From 6ba6c66ab556d95fd06d8d6376706e9c88d7bd7d Mon Sep 17 00:00:00 2001 From: Armin Brauns Date: Tue, 30 Jul 2024 12:47:52 +0000 Subject: [PATCH 0001/4482] hci_spi_st: send ACI config synchronously There's no reason to send these async, and since the reply isn't waited for anywhere, this can cause the HCI buffer pool to be exhausted and `bt_enable()` to fail. Signed-off-by: Armin Brauns --- drivers/bluetooth/hci/hci_spi_st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bluetooth/hci/hci_spi_st.c b/drivers/bluetooth/hci/hci_spi_st.c index fcfe2f4b75024..cc4d7f8b9d0e9 100644 --- a/drivers/bluetooth/hci/hci_spi_st.c +++ b/drivers/bluetooth/hci/hci_spi_st.c @@ -350,7 +350,7 @@ static int bt_spi_send_aci_config(uint8_t offset, const uint8_t *value, size_t v #if defined(CONFIG_BT_HCI_RAW) return bt_send(buf); #else - return bt_hci_cmd_send(BLUENRG_ACI_WRITE_CONFIG_DATA, buf); + return bt_hci_cmd_send_sync(BLUENRG_ACI_WRITE_CONFIG_DATA, buf, NULL); #endif /* CONFIG_BT_HCI_RAW */ } From 5bcb5242ed352f05b870d290c97c4388586064d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gero=20Schw=C3=A4ricke?= Date: Tue, 24 Sep 2024 22:41:22 +0200 Subject: [PATCH 0002/4482] modules: lvgl: fix multiple LVGL inputs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The LVGL input callback does not use an instance specific name, so we can only ever have one instance of this type. This issue was evident by a build error, e.g., when using "zephyr,lvgl-keypad-input" nodes twice: error: redefinition of '_input_callback__lvgl_keypad_process_event' Signed-off-by: Gero Schwäricke --- modules/lvgl/include/lvgl_common_input.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/lvgl/include/lvgl_common_input.h b/modules/lvgl/include/lvgl_common_input.h index 2d553e6dbdd69..f4aaffae2a2f3 100644 --- a/modules/lvgl/include/lvgl_common_input.h +++ b/modules/lvgl/include/lvgl_common_input.h @@ -36,8 +36,8 @@ int lvgl_init_input_devices(void); #define LVGL_KEY_VALID(key) IN_RANGE(key, 0, UINT8_MAX) #define LVGL_INPUT_DEFINE(inst, type, msgq_size, process_evt_cb) \ - INPUT_CALLBACK_DEFINE(LVGL_INPUT_DEVICE(inst), process_evt_cb, \ - (void *)DEVICE_DT_INST_GET(inst)); \ + INPUT_CALLBACK_DEFINE_NAMED(LVGL_INPUT_DEVICE(inst), process_evt_cb, \ + (void *)DEVICE_DT_INST_GET(inst), process_evt_cb_##inst); \ K_MSGQ_DEFINE(lvgl_input_msgq_##type##_##inst, sizeof(lv_indev_data_t), msgq_size, 4) #ifdef __cplusplus From d411421a2b1a3ccf36041bbc5c70c2321859bae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gero=20Schw=C3=A4ricke?= Date: Thu, 26 Sep 2024 20:52:35 +0200 Subject: [PATCH 0003/4482] input: fix missing namespace prefix for named input callbacks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using INPUT_CALLBACK_DEFINE_NAMED would not add the _input_callback__ prefix to the given callback name. This can result in namespace clashes. Signed-off-by: Gero Schwäricke --- include/zephyr/input/input.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/zephyr/input/input.h b/include/zephyr/input/input.h index 1fb04bb76c802..e43f14c66dd6b 100644 --- a/include/zephyr/input/input.h +++ b/include/zephyr/input/input.h @@ -137,7 +137,8 @@ struct input_callback { * same callback function. */ #define INPUT_CALLBACK_DEFINE_NAMED(_dev, _callback, _user_data, name) \ - static const STRUCT_SECTION_ITERABLE(input_callback, name) = { \ + static const STRUCT_SECTION_ITERABLE(input_callback, \ + _input_callback__##name) = { \ .dev = _dev, \ .callback = _callback, \ .user_data = _user_data, \ @@ -155,8 +156,7 @@ struct input_callback { * @param _user_data Pointer to user specified data. */ #define INPUT_CALLBACK_DEFINE(_dev, _callback, _user_data) \ - INPUT_CALLBACK_DEFINE_NAMED(_dev, _callback, _user_data, \ - _input_callback__##_callback) + INPUT_CALLBACK_DEFINE_NAMED(_dev, _callback, _user_data, _callback) #ifdef __cplusplus } From a50e0d9b3b2933a9ffd129d1dec8fc5caa0ed2f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gero=20Schw=C3=A4ricke?= Date: Thu, 26 Sep 2024 21:23:49 +0200 Subject: [PATCH 0004/4482] kscan: input: fix multiple kscan inputs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The kscan input callback does not use an instance specific name, so we can only ever have one instance of this type. Signed-off-by: Gero Schwäricke --- drivers/kscan/kscan_input.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/kscan/kscan_input.c b/drivers/kscan/kscan_input.c index 17481fc57d671..7e98ae4723e58 100644 --- a/drivers/kscan/kscan_input.c +++ b/drivers/kscan/kscan_input.c @@ -101,9 +101,10 @@ static const struct kscan_driver_api kscan_input_driver_api = { }; #define KSCAN_INPUT_INIT(index) \ - INPUT_CALLBACK_DEFINE(DEVICE_DT_GET(DT_INST_PARENT(index)), \ - kscan_input_cb, \ - (void *)DEVICE_DT_INST_GET(index)); \ + INPUT_CALLBACK_DEFINE_NAMED(DEVICE_DT_GET(DT_INST_PARENT(index)), \ + kscan_input_cb, \ + (void *)DEVICE_DT_INST_GET(index), \ + kscan_input_cb_##index); \ static const struct kscan_input_config kscan_input_config_##index = { \ .input_dev = DEVICE_DT_GET(DT_INST_PARENT(index)), \ }; \ From 8fda052826de630fc8a973325675759234a01fef Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Wed, 25 Sep 2024 16:13:10 +0200 Subject: [PATCH 0005/4482] net: Give name to logging choice This allows downstream modules to overwrite the default log level choice using Kconfig.defconfig files. For example, this becomes possible: ``` choice LWM2M_LOG_LEVEL_CHOICE default LWM2M_LOG_LEVEL_WRN endchoice ``` In contrast to the configuration method, this then has an effect on all applications stored in the downstream module. Signed-off-by: Reto Schneider --- subsys/net/Kconfig.template.log_config.net | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/Kconfig.template.log_config.net b/subsys/net/Kconfig.template.log_config.net index 49596a27e96e7..599f9d111ad5a 100644 --- a/subsys/net/Kconfig.template.log_config.net +++ b/subsys/net/Kconfig.template.log_config.net @@ -4,7 +4,7 @@ # Copyright (c) 2018 Intel Corporation. # SPDX-License-Identifier: Apache-2.0 -choice +choice "$(module)_LOG_LEVEL_CHOICE" prompt "$(module-str)" default $(module)_LOG_LEVEL_DEFAULT depends on $(module-dep) From 0ae12adcf073a5c9c0a47afcf5c89d6554675371 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 30 Sep 2024 17:29:02 +0300 Subject: [PATCH 0006/4482] manifest: Fix compilation warnings in hostap Hotfix for two compilation warning issues for wpa_drv_zep_event_dfs_cac_finished() and wpa_drv_zep_event_dfs_cac_started(), and for hmac_prf256() in hostap project. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 4eef52cdc9bdb..e07882f3adcd8 100644 --- a/west.yml +++ b/west.yml @@ -259,7 +259,7 @@ manifest: - hal - name: hostap path: modules/lib/hostap - revision: 291e1cd0dfad83ec02826adf48dd6db69c3471ca + revision: 9896a2ea803ec62e0998c0e569f12af88537d647 - name: libmetal revision: a6851ba6dba8c9e87d00c42f171a822f7a29639b path: modules/hal/libmetal From 6b167f2596f3171c0923fcc97b7974d0218dc8a4 Mon Sep 17 00:00:00 2001 From: Fabrice DJIATSA Date: Wed, 4 Sep 2024 09:46:16 +0200 Subject: [PATCH 0007/4482] drivers: clock_control: add calibration for h7 pllx_hsi This will calibrate the HSI's PLLX clocks if enabled The value rcc_hsicalibartion_default is 0x40U for h7/h7rs. Signed-off-by: Fabrice DJIATSA --- drivers/clock_control/clock_stm32_ll_h7.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/clock_control/clock_stm32_ll_h7.c b/drivers/clock_control/clock_stm32_ll_h7.c index e82dc42d56958..a8d177dd59fb9 100644 --- a/drivers/clock_control/clock_stm32_ll_h7.c +++ b/drivers/clock_control/clock_stm32_ll_h7.c @@ -675,9 +675,18 @@ static void set_up_fixed_clock_sources(void) } if (IS_ENABLED(STM32_HSI_ENABLED)) { - /* Enable HSI oscillator */ - LL_RCC_HSI_Enable(); - while (LL_RCC_HSI_IsReady() != 1) { + if (IS_ENABLED(STM32_PLL_SRC_HSI) || IS_ENABLED(STM32_PLL2_SRC_HSI) || ++ IS_ENABLED(STM32_PLL3_SRC_HSI)) { + /* HSI calibration */ + LL_RCC_HSI_SetCalibTrimming(RCC_HSICALIBRATION_DEFAULT); + } + /* Enable HSI if not enabled */ + if (LL_RCC_HSI_IsReady() != 1) { + /* Enable HSI oscillator */ + LL_RCC_HSI_Enable(); + while (LL_RCC_HSI_IsReady() != 1) { + /* Wait for HSI ready */ + } } /* HSI divider configuration */ LL_RCC_HSI_SetDivider(hsi_divider(STM32_HSI_DIVISOR)); From 319d67f7d318e43a316edd959b99257e51bf180a Mon Sep 17 00:00:00 2001 From: Dominik Lau Date: Fri, 23 Aug 2024 08:14:27 +0200 Subject: [PATCH 0008/4482] fs: ext2: add alignment for superblock Reading superblock didn't work with DMAs that only support aligned reads (e.g. STM32 DMA). Co-authored-by: Maciej Sobkowski Signed-off-by: Dominik Lau --- subsys/fs/ext2/Kconfig | 9 +++++++++ subsys/fs/ext2/ext2_ops.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/subsys/fs/ext2/Kconfig b/subsys/fs/ext2/Kconfig index f3beec883716f..9633a595b61a4 100644 --- a/subsys/fs/ext2/Kconfig +++ b/subsys/fs/ext2/Kconfig @@ -44,5 +44,14 @@ config EXT2_DISK_STARTING_SECTOR The current Ext2 implementation does not support GUID Partition Table. The starting sector of the file system must be specified by this option. +config EXT2_SUPERBLOCK_ALIGNMENT + int "Ext2 superblock alignment" + default 1 + help + Some SD host controllers require alignment of their data buffers + in order for DMA to work correctly. Devices should change default of + this value if they require alignment. This represents the alignment + of struct ext2_disk_superblock in bytes. + endmenu endif diff --git a/subsys/fs/ext2/ext2_ops.c b/subsys/fs/ext2/ext2_ops.c index 297601c564697..10acb8c891e1c 100644 --- a/subsys/fs/ext2/ext2_ops.c +++ b/subsys/fs/ext2/ext2_ops.c @@ -361,8 +361,9 @@ FS_EXT2_DECLARE_DEFAULT_CONFIG(ext2_default_cfg); /* Superblock is used only once. Because ext2 may have only one instance at the time we could * statically allocate this strusture. + * Alignment needed for reads to work with DMAs that force it (e.g. stm32 SDMMC + DMA). */ -static struct ext2_disk_superblock superblock; +static struct ext2_disk_superblock __aligned(CONFIG_EXT2_SUPERBLOCK_ALIGNMENT) superblock; static int ext2_mount(struct fs_mount_t *mountp) { From 744fe5284ac160d844a51b6f57c9dfccd38cbe57 Mon Sep 17 00:00:00 2001 From: Dominik Lau Date: Fri, 23 Aug 2024 08:24:18 +0200 Subject: [PATCH 0009/4482] drivers: disk: sdmmc: stm32: add missing DMA stream deinitialization Due to deinitialization not happening, reinitialization of the disk did not happen as the streams were marked busy. Signed-off-by: Dominik Lau --- drivers/disk/sdmmc_stm32.c | 59 +++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/drivers/disk/sdmmc_stm32.c b/drivers/disk/sdmmc_stm32.c index a344bb9d19235..1ce9e8e16d971 100644 --- a/drivers/disk/sdmmc_stm32.c +++ b/drivers/disk/sdmmc_stm32.c @@ -89,6 +89,8 @@ struct stm32_sdmmc_priv { #if STM32_SDMMC_USE_DMA struct sdmmc_dma_stream dma_rx; struct sdmmc_dma_stream dma_tx; + DMA_HandleTypeDef dma_tx_handle; + DMA_HandleTypeDef dma_rx_handle; #endif }; @@ -230,33 +232,50 @@ static int stm32_sdmmc_configure_dma(DMA_HandleTypeDef *handle, struct sdmmc_dma static int stm32_sdmmc_dma_init(struct stm32_sdmmc_priv *priv) { - static DMA_HandleTypeDef dma_tx_handle; - static DMA_HandleTypeDef dma_rx_handle; int err; LOG_DBG("using dma"); - err = stm32_sdmmc_configure_dma(&dma_tx_handle, &priv->dma_tx); + err = stm32_sdmmc_configure_dma(&priv->dma_tx_handle, &priv->dma_tx); if (err) { LOG_ERR("failed to init tx dma"); return err; } - __HAL_LINKDMA(&priv->hsd, hdmatx, dma_tx_handle); - HAL_DMA_DeInit(&dma_tx_handle); - HAL_DMA_Init(&dma_tx_handle); + __HAL_LINKDMA(&priv->hsd, hdmatx, priv->dma_tx_handle); + HAL_DMA_Init(&priv->dma_tx_handle); - err = stm32_sdmmc_configure_dma(&dma_rx_handle, &priv->dma_rx); + err = stm32_sdmmc_configure_dma(&priv->dma_rx_handle, &priv->dma_rx); if (err) { LOG_ERR("failed to init rx dma"); return err; } - __HAL_LINKDMA(&priv->hsd, hdmarx, dma_rx_handle); - HAL_DMA_DeInit(&dma_rx_handle); - HAL_DMA_Init(&dma_rx_handle); + __HAL_LINKDMA(&priv->hsd, hdmarx, priv->dma_rx_handle); + HAL_DMA_Init(&priv->dma_rx_handle); return err; } +static int stm32_sdmmc_dma_deinit(struct stm32_sdmmc_priv *priv) +{ + int ret; + struct sdmmc_dma_stream *dma_tx = &priv->dma_tx; + struct sdmmc_dma_stream *dma_rx = &priv->dma_rx; + + ret = dma_stop(dma_tx->dev, dma_tx->channel); + HAL_DMA_DeInit(&priv->dma_tx_handle); + if (ret != 0) { + LOG_ERR("Failed to stop tx DMA transmission"); + return ret; + } + ret = dma_stop(dma_rx->dev, dma_rx->channel); + HAL_DMA_DeInit(&priv->dma_rx_handle); + if (ret != 0) { + LOG_ERR("Failed to stop rx DMA transmission"); + return ret; + } + return ret; +} + #endif static int stm32_sdmmc_access_init(struct disk_info *disk) @@ -309,13 +328,27 @@ static int stm32_sdmmc_access_init(struct disk_info *disk) static int stm32_sdmmc_access_deinit(struct stm32_sdmmc_priv *priv) { + int err = 0; + +#if STM32_SDMMC_USE_DMA + err = stm32_sdmmc_dma_deinit(priv); + if (err) { + LOG_ERR("DMA deinit failed"); + return err; + } +#endif + #if defined(CONFIG_SDMMC_STM32_EMMC) - HAL_MMC_DeInit(&priv->hsd); + err = HAL_MMC_DeInit(&priv->hsd); #else - HAL_SD_DeInit(&priv->hsd); - + err = HAL_SD_DeInit(&priv->hsd); stm32_sdmmc_clock_disable(priv); #endif + if (err != HAL_OK) { + LOG_ERR("failed to deinit stm32_sdmmc (ErrorCode 0x%X)", priv->hsd.ErrorCode); + return err; + } + priv->status = DISK_STATUS_UNINIT; return 0; } From 1e1c14cfee99c2c28ec45fedd70d295bbb42fca4 Mon Sep 17 00:00:00 2001 From: Dominik Lau Date: Fri, 23 Aug 2024 08:21:25 +0200 Subject: [PATCH 0010/4482] drivers: dma: stm32: fix dma_stop stream busy handling for HAL override For DMA channels overridden by HAL DMA, there was no way of resetting stream busy variable. Co-authored-by: Maciej Sobkowski Signed-off-by: Dominik Lau --- drivers/dma/dma_stm32.c | 5 +++++ drivers/dma/dma_stm32_bdma.c | 5 +++++ drivers/dma/dma_stm32u5.c | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/drivers/dma/dma_stm32.c b/drivers/dma/dma_stm32.c index 2aa9eab78d21e..1b8d1629d5698 100644 --- a/drivers/dma/dma_stm32.c +++ b/drivers/dma/dma_stm32.c @@ -604,6 +604,11 @@ DMA_STM32_EXPORT_API int dma_stm32_stop(const struct device *dev, uint32_t id) return -EINVAL; } + if (stream->hal_override) { + stream->busy = false; + return 0; + } + /* Repeated stop : return now if channel is already stopped */ if (!stm32_dma_is_enabled_stream(dma, id)) { return 0; diff --git a/drivers/dma/dma_stm32_bdma.c b/drivers/dma/dma_stm32_bdma.c index 3712bf9e6e80c..c5f5c6c74ea4b 100644 --- a/drivers/dma/dma_stm32_bdma.c +++ b/drivers/dma/dma_stm32_bdma.c @@ -758,6 +758,11 @@ BDMA_STM32_EXPORT_API int bdma_stm32_stop(const struct device *dev, uint32_t id) return -EINVAL; } + if (stream->hal_override) { + stream->busy = false; + return 0; + } + /* Repeated stop : return now if channel is already stopped */ if (!stm32_bdma_is_enabled_channel(bdma, id)) { return 0; diff --git a/drivers/dma/dma_stm32u5.c b/drivers/dma/dma_stm32u5.c index 34a063ef242c6..ca57ee8f36a90 100644 --- a/drivers/dma/dma_stm32u5.c +++ b/drivers/dma/dma_stm32u5.c @@ -638,6 +638,11 @@ static int dma_stm32_stop(const struct device *dev, uint32_t id) return -EINVAL; } + if (stream->hal_override) { + stream->busy = false; + return 0; + } + /* Repeated stop : return now if channel is already stopped */ if (!stm32_dma_is_enabled_stream(dma, id)) { return 0; From 455b45780d6bd476e1a96e2d1d6a8b5a7ce238db Mon Sep 17 00:00:00 2001 From: Dominik Lau Date: Thu, 29 Aug 2024 12:47:12 +0200 Subject: [PATCH 0011/4482] tests: drivers: dma: run dma tests on stm32f746g_disco enabled dma loop transfer and channel blend to run on stm32f746g_disco Signed-off-by: Dominik Lau --- boards/st/stm32f746g_disco/stm32f746g_disco.yaml | 1 + .../chan_blen_transfer/boards/stm32f746g_disco.conf | 2 ++ .../boards/stm32f746g_disco.overlay | 13 +++++++++++++ .../dma/loop_transfer/boards/stm32f746g_disco.conf | 1 + .../loop_transfer/boards/stm32f746g_disco.overlay | 13 +++++++++++++ 5 files changed, 30 insertions(+) create mode 100644 tests/drivers/dma/chan_blen_transfer/boards/stm32f746g_disco.conf create mode 100644 tests/drivers/dma/chan_blen_transfer/boards/stm32f746g_disco.overlay create mode 100644 tests/drivers/dma/loop_transfer/boards/stm32f746g_disco.conf create mode 100644 tests/drivers/dma/loop_transfer/boards/stm32f746g_disco.overlay diff --git a/boards/st/stm32f746g_disco/stm32f746g_disco.yaml b/boards/st/stm32f746g_disco/stm32f746g_disco.yaml index 5442db5bb6737..7d58f2b1f2b90 100644 --- a/boards/st/stm32f746g_disco/stm32f746g_disco.yaml +++ b/boards/st/stm32f746g_disco/stm32f746g_disco.yaml @@ -19,4 +19,5 @@ supported: - usb_device - display - memc + - dma vendor: st diff --git a/tests/drivers/dma/chan_blen_transfer/boards/stm32f746g_disco.conf b/tests/drivers/dma/chan_blen_transfer/boards/stm32f746g_disco.conf new file mode 100644 index 0000000000000..ded0d42ac5609 --- /dev/null +++ b/tests/drivers/dma/chan_blen_transfer/boards/stm32f746g_disco.conf @@ -0,0 +1,2 @@ +CONFIG_DMA_TRANSFER_CHANNEL_NR_0=0 +CONFIG_DMA_TRANSFER_CHANNEL_NR_1=1 diff --git a/tests/drivers/dma/chan_blen_transfer/boards/stm32f746g_disco.overlay b/tests/drivers/dma/chan_blen_transfer/boards/stm32f746g_disco.overlay new file mode 100644 index 0000000000000..c189d0fed6fc0 --- /dev/null +++ b/tests/drivers/dma/chan_blen_transfer/boards/stm32f746g_disco.overlay @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2024 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + */ + +tst_dma0: &dma2 { + status = "okay"; +}; + +&sram0 { + zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_RAM_NOCACHE) )>; +}; diff --git a/tests/drivers/dma/loop_transfer/boards/stm32f746g_disco.conf b/tests/drivers/dma/loop_transfer/boards/stm32f746g_disco.conf new file mode 100644 index 0000000000000..5f10ed9e1abf6 --- /dev/null +++ b/tests/drivers/dma/loop_transfer/boards/stm32f746g_disco.conf @@ -0,0 +1 @@ +CONFIG_DMA_LOOP_TRANSFER_CHANNEL_NR=4 diff --git a/tests/drivers/dma/loop_transfer/boards/stm32f746g_disco.overlay b/tests/drivers/dma/loop_transfer/boards/stm32f746g_disco.overlay new file mode 100644 index 0000000000000..c189d0fed6fc0 --- /dev/null +++ b/tests/drivers/dma/loop_transfer/boards/stm32f746g_disco.overlay @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2024 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + */ + +tst_dma0: &dma2 { + status = "okay"; +}; + +&sram0 { + zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_RAM_NOCACHE) )>; +}; From 5ec39011ccfc86a4cad9224ee4b580bc5027b4fa Mon Sep 17 00:00:00 2001 From: Dominik Lau Date: Fri, 30 Aug 2024 11:21:52 +0200 Subject: [PATCH 0012/4482] drivers: disk: sdmmc: enabled SDMMC DMA for stm32f7x This enables the usage of DMA for stm32f7x in the sdmmc driver. Co-authored-by: Maciej Sobkowski Signed-off-by: Dominik Lau --- drivers/disk/Kconfig.sdmmc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/disk/Kconfig.sdmmc b/drivers/disk/Kconfig.sdmmc index 7b73058e4a5e9..9b49d3d40c21e 100644 --- a/drivers/disk/Kconfig.sdmmc +++ b/drivers/disk/Kconfig.sdmmc @@ -2,7 +2,7 @@ # Copyright (c) 2021 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -DT_STM32_SDMMC_HAS_DMA := $(dt_nodelabel_has_prop,sdmmc,dmas) +DT_STM32_SDMMC_HAS_DMA := $(dt_compat_any_has_prop,$(DT_COMPAT_ST_STM32_SDMMC),dmas) config DISK_DRIVER_SDMMC bool "SDMMC card driver" @@ -45,7 +45,7 @@ config SDMMC_STM32 select USE_STM32_HAL_MMC_EX if SDMMC_STM32_EMMC && SOC_SERIES_STM32L4X select USE_STM32_LL_SDMMC select USE_STM32_HAL_DMA if (SOC_SERIES_STM32L4X || SOC_SERIES_STM32F7X || SOC_SERIES_STM32F4X) - select DMA if ($(DT_STM32_SDMMC_HAS_DMA) && SOC_SERIES_STM32F4X) + select DMA if $(DT_STM32_SDMMC_HAS_DMA) && (SOC_SERIES_STM32F4X || SOC_SERIES_STM32F7X) select PINCTRL select RESET help From 9f0b96d77cf2a752a8c4d71aec88314e0e6c31a0 Mon Sep 17 00:00:00 2001 From: Maciej Sobkowski Date: Wed, 25 Sep 2024 11:29:54 +0200 Subject: [PATCH 0013/4482] samples: fs: Add stm32f746g_disco with DMA enabled to fs_sample Adds custom overlay and config allowing the fs_sample to run on the stm32f746g_disco with DMA enabled. Signed-off-by: Maciej Sobkowski --- .../fs/fs_sample/boards/stm32f746g_disco_dma.conf | 7 +++++++ .../fs_sample/boards/stm32f746g_disco_dma.overlay | 14 ++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 samples/subsys/fs/fs_sample/boards/stm32f746g_disco_dma.conf create mode 100644 samples/subsys/fs/fs_sample/boards/stm32f746g_disco_dma.overlay diff --git a/samples/subsys/fs/fs_sample/boards/stm32f746g_disco_dma.conf b/samples/subsys/fs/fs_sample/boards/stm32f746g_disco_dma.conf new file mode 100644 index 0000000000000..df3df4f407a86 --- /dev/null +++ b/samples/subsys/fs/fs_sample/boards/stm32f746g_disco_dma.conf @@ -0,0 +1,7 @@ +# +# Copyright (c) 2024 Antmicro +# +# SPDX-License-Identifier: Apache-2.0 +# + +CONFIG_EXT2_SUPERBLOCK_ALIGNMENT=32 diff --git a/samples/subsys/fs/fs_sample/boards/stm32f746g_disco_dma.overlay b/samples/subsys/fs/fs_sample/boards/stm32f746g_disco_dma.overlay new file mode 100644 index 0000000000000..f07c1cf3bee0e --- /dev/null +++ b/samples/subsys/fs/fs_sample/boards/stm32f746g_disco_dma.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2024 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&sdmmc1 { + dmas = <&dma2 6 4 0x30000 0x00>, <&dma2 3 4 0x30000 0x00>; + dma-names = "tx", "rx"; +}; + +&dma2 { + status = "okay"; +}; From a4169e6141f28be929394a65bcc4553c2f38823c Mon Sep 17 00:00:00 2001 From: Abderrahmane Jarmouni Date: Wed, 11 Sep 2024 00:30:21 +0200 Subject: [PATCH 0014/4482] boards: st: update board.cmake Update forgotten boards following PR 75284 Signed-off-by: Abderrahmane Jarmouni --- boards/st/nucleo_u031r8/board.cmake | 2 ++ boards/st/nucleo_u083rc/board.cmake | 2 ++ boards/st/nucleo_wb05kz/board.cmake | 2 ++ boards/st/nucleo_wb09ke/board.cmake | 2 ++ boards/st/stm32u083c_dk/board.cmake | 2 ++ 5 files changed, 10 insertions(+) diff --git a/boards/st/nucleo_u031r8/board.cmake b/boards/st/nucleo_u031r8/board.cmake index 7028d124f2067..fbd5f1ed8e761 100644 --- a/boards/st/nucleo_u031r8/board.cmake +++ b/boards/st/nucleo_u031r8/board.cmake @@ -1,9 +1,11 @@ +# keep first board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw") board_runner_args(pyocd "--target=stm32u031r8tx") board_runner_args(jlink "--device=STM32U031R8" "--reset-after-load") +# keep first include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake) include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/st/nucleo_u083rc/board.cmake b/boards/st/nucleo_u083rc/board.cmake index d969b9dff1a0b..2195ba62540ed 100644 --- a/boards/st/nucleo_u083rc/board.cmake +++ b/boards/st/nucleo_u083rc/board.cmake @@ -1,9 +1,11 @@ +# keep first board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw") board_runner_args(pyocd "--target=stm32u083rctx") board_runner_args(jlink "--device=STM32U083RC" "--reset-after-load") +# keep first include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake) include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/st/nucleo_wb05kz/board.cmake b/boards/st/nucleo_wb05kz/board.cmake index 15bdb8e444dec..a6b62f37ce2db 100644 --- a/boards/st/nucleo_wb05kz/board.cmake +++ b/boards/st/nucleo_wb05kz/board.cmake @@ -1,5 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 +# keep first board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=sw") +# keep first include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake) include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/st/nucleo_wb09ke/board.cmake b/boards/st/nucleo_wb09ke/board.cmake index 15bdb8e444dec..a6b62f37ce2db 100644 --- a/boards/st/nucleo_wb09ke/board.cmake +++ b/boards/st/nucleo_wb09ke/board.cmake @@ -1,5 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 +# keep first board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=sw") +# keep first include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake) include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/st/stm32u083c_dk/board.cmake b/boards/st/stm32u083c_dk/board.cmake index a274ab952ee48..10df49ddf0e7c 100644 --- a/boards/st/stm32u083c_dk/board.cmake +++ b/boards/st/stm32u083c_dk/board.cmake @@ -1,9 +1,11 @@ +# keep first board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw") board_runner_args(pyocd "--target=stm32u083mctx") board_runner_args(jlink "--device=STM32U083C-DK" "--reset-after-load") +# keep first include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake) include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) From 77f025dd195f7afe4efd0fbb61b031640058d2fb Mon Sep 17 00:00:00 2001 From: Abderrahmane Jarmouni Date: Wed, 11 Sep 2024 00:30:47 +0200 Subject: [PATCH 0015/4482] boards: st: update doc Update forgotten boards following PR 75284 Signed-off-by: Abderrahmane Jarmouni --- boards/st/nucleo_u031r8/doc/index.rst | 18 +++++++++++------- boards/st/stm32h750b_dk/doc/index.rst | 20 ++++++++++++++++++++ boards/st/stm32u083c_dk/doc/index.rst | 2 +- boards/st/stm32u5a9j_dk/doc/index.rst | 14 ++++++++++++-- 4 files changed, 44 insertions(+), 10 deletions(-) diff --git a/boards/st/nucleo_u031r8/doc/index.rst b/boards/st/nucleo_u031r8/doc/index.rst index 7b1aef56a4e2c..c9c327ad0922a 100644 --- a/boards/st/nucleo_u031r8/doc/index.rst +++ b/boards/st/nucleo_u031r8/doc/index.rst @@ -198,15 +198,19 @@ This probe allows to flash the board using various tools. Flashing ======== -Board is configured to be flashed using west STM32CubeProgrammer runner. -Installation of `STM32CubeProgrammer`_ is then required to flash the board. +The board is configured to be flashed using west `STM32CubeProgrammer`_ runner, +so its :ref:`installation ` is required. -Alternatively, pyocd or jlink via an external probe can also be used to flash -and debug the board if west is told to use it as runner, which can be done by -passing either or ``-r pyocd``, or ``-r jlink``. +Alternatively, JLink or pyOCD can also be used to flash the board using +the ``--runner`` (or ``-r``) option: -For pyocd additional target information needs to be installed. -This can be done by executing the following commands. +.. code-block:: console + + $ west flash --runner pyocd + $ west flash --runner jlink + +For pyOCD, additional target information needs to be installed +by executing the following pyOCD commands: .. code-block:: console diff --git a/boards/st/stm32h750b_dk/doc/index.rst b/boards/st/stm32h750b_dk/doc/index.rst index 3e2cd3d009eb7..d3fc2c252f419 100644 --- a/boards/st/stm32h750b_dk/doc/index.rst +++ b/boards/st/stm32h750b_dk/doc/index.rst @@ -96,12 +96,29 @@ COM port interface. Default communication settings are 115200 8N1. Programming and Debugging ************************* +STM32H750B Discovery kit includes an ST-LINK-V3E embedded debug tool interface. +This probe allows flashing and debugging the board using various tools. + See :ref:`build_an_application` for more information about application builds. Flashing ======== +The board is configured to be flashed using west `STM32CubeProgrammer`_ runner, +so its :ref:`installation ` is required. + +Alternatively, OpenOCD or JLink can also be used to flash the board using +the ``--runner`` (or ``-r``) option: + +.. code-block:: console + + $ west flash --runner openocd + $ west flash --runner jlink + +Flashing an application to STM32H750B_DK +---------------------------------------- + Connect the STM32H750B-DK to your host computer using the ST-LINK USB port, then run a serial host program to connect with the board. For example: @@ -147,3 +164,6 @@ You can debug an application in the usual way. Here is an example for the .. _STM32H750xx datasheet: https://www.st.com/resource/en/datasheet/stm32h750ib.pdf + +.. _STM32CubeProgrammer: + https://www.st.com/en/development-tools/stm32cubeprog.html diff --git a/boards/st/stm32u083c_dk/doc/index.rst b/boards/st/stm32u083c_dk/doc/index.rst index 25c632e1d4d9a..8d70934de6360 100644 --- a/boards/st/stm32u083c_dk/doc/index.rst +++ b/boards/st/stm32u083c_dk/doc/index.rst @@ -242,7 +242,7 @@ This can be done by executing the following commands. Flashing an application to STM32U083C_DK ------------------------------------------- +---------------------------------------- Connect the STM32U083C_DK to your host computer using the USB port. Then build and flash an application. Here is an example for the diff --git a/boards/st/stm32u5a9j_dk/doc/index.rst b/boards/st/stm32u5a9j_dk/doc/index.rst index 571ee80f334b1..54d4124303e0e 100644 --- a/boards/st/stm32u5a9j_dk/doc/index.rst +++ b/boards/st/stm32u5a9j_dk/doc/index.rst @@ -142,8 +142,18 @@ This probe allows to flash and debug the board using various tools. Flashing ======== -Board is configured to be flashed using west STM32CubeProgrammer runner. -Installation of `STM32CubeProgrammer`_ is then required to flash the board., +The board is configured to be flashed using west `STM32CubeProgrammer`_ runner, +so its :ref:`installation ` is required. + +Alternatively, OpenOCD can also be used to flash the board using +the ``--runner`` (or ``-r``) option: + +.. code-block:: console + + $ west flash --runner openocd + +Flashing an application to STM32U5A9J_DK +---------------------------------------- Connect the STM32U5A9J Discovery board to your host computer using the USB port, then run a serial host program to connect with your Discovery From f8bac1ac1b6b29ee8128bcc649f5e528c036a22c Mon Sep 17 00:00:00 2001 From: Abderrahmane Jarmouni Date: Wed, 11 Sep 2024 00:31:43 +0200 Subject: [PATCH 0016/4482] doc: develop: flash_debug: host-tools: fix typo Fix registred trademark typo Signed-off-by: Abderrahmane Jarmouni --- doc/develop/flash_debug/host-tools.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/develop/flash_debug/host-tools.rst b/doc/develop/flash_debug/host-tools.rst index 1ad2751582e83..04c3cae1b8587 100644 --- a/doc/develop/flash_debug/host-tools.rst +++ b/doc/develop/flash_debug/host-tools.rst @@ -481,7 +481,7 @@ STM32CubeProgrammer Flash Host Tools ************************************ STMicroelectronics provides `STM32CubeProgrammer`_ (STM32CubeProg) as an official programming tool -for STM32 boards on Linux|r|, macOS|r|, and Windows|r| operating systems. +for STM32 boards on Linux |reg|, macOS |reg|, and Windows |reg| operating systems. It provides an easy-to-use and efficient environment for reading, writing, and verifying device memory through both the debug interface (JTAG and SWD) and the bootloader interface (UART and USB DFU, I2C, SPI, and CAN). From 740eba1341ab2456c97390ea71d4be5d9ff8bab7 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 23 Sep 2024 10:29:40 +0200 Subject: [PATCH 0017/4482] pm: device: allow optional support of TURN_ON action Some devices, e.g. SoC level devices like I2C peripheral, can never be powerd off as they are always energized. Such devices can only go from an active state or to a low power state (suspended). Allow them to simply return -ENOTSUP when called with TURN_ON (or TURN_OFF). Signed-off-by: Gerard Marull-Paretas --- include/zephyr/pm/device.h | 5 +++-- subsys/pm/device.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/zephyr/pm/device.h b/include/zephyr/pm/device.h index 26e4a80377455..a6e2ef032c0d3 100644 --- a/include/zephyr/pm/device.h +++ b/include/zephyr/pm/device.h @@ -625,7 +625,8 @@ bool pm_device_is_powered(const struct device *dev); * This helper function is intended to be called at the end of a driver * init function to automatically setup the device into the lowest power * mode. It assumes that the device has been configured as if it is in - * @ref PM_DEVICE_STATE_OFF. + * @ref PM_DEVICE_STATE_OFF, or @ref PM_DEVICE_STATE_SUSPENDED if device can + * never be powered off. * * @param dev Device instance. * @param action_cb Device PM control callback function. @@ -718,7 +719,7 @@ static inline int pm_device_driver_init(const struct device *dev, pm_device_acti /* When power management is not enabled, all drivers should initialise to active state */ rc = action_cb(dev, PM_DEVICE_ACTION_TURN_ON); - if (rc < 0) { + if ((rc < 0) && (rc != -ENOTSUP)) { return rc; } diff --git a/subsys/pm/device.c b/subsys/pm/device.c index f272a2a8e2884..518e20a8630dd 100644 --- a/subsys/pm/device.c +++ b/subsys/pm/device.c @@ -370,7 +370,7 @@ int pm_device_driver_init(const struct device *dev, /* Run power-up logic */ rc = action_cb(dev, PM_DEVICE_ACTION_TURN_ON); - if (rc != 0) { + if ((rc < 0) && (rc != -ENOTSUP)) { return rc; } From 9f0ebb64a610745f2dd14a4b6adae8b7023134fe Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 23 Sep 2024 10:32:18 +0200 Subject: [PATCH 0018/4482] drivers: i2c: nrfx_twim: simplify PM by using pm_device_driver_init - Driver always initializes the device in the suspended state - If CONFIG_PM_DEVICE_RUNTIME=n, device PM callback will be called with RESUME action, thus setting up pins to default state and enabling the peripheral NOTE: when CONFIG_PM_DEVICE=n, the pinctrl sleep state will not be available (-ENOENT) and so never applied, thus avoiding a pin suspended->active transition. Signed-off-by: Gerard Marull-Paretas --- drivers/i2c/i2c_nrfx_twim.c | 39 +++---------------- dts/arm/nordic/nrf52805.dtsi | 1 + dts/arm/nordic/nrf52810.dtsi | 1 + dts/arm/nordic/nrf52811.dtsi | 1 + dts/arm/nordic/nrf52820.dtsi | 2 + dts/arm/nordic/nrf52832.dtsi | 2 + dts/arm/nordic/nrf52833.dtsi | 2 + dts/arm/nordic/nrf52840.dtsi | 2 + .../nordic/nrf5340_cpuapp_peripherals.dtsi | 4 ++ dts/arm/nordic/nrf5340_cpunet.dtsi | 1 + dts/arm/nordic/nrf91_peripherals.dtsi | 4 ++ dts/common/nordic/nrf54h20.dtsi | 8 ++++ dts/common/nordic/nrf54l15.dtsi | 4 ++ dts/common/nordic/nrf54l20.dtsi | 4 ++ dts/common/nordic/nrf9280.dtsi | 8 ++++ 15 files changed, 50 insertions(+), 33 deletions(-) diff --git a/drivers/i2c/i2c_nrfx_twim.c b/drivers/i2c/i2c_nrfx_twim.c index 4d1ff0f4640b2..e38512137edf6 100644 --- a/drivers/i2c/i2c_nrfx_twim.c +++ b/drivers/i2c/i2c_nrfx_twim.c @@ -297,40 +297,26 @@ static const struct i2c_driver_api i2c_nrfx_twim_driver_api = { .recover_bus = i2c_nrfx_twim_recover_bus, }; -#ifdef CONFIG_PM_DEVICE static int twim_nrfx_pm_action(const struct device *dev, enum pm_device_action action) { const struct i2c_nrfx_twim_config *dev_config = dev->config; - int ret = 0; switch (action) { case PM_DEVICE_ACTION_RESUME: - ret = pinctrl_apply_state(dev_config->pcfg, - PINCTRL_STATE_DEFAULT); - if (ret < 0) { - return ret; - } + (void)pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_DEFAULT); nrfx_twim_enable(&dev_config->twim); break; - case PM_DEVICE_ACTION_SUSPEND: nrfx_twim_disable(&dev_config->twim); - - ret = pinctrl_apply_state(dev_config->pcfg, - PINCTRL_STATE_SLEEP); - if (ret < 0) { - return ret; - } + (void)pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_SLEEP); break; - default: - ret = -ENOTSUP; + return -ENOTSUP; } - return ret; + return 0; } -#endif /* CONFIG_PM_DEVICE */ static int i2c_nrfx_twim_init(const struct device *dev) { @@ -342,13 +328,7 @@ static int i2c_nrfx_twim_init(const struct device *dev) k_sem_init(&dev_data->transfer_sync, 1, 1); k_sem_init(&dev_data->completion_sync, 0, 1); - int err = pinctrl_apply_state(dev_config->pcfg, - COND_CODE_1(CONFIG_PM_DEVICE_RUNTIME, - (PINCTRL_STATE_SLEEP), - (PINCTRL_STATE_DEFAULT))); - if (err < 0) { - return err; - } + (void)pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_SLEEP); if (nrfx_twim_init(&dev_config->twim, &dev_config->twim_config, event_handler, dev_data) != NRFX_SUCCESS) { @@ -356,14 +336,7 @@ static int i2c_nrfx_twim_init(const struct device *dev) return -EIO; } -#ifdef CONFIG_PM_DEVICE_RUNTIME - pm_device_init_suspended(dev); - pm_device_runtime_enable(dev); -#else - nrfx_twim_enable(&dev_config->twim); -#endif - - return 0; + return pm_device_driver_init(dev, twim_nrfx_pm_action); } #define I2C_NRFX_TWIM_INVALID_FREQUENCY ((nrf_twim_frequency_t)-1) diff --git a/dts/arm/nordic/nrf52805.dtsi b/dts/arm/nordic/nrf52805.dtsi index 07f3e8ed7d3e5..c8fafe99154b5 100644 --- a/dts/arm/nordic/nrf52805.dtsi +++ b/dts/arm/nordic/nrf52805.dtsi @@ -130,6 +130,7 @@ interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <14>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi0: spi@40004000 { diff --git a/dts/arm/nordic/nrf52810.dtsi b/dts/arm/nordic/nrf52810.dtsi index 3acbf81c56c37..73aa5a0da0c7a 100644 --- a/dts/arm/nordic/nrf52810.dtsi +++ b/dts/arm/nordic/nrf52810.dtsi @@ -134,6 +134,7 @@ interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <10>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi0: spi@40004000 { diff --git a/dts/arm/nordic/nrf52811.dtsi b/dts/arm/nordic/nrf52811.dtsi index 2f1660c052ea6..8479950d17a56 100644 --- a/dts/arm/nordic/nrf52811.dtsi +++ b/dts/arm/nordic/nrf52811.dtsi @@ -146,6 +146,7 @@ interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <14>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi1: spi@40003000 { diff --git a/dts/arm/nordic/nrf52820.dtsi b/dts/arm/nordic/nrf52820.dtsi index 1553a6481d2b1..9780e06af4b0b 100644 --- a/dts/arm/nordic/nrf52820.dtsi +++ b/dts/arm/nordic/nrf52820.dtsi @@ -149,6 +149,7 @@ interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <15>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi0: spi@40003000 { @@ -185,6 +186,7 @@ interrupts = <4 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <15>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi1: spi@40004000 { diff --git a/dts/arm/nordic/nrf52832.dtsi b/dts/arm/nordic/nrf52832.dtsi index ccd8bda3ab341..30fb92f71aa5f 100644 --- a/dts/arm/nordic/nrf52832.dtsi +++ b/dts/arm/nordic/nrf52832.dtsi @@ -134,6 +134,7 @@ interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <8>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi0: spi@40003000 { @@ -170,6 +171,7 @@ interrupts = <4 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <8>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi1: spi@40004000 { diff --git a/dts/arm/nordic/nrf52833.dtsi b/dts/arm/nordic/nrf52833.dtsi index 1029d2a423918..8ca66986111de 100644 --- a/dts/arm/nordic/nrf52833.dtsi +++ b/dts/arm/nordic/nrf52833.dtsi @@ -148,6 +148,7 @@ interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi0: spi@40003000 { @@ -184,6 +185,7 @@ interrupts = <4 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi1: spi@40004000 { diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index 718f8a562b7f2..4c52ff127b57f 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -136,6 +136,7 @@ interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi0: spi@40003000 { @@ -172,6 +173,7 @@ interrupts = <4 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi1: spi@40004000 { diff --git a/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi index f976061e98997..a1ca9e71e0c94 100644 --- a/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi @@ -119,6 +119,7 @@ i2c0: i2c@8000 { interrupts = <8 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi0: spi@8000 { @@ -160,6 +161,7 @@ i2c1: i2c@9000 { interrupts = <9 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi1: spi@9000 { @@ -214,6 +216,7 @@ i2c2: i2c@b000 { interrupts = <11 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi2: spi@b000 { @@ -255,6 +258,7 @@ i2c3: i2c@c000 { interrupts = <12 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi3: spi@c000 { diff --git a/dts/arm/nordic/nrf5340_cpunet.dtsi b/dts/arm/nordic/nrf5340_cpunet.dtsi index 77b77759b2205..81065d9aee954 100644 --- a/dts/arm/nordic/nrf5340_cpunet.dtsi +++ b/dts/arm/nordic/nrf5340_cpunet.dtsi @@ -205,6 +205,7 @@ interrupts = <19 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi0: spi@41013000 { diff --git a/dts/arm/nordic/nrf91_peripherals.dtsi b/dts/arm/nordic/nrf91_peripherals.dtsi index 93abc17d48b94..1be26d50af9c1 100644 --- a/dts/arm/nordic/nrf91_peripherals.dtsi +++ b/dts/arm/nordic/nrf91_peripherals.dtsi @@ -160,6 +160,7 @@ i2c0: i2c@8000 { interrupts = <8 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <13>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; i2c1: i2c@9000 { @@ -176,6 +177,7 @@ i2c1: i2c@9000 { interrupts = <9 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <13>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; i2c2: i2c@a000 { @@ -192,6 +194,7 @@ i2c2: i2c@a000 { interrupts = <10 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <13>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; i2c3: i2c@b000 { @@ -208,6 +211,7 @@ i2c3: i2c@b000 { interrupts = <11 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <13>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi0: spi@8000 { diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index fd15cf732919b..aa14161604903 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -910,6 +910,7 @@ #size-cells = <0>; nordic,clockpin-enable = , ; + zephyr,pm-device-runtime-auto; }; spi130: spi@9a5000 { @@ -952,6 +953,7 @@ #size-cells = <0>; nordic,clockpin-enable = , ; + zephyr,pm-device-runtime-auto; }; spi131: spi@9a6000 { @@ -1031,6 +1033,7 @@ #size-cells = <0>; nordic,clockpin-enable = , ; + zephyr,pm-device-runtime-auto; }; spi132: spi@9b5000 { @@ -1073,6 +1076,7 @@ #size-cells = <0>; nordic,clockpin-enable = , ; + zephyr,pm-device-runtime-auto; }; spi133: spi@9b6000 { @@ -1152,6 +1156,7 @@ #size-cells = <0>; nordic,clockpin-enable = , ; + zephyr,pm-device-runtime-auto; }; spi134: spi@9c5000 { @@ -1194,6 +1199,7 @@ #size-cells = <0>; nordic,clockpin-enable = , ; + zephyr,pm-device-runtime-auto; }; spi135: spi@9c6000 { @@ -1273,6 +1279,7 @@ #size-cells = <0>; nordic,clockpin-enable = , ; + zephyr,pm-device-runtime-auto; }; spi136: spi@9d5000 { @@ -1315,6 +1322,7 @@ #size-cells = <0>; nordic,clockpin-enable = , ; + zephyr,pm-device-runtime-auto; }; spi137: spi@9d6000 { diff --git a/dts/common/nordic/nrf54l15.dtsi b/dts/common/nordic/nrf54l15.dtsi index 6926088d9ef65..ad80b332fba5a 100644 --- a/dts/common/nordic/nrf54l15.dtsi +++ b/dts/common/nordic/nrf54l15.dtsi @@ -243,6 +243,7 @@ interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi20: spi@c6000 { @@ -282,6 +283,7 @@ interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi21: spi@c7000 { @@ -321,6 +323,7 @@ interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi22: spi@c8000 { @@ -531,6 +534,7 @@ interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi30: spi@104000 { diff --git a/dts/common/nordic/nrf54l20.dtsi b/dts/common/nordic/nrf54l20.dtsi index d70dac347dc37..ff2a2705279c5 100644 --- a/dts/common/nordic/nrf54l20.dtsi +++ b/dts/common/nordic/nrf54l20.dtsi @@ -193,6 +193,7 @@ interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi20: spi@c6000 { @@ -232,6 +233,7 @@ interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi21: spi@c7000 { @@ -271,6 +273,7 @@ interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi22: spi@c8000 { @@ -472,6 +475,7 @@ interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; + zephyr,pm-device-runtime-auto; }; spi30: spi@104000 { diff --git a/dts/common/nordic/nrf9280.dtsi b/dts/common/nordic/nrf9280.dtsi index 08e58ca48b607..3acd5268e752d 100644 --- a/dts/common/nordic/nrf9280.dtsi +++ b/dts/common/nordic/nrf9280.dtsi @@ -821,6 +821,7 @@ #size-cells = <0>; nordic,clockpin-enable = , ; + zephyr,pm-device-runtime-auto; }; spi130: spi@9a5000 { @@ -860,6 +861,7 @@ #size-cells = <0>; nordic,clockpin-enable = , ; + zephyr,pm-device-runtime-auto; }; spi131: spi@9a6000 { @@ -933,6 +935,7 @@ #size-cells = <0>; nordic,clockpin-enable = , ; + zephyr,pm-device-runtime-auto; }; spi132: spi@9b5000 { @@ -972,6 +975,7 @@ #size-cells = <0>; nordic,clockpin-enable = , ; + zephyr,pm-device-runtime-auto; }; spi133: spi@9b6000 { @@ -1045,6 +1049,7 @@ #size-cells = <0>; nordic,clockpin-enable = , ; + zephyr,pm-device-runtime-auto; }; spi134: spi@9c5000 { @@ -1084,6 +1089,7 @@ #size-cells = <0>; nordic,clockpin-enable = , ; + zephyr,pm-device-runtime-auto; }; spi135: spi@9c6000 { @@ -1157,6 +1163,7 @@ #size-cells = <0>; nordic,clockpin-enable = , ; + zephyr,pm-device-runtime-auto; }; spi136: spi@9d5000 { @@ -1196,6 +1203,7 @@ #size-cells = <0>; nordic,clockpin-enable = , ; + zephyr,pm-device-runtime-auto; }; spi137: spi@9d6000 { From 44180a7dfc1c672fd220e86ac2103935df006c7c Mon Sep 17 00:00:00 2001 From: Krystof Sadlik Date: Wed, 25 Sep 2024 12:43:13 +0200 Subject: [PATCH 0019/4482] boards: NXP: mimxrt1040: added counter as supported Mimxrt1040_ebk board was missing counter in the .yml file, also added GPT to documentation Signed-off-by: Krystof Sadlik --- boards/nxp/mimxrt1040_evk/doc/index.rst | 2 ++ boards/nxp/mimxrt1040_evk/mimxrt1040_evk.yaml | 1 + 2 files changed, 3 insertions(+) diff --git a/boards/nxp/mimxrt1040_evk/doc/index.rst b/boards/nxp/mimxrt1040_evk/doc/index.rst index fffd3873fa549..21c7d53868484 100644 --- a/boards/nxp/mimxrt1040_evk/doc/index.rst +++ b/boards/nxp/mimxrt1040_evk/doc/index.rst @@ -118,6 +118,8 @@ already supported, which can also be re-used on this mimxrt1040_evk board: +-----------+------------+-------------------------------------+ | I2C | on-chip | i2c | +-----------+------------+-------------------------------------+ +| GPT | on-chip | gpt | ++-----------+------------+-------------------------------------+ | DISPLAY | on-chip | eLCDIF. Tested with | | | | :ref:`rk043fn02h_ct`, and | | | | :ref:`rk043fn66hs_ctg` shields | diff --git a/boards/nxp/mimxrt1040_evk/mimxrt1040_evk.yaml b/boards/nxp/mimxrt1040_evk/mimxrt1040_evk.yaml index 415ca704d60ed..5044627b19b14 100644 --- a/boards/nxp/mimxrt1040_evk/mimxrt1040_evk.yaml +++ b/boards/nxp/mimxrt1040_evk/mimxrt1040_evk.yaml @@ -21,4 +21,5 @@ supported: - adc - spi - i2c + - counter vendor: nxp From 1299dc74df612fd20bb57cfb530f784e27aea1bb Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Wed, 25 Sep 2024 16:38:21 +0200 Subject: [PATCH 0020/4482] MAINTAINERS: Update patterns for Silabs platforms Update glob patterns to include files using "silabs" naming in addition to "gecko". Also include the oddly named BT HCI driver. Signed-off-by: Aksel Skauge Mellbye --- MAINTAINERS.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index d93a3ed2392f2..168934811ba2f 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -3493,6 +3493,8 @@ Silabs Platforms: - dts/arm/silabs/ - dts/bindings/*/silabs* - drivers/*/*_gecko* + - drivers/bluetooth/hci/slz_hci* + - drivers/*/*_silabs* labels: - "platform: Silabs" From 46367ff15aaceb353e0232846946f22c89702d47 Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Thu, 20 Jun 2024 10:52:50 +0200 Subject: [PATCH 0021/4482] sys: util: Make FIELD_* available from device tree Move FIELD_* macros from zephyr/sys/util.h to zephyr/sys/util_macro.h, as zephyr/sys/util.h cannot be used from device tree. Device tree uses zephyr/dt-bindings/dt-util.h, which includes zephyr/sys/util_macro.h. Signed-off-by: Aksel Skauge Mellbye --- include/zephyr/sys/util.h | 16 ---------------- include/zephyr/sys/util_macro.h | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/zephyr/sys/util.h b/include/zephyr/sys/util.h index ce44e18cbf5c8..6fba21dc16ac6 100644 --- a/include/zephyr/sys/util.h +++ b/include/zephyr/sys/util.h @@ -77,22 +77,6 @@ extern "C" { #define GENMASK64(h, l) \ (((~0ULL) - (1ULL << (l)) + 1) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) -/** @brief Extract the Least Significant Bit from @p value. */ -#define LSB_GET(value) ((value) & -(value)) - -/** - * @brief Extract a bitfield element from @p value corresponding to - * the field mask @p mask. - */ -#define FIELD_GET(mask, value) (((value) & (mask)) / LSB_GET(mask)) - -/** - * @brief Prepare a bitfield element using @p value with @p mask representing - * its field position and width. The result should be combined - * with other fields using a logical OR. - */ -#define FIELD_PREP(mask, value) (((value) * LSB_GET(mask)) & (mask)) - /** @brief 0 if @p cond is true-ish; causes a compile error otherwise. */ #define ZERO_OR_COMPILE_ERROR(cond) ((int) sizeof(char[1 - 2 * !(cond)]) - 1) diff --git a/include/zephyr/sys/util_macro.h b/include/zephyr/sys/util_macro.h index 5b3864d2e3c63..87c5caad56908 100644 --- a/include/zephyr/sys/util_macro.h +++ b/include/zephyr/sys/util_macro.h @@ -93,6 +93,22 @@ extern "C" { */ #define IS_BIT_MASK(m) IS_SHIFTED_BIT_MASK(m, 0) +/** @brief Extract the Least Significant Bit from @p value. */ +#define LSB_GET(value) ((value) & -(value)) + +/** + * @brief Extract a bitfield element from @p value corresponding to + * the field mask @p mask. + */ +#define FIELD_GET(mask, value) (((value) & (mask)) / LSB_GET(mask)) + +/** + * @brief Prepare a bitfield element using @p value with @p mask representing + * its field position and width. The result should be combined + * with other fields using a logical OR. + */ +#define FIELD_PREP(mask, value) (((value) * LSB_GET(mask)) & (mask)) + /** * @brief Check for macro definition in compiler-visible expressions * From bda8ae8c3f067adf5d1c46d5f1ca2bbe42423496 Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Fri, 20 Sep 2024 16:07:55 +0200 Subject: [PATCH 0022/4482] drivers: clock_control: silabs: Add clock control driver Add clock control driver for Silicon Labs Series 2 and newer. Signed-off-by: Aksel Skauge Mellbye --- .../silabs/dev_kits/sltb010a/sltb010a_0.yaml | 1 + .../dev_kits/xg24_dk2601b/xg24_dk2601b.yaml | 1 + .../dev_kits/xg27_dk2602a/xg27_dk2602a.yaml | 1 + drivers/clock_control/CMakeLists.txt | 1 + drivers/clock_control/Kconfig | 2 + drivers/clock_control/Kconfig.silabs | 9 ++ .../clock_control_silabs_series.c | 127 ++++++++++++++++++ dts/arm/silabs/efr32bg22.dtsi | 12 ++ dts/arm/silabs/efr32bg27.dtsi | 13 ++ dts/arm/silabs/efr32bg2x.dtsi | 8 ++ dts/arm/silabs/efr32mg21.dtsi | 19 +++ dts/arm/silabs/efr32mg24.dtsi | 18 +++ dts/bindings/clock/silabs,series-clock.yaml | 19 +++ .../clock_control/clock_control_silabs.h | 39 ++++++ .../dt-bindings/clock/silabs/common-clock.h | 54 ++++++++ .../dt-bindings/clock/silabs/xg21-clock.h | 26 ++++ .../dt-bindings/clock/silabs/xg22-clock.h | 76 +++++++++++ .../dt-bindings/clock/silabs/xg23-clock.h | 86 ++++++++++++ .../dt-bindings/clock/silabs/xg24-clock.h | 85 ++++++++++++ .../dt-bindings/clock/silabs/xg27-clock.h | 78 +++++++++++ .../src/silabs_device_subsys.h | 31 +++++ .../src/test_clock_control.c | 2 + .../clock_control_api/testcase.yaml | 3 + 23 files changed, 711 insertions(+) create mode 100644 drivers/clock_control/Kconfig.silabs create mode 100644 drivers/clock_control/clock_control_silabs_series.c create mode 100644 dts/bindings/clock/silabs,series-clock.yaml create mode 100644 include/zephyr/drivers/clock_control/clock_control_silabs.h create mode 100644 include/zephyr/dt-bindings/clock/silabs/common-clock.h create mode 100644 include/zephyr/dt-bindings/clock/silabs/xg21-clock.h create mode 100644 include/zephyr/dt-bindings/clock/silabs/xg22-clock.h create mode 100644 include/zephyr/dt-bindings/clock/silabs/xg23-clock.h create mode 100644 include/zephyr/dt-bindings/clock/silabs/xg24-clock.h create mode 100644 include/zephyr/dt-bindings/clock/silabs/xg27-clock.h create mode 100644 tests/drivers/clock_control/clock_control_api/src/silabs_device_subsys.h diff --git a/boards/silabs/dev_kits/sltb010a/sltb010a_0.yaml b/boards/silabs/dev_kits/sltb010a/sltb010a_0.yaml index 8cbf1832eac3e..4de8c502a07ba 100644 --- a/boards/silabs/dev_kits/sltb010a/sltb010a_0.yaml +++ b/boards/silabs/dev_kits/sltb010a/sltb010a_0.yaml @@ -15,4 +15,5 @@ supported: - uart - i2c - spi + - clock_control vendor: silabs diff --git a/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b.yaml b/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b.yaml index ed39649abe678..8bfaf749e3291 100644 --- a/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b.yaml +++ b/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b.yaml @@ -13,6 +13,7 @@ supported: - gpio - uart - watchdog + - clock_control testing: ignore_tags: - pm diff --git a/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a.yaml b/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a.yaml index bb6a214b78648..b725374398e3f 100644 --- a/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a.yaml +++ b/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a.yaml @@ -13,4 +13,5 @@ supported: - counter - gpio - uart + - clock_control vendor: silabs diff --git a/drivers/clock_control/CMakeLists.txt b/drivers/clock_control/CMakeLists.txt index e08891a42c750..79079867e5dd8 100644 --- a/drivers/clock_control/CMakeLists.txt +++ b/drivers/clock_control/CMakeLists.txt @@ -25,6 +25,7 @@ zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_DRIVER_CALIBRATION nrf_clo zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_RV32M1_PCC clock_control_rv32m1_pcc.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_INFINEON_CAT1 clock_control_ifx_cat1.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_SAM clock_control_sam_pmc.c) +zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_SILABS_SERIES clock_control_silabs_series.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_SI32_PLL clock_control_si32_pll.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_SI32_AHB clock_control_si32_ahb.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_SI32_APB clock_control_si32_apb.c) diff --git a/drivers/clock_control/Kconfig b/drivers/clock_control/Kconfig index 42a5f23ad1f5d..ca4db637014a3 100644 --- a/drivers/clock_control/Kconfig +++ b/drivers/clock_control/Kconfig @@ -98,4 +98,6 @@ source "drivers/clock_control/Kconfig.nrf_auxpll" source "drivers/clock_control/Kconfig.arm_scmi" +source "drivers/clock_control/Kconfig.silabs" + endif # CLOCK_CONTROL diff --git a/drivers/clock_control/Kconfig.silabs b/drivers/clock_control/Kconfig.silabs new file mode 100644 index 0000000000000..83926fe465cda --- /dev/null +++ b/drivers/clock_control/Kconfig.silabs @@ -0,0 +1,9 @@ +# Copyright (c) 2024 Silicon Laboratories Inc. +# SPDX-License-Identifier: Apache-2.0 + +config CLOCK_CONTROL_SILABS_SERIES + bool "Silicon Labs Series 2+ clock control driver" + default y + depends on DT_HAS_SILABS_SERIES_CLOCK_ENABLED + help + Enable Silicon Labs Series 2+ Clock Management Unit clock control driver. diff --git a/drivers/clock_control/clock_control_silabs_series.c b/drivers/clock_control/clock_control_silabs_series.c new file mode 100644 index 0000000000000..90498c246e04b --- /dev/null +++ b/drivers/clock_control/clock_control_silabs_series.c @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2024 Silicon Laboratories Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT silabs_series_clock + +#include +#include +#include +#include + +#include "sl_clock_manager.h" +#include "sl_status.h" + +struct silabs_clock_control_config { + CMU_TypeDef *cmu; +}; + +static enum clock_control_status silabs_clock_control_get_status(const struct device *dev, + clock_control_subsys_t sys); + +static int silabs_clock_control_on(const struct device *dev, clock_control_subsys_t sys) +{ + const struct silabs_clock_control_cmu_config *cfg = sys; + sl_status_t status; + + if (silabs_clock_control_get_status(dev, sys) == CLOCK_CONTROL_STATUS_ON) { + return -EALREADY; + } + + status = sl_clock_manager_enable_bus_clock(&cfg->bus_clock); + if (status != SL_STATUS_OK) { + return -ENOTSUP; + } + + return 0; +} + +static int silabs_clock_control_off(const struct device *dev, clock_control_subsys_t sys) +{ + const struct silabs_clock_control_cmu_config *cfg = sys; + sl_status_t status; + + status = sl_clock_manager_disable_bus_clock(&cfg->bus_clock); + if (status != SL_STATUS_OK) { + return -ENOTSUP; + } + + return 0; +} + +static int silabs_clock_control_get_rate(const struct device *dev, clock_control_subsys_t sys, + uint32_t *rate) +{ + const struct silabs_clock_control_cmu_config *cfg = sys; + sl_status_t status; + + status = sl_clock_manager_get_clock_branch_frequency(cfg->branch, rate); + if (status != SL_STATUS_OK) { + return -ENOTSUP; + } + + return 0; +} + +static enum clock_control_status silabs_clock_control_get_status(const struct device *dev, + clock_control_subsys_t sys) +{ + const struct silabs_clock_control_cmu_config *cfg = sys; + __maybe_unused const struct silabs_clock_control_config *reg = dev->config; + uint32_t clock_status = 0; + + if (cfg->bus_clock == 0xFFFFFFFFUL) { + return CLOCK_CONTROL_STATUS_UNKNOWN; + } + + switch (FIELD_GET(CLOCK_REG_MASK, cfg->bus_clock)) { +#if defined(_CMU_CLKEN0_MASK) + case 0: + clock_status = reg->cmu->CLKEN0; + break; +#endif +#if defined(_CMU_CLKEN1_MASK) + case 1: + clock_status = reg->cmu->CLKEN1; + break; +#endif +#if defined(_CMU_CLKEN2_MASK) + case 2: + clock_status = reg->cmu->CLKEN2; + break; +#endif + default: + __ASSERT(false, "Invalid bus clock: %x\n", cfg->bus_clock); + break; + } + + if (clock_status & BIT(FIELD_GET(CLOCK_BIT_MASK, cfg->bus_clock))) { + return CLOCK_CONTROL_STATUS_ON; + } else { + return CLOCK_CONTROL_STATUS_OFF; + } +} + +static int silabs_clock_control_init(const struct device *dev) +{ + ARG_UNUSED(dev); + sl_clock_manager_runtime_init(); + + return 0; +} + +static const struct clock_control_driver_api silabs_clock_control_api = { + .on = silabs_clock_control_on, + .off = silabs_clock_control_off, + .get_rate = silabs_clock_control_get_rate, + .get_status = silabs_clock_control_get_status, +}; + +static const struct silabs_clock_control_config silabs_clock_control_config = { + .cmu = (CMU_TypeDef *)DT_INST_REG_ADDR(0), +}; + +DEVICE_DT_INST_DEFINE(0, silabs_clock_control_init, NULL, NULL, &silabs_clock_control_config, + PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &silabs_clock_control_api); diff --git a/dts/arm/silabs/efr32bg22.dtsi b/dts/arm/silabs/efr32bg22.dtsi index 1b60f2d7b96ed..bcf918a9164f6 100644 --- a/dts/arm/silabs/efr32bg22.dtsi +++ b/dts/arm/silabs/efr32bg22.dtsi @@ -5,8 +5,13 @@ */ #include "efr32bg2x.dtsi" +#include #include +&cmu { + interrupts = <46 0>; +}; + &msc { flash0: flash@0 { compatible = "soc-nv-flash"; @@ -22,28 +27,35 @@ &gpio { interrupts = <10 2 18 2>; + clocks = <&cmu CLOCK_GPIO CLOCK_BRANCH_PCLK>; }; &i2c0 { interrupts = <27 0>; + clocks = <&cmu CLOCK_I2C0 CLOCK_BRANCH_LSPCLK>; }; &i2c1 { interrupts = <28 0>; + clocks = <&cmu CLOCK_I2C1 CLOCK_BRANCH_PCLK>; }; &usart0 { interrupts = <13 0>, <14 0>; + clocks = <&cmu CLOCK_USART0 CLOCK_BRANCH_PCLK>; }; &usart1 { interrupts = <15 0>, <16 0>; + clocks = <&cmu CLOCK_USART1 CLOCK_BRANCH_PCLK>; }; &burtc0 { interrupts = <18 0>; + clocks = <&cmu CLOCK_BURTC CLOCK_BRANCH_EM4GRPACLK>; }; &stimer0 { interrupts = <12 0>; + clocks = <&cmu CLOCK_RTCC CLOCK_BRANCH_RTCCCLK>; }; diff --git a/dts/arm/silabs/efr32bg27.dtsi b/dts/arm/silabs/efr32bg27.dtsi index 85ab2bd0db148..448761f3a5021 100644 --- a/dts/arm/silabs/efr32bg27.dtsi +++ b/dts/arm/silabs/efr32bg27.dtsi @@ -5,8 +5,13 @@ */ #include "efr32bg2x.dtsi" +#include #include +&cmu { + interrupts = <52 0>; +}; + &msc { flash0: flash@8000000 { compatible = "soc-nv-flash"; @@ -22,32 +27,40 @@ &gpio { interrupts = <30 2 31 2>; + clocks = <&cmu CLOCK_GPIO CLOCK_BRANCH_PCLK>; }; &i2c0 { interrupts = <32 0>; + clocks = <&cmu CLOCK_I2C0 CLOCK_BRANCH_LSPCLK>; }; &i2c1 { interrupts = <33 0>; + clocks = <&cmu CLOCK_I2C1 CLOCK_BRANCH_PCLK>; }; &usart0 { interrupts = <16 0>, <17 0>; + clocks = <&cmu CLOCK_USART0 CLOCK_BRANCH_PCLK>; }; &usart1 { interrupts = <18 0>, <19 0>; + clocks = <&cmu CLOCK_USART1 CLOCK_BRANCH_PCLK>; }; &burtc0 { interrupts = <23 0>; + clocks = <&cmu CLOCK_BURTC CLOCK_BRANCH_EM4GRPACLK>; }; &stimer0 { interrupts = <15 0>; + clocks = <&cmu CLOCK_RTCC CLOCK_BRANCH_RTCCCLK>; }; &adc0 { interrupts = <54 0>; + clocks = <&cmu CLOCK_IADC0 CLOCK_BRANCH_IADCCLK>; }; diff --git a/dts/arm/silabs/efr32bg2x.dtsi b/dts/arm/silabs/efr32bg2x.dtsi index 9cd0618cd41c9..ca42d7c0888c2 100644 --- a/dts/arm/silabs/efr32bg2x.dtsi +++ b/dts/arm/silabs/efr32bg2x.dtsi @@ -93,6 +93,14 @@ }; soc { + cmu: clock@50008000 { + compatible = "silabs,series-clock"; + reg = <0x50008000 0x4000>; + interrupt-names = "cmu"; + status = "okay"; + #clock-cells = <2>; + }; + msc: flash-controller@50030000 { compatible = "silabs,gecko-flash-controller"; reg = <0x50030000 0xC69>; diff --git a/dts/arm/silabs/efr32mg21.dtsi b/dts/arm/silabs/efr32mg21.dtsi index 217830f7265ae..fa6a47f6d8d04 100644 --- a/dts/arm/silabs/efr32mg21.dtsi +++ b/dts/arm/silabs/efr32mg21.dtsi @@ -8,6 +8,7 @@ #include #include #include +#include #include "gpio_gecko.h" / { @@ -40,6 +41,15 @@ }; soc { + cmu: clock@50008000 { + compatible = "silabs,series-clock"; + reg = <0x50008000 0x4000>; + interrupts = <48 0>; + interrupt-names = "cmu"; + status = "okay"; + #clock-cells = <2>; + }; + msc: flash-controller@50030000 { compatible = "silabs,gecko-flash-controller"; reg = <0x50030000 0x31a4>; @@ -61,6 +71,7 @@ interrupts = <11 0>, <12 0>; interrupt-names = "rx", "tx"; peripheral-id = <0>; + clocks = <&cmu CLOCK_AUTO CLOCK_BRANCH_PCLK>; status = "disabled"; }; @@ -70,6 +81,7 @@ interrupts = <13 0>, <14 0>; interrupt-names = "rx", "tx"; peripheral-id = <1>; + clocks = <&cmu CLOCK_AUTO CLOCK_BRANCH_PCLK>; status = "disabled"; }; @@ -79,6 +91,7 @@ interrupts = <15 0>, <16 0>; interrupt-names = "rx", "tx"; peripheral-id = <2>; + clocks = <&cmu CLOCK_AUTO CLOCK_BRANCH_PCLK>; status = "disabled"; }; @@ -89,6 +102,7 @@ #size-cells = <0>; reg = <0x5a010000 0x400>; interrupts = <27 0>; + clocks = <&cmu CLOCK_AUTO CLOCK_BRANCH_LSPCLK>; status = "disabled"; }; @@ -99,6 +113,7 @@ #size-cells = <0>; reg = <0x50068000 0x400>; interrupts = <28 0>; + clocks = <&cmu CLOCK_AUTO CLOCK_BRANCH_PCLK>; status = "disabled"; }; @@ -108,6 +123,7 @@ interrupts = <10 0>; clock-frequency = <32768>; prescaler = <1>; + clocks = <&cmu CLOCK_AUTO CLOCK_BRANCH_RTCCCLK>; status = "disabled"; }; @@ -116,6 +132,7 @@ reg = <0x5003c300 0x3c00>; interrupts = <26 2>, <25 2>; interrupt-names = "GPIO_EVEN", "GPIO_ODD"; + clocks = <&cmu CLOCK_AUTO CLOCK_BRANCH_PCLK>; ranges; #address-cells = <1>; @@ -171,6 +188,7 @@ reg = <0x5a018000 0x2C>; peripheral-id = <0>; interrupts = <43 0>; + clocks = <&cmu CLOCK_AUTO CLOCK_BRANCH_WDOG0CLK>; status = "disabled"; }; @@ -179,6 +197,7 @@ reg = <0x5a01c000 0x2C>; peripheral-id = <1>; interrupts = <44 0>; + clocks = <&cmu CLOCK_AUTO CLOCK_BRANCH_WDOG1CLK>; status = "disabled"; }; diff --git a/dts/arm/silabs/efr32mg24.dtsi b/dts/arm/silabs/efr32mg24.dtsi index b92100c85a567..540b9b83eac98 100644 --- a/dts/arm/silabs/efr32mg24.dtsi +++ b/dts/arm/silabs/efr32mg24.dtsi @@ -10,6 +10,7 @@ #include #include #include +#include #include / { @@ -84,6 +85,15 @@ }; soc { + cmu: clock@50008000 { + compatible = "silabs,series-clock"; + reg = <0x50008000 0x4000>; + interrupts = <47 0>; + interrupt-names = "cmu"; + status = "okay"; + #clock-cells = <2>; + }; + msc: flash-controller@50030000 { compatible = "silabs,gecko-flash-controller"; reg = <0x50030000 0x3148>; @@ -105,6 +115,7 @@ interrupts = <9 0>, <10 0>; interrupt-names = "rx", "tx"; peripheral-id = <0>; + clocks = <&cmu CLOCK_USART0 CLOCK_BRANCH_PCLK>; status = "disabled"; }; @@ -112,6 +123,7 @@ compatible = "silabs,gecko-burtc"; reg = <0x50064000 0x3034>; interrupts = <17 0>; + clocks = <&cmu CLOCK_BURTC CLOCK_BRANCH_EM4GRPACLK>; status = "disabled"; }; @@ -130,6 +142,7 @@ #size-cells = <0>; reg = <0x5b000000 0x3044>; interrupts = <27 0>; + clocks = <&cmu CLOCK_I2C0 CLOCK_BRANCH_LSPCLK>; status = "disabled"; }; @@ -139,6 +152,7 @@ interrupts = <67 0>; clock-frequency = <32768>; prescaler = <1>; + clocks = <&cmu CLOCK_SYSRTC0 CLOCK_BRANCH_SYSRTCCLK>; status = "disabled"; }; @@ -147,6 +161,7 @@ reg = <0x5003c000 0x4000>; interrupts = <26 2>, <25 2>; interrupt-names = "GPIO_EVEN", "GPIO_ODD"; + clocks = <&cmu CLOCK_GPIO CLOCK_BRANCH_PCLK>; ranges; #address-cells = <1>; @@ -194,6 +209,7 @@ reg = <0x5b004000 0x2C>; peripheral-id = <0>; interrupts = <42 0>; + clocks = <&cmu CLOCK_WDOG0 CLOCK_BRANCH_WDOG0CLK>; status = "disabled"; }; @@ -202,6 +218,7 @@ reg = <0x5b008000 0x2C>; peripheral-id = <1>; interrupts = <43 0>; + clocks = <&cmu CLOCK_WDOG1 CLOCK_BRANCH_WDOG1CLK>; status = "disabled"; }; @@ -209,6 +226,7 @@ compatible = "silabs,gecko-iadc"; reg = <0x59004000 0x4000>; interrupts = <49 0>; + clocks = <&cmu CLOCK_IADC0 CLOCK_BRANCH_IADCCLK>; status = "disabled"; #io-channel-cells = <1>; }; diff --git a/dts/bindings/clock/silabs,series-clock.yaml b/dts/bindings/clock/silabs,series-clock.yaml new file mode 100644 index 0000000000000..de013327390c1 --- /dev/null +++ b/dts/bindings/clock/silabs,series-clock.yaml @@ -0,0 +1,19 @@ +# Copyright (c) 2024 Silicon Laboratories Inc. +# SPDX-License-Identifier: Apache-2.0 + +description: Silicon Labs Series 2+ clock control node + +compatible: "silabs,series-clock" + +include: [clock-controller.yaml, base.yaml] + +properties: + reg: + required: true + + "#clock-cells": + const: 2 + +clock-cells: + - enable + - branch diff --git a/include/zephyr/drivers/clock_control/clock_control_silabs.h b/include/zephyr/drivers/clock_control/clock_control_silabs.h new file mode 100644 index 0000000000000..d608b1da5b084 --- /dev/null +++ b/include/zephyr/drivers/clock_control/clock_control_silabs.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Silicon Laboratories Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_DRIVERS_CLOCK_CONTROL_SILABS_H_ +#define ZEPHYR_INCLUDE_DRIVERS_CLOCK_CONTROL_SILABS_H_ + +#include + +#if defined(CONFIG_SOC_SERIES_EFR32MG21) +#include +#elif defined(CONFIG_SOC_SERIES_EFR32BG22) +#include +#elif defined(CONFIG_SOC_SERIES_EFR32MG24) +#include +#elif defined(CONFIG_SOC_SERIES_EFR32BG27) +#include +#endif + +struct silabs_clock_control_cmu_config { + uint32_t bus_clock; + uint8_t branch; +}; + +#define SILABS_DT_CLOCK_CFG(node_id) \ + { \ + .bus_clock = DT_CLOCKS_CELL(node_id, enable), \ + .branch = DT_CLOCKS_CELL(node_id, branch), \ + } + +#define SILABS_DT_INST_CLOCK_CFG(inst) \ + { \ + .bus_clock = DT_INST_CLOCKS_CELL(inst, enable), \ + .branch = DT_INST_CLOCKS_CELL(inst, branch), \ + } + +#endif /* ZEPHYR_INCLUDE_DRIVERS_CLOCK_CONTROL_SILABS_H_ */ diff --git a/include/zephyr/dt-bindings/clock/silabs/common-clock.h b/include/zephyr/dt-bindings/clock/silabs/common-clock.h new file mode 100644 index 0000000000000..1b5aa5d7a63f7 --- /dev/null +++ b/include/zephyr/dt-bindings/clock/silabs/common-clock.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2024 Silicon Laboratories Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_SILABS_COMMON_CLOCK_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_SILABS_COMMON_CLOCK_H_ + +/* + * DT macros for clock branches. + * Must stay in sync with the enum sl_clock_branch_t in the Silicon Labs HAL to be + * interpreted correctly by the clock control driver. + */ +#define CLOCK_BRANCH_SYSCLK 0 +#define CLOCK_BRANCH_HCLK 1 +#define CLOCK_BRANCH_HCLKRADIO 2 +#define CLOCK_BRANCH_PCLK 3 +#define CLOCK_BRANCH_LSPCLK 4 +#define CLOCK_BRANCH_TRACECLK 5 +#define CLOCK_BRANCH_ADCCLK 6 +#define CLOCK_BRANCH_EXPORTCLK 7 +#define CLOCK_BRANCH_EM01GRPACLK 8 +#define CLOCK_BRANCH_EM01GRPBCLK 9 +#define CLOCK_BRANCH_EM01GRPCCLK 10 +#define CLOCK_BRANCH_EM01GRPDCLK 11 +#define CLOCK_BRANCH_EM23GRPACLK 12 +#define CLOCK_BRANCH_EM4GRPACLK 13 +#define CLOCK_BRANCH_QSPISYSCLK 14 +#define CLOCK_BRANCH_IADCCLK 15 +#define CLOCK_BRANCH_WDOG0CLK 16 +#define CLOCK_BRANCH_WDOG1CLK 17 +#define CLOCK_BRANCH_RTCCCLK 18 +#define CLOCK_BRANCH_SYSRTCCLK 19 +#define CLOCK_BRANCH_EUART0CLK 20 +#define CLOCK_BRANCH_EUSART0CLK 21 +#define CLOCK_BRANCH_DPLLREFCLK 22 +#define CLOCK_BRANCH_I2C0CLK 23 +#define CLOCK_BRANCH_LCDCLK 24 +#define CLOCK_BRANCH_PIXELRZCLK 25 +#define CLOCK_BRANCH_PCNT0CLK 26 +#define CLOCK_BRANCH_PRORTCCLK 27 +#define CLOCK_BRANCH_SYSTICKCLK 28 +#define CLOCK_BRANCH_LESENSEHFCLK 29 +#define CLOCK_BRANCH_VDAC0CLK 30 +#define CLOCK_BRANCH_VDAC1CLK 31 +#define CLOCK_BRANCH_USB0CLK 32 +#define CLOCK_BRANCH_FLPLLREFCLK 33 +#define CLOCK_BRANCH_INVALID 34 + +#define CLOCK_BIT_MASK 0x03FUL +#define CLOCK_REG_MASK 0x1C0UL + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_SILABS_COMMON_CLOCK_H_ */ diff --git a/include/zephyr/dt-bindings/clock/silabs/xg21-clock.h b/include/zephyr/dt-bindings/clock/silabs/xg21-clock.h new file mode 100644 index 0000000000000..dcfcb4aeb8488 --- /dev/null +++ b/include/zephyr/dt-bindings/clock/silabs/xg21-clock.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2024 Silicon Laboratories Inc. + * + * SPDX-License-Identifier: Apache-2.0 + * + * This file was generated by the script gen_clock_control.py in the hal_silabs module. + * Do not manually edit. + */ + +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_SILABS_XG21_CLOCK_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_SILABS_XG21_CLOCK_H_ + +#include +#include "common-clock.h" + +/* + * DT macros for clock tree nodes. + * Defined as: + * 0..5 - Bit within CLKEN register + * 6..8 - CLKEN register number + * Must stay in sync with equivalent SL_BUS_*_VALUE constants in the Silicon Labs HAL to be + * interpreted correctly by the clock control driver. + */ +#define CLOCK_AUTO 0xFFFFFFFFUL + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_SILABS_XG21_CLOCK_H_ */ diff --git a/include/zephyr/dt-bindings/clock/silabs/xg22-clock.h b/include/zephyr/dt-bindings/clock/silabs/xg22-clock.h new file mode 100644 index 0000000000000..ef9c8623b532f --- /dev/null +++ b/include/zephyr/dt-bindings/clock/silabs/xg22-clock.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2024 Silicon Laboratories Inc. + * + * SPDX-License-Identifier: Apache-2.0 + * + * This file was generated by the script gen_clock_control.py in the hal_silabs module. + * Do not manually edit. + */ + +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_SILABS_XG22_CLOCK_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_SILABS_XG22_CLOCK_H_ + +#include +#include "common-clock.h" + +/* + * DT macros for clock tree nodes. + * Defined as: + * 0..5 - Bit within CLKEN register + * 6..8 - CLKEN register number + * Must stay in sync with equivalent SL_BUS_*_VALUE constants in the Silicon Labs HAL to be + * interpreted correctly by the clock control driver. + */ +#define CLOCK_AGC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 0)) +#define CLOCK_AMUXCP0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 11)) +#define CLOCK_BUFC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 11)) +#define CLOCK_BURAM (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 28)) +#define CLOCK_BURTC (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 29)) +#define CLOCK_CRYPTOACC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 13)) +#define CLOCK_DCDC (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 31)) +#define CLOCK_DPLL0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 17)) +#define CLOCK_EUART0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 24)) +#define CLOCK_FRC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 3)) +#define CLOCK_FSRCO (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 20)) +#define CLOCK_GPCRC0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 3)) +#define CLOCK_GPIO (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 26)) +#define CLOCK_HFRCO0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 18)) +#define CLOCK_HFXO0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 19)) +#define CLOCK_I2C0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 14)) +#define CLOCK_I2C1 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 15)) +#define CLOCK_IADC0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 10)) +#define CLOCK_ICACHE0 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 16)) +#define CLOCK_IFADCDEBUG (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 12)) +#define CLOCK_LDMA0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 0)) +#define CLOCK_LDMAXBAR0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 1)) +#define CLOCK_LETIMER0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 12)) +#define CLOCK_LFRCO (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 21)) +#define CLOCK_LFXO (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 22)) +#define CLOCK_MODEM (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 1)) +#define CLOCK_MSC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 17)) +#define CLOCK_PDM (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 25)) +#define CLOCK_PRORTC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 10)) +#define CLOCK_PROTIMER (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 4)) +#define CLOCK_PRS (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 27)) +#define CLOCK_RAC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 5)) +#define CLOCK_RADIOAES (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 2)) +#define CLOCK_RDMAILBOX0 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 8)) +#define CLOCK_RDMAILBOX1 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 9)) +#define CLOCK_RDSCRATCHPAD (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 7)) +#define CLOCK_RFCRC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 2)) +#define CLOCK_RFSENSE (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 14)) +#define CLOCK_RTCC (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 30)) +#define CLOCK_SMU (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 15)) +#define CLOCK_SYNTH (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 6)) +#define CLOCK_SYSCFG (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 16)) +#define CLOCK_TIMER0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 4)) +#define CLOCK_TIMER1 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 5)) +#define CLOCK_TIMER2 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 6)) +#define CLOCK_TIMER3 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 7)) +#define CLOCK_TIMER4 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 18)) +#define CLOCK_ULFRCO (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 23)) +#define CLOCK_USART0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 8)) +#define CLOCK_USART1 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 9)) +#define CLOCK_WDOG0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 13)) + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_SILABS_XG22_CLOCK_H_ */ diff --git a/include/zephyr/dt-bindings/clock/silabs/xg23-clock.h b/include/zephyr/dt-bindings/clock/silabs/xg23-clock.h new file mode 100644 index 0000000000000..29914ecdf23c6 --- /dev/null +++ b/include/zephyr/dt-bindings/clock/silabs/xg23-clock.h @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2024 Silicon Laboratories Inc. + * + * SPDX-License-Identifier: Apache-2.0 + * + * This file was generated by the script gen_clock_control.py in the hal_silabs module. + * Do not manually edit. + */ + +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_SILABS_XG23_CLOCK_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_SILABS_XG23_CLOCK_H_ + +#include +#include "common-clock.h" + +/* + * DT macros for clock tree nodes. + * Defined as: + * 0..5 - Bit within CLKEN register + * 6..8 - CLKEN register number + * Must stay in sync with equivalent SL_BUS_*_VALUE constants in the Silicon Labs HAL to be + * interpreted correctly by the clock control driver. + */ +#define CLOCK_ACMP0 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 18)) +#define CLOCK_ACMP1 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 19)) +#define CLOCK_AGC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 0)) +#define CLOCK_AMUXCP0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 11)) +#define CLOCK_BUFC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 11)) +#define CLOCK_BURAM (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 28)) +#define CLOCK_BURTC (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 29)) +#define CLOCK_DCDC (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 31)) +#define CLOCK_DMEM (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 27)) +#define CLOCK_DPLL0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 17)) +#define CLOCK_ECAIFADC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 28)) +#define CLOCK_EUSART0 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 22)) +#define CLOCK_EUSART1 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 23)) +#define CLOCK_EUSART2 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 24)) +#define CLOCK_FRC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 3)) +#define CLOCK_FSRCO (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 21)) +#define CLOCK_GPCRC0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 3)) +#define CLOCK_GPIO (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 26)) +#define CLOCK_HFRCO0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 18)) +#define CLOCK_HFRCOEM23 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 19)) +#define CLOCK_HFXO0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 20)) +#define CLOCK_HOSTMAILBOX (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 8)) +#define CLOCK_I2C0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 14)) +#define CLOCK_I2C1 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 15)) +#define CLOCK_IADC0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 10)) +#define CLOCK_ICACHE0 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 15)) +#define CLOCK_KEYSCAN (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 13)) +#define CLOCK_LCD (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 12)) +#define CLOCK_LDMA0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 0)) +#define CLOCK_LDMAXBAR0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 1)) +#define CLOCK_LESENSE (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 25)) +#define CLOCK_LETIMER0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 12)) +#define CLOCK_LFRCO (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 22)) +#define CLOCK_LFXO (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 23)) +#define CLOCK_MODEM (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 1)) +#define CLOCK_MSC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 16)) +#define CLOCK_PCNT0 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 21)) +#define CLOCK_PROTIMER (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 4)) +#define CLOCK_PRS (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 27)) +#define CLOCK_RAC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 5)) +#define CLOCK_RADIOAES (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 2)) +#define CLOCK_RFCRC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 2)) +#define CLOCK_RFECA0 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 25)) +#define CLOCK_RFECA1 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 26)) +#define CLOCK_RFMAILBOX (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 9)) +#define CLOCK_RFSCRATCHPAD (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 7)) +#define CLOCK_SEMAILBOX (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 10)) +#define CLOCK_SMU (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 14)) +#define CLOCK_SYNTH (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 6)) +#define CLOCK_SYSCFG (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 16)) +#define CLOCK_SYSRTC0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 30)) +#define CLOCK_TIMER0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 4)) +#define CLOCK_TIMER1 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 5)) +#define CLOCK_TIMER2 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 6)) +#define CLOCK_TIMER3 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 7)) +#define CLOCK_TIMER4 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 8)) +#define CLOCK_ULFRCO (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 24)) +#define CLOCK_USART0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 9)) +#define CLOCK_VDAC0 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 20)) +#define CLOCK_WDOG0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 13)) +#define CLOCK_WDOG1 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 17)) + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_SILABS_XG23_CLOCK_H_ */ diff --git a/include/zephyr/dt-bindings/clock/silabs/xg24-clock.h b/include/zephyr/dt-bindings/clock/silabs/xg24-clock.h new file mode 100644 index 0000000000000..7fca2a5baaf2b --- /dev/null +++ b/include/zephyr/dt-bindings/clock/silabs/xg24-clock.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2024 Silicon Laboratories Inc. + * + * SPDX-License-Identifier: Apache-2.0 + * + * This file was generated by the script gen_clock_control.py in the hal_silabs module. + * Do not manually edit. + */ + +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_SILABS_XG24_CLOCK_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_SILABS_XG24_CLOCK_H_ + +#include +#include "common-clock.h" + +/* + * DT macros for clock tree nodes. + * Defined as: + * 0..5 - Bit within CLKEN register + * 6..8 - CLKEN register number + * Must stay in sync with equivalent SL_BUS_*_VALUE constants in the Silicon Labs HAL to be + * interpreted correctly by the clock control driver. + */ +#define CLOCK_ACMP0 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 18)) +#define CLOCK_ACMP1 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 19)) +#define CLOCK_AGC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 0)) +#define CLOCK_AMUXCP0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 11)) +#define CLOCK_BUFC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 11)) +#define CLOCK_BURAM (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 28)) +#define CLOCK_BURTC (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 29)) +#define CLOCK_DCDC (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 31)) +#define CLOCK_DMEM (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 27)) +#define CLOCK_DPLL0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 17)) +#define CLOCK_ECAIFADC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 28)) +#define CLOCK_EUSART0 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 22)) +#define CLOCK_EUSART1 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 23)) +#define CLOCK_FRC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 3)) +#define CLOCK_FSRCO (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 21)) +#define CLOCK_GPCRC0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 3)) +#define CLOCK_GPIO (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 26)) +#define CLOCK_HFRCO0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 18)) +#define CLOCK_HFRCOEM23 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 19)) +#define CLOCK_HFXO0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 20)) +#define CLOCK_HOSTMAILBOX (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 8)) +#define CLOCK_I2C0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 14)) +#define CLOCK_I2C1 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 15)) +#define CLOCK_IADC0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 10)) +#define CLOCK_ICACHE0 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 15)) +#define CLOCK_KEYSCAN (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 13)) +#define CLOCK_LDMA0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 0)) +#define CLOCK_LDMAXBAR0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 1)) +#define CLOCK_LETIMER0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 12)) +#define CLOCK_LFRCO (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 22)) +#define CLOCK_LFXO (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 23)) +#define CLOCK_MODEM (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 1)) +#define CLOCK_MSC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 16)) +#define CLOCK_MVP (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 30)) +#define CLOCK_PCNT0 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 21)) +#define CLOCK_PROTIMER (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 4)) +#define CLOCK_PRS (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 27)) +#define CLOCK_RAC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 5)) +#define CLOCK_RADIOAES (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 2)) +#define CLOCK_RFCRC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 2)) +#define CLOCK_RFECA0 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 25)) +#define CLOCK_RFECA1 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 26)) +#define CLOCK_RFMAILBOX (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 9)) +#define CLOCK_RFSCRATCHPAD (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 7)) +#define CLOCK_SEMAILBOX (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 10)) +#define CLOCK_SMU (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 14)) +#define CLOCK_SYNTH (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 6)) +#define CLOCK_SYSCFG (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 16)) +#define CLOCK_SYSRTC0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 30)) +#define CLOCK_TIMER0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 4)) +#define CLOCK_TIMER1 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 5)) +#define CLOCK_TIMER2 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 6)) +#define CLOCK_TIMER3 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 7)) +#define CLOCK_TIMER4 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 8)) +#define CLOCK_ULFRCO (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 24)) +#define CLOCK_USART0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 9)) +#define CLOCK_VDAC0 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 20)) +#define CLOCK_VDAC1 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 29)) +#define CLOCK_WDOG0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 13)) +#define CLOCK_WDOG1 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 17)) + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_SILABS_XG24_CLOCK_H_ */ diff --git a/include/zephyr/dt-bindings/clock/silabs/xg27-clock.h b/include/zephyr/dt-bindings/clock/silabs/xg27-clock.h new file mode 100644 index 0000000000000..c21a9e5cc9c43 --- /dev/null +++ b/include/zephyr/dt-bindings/clock/silabs/xg27-clock.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2024 Silicon Laboratories Inc. + * + * SPDX-License-Identifier: Apache-2.0 + * + * This file was generated by the script gen_clock_control.py in the hal_silabs module. + * Do not manually edit. + */ + +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_SILABS_XG27_CLOCK_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_SILABS_XG27_CLOCK_H_ + +#include +#include "common-clock.h" + +/* + * DT macros for clock tree nodes. + * Defined as: + * 0..5 - Bit within CLKEN register + * 6..8 - CLKEN register number + * Must stay in sync with equivalent SL_BUS_*_VALUE constants in the Silicon Labs HAL to be + * interpreted correctly by the clock control driver. + */ +#define CLOCK_ACMP0 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 19)) +#define CLOCK_AGC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 0)) +#define CLOCK_AMUXCP0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 11)) +#define CLOCK_BUFC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 11)) +#define CLOCK_BURAM (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 28)) +#define CLOCK_BURTC (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 29)) +#define CLOCK_CRYPTOACC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 13)) +#define CLOCK_DCDC (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 31)) +#define CLOCK_DPLL0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 17)) +#define CLOCK_ETAMPDET (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 28)) +#define CLOCK_EUSART0 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 20)) +#define CLOCK_FRC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 3)) +#define CLOCK_FSRCO (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 20)) +#define CLOCK_GPCRC0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 3)) +#define CLOCK_GPIO (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 26)) +#define CLOCK_HFRCO0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 18)) +#define CLOCK_HFXO0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 19)) +#define CLOCK_I2C0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 14)) +#define CLOCK_I2C1 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 15)) +#define CLOCK_IADC0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 10)) +#define CLOCK_ICACHE0 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 16)) +#define CLOCK_IFADCDEBUG (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 12)) +#define CLOCK_LDMA0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 0)) +#define CLOCK_LDMAXBAR0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 1)) +#define CLOCK_LETIMER0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 12)) +#define CLOCK_LFRCO (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 21)) +#define CLOCK_LFXO (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 22)) +#define CLOCK_MODEM (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 1)) +#define CLOCK_MSC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 17)) +#define CLOCK_PDM (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 25)) +#define CLOCK_PRORTC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 10)) +#define CLOCK_PROTIMER (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 4)) +#define CLOCK_PRS (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 27)) +#define CLOCK_RAC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 5)) +#define CLOCK_RADIOAES (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 2)) +#define CLOCK_RDMAILBOX0 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 8)) +#define CLOCK_RDMAILBOX1 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 9)) +#define CLOCK_RDSCRATCHPAD (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 7)) +#define CLOCK_RFCRC (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 2)) +#define CLOCK_RFSENSE (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 14)) +#define CLOCK_RTCC (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 30)) +#define CLOCK_SMU (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 15)) +#define CLOCK_SYNTH (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 6)) +#define CLOCK_SYSCFG (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 16)) +#define CLOCK_TIMER0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 4)) +#define CLOCK_TIMER1 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 5)) +#define CLOCK_TIMER2 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 6)) +#define CLOCK_TIMER3 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 7)) +#define CLOCK_TIMER4 (FIELD_PREP(CLOCK_REG_MASK, 1) | FIELD_PREP(CLOCK_BIT_MASK, 18)) +#define CLOCK_ULFRCO (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 23)) +#define CLOCK_USART0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 8)) +#define CLOCK_USART1 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 9)) +#define CLOCK_WDOG0 (FIELD_PREP(CLOCK_REG_MASK, 0) | FIELD_PREP(CLOCK_BIT_MASK, 13)) + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_SILABS_XG27_CLOCK_H_ */ diff --git a/tests/drivers/clock_control/clock_control_api/src/silabs_device_subsys.h b/tests/drivers/clock_control/clock_control_api/src/silabs_device_subsys.h new file mode 100644 index 0000000000000..e3362303ac858 --- /dev/null +++ b/tests/drivers/clock_control/clock_control_api/src/silabs_device_subsys.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024 Silicon Laboratories Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "device_subsys.h" +#include + +struct silabs_clock_control_cmu_config i2c0_clock = { + .bus_clock = CLOCK_I2C0, + .branch = CLOCK_BRANCH_LSPCLK, +}; + +struct silabs_clock_control_cmu_config wdog0_clock = { + .bus_clock = CLOCK_WDOG0, + .branch = CLOCK_BRANCH_WDOG0CLK, +}; + +static const struct device_subsys_data subsys_data[] = { + {.subsys = (void *)&i2c0_clock}, + {.subsys = (void *)&wdog0_clock}, +}; + +static const struct device_data devices[] = { + { + .dev = DEVICE_DT_GET_ONE(silabs_series_clock), + .subsys_data = subsys_data, + .subsys_cnt = ARRAY_SIZE(subsys_data) + } +}; diff --git a/tests/drivers/clock_control/clock_control_api/src/test_clock_control.c b/tests/drivers/clock_control/clock_control_api/src/test_clock_control.c index 80a62132702d9..2c857d28270e9 100644 --- a/tests/drivers/clock_control/clock_control_api/src/test_clock_control.c +++ b/tests/drivers/clock_control/clock_control_api/src/test_clock_control.c @@ -12,6 +12,8 @@ LOG_MODULE_REGISTER(test); #include "nrf_device_subsys.h" #elif DT_HAS_COMPAT_STATUS_OKAY(espressif_esp32_rtc) #include "esp32_device_subsys.h" +#elif DT_HAS_COMPAT_STATUS_OKAY(silabs_series_clock) +#include "silabs_device_subsys.h" #else #error "Unsupported board" #endif diff --git a/tests/drivers/clock_control/clock_control_api/testcase.yaml b/tests/drivers/clock_control/clock_control_api/testcase.yaml index ece53e013d760..19644639cd899 100644 --- a/tests/drivers/clock_control/clock_control_api/testcase.yaml +++ b/tests/drivers/clock_control/clock_control_api/testcase.yaml @@ -10,6 +10,9 @@ tests: - esp32c3_devkitm - esp32s2_saola - esp32s3_devkitm/esp32s3/procpu + - sltb010a@0 + - xg24_dk2601b + - xg27_dk2602a drivers.clock.clock_control_nrf5: platform_allow: - nrf51dk/nrf51822 From 00270d0d129539d4846e7b1c1d9f8de32a6b33c9 Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Wed, 25 Sep 2024 15:56:57 +0200 Subject: [PATCH 0023/4482] drivers: serial: gecko: Use clock control on Series 2 Use clock control driver to configure peripheral clock on Series 2 devices. Signed-off-by: Aksel Skauge Mellbye --- drivers/serial/Kconfig.gecko | 1 + drivers/serial/uart_gecko.c | 43 ++++++++++++++++++++++++++---------- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/drivers/serial/Kconfig.gecko b/drivers/serial/Kconfig.gecko index 8bc311cd5232b..863558c280769 100644 --- a/drivers/serial/Kconfig.gecko +++ b/drivers/serial/Kconfig.gecko @@ -11,5 +11,6 @@ config UART_GECKO select SERIAL_SUPPORT_INTERRUPT select SOC_GECKO_USART select PINCTRL if SOC_FAMILY_SILABS_S1 + select CLOCK_CONTROL if SOC_FAMILY_SILABS_S2 help Enable the Gecko uart driver. diff --git a/drivers/serial/uart_gecko.c b/drivers/serial/uart_gecko.c index 03cafb0ec04de..6a8beb3d27ddc 100644 --- a/drivers/serial/uart_gecko.c +++ b/drivers/serial/uart_gecko.c @@ -18,13 +18,21 @@ #include #endif /* CONFIG_PINCTRL */ -#if DT_NODE_HAS_PROP(id, peripheral_id) +#ifdef CONFIG_CLOCK_CONTROL +#include +#include +#define GET_GECKO_USART_CLOCK(idx) \ + .clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(idx)), \ + .clock_cfg = SILABS_DT_INST_CLOCK_CFG(idx), +#elif DT_NODE_HAS_PROP(id, peripheral_id) #define USART_PREFIX cmuClock_USART #define UART_PREFIX cmuClock_UART #define CLOCK_USART(id) _CONCAT(USART_PREFIX, id) #define CLOCK_UART(id) _CONCAT(UART_PREFIX, id) -#define GET_GECKO_USART_CLOCK(id) CLOCK_USART(DT_INST_PROP(id, peripheral_id)) -#define GET_GECKO_UART_CLOCK(id) CLOCK_UART(DT_INST_PROP(id, peripheral_id)) +#define GET_GECKO_USART_CLOCK(id) \ + .clock = CLOCK_USART(DT_INST_PROP(id, peripheral_id)), +#define GET_GECKO_UART_CLOCK(id) \ + .clock = CLOCK_UART(DT_INST_PROP(id, peripheral_id)), #else #if (USART_COUNT == 1) #define CLOCK_USART(ref) (((ref) == USART0) ? cmuClock_USART0 \ @@ -66,8 +74,10 @@ #define CLOCK_UART(ref) (((ref) == UART0) ? cmuClock_UART0 \ : ((ref) == UART1) ? cmuClock_UART1 \ : -1) -#define GET_GECKO_USART_CLOCK(id) CLOCK_USART((USART_TypeDef *)DT_INST_REG_ADDR(id)) -#define GET_GECKO_UART_CLOCK(id) CLOCK_UART((USART_TypeDef *)DT_INST_REG_ADDR(id)) +#define GET_GECKO_USART_CLOCK(id) \ + .clock = CLOCK_USART((USART_TypeDef *)DT_INST_REG_ADDR(id)), +#define GET_GECKO_UART_CLOCK(id) \ + .clock = CLOCK_UART((USART_TypeDef *)DT_INST_REG_ADDR(id)), #endif /* DT_NODE_HAS_PROP(id, peripheral_id) */ /* Helper define to determine if SOC supports hardware flow control */ @@ -119,7 +129,12 @@ struct uart_gecko_config { const struct pinctrl_dev_config *pcfg; #endif /* CONFIG_PINCTRL */ USART_TypeDef *base; +#ifdef CONFIG_CLOCK_CONTROL + const struct device *clock_dev; + const struct silabs_clock_control_cmu_config clock_cfg; +#else CMU_Clock_TypeDef clock; +#endif uint32_t baud_rate; #ifndef CONFIG_PINCTRL #ifdef UART_GECKO_HW_FLOW_CONTROL @@ -437,12 +452,16 @@ static int uart_gecko_init(const struct device *dev) USART_InitAsync_TypeDef usartInit = USART_INITASYNC_DEFAULT; - /* The peripheral and gpio clock are already enabled from soc and gpio - * driver - */ - + /* The peripheral and gpio clock are already enabled from soc and gpio driver */ /* Enable USART clock */ +#ifdef CONFIG_CLOCK_CONTROL + err = clock_control_on(config->clock_dev, (clock_control_subsys_t)&config->clock_cfg); + if (err < 0) { + return err; + } +#else CMU_ClockEnable(config->clock, true); +#endif /* Init USART */ usartInit.baudrate = config->baud_rate; @@ -613,7 +632,7 @@ static const struct uart_driver_api uart_gecko_driver_api = { \ static const struct uart_gecko_config uart_gecko_cfg_##idx = { \ .base = (USART_TypeDef *)DT_INST_REG_ADDR(idx), \ - .clock = GET_GECKO_UART_CLOCK(idx), \ + GET_GECKO_UART_CLOCK(idx) \ .baud_rate = DT_INST_PROP(idx, current_speed), \ GECKO_UART_HW_FLOW_CONTROL(idx) \ GECKO_UART_RX_TX_PINS(idx) \ @@ -671,7 +690,7 @@ DT_INST_FOREACH_STATUS_OKAY(GECKO_UART_INIT) static const struct uart_gecko_config usart_gecko_cfg_##idx = { \ .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(idx), \ .base = (USART_TypeDef *)DT_INST_REG_ADDR(idx), \ - .clock = GET_GECKO_USART_CLOCK(idx), \ + GET_GECKO_USART_CLOCK(idx) \ .baud_rate = DT_INST_PROP(idx, current_speed), \ GECKO_USART_IRQ_HANDLER_FUNC(idx) \ }; \ @@ -694,7 +713,7 @@ DT_INST_FOREACH_STATUS_OKAY(GECKO_UART_INIT) \ static const struct uart_gecko_config usart_gecko_cfg_##idx = { \ .base = (USART_TypeDef *)DT_INST_REG_ADDR(idx), \ - .clock = GET_GECKO_USART_CLOCK(idx), \ + GET_GECKO_USART_CLOCK(idx) \ .baud_rate = DT_INST_PROP(idx, current_speed), \ GECKO_UART_HW_FLOW_CONTROL(idx) \ GECKO_UART_RX_TX_PINS(idx) \ From d82acdc4e41b63e87259842da0b05ad8d7b674c3 Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Wed, 25 Sep 2024 15:58:59 +0200 Subject: [PATCH 0024/4482] drivers: spi: gecko: Use clock control on Series 2 Use clock control driver to configure peripheral clock on Series 2 devices. Signed-off-by: Aksel Skauge Mellbye --- drivers/spi/Kconfig.gecko | 1 + drivers/spi/spi_gecko.c | 47 ++++++++++++++++++++++++++++++++++----- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/drivers/spi/Kconfig.gecko b/drivers/spi/Kconfig.gecko index 4010eb6c73513..b2f47f2e366ef 100644 --- a/drivers/spi/Kconfig.gecko +++ b/drivers/spi/Kconfig.gecko @@ -9,5 +9,6 @@ config SPI_GECKO depends on DT_HAS_SILABS_GECKO_SPI_USART_ENABLED depends on GPIO select SOC_GECKO_USART + select CLOCK_CONTROL_SILABS_SERIES if SOC_FAMILY_SILABS_S2 help Enable the SPI peripherals on Gecko diff --git a/drivers/spi/spi_gecko.c b/drivers/spi/spi_gecko.c index 99088d40a4ca3..009f429d7ed51 100644 --- a/drivers/spi/spi_gecko.c +++ b/drivers/spi/spi_gecko.c @@ -30,9 +30,16 @@ LOG_MODULE_REGISTER(spi_gecko); #endif #endif /* CONFIG_PINCTRL */ -#if DT_NODE_HAS_PROP(n, peripheral_id) +#ifdef CONFIG_CLOCK_CONTROL +#include +#include +#define GET_GECKO_USART_CLOCK(idx) \ + .clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(idx)), \ + .clock_cfg = SILABS_DT_INST_CLOCK_CFG(idx), +#elif DT_NODE_HAS_PROP(n, peripheral_id) #define CLOCK_USART(id) _CONCAT(cmuClock_USART, id) -#define GET_GECKO_USART_CLOCK(n) CLOCK_USART(DT_INST_PROP(n, peripheral_id)) +#define GET_GECKO_USART_CLOCK(n) \ + .clock = CLOCK_USART(DT_INST_PROP(n, peripheral_id)), #else #if (USART_COUNT == 1) #define CLOCK_USART(ref) (((ref) == USART0) ? cmuClock_USART0 \ @@ -70,7 +77,8 @@ LOG_MODULE_REGISTER(spi_gecko); #else #error "Undefined number of USARTs." #endif /* USART_COUNT */ -#define GET_GECKO_USART_CLOCK(id) CLOCK_USART((USART_TypeDef *)DT_INST_REG_ADDR(id)) +#define GET_GECKO_USART_CLOCK(id) \ + .clock = CLOCK_USART((USART_TypeDef *)DT_INST_REG_ADDR(id)), #endif /* DT_NODE_HAS_PROP(n, peripheral_id) */ @@ -84,7 +92,12 @@ struct spi_gecko_data { struct spi_gecko_config { USART_TypeDef *base; +#ifdef CONFIG_CLOCK_CONTROL + const struct device *clock_dev; + const struct silabs_clock_control_cmu_config clock_cfg; +#else CMU_Clock_TypeDef clock; +#endif uint32_t clock_frequency; #ifdef CONFIG_PINCTRL const struct pinctrl_dev_config *pcfg; @@ -106,7 +119,22 @@ static int spi_config(const struct device *dev, { const struct spi_gecko_config *gecko_config = dev->config; struct spi_gecko_data *data = dev->data; - uint32_t spi_frequency = CMU_ClockFreqGet(gecko_config->clock) / 2; + uint32_t spi_frequency; + +#ifdef CONFIG_CLOCK_CONTROL + int err; + + err = clock_control_get_rate(gecko_config->clock_dev, + (clock_control_subsys_t)&gecko_config->clock_cfg, + &spi_frequency); + if (err) { + return err; + } + /* Max supported SPI frequency is half the source clock */ + spi_frequency /= 2; +#else + spi_frequency = CMU_ClockFreqGet(gecko_config->clock) / 2; +#endif if (config->operation & SPI_HALF_DUPLEX) { LOG_ERR("Half-duplex not supported"); @@ -314,7 +342,14 @@ static int spi_gecko_init(const struct device *dev) #endif /* Enable USART clock */ +#ifdef CONFIG_CLOCK_CONTROL + err = clock_control_on(config->clock_dev, (clock_control_subsys_t)&config->clock_cfg); + if (err < 0) { + return err; + } +#else CMU_ClockEnable(config->clock, true); +#endif /* Init USART */ USART_InitSync(config->base, &usartInit); @@ -405,7 +440,7 @@ static const struct spi_driver_api spi_gecko_api = { .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ .base = (USART_TypeDef *) \ DT_INST_REG_ADDR(n), \ - .clock = GET_GECKO_USART_CLOCK(n), \ + GET_GECKO_USART_CLOCK(n) \ .clock_frequency = DT_INST_PROP_OR(n, clock_frequency, 1000000) \ }; \ DEVICE_DT_INST_DEFINE(n, \ @@ -426,7 +461,7 @@ static const struct spi_driver_api spi_gecko_api = { static struct spi_gecko_config spi_gecko_cfg_##n = { \ .base = (USART_TypeDef *) \ DT_INST_REG_ADDR(n), \ - .clock = GET_GECKO_USART_CLOCK(n), \ + GET_GECKO_USART_CLOCK(n) \ .clock_frequency = DT_INST_PROP_OR(n, clock_frequency, 1000000), \ .pin_rx = { DT_INST_PROP_BY_IDX(n, location_rx, 1), \ DT_INST_PROP_BY_IDX(n, location_rx, 2), \ From de70ebd66f20a6e141aff5bb36763f70baf04d92 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 26 Sep 2024 14:43:57 +0200 Subject: [PATCH 0025/4482] boards: nordic: do not enable DMA_RAM21 region by default This region is only required if certain fast peripherals make use of such region for DMAing. It was now enabled on all builds, often resulting in: ``` [134/134] Linking C executable zephyr/zephyr.elf Memory region Used Size Region Size %age Used FLASH: 24372 B 248 KB 9.60% RAM: 4448 B 256 KB 1.70% DMA_RAM21: 0 GB 16 KB 0.00% <~~ Not used! DMA_RAM3x_APP: 40 B 4 KB 0.98% IDT_LIST: 0 GB 32 KB 0.00% ``` Signed-off-by: Gerard Marull-Paretas --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 4 ---- boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts | 4 ---- .../boards/nrf/dmm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 4 ++++ .../boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay | 4 ++++ .../boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay | 4 ++++ .../boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay | 4 ++++ 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 517b6ed853c44..04cb9608b3a0a 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -193,10 +193,6 @@ ipc0: &cpuapp_cpurad_ipc { status = "okay"; }; -&dma_fast_region { - status = "okay"; -}; - &cpuapp_rx_partitions { status = "okay"; }; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts index ceb4ddc3ff177..66d5dc81603de 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts @@ -197,10 +197,6 @@ ipc0: &cpuapp_cpurad_ipc { status = "okay"; }; -&dma_fast_region { - status = "okay"; -}; - &cpuapp_rx_partitions { status = "okay"; }; diff --git a/tests/boards/nrf/dmm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/boards/nrf/dmm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 513ef21776ff9..39ec122b32fac 100644 --- a/tests/boards/nrf/dmm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/boards/nrf/dmm/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -47,6 +47,10 @@ memory-regions = <&cpuapp_dma_region>; }; +&dma_fast_region { + status = "okay"; +}; + &spi120 { compatible = "nordic,nrf-spim"; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay index 0523426db4580..9422ff33fd6d7 100644 --- a/tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay +++ b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay @@ -46,6 +46,10 @@ status = "okay"; }; +&dma_fast_region { + status = "okay"; +}; + &spi121 { compatible = "nordic,nrf-spim"; status = "okay"; diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay b/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay index 0523426db4580..9422ff33fd6d7 100644 --- a/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay +++ b/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay @@ -46,6 +46,10 @@ status = "okay"; }; +&dma_fast_region { + status = "okay"; +}; + &spi121 { compatible = "nordic,nrf-spim"; status = "okay"; diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay index d6c3c972afd33..b140cd34ff480 100644 --- a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay +++ b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay @@ -23,6 +23,10 @@ }; }; +&dma_fast_region { + status = "okay"; +}; + &spi120 { status = "okay"; pinctrl-0 = <&spi120_default>; From 077dd8f1427a503c4368810249c66fdfe017c141 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 26 Sep 2024 15:48:36 +0300 Subject: [PATCH 0026/4482] net: dns: Increase the size of dispatcher table The dispatcher table needs to be large enough to have support for all file descriptor values. Fixes #79042 Signed-off-by: Jukka Rissanen --- subsys/net/lib/dns/dispatcher.c | 2 +- subsys/net/lib/sockets/Kconfig | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/subsys/net/lib/dns/dispatcher.c b/subsys/net/lib/dns/dispatcher.c index 674872e65ee5d..e7515b22d1d71 100644 --- a/subsys/net/lib/dns/dispatcher.c +++ b/subsys/net/lib/dns/dispatcher.c @@ -31,7 +31,7 @@ NET_BUF_POOL_DEFINE(dns_msg_pool, DNS_RESOLVER_BUF_CTR, static struct socket_dispatch_table { struct dns_socket_dispatcher *ctx; -} dispatch_table[CONFIG_NET_SOCKETS_POLL_MAX]; +} dispatch_table[CONFIG_ZVFS_OPEN_MAX]; static int dns_dispatch(struct dns_socket_dispatcher *dispatcher, int sock, struct sockaddr *addr, size_t addrlen, diff --git a/subsys/net/lib/sockets/Kconfig b/subsys/net/lib/sockets/Kconfig index 87fd6efd4c0d1..1fec457827063 100644 --- a/subsys/net/lib/sockets/Kconfig +++ b/subsys/net/lib/sockets/Kconfig @@ -50,6 +50,7 @@ config NET_SOCKETS_POLL_MAX default 6 if WIFI_NM_WPA_SUPPLICANT default 4 if SHELL_BACKEND_TELNET default 3 + range 1 ZVFS_OPEN_MAX help Maximum number of entries supported for poll() call. From 2ff26674a26d544df7a54b9481ec4d7b1430d47b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 26 Sep 2024 15:55:42 +0300 Subject: [PATCH 0027/4482] net: dns: Check that dispatcher table is not overflowing Add CHECKIF() checks that verify that dispatcher table is not overflowing. Signed-off-by: Jukka Rissanen --- subsys/net/lib/dns/dispatcher.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/subsys/net/lib/dns/dispatcher.c b/subsys/net/lib/dns/dispatcher.c index e7515b22d1d71..266c616d74fe9 100644 --- a/subsys/net/lib/dns/dispatcher.c +++ b/subsys/net/lib/dns/dispatcher.c @@ -255,6 +255,11 @@ int dns_dispatcher_register(struct dns_socket_dispatcher *ctx) entry->pair = ctx; for (int i = 0; i < ctx->fds_len; i++) { + CHECKIF((int)ctx->fds[i].fd >= (int)ARRAY_SIZE(dispatch_table)) { + ret = -ERANGE; + goto out; + } + if (dispatch_table[ctx->fds[i].fd].ctx == NULL) { dispatch_table[ctx->fds[i].fd].ctx = ctx; } @@ -287,6 +292,11 @@ int dns_dispatcher_register(struct dns_socket_dispatcher *ctx) ctx->pair = NULL; for (int i = 0; i < ctx->fds_len; i++) { + if ((int)ctx->fds[i].fd >= (int)ARRAY_SIZE(dispatch_table)) { + ret = -ERANGE; + goto out; + } + if (dispatch_table[ctx->fds[i].fd].ctx == NULL) { dispatch_table[ctx->fds[i].fd].ctx = ctx; } @@ -308,17 +318,25 @@ int dns_dispatcher_register(struct dns_socket_dispatcher *ctx) int dns_dispatcher_unregister(struct dns_socket_dispatcher *ctx) { + int ret = 0; + k_mutex_lock(&lock, K_FOREVER); (void)sys_slist_find_and_remove(&sockets, &ctx->node); for (int i = 0; i < ctx->fds_len; i++) { + CHECKIF((int)ctx->fds[i].fd >= (int)ARRAY_SIZE(dispatch_table)) { + ret = -ERANGE; + goto out; + } + dispatch_table[ctx->fds[i].fd].ctx = NULL; } +out: k_mutex_unlock(&lock); - return 0; + return ret; } void dns_dispatcher_init(void) From 759f3a0c7c641e9af9d0aac3397abf687443d1a0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 27 Sep 2024 08:51:43 +0300 Subject: [PATCH 0028/4482] tests/samples: net: Fix the max number of file descriptors Make sure that CONFIG_ZVFS_OPEN_MAX in the tests and samples is at least the same value as CONFIG_NET_SOCKETS_POLL_MAX so that we cannot have more polled sockets than there are available file descriptors. Signed-off-by: Jukka Rissanen --- samples/net/sockets/echo_service/prj.conf | 1 + tests/net/all/prj.conf | 1 + tests/net/lib/dns_addremove/prj.conf | 1 + tests/net/lib/dns_resolve/prj.conf | 2 +- tests/net/lib/mdns_responder/prj.conf | 1 + tests/net/pm/prj.conf | 2 +- tests/net/socket/service/prj.conf | 2 +- 7 files changed, 7 insertions(+), 3 deletions(-) diff --git a/samples/net/sockets/echo_service/prj.conf b/samples/net/sockets/echo_service/prj.conf index b9c053c27a2b6..3b12a23837805 100644 --- a/samples/net/sockets/echo_service/prj.conf +++ b/samples/net/sockets/echo_service/prj.conf @@ -14,6 +14,7 @@ CONFIG_ZVFS_OPEN_MAX=10 CONFIG_NET_MAX_CONN=5 CONFIG_NET_SOCKETS_SERVICE=y CONFIG_NET_SOCKETS_POLL_MAX=20 +CONFIG_ZVFS_OPEN_MAX=20 # Network driver config CONFIG_TEST_RANDOM_GENERATOR=y diff --git a/tests/net/all/prj.conf b/tests/net/all/prj.conf index 7944be6a884d6..f4f42f781874e 100644 --- a/tests/net/all/prj.conf +++ b/tests/net/all/prj.conf @@ -354,6 +354,7 @@ CONFIG_NET_SOCKETS_LOG_LEVEL_DBG=y CONFIG_NET_SOCKETS_OFFLOAD=y CONFIG_NET_SOCKETS_PACKET=y CONFIG_NET_SOCKETS_POLL_MAX=50 +CONFIG_ZVFS_OPEN_MAX=50 CONFIG_NET_SOCKETS=y CONFIG_NET_SOCKETS_SOCKOPT_TLS=y CONFIG_NET_SOCKETS_TLS_MAX_CIPHERSUITES=10 diff --git a/tests/net/lib/dns_addremove/prj.conf b/tests/net/lib/dns_addremove/prj.conf index c28f0a14eac19..81c65b34f32f8 100644 --- a/tests/net/lib/dns_addremove/prj.conf +++ b/tests/net/lib/dns_addremove/prj.conf @@ -18,3 +18,4 @@ CONFIG_PRINTK=y CONFIG_ZTEST=y CONFIG_MAIN_STACK_SIZE=2048 CONFIG_NET_SOCKETS_POLL_MAX=5 +CONFIG_ZVFS_OPEN_MAX=5 diff --git a/tests/net/lib/dns_resolve/prj.conf b/tests/net/lib/dns_resolve/prj.conf index 39ab38272e6ac..e90e185040aa7 100644 --- a/tests/net/lib/dns_resolve/prj.conf +++ b/tests/net/lib/dns_resolve/prj.conf @@ -30,4 +30,4 @@ CONFIG_ZTEST=y CONFIG_MAIN_STACK_SIZE=1344 CONFIG_NET_SOCKETS_POLL_MAX=9 -CONFIG_ZVFS_OPEN_MAX=8 +CONFIG_ZVFS_OPEN_MAX=9 diff --git a/tests/net/lib/mdns_responder/prj.conf b/tests/net/lib/mdns_responder/prj.conf index 6d4db394c8db5..9ea509698981b 100644 --- a/tests/net/lib/mdns_responder/prj.conf +++ b/tests/net/lib/mdns_responder/prj.conf @@ -6,6 +6,7 @@ CONFIG_NET_LOOPBACK=y CONFIG_NET_IPV4=y CONFIG_NET_IPV6=y CONFIG_NET_SOCKETS_POLL_MAX=7 +CONFIG_ZVFS_OPEN_MAX=7 # Network driver config CONFIG_TEST_RANDOM_GENERATOR=y diff --git a/tests/net/pm/prj.conf b/tests/net/pm/prj.conf index 5d478e4d0700b..9c838139d9b8e 100644 --- a/tests/net/pm/prj.conf +++ b/tests/net/pm/prj.conf @@ -7,7 +7,7 @@ CONFIG_NET_L2_ETHERNET=n CONFIG_NET_UDP=y CONFIG_NET_IPV4=y CONFIG_NET_SOCKETS=y -CONFIG_ZVFS_OPEN_MAX=2 +CONFIG_ZVFS_OPEN_MAX=3 CONFIG_ZTEST_STACK_SIZE=2048 CONFIG_MAIN_STACK_SIZE=2048 CONFIG_NET_LOG=y diff --git a/tests/net/socket/service/prj.conf b/tests/net/socket/service/prj.conf index 5f5c2325a335b..d0664554f7fe8 100644 --- a/tests/net/socket/service/prj.conf +++ b/tests/net/socket/service/prj.conf @@ -5,7 +5,7 @@ CONFIG_NET_IPV6=y CONFIG_NET_UDP=y CONFIG_NET_TCP=y CONFIG_NET_SOCKETS=y -CONFIG_ZVFS_OPEN_MAX=10 +CONFIG_ZVFS_OPEN_MAX=20 CONFIG_NET_PKT_TX_COUNT=8 CONFIG_NET_PKT_RX_COUNT=8 CONFIG_NET_MAX_CONN=5 From d128a078f6f8cebf1a450b219897f0f29c55dee3 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Thu, 26 Sep 2024 16:18:26 +0200 Subject: [PATCH 0029/4482] cmake: change test message overwrite to macro Fixes: #79052 The yaml CMake tests overwrites `message()` in order to verify correct error handling. This was original done in a function and then using a return call when an expected error has been raised. Using a function() means the `return()` only returns the `message()` and thus wrongly continue processing rest of the yaml file. Change `message()` to macro so the return call correctly returns from the calling yaml functions. Signed-off-by: Torsten Rasmussen --- tests/cmake/yaml/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/cmake/yaml/CMakeLists.txt b/tests/cmake/yaml/CMakeLists.txt index ee3c6a82861c3..04873efa9a9ec 100644 --- a/tests/cmake/yaml/CMakeLists.txt +++ b/tests/cmake/yaml/CMakeLists.txt @@ -8,7 +8,7 @@ target_sources(app PRIVATE ${ZEPHYR_BASE}/misc/empty_file.c) set_property(GLOBAL PROPERTY EXPECTED_ERROR 0) -function(message) +macro(message) if(DEFINED expect_failure) if(${ARGV0} STREQUAL FATAL_ERROR) if("${ARGV1}" STREQUAL "${expect_failure}") @@ -23,7 +23,7 @@ function(message) endif() endif() _message(${ARGN}) -endfunction() +endmacro() macro(test_assert) cmake_parse_arguments(TA_ARG "" "COMMENT" "TEST" ${ARGN}) From 9ae8ebfadef412ed6981445988bbc05f1d23bba5 Mon Sep 17 00:00:00 2001 From: alperen sener Date: Thu, 26 Sep 2024 16:11:37 +0200 Subject: [PATCH 0030/4482] Tests: Bluetooth: Tester: Increase the number of max mesh tx segments Increasing the number of max tx segments to be able to fit composition page 0 into composition data status message. After the subnet bridge config client and server are added to the tester, the size needed to report composition data page 0 increased. Current behaviour of the tester is correct, dropping the element when there is not enough space in data field, however the PTS application does not handle the composition data status message without element. Signed-off-by: alperen sener --- tests/bluetooth/tester/overlay-mesh.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/bluetooth/tester/overlay-mesh.conf b/tests/bluetooth/tester/overlay-mesh.conf index a9e96686da8aa..1e488bad00bd6 100644 --- a/tests/bluetooth/tester/overlay-mesh.conf +++ b/tests/bluetooth/tester/overlay-mesh.conf @@ -15,6 +15,7 @@ CONFIG_BT_MESH_HEALTH_CLI=y CONFIG_BT_MESH_FRIEND=y CONFIG_BT_MESH_FRIEND_QUEUE_SIZE=32 CONFIG_BT_MESH_RX_SEG_MAX=13 +CONFIG_BT_MESH_TX_SEG_MAX=7 CONFIG_BT_MESH_TX_SEG_MSG_COUNT=3 CONFIG_BT_MESH_LPN_POLL_TIMEOUT=100 CONFIG_BT_MESH_PROVISIONER=y From 0a8e1ad972b984c9d1ec05dd3c3a353161917c9c Mon Sep 17 00:00:00 2001 From: Lars-Ove Karlsson Date: Thu, 26 Sep 2024 14:28:04 +0200 Subject: [PATCH 0031/4482] libc: minimal: math: Removed undefined behavior in sqrt routines The previous code used casts of address of int to float pointer. This is undefined behavior in C and may cause a compiler to optimize code incorrectly. I have replaced it with a union of int and float types, eliminating the cast problem. Signed-off-by: Lars-Ove Karlsson --- lib/libc/minimal/source/math/sqrt.c | 28 ++++++++++++++++------------ lib/libc/minimal/source/math/sqrtf.c | 28 ++++++++++++++++------------ 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/lib/libc/minimal/source/math/sqrt.c b/lib/libc/minimal/source/math/sqrt.c index df0f8c0315c42..07fc1eaeebded 100644 --- a/lib/libc/minimal/source/math/sqrt.c +++ b/lib/libc/minimal/source/math/sqrt.c @@ -15,15 +15,19 @@ #define MAX_D_ERROR_COUNT 5 /* when result almost converges, stop */ #define EXP_MASK64 GENMASK64(62, 52) +typedef union { + double d; + int64_t i; +} int64double_t; + double sqrt(double square) { int i; - int64_t exponent; - double root; - double last; - int64_t *p_square = (int64_t *)□ - int64_t *p_root = (int64_t *)&root; - int64_t *p_last = (int64_t *)&last; + int64_t exponent; + int64double_t root; + int64double_t last; + int64double_t p_square; + p_square.d = square; if (square == 0.0) { return square; @@ -36,21 +40,21 @@ double sqrt(double square) * we can do this by dividing the exponent part of the float by 2 * this assumes IEEE-754 format doubles */ - exponent = ((*p_square & EXP_MASK64)>>52)-1023; - if (exponent == 0x7FF-1023) { + exponent = ((p_square.i & EXP_MASK64) >> 52) - 1023; + if (exponent == 0x7FF - 1023) { /* the number is a NAN or inf, return NaN or inf */ return square + square; } exponent /= 2; - *p_root = (*p_square & ~EXP_MASK64) | (exponent+1023)<<52; + root.i = (p_square.i & ~EXP_MASK64) | (exponent + 1023) << 52; for (i = 0; i < MAX_D_ITTERATIONS; i++) { last = root; - root = (root + square / root) * 0.5; + root.d = (root.d + square / root.d) * 0.5; /* if (llabs(*p_root-*p_last)>23)-127; - if (exponent == 0xFF-127) { + exponent = ((p_square.i & EXP_MASK32) >> 23) - 127; + if (exponent == 0xFF - 127) { /* the number is a NAN or inf, return NaN or inf */ return square + square; } exponent /= 2; - *p_root = (*p_square & ~EXP_MASK32) | (exponent+127) << 23; + root.i = (p_square.i & ~EXP_MASK32) | (exponent + 127) << 23; for (i = 0; i < MAX_F_ITTERATIONS; i++) { last = root; - root = (root + square / root) * 0.5f; + root.f = (root.f + square / root.f) * 0.5f; /* if (labs(*p_root - *p_last) < MAX_F_ERROR_COUNT) */ - if ((*p_root ^ *p_last) < MAX_F_ERROR_COUNT) { + if ((root.i ^ last.i) < MAX_F_ERROR_COUNT) { break; } } - return root; + return root.f; } From 8fceb6421f27218d7d3a5fc7c16e15c349cfa1fb Mon Sep 17 00:00:00 2001 From: Lars-Ove Karlsson Date: Thu, 26 Sep 2024 17:32:28 +0200 Subject: [PATCH 0032/4482] libc: minimal: math: Removed undefined behavior in sqrt routines Fixed a clang config warning. Signed-off-by: Lars-Ove Karlsson --- lib/libc/minimal/source/math/sqrt.c | 1 + lib/libc/minimal/source/math/sqrtf.c | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/libc/minimal/source/math/sqrt.c b/lib/libc/minimal/source/math/sqrt.c index 07fc1eaeebded..48e3212312ecb 100644 --- a/lib/libc/minimal/source/math/sqrt.c +++ b/lib/libc/minimal/source/math/sqrt.c @@ -27,6 +27,7 @@ double sqrt(double square) int64double_t root; int64double_t last; int64double_t p_square; + p_square.d = square; if (square == 0.0) { diff --git a/lib/libc/minimal/source/math/sqrtf.c b/lib/libc/minimal/source/math/sqrtf.c index a3116e54701a3..673e54e1fb592 100644 --- a/lib/libc/minimal/source/math/sqrtf.c +++ b/lib/libc/minimal/source/math/sqrtf.c @@ -27,6 +27,7 @@ float sqrtf(float square) intfloat_t root; intfloat_t last; intfloat_t p_square; + p_square.f = square; if (square == 0.0f) { From 5e2203a6cdd0daf395bb3825d416843ecdc40629 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Mon, 30 Sep 2024 14:03:29 +0000 Subject: [PATCH 0033/4482] stepper: shell: fix uninitialized variable compiler warning Fixes: /__w/zephyr/zephyr/include/zephyr/drivers/stepper.h:429:16: error: 'direction' may be used uninitialized [-Werror=maybe-uninitialized] found with: west build -p -b esp32s3_touch_lcd_1_28/esp32s3/appcpu -T tests/drivers/stepper/shell/drivers.stepper.shell Signed-off-by: Fabio Baltieri --- drivers/stepper/stepper_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/stepper/stepper_shell.c b/drivers/stepper/stepper_shell.c index fba5c3014ee54..10ab67fb2c649 100644 --- a/drivers/stepper/stepper_shell.c +++ b/drivers/stepper/stepper_shell.c @@ -360,7 +360,7 @@ static int cmd_stepper_enable_constant_velocity_mode(const struct shell *sh, siz { const struct device *dev; int err = -EINVAL; - enum stepper_direction direction; + enum stepper_direction direction = STEPPER_DIRECTION_POSITIVE; for (int i = 0; i < ARRAY_SIZE(stepper_direction_map); i++) { if (strcmp(argv[ARG_IDX_PARAM], stepper_direction_map[i].name) == 0) { From 7f40866168f27f6c3edc78eb542378b51469d49b Mon Sep 17 00:00:00 2001 From: Emilio Benavente Date: Thu, 26 Sep 2024 20:10:11 +0000 Subject: [PATCH 0034/4482] boards: nxp: mimxrt1060_evk: Updated Active state for user_led The User LED for the mimxrt1060_evkb is inverted from the mimxrt1060_evk, this commit updates the ACTIVE_STATE to be HIGH rather than LOW. Signed-off-by: Emilio Benavente --- boards/nxp/mimxrt1060_evk/mimxrt1060_evkb.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/nxp/mimxrt1060_evk/mimxrt1060_evkb.dts b/boards/nxp/mimxrt1060_evk/mimxrt1060_evkb.dts index 506f0d0d7a795..905d32d89aa41 100644 --- a/boards/nxp/mimxrt1060_evk/mimxrt1060_evkb.dts +++ b/boards/nxp/mimxrt1060_evk/mimxrt1060_evkb.dts @@ -13,6 +13,6 @@ }; &green_led { - gpios = <&gpio1 8 GPIO_ACTIVE_LOW>; + gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>; label = "User LED1"; }; From aac15846fa45b6ad653e4e8efb4f1fd307246bc4 Mon Sep 17 00:00:00 2001 From: Helmut Lord Date: Thu, 26 Sep 2024 05:37:30 -0400 Subject: [PATCH 0035/4482] west_commands: build: add extra file arguments Adds an argument to include additional .conf or .overlay files Example use: ``` west build -b nrf52840dk/nrf52840 -p --extra-conf foo.conf ``` ``` west build -b nrf52840dk/nrf52840 -p --extra-dtc-overlay foo.overlay ``` Or: ``` west build -b nrf52840dk/nrf52840 -p --extra-conf foo.conf --extra-conf bar.conf ``` ``` west build -b nrf52840dk/nrf52840 -p --extra-dtc-overlay foo.overlay --extra-dtc-overlay bar.overlay ``` Signed-off-by: Helmut Lord --- scripts/west_commands/build.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/scripts/west_commands/build.py b/scripts/west_commands/build.py index 6bedd61937fa5..891a842bb8866 100644 --- a/scripts/west_commands/build.py +++ b/scripts/west_commands/build.py @@ -28,6 +28,8 @@ [-t TARGET] [-p {auto, always, never}] [-c] [--cmake-only] [-n] [-o BUILD_OPT] [-f] [--sysbuild | --no-sysbuild] [--domain DOMAIN] + [--extra-conf FILE.conf] + [--extra-dtc-overlay FILE.overlay] [source_dir] -- [cmake_opt [cmake_opt ...]] ''' @@ -150,6 +152,20 @@ def do_add_parser(self, parser_adder): Do not use this option with manually specified -DSHIELD... cmake arguments: the results are undefined''') + group.add_argument('--extra-conf', dest='extra_conf_files', metavar='EXTRA_CONF_FILE', + action='append', default=[], + help='''add the argument to EXTRA_CONF_FILE; may be given + multiple times. Forces CMake to run again if given. + Do not use this option with manually specified + -DEXTRA_CONF_FILE... cmake arguments: the results are + undefined''') + group.add_argument('--extra-dtc-overlay', dest='extra_dtc_overlay_files', + metavar='EXTRA_DTC_OVERLAY_FILE', action='append', default=[], + help='''add the argument to EXTRA_DTC_OVERLAY_FILE; may be given + multiple times. Forces CMake to run again if given. + Do not use this option with manually specified + -DEXTRA_DTC_OVERLAY_FILE... cmake arguments: the results are + undefined''') group = parser.add_mutually_exclusive_group() group.add_argument('--sysbuild', action='store_true', @@ -223,7 +239,8 @@ def do_run(self, args, remainder): self._update_cache() if (self.args.cmake or self.args.cmake_opts or self.args.cmake_only or self.args.snippets or - self.args.shields): + self.args.shields or self.args.extra_conf_files or + self.args.extra_dtc_overlay_files): self.run_cmake = True else: self.run_cmake = True @@ -570,6 +587,13 @@ def _run_cmake(self, board, origin, cmake_opts): cmake_opts.append(f'-DSNIPPET={";".join(self.args.snippets)}') if self.args.shields: cmake_opts.append(f'-DSHIELD={";".join(self.args.shields)}') + if self.args.extra_conf_files: + cmake_opts.append(f'-DEXTRA_CONF_FILE={";".join(self.args.extra_conf_files)}') + if self.args.extra_dtc_overlay_files: + cmake_opts.append( + f'-DEXTRA_DTC_OVERLAY_FILE=' + f'{";".join(self.args.extra_dtc_overlay_files)}' + ) user_args = config_get('cmake-args', None) if user_args: From 7e21f2e1ced3cd92e02d6b00430cad37eb756b45 Mon Sep 17 00:00:00 2001 From: Ryan McClelland Date: Wed, 25 Sep 2024 10:23:49 -0700 Subject: [PATCH 0036/4482] drivers: i3c: shell: add parse args func for rstact Add the parse args function for the rstact Signed-off-by: Ryan McClelland --- drivers/i3c/i3c_shell.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/i3c/i3c_shell.c b/drivers/i3c/i3c_shell.c index 7c240512a5226..9ad1dfeac0dce 100644 --- a/drivers/i3c/i3c_shell.c +++ b/drivers/i3c/i3c_shell.c @@ -1064,21 +1064,9 @@ static int cmd_i3c_ccc_rstact(const struct shell *sh, size_t argc, char **argv) int ret; uint8_t data; - dev = device_get_binding(argv[ARGV_DEV]); - if (!dev) { - shell_error(sh, "I3C: Device driver %s not found.", argv[ARGV_DEV]); - return -ENODEV; - } - - tdev = device_get_binding(argv[ARGV_TDEV]); - if (!tdev) { - shell_error(sh, "I3C: Device driver %s not found.", argv[ARGV_TDEV]); - return -ENODEV; - } - desc = get_i3c_attached_desc_from_dev_name(dev, tdev->name); - if (!desc) { - shell_error(sh, "I3C: Device %s not attached to bus.", tdev->name); - return -ENODEV; + ret = i3c_parse_args(sh, argv, &dev, &tdev, &desc); + if (ret != 0) { + return ret; } action = strtol(argv[5], NULL, 16); From 507e8170fa074abbdbb9b3f04742ac6361d7435a Mon Sep 17 00:00:00 2001 From: Ryan McClelland Date: Wed, 25 Sep 2024 17:22:45 -0700 Subject: [PATCH 0037/4482] drivers: i3c: shell: fixup rstact Both #78823 and #78807 merged at around the same time. This made it so the shell didn't compile when #78823 was stacked on top as it did not run with the test build. This fixes the compile issues. Signed-off-by: Ryan McClelland --- drivers/i3c/i3c_shell.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/i3c/i3c_shell.c b/drivers/i3c/i3c_shell.c index 9ad1dfeac0dce..194942aa8e426 100644 --- a/drivers/i3c/i3c_shell.c +++ b/drivers/i3c/i3c_shell.c @@ -1072,9 +1072,9 @@ static int cmd_i3c_ccc_rstact(const struct shell *sh, size_t argc, char **argv) action = strtol(argv[5], NULL, 16); if (strcmp(argv[4], "get") == 0) { - ret = i3c_ccc_do_rstact_fmt3(tdev, action, &data); + ret = i3c_ccc_do_rstact_fmt3(desc, action, &data); } else if (strcmp(argv[4], "set") == 0) { - ret = i3c_ccc_do_rstact_fmt2(tdev, action); + ret = i3c_ccc_do_rstact_fmt2(desc, action); } else { shell_error(sh, "I3C: invalid parameter"); return -EINVAL; @@ -1086,7 +1086,7 @@ static int cmd_i3c_ccc_rstact(const struct shell *sh, size_t argc, char **argv) } if (action >= 0x80) { - shell_print("RSTACT Returned Data: 0x%02x", data); + shell_print(sh, "RSTACT Returned Data: 0x%02x", data); } return ret; From 901044f1e72f650d74eb18c67bdb5faf861f0b45 Mon Sep 17 00:00:00 2001 From: Ryan McClelland Date: Wed, 25 Sep 2024 10:03:31 -0700 Subject: [PATCH 0038/4482] drivers: i3c: add ccc setbuscon Add helpers and defines for the i3c ccc setbuscon. Signed-off-by: Ryan McClelland --- drivers/i3c/i3c_ccc.c | 17 ++++++ include/zephyr/drivers/i3c/ccc.h | 101 +++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+) diff --git a/drivers/i3c/i3c_ccc.c b/drivers/i3c/i3c_ccc.c index 4c8b89e6d12c0..f2a5cbfbf8d61 100644 --- a/drivers/i3c/i3c_ccc.c +++ b/drivers/i3c/i3c_ccc.c @@ -893,3 +893,20 @@ int i3c_ccc_do_getmxds(const struct i3c_device_desc *target, out: return ret; } + +int i3c_ccc_do_setbuscon(const struct device *controller, + uint8_t *context, uint16_t length) +{ + struct i3c_ccc_payload ccc_payload; + + __ASSERT_NO_MSG(controller != NULL); + __ASSERT_NO_MSG(context != NULL); + + memset(&ccc_payload, 0, sizeof(ccc_payload)); + ccc_payload.ccc.id = I3C_CCC_SETBUSCON; + + ccc_payload.ccc.data = context; + ccc_payload.ccc.data_len = length; + + return i3c_do_ccc(controller, &ccc_payload); +} diff --git a/include/zephyr/drivers/i3c/ccc.h b/include/zephyr/drivers/i3c/ccc.h index 0662c55e4493c..8d662258158b9 100644 --- a/include/zephyr/drivers/i3c/ccc.h +++ b/include/zephyr/drivers/i3c/ccc.h @@ -1271,6 +1271,93 @@ enum i3c_ccc_rstact_defining_byte { I3C_CCC_RSTACT_RETURN_VIRTUAL_TARGET_INDICATION = 0x84U, }; +/** + * @name Set Bus Context MIPI I3C Specification v1.Y Minor Version (SETBUSCON) + * @anchor I3C_CCC_SETBUSCON_I3C_SPEC + * + * - CONTEXT[7:6]: 2'b00 + * + * - CONTEXT[5]: I3C Specification Editorial Revision (within Minor Version) + * - 0: Version 1.Y.0 + * - 1: Version 1.Y.1 or greater + * + * - CONTEXT[4]: I3C Specification Family + * - 0: MIPI I3C Specification + * - 1: MIPI I3C Basic Specification + * + * - CONTEXT[3:0]: I3C Specification Minor Version (v1.Y) + * - 0: Illegal, do not use (see Note below) + * (It would encode v1.0, but SETBUSCON was not available in I3C Basic v1.0) + * - 1-15: Version 1.1 - Version 1.15 + * + * Examples: Bit[5] Bit[4] Bits[3:0] + * I3C Basic v1.1.0: 1’b0 || 1’b1 || 4’b0001 or 8’b00010001 + * I3C Basic v1.1.1: 1’b1 || 1’b1 || 4’b0001 or 8’b00110001 + * I3C Basic v1.2.0: 1’b0 || 1’b1 || 4’b0010 or 8’b00010010 + * + * @{ + */ + +/** I3C Specification Minor Version shift mask */ +#define I3C_CCC_SETBUSCON_I3C_SPEC_MINOR_VER_MASK GENMASK(3U, 0U) + +/** + * @brief I3C Specification Minor Version (v1.Y) + * + * Set the context bits for SETBUSCON + * + * @param y I3C Specification Minor Version Number + */ +#define I3C_CCC_SETBUSCON_I3C_SPEC_MINOR_VER(y) \ + FIELD_PREP(I3C_CCC_SETBUSCON_I3C_SPEC_MINOR_VER_MASK, (y)) + +/** MIPI I3C Specification */ +#define I3C_CCC_SETBUSCON_I3C_SPEC_I3C_SPEC 0 + +/** MIPI I3C Basic Specification */ +#define I3C_CCC_SETBUSCON_I3C_SPEC_I3C_BASIC_SPEC BIT(4) + +/** Version 1.Y.0 */ +#define I3C_CCC_SETBUSCON_I3C_SPEC_I3C_SPEC_EDITORIAL_1_Y_0 0 + +/** Version 1.Y.1 or greater */ +#define I3C_CCC_SETBUSCON_I3C_SPEC_I3C_SPEC_EDITORIAL_1_Y_1 BIT(5) + +/** @} */ + +/** + * @name Set Bus Context Other Standards Organizations (SETBUSCON) + * @anchor I3C_CCC_SETBUSCON_OTHER_STANDARDS + * + * @{ + */ + +/** + * @brief JEDEC Sideband + * + * JEDEC SideBand Bus device, compliant to JESD403 Specification v1.0 or later. + */ +#define I3C_CCC_SETBUSCON_OTHER_STANDARDS_JEDEC_SIDEBAND 128 + +/** + * @brief MCTP + * + * MCTP for system manageability (conforming to the content protocol defined in + * the MCTP I3C Transport Binding Specification, released by DMTF, version 1.0 + * or newer) + */ +#define I3C_CCC_SETBUSCON_OTHER_STANDARDS_MCTP 129 + +/** + * @brief ETSI + * + * ETSI for Secure Smart Platform Devices used for mobile networks authentication + * and other ETSI security functions in mobile ecosystem + */ +#define I3C_CCC_SETBUSCON_OTHER_STANDARDS_ETSI 130 + +/** @} */ + /** * @brief Test if I3C CCC payload is for broadcast. * @@ -2018,6 +2105,20 @@ static inline int i3c_ccc_do_getmxds_fmt3(const struct i3c_device_desc *target, int i3c_ccc_do_deftgts_all(const struct device *controller, struct i3c_ccc_deftgts *deftgts); +/** + * @brief Broadcast SETBUSCON to set the bus context + * + * Helper function to set the bus context of all connected targets. + * + * @param[in] controller Pointer to the controller device driver instance. + * @param[in] context Pointer to context byte values + * @param[in] length Length of the context buffer + * + * @return @see i3c_do_ccc + */ +int i3c_ccc_do_setbuscon(const struct device *controller, + uint8_t *context, uint16_t length); + #ifdef __cplusplus } #endif From 22571f32bfb2032b9b37a18847eb9f3f10ff0865 Mon Sep 17 00:00:00 2001 From: Ryan McClelland Date: Wed, 25 Sep 2024 10:04:01 -0700 Subject: [PATCH 0039/4482] drivers: i3c: shell: add shell cmd for ccc setbuscon Add a i3c shell command for the i3c ccc setbuscon. Signed-off-by: Ryan McClelland --- drivers/i3c/i3c_shell.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/i3c/i3c_shell.c b/drivers/i3c/i3c_shell.c index 194942aa8e426..27d6e511336ca 100644 --- a/drivers/i3c/i3c_shell.c +++ b/drivers/i3c/i3c_shell.c @@ -1610,6 +1610,35 @@ static int cmd_i3c_ccc_setvendor_bc(const struct shell *sh, size_t argc, char ** return ret; } +/* i3c ccc setbuscon [] */ +static int cmd_i3c_ccc_setbuscon(const struct shell *sh, size_t argc, char **argv) +{ + const struct device *dev; + uint8_t buf[MAX_I3C_BYTES] = {0}; + uint8_t data_length; + int ret; + int i; + + dev = device_get_binding(argv[ARGV_DEV]); + if (!dev) { + shell_error(sh, "I3C: Device driver %s not found.", argv[ARGV_DEV]); + return -ENODEV; + } + + data_length = argc - 2; + for (i = 0; i < data_length; i++) { + buf[i] = (uint8_t)strtol(argv[2 + i], NULL, 16); + } + + ret = i3c_ccc_do_setbuscon(dev, buf, data_length); + if (ret < 0) { + shell_error(sh, "I3C: unable to send CCC SETBUSCON."); + return ret; + } + + return ret; +} + /* i3c ccc getmxds [] */ static int cmd_i3c_ccc_getmxds(const struct shell *sh, size_t argc, char **argv) { @@ -2252,6 +2281,10 @@ SHELL_STATIC_SUBCMD_SET_CREATE( "Send CCC GETMXDS\n" "Usage: ccc getmxds []", cmd_i3c_ccc_getmxds, 3, 1), + SHELL_CMD_ARG(setbuscon, &dsub_i3c_device_name, + "Send CCC SETBUSCON\n" + "Usage: ccc setbuscon []", + cmd_i3c_ccc_setbuscon, 3, MAX_I3C_BYTES - 1), SHELL_CMD_ARG(getvendor, &dsub_i3c_device_attached_name, "Send CCC GETVENDOR\n" "Usage: ccc getvendor []", From 996512d58940e413358cc11044dc616e7d6bbd23 Mon Sep 17 00:00:00 2001 From: Ryan McClelland Date: Wed, 25 Sep 2024 17:18:29 -0700 Subject: [PATCH 0040/4482] Revert "Revert "tests: drivers: i3c: add build of i3c_shell.c"" This reverts commit 50720f835b511f588c4c5538afcde354a5d2e7f2. Signed-off-by: Ryan McClelland --- tests/drivers/build_all/i3c/prj.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/drivers/build_all/i3c/prj.conf b/tests/drivers/build_all/i3c/prj.conf index 33c6e6a13fdd9..069aabfdbbf35 100644 --- a/tests/drivers/build_all/i3c/prj.conf +++ b/tests/drivers/build_all/i3c/prj.conf @@ -1,3 +1,5 @@ CONFIG_TEST=y CONFIG_TEST_USERSPACE=y CONFIG_I3C=y +CONFIG_SHELL=y +CONFIG_I3C_SHELL=y From 48eb944e4d2ea1dc50e31db2cf27432c168450a1 Mon Sep 17 00:00:00 2001 From: WenBin Zhang Date: Wed, 25 Sep 2024 16:51:43 +0800 Subject: [PATCH 0041/4482] input: gpio_keys: fix gpio_pin_get_dt error handling When gpio_pin_get_dt returns an error, the report event should not be generated Signed-off-by: WenBin Zhang --- drivers/input/input_gpio_keys.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/input/input_gpio_keys.c b/drivers/input/input_gpio_keys.c index fa782f2281c81..be35e12ef5608 100644 --- a/drivers/input/input_gpio_keys.c +++ b/drivers/input/input_gpio_keys.c @@ -61,9 +61,15 @@ static void gpio_keys_poll_pin(const struct device *dev, int key_index) const struct gpio_keys_pin_config *pin_cfg = &cfg->pin_cfg[key_index]; struct gpio_keys_pin_data *pin_data = &cfg->pin_data[key_index]; int new_pressed; + int ret; - new_pressed = gpio_pin_get_dt(&pin_cfg->spec); + ret = gpio_pin_get_dt(&pin_cfg->spec); + if (ret < 0) { + LOG_ERR("key_index %d get failed: %d", key_index, ret); + return; + } + new_pressed = ret; LOG_DBG("%s: pin_state=%d, new_pressed=%d, key_index=%d", dev->name, pin_data->cb_data.pin_state, new_pressed, key_index); From 4409573e72471a040531a67576f7f04af0b40488 Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Tue, 10 Sep 2024 17:17:40 -0300 Subject: [PATCH 0042/4482] tests: wifi: esp32: Functional tests for CI Functional wifi tests for ESP32 devices Signed-off-by: Raffael Rostagno --- tests/boards/espressif/wifi/CMakeLists.txt | 9 + tests/boards/espressif/wifi/Kconfig | 74 +++++ tests/boards/espressif/wifi/prj.conf | 15 + .../espressif/wifi/socs/esp32_procpu.overlay | 9 + .../espressif/wifi/socs/esp32c2.overlay | 9 + .../espressif/wifi/socs/esp32c3.overlay | 9 + .../espressif/wifi/socs/esp32c6.overlay | 9 + .../espressif/wifi/socs/esp32s2.overlay | 9 + .../wifi/socs/esp32s3_procpu.overlay | 9 + tests/boards/espressif/wifi/src/main.c | 310 ++++++++++++++++++ tests/boards/espressif/wifi/testcase.yaml | 36 ++ 11 files changed, 498 insertions(+) create mode 100644 tests/boards/espressif/wifi/CMakeLists.txt create mode 100644 tests/boards/espressif/wifi/Kconfig create mode 100644 tests/boards/espressif/wifi/prj.conf create mode 100644 tests/boards/espressif/wifi/socs/esp32_procpu.overlay create mode 100644 tests/boards/espressif/wifi/socs/esp32c2.overlay create mode 100644 tests/boards/espressif/wifi/socs/esp32c3.overlay create mode 100644 tests/boards/espressif/wifi/socs/esp32c6.overlay create mode 100644 tests/boards/espressif/wifi/socs/esp32s2.overlay create mode 100644 tests/boards/espressif/wifi/socs/esp32s3_procpu.overlay create mode 100644 tests/boards/espressif/wifi/src/main.c create mode 100644 tests/boards/espressif/wifi/testcase.yaml diff --git a/tests/boards/espressif/wifi/CMakeLists.txt b/tests/boards/espressif/wifi/CMakeLists.txt new file mode 100644 index 0000000000000..d2c5f02adaf73 --- /dev/null +++ b/tests/boards/espressif/wifi/CMakeLists.txt @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(wifi_test) + +target_include_directories(app PRIVATE ${ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/boards/espressif/wifi/Kconfig b/tests/boards/espressif/wifi/Kconfig new file mode 100644 index 0000000000000..bc0b105b28052 --- /dev/null +++ b/tests/boards/espressif/wifi/Kconfig @@ -0,0 +1,74 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +mainmenu "Wi-Fi Test" + +source "Kconfig.zephyr" + +config WIFI_TEST_ENABLE + bool "Enable Wi-Fi test" + default y + select WIFI + select WIFI_USE_NATIVE_NETWORKING + +config WIFI_TEST_SSID + string "Wi-Fi Test SSID" + default "TestSSID" + help + This option sets the SSID of the Wi-Fi network for testing. + It allows you to specify the Wi-Fi SSID that the device will + use during test scenarios. + +config WIFI_TEST_PSK + string "Wi-Fi Test PSK" + default "TestPSK" + help + This option sets the Pre-Shared Key (PSK) for the Wi-Fi network + during test scenarios. The device will use this password to authenticate + with the specified test SSID. + +config WIFI_TEST_AUTH_MODE_WPA2 + bool "WPA2 Security" + help + Option to use WPA2 Security for Wi-Fi connections. + +config WIFI_TEST_AUTH_MODE_WPA3 + bool "WPA3 Security" + select ESP_WIFI_ENABLE_WPA3_SAE + help + Option to use WPA3 Security for Wi-Fi connections. + +config WIFI_CONNECT_ATTEMPTS + int "Wi-Fi Connect Attempts" + default 5 + help + Number of attempts when connecting to a Wi-Fi network. + If connection is not successful after all attempts, test will fail. + +config WIFI_SCAN_TIMEOUT + int "Wi-Fi Scan Timeout (in seconds)" + default 30 + help + Timeout duration for Wi-Fi scanning. + If scan doesn't complete within this time, test will fail. + +config WIFI_CONNECT_TIMEOUT + int "Wi-Fi Connect Timeout (in seconds)" + default 60 + help + Timeout duration for connecting to Wi-Fi network. + If connection is not established within this time, test will fail. + +config WIFI_DISCONNECT_TIMEOUT + int "Wi-Fi Disconnect Timeout (in seconds)" + default 5 + help + Timeout duration for disconnecting from Wi-Fi network. + If disconnect doesn't complete within this time, test will fail. + +config WIFI_PING_TIMEOUT + int "Gateway Ping Timeout (in seconds)" + default 10 + help + Timeout duration for pinging the network gateway. + If no reply is received within this time, test will fail. diff --git a/tests/boards/espressif/wifi/prj.conf b/tests/boards/espressif/wifi/prj.conf new file mode 100644 index 0000000000000..cc2a9cc4e44da --- /dev/null +++ b/tests/boards/espressif/wifi/prj.conf @@ -0,0 +1,15 @@ +CONFIG_ZTEST=y + +CONFIG_NETWORKING=y +CONFIG_NET_TEST=y +CONFIG_NET_IPV6=n +CONFIG_NET_IPV4=y +CONFIG_NET_DHCPV4=y + +CONFIG_NET_LOG=y +CONFIG_NET_MGMT=y +CONFIG_NET_MAX_CONTEXTS=4 +CONFIG_NET_L2_ETHERNET=y +CONFIG_NET_L2_WIFI_MGMT=y +CONFIG_ETH_DRIVER=n +CONFIG_WIFI_NM=y diff --git a/tests/boards/espressif/wifi/socs/esp32_procpu.overlay b/tests/boards/espressif/wifi/socs/esp32_procpu.overlay new file mode 100644 index 0000000000000..872f2dfe2eaba --- /dev/null +++ b/tests/boards/espressif/wifi/socs/esp32_procpu.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wifi { + status = "okay"; +}; diff --git a/tests/boards/espressif/wifi/socs/esp32c2.overlay b/tests/boards/espressif/wifi/socs/esp32c2.overlay new file mode 100644 index 0000000000000..872f2dfe2eaba --- /dev/null +++ b/tests/boards/espressif/wifi/socs/esp32c2.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wifi { + status = "okay"; +}; diff --git a/tests/boards/espressif/wifi/socs/esp32c3.overlay b/tests/boards/espressif/wifi/socs/esp32c3.overlay new file mode 100644 index 0000000000000..872f2dfe2eaba --- /dev/null +++ b/tests/boards/espressif/wifi/socs/esp32c3.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wifi { + status = "okay"; +}; diff --git a/tests/boards/espressif/wifi/socs/esp32c6.overlay b/tests/boards/espressif/wifi/socs/esp32c6.overlay new file mode 100644 index 0000000000000..872f2dfe2eaba --- /dev/null +++ b/tests/boards/espressif/wifi/socs/esp32c6.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wifi { + status = "okay"; +}; diff --git a/tests/boards/espressif/wifi/socs/esp32s2.overlay b/tests/boards/espressif/wifi/socs/esp32s2.overlay new file mode 100644 index 0000000000000..872f2dfe2eaba --- /dev/null +++ b/tests/boards/espressif/wifi/socs/esp32s2.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wifi { + status = "okay"; +}; diff --git a/tests/boards/espressif/wifi/socs/esp32s3_procpu.overlay b/tests/boards/espressif/wifi/socs/esp32s3_procpu.overlay new file mode 100644 index 0000000000000..872f2dfe2eaba --- /dev/null +++ b/tests/boards/espressif/wifi/socs/esp32s3_procpu.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wifi { + status = "okay"; +}; diff --git a/tests/boards/espressif/wifi/src/main.c b/tests/boards/espressif/wifi/src/main.c new file mode 100644 index 0000000000000..0c7c4c7f92b8d --- /dev/null +++ b/tests/boards/espressif/wifi/src/main.c @@ -0,0 +1,310 @@ +/* + * Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#include +#include +#include +#include + +LOG_MODULE_REGISTER(wifi_test, CONFIG_NET_L2_ETHERNET_LOG_LEVEL); + +#include "net_private.h" + +K_SEM_DEFINE(wifi_event, 0, 1); + +#define WIFI_MGMT_EVENTS \ + (NET_EVENT_WIFI_SCAN_DONE | NET_EVENT_WIFI_SCAN_RESULT | NET_EVENT_WIFI_CONNECT_RESULT | \ + NET_EVENT_WIFI_DISCONNECT_RESULT) + +#define TEST_DATA "ICMP dummy data" + +static struct net_if *iface; +static uint32_t scan_result; +static bool connecting; +static int result; +static struct net_mgmt_event_callback wifi_mgmt_cb; + +extern char *net_sprint_ll_addr_buf(const uint8_t *ll, uint8_t ll_len, char *buf, int buflen); + +static void wifi_scan_result(struct net_mgmt_event_callback *cb) +{ + const struct wifi_scan_result *entry = (const struct wifi_scan_result *)cb->info; + uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; + uint8_t ssid_print[WIFI_SSID_MAX_LEN + 1]; + + scan_result++; + + if (scan_result == 1U) { + printk("\n%-4s | %-32s %-5s | %-13s | %-4s | %-15s | %-17s | %-8s\n", "Num", "SSID", + "(len)", "Chan (Band)", "RSSI", "Security", "BSSID", "MFP"); + } + + strncpy(ssid_print, entry->ssid, sizeof(ssid_print) - 1); + ssid_print[sizeof(ssid_print) - 1] = '\0'; + + printk("%-4d | %-32s %-5u | %-4u (%-6s) | %-4d | %-15s | %-17s | %-8s\n", scan_result, + ssid_print, entry->ssid_length, entry->channel, wifi_band_txt(entry->band), + entry->rssi, wifi_security_txt(entry->security), + ((entry->mac_length) ? net_sprint_ll_addr_buf(entry->mac, WIFI_MAC_ADDR_LEN, + mac_string_buf, sizeof(mac_string_buf)) + : ""), + wifi_mfp_txt(entry->mfp)); +} + +static void wifi_connect_result(struct net_mgmt_event_callback *cb) +{ + const struct wifi_status *status = (const struct wifi_status *)cb->info; + + result = status->status; + + if (result) { + LOG_INF("Connection request failed (%d)", result); + } else { + LOG_INF("Connected"); + } +} + +static void wifi_disconnect_result(struct net_mgmt_event_callback *cb) +{ + const struct wifi_status *status = (const struct wifi_status *)cb->info; + + result = status->status; + + if (!connecting) { + if (result) { + LOG_INF("Disconnect failed (%d)", result); + } else { + LOG_INF("Disconnected"); + } + } else { + /* Disconnect event while connecting is a failed attempt */ + result = WIFI_STATUS_CONN_FAIL; + } +} + +static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, + struct net_if *iface) +{ + switch (mgmt_event) { + case NET_EVENT_WIFI_SCAN_RESULT: + wifi_scan_result(cb); + break; + case NET_EVENT_WIFI_SCAN_DONE: + k_sem_give(&wifi_event); + break; + case NET_EVENT_WIFI_CONNECT_RESULT: + wifi_connect_result(cb); + k_sem_give(&wifi_event); + break; + case NET_EVENT_WIFI_DISCONNECT_RESULT: + wifi_disconnect_result(cb); + k_sem_give(&wifi_event); + break; + default: + break; + } +} + +static int icmp_event(struct net_icmp_ctx *ctx, struct net_pkt *pkt, struct net_icmp_ip_hdr *hdr, + struct net_icmp_hdr *icmp_hdr, void *user_data) +{ + struct net_ipv4_hdr *ip_hdr = hdr->ipv4; + + LOG_INF("Received ICMP reply from %s", net_sprint_ipv4_addr(&ip_hdr->src)); + + k_sem_give(&wifi_event); + + return 0; +} + +static int wifi_scan(void) +{ + int ret = net_mgmt(NET_REQUEST_WIFI_SCAN, iface, NULL, 0); + + if (ret) { + LOG_INF("Scan request failed with error: %d", ret); + return ret; + } + + LOG_INF("Wifi scan requested..."); + + return 0; +} + +static int wifi_connect(void) +{ + struct wifi_connect_req_params params = {0}; + int ret; + + /* Defaults */ + params.band = WIFI_FREQ_BAND_UNKNOWN; + params.channel = WIFI_CHANNEL_ANY; + params.mfp = WIFI_MFP_OPTIONAL; + + /* Input parameters */ + params.ssid = CONFIG_WIFI_TEST_SSID; + params.ssid_length = strlen(params.ssid); +#if defined(CONFIG_WIFI_TEST_AUTH_MODE_WPA2) + params.security = WIFI_SECURITY_TYPE_PSK; + params.psk = CONFIG_WIFI_TEST_PSK; + params.psk_length = strlen(CONFIG_WIFI_TEST_PSK); +#elif defined(CONFIG_WIFI_TEST_AUTH_MODE_WPA3) + params.security = WIFI_SECURITY_TYPE_SAE; + params.sae_password = CONFIG_WIFI_TEST_PSK; + params.sae_password_length = strlen(CONFIG_WIFI_TEST_PSK); +#else + params.security = WIFI_SECURITY_TYPE_NONE; +#endif + + ret = net_mgmt(NET_REQUEST_WIFI_CONNECT, iface, ¶ms, + sizeof(struct wifi_connect_req_params)); + + if (ret) { + LOG_INF("Connection request failed with error: %d", ret); + return ret; + } + + LOG_INF("Connection requested..."); + + return 0; +} + +static int wifi_disconnect(void) +{ + int ret; + + ret = net_mgmt(NET_REQUEST_WIFI_DISCONNECT, iface, NULL, 0); + + if (ret) { + LOG_INF("Disconnect request failed with error: %d", ret); + return ret; + } + + return 0; +} + +static int wifi_state(void) +{ + struct wifi_iface_status status = {0}; + + net_mgmt(NET_REQUEST_WIFI_IFACE_STATUS, iface, &status, sizeof(struct wifi_iface_status)); + + return status.state; +} + +ZTEST(wifi, test_wifi_0_scan) +{ + int ret; + + ret = wifi_scan(); + zassert_equal(ret, 0, "Scan request failed"); + + zassert_equal(k_sem_take(&wifi_event, K_SECONDS(CONFIG_WIFI_SCAN_TIMEOUT)), 0, + "Wifi scan failed or timed out"); + + LOG_INF("Scan done"); +} + +ZTEST(wifi, test_wifi_1_connect) +{ + int ret; + int retry = CONFIG_WIFI_CONNECT_ATTEMPTS; + + /* Manage connect retry as disconnect event may happen */ + connecting = true; + + do { + ret = wifi_connect(); + zassert_equal(ret, 0, "Connect request failed"); + + zassert_equal(k_sem_take(&wifi_event, K_SECONDS(CONFIG_WIFI_CONNECT_TIMEOUT)), 0, + "Wifi connect timed out"); + + if (result) { + zassert(--retry, "Connect failed"); + LOG_INF("Failed attempt, retry %d", CONFIG_WIFI_CONNECT_ATTEMPTS - retry); + k_sleep(K_SECONDS(1)); + } else { + break; + } + } while (retry); + + connecting = false; + + /* Check interface state */ + int state = wifi_state(); + + LOG_INF("Interface state: %s", wifi_state_txt(state)); + + zassert_equal(state, WIFI_STATE_COMPLETED, "Interface state check failed"); +} + +ZTEST(wifi, test_wifi_2_icmp) +{ + struct net_icmp_ping_params params; + struct net_icmp_ctx ctx; + struct in_addr gw_addr_4; + struct sockaddr_in dst4 = {0}; + int ret; + + gw_addr_4 = net_if_ipv4_get_gw(iface); + zassert_not_equal(gw_addr_4.s_addr, 0, "Gateway address is not set"); + + ret = net_icmp_init_ctx(&ctx, NET_ICMPV4_ECHO_REPLY, 0, icmp_event); + zassert_equal(ret, 0, "Cannot init ICMP (%d)", ret); + + dst4.sin_family = AF_INET; + memcpy(&dst4.sin_addr, &gw_addr_4, sizeof(gw_addr_4)); + + params.identifier = 1234; + params.sequence = 5678; + params.tc_tos = 1; + params.priority = 2; + params.data = TEST_DATA; + params.data_size = sizeof(TEST_DATA); + + LOG_INF("Pinging the gateway..."); + + ret = net_icmp_send_echo_request(&ctx, iface, (struct sockaddr *)&dst4, ¶ms, NULL); + zassert_equal(ret, 0, "Cannot send ICMP echo request (%d)", ret); + + zassert_equal(k_sem_take(&wifi_event, K_SECONDS(CONFIG_WIFI_PING_TIMEOUT)), 0, + "Gateway ping (ICMP) timed out"); + + net_icmp_cleanup_ctx(&ctx); +} + +ZTEST(wifi, test_wifi_3_disconnect) +{ + int ret; + + ret = wifi_disconnect(); + zassert_equal(ret, 0, "Disconect request failed"); + + zassert_equal(k_sem_take(&wifi_event, K_SECONDS(CONFIG_WIFI_DISCONNECT_TIMEOUT)), 0, + "Wifi disconnect timed out"); + + zassert_equal(result, 0, "Disconnect failed"); +} + +static void *wifi_setup(void) +{ + iface = net_if_get_wifi_sta(); + + net_mgmt_init_event_callback(&wifi_mgmt_cb, wifi_mgmt_event_handler, WIFI_MGMT_EVENTS); + net_mgmt_add_event_callback(&wifi_mgmt_cb); + + /* reset semaphore that tracks wifi events */ + k_sem_reset(&wifi_event); + + return NULL; +} + +ZTEST_SUITE(wifi, NULL, wifi_setup, NULL, NULL, NULL); diff --git a/tests/boards/espressif/wifi/testcase.yaml b/tests/boards/espressif/wifi/testcase.yaml new file mode 100644 index 0000000000000..0b3a4751fc551 --- /dev/null +++ b/tests/boards/espressif/wifi/testcase.yaml @@ -0,0 +1,36 @@ +tests: + esp.wifi.sec.none: + tags: wifi + filter: CONFIG_WIFI_ESP32 + extra_configs: + - CONFIG_ESP32_WIFI_STA_AUTO_DHCPV4=y + platform_allow: + - esp32_devkitc_wrover/esp32/procpu + - esp32s2_saola + - esp32s3_devkitm/esp32s3/procpu + - esp32c3_devkitm + - esp8684_devkitm + esp.wifi.sec.wpa2: + tags: wifi + filter: CONFIG_WIFI_ESP32 + extra_configs: + - CONFIG_WIFI_TEST_AUTH_MODE_WPA2=y + - CONFIG_ESP32_WIFI_STA_AUTO_DHCPV4=y + platform_allow: + - esp32_devkitc_wrover/esp32/procpu + - esp32s2_saola + - esp32s3_devkitm/esp32s3/procpu + - esp32c3_devkitm + - esp8684_devkitm + esp.wifi.sec.wpa3: + tags: wifi + filter: CONFIG_WIFI_ESP32 + extra_configs: + - CONFIG_WIFI_TEST_AUTH_MODE_WPA3=y + - CONFIG_ESP32_WIFI_STA_AUTO_DHCPV4=y + platform_allow: + - esp32_devkitc_wrover/esp32/procpu + - esp32s2_saola + - esp32s3_devkitm/esp32s3/procpu + - esp32c3_devkitm + - esp8684_devkitm From 565005c27adfb162c1651d694016f90b3e626607 Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Mon, 23 Sep 2024 22:54:34 -0300 Subject: [PATCH 0043/4482] drivers: wifi: esp32: Check blobs dependency Checks blobs presence as dependency to allow driver build. Goal is to avoid building in environment where blobs won't be present (e.g GitHub CI environment). Signed-off-by: Raffael Rostagno --- drivers/wifi/CMakeLists.txt | 3 +++ drivers/wifi/esp32/Kconfig.esp32 | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/wifi/CMakeLists.txt b/drivers/wifi/CMakeLists.txt index bd175b8e28f98..42af72edce84f 100644 --- a/drivers/wifi/CMakeLists.txt +++ b/drivers/wifi/CMakeLists.txt @@ -5,6 +5,9 @@ zephyr_library_property(ALLOW_EMPTY TRUE) add_subdirectory_ifdef(CONFIG_WIFI_ESP_AT esp_at) add_subdirectory_ifdef(CONFIG_WIFI_ESP32 esp32) +if(CONFIG_DT_HAS_ESPRESSIF_ESP32_WIFI_ENABLED) + zephyr_blobs_verify(MODULE hal_espressif REQUIRED) +endif() add_subdirectory_ifdef(CONFIG_WIFI_ESWIFI eswifi) add_subdirectory_ifdef(CONFIG_WIFI_SIMPLELINK simplelink) add_subdirectory_ifdef(CONFIG_WIFI_WINC1500 winc1500) diff --git a/drivers/wifi/esp32/Kconfig.esp32 b/drivers/wifi/esp32/Kconfig.esp32 index 53e8e25c98afe..14bb744c3cc43 100644 --- a/drivers/wifi/esp32/Kconfig.esp32 +++ b/drivers/wifi/esp32/Kconfig.esp32 @@ -4,6 +4,7 @@ menuconfig WIFI_ESP32 bool "ESP32 SoC WiFi support" default y depends on DT_HAS_ESPRESSIF_ESP32_WIFI_ENABLED + depends on ZEPHYR_HAL_ESPRESSIF_MODULE_BLOBS depends on !SMP select THREAD_CUSTOM_DATA select NET_L2_WIFI_MGMT From 9313fb60dac0c90b3c12f602ee36acce800cb84a Mon Sep 17 00:00:00 2001 From: Ayush Singh Date: Sat, 21 Sep 2024 13:53:29 +0530 Subject: [PATCH 0044/4482] boards: beagle: beagleconnect_freedom: Add PWM - Add PWM support to base devicetree Signed-off-by: Ayush Singh --- .../beagleconnect_freedom-pinctrl.dtsi | 14 +++++++++++++ .../beagleconnect_freedom.dts | 20 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/boards/beagle/beagleconnect_freedom/beagleconnect_freedom-pinctrl.dtsi b/boards/beagle/beagleconnect_freedom/beagleconnect_freedom-pinctrl.dtsi index cf662d67a2e89..c630d9b865feb 100644 --- a/boards/beagle/beagleconnect_freedom/beagleconnect_freedom-pinctrl.dtsi +++ b/boards/beagle/beagleconnect_freedom/beagleconnect_freedom-pinctrl.dtsi @@ -95,4 +95,18 @@ pinmux = <30 IOC_PORT_RFC_GPO0>; bias-disable; }; + + /* MB1 PWM */ + pwm0_default: pwm0_default { + pinmux = <17 IOC_PORT_MCU_PORT_EVENT1>; + bias-disable; + drive-strength = <2>; + }; + + /* MB2 PWM */ + pwm1_default: pwm1_default { + pinmux = <19 IOC_PORT_MCU_PORT_EVENT3>; + bias-disable; + drive-strength = <2>; + }; }; diff --git a/boards/beagle/beagleconnect_freedom/beagleconnect_freedom.dts b/boards/beagle/beagleconnect_freedom/beagleconnect_freedom.dts index f94737a9e37a8..f73a9dbc7fd53 100644 --- a/boards/beagle/beagleconnect_freedom/beagleconnect_freedom.dts +++ b/boards/beagle/beagleconnect_freedom/beagleconnect_freedom.dts @@ -208,3 +208,23 @@ &ieee802154g { status = "okay"; }; + +&gpt0 { + status = "okay"; +}; + +&gpt1 { + status = "okay"; +}; + +&pwm0 { + status = "okay"; + pinctrl-0 = <&pwm0_default>; + pinctrl-names = "default"; +}; + +&pwm1 { + status = "okay"; + pinctrl-0 = <&pwm1_default>; + pinctrl-names = "default"; +}; From fc034ea54b40a3c72243d4f3eb518444f468fe53 Mon Sep 17 00:00:00 2001 From: Ayush Singh Date: Sat, 21 Sep 2024 13:54:09 +0530 Subject: [PATCH 0045/4482] samples: blinky_pwm: Remove enabling pwm in overlay - Since PWM config has been moved to base devicetree, it can be safely removed from the sample. Signed-off-by: Ayush Singh --- .../boards/beagleconnect_freedom.overlay | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/samples/basic/blinky_pwm/boards/beagleconnect_freedom.overlay b/samples/basic/blinky_pwm/boards/beagleconnect_freedom.overlay index a2aeeeefee29f..28b0bc0a20d73 100644 --- a/samples/basic/blinky_pwm/boards/beagleconnect_freedom.overlay +++ b/samples/basic/blinky_pwm/boards/beagleconnect_freedom.overlay @@ -17,21 +17,3 @@ }; }; }; - -&pinctrl { - pwm0_default: pwm0_default { - pinmux = <17 IOC_PORT_MCU_PORT_EVENT1>; - bias-disable; - drive-strength = <8>; - }; -}; - -&gpt0 { - status = "okay"; -}; - -&pwm0 { - status = "okay"; - pinctrl-0 = <&pwm0_default>; - pinctrl-names = "default"; -}; From 3bcd0a658e34e1fa478353fa83492728cb9b2712 Mon Sep 17 00:00:00 2001 From: Ayush Singh Date: Mon, 30 Sep 2024 14:52:24 +0530 Subject: [PATCH 0046/4482] boards: beagle: beagleconnect_freedom: Add ADC - Enable ADC node to the base board. Signed-off-by: Ayush Singh --- .../beagleconnect_freedom.dts | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/boards/beagle/beagleconnect_freedom/beagleconnect_freedom.dts b/boards/beagle/beagleconnect_freedom/beagleconnect_freedom.dts index f73a9dbc7fd53..2aa299f9d70f8 100644 --- a/boards/beagle/beagleconnect_freedom/beagleconnect_freedom.dts +++ b/boards/beagle/beagleconnect_freedom/beagleconnect_freedom.dts @@ -228,3 +228,64 @@ pinctrl-0 = <&pwm1_default>; pinctrl-names = "default"; }; + +&adc0 { + status = "okay"; + + #address-cells = <1>; + #size-cells = <0>; + + /* MB1 AN */ + channel@9 { + reg = <9>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; + + /* MB2 AN */ + channel@a { + reg = <10>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; + + /* MB1/2 SCL */ + channel@b { + reg = <11>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; + + /* MB1/2 SDA */ + channel@c { + reg = <12>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; + + /* MB2 CS */ + channel@d { + reg = <13>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; + + /* MB1 CS */ + channel@e { + reg = <14>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; +}; From c96de5210730d6921c9d613bd73b3571092cc1cf Mon Sep 17 00:00:00 2001 From: Ayush Singh Date: Sat, 21 Sep 2024 15:00:37 +0530 Subject: [PATCH 0047/4482] samples: drivers: adc: Remove ADC node from overlay - Since ADC node is now enabled in the base dt, this is no longer required Signed-off-by: Ayush Singh --- .../boards/beagleconnect_freedom.overlay | 61 ------------------- 1 file changed, 61 deletions(-) diff --git a/samples/drivers/adc/adc_dt/boards/beagleconnect_freedom.overlay b/samples/drivers/adc/adc_dt/boards/beagleconnect_freedom.overlay index 51c69091d8623..5d9de1d4bb502 100644 --- a/samples/drivers/adc/adc_dt/boards/beagleconnect_freedom.overlay +++ b/samples/drivers/adc/adc_dt/boards/beagleconnect_freedom.overlay @@ -16,64 +16,3 @@ */ }; }; - -&adc0 { - status = "okay"; - - #address-cells = <1>; - #size-cells = <0>; - - /* MB1 AN */ - channel@9 { - reg = <9>; - zephyr,gain = "ADC_GAIN_1"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,resolution = <12>; - }; - - /* MB2 AN */ - channel@a { - reg = <10>; - zephyr,gain = "ADC_GAIN_1"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,resolution = <12>; - }; - - /* MB1/2 SCL */ - channel@b { - reg = <11>; - zephyr,gain = "ADC_GAIN_1"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,resolution = <12>; - }; - - /* MB1/2 SDA */ - channel@c { - reg = <12>; - zephyr,gain = "ADC_GAIN_1"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,resolution = <12>; - }; - - /* MB2 CS */ - channel@d { - reg = <13>; - zephyr,gain = "ADC_GAIN_1"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,resolution = <12>; - }; - - /* MB1 CS */ - channel@e { - reg = <14>; - zephyr,gain = "ADC_GAIN_1"; - zephyr,reference = "ADC_REF_INTERNAL"; - zephyr,acquisition-time = ; - zephyr,resolution = <12>; - }; -}; From 1b81489ec5f49056e3441c8f1142cf0382792509 Mon Sep 17 00:00:00 2001 From: Ayush Singh Date: Mon, 30 Sep 2024 14:54:15 +0530 Subject: [PATCH 0048/4482] tests: drivers: adc: adc_api: Add beagleconnect_freedom overlay - Enabling adc testing for beagleconnect_freedom Signed-off-by: Ayush Singh --- .../adc/adc_api/boards/beagleconnect_freedom.overlay | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/drivers/adc/adc_api/boards/beagleconnect_freedom.overlay diff --git a/tests/drivers/adc/adc_api/boards/beagleconnect_freedom.overlay b/tests/drivers/adc/adc_api/boards/beagleconnect_freedom.overlay new file mode 100644 index 0000000000000..7bbb9172f08d1 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/beagleconnect_freedom.overlay @@ -0,0 +1,12 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) Ayush Singh + */ + +/ { + zephyr,user { + io-channels = <&adc0 0x09>, <&adc0 0x0a>, <&adc0 0x0b>, <&adc0 0x0c>, + <&adc0 0x0d>, <&adc0 0x0e>; + }; +}; From 2c19cf65b4d4a383c1bb427b2b522d95380e5705 Mon Sep 17 00:00:00 2001 From: Ayush Singh Date: Mon, 30 Sep 2024 14:57:36 +0530 Subject: [PATCH 0049/4482] boards: beagle: beagleconnect_freedom: Disable 2.4g ieee802154 - A lot of zephyr networking samples (zperf, http_server, etc) will complain if both 2.4g and subg ieee802154 are enabled simultaneously. - This leads to a lot of new people getting confused with the network code not working without any clear errors. - As we already set the alias `zephyr,ieee802154 = &ieee802154g`, I think it would be best to enable only subg by default. Signed-off-by: Ayush Singh --- boards/beagle/beagleconnect_freedom/beagleconnect_freedom.dts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/boards/beagle/beagleconnect_freedom/beagleconnect_freedom.dts b/boards/beagle/beagleconnect_freedom/beagleconnect_freedom.dts index 2aa299f9d70f8..3191eccb62522 100644 --- a/boards/beagle/beagleconnect_freedom/beagleconnect_freedom.dts +++ b/boards/beagle/beagleconnect_freedom/beagleconnect_freedom.dts @@ -201,10 +201,6 @@ }; }; -&ieee802154 { - status = "okay"; -}; - &ieee802154g { status = "okay"; }; From b68a82358674c84cced5d30fe0a10649ede087c6 Mon Sep 17 00:00:00 2001 From: Ayush Singh Date: Mon, 30 Sep 2024 15:00:15 +0530 Subject: [PATCH 0050/4482] boards: beagle: beagleconnect_freedom: Enable adc, pwm tests - Enable testing for ADC and PWM. Signed-off-by: Ayush Singh --- boards/beagle/beagleconnect_freedom/beagleconnect_freedom.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boards/beagle/beagleconnect_freedom/beagleconnect_freedom.yaml b/boards/beagle/beagleconnect_freedom/beagleconnect_freedom.yaml index 46cfaf5de3ffa..cbe7f154814ee 100644 --- a/boards/beagle/beagleconnect_freedom/beagleconnect_freedom.yaml +++ b/boards/beagle/beagleconnect_freedom/beagleconnect_freedom.yaml @@ -14,4 +14,6 @@ supported: - spi - uart - hwinfo + - adc + - pwm vendor: beagle From 57f0894b8f0f57080ee03134547c281ce92389ca Mon Sep 17 00:00:00 2001 From: Ayush Singh Date: Mon, 30 Sep 2024 14:59:46 +0530 Subject: [PATCH 0051/4482] boards: beagle: beagleconnect_freedom: doc: Update capabilities - Add PWM, ADC, FLASH and Radio to docs Signed-off-by: Ayush Singh --- boards/beagle/beagleconnect_freedom/doc/index.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/boards/beagle/beagleconnect_freedom/doc/index.rst b/boards/beagle/beagleconnect_freedom/doc/index.rst index 43a237d031775..f9b980c1f3041 100644 --- a/boards/beagle/beagleconnect_freedom/doc/index.rst +++ b/boards/beagle/beagleconnect_freedom/doc/index.rst @@ -62,6 +62,14 @@ The board configuration supports the following hardware features: +-----------+------------+----------------------+ | I2C | off-chip | BCF_BRIDGE_MCU | +-----------+------------+----------------------+ +| ADC | on-chip | adc | ++-----------+------------+----------------------+ +| PWM | on-chip | pwm | ++-----------+------------+----------------------+ +| FLASH | on-chip | flash | ++-----------+------------+----------------------+ +| RADIO | on-chip | ieee802154 | ++-----------+------------+----------------------+ Connections and IOs =================== From a6ed05e76532210b6e53124a897243f15e4f9e9e Mon Sep 17 00:00:00 2001 From: Emilio Benavente Date: Wed, 4 Sep 2024 15:24:32 +0000 Subject: [PATCH 0052/4482] tests: drivers: uart_async_api: fix userspace fault Updated overlay files to test using nocache. and run outside of usersapce mode to avoid inaccessible memory regions when using nocache on RT parts. Also updated testcase file to reflect nocache testing. Signed-off-by: Emilio Benavente --- .../uart/uart_async_api/boards/mimxrt1010_evk.overlay | 6 ------ .../uart/uart_async_api/boards/mimxrt1015_evk.overlay | 6 ------ .../uart/uart_async_api/boards/mimxrt1020_evk.overlay | 6 ------ .../uart/uart_async_api/boards/mimxrt1024_evk.overlay | 6 ------ .../uart/uart_async_api/boards/mimxrt1050_evk.overlay | 6 ------ .../uart/uart_async_api/boards/mimxrt1060_evk.overlay | 6 ------ .../uart/uart_async_api/boards/mimxrt1060_evkb.overlay | 6 ------ .../uart/uart_async_api/boards/mimxrt1064_evk.overlay | 6 ------ .../boards/mimxrt1160_evk_mimxrt1166_cm7.overlay | 6 ------ .../boards/mimxrt1170_evk_mimxrt1176_cm7_A.overlay | 6 ------ tests/drivers/uart/uart_async_api/testcase.yaml | 10 +++++++++- 11 files changed, 9 insertions(+), 61 deletions(-) diff --git a/tests/drivers/uart/uart_async_api/boards/mimxrt1010_evk.overlay b/tests/drivers/uart/uart_async_api/boards/mimxrt1010_evk.overlay index 02c9390abbc29..4dc4c119d905f 100644 --- a/tests/drivers/uart/uart_async_api/boards/mimxrt1010_evk.overlay +++ b/tests/drivers/uart/uart_async_api/boards/mimxrt1010_evk.overlay @@ -1,11 +1,5 @@ /* SPDX-License-Identifier: Apache-2.0 */ -/ { - chosen { - zephyr,sram = &dtcm; - }; -}; - dut: &lpuart4 { status = "okay"; current-speed = <115200>; diff --git a/tests/drivers/uart/uart_async_api/boards/mimxrt1015_evk.overlay b/tests/drivers/uart/uart_async_api/boards/mimxrt1015_evk.overlay index da52ae8d9d12c..f82d4c29082ff 100644 --- a/tests/drivers/uart/uart_async_api/boards/mimxrt1015_evk.overlay +++ b/tests/drivers/uart/uart_async_api/boards/mimxrt1015_evk.overlay @@ -1,11 +1,5 @@ /* SPDX-License-Identifier: Apache-2.0 */ -/ { - chosen { - zephyr,sram = &dtcm; - }; -}; - dut: &lpuart4 { status = "okay"; current-speed = <115200>; diff --git a/tests/drivers/uart/uart_async_api/boards/mimxrt1020_evk.overlay b/tests/drivers/uart/uart_async_api/boards/mimxrt1020_evk.overlay index cceca9150179e..4f031193d1522 100644 --- a/tests/drivers/uart/uart_async_api/boards/mimxrt1020_evk.overlay +++ b/tests/drivers/uart/uart_async_api/boards/mimxrt1020_evk.overlay @@ -1,11 +1,5 @@ /* SPDX-License-Identifier: Apache-2.0 */ -/ { - chosen { - zephyr,sram = &dtcm; - }; -}; - dut: &lpuart2 { status = "okay"; current-speed = <115200>; diff --git a/tests/drivers/uart/uart_async_api/boards/mimxrt1024_evk.overlay b/tests/drivers/uart/uart_async_api/boards/mimxrt1024_evk.overlay index b8b4e96bc15d8..3349704181a00 100644 --- a/tests/drivers/uart/uart_async_api/boards/mimxrt1024_evk.overlay +++ b/tests/drivers/uart/uart_async_api/boards/mimxrt1024_evk.overlay @@ -1,11 +1,5 @@ /* SPDX-License-Identifier: Apache-2.0 */ -/ { - chosen { - zephyr,sram = &dtcm; - }; -}; - dut: &lpuart2 { status = "okay"; current-speed = <115200>; diff --git a/tests/drivers/uart/uart_async_api/boards/mimxrt1050_evk.overlay b/tests/drivers/uart/uart_async_api/boards/mimxrt1050_evk.overlay index 1a0c35e198aa7..22ecfdfa712ae 100644 --- a/tests/drivers/uart/uart_async_api/boards/mimxrt1050_evk.overlay +++ b/tests/drivers/uart/uart_async_api/boards/mimxrt1050_evk.overlay @@ -1,11 +1,5 @@ /* SPDX-License-Identifier: Apache-2.0 */ -/ { - chosen { - zephyr,sram = &dtcm; - }; -}; - dut: &lpuart3 { status = "okay"; current-speed = <115200>; diff --git a/tests/drivers/uart/uart_async_api/boards/mimxrt1060_evk.overlay b/tests/drivers/uart/uart_async_api/boards/mimxrt1060_evk.overlay index 1a0c35e198aa7..22ecfdfa712ae 100644 --- a/tests/drivers/uart/uart_async_api/boards/mimxrt1060_evk.overlay +++ b/tests/drivers/uart/uart_async_api/boards/mimxrt1060_evk.overlay @@ -1,11 +1,5 @@ /* SPDX-License-Identifier: Apache-2.0 */ -/ { - chosen { - zephyr,sram = &dtcm; - }; -}; - dut: &lpuart3 { status = "okay"; current-speed = <115200>; diff --git a/tests/drivers/uart/uart_async_api/boards/mimxrt1060_evkb.overlay b/tests/drivers/uart/uart_async_api/boards/mimxrt1060_evkb.overlay index 1a0c35e198aa7..22ecfdfa712ae 100644 --- a/tests/drivers/uart/uart_async_api/boards/mimxrt1060_evkb.overlay +++ b/tests/drivers/uart/uart_async_api/boards/mimxrt1060_evkb.overlay @@ -1,11 +1,5 @@ /* SPDX-License-Identifier: Apache-2.0 */ -/ { - chosen { - zephyr,sram = &dtcm; - }; -}; - dut: &lpuart3 { status = "okay"; current-speed = <115200>; diff --git a/tests/drivers/uart/uart_async_api/boards/mimxrt1064_evk.overlay b/tests/drivers/uart/uart_async_api/boards/mimxrt1064_evk.overlay index 1a0c35e198aa7..22ecfdfa712ae 100644 --- a/tests/drivers/uart/uart_async_api/boards/mimxrt1064_evk.overlay +++ b/tests/drivers/uart/uart_async_api/boards/mimxrt1064_evk.overlay @@ -1,11 +1,5 @@ /* SPDX-License-Identifier: Apache-2.0 */ -/ { - chosen { - zephyr,sram = &dtcm; - }; -}; - dut: &lpuart3 { status = "okay"; current-speed = <115200>; diff --git a/tests/drivers/uart/uart_async_api/boards/mimxrt1160_evk_mimxrt1166_cm7.overlay b/tests/drivers/uart/uart_async_api/boards/mimxrt1160_evk_mimxrt1166_cm7.overlay index cceca9150179e..4f031193d1522 100644 --- a/tests/drivers/uart/uart_async_api/boards/mimxrt1160_evk_mimxrt1166_cm7.overlay +++ b/tests/drivers/uart/uart_async_api/boards/mimxrt1160_evk_mimxrt1166_cm7.overlay @@ -1,11 +1,5 @@ /* SPDX-License-Identifier: Apache-2.0 */ -/ { - chosen { - zephyr,sram = &dtcm; - }; -}; - dut: &lpuart2 { status = "okay"; current-speed = <115200>; diff --git a/tests/drivers/uart/uart_async_api/boards/mimxrt1170_evk_mimxrt1176_cm7_A.overlay b/tests/drivers/uart/uart_async_api/boards/mimxrt1170_evk_mimxrt1176_cm7_A.overlay index cceca9150179e..4f031193d1522 100644 --- a/tests/drivers/uart/uart_async_api/boards/mimxrt1170_evk_mimxrt1176_cm7_A.overlay +++ b/tests/drivers/uart/uart_async_api/boards/mimxrt1170_evk_mimxrt1176_cm7_A.overlay @@ -1,11 +1,5 @@ /* SPDX-License-Identifier: Apache-2.0 */ -/ { - chosen { - zephyr,sram = &dtcm; - }; -}; - dut: &lpuart2 { status = "okay"; current-speed = <115200>; diff --git a/tests/drivers/uart/uart_async_api/testcase.yaml b/tests/drivers/uart/uart_async_api/testcase.yaml index e7a970d4a58ab..91ef347af3425 100644 --- a/tests/drivers/uart/uart_async_api/testcase.yaml +++ b/tests/drivers/uart/uart_async_api/testcase.yaml @@ -58,9 +58,17 @@ tests: integration_platforms: - qemu_cortex_m0 drivers.uart.async_api.lpuart: - filter: CONFIG_SERIAL_SUPPORT_ASYNC and CONFIG_UART_MCUX_LPUART + filter: CONFIG_SERIAL_SUPPORT_ASYNC and CONFIG_UART_MCUX_LPUART and not CONFIG_CPU_HAS_DCACHE harness: ztest depends_on: dma + drivers.uart.async_api.lpuart.rt_nocache: + filter: CONFIG_SERIAL_SUPPORT_ASYNC and CONFIG_UART_MCUX_LPUART and CONFIG_CPU_HAS_DCACHE + harness: ztest + depends_on: dma + extra_configs: + - CONFIG_DCACHE=y + - CONFIG_NOCACHE_MEMORY=y + - CONFIG_USERSPACE=n drivers.uart.async_api.sam0: filter: CONFIG_SERIAL_SUPPORT_ASYNC and CONFIG_SOC_FAMILY_ATMEL_SAM0 platform_allow: From 18b20058a0faaecf176f9ce9aeb6e40de716bf23 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 27 Sep 2024 08:19:00 +0100 Subject: [PATCH 0053/4482] dfu: Add missing depends on for progressive erase Adds a depends on that requires the underlying driver support explicit erase Signed-off-by: Jamie McCrae --- subsys/dfu/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/dfu/Kconfig b/subsys/dfu/Kconfig index ec7d90ba14a2f..5977764016d36 100644 --- a/subsys/dfu/Kconfig +++ b/subsys/dfu/Kconfig @@ -69,6 +69,7 @@ config IMG_BLOCK_BUF_SIZE config IMG_ERASE_PROGRESSIVELY bool "Erase flash progressively when receiving new firmware" select STREAM_FLASH_ERASE + depends on FLASH_HAS_EXPLICIT_ERASE help If enabled, flash is erased as necessary when receiving new firmware, instead of erasing the whole image slot at once. This is necessary From 6733efdc84df6908cac42f9b95fb3cb4bfe95f29 Mon Sep 17 00:00:00 2001 From: Florian Grandel Date: Wed, 25 Sep 2024 11:28:40 +0200 Subject: [PATCH 0054/4482] arch: x86: ia32: linker.ld: add missing DT sections macro Generating sections via DT memory attributes did not work for the platform as only the memory region was created so far. This change adds the DT_LINKER_SECTION() macro to the linker script so that the appropriate sections will be generated, too. Fixes #79085 Signed-off-by: Florian Grandel --- include/zephyr/arch/x86/ia32/linker.ld | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/zephyr/arch/x86/ia32/linker.ld b/include/zephyr/arch/x86/ia32/linker.ld index 57101bca820a0..02360d98202f9 100644 --- a/include/zephyr/arch/x86/ia32/linker.ld +++ b/include/zephyr/arch/x86/ia32/linker.ld @@ -573,7 +573,10 @@ SECTIONS .strtab 0 : { *(.strtab) } .shstrtab 0 : { *(.shstrtab) } #endif - } + + /* Sections generated from 'zephyr,memory-region' nodes */ + LINKER_DT_SECTIONS() +} #ifdef CONFIG_XIP /* From d5b653961487ce516dc0eefca65d19dfc72a1497 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 26 Sep 2024 11:29:55 -0700 Subject: [PATCH 0055/4482] picolibc: Update module to version 1.8.8 Switch to released version with all of the Zephyr build fixes Signed-off-by: Keith Packard --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index e07882f3adcd8..1f5d8db576246 100644 --- a/west.yml +++ b/west.yml @@ -315,7 +315,7 @@ manifest: - debug - name: picolibc path: modules/lib/picolibc - revision: 06bde1fd7531b1f788f6e42b6f7b358c0fe4f814 + revision: e15656f7682500fc8953e1a2008f7b1ae4f65ce8 - name: segger revision: b011c45b585e097d95d9cf93edf4f2e01588d3cd path: modules/debug/segger From 61644977d43ddd36c32292f1895d6f22a439003d Mon Sep 17 00:00:00 2001 From: Lucas Tamborrino Date: Mon, 26 Aug 2024 15:16:48 -0300 Subject: [PATCH 0056/4482] samples: drivers: video: capture: Add format config Add video format Kconfig for proper sample configuration. Signed-off-by: Lucas Tamborrino --- samples/drivers/video/capture/Kconfig | 27 +++++++++++ samples/drivers/video/capture/sample.yaml | 1 + samples/drivers/video/capture/src/main.c | 55 ++++++++++++++--------- 3 files changed, 63 insertions(+), 20 deletions(-) create mode 100644 samples/drivers/video/capture/Kconfig diff --git a/samples/drivers/video/capture/Kconfig b/samples/drivers/video/capture/Kconfig new file mode 100644 index 0000000000000..5ec77c553e198 --- /dev/null +++ b/samples/drivers/video/capture/Kconfig @@ -0,0 +1,27 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +mainmenu "Video capture sample application" + +menu "Video capture configuration" + +config VIDEO_FRAME_HEIGHT + int "Height of the video frame" + default 0 + help + Height of the video frame. If set to 0, the default height is used. + +config VIDEO_FRAME_WIDTH + int "Width of the video frame" + default 0 + help + Width of the video frame. If set to 0, the default width is used. + +config VIDEO_PIXEL_FORMAT + string "Pixel format of the video frame" + help + Pixel format of the video frame. If not set, the default pixel format is used. + +endmenu + +source "Kconfig.zephyr" diff --git a/samples/drivers/video/capture/sample.yaml b/samples/drivers/video/capture/sample.yaml index 6d3724b106ff3..79b65494bad55 100644 --- a/samples/drivers/video/capture/sample.yaml +++ b/samples/drivers/video/capture/sample.yaml @@ -24,6 +24,7 @@ tests: - mimxrt1064_evk - mimxrt1170_evk/mimxrt1176/cm7 - mm_swiftio + - esp32s3_eye/esp32s3/procpu depends_on: video integration_platforms: - mimxrt1064_evk diff --git a/samples/drivers/video/capture/src/main.c b/samples/drivers/video/capture/src/main.c index 9eed2a3924fb2..d2d64b84dd408 100644 --- a/samples/drivers/video/capture/src/main.c +++ b/samples/drivers/video/capture/src/main.c @@ -22,18 +22,13 @@ static inline int display_setup(const struct device *const display_dev, const ui struct display_capabilities capabilities; int ret = 0; - if (!device_is_ready(display_dev)) { - LOG_ERR("Device %s not found", display_dev->name); - return -ENODEV; - } - - printk("\nDisplay device: %s\n", display_dev->name); + LOG_INF("Display device: %s", display_dev->name); display_get_capabilities(display_dev, &capabilities); - printk("- Capabilities:\n"); - printk(" x_resolution = %u, y_resolution = %u, supported_pixel_formats = %u\n" - " current_pixel_format = %u, current_orientation = %u\n\n", + LOG_INF("- Capabilities:"); + LOG_INF(" x_resolution = %u, y_resolution = %u, supported_pixel_formats = %u" + " current_pixel_format = %u, current_orientation = %u", capabilities.x_resolution, capabilities.y_resolution, capabilities.supported_pixel_formats, capabilities.current_pixel_format, capabilities.current_orientation); @@ -41,7 +36,7 @@ static inline int display_setup(const struct device *const display_dev, const ui /* Set display pixel format to match the one in use by the camera */ switch (pixfmt) { case VIDEO_PIX_FMT_RGB565: - ret = display_set_pixel_format(display_dev, PIXEL_FORMAT_BGR_565); + ret = display_set_pixel_format(display_dev, PIXEL_FORMAT_RGB_565); break; case VIDEO_PIX_FMT_XRGB32: ret = display_set_pixel_format(display_dev, PIXEL_FORMAT_ARGB_8888); @@ -101,7 +96,7 @@ int main(void) } #endif - printk("Video device: %s\n", video_dev->name); + LOG_INF("Video device: %s", video_dev->name); /* Get capabilities */ if (video_get_caps(video_dev, VIDEO_EP_OUT, &caps)) { @@ -109,11 +104,11 @@ int main(void) return 0; } - printk("- Capabilities:\n"); + LOG_INF("- Capabilities:"); while (caps.format_caps[i].pixelformat) { const struct video_format_cap *fcap = &caps.format_caps[i]; /* fourcc to string */ - printk(" %c%c%c%c width [%u; %u; %u] height [%u; %u; %u]\n", + LOG_INF(" %c%c%c%c width [%u; %u; %u] height [%u; %u; %u]", (char)fcap->pixelformat, (char)(fcap->pixelformat >> 8), (char)(fcap->pixelformat >> 16), (char)(fcap->pixelformat >> 24), fcap->width_min, fcap->width_max, fcap->width_step, fcap->height_min, @@ -127,23 +122,43 @@ int main(void) return 0; } - printk("- Default format: %c%c%c%c %ux%u\n", (char)fmt.pixelformat, +#if CONFIG_VIDEO_FRAME_HEIGHT + fmt.height = CONFIG_VIDEO_FRAME_HEIGHT; +#endif + +#if CONFIG_VIDEO_FRAME_WIDTH + fmt.width = CONFIG_VIDEO_FRAME_WIDTH; + fmt.pitch = fmt.width * 2; +#endif + + if (strcmp(CONFIG_VIDEO_PIXEL_FORMAT, "")) { + fmt.pixelformat = + video_fourcc(CONFIG_VIDEO_PIXEL_FORMAT[0], CONFIG_VIDEO_PIXEL_FORMAT[1], + CONFIG_VIDEO_PIXEL_FORMAT[2], CONFIG_VIDEO_PIXEL_FORMAT[3]); + } + + LOG_INF("- Video format: %c%c%c%c %ux%u", (char)fmt.pixelformat, (char)(fmt.pixelformat >> 8), (char)(fmt.pixelformat >> 16), (char)(fmt.pixelformat >> 24), fmt.width, fmt.height); + if (video_set_format(video_dev, VIDEO_EP_OUT, &fmt)) { + LOG_ERR("Unable to set format"); + return 0; + } + if (!video_get_frmival(video_dev, VIDEO_EP_OUT, &frmival)) { - printk("- Default frame rate : %f fps\n", + LOG_INF("- Default frame rate : %f fps", 1.0 * frmival.denominator / frmival.numerator); } - printk("- Supported frame intervals for the default format:\n"); + LOG_INF("- Supported frame intervals for the default format:"); memset(&fie, 0, sizeof(fie)); fie.format = &fmt; while (video_enum_frmival(video_dev, VIDEO_EP_OUT, &fie) == 0) { if (fie.type == VIDEO_FRMIVAL_TYPE_DISCRETE) { - printk(" %u/%u ", fie.discrete.numerator, fie.discrete.denominator); + LOG_INF(" %u/%u ", fie.discrete.numerator, fie.discrete.denominator); } else { - printk(" [min = %u/%u; max = %u/%u; step = %u/%u]\n", + LOG_INF(" [min = %u/%u; max = %u/%u; step = %u/%u]", fie.stepwise.min.numerator, fie.stepwise.min.denominator, fie.stepwise.max.numerator, fie.stepwise.max.denominator, fie.stepwise.step.numerator, fie.stepwise.step.denominator); @@ -190,7 +205,7 @@ int main(void) return 0; } - printk("Capture started\n"); + LOG_INF("Capture started"); /* Grab video frames */ while (1) { @@ -200,7 +215,7 @@ int main(void) return 0; } - printk("Got frame %u! size: %u; timestamp %u ms\n", frame++, vbuf->bytesused, + LOG_DBG("Got frame %u! size: %u; timestamp %u ms", frame++, vbuf->bytesused, vbuf->timestamp); #if DT_HAS_CHOSEN(zephyr_display) From 6c99888bfef812e0890c45cbfa27bed215b680a9 Mon Sep 17 00:00:00 2001 From: Lucas Tamborrino Date: Tue, 24 Sep 2024 16:56:11 -0300 Subject: [PATCH 0057/4482] drivers: video: esp32: Fix unused variables Fix build warning for unused variables. Signed-off-by: Lucas Tamborrino --- drivers/video/video_esp32_dvp.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/video/video_esp32_dvp.c b/drivers/video/video_esp32_dvp.c index 54a480e5424d0..d11a209fed211 100644 --- a/drivers/video/video_esp32_dvp.c +++ b/drivers/video/video_esp32_dvp.c @@ -89,7 +89,6 @@ void video_esp32_dma_rx_done(const struct device *dev, void *user_data, uint32_t int status) { struct video_esp32_data *data = user_data; - int ret = 0; if (status == DMA_STATUS_BLOCK) { LOG_DBG("received block"); @@ -278,7 +277,6 @@ static int video_esp32_set_fmt(const struct device *dev, enum video_endpoint_id static int video_esp32_enqueue(const struct device *dev, enum video_endpoint_id ep, struct video_buffer *vbuf) { - const struct video_esp32_config *cfg = dev->config; struct video_esp32_data *data = dev->data; if (ep != VIDEO_EP_OUT) { From 3f405ea92fcfbaa94b71ce446b4136466a1dd82a Mon Sep 17 00:00:00 2001 From: Lucas Tamborrino Date: Tue, 24 Sep 2024 16:54:50 -0300 Subject: [PATCH 0058/4482] boards: espressif: esp32s3 eye: add video feature Add video as supported feature. Signed-off-by: Lucas Tamborrino --- boards/espressif/esp32s3_eye/esp32s3_eye_procpu.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/espressif/esp32s3_eye/esp32s3_eye_procpu.yaml b/boards/espressif/esp32s3_eye/esp32s3_eye_procpu.yaml index adddce2e59e7e..089082c42e505 100644 --- a/boards/espressif/esp32s3_eye/esp32s3_eye_procpu.yaml +++ b/boards/espressif/esp32s3_eye/esp32s3_eye_procpu.yaml @@ -16,6 +16,7 @@ supported: - pwm - dma - input + - video testing: ignore_tags: - net From 9ae3105f795a90b4bcc1cf720956a9a02f317c35 Mon Sep 17 00:00:00 2001 From: Lucas Tamborrino Date: Mon, 26 Aug 2024 10:54:31 -0300 Subject: [PATCH 0059/4482] samples: drivers: video: capture: Add ESP32S3-EYE support Add support for esp32s3-eye board. Signed-off-by: Lucas Tamborrino --- .../video/capture/boards/esp32s3_eye_procpu.conf | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 samples/drivers/video/capture/boards/esp32s3_eye_procpu.conf diff --git a/samples/drivers/video/capture/boards/esp32s3_eye_procpu.conf b/samples/drivers/video/capture/boards/esp32s3_eye_procpu.conf new file mode 100644 index 0000000000000..76321800fa069 --- /dev/null +++ b/samples/drivers/video/capture/boards/esp32s3_eye_procpu.conf @@ -0,0 +1,11 @@ +CONFIG_VIDEO_BUFFER_POOL_SZ_MAX=40000 +CONFIG_VIDEO_BUFFER_POOL_NUM_MAX=3 +CONFIG_ESP_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_VIDEO_BUFFER_POOL_ALIGN=32 +CONFIG_DMA_ESP32_MAX_DESCRIPTOR_NUM=64 +CONFIG_VIDEO_BUFFER_USE_SHARED_MULTI_HEAP=y +CONFIG_VIDEO_BUFFER_SMH_ATTRIBUTE=2 +CONFIG_VIDEO_FRAME_HEIGHT=240 +CONFIG_VIDEO_FRAME_WIDTH=240 +CONFIG_VIDEO_PIXEL_FORMAT="RGBP" From 72370b23ce643f02bc57c5d005f9d0e324f92e9b Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Thu, 27 Jun 2024 10:05:24 +0200 Subject: [PATCH 0060/4482] dts: bindings: flash_controller stm32 qspi has requires-ulbpr property Add the property from the "jedec,spi-nor-common.yaml" to the existing st,stm32-qspi-nor.yaml. So that external quad-NOR with unlock the Global Block Protection (BPR) (opcode 0x98) is accepted. Signed-off-by: Francois Ramu --- dts/bindings/flash_controller/st,stm32-qspi-nor.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dts/bindings/flash_controller/st,stm32-qspi-nor.yaml b/dts/bindings/flash_controller/st,stm32-qspi-nor.yaml index 3f990f4a125c2..8c23e02c07654 100644 --- a/dts/bindings/flash_controller/st,stm32-qspi-nor.yaml +++ b/dts/bindings/flash_controller/st,stm32-qspi-nor.yaml @@ -61,3 +61,13 @@ properties: supporting 1-4-4 mode also would support fast page programming. If absent, then 1-4-4 program page is used in quad mode. + + requires-ulbpr: + type: boolean + description: | + Indicates the device requires the ULBPR (0x98) command. + + Some flash chips such as the Microchip SST26VF series have a block + protection register that initializes to write-protected. Use this + property to indicate that the BPR must be unlocked before write + operations can proceed. From 76740ae1d12e8a436c33e8f9b92d9ec0e5f40263 Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Wed, 19 Jun 2024 11:27:54 +0200 Subject: [PATCH 0061/4482] drivers: flash: qspi stm32 driver supporting requires_ulbpr Add the support of the requires_ulbpr property when a Microchip quad-spi flash is mounted. Set the CONFIG_USE_MICROCHIP_QSPI_FLASH_WITH_STM32=y flag to access the command Signed-off-by: Francois Ramu --- drivers/flash/Kconfig.stm32 | 8 ++++++++ drivers/flash/flash_stm32_qspi.c | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/drivers/flash/Kconfig.stm32 b/drivers/flash/Kconfig.stm32 index 60dd966a0ae5e..0d0ecf535b977 100644 --- a/drivers/flash/Kconfig.stm32 +++ b/drivers/flash/Kconfig.stm32 @@ -84,4 +84,12 @@ config FLASH_STM32_BLOCK_REGISTERS registers improves system security, because flash content (or protection settings) can't be changed even when exploit was found. +config USE_MICROCHIP_QSPI_FLASH_WITH_STM32 + bool "Include patch for Microchip qspi flash when running with stm32" + depends on DT_HAS_ST_STM32_QSPI_NOR_ENABLED + help + Set to use Microchip qspi flash memories which supports + the Global Block Protection Unlock instruction (ULBPR - 98H), + and write with SPI_NOR_CMD_PP_1_1_4 on 4 lines + endif # SOC_FLASH_STM32 diff --git a/drivers/flash/flash_stm32_qspi.c b/drivers/flash/flash_stm32_qspi.c index 64c604d38bd84..bb2fe2586854d 100644 --- a/drivers/flash/flash_stm32_qspi.c +++ b/drivers/flash/flash_stm32_qspi.c @@ -187,9 +187,16 @@ static inline int qspi_prepare_quad_program(const struct device *dev, dev_data->qspi_write_cmd == SPI_NOR_CMD_PP_1_4_4); cmd->Instruction = dev_data->qspi_write_cmd; +#if defined(CONFIG_USE_MICROCHIP_QSPI_FLASH_WITH_STM32) + /* Microchip qspi-NOR flash, does not follow the standard rules */ + if (cmd->Instruction == SPI_NOR_CMD_PP_1_1_4) { + cmd->AddressMode = QSPI_ADDRESS_4_LINES; + } +#else cmd->AddressMode = ((cmd->Instruction == SPI_NOR_CMD_PP_1_1_4) ? QSPI_ADDRESS_1_LINE : QSPI_ADDRESS_4_LINES); +#endif /* CONFIG_USE_MICROCHIP_QSPI_FLASH_WITH_STM32 */ cmd->DataMode = QSPI_DATA_4_LINES; cmd->DummyCycles = 0; From ff34d575bc154f79271ecfb79c0362ef9e9cd73f Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Thu, 27 Jun 2024 09:50:38 +0200 Subject: [PATCH 0062/4482] drivers: flash: stm32 qspi flash driver with unprotect command Add the write_unprotect command to the stm32 qspi flash driver to un protect flash before any write operation to the external quad-NOR Signed-off-by: Francois Ramu --- drivers/flash/flash_stm32_qspi.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/flash/flash_stm32_qspi.c b/drivers/flash/flash_stm32_qspi.c index bb2fe2586854d..3e63cb979c727 100644 --- a/drivers/flash/flash_stm32_qspi.c +++ b/drivers/flash/flash_stm32_qspi.c @@ -352,6 +352,27 @@ static int qspi_read_jedec_id(const struct device *dev, uint8_t *id) } #endif /* CONFIG_FLASH_JESD216_API */ +static int qspi_write_unprotect(const struct device *dev) +{ + int ret = 0; + QSPI_CommandTypeDef cmd_unprotect = { + .Instruction = SPI_NOR_CMD_ULBPR, + .InstructionMode = QSPI_INSTRUCTION_1_LINE, + }; + + if (IS_ENABLED(DT_INST_PROP(0, requires_ulbpr))) { + ret = qspi_send_cmd(dev, &cmd_write_en); + + if (ret != 0) { + return ret; + } + + ret = qspi_send_cmd(dev, &cmd_unprotect); + } + + return ret; +} + /* * Read Serial Flash Discovery Parameter */ @@ -1498,6 +1519,13 @@ static int flash_stm32_qspi_init(const struct device *dev) } #endif /* CONFIG_FLASH_PAGE_LAYOUT */ + ret = qspi_write_unprotect(dev); + if (ret != 0) { + LOG_ERR("write unprotect failed: %d", ret); + return -ENODEV; + } + LOG_DBG("Write Un-protected"); + #ifdef CONFIG_STM32_MEMMAP #if DT_PROP(DT_NODELABEL(quadspi), dual_flash) && defined(QUADSPI_CR_DFM) /* From fa4f2ffc47d49a17e04f11da14d12ca317124ecc Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Wed, 12 Jun 2024 19:09:24 +0200 Subject: [PATCH 0063/4482] Bluetooth: CAP: Add support for doing just disable for unicast stop The unicast_stop function is changed to primarily do a BAP disable instead of a release, with optional support for releasing the streams once they have been disabled. This also adds unittests for the procedure which also allow us to remove the invalid param testing from the BSIM tests. Signed-off-by: Emil Gydesen --- include/zephyr/bluetooth/audio/cap.h | 8 +- subsys/bluetooth/audio/bap_stream.c | 4 +- subsys/bluetooth/audio/cap_common.c | 10 + subsys/bluetooth/audio/cap_initiator.c | 484 ++++++++++++++---- subsys/bluetooth/audio/cap_internal.h | 8 + subsys/bluetooth/audio/cap_stream.c | 10 + subsys/bluetooth/audio/shell/cap_initiator.c | 1 + .../audio/cap_initiator/CMakeLists.txt | 1 + tests/bluetooth/audio/cap_initiator/prj.conf | 2 + .../bluetooth/audio/cap_initiator/src/main.c | 2 - .../audio/cap_initiator/src/test_common.c | 2 + .../cap_initiator/src/test_unicast_start.c | 2 - .../cap_initiator/src/test_unicast_stop.c | 482 +++++++++++++++++ .../cap_initiator/uut/bap_unicast_client.c | 95 +++- tests/bluetooth/tester/src/audio/btp_cap.c | 1 + .../audio/src/cap_initiator_unicast_test.c | 34 +- .../bsim/bluetooth/audio/src/gmap_ugg_test.c | 1 + 17 files changed, 1022 insertions(+), 125 deletions(-) create mode 100644 tests/bluetooth/audio/cap_initiator/src/test_unicast_stop.c diff --git a/include/zephyr/bluetooth/audio/cap.h b/include/zephyr/bluetooth/audio/cap.h index 50c29640a734a..4417477860dc2 100644 --- a/include/zephyr/bluetooth/audio/cap.h +++ b/include/zephyr/bluetooth/audio/cap.h @@ -312,6 +312,9 @@ struct bt_cap_unicast_audio_stop_param { /** Array of streams to stop */ struct bt_cap_stream **streams; + + /** Whether to release the streams after they have stopped */ + bool release; }; /** @@ -379,7 +382,10 @@ int bt_cap_initiator_unicast_audio_update(const struct bt_cap_unicast_audio_upda * * @param param Stop parameters. * - * @return 0 on success or negative error value on failure. + * @return 0 on success + * @retval -EBUSY if a CAP procedure is already in progress + * @retval -EINVAL if any parameter is invalid + * @retval -EALREADY if no state changes will occur */ int bt_cap_initiator_unicast_audio_stop(const struct bt_cap_unicast_audio_stop_param *param); diff --git a/subsys/bluetooth/audio/bap_stream.c b/subsys/bluetooth/audio/bap_stream.c index 55ff17dd8e7e4..ac6ed0820411f 100644 --- a/subsys/bluetooth/audio/bap_stream.c +++ b/subsys/bluetooth/audio/bap_stream.c @@ -509,7 +509,7 @@ void bt_bap_stream_detach(struct bt_bap_stream *stream) { const bool is_broadcast = bt_bap_stream_is_broadcast(stream); - LOG_DBG("stream %p", stream); + LOG_DBG("stream %p conn %p ep %p", stream, (void *)stream->conn, (void *)stream->ep); if (stream->conn != NULL) { bt_conn_unref(stream->conn); @@ -587,7 +587,7 @@ int bt_bap_stream_config(struct bt_conn *conn, struct bt_bap_stream *stream, str codec_cfg, codec_cfg ? codec_cfg->id : 0, codec_cfg ? codec_cfg->cid : 0, codec_cfg ? codec_cfg->vid : 0); - CHECKIF(conn == NULL || stream == NULL || codec_cfg == NULL) { + CHECKIF(conn == NULL || stream == NULL || codec_cfg == NULL || ep == NULL) { LOG_DBG("NULL value(s) supplied)"); return -EINVAL; } diff --git a/subsys/bluetooth/audio/cap_common.c b/subsys/bluetooth/audio/cap_common.c index 56e7741d2ee0f..8780a3e357afe 100644 --- a/subsys/bluetooth/audio/cap_common.c +++ b/subsys/bluetooth/audio/cap_common.c @@ -64,6 +64,11 @@ void bt_cap_common_set_subproc(enum bt_cap_common_subproc_type subproc_type) active_proc.subproc_type = subproc_type; } +bool bt_cap_common_proc_is_type(enum bt_cap_common_proc_type proc_type) +{ + return active_proc.proc_type == proc_type; +} + bool bt_cap_common_subproc_is_type(enum bt_cap_common_subproc_type subproc_type) { return active_proc.subproc_type == subproc_type; @@ -122,7 +127,12 @@ void bt_cap_common_abort_proc(struct bt_conn *conn, int err) return; } +#if defined(CONFIG_BT_CAP_INITIATOR_UNICAST) + LOG_DBG("Aborting proc %d with subproc %d for %p: %d", active_proc.proc_type, + active_proc.subproc_type, (void *)conn, err); +#else /* !CONFIG_BT_CAP_INITIATOR_UNICAST */ LOG_DBG("Aborting proc %d for %p: %d", active_proc.proc_type, (void *)conn, err); +#endif /* CONFIG_BT_CAP_INITIATOR_UNICAST */ active_proc.err = err; active_proc.failed_conn = conn; diff --git a/subsys/bluetooth/audio/cap_initiator.c b/subsys/bluetooth/audio/cap_initiator.c index 20d5011ebde14..23295848b1435 100644 --- a/subsys/bluetooth/audio/cap_initiator.c +++ b/subsys/bluetooth/audio/cap_initiator.c @@ -513,6 +513,17 @@ static void update_proc_done_cnt(struct bt_cap_common_proc *active_proc) state = stream_get_state(bap_stream); switch (subproc_type) { + case BT_CAP_COMMON_SUBPROC_TYPE_DISABLE: + if (state == BT_BAP_EP_STATE_QOS_CONFIGURED || + state == BT_BAP_EP_STATE_DISABLING) { + proc_done_cnt++; + } + break; + case BT_CAP_COMMON_SUBPROC_TYPE_STOP: + if (state == BT_BAP_EP_STATE_QOS_CONFIGURED) { + proc_done_cnt++; + } + break; case BT_CAP_COMMON_SUBPROC_TYPE_RELEASE: if (state == BT_BAP_EP_STATE_IDLE || state == BT_BAP_EP_STATE_CODEC_CONFIGURED) { @@ -574,47 +585,60 @@ get_next_proc_param(struct bt_cap_common_proc *active_proc) struct bt_cap_initiator_proc_param *proc_param; struct bt_cap_stream *cap_stream; struct bt_bap_stream *bap_stream; + enum bt_bap_ep_state state; proc_param = &active_proc->proc_param.initiator[i]; cap_stream = proc_param->stream; bap_stream = &cap_stream->bap_stream; + state = stream_get_state(bap_stream); switch (subproc_type) { case BT_CAP_COMMON_SUBPROC_TYPE_CODEC_CONFIG: - if (stream_is_in_state(bap_stream, BT_BAP_EP_STATE_IDLE)) { + if (state == BT_BAP_EP_STATE_IDLE) { return proc_param; } break; case BT_CAP_COMMON_SUBPROC_TYPE_QOS_CONFIG: - if (stream_is_in_state(bap_stream, BT_BAP_EP_STATE_CODEC_CONFIGURED)) { + if (state == BT_BAP_EP_STATE_CODEC_CONFIGURED) { return proc_param; } break; case BT_CAP_COMMON_SUBPROC_TYPE_ENABLE: - if (stream_is_in_state(bap_stream, BT_BAP_EP_STATE_QOS_CONFIGURED)) { + if (state == BT_BAP_EP_STATE_QOS_CONFIGURED) { return proc_param; } break; case BT_CAP_COMMON_SUBPROC_TYPE_CONNECT: - if (stream_is_in_state(bap_stream, BT_BAP_EP_STATE_ENABLING) && - !proc_param->start.connected) { + if (state == BT_BAP_EP_STATE_ENABLING && !proc_param->start.connected) { return proc_param; } break; case BT_CAP_COMMON_SUBPROC_TYPE_START: - if (stream_is_in_state(bap_stream, BT_BAP_EP_STATE_ENABLING)) { + if (state == BT_BAP_EP_STATE_ENABLING) { /* TODO: Add check for connected */ return proc_param; } break; case BT_CAP_COMMON_SUBPROC_TYPE_META_UPDATE: - if (stream_is_in_state(bap_stream, BT_BAP_EP_STATE_ENABLING) || - stream_is_in_state(bap_stream, BT_BAP_EP_STATE_STREAMING)) { + if (state == BT_BAP_EP_STATE_ENABLING || + state == BT_BAP_EP_STATE_STREAMING) { + return proc_param; + } + break; + case BT_CAP_COMMON_SUBPROC_TYPE_DISABLE: + if (state == BT_BAP_EP_STATE_ENABLING || + state == BT_BAP_EP_STATE_STREAMING) { + return proc_param; + } + break; + case BT_CAP_COMMON_SUBPROC_TYPE_STOP: + if (state == BT_BAP_EP_STATE_DISABLING) { return proc_param; } break; case BT_CAP_COMMON_SUBPROC_TYPE_RELEASE: - if (!stream_is_in_state(bap_stream, BT_BAP_EP_STATE_IDLE)) { + if (proc_param->stop.release && state != BT_BAP_EP_STATE_IDLE && + state != BT_BAP_EP_STATE_CODEC_CONFIGURED) { return proc_param; } break; @@ -848,6 +872,7 @@ static int cap_initiator_unicast_audio_configure( /* Since BAP operations may require a write long or a read long on the notification, * we cannot assume that we can do multiple streams at once, thus do it one at a time. * TODO: We should always be able to do one per ACL, so there is room for optimization. + * This applies to all BAP calls in this file. */ err = bt_bap_stream_config(conn, bap_stream, ep, codec_cfg); if (err != 0) { @@ -946,12 +971,6 @@ void bt_cap_initiator_codec_configured(struct bt_cap_stream *cap_stream) next_bap_stream = &next_cap_stream->bap_stream; active_proc->proc_initiated_cnt++; - /* Since BAP operations may require a write long or a read long on the notification, - * we cannot assume that we can do multiple streams at once, thus do it one at a - * time. - * TODO: We should always be able to do one per ACL, so there is room for - * optimization. - */ err = bt_bap_stream_config(conn, next_bap_stream, ep, codec_cfg); if (err != 0) { LOG_DBG("Failed to config stream %p: %d", next_cap_stream, err); @@ -1042,10 +1061,6 @@ void bt_cap_initiator_codec_configured(struct bt_cap_stream *cap_stream) void bt_cap_initiator_qos_configured(struct bt_cap_stream *cap_stream) { struct bt_cap_common_proc *active_proc = bt_cap_common_get_active_proc(); - struct bt_cap_initiator_proc_param *proc_param; - struct bt_cap_stream *next_cap_stream; - struct bt_bap_stream *bap_stream; - int err; if (!bt_cap_common_stream_in_active_proc(cap_stream)) { /* State change happened outside of a procedure; ignore */ @@ -1054,7 +1069,9 @@ void bt_cap_initiator_qos_configured(struct bt_cap_stream *cap_stream) LOG_DBG("cap_stream %p", cap_stream); - if (!bt_cap_common_subproc_is_type(BT_CAP_COMMON_SUBPROC_TYPE_QOS_CONFIG)) { + if (!(bt_cap_common_proc_is_type(BT_CAP_COMMON_PROC_TYPE_START) && + bt_cap_common_subproc_is_type(BT_CAP_COMMON_SUBPROC_TYPE_QOS_CONFIG)) && + !(bt_cap_common_proc_is_type(BT_CAP_COMMON_PROC_TYPE_STOP))) { /* Unexpected callback - Abort */ bt_cap_common_abort_proc(cap_stream->bap_stream.conn, -EBADMSG); } else { @@ -1072,36 +1089,60 @@ void bt_cap_initiator_qos_configured(struct bt_cap_stream *cap_stream) return; } - if (!bt_cap_common_proc_is_done()) { - /* Not yet finished, wait for all */ - return; - } + if (bt_cap_common_proc_is_type(BT_CAP_COMMON_PROC_TYPE_START)) { + struct bt_cap_initiator_proc_param *proc_param; + struct bt_cap_stream *next_cap_stream; + struct bt_bap_stream *bap_stream; + int err; - bt_cap_common_set_subproc(BT_CAP_COMMON_SUBPROC_TYPE_ENABLE); - proc_param = get_next_proc_param(active_proc); - if (proc_param == NULL) { - /* If proc_param is NULL then this step is a no-op and we can skip to the next step - */ - bt_cap_initiator_enabled(active_proc->proc_param.initiator[0].stream); + if (!bt_cap_common_proc_is_done()) { + /* Not yet finished, wait for all */ + return; + } - return; - } + bt_cap_common_set_subproc(BT_CAP_COMMON_SUBPROC_TYPE_ENABLE); + proc_param = get_next_proc_param(active_proc); + if (proc_param == NULL) { + /* If proc_param is NULL then this step is a no-op and we can skip to the + * next step + */ + bt_cap_initiator_enabled(active_proc->proc_param.initiator[0].stream); - next_cap_stream = proc_param->stream; - bap_stream = &next_cap_stream->bap_stream; - active_proc->proc_initiated_cnt++; + return; + } - /* Since BAP operations may require a write long or a read long on the notification, we - * cannot assume that we can do multiple streams at once, thus do it one at a time. - * TODO: We should always be able to do one per ACL, so there is room for optimization. - */ - err = bt_bap_stream_enable(bap_stream, bap_stream->codec_cfg->meta, - bap_stream->codec_cfg->meta_len); - if (err != 0) { - LOG_DBG("Failed to enable stream %p: %d", next_cap_stream, err); + next_cap_stream = proc_param->stream; + bap_stream = &next_cap_stream->bap_stream; + active_proc->proc_initiated_cnt++; - bt_cap_common_abort_proc(bap_stream->conn, err); - cap_initiator_unicast_audio_proc_complete(); + err = bt_bap_stream_enable(bap_stream, bap_stream->codec_cfg->meta, + bap_stream->codec_cfg->meta_len); + if (err != 0) { + LOG_DBG("Failed to enable stream %p: %d", next_cap_stream, err); + + bt_cap_common_abort_proc(bap_stream->conn, err); + cap_initiator_unicast_audio_proc_complete(); + } + } else if (bt_cap_common_subproc_is_type(BT_CAP_COMMON_SUBPROC_TYPE_RELEASE)) { + struct bt_cap_initiator_proc_param *proc_param; + struct bt_cap_stream *next_cap_stream; + struct bt_bap_stream *next_bap_stream; + int err; + + proc_param = get_next_proc_param(active_proc); + __ASSERT(proc_param != NULL, "proc is not done, but could not get next proc_param"); + + next_cap_stream = proc_param->stream; + next_bap_stream = &next_cap_stream->bap_stream; + active_proc->proc_initiated_cnt++; + + err = bt_bap_stream_release(next_bap_stream); + if (err != 0) { + LOG_DBG("Failed to release stream %p: %d", next_cap_stream, err); + + bt_cap_common_abort_proc(next_bap_stream->conn, err); + cap_initiator_unicast_audio_proc_complete(); + } } } @@ -1148,12 +1189,6 @@ void bt_cap_initiator_enabled(struct bt_cap_stream *cap_stream) active_proc->proc_initiated_cnt++; - /* Since BAP operations may require a write long or a read long on the notification, - * we cannot assume that we can do multiple streams at once, thus do it one at a - * time. - * TODO: We should always be able to do one per ACL, so there is room for - * optimization. - */ err = bt_bap_stream_enable(next_bap_stream, next_bap_stream->codec_cfg->meta, next_bap_stream->codec_cfg->meta_len); if (err != 0) { @@ -1276,12 +1311,6 @@ void bt_cap_initiator_connected(struct bt_cap_stream *cap_stream) bap_stream = &proc_param->stream->bap_stream; if (stream_is_dir(bap_stream, BT_AUDIO_DIR_SOURCE)) { - /* Since BAP operations may require a write long or a read long on the notification, - * we cannot assume that we can do multiple streams at once, thus do it one at a - * time. - * TODO: We should always be able to do one per ACL, so there is room for - * optimization. - */ err = bt_bap_stream_start(bap_stream); if (err != 0) { LOG_DBG("Failed to start stream %p: %d", proc_param->stream, err); @@ -1330,12 +1359,6 @@ void bt_cap_initiator_started(struct bt_cap_stream *cap_stream) if (stream_is_dir(next_bap_stream, BT_AUDIO_DIR_SOURCE)) { int err; - /* Since BAP operations may require a write long or a read long on - * the notification, we cannot assume that we can do multiple - * streams at once, thus do it one at a time. - * TODO: We should always be able to do one per ACL, so there is - * room for optimization. - */ err = bt_bap_stream_start(next_bap_stream); if (err != 0) { LOG_DBG("Failed to start stream %p: %d", next_cap_stream, err); @@ -1478,6 +1501,9 @@ int bt_cap_initiator_unicast_audio_update(const struct bt_cap_unicast_audio_upda ¶m->stream_params[i]; struct bt_cap_stream *cap_stream = stream_param->stream; + /* Ensure that ops are registered before any procedures are started */ + bt_cap_stream_ops_register_bap(cap_stream); + active_proc->proc_param.initiator[i].stream = cap_stream; active_proc->proc_param.initiator[i].meta_update.meta_len = stream_param->meta_len; memcpy(&active_proc->proc_param.initiator[i].meta_update.meta, stream_param->meta, @@ -1562,13 +1588,6 @@ void bt_cap_initiator_metadata_updated(struct bt_cap_stream *cap_stream) bap_stream = &next_cap_stream->bap_stream; active_proc->proc_initiated_cnt++; - /* Since BAP operations may require a write long or a read long on the notification, - * we cannot assume that we can do multiple streams at once, thus do it one at a - * time. - * TODO: We should always be able to do one per ACL, so there is room for - * optimization. - */ - err = bt_bap_stream_metadata(bap_stream, meta, meta_len); if (err != 0) { LOG_DBG("Failed to update metadata for stream %p: %d", next_cap_stream, @@ -1584,13 +1603,43 @@ void bt_cap_initiator_metadata_updated(struct bt_cap_stream *cap_stream) cap_initiator_unicast_audio_proc_complete(); } -static bool can_release(const struct bt_bap_stream *bap_stream) +static bool can_release_stream(const struct bt_bap_stream *bap_stream) +{ + enum bt_bap_ep_state state; + + if (bap_stream->conn == NULL) { + return false; + } + + state = stream_get_state(bap_stream); + + /* We cannot release idle endpoints. + * We do not know if we can release endpoints in the Codec Configured state as servers may + * cache it, so treat it as idle + */ + return state != BT_BAP_EP_STATE_IDLE && state != BT_BAP_EP_STATE_CODEC_CONFIGURED; +} + +static bool can_disable_stream(const struct bt_bap_stream *bap_stream) +{ + enum bt_bap_ep_state state; + + if (bap_stream->conn == NULL) { + return false; + } + + state = stream_get_state(bap_stream); + + return state == BT_BAP_EP_STATE_STREAMING || state == BT_BAP_EP_STATE_ENABLING; +} + +static bool can_stop_stream(const struct bt_bap_stream *bap_stream) { if (bap_stream->conn == NULL) { return false; } - return !stream_is_in_state(bap_stream, BT_BAP_EP_STATE_IDLE); + return stream_is_in_state(bap_stream, BT_BAP_EP_STATE_DISABLING); } static bool valid_unicast_audio_stop_param(const struct bt_cap_unicast_audio_stop_param *param) @@ -1637,6 +1686,18 @@ static bool valid_unicast_audio_stop_param(const struct bt_cap_unicast_audio_sto return -EINVAL; } + if (param->type == BT_CAP_SET_TYPE_CSIP) { + struct bt_cap_common_client *client = bt_cap_common_get_client_by_acl(conn); + + if (client->csis_inst == NULL) { + LOG_DBG("param->streams[%zu]->bap_stream.conn not part of a " + "coordinated set", + i); + + return false; + } + } + CHECKIF(bap_stream->group == NULL) { LOG_DBG("param->streams[%zu] is not in a unicast group", i); return false; @@ -1653,12 +1714,6 @@ static bool valid_unicast_audio_stop_param(const struct bt_cap_unicast_audio_sto } } - if (!can_release(bap_stream)) { - LOG_DBG("Cannot stop param->streams[%zu]", i); - - return false; - } - for (size_t j = 0U; j < i; j++) { if (param->streams[j] == cap_stream) { LOG_DBG("param->stream_params[%zu] (%p) is " @@ -1676,8 +1731,9 @@ static bool valid_unicast_audio_stop_param(const struct bt_cap_unicast_audio_sto int bt_cap_initiator_unicast_audio_stop(const struct bt_cap_unicast_audio_stop_param *param) { struct bt_cap_common_proc *active_proc = bt_cap_common_get_active_proc(); - struct bt_cap_initiator_proc_param *proc_param; - struct bt_bap_stream *bap_stream; + bool can_release = false; + bool can_disable = false; + bool can_stop = false; int err; if (bt_cap_common_proc_is_active()) { @@ -1692,34 +1748,259 @@ int bt_cap_initiator_unicast_audio_stop(const struct bt_cap_unicast_audio_stop_p for (size_t i = 0U; i < param->count; i++) { struct bt_cap_stream *cap_stream = param->streams[i]; + struct bt_bap_stream *bap_stream = &cap_stream->bap_stream; + + /* Ensure that ops are registered before any procedures are started */ + bt_cap_stream_ops_register_bap(cap_stream); active_proc->proc_param.initiator[i].stream = cap_stream; - } + active_proc->proc_param.initiator[i].stop.release = param->release; - bt_cap_common_start_proc(BT_CAP_COMMON_PROC_TYPE_STOP, param->count); + if (!can_disable && can_disable_stream(bap_stream)) { + can_disable = true; + } - bt_cap_common_set_subproc(BT_CAP_COMMON_SUBPROC_TYPE_RELEASE); + if (!can_stop && can_stop_stream(bap_stream)) { + can_stop = true; + } + if (!can_release && param->release && can_release_stream(bap_stream)) { + can_release = true; + } + } + + if (!can_disable && !can_stop && !can_release) { + LOG_DBG("Cannot %s any streams", !can_disable ? "disable" + : !can_stop ? "stop" + : "release"); + return -EALREADY; + } + + bt_cap_common_start_proc(BT_CAP_COMMON_PROC_TYPE_STOP, param->count); /** TODO: If this is a CSIP set, then the order of the procedures may * not match the order in the parameters, and the CSIP ordered access * procedure should be used. */ - proc_param = get_next_proc_param(active_proc); - __ASSERT(proc_param != NULL, "proc is not done, but could not get next proc_param"); - bap_stream = &proc_param->stream->bap_stream; - active_proc->proc_initiated_cnt++; + if (can_disable) { + struct bt_cap_initiator_proc_param *proc_param; + struct bt_bap_stream *bap_stream; - err = bt_bap_stream_release(bap_stream); - if (err != 0) { - LOG_DBG("Failed to stop bap_stream %p: %d", proc_param->stream, err); + bt_cap_common_set_subproc(BT_CAP_COMMON_SUBPROC_TYPE_DISABLE); - bt_cap_common_clear_active_proc(); + proc_param = get_next_proc_param(active_proc); + __ASSERT(proc_param != NULL, + "proc is not started, but could not get next proc_param"); + bap_stream = &proc_param->stream->bap_stream; + active_proc->proc_initiated_cnt++; + + err = bt_bap_stream_disable(bap_stream); + if (err != 0) { + LOG_DBG("Failed to disable bap_stream %p: %d", proc_param->stream, err); + + bt_cap_common_clear_active_proc(); + } + } else if (can_stop) { + struct bt_cap_initiator_proc_param *proc_param; + struct bt_bap_stream *bap_stream; + + bt_cap_common_set_subproc(BT_CAP_COMMON_SUBPROC_TYPE_STOP); + + proc_param = get_next_proc_param(active_proc); + __ASSERT(proc_param != NULL, + "proc is not started, but could not get next proc_param"); + bap_stream = &proc_param->stream->bap_stream; + active_proc->proc_initiated_cnt++; + + err = bt_bap_stream_stop(bap_stream); + if (err != 0) { + LOG_DBG("Failed to stop bap_stream %p: %d", proc_param->stream, err); + + bt_cap_common_clear_active_proc(); + } + } else { + struct bt_cap_initiator_proc_param *proc_param; + struct bt_bap_stream *bap_stream; + + bt_cap_common_set_subproc(BT_CAP_COMMON_SUBPROC_TYPE_RELEASE); + + proc_param = get_next_proc_param(active_proc); + __ASSERT(proc_param != NULL, + "proc is not started, but could not get next proc_param"); + bap_stream = &proc_param->stream->bap_stream; + active_proc->proc_initiated_cnt++; + + err = bt_bap_stream_release(bap_stream); + if (err != 0) { + LOG_DBG("Failed to release bap_stream %p: %d", proc_param->stream, err); + + bt_cap_common_clear_active_proc(); + } } return err; } +void bt_cap_initiator_disabled(struct bt_cap_stream *cap_stream) +{ + struct bt_cap_common_proc *active_proc = bt_cap_common_get_active_proc(); + + if (!bt_cap_common_stream_in_active_proc(cap_stream)) { + /* State change happened outside of a procedure; ignore */ + return; + } + + if (!bt_cap_common_subproc_is_type(BT_CAP_COMMON_SUBPROC_TYPE_DISABLE)) { + /* Unexpected callback - Abort */ + bt_cap_common_abort_proc(cap_stream->bap_stream.conn, -EBADMSG); + } else { + update_proc_done_cnt(active_proc); + + LOG_DBG("Stream %p disabled (%zu/%zu streams done)", cap_stream, + active_proc->proc_done_cnt, active_proc->proc_cnt); + } + + if (bt_cap_common_proc_is_aborted()) { + if (bt_cap_common_proc_all_handled()) { + cap_initiator_unicast_audio_proc_complete(); + } + + return; + } + + if (!bt_cap_common_proc_is_done()) { + struct bt_cap_initiator_proc_param *proc_param; + struct bt_cap_stream *next_cap_stream; + struct bt_bap_stream *next_bap_stream; + int err; + + proc_param = get_next_proc_param(active_proc); + __ASSERT(proc_param != NULL, "proc is not done, but could not get next proc_param"); + next_cap_stream = proc_param->stream; + next_bap_stream = &next_cap_stream->bap_stream; + active_proc->proc_initiated_cnt++; + + err = bt_bap_stream_disable(next_bap_stream); + if (err != 0) { + LOG_DBG("Failed to disable stream %p: %d", next_cap_stream, err); + + bt_cap_common_abort_proc(next_bap_stream->conn, err); + cap_initiator_unicast_audio_proc_complete(); + } + } else { + struct bt_cap_initiator_proc_param *proc_param; + struct bt_cap_stream *next_cap_stream; + struct bt_bap_stream *next_bap_stream; + int err; + + bt_cap_common_set_subproc(BT_CAP_COMMON_SUBPROC_TYPE_STOP); + + proc_param = get_next_proc_param(active_proc); + if (proc_param == NULL) { + /* If proc_param is NULL then this step is a no-op and we can skip to the + * next step + */ + bt_cap_initiator_stopped(active_proc->proc_param.initiator[0].stream); + + return; + } + + next_cap_stream = proc_param->stream; + next_bap_stream = &next_cap_stream->bap_stream; + active_proc->proc_initiated_cnt++; + + err = bt_bap_stream_stop(next_bap_stream); + if (err != 0) { + LOG_DBG("Failed to stop stream %p: %d", next_cap_stream, err); + + bt_cap_common_abort_proc(next_bap_stream->conn, err); + cap_initiator_unicast_audio_proc_complete(); + } + } +} + +void bt_cap_initiator_stopped(struct bt_cap_stream *cap_stream) +{ + struct bt_cap_common_proc *active_proc = bt_cap_common_get_active_proc(); + + if (!bt_cap_common_stream_in_active_proc(cap_stream)) { + /* State change happened outside of a procedure; ignore */ + return; + } + + if (!bt_cap_common_proc_is_type(BT_CAP_COMMON_PROC_TYPE_STOP)) { + /* Unexpected callback - Abort */ + bt_cap_common_abort_proc(cap_stream->bap_stream.conn, -EBADMSG); + } else { + if (bt_cap_common_subproc_is_type(BT_CAP_COMMON_SUBPROC_TYPE_STOP)) { + update_proc_done_cnt(active_proc); + + LOG_DBG("Stream %p stopped (%zu/%zu streams done)", cap_stream, + active_proc->proc_done_cnt, active_proc->proc_cnt); + } else { + /* We are still doing disable - Wait for those to be done, as stopped may + * also be called when we are disabling sink ASEs + */ + return; + } + } + + if (bt_cap_common_proc_is_aborted()) { + if (bt_cap_common_proc_all_handled()) { + cap_initiator_unicast_audio_proc_complete(); + } + + return; + } + + if (!bt_cap_common_proc_is_done()) { + struct bt_cap_initiator_proc_param *proc_param; + struct bt_cap_stream *next_cap_stream; + struct bt_bap_stream *next_bap_stream; + int err; + + proc_param = get_next_proc_param(active_proc); + __ASSERT(proc_param != NULL, "proc is not done, but could not get next proc_param"); + next_cap_stream = proc_param->stream; + next_bap_stream = &next_cap_stream->bap_stream; + + active_proc->proc_initiated_cnt++; + + err = bt_bap_stream_stop(next_bap_stream); + if (err != 0) { + LOG_DBG("Failed to stop stream %p: %d", next_cap_stream, err); + + bt_cap_common_abort_proc(next_bap_stream->conn, err); + cap_initiator_unicast_audio_proc_complete(); + } + } else { + /* We are done stopping streams now - We mark the next subproc. If + * get_next_proc_param returns a NULL value it means that we are complete done. If + * it returns a non-NULL value, it means that we need to start releasing streams. + * However, since the QoS Configured state is better suited to trigger this, we + * simply wait until bt_cap_initiator_qos_configured is called. + */ + struct bt_cap_initiator_proc_param *proc_param; + + if (!bt_cap_common_proc_is_done()) { + /* We are still disabling or stopping some */ + return; + } + + bt_cap_common_set_subproc(BT_CAP_COMMON_SUBPROC_TYPE_RELEASE); + + proc_param = get_next_proc_param(active_proc); + if (proc_param == NULL) { + /* If proc_param is NULL then this step is a no-op and we can finish the + * procedure + */ + cap_initiator_unicast_audio_proc_complete(); + + return; + } /* wait for bt_cap_initiator_qos_configured */ + } +} + void bt_cap_initiator_released(struct bt_cap_stream *cap_stream) { struct bt_cap_common_proc *active_proc = bt_cap_common_get_active_proc(); @@ -1748,23 +2029,22 @@ void bt_cap_initiator_released(struct bt_cap_stream *cap_stream) } if (!bt_cap_common_proc_is_done()) { - struct bt_cap_stream *next_cap_stream = - active_proc->proc_param.initiator[active_proc->proc_done_cnt].stream; - struct bt_bap_stream *bap_stream = &next_cap_stream->bap_stream; + struct bt_cap_initiator_proc_param *proc_param; + struct bt_cap_stream *next_cap_stream; + struct bt_bap_stream *next_bap_stream; int err; + proc_param = get_next_proc_param(active_proc); + __ASSERT(proc_param != NULL, "proc is not done, but could not get next proc_param"); + next_cap_stream = proc_param->stream; + next_bap_stream = &next_cap_stream->bap_stream; active_proc->proc_initiated_cnt++; - /* Since BAP operations may require a write long or a read long on the - * notification, we cannot assume that we can do multiple streams at once, - * thus do it one at a time. - * TODO: We should always be able to do one per ACL, so there is room for - * optimization. - */ - err = bt_bap_stream_release(bap_stream); + + err = bt_bap_stream_release(next_bap_stream); if (err != 0) { LOG_DBG("Failed to release stream %p: %d", next_cap_stream, err); - bt_cap_common_abort_proc(bap_stream->conn, err); + bt_cap_common_abort_proc(next_bap_stream->conn, err); cap_initiator_unicast_audio_proc_complete(); } } else { diff --git a/subsys/bluetooth/audio/cap_internal.h b/subsys/bluetooth/audio/cap_internal.h index 839d4a31757a3..3543b35c3876e 100644 --- a/subsys/bluetooth/audio/cap_internal.h +++ b/subsys/bluetooth/audio/cap_internal.h @@ -30,6 +30,8 @@ void bt_cap_initiator_enabled(struct bt_cap_stream *cap_stream); void bt_cap_initiator_started(struct bt_cap_stream *cap_stream); void bt_cap_initiator_connected(struct bt_cap_stream *cap_stream); void bt_cap_initiator_metadata_updated(struct bt_cap_stream *cap_stream); +void bt_cap_initiator_disabled(struct bt_cap_stream *cap_stream); +void bt_cap_initiator_stopped(struct bt_cap_stream *cap_stream); void bt_cap_initiator_released(struct bt_cap_stream *cap_stream); void bt_cap_stream_ops_register_bap(struct bt_cap_stream *cap_stream); @@ -61,6 +63,8 @@ enum bt_cap_common_subproc_type { BT_CAP_COMMON_SUBPROC_TYPE_CONNECT, BT_CAP_COMMON_SUBPROC_TYPE_START, BT_CAP_COMMON_SUBPROC_TYPE_META_UPDATE, + BT_CAP_COMMON_SUBPROC_TYPE_DISABLE, + BT_CAP_COMMON_SUBPROC_TYPE_STOP, BT_CAP_COMMON_SUBPROC_TYPE_RELEASE, }; @@ -79,6 +83,9 @@ struct bt_cap_initiator_proc_param { /** Codec Specific Capabilities Metadata */ uint8_t meta[CONFIG_BT_AUDIO_CODEC_CFG_MAX_METADATA_SIZE]; } meta_update; + struct { + bool release; + } stop; }; }; @@ -173,6 +180,7 @@ struct bt_cap_common_proc *bt_cap_common_get_active_proc(void); void bt_cap_common_clear_active_proc(void); void bt_cap_common_start_proc(enum bt_cap_common_proc_type proc_type, size_t proc_cnt); void bt_cap_common_set_subproc(enum bt_cap_common_subproc_type subproc_type); +bool bt_cap_common_proc_is_type(enum bt_cap_common_proc_type proc_type); bool bt_cap_common_subproc_is_type(enum bt_cap_common_subproc_type subproc_type); struct bt_conn *bt_cap_common_get_member_conn(enum bt_cap_set_type type, const union bt_cap_set_member *member); diff --git a/subsys/bluetooth/audio/cap_stream.c b/subsys/bluetooth/audio/cap_stream.c index e1ee733a44812..bbc645daa3e9d 100644 --- a/subsys/bluetooth/audio/cap_stream.c +++ b/subsys/bluetooth/audio/cap_stream.c @@ -132,6 +132,11 @@ static void cap_stream_disabled_cb(struct bt_bap_stream *bap_stream) LOG_DBG("%p", cap_stream); + if (IS_ENABLED(CONFIG_BT_CAP_INITIATOR) && IS_ENABLED(CONFIG_BT_BAP_UNICAST_CLIENT) && + stream_is_central(bap_stream)) { + bt_cap_initiator_disabled(cap_stream); + } + if (ops != NULL && ops->disabled != NULL) { ops->disabled(bap_stream); } @@ -188,6 +193,11 @@ static void cap_stream_stopped_cb(struct bt_bap_stream *bap_stream, uint8_t reas LOG_DBG("%p", cap_stream); + if (IS_ENABLED(CONFIG_BT_CAP_INITIATOR) && IS_ENABLED(CONFIG_BT_BAP_UNICAST_CLIENT) && + stream_is_central(bap_stream)) { + bt_cap_initiator_stopped(cap_stream); + } + if (ops != NULL && ops->stopped != NULL) { ops->stopped(bap_stream, reason); } diff --git a/subsys/bluetooth/audio/shell/cap_initiator.c b/subsys/bluetooth/audio/shell/cap_initiator.c index d2e6bf2127e3d..6809d870de06c 100644 --- a/subsys/bluetooth/audio/shell/cap_initiator.c +++ b/subsys/bluetooth/audio/shell/cap_initiator.c @@ -532,6 +532,7 @@ static int cmd_cap_initiator_unicast_stop(const struct shell *sh, size_t argc, param.streams = streams; param.type = BT_CAP_SET_TYPE_AD_HOC; + param.release = true; err = bt_cap_initiator_unicast_audio_stop(¶m); if (err != 0) { diff --git a/tests/bluetooth/audio/cap_initiator/CMakeLists.txt b/tests/bluetooth/audio/cap_initiator/CMakeLists.txt index 2c7096e8c3249..8502038e975dd 100644 --- a/tests/bluetooth/audio/cap_initiator/CMakeLists.txt +++ b/tests/bluetooth/audio/cap_initiator/CMakeLists.txt @@ -17,4 +17,5 @@ target_sources(testbinary src/main.c src/test_common.c src/test_unicast_start.c + src/test_unicast_stop.c ) diff --git a/tests/bluetooth/audio/cap_initiator/prj.conf b/tests/bluetooth/audio/cap_initiator/prj.conf index b4a1d54026a4b..33283b79045a1 100644 --- a/tests/bluetooth/audio/cap_initiator/prj.conf +++ b/tests/bluetooth/audio/cap_initiator/prj.conf @@ -24,3 +24,5 @@ CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT=2 CONFIG_ASSERT=y CONFIG_ASSERT_LEVEL=2 CONFIG_ASSERT_VERBOSE=y + +CONFIG_BT_BAP_STREAM_LOG_LEVEL_DBG=y diff --git a/tests/bluetooth/audio/cap_initiator/src/main.c b/tests/bluetooth/audio/cap_initiator/src/main.c index 54b78f0efe2a2..a15c1fc1c1f04 100644 --- a/tests/bluetooth/audio/cap_initiator/src/main.c +++ b/tests/bluetooth/audio/cap_initiator/src/main.c @@ -24,8 +24,6 @@ #include "ztest_assert.h" #include "ztest_test.h" -DEFINE_FFF_GLOBALS; - static void mock_init_rule_before(const struct ztest_unit_test *test, void *fixture) { test_mocks_init(); diff --git a/tests/bluetooth/audio/cap_initiator/src/test_common.c b/tests/bluetooth/audio/cap_initiator/src/test_common.c index dbb0c8a9470c1..fc8d2b10ae213 100644 --- a/tests/bluetooth/audio/cap_initiator/src/test_common.c +++ b/tests/bluetooth/audio/cap_initiator/src/test_common.c @@ -18,6 +18,8 @@ #include "test_common.h" #include "ztest_assert.h" +DEFINE_FFF_GLOBALS; + void test_mocks_init(void) { mock_cap_initiator_init(); diff --git a/tests/bluetooth/audio/cap_initiator/src/test_unicast_start.c b/tests/bluetooth/audio/cap_initiator/src/test_unicast_start.c index 7ff7f2472ffc9..27eb47739269e 100644 --- a/tests/bluetooth/audio/cap_initiator/src/test_unicast_start.c +++ b/tests/bluetooth/audio/cap_initiator/src/test_unicast_start.c @@ -30,8 +30,6 @@ #include "ztest_assert.h" #include "ztest_test.h" -#define FFF_GLOBALS - struct cap_initiator_test_unicast_start_fixture { struct bt_cap_stream cap_streams[CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT]; struct bt_bap_ep eps[CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT]; diff --git a/tests/bluetooth/audio/cap_initiator/src/test_unicast_stop.c b/tests/bluetooth/audio/cap_initiator/src/test_unicast_stop.c new file mode 100644 index 0000000000000..50175f588d06c --- /dev/null +++ b/tests/bluetooth/audio/cap_initiator/src/test_unicast_stop.c @@ -0,0 +1,482 @@ +/* test_unicast_stop.c - unit test for unicast stop procedure */ + +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "bap_endpoint.h" +#include "cap_initiator.h" +#include "conn.h" +#include "expects_util.h" +#include "test_common.h" +#include "ztest_assert.h" +#include "ztest_test.h" + +struct cap_initiator_test_unicast_stop_fixture { + struct bt_cap_stream cap_streams[CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT]; + struct bt_bap_ep eps[CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT]; + struct bt_bap_unicast_group unicast_group; + struct bt_conn conns[CONFIG_BT_MAX_CONN]; + struct bt_bap_lc3_preset preset; +}; + +static void cap_initiator_test_unicast_stop_fixture_init( + struct cap_initiator_test_unicast_stop_fixture *fixture) +{ + fixture->preset = (struct bt_bap_lc3_preset)BT_BAP_LC3_UNICAST_PRESET_16_2_1( + BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED); + + for (size_t i = 0U; i < ARRAY_SIZE(fixture->conns); i++) { + test_conn_init(&fixture->conns[i]); + } + + for (size_t i = 0U; i < ARRAY_SIZE(fixture->eps); i++) { + fixture->eps[i].dir = (i & 1) + 1; /* Makes it either 1 or 2 (sink or source)*/ + } + + for (size_t i = 0U; i < ARRAY_SIZE(fixture->cap_streams); i++) { + struct bt_cap_stream *cap_stream = &fixture->cap_streams[i]; + struct bt_bap_stream *bap_stream = &cap_stream->bap_stream; + + sys_slist_append(&fixture->unicast_group.streams, &bap_stream->_node); + bap_stream->group = &fixture->unicast_group; + } +} + +static void *cap_initiator_test_unicast_stop_setup(void) +{ + struct cap_initiator_test_unicast_stop_fixture *fixture; + + fixture = malloc(sizeof(*fixture)); + zassert_not_null(fixture); + + return fixture; +} + +static void cap_initiator_test_unicast_stop_before(void *f) +{ + int err; + + memset(f, 0, sizeof(struct cap_initiator_test_unicast_stop_fixture)); + cap_initiator_test_unicast_stop_fixture_init(f); + + err = bt_cap_initiator_register_cb(&mock_cap_initiator_cb); + zassert_equal(0, err, "Unexpected return value %d", err); +} + +static void cap_initiator_test_unicast_stop_after(void *f) +{ + struct cap_initiator_test_unicast_stop_fixture *fixture = f; + + bt_cap_initiator_unregister_cb(&mock_cap_initiator_cb); + + for (size_t i = 0; i < ARRAY_SIZE(fixture->conns); i++) { + mock_bt_conn_disconnected(&fixture->conns[i], BT_HCI_ERR_REMOTE_USER_TERM_CONN); + } + + /* In the case of a test failing, we cancel the procedure so that subsequent won't fail */ + bt_cap_initiator_unicast_audio_cancel(); +} + +static void cap_initiator_test_unicast_stop_teardown(void *f) +{ + free(f); +} + +ZTEST_SUITE(cap_initiator_test_unicast_stop, NULL, cap_initiator_test_unicast_stop_setup, + cap_initiator_test_unicast_stop_before, cap_initiator_test_unicast_stop_after, + cap_initiator_test_unicast_stop_teardown); + +static ZTEST_F(cap_initiator_test_unicast_stop, + test_initiator_unicast_stop_disable_state_codec_configured) +{ + struct bt_cap_stream *streams[CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT] = {0}; + const struct bt_cap_unicast_audio_stop_param param = { + .type = BT_CAP_SET_TYPE_AD_HOC, + .count = ARRAY_SIZE(streams), + .streams = streams, + .release = false, + }; + int err; + + for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) { + streams[i] = &fixture->cap_streams[i]; + + test_unicast_set_state(streams[i], &fixture->conns[i % ARRAY_SIZE(fixture->conns)], + &fixture->eps[i], &fixture->preset, + BT_BAP_EP_STATE_CODEC_CONFIGURED); + } + + err = bt_cap_initiator_unicast_audio_stop(¶m); + zassert_equal(err, -EALREADY, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_initiator_cb.unicast_stop_complete_cb", 0, + mock_cap_initiator_unicast_stop_complete_cb_fake.call_count); + + for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) { + const struct bt_bap_stream *bap_stream = &fixture->cap_streams[i].bap_stream; + const enum bt_bap_ep_state state = bap_stream->ep->status.state; + + zassert_equal(state, BT_BAP_EP_STATE_CODEC_CONFIGURED, + "[%zu]: Stream %p unexpected state: %d", i, bap_stream, state); + } +} + +static ZTEST_F(cap_initiator_test_unicast_stop, + test_initiator_unicast_stop_disable_state_qos_configured) +{ + struct bt_cap_stream *streams[CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT] = {0}; + const struct bt_cap_unicast_audio_stop_param param = { + .type = BT_CAP_SET_TYPE_AD_HOC, + .count = ARRAY_SIZE(streams), + .streams = streams, + .release = false, + }; + int err; + + for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) { + streams[i] = &fixture->cap_streams[i]; + + test_unicast_set_state(streams[i], &fixture->conns[i % ARRAY_SIZE(fixture->conns)], + &fixture->eps[i], &fixture->preset, + BT_BAP_EP_STATE_QOS_CONFIGURED); + } + + err = bt_cap_initiator_unicast_audio_stop(¶m); + zassert_equal(err, -EALREADY, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_initiator_cb.unicast_stop_complete_cb", 0, + mock_cap_initiator_unicast_stop_complete_cb_fake.call_count); + + for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) { + const struct bt_bap_stream *bap_stream = &fixture->cap_streams[i].bap_stream; + const enum bt_bap_ep_state state = bap_stream->ep->status.state; + + zassert_equal(state, BT_BAP_EP_STATE_QOS_CONFIGURED, + "[%zu]: Stream %p unexpected state: %d", i, bap_stream, state); + } +} + +static ZTEST_F(cap_initiator_test_unicast_stop, test_initiator_unicast_stop_disable_state_enabling) +{ + struct bt_cap_stream *streams[CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT] = {0}; + const struct bt_cap_unicast_audio_stop_param param = { + .type = BT_CAP_SET_TYPE_AD_HOC, + .count = ARRAY_SIZE(streams), + .streams = streams, + .release = false, + }; + int err; + + for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) { + streams[i] = &fixture->cap_streams[i]; + + test_unicast_set_state(streams[i], &fixture->conns[i % ARRAY_SIZE(fixture->conns)], + &fixture->eps[i], &fixture->preset, + BT_BAP_EP_STATE_ENABLING); + } + + err = bt_cap_initiator_unicast_audio_stop(¶m); + zassert_equal(err, 0, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_initiator_cb.unicast_stop_complete_cb", 1, + mock_cap_initiator_unicast_stop_complete_cb_fake.call_count); + + for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) { + const struct bt_bap_stream *bap_stream = &fixture->cap_streams[i].bap_stream; + const enum bt_bap_ep_state state = bap_stream->ep->status.state; + + zassert_equal(state, BT_BAP_EP_STATE_QOS_CONFIGURED, + "[%zu]: Stream %p unexpected state: %d", i, bap_stream, state); + } +} + +static ZTEST_F(cap_initiator_test_unicast_stop, test_initiator_unicast_stop_disable_state_streaming) +{ + struct bt_cap_stream *streams[CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT] = {0}; + const struct bt_cap_unicast_audio_stop_param param = { + .type = BT_CAP_SET_TYPE_AD_HOC, + .count = ARRAY_SIZE(streams), + .streams = streams, + .release = false, + }; + int err; + + for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) { + streams[i] = &fixture->cap_streams[i]; + + test_unicast_set_state(streams[i], &fixture->conns[i % ARRAY_SIZE(fixture->conns)], + &fixture->eps[i], &fixture->preset, + BT_BAP_EP_STATE_STREAMING); + } + + err = bt_cap_initiator_unicast_audio_stop(¶m); + zassert_equal(err, 0, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_initiator_cb.unicast_stop_complete_cb", 1, + mock_cap_initiator_unicast_stop_complete_cb_fake.call_count); + + for (size_t i = 0U; i < ARRAY_SIZE(fixture->cap_streams); i++) { + const struct bt_bap_stream *bap_stream = &fixture->cap_streams[i].bap_stream; + const enum bt_bap_ep_state state = bap_stream->ep->status.state; + + zassert_equal(state, BT_BAP_EP_STATE_QOS_CONFIGURED, + "[%zu]: Stream %p unexpected state: %d", i, bap_stream, state); + } +} + +static ZTEST_F(cap_initiator_test_unicast_stop, + test_initiator_unicast_stop_release_state_codec_configured) +{ + struct bt_cap_stream *streams[CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT] = {0}; + const struct bt_cap_unicast_audio_stop_param param = { + .type = BT_CAP_SET_TYPE_AD_HOC, + .count = ARRAY_SIZE(streams), + .streams = streams, + .release = true, + }; + int err; + + for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) { + streams[i] = &fixture->cap_streams[i]; + + test_unicast_set_state(streams[i], &fixture->conns[i % ARRAY_SIZE(fixture->conns)], + &fixture->eps[i], &fixture->preset, + BT_BAP_EP_STATE_CODEC_CONFIGURED); + } + + err = bt_cap_initiator_unicast_audio_stop(¶m); + zassert_equal(err, -EALREADY, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_initiator_cb.unicast_stop_complete_cb", 0, + mock_cap_initiator_unicast_stop_complete_cb_fake.call_count); + + for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) { + const struct bt_bap_stream *bap_stream = &fixture->cap_streams[i].bap_stream; + const enum bt_bap_ep_state state = bap_stream->ep->status.state; + + zassert_equal(state, BT_BAP_EP_STATE_CODEC_CONFIGURED, + "[%zu]: Stream %p unexpected state: %d", i, bap_stream, state); + } +} + +static ZTEST_F(cap_initiator_test_unicast_stop, + test_initiator_unicast_stop_release_state_qos_configured) +{ + struct bt_cap_stream *streams[CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT] = {0}; + const struct bt_cap_unicast_audio_stop_param param = { + .type = BT_CAP_SET_TYPE_AD_HOC, + .count = ARRAY_SIZE(streams), + .streams = streams, + .release = true, + }; + int err; + + for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) { + streams[i] = &fixture->cap_streams[i]; + + test_unicast_set_state(streams[i], &fixture->conns[i % ARRAY_SIZE(fixture->conns)], + &fixture->eps[i], &fixture->preset, + BT_BAP_EP_STATE_QOS_CONFIGURED); + } + + err = bt_cap_initiator_unicast_audio_stop(¶m); + zassert_equal(err, 0, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_initiator_cb.unicast_stop_complete_cb", 1, + mock_cap_initiator_unicast_stop_complete_cb_fake.call_count); + + for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) { + const struct bt_bap_stream *bap_stream = &fixture->cap_streams[i].bap_stream; + const enum bt_bap_ep_state state = fixture->eps[i].status.state; + + zassert_equal(state, BT_BAP_EP_STATE_IDLE, "[%zu]: Stream %p unexpected state: %d", + i, bap_stream, state); + } +} + +static ZTEST_F(cap_initiator_test_unicast_stop, test_initiator_unicast_stop_release_state_enabling) +{ + struct bt_cap_stream *streams[CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT] = {0}; + const struct bt_cap_unicast_audio_stop_param param = { + .type = BT_CAP_SET_TYPE_AD_HOC, + .count = ARRAY_SIZE(streams), + .streams = streams, + .release = true, + }; + int err; + + for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) { + streams[i] = &fixture->cap_streams[i]; + + test_unicast_set_state(streams[i], &fixture->conns[i % ARRAY_SIZE(fixture->conns)], + &fixture->eps[i], &fixture->preset, + BT_BAP_EP_STATE_ENABLING); + } + + err = bt_cap_initiator_unicast_audio_stop(¶m); + zassert_equal(err, 0, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_initiator_cb.unicast_stop_complete_cb", 1, + mock_cap_initiator_unicast_stop_complete_cb_fake.call_count); + + for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) { + const struct bt_bap_stream *bap_stream = &fixture->cap_streams[i].bap_stream; + const enum bt_bap_ep_state state = fixture->eps[i].status.state; + + zassert_equal(state, BT_BAP_EP_STATE_IDLE, "[%zu]: Stream %p unexpected state: %d", + i, bap_stream, state); + } +} + +static ZTEST_F(cap_initiator_test_unicast_stop, test_initiator_unicast_stop_release_state_streaming) +{ + struct bt_cap_stream *streams[CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT] = {0}; + const struct bt_cap_unicast_audio_stop_param param = { + .type = BT_CAP_SET_TYPE_AD_HOC, + .count = ARRAY_SIZE(streams), + .streams = streams, + .release = true, + }; + int err; + + for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) { + streams[i] = &fixture->cap_streams[i]; + + test_unicast_set_state(streams[i], &fixture->conns[i % ARRAY_SIZE(fixture->conns)], + &fixture->eps[i], &fixture->preset, + BT_BAP_EP_STATE_ENABLING); + } + + err = bt_cap_initiator_unicast_audio_stop(¶m); + zassert_equal(err, 0, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_initiator_cb.unicast_stop_complete_cb", 1, + mock_cap_initiator_unicast_stop_complete_cb_fake.call_count); + + for (size_t i = 0U; i < ARRAY_SIZE(fixture->cap_streams); i++) { + const struct bt_bap_stream *bap_stream = &fixture->cap_streams[i].bap_stream; + const enum bt_bap_ep_state state = fixture->eps[i].status.state; + + zassert_equal(state, BT_BAP_EP_STATE_IDLE, "[%zu]: Stream %p unexpected state: %d", + i, bap_stream, state); + } +} + +static ZTEST_F(cap_initiator_test_unicast_stop, test_initiator_unicast_stop_inval_param_null) +{ + int err; + + err = bt_cap_initiator_unicast_audio_stop(NULL); + zassert_equal(err, -EINVAL, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_initiator_cb.unicast_stop_complete_cb", 0, + mock_cap_initiator_unicast_stop_complete_cb_fake.call_count); +} + +static ZTEST_F(cap_initiator_test_unicast_stop, + test_initiator_unicast_stop_inval_param_null_streams) +{ + const struct bt_cap_unicast_audio_stop_param param = { + .type = BT_CAP_SET_TYPE_AD_HOC, + .count = CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT, + .streams = NULL, + .release = true, + }; + int err; + + err = bt_cap_initiator_unicast_audio_stop(¶m); + zassert_equal(err, -EINVAL, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_initiator_cb.unicast_stop_complete_cb", 0, + mock_cap_initiator_unicast_stop_complete_cb_fake.call_count); +} + +static ZTEST_F(cap_initiator_test_unicast_stop, test_initiator_unicast_stop_inval_missing_cas) +{ + struct bt_cap_stream *streams[CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT] = {0}; + const struct bt_cap_unicast_audio_stop_param param = { + .type = BT_CAP_SET_TYPE_CSIP, /* CSIP requires CAS */ + .count = ARRAY_SIZE(streams), + .streams = streams, + .release = true, + }; + int err; + + for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) { + streams[i] = &fixture->cap_streams[i]; + + test_unicast_set_state(streams[i], &fixture->conns[i % ARRAY_SIZE(fixture->conns)], + &fixture->eps[i], &fixture->preset, + BT_BAP_EP_STATE_STREAMING); + } + + err = bt_cap_initiator_unicast_audio_stop(¶m); + zassert_equal(err, -EINVAL, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_initiator_cb.unicast_stop_complete_cb", 0, + mock_cap_initiator_unicast_stop_complete_cb_fake.call_count); +} + +static ZTEST_F(cap_initiator_test_unicast_stop, test_initiator_unicast_stop_inval_param_zero_count) +{ + struct bt_cap_stream *streams[CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT] = {0}; + const struct bt_cap_unicast_audio_stop_param param = { + .type = BT_CAP_SET_TYPE_AD_HOC, + .count = 0U, + .streams = streams, + .release = true, + }; + int err; + + for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) { + streams[i] = &fixture->cap_streams[i]; + } + + err = bt_cap_initiator_unicast_audio_stop(¶m); + zassert_equal(err, -EINVAL, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_initiator_cb.unicast_stop_complete_cb", 0, + mock_cap_initiator_unicast_stop_complete_cb_fake.call_count); +} + +static ZTEST_F(cap_initiator_test_unicast_stop, test_initiator_unicast_stop_inval_param_inval_count) +{ + struct bt_cap_stream *streams[CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT] = {0}; + const struct bt_cap_unicast_audio_stop_param param = { + .type = BT_CAP_SET_TYPE_AD_HOC, + .count = CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT + 1U, + .streams = streams, + .release = true, + }; + int err; + + for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) { + streams[i] = &fixture->cap_streams[i]; + } + + err = bt_cap_initiator_unicast_audio_stop(¶m); + zassert_equal(err, -EINVAL, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_initiator_cb.unicast_stop_complete_cb", 0, + mock_cap_initiator_unicast_stop_complete_cb_fake.call_count); +} diff --git a/tests/bluetooth/audio/cap_initiator/uut/bap_unicast_client.c b/tests/bluetooth/audio/cap_initiator/uut/bap_unicast_client.c index 52feeeb15d345..387aeaf41ba32 100644 --- a/tests/bluetooth/audio/cap_initiator/uut/bap_unicast_client.c +++ b/tests/bluetooth/audio/cap_initiator/uut/bap_unicast_client.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -149,7 +150,6 @@ int bt_bap_unicast_client_connect(struct bt_bap_stream *stream) if (stream->ep != NULL && stream->ep->dir == BT_AUDIO_DIR_SINK) { /* Mocking that the unicast server automatically starts the stream */ stream->ep->status.state = BT_BAP_EP_STATE_STREAMING; - printk("A %s %p\n", __func__, stream); if (stream->ops != NULL && stream->ops->started != NULL) { stream->ops->started(stream); @@ -184,18 +184,105 @@ int bt_bap_unicast_client_start(struct bt_bap_stream *stream) int bt_bap_unicast_client_disable(struct bt_bap_stream *stream) { - zassert_unreachable("Unexpected call to '%s()' occurred", __func__); + printk("%s %p %d\n", __func__, stream, stream->ep->dir); + + if (stream == NULL || stream->ep == NULL) { + return -EINVAL; + } + + switch (stream->ep->status.state) { + case BT_BAP_EP_STATE_ENABLING: + case BT_BAP_EP_STATE_STREAMING: + break; + default: + return -EINVAL; + } + + /* Even though the ASCS spec does not have the disabling state for sink ASEs, the unicast + * client implementation fakes the behavior of it and always calls the disabled callback + * when leaving the streaming state in a non-release manner + */ + + /* Disabled sink ASEs go directly to the QoS configured state */ + if (stream->ep->dir == BT_AUDIO_DIR_SINK) { + stream->ep->status.state = BT_BAP_EP_STATE_QOS_CONFIGURED; + + if (stream->ops != NULL && stream->ops->disabled != NULL) { + stream->ops->disabled(stream); + } + + if (stream->ops != NULL && stream->ops->stopped != NULL) { + stream->ops->stopped(stream, BT_HCI_ERR_LOCALHOST_TERM_CONN); + } + + if (stream->ops != NULL && stream->ops->qos_set != NULL) { + stream->ops->qos_set(stream); + } + } else if (stream->ep->dir == BT_AUDIO_DIR_SOURCE) { + stream->ep->status.state = BT_BAP_EP_STATE_DISABLING; + + if (stream->ops != NULL && stream->ops->disabled != NULL) { + stream->ops->disabled(stream); + } + } + return 0; } int bt_bap_unicast_client_stop(struct bt_bap_stream *stream) { - zassert_unreachable("Unexpected call to '%s()' occurred", __func__); + printk("%s %p\n", __func__, stream); + + /* As per the ASCS spec, only source streams can be stopped by the client */ + if (stream == NULL || stream->ep == NULL || stream->ep->dir == BT_AUDIO_DIR_SINK) { + return -EINVAL; + } + + switch (stream->ep->status.state) { + case BT_BAP_EP_STATE_DISABLING: + break; + default: + return -EINVAL; + } + + stream->ep->status.state = BT_BAP_EP_STATE_QOS_CONFIGURED; + + if (stream->ops != NULL && stream->ops->stopped != NULL) { + stream->ops->stopped(stream, BT_HCI_ERR_LOCALHOST_TERM_CONN); + } + + if (stream->ops != NULL && stream->ops->qos_set != NULL) { + stream->ops->qos_set(stream); + } + return 0; } int bt_bap_unicast_client_release(struct bt_bap_stream *stream) { - zassert_unreachable("Unexpected call to '%s()' occurred", __func__); + printk("%s %p\n", __func__, stream); + + if (stream == NULL || stream->ep == NULL) { + return -EINVAL; + } + + switch (stream->ep->status.state) { + case BT_BAP_EP_STATE_CODEC_CONFIGURED: + case BT_BAP_EP_STATE_QOS_CONFIGURED: + case BT_BAP_EP_STATE_ENABLING: + case BT_BAP_EP_STATE_STREAMING: + case BT_BAP_EP_STATE_DISABLING: + break; + default: + return -EINVAL; + } + + stream->ep->status.state = BT_BAP_EP_STATE_IDLE; + bt_bap_stream_reset(stream); + + if (stream->ops != NULL && stream->ops->released != NULL) { + stream->ops->released(stream); + } + return 0; } diff --git a/tests/bluetooth/tester/src/audio/btp_cap.c b/tests/bluetooth/tester/src/audio/btp_cap.c index 19986060b948b..b4135f0a510e6 100644 --- a/tests/bluetooth/tester/src/audio/btp_cap.c +++ b/tests/bluetooth/tester/src/audio/btp_cap.c @@ -438,6 +438,7 @@ static uint8_t btp_cap_unicast_audio_stop(const void *cmd, uint16_t cmd_len, param.streams = streams; param.count = stream_cnt; param.type = BT_CAP_SET_TYPE_AD_HOC; + param.release = true; err = bt_cap_initiator_unicast_audio_stop(¶m); if (err != 0) { diff --git a/tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c b/tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c index c6299135a3ca2..eb063eddb1efc 100644 --- a/tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c @@ -682,17 +682,6 @@ static void unicast_audio_update(void) printk("READ LONG META\n"); } -static void unicast_audio_stop_inval(void) -{ - int err; - - err = bt_cap_initiator_unicast_audio_stop(NULL); - if (err == 0) { - FAIL("bt_cap_initiator_unicast_audio_stop with NULL param did not fail\n"); - return; - } -} - static void unicast_audio_stop(struct bt_bap_unicast_group *unicast_group) { struct bt_cap_unicast_audio_stop_param param; @@ -701,8 +690,30 @@ static void unicast_audio_stop(struct bt_bap_unicast_group *unicast_group) param.type = BT_CAP_SET_TYPE_AD_HOC; param.count = non_idle_streams_cnt; param.streams = non_idle_streams; + param.release = false; + + /* Stop without release first to verify that we enter the QoS Configured state */ + UNSET_FLAG(flag_stopped); + + err = bt_cap_initiator_unicast_audio_stop(¶m); + if (err != 0) { + FAIL("Failed to stop unicast audio without release: %d\n", err); + return; + } + + WAIT_FOR_FLAG(flag_stopped); + + /* Verify that it cannot be stopped twice */ + err = bt_cap_initiator_unicast_audio_stop(¶m); + if (err == 0) { + FAIL("bt_cap_initiator_unicast_audio_stop without release with already-stopped " + "streams did not fail\n"); + return; + } + /* Stop with release first to verify that we enter the idle state */ UNSET_FLAG(flag_stopped); + param.release = true; err = bt_cap_initiator_unicast_audio_stop(¶m); if (err != 0) { @@ -820,7 +831,6 @@ static void test_main_cap_initiator_unicast_inval(void) unicast_audio_update_inval(); unicast_audio_update(); - unicast_audio_stop_inval(); unicast_audio_stop(unicast_group); unicast_group_delete_inval(); diff --git a/tests/bsim/bluetooth/audio/src/gmap_ugg_test.c b/tests/bsim/bluetooth/audio/src/gmap_ugg_test.c index 312dfbf5aabff..00b8f5f931b05 100644 --- a/tests/bsim/bluetooth/audio/src/gmap_ugg_test.c +++ b/tests/bsim/bluetooth/audio/src/gmap_ugg_test.c @@ -929,6 +929,7 @@ static void unicast_audio_stop(struct bt_bap_unicast_group *unicast_group) param.type = BT_CAP_SET_TYPE_AD_HOC; param.count = started_unicast_streams_cnt; param.streams = started_unicast_streams; + param.release = true; err = bt_cap_initiator_unicast_audio_stop(¶m); if (err != 0) { From 5d76b563ea971564505cfb425028aa680a4a8670 Mon Sep 17 00:00:00 2001 From: Krzysztof Sychla Date: Mon, 25 Mar 2024 12:57:21 +0100 Subject: [PATCH 0064/4482] arch: Add Cortex-R8 support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable Cortex R8 support, similar to Cortex-R5. Signed-off-by: Krzysztof Sychla Signed-off-by: Marek Slowinski Signed-off-by: Piotr Zierhoffer Signed-off-by: Mateusz Hołenko --- arch/arm/core/cortex_a_r/Kconfig | 8 ++++++++ cmake/gcc-m-cpu.cmake | 9 +++++++++ cmake/gcc-m-fpu.cmake | 2 +- include/zephyr/arch/arm/cortex_a_r/mpu.h | 2 +- modules/cmsis/cmsis_core_a_r.h | 2 ++ .../mcumgr/grp/os_mgmt/include/os_mgmt_processor.h | 10 ++++++++++ 6 files changed, 31 insertions(+), 2 deletions(-) diff --git a/arch/arm/core/cortex_a_r/Kconfig b/arch/arm/core/cortex_a_r/Kconfig index 4095a277c6138..2ee3c945644d0 100644 --- a/arch/arm/core/cortex_a_r/Kconfig +++ b/arch/arm/core/cortex_a_r/Kconfig @@ -93,6 +93,14 @@ config CPU_CORTEX_R7 help This option signifies the use of a Cortex-R7 CPU +config CPU_CORTEX_R8 + bool + select CPU_AARCH32_CORTEX_R + select ARMV7_R + select ARMV7_R_FP if CPU_HAS_FPU + help + This option signifies the use of a Cortex-R8 CPU + config CPU_CORTEX_R52 bool select CPU_AARCH32_CORTEX_R diff --git a/cmake/gcc-m-cpu.cmake b/cmake/gcc-m-cpu.cmake index 8cb777c476994..6f00283b6b8e4 100644 --- a/cmake/gcc-m-cpu.cmake +++ b/cmake/gcc-m-cpu.cmake @@ -68,6 +68,15 @@ if("${ARCH}" STREQUAL "arm") else() set(GCC_M_CPU ${GCC_M_CPU}+nofp) endif() + elseif(CONFIG_CPU_CORTEX_R8) + set(GCC_M_CPU cortex-r8) + if(CONFIG_FPU AND CONFIG_CPU_HAS_VFP) + if(NOT CONFIG_VFP_FEATURE_DOUBLE_PRECISION) + set(GCC_M_CPU ${GCC_M_CPU}+nofp.dp) + endif() + else() + set(GCC_M_CPU ${GCC_M_CPU}+nofp) + endif() elseif(CONFIG_CPU_CORTEX_R52) set(GCC_M_CPU cortex-r52) if(CONFIG_FPU AND CONFIG_CPU_HAS_VFP) diff --git a/cmake/gcc-m-fpu.cmake b/cmake/gcc-m-fpu.cmake index a25cdf05679c8..d1ce9655b46d0 100644 --- a/cmake/gcc-m-fpu.cmake +++ b/cmake/gcc-m-fpu.cmake @@ -7,7 +7,7 @@ if(CONFIG_FPU) if("${ARCH}" STREQUAL "arm") if(CONFIG_CPU_AARCH32_CORTEX_R) - if(CONFIG_CPU_CORTEX_R4 OR CONFIG_CPU_CORTEX_R5) # VFPv3 + if(CONFIG_CPU_CORTEX_R4 OR CONFIG_CPU_CORTEX_R5 OR CONFIG_CPU_CORTEX_R8) # VFPv3 if(CONFIG_VFP_FEATURE_DOUBLE_PRECISION) set(GCC_M_FPU vfpv3-d16) elseif(CONFIG_VFP_FEATURE_SINGLE_PRECISION) diff --git a/include/zephyr/arch/arm/cortex_a_r/mpu.h b/include/zephyr/arch/arm/cortex_a_r/mpu.h index e660247e4aa12..896b73e20a29d 100644 --- a/include/zephyr/arch/arm/cortex_a_r/mpu.h +++ b/include/zephyr/arch/arm/cortex_a_r/mpu.h @@ -32,7 +32,7 @@ #define MPU_RASR_B_Pos 0 #define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) -#if defined(CONFIG_CPU_CORTEX_R4) || defined(CONFIG_CPU_CORTEX_R5) +#if defined(CONFIG_CPU_CORTEX_R4) || defined(CONFIG_CPU_CORTEX_R5) || defined(CONFIG_CPU_CORTEX_R8) #define ARM_MPU_REGION_SIZE_32B ((uint8_t)0x04U) #define ARM_MPU_REGION_SIZE_64B ((uint8_t)0x05U) #define ARM_MPU_REGION_SIZE_128B ((uint8_t)0x06U) diff --git a/modules/cmsis/cmsis_core_a_r.h b/modules/cmsis/cmsis_core_a_r.h index 9f4514edb474e..bef0f60281352 100644 --- a/modules/cmsis/cmsis_core_a_r.h +++ b/modules/cmsis/cmsis_core_a_r.h @@ -46,6 +46,8 @@ extern "C" { #include #elif defined(CONFIG_CPU_CORTEX_R7) #include +#elif defined(CONFIG_CPU_CORTEX_R8) +#include #elif defined(CONFIG_CPU_CORTEX_R52) #include #elif defined(CONFIG_CPU_AARCH32_CORTEX_A) diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt/include/os_mgmt_processor.h b/subsys/mgmt/mcumgr/grp/os_mgmt/include/os_mgmt_processor.h index 83b2f5987354c..71dfda7c19311 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt/include/os_mgmt_processor.h +++ b/subsys/mgmt/mcumgr/grp/os_mgmt/include/os_mgmt_processor.h @@ -83,6 +83,16 @@ extern "C" { #else #define PROCESSOR_NAME "cortex-r7+nofp" #endif +#elif defined(CONFIG_CPU_CORTEX_R8) +#if defined(CONFIG_FPU) && defined(CONFIG_CPU_HAS_VFP) +#if !defined(CONFIG_VFP_FEATURE_DOUBLE_PRECISION) +#define PROCESSOR_NAME "cortex-r8+nofp.dp" +#else +#define PROCESSOR_NAME "cortex-r8" +#endif +#else +#define PROCESSOR_NAME "cortex-r8+nofp" +#endif #elif defined(CONFIG_CPU_CORTEX_R52) #if defined(CONFIG_FPU) && defined(CONFIG_CPU_HAS_VFP) #if !defined(CONFIG_VFP_FEATURE_DOUBLE_PRECISION) From dc433dd6bdb21c2e02d8b97194b7f4764a562c4d Mon Sep 17 00:00:00 2001 From: Krzysztof Sychla Date: Wed, 27 Mar 2024 14:54:24 +0100 Subject: [PATCH 0065/4482] soc: renode: Add cortex_r8_virtual MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add virtual Cortex R8 SoC. This target does not represent a real SoC, but can be easily run in Renode. This will allow to easily test basic architecture support. Signed-off-by: Krzysztof Sychla Signed-off-by: Marek Slowinski Signed-off-by: Piotr Zierhoffer Signed-off-by: Mateusz Hołenko --- dts/arm/cortex_r8_virt.dtsi | 63 ++++++++++++++++++ soc/renode/cortex_r8_virtual/CMakeLists.txt | 13 ++++ soc/renode/cortex_r8_virtual/Kconfig | 9 +++ .../cortex_r8_virtual/Kconfig.defconfig | 20 ++++++ soc/renode/cortex_r8_virtual/Kconfig.soc | 10 +++ .../cortex_r8_virtual/arm_mpu_regions.c | 66 +++++++++++++++++++ soc/renode/cortex_r8_virtual/soc.c | 23 +++++++ soc/renode/cortex_r8_virtual/soc.h | 16 +++++ soc/renode/cortex_r8_virtual/soc.yml | 2 + 9 files changed, 222 insertions(+) create mode 100644 dts/arm/cortex_r8_virt.dtsi create mode 100644 soc/renode/cortex_r8_virtual/CMakeLists.txt create mode 100644 soc/renode/cortex_r8_virtual/Kconfig create mode 100644 soc/renode/cortex_r8_virtual/Kconfig.defconfig create mode 100644 soc/renode/cortex_r8_virtual/Kconfig.soc create mode 100644 soc/renode/cortex_r8_virtual/arm_mpu_regions.c create mode 100644 soc/renode/cortex_r8_virtual/soc.c create mode 100644 soc/renode/cortex_r8_virtual/soc.h create mode 100644 soc/renode/cortex_r8_virtual/soc.yml diff --git a/dts/arm/cortex_r8_virt.dtsi b/dts/arm/cortex_r8_virt.dtsi new file mode 100644 index 0000000000000..704f17ed8efdc --- /dev/null +++ b/dts/arm/cortex_r8_virt.dtsi @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2024 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/ { + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-r8f"; + reg = <0>; + }; + }; + soc { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + ranges; + interrupt-parent = < &gic >; + flash0: flash@c0000000 { + compatible = "soc-nv-flash"; + reg = < 0xc0000000 0x2000000 >; + }; + sram0: memory@0 { + compatible = "mmio-sram"; + reg = < 0x0 0x4000000 >; + }; + uart0: uart@ff000000 { + compatible = "xlnx,xuartps"; + reg = < 0xff000000 0x4c >; + status = "disabled"; + interrupts = ; + interrupt-names = "irq_0"; + }; + ttc0: timer@ff110000 { + compatible = "xlnx,ttcps"; + status = "okay"; + interrupts = < 0x0 0x24 0x2 0xa0 >, + < 0x0 0x25 0x2 0xa0 >, + < 0x0 0x26 0x2 0xa0 >; + interrupt-names = "irq_0", "irq_1", "irq_2"; + reg = < 0xff110000 0x1000 >; + clock-frequency = < 5000000 >; + }; + gic: interrupt-controller@f9000000 { + compatible = "arm,gic-v1", "arm,gic"; + reg = < 0xf9000000 0x1000 >, < 0xf9001000 0x100 >; + interrupt-controller; + #interrupt-cells = < 0x4 >; + status = "okay"; + phandle = < 0x1 >; + }; + }; +}; diff --git a/soc/renode/cortex_r8_virtual/CMakeLists.txt b/soc/renode/cortex_r8_virtual/CMakeLists.txt new file mode 100644 index 0000000000000..2b8f495b04ee8 --- /dev/null +++ b/soc/renode/cortex_r8_virtual/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright (c) 2024 Antmicro +# SPDX-License-Identifier: Apache-2.0 + +zephyr_sources(soc.c) + +zephyr_sources_ifdef( + CONFIG_ARM_MPU + arm_mpu_regions.c +) + +zephyr_include_directories(.) + +set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld CACHE INTERNAL "") diff --git a/soc/renode/cortex_r8_virtual/Kconfig b/soc/renode/cortex_r8_virtual/Kconfig new file mode 100644 index 0000000000000..769ee5e4af80d --- /dev/null +++ b/soc/renode/cortex_r8_virtual/Kconfig @@ -0,0 +1,9 @@ +# Copyright (c) 2024 Antmicro +# SPDX-License-Identifier: Apache-2.0 + +config SOC_CORTEX_R8_VIRTUAL + select ARM + select CPU_CORTEX_R8 + select PLATFORM_SPECIFIC_INIT + select CPU_HAS_ARM_MPU + select VFP_DP_D16 diff --git a/soc/renode/cortex_r8_virtual/Kconfig.defconfig b/soc/renode/cortex_r8_virtual/Kconfig.defconfig new file mode 100644 index 0000000000000..114978755a9c8 --- /dev/null +++ b/soc/renode/cortex_r8_virtual/Kconfig.defconfig @@ -0,0 +1,20 @@ +# Copyright (c) 2024 Antmicro +# SPDX-License-Identifier: Apache-2.0 + +if SOC_CORTEX_R8_VIRTUAL + +config NUM_IRQS + default 220 + +config SYS_CLOCK_HW_CYCLES_PER_SEC + default 5000000 + +DT_CHOSEN_Z_FLASH := zephyr,flash + +config FLASH_SIZE + default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_FLASH),0,K) + +config FLASH_BASE_ADDRESS + default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH)) + +endif # SOC_CORTEX_R8_VIRTUAL diff --git a/soc/renode/cortex_r8_virtual/Kconfig.soc b/soc/renode/cortex_r8_virtual/Kconfig.soc new file mode 100644 index 0000000000000..c326279f27bf3 --- /dev/null +++ b/soc/renode/cortex_r8_virtual/Kconfig.soc @@ -0,0 +1,10 @@ +# Copyright (c) 2024 Antmicro +# SPDX-License-Identifier: Apache-2.0 + +config SOC_CORTEX_R8_VIRTUAL + bool + help + Cortex R8 Virtual system implementation + +config SOC + default "cortex_r8_virtual" if SOC_CORTEX_R8_VIRTUAL diff --git a/soc/renode/cortex_r8_virtual/arm_mpu_regions.c b/soc/renode/cortex_r8_virtual/arm_mpu_regions.c new file mode 100644 index 0000000000000..8287a0651d4d0 --- /dev/null +++ b/soc/renode/cortex_r8_virtual/arm_mpu_regions.c @@ -0,0 +1,66 @@ +/* SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2021 Lexmark International, Inc. + * Copyright (c) 2024 Antmicro + */ + +#include +#include + +#define MPUTYPE_READ_ONLY \ + { \ + .rasr = (P_RO_U_RO_Msk \ + | (7 << MPU_RASR_TEX_Pos) \ + | MPU_RASR_C_Msk \ + | MPU_RASR_B_Msk \ + | MPU_RASR_XN_Msk) \ + } + +#define MPUTYPE_READ_ONLY_PRIV \ + { \ + .rasr = (P_RO_U_RO_Msk \ + | (5 << MPU_RASR_TEX_Pos) \ + | MPU_RASR_B_Msk) \ + } + +#define MPUTYPE_PRIV_WBWACACHE_XN \ + { \ + .rasr = (P_RW_U_NA_Msk \ + | (5 << MPU_RASR_TEX_Pos) \ + | MPU_RASR_B_Msk \ + | MPU_RASR_XN_Msk) \ + } + +#define MPUTYPE_PRIV_DEVICE \ + { \ + .rasr = (P_RW_U_NA_Msk \ + | (2 << MPU_RASR_TEX_Pos)) \ + } + +extern uint32_t _image_rom_end_order; +static const struct arm_mpu_region mpu_regions[] = { + MPU_REGION_ENTRY("FLASH0", + 0xc0000000, + REGION_32M, + MPUTYPE_READ_ONLY), + + MPU_REGION_ENTRY("SRAM_PRIV", + 0x00000000, + REGION_2G, + MPUTYPE_PRIV_WBWACACHE_XN), + + MPU_REGION_ENTRY("SRAM", + 0x00000000, + ((uint32_t)&_image_rom_end_order), + MPUTYPE_READ_ONLY_PRIV), + + MPU_REGION_ENTRY("REGISTERS", + 0xf8000000, + REGION_128M, + MPUTYPE_PRIV_DEVICE), +}; + +const struct arm_mpu_config mpu_config = { + .num_regions = ARRAY_SIZE(mpu_regions), + .mpu_regions = mpu_regions, +}; diff --git a/soc/renode/cortex_r8_virtual/soc.c b/soc/renode/cortex_r8_virtual/soc.c new file mode 100644 index 0000000000000..b5ec39c810800 --- /dev/null +++ b/soc/renode/cortex_r8_virtual/soc.c @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2019 Lexmark International, Inc. + * Copyright (c) 2024 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + * + */ + +#include +#include + +#include + +void z_arm_platform_init(void) +{ + /* + * Use normal exception vectors address range (0x0-0x1C). + */ + unsigned int sctlr = __get_SCTLR(); + + sctlr &= ~SCTLR_V_Msk; + __set_SCTLR(sctlr); +} diff --git a/soc/renode/cortex_r8_virtual/soc.h b/soc/renode/cortex_r8_virtual/soc.h new file mode 100644 index 0000000000000..952a91d5e3faf --- /dev/null +++ b/soc/renode/cortex_r8_virtual/soc.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2024 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + * + */ + +#ifndef ZEPHYR_SOC_CORTEX_R8_VIRTUAL_SOC_H_ +#define ZEPHYR_SOC_CORTEX_R8_VIRTUAL_SOC_H_ + +#define __CR_REV 1U + +#define __GIC_PRESENT 0U +#define __TIM_PRESENT 0U + +#endif /* ZEPHYR_SOC_CORTEX_R8_VIRTUAL_SOC_H_ */ diff --git a/soc/renode/cortex_r8_virtual/soc.yml b/soc/renode/cortex_r8_virtual/soc.yml new file mode 100644 index 0000000000000..8d0a0b279da59 --- /dev/null +++ b/soc/renode/cortex_r8_virtual/soc.yml @@ -0,0 +1,2 @@ +socs: + - name: cortex_r8_virtual From 92d4a88c7a813e65bab58efc5dd7c8896798d95a Mon Sep 17 00:00:00 2001 From: Krzysztof Sychla Date: Wed, 27 Mar 2024 14:55:54 +0100 Subject: [PATCH 0066/4482] boards: renode: Add virtual Cortex-R8 board MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds a virtual target using the `cortex_r8_virtual` SoC. It can be used for testing purposes and a starting point to add new R8 platforms. Signed-off-by: Krzysztof Sychla Signed-off-by: Marek Slowinski Signed-off-by: Piotr Zierhoffer Signed-off-by: Mateusz Hołenko --- .../Kconfig.cortex_r8_virtual | 5 ++ boards/renode/cortex_r8_virtual/board.cmake | 6 ++ boards/renode/cortex_r8_virtual/board.yml | 5 ++ .../cortex_r8_virtual/cortex_r8_virtual.dts | 26 ++++++++ .../cortex_r8_virtual/cortex_r8_virtual.yaml | 18 ++++++ .../cortex_r8_virtual_defconfig | 22 +++++++ boards/renode/cortex_r8_virtual/doc/index.rst | 62 +++++++++++++++++++ .../support/cortex_r8_virtual.repl | 31 ++++++++++ .../support/cortex_r8_virtual.resc | 18 ++++++ 9 files changed, 193 insertions(+) create mode 100644 boards/renode/cortex_r8_virtual/Kconfig.cortex_r8_virtual create mode 100644 boards/renode/cortex_r8_virtual/board.cmake create mode 100644 boards/renode/cortex_r8_virtual/board.yml create mode 100644 boards/renode/cortex_r8_virtual/cortex_r8_virtual.dts create mode 100644 boards/renode/cortex_r8_virtual/cortex_r8_virtual.yaml create mode 100644 boards/renode/cortex_r8_virtual/cortex_r8_virtual_defconfig create mode 100644 boards/renode/cortex_r8_virtual/doc/index.rst create mode 100644 boards/renode/cortex_r8_virtual/support/cortex_r8_virtual.repl create mode 100644 boards/renode/cortex_r8_virtual/support/cortex_r8_virtual.resc diff --git a/boards/renode/cortex_r8_virtual/Kconfig.cortex_r8_virtual b/boards/renode/cortex_r8_virtual/Kconfig.cortex_r8_virtual new file mode 100644 index 0000000000000..e9830df9f0547 --- /dev/null +++ b/boards/renode/cortex_r8_virtual/Kconfig.cortex_r8_virtual @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Antmicro +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_CORTEX_R8_VIRTUAL + select SOC_CORTEX_R8_VIRTUAL diff --git a/boards/renode/cortex_r8_virtual/board.cmake b/boards/renode/cortex_r8_virtual/board.cmake new file mode 100644 index 0000000000000..272149871d090 --- /dev/null +++ b/boards/renode/cortex_r8_virtual/board.cmake @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Antmicro +# SPDX-License-Identifier: Apache-2.0 + +set(SUPPORTED_EMU_PLATFORMS renode) +set(RENODE_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/support/cortex_r8_virtual.resc) +set(RENODE_UART sysbus.uart0) diff --git a/boards/renode/cortex_r8_virtual/board.yml b/boards/renode/cortex_r8_virtual/board.yml new file mode 100644 index 0000000000000..799b2a9ba12d0 --- /dev/null +++ b/boards/renode/cortex_r8_virtual/board.yml @@ -0,0 +1,5 @@ +board: + name: cortex_r8_virtual + vendor: renode + socs: + - name: cortex_r8_virtual diff --git a/boards/renode/cortex_r8_virtual/cortex_r8_virtual.dts b/boards/renode/cortex_r8_virtual/cortex_r8_virtual.dts new file mode 100644 index 0000000000000..9e8bd04f7df2b --- /dev/null +++ b/boards/renode/cortex_r8_virtual/cortex_r8_virtual.dts @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2024 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include + +/ { + model = "Cortex-R8 Virtual target"; + compatible = "renode,cortex-r8-virtual"; + chosen { + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + }; +}; + +&uart0 { + status = "okay"; + current-speed = <115200>; + clock-frequency = <99999901>; +}; diff --git a/boards/renode/cortex_r8_virtual/cortex_r8_virtual.yaml b/boards/renode/cortex_r8_virtual/cortex_r8_virtual.yaml new file mode 100644 index 0000000000000..8d888e8806cf9 --- /dev/null +++ b/boards/renode/cortex_r8_virtual/cortex_r8_virtual.yaml @@ -0,0 +1,18 @@ +identifier: cortex_r8_virtual +name: Cortex R8 Virtual Board +type: mcu +arch: arm +toolchain: + - zephyr +ram: 131072 +simulation: renode +simulation_exec: renode +testing: + ignore_tags: + - net + - bluetooth + renode: + uart: sysbus.uart0 + resc: boards/renode/cortex_r8_virtual/support/cortex_r8_virtual.resc +supported: + - uart diff --git a/boards/renode/cortex_r8_virtual/cortex_r8_virtual_defconfig b/boards/renode/cortex_r8_virtual/cortex_r8_virtual_defconfig new file mode 100644 index 0000000000000..1c358355b1e5a --- /dev/null +++ b/boards/renode/cortex_r8_virtual/cortex_r8_virtual_defconfig @@ -0,0 +1,22 @@ +# Copyright (c) 2024 Antmicro +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_XIP=n + +CONFIG_ISR_STACK_SIZE=512 +CONFIG_THREAD_STACK_INFO=y + +CONFIG_MAX_DOMAIN_PARTITIONS=24 + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# Enable serial port +CONFIG_UART_XLNX_PS=y + +CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 +CONFIG_ARM_MPU=y diff --git a/boards/renode/cortex_r8_virtual/doc/index.rst b/boards/renode/cortex_r8_virtual/doc/index.rst new file mode 100644 index 0000000000000..07a18a7765074 --- /dev/null +++ b/boards/renode/cortex_r8_virtual/doc/index.rst @@ -0,0 +1,62 @@ +.. _cortex_r8_virtual: + +Cortex-R8 Virtual +################# + +Overview +******** + +The Cortex-R8 Virtual board is a virtual platform that can be emulated with Renode. +Edit the :zephyr_file:`boards/renode/cortex_r8_virtual/support/cortex_r8_virtual.repl` file to adapt the platform layout to your needs. + +Refer to the `Renode documentation `_ +to learn how to obtain Renode for your host. + +Programming and debugging +************************* + +Building +======== + +Applications for the ``cortex_r8_virtual`` board target can be built +using the standard build flow (see :ref:`build_an_application`): + +.. zephyr-app-commands:: + :board: cortex_r8_virtual + :goals: build + +Flashing +======== + +Your software will run in simulation and you don't need to "flash" the board in a traditional way, +but you can use this configuration to run Zephyr applications +and kernel tests directly in Renode with the use of the ``run`` command. + +For example, with the :zephyr:code-sample:`synchronization` sample: + +.. zephyr-app-commands:: + :zephyr-app: samples/synchronization + :host-os: unix + :board: cortex_r8_virtual + :goals: run + +This will build an image with the synchronization sample app, boot it using +Renode, and display the following console output: + +.. code-block:: console + + *** Booting Zephyr OS build v3.6.0-5689-g2a5c606abfa7 *** + thread_a: Hello World from cpu 0 on cortex_r8_virtual! + thread_b: Hello World from cpu 0 on cortex_r8_virtual! + thread_a: Hello World from cpu 0 on cortex_r8_virtual! + thread_b: Hello World from cpu 0 on cortex_r8_virtual! + +Exit Renode by pressing :kbd:`CTRL+C`. + +Debugging +========= + +Refer to the detailed overview about :ref:`application_debugging`. + +Renode can serve as a GDB server. For more information, refer to the +`Renode documentation about GDB debugging `_. diff --git a/boards/renode/cortex_r8_virtual/support/cortex_r8_virtual.repl b/boards/renode/cortex_r8_virtual/support/cortex_r8_virtual.repl new file mode 100644 index 0000000000000..2c4c9d4cc6fab --- /dev/null +++ b/boards/renode/cortex_r8_virtual/support/cortex_r8_virtual.repl @@ -0,0 +1,31 @@ +cpu: CPU.ARMv7R @ sysbus + cpuType: "cortex-r8" + genericInterruptController: gic + numberOfMPURegions: 24 + cpuId: 0 + +scu: Miscellaneous.ArmSnoopControlUnit @ sysbus 0xae000000 + +gic: IRQControllers.ARM_GenericInterruptController @ { + sysbus new Bus.BusMultiRegistration { address: 0xf9001000; size: 0x100; region: "cpuInterface" }; + sysbus new Bus.BusMultiRegistration { address: 0xf9000000; size: 0x1000; region: "distributor" } + } + [0,1] -> cpu@[0,1] + architectureVersion: IRQControllers.ARM_GenericInterruptControllerVersion.GICv1 + supportsTwoSecurityStates: false + +privateTimer0: Timers.ARM_PrivateTimer @ { + sysbus new Bus.BusPointRegistration { address: 0xae000600; cpu: cpu } + } + -> gic#0@29 + frequency: 667000000 + +mem: Memory.MappedMemory @ sysbus 0x0 + size: 0x8000000 + +uart0: UART.Cadence_UART @ sysbus 0xff000000 + -> gic@21 + +ttc0: Timers.Cadence_TTC @ sysbus 0xff110000 + [0-2] -> gic@[36-38] + frequency: 5000000 diff --git a/boards/renode/cortex_r8_virtual/support/cortex_r8_virtual.resc b/boards/renode/cortex_r8_virtual/support/cortex_r8_virtual.resc new file mode 100644 index 0000000000000..6fbf739750a0e --- /dev/null +++ b/boards/renode/cortex_r8_virtual/support/cortex_r8_virtual.resc @@ -0,0 +1,18 @@ +:name: Cortex-R8-Virtual +:description: This script is prepared to run Zephyr on a virtual Cortex-R8 board. + +$name?="Cortex-R8-Virtual" + +using sysbus +mach create $name +machine LoadPlatformDescription $ORIGIN/cortex_r8_virtual.repl + + +showAnalyzer uart0 +cpu PerformanceInMips 5 + +macro reset +""" + sysbus LoadELF $elf +""" +runMacro $reset From 9b9d39d57811f1e2b1c45ee23751bd658a1e969f Mon Sep 17 00:00:00 2001 From: Marek Slowinski Date: Mon, 3 Jun 2024 14:23:34 +0200 Subject: [PATCH 0067/4482] samples: userspace: cortex_r8_virtual: Set CONFIG_DYNAMIC_OBJECTS=y MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable kernel dynamic object allocation. Otherwise the following error is printed: E: 0xa138 is not a valid sample driver E: address is not a known kernel object E: syscall z_vrfy_sample_driver_state_set failed check: access denied E: couldn't start driver interrupts Signed-off-by: Marek Slowinski Signed-off-by: Mateusz Hołenko --- samples/userspace/prod_consumer/boards/cortex_r8_virtual.conf | 1 + 1 file changed, 1 insertion(+) create mode 100644 samples/userspace/prod_consumer/boards/cortex_r8_virtual.conf diff --git a/samples/userspace/prod_consumer/boards/cortex_r8_virtual.conf b/samples/userspace/prod_consumer/boards/cortex_r8_virtual.conf new file mode 100644 index 0000000000000..83bf462b1c59d --- /dev/null +++ b/samples/userspace/prod_consumer/boards/cortex_r8_virtual.conf @@ -0,0 +1 @@ +CONFIG_DYNAMIC_OBJECTS=y From 2088f6d35ffd95da83f0b39c5c5d6245d0234ec3 Mon Sep 17 00:00:00 2001 From: Marek Slowinski Date: Mon, 3 Jun 2024 14:32:56 +0200 Subject: [PATCH 0068/4482] ztest: error_hook: Exclude cortex_r8_virtual from divide-by-zero tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cortex-R8 emulated in Renode doesn't trigger exceptions on divide by zero. We only skip the virtual SoC, so the test will still apply on a physical target. Signed-off-by: Marek Slowinski Signed-off-by: Mateusz Hołenko --- tests/ztest/error_hook/src/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/ztest/error_hook/src/main.c b/tests/ztest/error_hook/src/main.c index 7b1b63466c2af..e4b05fc3eb0d1 100644 --- a/tests/ztest/error_hook/src/main.c +++ b/tests/ztest/error_hook/src/main.c @@ -121,6 +121,7 @@ __no_optimization static void trigger_fault_divide_zero(void) #if (defined(CONFIG_SOC_SERIES_MPS2) && defined(CONFIG_QEMU_TARGET)) || \ (defined(CONFIG_SOC_SERIES_MPS3) && defined(CONFIG_QEMU_TARGET)) || \ defined(CONFIG_BOARD_QEMU_CORTEX_A53) || defined(CONFIG_SOC_QEMU_ARC) || \ + defined(CONFIG_SOC_CORTEX_R8_VIRTUAL) || \ defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE) || \ defined(CONFIG_BOARD_QEMU_CORTEX_R5) || \ defined(CONFIG_ARMV8_R) || defined(CONFIG_AARCH32_ARMV8_R) || \ From f7b7edc40ccbae60c4e386f5240b7c117045d289 Mon Sep 17 00:00:00 2001 From: Marek Slowinski Date: Tue, 11 Jun 2024 14:44:00 +0200 Subject: [PATCH 0069/4482] MAINTAINERS: Add Renode-related SoCs and boards to Testing with Renode area MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extend Testing with Renode area by: - soc/renode/ - boards/renode/ Signed-off-by: Marek Slowinski Signed-off-by: Mateusz Hołenko --- MAINTAINERS.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 168934811ba2f..c29e77f7b291f 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -5285,6 +5285,8 @@ Testing with Renode: - fkokosinski files: - cmake/emu/renode.cmake + - soc/renode/ + - boards/renode/ - boards/**/*/support/*.repl - boards/**/*/support/*.resc labels: From 9905e27353a4114d3592a3fdb1a5a2ce8e0ba169 Mon Sep 17 00:00:00 2001 From: Mateusz Holenko Date: Wed, 11 Sep 2024 13:18:39 +0200 Subject: [PATCH 0070/4482] tests: thread_runtime_stats: Skip the test on virtual Cortex-R8 platform MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Current clocks configuration for the platform makes it impossible to pass the IDLE_EVENT_STATS_PRECISION check. This is to be addressed in the future. Signed-off-by: Mateusz Hołenko --- tests/kernel/usage/thread_runtime_stats/testcase.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/kernel/usage/thread_runtime_stats/testcase.yaml b/tests/kernel/usage/thread_runtime_stats/testcase.yaml index 671a01b8a190f..b96eb0b381601 100644 --- a/tests/kernel/usage/thread_runtime_stats/testcase.yaml +++ b/tests/kernel/usage/thread_runtime_stats/testcase.yaml @@ -18,3 +18,4 @@ tests: - mps2/an385 platform_exclude: - mr_canhubk3 + - cortex_r8_virtual From df7f1ff5b5b5cd18c68ccb676ca210b82b9fe6d4 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Fri, 27 Sep 2024 15:07:22 +0900 Subject: [PATCH 0071/4482] tests: drivers: build_all: gnss: Add serial devices to build test Add build tests for following devices. - luatos,air530z - quectel,lc86g - u-blox,m8 Signed-off-by: TOKITA Hiroshi --- tests/drivers/build_all/gnss/app.overlay | 15 ++++++++++++++- tests/drivers/build_all/gnss/testcase.yaml | 4 +++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/drivers/build_all/gnss/app.overlay b/tests/drivers/build_all/gnss/app.overlay index 9616b60ef350a..cd3aed7fbf1d9 100644 --- a/tests/drivers/build_all/gnss/app.overlay +++ b/tests/drivers/build_all/gnss/app.overlay @@ -14,9 +14,22 @@ reg = <0x0 0x1000>; status = "okay"; - gnss: gnss-nmea-generic { + gnss_nmea_generic: gnss-nmea-generic { compatible = "gnss-nmea-generic"; }; + + gnss_air530z: air530z { + compatible = "luatos,air530z"; + }; + + gnss_lc86g: lc86g { + compatible = "quectel,lc86g"; + pps-mode = "GNSS_PPS_MODE_ENABLED"; + }; + + gnss_m8: m8 { + compatible = "u-blox,m8"; + }; }; }; }; diff --git a/tests/drivers/build_all/gnss/testcase.yaml b/tests/drivers/build_all/gnss/testcase.yaml index faaec12c7454b..d62d8990e7632 100644 --- a/tests/drivers/build_all/gnss/testcase.yaml +++ b/tests/drivers/build_all/gnss/testcase.yaml @@ -5,4 +5,6 @@ common: build_only: true platform_allow: native_sim tests: - drivers.gnss.default: {} + drivers.gnss.default: + extra_configs: + - CONFIG_PM_DEVICE=y From 5b607ed5c7869b6f01098bb02d5d81c357c3cb43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 27 Sep 2024 10:58:21 +0200 Subject: [PATCH 0072/4482] dts: arm: nordic: Define power states for nrf54h20/cpuapp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add definition of low power states 'idle' and 's2ram' for nrf54h20/cpuapp. Signed-off-by: Sebastian Głąb --- dts/common/nordic/nrf54h20.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index aa14161604903..de006cd9cf690 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -28,6 +28,7 @@ device_type = "cpu"; clocks = <&cpuapp_hsfll>; clock-frequency = ; + cpu-power-states = <&idle &s2ram>; }; cpurad: cpu@3 { @@ -122,6 +123,20 @@ nordic,tasks-mask = <0xffff0000>; }; }; + + power-states { + idle: idle { + compatible = "zephyr,power-state"; + power-state-name = "suspend-to-idle"; + min-residency-us = <100000>; + }; + + s2ram: s2ram { + compatible = "zephyr,power-state"; + power-state-name = "suspend-to-ram"; + min-residency-us = <800000>; + }; + }; }; reserved-memory { From f8299b66eb74bf938a4824354c406313accefeb4 Mon Sep 17 00:00:00 2001 From: Daniel Flodin Date: Fri, 27 Sep 2024 10:35:20 +0200 Subject: [PATCH 0073/4482] include: types.h: toolchain.h: Move TLS macro definition Move the `Z_THREAD_LOCAL` macro from `include/zephyr/toolchain/common.h` to `include/zephyr/types.h`. This is needed since some `syscall.h` files are using TLS but aren't including `zephyr/toolchain.h` (but they are including `zephyr/types.h`). Signed-off-by: Daniel Flodin --- include/zephyr/toolchain/common.h | 18 ------------------ include/zephyr/types.h | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/zephyr/toolchain/common.h b/include/zephyr/toolchain/common.h index 1891b35538a67..c84328365fd3b 100644 --- a/include/zephyr/toolchain/common.h +++ b/include/zephyr/toolchain/common.h @@ -39,24 +39,6 @@ #endif #endif -/* - * Thread local variables are declared with different keywords depending on - * which C/C++ standard that is used. C++11 and C23 uses "thread_local" whilst - * C11 uses "_Thread_local". Previously the GNU "__thread" keyword was used - * which is the same in both gcc and g++. - */ -#ifndef Z_THREAD_LOCAL -#if defined(__cplusplus) && (__cplusplus) >= 201103L /* C++11 */ -#define Z_THREAD_LOCAL thread_local -#elif defined(__STDC_VERSION__) && (__STDC_VERSION__) >= 202311L /* C23 */ -#define Z_THREAD_LOCAL thread_local -#elif defined(__STDC_VERSION__) && (__STDC_VERSION__) >= 201112L /* C11 */ -#define Z_THREAD_LOCAL _Thread_local -#else /* Default back to old behavior which used the GNU keyword. */ -#define Z_THREAD_LOCAL __thread -#endif -#endif /* Z_THREAD_LOCAL */ - /* * Generate a reference to an external symbol. * The reference indicates to the linker that the symbol is required diff --git a/include/zephyr/types.h b/include/zephyr/types.h index 7e5e87b2ce334..145957da05929 100644 --- a/include/zephyr/types.h +++ b/include/zephyr/types.h @@ -29,6 +29,24 @@ typedef union { void (*thepfunc)(void); } z_max_align_t; +/* + * Thread local variables are declared with different keywords depending on + * which C/C++ standard that is used. C++11 and C23 uses "thread_local" whilst + * C11 uses "_Thread_local". Previously the GNU "__thread" keyword was used + * which is the same in both gcc and g++. + */ +#ifndef Z_THREAD_LOCAL +#if defined(__cplusplus) && (__cplusplus) >= 201103L /* C++11 */ +#define Z_THREAD_LOCAL thread_local +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__) >= 202311L /* C23 */ +#define Z_THREAD_LOCAL thread_local +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__) >= 201112L /* C11 */ +#define Z_THREAD_LOCAL _Thread_local +#else /* Default back to old behavior which used the GNU keyword. */ +#define Z_THREAD_LOCAL __thread +#endif +#endif /* Z_THREAD_LOCAL */ + #ifdef __cplusplus /* Zephyr requires an int main(void) signature with C linkage for the application main if present */ extern int main(void); From 517d51e33a26aa7b0005ce1f60f91b24e5c1a396 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 26 Sep 2024 12:59:23 +0200 Subject: [PATCH 0074/4482] drivers/timer native_posix: Allow without BOARD_NATIVE_POSIX This driver works both with native_posix and native_sim. native_sim will eventually not set NATIVE_SIM_NATIVE_POSIX_COMPAT (i.e. not pretend to be native_posix) so let's correct the dependencies. Signed-off-by: Alberto Escolar Piedras --- drivers/timer/Kconfig.native_posix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/timer/Kconfig.native_posix b/drivers/timer/Kconfig.native_posix index 278feeec2a85c..ad2c4acad7669 100644 --- a/drivers/timer/Kconfig.native_posix +++ b/drivers/timer/Kconfig.native_posix @@ -6,7 +6,7 @@ config NATIVE_POSIX_TIMER bool "(POSIX) native_sim/posix timer driver" default y - depends on BOARD_NATIVE_POSIX + depends on BOARD_NATIVE_POSIX || BOARD_NATIVE_SIM select TICKLESS_CAPABLE select TIMER_HAS_64BIT_CYCLE_COUNTER select SYSTEM_TIMER_HAS_DISABLE_SUPPORT From 15774e13167924a6ea71f3b47040deb1e23ac660 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 26 Sep 2024 13:15:46 +0200 Subject: [PATCH 0075/4482] tests/boards/native_sim/cpu_wait: Correct ifdef This test works both with native_posix and native_sim. native_sim will eventually not set NATIVE_SIM_NATIVE_POSIX_COMPAT (i.e. not pretend to be native_posix) so let's correct this ifdef Signed-off-by: Alberto Escolar Piedras --- tests/boards/native_sim/cpu_wait/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/boards/native_sim/cpu_wait/src/main.c b/tests/boards/native_sim/cpu_wait/src/main.c index 28d6d9309e909..622b7579ef1cd 100644 --- a/tests/boards/native_sim/cpu_wait/src/main.c +++ b/tests/boards/native_sim/cpu_wait/src/main.c @@ -214,7 +214,7 @@ static void np_timer_isr_test_replacement(const void *arg) */ ZTEST(native_cpu_hold, test_cpu_hold_with_interrupts) { -#if defined(CONFIG_BOARD_NATIVE_POSIX) +#if defined(CONFIG_BOARD_NATIVE_POSIX) || defined(CONFIG_BOARD_NATIVE_SIM) /* So far we only have a test for native_posix. * As the test hooks into an interrupt to cause an extra delay * this is very platform specific From 080787f5b7a9e16c5b2273c355a4a752ca069304 Mon Sep 17 00:00:00 2001 From: Tom Chang Date: Mon, 16 Sep 2024 13:55:46 +0800 Subject: [PATCH 0076/4482] drivers: espi: npcx: update the parsing function for espi taf This commit updates the FLASHRXBUF parsing functionality of eSPI TAF. It ensures that data can be read correctly from FLASHRXBUF[0]. And, the eSPI TAF request can be parsed correctly. Signed-off-by: Tom Chang --- drivers/espi/espi_npcx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/espi/espi_npcx.c b/drivers/espi/espi_npcx.c index 67eee0f1baa4b..b134efadefa20 100644 --- a/drivers/espi/espi_npcx.c +++ b/drivers/espi/espi_npcx.c @@ -383,11 +383,13 @@ static uint32_t espi_taf_parse(const struct device *dev) { struct espi_reg *const inst = HAL_INSTANCE(dev); struct npcx_taf_head taf_head; - uint32_t taf_addr; + uint32_t taf_addr, head_data; uint8_t i, roundsize; /* Get type, length and tag from RX buffer */ - memcpy(&taf_head, (void *)&inst->FLASHRXBUF[0], sizeof(taf_head)); + head_data = inst->FLASHRXBUF[0]; + taf_head = *(struct npcx_taf_head *)&head_data; + taf_pckt.type = taf_head.type; taf_pckt.len = (((uint16_t)taf_head.tag_hlen & 0xF) << 8) | taf_head.llen; taf_pckt.tag = taf_head.tag_hlen >> 4; From 9c0f92db475f0e27673ac366276026eddf1a150c Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Thu, 19 Sep 2024 17:22:54 -0500 Subject: [PATCH 0077/4482] boards: shields: rk055hdmipi4ma0: raise MIPI DSI bit clock for RT1170 The RT1170 MIPI DPHY requires a faster clock frequency setting for the MIPI DPHY, or the pixel packet counts for the HFP, HBP, and HSA will be incorrect, and the DSI transfers will stall. Raise the target DPHY clock frequency to resolve this. Fixes #78299 Signed-off-by: Daniel DeGrasse --- .../boards/mimxrt1170_evk_mimxrt1176_cm7.overlay | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 boards/shields/rk055hdmipi4ma0/boards/mimxrt1170_evk_mimxrt1176_cm7.overlay diff --git a/boards/shields/rk055hdmipi4ma0/boards/mimxrt1170_evk_mimxrt1176_cm7.overlay b/boards/shields/rk055hdmipi4ma0/boards/mimxrt1170_evk_mimxrt1176_cm7.overlay new file mode 100644 index 0000000000000..7578cac75c266 --- /dev/null +++ b/boards/shields/rk055hdmipi4ma0/boards/mimxrt1170_evk_mimxrt1176_cm7.overlay @@ -0,0 +1,10 @@ +/* + * Copyright 2024, NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&zephyr_mipi_dsi { + /* Raise the DSI clock frequency */ + phy-clock = <792000000>; +}; From 4ce3a7b08e73f49bb45f5206f0bd0a4cdef4771e Mon Sep 17 00:00:00 2001 From: Vladislav Pejic Date: Fri, 27 Sep 2024 09:36:10 +0200 Subject: [PATCH 0078/4482] sample: accel_polling: Upgrade for RTIO stream Upgrade to accel_polling sample application to support RTIO streaming functionality. This mode is enabled when CONFIG_SENSOR_ASYNC_API is defined. NUM_SENSORS must be set to the correct number of sensors used. Signed-off-by: Vladislav Pejic --- samples/sensor/accel_polling/src/main.c | 113 +++++++++++++++++++++++- 1 file changed, 112 insertions(+), 1 deletion(-) diff --git a/samples/sensor/accel_polling/src/main.c b/samples/sensor/accel_polling/src/main.c index 1286969616016..ec6e1cee91012 100644 --- a/samples/sensor/accel_polling/src/main.c +++ b/samples/sensor/accel_polling/src/main.c @@ -11,14 +11,120 @@ #include #include #include +#include +#include #define ACCEL_ALIAS(i) DT_ALIAS(_CONCAT(accel, i)) -#define ACCELEROMETER_DEVICE(i, _) \ +#define ACCELEROMETER_DEVICE(i, _) \ IF_ENABLED(DT_NODE_EXISTS(ACCEL_ALIAS(i)), (DEVICE_DT_GET(ACCEL_ALIAS(i)),)) +#define NUM_SENSORS 1 /* support up to 10 accelerometer sensors */ static const struct device *const sensors[] = {LISTIFY(10, ACCELEROMETER_DEVICE, ())}; +#ifdef CONFIG_SENSOR_ASYNC_API + +#define ACCEL_IODEV_SYM(id) CONCAT(accel_iodev, id) +#define ACCEL_IODEV_PTR(id, _) &ACCEL_IODEV_SYM(id) + +#define ACCEL_TRIGGERS \ + {SENSOR_TRIG_FIFO_FULL, SENSOR_STREAM_DATA_INCLUDE}, \ + {SENSOR_TRIG_FIFO_WATERMARK, SENSOR_STREAM_DATA_DROP} + +#define ACCEL_DEFINE_IODEV(id, _) \ + SENSOR_DT_STREAM_IODEV( \ + ACCEL_IODEV_SYM(id), \ + ACCEL_ALIAS(id), \ + ACCEL_TRIGGERS); + +LISTIFY(NUM_SENSORS, ACCEL_DEFINE_IODEV, (;)); + +struct rtio_iodev *iodevs[NUM_SENSORS] = { LISTIFY(NUM_SENSORS, ACCEL_IODEV_PTR, (,)) }; + +RTIO_DEFINE_WITH_MEMPOOL(accel_ctx, NUM_SENSORS, NUM_SENSORS, NUM_SENSORS*20, 256, sizeof(void *)); + +static int print_accels_stream(const struct device *dev, struct rtio_iodev *iodev) +{ + int rc = 0; + struct sensor_three_axis_data accel_data = {0}; + const struct sensor_decoder_api *decoder; + struct rtio_cqe *cqe; + uint8_t *buf; + uint32_t buf_len; + struct rtio_sqe *handles[NUM_SENSORS]; + + /* Start the streams */ + for (int i = 0; i < NUM_SENSORS; i++) { + printk("sensor_stream\n"); + sensor_stream(iodevs[i], &accel_ctx, NULL, &handles[i]); + } + + while (1) { + cqe = rtio_cqe_consume_block(&accel_ctx); + + if (cqe->result != 0) { + printk("async read failed %d\n", cqe->result); + return cqe->result; + } + + rc = rtio_cqe_get_mempool_buffer(&accel_ctx, cqe, &buf, &buf_len); + + if (rc != 0) { + printk("get mempool buffer failed %d\n", rc); + return rc; + } + + const struct device *sensor = dev; + + rtio_cqe_release(&accel_ctx, cqe); + + rc = sensor_get_decoder(sensor, &decoder); + + if (rc != 0) { + printk("sensor_get_decoder failed %d\n", rc); + return rc; + } + + /* Frame iterator values when data comes from a FIFO */ + uint32_t accel_fit = 0; + + /* Number of accelerometer data frames */ + uint16_t frame_count; + + rc = decoder->get_frame_count(buf, + (struct sensor_chan_spec) {SENSOR_CHAN_ACCEL_XYZ, 0}, &frame_count); + + if (rc != 0) { + printk("sensor_get_decoder failed %d\n", rc); + return rc; + } + + /* If a tap has occurred lets print it out */ + if (decoder->has_trigger(buf, SENSOR_TRIG_TAP)) { + printk("Tap! Sensor %s\n", dev->name); + } + + /* Decode all available accelerometer sample frames */ + for (int i = 0; i < frame_count; i++) { + decoder->decode(buf, (struct sensor_chan_spec) {SENSOR_CHAN_ACCEL_XYZ, 0}, + &accel_fit, 1, &accel_data); + + printk("Accel data for %s (%" PRIq(6) ", %" PRIq(6) + ", %" PRIq(6) ") %lluns\n", dev->name, + PRIq_arg(accel_data.readings[0].x, 6, accel_data.shift), + PRIq_arg(accel_data.readings[0].y, 6, accel_data.shift), + PRIq_arg(accel_data.readings[0].z, 6, accel_data.shift), + (accel_data.header.base_timestamp_ns + + accel_data.readings[0].timestamp_delta)); + } + + rtio_release_buffer(&accel_ctx, buf, buf_len); + } + + return rc; +} +#else + static const enum sensor_channel channels[] = { SENSOR_CHAN_ACCEL_X, SENSOR_CHAN_ACCEL_Y, @@ -50,6 +156,7 @@ static int print_accels(const struct device *dev) return 0; } +#endif /*CONFIG_SENSOR_ASYNC_API*/ static int set_sampling_freq(const struct device *dev) { @@ -92,7 +199,11 @@ int main(void) for (int i = 0; i < 5; i++) { #endif for (size_t i = 0; i < ARRAY_SIZE(sensors); i++) { +#ifdef CONFIG_SENSOR_ASYNC_API + ret = print_accels_stream(sensors[i], iodevs[i]); +#else ret = print_accels(sensors[i]); +#endif /*CONFIG_SENSOR_ASYNC_API*/ if (ret < 0) { return 0; } From fe5bfc9eb2386c1a0ca94ece32163417b6d898af Mon Sep 17 00:00:00 2001 From: Vladislav Pejic Date: Fri, 27 Sep 2024 12:12:42 +0200 Subject: [PATCH 0079/4482] driver: sensor: adxl372: Bug fix for status2 reg This is a bug fix for adxl372_get_status function. This function is used to get STATUS1, STATUS2, FIFO_ENTRIES2 and FIFO_ENTRIES1 registers (they are continuously present in the memory in this order). User can choose if it wants STATUS2 and/or FIFO registers by passing pointers where to store received values. Bug was when user doesn't want STATUS2 and want FIFO regs. In that case calculated length would be 3 which will result in reading of STATUS1, STATUS2 and FIFO_ENTRIES2 regs and not expected STATUS1, FIFO_ENTRIES2 and FIFO_ENTRIES1. Signed-off-by: Vladislav Pejic --- drivers/sensor/adi/adxl372/adxl372.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/sensor/adi/adxl372/adxl372.c b/drivers/sensor/adi/adxl372/adxl372.c index 032a7c6e8ae33..8eef0160839c8 100644 --- a/drivers/sensor/adi/adxl372/adxl372.c +++ b/drivers/sensor/adi/adxl372/adxl372.c @@ -364,7 +364,16 @@ int adxl372_get_status(const struct device *dev, } if (fifo_entries) { - length += 2U; + if (status2) { + length += 2U; + } else { + /* Registers STATUS1, STATUS2, FIFO_ENTRIES2 and FIFO_ENTRIES1 + * are one after the other. If user wants fifo_entries and + * not status2, to get the correct values, STATUS2 register + * also must be read but read value will be ignored. + */ + length += 3U; + } } ret = data->hw_tf->read_reg_multiple(dev, ADXL372_STATUS_1, buf, length); From 4bbc2a7893f7f346e511a498af5bc6342cf2da4d Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Mon, 9 Sep 2024 16:56:57 +0800 Subject: [PATCH 0080/4482] arch: riscv: isr.S: restore s0 before jumping to z_riscv_fatal_error_csf Restore the s0 we saved early in ISR entry so it shows up properly in the CSF. Signed-off-by: David Reiss Signed-off-by: Yong Cong Sin --- arch/riscv/core/isr.S | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/riscv/core/isr.S b/arch/riscv/core/isr.S index 7e885da93a469..65c40e63456e1 100644 --- a/arch/riscv/core/isr.S +++ b/arch/riscv/core/isr.S @@ -443,6 +443,12 @@ do_fault: 1: mv a1, sp #ifdef CONFIG_EXCEPTION_DEBUG + /* + * Restore the s0 we saved early in ISR entry + * so it shows up properly in the CSF. + */ + lr s0, __struct_arch_esf_s0_OFFSET(sp) + /* Allocate space for caller-saved registers on current thread stack */ addi sp, sp, -__callee_saved_t_SIZEOF From 4da4ee8eceabba04cfc3e75fe9962074cc1299ed Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Mon, 9 Sep 2024 16:57:35 +0800 Subject: [PATCH 0081/4482] tests: arch: riscv: test csf registers value Test if callee-saved-registers values are as expected. Signed-off-by: David Reiss Signed-off-by: Yong Cong Sin --- tests/arch/riscv/fatal/CMakeLists.txt | 8 ++++ tests/arch/riscv/fatal/prj.conf | 2 + tests/arch/riscv/fatal/src/main.c | 62 +++++++++++++++++++++++++++ tests/arch/riscv/fatal/testcase.yaml | 27 ++++++++++++ 4 files changed, 99 insertions(+) create mode 100644 tests/arch/riscv/fatal/CMakeLists.txt create mode 100644 tests/arch/riscv/fatal/prj.conf create mode 100644 tests/arch/riscv/fatal/src/main.c create mode 100644 tests/arch/riscv/fatal/testcase.yaml diff --git a/tests/arch/riscv/fatal/CMakeLists.txt b/tests/arch/riscv/fatal/CMakeLists.txt new file mode 100644 index 0000000000000..366f13f660da4 --- /dev/null +++ b/tests/arch/riscv/fatal/CMakeLists.txt @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(riscv_fatal) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/arch/riscv/fatal/prj.conf b/tests/arch/riscv/fatal/prj.conf new file mode 100644 index 0000000000000..15ada69e712dd --- /dev/null +++ b/tests/arch/riscv/fatal/prj.conf @@ -0,0 +1,2 @@ +CONFIG_TEST=y +CONFIG_LOG=y diff --git a/tests/arch/riscv/fatal/src/main.c b/tests/arch/riscv/fatal/src/main.c new file mode 100644 index 0000000000000..fc75192a22d5e --- /dev/null +++ b/tests/arch/riscv/fatal/src/main.c @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2024 Meta Platforms + * + * SPDX-License-Identifier: Apache-2.0 + */ + +int main(void) +{ + __asm__( + /** + * Load up a bunch of known values into registers + * and expect them to show up in the core dump. + * Value is register ABI name kinda spelled out, + * followed by zeros to pad to 32 bits, + * followed by FF00, followed by hex number of the register, + * follwed by the "hex-coded-decismal" number of the register. + */ + + /* "RA" -> "DA". Kind of a stretch, but okay. */ + "li x1, 0xDADA0000FF000101\n\t" + + /* Skip stack pointer because it can mess stuff up. */ + /* "li x2, 0\n\t" */ + + /* T0 -> D0. Kinda close in pronunciation. */ + "li x5, 0xD0FF0000FF000505\n\t" + "li x6, 0xD1FF0000FF000606\n\t" + "li x7, 0xD2FF0000FF000707\n\t" + /* S0 -> C0. Kinda close in pronunciation. */ + "li x8, 0xC0FF0000FF000808\n\t" + "li x9, 0xC1FF0000FF000909\n\t" + /* A0 -> A0. Actual match! */ + "li x10, 0xA0FF0000FF000A10\n\t" + "li x11, 0xA1FF0000FF000B11\n\t" + "li x12, 0xA2FF0000FF000C12\n\t" + "li x13, 0xA3FF0000FF000D13\n\t" + "li x14, 0xA4FF0000FF000E14\n\t" + "li x15, 0xA5FF0000FF000F15\n\t" + "li x16, 0xA6FF0000FF001016\n\t" + "li x17, 0xA7FF0000FF001117\n\t" + "li x18, 0xC2FF0000FF001218\n\t" + "li x19, 0xC3FF0000FF001319\n\t" + "li x20, 0xC4FF0000FF001420\n\t" + "li x21, 0xC5FF0000FF001521\n\t" + "li x22, 0xC6FF0000FF001622\n\t" + "li x23, 0xC7FF0000FF001723\n\t" + "li x24, 0xC8FF0000FF001824\n\t" + "li x25, 0xC9FF0000FF001925\n\t" + "li x26, 0xC10FF000FF001A26\n\t" + "li x27, 0xC11FF000FF001B27\n\t" + "li x28, 0xD3FF0000FF001C28\n\t" + "li x29, 0xD4FF0000FF001D29\n\t" + "li x30, 0xD5FF0000FF001E30\n\t" + "li x31, 0xD6FF0000FF001F31\n\t" + /* K_ERR_KERNEL_PANIC */ + "li a0, 4\n\t" + /* RV_ECALL_RUNTIME_EXCEPT */ + "li t0, 0\n\t" + "ecall\n"); + + return 0; +} diff --git a/tests/arch/riscv/fatal/testcase.yaml b/tests/arch/riscv/fatal/testcase.yaml new file mode 100644 index 0000000000000..1355991bca580 --- /dev/null +++ b/tests/arch/riscv/fatal/testcase.yaml @@ -0,0 +1,27 @@ +common: + ignore_faults: true + harness: console + ignore_qemu_crash: true + tags: kernel riscv + platform_allow: + - qemu_riscv64 +tests: + arch.riscv64.fatal: + harness_config: + type: multi_line + regex: + - "E: a0: 0000000000000004 t0: 0000000000000000" + - "E: a1: a1ff0000ff000b11 t1: d1ff0000ff000606" + - "E: a2: a2ff0000ff000c12 t2: d2ff0000ff000707" + - "E: a3: a3ff0000ff000d13 t3: d3ff0000ff001c28" + - "E: a4: a4ff0000ff000e14 t4: d4ff0000ff001d29" + - "E: a5: a5ff0000ff000f15 t5: d5ff0000ff001e30" + - "E: a6: a6ff0000ff001016 t6: d6ff0000ff001f31" + - "E: a7: a7ff0000ff001117" + - "E: ra: dada0000ff000101" + - "E: s0: c0ff0000ff000808 s6: c6ff0000ff001622" + - "E: s1: c1ff0000ff000909 s7: c7ff0000ff001723" + - "E: s2: c2ff0000ff001218 s8: c8ff0000ff001824" + - "E: s3: c3ff0000ff001319 s9: c9ff0000ff001925" + - "E: s4: c4ff0000ff001420 s10: c10ff000ff001a26" + - "E: s5: c5ff0000ff001521 s11: c11ff000ff001b27" From 3ee9b40a5a5cacef426fd76c05fc29bcfecfcd4b Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Fri, 27 Sep 2024 10:13:30 +0200 Subject: [PATCH 0082/4482] eeprom sim: Enhance & refactor native part so it works w emb libCs For the parts of the simulator which are dedicated for the native platforms (POSIX arch based): * Refactor the parts that interacts with the host, so it is possible to use it also with embedded libCs * Enhance it with more options to allow: * Keeping the content just in RAM * Erasing the EEPROM file at exit * Clearing the file at boot * Also show in the command line help the default file name. As part of this: * Update the kconfig dependencies, so we allow building it with other C libraries in the native targets * Update the table in the native_sim docs to indicate all C libraries are supproted now Signed-off-by: Alberto Escolar Piedras --- boards/native/native_sim/doc/index.rst | 2 +- drivers/eeprom/CMakeLists.txt | 9 +- drivers/eeprom/Kconfig | 1 - drivers/eeprom/eeprom_simulator.c | 98 +++++++++---------- drivers/eeprom/eeprom_simulator_native.c | 114 +++++++++++++++++++++++ drivers/eeprom/eeprom_simulator_native.h | 28 ++++++ 6 files changed, 195 insertions(+), 57 deletions(-) create mode 100644 drivers/eeprom/eeprom_simulator_native.c create mode 100644 drivers/eeprom/eeprom_simulator_native.h diff --git a/boards/native/native_sim/doc/index.rst b/boards/native/native_sim/doc/index.rst index 3f6033884b3f2..a83d1cd779048 100644 --- a/boards/native/native_sim/doc/index.rst +++ b/boards/native/native_sim/doc/index.rst @@ -702,7 +702,7 @@ host libC (:kconfig:option:`CONFIG_EXTERNAL_LIBC`): Console backend, :ref:`POSIX arch console `, :kconfig:option:`CONFIG_POSIX_ARCH_CONSOLE`, All Display, :ref:`Display SDL `, :kconfig:option:`CONFIG_SDL_DISPLAY`, All Entropy, :ref:`Native posix entropy `, :kconfig:option:`CONFIG_FAKE_ENTROPY_NATIVE_POSIX`, All - EEPROM, EEPROM simulator, :kconfig:option:`CONFIG_EEPROM_SIMULATOR`, Host libC + EEPROM, EEPROM simulator, :kconfig:option:`CONFIG_EEPROM_SIMULATOR`, All EEPROM, EEPROM emulator, :kconfig:option:`CONFIG_EEPROM_EMULATOR`, All Ethernet, :ref:`Eth native_posix `, :kconfig:option:`CONFIG_ETH_NATIVE_POSIX`, All Flash, :ref:`Flash simulator `, :kconfig:option:`CONFIG_FLASH_SIMULATOR`, All diff --git a/drivers/eeprom/CMakeLists.txt b/drivers/eeprom/CMakeLists.txt index 0e2ce2d01d42f..4b148e9f1a23b 100644 --- a/drivers/eeprom/CMakeLists.txt +++ b/drivers/eeprom/CMakeLists.txt @@ -10,7 +10,14 @@ zephyr_library_sources_ifdef(CONFIG_EEPROM_SHELL eeprom_shell.c) zephyr_library_sources_ifdef(CONFIG_EEPROM_AT2X eeprom_at2x.c) zephyr_library_sources_ifdef(CONFIG_EEPROM_LPC11U6X eeprom_lpc11u6x.c) zephyr_library_sources_ifdef(CONFIG_EEPROM_STM32 eeprom_stm32.c) -zephyr_library_sources_ifdef(CONFIG_EEPROM_SIMULATOR eeprom_simulator.c) +if(CONFIG_EEPROM_SIMULATOR) + zephyr_library_sources(eeprom_simulator.c) + if(CONFIG_NATIVE_LIBRARY) + target_sources(native_simulator INTERFACE eeprom_simulator_native.c) + elseif(CONFIG_ARCH_POSIX) + zephyr_library_sources(eeprom_simulator_native.c) + endif() +endif() zephyr_library_sources_ifdef(CONFIG_EEPROM_EMULATOR eeprom_emulator.c) zephyr_library_sources_ifdef(CONFIG_EEPROM_TMP116 eeprom_tmp116.c) zephyr_library_sources_ifdef(CONFIG_EEPROM_XEC eeprom_mchp_xec.c) diff --git a/drivers/eeprom/Kconfig b/drivers/eeprom/Kconfig index 9b85ffe6dc7ba..87733d2c2e1ce 100644 --- a/drivers/eeprom/Kconfig +++ b/drivers/eeprom/Kconfig @@ -104,7 +104,6 @@ config EEPROM_SIMULATOR bool "Simulated EEPROM driver" default y depends on DT_HAS_ZEPHYR_SIM_EEPROM_ENABLED - depends on !(ARCH_POSIX && !EXTERNAL_LIBC) select STATS select STATS_NAMES help diff --git a/drivers/eeprom/eeprom_simulator.c b/drivers/eeprom/eeprom_simulator.c index f6a604bcf6f75..a8daf71038744 100644 --- a/drivers/eeprom/eeprom_simulator.c +++ b/drivers/eeprom/eeprom_simulator.c @@ -8,18 +8,10 @@ #define DT_DRV_COMPAT zephyr_sim_eeprom #ifdef CONFIG_ARCH_POSIX -#undef _POSIX_C_SOURCE -/* Note: This is used only for interaction with the host C library, and is therefore exempt of - * coding guidelines rule A.4&5 which applies to the embedded code using embedded libraries - */ -#define _POSIX_C_SOURCE 200809L -#include -#include -#include -#include +#include "eeprom_simulator_native.h" #include "cmdline.h" #include "soc.h" -#endif +#endif /* CONFIG_ARCH_POSIX */ #include #include @@ -87,10 +79,13 @@ STATS_NAME(eeprom_sim_thresholds, max_len) STATS_NAME_END(eeprom_sim_thresholds); #ifdef CONFIG_ARCH_POSIX -static uint8_t *mock_eeprom; +static char *mock_eeprom; static int eeprom_fd = -1; static const char *eeprom_file_path; -static const char default_eeprom_file_path[] = "eeprom.bin"; +#define DEFAULT_EEPROM_FILE_PATH "eeprom.bin" +static bool eeprom_erase_at_start; +static bool eeprom_rm_at_exit; +static bool eeprom_in_ram; #else static uint8_t mock_eeprom[DT_INST_PROP(0, size)]; #endif /* CONFIG_ARCH_POSIX */ @@ -218,35 +213,22 @@ static const struct eeprom_sim_config eeprom_sim_config_0 = { static int eeprom_mock_init(const struct device *dev) { - if (eeprom_file_path == NULL) { - eeprom_file_path = default_eeprom_file_path; - } + int rc; - eeprom_fd = open(eeprom_file_path, O_RDWR | O_CREAT, (mode_t)0600); - if (eeprom_fd == -1) { - posix_print_warning("Failed to open eeprom device file " - "%s: %s\n", - eeprom_file_path, strerror(errno)); - return -EIO; - } + ARG_UNUSED(dev); - if (ftruncate(eeprom_fd, DT_INST_PROP(0, size)) == -1) { - posix_print_warning("Failed to resize eeprom device file " - "%s: %s\n", - eeprom_file_path, strerror(errno)); - return -EIO; + if (eeprom_in_ram == false && eeprom_file_path == NULL) { + eeprom_file_path = DEFAULT_EEPROM_FILE_PATH; } - mock_eeprom = mmap(NULL, DT_INST_PROP(0, size), - PROT_WRITE | PROT_READ, MAP_SHARED, eeprom_fd, 0); - if (mock_eeprom == MAP_FAILED) { - posix_print_warning("Failed to mmap eeprom device file " - "%s: %s\n", - eeprom_file_path, strerror(errno)); + rc = eeprom_mock_init_native(eeprom_in_ram, &mock_eeprom, DT_INST_PROP(0, size), &eeprom_fd, + eeprom_file_path, 0xFF, eeprom_erase_at_start); + + if (rc < 0) { return -EIO; + } else { + return 0; } - - return 0; } #else @@ -269,35 +251,43 @@ static int eeprom_sim_init(const struct device *dev) return eeprom_mock_init(dev); } -DEVICE_DT_INST_DEFINE(0, &eeprom_sim_init, NULL, - NULL, &eeprom_sim_config_0, POST_KERNEL, - CONFIG_EEPROM_INIT_PRIORITY, &eeprom_sim_api); +DEVICE_DT_INST_DEFINE(0, &eeprom_sim_init, NULL, NULL, &eeprom_sim_config_0, POST_KERNEL, + CONFIG_EEPROM_INIT_PRIORITY, &eeprom_sim_api); #ifdef CONFIG_ARCH_POSIX static void eeprom_native_cleanup(void) { - if ((mock_eeprom != MAP_FAILED) && (mock_eeprom != NULL)) { - munmap(mock_eeprom, DT_INST_PROP(0, size)); - } - - if (eeprom_fd != -1) { - close(eeprom_fd); - } + eeprom_mock_cleanup_native(eeprom_in_ram, eeprom_fd, mock_eeprom, DT_INST_PROP(0, size), + eeprom_file_path, eeprom_rm_at_exit); } static void eeprom_native_options(void) { static struct args_struct_t eeprom_options[] = { - { .manual = false, - .is_mandatory = false, - .is_switch = false, - .option = "eeprom", - .name = "path", - .type = 's', - .dest = (void *)&eeprom_file_path, - .call_when_found = NULL, - .descript = "Path to binary file to be used as eeprom" }, + {.option = "eeprom", + .name = "path", + .type = 's', + .dest = (void *)&eeprom_file_path, + .descript = "Path to binary file to be used as EEPROM, by default " + "\"" DEFAULT_EEPROM_FILE_PATH "\""}, + {.is_switch = true, + .option = "eeprom_erase", + .type = 'b', + .dest = (void *)&eeprom_erase_at_start, + .descript = "Erase the EEPROM content at startup"}, + {.is_switch = true, + .option = "eeprom_rm", + .type = 'b', + .dest = (void *)&eeprom_rm_at_exit, + .descript = "Remove the EEPROM file when terminating the execution"}, + {.is_switch = true, + .option = "eeprom_in_ram", + .type = 'b', + .dest = (void *)&eeprom_in_ram, + .descript = "Instead of a file, keep the file content just in RAM. If this is " + "set, eeprom, eeprom_erase & eeprom_rm are ignored, and the EEPROM " + "content is always erased at startup"}, ARG_TABLE_ENDMARKER }; diff --git a/drivers/eeprom/eeprom_simulator_native.c b/drivers/eeprom/eeprom_simulator_native.c new file mode 100644 index 0000000000000..52276e03fd195 --- /dev/null +++ b/drivers/eeprom/eeprom_simulator_native.c @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + * + * Part of EEPROM simulator which interacts with the host OS / Linux + * + * When building for the native simulator, this file is built in the + * native simulator runner/host context, and not in Zephyr/embedded context. + */ + +#undef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 200809L + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Initialize the EEPROM buffer. + * And, if the content is to be kept on disk map it to the buffer to the file. + * + * Returns -1 on failure + * 0 on success + */ +int eeprom_mock_init_native(bool eeprom_in_ram, char **mock_eeprom, unsigned int size, + int *eeprom_fd, const char *eeprom_file_path, unsigned int erase_value, + bool eeprom_erase_at_start) +{ + struct stat f_stat; + int rc; + + if (eeprom_in_ram == true) { + *mock_eeprom = (char *)malloc(size); + if (*mock_eeprom == NULL) { + nsi_print_warning("Could not allocate EEPROM in the process heap %s\n", + strerror(errno)); + return -1; + } + } else { + *eeprom_fd = open(eeprom_file_path, O_RDWR | O_CREAT, (mode_t)0600); + if (*eeprom_fd == -1) { + nsi_print_warning("Failed to open EEPROM device file %s: %s\n", + eeprom_file_path, strerror(errno)); + return -1; + } + + rc = fstat(*eeprom_fd, &f_stat); + if (rc) { + nsi_print_warning("Failed to get status of EEPROM device file %s: %s\n", + eeprom_file_path, strerror(errno)); + return -1; + } + + if (ftruncate(*eeprom_fd, size) == -1) { + nsi_print_warning("Failed to resize EEPROM device file %s: %s\n", + eeprom_file_path, strerror(errno)); + return -1; + } + + *mock_eeprom = mmap(NULL, size, PROT_WRITE | PROT_READ, MAP_SHARED, *eeprom_fd, 0); + if (*mock_eeprom == MAP_FAILED) { + nsi_print_warning("Failed to mmap EEPROM device file %s: %s\n", + eeprom_file_path, strerror(errno)); + return -1; + } + } + + if ((eeprom_erase_at_start == true) || (eeprom_in_ram == true) || (f_stat.st_size == 0)) { + /* Erase the EEPROM by setting all bits to the configured erase value */ + (void)memset(*mock_eeprom, erase_value, size); + } + + return 0; +} + +/* + * If in RAM: Free the mock buffer + * If in disk: unmap the eeprom file from RAM, close the file, and if configured to do so, + * delete the file. + */ +void eeprom_mock_cleanup_native(bool eeprom_in_ram, int eeprom_fd, char *mock_eeprom, + unsigned int size, const char *eeprom_file_path, + bool eeprom_rm_at_exit) +{ + + if (eeprom_in_ram == true) { + if (mock_eeprom != NULL) { + free(mock_eeprom); + } + return; + } + + if ((mock_eeprom != MAP_FAILED) && (mock_eeprom != NULL)) { + munmap(mock_eeprom, size); + } + + if (eeprom_fd != -1) { + close(eeprom_fd); + } + + if ((eeprom_rm_at_exit == true) && (eeprom_file_path != NULL)) { + /* We try to remove the file but do not error out if we can't */ + (void)remove(eeprom_file_path); + } +} diff --git a/drivers/eeprom/eeprom_simulator_native.h b/drivers/eeprom/eeprom_simulator_native.h new file mode 100644 index 0000000000000..ecd3071fef737 --- /dev/null +++ b/drivers/eeprom/eeprom_simulator_native.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef DRIVERS_EEPROM_EEPROM_SIMULATOR_NATIVE_H +#define DRIVERS_EEPROM_EEPROM_SIMULATOR_NATIVE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +int eeprom_mock_init_native(bool eeprom_in_ram, char **mock_eeprom, unsigned int size, + int *eeprom_fd, const char *eeprom_file_path, unsigned int erase_value, + bool eeprom_erase_at_start); + +void eeprom_mock_cleanup_native(bool eeprom_in_ram, int eeprom_fd, char *mock_eeprom, + unsigned int size, const char *eeprom_file_path, + bool eeprom_rm_at_exit); + +#ifdef __cplusplus +} +#endif + +#endif /* DRIVERS_EEPROM_EEPROM_SIMULATOR_NATIVE_H */ From c1e7784445acaf5772200294b05b35e3fc611015 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 27 Sep 2024 13:50:55 +0100 Subject: [PATCH 0083/4482] west.yml: MCUboot synchronization from upstream Update Zephyr fork of MCUboot to revision: 3a195f2207d5eadf45a5c989a870e91aff020d86 Brings following Zephyr relevant fixes: - 3a195f22 boot: bootutil: loader: Fix issue with using pointers - cc7b97be boot: boot_serial: Fix wrong usage of slot numbers - 30109df3 boot: bootutil: loader: Fix slot info for directXIP/RAM load - 7f3c77e1 boot: bootutil: Add write block size checking - c40d237a boot: zephyr: Add check for unexpected flash sector size - f9fc5918 boot: zephyr: Remove broken target config header feature - f8d8004e boot: zephyr: Allow disabling NRFX_WDT on nRF devices - fe26c289 boot: zephyr: boards: nxp: clean .conf files - b553290f Add Conexio Stratus Pro board configuration for DFU - 41df52e6 boot: SHA512 verification - 75672000 cmake: zephyr: change ERROR into FATAL_ERROR Signed-off-by: Jamie McCrae --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 1f5d8db576246..3df10c478eaa2 100644 --- a/west.yml +++ b/west.yml @@ -285,7 +285,7 @@ manifest: groups: - crypto - name: mcuboot - revision: e890df7ab975da181a9f3fb3abc470bf935625ab + revision: 3a195f2207d5eadf45a5c989a870e91aff020d86 path: bootloader/mcuboot groups: - bootloader From 20d17cfa6a711d5a03a65c21dfdc0b287c4b9916 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Fri, 27 Sep 2024 23:01:19 +0900 Subject: [PATCH 0084/4482] tests: drivers: build_all: charger: Add config for sbs,sbs-charger Add configuration to add `sbs,sbs-charger` to build test. Also, adding emulator build test. Signed-off-by: TOKITA Hiroshi --- tests/drivers/build_all/charger/i2c.dtsi | 5 +++++ tests/drivers/build_all/charger/testcase.yaml | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/tests/drivers/build_all/charger/i2c.dtsi b/tests/drivers/build_all/charger/i2c.dtsi index 94e93c51500e5..fcf77f8c30eee 100644 --- a/tests/drivers/build_all/charger/i2c.dtsi +++ b/tests/drivers/build_all/charger/i2c.dtsi @@ -39,3 +39,8 @@ bq25180@2 { constant-charge-current-max-microamp = <500000>; constant-charge-voltage-max-microvolt = <4200000>; }; + +sbs-charger@3 { + compatible = "sbs,sbs-charger"; + reg = <0x3>; +}; diff --git a/tests/drivers/build_all/charger/testcase.yaml b/tests/drivers/build_all/charger/testcase.yaml index 134fa0254c94c..fdf99e9ab77f2 100644 --- a/tests/drivers/build_all/charger/testcase.yaml +++ b/tests/drivers/build_all/charger/testcase.yaml @@ -9,3 +9,13 @@ tests: build_only: true platform_allow: - native_sim + + drivers.charger.emul.build: + tags: + - drivers + - charger + build_only: true + platform_allow: + - native_sim + extra_configs: + - CONFIG_EMUL=y From cb99cd795d546c3e6474ae5e346c5b58f43d625d Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Fri, 27 Sep 2024 23:25:38 +0900 Subject: [PATCH 0085/4482] tests: drivers: build_all: fuel_gauge: Add devices to build test Add build tests for the following devices. - maxim,max17048 - ti,bq27z746 - sbs,sbs-gauge-new-api - zephyr,fuel-gauge-composite Signed-off-by: TOKITA Hiroshi --- .../build_all/fuel_gauge/CMakeLists.txt | 8 +++ .../drivers/build_all/fuel_gauge/app.overlay | 65 +++++++++++++++++++ tests/drivers/build_all/fuel_gauge/i2c.dtsi | 26 ++++++++ tests/drivers/build_all/fuel_gauge/prj.conf | 3 + tests/drivers/build_all/fuel_gauge/src/main.c | 9 +++ .../build_all/fuel_gauge/testcase.yaml | 21 ++++++ 6 files changed, 132 insertions(+) create mode 100644 tests/drivers/build_all/fuel_gauge/CMakeLists.txt create mode 100644 tests/drivers/build_all/fuel_gauge/app.overlay create mode 100644 tests/drivers/build_all/fuel_gauge/i2c.dtsi create mode 100644 tests/drivers/build_all/fuel_gauge/prj.conf create mode 100644 tests/drivers/build_all/fuel_gauge/src/main.c create mode 100644 tests/drivers/build_all/fuel_gauge/testcase.yaml diff --git a/tests/drivers/build_all/fuel_gauge/CMakeLists.txt b/tests/drivers/build_all/fuel_gauge/CMakeLists.txt new file mode 100644 index 0000000000000..3742cd1ce05c6 --- /dev/null +++ b/tests/drivers/build_all/fuel_gauge/CMakeLists.txt @@ -0,0 +1,8 @@ +# Copyright (c) 2024 TOKITA Hiroshi +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(build_all) + +target_sources(app PRIVATE src/main.c) diff --git a/tests/drivers/build_all/fuel_gauge/app.overlay b/tests/drivers/build_all/fuel_gauge/app.overlay new file mode 100644 index 0000000000000..adf103f480e6a --- /dev/null +++ b/tests/drivers/build_all/fuel_gauge/app.overlay @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + + #include + +/ { + test { + #address-cells = <1>; + #size-cells = <1>; + + test_gpio: gpio@deadbeef { + compatible = "vnd,gpio"; + gpio-controller; + reg = <0xdeadbeef 0x1000>; + #gpio-cells = <0x2>; + status = "okay"; + }; + + test_i2c: i2c@11112222 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "vnd,i2c"; + reg = <0x11112222 0x1000>; + status = "okay"; + clock-frequency = ; + + #include "i2c.dtsi" + }; + + test_adc: adc@adc0adc0 { + compatible = "vnd,adc"; + reg = <0xadc0adc0 0x1000>; + #io-channel-cells = <1>; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_VDD_1"; + zephyr,acquisition-time = <0>; + }; + }; + + test_vbatt: vbatt { + compatible = "voltage-divider"; + io-channels = <&test_adc 0>; + output-ohms = <180000>; + full-ohms = <(1500000 + 180000)>; + power-gpios = <&gpio0 16 0>; + }; + + test_fuel_gauge: fuel_gauge { + compatible = "zephyr,fuel-gauge-composite"; + status = "okay"; + battery-voltage = <&test_vbatt>; + device-chemistry = "lithium-ion-polymer"; + ocv-capacity-table-0 = <0>; + charge-full-design-microamp-hours = <1350000>; + }; + }; +}; diff --git a/tests/drivers/build_all/fuel_gauge/i2c.dtsi b/tests/drivers/build_all/fuel_gauge/i2c.dtsi new file mode 100644 index 0000000000000..bd01a7a4aaad0 --- /dev/null +++ b/tests/drivers/build_all/fuel_gauge/i2c.dtsi @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + +/**************************************** + * PLEASE KEEP REG ADDRESSES SEQUENTIAL * + ***************************************/ + +max17048@0 { + compatible = "maxim,max17048"; + reg = <0x0>; + status = "okay"; +}; + +bq27z746@1 { + compatible = "ti,bq27z746"; + reg = <0x1>; + status = "okay"; +}; + +sbs-gauge-new-api@2 { + compatible = "sbs,sbs-gauge-new-api"; + reg = <0x2>; + status = "okay"; +}; diff --git a/tests/drivers/build_all/fuel_gauge/prj.conf b/tests/drivers/build_all/fuel_gauge/prj.conf new file mode 100644 index 0000000000000..4b10361f57992 --- /dev/null +++ b/tests/drivers/build_all/fuel_gauge/prj.conf @@ -0,0 +1,3 @@ +CONFIG_FUEL_GAUGE=y +CONFIG_SENSOR=y +CONFIG_GPIO=y diff --git a/tests/drivers/build_all/fuel_gauge/src/main.c b/tests/drivers/build_all/fuel_gauge/src/main.c new file mode 100644 index 0000000000000..175b9065f6778 --- /dev/null +++ b/tests/drivers/build_all/fuel_gauge/src/main.c @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + +int main(void) +{ + return 0; +} diff --git a/tests/drivers/build_all/fuel_gauge/testcase.yaml b/tests/drivers/build_all/fuel_gauge/testcase.yaml new file mode 100644 index 0000000000000..0461e0590aa3a --- /dev/null +++ b/tests/drivers/build_all/fuel_gauge/testcase.yaml @@ -0,0 +1,21 @@ +# Copyright (c) 2024 TOKITA hiroshi +# SPDX-License-Identifier: Apache-2.0 + +tests: + drivers.fuel_gauge.build: + tags: + - drivers + - fuel_gauge + build_only: true + platform_allow: + - native_sim + + drivers.fuel_gauge.emul.build: + tags: + - drivers + - fuel_gauge + build_only: true + platform_allow: + - native_sim + extra_configs: + - CONFIG_EMUL=y From 41533a2eea227ae2ae720a97ab166178a82934bc Mon Sep 17 00:00:00 2001 From: Florian Grandel Date: Fri, 6 Sep 2024 11:09:29 +0200 Subject: [PATCH 0086/4482] scripts: build: check_init_priorities: remove obsolete code Removes a snippet of dead code. Signed-off-by: Florian Grandel --- scripts/build/check_init_priorities.py | 11 -------- scripts/build/check_init_priorities_test.py | 29 --------------------- 2 files changed, 40 deletions(-) diff --git a/scripts/build/check_init_priorities.py b/scripts/build/check_init_priorities.py index 4e2c50ddf27aa..dc028aa31de28 100755 --- a/scripts/build/check_init_priorities.py +++ b/scripts/build/check_init_priorities.py @@ -41,10 +41,6 @@ _DEVICE_INIT_LEVELS = ["EARLY", "PRE_KERNEL_1", "PRE_KERNEL_2", "POST_KERNEL", "APPLICATION", "SMP"] -# List of compatibles for node where the initialization priority should be the -# opposite of the device tree inferred dependency. -_INVERTED_PRIORITY_COMPATIBLES = frozenset() - # List of compatibles for nodes where we don't check the priority. _IGNORE_COMPATIBLES = frozenset([ # There is no direct dependency between the CDC ACM UART and the USB @@ -260,13 +256,6 @@ def _check_dep(self, dev_ord, dep_ord): self.log.info(f"Ignoring priority: {dev_node._binding.compatible}") return - if dev_node._binding and dep_node._binding: - dev_compat = dev_node._binding.compatible - dep_compat = dep_node._binding.compatible - if (dev_compat, dep_compat) in _INVERTED_PRIORITY_COMPATIBLES: - self.log.info(f"Swapped priority: {dev_compat}, {dep_compat}") - dev_ord, dep_ord = dep_ord, dev_ord - dev_prio, dev_init = self._obj.devices.get(dev_ord, (None, None)) dep_prio, dep_init = self._obj.devices.get(dep_ord, (None, None)) diff --git a/scripts/build/check_init_priorities_test.py b/scripts/build/check_init_priorities_test.py index c7b2aabb25f46..16cf9af740650 100755 --- a/scripts/build/check_init_priorities_test.py +++ b/scripts/build/check_init_priorities_test.py @@ -332,35 +332,6 @@ def test_check_same_prio_assert(self, mock_vinit): with self.assertRaises(ValueError): validator._check_dep(1, 2) - @mock.patch("check_init_priorities.Validator.__init__", return_value=None) - def test_check_swapped(self, mock_vinit): - validator = check_init_priorities.Validator("", "", None) - validator.log = mock.Mock() - validator._obj = mock.Mock() - validator.errors = 0 - - save_inverted_priorities = check_init_priorities._INVERTED_PRIORITY_COMPATIBLES - - check_init_priorities._INVERTED_PRIORITY_COMPATIBLES = set([("compat-3", "compat-1")]) - - validator._ord2node = {1: mock.Mock(), 3: mock.Mock()} - validator._ord2node[1]._binding.compatible = "compat-1" - validator._ord2node[1].path = "/1" - validator._ord2node[3]._binding.compatible = "compat-3" - validator._ord2node[3].path = "/3" - - validator._obj.devices = {1: (20, "i1"), 3: (10, "i3")} - - validator._check_dep(3, 1) - - self.assertListEqual(validator.log.info.call_args_list, [ - mock.call("Swapped priority: compat-3, compat-1"), - mock.call("/3 20 > /1 10"), - ]) - self.assertEqual(validator.errors, 0) - - check_init_priorities._INVERTED_PRIORITY_COMPATIBLES = save_inverted_priorities - @mock.patch("check_init_priorities.Validator.__init__", return_value=None) def test_check_ignored(self, mock_vinit): validator = check_init_priorities.Validator("", "", None) From e9adbe4077baab3c91f0e139a504dfc00d75b732 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 28 Sep 2024 10:25:03 +0900 Subject: [PATCH 0087/4482] drivers: input: sbus: Remove unused `pinctrl.h` including This source does not reference any pinctrl functions. Removing the unused header. Signed-off-by: TOKITA Hiroshi --- drivers/input/input_sbus.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/input/input_sbus.c b/drivers/input/input_sbus.c index ef88f5fc677f0..b720e1427a013 100644 --- a/drivers/input/input_sbus.c +++ b/drivers/input/input_sbus.c @@ -8,7 +8,6 @@ #define DT_DRV_COMPAT futaba_sbus #include -#include #include #include #include From 00eaa850b2b4dfb743c38bdcaeb657b6e7b75a30 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 28 Sep 2024 10:30:35 +0900 Subject: [PATCH 0088/4482] drivers: input: sbus: Fix incorrect index reference of INPUT_SBUS_INIT The argument of INPUT_SBUS_INIT is named `n,` but there are some places where it references `id.` Correcting these. Signed-off-by: TOKITA Hiroshi --- drivers/input/input_sbus.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/input/input_sbus.c b/drivers/input/input_sbus.c index b720e1427a013..b9eb44e03e668 100644 --- a/drivers/input/input_sbus.c +++ b/drivers/input/input_sbus.c @@ -355,7 +355,7 @@ static int input_sbus_init(const struct device *dev) #define INPUT_SBUS_INIT(n) \ \ - static const struct sbus_input_channel input_##id[] = { \ + static const struct sbus_input_channel input_##n[] = { \ DT_INST_FOREACH_CHILD(n, SBUS_INPUT_CHANNEL_INITIALIZER) \ }; \ DT_INST_FOREACH_CHILD(n, INPUT_CHANNEL_CHECK) \ @@ -363,9 +363,9 @@ static int input_sbus_init(const struct device *dev) static struct input_sbus_data sbus_data_##n; \ \ static const struct input_sbus_config sbus_cfg_##n = { \ - .channel_info = input_##id, \ + .channel_info = input_##n, \ .uart_dev = DEVICE_DT_GET(DT_INST_BUS(n)), \ - .num_channels = ARRAY_SIZE(input_##id), \ + .num_channels = ARRAY_SIZE(input_##n), \ .cb = sbus_uart_isr, \ }; \ \ From cc6dfb6220ab2a07d44e8b8e8406601c7902c471 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Fri, 27 Sep 2024 11:16:55 +0900 Subject: [PATCH 0089/4482] tests: drivers: build_all: input: Add config for futaba,sbus Add configuration to add `futaba,sbus` to build test. Signed-off-by: TOKITA Hiroshi --- tests/drivers/build_all/input/app.overlay | 20 ++++++++++++++++++++ tests/drivers/build_all/input/prj.conf | 2 ++ 2 files changed, 22 insertions(+) diff --git a/tests/drivers/build_all/input/app.overlay b/tests/drivers/build_all/input/app.overlay index 06e91145fa132..80be92b765d25 100644 --- a/tests/drivers/build_all/input/app.overlay +++ b/tests/drivers/build_all/input/app.overlay @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + / { test { #address-cells = <1>; @@ -162,6 +164,24 @@ double-tap-delay-ms = <0>; }; + test_uart: uart@55556666 { + compatible = "vnd,serial"; + reg = <0x55556666 0x1000>; + status = "okay"; + + #address-cells = <1>; + #size-cells = <0>; + + sbus { + compatible = "futaba,sbus"; + right_stick_x { + channel = <1>; + type = ; + zephyr,code = ; + }; + }; + }; + i2c@1 { #address-cells = <1>; #size-cells = <0>; diff --git a/tests/drivers/build_all/input/prj.conf b/tests/drivers/build_all/input/prj.conf index d87817b31bd7c..9f77aa3dfa3c5 100644 --- a/tests/drivers/build_all/input/prj.conf +++ b/tests/drivers/build_all/input/prj.conf @@ -1,2 +1,4 @@ CONFIG_GPIO=y CONFIG_INPUT=y +CONFIG_SERIAL=y +CONFIG_UART_INTERRUPT_DRIVEN=y From 1f30346d4fce15181a855c28d94c7bd014c5bb3b Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sun, 29 Sep 2024 09:06:58 +0900 Subject: [PATCH 0090/4482] drivers: dac: Add dummy driver for vnd,dac Add dummy driver for "vnd,dac" to use in build_all tests. Signed-off-by: TOKITA Hiroshi --- drivers/dac/CMakeLists.txt | 1 + drivers/dac/Kconfig | 2 ++ drivers/dac/Kconfig.test | 6 +++++ drivers/dac/dac_test.c | 45 ++++++++++++++++++++++++++++++++++ dts/bindings/test/vnd,dac.yaml | 8 ++++++ 5 files changed, 62 insertions(+) create mode 100644 drivers/dac/Kconfig.test create mode 100644 drivers/dac/dac_test.c create mode 100644 dts/bindings/test/vnd,dac.yaml diff --git a/drivers/dac/CMakeLists.txt b/drivers/dac/CMakeLists.txt index d6869cc234a1c..eec91be800a21 100644 --- a/drivers/dac/CMakeLists.txt +++ b/drivers/dac/CMakeLists.txt @@ -24,3 +24,4 @@ zephyr_library_sources_ifdef(CONFIG_DAC_AD56XX dac_ad56xx.c) zephyr_library_sources_ifdef(CONFIG_DAC_AD569X dac_ad569x.c) zephyr_library_sources_ifdef(CONFIG_USERSPACE dac_handlers.c) zephyr_library_sources_ifdef(CONFIG_DAC_MCUX_GAU dac_mcux_gau.c) +zephyr_library_sources_ifdef(CONFIG_DAC_TEST dac_test.c) diff --git a/drivers/dac/Kconfig b/drivers/dac/Kconfig index 08680b964048d..26b17f1a31d57 100644 --- a/drivers/dac/Kconfig +++ b/drivers/dac/Kconfig @@ -59,4 +59,6 @@ source "drivers/dac/Kconfig.ad559x" source "drivers/dac/Kconfig.ad569x" +source "drivers/dac/Kconfig.test" + endif # DAC diff --git a/drivers/dac/Kconfig.test b/drivers/dac/Kconfig.test new file mode 100644 index 0000000000000..dbca0a8c8ba0b --- /dev/null +++ b/drivers/dac/Kconfig.test @@ -0,0 +1,6 @@ +# Copyright (c) 2024 TOKITA Hiroshi +# SPDX-License-Identifier: Apache-2.0 + +config DAC_TEST + def_bool DT_HAS_VND_DAC_ENABLED + depends on DT_HAS_VND_DAC_ENABLED diff --git a/drivers/dac/dac_test.c b/drivers/dac/dac_test.c new file mode 100644 index 0000000000000..24880c5bcc45f --- /dev/null +++ b/drivers/dac/dac_test.c @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT vnd_dac + +#include +#include + +int vnd_dac_channel_setup(const struct device *dev, const struct dac_channel_cfg *channel_cfg) +{ + ARG_UNUSED(dev); + ARG_UNUSED(channel_cfg); + + return -ENOTSUP; +} + +int vnd_dac_write_value(const struct device *dev, uint8_t channel, uint32_t value) +{ + ARG_UNUSED(dev); + ARG_UNUSED(channel); + ARG_UNUSED(value); + + return -ENOTSUP; +} + +static const struct dac_driver_api vnd_dac_driver_api = { + .channel_setup = vnd_dac_channel_setup, + .write_value = vnd_dac_write_value, +}; + +static int vnd_dac_init(const struct device *dev) +{ + ARG_UNUSED(dev); + + return 0; +} + +#define VND_DAC_INIT(index) \ + DEVICE_DT_INST_DEFINE(index, &vnd_dac_init, NULL, NULL, NULL, POST_KERNEL, \ + CONFIG_DAC_INIT_PRIORITY, &vnd_dac_driver_api); + +DT_INST_FOREACH_STATUS_OKAY(VND_DAC_INIT) diff --git a/dts/bindings/test/vnd,dac.yaml b/dts/bindings/test/vnd,dac.yaml new file mode 100644 index 0000000000000..b7682b22d51f6 --- /dev/null +++ b/dts/bindings/test/vnd,dac.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2024 TOKITA Hiroshi +# SPDX-License-Identifier: Apache-2.0 + +description: Test DAC node + +compatible: "vnd,dac" + +include: dac-controller.yaml From e3438585b5eeab3c1df5d03d00650012ae735235 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 28 Sep 2024 17:39:01 +0900 Subject: [PATCH 0091/4482] tests: drivers: build_all: sensor: Adding Festo VEAA pressure regulator Add "festo,veaa-x-3" to testing targets. Signed-off-by: TOKITA Hiroshi --- tests/drivers/build_all/sensor/adc.dtsi | 10 ++++++++++ tests/drivers/build_all/sensor/app.overlay | 7 +++++++ tests/drivers/build_all/sensor/prj.conf | 1 + 3 files changed, 18 insertions(+) diff --git a/tests/drivers/build_all/sensor/adc.dtsi b/tests/drivers/build_all/sensor/adc.dtsi index 87cf64faae91f..583839feff1c1 100644 --- a/tests/drivers/build_all/sensor/adc.dtsi +++ b/tests/drivers/build_all/sensor/adc.dtsi @@ -116,3 +116,13 @@ test_seeed_grove_temperature: seeed-grove-temperature { compatible = "seeed,grove-temperature"; io-channels = <&test_adc 0>; }; + +test_veaa_x_3: test_veaa_x_3 { + status = "okay"; + compatible = "festo,veaa-x-3"; + io-channels = <&test_adc 3>; + dac = <&test_dac>; + dac-channel-id = <2>; + dac-resolution = <12>; + pressure-range-type = "D2"; +}; diff --git a/tests/drivers/build_all/sensor/app.overlay b/tests/drivers/build_all/sensor/app.overlay index ebfa224848a32..5b1d17ce3fee2 100644 --- a/tests/drivers/build_all/sensor/app.overlay +++ b/tests/drivers/build_all/sensor/app.overlay @@ -53,6 +53,13 @@ #include "adc.dtsi" }; + test_dac: dac@dac0dac0 { + compatible = "vnd,dac"; + reg = <0xdac0dac0 0x1000>; + status = "okay"; + #io-channel-cells = <1>; + }; + test_gpio: gpio@deadbeef { compatible = "vnd,gpio"; gpio-controller; diff --git a/tests/drivers/build_all/sensor/prj.conf b/tests/drivers/build_all/sensor/prj.conf index a0683d0ce16f4..3283fba0a0111 100644 --- a/tests/drivers/build_all/sensor/prj.conf +++ b/tests/drivers/build_all/sensor/prj.conf @@ -4,6 +4,7 @@ CONFIG_LOG=y CONFIG_SENSOR_LOG_LEVEL_DBG=y CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000 CONFIG_ADC=y +CONFIG_DAC=y CONFIG_GPIO=y CONFIG_I2C=y CONFIG_I3C=y From 92ec60f5abac71bb35c1a93bbf1d7b23ec05bafd Mon Sep 17 00:00:00 2001 From: Ian Morris Date: Mon, 22 Jul 2024 16:49:44 -0700 Subject: [PATCH 0092/4482] drivers: sensor: renesas: Move to vendor subdirectory Moves all Renesas sensor drivers into a vendor specific subdirectory matching the organization used for other drivers. Signed-off-by: Ian Morris --- drivers/sensor/CMakeLists.txt | 3 +-- drivers/sensor/Kconfig | 3 +-- drivers/sensor/renesas/CMakeLists.txt | 7 +++++++ drivers/sensor/renesas/Kconfig | 7 +++++++ drivers/sensor/{ => renesas}/hs300x/CMakeLists.txt | 0 drivers/sensor/{ => renesas}/hs300x/Kconfig | 0 drivers/sensor/{ => renesas}/hs300x/hs300x.c | 0 drivers/sensor/{ => renesas}/isl29035/CMakeLists.txt | 0 drivers/sensor/{ => renesas}/isl29035/Kconfig | 0 drivers/sensor/{ => renesas}/isl29035/isl29035.c | 0 drivers/sensor/{ => renesas}/isl29035/isl29035.h | 0 drivers/sensor/{ => renesas}/isl29035/isl29035_trigger.c | 0 12 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 drivers/sensor/renesas/CMakeLists.txt create mode 100644 drivers/sensor/renesas/Kconfig rename drivers/sensor/{ => renesas}/hs300x/CMakeLists.txt (100%) rename drivers/sensor/{ => renesas}/hs300x/Kconfig (100%) rename drivers/sensor/{ => renesas}/hs300x/hs300x.c (100%) rename drivers/sensor/{ => renesas}/isl29035/CMakeLists.txt (100%) rename drivers/sensor/{ => renesas}/isl29035/Kconfig (100%) rename drivers/sensor/{ => renesas}/isl29035/isl29035.c (100%) rename drivers/sensor/{ => renesas}/isl29035/isl29035.h (100%) rename drivers/sensor/{ => renesas}/isl29035/isl29035_trigger.c (100%) diff --git a/drivers/sensor/CMakeLists.txt b/drivers/sensor/CMakeLists.txt index 1ea25775c45ce..f5808b7cd5dac 100644 --- a/drivers/sensor/CMakeLists.txt +++ b/drivers/sensor/CMakeLists.txt @@ -18,6 +18,7 @@ add_subdirectory(microchip) add_subdirectory(nordic) add_subdirectory(nuvoton) add_subdirectory(nxp) +add_subdirectory(renesas) add_subdirectory(rohm) add_subdirectory(seeed) add_subdirectory(sensirion) @@ -41,9 +42,7 @@ add_subdirectory_ifdef(CONFIG_F75303 f75303) add_subdirectory_ifdef(CONFIG_FCX_MLDX5 fcx_mldx5) add_subdirectory_ifdef(CONFIG_GROW_R502A grow_r502a) add_subdirectory_ifdef(CONFIG_HP206C hp206c) -add_subdirectory_ifdef(CONFIG_HS300X hs300x) add_subdirectory_ifdef(CONFIG_IST8310 ist8310) -add_subdirectory_ifdef(CONFIG_ISL29035 isl29035) add_subdirectory_ifdef(CONFIG_LM35 lm35) add_subdirectory_ifdef(CONFIG_LM75 lm75) add_subdirectory_ifdef(CONFIG_LM77 lm77) diff --git a/drivers/sensor/Kconfig b/drivers/sensor/Kconfig index d4f0c8263266c..0fc8252408d8d 100644 --- a/drivers/sensor/Kconfig +++ b/drivers/sensor/Kconfig @@ -102,6 +102,7 @@ source "drivers/sensor/microchip/Kconfig" source "drivers/sensor/nordic/Kconfig" source "drivers/sensor/nuvoton/Kconfig" source "drivers/sensor/nxp/Kconfig" +source "drivers/sensor/renesas/Kconfig" source "drivers/sensor/rohm/Kconfig" source "drivers/sensor/seeed/Kconfig" source "drivers/sensor/sensirion/Kconfig" @@ -125,8 +126,6 @@ source "drivers/sensor/f75303/Kconfig" source "drivers/sensor/fcx_mldx5/Kconfig" source "drivers/sensor/grow_r502a/Kconfig" source "drivers/sensor/hp206c/Kconfig" -source "drivers/sensor/hs300x/Kconfig" -source "drivers/sensor/isl29035/Kconfig" source "drivers/sensor/ist8310/Kconfig" source "drivers/sensor/lm35/Kconfig" source "drivers/sensor/lm75/Kconfig" diff --git a/drivers/sensor/renesas/CMakeLists.txt b/drivers/sensor/renesas/CMakeLists.txt new file mode 100644 index 0000000000000..28ff2d1db9fa6 --- /dev/null +++ b/drivers/sensor/renesas/CMakeLists.txt @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Ian Morris +# SPDX-License-Identifier: Apache-2.0 + +# zephyr-keep-sorted-start +add_subdirectory_ifdef(CONFIG_HS300X hs300x) +add_subdirectory_ifdef(CONFIG_ISL29035 isl29035) +# zephyr-keep-sorted-stop diff --git a/drivers/sensor/renesas/Kconfig b/drivers/sensor/renesas/Kconfig new file mode 100644 index 0000000000000..00d5dd6b796e2 --- /dev/null +++ b/drivers/sensor/renesas/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Ian Morris +# SPDX-License-Identifier: Apache-2.0 + +# zephyr-keep-sorted-start +source "drivers/sensor/renesas/hs300x/Kconfig" +source "drivers/sensor/renesas/isl29035/Kconfig" +# zephyr-keep-sorted-stop diff --git a/drivers/sensor/hs300x/CMakeLists.txt b/drivers/sensor/renesas/hs300x/CMakeLists.txt similarity index 100% rename from drivers/sensor/hs300x/CMakeLists.txt rename to drivers/sensor/renesas/hs300x/CMakeLists.txt diff --git a/drivers/sensor/hs300x/Kconfig b/drivers/sensor/renesas/hs300x/Kconfig similarity index 100% rename from drivers/sensor/hs300x/Kconfig rename to drivers/sensor/renesas/hs300x/Kconfig diff --git a/drivers/sensor/hs300x/hs300x.c b/drivers/sensor/renesas/hs300x/hs300x.c similarity index 100% rename from drivers/sensor/hs300x/hs300x.c rename to drivers/sensor/renesas/hs300x/hs300x.c diff --git a/drivers/sensor/isl29035/CMakeLists.txt b/drivers/sensor/renesas/isl29035/CMakeLists.txt similarity index 100% rename from drivers/sensor/isl29035/CMakeLists.txt rename to drivers/sensor/renesas/isl29035/CMakeLists.txt diff --git a/drivers/sensor/isl29035/Kconfig b/drivers/sensor/renesas/isl29035/Kconfig similarity index 100% rename from drivers/sensor/isl29035/Kconfig rename to drivers/sensor/renesas/isl29035/Kconfig diff --git a/drivers/sensor/isl29035/isl29035.c b/drivers/sensor/renesas/isl29035/isl29035.c similarity index 100% rename from drivers/sensor/isl29035/isl29035.c rename to drivers/sensor/renesas/isl29035/isl29035.c diff --git a/drivers/sensor/isl29035/isl29035.h b/drivers/sensor/renesas/isl29035/isl29035.h similarity index 100% rename from drivers/sensor/isl29035/isl29035.h rename to drivers/sensor/renesas/isl29035/isl29035.h diff --git a/drivers/sensor/isl29035/isl29035_trigger.c b/drivers/sensor/renesas/isl29035/isl29035_trigger.c similarity index 100% rename from drivers/sensor/isl29035/isl29035_trigger.c rename to drivers/sensor/renesas/isl29035/isl29035_trigger.c From 26314cf7609aed74e5fde34d07a9464ab5ea1ed8 Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Fri, 27 Sep 2024 17:49:45 -0300 Subject: [PATCH 0093/4482] tests: clock_control: esp32: Fix device testing Select modules which are not sensitive for testing. Signed-off-by: Raffael Rostagno --- .../clock_control_api/src/esp32_device_subsys.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/drivers/clock_control/clock_control_api/src/esp32_device_subsys.h b/tests/drivers/clock_control/clock_control_api/src/esp32_device_subsys.h index 425511766b2f8..2e197611e0176 100644 --- a/tests/drivers/clock_control/clock_control_api/src/esp32_device_subsys.h +++ b/tests/drivers/clock_control/clock_control_api/src/esp32_device_subsys.h @@ -12,9 +12,15 @@ static const struct device_subsys_data subsys_data[] = { {.subsys = (void *) ESP32_LEDC_MODULE}, {.subsys = (void *) ESP32_UART1_MODULE}, {.subsys = (void *) ESP32_I2C0_MODULE}, +#if !defined(CONFIG_SOC_SERIES_ESP32C2) {.subsys = (void *) ESP32_UHCI0_MODULE}, - {.subsys = (void *) ESP32_RMT_MODULE}, - {.subsys = (void *) ESP32_TWAI_MODULE}, +#endif +#if defined(CONFIG_SOC_SERIES_ESP32C3) || defined(CONFIG_SOC_SERIES_ESP32S2) || \ + defined(CONFIG_SOC_SERIES_ESP32S3) + {.subsys = (void *) ESP32_TIMG1_MODULE}, +#else + {.subsys = (void *) ESP32_TIMG0_MODULE}, +#endif {.subsys = (void *) ESP32_RNG_MODULE}, }; From 724376de33ac620c2967667c738994367d27d165 Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Sat, 28 Sep 2024 11:36:47 -0300 Subject: [PATCH 0094/4482] drivers: clock_control: esp32: Fix for UART baud Fixes UART baud rate adjustment for ESP32 devices. Signed-off-by: Raffael Rostagno --- drivers/clock_control/clock_control_esp32.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/clock_control/clock_control_esp32.c b/drivers/clock_control/clock_control_esp32.c index 314d4e4eadc8f..f911e4cb67d8f 100644 --- a/drivers/clock_control/clock_control_esp32.c +++ b/drivers/clock_control/clock_control_esp32.c @@ -689,9 +689,6 @@ static int esp32_cpu_clock_configure(const struct esp32_cpu_clock_config *cpu_cf #if !defined(ESP_CONSOLE_UART_NONE) #if !defined(CONFIG_SOC_SERIES_ESP32C2) && !defined(CONFIG_SOC_SERIES_ESP32C6) uint32_t uart_clock_src_hz = esp_clk_apb_freq(); -#if ESP_ROM_UART_CLK_IS_XTAL - uart_clock_src_hz = (uint32_t)rtc_clk_xtal_freq_get() * MHZ(1); -#endif esp_rom_uart_set_clock_baudrate(ESP_CONSOLE_UART_NUM, uart_clock_src_hz, ESP_CONSOLE_UART_BAUDRATE); From a3556aafb76857eab7dc3bd51439872ec550f540 Mon Sep 17 00:00:00 2001 From: Arrel Neumiller Date: Sun, 29 Sep 2024 10:11:22 +0100 Subject: [PATCH 0095/4482] doc: kconfig: clarify .config file location Fixes issue #78815 Specifies explicitly the location of the generated .config file relative to the build directory. Signed-off-by: Arrel Neumiller --- doc/build/kconfig/setting.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/build/kconfig/setting.rst b/doc/build/kconfig/setting.rst index 05308589d53f6..3a70d90da8219 100644 --- a/doc/build/kconfig/setting.rst +++ b/doc/build/kconfig/setting.rst @@ -91,8 +91,8 @@ this: # CONFIG_SOME_OTHER_BOOL is not set - This is the format you will see in the merged configuration in - :file:`zephyr/.config`. + This is the format you will see in the merged configuration + saved to :file:`zephyr/.config` in the build directory. This style is accepted for historical reasons: Kconfig configuration files can be parsed as makefiles (though Zephyr doesn't use this). Having From 5bd53b6e2ecce7581300499dc9b8c01510d0eb27 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Mon, 1 Apr 2024 15:42:36 +1000 Subject: [PATCH 0096/4482] uart: update meaning of `uart_irq_tx_ready` return code Update the documented value range that `uart_irq_tx_ready` returns in order to provide more information to the callers about the number of bytes that could be writted with `uart_fifo_fill` without fragmentation. Signed-off-by: Jordan Yates --- doc/releases/migration-guide-4.0.rst | 4 ++++ include/zephyr/drivers/uart.h | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index a5678523a2cf0..5444f426fe1f6 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -208,6 +208,10 @@ Sensors Serial ====== + * Users of :c:func:`uart_irq_tx_ready` now need to check for ``ret > 0`` to ensure that the FIFO + can accept data bytes, instead of ``ret == 1``. The function now returns a lower bound on the + number of bytes that can be provided to :c:func:`uart_fifo_fill` without truncation. + Regulator ========= diff --git a/include/zephyr/drivers/uart.h b/include/zephyr/drivers/uart.h index 845949ea96401..7d56a78b056cc 100644 --- a/include/zephyr/drivers/uart.h +++ b/include/zephyr/drivers/uart.h @@ -902,9 +902,9 @@ static inline void z_impl_uart_irq_tx_disable(const struct device *dev) } /** - * @brief Check if UART TX buffer can accept a new char + * @brief Check if UART TX buffer can accept bytes * - * @details Check if UART TX buffer can accept at least one character + * @details Check if UART TX buffer can accept more bytes * for transmission (i.e. uart_fifo_fill() will succeed and return * non-zero). This function must be called in a UART interrupt * handler, or its result is undefined. Before calling this function @@ -913,9 +913,11 @@ static inline void z_impl_uart_irq_tx_disable(const struct device *dev) * * @param dev UART device instance. * - * @retval 1 If TX interrupt is enabled and at least one char can be - * written to UART. * @retval 0 If device is not ready to write a new byte. + * @retval >0 Minimum number of bytes that can be written in a single call to + * @ref uart_fifo_fill. It may be possible to write more bytes, but + * the actual number written must be checked in the return code from + * @ref uart_fifo_fill. * @retval -ENOSYS If this function is not implemented. * @retval -ENOTSUP If API is not enabled. */ From 81352d011f14a01c803d20661bddd2086aa572c7 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Mon, 1 Apr 2024 15:45:39 +1000 Subject: [PATCH 0097/4482] serial/usb: update `struct ring_buf` users Update the interrupt driver UART drivers that use `struct ring_buf` internally to report the number of bytes that can be pushed in `uart_fifo_fill` without fragmentation. Signed-off-by: Jordan Yates --- drivers/serial/serial_test.c | 6 +++--- drivers/serial/uart_emul.c | 6 +++--- subsys/usb/device/class/cdc_acm.c | 2 +- subsys/usb/device_next/class/usbd_cdc_acm.c | 4 +--- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/serial/serial_test.c b/drivers/serial/serial_test.c index b1bb46228beb2..f04f5eee702cb 100644 --- a/drivers/serial/serial_test.c +++ b/drivers/serial/serial_test.c @@ -130,10 +130,10 @@ static void irq_tx_disable(const struct device *dev) static int irq_tx_ready(const struct device *dev) { struct serial_vnd_data *data = dev->data; - bool ready = (ring_buf_space_get(data->written) != 0); + int available = ring_buf_space_get(data->written); - LOG_DBG("tx ready: %d", ready); - return ready; + LOG_DBG("tx ready: %d", available); + return available; } static void irq_callback_set(const struct device *dev, uart_irq_callback_user_data_t cb, diff --git a/drivers/serial/uart_emul.c b/drivers/serial/uart_emul.c index f020737773765..a00f10486b129 100644 --- a/drivers/serial/uart_emul.c +++ b/drivers/serial/uart_emul.c @@ -231,7 +231,7 @@ static int uart_emul_fifo_read(const struct device *dev, uint8_t *rx_data, int s static int uart_emul_irq_tx_ready(const struct device *dev) { - bool ready = false; + int available = 0; struct uart_emul_data *data = dev->data; K_SPINLOCK(&data->tx_lock) { @@ -239,10 +239,10 @@ static int uart_emul_irq_tx_ready(const struct device *dev) K_SPINLOCK_BREAK; } - ready = ring_buf_space_get(data->tx_rb) > 0; + available = ring_buf_space_get(data->tx_rb); } - return ready; + return available; } static int uart_emul_irq_rx_ready(const struct device *dev) diff --git a/subsys/usb/device/class/cdc_acm.c b/subsys/usb/device/class/cdc_acm.c index 130e571b0f660..5cc73f7bae991 100644 --- a/subsys/usb/device/class/cdc_acm.c +++ b/subsys/usb/device/class/cdc_acm.c @@ -622,7 +622,7 @@ static int cdc_acm_irq_tx_ready(const struct device *dev) struct cdc_acm_dev_data_t * const dev_data = dev->data; if (dev_data->tx_irq_ena && dev_data->tx_ready) { - return 1; + return ring_buf_space_get(dev_data->tx_ringbuf); } return 0; diff --git a/subsys/usb/device_next/class/usbd_cdc_acm.c b/subsys/usb/device_next/class/usbd_cdc_acm.c index eb0abb803cee3..acb17ed446f40 100644 --- a/subsys/usb/device_next/class/usbd_cdc_acm.c +++ b/subsys/usb/device_next/class/usbd_cdc_acm.c @@ -707,9 +707,7 @@ static int cdc_acm_irq_tx_ready(const struct device *dev) struct cdc_acm_uart_data *const data = dev->data; if (check_wq_ctx(dev)) { - if (ring_buf_space_get(data->tx_fifo.rb)) { - return 1; - } + return ring_buf_space_get(data->tx_fifo.rb); } else { LOG_WRN("Invoked by inappropriate context"); __ASSERT_NO_MSG(false); From 3e5c72a0ee212418eb12f93afbe5e30a4585e2c5 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Mon, 1 Apr 2024 15:53:50 +1000 Subject: [PATCH 0098/4482] serial: async_to_irq: update `tx_ready` return The async IRQ shim supports writes of any size up to the TX buffer size. Signed-off-by: Jordan Yates --- drivers/serial/uart_async_to_irq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/serial/uart_async_to_irq.c b/drivers/serial/uart_async_to_irq.c index 897ff50fcb576..b67dd6505aab6 100644 --- a/drivers/serial/uart_async_to_irq.c +++ b/drivers/serial/uart_async_to_irq.c @@ -263,8 +263,10 @@ void z_uart_async_to_irq_irq_tx_disable(const struct device *dev) int z_uart_async_to_irq_irq_tx_ready(const struct device *dev) { struct uart_async_to_irq_data *data = get_data(dev); + bool ready = (data->flags & A2I_TX_IRQ_ENABLED) && !(data->flags & A2I_TX_BUSY); - return (data->flags & A2I_TX_IRQ_ENABLED) && !(data->flags & A2I_TX_BUSY); + /* async API handles arbitrary sizes */ + return ready ? data->tx.len : 0; } /** Interrupt driven receiver enabling function */ From 0425b04fc317aa7a222d7f66af8c2df9b064f8b2 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Mon, 1 Apr 2024 15:56:21 +1000 Subject: [PATCH 0099/4482] serial: uart_nrfx_*: update `tx_ready` return codes Update nrfx drivers with the minimum number of bytes that can be sent in a single call to `uart_fifo_fill`. Signed-off-by: Jordan Yates --- drivers/serial/uart_nrfx_uart.c | 9 +++++---- drivers/serial/uart_nrfx_uarte.c | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/serial/uart_nrfx_uart.c b/drivers/serial/uart_nrfx_uart.c index 618d476e55e2f..1e0da0f882f01 100644 --- a/drivers/serial/uart_nrfx_uart.c +++ b/drivers/serial/uart_nrfx_uart.c @@ -878,10 +878,11 @@ static int uart_nrfx_irq_tx_ready_complete(const struct device *dev) * called after the TX interrupt is requested to be disabled but before * the disabling is actually performed (in the IRQ handler). */ - return nrf_uart_int_enable_check(uart0_addr, - NRF_UART_INT_MASK_TXDRDY) && - !disable_tx_irq && - event_txdrdy_check(); + bool ready = nrf_uart_int_enable_check(uart0_addr, + NRF_UART_INT_MASK_TXDRDY) && + !disable_tx_irq && + event_txdrdy_check(); + return ready ? 1 : 0; } /** Interrupt driven receiver ready function */ diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 9403c5a3f914a..72791f2337485 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -1596,7 +1596,7 @@ static int uarte_nrfx_irq_tx_ready_complete(const struct device *dev) data->int_driven->fifo_fill_lock = 0; } - return ready; + return ready ? data->int_driven->tx_buff_size : 0; } static int uarte_nrfx_irq_rx_ready(const struct device *dev) From 84c12ab5b5faf478cd264e090ffc4912048813e7 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Wed, 12 Jun 2024 10:01:28 -0700 Subject: [PATCH 0100/4482] boards: rename qemu_xtensa to qemu_xtensa/dc233c This is in preparation for adding another SoC where qemu_xtensa is no longer valid choice. So use qemu_xtensa/dc233c as it is the same as the old qemu_xtensa. Signed-off-by: Daniel Leung --- boards/deprecated.cmake | 3 +++ boards/qemu/xtensa/doc/index.rst | 2 +- .../xtensa/{qemu_xtensa.dts => qemu_xtensa_dc233c.dts} | 0 .../xtensa/{qemu_xtensa.yaml => qemu_xtensa_dc233c.yaml} | 2 +- ...qemu_xtensa_defconfig => qemu_xtensa_dc233c_defconfig} | 0 doc/releases/migration-guide-4.0.rst | 2 ++ samples/subsys/llext/modules/README.rst | 4 ++-- samples/subsys/llext/modules/sample.yaml | 4 ++-- .../portability/cmsis_rtos_v1/philosophers/src/main.c | 2 +- .../portability/cmsis_rtos_v2/philosophers/sample.yaml | 2 +- .../application_development/code_relocation/testcase.yaml | 2 +- tests/kernel/cache/testcase.yaml | 4 ++-- tests/lib/heap/testcase.yaml | 4 ++-- tests/lib/mpsc_pbuf/testcase.yaml | 3 ++- tests/posix/shm/testcase.yaml | 2 +- tests/subsys/debug/symtab/testcase.yaml | 2 +- tests/subsys/llext/simple/testcase.yaml | 8 ++++---- 17 files changed, 26 insertions(+), 20 deletions(-) rename boards/qemu/xtensa/{qemu_xtensa.dts => qemu_xtensa_dc233c.dts} (100%) rename boards/qemu/xtensa/{qemu_xtensa.yaml => qemu_xtensa_dc233c.yaml} (85%) rename boards/qemu/xtensa/{qemu_xtensa_defconfig => qemu_xtensa_dc233c_defconfig} (100%) diff --git a/boards/deprecated.cmake b/boards/deprecated.cmake index a96f68b12dab0..84d5f3c768e6d 100644 --- a/boards/deprecated.cmake +++ b/boards/deprecated.cmake @@ -721,6 +721,9 @@ set(qemu_x86_virt_DEPRECATED set(qemu_x86_xip_DEPRECATED qemu_x86/atom/xip ) +set(qemu_xtensa_DEPRECATED + qemu_xtensa/dc233c +) set(qemu_xtensa_mmu_DEPRECATED qemu_xtensa/dc233c/mmu ) diff --git a/boards/qemu/xtensa/doc/index.rst b/boards/qemu/xtensa/doc/index.rst index 1bc8b2b2acebe..f0ec7e9deec71 100644 --- a/boards/qemu/xtensa/doc/index.rst +++ b/boards/qemu/xtensa/doc/index.rst @@ -18,7 +18,7 @@ emulated environment, for example, with the :zephyr:code-sample:`synchronization .. zephyr-app-commands:: :zephyr-app: samples/synchronization :host-os: unix - :board: qemu_xtensa + :board: qemu_xtensa/dc233c :goals: run This will build an image with the synchronization sample app, boot it using diff --git a/boards/qemu/xtensa/qemu_xtensa.dts b/boards/qemu/xtensa/qemu_xtensa_dc233c.dts similarity index 100% rename from boards/qemu/xtensa/qemu_xtensa.dts rename to boards/qemu/xtensa/qemu_xtensa_dc233c.dts diff --git a/boards/qemu/xtensa/qemu_xtensa.yaml b/boards/qemu/xtensa/qemu_xtensa_dc233c.yaml similarity index 85% rename from boards/qemu/xtensa/qemu_xtensa.yaml rename to boards/qemu/xtensa/qemu_xtensa_dc233c.yaml index 1190d0d3f8e4e..a3ac9b1ca4fab 100644 --- a/boards/qemu/xtensa/qemu_xtensa.yaml +++ b/boards/qemu/xtensa/qemu_xtensa_dc233c.yaml @@ -1,4 +1,4 @@ -identifier: qemu_xtensa +identifier: qemu_xtensa/dc233c name: QEMU Emulation for Xtensa type: qemu simulation: qemu diff --git a/boards/qemu/xtensa/qemu_xtensa_defconfig b/boards/qemu/xtensa/qemu_xtensa_dc233c_defconfig similarity index 100% rename from boards/qemu/xtensa/qemu_xtensa_defconfig rename to boards/qemu/xtensa/qemu_xtensa_dc233c_defconfig diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 5444f426fe1f6..e8c09adbb3bb7 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -35,6 +35,8 @@ Boards * STM32WBA: The command used for fetching blobs required to build ble applications is now ``west blobs fetch hal_stm32`` instead of ``west blobs fetch stm32``. +* Board ``qemu_xtensa`` is deprecated. Use ``qemu_xtensa/dc233c`` instead. + STM32 ===== diff --git a/samples/subsys/llext/modules/README.rst b/samples/subsys/llext/modules/README.rst index 58dc540f729a5..4149dffab25b8 100644 --- a/samples/subsys/llext/modules/README.rst +++ b/samples/subsys/llext/modules/README.rst @@ -41,7 +41,7 @@ Building and running .. zephyr-app-commands:: :zephyr-app: samples/subsys/llext/modules - :board: qemu_xtensa + :board: qemu_xtensa/dc233c :goals: build run :compact: @@ -50,7 +50,7 @@ Building and running .. zephyr-app-commands:: :zephyr-app: samples/subsys/llext/modules - :board: qemu_xtensa + :board: qemu_xtensa/dc233c :goals: build run :west-args: -T sample.llext.modules.module_build :compact: diff --git a/samples/subsys/llext/modules/sample.yaml b/samples/subsys/llext/modules/sample.yaml index 955c4abbad7a5..4fc5d4005aa15 100644 --- a/samples/subsys/llext/modules/sample.yaml +++ b/samples/subsys/llext/modules/sample.yaml @@ -6,9 +6,9 @@ common: - qemu_cortex_a53 # ARM Cortex-A53 (ARMv8-A ISA) - mps2/an385 # ARM Cortex-M3 (ARMv7-M ISA) - mps2/an521/cpu0 # ARM Cortex-M33 (ARMv8-M ISA) - - qemu_xtensa + - qemu_xtensa/dc233c integration_platforms: - - qemu_xtensa + - qemu_xtensa/dc233c - mps2/an385 - qemu_cortex_a53 harness: console diff --git a/samples/subsys/portability/cmsis_rtos_v1/philosophers/src/main.c b/samples/subsys/portability/cmsis_rtos_v1/philosophers/src/main.c index ccaa8224c2323..b5f22a3035057 100644 --- a/samples/subsys/portability/cmsis_rtos_v1/philosophers/src/main.c +++ b/samples/subsys/portability/cmsis_rtos_v1/philosophers/src/main.c @@ -72,7 +72,7 @@ osSemaphoreId forks[NUM_PHIL]; #define fork(x) (forks[x]) /* - * CMSIS limits the stack size, but qemu_x86_64, qemu_xtensa, + * CMSIS limits the stack size, but qemu_x86_64, qemu_xtensa (all), * qemu_leon3 and the boards such as up_squared, intel_ehl_crb, * acrn_ehl_crb need 1024 to run this. * For other arch and boards suggested stack size is 512. diff --git a/samples/subsys/portability/cmsis_rtos_v2/philosophers/sample.yaml b/samples/subsys/portability/cmsis_rtos_v2/philosophers/sample.yaml index af5a69f0af789..801b997fcb128 100644 --- a/samples/subsys/portability/cmsis_rtos_v2/philosophers/sample.yaml +++ b/samples/subsys/portability/cmsis_rtos_v2/philosophers/sample.yaml @@ -8,7 +8,7 @@ common: min_ram: 32 min_flash: 34 platform_exclude: - - qemu_xtensa + - qemu_xtensa/dc233c - qemu_x86_64 harness: console harness_config: diff --git a/tests/application_development/code_relocation/testcase.yaml b/tests/application_development/code_relocation/testcase.yaml index 2fcf97b6aa629..45582025a85c6 100644 --- a/tests/application_development/code_relocation/testcase.yaml +++ b/tests/application_development/code_relocation/testcase.yaml @@ -37,4 +37,4 @@ tests: - qemu_riscv64 application_development.code_relocation.xtensa: extra_args: CONF_FILE="prj_xtensa.conf" - platform_allow: qemu_xtensa + platform_allow: qemu_xtensa/dc233c diff --git a/tests/kernel/cache/testcase.yaml b/tests/kernel/cache/testcase.yaml index 22cd07fbdac2f..bb0cc45df07a7 100644 --- a/tests/kernel/cache/testcase.yaml +++ b/tests/kernel/cache/testcase.yaml @@ -8,7 +8,7 @@ tests: - bcm958402m2/bcm58402/m7 - bcm958401m2 integration_platforms: - - qemu_xtensa + - qemu_xtensa/dc233c - qemu_cortex_a53 - nsim/nsim_em - qemu_x86 @@ -23,7 +23,7 @@ tests: - bcm958402m2/bcm58402/m7 - bcm958401m2 integration_platforms: - - qemu_xtensa + - qemu_xtensa/dc233c - qemu_cortex_a53 - nsim/nsim_em - qemu_x86 diff --git a/tests/lib/heap/testcase.yaml b/tests/lib/heap/testcase.yaml index 279aa0c9a68b4..d522fd4a59acc 100644 --- a/tests/lib/heap/testcase.yaml +++ b/tests/lib/heap/testcase.yaml @@ -3,14 +3,14 @@ # minutes (vs. ~20 seconds for qemu) to complete in CI. There's # little value there, this is a unit test of library code and we have # coverage of the RISC-V architectures via qemu platforms already. -# Excludes qemu_xtensa due to pathological runtimes which cannot be +# Excludes qemu_xtensa/dc233c due to pathological runtimes which cannot be # reproduced on real hardware. tests: libraries.heap: tags: heap platform_exclude: - m2gl025_miv - - qemu_xtensa + - qemu_xtensa/dc233c - esp32s2_saola - esp32s2_lolin_mini timeout: 480 diff --git a/tests/lib/mpsc_pbuf/testcase.yaml b/tests/lib/mpsc_pbuf/testcase.yaml index 124c3a7669cba..50d9722e42642 100644 --- a/tests/lib/mpsc_pbuf/testcase.yaml +++ b/tests/lib/mpsc_pbuf/testcase.yaml @@ -14,7 +14,8 @@ tests: - qemu_riscv64 - qemu_x86 - qemu_x86_64 - - qemu_xtensa + - qemu_xtensa/dc233c + - native_posix - native_sim integration_platforms: - native_sim diff --git a/tests/posix/shm/testcase.yaml b/tests/posix/shm/testcase.yaml index d0fb52be995f0..1928a6e177c2e 100644 --- a/tests/posix/shm/testcase.yaml +++ b/tests/posix/shm/testcase.yaml @@ -9,7 +9,7 @@ common: - simulation platform_exclude: # linker_zephyr_pre0.cmd:140: syntax error (??) - - qemu_xtensa + - qemu_xtensa/dc233c # CONFIG_MMU=y but no arch_mem_map() or arch_mem_unmap() - intel_ish_5_4_1 - intel_ish_5_6_0 diff --git a/tests/subsys/debug/symtab/testcase.yaml b/tests/subsys/debug/symtab/testcase.yaml index e20c196705a1f..43d4c54a2e4af 100644 --- a/tests/subsys/debug/symtab/testcase.yaml +++ b/tests/subsys/debug/symtab/testcase.yaml @@ -5,7 +5,7 @@ common: - qemu_riscv64 - qemu_cortex_a53 - qemu_cortex_m3 - - qemu_xtensa + - qemu_xtensa/dc233c tags: - debug - symtab diff --git a/tests/subsys/llext/simple/testcase.yaml b/tests/subsys/llext/simple/testcase.yaml index 6352e5d30f1fb..59cdccf6e3a04 100644 --- a/tests/subsys/llext/simple/testcase.yaml +++ b/tests/subsys/llext/simple/testcase.yaml @@ -64,7 +64,7 @@ tests: llext.simple.writable: arch_allow: arm xtensa integration_platforms: - - qemu_xtensa # Xtensa ISA + - qemu_xtensa/dc233c # Xtensa ISA filter: not CONFIG_MPU and not CONFIG_MMU and not CONFIG_SOC_SERIES_S32ZE extra_configs: - arch:arm:CONFIG_ARM_MPU=n @@ -73,7 +73,7 @@ tests: llext.simple.writable_relocatable: arch_allow: arm xtensa integration_platforms: - - qemu_xtensa # Xtensa ISA + - qemu_xtensa/dc233c # Xtensa ISA filter: not CONFIG_MPU and not CONFIG_MMU extra_configs: - arch:arm:CONFIG_ARM_MPU=n @@ -86,7 +86,7 @@ tests: llext.simple.writable_slid_linking: arch_allow: arm xtensa integration_platforms: - - qemu_xtensa # Xtensa ISA + - qemu_xtensa/dc233c # Xtensa ISA filter: not CONFIG_MPU and not CONFIG_MMU and not CONFIG_SOC_SERIES_S32ZE extra_configs: - arch:arm:CONFIG_ARM_MPU=n @@ -96,7 +96,7 @@ tests: llext.simple.writable_relocatable_slid_linking: arch_allow: arm xtensa integration_platforms: - - qemu_xtensa # Xtensa ISA + - qemu_xtensa/dc233c # Xtensa ISA filter: not CONFIG_MPU and not CONFIG_MMU extra_configs: - arch:arm:CONFIG_ARM_MPU=n From d0e2a62daf65dbd2b4e7fd131dca46b32839e024 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Wed, 24 Apr 2024 10:41:05 -0700 Subject: [PATCH 0101/4482] soc: xtensa: add sample_controller32 Add sample_controller32 for Xtensa which has MPU. Signed-off-by: Daniel Leung --- dts/xtensa/sample_controller32.dtsi | 40 ++ soc/cdns/sample_controller32/CMakeLists.txt | 7 + soc/cdns/sample_controller32/Kconfig | 9 + soc/cdns/sample_controller32/Kconfig.soc | 12 + .../include/_soc_inthandlers.h | 296 +++++++++ .../include/xtensa-sample-controller32.ld | 588 ++++++++++++++++++ soc/cdns/sample_controller32/mpu.c | 16 + soc/cdns/sample_controller32/soc.yml | 4 + 8 files changed, 972 insertions(+) create mode 100644 dts/xtensa/sample_controller32.dtsi create mode 100644 soc/cdns/sample_controller32/CMakeLists.txt create mode 100644 soc/cdns/sample_controller32/Kconfig create mode 100644 soc/cdns/sample_controller32/Kconfig.soc create mode 100644 soc/cdns/sample_controller32/include/_soc_inthandlers.h create mode 100644 soc/cdns/sample_controller32/include/xtensa-sample-controller32.ld create mode 100644 soc/cdns/sample_controller32/mpu.c create mode 100644 soc/cdns/sample_controller32/soc.yml diff --git a/dts/xtensa/sample_controller32.dtsi b/dts/xtensa/sample_controller32.dtsi new file mode 100644 index 0000000000000..2b85bd4bc3f70 --- /dev/null +++ b/dts/xtensa/sample_controller32.dtsi @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 Intel Corporation. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "skeleton.dtsi" + +/ { + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + device_type = "cpu"; + compatible = "sample_controller"; + reg = <0>; + }; + }; + + sram0: memory@60000000 { + device_type = "memory"; + compatible = "mmio-sram"; + reg = <0x60000000 0x4000000>; + }; + + srom0: memory@fe000000 { + device_type = "memory"; + compatible = "mmio-sram"; + reg = <0x50000000 0x1000000>; + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + ranges; + + }; +}; diff --git a/soc/cdns/sample_controller32/CMakeLists.txt b/soc/cdns/sample_controller32/CMakeLists.txt new file mode 100644 index 0000000000000..684003a0f95d9 --- /dev/null +++ b/soc/cdns/sample_controller32/CMakeLists.txt @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 + +zephyr_include_directories(include) + +zephyr_library_sources_ifdef(CONFIG_XTENSA_MPU mpu.c) + +set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/include/xtensa-sample-controller32.ld CACHE INTERNAL "") diff --git a/soc/cdns/sample_controller32/Kconfig b/soc/cdns/sample_controller32/Kconfig new file mode 100644 index 0000000000000..69ba20c5fc89e --- /dev/null +++ b/soc/cdns/sample_controller32/Kconfig @@ -0,0 +1,9 @@ +# Copyright (c) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +config SOC_XTENSA_SAMPLE_CONTROLLER32 + select XTENSA + select XTENSA_HAL + select ATOMIC_OPERATIONS_C + select CPU_HAS_MPU + select ARCH_HAS_USERSPACE if XTENSA_MPU diff --git a/soc/cdns/sample_controller32/Kconfig.soc b/soc/cdns/sample_controller32/Kconfig.soc new file mode 100644 index 0000000000000..90e0556b3c9af --- /dev/null +++ b/soc/cdns/sample_controller32/Kconfig.soc @@ -0,0 +1,12 @@ +# Copyright (c) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +config SOC_XTENSA_SAMPLE_CONTROLLER32 + bool + +config SOC + default "sample_controller32" if SOC_XTENSA_SAMPLE_CONTROLLER32 + +config SOC_TOOLCHAIN_NAME + string + default "sample_controller32" if SOC_XTENSA_SAMPLE_CONTROLLER32 diff --git a/soc/cdns/sample_controller32/include/_soc_inthandlers.h b/soc/cdns/sample_controller32/include/_soc_inthandlers.h new file mode 100644 index 0000000000000..e0d60d348c212 --- /dev/null +++ b/soc/cdns/sample_controller32/include/_soc_inthandlers.h @@ -0,0 +1,296 @@ +/* + * Copyright (c) 2024 Intel Corporation. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT. + * + * Functions here are designed to produce efficient code to + * search an Xtensa bitmask of interrupts, inspecting only those bits + * declared to be associated with a given interrupt level. Each + * dispatcher will handle exactly one flagged interrupt, in numerical + * order (low bits first) and will return a mask of that bit that can + * then be cleared by the calling code. Unrecognized bits for the + * level will invoke an error handler. + */ + +#include +#include +#include + +#if !defined(XCHAL_INT0_LEVEL) || XCHAL_INT0_LEVEL != 1 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT1_LEVEL) || XCHAL_INT1_LEVEL != 1 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT2_LEVEL) || XCHAL_INT2_LEVEL != 1 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT3_LEVEL) || XCHAL_INT3_LEVEL != 1 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT4_LEVEL) || XCHAL_INT4_LEVEL != 1 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT5_LEVEL) || XCHAL_INT5_LEVEL != 1 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT6_LEVEL) || XCHAL_INT6_LEVEL != 1 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT7_LEVEL) || XCHAL_INT7_LEVEL != 1 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT15_LEVEL) || XCHAL_INT15_LEVEL != 1 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT16_LEVEL) || XCHAL_INT16_LEVEL != 1 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT17_LEVEL) || XCHAL_INT17_LEVEL != 1 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT18_LEVEL) || XCHAL_INT18_LEVEL != 1 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT19_LEVEL) || XCHAL_INT19_LEVEL != 1 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT20_LEVEL) || XCHAL_INT20_LEVEL != 1 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT22_LEVEL) || XCHAL_INT22_LEVEL != 1 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT8_LEVEL) || XCHAL_INT8_LEVEL != 2 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT9_LEVEL) || XCHAL_INT9_LEVEL != 3 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT10_LEVEL) || XCHAL_INT10_LEVEL != 3 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT11_LEVEL) || XCHAL_INT11_LEVEL != 3 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT21_LEVEL) || XCHAL_INT21_LEVEL != 3 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT12_LEVEL) || XCHAL_INT12_LEVEL != 4 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT13_LEVEL) || XCHAL_INT13_LEVEL != 5 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT14_LEVEL) || XCHAL_INT14_LEVEL != 7 +#error core-isa.h interrupt level does not match dispatcher! +#endif + +static inline int _xtensa_handle_one_int1(unsigned int mask) +{ + int irq; + + if (mask & 0x7f) { + if (mask & 0x7) { + if (mask & BIT(0)) { + mask = BIT(0); + irq = 0; + goto handle_irq; + } + if (mask & BIT(1)) { + mask = BIT(1); + irq = 1; + goto handle_irq; + } + if (mask & BIT(2)) { + mask = BIT(2); + irq = 2; + goto handle_irq; + } + } else { + if (mask & 0x18) { + if (mask & BIT(3)) { + mask = BIT(3); + irq = 3; + goto handle_irq; + } + if (mask & BIT(4)) { + mask = BIT(4); + irq = 4; + goto handle_irq; + } + } else { + if (mask & BIT(5)) { + mask = BIT(5); + irq = 5; + goto handle_irq; + } + if (mask & BIT(6)) { + mask = BIT(6); + irq = 6; + goto handle_irq; + } + } + } + } else { + if (mask & 0x38080) { + if (mask & 0x8080) { + if (mask & BIT(7)) { + mask = BIT(7); + irq = 7; + goto handle_irq; + } + if (mask & BIT(15)) { + mask = BIT(15); + irq = 15; + goto handle_irq; + } + } else { + if (mask & BIT(16)) { + mask = BIT(16); + irq = 16; + goto handle_irq; + } + if (mask & BIT(17)) { + mask = BIT(17); + irq = 17; + goto handle_irq; + } + } + } else { + if (mask & 0xc0000) { + if (mask & BIT(18)) { + mask = BIT(18); + irq = 18; + goto handle_irq; + } + if (mask & BIT(19)) { + mask = BIT(19); + irq = 19; + goto handle_irq; + } + } else { + if (mask & BIT(20)) { + mask = BIT(20); + irq = 20; + goto handle_irq; + } + if (mask & BIT(22)) { + mask = BIT(22); + irq = 22; + goto handle_irq; + } + } + } + } + return 0; +handle_irq: + _sw_isr_table[irq].isr(_sw_isr_table[irq].arg); + return mask; +} + +static inline int _xtensa_handle_one_int2(unsigned int mask) +{ + int irq; + + if (mask & BIT(8)) { + mask = BIT(8); + irq = 8; + goto handle_irq; + } + return 0; +handle_irq: + _sw_isr_table[irq].isr(_sw_isr_table[irq].arg); + return mask; +} + +static inline int _xtensa_handle_one_int3(unsigned int mask) +{ + int irq; + + if (mask & 0x600) { + if (mask & BIT(9)) { + mask = BIT(9); + irq = 9; + goto handle_irq; + } + if (mask & BIT(10)) { + mask = BIT(10); + irq = 10; + goto handle_irq; + } + } else { + if (mask & BIT(11)) { + mask = BIT(11); + irq = 11; + goto handle_irq; + } + if (mask & BIT(21)) { + mask = BIT(21); + irq = 21; + goto handle_irq; + } + } + return 0; +handle_irq: + _sw_isr_table[irq].isr(_sw_isr_table[irq].arg); + return mask; +} + +static inline int _xtensa_handle_one_int4(unsigned int mask) +{ + int irq; + + if (mask & BIT(12)) { + mask = BIT(12); + irq = 12; + goto handle_irq; + } + return 0; +handle_irq: + _sw_isr_table[irq].isr(_sw_isr_table[irq].arg); + return mask; +} + +static inline int _xtensa_handle_one_int5(unsigned int mask) +{ + int irq; + + if (mask & BIT(13)) { + mask = BIT(13); + irq = 13; + goto handle_irq; + } + return 0; +handle_irq: + _sw_isr_table[irq].isr(_sw_isr_table[irq].arg); + return mask; +} + +static inline int _xtensa_handle_one_int7(unsigned int mask) +{ + int irq; + + if (mask & BIT(14)) { + mask = BIT(14); + irq = 14; + goto handle_irq; + } + return 0; +handle_irq: + _sw_isr_table[irq].isr(_sw_isr_table[irq].arg); + return mask; +} + +static inline int _xtensa_handle_one_int0(unsigned int mask) +{ + return 0; +} +static inline int _xtensa_handle_one_int6(unsigned int mask) +{ + return 0; +} diff --git a/soc/cdns/sample_controller32/include/xtensa-sample-controller32.ld b/soc/cdns/sample_controller32/include/xtensa-sample-controller32.ld new file mode 100644 index 0000000000000..2bda535cf29ea --- /dev/null +++ b/soc/cdns/sample_controller32/include/xtensa-sample-controller32.ld @@ -0,0 +1,588 @@ +/* + * Copyright (c) 2016 Cadence Design Systems, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file + * @brief Linker command/script file + * + * Linker script for the Xtensa platform. + */ + +#include + +#include + +#include +#include +#include + +#define RAMABLE_REGION RAM :sram0_phdr +#define ROMABLE_REGION RAM :sram0_phdr + +#ifdef CONFIG_MPU +#define MPU_SEGMENT_SIZE_ALIGN . = ALIGN(XCHAL_MPU_ALIGN); +#define HDR_MPU_SEGMENT_SIZE_ALIGN ALIGN(XCHAL_MPU_ALIGN) +#define HDR_4K_OR_MPU_SEGMENT_SIZE_ALIGN ALIGN(XCHAL_MPU_ALIGN) +#define LAST_RAM_ALIGN MPU_SEGMENT_SIZE_ALIGN +#else +#define MPU_SEGMENT_SIZE_ALIGN . = ALIGN(4); +#define HDR_MPU_SEGMENT_SIZE_ALIGN ALIGN(4) +#define HDR_4K_OR_MPU_SEGMENT_SIZE_ALIGN ALIGN(4096) +#endif + +#define PHYS_SRAM0_ADDR (DT_REG_ADDR(DT_NODELABEL(sram0))) +#define PHYS_SRAM0_SIZE (DT_REG_SIZE(DT_NODELABEL(sram0))) + +#define PHYS_ROM0_ADDR (DT_REG_ADDR(DT_NODELABEL(srom0))) +#define PHYS_ROM0_SIZE (DT_REG_SIZE(DT_NODELABEL(srom0))) + +/* Usable RAM is after the exception vectors and page-aligned. */ +#define PHYS_RAM_ADDR (PHYS_SRAM0_ADDR + CONFIG_SRAM_OFFSET) +#define PHYS_RAM_SIZE (PHYS_SRAM0_SIZE - CONFIG_SRAM_OFFSET) + +MEMORY +{ + dram1_0_seg : org = 0x3FFC0000, len = 0x20000 + dram0_0_seg : org = 0x3FFE0000, len = 0x20000 + iram0_0_seg : org = 0x40000000, len = 0x178 + iram0_1_seg : org = 0x40000178, len = 0x8 + iram0_2_seg : org = 0x40000180, len = 0x38 + iram0_3_seg : org = 0x400001B8, len = 0x8 + iram0_4_seg : org = 0x400001C0, len = 0x38 + iram0_5_seg : org = 0x400001F8, len = 0x8 + iram0_6_seg : org = 0x40000200, len = 0x38 + iram0_7_seg : org = 0x40000238, len = 0x8 + iram0_8_seg : org = 0x40000240, len = 0x38 + iram0_9_seg : org = 0x40000278, len = 0x8 + iram0_10_seg : org = 0x40000280, len = 0x38 + iram0_11_seg : org = 0x400002B8, len = 0x8 + iram0_12_seg : org = 0x400002C0, len = 0x38 + iram0_13_seg : org = 0x400002F8, len = 0x8 + iram0_14_seg : org = 0x40000300, len = 0x38 + iram0_15_seg : org = 0x40000338, len = 0x8 + iram0_16_seg : org = 0x40000340, len = 0x38 + iram0_17_seg : org = 0x40000378, len = 0x48 + iram0_18_seg : org = 0x400003C0, len = 0x40 + iram0_19_seg : org = 0x40000400, len = 0x1FC00 +#ifdef CONFIG_MPU + vec_helpers : org = 0x40002400, len = (PHYS_RAM_ADDR - 0x00002400) +#endif + srom0_seg : org = PHYS_ROM0_ADDR, len = PHYS_ROM0_SIZE + RAM : org = PHYS_RAM_ADDR, len = PHYS_RAM_SIZE + +#ifdef CONFIG_GEN_ISR_TABLES + /* The space before exception vectors is not being used. + * So we stuff the temporary IDT_LIST there to avoid + * some linker issues which would balloon the size of + * the intermediate files (like zephyr_pre0.elf, to + * couple hundred MBs or even GBs). + */ + IDT_LIST : org = 0x3FFBE000, len = 0x2000 +#endif +} + +PHDRS +{ + dram1_0_phdr PT_LOAD; + dram1_0_bss_phdr PT_LOAD; + dram0_0_phdr PT_LOAD; + dram0_0_bss_phdr PT_LOAD; + iram0_0_phdr PT_LOAD; + iram0_1_phdr PT_LOAD; + iram0_2_phdr PT_LOAD; + iram0_3_phdr PT_LOAD; + iram0_4_phdr PT_LOAD; + iram0_5_phdr PT_LOAD; + iram0_6_phdr PT_LOAD; + iram0_7_phdr PT_LOAD; + iram0_8_phdr PT_LOAD; + iram0_9_phdr PT_LOAD; + iram0_10_phdr PT_LOAD; + iram0_11_phdr PT_LOAD; + iram0_12_phdr PT_LOAD; + iram0_13_phdr PT_LOAD; + iram0_14_phdr PT_LOAD; + iram0_15_phdr PT_LOAD; + iram0_16_phdr PT_LOAD; + iram0_17_phdr PT_LOAD; + iram0_18_phdr PT_LOAD; + +#ifdef CONFIG_XTENSA_MPU + vec_helpers_phdr PT_LOAD; +#endif + + srom0_phdr PT_LOAD; + sram0_phdr PT_LOAD; + sram0_bss_phdr PT_LOAD; +} + + +/* Default entry point: */ +ENTRY(CONFIG_KERNEL_ENTRY) + +_rom_store_table = 0; + +PROVIDE(_memmap_vecbase_reset = 0x40000000); +PROVIDE(_memmap_reset_vector = 0x50000000); + +/* Various memory-map dependent cache attribute settings: */ +_memmap_cacheattr_wb_base = 0x00001110; +_memmap_cacheattr_wt_base = 0x00001110; +_memmap_cacheattr_bp_base = 0x00002220; +_memmap_cacheattr_unused_mask = 0xFFFF000F; +_memmap_cacheattr_wb_trapnull = 0x2222111F; +_memmap_cacheattr_wba_trapnull = 0x2222111F; +_memmap_cacheattr_wbna_trapnull = 0x2222111F; +_memmap_cacheattr_wt_trapnull = 0x2222111F; +_memmap_cacheattr_bp_trapnull = 0x2222222F; +_memmap_cacheattr_wb_strict = 0xFFFF111F; +_memmap_cacheattr_wt_strict = 0xFFFF111F; +_memmap_cacheattr_bp_strict = 0xFFFF222F; +_memmap_cacheattr_wb_allvalid = 0x22221112; +_memmap_cacheattr_wt_allvalid = 0x22221112; +_memmap_cacheattr_bp_allvalid = 0x22222222; +PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_bp_trapnull); + +SECTIONS +{ + +#include + +#ifdef CONFIG_GEN_ISR_TABLES +#include +#endif + + .dram1.rodata : ALIGN(4) + { + _dram1_rodata_start = ABSOLUTE(.); + *(.dram1.rodata) + _dram1_rodata_end = ABSOLUTE(.); + } >dram1_0_seg :dram1_0_phdr + + .dram1.literal : ALIGN(4) + { + _dram1_literal_start = ABSOLUTE(.); + *(.dram1.literal) + _dram1_literal_end = ABSOLUTE(.); + } >dram1_0_seg :dram1_0_phdr + + .dram1.data : ALIGN(4) + { + _dram1_data_start = ABSOLUTE(.); + *(.dram1.data) + _dram1_data_end = ABSOLUTE(.); + } >dram1_0_seg :dram1_0_phdr + + .dram1.bss (NOLOAD) : ALIGN(8) + { + . = ALIGN (8); + _dram1_bss_start = ABSOLUTE(.); + *(.dram1.bss) + . = ALIGN (8); + _dram1_bss_end = ABSOLUTE(.); + _memmap_seg_dram1_0_end = ALIGN(0x8); + } >dram1_0_seg :dram1_0_bss_phdr + + .dram0.rodata : ALIGN(4) + { + _dram0_rodata_start = ABSOLUTE(.); + *(.dram0.rodata) + _dram0_rodata_end = ABSOLUTE(.); + } >dram0_0_seg :dram0_0_phdr + + .dram0.literal : ALIGN(4) + { + _dram0_literal_start = ABSOLUTE(.); + *(.dram0.literal) + _dram0_literal_end = ABSOLUTE(.); + } >dram0_0_seg :dram0_0_phdr + + .dram0.data : ALIGN(4) + { + _dram0_data_start = ABSOLUTE(.); + *(.dram0.data) + _dram0_data_end = ABSOLUTE(.); + } >dram0_0_seg :dram0_0_phdr + + .dram0.bss (NOLOAD) : ALIGN(8) + { + . = ALIGN (8); + _dram0_bss_start = ABSOLUTE(.); + *(.dram0.bss) + . = ALIGN (8); + _dram0_bss_end = ABSOLUTE(.); + _memmap_seg_dram0_0_end = ALIGN(0x8); + } >dram0_0_seg :dram0_0_bss_phdr + + .WindowVectors.text : ALIGN(4) + { + _WindowVectors_text_start = ABSOLUTE(.); + KEEP (*(.WindowVectors.text)) + _WindowVectors_text_end = ABSOLUTE(.); + } >iram0_0_seg :iram0_0_phdr + + .Level2InterruptVector.literal : ALIGN(4) + { + _Level2InterruptVector_literal_start = ABSOLUTE(.); + *(.Level2InterruptVector.literal) + _Level2InterruptVector_literal_end = ABSOLUTE(.); + } >iram0_1_seg :iram0_1_phdr + + .Level2InterruptVector.text : ALIGN(4) + { + _Level2InterruptVector_text_start = ABSOLUTE(.); + KEEP (*(.Level2InterruptVector.text)) + _Level2InterruptVector_text_end = ABSOLUTE(.); + } >iram0_2_seg :iram0_2_phdr + + .Level3InterruptVector.literal : ALIGN(4) + { + _Level3InterruptVector_literal_start = ABSOLUTE(.); + *(.Level3InterruptVector.literal) + _Level3InterruptVector_literal_end = ABSOLUTE(.); + } >iram0_3_seg :iram0_3_phdr + + .Level3InterruptVector.text : ALIGN(4) + { + _Level3InterruptVector_text_start = ABSOLUTE(.); + KEEP (*(.Level3InterruptVector.text)) + _Level3InterruptVector_text_end = ABSOLUTE(.); + } >iram0_4_seg :iram0_4_phdr + + .Level4InterruptVector.literal : ALIGN(4) + { + _Level4InterruptVector_literal_start = ABSOLUTE(.); + *(.Level4InterruptVector.literal) + _Level4InterruptVector_literal_end = ABSOLUTE(.); + } >iram0_5_seg :iram0_5_phdr + + .Level4InterruptVector.text : ALIGN(4) + { + _Level4InterruptVector_text_start = ABSOLUTE(.); + KEEP (*(.Level4InterruptVector.text)) + _Level4InterruptVector_text_end = ABSOLUTE(.); + } >iram0_6_seg :iram0_6_phdr + + .Level5InterruptVector.literal : ALIGN(4) + { + _Level5InterruptVector_literal_start = ABSOLUTE(.); + *(.Level5InterruptVector.literal) + _Level5InterruptVector_literal_end = ABSOLUTE(.); + } >iram0_7_seg :iram0_7_phdr + + .Level5InterruptVector.text : ALIGN(4) + { + _Level5InterruptVector_text_start = ABSOLUTE(.); + KEEP (*(.Level5InterruptVector.text)) + _Level5InterruptVector_text_end = ABSOLUTE(.); + } >iram0_8_seg :iram0_8_phdr + + .DebugExceptionVector.literal : ALIGN(4) + { + _DebugExceptionVector_literal_start = ABSOLUTE(.); + *(.DebugExceptionVector.literal) + _DebugExceptionVector_literal_end = ABSOLUTE(.); + } >iram0_9_seg :iram0_9_phdr + + .DebugExceptionVector.text : ALIGN(4) + { + _DebugExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.DebugExceptionVector.text)) + _DebugExceptionVector_text_end = ABSOLUTE(.); + } >iram0_10_seg :iram0_10_phdr + + .NMIExceptionVector.literal : ALIGN(4) + { + _NMIExceptionVector_literal_start = ABSOLUTE(.); + *(.NMIExceptionVector.literal) + _NMIExceptionVector_literal_end = ABSOLUTE(.); + } >iram0_11_seg :iram0_11_phdr + + .NMIExceptionVector.text : ALIGN(4) + { + _NMIExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.NMIExceptionVector.text)) + _NMIExceptionVector_text_end = ABSOLUTE(.); + } >iram0_12_seg :iram0_12_phdr + + .KernelExceptionVector.literal : ALIGN(4) + { + _KernelExceptionVector_literal_start = ABSOLUTE(.); + *(.KernelExceptionVector.literal) + _KernelExceptionVector_literal_end = ABSOLUTE(.); + } >iram0_13_seg :iram0_13_phdr + + .KernelExceptionVector.text : ALIGN(4) + { + _KernelExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.KernelExceptionVector.text)) + _KernelExceptionVector_text_end = ABSOLUTE(.); + } >iram0_14_seg :iram0_14_phdr + + .UserExceptionVector.literal : ALIGN(4) + { + _UserExceptionVector_literal_start = ABSOLUTE(.); + *(.UserExceptionVector.literal) + _UserExceptionVector_literal_end = ABSOLUTE(.); + } >iram0_15_seg :iram0_15_phdr + + .UserExceptionVector.text : ALIGN(4) + { + _UserExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.UserExceptionVector.text)) + _UserExceptionVector_text_end = ABSOLUTE(.); + } >iram0_16_seg :iram0_16_phdr + + .DoubleExceptionVector.literal : ALIGN(4) + { + _DoubleExceptionVector_literal_start = ABSOLUTE(.); + *(.DoubleExceptionVector.literal) + _DoubleExceptionVector_literal_end = ABSOLUTE(.); + } >iram0_17_seg :iram0_17_phdr + + .DoubleExceptionVector.text : ALIGN(4) + { + _DoubleExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.DoubleExceptionVector.text)) + _DoubleExceptionVector_text_end = ABSOLUTE(.); + } >iram0_18_seg :iram0_18_phdr + +#define LIB_OBJ_FUNC_IN_SECT(library, obj_file, func) \ + *##library##:##obj_file##(.literal.##func .text.##func) \ + +#ifdef CONFIG_XTENSA_MPU + .vec_helpers : + { + /* There is quite some space between .DoubleExceptionVector + * and the beginning of .text. We can put exception handling + * code here. + */ + + *libarch__xtensa__core.a:xtensa_asm2_util.S.obj(.literal .text) + *libarch__xtensa__core.a:xtensa_asm2_util.S.obj(.iram.text .iram0.text) + + *libarch__xtensa__core.a:window_vectors.S.obj(.iram.text) + + *libarch__xtensa__core.a:crt1.S.obj(.literal .text) + + LIB_OBJ_FUNC_IN_SECT(libarch__xtensa__core.a,xtensa_asm2.c.obj,*) + LIB_OBJ_FUNC_IN_SECT(libarch__xtensa__core.a,fatal.c.obj,*) + LIB_OBJ_FUNC_IN_SECT(libarch__xtensa__core.a,cpu_idle.c.obj,*) + + *(.literal.arch_is_in_isr .text.arch_is_in_isr) + + /* To support backtracing */ + LIB_OBJ_FUNC_IN_SECT(libarch__xtensa__core.a,xtensa_backtrace.c.obj,*) + + *libarch__xtensa__core.a:debug_helpers_asm.S.obj(.iram1.literal .iram1) + + /* Userspace related stuff */ + LIB_OBJ_FUNC_IN_SECT(libarch__xtensa__core.a,userspace.S.obj,xtensa_do_syscall) + + /* Below are to speed up execution by avoiding TLB misses + * on frequently used functions. + * + * There is almost 1MB space (due to TLB pinning) so we can + * be generous. + */ + LIB_OBJ_FUNC_IN_SECT(libkernel.a,,*) + + LIB_OBJ_FUNC_IN_SECT(libdrivers__console.a,,*) + LIB_OBJ_FUNC_IN_SECT(libdrivers__timer.a,,*) + + *(.literal.z_vrfy_* .text.z_vrfy_*) + *(.literal.z_mrsh_* .text.z_mrsh_*) + *(.literal.z_impl_* .text.z_impl_*) + *(.literal.z_obj_* .text.z_obj_*) + + *(.literal.k_sys_fatal_error_handler .text.k_sys_fatal_error_handler) + } >vec_helpers :vec_helpers_phdr +#endif /* CONFIG_XTENSA_MPU */ + +#ifdef CONFIG_CODE_DATA_RELOCATION +#include +#endif + + .ResetVector.text : ALIGN(4) + { + __rom_region_start = ABSOLUTE(.); + _ResetVector_text_start = ABSOLUTE(.); + KEEP (*(.ResetVector.text)) + _ResetVector_text_end = ABSOLUTE(.); + } >srom0_seg :srom0_phdr + + .text : HDR_MPU_SEGMENT_SIZE_ALIGN + { + _stext = .; + __text_region_start = .; + z_mapped_start = .; + _text_start = ABSOLUTE(.); + *(.entry.text) + *(.init.literal) + *(.iram0.literal .iram.literal .iram.text.literal .iram0.text .iram.text) + *(.iram1.literal .iram1) + KEEP(*(.init)) + *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) + *(.fini.literal) + KEEP(*(.fini)) + *(.gnu.version) + + #include + + MPU_SEGMENT_SIZE_ALIGN + + _text_end = ABSOLUTE(.); + _etext = .; + } >RAMABLE_REGION + __text_region_end = .; + + .rodata : HDR_MPU_SEGMENT_SIZE_ALIGN + { + __rodata_region_start = ABSOLUTE(.); + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r.*) + *(.rodata1) + + . = ALIGN(4); + #include + #include + } >RAMABLE_REGION + +#include + +#include + +#include + + .rodata_end : ALIGN(4) + { + . = ALIGN(4); /* this table MUST be 4-byte aligned */ + _bss_table_start = ABSOLUTE(.); + LONG(_bss_start) + LONG(_bss_end) + _bss_table_end = ABSOLUTE(.); + + MPU_SEGMENT_SIZE_ALIGN + + __rodata_region_end = ABSOLUTE(.); + } >RAMABLE_REGION + +#ifdef CONFIG_USERSPACE +#define SMEM_PARTITION_ALIGN(size) MPU_SEGMENT_SIZE_ALIGN +#define APP_SHARED_ALIGN MPU_SEGMENT_SIZE_ALIGN + +#include + + _image_ram_start = _app_smem_start; + _app_smem_size = _app_smem_end - _app_smem_start; + _app_smem_num_words = _app_smem_size >> 2; + _app_smem_rom_start = LOADADDR(_APP_SMEM_SECTION_NAME); + _app_smem_num_words = _app_smem_size >> 2; +#endif /* CONFIG_USERSPACE */ + + .data : HDR_MPU_SEGMENT_SIZE_ALIGN + { +#ifndef CONFIG_USERSPACE + _image_ram_start = ABSOLUTE(.); +#endif + __data_start = ABSOLUTE(.); + *(.data) + *(.data.*) + *(.gnu.linkonce.d.*) + KEEP(*(.gnu.linkonce.d.*personality*)) + *(.data1) + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s.*) + *(.sdata2) + *(.sdata2.*) + *(.gnu.linkonce.s2.*) + KEEP(*(.jcr)) + + . = ALIGN(4); + #include + . = ALIGN(4); + + MPU_SEGMENT_SIZE_ALIGN + + __data_end = ABSOLUTE(.); + } >RAMABLE_REGION + +#include + +#include + +#include + +#include + +#include + + .bss (NOLOAD) : HDR_MPU_SEGMENT_SIZE_ALIGN + { + . = ALIGN (8); + _bss_start = ABSOLUTE(.); + *(.dynsbss) + *(.sbss) + *(.sbss.*) + *(.gnu.linkonce.sb.*) + *(.scommon) + *(.sbss2) + *(.sbss2.*) + *(.gnu.linkonce.sb2.*) + *(.dynbss) + *(.bss) + *(.bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + *(.sram.bss) + . = ALIGN (8); + _bss_end = ABSOLUTE(.); + + MPU_SEGMENT_SIZE_ALIGN + + } >RAM :sram0_bss_phdr + +#include + +/* Must be last in RAM */ +#include + +#include + + _heap_start = .; + + PROVIDE(_heap_sentry = ORIGIN(RAM) + LENGTH(RAM)); + PROVIDE(_heap_end = ORIGIN(RAM) + LENGTH(RAM)); + + PROVIDE(__stack = z_interrupt_stacks + CONFIG_ISR_STACK_SIZE); + +#include + + .xtensa.info 0 : { *(.xtensa.info) } + .xt.insn 0 : + { + KEEP (*(.xt.insn)) + KEEP (*(.gnu.linkonce.x.*)) + } + .xt.prop 0 : + { + KEEP (*(.xt.prop)) + KEEP (*(.xt.prop.*)) + KEEP (*(.gnu.linkonce.prop.*)) + } + .xt.lit 0 : + { + KEEP (*(.xt.lit)) + KEEP (*(.xt.lit.*)) + KEEP (*(.gnu.linkonce.p.*)) + } + .debug.xt.callgraph 0 : + { + KEEP (*(.debug.xt.callgraph .debug.xt.callgraph.* .gnu.linkonce.xt.callgraph.*)) + } +} diff --git a/soc/cdns/sample_controller32/mpu.c b/soc/cdns/sample_controller32/mpu.c new file mode 100644 index 0000000000000..c4ddb042a08bb --- /dev/null +++ b/soc/cdns/sample_controller32/mpu.c @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2024 Intel Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include + +#include +#include +#include + +const struct xtensa_mpu_range xtensa_soc_mpu_ranges[0]; +const int xtensa_soc_mpu_ranges_num; diff --git a/soc/cdns/sample_controller32/soc.yml b/soc/cdns/sample_controller32/soc.yml new file mode 100644 index 0000000000000..8f29326a09aba --- /dev/null +++ b/soc/cdns/sample_controller32/soc.yml @@ -0,0 +1,4 @@ +series: +- name: sample_controller32 + socs: + - name: sample_controller32 From 907a3bf9089b190180154223612b79e15eb9542e Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Wed, 24 Apr 2024 10:51:48 -0700 Subject: [PATCH 0102/4482] boards: add qemu_xtensa/sample_controller32/mpu This adds the necessary bit to enable testing Xtensa MPU on QEMU. Signed-off-by: Daniel Leung --- boards/qemu/xtensa/Kconfig | 1 + boards/qemu/xtensa/Kconfig.qemu_xtensa | 3 ++- boards/qemu/xtensa/board.cmake | 4 ++-- boards/qemu/xtensa/board.yml | 3 +++ .../qemu_xtensa_sample_controller32_mpu.dts | 22 +++++++++++++++++++ .../qemu_xtensa_sample_controller32_mpu.yaml | 10 +++++++++ ...u_xtensa_sample_controller32_mpu_defconfig | 11 ++++++++++ 7 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 boards/qemu/xtensa/qemu_xtensa_sample_controller32_mpu.dts create mode 100644 boards/qemu/xtensa/qemu_xtensa_sample_controller32_mpu.yaml create mode 100644 boards/qemu/xtensa/qemu_xtensa_sample_controller32_mpu_defconfig diff --git a/boards/qemu/xtensa/Kconfig b/boards/qemu/xtensa/Kconfig index 8cdc6ec28ff21..9ec79f85c1ee6 100644 --- a/boards/qemu/xtensa/Kconfig +++ b/boards/qemu/xtensa/Kconfig @@ -7,3 +7,4 @@ config BOARD_QEMU_XTENSA select QEMU_TARGET select ARCH_SUPPORTS_COREDUMP select XTENSA_MMU if BOARD_QEMU_XTENSA_DC233C_MMU + select XTENSA_MPU if BOARD_QEMU_XTENSA_SAMPLE_CONTROLLER32_MPU diff --git a/boards/qemu/xtensa/Kconfig.qemu_xtensa b/boards/qemu/xtensa/Kconfig.qemu_xtensa index f0aa1c8010c3b..6d1a9f9ce976c 100644 --- a/boards/qemu/xtensa/Kconfig.qemu_xtensa +++ b/boards/qemu/xtensa/Kconfig.qemu_xtensa @@ -4,4 +4,5 @@ # SPDX-License-Identifier: Apache-2.0 config BOARD_QEMU_XTENSA - select SOC_XTENSA_DC233C + select SOC_XTENSA_SAMPLE_CONTROLLER32 if BOARD_QEMU_XTENSA_SAMPLE_CONTROLLER32_MPU + select SOC_XTENSA_DC233C if !BOARD_QEMU_XTENSA_SAMPLE_CONTROLLER32_MPU diff --git a/boards/qemu/xtensa/board.cmake b/boards/qemu/xtensa/board.cmake index 40818845da6d0..a11c7e8c1583a 100644 --- a/boards/qemu/xtensa/board.cmake +++ b/boards/qemu/xtensa/board.cmake @@ -3,10 +3,10 @@ set(SUPPORTED_EMU_PLATFORMS qemu) if(CONFIG_BOARD_QEMU_XTENSA) - set(QEMU_CPU_TYPE_${ARCH} dc233c) + set(QEMU_CPU_TYPE_${ARCH} ${CONFIG_SOC}) set(QEMU_FLAGS_${ARCH} - -machine sim -semihosting -nographic -cpu dc233c + -machine sim -semihosting -nographic -cpu ${CONFIG_SOC} ) endif() diff --git a/boards/qemu/xtensa/board.yml b/boards/qemu/xtensa/board.yml index 1441dcc25fc6a..0b2afcd488326 100644 --- a/boards/qemu/xtensa/board.yml +++ b/boards/qemu/xtensa/board.yml @@ -5,3 +5,6 @@ board: - name: dc233c variants: - name: mmu + - name: sample_controller32 + variants: + - name: mpu diff --git a/boards/qemu/xtensa/qemu_xtensa_sample_controller32_mpu.dts b/boards/qemu/xtensa/qemu_xtensa_sample_controller32_mpu.dts new file mode 100644 index 0000000000000..4fba5a197f0ff --- /dev/null +++ b/boards/qemu/xtensa/qemu_xtensa_sample_controller32_mpu.dts @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2019, 2023 Intel Corporation. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include "sample_controller32.dtsi" + +/ { + model = "qemu_xtensa_mpu"; + compatible = "cdns,xtensa-sample-controller32"; + + chosen { + zephyr,sram = &sram0; + }; +}; + +&cpu0 { + clock-frequency = <10000000>; +}; diff --git a/boards/qemu/xtensa/qemu_xtensa_sample_controller32_mpu.yaml b/boards/qemu/xtensa/qemu_xtensa_sample_controller32_mpu.yaml new file mode 100644 index 0000000000000..5c91f09db79ce --- /dev/null +++ b/boards/qemu/xtensa/qemu_xtensa_sample_controller32_mpu.yaml @@ -0,0 +1,10 @@ +identifier: qemu_xtensa/sample_controller32/mpu +name: QEMU Emulation for Xtensa with MPU +type: qemu +simulation: qemu +arch: xtensa +testing: + default: true + ignore_tags: + - net + - bluetooth diff --git a/boards/qemu/xtensa/qemu_xtensa_sample_controller32_mpu_defconfig b/boards/qemu/xtensa/qemu_xtensa_sample_controller32_mpu_defconfig new file mode 100644 index 0000000000000..8e34107fe3df3 --- /dev/null +++ b/boards/qemu/xtensa/qemu_xtensa_sample_controller32_mpu_defconfig @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_CONSOLE=y +CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=10000000 +CONFIG_STACK_SENTINEL=y +CONFIG_GEN_ISR_TABLES=y +CONFIG_GEN_IRQ_VECTOR_TABLE=n +CONFIG_SIMULATOR_XTENSA=y +CONFIG_QEMU_ICOUNT_SHIFT=6 +CONFIG_PRIVILEGED_STACK_SIZE=4096 From 8295deb966e9e7db81a331910f50ad268a0e01bf Mon Sep 17 00:00:00 2001 From: Andries Kruithof Date: Wed, 24 Jul 2024 11:25:11 +0200 Subject: [PATCH 0103/4482] Bluetooth: Audio: CAP implement broadcast reception stop Implement the CAP broadcast reception stop procedures and add unit tests Signed-off-by: Andries Kruithof --- include/zephyr/bluetooth/audio/cap.h | 29 +- subsys/bluetooth/audio/cap_commander.c | 288 +++++++++++++++++- subsys/bluetooth/audio/cap_common.c | 3 +- subsys/bluetooth/audio/cap_internal.h | 8 + .../cap_commander/include/cap_commander.h | 1 + .../src/test_broadcast_reception.c | 220 ++++++++++++- .../uut/bap_broadcast_assistant.c | 37 +++ .../audio/cap_commander/uut/cap_commander.c | 5 +- .../bluetooth/audio/src/cap_commander_test.c | 2 +- 9 files changed, 573 insertions(+), 20 deletions(-) diff --git a/include/zephyr/bluetooth/audio/cap.h b/include/zephyr/bluetooth/audio/cap.h index 4417477860dc2..a2023f0e98380 100644 --- a/include/zephyr/bluetooth/audio/cap.h +++ b/include/zephyr/bluetooth/audio/cap.h @@ -826,6 +826,17 @@ struct bt_cap_commander_cb { * by bt_cap_commander_cancel(). */ void (*broadcast_reception_start)(struct bt_conn *conn, int err); + /** + * @brief Callback for bt_cap_commander_broadcast_reception_stop(). + * + * @param conn Pointer to the connection where the error + * occurred. NULL if @p err is 0 or if cancelled by + * bt_cap_commander_cancel() + * @param err 0 on success, BT_GATT_ERR() with a + * specific ATT (BT_ATT_ERR_*) error code or -ECANCELED if cancelled + * by bt_cap_commander_cancel(). + */ + void (*broadcast_reception_stop)(struct bt_conn *conn, int err); #endif /* CONFIG_BT_BAP_BROADCAST_ASSISTANT */ }; @@ -954,14 +965,26 @@ int bt_cap_commander_broadcast_reception_start( const struct bt_cap_commander_broadcast_reception_start_param *param); /** Parameters for stopping broadcast reception */ + +struct bt_cap_commander_broadcast_reception_stop_member_param { + /** Coordinated or ad-hoc set member. */ + union bt_cap_set_member member; + + /** Source ID of the receive state. */ + uint8_t src_id; + + /** Number of subgroups */ + size_t num_subgroups; +}; + struct bt_cap_commander_broadcast_reception_stop_param { /** The type of the set. */ enum bt_cap_set_type type; - /** Coordinated or ad-hoc set member. */ - union bt_cap_set_member *members; + /** The set of devices for this procedure */ + struct bt_cap_commander_broadcast_reception_stop_member_param *param; - /** The number of members in @p members */ + /** The number of parameters in @p param */ size_t count; }; diff --git a/subsys/bluetooth/audio/cap_commander.c b/subsys/bluetooth/audio/cap_commander.c index 70dea22f24b0e..d8e40007eb79d 100644 --- a/subsys/bluetooth/audio/cap_commander.c +++ b/subsys/bluetooth/audio/cap_commander.c @@ -100,7 +100,7 @@ int bt_cap_commander_discover(struct bt_conn *conn) #if defined(CONFIG_BT_BAP_BROADCAST_ASSISTANT) static struct bt_bap_broadcast_assistant_cb broadcast_assistant_cb; -static bool ba_cb_registered; +static bool broadcast_assistant_cb_registered; static void copy_broadcast_reception_start_param(struct bt_bap_broadcast_assistant_add_src_param *add_src_param, @@ -115,7 +115,7 @@ copy_broadcast_reception_start_param(struct bt_bap_broadcast_assistant_add_src_p add_src_param->subgroups = start_param->subgroups; } -static void cap_commander_ba_add_src_cb(struct bt_conn *conn, int err) +static void cap_commander_broadcast_assistant_add_src_cb(struct bt_conn *conn, int err) { struct bt_cap_common_proc *active_proc = bt_cap_common_get_active_proc(); struct bt_bap_broadcast_assistant_add_src_param add_src_param = {0}; @@ -170,7 +170,7 @@ static void cap_commander_ba_add_src_cb(struct bt_conn *conn, int err) } } -static int cap_commander_register_ba_cb(void) +static int cap_commander_register_broadcast_assistant_cb(void) { int err; @@ -181,7 +181,7 @@ static int cap_commander_register_ba_cb(void) return -ENOEXEC; } - ba_cb_registered = true; + broadcast_assistant_cb_registered = true; return 0; } @@ -197,7 +197,7 @@ static bool valid_broadcast_reception_start_param( } CHECKIF(param->count == 0) { - LOG_DBG("Invalid param->count: %u", param->count); + LOG_DBG("Invalid param->count: %zu", param->count); return false; } @@ -345,8 +345,9 @@ int bt_cap_commander_broadcast_reception_start( bt_cap_common_start_proc(BT_CAP_COMMON_PROC_TYPE_BROADCAST_RECEPTION_START, param->count); - broadcast_assistant_cb.add_src = cap_commander_ba_add_src_cb; - if (!ba_cb_registered && cap_commander_register_ba_cb() != 0) { + broadcast_assistant_cb.add_src = cap_commander_broadcast_assistant_add_src_cb; + if (!broadcast_assistant_cb_registered && + cap_commander_register_broadcast_assistant_cb() != 0) { LOG_DBG("Failed to register broadcast assistant callbacks"); return -ENOEXEC; @@ -400,14 +401,278 @@ int bt_cap_commander_broadcast_reception_start( return 0; } -#endif /* CONFIG_BT_BAP_BROADCAST_ASSISTANT */ + +static void +copy_broadcast_reception_stop_param(struct bt_bap_broadcast_assistant_mod_src_param *mod_src_param, + struct cap_broadcast_reception_stop *stop_param) +{ + mod_src_param->src_id = stop_param->src_id; + mod_src_param->pa_sync = false; + mod_src_param->pa_interval = BT_BAP_PA_INTERVAL_UNKNOWN; + mod_src_param->num_subgroups = stop_param->num_subgroups; + + mod_src_param->subgroups = stop_param->subgroups; +} + +static void cap_commander_broadcast_assistant_recv_state_cb( + struct bt_conn *conn, int err, const struct bt_bap_scan_delegator_recv_state *state) +{ + struct bt_cap_common_proc *active_proc = bt_cap_common_get_active_proc(); + + if (state == NULL) { + /* Empty receive state, indicating that the source has been removed + */ + return; + } + + if (bt_cap_common_conn_in_active_proc(conn) && + active_proc->proc_type == BT_CAP_COMMON_PROC_TYPE_BROADCAST_RECEPTION_STOP) { + + LOG_DBG("BASS recv state: conn %p, src_id %u", (void *)conn, state->src_id); + + for (uint8_t i = 0; i < state->num_subgroups; i++) { + const struct bt_bap_bass_subgroup *subgroup = &state->subgroups[i]; + + /* if bis_sync not equals 0 we can not remove the source (yet) + * and we need to wait for another notification + */ + if (subgroup->bis_sync != 0) { + return; + } + } + + LOG_DBG("Removing source for conn %p", (void *)conn); + err = bt_bap_broadcast_assistant_rem_src(conn, state->src_id); + if (err != 0) { + LOG_DBG("Failed to rem_src for conn %p: %d", (void *)conn, err); + bt_cap_common_abort_proc(conn, err); + cap_commander_proc_complete(); + } + } +} + +static void cap_commander_broadcast_assistant_rem_src_cb(struct bt_conn *conn, int err) +{ + struct bt_cap_common_proc *active_proc = bt_cap_common_get_active_proc(); + struct bt_bap_broadcast_assistant_mod_src_param mod_src_param = {0}; + + if (!bt_cap_common_conn_in_active_proc(conn)) { + /* State change happened outside of a procedure; ignore */ + return; + } + + if (err != 0) { + LOG_DBG("Failed removing source: %d", err); + LOG_DBG("Aborting the proc %d %d", active_proc->proc_done_cnt, + active_proc->proc_initiated_cnt); + + bt_cap_common_abort_proc(conn, err); + } else { + active_proc->proc_done_cnt++; + + LOG_DBG("Conn %p broadcast source removed (%zu/%zu streams done)", (void *)conn, + active_proc->proc_done_cnt, active_proc->proc_cnt); + } + + if (bt_cap_common_proc_is_aborted()) { + if (bt_cap_common_proc_all_handled()) { + cap_commander_proc_complete(); + } + + return; + } + + if (!bt_cap_common_proc_is_done()) { + struct bt_cap_commander_proc_param *proc_param; + + proc_param = &active_proc->proc_param.commander[active_proc->proc_done_cnt]; + conn = proc_param->conn; + copy_broadcast_reception_stop_param(&mod_src_param, + &proc_param->broadcast_reception_stop); + active_proc->proc_initiated_cnt++; + err = bt_bap_broadcast_assistant_mod_src(conn, &mod_src_param); + if (err != 0) { + LOG_DBG("Failed to mod_src for conn %p: %d", (void *)conn, err); + bt_cap_common_abort_proc(conn, err); + cap_commander_proc_complete(); + } + } else { + cap_commander_proc_complete(); + } +} + +static void cap_commander_broadcast_assistant_mod_src_cb(struct bt_conn *conn, int err) +{ + struct bt_cap_common_proc *active_proc = bt_cap_common_get_active_proc(); + + if (!bt_cap_common_conn_in_active_proc(conn)) { + /* State change happened outside of a procedure; ignore */ + return; + } + + if (err != 0) { + LOG_DBG("Failed modifying source: %d", err); + LOG_DBG("Aborting the proc %d %d", active_proc->proc_done_cnt, + active_proc->proc_initiated_cnt); + + bt_cap_common_abort_proc(conn, err); + } else { + LOG_DBG("Conn %p broadcast source modifified (%zu/%zu streams done)", (void *)conn, + active_proc->proc_done_cnt, active_proc->proc_cnt); + } + + if (bt_cap_common_proc_is_aborted()) { + if (bt_cap_common_proc_all_handled()) { + cap_commander_proc_complete(); + } + } +} + +static bool valid_broadcast_reception_stop_param( + const struct bt_cap_commander_broadcast_reception_stop_param *param) +{ + CHECKIF(param == NULL) { + LOG_DBG("param is NULL"); + return false; + } + + CHECKIF(param->count == 0) { + LOG_DBG("Invalid param->count: %zu", param->count); + return false; + } + + CHECKIF(param->count > CONFIG_BT_MAX_CONN) { + LOG_DBG("param->count (%zu) is larger than CONFIG_BT_MAX_CONN (%d)", param->count, + CONFIG_BT_MAX_CONN); + return false; + } + + CHECKIF(param->param == NULL) { + LOG_DBG("param->param is NULL"); + return false; + } + + for (size_t i = 0; i < param->count; i++) { + const struct bt_cap_commander_broadcast_reception_stop_member_param *stop_param = + ¶m->param[i]; + const union bt_cap_set_member *member = ¶m->param[i].member; + const struct bt_conn *member_conn = + bt_cap_common_get_member_conn(param->type, member); + + if (member == NULL) { + LOG_DBG("param->param[%zu].member is NULL", i); + return false; + } + + if (member_conn == NULL) { + LOG_DBG("Invalid param->param[%zu].member", i); + return false; + } + + CHECKIF(stop_param->num_subgroups == 0) { + LOG_DBG("param->param[%zu]->num_subgroups is 0", i); + return false; + } + + CHECKIF(stop_param->num_subgroups > CONFIG_BT_BAP_BASS_MAX_SUBGROUPS) { + LOG_DBG("Too many subgroups %u/%u", stop_param->num_subgroups, + CONFIG_BT_BAP_BASS_MAX_SUBGROUPS); + return false; + } + + for (size_t j = 0U; j < i; j++) { + const union bt_cap_set_member *other = ¶m->param[j].member; + uint8_t other_src_id = param->param[j].src_id; + + if (other == member && stop_param->src_id == other_src_id) { + LOG_DBG("param->members[%zu], src_id %d (%p) is duplicated by " + "param->members[%zu], src_id %d (%p)", + j, other_src_id, other, i, stop_param->src_id, member); + return false; + } + } + } + + return true; +} int bt_cap_commander_broadcast_reception_stop( const struct bt_cap_commander_broadcast_reception_stop_param *param) { - return -ENOSYS; + struct bt_bap_broadcast_assistant_mod_src_param mod_src_param = {0}; + struct bt_cap_commander_proc_param *proc_param; + struct bt_cap_common_proc *active_proc; + struct bt_conn *conn; + int err; + + if (bt_cap_common_proc_is_active()) { + LOG_DBG("A CAP procedure is already in progress"); + + return -EBUSY; + } + + if (!valid_broadcast_reception_stop_param(param)) { + return -EINVAL; + } + + bt_cap_common_start_proc(BT_CAP_COMMON_PROC_TYPE_BROADCAST_RECEPTION_STOP, param->count); + + broadcast_assistant_cb.mod_src = cap_commander_broadcast_assistant_mod_src_cb; + broadcast_assistant_cb.rem_src = cap_commander_broadcast_assistant_rem_src_cb; + broadcast_assistant_cb.recv_state = cap_commander_broadcast_assistant_recv_state_cb; + if (!broadcast_assistant_cb_registered && + cap_commander_register_broadcast_assistant_cb() != 0) { + LOG_DBG("Failed to register broadcast assistant callbacks"); + + return -ENOEXEC; + } + + active_proc = bt_cap_common_get_active_proc(); + + for (size_t i = 0U; i < param->count; i++) { + const struct bt_cap_commander_broadcast_reception_stop_member_param *member_param = + ¶m->param[i]; + struct bt_cap_commander_proc_param *stored_param; + struct bt_conn *member_conn = + bt_cap_common_get_member_conn(param->type, &member_param->member); + + if (member_conn == NULL) { + LOG_DBG("Invalid param->member[%zu]", i); + + return -EINVAL; + } + /* Store the necessary parameters as we cannot assume that the supplied + * parameters are kept valid + */ + stored_param = &active_proc->proc_param.commander[i]; + stored_param->conn = member_conn; + stored_param->broadcast_reception_stop.src_id = member_param->src_id; + stored_param->broadcast_reception_stop.num_subgroups = member_param->num_subgroups; + for (size_t j = 0U; j < CONFIG_BT_BAP_BASS_MAX_SUBGROUPS; j++) { + stored_param->broadcast_reception_stop.subgroups[j].bis_sync = 0; + stored_param->broadcast_reception_stop.subgroups[j].metadata_len = 0; + } + } + + proc_param = &active_proc->proc_param.commander[0]; + + conn = proc_param->conn; + copy_broadcast_reception_stop_param(&mod_src_param, &proc_param->broadcast_reception_stop); + + active_proc->proc_initiated_cnt++; + + err = bt_bap_broadcast_assistant_mod_src(conn, &mod_src_param); + if (err != 0) { + LOG_DBG("Failed to stop broadcast reception for conn %p: %d", (void *)conn, err); + + return -ENOEXEC; + } + + return 0; } +#endif /* CONFIG_BT_BAP_BROADCAST_ASSISTANT */ + static void cap_commander_proc_complete(void) { struct bt_cap_common_proc *active_proc = bt_cap_common_get_active_proc(); @@ -464,6 +729,11 @@ static void cap_commander_proc_complete(void) cap_cb->broadcast_reception_start(failed_conn, err); } break; + case BT_CAP_COMMON_PROC_TYPE_BROADCAST_RECEPTION_STOP: + if (cap_cb->broadcast_reception_stop != NULL) { + cap_cb->broadcast_reception_stop(failed_conn, err); + } + break; #endif /* CONFIG_BT_BAP_BROADCAST_ASSISTANT */ case BT_CAP_COMMON_PROC_TYPE_NONE: default: diff --git a/subsys/bluetooth/audio/cap_common.c b/subsys/bluetooth/audio/cap_common.c index 8780a3e357afe..5d277bbf19a30 100644 --- a/subsys/bluetooth/audio/cap_common.c +++ b/subsys/bluetooth/audio/cap_common.c @@ -163,6 +163,7 @@ static bool active_proc_is_commander(void) case BT_CAP_COMMON_PROC_TYPE_MICROPHONE_GAIN_CHANGE: case BT_CAP_COMMON_PROC_TYPE_MICROPHONE_MUTE_CHANGE: case BT_CAP_COMMON_PROC_TYPE_BROADCAST_RECEPTION_START: + case BT_CAP_COMMON_PROC_TYPE_BROADCAST_RECEPTION_STOP: return true; default: return false; @@ -190,7 +191,7 @@ bool bt_cap_common_conn_in_active_proc(const struct bt_conn *conn) return true; } } -#endif /* CONFIG_BT_CAP_INITIATOR_UNICAST */ +#endif /* CONFIG_BT_CAP_COMMANDER */ } return false; diff --git a/subsys/bluetooth/audio/cap_internal.h b/subsys/bluetooth/audio/cap_internal.h index 3543b35c3876e..c063f8c834166 100644 --- a/subsys/bluetooth/audio/cap_internal.h +++ b/subsys/bluetooth/audio/cap_internal.h @@ -48,6 +48,7 @@ enum bt_cap_common_proc_type { BT_CAP_COMMON_PROC_TYPE_UPDATE, BT_CAP_COMMON_PROC_TYPE_STOP, BT_CAP_COMMON_PROC_TYPE_BROADCAST_RECEPTION_START, + BT_CAP_COMMON_PROC_TYPE_BROADCAST_RECEPTION_STOP, BT_CAP_COMMON_PROC_TYPE_VOLUME_CHANGE, BT_CAP_COMMON_PROC_TYPE_VOLUME_OFFSET_CHANGE, BT_CAP_COMMON_PROC_TYPE_VOLUME_MUTE_CHANGE, @@ -99,6 +100,12 @@ struct cap_broadcast_reception_start { uint8_t num_subgroups; struct bt_bap_bass_subgroup subgroups[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]; }; + +struct cap_broadcast_reception_stop { + uint8_t src_id; + uint8_t num_subgroups; + struct bt_bap_bass_subgroup subgroups[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]; +}; #endif /* CONFIG_BT_BAP_BROADCAST_ASSISTANT */ struct bt_cap_commander_proc_param { @@ -120,6 +127,7 @@ struct bt_cap_commander_proc_param { #endif /* CONFIG_BT_VCP_VOL_CTLR_VOCS */ #if defined(CONFIG_BT_BAP_BROADCAST_ASSISTANT) struct cap_broadcast_reception_start broadcast_reception_start; + struct cap_broadcast_reception_stop broadcast_reception_stop; #endif /* CONFIG_BT_BAP_BROADCAST_ASSISTANT */ #if defined(CONFIG_BT_MICP_MIC_CTLR) struct { diff --git a/tests/bluetooth/audio/cap_commander/include/cap_commander.h b/tests/bluetooth/audio/cap_commander/include/cap_commander.h index 3f1f8691fd96b..68690073d6eff 100644 --- a/tests/bluetooth/audio/cap_commander/include/cap_commander.h +++ b/tests/bluetooth/audio/cap_commander/include/cap_commander.h @@ -24,5 +24,6 @@ DECLARE_FAKE_VOID_FUNC(mock_cap_commander_volume_offset_changed_cb, struct bt_co DECLARE_FAKE_VOID_FUNC(mock_cap_commander_microphone_mute_changed_cb, struct bt_conn *, int); DECLARE_FAKE_VOID_FUNC(mock_cap_commander_microphone_gain_changed_cb, struct bt_conn *, int); DECLARE_FAKE_VOID_FUNC(mock_cap_commander_broadcast_reception_start_cb, struct bt_conn *, int); +DECLARE_FAKE_VOID_FUNC(mock_cap_commander_broadcast_reception_stop_cb, struct bt_conn *, int); #endif /* MOCKS_CAP_COMMANDER_H_ */ diff --git a/tests/bluetooth/audio/cap_commander/src/test_broadcast_reception.c b/tests/bluetooth/audio/cap_commander/src/test_broadcast_reception.c index ee6c82761f26d..7da6150d08161 100644 --- a/tests/bluetooth/audio/cap_commander/src/test_broadcast_reception.c +++ b/tests/bluetooth/audio/cap_commander/src/test_broadcast_reception.c @@ -32,13 +32,17 @@ LOG_MODULE_REGISTER(bt_broadcast_reception_test, CONFIG_BT_CAP_COMMANDER_LOG_LEV struct cap_commander_test_broadcast_reception_fixture { struct bt_conn conns[CONFIG_BT_MAX_CONN]; - struct bt_bap_bass_subgroup start_subgroups[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]; + struct bt_bap_bass_subgroup subgroups[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]; struct bt_cap_commander_broadcast_reception_start_member_param start_member_params[CONFIG_BT_MAX_CONN]; struct bt_cap_commander_broadcast_reception_start_param start_param; + struct bt_cap_commander_broadcast_reception_stop_member_param + stop_member_params[CONFIG_BT_MAX_CONN]; + struct bt_cap_commander_broadcast_reception_stop_param stop_param; }; static void test_start_param_init(void *f); +static void test_stop_param_init(void *f); static void cap_commander_test_broadcast_reception_fixture_init( struct cap_commander_test_broadcast_reception_fixture *fixture) @@ -47,6 +51,7 @@ static void cap_commander_test_broadcast_reception_fixture_init( test_conn_init(&fixture->conns[i]); } test_start_param_init(fixture); + test_stop_param_init(fixture); } static void *cap_commander_test_broadcast_reception_setup(void) @@ -91,9 +96,9 @@ static void test_start_param_init(void *f) fixture->start_param.count = ARRAY_SIZE(fixture->start_member_params); - for (size_t i = 0; i < ARRAY_SIZE(fixture->start_subgroups); i++) { - fixture->start_subgroups[i].bis_sync = i; - fixture->start_subgroups[i].metadata_len = 0; + for (size_t i = 0; i < ARRAY_SIZE(fixture->subgroups); i++) { + fixture->subgroups[i].bis_sync = 1 << i; + fixture->subgroups[i].metadata_len = 0; } for (size_t i = 0U; i < ARRAY_SIZE(fixture->start_member_params); i++) { @@ -102,7 +107,7 @@ static void test_start_param_init(void *f) fixture->start_member_params[i].adv_sid = SID; fixture->start_member_params[i].pa_interval = ADV_INTERVAL; fixture->start_member_params[i].broadcast_id = BROADCAST_ID; - memcpy(fixture->start_member_params[i].subgroups, &fixture->start_subgroups[0], + memcpy(fixture->start_member_params[i].subgroups, &fixture->subgroups[0], sizeof(struct bt_bap_bass_subgroup) * CONFIG_BT_BAP_BASS_MAX_SUBGROUPS); fixture->start_member_params[i].num_subgroups = CONFIG_BT_BAP_BASS_MAX_SUBGROUPS; } @@ -117,6 +122,28 @@ static void test_start_param_init(void *f) } } +static void test_stop_param_init(void *f) +{ + struct cap_commander_test_broadcast_reception_fixture *fixture = f; + int err; + + fixture->stop_param.type = BT_CAP_SET_TYPE_AD_HOC; + fixture->stop_param.param = fixture->stop_member_params; + + fixture->stop_param.count = ARRAY_SIZE(fixture->stop_member_params); + + for (size_t i = 0U; i < ARRAY_SIZE(fixture->stop_member_params); i++) { + fixture->stop_member_params[i].member.member = &fixture->conns[i]; + fixture->stop_member_params[i].src_id = SID; + fixture->stop_member_params[i].num_subgroups = CONFIG_BT_BAP_BASS_MAX_SUBGROUPS; + } + + for (size_t i = 0; i < ARRAY_SIZE(fixture->conns); i++) { + err = bt_cap_commander_discover(&fixture->conns[i]); + zassert_equal(0, err, "Unexpected return value %d", err); + } +} + ZTEST_SUITE(cap_commander_test_broadcast_reception, NULL, cap_commander_test_broadcast_reception_setup, cap_commander_test_broadcast_reception_before, @@ -371,3 +398,186 @@ ZTEST_F(cap_commander_test_broadcast_reception, test_commander_reception_start_i zexpect_call_count("bt_cap_commander_cb.broadcast_reception_start", 0, mock_cap_commander_broadcast_reception_start_cb_fake.call_count); } + +ZTEST_F(cap_commander_test_broadcast_reception, test_commander_reception_stop_default_subgroups) +{ + int err; + + err = bt_cap_commander_register_cb(&mock_cap_commander_cb); + zassert_equal(0, err, "Unexpected return value %d", err); + + err = bt_cap_commander_broadcast_reception_start(&fixture->start_param); + zassert_equal(0, err, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_commander_cb.broadcast_reception_start", 1, + mock_cap_commander_broadcast_reception_start_cb_fake.call_count); + zassert_equal_ptr(NULL, + mock_cap_commander_broadcast_reception_start_cb_fake.arg0_history[0]); + zassert_equal(0, mock_cap_commander_broadcast_reception_start_cb_fake.arg1_history[0]); + + err = bt_cap_commander_broadcast_reception_stop(&fixture->stop_param); + zassert_equal(0, err, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_commander_cb.broadcast_reception_stop", 1, + mock_cap_commander_broadcast_reception_stop_cb_fake.call_count); + zassert_equal_ptr(NULL, + mock_cap_commander_broadcast_reception_stop_cb_fake.arg0_history[0]); + zassert_equal(0, mock_cap_commander_broadcast_reception_stop_cb_fake.arg1_history[0]); +} + +ZTEST_F(cap_commander_test_broadcast_reception, test_commander_reception_stop_one_subgroup) +{ + int err; + + err = bt_cap_commander_register_cb(&mock_cap_commander_cb); + zassert_equal(0, err, "Unexpected return value %d", err); + + err = bt_cap_commander_broadcast_reception_start(&fixture->start_param); + zassert_equal(0, err, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_commander_cb.broadcast_reception_start", 1, + mock_cap_commander_broadcast_reception_start_cb_fake.call_count); + zassert_equal_ptr(NULL, + mock_cap_commander_broadcast_reception_start_cb_fake.arg0_history[0]); + zassert_equal(0, mock_cap_commander_broadcast_reception_start_cb_fake.arg1_history[0]); + + /* We test with one subgroup, instead of CONFIG_BT_BAP_BASS_MAX_SUBGROUPS subgroups */ + for (size_t i = 0U; i < CONFIG_BT_MAX_CONN; i++) { + printk("Source ID %d: %d\n", i, fixture->stop_param.param[i].src_id); + + fixture->stop_param.param[i].num_subgroups = 1; + } + + err = bt_cap_commander_broadcast_reception_stop(&fixture->stop_param); + zassert_equal(0, err, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_commander_cb.broadcast_reception_stop", 1, + mock_cap_commander_broadcast_reception_stop_cb_fake.call_count); + zassert_equal_ptr(NULL, + mock_cap_commander_broadcast_reception_stop_cb_fake.arg0_history[0]); + zassert_equal(0, mock_cap_commander_broadcast_reception_stop_cb_fake.arg1_history[0]); +} + +ZTEST_F(cap_commander_test_broadcast_reception, test_commander_reception_stop_double) +{ + int err; + + err = bt_cap_commander_register_cb(&mock_cap_commander_cb); + zassert_equal(0, err, "Unexpected return value %d", err); + printk("Source ID: %d\n", fixture->stop_param.param[0].src_id); + err = bt_cap_commander_broadcast_reception_stop(&fixture->stop_param); + zassert_equal(0, err, "Unexpected return value %d", err); + + err = bt_cap_commander_broadcast_reception_stop(&fixture->stop_param); + zassert_equal(0, err, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_commander_cb.broadcast_reception_stop", 2, + mock_cap_commander_broadcast_reception_stop_cb_fake.call_count); +} + +ZTEST_F(cap_commander_test_broadcast_reception, test_commander_reception_stop_inval_param_null) +{ + int err; + + err = bt_cap_commander_broadcast_reception_stop(NULL); + zassert_equal(-EINVAL, err, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_commander_cb.broadcast_reception_stop", 0, + mock_cap_commander_broadcast_reception_stop_cb_fake.call_count); +} + +ZTEST_F(cap_commander_test_broadcast_reception, + test_commander_reception_stop_inval_param_zero_count) +{ + int err; + + fixture->stop_param.count = 0; + + err = bt_cap_commander_broadcast_reception_stop(&fixture->stop_param); + zassert_equal(-EINVAL, err, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_commander_cb.broadcast_reception_stop", 0, + mock_cap_commander_broadcast_reception_stop_cb_fake.call_count); +} + +ZTEST_F(cap_commander_test_broadcast_reception, + test_commander_reception_stop_inval_param_high_count) +{ + int err; + + fixture->stop_param.count = CONFIG_BT_MAX_CONN + 1; + + err = bt_cap_commander_broadcast_reception_stop(&fixture->stop_param); + zassert_equal(-EINVAL, err, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_commander_cb.broadcast_reception_stop", 0, + mock_cap_commander_broadcast_reception_stop_cb_fake.call_count); +} + +ZTEST_F(cap_commander_test_broadcast_reception, + test_commander_reception_stop_inval_param_null_param) +{ + int err; + + fixture->stop_param.type = BT_CAP_SET_TYPE_AD_HOC; + fixture->stop_param.param = NULL; + fixture->stop_param.count = ARRAY_SIZE(fixture->conns); + + err = bt_cap_commander_broadcast_reception_stop(&fixture->stop_param); + zassert_equal(-EINVAL, err, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_commander_cb.broadcast_reception_stop", 0, + mock_cap_commander_broadcast_reception_stop_cb_fake.call_count); +} + +ZTEST_F(cap_commander_test_broadcast_reception, test_commander_reception_stop_inval_null_member) +{ + int err; + + fixture->stop_param.param[0].member.member = NULL; + + err = bt_cap_commander_broadcast_reception_stop(&fixture->stop_param); + zassert_equal(-EINVAL, err, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_commander_cb.broadcast_reception_stop", 0, + mock_cap_commander_broadcast_reception_stop_cb_fake.call_count); +} + +ZTEST_F(cap_commander_test_broadcast_reception, test_commander_reception_stop_inval_missing_cas) +{ + int err; + + fixture->stop_param.type = BT_CAP_SET_TYPE_CSIP; + + err = bt_cap_commander_broadcast_reception_stop(&fixture->stop_param); + zassert_equal(-EINVAL, err, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_commander_cb.broadcast_reception_stop", 0, + mock_cap_commander_broadcast_reception_stop_cb_fake.call_count); +} + +ZTEST_F(cap_commander_test_broadcast_reception, test_commander_reception_stop_inval_no_subgroups) +{ + int err; + + fixture->stop_param.param[0].num_subgroups = 0; + + err = bt_cap_commander_broadcast_reception_stop(&fixture->stop_param); + zassert_equal(-EINVAL, err, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_commander_cb.broadcast_reception_stop", 0, + mock_cap_commander_broadcast_reception_stop_cb_fake.call_count); +} + +ZTEST_F(cap_commander_test_broadcast_reception, test_commander_reception_stop_inval_num_subgroups) +{ + int err; + + fixture->stop_param.param[0].num_subgroups = CONFIG_BT_BAP_BASS_MAX_SUBGROUPS + 1; + + err = bt_cap_commander_broadcast_reception_stop(&fixture->stop_param); + zassert_equal(-EINVAL, err, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_commander_cb.broadcast_reception_stop", 0, + mock_cap_commander_broadcast_reception_stop_cb_fake.call_count); +} diff --git a/tests/bluetooth/audio/cap_commander/uut/bap_broadcast_assistant.c b/tests/bluetooth/audio/cap_commander/uut/bap_broadcast_assistant.c index e4ec106c8f658..606eb71aad822 100644 --- a/tests/bluetooth/audio/cap_commander/uut/bap_broadcast_assistant.c +++ b/tests/bluetooth/audio/cap_commander/uut/bap_broadcast_assistant.c @@ -28,3 +28,40 @@ int bt_bap_broadcast_assistant_add_src(struct bt_conn *conn, return 0; } + +int bt_bap_broadcast_assistant_mod_src(struct bt_conn *conn, + const struct bt_bap_broadcast_assistant_mod_src_param *param) +{ + struct bt_bap_scan_delegator_recv_state state; + + zassert_not_null(conn, "conn is NULL"); + zassert_not_null(param, "param is NULL"); + + state.pa_sync_state = param->pa_sync ? BT_BAP_PA_STATE_SYNCED : BT_BAP_PA_STATE_NOT_SYNCED; + state.src_id = param->src_id; + state.num_subgroups = param->num_subgroups; + for (size_t i = 0; i < param->num_subgroups; i++) { + state.subgroups[i].bis_sync = param->subgroups[i].bis_sync; + } + + if (broadcast_assistant_cbs->mod_src != NULL) { + broadcast_assistant_cbs->mod_src(conn, 0); + } + if (broadcast_assistant_cbs->recv_state != NULL) { + broadcast_assistant_cbs->recv_state(conn, 0, &state); + } + + return 0; +} + +int bt_bap_broadcast_assistant_rem_src(struct bt_conn *conn, uint8_t src_id) +{ + zassert_not_null(conn, "conn is NULL"); + zassert_not_equal(src_id, 0, "src_id is 0"); + + if (broadcast_assistant_cbs->rem_src != NULL) { + broadcast_assistant_cbs->rem_src(conn, 0); + } + + return 0; +} diff --git a/tests/bluetooth/audio/cap_commander/uut/cap_commander.c b/tests/bluetooth/audio/cap_commander/uut/cap_commander.c index 19e382aec2cf5..1e1de370b73e0 100644 --- a/tests/bluetooth/audio/cap_commander/uut/cap_commander.c +++ b/tests/bluetooth/audio/cap_commander/uut/cap_commander.c @@ -16,7 +16,8 @@ FAKE(mock_cap_commander_volume_offset_changed_cb) \ FAKE(mock_cap_commander_microphone_mute_changed_cb) \ FAKE(mock_cap_commander_microphone_gain_changed_cb) \ - FAKE(mock_cap_commander_broadcast_reception_start_cb) + FAKE(mock_cap_commander_broadcast_reception_start_cb) \ + FAKE(mock_cap_commander_broadcast_reception_stop_cb) DEFINE_FAKE_VOID_FUNC(mock_cap_commander_discovery_complete_cb, struct bt_conn *, int, const struct bt_csip_set_coordinator_set_member *, @@ -28,6 +29,7 @@ DEFINE_FAKE_VOID_FUNC(mock_cap_commander_volume_offset_changed_cb, struct bt_con DEFINE_FAKE_VOID_FUNC(mock_cap_commander_microphone_mute_changed_cb, struct bt_conn *, int); DEFINE_FAKE_VOID_FUNC(mock_cap_commander_microphone_gain_changed_cb, struct bt_conn *, int); DEFINE_FAKE_VOID_FUNC(mock_cap_commander_broadcast_reception_start_cb, struct bt_conn *, int); +DEFINE_FAKE_VOID_FUNC(mock_cap_commander_broadcast_reception_stop_cb, struct bt_conn *, int); const struct bt_cap_commander_cb mock_cap_commander_cb = { .discovery_complete = mock_cap_commander_discovery_complete_cb, @@ -46,6 +48,7 @@ const struct bt_cap_commander_cb mock_cap_commander_cb = { #endif /* CONFIG_BT_MICP_MIC_CTLR */ #if defined(CONFIG_BT_BAP_BROADCAST_ASSISTANT) .broadcast_reception_start = mock_cap_commander_broadcast_reception_start_cb, + .broadcast_reception_stop = mock_cap_commander_broadcast_reception_stop_cb, #endif /* CONFIG_BT_BAP_BROADCAST_ASSISTANT */ }; diff --git a/tests/bsim/bluetooth/audio/src/cap_commander_test.c b/tests/bsim/bluetooth/audio/src/cap_commander_test.c index 7a849fc1912cb..e27b75e91e6be 100644 --- a/tests/bsim/bluetooth/audio/src/cap_commander_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_commander_test.c @@ -982,7 +982,7 @@ static void test_broadcast_reception_stop(size_t acceptor_count) /* reception stop is not implemented yet, for now the following command will fail*/ reception_stop_param.type = BT_CAP_SET_TYPE_AD_HOC; - reception_stop_param.members = NULL; + reception_stop_param.param = NULL; reception_stop_param.count = 0U; err = bt_cap_commander_broadcast_reception_stop(&reception_stop_param); if (err != 0) { From a63665438a845499478456f6a3b11dee0e3b7c3c Mon Sep 17 00:00:00 2001 From: Andries Kruithof Date: Tue, 6 Aug 2024 16:39:15 +0200 Subject: [PATCH 0104/4482] Bluetooth: Audio: improve broadcast reception stop unittest Add more parameter checking for the unittests for the CAP procedure 'broadcast reception stop' Signed-off-by: Andries Kruithof --- .../src/test_broadcast_reception.c | 159 +++++++++++------- .../uut/bap_broadcast_assistant.c | 139 +++++++++++++-- 2 files changed, 222 insertions(+), 76 deletions(-) diff --git a/tests/bluetooth/audio/cap_commander/src/test_broadcast_reception.c b/tests/bluetooth/audio/cap_commander/src/test_broadcast_reception.c index 7da6150d08161..61827719bb5fd 100644 --- a/tests/bluetooth/audio/cap_commander/src/test_broadcast_reception.c +++ b/tests/bluetooth/audio/cap_commander/src/test_broadcast_reception.c @@ -1,4 +1,4 @@ -/* test_broadcast_reception.c - unit test for broadcast reception */ +/* test_broadcast_reception.c - unit test for broadcast reception start and stop */ /* * Copyright (c) 2024 Nordic Semiconductor ASA @@ -21,6 +21,8 @@ #include +int bt_cap_common_proc_is_active(void); + LOG_MODULE_REGISTER(bt_broadcast_reception_test, CONFIG_BT_CAP_COMMANDER_LOG_LEVEL); #define FFF_GLOBALS @@ -39,19 +41,40 @@ struct cap_commander_test_broadcast_reception_fixture { struct bt_cap_commander_broadcast_reception_stop_member_param stop_member_params[CONFIG_BT_MAX_CONN]; struct bt_cap_commander_broadcast_reception_stop_param stop_param; + struct bt_bap_broadcast_assistant_cb broadcast_assistant_cb; }; +/* src_id can not be part of the fixture since it is accessed in the callback function */ +static uint8_t src_id[CONFIG_BT_MAX_CONN]; + static void test_start_param_init(void *f); static void test_stop_param_init(void *f); +static void cap_commander_broadcast_assistant_recv_state_cb( + struct bt_conn *conn, int err, const struct bt_bap_scan_delegator_recv_state *state) +{ + uint8_t index; + + index = bt_conn_index(conn); + src_id[index] = state->src_id; +} + static void cap_commander_test_broadcast_reception_fixture_init( struct cap_commander_test_broadcast_reception_fixture *fixture) { + int err; + for (size_t i = 0; i < ARRAY_SIZE(fixture->conns); i++) { test_conn_init(&fixture->conns[i]); + fixture->conns[i].index = i; } test_start_param_init(fixture); test_stop_param_init(fixture); + + fixture->broadcast_assistant_cb.recv_state = + cap_commander_broadcast_assistant_recv_state_cb; + err = bt_bap_broadcast_assistant_register_cb(&fixture->broadcast_assistant_cb); + zassert_equal(0, err, "Failed registering broadcast assistant callback functions %d", err); } static void *cap_commander_test_broadcast_reception_setup(void) @@ -66,15 +89,28 @@ static void *cap_commander_test_broadcast_reception_setup(void) static void cap_commander_test_broadcast_reception_before(void *f) { + int err; + struct cap_commander_test_broadcast_reception_fixture *fixture = f; + memset(f, 0, sizeof(struct cap_commander_test_broadcast_reception_fixture)); - cap_commander_test_broadcast_reception_fixture_init(f); + cap_commander_test_broadcast_reception_fixture_init(fixture); + + for (size_t i = 0; i < ARRAY_SIZE(fixture->conns); i++) { + err = bt_cap_commander_discover(&fixture->conns[i]); + zassert_equal(0, err, "Unexpected return value %d", err); + } } static void cap_commander_test_broadcast_reception_after(void *f) { struct cap_commander_test_broadcast_reception_fixture *fixture = f; + int err; bt_cap_commander_unregister_cb(&mock_cap_commander_cb); + bt_bap_broadcast_assistant_unregister_cb(&fixture->broadcast_assistant_cb); + + /* We need to cleanup since the CAP commander remembers state */ + err = bt_cap_commander_cancel(); for (size_t i = 0; i < ARRAY_SIZE(fixture->conns); i++) { mock_bt_conn_disconnected(&fixture->conns[i], BT_HCI_ERR_REMOTE_USER_TERM_CONN); @@ -116,32 +152,51 @@ static void test_start_param_init(void *f) err = bt_cap_commander_discover(&fixture->conns[i]); zassert_equal(0, err, "Unexpected return value %d", err); } - - for (size_t i = 0U; i < ARRAY_SIZE(fixture->start_member_params); i++) { - fixture->start_member_params[i].member.member = &fixture->conns[i]; - } } static void test_stop_param_init(void *f) { struct cap_commander_test_broadcast_reception_fixture *fixture = f; - int err; fixture->stop_param.type = BT_CAP_SET_TYPE_AD_HOC; fixture->stop_param.param = fixture->stop_member_params; - fixture->stop_param.count = ARRAY_SIZE(fixture->stop_member_params); for (size_t i = 0U; i < ARRAY_SIZE(fixture->stop_member_params); i++) { fixture->stop_member_params[i].member.member = &fixture->conns[i]; - fixture->stop_member_params[i].src_id = SID; + fixture->stop_member_params[i].src_id = 0; fixture->stop_member_params[i].num_subgroups = CONFIG_BT_BAP_BASS_MAX_SUBGROUPS; } +} - for (size_t i = 0; i < ARRAY_SIZE(fixture->conns); i++) { - err = bt_cap_commander_discover(&fixture->conns[i]); - zassert_equal(0, err, "Unexpected return value %d", err); - } +static void +test_broadcast_reception_start(struct bt_cap_commander_broadcast_reception_start_param *start_param) +{ + int err; + + err = bt_cap_commander_broadcast_reception_start(start_param); + zassert_equal(0, err, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_commander_cb.broadcast_reception_start", 1, + mock_cap_commander_broadcast_reception_start_cb_fake.call_count); + zassert_equal_ptr(NULL, + mock_cap_commander_broadcast_reception_start_cb_fake.arg0_history[0]); + zassert_equal(0, mock_cap_commander_broadcast_reception_start_cb_fake.arg1_history[0]); +} + +static void +test_broadcast_reception_stop(struct bt_cap_commander_broadcast_reception_stop_param *stop_param) +{ + int err; + + err = bt_cap_commander_broadcast_reception_stop(stop_param); + zassert_equal(0, err, "Unexpected return value %d", err); + + zexpect_call_count("bt_cap_commander_cb.broadcast_reception_stop", 1, + mock_cap_commander_broadcast_reception_stop_cb_fake.call_count); + zassert_equal_ptr(NULL, + mock_cap_commander_broadcast_reception_stop_cb_fake.arg0_history[0]); + zassert_equal(0, mock_cap_commander_broadcast_reception_stop_cb_fake.arg1_history[0]); } ZTEST_SUITE(cap_commander_test_broadcast_reception, NULL, @@ -157,11 +212,7 @@ ZTEST_F(cap_commander_test_broadcast_reception, test_commander_reception_start) err = bt_cap_commander_register_cb(&mock_cap_commander_cb); zassert_equal(0, err, "Unexpected return value %d", err); - err = bt_cap_commander_broadcast_reception_start(&fixture->start_param); - zassert_equal(0, err, "Unexpected return value %d", err); - - zexpect_call_count("bt_cap_commander_cb.broadcast_reception_start", 1, - mock_cap_commander_broadcast_reception_start_cb_fake.call_count); + test_broadcast_reception_start(&fixture->start_param); } ZTEST_F(cap_commander_test_broadcast_reception, test_commander_reception_start_one_subgroup) @@ -176,11 +227,7 @@ ZTEST_F(cap_commander_test_broadcast_reception, test_commander_reception_start_o fixture->start_param.param[i].num_subgroups = 1; } - err = bt_cap_commander_broadcast_reception_start(&fixture->start_param); - zassert_equal(0, err, "Unexpected return value %d", err); - - zexpect_call_count("bt_cap_commander_cb.broadcast_reception_start", 1, - mock_cap_commander_broadcast_reception_start_cb_fake.call_count); + test_broadcast_reception_start(&fixture->start_param); } ZTEST_F(cap_commander_test_broadcast_reception, test_commander_reception_start_double) @@ -190,9 +237,12 @@ ZTEST_F(cap_commander_test_broadcast_reception, test_commander_reception_start_d err = bt_cap_commander_register_cb(&mock_cap_commander_cb); zassert_equal(0, err, "Unexpected return value %d", err); - err = bt_cap_commander_broadcast_reception_start(&fixture->start_param); - zassert_equal(0, err, "Unexpected return value %d", err); + test_broadcast_reception_start(&fixture->start_param); + /* + * We can not use test_broadcast_reception_start because of the check on how often the + * callback function is called + */ err = bt_cap_commander_broadcast_reception_start(&fixture->start_param); zassert_equal(0, err, "Unexpected return value %d", err); @@ -406,23 +456,13 @@ ZTEST_F(cap_commander_test_broadcast_reception, test_commander_reception_stop_de err = bt_cap_commander_register_cb(&mock_cap_commander_cb); zassert_equal(0, err, "Unexpected return value %d", err); - err = bt_cap_commander_broadcast_reception_start(&fixture->start_param); - zassert_equal(0, err, "Unexpected return value %d", err); + test_broadcast_reception_start(&fixture->start_param); - zexpect_call_count("bt_cap_commander_cb.broadcast_reception_start", 1, - mock_cap_commander_broadcast_reception_start_cb_fake.call_count); - zassert_equal_ptr(NULL, - mock_cap_commander_broadcast_reception_start_cb_fake.arg0_history[0]); - zassert_equal(0, mock_cap_commander_broadcast_reception_start_cb_fake.arg1_history[0]); - - err = bt_cap_commander_broadcast_reception_stop(&fixture->stop_param); - zassert_equal(0, err, "Unexpected return value %d", err); + for (size_t i = 0U; i < CONFIG_BT_MAX_CONN; i++) { + fixture->stop_param.param[i].src_id = src_id[i]; + } - zexpect_call_count("bt_cap_commander_cb.broadcast_reception_stop", 1, - mock_cap_commander_broadcast_reception_stop_cb_fake.call_count); - zassert_equal_ptr(NULL, - mock_cap_commander_broadcast_reception_stop_cb_fake.arg0_history[0]); - zassert_equal(0, mock_cap_commander_broadcast_reception_stop_cb_fake.arg1_history[0]); + test_broadcast_reception_stop(&fixture->stop_param); } ZTEST_F(cap_commander_test_broadcast_reception, test_commander_reception_stop_one_subgroup) @@ -432,30 +472,15 @@ ZTEST_F(cap_commander_test_broadcast_reception, test_commander_reception_stop_on err = bt_cap_commander_register_cb(&mock_cap_commander_cb); zassert_equal(0, err, "Unexpected return value %d", err); - err = bt_cap_commander_broadcast_reception_start(&fixture->start_param); - zassert_equal(0, err, "Unexpected return value %d", err); - - zexpect_call_count("bt_cap_commander_cb.broadcast_reception_start", 1, - mock_cap_commander_broadcast_reception_start_cb_fake.call_count); - zassert_equal_ptr(NULL, - mock_cap_commander_broadcast_reception_start_cb_fake.arg0_history[0]); - zassert_equal(0, mock_cap_commander_broadcast_reception_start_cb_fake.arg1_history[0]); + test_broadcast_reception_start(&fixture->start_param); /* We test with one subgroup, instead of CONFIG_BT_BAP_BASS_MAX_SUBGROUPS subgroups */ for (size_t i = 0U; i < CONFIG_BT_MAX_CONN; i++) { - printk("Source ID %d: %d\n", i, fixture->stop_param.param[i].src_id); - fixture->stop_param.param[i].num_subgroups = 1; + fixture->stop_param.param[i].src_id = src_id[i]; } - err = bt_cap_commander_broadcast_reception_stop(&fixture->stop_param); - zassert_equal(0, err, "Unexpected return value %d", err); - - zexpect_call_count("bt_cap_commander_cb.broadcast_reception_stop", 1, - mock_cap_commander_broadcast_reception_stop_cb_fake.call_count); - zassert_equal_ptr(NULL, - mock_cap_commander_broadcast_reception_stop_cb_fake.arg0_history[0]); - zassert_equal(0, mock_cap_commander_broadcast_reception_stop_cb_fake.arg1_history[0]); + test_broadcast_reception_stop(&fixture->stop_param); } ZTEST_F(cap_commander_test_broadcast_reception, test_commander_reception_stop_double) @@ -464,13 +489,23 @@ ZTEST_F(cap_commander_test_broadcast_reception, test_commander_reception_stop_do err = bt_cap_commander_register_cb(&mock_cap_commander_cb); zassert_equal(0, err, "Unexpected return value %d", err); - printk("Source ID: %d\n", fixture->stop_param.param[0].src_id); - err = bt_cap_commander_broadcast_reception_stop(&fixture->stop_param); - zassert_equal(0, err, "Unexpected return value %d", err); + test_broadcast_reception_start(&fixture->start_param); + + for (size_t i = 0U; i < CONFIG_BT_MAX_CONN; i++) { + printk("Source ID %d: %d %d\n", i, fixture->stop_param.param[i].src_id, src_id[i]); + + fixture->stop_param.param[i].src_id = src_id[i]; + } + + test_broadcast_reception_stop(&fixture->stop_param); + + /* + * We can not use test_broadcast_reception_stop because of the check on how often the + * callback function is called + */ err = bt_cap_commander_broadcast_reception_stop(&fixture->stop_param); zassert_equal(0, err, "Unexpected return value %d", err); - zexpect_call_count("bt_cap_commander_cb.broadcast_reception_stop", 2, mock_cap_commander_broadcast_reception_stop_cb_fake.call_count); } diff --git a/tests/bluetooth/audio/cap_commander/uut/bap_broadcast_assistant.c b/tests/bluetooth/audio/cap_commander/uut/bap_broadcast_assistant.c index 606eb71aad822..95dcf032189d5 100644 --- a/tests/bluetooth/audio/cap_commander/uut/bap_broadcast_assistant.c +++ b/tests/bluetooth/audio/cap_commander/uut/bap_broadcast_assistant.c @@ -6,11 +6,71 @@ #include "zephyr/bluetooth/audio/bap.h" -static struct bt_bap_broadcast_assistant_cb *broadcast_assistant_cbs; +static sys_slist_t broadcast_assistant_cbs = SYS_SLIST_STATIC_INIT(&broadcast_assistant_cbs); + +struct bap_broadcast_assistant_recv_state_info { + uint8_t src_id; + /** Cached PAST available */ + bool past_avail; + uint8_t adv_sid; + uint32_t broadcast_id; + bt_addr_le_t addr; +}; + +struct bap_broadcast_assistant_instance { + struct bt_conn *conn; + struct bap_broadcast_assistant_recv_state_info recv_states; + /* + * the following are not part of the broadcast_assistant instance, but adding them allow us + * to easily check pa_sync and bis_sync states + */ + enum bt_bap_pa_state pa_sync_state; + uint8_t num_subgroups; + struct bt_bap_bass_subgroup subgroups[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]; +}; + +static struct bap_broadcast_assistant_instance broadcast_assistants[CONFIG_BT_MAX_CONN]; +static uint8_t max_src_id; + +static struct bap_broadcast_assistant_instance *inst_by_conn(struct bt_conn *conn) +{ + struct bap_broadcast_assistant_instance *inst; + + zassert_not_null(conn, "conn is NULL"); + + inst = &broadcast_assistants[bt_conn_index(conn)]; + + return inst; +} int bt_bap_broadcast_assistant_register_cb(struct bt_bap_broadcast_assistant_cb *cb) { - broadcast_assistant_cbs = cb; + struct bt_bap_broadcast_assistant_cb *tmp; + + if (cb == NULL) { + return -EINVAL; + } + + SYS_SLIST_FOR_EACH_CONTAINER(&broadcast_assistant_cbs, tmp, _node) { + if (tmp == cb) { + return -EALREADY; + } + } + + sys_slist_append(&broadcast_assistant_cbs, &cb->_node); + + return 0; +} + +int bt_bap_broadcast_assistant_unregister_cb(struct bt_bap_broadcast_assistant_cb *cb) +{ + if (cb == NULL) { + return -EINVAL; + } + + if (!sys_slist_find_and_remove(&broadcast_assistant_cbs, &cb->_node)) { + return -EALREADY; + } return 0; } @@ -18,12 +78,41 @@ int bt_bap_broadcast_assistant_register_cb(struct bt_bap_broadcast_assistant_cb int bt_bap_broadcast_assistant_add_src(struct bt_conn *conn, const struct bt_bap_broadcast_assistant_add_src_param *param) { + struct bap_broadcast_assistant_instance *inst; + struct bt_bap_scan_delegator_recv_state state; + struct bt_bap_broadcast_assistant_cb *listener, *next; + /* Note that proper parameter checking is done in the caller */ zassert_not_null(conn, "conn is NULL"); zassert_not_null(param, "param is NULL"); - if (broadcast_assistant_cbs->add_src != NULL) { - broadcast_assistant_cbs->add_src(conn, 0); + inst = inst_by_conn(conn); + zassert_not_null(inst, "inst is NULL"); + + max_src_id++; + inst->recv_states.src_id = max_src_id; + inst->recv_states.past_avail = false; + inst->recv_states.adv_sid = param->adv_sid; + inst->recv_states.broadcast_id = param->broadcast_id; + inst->pa_sync_state = param->pa_sync; + inst->num_subgroups = param->num_subgroups; + state.pa_sync_state = param->pa_sync; + state.src_id = max_src_id; + state.num_subgroups = param->num_subgroups; + for (size_t i = 0; i < param->num_subgroups; i++) { + state.subgroups[i].bis_sync = param->subgroups[i].bis_sync; + inst->subgroups[i].bis_sync = param->subgroups[i].bis_sync; + } + + bt_addr_le_copy(&inst->recv_states.addr, ¶m->addr); + + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&broadcast_assistant_cbs, listener, next, _node) { + if (listener->add_src != NULL) { + listener->add_src(conn, 0); + } + if (listener->recv_state != NULL) { + listener->recv_state(conn, 0, &state); + } } return 0; @@ -32,35 +121,57 @@ int bt_bap_broadcast_assistant_add_src(struct bt_conn *conn, int bt_bap_broadcast_assistant_mod_src(struct bt_conn *conn, const struct bt_bap_broadcast_assistant_mod_src_param *param) { + struct bap_broadcast_assistant_instance *inst; struct bt_bap_scan_delegator_recv_state state; + struct bt_bap_broadcast_assistant_cb *listener, *next; zassert_not_null(conn, "conn is NULL"); zassert_not_null(param, "param is NULL"); + inst = inst_by_conn(conn); + zassert_not_null(inst, "inst is NULL"); + state.pa_sync_state = param->pa_sync ? BT_BAP_PA_STATE_SYNCED : BT_BAP_PA_STATE_NOT_SYNCED; state.src_id = param->src_id; + inst->recv_states.src_id = param->src_id; + inst->pa_sync_state = param->pa_sync; + state.num_subgroups = param->num_subgroups; + inst->num_subgroups = param->num_subgroups; for (size_t i = 0; i < param->num_subgroups; i++) { state.subgroups[i].bis_sync = param->subgroups[i].bis_sync; + inst->subgroups[i].bis_sync = param->subgroups[i].bis_sync; } - - if (broadcast_assistant_cbs->mod_src != NULL) { - broadcast_assistant_cbs->mod_src(conn, 0); - } - if (broadcast_assistant_cbs->recv_state != NULL) { - broadcast_assistant_cbs->recv_state(conn, 0, &state); - } + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&broadcast_assistant_cbs, listener, next, _node) { + if (listener->mod_src != NULL) { + listener->mod_src(conn, 0); + } + if (listener->recv_state != NULL) { + listener->recv_state(conn, 0, &state); + } + } return 0; } int bt_bap_broadcast_assistant_rem_src(struct bt_conn *conn, uint8_t src_id) { + struct bap_broadcast_assistant_instance *inst; + struct bt_bap_broadcast_assistant_cb *listener, *next; + zassert_not_null(conn, "conn is NULL"); - zassert_not_equal(src_id, 0, "src_id is 0"); - if (broadcast_assistant_cbs->rem_src != NULL) { - broadcast_assistant_cbs->rem_src(conn, 0); + inst = inst_by_conn(conn); + zassert_equal(src_id, inst->recv_states.src_id, "Invalid src_id"); + zassert_equal(BT_BAP_PA_STATE_NOT_SYNCED, inst->pa_sync_state, "Invalid sync state"); + for (int i = 0; i < inst->num_subgroups; i++) { + zassert_equal(0, inst->subgroups[i].bis_sync); + } + + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&broadcast_assistant_cbs, listener, next, _node) { + if (listener->rem_src != NULL) { + listener->rem_src(conn, 0); + } } return 0; From fa8d80a15bd1f4a71c7434ed2d7bf9667d1028d2 Mon Sep 17 00:00:00 2001 From: Armin Brauns Date: Thu, 1 Aug 2024 11:01:34 +0000 Subject: [PATCH 0105/4482] bluetooth: honor log panic mode in monitor Once panic mode is entered, the log write functions are called from an ISR, so must not try to acquire locks. Signed-off-by: Armin Brauns --- subsys/bluetooth/host/monitor.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/monitor.c b/subsys/bluetooth/host/monitor.c index 6f4c26df82251..bf434daaf9cfa 100644 --- a/subsys/bluetooth/host/monitor.c +++ b/subsys/bluetooth/host/monitor.c @@ -98,6 +98,8 @@ static void drop_add(uint16_t opcode) #if defined(CONFIG_BT_DEBUG_MONITOR_RTT) #include +static bool panic_mode; + #define RTT_BUFFER_NAME CONFIG_BT_DEBUG_MONITOR_RTT_BUFFER_NAME #define RTT_BUF_SIZE CONFIG_BT_DEBUG_MONITOR_RTT_BUFFER_SIZE @@ -124,10 +126,14 @@ static void monitor_send(const void *data, size_t len) } if (!drop) { - SEGGER_RTT_LOCK(); + if (!panic_mode) { + SEGGER_RTT_LOCK(); + } cnt = SEGGER_RTT_WriteNoLock(CONFIG_BT_DEBUG_MONITOR_RTT_BUFFER, rtt_buf, rtt_buf_offset); - SEGGER_RTT_UNLOCK(); + if (!panic_mode) { + SEGGER_RTT_UNLOCK(); + } } if (!cnt) { @@ -356,6 +362,9 @@ static void monitor_log_process(const struct log_backend *const backend, static void monitor_log_panic(const struct log_backend *const backend) { +#if defined(CONFIG_BT_DEBUG_MONITOR_RTT) + panic_mode = true; +#endif } static void monitor_log_init(const struct log_backend *const backend) From 5eeff698caa8027b14536241a00ff72e4731832d Mon Sep 17 00:00:00 2001 From: Kurtis Dinelle Date: Sun, 4 Aug 2024 12:04:16 -0700 Subject: [PATCH 0106/4482] sensor: tsl2591: fix: Address CID 353644 & 353654 Fixes implicit sign-extension/potential overflow by explicitly casting to int64_t. Signed-off-by: Kurtis Dinelle --- drivers/sensor/ams/tsl2591/tsl2591.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/sensor/ams/tsl2591/tsl2591.c b/drivers/sensor/ams/tsl2591/tsl2591.c index ee2c0b56cb4a3..59f7054938fb2 100644 --- a/drivers/sensor/ams/tsl2591/tsl2591.c +++ b/drivers/sensor/ams/tsl2591/tsl2591.c @@ -136,7 +136,7 @@ static int tsl2591_channel_get(const struct device *dev, enum sensor_channel cha struct sensor_value *val) { const struct tsl2591_data *data = dev->data; - int64_t cpl = data->atime * data->again; + int64_t cpl = (int64_t)data->atime * (int64_t)data->again; int64_t strength; /* Unfortunately, datasheet does not provide a lux conversion formula for this particular From 2cfb21b9df8cf3b4a0c05b378b69f4c19c0590ae Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Fri, 23 Aug 2024 15:22:30 +0200 Subject: [PATCH 0107/4482] dts: st: stm32f2: remove 'ntc' property from die temp sensor Remove the "Negative Temperature Coefficient" attribute from the STM32F2 die temperature sensor node, as it does not correspond to the hardware. Signed-off-by: Mathieu Choplain --- dts/arm/st/f2/stm32f2.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/dts/arm/st/f2/stm32f2.dtsi b/dts/arm/st/f2/stm32f2.dtsi index 8af21aaa46804..1a8c9c811452f 100644 --- a/dts/arm/st/f2/stm32f2.dtsi +++ b/dts/arm/st/f2/stm32f2.dtsi @@ -708,7 +708,6 @@ io-channels = <&adc1 16>; status = "disabled"; v25 = <760>; - ntc; avgslope = <25>; }; From 577c1b2e9e3ee1183a399a9dc13825489330e807 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Tue, 23 Jul 2024 11:13:19 +0200 Subject: [PATCH 0108/4482] dts: st: stm32f030: add correct 'avgslope' property on die temp sensor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the missing 'avgslope' property to the DTSI for STM32F030/STM32F070. This fixes improper results being returned by the driver: the correct value for the average slope is 4.3mV/°C (4300 µV/°C), but the binding's default value of 2.53mV/°C was used instead, since property was missing. Signed-off-by: Mathieu Choplain --- dts/arm/st/f0/stm32f030.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dts/arm/st/f0/stm32f030.dtsi b/dts/arm/st/f0/stm32f030.dtsi index 1d211447fae7a..0985359140e62 100644 --- a/dts/arm/st/f0/stm32f030.dtsi +++ b/dts/arm/st/f0/stm32f030.dtsi @@ -15,9 +15,10 @@ compatible = "st,stm32c0-temp-cal"; ts-cal1-addr = <0x1FFFF7B8>; ts-cal1-temp = <30>; - ntc; ts-cal-vrefanalog = <3300>; + avgslope = <4300>; io-channels = <&adc1 16>; + ntc; status = "disabled"; }; }; From 0fd095d6d107a8243d2afd7372488cb2540dc152 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Tue, 23 Jul 2024 10:44:57 +0200 Subject: [PATCH 0109/4482] dts: st: stm32f100: add correct 'v25' property on die temp sensor The typical value for V25 is different on the STM32F100 line compared to other STM32F1 MCUs. Update the DTS property to the correct value. Signed-off-by: Mathieu Choplain --- dts/arm/st/f1/stm32f100Xb.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dts/arm/st/f1/stm32f100Xb.dtsi b/dts/arm/st/f1/stm32f100Xb.dtsi index 73fe3f117e43b..eefe269e4596e 100644 --- a/dts/arm/st/f1/stm32f100Xb.dtsi +++ b/dts/arm/st/f1/stm32f100Xb.dtsi @@ -52,4 +52,8 @@ #io-channel-cells = <1>; }; }; + + die_temp: dietemp { + v25 = <1410>; + }; }; From 665f33ec517d8293d9a8bb498e08df2c2d993fdd Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Tue, 27 Aug 2024 17:08:14 +0200 Subject: [PATCH 0110/4482] dts: bindings: stm32-temp: force new series to define 'v25' Set the 'v25' property of 'st,stm32-temp' to required, and remove its default value, to ensure new series cannot be introduced without setting the property to the correct value explicitly. This change does not require any DTSI modification, because there are only two files using this compatible (stm32f1.dtsi / stm32f2.dtsi), and both of these already set 'v25' explicitly. Signed-off-by: Mathieu Choplain --- dts/bindings/sensor/st,stm32-temp.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dts/bindings/sensor/st,stm32-temp.yaml b/dts/bindings/sensor/st,stm32-temp.yaml index 31ce5b84f64be..b5a734ea249b9 100644 --- a/dts/bindings/sensor/st,stm32-temp.yaml +++ b/dts/bindings/sensor/st,stm32-temp.yaml @@ -19,7 +19,7 @@ properties: v25: type: int - default: 760 + required: true description: | Voltage of temperature sensor at 25C in mV according to datasheet "Electrical characteristics/Operating conditions" From 8caf1f6d3e4d8d51f8a56c6a13a7527af3636ebf Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Tue, 27 Aug 2024 18:30:15 +0200 Subject: [PATCH 0111/4482] dts: bindings: stm32-temp: force new series to define 'avgslope' Set the 'avgslope' property of 'st,stm32-temp' to required, and remove its default value, to ensure new series cannot be introduced without setting the property to the correct value explicitly. This change does not require any DTSI modification, because there are only two files using this compatible (stm32f1.dtsi / stm32f2.dtsi), and both of these already set 'avgslope' explicitly. Signed-off-by: Mathieu Choplain --- dts/bindings/sensor/st,stm32-temp.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dts/bindings/sensor/st,stm32-temp.yaml b/dts/bindings/sensor/st,stm32-temp.yaml index b5a734ea249b9..21e10a87ec092 100644 --- a/dts/bindings/sensor/st,stm32-temp.yaml +++ b/dts/bindings/sensor/st,stm32-temp.yaml @@ -10,7 +10,7 @@ include: [base.yaml, "st,stm32-temp-common.yaml"] properties: avgslope: type: int - default: 25 + required: true description: | Average slope of T-V chart (in mV/C x10) according to datasheet "Electrical characteristics/Operating conditions" From 8785e9f605cb1bb49181ef72eff89a50a6127dad Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Tue, 27 Aug 2024 17:29:42 +0200 Subject: [PATCH 0112/4482] dts: bindings: stm32c0-temp-cal: force new series to define 'avgslope' Set the 'avgslope' property of 'st,stm32c0-temp-cal' to required, and remove its default value, to ensure new series cannot be introduced without setting the property to the correct value explicitly. This change does not require any DTSI modification, because there are only two files using this compatible (stm32f030.dtsi / stm32c0.dtsi), and both of these already set 'avgslope' explicitly. Signed-off-by: Mathieu Choplain --- dts/bindings/sensor/st,stm32c0-temp-cal.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dts/bindings/sensor/st,stm32c0-temp-cal.yaml b/dts/bindings/sensor/st,stm32c0-temp-cal.yaml index a750047c3db7b..6946f11a708fe 100644 --- a/dts/bindings/sensor/st,stm32c0-temp-cal.yaml +++ b/dts/bindings/sensor/st,stm32c0-temp-cal.yaml @@ -12,7 +12,7 @@ include: "st,stm32-temp-cal-common.yaml" properties: avgslope: type: int - default: 2530 + required: true description: | Average slope of T-V chart (in uV/C) according to datasheet "Electrical characteristics/Operating conditions" From d307221065ec5934fa1c86841333ec7c12d2a691 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Wed, 17 Jul 2024 14:20:44 +0200 Subject: [PATCH 0113/4482] drivers: sensor: stm32_temp: enable/disable channel in separate functions Moves the temperature sensor channel enable and selection to separate functions. This improves the driver's readability and makes introduction of new STM32 series easier. Signed-off-by: Mathieu Choplain --- drivers/sensor/st/stm32_temp/stm32_temp.c | 29 ++++++++++++++++------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/drivers/sensor/st/stm32_temp/stm32_temp.c b/drivers/sensor/st/stm32_temp/stm32_temp.c index aa746e0c69995..6a881c76e900c 100644 --- a/drivers/sensor/st/stm32_temp/stm32_temp.c +++ b/drivers/sensor/st/stm32_temp/stm32_temp.c @@ -63,12 +63,29 @@ struct stm32_temp_config { bool is_ntc; }; +static inline void adc_enable_tempsensor_channel(ADC_TypeDef *adc) +{ + const uint32_t path = LL_ADC_GetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(adc)); + + LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(adc), + path | LL_ADC_PATH_INTERNAL_TEMPSENSOR); + + k_usleep(LL_ADC_DELAY_TEMPSENSOR_STAB_US); +} + +static inline void adc_disable_tempsensor_channel(ADC_TypeDef *adc) +{ + const uint32_t path = LL_ADC_GetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(adc)); + + LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(adc), + path & ~LL_ADC_PATH_INTERNAL_TEMPSENSOR); +} + static int stm32_temp_sample_fetch(const struct device *dev, enum sensor_channel chan) { struct stm32_temp_data *data = dev->data; struct adc_sequence *sp = &data->adc_seq; int rc; - uint32_t path; if (chan != SENSOR_CHAN_ALL && chan != SENSOR_CHAN_DIE_TEMP) { return -ENOTSUP; @@ -83,20 +100,14 @@ static int stm32_temp_sample_fetch(const struct device *dev, enum sensor_channel goto unlock; } - path = LL_ADC_GetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(data->adc_base)); - LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(data->adc_base), - LL_ADC_PATH_INTERNAL_TEMPSENSOR | path); - - k_usleep(LL_ADC_DELAY_TEMPSENSOR_STAB_US); + adc_enable_tempsensor_channel(data->adc_base); rc = adc_read(data->adc, sp); if (rc == 0) { data->raw = data->sample_buffer; } - path = LL_ADC_GetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(data->adc_base)); - LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(data->adc_base), - path &= ~LL_ADC_PATH_INTERNAL_TEMPSENSOR); + adc_disable_tempsensor_channel(data->adc_base); unlock: pm_device_runtime_put(data->adc); From 70bf26b3588d391e778cc1f0596d7c2b0b57e332 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Wed, 17 Jul 2024 14:23:23 +0200 Subject: [PATCH 0114/4482] drivers: sensor: stm32_temp: convert samples in dedicated function Factor out the ADC-sample-to-temperature conversion logic from the sensor subsystem API implementation, and move it to a dedicated function. This makes the driver more readable. Signed-off-by: Mathieu Choplain --- drivers/sensor/st/stm32_temp/stm32_temp.c | 90 +++++++++++++---------- 1 file changed, 51 insertions(+), 39 deletions(-) diff --git a/drivers/sensor/st/stm32_temp/stm32_temp.c b/drivers/sensor/st/stm32_temp/stm32_temp.c index 6a881c76e900c..c956525cb739e 100644 --- a/drivers/sensor/st/stm32_temp/stm32_temp.c +++ b/drivers/sensor/st/stm32_temp/stm32_temp.c @@ -81,6 +81,56 @@ static inline void adc_disable_tempsensor_channel(ADC_TypeDef *adc) path & ~LL_ADC_PATH_INTERNAL_TEMPSENSOR); } +static float convert_adc_sample_to_temperature(const struct device *dev) +{ + struct stm32_temp_data *data = dev->data; + const struct stm32_temp_config *cfg = dev->config; + float temperature; + +#if defined(HAS_CALIBRATION) + +#if defined(CONFIG_SOC_SERIES_STM32H5X) + /* Disable the ICACHE to ensure all memory accesses are non-cacheable. + * This is required on STM32H5, where the manufacturing flash must be + * accessed in non-cacheable mode - otherwise, a bus error occurs. + */ + LL_ICACHE_Disable(); +#endif /* CONFIG_SOC_SERIES_STM32H5X */ + + temperature = ((float)data->raw * adc_ref_internal(data->adc)) / cfg->cal_vrefanalog; + temperature -= (*cfg->cal1_addr >> cfg->ts_cal_shift); +#if defined(HAS_SINGLE_CALIBRATION) + if (cfg->is_ntc) { + temperature = -temperature; + } + temperature /= (cfg->avgslope * 4096) / (cfg->cal_vrefanalog * 1000); +#else + temperature *= (cfg->cal2_temp - cfg->cal1_temp); + temperature /= ((*cfg->cal2_addr - *cfg->cal1_addr) >> cfg->ts_cal_shift); +#endif + temperature += cfg->cal1_temp; + +#if defined(CONFIG_SOC_SERIES_STM32H5X) + /* Re-enable the ICACHE (unconditonally, as it should always be on) */ + LL_ICACHE_Enable(); +#endif /* CONFIG_SOC_SERIES_STM32H5X */ + +#else + /* Sensor value in millivolts */ + int32_t mv = data->raw * adc_ref_internal(data->adc) / 0x0FFF; + + if (cfg->is_ntc) { + temperature = (float)(cfg->v25_mv - mv); + } else { + temperature = (float)(mv - cfg->v25_mv); + } + temperature = (temperature / cfg->avgslope) * 10; + temperature += 25; +#endif + + return temperature; +} + static int stm32_temp_sample_fetch(const struct device *dev, enum sensor_channel chan) { struct stm32_temp_data *data = dev->data; @@ -119,49 +169,11 @@ static int stm32_temp_sample_fetch(const struct device *dev, enum sensor_channel static int stm32_temp_channel_get(const struct device *dev, enum sensor_channel chan, struct sensor_value *val) { - struct stm32_temp_data *data = dev->data; - const struct stm32_temp_config *cfg = dev->config; - float temp; - if (chan != SENSOR_CHAN_DIE_TEMP) { return -ENOTSUP; } -#if HAS_CALIBRATION - -#if defined(CONFIG_SOC_SERIES_STM32H5X) - LL_ICACHE_Disable(); -#endif /* CONFIG_SOC_SERIES_STM32H5X */ - - temp = ((float)data->raw * adc_ref_internal(data->adc)) / cfg->cal_vrefanalog; - temp -= (*cfg->cal1_addr >> cfg->ts_cal_shift); -#if HAS_SINGLE_CALIBRATION - if (cfg->is_ntc) { - temp = -temp; - } - temp /= (cfg->avgslope * 4096) / (cfg->cal_vrefanalog * 1000); -#else - temp *= (cfg->cal2_temp - cfg->cal1_temp); - temp /= ((*cfg->cal2_addr - *cfg->cal1_addr) >> cfg->ts_cal_shift); -#endif - temp += cfg->cal1_temp; - -#if defined(CONFIG_SOC_SERIES_STM32H5X) - LL_ICACHE_Enable(); -#endif /* CONFIG_SOC_SERIES_STM32H5X */ - -#else - /* Sensor value in millivolts */ - int32_t mv = data->raw * adc_ref_internal(data->adc) / 0x0FFF; - - if (cfg->is_ntc) { - temp = (float)(cfg->v25_mv - mv); - } else { - temp = (float)(mv - cfg->v25_mv); - } - temp = (temp / cfg->avgslope) * 10; - temp += 25; -#endif + const float temp = convert_adc_sample_to_temperature(dev); return sensor_value_from_float(val, temp); } From 2ef666a15c4e204c575b4baa098ed26ad90b3e32 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Wed, 17 Jul 2024 14:47:29 +0200 Subject: [PATCH 0115/4482] drivers: sensor: stm32_temp: make driver data field names closer to RM Rename the fields of the STM32 dietemp sensor driver data structure to match the names in Reference Manual more closely, and add documentation comments to all of them. Signed-off-by: Mathieu Choplain --- drivers/sensor/st/stm32_temp/stm32_temp.c | 70 +++++++++++------------ 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/sensor/st/stm32_temp/stm32_temp.c b/drivers/sensor/st/stm32_temp/stm32_temp.c index c956525cb739e..7f7620887df49 100644 --- a/drivers/sensor/st/stm32_temp/stm32_temp.c +++ b/drivers/sensor/st/stm32_temp/stm32_temp.c @@ -45,21 +45,21 @@ struct stm32_temp_data { }; struct stm32_temp_config { -#if HAS_CALIBRATION - uint16_t *cal1_addr; - int cal1_temp; -#if HAS_DUAL_CALIBRATION - uint16_t *cal2_addr; - int cal2_temp; -#else - int avgslope; -#endif - int cal_vrefanalog; - int ts_cal_shift; -#else - int avgslope; - int v25_mv; +#if !defined(HAS_CALIBRATION) + int average_slope; /** Unit: mV/°C x10 */ + int v25; /** Unit: mV */ +#else /* HAS_CALIBRATION */ + unsigned int calib_vrefanalog; /** Unit: mV */ + unsigned int calib_data_shift; + const uint16_t *ts_cal1_addr; + int ts_cal1_temp; /** Unit: °C */ +#if defined(HAS_SINGLE_CALIBRATION) + int average_slope; /** Unit: µV/°C */ +#else /* HAS_DUAL_CALIBRATION */ + const uint16_t *ts_cal2_addr; + int ts_cal2_temp; /** Unit: °C */ #endif +#endif /* HAS_CALIBRATION */ bool is_ntc; }; @@ -97,18 +97,18 @@ static float convert_adc_sample_to_temperature(const struct device *dev) LL_ICACHE_Disable(); #endif /* CONFIG_SOC_SERIES_STM32H5X */ - temperature = ((float)data->raw * adc_ref_internal(data->adc)) / cfg->cal_vrefanalog; - temperature -= (*cfg->cal1_addr >> cfg->ts_cal_shift); + temperature = ((float)data->raw * adc_ref_internal(data->adc)) / cfg->calib_vrefanalog; + temperature -= (*cfg->ts_cal1_addr >> cfg->calib_data_shift); #if defined(HAS_SINGLE_CALIBRATION) if (cfg->is_ntc) { temperature = -temperature; } - temperature /= (cfg->avgslope * 4096) / (cfg->cal_vrefanalog * 1000); + temperature /= (cfg->average_slope * 4096) / (cfg->calib_vrefanalog * 1000); #else - temperature *= (cfg->cal2_temp - cfg->cal1_temp); - temperature /= ((*cfg->cal2_addr - *cfg->cal1_addr) >> cfg->ts_cal_shift); + temperature *= (cfg->ts_cal2_temp - cfg->ts_cal1_temp); + temperature /= ((*cfg->ts_cal2_addr - *cfg->ts_cal1_addr) >> cfg->calib_data_shift); #endif - temperature += cfg->cal1_temp; + temperature += cfg->ts_cal1_temp; #if defined(CONFIG_SOC_SERIES_STM32H5X) /* Re-enable the ICACHE (unconditonally, as it should always be on) */ @@ -120,11 +120,11 @@ static float convert_adc_sample_to_temperature(const struct device *dev) int32_t mv = data->raw * adc_ref_internal(data->adc) / 0x0FFF; if (cfg->is_ntc) { - temperature = (float)(cfg->v25_mv - mv); + temperature = (float)(cfg->v25 - mv); } else { - temperature = (float)(mv - cfg->v25_mv); + temperature = (float)(mv - cfg->v25); } - temperature = (temperature / cfg->avgslope) * 10; + temperature = (temperature / cfg->average_slope) * 10; temperature += 25; #endif @@ -235,20 +235,20 @@ static struct stm32_temp_data stm32_temp_dev_data = { }; static const struct stm32_temp_config stm32_temp_dev_config = { -#if HAS_CALIBRATION - .cal1_addr = (uint16_t *)DT_INST_PROP(0, ts_cal1_addr), - .cal1_temp = DT_INST_PROP(0, ts_cal1_temp), -#if HAS_DUAL_CALIBRATION - .cal2_addr = (uint16_t *)DT_INST_PROP(0, ts_cal2_addr), - .cal2_temp = DT_INST_PROP(0, ts_cal2_temp), -#else - .avgslope = DT_INST_PROP(0, avgslope), +#if defined(HAS_CALIBRATION) + .ts_cal1_addr = (uint16_t *)DT_INST_PROP(0, ts_cal1_addr), + .ts_cal1_temp = DT_INST_PROP(0, ts_cal1_temp), +#if defined(HAS_SINGLE_CALIBRATION) + .average_slope = DT_INST_PROP(0, avgslope), +#else /* HAS_DUAL_CALIBRATION */ + .ts_cal2_addr = (uint16_t *)DT_INST_PROP(0, ts_cal2_addr), + .ts_cal2_temp = DT_INST_PROP(0, ts_cal2_temp), #endif - .ts_cal_shift = (DT_INST_PROP(0, ts_cal_resolution) - CAL_RES), - .cal_vrefanalog = DT_INST_PROP(0, ts_cal_vrefanalog), + .calib_data_shift = (DT_INST_PROP(0, ts_cal_resolution) - CAL_RES), + .calib_vrefanalog = DT_INST_PROP(0, ts_cal_vrefanalog), #else - .avgslope = DT_INST_PROP(0, avgslope), - .v25_mv = DT_INST_PROP(0, v25), + .average_slope = DT_INST_PROP(0, avgslope), + .v25 = DT_INST_PROP(0, v25), #endif .is_ntc = DT_INST_PROP_OR(0, ntc, false) }; From dabcd605a83b2966752f6d8756e0fe27f72af403 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Wed, 17 Jul 2024 14:56:29 +0200 Subject: [PATCH 0116/4482] drivers: sensor: stm32_temp: read calibration data in dedicated function Move the reading of calibration data from manufacturing flash to a dedicated function. This makes introduction of new STM32 series easier. Additionally, use the sys_read16 primitive to read data instead of manipulating and dereferencing raw manufacturing flash pointers. Signed-off-by: Mathieu Choplain --- drivers/sensor/st/stm32_temp/stm32_temp.c | 68 ++++++++++++++++------- 1 file changed, 49 insertions(+), 19 deletions(-) diff --git a/drivers/sensor/st/stm32_temp/stm32_temp.c b/drivers/sensor/st/stm32_temp/stm32_temp.c index 7f7620887df49..e1a7ead6f11c2 100644 --- a/drivers/sensor/st/stm32_temp/stm32_temp.c +++ b/drivers/sensor/st/stm32_temp/stm32_temp.c @@ -17,7 +17,10 @@ #endif /* CONFIG_SOC_SERIES_STM32H5X */ LOG_MODULE_REGISTER(stm32_temp, CONFIG_SENSOR_LOG_LEVEL); -#define CAL_RES 12 + +#define CAL_RES 12 +#define MAX_CALIB_POINTS 2 + #if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_temp) #define DT_DRV_COMPAT st_stm32_temp #elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_temp_cal) @@ -51,12 +54,12 @@ struct stm32_temp_config { #else /* HAS_CALIBRATION */ unsigned int calib_vrefanalog; /** Unit: mV */ unsigned int calib_data_shift; - const uint16_t *ts_cal1_addr; + const void *ts_cal1_addr; int ts_cal1_temp; /** Unit: °C */ #if defined(HAS_SINGLE_CALIBRATION) int average_slope; /** Unit: µV/°C */ #else /* HAS_DUAL_CALIBRATION */ - const uint16_t *ts_cal2_addr; + const void *ts_cal2_addr; int ts_cal2_temp; /** Unit: °C */ #endif #endif /* HAS_CALIBRATION */ @@ -81,14 +84,22 @@ static inline void adc_disable_tempsensor_channel(ADC_TypeDef *adc) path & ~LL_ADC_PATH_INTERNAL_TEMPSENSOR); } -static float convert_adc_sample_to_temperature(const struct device *dev) -{ - struct stm32_temp_data *data = dev->data; - const struct stm32_temp_config *cfg = dev->config; - float temperature; - #if defined(HAS_CALIBRATION) +static uint32_t fetch_mfg_data(const void *addr) +{ + /* On all STM32 series, the calibration data is stored + * as 16-bit data in the manufacturing flash region + */ + return sys_read16((mem_addr_t)addr); +} +/** + * @returns TS_CAL1 in calib_data[0] + * TS_CAL2 in calib_data[1] if applicable + */ +static void read_calibration_data(const struct stm32_temp_config *cfg, + uint32_t calib_data[MAX_CALIB_POINTS]) +{ #if defined(CONFIG_SOC_SERIES_STM32H5X) /* Disable the ICACHE to ensure all memory accesses are non-cacheable. * This is required on STM32H5, where the manufacturing flash must be @@ -97,8 +108,33 @@ static float convert_adc_sample_to_temperature(const struct device *dev) LL_ICACHE_Disable(); #endif /* CONFIG_SOC_SERIES_STM32H5X */ + calib_data[0] = fetch_mfg_data(cfg->ts_cal1_addr); +#if defined(HAS_DUAL_CALIBRATION) + calib_data[1] = fetch_mfg_data(cfg->ts_cal2_addr); +#endif + + +#if defined(CONFIG_SOC_SERIES_STM32H5X) + /* Re-enable the ICACHE (unconditonally - it should always be turned on) */ + LL_ICACHE_Enable(); +#endif /* CONFIG_SOC_SERIES_STM32H5X */ +} +#endif /* HAS_CALIBRATION */ + + +static float convert_adc_sample_to_temperature(const struct device *dev) +{ + struct stm32_temp_data *data = dev->data; + const struct stm32_temp_config *cfg = dev->config; + float temperature; + +#if defined(HAS_CALIBRATION) + uint32_t calib[MAX_CALIB_POINTS]; + + read_calibration_data(cfg, calib); + temperature = ((float)data->raw * adc_ref_internal(data->adc)) / cfg->calib_vrefanalog; - temperature -= (*cfg->ts_cal1_addr >> cfg->calib_data_shift); + temperature -= (calib[0] >> cfg->calib_data_shift); #if defined(HAS_SINGLE_CALIBRATION) if (cfg->is_ntc) { temperature = -temperature; @@ -106,15 +142,9 @@ static float convert_adc_sample_to_temperature(const struct device *dev) temperature /= (cfg->average_slope * 4096) / (cfg->calib_vrefanalog * 1000); #else temperature *= (cfg->ts_cal2_temp - cfg->ts_cal1_temp); - temperature /= ((*cfg->ts_cal2_addr - *cfg->ts_cal1_addr) >> cfg->calib_data_shift); + temperature /= ((calib[1] - calib[0]) >> cfg->calib_data_shift); #endif temperature += cfg->ts_cal1_temp; - -#if defined(CONFIG_SOC_SERIES_STM32H5X) - /* Re-enable the ICACHE (unconditonally, as it should always be on) */ - LL_ICACHE_Enable(); -#endif /* CONFIG_SOC_SERIES_STM32H5X */ - #else /* Sensor value in millivolts */ int32_t mv = data->raw * adc_ref_internal(data->adc) / 0x0FFF; @@ -236,12 +266,12 @@ static struct stm32_temp_data stm32_temp_dev_data = { static const struct stm32_temp_config stm32_temp_dev_config = { #if defined(HAS_CALIBRATION) - .ts_cal1_addr = (uint16_t *)DT_INST_PROP(0, ts_cal1_addr), + .ts_cal1_addr = (const void *)DT_INST_PROP(0, ts_cal1_addr), .ts_cal1_temp = DT_INST_PROP(0, ts_cal1_temp), #if defined(HAS_SINGLE_CALIBRATION) .average_slope = DT_INST_PROP(0, avgslope), #else /* HAS_DUAL_CALIBRATION */ - .ts_cal2_addr = (uint16_t *)DT_INST_PROP(0, ts_cal2_addr), + .ts_cal2_addr = (const void *)DT_INST_PROP(0, ts_cal2_addr), .ts_cal2_temp = DT_INST_PROP(0, ts_cal2_temp), #endif .calib_data_shift = (DT_INST_PROP(0, ts_cal_resolution) - CAL_RES), From 7f44ecb06ad53951617566bd36e17d509599e78c Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Wed, 17 Jul 2024 15:03:02 +0200 Subject: [PATCH 0117/4482] drivers: sensor: stm32_temp: update and comment conversion code Update all the conversion code in the STM32 dietemp sensor driver to be more readable and match the Reference Manuals. Additionally, comment all the code to make it easy to understand. Signed-off-by: Mathieu Choplain --- drivers/sensor/st/stm32_temp/stm32_temp.c | 102 ++++++++++++++++------ 1 file changed, 77 insertions(+), 25 deletions(-) diff --git a/drivers/sensor/st/stm32_temp/stm32_temp.c b/drivers/sensor/st/stm32_temp/stm32_temp.c index e1a7ead6f11c2..99fa003f0924f 100644 --- a/drivers/sensor/st/stm32_temp/stm32_temp.c +++ b/drivers/sensor/st/stm32_temp/stm32_temp.c @@ -49,7 +49,7 @@ struct stm32_temp_data { struct stm32_temp_config { #if !defined(HAS_CALIBRATION) - int average_slope; /** Unit: mV/°C x10 */ + float average_slope; /** Unit: mV/°C */ int v25; /** Unit: mV */ #else /* HAS_CALIBRATION */ unsigned int calib_vrefanalog; /** Unit: mV */ @@ -57,7 +57,7 @@ struct stm32_temp_config { const void *ts_cal1_addr; int ts_cal1_temp; /** Unit: °C */ #if defined(HAS_SINGLE_CALIBRATION) - int average_slope; /** Unit: µV/°C */ + float average_slope; /** Unit: mV/°C */ #else /* HAS_DUAL_CALIBRATION */ const void *ts_cal2_addr; int ts_cal2_temp; /** Unit: °C */ @@ -121,42 +121,88 @@ static void read_calibration_data(const struct stm32_temp_config *cfg, } #endif /* HAS_CALIBRATION */ - static float convert_adc_sample_to_temperature(const struct device *dev) { struct stm32_temp_data *data = dev->data; const struct stm32_temp_config *cfg = dev->config; + const uint16_t vdda_mv = adc_ref_internal(data->adc); float temperature; -#if defined(HAS_CALIBRATION) +#if !defined(HAS_CALIBRATION) + /** + * Series without calibration (STM32F1/F2): + * Tjunction = ((Dividend) / Avg_Slope) + 25 + * + * where Dividend is: + * - (V25 - Vsense) on STM32F1 series ("ntc") + * - (Vsense - V25) on STM32F2 series + * and Vsense = (ADC raw data) / ADC_MAX_VALUE * Vdda + * and ADC_MAX_VALUE = 4095 (12-bit ADC resolution) + * + * References: + * - RM0008 §11.10 "Temperature sensor" (STM32F100) + * - RM0041 §10.9 "Temperature sensor" (STM32F101/F102/F103/F105/F107) + * - RM0033 §10.10 "Temperature sensor" (STM32F2) + */ + /* Perform multiplication first for higher accuracy */ + const int vsense = ((int)data->raw * vdda_mv) / 4095; + + if (cfg->is_ntc) { + temperature = (float)(cfg->v25 - vsense); + } else { + temperature = (float)(vsense - cfg->v25); + } + temperature /= cfg->average_slope; + temperature += 25.0f; +#else /* HAS_CALIBRATION */ uint32_t calib[MAX_CALIB_POINTS]; read_calibration_data(cfg, calib); - temperature = ((float)data->raw * adc_ref_internal(data->adc)) / cfg->calib_vrefanalog; - temperature -= (calib[0] >> cfg->calib_data_shift); + const float sense_data = ((float)vdda_mv / cfg->calib_vrefanalog) * data->raw; + #if defined(HAS_SINGLE_CALIBRATION) - if (cfg->is_ntc) { - temperature = -temperature; - } - temperature /= (cfg->average_slope * 4096) / (cfg->calib_vrefanalog * 1000); -#else - temperature *= (cfg->ts_cal2_temp - cfg->ts_cal1_temp); - temperature /= ((calib[1] - calib[0]) >> cfg->calib_data_shift); -#endif - temperature += cfg->ts_cal1_temp; -#else - /* Sensor value in millivolts */ - int32_t mv = data->raw * adc_ref_internal(data->adc) / 0x0FFF; + /** + * Series with one calibration point (STM32C0,STM32F030/F070): + * Tjunction = ((Dividend) / Avg_Slope_Code) + TS_CAL1_TEMP + * + * where Dividend is: + * - (TS_CAL1 - Sense_Data) on STM32F030/STM32F070 ("ntc") + * - (Sense_Data - TS_CAL1) on STM32C0 series + * + * and Avg_SlopeCode = (Avg_Slope * 4096 / calibration Vdda) + * + * References: + * - RM0360 §12.8 "Temperature sensor" (STM32F030/STM32F070) + * - RM0490 §14.10 "Temperature sensor and internal reference voltage" (STM32C0) + */ + const float avg_slope_code = + (cfg->average_slope / cfg->calib_vrefanalog) * 4096.f; + float dividend; if (cfg->is_ntc) { - temperature = (float)(cfg->v25 - mv); + dividend = ((float)(calib[0] >> cfg->calib_data_shift) - sense_data); } else { - temperature = (float)(mv - cfg->v25); + dividend = (sense_data - (calib[0] >> cfg->calib_data_shift)); } - temperature = (temperature / cfg->average_slope) * 10; - temperature += 25; -#endif + + temperature = (dividend / avg_slope_code) + cfg->ts_cal1_temp; +#else /* HAS_DUAL_CALIBRATION */ + /** + * Series with two calibration points: + * Tjunction = (Slope * (Sense_Data - TS_CAL1)) + TS_CAL1_TEMP + * + * (TS_CAL2_TEMP - TS_CAL1_TEMP) + * where Slope = ----------------------------- + * (TS_CAL2 - TS_CAL1) + */ + const float slope = ((float)(cfg->ts_cal2_temp - cfg->ts_cal1_temp)) + / ((calib[1] - calib[0]) >> cfg->calib_data_shift); + + temperature = (slope * (sense_data - (calib[0] >> cfg->calib_data_shift))) + + cfg->ts_cal1_temp; +#endif /* HAS_SINGLE_CALIBRATION */ +#endif /* HAS_CALIBRATION */ return temperature; } @@ -269,7 +315,10 @@ static const struct stm32_temp_config stm32_temp_dev_config = { .ts_cal1_addr = (const void *)DT_INST_PROP(0, ts_cal1_addr), .ts_cal1_temp = DT_INST_PROP(0, ts_cal1_temp), #if defined(HAS_SINGLE_CALIBRATION) - .average_slope = DT_INST_PROP(0, avgslope), + /* DT property is premultiplied by 1000 to cope with Device Tree + * properties being integer-only. Rescale here during compile. + */ + .average_slope = ((float)DT_INST_PROP(0, avgslope) / 1000.0f), #else /* HAS_DUAL_CALIBRATION */ .ts_cal2_addr = (const void *)DT_INST_PROP(0, ts_cal2_addr), .ts_cal2_temp = DT_INST_PROP(0, ts_cal2_temp), @@ -277,7 +326,10 @@ static const struct stm32_temp_config stm32_temp_dev_config = { .calib_data_shift = (DT_INST_PROP(0, ts_cal_resolution) - CAL_RES), .calib_vrefanalog = DT_INST_PROP(0, ts_cal_vrefanalog), #else - .average_slope = DT_INST_PROP(0, avgslope), + /* DT property is premultiplied by 10 to cope with Device Tree + * properties being integer-only. Rescale here during compile. + */ + .average_slope = ((float)DT_INST_PROP(0, avgslope) / 10.0f), .v25 = DT_INST_PROP(0, v25), #endif .is_ntc = DT_INST_PROP_OR(0, ntc, false) From 4641d3dab97d387316f50c77068109931fd5f185 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Wed, 28 Aug 2024 14:14:19 +0200 Subject: [PATCH 0118/4482] dts: bindings: stm32-temp*: regroup 'ntc' in common file Reduce duplication in STM32 dietemp bindings by regrouping the 'ntc' property declared in both "st,stm32-temp" and "st,stm32c0-temp-cal" to the shared "st,stm32-temp-common" binding. "st,stm32-temp-cal" is also modified to block 'ntc' property on include as no dual-calibration sensors to date require it (this could be changed later when need arises). Signed-off-by: Mathieu Choplain --- dts/bindings/sensor/st,stm32-temp-cal.yaml | 5 ++++- dts/bindings/sensor/st,stm32-temp-common.yaml | 11 +++++++++++ dts/bindings/sensor/st,stm32-temp.yaml | 4 ---- dts/bindings/sensor/st,stm32c0-temp-cal.yaml | 4 ---- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/dts/bindings/sensor/st,stm32-temp-cal.yaml b/dts/bindings/sensor/st,stm32-temp-cal.yaml index 5f5f4edffe11f..9994131426159 100644 --- a/dts/bindings/sensor/st,stm32-temp-cal.yaml +++ b/dts/bindings/sensor/st,stm32-temp-cal.yaml @@ -7,7 +7,10 @@ description: | compatible: "st,stm32-temp-cal" -include: "st,stm32-temp-cal-common.yaml" +include: + - name: st,stm32-temp-cal-common.yaml + property-blocklist: + - ntc properties: ts-cal2-addr: diff --git a/dts/bindings/sensor/st,stm32-temp-common.yaml b/dts/bindings/sensor/st,stm32-temp-common.yaml index cf45e234d4a74..ffedcd4b2aec6 100644 --- a/dts/bindings/sensor/st,stm32-temp-common.yaml +++ b/dts/bindings/sensor/st,stm32-temp-common.yaml @@ -7,3 +7,14 @@ properties: io-channels: required: true description: ADC channel for temperature sensor + + ntc: + type: boolean + description: | + Negative Temperature Coefficient + + Set when the sensor's value is inversely proportional to temperature + (i.e., the sensor's value decreases as the temperature increases). + + This is visible in the formula used for temperature calculation, which has the + form "Calibration_Value - ADC_Value" rather than "ADC_Value - Calibration_Value". diff --git a/dts/bindings/sensor/st,stm32-temp.yaml b/dts/bindings/sensor/st,stm32-temp.yaml index 21e10a87ec092..4d0c251c377c4 100644 --- a/dts/bindings/sensor/st,stm32-temp.yaml +++ b/dts/bindings/sensor/st,stm32-temp.yaml @@ -25,7 +25,3 @@ properties: datasheet "Electrical characteristics/Operating conditions" STM32F1 Table 5.3.19 (min 1340, max 1520, default 1430) STM32F4 Table 6.3.21 default 760 - - ntc: - type: boolean - description: Negative Temperature Coefficient. True if STM32F1 diff --git a/dts/bindings/sensor/st,stm32c0-temp-cal.yaml b/dts/bindings/sensor/st,stm32c0-temp-cal.yaml index 6946f11a708fe..6e4ecc47a1658 100644 --- a/dts/bindings/sensor/st,stm32c0-temp-cal.yaml +++ b/dts/bindings/sensor/st,stm32c0-temp-cal.yaml @@ -17,7 +17,3 @@ properties: Average slope of T-V chart (in uV/C) according to datasheet "Electrical characteristics/Operating conditions" STM32C0 Table 5.3.16 (min 2400 uV/C, max 2650, typ: 2530) - - ntc: - type: boolean - description: Negative Temperature Coefficient. True if STM32F0x0 From e61b010b4c3b835e6727beac5439be1c42fdcec5 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Tue, 23 Jul 2024 10:22:14 +0200 Subject: [PATCH 0119/4482] dts: bindings: stm32-temp*: reword bindings documentation Improve the STM32 dietemp sensor bindings by rewording the descriptions of bindings and properties. Signed-off-by: Mathieu Choplain --- .../sensor/st,stm32-temp-cal-common.yaml | 19 ++++++++++--------- dts/bindings/sensor/st,stm32-temp-cal.yaml | 9 +++------ dts/bindings/sensor/st,stm32-temp.yaml | 12 ++++-------- dts/bindings/sensor/st,stm32c0-temp-cal.yaml | 8 +++----- 4 files changed, 20 insertions(+), 28 deletions(-) diff --git a/dts/bindings/sensor/st,stm32-temp-cal-common.yaml b/dts/bindings/sensor/st,stm32-temp-cal-common.yaml index 96ae8a13bfbd6..9a47984ed7c97 100644 --- a/dts/bindings/sensor/st,stm32-temp-cal-common.yaml +++ b/dts/bindings/sensor/st,stm32-temp-cal-common.yaml @@ -9,29 +9,30 @@ properties: ts-cal1-addr: type: int required: true - description: address of parameter TS_CAL1 + description: Address of TS_CAL1 calibration parameter ts-cal1-temp: type: int required: true - description: | - temperature at which temperature sensor has been - calibrated in production for data into ts-cal1-addr + description: Temperature at which TS_CAL1 has been measured (TS_CAL2_TEMP) ts-cal-vrefanalog: type: int required: true description: | Analog voltage reference (Vref+) voltage with which - temperature sensor has been calibrated in production + temperature sensor calibration parameters have been + measured ts-cal-resolution: type: int description: | - Temperature calibration resolution with which the ts-cal1-temp and - ts-cal2-temp are measured. - For most stm32 series a native 12-bit ADC is embedded in the device, - except for H7 on 16-bit and U5 on 14-bit + ADC resolution used for measuring calibration data + + This is usually equal to the ADC's native resolution. + + Most series have a 12-bit ADC, but 14-bit and 16-bit + also exists on e.g., STM32U5 and STM32H7 (16) series. default: 12 enum: - 12 diff --git a/dts/bindings/sensor/st,stm32-temp-cal.yaml b/dts/bindings/sensor/st,stm32-temp-cal.yaml index 9994131426159..84ca91e64f0f2 100644 --- a/dts/bindings/sensor/st,stm32-temp-cal.yaml +++ b/dts/bindings/sensor/st,stm32-temp-cal.yaml @@ -2,8 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 description: | - STM32 family TEMP node for production calibrated sensors like L5/U5 - with two calibration temperatures. + STM32 family TEMP node for production calibrated sensors with two calibration temperatures. compatible: "st,stm32-temp-cal" @@ -16,11 +15,9 @@ properties: ts-cal2-addr: type: int required: true - description: address of parameter TS_CAL2 + description: Address of TS_CAL2 calibration parameter ts-cal2-temp: type: int required: true - description: | - temperature at which temperature sensor has been - calibrated in production for data into ts-cal2-addr + description: Temperature at which TS_CAL2 has been measured (TS_CAL2_TEMP) diff --git a/dts/bindings/sensor/st,stm32-temp.yaml b/dts/bindings/sensor/st,stm32-temp.yaml index 4d0c251c377c4..1dcd8661ab16e 100644 --- a/dts/bindings/sensor/st,stm32-temp.yaml +++ b/dts/bindings/sensor/st,stm32-temp.yaml @@ -12,16 +12,12 @@ properties: type: int required: true description: | - Average slope of T-V chart (in mV/C x10) according to - datasheet "Electrical characteristics/Operating conditions" - STM32F1 Table 5.3.19 (min 4 mV/C, max 4.6, default 4.3) - STM32F4 Table 6.3.21 default 2.5 + Average slope of T-V chart (in mV/°C, x10), found in MCU datasheet + chapters "Electrical characteristics" or "Operating conditions" v25: type: int required: true description: | - Voltage of temperature sensor at 25C in mV according to - datasheet "Electrical characteristics/Operating conditions" - STM32F1 Table 5.3.19 (min 1340, max 1520, default 1430) - STM32F4 Table 6.3.21 default 760 + Voltage of temperature sensor at 25°C (in mV), found in MCU datasheet + chapters "Electrical characteristics" or "Operating conditions" diff --git a/dts/bindings/sensor/st,stm32c0-temp-cal.yaml b/dts/bindings/sensor/st,stm32c0-temp-cal.yaml index 6e4ecc47a1658..06ba09da469d3 100644 --- a/dts/bindings/sensor/st,stm32c0-temp-cal.yaml +++ b/dts/bindings/sensor/st,stm32c0-temp-cal.yaml @@ -2,8 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 description: | - STM32 family TEMP node for production calibrated sensors like C0 - with a single calibration temperature. + STM32 family TEMP node for production calibrated sensors with a single calibration temperature. compatible: "st,stm32c0-temp-cal" @@ -14,6 +13,5 @@ properties: type: int required: true description: | - Average slope of T-V chart (in uV/C) according to - datasheet "Electrical characteristics/Operating conditions" - STM32C0 Table 5.3.16 (min 2400 uV/C, max 2650, typ: 2530) + Average slope of T-V chart (in µV/°C), found in MCU datasheet + chapters "Electrical characteristics" or "Operating conditions" From 5a0775b1ab2946076998e7c86aed31cd10a3db27 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Tue, 23 Jul 2024 10:47:24 +0200 Subject: [PATCH 0120/4482] dts: bindings: stm32-temp*: align 'avgslope' to datasheet format Change the STM32 Temperature Sensor bindings to accept the average slope value in string form instead of integer. With this change, it is possible to use the raw decimal value found in each MCU's datasheet instead of needing to scale it (differently depending on series!). This also allows regrouping the property in a single file to reduce duplication. Also update all DTSI files affected by this change and the dietemp driver to accept the property's new format. Signed-off-by: Mathieu Choplain --- drivers/sensor/st/stm32_temp/stm32_temp.c | 10 ++-------- dts/arm/st/c0/stm32c0.dtsi | 2 +- dts/arm/st/f0/stm32f030.dtsi | 2 +- dts/arm/st/f1/stm32f1.dtsi | 2 +- dts/arm/st/f2/stm32f2.dtsi | 2 +- dts/bindings/sensor/st,stm32-temp-cal.yaml | 1 + dts/bindings/sensor/st,stm32-temp-common.yaml | 7 +++++++ dts/bindings/sensor/st,stm32-temp.yaml | 7 ------- dts/bindings/sensor/st,stm32c0-temp-cal.yaml | 8 -------- 9 files changed, 14 insertions(+), 27 deletions(-) diff --git a/drivers/sensor/st/stm32_temp/stm32_temp.c b/drivers/sensor/st/stm32_temp/stm32_temp.c index 99fa003f0924f..0c9e90b2d1897 100644 --- a/drivers/sensor/st/stm32_temp/stm32_temp.c +++ b/drivers/sensor/st/stm32_temp/stm32_temp.c @@ -315,10 +315,7 @@ static const struct stm32_temp_config stm32_temp_dev_config = { .ts_cal1_addr = (const void *)DT_INST_PROP(0, ts_cal1_addr), .ts_cal1_temp = DT_INST_PROP(0, ts_cal1_temp), #if defined(HAS_SINGLE_CALIBRATION) - /* DT property is premultiplied by 1000 to cope with Device Tree - * properties being integer-only. Rescale here during compile. - */ - .average_slope = ((float)DT_INST_PROP(0, avgslope) / 1000.0f), + .average_slope = ((float)DT_INST_STRING_UNQUOTED(0, avgslope)), #else /* HAS_DUAL_CALIBRATION */ .ts_cal2_addr = (const void *)DT_INST_PROP(0, ts_cal2_addr), .ts_cal2_temp = DT_INST_PROP(0, ts_cal2_temp), @@ -326,10 +323,7 @@ static const struct stm32_temp_config stm32_temp_dev_config = { .calib_data_shift = (DT_INST_PROP(0, ts_cal_resolution) - CAL_RES), .calib_vrefanalog = DT_INST_PROP(0, ts_cal_vrefanalog), #else - /* DT property is premultiplied by 10 to cope with Device Tree - * properties being integer-only. Rescale here during compile. - */ - .average_slope = ((float)DT_INST_PROP(0, avgslope) / 10.0f), + .average_slope = ((float)DT_INST_STRING_UNQUOTED(0, avgslope)), .v25 = DT_INST_PROP(0, v25), #endif .is_ntc = DT_INST_PROP_OR(0, ntc, false) diff --git a/dts/arm/st/c0/stm32c0.dtsi b/dts/arm/st/c0/stm32c0.dtsi index a18e10c251fcd..812db5f010127 100644 --- a/dts/arm/st/c0/stm32c0.dtsi +++ b/dts/arm/st/c0/stm32c0.dtsi @@ -346,7 +346,7 @@ ts-cal1-addr = <0x1FFF7568>; ts-cal1-temp = <30>; ts-cal-vrefanalog = <3000>; - avgslope = <2530>; + avgslope = "2.53"; io-channels = <&adc1 9>; status = "disabled"; }; diff --git a/dts/arm/st/f0/stm32f030.dtsi b/dts/arm/st/f0/stm32f030.dtsi index 0985359140e62..caa4699e89923 100644 --- a/dts/arm/st/f0/stm32f030.dtsi +++ b/dts/arm/st/f0/stm32f030.dtsi @@ -16,7 +16,7 @@ ts-cal1-addr = <0x1FFFF7B8>; ts-cal1-temp = <30>; ts-cal-vrefanalog = <3300>; - avgslope = <4300>; + avgslope = "4.3"; io-channels = <&adc1 16>; ntc; status = "disabled"; diff --git a/dts/arm/st/f1/stm32f1.dtsi b/dts/arm/st/f1/stm32f1.dtsi index 1f213353c0cac..53a12c413d44d 100644 --- a/dts/arm/st/f1/stm32f1.dtsi +++ b/dts/arm/st/f1/stm32f1.dtsi @@ -365,7 +365,7 @@ compatible = "st,stm32-temp"; io-channels = <&adc1 16>; status = "disabled"; - avgslope = <43>; + avgslope = "4.3"; v25 = <1430>; ntc; }; diff --git a/dts/arm/st/f2/stm32f2.dtsi b/dts/arm/st/f2/stm32f2.dtsi index 1a8c9c811452f..a625d4d362d45 100644 --- a/dts/arm/st/f2/stm32f2.dtsi +++ b/dts/arm/st/f2/stm32f2.dtsi @@ -707,8 +707,8 @@ compatible = "st,stm32-temp"; io-channels = <&adc1 16>; status = "disabled"; + avgslope = "2.5"; v25 = <760>; - avgslope = <25>; }; otgfs_phy: otgfs_phy { diff --git a/dts/bindings/sensor/st,stm32-temp-cal.yaml b/dts/bindings/sensor/st,stm32-temp-cal.yaml index 84ca91e64f0f2..c2174b1c04237 100644 --- a/dts/bindings/sensor/st,stm32-temp-cal.yaml +++ b/dts/bindings/sensor/st,stm32-temp-cal.yaml @@ -9,6 +9,7 @@ compatible: "st,stm32-temp-cal" include: - name: st,stm32-temp-cal-common.yaml property-blocklist: + - avgslope - ntc properties: diff --git a/dts/bindings/sensor/st,stm32-temp-common.yaml b/dts/bindings/sensor/st,stm32-temp-common.yaml index ffedcd4b2aec6..660844c3a99e1 100644 --- a/dts/bindings/sensor/st,stm32-temp-common.yaml +++ b/dts/bindings/sensor/st,stm32-temp-common.yaml @@ -8,6 +8,13 @@ properties: required: true description: ADC channel for temperature sensor + avgslope: + type: string + required: true + description: | + Average slope of T-V chart (in mV/°C), found in MCU datasheet + chapters "Electrical characteristics" or "Operating conditions" + ntc: type: boolean description: | diff --git a/dts/bindings/sensor/st,stm32-temp.yaml b/dts/bindings/sensor/st,stm32-temp.yaml index 1dcd8661ab16e..1a53f33b43ab2 100644 --- a/dts/bindings/sensor/st,stm32-temp.yaml +++ b/dts/bindings/sensor/st,stm32-temp.yaml @@ -8,13 +8,6 @@ compatible: "st,stm32-temp" include: [base.yaml, "st,stm32-temp-common.yaml"] properties: - avgslope: - type: int - required: true - description: | - Average slope of T-V chart (in mV/°C, x10), found in MCU datasheet - chapters "Electrical characteristics" or "Operating conditions" - v25: type: int required: true diff --git a/dts/bindings/sensor/st,stm32c0-temp-cal.yaml b/dts/bindings/sensor/st,stm32c0-temp-cal.yaml index 06ba09da469d3..d217782cadee9 100644 --- a/dts/bindings/sensor/st,stm32c0-temp-cal.yaml +++ b/dts/bindings/sensor/st,stm32c0-temp-cal.yaml @@ -7,11 +7,3 @@ description: | compatible: "st,stm32c0-temp-cal" include: "st,stm32-temp-cal-common.yaml" - -properties: - avgslope: - type: int - required: true - description: | - Average slope of T-V chart (in µV/°C), found in MCU datasheet - chapters "Electrical characteristics" or "Operating conditions" From 02fb8faefb52ce808b4799eb99307a04b4acc14b Mon Sep 17 00:00:00 2001 From: Alexandre Bailon Date: Mon, 26 Aug 2024 22:18:05 +0200 Subject: [PATCH 0121/4482] board: ti: cc1352p7_lp: Add complementary instructions about OpenOCD Currently, OpenOCD doesn't support the cc1352p7. There are two open PR adding its support to Zephyr's OpenOCD[1] and upstream OpenOCD[2]. Until this gets merged, we need to use a downstream version of OpenOCD. This updates the documentation to explain where to find it and how to use it. [1] https://github.com/zephyrproject-rtos/openocd/pull/65 [2] https://review.openocd.org/q/owner:abailon%2540baylibre.com Signed-off-by: Alexandre Bailon --- boards/ti/cc1352p7_launchpad/doc/index.rst | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/boards/ti/cc1352p7_launchpad/doc/index.rst b/boards/ti/cc1352p7_launchpad/doc/index.rst index 2b7fbc12a2c6c..aa2c28cb2c45e 100644 --- a/boards/ti/cc1352p7_launchpad/doc/index.rst +++ b/boards/ti/cc1352p7_launchpad/doc/index.rst @@ -151,15 +151,20 @@ Prerequisites: #. Install OpenOCD - You can obtain OpenOCD by following these - :ref:`installing the latest Zephyr SDK instructions `. + Currently, OpenOCD doesn't support the CC1352P7. + Until its support get merged, we have to builld a downstream version that could found `here `_. + Please refer to OpenOCD documentation to build and install OpenOCD. - After the installation, add the directory containing the OpenOCD executable - to your environment's PATH variable. For example, use this command in Linux: + For your convenience, we provide a `prebuilt binary `_. - .. code-block:: console +.. code-block:: console + + $ unzip openocd-810cb5b21-x86_64-linux-gnu.zip + $ chmod +x openocd-x86_64-linux-gnu/bin/openocd + $ export OPENOCD_DIST=$PWD/openocd-x86_64-linux-gnu - export PATH=$ZEPHYR_SDK_INSTALL_DIR/sysroots/x86_64-pokysdk-linux/usr/bin/openocd:$PATH +By default, zephyr will try to use the OpenOCD binary from SDK. +You will have to define :code:`OPENOCD` and :code:`OPENOCD_DEFAULT_PATH` to use the custom OpenOCD binary. Flashing ======== @@ -185,6 +190,7 @@ Then build and flash the application in the usual way. :zephyr-app: samples/hello_world :board: cc1352p7_lp :goals: build flash + :gen-args: -DOPENOCD=$OPENOCD_DIST/bin/openocd -DOPENOCD_DEFAULT_PATH=$OPENOCD_DIST/share/openocd Debugging ========= @@ -197,6 +203,7 @@ You can debug an application in the usual way. Here is an example for the :board: cc1352p7_lp :maybe-skip-config: :goals: debug + :gen-args: -DOPENOCD=$OPENOCD_DIST/bin/openocd -DOPENOCD_DEFAULT_PATH=$OPENOCD_DIST/share/openocd Bootloader ========== From 8ccc43912fe7cd99a8b71328a5f199b6b8bd2ff4 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Mon, 22 Apr 2024 07:59:35 -0500 Subject: [PATCH 0122/4482] samples: ipc: openamp: Remove virtual shared memory device A virtual metal_device is created, next the needed IO regions are created and added to this device. Immediately we extract these regions back out and make use of them. There is no reason to create the metal_device and add the IO regions to it, instead simply use the IO regions directly. This is similar to what was already done to the openamp_rsc_table sample. Signed-off-by: Andrew Davis --- samples/subsys/ipc/openamp/remote/src/main.c | 43 ++------------------ samples/subsys/ipc/openamp/src/main.c | 43 ++------------------ 2 files changed, 8 insertions(+), 78 deletions(-) diff --git a/samples/subsys/ipc/openamp/remote/src/main.c b/samples/subsys/ipc/openamp/remote/src/main.c index 06622d49e44e3..73da4bbb5e66a 100644 --- a/samples/subsys/ipc/openamp/remote/src/main.c +++ b/samples/subsys/ipc/openamp/remote/src/main.c @@ -15,7 +15,6 @@ #include #include -#include #include "common.h" @@ -27,25 +26,6 @@ static const struct device *const ipm_handle = DEVICE_DT_GET(DT_CHOSEN(zephyr_ipc)); static metal_phys_addr_t shm_physmap[] = { SHM_START_ADDR }; -static struct metal_device shm_device = { - .name = SHM_DEVICE_NAME, - .bus = NULL, - .num_regions = 1, - { - { - .virt = (void *) SHM_START_ADDR, - .physmap = shm_physmap, - .size = SHM_SIZE, - .page_shift = 0xffffffff, - .page_mask = 0xffffffff, - .mem_flags = 0, - .ops = { NULL }, - }, - }, - .node = { NULL }, - .irq_num = 0, - .irq_info = NULL -}; static volatile unsigned int received_data; @@ -59,7 +39,8 @@ static struct virtio_vring_info rvrings[2] = { }; static struct virtio_device vdev; static struct rpmsg_virtio_device rvdev; -static struct metal_io_region *io; +static struct metal_io_region shm_io_data; +static struct metal_io_region *io = &shm_io_data; static struct virtqueue *vqueue[2]; static unsigned char ipc_virtio_get_status(struct virtio_device *dev) @@ -147,7 +128,6 @@ void app_task(void *arg1, void *arg2, void *arg3) int status = 0; unsigned int message = 0U; - struct metal_device *device; struct rpmsg_device *rdev; struct metal_init_params metal_params = METAL_INIT_DEFAULTS; @@ -159,23 +139,8 @@ void app_task(void *arg1, void *arg2, void *arg3) return; } - status = metal_register_generic_device(&shm_device); - if (status != 0) { - printk("Couldn't register shared memory device: %d\n", status); - return; - } - - status = metal_device_open("generic", SHM_DEVICE_NAME, &device); - if (status != 0) { - printk("metal_device_open failed: %d\n", status); - return; - } - - io = metal_device_io_region(device, 0); - if (io == NULL) { - printk("metal_device_io_region failed to get region\n"); - return; - } + /* declare shared memory region */ + metal_io_init(io, (void *)SHM_START_ADDR, shm_physmap, SHM_SIZE, -1, 0, NULL); /* setup IPM */ if (!device_is_ready(ipm_handle)) { diff --git a/samples/subsys/ipc/openamp/src/main.c b/samples/subsys/ipc/openamp/src/main.c index 5b2ce5fddbba2..c694b73759073 100644 --- a/samples/subsys/ipc/openamp/src/main.c +++ b/samples/subsys/ipc/openamp/src/main.c @@ -16,7 +16,6 @@ #include #include -#include #include "common.h" @@ -28,25 +27,6 @@ static const struct device *const ipm_handle = DEVICE_DT_GET(DT_CHOSEN(zephyr_ipc)); static metal_phys_addr_t shm_physmap[] = { SHM_START_ADDR }; -static struct metal_device shm_device = { - .name = SHM_DEVICE_NAME, - .bus = NULL, - .num_regions = 1, - { - { - .virt = (void *) SHM_START_ADDR, - .physmap = shm_physmap, - .size = SHM_SIZE, - .page_shift = 0xffffffff, - .page_mask = 0xffffffff, - .mem_flags = 0, - .ops = { NULL }, - }, - }, - .node = { NULL }, - .irq_num = 0, - .irq_info = NULL -}; static volatile unsigned int received_data; @@ -60,7 +40,8 @@ static struct virtio_vring_info rvrings[2] = { }; static struct virtio_device vdev; static struct rpmsg_virtio_device rvdev; -static struct metal_io_region *io; +static struct metal_io_region shm_io_data; +static struct metal_io_region *io = &shm_io_data; static struct virtqueue *vqueue[2]; static unsigned char ipc_virtio_get_status(struct virtio_device *dev) @@ -171,7 +152,6 @@ void app_task(void *arg1, void *arg2, void *arg3) int status = 0; unsigned int message = 0U; - struct metal_device *device; struct metal_init_params metal_params = METAL_INIT_DEFAULTS; printk("\r\nOpenAMP[master] demo started\r\n"); @@ -182,23 +162,8 @@ void app_task(void *arg1, void *arg2, void *arg3) return; } - status = metal_register_generic_device(&shm_device); - if (status != 0) { - printk("Couldn't register shared memory device: %d\n", status); - return; - } - - status = metal_device_open("generic", SHM_DEVICE_NAME, &device); - if (status != 0) { - printk("metal_device_open failed: %d\n", status); - return; - } - - io = metal_device_io_region(device, 0); - if (io == NULL) { - printk("metal_device_io_region failed to get region\n"); - return; - } + /* declare shared memory region */ + metal_io_init(io, (void *)SHM_START_ADDR, shm_physmap, SHM_SIZE, -1, 0, NULL); /* setup IPM */ if (!device_is_ready(ipm_handle)) { From d58542fcc4bec709e8a606bb365bc919f6409992 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Mon, 9 Sep 2024 10:36:49 -0500 Subject: [PATCH 0123/4482] ipc: rpmsg_service: Remove virtual shared memory device A virtual metal_device is created, next the needed IO regions are created and added to this device. Immediately we extract these regions back out and make use of them. There is no reason to create the metal_device and add the IO regions to it, instead simply use the IO regions directly. This is similar to what was already done to the openamp_rsc_table sample. Signed-off-by: Andrew Davis --- subsys/ipc/rpmsg_service/rpmsg_backend.c | 42 +++--------------------- 1 file changed, 4 insertions(+), 38 deletions(-) diff --git a/subsys/ipc/rpmsg_service/rpmsg_backend.c b/subsys/ipc/rpmsg_service/rpmsg_backend.c index b3f428e011c10..4a35880f36d53 100644 --- a/subsys/ipc/rpmsg_service/rpmsg_backend.c +++ b/subsys/ipc/rpmsg_service/rpmsg_backend.c @@ -13,7 +13,6 @@ #include #include -#include #define LOG_MODULE_NAME rpmsg_backend LOG_MODULE_REGISTER(LOG_MODULE_NAME, CONFIG_RPMSG_SERVICE_LOG_LEVEL); @@ -61,25 +60,7 @@ static const struct device *const ipm_handle = #endif static metal_phys_addr_t shm_physmap[] = { SHM_START_ADDR }; -static struct metal_device shm_device = { - .name = SHM_DEVICE_NAME, - .bus = NULL, - .num_regions = 1, - { - { - .virt = (void *) SHM_START_ADDR, - .physmap = shm_physmap, - .size = SHM_SIZE, - .page_shift = 0xffffffff, - .page_mask = 0xffffffff, - .mem_flags = 0, - .ops = { NULL }, - }, - }, - .node = { NULL }, - .irq_num = 0, - .irq_info = NULL -}; +static struct metal_io_region shm_io; static struct virtio_vring_info rvrings[2] = { [0] = { @@ -184,7 +165,6 @@ int rpmsg_backend_init(struct metal_io_region **io, struct virtio_device *vdev) { int32_t err; struct metal_init_params metal_params = METAL_INIT_DEFAULTS; - struct metal_device *device; /* Start IPM workqueue */ k_work_queue_start(&ipm_work_q, ipm_stack_area, @@ -202,23 +182,9 @@ int rpmsg_backend_init(struct metal_io_region **io, struct virtio_device *vdev) return err; } - err = metal_register_generic_device(&shm_device); - if (err) { - LOG_ERR("Couldn't register shared memory device: %d", err); - return err; - } - - err = metal_device_open("generic", SHM_DEVICE_NAME, &device); - if (err) { - LOG_ERR("metal_device_open failed: %d", err); - return err; - } - - *io = metal_device_io_region(device, 0); - if (!*io) { - LOG_ERR("metal_device_io_region failed to get region"); - return err; - } + /* declare shared memory region */ + metal_io_init(&shm_io, (void *)SHM_START_ADDR, shm_physmap, SHM_SIZE, -1, 0, NULL); + *io = &shm_io; /* IPM setup */ #if defined(CONFIG_RPMSG_SERVICE_DUAL_IPM_SUPPORT) From be4a4ee324d4feb42d8ce856267fd5a32aedbaa0 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Tue, 7 May 2024 13:18:22 -0500 Subject: [PATCH 0124/4482] ipc: ipc_service: Remove intermediate metal generic device A libmetal "generic" device is created, then opened and used for its IO regions. Since we are adding these IO regions in the first place there is no reason for this layer of indirection. Signed-off-by: Andrew Davis --- include/zephyr/ipc/ipc_static_vrings.h | 6 +--- .../backends/ipc_rpmsg_static_vrings.c | 7 ++-- .../ipc/ipc_service/lib/ipc_static_vrings.c | 34 +++---------------- 3 files changed, 8 insertions(+), 39 deletions(-) diff --git a/include/zephyr/ipc/ipc_static_vrings.h b/include/zephyr/ipc/ipc_static_vrings.h index d82144f4522b0..2450e85df70ff 100644 --- a/include/zephyr/ipc/ipc_static_vrings.h +++ b/include/zephyr/ipc/ipc_static_vrings.h @@ -9,7 +9,6 @@ #include #include -#include #ifdef __cplusplus extern "C" { @@ -55,9 +54,6 @@ struct ipc_static_vrings { /** SHM physmap. */ metal_phys_addr_t shm_physmap[1]; - /** SHM device. */ - struct metal_device shm_device; - /** SHM and addresses. */ uintptr_t status_reg_addr; @@ -77,7 +73,7 @@ struct ipc_static_vrings { size_t shm_size; /** SHM IO region. */ - struct metal_io_region *shm_io; + struct metal_io_region shm_io; /** VRINGs */ struct virtio_vring_info rvrings[VRING_COUNT]; diff --git a/subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c b/subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c index a2c0883c05469..19955f065b3b2 100644 --- a/subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c +++ b/subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c @@ -577,7 +577,6 @@ static int open(const struct device *instance) data->vr.notify_cb = virtio_notify_cb; data->vr.priv = (void *) conf; - data->vr.shm_device.name = instance->name; err = ipc_static_vrings_init(&data->vr, conf->role); if (err != 0) { @@ -595,9 +594,9 @@ static int open(const struct device *instance) rpmsg_inst->cb = ept_cb; err = ipc_rpmsg_init(rpmsg_inst, data->role, conf->buffer_size, - data->vr.shm_io, &data->vr.vdev, - (void *) data->vr.shm_device.regions->virt, - data->vr.shm_device.regions->size, ns_bind_cb); + &data->vr.shm_io, &data->vr.vdev, + (void *)data->vr.shm_addr, + data->vr.shm_size, ns_bind_cb); if (err != 0) { goto error; } diff --git a/subsys/ipc/ipc_service/lib/ipc_static_vrings.c b/subsys/ipc/ipc_service/lib/ipc_static_vrings.c index 4daac52f575bd..c8708fd51995b 100644 --- a/subsys/ipc/ipc_service/lib/ipc_static_vrings.c +++ b/subsys/ipc/ipc_service/lib/ipc_static_vrings.c @@ -7,8 +7,6 @@ #include #include -#define SHM_DEVICE_DEFAULT_NAME "sram0.shm" - #define RPMSG_VQ_0 (0) /* TX virtqueue queue index */ #define RPMSG_VQ_1 (1) /* RX virtqueue queue index */ @@ -75,7 +73,6 @@ const static struct virtio_dispatch dispatch = { static int libmetal_setup(struct ipc_static_vrings *vr) { struct metal_init_params metal_params = METAL_INIT_DEFAULTS; - struct metal_device *device; int err; err = metal_init(&metal_params); @@ -83,30 +80,11 @@ static int libmetal_setup(struct ipc_static_vrings *vr) return err; } - err = metal_register_generic_device(&vr->shm_device); - if (err != 0) { - return err; - } - - err = metal_device_open("generic", vr->shm_device.name, &device); - if (err != 0) { - return err; - } - - vr->shm_io = metal_device_io_region(device, 0); - if (vr->shm_io == NULL) { - return err; - } - return 0; } static int libmetal_teardown(struct ipc_static_vrings *vr) { - vr->shm_io = 0; - - metal_device_close(&vr->shm_device); - metal_finish(); return 0; @@ -124,13 +102,13 @@ static int vq_setup(struct ipc_static_vrings *vr, unsigned int role) return -ENOMEM; } - vr->rvrings[RPMSG_VQ_0].io = vr->shm_io; + vr->rvrings[RPMSG_VQ_0].io = &vr->shm_io; vr->rvrings[RPMSG_VQ_0].info.vaddr = (void *) vr->tx_addr; vr->rvrings[RPMSG_VQ_0].info.num_descs = vr->vring_size; vr->rvrings[RPMSG_VQ_0].info.align = MEM_ALIGNMENT; vr->rvrings[RPMSG_VQ_0].vq = vr->vq[RPMSG_VQ_0]; - vr->rvrings[RPMSG_VQ_1].io = vr->shm_io; + vr->rvrings[RPMSG_VQ_1].io = &vr->shm_io; vr->rvrings[RPMSG_VQ_1].info.vaddr = (void *) vr->rx_addr; vr->rvrings[RPMSG_VQ_1].info.num_descs = vr->vring_size; vr->rvrings[RPMSG_VQ_1].info.align = MEM_ALIGNMENT; @@ -166,13 +144,9 @@ int ipc_static_vrings_init(struct ipc_static_vrings *vr, unsigned int role) return -EINVAL; } - if (!vr->shm_device.name) { - vr->shm_device.name = SHM_DEVICE_DEFAULT_NAME; - } - vr->shm_device.num_regions = 1; vr->shm_physmap[0] = vr->shm_addr; - metal_io_init(vr->shm_device.regions, (void *) vr->shm_addr, + metal_io_init(&vr->shm_io, (void *)vr->shm_addr, vr->shm_physmap, vr->shm_size, -1, 0, NULL); err = libmetal_setup(vr); @@ -197,7 +171,7 @@ int ipc_static_vrings_deinit(struct ipc_static_vrings *vr, unsigned int role) return err; } - metal_io_finish(vr->shm_device.regions); + metal_io_finish(&vr->shm_io); return 0; } From df64d076d8b7623c8c170e5514dc23a0a85d0758 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Tue, 7 May 2024 12:51:10 -0500 Subject: [PATCH 0125/4482] ipc: ipc_service: Inline libmetal_{setup,teardown}() for correct ordering Currently metal_init() is called as part of libmetal_setup() which is called after libmetal has already started being used (metal_io_init called before). Same for metal_finish() but in reverse (metal_io_finish called after). To fix this inline the content of libmetal_{setup,teardown} into their one call-sites and move the init/finish calls to the correct spot before/after all uses of the lib. Signed-off-by: Andrew Davis --- .../ipc/ipc_service/lib/ipc_static_vrings.c | 38 ++++--------------- 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/subsys/ipc/ipc_service/lib/ipc_static_vrings.c b/subsys/ipc/ipc_service/lib/ipc_static_vrings.c index c8708fd51995b..f07ffd45dcb27 100644 --- a/subsys/ipc/ipc_service/lib/ipc_static_vrings.c +++ b/subsys/ipc/ipc_service/lib/ipc_static_vrings.c @@ -70,26 +70,6 @@ const static struct virtio_dispatch dispatch = { .notify = ipc_virtio_notify, }; -static int libmetal_setup(struct ipc_static_vrings *vr) -{ - struct metal_init_params metal_params = METAL_INIT_DEFAULTS; - int err; - - err = metal_init(&metal_params); - if (err != 0) { - return err; - } - - return 0; -} - -static int libmetal_teardown(struct ipc_static_vrings *vr) -{ - metal_finish(); - - return 0; -} - static int vq_setup(struct ipc_static_vrings *vr, unsigned int role) { vr->vq[RPMSG_VQ_0] = virtqueue_allocate(vr->vring_size); @@ -138,22 +118,23 @@ static int vq_teardown(struct ipc_static_vrings *vr, unsigned int role) int ipc_static_vrings_init(struct ipc_static_vrings *vr, unsigned int role) { + struct metal_init_params metal_params = METAL_INIT_DEFAULTS; int err = 0; if (!vr) { return -EINVAL; } + err = metal_init(&metal_params); + if (err != 0) { + return err; + } + vr->shm_physmap[0] = vr->shm_addr; metal_io_init(&vr->shm_io, (void *)vr->shm_addr, vr->shm_physmap, vr->shm_size, -1, 0, NULL); - err = libmetal_setup(vr); - if (err != 0) { - return err; - } - return vq_setup(vr, role); } @@ -166,12 +147,9 @@ int ipc_static_vrings_deinit(struct ipc_static_vrings *vr, unsigned int role) return err; } - err = libmetal_teardown(vr); - if (err != 0) { - return err; - } - metal_io_finish(&vr->shm_io); + metal_finish(); + return 0; } From d0f5b6c351b154a9dd2fd1f9a28883ae86228a3d Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Thu, 20 Jun 2024 13:42:38 +0800 Subject: [PATCH 0126/4482] Bluetooth: BR: Add listener cb for discovery The results of inquiry and extended inquiry are only reported from application level after the inquiry complete event notified. While the event of inquiry result is notified by controller in real time. It is not a good user experience. Just like scanning of LE, add a listener cb for discovery. When the event of inquiry result, extended inquiry result, or remote name request complete notified, call listener `recv` cb to notify the upper layer. When the event of inquiry complete notified or no pending of remote name request , call listener `timeout` cb to notify the upper layer. Signed-off-by: Lyle Zhu --- include/zephyr/bluetooth/bluetooth.h | 47 +++++++++++++++++++++++++++- subsys/bluetooth/host/classic/br.c | 46 +++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 1 deletion(-) diff --git a/include/zephyr/bluetooth/bluetooth.h b/include/zephyr/bluetooth/bluetooth.h index bc5b7b0731c4a..333ad5d4ff169 100644 --- a/include/zephyr/bluetooth/bluetooth.h +++ b/include/zephyr/bluetooth/bluetooth.h @@ -236,7 +236,8 @@ int bt_enable(bt_ready_cb_t cb); * with settings_load() before reenabling the stack. * * This API does _not_ clear previously registered callbacks - * like @ref bt_le_scan_cb_register and @ref bt_conn_cb_register. + * like @ref bt_le_scan_cb_register, @ref bt_conn_cb_register + * AND @ref bt_br_discovery_cb_register. * That is, the application shall not re-register them when * the Bluetooth subsystem is re-enabled later. * @@ -2578,6 +2579,8 @@ struct bt_br_discovery_param { * @param results Storage for discovery results. * @param count Number of results in storage. Valid range: 1-255. * @param cb Callback to notify discovery results. + * May be NULL if callback registration through + * @ref bt_br_discovery_cb_register is preferred. * * @return Zero on success or error code otherwise, positive in case * of protocol error or negative (POSIX) in case of stack internal error @@ -2597,6 +2600,48 @@ int bt_br_discovery_start(const struct bt_br_discovery_param *param, */ int bt_br_discovery_stop(void); +struct bt_br_discovery_cb { + + /** + * @brief Advertisement packet and scan response received callback. + * + * @param result Storage used for discovery results + */ + void (*recv)(const struct bt_br_discovery_result *result); + + /** @brief The inquiry has stopped after discovery timeout. + * + * @param results Storage used for discovery results + * @param count Number of valid discovery results. + */ + void (*timeout)(const struct bt_br_discovery_result *results, + size_t count); + + sys_snode_t node; +}; + +/** + * @brief Register discovery packet callbacks. + * + * Adds the callback structure to the list of callback structures that monitors + * inquiry activity. + * + * This callback will be called for all inquiry activity, regardless of what + * API was used to start the discovery. + * + * @param cb Callback struct. Must point to memory that remains valid. + */ +void bt_br_discovery_cb_register(struct bt_br_discovery_cb *cb); + +/** + * @brief Unregister discovery packet callbacks. + * + * Remove the callback structure from the list of discovery callbacks. + * + * @param cb Callback struct. Must point to memory that remains valid. + */ +void bt_br_discovery_cb_unregister(struct bt_br_discovery_cb *cb); + struct bt_br_oob { /** BR/EDR address. */ bt_addr_t addr; diff --git a/subsys/bluetooth/host/classic/br.c b/subsys/bluetooth/host/classic/br.c index 80b010798c156..cf6536a96c366 100644 --- a/subsys/bluetooth/host/classic/br.c +++ b/subsys/bluetooth/host/classic/br.c @@ -26,6 +26,7 @@ static bt_br_discovery_cb_t *discovery_cb; struct bt_br_discovery_result *discovery_results; static size_t discovery_results_size; static size_t discovery_results_count; +static sys_slist_t discovery_cbs = SYS_SLIST_STATIC_INIT(&discovery_cbs); static int reject_conn(const bt_addr_t *bdaddr, uint8_t reason) { @@ -334,6 +335,7 @@ static void report_discovery_results(void) { bool resolving_names = false; int i; + struct bt_br_discovery_cb *listener, *next; for (i = 0; i < discovery_results_count; i++) { struct discovery_priv *priv; @@ -359,9 +361,16 @@ static void report_discovery_results(void) atomic_clear_bit(bt_dev.flags, BT_DEV_INQUIRY); + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&discovery_cbs, listener, next, node) { + if (listener->timeout) { + listener->timeout(discovery_results, discovery_results_count); + } + } + if (discovery_cb) { discovery_cb(discovery_results, discovery_results_count); } + bt_br_discovery_reset(); } @@ -437,6 +446,7 @@ void bt_hci_inquiry_result_with_rssi(struct net_buf *buf) struct bt_hci_evt_inquiry_result_with_rssi *evt; struct bt_br_discovery_result *result; struct discovery_priv *priv; + struct bt_br_discovery_cb *listener, *next; if (buf->len < sizeof(*evt)) { LOG_ERR("Unexpected end to buffer"); @@ -460,6 +470,12 @@ void bt_hci_inquiry_result_with_rssi(struct net_buf *buf) /* we could reuse slot so make sure EIR is cleared */ (void)memset(result->eir, 0, sizeof(result->eir)); + + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&discovery_cbs, listener, next, node) { + if (listener->recv) { + listener->recv(result); + } + } } } @@ -468,6 +484,7 @@ void bt_hci_extended_inquiry_result(struct net_buf *buf) struct bt_hci_evt_extended_inquiry_result *evt = (void *)buf->data; struct bt_br_discovery_result *result; struct discovery_priv *priv; + struct bt_br_discovery_cb *listener, *next; if (!atomic_test_bit(bt_dev.flags, BT_DEV_INQUIRY)) { return; @@ -487,6 +504,12 @@ void bt_hci_extended_inquiry_result(struct net_buf *buf) result->rssi = evt->rssi; memcpy(result->cod, evt->cod, 3); memcpy(result->eir, evt->eir, sizeof(result->eir)); + + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&discovery_cbs, listener, next, node) { + if (listener->recv) { + listener->recv(result); + } + } } void bt_hci_remote_name_request_complete(struct net_buf *buf) @@ -497,6 +520,7 @@ void bt_hci_remote_name_request_complete(struct net_buf *buf) int eir_len = 240; uint8_t *eir; int i; + struct bt_br_discovery_cb *listener, *next; result = get_result_slot(&evt->bdaddr, 0xff); if (!result) { @@ -549,6 +573,12 @@ void bt_hci_remote_name_request_complete(struct net_buf *buf) eir += eir[0] + 1; } + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&discovery_cbs, listener, next, node) { + if (listener->recv) { + listener->recv(result); + } + } + check_names: /* if still waiting for names */ for (i = 0; i < discovery_results_count; i++) { @@ -564,6 +594,12 @@ void bt_hci_remote_name_request_complete(struct net_buf *buf) /* all names resolved, report discovery results */ atomic_clear_bit(bt_dev.flags, BT_DEV_INQUIRY); + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&discovery_cbs, listener, next, node) { + if (listener->timeout) { + listener->timeout(discovery_results, discovery_results_count); + } + } + if (discovery_cb) { discovery_cb(discovery_results, discovery_results_count); } @@ -985,6 +1021,16 @@ int bt_br_discovery_stop(void) return 0; } +void bt_br_discovery_cb_register(struct bt_br_discovery_cb *cb) +{ + sys_slist_append(&discovery_cbs, &cb->node); +} + +void bt_br_discovery_cb_unregister(struct bt_br_discovery_cb *cb) +{ + sys_slist_find_and_remove(&discovery_cbs, &cb->node); +} + static int write_scan_enable(uint8_t scan) { struct net_buf *buf; From b0258c919ddb72616c19cfd2a16de765c286db1b Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Tue, 23 Jul 2024 19:57:52 +0800 Subject: [PATCH 0127/4482] Bluetooth: classic: Move classic source to sub folder Move source code of classic from bluetooth.h to ./classic/classic.h. Signed-off-by: Lyle Zhu --- include/zephyr/bluetooth/bluetooth.h | 165 +--------------- include/zephyr/bluetooth/classic/classic.h | 215 +++++++++++++++++++++ 2 files changed, 216 insertions(+), 164 deletions(-) create mode 100644 include/zephyr/bluetooth/classic/classic.h diff --git a/include/zephyr/bluetooth/bluetooth.h b/include/zephyr/bluetooth/bluetooth.h index 333ad5d4ff169..4b388bfd14692 100644 --- a/include/zephyr/bluetooth/bluetooth.h +++ b/include/zephyr/bluetooth/bluetooth.h @@ -26,6 +26,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -2522,170 +2523,6 @@ int bt_le_oob_get_local(uint8_t id, struct bt_le_oob *oob); int bt_le_ext_adv_oob_get_local(struct bt_le_ext_adv *adv, struct bt_le_oob *oob); -/** @brief BR/EDR discovery result structure */ -struct bt_br_discovery_result { - /** private */ - uint8_t _priv[4]; - - /** Remote device address */ - bt_addr_t addr; - - /** RSSI from inquiry */ - int8_t rssi; - - /** Class of Device */ - uint8_t cod[3]; - - /** Extended Inquiry Response */ - uint8_t eir[240]; -}; - -/** - * @typedef bt_br_discovery_cb_t - * @brief Callback type for reporting BR/EDR discovery (inquiry) - * results. - * - * A callback of this type is given to the bt_br_discovery_start() - * function and will be called at the end of the discovery with - * information about found devices populated in the results array. - * - * @param results Storage used for discovery results - * @param count Number of valid discovery results. - */ -typedef void bt_br_discovery_cb_t(struct bt_br_discovery_result *results, - size_t count); - -/** BR/EDR discovery parameters */ -struct bt_br_discovery_param { - /** Maximum length of the discovery in units of 1.28 seconds. - * Valid range is 0x01 - 0x30. - */ - uint8_t length; - - /** True if limited discovery procedure is to be used. */ - bool limited; -}; - -/** - * @brief Start BR/EDR discovery - * - * Start BR/EDR discovery (inquiry) and provide results through the specified - * callback. When bt_br_discovery_cb_t is called it indicates that discovery - * has completed. If more inquiry results were received during session than - * fits in provided result storage, only ones with highest RSSI will be - * reported. - * - * @param param Discovery parameters. - * @param results Storage for discovery results. - * @param count Number of results in storage. Valid range: 1-255. - * @param cb Callback to notify discovery results. - * May be NULL if callback registration through - * @ref bt_br_discovery_cb_register is preferred. - * - * @return Zero on success or error code otherwise, positive in case - * of protocol error or negative (POSIX) in case of stack internal error - */ -int bt_br_discovery_start(const struct bt_br_discovery_param *param, - struct bt_br_discovery_result *results, size_t count, - bt_br_discovery_cb_t cb); - -/** - * @brief Stop BR/EDR discovery. - * - * Stops ongoing BR/EDR discovery. If discovery was stopped by this call - * results won't be reported - * - * @return Zero on success or error code otherwise, positive in case of - * protocol error or negative (POSIX) in case of stack internal error. - */ -int bt_br_discovery_stop(void); - -struct bt_br_discovery_cb { - - /** - * @brief Advertisement packet and scan response received callback. - * - * @param result Storage used for discovery results - */ - void (*recv)(const struct bt_br_discovery_result *result); - - /** @brief The inquiry has stopped after discovery timeout. - * - * @param results Storage used for discovery results - * @param count Number of valid discovery results. - */ - void (*timeout)(const struct bt_br_discovery_result *results, - size_t count); - - sys_snode_t node; -}; - -/** - * @brief Register discovery packet callbacks. - * - * Adds the callback structure to the list of callback structures that monitors - * inquiry activity. - * - * This callback will be called for all inquiry activity, regardless of what - * API was used to start the discovery. - * - * @param cb Callback struct. Must point to memory that remains valid. - */ -void bt_br_discovery_cb_register(struct bt_br_discovery_cb *cb); - -/** - * @brief Unregister discovery packet callbacks. - * - * Remove the callback structure from the list of discovery callbacks. - * - * @param cb Callback struct. Must point to memory that remains valid. - */ -void bt_br_discovery_cb_unregister(struct bt_br_discovery_cb *cb); - -struct bt_br_oob { - /** BR/EDR address. */ - bt_addr_t addr; -}; - -/** - * @brief Get BR/EDR local Out Of Band information - * - * This function allows to get local controller information that are useful - * for Out Of Band pairing or connection creation process. - * - * @param oob Out Of Band information - */ -int bt_br_oob_get_local(struct bt_br_oob *oob); - - -/** - * @brief Enable/disable set controller in discoverable state. - * - * Allows make local controller to listen on INQUIRY SCAN channel and responds - * to devices making general inquiry. To enable this state it's mandatory - * to first be in connectable state. - * - * @param enable Value allowing/disallowing controller to become discoverable. - * - * @return Negative if fail set to requested state or requested state has been - * already set. Zero if done successfully. - */ -int bt_br_set_discoverable(bool enable); - -/** - * @brief Enable/disable set controller in connectable state. - * - * Allows make local controller to be connectable. It means the controller - * start listen to devices requests on PAGE SCAN channel. If disabled also - * resets discoverability if was set. - * - * @param enable Value allowing/disallowing controller to be connectable. - * - * @return Negative if fail set to requested state or requested state has been - * already set. Zero if done successfully. - */ -int bt_br_set_connectable(bool enable); - /** * @brief Clear pairing information. * diff --git a/include/zephyr/bluetooth/classic/classic.h b/include/zephyr/bluetooth/classic/classic.h new file mode 100644 index 0000000000000..eaddcd23db899 --- /dev/null +++ b/include/zephyr/bluetooth/classic/classic.h @@ -0,0 +1,215 @@ +/** @file + * @brief Bluetooth subsystem classic core APIs. + */ + +/* + * Copyright (c) 2015-2016 Intel Corporation + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef ZEPHYR_INCLUDE_BLUETOOTH_CLASSIC_H_ +#define ZEPHYR_INCLUDE_BLUETOOTH_CLASSIC_H_ + +/** + * @brief Bluetooth APIs + * @defgroup bluetooth Bluetooth APIs + * @ingroup connectivity + * @{ + */ + +#include +#include + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Generic Access Profile (GAP) + * @defgroup bt_gap Generic Access Profile (GAP) + * @since 1.0 + * @version 1.0.0 + * @ingroup bluetooth + * @{ + */ + +/** @brief BR/EDR discovery result structure */ +struct bt_br_discovery_result { + /** private */ + uint8_t _priv[4]; + + /** Remote device address */ + bt_addr_t addr; + + /** RSSI from inquiry */ + int8_t rssi; + + /** Class of Device */ + uint8_t cod[3]; + + /** Extended Inquiry Response */ + uint8_t eir[240]; +}; + +/** + * @typedef bt_br_discovery_cb_t + * @brief Callback type for reporting BR/EDR discovery (inquiry) + * results. + * + * A callback of this type is given to the bt_br_discovery_start() + * function and will be called at the end of the discovery with + * information about found devices populated in the results array. + * + * @param results Storage used for discovery results + * @param count Number of valid discovery results. + */ +typedef void bt_br_discovery_cb_t(struct bt_br_discovery_result *results, + size_t count); + +/** BR/EDR discovery parameters */ +struct bt_br_discovery_param { + /** Maximum length of the discovery in units of 1.28 seconds. + * Valid range is 0x01 - 0x30. + */ + uint8_t length; + + /** True if limited discovery procedure is to be used. */ + bool limited; +}; + +/** + * @brief Start BR/EDR discovery + * + * Start BR/EDR discovery (inquiry) and provide results through the specified + * callback. When bt_br_discovery_cb_t is called it indicates that discovery + * has completed. If more inquiry results were received during session than + * fits in provided result storage, only ones with highest RSSI will be + * reported. + * + * @param param Discovery parameters. + * @param results Storage for discovery results. + * @param count Number of results in storage. Valid range: 1-255. + * @param cb Callback to notify discovery results. + * May be NULL if callback registration through + * @ref bt_br_discovery_cb_register is preferred. + * + * @return Zero on success or error code otherwise, positive in case + * of protocol error or negative (POSIX) in case of stack internal error + */ +int bt_br_discovery_start(const struct bt_br_discovery_param *param, + struct bt_br_discovery_result *results, size_t count, + bt_br_discovery_cb_t cb); + +/** + * @brief Stop BR/EDR discovery. + * + * Stops ongoing BR/EDR discovery. If discovery was stopped by this call + * results won't be reported + * + * @return Zero on success or error code otherwise, positive in case of + * protocol error or negative (POSIX) in case of stack internal error. + */ +int bt_br_discovery_stop(void); + +struct bt_br_discovery_cb { + + /** + * @brief An inquiry response received callback. + * + * @param result Storage used for discovery results + */ + void (*recv)(const struct bt_br_discovery_result *result); + + /** @brief The inquiry has stopped after discovery timeout. + * + * @param results Storage used for discovery results + * @param count Number of valid discovery results. + */ + void (*timeout)(const struct bt_br_discovery_result *results, + size_t count); + + sys_snode_t node; +}; + +/** + * @brief Register discovery packet callbacks. + * + * Adds the callback structure to the list of callback structures that monitors + * inquiry activity. + * + * This callback will be called for all inquiry activity, regardless of what + * API was used to start the discovery. + * + * @param cb Callback struct. Must point to memory that remains valid. + */ +void bt_br_discovery_cb_register(struct bt_br_discovery_cb *cb); + +/** + * @brief Unregister discovery packet callbacks. + * + * Remove the callback structure from the list of discovery callbacks. + * + * @param cb Callback struct. Must point to memory that remains valid. + */ +void bt_br_discovery_cb_unregister(struct bt_br_discovery_cb *cb); + +struct bt_br_oob { + /** BR/EDR address. */ + bt_addr_t addr; +}; + +/** + * @brief Get BR/EDR local Out Of Band information + * + * This function allows to get local controller information that are useful + * for Out Of Band pairing or connection creation process. + * + * @param oob Out Of Band information + */ +int bt_br_oob_get_local(struct bt_br_oob *oob); + +/** + * @brief Enable/disable set controller in discoverable state. + * + * Allows make local controller to listen on INQUIRY SCAN channel and responds + * to devices making general inquiry. To enable this state it's mandatory + * to first be in connectable state. + * + * @param enable Value allowing/disallowing controller to become discoverable. + * + * @return Negative if fail set to requested state or requested state has been + * already set. Zero if done successfully. + */ +int bt_br_set_discoverable(bool enable); + +/** + * @brief Enable/disable set controller in connectable state. + * + * Allows make local controller to be connectable. It means the controller + * start listen to devices requests on PAGE SCAN channel. If disabled also + * resets discoverability if was set. + * + * @param enable Value allowing/disallowing controller to be connectable. + * + * @return Negative if fail set to requested state or requested state has been + * already set. Zero if done successfully. + */ +int bt_br_set_connectable(bool enable); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +/** + * @} + */ + +#endif /* ZEPHYR_INCLUDE_BLUETOOTH_CLASSIC_H_ */ From f670e3a52fc13ff3091eab1c7c3d0139b2378913 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Tue, 23 Jul 2024 20:15:30 +0800 Subject: [PATCH 0128/4482] Bluetooth: Classic: Remove callback from bt_br_discovery_start Remove BR discovery callback from bt_br_discovery_start. All discovery results will be notified through callback registered by bt_br_discovery_cb_register. Signed-off-by: Lyle Zhu --- include/zephyr/bluetooth/classic/classic.h | 26 ++++------------------ subsys/bluetooth/host/classic/br.c | 15 +------------ 2 files changed, 5 insertions(+), 36 deletions(-) diff --git a/include/zephyr/bluetooth/classic/classic.h b/include/zephyr/bluetooth/classic/classic.h index eaddcd23db899..9ad0361803dbe 100644 --- a/include/zephyr/bluetooth/classic/classic.h +++ b/include/zephyr/bluetooth/classic/classic.h @@ -56,21 +56,6 @@ struct bt_br_discovery_result { uint8_t eir[240]; }; -/** - * @typedef bt_br_discovery_cb_t - * @brief Callback type for reporting BR/EDR discovery (inquiry) - * results. - * - * A callback of this type is given to the bt_br_discovery_start() - * function and will be called at the end of the discovery with - * information about found devices populated in the results array. - * - * @param results Storage used for discovery results - * @param count Number of valid discovery results. - */ -typedef void bt_br_discovery_cb_t(struct bt_br_discovery_result *results, - size_t count); - /** BR/EDR discovery parameters */ struct bt_br_discovery_param { /** Maximum length of the discovery in units of 1.28 seconds. @@ -86,24 +71,21 @@ struct bt_br_discovery_param { * @brief Start BR/EDR discovery * * Start BR/EDR discovery (inquiry) and provide results through the specified - * callback. When bt_br_discovery_cb_t is called it indicates that discovery - * has completed. If more inquiry results were received during session than + * callback. The discovery results will be notified through callbacks + * registered by @ref bt_br_discovery_cb_register. + * If more inquiry results were received during session than * fits in provided result storage, only ones with highest RSSI will be * reported. * * @param param Discovery parameters. * @param results Storage for discovery results. * @param count Number of results in storage. Valid range: 1-255. - * @param cb Callback to notify discovery results. - * May be NULL if callback registration through - * @ref bt_br_discovery_cb_register is preferred. * * @return Zero on success or error code otherwise, positive in case * of protocol error or negative (POSIX) in case of stack internal error */ int bt_br_discovery_start(const struct bt_br_discovery_param *param, - struct bt_br_discovery_result *results, size_t count, - bt_br_discovery_cb_t cb); + struct bt_br_discovery_result *results, size_t count); /** * @brief Stop BR/EDR discovery. diff --git a/subsys/bluetooth/host/classic/br.c b/subsys/bluetooth/host/classic/br.c index cf6536a96c366..97ee86f34de52 100644 --- a/subsys/bluetooth/host/classic/br.c +++ b/subsys/bluetooth/host/classic/br.c @@ -22,7 +22,6 @@ #include LOG_MODULE_REGISTER(bt_br); -static bt_br_discovery_cb_t *discovery_cb; struct bt_br_discovery_result *discovery_results; static size_t discovery_results_size; static size_t discovery_results_count; @@ -325,7 +324,6 @@ static bool eir_has_name(const uint8_t *eir) void bt_br_discovery_reset(void) { - discovery_cb = NULL; discovery_results = NULL; discovery_results_size = 0; discovery_results_count = 0; @@ -367,10 +365,6 @@ static void report_discovery_results(void) } } - if (discovery_cb) { - discovery_cb(discovery_results, discovery_results_count); - } - bt_br_discovery_reset(); } @@ -599,10 +593,6 @@ void bt_hci_remote_name_request_complete(struct net_buf *buf) listener->timeout(discovery_results, discovery_results_count); } } - - if (discovery_cb) { - discovery_cb(discovery_results, discovery_results_count); - } } void bt_hci_read_remote_features_complete(struct net_buf *buf) @@ -941,8 +931,7 @@ static bool valid_br_discov_param(const struct bt_br_discovery_param *param, siz } int bt_br_discovery_start(const struct bt_br_discovery_param *param, - struct bt_br_discovery_result *results, size_t cnt, - bt_br_discovery_cb_t cb) + struct bt_br_discovery_result *results, size_t cnt) { int err; @@ -965,7 +954,6 @@ int bt_br_discovery_start(const struct bt_br_discovery_param *param, (void)memset(results, 0, sizeof(*results) * cnt); - discovery_cb = cb; discovery_results = results; discovery_results_size = cnt; discovery_results_count = 0; @@ -1013,7 +1001,6 @@ int bt_br_discovery_stop(void) atomic_clear_bit(bt_dev.flags, BT_DEV_INQUIRY); - discovery_cb = NULL; discovery_results = NULL; discovery_results_size = 0; discovery_results_count = 0; From ac0ccc8f5f1eea3330dca46b1aa8c5dba08658b8 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Tue, 23 Jul 2024 20:28:06 +0800 Subject: [PATCH 0129/4482] sample: Bluetooth: hfp_ag: update device discovery Due to the update of function bt_br_discovery_start, register discovery callback by calling bt_br_discovery_cb_register. Signed-off-by: Lyle Zhu --- samples/bluetooth/handsfree_ag/src/main.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/samples/bluetooth/handsfree_ag/src/main.c b/samples/bluetooth/handsfree_ag/src/main.c index 5a0e8fe6cd099..84d118802717d 100644 --- a/samples/bluetooth/handsfree_ag/src/main.c +++ b/samples/bluetooth/handsfree_ag/src/main.c @@ -208,10 +208,15 @@ static struct bt_conn_cb conn_callbacks = { .security_changed = security_changed, }; -static void scan_discovery_cb(struct bt_br_discovery_result *results, size_t count) +static void discovery_recv_cb(const struct bt_br_discovery_result *result) +{ + (void)result; +} + +static void discovery_timeout_cb(const struct bt_br_discovery_result *results, size_t count) { char addr[BT_ADDR_LE_STR_LEN]; - uint8_t *eir; + const uint8_t *eir; bool cod_hf = false; static uint8_t temp[240]; size_t len = sizeof(results->eir); @@ -275,7 +280,7 @@ static void discover_work_handler(struct k_work *work) br_discover.limited = false; err = bt_br_discovery_start(&br_discover, scan_result, - CONFIG_BT_HFP_AG_DISCOVER_RESULT_COUNT, scan_discovery_cb); + CONFIG_BT_HFP_AG_DISCOVER_RESULT_COUNT); if (err) { printk("Fail to start discovery (err %d)\n", err); return; @@ -344,6 +349,11 @@ static void call_remote_accept_work_handler(struct k_work *work) } } +static struct bt_br_discovery_cb discovery_cb = { + .recv = discovery_recv_cb, + .timeout = discovery_timeout_cb, +}; + static void bt_ready(int err) { if (err) { @@ -359,6 +369,8 @@ static void bt_ready(int err) bt_conn_cb_register(&conn_callbacks); + bt_br_discovery_cb_register(&discovery_cb); + bt_hfp_ag_register(&ag_cb); k_work_init(&discover_work, discover_work_handler); From d92bc8ab306b55e07e0e9624f5343a948fe1c2f3 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Wed, 24 Jul 2024 09:10:30 +0800 Subject: [PATCH 0130/4482] Bluetooth: shell: BR: update device discovery Due to the update of function bt_br_discovery_start, register discovery callback by calling bt_br_discovery_cb_register. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/shell/bredr.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/host/classic/shell/bredr.c b/subsys/bluetooth/host/classic/shell/bredr.c index d2ec1e983506c..c21c726cb147a 100644 --- a/subsys/bluetooth/host/classic/shell/bredr.c +++ b/subsys/bluetooth/host/classic/shell/bredr.c @@ -151,7 +151,7 @@ static void br_device_found(const bt_addr_t *addr, int8_t rssi, static struct bt_br_discovery_result br_discovery_results[5]; -static void br_discovery_complete(struct bt_br_discovery_result *results, +static void br_discovery_complete(const struct bt_br_discovery_result *results, size_t count) { size_t i; @@ -164,12 +164,18 @@ static void br_discovery_complete(struct bt_br_discovery_result *results, } } +static struct bt_br_discovery_cb discovery_cb = { + .recv = NULL, + .timeout = br_discovery_complete, +}; + static int cmd_discovery(const struct shell *sh, size_t argc, char *argv[]) { const char *action; action = argv[1]; if (!strcmp(action, "on")) { + static bool reg_cb = true; struct bt_br_discovery_param param; param.limited = false; @@ -183,9 +189,13 @@ static int cmd_discovery(const struct shell *sh, size_t argc, char *argv[]) param.limited = true; } + if (reg_cb) { + reg_cb = false; + bt_br_discovery_cb_register(&discovery_cb); + } + if (bt_br_discovery_start(¶m, br_discovery_results, - ARRAY_SIZE(br_discovery_results), - br_discovery_complete) < 0) { + ARRAY_SIZE(br_discovery_results)) < 0) { shell_print(sh, "Failed to start discovery"); return 0; } From b1dc7ff24236874a9dd3103f86a40430926d18ce Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Fri, 20 Sep 2024 18:16:45 +0800 Subject: [PATCH 0131/4482] Bluetooth: BR: Optimize _priv of struct bt_br_discovery_result Move `struct discovery_priv` to classic.h Rename `struct discovery_priv` to `struct bt_br_discovery_priv`. Modify the structure `struct bt_br_discovery_priv` with `@private`. Change field `_priv` of `struct bt_br_discovery_result` from `uint8_t _priv[4]` to `struct bt_br_discovery_priv _priv`. Signed-off-by: Lyle Zhu --- include/zephyr/bluetooth/classic/classic.h | 17 ++++++++++-- subsys/bluetooth/host/classic/br.c | 30 +++++++++------------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/include/zephyr/bluetooth/classic/classic.h b/include/zephyr/bluetooth/classic/classic.h index 9ad0361803dbe..ce85b62603b17 100644 --- a/include/zephyr/bluetooth/classic/classic.h +++ b/include/zephyr/bluetooth/classic/classic.h @@ -38,10 +38,23 @@ extern "C" { * @{ */ +/** + * @private + * @brief BR/EDR discovery private structure + */ +struct bt_br_discovery_priv { + /** Clock offset */ + uint16_t clock_offset; + /** Page scan repetition mode */ + uint8_t pscan_rep_mode; + /** Resolving remote name*/ + uint8_t resolving; +}; + /** @brief BR/EDR discovery result structure */ struct bt_br_discovery_result { - /** private */ - uint8_t _priv[4]; + /** Private data */ + struct bt_br_discovery_priv _priv; /** Remote device address */ bt_addr_t addr; diff --git a/subsys/bluetooth/host/classic/br.c b/subsys/bluetooth/host/classic/br.c index 97ee86f34de52..f0ffa6031ecfb 100644 --- a/subsys/bluetooth/host/classic/br.c +++ b/subsys/bluetooth/host/classic/br.c @@ -255,12 +255,6 @@ void bt_hci_conn_complete(struct net_buf *buf) bt_hci_cmd_send_sync(BT_HCI_OP_READ_REMOTE_FEATURES, buf, NULL); } -struct discovery_priv { - uint16_t clock_offset; - uint8_t pscan_rep_mode; - uint8_t resolving; -} __packed; - static int request_name(const bt_addr_t *addr, uint8_t pscan, uint16_t offset) { struct bt_hci_cp_remote_name_request *cp; @@ -336,9 +330,9 @@ static void report_discovery_results(void) struct bt_br_discovery_cb *listener, *next; for (i = 0; i < discovery_results_count; i++) { - struct discovery_priv *priv; + struct bt_br_discovery_priv *priv; - priv = (struct discovery_priv *)&discovery_results[i]._priv; + priv = &discovery_results[i]._priv; if (eir_has_name(discovery_results[i].eir)) { continue; @@ -439,7 +433,7 @@ void bt_hci_inquiry_result_with_rssi(struct net_buf *buf) while (num_reports--) { struct bt_hci_evt_inquiry_result_with_rssi *evt; struct bt_br_discovery_result *result; - struct discovery_priv *priv; + struct bt_br_discovery_priv *priv; struct bt_br_discovery_cb *listener, *next; if (buf->len < sizeof(*evt)) { @@ -455,7 +449,7 @@ void bt_hci_inquiry_result_with_rssi(struct net_buf *buf) return; } - priv = (struct discovery_priv *)&result->_priv; + priv = &result->_priv; priv->pscan_rep_mode = evt->pscan_rep_mode; priv->clock_offset = evt->clock_offset; @@ -477,7 +471,7 @@ void bt_hci_extended_inquiry_result(struct net_buf *buf) { struct bt_hci_evt_extended_inquiry_result *evt = (void *)buf->data; struct bt_br_discovery_result *result; - struct discovery_priv *priv; + struct bt_br_discovery_priv *priv; struct bt_br_discovery_cb *listener, *next; if (!atomic_test_bit(bt_dev.flags, BT_DEV_INQUIRY)) { @@ -491,7 +485,7 @@ void bt_hci_extended_inquiry_result(struct net_buf *buf) return; } - priv = (struct discovery_priv *)&result->_priv; + priv = &result->_priv; priv->pscan_rep_mode = evt->pscan_rep_mode; priv->clock_offset = evt->clock_offset; @@ -510,7 +504,7 @@ void bt_hci_remote_name_request_complete(struct net_buf *buf) { struct bt_hci_evt_remote_name_req_complete *evt = (void *)buf->data; struct bt_br_discovery_result *result; - struct discovery_priv *priv; + struct bt_br_discovery_priv *priv; int eir_len = 240; uint8_t *eir; int i; @@ -521,7 +515,7 @@ void bt_hci_remote_name_request_complete(struct net_buf *buf) return; } - priv = (struct discovery_priv *)&result->_priv; + priv = &result->_priv; priv->resolving = 0U; if (evt->status) { @@ -576,9 +570,9 @@ void bt_hci_remote_name_request_complete(struct net_buf *buf) check_names: /* if still waiting for names */ for (i = 0; i < discovery_results_count; i++) { - struct discovery_priv *dpriv; + struct bt_br_discovery_priv *dpriv; - dpriv = (struct discovery_priv *)&discovery_results[i]._priv; + dpriv = &discovery_results[i]._priv; if (dpriv->resolving) { return; @@ -978,11 +972,11 @@ int bt_br_discovery_stop(void) } for (i = 0; i < discovery_results_count; i++) { - struct discovery_priv *priv; + struct bt_br_discovery_priv *priv; struct bt_hci_cp_remote_name_cancel *cp; struct net_buf *buf; - priv = (struct discovery_priv *)&discovery_results[i]._priv; + priv = &discovery_results[i]._priv; if (!priv->resolving) { continue; From 832753b80caeb12f4baa7bc237fa60202faed5a9 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Thu, 26 Sep 2024 10:16:39 +0800 Subject: [PATCH 0132/4482] Bluetooth: BR: Change the type of `resolving` to `bool` The `resolving` is used to flag the status that the stack is requesting remote device name. It is better to use the type `bool` instead of the original type `uint8_t`. Signed-off-by: Lyle Zhu --- include/zephyr/bluetooth/classic/classic.h | 2 +- subsys/bluetooth/host/classic/br.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/zephyr/bluetooth/classic/classic.h b/include/zephyr/bluetooth/classic/classic.h index ce85b62603b17..be7cf8dc404e8 100644 --- a/include/zephyr/bluetooth/classic/classic.h +++ b/include/zephyr/bluetooth/classic/classic.h @@ -48,7 +48,7 @@ struct bt_br_discovery_priv { /** Page scan repetition mode */ uint8_t pscan_rep_mode; /** Resolving remote name*/ - uint8_t resolving; + bool resolving; }; /** @brief BR/EDR discovery result structure */ diff --git a/subsys/bluetooth/host/classic/br.c b/subsys/bluetooth/host/classic/br.c index f0ffa6031ecfb..b7f885551fa41 100644 --- a/subsys/bluetooth/host/classic/br.c +++ b/subsys/bluetooth/host/classic/br.c @@ -343,7 +343,7 @@ static void report_discovery_results(void) continue; } - priv->resolving = 1U; + priv->resolving = true; resolving_names = true; } @@ -516,7 +516,7 @@ void bt_hci_remote_name_request_complete(struct net_buf *buf) } priv = &result->_priv; - priv->resolving = 0U; + priv->resolving = false; if (evt->status) { goto check_names; From 773d50e072cbcf40558e5d8da11739381605a871 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Wed, 18 Sep 2024 19:47:27 +0900 Subject: [PATCH 0133/4482] drivers: sensor: mc3419: Change the TRIGGER config to a typical Because MC3419's TRIGGER's Kconfig was different from the typical configuration, the `build_all` test settings were not correctly applied. The Kconfig configuration has been revised to be set in conjunction with MC3419_TRIGGER_OWN_THREAD, even if MC3419_TRIGGER is not explicitly specified. Signed-off-by: TOKITA Hiroshi --- drivers/sensor/memsic/mc3419/Kconfig | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/sensor/memsic/mc3419/Kconfig b/drivers/sensor/memsic/mc3419/Kconfig index 5332e8c61ec19..a076e9d82482b 100644 --- a/drivers/sensor/memsic/mc3419/Kconfig +++ b/drivers/sensor/memsic/mc3419/Kconfig @@ -15,14 +15,26 @@ if MC3419 config MC3419_TRIGGER bool "Trigger mode" -if MC3419_TRIGGER +choice MC3419_TRIGGER_MODE + prompt "Trigger mode" + default MC3419_TRIGGER_NONE + help + Specify the type of triggering to be used by the driver. + +config MC3419_TRIGGER_NONE + bool "No trigger" config MC3419_TRIGGER_OWN_THREAD bool "Use own thread" + select MC3419_TRIGGER help Enable trigger to run in own thread. By default it is global thread mode. +endchoice # MC3419_TRIGGER_MODE + +if MC3419_TRIGGER + config MC3419_THREAD_PRIORITY int "Own thread priority" depends on MC3419_TRIGGER_OWN_THREAD From e5a41c8964c3628659450befe1422e6bc36ae560 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Wed, 18 Sep 2024 19:54:14 +0900 Subject: [PATCH 0134/4482] tests: drivers: build_all: sensor: Add CONFIG_MC3419_TRIGGER_NONE Add missing CONFIG_MC3419_TRIGGER_NONE=y Signed-off-by: TOKITA Hiroshi --- tests/drivers/build_all/sensor/sensors_trigger_none.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/drivers/build_all/sensor/sensors_trigger_none.conf b/tests/drivers/build_all/sensor/sensors_trigger_none.conf index 9442e13ed6d13..8db789f0ce344 100644 --- a/tests/drivers/build_all/sensor/sensors_trigger_none.conf +++ b/tests/drivers/build_all/sensor/sensors_trigger_none.conf @@ -50,6 +50,7 @@ CONFIG_LSM6DSL_TRIGGER_NONE=y CONFIG_LSM6DSO_TRIGGER_NONE=y CONFIG_LSM6DSO16IS_TRIGGER_NONE=y CONFIG_LSM6DSV16X_TRIGGER_NONE=y +CONFIG_MC3419_TRIGGER_NONE=y CONFIG_MPU6050_TRIGGER_NONE=y CONFIG_MPU9250_TRIGGER_NONE=y CONFIG_SHT3XD_TRIGGER_NONE=y From 1005a7352387e3fae783f1b458a99dbe91d69035 Mon Sep 17 00:00:00 2001 From: Andrej Butok Date: Fri, 20 Sep 2024 10:45:22 +0200 Subject: [PATCH 0135/4482] boards: nxp: rd_rw612_bga: Delete fw_storage - Delete unused fw_storage partition. - Optimize mcuboot partitions. Signed-off-by: Andrej Butok --- boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi | 24 +++++++---------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi b/boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi index ace4c03c56ca3..4926cfef5ccbb 100644 --- a/boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi +++ b/boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi @@ -144,30 +144,20 @@ arduino_i2c: &flexcomm2 { label = "mcuboot"; reg = <0x00000000 DT_SIZE_K(128)>; }; - /* Note slot 0 has one additional sector, - * this is intended for use with the swap move algorithm + /* The MCUBoot swap-move algorithm uses the last 2 sectors + * of the primary slot0 for swap status and move. */ slot0_partition: partition@20000 { label = "image-0"; - reg = <0x00020000 0x3e0000>; + reg = <0x00020000 (DT_SIZE_M(3) + DT_SIZE_K(2 * 4))>; }; - - /* This partition is reserved for connectivity firmwares storage - * and shouldn't be moved. - */ - fw_storage: partition@400000 { - label = "fw_storage"; - reg = <0x400000 0x280000>; - read-only; - }; - - slot1_partition: partition@680000 { + slot1_partition: partition@323000 { label = "image-1"; - reg = <0x680000 0x3e0000>; + reg = <0x00323000 DT_SIZE_M(3)>; }; - storage_partition: partition@a60000 { + storage_partition: partition@623000 { label = "storage"; - reg = <0xa60000 0x35a0000>; + reg = <0x00623000 (DT_SIZE_M(58) - DT_SIZE_K(136))>; }; }; }; From 08ceb14299c921000705710917102c17d327f8ed Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Thu, 16 May 2024 15:29:35 +0800 Subject: [PATCH 0136/4482] Bluetooth: Host: SSP: Correct BR bonding type Currently, the bonding type of Authentication _Requirements parameter is always `Dedicated Bonding` if the device is pairing initiator. But if the bonding is performed during connection setup or channel establishment as a precursor to accessing a service, the bonding type should be `General bonding`. Add a flag BT_CONN_BR_GENERAL_BONDING. Set the flag if the bonding is performed in the L2CAP_BR/RFCOMM channel establishment. Set bonding type depends on the flag when receiving IO cap request. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/l2cap_br.c | 7 +++++++ subsys/bluetooth/host/classic/rfcomm.c | 7 +++++++ subsys/bluetooth/host/classic/ssp.c | 12 ++++++++++-- subsys/bluetooth/host/conn.c | 1 + subsys/bluetooth/host/conn_internal.h | 1 + 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/classic/l2cap_br.c b/subsys/bluetooth/host/classic/l2cap_br.c index 523cce4600b54..4c1461c7f04aa 100644 --- a/subsys/bluetooth/host/classic/l2cap_br.c +++ b/subsys/bluetooth/host/classic/l2cap_br.c @@ -786,6 +786,13 @@ l2cap_br_conn_security(struct bt_l2cap_chan *chan, const uint16_t psm) * since service/profile requires that. */ if (check == 0) { + /* + * General Bonding refers to the process of performing bonding + * during connection setup or channel establishment procedures + * as a precursor to accessing a service. + * For current case, it is dedicated bonding. + */ + atomic_set_bit(chan->conn->flags, BT_CONN_BR_GENERAL_BONDING); return L2CAP_CONN_SECURITY_PENDING; } diff --git a/subsys/bluetooth/host/classic/rfcomm.c b/subsys/bluetooth/host/classic/rfcomm.c index 21ccba25e7efc..f8742bff3678a 100644 --- a/subsys/bluetooth/host/classic/rfcomm.c +++ b/subsys/bluetooth/host/classic/rfcomm.c @@ -829,6 +829,13 @@ static enum security_result rfcomm_dlc_security(struct bt_rfcomm_dlc *dlc) } if (!bt_conn_set_security(conn, dlc->required_sec_level)) { + /* + * General Bonding refers to the process of performing bonding + * during connection setup or channel establishment procedures + * as a precursor to accessing a service. + * For current case, it is dedicated bonding. + */ + atomic_set_bit(conn->flags, BT_CONN_BR_GENERAL_BONDING); /* If Security elevation is initiated or in progress */ return RFCOMM_SECURITY_PENDING; } diff --git a/subsys/bluetooth/host/classic/ssp.c b/subsys/bluetooth/host/classic/ssp.c index 72ac72624a76a..41a42f829f334 100644 --- a/subsys/bluetooth/host/classic/ssp.c +++ b/subsys/bluetooth/host/classic/ssp.c @@ -666,9 +666,17 @@ void bt_hci_io_capa_req(struct net_buf *buf) */ if (atomic_test_bit(conn->flags, BT_CONN_BR_PAIRING_INITIATOR)) { if (get_io_capa() != BT_IO_NO_INPUT_OUTPUT) { - auth = BT_HCI_DEDICATED_BONDING_MITM; + if (atomic_test_bit(conn->flags, BT_CONN_BR_GENERAL_BONDING)) { + auth = BT_HCI_GENERAL_BONDING_MITM; + } else { + auth = BT_HCI_DEDICATED_BONDING_MITM; + } } else { - auth = BT_HCI_DEDICATED_BONDING; + if (atomic_test_bit(conn->flags, BT_CONN_BR_GENERAL_BONDING)) { + auth = BT_HCI_GENERAL_BONDING; + } else { + auth = BT_HCI_DEDICATED_BONDING; + } } } else { auth = ssp_get_auth(conn); diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 5bb310e07fab0..a8b1282ea959d 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -2612,6 +2612,7 @@ static void reset_pairing(struct bt_conn *conn) atomic_clear_bit(conn->flags, BT_CONN_BR_PAIRING); atomic_clear_bit(conn->flags, BT_CONN_BR_PAIRING_INITIATOR); atomic_clear_bit(conn->flags, BT_CONN_BR_LEGACY_SECURE); + atomic_clear_bit(conn->flags, BT_CONN_BR_GENERAL_BONDING); } #endif /* CONFIG_BT_CLASSIC */ diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h index 0c334bc7cbe80..a7b9bec7eec6f 100644 --- a/subsys/bluetooth/host/conn_internal.h +++ b/subsys/bluetooth/host/conn_internal.h @@ -60,6 +60,7 @@ enum { BT_CONN_USER, /* user I/O when pairing */ BT_CONN_BR_PAIRING, /* BR connection in pairing context */ BT_CONN_BR_NOBOND, /* SSP no bond pairing tracker */ + BT_CONN_BR_GENERAL_BONDING, /* BR general bonding */ BT_CONN_BR_PAIRING_INITIATOR, /* local host starts authentication */ BT_CONN_CLEANUP, /* Disconnected, pending cleanup */ BT_CONN_AUTO_INIT_PROCEDURES_DONE, /* Auto-initiated procedures have run */ From cb6417cff4955319df02bcf6ff9fbe0cb53d1ca7 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Mon, 23 Sep 2024 13:42:10 +0800 Subject: [PATCH 0137/4482] irq: multilevel: fix `irq_parent_level_3()` The IRQ for level 1 and above is incremented by 1 when encoded with Zephyr's multilevel IRQ scheme, so it should be decremented by 1. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- include/zephyr/irq_multilevel.h | 5 +++-- tests/kernel/gen_isr_table/src/main.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/zephyr/irq_multilevel.h b/include/zephyr/irq_multilevel.h index 3dbb58f374d74..6d24be83668cf 100644 --- a/include/zephyr/irq_multilevel.h +++ b/include/zephyr/irq_multilevel.h @@ -163,8 +163,9 @@ static inline unsigned int irq_to_level_3(unsigned int irq) */ static inline unsigned int irq_parent_level_3(unsigned int irq) { - return (irq >> CONFIG_1ST_LEVEL_INTERRUPT_BITS) & - BIT_MASK(CONFIG_2ND_LEVEL_INTERRUPT_BITS); + return ((irq >> CONFIG_1ST_LEVEL_INTERRUPT_BITS) & + BIT_MASK(CONFIG_2ND_LEVEL_INTERRUPT_BITS)) - + 1; } /** diff --git a/tests/kernel/gen_isr_table/src/main.c b/tests/kernel/gen_isr_table/src/main.c index 492bca186bf0a..cc9d94867ce83 100644 --- a/tests/kernel/gen_isr_table/src/main.c +++ b/tests/kernel/gen_isr_table/src/main.c @@ -437,8 +437,8 @@ static void test_multi_level_bit_masks_fn(uint32_t irq1, uint32_t irq2, uint32_t zassert_equal(hwirq3, irq_from_level(irqn, 3)); zassert_equal((hwirq3 + 1) << l3_shift, irq_to_level_3(hwirq3)); zassert_equal((hwirq3 + 1) << l3_shift, irq_to_level(hwirq3, 3)); - zassert_equal(hwirq2 + 1, irq_parent_level_3(irqn)); - zassert_equal(hwirq2 + 1, irq_parent_level(irqn, 3)); + zassert_equal(hwirq2, irq_parent_level_3(irqn)); + zassert_equal(hwirq2, irq_parent_level(irqn, 3)); } if (has_l3) { From 3fa7d783d659a388c71c6c69b5f0814bf168dce0 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Mon, 23 Sep 2024 14:07:18 +0800 Subject: [PATCH 0138/4482] irq: multilevel: allow to APIs to always work When `CONFIG_MULTI_LEVEL_INTERRUPTS` is enabled, bits in a `uint32_t` is always partitioned into 3 levels, we can safely remove the `CONFIG_*_LEVEL_INTERRUPTS` checks so that the APIs always works. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- include/zephyr/irq_multilevel.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/include/zephyr/irq_multilevel.h b/include/zephyr/irq_multilevel.h index 6d24be83668cf..587844f6d69f0 100644 --- a/include/zephyr/irq_multilevel.h +++ b/include/zephyr/irq_multilevel.h @@ -36,11 +36,11 @@ static inline unsigned int irq_get_level(unsigned int irq) const uint32_t mask3 = BIT_MASK(CONFIG_3RD_LEVEL_INTERRUPT_BITS) << (CONFIG_1ST_LEVEL_INTERRUPT_BITS + CONFIG_2ND_LEVEL_INTERRUPT_BITS); - if (IS_ENABLED(CONFIG_3RD_LEVEL_INTERRUPTS) && (irq & mask3) != 0) { + if ((irq & mask3) != 0) { return 3; } - if (IS_ENABLED(CONFIG_2ND_LEVEL_INTERRUPTS) && (irq & mask2) != 0) { + if ((irq & mask2) != 0) { return 2; } @@ -59,7 +59,9 @@ static inline unsigned int irq_get_level(unsigned int irq) */ static inline unsigned int irq_from_level_2(unsigned int irq) { - if (IS_ENABLED(CONFIG_3RD_LEVEL_INTERRUPTS)) { + unsigned int level = irq_get_level(irq); + + if (level == 3) { return ((irq >> CONFIG_1ST_LEVEL_INTERRUPT_BITS) & BIT_MASK(CONFIG_2ND_LEVEL_INTERRUPT_BITS)) - 1; } else { @@ -249,10 +251,14 @@ static inline unsigned int irq_get_intc_irq(unsigned int irq) { const unsigned int level = irq_get_level(irq); - __ASSERT_NO_MSG(level > 1 && level <= 3); - - return irq & BIT_MASK(CONFIG_1ST_LEVEL_INTERRUPT_BITS + - (level == 3 ? CONFIG_2ND_LEVEL_INTERRUPT_BITS : 0)); + if (level == 3) { + return irq & + BIT_MASK(CONFIG_1ST_LEVEL_INTERRUPT_BITS + CONFIG_2ND_LEVEL_INTERRUPT_BITS); + } else if (level == 2) { + return irq & BIT_MASK(CONFIG_1ST_LEVEL_INTERRUPT_BITS); + } else { + return irq; + } } #endif /* CONFIG_MULTI_LEVEL_INTERRUPTS */ From d05c9e6037fddf438f2012067cc9345f4206e832 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Mon, 23 Sep 2024 14:13:15 +0800 Subject: [PATCH 0139/4482] tests: gen_isr_table: move multilevel test into a separate file The multilevel IRQ APIs tests are currently cordoned off by `CONFIG_MULTI_LEVEL_INTERRUPTS` compiler switch, do this more cleanly by moving it to another file and use cmake for that instead. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- tests/kernel/gen_isr_table/CMakeLists.txt | 6 +- tests/kernel/gen_isr_table/src/main.c | 120 ----------------- .../kernel/gen_isr_table/src/multilevel_irq.c | 127 ++++++++++++++++++ 3 files changed, 132 insertions(+), 121 deletions(-) create mode 100644 tests/kernel/gen_isr_table/src/multilevel_irq.c diff --git a/tests/kernel/gen_isr_table/CMakeLists.txt b/tests/kernel/gen_isr_table/CMakeLists.txt index 9bb0ffd574d07..8e26d28c835d6 100644 --- a/tests/kernel/gen_isr_table/CMakeLists.txt +++ b/tests/kernel/gen_isr_table/CMakeLists.txt @@ -4,5 +4,9 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(gen_isr_table) -FILE(GLOB app_sources src/*.c) +FILE(GLOB app_sources src/main.c) + target_sources(app PRIVATE ${app_sources}) +target_sources_ifdef(CONFIG_MULTI_LEVEL_INTERRUPTS app PRIVATE + src/multilevel_irq.c +) diff --git a/tests/kernel/gen_isr_table/src/main.c b/tests/kernel/gen_isr_table/src/main.c index cc9d94867ce83..82683f6836379 100644 --- a/tests/kernel/gen_isr_table/src/main.c +++ b/tests/kernel/gen_isr_table/src/main.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -406,123 +405,4 @@ static void *gen_isr_table_setup(void) return NULL; } -#ifdef CONFIG_MULTI_LEVEL_INTERRUPTS -static void test_multi_level_bit_masks_fn(uint32_t irq1, uint32_t irq2, uint32_t irq3) -{ - const uint32_t l2_shift = CONFIG_1ST_LEVEL_INTERRUPT_BITS; - const uint32_t l3_shift = CONFIG_1ST_LEVEL_INTERRUPT_BITS + CONFIG_2ND_LEVEL_INTERRUPT_BITS; - const uint32_t hwirq1 = irq1; - const uint32_t hwirq2 = irq2 - 1; - const uint32_t hwirq3 = irq3 - 1; - const bool has_l3 = irq3 > 0; - const bool has_l2 = irq2 > 0; - const uint32_t level = has_l3 ? 3 : has_l2 ? 2 : 1; - const uint32_t irqn_l1 = irq1; - const uint32_t irqn_l2 = (irq2 << l2_shift) | irqn_l1; - const uint32_t irqn = (irq3 << l3_shift) | irqn_l2; - - zassert_equal(level, irq_get_level(irqn)); - - if (has_l2) { - zassert_equal(hwirq2, irq_from_level_2(irqn)); - zassert_equal(hwirq2, irq_from_level(irqn, 2)); - zassert_equal((hwirq2 + 1) << l2_shift, irq_to_level_2(hwirq2)); - zassert_equal((hwirq2 + 1) << l2_shift, irq_to_level(hwirq2, 2)); - zassert_equal(hwirq1, irq_parent_level_2(irqn)); - zassert_equal(hwirq1, irq_parent_level(irqn, 2)); - } - - if (has_l3) { - zassert_equal(hwirq3, irq_from_level_3(irqn)); - zassert_equal(hwirq3, irq_from_level(irqn, 3)); - zassert_equal((hwirq3 + 1) << l3_shift, irq_to_level_3(hwirq3)); - zassert_equal((hwirq3 + 1) << l3_shift, irq_to_level(hwirq3, 3)); - zassert_equal(hwirq2, irq_parent_level_3(irqn)); - zassert_equal(hwirq2, irq_parent_level(irqn, 3)); - } - - if (has_l3) { - zassert_equal(irqn_l2, irq_get_intc_irq(irqn)); - } else if (has_l2) { - zassert_equal(irqn_l1, irq_get_intc_irq(irqn)); - } else { - /* degenerate cases */ - if (false) { - zassert_equal(irqn, irq_get_intc_irq(irqn)); - } - } -} - -ZTEST(gen_isr_table, test_multi_level_bit_masks_l1) -{ - uint32_t irq1; - - /* First IRQ of level 1 */ - irq1 = 0; - test_multi_level_bit_masks_fn(irq1, 0, 0); - - /* Somewhere in-between */ - irq1 = BIT_MASK(CONFIG_1ST_LEVEL_INTERRUPT_BITS) >> 1; - test_multi_level_bit_masks_fn(irq1, 0, 0); - - /* Last IRQ of level 1 */ - irq1 = BIT_MASK(CONFIG_1ST_LEVEL_INTERRUPT_BITS); - test_multi_level_bit_masks_fn(irq1, 0, 0); -} - -ZTEST(gen_isr_table, test_multi_level_bit_masks_l2) -{ - if (!IS_ENABLED(CONFIG_2ND_LEVEL_INTERRUPTS)) { - ztest_test_skip(); - } - - uint32_t irq1, irq2; - - /* First IRQ of level 2 */ - irq1 = 0; - /* First irq of level 2 and onwards is 1, as 0 means that the irq is not present */ - irq2 = 1; - test_multi_level_bit_masks_fn(irq1, irq2, 0); - - /* Somewhere in-between */ - irq1 = BIT_MASK(CONFIG_1ST_LEVEL_INTERRUPT_BITS) >> 1; - irq2 = BIT_MASK(CONFIG_2ND_LEVEL_INTERRUPT_BITS) >> 1; - test_multi_level_bit_masks_fn(irq1, irq2, 0); - - /* Last IRQ of level 2 */ - irq1 = BIT_MASK(CONFIG_1ST_LEVEL_INTERRUPT_BITS); - irq2 = BIT_MASK(CONFIG_2ND_LEVEL_INTERRUPT_BITS); - test_multi_level_bit_masks_fn(irq1, irq2, 0); -} - -ZTEST(gen_isr_table, test_multi_level_bit_masks_l3) -{ - if (!IS_ENABLED(CONFIG_3RD_LEVEL_INTERRUPTS)) { - ztest_test_skip(); - } - - uint32_t irq1, irq2, irq3; - - /* First IRQ of level 3 */ - irq1 = 0; - /* First irq of level 2 and onwards is 1, as 0 means that the irq is not present */ - irq2 = 1; - irq3 = 1; - test_multi_level_bit_masks_fn(irq1, irq2, irq3); - - /* Somewhere in-between */ - irq1 = BIT_MASK(CONFIG_1ST_LEVEL_INTERRUPT_BITS) >> 1; - irq2 = BIT_MASK(CONFIG_2ND_LEVEL_INTERRUPT_BITS) >> 1; - irq3 = BIT_MASK(CONFIG_3RD_LEVEL_INTERRUPT_BITS) >> 1; - test_multi_level_bit_masks_fn(irq1, irq2, irq3); - - /* Last IRQ of level 3 */ - irq1 = BIT_MASK(CONFIG_1ST_LEVEL_INTERRUPT_BITS); - irq2 = BIT_MASK(CONFIG_2ND_LEVEL_INTERRUPT_BITS); - irq3 = BIT_MASK(CONFIG_3RD_LEVEL_INTERRUPT_BITS); - test_multi_level_bit_masks_fn(irq1, irq2, irq3); -} - -#endif /* CONFIG_MULTI_LEVEL_INTERRUPTS */ - ZTEST_SUITE(gen_isr_table, NULL, gen_isr_table_setup, NULL, NULL, NULL); diff --git a/tests/kernel/gen_isr_table/src/multilevel_irq.c b/tests/kernel/gen_isr_table/src/multilevel_irq.c new file mode 100644 index 0000000000000..873b3d0a35938 --- /dev/null +++ b/tests/kernel/gen_isr_table/src/multilevel_irq.c @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2024 Meta Platforms + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +static void test_multi_level_bit_masks_fn(uint32_t irq1, uint32_t irq2, uint32_t irq3) +{ + const uint32_t l2_shift = CONFIG_1ST_LEVEL_INTERRUPT_BITS; + const uint32_t l3_shift = CONFIG_1ST_LEVEL_INTERRUPT_BITS + CONFIG_2ND_LEVEL_INTERRUPT_BITS; + const uint32_t hwirq1 = irq1; + const uint32_t hwirq2 = irq2 - 1; + const uint32_t hwirq3 = irq3 - 1; + const bool has_l3 = irq3 > 0; + const bool has_l2 = irq2 > 0; + const uint32_t level = has_l3 ? 3 : has_l2 ? 2 : 1; + const uint32_t irqn_l1 = irq1; + const uint32_t irqn_l2 = (irq2 << l2_shift) | irqn_l1; + const uint32_t irqn = (irq3 << l3_shift) | irqn_l2; + + zassert_equal(level, irq_get_level(irqn)); + + if (has_l2) { + zassert_equal(hwirq2, irq_from_level_2(irqn)); + zassert_equal(hwirq2, irq_from_level(irqn, 2)); + zassert_equal((hwirq2 + 1) << l2_shift, irq_to_level_2(hwirq2)); + zassert_equal((hwirq2 + 1) << l2_shift, irq_to_level(hwirq2, 2)); + zassert_equal(hwirq1, irq_parent_level_2(irqn)); + zassert_equal(hwirq1, irq_parent_level(irqn, 2)); + } + + if (has_l3) { + zassert_equal(hwirq3, irq_from_level_3(irqn)); + zassert_equal(hwirq3, irq_from_level(irqn, 3)); + zassert_equal((hwirq3 + 1) << l3_shift, irq_to_level_3(hwirq3)); + zassert_equal((hwirq3 + 1) << l3_shift, irq_to_level(hwirq3, 3)); + zassert_equal(hwirq2, irq_parent_level_3(irqn)); + zassert_equal(hwirq2, irq_parent_level(irqn, 3)); + } + + if (has_l3) { + zassert_equal(irqn_l2, irq_get_intc_irq(irqn)); + } else if (has_l2) { + zassert_equal(irqn_l1, irq_get_intc_irq(irqn)); + } else { + /* degenerate cases */ + if (false) { + zassert_equal(irqn, irq_get_intc_irq(irqn)); + } + } +} + +ZTEST(gen_isr_table_multilevel, test_multi_level_bit_masks_l1) +{ + uint32_t irq1; + + /* First IRQ of level 1 */ + irq1 = 0; + test_multi_level_bit_masks_fn(irq1, 0, 0); + + /* Somewhere in-between */ + irq1 = BIT_MASK(CONFIG_1ST_LEVEL_INTERRUPT_BITS) >> 1; + test_multi_level_bit_masks_fn(irq1, 0, 0); + + /* Last IRQ of level 1 */ + irq1 = BIT_MASK(CONFIG_1ST_LEVEL_INTERRUPT_BITS); + test_multi_level_bit_masks_fn(irq1, 0, 0); +} + +ZTEST(gen_isr_table_multilevel, test_multi_level_bit_masks_l2) +{ + if (!IS_ENABLED(CONFIG_2ND_LEVEL_INTERRUPTS)) { + ztest_test_skip(); + } + + uint32_t irq1, irq2; + + /* First IRQ of level 2 */ + irq1 = 0; + /* First irq of level 2 and onwards is 1, as 0 means that the irq is not present */ + irq2 = 1; + test_multi_level_bit_masks_fn(irq1, irq2, 0); + + /* Somewhere in-between */ + irq1 = BIT_MASK(CONFIG_1ST_LEVEL_INTERRUPT_BITS) >> 1; + irq2 = BIT_MASK(CONFIG_2ND_LEVEL_INTERRUPT_BITS) >> 1; + test_multi_level_bit_masks_fn(irq1, irq2, 0); + + /* Last IRQ of level 2 */ + irq1 = BIT_MASK(CONFIG_1ST_LEVEL_INTERRUPT_BITS); + irq2 = BIT_MASK(CONFIG_2ND_LEVEL_INTERRUPT_BITS); + test_multi_level_bit_masks_fn(irq1, irq2, 0); +} + +ZTEST(gen_isr_table_multilevel, test_multi_level_bit_masks_l3) +{ + if (!IS_ENABLED(CONFIG_3RD_LEVEL_INTERRUPTS)) { + ztest_test_skip(); + } + + uint32_t irq1, irq2, irq3; + + /* First IRQ of level 3 */ + irq1 = 0; + /* First irq of level 2 and onwards is 1, as 0 means that the irq is not present */ + irq2 = 1; + irq3 = 1; + test_multi_level_bit_masks_fn(irq1, irq2, irq3); + + /* Somewhere in-between */ + irq1 = BIT_MASK(CONFIG_1ST_LEVEL_INTERRUPT_BITS) >> 1; + irq2 = BIT_MASK(CONFIG_2ND_LEVEL_INTERRUPT_BITS) >> 1; + irq3 = BIT_MASK(CONFIG_3RD_LEVEL_INTERRUPT_BITS) >> 1; + test_multi_level_bit_masks_fn(irq1, irq2, irq3); + + /* Last IRQ of level 3 */ + irq1 = BIT_MASK(CONFIG_1ST_LEVEL_INTERRUPT_BITS); + irq2 = BIT_MASK(CONFIG_2ND_LEVEL_INTERRUPT_BITS); + irq3 = BIT_MASK(CONFIG_3RD_LEVEL_INTERRUPT_BITS); + test_multi_level_bit_masks_fn(irq1, irq2, irq3); +} + +ZTEST_SUITE(gen_isr_table_multilevel, NULL, NULL, NULL, NULL, NULL); From 68f56f1c5d7b8f7023ad409cf3b6980800da63ea Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Mon, 23 Sep 2024 14:18:47 +0800 Subject: [PATCH 0140/4482] tests: gen_isr_table: multilevel: cleanup filter & Kconfigs The following Kconfigs are always enabled on `qemu_riscv32`: - CONFIG_MULTI_LEVEL_INTERRUPTS - CONFIG_2ND_LEVEL_INTERRUPTS - CONFIG_RISCV_PRIVILEGED No need to enable/filter for them in the testcase. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- tests/kernel/gen_isr_table/testcase.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/kernel/gen_isr_table/testcase.yaml b/tests/kernel/gen_isr_table/testcase.yaml index b5ab3f3eb7804..a45771919b10f 100644 --- a/tests/kernel/gen_isr_table/testcase.yaml +++ b/tests/kernel/gen_isr_table/testcase.yaml @@ -83,18 +83,14 @@ tests: - CONFIG_GEN_IRQ_VECTOR_TABLE=n arch.interrupt.gen_isr_table.bit_shift_2nd_level: platform_allow: qemu_riscv32 - filter: CONFIG_RISCV_PRIVILEGED extra_configs: - CONFIG_MAX_IRQ_PER_AGGREGATOR=52 - CONFIG_1ST_LEVEL_INTERRUPT_BITS=7 - CONFIG_2ND_LEVEL_INTERRUPT_BITS=9 arch.interrupt.gen_isr_table.bit_shift_3rd_level: platform_allow: qemu_riscv32 - filter: CONFIG_RISCV_PRIVILEGED extra_configs: - CONFIG_MAX_IRQ_PER_AGGREGATOR=52 - - CONFIG_MULTI_LEVEL_INTERRUPTS=y - - CONFIG_2ND_LEVEL_INTERRUPTS=y - CONFIG_3RD_LEVEL_INTERRUPTS=y - CONFIG_1ST_LEVEL_INTERRUPT_BITS=8 - CONFIG_2ND_LEVEL_INTERRUPT_BITS=11 From 091d70de6b003dba415289713d5f4c38e0eb077a Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Mon, 23 Sep 2024 15:05:15 +0800 Subject: [PATCH 0141/4482] tests: kernel: interrupt: multilevel: test APIs with devicetree Test multilevel-irq APIs with interrupt number generated from the devicetree to make sure that they work in sync. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- tests/kernel/interrupt/CMakeLists.txt | 1 + tests/kernel/interrupt/Kconfig | 8 ++ tests/kernel/interrupt/multilevel_irq.overlay | 44 +++++++++++ tests/kernel/interrupt/src/multilevel_irq.c | 76 +++++++++++++++++++ tests/kernel/interrupt/testcase.yaml | 6 ++ 5 files changed, 135 insertions(+) create mode 100644 tests/kernel/interrupt/Kconfig create mode 100644 tests/kernel/interrupt/multilevel_irq.overlay create mode 100644 tests/kernel/interrupt/src/multilevel_irq.c diff --git a/tests/kernel/interrupt/CMakeLists.txt b/tests/kernel/interrupt/CMakeLists.txt index b464719f89a65..dac54fb4ce4d9 100644 --- a/tests/kernel/interrupt/CMakeLists.txt +++ b/tests/kernel/interrupt/CMakeLists.txt @@ -26,4 +26,5 @@ endif() if(CONFIG_MULTI_LEVEL_INTERRUPTS) target_sources_ifdef(CONFIG_DYNAMIC_INTERRUPTS app PRIVATE src/sw_isr_table.c) + target_sources_ifdef(CONFIG_TEST_MULTILEVEL_IRQ app PRIVATE src/multilevel_irq.c) endif() diff --git a/tests/kernel/interrupt/Kconfig b/tests/kernel/interrupt/Kconfig new file mode 100644 index 0000000000000..daa87b5c30f5f --- /dev/null +++ b/tests/kernel/interrupt/Kconfig @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2024 Meta Platforms + +config TEST_MULTILEVEL_IRQ + bool "Build the tests in multilevel_irq.c" + depends on MULTI_LEVEL_INTERRUPTS + +source "Kconfig.zephyr" diff --git a/tests/kernel/interrupt/multilevel_irq.overlay b/tests/kernel/interrupt/multilevel_irq.overlay new file mode 100644 index 0000000000000..69878bd3f499e --- /dev/null +++ b/tests/kernel/interrupt/multilevel_irq.overlay @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Meta Platforms + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + test { + #address-cells = < 0x1 >; + #size-cells = < 0x1 >; + + test_cpu_intc: interrupt-controller { + compatible = "vnd,cpu-intc"; + #address-cells = <0>; + #interrupt-cells = < 0x01 >; + interrupt-controller; + }; + + test_l1_irq: interrupt-controller@bbbbcccc { + compatible = "vnd,intc"; + reg = <0xbbbbcccc 0x1000>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = <11 0>; + interrupt-parent = <&test_cpu_intc>; + }; + + test_l2_irq: interrupt-controller@bbbccccc { + compatible = "vnd,intc"; + reg = <0xbbbccccc 0x1000>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = <12 0>; + interrupt-parent = <&test_l1_irq>; + }; + + test_l3_irq: interrupt-holder { + compatible = "vnd,interrupt-holder"; + status = "okay"; + interrupts = <13 3>; + interrupt-parent = <&test_l2_irq>; + interrupt-names = "test"; + }; + }; +}; diff --git a/tests/kernel/interrupt/src/multilevel_irq.c b/tests/kernel/interrupt/src/multilevel_irq.c new file mode 100644 index 0000000000000..d74a2283a5f7b --- /dev/null +++ b/tests/kernel/interrupt/src/multilevel_irq.c @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2024 Meta Platforms + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +ZTEST(interrupt_feature, test_multi_level_api) +{ + /* Zephyr multilevel-encoded IRQ */ + const uint32_t irqn_l3 = DT_IRQN(DT_NODELABEL(test_l3_irq)); + const uint32_t irqn_l2 = DT_IRQN(DT_NODELABEL(test_l2_irq)); + const uint32_t irqn_l1 = DT_IRQN(DT_NODELABEL(test_l1_irq)); + /* Raw IRQ specified in the devicetree */ + const uint32_t raw_l3 = DT_IRQ(DT_NODELABEL(test_l3_irq), irq); + const uint32_t raw_l2 = DT_IRQ(DT_NODELABEL(test_l2_irq), irq); + const uint32_t raw_l1 = DT_IRQ(DT_NODELABEL(test_l1_irq), irq); + + /** + * - irq_get_level() + */ + zassert_equal(3, irq_get_level(irqn_l3)); + zassert_equal(2, irq_get_level(irqn_l2)); + zassert_equal(1, irq_get_level(irqn_l1)); + + /** + * - irq_from_level_2() + * - irq_to_level_2() + * - irq_parent_level_2() + */ + zassert_equal(irq_from_level_2(irqn_l3), raw_l2); + zassert_equal(irq_from_level_2(irqn_l2), raw_l2); + + zassert_equal(irq_to_level_2(raw_l2) & irqn_l2, irq_to_level_2(raw_l2)); + + zassert_equal(irq_parent_level_2(irqn_l2), raw_l1); + + /** + * - irq_from_level_3() + * - irq_to_level_3() + * - irq_parent_level_3() + */ + zassert_equal(irq_from_level_3(irqn_l3), raw_l3); + + zassert_equal(irq_to_level_3(raw_l3) & irqn_l3, irq_to_level_3(raw_l3)); + + zassert_equal(irq_parent_level_3(irqn_l3), raw_l2); + + /** + * - irq_from_level() + * - irq_to_level() + * - irq_parent_level() + */ + zassert_equal(irq_from_level(irqn_l3, 2), raw_l2); + zassert_equal(irq_from_level(irqn_l2, 2), raw_l2); + zassert_equal(irq_from_level(irqn_l3, 3), raw_l3); + + zassert_equal(irq_to_level(raw_l2, 2) & irqn_l2, irq_to_level(raw_l2, 2)); + zassert_equal(irq_to_level(raw_l3, 3) & irqn_l3, irq_to_level(raw_l3, 3)); + + zassert_equal(irq_parent_level(irqn_l2, 2), raw_l1); + zassert_equal(irq_parent_level(irqn_l3, 3), raw_l2); + + /** + * - irq_get_intc_irq() + */ + zassert_equal(irq_get_intc_irq(irqn_l3), irqn_l2); + zassert_equal(irq_get_intc_irq(irqn_l2), irqn_l1); + zassert_equal(irq_get_intc_irq(irqn_l1), irqn_l1); +} + +ZTEST_SUITE(gen_isr_table_multilevel, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/kernel/interrupt/testcase.yaml b/tests/kernel/interrupt/testcase.yaml index 78d81a579d08d..1ed995c0baa18 100644 --- a/tests/kernel/interrupt/testcase.yaml +++ b/tests/kernel/interrupt/testcase.yaml @@ -79,3 +79,9 @@ tests: filter: > not CONFIG_TRUSTED_EXECUTION_NONSECURE and CONFIG_ISR_TABLES_LOCAL_DECLARATION_SUPPORTED and not CONFIG_CODE_DATA_RELOCATION + arch.interrupt.multilevel: + filter: CONFIG_MULTI_LEVEL_INTERRUPTS + extra_args: + - EXTRA_DTC_OVERLAY_FILE="multilevel_irq.overlay" + extra_configs: + - CONFIG_TEST_MULTILEVEL_IRQ=y From 4b2f5c7de2d9cc8ef4704601001b451fff1ffbd2 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Mon, 23 Sep 2024 16:16:14 +0800 Subject: [PATCH 0142/4482] irq: multilevel: avoid manipulations with bits by using union type Use a union struct to partition the bits in a multilevel-encoded interrupt number instead of manipulating the bits manually, which is tedious and error prone. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- include/zephyr/irq_multilevel.h | 132 ++++++++++++++++++++++++-------- 1 file changed, 102 insertions(+), 30 deletions(-) diff --git a/include/zephyr/irq_multilevel.h b/include/zephyr/irq_multilevel.h index 587844f6d69f0..65d77471cba47 100644 --- a/include/zephyr/irq_multilevel.h +++ b/include/zephyr/irq_multilevel.h @@ -21,6 +21,64 @@ extern "C" { #endif #if defined(CONFIG_MULTI_LEVEL_INTERRUPTS) || defined(__DOXYGEN__) + +typedef union _z_irq { + /* Zephyr multilevel-encoded IRQ */ + uint32_t irq; + + /* Interrupt bits */ + struct { + /* First level interrupt bits */ + uint32_t l1: CONFIG_1ST_LEVEL_INTERRUPT_BITS; + /* Second level interrupt bits */ + uint32_t l2: CONFIG_2ND_LEVEL_INTERRUPT_BITS; + /* Third level interrupt bits */ + uint32_t l3: CONFIG_3RD_LEVEL_INTERRUPT_BITS; + } bits; + + /* Third level IRQ's interrupt controller */ + struct { + /* IRQ of the third level interrupt aggregator */ + uint32_t irq: CONFIG_1ST_LEVEL_INTERRUPT_BITS + CONFIG_2ND_LEVEL_INTERRUPT_BITS; + } l3_intc; + + /* Second level IRQ's interrupt controller */ + struct { + /* IRQ of the second level interrupt aggregator */ + uint32_t irq: CONFIG_1ST_LEVEL_INTERRUPT_BITS; + } l2_intc; +} _z_irq_t; + +BUILD_ASSERT(sizeof(_z_irq_t) == sizeof(uint32_t), "Size of `_z_irq_t` must equal to `uint32_t`"); + +static inline uint32_t _z_l1_irq(_z_irq_t irq) +{ + return irq.bits.l1; +} + +static inline uint32_t _z_l2_irq(_z_irq_t irq) +{ + return irq.bits.l2 - 1; +} + +static inline uint32_t _z_l3_irq(_z_irq_t irq) +{ + return irq.bits.l3 - 1; +} + +static inline unsigned int _z_irq_get_level(_z_irq_t z_irq) +{ + if (z_irq.bits.l3 != 0) { + return 3; + } + + if (z_irq.bits.l2 != 0) { + return 2; + } + + return 1; +} + /** * @brief Return IRQ level * This routine returns the interrupt level number of the provided interrupt. @@ -31,20 +89,11 @@ extern "C" { */ static inline unsigned int irq_get_level(unsigned int irq) { - const uint32_t mask2 = BIT_MASK(CONFIG_2ND_LEVEL_INTERRUPT_BITS) << - CONFIG_1ST_LEVEL_INTERRUPT_BITS; - const uint32_t mask3 = BIT_MASK(CONFIG_3RD_LEVEL_INTERRUPT_BITS) << - (CONFIG_1ST_LEVEL_INTERRUPT_BITS + CONFIG_2ND_LEVEL_INTERRUPT_BITS); - - if ((irq & mask3) != 0) { - return 3; - } - - if ((irq & mask2) != 0) { - return 2; - } + _z_irq_t z_irq = { + .irq = irq, + }; - return 1; + return _z_irq_get_level(z_irq); } /** @@ -59,14 +108,11 @@ static inline unsigned int irq_get_level(unsigned int irq) */ static inline unsigned int irq_from_level_2(unsigned int irq) { - unsigned int level = irq_get_level(irq); + _z_irq_t z_irq = { + .irq = irq, + }; - if (level == 3) { - return ((irq >> CONFIG_1ST_LEVEL_INTERRUPT_BITS) & - BIT_MASK(CONFIG_2ND_LEVEL_INTERRUPT_BITS)) - 1; - } else { - return (irq >> CONFIG_1ST_LEVEL_INTERRUPT_BITS) - 1; - } + return _z_l2_irq(z_irq); } /** @@ -92,7 +138,13 @@ static inline unsigned int irq_from_level_2(unsigned int irq) */ static inline unsigned int irq_to_level_2(unsigned int irq) { - return IRQ_TO_L2(irq); + _z_irq_t z_irq = { + .bits = { + .l2 = irq + 1, + }, + }; + + return z_irq.irq; } /** @@ -107,7 +159,11 @@ static inline unsigned int irq_to_level_2(unsigned int irq) */ static inline unsigned int irq_parent_level_2(unsigned int irq) { - return irq & BIT_MASK(CONFIG_1ST_LEVEL_INTERRUPT_BITS); + _z_irq_t z_irq = { + .irq = irq, + }; + + return _z_l1_irq(z_irq); } /** @@ -123,7 +179,11 @@ static inline unsigned int irq_parent_level_2(unsigned int irq) */ static inline unsigned int irq_from_level_3(unsigned int irq) { - return (irq >> (CONFIG_1ST_LEVEL_INTERRUPT_BITS + CONFIG_2ND_LEVEL_INTERRUPT_BITS)) - 1; + _z_irq_t z_irq = { + .irq = irq, + }; + + return _z_l3_irq(z_irq); } /** @@ -150,7 +210,13 @@ static inline unsigned int irq_from_level_3(unsigned int irq) */ static inline unsigned int irq_to_level_3(unsigned int irq) { - return IRQ_TO_L3(irq); + _z_irq_t z_irq = { + .bits = { + .l3 = irq + 1, + }, + }; + + return z_irq.irq; } /** @@ -165,9 +231,11 @@ static inline unsigned int irq_to_level_3(unsigned int irq) */ static inline unsigned int irq_parent_level_3(unsigned int irq) { - return ((irq >> CONFIG_1ST_LEVEL_INTERRUPT_BITS) & - BIT_MASK(CONFIG_2ND_LEVEL_INTERRUPT_BITS)) - - 1; + _z_irq_t z_irq = { + .irq = irq, + }; + + return _z_l2_irq(z_irq); } /** @@ -251,11 +319,15 @@ static inline unsigned int irq_get_intc_irq(unsigned int irq) { const unsigned int level = irq_get_level(irq); + __ASSERT_NO_MSG(level <= 3); + _z_irq_t z_irq = { + .irq = irq, + }; + if (level == 3) { - return irq & - BIT_MASK(CONFIG_1ST_LEVEL_INTERRUPT_BITS + CONFIG_2ND_LEVEL_INTERRUPT_BITS); + return z_irq.l3_intc.irq; } else if (level == 2) { - return irq & BIT_MASK(CONFIG_1ST_LEVEL_INTERRUPT_BITS); + return z_irq.l2_intc.irq; } else { return irq; } From 8bfdff3cb13ba636df0ab57630c5b3e498b94d4f Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Tue, 24 Sep 2024 15:21:42 +0800 Subject: [PATCH 0143/4482] irq: multilevel: add API to increment a multilevel IRQ Unlike a normal IRQ, a multilevel IRQ can't be incremented by simply `irq++`, as that would always increment the L1 of a IRQ, regardless of its level. A function that understands the level for which the IRQ operates in is required. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- include/zephyr/irq_multilevel.h | 25 ++++++++++++++++++ tests/kernel/interrupt/multilevel_irq.overlay | 26 +++++++++++++++++++ tests/kernel/interrupt/src/multilevel_irq.c | 11 ++++++++ 3 files changed, 62 insertions(+) diff --git a/include/zephyr/irq_multilevel.h b/include/zephyr/irq_multilevel.h index 65d77471cba47..da761179cdf4a 100644 --- a/include/zephyr/irq_multilevel.h +++ b/include/zephyr/irq_multilevel.h @@ -333,6 +333,31 @@ static inline unsigned int irq_get_intc_irq(unsigned int irq) } } +/** + * @brief Increments the multilevel-encoded @a irq by @a val + * + * @param irq IRQ number in its zephyr format + * @param val Amount to increment + * + * @return @a irq incremented by @a val + */ +static inline unsigned int irq_increment(unsigned int irq, unsigned int val) +{ + _z_irq_t z_irq = { + .irq = irq, + }; + + if (z_irq.bits.l3 != 0) { + z_irq.bits.l3 += val; + } else if (z_irq.bits.l2 != 0) { + z_irq.bits.l2 += val; + } else { + z_irq.bits.l1 += val; + } + + return z_irq.irq; +} + #endif /* CONFIG_MULTI_LEVEL_INTERRUPTS */ #ifdef __cplusplus } diff --git a/tests/kernel/interrupt/multilevel_irq.overlay b/tests/kernel/interrupt/multilevel_irq.overlay index 69878bd3f499e..a33b27fbcfdf6 100644 --- a/tests/kernel/interrupt/multilevel_irq.overlay +++ b/tests/kernel/interrupt/multilevel_irq.overlay @@ -40,5 +40,31 @@ interrupt-parent = <&test_l2_irq>; interrupt-names = "test"; }; + + test_l1_irq_inc: interrupt-controller@bbbbdccc { + compatible = "vnd,intc"; + reg = <0xbbbbdccc 0x10>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = <12 0>; /* +1 */ + interrupt-parent = <&test_cpu_intc>; + }; + + test_l2_irq_inc: interrupt-controller@bbbbdcdc { + compatible = "vnd,intc"; + reg = <0xbbbbdcdc 0x10>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = <14 0>; /* +2 */ + interrupt-parent = <&test_l1_irq>; + }; + + test_l3_irq_inc: interrupt-holder-inc { + compatible = "vnd,interrupt-holder"; + status = "okay"; + interrupts = <16 3>; /* +3 */ + interrupt-parent = <&test_l2_irq>; + interrupt-names = "test"; + }; }; }; diff --git a/tests/kernel/interrupt/src/multilevel_irq.c b/tests/kernel/interrupt/src/multilevel_irq.c index d74a2283a5f7b..76dbd29b4543a 100644 --- a/tests/kernel/interrupt/src/multilevel_irq.c +++ b/tests/kernel/interrupt/src/multilevel_irq.c @@ -71,6 +71,17 @@ ZTEST(interrupt_feature, test_multi_level_api) zassert_equal(irq_get_intc_irq(irqn_l3), irqn_l2); zassert_equal(irq_get_intc_irq(irqn_l2), irqn_l1); zassert_equal(irq_get_intc_irq(irqn_l1), irqn_l1); + + const uint32_t irqn_l3_inc = DT_IRQN(DT_NODELABEL(test_l3_irq_inc)); + const uint32_t irqn_l2_inc = DT_IRQN(DT_NODELABEL(test_l2_irq_inc)); + const uint32_t irqn_l1_inc = DT_IRQN(DT_NODELABEL(test_l1_irq_inc)); + + /** + * - irq_increment() + */ + zassert_equal(irq_increment(irqn_l1, 1), irqn_l1_inc); + zassert_equal(irq_increment(irqn_l2, 2), irqn_l2_inc); + zassert_equal(irq_increment(irqn_l3, 3), irqn_l3_inc); } ZTEST_SUITE(gen_isr_table_multilevel, NULL, NULL, NULL, NULL, NULL); From 91db52c431b89a2b7e9841f9dee0dc0223ebccda Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Fri, 19 Jul 2024 15:11:13 +0800 Subject: [PATCH 0144/4482] Bluetooth: SSP: clear pairing flag if ssp pairing completed When the ssp pairing event is notified, clear the pairing flag. It is used to support case that the authentication is started by peer, the link will not be encrypted after the pairing is completed without any err. If the local device want to encrypt the link, it could call `bt_conn_set_security` to start encrypt the link after the pairing complete callback triggered. In original implementation, the `bt_conn_set_security` cannot be called if the authentication has been started. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/ssp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/subsys/bluetooth/host/classic/ssp.c b/subsys/bluetooth/host/classic/ssp.c index 41a42f829f334..9be5ca28dec34 100644 --- a/subsys/bluetooth/host/classic/ssp.c +++ b/subsys/bluetooth/host/classic/ssp.c @@ -213,6 +213,13 @@ static int ssp_confirm_neg_reply(struct bt_conn *conn) static void ssp_pairing_complete(struct bt_conn *conn, uint8_t status) { + /* When the ssp pairing complete event notified, + * clear the pairing flag. + */ + atomic_clear_bit(conn->flags, BT_CONN_BR_PAIRING); + + LOG_DBG("Pairing completed status %d", status); + if (!status) { bool bond = !atomic_test_bit(conn->flags, BT_CONN_BR_NOBOND); struct bt_conn_auth_info_cb *listener, *next; From 8c8a21a04c599a4e990ba4c5cc864e0810b28ed0 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Wed, 24 Jul 2024 19:43:21 +0800 Subject: [PATCH 0145/4482] Bluetooth: BR_SMP: Add a flag BT_CONN_BR_PAIRED Due to the BT_CONN_BR_PAIRING is cleared when receiving ssp pairing complete event. The LTK key cannot be derived after the BR connection encrypted. Add a flag BT_CONN_BR_PAIRED that the pairing has been done. Use this flag to indicate whether the LTK derivation needs to be applied if the BR ACL connection is encrypted. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/ssp.c | 1 + subsys/bluetooth/host/conn.c | 1 + subsys/bluetooth/host/conn_internal.h | 1 + subsys/bluetooth/host/hci_core.c | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/classic/ssp.c b/subsys/bluetooth/host/classic/ssp.c index 9be5ca28dec34..66ff7740c6c1e 100644 --- a/subsys/bluetooth/host/classic/ssp.c +++ b/subsys/bluetooth/host/classic/ssp.c @@ -217,6 +217,7 @@ static void ssp_pairing_complete(struct bt_conn *conn, uint8_t status) * clear the pairing flag. */ atomic_clear_bit(conn->flags, BT_CONN_BR_PAIRING); + atomic_set_bit_to(conn->flags, BT_CONN_BR_PAIRED, !status); LOG_DBG("Pairing completed status %d", status); diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index a8b1282ea959d..bf420579445dc 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -2610,6 +2610,7 @@ static void reset_pairing(struct bt_conn *conn) #if defined(CONFIG_BT_CLASSIC) if (conn->type == BT_CONN_TYPE_BR) { atomic_clear_bit(conn->flags, BT_CONN_BR_PAIRING); + atomic_clear_bit(conn->flags, BT_CONN_BR_PAIRED); atomic_clear_bit(conn->flags, BT_CONN_BR_PAIRING_INITIATOR); atomic_clear_bit(conn->flags, BT_CONN_BR_LEGACY_SECURE); atomic_clear_bit(conn->flags, BT_CONN_BR_GENERAL_BONDING); diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h index a7b9bec7eec6f..ab64538255de1 100644 --- a/subsys/bluetooth/host/conn_internal.h +++ b/subsys/bluetooth/host/conn_internal.h @@ -59,6 +59,7 @@ enum { BT_CONN_BR_LEGACY_SECURE, /* 16 digits legacy PIN tracker */ BT_CONN_USER, /* user I/O when pairing */ BT_CONN_BR_PAIRING, /* BR connection in pairing context */ + BT_CONN_BR_PAIRED, /* BR connection pairing is done */ BT_CONN_BR_NOBOND, /* SSP no bond pairing tracker */ BT_CONN_BR_GENERAL_BONDING, /* BR general bonding */ BT_CONN_BR_PAIRING_INITIATOR, /* local host starts authentication */ diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 39fe50643a77e..88ba83932f0cc 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -2177,7 +2177,7 @@ static void hci_encrypt_change(struct net_buf *buf) * Start SMP over BR/EDR if we are pairing and are * central on the link */ - if (atomic_test_bit(conn->flags, BT_CONN_BR_PAIRING) && + if (atomic_test_bit(conn->flags, BT_CONN_BR_PAIRED) && conn->role == BT_CONN_ROLE_CENTRAL) { bt_smp_br_send_pairing_req(conn); } From c7db41dddb6dfee3c2f41c6965683915a5dfb6b8 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Thu, 25 Jul 2024 09:51:09 +0800 Subject: [PATCH 0146/4482] Bluetooth: BR: SMP: Set CT2 bit by default Set CT2 bit by default. If CT2 bit is set by both side, set the CT2 flag `SMP_FLAG_CT2`. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/smp.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index 71ca413851014..bfa04fa8dc43c 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -1190,7 +1190,7 @@ static uint8_t smp_br_pairing_req(struct bt_smp_br *smp, struct net_buf *buf) */ rsp = net_buf_add(rsp_buf, sizeof(*rsp)); - rsp->auth_req = 0x00; + rsp->auth_req = BT_SMP_AUTH_CT2; rsp->io_capability = 0x00; rsp->oob_flag = 0x00; rsp->max_key_size = max_key_size; @@ -1209,6 +1209,12 @@ static uint8_t smp_br_pairing_req(struct bt_smp_br *smp, struct net_buf *buf) atomic_set_bit(smp->flags, SMP_FLAG_PAIRING); + /* If CT2 bit is set both side, set CT2 flag */ + if ((rsp->auth_req & BT_SMP_AUTH_CT2) && + (req->auth_req & BT_SMP_AUTH_CT2)) { + atomic_set_bit(smp->flags, SMP_FLAG_CT2); + } + /* derive LTK if requested and clear distribution bits */ if ((smp->local_dist & BT_SMP_DIST_ENC_KEY) && (smp->remote_dist & BT_SMP_DIST_ENC_KEY)) { @@ -1269,6 +1275,14 @@ static uint8_t smp_br_pairing_rsp(struct bt_smp_br *smp, struct net_buf *buf) atomic_set_bit(smp->allowed_cmds, BT_SMP_CMD_SIGNING_INFO); } + /* + * CT2 flag is set in pairing req by bt_smp_br_send_pairing_req. + * If CT2 bit is set both side, set CT2 flag. + */ + if (rsp->auth_req & BT_SMP_AUTH_CT2) { + atomic_set_bit(smp->flags, SMP_FLAG_CT2); + } + /* derive LTK if requested and clear distribution bits */ if ((smp->local_dist & BT_SMP_DIST_ENC_KEY) && (smp->remote_dist & BT_SMP_DIST_ENC_KEY)) { @@ -1637,7 +1651,7 @@ int bt_smp_br_send_pairing_req(struct bt_conn *conn) * ignored on reception. */ - req->auth_req = 0x00; + req->auth_req = BT_SMP_AUTH_CT2; req->io_capability = 0x00; req->oob_flag = 0x00; req->max_key_size = max_key_size; From f9c490b7e1d18edb3e3eb22bf441c16958d8b7dd Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Thu, 25 Jul 2024 10:56:14 +0800 Subject: [PATCH 0147/4482] Bluetooth: LE: SMP: Set CT2 bit by default Set CT2 bit to auth_req field by default if the BR is enabled. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/smp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index bfa04fa8dc43c..9c8760a44b65b 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -2693,6 +2693,10 @@ static uint8_t get_auth(struct bt_smp *smp, uint8_t auth) auth &= ~BT_SMP_AUTH_KEYPRESS; } +#if defined(CONFIG_BT_CLASSIC) + auth |= BT_SMP_AUTH_CT2; +#endif /* CONFIG_BT_CLASSIC */ + return auth; } From ff39d4103413020723ac264f98831de5c16e93b7 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Tue, 24 Sep 2024 10:16:52 +0800 Subject: [PATCH 0148/4482] Bluetooth: ssp: correct pairing failed callback Current, the callback `pairing_complete` is called when the pairing is filed. But there is a callback `pairing_failed` for pairing failed case. Correct the callback calling if pairing failed. Call `pairing_failed` instead of `pairing_complete` if the pairing failed. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/ssp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/classic/ssp.c b/subsys/bluetooth/host/classic/ssp.c index 66ff7740c6c1e..b42c19e2547fc 100644 --- a/subsys/bluetooth/host/classic/ssp.c +++ b/subsys/bluetooth/host/classic/ssp.c @@ -236,8 +236,8 @@ static void ssp_pairing_complete(struct bt_conn *conn, uint8_t status) SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&bt_auth_info_cbs, listener, next, node) { - if (listener->pairing_complete) { - listener->pairing_complete(conn, status); + if (listener->pairing_failed) { + listener->pairing_failed(conn, status); } } } From 5742b270784146936439127f027dafd13231bf2d Mon Sep 17 00:00:00 2001 From: Mirko Covizzi Date: Wed, 25 Sep 2024 12:51:30 +0200 Subject: [PATCH 0149/4482] ipc: icmsg: fix typo Fix typo in header. Signed-off-by: Mirko Covizzi --- include/zephyr/ipc/icmsg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/ipc/icmsg.h b/include/zephyr/ipc/icmsg.h index 9a04aa980a031..6e4cbaeaa86c4 100644 --- a/include/zephyr/ipc/icmsg.h +++ b/include/zephyr/ipc/icmsg.h @@ -66,7 +66,7 @@ struct icmsg_data_t { * completed. * This function is intended to be called late in the initialization process, * possibly from a thread which can be safely blocked while handshake with the - * remote instance is being pefromed. + * remote instance is being performed. * * @param[in] conf Structure containing configuration parameters for the icmsg * instance. From ca26820ac18b8dc04ab5bc36e37d490d0b0e8b4c Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 26 Sep 2024 12:09:53 +0200 Subject: [PATCH 0150/4482] ipc: icmsg: Check return error of pbuf_rx_init() When pbuf_rx_init() was added, this caller did not check for a possibly returned error to not have more overhead than before using this function. Although unlikely let's check for a possible error (not configured Rx pbuf cfg). Signed-off-by: Alberto Escolar Piedras --- subsys/ipc/ipc_service/lib/icmsg.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/subsys/ipc/ipc_service/lib/icmsg.c b/subsys/ipc/ipc_service/lib/icmsg.c index 9de8a99ad5802..f574e71ec1478 100644 --- a/subsys/ipc/ipc_service/lib/icmsg.c +++ b/subsys/ipc/ipc_service/lib/icmsg.c @@ -273,11 +273,16 @@ int icmsg_open(const struct icmsg_config_t *conf, int ret = pbuf_tx_init(dev_data->tx_pb); if (ret < 0) { - __ASSERT(false, "Incorrect configuration"); + __ASSERT(false, "Incorrect Tx configuration"); return ret; } - (void)pbuf_rx_init(dev_data->rx_pb); + ret = pbuf_rx_init(dev_data->rx_pb); + + if (ret < 0) { + __ASSERT(false, "Incorrect Rx configuration"); + return ret; + } ret = pbuf_write(dev_data->tx_pb, magic, sizeof(magic)); From 117a0098f370ea898da5a3f83fa2e74bf3b5bf92 Mon Sep 17 00:00:00 2001 From: Florian Grandel Date: Wed, 25 Sep 2024 11:25:46 +0200 Subject: [PATCH 0151/4482] drivers: flash: simulator: fix address resolution The flash simulator assumes that flash is being addressed with absolute addresses by clients. But this is not the case. Given addresses are relative to the flash base address. The existing code only worked because the base address was always zero. Testing with non-zero base addresses caused a mem fault/page fault. (Reproducible e.g. when using the NVS settings subsystem on QEMU x86 with a non-zero base address in the soc-nv-flash node.) Fixes #79082 Signed-off-by: Florian Grandel --- drivers/flash/flash_simulator.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/flash/flash_simulator.c b/drivers/flash/flash_simulator.c index 1041bc3423b26..d8ee0ce093506 100644 --- a/drivers/flash/flash_simulator.c +++ b/drivers/flash/flash_simulator.c @@ -48,7 +48,7 @@ #error "Erase unit must be a multiple of program unit" #endif -#define MOCK_FLASH(addr) (mock_flash + (addr) - FLASH_SIMULATOR_BASE_OFFSET) +#define MOCK_FLASH(offset) (mock_flash + (offset)) /* maximum number of pages that can be tracked by the stats module */ #define STATS_PAGE_COUNT_THRESHOLD 256 @@ -174,9 +174,9 @@ static int flash_range_is_valid(const struct device *dev, off_t offset, size_t len) { ARG_UNUSED(dev); - if ((offset + len > FLASH_SIMULATOR_FLASH_SIZE + - FLASH_SIMULATOR_BASE_OFFSET) || - (offset < FLASH_SIMULATOR_BASE_OFFSET)) { + + if ((offset < 0 || offset >= FLASH_SIMULATOR_FLASH_SIZE || + (FLASH_SIMULATOR_FLASH_SIZE - offset) < len)) { return 0; } @@ -299,8 +299,7 @@ static int flash_sim_write(const struct device *dev, const off_t offset, static void unit_erase(const uint32_t unit) { - const off_t unit_addr = FLASH_SIMULATOR_BASE_OFFSET + - (unit * FLASH_SIMULATOR_ERASE_UNIT); + const off_t unit_addr = unit * FLASH_SIMULATOR_ERASE_UNIT; /* erase the memory unit by setting it to erase value */ memset(MOCK_FLASH(unit_addr), FLASH_SIMULATOR_ERASE_VALUE, @@ -332,8 +331,7 @@ static int flash_sim_erase(const struct device *dev, const off_t offset, } #endif /* the first unit to be erased */ - uint32_t unit_start = (offset - FLASH_SIMULATOR_BASE_OFFSET) / - FLASH_SIMULATOR_ERASE_UNIT; + uint32_t unit_start = offset / FLASH_SIMULATOR_ERASE_UNIT; /* erase as many units as necessary and increase their erase counter */ for (uint32_t i = 0; i < len / FLASH_SIMULATOR_ERASE_UNIT; i++) { From f1d9549a0cf2fc3c06af35a0a646ebd7170b28f2 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Wed, 24 Jul 2024 20:12:17 +0800 Subject: [PATCH 0152/4482] Bluetooth: BR: SMP: Check if remote supports CID 0x0007 Add a function bt_l2cap_br_get_remote_fixed_chan to get the remote fixed channels. If the fixed channel CID 0x0007 is unsupported, skip the LTK derivation. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/l2cap_br.c | 15 +++++++++++++++ .../bluetooth/host/classic/l2cap_br_interface.h | 3 +++ subsys/bluetooth/host/smp.c | 6 ++++++ 3 files changed, 24 insertions(+) diff --git a/subsys/bluetooth/host/classic/l2cap_br.c b/subsys/bluetooth/host/classic/l2cap_br.c index 4c1461c7f04aa..98e30ca913d96 100644 --- a/subsys/bluetooth/host/classic/l2cap_br.c +++ b/subsys/bluetooth/host/classic/l2cap_br.c @@ -119,6 +119,21 @@ struct bt_l2cap_chan *bt_l2cap_br_lookup_tx_cid(struct bt_conn *conn, return NULL; } +uint8_t bt_l2cap_br_get_remote_fixed_chan(struct bt_conn *conn) +{ + struct bt_l2cap_chan *chan_sig; + struct bt_l2cap_br *br_chan_sig; + + chan_sig = bt_l2cap_br_lookup_rx_cid(conn, BT_L2CAP_CID_BR_SIG); + if (!chan_sig) { + return (uint8_t)0U; + } + + br_chan_sig = CONTAINER_OF(chan_sig, struct bt_l2cap_br, chan.chan); + + return br_chan_sig->info_fixed_chan; +} + static struct bt_l2cap_br_chan* l2cap_br_chan_alloc_cid(struct bt_conn *conn, struct bt_l2cap_chan *chan) { diff --git a/subsys/bluetooth/host/classic/l2cap_br_interface.h b/subsys/bluetooth/host/classic/l2cap_br_interface.h index c8859abde0a68..fd64ed80102b6 100644 --- a/subsys/bluetooth/host/classic/l2cap_br_interface.h +++ b/subsys/bluetooth/host/classic/l2cap_br_interface.h @@ -67,3 +67,6 @@ struct net_buf *l2cap_br_data_pull(struct bt_conn *conn, /* Find L2CAP BR channel by using specific cid on specific connection */ struct bt_l2cap_chan *bt_l2cap_br_lookup_tx_cid(struct bt_conn *conn, uint16_t cid); + +/* Get remote supported fixed channels */ +uint8_t bt_l2cap_br_get_remote_fixed_chan(struct bt_conn *conn); diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index 9c8760a44b65b..48143548ed95e 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -1601,6 +1601,12 @@ int bt_smp_br_send_pairing_req(struct bt_conn *conn) struct net_buf *req_buf; uint8_t max_key_size; struct bt_smp_br *smp; + uint8_t remote_fixed_chan; + + remote_fixed_chan = bt_l2cap_br_get_remote_fixed_chan(conn); + if (!(remote_fixed_chan & BIT(BT_L2CAP_CID_BR_SMP))) { + return -ENOTSUP; + } smp = smp_br_chan_get(conn); if (!smp) { From 0b6684d8e35137ffb49c11db92d089358d31a8f3 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Wed, 25 Sep 2024 10:30:44 +0800 Subject: [PATCH 0153/4482] Bluetooth: l2cap_br: Comment on l2cap->info_fixed_chan Comment on the l2cap->info_fixed_chan why the size of it is one octet. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/l2cap_br.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/subsys/bluetooth/host/classic/l2cap_br.c b/subsys/bluetooth/host/classic/l2cap_br.c index 98e30ca913d96..a399ffce2908b 100644 --- a/subsys/bluetooth/host/classic/l2cap_br.c +++ b/subsys/bluetooth/host/classic/l2cap_br.c @@ -85,6 +85,13 @@ struct bt_l2cap_br { /* The channel this context is associated with */ struct bt_l2cap_br_chan chan; uint8_t info_ident; + /* + * 2.1 CHANNEL IDENTIFIERS in + * BLUETOOTH CORE SPECIFICATION Version 5.4 | Vol 3, Part A. + * The range of fixed L2CAP CID is 0x0001 ~ 0x0007 both for LE and BR. + * So use one octet buffer to keep the `Fixed channels supported` + * of peer device. + */ uint8_t info_fixed_chan; uint32_t info_feat_mask; }; @@ -541,6 +548,14 @@ static int l2cap_br_info_rsp(struct bt_l2cap_br *l2cap, uint8_t ident, err = -EINVAL; break; } + /* + * 2.1 CHANNEL IDENTIFIERS in + * BLUETOOTH CORE SPECIFICATION Version 5.4 | Vol 3, Part A. + * The info length of `Fixed channels supported` is 8 octets. + * Then the range of fixed L2CAP CID is 0x0001 ~ 0x0007 both for LE and BR. + * So use one octet buffer to keep the `Fixed channels supported` + * of peer device. + */ l2cap->info_fixed_chan = net_buf_pull_u8(buf); LOG_DBG("remote fixed channel mask 0x%02x", l2cap->info_fixed_chan); From 17cfe3619501cf9e44133c8e816e47436b990cbd Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Wed, 25 Sep 2024 16:51:24 +0800 Subject: [PATCH 0154/4482] Bluetooth: BR: Return `SHELL_CMD_HELP_PRINTED` if calls shell_help If the function `shell_help` is called, return SHELL_CMD_HELP_PRINTED instead of `0`. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/shell/bredr.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/subsys/bluetooth/host/classic/shell/bredr.c b/subsys/bluetooth/host/classic/shell/bredr.c index c21c726cb147a..869b875866c1f 100644 --- a/subsys/bluetooth/host/classic/shell/bredr.c +++ b/subsys/bluetooth/host/classic/shell/bredr.c @@ -210,6 +210,7 @@ static int cmd_discovery(const struct shell *sh, size_t argc, char *argv[]) shell_print(sh, "Discovery stopped"); } else { shell_help(sh); + return SHELL_CMD_HELP_PRINTED; } return 0; @@ -307,7 +308,7 @@ static int cmd_discoverable(const struct shell *sh, err = bt_br_set_discoverable(false); } else { shell_help(sh); - return 0; + return SHELL_CMD_HELP_PRINTED; } if (err) { @@ -335,7 +336,7 @@ static int cmd_connectable(const struct shell *sh, err = bt_br_set_connectable(false); } else { shell_help(sh); - return 0; + return SHELL_CMD_HELP_PRINTED; } if (err) { @@ -525,7 +526,7 @@ static int cmd_sdp_find_record(const struct shell *sh, discov = discov_a2src; } else { shell_help(sh); - return 0; + return SHELL_CMD_HELP_PRINTED; } shell_print(sh, "SDP UUID \'%s\' gets applied", action); @@ -562,8 +563,7 @@ static int cmd_br(const struct shell *sh, size_t argc, char **argv) { if (argc == 1) { shell_help(sh); - /* shell returns 1 when help is printed */ - return 1; + return SHELL_CMD_HELP_PRINTED; } shell_error(sh, "%s unknown parameter: %s", argv[0], argv[1]); From 3b74ed3f54354341cb403891d139e661261e8f66 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Wed, 25 Sep 2024 16:55:28 +0800 Subject: [PATCH 0155/4482] Bluetooth: BR: shell: Rename `int res` to `int err` Rename `int res` to `int err`. Make variable naming consistent. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/shell/bredr.c | 48 ++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/subsys/bluetooth/host/classic/shell/bredr.c b/subsys/bluetooth/host/classic/shell/bredr.c index 869b875866c1f..d8e74cd9f09cc 100644 --- a/subsys/bluetooth/host/classic/shell/bredr.c +++ b/subsys/bluetooth/host/classic/shell/bredr.c @@ -375,7 +375,7 @@ static uint8_t sdp_hfp_ag_user(struct bt_conn *conn, char addr[BT_ADDR_STR_LEN]; uint16_t param, version; uint16_t features; - int res; + int err; conn_addr_str(conn, addr, sizeof(addr)); @@ -389,21 +389,21 @@ static uint8_t sdp_hfp_ag_user(struct bt_conn *conn, * Focus to get BT_SDP_ATTR_PROTO_DESC_LIST attribute item to * get HFPAG Server Channel Number operating on RFCOMM protocol. */ - res = bt_sdp_get_proto_param(result->resp_buf, + err = bt_sdp_get_proto_param(result->resp_buf, BT_SDP_PROTO_RFCOMM, ¶m); - if (res < 0) { + if (err < 0) { shell_error(ctx_shell, "Error getting Server CN, " - "err %d", res); + "err %d", err); goto done; } shell_print(ctx_shell, "HFPAG Server CN param 0x%04x", param); - res = bt_sdp_get_profile_version(result->resp_buf, + err = bt_sdp_get_profile_version(result->resp_buf, BT_SDP_HANDSFREE_SVCLASS, &version); - if (res < 0) { + if (err < 0) { shell_error(ctx_shell, "Error getting profile version, " - "err %d", res); + "err %d", err); goto done; } shell_print(ctx_shell, "HFP version param 0x%04x", version); @@ -412,10 +412,10 @@ static uint8_t sdp_hfp_ag_user(struct bt_conn *conn, * Focus to get BT_SDP_ATTR_SUPPORTED_FEATURES attribute item to * get profile Supported Features mask. */ - res = bt_sdp_get_features(result->resp_buf, &features); - if (res < 0) { + err = bt_sdp_get_features(result->resp_buf, &features); + if (err < 0) { shell_error(ctx_shell, "Error getting HFPAG Features, " - "err %d", res); + "err %d", err); goto done; } shell_print(ctx_shell, "HFPAG Supported Features param 0x%04x", @@ -434,7 +434,7 @@ static uint8_t sdp_a2src_user(struct bt_conn *conn, char addr[BT_ADDR_STR_LEN]; uint16_t param, version; uint16_t features; - int res; + int err; conn_addr_str(conn, addr, sizeof(addr)); @@ -448,11 +448,11 @@ static uint8_t sdp_a2src_user(struct bt_conn *conn, * Focus to get BT_SDP_ATTR_PROTO_DESC_LIST attribute item to * get A2SRC Server PSM Number. */ - res = bt_sdp_get_proto_param(result->resp_buf, + err = bt_sdp_get_proto_param(result->resp_buf, BT_SDP_PROTO_L2CAP, ¶m); - if (res < 0) { + if (err < 0) { shell_error(ctx_shell, "A2SRC PSM Number not found, " - "err %d", res); + "err %d", err); goto done; } @@ -463,12 +463,12 @@ static uint8_t sdp_a2src_user(struct bt_conn *conn, * Focus to get BT_SDP_ATTR_PROFILE_DESC_LIST attribute item to * get profile version number. */ - res = bt_sdp_get_profile_version(result->resp_buf, + err = bt_sdp_get_profile_version(result->resp_buf, BT_SDP_ADVANCED_AUDIO_SVCLASS, &version); - if (res < 0) { + if (err < 0) { shell_error(ctx_shell, "A2SRC version not found, " - "err %d", res); + "err %d", err); goto done; } shell_print(ctx_shell, "A2SRC version param 0x%04x", version); @@ -477,10 +477,10 @@ static uint8_t sdp_a2src_user(struct bt_conn *conn, * Focus to get BT_SDP_ATTR_SUPPORTED_FEATURES attribute item to * get profile supported features mask. */ - res = bt_sdp_get_features(result->resp_buf, &features); - if (res < 0) { + err = bt_sdp_get_features(result->resp_buf, &features); + if (err < 0) { shell_error(ctx_shell, "A2SRC Features not found, " - "err %d", res); + "err %d", err); goto done; } shell_print(ctx_shell, "A2SRC Supported Features param 0x%04x", @@ -510,7 +510,7 @@ static struct bt_sdp_discover_params discov; static int cmd_sdp_find_record(const struct shell *sh, size_t argc, char *argv[]) { - int res; + int err; const char *action; if (!default_conn) { @@ -531,9 +531,9 @@ static int cmd_sdp_find_record(const struct shell *sh, shell_print(sh, "SDP UUID \'%s\' gets applied", action); - res = bt_sdp_discover(default_conn, &discov); - if (res) { - shell_error(sh, "SDP discovery failed: result %d", res); + err = bt_sdp_discover(default_conn, &discov); + if (err) { + shell_error(sh, "SDP discovery failed: err %d", err); return -ENOEXEC; } else { shell_print(sh, "SDP discovery started"); From 0270f91c1c8ba79a6cbb2596dc07e95a75c7802a Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Wed, 25 Sep 2024 17:00:35 +0800 Subject: [PATCH 0156/4482] Bluetooth: BR: Shell: Return error if command is failed Return error code if the command is failed instead of `0`. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/shell/bredr.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/subsys/bluetooth/host/classic/shell/bredr.c b/subsys/bluetooth/host/classic/shell/bredr.c index d8e74cd9f09cc..f8159fa711b8f 100644 --- a/subsys/bluetooth/host/classic/shell/bredr.c +++ b/subsys/bluetooth/host/classic/shell/bredr.c @@ -60,13 +60,13 @@ static int cmd_auth_pincode(const struct shell *sh, if (!conn) { shell_print(sh, "Not connected"); - return 0; + return -ENOEXEC; } if (strlen(argv[1]) > max) { shell_print(sh, "PIN code value invalid - enter max %u " "digits", max); - return 0; + return -ENOEXEC; } shell_print(sh, "PIN code \"%s\" applied", argv[1]); @@ -91,6 +91,7 @@ static int cmd_connect(const struct shell *sh, size_t argc, char *argv[]) conn = bt_conn_create_br(&addr, BT_BR_CONN_PARAM_DEFAULT); if (!conn) { shell_print(sh, "Connection failed"); + return -ENOEXEC; } else { shell_print(sh, "Connection pending"); @@ -197,14 +198,14 @@ static int cmd_discovery(const struct shell *sh, size_t argc, char *argv[]) if (bt_br_discovery_start(¶m, br_discovery_results, ARRAY_SIZE(br_discovery_results)) < 0) { shell_print(sh, "Failed to start discovery"); - return 0; + return -ENOEXEC; } shell_print(sh, "Discovery started"); } else if (!strcmp(action, "off")) { if (bt_br_discovery_stop()) { shell_print(sh, "Failed to stop discovery"); - return 0; + return -ENOEXEC; } shell_print(sh, "Discovery stopped"); @@ -278,7 +279,7 @@ static int cmd_l2cap_register(const struct shell *sh, { if (br_server.psm) { shell_print(sh, "Already registered"); - return 0; + return -ENOEXEC; } br_server.psm = strtoul(argv[1], NULL, 16); @@ -515,7 +516,7 @@ static int cmd_sdp_find_record(const struct shell *sh, if (!default_conn) { shell_print(sh, "Not connected"); - return 0; + return -ENOEXEC; } action = argv[1]; From 4c09f5cce3b8c589ba523b572567115d89794837 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Wed, 25 Sep 2024 17:01:51 +0800 Subject: [PATCH 0157/4482] Bluetooth: BR: Shell: Remove duplicated `else` statement Remove duplicate `else` statement if the function is returned from corresponding `if` statement. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/shell/bredr.c | 25 ++++++++++----------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/subsys/bluetooth/host/classic/shell/bredr.c b/subsys/bluetooth/host/classic/shell/bredr.c index f8159fa711b8f..68906490d7d7e 100644 --- a/subsys/bluetooth/host/classic/shell/bredr.c +++ b/subsys/bluetooth/host/classic/shell/bredr.c @@ -92,13 +92,12 @@ static int cmd_connect(const struct shell *sh, size_t argc, char *argv[]) if (!conn) { shell_print(sh, "Connection failed"); return -ENOEXEC; - } else { + } - shell_print(sh, "Connection pending"); + shell_print(sh, "Connection pending"); - /* unref connection obj in advance as app user */ - bt_conn_unref(conn); - } + /* unref connection obj in advance as app user */ + bt_conn_unref(conn); return 0; } @@ -288,10 +287,10 @@ static int cmd_l2cap_register(const struct shell *sh, shell_error(sh, "Unable to register psm"); br_server.psm = 0U; return -ENOEXEC; - } else { - shell_print(sh, "L2CAP psm %u registered", br_server.psm); } + shell_print(sh, "L2CAP psm %u registered", br_server.psm); + return 0; } @@ -316,10 +315,10 @@ static int cmd_discoverable(const struct shell *sh, shell_print(sh, "BR/EDR set/reset discoverable failed " "(err %d)", err); return -ENOEXEC; - } else { - shell_print(sh, "BR/EDR set/reset discoverable done"); } + shell_print(sh, "BR/EDR set/reset discoverable done"); + return 0; } @@ -344,10 +343,10 @@ static int cmd_connectable(const struct shell *sh, shell_print(sh, "BR/EDR set/rest connectable failed " "(err %d)", err); return -ENOEXEC; - } else { - shell_print(sh, "BR/EDR set/reset connectable done"); } + shell_print(sh, "BR/EDR set/reset connectable done"); + return 0; } @@ -536,10 +535,10 @@ static int cmd_sdp_find_record(const struct shell *sh, if (err) { shell_error(sh, "SDP discovery failed: err %d", err); return -ENOEXEC; - } else { - shell_print(sh, "SDP discovery started"); } + shell_print(sh, "SDP discovery started"); + return 0; } From 539cc1ddfa19d61294ee199beb3f196114fa2872 Mon Sep 17 00:00:00 2001 From: Maciej Baczmanski Date: Mon, 30 Sep 2024 09:37:55 +0200 Subject: [PATCH 0158/4482] manifest: openthread: Regular OpenThread upmerge Update OpenThread up to `2aeb8b8` and align KConfig options Signed-off-by: Maciej Baczmanski --- modules/openthread/CMakeLists.txt | 4 ++++ modules/openthread/Kconfig.features | 12 ++++++++++++ west.yml | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/modules/openthread/CMakeLists.txt b/modules/openthread/CMakeLists.txt index 2ee23327435a1..6bf3936718ac0 100644 --- a/modules/openthread/CMakeLists.txt +++ b/modules/openthread/CMakeLists.txt @@ -45,6 +45,7 @@ kconfig_to_ot_option(CONFIG_OPENTHREAD_BACKBONE_ROUTER_MULTICAST_ROUTING OT_BACK kconfig_to_ot_option(CONFIG_OPENTHREAD_BLE_TCAT OT_BLE_TCAT "Enable BLE TCAT support") kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_AGENT OT_BORDER_AGENT "Enable Border Agent") kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_AGENT_EPHEMERAL_KEY_ENABLE OT_BORDER_AGENT_EPSKC "Border agent ephemeral PSKc") +kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_AGENT_ID OT_BORDER_AGENT_ID "Create and save border agent ID") kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_ROUTER OT_BORDER_ROUTER "Enable Border Router") kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_ROUTING OT_BORDER_ROUTING "Enable Border routing") kconfig_to_ot_option(CONFIG_OPENTHREAD_BORDER_ROUTING_COUNTERS OT_BORDER_ROUTING_COUNTERS "Enable Border routing counters") @@ -70,8 +71,10 @@ kconfig_to_ot_option(CONFIG_OPENTHREAD_DNS_CLIENT OT_DNS_CLIENT "Enable DNS clie kconfig_to_ot_option(CONFIG_OPENTHREAD_DNS_CLIENT_OVER_TCP OT_DNS_CLIENT_OVER_TCP "Enable dns query over tcp") kconfig_to_ot_option(CONFIG_OPENTHREAD_DNS_DSO OT_DNS_DSO "Enable DNS Stateful Operations (DSO) support") kconfig_to_ot_option(CONFIG_OPENTHREAD_DNS_UPSTREAM_QUERY OT_DNS_UPSTREAM_QUERY "Enable forwarding DNS queries to upstream") +kconfig_to_ot_option(CONFIG_OPENTHREAD_DNSSD_DISCOVERY_PROXY OT_DNSSD_DISCOVERY_PROXY "Enable DNS-SD discovery proxy support") kconfig_to_ot_option(CONFIG_OPENTHREAD_DNSSD_SERVER OT_DNSSD_SERVER "Enable DNS-SD server support") kconfig_to_ot_option(CONFIG_OPENTHREAD_DUA OT_DUA "Enable Domain Unicast Address feature for Thread 1.2") +kconfig_to_ot_option(CONFIG_OPENTHREAD_DYNAMIC_STORE_FRAME_AHEAD_COUNTER OT_DYNAMIC_STORE_FRAME_AHEAD_COUNTER "Enable dynamic store frame ahead counter") kconfig_to_ot_option(CONFIG_OPENTHREAD_ECDSA OT_ECDSA "Enable ECDSA support") kconfig_to_ot_option(CONFIG_OPENTHREAD_ENABLE_SERVICE OT_SERVICE "Enable Service entries in Thread Network Data") kconfig_to_ot_option(CONFIG_OPENTHREAD_EXTERNAL_HEAP OT_EXTERNAL_HEAP "Enable external heap support") @@ -99,6 +102,7 @@ kconfig_to_ot_option(CONFIG_OPENTHREAD_NAT64_BORDER_ROUTING OT_NAT64_BORDER_ROUT kconfig_to_ot_option(CONFIG_OPENTHREAD_NAT64_TRANSLATOR OT_NAT64_TRANSLATOR "Enable NAT64 translator") kconfig_to_ot_option(CONFIG_OPENTHREAD_NEIGHBOR_DISCOVERY_AGENT OT_NEIGHBOR_DISCOVERY_AGENT "Enable neighbor discovery agent support") kconfig_to_ot_option(CONFIG_OPENTHREAD_NETDIAG_CLIENT OT_NETDIAG_CLIENT "Enable TMF network diagnostics on clients") +kconfig_to_ot_option(CONFIG_OPENTHREAD_NETDIAG_VENDOR_INFO OT_NETDIAG_VENDOR_INFO "Allow setting vendor info at runtime") kconfig_to_ot_option(CONFIG_OPENTHREAD_NETDATA_PUBLISHER OT_NETDATA_PUBLISHER "Enable Thread Network Data publisher") kconfig_to_ot_option(CONFIG_OPENTHREAD_OPERATIONAL_DATASET_AUTO_INIT OT_OPERATIONAL_DATASET_AUTO_INIT "Enable operational dataset auto init") kconfig_to_ot_option(CONFIG_OPENTHREAD_OTNS OT_OTNS "Enable OTNS support") diff --git a/modules/openthread/Kconfig.features b/modules/openthread/Kconfig.features index eb713232c926f..ccdd3236d384a 100644 --- a/modules/openthread/Kconfig.features +++ b/modules/openthread/Kconfig.features @@ -52,6 +52,9 @@ config OPENTHREAD_BORDER_AGENT config OPENTHREAD_BORDER_AGENT_EPHEMERAL_KEY_ENABLE bool "Border agent ephemeral PSKc" +config OPENTHREAD_BORDER_AGENT_ID + bool "Create and save border agent ID" + config OPENTHREAD_BORDER_ROUTER bool "Border Router support" @@ -150,6 +153,9 @@ config OPENTHREAD_DNS_UPSTREAM_QUERY help Enable forwarding DNS queries to platform DNS upstream API +config OPENTHREAD_DNSSD_DISCOVERY_PROXY + bool "DNS-SD discovery proxy support" + config OPENTHREAD_DNSSD_SERVER bool "DNS-SD server support" @@ -158,6 +164,9 @@ config OPENTHREAD_DUA help Enable Domain Unicast Address feature for Thread 1.2 +config OPENTHREAD_DYNAMIC_STORE_FRAME_AHEAD_COUNTER + bool "Dynamic store frame ahead counter" + config OPENTHREAD_ECDSA bool "ECDSA support" @@ -248,6 +257,9 @@ config OPENTHREAD_NAT64_TRANSLATOR config OPENTHREAD_NETDIAG_CLIENT bool "TMF network diagnostics on client" +config OPENTHREAD_NETDIAG_VENDOR_INFO + bool "Allow setting vendor info at runtime" + config OPENTHREAD_NEIGHBOR_DISCOVERY_AGENT bool "Neighbor discovery agent support" diff --git a/west.yml b/west.yml index 3df10c478eaa2..9ec48d6bf499f 100644 --- a/west.yml +++ b/west.yml @@ -306,7 +306,7 @@ manifest: revision: 76d2168bcdfcd23a9a7dce8c21f2083b90a1e60a path: modules/lib/open-amp - name: openthread - revision: e10a92570f94ff1e0bc5e0da9ecf0ee135d955a6 + revision: 2aeb8b833ba760ec29d5f340dd1ce7bcb61c5d56 path: modules/lib/openthread - name: percepio path: modules/debug/percepio From 9655c2f61b8b09ec0b7ee0f9479b849c2f94d871 Mon Sep 17 00:00:00 2001 From: Maciej Baczmanski Date: Mon, 30 Sep 2024 09:43:15 +0200 Subject: [PATCH 0159/4482] net: openthread: add `OPENTHREAD_STORE_FRAME_COUNTER_AHEAD` Add `OPENTHREAD_STORE_FRAME_COUNTER_AHEAD` Kconfig option and set it to 100000, as after calculations it appears to be a more suitable value. Signed-off-by: Maciej Baczmanski --- modules/openthread/Kconfig.thread | 10 ++++++++-- .../platform/openthread-core-zephyr-config.h | 10 ++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/modules/openthread/Kconfig.thread b/modules/openthread/Kconfig.thread index dce39fecec8f4..22f11d5c606dd 100644 --- a/modules/openthread/Kconfig.thread +++ b/modules/openthread/Kconfig.thread @@ -187,13 +187,13 @@ config OPENTHREAD_BLE_TCAT_THREAD_STACK_SIZE default 5120 if OPENTHREAD_CRYPTO_PSA default 4200 help - Openthread default TCAT stack size. + Openthread default TCAT stack size. config OPENTHREAD_BLE_TCAT_RING_BUF_SIZE int "Openthread BLE ringbuffer size" default 512 help - Openthread BLE TCAT ringbuffer size. + Openthread BLE TCAT ringbuffer size. config OPENTHREAD_NAT64_CIDR string "Set IPv4 CIDR used by NAT64" @@ -204,3 +204,9 @@ config OPENTHREAD_NAT64_CIDR to set source address of the outgoing translated IPv4 packets. The CIDR must have four bytes in the address with the non-zero length of prefix (e.g., "127.0.0.1/24"). + +config OPENTHREAD_STORE_FRAME_COUNTER_AHEAD + int "Openthread frame counter ahead value" + default 100000 + help + Openthread value ahead of the current frame counter for persistent storage. diff --git a/modules/openthread/platform/openthread-core-zephyr-config.h b/modules/openthread/platform/openthread-core-zephyr-config.h index 71a087ca0b501..20f424ee2fe9e 100644 --- a/modules/openthread/platform/openthread-core-zephyr-config.h +++ b/modules/openthread/platform/openthread-core-zephyr-config.h @@ -448,4 +448,14 @@ #define OPENTHREAD_CONFIG_RADIO_STATS_ENABLE CONFIG_OPENTHREAD_RADIO_STATS #endif +/** + * @def OPENTHREAD_CONFIG_STORE_FRAME_COUNTER_AHEAD + * + * The value ahead of the current frame counter for persistent storage. + * + */ +#ifdef CONFIG_OPENTHREAD_STORE_FRAME_COUNTER_AHEAD +#define OPENTHREAD_CONFIG_STORE_FRAME_COUNTER_AHEAD CONFIG_OPENTHREAD_STORE_FRAME_COUNTER_AHEAD +#endif + #endif /* OPENTHREAD_CORE_ZEPHYR_CONFIG_H_ */ From 71afbaf66ebd18ce55410f13ecdaaa66183703f6 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 2 Oct 2024 12:59:27 +0200 Subject: [PATCH 0160/4482] irq_multilevel: explicitly initialize all members to avoid a warning As this is a header, let's explicitly initialize all members of the struct to avoid a "missing initializer for member" warning in case the file is built with -Wmissing-field-initializers, or worse, that warning set to be an error. Signed-off-by: Alberto Escolar Piedras --- include/zephyr/irq_multilevel.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/zephyr/irq_multilevel.h b/include/zephyr/irq_multilevel.h index da761179cdf4a..dc18c3049b6b4 100644 --- a/include/zephyr/irq_multilevel.h +++ b/include/zephyr/irq_multilevel.h @@ -140,7 +140,9 @@ static inline unsigned int irq_to_level_2(unsigned int irq) { _z_irq_t z_irq = { .bits = { + .l1 = 0, .l2 = irq + 1, + .l3 = 0, }, }; @@ -212,6 +214,8 @@ static inline unsigned int irq_to_level_3(unsigned int irq) { _z_irq_t z_irq = { .bits = { + .l1 = 0, + .l2 = 0, .l3 = irq + 1, }, }; From f98fde07b304fadf98d62659de3a4bbf0dd99149 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Fri, 20 Sep 2024 13:01:04 +0000 Subject: [PATCH 0161/4482] devicetree: make DT_..._REG_ADDR return unsigned `DT_..._REG_ADDR` macros do not always return an unsigned value. This commit adds and unsigned 32bit prefix to ensure the value is always unsigned. Signed-off-by: Jeppe Odgaard Signed-off-by: Fabio Baltieri --- doc/releases/migration-guide-4.0.rst | 7 +++ drivers/w1/w1_ds2482-800_channel.c | 4 +- include/zephyr/devicetree.h | 65 +++++++++++++++++++-- include/zephyr/devicetree/spi.h | 6 +- include/zephyr/drivers/adc.h | 2 +- include/zephyr/drivers/firmware/scmi/util.h | 10 ++-- include/zephyr/drivers/mipi_dbi.h | 2 +- include/zephyr/drivers/mspi/devicetree.h | 3 +- include/zephyr/drivers/spi.h | 2 +- include/zephyr/sys/device_mmio.h | 4 +- tests/lib/devicetree/api/src/main.c | 2 +- 11 files changed, 84 insertions(+), 23 deletions(-) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index e8c09adbb3bb7..d23b208ed9c4b 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -37,6 +37,13 @@ Boards * Board ``qemu_xtensa`` is deprecated. Use ``qemu_xtensa/dc233c`` instead. +Devicetree +********** + +* The :c:macro:`DT_REG_ADDR` macro and its variants are now expanding into an + unsigned literals (i.e. with a ``U`` suffix). To use addresses as devicetree + indexes use the :c:macro:`DT_REG_ADDR_RAW` variants. + STM32 ===== diff --git a/drivers/w1/w1_ds2482-800_channel.c b/drivers/w1/w1_ds2482-800_channel.c index 501a8c7013214..19363232116d8 100644 --- a/drivers/w1/w1_ds2482-800_channel.c +++ b/drivers/w1/w1_ds2482-800_channel.c @@ -164,8 +164,8 @@ static const struct w1_driver_api ds2482_driver_api = { .w1_config.slave_count = W1_INST_SLAVE_COUNT(inst), \ .parent = DEVICE_DT_GET(DT_INST_PARENT(inst)), \ .i2c_spec = I2C_DT_SPEC_GET(DT_INST_PARENT(inst)), \ - .reg_channel = UTIL_CAT(CHSL_IO, DT_INST_REG_ADDR(inst)), \ - .reg_channel_rb = UTIL_CAT(CHSL_RB_IO, DT_INST_REG_ADDR(inst)), \ + .reg_channel = UTIL_CAT(CHSL_IO, DT_INST_REG_ADDR_RAW(inst)), \ + .reg_channel_rb = UTIL_CAT(CHSL_RB_IO, DT_INST_REG_ADDR_RAW(inst)), \ .reg_config = DT_INST_PROP(inst, active_pullup) << DEVICE_APU_pos, \ }; \ static struct ds2482_data inst_##inst##_data = {0}; \ diff --git a/include/zephyr/devicetree.h b/include/zephyr/devicetree.h index b675b42ec7a61..a93ffd527543d 100644 --- a/include/zephyr/devicetree.h +++ b/include/zephyr/devicetree.h @@ -2243,6 +2243,34 @@ #define DT_REG_HAS_NAME(node_id, name) \ IS_ENABLED(DT_CAT4(node_id, _REG_NAME_, name, _EXISTS)) +/** + * @brief Get the base raw address of the register block at index @p idx + * + * Get the base address of the register block at index @p idx without any + * type suffix. This can be used to index other devicetree properties, use the + * non _RAW macros for assigning values in actual code. + * + * @param node_id node identifier + * @param idx index of the register whose address to return + * @return address of the idx-th register block + */ +#define DT_REG_ADDR_BY_IDX_RAW(node_id, idx) \ + DT_CAT4(node_id, _REG_IDX_, idx, _VAL_ADDRESS) + +/** + * @brief Get a node's (only) register block raw address + * + * Get a node's only register block address without any type suffix. This can + * be used to index other devicetree properties, use the non _RAW macros for + * assigning values in actual code. + * + * Equivalent to DT_REG_ADDR_BY_IDX_RAW(node_id, 0). + * @param node_id node identifier + * @return node's register block address + */ +#define DT_REG_ADDR_RAW(node_id) \ + DT_REG_ADDR_BY_IDX_RAW(node_id, 0) + /** * @brief Get the base address of the register block at index @p idx * @param node_id node identifier @@ -2250,7 +2278,7 @@ * @return address of the idx-th register block */ #define DT_REG_ADDR_BY_IDX(node_id, idx) \ - DT_CAT4(node_id, _REG_IDX_, idx, _VAL_ADDRESS) + DT_U32_C(DT_REG_ADDR_BY_IDX_RAW(node_id, idx)) /** * @brief Get the size of the register block at index @p idx @@ -2285,7 +2313,7 @@ * @param node_id node identifier * @return node's register block address */ -#define DT_REG_ADDR_U64(node_id) DT_U64_C(DT_REG_ADDR(node_id)) +#define DT_REG_ADDR_U64(node_id) DT_U64_C(DT_REG_ADDR_BY_IDX_RAW(node_id, 0)) /** * @brief Get a node's (only) register block size @@ -2303,7 +2331,7 @@ * @return address of the register block specified by name */ #define DT_REG_ADDR_BY_NAME(node_id, name) \ - DT_CAT4(node_id, _REG_NAME_, name, _VAL_ADDRESS) + DT_U32_C(DT_CAT4(node_id, _REG_NAME_, name, _VAL_ADDRESS)) /** * @brief Like DT_REG_ADDR_BY_NAME(), but with a fallback to @p default_value @@ -2330,7 +2358,7 @@ * @return address of the register block specified by name */ #define DT_REG_ADDR_BY_NAME_U64(node_id, name) \ - DT_U64_C(DT_REG_ADDR_BY_NAME(node_id, name)) + DT_U64_C(DT_CAT4(node_id, _REG_NAME_, name, _VAL_ADDRESS)) /** * @brief Get a register block's size by name @@ -4135,6 +4163,14 @@ */ #define DT_INST_REG_HAS_NAME(inst, name) DT_REG_HAS_NAME(DT_DRV_INST(inst), name) +/** + * @brief Get a `DT_DRV_COMPAT` instance's idx-th register block's raw address + * @param inst instance number + * @param idx index of the register whose address to return + * @return address of the instance's idx-th register block + */ +#define DT_INST_REG_ADDR_BY_IDX_RAW(inst, idx) DT_REG_ADDR_BY_IDX_RAW(DT_DRV_INST(inst), idx) + /** * @brief Get a `DT_DRV_COMPAT` instance's idx-th register block's address * @param inst instance number @@ -4185,7 +4221,7 @@ * @return address of the register block with the given @p name */ #define DT_INST_REG_ADDR_BY_NAME_U64(inst, name) \ - DT_U64_C(DT_INST_REG_ADDR_BY_NAME(inst, name)) + DT_REG_ADDR_BY_NAME_U64(DT_DRV_INST(inst), name) /** * @brief Get a `DT_DRV_COMPAT`'s register block size by name @@ -4207,6 +4243,13 @@ #define DT_INST_REG_SIZE_BY_NAME_OR(inst, name, default_value) \ DT_REG_SIZE_BY_NAME_OR(DT_DRV_INST(inst), name, default_value) +/** + * @brief Get a `DT_DRV_COMPAT`'s (only) register block raw address + * @param inst instance number + * @return instance's register block address + */ +#define DT_INST_REG_ADDR_RAW(inst) DT_INST_REG_ADDR_BY_IDX_RAW(inst, 0) + /** * @brief Get a `DT_DRV_COMPAT`'s (only) register block address * @param inst instance number @@ -4225,7 +4268,7 @@ * @param inst instance number * @return instance's register block address */ -#define DT_INST_REG_ADDR_U64(inst) DT_U64_C(DT_INST_REG_ADDR(inst)) +#define DT_INST_REG_ADDR_U64(inst) DT_REG_ADDR_U64(DT_DRV_INST(inst)) /** * @brief Get a `DT_DRV_COMPAT`'s (only) register block size @@ -4887,6 +4930,16 @@ #define DT_COMPAT_NODE_HAS_PROP_AND_OR(inst, compat, prop) \ DT_NODE_HAS_PROP(DT_INST(inst, compat), prop) || +/** + * @def DT_U32_C + * @brief Macro to add 32bit unsigned postfix to the devicetree address constants + */ +#if defined(_LINKER) || defined(_ASMLANGUAGE) +#define DT_U32_C(_v) (_v) +#else +#define DT_U32_C(_v) UINT32_C(_v) +#endif + /** * @def DT_U64_C * @brief Macro to add ULL postfix to the devicetree address constants diff --git a/include/zephyr/devicetree/spi.h b/include/zephyr/devicetree/spi.h index d1f916c3df99f..db1b4996f6440 100644 --- a/include/zephyr/devicetree/spi.h +++ b/include/zephyr/devicetree/spi.h @@ -148,7 +148,7 @@ extern "C" { * @return node identifier for spi_dev's chip select GPIO controller */ #define DT_SPI_DEV_CS_GPIOS_CTLR(spi_dev) \ - DT_GPIO_CTLR_BY_IDX(DT_BUS(spi_dev), cs_gpios, DT_REG_ADDR(spi_dev)) + DT_GPIO_CTLR_BY_IDX(DT_BUS(spi_dev), cs_gpios, DT_REG_ADDR_RAW(spi_dev)) /** * @brief Get a SPI device's chip select GPIO pin number @@ -181,7 +181,7 @@ extern "C" { * @return pin number of spi_dev's chip select GPIO */ #define DT_SPI_DEV_CS_GPIOS_PIN(spi_dev) \ - DT_GPIO_PIN_BY_IDX(DT_BUS(spi_dev), cs_gpios, DT_REG_ADDR(spi_dev)) + DT_GPIO_PIN_BY_IDX(DT_BUS(spi_dev), cs_gpios, DT_REG_ADDR_RAW(spi_dev)) /** * @brief Get a SPI device's chip select GPIO flags @@ -209,7 +209,7 @@ extern "C" { * zero if there is none */ #define DT_SPI_DEV_CS_GPIOS_FLAGS(spi_dev) \ - DT_GPIO_FLAGS_BY_IDX(DT_BUS(spi_dev), cs_gpios, DT_REG_ADDR(spi_dev)) + DT_GPIO_FLAGS_BY_IDX(DT_BUS(spi_dev), cs_gpios, DT_REG_ADDR_RAW(spi_dev)) /** * @brief Equivalent to DT_SPI_DEV_HAS_CS_GPIOS(DT_DRV_INST(inst)). diff --git a/include/zephyr/drivers/adc.h b/include/zephyr/drivers/adc.h index dc7d975ae4504..583c04cd0e71e 100644 --- a/include/zephyr/drivers/adc.h +++ b/include/zephyr/drivers/adc.h @@ -321,7 +321,7 @@ struct adc_dt_spec { DT_FOREACH_CHILD_VARGS(ctlr, ADC_FOREACH_INPUT, input) #define ADC_FOREACH_INPUT(node, input) \ - IF_ENABLED(IS_EQ(DT_REG_ADDR(node), input), (node)) + IF_ENABLED(IS_EQ(DT_REG_ADDR_RAW(node), input), (node)) #define ADC_CHANNEL_CFG_FROM_DT_NODE(node_id) \ IF_ENABLED(DT_NODE_EXISTS(node_id), \ diff --git a/include/zephyr/drivers/firmware/scmi/util.h b/include/zephyr/drivers/firmware/scmi/util.h index 93900a109b8e6..cd05f984ac202 100644 --- a/include/zephyr/drivers/firmware/scmi/util.h +++ b/include/zephyr/drivers/firmware/scmi/util.h @@ -66,7 +66,7 @@ #define DT_SCMI_TRANSPORT_TX_CHAN_DECLARE(node_id) \ COND_CODE_1(DT_SCMI_TRANSPORT_PROTO_HAS_CHAN(node_id, 0), \ (extern struct scmi_channel \ - SCMI_TRANSPORT_CHAN_NAME(DT_REG_ADDR(node_id), 0);), \ + SCMI_TRANSPORT_CHAN_NAME(DT_REG_ADDR_RAW(node_id), 0);), \ (extern struct scmi_channel \ SCMI_TRANSPORT_CHAN_NAME(SCMI_PROTOCOL_BASE, 0);)) \ @@ -110,7 +110,7 @@ */ #define DT_SCMI_TRANSPORT_TX_CHAN(node_id) \ COND_CODE_1(DT_SCMI_TRANSPORT_PROTO_HAS_CHAN(node_id, 0), \ - (&SCMI_TRANSPORT_CHAN_NAME(DT_REG_ADDR(node_id), 0)), \ + (&SCMI_TRANSPORT_CHAN_NAME(DT_REG_ADDR_RAW(node_id), 0)), \ (&SCMI_TRANSPORT_CHAN_NAME(SCMI_PROTOCOL_BASE, 0))) /** @@ -211,9 +211,9 @@ #define DT_SCMI_PROTOCOL_DEFINE(node_id, init_fn, pm, data, config, \ level, prio, api) \ DT_SCMI_TRANSPORT_CHANNELS_DECLARE(node_id) \ - DT_SCMI_PROTOCOL_DATA_DEFINE(node_id, DT_REG_ADDR(node_id), data); \ + DT_SCMI_PROTOCOL_DATA_DEFINE(node_id, DT_REG_ADDR_RAW(node_id), data); \ DEVICE_DT_DEFINE(node_id, init_fn, pm, \ - &SCMI_PROTOCOL_NAME(DT_REG_ADDR(node_id)), \ + &SCMI_PROTOCOL_NAME(DT_REG_ADDR_RAW(node_id)), \ config, level, prio, api) /** @@ -247,7 +247,7 @@ */ #define DT_SCMI_PROTOCOL_DEFINE_NODEV(node_id, data) \ DT_SCMI_TRANSPORT_CHANNELS_DECLARE(node_id) \ - DT_SCMI_PROTOCOL_DATA_DEFINE(node_id, DT_REG_ADDR(node_id), data) + DT_SCMI_PROTOCOL_DATA_DEFINE(node_id, DT_REG_ADDR_RAW(node_id), data) /** * @brief Create an SCMI message field diff --git a/include/zephyr/drivers/mipi_dbi.h b/include/zephyr/drivers/mipi_dbi.h index c2d52c77e0e0c..5dbbfce90aa48 100644 --- a/include/zephyr/drivers/mipi_dbi.h +++ b/include/zephyr/drivers/mipi_dbi.h @@ -63,7 +63,7 @@ extern "C" { .cs = { \ .gpio = GPIO_DT_SPEC_GET_BY_IDX_OR(DT_PHANDLE(DT_PARENT(node_id), \ spi_dev), cs_gpios, \ - DT_REG_ADDR(node_id), \ + DT_REG_ADDR_RAW(node_id), \ {}), \ .delay = (delay_), \ }, \ diff --git a/include/zephyr/drivers/mspi/devicetree.h b/include/zephyr/drivers/mspi/devicetree.h index c720071c52f08..a3e5b65319e0c 100644 --- a/include/zephyr/drivers/mspi/devicetree.h +++ b/include/zephyr/drivers/mspi/devicetree.h @@ -212,7 +212,8 @@ extern "C" { * @return #gpio_dt_spec struct corresponding with mspi_dev's chip enable */ #define MSPI_DEV_CE_GPIOS_DT_SPEC_GET(mspi_dev) \ - GPIO_DT_SPEC_GET_BY_IDX_OR(DT_BUS(mspi_dev), ce_gpios, DT_REG_ADDR(mspi_dev), {}) + GPIO_DT_SPEC_GET_BY_IDX_OR(DT_BUS(mspi_dev), ce_gpios, \ + DT_REG_ADDR_RAW(mspi_dev), {}) /** * @brief Get a struct gpio_dt_spec for a MSPI device's chip enable pin diff --git a/include/zephyr/drivers/spi.h b/include/zephyr/drivers/spi.h index 958211e8294d0..d344a73c562e4 100644 --- a/include/zephyr/drivers/spi.h +++ b/include/zephyr/drivers/spi.h @@ -211,7 +211,7 @@ struct spi_cs_control { */ #define SPI_CS_GPIOS_DT_SPEC_GET(spi_dev) \ GPIO_DT_SPEC_GET_BY_IDX_OR(DT_BUS(spi_dev), cs_gpios, \ - DT_REG_ADDR(spi_dev), {}) + DT_REG_ADDR_RAW(spi_dev), {}) /** * @brief Get a struct gpio_dt_spec for a SPI device's chip select pin diff --git a/include/zephyr/sys/device_mmio.h b/include/zephyr/sys/device_mmio.h index 2d1874a35859a..e6971c96ebed6 100644 --- a/include/zephyr/sys/device_mmio.h +++ b/include/zephyr/sys/device_mmio.h @@ -63,13 +63,13 @@ struct z_device_mmio_rom { #define Z_DEVICE_MMIO_ROM_INITIALIZER(node_id) \ { \ - .phys_addr = UINT32_C(DT_REG_ADDR(node_id)), \ + .phys_addr = DT_REG_ADDR(node_id), \ .size = DT_REG_SIZE(node_id) \ } #define Z_DEVICE_MMIO_NAMED_ROM_INITIALIZER(name, node_id) \ { \ - .phys_addr = UINT32_C(DT_REG_ADDR_BY_NAME(node_id, name)), \ + .phys_addr = DT_REG_ADDR_BY_NAME(node_id, name), \ .size = DT_REG_SIZE_BY_NAME(node_id, name) \ } diff --git a/tests/lib/devicetree/api/src/main.c b/tests/lib/devicetree/api/src/main.c index 9de03524d8aeb..60a79d68f399a 100644 --- a/tests/lib/devicetree/api/src/main.c +++ b/tests/lib/devicetree/api/src/main.c @@ -2948,7 +2948,7 @@ ZTEST(devicetree_api, test_fixed_partitions) * Test this by way of string comparison. */ zassert_true(!strcmp(TO_STRING(DT_FIXED_PARTITION_ADDR(TEST_PARTITION_2)), - "(__REG_IDX_0_VAL_ADDRESS + 458624)")); + "(__REG_IDX_0_VAL_ADDRESSU + 458624U)")); zassert_equal(DT_REG_ADDR(TEST_PARTITION_2), 458624); /* Test that all DT_FIXED_PARTITION_ID are defined and unique. */ From fc0437c0b806f3ffb02fc840048d5288a55e4aeb Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Thu, 4 Jul 2024 12:26:13 +0200 Subject: [PATCH 0162/4482] doc: usb: move "Built-in functions" down and increase the heading Move "Built-in functions" section down and increase the heading. Signed-off-by: Johann Fischer --- .../usb/device_next/usb_device.rst | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/doc/connectivity/usb/device_next/usb_device.rst b/doc/connectivity/usb/device_next/usb_device.rst index 1213c85fb51d7..ea6eb69324c8b 100644 --- a/doc/connectivity/usb/device_next/usb_device.rst +++ b/doc/connectivity/usb/device_next/usb_device.rst @@ -23,31 +23,6 @@ classes and provides an API to implement custom USB functions. The new USB device support is considered experimental and will replace :ref:`usb_device_stack`. -Built-in functions -================== - -The USB device stack has built-in USB functions. Some can be used directly in -the user application through a special API, such as HID or Audio class devices, -while others use a general Zephyr RTOS driver API, such as MSC and CDC class -implementations. The *Identification string* identifies a class or function -instance (``n``) and is used as an argument to the :c:func:`usbd_register_class`. - -+-----------------------------------+-------------------------+-------------------------+ -| Class or function | User API (if any) | Identification string | -+===================================+=========================+=========================+ -| USB Audio 2 class | :ref:`uac2_device` | :samp:`uac2_{n}` | -+-----------------------------------+-------------------------+-------------------------+ -| USB CDC ACM class | :ref:`uart_api` | :samp:`cdc_acm_{n}` | -+-----------------------------------+-------------------------+-------------------------+ -| USB CDC ECM class | Ethernet device | :samp:`cdc_ecm_{n}` | -+-----------------------------------+-------------------------+-------------------------+ -| USB Mass Storage Class (MSC) | :ref:`usbd_msc_device` | :samp:`msc_{n}` | -+-----------------------------------+-------------------------+-------------------------+ -| USB Human Interface Devices (HID) | :ref:`usbd_hid_device` | :samp:`hid_{n}` | -+-----------------------------------+-------------------------+-------------------------+ -| Bluetooth HCI USB transport layer | :ref:`bt_hci_raw` | :samp:`bt_hci_{n}` | -+-----------------------------------+-------------------------+-------------------------+ - Samples ======= @@ -223,3 +198,28 @@ for this capability. :dedent: :start-after: doc device msg-cb start :end-before: doc device msg-cb end + +Built-in functions +****************** + +The USB device stack has built-in USB functions. Some can be used directly in +the user application through a special API, such as HID or Audio class devices, +while others use a general Zephyr RTOS driver API, such as MSC and CDC class +implementations. The *Identification string* identifies a class or function +instance (``n``) and is used as an argument to the :c:func:`usbd_register_class`. + ++-----------------------------------+-------------------------+-------------------------+ +| Class or function | User API (if any) | Identification string | ++===================================+=========================+=========================+ +| USB Audio 2 class | :ref:`uac2_device` | :samp:`uac2_{n}` | ++-----------------------------------+-------------------------+-------------------------+ +| USB CDC ACM class | :ref:`uart_api` | :samp:`cdc_acm_{n}` | ++-----------------------------------+-------------------------+-------------------------+ +| USB CDC ECM class | Ethernet device | :samp:`cdc_ecm_{n}` | ++-----------------------------------+-------------------------+-------------------------+ +| USB Mass Storage Class (MSC) | :ref:`usbd_msc_device` | :samp:`msc_{n}` | ++-----------------------------------+-------------------------+-------------------------+ +| USB Human Interface Devices (HID) | :ref:`usbd_hid_device` | :samp:`hid_{n}` | ++-----------------------------------+-------------------------+-------------------------+ +| Bluetooth HCI USB transport layer | :ref:`bt_hci_raw` | :samp:`bt_hci_{n}` | ++-----------------------------------+-------------------------+-------------------------+ From 64ee885950434e086c067891790ae8c579656c6a Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Thu, 4 Jul 2024 12:32:47 +0200 Subject: [PATCH 0163/4482] usb: device_next: align CDC ACM UART with Interrupt-driven UART API Align CDC ACM UART with Interrupt-driven UART API behavior description. Use the same flags in uart_irq_rx_ready(), uart_irq_tx_ready(), and uart_irq_is_pending(), which are updated after each uart_irq_update() call. Allow TX FIFO to be filled if there is space. Signed-off-by: Johann Fischer --- subsys/usb/device_next/class/usbd_cdc_acm.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/subsys/usb/device_next/class/usbd_cdc_acm.c b/subsys/usb/device_next/class/usbd_cdc_acm.c index acb17ed446f40..83735e202a63a 100644 --- a/subsys/usb/device_next/class/usbd_cdc_acm.c +++ b/subsys/usb/device_next/class/usbd_cdc_acm.c @@ -269,7 +269,7 @@ static void usbd_cdc_acm_enable(struct usbd_class_data *const c_data) } if (atomic_test_bit(&data->state, CDC_ACM_IRQ_TX_ENABLED)) { - if (ring_buf_is_empty(data->tx_fifo.rb)) { + if (ring_buf_space_get(data->tx_fifo.rb)) { /* Raise TX ready interrupt */ cdc_acm_work_submit(&data->irq_cb_work); } else { @@ -613,7 +613,7 @@ static void cdc_acm_irq_tx_enable(const struct device *dev) atomic_set_bit(&data->state, CDC_ACM_IRQ_TX_ENABLED); - if (ring_buf_is_empty(data->tx_fifo.rb)) { + if (ring_buf_space_get(data->tx_fifo.rb)) { LOG_INF("tx_en: trigger irq_cb_work"); cdc_acm_work_submit(&data->irq_cb_work); } @@ -707,7 +707,9 @@ static int cdc_acm_irq_tx_ready(const struct device *dev) struct cdc_acm_uart_data *const data = dev->data; if (check_wq_ctx(dev)) { - return ring_buf_space_get(data->tx_fifo.rb); + if (data->tx_fifo.irq) { + return ring_buf_space_get(data->tx_fifo.rb); + } } else { LOG_WRN("Invoked by inappropriate context"); __ASSERT_NO_MSG(false); @@ -721,7 +723,7 @@ static int cdc_acm_irq_rx_ready(const struct device *dev) struct cdc_acm_uart_data *const data = dev->data; if (check_wq_ctx(dev)) { - if (!ring_buf_is_empty(data->rx_fifo.rb)) { + if (data->rx_fifo.irq) { return 1; } } else { @@ -767,7 +769,7 @@ static int cdc_acm_irq_update(const struct device *dev) } if (atomic_test_bit(&data->state, CDC_ACM_IRQ_TX_ENABLED) && - ring_buf_is_empty(data->tx_fifo.rb)) { + ring_buf_space_get(data->tx_fifo.rb)) { data->tx_fifo.irq = true; } else { data->tx_fifo.irq = false; @@ -834,7 +836,7 @@ static void cdc_acm_irq_cb_handler(struct k_work *work) } if (atomic_test_bit(&data->state, CDC_ACM_IRQ_TX_ENABLED) && - ring_buf_is_empty(data->tx_fifo.rb)) { + ring_buf_space_get(data->tx_fifo.rb)) { LOG_DBG("tx irq pending, submit irq_cb_work"); cdc_acm_work_submit(&data->irq_cb_work); } From 1867e71df26f23c8897a998e7f8945b04f1bbdf5 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Thu, 4 Jul 2024 12:47:06 +0200 Subject: [PATCH 0164/4482] doc: usb: describe CDC ACM virtual UART IRQ API behavior In general, it mirrors what is described in Interrupt-driven API documentation, but here a little more explicitly and with a simplified example, so that we can finally chisel it into the stone. Signed-off-by: Johann Fischer --- .../usb/device_next/usb_device.rst | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/doc/connectivity/usb/device_next/usb_device.rst b/doc/connectivity/usb/device_next/usb_device.rst index ea6eb69324c8b..d658c75180a12 100644 --- a/doc/connectivity/usb/device_next/usb_device.rst +++ b/doc/connectivity/usb/device_next/usb_device.rst @@ -223,3 +223,62 @@ instance (``n``) and is used as an argument to the :c:func:`usbd_register_class` +-----------------------------------+-------------------------+-------------------------+ | Bluetooth HCI USB transport layer | :ref:`bt_hci_raw` | :samp:`bt_hci_{n}` | +-----------------------------------+-------------------------+-------------------------+ + +CDC ACM UART +============ + +CDC ACM implements a virtual UART controller and provides Interrupt-driven UART +API and Polling UART API. + +Interrupt-driven UART API +------------------------- + +Internally the implementation uses two ringbuffers, these take over the +function of the TX/RX FIFOs (TX/RX buffers) from the :ref:`uart_interrupt_api`. + +As described in the :ref:`uart_interrupt_api`, the functions +:c:func:`uart_irq_update()`, :c:func:`uart_irq_is_pending`, +:c:func:`uart_irq_rx_ready()`, :c:func:`uart_irq_tx_ready()` +:c:func:`uart_fifo_read()`, and :c:func:`uart_fifo_fill()` +should be called from the interrupt handler, see +:c:func:`uart_irq_callback_user_data_set()`. To prevent undefined behaviour, +the implementation of these functions checks in what context they are called +and fails if it is not an interrupt handler. + +Also, as described in the UART API, :c:func:`uart_irq_is_pending` +:c:func:`uart_irq_rx_ready()`, and :c:func:`uart_irq_tx_ready()` +can only be called after :c:func:`uart_irq_update()`. + +Simplified, the interrupt handler should look something like: + +.. code-block:: c + + static void interrupt_handler(const struct device *dev, void *user_data) + { + while (uart_irq_update(dev) && uart_irq_is_pending(dev)) { + if (uart_irq_rx_ready(dev)) { + int len; + int n; + + /* ... */ + n = uart_fifo_read(dev, buffer, len); + /* ... */ + } + + if (uart_irq_tx_ready(dev)) { + int len; + int n; + + /* ... */ + n = uart_fifo_fill(dev, buffer, len); + /* ... */ + } + } + +All these functions are not directly dependent on the status of the USB device. +Filling the TX FIFO does not mean that data is being sent to the host. And +successfully reading the RX FIFO does not mean that the device is still +connected to the host. If there is space in the TX FIFO, and the TX interrupt +is enabled, :c:func:`uart_irq_tx_ready()` will succeed. If there is data in the +RX FIFO, and the RX interrupt is enabled, :c:func:`uart_irq_rx_ready()` will +succeed. Function :c:func:`uart_irq_tx_complete()` is not implemented yet. From 6cf27758d3dca90464779438f9dbb31d578118b7 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Fri, 5 Jul 2024 11:52:24 +0200 Subject: [PATCH 0165/4482] usb: device_next: align CDC ACM UART poll_out with legacy implementation Apply changes in commit c152e0980cf6 ("usb: device: cdc_acm: block in uart_poll_out() routine") to the new CDC ACM UART poll_out implementation. Signed-off-by: Johann Fischer --- subsys/usb/device_next/class/usbd_cdc_acm.c | 52 ++++++++++++--------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/subsys/usb/device_next/class/usbd_cdc_acm.c b/subsys/usb/device_next/class/usbd_cdc_acm.c index 83735e202a63a..36154e163131d 100644 --- a/subsys/usb/device_next/class/usbd_cdc_acm.c +++ b/subsys/usb/device_next/class/usbd_cdc_acm.c @@ -105,6 +105,10 @@ struct cdc_acm_uart_data { struct k_work irq_cb_work; struct cdc_acm_uart_fifo rx_fifo; struct cdc_acm_uart_fifo tx_fifo; + /* When flow_ctrl is set, poll out is blocked when the buffer is full, + * roughly emulating flow control. + */ + bool flow_ctrl; /* USBD CDC ACM TX fifo work */ struct k_work tx_fifo_work; /* USBD CDC ACM RX fifo work */ @@ -373,7 +377,8 @@ static void cdc_acm_update_uart_cfg(struct cdc_acm_uart_data *const data) break; }; - cfg->flow_ctrl = UART_CFG_FLOW_CTRL_NONE; + cfg->flow_ctrl = data->flow_ctrl ? UART_CFG_FLOW_CTRL_RTS_CTS : + UART_CFG_FLOW_CTRL_NONE; } static void cdc_acm_update_linestate(struct cdc_acm_uart_data *const data) @@ -884,24 +889,27 @@ static int cdc_acm_poll_in(const struct device *dev, unsigned char *const c) static void cdc_acm_poll_out(const struct device *dev, const unsigned char c) { struct cdc_acm_uart_data *const data = dev->data; + uint32_t wrote; if (atomic_test_and_set_bit(&data->state, CDC_ACM_LOCK)) { LOG_ERR("IRQ callback is used"); return; } - if (ring_buf_put(data->tx_fifo.rb, &c, 1)) { - goto poll_out_exit; - } + while (true) { + wrote = ring_buf_put(data->tx_fifo.rb, &c, 1); + if (wrote == 1) { + break; + } - LOG_DBG("Ring buffer full, drain buffer"); - if (!ring_buf_get(data->tx_fifo.rb, NULL, 1) || - !ring_buf_put(data->tx_fifo.rb, &c, 1)) { - LOG_ERR("Failed to drain buffer"); - __ASSERT_NO_MSG(false); + if (k_is_in_isr() || !data->flow_ctrl) { + LOG_WRN_ONCE("Ring buffer full, discard data"); + break; + } + + k_msleep(1); } -poll_out_exit: atomic_clear_bit(&data->state, CDC_ACM_LOCK); cdc_acm_work_submit(&data->tx_fifo_work); } @@ -976,17 +984,18 @@ static int cdc_acm_line_ctrl_get(const struct device *dev, static int cdc_acm_configure(const struct device *dev, const struct uart_config *const cfg) { - ARG_UNUSED(dev); - ARG_UNUSED(cfg); - /* - * We cannot implement configure API because there is - * no notification of configuration changes provided - * for the Abstract Control Model and the UART controller - * is only emulated. - * However, it allows us to use CDC ACM UART together with - * subsystems like Modbus which require configure API for - * real controllers. - */ + struct cdc_acm_uart_data *const data = dev->data; + + switch (cfg->flow_ctrl) { + case UART_CFG_FLOW_CTRL_NONE: + data->flow_ctrl = false; + break; + case UART_CFG_FLOW_CTRL_RTS_CTS: + data->flow_ctrl = true; + break; + default: + return -ENOTSUP; + } return 0; } @@ -1240,6 +1249,7 @@ const static struct usb_desc_header *cdc_acm_hs_desc_##n[] = { \ .c_data = &cdc_acm_##n, \ .rx_fifo.rb = &cdc_acm_rb_rx_##n, \ .tx_fifo.rb = &cdc_acm_rb_tx_##n, \ + .flow_ctrl = DT_INST_PROP(n, hw_flow_control), \ .notif_sem = Z_SEM_INITIALIZER(uart_data_##n.notif_sem, 0, 1), \ .desc = &cdc_acm_desc_##n, \ .fs_desc = cdc_acm_fs_desc_##n, \ From ef89321160d092644ed9efa5e30f2ff92ce809a2 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Fri, 5 Jul 2024 13:41:46 +0200 Subject: [PATCH 0166/4482] usb: device_next: allow fifo_fill and poll_out be used simultaneously As it is still accepted practice, allow fifo_fill and poll_out to be used simultaneously. The lock around fifo_fill was already in place. Signed-off-by: Johann Fischer --- subsys/usb/device_next/class/usbd_cdc_acm.c | 39 ++++----------------- 1 file changed, 6 insertions(+), 33 deletions(-) diff --git a/subsys/usb/device_next/class/usbd_cdc_acm.c b/subsys/usb/device_next/class/usbd_cdc_acm.c index 36154e163131d..e67b27ad03733 100644 --- a/subsys/usb/device_next/class/usbd_cdc_acm.c +++ b/subsys/usb/device_next/class/usbd_cdc_acm.c @@ -47,7 +47,6 @@ UDC_BUF_POOL_DEFINE(cdc_acm_ep_pool, #define CDC_ACM_IRQ_RX_ENABLED 2 #define CDC_ACM_IRQ_TX_ENABLED 3 #define CDC_ACM_RX_FIFO_BUSY 4 -#define CDC_ACM_LOCK 5 static struct k_work_q cdc_acm_work_q; static K_KERNEL_STACK_DEFINE(cdc_acm_stack, @@ -540,15 +539,10 @@ static void cdc_acm_tx_fifo_handler(struct k_work *work) return; } - if (atomic_test_and_set_bit(&data->state, CDC_ACM_LOCK)) { - cdc_acm_work_submit(&data->tx_fifo_work); - return; - } - buf = cdc_acm_buf_alloc(cdc_acm_get_bulk_in(c_data)); if (buf == NULL) { cdc_acm_work_submit(&data->tx_fifo_work); - goto tx_fifo_handler_exit; + return; } len = ring_buf_get(data->tx_fifo.rb, buf->data, buf->size); @@ -559,9 +553,6 @@ static void cdc_acm_tx_fifo_handler(struct k_work *work) LOG_ERR("Failed to enqueue"); net_buf_unref(buf); } - -tx_fifo_handler_exit: - atomic_clear_bit(&data->state, CDC_ACM_LOCK); } /* @@ -808,12 +799,6 @@ static void cdc_acm_irq_cb_handler(struct k_work *work) return; } - if (atomic_test_and_set_bit(&data->state, CDC_ACM_LOCK)) { - LOG_ERR("Polling is in progress"); - cdc_acm_work_submit(&data->irq_cb_work); - return; - } - data->tx_fifo.altered = false; data->rx_fifo.altered = false; data->rx_fifo.irq = false; @@ -845,8 +830,6 @@ static void cdc_acm_irq_cb_handler(struct k_work *work) LOG_DBG("tx irq pending, submit irq_cb_work"); cdc_acm_work_submit(&data->irq_cb_work); } - - atomic_clear_bit(&data->state, CDC_ACM_LOCK); } static void cdc_acm_irq_callback_set(const struct device *dev, @@ -865,13 +848,8 @@ static int cdc_acm_poll_in(const struct device *dev, unsigned char *const c) uint32_t len; int ret = -1; - if (atomic_test_and_set_bit(&data->state, CDC_ACM_LOCK)) { - LOG_ERR("IRQ callback is used"); - return -1; - } - if (ring_buf_is_empty(data->rx_fifo.rb)) { - goto poll_in_exit; + return ret; } len = ring_buf_get(data->rx_fifo.rb, c, 1); @@ -880,24 +858,20 @@ static int cdc_acm_poll_in(const struct device *dev, unsigned char *const c) ret = 0; } -poll_in_exit: - atomic_clear_bit(&data->state, CDC_ACM_LOCK); - return ret; } static void cdc_acm_poll_out(const struct device *dev, const unsigned char c) { struct cdc_acm_uart_data *const data = dev->data; + unsigned int lock; uint32_t wrote; - if (atomic_test_and_set_bit(&data->state, CDC_ACM_LOCK)) { - LOG_ERR("IRQ callback is used"); - return; - } - while (true) { + lock = irq_lock(); wrote = ring_buf_put(data->tx_fifo.rb, &c, 1); + irq_unlock(lock); + if (wrote == 1) { break; } @@ -910,7 +884,6 @@ static void cdc_acm_poll_out(const struct device *dev, const unsigned char c) k_msleep(1); } - atomic_clear_bit(&data->state, CDC_ACM_LOCK); cdc_acm_work_submit(&data->tx_fifo_work); } From ece1f51c5b10842680303515a2795125375c7123 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Fri, 5 Jul 2024 13:49:25 +0200 Subject: [PATCH 0167/4482] doc: usb: add note about CDC ACM virtual UART polling API behavior Add note about CDC ACM virtual UART polling API behavior. Signed-off-by: Johann Fischer --- doc/connectivity/usb/device_next/usb_device.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/connectivity/usb/device_next/usb_device.rst b/doc/connectivity/usb/device_next/usb_device.rst index d658c75180a12..7e7762997a011 100644 --- a/doc/connectivity/usb/device_next/usb_device.rst +++ b/doc/connectivity/usb/device_next/usb_device.rst @@ -282,3 +282,10 @@ connected to the host. If there is space in the TX FIFO, and the TX interrupt is enabled, :c:func:`uart_irq_tx_ready()` will succeed. If there is data in the RX FIFO, and the RX interrupt is enabled, :c:func:`uart_irq_rx_ready()` will succeed. Function :c:func:`uart_irq_tx_complete()` is not implemented yet. + +Polling UART API +---------------- + +The CDC ACM poll out implementation follows :ref:`uart_polling_api` and +blocks when the TX FIFO is full only if the hw-flow-control property is enabled +and called from a non-ISR context. From 4875aa392443cf2dca5426fcc7123b84bf3258ee Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Mon, 9 Sep 2024 17:01:08 +0200 Subject: [PATCH 0168/4482] usb: device_next: limit CDC ACM OUT transfer size to the current MPS When the controller is connected to a full speed bus, regardless of whether the controller supports high speed or not, the transfer size for the bulk OUT endpoint should be equal to the MPS in the current configuration. Signed-off-by: Johann Fischer --- subsys/usb/device_next/class/usbd_cdc_acm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/subsys/usb/device_next/class/usbd_cdc_acm.c b/subsys/usb/device_next/class/usbd_cdc_acm.c index e67b27ad03733..1d683fa3cc465 100644 --- a/subsys/usb/device_next/class/usbd_cdc_acm.c +++ b/subsys/usb/device_next/class/usbd_cdc_acm.c @@ -596,6 +596,9 @@ static void cdc_acm_rx_fifo_handler(struct k_work *work) return; } + /* Shrink the buffer size if operating on a full speed bus */ + buf->size = MIN(cdc_acm_get_bulk_mps(c_data), buf->size); + ret = usbd_ep_enqueue(c_data, buf); if (ret) { LOG_ERR("Failed to enqueue net_buf for 0x%02x", ep); From fe4d8a678c56127b8e74830da4f8035c394d832c Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Mon, 9 Sep 2024 13:23:50 +0200 Subject: [PATCH 0169/4482] usb: device_next: use delayable work for TX FIFO in CDC ACM Use delayable work to reduce CPU load when there is no transfer flow in the host direction. This also improves the performance of poll out, as introduced in commit commit fed6bde78852 ("usb: device: cdc_acm: send more than 1 byte in poll out") for the legacy CDC ACM implementation. Signed-off-by: Johann Fischer --- subsys/usb/device_next/class/usbd_cdc_acm.c | 25 +++++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/subsys/usb/device_next/class/usbd_cdc_acm.c b/subsys/usb/device_next/class/usbd_cdc_acm.c index 1d683fa3cc465..80f4a858386ed 100644 --- a/subsys/usb/device_next/class/usbd_cdc_acm.c +++ b/subsys/usb/device_next/class/usbd_cdc_acm.c @@ -109,7 +109,7 @@ struct cdc_acm_uart_data { */ bool flow_ctrl; /* USBD CDC ACM TX fifo work */ - struct k_work tx_fifo_work; + struct k_work_delayable tx_fifo_work; /* USBD CDC ACM RX fifo work */ struct k_work rx_fifo_work; atomic_t state; @@ -140,6 +140,12 @@ static ALWAYS_INLINE int cdc_acm_work_submit(struct k_work *work) return k_work_submit_to_queue(&cdc_acm_work_q, work); } +static ALWAYS_INLINE int cdc_acm_work_schedule(struct k_work_delayable *work, + k_timeout_t delay) +{ + return k_work_schedule_for_queue(&cdc_acm_work_q, work, delay); +} + static ALWAYS_INLINE bool check_wq_ctx(const struct device *dev) { return k_current_get() == k_work_queue_thread_get(&cdc_acm_work_q); @@ -277,7 +283,7 @@ static void usbd_cdc_acm_enable(struct usbd_class_data *const c_data) cdc_acm_work_submit(&data->irq_cb_work); } else { /* Queue pending TX data on IN endpoint */ - cdc_acm_work_submit(&data->tx_fifo_work); + cdc_acm_work_schedule(&data->tx_fifo_work, K_NO_WAIT); } } } @@ -520,13 +526,14 @@ static int cdc_acm_send_notification(const struct device *dev, */ static void cdc_acm_tx_fifo_handler(struct k_work *work) { + struct k_work_delayable *dwork = k_work_delayable_from_work(work); struct cdc_acm_uart_data *data; struct usbd_class_data *c_data; struct net_buf *buf; size_t len; int ret; - data = CONTAINER_OF(work, struct cdc_acm_uart_data, tx_fifo_work); + data = CONTAINER_OF(dwork, struct cdc_acm_uart_data, tx_fifo_work); c_data = data->c_data; if (!atomic_test_bit(&data->state, CDC_ACM_CLASS_ENABLED)) { @@ -541,7 +548,7 @@ static void cdc_acm_tx_fifo_handler(struct k_work *work) buf = cdc_acm_buf_alloc(cdc_acm_get_bulk_in(c_data)); if (buf == NULL) { - cdc_acm_work_submit(&data->tx_fifo_work); + cdc_acm_work_schedule(&data->tx_fifo_work, K_MSEC(1)); return; } @@ -819,7 +826,7 @@ static void cdc_acm_irq_cb_handler(struct k_work *work) if (data->tx_fifo.altered) { LOG_DBG("tx fifo altered, submit work"); - cdc_acm_work_submit(&data->tx_fifo_work); + cdc_acm_work_schedule(&data->tx_fifo_work, K_NO_WAIT); } if (atomic_test_bit(&data->state, CDC_ACM_IRQ_RX_ENABLED) && @@ -887,7 +894,11 @@ static void cdc_acm_poll_out(const struct device *dev, const unsigned char c) k_msleep(1); } - cdc_acm_work_submit(&data->tx_fifo_work); + /* Schedule with minimal timeout to make it possible to send more than + * one byte per USB transfer. The latency increase is negligible while + * the increased throughput and reduced CPU usage is easily observable. + */ + cdc_acm_work_schedule(&data->tx_fifo_work, K_MSEC(1)); } #ifdef CONFIG_UART_LINE_CTRL @@ -1006,7 +1017,7 @@ static int usbd_cdc_acm_preinit(const struct device *dev) k_thread_name_set(&cdc_acm_work_q.thread, "cdc_acm_work_q"); - k_work_init(&data->tx_fifo_work, cdc_acm_tx_fifo_handler); + k_work_init_delayable(&data->tx_fifo_work, cdc_acm_tx_fifo_handler); k_work_init(&data->rx_fifo_work, cdc_acm_rx_fifo_handler); k_work_init(&data->irq_cb_work, cdc_acm_irq_cb_handler); From 0f0322127df5579cd3663f87039207dc7595dad1 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Wed, 11 Sep 2024 12:57:18 +0200 Subject: [PATCH 0170/4482] usb: device: avoid starving other threads in CDC ACM UART fifo_fill The check for the device being configured or suspended in the fifo_fill implementation can starve other threads, because the early return does not change the state of the TX path, and fifo_fill is called again from the callback loop. The ringbuffer that emulates the TX FIFO can be filled and marked ready as long as the space is available. Signed-off-by: Johann Fischer --- subsys/usb/device/class/cdc_acm.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/subsys/usb/device/class/cdc_acm.c b/subsys/usb/device/class/cdc_acm.c index 5cc73f7bae991..2616f98f4e144 100644 --- a/subsys/usb/device/class/cdc_acm.c +++ b/subsys/usb/device/class/cdc_acm.c @@ -526,19 +526,18 @@ static int cdc_acm_fifo_fill(const struct device *dev, LOG_DBG("dev_data %p len %d tx_ringbuf space %u", dev_data, len, ring_buf_space_get(dev_data->tx_ringbuf)); - if (!dev_data->configured || dev_data->suspended) { - LOG_INF("Device suspended or not configured"); - return 0; - } - - dev_data->tx_ready = false; - lock = irq_lock(); wrote = ring_buf_put(dev_data->tx_ringbuf, tx_data, len); irq_unlock(lock); LOG_DBG("Wrote %zu of %d bytes to TX ringbuffer", wrote, len); - k_work_schedule_for_queue(&USB_WORK_Q, &dev_data->tx_work, K_NO_WAIT); + if (!ring_buf_space_get(dev_data->tx_ringbuf)) { + dev_data->tx_ready = false; + } + + if (wrote) { + k_work_schedule_for_queue(&USB_WORK_Q, &dev_data->tx_work, K_NO_WAIT); + } /* Return written to ringbuf data len */ return wrote; From c5a31aec3c6acd2e3d7d4f34dec97d2961a3eb72 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Wed, 11 Sep 2024 13:57:28 +0200 Subject: [PATCH 0171/4482] usb: device: cleanup CDC ACM UART rx_ready, tx_ready and is_pending Align the irq_tx_ready and irq_rx_ready implementations and use them from irq_rx_pending. Signed-off-by: Johann Fischer --- subsys/usb/device/class/cdc_acm.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/subsys/usb/device/class/cdc_acm.c b/subsys/usb/device/class/cdc_acm.c index 2616f98f4e144..97711a00f2870 100644 --- a/subsys/usb/device/class/cdc_acm.c +++ b/subsys/usb/device/class/cdc_acm.c @@ -666,7 +666,7 @@ static int cdc_acm_irq_rx_ready(const struct device *dev) { struct cdc_acm_dev_data_t * const dev_data = dev->data; - if (dev_data->rx_ready) { + if (dev_data->rx_ready && dev_data->rx_irq_ena) { return 1; } @@ -682,15 +682,11 @@ static int cdc_acm_irq_rx_ready(const struct device *dev) */ static int cdc_acm_irq_is_pending(const struct device *dev) { - struct cdc_acm_dev_data_t * const dev_data = dev->data; - - if (dev_data->tx_ready && dev_data->tx_irq_ena) { + if (cdc_acm_irq_rx_ready(dev) || cdc_acm_irq_tx_ready(dev)) { return 1; - } else if (dev_data->rx_ready && dev_data->rx_irq_ena) { - return 1; - } else { - return 0; } + + return 0; } /** From b79ffe35820cf50c52195f37465723b5e1097921 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Wed, 11 Sep 2024 15:08:22 +0200 Subject: [PATCH 0172/4482] usb: device: use irq_update in CDC ACM UART implementation Move the TX/RX ready flag updates into irq_update() where they belong. Signed-off-by: Johann Fischer --- subsys/usb/device/class/cdc_acm.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/subsys/usb/device/class/cdc_acm.c b/subsys/usb/device/class/cdc_acm.c index 97711a00f2870..417a35f07144a 100644 --- a/subsys/usb/device/class/cdc_acm.c +++ b/subsys/usb/device/class/cdc_acm.c @@ -531,10 +531,6 @@ static int cdc_acm_fifo_fill(const struct device *dev, irq_unlock(lock); LOG_DBG("Wrote %zu of %d bytes to TX ringbuffer", wrote, len); - if (!ring_buf_space_get(dev_data->tx_ringbuf)) { - dev_data->tx_ready = false; - } - if (wrote) { k_work_schedule_for_queue(&USB_WORK_Q, &dev_data->tx_work, K_NO_WAIT); } @@ -563,10 +559,6 @@ static int cdc_acm_fifo_read(const struct device *dev, uint8_t *rx_data, len = ring_buf_get(dev_data->rx_ringbuf, rx_data, size); - if (ring_buf_is_empty(dev_data->rx_ringbuf)) { - dev_data->rx_ready = false; - } - if (dev_data->rx_paused == true) { if (ring_buf_space_get(dev_data->rx_ringbuf) >= CDC_ACM_BUFFER_SIZE) { struct usb_cfg_data *cfg = (void *)dev->config; @@ -698,7 +690,15 @@ static int cdc_acm_irq_is_pending(const struct device *dev) */ static int cdc_acm_irq_update(const struct device *dev) { - ARG_UNUSED(dev); + struct cdc_acm_dev_data_t * const dev_data = dev->data; + + if (!ring_buf_space_get(dev_data->tx_ringbuf)) { + dev_data->tx_ready = false; + } + + if (ring_buf_is_empty(dev_data->rx_ringbuf)) { + dev_data->rx_ready = false; + } return 1; } From bf9584d6ba8246c4d08fa14b865f8b196986389f Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Thu, 11 Jul 2024 14:36:38 +1000 Subject: [PATCH 0173/4482] fs: add `FILE_SYSTEM_LIB_LINK` option Add an option that links in the underlying file system libraries as usual, but doesn't compile in the Zephyr file system abstraction layer. This can be useful to avoid linking in the entire filesystem implementation through the `fs_file_system_t` API struct if only a subset of the functions are used. Signed-off-by: Jordan Yates --- subsys/fs/CMakeLists.txt | 24 +++++++++++++----------- subsys/fs/Kconfig | 11 +++++++++++ 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/subsys/fs/CMakeLists.txt b/subsys/fs/CMakeLists.txt index fb774711543a7..574f9b26c923a 100644 --- a/subsys/fs/CMakeLists.txt +++ b/subsys/fs/CMakeLists.txt @@ -1,18 +1,20 @@ # SPDX-License-Identifier: Apache-2.0 -if(CONFIG_FILE_SYSTEM) +if(CONFIG_FILE_SYSTEM_LIB_LINK) zephyr_interface_library_named(FS) - zephyr_library() - zephyr_library_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - zephyr_library_sources(fs.c fs_impl.c) - zephyr_library_sources_ifdef(CONFIG_FAT_FILESYSTEM_ELM fat_fs.c) - zephyr_library_sources_ifdef(CONFIG_FILE_SYSTEM_LITTLEFS littlefs_fs.c) - zephyr_library_sources_ifdef(CONFIG_FILE_SYSTEM_SHELL shell.c) - - zephyr_library_compile_definitions_ifdef(CONFIG_FILE_SYSTEM_LITTLEFS - LFS_CONFIG=zephyr_lfs_config.h - ) + if(CONFIG_FILE_SYSTEM) + zephyr_library() + zephyr_library_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + zephyr_library_sources(fs.c fs_impl.c) + zephyr_library_sources_ifdef(CONFIG_FAT_FILESYSTEM_ELM fat_fs.c) + zephyr_library_sources_ifdef(CONFIG_FILE_SYSTEM_LITTLEFS littlefs_fs.c) + zephyr_library_sources_ifdef(CONFIG_FILE_SYSTEM_SHELL shell.c) + + zephyr_library_compile_definitions_ifdef(CONFIG_FILE_SYSTEM_LITTLEFS + LFS_CONFIG=zephyr_lfs_config.h + ) + endif() add_subdirectory_ifdef(CONFIG_FILE_SYSTEM_EXT2 ext2) diff --git a/subsys/fs/Kconfig b/subsys/fs/Kconfig index 0a20aea7ee8a4..af92a9bab9a9e 100644 --- a/subsys/fs/Kconfig +++ b/subsys/fs/Kconfig @@ -4,8 +4,19 @@ menu "File Systems" +config FILE_SYSTEM_LIB_LINK + bool "Link file system libraries into build" + help + Link in the underlying file system libraries. This can be + enabled without CONFIG_FILE_SYSTEM to enable applications + to work directly with the underlying file system libraries. + This can be useful to avoid linking in the entire filesystem + implementation via `struct fs_file_system_t` if only a subset + is used. + config FILE_SYSTEM bool "File system support" + select FILE_SYSTEM_LIB_LINK help Enables support for file system. From aeec014cbe5ff4d93b128fb6f218c41965ffac3b Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Tue, 1 Oct 2024 12:33:16 +0200 Subject: [PATCH 0174/4482] llext: rename symbol struct identifiers This patch renames the identifiers for the structs in the LLEXT symbol tables to have a prefix of "__llext_sym_". This is done so existing scripts like gen_device_deps.py do not confuse them with the object they are referring to. Signed-off-by: Luca Burelli --- include/zephyr/llext/symbol.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/zephyr/llext/symbol.h b/include/zephyr/llext/symbol.h index 880cb4f8ec3ef..109586709fe3d 100644 --- a/include/zephyr/llext/symbol.h +++ b/include/zephyr/llext/symbol.h @@ -93,7 +93,7 @@ struct llext_symtable { #define Z_LL_EXTENSION_SYMBOL(x) \ static const struct llext_const_symbol \ Z_GENERIC_SECTION(".exported_sym") __used \ - x ## _sym = { \ + __llext_sym_ ## x = { \ .name = STRINGIFY(x), .addr = (const void *)&x, \ } #else @@ -124,13 +124,15 @@ struct llext_symtable { #define Z_EXPORT_SYMBOL(x) \ static const char Z_GENERIC_SECTION("llext_exports_strtab") __used \ x ## _sym_name[] = STRINGIFY(x); \ - static const STRUCT_SECTION_ITERABLE(llext_const_symbol, x ## _sym) = { \ + static const STRUCT_SECTION_ITERABLE(llext_const_symbol, \ + __llext_sym_ ## x) = { \ .name = x ## _sym_name, .addr = (const void *)&x, \ } #elif defined(CONFIG_LLEXT) /* LLEXT application: export symbols */ #define Z_EXPORT_SYMBOL(x) \ - static const STRUCT_SECTION_ITERABLE(llext_const_symbol, x ## _sym) = { \ + static const STRUCT_SECTION_ITERABLE(llext_const_symbol, \ + __llext_sym_ ## x) = { \ .name = STRINGIFY(x), .addr = (const void *)&x, \ } #else From bce51b77068829600d781023a2a5d34813c7b824 Mon Sep 17 00:00:00 2001 From: Daniel Gaston Ochoa Date: Thu, 19 Sep 2024 07:37:29 +0100 Subject: [PATCH 0175/4482] drivers: spi: stm32h7: avoid unnecessary suspend The SPI stm32 H7 driver always suspends the SPI transaction when finishing the transceive operation. This, according to the stm32 H7 datasheet, must only be done when the SPI master is configured as receive-only, and the driver always configures it as full-duplex. Hence, remove this unnecessary operation for clarify and for a potential reduction in the minimum time between SPI transceive operations. Signed-off-by: Daniel Gaston Ochoa --- drivers/spi/spi_ll_stm32.h | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/spi/spi_ll_stm32.h b/drivers/spi/spi_ll_stm32.h index d0f6ac46dadc2..3b95ce211bce9 100644 --- a/drivers/spi/spi_ll_stm32.h +++ b/drivers/spi/spi_ll_stm32.h @@ -219,26 +219,16 @@ static inline void ll_func_set_fifo_threshold_16bit(SPI_TypeDef *spi) static inline void ll_func_disable_spi(SPI_TypeDef *spi) { #if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_spi) - if (LL_SPI_IsActiveMasterTransfer(spi)) { - LL_SPI_SuspendMasterTransfer(spi); - while (LL_SPI_IsActiveMasterTransfer(spi)) { - /* NOP */ - } - } - - LL_SPI_Disable(spi); - while (LL_SPI_IsEnabled(spi)) { - /* NOP */ - } - /* Flush RX buffer */ while (LL_SPI_IsActiveFlag_RXP(spi)) { (void)LL_SPI_ReceiveData8(spi); } - LL_SPI_ClearFlag_SUSP(spi); -#else - LL_SPI_Disable(spi); #endif /* st_stm32h7_spi */ + LL_SPI_Disable(spi); + + while (LL_SPI_IsEnabled(spi)) { + /* NOP */ + } } #endif /* ZEPHYR_DRIVERS_SPI_SPI_LL_STM32_H_ */ From 9658b7d0d3635370f7718007daab27307438e597 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Mon, 30 Sep 2024 11:11:58 +0200 Subject: [PATCH 0176/4482] samples: Bluetooth: Audio: Avoid uisng K_FOREVER in syswq Several samples used K_FOREVER when allocating buffers in the system workqueue thread, which is prohibited. The samples should rather retry later if TX fails. This is not the ideal solution for the samples, but fixes a bug. Ideally the samples would use a dedicated thread to handle TX, instead of the system workqueue. Signed-off-by: Emil Gydesen --- .../bluetooth/bap_unicast_server/src/main.c | 7 +++++- samples/bluetooth/hap_ha/src/bap_unicast_sr.c | 7 +++++- .../iso_broadcast_benchmark/src/broadcaster.c | 2 +- .../iso_connected_benchmark/src/main.c | 2 +- .../pbp_public_broadcast_source/src/main.c | 16 ++++++++++-- .../bluetooth/tmap_bms/src/cap_initiator.c | 16 ++++++++++-- .../tmap_central/src/cap_initiator.c | 25 +++++++++++-------- 7 files changed, 57 insertions(+), 18 deletions(-) diff --git a/samples/bluetooth/bap_unicast_server/src/main.c b/samples/bluetooth/bap_unicast_server/src/main.c index 5fcf263f8167a..77da4e23d6c55 100644 --- a/samples/bluetooth/bap_unicast_server/src/main.c +++ b/samples/bluetooth/bap_unicast_server/src/main.c @@ -229,7 +229,12 @@ static void audio_timer_timeout(struct k_work *work) for (size_t i = 0; i < configured_source_stream_count; i++) { struct bt_bap_stream *stream = &source_streams[i].stream; - buf = net_buf_alloc(&tx_pool, K_FOREVER); + buf = net_buf_alloc(&tx_pool, K_NO_WAIT); + if (buf == NULL) { + printk("Failed to allocate TX buffer\n"); + /* Break and retry later */ + break; + } net_buf_reserve(buf, BT_ISO_CHAN_SEND_RESERVE); net_buf_add_mem(buf, buf_data, ++source_streams[i].len_to_send); diff --git a/samples/bluetooth/hap_ha/src/bap_unicast_sr.c b/samples/bluetooth/hap_ha/src/bap_unicast_sr.c index c671ad0ccd766..54d096035386d 100644 --- a/samples/bluetooth/hap_ha/src/bap_unicast_sr.c +++ b/samples/bluetooth/hap_ha/src/bap_unicast_sr.c @@ -157,7 +157,12 @@ static void audio_timer_timeout(struct k_work *work) for (size_t i = 0; i < configured_source_stream_count; i++) { struct bt_bap_stream *stream = source_streams[i].stream; - buf = net_buf_alloc(&tx_pool, K_FOREVER); + buf = net_buf_alloc(&tx_pool, K_NO_WAIT); + if (buf == NULL) { + printk("Failed to allocate TX buffer\n"); + /* Break and retry later */ + break; + } net_buf_reserve(buf, BT_ISO_CHAN_SEND_RESERVE); net_buf_add_mem(buf, buf_data, len_to_send); diff --git a/samples/bluetooth/iso_broadcast_benchmark/src/broadcaster.c b/samples/bluetooth/iso_broadcast_benchmark/src/broadcaster.c index 94f334ff54d84..32d5e86ca5f57 100644 --- a/samples/bluetooth/iso_broadcast_benchmark/src/broadcaster.c +++ b/samples/bluetooth/iso_broadcast_benchmark/src/broadcaster.c @@ -589,7 +589,7 @@ static void iso_timer_timeout(struct k_work *work) k_work_reschedule(&iso_send_work, K_USEC(big_create_param.interval - 100)); for (int i = 0; i < big_create_param.num_bis; i++) { - buf = net_buf_alloc(&bis_tx_pool, K_FOREVER); + buf = net_buf_alloc(&bis_tx_pool, K_NO_WAIT); if (buf == NULL) { LOG_ERR("Could not allocate buffer"); return; diff --git a/samples/bluetooth/iso_connected_benchmark/src/main.c b/samples/bluetooth/iso_connected_benchmark/src/main.c index ff694b4a1cfc9..eec884393aaec 100644 --- a/samples/bluetooth/iso_connected_benchmark/src/main.c +++ b/samples/bluetooth/iso_connected_benchmark/src/main.c @@ -202,7 +202,7 @@ static void iso_send(struct bt_iso_chan *chan) interval = (role == ROLE_CENTRAL) ? cig_create_param.c_to_p_interval : cig_create_param.p_to_c_interval; - buf = net_buf_alloc(&tx_pool, K_FOREVER); + buf = net_buf_alloc(&tx_pool, K_NO_WAIT); if (buf == NULL) { LOG_ERR("Could not allocate buffer"); k_work_reschedule(&chan_work->send_work, K_USEC(interval)); diff --git a/samples/bluetooth/pbp_public_broadcast_source/src/main.c b/samples/bluetooth/pbp_public_broadcast_source/src/main.c index e74e3a6bbb029..f2a7ebd81254c 100644 --- a/samples/bluetooth/pbp_public_broadcast_source/src/main.c +++ b/samples/bluetooth/pbp_public_broadcast_source/src/main.c @@ -68,6 +68,7 @@ struct bt_cap_initiator_broadcast_stream_param stream_params; struct bt_cap_initiator_broadcast_subgroup_param subgroup_param; struct bt_cap_initiator_broadcast_create_param create_param; struct bt_cap_broadcast_source *broadcast_source; +static struct k_work_delayable audio_send_work; struct bt_le_ext_adv *ext_adv; static void broadcast_started_cb(struct bt_bap_stream *stream) @@ -110,10 +111,12 @@ static void broadcast_sent_cb(struct bt_bap_stream *stream) mock_data_initialized = true; } - buf = net_buf_alloc(&tx_pool, K_FOREVER); + buf = net_buf_alloc(&tx_pool, K_NO_WAIT); if (buf == NULL) { printk("Could not allocate buffer when sending on %p\n", stream); + /* Retry next SDU interval */ + k_work_schedule(&audio_send_work, K_USEC(broadcast_preset_48_2_1.qos.interval)); return; } @@ -121,13 +124,20 @@ static void broadcast_sent_cb(struct bt_bap_stream *stream) net_buf_add_mem(buf, mock_data, broadcast_preset_48_2_1.qos.sdu); ret = bt_bap_stream_send(stream, buf, seq_num++); if (ret < 0) { - /* This will end broadcasting on this stream. */ + printk("Could not send on %p: %d\n", stream, ret); net_buf_unref(buf); + /* Retry next SDU interval */ + k_work_schedule(&audio_send_work, K_USEC(broadcast_preset_48_2_1.qos.interval)); return; } } +static void audio_timer_timeout(struct k_work *work) +{ + broadcast_sent_cb(&broadcast_stream->bap_stream); +} + static struct bt_bap_stream_ops broadcast_stream_ops = { .started = broadcast_started_cb, .stopped = broadcast_stopped_cb, @@ -319,6 +329,8 @@ int cap_initiator_init(void) bt_bap_stream_cb_register(&broadcast_stream->bap_stream, &broadcast_stream_ops); } + k_work_init_delayable(&audio_send_work, audio_timer_timeout); + return 0; } diff --git a/samples/bluetooth/tmap_bms/src/cap_initiator.c b/samples/bluetooth/tmap_bms/src/cap_initiator.c index e40f66df9e418..e038e13f7e9c7 100644 --- a/samples/bluetooth/tmap_bms/src/cap_initiator.c +++ b/samples/bluetooth/tmap_bms/src/cap_initiator.c @@ -52,6 +52,7 @@ struct bt_cap_initiator_broadcast_stream_param stream_params; struct bt_cap_initiator_broadcast_subgroup_param subgroup_param; struct bt_cap_initiator_broadcast_create_param create_param; struct bt_cap_broadcast_source *broadcast_source; +static struct k_work_delayable audio_send_work; struct bt_le_ext_adv *ext_adv; static uint8_t tmap_addata[] = { @@ -94,9 +95,12 @@ static void broadcast_sent_cb(struct bt_bap_stream *stream) mock_data_initialized = true; } - buf = net_buf_alloc(&tx_pool, K_FOREVER); + buf = net_buf_alloc(&tx_pool, K_NO_WAIT); if (buf == NULL) { printk("Could not allocate buffer when sending on %p\n", stream); + + /* Retry next SDU interval */ + k_work_schedule(&audio_send_work, K_USEC(broadcast_preset_48_2_1.qos.interval)); return; } @@ -104,12 +108,19 @@ static void broadcast_sent_cb(struct bt_bap_stream *stream) net_buf_add_mem(buf, mock_data, broadcast_preset_48_2_1.qos.sdu); ret = bt_bap_stream_send(stream, buf, seq_num++); if (ret < 0) { - /* This will end broadcasting on this stream. */ net_buf_unref(buf); + + /* Retry next SDU interval */ + k_work_schedule(&audio_send_work, K_USEC(broadcast_preset_48_2_1.qos.interval)); return; } } +static void audio_timer_timeout(struct k_work *work) +{ + broadcast_sent_cb(&broadcast_stream->bap_stream); +} + static struct bt_bap_stream_ops broadcast_stream_ops = { .started = broadcast_started_cb, .stopped = broadcast_stopped_cb, @@ -262,6 +273,7 @@ int cap_initiator_init(void) { broadcast_stream = &broadcast_source_stream; bt_bap_stream_cb_register(&broadcast_stream->bap_stream, &broadcast_stream_ops); + k_work_init_delayable(&audio_send_work, audio_timer_timeout); return 0; } diff --git a/samples/bluetooth/tmap_central/src/cap_initiator.c b/samples/bluetooth/tmap_central/src/cap_initiator.c index f37986a26457b..2d31e82c599d0 100644 --- a/samples/bluetooth/tmap_central/src/cap_initiator.c +++ b/samples/bluetooth/tmap_central/src/cap_initiator.c @@ -393,17 +393,22 @@ static void audio_timer_timeout(struct k_work *work) data_initialized = true; } - buf = net_buf_alloc(&tx_pool, K_FOREVER); - net_buf_reserve(buf, BT_ISO_CHAN_SEND_RESERVE); - net_buf_add_mem(buf, buf_data, len_to_send); - buf_to_send = buf; - - ret = bt_bap_stream_send(stream, buf_to_send, 0); - if (ret < 0) { - printk("Failed to send audio data on streams: (%d)\n", ret); - net_buf_unref(buf_to_send); + buf = net_buf_alloc(&tx_pool, K_NO_WAIT); + if (buf != NULL) { + net_buf_reserve(buf, BT_ISO_CHAN_SEND_RESERVE); + net_buf_add_mem(buf, buf_data, len_to_send); + buf_to_send = buf; + + ret = bt_bap_stream_send(stream, buf_to_send, 0); + if (ret < 0) { + printk("Failed to send audio data on streams: (%d)\n", ret); + net_buf_unref(buf_to_send); + } else { + printk("Sending mock data with len %zu\n", len_to_send); + } } else { - printk("Sending mock data with len %zu\n", len_to_send); + printk("Failed to allocate TX buffer\n"); + /* Retry later */ } k_work_schedule(&audio_send_work, K_MSEC(1000)); From 1460ef44192461c13e2b337382675324145dc137 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 30 Sep 2024 13:02:13 +0200 Subject: [PATCH 0177/4482] tests/bsim/compile: Improve cmake_extra_args Allow cmake_extra_args to contain multiple arguments Signed-off-by: Alberto Escolar Piedras --- tests/bsim/compile.source | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/bsim/compile.source b/tests/bsim/compile.source index 3b0e093cd8780..bbf0b8d3b1c0c 100644 --- a/tests/bsim/compile.source +++ b/tests/bsim/compile.source @@ -25,7 +25,7 @@ function _compile(){ default_cmake_args=(-DCONFIG_COVERAGE=y -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ -DCONFIG_COMPILER_WARNINGS_AS_ERRORS=y -DCONFIG_ASSERT=y) local cmake_args=(${cmake_args:-"${default_cmake_args[@]}"}) - local cmake_extra_args="${cmake_extra_args:-""}" + local cmake_extra_args=(${cmake_extra_args:-""}) local ninja_args="${ninja_args:-""}" local cc_flags="${cc_flags:-""}" @@ -61,7 +61,7 @@ function _compile(){ local cmake_cmd+=( -DOVERLAY_CONFIG="${conf_overlay}" \ -DEXTRA_CONF_FILE="${extra_conf_file}" \ ${modules_arg} \ - "${cmake_args[@]}" ${cc_flags:+-DCMAKE_C_FLAGS=${cc_flags}} ${cmake_extra_args}) + "${cmake_args[@]}" ${cc_flags:+-DCMAKE_C_FLAGS=${cc_flags}} "${cmake_extra_args[@]}") if [ -v sysbuild ]; then local cmake_cmd+=( -DAPP_DIR=${app_root}/${app} ${ZEPHYR_BASE}/share/sysbuild/) else From d29f2d547b33dfcc4922770ff6251ec066493fc3 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 30 Sep 2024 13:08:15 +0200 Subject: [PATCH 0178/4482] tests/bsim/bluetooth/audio_samples: Error on warnings Do not override the cmake_args parameter, but instead use the cmake_extra_args one. Otherwise we lose the default -DCONFIG_COMPILER_WARNINGS_AS_ERRORS=y Signed-off-by: Alberto Escolar Piedras --- tests/bsim/bluetooth/audio_samples/compile.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/bsim/bluetooth/audio_samples/compile.sh b/tests/bsim/bluetooth/audio_samples/compile.sh index 59c0f91df2f1d..435a0b27d5f9b 100755 --- a/tests/bsim/bluetooth/audio_samples/compile.sh +++ b/tests/bsim/bluetooth/audio_samples/compile.sh @@ -24,13 +24,13 @@ if [ "${BOARD_TS}" == "nrf5340bsim_nrf5340_cpuapp" ]; then exe_name=bs_${BOARD_TS}_${app}_prj_conf sysbuild=1 compile app=tests/bsim/bluetooth/audio_samples/cap/initiator \ sample=${ZEPHYR_BASE}/samples/bluetooth/cap_initiator \ - cmake_args="-DCONFIG_SAMPLE_UNICAST=n" \ + cmake_extra_args="-DCONFIG_SAMPLE_UNICAST=n" \ conf_file=${sample}/prj.conf \ conf_overlay=${sample}/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf \ exe_name=bs_${BOARD_TS}_${app}_broadcast_prj_conf sysbuild=1 compile app=tests/bsim/bluetooth/audio_samples/cap/acceptor \ sample=${ZEPHYR_BASE}/samples/bluetooth/cap_acceptor \ - cmake_args="-DCONFIG_SAMPLE_SCAN_SELF=y -DCONFIG_SAMPLE_UNICAST=n" \ + cmake_extra_args="-DCONFIG_SAMPLE_SCAN_SELF=y -DCONFIG_SAMPLE_UNICAST=n" \ conf_file=${sample}/prj.conf \ conf_overlay=${sample}/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf \ exe_name=bs_${BOARD_TS}_${app}_broadcast_prj_conf sysbuild=1 compile @@ -60,13 +60,13 @@ else exe_name=bs_${BOARD_TS}_${app}_prj_conf sysbuild=1 compile app=tests/bsim/bluetooth/audio_samples/cap/initiator \ sample=${ZEPHYR_BASE}/samples/bluetooth/cap_initiator \ - cmake_args="-DCONFIG_SAMPLE_UNICAST=n" \ + cmake_extra_args="-DCONFIG_SAMPLE_UNICAST=n" \ conf_file=${sample}/prj.conf \ conf_overlay=${sample}/overlay-bt_ll_sw_split.conf \ exe_name=bs_${BOARD_TS}_${app}_broadcast_prj_conf sysbuild=1 compile app=tests/bsim/bluetooth/audio_samples/cap/acceptor \ sample=${ZEPHYR_BASE}/samples/bluetooth/cap_acceptor \ - cmake_args="-DCONFIG_SAMPLE_SCAN_SELF=y -DCONFIG_SAMPLE_UNICAST=n" \ + cmake_extra_args="-DCONFIG_SAMPLE_SCAN_SELF=y -DCONFIG_SAMPLE_UNICAST=n" \ conf_file=${sample}/prj.conf \ conf_overlay=${sample}/overlay-bt_ll_sw_split.conf \ exe_name=bs_${BOARD_TS}_${app}_broadcast_prj_conf sysbuild=1 compile From 3d86360c33222a3ec754810b8e2229e777a0dec6 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 30 Sep 2024 13:35:44 +0200 Subject: [PATCH 0179/4482] samples/bluetooth/cap_acceptor: Add missing include strncasecmp()'s prototype is provided in strings.h let's include it to avoid a build warning. Signed-off-by: Alberto Escolar Piedras --- samples/bluetooth/cap_acceptor/src/cap_acceptor_broadcast.c | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/bluetooth/cap_acceptor/src/cap_acceptor_broadcast.c b/samples/bluetooth/cap_acceptor/src/cap_acceptor_broadcast.c index c1c024dd1cdde..60fb40b6daefb 100644 --- a/samples/bluetooth/cap_acceptor/src/cap_acceptor_broadcast.c +++ b/samples/bluetooth/cap_acceptor/src/cap_acceptor_broadcast.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include From f5a3f90a68feff13b578d5ebc8a6086978533fa3 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Mon, 30 Sep 2024 13:15:26 +0200 Subject: [PATCH 0180/4482] usb: device_next: respect bMaxPacketSize0 in control transfers Only the device operating at high speed has bMaxPacketSize0 set to 64 bytes, the device operating at other speeds may have a different value. For full speed, use the value from the full speed descriptor. Signed-off-by: Johann Fischer --- subsys/usb/device_next/usbd_endpoint.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/subsys/usb/device_next/usbd_endpoint.c b/subsys/usb/device_next/usbd_endpoint.c index 1d41f4c99a217..1e0ef658d35ca 100644 --- a/subsys/usb/device_next/usbd_endpoint.c +++ b/subsys/usb/device_next/usbd_endpoint.c @@ -59,7 +59,20 @@ static void usbd_ep_ctrl_set_zlp(struct usbd_context *const uds_ctx, struct net_buf *const buf) { struct usb_setup_packet *setup = usbd_get_setup_pkt(uds_ctx); + struct usb_device_descriptor *desc = uds_ctx->fs_desc; size_t min_len = MIN(setup->wLength, buf->len); + uint8_t mps0 = 0; + + switch (usbd_bus_speed(uds_ctx)) { + case USBD_SPEED_FS: + mps0 = desc->bMaxPacketSize0; + break; + case USBD_SPEED_HS: + mps0 = USB_CONTROL_EP_MPS; + break; + default: + __ASSERT(false, "Cannot determine bMaxPacketSize0 (unsupported speed)"); + } if (buf->len == 0) { return; @@ -70,7 +83,7 @@ static void usbd_ep_ctrl_set_zlp(struct usbd_context *const uds_ctx, * last chunk is wMaxPacketSize long, to indicate the last * packet. */ - if (setup->wLength > min_len && !(min_len % USB_CONTROL_EP_MPS)) { + if (setup->wLength > min_len && !(min_len % mps0)) { /* * Transfer length is less as requested by wLength and * is multiple of wMaxPacketSize. From 35c9e549617f63c96fc658206772f1b9fcfc982c Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Mon, 30 Sep 2024 13:35:23 +0200 Subject: [PATCH 0181/4482] include: usb_ch9: add note about USB_CONTROL_EP_MPS This value may not be correct for devices operating at speeds other than high speed. Signed-off-by: Johann Fischer --- include/zephyr/usb/usb_ch9.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/zephyr/usb/usb_ch9.h b/include/zephyr/usb/usb_ch9.h index 41b3571024eb4..3f1ad5b8093ea 100644 --- a/include/zephyr/usb/usb_ch9.h +++ b/include/zephyr/usb/usb_ch9.h @@ -283,7 +283,12 @@ struct usb_association_descriptor { /** Macro to obtain descriptor index from USB_SREQ_GET_DESCRIPTOR request */ #define USB_GET_DESCRIPTOR_INDEX(wValue) ((uint8_t)(wValue)) -/** USB Control Endpoints maximum packet size (MPS) */ +/** + * USB Control Endpoints maximum packet size (MPS) + * + * This value may not be correct for devices operating at speeds other than + * high speed. + */ #define USB_CONTROL_EP_MPS 64U /** USB endpoint direction mask */ From 8049c249940a0a073ee2b849f31c85d2385f993d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Mon, 30 Sep 2024 13:14:28 +0200 Subject: [PATCH 0182/4482] Bluetooth: Mesh: Add prefix to Subnet Bridge API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds the `bt_mesh_brg_cfg` prefix to the public Subnet Bridge API, and aligns the function and callback naming with the rest of the Bluetooth Mesh API. Signed-off-by: Håvard Reierstad --- .../bluetooth/api/mesh/brg_cfg.rst | 15 +- include/zephyr/bluetooth/mesh/brg_cfg.h | 24 ++-- include/zephyr/bluetooth/mesh/brg_cfg_cli.h | 76 +++++------ subsys/bluetooth/mesh/brg_cfg_cli.c | 102 +++++++------- subsys/bluetooth/mesh/brg_cfg_srv.c | 10 +- subsys/bluetooth/mesh/shell/brg_cfg.c | 58 ++++---- tests/bluetooth/tester/src/btp_mesh.c | 35 +++-- tests/bsim/bluetooth/mesh/src/test_brg.c | 129 +++++++++--------- 8 files changed, 215 insertions(+), 234 deletions(-) diff --git a/doc/connectivity/bluetooth/api/mesh/brg_cfg.rst b/doc/connectivity/bluetooth/api/mesh/brg_cfg.rst index b118116f620d8..d6e7462c546d2 100644 --- a/doc/connectivity/bluetooth/api/mesh/brg_cfg.rst +++ b/doc/connectivity/bluetooth/api/mesh/brg_cfg.rst @@ -69,15 +69,15 @@ Enabling or disabling the Subnet Bridge feature The Bridge Configuration Client (or Configuration Manager) can enable or disable the Subnet Bridge feature on a node by sending a **Subnet Bridge Set** message to the Bridge Configuration -Server model on the target node, using the :c:func:`bt_mesh_brg_cfg_cli_subnet_bridge_set` function. +Server model on the target node, using the :c:func:`bt_mesh_brg_cfg_cli_set` function. Adding or removing subnets ************************** The Bridge Configuration Client can add or remove an entry from the Bridging Table by sending a **Bridging Table Add** or **Bridging Table Remove** message to the Bridge Configuration -Server model on the target node, calling the :c:func:`bt_mesh_brg_cfg_cli_bridging_table_add` or -:c:func:`bt_mesh_brg_cfg_cli_bridging_table_remove` functions. +Server model on the target node, calling the :c:func:`bt_mesh_brg_cfg_cli_table_add` or +:c:func:`bt_mesh_brg_cfg_cli_table_remove` functions. .. _bluetooth_mesh_brg_cfg_states: @@ -89,20 +89,19 @@ The Subnet Bridge has the following states: - *Subnet Bridge*: This state indicates whether the Subnet Bridge feature is enabled or disabled on the node. The Bridge Configuration Client can retrieve this information by sending a **Subnet Bridge Get** - message to the Bridge Configuration Server using the - :c:func:`bt_mesh_brg_cfg_cli_subnet_bridge_get` function. + message to the Bridge Configuration Server using the :c:func:`bt_mesh_brg_cfg_cli_get` function. - *Bridging Table*: This state holds the bridging table. The Client can request a list of entries from a Bridging Table by sending a **Bridging Table Get** message to the target node using - the :c:func:`bt_mesh_brg_cfg_cli_bridging_table_get` function. + the :c:func:`bt_mesh_brg_cfg_cli_table_get` function. The Client can get a list of subnets currently bridged by a Subnet Bridge by sending a **Bridged Subnets Get** message to the target Server by calling the - :c:func:`bt_mesh_brg_cfg_cli_bridged_subnets_get` function. + :c:func:`bt_mesh_brg_cfg_cli_subnets_get` function. - *Bridging Table Size*: This state reports the maximum number of entries the Bridging Table can store. The Client can retrieve this information by sending a **Bridging Table Size Get** message - using the :c:func:`bt_mesh_brg_cfg_cli_bridging_table_size_get` function. + using the :c:func:`bt_mesh_brg_cfg_cli_table_size_get` function. This is a read-only state. Subnet bridging and replay protection diff --git a/include/zephyr/bluetooth/mesh/brg_cfg.h b/include/zephyr/bluetooth/mesh/brg_cfg.h index 906a2e0bb381f..a488fed09c5ec 100644 --- a/include/zephyr/bluetooth/mesh/brg_cfg.h +++ b/include/zephyr/bluetooth/mesh/brg_cfg.h @@ -21,20 +21,20 @@ extern "C" { */ /** Subnet Bridge states */ -enum bt_mesh_subnet_bridge_state { +enum bt_mesh_brg_cfg_state { /** Subnet bridge functionality is disabled. */ - BT_MESH_SUBNET_BRIDGE_DISABLED, + BT_MESH_BRG_CFG_DISABLED, /** Subnet bridge state functionality is enabled. */ - BT_MESH_SUBNET_BRIDGE_ENABLED, + BT_MESH_BRG_CFG_ENABLED, }; /* Briding from Addr1 to Addr2. */ -#define BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY 1 +#define BT_MESH_BRG_CFG_DIR_ONEWAY 1 /* Bidirectional briging between Addr1 and Addr2. */ -#define BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY 2 +#define BT_MESH_BRG_CFG_DIR_TWOWAY 2 /** Bridging Table state entry corresponding to a entry in the Bridging Table. */ -struct bt_mesh_bridging_table_entry { +struct bt_mesh_brg_cfg_table_entry { /** Allowed directions for the bridged traffic (or bridged traffic not allowed) */ uint8_t directions; /** NetKey Index of the first subnet */ @@ -48,24 +48,24 @@ struct bt_mesh_bridging_table_entry { }; /** Bridging Table Status response */ -struct bt_mesh_bridging_table_status { +struct bt_mesh_brg_cfg_table_status { /** Status Code of the requesting message */ uint8_t status; /** Requested Bridging Table entry */ - struct bt_mesh_bridging_table_entry entry; + struct bt_mesh_brg_cfg_table_entry entry; }; /** Used to filter set of pairs of NetKey Indexes from the Bridging Table */ -struct bt_mesh_filter_netkey { +struct bt_mesh_brg_cfg_filter_netkey { uint16_t filter: 2, /* Filter applied to the set of pairs of NetKey Indexes */ prohibited: 2, /* Prohibited */ net_idx: 12; /* NetKey Index used for filtering or ignored */ }; /** Bridged Subnets List response */ -struct bt_mesh_bridged_subnets_list { +struct bt_mesh_brg_cfg_subnets_list { /** Filter applied NetKey Indexes, and NetKey Index used for filtering. */ - struct bt_mesh_filter_netkey net_idx_filter; + struct bt_mesh_brg_cfg_filter_netkey net_idx_filter; /** Start offset in units of bridges */ uint8_t start_idx; /** Pointer to allocated buffer for storing filtered of NetKey Indexes */ @@ -73,7 +73,7 @@ struct bt_mesh_bridged_subnets_list { }; /** Bridging Table List response */ -struct bt_mesh_bridging_table_list { +struct bt_mesh_brg_cfg_table_list { /** Status Code of the requesting message */ uint8_t status; /** NetKey Index of the first subnet */ diff --git a/include/zephyr/bluetooth/mesh/brg_cfg_cli.h b/include/zephyr/bluetooth/mesh/brg_cfg_cli.h index c29650a5df976..37666ac6dcd37 100644 --- a/include/zephyr/bluetooth/mesh/brg_cfg_cli.h +++ b/include/zephyr/bluetooth/mesh/brg_cfg_cli.h @@ -42,8 +42,8 @@ struct bt_mesh_brg_cfg_cli_cb { * @param addr Address of the sender. * @param status Status received from the server. */ - void (*subnet_bridge_status)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, - enum bt_mesh_subnet_bridge_state status); + void (*bridge_status)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, + enum bt_mesh_brg_cfg_state status); /** @brief Optional callback for Bridging Table Size Status message. * @@ -54,8 +54,7 @@ struct bt_mesh_brg_cfg_cli_cb { * @param addr Address of the sender. * @param size Size received from the server. */ - void (*bridging_table_size_status)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, - uint16_t size); + void (*table_size_status)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, uint16_t size); /** @brief Optional callback for Bridging Table Status message. * @@ -66,8 +65,8 @@ struct bt_mesh_brg_cfg_cli_cb { * @param addr Address of the sender. * @param rsp Response received from the Bridging Configuration Server. */ - void (*bridging_table_status)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, - struct bt_mesh_bridging_table_status *rsp); + void (*table_status)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, + struct bt_mesh_brg_cfg_table_status *rsp); /** @brief Optional callback for Bridged Subnets List message. * @@ -78,8 +77,8 @@ struct bt_mesh_brg_cfg_cli_cb { * @param addr Address of the sender. * @param rsp Response received from the Bridging Configuration Server. */ - void (*bridged_subnets_list)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, - struct bt_mesh_bridged_subnets_list *rsp); + void (*subnets_list)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, + struct bt_mesh_brg_cfg_subnets_list *rsp); /** @brief Optional callback for Bridging Table List message. * @@ -90,8 +89,8 @@ struct bt_mesh_brg_cfg_cli_cb { * @param addr Address of the sender. * @param rsp Response received from the Bridging Configuration Server. */ - void (*bridging_table_list)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, - struct bt_mesh_bridging_table_list *rsp); + void (*table_list)(struct bt_mesh_brg_cfg_cli *cli, uint16_t addr, + struct bt_mesh_brg_cfg_table_list *rsp); }; /** Bridge Configuration Client Model Context */ @@ -121,13 +120,12 @@ struct bt_mesh_brg_cfg_cli { * @param net_idx Network index to encrypt the message with. * @param addr Target node address. * @param status Status response parameter, returns one of - * @ref BT_MESH_SUBNET_BRIDGE_DISABLED or - * @ref BT_MESH_SUBNET_BRIDGE_ENABLED on success. + * @ref BT_MESH_BRG_CFG_DISABLED or + * @ref BT_MESH_BRG_CFG_ENABLED on success. * * @return 0 on success, or (negative) error code on failure. */ -int bt_mesh_brg_cfg_cli_subnet_bridge_get(uint16_t net_idx, uint16_t addr, - enum bt_mesh_subnet_bridge_state *status); +int bt_mesh_brg_cfg_cli_get(uint16_t net_idx, uint16_t addr, enum bt_mesh_brg_cfg_state *status); /** @brief Sends a Subnet Bridge Set message to the given destination address * with the given parameters @@ -145,17 +143,16 @@ int bt_mesh_brg_cfg_cli_subnet_bridge_get(uint16_t net_idx, uint16_t addr, * @param net_idx Network index to encrypt the message with. * @param addr Target node address. * @param val Value to set the Subnet Bridge state to. Must be one of - * @ref BT_MESH_SUBNET_BRIDGE_DISABLED or - * @ref BT_MESH_SUBNET_BRIDGE_ENABLED. + * @ref BT_MESH_BRG_CFG_DISABLED or + * @ref BT_MESH_BRG_CFG_ENABLED. * @param status Status response parameter, returns one of - * @ref BT_MESH_SUBNET_BRIDGE_DISABLED or - * @ref BT_MESH_SUBNET_BRIDGE_ENABLED on success. + * @ref BT_MESH_BRG_CFG_DISABLED or + * @ref BT_MESH_BRG_CFG_ENABLED on success. * * @return 0 on success, or (negative) error code on failure. */ -int bt_mesh_brg_cfg_cli_subnet_bridge_set(uint16_t net_idx, uint16_t addr, - enum bt_mesh_subnet_bridge_state val, - enum bt_mesh_subnet_bridge_state *status); +int bt_mesh_brg_cfg_cli_set(uint16_t net_idx, uint16_t addr, enum bt_mesh_brg_cfg_state val, + enum bt_mesh_brg_cfg_state *status); /** @brief Sends a Bridging Table Size Get message to the given destination * address with the given parameters @@ -176,7 +173,7 @@ int bt_mesh_brg_cfg_cli_subnet_bridge_set(uint16_t net_idx, uint16_t addr, * * @return 0 on success, or (negative) error code on failure. */ -int bt_mesh_brg_cfg_cli_bridging_table_size_get(uint16_t net_idx, uint16_t addr, uint16_t *size); +int bt_mesh_brg_cfg_cli_table_size_get(uint16_t net_idx, uint16_t addr, uint16_t *size); /** @brief Sends a Bridging Table Add message to the given destination address * with the given parameters @@ -198,9 +195,9 @@ int bt_mesh_brg_cfg_cli_bridging_table_size_get(uint16_t net_idx, uint16_t addr, * * @return 0 on success, or (negative) error code on failure. */ -int bt_mesh_brg_cfg_cli_bridging_table_add(uint16_t net_idx, uint16_t addr, - struct bt_mesh_bridging_table_entry *entry, - struct bt_mesh_bridging_table_status *rsp); +int bt_mesh_brg_cfg_cli_table_add(uint16_t net_idx, uint16_t addr, + struct bt_mesh_brg_cfg_table_entry *entry, + struct bt_mesh_brg_cfg_table_status *rsp); /** @brief Sends a Bridging Table Remove message to the given destination * address with the given parameters @@ -226,9 +223,9 @@ int bt_mesh_brg_cfg_cli_bridging_table_add(uint16_t net_idx, uint16_t addr, * * @return 0 on success, or (negative) error code on failure. */ -int bt_mesh_brg_cfg_cli_bridging_table_remove(uint16_t net_idx, uint16_t addr, uint16_t net_idx1, - uint16_t net_idx2, uint16_t addr1, uint16_t addr2, - struct bt_mesh_bridging_table_status *rsp); +int bt_mesh_brg_cfg_cli_table_remove(uint16_t net_idx, uint16_t addr, uint16_t net_idx1, + uint16_t net_idx2, uint16_t addr1, uint16_t addr2, + struct bt_mesh_brg_cfg_table_status *rsp); /** @brief Sends a Bridged Subnets Get message to the given destination address * with the given parameters @@ -244,7 +241,7 @@ int bt_mesh_brg_cfg_cli_bridging_table_remove(uint16_t net_idx, uint16_t addr, u * * When @c rsp is set, the user is responsible for providing a buffer for the * filtered set of N pairs of NetKey Indexes in - * @ref bt_mesh_bridged_subnets_list::list. If a buffer is not provided, the + * @ref bt_mesh_brg_cfg_subnets_list::list. If a buffer is not provided, the * bridged subnets won't be copied. * @param net_idx Network index to encrypt the message with. @@ -256,10 +253,9 @@ int bt_mesh_brg_cfg_cli_bridging_table_remove(uint16_t net_idx, uint16_t addr, u * * @return 0 on success, or (negative) error code on failure. */ -int bt_mesh_brg_cfg_cli_bridged_subnets_get(uint16_t net_idx, uint16_t addr, - struct bt_mesh_filter_netkey filter_net_idx, - uint8_t start_idx, - struct bt_mesh_bridged_subnets_list *rsp); +int bt_mesh_brg_cfg_cli_subnets_get(uint16_t net_idx, uint16_t addr, + struct bt_mesh_brg_cfg_filter_netkey filter_net_idx, + uint8_t start_idx, struct bt_mesh_brg_cfg_subnets_list *rsp); /** @brief Sends a Bridging Table Get message to the given destination address * with the given parameters @@ -276,10 +272,10 @@ int bt_mesh_brg_cfg_cli_bridged_subnets_get(uint16_t net_idx, uint16_t addr, * * When @c rsp is set, the user is responsible for providing a buffer for the * filtered set of N pairs of NetKey Indexes in - * @ref bt_mesh_bridging_table_list::list. If a buffer is not provided, the - * bridged addresses won't be copied. If a buffer size is shorter than received - * list, only those many entries that fit in the buffer will be copied from the - * list, and rest will be discarded. + * @ref bt_mesh_brg_cfg_table_list::list. If a buffer is not provided, + * the bridged addresses won't be copied. If a buffer size is shorter than + * received list, only those many entries that fit in the buffer will be copied + * from the list, and rest will be discarded. * * @param net_idx Network index to encrypt the message with. * @param addr Target node address. @@ -291,9 +287,9 @@ int bt_mesh_brg_cfg_cli_bridged_subnets_get(uint16_t net_idx, uint16_t addr, * * @return 0 on success, or (negative) error code on failure. */ -int bt_mesh_brg_cfg_cli_bridging_table_get(uint16_t net_idx, uint16_t addr, uint16_t net_idx1, - uint16_t net_idx2, uint16_t start_idx, - struct bt_mesh_bridging_table_list *rsp); +int bt_mesh_brg_cfg_cli_table_get(uint16_t net_idx, uint16_t addr, uint16_t net_idx1, + uint16_t net_idx2, uint16_t start_idx, + struct bt_mesh_brg_cfg_table_list *rsp); /** @brief Get the current transmission timeout value. * diff --git a/subsys/bluetooth/mesh/brg_cfg_cli.c b/subsys/bluetooth/mesh/brg_cfg_cli.c index 229b0b6f89227..3f3984087080f 100644 --- a/subsys/bluetooth/mesh/brg_cfg_cli.c +++ b/subsys/bluetooth/mesh/brg_cfg_cli.c @@ -17,12 +17,11 @@ static int32_t msg_timeout; static struct bt_mesh_brg_cfg_cli *cli; -static int subnet_bridge_status(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, - struct net_buf_simple *buf) +static int bridge_status(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, + struct net_buf_simple *buf) { - enum bt_mesh_subnet_bridge_state status = - (enum bt_mesh_subnet_bridge_state)net_buf_simple_pull_u8(buf); - enum bt_mesh_subnet_bridge_state *rsp; + enum bt_mesh_brg_cfg_state status = (enum bt_mesh_brg_cfg_state)net_buf_simple_pull_u8(buf); + enum bt_mesh_brg_cfg_state *rsp; if (bt_mesh_msg_ack_ctx_match(&cli->ack_ctx, OP_SUBNET_BRIDGE_STATUS, ctx->addr, (void **)&rsp)) { @@ -30,17 +29,17 @@ static int subnet_bridge_status(const struct bt_mesh_model *model, struct bt_mes bt_mesh_msg_ack_ctx_rx(&cli->ack_ctx); } - if (cli->cb && cli->cb->subnet_bridge_status) { - cli->cb->subnet_bridge_status(cli, ctx->addr, status); + if (cli->cb && cli->cb->bridge_status) { + cli->cb->bridge_status(cli, ctx->addr, status); } return 0; } -static int bridging_table_status(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, - struct net_buf_simple *buf) +static int table_status(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, + struct net_buf_simple *buf) { - struct bt_mesh_bridging_table_status table_status; - struct bt_mesh_bridging_table_status *rsp; + struct bt_mesh_brg_cfg_table_status table_status; + struct bt_mesh_brg_cfg_table_status *rsp; table_status.status = net_buf_simple_pull_u8(buf); table_status.entry.directions = net_buf_simple_pull_u8(buf); @@ -63,17 +62,17 @@ static int bridging_table_status(const struct bt_mesh_model *model, struct bt_me bt_mesh_msg_ack_ctx_rx(&cli->ack_ctx); } - if (cli->cb && cli->cb->bridging_table_status) { - cli->cb->bridging_table_status(cli, ctx->addr, &table_status); + if (cli->cb && cli->cb->table_status) { + cli->cb->table_status(cli, ctx->addr, &table_status); } return 0; } -static int bridged_subnets_list(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, - struct net_buf_simple *buf) +static int subnets_list(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, + struct net_buf_simple *buf) { - struct bt_mesh_bridged_subnets_list subnets_list; - struct bt_mesh_bridged_subnets_list *rsp; + struct bt_mesh_brg_cfg_subnets_list subnets_list; + struct bt_mesh_brg_cfg_subnets_list *rsp; uint16_t net_idx_filter; net_idx_filter = net_buf_simple_pull_le16(buf); @@ -102,17 +101,17 @@ static int bridged_subnets_list(const struct bt_mesh_model *model, struct bt_mes bt_mesh_msg_ack_ctx_rx(&cli->ack_ctx); } - if (cli->cb && cli->cb->bridged_subnets_list) { - cli->cb->bridged_subnets_list(cli, ctx->addr, &subnets_list); + if (cli->cb && cli->cb->subnets_list) { + cli->cb->subnets_list(cli, ctx->addr, &subnets_list); } return 0; } -static int bridging_table_list(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, - struct net_buf_simple *buf) +static int table_list(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, + struct net_buf_simple *buf) { - struct bt_mesh_bridging_table_list table_list; - struct bt_mesh_bridging_table_list *rsp; + struct bt_mesh_brg_cfg_table_list table_list; + struct bt_mesh_brg_cfg_table_list *rsp; table_list.status = net_buf_simple_pull_u8(buf); key_idx_unpack_pair(buf, &table_list.net_idx1, &table_list.net_idx2); @@ -141,14 +140,14 @@ static int bridging_table_list(const struct bt_mesh_model *model, struct bt_mesh bt_mesh_msg_ack_ctx_rx(&cli->ack_ctx); } - if (cli->cb && cli->cb->bridging_table_list) { - cli->cb->bridging_table_list(cli, ctx->addr, &table_list); + if (cli->cb && cli->cb->table_list) { + cli->cb->table_list(cli, ctx->addr, &table_list); } return 0; } -static int bridging_table_size_status(const struct bt_mesh_model *model, - struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf) +static int table_size_status(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, + struct net_buf_simple *buf) { uint16_t size = net_buf_simple_pull_le16(buf); uint16_t *rsp; @@ -159,18 +158,18 @@ static int bridging_table_size_status(const struct bt_mesh_model *model, bt_mesh_msg_ack_ctx_rx(&cli->ack_ctx); } - if (cli->cb && cli->cb->bridging_table_size_status) { - cli->cb->bridging_table_size_status(cli, ctx->addr, size); + if (cli->cb && cli->cb->table_size_status) { + cli->cb->table_size_status(cli, ctx->addr, size); } return 0; } const struct bt_mesh_model_op _bt_mesh_brg_cfg_cli_op[] = { - {OP_SUBNET_BRIDGE_STATUS, BT_MESH_LEN_EXACT(1), subnet_bridge_status}, - {OP_BRIDGING_TABLE_STATUS, BT_MESH_LEN_EXACT(9), bridging_table_status}, - {OP_BRIDGED_SUBNETS_LIST, BT_MESH_LEN_MIN(3), bridged_subnets_list}, - {OP_BRIDGING_TABLE_LIST, BT_MESH_LEN_MIN(6), bridging_table_list}, - {OP_BRIDGING_TABLE_SIZE_STATUS, BT_MESH_LEN_EXACT(2), bridging_table_size_status}, + {OP_SUBNET_BRIDGE_STATUS, BT_MESH_LEN_EXACT(1), bridge_status}, + {OP_BRIDGING_TABLE_STATUS, BT_MESH_LEN_EXACT(9), table_status}, + {OP_BRIDGED_SUBNETS_LIST, BT_MESH_LEN_MIN(3), subnets_list}, + {OP_BRIDGING_TABLE_LIST, BT_MESH_LEN_MIN(6), table_list}, + {OP_BRIDGING_TABLE_SIZE_STATUS, BT_MESH_LEN_EXACT(2), table_size_status}, BT_MESH_MODEL_OP_END, }; @@ -202,8 +201,7 @@ const struct bt_mesh_model_cb _bt_mesh_brg_cfg_cli_cb = { .init = brg_cfg_cli_init, }; -int bt_mesh_brg_cfg_cli_subnet_bridge_get(uint16_t net_idx, uint16_t addr, - enum bt_mesh_subnet_bridge_state *status) +int bt_mesh_brg_cfg_cli_get(uint16_t net_idx, uint16_t addr, enum bt_mesh_brg_cfg_state *status) { BT_MESH_MODEL_BUF_DEFINE(msg, OP_SUBNET_BRIDGE_GET, 0); struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr); @@ -219,9 +217,8 @@ int bt_mesh_brg_cfg_cli_subnet_bridge_get(uint16_t net_idx, uint16_t addr, return bt_mesh_msg_ackd_send(cli->model, &ctx, &msg, !status ? NULL : &rsp_ctx); } -int bt_mesh_brg_cfg_cli_subnet_bridge_set(uint16_t net_idx, uint16_t addr, - enum bt_mesh_subnet_bridge_state val, - enum bt_mesh_subnet_bridge_state *status) +int bt_mesh_brg_cfg_cli_set(uint16_t net_idx, uint16_t addr, enum bt_mesh_brg_cfg_state val, + enum bt_mesh_brg_cfg_state *status) { BT_MESH_MODEL_BUF_DEFINE(msg, OP_SUBNET_BRIDGE_SET, 1); struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr); @@ -238,7 +235,7 @@ int bt_mesh_brg_cfg_cli_subnet_bridge_set(uint16_t net_idx, uint16_t addr, return bt_mesh_msg_ackd_send(cli->model, &ctx, &msg, !status ? NULL : &rsp_ctx); } -int bt_mesh_brg_cfg_cli_bridging_table_size_get(uint16_t net_idx, uint16_t addr, uint16_t *size) +int bt_mesh_brg_cfg_cli_table_size_get(uint16_t net_idx, uint16_t addr, uint16_t *size) { BT_MESH_MODEL_BUF_DEFINE(msg, OP_BRIDGING_TABLE_SIZE_GET, 0); struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr); @@ -254,9 +251,9 @@ int bt_mesh_brg_cfg_cli_bridging_table_size_get(uint16_t net_idx, uint16_t addr, return bt_mesh_msg_ackd_send(cli->model, &ctx, &msg, !size ? NULL : &rsp_ctx); } -int bt_mesh_brg_cfg_cli_bridging_table_add(uint16_t net_idx, uint16_t addr, - struct bt_mesh_bridging_table_entry *entry, - struct bt_mesh_bridging_table_status *rsp) +int bt_mesh_brg_cfg_cli_table_add(uint16_t net_idx, uint16_t addr, + struct bt_mesh_brg_cfg_table_entry *entry, + struct bt_mesh_brg_cfg_table_status *rsp) { BT_MESH_MODEL_BUF_DEFINE(msg, OP_BRIDGING_TABLE_ADD, 8); struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr); @@ -292,9 +289,9 @@ int bt_mesh_brg_cfg_cli_bridging_table_add(uint16_t net_idx, uint16_t addr, return bt_mesh_msg_ackd_send(cli->model, &ctx, &msg, !rsp ? NULL : &rsp_ctx); } -int bt_mesh_brg_cfg_cli_bridging_table_remove(uint16_t net_idx, uint16_t addr, uint16_t net_idx1, - uint16_t net_idx2, uint16_t addr1, uint16_t addr2, - struct bt_mesh_bridging_table_status *rsp) +int bt_mesh_brg_cfg_cli_table_remove(uint16_t net_idx, uint16_t addr, uint16_t net_idx1, + uint16_t net_idx2, uint16_t addr1, uint16_t addr2, + struct bt_mesh_brg_cfg_table_status *rsp) { BT_MESH_MODEL_BUF_DEFINE(msg, OP_BRIDGING_TABLE_REMOVE, 7); struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr); @@ -321,10 +318,9 @@ int bt_mesh_brg_cfg_cli_bridging_table_remove(uint16_t net_idx, uint16_t addr, u return bt_mesh_msg_ackd_send(cli->model, &ctx, &msg, !rsp ? NULL : &rsp_ctx); } -int bt_mesh_brg_cfg_cli_bridged_subnets_get(uint16_t net_idx, uint16_t addr, - struct bt_mesh_filter_netkey filter_net_idx, - uint8_t start_idx, - struct bt_mesh_bridged_subnets_list *rsp) +int bt_mesh_brg_cfg_cli_subnets_get(uint16_t net_idx, uint16_t addr, + struct bt_mesh_brg_cfg_filter_netkey filter_net_idx, + uint8_t start_idx, struct bt_mesh_brg_cfg_subnets_list *rsp) { BT_MESH_MODEL_BUF_DEFINE(msg, OP_BRIDGED_SUBNETS_GET, 3); struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr); @@ -342,9 +338,9 @@ int bt_mesh_brg_cfg_cli_bridged_subnets_get(uint16_t net_idx, uint16_t addr, return bt_mesh_msg_ackd_send(cli->model, &ctx, &msg, !rsp ? NULL : &rsp_ctx); } -int bt_mesh_brg_cfg_cli_bridging_table_get(uint16_t net_idx, uint16_t addr, uint16_t net_idx1, - uint16_t net_idx2, uint16_t start_idx, - struct bt_mesh_bridging_table_list *rsp) +int bt_mesh_brg_cfg_cli_table_get(uint16_t net_idx, uint16_t addr, uint16_t net_idx1, + uint16_t net_idx2, uint16_t start_idx, + struct bt_mesh_brg_cfg_table_list *rsp) { BT_MESH_MODEL_BUF_DEFINE(msg, OP_BRIDGING_TABLE_GET, 5); struct bt_mesh_msg_ctx ctx = BT_MESH_MSG_CTX_INIT_DEV(net_idx, addr); diff --git a/subsys/bluetooth/mesh/brg_cfg_srv.c b/subsys/bluetooth/mesh/brg_cfg_srv.c index 7492caf3771cf..d622ebf48a252 100644 --- a/subsys/bluetooth/mesh/brg_cfg_srv.c +++ b/subsys/bluetooth/mesh/brg_cfg_srv.c @@ -40,7 +40,7 @@ static int subnet_bridge_set(const struct bt_mesh_model *model, struct bt_mesh_m { uint8_t enable = net_buf_simple_pull_u8(buf); - if (enable > BT_MESH_SUBNET_BRIDGE_ENABLED) { + if (enable > BT_MESH_BRG_CFG_ENABLED) { return -EINVAL; } @@ -52,7 +52,7 @@ static int subnet_bridge_set(const struct bt_mesh_model *model, struct bt_mesh_m static void bridging_table_status_send(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, uint8_t status, - struct bt_mesh_bridging_table_entry *entry) + struct bt_mesh_brg_cfg_table_entry *entry) { BT_MESH_MODEL_BUF_DEFINE(msg, OP_BRIDGING_TABLE_STATUS, 9); @@ -76,7 +76,7 @@ static bool netkey_check(uint16_t net_idx1, uint16_t net_idx2) static int bridging_table_add(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf) { - struct bt_mesh_bridging_table_entry entry; + struct bt_mesh_brg_cfg_table_entry entry; uint8_t status = STATUS_SUCCESS; int err; @@ -99,7 +99,7 @@ static int bridging_table_add(const struct bt_mesh_model *model, struct bt_mesh_ static int bridging_table_remove(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf) { - struct bt_mesh_bridging_table_entry entry; + struct bt_mesh_brg_cfg_table_entry entry; uint8_t status = STATUS_SUCCESS; int err; @@ -135,7 +135,7 @@ static int bridged_subnets_get(const struct bt_mesh_model *model, struct bt_mesh return -EINVAL; } - struct bt_mesh_filter_netkey filter_net_idx; + struct bt_mesh_brg_cfg_filter_netkey filter_net_idx; filter_net_idx.filter = net_idx_filter & BIT_MASK(2); filter_net_idx.net_idx = (net_idx_filter >> 4) & BIT_MASK(12); diff --git a/subsys/bluetooth/mesh/shell/brg_cfg.c b/subsys/bluetooth/mesh/shell/brg_cfg.c index 43ab3e0b15765..cefaaa47035b8 100644 --- a/subsys/bluetooth/mesh/shell/brg_cfg.c +++ b/subsys/bluetooth/mesh/shell/brg_cfg.c @@ -14,43 +14,43 @@ static int cmd_subnet_bridge_get(const struct shell *sh, size_t argc, char *argv[]) { - enum bt_mesh_subnet_bridge_state rsp; + enum bt_mesh_brg_cfg_state rsp; int err; - err = bt_mesh_brg_cfg_cli_subnet_bridge_get(bt_mesh_shell_target_ctx.net_idx, - bt_mesh_shell_target_ctx.dst, &rsp); + err = bt_mesh_brg_cfg_cli_get(bt_mesh_shell_target_ctx.net_idx, + bt_mesh_shell_target_ctx.dst, &rsp); if (err) { shell_error(sh, "Failed to send Subnet Bridge Get (err %d)", err); return -ENOEXEC; } shell_print(sh, "Subnet Bridge State: %s", - (rsp == BT_MESH_SUBNET_BRIDGE_ENABLED) ? "Enabled" : "Disabled"); + (rsp == BT_MESH_BRG_CFG_ENABLED) ? "Enabled" : "Disabled"); return 0; } static int cmd_subnet_bridge_set(const struct shell *sh, size_t argc, char *argv[]) { - enum bt_mesh_subnet_bridge_state set, rsp; + enum bt_mesh_brg_cfg_state set, rsp; int err = 0; - set = shell_strtobool(argv[1], 0, &err) ? BT_MESH_SUBNET_BRIDGE_ENABLED - : BT_MESH_SUBNET_BRIDGE_DISABLED; + set = shell_strtobool(argv[1], 0, &err) ? BT_MESH_BRG_CFG_ENABLED + : BT_MESH_BRG_CFG_DISABLED; if (err) { shell_warn(sh, "Unable to parse input string argument"); return err; } - err = bt_mesh_brg_cfg_cli_subnet_bridge_set(bt_mesh_shell_target_ctx.net_idx, - bt_mesh_shell_target_ctx.dst, set, &rsp); + err = bt_mesh_brg_cfg_cli_set(bt_mesh_shell_target_ctx.net_idx, + bt_mesh_shell_target_ctx.dst, set, &rsp); if (err) { shell_error(sh, "Failed to send Subnet Bridge Set (err %d)", err); return -ENOEXEC; } shell_print(sh, "Subnet Bridge State: %s", - (rsp == BT_MESH_SUBNET_BRIDGE_ENABLED) ? "Enabled" : "Disabled"); + (rsp == BT_MESH_BRG_CFG_ENABLED) ? "Enabled" : "Disabled"); return 0; } @@ -59,8 +59,8 @@ static int cmd_bridging_table_size_get(const struct shell *sh, size_t argc, char uint16_t rsp; int err; - err = bt_mesh_brg_cfg_cli_bridging_table_size_get(bt_mesh_shell_target_ctx.net_idx, - bt_mesh_shell_target_ctx.dst, &rsp); + err = bt_mesh_brg_cfg_cli_table_size_get(bt_mesh_shell_target_ctx.net_idx, + bt_mesh_shell_target_ctx.dst, &rsp); if (err) { shell_error(sh, "Failed to send Bridging Table Size Get (err %d)", err); return -ENOEXEC; @@ -72,8 +72,8 @@ static int cmd_bridging_table_size_get(const struct shell *sh, size_t argc, char static int cmd_bridging_table_add(const struct shell *sh, size_t argc, char *argv[]) { - struct bt_mesh_bridging_table_entry entry; - struct bt_mesh_bridging_table_status rsp; + struct bt_mesh_brg_cfg_table_entry entry; + struct bt_mesh_brg_cfg_table_status rsp; int err = 0; entry.directions = shell_strtoul(argv[1], 0, &err); @@ -86,8 +86,8 @@ static int cmd_bridging_table_add(const struct shell *sh, size_t argc, char *arg return err; } - err = bt_mesh_brg_cfg_cli_bridging_table_add(bt_mesh_shell_target_ctx.net_idx, - bt_mesh_shell_target_ctx.dst, &entry, &rsp); + err = bt_mesh_brg_cfg_cli_table_add(bt_mesh_shell_target_ctx.net_idx, + bt_mesh_shell_target_ctx.dst, &entry, &rsp); if (err) { shell_error(sh, "Failed to send Bridging Table Add (err %d)", err); return -ENOEXEC; @@ -104,7 +104,7 @@ static int cmd_bridging_table_add(const struct shell *sh, size_t argc, char *arg static int cmd_bridging_table_remove(const struct shell *sh, size_t argc, char *argv[]) { uint16_t net_idx1, net_idx2, addr1, addr2; - struct bt_mesh_bridging_table_status rsp; + struct bt_mesh_brg_cfg_table_status rsp; int err = 0; net_idx1 = shell_strtoul(argv[1], 0, &err); @@ -116,9 +116,9 @@ static int cmd_bridging_table_remove(const struct shell *sh, size_t argc, char * return err; } - err = bt_mesh_brg_cfg_cli_bridging_table_remove(bt_mesh_shell_target_ctx.net_idx, - bt_mesh_shell_target_ctx.dst, net_idx1, - net_idx2, addr1, addr2, &rsp); + err = bt_mesh_brg_cfg_cli_table_remove(bt_mesh_shell_target_ctx.net_idx, + bt_mesh_shell_target_ctx.dst, net_idx1, net_idx2, + addr1, addr2, &rsp); if (err) { shell_error(sh, "Failed to send Bridging Table Remove (err %d)", err); return -ENOEXEC; @@ -134,9 +134,9 @@ static int cmd_bridging_table_remove(const struct shell *sh, size_t argc, char * static int cmd_bridged_subnets_get(const struct shell *sh, size_t argc, char *argv[]) { - struct bt_mesh_filter_netkey filter_net_idx; + struct bt_mesh_brg_cfg_filter_netkey filter_net_idx; uint8_t start_idx; - struct bt_mesh_bridged_subnets_list rsp = { + struct bt_mesh_brg_cfg_subnets_list rsp = { .list = NET_BUF_SIMPLE(CONFIG_BT_MESH_BRG_TABLE_ITEMS_MAX * 3), }; int err = 0; @@ -151,9 +151,9 @@ static int cmd_bridged_subnets_get(const struct shell *sh, size_t argc, char *ar return err; } - err = bt_mesh_brg_cfg_cli_bridged_subnets_get(bt_mesh_shell_target_ctx.net_idx, - bt_mesh_shell_target_ctx.dst, filter_net_idx, - start_idx, &rsp); + err = bt_mesh_brg_cfg_cli_subnets_get(bt_mesh_shell_target_ctx.net_idx, + bt_mesh_shell_target_ctx.dst, filter_net_idx, + start_idx, &rsp); if (err) { shell_error(sh, "Failed to send Bridged Subnets Get (err %d)", err); return -ENOEXEC; @@ -180,7 +180,7 @@ static int cmd_bridged_subnets_get(const struct shell *sh, size_t argc, char *ar static int cmd_bridging_table_get(const struct shell *sh, size_t argc, char *argv[]) { uint16_t net_idx1, net_idx2, start_idx; - struct bt_mesh_bridging_table_list rsp = { + struct bt_mesh_brg_cfg_table_list rsp = { .list = NET_BUF_SIMPLE(CONFIG_BT_MESH_BRG_TABLE_ITEMS_MAX * 5), }; int err = 0; @@ -195,9 +195,9 @@ static int cmd_bridging_table_get(const struct shell *sh, size_t argc, char *arg return err; } - err = bt_mesh_brg_cfg_cli_bridging_table_get(bt_mesh_shell_target_ctx.net_idx, - bt_mesh_shell_target_ctx.dst, net_idx1, - net_idx2, start_idx, &rsp); + err = bt_mesh_brg_cfg_cli_table_get(bt_mesh_shell_target_ctx.net_idx, + bt_mesh_shell_target_ctx.dst, net_idx1, net_idx2, + start_idx, &rsp); if (err) { shell_error(sh, "Failed to send Bridging Table Get (err %d)", err); return -ENOEXEC; diff --git a/tests/bluetooth/tester/src/btp_mesh.c b/tests/bluetooth/tester/src/btp_mesh.c index efd1d4c35848f..2830d52556bf1 100644 --- a/tests/bluetooth/tester/src/btp_mesh.c +++ b/tests/bluetooth/tester/src/btp_mesh.c @@ -2086,10 +2086,10 @@ static uint8_t models_metadata_get(const void *cmd, uint16_t cmd_len, static uint8_t subnet_bridge_get(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len) { const struct btp_mesh_subnet_bridge_get_cmd *cp = cmd; - enum bt_mesh_subnet_bridge_state state; + enum bt_mesh_brg_cfg_state state; int err; - err = bt_mesh_brg_cfg_cli_subnet_bridge_get(net.net_idx, sys_le16_to_cpu(cp->addr), &state); + err = bt_mesh_brg_cfg_cli_get(net.net_idx, sys_le16_to_cpu(cp->addr), &state); if (err) { LOG_ERR("err=%d", err); return BTP_STATUS_FAILED; @@ -2103,13 +2103,12 @@ static uint8_t subnet_bridge_get(const void *cmd, uint16_t cmd_len, void *rsp, u static uint8_t subnet_bridge_set(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len) { const struct btp_mesh_subnet_bridge_set_cmd *cp = cmd; - enum bt_mesh_subnet_bridge_state state; + enum bt_mesh_brg_cfg_state state; int err; state = cp->val; - err = bt_mesh_brg_cfg_cli_subnet_bridge_set(net.net_idx, sys_le16_to_cpu(cp->addr), state, - &state); + err = bt_mesh_brg_cfg_cli_set(net.net_idx, sys_le16_to_cpu(cp->addr), state, &state); if (err) { LOG_ERR("err=%d", err); return BTP_STATUS_FAILED; @@ -2123,8 +2122,8 @@ static uint8_t subnet_bridge_set(const void *cmd, uint16_t cmd_len, void *rsp, u static uint8_t bridging_table_add(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len) { const struct btp_mesh_bridging_table_add_cmd *cp = cmd; - struct bt_mesh_bridging_table_entry entry; - struct bt_mesh_bridging_table_status rp; + struct bt_mesh_brg_cfg_table_entry entry; + struct bt_mesh_brg_cfg_table_status rp; int err; LOG_DBG(""); @@ -2135,8 +2134,7 @@ static uint8_t bridging_table_add(const void *cmd, uint16_t cmd_len, void *rsp, entry.addr1 = sys_le16_to_cpu(cp->addr1); entry.addr2 = sys_le16_to_cpu(cp->addr2); - err = bt_mesh_brg_cfg_cli_bridging_table_add(net_key_idx, sys_le16_to_cpu(cp->addr), &entry, - &rp); + err = bt_mesh_brg_cfg_cli_table_add(net_key_idx, sys_le16_to_cpu(cp->addr), &entry, &rp); if (err) { LOG_ERR("err=%d", err); return BTP_STATUS_FAILED; @@ -2149,12 +2147,12 @@ static uint8_t bridging_table_remove(const void *cmd, uint16_t cmd_len, void *rs uint16_t *rsp_len) { const struct btp_mesh_bridging_table_remove_cmd *cp = cmd; - struct bt_mesh_bridging_table_status rp; + struct bt_mesh_brg_cfg_table_status rp; int err; LOG_DBG(""); - err = bt_mesh_brg_cfg_cli_bridging_table_remove( + err = bt_mesh_brg_cfg_cli_table_remove( net_key_idx, sys_le16_to_cpu(cp->addr), sys_le16_to_cpu(cp->net_idx1), sys_le16_to_cpu(cp->net_idx2), sys_le16_to_cpu(cp->addr1), sys_le16_to_cpu(cp->addr2), &rp); @@ -2170,8 +2168,8 @@ static uint8_t bridging_table_remove(const void *cmd, uint16_t cmd_len, void *rs static uint8_t bridged_subnets_get(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len) { const struct btp_mesh_bridged_subnets_get_cmd *cp = cmd; - struct bt_mesh_filter_netkey filter_net_idx; - struct bt_mesh_bridged_subnets_list rp; + struct bt_mesh_brg_cfg_filter_netkey filter_net_idx; + struct bt_mesh_brg_cfg_subnets_list rp; int err; LOG_DBG(""); @@ -2184,8 +2182,8 @@ static uint8_t bridged_subnets_get(const void *cmd, uint16_t cmd_len, void *rsp, filter_net_idx.filter = cp->filter; filter_net_idx.net_idx = sys_le16_to_cpu(cp->net_idx); - err = bt_mesh_brg_cfg_cli_bridged_subnets_get(net_key_idx, sys_le16_to_cpu(cp->addr), - filter_net_idx, cp->start_idx, &rp); + err = bt_mesh_brg_cfg_cli_subnets_get(net_key_idx, sys_le16_to_cpu(cp->addr), + filter_net_idx, cp->start_idx, &rp); if (err) { LOG_ERR("err=%d", err); return BTP_STATUS_FAILED; @@ -2197,7 +2195,7 @@ static uint8_t bridged_subnets_get(const void *cmd, uint16_t cmd_len, void *rsp, static uint8_t bridging_table_get(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len) { const struct btp_mesh_bridging_table_get_cmd *cp = cmd; - struct bt_mesh_bridging_table_list rp; + struct bt_mesh_brg_cfg_table_list rp; int err; LOG_DBG(""); @@ -2207,7 +2205,7 @@ static uint8_t bridging_table_get(const void *cmd, uint16_t cmd_len, void *rsp, */ rp.list = NULL; - err = bt_mesh_brg_cfg_cli_bridging_table_get( + err = bt_mesh_brg_cfg_cli_table_get( net_key_idx, sys_le16_to_cpu(cp->addr), sys_le16_to_cpu(cp->net_idx1), sys_le16_to_cpu(cp->net_idx2), sys_le16_to_cpu(cp->start_idx), &rp); if (err) { @@ -2227,8 +2225,7 @@ static uint8_t bridging_table_size_get(const void *cmd, uint16_t cmd_len, void * LOG_DBG(""); - err = bt_mesh_brg_cfg_cli_bridging_table_size_get(net_key_idx, sys_le16_to_cpu(cp->addr), - &size); + err = bt_mesh_brg_cfg_cli_table_size_get(net_key_idx, sys_le16_to_cpu(cp->addr), &size); if (err) { LOG_ERR("err=%d", err); return BTP_STATUS_FAILED; diff --git a/tests/bsim/bluetooth/mesh/src/test_brg.c b/tests/bsim/bluetooth/mesh/src/test_brg.c index 279bed1767bfe..5c82c4dce7411 100644 --- a/tests/bsim/bluetooth/mesh/src/test_brg.c +++ b/tests/bsim/bluetooth/mesh/src/test_brg.c @@ -202,8 +202,8 @@ static void tester_setup(void) static void bridge_entry_add(uint16_t src, uint16_t dst, uint16_t net_idx1, uint16_t net_idx2, uint8_t dir) { - struct bt_mesh_bridging_table_entry entry; - struct bt_mesh_bridging_table_status rsp; + struct bt_mesh_brg_cfg_table_entry entry; + struct bt_mesh_brg_cfg_table_status rsp; int err; entry.directions = dir; @@ -212,7 +212,7 @@ static void bridge_entry_add(uint16_t src, uint16_t dst, uint16_t net_idx1, uint entry.addr1 = src; entry.addr2 = dst; - err = bt_mesh_brg_cfg_cli_bridging_table_add(0, BRIDGE_ADDR, &entry, &rsp); + err = bt_mesh_brg_cfg_cli_table_add(0, BRIDGE_ADDR, &entry, &rsp); if (err || rsp.status || rsp.entry.directions != dir || rsp.entry.net_idx1 != net_idx1 || rsp.entry.net_idx2 != net_idx2 || rsp.entry.addr1 != src || rsp.entry.addr2 != dst) { FAIL("Bridging table add failed (err %d) (status %u)", err, rsp.status); @@ -222,10 +222,10 @@ static void bridge_entry_add(uint16_t src, uint16_t dst, uint16_t net_idx1, uint static void bridge_entry_remove(uint16_t src, uint16_t dst, uint16_t net_idx1, uint16_t net_idx2) { - struct bt_mesh_bridging_table_status rsp; + struct bt_mesh_brg_cfg_table_status rsp; - ASSERT_OK(bt_mesh_brg_cfg_cli_bridging_table_remove(0, BRIDGE_ADDR, net_idx1, net_idx2, src, - dst, &rsp)); + ASSERT_OK(bt_mesh_brg_cfg_cli_table_remove(0, BRIDGE_ADDR, net_idx1, net_idx2, src, dst, + &rsp)); if (rsp.status) { FAIL("Bridging table remove failed (status %u)", rsp.status); return; @@ -247,9 +247,8 @@ static void tester_bridge_configure(int subnets) } } - ASSERT_OK(bt_mesh_brg_cfg_cli_subnet_bridge_set(0, BRIDGE_ADDR, - BT_MESH_SUBNET_BRIDGE_ENABLED, &status)); - if (status != BT_MESH_SUBNET_BRIDGE_ENABLED) { + ASSERT_OK(bt_mesh_brg_cfg_cli_set(0, BRIDGE_ADDR, BT_MESH_BRG_CFG_ENABLED, &status)); + if (status != BT_MESH_BRG_CFG_ENABLED) { FAIL("Subnet bridge set failed (status %u)", status); return; } @@ -333,14 +332,14 @@ struct bridged_addresses_entry { static void bridge_table_verify(uint16_t net_idx1, uint16_t net_idx2, uint16_t start_idx, struct bridged_addresses_entry *list, size_t list_len) { - struct bt_mesh_bridging_table_list rsp = { + struct bt_mesh_brg_cfg_table_list rsp = { .list = NET_BUF_SIMPLE(BT_MESH_RX_SDU_MAX), }; net_buf_simple_init(rsp.list, 0); - ASSERT_OK(bt_mesh_brg_cfg_cli_bridging_table_get(0, BRIDGE_ADDR, net_idx1, net_idx2, - start_idx, &rsp)); + ASSERT_OK( + bt_mesh_brg_cfg_cli_table_get(0, BRIDGE_ADDR, net_idx1, net_idx2, start_idx, &rsp)); ASSERT_EQUAL(rsp.status, 0); ASSERT_EQUAL(rsp.net_idx1, net_idx1); ASSERT_EQUAL(rsp.net_idx2, net_idx2); @@ -472,7 +471,7 @@ static void test_tester_simple(void) /* Adding devices to bridge table */ for (int i = 0; i < REMOTE_NODES; i++) { bridge_entry_add(PROV_ADDR, DEVICE_ADDR_START + i, 0, i + 1, - BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY); + BT_MESH_BRG_CFG_DIR_TWOWAY); } for (int i = 0; i < REMOTE_NODES; i++) { @@ -489,9 +488,8 @@ static void test_tester_simple(void) LOG_INF("Step 2: Disabling bridging..."); - err = bt_mesh_brg_cfg_cli_subnet_bridge_set(0, BRIDGE_ADDR, BT_MESH_SUBNET_BRIDGE_DISABLED, - &status); - if (err || status != BT_MESH_SUBNET_BRIDGE_DISABLED) { + err = bt_mesh_brg_cfg_cli_set(0, BRIDGE_ADDR, BT_MESH_BRG_CFG_DISABLED, &status); + if (err || status != BT_MESH_BRG_CFG_DISABLED) { FAIL("Subnet bridge set failed (err %d) (status %u)", err, status); return; } @@ -506,9 +504,8 @@ static void test_tester_simple(void) } LOG_INF("Step3: Enabling bridging..."); - err = bt_mesh_brg_cfg_cli_subnet_bridge_set(0, BRIDGE_ADDR, BT_MESH_SUBNET_BRIDGE_ENABLED, - &status); - if (err || status != BT_MESH_SUBNET_BRIDGE_ENABLED) { + err = bt_mesh_brg_cfg_cli_set(0, BRIDGE_ADDR, BT_MESH_BRG_CFG_ENABLED, &status); + if (err || status != BT_MESH_BRG_CFG_ENABLED) { FAIL("Subnet bridge set failed (err %d) (status %u)", err, status); return; } @@ -554,7 +551,7 @@ static void test_tester_table_state_change(void) ASSERT_EQUAL(err, -EAGAIN); /* DATA and GET messages should reach Device 1, but STATUS message won't be received. */ - bridge_entry_add(PROV_ADDR, DEVICE_ADDR_START, 0, 1, BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY); + bridge_entry_add(PROV_ADDR, DEVICE_ADDR_START, 0, 1, BT_MESH_BRG_CFG_DIR_ONEWAY); ASSERT_OK(send_data(DEVICE_ADDR_START, 0xAA)); @@ -569,19 +566,17 @@ static void test_tester_table_state_change(void) /* Adding a reverse entry. This should be added to the bridge table as a separate entry as * the addresses and net keys indexs are provided in the opposite order. */ - bridge_entry_add(DEVICE_ADDR_START, PROV_ADDR, 1, 0, BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY); - bridge_table_verify( - 0, 1, 0, - (struct bridged_addresses_entry[]){ - {PROV_ADDR, DEVICE_ADDR_START, BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY}, - }, - 1); - bridge_table_verify( - 1, 0, 0, - (struct bridged_addresses_entry[]){ - {DEVICE_ADDR_START, PROV_ADDR, BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY}, - }, - 1); + bridge_entry_add(DEVICE_ADDR_START, PROV_ADDR, 1, 0, BT_MESH_BRG_CFG_DIR_ONEWAY); + bridge_table_verify(0, 1, 0, + (struct bridged_addresses_entry[]){ + {PROV_ADDR, DEVICE_ADDR_START, BT_MESH_BRG_CFG_DIR_ONEWAY}, + }, + 1); + bridge_table_verify(1, 0, 0, + (struct bridged_addresses_entry[]){ + {DEVICE_ADDR_START, PROV_ADDR, BT_MESH_BRG_CFG_DIR_ONEWAY}, + }, + 1); k_sleep(K_SECONDS(1)); @@ -596,13 +591,12 @@ static void test_tester_table_state_change(void) * tester should still receive STATUS message. */ bridge_entry_remove(DEVICE_ADDR_START, PROV_ADDR, 1, 0); - bridge_entry_add(PROV_ADDR, DEVICE_ADDR_START, 0, 1, BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY); - bridge_table_verify( - 0, 1, 0, - (struct bridged_addresses_entry[]){ - {PROV_ADDR, DEVICE_ADDR_START, BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY}, - }, - 1); + bridge_entry_add(PROV_ADDR, DEVICE_ADDR_START, 0, 1, BT_MESH_BRG_CFG_DIR_TWOWAY); + bridge_table_verify(0, 1, 0, + (struct bridged_addresses_entry[]){ + {PROV_ADDR, DEVICE_ADDR_START, BT_MESH_BRG_CFG_DIR_TWOWAY}, + }, + 1); bridge_table_verify(1, 0, 0, NULL, 0); ASSERT_OK(send_get(DEVICE_ADDR_START)); @@ -651,7 +645,7 @@ static void test_tester_net_key_remove(void) /* Adding devices to bridge table */ for (int i = 0; i < REMOTE_NODES; i++) { bridge_entry_add(PROV_ADDR, DEVICE_ADDR_START + i, 0, i + 1, - BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY); + BT_MESH_BRG_CFG_DIR_TWOWAY); } ASSERT_OK(send_data(DEVICE_ADDR_START, 0xAA)); @@ -667,21 +661,20 @@ static void test_tester_net_key_remove(void) err = k_sem_take(&status_msg_recvd_sem, K_SECONDS(5)); ASSERT_EQUAL(err, -EAGAIN); - bridge_table_verify( - 0, 2, 0, - (struct bridged_addresses_entry[]){ - {PROV_ADDR, DEVICE_ADDR_START + 1, BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY}, - }, - 1); + bridge_table_verify(0, 2, 0, + (struct bridged_addresses_entry[]){ + {PROV_ADDR, DEVICE_ADDR_START + 1, BT_MESH_BRG_CFG_DIR_TWOWAY}, + }, + 1); /* Bridging Table Get message will return Invalid NetKey Index error because Subnet 1 is * removed. */ - struct bt_mesh_bridging_table_list rsp = { + struct bt_mesh_brg_cfg_table_list rsp = { .list = NULL, }; - ASSERT_OK(bt_mesh_brg_cfg_cli_bridging_table_get(0, BRIDGE_ADDR, 0, 1, 0, &rsp)); + ASSERT_OK(bt_mesh_brg_cfg_cli_table_get(0, BRIDGE_ADDR, 0, 1, 0, &rsp)); ASSERT_EQUAL(rsp.status, 4); PASS(); @@ -699,8 +692,8 @@ static void test_tester_persistence(void) LOG_INF("Already provisioned, skipping provisioning"); - ASSERT_OK(bt_mesh_brg_cfg_cli_subnet_bridge_get(0, BRIDGE_ADDR, &status)); - if (status != BT_MESH_SUBNET_BRIDGE_ENABLED) { + ASSERT_OK(bt_mesh_brg_cfg_cli_get(0, BRIDGE_ADDR, &status)); + if (status != BT_MESH_BRG_CFG_ENABLED) { FAIL("Subnet bridge set failed (status %u)", status); return; } @@ -708,30 +701,30 @@ static void test_tester_persistence(void) bridge_table_verify( 0, 1, 0, (struct bridged_addresses_entry[]){ - {PROV_ADDR, DEVICE_ADDR_START, BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY}, + {PROV_ADDR, DEVICE_ADDR_START, BT_MESH_BRG_CFG_DIR_TWOWAY}, }, 1); - bridge_table_verify(0, 2, 0, - (struct bridged_addresses_entry[]){ - {PROV_ADDR, DEVICE_ADDR_START + 1, - BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY}, - }, - 1); + bridge_table_verify( + 0, 2, 0, + (struct bridged_addresses_entry[]){ + {PROV_ADDR, DEVICE_ADDR_START + 1, BT_MESH_BRG_CFG_DIR_TWOWAY}, + }, + 1); bridge_table_verify( 1, 0, 0, (struct bridged_addresses_entry[]){ - {DEVICE_ADDR_START, PROV_ADDR, BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY}, + {DEVICE_ADDR_START, PROV_ADDR, BT_MESH_BRG_CFG_DIR_ONEWAY}, }, 1); - bridge_table_verify(2, 0, 0, - (struct bridged_addresses_entry[]){ - {DEVICE_ADDR_START + 1, PROV_ADDR, - BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY}, - }, - 1); + bridge_table_verify( + 2, 0, 0, + (struct bridged_addresses_entry[]){ + {DEVICE_ADDR_START + 1, PROV_ADDR, BT_MESH_BRG_CFG_DIR_ONEWAY}, + }, + 1); } else { tester_setup(); @@ -744,9 +737,9 @@ static void test_tester_persistence(void) /* Adding devices to bridge table */ for (int i = 0; i < REMOTE_NODES; i++) { bridge_entry_add(PROV_ADDR, DEVICE_ADDR_START + i, 0, i + 1, - BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY); + BT_MESH_BRG_CFG_DIR_TWOWAY); bridge_entry_add(DEVICE_ADDR_START + i, PROV_ADDR, i + 1, 0, - BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY); + BT_MESH_BRG_CFG_DIR_ONEWAY); } k_sleep(K_SECONDS(CONFIG_BT_MESH_STORE_TIMEOUT)); @@ -839,7 +832,7 @@ static void test_tester_ivu(void) /* Adding devices to bridge table */ for (int i = 0; i < REMOTE_NODES; i++) { bridge_entry_add(PROV_ADDR, DEVICE_ADDR_START + i, 0, i + 1, - BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY); + BT_MESH_BRG_CFG_DIR_TWOWAY); } for (int i = 0; i < REMOTE_NODES; i++) { From 0fe6d34f8a49da81c5b9c2b9d324122a169c38a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Tue, 1 Oct 2024 09:07:10 +0200 Subject: [PATCH 0183/4482] Bluetooth: Mesh: Remove duplicate brg declaration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes duplicate declaration of the bridging direction, keeping the one in the public header file. Signed-off-by: Håvard Reierstad --- include/zephyr/bluetooth/mesh/brg_cfg.h | 4 ++-- subsys/bluetooth/mesh/brg_cfg.c | 4 ++-- subsys/bluetooth/mesh/brg_cfg.h | 15 ++------------- tests/bluetooth/mesh/brg/src/main.c | 5 +++++ 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/include/zephyr/bluetooth/mesh/brg_cfg.h b/include/zephyr/bluetooth/mesh/brg_cfg.h index a488fed09c5ec..754ecc9e3e40b 100644 --- a/include/zephyr/bluetooth/mesh/brg_cfg.h +++ b/include/zephyr/bluetooth/mesh/brg_cfg.h @@ -28,9 +28,9 @@ enum bt_mesh_brg_cfg_state { BT_MESH_BRG_CFG_ENABLED, }; -/* Briding from Addr1 to Addr2. */ +/* Bridging from Addr1 to Addr2. */ #define BT_MESH_BRG_CFG_DIR_ONEWAY 1 -/* Bidirectional briging between Addr1 and Addr2. */ +/* Bidirectional bridging between Addr1 and Addr2. */ #define BT_MESH_BRG_CFG_DIR_TWOWAY 2 /** Bridging Table state entry corresponding to a entry in the Bridging Table. */ diff --git a/subsys/bluetooth/mesh/brg_cfg.c b/subsys/bluetooth/mesh/brg_cfg.c index 9c90773faef30..112d2fe0a3e34 100644 --- a/subsys/bluetooth/mesh/brg_cfg.c +++ b/subsys/bluetooth/mesh/brg_cfg.c @@ -224,8 +224,8 @@ static bool netkey_check(uint16_t net_idx1, uint16_t net_idx2) return bt_mesh_subnet_get(net_idx1) && bt_mesh_subnet_get(net_idx2); } -int bt_mesh_brg_cfg_tbl_add(enum bt_mesh_brg_cfg_dir direction, uint16_t net_idx1, - uint16_t net_idx2, uint16_t addr1, uint16_t addr2, uint8_t *status) +int bt_mesh_brg_cfg_tbl_add(uint8_t direction, uint16_t net_idx1, uint16_t net_idx2, uint16_t addr1, + uint16_t addr2, uint8_t *status) { /* Sanity checks */ if (!BT_MESH_ADDR_IS_UNICAST(addr1) || net_idx1 == net_idx2 || addr1 == addr2 || diff --git a/subsys/bluetooth/mesh/brg_cfg.h b/subsys/bluetooth/mesh/brg_cfg.h index af8cc5adc0f1f..4deddd05c1bea 100644 --- a/subsys/bluetooth/mesh/brg_cfg.h +++ b/subsys/bluetooth/mesh/brg_cfg.h @@ -13,17 +13,6 @@ #define BT_MESH_BRG_CFG_NKEY_PRHB_FLT_MASK 0x000C -enum bt_mesh_brg_cfg_dir { - /* Value is prohibited. */ - BT_MESH_BRG_CFG_DIR_PROHIBITED = 0, - /* Briging from Addr1 to Addr2. */ - BT_MESH_BRG_CFG_DIR_ONEWAY = 1, - /* Briging to/from Addr1 from/to Addr2. */ - BT_MESH_BRG_CFG_DIR_TWOWAY = 2, - /* Values above these are prohibited. */ - BT_MESH_BRG_CFG_DIR_MAX = 3, -}; - #define BT_MESH_BRG_CFG_NETIDX_NOMATCH 0xFFFF /* One row of the bridging table */ @@ -50,8 +39,8 @@ int bt_mesh_brg_cfg_tbl_reset(void); int bt_mesh_brg_cfg_tbl_get(const struct bt_mesh_brg_cfg_row **rows); -int bt_mesh_brg_cfg_tbl_add(enum bt_mesh_brg_cfg_dir direction, uint16_t net_idx1, - uint16_t net_idx2, uint16_t addr1, uint16_t addr2, uint8_t *status); +int bt_mesh_brg_cfg_tbl_add(uint8_t direction, uint16_t net_idx1, uint16_t net_idx2, uint16_t addr1, + uint16_t addr2, uint8_t *status); int bt_mesh_brg_cfg_tbl_remove(uint16_t net_idx1, uint16_t net_idx2, uint16_t addr1, uint16_t addr2, uint8_t *status); diff --git a/tests/bluetooth/mesh/brg/src/main.c b/tests/bluetooth/mesh/brg/src/main.c index 65cf5424012db..2b98722e4022f 100644 --- a/tests/bluetooth/mesh/brg/src/main.c +++ b/tests/bluetooth/mesh/brg/src/main.c @@ -293,6 +293,11 @@ ZTEST(bt_mesh_brg_cfg, test_brg_tbl_pending_store) bt_mesh_brg_cfg_pending_store(); } +/* Value is prohibited. */ +#define BT_MESH_BRG_CFG_DIR_PROHIBITED 0 +/* Values above and including this is prohibited. */ +#define BT_MESH_BRG_CFG_DIR_MAX 3 + /* Test if invalid entries are not added to the table. */ ZTEST(bt_mesh_brg_cfg, test_tbl_add_invalid_ip) { From c0ce5b419b774ff6878ab86ab6ecaec71cff0845 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Thu, 16 May 2024 19:31:02 +0800 Subject: [PATCH 0184/4482] Bluetooth: Host: smp: Add function to get bonding setting Add a function bt_get_bondable to get the bonding setting. Signed-off-by: Lyle Zhu --- include/zephyr/bluetooth/conn.h | 11 +++++++++++ subsys/bluetooth/host/smp.c | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/include/zephyr/bluetooth/conn.h b/include/zephyr/bluetooth/conn.h index 1538c36a218f2..c0b91fd5db15b 100644 --- a/include/zephyr/bluetooth/conn.h +++ b/include/zephyr/bluetooth/conn.h @@ -1746,6 +1746,17 @@ static inline const char *bt_security_err_to_str(enum bt_security_err err) */ void bt_set_bondable(bool enable); +/** @brief Get bonding flag. + * + * Get current bonding flag. + * The initial value of this flag depends on @kconfig{CONFIG_BT_BONDABLE} Kconfig + * setting. + * The Bonding flag can be updated using bt_set_bondable(). + * + * @return Current bonding flag. + */ +bool bt_get_bondable(void); + /** @brief Set/clear the bonding flag for a given connection. * * Set/clear the Bonding flag in the Authentication Requirements of diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index 48143548ed95e..2686203a9b056 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -2659,6 +2659,11 @@ void bt_set_bondable(bool enable) bondable = enable; } +bool bt_get_bondable(void) +{ + return bondable; +} + void bt_le_oob_set_sc_flag(bool enable) { sc_oobd_present = enable; From e772c45e6b7ca248d324360e38da752f3cbadace Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Thu, 16 May 2024 19:46:35 +0800 Subject: [PATCH 0185/4482] Bluetooth: SSP: Support non-bondable mode If the return value of function bt_get_bondable is false, clear the bonding flag when controller requiring `Authentication_Requirements`. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/ssp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/subsys/bluetooth/host/classic/ssp.c b/subsys/bluetooth/host/classic/ssp.c index b42c19e2547fc..730d625defc9f 100644 --- a/subsys/bluetooth/host/classic/ssp.c +++ b/subsys/bluetooth/host/classic/ssp.c @@ -642,6 +642,9 @@ void bt_hci_io_capa_resp(struct net_buf *buf) bt_conn_unref(conn); } +/* Clear Bonding flag */ +#define BT_HCI_SET_NO_BONDING(auth) ((auth) & 0x01) + void bt_hci_io_capa_req(struct net_buf *buf) { struct bt_hci_evt_io_capa_req *evt = (void *)buf->data; @@ -690,6 +693,11 @@ void bt_hci_io_capa_req(struct net_buf *buf) auth = ssp_get_auth(conn); } + if (!bt_get_bondable()) { + /* If bondable is false, clear bonding flag. */ + auth = BT_HCI_SET_NO_BONDING(auth); + } + cp = net_buf_add(resp_buf, sizeof(*cp)); bt_addr_copy(&cp->bdaddr, &evt->bdaddr); cp->capability = get_io_capa(); From d5160f663aa017d9365b84e0ecc6e3606dd29746 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Tue, 24 Sep 2024 14:42:20 +0800 Subject: [PATCH 0186/4482] Bluetooth: BR: Improve `bt_conn_set_bondable` In current, the bondable flag cannot be configured for each specific BR connection. But for LE conn, there is a function `bt_conn_set_bondable` for this purpose. Improve `bt_conn_set_bondable` to support BR conn. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/br.c | 2 ++ subsys/bluetooth/host/classic/ssp.c | 2 +- subsys/bluetooth/host/conn_internal.h | 1 + subsys/bluetooth/host/smp.c | 10 ++++++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/classic/br.c b/subsys/bluetooth/host/classic/br.c index b7f885551fa41..65a0fe801259c 100644 --- a/subsys/bluetooth/host/classic/br.c +++ b/subsys/bluetooth/host/classic/br.c @@ -240,6 +240,8 @@ void bt_hci_conn_complete(struct net_buf *buf) bt_conn_set_state(conn, BT_CONN_CONNECTED); + atomic_set_bit_to(conn->flags, BT_CONN_BR_BONDABLE, bt_get_bondable()); + bt_conn_connected(conn); bt_conn_unref(conn); diff --git a/subsys/bluetooth/host/classic/ssp.c b/subsys/bluetooth/host/classic/ssp.c index 730d625defc9f..87552bdc23b3a 100644 --- a/subsys/bluetooth/host/classic/ssp.c +++ b/subsys/bluetooth/host/classic/ssp.c @@ -693,7 +693,7 @@ void bt_hci_io_capa_req(struct net_buf *buf) auth = ssp_get_auth(conn); } - if (!bt_get_bondable()) { + if (!atomic_test_bit(conn->flags, BT_CONN_BR_BONDABLE)) { /* If bondable is false, clear bonding flag. */ auth = BT_HCI_SET_NO_BONDING(auth); } diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h index ab64538255de1..19cd2f04319ba 100644 --- a/subsys/bluetooth/host/conn_internal.h +++ b/subsys/bluetooth/host/conn_internal.h @@ -57,6 +57,7 @@ enum { */ BT_CONN_AUTO_CONNECT, BT_CONN_BR_LEGACY_SECURE, /* 16 digits legacy PIN tracker */ + BT_CONN_BR_BONDABLE, /* BR connection is bondable */ BT_CONN_USER, /* user I/O when pairing */ BT_CONN_BR_PAIRING, /* BR connection in pairing context */ BT_CONN_BR_PAIRED, /* BR connection pairing is done */ diff --git a/subsys/bluetooth/host/smp.c b/subsys/bluetooth/host/smp.c index 2686203a9b056..f6225071d4115 100644 --- a/subsys/bluetooth/host/smp.c +++ b/subsys/bluetooth/host/smp.c @@ -5447,6 +5447,16 @@ int bt_conn_set_bondable(struct bt_conn *conn, bool enable) { struct bt_smp *smp; + if (IS_ENABLED(CONFIG_BT_CLASSIC) && (conn->type == BT_CONN_TYPE_BR)) { + if (enable && atomic_test_and_set_bit(conn->flags, BT_CONN_BR_BONDABLE)) { + return -EALREADY; + } + if (!enable && !atomic_test_and_clear_bit(conn->flags, BT_CONN_BR_BONDABLE)) { + return -EALREADY; + } + return 0; + } + smp = smp_chan_get(conn); if (!smp) { return -EINVAL; From a00d5089d5db1c2d19e9e16ab0b2823f4bfba48e Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Tue, 24 Sep 2024 16:34:29 +0800 Subject: [PATCH 0187/4482] Bluetooth: shell: Add command `conn-bondable` Add command `conn-bondable` to enable/disable the pairing bondable flag of a specific ACL connection. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/shell/bt.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/subsys/bluetooth/host/shell/bt.c b/subsys/bluetooth/host/shell/bt.c index 54ab12cec8f3a..da55537f3395e 100644 --- a/subsys/bluetooth/host/shell/bt.c +++ b/subsys/bluetooth/host/shell/bt.c @@ -3902,6 +3902,35 @@ static int cmd_bondable(const struct shell *sh, size_t argc, char *argv[]) return 0; } +#if defined(CONFIG_BT_BONDABLE_PER_CONNECTION) +static int cmd_conn_bondable(const struct shell *sh, size_t argc, char *argv[]) +{ + int err = 0; + bool enable; + + if (!default_conn) { + shell_error(sh, "Not connected"); + return -ENOEXEC; + } + + enable = shell_strtobool(argv[1], 0, &err); + if (err) { + shell_help(sh); + return SHELL_CMD_HELP_PRINTED; + } + + shell_print(sh, "[%p] set conn bondable %s", default_conn, argv[1]); + + err = bt_conn_set_bondable(default_conn, enable); + if (err) { + shell_error(sh, "Set conn bondable failed: err %d", err); + return -ENOEXEC; + } + shell_print(sh, "Set conn bondable done"); + return 0; +} +#endif /* CONFIG_BT_BONDABLE_PER_CONNECTION */ + static void bond_info(const struct bt_bond_info *info, void *user_data) { char addr[BT_ADDR_LE_STR_LEN]; @@ -5079,6 +5108,9 @@ SHELL_STATIC_SUBCMD_SET_CREATE(bt_cmds, cmd_security, 1, 2), SHELL_CMD_ARG(bondable, NULL, HELP_ONOFF, cmd_bondable, 2, 0), +#if defined(CONFIG_BT_BONDABLE_PER_CONNECTION) + SHELL_CMD_ARG(conn-bondable, NULL, HELP_ONOFF, cmd_conn_bondable, 2, 0), +#endif /* CONFIG_BT_BONDABLE_PER_CONNECTION */ SHELL_CMD_ARG(bonds, NULL, HELP_NONE, cmd_bonds, 1, 0), SHELL_CMD_ARG(connections, NULL, HELP_NONE, cmd_connections, 1, 0), SHELL_CMD_ARG(auth, NULL, From aaab22357485c566926643af15a610294f641d35 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Tue, 24 Sep 2024 17:15:20 +0800 Subject: [PATCH 0188/4482] Bluetooth: SSP: Incorrect bonding status notified The `bonded` flag of the callback `pairing_complete` is always true, event if the SSP pairing is non-bondable. Check the bonding status in SSP complete event instead of in link key notify event. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/ssp.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/subsys/bluetooth/host/classic/ssp.c b/subsys/bluetooth/host/classic/ssp.c index 87552bdc23b3a..ea8f1655ab520 100644 --- a/subsys/bluetooth/host/classic/ssp.c +++ b/subsys/bluetooth/host/classic/ssp.c @@ -479,11 +479,6 @@ void bt_hci_link_key_notify(struct net_buf *buf) conn->br.link_key->flags |= BT_LINK_KEY_AUTHENTICATED; __fallthrough; case BT_LK_UNAUTH_COMBINATION_P192: - /* Mark no-bond so that link-key is removed on disconnection */ - if (ssp_get_auth(conn) < BT_HCI_DEDICATED_BONDING) { - atomic_set_bit(conn->flags, BT_CONN_BR_NOBOND); - } - memcpy(conn->br.link_key->val, evt->link_key, 16); break; case BT_LK_AUTH_COMBINATION_P256: @@ -492,11 +487,6 @@ void bt_hci_link_key_notify(struct net_buf *buf) case BT_LK_UNAUTH_COMBINATION_P256: conn->br.link_key->flags |= BT_LINK_KEY_SC; - /* Mark no-bond so that link-key is removed on disconnection */ - if (ssp_get_auth(conn) < BT_HCI_DEDICATED_BONDING) { - atomic_set_bit(conn->flags, BT_CONN_BR_NOBOND); - } - memcpy(conn->br.link_key->val, evt->link_key, 16); break; default: @@ -720,6 +710,11 @@ void bt_hci_ssp_complete(struct net_buf *buf) return; } + /* Mark no-bond so that link-key will be removed on disconnection */ + if (ssp_get_auth(conn) < BT_HCI_DEDICATED_BONDING) { + atomic_set_bit(conn->flags, BT_CONN_BR_NOBOND); + } + ssp_pairing_complete(conn, bt_security_err_get(evt->status)); if (evt->status) { bt_conn_disconnect(conn, BT_HCI_ERR_AUTH_FAIL); From 0ed8866eb6776179871bf1146879a2ca92c32ab4 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Wed, 25 Sep 2024 21:22:34 +0800 Subject: [PATCH 0189/4482] Bluetooth: host: Kconfig: Correct `help` of `BT_BONDABLE` Correct the `help` of the configuration `BT_BONDABLE`. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/Kconfig | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/host/Kconfig b/subsys/bluetooth/host/Kconfig index 233c916408fd2..05214f224b133 100644 --- a/subsys/bluetooth/host/Kconfig +++ b/subsys/bluetooth/host/Kconfig @@ -632,9 +632,13 @@ config BT_BONDABLE bool "Bondable Mode" default y help - This option enables support for Bondable Mode. In this mode, - Bonding flag in AuthReq of SMP Pairing Request/Response will be set - indicating the support for this mode. + This option is the default value of the bonding flag for any ACL connection. + If the option is true, the default bonding flag is true. Or, the default + bonding flag is false. + After a connection is established, the bonding flag of the connection + can also be changed by calling `bt_conn_set_bondable()` if the configuration + `the bonding flag per-connection` (BT_BONDABLE_PER_CONNECTION) is + enabled. Please see the BT_BONDABLE_PER_CONNECTION configuration. config BT_BONDING_REQUIRED bool "Always require bonding" From 715b97397b797c7f105053dd41f2532006ae909d Mon Sep 17 00:00:00 2001 From: Pete Skeggs Date: Sat, 28 Sep 2024 14:46:21 -0700 Subject: [PATCH 0190/4482] net: lib: coap: Make use of ZSOCK_MSG_TRUNC configurable Not all offloaded network stacks support this socket option so control it using a Kconfig CONFIG_COAP_CLIENT_TRUNCATE_MSGS, and enable it by default. Signed-off-by: Pete Skeggs --- subsys/net/lib/coap/Kconfig | 8 ++++++++ subsys/net/lib/coap/coap_client.c | 17 ++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/subsys/net/lib/coap/Kconfig b/subsys/net/lib/coap/Kconfig index 61a5d2ab78542..443514a686152 100644 --- a/subsys/net/lib/coap/Kconfig +++ b/subsys/net/lib/coap/Kconfig @@ -152,6 +152,14 @@ config COAP_CLIENT_MAX_REQUESTS help Maximum number of CoAP requests a single client can handle at a time +config COAP_CLIENT_TRUNCATE_MSGS + bool "Receive notification when blocks are truncated" + default y + help + Include ZSOCK_MSG_TRUNC in flags passed to zsock_recvfrom() to + receive network stack notifications about block truncation. + Otherwise it happens silently. + endif # COAP_CLIENT config COAP_SERVER diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index 218eebe3368c7..e2fd86167f592 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -592,14 +592,21 @@ static int recv_response(struct coap_client *client, struct coap_packet *respons int total_len; int available_len; int ret; + int flags = ZSOCK_MSG_DONTWAIT; + + if (IS_ENABLED(CONFIG_COAP_CLIENT_TRUNCATE_MSGS)) { + flags |= ZSOCK_MSG_TRUNC; + } memset(client->recv_buf, 0, sizeof(client->recv_buf)); - total_len = receive(client->fd, client->recv_buf, sizeof(client->recv_buf), - ZSOCK_MSG_DONTWAIT | ZSOCK_MSG_TRUNC, &client->address, - &client->socklen); + total_len = receive(client->fd, client->recv_buf, sizeof(client->recv_buf), flags, + &client->address, &client->socklen); if (total_len < 0) { LOG_ERR("Error reading response: %d", errno); + if (errno == EOPNOTSUPP) { + return -errno; + } return -EINVAL; } else if (total_len == 0) { LOG_ERR("Zero length recv"); @@ -937,6 +944,10 @@ static void coap_client_recv(void *coap_cl, void *a, void *b) LOG_ERR("Error receiving response"); clients[i]->response_ready = false; k_mutex_unlock(&clients[i]->lock); + if (ret == -EOPNOTSUPP) { + LOG_ERR("Socket misconfigured."); + goto idle; + } continue; } From c85d157fc03f76b6d7ac9179f120e6063ca0e041 Mon Sep 17 00:00:00 2001 From: Iuliana Prodan Date: Fri, 19 Jul 2024 20:38:21 +0300 Subject: [PATCH 0191/4482] soc: nxp: imx: add resource_table section in linker script Add resource_table section in linker script for i.MX8QXP and i.MX8QM, for inter-process communication. Signed-off-by: Iuliana Prodan --- soc/nxp/imx/imx8/adsp/linker.ld | 8 +++++++- soc/nxp/imx/imx8x/adsp/linker.ld | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/soc/nxp/imx/imx8/adsp/linker.ld b/soc/nxp/imx/imx8/adsp/linker.ld index a0754d007dfe4..36f90d309a473 100644 --- a/soc/nxp/imx/imx8/adsp/linker.ld +++ b/soc/nxp/imx/imx8/adsp/linker.ld @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 NXP + * Copyright 2021, 2024 NXP * * SPDX-License-Identifier: Apache-2.0 */ @@ -171,6 +171,12 @@ EXTERN(ext_man_fw_ver) SECTIONS { +#ifdef CONFIG_OPENAMP_RSC_TABLE + SECTION_PROLOGUE(.resource_table,, SUBALIGN(4)) + { + KEEP(*(.resource_table*)) + } GROUP_LINK_IN(ROMABLE_REGION) +#endif #include diff --git a/soc/nxp/imx/imx8x/adsp/linker.ld b/soc/nxp/imx/imx8x/adsp/linker.ld index a0754d007dfe4..b0bc2aaad968b 100644 --- a/soc/nxp/imx/imx8x/adsp/linker.ld +++ b/soc/nxp/imx/imx8x/adsp/linker.ld @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 NXP + * Copyright 2021, 2024 NXP * * SPDX-License-Identifier: Apache-2.0 */ @@ -172,6 +172,13 @@ EXTERN(ext_man_fw_ver) SECTIONS { +#ifdef CONFIG_OPENAMP_RSC_TABLE + SECTION_PROLOGUE(.resource_table,, SUBALIGN(4)) + { + KEEP(*(.resource_table*)) + } GROUP_LINK_IN(ROMABLE_REGION) +#endif + #include #ifdef CONFIG_LLEXT From 991eb0cd10d9324bb4118134fc62f68f982e9d2d Mon Sep 17 00:00:00 2001 From: Iuliana Prodan Date: Fri, 19 Jul 2024 20:39:33 +0300 Subject: [PATCH 0192/4482] dts: xtensa: nxp: add mailbox node Add mailbox node used for inter-process communication. For DSP, we have a direct interrupt line to the core. Signed-off-by: Iuliana Prodan --- dts/xtensa/nxp/nxp_imx8.dtsi | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dts/xtensa/nxp/nxp_imx8.dtsi b/dts/xtensa/nxp/nxp_imx8.dtsi index 87713a71200a1..9e8229e7b8e5f 100644 --- a/dts/xtensa/nxp/nxp_imx8.dtsi +++ b/dts/xtensa/nxp/nxp_imx8.dtsi @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 NXP + * Copyright 2021, 2024 NXP * * SPDX-License-Identifier: Apache-2.0 */ @@ -178,4 +178,13 @@ clocks = <&ccm IMX_CCM_LPUART3_CLK 0x0 0x0>; status = "disabled"; }; + + mailbox0: mailbox@5d310000 { + compatible = "nxp,imx-mu"; + reg = <0x5d310000 0x10000>; + interrupt-parent = <&clic>; + interrupts = <7 0 0>; + rdc = <0>; + status = "disabled"; + }; }; From 42b116e4acd5c4fefb75201fab06c8bd2d4aca4b Mon Sep 17 00:00:00 2001 From: Iuliana Prodan Date: Fri, 19 Jul 2024 20:41:32 +0300 Subject: [PATCH 0193/4482] samples: add support for i.MX8QM and i.MX8QXP DSP core in openamp_rsc_table Add the dts and config overlay for the two boards in order to have the openamp_rsc_table sample working on HiFi4 DSP from i.MX8QM and i.MX8QXP. Since these two are similar, use a snippet. Therefore, to compile the sample we use: west build -p -b imx8qm_mek/mimx8qm6/adsp -S nxp-openamp-imx8-adsp -s samples/subsys/ipc/openamp_rsc_table/ Signed-off-by: Iuliana Prodan --- .../snippets/nxp-openamp-imx8-adsp.conf | 5 ++++ .../snippets/nxp-openamp-imx8-adsp.overlay | 24 +++++++++++++++++++ .../openamp_rsc_table/snippets/snippet.yml | 6 +++++ 3 files changed, 35 insertions(+) create mode 100644 samples/subsys/ipc/openamp_rsc_table/snippets/nxp-openamp-imx8-adsp.conf create mode 100644 samples/subsys/ipc/openamp_rsc_table/snippets/nxp-openamp-imx8-adsp.overlay create mode 100644 samples/subsys/ipc/openamp_rsc_table/snippets/snippet.yml diff --git a/samples/subsys/ipc/openamp_rsc_table/snippets/nxp-openamp-imx8-adsp.conf b/samples/subsys/ipc/openamp_rsc_table/snippets/nxp-openamp-imx8-adsp.conf new file mode 100644 index 0000000000000..01dd4f8ca3fb8 --- /dev/null +++ b/samples/subsys/ipc/openamp_rsc_table/snippets/nxp-openamp-imx8-adsp.conf @@ -0,0 +1,5 @@ +CONFIG_LOG_PRINTK=n +CONFIG_IPM_IMX_MAX_DATA_SIZE_16=n +CONFIG_IPM_IMX_MAX_DATA_SIZE_4=y +CONFIG_OPENAMP_WITH_DCACHE=y +CONFIG_IPM_IMX_FW_READY_REPLY=y diff --git a/samples/subsys/ipc/openamp_rsc_table/snippets/nxp-openamp-imx8-adsp.overlay b/samples/subsys/ipc/openamp_rsc_table/snippets/nxp-openamp-imx8-adsp.overlay new file mode 100644 index 0000000000000..56843c499c350 --- /dev/null +++ b/samples/subsys/ipc/openamp_rsc_table/snippets/nxp-openamp-imx8-adsp.overlay @@ -0,0 +1,24 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + /* + * shared memory reserved for the inter-processor communication + */ + zephyr,ipc_shm = &dspsram3; + zephyr,ipc = &mailbox0; + }; + + dspsram3: memory@942f0000 { + compatible = "mmio-sram"; + reg = <0x942f0000 0x110000>; + }; +}; + +&mailbox0 { + status = "okay"; +}; diff --git a/samples/subsys/ipc/openamp_rsc_table/snippets/snippet.yml b/samples/subsys/ipc/openamp_rsc_table/snippets/snippet.yml new file mode 100644 index 0000000000000..1768672fd2ebd --- /dev/null +++ b/samples/subsys/ipc/openamp_rsc_table/snippets/snippet.yml @@ -0,0 +1,6 @@ +name: nxp-openamp-imx8-adsp +boards: + /imx8qxp_mek\/mimx8qx6\/adsp|imx8qm_mek\/mimx8qm6\/adsp/: + append: + EXTRA_DTC_OVERLAY_FILE: nxp-openamp-imx8-adsp.overlay + EXTRA_CONF_FILE: nxp-openamp-imx8-adsp.conf From d8c0a67d7b7593064ccbd2cb3ce7f4bbecf79c85 Mon Sep 17 00:00:00 2001 From: Georgij Cernysiov Date: Mon, 30 Sep 2024 16:07:09 +0200 Subject: [PATCH 0194/4482] drivers: ethernet: adin2111: fix generic spi frame reception Fixes a bug that results in double RX buffer read from ADIN when generic SPI protocol is used. Actual frame size to be read must be RX_FSIZE - HEADER. If we read less amount of bytes, then ADIN raises an IRQ or signals via Pn_RX_RDY that there is another frame available, as we fail to read the whole frame. The fix for "Still some length to go 2" is still present, we drop the CRC32 bytes from the frame prior allocation and network stack pass. Signed-off-by: Georgij Cernysiov --- drivers/ethernet/eth_adin2111.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/ethernet/eth_adin2111.c b/drivers/ethernet/eth_adin2111.c index 28a938bc5fddd..992daed9abd12 100644 --- a/drivers/ethernet/eth_adin2111.c +++ b/drivers/ethernet/eth_adin2111.c @@ -557,8 +557,8 @@ static int adin2111_read_fifo(const struct device *dev, const uint16_t port_idx) /* burst read must be in multiples of 4 */ padding_len = ((fsize % 4) == 0) ? 0U : (ROUND_UP(fsize, 4U) - fsize); - /* actual frame length is FSIZE - FRAME HEADER - CRC32 */ - fsize_real = fsize - (ADIN2111_FRAME_HEADER_SIZE + sizeof(uint32_t)); + /* actual available frame length is FSIZE - FRAME HEADER */ + fsize -= ADIN2111_FRAME_HEADER_SIZE; /* spi header */ *(uint16_t *)cmd_buf = htons((ADIN2111_READ_TXN_CTRL | rx_reg)); @@ -574,7 +574,7 @@ static int adin2111_read_fifo(const struct device *dev, const uint16_t port_idx) const struct spi_buf tx_buf = { .buf = cmd_buf, .len = sizeof(cmd_buf) }; const struct spi_buf rx_buf[3] = { {.buf = NULL, .len = sizeof(cmd_buf) + ADIN2111_FRAME_HEADER_SIZE}, - {.buf = ctx->buf, .len = fsize_real}, + {.buf = ctx->buf, .len = fsize}, {.buf = NULL, .len = padding_len } }; const struct spi_buf_set tx = { .buffers = &tx_buf, .count = 1U }; @@ -590,6 +590,9 @@ static int adin2111_read_fifo(const struct device *dev, const uint16_t port_idx) return ret; } + /* remove CRC32 and pass to the stack */ + fsize_real = fsize - sizeof(uint32_t); + pkt = net_pkt_rx_alloc_with_buffer(iface, fsize_real, AF_UNSPEC, 0, K_MSEC(CONFIG_ETH_ADIN2111_TIMEOUT)); if (!pkt) { From 867e84ce5969c60ef1b10d5a39774ce63d929b96 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 30 Sep 2024 15:48:37 +0200 Subject: [PATCH 0195/4482] manifest: Update nRF hw models to latest Update the HW models module to: bf8e45bd1f870e49cc15392e045c28d54ea12285 Including the following: * bf8e45b (52) CCM HAL: Support nrfx 3.7.0 with renamed TASK_CRYPT * 14c14d7 HW_models/NHW_GRTC: Support MDK not exposing SYSCOUNTERVALID * 6d66801 RADIO: Improve RSSISTART behaviour * ceb6a80 hal grtc: Add replacements for new int group functions * 838aa38 docs/README_HW_models: Add reference to Bsim HW models descr * 0ff34d7 docs: Several updates and fixes * 2972a93 AES_CCM: Avoid UBSAN pointer align warnwhen reading CNFPTR * f8cd477 UART: Minor bugfix: Set rx status to off during ENABLE Signed-off-by: Alberto Escolar Piedras --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 9ec48d6bf499f..530fbd19b30dd 100644 --- a/west.yml +++ b/west.yml @@ -300,7 +300,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: 85944c64f224406e4d781aa382c5f1f71ed307fd + revision: bf8e45bd1f870e49cc15392e045c28d54ea12285 path: modules/bsim_hw_models/nrf_hw_models - name: open-amp revision: 76d2168bcdfcd23a9a7dce8c21f2083b90a1e60a From 094b0498a9920bd20b026f6e575b5c8ba71e8bcd Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Mon, 30 Sep 2024 16:09:34 +0200 Subject: [PATCH 0196/4482] manifest: update open-amp to include change to strlcpy This manifest update points open-amp to include a fix for unsafe use of strncpy by by replacing it with internal strlcpy. Signed-off-by: Torsten Rasmussen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 530fbd19b30dd..3d2aeef7e0e19 100644 --- a/west.yml +++ b/west.yml @@ -303,7 +303,7 @@ manifest: revision: bf8e45bd1f870e49cc15392e045c28d54ea12285 path: modules/bsim_hw_models/nrf_hw_models - name: open-amp - revision: 76d2168bcdfcd23a9a7dce8c21f2083b90a1e60a + revision: b735edbc739ad59156eb55bb8ce2583d74537719 path: modules/lib/open-amp - name: openthread revision: 2aeb8b833ba760ec29d5f340dd1ce7bcb61c5d56 From a3f2ba1928c0904493c3b2a1ee8a164d9e90436d Mon Sep 17 00:00:00 2001 From: Jori Rintahaka Date: Mon, 30 Sep 2024 16:46:13 +0300 Subject: [PATCH 0197/4482] drivers: bluetooth: silabs: move code from module to main tree The code that handles passing events to and from the controller resided in the hal_silabs module. This is an integral part of the HCI driver that it can't work without, and logically belongs in the driver. Signed-off-by: Jori Rintahaka --- drivers/bluetooth/hci/slz_hci.c | 51 +++++++++++++++++++++++++++++---- west.yml | 2 +- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/drivers/bluetooth/hci/slz_hci.c b/drivers/bluetooth/hci/slz_hci.c index 432ea39c39841..1c86e71bd014d 100644 --- a/drivers/bluetooth/hci/slz_hci.c +++ b/drivers/bluetooth/hci/slz_hci.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #define LOG_LEVEL CONFIG_BT_HCI_DRIVER_LOG_LEVEL @@ -34,6 +33,17 @@ struct hci_data { static K_KERNEL_STACK_DEFINE(slz_ll_stack, SL_BT_SILABS_LL_STACK_SIZE); static struct k_thread slz_ll_thread; +/* Semaphore for Link Layer */ +K_SEM_DEFINE(slz_ll_sem, 0, 1); + +/* Events mask for Link Layer */ +static atomic_t sli_btctrl_events; + +/* FIXME: these functions should come from the SiSDK headers! */ +void BTLE_LL_EventRaise(uint32_t events); +void BTLE_LL_Process(uint32_t events); +bool sli_pending_btctrl_events(void); + void rail_isr_installer(void) { #ifdef CONFIG_SOC_SERIES_EFR32MG24 @@ -72,11 +82,11 @@ uint32_t hci_common_transport_transmit(uint8_t *data, int16_t len) len -= 1; switch (packet_type) { - case h4_event: + case BT_HCI_H4_EVT: event_code = data[0]; buf = bt_buf_get_evt(event_code, false, K_FOREVER); break; - case h4_acl: + case BT_HCI_H4_ACL: buf = bt_buf_get_rx(BT_BUF_ACL_IN, K_FOREVER); break; default: @@ -100,10 +110,10 @@ static int slz_bt_send(const struct device *dev, struct net_buf *buf) switch (bt_buf_get_type(buf)) { case BT_BUF_ACL_OUT: - net_buf_push_u8(buf, h4_acl); + net_buf_push_u8(buf, BT_HCI_H4_ACL); break; case BT_BUF_CMD: - net_buf_push_u8(buf, h4_command); + net_buf_push_u8(buf, BT_HCI_H4_CMD); break; default: rv = -EINVAL; @@ -120,13 +130,25 @@ static int slz_bt_send(const struct device *dev, struct net_buf *buf) return rv; } +/** + * The HCI driver thread simply waits for the LL semaphore to signal that + * it has an event to handle, whether it's from the radio, its own scheduler, + * or an HCI event to pass upstairs. The BTLE_LL_Process function call will + * take care of all of them, and add HCI events to the HCI queue when applicable. + */ static void slz_thread_func(void *p1, void *p2, void *p3) { ARG_UNUSED(p1); ARG_UNUSED(p2); ARG_UNUSED(p3); - slz_ll_thread_func(); + while (true) { + uint32_t events; + + k_sem_take(&slz_ll_sem, K_FOREVER); + events = atomic_clear(&sli_btctrl_events); + BTLE_LL_Process(events); + } } static int slz_bt_open(const struct device *dev, bt_hci_recv_t recv) @@ -211,6 +233,23 @@ static int slz_bt_open(const struct device *dev, bt_hci_recv_t recv) return ret; } +bool sli_pending_btctrl_events(void) +{ + return false; /* TODO: check if this should really return false! */ +} + +/* Store event flags and increment the LL semaphore */ +void BTLE_LL_EventRaise(uint32_t events) +{ + atomic_or(&sli_btctrl_events, events); + k_sem_give(&slz_ll_sem); +} + +void sl_bt_controller_init(void) +{ + /* No extra initialization procedure required */ +} + static const struct bt_hci_driver_api drv = { .open = slz_bt_open, .send = slz_bt_send, diff --git a/west.yml b/west.yml index 3d2aeef7e0e19..23d11e10054ce 100644 --- a/west.yml +++ b/west.yml @@ -223,7 +223,7 @@ manifest: groups: - hal - name: hal_silabs - revision: bb44c61d3f8b1e00d7b3d3804cfaf8df1e905d5d + revision: d07d744a933bada3a87377dc46241960f620011f path: modules/hal/silabs groups: - hal From 96c6c7863ab07996472156c032736b8b86b5fca5 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 30 Sep 2024 14:41:18 +0100 Subject: [PATCH 0198/4482] sysbuild: cmake: Fix ExternalZephyrProject_Add() revision handling Fixes an issue with HWMv2 boards whereby the specified board revision was not applied at the correct place, which would cause the target image to fail configuration Fixes #79208 Signed-off-by: Jamie McCrae --- .../cmake/modules/sysbuild_extensions.cmake | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake index c1b2513d192f5..135160f564993 100644 --- a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake +++ b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake @@ -398,7 +398,22 @@ function(ExternalZephyrProject_Add) # unless _BOARD is defined. if(DEFINED ZBUILD_BOARD_REVISION) # Use provided board revision - set_target_properties(${ZBUILD_APPLICATION} PROPERTIES BOARD ${ZBUILD_BOARD}@${ZBUILD_BOARD_REVISION}) + if(ZBUILD_BOARD MATCHES "/") + # HWMv2 requires adding version to the board, split elements up, attach version, then + # reassemble into a complete string + string(REPLACE "/" ";" split_board_qualifiers "${ZBUILD_BOARD}") + list(GET split_board_qualifiers 0 target_board) + set(target_board ${target_board}@${ZBUILD_BOARD_REVISION}) + list(REMOVE_AT split_board_qualifiers 0) + list(PREPEND split_board_qualifiers ${target_board}) + string(REPLACE ";" "/" board_qualifiers "${split_board_qualifiers}") + set_target_properties(${ZBUILD_APPLICATION} PROPERTIES BOARD ${board_qualifiers}) + set(split_board_qualifiers) + set(board_qualifiers) + else() + # Legacy HWMv1 support, version goes at end + set_target_properties(${ZBUILD_APPLICATION} PROPERTIES BOARD ${ZBUILD_BOARD}@${ZBUILD_BOARD_REVISION}) + endif() else() set_target_properties(${ZBUILD_APPLICATION} PROPERTIES BOARD ${ZBUILD_BOARD}) endif() From 476c12fddec44c372d7369aa8ee7c255b31157c1 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Mon, 30 Sep 2024 13:55:00 +0200 Subject: [PATCH 0199/4482] include: zephyr: net: coap_service: Use _CONCAT expansion Passing MACRO arguments that need expansion require _CONCAT. Signed-off-by: Pieter De Gendt --- include/zephyr/net/coap_service.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/zephyr/net/coap_service.h b/include/zephyr/net/coap_service.h index 718d1fb1cfcde..f5bf3f8405b7b 100644 --- a/include/zephyr/net/coap_service.h +++ b/include/zephyr/net/coap_service.h @@ -59,7 +59,7 @@ struct coap_service { }; #define __z_coap_service_define(_name, _host, _port, _flags, _res_begin, _res_end) \ - static struct coap_service_data coap_service_data_##_name = { \ + static struct coap_service_data _CONCAT(coap_service_data_, _name) = { \ .sock_fd = -1, \ }; \ const STRUCT_SECTION_ITERABLE(coap_service, _name) = { \ @@ -69,7 +69,7 @@ struct coap_service { .flags = _flags, \ .res_begin = (_res_begin), \ .res_end = (_res_end), \ - .data = &coap_service_data_##_name, \ + .data = &_CONCAT(coap_service_data_, _name), \ } /** @endcond */ @@ -111,8 +111,8 @@ struct coap_service { * @param _service Name of the associated service. */ #define COAP_RESOURCE_DEFINE(_name, _service, ...) \ - STRUCT_SECTION_ITERABLE_ALTERNATE(coap_resource_##_service, coap_resource, _name) \ - = __VA_ARGS__ + STRUCT_SECTION_ITERABLE_ALTERNATE(_CONCAT(coap_resource_, _service), coap_resource, \ + _name) = __VA_ARGS__ /** * @brief Define a CoAP service with static resources. @@ -132,11 +132,11 @@ struct coap_service { * @param _flags Configuration flags @see @ref COAP_SERVICE_FLAGS. */ #define COAP_SERVICE_DEFINE(_name, _host, _port, _flags) \ - extern struct coap_resource _CONCAT(_coap_resource_##_name, _list_start)[]; \ - extern struct coap_resource _CONCAT(_coap_resource_##_name, _list_end)[]; \ + extern struct coap_resource _CONCAT(_CONCAT(_coap_resource_, _name), _list_start)[]; \ + extern struct coap_resource _CONCAT(_CONCAT(_coap_resource_, _name), _list_end)[]; \ __z_coap_service_define(_name, _host, _port, _flags, \ - &_CONCAT(_coap_resource_##_name, _list_start)[0], \ - &_CONCAT(_coap_resource_##_name, _list_end)[0]) + &_CONCAT(_CONCAT(_coap_resource_, _name), _list_start)[0], \ + &_CONCAT(_CONCAT(_coap_resource_, _name), _list_end)[0]) /** * @brief Count the number of CoAP services. @@ -177,7 +177,7 @@ struct coap_service { * @param _it Name of iterator (of type @ref coap_resource) */ #define COAP_RESOURCE_FOREACH(_service, _it) \ - STRUCT_SECTION_FOREACH_ALTERNATE(coap_resource_##_service, coap_resource, _it) + STRUCT_SECTION_FOREACH_ALTERNATE(_CONCAT(coap_resource_, _service), coap_resource, _it) /** * @brief Iterate over all static resources associated with @p _service . From 01754956de29e48d8bf625f09bc6a5794d1f1bdd Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Mon, 30 Sep 2024 11:51:50 +0300 Subject: [PATCH 0200/4482] boards: nxp: imx95_evk: add rimage support for m7 ddr variant Add rimage support for the i.MX95 EVK M7-based DDR board variant. This is only required when running SOF. Signed-off-by: Laurentiu Mihalcea --- boards/nxp/imx95_evk/CMakeLists.txt | 13 +++++++++++++ boards/nxp/imx95_evk/board.cmake | 5 +++++ 2 files changed, 18 insertions(+) create mode 100644 boards/nxp/imx95_evk/CMakeLists.txt create mode 100644 boards/nxp/imx95_evk/board.cmake diff --git a/boards/nxp/imx95_evk/CMakeLists.txt b/boards/nxp/imx95_evk/CMakeLists.txt new file mode 100644 index 0000000000000..4b24695474302 --- /dev/null +++ b/boards/nxp/imx95_evk/CMakeLists.txt @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: Apache-2.0 + +if (CONFIG_SOF AND CONFIG_BOARD_IMX95_EVK_MIMX9596_M7_DDR) + add_custom_target(zephyr.ri ALL + DEPENDS ${CMAKE_BINARY_DIR}/zephyr/zephyr.ri + ) + + add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/zephyr/zephyr.ri + COMMAND west sign --if-tool-available --tool rimage --build-dir ${CMAKE_BINARY_DIR} ${WEST_SIGN_OPTS} + DEPENDS ${CMAKE_BINARY_DIR}/zephyr/${KERNEL_ELF_NAME} + ) +endif() diff --git a/boards/nxp/imx95_evk/board.cmake b/boards/nxp/imx95_evk/board.cmake new file mode 100644 index 0000000000000..57089c3f1b089 --- /dev/null +++ b/boards/nxp/imx95_evk/board.cmake @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + +if (CONFIG_SOF AND CONFIG_BOARD_IMX95_EVK_MIMX9596_M7_DDR) + board_set_rimage_target(imx95) +endif() From 155f3f3ba688dac3e1113ada3f9cfa894612f951 Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Mon, 30 Sep 2024 13:02:14 +0300 Subject: [PATCH 0201/4482] west_commands: sign: add imx95 to target list Add imx95 to target list to allow signing images for imx95. Signed-off-by: Laurentiu Mihalcea --- scripts/west_commands/sign.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/west_commands/sign.py b/scripts/west_commands/sign.py index 5f59facffbf7e..54fbe75d8fde7 100644 --- a/scripts/west_commands/sign.py +++ b/scripts/west_commands/sign.py @@ -485,7 +485,7 @@ def sign(self, command, build_dir, build_conf, formats): kernel_name = build_conf.get('CONFIG_KERNEL_BIN_NAME', 'zephyr') # TODO: make this a new sign.py --bootloader option. - if target in ('imx8', 'imx8m', 'imx8ulp'): + if target in ('imx8', 'imx8m', 'imx8ulp', 'imx95'): bootloader = None kernel = str(b / 'zephyr' / f'{kernel_name}.elf') out_bin = str(b / 'zephyr' / f'{kernel_name}.ri') From c710f8892beef3e486dded2f0ad4394e4a4d9aa0 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Thu, 19 Sep 2024 12:43:17 +0800 Subject: [PATCH 0202/4482] drivers: intc: plic: implement irq affinity configuration - Implement irq-set-affinity in RISCV PLIC. - Added new affinity shell command to get/set the irq(s) affinity in runtime, when `0` is sent as the `local_irq`, it means set/get all IRQs affinity. - Some minor optimizations Updated the build_all test to build this new configuration. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- arch/riscv/core/smp.c | 6 +- drivers/interrupt_controller/Kconfig.plic | 32 ++ drivers/interrupt_controller/intc_plic.c | 442 +++++++++++++++--- .../drivers/interrupt_controller/riscv_plic.h | 10 + .../intc_plic/testcase.yaml | 10 + 5 files changed, 431 insertions(+), 69 deletions(-) diff --git a/arch/riscv/core/smp.c b/arch/riscv/core/smp.c index 4ef287c4a7a56..bc56c1fba8c6f 100644 --- a/arch/riscv/core/smp.c +++ b/arch/riscv/core/smp.c @@ -74,7 +74,11 @@ void arch_secondary_cpu_init(int hartid) #endif #ifdef CONFIG_SMP irq_enable(RISCV_IRQ_MSOFT); -#endif +#ifdef CONFIG_PLIC_IRQ_AFFINITY + /* Enable on secondary cores so that they can respond to PLIC */ + irq_enable(RISCV_IRQ_MEXT); +#endif /* CONFIG_PLIC_IRQ_AFFINITY */ +#endif /* CONFIG_SMP */ riscv_cpu_init[cpu_num].fn(riscv_cpu_init[cpu_num].arg); } diff --git a/drivers/interrupt_controller/Kconfig.plic b/drivers/interrupt_controller/Kconfig.plic index d4f91a3fbd22f..4367ce8f6303f 100644 --- a/drivers/interrupt_controller/Kconfig.plic +++ b/drivers/interrupt_controller/Kconfig.plic @@ -13,6 +13,20 @@ config PLIC if PLIC +config PLIC_IRQ_AFFINITY + bool "Configure IRQ affinity" + depends on SMP + depends on MP_MAX_NUM_CPUS > 1 + help + Enable configuration of IRQ affinity. + +config PLIC_IRQ_AFFINITY_MASK + hex "Default IRQ affinity mask" + depends on PLIC_IRQ_AFFINITY + default 0x1 + help + Default mask for the driver when IRQ affinity is enabled. + config PLIC_SHELL bool "PLIC shell commands" depends on SHELL @@ -20,4 +34,22 @@ config PLIC_SHELL Enable additional shell commands useful for debugging. Caution: This can use quite a bit of RAM (PLICs * IRQs * sizeof(uint16_t)). +if PLIC_SHELL + +config PLIC_SHELL_IRQ_COUNT + bool "IRQ count shell commands" + default y + help + Records the number of hits per interrupt line and provide shell commands to access them. + Caution: This can use quite a bit of RAM (PLICs * IRQs * sizeof(PLIC_IRQ_COUNT_TYPE)). + +config PLIC_SHELL_IRQ_AFFINITY + bool "Shell commands to configure IRQ affinity" + default y + depends on PLIC_IRQ_AFFINITY + help + Provide shell commands to configure IRQ affinity in runtime. + +endif # PLIC_SHELL + endif # PLIC diff --git a/drivers/interrupt_controller/intc_plic.c b/drivers/interrupt_controller/intc_plic.c index 7a235083cb245..7407f493694de 100644 --- a/drivers/interrupt_controller/intc_plic.c +++ b/drivers/interrupt_controller/intc_plic.c @@ -70,6 +70,18 @@ #define INTC_PLIC_STATIC_INLINE static inline #endif /* CONFIG_TEST_INTC_PLIC */ +#ifdef CONFIG_PLIC_IRQ_AFFINITY +#if CONFIG_MP_MAX_NUM_CPUS <= 8 +typedef uint8_t plic_cpumask_t; +#elif CONFIG_MP_MAX_NUM_CPUS <= 16 +typedef uint16_t plic_cpumask_t; +#elif CONFIG_MP_MAX_NUM_CPUS <= 32 +typedef uint32_t plic_cpumask_t; +#else +#error "Currently only supports up to 32 cores" +#endif /* CONFIG_MP_MAX_NUM_CPUS */ +#endif /* CONFIG_PLIC_IRQ_AFFINITY */ + typedef void (*riscv_plic_irq_config_func_t)(void); struct plic_config { mem_addr_t prio; @@ -77,7 +89,11 @@ struct plic_config { mem_addr_t reg; mem_addr_t trig; uint32_t max_prio; - uint32_t num_irqs; + /* Number of IRQs that the PLIC physically supports */ + uint32_t riscv_ndev; + /* Number of IRQs supported in this driver */ + uint32_t nr_irqs; + uint32_t irq; riscv_plic_irq_config_func_t irq_config_func; struct _isr_table_entry *isr_table; const uint32_t *const hart_context; @@ -89,11 +105,19 @@ struct plic_stats { }; struct plic_data { + +#ifdef CONFIG_PLIC_SHELL_IRQ_COUNT struct plic_stats stats; +#endif /* CONFIG_PLIC_SHELL_IRQ_COUNT */ + +#ifdef CONFIG_PLIC_IRQ_AFFINITY + plic_cpumask_t *irq_cpumask; +#endif /* CONFIG_PLIC_IRQ_AFFINITY */ + }; -static uint32_t save_irq; -static const struct device *save_dev; +static uint32_t save_irq[CONFIG_MP_MAX_NUM_CPUS]; +static const struct device *save_dev[CONFIG_MP_MAX_NUM_CPUS]; INTC_PLIC_STATIC_INLINE uint32_t local_irq_to_reg_index(uint32_t local_irq) { @@ -109,7 +133,7 @@ static inline uint32_t get_plic_enabled_size(const struct device *dev) { const struct plic_config *config = dev->config; - return local_irq_to_reg_index(config->num_irqs) + 1; + return local_irq_to_reg_index(config->nr_irqs) + 1; } static ALWAYS_INLINE uint32_t get_hart_context(const struct device *dev, uint32_t hartid) @@ -119,6 +143,20 @@ static ALWAYS_INLINE uint32_t get_hart_context(const struct device *dev, uint32_ return config->hart_context[hartid]; } +static ALWAYS_INLINE uint32_t get_irq_cpumask(const struct device *dev, uint32_t local_irq) +{ +#ifdef CONFIG_PLIC_IRQ_AFFINITY + const struct plic_data *data = dev->data; + + return data->irq_cpumask[local_irq]; +#else + ARG_UNUSED(dev); + ARG_UNUSED(local_irq); + + return 0x1; +#endif /* CONFIG_PLIC_IRQ_AFFINITY */ +} + static inline mem_addr_t get_context_en_addr(const struct device *dev, uint32_t cpu_num) { const struct plic_config *config = dev->config; @@ -131,7 +169,7 @@ static inline mem_addr_t get_context_en_addr(const struct device *dev, uint32_t #else hartid = arch_proc_id(); #endif - return config->irq_en + get_hart_context(dev, hartid) * CONTEXT_ENABLE_SIZE; + return config->irq_en + get_hart_context(dev, hartid) * CONTEXT_ENABLE_SIZE; } static inline mem_addr_t get_claim_complete_addr(const struct device *dev) @@ -142,11 +180,9 @@ static inline mem_addr_t get_claim_complete_addr(const struct device *dev) * We want to return the claim complete addr for the hart's context. */ - return config->reg + get_hart_context(dev, arch_proc_id()) * CONTEXT_SIZE + - CONTEXT_CLAIM; + return config->reg + get_hart_context(dev, arch_proc_id()) * CONTEXT_SIZE + CONTEXT_CLAIM; } - static inline mem_addr_t get_threshold_priority_addr(const struct device *dev, uint32_t cpu_num) { const struct plic_config *config = dev->config; @@ -161,6 +197,13 @@ static inline mem_addr_t get_threshold_priority_addr(const struct device *dev, u return config->reg + (get_hart_context(dev, hartid) * CONTEXT_SIZE); } +static ALWAYS_INLINE uint32_t local_irq_to_irq(const struct device *dev, uint32_t local_irq) +{ + const struct plic_config *config = dev->config; + + return irq_to_level_2(local_irq) | config->irq; +} + /** * @brief Determine the PLIC device from the IRQ * @@ -213,7 +256,8 @@ static void plic_irq_enable_set_state(uint32_t irq, bool enable) uint32_t en_value; en_value = sys_read32(en_addr); - WRITE_BIT(en_value, local_irq & PLIC_REG_MASK, enable); + WRITE_BIT(en_value, local_irq & PLIC_REG_MASK, + enable ? (get_irq_cpumask(dev, local_irq) & BIT(cpu_num)) != 0 : false); sys_write32(en_value, en_addr); } } @@ -267,15 +311,27 @@ void riscv_plic_irq_disable(uint32_t irq) int riscv_plic_irq_is_enabled(uint32_t irq) { const struct device *dev = get_plic_dev_from_irq(irq); - const struct plic_config *config = dev->config; const uint32_t local_irq = irq_from_level_2(irq); - mem_addr_t en_addr = config->irq_en + local_irq_to_reg_offset(local_irq); + uint32_t bit_position = local_irq & PLIC_REG_MASK; uint32_t en_value; + int is_enabled = IS_ENABLED(CONFIG_PLIC_IRQ_AFFINITY) ? 0 : 1; + uint32_t key = irq_lock(); + + for (uint32_t cpu_num = 0; cpu_num < arch_num_cpus(); cpu_num++) { + mem_addr_t en_addr = + get_context_en_addr(dev, cpu_num) + local_irq_to_reg_offset(local_irq); - en_value = sys_read32(en_addr); - en_value &= BIT(local_irq & PLIC_REG_MASK); + en_value = sys_read32(en_addr); + if (IS_ENABLED(CONFIG_PLIC_IRQ_AFFINITY)) { + is_enabled |= !!(en_value & BIT(bit_position)); + } else { + is_enabled &= !!(en_value & BIT(bit_position)); + } + } + + irq_unlock(key); - return !!en_value; + return is_enabled; } /** @@ -314,33 +370,132 @@ void riscv_plic_set_priority(uint32_t irq, uint32_t priority) */ unsigned int riscv_plic_get_irq(void) { - return save_irq; + return save_irq[arch_proc_id()]; } +/** + * @brief Get riscv PLIC causing an interrupt + * + * This routine returns the RISCV PLIC device causing an interrupt. + * + * @return PLIC device causing an interrupt. + */ const struct device *riscv_plic_get_dev(void) { - return save_dev; + return save_dev[arch_proc_id()]; +} + +#ifdef CONFIG_PLIC_IRQ_AFFINITY +/** + * @brief Set riscv PLIC-specific interrupt enable by cpu bitmask + * + * @param irq IRQ number for which to set smp irq affinity + * @param cpumask Bitmask to specific which cores can handle IRQ + */ +int riscv_plic_irq_set_affinity(uint32_t irq, uint32_t cpumask) +{ + const struct device *dev = get_plic_dev_from_irq(irq); + const struct plic_data *data = dev->data; + __maybe_unused const struct plic_config *config = dev->config; + const uint32_t local_irq = irq_from_level_2(irq); + + if (local_irq >= config->nr_irqs) { + __ASSERT(false, "overflow: irq %d, local_irq %d", irq, local_irq); + return -EINVAL; + } + + if ((cpumask & ~BIT_MASK(arch_num_cpus())) != 0) { + __ASSERT(false, "cpumask: 0x%X", cpumask); + return -EINVAL; + } + + uint32_t key = irq_lock(); + + /* Updated irq_cpumask for next time setting plic enable register */ + data->irq_cpumask[local_irq] = (plic_cpumask_t)cpumask; + + /* If irq is enabled, apply the new irq affinity */ + if (riscv_plic_irq_is_enabled(irq)) { + riscv_plic_irq_enable(irq); + } + + irq_unlock(key); + + return 0; +} +#endif /* CONFIG_PLIC_IRQ_AFFINITY */ + +#ifdef CONFIG_PLIC_SHELL_IRQ_COUNT +/** + * If there's more than one core, irq_count points to a 2D-array: irq_count[NUM_CPUs + 1][nr_irqs] + * + * i.e. NUM_CPUs == 2: + * CPU 0 [0 ... nr_irqs - 1] + * CPU 1 [0 ... nr_irqs - 1] + * TOTAL [0 ... nr_irqs - 1] + */ +static ALWAYS_INLINE uint16_t *get_irq_hit_count_cpu(const struct device *dev, int cpu, + uint32_t local_irq) +{ + const struct plic_config *config = dev->config; + const struct plic_data *data = dev->data; + uint32_t offset = local_irq; + + if (CONFIG_MP_MAX_NUM_CPUS > 1) { + offset = cpu * config->nr_irqs + local_irq; + } + + return &data->stats.irq_count[offset]; } +static ALWAYS_INLINE uint16_t *get_irq_hit_count_total(const struct device *dev, uint32_t local_irq) +{ + const struct plic_config *config = dev->config; + const struct plic_data *data = dev->data; + uint32_t offset = local_irq; + + if (CONFIG_MP_MAX_NUM_CPUS > 1) { + offset = arch_num_cpus() * config->nr_irqs + local_irq; + } + + return &data->stats.irq_count[offset]; +} +#endif /* CONFIG_PLIC_SHELL_IRQ_COUNT */ + static void plic_irq_handler(const struct device *dev) { const struct plic_config *config = dev->config; mem_addr_t claim_complete_addr = get_claim_complete_addr(dev); struct _isr_table_entry *ite; uint32_t __maybe_unused trig_val; - + uint32_t cpu_id = arch_proc_id(); /* Get the IRQ number generating the interrupt */ const uint32_t local_irq = sys_read32(claim_complete_addr); -#ifdef CONFIG_PLIC_SHELL - const struct plic_data *data = dev->data; - struct plic_stats stat = data->stats; +#ifdef CONFIG_PLIC_SHELL_IRQ_COUNT + uint16_t *cpu_count = get_irq_hit_count_cpu(dev, cpu_id, local_irq); + uint16_t *total_count = get_irq_hit_count_total(dev, local_irq); /* Cap the count at __UINT16_MAX__ */ - if (stat.irq_count[local_irq] != __UINT16_MAX__) { - stat.irq_count[local_irq]++; + if (*total_count < __UINT16_MAX__) { + (*cpu_count)++; + if (CONFIG_MP_MAX_NUM_CPUS > 1) { + (*total_count)++; + } + } +#endif /* CONFIG_PLIC_SHELL_IRQ_COUNT */ + + /* + * Note: Because PLIC only supports multicast of interrupt, all enabled + * targets will receive interrupt notification. Only the fastest target + * will claim this interrupt, and other targets will claim ID 0 if + * no other pending interrupt now. + * + * (by RISC-V Privileged Architecture v1.10) + */ + if (IS_ENABLED(CONFIG_SMP) && (local_irq == 0U)) { + return; } -#endif /* CONFIG_PLIC_SHELL */ /* * Save IRQ in save_irq. To be used, if need be, by @@ -348,14 +503,14 @@ static void plic_irq_handler(const struct device *dev) * as IRQ number held by the claim_complete register is * cleared upon read. */ - save_irq = local_irq; - save_dev = dev; + save_irq[cpu_id] = local_irq; + save_dev[cpu_id] = dev; /* * If the IRQ is out of range, call z_irq_spurious. * A call to z_irq_spurious will not return. */ - if (local_irq == 0U || local_irq >= config->num_irqs) { + if ((local_irq == 0U) || (local_irq >= config->nr_irqs)) { z_irq_spurious(NULL); } @@ -417,7 +572,7 @@ static int plic_init(const struct device *dev) } /* Set priority of each interrupt line to 0 initially */ - for (uint32_t i = 0; i < config->num_irqs; i++) { + for (uint32_t i = 0; i < config->nr_irqs; i++) { sys_write32(0U, prio_addr + (i * sizeof(uint32_t))); } @@ -442,7 +597,8 @@ static inline int parse_device(const struct shell *sh, size_t argc, char *argv[] return 0; } -static int cmd_get_stats(const struct shell *sh, size_t argc, char *argv[]) +#ifdef CONFIG_PLIC_SHELL_IRQ_COUNT +static int cmd_stats_get(const struct shell *sh, size_t argc, char *argv[]) { const struct device *dev; int ret = parse_device(sh, argc, argv, &dev); @@ -453,35 +609,60 @@ static int cmd_get_stats(const struct shell *sh, size_t argc, char *argv[]) } const struct plic_config *config = dev->config; - const struct plic_data *data = dev->data; - struct plic_stats stat = data->stats; if (argc > 2) { - min_hit = (uint16_t)atoi(argv[2]); + min_hit = (uint16_t)shell_strtoul(argv[2], 10, &ret); + if (ret != 0) { + shell_error(sh, "Failed to parse %s: %d", argv[2], ret); + return ret; + } shell_print(sh, "IRQ line with > %d hits:", min_hit); } - shell_print(sh, " IRQ Hits\tISR(ARG)"); - for (int i = 0; i < stat.irq_count_len; i++) { - if (stat.irq_count[i] > min_hit) { + shell_fprintf(sh, SHELL_NORMAL, " IRQ"); + for (int cpu_id = 0; cpu_id < arch_num_cpus(); cpu_id++) { + shell_fprintf(sh, SHELL_NORMAL, " CPU%2d", cpu_id); + } + if (CONFIG_MP_MAX_NUM_CPUS > 1) { + shell_fprintf(sh, SHELL_NORMAL, " Total"); + } + shell_fprintf(sh, SHELL_NORMAL, "\tISR(ARG)\n"); + + for (int i = 0; i < config->nr_irqs; i++) { + uint16_t *total_count = get_irq_hit_count_total(dev, i); + + if (*total_count <= min_hit) { + /* Skips printing if total_hit is lesser than min_hit */ + continue; + } + + shell_fprintf(sh, SHELL_NORMAL, " %4d", i); /* IRQ number */ + /* Print the IRQ hit counts on each CPU */ + for (int cpu_id = 0; cpu_id < arch_num_cpus(); cpu_id++) { + uint16_t *cpu_count = get_irq_hit_count_cpu(dev, cpu_id, i); + + shell_fprintf(sh, SHELL_NORMAL, " %5d", *cpu_count); + } + if (CONFIG_MP_MAX_NUM_CPUS > 1) { + /* If there's > 1 CPU, print the total hit count at the end */ + shell_fprintf(sh, SHELL_NORMAL, " %5d", *total_count); + } #ifdef CONFIG_SYMTAB - const char *name = - symtab_find_symbol_name((uintptr_t)config->isr_table[i].isr, NULL); + const char *name = + symtab_find_symbol_name((uintptr_t)config->isr_table[i].isr, NULL); - shell_print(sh, " %4d %10d\t%s(%p)", i, stat.irq_count[i], name, - config->isr_table[i].arg); + shell_fprintf(sh, SHELL_NORMAL, "\t%s(%p)\n", name, config->isr_table[i].arg); #else - shell_print(sh, " %4d %10d\t%p(%p)", i, stat.irq_count[i], - (void *)config->isr_table[i].isr, config->isr_table[i].arg); + shell_fprintf(sh, SHELL_NORMAL, "\t%p(%p)\n", (void *)config->isr_table[i].isr, + config->isr_table[i].arg); #endif /* CONFIG_SYMTAB */ - } } shell_print(sh, ""); return 0; } -static int cmd_clear_stats(const struct shell *sh, size_t argc, char *argv[]) +static int cmd_stats_clear(const struct shell *sh, size_t argc, char *argv[]) { const struct device *dev; int ret = parse_device(sh, argc, argv, &dev); @@ -491,19 +672,111 @@ static int cmd_clear_stats(const struct shell *sh, size_t argc, char *argv[]) } const struct plic_data *data = dev->data; + const struct plic_config *config = dev->config; struct plic_stats stat = data->stats; - memset(stat.irq_count, 0, stat.irq_count_len * sizeof(uint16_t)); + memset(stat.irq_count, 0, + config->nr_irqs * + COND_CODE_1(CONFIG_MP_MAX_NUM_CPUS, (1), + (UTIL_INC(CONFIG_MP_MAX_NUM_CPUS))) * + sizeof(uint16_t)); shell_print(sh, "Cleared stats of %s.\n", dev->name); return 0; } +#endif /* CONFIG_PLIC_SHELL_IRQ_COUNT */ + +#ifdef CONFIG_PLIC_SHELL_IRQ_AFFINITY +static int cmd_affinity_set(const struct shell *sh, size_t argc, char **argv) +{ + ARG_UNUSED(argc); + + uint32_t local_irq, irq, mask; + const struct device *dev; + int rc = parse_device(sh, argc, argv, &dev); + const struct plic_config *config = dev->config; + + if (rc != 0) { + return rc; + } + + local_irq = (uint32_t)shell_strtol(argv[2], 10, &rc); + if (rc != 0) { + shell_error(sh, "Failed to parse %s: %d", argv[2], rc); + } + + if (local_irq >= config->nr_irqs) { + shell_error(sh, "local_irq (%d) > nr_irqs (%d)", local_irq, config->nr_irqs); + return -EINVAL; + } + + mask = (uint32_t)shell_strtol(argv[3], 16, &rc); + if (rc != 0) { + shell_error(sh, "Failed to parse %s: %d", argv[3], rc); + } + + if ((mask & ~BIT_MASK(arch_num_cpus())) != 0) { + shell_error(sh, "cpumask: 0x%X num_cpus: %d", mask, arch_num_cpus()); + return -EINVAL; + } + + if (local_irq != 0) { + irq = local_irq_to_irq(dev, local_irq); + riscv_plic_irq_set_affinity(irq, mask); + shell_print(sh, "IRQ %d affinity set to 0x%X", local_irq, mask); + } else { + for (local_irq = 1; local_irq <= config->nr_irqs; local_irq++) { + irq = local_irq_to_irq(dev, local_irq); + riscv_plic_irq_set_affinity(irq, mask); + } + shell_print(sh, "All IRQ affinity set to 0x%X", mask); + } + + return 0; +} + +static int cmd_affinity_get(const struct shell *sh, size_t argc, char **argv) +{ + ARG_UNUSED(argc); + + const struct device *dev; + int rc = parse_device(sh, argc, argv, &dev); + const struct plic_config *config = dev->config; + + if (rc != 0) { + return rc; + } + + shell_print(sh, " IRQ MASK"); + if (argc == 2) { + for (uint32_t local_irq = 0; local_irq < config->nr_irqs; local_irq++) { + shell_print(sh, "%4d 0x%X", local_irq, get_irq_cpumask(dev, local_irq)); + } + } else { + uint32_t local_irq = (uint32_t)shell_strtol(argv[2], 10, &rc); + + if (rc != 0) { + shell_error(sh, "Failed to parse %s: %d", argv[2], rc); + } + + if (local_irq >= config->nr_irqs) { + shell_error(sh, "local_irq (%d) > nr_irqs (%d)", local_irq, + config->nr_irqs); + return -EINVAL; + } + + shell_print(sh, "%4d 0x%X", local_irq, get_irq_cpumask(dev, local_irq)); + } + + return 0; +} +#endif /* CONFIG_PLIC_SHELL_IRQ_AFFINITY */ /* Device name autocompletion support */ static void device_name_get(size_t idx, struct shell_static_entry *entry) { - const struct device *dev = shell_device_lookup(idx, NULL); + const struct device *dev = shell_device_lookup(idx, "interrupt-controller"); entry->syntax = (dev != NULL) ? dev->name : NULL; entry->handler = NULL; @@ -513,51 +786,82 @@ static void device_name_get(size_t idx, struct shell_static_entry *entry) SHELL_DYNAMIC_CMD_CREATE(dsub_device_name, device_name_get); +#ifdef CONFIG_PLIC_SHELL_IRQ_COUNT SHELL_STATIC_SUBCMD_SET_CREATE(plic_stats_cmds, SHELL_CMD_ARG(get, &dsub_device_name, "Read PLIC's stats.\n" "Usage: plic stats get [minimum hits]", - cmd_get_stats, 2, 1), + cmd_stats_get, 2, 1), SHELL_CMD_ARG(clear, &dsub_device_name, "Reset PLIC's stats.\n" "Usage: plic stats clear ", - cmd_clear_stats, 2, 0), + cmd_stats_clear, 2, 0), SHELL_SUBCMD_SET_END ); +#endif /* CONFIG_PLIC_SHELL_IRQ_COUNT */ + +#ifdef CONFIG_PLIC_SHELL_IRQ_AFFINITY +SHELL_STATIC_SUBCMD_SET_CREATE(plic_affinity_cmds, + SHELL_CMD_ARG(set, &dsub_device_name, + "Set IRQ affinity.\n" + "Usage: plic affinity set ", + cmd_affinity_set, 4, 0), + SHELL_CMD_ARG(get, &dsub_device_name, + "Get IRQ affinity.\n" + "Usage: plic affinity get ", + cmd_affinity_get, 2, 1), + SHELL_SUBCMD_SET_END); +#endif /* CONFIG_PLIC_SHELL_IRQ_AFFINITY */ SHELL_STATIC_SUBCMD_SET_CREATE(plic_cmds, - SHELL_CMD_ARG(stats, &plic_stats_cmds, "PLIC stats", NULL, 3, 0), +#ifdef CONFIG_PLIC_SHELL_IRQ_COUNT + SHELL_CMD(stats, &plic_stats_cmds, "IRQ stats", NULL), +#endif /* CONFIG_PLIC_SHELL_IRQ_COUNT */ +#ifdef CONFIG_PLIC_SHELL_IRQ_AFFINITY + SHELL_CMD(affinity, &plic_affinity_cmds, "IRQ affinity", NULL), +#endif /* CONFIG_PLIC_SHELL_IRQ_AFFINITY */ SHELL_SUBCMD_SET_END ); -static int cmd_plic(const struct shell *sh, size_t argc, char **argv) -{ - shell_error(sh, "%s:unknown parameter: %s", argv[0], argv[1]); - return -EINVAL; -} - -SHELL_CMD_ARG_REGISTER(plic, &plic_cmds, "PLIC shell commands", - cmd_plic, 2, 0); +SHELL_CMD_REGISTER(plic, &plic_cmds, "PLIC shell commands", NULL); +#endif /* CONFIG_PLIC_SHELL */ #define PLIC_MIN_IRQ_NUM(n) MIN(DT_INST_PROP(n, riscv_ndev), CONFIG_MAX_IRQ_PER_AGGREGATOR) + +#ifdef CONFIG_PLIC_SHELL_IRQ_COUNT #define PLIC_INTC_IRQ_COUNT_BUF_DEFINE(n) \ - static uint16_t local_irq_count_##n[PLIC_MIN_IRQ_NUM(n)]; + static uint16_t local_irq_count_##n[COND_CODE_1(CONFIG_MP_MAX_NUM_CPUS, (1), \ + (UTIL_INC(CONFIG_MP_MAX_NUM_CPUS)))] \ + [PLIC_MIN_IRQ_NUM(n)]; +#define PLIC_INTC_IRQ_COUNT_INIT(n) \ + .stats = { \ + .irq_count = &local_irq_count_##n[0][0], \ + }, + +#else +#define PLIC_INTC_IRQ_COUNT_BUF_DEFINE(n) +#define PLIC_INTC_IRQ_COUNT_INIT(n) +#endif /* CONFIG_PLIC_SHELL_IRQ_COUNT */ + +#ifdef CONFIG_PLIC_IRQ_AFFINITY +#define PLIC_IRQ_CPUMASK_BUF_DECLARE(n) \ + static plic_cpumask_t irq_cpumask_##n[PLIC_MIN_IRQ_NUM(n)] = { \ + [0 ...(PLIC_MIN_IRQ_NUM(n) - 1)] = CONFIG_PLIC_IRQ_AFFINITY_MASK, \ + } +#define PLIC_IRQ_CPUMASK_BUF_INIT(n) .irq_cpumask = &irq_cpumask_##n[0], +#else +#define PLIC_IRQ_CPUMASK_BUF_DECLARE(n) +#define PLIC_IRQ_CPUMASK_BUF_INIT(n) +#endif /* CONFIG_PLIC_IRQ_AFFINITY */ #define PLIC_INTC_DATA_INIT(n) \ PLIC_INTC_IRQ_COUNT_BUF_DEFINE(n); \ + PLIC_IRQ_CPUMASK_BUF_DECLARE(n); \ static struct plic_data plic_data_##n = { \ - .stats = { \ - .irq_count = local_irq_count_##n, \ - .irq_count_len = PLIC_MIN_IRQ_NUM(n), \ - }, \ + PLIC_INTC_IRQ_COUNT_INIT(n) \ + PLIC_IRQ_CPUMASK_BUF_INIT(n) \ }; -#define PLIC_INTC_DATA(n) &plic_data_##n -#else -#define PLIC_INTC_DATA_INIT(...) -#define PLIC_INTC_DATA(n) (NULL) -#endif - #define PLIC_INTC_IRQ_FUNC_DECLARE(n) static void plic_irq_config_func_##n(void) #define PLIC_INTC_IRQ_FUNC_DEFINE(n) \ @@ -582,7 +886,9 @@ SHELL_CMD_ARG_REGISTER(plic, &plic_cmds, "PLIC shell commands", IF_ENABLED(PLIC_SUPPORTS_TRIG_TYPE, \ (.trig = PLIC_BASE_ADDR(n) + PLIC_REG_TRIG_TYPE_OFFSET,)) \ .max_prio = DT_INST_PROP(n, riscv_max_priority), \ - .num_irqs = DT_INST_PROP(n, riscv_ndev), \ + .riscv_ndev = DT_INST_PROP(n, riscv_ndev), \ + .nr_irqs = PLIC_MIN_IRQ_NUM(n), \ + .irq = DT_INST_IRQN(n), \ .irq_config_func = plic_irq_config_func_##n, \ .isr_table = &_sw_isr_table[INTC_INST_ISR_TBL_OFFSET(n)], \ .hart_context = plic_hart_contexts_##n, \ @@ -597,7 +903,7 @@ SHELL_CMD_ARG_REGISTER(plic, &plic_cmds, "PLIC shell commands", PLIC_INTC_CONFIG_INIT(n) \ PLIC_INTC_DATA_INIT(n) \ DEVICE_DT_INST_DEFINE(n, &plic_init, NULL, \ - PLIC_INTC_DATA(n), &plic_config_##n, \ + &plic_data_##n, &plic_config_##n, \ PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, \ NULL); diff --git a/include/zephyr/drivers/interrupt_controller/riscv_plic.h b/include/zephyr/drivers/interrupt_controller/riscv_plic.h index 22c57a4b69673..3a390017f1059 100644 --- a/include/zephyr/drivers/interrupt_controller/riscv_plic.h +++ b/include/zephyr/drivers/interrupt_controller/riscv_plic.h @@ -44,6 +44,16 @@ int riscv_plic_irq_is_enabled(uint32_t irq); */ void riscv_plic_set_priority(uint32_t irq, uint32_t prio); +/** + * @brief Set IRQ affinity. + * + * @param irq IRQ line. + * @param cpumask CPU bit mask. + * + * @return 0 if success, negative errno value otherwise + */ +int riscv_plic_irq_set_affinity(uint32_t irq, uint32_t cpumask); + /** * @brief Get active interrupt ID * diff --git a/tests/drivers/build_all/interrupt_controller/intc_plic/testcase.yaml b/tests/drivers/build_all/interrupt_controller/intc_plic/testcase.yaml index 2cf1d82767fc4..1e750d6088928 100644 --- a/tests/drivers/build_all/interrupt_controller/intc_plic/testcase.yaml +++ b/tests/drivers/build_all/interrupt_controller/intc_plic/testcase.yaml @@ -3,7 +3,9 @@ common: filter: CONFIG_PLIC platform_allow: - qemu_riscv32 + - qemu_riscv32/qemu_virt_riscv32/smp - qemu_riscv64 + - qemu_riscv64/qemu_virt_riscv64/smp tags: - drivers - interrupt @@ -27,3 +29,11 @@ tests: - CONFIG_NUM_2ND_LEVEL_AGGREGATORS=2 - CONFIG_2ND_LVL_INTR_01_OFFSET=8 - CONFIG_UART_INTERRUPT_DRIVEN=y + drivers.interrupt_controller.intc_plic.irq_affinity.build: + filter: CONFIG_SMP + tags: + - smp + extra_configs: + - CONFIG_MP_MAX_NUM_CPUS=4 + - CONFIG_PLIC_IRQ_AFFINITY=y + - CONFIG_PLIC_IRQ_AFFINITY_MASK=0xf From c2126cb9068616c44290bce8e757dedc6eb885ce Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Wed, 18 Sep 2024 19:35:30 +0300 Subject: [PATCH 0203/4482] soc: intel_adsp: tools: cavstool.py: argsparse code to separate function Do not force argsparse code to all modules importing cavstool.py. The commit moves argparse code into a separate function, and calls it from 'if __name__ == "__main__":'. Also adds the argsparse call to to acetool.py that shares cavstool code with the argument parsing. Signed-off-by: Jyri Sarha --- soc/intel/intel_adsp/tools/acetool.py | 1 + soc/intel/intel_adsp/tools/cavstool.py | 42 ++++++++++++++------------ 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/soc/intel/intel_adsp/tools/acetool.py b/soc/intel/intel_adsp/tools/acetool.py index 5424e2a68ae81..a1202f47577b2 100755 --- a/soc/intel/intel_adsp/tools/acetool.py +++ b/soc/intel/intel_adsp/tools/acetool.py @@ -6,6 +6,7 @@ import cavstool if __name__ == "__main__": + cavstool.args_parse() try: asyncio.run(cavstool.main()) except KeyboardInterrupt: diff --git a/soc/intel/intel_adsp/tools/cavstool.py b/soc/intel/intel_adsp/tools/cavstool.py index e250730910f1d..6b0dda0756138 100755 --- a/soc/intel/intel_adsp/tools/cavstool.py +++ b/soc/intel/intel_adsp/tools/cavstool.py @@ -962,28 +962,30 @@ async def main(): if not args.log_only: handle_ipc() - -ap = argparse.ArgumentParser(description="DSP loader/logger tool", allow_abbrev=False) -ap.add_argument("-q", "--quiet", action="store_true", - help="No loader output, just DSP logging") -ap.add_argument("-v", "--verbose", action="store_true", - help="More loader output, DEBUG logging level") -ap.add_argument("-l", "--log-only", action="store_true", - help="Don't load firmware, just show log output") -ap.add_argument("-p", "--shell-pty", action="store_true", - help="Create a Zephyr shell pty if enabled in firmware") -ap.add_argument("-n", "--no-history", action="store_true", - help="No current log buffer at start, just new output") -ap.add_argument("fw_file", nargs="?", help="Firmware file") - -args = ap.parse_args() - -if args.quiet: - log.setLevel(logging.WARN) -elif args.verbose: - log.setLevel(logging.DEBUG) +def args_parse(): + global args + ap = argparse.ArgumentParser(description="DSP loader/logger tool", allow_abbrev=False) + ap.add_argument("-q", "--quiet", action="store_true", + help="No loader output, just DSP logging") + ap.add_argument("-v", "--verbose", action="store_true", + help="More loader output, DEBUG logging level") + ap.add_argument("-l", "--log-only", action="store_true", + help="Don't load firmware, just show log output") + ap.add_argument("-p", "--shell-pty", action="store_true", + help="Create a Zephyr shell pty if enabled in firmware") + ap.add_argument("-n", "--no-history", action="store_true", + help="No current log buffer at start, just new output") + ap.add_argument("fw_file", nargs="?", help="Firmware file") + + args = ap.parse_args() + + if args.quiet: + log.setLevel(logging.WARN) + elif args.verbose: + log.setLevel(logging.DEBUG) if __name__ == "__main__": + args_parse() try: asyncio.run(main()) except KeyboardInterrupt: From 91495812bdb5f173011d8524a7143e8f2a18ce91 Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Thu, 19 Sep 2024 19:22:19 +0300 Subject: [PATCH 0204/4482] soc: intel_adsp: tools: cavstool.py: Make map_regs() shareable map_reg() depends on args global variable for knowing it should load a new firmware or just stand by for logging or Zephyr shell. The map_regs() code is the very first step to access the DSP memory, it nees to be shareable if the code is to be accessed from another python module. Signed-off-by: Jyri Sarha --- soc/intel/intel_adsp/tools/cavstool.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/soc/intel/intel_adsp/tools/cavstool.py b/soc/intel/intel_adsp/tools/cavstool.py index 6b0dda0756138..2b008b98b7c3f 100755 --- a/soc/intel/intel_adsp/tools/cavstool.py +++ b/soc/intel/intel_adsp/tools/cavstool.py @@ -210,7 +210,7 @@ def adsp_mem_window_config(): return (base, stride) -def map_regs(): +def map_regs(log_only): p = runx(f"grep -iEl 'PCI_CLASS=40(10|38)0' /sys/bus/pci/devices/*/uevent") pcidir = os.path.dirname(p) @@ -226,7 +226,7 @@ def map_regs(): if os.path.exists(f"{pcidir}/driver"): mod = os.path.basename(os.readlink(f"{pcidir}/driver/module")) found_msg = f"Existing driver \"{mod}\" found" - if args.log_only: + if log_only: log.info(found_msg) else: log.warning(found_msg + ", unloading module") @@ -920,7 +920,7 @@ async def main(): global hda, sd, dsp, hda_ostream_id, hda_streams try: - (hda, sd, dsp, hda_ostream_id) = map_regs() + (hda, sd, dsp, hda_ostream_id) = map_regs(args.log_only) except Exception as e: log.error("Could not map device in sysfs; run as root?") log.error(e) From 9563960bde3770f730a07437c695705d643764cf Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Thu, 19 Sep 2024 12:11:28 +0300 Subject: [PATCH 0205/4482] soc: intel_adsp: tools: cavstool: Fix fw_is_alive() and wait_fw_entered() The fw_is_alive() depends on 'dsp' global variable which is assigned from map_regs() return value. To make fw_is_alive() and wait_fw_entered(), that calls fw_is_alive(), callable from another module, the 'dsp' variable needs to be passed as an argument. Signed-off-by: Jyri Sarha --- soc/intel/intel_adsp/tools/cavstool.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/soc/intel/intel_adsp/tools/cavstool.py b/soc/intel/intel_adsp/tools/cavstool.py index 2b008b98b7c3f..9718ef894b990 100755 --- a/soc/intel/intel_adsp/tools/cavstool.py +++ b/soc/intel/intel_adsp/tools/cavstool.py @@ -482,7 +482,7 @@ def load_firmware(fw_file): log.info(f"Starting DMA, FW_STATUS = 0x{dsp.SRAM_FW_STATUS:x}") sd.CTL |= 2 # START flag - wait_fw_entered() + wait_fw_entered(dsp, timeout_s=None) # Turn DMA off and reset the stream. Clearing START first is a # noop per the spec, but absolutely required for stability. @@ -604,7 +604,7 @@ def load_firmware_ace(fw_file): log.info(f"Starting DMA, FW_STATUS = 0x{dsp.ROM_STATUS:x}") sd.CTL |= 2 # START flag - wait_fw_entered() + wait_fw_entered(dsp, timeout_s=None) # Turn DMA off and reset the stream. Clearing START first is a # noop per the spec, but absolutely required for stability. @@ -618,17 +618,17 @@ def load_firmware_ace(fw_file): sd.CTL |= 1 log.info(f"ACE firmware load complete") -def fw_is_alive(): +def fw_is_alive(dsp): return dsp.ROM_STATUS & ((1 << 28) - 1) == 5 # "FW_ENTERED" -def wait_fw_entered(timeout_s=2): +def wait_fw_entered(dsp, timeout_s): log.info("Waiting %s for firmware handoff, ROM_STATUS = 0x%x", "forever" if timeout_s is None else f"{timeout_s} seconds", dsp.ROM_STATUS) hertz = 100 attempts = None if timeout_s is None else timeout_s * hertz while True: - alive = fw_is_alive() + alive = fw_is_alive(dsp) if alive: break if attempts is not None: @@ -875,10 +875,10 @@ def ipc_command(data, ext_data): sys.stdout.flush() else: log.warning(f"cavstool: Unrecognized IPC command 0x{data:x} ext 0x{ext_data:x}") - if not fw_is_alive(): + if not fw_is_alive(dsp): if args.log_only: log.info("DSP power seems off") - wait_fw_entered(timeout_s=None) + wait_fw_entered(dsp, timeout_s=None) else: log.warning("DSP power seems off?!") time.sleep(2) # potential spam reduction @@ -929,7 +929,7 @@ async def main(): log.info(f"Detected cAVS 1.8+ hardware") if args.log_only: - wait_fw_entered(timeout_s=None) + wait_fw_entered(dsp, timeout_s=None) else: if not args.fw_file: log.error("Firmware file argument missing") From 80e629cd974aa8e5db10665a21864c6f236133c4 Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Thu, 19 Sep 2024 20:28:01 +0300 Subject: [PATCH 0206/4482] soc: intel_adsp: tools: cavstool.py: Add debug_slot_offset() Add debug_slot_offset() function for getting a debug slot offset by the slot number. Signed-off-by: Jyri Sarha --- soc/intel/intel_adsp/tools/cavstool.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/soc/intel/intel_adsp/tools/cavstool.py b/soc/intel/intel_adsp/tools/cavstool.py index 9718ef894b990..874bd1de6faa5 100755 --- a/soc/intel/intel_adsp/tools/cavstool.py +++ b/soc/intel/intel_adsp/tools/cavstool.py @@ -745,6 +745,9 @@ def debug_offset(): ( base, stride ) = adsp_mem_window_config() return base + stride * 2 +def debug_slot_offset(num): + return debug_offset() + DEBUG_SLOT_SIZE * (1 + num) + def shell_base_offset(): return debug_offset() + DEBUG_SLOT_SIZE * (1 + DEBUG_SLOT_SHELL) From 5688a95d075b8c399f085a0a56025961a71328b3 Mon Sep 17 00:00:00 2001 From: Florian Grandel Date: Tue, 10 Sep 2024 11:44:14 +0200 Subject: [PATCH 0207/4482] cmake: modules: dts: fix in/out docs The input/output documentation of dts.cmake and pre_dt.cmake was outdated. Signed-off-by: Florian Grandel --- cmake/modules/dts.cmake | 8 ++++++++ cmake/modules/pre_dt.cmake | 2 -- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cmake/modules/dts.cmake b/cmake/modules/dts.cmake index 19b168c74858e..c22761b9c7178 100644 --- a/cmake/modules/dts.cmake +++ b/cmake/modules/dts.cmake @@ -66,6 +66,12 @@ find_package(Dtc 1.4.6) # # Required variables: # - BINARY_DIR_INCLUDE_GENERATED: where to put generated include files +# - DTS_ROOT: a deduplicated list of places where devicetree +# implementation files (like bindings, vendor prefixes, etc.) are +# found +# - DTS_ROOT_SYSTEM_INCLUDE_DIRS: set to "PATH1 PATH2 ...", +# with one path per potential location where C preprocessor #includes +# may be found for devicetree files # - KCONFIG_BINARY_DIR: where to put generated Kconfig files # # Optional variables: @@ -73,6 +79,8 @@ find_package(Dtc 1.4.6) # - BOARD_DIR: board directory to use when looking for DTS_SOURCE # - BOARD_REVISION_STRING: used when looking for a board revision's # devicetree overlay file in BOARD_DIR +# - CMAKE_DTS_PREPROCESSOR: the path to the preprocessor to use +# for devicetree files # - DTC_OVERLAY_FILE: list of devicetree overlay files which will be # used to modify or extend the base devicetree. # - EXTRA_DTC_OVERLAY_FILE: list of extra devicetree overlay files. diff --git a/cmake/modules/pre_dt.cmake b/cmake/modules/pre_dt.cmake index 4e062b2b97069..982cdc6e4a7fc 100644 --- a/cmake/modules/pre_dt.cmake +++ b/cmake/modules/pre_dt.cmake @@ -11,8 +11,6 @@ include(extensions) # Outcome: # The following variables will be defined when this CMake module completes: # -# - CMAKE_DTS_PREPROCESSOR: the path to the preprocessor to use -# for devicetree files # - DTS_ROOT: a deduplicated list of places where devicetree # implementation files (like bindings, vendor prefixes, etc.) are # found From c0bb9735d7e4b28029ba461fa40f9ddf07d98f61 Mon Sep 17 00:00:00 2001 From: Dave Rensberger Date: Mon, 30 Sep 2024 17:25:17 -0400 Subject: [PATCH 0208/4482] net: shell: Make stack size for event_mon_stack configurable The stack size for the event_mon_stack task may need to be larger than the default 1024 to avoid crashes. It should be configurable through Kconfig so that source code doesn't need to be modified to increase it. Signed-off-by: Dave Rensberger --- subsys/net/ip/Kconfig.mgmt | 7 +++++++ subsys/net/lib/shell/events.c | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/subsys/net/ip/Kconfig.mgmt b/subsys/net/ip/Kconfig.mgmt index 04fe2adf14e89..c84dd8f239832 100644 --- a/subsys/net/ip/Kconfig.mgmt +++ b/subsys/net/ip/Kconfig.mgmt @@ -105,6 +105,13 @@ config NET_MGMT_EVENT_MONITOR NET_MGMT_EVENT_QUEUE_SIZE from the default in order not to miss any events. +config NET_MGMT_EVENT_MONITOR_STACK_SIZE + int "Size of the stack allocated for the event_mon_stack thread" + depends on NET_MGMT_EVENT_MONITOR + default 1024 + help + Sets the size of the stack for event_mon_stack_thread. + config NET_MGMT_EVENT_MONITOR_AUTO_START bool "Start the event monitor automatically at boot" depends on NET_MGMT_EVENT_MONITOR && SHELL_BACKEND_SERIAL diff --git a/subsys/net/lib/shell/events.c b/subsys/net/lib/shell/events.c index 72044b5afa6fd..687e136e7cb33 100644 --- a/subsys/net/lib/shell/events.c +++ b/subsys/net/lib/shell/events.c @@ -17,7 +17,6 @@ LOG_MODULE_DECLARE(net_shell); #include "net_shell_private.h" #if defined(CONFIG_NET_MGMT_EVENT_MONITOR) -#define EVENT_MON_STACK_SIZE 1024 #define THREAD_PRIORITY K_PRIO_COOP(2) #define MAX_EVENT_INFO_SIZE NET_EVENT_INFO_MAX_SIZE #define MONITOR_L2_MASK (_NET_EVENT_IF_BASE) @@ -32,7 +31,7 @@ static struct net_mgmt_event_callback l3_ipv4_cb; static struct net_mgmt_event_callback l3_ipv6_cb; static struct net_mgmt_event_callback l4_cb; static struct k_thread event_mon; -static K_THREAD_STACK_DEFINE(event_mon_stack, EVENT_MON_STACK_SIZE); +static K_THREAD_STACK_DEFINE(event_mon_stack, CONFIG_NET_MGMT_EVENT_MONITOR_STACK_SIZE); struct event_msg { struct net_if *iface; From a4599219b7f357f21317bb4c05539c95e2251abb Mon Sep 17 00:00:00 2001 From: Georges Oates_Larsen Date: Mon, 30 Sep 2024 15:40:22 -0700 Subject: [PATCH 0209/4482] logging: dictionary: Support unsigned integers Add unsigned integer support to the log parser. This does not change the underlying log format, it only allows the log parser to more accurately read the log format. Signed-off-by: Georges Oates_Larsen --- .../logging/dictionary/dictionary_parser/data_types.py | 5 +++++ .../dictionary/dictionary_parser/log_parser_v1.py | 10 ++++++---- .../dictionary/dictionary_parser/log_parser_v3.py | 10 ++++++---- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/scripts/logging/dictionary/dictionary_parser/data_types.py b/scripts/logging/dictionary/dictionary_parser/data_types.py index 0ff4de7c34fce..844454c326298 100644 --- a/scripts/logging/dictionary/dictionary_parser/data_types.py +++ b/scripts/logging/dictionary/dictionary_parser/data_types.py @@ -30,14 +30,19 @@ def __init__(self, database): if database.is_tgt_64bit(): self.add_data_type(self.LONG, "q") + self.add_data_type(self.ULONG, "Q") self.add_data_type(self.LONG_LONG, "q") + self.add_data_type(self.ULONG_LONG, "Q") self.add_data_type(self.PTR, "Q") else: self.add_data_type(self.LONG, "i") + self.add_data_type(self.ULONG, "I") self.add_data_type(self.LONG_LONG, "q") + self.add_data_type(self.ULONG_LONG, "Q") self.add_data_type(self.PTR, "I") self.add_data_type(self.INT, "i") + self.add_data_type(self.UINT, "I") self.add_data_type(self.DOUBLE, "d") self.add_data_type(self.LONG_DOUBLE, "d") diff --git a/scripts/logging/dictionary/dictionary_parser/log_parser_v1.py b/scripts/logging/dictionary/dictionary_parser/log_parser_v1.py index 124974e93109c..92eb7cc9c8958 100644 --- a/scripts/logging/dictionary/dictionary_parser/log_parser_v1.py +++ b/scripts/logging/dictionary/dictionary_parser/log_parser_v1.py @@ -141,14 +141,16 @@ def process_one_fmt_str(self, fmt_str, arg_list, string_tbl): # intmax_t, size_t or ptrdiff_t arg_data_type = DataTypes.LONG - elif fmt in ('c', 'd', 'i', 'o', 'u') or str.lower(fmt) == 'x': + elif fmt in ('c', 'd', 'i', 'o', 'u', 'x', 'X'): + unsigned = fmt in ('c', 'o', 'u', 'x', 'X') + if fmt_str[idx - 1] == 'l': if fmt_str[idx - 2] == 'l': - arg_data_type = DataTypes.LONG_LONG + arg_data_type = DataTypes.ULONG_LONG if unsigned else DataTypes.LONG_LONG else: - arg_data_type = DataTypes.LONG + arg_data_type = DataTypes.ULONG if unsigned else DataTypes.LONG else: - arg_data_type = DataTypes.INT + arg_data_type = DataTypes.UINT if unsigned else DataTypes.INT is_parsing = False do_extract = True diff --git a/scripts/logging/dictionary/dictionary_parser/log_parser_v3.py b/scripts/logging/dictionary/dictionary_parser/log_parser_v3.py index d6b3904e19662..f72dde1f6046e 100644 --- a/scripts/logging/dictionary/dictionary_parser/log_parser_v3.py +++ b/scripts/logging/dictionary/dictionary_parser/log_parser_v3.py @@ -146,14 +146,16 @@ def process_one_fmt_str(self, fmt_str, arg_list, string_tbl): # intmax_t, size_t or ptrdiff_t arg_data_type = DataTypes.LONG - elif fmt in ('c', 'd', 'i', 'o', 'u') or str.lower(fmt) == 'x': + elif fmt in ('c', 'd', 'i', 'o', 'u', 'x', 'X'): + unsigned = fmt in ('c', 'o', 'u', 'x', 'X') + if fmt_str[idx - 1] == 'l': if fmt_str[idx - 2] == 'l': - arg_data_type = DataTypes.LONG_LONG + arg_data_type = DataTypes.ULONG_LONG if unsigned else DataTypes.LONG_LONG else: - arg_data_type = DataTypes.LONG + arg_data_type = DataTypes.ULONG if unsigned else DataTypes.LONG else: - arg_data_type = DataTypes.INT + arg_data_type = DataTypes.UINT if unsigned else DataTypes.INT is_parsing = False do_extract = True From 9acfd9d4ca1c7a904f995e5d36546014f11a38b0 Mon Sep 17 00:00:00 2001 From: Dominik Kilian Date: Mon, 30 Sep 2024 16:12:43 +0200 Subject: [PATCH 0210/4482] maintainers: Add doki-nordic as maintainer of IPC Become the maintainer for the IPC code. Additionally carlocaione becomes collaborator now. Signed-off-by: Dominik Kilian --- MAINTAINERS.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index c29e77f7b291f..2434fb5c2f21d 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -2357,8 +2357,10 @@ Input: IPC: status: maintained maintainers: - - carlocaione + - doki-nordic - arnopo + collaborators: + - carlocaione files: - include/zephyr/ipc/ - samples/subsys/ipc/ From cd76ab3428692e464cb36eece3bb279f47eb9766 Mon Sep 17 00:00:00 2001 From: Adrien Ricciardi Date: Tue, 1 Oct 2024 10:46:40 +0200 Subject: [PATCH 0211/4482] fs: nvs: Simplified the initial loop in calc_free_space() Replaced the initial loop that computes the initial free space by a simple formula. Signed-off-by: Adrien Ricciardi --- subsys/fs/nvs/nvs.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/subsys/fs/nvs/nvs.c b/subsys/fs/nvs/nvs.c index 9e6578a557631..7922967f9963c 100644 --- a/subsys/fs/nvs/nvs.c +++ b/subsys/fs/nvs/nvs.c @@ -1309,14 +1309,13 @@ ssize_t nvs_calc_free_space(struct nvs_fs *fs) ate_size = nvs_al_size(fs, sizeof(struct nvs_ate)); - free_space = 0; - for (uint16_t i = 1; i < fs->sector_count; i++) { - /* - * There is always a closing ATE and a reserved ATE for - * deletion in each sector - */ - free_space += (fs->sector_size - (2 * ate_size)); - } + /* + * There is always a closing ATE and a reserved ATE for + * deletion in each sector. + * Take into account one less sector because it is reserved for the + * garbage collection. + */ + free_space = (fs->sector_count - 1) * (fs->sector_size - (2 * ate_size)); step_addr = fs->ate_wra; From 8638e411e766bf674718aba51dc0c7eda61cf7c8 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Wed, 2 Oct 2024 11:26:55 -0700 Subject: [PATCH 0212/4482] xtensa: fix insecure userspace warning wording "in behave of" -> "on behalf of", which is more accurate of what is actually happening in the code. Signed-off-by: Daniel Leung --- arch/xtensa/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/xtensa/CMakeLists.txt b/arch/xtensa/CMakeLists.txt index 21de223d4ec20..48ac9d7531b12 100644 --- a/arch/xtensa/CMakeLists.txt +++ b/arch/xtensa/CMakeLists.txt @@ -7,5 +7,5 @@ add_subdirectory(core) if (CONFIG_XTENSA_INSECURE_USERSPACE) message(WARNING " This userspace implementation uses the window ABI this means that the kernel - will spill registers in behave of the userpsace. Use it carefully.") + will spill registers on behalf of the userpsace. Use it carefully.") endif() From c74dd3ee74296d74848f31703228fbe72f6cd046 Mon Sep 17 00:00:00 2001 From: Andrew Sonzogni Date: Mon, 23 Sep 2024 11:45:45 +0200 Subject: [PATCH 0213/4482] drivers: sensor: lis2dw12: add temp reading adds support for reading temperature Signed-off-by: Andrew Sonzogni --- drivers/sensor/st/lis2dw12/lis2dw12.c | 60 +++++++++++++++++++++++++-- drivers/sensor/st/lis2dw12/lis2dw12.h | 8 ++++ 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/drivers/sensor/st/lis2dw12/lis2dw12.c b/drivers/sensor/st/lis2dw12/lis2dw12.c index ff29c83133b4e..005238ca87d77 100644 --- a/drivers/sensor/st/lis2dw12/lis2dw12.c +++ b/drivers/sensor/st/lis2dw12/lis2dw12.c @@ -92,6 +92,20 @@ static inline void lis2dw12_convert(struct sensor_value *val, int raw_val, val->val2 = dval % 1000000LL; } +static inline void lis2dw12_channel_get_temp(const struct device *dev, struct sensor_value *val) +{ + struct lis2dw12_data *lis2dw12 = dev->data; + int64_t dval_uc; + + /* The calcul is in micro Celcius to keep it efficient */ + dval_uc = ((lis2dw12->temp >> LIS2DW12_SHIFT_TEMP) * LIS2DW12_TEMP_SCALE_FACTOR); + dval_uc += 25000000; + + /* switch to Celcius when we split the integer and fractional parts of the value */ + val->val1 = dval_uc / 1000000LL; + val->val2 = dval_uc % 1000000LL; +} + static inline void lis2dw12_channel_get_acc(const struct device *dev, enum sensor_channel chan, struct sensor_value *val) @@ -132,6 +146,9 @@ static int lis2dw12_channel_get(const struct device *dev, case SENSOR_CHAN_ACCEL_XYZ: lis2dw12_channel_get_acc(dev, chan, val); return 0; + case SENSOR_CHAN_DIE_TEMP: + lis2dw12_channel_get_temp(dev, val); + return 0; default: LOG_DBG("Channel not supported"); break; @@ -309,8 +326,7 @@ static int lis2dw12_attr_set(const struct device *dev, return -ENOTSUP; } -static int lis2dw12_sample_fetch(const struct device *dev, - enum sensor_channel chan) +static int lis2dw12_sample_fetch_accel(const struct device *dev) { struct lis2dw12_data *lis2dw12 = dev->data; const struct lis2dw12_device_config *cfg = dev->config; @@ -318,9 +334,9 @@ static int lis2dw12_sample_fetch(const struct device *dev, uint8_t shift; int16_t buf[3]; - /* fetch raw data sample */ + /* fetch acceleration raw data sample */ if (lis2dw12_acceleration_raw_get(ctx, buf) < 0) { - LOG_DBG("Failed to fetch raw data sample"); + LOG_DBG("Failed to fetch acceleration raw data sample"); return -EIO; } @@ -338,6 +354,42 @@ static int lis2dw12_sample_fetch(const struct device *dev, return 0; } +static int lis2dw12_sample_fetch_temp(const struct device *dev) +{ + const struct lis2dw12_device_config *cfg = dev->config; + stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx; + struct lis2dw12_data *data = dev->data; + + /* fetch temperature raw data sample */ + if (lis2dw12_temperature_raw_get(ctx, &data->temp) < 0) { + LOG_DBG("Failed to fetch temperature raw data sample"); + return -EIO; + } + + return 0; +} + +static int lis2dw12_sample_fetch(const struct device *dev, + enum sensor_channel chan) +{ + switch (chan) { + case SENSOR_CHAN_ACCEL_X: + case SENSOR_CHAN_ACCEL_Y: + case SENSOR_CHAN_ACCEL_Z: + case SENSOR_CHAN_ACCEL_XYZ: + lis2dw12_sample_fetch_accel(dev); + break; + case SENSOR_CHAN_DIE_TEMP: + lis2dw12_sample_fetch_temp(dev); + break; + default: + LOG_DBG("Channel not supported"); + return -ENOTSUP; + } + + return 0; +} + static const struct sensor_driver_api lis2dw12_driver_api = { .attr_set = lis2dw12_attr_set, #if CONFIG_LIS2DW12_TRIGGER diff --git a/drivers/sensor/st/lis2dw12/lis2dw12.h b/drivers/sensor/st/lis2dw12/lis2dw12.h index d52312193c03a..266f13bf7899b 100644 --- a/drivers/sensor/st/lis2dw12/lis2dw12.h +++ b/drivers/sensor/st/lis2dw12/lis2dw12.h @@ -58,6 +58,11 @@ #define LIS2DW12_SHIFT_PM1 4 #define LIS2DW12_SHIFT_PMOTHER 2 +/* shift value for 12 bit resolution */ +#define LIS2DW12_SHIFT_TEMP 4 +/* Temperature 12 bit scale factor in uC = 1000000/16 as 1 LSB = C/16 */ +#define LIS2DW12_TEMP_SCALE_FACTOR 62500 + /** * struct lis2dw12_device_config - lis2dw12 hw configuration * @bus_name: Pointer to bus master identifier. @@ -104,6 +109,9 @@ struct lis2dw12_device_config { /* sensor data */ struct lis2dw12_data { + /* temperature raw data */ + int16_t temp; + /* accelerometer raw data */ int16_t acc[3]; /* save sensitivity */ From 70de35d9c99e6d5dd7249bb49aecc6a5eb8ed209 Mon Sep 17 00:00:00 2001 From: Andrew Sonzogni Date: Mon, 23 Sep 2024 15:25:49 +0200 Subject: [PATCH 0214/4482] drivers: sensor: lis2dw12: add inactivity detection Add inactivity mode or stationary detection Signed-off-by: Andrew Sonzogni --- drivers/sensor/st/lis2dw12/Kconfig | 11 +++- drivers/sensor/st/lis2dw12/lis2dw12.c | 66 +++++++++++++++---- drivers/sensor/st/lis2dw12/lis2dw12.h | 19 ++++-- drivers/sensor/st/lis2dw12/lis2dw12_trigger.c | 65 ++++++++++++++---- dts/bindings/sensor/st,lis2dw12-common.yaml | 18 +++++ include/zephyr/dt-bindings/sensor/lis2dw12.h | 18 +++++ 6 files changed, 163 insertions(+), 34 deletions(-) diff --git a/drivers/sensor/st/lis2dw12/Kconfig b/drivers/sensor/st/lis2dw12/Kconfig index 2241505902fc5..d2ccde49fed0c 100644 --- a/drivers/sensor/st/lis2dw12/Kconfig +++ b/drivers/sensor/st/lis2dw12/Kconfig @@ -63,10 +63,15 @@ config LIS2DW12_TAP endif # LIS2DW12_TRIGGER -config LIS2DW12_THRESHOLD - bool "Wakeup threshold trigger (via interrupt)" +config LIS2DW12_SLEEP + bool "Sleep mode" help - Enable the wakeup threshold trigger feature. + Enable sleep (inactivity) mode with ODR change when detected + +config LIS2DW12_WAKEUP + bool "Wakeup detection (via interrupt)" + help + Enable the wakeup detection feature. The wake-up interrupt signal is generated if a certain number of consecutive data exceed the configured threshold (config in DT). The threshold is applied to both positive and negative data: for diff --git a/drivers/sensor/st/lis2dw12/lis2dw12.c b/drivers/sensor/st/lis2dw12/lis2dw12.c index 005238ca87d77..3f1e7580780a5 100644 --- a/drivers/sensor/st/lis2dw12/lis2dw12.c +++ b/drivers/sensor/st/lis2dw12/lis2dw12.c @@ -187,7 +187,7 @@ static inline int32_t sensor_ms2_to_mg(const struct sensor_value *ms2) } } -#if CONFIG_LIS2DW12_THRESHOLD +#if (CONFIG_LIS2DW12_SLEEP || CONFIG_LIS2DW12_WAKEUP) /* Converts a lis2dw12_fs_t range to its value in milli-g * Range can be 2/4/8/16G @@ -290,27 +290,50 @@ static int lis2dw12_attr_set_ff_dur(const struct device *dev, } #endif +#ifdef CONFIG_LIS2DW12_SLEEP +static int lis2dw12_attr_set_act_mode(const struct device *dev, + enum sensor_channel chan, + enum sensor_attribute attr, + const struct sensor_value *val) +{ + const struct lis2dw12_device_config *cfg = dev->config; + struct lis2dw12_data *lis2dw12 = dev->data; + stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx; + lis2dw12_sleep_on_t sleep_val = val->val1 & 0x03U; + + /* can only be set for all directions at once */ + if (chan != SENSOR_CHAN_ACCEL_XYZ) { + return -EINVAL; + } + + return lis2dw12_act_mode_set(ctx, sleep_val); +} +#endif + static int lis2dw12_attr_set(const struct device *dev, enum sensor_channel chan, enum sensor_attribute attr, const struct sensor_value *val) { -#if CONFIG_LIS2DW12_THRESHOLD switch (attr) { +#if (CONFIG_LIS2DW12_SLEEP || CONFIG_LIS2DW12_WAKEUP) case SENSOR_ATTR_UPPER_THRESH: case SENSOR_ATTR_LOWER_THRESH: return lis2dw12_attr_set_thresh(dev, chan, attr, val); +#endif +#ifdef CONFIG_LIS2DW12_FREEFALL + case SENSOR_ATTR_FF_DUR: + return lis2dw12_attr_set_ff_dur(dev, chan, attr, val); +#endif +#ifdef CONFIG_LIS2DW12_SLEEP + case SENSOR_ATTR_FEATURE_MASK: + return lis2dw12_attr_set_act_mode(dev, chan, attr, val); +#endif default: /* Do nothing */ break; } -#endif -#ifdef CONFIG_LIS2DW12_FREEFALL - if (attr == SENSOR_ATTR_FF_DUR) { - return lis2dw12_attr_set_ff_dur(dev, chan, attr, val); - } -#endif switch (chan) { case SENSOR_CHAN_ACCEL_X: @@ -527,13 +550,20 @@ static int lis2dw12_init(const struct device *dev) return ret; } -#ifdef CONFIG_LIS2DW12_THRESHOLD +#ifdef CONFIG_LIS2DW12_WAKEUP ret = lis2dw12_wkup_dur_set(ctx, cfg->wakeup_duration); if (ret < 0) { LOG_ERR("wakeup duration config error %d", ret); return ret; } -#endif /* CONFIG_LIS2DW12_THRESHOLD */ +#endif /* CONFIG_LIS2DW12_WAKEUP */ +#ifdef CONFIG_LIS2DW12_SLEEP + ret = lis2dw12_act_sleep_dur_set(ctx, cfg->sleep_duration); + if (ret < 0) { + LOG_ERR("sleep duration config error %d", ret); + return ret; + } +#endif /* CONFIG_LIS2DW12_SLEEP */ return 0; } @@ -580,11 +610,18 @@ static int lis2dw12_init(const struct device *dev) #define LIS2DW12_CONFIG_FREEFALL(inst) #endif /* CONFIG_LIS2DW12_FREEFALL */ -#ifdef CONFIG_LIS2DW12_THRESHOLD -#define LIS2DW12_CONFIG_THRESHOLD(inst) \ +#ifdef CONFIG_LIS2DW12_WAKEUP +#define LIS2DW12_CONFIG_WAKEUP(inst) \ .wakeup_duration = DT_INST_PROP(inst, wakeup_duration), #else -#define LIS2DW12_CONFIG_THRESHOLD(inst) +#define LIS2DW12_CONFIG_WAKEUP(inst) +#endif + +#ifdef CONFIG_LIS2DW12_SLEEP +#define LIS2DW12_CONFIG_SLEEP(inst) \ + .sleep_duration = DT_INST_PROP(inst, sleep_duration), +#else +#define LIS2DW12_CONFIG_SLEEP(inst) #endif #ifdef CONFIG_LIS2DW12_TRIGGER @@ -606,7 +643,8 @@ static int lis2dw12_init(const struct device *dev) .drdy_pulsed = DT_INST_PROP(inst, drdy_pulsed), \ LIS2DW12_CONFIG_TAP(inst) \ LIS2DW12_CONFIG_FREEFALL(inst) \ - LIS2DW12_CONFIG_THRESHOLD(inst) \ + LIS2DW12_CONFIG_WAKEUP(inst) \ + LIS2DW12_CONFIG_SLEEP(inst) \ COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, irq_gpios), \ (LIS2DW12_CFG_IRQ(inst)), ()) diff --git a/drivers/sensor/st/lis2dw12/lis2dw12.h b/drivers/sensor/st/lis2dw12/lis2dw12.h index 266f13bf7899b..b0a16660f648f 100644 --- a/drivers/sensor/st/lis2dw12/lis2dw12.h +++ b/drivers/sensor/st/lis2dw12/lis2dw12.h @@ -97,13 +97,16 @@ struct lis2dw12_device_config { uint8_t tap_latency; uint8_t tap_quiet; #endif /* CONFIG_LIS2DW12_TAP */ +#ifdef CONFIG_LIS2DW12_SLEEP + uint8_t sleep_duration; +#endif #ifdef CONFIG_LIS2DW12_FREEFALL uint8_t freefall_duration; uint8_t freefall_threshold; #endif /* CONFIG_LIS2DW12_FREEFALL */ -#ifdef CONFIG_LIS2DW12_THRESHOLD +#ifdef CONFIG_LIS2DW12_WAKEUP uint8_t wakeup_duration; -#endif /* CONFIG_LIS2DW12_THRESHOLD */ +#endif /* CONFIG_LIS2DW12_WAKEUP */ #endif /* CONFIG_LIS2DW12_TRIGGER */ }; @@ -131,10 +134,14 @@ struct lis2dw12_data { sensor_trigger_handler_t double_tap_handler; const struct sensor_trigger *double_tap_trig; #endif /* CONFIG_LIS2DW12_TAP */ -#ifdef CONFIG_LIS2DW12_THRESHOLD - sensor_trigger_handler_t threshold_handler; - const struct sensor_trigger *threshold_trig; -#endif /* CONFIG_LIS2DW12_THRESHOLD */ +#ifdef CONFIG_LIS2DW12_WAKEUP + sensor_trigger_handler_t motion_handler; + const struct sensor_trigger *motion_trig; +#endif /* CONFIG_LIS2DW12_WAKEUP */ +#ifdef CONFIG_LIS2DW12_SLEEP + sensor_trigger_handler_t stationary_handler; + const struct sensor_trigger *stationary_trig; +#endif #ifdef CONFIG_LIS2DW12_FREEFALL sensor_trigger_handler_t freefall_handler; const struct sensor_trigger *freefall_trig; diff --git a/drivers/sensor/st/lis2dw12/lis2dw12_trigger.c b/drivers/sensor/st/lis2dw12/lis2dw12_trigger.c index e30d6d4c1678d..0f300d157b60b 100644 --- a/drivers/sensor/st/lis2dw12/lis2dw12_trigger.c +++ b/drivers/sensor/st/lis2dw12/lis2dw12_trigger.c @@ -67,14 +67,14 @@ static int lis2dw12_enable_int(const struct device *dev, return lis2dw12_pin_int1_route_set(ctx, &int_route.ctrl4_int1_pad_ctrl); #endif /* CONFIG_LIS2DW12_TAP */ -#ifdef CONFIG_LIS2DW12_THRESHOLD +#ifdef CONFIG_LIS2DW12_WAKEUP /** * Trigger fires when channel reading transitions configured * thresholds. The thresholds are configured via the @ref * SENSOR_ATTR_LOWER_THRESH and @ref SENSOR_ATTR_UPPER_THRESH * attributes. */ - case SENSOR_TRIG_THRESHOLD: + case SENSOR_TRIG_MOTION: LOG_DBG("Setting int1_wu: %d\n", enable); lis2dw12_pin_int1_route_get(ctx, &int_route.ctrl4_int1_pad_ctrl); @@ -82,6 +82,21 @@ static int lis2dw12_enable_int(const struct device *dev, return lis2dw12_pin_int1_route_set(ctx, &int_route.ctrl4_int1_pad_ctrl); #endif +#ifdef CONFIG_LIS2DW12_SLEEP + /** + * Trigger fires when channel reading transitions configured + * thresholds for a certain time. The thresholds are configured + * via the @ref SENSOR_ATTR_LOWER_THRESH and @ref SENSOR_ATTR_UPPER_THRESH + * attributes. + */ + case SENSOR_TRIG_STATIONARY: + LOG_DBG("Setting int2_sleep_chg: %d\n", enable); + lis2dw12_pin_int2_route_get(ctx, + &int_route.ctrl5_int2_pad_ctrl); + int_route.ctrl5_int2_pad_ctrl.int2_sleep_chg = enable; + return lis2dw12_pin_int2_route_set(ctx, + &int_route.ctrl5_int2_pad_ctrl); +#endif #ifdef CONFIG_LIS2DW12_FREEFALL /** * Trigger fires when the readings does not include Earth's @@ -154,13 +169,22 @@ int lis2dw12_trigger_set(const struct device *dev, lis2dw12->double_tap_trig = trig; return lis2dw12_enable_int(dev, SENSOR_TRIG_DOUBLE_TAP, state); #endif /* CONFIG_LIS2DW12_TAP */ -#ifdef CONFIG_LIS2DW12_THRESHOLD - case SENSOR_TRIG_THRESHOLD: +#ifdef CONFIG_LIS2DW12_WAKEUP + case SENSOR_TRIG_MOTION: { LOG_DBG("Set trigger %d (handler: %p)\n", trig->type, handler); - lis2dw12->threshold_handler = handler; - lis2dw12->threshold_trig = trig; - return lis2dw12_enable_int(dev, SENSOR_TRIG_THRESHOLD, state); + lis2dw12->motion_handler = handler; + lis2dw12->motion_trig = trig; + return lis2dw12_enable_int(dev, SENSOR_TRIG_MOTION, state); + } +#endif +#ifdef CONFIG_LIS2DW12_SLEEP + case SENSOR_TRIG_STATIONARY: + { + LOG_DBG("Set trigger %d (handler: %p)\n", trig->type, handler); + lis2dw12->stationary_handler = handler; + lis2dw12->stationary_trig = trig; + return lis2dw12_enable_int(dev, SENSOR_TRIG_STATIONARY, state); } #endif #ifdef CONFIG_LIS2DW12_FREEFALL @@ -214,14 +238,28 @@ static int lis2dw12_handle_double_tap_int(const struct device *dev) } #endif /* CONFIG_LIS2DW12_TAP */ -#ifdef CONFIG_LIS2DW12_THRESHOLD +#ifdef CONFIG_LIS2DW12_WAKEUP static int lis2dw12_handle_wu_ia_int(const struct device *dev) { struct lis2dw12_data *lis2dw12 = dev->data; - sensor_trigger_handler_t handler = lis2dw12->threshold_handler; + sensor_trigger_handler_t handler = lis2dw12->motion_handler; if (handler) { - handler(dev, lis2dw12->threshold_trig); + handler(dev, lis2dw12->motion_trig); + } + + return 0; +} +#endif + +#ifdef CONFIG_LIS2DW12_SLEEP +static int lis2dw12_handle_sleep_change_int(const struct device *dev) +{ + struct lis2dw12_data *lis2dw12 = dev->data; + sensor_trigger_handler_t handler = lis2dw12->stationary_handler; + + if (handler) { + handler(dev, lis2dw12->stationary_trig); } return 0; @@ -265,11 +303,16 @@ static void lis2dw12_handle_interrupt(const struct device *dev) lis2dw12_handle_double_tap_int(dev); } #endif /* CONFIG_LIS2DW12_TAP */ -#ifdef CONFIG_LIS2DW12_THRESHOLD +#ifdef CONFIG_LIS2DW12_WAKEUP if (sources.all_int_src.wu_ia) { lis2dw12_handle_wu_ia_int(dev); } #endif +#ifdef CONFIG_LIS2DW12_SLEEP + if (sources.all_int_src.sleep_change_ia) { + lis2dw12_handle_sleep_change_int(dev); + } +#endif #ifdef CONFIG_LIS2DW12_FREEFALL if (sources.all_int_src.ff_ia) { lis2dw12_handle_ff_ia_int(dev); diff --git a/dts/bindings/sensor/st,lis2dw12-common.yaml b/dts/bindings/sensor/st,lis2dw12-common.yaml index c95a97da3987c..85baed2109c93 100644 --- a/dts/bindings/sensor/st,lis2dw12-common.yaml +++ b/dts/bindings/sensor/st,lis2dw12-common.yaml @@ -247,3 +247,21 @@ properties: - 3 # LIS2DW12_DT_WAKEUP_4_ODR enum: [0, 1, 2, 3] + + sleep-duration: + type: int + default: 0 + description: | + The sleep duration. Default value is the register reset value (0000 -> 16*1/ODR). + If the accelerometer readings of the all axes are lower + than the wakeup threshold value for the sleep duration long, + then a sleep trigger occurs or the device goes in sleep mode. This value is 4 bits long in the + register and 1 LSB = 512 * 1/ODR. + + Value goes from 0 to 15 + + - 0 # LIS2DW12_DT_SLEEP_0_ODR + ... + - 15 # LIS2DW12_DT_SLEEP_15_ODR + + enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] diff --git a/include/zephyr/dt-bindings/sensor/lis2dw12.h b/include/zephyr/dt-bindings/sensor/lis2dw12.h index 9e5892ec0a52d..e5d2e0482d510 100644 --- a/include/zephyr/dt-bindings/sensor/lis2dw12.h +++ b/include/zephyr/dt-bindings/sensor/lis2dw12.h @@ -39,4 +39,22 @@ #define LIS2DW12_DT_WAKEUP_3_ODR 2 #define LIS2DW12_DT_WAKEUP_4_ODR 3 +/* sleep duration */ +#define LIS2DW12_DT_SLEEP_0_ODR 0 +#define LIS2DW12_DT_SLEEP_1_ODR 1 +#define LIS2DW12_DT_SLEEP_2_ODR 2 +#define LIS2DW12_DT_SLEEP_3_ODR 3 +#define LIS2DW12_DT_SLEEP_4_ODR 4 +#define LIS2DW12_DT_SLEEP_5_ODR 5 +#define LIS2DW12_DT_SLEEP_6_ODR 6 +#define LIS2DW12_DT_SLEEP_7_ODR 7 +#define LIS2DW12_DT_SLEEP_8_ODR 8 +#define LIS2DW12_DT_SLEEP_9_ODR 9 +#define LIS2DW12_DT_SLEEP_10_ODR 10 +#define LIS2DW12_DT_SLEEP_11_ODR 11 +#define LIS2DW12_DT_SLEEP_12_ODR 12 +#define LIS2DW12_DT_SLEEP_13_ODR 13 +#define LIS2DW12_DT_SLEEP_14_ODR 14 +#define LIS2DW12_DT_SLEEP_15_ODR 15 + #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_ST_LIS2DW12_H_ */ From 44d101acabb5f3c0916ba9c193361c32e16c015c Mon Sep 17 00:00:00 2001 From: Andrew Sonzogni Date: Mon, 23 Sep 2024 15:31:15 +0200 Subject: [PATCH 0215/4482] drivers: sensor: lis2dw12: add interrupt status fetch INT status can be fetched if the feature can't trigger via interrupt Signed-off-by: Andrew Sonzogni --- drivers/sensor/st/lis2dw12/lis2dw12.c | 15 +++++++++++++++ drivers/sensor/st/lis2dw12/lis2dw12.h | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/drivers/sensor/st/lis2dw12/lis2dw12.c b/drivers/sensor/st/lis2dw12/lis2dw12.c index 3f1e7580780a5..1029376f8dc50 100644 --- a/drivers/sensor/st/lis2dw12/lis2dw12.c +++ b/drivers/sensor/st/lis2dw12/lis2dw12.c @@ -135,6 +135,18 @@ static inline void lis2dw12_channel_get_acc(const struct device *dev, } } +static inline void lis2dw12_channel_get_status(const struct device *dev, + struct sensor_value *val) +{ + const struct lis2dw12_device_config *cfg = dev->config; + stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx; + lis2dw12_status_t status; + + /* fetch manually the interrupt status reg */ + lis2dw12_status_reg_get(ctx, &status); + val->val1 = (int32_t)*(uint8_t *)&status; +} + static int lis2dw12_channel_get(const struct device *dev, enum sensor_channel chan, struct sensor_value *val) @@ -149,6 +161,9 @@ static int lis2dw12_channel_get(const struct device *dev, case SENSOR_CHAN_DIE_TEMP: lis2dw12_channel_get_temp(dev, val); return 0; + case SENSOR_CHAN_LIS2DW12_INT_STATUS: + lis2dw12_channel_get_status(dev, val); + return 0; default: LOG_DBG("Channel not supported"); break; diff --git a/drivers/sensor/st/lis2dw12/lis2dw12.h b/drivers/sensor/st/lis2dw12/lis2dw12.h index b0a16660f648f..6f9011a423171 100644 --- a/drivers/sensor/st/lis2dw12/lis2dw12.h +++ b/drivers/sensor/st/lis2dw12/lis2dw12.h @@ -163,4 +163,9 @@ int lis2dw12_trigger_set(const struct device *dev, sensor_trigger_handler_t handler); #endif /* CONFIG_LIS2DW12_TRIGGER */ +/* LIS2DW12 specific channels */ +enum sensor_channel_lis2dw12 { + SENSOR_CHAN_LIS2DW12_INT_STATUS = SENSOR_CHAN_PRIV_START, +}; + #endif /* ZEPHYR_DRIVERS_SENSOR_LIS2DW12_LIS2DW12_H_ */ From 5aebd1276d68af036c30d544d6ef92f0893b53d7 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Fri, 20 Sep 2024 10:34:24 +0800 Subject: [PATCH 0216/4482] devicetree: add `DT_NODE_HAS_STATUS_OKAY` We already have `DT_HAS_COMPAT_STATUS_OKAY` and `DT_NUM_INST_STATUS_OKAY`, it seems intuitive to assume that `DT_NODE_HAS_STATUS_OKAY` exists, so much so that it was used before it's implemented. This patch implements `DT_NODE_HAS_STATUS_OKAY`, which is equivalent to: `DT_NODE_HAS_STATUS(, okay)` Added test for it in `tests/lib/devicetree/api` Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- include/zephyr/devicetree.h | 22 ++++++++++++++++++++++ tests/lib/devicetree/api/src/main.c | 11 +++++++++++ 2 files changed, 33 insertions(+) diff --git a/include/zephyr/devicetree.h b/include/zephyr/devicetree.h index a93ffd527543d..8430c3072c68e 100644 --- a/include/zephyr/devicetree.h +++ b/include/zephyr/devicetree.h @@ -3431,6 +3431,28 @@ #define DT_NODE_HAS_STATUS(node_id, status) \ DT_NODE_HAS_STATUS_INTERNAL(node_id, status) +/** + * @brief Does a node identifier refer to a node with a status `okay`? + * + * Example uses: + * + * @code{.c} + * DT_NODE_HAS_STATUS_OKAY(DT_PATH(soc, i2c_12340000)) + * @endcode + * + * Tests whether a node identifier refers to a node which: + * + * - exists in the devicetree, and + * - has a status property as `okay` + * + * As usual, both a missing status and an `ok` status are treated as + * `okay`. + * + * @param node_id a node identifier + * @return 1 if the node has status as `okay`, 0 otherwise. + */ +#define DT_NODE_HAS_STATUS_OKAY(node_id) DT_NODE_HAS_STATUS(node_id, okay) + /** * @brief Does the devicetree have a status `okay` node with a compatible? * diff --git a/tests/lib/devicetree/api/src/main.c b/tests/lib/devicetree/api/src/main.c index 60a79d68f399a..7616ef54a1f3c 100644 --- a/tests/lib/devicetree/api/src/main.c +++ b/tests/lib/devicetree/api/src/main.c @@ -366,6 +366,17 @@ ZTEST(devicetree_api, test_has_status) 0, ""); } +ZTEST(devicetree_api, test_has_status_okay) +{ + zassert_equal(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(test_gpio_1)), 1); + + zassert_equal(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(test_no_status)), 1); + + zassert_equal(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(disabled_gpio)), 0); + + zassert_equal(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(reserved_gpio)), 0); +} + ZTEST(devicetree_api, test_bus) { int pin, flags; From 52a202309bd383c3c60770ab5e6e6ac4d263f5c4 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Fri, 20 Sep 2024 12:47:40 +0800 Subject: [PATCH 0217/4482] zephyr: bulk update to DT_NODE_HAS_STATUS_OKAY Change instances of: DT_NODE_HAS_STATUS(, okay) to DT_NODE_HAS_STATUS_OKAY() Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- arch/arm/core/cortex_m/fault.c | 2 +- boards/arm/v2m_musca_b1/pinmux.c | 2 +- boards/arm/v2m_musca_s1/pinmux.c | 2 +- boards/digilent/arty_a7/board.c | 4 +- boards/nordic/nrf9160dk/board.c | 4 +- boards/nordic/nrf9160dk/nrf52840_reset.c | 4 +- boards/nxp/frdm_mcxa156/board.c | 22 +-- boards/nxp/frdm_mcxn236/board.c | 36 ++-- boards/nxp/frdm_mcxn947/board.c | 58 +++--- boards/silabs/dev_kits/sltb004a/board.c | 2 +- drivers/adc/adc_gd32.c | 6 +- drivers/audio/dmic_mcux.c | 2 +- drivers/clock_control/clock_control_gd32.c | 2 +- .../clock_control/clock_control_ifx_cat1.c | 174 +++++++++--------- drivers/clock_control/clock_control_litex.h | 2 +- drivers/clock_control/clock_control_max32.c | 12 +- .../clock_control/clock_control_mcux_ccm.c | 14 +- .../clock_control/clock_control_mcux_scg.c | 4 +- .../clock_control/clock_control_mcux_sim.c | 2 +- .../clock_control/clock_control_nrf2_fll16m.c | 2 +- .../clock_control/clock_control_nrf2_lfclk.c | 2 +- .../clock_control/clock_control_renesas_ra.c | 2 +- .../clock_control_renesas_ra_cgc.c | 2 +- .../clock_control/clock_control_smartbond.c | 18 +- drivers/clock_control/clock_stm32_ll_wb0.c | 2 +- drivers/counter/counter_mcux_snvs.c | 4 +- drivers/counter/counter_smartbond_timer.c | 2 +- drivers/disk/sdmmc_stm32.c | 2 +- drivers/dma/dma_mcux_edma.c | 6 +- drivers/dma/dma_stm32.c | 16 +- drivers/dma/dma_stm32_bdma.c | 4 +- drivers/dma/dmamux_stm32.c | 28 +-- drivers/espi/espi_mchp_xec_host_v2.c | 6 +- drivers/ethernet/eth_stm32_hal.c | 4 +- drivers/ethernet/nxp_enet/eth_mcux.c | 10 +- drivers/ethernet/nxp_enet/eth_nxp_enet.c | 2 +- drivers/ethernet/phy/phy_adin2111.c | 2 +- drivers/flash/soc_flash_lpc.c | 4 +- drivers/flash/soc_flash_mcux.c | 12 +- drivers/flash/soc_flash_nrf.c | 8 +- drivers/gpio/gpio_esp32.c | 14 +- drivers/gpio/gpio_gd32.c | 2 +- drivers/gpio/gpio_lpc11u6x.c | 12 +- drivers/gpio/gpio_mchp_xec.c | 24 +-- drivers/gpio/gpio_nrfx.c | 2 +- drivers/gpio/gpio_nxp_s32.c | 8 +- drivers/gpio/gpio_renesas_ra_ioport.c | 2 +- drivers/gpio/gpio_sam0.c | 8 +- drivers/gpio/gpio_stm32.c | 4 +- drivers/gpio/gpio_xlnx_axi.c | 2 +- drivers/i2c/i2c_esp32.c | 8 +- drivers/i2s/i2s_litex.c | 4 +- .../interrupt_controller/intc_mchp_ecia_xec.c | 2 +- drivers/led_strip/lpd880x.c | 2 +- drivers/lora/shell.c | 2 +- drivers/memc/memc_nxp_s32_qspi.c | 2 +- drivers/pinctrl/pinctrl_esp32.c | 4 +- drivers/pinctrl/pinctrl_ite_it8xxx2.c | 2 +- drivers/pinctrl/pinctrl_kinetis.c | 2 +- drivers/rtc/rtc_smartbond.c | 2 +- drivers/sensor/bosch/bmi08x/bmi08x.h | 2 +- drivers/sensor/st/stm32_temp/stm32_temp.c | 4 +- drivers/sensor/st/stm32_vbat/stm32_vbat.c | 2 +- drivers/sensor/st/stm32_vref/stm32_vref.c | 4 +- drivers/serial/leuart_gecko.c | 8 +- drivers/serial/uart_cmsdk_apb.c | 20 +- drivers/serial/uart_lpc11u6x.c | 84 ++++----- drivers/serial/uart_lpc11u6x.h | 16 +- drivers/serial/uart_miv.c | 4 +- drivers/spi/spi_smartbond.c | 4 +- drivers/spi/spi_xec_qmspi.c | 4 +- drivers/timer/mcux_os_timer.c | 10 +- drivers/timer/nrf_grtc_timer.c | 4 +- drivers/timer/smartbond_timer.c | 2 +- drivers/usb/device/usb_dc_mcux.c | 8 +- drivers/usb/device/usb_dc_nrfx.c | 4 +- drivers/usb/udc/udc_nrf.c | 4 +- drivers/watchdog/wdt_esp32.c | 4 +- include/zephyr/device.h | 2 +- .../clock_control/stm32_clock_control.h | 6 +- include/zephyr/drivers/emul.h | 2 +- include/zephyr/linker/linker-defs.h | 9 +- include/zephyr/pm/state.h | 6 +- kernel/init.c | 6 +- kernel/xip.c | 6 +- modules/hal_nordic/nrfx/nrfx_config.h | 2 +- samples/basic/button/src/main.c | 2 +- samples/basic/threads/src/main.c | 4 +- samples/bluetooth/central_otc/src/main.c | 4 +- .../encrypted_advertising/central/src/main.c | 2 +- .../peripheral/src/main.c | 2 +- samples/bluetooth/iso_receive/src/main.c | 2 +- samples/bluetooth/mesh_provisioner/src/main.c | 8 +- samples/bluetooth/periodic_sync/src/main.c | 2 +- samples/bluetooth/peripheral_hids/src/hog.c | 2 +- samples/bluetooth/peripheral_hr/src/main.c | 2 +- .../boards/espressif/deep_sleep/src/main.c | 2 +- .../boards/espressif/light_sleep/src/main.c | 2 +- samples/boards/nordic/battery/src/battery.c | 4 +- .../nxp/mimxrt1060_evk/system_off/src/main.c | 4 +- samples/boards/st/i2c_timing/src/main.c | 2 +- samples/boards/st/mco/src/main.c | 2 +- .../st/power_mgmt/standby_shutdown/src/main.c | 2 +- .../boards/st/power_mgmt/wkup_pins/src/main.c | 2 +- samples/drivers/espi/src/main.c | 10 +- samples/drivers/i2s/echo/src/main.c | 12 +- samples/drivers/lora/receive/src/main.c | 2 +- samples/drivers/lora/send/src/main.c | 2 +- samples/shields/x_nucleo_53l0a1/src/main.c | 2 +- .../subsys/mgmt/osdp/control_panel/src/main.c | 2 +- .../mgmt/osdp/peripheral_device/src/main.c | 2 +- samples/subsys/task_wdt/src/main.c | 2 +- soc/arm/beetle/power.c | 12 +- soc/atmel/sam/common/soc_power.c | 4 +- soc/intel/intel_adsp/common/clk.c | 4 +- .../intel_adsp/common/include/adsp_clk.h | 4 +- soc/intel/intel_adsp/common/mem_window.c | 8 +- soc/ite/ec/it8xxx2/soc.c | 8 +- soc/microchip/mec/common/soc_dt.h | 2 +- soc/microchip/mec/mec172x/device_power.c | 6 +- .../common/nrf54hx_nrf92x_mpu_regions.c | 6 +- soc/nordic/nrf52/soc.c | 2 +- soc/nordic/nrf53/soc.c | 2 +- soc/nordic/nrf54h/soc.c | 2 +- soc/nordic/nrf92/soc.c | 2 +- soc/nordic/validate_enabled_instances.c | 6 +- soc/nxp/imx/imx6sx/soc.c | 86 ++++----- soc/nxp/imx/imx7d/soc.c | 26 +-- soc/nxp/imx/imx8m/a53/soc.c | 8 +- soc/nxp/imx/imx8m/m4_mini/soc.c | 8 +- soc/nxp/imx/imx8m/m4_quad/soc.c | 8 +- soc/nxp/imx/imx8m/m7/soc.c | 24 +-- soc/nxp/imxrt/imxrt10xx/flexspi.c | 2 +- soc/nxp/imxrt/imxrt10xx/soc.c | 24 +-- soc/nxp/imxrt/imxrt118x/soc.c | 36 ++-- soc/nxp/imxrt/imxrt11xx/soc.c | 24 +-- soc/nxp/imxrt/imxrt5xx/cm33/soc.c | 4 +- soc/nxp/imxrt/imxrt6xx/cm33/soc.c | 4 +- soc/nxp/imxrt/imxrt6xx/cm33/soc.h | 4 +- soc/nxp/kinetis/k6x/soc.c | 2 +- soc/nxp/kinetis/ke1xf/soc.c | 32 ++-- soc/nxp/kinetis/ke1xz/soc.c | 18 +- soc/nxp/kinetis/kl2x/soc.c | 2 +- soc/nxp/kinetis/kwx/soc_kw4xz.c | 8 +- soc/nxp/lpc/lpc55xxx/soc.c | 2 +- soc/nxp/mcx/mcxc/soc.c | 2 +- soc/nxp/rw/power.c | 14 +- soc/nxp/rw/soc.c | 10 +- soc/openisa/rv32m1/soc.c | 8 +- soc/renesas/ra/ra4m1/soc.c | 2 +- soc/renesas/smartbond/da1469x/power.c | 2 +- soc/snps/emsk/soc_config.c | 8 +- soc/st/stm32/stm32h7x/mpu_regions.c | 4 +- soc/xlnx/zynq7000/xc7zxxx/soc.c | 8 +- soc/xlnx/zynq7000/xc7zxxxs/soc.c | 8 +- .../nordic/hal/nrf5/radio/radio_nrf5_fem.h | 4 +- subsys/pm/policy.c | 4 +- subsys/tracing/sysview/sysview_config.c | 2 +- subsys/usb/device/usb_device.c | 2 +- .../host/id/mocks/zephyr/linker/linker-defs.h | 4 + tests/drivers/adc/adc_api/src/test_adc.c | 4 +- .../src/test_stm32_clock_configuration_adc.c | 2 +- .../src/test_stm32_clock_configuration_i2c.c | 2 +- .../src/test_stm32_clock_configuration_i2s.c | 2 +- .../test_stm32_clock_configuration_lptim.c | 2 +- .../src/test_stm32_clock_configuration.c | 2 +- tests/drivers/eeprom/api/src/main.c | 4 +- tests/drivers/gpio/gpio_basic_api/src/main.c | 2 +- .../gpio/gpio_basic_api/src/test_gpio.h | 8 +- .../gpio/gpio_reserved_ranges/src/main.c | 12 +- tests/drivers/i2c/i2c_api/src/test_i2c.c | 6 +- tests/drivers/i2c/i2c_ram/src/test_i2c_ram.c | 2 +- tests/drivers/i2c/i2c_tca954x/src/main.c | 4 +- tests/drivers/memc/ram/src/main.c | 24 +-- tests/drivers/pwm/pwm_api/src/test_pwm.c | 8 +- .../drivers/smbus/smbus_api/src/test_smbus.c | 2 +- .../smbus/smbus_api/src/test_smbus_qemu.c | 2 +- .../watchdog/wdt_basic_api/src/test_wdt.c | 4 +- .../watchdog/wdt_basic_reset_none/src/main.c | 2 +- .../watchdog/wdt_error_cases/src/main.c | 4 +- 180 files changed, 743 insertions(+), 738 deletions(-) diff --git a/arch/arm/core/cortex_m/fault.c b/arch/arm/core/cortex_m/fault.c index 4cc01f87129a0..4e604ba8033c1 100644 --- a/arch/arm/core/cortex_m/fault.c +++ b/arch/arm/core/cortex_m/fault.c @@ -743,7 +743,7 @@ static inline bool z_arm_is_pc_valid(uintptr_t pc) return true; } -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_itcm)) /* Is it in the ITCM */ if ((((uintptr_t)&__itcm_start) <= pc) && (pc < ((uintptr_t)&__itcm_end))) { return true; diff --git a/boards/arm/v2m_musca_b1/pinmux.c b/boards/arm/v2m_musca_b1/pinmux.c index 443d462eb2126..2a2c44d62b937 100644 --- a/boards/arm/v2m_musca_b1/pinmux.c +++ b/boards/arm/v2m_musca_b1/pinmux.c @@ -40,7 +40,7 @@ static void arm_musca_b1_pinmux_defaults(void) scc[IOMUX_ALTF1_OUTSEL] = 0xffff; scc[IOMUX_ALTF1_OENSEL] = 0xffff; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart0)) /* clear bit 0/1 for GPIO0/1 to steer from ALTF1 */ scc[IOMUX_MAIN_INSEL] &= ~(BIT(0) | BIT(1)); scc[IOMUX_MAIN_OUTSEL] &= ~(BIT(0) | BIT(1)); diff --git a/boards/arm/v2m_musca_s1/pinmux.c b/boards/arm/v2m_musca_s1/pinmux.c index a1a1a4ad2523a..3affa53dadf4b 100644 --- a/boards/arm/v2m_musca_s1/pinmux.c +++ b/boards/arm/v2m_musca_s1/pinmux.c @@ -40,7 +40,7 @@ static void arm_musca_s1_pinmux_defaults(void) scc[IOMUX_ALTF1_OUTSEL] = 0xffff; scc[IOMUX_ALTF1_OENSEL] = 0xffff; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart0)) /* clear bit 0/1 for GPIO0/1 to steer from ALTF1 */ scc[IOMUX_MAIN_INSEL] &= ~(BIT(0) | BIT(1)); scc[IOMUX_MAIN_OUTSEL] &= ~(BIT(0) | BIT(1)); diff --git a/boards/digilent/arty_a7/board.c b/boards/digilent/arty_a7/board.c index 984cd34ab43a4..0e087c212b427 100644 --- a/boards/digilent/arty_a7/board.c +++ b/boards/digilent/arty_a7/board.c @@ -16,7 +16,7 @@ LOG_MODULE_REGISTER(board, CONFIG_LOG_DEFAULT_LEVEL); #define DAPLINK_QSPI_MUX_NODE DT_NODELABEL(daplink_qspi_mux) -#if DT_NODE_HAS_STATUS(DAPLINK_QSPI_MUX_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(DAPLINK_QSPI_MUX_NODE) int board_daplink_qspi_mux_select(enum board_daplink_qspi_mux_mode mode) { struct gpio_dt_spec mux = GPIO_DT_SPEC_GET(DAPLINK_QSPI_MUX_NODE, mux_gpios); @@ -77,4 +77,4 @@ static int board_init(void) } SYS_INIT(board_init, POST_KERNEL, CONFIG_BOARD_INIT_PRIORITY); -#endif /* DT_NODE_HAS_STATUS(DAPLINK_QSPI_MUX_NODE, okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DAPLINK_QSPI_MUX_NODE) */ diff --git a/boards/nordic/nrf9160dk/board.c b/boards/nordic/nrf9160dk/board.c index adf137df196e1..c8e680c45397a 100644 --- a/boards/nordic/nrf9160dk/board.c +++ b/boards/nordic/nrf9160dk/board.c @@ -32,7 +32,7 @@ LOG_MODULE_REGISTER(board_control, CONFIG_BOARD_NRF9160DK_LOG_LEVEL); GET_PORT(reset_input, gpios, 0) == 0 && \ GET_PIN(reset_input, gpios, 0) == 18) #define USE_RESET_GPIO \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(reset_input), okay) && \ + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(reset_input)) && \ !RESET_INPUT_IS_PINRESET) struct switch_cfg { @@ -47,7 +47,7 @@ struct switch_cfg { #endif }; -#define ROUTING_ENABLED(_name) DT_NODE_HAS_STATUS(DT_NODELABEL(_name), okay) +#define ROUTING_ENABLED(_name) DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(_name)) #define SWITCH_CFG(_name, _idx) \ { \ .gpio = GET_DEV(_name, control_gpios, _idx), \ diff --git a/boards/nordic/nrf9160dk/nrf52840_reset.c b/boards/nordic/nrf9160dk/nrf52840_reset.c index e639b5765b737..aa9f9d4b62031 100644 --- a/boards/nordic/nrf9160dk/nrf52840_reset.c +++ b/boards/nordic/nrf9160dk/nrf52840_reset.c @@ -12,7 +12,7 @@ #define RESET_NODE DT_NODELABEL(nrf52840_reset) -#if DT_NODE_HAS_STATUS(RESET_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(RESET_NODE) #define RESET_GPIO_CTRL DT_GPIO_CTLR(RESET_NODE, gpios) #define RESET_GPIO_PIN DT_GPIO_PIN(RESET_NODE, gpios) @@ -65,4 +65,4 @@ int bt_hci_transport_setup(const struct device *h4) return 0; } -#endif /* DT_NODE_HAS_STATUS(RESET_NODE, okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(RESET_NODE) */ diff --git a/boards/nxp/frdm_mcxa156/board.c b/boards/nxp/frdm_mcxa156/board.c index 98801c47a1a23..84347c4715ca8 100644 --- a/boards/nxp/frdm_mcxa156/board.c +++ b/boards/nxp/frdm_mcxa156/board.c @@ -66,52 +66,52 @@ static int frdm_mcxa156_init(void) CLOCK_SetClockDiv(kCLOCK_DivAHBCLK, 1U); /* !< Set AHBCLKDIV divider to value 1 */ CLOCK_SetClockDiv(kCLOCK_DivFRO_HF_DIV, 1U); /* !< Set FROHFDIV divider to value 1 */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(porta), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(porta)) RESET_ReleasePeripheralReset(kPORT0_RST_SHIFT_RSTn); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(portb), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(portb)) RESET_ReleasePeripheralReset(kPORT1_RST_SHIFT_RSTn); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(portc), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(portc)) RESET_ReleasePeripheralReset(kPORT2_RST_SHIFT_RSTn); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(portd), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(portd)) RESET_ReleasePeripheralReset(kPORT3_RST_SHIFT_RSTn); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(porte), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(porte)) RESET_ReleasePeripheralReset(kPORT4_RST_SHIFT_RSTn); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0)) RESET_ReleasePeripheralReset(kGPIO0_RST_SHIFT_RSTn); CLOCK_EnableClock(kCLOCK_GateGPIO0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) RESET_ReleasePeripheralReset(kGPIO1_RST_SHIFT_RSTn); CLOCK_EnableClock(kCLOCK_GateGPIO1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio2)) RESET_ReleasePeripheralReset(kGPIO2_RST_SHIFT_RSTn); CLOCK_EnableClock(kCLOCK_GateGPIO2); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio3)) RESET_ReleasePeripheralReset(kGPIO3_RST_SHIFT_RSTn); CLOCK_EnableClock(kCLOCK_GateGPIO3); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio4)) RESET_ReleasePeripheralReset(kGPIO4_RST_SHIFT_RSTn); CLOCK_EnableClock(kCLOCK_GateGPIO4); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart0)) CLOCK_SetClockDiv(kCLOCK_DivLPUART0, 1u); CLOCK_AttachClk(kFRO12M_to_LPUART0); #endif diff --git a/boards/nxp/frdm_mcxn236/board.c b/boards/nxp/frdm_mcxn236/board.c index 8f0d1fd797674..fbaf20ccd65f4 100644 --- a/boards/nxp/frdm_mcxn236/board.c +++ b/boards/nxp/frdm_mcxn236/board.c @@ -88,84 +88,84 @@ static int frdm_mcxn236_init(void) /* Set AHBCLKDIV divider to value 1 */ CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcomm1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm1)) CLOCK_SetClkDiv(kCLOCK_DivFlexcom1Clk, 1u); CLOCK_AttachClk(kFRO12M_to_FLEXCOMM1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcomm2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm2)) CLOCK_SetClkDiv(kCLOCK_DivFlexcom2Clk, 1u); CLOCK_AttachClk(kFRO12M_to_FLEXCOMM2); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcomm3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm3)) CLOCK_SetClkDiv(kCLOCK_DivFlexcom3Clk, 1u); CLOCK_AttachClk(kFRO12M_to_FLEXCOMM3); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcomm4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm4)) CLOCK_SetClkDiv(kCLOCK_DivFlexcom4Clk, 1u); CLOCK_AttachClk(kFRO12M_to_FLEXCOMM4); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcomm5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm5)) CLOCK_SetClkDiv(kCLOCK_DivFlexcom5Clk, 1u); CLOCK_AttachClk(kFRO12M_to_FLEXCOMM5); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(os_timer), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(os_timer)) CLOCK_AttachClk(kCLK_1M_to_OSTIMER); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0)) CLOCK_EnableClock(kCLOCK_Gpio0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) CLOCK_EnableClock(kCLOCK_Gpio1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio2)) CLOCK_EnableClock(kCLOCK_Gpio2); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio3)) CLOCK_EnableClock(kCLOCK_Gpio3); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio4)) CLOCK_EnableClock(kCLOCK_Gpio4); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio5)) CLOCK_EnableClock(kCLOCK_Gpio5); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(wwdt0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(wwdt0)) CLOCK_SetClkDiv(kCLOCK_DivWdt0Clk, 1u); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ctimer0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ctimer0)) CLOCK_SetClkDiv(kCLOCK_DivCtimer0Clk, 1U); CLOCK_AttachClk(kPLL0_to_CTIMER0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ctimer1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ctimer1)) CLOCK_SetClkDiv(kCLOCK_DivCtimer1Clk, 1U); CLOCK_AttachClk(kPLL0_to_CTIMER1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ctimer2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ctimer2)) CLOCK_SetClkDiv(kCLOCK_DivCtimer2Clk, 1U); CLOCK_AttachClk(kPLL0_to_CTIMER2); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ctimer3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ctimer3)) CLOCK_SetClkDiv(kCLOCK_DivCtimer3Clk, 1U); CLOCK_AttachClk(kPLL0_to_CTIMER3); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ctimer4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ctimer4)) CLOCK_SetClkDiv(kCLOCK_DivCtimer4Clk, 1U); CLOCK_AttachClk(kPLL0_to_CTIMER4); #endif diff --git a/boards/nxp/frdm_mcxn947/board.c b/boards/nxp/frdm_mcxn947/board.c index 37ec5f4dd6d4a..db21a4ae19478 100644 --- a/boards/nxp/frdm_mcxn947/board.c +++ b/boards/nxp/frdm_mcxn947/board.c @@ -127,7 +127,7 @@ static int frdm_mcxn947_init(void) CLOCK_SetupExtClocking(BOARD_XTAL0_CLK_HZ); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcan0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcan0)) /* Set up PLL1 for 80 MHz FlexCAN clock */ const pll_setup_t pll1Setup = { .pllctrl = SCG_SPLLCTRL_SOURCE(1U) | SCG_SPLLCTRL_SELI(27U) | @@ -146,50 +146,50 @@ static int frdm_mcxn947_init(void) CLOCK_SetClkDiv(kCLOCK_DivPLL1Clk0, 1U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcomm1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm1)) CLOCK_SetClkDiv(kCLOCK_DivFlexcom1Clk, 1u); CLOCK_AttachClk(kFRO12M_to_FLEXCOMM1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcomm2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm2)) CLOCK_SetClkDiv(kCLOCK_DivFlexcom2Clk, 1u); CLOCK_AttachClk(kFRO12M_to_FLEXCOMM2); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcomm4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm4)) CLOCK_SetClkDiv(kCLOCK_DivFlexcom4Clk, 1u); CLOCK_AttachClk(kFRO12M_to_FLEXCOMM4); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(os_timer), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(os_timer)) CLOCK_AttachClk(kCLK_1M_to_OSTIMER); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0)) CLOCK_EnableClock(kCLOCK_Gpio0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) CLOCK_EnableClock(kCLOCK_Gpio1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio2)) CLOCK_EnableClock(kCLOCK_Gpio2); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio3)) CLOCK_EnableClock(kCLOCK_Gpio3); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio4)) CLOCK_EnableClock(kCLOCK_Gpio4); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio5)) CLOCK_EnableClock(kCLOCK_Gpio5); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dac0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dac0)) SPC_EnableActiveModeAnalogModules(SPC0, kSPC_controlDac0); CLOCK_SetClkDiv(kCLOCK_DivDac0Clk, 1u); CLOCK_AttachClk(kFRO_HF_to_DAC0); @@ -197,7 +197,7 @@ static int frdm_mcxn947_init(void) CLOCK_EnableClock(kCLOCK_Dac0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dac1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dac1)) SPC_EnableActiveModeAnalogModules(SPC0, kSPC_controlDac1); CLOCK_SetClkDiv(kCLOCK_DivDac1Clk, 1u); CLOCK_AttachClk(kFRO_HF_to_DAC1); @@ -205,7 +205,7 @@ static int frdm_mcxn947_init(void) CLOCK_EnableClock(kCLOCK_Dac1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet)) CLOCK_AttachClk(kNONE_to_ENETRMII); CLOCK_EnableClock(kCLOCK_Enet); SYSCON0->PRESETCTRL2 = SYSCON_PRESETCTRL2_ENET_RST_MASK; @@ -214,41 +214,41 @@ static int frdm_mcxn947_init(void) SYSCON->ENET_PHY_INTF_SEL = SYSCON_ENET_PHY_INTF_SEL_PHY_SEL(1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(wwdt0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(wwdt0)) CLOCK_SetClkDiv(kCLOCK_DivWdt0Clk, 1u); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ctimer0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ctimer0)) CLOCK_SetClkDiv(kCLOCK_DivCtimer0Clk, 1U); CLOCK_AttachClk(kPLL0_to_CTIMER0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ctimer1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ctimer1)) CLOCK_SetClkDiv(kCLOCK_DivCtimer1Clk, 1U); CLOCK_AttachClk(kPLL0_to_CTIMER1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ctimer2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ctimer2)) CLOCK_SetClkDiv(kCLOCK_DivCtimer2Clk, 1U); CLOCK_AttachClk(kPLL0_to_CTIMER2); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ctimer3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ctimer3)) CLOCK_SetClkDiv(kCLOCK_DivCtimer3Clk, 1U); CLOCK_AttachClk(kPLL0_to_CTIMER3); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ctimer4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ctimer4)) CLOCK_SetClkDiv(kCLOCK_DivCtimer4Clk, 1U); CLOCK_AttachClk(kPLL0_to_CTIMER4); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcan0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcan0)) CLOCK_SetClkDiv(kCLOCK_DivFlexcan0Clk, 1U); CLOCK_AttachClk(kPLL1_CLK0_to_FLEXCAN0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc0)) CLOCK_SetClkDiv(kCLOCK_DivUSdhcClk, 1u); CLOCK_AttachClk(kFRO_HF_to_USDHC); #endif @@ -260,17 +260,17 @@ static int frdm_mcxn947_init(void) enable_cache64(); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(vref), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(vref)) CLOCK_EnableClock(kCLOCK_Vref); SPC_EnableActiveModeAnalogModules(SPC0, kSPC_controlVref); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpadc0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpadc0)) CLOCK_SetClkDiv(kCLOCK_DivAdc0Clk, 1U); CLOCK_AttachClk(kFRO_HF_to_ADC0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb1), okay) && CONFIG_USB_DC_NXP_EHCI +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && CONFIG_USB_DC_NXP_EHCI usb_phy_config_struct_t usbPhyConfig = { BOARD_USB_PHY_D_CAL, BOARD_USB_PHY_TXCAL45DP, BOARD_USB_PHY_TXCAL45DM, }; @@ -312,13 +312,13 @@ static int frdm_mcxn947_init(void) USB_EhciPhyInit(kUSB_ControllerEhci0, BOARD_XTAL0_CLK_HZ, &usbPhyConfig); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpcmp0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpcmp0)) CLOCK_SetClkDiv(kCLOCK_DivCmp0FClk, 1U); CLOCK_AttachClk(kFRO12M_to_CMP0F); SPC_EnableActiveModeAnalogModules(SPC0, (kSPC_controlCmp0 | kSPC_controlCmp0Dac)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lptmr0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lptmr0)) /* * Clock Select Decides what input source the lptmr will clock from @@ -340,9 +340,9 @@ static int frdm_mcxn947_init(void) CLOCK_SetupClockCtrl(kCLOCK_CLKIN_ENA_FM_USBH_LPT); #endif /* DT_PROP(DT_NODELABEL(lptmr0), clk_source) */ -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(lptmr0), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lptmr0)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexio0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexio0)) CLOCK_SetClkDiv(kCLOCK_DivFlexioClk, 1u); CLOCK_AttachClk(kPLL0_to_FLEXIO); #endif diff --git a/boards/silabs/dev_kits/sltb004a/board.c b/boards/silabs/dev_kits/sltb004a/board.c index 43dd2a6b3b248..1b09177ce6906 100644 --- a/boards/silabs/dev_kits/sltb004a/board.c +++ b/boards/silabs/dev_kits/sltb004a/board.c @@ -37,7 +37,7 @@ static int efr32mg_sltb004a_init(void) #define CCS811 DT_NODELABEL(ccs811) -#if DT_NODE_HAS_STATUS(CCS811, okay) +#if DT_NODE_HAS_STATUS_OKAY(CCS811) cfg = (struct supply_cfg){ .gpio = DEVICE_DT_GET(DT_GPIO_CTLR(CCS811, supply_gpios)), .pin = DT_GPIO_PIN(CCS811, supply_gpios), diff --git a/drivers/adc/adc_gd32.c b/drivers/adc/adc_gd32.c index 75760de6713fa..46fbfc783b751 100644 --- a/drivers/adc/adc_gd32.c +++ b/drivers/adc/adc_gd32.c @@ -41,9 +41,9 @@ LOG_MODULE_REGISTER(adc_gd32, CONFIG_ADC_LOG_LEVEL); #define ADC1_NODE DT_NODELABEL(adc1) #define ADC2_NODE DT_NODELABEL(adc2) -#define ADC0_ENABLE DT_NODE_HAS_STATUS(ADC0_NODE, okay) -#define ADC1_ENABLE DT_NODE_HAS_STATUS(ADC1_NODE, okay) -#define ADC2_ENABLE DT_NODE_HAS_STATUS(ADC2_NODE, okay) +#define ADC0_ENABLE DT_NODE_HAS_STATUS_OKAY(ADC0_NODE) +#define ADC1_ENABLE DT_NODE_HAS_STATUS_OKAY(ADC1_NODE) +#define ADC2_ENABLE DT_NODE_HAS_STATUS_OKAY(ADC2_NODE) #ifndef ADC0 /** diff --git a/drivers/audio/dmic_mcux.c b/drivers/audio/dmic_mcux.c index ff357fda9bbb8..0f032e8368cc0 100644 --- a/drivers/audio/dmic_mcux.c +++ b/drivers/audio/dmic_mcux.c @@ -686,7 +686,7 @@ static const struct _dmic_ops dmic_ops = { /* Gets pointer for a given PDM channel node */ #define PDM_DMIC_CHAN_GET(pdm_node) \ - COND_CODE_1(DT_NODE_HAS_STATUS(pdm_node, okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(pdm_node), \ (&pdm_channel_##pdm_node), (NULL)), /* Gets array of pointers to PDM channels */ diff --git a/drivers/clock_control/clock_control_gd32.c b/drivers/clock_control/clock_control_gd32.c index 1a20d5e4ab210..52b197e2029f7 100644 --- a/drivers/clock_control/clock_control_gd32.c +++ b/drivers/clock_control/clock_control_gd32.c @@ -43,7 +43,7 @@ struct clock_control_gd32_config { #if DT_HAS_COMPAT_STATUS_OKAY(gd_gd32_timer) /* timer identifiers */ #define TIMER_ID_OR_NONE(nodelabel) \ - COND_CODE_1(DT_NODE_HAS_STATUS(DT_NODELABEL(nodelabel), okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(nodelabel)), \ (DT_CLOCKS_CELL(DT_NODELABEL(nodelabel), id),), ()) static const uint16_t timer_ids[] = { diff --git a/drivers/clock_control/clock_control_ifx_cat1.c b/drivers/clock_control/clock_control_ifx_cat1.c index 1d89ed0fbe0c3..606e06c4e467d 100644 --- a/drivers/clock_control/clock_control_ifx_cat1.c +++ b/drivers/clock_control/clock_control_ifx_cat1.c @@ -18,111 +18,111 @@ /* Enumeration of enabled in device tree Clock, uses for indexing clock info table */ enum { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_imo), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_imo)) INFINEON_CAT1_CLOCK_IMO, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_iho), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_iho)) INFINEON_CAT1_CLOCK_IHO, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux0)) INFINEON_CAT1_CLOCK_PATHMUX0, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux1)) INFINEON_CAT1_CLOCK_PATHMUX1, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux2)) INFINEON_CAT1_CLOCK_PATHMUX2, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux3)) INFINEON_CAT1_CLOCK_PATHMUX3, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux4)) INFINEON_CAT1_CLOCK_PATHMUX4, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf0)) INFINEON_CAT1_CLOCK_HF0, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf1)) INFINEON_CAT1_CLOCK_HF1, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf2)) INFINEON_CAT1_CLOCK_HF2, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf3)) INFINEON_CAT1_CLOCK_HF3, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf4)) INFINEON_CAT1_CLOCK_HF4, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf5)) INFINEON_CAT1_CLOCK_HF5, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf6), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf6)) INFINEON_CAT1_CLOCK_HF6, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf7), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf7)) INFINEON_CAT1_CLOCK_HF7, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf8), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf8)) INFINEON_CAT1_CLOCK_HF8, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf9), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf9)) INFINEON_CAT1_CLOCK_HF9, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf10), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf10)) INFINEON_CAT1_CLOCK_HF10, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf11), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf11)) INFINEON_CAT1_CLOCK_HF11, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf12), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf12)) INFINEON_CAT1_CLOCK_HF12, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf13), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf13)) INFINEON_CAT1_CLOCK_HF13, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_fast), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_fast)) INFINEON_CAT1_CLOCK_FAST, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_slow), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_slow)) INFINEON_CAT1_CLOCK_SLOW, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_peri), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_peri)) INFINEON_CAT1_CLOCK_PERI, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pll0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pll0)) INFINEON_CAT1_CLOCK_PLL0, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pll1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pll1)) INFINEON_CAT1_CLOCK_PLL1, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(fll0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(fll0)) INFINEON_CAT1_CLOCK_FLL0, #endif @@ -142,111 +142,111 @@ struct infineon_cat1_clock_info_t { static struct infineon_cat1_clock_info_t clock_info_table[INFINEON_CAT1_ENABLED_CLOCK_COUNT] = { /* We always have IMO */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_imo), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_imo)) [INFINEON_CAT1_CLOCK_IMO] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_imo)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_iho), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_iho)) [INFINEON_CAT1_CLOCK_IHO] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_iho)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux0)) [INFINEON_CAT1_CLOCK_PATHMUX0] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(path_mux0)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux1)) [INFINEON_CAT1_CLOCK_PATHMUX1] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(path_mux1)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux2)) [INFINEON_CAT1_CLOCK_PATHMUX2] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(path_mux2)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux3)) [INFINEON_CAT1_CLOCK_PATHMUX3] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(path_mux3)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux4)) [INFINEON_CAT1_CLOCK_PATHMUX4] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(path_mux4)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf0)) [INFINEON_CAT1_CLOCK_HF0] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf0)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf1)) [INFINEON_CAT1_CLOCK_HF1] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf1)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf2)) [INFINEON_CAT1_CLOCK_HF2] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf2)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf3)) [INFINEON_CAT1_CLOCK_HF3] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf3)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf4)) [INFINEON_CAT1_CLOCK_HF4] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf4)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf5)) [INFINEON_CAT1_CLOCK_HF5] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf5)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf6), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf6)) [INFINEON_CAT1_CLOCK_HF6] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf6)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf7), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf7)) [INFINEON_CAT1_CLOCK_HF7] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf7)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf8), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf8)) [INFINEON_CAT1_CLOCK_HF8] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf8)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf9), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf9)) [INFINEON_CAT1_CLOCK_HF9] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf9)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf10), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf10)) [INFINEON_CAT1_CLOCK_HF10] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf10)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf11), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf11)) [INFINEON_CAT1_CLOCK_HF11] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf11)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf12), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf12)) [INFINEON_CAT1_CLOCK_HF12] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf12)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf13), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf13)) [INFINEON_CAT1_CLOCK_HF13] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_hf13)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_fast), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_fast)) [INFINEON_CAT1_CLOCK_FAST] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_fast)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_slow), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_slow)) [INFINEON_CAT1_CLOCK_SLOW] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_slow)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_peri), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_peri)) [INFINEON_CAT1_CLOCK_PERI] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(clk_peri)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pll0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pll0)) [INFINEON_CAT1_CLOCK_PLL0] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(pll0)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pll1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pll1)) [INFINEON_CAT1_CLOCK_PLL1] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(pll1)) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(fll0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(fll0)) [INFINEON_CAT1_CLOCK_FLL0] = { .dt_ord = DT_DEP_ORD(DT_NODELABEL(fll0)) }, #endif }; @@ -326,7 +326,7 @@ static cyhal_clock_t *_get_hal_obj_from_ord(uint32_t dt_ord) return ret_obj; } -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dpll_hp), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dpll_hp)) __WEAK void cycfg_ClockStartupError(uint32_t error) { (void)error; /* Suppress the compiler warning */ @@ -390,25 +390,25 @@ static int clock_control_infineon_cat1_init(const struct device *dev) uint32 clock_div; /* Configure IMO */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_imo), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_imo)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_IMO].obj; if (cyhal_clock_get(clock_obj, &CYHAL_CLOCK_RSC_IMO)) { return -EIO; } #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_iho), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_iho)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_IHO].obj; if (cyhal_clock_get(clock_obj, &CYHAL_CLOCK_RSC_IHO)) { return -EIO; } #endif -#if !DT_NODE_HAS_STATUS(DT_NODELABEL(clk_imo), okay) && \ - !DT_NODE_HAS_STATUS(DT_NODELABEL(clk_iho), okay) +#if !DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_imo)) && \ + !DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_iho)) #error "IMO clock or IHO clock must be enabled" #endif /* Configure the PathMux[0] to source defined in tree device 'path_mux0' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux0)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_PATHMUX0].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(path_mux0)); @@ -418,7 +418,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the PathMux[1] to source defined in tree device 'path_mux1' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux1)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_PATHMUX1].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(path_mux1)); @@ -428,7 +428,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the PathMux[2] to source defined in tree device 'path_mux2' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux2)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_PATHMUX2].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(path_mux2)); @@ -438,7 +438,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the PathMux[3] to source defined in tree device 'path_mux3' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux3)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_PATHMUX3].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(path_mux3)); @@ -448,7 +448,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the PathMux[4] to source defined in tree device 'path_mux4' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(path_mux4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(path_mux4)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_PATHMUX4].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(path_mux4)); @@ -458,7 +458,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure FLL0 */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(fll0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(fll0)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_FLL0].obj; frequency = DT_PROP(DT_NODELABEL(fll0), clock_frequency); @@ -470,7 +470,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure PLL0 */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pll0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pll0)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_PLL0].obj; frequency = DT_PROP(DT_NODELABEL(pll0), clock_frequency); @@ -483,7 +483,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure PLL1 */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pll1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pll1)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_PLL1].obj; frequency = DT_PROP(DT_NODELABEL(pll1), clock_frequency); @@ -495,7 +495,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[0] to source defined in tree device 'clk_hf0' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf0)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF0].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf0)); clock_div = DT_PROP(DT_NODELABEL(clk_hf0), clock_div); @@ -506,7 +506,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[1] to source defined in tree device 'clk_hf1' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf1)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF1].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf1)); clock_div = DT_PROP(DT_NODELABEL(clk_hf1), clock_div); @@ -517,7 +517,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[2] to source defined in tree device 'clk_hf2' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf2)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF2].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf2)); clock_div = DT_PROP(DT_NODELABEL(clk_hf2), clock_div); @@ -528,7 +528,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[3] to source defined in tree device 'clk_hf3' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf3)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF3].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf3)); clock_div = DT_PROP(DT_NODELABEL(clk_hf3), clock_div); @@ -539,7 +539,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[4] to source defined in tree device 'clk_hf4' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf4)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF4].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf4)); clock_div = DT_PROP(DT_NODELABEL(clk_hf4), clock_div); @@ -550,7 +550,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[5] to source defined in tree device 'clk_hf5' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf5)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF5].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf5)); clock_div = DT_PROP(DT_NODELABEL(clk_hf5), clock_div); @@ -561,7 +561,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[6] to source defined in tree device 'clk_hf6' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf6), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf6)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF6].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf6)); clock_div = DT_PROP(DT_NODELABEL(clk_hf6), clock_div); @@ -572,7 +572,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[7] to source defined in tree device 'clk_hf7' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf7), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf7)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF7].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf7)); clock_div = DT_PROP(DT_NODELABEL(clk_hf7), clock_div); @@ -583,7 +583,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[8] to source defined in tree device 'clk_hf8' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf8), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf8)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF8].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf8)); clock_div = DT_PROP(DT_NODELABEL(clk_hf8), clock_div); @@ -594,7 +594,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[9] to source defined in tree device 'clk_hf9' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf9), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf9)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF9].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf9)); clock_div = DT_PROP(DT_NODELABEL(clk_hf9), clock_div); @@ -605,7 +605,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[10] to source defined in tree device 'clk_hf10' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf10), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf10)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF10].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf10)); clock_div = DT_PROP(DT_NODELABEL(clk_hf10), clock_div); @@ -616,7 +616,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[11] to source defined in tree device 'clk_hf11' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf11), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf11)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF11].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf11)); clock_div = DT_PROP(DT_NODELABEL(clk_hf11), clock_div); @@ -627,7 +627,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[12] to source defined in tree device 'clk_hf12' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf12), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf12)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF12].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf12)); clock_div = DT_PROP(DT_NODELABEL(clk_hf12), clock_div); @@ -638,7 +638,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the HF[13] to source defined in tree device 'clk_hf13' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_hf13), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_hf13)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_HF13].obj; clock_source_obj = _get_hal_obj_from_ord(GET_CLK_SOURCE_ORD(clk_hf13)); clock_div = DT_PROP(DT_NODELABEL(clk_hf13), clock_div); @@ -649,7 +649,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the clock fast to source defined in tree device 'clk_fast' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_fast), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_fast)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_FAST].obj; clock_div = DT_PROP(DT_NODELABEL(clk_fast), clock_div); @@ -663,7 +663,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the clock peri to source defined in tree device 'clk_peri' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_peri), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_peri)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_PERI].obj; clock_div = DT_PROP(DT_NODELABEL(clk_peri), clock_div); @@ -677,7 +677,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) #endif /* Configure the clock slow to source defined in tree device 'clk_slow' node */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_slow), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_slow)) clock_obj = &clock_info_table[INFINEON_CAT1_CLOCK_SLOW].obj; clock_div = DT_PROP(DT_NODELABEL(clk_slow), clock_div); @@ -690,7 +690,7 @@ static int clock_control_infineon_cat1_init(const struct device *dev) } #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dpll_hp), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dpll_hp)) Cy_SysClk_Dpll_Hp0_Init(); SystemCoreClockUpdate(); #endif @@ -713,7 +713,7 @@ static const struct clock_control_driver_api clock_control_infineon_cat1_api = { .off = clock_control_infineon_cat_on_off }; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_imo), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_imo)) DEVICE_DT_DEFINE(DT_NODELABEL(clk_imo), clock_control_infineon_cat1_init, NULL, @@ -723,7 +723,7 @@ DEVICE_DT_DEFINE(DT_NODELABEL(clk_imo), CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &clock_control_infineon_cat1_api); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_iho), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_iho)) DEVICE_DT_DEFINE(DT_NODELABEL(clk_iho), clock_control_infineon_cat1_init, NULL, diff --git a/drivers/clock_control/clock_control_litex.h b/drivers/clock_control/clock_control_litex.h index 14d371c077c65..8a1b25de40071 100644 --- a/drivers/clock_control/clock_control_litex.h +++ b/drivers/clock_control/clock_control_litex.h @@ -73,7 +73,7 @@ lcko->margin.exp = CLKOUT_MARGIN_EXP(N); /* Devicetree clkout defines */ -#define CLKOUT_EXIST(N) DT_NODE_HAS_STATUS(DT_NODELABEL(clk##N), okay) +#define CLKOUT_EXIST(N) DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk##N)) #define CLKOUT_ID(N) DT_REG_ADDR(DT_NODELABEL(clk##N)) #define CLKOUT_FREQ(N) DT_PROP(DT_NODELABEL(clk##N), \ litex_clock_frequency) diff --git a/drivers/clock_control/clock_control_max32.c b/drivers/clock_control/clock_control_max32.c index 2cbed41bd23a8..29d7cc2fef424 100644 --- a/drivers/clock_control/clock_control_max32.c +++ b/drivers/clock_control/clock_control_max32.c @@ -106,27 +106,27 @@ static void setup_fixed_clocks(void) MXC_SYS_ClockSourceDisable(ADI_MAX32_CLK_EXTCLK); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_ipo), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_ipo)) MXC_SYS_ClockSourceEnable(ADI_MAX32_CLK_IPO); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_erfo), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_erfo)) MXC_SYS_ClockSourceEnable(ADI_MAX32_CLK_ERFO); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_ibro), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_ibro)) MXC_SYS_ClockSourceEnable(ADI_MAX32_CLK_IBRO); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_iso), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_iso)) MXC_SYS_ClockSourceEnable(ADI_MAX32_CLK_ISO); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_inro), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_inro)) MXC_SYS_ClockSourceEnable(ADI_MAX32_CLK_INRO); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(clk_ertco), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_ertco)) MXC_SYS_ClockSourceEnable(ADI_MAX32_CLK_ERTCO); #endif diff --git a/drivers/clock_control/clock_control_mcux_ccm.c b/drivers/clock_control/clock_control_mcux_ccm.c index 8ff096723521d..c3b7f2416c475 100644 --- a/drivers/clock_control/clock_control_mcux_ccm.c +++ b/drivers/clock_control/clock_control_mcux_ccm.c @@ -216,14 +216,14 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev, #endif #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc1), okay) && CONFIG_IMX_USDHC +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc1)) && CONFIG_IMX_USDHC case IMX_CCM_USDHC1_CLK: *rate = CLOCK_GetSysPfdFreq(kCLOCK_Pfd0) / (CLOCK_GetDiv(kCLOCK_Usdhc1Div) + 1U); break; #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc2), okay) && CONFIG_IMX_USDHC +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc2)) && CONFIG_IMX_USDHC case IMX_CCM_USDHC2_CLK: *rate = CLOCK_GetSysPfdFreq(kCLOCK_Pfd0) / (CLOCK_GetDiv(kCLOCK_Usdhc2Div) + 1U); @@ -339,12 +339,12 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev, / (CLOCK_GetDiv(kCLOCK_Sai3Div) + 1); break; #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexspi), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexspi)) case IMX_CCM_FLEXSPI_CLK: *rate = CLOCK_GetClockRootFreq(kCLOCK_FlexspiClkRoot); break; #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexspi2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexspi2)) case IMX_CCM_FLEXSPI2_CLK: *rate = CLOCK_GetClockRootFreq(kCLOCK_Flexspi2ClkRoot); break; @@ -354,7 +354,7 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev, *rate = CLOCK_GetFreq(kCLOCK_PerClk); break; #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexio1), okay) && CONFIG_MCUX_FLEXIO +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexio1)) && CONFIG_MCUX_FLEXIO case IMX_CCM_FLEXIO1_CLK: { uint32_t flexio_mux = CLOCK_GetMux(kCLOCK_Flexio1Mux); @@ -376,8 +376,8 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev, / (CLOCK_GetDiv(kCLOCK_Flexio1Div) + 1); } break; #endif -#if (DT_NODE_HAS_STATUS(DT_NODELABEL(flexio2), okay) \ - || DT_NODE_HAS_STATUS(DT_NODELABEL(flexio3), okay)) && CONFIG_MCUX_FLEXIO +#if (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexio2)) \ + || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexio3))) && CONFIG_MCUX_FLEXIO case IMX_CCM_FLEXIO2_3_CLK: { uint32_t flexio_mux = CLOCK_GetMux(kCLOCK_Flexio2Mux); diff --git a/drivers/clock_control/clock_control_mcux_scg.c b/drivers/clock_control/clock_control_mcux_scg.c index 5642aabe8dd7e..684cb8f2aa21c 100644 --- a/drivers/clock_control/clock_control_mcux_scg.c +++ b/drivers/clock_control/clock_control_mcux_scg.c @@ -125,7 +125,7 @@ static int mcux_scg_get_rate(const struct device *dev, static int mcux_scg_init(const struct device *dev) { -#if DT_NODE_HAS_STATUS(MCUX_SCG_CLOCK_NODE(clkout_clk), okay) +#if DT_NODE_HAS_STATUS_OKAY(MCUX_SCG_CLOCK_NODE(clkout_clk)) #if DT_SAME_NODE(DT_CLOCKS_CTLR(MCUX_SCG_CLOCK_NODE(clkout_clk)), MCUX_SCG_CLOCK_NODE(slow_clk)) CLOCK_SetClkOutSel(kClockClkoutSelScgSlow); #elif DT_SAME_NODE(DT_CLOCKS_CTLR(MCUX_SCG_CLOCK_NODE(clkout_clk)), MCUX_SCG_CLOCK_NODE(sosc_clk)) @@ -139,7 +139,7 @@ static int mcux_scg_init(const struct device *dev) #else #error Unsupported SCG clkout clock source #endif -#endif /* DT_NODE_HAS_STATUS(MCUX_SCG_CLOCK_NODE(clkout_clk), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(MCUX_SCG_CLOCK_NODE(clkout_clk)) */ return 0; } diff --git a/drivers/clock_control/clock_control_mcux_sim.c b/drivers/clock_control/clock_control_mcux_sim.c index 26c9a3c1c2a64..2b16e5d6361b8 100644 --- a/drivers/clock_control/clock_control_mcux_sim.c +++ b/drivers/clock_control/clock_control_mcux_sim.c @@ -67,7 +67,7 @@ static int mcux_sim_get_subsys_rate(const struct device *dev, return 0; } -#if DT_NODE_HAS_STATUS(DT_INST(0, nxp_kinetis_ke1xf_sim), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_kinetis_ke1xf_sim)) #define NXP_KINETIS_SIM_NODE DT_INST(0, nxp_kinetis_ke1xf_sim) #if DT_NODE_HAS_PROP(DT_INST(0, nxp_kinetis_ke1xf_sim), clkout_source) #define NXP_KINETIS_SIM_CLKOUT_SOURCE \ diff --git a/drivers/clock_control/clock_control_nrf2_fll16m.c b/drivers/clock_control/clock_control_nrf2_fll16m.c index 4fdf9220c2770..7462d822f4480 100644 --- a/drivers/clock_control/clock_control_nrf2_fll16m.c +++ b/drivers/clock_control/clock_control_nrf2_fll16m.c @@ -26,7 +26,7 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, #define FLL16M_LFXO_NODE DT_INST_PHANDLE_BY_NAME(0, clocks, lfxo) #define FLL16M_HFXO_NODE DT_INST_PHANDLE_BY_NAME(0, clocks, hfxo) -#define FLL16M_HAS_LFXO DT_NODE_HAS_STATUS(FLL16M_LFXO_NODE, okay) +#define FLL16M_HAS_LFXO DT_NODE_HAS_STATUS_OKAY(FLL16M_LFXO_NODE) #define FLL16M_LFXO_ACCURACY DT_PROP(FLL16M_LFXO_NODE, accuracy_ppm) #define FLL16M_HFXO_ACCURACY DT_PROP(FLL16M_HFXO_NODE, accuracy_ppm) diff --git a/drivers/clock_control/clock_control_nrf2_lfclk.c b/drivers/clock_control/clock_control_nrf2_lfclk.c index 9ce7974570e6a..36b8e2472977b 100644 --- a/drivers/clock_control/clock_control_nrf2_lfclk.c +++ b/drivers/clock_control/clock_control_nrf2_lfclk.c @@ -19,7 +19,7 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, #define LFCLK_LFXO_NODE DT_INST_PHANDLE_BY_NAME(0, clocks, lfxo) #define LFCLK_HFXO_NODE DT_INST_PHANDLE_BY_NAME(0, clocks, hfxo) -#define LFCLK_HAS_LFXO DT_NODE_HAS_STATUS(LFCLK_LFXO_NODE, okay) +#define LFCLK_HAS_LFXO DT_NODE_HAS_STATUS_OKAY(LFCLK_LFXO_NODE) #define LFCLK_LFLPRC_ACCURACY DT_INST_PROP(0, lflprc_accuracy_ppm) #define LFCLK_LFRC_ACCURACY DT_INST_PROP(0, lfrc_accuracy_ppm) diff --git a/drivers/clock_control/clock_control_renesas_ra.c b/drivers/clock_control/clock_control_renesas_ra.c index 0b058633151cf..3065c94e785a9 100644 --- a/drivers/clock_control/clock_control_renesas_ra.c +++ b/drivers/clock_control/clock_control_renesas_ra.c @@ -38,7 +38,7 @@ #define CLKSRC_FREQ(clk) DT_PROP(DT_PATH(clocks, clk), clock_frequency) -#define IS_CLKSRC_ENABLED(clk) DT_NODE_HAS_STATUS(DT_PATH(clocks, clk), okay) +#define IS_CLKSRC_ENABLED(clk) DT_NODE_HAS_STATUS_OKAY(DT_PATH(clocks, clk)) #define SCKSCR_INIT_VALUE _CONCAT(CLKSRC_, SYSCLK_SRC) diff --git a/drivers/clock_control/clock_control_renesas_ra_cgc.c b/drivers/clock_control/clock_control_renesas_ra_cgc.c index b03852fc86e1f..70512905be7aa 100644 --- a/drivers/clock_control/clock_control_renesas_ra_cgc.c +++ b/drivers/clock_control/clock_control_renesas_ra_cgc.c @@ -12,7 +12,7 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pclkblock), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pclkblock)) #define MSTP_REGS_ELEM(node_id, prop, idx) \ [DT_STRING_TOKEN_BY_IDX(node_id, prop, idx)] = \ (volatile uint32_t *)DT_REG_ADDR_BY_IDX(node_id, idx), diff --git a/drivers/clock_control/clock_control_smartbond.c b/drivers/clock_control/clock_control_smartbond.c index ed0cc20526426..3d866fb4c5820 100644 --- a/drivers/clock_control/clock_control_smartbond.c +++ b/drivers/clock_control/clock_control_smartbond.c @@ -265,7 +265,7 @@ static inline int smartbond_clock_control_off(const struct device *dev, switch (clk) { case SMARTBOND_CLK_RC32K: /* RC32K is used by POWERUP and WAKEUP HW FSM */ - BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_NODELABEL(rc32k), okay), + BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(rc32k)), "RC32K is not allowed to be turned off"); ret = -EPERM; break; @@ -472,12 +472,12 @@ static void smartbond_clock_control_update_memory_settings(uint32_t sys_clock_fr { if (sys_clock_freq > 32000000) { da1469x_qspi_set_read_pipe_delay(QSPIC_ID, 7); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(memc), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(memc)) da1469x_qspi_set_read_pipe_delay(QSPIC2_ID, 7); #endif } else { da1469x_qspi_set_read_pipe_delay(QSPIC_ID, 2); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(memc), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(memc)) da1469x_qspi_set_read_pipe_delay(QSPIC2_ID, 2); #endif } @@ -485,7 +485,7 @@ static void smartbond_clock_control_update_memory_settings(uint32_t sys_clock_fr da1469x_qspi_set_cs_delay(QSPIC_ID, SystemCoreClock, DT_PROP(DT_NODELABEL(flash_controller), read_cs_idle_delay), DT_PROP(DT_NODELABEL(flash_controller), erase_cs_idle_delay)); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(memc), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(memc)) da1469x_qspi_set_cs_delay(QSPIC2_ID, SystemCoreClock, DT_PROP(DT_NODELABEL(memc), read_cs_idle_min_ns), DT_PROP_OR(DT_NODELABEL(memc), erase_cs_idle_min_ns, 0)); @@ -565,7 +565,7 @@ int smartbond_clocks_init(const struct device *dev) ARG_UNUSED(dev); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(memc), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(memc)) /* Make sure QSPIC2 is enabled */ da1469x_clock_amba_enable(CRG_TOP_CLK_AMBA_REG_QSPI2_ENABLE_Msk); #endif @@ -579,12 +579,12 @@ int smartbond_clocks_init(const struct device *dev) DT_FOREACH_CHILD_STATUS_OKAY_SEP(DT_PATH(crg, osc), ENABLE_OSC, (;)); /* Make sure that selected sysclock is enabled */ - BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_PROP(DT_NODELABEL(sys_clk), clock_src), okay), + BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DT_PROP(DT_NODELABEL(sys_clk), clock_src)), "Clock selected as system clock no enabled in DT"); - BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_PROP(DT_NODELABEL(lp_clk), clock_src), okay), + BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DT_PROP(DT_NODELABEL(lp_clk), clock_src)), "Clock selected as LP clock no enabled in DT"); BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_NODELABEL(pll), disabled) || - DT_NODE_HAS_STATUS(DT_NODELABEL(xtal32m), okay), + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(xtal32m)), "PLL enabled in DT but XTAL32M is disabled"); clk_id = DT_DEP_ORD(DT_PROP(DT_NODELABEL(lp_clk), clock_src)); @@ -616,7 +616,7 @@ static int smartbond_clocks_pm_action(const struct device *dev, enum pm_device_a case PM_DEVICE_ACTION_SUSPEND: break; case PM_DEVICE_ACTION_RESUME: -#if DT_NODE_HAS_STATUS(DT_NODELABEL(memc), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(memc)) /* Make sure QSPIC2 is enabled */ da1469x_clock_amba_enable(CRG_TOP_CLK_AMBA_REG_QSPI2_ENABLE_Msk); #endif diff --git a/drivers/clock_control/clock_stm32_ll_wb0.c b/drivers/clock_control/clock_stm32_ll_wb0.c index 6654867e01e75..3a08cf64067b7 100644 --- a/drivers/clock_control/clock_stm32_ll_wb0.c +++ b/drivers/clock_control/clock_stm32_ll_wb0.c @@ -39,7 +39,7 @@ #if DT_NODE_HAS_PROP(STM32_CLOCK_CONTROL_NODE, slow_clock) -# if !DT_NODE_HAS_STATUS(DT_RCC_SLOWCLK_NODE, okay) +# if !DT_NODE_HAS_STATUS_OKAY(DT_RCC_SLOWCLK_NODE) # error slow-clock source is not enabled # endif diff --git a/drivers/counter/counter_mcux_snvs.c b/drivers/counter/counter_mcux_snvs.c index 3346cc21e75e6..172b4b894a306 100644 --- a/drivers/counter/counter_mcux_snvs.c +++ b/drivers/counter/counter_mcux_snvs.c @@ -311,7 +311,7 @@ static const struct counter_driver_api mcux_snvs_driver_api = { BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) <= 1, "unsupported snvs instance"); -#if DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) static struct mcux_snvs_data mcux_snvs_data_0; static void mcux_snvs_irq_config_0(const struct device *dev); @@ -339,4 +339,4 @@ static void mcux_snvs_irq_config_0(const struct device *dev) mcux_snvs_isr, DEVICE_DT_INST_GET(0), 0); irq_enable(DT_INST_IRQN(0)); } -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) */ diff --git a/drivers/counter/counter_smartbond_timer.c b/drivers/counter/counter_smartbond_timer.c index 8dc3baba045f1..8ee8f006dae6a 100644 --- a/drivers/counter/counter_smartbond_timer.c +++ b/drivers/counter/counter_smartbond_timer.c @@ -27,7 +27,7 @@ LOG_MODULE_REGISTER(counter_timer, CONFIG_COUNTER_LOG_LEVEL); #define COUNTER_DT_DEVICE(_idx) DEVICE_DT_GET_OR_NULL(DT_NODELABEL(timer##_idx)) -#define PDC_XTAL_EN (DT_NODE_HAS_STATUS(DT_NODELABEL(xtal32m), okay) ? \ +#define PDC_XTAL_EN (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(xtal32m)) ? \ MCU_PDC_EN_XTAL : MCU_PDC_EN_NONE) struct counter_smartbond_data { diff --git a/drivers/disk/sdmmc_stm32.c b/drivers/disk/sdmmc_stm32.c index 1ce9e8e16d971..faf9564a9fb0d 100644 --- a/drivers/disk/sdmmc_stm32.c +++ b/drivers/disk/sdmmc_stm32.c @@ -743,7 +743,7 @@ static int disk_stm32_sdmmc_init(const struct device *dev) return err; } -#if DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) #if STM32_SDMMC_USE_DMA diff --git a/drivers/dma/dma_mcux_edma.c b/drivers/dma/dma_mcux_edma.c index 26c7cf58c34b1..7da8bf79b06d5 100644 --- a/drivers/dma/dma_mcux_edma.c +++ b/drivers/dma/dma_mcux_edma.c @@ -55,11 +55,11 @@ struct dma_mcux_edma_config { #ifdef CONFIG_DMA_MCUX_USE_DTCM_FOR_DMA_DESCRIPTORS -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) #define EDMA_TCDPOOL_CACHE_ATTR __dtcm_noinit_section -#else /* DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) */ +#else /* DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) */ #error Selected DTCM for MCUX DMA descriptors but no DTCM section. -#endif /* DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) */ #elif defined(CONFIG_NOCACHE_MEMORY) #define EDMA_TCDPOOL_CACHE_ATTR __nocache diff --git a/drivers/dma/dma_stm32.c b/drivers/dma/dma_stm32.c index 1b8d1629d5698..8918c1c460517 100644 --- a/drivers/dma/dma_stm32.c +++ b/drivers/dma/dma_stm32.c @@ -29,7 +29,7 @@ LOG_MODULE_REGISTER(dma_stm32, CONFIG_DMA_LOG_LEVEL); #define DT_DRV_COMPAT st_stm32_dma_v2bis #endif -#if DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) #if DT_INST_IRQ_HAS_IDX(0, 7) #define DMA_STM32_0_STREAM_COUNT 8 #elif DT_INST_IRQ_HAS_IDX(0, 6) @@ -41,9 +41,9 @@ LOG_MODULE_REGISTER(dma_stm32, CONFIG_DMA_LOG_LEVEL); #else #define DMA_STM32_0_STREAM_COUNT 3 #endif -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) */ -#if DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(1)) #if DT_INST_IRQ_HAS_IDX(1, 7) #define DMA_STM32_1_STREAM_COUNT 8 #elif DT_INST_IRQ_HAS_IDX(1, 6) @@ -53,7 +53,7 @@ LOG_MODULE_REGISTER(dma_stm32, CONFIG_DMA_LOG_LEVEL); #else #define DMA_STM32_1_STREAM_COUNT 5 #endif -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(1)) */ static const uint32_t table_m_size[] = { LL_DMA_MDATAALIGN_BYTE, @@ -756,7 +756,7 @@ static void dma_stm32_irq_##dma##_##chan(const struct device *dev) \ #endif /* CONFIG_DMA_STM32_SHARED_IRQS */ -#if DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) DMA_STM32_DEFINE_IRQ_HANDLER(0, 0); DMA_STM32_DEFINE_IRQ_HANDLER(0, 1); @@ -804,10 +804,10 @@ static void dma_stm32_config_irq_0(const struct device *dev) DMA_STM32_INIT_DEV(0); -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) */ -#if DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(1)) DMA_STM32_DEFINE_IRQ_HANDLER(1, 0); DMA_STM32_DEFINE_IRQ_HANDLER(1, 1); @@ -856,4 +856,4 @@ static void dma_stm32_config_irq_1(const struct device *dev) DMA_STM32_INIT_DEV(1); -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(1)) */ diff --git a/drivers/dma/dma_stm32_bdma.c b/drivers/dma/dma_stm32_bdma.c index c5f5c6c74ea4b..70cc9a6770605 100644 --- a/drivers/dma/dma_stm32_bdma.c +++ b/drivers/dma/dma_stm32_bdma.c @@ -906,7 +906,7 @@ static void bdma_stm32_irq_##bdma##_##chan(const struct device *dev) \ } while (false) -#if DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) #define BDMA_STM32_DEFINE_IRQ_HANDLER_GEN(i, _) \ BDMA_STM32_DEFINE_IRQ_HANDLER(0, i) @@ -923,4 +923,4 @@ static void bdma_stm32_config_irq_0(const struct device *dev) BDMA_STM32_INIT_DEV(0); -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) */ diff --git a/drivers/dma/dmamux_stm32.c b/drivers/dma/dmamux_stm32.c index d12a294eb7ff1..27e02b1c18802 100644 --- a/drivers/dma/dmamux_stm32.c +++ b/drivers/dma/dmamux_stm32.c @@ -108,7 +108,7 @@ struct dmamux_stm32_dma_fops { }; #if (defined(CONFIG_DMA_STM32_V1) || defined(CONFIG_DMA_STM32_V2)) && \ - DT_NODE_HAS_STATUS(DT_NODELABEL(dmamux1), okay) + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dmamux1)) static const struct dmamux_stm32_dma_fops dmamux1 = { dma_stm32_configure, dma_stm32_start, @@ -118,7 +118,7 @@ static const struct dmamux_stm32_dma_fops dmamux1 = { }; #endif -#if defined(CONFIG_DMA_STM32_BDMA) && DT_NODE_HAS_STATUS(DT_NODELABEL(dmamux2), okay) +#if defined(CONFIG_DMA_STM32_BDMA) && DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dmamux2)) static const struct dmamux_stm32_dma_fops dmamux2 = { bdma_stm32_configure, bdma_stm32_start, @@ -130,17 +130,17 @@ static const struct dmamux_stm32_dma_fops dmamux2 = { const struct dmamux_stm32_dma_fops *get_dma_fops(const struct dmamux_stm32_config *dev_config) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dmamux1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dmamux1)) if (dev_config->base == DT_REG_ADDR(DT_NODELABEL(dmamux1))) { return &dmamux1; } -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(dmamux1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dmamux1)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dmamux2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dmamux2)) if (dev_config->base == DT_REG_ADDR(DT_NODELABEL(dmamux2))) { return &dmamux2; } -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(dmamux2), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dmamux2)) */ __ASSERT(false, "Unknown dma base address %x", dev_config->base); return (void *)0; @@ -298,24 +298,24 @@ static int dmamux_stm32_init(const struct device *dev) } #endif /* DT_INST_NODE_HAS_PROP(0, clocks) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dmamux1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dmamux1)) /* DMA 1 and DMA2 for DMAMUX1, BDMA for DMAMUX2 */ if (config->base == DT_REG_ADDR(DT_NODELABEL(dmamux1))) { /* DMAs assigned to DMAMUX channels at build time might not be ready. */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dma1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dma1)) if (device_is_ready(DEVICE_DT_GET(DT_NODELABEL(dma1))) == false) { return -ENODEV; } #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dma2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dma2)) if (device_is_ready(DEVICE_DT_GET(DT_NODELABEL(dma2))) == false) { return -ENODEV; } #endif } -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(dmamux1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dmamux1)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dmamux2), okay) && DT_NODE_HAS_STATUS(DT_NODELABEL(bdma1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dmamux2)) && DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(bdma1)) if (config->base == DT_REG_ADDR(DT_NODELABEL(dmamux2))) { if (device_is_ready(DEVICE_DT_GET(DT_NODELABEL(bdma1))) == false) { return -ENODEV; @@ -346,19 +346,19 @@ static const struct dma_driver_api dma_funcs = { #define DMA_1_BEGIN_DMAMUX_CHANNEL DT_PROP_OR(DT_NODELABEL(dma1), dma_offset, 0) #define DMA_1_END_DMAMUX_CHANNEL (DMA_1_BEGIN_DMAMUX_CHANNEL + \ DT_PROP_OR(DT_NODELABEL(dma1), dma_requests, 0)) -#define DEV_DMA1 COND_CODE_1(DT_NODE_HAS_STATUS(DT_NODELABEL(dma1), okay), \ +#define DEV_DMA1 COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dma1)), \ DEVICE_DT_GET(DT_NODELABEL(dma1)), NULL) #define DMA_2_BEGIN_DMAMUX_CHANNEL DT_PROP_OR(DT_NODELABEL(dma2), dma_offset, 0) #define DMA_2_END_DMAMUX_CHANNEL (DMA_2_BEGIN_DMAMUX_CHANNEL + \ DT_PROP_OR(DT_NODELABEL(dma2), dma_requests, 0)) -#define DEV_DMA2 COND_CODE_1(DT_NODE_HAS_STATUS(DT_NODELABEL(dma2), okay), \ +#define DEV_DMA2 COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dma2)), \ DEVICE_DT_GET(DT_NODELABEL(dma2)), NULL) #define BDMA_1_BEGIN_DMAMUX_CHANNEL DT_PROP_OR(DT_NODELABEL(bdma1), dma_offset, 0) #define BDMA_1_END_DMAMUX_CHANNEL (BDMA_1_BEGIN_DMAMUX_CHANNEL + \ DT_PROP_OR(DT_NODELABEL(bdma1), dma_requests, 0)) -#define DEV_BDMA COND_CODE_1(DT_NODE_HAS_STATUS(DT_NODELABEL(bdma1), okay), \ +#define DEV_BDMA COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(bdma1)), \ DEVICE_DT_GET(DT_NODELABEL(bdma1)), NULL) #define DEV_DMA_BINDING(mux_channel) \ diff --git a/drivers/espi/espi_mchp_xec_host_v2.c b/drivers/espi/espi_mchp_xec_host_v2.c index 8cf4e085ed5f3..12d32007e84ba 100644 --- a/drivers/espi/espi_mchp_xec_host_v2.c +++ b/drivers/espi/espi_mchp_xec_host_v2.c @@ -108,7 +108,7 @@ static uint8_t ec_host_cmd_sram[CONFIG_ESPI_XEC_PERIPHERAL_HOST_CMD_PARAM_SIZE] #ifdef CONFIG_ESPI_PERIPHERAL_XEC_MAILBOX -BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_NODELABEL(mbox0), okay), +BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(mbox0)), "XEC mbox0 DT node is disabled!"); static struct xec_mbox_config { @@ -171,7 +171,7 @@ static int init_mbox0(const struct device *dev) #ifdef CONFIG_ESPI_PERIPHERAL_8042_KBC -BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_NODELABEL(kbc0), okay), +BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(kbc0)), "XEC kbc0 DT node is disabled!"); struct xec_kbc0_config { @@ -665,7 +665,7 @@ static int init_acpi_ec1(const struct device *dev) #ifdef CONFIG_ESPI_PERIPHERAL_EC_HOST_CMD -BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_NODELABEL(emi0), okay), +BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(emi0)), "XEC EMI0 DT node is disabled!"); struct xec_emi_config { diff --git a/drivers/ethernet/eth_stm32_hal.c b/drivers/ethernet/eth_stm32_hal.c index c151f1a0c1289..bc42515586010 100644 --- a/drivers/ethernet/eth_stm32_hal.c +++ b/drivers/ethernet/eth_stm32_hal.c @@ -50,7 +50,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #endif #if defined(CONFIG_ETH_STM32_HAL_USE_DTCM_FOR_DMA_BUFFER) && \ - !DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) + !DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) #error DTCM for DMA buffer is activated but zephyr,dtcm is not present in dts #endif @@ -91,7 +91,7 @@ static const struct device *eth_stm32_phy_dev = DEVICE_PHY_BY_NAME(0); #define ETH_DMA_TX_TIMEOUT_MS 20U /* transmit timeout in milliseconds */ #if defined(CONFIG_ETH_STM32_HAL_USE_DTCM_FOR_DMA_BUFFER) && \ - DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) + DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) #define __eth_stm32_desc __dtcm_noinit_section #define __eth_stm32_buf __dtcm_noinit_section #elif defined(CONFIG_SOC_SERIES_STM32H7X) diff --git a/drivers/ethernet/nxp_enet/eth_mcux.c b/drivers/ethernet/nxp_enet/eth_mcux.c index 2ac0296d6b281..397fa58bae146 100644 --- a/drivers/ethernet/nxp_enet/eth_mcux.c +++ b/drivers/ethernet/nxp_enet/eth_mcux.c @@ -149,7 +149,7 @@ static const char *eth_name(ENET_Type *base) switch ((int)base) { case DT_INST_REG_ADDR(0): return "ETH_0"; -#if DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(1)) case DT_INST_REG_ADDR(1): return "ETH_1"; #endif @@ -964,10 +964,10 @@ static void eth_mcux_init(const struct device *dev) context->phy_handle->ops = &phyksz8081_ops; #if defined(CONFIG_SOC_SERIES_IMXRT10XX) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet)) sys_clock = CLOCK_GetFreq(kCLOCK_IpgClk); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet2)) sys_clock = CLOCK_GetFreq(kCLOCK_EnetPll1Clk); #endif #elif defined(CONFIG_SOC_SERIES_IMXRT11XX) @@ -1350,7 +1350,7 @@ static void eth_mcux_err_isr(const struct device *dev) } while (false) #define ETH_MCUX_IRQ_PTP(n) \ - COND_CODE_1(DT_NODE_HAS_STATUS(PTP_INST_NODEID(n), okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(PTP_INST_NODEID(n)), \ (ETH_MCUX_IRQ_PTP_INIT(n)), \ (ETH_MCUX_NONE)) @@ -1454,7 +1454,7 @@ static void eth_mcux_err_isr(const struct device *dev) #define ETH_MCUX_PINCTRL_INIT(n) #endif -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) && \ +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) && \ CONFIG_ETH_MCUX_USE_DTCM_FOR_DMA_BUFFER /* Use DTCM for hardware DMA buffers */ #define _mcux_dma_desc __dtcm_bss_section diff --git a/drivers/ethernet/nxp_enet/eth_nxp_enet.c b/drivers/ethernet/nxp_enet/eth_nxp_enet.c index 255e8d1bd9b05..5f6d58ad12c36 100644 --- a/drivers/ethernet/nxp_enet/eth_nxp_enet.c +++ b/drivers/ethernet/nxp_enet/eth_nxp_enet.c @@ -855,7 +855,7 @@ static const struct ethernet_api api_funcs = { #define NXP_ENET_DT_PHY_DEV(node_id, phy_phandle, idx) \ DEVICE_DT_GET(DT_PHANDLE_BY_IDX(node_id, phy_phandle, idx)) -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) && \ +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) && \ CONFIG_ETH_NXP_ENET_USE_DTCM_FOR_DMA_BUFFER #define _nxp_enet_dma_desc_section __dtcm_bss_section #define _nxp_enet_dma_buffer_section __dtcm_noinit_section diff --git a/drivers/ethernet/phy/phy_adin2111.c b/drivers/ethernet/phy/phy_adin2111.c index 380def0ebe74c..902838bd08d22 100644 --- a/drivers/ethernet/phy/phy_adin2111.c +++ b/drivers/ethernet/phy/phy_adin2111.c @@ -7,7 +7,7 @@ #include -#if DT_NODE_HAS_STATUS(DT_INST(0, adi_adin2111_phy), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, adi_adin2111_phy)) #define DT_DRV_COMPAT adi_adin2111_phy #else #define DT_DRV_COMPAT adi_adin1100_phy diff --git a/drivers/flash/soc_flash_lpc.c b/drivers/flash/soc_flash_lpc.c index ae457fe926b7e..5f931a1bf7348 100644 --- a/drivers/flash/soc_flash_lpc.c +++ b/drivers/flash/soc_flash_lpc.c @@ -17,9 +17,9 @@ #include "fsl_flashiap.h" -#if DT_NODE_HAS_STATUS(DT_INST(0, nxp_iap_fmc11), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_iap_fmc11)) #define DT_DRV_COMPAT nxp_iap_fmc11 -#elif DT_NODE_HAS_STATUS(DT_INST(0, nxp_iap_fmc54), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_iap_fmc54)) #define DT_DRV_COMPAT nxp_iap_fmc54 #else #error No matching compatible for soc_flash_lpc.c diff --git a/drivers/flash/soc_flash_mcux.c b/drivers/flash/soc_flash_mcux.c index e4a9e8ff7de94..5cf62cfe65a57 100644 --- a/drivers/flash/soc_flash_mcux.c +++ b/drivers/flash/soc_flash_mcux.c @@ -22,19 +22,19 @@ LOG_MODULE_REGISTER(flash_mcux); -#if DT_NODE_HAS_STATUS(DT_INST(0, nxp_kinetis_ftfa), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_kinetis_ftfa)) #define DT_DRV_COMPAT nxp_kinetis_ftfa -#elif DT_NODE_HAS_STATUS(DT_INST(0, nxp_kinetis_ftfe), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_kinetis_ftfe)) #define DT_DRV_COMPAT nxp_kinetis_ftfe -#elif DT_NODE_HAS_STATUS(DT_INST(0, nxp_kinetis_ftfl), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_kinetis_ftfl)) #define DT_DRV_COMPAT nxp_kinetis_ftfl -#elif DT_NODE_HAS_STATUS(DT_INST(0, nxp_iap_fmc55), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_iap_fmc55)) #define DT_DRV_COMPAT nxp_iap_fmc55 #define SOC_HAS_IAP 1 -#elif DT_NODE_HAS_STATUS(DT_INST(0, nxp_iap_fmc553), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_iap_fmc553)) #define DT_DRV_COMPAT nxp_iap_fmc553 #define SOC_HAS_IAP 1 -#elif DT_NODE_HAS_STATUS(DT_INST(0, nxp_iap_msf1), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_iap_msf1)) #define DT_DRV_COMPAT nxp_iap_msf1 #define SOC_HAS_IAP_MSF1 1 #else diff --git a/drivers/flash/soc_flash_nrf.c b/drivers/flash/soc_flash_nrf.c index c15722082a341..5ed86b724ff69 100644 --- a/drivers/flash/soc_flash_nrf.c +++ b/drivers/flash/soc_flash_nrf.c @@ -23,13 +23,13 @@ #include LOG_MODULE_REGISTER(flash_nrf); -#if DT_NODE_HAS_STATUS(DT_INST(0, nordic_nrf51_flash_controller), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nordic_nrf51_flash_controller)) #define DT_DRV_COMPAT nordic_nrf51_flash_controller -#elif DT_NODE_HAS_STATUS(DT_INST(0, nordic_nrf52_flash_controller), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nordic_nrf52_flash_controller)) #define DT_DRV_COMPAT nordic_nrf52_flash_controller -#elif DT_NODE_HAS_STATUS(DT_INST(0, nordic_nrf53_flash_controller), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nordic_nrf53_flash_controller)) #define DT_DRV_COMPAT nordic_nrf53_flash_controller -#elif DT_NODE_HAS_STATUS(DT_INST(0, nordic_nrf91_flash_controller), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nordic_nrf91_flash_controller)) #define DT_DRV_COMPAT nordic_nrf91_flash_controller #else #error No matching compatible for soc_flash_nrf.c diff --git a/drivers/gpio/gpio_esp32.c b/drivers/gpio/gpio_esp32.c index ea12070235e9c..d0c933ca37df1 100644 --- a/drivers/gpio/gpio_esp32.c +++ b/drivers/gpio/gpio_esp32.c @@ -284,7 +284,7 @@ static int gpio_esp32_port_get_raw(const struct device *port, uint32_t *value) if (cfg->gpio_port == 0) { *value = cfg->gpio_dev->in; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) } else { *value = cfg->gpio_dev->in1.data; #endif @@ -302,7 +302,7 @@ static int gpio_esp32_port_set_masked_raw(const struct device *port, if (cfg->gpio_port == 0) { cfg->gpio_dev->out = (cfg->gpio_dev->out & ~mask) | (mask & value); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) } else { cfg->gpio_dev->out1.data = (cfg->gpio_dev->out1.data & ~mask) | (mask & value); #endif @@ -320,7 +320,7 @@ static int gpio_esp32_port_set_bits_raw(const struct device *port, if (cfg->gpio_port == 0) { cfg->gpio_dev->out_w1ts = pins; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) } else { cfg->gpio_dev->out1_w1ts.data = pins; #endif @@ -336,7 +336,7 @@ static int gpio_esp32_port_clear_bits_raw(const struct device *port, if (cfg->gpio_port == 0) { cfg->gpio_dev->out_w1tc = pins; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) } else { cfg->gpio_dev->out1_w1tc.data = pins; #endif @@ -353,7 +353,7 @@ static int gpio_esp32_port_toggle_bits(const struct device *port, if (cfg->gpio_port == 0) { cfg->gpio_dev->out ^= pins; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) } else { cfg->gpio_dev->out1.data ^= pins; #endif @@ -531,11 +531,11 @@ static void IRAM_ATTR gpio_esp32_isr(void *param) { ARG_UNUSED(param); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0)) gpio_esp32_fire_callbacks(DEVICE_DT_INST_GET(0)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) gpio_esp32_fire_callbacks(DEVICE_DT_INST_GET(1)); #endif } diff --git a/drivers/gpio/gpio_gd32.c b/drivers/gpio/gpio_gd32.c index 744f5e4a7768d..1c40be4de4c5a 100644 --- a/drivers/gpio/gpio_gd32.c +++ b/drivers/gpio/gpio_gd32.c @@ -365,7 +365,7 @@ static int gpio_gd32_init(const struct device *port) }, \ .reg = DT_INST_REG_ADDR(n), \ .clkid = DT_INST_CLOCKS_CELL(n, id), \ - COND_CODE_1(DT_NODE_HAS_STATUS(SYSCFG_NODE, okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(SYSCFG_NODE), \ (.clkid_exti = DT_CLOCKS_CELL(SYSCFG_NODE, id),), \ (.clkid_exti = DT_CLOCKS_CELL(AFIO_NODE, id),)) \ .reset = RESET_DT_SPEC_INST_GET(n), \ diff --git a/drivers/gpio/gpio_lpc11u6x.c b/drivers/gpio/gpio_lpc11u6x.c index a44deceed9bb7..102d8c3e8b619 100644 --- a/drivers/gpio/gpio_lpc11u6x.c +++ b/drivers/gpio/gpio_lpc11u6x.c @@ -459,21 +459,21 @@ static void gpio_lpc11u6x_isr(const void *arg) } } /* For each port with active pins, fire the GPIO interrupt callbacks. */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0)) if (pins[0]) { port = DEVICE_DT_GET(DT_NODELABEL(gpio0)); data = port->data; gpio_fire_callbacks(&data->cb_list, port, pins[0]); } #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) if (pins[1]) { port = DEVICE_DT_GET(DT_NODELABEL(gpio1)); data = port->data; gpio_fire_callbacks(&data->cb_list, port, pins[1]); } #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio2)) if (pins[2]) { port = DEVICE_DT_GET(DT_NODELABEL(gpio2)); data = port->data; @@ -589,14 +589,14 @@ DEVICE_DT_DEFINE(DT_NODELABEL(gpio##id), \ PRE_KERNEL_2, CONFIG_GPIO_INIT_PRIORITY, \ &gpio_lpc11u6x_driver_api) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0)) GPIO_LPC11U6X_INIT(0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) GPIO_LPC11U6X_INIT(1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio2)) GPIO_LPC11U6X_INIT(2); #endif diff --git a/drivers/gpio/gpio_mchp_xec.c b/drivers/gpio/gpio_mchp_xec.c index 86d9f2a5d7a55..e96130a094160 100644 --- a/drivers/gpio/gpio_mchp_xec.c +++ b/drivers/gpio/gpio_mchp_xec.c @@ -341,7 +341,7 @@ static const struct gpio_driver_api gpio_xec_driver_api = { .manage_callback = gpio_xec_manage_callback, }; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_000_036), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_000_036)) static int gpio_xec_port000_036_init(const struct device *dev); static const struct gpio_xec_config gpio_xec_port000_036_config = { @@ -385,9 +385,9 @@ static int gpio_xec_port000_036_init(const struct device *dev) #endif return 0; } -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_000_036), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_000_036)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_040_076), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_040_076)) static int gpio_xec_port040_076_init(const struct device *dev); static const struct gpio_xec_config gpio_xec_port040_076_config = { @@ -431,9 +431,9 @@ static int gpio_xec_port040_076_init(const struct device *dev) #endif return 0; } -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_040_076), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_040_076)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_100_136), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_100_136)) static int gpio_xec_port100_136_init(const struct device *dev); static const struct gpio_xec_config gpio_xec_port100_136_config = { @@ -477,9 +477,9 @@ static int gpio_xec_port100_136_init(const struct device *dev) #endif return 0; } -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_100_136), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_100_136)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_140_176), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_140_176)) static int gpio_xec_port140_176_init(const struct device *dev); static const struct gpio_xec_config gpio_xec_port140_176_config = { @@ -523,9 +523,9 @@ static int gpio_xec_port140_176_init(const struct device *dev) #endif return 0; } -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_140_176), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_140_176)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_200_236), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_200_236)) static int gpio_xec_port200_236_init(const struct device *dev); static const struct gpio_xec_config gpio_xec_port200_236_config = { @@ -569,9 +569,9 @@ static int gpio_xec_port200_236_init(const struct device *dev) #endif return 0; } -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_200_236), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_200_236)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_240_276), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_240_276)) static int gpio_xec_port240_276_init(const struct device *dev); static const struct gpio_xec_config gpio_xec_port240_276_config = { @@ -615,4 +615,4 @@ static int gpio_xec_port240_276_init(const struct device *dev) #endif return 0; } -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpio_240_276), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio_240_276)) */ diff --git a/drivers/gpio/gpio_nrfx.c b/drivers/gpio/gpio_nrfx.c index d89c964cc90a8..151cf1a830c5c 100644 --- a/drivers/gpio/gpio_nrfx.c +++ b/drivers/gpio/gpio_nrfx.c @@ -446,7 +446,7 @@ static const struct gpio_driver_api gpio_nrfx_drv_api_funcs = { #define GPIOTE_CHECK(id) \ COND_CODE_1(DT_INST_NODE_HAS_PROP(id, gpiote_instance), \ - (BUILD_ASSERT(DT_NODE_HAS_STATUS(GPIOTE_PHANDLE(id), okay), \ + (BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(GPIOTE_PHANDLE(id)), \ "Please enable GPIOTE instance for used GPIO port!")), \ ()) diff --git a/drivers/gpio/gpio_nxp_s32.c b/drivers/gpio/gpio_nxp_s32.c index e9bcc29c907cf..5e9e7a5547121 100644 --- a/drivers/gpio/gpio_nxp_s32.c +++ b/drivers/gpio/gpio_nxp_s32.c @@ -519,7 +519,7 @@ static const struct gpio_driver_api gpio_nxp_s32_driver_api = { DT_NODE_HAS_PROP(DT_DRV_INST(n), interrupts)), \ "interrupts and interrupt-parent must be set when " \ "using external interrupts"); \ - IF_ENABLED(DT_NODE_HAS_STATUS(GPIO_NXP_S32_EIRQ_NODE(n), okay), ( \ + IF_ENABLED(DT_NODE_HAS_STATUS_OKAY(GPIO_NXP_S32_EIRQ_NODE(n)), ( \ static uint8_t gpio_nxp_s32_eirq_data_##n[] = { \ LISTIFY(DT_NUM_IRQS(DT_DRV_INST(n)), \ GPIO_NXP_S32_EIRQ_PIN_LINE, (,), n) \ @@ -533,7 +533,7 @@ static const struct gpio_driver_api gpio_nxp_s32_driver_api = { )) #define GPIO_NXP_S32_GET_EIRQ_INFO(n) \ - .eirq_info = UTIL_AND(DT_NODE_HAS_STATUS(GPIO_NXP_S32_EIRQ_NODE(n), okay),\ + .eirq_info = UTIL_AND(DT_NODE_HAS_STATUS_OKAY(GPIO_NXP_S32_EIRQ_NODE(n)),\ &gpio_nxp_s32_eirq_##n), #else #define GPIO_NXP_S32_SET_EIRQ_INFO(n) @@ -547,7 +547,7 @@ static const struct gpio_driver_api gpio_nxp_s32_driver_api = { BUILD_ASSERT((DT_INST_NODE_HAS_PROP(n, nxp_wkpu) == \ DT_INST_NODE_HAS_PROP(n, nxp_wkpu_interrupts)), \ "nxp,wkpu and nxp,wkpu-interrupts must be provided"); \ - IF_ENABLED(DT_NODE_HAS_STATUS(GPIO_NXP_S32_WKPU_NODE(n), okay), ( \ + IF_ENABLED(DT_NODE_HAS_STATUS_OKAY(GPIO_NXP_S32_WKPU_NODE(n)), ( \ static uint8_t gpio_nxp_s32_wkpu_data_##n[] = \ DT_INST_PROP(n, nxp_wkpu_interrupts); \ static struct gpio_nxp_s32_irq_config gpio_nxp_s32_wkpu_##n = { \ @@ -560,7 +560,7 @@ static const struct gpio_driver_api gpio_nxp_s32_driver_api = { )) #define GPIO_NXP_S32_GET_WKPU_INFO(n) \ - .wkpu_info = UTIL_AND(DT_NODE_HAS_STATUS(GPIO_NXP_S32_WKPU_NODE(n), okay),\ + .wkpu_info = UTIL_AND(DT_NODE_HAS_STATUS_OKAY(GPIO_NXP_S32_WKPU_NODE(n)),\ &gpio_nxp_s32_wkpu_##n) #else #define GPIO_NXP_S32_SET_WKPU_INFO(n) diff --git a/drivers/gpio/gpio_renesas_ra_ioport.c b/drivers/gpio/gpio_renesas_ra_ioport.c index 8005acab36073..65fc946438a22 100644 --- a/drivers/gpio/gpio_renesas_ra_ioport.c +++ b/drivers/gpio/gpio_renesas_ra_ioport.c @@ -176,7 +176,7 @@ static const struct gpio_driver_api gpio_ra_drv_api_funcs = { DT_REG_ADDR(DT_NODELABEL(ioport##suffix))) #define GPIO_DEVICE_INIT_RA_IF_OKAY(suffix) \ - COND_CODE_1(DT_NODE_HAS_STATUS(DT_NODELABEL(ioport##suffix), okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ioport##suffix)), \ (GPIO_DEVICE_INIT_RA(suffix)), \ ()) diff --git a/drivers/gpio/gpio_sam0.c b/drivers/gpio/gpio_sam0.c index 03cfab48e600b..98234d3319d82 100644 --- a/drivers/gpio/gpio_sam0.c +++ b/drivers/gpio/gpio_sam0.c @@ -286,7 +286,7 @@ static const struct gpio_driver_api gpio_sam0_api = { static int gpio_sam0_init(const struct device *dev) { return 0; } /* Port A */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(porta), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(porta)) static const struct gpio_sam0_config gpio_sam0_config_0 = { .common = { @@ -308,7 +308,7 @@ DEVICE_DT_DEFINE(DT_NODELABEL(porta), #endif /* Port B */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(portb), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(portb)) static const struct gpio_sam0_config gpio_sam0_config_1 = { .common = { @@ -330,7 +330,7 @@ DEVICE_DT_DEFINE(DT_NODELABEL(portb), #endif /* Port C */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(portc), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(portc)) static const struct gpio_sam0_config gpio_sam0_config_2 = { .common = { @@ -352,7 +352,7 @@ DEVICE_DT_DEFINE(DT_NODELABEL(portc), #endif /* Port D */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(portd), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(portd)) static const struct gpio_sam0_config gpio_sam0_config_3 = { .common = { diff --git a/drivers/gpio/gpio_stm32.c b/drivers/gpio/gpio_stm32.c index d077f54e64d3a..d341612aaac66 100644 --- a/drivers/gpio/gpio_stm32.c +++ b/drivers/gpio/gpio_stm32.c @@ -702,7 +702,7 @@ static int gpio_stm32_init(const struct device *dev) } #if (defined(PWR_CR2_IOSV) || defined(PWR_SVMCR_IO2SV)) && \ - DT_NODE_HAS_STATUS(DT_NODELABEL(gpiog), okay) + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpiog)) z_stm32_hsem_lock(CFG_HW_RCC_SEMID, HSEM_LOCK_DEFAULT_RETRY); /* Port G[15:2] requires external power supply */ /* Cf: L4/L5 RM, Chapter "Independent I/O supply rail" */ @@ -752,7 +752,7 @@ static int gpio_stm32_init(const struct device *dev) DT_CLOCKS_CELL(DT_NODELABEL(gpio##__suffix), bus)) #define GPIO_DEVICE_INIT_STM32_IF_OKAY(__suffix, __SUFFIX) \ - COND_CODE_1(DT_NODE_HAS_STATUS(DT_NODELABEL(gpio##__suffix), okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio##__suffix)), \ (GPIO_DEVICE_INIT_STM32(__suffix, __SUFFIX)), \ ()) diff --git a/drivers/gpio/gpio_xlnx_axi.c b/drivers/gpio/gpio_xlnx_axi.c index 4b50bf85cd6ec..3b1238310f998 100644 --- a/drivers/gpio/gpio_xlnx_axi.c +++ b/drivers/gpio/gpio_xlnx_axi.c @@ -382,7 +382,7 @@ static const struct gpio_driver_api gpio_xlnx_axi_driver_api = { #define GPIO_XLNX_AXI_GPIO2_HAS_COMPAT_STATUS_OKAY(n) \ UTIL_AND(DT_NODE_HAS_COMPAT(DT_INST_CHILD(n, gpio2), xlnx_xps_gpio_1_00_a_gpio2), \ - DT_NODE_HAS_STATUS(DT_INST_CHILD(n, gpio2), okay)) + DT_NODE_HAS_STATUS_OKAY(DT_INST_CHILD(n, gpio2))) #define GPIO_XLNX_AXI_GPIO2_COND_INIT(n) \ IF_ENABLED(UTIL_AND(DT_INST_PROP_OR(n, xlnx_is_dual, 1), \ diff --git a/drivers/i2c/i2c_esp32.c b/drivers/i2c/i2c_esp32.c index 3c1381722090e..07c8ea536caf6 100644 --- a/drivers/i2c/i2c_esp32.c +++ b/drivers/i2c/i2c_esp32.c @@ -843,7 +843,7 @@ static int IRAM_ATTR i2c_esp32_init(const struct device *dev) &i2c_esp32_config_##idx, POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ &i2c_esp32_driver_api); -#if DT_NODE_HAS_STATUS(I2C(0), okay) +#if DT_NODE_HAS_STATUS_OKAY(I2C(0)) #ifndef SOC_I2C_SUPPORT_HW_CLR_BUS #if !DT_NODE_HAS_PROP(I2C(0), sda_gpios) || !DT_NODE_HAS_PROP(I2C(0), scl_gpios) #error "Missing and properties to build for this target." @@ -854,9 +854,9 @@ static int IRAM_ATTR i2c_esp32_init(const struct device *dev) #endif #endif /* !SOC_I2C_SUPPORT_HW_CLR_BUS */ ESP32_I2C_INIT(0); -#endif /* DT_NODE_HAS_STATUS(I2C(0), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(I2C(0)) */ -#if DT_NODE_HAS_STATUS(I2C(1), okay) +#if DT_NODE_HAS_STATUS_OKAY(I2C(1)) #ifndef SOC_I2C_SUPPORT_HW_CLR_BUS #if !DT_NODE_HAS_PROP(I2C(1), sda_gpios) || !DT_NODE_HAS_PROP(I2C(1), scl_gpios) #error "Missing and properties to build for this target." @@ -867,4 +867,4 @@ ESP32_I2C_INIT(0); #endif #endif /* !SOC_I2C_SUPPORT_HW_CLR_BUS */ ESP32_I2C_INIT(1); -#endif /* DT_NODE_HAS_STATUS(I2C(1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(I2C(1)) */ diff --git a/drivers/i2s/i2s_litex.c b/drivers/i2s/i2s_litex.c index e66eaed7972c0..6105804d8ceed 100644 --- a/drivers/i2s/i2s_litex.c +++ b/drivers/i2s/i2s_litex.c @@ -634,9 +634,9 @@ static const struct i2s_driver_api i2s_litex_driver_api = { irq_enable(DT_IRQN(DT_NODELABEL(i2s_##dir))); \ } -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2s_rx), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2s_rx)) I2S_INIT(rx); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2s_tx), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2s_tx)) I2S_INIT(tx); #endif diff --git a/drivers/interrupt_controller/intc_mchp_ecia_xec.c b/drivers/interrupt_controller/intc_mchp_ecia_xec.c index f1fc0f8c28b70..c4844643ccbff 100644 --- a/drivers/interrupt_controller/intc_mchp_ecia_xec.c +++ b/drivers/interrupt_controller/intc_mchp_ecia_xec.c @@ -445,7 +445,7 @@ int mchp_ecia_info_unset_callback(int ecia_info) * Leaving a node disabled also allows another driver/application to take over * aggregation by managing the GIRQ itself. */ -#define XEC_CHK_REQ_AGGR(n) DT_NODE_HAS_STATUS(n, okay) | +#define XEC_CHK_REQ_AGGR(n) DT_NODE_HAS_STATUS_OKAY(n) | #define XEC_ECIA_REQUIRE_AGGR_ISR \ ( \ diff --git a/drivers/led_strip/lpd880x.c b/drivers/led_strip/lpd880x.c index 991e2e3fb57e9..d4b56509db1b8 100644 --- a/drivers/led_strip/lpd880x.c +++ b/drivers/led_strip/lpd880x.c @@ -9,7 +9,7 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_INST(0, greeled_lpd8806), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, greeled_lpd8806)) #define DT_DRV_COMPAT greeled_lpd8806 #else #define DT_DRV_COMPAT greeled_lpd8803 diff --git a/drivers/lora/shell.c b/drivers/lora/shell.c index 692446b06cf6a..7d3775c9d5c35 100644 --- a/drivers/lora/shell.c +++ b/drivers/lora/shell.c @@ -13,7 +13,7 @@ LOG_MODULE_REGISTER(lora_shell, CONFIG_LORA_LOG_LEVEL); #define DEFAULT_RADIO_NODE DT_ALIAS(lora0) -BUILD_ASSERT(DT_NODE_HAS_STATUS(DEFAULT_RADIO_NODE, okay), +BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DEFAULT_RADIO_NODE), "No default LoRa radio specified in DT"); static struct lora_modem_config modem_config = { diff --git a/drivers/memc/memc_nxp_s32_qspi.c b/drivers/memc/memc_nxp_s32_qspi.c index f588a0bd9af76..e1d5c60bd67d7 100644 --- a/drivers/memc/memc_nxp_s32_qspi.c +++ b/drivers/memc/memc_nxp_s32_qspi.c @@ -139,7 +139,7 @@ uint8_t memc_nxp_s32_qspi_get_instance(const struct device *dev) #define QSPI_PORT_SIZE_FN(node_id, side_upper, port) \ COND_CODE_1(IS_EQ(DT_REG_ADDR(node_id), QSPI_PCSF##side_upper##port), \ - (COND_CODE_1(DT_NODE_HAS_STATUS(node_id, okay), \ + (COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(node_id), \ (.memSize##side_upper##port = DT_PROP(node_id, size) / 8,), \ (.memSize##side_upper##port = 0,))), \ (EMPTY)) diff --git a/drivers/pinctrl/pinctrl_esp32.c b/drivers/pinctrl/pinctrl_esp32.c index 89c1ba43b414f..4ed39229d5625 100644 --- a/drivers/pinctrl/pinctrl_esp32.c +++ b/drivers/pinctrl/pinctrl_esp32.c @@ -254,7 +254,7 @@ static int esp32_pin_configure(const uint32_t pin_mux, const uint32_t pin_cfg) gpio_dev_t *const gpio_dev = (gpio_dev_t *)DT_REG_ADDR(DT_NODELABEL(gpio0)); gpio_dev->out_w1ts = BIT(pin_num); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) } else { gpio_dev_t *const gpio_dev = (gpio_dev_t *)DT_REG_ADDR(DT_NODELABEL(gpio1)); @@ -268,7 +268,7 @@ static int esp32_pin_configure(const uint32_t pin_mux, const uint32_t pin_cfg) gpio_dev_t *const gpio_dev = (gpio_dev_t *)DT_REG_ADDR(DT_NODELABEL(gpio0)); gpio_dev->out_w1tc = BIT(pin_num); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) } else { gpio_dev_t *const gpio_dev = (gpio_dev_t *)DT_REG_ADDR(DT_NODELABEL(gpio1)); diff --git a/drivers/pinctrl/pinctrl_ite_it8xxx2.c b/drivers/pinctrl/pinctrl_ite_it8xxx2.c index 91ca93ea293ea..422f8c6c67ff9 100644 --- a/drivers/pinctrl/pinctrl_ite_it8xxx2.c +++ b/drivers/pinctrl/pinctrl_ite_it8xxx2.c @@ -366,7 +366,7 @@ static int pinctrl_it8xxx2_init(const struct device *dev) gpio_base->GPIO_GCR &= ~IT8XXX2_GPIO_LPCRSTEN; #ifdef CONFIG_SOC_IT8XXX2_REG_SET_V2 -#if defined(CONFIG_I2C_ITE_ENHANCE) && DT_NODE_HAS_STATUS(DT_NODELABEL(i2c5), okay) +#if defined(CONFIG_I2C_ITE_ENHANCE) && DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c5)) const struct gpio_dt_spec scl_gpios = GPIO_DT_SPEC_GET(DT_NODELABEL(i2c5), scl_gpios); const struct gpio_dt_spec sda_gpios = GPIO_DT_SPEC_GET(DT_NODELABEL(i2c5), sda_gpios); diff --git a/drivers/pinctrl/pinctrl_kinetis.c b/drivers/pinctrl/pinctrl_kinetis.c index 7a8151c7be166..bc250d742cf3f 100644 --- a/drivers/pinctrl/pinctrl_kinetis.c +++ b/drivers/pinctrl/pinctrl_kinetis.c @@ -75,7 +75,7 @@ static int pinctrl_mcux_init(const struct device *dev) return 0; } -#if DT_NODE_HAS_STATUS(DT_INST(0, nxp_kinetis_sim), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_kinetis_sim)) #define PINCTRL_MCUX_DT_INST_CLOCK_SUBSYS(n) \ CLK_GATE_DEFINE(DT_INST_CLOCKS_CELL(n, offset), DT_INST_CLOCKS_CELL(n, bits)) #elif DT_HAS_COMPAT_STATUS_OKAY(nxp_scg_k4) diff --git a/drivers/rtc/rtc_smartbond.c b/drivers/rtc/rtc_smartbond.c index 7aa0d461d2733..3d171e58f6943 100644 --- a/drivers/rtc/rtc_smartbond.c +++ b/drivers/rtc/rtc_smartbond.c @@ -626,7 +626,7 @@ static int rtc_smartbond_init(const struct device *dev) /* Wakeup device from RTC events (alarm/roll over) */ #if CONFIG_PM - bool is_xtal32m_enabled = DT_NODE_HAS_STATUS(DT_NODELABEL(xtal32m), okay); + bool is_xtal32m_enabled = DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(xtal32m)); int pdc_idx = da1469x_pdc_add(MCU_PDC_TRIGGER_RTC_ALARM, MCU_PDC_MASTER_M33, is_xtal32m_enabled ? MCU_PDC_EN_XTAL : 0); diff --git a/drivers/sensor/bosch/bmi08x/bmi08x.h b/drivers/sensor/bosch/bmi08x/bmi08x.h index 6b8b33f8ec72c..83926126e4844 100644 --- a/drivers/sensor/bosch/bmi08x/bmi08x.h +++ b/drivers/sensor/bosch/bmi08x/bmi08x.h @@ -427,7 +427,7 @@ enum bmi08x_odr { #define BMI08X_GYR_SCALE(range_dps) ((2 * range_dps * SENSOR_PI) / 180LL / 65536LL) /* report of data sync is selected */ -#define BMI08X_ACCEL_DATA_SYNC_EN(inst) DT_NODE_HAS_STATUS(DT_INST_PHANDLE(inst, data_sync), okay) +#define BMI08X_ACCEL_DATA_SYNC_EN(inst) DT_NODE_HAS_STATUS_OKAY(DT_INST_PHANDLE(inst, data_sync)) /* Macro used for compile time optimization to compile in/out code used for data-sync * if at least 1 bmi08x has data-sync enabled */ diff --git a/drivers/sensor/st/stm32_temp/stm32_temp.c b/drivers/sensor/st/stm32_temp/stm32_temp.c index 0c9e90b2d1897..76e502bcfaeaf 100644 --- a/drivers/sensor/st/stm32_temp/stm32_temp.c +++ b/drivers/sensor/st/stm32_temp/stm32_temp.c @@ -287,7 +287,7 @@ static int stm32_temp_init(const struct device *dev) * this driver even if the ADC used for measurement is disabled. In such cases, * fail build with an explicit error message. */ -#if !DT_NODE_HAS_STATUS(DT_INST_IO_CHANNELS_CTLR(0), okay) +#if !DT_NODE_HAS_STATUS_OKAY(DT_INST_IO_CHANNELS_CTLR(0)) /* Use BUILD_ASSERT to get preprocessing on the message */ BUILD_ASSERT(0, "ADC '" DT_NODE_FULL_NAME(DT_INST_IO_CHANNELS_CTLR(0)) "' needed by " @@ -334,4 +334,4 @@ SENSOR_DEVICE_DT_INST_DEFINE(0, stm32_temp_init, NULL, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &stm32_temp_driver_api); -#endif /* !DT_NODE_HAS_STATUS(DT_INST_IO_CHANNELS_CTLR(0), okay) */ +#endif /* !DT_NODE_HAS_STATUS_OKAY(DT_INST_IO_CHANNELS_CTLR(0)) */ diff --git a/drivers/sensor/st/stm32_vbat/stm32_vbat.c b/drivers/sensor/st/stm32_vbat/stm32_vbat.c index b74e0cf8b7f6b..98bebad37faec 100644 --- a/drivers/sensor/st/stm32_vbat/stm32_vbat.c +++ b/drivers/sensor/st/stm32_vbat/stm32_vbat.c @@ -125,7 +125,7 @@ static int stm32_vbat_init(const struct device *dev) } #define ASSERT_VBAT_ADC_ENABLED(inst) \ - BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_INST_IO_CHANNELS_CTLR(inst), okay), \ + BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DT_INST_IO_CHANNELS_CTLR(inst)), \ "ADC instance '" DT_NODE_FULL_NAME(DT_INST_IO_CHANNELS_CTLR(inst)) "' needed " \ "by Vbat sensor '" DT_NODE_FULL_NAME(DT_DRV_INST(inst)) "' is not enabled") diff --git a/drivers/sensor/st/stm32_vref/stm32_vref.c b/drivers/sensor/st/stm32_vref/stm32_vref.c index b2cf7222fadb0..b76c2ea0e6ec6 100644 --- a/drivers/sensor/st/stm32_vref/stm32_vref.c +++ b/drivers/sensor/st/stm32_vref/stm32_vref.c @@ -154,7 +154,7 @@ static int stm32_vref_init(const struct device *dev) * possible to compile this driver even if the ADC used for measurement is * disabled. In such cases, fail build with an explicit error message. */ -#if !DT_NODE_HAS_STATUS(DT_INST_IO_CHANNELS_CTLR(0), okay) +#if !DT_NODE_HAS_STATUS_OKAY(DT_INST_IO_CHANNELS_CTLR(0)) /* Use BUILD_ASSERT to get preprocessing on the message */ BUILD_ASSERT(0, "ADC '" DT_NODE_FULL_NAME(DT_INST_IO_CHANNELS_CTLR(0)) "' needed by " @@ -183,4 +183,4 @@ static const struct stm32_vref_config stm32_vref_dev_config = { SENSOR_DEVICE_DT_INST_DEFINE(0, stm32_vref_init, NULL, &stm32_vref_dev_data, &stm32_vref_dev_config, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &stm32_vref_driver_api); -#endif /* !DT_NODE_HAS_STATUS(DT_INST_IO_CHANNELS_CTLR(0), okay) */ +#endif /* !DT_NODE_HAS_STATUS_OKAY(DT_INST_IO_CHANNELS_CTLR(0)) */ diff --git a/drivers/serial/leuart_gecko.c b/drivers/serial/leuart_gecko.c index daaff59069c7e..9eec982802c15 100644 --- a/drivers/serial/leuart_gecko.c +++ b/drivers/serial/leuart_gecko.c @@ -317,7 +317,7 @@ static const struct uart_driver_api leuart_gecko_driver_api = { #endif }; -#if DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) #define PIN_LEUART_0_RXD {DT_INST_PROP_BY_IDX(0, location_rx, 1), \ DT_INST_PROP_BY_IDX(0, location_rx, 2), gpioModeInput, 1} @@ -368,9 +368,9 @@ static void leuart_gecko_config_func_0(const struct device *dev) } #endif -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) */ -#if DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(1)) #define PIN_LEUART_1_RXD {DT_INST_PROP_BY_IDX(1, location_rx, 1), \ DT_INST_PROP_BY_IDX(1, location_rx, 2), gpioModeInput, 1} @@ -421,4 +421,4 @@ static void leuart_gecko_config_func_1(const struct device *dev) } #endif -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(1)) */ diff --git a/drivers/serial/uart_cmsdk_apb.c b/drivers/serial/uart_cmsdk_apb.c index a6568133b7248..e4ceb883bd624 100644 --- a/drivers/serial/uart_cmsdk_apb.c +++ b/drivers/serial/uart_cmsdk_apb.c @@ -475,7 +475,7 @@ static const struct uart_driver_api uart_cmsdk_apb_driver_api = { #endif /* CONFIG_UART_INTERRUPT_DRIVEN */ }; -#if DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void uart_cmsdk_apb_irq_config_func_0(const struct device *dev); @@ -538,9 +538,9 @@ static void uart_cmsdk_apb_irq_config_func_0(const struct device *dev) #endif #endif -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) */ -#if DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(1)) #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void uart_cmsdk_apb_irq_config_func_1(const struct device *dev); @@ -603,9 +603,9 @@ static void uart_cmsdk_apb_irq_config_func_1(const struct device *dev) #endif #endif -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(1)) */ -#if DT_NODE_HAS_STATUS(DT_DRV_INST(2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(2)) #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void uart_cmsdk_apb_irq_config_func_2(const struct device *dev); @@ -668,9 +668,9 @@ static void uart_cmsdk_apb_irq_config_func_2(const struct device *dev) #endif #endif -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(2), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(2)) */ -#if DT_NODE_HAS_STATUS(DT_DRV_INST(3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(3)) #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void uart_cmsdk_apb_irq_config_func_3(const struct device *dev); @@ -733,9 +733,9 @@ static void uart_cmsdk_apb_irq_config_func_3(const struct device *dev) #endif #endif -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(3), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(3)) */ -#if DT_NODE_HAS_STATUS(DT_DRV_INST(4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(4)) #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void uart_cmsdk_apb_irq_config_func_4(const struct device *dev); @@ -798,4 +798,4 @@ static void uart_cmsdk_apb_irq_config_func_4(const struct device *dev) #endif #endif -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(4), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(4)) */ diff --git a/drivers/serial/uart_lpc11u6x.c b/drivers/serial/uart_lpc11u6x.c index 5645fb7910b4f..3a13850429fd5 100644 --- a/drivers/serial/uart_lpc11u6x.c +++ b/drivers/serial/uart_lpc11u6x.c @@ -13,7 +13,7 @@ #include "uart_lpc11u6x.h" -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart0)) static int lpc11u6x_uart0_poll_in(const struct device *dev, unsigned char *c) { const struct lpc11u6x_uart0_config *cfg = dev->config; @@ -443,12 +443,12 @@ static void lpc11u6x_uart0_isr_config(const struct device *dev) } #endif /* CONFIG_UART_INTERRUPT_DRIVEN */ -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart0), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart0)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) static int lpc11u6x_uartx_poll_in(const struct device *dev, unsigned char *c) { @@ -810,18 +810,18 @@ static int lpc11u6x_uartx_init(const struct device *dev) LPC11U6X_UARTX_CFG_ENABLE; #ifdef CONFIG_UART_INTERRUPT_DRIVEN -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) lpc11u6x_uartx_isr_config_1(dev); -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) || - * DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) || + * DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) lpc11u6x_uartx_isr_config_2(dev); -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) || - * DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) || + * DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) */ #endif /* CONFIG_UART_INTERRUPT_DRIVEN */ return 0; @@ -876,44 +876,44 @@ DEVICE_DT_DEFINE(DT_NODELABEL(uart##idx), \ PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ &uartx_api) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) LPC11U6X_UARTX_INIT(1); -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) LPC11U6X_UARTX_INIT(2); -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) LPC11U6X_UARTX_INIT(3); -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) LPC11U6X_UARTX_INIT(4); -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) */ #if CONFIG_UART_INTERRUPT_DRIVEN && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4))) struct lpc11u6x_uartx_shared_irq lpc11u6x_uartx_shared_irq_info_1 = { .devices = { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) DEVICE_DT_GET(DT_NODELABEL(uart1)), #else NULL, -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) */ +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) DEVICE_DT_GET(DT_NODELABEL(uart4)), #else NULL, -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) */ }, }; static void lpc11u6x_uartx_isr_config_1(const struct device *dev) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) IRQ_CONNECT(DT_IRQN(DT_NODELABEL(uart1)), DT_IRQ(DT_NODELABEL(uart1), priority), lpc11u6x_uartx_shared_isr, @@ -927,34 +927,34 @@ static void lpc11u6x_uartx_isr_config_1(const struct device *dev) &lpc11u6x_uartx_shared_irq_info_1, 0); irq_enable(DT_IRQN(DT_NODELABEL(uart4))); -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) */ } #endif /* CONFIG_UART_INTERRUPT_DRIVEN && - * (DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) || - * DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay)) + * (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) || + * DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4))) */ #if CONFIG_UART_INTERRUPT_DRIVEN && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3))) struct lpc11u6x_uartx_shared_irq lpc11u6x_uartx_shared_irq_info_2 = { .devices = { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) DEVICE_DT_GET(DT_NODELABEL(uart2)), #else NULL, -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) */ +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) DEVICE_DT_GET(DT_NODELABEL(uart3)), #else NULL, -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) */ }, }; static void lpc11u6x_uartx_isr_config_2(const struct device *dev) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) IRQ_CONNECT(DT_IRQN(DT_NODELABEL(uart2)), DT_IRQ(DT_NODELABEL(uart2), priority), lpc11u6x_uartx_shared_isr, @@ -968,11 +968,11 @@ static void lpc11u6x_uartx_isr_config_2(const struct device *dev) &lpc11u6x_uartx_shared_irq_info_2, 0); irq_enable(DT_IRQN(DT_NODELABEL(uart3))); -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) */ } #endif /* CONFIG_UART_INTERRUPT_DRIVEN && - * (DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) || - * DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay)) + * (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) || + * DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3))) */ #endif /* DT_NODE_EXISTS(DT_NODELABEL(uart1) || * DT_NODE_EXISTS(DT_NODELABEL(uart2) || diff --git a/drivers/serial/uart_lpc11u6x.h b/drivers/serial/uart_lpc11u6x.h index 8951945e65ab7..257846cbdd496 100644 --- a/drivers/serial/uart_lpc11u6x.h +++ b/drivers/serial/uart_lpc11u6x.h @@ -199,20 +199,20 @@ struct lpc11u6x_uartx_shared_irq { }; #if CONFIG_UART_INTERRUPT_DRIVEN && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4))) static void lpc11u6x_uartx_isr_config_1(const struct device *dev); #endif /* CONFIG_UART_INTERRUPT_DRIVEN && - * (DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) || - * DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay)) + * (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) || + * DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3))) */ #if CONFIG_UART_INTERRUPT_DRIVEN && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3))) static void lpc11u6x_uartx_isr_config_2(const struct device *dev); #endif /* CONFIG_UART_INTERRUPT_DRIVEN && - * (DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) || - * DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay)) + * (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) || + * DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3))) */ #endif /* ZEPHYR_DRIVERS_SERIAL_UART_LPC11U6X_H_ */ diff --git a/drivers/serial/uart_miv.c b/drivers/serial/uart_miv.c index bf35b4cf6563d..d1b5cfb0e2666 100644 --- a/drivers/serial/uart_miv.c +++ b/drivers/serial/uart_miv.c @@ -387,7 +387,7 @@ static const struct uart_driver_api uart_miv_driver_api = { BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) <= 1, "unsupported uart_miv instance"); -#if DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) static struct uart_miv_data uart_miv_data_0; @@ -424,4 +424,4 @@ static void uart_miv_irq_cfg_func_0(const struct device *dev) } #endif -#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_DRV_INST(0)) */ diff --git a/drivers/spi/spi_smartbond.c b/drivers/spi/spi_smartbond.c index 324273bc12e32..7a2be279e986b 100644 --- a/drivers/spi/spi_smartbond.c +++ b/drivers/spi/spi_smartbond.c @@ -1227,11 +1227,11 @@ static int spi_smartbond_isr_connect(const struct device *dev) switch ((uint32_t)cfg->regs) { case (uint32_t)SPI: - COND_CODE_1(DT_NODE_HAS_STATUS(DT_NODELABEL(spi), okay), + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(spi)), (SPI_SMARTBOND_ISR_CONNECT), (NULL)); break; case (uint32_t)SPI2: - COND_CODE_1(DT_NODE_HAS_STATUS(DT_NODELABEL(spi2), okay), + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(spi2)), (SPI2_SMARTBOND_ISR_CONNECT), (NULL)); break; default: diff --git a/drivers/spi/spi_xec_qmspi.c b/drivers/spi/spi_xec_qmspi.c index f606f3145c378..02cd34d259f95 100644 --- a/drivers/spi/spi_xec_qmspi.c +++ b/drivers/spi/spi_xec_qmspi.c @@ -681,7 +681,7 @@ static const struct spi_driver_api spi_qmspi_driver_api = { DT_INST_PROP(0, dldh), \ DT_INST_PROP(0, dcsda)) -#if DT_NODE_HAS_STATUS(DT_INST(0, microchip_xec_qmspi), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, microchip_xec_qmspi)) PINCTRL_DT_INST_DEFINE(0); @@ -708,4 +708,4 @@ DEVICE_DT_INST_DEFINE(0, &spi_qmspi_0_config, POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, &spi_qmspi_driver_api); -#endif /* DT_NODE_HAS_STATUS(DT_INST(0, microchip_xec_qmspi), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_INST(0, microchip_xec_qmspi)) */ diff --git a/drivers/timer/mcux_os_timer.c b/drivers/timer/mcux_os_timer.c index 74580e684b02c..c6eb776e43abf 100644 --- a/drivers/timer/mcux_os_timer.c +++ b/drivers/timer/mcux_os_timer.c @@ -36,7 +36,7 @@ static OSTIMER_Type *base; * certain deep sleep modes and the time elapsed when it is powered off. */ static uint64_t cyc_sys_compensated; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(standby), okay) && CONFIG_PM +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(standby)) && CONFIG_PM static const struct device *counter_dev; #endif @@ -71,7 +71,7 @@ void mcux_lpc_ostick_isr(const void *arg) sys_clock_announce(IS_ENABLED(CONFIG_TICKLESS_KERNEL) ? dticks : 1); } -#if DT_NODE_HAS_STATUS(DT_NODELABEL(standby), okay) && CONFIG_PM +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(standby)) && CONFIG_PM /* The OS Timer is disabled in certain low power modes and cannot wakeup the system * on timeout. This function will be called by the low power code to allow the @@ -178,7 +178,7 @@ void sys_clock_set_timeout(int32_t ticks, bool idle) return; } -#if DT_NODE_HAS_STATUS(DT_NODELABEL(standby), okay) && CONFIG_PM +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(standby)) && CONFIG_PM if (idle) { /* OS Timer may not be able to wakeup in certain low power modes. * For these cases, we start a counter that can wakeup @@ -247,7 +247,7 @@ uint64_t sys_clock_cycle_get_64(void) void sys_clock_idle_exit(void) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(standby), okay) && CONFIG_PM +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(standby)) && CONFIG_PM /* The tick should be compensated for states where the * OS Timer is disabled */ @@ -280,7 +280,7 @@ static int sys_clock_driver_init(void) irq_enable(DT_INST_IRQN(0)); /* On some SoC's, OS Timer cannot wakeup from low power mode in standby modes */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(standby), okay) && CONFIG_PM +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(standby)) && CONFIG_PM counter_dev = DEVICE_DT_GET_OR_NULL(DT_INST_PHANDLE(0, deep_sleep_counter)); #endif diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 187c7e12326af..401fdd26821b8 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -426,7 +426,7 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) nrfy_grtc_timeout_get(NRF_GRTC) * CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC / 32768 + MAX_CC_LATCH_WAIT_TIME_US; k_busy_wait(wait_time); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lfxo), okay) && NRF_GRTC_HAS_CLKSEL +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lfxo)) && NRF_GRTC_HAS_CLKSEL nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFXO); #endif k_spin_unlock(&lock, key); @@ -508,7 +508,7 @@ static int sys_clock_driver_init(void) #endif #if defined(CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) && \ - DT_NODE_HAS_STATUS(DT_NODELABEL(lfxo), okay) && NRF_GRTC_HAS_CLKSEL + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lfxo)) && NRF_GRTC_HAS_CLKSEL /* Switch to LFXO as the low-frequency clock source. */ nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFXO); #endif diff --git a/drivers/timer/smartbond_timer.c b/drivers/timer/smartbond_timer.c index ceef22ce5fa2f..afa86617e0e50 100644 --- a/drivers/timer/smartbond_timer.c +++ b/drivers/timer/smartbond_timer.c @@ -199,7 +199,7 @@ static int sys_clock_driver_init(void) uint8_t pdc_idx; uint8_t en_xtal; - en_xtal = DT_NODE_HAS_STATUS(DT_NODELABEL(xtal32m), okay) ? MCU_PDC_EN_XTAL : 0; + en_xtal = DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(xtal32m)) ? MCU_PDC_EN_XTAL : 0; /* Enable wakeup by TIMER2 */ pdc_idx = da1469x_pdc_add(MCU_PDC_TRIGGER_TIMER2, MCU_PDC_MASTER_M33, en_xtal); diff --git a/drivers/usb/device/usb_dc_mcux.c b/drivers/usb/device/usb_dc_mcux.c index b28499db1d6f2..14a8918d10679 100644 --- a/drivers/usb/device/usb_dc_mcux.c +++ b/drivers/usb/device/usb_dc_mcux.c @@ -84,17 +84,17 @@ BUILD_ASSERT(NUM_INSTS <= 1, "Only one USB device supported"); #elif defined(CONFIG_SOC_LPC55S36) #define CONTROLLER_ID kUSB_ControllerLpcIp3511Fs0 #elif defined(CONFIG_SOC_LPC55S69_CPU0) || defined(CONFIG_SOC_LPC55S69_CPU1) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usbhs), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usbhs)) #define CONTROLLER_ID kUSB_ControllerLpcIp3511Hs0 -#elif DT_NODE_HAS_STATUS(DT_NODELABEL(usbfs), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usbfs)) #define CONTROLLER_ID kUSB_ControllerLpcIp3511Fs0 #endif /* LPC55s69 */ #elif defined(CONFIG_SOC_SERIES_IMXRT11XX) || \ defined(CONFIG_SOC_SERIES_IMXRT10XX) || \ defined(CONFIG_SOC_SERIES_MCXN) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) #define CONTROLLER_ID kUSB_ControllerEhci0 -#elif DT_NODE_HAS_STATUS(DT_NODELABEL(usb2), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb2)) #define CONTROLLER_ID kUSB_ControllerEhci1 #endif /* IMX RT */ #elif defined(CONFIG_SOC_SERIES_RW6XX) diff --git a/drivers/usb/device/usb_dc_nrfx.c b/drivers/usb/device/usb_dc_nrfx.c index a165c24f7891b..c8442cb8f649d 100644 --- a/drivers/usb/device/usb_dc_nrfx.c +++ b/drivers/usb/device/usb_dc_nrfx.c @@ -1900,8 +1900,8 @@ static int usb_init(void) == NRF5X_REG_MODE_DCDC), #if NRFX_POWER_SUPPORTS_DCDCEN_VDDH .dcdcenhv = COND_CODE_1(CONFIG_SOC_SERIES_NRF52X, - (DT_NODE_HAS_STATUS(DT_INST(0, nordic_nrf52x_regulator_hv), okay)), - (DT_NODE_HAS_STATUS(DT_INST(0, nordic_nrf53x_regulator_hv), okay))), + (DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nordic_nrf52x_regulator_hv))), + (DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nordic_nrf53x_regulator_hv)))), #endif }; diff --git a/drivers/usb/udc/udc_nrf.c b/drivers/usb/udc/udc_nrf.c index c6951074c8549..c024d2a6a1847 100644 --- a/drivers/usb/udc/udc_nrf.c +++ b/drivers/usb/udc/udc_nrf.c @@ -824,8 +824,8 @@ static const struct udc_nrf_config udc_nrf_cfg = { == NRF5X_REG_MODE_DCDC), #if NRFX_POWER_SUPPORTS_DCDCEN_VDDH .dcdcenhv = COND_CODE_1(CONFIG_SOC_SERIES_NRF52X, - (DT_NODE_HAS_STATUS(DT_INST(0, nordic_nrf52x_regulator_hv), okay)), - (DT_NODE_HAS_STATUS(DT_INST(0, nordic_nrf53x_regulator_hv), okay))), + (DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nordic_nrf52x_regulator_hv))), + (DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nordic_nrf53x_regulator_hv)))), #endif }, diff --git a/drivers/watchdog/wdt_esp32.c b/drivers/watchdog/wdt_esp32.c index 8fe4c877fd0ad..1c7ee61ee64cc 100644 --- a/drivers/watchdog/wdt_esp32.c +++ b/drivers/watchdog/wdt_esp32.c @@ -226,10 +226,10 @@ static void wdt_esp32_isr(void *arg) } -#if DT_NODE_HAS_STATUS(DT_NODELABEL(wdt0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(wdt0)) ESP32_WDT_INIT(0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(wdt1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(wdt1)) ESP32_WDT_INIT(1); #endif diff --git a/include/zephyr/device.h b/include/zephyr/device.h index 8328ace40e99d..fccfa6e6d0922 100644 --- a/include/zephyr/device.h +++ b/include/zephyr/device.h @@ -318,7 +318,7 @@ typedef int16_t device_handle_t; * @return a @ref device reference for the node identifier, which may be `NULL`. */ #define DEVICE_DT_GET_OR_NULL(node_id) \ - COND_CODE_1(DT_NODE_HAS_STATUS(node_id, okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(node_id), \ (DEVICE_DT_GET(node_id)), (NULL)) /** diff --git a/include/zephyr/drivers/clock_control/stm32_clock_control.h b/include/zephyr/drivers/clock_control/stm32_clock_control.h index c33714be97629..b03fa79002709 100644 --- a/include/zephyr/drivers/clock_control/stm32_clock_control.h +++ b/include/zephyr/drivers/clock_control/stm32_clock_control.h @@ -250,7 +250,7 @@ #endif /** PLL/PLL1 clock source */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pll), okay) && \ +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pll)) && \ DT_NODE_HAS_PROP(DT_NODELABEL(pll), clocks) #define DT_PLL_CLOCKS_CTRL DT_CLOCKS_CTLR(DT_NODELABEL(pll)) #if DT_SAME_NODE(DT_PLL_CLOCKS_CTRL, DT_NODELABEL(clk_msi)) @@ -275,7 +275,7 @@ #endif /** PLL2 clock source */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pll2), okay) && \ +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pll2)) && \ DT_NODE_HAS_PROP(DT_NODELABEL(pll2), clocks) #define DT_PLL2_CLOCKS_CTRL DT_CLOCKS_CTLR(DT_NODELABEL(pll2)) #if DT_SAME_NODE(DT_PLL2_CLOCKS_CTRL, DT_NODELABEL(clk_msis)) @@ -291,7 +291,7 @@ #endif /** PLL3 clock source */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pll3), okay) && \ +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pll3)) && \ DT_NODE_HAS_PROP(DT_NODELABEL(pll3), clocks) #define DT_PLL3_CLOCKS_CTRL DT_CLOCKS_CTLR(DT_NODELABEL(pll3)) #if DT_SAME_NODE(DT_PLL3_CLOCKS_CTRL, DT_NODELABEL(clk_msis)) diff --git a/include/zephyr/drivers/emul.h b/include/zephyr/drivers/emul.h index c0830bb020555..a20679573e4cb 100644 --- a/include/zephyr/drivers/emul.h +++ b/include/zephyr/drivers/emul.h @@ -195,7 +195,7 @@ struct emul { * @return a @ref emul reference for the node identifier, which may be `NULL`. */ #define EMUL_DT_GET_OR_NULL(node_id) \ - COND_CODE_1(DT_NODE_HAS_STATUS(node_id, okay), (EMUL_DT_GET(node_id)), (NULL)) + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(node_id), (EMUL_DT_GET(node_id)), (NULL)) /** * @brief Set up a list of emulators diff --git a/include/zephyr/linker/linker-defs.h b/include/zephyr/linker/linker-defs.h index 5c1089c0fcfed..ff3cbe6ca6cf4 100644 --- a/include/zephyr/linker/linker-defs.h +++ b/include/zephyr/linker/linker-defs.h @@ -32,6 +32,7 @@ */ #ifdef ZTEST_UNITTEST #define DT_NODE_HAS_STATUS(node, status) 0 +#define DT_NODE_HAS_STATUS_OKAY(node) 0 #else #include #endif @@ -159,7 +160,7 @@ extern char __gcov_bss_size[]; /* end address of image, used by newlib for the heap */ extern char _end[]; -#if (DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay)) +#if (DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_ccm))) extern char __ccm_data_rom_start[]; extern char __ccm_start[]; extern char __ccm_data_start[]; @@ -171,14 +172,14 @@ extern char __ccm_noinit_end[]; extern char __ccm_end[]; #endif -#if (DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay)) +#if (DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_itcm))) extern char __itcm_start[]; extern char __itcm_end[]; extern char __itcm_size[]; extern char __itcm_load_start[]; #endif -#if (DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay)) +#if (DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm))) extern char __dtcm_data_start[]; extern char __dtcm_data_end[]; extern char __dtcm_bss_start[]; @@ -190,7 +191,7 @@ extern char __dtcm_start[]; extern char __dtcm_end[]; #endif -#if (DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ocm), okay)) +#if (DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_ocm))) extern char __ocm_data_start[]; extern char __ocm_data_end[]; extern char __ocm_bss_start[]; diff --git a/include/zephyr/pm/state.h b/include/zephyr/pm/state.h index 87363ea27d2e9..6590b90c385e7 100644 --- a/include/zephyr/pm/state.h +++ b/include/zephyr/pm/state.h @@ -194,7 +194,7 @@ struct pm_state_constraint { * @param idx Index within the array. */ #define Z_DT_PHANDLE_01(node_id, prop, idx) \ - COND_CODE_1(DT_NODE_HAS_STATUS(DT_PHANDLE_BY_IDX(node_id, prop, idx), okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_PHANDLE_BY_IDX(node_id, prop, idx)), \ (1), (0)) /** @@ -207,7 +207,7 @@ struct pm_state_constraint { * @param node_id A node identifier with compatible zephyr,power-state */ #define Z_PM_STATE_INFO_FROM_DT_CPU(i, node_id) \ - COND_CODE_1(DT_NODE_HAS_STATUS(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i), okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i)), \ (PM_STATE_INFO_DT_INIT(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i)),), ()) /** @@ -220,7 +220,7 @@ struct pm_state_constraint { * @param node_id A node identifier with compatible zephyr,power-state */ #define Z_PM_STATE_FROM_DT_CPU(i, node_id) \ - COND_CODE_1(DT_NODE_HAS_STATUS(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i), okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i)), \ (PM_STATE_DT_INIT(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i)),), ()) /** @endcond */ diff --git a/kernel/init.c b/kernel/init.c index afbffe1ccff9d..c3b6ea9bb33f6 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -223,17 +223,17 @@ void z_bss_zero(void) } z_early_memset(__bss_start, 0, __bss_end - __bss_start); -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_ccm)) z_early_memset(&__ccm_bss_start, 0, (uintptr_t) &__ccm_bss_end - (uintptr_t) &__ccm_bss_start); #endif -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) z_early_memset(&__dtcm_bss_start, 0, (uintptr_t) &__dtcm_bss_end - (uintptr_t) &__dtcm_bss_start); #endif -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ocm), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_ocm)) z_early_memset(&__ocm_bss_start, 0, (uintptr_t) &__ocm_bss_end - (uintptr_t) &__ocm_bss_start); diff --git a/kernel/xip.c b/kernel/xip.c index d068174a1e91b..94d38e9b30dcc 100644 --- a/kernel/xip.c +++ b/kernel/xip.c @@ -31,15 +31,15 @@ void z_data_copy(void) z_early_memcpy(&__ramfunc_start, &__ramfunc_load_start, (uintptr_t) &__ramfunc_size); #endif /* CONFIG_ARCH_HAS_RAMFUNC_SUPPORT */ -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_ccm)) z_early_memcpy(&__ccm_data_start, &__ccm_data_rom_start, __ccm_data_end - __ccm_data_start); #endif -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_itcm)) z_early_memcpy(&__itcm_start, &__itcm_load_start, (uintptr_t) &__itcm_size); #endif -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) z_early_memcpy(&__dtcm_data_start, &__dtcm_data_load_start, __dtcm_data_end - __dtcm_data_start); #endif diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index b0c27bb2fe884..bec09b1a058bc 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -1000,7 +1000,7 @@ #define NRFX_IPCT_PUB_OR_SUB_MASK(inst_num) \ COND_CODE_1(IS_EMPTY(inst_num), \ - (DT_NODE_HAS_STATUS(NRFX_CONFIG_IPCT_LOCAL_NODE, okay)), \ + (DT_NODE_HAS_STATUS_OKAY(NRFX_CONFIG_IPCT_LOCAL_NODE)), \ (DT_NODE_HAS_PROP(DT_NODELABEL(_CONCAT(ipct, inst_num)), owned_channels))) /* Variables names generation. */ diff --git a/samples/basic/button/src/main.c b/samples/basic/button/src/main.c index b181afcc34ee4..a86407a65c256 100644 --- a/samples/basic/button/src/main.c +++ b/samples/basic/button/src/main.c @@ -18,7 +18,7 @@ * Get button configuration from the devicetree sw0 alias. This is mandatory. */ #define SW0_NODE DT_ALIAS(sw0) -#if !DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(SW0_NODE) #error "Unsupported board: sw0 devicetree alias is not defined" #endif static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET_OR(SW0_NODE, gpios, diff --git a/samples/basic/threads/src/main.c b/samples/basic/threads/src/main.c index 0554ddd9daf1f..529df15908ad7 100644 --- a/samples/basic/threads/src/main.c +++ b/samples/basic/threads/src/main.c @@ -20,11 +20,11 @@ #define LED0_NODE DT_ALIAS(led0) #define LED1_NODE DT_ALIAS(led1) -#if !DT_NODE_HAS_STATUS(LED0_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(LED0_NODE) #error "Unsupported board: led0 devicetree alias is not defined" #endif -#if !DT_NODE_HAS_STATUS(LED1_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(LED1_NODE) #error "Unsupported board: led1 devicetree alias is not defined" #endif diff --git a/samples/bluetooth/central_otc/src/main.c b/samples/bluetooth/central_otc/src/main.c index bd690e87ed141..9f1f3069fd4c1 100644 --- a/samples/bluetooth/central_otc/src/main.c +++ b/samples/bluetooth/central_otc/src/main.c @@ -77,8 +77,8 @@ static void print_hex_number(const uint8_t *num, size_t len) #define SW1_NODE DT_ALIAS(sw1) #define SW2_NODE DT_ALIAS(sw2) #define SW3_NODE DT_ALIAS(sw3) -#if !DT_NODE_HAS_STATUS(SW0_NODE, okay) || !DT_NODE_HAS_STATUS(SW1_NODE, okay) || \ - !DT_NODE_HAS_STATUS(SW2_NODE, okay) || !DT_NODE_HAS_STATUS(SW3_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(SW0_NODE) || !DT_NODE_HAS_STATUS_OKAY(SW1_NODE) || \ + !DT_NODE_HAS_STATUS_OKAY(SW2_NODE) || !DT_NODE_HAS_STATUS_OKAY(SW3_NODE) #error "Unsupported board: This sample need 4 buttons to run" #endif diff --git a/samples/bluetooth/encrypted_advertising/central/src/main.c b/samples/bluetooth/encrypted_advertising/central/src/main.c index 888940af780b0..122641b311a4e 100644 --- a/samples/bluetooth/encrypted_advertising/central/src/main.c +++ b/samples/bluetooth/encrypted_advertising/central/src/main.c @@ -30,7 +30,7 @@ LOG_MODULE_DECLARE(ead_central_sample, CONFIG_BT_EAD_LOG_LEVEL); * Get button configuration from the devicetree sw0 alias. This is mandatory. */ #define SW0_NODE DT_ALIAS(sw0) -#if !DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(SW0_NODE) #error "Unsupported board: sw0 devicetree alias is not defined" #endif static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET_OR(SW0_NODE, gpios, {0}); diff --git a/samples/bluetooth/encrypted_advertising/peripheral/src/main.c b/samples/bluetooth/encrypted_advertising/peripheral/src/main.c index 6b269d30513b8..affa5430af2cf 100644 --- a/samples/bluetooth/encrypted_advertising/peripheral/src/main.c +++ b/samples/bluetooth/encrypted_advertising/peripheral/src/main.c @@ -26,7 +26,7 @@ LOG_MODULE_DECLARE(ead_peripheral_sample, CONFIG_BT_EAD_LOG_LEVEL); * Get button configuration from the devicetree sw0 alias. This is mandatory. */ #define SW0_NODE DT_ALIAS(sw0) -#if !DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(SW0_NODE) #error "Unsupported board: sw0 devicetree alias is not defined" #endif static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET_OR(SW0_NODE, gpios, {0}); diff --git a/samples/bluetooth/iso_receive/src/main.c b/samples/bluetooth/iso_receive/src/main.c index 3b7c051f387f0..989694907b4a9 100644 --- a/samples/bluetooth/iso_receive/src/main.c +++ b/samples/bluetooth/iso_receive/src/main.c @@ -42,7 +42,7 @@ static K_SEM_DEFINE(sem_big_sync_lost, 0, BIS_ISO_CHAN_COUNT); /* The devicetree node identifier for the "led0" alias. */ #define LED0_NODE DT_ALIAS(led0) -#if DT_NODE_HAS_STATUS(LED0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(LED0_NODE) static const struct gpio_dt_spec led_gpio = GPIO_DT_SPEC_GET(LED0_NODE, gpios); #define HAS_LED 1 #define BLINK_ONOFF K_MSEC(500) diff --git a/samples/bluetooth/mesh_provisioner/src/main.c b/samples/bluetooth/mesh_provisioner/src/main.c index 472dc020d438e..d4be8601304f2 100644 --- a/samples/bluetooth/mesh_provisioner/src/main.c +++ b/samples/bluetooth/mesh_provisioner/src/main.c @@ -20,7 +20,7 @@ static uint8_t node_uuid[16]; K_SEM_DEFINE(sem_unprov_beacon, 0, 1); K_SEM_DEFINE(sem_node_added, 0, 1); -#if DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW0_NODE) K_SEM_DEFINE(sem_button_pressed, 0, 1); #endif @@ -315,7 +315,7 @@ static uint8_t check_unconfigured(struct bt_mesh_cdb_node *node, void *data) return BT_MESH_CDB_ITER_CONTINUE; } -#if DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW0_NODE) static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET_OR(SW0_NODE, gpios, {0}); static struct gpio_callback button_cb_data; @@ -366,7 +366,7 @@ int main(void) printk("Bluetooth initialized\n"); bt_ready(); -#if DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW0_NODE) button_init(); #endif @@ -383,7 +383,7 @@ int main(void) bin2hex(node_uuid, 16, uuid_hex_str, sizeof(uuid_hex_str)); -#if DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW0_NODE) k_sem_reset(&sem_button_pressed); printk("Device %s detected, press button 1 to provision.\n", uuid_hex_str); err = k_sem_take(&sem_button_pressed, K_SECONDS(30)); diff --git a/samples/bluetooth/periodic_sync/src/main.c b/samples/bluetooth/periodic_sync/src/main.c index 44c5a8530b4ad..a8baf5d260066 100644 --- a/samples/bluetooth/periodic_sync/src/main.c +++ b/samples/bluetooth/periodic_sync/src/main.c @@ -24,7 +24,7 @@ static K_SEM_DEFINE(sem_per_sync_lost, 0, 1); /* The devicetree node identifier for the "led0" alias. */ #define LED0_NODE DT_ALIAS(led0) -#if DT_NODE_HAS_STATUS(LED0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(LED0_NODE) #define HAS_LED 1 static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios); #define BLINK_ONOFF K_MSEC(500) diff --git a/samples/bluetooth/peripheral_hids/src/hog.c b/samples/bluetooth/peripheral_hids/src/hog.c index cf67521517d0b..9aefdf2ea98c8 100644 --- a/samples/bluetooth/peripheral_hids/src/hog.c +++ b/samples/bluetooth/peripheral_hids/src/hog.c @@ -180,7 +180,7 @@ void hog_init(void) void hog_button_loop(void) { -#if DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW0_NODE) const struct gpio_dt_spec sw0 = GPIO_DT_SPEC_GET(SW0_NODE, gpios); gpio_pin_configure_dt(&sw0, GPIO_INPUT); diff --git a/samples/bluetooth/peripheral_hr/src/main.c b/samples/bluetooth/peripheral_hr/src/main.c index 8d7f73e544067..19c640ca91b53 100644 --- a/samples/bluetooth/peripheral_hr/src/main.c +++ b/samples/bluetooth/peripheral_hr/src/main.c @@ -123,7 +123,7 @@ static void hrs_notify(void) /* The devicetree node identifier for the "led0" alias. */ #define LED0_NODE DT_ALIAS(led0) -#if DT_NODE_HAS_STATUS(LED0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(LED0_NODE) #include #define HAS_LED 1 static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios); diff --git a/samples/boards/espressif/deep_sleep/src/main.c b/samples/boards/espressif/deep_sleep/src/main.c index edf8b5597051f..519a1a550df9f 100644 --- a/samples/boards/espressif/deep_sleep/src/main.c +++ b/samples/boards/espressif/deep_sleep/src/main.c @@ -17,7 +17,7 @@ #endif #ifdef CONFIG_EXAMPLE_GPIO_WAKEUP -#if !DT_NODE_HAS_STATUS(DT_ALIAS(wakeup_button), okay) +#if !DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(wakeup_button)) #error "Unsupported: wakeup-button alias is not defined" #else static const struct gpio_dt_spec wakeup_button = GPIO_DT_SPEC_GET(DT_ALIAS(wakeup_button), gpios); diff --git a/samples/boards/espressif/light_sleep/src/main.c b/samples/boards/espressif/light_sleep/src/main.c index 50cb920d159ee..9134f6a2006cd 100644 --- a/samples/boards/espressif/light_sleep/src/main.c +++ b/samples/boards/espressif/light_sleep/src/main.c @@ -16,7 +16,7 @@ */ #define SW0_NODE DT_ALIAS(sw0) -#if !DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(SW0_NODE) #error "unsupported board: sw0 devicetree alias is not defined" #endif diff --git a/samples/boards/nordic/battery/src/battery.c b/samples/boards/nordic/battery/src/battery.c index a0fbb651b58b9..3a31a91398b9e 100644 --- a/samples/boards/nordic/battery/src/battery.c +++ b/samples/boards/nordic/battery/src/battery.c @@ -51,7 +51,7 @@ struct divider_config { }; static const struct divider_config divider_config = { -#if DT_NODE_HAS_STATUS(VBATT, okay) +#if DT_NODE_HAS_STATUS_OKAY(VBATT) .io_channel = { DT_IO_CHANNELS_INPUT(VBATT), }, @@ -72,7 +72,7 @@ struct divider_data { int16_t raw; }; static struct divider_data divider_data = { -#if DT_NODE_HAS_STATUS(VBATT, okay) +#if DT_NODE_HAS_STATUS_OKAY(VBATT) .adc = DEVICE_DT_GET(DT_IO_CHANNELS_CTLR(VBATT)), #else .adc = DEVICE_DT_GET(DT_IO_CHANNELS_CTLR(ZEPHYR_USER)), diff --git a/samples/boards/nxp/mimxrt1060_evk/system_off/src/main.c b/samples/boards/nxp/mimxrt1060_evk/system_off/src/main.c index 57b0298f86146..af5dbf4b84535 100644 --- a/samples/boards/nxp/mimxrt1060_evk/system_off/src/main.c +++ b/samples/boards/nxp/mimxrt1060_evk/system_off/src/main.c @@ -17,12 +17,12 @@ #define SOFT_OFF_S 10U #define SW0_NODE DT_ALIAS(sw0) -#if !DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(SW0_NODE) #error "Unsupported board: sw0 devicetree alias is not defined" #endif #define SNVS_RTC_NODE DT_NODELABEL(snvs_rtc) -#if !DT_NODE_HAS_STATUS(SNVS_RTC_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(SNVS_RTC_NODE) #error "Unsupported board: snvs_rtc node is not enabled" #endif diff --git a/samples/boards/st/i2c_timing/src/main.c b/samples/boards/st/i2c_timing/src/main.c index 41b8dfa2dee25..80f8001318db0 100644 --- a/samples/boards/st/i2c_timing/src/main.c +++ b/samples/boards/st/i2c_timing/src/main.c @@ -10,7 +10,7 @@ #include -#if DT_NODE_HAS_STATUS(DT_ALIAS(i2c_0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(i2c_0)) #define I2C_DEV_NODE DT_ALIAS(i2c_0) #else #error "Please set the correct I2C device" diff --git a/samples/boards/st/mco/src/main.c b/samples/boards/st/mco/src/main.c index 966e80f8525b4..7e79d1e8cd8dc 100644 --- a/samples/boards/st/mco/src/main.c +++ b/samples/boards/st/mco/src/main.c @@ -25,7 +25,7 @@ int main(void) return -1; } -#if DT_NODE_HAS_STATUS(DT_NODELABEL(mco2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(mco2)) dev = DEVICE_DT_GET(DT_NODELABEL(mco2)); if (device_is_ready(dev)) { printk("MCO2 device successfully configured\n"); diff --git a/samples/boards/st/power_mgmt/standby_shutdown/src/main.c b/samples/boards/st/power_mgmt/standby_shutdown/src/main.c index 6610f01f955f7..b74051bc99f95 100644 --- a/samples/boards/st/power_mgmt/standby_shutdown/src/main.c +++ b/samples/boards/st/power_mgmt/standby_shutdown/src/main.c @@ -23,7 +23,7 @@ #define SLEEP_TIME_MS 3000 #define SW0_NODE DT_ALIAS(sw0) -#if !DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(SW0_NODE) #error "Unsupported board: sw0 devicetree alias is not defined" #endif diff --git a/samples/boards/st/power_mgmt/wkup_pins/src/main.c b/samples/boards/st/power_mgmt/wkup_pins/src/main.c index 2284a76b03561..c83db862d4354 100644 --- a/samples/boards/st/power_mgmt/wkup_pins/src/main.c +++ b/samples/boards/st/power_mgmt/wkup_pins/src/main.c @@ -15,7 +15,7 @@ #define WAIT_TIME_US 4000000 #define WKUP_SRC_NODE DT_ALIAS(wkup_src) -#if !DT_NODE_HAS_STATUS(WKUP_SRC_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(WKUP_SRC_NODE) #error "Unsupported board: wkup_src devicetree alias is not defined" #endif diff --git a/samples/drivers/espi/src/main.c b/samples/drivers/espi/src/main.c index fff0998459dbb..aa6b92a472563 100644 --- a/samples/drivers/espi/src/main.c +++ b/samples/drivers/espi/src/main.c @@ -45,7 +45,7 @@ LOG_MODULE_DECLARE(espi, CONFIG_ESPI_LOG_LEVEL); /* The devicetree node identifier for the board power rails pins. */ #define BRD_PWR_NODE DT_NODELABEL(board_power) -#if DT_NODE_HAS_STATUS(BRD_PWR_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(BRD_PWR_NODE) static const struct gpio_dt_spec pwrgd_gpio = GPIO_DT_SPEC_GET(BRD_PWR_NODE, pwrg_gpios); static const struct gpio_dt_spec rsm_gpio = GPIO_DT_SPEC_GET(BRD_PWR_NODE, rsm_gpios); #endif @@ -911,7 +911,7 @@ int espi_init(void) return ret; } -#if DT_NODE_HAS_STATUS(BRD_PWR_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(BRD_PWR_NODE) static int wait_for_pin(const struct gpio_dt_spec *gpio, uint16_t timeout, int exp_level) { uint16_t loop_cnt = timeout; @@ -1172,7 +1172,7 @@ int espi_test(void) */ k_sleep(K_SECONDS(1)); -#if DT_NODE_HAS_STATUS(BRD_PWR_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(BRD_PWR_NODE) if (!gpio_is_ready_dt(&pwrgd_gpio)) { LOG_ERR("%s: device not ready.", pwrgd_gpio.port->name); return -ENODEV; @@ -1201,7 +1201,7 @@ int espi_test(void) LOG_INF("Hello eSPI test %s", CONFIG_BOARD); -#if DT_NODE_HAS_STATUS(BRD_PWR_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(BRD_PWR_NODE) ret = gpio_pin_configure_dt(&pwrgd_gpio, GPIO_INPUT); if (ret) { LOG_ERR("Unable to configure %d:%d", pwrgd_gpio.pin, ret); @@ -1252,7 +1252,7 @@ int espi_test(void) } #endif -#if DT_NODE_HAS_STATUS(BRD_PWR_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(BRD_PWR_NODE) ret = wait_for_pin(&pwrgd_gpio, PWR_SEQ_TIMEOUT, 1); if (ret) { LOG_ERR("RSMRST_PWRGD timeout"); diff --git a/samples/drivers/i2s/echo/src/main.c b/samples/drivers/i2s/echo/src/main.c index c0ac1505d7b34..bffa794158b3f 100644 --- a/samples/drivers/i2s/echo/src/main.c +++ b/samples/drivers/i2s/echo/src/main.c @@ -30,12 +30,12 @@ #define TIMEOUT 1000 #define SW0_NODE DT_ALIAS(sw0) -#if DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW0_NODE) static struct gpio_dt_spec sw0_spec = GPIO_DT_SPEC_GET(SW0_NODE, gpios); #endif #define SW1_NODE DT_ALIAS(sw1) -#if DT_NODE_HAS_STATUS(SW1_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW1_NODE) static struct gpio_dt_spec sw1_spec = GPIO_DT_SPEC_GET(SW1_NODE, gpios); #endif @@ -47,7 +47,7 @@ static int16_t echo_block[SAMPLES_PER_BLOCK]; static volatile bool echo_enabled = true; static K_SEM_DEFINE(toggle_transfer, 1, 1); -#if DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW0_NODE) static void sw0_handler(const struct device *dev, struct gpio_callback *cb, uint32_t pins) { @@ -58,7 +58,7 @@ static void sw0_handler(const struct device *dev, struct gpio_callback *cb, } #endif -#if DT_NODE_HAS_STATUS(SW1_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW1_NODE) static void sw1_handler(const struct device *dev, struct gpio_callback *cb, uint32_t pins) { @@ -70,7 +70,7 @@ static bool init_buttons(void) { int ret; -#if DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW0_NODE) static struct gpio_callback sw0_cb_data; if (!gpio_is_ready_dt(&sw0_spec)) { @@ -98,7 +98,7 @@ static bool init_buttons(void) printk("Press \"%s\" to toggle the echo effect\n", sw0_spec.port->name); #endif -#if DT_NODE_HAS_STATUS(SW1_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(SW1_NODE) static struct gpio_callback sw1_cb_data; if (!gpio_is_ready_dt(&sw1_spec)) { diff --git a/samples/drivers/lora/receive/src/main.c b/samples/drivers/lora/receive/src/main.c index 9b50335400114..e6ba6086ae06b 100644 --- a/samples/drivers/lora/receive/src/main.c +++ b/samples/drivers/lora/receive/src/main.c @@ -11,7 +11,7 @@ #include #define DEFAULT_RADIO_NODE DT_ALIAS(lora0) -BUILD_ASSERT(DT_NODE_HAS_STATUS(DEFAULT_RADIO_NODE, okay), +BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DEFAULT_RADIO_NODE), "No default LoRa radio specified in DT"); #define MAX_DATA_LEN 255 diff --git a/samples/drivers/lora/send/src/main.c b/samples/drivers/lora/send/src/main.c index 63cce8367af89..7988fa8762ee2 100644 --- a/samples/drivers/lora/send/src/main.c +++ b/samples/drivers/lora/send/src/main.c @@ -11,7 +11,7 @@ #include #define DEFAULT_RADIO_NODE DT_ALIAS(lora0) -BUILD_ASSERT(DT_NODE_HAS_STATUS(DEFAULT_RADIO_NODE, okay), +BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DEFAULT_RADIO_NODE), "No default LoRa radio specified in DT"); #define MAX_DATA_LEN 10 diff --git a/samples/shields/x_nucleo_53l0a1/src/main.c b/samples/shields/x_nucleo_53l0a1/src/main.c index e2688eec21b3f..9de9469ba7d71 100644 --- a/samples/shields/x_nucleo_53l0a1/src/main.c +++ b/samples/shields/x_nucleo_53l0a1/src/main.c @@ -15,7 +15,7 @@ * Get button configuration from the devicetree sw0 alias. This is mandatory. */ #define SW0_NODE DT_ALIAS(sw0) -#if !DT_NODE_HAS_STATUS(SW0_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(SW0_NODE) #error "Unsupported board: sw0 devicetree alias is not defined" #endif diff --git a/samples/subsys/mgmt/osdp/control_panel/src/main.c b/samples/subsys/mgmt/osdp/control_panel/src/main.c index 1942e8227336b..2b58692e9263f 100644 --- a/samples/subsys/mgmt/osdp/control_panel/src/main.c +++ b/samples/subsys/mgmt/osdp/control_panel/src/main.c @@ -12,7 +12,7 @@ /* The devicetree node identifier for the "led0" alias. */ #define LED0_NODE DT_ALIAS(led0) -#if !DT_NODE_HAS_STATUS(LED0_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(LED0_NODE) #error "BOARD does not define a debug LED" #endif diff --git a/samples/subsys/mgmt/osdp/peripheral_device/src/main.c b/samples/subsys/mgmt/osdp/peripheral_device/src/main.c index 8ffdd10f0810f..74d4fed6d2c87 100644 --- a/samples/subsys/mgmt/osdp/peripheral_device/src/main.c +++ b/samples/subsys/mgmt/osdp/peripheral_device/src/main.c @@ -12,7 +12,7 @@ /* The devicetree node identifier for the "led0" alias. */ #define LED0_NODE DT_ALIAS(led0) -#if !DT_NODE_HAS_STATUS(LED0_NODE, okay) +#if !DT_NODE_HAS_STATUS_OKAY(LED0_NODE) #error "BOARD does not define a debug LED" #endif diff --git a/samples/subsys/task_wdt/src/main.c b/samples/subsys/task_wdt/src/main.c index f06ef1faef299..a366b3683eba8 100644 --- a/samples/subsys/task_wdt/src/main.c +++ b/samples/subsys/task_wdt/src/main.c @@ -21,7 +21,7 @@ * from there. Otherwise, the task watchdog will be used without a * hardware watchdog fallback. */ -#if DT_NODE_HAS_STATUS(DT_ALIAS(watchdog0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(watchdog0)) #define WDT_NODE DT_ALIAS(watchdog0) #elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_window_watchdog) #define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(st_stm32_window_watchdog) diff --git a/soc/arm/beetle/power.c b/soc/arm/beetle/power.c index 4377d79d3f0fd..700969f467353 100644 --- a/soc/arm/beetle/power.c +++ b/soc/arm/beetle/power.c @@ -11,13 +11,13 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0)) #define CLK_BIT_GPIO0 _BEETLE_GPIO0 #else #define CLK_BIT_GPIO0 0 #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) #define CLK_BIT_GPIO1 _BEETLE_GPIO1 #else #define CLK_BIT_GPIO1 0 @@ -25,13 +25,13 @@ #define AHB_CLK_BITS (CLK_BIT_GPIO0 | CLK_BIT_GPIO1) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(timer0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(timer0)) #define CLK_BIT_TIMER0 _BEETLE_TIMER0 #else #define CLK_BIT_TIMER0 0 #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(timer1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(timer1)) #define CLK_BIT_TIMER1 _BEETLE_TIMER1 #else #define CLK_BIT_TIMER1 0 @@ -43,13 +43,13 @@ #define CLK_BIT_WDOG 0 #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart0)) #define CLK_BIT_UART0 _BEETLE_UART0 #else #define CLK_BIT_UART0 0 #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) #define CLK_BIT_UART1 _BEETLE_UART1 #else #define CLK_BIT_UART1 0 diff --git a/soc/atmel/sam/common/soc_power.c b/soc/atmel/sam/common/soc_power.c index 08499b98b102e..0b477f9fbe9c1 100644 --- a/soc/atmel/sam/common/soc_power.c +++ b/soc/atmel/sam/common/soc_power.c @@ -12,7 +12,7 @@ #endif #if defined(CONFIG_REBOOT) -#if DT_NODE_HAS_STATUS(SAM_DT_RSTC_DRIVER, okay) +#if DT_NODE_HAS_STATUS_OKAY(SAM_DT_RSTC_DRIVER) void sys_arch_reboot(int type) { @@ -33,5 +33,5 @@ void sys_arch_reboot(int type) } } -#endif /* DT_NODE_HAS_STATUS */ +#endif /* DT_NODE_HAS_STATUS_OKAY */ #endif /* CONFIG_REBOOT */ diff --git a/soc/intel/intel_adsp/common/clk.c b/soc/intel/intel_adsp/common/clk.c index b32071bab78b5..66c8620219856 100644 --- a/soc/intel/intel_adsp/common/clk.c +++ b/soc/intel/intel_adsp/common/clk.c @@ -129,10 +129,10 @@ struct adsp_clock_source_desc adsp_clk_src_info[ADSP_CLOCK_SOURCE_COUNT] = { */ [ADSP_CLOCK_SOURCE_XTAL_OSC] = { CONFIG_DAI_DMIC_HW_IOCLK }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(audioclk), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(audioclk)) [ADSP_CLOCK_SOURCE_AUDIO_CARDINAL] = { DT_PROP(DT_NODELABEL(audioclk), clock_frequency) }, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pllclk), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pllclk)) [ADSP_CLOCK_SOURCE_AUDIO_PLL_FIXED] = { DT_PROP(DT_NODELABEL(pllclk), clock_frequency) }, #endif [ADSP_CLOCK_SOURCE_MLCK_INPUT] = { 0 }, diff --git a/soc/intel/intel_adsp/common/include/adsp_clk.h b/soc/intel/intel_adsp/common/include/adsp_clk.h index ccfb5cdc7e7ad..591116c5561ed 100644 --- a/soc/intel/intel_adsp/common/include/adsp_clk.h +++ b/soc/intel/intel_adsp/common/include/adsp_clk.h @@ -64,10 +64,10 @@ struct adsp_cpu_clock_info *adsp_cpu_clocks_get(void); /* Clock sources used by dai */ #define ADSP_CLOCK_SOURCE_XTAL_OSC 0 -#if DT_NODE_HAS_STATUS(DT_NODELABEL(audioclk), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(audioclk)) #define ADSP_CLOCK_SOURCE_AUDIO_CARDINAL 1 #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pllclk), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pllclk)) #define ADSP_CLOCK_SOURCE_AUDIO_PLL_FIXED 2 #endif diff --git a/soc/intel/intel_adsp/common/mem_window.c b/soc/intel/intel_adsp/common/mem_window.c index 8ca591deb36ab..ae5abcb77bf79 100644 --- a/soc/intel/intel_adsp/common/mem_window.c +++ b/soc/intel/intel_adsp/common/mem_window.c @@ -58,15 +58,15 @@ void mem_window_idle_exit(void) &mem_win_config_##n, PRE_KERNEL_1, \ CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL); -#if DT_NODE_HAS_STATUS(MEM_WINDOW_NODE(0), okay) +#if DT_NODE_HAS_STATUS_OKAY(MEM_WINDOW_NODE(0)) MEM_WINDOW_DEFINE(0) #endif -#if DT_NODE_HAS_STATUS(MEM_WINDOW_NODE(1), okay) +#if DT_NODE_HAS_STATUS_OKAY(MEM_WINDOW_NODE(1)) MEM_WINDOW_DEFINE(1) #endif -#if DT_NODE_HAS_STATUS(MEM_WINDOW_NODE(2), okay) +#if DT_NODE_HAS_STATUS_OKAY(MEM_WINDOW_NODE(2)) MEM_WINDOW_DEFINE(2) #endif -#if DT_NODE_HAS_STATUS(MEM_WINDOW_NODE(3), okay) +#if DT_NODE_HAS_STATUS_OKAY(MEM_WINDOW_NODE(3)) MEM_WINDOW_DEFINE(3) #endif diff --git a/soc/ite/ec/it8xxx2/soc.c b/soc/ite/ec/it8xxx2/soc.c index 0f2501111be86..2c2660ac3b187 100644 --- a/soc/ite/ec/it8xxx2/soc.c +++ b/soc/ite/ec/it8xxx2/soc.c @@ -403,7 +403,7 @@ static int ite_it8xxx2_init(void) IT8XXX2_EGPIO_EGCR |= IT8XXX2_EGPIO_EEPODD; #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) /* UART1 board init */ /* bit2: clocks to UART1 modules are not gated. */ IT8XXX2_ECPM_CGCTRL3R &= ~BIT(2); @@ -417,9 +417,9 @@ static int ite_it8xxx2_init(void) /* switch UART1 on without hardware flow control */ gpio_regs->GPIO_GCR1 |= IT8XXX2_GPIO_U1CTRL_SIN0_SOUT0_EN; -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) /* UART2 board init */ /* setting voltage 3.3v */ gpio_regs->GPIO_GCR21 &= ~(IT8XXX2_GPIO_GPH1VS | IT8XXX2_GPIO_GPH2VS); @@ -435,7 +435,7 @@ static int ite_it8xxx2_init(void) /* switch UART2 on without hardware flow control */ gpio_regs->GPIO_GCR1 |= IT8XXX2_GPIO_U2CTRL_SIN1_SOUT1_EN; -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) */ #if (SOC_USBPD_ITE_PHY_PORT_COUNT > 0) int port; diff --git a/soc/microchip/mec/common/soc_dt.h b/soc/microchip/mec/common/soc_dt.h index cfaa8821da949..39f772f964f17 100644 --- a/soc/microchip/mec/common/soc_dt.h +++ b/soc/microchip/mec/common/soc_dt.h @@ -35,7 +35,7 @@ #define MCHP_DT_ESPI_VW_FLAG_RST_SRC_MSK0 0x7 #define MCHP_DT_NODE_FROM_VWTABLE(name) DT_CHILD(DT_PATH(mchp_xec_espi_vw_routing), name) -#define MCHP_DT_VW_NODE_HAS_STATUS(name) DT_NODE_HAS_STATUS(MCHP_DT_NODE_FROM_VWTABLE(name), okay) +#define MCHP_DT_VW_NODE_HAS_STATUS(name) DT_NODE_HAS_STATUS_OKAY(MCHP_DT_NODE_FROM_VWTABLE(name)) /* Macro to store eSPI virtual wire DT flags * b[0] = DT status property 0 is disabled, 1 enabled, diff --git a/soc/microchip/mec/mec172x/device_power.c b/soc/microchip/mec/mec172x/device_power.c index 8a35d6ddd00ef..eab5bfb04196a 100644 --- a/soc/microchip/mec/mec172x/device_power.c +++ b/soc/microchip/mec/mec172x/device_power.c @@ -93,14 +93,14 @@ void soc_deep_sleep_non_wake_dis(void) void soc_deep_sleep_wake_en(void) { #if defined(CONFIG_KSCAN) || \ - (!defined(CONFIG_PM_DEVICE) && DT_NODE_HAS_STATUS(DT_NODELABEL(ps2_0), okay)) + (!defined(CONFIG_PM_DEVICE) && DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ps2_0))) struct ecia_named_regs *regs = ECIA_XEC_REG_BASE; #if defined(CONFIG_KSCAN) /* Enable PLL wake via KSCAN */ regs->GIRQ21.SRC = MCHP_KEYSCAN_GIRQ_BIT; regs->GIRQ21.EN_SET = MCHP_KEYSCAN_GIRQ_BIT; #endif -#if !defined(CONFIG_PM_DEVICE) && DT_NODE_HAS_STATUS(DT_NODELABEL(ps2_0), okay) +#if !defined(CONFIG_PM_DEVICE) && DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ps2_0)) /* Enable PS2_0B_WK */ regs->GIRQ21.SRC = MCHP_PS2_0_PORT0B_WK_GIRQ_BIT; regs->GIRQ21.EN_SET = MCHP_PS2_0_PORT0B_WK_GIRQ_BIT; @@ -110,7 +110,7 @@ void soc_deep_sleep_wake_en(void) void soc_deep_sleep_wake_dis(void) { -#if !defined(CONFIG_PM_DEVICE) && DT_NODE_HAS_STATUS(DT_NODELABEL(ps2_0), okay) +#if !defined(CONFIG_PM_DEVICE) && DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ps2_0)) struct ecia_named_regs *regs = ECIA_XEC_REG_BASE; /* Enable PS2_0B_WK */ diff --git a/soc/nordic/common/nrf54hx_nrf92x_mpu_regions.c b/soc/nordic/common/nrf54hx_nrf92x_mpu_regions.c index 66659588411e4..b76fac86bcd3d 100644 --- a/soc/nordic/common/nrf54hx_nrf92x_mpu_regions.c +++ b/soc/nordic/common/nrf54hx_nrf92x_mpu_regions.c @@ -28,15 +28,15 @@ static struct arm_mpu_region mpu_regions[] = { REGION_RAM_ATTR(CONFIG_SRAM_BASE_ADDRESS, CONFIG_SRAM_SIZE * 1024)), -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usbhs), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usbhs)) MPU_REGION_ENTRY("USBHS_CORE", USBHS_BASE, REGION_RAM_NOCACHE_ATTR(USBHS_BASE, USBHS_SIZE)), #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(can120), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(can120)) MPU_REGION_ENTRY("CAN120_MCAN", CAN120_BASE, REGION_RAM_NOCACHE_ATTR(CAN120_BASE, CAN120_SIZE)), #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(can121), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(can121)) MPU_REGION_ENTRY("CAN121_MCAN", CAN121_BASE, REGION_RAM_NOCACHE_ATTR(CAN121_BASE, CAN121_SIZE)), #endif diff --git a/soc/nordic/nrf52/soc.c b/soc/nordic/nrf52/soc.c index 3262b84bc85d7..4bb3b8640e583 100644 --- a/soc/nordic/nrf52/soc.c +++ b/soc/nordic/nrf52/soc.c @@ -37,7 +37,7 @@ static int nordicsemi_nrf52_init(void) nrf_power_dcdcen_set(NRF_POWER, true); #endif #if NRF_POWER_HAS_DCDCEN_VDDH && (defined(CONFIG_SOC_DCDC_NRF52X_HV) || \ - DT_NODE_HAS_STATUS(DT_INST(0, nordic_nrf52x_regulator_hv), okay)) + DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nordic_nrf52x_regulator_hv))) nrf_power_dcdcen_vddh_set(NRF_POWER, true); #endif diff --git a/soc/nordic/nrf53/soc.c b/soc/nordic/nrf53/soc.c index 35a13be1b9a44..cbdb8e04fe0fe 100644 --- a/soc/nordic/nrf53/soc.c +++ b/soc/nordic/nrf53/soc.c @@ -558,7 +558,7 @@ static int nordicsemi_nrf53_init(void) (DT_PROP(DT_NODELABEL(vregradio), regulator_initial_mode) == NRF5X_REG_MODE_DCDC) nrf_regulators_vreg_enable_set(NRF_REGULATORS, NRF_REGULATORS_VREG_RADIO, true); #endif -#if defined(CONFIG_SOC_DCDC_NRF53X_HV) || DT_NODE_HAS_STATUS(DT_NODELABEL(vregh), okay) +#if defined(CONFIG_SOC_DCDC_NRF53X_HV) || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(vregh)) nrf_regulators_vreg_enable_set(NRF_REGULATORS, NRF_REGULATORS_VREG_HIGH, true); #endif diff --git a/soc/nordic/nrf54h/soc.c b/soc/nordic/nrf54h/soc.c index 2699a3ebd5406..4ffb17bef51a6 100644 --- a/soc/nordic/nrf54h/soc.c +++ b/soc/nordic/nrf54h/soc.c @@ -143,7 +143,7 @@ static int nordicsemi_nrf54h_init(void) return err; } -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ccm030), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ccm030)) /* DMASEC is set to non-secure by default, which prevents CCM from * accessing secure memory. Change DMASEC to secure. */ diff --git a/soc/nordic/nrf92/soc.c b/soc/nordic/nrf92/soc.c index 1a40bb58ddae1..d9a54e4f1aa6a 100644 --- a/soc/nordic/nrf92/soc.c +++ b/soc/nordic/nrf92/soc.c @@ -93,7 +93,7 @@ static int nordicsemi_nrf92_init(void) trim_hsfll(); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ccm030), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ccm030)) /* DMASEC is set to non-secure by default, which prevents CCM from * accessing secure memory. Change DMASEC to secure. */ diff --git a/soc/nordic/validate_enabled_instances.c b/soc/nordic/validate_enabled_instances.c index b3e4dd70bbf1b..afcfc6e8ca837 100644 --- a/soc/nordic/validate_enabled_instances.c +++ b/soc/nordic/validate_enabled_instances.c @@ -7,16 +7,16 @@ #include #define I2C_ENABLED(idx) (IS_ENABLED(CONFIG_I2C) && \ - DT_NODE_HAS_STATUS(DT_NODELABEL(i2c##idx), okay)) + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c##idx))) #define SPI_ENABLED(idx) (IS_ENABLED(CONFIG_SPI) && \ - DT_NODE_HAS_STATUS(DT_NODELABEL(spi##idx), okay)) + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(spi##idx))) #define UART_ENABLED(idx) (IS_ENABLED(CONFIG_SERIAL) && \ (IS_ENABLED(CONFIG_SOC_SERIES_NRF53X) || \ IS_ENABLED(CONFIG_SOC_SERIES_NRF54LX) || \ IS_ENABLED(CONFIG_SOC_SERIES_NRF91X)) && \ - DT_NODE_HAS_STATUS(DT_NODELABEL(uart##idx), okay)) + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart##idx))) /* * In most Nordic SoCs, SPI and TWI peripherals with the same instance number diff --git a/soc/nxp/imx/imx6sx/soc.c b/soc/nxp/imx/imx6sx/soc.c index 11cbac10002ef..516c2e9bcf62a 100644 --- a/soc/nxp/imx/imx6sx/soc.c +++ b/soc/nxp/imx/imx6sx/soc.c @@ -23,55 +23,55 @@ static void SOC_RdcInit(void) RDC_DOMAIN_PERM(M4_DOMAIN_ID, RDC_DOMAIN_PERM_RW), false, false); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) /* Set access to UART_1 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapUart1, RDC_DT_VAL(uart1), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) /* Set access to UART_2 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapUart2, RDC_DT_VAL(uart2), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) /* Set access to UART_3 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapUart3, RDC_DT_VAL(uart3), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) /* Set access to UART_4 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapUart4, RDC_DT_VAL(uart4), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart5)) /* Set access to UART_5 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapUart5, RDC_DT_VAL(uart5), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart6), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart6)) /* Set access to UART_6 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapUart6, RDC_DT_VAL(uart6), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) /* Set access to GPIO_1 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapGpio1, RDC_DT_VAL(gpio1), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio2)) /* Set access to GPIO_2 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapGpio2, RDC_DT_VAL(gpio2), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio3)) /* Set access to GPIO_3 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapGpio3, RDC_DT_VAL(gpio3), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio4)) /* Set access to GPIO_4 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapGpio4, RDC_DT_VAL(gpio4), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio5)) /* Set access to GPIO_5 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapGpio5, RDC_DT_VAL(gpio5), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio6), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio6)) /* Set access to GPIO_6 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapGpio6, RDC_DT_VAL(gpio6), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio7), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio7)) /* Set access to GPIO_7 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapGpio7, RDC_DT_VAL(gpio7), false, false); #endif @@ -81,69 +81,69 @@ static void SOC_RdcInit(void) RDC_SetPdapAccess(RDC, rdcPdapMuB, RDC_DT_VAL(mub), false, false); #endif /* CONFIG_IPM_IMX */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(epit1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(epit1)) /* Set access to EPIT_1 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapEpit1, RDC_DT_VAL(epit1), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(epit2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(epit2)) /* Set access to EPIT_2 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapEpit2, RDC_DT_VAL(epit2), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c1)) /* Set access to I2C-1 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapI2c1, RDC_DT_VAL(i2c1), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c2)) /* Set access to I2C-2 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapI2c2, RDC_DT_VAL(i2c2), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c3)) /* Set access to I2C-3 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapI2c3, RDC_DT_VAL(i2c3), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c4)) /* Set access to I2C-4 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapI2c4, RDC_DT_VAL(i2c4), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm1)) /* Set access to PWM-1 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapPwm1, RDC_DT_VAL(pwm1), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm2)) /* Set access to PWM-2 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapPwm2, RDC_DT_VAL(pwm2), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm3)) /* Set access to PWM-3 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapPwm3, RDC_DT_VAL(pwm3), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm4)) /* Set access to PWM-4 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapPwm4, RDC_DT_VAL(pwm4), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm5)) /* Set access to PWM-5 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapPwm5, RDC_DT_VAL(pwm5), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm6), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm6)) /* Set access to PWM-6 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapPwm6, RDC_DT_VAL(pwm6), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm7), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm7)) /* Set access to PWM-7 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapPwm7, RDC_DT_VAL(pwm7), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm8), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm8)) /* Set access to PWM-8 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapPwm8, RDC_DT_VAL(pwm8), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(adc1)) /* Set access to ADC-1 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapAdc1, RDC_DT_VAL(adc1), false, false); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(adc2)) /* Set access to ADC-2 for M4 core */ RDC_SetPdapAccess(RDC, rdcPdapAdc2, RDC_DT_VAL(adc2), false, false); #endif @@ -213,10 +213,10 @@ static void SOC_ClockInit(void) CCM_SetRootDivider(CCM, ccmRootPerclkPodf, 0); /* Enable EPIT clocks */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(epit1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(epit1)) CCM_ControlGate(CCM, ccmCcgrGateEpit1Clk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(epit2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(epit2)) CCM_ControlGate(CCM, ccmCcgrGateEpit2Clk, ccmClockNeededAll); #endif #endif /* CONFIG_COUNTER_IMX_EPIT */ @@ -229,16 +229,16 @@ static void SOC_ClockInit(void) CCM_SetRootDivider(CCM, ccmRootPerclkPodf, 0); /* Enable I2C clock */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c1)) CCM_ControlGate(CCM, ccmCcgrGateI2c1Serialclk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c2)) CCM_ControlGate(CCM, ccmCcgrGateI2c2Serialclk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c3)) CCM_ControlGate(CCM, ccmCcgrGateI2c3Serialclk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c4)) CCM_ControlGate(CCM, ccmCcgrGateI2c4Serialclk, ccmClockNeededAll); #endif #endif /* CONFIG_I2C_IMX */ @@ -251,28 +251,28 @@ static void SOC_ClockInit(void) CCM_SetRootDivider(CCM, ccmRootPerclkPodf, 0); /* Enable PWM clock */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm1)) CCM_ControlGate(CCM, ccmCcgrGatePwm1Clk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm2)) CCM_ControlGate(CCM, ccmCcgrGatePwm2Clk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm3)) CCM_ControlGate(CCM, ccmCcgrGatePwm3Clk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm4)) CCM_ControlGate(CCM, ccmCcgrGatePwm4Clk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm5)) CCM_ControlGate(CCM, ccmCcgrGatePwm5Clk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm6), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm6)) CCM_ControlGate(CCM, ccmCcgrGatePwm6Clk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm7), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm7)) CCM_ControlGate(CCM, ccmCcgrGatePwm7Clk, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm8), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm8)) CCM_ControlGate(CCM, ccmCcgrGatePwm8Clk, ccmClockNeededAll); #endif #endif /* CONFIG_PWM_IMX */ diff --git a/soc/nxp/imx/imx7d/soc.c b/soc/nxp/imx/imx7d/soc.c index df3ee95f2e134..780c405a0bb95 100644 --- a/soc/nxp/imx/imx7d/soc.c +++ b/soc/nxp/imx/imx7d/soc.c @@ -57,21 +57,21 @@ void SOC_RdcInit(void) static void nxp_mcimx7_gpio_config(void) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) RDC_SetPdapAccess(RDC, rdcPdapGpio1, RDC_DT_VAL(gpio1), false, false); /* Enable gpio clock gate */ CCM_ControlGate(CCM, ccmCcgrGateGpio1, ccmClockNeededRunWait); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio2)) RDC_SetPdapAccess(RDC, rdcPdapGpio2, RDC_DT_VAL(gpio2), false, false); /* Enable gpio clock gate */ CCM_ControlGate(CCM, ccmCcgrGateGpio2, ccmClockNeededRunWait); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio7), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio7)) RDC_SetPdapAccess(RDC, rdcPdapGpio7, RDC_DT_VAL(gpio7), false, false); /* Enable gpio clock gate */ CCM_ControlGate(CCM, ccmCcgrGateGpio7, ccmClockNeededRunWait); @@ -84,7 +84,7 @@ static void nxp_mcimx7_gpio_config(void) static void nxp_mcimx7_uart_config(void) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) /* We need to grasp board uart exclusively */ RDC_SetPdapAccess(RDC, rdcPdapUart2, RDC_DT_VAL(uart2), false, false); /* Select clock derived from OSC clock(24M) */ @@ -99,7 +99,7 @@ static void nxp_mcimx7_uart_config(void) CCM_ControlGate(CCM, ccmCcgrGateUart2, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart6), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart6)) /* We need to grasp board uart exclusively */ RDC_SetPdapAccess(RDC, rdcPdapUart6, RDC_DT_VAL(uart6), false, false); /* Select clock derived from OSC clock(24M) */ @@ -121,7 +121,7 @@ static void nxp_mcimx7_uart_config(void) static void nxp_mcimx7_i2c_config(void) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c1)) /* In this example, we need to grasp board I2C exclusively */ RDC_SetPdapAccess(RDC, rdcPdapI2c1, RDC_DT_VAL(i2c1), false, false); /* Select I2C clock derived from OSC clock(24M) */ @@ -131,7 +131,7 @@ static void nxp_mcimx7_i2c_config(void) CCM_ControlGate(CCM, ccmCcgrGateI2c1, ccmClockNeededRunWait); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c2)) /* In this example, we need to grasp board I2C exclusively */ RDC_SetPdapAccess(RDC, rdcPdapI2c2, RDC_DT_VAL(i2c2), false, false); /* Select I2C clock derived from OSC clock(24M) */ @@ -141,7 +141,7 @@ static void nxp_mcimx7_i2c_config(void) CCM_ControlGate(CCM, ccmCcgrGateI2c2, ccmClockNeededRunWait); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c3)) /* In this example, we need to grasp board I2C exclusively */ RDC_SetPdapAccess(RDC, rdcPdapI2c3, RDC_DT_VAL(i2c3), false, false); /* Select I2C clock derived from OSC clock(24M) */ @@ -151,7 +151,7 @@ static void nxp_mcimx7_i2c_config(void) CCM_ControlGate(CCM, ccmCcgrGateI2c3, ccmClockNeededRunWait); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c4)) /* In this example, we need to grasp board I2C exclusively */ RDC_SetPdapAccess(RDC, rdcPdapI2c4, RDC_DT_VAL(i2c4), false, false); /* Select I2C clock derived from OSC clock(24M) */ @@ -168,7 +168,7 @@ static void nxp_mcimx7_i2c_config(void) static void nxp_mcimx7_pwm_config(void) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm1)) /* We need to grasp board pwm exclusively */ RDC_SetPdapAccess(RDC, rdcPdapPwm1, RDC_DT_VAL(pwm1), false, false); /* Select clock derived from OSC clock(24M) */ @@ -178,7 +178,7 @@ static void nxp_mcimx7_pwm_config(void) CCM_ControlGate(CCM, ccmCcgrGatePwm1, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm2)) /* We need to grasp board pwm exclusively */ RDC_SetPdapAccess(RDC, rdcPdapPwm2, RDC_DT_VAL(pwm2), false, false); /* Select clock derived from OSC clock(24M) */ @@ -188,7 +188,7 @@ static void nxp_mcimx7_pwm_config(void) CCM_ControlGate(CCM, ccmCcgrGatePwm2, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm3)) /* We need to grasp board pwm exclusively */ RDC_SetPdapAccess(RDC, rdcPdapPwm3, RDC_DT_VAL(pwm3), false, false); /* Select clock derived from OSC clock(24M) */ @@ -198,7 +198,7 @@ static void nxp_mcimx7_pwm_config(void) CCM_ControlGate(CCM, ccmCcgrGatePwm3, ccmClockNeededAll); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm4)) /* We need to grasp board pwm exclusively */ RDC_SetPdapAccess(RDC, rdcPdapPwm4, RDC_DT_VAL(pwm4), false, false); /* Select clock derived from OSC clock(24M) */ diff --git a/soc/nxp/imx/imx8m/a53/soc.c b/soc/nxp/imx/imx8m/a53/soc.c index a20ae395f18dc..a110213e2b635 100644 --- a/soc/nxp/imx/imx8m/a53/soc.c +++ b/soc/nxp/imx/imx8m/a53/soc.c @@ -12,7 +12,7 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_NODELABEL(rdc), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(rdc)) #define rdc_inst ((RDC_Type *)DT_REG_ADDR(DT_NODELABEL(rdc))) @@ -28,19 +28,19 @@ static void soc_rdc_init(void) RDC_GetDefaultPeriphAccessConfig(&periphConfig); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(uart2), rdc) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) && DT_NODE_HAS_PROP(DT_NODELABEL(uart2), rdc) periphConfig.periph = kRDC_Periph_UART2; periphConfig.policy = RDC_DT_VAL(uart2); RDC_SetPeriphAccessConfig(rdc_inst, &periphConfig); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(uart4), rdc) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) && DT_NODE_HAS_PROP(DT_NODELABEL(uart4), rdc) periphConfig.periph = kRDC_Periph_UART4; periphConfig.policy = RDC_DT_VAL(uart4); RDC_SetPeriphAccessConfig(rdc_inst, &periphConfig); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) && DT_NODE_HAS_PROP(DT_NODELABEL(enet), rdc) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet)) && DT_NODE_HAS_PROP(DT_NODELABEL(enet), rdc) periphConfig.periph = kRDC_Periph_ENET1; periphConfig.policy = RDC_DT_VAL(enet); RDC_SetPeriphAccessConfig(rdc_inst, &periphConfig); diff --git a/soc/nxp/imx/imx8m/m4_mini/soc.c b/soc/nxp/imx/imx8m/m4_mini/soc.c index 784c39fcc0479..b809a900e11f4 100644 --- a/soc/nxp/imx/imx8m/m4_mini/soc.c +++ b/soc/nxp/imx/imx8m/m4_mini/soc.c @@ -104,25 +104,25 @@ static void SOC_ClockInit(void) CLOCK_SetRootMux(kCLOCK_RootAudioAhb, kCLOCK_AudioAhbRootmuxSysPll1); #if defined(CONFIG_UART_MCUX_IUART) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart1, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootUart1, 1U, 1U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart2, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootUart2, 1U, 1U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart3, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootUart3, 1U, 1U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart4, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ diff --git a/soc/nxp/imx/imx8m/m4_quad/soc.c b/soc/nxp/imx/imx8m/m4_quad/soc.c index 031121bc42467..eea984fc172af 100644 --- a/soc/nxp/imx/imx8m/m4_quad/soc.c +++ b/soc/nxp/imx/imx8m/m4_quad/soc.c @@ -67,25 +67,25 @@ static void SOC_ClockInit(void) CLOCK_SetRootMux(kCLOCK_RootM4, kCLOCK_M4RootmuxSysPll1Div3); #if defined(CONFIG_UART_MCUX_IUART) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart1, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootUart1, 1U, 1U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart2, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootUart2, 1U, 1U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart3, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootUart3, 1U, 1U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart4, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ diff --git a/soc/nxp/imx/imx8m/m7/soc.c b/soc/nxp/imx/imx8m/m7/soc.c index 683d550b14995..7cd42b3bb5d75 100644 --- a/soc/nxp/imx/imx8m/m7/soc.c +++ b/soc/nxp/imx/imx8m/m7/soc.c @@ -107,25 +107,25 @@ static void SOC_ClockInit(void) CLOCK_SetRootMux(kCLOCK_RootAhb, kCLOCK_AhbRootmuxSysPll1Div6); #if defined(CONFIG_UART_MCUX_IUART) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart1, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootUart1, 1U, 1U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart2)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart2, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootUart2, 1U, 1U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart3)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart3, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootUart3, 1U, 1U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart4)) /* Set UART source to SysPLL1 Div10 80MHZ */ CLOCK_SetRootMux(kCLOCK_RootUart4, kCLOCK_UartRootmuxSysPll1Div10); /* Set root clock to 80MHZ/ 1= 80MHZ */ @@ -134,21 +134,21 @@ static void SOC_ClockInit(void) #endif #if defined(CONFIG_SPI_MCUX_ECSPI) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ecspi1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ecspi1)) /* Set ECSPI1 source to SYSTEM PLL1 800MHZ */ CLOCK_SetRootMux(kCLOCK_RootEcspi1, kCLOCK_EcspiRootmuxSysPll1); /* Set root clock to 800MHZ / 10 = 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootEcspi1, 2U, 5U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ecspi2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ecspi2)) /* Set ECSPI2 source to SYSTEM PLL1 800MHZ */ CLOCK_SetRootMux(kCLOCK_RootEcspi2, kCLOCK_EcspiRootmuxSysPll1); /* Set root clock to 800MHZ / 10 = 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootEcspi2, 2U, 5U); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ecspi3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ecspi3)) /* Set ECSPI3 source to SYSTEM PLL1 800MHZ */ CLOCK_SetRootMux(kCLOCK_RootEcspi3, kCLOCK_EcspiRootmuxSysPll1); /* Set root clock to 800MHZ / 10 = 80MHZ */ @@ -175,27 +175,27 @@ static void gpio_init(void) { #if defined(CONFIG_GPIO_MCUX_IGPIO) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio1)) CLOCK_EnableClock(kCLOCK_Gpio1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio2)) CLOCK_EnableClock(kCLOCK_Gpio2); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio3)) CLOCK_EnableClock(kCLOCK_Gpio3); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio4), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio4)) CLOCK_EnableClock(kCLOCK_Gpio4); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpio5), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio5)) CLOCK_EnableClock(kCLOCK_Gpio5); diff --git a/soc/nxp/imxrt/imxrt10xx/flexspi.c b/soc/nxp/imxrt/imxrt10xx/flexspi.c index a6a6239e9e740..5f288747c1a3e 100644 --- a/soc/nxp/imxrt/imxrt10xx/flexspi.c +++ b/soc/nxp/imxrt/imxrt10xx/flexspi.c @@ -28,7 +28,7 @@ uint32_t flexspi_clock_set_freq(uint32_t clock_name, uint32_t rate) div_sel = kCLOCK_FlexspiDiv; clk_name = kCLOCK_FlexSpi; break; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexspi2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexspi2)) case IMX_CCM_FLEXSPI2_CLK: /* Get clock root frequency */ root_rate = CLOCK_GetClockRootFreq(kCLOCK_Flexspi2ClkRoot) * diff --git a/soc/nxp/imxrt/imxrt10xx/soc.c b/soc/nxp/imxrt/imxrt10xx/soc.c index d8a11dafd3496..941ae1d34747f 100644 --- a/soc/nxp/imxrt/imxrt10xx/soc.c +++ b/soc/nxp/imxrt/imxrt10xx/soc.c @@ -67,10 +67,10 @@ const clock_enet_pll_config_t ethPllConfig = { .enableClkOutput500M = true, #endif #if defined(CONFIG_ETH_NXP_ENET) || defined(CONFIG_ETH_MCUX) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet)) .enableClkOutput = true, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet2)) .enableClkOutput1 = true, #endif #endif @@ -79,10 +79,10 @@ const clock_enet_pll_config_t ethPllConfig = { #else .enableClkOutput25M = false, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet)) .loopDivider = 1, #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet2)) .loopDivider1 = 1, #endif }; @@ -226,7 +226,7 @@ static ALWAYS_INLINE void clock_init(void) #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) && CONFIG_NET_L2_ETHERNET +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet)) && CONFIG_NET_L2_ETHERNET #if CONFIG_ETH_MCUX_RMII_EXT_CLK /* Enable clock input for ENET1 */ IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET1TxClkOutputDir, false); @@ -236,43 +236,43 @@ static ALWAYS_INLINE void clock_init(void) #endif #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet2), okay) && CONFIG_NET_L2_ETHERNET +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet2)) && CONFIG_NET_L2_ETHERNET /* Set ENET2 ref clock to be generated by External OSC,*/ /* direction as output and frequency to 50MHz */ IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET2TxClkOutputDir | kIOMUXC_GPR_ENET2RefClkMode, true); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb1), okay) && \ +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && \ (CONFIG_USB_DC_NXP_EHCI || CONFIG_UDC_NXP_EHCI) CLOCK_EnableUsbhs0PhyPllClock(kCLOCK_Usb480M, DT_PROP_BY_PHANDLE(DT_NODELABEL(usb1), clocks, clock_frequency)); CLOCK_EnableUsbhs0Clock(kCLOCK_Usb480M, DT_PROP_BY_PHANDLE(DT_NODELABEL(usb1), clocks, clock_frequency)); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb1), okay) && CONFIG_USB_DC_NXP_EHCI +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && CONFIG_USB_DC_NXP_EHCI USB_EhciPhyInit(kUSB_ControllerEhci0, CPU_XTAL_CLK_HZ, &usbPhyConfig); #endif #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb2), okay) && \ +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb2)) && \ (CONFIG_USB_DC_NXP_EHCI || CONFIG_UDC_NXP_EHCI) CLOCK_EnableUsbhs1PhyPllClock(kCLOCK_Usb480M, DT_PROP_BY_PHANDLE(DT_NODELABEL(usb2), clocks, clock_frequency)); CLOCK_EnableUsbhs1Clock(kCLOCK_Usb480M, DT_PROP_BY_PHANDLE(DT_NODELABEL(usb2), clocks, clock_frequency)); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb1), okay) && CONFIG_USB_DC_NXP_EHCI +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && CONFIG_USB_DC_NXP_EHCI USB_EhciPhyInit(kUSB_ControllerEhci1, CPU_XTAL_CLK_HZ, &usbPhyConfig); #endif #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc1), okay) && CONFIG_IMX_USDHC +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc1)) && CONFIG_IMX_USDHC /* Configure USDHC clock source and divider */ CLOCK_InitSysPfd(kCLOCK_Pfd0, 24U); CLOCK_SetDiv(kCLOCK_Usdhc1Div, 1U); CLOCK_SetMux(kCLOCK_Usdhc1Mux, 1U); CLOCK_EnableClock(kCLOCK_Usdhc1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc2), okay) && CONFIG_IMX_USDHC +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc2)) && CONFIG_IMX_USDHC /* Configure USDHC clock source and divider */ CLOCK_InitSysPfd(kCLOCK_Pfd0, 24U); CLOCK_SetDiv(kCLOCK_Usdhc2Div, 1U); diff --git a/soc/nxp/imxrt/imxrt118x/soc.c b/soc/nxp/imxrt/imxrt118x/soc.c index 85299643de731..1809d6b4b0293 100644 --- a/soc/nxp/imxrt/imxrt118x/soc.c +++ b/soc/nxp/imxrt/imxrt118x/soc.c @@ -208,16 +208,16 @@ static ALWAYS_INLINE void clock_init(void) #endif #if defined(CONFIG_UART_MCUX_LPUART) && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart1), okay) \ - || DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart2), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart1)) \ + || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart2))) /* Configure LPUART0102 using SYS_PLL3_DIV2_CLK */ rootCfg.mux = kCLOCK_LPUART0102_ClockRoot_MuxSysPll3Div2; rootCfg.div = 10; #endif #if defined(CONFIG_I2C_MCUX_LPI2C) && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c1), okay) \ - || DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c2), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c1)) \ + || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c2))) /* Configure LPI2C0102 using SYS_PLL3_DIV2_CLK */ rootCfg.mux = kCLOCK_LPI2C0102_ClockRoot_MuxSysPll3Div2; rootCfg.div = 4; @@ -225,8 +225,8 @@ static ALWAYS_INLINE void clock_init(void) #endif #if defined(CONFIG_I2C_MCUX_LPI2C) && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c3), okay) \ - || DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c4), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c3)) \ + || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c4))) /* Configure LPI2C0304 using SYS_PLL3_DIV2_CLK */ rootCfg.mux = kCLOCK_LPI2C0304_ClockRoot_MuxSysPll3Div2; rootCfg.div = 4; @@ -234,8 +234,8 @@ static ALWAYS_INLINE void clock_init(void) #endif #if defined(CONFIG_I2C_MCUX_LPI2C) && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c5), okay) \ - || DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c6), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c5)) \ + || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c6))) /* Configure LPI2C0506 using SYS_PLL3_DIV2_CLK */ rootCfg.mux = kCLOCK_LPI2C0506_ClockRoot_MuxSysPll3Div2; rootCfg.div = 4; @@ -243,8 +243,8 @@ static ALWAYS_INLINE void clock_init(void) #endif #if defined(CONFIG_SPI_MCUX_LPSPI) && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(lpspi1), okay) \ - || DT_NODE_HAS_STATUS(DT_NODELABEL(lpspi2), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpspi1)) \ + || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpspi2))) /* Configure LPSPI0102 using SYS_PLL3_PFD1_CLK */ rootCfg.mux = kCLOCK_LPSPI0102_ClockRoot_MuxSysPll3Pfd1; rootCfg.div = 2; @@ -253,28 +253,28 @@ static ALWAYS_INLINE void clock_init(void) #if defined(CONFIG_COUNTER_MCUX_GPT) -#if (DT_NODE_HAS_STATUS(DT_NODELABEL(gpt1), okay)) +#if (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpt1))) /* Configure GPT1 using SYS_PLL3_DIV2_CLK */ rootCfg.mux = kCLOCK_GPT1_ClockRoot_MuxSysPll3Div2; rootCfg.div = 1; CLOCK_SetRootClock(kCLOCK_Root_Gpt1, &rootCfg); -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpt1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpt1)) */ -#if (DT_NODE_HAS_STATUS(DT_NODELABEL(gpt2), okay)) +#if (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpt2))) /* Configure GPT2 using SYS_PLL3_DIV2_CLK */ rootCfg.mux = kCLOCK_GPT2_ClockRoot_MuxSysPll3Div2; rootCfg.div = 1; CLOCK_SetRootClock(kCLOCK_Root_Gpt2, &rootCfg); -#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpt2), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpt2)) */ #endif /* CONFIG_COUNTER_MCUX_GPT */ #ifdef CONFIG_MCUX_ACMP -#if (DT_NODE_HAS_STATUS(DT_NODELABEL(acmp1), okay) \ - || DT_NODE_HAS_STATUS(DT_NODELABEL(acmp2), okay) \ - || DT_NODE_HAS_STATUS(DT_NODELABEL(acmp3), okay) \ - || DT_NODE_HAS_STATUS(DT_NODELABEL(acmp4), okay)) +#if (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(acmp1)) \ + || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(acmp2)) \ + || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(acmp3)) \ + || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(acmp4))) /* Configure ACMP using MuxSysPll3Out */ rootCfg.mux = kCLOCK_ACMP_ClockRoot_MuxSysPll3Out; rootCfg.div = 2; diff --git a/soc/nxp/imxrt/imxrt11xx/soc.c b/soc/nxp/imxrt/imxrt11xx/soc.c index ae82e772b2cc3..02e35c2d105e9 100644 --- a/soc/nxp/imxrt/imxrt11xx/soc.c +++ b/soc/nxp/imxrt/imxrt11xx/soc.c @@ -409,7 +409,7 @@ static ALWAYS_INLINE void clock_init(void) #endif #if CONFIG_ETH_MCUX || CONFIG_ETH_NXP_ENET -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet)) /* 50 MHz ENET clock */ rootCfg.mux = kCLOCK_ENET1_ClockRoot_MuxSysPll1Div2; rootCfg.div = 10; @@ -424,7 +424,7 @@ static ALWAYS_INLINE void clock_init(void) (IOMUXC_GPR_GPR4_ENET_REF_CLK_DIR(0x01U) | IOMUXC_GPR_GPR4_ENET_TX_CLK_SEL(0x1U)); #endif #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet1g), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet1g)) rootCfg.mux = kCLOCK_ENET2_ClockRoot_MuxSysPll1Div2; #if DT_ENUM_HAS_VALUE(DT_CHILD(DT_NODELABEL(enet1g), ethernet), phy_connection_type, rgmii) /* 125 MHz ENET1G clock */ @@ -491,13 +491,13 @@ static ALWAYS_INLINE void clock_init(void) #endif #ifdef CONFIG_CAN_MCUX_FLEXCAN -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcan1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcan1)) /* Configure CAN1 using Osc48MDiv2 */ rootCfg.mux = kCLOCK_CAN1_ClockRoot_MuxOscRc48MDiv2; rootCfg.div = 1; CLOCK_SetRootClock(kCLOCK_Root_Can1, &rootCfg); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcan3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcan3)) /* Configure CAN1 using Osc48MDiv2 */ rootCfg.mux = kCLOCK_CAN3_ClockRoot_MuxOscRc48MDiv2; rootCfg.div = 1; @@ -506,7 +506,7 @@ static ALWAYS_INLINE void clock_init(void) #endif #ifdef CONFIG_MCUX_ACMP -#if DT_NODE_HAS_STATUS(DT_NODELABEL(acmp1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(acmp1)) /* Configure ACMP1 using Osc48MDiv2*/ rootCfg.mux = kCLOCK_ACMP_ClockRoot_MuxOscRc48MDiv2; rootCfg.div = 1; @@ -532,28 +532,28 @@ static ALWAYS_INLINE void clock_init(void) CLOCK_SetRootClock(kCLOCK_Root_Gpt1, &rootCfg); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb1), okay) && (CONFIG_USB_DC_NXP_EHCI || CONFIG_UDC_NXP_EHCI) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && (CONFIG_USB_DC_NXP_EHCI || CONFIG_UDC_NXP_EHCI) CLOCK_EnableUsbhs0PhyPllClock( kCLOCK_Usb480M, DT_PROP_BY_PHANDLE(DT_NODELABEL(usb1), clocks, clock_frequency)); CLOCK_EnableUsbhs0Clock(kCLOCK_Usb480M, DT_PROP_BY_PHANDLE(DT_NODELABEL(usb1), clocks, clock_frequency)); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb1), okay) && CONFIG_USB_DC_NXP_EHCI +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && CONFIG_USB_DC_NXP_EHCI USB_EhciPhyInit(kUSB_ControllerEhci0, CPU_XTAL_CLK_HZ, &usbPhyConfig); #endif #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb2), okay) && (CONFIG_USB_DC_NXP_EHCI || CONFIG_UDC_NXP_EHCI) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb2)) && (CONFIG_USB_DC_NXP_EHCI || CONFIG_UDC_NXP_EHCI) CLOCK_EnableUsbhs1PhyPllClock( kCLOCK_Usb480M, DT_PROP_BY_PHANDLE(DT_NODELABEL(usb2), clocks, clock_frequency)); CLOCK_EnableUsbhs1Clock(kCLOCK_Usb480M, DT_PROP_BY_PHANDLE(DT_NODELABEL(usb2), clocks, clock_frequency)); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb1), okay) && CONFIG_USB_DC_NXP_EHCI +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && CONFIG_USB_DC_NXP_EHCI USB_EhciPhyInit(kUSB_ControllerEhci1, CPU_XTAL_CLK_HZ, &usbPhyConfig); #endif #endif #if CONFIG_IMX_USDHC -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc1)) /* Configure USDHC1 using SysPll2Pfd2*/ rootCfg.mux = kCLOCK_USDHC1_ClockRoot_MuxSysPll2Pfd2; rootCfg.div = 2; @@ -561,7 +561,7 @@ static ALWAYS_INLINE void clock_init(void) CLOCK_EnableClock(kCLOCK_Usdhc1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc2)) /* Configure USDHC2 using SysPll2Pfd2*/ rootCfg.mux = kCLOCK_USDHC2_ClockRoot_MuxSysPll2Pfd2; rootCfg.div = 2; @@ -571,7 +571,7 @@ static ALWAYS_INLINE void clock_init(void) #endif #if !(DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_flash), nxp_imx_flexspi)) && \ - defined(CONFIG_MEMC_MCUX_FLEXSPI) && DT_NODE_HAS_STATUS(DT_NODELABEL(flexspi), okay) + defined(CONFIG_MEMC_MCUX_FLEXSPI) && DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexspi)) /* Configure FLEXSPI1 using OSC_RC_48M_DIV2 */ rootCfg.mux = kCLOCK_FLEXSPI1_ClockRoot_MuxOscRc48MDiv2; rootCfg.div = 1; diff --git a/soc/nxp/imxrt/imxrt5xx/cm33/soc.c b/soc/nxp/imxrt/imxrt5xx/cm33/soc.c index 10f690bf0a5a6..b8eeef23a452d 100644 --- a/soc/nxp/imxrt/imxrt5xx/cm33/soc.c +++ b/soc/nxp/imxrt/imxrt5xx/cm33/soc.c @@ -358,7 +358,7 @@ void __weak rt5xx_clock_init(void) /* Switch CLKOUT to FRO_DIV2 */ CLOCK_AttachClk(kFRO_DIV2_to_CLKOUT); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc0), okay) && CONFIG_IMX_USDHC +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc0)) && CONFIG_IMX_USDHC /* Make sure USDHC ram buffer has been power up*/ POWER_DisablePD(kPDRUNCFG_APD_USDHC0_SRAM); POWER_DisablePD(kPDRUNCFG_PPD_USDHC0_SRAM); @@ -373,7 +373,7 @@ void __weak rt5xx_clock_init(void) RESET_PeripheralReset(kSDIO0_RST_SHIFT_RSTn); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(smartdma), okay) && CONFIG_DMA_MCUX_SMARTDMA +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(smartdma)) && CONFIG_DMA_MCUX_SMARTDMA /* Power up SMARTDMA ram */ POWER_DisablePD(kPDRUNCFG_APD_SMARTDMA_SRAM); POWER_DisablePD(kPDRUNCFG_PPD_SMARTDMA_SRAM); diff --git a/soc/nxp/imxrt/imxrt6xx/cm33/soc.c b/soc/nxp/imxrt/imxrt6xx/cm33/soc.c index e8ec55510f385..cf5bc6f57b47d 100644 --- a/soc/nxp/imxrt/imxrt6xx/cm33/soc.c +++ b/soc/nxp/imxrt/imxrt6xx/cm33/soc.c @@ -286,7 +286,7 @@ static ALWAYS_INLINE void clock_init(void) CLOCK_AttachClk(kNONE_to_WDT0_CLK); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc0), okay) && CONFIG_IMX_USDHC +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc0)) && CONFIG_IMX_USDHC /* Make sure USDHC ram buffer has been power up*/ POWER_DisablePD(kPDRUNCFG_APD_USDHC0_SRAM); POWER_DisablePD(kPDRUNCFG_PPD_USDHC0_SRAM); @@ -350,7 +350,7 @@ static ALWAYS_INLINE void clock_init(void) #endif /* CONFIG_SOC_MIMXRT685S_CM33 */ } -#if (DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc0), okay) && CONFIG_IMX_USDHC) +#if (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc0)) && CONFIG_IMX_USDHC) void imxrt_usdhc_pinmux(uint16_t nusdhc, bool init, uint32_t speed, uint32_t strength) { diff --git a/soc/nxp/imxrt/imxrt6xx/cm33/soc.h b/soc/nxp/imxrt/imxrt6xx/cm33/soc.h index 356b0e5727c75..71e5d69544e20 100644 --- a/soc/nxp/imxrt/imxrt6xx/cm33/soc.h +++ b/soc/nxp/imxrt/imxrt6xx/cm33/soc.h @@ -85,8 +85,8 @@ extern "C" { #endif #if CONFIG_IMX_USDHC && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc0), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc1), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc0)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usdhc1))) void imxrt_usdhc_pinmux(uint16_t nusdhc, bool init, uint32_t speed, uint32_t strength); diff --git a/soc/nxp/kinetis/k6x/soc.c b/soc/nxp/kinetis/k6x/soc.c index c8eb6ba787059..32832dc8a0a28 100644 --- a/soc/nxp/kinetis/k6x/soc.c +++ b/soc/nxp/kinetis/k6x/soc.c @@ -101,7 +101,7 @@ static ALWAYS_INLINE void clock_init(void) CLOCK_SetSimConfig(&simConfig); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart0)) CLOCK_SetLpuartClock(LPUART0SRC_OSCERCLK); #endif diff --git a/soc/nxp/kinetis/ke1xf/soc.c b/soc/nxp/kinetis/ke1xf/soc.c index 5d3e2291fe630..35968f6acf0f5 100644 --- a/soc/nxp/kinetis/ke1xf/soc.c +++ b/soc/nxp/kinetis/ke1xf/soc.c @@ -61,7 +61,7 @@ static const scg_sys_clk_config_t scg_sys_clk_config = { #endif }; -#if DT_NODE_HAS_STATUS(SCG_CLOCK_NODE(sosc_clk), okay) +#if DT_NODE_HAS_STATUS_OKAY(SCG_CLOCK_NODE(sosc_clk)) /* System Oscillator (SOSC) configuration */ ASSERT_ASYNC_CLK_DIV_VALID(SCG_CLOCK_DIV(soscdiv1_clk), "Invalid SCG SOSC divider 1 value"); @@ -155,7 +155,7 @@ static ALWAYS_INLINE void clk_init(void) }; scg_sys_clk_config_t current; -#if DT_NODE_HAS_STATUS(SCG_CLOCK_NODE(sosc_clk), okay) +#if DT_NODE_HAS_STATUS_OKAY(SCG_CLOCK_NODE(sosc_clk)) /* Optionally initialize system oscillator */ CLOCK_InitSysOsc(&scg_sosc_config); CLOCK_SetXtal0Freq(scg_sosc_config.freq); @@ -179,59 +179,59 @@ static ALWAYS_INLINE void clk_init(void) CLOCK_GetCurSysClkConfig(¤t); } while (current.src != scg_sys_clk_config.src); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart0)) CLOCK_SetIpSrc(kCLOCK_Lpuart0, DT_CLOCKS_CELL(DT_NODELABEL(lpuart0), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart1)) CLOCK_SetIpSrc(kCLOCK_Lpuart1, DT_CLOCKS_CELL(DT_NODELABEL(lpuart1), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart2)) CLOCK_SetIpSrc(kCLOCK_Lpuart2, DT_CLOCKS_CELL(DT_NODELABEL(lpuart2), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c0)) CLOCK_SetIpSrc(kCLOCK_Lpi2c0, DT_CLOCKS_CELL(DT_NODELABEL(lpi2c0), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c1)) CLOCK_SetIpSrc(kCLOCK_Lpi2c1, DT_CLOCKS_CELL(DT_NODELABEL(lpi2c1), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpspi0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpspi0)) CLOCK_SetIpSrc(kCLOCK_Lpspi0, DT_CLOCKS_CELL(DT_NODELABEL(lpspi0), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpspi1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpspi1)) CLOCK_SetIpSrc(kCLOCK_Lpspi1, DT_CLOCKS_CELL(DT_NODELABEL(lpspi1), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(adc0)) CLOCK_SetIpSrc(kCLOCK_Adc0, DT_CLOCKS_CELL(DT_NODELABEL(adc0), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(adc1)) CLOCK_SetIpSrc(kCLOCK_Adc1, DT_CLOCKS_CELL(DT_NODELABEL(adc1), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(adc2)) CLOCK_SetIpSrc(kCLOCK_Adc2, DT_CLOCKS_CELL(DT_NODELABEL(adc2), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ftm0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ftm0)) CLOCK_SetIpSrc(kCLOCK_Ftm0, DT_CLOCKS_CELL(DT_NODELABEL(ftm0), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ftm1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ftm1)) CLOCK_SetIpSrc(kCLOCK_Ftm1, DT_CLOCKS_CELL(DT_NODELABEL(ftm1), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ftm2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ftm2)) CLOCK_SetIpSrc(kCLOCK_Ftm2, DT_CLOCKS_CELL(DT_NODELABEL(ftm2), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ftm3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ftm3)) CLOCK_SetIpSrc(kCLOCK_Ftm3, DT_CLOCKS_CELL(DT_NODELABEL(ftm3), ip_source)); #endif diff --git a/soc/nxp/kinetis/ke1xz/soc.c b/soc/nxp/kinetis/ke1xz/soc.c index 5a6b443c1feed..0f8ad0de6acaa 100644 --- a/soc/nxp/kinetis/ke1xz/soc.c +++ b/soc/nxp/kinetis/ke1xz/soc.c @@ -106,39 +106,39 @@ static ALWAYS_INLINE void clk_init(void) CLOCK_GetCurSysClkConfig(¤t); } while (current.src != scg_sys_clk_config.src); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart0)) CLOCK_SetIpSrc(kCLOCK_Lpuart0, DT_CLOCKS_CELL(DT_NODELABEL(lpuart0), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart1)) CLOCK_SetIpSrc(kCLOCK_Lpuart1, DT_CLOCKS_CELL(DT_NODELABEL(lpuart1), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart2)) CLOCK_SetIpSrc(kCLOCK_Lpuart2, DT_CLOCKS_CELL(DT_NODELABEL(lpuart2), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c0)) CLOCK_SetIpSrc(kCLOCK_Lpi2c0, DT_CLOCKS_CELL(DT_NODELABEL(lpi2c0), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpi2c1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c1)) CLOCK_SetIpSrc(kCLOCK_Lpi2c1, DT_CLOCKS_CELL(DT_NODELABEL(lpi2c1), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexio), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexio)) CLOCK_SetIpSrc(kCLOCK_Flexio0, DT_CLOCKS_CELL(DT_NODELABEL(flexio), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpspi0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpspi0)) CLOCK_SetIpSrc(kCLOCK_Lpspi0, DT_CLOCKS_CELL(DT_NODELABEL(lpspi0), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpspi1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpspi1)) CLOCK_SetIpSrc(kCLOCK_Lpspi1, DT_CLOCKS_CELL(DT_NODELABEL(lpspi1), ip_source)); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(adc0)) CLOCK_SetIpSrc(kCLOCK_Adc0, DT_CLOCKS_CELL(DT_NODELABEL(adc0), ip_source)); #endif diff --git a/soc/nxp/kinetis/kl2x/soc.c b/soc/nxp/kinetis/kl2x/soc.c index 71fe3d35a355a..8ab125d4c7ce4 100644 --- a/soc/nxp/kinetis/kl2x/soc.c +++ b/soc/nxp/kinetis/kl2x/soc.c @@ -70,7 +70,7 @@ static ALWAYS_INLINE void clock_init(void) CLOCK_SetInternalRefClkConfig(kMCG_IrclkEnable, kMCG_IrcSlow, 0); CLOCK_SetSimConfig(&simConfig); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart0)) CLOCK_SetLpsci0Clock(LPSCI0SRC_MCGFLLCLK); #endif #if CONFIG_USB_KINETIS || CONFIG_UDC_KINETIS diff --git a/soc/nxp/kinetis/kwx/soc_kw4xz.c b/soc/nxp/kinetis/kwx/soc_kw4xz.c index 4e33f4df5b84b..f6baedb07b76f 100644 --- a/soc/nxp/kinetis/kwx/soc_kw4xz.c +++ b/soc/nxp/kinetis/kwx/soc_kw4xz.c @@ -67,14 +67,14 @@ static ALWAYS_INLINE void clock_init(void) CLOCK_SetSimConfig(&simConfig); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart0)) CLOCK_SetLpuartClock(LPUART0SRC_OSCERCLK); #endif #if defined(CONFIG_PWM) && \ - (DT_NODE_HAS_STATUS(DT_NODELABEL(pwm0), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(pwm1), okay) || \ - DT_NODE_HAS_STATUS(DT_NODELABEL(pwm2), okay)) + (DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm0)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm1)) || \ + DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pwm2))) CLOCK_SetTpmClock(TPMSRC_MCGPLLCLK); #endif } diff --git a/soc/nxp/lpc/lpc55xxx/soc.c b/soc/nxp/lpc/lpc55xxx/soc.c index 233ab0d9d82dc..1959b525e92e4 100644 --- a/soc/nxp/lpc/lpc55xxx/soc.c +++ b/soc/nxp/lpc/lpc55xxx/soc.c @@ -193,7 +193,7 @@ static ALWAYS_INLINE void clock_init(void) CLOCK_AttachClk(kFRO12M_to_FLEXCOMM4); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(hs_lspi), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(hs_lspi)) /* Attach 12 MHz clock to HSLSPI */ CLOCK_AttachClk(kFRO_HF_DIV_to_HSLSPI); #endif diff --git a/soc/nxp/mcx/mcxc/soc.c b/soc/nxp/mcx/mcxc/soc.c index 1f4762e202a50..4cb7b3c5085fc 100644 --- a/soc/nxp/mcx/mcxc/soc.c +++ b/soc/nxp/mcx/mcxc/soc.c @@ -95,7 +95,7 @@ static void clock_init(void) /* Set SystemCoreClock variable. */ SystemCoreClock = DT_PROP(DT_NODELABEL(cpu0), clock_frequency); /* Set LPUART0 clock source. */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpuart0)) CLOCK_SetLpuart0Clock(LPUART_CLOCK_SEL(lpuart0)); #endif #if DT_HAS_COMPAT_STATUS_OKAY(nxp_kinetis_tpm) diff --git a/soc/nxp/rw/power.c b/soc/nxp/rw/power.c index 1f0255a388fd5..f4176b6349cf5 100644 --- a/soc/nxp/rw/power.c +++ b/soc/nxp/rw/power.c @@ -28,11 +28,11 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); power_sleep_config_t slp_cfg; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pin0), okay) || DT_NODE_HAS_STATUS(DT_NODELABEL(pin1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin0)) || DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin1)) pinctrl_soc_pin_t pin_cfg; #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pin0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin0)) static void pin0_isr(const struct device *dev) { uint8_t level = ~(DT_ENUM_IDX(DT_NODELABEL(pin0), wakeup_level)) & 0x1; @@ -44,7 +44,7 @@ static void pin0_isr(const struct device *dev) } #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pin1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin1)) static void pin1_isr(const struct device *dev) { uint8_t level = ~(DT_ENUM_IDX(DT_NODELABEL(pin1), wakeup_level)) & 0x1; @@ -61,7 +61,7 @@ __weak void pm_state_set(enum pm_state state, uint8_t substate_id) { ARG_UNUSED(substate_id); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pin0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin0)) pin_cfg = IOMUX_GPIO_IDX(24) | IOMUX_TYPE(IOMUX_GPIO); pinctrl_configure_pins(&pin_cfg, 1, 0); POWER_ConfigWakeupPin(kPOWER_WakeupPin0, DT_ENUM_IDX(DT_NODELABEL(pin0), wakeup_level)); @@ -70,7 +70,7 @@ __weak void pm_state_set(enum pm_state state, uint8_t substate_id) EnableIRQ(DT_IRQN(DT_NODELABEL(pin0))); POWER_EnableWakeup(DT_IRQN(DT_NODELABEL(pin0))); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pin1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin1)) pin_cfg = IOMUX_GPIO_IDX(25) | IOMUX_TYPE(IOMUX_GPIO); pinctrl_configure_pins(&pin_cfg, 1, 0); POWER_ConfigWakeupPin(kPOWER_WakeupPin1, DT_ENUM_IDX(DT_NODELABEL(pin1), wakeup_level)); @@ -119,7 +119,7 @@ void nxp_rw6xx_power_init(void) slp_cfg.memPdCfg = suspend_sleepconfig[3]; slp_cfg.pm3BuckCfg = suspend_sleepconfig[4]; -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pin0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin0)) /* PIN 0 uses GPIO0_24, confiure the pin as GPIO */ pin_cfg = IOMUX_GPIO_IDX(24) | IOMUX_TYPE(IOMUX_GPIO); pinctrl_configure_pins(&pin_cfg, 1, 0); @@ -131,7 +131,7 @@ void nxp_rw6xx_power_init(void) NULL, 0); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(pin1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(pin1)) /* PIN 1 uses GPIO0_25, confiure the pin as GPIO */ pin_cfg = IOMUX_GPIO_IDX(25) | IOMUX_TYPE(IOMUX_GPIO); pinctrl_configure_pins(&pin_cfg, 1, 0); diff --git a/soc/nxp/rw/soc.c b/soc/nxp/rw/soc.c index 1a52626a0539d..9d3b6c548f155 100644 --- a/soc/nxp/rw/soc.c +++ b/soc/nxp/rw/soc.c @@ -221,7 +221,7 @@ __ramfunc void clock_init(void) #endif #endif /* CONFIG_SPI */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(dmic0), okay) && CONFIG_AUDIO_DMIC_MCUX +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dmic0)) && CONFIG_AUDIO_DMIC_MCUX /* Clock DMIC from Audio PLL. PLL output is sourced from AVPLL * channel 1, which is clocked at 12.288 MHz. We can divide this * by 4 to achieve the desired DMIC bit clk of 3.072 MHz @@ -230,7 +230,7 @@ __ramfunc void clock_init(void) CLOCK_SetClkDiv(kCLOCK_DivDmicClk, 4); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lcdic), okay) && CONFIG_MIPI_DBI_NXP_LCDIC +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lcdic)) && CONFIG_MIPI_DBI_NXP_LCDIC CLOCK_AttachClk(kMAIN_CLK_to_LCD_CLK); RESET_PeripheralReset(kLCDIC_RST_SHIFT_RSTn); #endif @@ -250,7 +250,7 @@ __ramfunc void clock_init(void) #endif #endif /* CONFIG_COUNTER_MCUX_CTIMER */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usb_otg), okay) && CONFIG_USB_DC_NXP_EHCI +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb_otg)) && CONFIG_USB_DC_NXP_EHCI /* Enable system xtal from Analog */ SYSCTL2->ANA_GRP_CTRL |= SYSCTL2_ANA_GRP_CTRL_PU_AG_MASK; /* reset USB */ @@ -261,7 +261,7 @@ __ramfunc void clock_init(void) CLOCK_EnableUsbhsPhyClock(); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(enet), okay) && CONFIG_NET_L2_ETHERNET +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(enet)) && CONFIG_NET_L2_ETHERNET RESET_PeripheralReset(kENET_IPG_RST_SHIFT_RSTn); RESET_PeripheralReset(kENET_IPG_S_RST_SHIFT_RSTn); #endif @@ -289,7 +289,7 @@ void soc_early_init_hook(void) #define PMU_RESET_CAUSES \ COND_CODE_0(IS_EMPTY(PMU_RESET_CAUSES_), (PMU_RESET_CAUSES_), (0)) #define WDT_RESET \ - COND_CODE_1(DT_NODE_HAS_STATUS(wwdt, okay), (kPOWER_ResetSourceWdt), (0)) + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(wwdt), (kPOWER_ResetSourceWdt), (0)) #define RESET_CAUSES \ (PMU_RESET_CAUSES | WDT_RESET) #else diff --git a/soc/openisa/rv32m1/soc.c b/soc/openisa/rv32m1/soc.c index cfcc6a0387bc0..5b3b5ec164661 100644 --- a/soc/openisa/rv32m1/soc.c +++ b/soc/openisa/rv32m1/soc.c @@ -197,16 +197,16 @@ static void rv32m1_switch_to_sirc(void) */ static void rv32m1_setup_peripheral_clocks(void) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(tpm0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(tpm0)) CLOCK_SetIpSrc(kCLOCK_Tpm0, kCLOCK_IpSrcFircAsync); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(tpm1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(tpm1)) CLOCK_SetIpSrc(kCLOCK_Tpm1, kCLOCK_IpSrcFircAsync); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(tpm2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(tpm2)) CLOCK_SetIpSrc(kCLOCK_Tpm2, kCLOCK_IpSrcFircAsync); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(tpm3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(tpm3)) CLOCK_SetIpSrc(kCLOCK_Tpm3, kCLOCK_IpSrcFircAsync); #endif } diff --git a/soc/renesas/ra/ra4m1/soc.c b/soc/renesas/ra/ra4m1/soc.c index 7f021ba17faea..7d8f27449141a 100644 --- a/soc/renesas/ra/ra4m1/soc.c +++ b/soc/renesas/ra/ra4m1/soc.c @@ -107,7 +107,7 @@ const struct opt_set_mem ops __attribute__((section(".opt_set_mem"))) = { .LVDAS = 0x1, /* Disable voltage monitor 0 following reset */ .VDSEL1 = 0x3, .RSVD2 = 0x3, - .HOCOEN = !DT_NODE_HAS_STATUS(DT_PATH(clocks, hoco), okay), + .HOCOEN = !DT_NODE_HAS_STATUS_OKAY(DT_PATH(clocks, hoco)), .RSVD3 = 0x7, .HOCOFRQ1 = OFS1_HOCO_FREQ, .RSVD4 = 0x1ffff, diff --git a/soc/renesas/smartbond/da1469x/power.c b/soc/renesas/smartbond/da1469x/power.c index 3e39239bcd1eb..816cb01419c3f 100644 --- a/soc/renesas/smartbond/da1469x/power.c +++ b/soc/renesas/smartbond/da1469x/power.c @@ -48,7 +48,7 @@ void pm_state_exit_post_ops(enum pm_state state, uint8_t substate_id) int renesas_da1469x_pm_init(void) { static const struct da1469x_sleep_config sleep_cfg = { - .enable_xtal_on_wakeup = DT_NODE_HAS_STATUS(DT_NODELABEL(xtal32m), okay), + .enable_xtal_on_wakeup = DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(xtal32m)), }; da1469x_sleep_config(&sleep_cfg); diff --git a/soc/snps/emsk/soc_config.c b/soc/snps/emsk/soc_config.c index c43942facb08a..5c18898ecd28a 100644 --- a/soc/snps/emsk/soc_config.c +++ b/soc/snps/emsk/soc_config.c @@ -17,14 +17,14 @@ void soc_early_init_hook(void) /* On ARC EM Starter kit board, * send the UART the command to clear the interrupt */ -#if DT_NODE_HAS_STATUS(DT_INST(0, ns16550), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, ns16550)) sys_write32(0, DT_REG_ADDR(DT_INST(0, ns16550))+0x4); sys_write32(0, DT_REG_ADDR(DT_INST(0, ns16550))+0x10); -#endif /* DT_NODE_HAS_STATUS(DT_INST(0, ns16550), okay) */ -#if DT_NODE_HAS_STATUS(DT_INST(1, ns16550), okay) +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_INST(0, ns16550)) */ +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(1, ns16550)) sys_write32(0, DT_REG_ADDR(DT_INST(1, ns16550))+0x4); sys_write32(0, DT_REG_ADDR(DT_INST(1, ns16550))+0x10); -#endif /* DT_NODE_HAS_STATUS(DT_INST(1, ns16550), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_INST(1, ns16550)) */ } #endif /* CONFIG_UART_NS16550 */ diff --git a/soc/st/stm32/stm32h7x/mpu_regions.c b/soc/st/stm32/stm32h7x/mpu_regions.c index 29825ad226a9a..8582db6072493 100644 --- a/soc/st/stm32/stm32h7x/mpu_regions.c +++ b/soc/st/stm32/stm32h7x/mpu_regions.c @@ -21,8 +21,8 @@ static const struct arm_mpu_region mpu_regions[] = { REGION_512K | MPU_RASR_XN_Msk | P_RW_U_NA_Msk) }), -#if DT_NODE_HAS_STATUS(DT_NODELABEL(mac), okay) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(sram3), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(mac)) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sram3)) MPU_REGION_ENTRY("SRAM3_ETH_BUF", DT_REG_ADDR(DT_NODELABEL(sram3)), REGION_RAM_NOCACHE_ATTR(REGION_16K)), diff --git a/soc/xlnx/zynq7000/xc7zxxx/soc.c b/soc/xlnx/zynq7000/xc7zxxx/soc.c index 37d30b02426a3..c1dad84ff36e3 100644 --- a/soc/xlnx/zynq7000/xc7zxxx/soc.c +++ b/soc/xlnx/zynq7000/xc7zxxx/soc.c @@ -39,13 +39,13 @@ static const struct arm_mmu_region mmu_regions[] = { /* ARM Arch timer, GIC are covered by the MPCore mapping */ /* GEMs */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gem0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gem0)) MMU_REGION_FLAT_ENTRY("gem0", DT_REG_ADDR(DT_NODELABEL(gem0)), DT_REG_SIZE(DT_NODELABEL(gem0)), MT_DEVICE | MATTR_SHARED | MPERM_R | MPERM_W), #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gem1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gem1)) MMU_REGION_FLAT_ENTRY("gem1", DT_REG_ADDR(DT_NODELABEL(gem1)), DT_REG_SIZE(DT_NODELABEL(gem1)), @@ -53,7 +53,7 @@ static const struct arm_mmu_region mmu_regions[] = { #endif /* GPIO controller */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(psgpio), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(psgpio)) MMU_REGION_FLAT_ENTRY("psgpio", DT_REG_ADDR(DT_NODELABEL(psgpio)), DT_REG_SIZE(DT_NODELABEL(psgpio)), @@ -106,7 +106,7 @@ void soc_reset_hook(void) sctlr &= ~SCTLR_A_Msk; __set_SCTLR(sctlr); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(slcr), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(slcr)) mm_reg_t addr = DT_REG_ADDR(DT_NODELABEL(slcr)); /* Unlock System Level Control Registers (SLCR) */ diff --git a/soc/xlnx/zynq7000/xc7zxxxs/soc.c b/soc/xlnx/zynq7000/xc7zxxxs/soc.c index a46d9a217843b..982ee094e01f7 100644 --- a/soc/xlnx/zynq7000/xc7zxxxs/soc.c +++ b/soc/xlnx/zynq7000/xc7zxxxs/soc.c @@ -39,13 +39,13 @@ static const struct arm_mmu_region mmu_regions[] = { /* ARM Arch timer, GIC are covered by the MPCore mapping */ /* GEMs */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gem0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gem0)) MMU_REGION_FLAT_ENTRY("gem0", DT_REG_ADDR(DT_NODELABEL(gem0)), DT_REG_SIZE(DT_NODELABEL(gem0)), MT_DEVICE | MATTR_SHARED | MPERM_R | MPERM_W), #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(gem1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gem1)) MMU_REGION_FLAT_ENTRY("gem1", DT_REG_ADDR(DT_NODELABEL(gem1)), DT_REG_SIZE(DT_NODELABEL(gem1)), @@ -53,7 +53,7 @@ static const struct arm_mmu_region mmu_regions[] = { #endif /* GPIO controller */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(psgpio), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(psgpio)) MMU_REGION_FLAT_ENTRY("psgpio", DT_REG_ADDR(DT_NODELABEL(psgpio)), DT_REG_SIZE(DT_NODELABEL(psgpio)), @@ -106,7 +106,7 @@ void soc_reset_hook(void) sctlr &= ~SCTLR_A_Msk; __set_SCTLR(sctlr); -#if DT_NODE_HAS_STATUS(DT_NODELABEL(slcr), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(slcr)) mm_reg_t addr = DT_REG_ADDR(DT_NODELABEL(slcr)); /* Unlock System Level Control Registers (SLCR) */ diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_fem.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_fem.h index b9ada56b5ab2f..a80de9f85e548 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_fem.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_fem.h @@ -17,9 +17,9 @@ #if DT_NODE_HAS_PROP(DT_NODELABEL(radio), fem) #define FEM_NODE DT_PHANDLE(DT_NODELABEL(radio), fem) -#if DT_NODE_HAS_STATUS(FEM_NODE, okay) +#if DT_NODE_HAS_STATUS_OKAY(FEM_NODE) #define HAL_RADIO_HAVE_FEM -#endif /* DT_NODE_HAS_STATUS(FEM_NODE, okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(FEM_NODE) */ #endif /* DT_NODE_HAS_PROP(DT_NODELABEL(radio), fem)) */ /* Does FEM_NODE have a particular DT compatible? */ diff --git a/subsys/pm/policy.c b/subsys/pm/policy.c index b13017f160374..39742cdf38c8c 100644 --- a/subsys/pm/policy.c +++ b/subsys/pm/policy.c @@ -77,8 +77,8 @@ struct pm_state_device_constraint { * @brief Helper macro to define a device pm constraints. */ #define PM_STATE_CONSTRAINT_DEFINE(i, node_id) \ - COND_CODE_1(DT_NODE_HAS_STATUS(DT_PHANDLE_BY_IDX(node_id, \ - zephyr_disabling_power_states, i), okay), \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_PHANDLE_BY_IDX(node_id, \ + zephyr_disabling_power_states, i)), \ (PM_STATE_CONSTRAINT_INIT(DT_PHANDLE_BY_IDX(node_id, \ zephyr_disabling_power_states, i)),), ()) diff --git a/subsys/tracing/sysview/sysview_config.c b/subsys/tracing/sysview/sysview_config.c index e68cb4f8a79eb..0ef395e451627 100644 --- a/subsys/tracing/sysview/sysview_config.c +++ b/subsys/tracing/sysview/sysview_config.c @@ -97,7 +97,7 @@ void SEGGER_SYSVIEW_Conf(void) SEGGER_SYSVIEW_Init(sys_clock_hw_cycles_per_sec(), sys_clock_hw_cycles_per_sec(), &SYSVIEW_X_OS_TraceAPI, cbSendSystemDesc); -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_sram), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_sram)) SEGGER_SYSVIEW_SetRAMBase(DT_REG_ADDR(DT_CHOSEN(zephyr_sram))); #else /* Setting RAMBase is just an optimization: this value is subtracted diff --git a/subsys/usb/device/usb_device.c b/subsys/usb/device/usb_device.c index e3a065fae1af0..c285817e8edc8 100644 --- a/subsys/usb/device/usb_device.c +++ b/subsys/usb/device/usb_device.c @@ -1295,7 +1295,7 @@ static void forward_status_cb(enum usb_dc_status_code status, const uint8_t *par static int usb_vbus_set(bool on) { #define USB_DEV_NODE DT_CHOSEN(zephyr_usb_device) -#if DT_NODE_HAS_STATUS(USB_DEV_NODE, okay) && \ +#if DT_NODE_HAS_STATUS_OKAY(USB_DEV_NODE) && \ DT_NODE_HAS_PROP(USB_DEV_NODE, vbus_gpios) int ret = 0; struct gpio_dt_spec gpio_dev = GPIO_DT_SPEC_GET(USB_DEV_NODE, vbus_gpios); diff --git a/tests/bluetooth/host/id/mocks/zephyr/linker/linker-defs.h b/tests/bluetooth/host/id/mocks/zephyr/linker/linker-defs.h index f2f32310870e0..7bd7faa79350f 100644 --- a/tests/bluetooth/host/id/mocks/zephyr/linker/linker-defs.h +++ b/tests/bluetooth/host/id/mocks/zephyr/linker/linker-defs.h @@ -10,6 +10,10 @@ #undef DT_NODE_HAS_STATUS #endif +#ifdef DT_NODE_HAS_STATUS_OKAY +#undef DT_NODE_HAS_STATUS_OKAY +#endif + #ifdef DT_FOREACH_OKAY_HELPER #undef DT_FOREACH_OKAY_HELPER #endif diff --git a/tests/drivers/adc/adc_api/src/test_adc.c b/tests/drivers/adc/adc_api/src/test_adc.c index 7d778cc6ef7cb..e7d1958cd5a2b 100644 --- a/tests/drivers/adc/adc_api/src/test_adc.c +++ b/tests/drivers/adc/adc_api/src/test_adc.c @@ -55,7 +55,7 @@ const struct device *get_adc_device(void) return adc_channels[0].dev; } -#if DT_NODE_HAS_STATUS(DT_NODELABEL(test_counter), okay) && \ +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(test_counter)) && \ defined(CONFIG_COUNTER) static void init_counter(void) { @@ -90,7 +90,7 @@ static void init_adc(void) m_sample_buffer[i] = INVALID_ADC_VALUE; } -#if DT_NODE_HAS_STATUS(DT_NODELABEL(test_counter), okay) && \ +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(test_counter)) && \ defined(CONFIG_COUNTER) init_counter(); #endif diff --git a/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_adc.c b/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_adc.c index fd28729a376b2..4ff7aec59db27 100644 --- a/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_adc.c +++ b/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_adc.c @@ -10,7 +10,7 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(adc1)) #undef DT_DRV_COMPAT #define DT_DRV_COMPAT st_stm32_adc diff --git a/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_i2c.c b/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_i2c.c index 05a6dc0528f6a..5a1f199828932 100644 --- a/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_i2c.c +++ b/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_i2c.c @@ -11,7 +11,7 @@ #include #if !defined(CONFIG_SOC_SERIES_STM32F4X) -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2c1)) #if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_i2c_v1) #define DT_DRV_COMPAT st_stm32_i2c_v1 diff --git a/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_i2s.c b/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_i2s.c index 4235f04207b91..c4d9c37726b77 100644 --- a/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_i2s.c +++ b/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_i2s.c @@ -10,7 +10,7 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2s2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(i2s2)) #if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_i2s) #define DT_DRV_COMPAT st_stm32_i2s diff --git a/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_lptim.c b/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_lptim.c index 3c85739dce9a3..0b04e0882e229 100644 --- a/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_lptim.c +++ b/tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices/src/test_stm32_clock_configuration_lptim.c @@ -10,7 +10,7 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_NODELABEL(lptim1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lptim1)) #undef DT_DRV_COMPAT #define DT_DRV_COMPAT st_stm32_lptim diff --git a/tests/drivers/clock_control/stm32_clock_configuration/stm32h7_devices/src/test_stm32_clock_configuration.c b/tests/drivers/clock_control/stm32_clock_configuration/stm32h7_devices/src/test_stm32_clock_configuration.c index d7b05edd7f609..aaa86026df423 100644 --- a/tests/drivers/clock_control/stm32_clock_configuration/stm32h7_devices/src/test_stm32_clock_configuration.c +++ b/tests/drivers/clock_control/stm32_clock_configuration/stm32h7_devices/src/test_stm32_clock_configuration.c @@ -80,7 +80,7 @@ ZTEST(stm32h7_devices_clocks, test_spi_clk_config) RCC_SPI123CLKSOURCE_CLKP, spi1_actual_domain_clk); /* Check perclk configuration */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(perck), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(perck)) uint32_t perclk_dt_domain_clk, perclk_actual_domain_clk; perclk_dt_domain_clk = DT_CLOCKS_CELL_BY_IDX(DT_NODELABEL(perck), 0, bus); diff --git a/tests/drivers/eeprom/api/src/main.c b/tests/drivers/eeprom/api/src/main.c index 5a14565cccb3b..5d311b7567d19 100644 --- a/tests/drivers/eeprom/api/src/main.c +++ b/tests/drivers/eeprom/api/src/main.c @@ -185,9 +185,9 @@ void test_main(void) { run_tests_on_eeprom(DEVICE_DT_GET(DT_ALIAS(eeprom_0))); -#if DT_NODE_HAS_STATUS(DT_ALIAS(eeprom_1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(eeprom_1)) run_tests_on_eeprom(DEVICE_DT_GET(DT_ALIAS(eeprom_1))); -#endif /* DT_NODE_HAS_STATUS(DT_ALIAS(eeprom_1), okay) */ +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(eeprom_1)) */ ztest_verify_all_test_suites_ran(); } diff --git a/tests/drivers/gpio/gpio_basic_api/src/main.c b/tests/drivers/gpio/gpio_basic_api/src/main.c index 67326505e986c..3e11722cf8c23 100644 --- a/tests/drivers/gpio/gpio_basic_api/src/main.c +++ b/tests/drivers/gpio/gpio_basic_api/src/main.c @@ -20,7 +20,7 @@ static void board_setup(void) { -#if DT_NODE_HAS_STATUS(DT_INST(0, test_gpio_basic_api), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, test_gpio_basic_api)) /* PIN_IN and PIN_OUT must be on same controller. */ const struct device *const in_dev = DEVICE_DT_GET(DEV_OUT); const struct device *const out_dev = DEVICE_DT_GET(DEV_IN); diff --git a/tests/drivers/gpio/gpio_basic_api/src/test_gpio.h b/tests/drivers/gpio/gpio_basic_api/src/test_gpio.h index ba3d3ae5eba23..78709937089cb 100644 --- a/tests/drivers/gpio/gpio_basic_api/src/test_gpio.h +++ b/tests/drivers/gpio/gpio_basic_api/src/test_gpio.h @@ -12,7 +12,7 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_INST(0, test_gpio_basic_api), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, test_gpio_basic_api)) /* Execution of the test requires hardware configuration described in * devicetree. See the test,gpio_basic_api binding local to this test @@ -29,11 +29,11 @@ #define PIN_IN DT_GPIO_PIN(DT_INST(0, test_gpio_basic_api), in_gpios) #define PIN_IN_FLAGS DT_GPIO_FLAGS(DT_INST(0, test_gpio_basic_api), in_gpios) -#elif DT_NODE_HAS_STATUS(DT_ALIAS(gpio_0), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(gpio_0)) #define DEV DT_GPIO_CTLR(DT_ALIAS(gpio_0)) -#elif DT_NODE_HAS_STATUS(DT_ALIAS(gpio_1), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(gpio_1)) #define DEV DT_GPIO_CTLR(DT_ALIAS(gpio_1)) -#elif DT_NODE_HAS_STATUS(DT_ALIAS(gpio_3), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(gpio_3)) #define DEV DT_GPIO_CTLR(DT_ALIAS(gpio_3)) #else #error Unsupported board diff --git a/tests/drivers/gpio/gpio_reserved_ranges/src/main.c b/tests/drivers/gpio/gpio_reserved_ranges/src/main.c index 1a56df9adc070..351a525d2eab1 100644 --- a/tests/drivers/gpio/gpio_reserved_ranges/src/main.c +++ b/tests/drivers/gpio/gpio_reserved_ranges/src/main.c @@ -33,12 +33,12 @@ ZTEST(gpio_reserved_ranges, test_path_props) ZTEST(gpio_reserved_ranges, test_has_status) { - zassert_equal(DT_NODE_HAS_STATUS(TEST_GPIO_1, okay), 1, ""); - zassert_equal(DT_NODE_HAS_STATUS(TEST_GPIO_2, okay), 1, ""); - zassert_equal(DT_NODE_HAS_STATUS(TEST_GPIO_3, okay), 1, ""); - zassert_equal(DT_NODE_HAS_STATUS(TEST_GPIO_4, okay), 1, ""); - zassert_equal(DT_NODE_HAS_STATUS(TEST_GPIO_5, okay), 1, ""); - zassert_equal(DT_NODE_HAS_STATUS(TEST_GPIO_6, okay), 1, ""); + zassert_equal(DT_NODE_HAS_STATUS_OKAY(TEST_GPIO_1), 1, ""); + zassert_equal(DT_NODE_HAS_STATUS_OKAY(TEST_GPIO_2), 1, ""); + zassert_equal(DT_NODE_HAS_STATUS_OKAY(TEST_GPIO_3), 1, ""); + zassert_equal(DT_NODE_HAS_STATUS_OKAY(TEST_GPIO_4), 1, ""); + zassert_equal(DT_NODE_HAS_STATUS_OKAY(TEST_GPIO_5), 1, ""); + zassert_equal(DT_NODE_HAS_STATUS_OKAY(TEST_GPIO_6), 1, ""); } ZTEST(gpio_reserved_ranges, test_reserved_ranges) diff --git a/tests/drivers/i2c/i2c_api/src/test_i2c.c b/tests/drivers/i2c/i2c_api/src/test_i2c.c index 9ed4162b04b88..ce0256b45004b 100644 --- a/tests/drivers/i2c/i2c_api/src/test_i2c.c +++ b/tests/drivers/i2c/i2c_api/src/test_i2c.c @@ -16,11 +16,11 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_ALIAS(i2c_0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(i2c_0)) #define I2C_DEV_NODE DT_ALIAS(i2c_0) -#elif DT_NODE_HAS_STATUS(DT_ALIAS(i2c_1), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(i2c_1)) #define I2C_DEV_NODE DT_ALIAS(i2c_1) -#elif DT_NODE_HAS_STATUS(DT_ALIAS(i2c_2), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(i2c_2)) #define I2C_DEV_NODE DT_ALIAS(i2c_2) #else #error "Please set the correct I2C device" diff --git a/tests/drivers/i2c/i2c_ram/src/test_i2c_ram.c b/tests/drivers/i2c/i2c_ram/src/test_i2c_ram.c index 3992897d90f29..8fb39de25173c 100644 --- a/tests/drivers/i2c/i2c_ram/src/test_i2c_ram.c +++ b/tests/drivers/i2c/i2c_ram/src/test_i2c_ram.c @@ -20,7 +20,7 @@ #define RAM_ADDR (0b10100010 >> 1) -#if DT_NODE_HAS_STATUS(DT_ALIAS(i2c_ram), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(i2c_ram)) #define I2C_DEV_NODE DT_ALIAS(i2c_ram) #define TX_DATA_OFFSET 2 static uint8_t tx_data[9] = {0x00, 0x00, 'Z', 'e', 'p', 'h', 'y', 'r', '\n'}; diff --git a/tests/drivers/i2c/i2c_tca954x/src/main.c b/tests/drivers/i2c/i2c_tca954x/src/main.c index 5524b1ed4dd69..c5433f93a4a70 100644 --- a/tests/drivers/i2c/i2c_tca954x/src/main.c +++ b/tests/drivers/i2c/i2c_tca954x/src/main.c @@ -8,13 +8,13 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_ALIAS(i2c_channel_0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(i2c_channel_0)) #define I2C_0_CTRL_NODE_ID DT_ALIAS(i2c_channel_0) #else #error "I2C 0 controller device not found" #endif -#if DT_NODE_HAS_STATUS(DT_ALIAS(i2c_channel_1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(i2c_channel_1)) #define I2C_1_CTRL_NODE_ID DT_ALIAS(i2c_channel_1) #else #error "I2C 1 controller device not found" diff --git a/tests/drivers/memc/ram/src/main.c b/tests/drivers/memc/ram/src/main.c index c8de856aa46f2..666f422da5156 100644 --- a/tests/drivers/memc/ram/src/main.c +++ b/tests/drivers/memc/ram/src/main.c @@ -32,23 +32,23 @@ static void test_ram_rw(uint32_t *mem, size_t size) } } -#if DT_NODE_HAS_STATUS(DT_NODELABEL(sdram1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sdram1)) BUF_DEF(sdram1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(sdram2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sdram2)) BUF_DEF(sdram2); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(sram1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sram1)) BUF_DEF(sram1); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(sram2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sram2)) BUF_DEF(sram2); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(memc), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(memc)) BUF_DEF(psram); #endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ram0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ram0)) #define RAM_SIZE DT_REG_SIZE(DT_NODELABEL(ram0)) static uint32_t *buf_ram0 = (uint32_t *)DT_REG_ADDR(DT_NODELABEL(ram0)); #endif @@ -57,7 +57,7 @@ ZTEST_SUITE(test_ram, NULL, NULL, NULL, NULL, NULL); ZTEST(test_ram, test_sdram1) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(sdram1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sdram1)) test_ram_rw(buf_sdram1, BUF_SIZE); #else ztest_test_skip(); @@ -66,7 +66,7 @@ ZTEST(test_ram, test_sdram1) ZTEST(test_ram, test_ram0) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(ram0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(ram0)) test_ram_rw(buf_ram0, RAM_SIZE); #else ztest_test_skip(); @@ -75,7 +75,7 @@ ZTEST(test_ram, test_ram0) ZTEST(test_ram, test_sdram2) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(sdram2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sdram2)) test_ram_rw(buf_sdram2, BUF_SIZE); #else ztest_test_skip(); @@ -84,7 +84,7 @@ ZTEST(test_ram, test_sdram2) ZTEST(test_ram, test_sram1) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(sram1), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sram1)) test_ram_rw(buf_sram1, BUF_SIZE); #else ztest_test_skip(); @@ -93,7 +93,7 @@ ZTEST(test_ram, test_sram1) ZTEST(test_ram, test_sram2) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(sram2), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(sram2)) test_ram_rw(buf_sram2, BUF_SIZE); #else ztest_test_skip(); @@ -102,7 +102,7 @@ ZTEST(test_ram, test_sram2) ZTEST(test_ram, test_psram) { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(memc), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(memc)) test_ram_rw(buf_psram, BUF_SIZE); #else ztest_test_skip(); diff --git a/tests/drivers/pwm/pwm_api/src/test_pwm.c b/tests/drivers/pwm/pwm_api/src/test_pwm.c index b5fc72b37e8cd..69a4dcaeacc42 100644 --- a/tests/drivers/pwm/pwm_api/src/test_pwm.c +++ b/tests/drivers/pwm/pwm_api/src/test_pwm.c @@ -29,13 +29,13 @@ #include #include -#if DT_NODE_HAS_STATUS(DT_ALIAS(pwm_0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(pwm_0)) #define PWM_DEV_NODE DT_ALIAS(pwm_0) -#elif DT_NODE_HAS_STATUS(DT_ALIAS(pwm_1), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(pwm_1)) #define PWM_DEV_NODE DT_ALIAS(pwm_1) -#elif DT_NODE_HAS_STATUS(DT_ALIAS(pwm_2), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(pwm_2)) #define PWM_DEV_NODE DT_ALIAS(pwm_2) -#elif DT_NODE_HAS_STATUS(DT_ALIAS(pwm_3), okay) +#elif DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(pwm_3)) #define PWM_DEV_NODE DT_ALIAS(pwm_3) #elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_pwm) diff --git a/tests/drivers/smbus/smbus_api/src/test_smbus.c b/tests/drivers/smbus/smbus_api/src/test_smbus.c index 5d1dd9ca49ad7..7743e04fbda27 100644 --- a/tests/drivers/smbus/smbus_api/src/test_smbus.c +++ b/tests/drivers/smbus/smbus_api/src/test_smbus.c @@ -14,7 +14,7 @@ #include -BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_NODELABEL(smbus0), okay), +BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(smbus0)), "SMBus node is disabled!"); #define FAKE_ADDRESS 0x10 diff --git a/tests/drivers/smbus/smbus_api/src/test_smbus_qemu.c b/tests/drivers/smbus/smbus_api/src/test_smbus_qemu.c index 74d8ba4408e2b..182794e7dc9dc 100644 --- a/tests/drivers/smbus/smbus_api/src/test_smbus_qemu.c +++ b/tests/drivers/smbus/smbus_api/src/test_smbus_qemu.c @@ -16,7 +16,7 @@ #include #include -BUILD_ASSERT(DT_NODE_HAS_STATUS(DT_NODELABEL(smbus0), okay), +BUILD_ASSERT(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(smbus0)), "SMBus node is disabled!"); /* Qemu q35 has default emulated EEPROM-like devices */ diff --git a/tests/drivers/watchdog/wdt_basic_api/src/test_wdt.c b/tests/drivers/watchdog/wdt_basic_api/src/test_wdt.c index 3166176de43ae..353d189db5471 100644 --- a/tests/drivers/watchdog/wdt_basic_api/src/test_wdt.c +++ b/tests/drivers/watchdog/wdt_basic_api/src/test_wdt.c @@ -66,7 +66,7 @@ * 'watchdog0' property, or one of the following watchdog compatibles * must have an enabled node. */ -#if DT_NODE_HAS_STATUS(DT_ALIAS(watchdog0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(watchdog0)) #define WDT_NODE DT_ALIAS(watchdog0) #elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_window_watchdog) #define WDT_NODE DT_INST(0, st_stm32_window_watchdog) @@ -148,7 +148,7 @@ static struct wdt_timeout_cfg m_cfg_wdt1; #define DATATYPE uint32_t #endif -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) #define NOINIT_SECTION ".dtcm_noinit.test_wdt" #else #define NOINIT_SECTION ".noinit.test_wdt" diff --git a/tests/drivers/watchdog/wdt_basic_reset_none/src/main.c b/tests/drivers/watchdog/wdt_basic_reset_none/src/main.c index 6a025a1478cec..9fa3e0bd75283 100644 --- a/tests/drivers/watchdog/wdt_basic_reset_none/src/main.c +++ b/tests/drivers/watchdog/wdt_basic_reset_none/src/main.c @@ -13,7 +13,7 @@ * 'watchdog0' property, or one of the following watchdog compatibles * must have an enabled node. */ -#if DT_NODE_HAS_STATUS(DT_ALIAS(watchdog0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(watchdog0)) #define WDT_NODE DT_ALIAS(watchdog0) #elif DT_HAS_COMPAT_STATUS_OKAY(nxp_s32_swt) #define WDT_NODE DT_INST(0, nxp_s32_swt) diff --git a/tests/drivers/watchdog/wdt_error_cases/src/main.c b/tests/drivers/watchdog/wdt_error_cases/src/main.c index c1adc43eea393..b05bedf01c337 100644 --- a/tests/drivers/watchdog/wdt_error_cases/src/main.c +++ b/tests/drivers/watchdog/wdt_error_cases/src/main.c @@ -13,7 +13,7 @@ * 'watchdog0' property, or one of the following watchdog compatibles * must have an enabled node. */ -#if DT_NODE_HAS_STATUS(DT_ALIAS(watchdog0), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_ALIAS(watchdog0)) #define WDT_NODE DT_ALIAS(watchdog0) #elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_wdt) #define WDT_NODE DT_INST(0, nordic_nrf_wdt) @@ -21,7 +21,7 @@ #define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(zephyr_counter_watchdog) #endif -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay) +#if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_dtcm)) #define NOINIT_SECTION ".dtcm_noinit.test_wdt" #else #define NOINIT_SECTION ".noinit.test_wdt" From 5d29e13e097e075f52c9641786b5f85a05e35698 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Tue, 23 Apr 2024 13:46:23 -0400 Subject: [PATCH 0218/4482] sys_sem: add a for-loop-like macro similar to spinlocks Add SYS_SEM_LOCK() and SYS_SEM_LOCK_BREAK which are mostly the same as K_SPINLOCK() and K_SPINLOCK_BREAK. Signed-off-by: Chris Friedt --- include/zephyr/sys/sem.h | 77 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/include/zephyr/sys/sem.h b/include/zephyr/sys/sem.h index d4e93df4ffc6b..73e4d8737250c 100644 --- a/include/zephyr/sys/sem.h +++ b/include/zephyr/sys/sem.h @@ -23,6 +23,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -138,6 +139,82 @@ int sys_sem_take(struct sys_sem *sem, k_timeout_t timeout); */ unsigned int sys_sem_count_get(struct sys_sem *sem); +/** + * @cond INTERNAL_HIDDEN + */ + +#if defined(__GNUC__) +static ALWAYS_INLINE void z_sys_sem_lock_onexit(__maybe_unused int *rc) +{ + __ASSERT(*rc == 1, "SYS_SEM_LOCK exited with goto, break or return, " + "use SYS_SEM_LOCK_BREAK instead."); +} +#define SYS_SEM_LOCK_ONEXIT __attribute__((__cleanup__(z_sys_sem_lock_onexit))) +#else +#define SYS_SEM_LOCK_ONEXIT +#endif + +/** + * INTERNAL_HIDDEN @endcond + */ + +/** + * @brief Leaves a code block guarded with @ref SYS_SEM_LOCK after releasing the + * lock. + * + * See @ref SYS_SEM_LOCK for details. + */ +#define SYS_SEM_LOCK_BREAK continue + +/** + * @brief Guards a code block with the given sys_sem, automatically acquiring + * the semaphore before executing the code block. The semaphore will be + * released either when reaching the end of the code block or when leaving the + * block with @ref SYS_SEM_LOCK_BREAK. + * + * @details Example usage: + * + * @code{.c} + * SYS_SEM_LOCK(&sem) { + * + * ...execute statements with the semaphore held... + * + * if (some_condition) { + * ...release the lock and leave the guarded section prematurely: + * SYS_SEM_LOCK_BREAK; + * } + * + * ...execute statements with the lock held... + * + * } + * @endcode + * + * Behind the scenes this pattern expands to a for-loop whose body is executed + * exactly once: + * + * @code{.c} + * for (sys_sem_take(&sem, K_FOREVER); ...; sys_sem_give(&sem)) { + * ... + * } + * @endcode + * + * @warning The code block must execute to its end or be left by calling + * @ref SYS_SEM_LOCK_BREAK. Otherwise, e.g. if exiting the block with a break, + * goto or return statement, the semaphore will not be released on exit. + * + * @param sem Semaphore (@ref sys_sem) used to guard the enclosed code block. + */ +#define SYS_SEM_LOCK(sem) \ + for (int __rc SYS_SEM_LOCK_ONEXIT = sys_sem_take((sem), K_FOREVER); ({ \ + __ASSERT(__rc >= 0, "Failed to take sem: %d", __rc); \ + __rc == 0; \ + }); \ + ({ \ + __rc = sys_sem_give((sem)); \ + __ASSERT(__rc == 0, "Failed to give sem: %d", __rc); \ + }), \ + __rc = 1) + /** * @} */ From 5a0b1b1628a29e2000ad091807d332c4bb57edb1 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Tue, 23 Apr 2024 13:47:13 -0400 Subject: [PATCH 0219/4482] clang-format: add entry for SYS_SEM_LOCK() SYS_SEM_LOCK() is a for-loop-like macro similar inspired by K_SPINLOCK(). Add an entry to .clang-format so that autoformatting works as expected. Signed-off-by: Chris Friedt --- .clang-format | 1 + 1 file changed, 1 insertion(+) diff --git a/.clang-format b/.clang-format index 8a170fe5c25a9..6cc25296b7d53 100644 --- a/.clang-format +++ b/.clang-format @@ -46,6 +46,7 @@ ForEachMacros: - 'SYS_DLIST_FOR_EACH_CONTAINER_SAFE' - 'SYS_DLIST_FOR_EACH_NODE' - 'SYS_DLIST_FOR_EACH_NODE_SAFE' + - 'SYS_SEM_LOCK' - 'SYS_SFLIST_FOR_EACH_CONTAINER' - 'SYS_SFLIST_FOR_EACH_CONTAINER_SAFE' - 'SYS_SFLIST_FOR_EACH_NODE' From 7506274ef2f82799bd548b524189ea2fc29a3bcb Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Sun, 21 Apr 2024 10:38:28 -0400 Subject: [PATCH 0220/4482] posix: use sys_sem instead of k_spinlock for pool synch Based on Andy's talk at eoss 2024, use the sys/sem.h api instead of the spinlock.h api to synchronize pooled elements since it has minimal overhead like semaphores but also works from userspace. Signed-off-by: Chris Friedt --- lib/posix/options/key.c | 136 ++++++++++++++-------------- lib/posix/options/mutex.c | 50 ++++++----- lib/posix/options/pthread.c | 172 +++++++++++++++++++----------------- lib/posix/options/rwlock.c | 55 ++++++------ 4 files changed, 214 insertions(+), 199 deletions(-) diff --git a/lib/posix/options/key.c b/lib/posix/options/key.c index a7906b8d9f7ce..f49198d173c81 100644 --- a/lib/posix/options/key.c +++ b/lib/posix/options/key.c @@ -11,6 +11,7 @@ #include #include #include +#include struct pthread_key_data { sys_snode_t node; @@ -19,7 +20,7 @@ struct pthread_key_data { LOG_MODULE_REGISTER(pthread_key, CONFIG_PTHREAD_KEY_LOG_LEVEL); -static struct k_spinlock pthread_key_lock; +static SYS_SEM_DEFINE(pthread_key_lock, 1, 1); /* This is non-standard (i.e. an implementation detail) */ #define PTHREAD_KEY_INITIALIZER (-1) @@ -128,42 +129,40 @@ int pthread_key_create(pthread_key_t *key, int pthread_key_delete(pthread_key_t key) { size_t bit; - __unused int ret; - pthread_key_obj *key_obj; + int ret = EINVAL; + pthread_key_obj *key_obj = NULL; struct pthread_key_data *key_data; sys_snode_t *node_l, *next_node_l; - k_spinlock_key_t key_key; - key_key = k_spin_lock(&pthread_key_lock); + SYS_SEM_LOCK(&pthread_key_lock) { + key_obj = get_posix_key(key); + if (key_obj == NULL) { + ret = EINVAL; + SYS_SEM_LOCK_BREAK; + } - key_obj = get_posix_key(key); - if (key_obj == NULL) { - k_spin_unlock(&pthread_key_lock, key_key); - return EINVAL; - } + /* Delete thread-specific elements associated with the key */ + SYS_SLIST_FOR_EACH_NODE_SAFE(&(key_obj->key_data_l), node_l, next_node_l) { - /* Delete thread-specific elements associated with the key */ - SYS_SLIST_FOR_EACH_NODE_SAFE(&(key_obj->key_data_l), - node_l, next_node_l) { + /* Remove the object from the list key_data_l */ + key_data = (struct pthread_key_data *)sys_slist_get(&(key_obj->key_data_l)); - /* Remove the object from the list key_data_l */ - key_data = (struct pthread_key_data *) - sys_slist_get(&(key_obj->key_data_l)); + /* Deallocate the object's memory */ + k_free((void *)key_data); + LOG_DBG("Freed key data %p for key %x in thread %x", key_data, key, + pthread_self()); + } - /* Deallocate the object's memory */ - k_free((void *)key_data); - LOG_DBG("Freed key data %p for key %x in thread %x", key_data, key, pthread_self()); + bit = posix_key_to_offset(key_obj); + ret = sys_bitarray_free(&posix_key_bitarray, 1, bit); + __ASSERT_NO_MSG(ret == 0); } - bit = posix_key_to_offset(key_obj); - ret = sys_bitarray_free(&posix_key_bitarray, 1, bit); - __ASSERT_NO_MSG(ret == 0); - - k_spin_unlock(&pthread_key_lock, key_key); - - LOG_DBG("Deleted key %p (%x)", key_obj, key); + if (ret == 0) { + LOG_DBG("Deleted key %p (%x)", key_obj, key); + } - return 0; + return ret; } /** @@ -173,12 +172,10 @@ int pthread_key_delete(pthread_key_t key) */ int pthread_setspecific(pthread_key_t key, const void *value) { - pthread_key_obj *key_obj; + pthread_key_obj *key_obj = NULL; struct posix_thread *thread; struct pthread_key_data *key_data; - pthread_thread_data *thread_spec_data; - k_spinlock_key_t key_key; - sys_snode_t *node_l; + sys_snode_t *node_l = NULL; int retval = 0; thread = to_posix_thread(pthread_self()); @@ -190,37 +187,38 @@ int pthread_setspecific(pthread_key_t key, const void *value) * If the key is already in the list, re-assign its value. * Else add the key to the thread's list. */ - key_key = k_spin_lock(&pthread_key_lock); - - key_obj = get_posix_key(key); - if (key_obj == NULL) { - k_spin_unlock(&pthread_key_lock, key_key); - return EINVAL; - } - - SYS_SLIST_FOR_EACH_NODE(&(thread->key_list), node_l) { + SYS_SEM_LOCK(&pthread_key_lock) { + key_obj = get_posix_key(key); + if (key_obj == NULL) { + retval = EINVAL; + SYS_SEM_LOCK_BREAK; + } - thread_spec_data = (pthread_thread_data *)node_l; + SYS_SLIST_FOR_EACH_NODE(&(thread->key_list), node_l) { + pthread_thread_data *thread_spec_data = (pthread_thread_data *)node_l; - if (thread_spec_data->key == key_obj) { + if (thread_spec_data->key == key_obj) { + /* Key is already present so associate thread specific data */ + thread_spec_data->spec_data = (void *)value; + LOG_DBG("Paired key %x to value %p for thread %x", key, value, + pthread_self()); + break; + } + } - /* Key is already present so - * associate thread specific data - */ - thread_spec_data->spec_data = (void *)value; - LOG_DBG("Paired key %x to value %p for thread %x", key, value, - pthread_self()); - goto out; + retval = 0; + if (node_l != NULL) { + /* Key is already present, so we are done */ + SYS_SEM_LOCK_BREAK; } - } - if (node_l == NULL) { + /* Key and data need to be added */ key_data = k_malloc(sizeof(struct pthread_key_data)); if (key_data == NULL) { LOG_DBG("Failed to allocate key data for key %x", key); retval = ENOMEM; - goto out; + SYS_SEM_LOCK_BREAK; } LOG_DBG("Allocated key data %p for key %x in thread %x", key_data, key, @@ -239,9 +237,6 @@ int pthread_setspecific(pthread_key_t key, const void *value) LOG_DBG("Paired key %x to value %p for thread %x", key, value, pthread_self()); } -out: - k_spin_unlock(&pthread_key_lock, key_key); - return retval; } @@ -257,33 +252,30 @@ void *pthread_getspecific(pthread_key_t key) pthread_thread_data *thread_spec_data; void *value = NULL; sys_snode_t *node_l; - k_spinlock_key_t key_key; thread = to_posix_thread(pthread_self()); if (thread == NULL) { return NULL; } - key_key = k_spin_lock(&pthread_key_lock); - - key_obj = get_posix_key(key); - if (key_obj == NULL) { - k_spin_unlock(&pthread_key_lock, key_key); - return NULL; - } + SYS_SEM_LOCK(&pthread_key_lock) { + key_obj = get_posix_key(key); + if (key_obj == NULL) { + value = NULL; + SYS_SEM_LOCK_BREAK; + } - /* Traverse the list of keys set by the thread, looking for key */ + /* Traverse the list of keys set by the thread, looking for key */ - SYS_SLIST_FOR_EACH_NODE(&(thread->key_list), node_l) { - thread_spec_data = (pthread_thread_data *)node_l; - if (thread_spec_data->key == key_obj) { - /* Key is present, so get the set thread data */ - value = thread_spec_data->spec_data; - break; + SYS_SLIST_FOR_EACH_NODE(&(thread->key_list), node_l) { + thread_spec_data = (pthread_thread_data *)node_l; + if (thread_spec_data->key == key_obj) { + /* Key is present, so get the set thread data */ + value = thread_spec_data->spec_data; + break; + } } } - k_spin_unlock(&pthread_key_lock, key_key); - return value; } diff --git a/lib/posix/options/mutex.c b/lib/posix/options/mutex.c index ff3f3561f6d64..cd320a969dca8 100644 --- a/lib/posix/options/mutex.c +++ b/lib/posix/options/mutex.c @@ -12,10 +12,11 @@ #include #include #include +#include LOG_MODULE_REGISTER(pthread_mutex, CONFIG_PTHREAD_MUTEX_LOG_LEVEL); -static struct k_spinlock pthread_mutex_spinlock; +static SYS_SEM_DEFINE(lock, 1, 1); int64_t timespec_to_timeoutms(const struct timespec *abstime); @@ -106,35 +107,42 @@ struct k_mutex *to_posix_mutex(pthread_mutex_t *mu) static int acquire_mutex(pthread_mutex_t *mu, k_timeout_t timeout) { - int type; - size_t bit; - int ret = 0; - struct k_mutex *m; - k_spinlock_key_t key; + int type = -1; + size_t bit = -1; + int ret = EINVAL; + size_t lock_count = -1; + struct k_mutex *m = NULL; + struct k_thread *owner = NULL; + + SYS_SEM_LOCK(&lock) { + m = to_posix_mutex(mu); + if (m == NULL) { + ret = EINVAL; + SYS_SEM_LOCK_BREAK; + } - key = k_spin_lock(&pthread_mutex_spinlock); + LOG_DBG("Locking mutex %p with timeout %llx", m, timeout.ticks); - m = to_posix_mutex(mu); - if (m == NULL) { - k_spin_unlock(&pthread_mutex_spinlock, key); - return EINVAL; + ret = 0; + bit = posix_mutex_to_offset(m); + type = posix_mutex_type[bit]; + owner = m->owner; + lock_count = m->lock_count; } - LOG_DBG("Locking mutex %p with timeout %llx", m, timeout.ticks); - - bit = posix_mutex_to_offset(m); - type = posix_mutex_type[bit]; + if (ret != 0) { + goto handle_error; + } - if (m->owner == k_current_get()) { + if (owner == k_current_get()) { switch (type) { case PTHREAD_MUTEX_NORMAL: if (K_TIMEOUT_EQ(timeout, K_NO_WAIT)) { - k_spin_unlock(&pthread_mutex_spinlock, key); LOG_DBG("Timeout locking mutex %p", m); - return EBUSY; + ret = EBUSY; + break; } /* On most POSIX systems, this usually results in an infinite loop */ - k_spin_unlock(&pthread_mutex_spinlock, key); LOG_DBG("Attempt to relock non-recursive mutex %p", m); do { (void)k_sleep(K_FOREVER); @@ -142,7 +150,7 @@ static int acquire_mutex(pthread_mutex_t *mu, k_timeout_t timeout) CODE_UNREACHABLE; break; case PTHREAD_MUTEX_RECURSIVE: - if (m->lock_count >= MUTEX_MAX_REC_LOCK) { + if (lock_count >= MUTEX_MAX_REC_LOCK) { LOG_DBG("Mutex %p locked recursively too many times", m); ret = EAGAIN; } @@ -157,7 +165,6 @@ static int acquire_mutex(pthread_mutex_t *mu, k_timeout_t timeout) break; } } - k_spin_unlock(&pthread_mutex_spinlock, key); if (ret == 0) { ret = k_mutex_lock(m, timeout); @@ -171,6 +178,7 @@ static int acquire_mutex(pthread_mutex_t *mu, k_timeout_t timeout) } } +handle_error: if (ret < 0) { LOG_DBG("k_mutex_unlock() failed: %d", ret); ret = -ret; diff --git a/lib/posix/options/pthread.c b/lib/posix/options/pthread.c index fe3c606bdb88a..e3f8ebf0910d1 100644 --- a/lib/posix/options/pthread.c +++ b/lib/posix/options/pthread.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -86,8 +87,8 @@ static sys_dlist_t posix_thread_q[] = { SYS_DLIST_STATIC_INIT(&posix_thread_q[POSIX_THREAD_RUN_Q]), SYS_DLIST_STATIC_INIT(&posix_thread_q[POSIX_THREAD_DONE_Q]), }; -static struct posix_thread posix_thread_pool[CONFIG_POSIX_THREAD_THREADS_MAX]; -static struct k_spinlock pthread_pool_lock; +static struct posix_thread posix_thread_pool[CONFIG_MAX_PTHREAD_COUNT]; +static SYS_SEM_DEFINE(pthread_pool_lock, 1, 1); static int pthread_concurrency; static inline void posix_thread_q_set(struct posix_thread *t, enum posix_thread_qid qid) @@ -203,7 +204,7 @@ void __z_pthread_cleanup_push(void *cleanup[3], void (*routine)(void *arg), void struct posix_thread *t = NULL; struct __pthread_cleanup *const c = (struct __pthread_cleanup *)cleanup; - K_SPINLOCK(&pthread_pool_lock) { + SYS_SEM_LOCK(&pthread_pool_lock) { t = to_posix_thread(pthread_self()); BUILD_ASSERT(3 * sizeof(void *) == sizeof(*c)); __ASSERT_NO_MSG(t != NULL); @@ -220,7 +221,7 @@ void __z_pthread_cleanup_pop(int execute) struct __pthread_cleanup *c = NULL; struct posix_thread *t = NULL; - K_SPINLOCK(&pthread_pool_lock) { + SYS_SEM_LOCK(&pthread_pool_lock) { t = to_posix_thread(pthread_self()); __ASSERT_NO_MSG(t != NULL); node = sys_slist_get(&t->cleanup_list); @@ -460,7 +461,6 @@ static K_WORK_DELAYABLE_DEFINE(posix_thread_recycle_work, posix_thread_recycle_w static void posix_thread_finalize(struct posix_thread *t, void *retval) { sys_snode_t *node_l; - k_spinlock_key_t key; pthread_key_obj *key_obj; pthread_thread_data *thread_spec_data; @@ -475,11 +475,11 @@ static void posix_thread_finalize(struct posix_thread *t, void *retval) } /* move thread from run_q to done_q */ - key = k_spin_lock(&pthread_pool_lock); - sys_dlist_remove(&t->q_node); - posix_thread_q_set(t, POSIX_THREAD_DONE_Q); - t->retval = retval; - k_spin_unlock(&pthread_pool_lock, key); + SYS_SEM_LOCK(&pthread_pool_lock) { + sys_dlist_remove(&t->q_node); + posix_thread_q_set(t, POSIX_THREAD_DONE_Q); + t->retval = retval; + } /* trigger recycle work */ (void)k_work_schedule(&posix_thread_recycle_work, K_MSEC(CONFIG_PTHREAD_RECYCLER_DELAY_MS)); @@ -510,22 +510,22 @@ static void zephyr_thread_wrapper(void *arg1, void *arg2, void *arg3) static void posix_thread_recycle(void) { - k_spinlock_key_t key; struct posix_thread *t; struct posix_thread *safe_t; sys_dlist_t recyclables = SYS_DLIST_STATIC_INIT(&recyclables); - key = k_spin_lock(&pthread_pool_lock); - SYS_DLIST_FOR_EACH_CONTAINER_SAFE(&posix_thread_q[POSIX_THREAD_DONE_Q], t, safe_t, q_node) { - if (t->attr.detachstate == PTHREAD_CREATE_JOINABLE) { - /* thread has not been joined yet */ - continue; - } + SYS_SEM_LOCK(&pthread_pool_lock) { + SYS_DLIST_FOR_EACH_CONTAINER_SAFE(&posix_thread_q[POSIX_THREAD_DONE_Q], t, safe_t, + q_node) { + if (t->attr.detachstate == PTHREAD_CREATE_JOINABLE) { + /* thread has not been joined yet */ + continue; + } - sys_dlist_remove(&t->q_node); - sys_dlist_append(&recyclables, &t->q_node); + sys_dlist_remove(&t->q_node); + sys_dlist_append(&recyclables, &t->q_node); + } } - k_spin_unlock(&pthread_pool_lock, key); if (sys_dlist_is_empty(&recyclables)) { return; @@ -541,12 +541,12 @@ static void posix_thread_recycle(void) } } - key = k_spin_lock(&pthread_pool_lock); - while (!sys_dlist_is_empty(&recyclables)) { - t = CONTAINER_OF(sys_dlist_get(&recyclables), struct posix_thread, q_node); - posix_thread_q_set(t, POSIX_THREAD_READY_Q); + SYS_SEM_LOCK(&pthread_pool_lock) { + while (!sys_dlist_is_empty(&recyclables)) { + t = CONTAINER_OF(sys_dlist_get(&recyclables), struct posix_thread, q_node); + posix_thread_q_set(t, POSIX_THREAD_READY_Q); + } } - k_spin_unlock(&pthread_pool_lock, key); } /** @@ -571,7 +571,7 @@ int pthread_create(pthread_t *th, const pthread_attr_t *_attr, void *(*threadrou /* reclaim resources greedily */ posix_thread_recycle(); - K_SPINLOCK(&pthread_pool_lock) { + SYS_SEM_LOCK(&pthread_pool_lock) { if (!sys_dlist_is_empty(&posix_thread_q[POSIX_THREAD_READY_Q])) { t = CONTAINER_OF(sys_dlist_get(&posix_thread_q[POSIX_THREAD_READY_Q]), struct posix_thread, q_node); @@ -587,7 +587,7 @@ int pthread_create(pthread_t *th, const pthread_attr_t *_attr, void *(*threadrou err = pthread_barrier_init(&barrier, NULL, 2); if (err != 0) { /* cannot allocate barrier. move thread back to ready_q */ - K_SPINLOCK(&pthread_pool_lock) { + SYS_SEM_LOCK(&pthread_pool_lock) { sys_dlist_remove(&t->q_node); posix_thread_q_set(t, POSIX_THREAD_READY_Q); } @@ -609,7 +609,7 @@ int pthread_create(pthread_t *th, const pthread_attr_t *_attr, void *(*threadrou } if (err != 0) { /* cannot allocate pthread attributes (e.g. stack) */ - K_SPINLOCK(&pthread_pool_lock) { + SYS_SEM_LOCK(&pthread_pool_lock) { sys_dlist_remove(&t->q_node); posix_thread_q_set(t, POSIX_THREAD_READY_Q); } @@ -657,7 +657,7 @@ int pthread_getconcurrency(void) { int ret = 0; - K_SPINLOCK(&pthread_pool_lock) { + SYS_SEM_LOCK(&pthread_pool_lock) { ret = pthread_concurrency; } @@ -674,7 +674,7 @@ int pthread_setconcurrency(int new_level) return EAGAIN; } - K_SPINLOCK(&pthread_pool_lock) { + SYS_SEM_LOCK(&pthread_pool_lock) { pthread_concurrency = new_level; } @@ -688,21 +688,21 @@ int pthread_setconcurrency(int new_level) */ int pthread_setcancelstate(int state, int *oldstate) { - int ret = 0; - struct posix_thread *t; + int ret = EINVAL; bool cancel_pending = false; - bool cancel_type = PTHREAD_CANCEL_ENABLE; + struct posix_thread *t = NULL; + bool cancel_type = -1; if (state != PTHREAD_CANCEL_ENABLE && state != PTHREAD_CANCEL_DISABLE) { LOG_DBG("Invalid pthread state %d", state); return EINVAL; } - K_SPINLOCK(&pthread_pool_lock) { + SYS_SEM_LOCK(&pthread_pool_lock) { t = to_posix_thread(pthread_self()); if (t == NULL) { ret = EINVAL; - K_SPINLOCK_BREAK; + SYS_SEM_LOCK_BREAK; } if (oldstate != NULL) { @@ -712,14 +712,16 @@ int pthread_setcancelstate(int state, int *oldstate) t->attr.cancelstate = state; cancel_pending = t->attr.cancelpending; cancel_type = t->attr.canceltype; + + ret = 0; } - if (state == PTHREAD_CANCEL_ENABLE && cancel_type == PTHREAD_CANCEL_ASYNCHRONOUS && - cancel_pending) { + if (ret == 0 && state == PTHREAD_CANCEL_ENABLE && + cancel_type == PTHREAD_CANCEL_ASYNCHRONOUS && cancel_pending) { posix_thread_finalize(t, PTHREAD_CANCELED); } - return 0; + return ret; } /** @@ -729,7 +731,7 @@ int pthread_setcancelstate(int state, int *oldstate) */ int pthread_setcanceltype(int type, int *oldtype) { - int ret = 0; + int ret = EINVAL; struct posix_thread *t; if (type != PTHREAD_CANCEL_DEFERRED && type != PTHREAD_CANCEL_ASYNCHRONOUS) { @@ -737,17 +739,19 @@ int pthread_setcanceltype(int type, int *oldtype) return EINVAL; } - K_SPINLOCK(&pthread_pool_lock) { + SYS_SEM_LOCK(&pthread_pool_lock) { t = to_posix_thread(pthread_self()); if (t == NULL) { ret = EINVAL; - K_SPINLOCK_BREAK; + SYS_SEM_LOCK_BREAK; } if (oldtype != NULL) { *oldtype = t->attr.canceltype; } t->attr.canceltype = type; + + ret = 0; } return ret; @@ -760,16 +764,16 @@ int pthread_setcanceltype(int type, int *oldtype) */ void pthread_testcancel(void) { - struct posix_thread *t; bool cancel_pended = false; + struct posix_thread *t = NULL; - K_SPINLOCK(&pthread_pool_lock) { + SYS_SEM_LOCK(&pthread_pool_lock) { t = to_posix_thread(pthread_self()); if (t == NULL) { - K_SPINLOCK_BREAK; + SYS_SEM_LOCK_BREAK; } if (t->attr.cancelstate != PTHREAD_CANCEL_ENABLE) { - K_SPINLOCK_BREAK; + SYS_SEM_LOCK_BREAK; } if (t->attr.cancelpending) { cancel_pended = true; @@ -789,24 +793,25 @@ void pthread_testcancel(void) */ int pthread_cancel(pthread_t pthread) { - int ret = 0; + int ret = ESRCH; bool cancel_state = PTHREAD_CANCEL_ENABLE; bool cancel_type = PTHREAD_CANCEL_DEFERRED; struct posix_thread *t = NULL; - K_SPINLOCK(&pthread_pool_lock) { + SYS_SEM_LOCK(&pthread_pool_lock) { t = to_posix_thread(pthread); if (t == NULL) { ret = ESRCH; - K_SPINLOCK_BREAK; + SYS_SEM_LOCK_BREAK; } if (!__attr_is_initialized(&t->attr)) { /* thread has already terminated */ ret = ESRCH; - K_SPINLOCK_BREAK; + SYS_SEM_LOCK_BREAK; } + ret = 0; t->attr.cancelpending = true; cancel_state = t->attr.cancelstate; cancel_type = t->attr.canceltype; @@ -827,7 +832,7 @@ int pthread_cancel(pthread_t pthread) */ int pthread_setschedparam(pthread_t pthread, int policy, const struct sched_param *param) { - int ret = 0; + int ret = ESRCH; int new_prio = K_LOWEST_APPLICATION_THREAD_PRIO; struct posix_thread *t = NULL; @@ -836,13 +841,14 @@ int pthread_setschedparam(pthread_t pthread, int policy, const struct sched_para return EINVAL; } - K_SPINLOCK(&pthread_pool_lock) { + SYS_SEM_LOCK(&pthread_pool_lock) { t = to_posix_thread(pthread); if (t == NULL) { ret = ESRCH; - K_SPINLOCK_BREAK; + SYS_SEM_LOCK_BREAK; } + ret = 0; new_prio = posix_to_zephyr_priority(param->sched_priority, policy); } @@ -867,7 +873,6 @@ int pthread_setschedprio(pthread_t thread, int prio) struct sched_param param; ret = pthread_getschedparam(thread, &policy, ¶m); - if (ret != 0) { return ret; } @@ -876,13 +881,15 @@ int pthread_setschedprio(pthread_t thread, int prio) return EINVAL; } - K_SPINLOCK(&pthread_pool_lock) { + ret = ESRCH; + SYS_SEM_LOCK(&pthread_pool_lock) { t = to_posix_thread(thread); if (t == NULL) { ret = ESRCH; - K_SPINLOCK_BREAK; + SYS_SEM_LOCK_BREAK; } + ret = 0; new_prio = posix_to_zephyr_priority(prio, policy); } @@ -942,25 +949,26 @@ int pthread_attr_init(pthread_attr_t *_attr) */ int pthread_getschedparam(pthread_t pthread, int *policy, struct sched_param *param) { - int ret = 0; + int ret = ESRCH; struct posix_thread *t; if (policy == NULL || param == NULL) { return EINVAL; } - K_SPINLOCK(&pthread_pool_lock) { + SYS_SEM_LOCK(&pthread_pool_lock) { t = to_posix_thread(pthread); if (t == NULL) { ret = ESRCH; - K_SPINLOCK_BREAK; + SYS_SEM_LOCK_BREAK; } if (!__attr_is_initialized(&t->attr)) { ret = ESRCH; - K_SPINLOCK_BREAK; + SYS_SEM_LOCK_BREAK; } + ret = 0; param->sched_priority = zephyr_to_posix_priority(k_thread_priority_get(&t->thread), policy); } @@ -975,7 +983,7 @@ int pthread_getschedparam(pthread_t pthread, int *policy, struct sched_param *pa */ int pthread_once(pthread_once_t *once, void (*init_func)(void)) { - __unused int ret; + int ret = EINVAL; bool run_init_func = false; struct pthread_once *const _once = (struct pthread_once *)once; @@ -983,18 +991,19 @@ int pthread_once(pthread_once_t *once, void (*init_func)(void)) return EINVAL; } - K_SPINLOCK(&pthread_pool_lock) { + SYS_SEM_LOCK(&pthread_pool_lock) { if (!_once->flag) { run_init_func = true; _once->flag = true; } + ret = 0; } - if (run_init_func) { + if (ret == 0 && run_init_func) { init_func(); } - return 0; + return ret; } /** @@ -1007,10 +1016,10 @@ void pthread_exit(void *retval) { struct posix_thread *self = NULL; - K_SPINLOCK(&pthread_pool_lock) { + SYS_SEM_LOCK(&pthread_pool_lock) { self = to_posix_thread(pthread_self()); if (self == NULL) { - K_SPINLOCK_BREAK; + SYS_SEM_LOCK_BREAK; } /* Mark a thread as cancellable before exiting */ @@ -1036,7 +1045,7 @@ void pthread_exit(void *retval) */ int pthread_join(pthread_t pthread, void **status) { - int ret = 0; + int ret = ESRCH; struct posix_thread *t = NULL; if (pthread == pthread_self()) { @@ -1044,11 +1053,11 @@ int pthread_join(pthread_t pthread, void **status) return EDEADLK; } - K_SPINLOCK(&pthread_pool_lock) { + SYS_SEM_LOCK(&pthread_pool_lock) { t = to_posix_thread(pthread); if (t == NULL) { ret = ESRCH; - K_SPINLOCK_BREAK; + SYS_SEM_LOCK_BREAK; } LOG_DBG("Pthread %p joining..", &t->thread); @@ -1056,18 +1065,19 @@ int pthread_join(pthread_t pthread, void **status) if (t->attr.detachstate != PTHREAD_CREATE_JOINABLE) { /* undefined behaviour */ ret = EINVAL; - K_SPINLOCK_BREAK; + SYS_SEM_LOCK_BREAK; } if (posix_thread_q_get(t) == POSIX_THREAD_READY_Q) { ret = ESRCH; - K_SPINLOCK_BREAK; + SYS_SEM_LOCK_BREAK; } /* * thread is joinable and is in run_q or done_q. * let's ensure that the thread cannot be joined again after this point. */ + ret = 0; t->attr.detachstate = PTHREAD_CREATE_DETACHED; } @@ -1105,23 +1115,24 @@ int pthread_join(pthread_t pthread, void **status) */ int pthread_detach(pthread_t pthread) { - int ret = 0; - struct posix_thread *t; + int ret = ESRCH; + struct posix_thread *t = NULL; - K_SPINLOCK(&pthread_pool_lock) { + SYS_SEM_LOCK(&pthread_pool_lock) { t = to_posix_thread(pthread); if (t == NULL) { ret = ESRCH; - K_SPINLOCK_BREAK; + SYS_SEM_LOCK_BREAK; } if (posix_thread_q_get(t) == POSIX_THREAD_READY_Q || t->attr.detachstate != PTHREAD_CREATE_JOINABLE) { LOG_DBG("Pthread %p cannot be detached", &t->thread); ret = EINVAL; - K_SPINLOCK_BREAK; + SYS_SEM_LOCK_BREAK; } + ret = 0; t->attr.detachstate = PTHREAD_CREATE_DETACHED; } @@ -1414,26 +1425,27 @@ int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(vo /* this should probably go into signal.c but we need access to the lock */ int pthread_sigmask(int how, const sigset_t *ZRESTRICT set, sigset_t *ZRESTRICT oset) { - int ret = 0; - struct posix_thread *t; + int ret = ESRCH; + struct posix_thread *t = NULL; if (!(how == SIG_BLOCK || how == SIG_SETMASK || how == SIG_UNBLOCK)) { return EINVAL; } - K_SPINLOCK(&pthread_pool_lock) { + SYS_SEM_LOCK(&pthread_pool_lock) { t = to_posix_thread(pthread_self()); if (t == NULL) { ret = ESRCH; - K_SPINLOCK_BREAK; + SYS_SEM_LOCK_BREAK; } if (oset != NULL) { *oset = t->sigset; } + ret = 0; if (set == NULL) { - K_SPINLOCK_BREAK; + SYS_SEM_LOCK_BREAK; } switch (how) { diff --git a/lib/posix/options/rwlock.c b/lib/posix/options/rwlock.c index f282fc26549fe..aad0a4d4713fa 100644 --- a/lib/posix/options/rwlock.c +++ b/lib/posix/options/rwlock.c @@ -11,13 +11,14 @@ #include #include #include +#include #define CONCURRENT_READER_LIMIT (CONFIG_POSIX_THREAD_THREADS_MAX + 1) struct posix_rwlock { - struct k_sem rd_sem; - struct k_sem wr_sem; - struct k_sem reader_active; /* blocks WR till reader has acquired lock */ + struct sys_sem rd_sem; + struct sys_sem wr_sem; + struct sys_sem reader_active; /* blocks WR till reader has acquired lock */ k_tid_t wr_owner; }; @@ -32,7 +33,7 @@ static uint32_t write_lock_acquire(struct posix_rwlock *rwl, int32_t timeout); LOG_MODULE_REGISTER(pthread_rwlock, CONFIG_PTHREAD_RWLOCK_LOG_LEVEL); -static struct k_spinlock posix_rwlock_spinlock; +static SYS_SEM_DEFINE(posix_rwlock_lock, 1, 1); static struct posix_rwlock posix_rwlock_pool[CONFIG_MAX_PTHREAD_RWLOCK_COUNT]; SYS_BITARRAY_DEFINE_STATIC(posix_rwlock_bitarray, CONFIG_MAX_PTHREAD_RWLOCK_COUNT); @@ -123,9 +124,9 @@ int pthread_rwlock_init(pthread_rwlock_t *rwlock, return ENOMEM; } - k_sem_init(&rwl->rd_sem, CONCURRENT_READER_LIMIT, CONCURRENT_READER_LIMIT); - k_sem_init(&rwl->wr_sem, 1, 1); - k_sem_init(&rwl->reader_active, 1, 1); + sys_sem_init(&rwl->rd_sem, CONCURRENT_READER_LIMIT, CONCURRENT_READER_LIMIT); + sys_sem_init(&rwl->wr_sem, 1, 1); + sys_sem_init(&rwl->reader_active, 1, 1); rwl->wr_owner = NULL; LOG_DBG("Initialized rwlock %p", rwl); @@ -140,22 +141,24 @@ int pthread_rwlock_init(pthread_rwlock_t *rwlock, */ int pthread_rwlock_destroy(pthread_rwlock_t *rwlock) { - int ret = 0; int err; size_t bit; + int ret = EINVAL; struct posix_rwlock *rwl; - rwl = get_posix_rwlock(*rwlock); - if (rwl == NULL) { - return EINVAL; - } + SYS_SEM_LOCK(&posix_rwlock_lock) { + rwl = get_posix_rwlock(*rwlock); + if (rwl == NULL) { + ret = EINVAL; + SYS_SEM_LOCK_BREAK; + } - K_SPINLOCK(&posix_rwlock_spinlock) { if (rwl->wr_owner != NULL) { ret = EBUSY; - K_SPINLOCK_BREAK; + SYS_SEM_LOCK_BREAK; } + ret = 0; bit = posix_rwlock_to_offset(rwl); err = sys_bitarray_free(&posix_rwlock_bitarray, 1, bit); __ASSERT_NO_MSG(err == 0); @@ -328,15 +331,15 @@ int pthread_rwlock_unlock(pthread_rwlock_t *rwlock) if (k_current_get() == rwl->wr_owner) { /* Write unlock */ rwl->wr_owner = NULL; - k_sem_give(&rwl->reader_active); - k_sem_give(&rwl->wr_sem); + sys_sem_give(&rwl->reader_active); + sys_sem_give(&rwl->wr_sem); } else { /* Read unlock */ - k_sem_give(&rwl->rd_sem); + sys_sem_give(&rwl->rd_sem); - if (k_sem_count_get(&rwl->rd_sem) == CONCURRENT_READER_LIMIT) { + if (sys_sem_count_get(&rwl->rd_sem) == CONCURRENT_READER_LIMIT) { /* Last read lock, unlock writer */ - k_sem_give(&rwl->reader_active); + sys_sem_give(&rwl->reader_active); } } return 0; @@ -346,10 +349,10 @@ static uint32_t read_lock_acquire(struct posix_rwlock *rwl, int32_t timeout) { uint32_t ret = 0U; - if (k_sem_take(&rwl->wr_sem, SYS_TIMEOUT_MS(timeout)) == 0) { - k_sem_take(&rwl->reader_active, K_NO_WAIT); - k_sem_take(&rwl->rd_sem, K_NO_WAIT); - k_sem_give(&rwl->wr_sem); + if (sys_sem_take(&rwl->wr_sem, SYS_TIMEOUT_MS(timeout)) == 0) { + sys_sem_take(&rwl->reader_active, K_NO_WAIT); + sys_sem_take(&rwl->rd_sem, K_NO_WAIT); + sys_sem_give(&rwl->wr_sem); } else { ret = EBUSY; } @@ -366,7 +369,7 @@ static uint32_t write_lock_acquire(struct posix_rwlock *rwl, int32_t timeout) k_timeout = SYS_TIMEOUT_MS(timeout); /* waiting for release of write lock */ - if (k_sem_take(&rwl->wr_sem, k_timeout) == 0) { + if (sys_sem_take(&rwl->wr_sem, k_timeout) == 0) { /* update remaining timeout time for 2nd sem */ if (timeout != SYS_FOREVER_MS) { elapsed_time = k_uptime_get() - st_time; @@ -377,10 +380,10 @@ static uint32_t write_lock_acquire(struct posix_rwlock *rwl, int32_t timeout) k_timeout = SYS_TIMEOUT_MS(timeout); /* waiting for reader to complete operation */ - if (k_sem_take(&rwl->reader_active, k_timeout) == 0) { + if (sys_sem_take(&rwl->reader_active, k_timeout) == 0) { rwl->wr_owner = k_current_get(); } else { - k_sem_give(&rwl->wr_sem); + sys_sem_give(&rwl->wr_sem); ret = EBUSY; } From d11a0c2be968cb4f435f0d0873a37d9687cacbe1 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Fri, 26 Apr 2024 03:20:13 -0400 Subject: [PATCH 0221/4482] tests: posix: common: test userspace as well Ensure that userspace is tested in the common posix testsuite. Signed-off-by: Chris Friedt --- tests/posix/common/testcase.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/posix/common/testcase.yaml b/tests/posix/common/testcase.yaml index 55084da91e3b5..b5945df205edc 100644 --- a/tests/posix/common/testcase.yaml +++ b/tests/posix/common/testcase.yaml @@ -71,3 +71,9 @@ tests: extra_configs: - CONFIG_DYNAMIC_THREAD=n - CONFIG_THREAD_STACK_INFO=n + portability.posix.common.userspace: + filter: CONFIG_ARCH_HAS_USERSPACE + tags: + - userspace + extra_configs: + - CONFIG_USERSPACE=y From 98f19592f140cc871c59364ee15be8b40a0c2c13 Mon Sep 17 00:00:00 2001 From: Sadik Ozer Date: Mon, 23 Sep 2024 18:28:47 +0300 Subject: [PATCH 0222/4482] dts: arm: adi: Add MAX32662 missing pin definitions This commit add missing pins that not defined in pinctrl file Signed-off-by: Sadik Ozer --- dts/arm/adi/max32/max32662-pinctrl.dtsi | 106 ++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/dts/arm/adi/max32/max32662-pinctrl.dtsi b/dts/arm/adi/max32/max32662-pinctrl.dtsi index 585b08f85c8b2..7c8d7a2fb136f 100644 --- a/dts/arm/adi/max32/max32662-pinctrl.dtsi +++ b/dts/arm/adi/max32/max32662-pinctrl.dtsi @@ -146,6 +146,38 @@ pinmux = ; }; + /omit-if-no-ref/ spi1a_miso_p0_7: spi1a_miso_p0_7 { + pinmux = ; + }; + + /omit-if-no-ref/ uart0b_cts_p0_7: uart0b_cts_p0_7 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr2c_ia_p0_7: tmr2c_ia_p0_7 { + pinmux = ; + }; + + /omit-if-no-ref/ uart0d_rx_p0_7: uart0d_rx_p0_7 { + pinmux = ; + }; + + /omit-if-no-ref/ spi1a_mosi_p0_8: spi1a_mosi_p0_8 { + pinmux = ; + }; + + /omit-if-no-ref/ uart0b_rts_p0_8: uart0b_rts_p0_8 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr2c_oa_p0_8: tmr2c_oa_p0_8 { + pinmux = ; + }; + + /omit-if-no-ref/ uart0d_tx_p0_8: uart0d_tx_p0_8 { + pinmux = ; + }; + /omit-if-no-ref/ i2c1a_sda_p0_9: i2c1a_sda_p0_9 { pinmux = ; }; @@ -233,6 +265,80 @@ /omit-if-no-ref/ ain0_p0_13: ain0_p0_13 { pinmux = ; }; + + + + /omit-if-no-ref/ pt0a_p0_14: pt0a_p0_14 { + pinmux = ; + }; + + /omit-if-no-ref/ pt1a_p0_15: pt1a_p0_15 { + pinmux = ; + }; + + /omit-if-no-ref/ can0b_rx_p0_15: can0b_rx_p0_15 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr2c_ia_p0_15: tmr2c_ia_p0_15 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr0d_ia_p0_15: tmr0d_ia_p0_15 { + pinmux = ; + }; + + /omit-if-no-ref/ pt2a_p0_16: pt2a_p0_16 { + pinmux = ; + }; + + /omit-if-no-ref/ can0b_tx_p0_16: can0b_tx_p0_16 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr2c_oa_p0_16: tmr2c_oa_p0_16 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr0d_oa_p0_16: tmr0d_oa_p0_16 { + pinmux = ; + }; + + /omit-if-no-ref/ spi1a_sck_p0_17: spi1a_sck_p0_17 { + pinmux = ; + }; + + /omit-if-no-ref/ adc_trig_c_p0_17: adc_trig_c_p0_17 { + pinmux = ; + }; + + /omit-if-no-ref/ uart0d_cts_p0_17: uart0d_cts_p0_17 { + pinmux = ; + }; + + /omit-if-no-ref/ spi1a_ss0_p0_18: spi1a_ss0_p0_18 { + pinmux = ; + }; + + /omit-if-no-ref/ uart0d_rts_p0_17: uart0d_rts_p0_17 { + pinmux = ; + }; + + /omit-if-no-ref/ uart0a_rts_p0_19: uart0a_rts_p0_19 { + pinmux = ; + }; + + /omit-if-no-ref/ tmrt1c_ia_p0_19: tmrt1c_ia_p0_19 { + pinmux = ; + }; + + /omit-if-no-ref/ uart0a_cts_p0_20: uart0a_cts_p0_20 { + pinmux = ; + }; + + /omit-if-no-ref/ tmrt1c_oa_p0_20: tmrt1c_oa_p0_20 { + pinmux = ; + }; }; }; }; From 3f4a9c408a2c478062cf634f15643a5a63b5f4ee Mon Sep 17 00:00:00 2001 From: Sadik Ozer Date: Mon, 23 Sep 2024 18:36:31 +0300 Subject: [PATCH 0223/4482] boards: arm: adi: Enable display for MAX32662EVKIT board MAX32662EVKIT board has CFAF128128B1-0145T display which is 128x128 graphic display. This commit enable mpi dbi display support with LVGL graphic library. Pin connection of display is 3wire mode SRAM size increased to be fit with lvgl example. Signed-off-by: Sadik Ozer --- boards/adi/max32662evkit/Kconfig.defconfig | 29 +++++++++++ boards/adi/max32662evkit/max32662evkit.dts | 51 +++++++++++++++++++ .../display/lvgl/boards/max32662evkit.overlay | 19 +++++++ 3 files changed, 99 insertions(+) create mode 100644 boards/adi/max32662evkit/Kconfig.defconfig create mode 100644 samples/subsys/display/lvgl/boards/max32662evkit.overlay diff --git a/boards/adi/max32662evkit/Kconfig.defconfig b/boards/adi/max32662evkit/Kconfig.defconfig new file mode 100644 index 0000000000000..5bacd313ad7dc --- /dev/null +++ b/boards/adi/max32662evkit/Kconfig.defconfig @@ -0,0 +1,29 @@ +# MAX32662EVKIT boards configuration + +# Copyright (c) 2024 Analog Devices, Inc. +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_MAX32662EVKIT + +if DISPLAY + +config MIPI_DBI_SPI_3WIRE + default y + +if LVGL + +config LV_Z_BITS_PER_PIXEL + default 16 + +choice LV_COLOR_DEPTH + default LV_COLOR_DEPTH_16 # 16 bit per pixel +endchoice + +config LV_COLOR_16_SWAP + default y + +endif # LVGL + +endif # DISPLAY + +endif # BOARD_MAX32662EVKIT diff --git a/boards/adi/max32662evkit/max32662evkit.dts b/boards/adi/max32662evkit/max32662evkit.dts index e458a8d69047d..25a9e35177f2d 100644 --- a/boards/adi/max32662evkit/max32662evkit.dts +++ b/boards/adi/max32662evkit/max32662evkit.dts @@ -11,6 +11,7 @@ #include #include #include +#include / { model = "Analog Devices MAX32662EVKIT"; @@ -21,6 +22,7 @@ zephyr,shell-uart = &uart0; zephyr,sram = &sram2; zephyr,flash = &flash0; + zephyr,display = &st7735; }; leds { @@ -47,6 +49,40 @@ sw0 = &pb1; watchdog0 = &wdt0; }; + + mipi_dbi { + compatible = "zephyr,mipi-dbi-spi"; + spi-dev = <&spi1>; + #address-cells = <1>; + #size-cells = <0>; + + status = "okay"; + + st7735: st7735@0 { + compatible = "sitronix,st7735r"; + mipi-max-frequency = ; + mipi-mode = ; + + reg = <0>; + width = <130>; + height = <132>; + x-offset = <0>; + y-offset = <0>; + madctl = <0xc0>; + colmod = <0x05>; + vmctr1 = <0x51>; + pwctr1 = [02 02]; + pwctr2 = [c5]; + pwctr3 = [0d 00]; + pwctr4 = [8d 1a]; + pwctr5 = [8d ee]; + frmctr1 = [02 35 36]; + frmctr2 = [02 35 36]; + frmctr3 = [02 35 36 02 35 36]; + gamctrp1 = [0a 1c 0c 14 33 2b 24 28 27 25 2c 39 00 05 03 0d]; + gamctrn1 = [0a 1c 0c 14 33 2b 24 28 27 25 2d 3a 00 05 03 0d]; + }; + }; }; &uart0 { @@ -89,3 +125,18 @@ pinctrl-0 = <&spi0a_copi_p0_3 &spi0a_cito_p0_2 &spi0a_sck_p0_4 &spi0a_ts0_p0_5>; pinctrl-names = "default"; }; + +&spi1a_mosi_p0_8 { + power-source=; +}; + +&spi1a_sck_p0_17 { + power-source=; +}; + +&spi1 { + status = "okay"; + pinctrl-0 = <&spi1a_mosi_p0_8 &spi1a_sck_p0_17>; + pinctrl-names = "default"; + cs-gpios = <&gpio0 18 (GPIO_ACTIVE_LOW | MAX32_VSEL_VDDIOH)>; +}; diff --git a/samples/subsys/display/lvgl/boards/max32662evkit.overlay b/samples/subsys/display/lvgl/boards/max32662evkit.overlay new file mode 100644 index 0000000000000..b2a51459c4441 --- /dev/null +++ b/samples/subsys/display/lvgl/boards/max32662evkit.overlay @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2024, Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + zephyr,sram = &sram0; + }; +}; + +/* + * Concatenate SRAM0(16KB), SRAM1(16KB) and SRAM2(16KB) + * to lvgl example work + */ +&sram0 { + reg = <0x20000000 DT_SIZE_K(48)>; +}; From dd08fe5893de1a0fcd0a9948b7ae2ce90740c29e Mon Sep 17 00:00:00 2001 From: Florian Grandel Date: Mon, 23 Sep 2024 05:50:18 +0200 Subject: [PATCH 0224/4482] cmake: emu: qemu: return to ctrl-c To avoid killing the QEMU process w/o also ending the 802.15.4 monitoring tool, we reassign the terminal's interrupt shortcut from ^C to ^D. This change resets the shortcut to ^C after ending the QEMU session. Fixes #79131 Signed-off-by: Florian Grandel --- cmake/emu/qemu.cmake | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/cmake/emu/qemu.cmake b/cmake/emu/qemu.cmake index cc47f48d1ffea..11dead318fbb5 100644 --- a/cmake/emu/qemu.cmake +++ b/cmake/emu/qemu.cmake @@ -257,26 +257,27 @@ elseif(QEMU_NET_STACK) set_ifndef(NET_TOOLS ${ZEPHYR_BASE}/../tools/net-tools) # Default if not set list(APPEND PRE_QEMU_COMMANDS_FOR_server - COMMAND #Disable Ctrl-C to ensure that users won't accidentally exit #w/o killing the monitor. - stty intr ^d - COMMAND + COMMAND stty intr ^d + #This command is run in the background using '&'. This prevents #chaining other commands with '&&'. The command is enclosed in '{}' #to fix this. - { - ${NET_TOOLS}/monitor_15_4 - ${PCAP} - /tmp/ip-stack-server - /tmp/ip-stack-client - > /dev/null & + COMMAND { + ${NET_TOOLS}/monitor_15_4 + ${PCAP} + /tmp/ip-stack-server + /tmp/ip-stack-client + > /dev/null & } ) set(POST_QEMU_COMMANDS_FOR_server - COMMAND + # Re-enable Ctrl-C. + COMMAND stty intr ^c + # Kill the monitor_15_4 sub-process - pkill -P $$$$ + COMMAND pkill -P $$$$ ) endif() endif(QEMU_PIPE_STACK) From a5aed04b7eea268d36aae66eb068cb5bd3d33c1a Mon Sep 17 00:00:00 2001 From: Tommi Rantanen Date: Mon, 30 Sep 2024 11:30:18 +0300 Subject: [PATCH 0225/4482] net: lib: coap: Initialize response_truncated Fix the following compilation warning given when using newlibc: warning: 'response_truncated' may be used uninitialized [-Wmaybe-uninitialized] Issue is not seen with picolibc. The variable was introduced as part of PR #76257 Signed-off-by: Tommi Rantanen --- subsys/net/lib/coap/coap_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index e2fd86167f592..5569ab17008fb 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -935,7 +935,7 @@ static void coap_client_recv(void *coap_cl, void *a, void *b) for (int i = 0; i < num_clients; i++) { if (clients[i]->response_ready) { struct coap_packet response; - bool response_truncated; + bool response_truncated = false; k_mutex_lock(&clients[i]->lock, K_FOREVER); From 404e9c7b88629cdaf852c7c8d4d725c8f0c7117b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Fri, 27 Sep 2024 14:48:28 +0200 Subject: [PATCH 0226/4482] net: sockets: Split native IP socket implementation from syscalls Native IP socket implementation need only be build if native IP stack is enabled. Therefore, split the native IP sockets from the common socket syscalls shared across all socket implementations. Signed-off-by: Robert Lubos --- subsys/net/lib/sockets/CMakeLists.txt | 1 + subsys/net/lib/sockets/sockets.c | 3669 ++++--------------------- subsys/net/lib/sockets/sockets_inet.c | 2758 +++++++++++++++++++ 3 files changed, 3218 insertions(+), 3210 deletions(-) create mode 100644 subsys/net/lib/sockets/sockets_inet.c diff --git a/subsys/net/lib/sockets/CMakeLists.txt b/subsys/net/lib/sockets/CMakeLists.txt index 253cb4a182f8c..28b76df4a7af4 100644 --- a/subsys/net/lib/sockets/CMakeLists.txt +++ b/subsys/net/lib/sockets/CMakeLists.txt @@ -20,6 +20,7 @@ zephyr_library_sources( ) endif() +zephyr_library_sources_ifdef(CONFIG_NET_NATIVE sockets_inet.c) zephyr_library_sources_ifdef(CONFIG_NET_SOCKETS_CAN sockets_can.c) zephyr_library_sources_ifdef(CONFIG_NET_SOCKETS_PACKET sockets_packet.c) zephyr_library_sources_ifdef(CONFIG_NET_SOCKETS_SOCKOPT_TLS sockets_tls.c) diff --git a/subsys/net/lib/sockets/sockets.c b/subsys/net/lib/sockets/sockets.c index 12fbce5c6c527..8b420cc9e68de 100644 --- a/subsys/net/lib/sockets/sockets.c +++ b/subsys/net/lib/sockets/sockets.c @@ -11,32 +11,11 @@ LOG_MODULE_REGISTER(net_sock, CONFIG_NET_SOCKETS_LOG_LEVEL); #include -#include -#include #include #include -#include -#include #include -#include -#include -#include - -#if defined(CONFIG_SOCKS) -#include "socks.h" -#endif - -#include -#include "../../ip/ipv6.h" - -#include "../../ip/net_stats.h" #include "sockets_internal.h" -#include "../../ip/tcp_internal.h" -#include "../../ip/net_private.h" - -#define SET_ERRNO(x) \ - { int _err = x; if (_err < 0) { errno = -_err; return -1; } } #define VTABLE_CALL(fn, sock, ...) \ ({ \ @@ -65,8 +44,6 @@ LOG_MODULE_REGISTER(net_sock, CONFIG_NET_SOCKETS_LOG_LEVEL); retval; \ }) -const struct socket_op_vtable sock_fd_op_vtable; - static inline void *get_sock_vtable(int sock, const struct socket_op_vtable **vtable, struct k_mutex **lock) @@ -114,108 +91,6 @@ void *z_vrfy_zsock_get_context_object(int sock) #include #endif -static void zsock_received_cb(struct net_context *ctx, - struct net_pkt *pkt, - union net_ip_header *ip_hdr, - union net_proto_header *proto_hdr, - int status, - void *user_data); - -static int fifo_wait_non_empty(struct k_fifo *fifo, k_timeout_t timeout) -{ - struct k_poll_event events[] = { - K_POLL_EVENT_INITIALIZER(K_POLL_TYPE_FIFO_DATA_AVAILABLE, - K_POLL_MODE_NOTIFY_ONLY, fifo), - }; - - return k_poll(events, ARRAY_SIZE(events), timeout); -} - -static void zsock_flush_queue(struct net_context *ctx) -{ - bool is_listen = net_context_get_state(ctx) == NET_CONTEXT_LISTENING; - void *p; - - /* recv_q and accept_q are shared via a union */ - while ((p = k_fifo_get(&ctx->recv_q, K_NO_WAIT)) != NULL) { - if (is_listen) { - NET_DBG("discarding ctx %p", p); - net_context_put(p); - } else { - NET_DBG("discarding pkt %p", p); - net_pkt_unref(p); - } - } - - /* Some threads might be waiting on recv, cancel the wait */ - k_fifo_cancel_wait(&ctx->recv_q); - - /* Wake reader if it was sleeping */ - (void)k_condvar_signal(&ctx->cond.recv); -} - -#if defined(CONFIG_NET_NATIVE) -static int zsock_socket_internal(int family, int type, int proto) -{ - int fd = zvfs_reserve_fd(); - struct net_context *ctx; - int res; - - if (fd < 0) { - return -1; - } - - if (proto == 0) { - if (family == AF_INET || family == AF_INET6) { - if (type == SOCK_DGRAM) { - proto = IPPROTO_UDP; - } else if (type == SOCK_STREAM) { - proto = IPPROTO_TCP; - } - } - } - - res = net_context_get(family, type, proto, &ctx); - if (res < 0) { - zvfs_free_fd(fd); - errno = -res; - return -1; - } - - /* Initialize user_data, all other calls will preserve it */ - ctx->user_data = NULL; - - /* The socket flags are stored here */ - ctx->socket_data = NULL; - - /* recv_q and accept_q are in union */ - k_fifo_init(&ctx->recv_q); - - /* Condition variable is used to avoid keeping lock for a long time - * when waiting data to be received - */ - k_condvar_init(&ctx->cond.recv); - - /* TCP context is effectively owned by both application - * and the stack: stack may detect that peer closed/aborted - * connection, but it must not dispose of the context behind - * the application back. Likewise, when application "closes" - * context, it's not disposed of immediately - there's yet - * closing handshake for stack to perform. - */ - if (proto == IPPROTO_TCP) { - net_context_ref(ctx); - } - - zvfs_finalize_typed_fd(fd, ctx, (const struct fd_op_vtable *)&sock_fd_op_vtable, - ZVFS_MODE_IFSOCK); - - NET_DBG("socket: ctx=%p, fd=%d", ctx, fd); - - return fd; -} -#endif /* CONFIG_NET_NATIVE */ - int z_impl_zsock_socket(int family, int type, int proto) { STRUCT_SECTION_FOREACH(net_socket_register, sock_family) { @@ -259,29 +134,6 @@ static inline int z_vrfy_zsock_socket(int family, int type, int proto) #include #endif /* CONFIG_USERSPACE */ -int zsock_close_ctx(struct net_context *ctx) -{ - /* Reset callbacks to avoid any race conditions while - * flushing queues. No need to check return values here, - * as these are fail-free operations and we're closing - * socket anyway. - */ - if (net_context_get_state(ctx) == NET_CONTEXT_LISTENING) { - (void)net_context_accept(ctx, NULL, K_NO_WAIT, NULL); - } else { - (void)net_context_recv(ctx, NULL, K_NO_WAIT, NULL); - } - - ctx->user_data = INT_TO_POINTER(EINTR); - sock_set_error(ctx); - - zsock_flush_queue(ctx); - - SET_ERRNO(net_context_put(ctx)); - - return 0; -} - int z_impl_zsock_close(int sock) { const struct socket_op_vtable *vtable; @@ -366,128 +218,6 @@ static inline int z_vrfy_zsock_shutdown(int sock, int how) #include #endif /* CONFIG_USERSPACE */ -static void zsock_accepted_cb(struct net_context *new_ctx, - struct sockaddr *addr, socklen_t addrlen, - int status, void *user_data) { - struct net_context *parent = user_data; - - NET_DBG("parent=%p, ctx=%p, st=%d", parent, new_ctx, status); - - if (status == 0) { - /* This just installs a callback, so cannot fail. */ - (void)net_context_recv(new_ctx, zsock_received_cb, K_NO_WAIT, - NULL); - k_fifo_init(&new_ctx->recv_q); - k_condvar_init(&new_ctx->cond.recv); - - k_fifo_put(&parent->accept_q, new_ctx); - - /* TCP context is effectively owned by both application - * and the stack: stack may detect that peer closed/aborted - * connection, but it must not dispose of the context behind - * the application back. Likewise, when application "closes" - * context, it's not disposed of immediately - there's yet - * closing handshake for stack to perform. - */ - net_context_ref(new_ctx); - - (void)k_condvar_signal(&parent->cond.recv); - } - -} - -static void zsock_received_cb(struct net_context *ctx, - struct net_pkt *pkt, - union net_ip_header *ip_hdr, - union net_proto_header *proto_hdr, - int status, - void *user_data) -{ - if (ctx->cond.lock) { - (void)k_mutex_lock(ctx->cond.lock, K_FOREVER); - } - - NET_DBG("ctx=%p, pkt=%p, st=%d, user_data=%p", ctx, pkt, status, - user_data); - - if (status < 0) { - ctx->user_data = INT_TO_POINTER(-status); - sock_set_error(ctx); - } - - /* if pkt is NULL, EOF */ - if (!pkt) { - struct net_pkt *last_pkt = k_fifo_peek_tail(&ctx->recv_q); - - if (!last_pkt) { - /* If there're no packets in the queue, recv() may - * be blocked waiting on it to become non-empty, - * so cancel that wait. - */ - sock_set_eof(ctx); - k_fifo_cancel_wait(&ctx->recv_q); - NET_DBG("Marked socket %p as peer-closed", ctx); - } else { - net_pkt_set_eof(last_pkt, true); - NET_DBG("Set EOF flag on pkt %p", last_pkt); - } - - goto unlock; - } - - /* Normal packet */ - net_pkt_set_eof(pkt, false); - - net_pkt_set_rx_stats_tick(pkt, k_cycle_get_32()); - - k_fifo_put(&ctx->recv_q, pkt); - -unlock: - /* Wake reader if it was sleeping */ - (void)k_condvar_signal(&ctx->cond.recv); - - if (ctx->cond.lock) { - (void)k_mutex_unlock(ctx->cond.lock); - } -} - -int zsock_shutdown_ctx(struct net_context *ctx, int how) -{ - if (how == ZSOCK_SHUT_RD) { - if (net_context_get_state(ctx) == NET_CONTEXT_LISTENING) { - SET_ERRNO(net_context_accept(ctx, NULL, K_NO_WAIT, NULL)); - } else { - SET_ERRNO(net_context_recv(ctx, NULL, K_NO_WAIT, NULL)); - } - - sock_set_eof(ctx); - - zsock_flush_queue(ctx); - } else if (how == ZSOCK_SHUT_WR || how == ZSOCK_SHUT_RDWR) { - SET_ERRNO(-ENOTSUP); - } else { - SET_ERRNO(-EINVAL); - } - - return 0; -} - -int zsock_bind_ctx(struct net_context *ctx, const struct sockaddr *addr, - socklen_t addrlen) -{ - SET_ERRNO(net_context_bind(ctx, addr, addrlen)); - /* For DGRAM socket, we expect to receive packets after call to - * bind(), but for STREAM socket, next expected operation is - * listen(), which doesn't work if recv callback is set. - */ - if (net_context_get_type(ctx) == SOCK_DGRAM) { - SET_ERRNO(net_context_recv(ctx, zsock_received_cb, K_NO_WAIT, - ctx->user_data)); - } - - return 0; -} - int z_impl_zsock_bind(int sock, const struct sockaddr *addr, socklen_t addrlen) { int ret; @@ -516,64 +246,6 @@ static inline int z_vrfy_zsock_bind(int sock, const struct sockaddr *addr, #include #endif /* CONFIG_USERSPACE */ -static void zsock_connected_cb(struct net_context *ctx, int status, void *user_data) -{ - if (status < 0) { - ctx->user_data = INT_TO_POINTER(-status); - sock_set_error(ctx); - } -} - -int zsock_connect_ctx(struct net_context *ctx, const struct sockaddr *addr, - socklen_t addrlen) -{ - -#if defined(CONFIG_SOCKS) - if (net_context_is_proxy_enabled(ctx)) { - SET_ERRNO(net_socks5_connect(ctx, addr, addrlen)); - SET_ERRNO(net_context_recv(ctx, zsock_received_cb, - K_NO_WAIT, ctx->user_data)); - return 0; - } -#endif - if (net_context_get_state(ctx) == NET_CONTEXT_CONNECTED) { - return 0; - } else if (net_context_get_state(ctx) == NET_CONTEXT_CONNECTING) { - if (sock_is_error(ctx)) { - SET_ERRNO(-POINTER_TO_INT(ctx->user_data)); - } else { - SET_ERRNO(-EALREADY); - } - } else { - k_timeout_t timeout = K_MSEC(CONFIG_NET_SOCKETS_CONNECT_TIMEOUT); - net_context_connect_cb_t cb = NULL; - - if (sock_is_nonblock(ctx)) { - timeout = K_NO_WAIT; - cb = zsock_connected_cb; - } - - if (net_context_get_type(ctx) == SOCK_STREAM) { - /* For STREAM sockets net_context_recv() only installs - * recv callback w/o side effects, and it has to be done - * first to avoid race condition, when TCP stream data - * arrives right after connect. - */ - SET_ERRNO(net_context_recv(ctx, zsock_received_cb, - K_NO_WAIT, ctx->user_data)); - SET_ERRNO(net_context_connect(ctx, addr, addrlen, cb, - timeout, ctx->user_data)); - } else { - SET_ERRNO(net_context_connect(ctx, addr, addrlen, cb, - timeout, ctx->user_data)); - SET_ERRNO(net_context_recv(ctx, zsock_received_cb, - K_NO_WAIT, ctx->user_data)); - } - } - - return 0; -} - int z_impl_zsock_connect(int sock, const struct sockaddr *addr, socklen_t addrlen) { @@ -603,14 +275,6 @@ int z_vrfy_zsock_connect(int sock, const struct sockaddr *addr, #include #endif /* CONFIG_USERSPACE */ -int zsock_listen_ctx(struct net_context *ctx, int backlog) -{ - SET_ERRNO(net_context_listen(ctx, backlog)); - SET_ERRNO(net_context_accept(ctx, zsock_accepted_cb, K_NO_WAIT, ctx)); - - return 0; -} - int z_impl_zsock_listen(int sock, int backlog) { int ret; @@ -632,91 +296,6 @@ static inline int z_vrfy_zsock_listen(int sock, int backlog) #include #endif /* CONFIG_USERSPACE */ -int zsock_accept_ctx(struct net_context *parent, struct sockaddr *addr, - socklen_t *addrlen) -{ - struct net_context *ctx; - struct net_pkt *last_pkt; - int fd, ret; - - if (!sock_is_nonblock(parent)) { - k_timeout_t timeout = K_FOREVER; - - /* accept() can reuse zsock_wait_data(), as underneath it's - * monitoring the same queue (accept_q is an alias for recv_q). - */ - ret = zsock_wait_data(parent, &timeout); - if (ret < 0) { - errno = -ret; - return -1; - } - } - - ctx = k_fifo_get(&parent->accept_q, K_NO_WAIT); - if (ctx == NULL) { - errno = EAGAIN; - return -1; - } - - fd = zvfs_reserve_fd(); - if (fd < 0) { - zsock_flush_queue(ctx); - net_context_put(ctx); - return -1; - } - - /* Check if the connection is already disconnected */ - last_pkt = k_fifo_peek_tail(&ctx->recv_q); - if (last_pkt) { - if (net_pkt_eof(last_pkt)) { - sock_set_eof(ctx); - zvfs_free_fd(fd); - zsock_flush_queue(ctx); - net_context_put(ctx); - errno = ECONNABORTED; - return -1; - } - } - - if (net_context_is_closing(ctx)) { - errno = ECONNABORTED; - zvfs_free_fd(fd); - zsock_flush_queue(ctx); - net_context_put(ctx); - return -1; - } - - net_context_set_accepting(ctx, false); - - - if (addr != NULL && addrlen != NULL) { - int len = MIN(*addrlen, sizeof(ctx->remote)); - - memcpy(addr, &ctx->remote, len); - /* addrlen is a value-result argument, set to actual - * size of source address - */ - if (ctx->remote.sa_family == AF_INET) { - *addrlen = sizeof(struct sockaddr_in); - } else if (ctx->remote.sa_family == AF_INET6) { - *addrlen = sizeof(struct sockaddr_in6); - } else { - zvfs_free_fd(fd); - errno = ENOTSUP; - zsock_flush_queue(ctx); - net_context_put(ctx); - return -1; - } - } - - NET_DBG("accept: ctx=%p, fd=%d", ctx, fd); - - zvfs_finalize_typed_fd(fd, ctx, (const struct fd_op_vtable *)&sock_fd_op_vtable, - ZVFS_MODE_IFSOCK); - - return fd; -} - int z_impl_zsock_accept(int sock, struct sockaddr *addr, socklen_t *addrlen) { int new_sock; @@ -755,142 +334,6 @@ static inline int z_vrfy_zsock_accept(int sock, struct sockaddr *addr, #include #endif /* CONFIG_USERSPACE */ -#define WAIT_BUFS_INITIAL_MS 10 -#define WAIT_BUFS_MAX_MS 100 -#define MAX_WAIT_BUFS K_MSEC(CONFIG_NET_SOCKET_MAX_SEND_WAIT) - -static int send_check_and_wait(struct net_context *ctx, int status, - k_timepoint_t buf_timeout, k_timeout_t timeout, - uint32_t *retry_timeout) -{ - if (K_TIMEOUT_EQ(timeout, K_NO_WAIT)) { - goto out; - } - - if (status != -ENOBUFS && status != -EAGAIN) { - goto out; - } - - /* If we cannot get any buffers in reasonable - * amount of time, then do not wait forever as - * there might be some bigger issue. - * If we get -EAGAIN and cannot recover, then - * it means that the sending window is blocked - * and we just cannot send anything. - */ - if (sys_timepoint_expired(buf_timeout)) { - if (status == -ENOBUFS) { - status = -ENOMEM; - } else { - status = -ENOBUFS; - } - - goto out; - } - - if (!K_TIMEOUT_EQ(timeout, K_FOREVER)) { - *retry_timeout = - MIN(*retry_timeout, k_ticks_to_ms_floor32(timeout.ticks)); - } - - if (ctx->cond.lock) { - (void)k_mutex_unlock(ctx->cond.lock); - } - - if (status == -ENOBUFS) { - /* We can monitor net_pkt/net_buf availability, so just wait. */ - k_sleep(K_MSEC(*retry_timeout)); - } - - if (status == -EAGAIN) { - if (IS_ENABLED(CONFIG_NET_NATIVE_TCP) && - net_context_get_type(ctx) == SOCK_STREAM && - !net_if_is_ip_offloaded(net_context_get_iface(ctx))) { - struct k_poll_event event; - - k_poll_event_init(&event, - K_POLL_TYPE_SEM_AVAILABLE, - K_POLL_MODE_NOTIFY_ONLY, - net_tcp_tx_sem_get(ctx)); - - k_poll(&event, 1, K_MSEC(*retry_timeout)); - } else { - k_sleep(K_MSEC(*retry_timeout)); - } - } - /* Exponentially increase the retry timeout - * Cap the value to WAIT_BUFS_MAX_MS - */ - *retry_timeout = MIN(WAIT_BUFS_MAX_MS, *retry_timeout << 1); - - if (ctx->cond.lock) { - (void)k_mutex_lock(ctx->cond.lock, K_FOREVER); - } - - return 0; - -out: - errno = -status; - return -1; -} - -ssize_t zsock_sendto_ctx(struct net_context *ctx, const void *buf, size_t len, - int flags, - const struct sockaddr *dest_addr, socklen_t addrlen) -{ - k_timeout_t timeout = K_FOREVER; - uint32_t retry_timeout = WAIT_BUFS_INITIAL_MS; - k_timepoint_t buf_timeout, end; - int status; - - if ((flags & ZSOCK_MSG_DONTWAIT) || sock_is_nonblock(ctx)) { - timeout = K_NO_WAIT; - buf_timeout = sys_timepoint_calc(K_NO_WAIT); - } else { - net_context_get_option(ctx, NET_OPT_SNDTIMEO, &timeout, NULL); - buf_timeout = sys_timepoint_calc(MAX_WAIT_BUFS); - } - end = sys_timepoint_calc(timeout); - - /* Register the callback before sending in order to receive the response - * from the peer. - */ - status = net_context_recv(ctx, zsock_received_cb, - K_NO_WAIT, ctx->user_data); - if (status < 0) { - errno = -status; - return -1; - } - - while (1) { - if (dest_addr) { - status = net_context_sendto(ctx, buf, len, dest_addr, - addrlen, NULL, timeout, - ctx->user_data); - } else { - status = net_context_send(ctx, buf, len, NULL, timeout, - ctx->user_data); - } - - if (status < 0) { - status = send_check_and_wait(ctx, status, buf_timeout, - timeout, &retry_timeout); - if (status < 0) { - return status; - } - - /* Update the timeout value in case loop is repeated. */ - timeout = sys_timepoint_timeout(end); - - continue; - } - - break; - } - - return status; -} - ssize_t z_impl_zsock_sendto(int sock, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen) { @@ -929,58 +372,6 @@ ssize_t z_vrfy_zsock_sendto(int sock, const void *buf, size_t len, int flags, #include #endif /* CONFIG_USERSPACE */ -size_t msghdr_non_empty_iov_count(const struct msghdr *msg) -{ - size_t non_empty_iov_count = 0; - - for (size_t i = 0; i < msg->msg_iovlen; i++) { - if (msg->msg_iov[i].iov_len) { - non_empty_iov_count++; - } - } - - return non_empty_iov_count; -} - -ssize_t zsock_sendmsg_ctx(struct net_context *ctx, const struct msghdr *msg, - int flags) -{ - k_timeout_t timeout = K_FOREVER; - uint32_t retry_timeout = WAIT_BUFS_INITIAL_MS; - k_timepoint_t buf_timeout, end; - int status; - - if ((flags & ZSOCK_MSG_DONTWAIT) || sock_is_nonblock(ctx)) { - timeout = K_NO_WAIT; - buf_timeout = sys_timepoint_calc(K_NO_WAIT); - } else { - net_context_get_option(ctx, NET_OPT_SNDTIMEO, &timeout, NULL); - buf_timeout = sys_timepoint_calc(MAX_WAIT_BUFS); - } - end = sys_timepoint_calc(timeout); - - while (1) { - status = net_context_sendmsg(ctx, msg, flags, NULL, timeout, NULL); - if (status < 0) { - status = send_check_and_wait(ctx, status, - buf_timeout, - timeout, &retry_timeout); - if (status < 0) { - return status; - } - - /* Update the timeout value in case loop is repeated. */ - timeout = sys_timepoint_timeout(end); - - continue; - } - - break; - } - - return status; -} - ssize_t z_impl_zsock_sendmsg(int sock, const struct msghdr *msg, int flags) { int bytes_sent; @@ -1086,2468 +477,631 @@ static inline ssize_t z_vrfy_zsock_sendmsg(int sock, #include #endif /* CONFIG_USERSPACE */ -static int sock_get_pkt_src_addr(struct net_pkt *pkt, - enum net_ip_protocol proto, - struct sockaddr *addr, - socklen_t addrlen) +ssize_t z_impl_zsock_recvfrom(int sock, void *buf, size_t max_len, int flags, + struct sockaddr *src_addr, socklen_t *addrlen) { - int ret = 0; - struct net_pkt_cursor backup; - uint16_t *port; + int bytes_received; - if (!addr || !pkt) { - return -EINVAL; - } + SYS_PORT_TRACING_OBJ_FUNC_ENTER(socket, recvfrom, sock, max_len, flags, src_addr, addrlen); - net_pkt_cursor_backup(pkt, &backup); - net_pkt_cursor_init(pkt); + bytes_received = VTABLE_CALL(recvfrom, sock, buf, max_len, flags, src_addr, addrlen); - addr->sa_family = net_pkt_family(pkt); + SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, recvfrom, sock, + src_addr, addrlen, + bytes_received < 0 ? -errno : bytes_received); - if (IS_ENABLED(CONFIG_NET_IPV4) && - net_pkt_family(pkt) == AF_INET) { - NET_PKT_DATA_ACCESS_CONTIGUOUS_DEFINE(ipv4_access, - struct net_ipv4_hdr); - struct sockaddr_in *addr4 = net_sin(addr); - struct net_ipv4_hdr *ipv4_hdr; + sock_obj_core_update_recv_stats(sock, bytes_received); - if (addrlen < sizeof(struct sockaddr_in)) { - ret = -EINVAL; - goto error; - } + return bytes_received; +} - ipv4_hdr = (struct net_ipv4_hdr *)net_pkt_get_data( - pkt, &ipv4_access); - if (!ipv4_hdr || - net_pkt_acknowledge_data(pkt, &ipv4_access) || - net_pkt_skip(pkt, net_pkt_ipv4_opts_len(pkt))) { - ret = -ENOBUFS; - goto error; - } - - net_ipv4_addr_copy_raw((uint8_t *)&addr4->sin_addr, ipv4_hdr->src); - port = &addr4->sin_port; - } else if (IS_ENABLED(CONFIG_NET_IPV6) && - net_pkt_family(pkt) == AF_INET6) { - NET_PKT_DATA_ACCESS_CONTIGUOUS_DEFINE(ipv6_access, - struct net_ipv6_hdr); - struct sockaddr_in6 *addr6 = net_sin6(addr); - struct net_ipv6_hdr *ipv6_hdr; - - if (addrlen < sizeof(struct sockaddr_in6)) { - ret = -EINVAL; - goto error; - } - - ipv6_hdr = (struct net_ipv6_hdr *)net_pkt_get_data( - pkt, &ipv6_access); - if (!ipv6_hdr || - net_pkt_acknowledge_data(pkt, &ipv6_access) || - net_pkt_skip(pkt, net_pkt_ipv6_ext_len(pkt))) { - ret = -ENOBUFS; - goto error; - } +#ifdef CONFIG_USERSPACE +ssize_t z_vrfy_zsock_recvfrom(int sock, void *buf, size_t max_len, int flags, + struct sockaddr *src_addr, socklen_t *addrlen) +{ + socklen_t addrlen_copy; + ssize_t ret; - net_ipv6_addr_copy_raw((uint8_t *)&addr6->sin6_addr, ipv6_hdr->src); - port = &addr6->sin6_port; - } else { - ret = -ENOTSUP; - goto error; + if (K_SYSCALL_MEMORY_WRITE(buf, max_len)) { + errno = EFAULT; + return -1; } - if (IS_ENABLED(CONFIG_NET_UDP) && proto == IPPROTO_UDP) { - NET_PKT_DATA_ACCESS_DEFINE(udp_access, struct net_udp_hdr); - struct net_udp_hdr *udp_hdr; - - udp_hdr = (struct net_udp_hdr *)net_pkt_get_data(pkt, - &udp_access); - if (!udp_hdr) { - ret = -ENOBUFS; - goto error; - } - - *port = udp_hdr->src_port; - } else if (IS_ENABLED(CONFIG_NET_TCP) && proto == IPPROTO_TCP) { - NET_PKT_DATA_ACCESS_DEFINE(tcp_access, struct net_tcp_hdr); - struct net_tcp_hdr *tcp_hdr; - - tcp_hdr = (struct net_tcp_hdr *)net_pkt_get_data(pkt, - &tcp_access); - if (!tcp_hdr) { - ret = -ENOBUFS; - goto error; - } - - *port = tcp_hdr->src_port; - } else { - ret = -ENOTSUP; + if (addrlen) { + K_OOPS(k_usermode_from_copy(&addrlen_copy, addrlen, + sizeof(socklen_t))); } + K_OOPS(src_addr && K_SYSCALL_MEMORY_WRITE(src_addr, addrlen_copy)); -error: - net_pkt_cursor_restore(pkt, &backup); - - return ret; -} - -#if defined(CONFIG_NET_OFFLOAD) -static bool net_pkt_remote_addr_is_unspecified(struct net_pkt *pkt) -{ - bool ret = true; + ret = z_impl_zsock_recvfrom(sock, (void *)buf, max_len, flags, + (struct sockaddr *)src_addr, + addrlen ? &addrlen_copy : NULL); - if (net_pkt_family(pkt) == AF_INET) { - ret = net_ipv4_is_addr_unspecified(&net_sin(&pkt->remote)->sin_addr); - } else if (net_pkt_family(pkt) == AF_INET6) { - ret = net_ipv6_is_addr_unspecified(&net_sin6(&pkt->remote)->sin6_addr); + if (addrlen) { + K_OOPS(k_usermode_to_copy(addrlen, &addrlen_copy, + sizeof(socklen_t))); } return ret; } +#include +#endif /* CONFIG_USERSPACE */ -static int sock_get_offload_pkt_src_addr(struct net_pkt *pkt, - struct net_context *ctx, - struct sockaddr *addr, - socklen_t addrlen) +ssize_t z_impl_zsock_recvmsg(int sock, struct msghdr *msg, int flags) { - int ret = 0; + int bytes_received; - if (!addr || !pkt) { - return -EINVAL; - } + SYS_PORT_TRACING_OBJ_FUNC_ENTER(socket, recvmsg, sock, msg, flags); - if (!net_pkt_remote_addr_is_unspecified(pkt)) { - if (IS_ENABLED(CONFIG_NET_IPV4) && - net_pkt_family(pkt) == AF_INET) { - if (addrlen < sizeof(struct sockaddr_in)) { - ret = -EINVAL; - goto error; - } + bytes_received = VTABLE_CALL(recvmsg, sock, msg, flags); - memcpy(addr, &pkt->remote, sizeof(struct sockaddr_in)); - } else if (IS_ENABLED(CONFIG_NET_IPV6) && - net_pkt_family(pkt) == AF_INET6) { - if (addrlen < sizeof(struct sockaddr_in6)) { - ret = -EINVAL; - goto error; - } + SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, recvmsg, sock, msg, + bytes_received < 0 ? -errno : bytes_received); - memcpy(addr, &pkt->remote, sizeof(struct sockaddr_in6)); - } - } else if (ctx->flags & NET_CONTEXT_REMOTE_ADDR_SET) { - memcpy(addr, &ctx->remote, MIN(addrlen, sizeof(ctx->remote))); - } else { - ret = -ENOTSUP; - } + sock_obj_core_update_recv_stats(sock, bytes_received); -error: - return ret; + return bytes_received; } -#else -static int sock_get_offload_pkt_src_addr(struct net_pkt *pkt, - struct net_context *ctx, - struct sockaddr *addr, - socklen_t addrlen) + +#ifdef CONFIG_USERSPACE +ssize_t z_vrfy_zsock_recvmsg(int sock, struct msghdr *msg, int flags) { - ARG_UNUSED(pkt); - ARG_UNUSED(ctx); - ARG_UNUSED(addr); - ARG_UNUSED(addrlen); + struct msghdr msg_copy; + size_t iovlen; + size_t i; + int ret; - return 0; -} -#endif /* CONFIG_NET_OFFLOAD */ + if (msg == NULL) { + errno = EINVAL; + return -1; + } -void net_socket_update_tc_rx_time(struct net_pkt *pkt, uint32_t end_tick) -{ - net_pkt_set_rx_stats_tick(pkt, end_tick); + if (msg->msg_iov == NULL) { + errno = ENOMEM; + return -1; + } - net_stats_update_tc_rx_time(net_pkt_iface(pkt), - net_pkt_priority(pkt), - net_pkt_create_time(pkt), - end_tick); + K_OOPS(k_usermode_from_copy(&msg_copy, (void *)msg, sizeof(msg_copy))); - SYS_PORT_TRACING_FUNC(net, rx_time, pkt, end_tick); + k_usermode_from_copy(&iovlen, &msg->msg_iovlen, sizeof(iovlen)); - if (IS_ENABLED(CONFIG_NET_PKT_RXTIME_STATS_DETAIL)) { - uint32_t val, prev = net_pkt_create_time(pkt); - int i; + msg_copy.msg_name = NULL; + msg_copy.msg_control = NULL; - for (i = 0; i < net_pkt_stats_tick_count(pkt); i++) { - if (!net_pkt_stats_tick(pkt)[i]) { - break; - } + msg_copy.msg_iov = k_usermode_alloc_from_copy(msg->msg_iov, + msg->msg_iovlen * sizeof(struct iovec)); + if (!msg_copy.msg_iov) { + errno = ENOMEM; + goto fail; + } + + /* Clear the pointers in the copy so that if the allocation in the + * next loop fails, we do not try to free non allocated memory + * in fail branch. + */ + memset(msg_copy.msg_iov, 0, msg->msg_iovlen * sizeof(struct iovec)); - val = net_pkt_stats_tick(pkt)[i] - prev; - prev = net_pkt_stats_tick(pkt)[i]; - net_pkt_stats_tick(pkt)[i] = val; + for (i = 0; i < iovlen; i++) { + /* TODO: In practice we do not need to copy the actual data + * in msghdr when receiving data but currently there is no + * ready made function to do just that (unless we want to call + * relevant malloc function here ourselves). So just use + * the copying variant for now. + */ + msg_copy.msg_iov[i].iov_base = + k_usermode_alloc_from_copy(msg->msg_iov[i].iov_base, + msg->msg_iov[i].iov_len); + if (!msg_copy.msg_iov[i].iov_base) { + errno = ENOMEM; + goto fail; } - net_stats_update_tc_rx_time_detail( - net_pkt_iface(pkt), - net_pkt_priority(pkt), - net_pkt_stats_tick(pkt)); + msg_copy.msg_iov[i].iov_len = msg->msg_iov[i].iov_len; } -} -int zsock_wait_data(struct net_context *ctx, k_timeout_t *timeout) -{ - int ret; + if (msg->msg_namelen > 0) { + if (msg->msg_name == NULL) { + errno = EINVAL; + goto fail; + } - if (ctx->cond.lock == NULL) { - /* For some reason the lock pointer is not set properly - * when called by fdtable.c:zvfs_finalize_fd() - * It is not practical to try to figure out the fdtable - * lock at this point so skip it. - */ - NET_WARN("No lock pointer set for context %p", ctx); - return -EINVAL; + msg_copy.msg_name = k_usermode_alloc_from_copy(msg->msg_name, + msg->msg_namelen); + if (msg_copy.msg_name == NULL) { + errno = ENOMEM; + goto fail; + } } - if (k_fifo_is_empty(&ctx->recv_q)) { - /* Wait for the data to arrive but without holding a lock */ - ret = k_condvar_wait(&ctx->cond.recv, ctx->cond.lock, - *timeout); - if (ret < 0) { - return ret; + if (msg->msg_controllen > 0) { + if (msg->msg_control == NULL) { + errno = EINVAL; + goto fail; } - if (sock_is_error(ctx)) { - return -POINTER_TO_INT(ctx->user_data); + msg_copy.msg_control = + k_usermode_alloc_from_copy(msg->msg_control, + msg->msg_controllen); + if (msg_copy.msg_control == NULL) { + errno = ENOMEM; + goto fail; } } - return 0; -} + ret = z_impl_zsock_recvmsg(sock, &msg_copy, flags); -static int insert_pktinfo(struct msghdr *msg, int level, int type, - void *pktinfo, size_t pktinfo_len) -{ - struct cmsghdr *cmsg; + /* Do not copy anything back if there was an error or nothing was + * received. + */ + if (ret > 0) { + if (msg->msg_namelen > 0 && msg->msg_name != NULL) { + K_OOPS(k_usermode_to_copy(msg->msg_name, + msg_copy.msg_name, + msg_copy.msg_namelen)); + } - if (msg->msg_controllen < pktinfo_len) { - return -EINVAL; - } + if (msg->msg_controllen > 0 && + msg->msg_control != NULL) { + K_OOPS(k_usermode_to_copy(msg->msg_control, + msg_copy.msg_control, + msg_copy.msg_controllen)); + + msg->msg_controllen = msg_copy.msg_controllen; + } else { + msg->msg_controllen = 0U; + } + + k_usermode_to_copy(&msg->msg_iovlen, + &msg_copy.msg_iovlen, + sizeof(msg->msg_iovlen)); + + /* The new iovlen cannot be bigger than the original one */ + NET_ASSERT(msg_copy.msg_iovlen <= iovlen); - for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) { - if (cmsg->cmsg_len == 0) { - break; + for (i = 0; i < iovlen; i++) { + if (i < msg_copy.msg_iovlen) { + K_OOPS(k_usermode_to_copy(msg->msg_iov[i].iov_base, + msg_copy.msg_iov[i].iov_base, + msg_copy.msg_iov[i].iov_len)); + K_OOPS(k_usermode_to_copy(&msg->msg_iov[i].iov_len, + &msg_copy.msg_iov[i].iov_len, + sizeof(msg->msg_iov[i].iov_len))); + } else { + /* Clear out those vectors that we could not populate */ + msg->msg_iov[i].iov_len = 0; + } } + + k_usermode_to_copy(&msg->msg_flags, + &msg_copy.msg_flags, + sizeof(msg->msg_flags)); } - if (cmsg == NULL) { - return -EINVAL; + k_free(msg_copy.msg_name); + k_free(msg_copy.msg_control); + + /* Note that we need to free according to original iovlen */ + for (i = 0; i < iovlen; i++) { + k_free(msg_copy.msg_iov[i].iov_base); } - cmsg->cmsg_len = CMSG_LEN(pktinfo_len); - cmsg->cmsg_level = level; - cmsg->cmsg_type = type; + k_free(msg_copy.msg_iov); - memcpy(CMSG_DATA(cmsg), pktinfo, pktinfo_len); + return ret; - return 0; -} +fail: + if (msg_copy.msg_name) { + k_free(msg_copy.msg_name); + } -static int add_timestamping(struct net_context *ctx, - struct net_pkt *pkt, - struct msghdr *msg) -{ - uint8_t timestamping = 0; + if (msg_copy.msg_control) { + k_free(msg_copy.msg_control); + } - net_context_get_option(ctx, NET_OPT_TIMESTAMPING, ×tamping, NULL); + if (msg_copy.msg_iov) { + for (i = 0; i < msg_copy.msg_iovlen; i++) { + if (msg_copy.msg_iov[i].iov_base) { + k_free(msg_copy.msg_iov[i].iov_base); + } + } - if (timestamping) { - return insert_pktinfo(msg, SOL_SOCKET, SO_TIMESTAMPING, - net_pkt_timestamp(pkt), sizeof(struct net_ptp_time)); + k_free(msg_copy.msg_iov); } - return -ENOTSUP; + return -1; } +#include +#endif /* CONFIG_USERSPACE */ -static int add_pktinfo(struct net_context *ctx, - struct net_pkt *pkt, - struct msghdr *msg) +/* As this is limited function, we don't follow POSIX signature, with + * "..." instead of last arg. + */ +int z_impl_zsock_fcntl_impl(int sock, int cmd, int flags) { - int ret = -ENOTSUP; - struct net_pkt_cursor backup; - - net_pkt_cursor_backup(pkt, &backup); - net_pkt_cursor_init(pkt); - - if (IS_ENABLED(CONFIG_NET_IPV4) && net_pkt_family(pkt) == AF_INET) { - NET_PKT_DATA_ACCESS_CONTIGUOUS_DEFINE(ipv4_access, - struct net_ipv4_hdr); - struct in_pktinfo info; - struct net_ipv4_hdr *ipv4_hdr; - - ipv4_hdr = (struct net_ipv4_hdr *)net_pkt_get_data( - pkt, &ipv4_access); - if (ipv4_hdr == NULL || - net_pkt_acknowledge_data(pkt, &ipv4_access) || - net_pkt_skip(pkt, net_pkt_ipv4_opts_len(pkt))) { - ret = -ENOBUFS; - goto out; - } - - net_ipv4_addr_copy_raw((uint8_t *)&info.ipi_addr, ipv4_hdr->dst); - net_ipv4_addr_copy_raw((uint8_t *)&info.ipi_spec_dst, - (uint8_t *)net_sin_ptr(&ctx->local)->sin_addr); - info.ipi_ifindex = ctx->iface; + const struct socket_op_vtable *vtable; + struct k_mutex *lock; + void *obj; + int ret; - ret = insert_pktinfo(msg, IPPROTO_IP, IP_PKTINFO, - &info, sizeof(info)); + SYS_PORT_TRACING_OBJ_FUNC_ENTER(socket, fcntl, sock, cmd, flags); - goto out; + obj = get_sock_vtable(sock, &vtable, &lock); + if (obj == NULL) { + errno = EBADF; + SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, fcntl, sock, -errno); + return -1; } - if (IS_ENABLED(CONFIG_NET_IPV6) && net_pkt_family(pkt) == AF_INET6) { - NET_PKT_DATA_ACCESS_CONTIGUOUS_DEFINE(ipv6_access, - struct net_ipv6_hdr); - struct in6_pktinfo info; - struct net_ipv6_hdr *ipv6_hdr; - - ipv6_hdr = (struct net_ipv6_hdr *)net_pkt_get_data( - pkt, &ipv6_access); - if (ipv6_hdr == NULL || - net_pkt_acknowledge_data(pkt, &ipv6_access) || - net_pkt_skip(pkt, net_pkt_ipv6_ext_len(pkt))) { - ret = -ENOBUFS; - goto out; - } - - net_ipv6_addr_copy_raw((uint8_t *)&info.ipi6_addr, ipv6_hdr->dst); - info.ipi6_ifindex = ctx->iface; - - ret = insert_pktinfo(msg, IPPROTO_IPV6, IPV6_RECVPKTINFO, - &info, sizeof(info)); + (void)k_mutex_lock(lock, K_FOREVER); - goto out; - } + ret = zvfs_fdtable_call_ioctl((const struct fd_op_vtable *)vtable, + obj, cmd, flags); -out: - net_pkt_cursor_restore(pkt, &backup); + k_mutex_unlock(lock); + SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, fcntl, sock, + ret < 0 ? -errno : ret); return ret; } -static int update_msg_controllen(struct msghdr *msg) +#ifdef CONFIG_USERSPACE +static inline int z_vrfy_zsock_fcntl_impl(int sock, int cmd, int flags) { - struct cmsghdr *cmsg; - size_t cmsg_space = 0; - - for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) { - if (cmsg->cmsg_len == 0) { - break; - } - cmsg_space += cmsg->cmsg_len; - } - msg->msg_controllen = cmsg_space; - - return 0; + return z_impl_zsock_fcntl_impl(sock, cmd, flags); } +#include +#endif -static inline ssize_t zsock_recv_dgram(struct net_context *ctx, - struct msghdr *msg, - void *buf, - size_t max_len, - int flags, - struct sockaddr *src_addr, - socklen_t *addrlen) +int z_impl_zsock_ioctl_impl(int sock, unsigned long request, va_list args) { - k_timeout_t timeout = K_FOREVER; - size_t recv_len = 0; - size_t read_len; - struct net_pkt_cursor backup; - struct net_pkt *pkt; - - if ((flags & ZSOCK_MSG_DONTWAIT) || sock_is_nonblock(ctx)) { - timeout = K_NO_WAIT; - } else { - int ret; + const struct socket_op_vtable *vtable; + struct k_mutex *lock; + void *ctx; + int ret; - net_context_get_option(ctx, NET_OPT_RCVTIMEO, &timeout, NULL); + SYS_PORT_TRACING_OBJ_FUNC_ENTER(socket, ioctl, sock, request); - ret = zsock_wait_data(ctx, &timeout); - if (ret < 0) { - errno = -ret; - return -1; - } + ctx = get_sock_vtable(sock, &vtable, &lock); + if (ctx == NULL) { + errno = EBADF; + SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, ioctl, sock, -errno); + return -1; } - if (flags & ZSOCK_MSG_PEEK) { - int res; + (void)k_mutex_lock(lock, K_FOREVER); - res = fifo_wait_non_empty(&ctx->recv_q, timeout); - /* EAGAIN when timeout expired, EINTR when cancelled */ - if (res && res != -EAGAIN && res != -EINTR) { - errno = -res; - return -1; - } + NET_DBG("ioctl: ctx=%p, fd=%d, request=%lu", ctx, sock, request); - pkt = k_fifo_peek_head(&ctx->recv_q); - } else { - pkt = k_fifo_get(&ctx->recv_q, timeout); - } - - if (!pkt) { - errno = EAGAIN; - return -1; - } - - net_pkt_cursor_backup(pkt, &backup); - - if (src_addr && addrlen) { - if (IS_ENABLED(CONFIG_NET_OFFLOAD) && - net_if_is_ip_offloaded(net_context_get_iface(ctx))) { - int ret; - - ret = sock_get_offload_pkt_src_addr(pkt, ctx, src_addr, - *addrlen); - if (ret < 0) { - errno = -ret; - NET_DBG("sock_get_offload_pkt_src_addr %d", ret); - goto fail; - } - } else { - int ret; - - ret = sock_get_pkt_src_addr(pkt, net_context_get_proto(ctx), - src_addr, *addrlen); - if (ret < 0) { - errno = -ret; - NET_DBG("sock_get_pkt_src_addr %d", ret); - goto fail; - } - } - - /* addrlen is a value-result argument, set to actual - * size of source address - */ - if (src_addr->sa_family == AF_INET) { - *addrlen = sizeof(struct sockaddr_in); - } else if (src_addr->sa_family == AF_INET6) { - *addrlen = sizeof(struct sockaddr_in6); - } else { - errno = ENOTSUP; - goto fail; - } - } - - if (msg != NULL) { - int iovec = 0; - size_t tmp_read_len; - - if (msg->msg_iovlen < 1 || msg->msg_iov == NULL) { - errno = ENOMEM; - return -1; - } - - recv_len = net_pkt_remaining_data(pkt); - tmp_read_len = read_len = MIN(recv_len, max_len); - - while (tmp_read_len > 0) { - size_t len; - - buf = msg->msg_iov[iovec].iov_base; - if (buf == NULL) { - errno = EINVAL; - return -1; - } - - len = MIN(tmp_read_len, msg->msg_iov[iovec].iov_len); - - if (net_pkt_read(pkt, buf, len)) { - errno = ENOBUFS; - goto fail; - } - - if (len <= tmp_read_len) { - tmp_read_len -= len; - msg->msg_iov[iovec].iov_len = len; - iovec++; - } else { - errno = EINVAL; - return -1; - } - } - - msg->msg_iovlen = iovec; - - if (recv_len != read_len) { - msg->msg_flags |= ZSOCK_MSG_TRUNC; - } - - } else { - recv_len = net_pkt_remaining_data(pkt); - read_len = MIN(recv_len, max_len); - - if (net_pkt_read(pkt, buf, read_len)) { - errno = ENOBUFS; - goto fail; - } - } - - if (msg != NULL) { - if (msg->msg_control != NULL) { - if (msg->msg_controllen > 0) { - if (IS_ENABLED(CONFIG_NET_CONTEXT_TIMESTAMPING) && - net_context_is_timestamping_set(ctx)) { - if (add_timestamping(ctx, pkt, msg) < 0) { - msg->msg_flags |= ZSOCK_MSG_CTRUNC; - } - } - - if (IS_ENABLED(CONFIG_NET_CONTEXT_RECV_PKTINFO) && - net_context_is_recv_pktinfo_set(ctx)) { - if (add_pktinfo(ctx, pkt, msg) < 0) { - msg->msg_flags |= ZSOCK_MSG_CTRUNC; - } - } - - /* msg_controllen must be updated to reflect the total length of all - * control messages in the buffer. If there are no control data, - * msg_controllen will be cleared as expected It will also take into - * account pre-existing control data - */ - update_msg_controllen(msg); - } - } else { - msg->msg_controllen = 0U; - } - } - - if ((IS_ENABLED(CONFIG_NET_PKT_RXTIME_STATS) || - IS_ENABLED(CONFIG_TRACING_NET_CORE)) && - !(flags & ZSOCK_MSG_PEEK)) { - net_socket_update_tc_rx_time(pkt, k_cycle_get_32()); - } - - if (!(flags & ZSOCK_MSG_PEEK)) { - net_pkt_unref(pkt); - } else { - net_pkt_cursor_restore(pkt, &backup); - } - - return (flags & ZSOCK_MSG_TRUNC) ? recv_len : read_len; - -fail: - if (!(flags & ZSOCK_MSG_PEEK)) { - net_pkt_unref(pkt); - } - - return -1; -} - -static size_t zsock_recv_stream_immediate(struct net_context *ctx, uint8_t **buf, size_t *max_len, - int flags) -{ - size_t len; - size_t pkt_len; - size_t recv_len = 0; - struct net_pkt *pkt; - struct net_pkt_cursor backup; - struct net_pkt *origin = NULL; - const bool do_recv = !(buf == NULL || max_len == NULL); - size_t _max_len = (max_len == NULL) ? SIZE_MAX : *max_len; - const bool peek = (flags & ZSOCK_MSG_PEEK) == ZSOCK_MSG_PEEK; - - while (_max_len > 0) { - /* only peek until we know we can dequeue and / or requeue buffer */ - pkt = k_fifo_peek_head(&ctx->recv_q); - if (pkt == NULL || pkt == origin) { - break; - } - - if (origin == NULL) { - /* mark first pkt to avoid cycles when observing */ - origin = pkt; - } - - pkt_len = net_pkt_remaining_data(pkt); - len = MIN(_max_len, pkt_len); - recv_len += len; - _max_len -= len; - - if (do_recv && len > 0) { - if (peek) { - net_pkt_cursor_backup(pkt, &backup); - } - - net_pkt_read(pkt, *buf, len); - /* update buffer position for caller */ - *buf += len; - - if (peek) { - net_pkt_cursor_restore(pkt, &backup); - } - } - - if (do_recv && !peek) { - if (len == pkt_len) { - /* dequeue empty packets when not observing */ - pkt = k_fifo_get(&ctx->recv_q, K_NO_WAIT); - if (net_pkt_eof(pkt)) { - sock_set_eof(ctx); - } - - if (IS_ENABLED(CONFIG_NET_PKT_RXTIME_STATS) || - IS_ENABLED(CONFIG_TRACING_NET_CORE)) { - net_socket_update_tc_rx_time(pkt, k_cycle_get_32()); - } - - net_pkt_unref(pkt); - } - } else if (!do_recv || peek) { - /* requeue packets when observing */ - k_fifo_put(&ctx->recv_q, k_fifo_get(&ctx->recv_q, K_NO_WAIT)); - } - } - - if (do_recv) { - /* convey remaining buffer size back to caller */ - *max_len = _max_len; - } - - return recv_len; -} - -static int zsock_fionread_ctx(struct net_context *ctx) -{ - size_t ret = zsock_recv_stream_immediate(ctx, NULL, NULL, 0); - - return MIN(ret, INT_MAX); -} - -static ssize_t zsock_recv_stream_timed(struct net_context *ctx, struct msghdr *msg, - uint8_t *buf, size_t max_len, - int flags, k_timeout_t timeout) -{ - int res; - k_timepoint_t end; - size_t recv_len = 0, iovec = 0, available_len, max_iovlen = 0; - const bool waitall = (flags & ZSOCK_MSG_WAITALL) == ZSOCK_MSG_WAITALL; - - if (msg != NULL && buf == NULL) { - if (msg->msg_iovlen < 1) { - return -EINVAL; - } - - buf = msg->msg_iov[iovec].iov_base; - available_len = msg->msg_iov[iovec].iov_len; - msg->msg_iov[iovec].iov_len = 0; - max_iovlen = msg->msg_iovlen; - } - - for (end = sys_timepoint_calc(timeout); max_len > 0; timeout = sys_timepoint_timeout(end)) { - - if (sock_is_error(ctx)) { - return -POINTER_TO_INT(ctx->user_data); - } - - if (sock_is_eof(ctx)) { - return 0; - } - - if (!K_TIMEOUT_EQ(timeout, K_NO_WAIT)) { - res = zsock_wait_data(ctx, &timeout); - if (res < 0) { - return res; - } - } - - if (msg != NULL) { -again: - res = zsock_recv_stream_immediate(ctx, &buf, &available_len, flags); - recv_len += res; - - if (res == 0 && recv_len == 0 && K_TIMEOUT_EQ(timeout, K_NO_WAIT)) { - return -EAGAIN; - } - - msg->msg_iov[iovec].iov_len += res; - buf = (uint8_t *)(msg->msg_iov[iovec].iov_base) + res; - max_len -= res; - - if (available_len == 0) { - /* All data to this iovec was written */ - iovec++; - - if (iovec == max_iovlen) { - break; - } - - msg->msg_iovlen = iovec; - buf = msg->msg_iov[iovec].iov_base; - available_len = msg->msg_iov[iovec].iov_len; - msg->msg_iov[iovec].iov_len = 0; - - /* If there is more data, read it now and do not wait */ - if (buf != NULL && available_len > 0) { - goto again; - } - - continue; - } - - } else { - res = zsock_recv_stream_immediate(ctx, &buf, &max_len, flags); - recv_len += res; - - if (res == 0) { - if (recv_len == 0 && K_TIMEOUT_EQ(timeout, K_NO_WAIT)) { - return -EAGAIN; - } - } - } - - if (!waitall) { - break; - } - } - - return recv_len; -} - -static ssize_t zsock_recv_stream(struct net_context *ctx, struct msghdr *msg, - void *buf, size_t max_len, int flags) -{ - ssize_t res; - size_t recv_len = 0; - k_timeout_t timeout = K_FOREVER; - - if (!net_context_is_used(ctx)) { - errno = EBADF; - return -1; - } - - if (net_context_get_state(ctx) != NET_CONTEXT_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - if ((flags & ZSOCK_MSG_DONTWAIT) || sock_is_nonblock(ctx)) { - timeout = K_NO_WAIT; - } else if (!sock_is_eof(ctx) && !sock_is_error(ctx)) { - net_context_get_option(ctx, NET_OPT_RCVTIMEO, &timeout, NULL); - } - - if (max_len == 0) { - /* no bytes requested - done! */ - return 0; - } - - res = zsock_recv_stream_timed(ctx, msg, buf, max_len, flags, timeout); - recv_len += MAX(0, res); - - if (res < 0) { - errno = -res; - return -1; - } - - if (!(flags & ZSOCK_MSG_PEEK)) { - net_context_update_recv_wnd(ctx, recv_len); - } - - return recv_len; -} - -ssize_t zsock_recvfrom_ctx(struct net_context *ctx, void *buf, size_t max_len, - int flags, - struct sockaddr *src_addr, socklen_t *addrlen) -{ - enum net_sock_type sock_type = net_context_get_type(ctx); - - if (max_len == 0) { - return 0; - } - - if (sock_type == SOCK_DGRAM) { - return zsock_recv_dgram(ctx, NULL, buf, max_len, flags, src_addr, addrlen); - } else if (sock_type == SOCK_STREAM) { - return zsock_recv_stream(ctx, NULL, buf, max_len, flags); - } - - __ASSERT(0, "Unknown socket type"); - - errno = ENOTSUP; - - return -1; -} - -ssize_t z_impl_zsock_recvfrom(int sock, void *buf, size_t max_len, int flags, - struct sockaddr *src_addr, socklen_t *addrlen) -{ - int bytes_received; - - SYS_PORT_TRACING_OBJ_FUNC_ENTER(socket, recvfrom, sock, max_len, flags, src_addr, addrlen); - - bytes_received = VTABLE_CALL(recvfrom, sock, buf, max_len, flags, src_addr, addrlen); - - SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, recvfrom, sock, - src_addr, addrlen, - bytes_received < 0 ? -errno : bytes_received); - - sock_obj_core_update_recv_stats(sock, bytes_received); - - return bytes_received; -} - -#ifdef CONFIG_USERSPACE -ssize_t z_vrfy_zsock_recvfrom(int sock, void *buf, size_t max_len, int flags, - struct sockaddr *src_addr, socklen_t *addrlen) -{ - socklen_t addrlen_copy; - ssize_t ret; - - if (K_SYSCALL_MEMORY_WRITE(buf, max_len)) { - errno = EFAULT; - return -1; - } - - if (addrlen) { - K_OOPS(k_usermode_from_copy(&addrlen_copy, addrlen, - sizeof(socklen_t))); - } - K_OOPS(src_addr && K_SYSCALL_MEMORY_WRITE(src_addr, addrlen_copy)); - - ret = z_impl_zsock_recvfrom(sock, (void *)buf, max_len, flags, - (struct sockaddr *)src_addr, - addrlen ? &addrlen_copy : NULL); - - if (addrlen) { - K_OOPS(k_usermode_to_copy(addrlen, &addrlen_copy, - sizeof(socklen_t))); - } - - return ret; -} -#include -#endif /* CONFIG_USERSPACE */ - -ssize_t zsock_recvmsg_ctx(struct net_context *ctx, struct msghdr *msg, - int flags) -{ - enum net_sock_type sock_type = net_context_get_type(ctx); - size_t i, max_len = 0; - - if (msg == NULL) { - errno = EINVAL; - return -1; - } - - if (msg->msg_iov == NULL) { - errno = ENOMEM; - return -1; - } - - for (i = 0; i < msg->msg_iovlen; i++) { - max_len += msg->msg_iov[i].iov_len; - } - - if (sock_type == SOCK_DGRAM) { - return zsock_recv_dgram(ctx, msg, NULL, max_len, flags, - msg->msg_name, &msg->msg_namelen); - } else if (sock_type == SOCK_STREAM) { - return zsock_recv_stream(ctx, msg, NULL, max_len, flags); - } - - __ASSERT(0, "Unknown socket type"); - - errno = ENOTSUP; - - return -1; -} - -ssize_t z_impl_zsock_recvmsg(int sock, struct msghdr *msg, int flags) -{ - int bytes_received; - - SYS_PORT_TRACING_OBJ_FUNC_ENTER(socket, recvmsg, sock, msg, flags); - - bytes_received = VTABLE_CALL(recvmsg, sock, msg, flags); - - SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, recvmsg, sock, msg, - bytes_received < 0 ? -errno : bytes_received); - - sock_obj_core_update_recv_stats(sock, bytes_received); - - return bytes_received; -} - -#ifdef CONFIG_USERSPACE -ssize_t z_vrfy_zsock_recvmsg(int sock, struct msghdr *msg, int flags) -{ - struct msghdr msg_copy; - size_t iovlen; - size_t i; - int ret; - - if (msg == NULL) { - errno = EINVAL; - return -1; - } - - if (msg->msg_iov == NULL) { - errno = ENOMEM; - return -1; - } - - K_OOPS(k_usermode_from_copy(&msg_copy, (void *)msg, sizeof(msg_copy))); - - k_usermode_from_copy(&iovlen, &msg->msg_iovlen, sizeof(iovlen)); - - msg_copy.msg_name = NULL; - msg_copy.msg_control = NULL; - - msg_copy.msg_iov = k_usermode_alloc_from_copy(msg->msg_iov, - msg->msg_iovlen * sizeof(struct iovec)); - if (!msg_copy.msg_iov) { - errno = ENOMEM; - goto fail; - } - - /* Clear the pointers in the copy so that if the allocation in the - * next loop fails, we do not try to free non allocated memory - * in fail branch. - */ - memset(msg_copy.msg_iov, 0, msg->msg_iovlen * sizeof(struct iovec)); - - for (i = 0; i < iovlen; i++) { - /* TODO: In practice we do not need to copy the actual data - * in msghdr when receiving data but currently there is no - * ready made function to do just that (unless we want to call - * relevant malloc function here ourselves). So just use - * the copying variant for now. - */ - msg_copy.msg_iov[i].iov_base = - k_usermode_alloc_from_copy(msg->msg_iov[i].iov_base, - msg->msg_iov[i].iov_len); - if (!msg_copy.msg_iov[i].iov_base) { - errno = ENOMEM; - goto fail; - } - - msg_copy.msg_iov[i].iov_len = msg->msg_iov[i].iov_len; - } - - if (msg->msg_namelen > 0) { - if (msg->msg_name == NULL) { - errno = EINVAL; - goto fail; - } - - msg_copy.msg_name = k_usermode_alloc_from_copy(msg->msg_name, - msg->msg_namelen); - if (msg_copy.msg_name == NULL) { - errno = ENOMEM; - goto fail; - } - } - - if (msg->msg_controllen > 0) { - if (msg->msg_control == NULL) { - errno = EINVAL; - goto fail; - } - - msg_copy.msg_control = - k_usermode_alloc_from_copy(msg->msg_control, - msg->msg_controllen); - if (msg_copy.msg_control == NULL) { - errno = ENOMEM; - goto fail; - } - } - - ret = z_impl_zsock_recvmsg(sock, &msg_copy, flags); - - /* Do not copy anything back if there was an error or nothing was - * received. - */ - if (ret > 0) { - if (msg->msg_namelen > 0 && msg->msg_name != NULL) { - K_OOPS(k_usermode_to_copy(msg->msg_name, - msg_copy.msg_name, - msg_copy.msg_namelen)); - } - - if (msg->msg_controllen > 0 && - msg->msg_control != NULL) { - K_OOPS(k_usermode_to_copy(msg->msg_control, - msg_copy.msg_control, - msg_copy.msg_controllen)); - - msg->msg_controllen = msg_copy.msg_controllen; - } else { - msg->msg_controllen = 0U; - } - - k_usermode_to_copy(&msg->msg_iovlen, - &msg_copy.msg_iovlen, - sizeof(msg->msg_iovlen)); - - /* The new iovlen cannot be bigger than the original one */ - NET_ASSERT(msg_copy.msg_iovlen <= iovlen); - - for (i = 0; i < iovlen; i++) { - if (i < msg_copy.msg_iovlen) { - K_OOPS(k_usermode_to_copy(msg->msg_iov[i].iov_base, - msg_copy.msg_iov[i].iov_base, - msg_copy.msg_iov[i].iov_len)); - K_OOPS(k_usermode_to_copy(&msg->msg_iov[i].iov_len, - &msg_copy.msg_iov[i].iov_len, - sizeof(msg->msg_iov[i].iov_len))); - } else { - /* Clear out those vectors that we could not populate */ - msg->msg_iov[i].iov_len = 0; - } - } - - k_usermode_to_copy(&msg->msg_flags, - &msg_copy.msg_flags, - sizeof(msg->msg_flags)); - } - - k_free(msg_copy.msg_name); - k_free(msg_copy.msg_control); - - /* Note that we need to free according to original iovlen */ - for (i = 0; i < iovlen; i++) { - k_free(msg_copy.msg_iov[i].iov_base); - } - - k_free(msg_copy.msg_iov); - - return ret; - -fail: - if (msg_copy.msg_name) { - k_free(msg_copy.msg_name); - } - - if (msg_copy.msg_control) { - k_free(msg_copy.msg_control); - } - - if (msg_copy.msg_iov) { - for (i = 0; i < msg_copy.msg_iovlen; i++) { - if (msg_copy.msg_iov[i].iov_base) { - k_free(msg_copy.msg_iov[i].iov_base); - } - } - - k_free(msg_copy.msg_iov); - } - - return -1; -} -#include -#endif /* CONFIG_USERSPACE */ - -/* As this is limited function, we don't follow POSIX signature, with - * "..." instead of last arg. - */ -int z_impl_zsock_fcntl_impl(int sock, int cmd, int flags) -{ - const struct socket_op_vtable *vtable; - struct k_mutex *lock; - void *obj; - int ret; - - SYS_PORT_TRACING_OBJ_FUNC_ENTER(socket, fcntl, sock, cmd, flags); - - obj = get_sock_vtable(sock, &vtable, &lock); - if (obj == NULL) { - errno = EBADF; - SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, fcntl, sock, -errno); - return -1; - } - - (void)k_mutex_lock(lock, K_FOREVER); - - ret = zvfs_fdtable_call_ioctl((const struct fd_op_vtable *)vtable, - obj, cmd, flags); - - k_mutex_unlock(lock); - - SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, fcntl, sock, - ret < 0 ? -errno : ret); - return ret; -} - -#ifdef CONFIG_USERSPACE -static inline int z_vrfy_zsock_fcntl_impl(int sock, int cmd, int flags) -{ - return z_impl_zsock_fcntl_impl(sock, cmd, flags); -} -#include -#endif - -int z_impl_zsock_ioctl_impl(int sock, unsigned long request, va_list args) -{ - const struct socket_op_vtable *vtable; - struct k_mutex *lock; - void *ctx; - int ret; - - SYS_PORT_TRACING_OBJ_FUNC_ENTER(socket, ioctl, sock, request); - - ctx = get_sock_vtable(sock, &vtable, &lock); - if (ctx == NULL) { - errno = EBADF; - SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, ioctl, sock, -errno); - return -1; - } - - (void)k_mutex_lock(lock, K_FOREVER); - - NET_DBG("ioctl: ctx=%p, fd=%d, request=%lu", ctx, sock, request); - - ret = vtable->fd_vtable.ioctl(ctx, request, args); - - k_mutex_unlock(lock); - - SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, ioctl, sock, - ret < 0 ? -errno : ret); - return ret; - -} - -#ifdef CONFIG_USERSPACE -static inline int z_vrfy_zsock_ioctl_impl(int sock, unsigned long request, va_list args) -{ - switch (request) { - case ZFD_IOCTL_FIONBIO: - break; - - case ZFD_IOCTL_FIONREAD: { - int *avail; - - avail = va_arg(args, int *); - K_OOPS(K_SYSCALL_MEMORY_WRITE(avail, sizeof(*avail))); - - break; - } - - default: - errno = EOPNOTSUPP; - return -1; - } - - return z_impl_zsock_ioctl_impl(sock, request, args); -} -#include -#endif - -static int zsock_poll_prepare_ctx(struct net_context *ctx, - struct zsock_pollfd *pfd, - struct k_poll_event **pev, - struct k_poll_event *pev_end) -{ - if (pfd->events & ZSOCK_POLLIN) { - if (*pev == pev_end) { - return -ENOMEM; - } - - (*pev)->obj = &ctx->recv_q; - (*pev)->type = K_POLL_TYPE_FIFO_DATA_AVAILABLE; - (*pev)->mode = K_POLL_MODE_NOTIFY_ONLY; - (*pev)->state = K_POLL_STATE_NOT_READY; - (*pev)++; - } - - if (pfd->events & ZSOCK_POLLOUT) { - if (IS_ENABLED(CONFIG_NET_NATIVE_TCP) && - net_context_get_type(ctx) == SOCK_STREAM && - !net_if_is_ip_offloaded(net_context_get_iface(ctx))) { - if (*pev == pev_end) { - return -ENOMEM; - } - - if (net_context_get_state(ctx) == NET_CONTEXT_CONNECTING) { - (*pev)->obj = net_tcp_conn_sem_get(ctx); - } else { - (*pev)->obj = net_tcp_tx_sem_get(ctx); - } - - (*pev)->type = K_POLL_TYPE_SEM_AVAILABLE; - (*pev)->mode = K_POLL_MODE_NOTIFY_ONLY; - (*pev)->state = K_POLL_STATE_NOT_READY; - (*pev)++; - } else { - return -EALREADY; - } - - } - - /* If socket is already in EOF or error, it can be reported - * immediately, so we tell poll() to short-circuit wait. - */ - if (sock_is_eof(ctx) || sock_is_error(ctx)) { - return -EALREADY; - } - - return 0; -} - -static int zsock_poll_update_ctx(struct net_context *ctx, - struct zsock_pollfd *pfd, - struct k_poll_event **pev) -{ - ARG_UNUSED(ctx); - - if (pfd->events & ZSOCK_POLLIN) { - if ((*pev)->state != K_POLL_STATE_NOT_READY || sock_is_eof(ctx)) { - pfd->revents |= ZSOCK_POLLIN; - } - (*pev)++; - } - if (pfd->events & ZSOCK_POLLOUT) { - if (IS_ENABLED(CONFIG_NET_NATIVE_TCP) && - net_context_get_type(ctx) == SOCK_STREAM && - !net_if_is_ip_offloaded(net_context_get_iface(ctx))) { - if ((*pev)->state != K_POLL_STATE_NOT_READY && - !sock_is_eof(ctx) && - (net_context_get_state(ctx) == NET_CONTEXT_CONNECTED)) { - pfd->revents |= ZSOCK_POLLOUT; - } - (*pev)++; - } else { - pfd->revents |= ZSOCK_POLLOUT; - } - } - - if (sock_is_error(ctx)) { - pfd->revents |= ZSOCK_POLLERR; - } - - if (sock_is_eof(ctx)) { - pfd->revents |= ZSOCK_POLLHUP; - } - - return 0; -} - -static inline int time_left(uint32_t start, uint32_t timeout) -{ - uint32_t elapsed = k_uptime_get_32() - start; - - return timeout - elapsed; -} - -int zsock_poll_internal(struct zsock_pollfd *fds, int nfds, k_timeout_t timeout) -{ - bool retry; - int ret = 0; - int i; - struct zsock_pollfd *pfd; - struct k_poll_event poll_events[CONFIG_NET_SOCKETS_POLL_MAX]; - struct k_poll_event *pev; - struct k_poll_event *pev_end = poll_events + ARRAY_SIZE(poll_events); - const struct fd_op_vtable *vtable; - struct k_mutex *lock; - k_timepoint_t end; - bool offload = false; - const struct fd_op_vtable *offl_vtable = NULL; - void *offl_ctx = NULL; - - end = sys_timepoint_calc(timeout); - - pev = poll_events; - for (pfd = fds, i = nfds; i--; pfd++) { - void *ctx; - int result; - - /* Per POSIX, negative fd's are just ignored */ - if (pfd->fd < 0) { - continue; - } - - ctx = get_sock_vtable(pfd->fd, - (const struct socket_op_vtable **)&vtable, - &lock); - if (ctx == NULL) { - /* Will set POLLNVAL in return loop */ - continue; - } - - (void)k_mutex_lock(lock, K_FOREVER); - - result = zvfs_fdtable_call_ioctl(vtable, ctx, - ZFD_IOCTL_POLL_PREPARE, - pfd, &pev, pev_end); - if (result == -EALREADY) { - /* If POLL_PREPARE returned with EALREADY, it means - * it already detected that some socket is ready. In - * this case, we still perform a k_poll to pick up - * as many events as possible, but without any wait. - */ - timeout = K_NO_WAIT; - end = sys_timepoint_calc(timeout); - result = 0; - } else if (result == -EXDEV) { - /* If POLL_PREPARE returned EXDEV, it means - * it detected an offloaded socket. - * If offloaded socket is used with native TLS, the TLS - * wrapper for the offloaded poll will be used. - * In case the fds array contains a mixup of offloaded - * and non-offloaded sockets, the offloaded poll handler - * shall return an error. - */ - offload = true; - if (offl_vtable == NULL || net_socket_is_tls(ctx)) { - offl_vtable = vtable; - offl_ctx = ctx; - } - - result = 0; - } - - k_mutex_unlock(lock); - - if (result < 0) { - errno = -result; - return -1; - } - } - - if (offload) { - int poll_timeout; - - if (K_TIMEOUT_EQ(timeout, K_FOREVER)) { - poll_timeout = SYS_FOREVER_MS; - } else { - poll_timeout = k_ticks_to_ms_floor32(timeout.ticks); - } - - return zvfs_fdtable_call_ioctl(offl_vtable, offl_ctx, - ZFD_IOCTL_POLL_OFFLOAD, - fds, nfds, poll_timeout); - } - - timeout = sys_timepoint_timeout(end); - - do { - ret = k_poll(poll_events, pev - poll_events, timeout); - /* EAGAIN when timeout expired, EINTR when cancelled (i.e. EOF) */ - if (ret != 0 && ret != -EAGAIN && ret != -EINTR) { - errno = -ret; - return -1; - } - - retry = false; - ret = 0; - - pev = poll_events; - for (pfd = fds, i = nfds; i--; pfd++) { - void *ctx; - int result; - - pfd->revents = 0; - - if (pfd->fd < 0) { - continue; - } - - ctx = get_sock_vtable( - pfd->fd, - (const struct socket_op_vtable **)&vtable, - &lock); - if (ctx == NULL) { - pfd->revents = ZSOCK_POLLNVAL; - ret++; - continue; - } - - (void)k_mutex_lock(lock, K_FOREVER); - - result = zvfs_fdtable_call_ioctl(vtable, ctx, - ZFD_IOCTL_POLL_UPDATE, - pfd, &pev); - k_mutex_unlock(lock); - - if (result == -EAGAIN) { - retry = true; - continue; - } else if (result != 0) { - errno = -result; - return -1; - } - - if (pfd->revents != 0) { - ret++; - } - } - - if (retry) { - if (ret > 0) { - break; - } - - timeout = sys_timepoint_timeout(end); - - if (K_TIMEOUT_EQ(timeout, K_NO_WAIT)) { - break; - } - } - } while (retry); - - return ret; -} - -int z_impl_zsock_poll(struct zsock_pollfd *fds, int nfds, int poll_timeout) -{ - k_timeout_t timeout; - int ret; - - SYS_PORT_TRACING_OBJ_FUNC_ENTER(socket, poll, fds, nfds, poll_timeout); - - if (poll_timeout < 0) { - timeout = K_FOREVER; - } else { - timeout = K_MSEC(poll_timeout); - } - - ret = zsock_poll_internal(fds, nfds, timeout); - - SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, poll, fds, nfds, - ret < 0 ? -errno : ret); - return ret; -} - -#ifdef CONFIG_USERSPACE -static inline int z_vrfy_zsock_poll(struct zsock_pollfd *fds, - int nfds, int timeout) -{ - struct zsock_pollfd *fds_copy; - size_t fds_size; - int ret; - - /* Copy fds array from user mode */ - if (size_mul_overflow(nfds, sizeof(struct zsock_pollfd), &fds_size)) { - errno = EFAULT; - return -1; - } - fds_copy = k_usermode_alloc_from_copy((void *)fds, fds_size); - if (!fds_copy) { - errno = ENOMEM; - return -1; - } - - ret = z_impl_zsock_poll(fds_copy, nfds, timeout); - - if (ret >= 0) { - k_usermode_to_copy((void *)fds, fds_copy, fds_size); - } - k_free(fds_copy); - - return ret; -} -#include -#endif - -int z_impl_zsock_inet_pton(sa_family_t family, const char *src, void *dst) -{ - if (net_addr_pton(family, src, dst) == 0) { - return 1; - } else { - return 0; - } -} - -#ifdef CONFIG_USERSPACE -static inline int z_vrfy_zsock_inet_pton(sa_family_t family, - const char *src, void *dst) -{ - int dst_size; - char src_copy[NET_IPV6_ADDR_LEN]; - char dst_copy[sizeof(struct in6_addr)]; - int ret; - - switch (family) { - case AF_INET: - dst_size = sizeof(struct in_addr); - break; - case AF_INET6: - dst_size = sizeof(struct in6_addr); - break; - default: - errno = EAFNOSUPPORT; - return -1; - } - - K_OOPS(k_usermode_string_copy(src_copy, (char *)src, sizeof(src_copy))); - ret = z_impl_zsock_inet_pton(family, src_copy, dst_copy); - K_OOPS(k_usermode_to_copy(dst, dst_copy, dst_size)); - - return ret; -} -#include -#endif - -static enum tcp_conn_option get_tcp_option(int optname) -{ - switch (optname) { - case TCP_KEEPIDLE: - return TCP_OPT_KEEPIDLE; - case TCP_KEEPINTVL: - return TCP_OPT_KEEPINTVL; - case TCP_KEEPCNT: - return TCP_OPT_KEEPCNT; - } - - return -EINVAL; -} - -int zsock_getsockopt_ctx(struct net_context *ctx, int level, int optname, - void *optval, socklen_t *optlen) -{ - int ret; - - switch (level) { - case SOL_SOCKET: - switch (optname) { - case SO_ERROR: { - if (*optlen != sizeof(int)) { - errno = EINVAL; - return -1; - } - - *(int *)optval = POINTER_TO_INT(ctx->user_data); - - return 0; - } - - case SO_TYPE: { - int type = (int)net_context_get_type(ctx); - - if (*optlen != sizeof(type)) { - errno = EINVAL; - return -1; - } - - *(int *)optval = type; - - return 0; - } - - case SO_TXTIME: - if (IS_ENABLED(CONFIG_NET_CONTEXT_TXTIME)) { - ret = net_context_get_option(ctx, - NET_OPT_TXTIME, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } - break; - - case SO_PROTOCOL: { - int proto = (int)net_context_get_proto(ctx); - - if (*optlen != sizeof(proto)) { - errno = EINVAL; - return -1; - } - - *(int *)optval = proto; - - return 0; - } - - case SO_DOMAIN: { - if (*optlen != sizeof(int)) { - errno = EINVAL; - return -1; - } - - *(int *)optval = net_context_get_family(ctx); - - return 0; - } - - break; - - case SO_RCVBUF: - if (IS_ENABLED(CONFIG_NET_CONTEXT_RCVBUF)) { - ret = net_context_get_option(ctx, - NET_OPT_RCVBUF, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } - break; - - case SO_SNDBUF: - if (IS_ENABLED(CONFIG_NET_CONTEXT_SNDBUF)) { - ret = net_context_get_option(ctx, - NET_OPT_SNDBUF, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } - break; - - case SO_REUSEADDR: - if (IS_ENABLED(CONFIG_NET_CONTEXT_REUSEADDR)) { - ret = net_context_get_option(ctx, - NET_OPT_REUSEADDR, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } - break; - - case SO_REUSEPORT: - if (IS_ENABLED(CONFIG_NET_CONTEXT_REUSEPORT)) { - ret = net_context_get_option(ctx, - NET_OPT_REUSEPORT, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } - break; - - case SO_KEEPALIVE: - if (IS_ENABLED(CONFIG_NET_TCP_KEEPALIVE) && - net_context_get_proto(ctx) == IPPROTO_TCP) { - ret = net_tcp_get_option(ctx, - TCP_OPT_KEEPALIVE, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } - - break; - - case SO_TIMESTAMPING: - if (IS_ENABLED(CONFIG_NET_CONTEXT_TIMESTAMPING)) { - ret = net_context_get_option(ctx, - NET_OPT_TIMESTAMPING, - optval, optlen); - - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } - - break; - } - - break; - - case IPPROTO_TCP: - switch (optname) { - case TCP_NODELAY: - ret = net_tcp_get_option(ctx, TCP_OPT_NODELAY, optval, optlen); - return ret; - - case TCP_KEEPIDLE: - __fallthrough; - case TCP_KEEPINTVL: - __fallthrough; - case TCP_KEEPCNT: - if (IS_ENABLED(CONFIG_NET_TCP_KEEPALIVE)) { - ret = net_tcp_get_option(ctx, - get_tcp_option(optname), - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } - - break; - } - - break; - - case IPPROTO_IP: - switch (optname) { - case IP_TOS: - if (IS_ENABLED(CONFIG_NET_CONTEXT_DSCP_ECN)) { - ret = net_context_get_option(ctx, - NET_OPT_DSCP_ECN, - optval, - optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } - - break; - - case IP_TTL: - ret = net_context_get_option(ctx, NET_OPT_TTL, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - - case IP_MULTICAST_TTL: - ret = net_context_get_option(ctx, NET_OPT_MCAST_TTL, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } - - break; - - case IPPROTO_IPV6: - switch (optname) { - case IPV6_V6ONLY: - if (IS_ENABLED(CONFIG_NET_IPV4_MAPPING_TO_IPV6)) { - ret = net_context_get_option(ctx, - NET_OPT_IPV6_V6ONLY, - optval, - optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } - - break; - - case IPV6_ADDR_PREFERENCES: - if (IS_ENABLED(CONFIG_NET_IPV6)) { - ret = net_context_get_option(ctx, - NET_OPT_ADDR_PREFERENCES, - optval, - optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } - - break; - - case IPV6_TCLASS: - if (IS_ENABLED(CONFIG_NET_CONTEXT_DSCP_ECN)) { - ret = net_context_get_option(ctx, - NET_OPT_DSCP_ECN, - optval, - optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } - - break; - - case IPV6_UNICAST_HOPS: - ret = net_context_get_option(ctx, - NET_OPT_UNICAST_HOP_LIMIT, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - - case IPV6_MULTICAST_HOPS: - ret = net_context_get_option(ctx, - NET_OPT_MCAST_HOP_LIMIT, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } - - break; - } - - errno = ENOPROTOOPT; - return -1; -} - -int z_impl_zsock_getsockopt(int sock, int level, int optname, - void *optval, socklen_t *optlen) -{ - int ret; - - SYS_PORT_TRACING_OBJ_FUNC_ENTER(socket, getsockopt, sock, level, optname); - - ret = VTABLE_CALL(getsockopt, sock, level, optname, optval, optlen); - - SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, getsockopt, sock, level, optname, - optval, *optlen, ret < 0 ? -errno : ret); - return ret; -} - -#ifdef CONFIG_USERSPACE -int z_vrfy_zsock_getsockopt(int sock, int level, int optname, - void *optval, socklen_t *optlen) -{ - socklen_t kernel_optlen = *(socklen_t *)optlen; - void *kernel_optval; - int ret; - - if (K_SYSCALL_MEMORY_WRITE(optval, kernel_optlen)) { - errno = -EPERM; - return -1; - } - - kernel_optval = k_usermode_alloc_from_copy((const void *)optval, - kernel_optlen); - K_OOPS(!kernel_optval); - - ret = z_impl_zsock_getsockopt(sock, level, optname, - kernel_optval, &kernel_optlen); - - K_OOPS(k_usermode_to_copy((void *)optval, kernel_optval, kernel_optlen)); - K_OOPS(k_usermode_to_copy((void *)optlen, &kernel_optlen, - sizeof(socklen_t))); + ret = vtable->fd_vtable.ioctl(ctx, request, args); - k_free(kernel_optval); + k_mutex_unlock(lock); + SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, ioctl, sock, + ret < 0 ? -errno : ret); return ret; + } -#include -#endif /* CONFIG_USERSPACE */ -static int ipv4_multicast_group(struct net_context *ctx, const void *optval, - socklen_t optlen, bool do_join) +#ifdef CONFIG_USERSPACE +static inline int z_vrfy_zsock_ioctl_impl(int sock, unsigned long request, va_list args) { - struct ip_mreqn *mreqn; - struct net_if *iface; - int ifindex, ret; - - if (optval == NULL || optlen != sizeof(struct ip_mreqn)) { - errno = EINVAL; - return -1; - } - - mreqn = (struct ip_mreqn *)optval; - - if (mreqn->imr_multiaddr.s_addr == INADDR_ANY) { - errno = EINVAL; - return -1; - } - - if (mreqn->imr_ifindex != 0) { - iface = net_if_get_by_index(mreqn->imr_ifindex); - } else { - ifindex = net_if_ipv4_addr_lookup_by_index(&mreqn->imr_address); - iface = net_if_get_by_index(ifindex); - } + switch (request) { + case ZFD_IOCTL_FIONBIO: + break; - if (iface == NULL) { - /* Check if ctx has already an interface and if not, - * then select the default interface. - */ - if (ctx->iface <= 0) { - iface = net_if_get_default(); - } else { - iface = net_if_get_by_index(ctx->iface); - } + case ZFD_IOCTL_FIONREAD: { + int *avail; - if (iface == NULL) { - errno = EINVAL; - return -1; - } - } + avail = va_arg(args, int *); + K_OOPS(K_SYSCALL_MEMORY_WRITE(avail, sizeof(*avail))); - if (do_join) { - ret = net_ipv4_igmp_join(iface, &mreqn->imr_multiaddr, NULL); - } else { - ret = net_ipv4_igmp_leave(iface, &mreqn->imr_multiaddr); + break; } - if (ret < 0) { - errno = -ret; + default: + errno = EOPNOTSUPP; return -1; } - return 0; + return z_impl_zsock_ioctl_impl(sock, request, args); } +#include +#endif -static int ipv6_multicast_group(struct net_context *ctx, const void *optval, - socklen_t optlen, bool do_join) +int zsock_poll_internal(struct zsock_pollfd *fds, int nfds, k_timeout_t timeout) { - struct ipv6_mreq *mreq; - struct net_if *iface; - int ret; - - if (optval == NULL || optlen != sizeof(struct ipv6_mreq)) { - errno = EINVAL; - return -1; - } + bool retry; + int ret = 0; + int i; + struct zsock_pollfd *pfd; + struct k_poll_event poll_events[CONFIG_NET_SOCKETS_POLL_MAX]; + struct k_poll_event *pev; + struct k_poll_event *pev_end = poll_events + ARRAY_SIZE(poll_events); + const struct fd_op_vtable *vtable; + struct k_mutex *lock; + k_timepoint_t end; + bool offload = false; + const struct fd_op_vtable *offl_vtable = NULL; + void *offl_ctx = NULL; - mreq = (struct ipv6_mreq *)optval; + end = sys_timepoint_calc(timeout); - if (memcmp(&mreq->ipv6mr_multiaddr, - net_ipv6_unspecified_address(), - sizeof(mreq->ipv6mr_multiaddr)) == 0) { - errno = EINVAL; - return -1; - } + pev = poll_events; + for (pfd = fds, i = nfds; i--; pfd++) { + void *ctx; + int result; - iface = net_if_get_by_index(mreq->ipv6mr_ifindex); - if (iface == NULL) { - /* Check if ctx has already an interface and if not, - * then select the default interface. - */ - if (ctx->iface <= 0) { - iface = net_if_get_default(); - } else { - iface = net_if_get_by_index(ctx->iface); + /* Per POSIX, negative fd's are just ignored */ + if (pfd->fd < 0) { + continue; } - if (iface == NULL) { - errno = ENOENT; - return -1; + ctx = get_sock_vtable(pfd->fd, + (const struct socket_op_vtable **)&vtable, + &lock); + if (ctx == NULL) { + /* Will set POLLNVAL in return loop */ + continue; } - } - - if (do_join) { - ret = net_ipv6_mld_join(iface, &mreq->ipv6mr_multiaddr); - } else { - ret = net_ipv6_mld_leave(iface, &mreq->ipv6mr_multiaddr); - } - - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; -} - -int zsock_setsockopt_ctx(struct net_context *ctx, int level, int optname, - const void *optval, socklen_t optlen) -{ - int ret; - - switch (level) { - case SOL_SOCKET: - switch (optname) { - case SO_RCVBUF: - if (IS_ENABLED(CONFIG_NET_CONTEXT_RCVBUF)) { - ret = net_context_set_option(ctx, - NET_OPT_RCVBUF, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } - - break; - - case SO_SNDBUF: - if (IS_ENABLED(CONFIG_NET_CONTEXT_SNDBUF)) { - ret = net_context_set_option(ctx, - NET_OPT_SNDBUF, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - return 0; - } - - break; - - case SO_REUSEADDR: - if (IS_ENABLED(CONFIG_NET_CONTEXT_REUSEADDR)) { - ret = net_context_set_option(ctx, - NET_OPT_REUSEADDR, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } - - break; - - case SO_REUSEPORT: - if (IS_ENABLED(CONFIG_NET_CONTEXT_REUSEPORT)) { - ret = net_context_set_option(ctx, - NET_OPT_REUSEPORT, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } + (void)k_mutex_lock(lock, K_FOREVER); - return 0; + result = zvfs_fdtable_call_ioctl(vtable, ctx, + ZFD_IOCTL_POLL_PREPARE, + pfd, &pev, pev_end); + if (result == -EALREADY) { + /* If POLL_PREPARE returned with EALREADY, it means + * it already detected that some socket is ready. In + * this case, we still perform a k_poll to pick up + * as many events as possible, but without any wait. + */ + timeout = K_NO_WAIT; + end = sys_timepoint_calc(timeout); + result = 0; + } else if (result == -EXDEV) { + /* If POLL_PREPARE returned EXDEV, it means + * it detected an offloaded socket. + * If offloaded socket is used with native TLS, the TLS + * wrapper for the offloaded poll will be used. + * In case the fds array contains a mixup of offloaded + * and non-offloaded sockets, the offloaded poll handler + * shall return an error. + */ + offload = true; + if (offl_vtable == NULL || net_socket_is_tls(ctx)) { + offl_vtable = vtable; + offl_ctx = ctx; } - break; - - case SO_PRIORITY: - if (IS_ENABLED(CONFIG_NET_CONTEXT_PRIORITY)) { - ret = net_context_set_option(ctx, - NET_OPT_PRIORITY, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } + result = 0; + } - break; + k_mutex_unlock(lock); - case SO_RCVTIMEO: - if (IS_ENABLED(CONFIG_NET_CONTEXT_RCVTIMEO)) { - const struct zsock_timeval *tv = optval; - k_timeout_t timeout; + if (result < 0) { + errno = -result; + return -1; + } + } - if (optlen != sizeof(struct zsock_timeval)) { - errno = EINVAL; - return -1; - } + if (offload) { + int poll_timeout; - if (tv->tv_sec == 0 && tv->tv_usec == 0) { - timeout = K_FOREVER; - } else { - timeout = K_USEC(tv->tv_sec * 1000000ULL - + tv->tv_usec); - } + if (K_TIMEOUT_EQ(timeout, K_FOREVER)) { + poll_timeout = SYS_FOREVER_MS; + } else { + poll_timeout = k_ticks_to_ms_floor32(timeout.ticks); + } - ret = net_context_set_option(ctx, - NET_OPT_RCVTIMEO, - &timeout, - sizeof(timeout)); + return zvfs_fdtable_call_ioctl(offl_vtable, offl_ctx, + ZFD_IOCTL_POLL_OFFLOAD, + fds, nfds, poll_timeout); + } - if (ret < 0) { - errno = -ret; - return -1; - } + timeout = sys_timepoint_timeout(end); - return 0; - } + do { + ret = k_poll(poll_events, pev - poll_events, timeout); + /* EAGAIN when timeout expired, EINTR when cancelled (i.e. EOF) */ + if (ret != 0 && ret != -EAGAIN && ret != -EINTR) { + errno = -ret; + return -1; + } - break; - - case SO_SNDTIMEO: - if (IS_ENABLED(CONFIG_NET_CONTEXT_SNDTIMEO)) { - const struct zsock_timeval *tv = optval; - k_timeout_t timeout; - - if (optlen != sizeof(struct zsock_timeval)) { - errno = EINVAL; - return -1; - } - - if (tv->tv_sec == 0 && tv->tv_usec == 0) { - timeout = K_FOREVER; - } else { - timeout = K_USEC(tv->tv_sec * 1000000ULL - + tv->tv_usec); - } - - ret = net_context_set_option(ctx, - NET_OPT_SNDTIMEO, - &timeout, - sizeof(timeout)); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } + retry = false; + ret = 0; - break; + pev = poll_events; + for (pfd = fds, i = nfds; i--; pfd++) { + void *ctx; + int result; - case SO_TXTIME: - if (IS_ENABLED(CONFIG_NET_CONTEXT_TXTIME)) { - ret = net_context_set_option(ctx, - NET_OPT_TXTIME, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } + pfd->revents = 0; - return 0; + if (pfd->fd < 0) { + continue; } - break; - - case SO_SOCKS5: - if (IS_ENABLED(CONFIG_SOCKS)) { - ret = net_context_set_option(ctx, - NET_OPT_SOCKS5, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - net_context_set_proxy_enabled(ctx, true); - - return 0; + ctx = get_sock_vtable( + pfd->fd, + (const struct socket_op_vtable **)&vtable, + &lock); + if (ctx == NULL) { + pfd->revents = ZSOCK_POLLNVAL; + ret++; + continue; } - break; - - case SO_BINDTODEVICE: { - struct net_if *iface; - const struct ifreq *ifreq = optval; - - if (net_context_get_family(ctx) != AF_INET && - net_context_get_family(ctx) != AF_INET6) { - errno = EAFNOSUPPORT; - return -1; - } + (void)k_mutex_lock(lock, K_FOREVER); - /* optlen equal to 0 or empty interface name should - * remove the binding. - */ - if ((optlen == 0) || (ifreq != NULL && - strlen(ifreq->ifr_name) == 0)) { - ctx->flags &= ~NET_CONTEXT_BOUND_TO_IFACE; - return 0; - } + result = zvfs_fdtable_call_ioctl(vtable, ctx, + ZFD_IOCTL_POLL_UPDATE, + pfd, &pev); + k_mutex_unlock(lock); - if ((ifreq == NULL) || (optlen != sizeof(*ifreq))) { - errno = EINVAL; + if (result == -EAGAIN) { + retry = true; + continue; + } else if (result != 0) { + errno = -result; return -1; } - if (IS_ENABLED(CONFIG_NET_INTERFACE_NAME)) { - ret = net_if_get_by_name(ifreq->ifr_name); - if (ret < 0) { - errno = -ret; - return -1; - } - - iface = net_if_get_by_index(ret); - if (iface == NULL) { - errno = ENODEV; - return -1; - } - } else { - const struct device *dev; - - dev = device_get_binding(ifreq->ifr_name); - if (dev == NULL) { - errno = ENODEV; - return -1; - } - - iface = net_if_lookup_by_dev(dev); - if (iface == NULL) { - errno = ENODEV; - return -1; - } + if (pfd->revents != 0) { + ret++; } - - net_context_bind_iface(ctx, iface); - - return 0; } - case SO_LINGER: - /* ignored. for compatibility purposes only */ - return 0; - - case SO_KEEPALIVE: - if (IS_ENABLED(CONFIG_NET_TCP_KEEPALIVE) && - net_context_get_proto(ctx) == IPPROTO_TCP) { - ret = net_tcp_set_option(ctx, - TCP_OPT_KEEPALIVE, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } - - break; - - case SO_TIMESTAMPING: - if (IS_ENABLED(CONFIG_NET_CONTEXT_TIMESTAMPING)) { - ret = net_context_set_option(ctx, - NET_OPT_TIMESTAMPING, - optval, optlen); - - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; + if (retry) { + if (ret > 0) { + break; } - break; - } - - break; + timeout = sys_timepoint_timeout(end); - case IPPROTO_TCP: - switch (optname) { - case TCP_NODELAY: - ret = net_tcp_set_option(ctx, - TCP_OPT_NODELAY, optval, optlen); - return ret; - - case TCP_KEEPIDLE: - __fallthrough; - case TCP_KEEPINTVL: - __fallthrough; - case TCP_KEEPCNT: - if (IS_ENABLED(CONFIG_NET_TCP_KEEPALIVE)) { - ret = net_tcp_set_option(ctx, - get_tcp_option(optname), - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; + if (K_TIMEOUT_EQ(timeout, K_NO_WAIT)) { + break; } - - break; } - break; - - case IPPROTO_IP: - switch (optname) { - case IP_TOS: - if (IS_ENABLED(CONFIG_NET_CONTEXT_DSCP_ECN)) { - ret = net_context_set_option(ctx, - NET_OPT_DSCP_ECN, - optval, - optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } - - break; - - case IP_PKTINFO: - if (IS_ENABLED(CONFIG_NET_IPV4) && - IS_ENABLED(CONFIG_NET_CONTEXT_RECV_PKTINFO)) { - ret = net_context_set_option(ctx, - NET_OPT_RECV_PKTINFO, - optval, - optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } - - break; - - case IP_MULTICAST_TTL: - ret = net_context_set_option(ctx, NET_OPT_MCAST_TTL, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } + } while (retry); - return 0; + return ret; +} - case IP_TTL: - ret = net_context_set_option(ctx, NET_OPT_TTL, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } +int z_impl_zsock_poll(struct zsock_pollfd *fds, int nfds, int poll_timeout) +{ + k_timeout_t timeout; + int ret; - return 0; + SYS_PORT_TRACING_OBJ_FUNC_ENTER(socket, poll, fds, nfds, poll_timeout); - case IP_ADD_MEMBERSHIP: - if (IS_ENABLED(CONFIG_NET_IPV4)) { - return ipv4_multicast_group(ctx, optval, - optlen, true); - } + if (poll_timeout < 0) { + timeout = K_FOREVER; + } else { + timeout = K_MSEC(poll_timeout); + } - break; + ret = zsock_poll_internal(fds, nfds, timeout); - case IP_DROP_MEMBERSHIP: - if (IS_ENABLED(CONFIG_NET_IPV4)) { - return ipv4_multicast_group(ctx, optval, - optlen, false); - } + SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, poll, fds, nfds, + ret < 0 ? -errno : ret); + return ret; +} - break; - } +#ifdef CONFIG_USERSPACE +static inline int z_vrfy_zsock_poll(struct zsock_pollfd *fds, + int nfds, int timeout) +{ + struct zsock_pollfd *fds_copy; + size_t fds_size; + int ret; - break; + /* Copy fds array from user mode */ + if (size_mul_overflow(nfds, sizeof(struct zsock_pollfd), &fds_size)) { + errno = EFAULT; + return -1; + } + fds_copy = k_usermode_alloc_from_copy((void *)fds, fds_size); + if (!fds_copy) { + errno = ENOMEM; + return -1; + } - case IPPROTO_IPV6: - switch (optname) { - case IPV6_V6ONLY: - if (IS_ENABLED(CONFIG_NET_IPV4_MAPPING_TO_IPV6)) { - ret = net_context_set_option(ctx, - NET_OPT_IPV6_V6ONLY, - optval, - optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - } + ret = z_impl_zsock_poll(fds_copy, nfds, timeout); - return 0; - - case IPV6_RECVPKTINFO: - if (IS_ENABLED(CONFIG_NET_IPV6) && - IS_ENABLED(CONFIG_NET_CONTEXT_RECV_PKTINFO)) { - ret = net_context_set_option(ctx, - NET_OPT_RECV_PKTINFO, - optval, - optlen); - if (ret < 0) { - errno = -ret; - return -1; - } - - return 0; - } + if (ret >= 0) { + k_usermode_to_copy((void *)fds, fds_copy, fds_size); + } + k_free(fds_copy); - break; + return ret; +} +#include +#endif - case IPV6_ADDR_PREFERENCES: - if (IS_ENABLED(CONFIG_NET_IPV6)) { - ret = net_context_set_option(ctx, - NET_OPT_ADDR_PREFERENCES, - optval, - optlen); - if (ret < 0) { - errno = -ret; - return -1; - } +int z_impl_zsock_inet_pton(sa_family_t family, const char *src, void *dst) +{ + if (net_addr_pton(family, src, dst) == 0) { + return 1; + } else { + return 0; + } +} - return 0; - } +#ifdef CONFIG_USERSPACE +static inline int z_vrfy_zsock_inet_pton(sa_family_t family, + const char *src, void *dst) +{ + int dst_size; + char src_copy[NET_IPV6_ADDR_LEN]; + char dst_copy[sizeof(struct in6_addr)]; + int ret; - break; + switch (family) { + case AF_INET: + dst_size = sizeof(struct in_addr); + break; + case AF_INET6: + dst_size = sizeof(struct in6_addr); + break; + default: + errno = EAFNOSUPPORT; + return -1; + } - case IPV6_TCLASS: - if (IS_ENABLED(CONFIG_NET_CONTEXT_DSCP_ECN)) { - ret = net_context_set_option(ctx, - NET_OPT_DSCP_ECN, - optval, - optlen); - if (ret < 0) { - errno = -ret; - return -1; - } + K_OOPS(k_usermode_string_copy(src_copy, (char *)src, sizeof(src_copy))); + ret = z_impl_zsock_inet_pton(family, src_copy, dst_copy); + K_OOPS(k_usermode_to_copy(dst, dst_copy, dst_size)); - return 0; - } + return ret; +} +#include +#endif - break; +int z_impl_zsock_getsockopt(int sock, int level, int optname, + void *optval, socklen_t *optlen) +{ + int ret; - case IPV6_UNICAST_HOPS: - ret = net_context_set_option(ctx, - NET_OPT_UNICAST_HOP_LIMIT, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } + SYS_PORT_TRACING_OBJ_FUNC_ENTER(socket, getsockopt, sock, level, optname); - return 0; + ret = VTABLE_CALL(getsockopt, sock, level, optname, optval, optlen); - case IPV6_MULTICAST_HOPS: - ret = net_context_set_option(ctx, - NET_OPT_MCAST_HOP_LIMIT, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } + SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, getsockopt, sock, level, optname, + optval, *optlen, ret < 0 ? -errno : ret); + return ret; +} - return 0; +#ifdef CONFIG_USERSPACE +int z_vrfy_zsock_getsockopt(int sock, int level, int optname, + void *optval, socklen_t *optlen) +{ + socklen_t kernel_optlen = *(socklen_t *)optlen; + void *kernel_optval; + int ret; - case IPV6_ADD_MEMBERSHIP: - if (IS_ENABLED(CONFIG_NET_IPV6)) { - return ipv6_multicast_group(ctx, optval, - optlen, true); - } + if (K_SYSCALL_MEMORY_WRITE(optval, kernel_optlen)) { + errno = -EPERM; + return -1; + } - break; + kernel_optval = k_usermode_alloc_from_copy((const void *)optval, + kernel_optlen); + K_OOPS(!kernel_optval); - case IPV6_DROP_MEMBERSHIP: - if (IS_ENABLED(CONFIG_NET_IPV6)) { - return ipv6_multicast_group(ctx, optval, - optlen, false); - } + ret = z_impl_zsock_getsockopt(sock, level, optname, + kernel_optval, &kernel_optlen); - break; - } + K_OOPS(k_usermode_to_copy((void *)optval, kernel_optval, kernel_optlen)); + K_OOPS(k_usermode_to_copy((void *)optlen, &kernel_optlen, + sizeof(socklen_t))); - break; - } + k_free(kernel_optval); - errno = ENOPROTOOPT; - return -1; + return ret; } +#include +#endif /* CONFIG_USERSPACE */ int z_impl_zsock_setsockopt(int sock, int level, int optname, const void *optval, socklen_t optlen) @@ -3584,54 +1138,6 @@ int z_vrfy_zsock_setsockopt(int sock, int level, int optname, #include #endif /* CONFIG_USERSPACE */ -int zsock_getpeername_ctx(struct net_context *ctx, struct sockaddr *addr, - socklen_t *addrlen) -{ - socklen_t newlen = 0; - - if (addr == NULL || addrlen == NULL) { - SET_ERRNO(-EINVAL); - } - - if (!(ctx->flags & NET_CONTEXT_REMOTE_ADDR_SET)) { - SET_ERRNO(-ENOTCONN); - } - - if (net_context_get_type(ctx) == SOCK_STREAM && - net_context_get_state(ctx) != NET_CONTEXT_CONNECTED) { - SET_ERRNO(-ENOTCONN); - } - - if (IS_ENABLED(CONFIG_NET_IPV4) && ctx->remote.sa_family == AF_INET) { - struct sockaddr_in addr4 = { 0 }; - - addr4.sin_family = AF_INET; - addr4.sin_port = net_sin(&ctx->remote)->sin_port; - memcpy(&addr4.sin_addr, &net_sin(&ctx->remote)->sin_addr, - sizeof(struct in_addr)); - newlen = sizeof(struct sockaddr_in); - - memcpy(addr, &addr4, MIN(*addrlen, newlen)); - } else if (IS_ENABLED(CONFIG_NET_IPV6) && - ctx->remote.sa_family == AF_INET6) { - struct sockaddr_in6 addr6 = { 0 }; - - addr6.sin6_family = AF_INET6; - addr6.sin6_port = net_sin6(&ctx->remote)->sin6_port; - memcpy(&addr6.sin6_addr, &net_sin6(&ctx->remote)->sin6_addr, - sizeof(struct in6_addr)); - newlen = sizeof(struct sockaddr_in6); - - memcpy(addr, &addr6, MIN(*addrlen, newlen)); - } else { - SET_ERRNO(-EINVAL); - } - - *addrlen = newlen; - - return 0; -} - int z_impl_zsock_getpeername(int sock, struct sockaddr *addr, socklen_t *addrlen) { @@ -3677,56 +1183,6 @@ static inline int z_vrfy_zsock_getpeername(int sock, struct sockaddr *addr, #include #endif /* CONFIG_USERSPACE */ -int zsock_getsockname_ctx(struct net_context *ctx, struct sockaddr *addr, - socklen_t *addrlen) -{ - socklen_t newlen = 0; - int ret; - - if (IS_ENABLED(CONFIG_NET_IPV4) && ctx->local.family == AF_INET) { - struct sockaddr_in addr4 = { 0 }; - - if (net_sin_ptr(&ctx->local)->sin_addr == NULL) { - SET_ERRNO(-EINVAL); - } - - newlen = sizeof(struct sockaddr_in); - - ret = net_context_get_local_addr(ctx, - (struct sockaddr *)&addr4, - &newlen); - if (ret < 0) { - SET_ERRNO(-ret); - } - - memcpy(addr, &addr4, MIN(*addrlen, newlen)); - - } else if (IS_ENABLED(CONFIG_NET_IPV6) && ctx->local.family == AF_INET6) { - struct sockaddr_in6 addr6 = { 0 }; - - if (net_sin6_ptr(&ctx->local)->sin6_addr == NULL) { - SET_ERRNO(-EINVAL); - } - - newlen = sizeof(struct sockaddr_in6); - - ret = net_context_get_local_addr(ctx, - (struct sockaddr *)&addr6, - &newlen); - if (ret < 0) { - SET_ERRNO(-ret); - } - - memcpy(addr, &addr6, MIN(*addrlen, newlen)); - } else { - SET_ERRNO(-EINVAL); - } - - *addrlen = newlen; - - return 0; -} - int z_impl_zsock_getsockname(int sock, struct sockaddr *addr, socklen_t *addrlen) { @@ -3771,210 +1227,3 @@ static inline int z_vrfy_zsock_getsockname(int sock, struct sockaddr *addr, } #include #endif /* CONFIG_USERSPACE */ - -static ssize_t sock_read_vmeth(void *obj, void *buffer, size_t count) -{ - return zsock_recvfrom_ctx(obj, buffer, count, 0, NULL, 0); -} - -static ssize_t sock_write_vmeth(void *obj, const void *buffer, size_t count) -{ - return zsock_sendto_ctx(obj, buffer, count, 0, NULL, 0); -} - -static void zsock_ctx_set_lock(struct net_context *ctx, struct k_mutex *lock) -{ - ctx->cond.lock = lock; -} - -static int sock_ioctl_vmeth(void *obj, unsigned int request, va_list args) -{ - switch (request) { - - /* In Zephyr, fcntl() is just an alias of ioctl(). */ - case F_GETFL: - if (sock_is_nonblock(obj)) { - return O_NONBLOCK; - } - - return 0; - - case F_SETFL: { - int flags; - - flags = va_arg(args, int); - - if (flags & O_NONBLOCK) { - sock_set_flag(obj, SOCK_NONBLOCK, SOCK_NONBLOCK); - } else { - sock_set_flag(obj, SOCK_NONBLOCK, 0); - } - - return 0; - } - - case ZFD_IOCTL_POLL_PREPARE: { - struct zsock_pollfd *pfd; - struct k_poll_event **pev; - struct k_poll_event *pev_end; - - pfd = va_arg(args, struct zsock_pollfd *); - pev = va_arg(args, struct k_poll_event **); - pev_end = va_arg(args, struct k_poll_event *); - - return zsock_poll_prepare_ctx(obj, pfd, pev, pev_end); - } - - case ZFD_IOCTL_POLL_UPDATE: { - struct zsock_pollfd *pfd; - struct k_poll_event **pev; - - pfd = va_arg(args, struct zsock_pollfd *); - pev = va_arg(args, struct k_poll_event **); - - return zsock_poll_update_ctx(obj, pfd, pev); - } - - case ZFD_IOCTL_SET_LOCK: { - struct k_mutex *lock; - - lock = va_arg(args, struct k_mutex *); - - zsock_ctx_set_lock(obj, lock); - return 0; - } - - case ZFD_IOCTL_FIONBIO: - sock_set_flag(obj, SOCK_NONBLOCK, SOCK_NONBLOCK); - return 0; - - case ZFD_IOCTL_FIONREAD: { - int *avail = va_arg(args, int *); - - *avail = zsock_fionread_ctx(obj); - return 0; - } - - default: - errno = EOPNOTSUPP; - return -1; - } -} - -static int sock_shutdown_vmeth(void *obj, int how) -{ - return zsock_shutdown_ctx(obj, how); -} - -static int sock_bind_vmeth(void *obj, const struct sockaddr *addr, - socklen_t addrlen) -{ - return zsock_bind_ctx(obj, addr, addrlen); -} - -static int sock_connect_vmeth(void *obj, const struct sockaddr *addr, - socklen_t addrlen) -{ - return zsock_connect_ctx(obj, addr, addrlen); -} - -static int sock_listen_vmeth(void *obj, int backlog) -{ - return zsock_listen_ctx(obj, backlog); -} - -static int sock_accept_vmeth(void *obj, struct sockaddr *addr, - socklen_t *addrlen) -{ - return zsock_accept_ctx(obj, addr, addrlen); -} - -static ssize_t sock_sendto_vmeth(void *obj, const void *buf, size_t len, - int flags, const struct sockaddr *dest_addr, - socklen_t addrlen) -{ - return zsock_sendto_ctx(obj, buf, len, flags, dest_addr, addrlen); -} - -static ssize_t sock_sendmsg_vmeth(void *obj, const struct msghdr *msg, - int flags) -{ - return zsock_sendmsg_ctx(obj, msg, flags); -} - -static ssize_t sock_recvmsg_vmeth(void *obj, struct msghdr *msg, int flags) -{ - return zsock_recvmsg_ctx(obj, msg, flags); -} - -static ssize_t sock_recvfrom_vmeth(void *obj, void *buf, size_t max_len, - int flags, struct sockaddr *src_addr, - socklen_t *addrlen) -{ - return zsock_recvfrom_ctx(obj, buf, max_len, flags, - src_addr, addrlen); -} - -static int sock_getsockopt_vmeth(void *obj, int level, int optname, - void *optval, socklen_t *optlen) -{ - return zsock_getsockopt_ctx(obj, level, optname, optval, optlen); -} - -static int sock_setsockopt_vmeth(void *obj, int level, int optname, - const void *optval, socklen_t optlen) -{ - return zsock_setsockopt_ctx(obj, level, optname, optval, optlen); -} - -static int sock_close_vmeth(void *obj) -{ - return zsock_close_ctx(obj); -} -static int sock_getpeername_vmeth(void *obj, struct sockaddr *addr, - socklen_t *addrlen) -{ - return zsock_getpeername_ctx(obj, addr, addrlen); -} - -static int sock_getsockname_vmeth(void *obj, struct sockaddr *addr, - socklen_t *addrlen) -{ - return zsock_getsockname_ctx(obj, addr, addrlen); -} - -const struct socket_op_vtable sock_fd_op_vtable = { - .fd_vtable = { - .read = sock_read_vmeth, - .write = sock_write_vmeth, - .close = sock_close_vmeth, - .ioctl = sock_ioctl_vmeth, - }, - .shutdown = sock_shutdown_vmeth, - .bind = sock_bind_vmeth, - .connect = sock_connect_vmeth, - .listen = sock_listen_vmeth, - .accept = sock_accept_vmeth, - .sendto = sock_sendto_vmeth, - .sendmsg = sock_sendmsg_vmeth, - .recvmsg = sock_recvmsg_vmeth, - .recvfrom = sock_recvfrom_vmeth, - .getsockopt = sock_getsockopt_vmeth, - .setsockopt = sock_setsockopt_vmeth, - .getpeername = sock_getpeername_vmeth, - .getsockname = sock_getsockname_vmeth, -}; - -#if defined(CONFIG_NET_NATIVE) -static bool inet_is_supported(int family, int type, int proto) -{ - if (family != AF_INET && family != AF_INET6) { - return false; - } - - return true; -} - -NET_SOCKET_REGISTER(af_inet46, NET_SOCKET_DEFAULT_PRIO, AF_UNSPEC, - inet_is_supported, zsock_socket_internal); -#endif /* CONFIG_NET_NATIVE */ diff --git a/subsys/net/lib/sockets/sockets_inet.c b/subsys/net/lib/sockets/sockets_inet.c new file mode 100644 index 0000000000000..9403cdd152a44 --- /dev/null +++ b/subsys/net/lib/sockets/sockets_inet.c @@ -0,0 +1,2758 @@ +/* + * Copyright (c) 2017 Linaro Limited + * Copyright (c) 2021 Nordic Semiconductor + * Copyright (c) 2023 Arm Limited (or its affiliates). All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* Zephyr headers */ +#include +LOG_MODULE_DECLARE(net_sock, CONFIG_NET_SOCKETS_LOG_LEVEL); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(CONFIG_SOCKS) +#include "socks.h" +#endif + +#include +#include "../../ip/ipv6.h" + +#include "../../ip/net_stats.h" + +#include "sockets_internal.h" +#include "../../ip/tcp_internal.h" +#include "../../ip/net_private.h" + +#define SET_ERRNO(x) \ + { int _err = x; if (_err < 0) { errno = -_err; return -1; } } + +const struct socket_op_vtable sock_fd_op_vtable; + +static void zsock_received_cb(struct net_context *ctx, + struct net_pkt *pkt, + union net_ip_header *ip_hdr, + union net_proto_header *proto_hdr, + int status, + void *user_data); + +static int fifo_wait_non_empty(struct k_fifo *fifo, k_timeout_t timeout) +{ + struct k_poll_event events[] = { + K_POLL_EVENT_INITIALIZER(K_POLL_TYPE_FIFO_DATA_AVAILABLE, + K_POLL_MODE_NOTIFY_ONLY, fifo), + }; + + return k_poll(events, ARRAY_SIZE(events), timeout); +} + +static void zsock_flush_queue(struct net_context *ctx) +{ + bool is_listen = net_context_get_state(ctx) == NET_CONTEXT_LISTENING; + void *p; + + /* recv_q and accept_q are shared via a union */ + while ((p = k_fifo_get(&ctx->recv_q, K_NO_WAIT)) != NULL) { + if (is_listen) { + NET_DBG("discarding ctx %p", p); + net_context_put(p); + } else { + NET_DBG("discarding pkt %p", p); + net_pkt_unref(p); + } + } + + /* Some threads might be waiting on recv, cancel the wait */ + k_fifo_cancel_wait(&ctx->recv_q); + + /* Wake reader if it was sleeping */ + (void)k_condvar_signal(&ctx->cond.recv); +} + +static int zsock_socket_internal(int family, int type, int proto) +{ + int fd = zvfs_reserve_fd(); + struct net_context *ctx; + int res; + + if (fd < 0) { + return -1; + } + + if (proto == 0) { + if (family == AF_INET || family == AF_INET6) { + if (type == SOCK_DGRAM) { + proto = IPPROTO_UDP; + } else if (type == SOCK_STREAM) { + proto = IPPROTO_TCP; + } + } + } + + res = net_context_get(family, type, proto, &ctx); + if (res < 0) { + zvfs_free_fd(fd); + errno = -res; + return -1; + } + + /* Initialize user_data, all other calls will preserve it */ + ctx->user_data = NULL; + + /* The socket flags are stored here */ + ctx->socket_data = NULL; + + /* recv_q and accept_q are in union */ + k_fifo_init(&ctx->recv_q); + + /* Condition variable is used to avoid keeping lock for a long time + * when waiting data to be received + */ + k_condvar_init(&ctx->cond.recv); + + /* TCP context is effectively owned by both application + * and the stack: stack may detect that peer closed/aborted + * connection, but it must not dispose of the context behind + * the application back. Likewise, when application "closes" + * context, it's not disposed of immediately - there's yet + * closing handshake for stack to perform. + */ + if (proto == IPPROTO_TCP) { + net_context_ref(ctx); + } + + zvfs_finalize_typed_fd(fd, ctx, (const struct fd_op_vtable *)&sock_fd_op_vtable, + ZVFS_MODE_IFSOCK); + + NET_DBG("socket: ctx=%p, fd=%d", ctx, fd); + + return fd; +} + +int zsock_close_ctx(struct net_context *ctx) +{ + /* Reset callbacks to avoid any race conditions while + * flushing queues. No need to check return values here, + * as these are fail-free operations and we're closing + * socket anyway. + */ + if (net_context_get_state(ctx) == NET_CONTEXT_LISTENING) { + (void)net_context_accept(ctx, NULL, K_NO_WAIT, NULL); + } else { + (void)net_context_recv(ctx, NULL, K_NO_WAIT, NULL); + } + + ctx->user_data = INT_TO_POINTER(EINTR); + sock_set_error(ctx); + + zsock_flush_queue(ctx); + + SET_ERRNO(net_context_put(ctx)); + + return 0; +} + +static void zsock_accepted_cb(struct net_context *new_ctx, + struct sockaddr *addr, socklen_t addrlen, + int status, void *user_data) +{ + struct net_context *parent = user_data; + + NET_DBG("parent=%p, ctx=%p, st=%d", parent, new_ctx, status); + + if (status == 0) { + /* This just installs a callback, so cannot fail. */ + (void)net_context_recv(new_ctx, zsock_received_cb, K_NO_WAIT, + NULL); + k_fifo_init(&new_ctx->recv_q); + k_condvar_init(&new_ctx->cond.recv); + + k_fifo_put(&parent->accept_q, new_ctx); + + /* TCP context is effectively owned by both application + * and the stack: stack may detect that peer closed/aborted + * connection, but it must not dispose of the context behind + * the application back. Likewise, when application "closes" + * context, it's not disposed of immediately - there's yet + * closing handshake for stack to perform. + */ + net_context_ref(new_ctx); + + (void)k_condvar_signal(&parent->cond.recv); + } + +} + +static void zsock_received_cb(struct net_context *ctx, + struct net_pkt *pkt, + union net_ip_header *ip_hdr, + union net_proto_header *proto_hdr, + int status, + void *user_data) +{ + if (ctx->cond.lock) { + (void)k_mutex_lock(ctx->cond.lock, K_FOREVER); + } + + NET_DBG("ctx=%p, pkt=%p, st=%d, user_data=%p", ctx, pkt, status, + user_data); + + if (status < 0) { + ctx->user_data = INT_TO_POINTER(-status); + sock_set_error(ctx); + } + + /* if pkt is NULL, EOF */ + if (!pkt) { + struct net_pkt *last_pkt = k_fifo_peek_tail(&ctx->recv_q); + + if (!last_pkt) { + /* If there're no packets in the queue, recv() may + * be blocked waiting on it to become non-empty, + * so cancel that wait. + */ + sock_set_eof(ctx); + k_fifo_cancel_wait(&ctx->recv_q); + NET_DBG("Marked socket %p as peer-closed", ctx); + } else { + net_pkt_set_eof(last_pkt, true); + NET_DBG("Set EOF flag on pkt %p", last_pkt); + } + + goto unlock; + } + + /* Normal packet */ + net_pkt_set_eof(pkt, false); + + net_pkt_set_rx_stats_tick(pkt, k_cycle_get_32()); + + k_fifo_put(&ctx->recv_q, pkt); + +unlock: + /* Wake reader if it was sleeping */ + (void)k_condvar_signal(&ctx->cond.recv); + + if (ctx->cond.lock) { + (void)k_mutex_unlock(ctx->cond.lock); + } +} + +int zsock_shutdown_ctx(struct net_context *ctx, int how) +{ + if (how == ZSOCK_SHUT_RD) { + if (net_context_get_state(ctx) == NET_CONTEXT_LISTENING) { + SET_ERRNO(net_context_accept(ctx, NULL, K_NO_WAIT, NULL)); + } else { + SET_ERRNO(net_context_recv(ctx, NULL, K_NO_WAIT, NULL)); + } + + sock_set_eof(ctx); + + zsock_flush_queue(ctx); + } else if (how == ZSOCK_SHUT_WR || how == ZSOCK_SHUT_RDWR) { + SET_ERRNO(-ENOTSUP); + } else { + SET_ERRNO(-EINVAL); + } + + return 0; +} + +int zsock_bind_ctx(struct net_context *ctx, const struct sockaddr *addr, + socklen_t addrlen) +{ + SET_ERRNO(net_context_bind(ctx, addr, addrlen)); + /* For DGRAM socket, we expect to receive packets after call to + * bind(), but for STREAM socket, next expected operation is + * listen(), which doesn't work if recv callback is set. + */ + if (net_context_get_type(ctx) == SOCK_DGRAM) { + SET_ERRNO(net_context_recv(ctx, zsock_received_cb, K_NO_WAIT, + ctx->user_data)); + } + + return 0; +} + +static void zsock_connected_cb(struct net_context *ctx, int status, void *user_data) +{ + if (status < 0) { + ctx->user_data = INT_TO_POINTER(-status); + sock_set_error(ctx); + } +} + +int zsock_connect_ctx(struct net_context *ctx, const struct sockaddr *addr, + socklen_t addrlen) +{ + +#if defined(CONFIG_SOCKS) + if (net_context_is_proxy_enabled(ctx)) { + SET_ERRNO(net_socks5_connect(ctx, addr, addrlen)); + SET_ERRNO(net_context_recv(ctx, zsock_received_cb, + K_NO_WAIT, ctx->user_data)); + return 0; + } +#endif + if (net_context_get_state(ctx) == NET_CONTEXT_CONNECTED) { + return 0; + } else if (net_context_get_state(ctx) == NET_CONTEXT_CONNECTING) { + if (sock_is_error(ctx)) { + SET_ERRNO(-POINTER_TO_INT(ctx->user_data)); + } else { + SET_ERRNO(-EALREADY); + } + } else { + k_timeout_t timeout = K_MSEC(CONFIG_NET_SOCKETS_CONNECT_TIMEOUT); + net_context_connect_cb_t cb = NULL; + + if (sock_is_nonblock(ctx)) { + timeout = K_NO_WAIT; + cb = zsock_connected_cb; + } + + if (net_context_get_type(ctx) == SOCK_STREAM) { + /* For STREAM sockets net_context_recv() only installs + * recv callback w/o side effects, and it has to be done + * first to avoid race condition, when TCP stream data + * arrives right after connect. + */ + SET_ERRNO(net_context_recv(ctx, zsock_received_cb, + K_NO_WAIT, ctx->user_data)); + SET_ERRNO(net_context_connect(ctx, addr, addrlen, cb, + timeout, ctx->user_data)); + } else { + SET_ERRNO(net_context_connect(ctx, addr, addrlen, cb, + timeout, ctx->user_data)); + SET_ERRNO(net_context_recv(ctx, zsock_received_cb, + K_NO_WAIT, ctx->user_data)); + } + } + + return 0; +} + +int zsock_listen_ctx(struct net_context *ctx, int backlog) +{ + SET_ERRNO(net_context_listen(ctx, backlog)); + SET_ERRNO(net_context_accept(ctx, zsock_accepted_cb, K_NO_WAIT, ctx)); + + return 0; +} + +int zsock_accept_ctx(struct net_context *parent, struct sockaddr *addr, + socklen_t *addrlen) +{ + struct net_context *ctx; + struct net_pkt *last_pkt; + int fd, ret; + + if (!sock_is_nonblock(parent)) { + k_timeout_t timeout = K_FOREVER; + + /* accept() can reuse zsock_wait_data(), as underneath it's + * monitoring the same queue (accept_q is an alias for recv_q). + */ + ret = zsock_wait_data(parent, &timeout); + if (ret < 0) { + errno = -ret; + return -1; + } + } + + ctx = k_fifo_get(&parent->accept_q, K_NO_WAIT); + if (ctx == NULL) { + errno = EAGAIN; + return -1; + } + + fd = zvfs_reserve_fd(); + if (fd < 0) { + zsock_flush_queue(ctx); + net_context_put(ctx); + return -1; + } + + /* Check if the connection is already disconnected */ + last_pkt = k_fifo_peek_tail(&ctx->recv_q); + if (last_pkt) { + if (net_pkt_eof(last_pkt)) { + sock_set_eof(ctx); + zvfs_free_fd(fd); + zsock_flush_queue(ctx); + net_context_put(ctx); + errno = ECONNABORTED; + return -1; + } + } + + if (net_context_is_closing(ctx)) { + errno = ECONNABORTED; + zvfs_free_fd(fd); + zsock_flush_queue(ctx); + net_context_put(ctx); + return -1; + } + + net_context_set_accepting(ctx, false); + + + if (addr != NULL && addrlen != NULL) { + int len = MIN(*addrlen, sizeof(ctx->remote)); + + memcpy(addr, &ctx->remote, len); + /* addrlen is a value-result argument, set to actual + * size of source address + */ + if (ctx->remote.sa_family == AF_INET) { + *addrlen = sizeof(struct sockaddr_in); + } else if (ctx->remote.sa_family == AF_INET6) { + *addrlen = sizeof(struct sockaddr_in6); + } else { + zvfs_free_fd(fd); + errno = ENOTSUP; + zsock_flush_queue(ctx); + net_context_put(ctx); + return -1; + } + } + + NET_DBG("accept: ctx=%p, fd=%d", ctx, fd); + + zvfs_finalize_typed_fd(fd, ctx, (const struct fd_op_vtable *)&sock_fd_op_vtable, + ZVFS_MODE_IFSOCK); + + return fd; +} + +#define WAIT_BUFS_INITIAL_MS 10 +#define WAIT_BUFS_MAX_MS 100 +#define MAX_WAIT_BUFS K_MSEC(CONFIG_NET_SOCKET_MAX_SEND_WAIT) + +static int send_check_and_wait(struct net_context *ctx, int status, + k_timepoint_t buf_timeout, k_timeout_t timeout, + uint32_t *retry_timeout) +{ + if (K_TIMEOUT_EQ(timeout, K_NO_WAIT)) { + goto out; + } + + if (status != -ENOBUFS && status != -EAGAIN) { + goto out; + } + + /* If we cannot get any buffers in reasonable + * amount of time, then do not wait forever as + * there might be some bigger issue. + * If we get -EAGAIN and cannot recover, then + * it means that the sending window is blocked + * and we just cannot send anything. + */ + if (sys_timepoint_expired(buf_timeout)) { + if (status == -ENOBUFS) { + status = -ENOMEM; + } else { + status = -ENOBUFS; + } + + goto out; + } + + if (!K_TIMEOUT_EQ(timeout, K_FOREVER)) { + *retry_timeout = + MIN(*retry_timeout, k_ticks_to_ms_floor32(timeout.ticks)); + } + + if (ctx->cond.lock) { + (void)k_mutex_unlock(ctx->cond.lock); + } + + if (status == -ENOBUFS) { + /* We can monitor net_pkt/net_buf availability, so just wait. */ + k_sleep(K_MSEC(*retry_timeout)); + } + + if (status == -EAGAIN) { + if (IS_ENABLED(CONFIG_NET_NATIVE_TCP) && + net_context_get_type(ctx) == SOCK_STREAM && + !net_if_is_ip_offloaded(net_context_get_iface(ctx))) { + struct k_poll_event event; + + k_poll_event_init(&event, + K_POLL_TYPE_SEM_AVAILABLE, + K_POLL_MODE_NOTIFY_ONLY, + net_tcp_tx_sem_get(ctx)); + + k_poll(&event, 1, K_MSEC(*retry_timeout)); + } else { + k_sleep(K_MSEC(*retry_timeout)); + } + } + /* Exponentially increase the retry timeout + * Cap the value to WAIT_BUFS_MAX_MS + */ + *retry_timeout = MIN(WAIT_BUFS_MAX_MS, *retry_timeout << 1); + + if (ctx->cond.lock) { + (void)k_mutex_lock(ctx->cond.lock, K_FOREVER); + } + + return 0; + +out: + errno = -status; + return -1; +} + +ssize_t zsock_sendto_ctx(struct net_context *ctx, const void *buf, size_t len, + int flags, + const struct sockaddr *dest_addr, socklen_t addrlen) +{ + k_timeout_t timeout = K_FOREVER; + uint32_t retry_timeout = WAIT_BUFS_INITIAL_MS; + k_timepoint_t buf_timeout, end; + int status; + + if ((flags & ZSOCK_MSG_DONTWAIT) || sock_is_nonblock(ctx)) { + timeout = K_NO_WAIT; + buf_timeout = sys_timepoint_calc(K_NO_WAIT); + } else { + net_context_get_option(ctx, NET_OPT_SNDTIMEO, &timeout, NULL); + buf_timeout = sys_timepoint_calc(MAX_WAIT_BUFS); + } + end = sys_timepoint_calc(timeout); + + /* Register the callback before sending in order to receive the response + * from the peer. + */ + status = net_context_recv(ctx, zsock_received_cb, + K_NO_WAIT, ctx->user_data); + if (status < 0) { + errno = -status; + return -1; + } + + while (1) { + if (dest_addr) { + status = net_context_sendto(ctx, buf, len, dest_addr, + addrlen, NULL, timeout, + ctx->user_data); + } else { + status = net_context_send(ctx, buf, len, NULL, timeout, + ctx->user_data); + } + + if (status < 0) { + status = send_check_and_wait(ctx, status, buf_timeout, + timeout, &retry_timeout); + if (status < 0) { + return status; + } + + /* Update the timeout value in case loop is repeated. */ + timeout = sys_timepoint_timeout(end); + + continue; + } + + break; + } + + return status; +} + +size_t msghdr_non_empty_iov_count(const struct msghdr *msg) +{ + size_t non_empty_iov_count = 0; + + for (size_t i = 0; i < msg->msg_iovlen; i++) { + if (msg->msg_iov[i].iov_len) { + non_empty_iov_count++; + } + } + + return non_empty_iov_count; +} + +ssize_t zsock_sendmsg_ctx(struct net_context *ctx, const struct msghdr *msg, + int flags) +{ + k_timeout_t timeout = K_FOREVER; + uint32_t retry_timeout = WAIT_BUFS_INITIAL_MS; + k_timepoint_t buf_timeout, end; + int status; + + if ((flags & ZSOCK_MSG_DONTWAIT) || sock_is_nonblock(ctx)) { + timeout = K_NO_WAIT; + buf_timeout = sys_timepoint_calc(K_NO_WAIT); + } else { + net_context_get_option(ctx, NET_OPT_SNDTIMEO, &timeout, NULL); + buf_timeout = sys_timepoint_calc(MAX_WAIT_BUFS); + } + end = sys_timepoint_calc(timeout); + + while (1) { + status = net_context_sendmsg(ctx, msg, flags, NULL, timeout, NULL); + if (status < 0) { + status = send_check_and_wait(ctx, status, + buf_timeout, + timeout, &retry_timeout); + if (status < 0) { + return status; + } + + /* Update the timeout value in case loop is repeated. */ + timeout = sys_timepoint_timeout(end); + + continue; + } + + break; + } + + return status; +} + +static int sock_get_pkt_src_addr(struct net_pkt *pkt, + enum net_ip_protocol proto, + struct sockaddr *addr, + socklen_t addrlen) +{ + int ret = 0; + struct net_pkt_cursor backup; + uint16_t *port; + + if (!addr || !pkt) { + return -EINVAL; + } + + net_pkt_cursor_backup(pkt, &backup); + net_pkt_cursor_init(pkt); + + addr->sa_family = net_pkt_family(pkt); + + if (IS_ENABLED(CONFIG_NET_IPV4) && + net_pkt_family(pkt) == AF_INET) { + NET_PKT_DATA_ACCESS_CONTIGUOUS_DEFINE(ipv4_access, + struct net_ipv4_hdr); + struct sockaddr_in *addr4 = net_sin(addr); + struct net_ipv4_hdr *ipv4_hdr; + + if (addrlen < sizeof(struct sockaddr_in)) { + ret = -EINVAL; + goto error; + } + + ipv4_hdr = (struct net_ipv4_hdr *)net_pkt_get_data( + pkt, &ipv4_access); + if (!ipv4_hdr || + net_pkt_acknowledge_data(pkt, &ipv4_access) || + net_pkt_skip(pkt, net_pkt_ipv4_opts_len(pkt))) { + ret = -ENOBUFS; + goto error; + } + + net_ipv4_addr_copy_raw((uint8_t *)&addr4->sin_addr, ipv4_hdr->src); + port = &addr4->sin_port; + } else if (IS_ENABLED(CONFIG_NET_IPV6) && + net_pkt_family(pkt) == AF_INET6) { + NET_PKT_DATA_ACCESS_CONTIGUOUS_DEFINE(ipv6_access, + struct net_ipv6_hdr); + struct sockaddr_in6 *addr6 = net_sin6(addr); + struct net_ipv6_hdr *ipv6_hdr; + + if (addrlen < sizeof(struct sockaddr_in6)) { + ret = -EINVAL; + goto error; + } + + ipv6_hdr = (struct net_ipv6_hdr *)net_pkt_get_data( + pkt, &ipv6_access); + if (!ipv6_hdr || + net_pkt_acknowledge_data(pkt, &ipv6_access) || + net_pkt_skip(pkt, net_pkt_ipv6_ext_len(pkt))) { + ret = -ENOBUFS; + goto error; + } + + net_ipv6_addr_copy_raw((uint8_t *)&addr6->sin6_addr, ipv6_hdr->src); + port = &addr6->sin6_port; + } else { + ret = -ENOTSUP; + goto error; + } + + if (IS_ENABLED(CONFIG_NET_UDP) && proto == IPPROTO_UDP) { + NET_PKT_DATA_ACCESS_DEFINE(udp_access, struct net_udp_hdr); + struct net_udp_hdr *udp_hdr; + + udp_hdr = (struct net_udp_hdr *)net_pkt_get_data(pkt, + &udp_access); + if (!udp_hdr) { + ret = -ENOBUFS; + goto error; + } + + *port = udp_hdr->src_port; + } else if (IS_ENABLED(CONFIG_NET_TCP) && proto == IPPROTO_TCP) { + NET_PKT_DATA_ACCESS_DEFINE(tcp_access, struct net_tcp_hdr); + struct net_tcp_hdr *tcp_hdr; + + tcp_hdr = (struct net_tcp_hdr *)net_pkt_get_data(pkt, + &tcp_access); + if (!tcp_hdr) { + ret = -ENOBUFS; + goto error; + } + + *port = tcp_hdr->src_port; + } else { + ret = -ENOTSUP; + } + +error: + net_pkt_cursor_restore(pkt, &backup); + + return ret; +} + +#if defined(CONFIG_NET_OFFLOAD) +static bool net_pkt_remote_addr_is_unspecified(struct net_pkt *pkt) +{ + bool ret = true; + + if (net_pkt_family(pkt) == AF_INET) { + ret = net_ipv4_is_addr_unspecified(&net_sin(&pkt->remote)->sin_addr); + } else if (net_pkt_family(pkt) == AF_INET6) { + ret = net_ipv6_is_addr_unspecified(&net_sin6(&pkt->remote)->sin6_addr); + } + + return ret; +} + +static int sock_get_offload_pkt_src_addr(struct net_pkt *pkt, + struct net_context *ctx, + struct sockaddr *addr, + socklen_t addrlen) +{ + int ret = 0; + + if (!addr || !pkt) { + return -EINVAL; + } + + if (!net_pkt_remote_addr_is_unspecified(pkt)) { + if (IS_ENABLED(CONFIG_NET_IPV4) && + net_pkt_family(pkt) == AF_INET) { + if (addrlen < sizeof(struct sockaddr_in)) { + ret = -EINVAL; + goto error; + } + + memcpy(addr, &pkt->remote, sizeof(struct sockaddr_in)); + } else if (IS_ENABLED(CONFIG_NET_IPV6) && + net_pkt_family(pkt) == AF_INET6) { + if (addrlen < sizeof(struct sockaddr_in6)) { + ret = -EINVAL; + goto error; + } + + memcpy(addr, &pkt->remote, sizeof(struct sockaddr_in6)); + } + } else if (ctx->flags & NET_CONTEXT_REMOTE_ADDR_SET) { + memcpy(addr, &ctx->remote, MIN(addrlen, sizeof(ctx->remote))); + } else { + ret = -ENOTSUP; + } + +error: + return ret; +} +#else +static int sock_get_offload_pkt_src_addr(struct net_pkt *pkt, + struct net_context *ctx, + struct sockaddr *addr, + socklen_t addrlen) +{ + ARG_UNUSED(pkt); + ARG_UNUSED(ctx); + ARG_UNUSED(addr); + ARG_UNUSED(addrlen); + + return 0; +} +#endif /* CONFIG_NET_OFFLOAD */ + +void net_socket_update_tc_rx_time(struct net_pkt *pkt, uint32_t end_tick) +{ + net_pkt_set_rx_stats_tick(pkt, end_tick); + + net_stats_update_tc_rx_time(net_pkt_iface(pkt), + net_pkt_priority(pkt), + net_pkt_create_time(pkt), + end_tick); + + SYS_PORT_TRACING_FUNC(net, rx_time, pkt, end_tick); + + if (IS_ENABLED(CONFIG_NET_PKT_RXTIME_STATS_DETAIL)) { + uint32_t val, prev = net_pkt_create_time(pkt); + int i; + + for (i = 0; i < net_pkt_stats_tick_count(pkt); i++) { + if (!net_pkt_stats_tick(pkt)[i]) { + break; + } + + val = net_pkt_stats_tick(pkt)[i] - prev; + prev = net_pkt_stats_tick(pkt)[i]; + net_pkt_stats_tick(pkt)[i] = val; + } + + net_stats_update_tc_rx_time_detail( + net_pkt_iface(pkt), + net_pkt_priority(pkt), + net_pkt_stats_tick(pkt)); + } +} + +int zsock_wait_data(struct net_context *ctx, k_timeout_t *timeout) +{ + int ret; + + if (ctx->cond.lock == NULL) { + /* For some reason the lock pointer is not set properly + * when called by fdtable.c:zvfs_finalize_fd() + * It is not practical to try to figure out the fdtable + * lock at this point so skip it. + */ + NET_WARN("No lock pointer set for context %p", ctx); + return -EINVAL; + } + + if (k_fifo_is_empty(&ctx->recv_q)) { + /* Wait for the data to arrive but without holding a lock */ + ret = k_condvar_wait(&ctx->cond.recv, ctx->cond.lock, + *timeout); + if (ret < 0) { + return ret; + } + + if (sock_is_error(ctx)) { + return -POINTER_TO_INT(ctx->user_data); + } + } + + return 0; +} + +static int insert_pktinfo(struct msghdr *msg, int level, int type, + void *pktinfo, size_t pktinfo_len) +{ + struct cmsghdr *cmsg; + + if (msg->msg_controllen < pktinfo_len) { + return -EINVAL; + } + + for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) { + if (cmsg->cmsg_len == 0) { + break; + } + } + + if (cmsg == NULL) { + return -EINVAL; + } + + cmsg->cmsg_len = CMSG_LEN(pktinfo_len); + cmsg->cmsg_level = level; + cmsg->cmsg_type = type; + + memcpy(CMSG_DATA(cmsg), pktinfo, pktinfo_len); + + return 0; +} + +static int add_timestamping(struct net_context *ctx, + struct net_pkt *pkt, + struct msghdr *msg) +{ + uint8_t timestamping = 0; + + net_context_get_option(ctx, NET_OPT_TIMESTAMPING, ×tamping, NULL); + + if (timestamping) { + return insert_pktinfo(msg, SOL_SOCKET, SO_TIMESTAMPING, + net_pkt_timestamp(pkt), sizeof(struct net_ptp_time)); + } + + return -ENOTSUP; +} + +static int add_pktinfo(struct net_context *ctx, + struct net_pkt *pkt, + struct msghdr *msg) +{ + int ret = -ENOTSUP; + struct net_pkt_cursor backup; + + net_pkt_cursor_backup(pkt, &backup); + net_pkt_cursor_init(pkt); + + if (IS_ENABLED(CONFIG_NET_IPV4) && net_pkt_family(pkt) == AF_INET) { + NET_PKT_DATA_ACCESS_CONTIGUOUS_DEFINE(ipv4_access, + struct net_ipv4_hdr); + struct in_pktinfo info; + struct net_ipv4_hdr *ipv4_hdr; + + ipv4_hdr = (struct net_ipv4_hdr *)net_pkt_get_data( + pkt, &ipv4_access); + if (ipv4_hdr == NULL || + net_pkt_acknowledge_data(pkt, &ipv4_access) || + net_pkt_skip(pkt, net_pkt_ipv4_opts_len(pkt))) { + ret = -ENOBUFS; + goto out; + } + + net_ipv4_addr_copy_raw((uint8_t *)&info.ipi_addr, ipv4_hdr->dst); + net_ipv4_addr_copy_raw((uint8_t *)&info.ipi_spec_dst, + (uint8_t *)net_sin_ptr(&ctx->local)->sin_addr); + info.ipi_ifindex = ctx->iface; + + ret = insert_pktinfo(msg, IPPROTO_IP, IP_PKTINFO, + &info, sizeof(info)); + + goto out; + } + + if (IS_ENABLED(CONFIG_NET_IPV6) && net_pkt_family(pkt) == AF_INET6) { + NET_PKT_DATA_ACCESS_CONTIGUOUS_DEFINE(ipv6_access, + struct net_ipv6_hdr); + struct in6_pktinfo info; + struct net_ipv6_hdr *ipv6_hdr; + + ipv6_hdr = (struct net_ipv6_hdr *)net_pkt_get_data( + pkt, &ipv6_access); + if (ipv6_hdr == NULL || + net_pkt_acknowledge_data(pkt, &ipv6_access) || + net_pkt_skip(pkt, net_pkt_ipv6_ext_len(pkt))) { + ret = -ENOBUFS; + goto out; + } + + net_ipv6_addr_copy_raw((uint8_t *)&info.ipi6_addr, ipv6_hdr->dst); + info.ipi6_ifindex = ctx->iface; + + ret = insert_pktinfo(msg, IPPROTO_IPV6, IPV6_RECVPKTINFO, + &info, sizeof(info)); + + goto out; + } + +out: + net_pkt_cursor_restore(pkt, &backup); + + return ret; +} + +static int update_msg_controllen(struct msghdr *msg) +{ + struct cmsghdr *cmsg; + size_t cmsg_space = 0; + + for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) { + if (cmsg->cmsg_len == 0) { + break; + } + cmsg_space += cmsg->cmsg_len; + } + msg->msg_controllen = cmsg_space; + + return 0; +} + +static inline ssize_t zsock_recv_dgram(struct net_context *ctx, + struct msghdr *msg, + void *buf, + size_t max_len, + int flags, + struct sockaddr *src_addr, + socklen_t *addrlen) +{ + k_timeout_t timeout = K_FOREVER; + size_t recv_len = 0; + size_t read_len; + struct net_pkt_cursor backup; + struct net_pkt *pkt; + + if ((flags & ZSOCK_MSG_DONTWAIT) || sock_is_nonblock(ctx)) { + timeout = K_NO_WAIT; + } else { + int ret; + + net_context_get_option(ctx, NET_OPT_RCVTIMEO, &timeout, NULL); + + ret = zsock_wait_data(ctx, &timeout); + if (ret < 0) { + errno = -ret; + return -1; + } + } + + if (flags & ZSOCK_MSG_PEEK) { + int res; + + res = fifo_wait_non_empty(&ctx->recv_q, timeout); + /* EAGAIN when timeout expired, EINTR when cancelled */ + if (res && res != -EAGAIN && res != -EINTR) { + errno = -res; + return -1; + } + + pkt = k_fifo_peek_head(&ctx->recv_q); + } else { + pkt = k_fifo_get(&ctx->recv_q, timeout); + } + + if (!pkt) { + errno = EAGAIN; + return -1; + } + + net_pkt_cursor_backup(pkt, &backup); + + if (src_addr && addrlen) { + if (IS_ENABLED(CONFIG_NET_OFFLOAD) && + net_if_is_ip_offloaded(net_context_get_iface(ctx))) { + int ret; + + ret = sock_get_offload_pkt_src_addr(pkt, ctx, src_addr, + *addrlen); + if (ret < 0) { + errno = -ret; + NET_DBG("sock_get_offload_pkt_src_addr %d", ret); + goto fail; + } + } else { + int ret; + + ret = sock_get_pkt_src_addr(pkt, net_context_get_proto(ctx), + src_addr, *addrlen); + if (ret < 0) { + errno = -ret; + NET_DBG("sock_get_pkt_src_addr %d", ret); + goto fail; + } + } + + /* addrlen is a value-result argument, set to actual + * size of source address + */ + if (src_addr->sa_family == AF_INET) { + *addrlen = sizeof(struct sockaddr_in); + } else if (src_addr->sa_family == AF_INET6) { + *addrlen = sizeof(struct sockaddr_in6); + } else { + errno = ENOTSUP; + goto fail; + } + } + + if (msg != NULL) { + int iovec = 0; + size_t tmp_read_len; + + if (msg->msg_iovlen < 1 || msg->msg_iov == NULL) { + errno = ENOMEM; + return -1; + } + + recv_len = net_pkt_remaining_data(pkt); + tmp_read_len = read_len = MIN(recv_len, max_len); + + while (tmp_read_len > 0) { + size_t len; + + buf = msg->msg_iov[iovec].iov_base; + if (buf == NULL) { + errno = EINVAL; + return -1; + } + + len = MIN(tmp_read_len, msg->msg_iov[iovec].iov_len); + + if (net_pkt_read(pkt, buf, len)) { + errno = ENOBUFS; + goto fail; + } + + if (len <= tmp_read_len) { + tmp_read_len -= len; + msg->msg_iov[iovec].iov_len = len; + iovec++; + } else { + errno = EINVAL; + return -1; + } + } + + msg->msg_iovlen = iovec; + + if (recv_len != read_len) { + msg->msg_flags |= ZSOCK_MSG_TRUNC; + } + + } else { + recv_len = net_pkt_remaining_data(pkt); + read_len = MIN(recv_len, max_len); + + if (net_pkt_read(pkt, buf, read_len)) { + errno = ENOBUFS; + goto fail; + } + } + + if (msg != NULL) { + if (msg->msg_control != NULL) { + if (msg->msg_controllen > 0) { + if (IS_ENABLED(CONFIG_NET_CONTEXT_TIMESTAMPING) && + net_context_is_timestamping_set(ctx)) { + if (add_timestamping(ctx, pkt, msg) < 0) { + msg->msg_flags |= ZSOCK_MSG_CTRUNC; + } + } + + if (IS_ENABLED(CONFIG_NET_CONTEXT_RECV_PKTINFO) && + net_context_is_recv_pktinfo_set(ctx)) { + if (add_pktinfo(ctx, pkt, msg) < 0) { + msg->msg_flags |= ZSOCK_MSG_CTRUNC; + } + } + + /* msg_controllen must be updated to reflect the total length of all + * control messages in the buffer. If there are no control data, + * msg_controllen will be cleared as expected It will also take into + * account pre-existing control data + */ + update_msg_controllen(msg); + } + } else { + msg->msg_controllen = 0U; + } + } + + if ((IS_ENABLED(CONFIG_NET_PKT_RXTIME_STATS) || + IS_ENABLED(CONFIG_TRACING_NET_CORE)) && + !(flags & ZSOCK_MSG_PEEK)) { + net_socket_update_tc_rx_time(pkt, k_cycle_get_32()); + } + + if (!(flags & ZSOCK_MSG_PEEK)) { + net_pkt_unref(pkt); + } else { + net_pkt_cursor_restore(pkt, &backup); + } + + return (flags & ZSOCK_MSG_TRUNC) ? recv_len : read_len; + +fail: + if (!(flags & ZSOCK_MSG_PEEK)) { + net_pkt_unref(pkt); + } + + return -1; +} + +static size_t zsock_recv_stream_immediate(struct net_context *ctx, uint8_t **buf, size_t *max_len, + int flags) +{ + size_t len; + size_t pkt_len; + size_t recv_len = 0; + struct net_pkt *pkt; + struct net_pkt_cursor backup; + struct net_pkt *origin = NULL; + const bool do_recv = !(buf == NULL || max_len == NULL); + size_t _max_len = (max_len == NULL) ? SIZE_MAX : *max_len; + const bool peek = (flags & ZSOCK_MSG_PEEK) == ZSOCK_MSG_PEEK; + + while (_max_len > 0) { + /* only peek until we know we can dequeue and / or requeue buffer */ + pkt = k_fifo_peek_head(&ctx->recv_q); + if (pkt == NULL || pkt == origin) { + break; + } + + if (origin == NULL) { + /* mark first pkt to avoid cycles when observing */ + origin = pkt; + } + + pkt_len = net_pkt_remaining_data(pkt); + len = MIN(_max_len, pkt_len); + recv_len += len; + _max_len -= len; + + if (do_recv && len > 0) { + if (peek) { + net_pkt_cursor_backup(pkt, &backup); + } + + net_pkt_read(pkt, *buf, len); + /* update buffer position for caller */ + *buf += len; + + if (peek) { + net_pkt_cursor_restore(pkt, &backup); + } + } + + if (do_recv && !peek) { + if (len == pkt_len) { + /* dequeue empty packets when not observing */ + pkt = k_fifo_get(&ctx->recv_q, K_NO_WAIT); + if (net_pkt_eof(pkt)) { + sock_set_eof(ctx); + } + + if (IS_ENABLED(CONFIG_NET_PKT_RXTIME_STATS) || + IS_ENABLED(CONFIG_TRACING_NET_CORE)) { + net_socket_update_tc_rx_time(pkt, k_cycle_get_32()); + } + + net_pkt_unref(pkt); + } + } else if (!do_recv || peek) { + /* requeue packets when observing */ + k_fifo_put(&ctx->recv_q, k_fifo_get(&ctx->recv_q, K_NO_WAIT)); + } + } + + if (do_recv) { + /* convey remaining buffer size back to caller */ + *max_len = _max_len; + } + + return recv_len; +} + +static int zsock_fionread_ctx(struct net_context *ctx) +{ + size_t ret = zsock_recv_stream_immediate(ctx, NULL, NULL, 0); + + return MIN(ret, INT_MAX); +} + +static ssize_t zsock_recv_stream_timed(struct net_context *ctx, struct msghdr *msg, + uint8_t *buf, size_t max_len, + int flags, k_timeout_t timeout) +{ + int res; + k_timepoint_t end; + size_t recv_len = 0, iovec = 0, available_len, max_iovlen = 0; + const bool waitall = (flags & ZSOCK_MSG_WAITALL) == ZSOCK_MSG_WAITALL; + + if (msg != NULL && buf == NULL) { + if (msg->msg_iovlen < 1) { + return -EINVAL; + } + + buf = msg->msg_iov[iovec].iov_base; + available_len = msg->msg_iov[iovec].iov_len; + msg->msg_iov[iovec].iov_len = 0; + max_iovlen = msg->msg_iovlen; + } + + for (end = sys_timepoint_calc(timeout); max_len > 0; timeout = sys_timepoint_timeout(end)) { + + if (sock_is_error(ctx)) { + return -POINTER_TO_INT(ctx->user_data); + } + + if (sock_is_eof(ctx)) { + return 0; + } + + if (!K_TIMEOUT_EQ(timeout, K_NO_WAIT)) { + res = zsock_wait_data(ctx, &timeout); + if (res < 0) { + return res; + } + } + + if (msg != NULL) { +again: + res = zsock_recv_stream_immediate(ctx, &buf, &available_len, flags); + recv_len += res; + + if (res == 0 && recv_len == 0 && K_TIMEOUT_EQ(timeout, K_NO_WAIT)) { + return -EAGAIN; + } + + msg->msg_iov[iovec].iov_len += res; + buf = (uint8_t *)(msg->msg_iov[iovec].iov_base) + res; + max_len -= res; + + if (available_len == 0) { + /* All data to this iovec was written */ + iovec++; + + if (iovec == max_iovlen) { + break; + } + + msg->msg_iovlen = iovec; + buf = msg->msg_iov[iovec].iov_base; + available_len = msg->msg_iov[iovec].iov_len; + msg->msg_iov[iovec].iov_len = 0; + + /* If there is more data, read it now and do not wait */ + if (buf != NULL && available_len > 0) { + goto again; + } + + continue; + } + + } else { + res = zsock_recv_stream_immediate(ctx, &buf, &max_len, flags); + recv_len += res; + + if (res == 0) { + if (recv_len == 0 && K_TIMEOUT_EQ(timeout, K_NO_WAIT)) { + return -EAGAIN; + } + } + } + + if (!waitall) { + break; + } + } + + return recv_len; +} + +static ssize_t zsock_recv_stream(struct net_context *ctx, struct msghdr *msg, + void *buf, size_t max_len, int flags) +{ + ssize_t res; + size_t recv_len = 0; + k_timeout_t timeout = K_FOREVER; + + if (!net_context_is_used(ctx)) { + errno = EBADF; + return -1; + } + + if (net_context_get_state(ctx) != NET_CONTEXT_CONNECTED) { + errno = ENOTCONN; + return -1; + } + + if ((flags & ZSOCK_MSG_DONTWAIT) || sock_is_nonblock(ctx)) { + timeout = K_NO_WAIT; + } else if (!sock_is_eof(ctx) && !sock_is_error(ctx)) { + net_context_get_option(ctx, NET_OPT_RCVTIMEO, &timeout, NULL); + } + + if (max_len == 0) { + /* no bytes requested - done! */ + return 0; + } + + res = zsock_recv_stream_timed(ctx, msg, buf, max_len, flags, timeout); + recv_len += MAX(0, res); + + if (res < 0) { + errno = -res; + return -1; + } + + if (!(flags & ZSOCK_MSG_PEEK)) { + net_context_update_recv_wnd(ctx, recv_len); + } + + return recv_len; +} + +ssize_t zsock_recvfrom_ctx(struct net_context *ctx, void *buf, size_t max_len, + int flags, + struct sockaddr *src_addr, socklen_t *addrlen) +{ + enum net_sock_type sock_type = net_context_get_type(ctx); + + if (max_len == 0) { + return 0; + } + + if (sock_type == SOCK_DGRAM) { + return zsock_recv_dgram(ctx, NULL, buf, max_len, flags, src_addr, addrlen); + } else if (sock_type == SOCK_STREAM) { + return zsock_recv_stream(ctx, NULL, buf, max_len, flags); + } + + __ASSERT(0, "Unknown socket type"); + + errno = ENOTSUP; + + return -1; +} + +ssize_t zsock_recvmsg_ctx(struct net_context *ctx, struct msghdr *msg, + int flags) +{ + enum net_sock_type sock_type = net_context_get_type(ctx); + size_t i, max_len = 0; + + if (msg == NULL) { + errno = EINVAL; + return -1; + } + + if (msg->msg_iov == NULL) { + errno = ENOMEM; + return -1; + } + + for (i = 0; i < msg->msg_iovlen; i++) { + max_len += msg->msg_iov[i].iov_len; + } + + if (sock_type == SOCK_DGRAM) { + return zsock_recv_dgram(ctx, msg, NULL, max_len, flags, + msg->msg_name, &msg->msg_namelen); + } else if (sock_type == SOCK_STREAM) { + return zsock_recv_stream(ctx, msg, NULL, max_len, flags); + } + + __ASSERT(0, "Unknown socket type"); + + errno = ENOTSUP; + + return -1; +} + +static int zsock_poll_prepare_ctx(struct net_context *ctx, + struct zsock_pollfd *pfd, + struct k_poll_event **pev, + struct k_poll_event *pev_end) +{ + if (pfd->events & ZSOCK_POLLIN) { + if (*pev == pev_end) { + return -ENOMEM; + } + + (*pev)->obj = &ctx->recv_q; + (*pev)->type = K_POLL_TYPE_FIFO_DATA_AVAILABLE; + (*pev)->mode = K_POLL_MODE_NOTIFY_ONLY; + (*pev)->state = K_POLL_STATE_NOT_READY; + (*pev)++; + } + + if (pfd->events & ZSOCK_POLLOUT) { + if (IS_ENABLED(CONFIG_NET_NATIVE_TCP) && + net_context_get_type(ctx) == SOCK_STREAM && + !net_if_is_ip_offloaded(net_context_get_iface(ctx))) { + if (*pev == pev_end) { + return -ENOMEM; + } + + if (net_context_get_state(ctx) == NET_CONTEXT_CONNECTING) { + (*pev)->obj = net_tcp_conn_sem_get(ctx); + } else { + (*pev)->obj = net_tcp_tx_sem_get(ctx); + } + + (*pev)->type = K_POLL_TYPE_SEM_AVAILABLE; + (*pev)->mode = K_POLL_MODE_NOTIFY_ONLY; + (*pev)->state = K_POLL_STATE_NOT_READY; + (*pev)++; + } else { + return -EALREADY; + } + + } + + /* If socket is already in EOF or error, it can be reported + * immediately, so we tell poll() to short-circuit wait. + */ + if (sock_is_eof(ctx) || sock_is_error(ctx)) { + return -EALREADY; + } + + return 0; +} + +static int zsock_poll_update_ctx(struct net_context *ctx, + struct zsock_pollfd *pfd, + struct k_poll_event **pev) +{ + ARG_UNUSED(ctx); + + if (pfd->events & ZSOCK_POLLIN) { + if ((*pev)->state != K_POLL_STATE_NOT_READY || sock_is_eof(ctx)) { + pfd->revents |= ZSOCK_POLLIN; + } + (*pev)++; + } + if (pfd->events & ZSOCK_POLLOUT) { + if (IS_ENABLED(CONFIG_NET_NATIVE_TCP) && + net_context_get_type(ctx) == SOCK_STREAM && + !net_if_is_ip_offloaded(net_context_get_iface(ctx))) { + if ((*pev)->state != K_POLL_STATE_NOT_READY && + !sock_is_eof(ctx) && + (net_context_get_state(ctx) == NET_CONTEXT_CONNECTED)) { + pfd->revents |= ZSOCK_POLLOUT; + } + (*pev)++; + } else { + pfd->revents |= ZSOCK_POLLOUT; + } + } + + if (sock_is_error(ctx)) { + pfd->revents |= ZSOCK_POLLERR; + } + + if (sock_is_eof(ctx)) { + pfd->revents |= ZSOCK_POLLHUP; + } + + return 0; +} + +static enum tcp_conn_option get_tcp_option(int optname) +{ + switch (optname) { + case TCP_KEEPIDLE: + return TCP_OPT_KEEPIDLE; + case TCP_KEEPINTVL: + return TCP_OPT_KEEPINTVL; + case TCP_KEEPCNT: + return TCP_OPT_KEEPCNT; + } + + return -EINVAL; +} + +int zsock_getsockopt_ctx(struct net_context *ctx, int level, int optname, + void *optval, socklen_t *optlen) +{ + int ret; + + switch (level) { + case SOL_SOCKET: + switch (optname) { + case SO_ERROR: { + if (*optlen != sizeof(int)) { + errno = EINVAL; + return -1; + } + + *(int *)optval = POINTER_TO_INT(ctx->user_data); + + return 0; + } + + case SO_TYPE: { + int type = (int)net_context_get_type(ctx); + + if (*optlen != sizeof(type)) { + errno = EINVAL; + return -1; + } + + *(int *)optval = type; + + return 0; + } + + case SO_TXTIME: + if (IS_ENABLED(CONFIG_NET_CONTEXT_TXTIME)) { + ret = net_context_get_option(ctx, + NET_OPT_TXTIME, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + break; + + case SO_PROTOCOL: { + int proto = (int)net_context_get_proto(ctx); + + if (*optlen != sizeof(proto)) { + errno = EINVAL; + return -1; + } + + *(int *)optval = proto; + + return 0; + } + + case SO_DOMAIN: { + if (*optlen != sizeof(int)) { + errno = EINVAL; + return -1; + } + + *(int *)optval = net_context_get_family(ctx); + + return 0; + } + + break; + + case SO_RCVBUF: + if (IS_ENABLED(CONFIG_NET_CONTEXT_RCVBUF)) { + ret = net_context_get_option(ctx, + NET_OPT_RCVBUF, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + break; + + case SO_SNDBUF: + if (IS_ENABLED(CONFIG_NET_CONTEXT_SNDBUF)) { + ret = net_context_get_option(ctx, + NET_OPT_SNDBUF, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + break; + + case SO_REUSEADDR: + if (IS_ENABLED(CONFIG_NET_CONTEXT_REUSEADDR)) { + ret = net_context_get_option(ctx, + NET_OPT_REUSEADDR, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + break; + + case SO_REUSEPORT: + if (IS_ENABLED(CONFIG_NET_CONTEXT_REUSEPORT)) { + ret = net_context_get_option(ctx, + NET_OPT_REUSEPORT, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + break; + + case SO_KEEPALIVE: + if (IS_ENABLED(CONFIG_NET_TCP_KEEPALIVE) && + net_context_get_proto(ctx) == IPPROTO_TCP) { + ret = net_tcp_get_option(ctx, + TCP_OPT_KEEPALIVE, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + + case SO_TIMESTAMPING: + if (IS_ENABLED(CONFIG_NET_CONTEXT_TIMESTAMPING)) { + ret = net_context_get_option(ctx, + NET_OPT_TIMESTAMPING, + optval, optlen); + + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + } + + break; + + case IPPROTO_TCP: + switch (optname) { + case TCP_NODELAY: + ret = net_tcp_get_option(ctx, TCP_OPT_NODELAY, optval, optlen); + return ret; + + case TCP_KEEPIDLE: + __fallthrough; + case TCP_KEEPINTVL: + __fallthrough; + case TCP_KEEPCNT: + if (IS_ENABLED(CONFIG_NET_TCP_KEEPALIVE)) { + ret = net_tcp_get_option(ctx, + get_tcp_option(optname), + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + } + + break; + + case IPPROTO_IP: + switch (optname) { + case IP_TOS: + if (IS_ENABLED(CONFIG_NET_CONTEXT_DSCP_ECN)) { + ret = net_context_get_option(ctx, + NET_OPT_DSCP_ECN, + optval, + optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + + case IP_TTL: + ret = net_context_get_option(ctx, NET_OPT_TTL, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + + case IP_MULTICAST_TTL: + ret = net_context_get_option(ctx, NET_OPT_MCAST_TTL, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + + case IPPROTO_IPV6: + switch (optname) { + case IPV6_V6ONLY: + if (IS_ENABLED(CONFIG_NET_IPV4_MAPPING_TO_IPV6)) { + ret = net_context_get_option(ctx, + NET_OPT_IPV6_V6ONLY, + optval, + optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + + case IPV6_ADDR_PREFERENCES: + if (IS_ENABLED(CONFIG_NET_IPV6)) { + ret = net_context_get_option(ctx, + NET_OPT_ADDR_PREFERENCES, + optval, + optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + + case IPV6_TCLASS: + if (IS_ENABLED(CONFIG_NET_CONTEXT_DSCP_ECN)) { + ret = net_context_get_option(ctx, + NET_OPT_DSCP_ECN, + optval, + optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + + case IPV6_UNICAST_HOPS: + ret = net_context_get_option(ctx, + NET_OPT_UNICAST_HOP_LIMIT, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + + case IPV6_MULTICAST_HOPS: + ret = net_context_get_option(ctx, + NET_OPT_MCAST_HOP_LIMIT, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + } + + errno = ENOPROTOOPT; + return -1; +} + +static int ipv4_multicast_group(struct net_context *ctx, const void *optval, + socklen_t optlen, bool do_join) +{ + struct ip_mreqn *mreqn; + struct net_if *iface; + int ifindex, ret; + + if (optval == NULL || optlen != sizeof(struct ip_mreqn)) { + errno = EINVAL; + return -1; + } + + mreqn = (struct ip_mreqn *)optval; + + if (mreqn->imr_multiaddr.s_addr == INADDR_ANY) { + errno = EINVAL; + return -1; + } + + if (mreqn->imr_ifindex != 0) { + iface = net_if_get_by_index(mreqn->imr_ifindex); + } else { + ifindex = net_if_ipv4_addr_lookup_by_index(&mreqn->imr_address); + iface = net_if_get_by_index(ifindex); + } + + if (iface == NULL) { + /* Check if ctx has already an interface and if not, + * then select the default interface. + */ + if (ctx->iface <= 0) { + iface = net_if_get_default(); + } else { + iface = net_if_get_by_index(ctx->iface); + } + + if (iface == NULL) { + errno = EINVAL; + return -1; + } + } + + if (do_join) { + ret = net_ipv4_igmp_join(iface, &mreqn->imr_multiaddr, NULL); + } else { + ret = net_ipv4_igmp_leave(iface, &mreqn->imr_multiaddr); + } + + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; +} + +static int ipv6_multicast_group(struct net_context *ctx, const void *optval, + socklen_t optlen, bool do_join) +{ + struct ipv6_mreq *mreq; + struct net_if *iface; + int ret; + + if (optval == NULL || optlen != sizeof(struct ipv6_mreq)) { + errno = EINVAL; + return -1; + } + + mreq = (struct ipv6_mreq *)optval; + + if (memcmp(&mreq->ipv6mr_multiaddr, + net_ipv6_unspecified_address(), + sizeof(mreq->ipv6mr_multiaddr)) == 0) { + errno = EINVAL; + return -1; + } + + iface = net_if_get_by_index(mreq->ipv6mr_ifindex); + if (iface == NULL) { + /* Check if ctx has already an interface and if not, + * then select the default interface. + */ + if (ctx->iface <= 0) { + iface = net_if_get_default(); + } else { + iface = net_if_get_by_index(ctx->iface); + } + + if (iface == NULL) { + errno = ENOENT; + return -1; + } + } + + if (do_join) { + ret = net_ipv6_mld_join(iface, &mreq->ipv6mr_multiaddr); + } else { + ret = net_ipv6_mld_leave(iface, &mreq->ipv6mr_multiaddr); + } + + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; +} + +int zsock_setsockopt_ctx(struct net_context *ctx, int level, int optname, + const void *optval, socklen_t optlen) +{ + int ret; + + switch (level) { + case SOL_SOCKET: + switch (optname) { + case SO_RCVBUF: + if (IS_ENABLED(CONFIG_NET_CONTEXT_RCVBUF)) { + ret = net_context_set_option(ctx, + NET_OPT_RCVBUF, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + + case SO_SNDBUF: + if (IS_ENABLED(CONFIG_NET_CONTEXT_SNDBUF)) { + ret = net_context_set_option(ctx, + NET_OPT_SNDBUF, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + + case SO_REUSEADDR: + if (IS_ENABLED(CONFIG_NET_CONTEXT_REUSEADDR)) { + ret = net_context_set_option(ctx, + NET_OPT_REUSEADDR, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + + case SO_REUSEPORT: + if (IS_ENABLED(CONFIG_NET_CONTEXT_REUSEPORT)) { + ret = net_context_set_option(ctx, + NET_OPT_REUSEPORT, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + + case SO_PRIORITY: + if (IS_ENABLED(CONFIG_NET_CONTEXT_PRIORITY)) { + ret = net_context_set_option(ctx, + NET_OPT_PRIORITY, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + + case SO_RCVTIMEO: + if (IS_ENABLED(CONFIG_NET_CONTEXT_RCVTIMEO)) { + const struct zsock_timeval *tv = optval; + k_timeout_t timeout; + + if (optlen != sizeof(struct zsock_timeval)) { + errno = EINVAL; + return -1; + } + + if (tv->tv_sec == 0 && tv->tv_usec == 0) { + timeout = K_FOREVER; + } else { + timeout = K_USEC(tv->tv_sec * 1000000ULL + + tv->tv_usec); + } + + ret = net_context_set_option(ctx, + NET_OPT_RCVTIMEO, + &timeout, + sizeof(timeout)); + + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + + case SO_SNDTIMEO: + if (IS_ENABLED(CONFIG_NET_CONTEXT_SNDTIMEO)) { + const struct zsock_timeval *tv = optval; + k_timeout_t timeout; + + if (optlen != sizeof(struct zsock_timeval)) { + errno = EINVAL; + return -1; + } + + if (tv->tv_sec == 0 && tv->tv_usec == 0) { + timeout = K_FOREVER; + } else { + timeout = K_USEC(tv->tv_sec * 1000000ULL + + tv->tv_usec); + } + + ret = net_context_set_option(ctx, + NET_OPT_SNDTIMEO, + &timeout, + sizeof(timeout)); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + + case SO_TXTIME: + if (IS_ENABLED(CONFIG_NET_CONTEXT_TXTIME)) { + ret = net_context_set_option(ctx, + NET_OPT_TXTIME, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + + case SO_SOCKS5: + if (IS_ENABLED(CONFIG_SOCKS)) { + ret = net_context_set_option(ctx, + NET_OPT_SOCKS5, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + net_context_set_proxy_enabled(ctx, true); + + return 0; + } + + break; + + case SO_BINDTODEVICE: { + struct net_if *iface; + const struct ifreq *ifreq = optval; + + if (net_context_get_family(ctx) != AF_INET && + net_context_get_family(ctx) != AF_INET6) { + errno = EAFNOSUPPORT; + return -1; + } + + /* optlen equal to 0 or empty interface name should + * remove the binding. + */ + if ((optlen == 0) || (ifreq != NULL && + strlen(ifreq->ifr_name) == 0)) { + ctx->flags &= ~NET_CONTEXT_BOUND_TO_IFACE; + return 0; + } + + if ((ifreq == NULL) || (optlen != sizeof(*ifreq))) { + errno = EINVAL; + return -1; + } + + if (IS_ENABLED(CONFIG_NET_INTERFACE_NAME)) { + ret = net_if_get_by_name(ifreq->ifr_name); + if (ret < 0) { + errno = -ret; + return -1; + } + + iface = net_if_get_by_index(ret); + if (iface == NULL) { + errno = ENODEV; + return -1; + } + } else { + const struct device *dev; + + dev = device_get_binding(ifreq->ifr_name); + if (dev == NULL) { + errno = ENODEV; + return -1; + } + + iface = net_if_lookup_by_dev(dev); + if (iface == NULL) { + errno = ENODEV; + return -1; + } + } + + net_context_bind_iface(ctx, iface); + + return 0; + } + + case SO_LINGER: + /* ignored. for compatibility purposes only */ + return 0; + + case SO_KEEPALIVE: + if (IS_ENABLED(CONFIG_NET_TCP_KEEPALIVE) && + net_context_get_proto(ctx) == IPPROTO_TCP) { + ret = net_tcp_set_option(ctx, + TCP_OPT_KEEPALIVE, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + + case SO_TIMESTAMPING: + if (IS_ENABLED(CONFIG_NET_CONTEXT_TIMESTAMPING)) { + ret = net_context_set_option(ctx, + NET_OPT_TIMESTAMPING, + optval, optlen); + + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + } + + break; + + case IPPROTO_TCP: + switch (optname) { + case TCP_NODELAY: + ret = net_tcp_set_option(ctx, + TCP_OPT_NODELAY, optval, optlen); + return ret; + + case TCP_KEEPIDLE: + __fallthrough; + case TCP_KEEPINTVL: + __fallthrough; + case TCP_KEEPCNT: + if (IS_ENABLED(CONFIG_NET_TCP_KEEPALIVE)) { + ret = net_tcp_set_option(ctx, + get_tcp_option(optname), + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + } + break; + + case IPPROTO_IP: + switch (optname) { + case IP_TOS: + if (IS_ENABLED(CONFIG_NET_CONTEXT_DSCP_ECN)) { + ret = net_context_set_option(ctx, + NET_OPT_DSCP_ECN, + optval, + optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + + case IP_PKTINFO: + if (IS_ENABLED(CONFIG_NET_IPV4) && + IS_ENABLED(CONFIG_NET_CONTEXT_RECV_PKTINFO)) { + ret = net_context_set_option(ctx, + NET_OPT_RECV_PKTINFO, + optval, + optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + + case IP_MULTICAST_TTL: + ret = net_context_set_option(ctx, NET_OPT_MCAST_TTL, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + + case IP_TTL: + ret = net_context_set_option(ctx, NET_OPT_TTL, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + + case IP_ADD_MEMBERSHIP: + if (IS_ENABLED(CONFIG_NET_IPV4)) { + return ipv4_multicast_group(ctx, optval, + optlen, true); + } + + break; + + case IP_DROP_MEMBERSHIP: + if (IS_ENABLED(CONFIG_NET_IPV4)) { + return ipv4_multicast_group(ctx, optval, + optlen, false); + } + + break; + } + + break; + + case IPPROTO_IPV6: + switch (optname) { + case IPV6_V6ONLY: + if (IS_ENABLED(CONFIG_NET_IPV4_MAPPING_TO_IPV6)) { + ret = net_context_set_option(ctx, + NET_OPT_IPV6_V6ONLY, + optval, + optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + } + + return 0; + + case IPV6_RECVPKTINFO: + if (IS_ENABLED(CONFIG_NET_IPV6) && + IS_ENABLED(CONFIG_NET_CONTEXT_RECV_PKTINFO)) { + ret = net_context_set_option(ctx, + NET_OPT_RECV_PKTINFO, + optval, + optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + + case IPV6_ADDR_PREFERENCES: + if (IS_ENABLED(CONFIG_NET_IPV6)) { + ret = net_context_set_option(ctx, + NET_OPT_ADDR_PREFERENCES, + optval, + optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + + case IPV6_TCLASS: + if (IS_ENABLED(CONFIG_NET_CONTEXT_DSCP_ECN)) { + ret = net_context_set_option(ctx, + NET_OPT_DSCP_ECN, + optval, + optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + + case IPV6_UNICAST_HOPS: + ret = net_context_set_option(ctx, + NET_OPT_UNICAST_HOP_LIMIT, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + + case IPV6_MULTICAST_HOPS: + ret = net_context_set_option(ctx, + NET_OPT_MCAST_HOP_LIMIT, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + + case IPV6_ADD_MEMBERSHIP: + if (IS_ENABLED(CONFIG_NET_IPV6)) { + return ipv6_multicast_group(ctx, optval, + optlen, true); + } + + break; + + case IPV6_DROP_MEMBERSHIP: + if (IS_ENABLED(CONFIG_NET_IPV6)) { + return ipv6_multicast_group(ctx, optval, + optlen, false); + } + + break; + } + + break; + } + + errno = ENOPROTOOPT; + return -1; +} + +int zsock_getpeername_ctx(struct net_context *ctx, struct sockaddr *addr, + socklen_t *addrlen) +{ + socklen_t newlen = 0; + + if (addr == NULL || addrlen == NULL) { + SET_ERRNO(-EINVAL); + } + + if (!(ctx->flags & NET_CONTEXT_REMOTE_ADDR_SET)) { + SET_ERRNO(-ENOTCONN); + } + + if (net_context_get_type(ctx) == SOCK_STREAM && + net_context_get_state(ctx) != NET_CONTEXT_CONNECTED) { + SET_ERRNO(-ENOTCONN); + } + + if (IS_ENABLED(CONFIG_NET_IPV4) && ctx->remote.sa_family == AF_INET) { + struct sockaddr_in addr4 = { 0 }; + + addr4.sin_family = AF_INET; + addr4.sin_port = net_sin(&ctx->remote)->sin_port; + memcpy(&addr4.sin_addr, &net_sin(&ctx->remote)->sin_addr, + sizeof(struct in_addr)); + newlen = sizeof(struct sockaddr_in); + + memcpy(addr, &addr4, MIN(*addrlen, newlen)); + } else if (IS_ENABLED(CONFIG_NET_IPV6) && + ctx->remote.sa_family == AF_INET6) { + struct sockaddr_in6 addr6 = { 0 }; + + addr6.sin6_family = AF_INET6; + addr6.sin6_port = net_sin6(&ctx->remote)->sin6_port; + memcpy(&addr6.sin6_addr, &net_sin6(&ctx->remote)->sin6_addr, + sizeof(struct in6_addr)); + newlen = sizeof(struct sockaddr_in6); + + memcpy(addr, &addr6, MIN(*addrlen, newlen)); + } else { + SET_ERRNO(-EINVAL); + } + + *addrlen = newlen; + + return 0; +} + +int zsock_getsockname_ctx(struct net_context *ctx, struct sockaddr *addr, + socklen_t *addrlen) +{ + socklen_t newlen = 0; + int ret; + + if (IS_ENABLED(CONFIG_NET_IPV4) && ctx->local.family == AF_INET) { + struct sockaddr_in addr4 = { 0 }; + + if (net_sin_ptr(&ctx->local)->sin_addr == NULL) { + SET_ERRNO(-EINVAL); + } + + newlen = sizeof(struct sockaddr_in); + + ret = net_context_get_local_addr(ctx, + (struct sockaddr *)&addr4, + &newlen); + if (ret < 0) { + SET_ERRNO(-ret); + } + + memcpy(addr, &addr4, MIN(*addrlen, newlen)); + + } else if (IS_ENABLED(CONFIG_NET_IPV6) && ctx->local.family == AF_INET6) { + struct sockaddr_in6 addr6 = { 0 }; + + if (net_sin6_ptr(&ctx->local)->sin6_addr == NULL) { + SET_ERRNO(-EINVAL); + } + + newlen = sizeof(struct sockaddr_in6); + + ret = net_context_get_local_addr(ctx, + (struct sockaddr *)&addr6, + &newlen); + if (ret < 0) { + SET_ERRNO(-ret); + } + + memcpy(addr, &addr6, MIN(*addrlen, newlen)); + } else { + SET_ERRNO(-EINVAL); + } + + *addrlen = newlen; + + return 0; +} + +static ssize_t sock_read_vmeth(void *obj, void *buffer, size_t count) +{ + return zsock_recvfrom_ctx(obj, buffer, count, 0, NULL, 0); +} + +static ssize_t sock_write_vmeth(void *obj, const void *buffer, size_t count) +{ + return zsock_sendto_ctx(obj, buffer, count, 0, NULL, 0); +} + +static void zsock_ctx_set_lock(struct net_context *ctx, struct k_mutex *lock) +{ + ctx->cond.lock = lock; +} + +static int sock_ioctl_vmeth(void *obj, unsigned int request, va_list args) +{ + switch (request) { + + /* In Zephyr, fcntl() is just an alias of ioctl(). */ + case F_GETFL: + if (sock_is_nonblock(obj)) { + return O_NONBLOCK; + } + + return 0; + + case F_SETFL: { + int flags; + + flags = va_arg(args, int); + + if (flags & O_NONBLOCK) { + sock_set_flag(obj, SOCK_NONBLOCK, SOCK_NONBLOCK); + } else { + sock_set_flag(obj, SOCK_NONBLOCK, 0); + } + + return 0; + } + + case ZFD_IOCTL_POLL_PREPARE: { + struct zsock_pollfd *pfd; + struct k_poll_event **pev; + struct k_poll_event *pev_end; + + pfd = va_arg(args, struct zsock_pollfd *); + pev = va_arg(args, struct k_poll_event **); + pev_end = va_arg(args, struct k_poll_event *); + + return zsock_poll_prepare_ctx(obj, pfd, pev, pev_end); + } + + case ZFD_IOCTL_POLL_UPDATE: { + struct zsock_pollfd *pfd; + struct k_poll_event **pev; + + pfd = va_arg(args, struct zsock_pollfd *); + pev = va_arg(args, struct k_poll_event **); + + return zsock_poll_update_ctx(obj, pfd, pev); + } + + case ZFD_IOCTL_SET_LOCK: { + struct k_mutex *lock; + + lock = va_arg(args, struct k_mutex *); + + zsock_ctx_set_lock(obj, lock); + return 0; + } + + case ZFD_IOCTL_FIONBIO: + sock_set_flag(obj, SOCK_NONBLOCK, SOCK_NONBLOCK); + return 0; + + case ZFD_IOCTL_FIONREAD: { + int *avail = va_arg(args, int *); + + *avail = zsock_fionread_ctx(obj); + return 0; + } + + default: + errno = EOPNOTSUPP; + return -1; + } +} + +static int sock_shutdown_vmeth(void *obj, int how) +{ + return zsock_shutdown_ctx(obj, how); +} + +static int sock_bind_vmeth(void *obj, const struct sockaddr *addr, + socklen_t addrlen) +{ + return zsock_bind_ctx(obj, addr, addrlen); +} + +static int sock_connect_vmeth(void *obj, const struct sockaddr *addr, + socklen_t addrlen) +{ + return zsock_connect_ctx(obj, addr, addrlen); +} + +static int sock_listen_vmeth(void *obj, int backlog) +{ + return zsock_listen_ctx(obj, backlog); +} + +static int sock_accept_vmeth(void *obj, struct sockaddr *addr, + socklen_t *addrlen) +{ + return zsock_accept_ctx(obj, addr, addrlen); +} + +static ssize_t sock_sendto_vmeth(void *obj, const void *buf, size_t len, + int flags, const struct sockaddr *dest_addr, + socklen_t addrlen) +{ + return zsock_sendto_ctx(obj, buf, len, flags, dest_addr, addrlen); +} + +static ssize_t sock_sendmsg_vmeth(void *obj, const struct msghdr *msg, + int flags) +{ + return zsock_sendmsg_ctx(obj, msg, flags); +} + +static ssize_t sock_recvmsg_vmeth(void *obj, struct msghdr *msg, int flags) +{ + return zsock_recvmsg_ctx(obj, msg, flags); +} + +static ssize_t sock_recvfrom_vmeth(void *obj, void *buf, size_t max_len, + int flags, struct sockaddr *src_addr, + socklen_t *addrlen) +{ + return zsock_recvfrom_ctx(obj, buf, max_len, flags, + src_addr, addrlen); +} + +static int sock_getsockopt_vmeth(void *obj, int level, int optname, + void *optval, socklen_t *optlen) +{ + return zsock_getsockopt_ctx(obj, level, optname, optval, optlen); +} + +static int sock_setsockopt_vmeth(void *obj, int level, int optname, + const void *optval, socklen_t optlen) +{ + return zsock_setsockopt_ctx(obj, level, optname, optval, optlen); +} + +static int sock_close_vmeth(void *obj) +{ + return zsock_close_ctx(obj); +} +static int sock_getpeername_vmeth(void *obj, struct sockaddr *addr, + socklen_t *addrlen) +{ + return zsock_getpeername_ctx(obj, addr, addrlen); +} + +static int sock_getsockname_vmeth(void *obj, struct sockaddr *addr, + socklen_t *addrlen) +{ + return zsock_getsockname_ctx(obj, addr, addrlen); +} + +const struct socket_op_vtable sock_fd_op_vtable = { + .fd_vtable = { + .read = sock_read_vmeth, + .write = sock_write_vmeth, + .close = sock_close_vmeth, + .ioctl = sock_ioctl_vmeth, + }, + .shutdown = sock_shutdown_vmeth, + .bind = sock_bind_vmeth, + .connect = sock_connect_vmeth, + .listen = sock_listen_vmeth, + .accept = sock_accept_vmeth, + .sendto = sock_sendto_vmeth, + .sendmsg = sock_sendmsg_vmeth, + .recvmsg = sock_recvmsg_vmeth, + .recvfrom = sock_recvfrom_vmeth, + .getsockopt = sock_getsockopt_vmeth, + .setsockopt = sock_setsockopt_vmeth, + .getpeername = sock_getpeername_vmeth, + .getsockname = sock_getsockname_vmeth, +}; + +static bool inet_is_supported(int family, int type, int proto) +{ + if (family != AF_INET && family != AF_INET6) { + return false; + } + + return true; +} + +NET_SOCKET_REGISTER(af_inet46, NET_SOCKET_DEFAULT_PRIO, AF_UNSPEC, + inet_is_supported, zsock_socket_internal); From 2e1d89619f4d126edcc5f2272728ca941aeead8c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Fri, 27 Sep 2024 15:01:31 +0200 Subject: [PATCH 0227/4482] net: Avoid compiling native network stack parts w/o NET_NATIVE In case NET_NATIVE is disabled, certain network stack components do not need to be compiled. Otherwise, they could throw errors if --no-gc-sections compiler options is enabled. Signed-off-by: Robert Lubos --- include/zephyr/net/net_if.h | 36 ++++++++++++++++++++++++++ subsys/net/ip/net_context.c | 4 +-- subsys/net/ip/net_core.c | 50 +++++++++++++++++++++++++------------ subsys/net/ip/net_if.c | 4 +++ subsys/net/ip/utils.c | 6 ++--- 5 files changed, 79 insertions(+), 21 deletions(-) diff --git a/include/zephyr/net/net_if.h b/include/zephyr/net/net_if.h index 4e08aa50ba564..0e0e619a83158 100644 --- a/include/zephyr/net/net_if.h +++ b/include/zephyr/net/net_if.h @@ -1827,7 +1827,16 @@ bool net_if_ipv6_router_rm(struct net_if_router *router); * * @return Hop limit */ +#if defined(CONFIG_NET_NATIVE_IPV6) uint8_t net_if_ipv6_get_hop_limit(struct net_if *iface); +#else +static inline uint8_t net_if_ipv6_get_hop_limit(struct net_if *iface) +{ + ARG_UNUSED(iface); + + return 0; +} +#endif /* CONFIG_NET_NATIVE_IPV6 */ /** * @brief Set the default IPv6 hop limit of a given interface. @@ -1835,7 +1844,16 @@ uint8_t net_if_ipv6_get_hop_limit(struct net_if *iface); * @param iface Network interface * @param hop_limit New hop limit */ +#if defined(CONFIG_NET_NATIVE_IPV6) void net_if_ipv6_set_hop_limit(struct net_if *iface, uint8_t hop_limit); +#else +static inline void net_if_ipv6_set_hop_limit(struct net_if *iface, + uint8_t hop_limit) +{ + ARG_UNUSED(iface); + ARG_UNUSED(hop_limit); +} +#endif /* CONFIG_NET_NATIVE_IPV6 */ /** @cond INTERNAL_HIDDEN */ @@ -1860,7 +1878,16 @@ static inline void net_ipv6_set_hop_limit(struct net_if *iface, * * @return Hop limit */ +#if defined(CONFIG_NET_NATIVE_IPV6) uint8_t net_if_ipv6_get_mcast_hop_limit(struct net_if *iface); +#else +static inline uint8_t net_if_ipv6_get_mcast_hop_limit(struct net_if *iface) +{ + ARG_UNUSED(iface); + + return 0; +} +#endif /* CONFIG_NET_NATIVE_IPV6 */ /** * @brief Set the default IPv6 multicast hop limit of a given interface. @@ -1868,7 +1895,16 @@ uint8_t net_if_ipv6_get_mcast_hop_limit(struct net_if *iface); * @param iface Network interface * @param hop_limit New hop limit */ +#if defined(CONFIG_NET_NATIVE_IPV6) void net_if_ipv6_set_mcast_hop_limit(struct net_if *iface, uint8_t hop_limit); +#else +static inline void net_if_ipv6_set_mcast_hop_limit(struct net_if *iface, + uint8_t hop_limit) +{ + ARG_UNUSED(iface); + ARG_UNUSED(hop_limit); +} +#endif /* CONFIG_NET_NATIVE_IPV6 */ /** * @brief Set IPv6 reachable time for a given interface diff --git a/subsys/net/ip/net_context.c b/subsys/net/ip/net_context.c index af434e950f17a..e6a13874bdef4 100644 --- a/subsys/net/ip/net_context.c +++ b/subsys/net/ip/net_context.c @@ -2456,7 +2456,7 @@ enum net_verdict net_context_packet_received(struct net_conn *conn, return verdict; } -#if defined(CONFIG_NET_UDP) +#if defined(CONFIG_NET_NATIVE_UDP) static int recv_udp(struct net_context *context, net_context_recv_cb_t cb, k_timeout_t timeout, @@ -2538,7 +2538,7 @@ static int recv_udp(struct net_context *context, } #else #define recv_udp(...) 0 -#endif /* CONFIG_NET_UDP */ +#endif /* CONFIG_NET_NATIVE_UDP */ static enum net_verdict net_context_raw_packet_received( struct net_conn *conn, diff --git a/subsys/net/ip/net_core.c b/subsys/net/ip/net_core.c index 8ab2fb93a3c85..5259f9c6e6d70 100644 --- a/subsys/net/ip/net_core.c +++ b/subsys/net/ip/net_core.c @@ -60,6 +60,7 @@ LOG_MODULE_REGISTER(net_core, CONFIG_NET_CORE_LOG_LEVEL); #include "net_stats.h" +#if defined(CONFIG_NET_NATIVE) static inline enum net_verdict process_data(struct net_pkt *pkt, bool is_loopback) { @@ -188,22 +189,6 @@ static void net_post_init(void) #endif } -static void init_rx_queues(void) -{ - /* Starting TX side. The ordering is important here and the TX - * can only be started when RX side is ready to receive packets. - */ - net_if_init(); - - net_tc_rx_init(); - - /* This will take the interface up and start everything. */ - net_if_post_init(); - - /* Things to init after network interface is working */ - net_post_init(); -} - static inline void copy_ll_addr(struct net_pkt *pkt) { memcpy(net_pkt_lladdr_src(pkt), net_pkt_lladdr_if(pkt), @@ -571,6 +556,39 @@ static inline void l3_init(void) NET_DBG("Network L3 init done"); } +#else /* CONFIG_NET_NATIVE */ +#define l3_init(...) +#define net_post_init(...) +int net_send_data(struct net_pkt *pkt) +{ + ARG_UNUSED(pkt); + + return -ENOTSUP; +} +int net_recv_data(struct net_if *iface, struct net_pkt *pkt) +{ + ARG_UNUSED(iface); + ARG_UNUSED(pkt); + + return -ENOTSUP; +} +#endif /* CONFIG_NET_NATIVE */ + +static void init_rx_queues(void) +{ + /* Starting TX side. The ordering is important here and the TX + * can only be started when RX side is ready to receive packets. + */ + net_if_init(); + + net_tc_rx_init(); + + /* This will take the interface up and start everything. */ + net_if_post_init(); + + /* Things to init after network interface is working */ + net_post_init(); +} static inline int services_init(void) { diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c index 0d0248158f758..20f0c4e4994f1 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -174,6 +174,7 @@ struct net_if *z_vrfy_net_if_get_by_index(int index) #include #endif +#if defined(CONFIG_NET_NATIVE) static inline void net_context_send_cb(struct net_context *context, int status) { @@ -382,6 +383,7 @@ void net_if_queue_tx(struct net_if *iface, struct net_pkt *pkt) ; } } +#endif /* CONFIG_NET_NATIVE */ void net_if_stats_reset(struct net_if *iface) { @@ -445,6 +447,7 @@ static inline void init_iface(struct net_if *iface) net_ipv6_pe_init(iface); } +#if defined(CONFIG_NET_NATIVE) enum net_verdict net_if_send_data(struct net_if *iface, struct net_pkt *pkt) { const struct net_l2 *l2; @@ -551,6 +554,7 @@ enum net_verdict net_if_send_data(struct net_if *iface, struct net_pkt *pkt) return verdict; } +#endif /* CONFIG_NET_NATIVE */ int net_if_set_link_addr_locked(struct net_if *iface, uint8_t *addr, uint8_t len, diff --git a/subsys/net/ip/utils.c b/subsys/net/ip/utils.c index e8b6b99b073b2..f130a184bcb27 100644 --- a/subsys/net/ip/utils.c +++ b/subsys/net/ip/utils.c @@ -634,7 +634,7 @@ static inline uint16_t pkt_calc_chksum(struct net_pkt *pkt, uint16_t sum) return sum; } -#if defined(CONFIG_NET_IP) +#if defined(CONFIG_NET_NATIVE_IP) uint16_t net_calc_chksum(struct net_pkt *pkt, uint8_t proto) { size_t len = 0U; @@ -684,7 +684,7 @@ uint16_t net_calc_chksum(struct net_pkt *pkt, uint8_t proto) } #endif -#if defined(CONFIG_NET_IPV4) +#if defined(CONFIG_NET_NATIVE_IPV4) uint16_t net_calc_chksum_ipv4(struct net_pkt *pkt) { uint16_t sum; @@ -697,7 +697,7 @@ uint16_t net_calc_chksum_ipv4(struct net_pkt *pkt) return ~sum; } -#endif /* CONFIG_NET_IPV4 */ +#endif /* CONFIG_NET_NATIVE_IPV4 */ #if defined(CONFIG_NET_IPV4_IGMP) uint16_t net_calc_chksum_igmp(struct net_pkt *pkt) From bdbf7cc6209f1b8a4c9c4371b58dffd91f7a7f92 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 30 Sep 2024 11:54:12 +0200 Subject: [PATCH 0228/4482] net: offload: Do not need to enable TC threads for NET_OFFLOAD Net offloading doesn't need net TC threads to be enabled as they're used by the native stack. This fixes build if CONFIG_NET_OFFLOAD is enabled but native stack is disabled. Signed-off-by: Robert Lubos --- subsys/net/ip/CMakeLists.txt | 2 +- subsys/net/ip/net_private.h | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/subsys/net/ip/CMakeLists.txt b/subsys/net/ip/CMakeLists.txt index 11509d804d789..0189d748f6a77 100644 --- a/subsys/net/ip/CMakeLists.txt +++ b/subsys/net/ip/CMakeLists.txt @@ -19,7 +19,7 @@ zephyr_library_sources( ) if(CONFIG_NET_OFFLOAD) -zephyr_library_sources(net_context.c net_pkt.c net_tc.c) +zephyr_library_sources(net_context.c net_pkt.c) endif() zephyr_library_sources_ifdef(CONFIG_NET_MGMT_EVENT net_mgmt.c) diff --git a/subsys/net/ip/net_private.h b/subsys/net/ip/net_private.h index 0bbcbb231649e..04c3205f5aece 100644 --- a/subsys/net/ip/net_private.h +++ b/subsys/net/ip/net_private.h @@ -86,16 +86,12 @@ extern bool net_context_is_v6only_set(struct net_context *context); extern bool net_context_is_recv_pktinfo_set(struct net_context *context); extern bool net_context_is_timestamping_set(struct net_context *context); extern void net_pkt_init(void); -extern void net_tc_tx_init(void); -extern void net_tc_rx_init(void); int net_context_get_local_addr(struct net_context *context, struct sockaddr *addr, socklen_t *addrlen); #else static inline void net_context_init(void) { } static inline void net_pkt_init(void) { } -static inline void net_tc_tx_init(void) { } -static inline void net_tc_rx_init(void) { } static inline const char *net_context_state(struct net_context *context) { ARG_UNUSED(context); @@ -149,6 +145,8 @@ static inline void mdns_init_responder(void) { } #if defined(CONFIG_NET_NATIVE) enum net_verdict net_ipv4_input(struct net_pkt *pkt, bool is_loopback); enum net_verdict net_ipv6_input(struct net_pkt *pkt, bool is_loopback); +extern void net_tc_tx_init(void); +extern void net_tc_rx_init(void); #else static inline enum net_verdict net_ipv4_input(struct net_pkt *pkt, bool is_loopback) @@ -167,6 +165,9 @@ static inline enum net_verdict net_ipv6_input(struct net_pkt *pkt, return NET_CONTINUE; } + +static inline void net_tc_tx_init(void) { } +static inline void net_tc_rx_init(void) { } #endif extern bool net_tc_submit_to_tx_queue(uint8_t tc, struct net_pkt *pkt); extern void net_tc_submit_to_rx_queue(uint8_t tc, struct net_pkt *pkt); From 0c1550dd9fcfd8d17f128885db892b51cef06018 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 30 Sep 2024 16:23:37 +0200 Subject: [PATCH 0229/4482] net: sockets: Remove SET_ERRNO() macro Macros with flow control are discouraged and generate compliance error, hence remove it and replace the corresponding code with simple errno assignments. Signed-off-by: Robert Lubos --- subsys/net/lib/sockets/sockets_inet.c | 184 ++++++++++++++++++-------- 1 file changed, 130 insertions(+), 54 deletions(-) diff --git a/subsys/net/lib/sockets/sockets_inet.c b/subsys/net/lib/sockets/sockets_inet.c index 9403cdd152a44..4a51fd3f0dc98 100644 --- a/subsys/net/lib/sockets/sockets_inet.c +++ b/subsys/net/lib/sockets/sockets_inet.c @@ -34,9 +34,6 @@ LOG_MODULE_DECLARE(net_sock, CONFIG_NET_SOCKETS_LOG_LEVEL); #include "../../ip/tcp_internal.h" #include "../../ip/net_private.h" -#define SET_ERRNO(x) \ - { int _err = x; if (_err < 0) { errno = -_err; return -1; } } - const struct socket_op_vtable sock_fd_op_vtable; static void zsock_received_cb(struct net_context *ctx, @@ -141,6 +138,8 @@ static int zsock_socket_internal(int family, int type, int proto) int zsock_close_ctx(struct net_context *ctx) { + int ret; + /* Reset callbacks to avoid any race conditions while * flushing queues. No need to check return values here, * as these are fail-free operations and we're closing @@ -157,7 +156,11 @@ int zsock_close_ctx(struct net_context *ctx) zsock_flush_queue(ctx); - SET_ERRNO(net_context_put(ctx)); + ret = net_context_put(ctx); + if (ret < 0) { + errno = -ret; + return -1; + } return 0; } @@ -250,36 +253,61 @@ static void zsock_received_cb(struct net_context *ctx, int zsock_shutdown_ctx(struct net_context *ctx, int how) { + int ret; + if (how == ZSOCK_SHUT_RD) { if (net_context_get_state(ctx) == NET_CONTEXT_LISTENING) { - SET_ERRNO(net_context_accept(ctx, NULL, K_NO_WAIT, NULL)); + ret = net_context_accept(ctx, NULL, K_NO_WAIT, NULL); + if (ret < 0) { + errno = -ret; + return -1; + } } else { - SET_ERRNO(net_context_recv(ctx, NULL, K_NO_WAIT, NULL)); + ret = net_context_recv(ctx, NULL, K_NO_WAIT, NULL); + if (ret < 0) { + errno = -ret; + return -1; + } } sock_set_eof(ctx); zsock_flush_queue(ctx); - } else if (how == ZSOCK_SHUT_WR || how == ZSOCK_SHUT_RDWR) { - SET_ERRNO(-ENOTSUP); - } else { - SET_ERRNO(-EINVAL); + + return 0; } - return 0; + if (how == ZSOCK_SHUT_WR || how == ZSOCK_SHUT_RDWR) { + errno = ENOTSUP; + return -1; + } + + errno = EINVAL; + return -1; } int zsock_bind_ctx(struct net_context *ctx, const struct sockaddr *addr, socklen_t addrlen) { - SET_ERRNO(net_context_bind(ctx, addr, addrlen)); + int ret; + + ret = net_context_bind(ctx, addr, addrlen); + if (ret < 0) { + errno = -ret; + return -1; + } + /* For DGRAM socket, we expect to receive packets after call to * bind(), but for STREAM socket, next expected operation is * listen(), which doesn't work if recv callback is set. */ if (net_context_get_type(ctx) == SOCK_DGRAM) { - SET_ERRNO(net_context_recv(ctx, zsock_received_cb, K_NO_WAIT, - ctx->user_data)); + ret = net_context_recv(ctx, zsock_received_cb, K_NO_WAIT, + ctx->user_data); + if (ret < 0) { + errno = -ret; + return -1; + } } return 0; @@ -296,47 +324,75 @@ static void zsock_connected_cb(struct net_context *ctx, int status, void *user_d int zsock_connect_ctx(struct net_context *ctx, const struct sockaddr *addr, socklen_t addrlen) { + k_timeout_t timeout = K_MSEC(CONFIG_NET_SOCKETS_CONNECT_TIMEOUT); + net_context_connect_cb_t cb = NULL; + int ret; #if defined(CONFIG_SOCKS) if (net_context_is_proxy_enabled(ctx)) { - SET_ERRNO(net_socks5_connect(ctx, addr, addrlen)); - SET_ERRNO(net_context_recv(ctx, zsock_received_cb, - K_NO_WAIT, ctx->user_data)); + ret = net_socks5_connect(ctx, addr, addrlen); + if (ret < 0) { + errno = -ret; + return -1; + } + ret = net_context_recv(ctx, zsock_received_cb, + K_NO_WAIT, ctx->user_data); + if (ret < 0) { + errno = -ret; + return -1; + } return 0; } #endif if (net_context_get_state(ctx) == NET_CONTEXT_CONNECTED) { return 0; - } else if (net_context_get_state(ctx) == NET_CONTEXT_CONNECTING) { + } + + if (net_context_get_state(ctx) == NET_CONTEXT_CONNECTING) { if (sock_is_error(ctx)) { - SET_ERRNO(-POINTER_TO_INT(ctx->user_data)); - } else { - SET_ERRNO(-EALREADY); + errno = POINTER_TO_INT(ctx->user_data); + return -1; } - } else { - k_timeout_t timeout = K_MSEC(CONFIG_NET_SOCKETS_CONNECT_TIMEOUT); - net_context_connect_cb_t cb = NULL; - if (sock_is_nonblock(ctx)) { - timeout = K_NO_WAIT; - cb = zsock_connected_cb; - } + errno = EALREADY; + return -1; + } - if (net_context_get_type(ctx) == SOCK_STREAM) { - /* For STREAM sockets net_context_recv() only installs - * recv callback w/o side effects, and it has to be done - * first to avoid race condition, when TCP stream data - * arrives right after connect. - */ - SET_ERRNO(net_context_recv(ctx, zsock_received_cb, - K_NO_WAIT, ctx->user_data)); - SET_ERRNO(net_context_connect(ctx, addr, addrlen, cb, - timeout, ctx->user_data)); - } else { - SET_ERRNO(net_context_connect(ctx, addr, addrlen, cb, - timeout, ctx->user_data)); - SET_ERRNO(net_context_recv(ctx, zsock_received_cb, - K_NO_WAIT, ctx->user_data)); + if (sock_is_nonblock(ctx)) { + timeout = K_NO_WAIT; + cb = zsock_connected_cb; + } + + if (net_context_get_type(ctx) == SOCK_STREAM) { + /* For STREAM sockets net_context_recv() only installs + * recv callback w/o side effects, and it has to be done + * first to avoid race condition, when TCP stream data + * arrives right after connect. + */ + ret = net_context_recv(ctx, zsock_received_cb, + K_NO_WAIT, ctx->user_data); + if (ret < 0) { + errno = -ret; + return -1; + } + ret = net_context_connect(ctx, addr, addrlen, cb, + timeout, ctx->user_data); + if (ret < 0) { + errno = -ret; + return -1; + } + } else { + ret = net_context_connect(ctx, addr, addrlen, cb, + timeout, ctx->user_data); + if (ret < 0) { + errno = -ret; + return -1; + } + ret = net_context_recv(ctx, zsock_received_cb, + K_NO_WAIT, ctx->user_data); + if (ret < 0) { + errno = -ret; + return -1; } } @@ -345,8 +401,19 @@ int zsock_connect_ctx(struct net_context *ctx, const struct sockaddr *addr, int zsock_listen_ctx(struct net_context *ctx, int backlog) { - SET_ERRNO(net_context_listen(ctx, backlog)); - SET_ERRNO(net_context_accept(ctx, zsock_accepted_cb, K_NO_WAIT, ctx)); + int ret; + + ret = net_context_listen(ctx, backlog); + if (ret < 0) { + errno = -ret; + return -1; + } + + ret = net_context_accept(ctx, zsock_accepted_cb, K_NO_WAIT, ctx); + if (ret < 0) { + errno = -ret; + return -1; + } return 0; } @@ -2460,16 +2527,19 @@ int zsock_getpeername_ctx(struct net_context *ctx, struct sockaddr *addr, socklen_t newlen = 0; if (addr == NULL || addrlen == NULL) { - SET_ERRNO(-EINVAL); + errno = EINVAL; + return -1; } if (!(ctx->flags & NET_CONTEXT_REMOTE_ADDR_SET)) { - SET_ERRNO(-ENOTCONN); + errno = ENOTCONN; + return -1; } if (net_context_get_type(ctx) == SOCK_STREAM && net_context_get_state(ctx) != NET_CONTEXT_CONNECTED) { - SET_ERRNO(-ENOTCONN); + errno = ENOTCONN; + return -1; } if (IS_ENABLED(CONFIG_NET_IPV4) && ctx->remote.sa_family == AF_INET) { @@ -2494,7 +2564,8 @@ int zsock_getpeername_ctx(struct net_context *ctx, struct sockaddr *addr, memcpy(addr, &addr6, MIN(*addrlen, newlen)); } else { - SET_ERRNO(-EINVAL); + errno = EINVAL; + return -1; } *addrlen = newlen; @@ -2512,7 +2583,8 @@ int zsock_getsockname_ctx(struct net_context *ctx, struct sockaddr *addr, struct sockaddr_in addr4 = { 0 }; if (net_sin_ptr(&ctx->local)->sin_addr == NULL) { - SET_ERRNO(-EINVAL); + errno = EINVAL; + return -1; } newlen = sizeof(struct sockaddr_in); @@ -2521,7 +2593,8 @@ int zsock_getsockname_ctx(struct net_context *ctx, struct sockaddr *addr, (struct sockaddr *)&addr4, &newlen); if (ret < 0) { - SET_ERRNO(-ret); + errno = -ret; + return -1; } memcpy(addr, &addr4, MIN(*addrlen, newlen)); @@ -2530,7 +2603,8 @@ int zsock_getsockname_ctx(struct net_context *ctx, struct sockaddr *addr, struct sockaddr_in6 addr6 = { 0 }; if (net_sin6_ptr(&ctx->local)->sin6_addr == NULL) { - SET_ERRNO(-EINVAL); + errno = EINVAL; + return -1; } newlen = sizeof(struct sockaddr_in6); @@ -2539,12 +2613,14 @@ int zsock_getsockname_ctx(struct net_context *ctx, struct sockaddr *addr, (struct sockaddr *)&addr6, &newlen); if (ret < 0) { - SET_ERRNO(-ret); + errno = -ret; + return -1; } memcpy(addr, &addr6, MIN(*addrlen, newlen)); } else { - SET_ERRNO(-EINVAL); + errno = EINVAL; + return -1; } *addrlen = newlen; From f57e78de2a53f4c9a650b4680bbfccfd1cfb3b15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Fri, 27 Sep 2024 12:17:46 +0200 Subject: [PATCH 0230/4482] drivers: udc_dwc2: Suspend if connected to suspended bus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Peripherals are required to support the suspend state whenever VBUS is powered, even if bus reset has not occurred (Mandate: Required, Effective Date: February, 2010). Remove the stale suspend check that essentially prevented the device from hibernating when connected to already suspended bus. Signed-off-by: Tomasz Moń --- drivers/usb/udc/udc_dwc2.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 0283b4a1b71b1..91cbaba8f5384 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -2727,11 +2727,6 @@ static void udc_dwc2_isr_handler(const struct device *dev) /* Clear USB Suspend interrupt. */ sys_write32(USB_DWC2_GINTSTS_USBSUSP, gintsts_reg); - if (!priv->enumdone) { - /* Ignore stale suspend interrupt */ - continue; - } - /* Notify the stack */ udc_set_suspended(dev, true); udc_submit_event(dev, UDC_EVT_SUSPEND, 0); From 508bd3edef06c43e1eb525062ff0474d87a5e91e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Mon, 30 Sep 2024 08:54:11 +0200 Subject: [PATCH 0231/4482] drivers: udc_dwc2: Change hibernation exit on bus reset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adhere to programming guide steps on Hibernation Exit on Host Initiated Reset. Signed-off-by: Tomasz Moń --- drivers/usb/udc/udc_dwc2.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 91cbaba8f5384..917910ad26d6d 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -904,7 +904,7 @@ static void dwc2_backup_registers(const struct device *dev) } static void dwc2_restore_essential_registers(const struct device *dev, - bool rwup) + bool rwup, bool bus_reset) { const struct udc_dwc2_config *const config = dev->config; struct usb_dwc2_reg *const base = config->base; @@ -925,6 +925,10 @@ static void dwc2_restore_essential_registers(const struct device *dev, sys_write32(backup->gusbcfg, (mem_addr_t)&base->gusbcfg); sys_write32(backup->dcfg, (mem_addr_t)&base->dcfg); + if (bus_reset) { + sys_write32(backup->dcfg, (mem_addr_t)&base->dcfg); + } + if (!rwup) { pcgcctl |= USB_DWC2_PCGCCTL_RESTOREMODE | USB_DWC2_PCGCCTL_RSTPDWNMODULE; } @@ -1026,7 +1030,8 @@ static void dwc2_enter_hibernation(const struct device *dev) LOG_DBG("Hibernated"); } -static void dwc2_exit_hibernation(const struct device *dev, bool rwup) +static void dwc2_exit_hibernation(const struct device *dev, + bool rwup, bool bus_reset) { const struct udc_dwc2_config *const config = dev->config; struct usb_dwc2_reg *const base = config->base; @@ -1066,13 +1071,15 @@ static void dwc2_exit_hibernation(const struct device *dev, bool rwup) /* Disable PMU interrupt */ sys_clear_bits(gpwrdn_reg, USB_DWC2_GPWRDN_PMUINTSEL); - dwc2_restore_essential_registers(dev, rwup); + dwc2_restore_essential_registers(dev, rwup, bus_reset); /* Note: in Remote Wakeup case 15 ms max signaling time starts now */ /* Wait for Restore Done Interrupt */ dwc2_wait_for_bit(dev, (mem_addr_t)&base->gintsts, USB_DWC2_GINTSTS_RSTRDONEINT); - sys_write32(0xFFFFFFFFUL, (mem_addr_t)&base->gintsts); + if (!bus_reset) { + sys_write32(0xFFFFFFFFUL, (mem_addr_t)&base->gintsts); + } /* Disable restore from PMU */ sys_clear_bits(gpwrdn_reg, USB_DWC2_GPWRDN_RESTORE); @@ -2027,7 +2034,7 @@ static int udc_dwc2_disable(const struct device *dev) config->irq_disable_func(dev); if (priv->hibernated) { - dwc2_exit_hibernation(dev, false); + dwc2_exit_hibernation(dev, false, true); priv->hibernated = 0; } @@ -2744,7 +2751,7 @@ static void dwc2_handle_hibernation_exit(const struct device *dev, struct usb_dwc2_reg *const base = dwc2_get_base(dev); struct udc_dwc2_data *const priv = udc_get_private(dev); - dwc2_exit_hibernation(dev, rwup); + dwc2_exit_hibernation(dev, rwup, bus_reset); dwc2_restore_device_registers(dev, rwup); priv->hibernated = 0; From d224fa130e882ec19002fb29803eb8d7f3662b46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Tue, 1 Oct 2024 11:33:55 +0200 Subject: [PATCH 0232/4482] doc: _scripts: gen_devicetree_rest: add link to driver sources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When generating the documentation pages for the devicetree bindings, add a link to the .c file implementing the corresponding driver, or folder likely to contain the driver implementation, using heuristics to determine the most likely location of the driver sources. Signed-off-by: Benjamin Cabé --- doc/_scripts/gen_devicetree_rest.py | 79 ++++++++++++++++++++++++++--- 1 file changed, 73 insertions(+), 6 deletions(-) diff --git a/doc/_scripts/gen_devicetree_rest.py b/doc/_scripts/gen_devicetree_rest.py index 4637aca7ae9d1..f29f040380103 100644 --- a/doc/_scripts/gen_devicetree_rest.py +++ b/doc/_scripts/gen_devicetree_rest.py @@ -165,8 +165,9 @@ def main(): setup_logging(args.verbose) bindings = load_bindings(args.dts_roots, args.dts_folders) base_binding = load_base_binding() + driver_sources = load_driver_sources() vnd_lookup = VndLookup(args.vendor_prefixes, bindings) - dump_content(bindings, base_binding, vnd_lookup, args.out_dir, + dump_content(bindings, base_binding, vnd_lookup, driver_sources, args.out_dir, args.turbo_mode) def parse_args(): @@ -243,7 +244,60 @@ def load_base_binding(): return edtlib.Binding(os.fspath(base_yaml), base_includes, require_compatible=False, require_description=False) -def dump_content(bindings, base_binding, vnd_lookup, out_dir, turbo_mode): +def load_driver_sources(): + driver_sources = {} + dt_drv_compat_occurrences = defaultdict(list) + + dt_drv_compat_pattern = re.compile(r"#define DT_DRV_COMPAT\s+(.*)") + device_dt_inst_define_pattern = re.compile(r"DEVICE_DT_INST_DEFINE") + + folders_to_scan = ["boards", "drivers", "modules", "soc", "subsys"] + + # When looking at folders_to_scan, a file is considered as a likely driver source if: + # - There is only one and only one file with a "#define DT_DRV_COMPAT " for a given + # compatible. + # - or, a file contains both a "#define DT_DRV_COMPAT " and a + # DEVICE_DT_INST_DEFINE(...) call. + + for folder in folders_to_scan: + for dirpath, _, filenames in os.walk(ZEPHYR_BASE / folder): + for filename in filenames: + if not filename.endswith(('.c', '.h')): + continue + filepath = Path(dirpath) / filename + with open(filepath, "r", encoding="utf-8") as f: + content = f.read() + + relative_path = filepath.relative_to(ZEPHYR_BASE) + + # Find all DT_DRV_COMPAT occurrences in the file + dt_drv_compat_matches = dt_drv_compat_pattern.findall(content) + for compatible in dt_drv_compat_matches: + dt_drv_compat_occurrences[compatible].append(relative_path) + + if dt_drv_compat_matches and device_dt_inst_define_pattern.search(content): + for compatible in dt_drv_compat_matches: + if compatible in driver_sources: + # Mark as ambiguous if multiple files define the same compatible + driver_sources[compatible] = None + else: + driver_sources[compatible] = relative_path + + # Remove ambiguous driver sources + driver_sources = {k: v for k, v in driver_sources.items() if v is not None} + + # Consider DT_DRV_COMPATs with only one occurrence as driver sources + for compatible, occurrences in dt_drv_compat_occurrences.items(): + if compatible not in driver_sources and len(occurrences) == 1: + path = occurrences[0] + # Assume the driver is defined in the enclosing folder if it's a header file + if path.suffix == ".h": + path = path.parent + driver_sources[compatible] = path + + return driver_sources + +def dump_content(bindings, base_binding, vnd_lookup, driver_sources, out_dir, turbo_mode): # Dump the generated .rst files for a vnd2bindings dict. # Files are only written if they are changed. Existing .rst # files which would not be written by the 'vnd2bindings' @@ -256,7 +310,7 @@ def dump_content(bindings, base_binding, vnd_lookup, out_dir, turbo_mode): write_dummy_index(bindings, out_dir) else: write_bindings_rst(vnd_lookup, out_dir) - write_orphans(bindings, base_binding, vnd_lookup, out_dir) + write_orphans(bindings, base_binding, vnd_lookup, driver_sources, out_dir) def setup_bindings_dir(bindings, out_dir): # Make a set of all the Path objects we will be creating for @@ -382,7 +436,7 @@ def write_bindings_rst(vnd_lookup, out_dir): write_if_updated(out_dir / 'bindings.rst', string_io.getvalue()) -def write_orphans(bindings, base_binding, vnd_lookup, out_dir): +def write_orphans(bindings, base_binding, vnd_lookup, driver_sources, out_dir): # Write out_dir / bindings / foo / binding_page.rst for each binding # in 'bindings', along with any "disambiguation" pages needed when a # single compatible string can be handled by multiple bindings. @@ -415,7 +469,7 @@ def write_orphans(bindings, base_binding, vnd_lookup, out_dir): string_io = io.StringIO() print_binding_page(binding, base_names, vnd_lookup, - dup_compat2bindings, string_io) + driver_sources, dup_compat2bindings, string_io) written = write_if_updated(out_dir / 'bindings' / binding_filename(binding), @@ -443,7 +497,7 @@ def write_orphans(bindings, base_binding, vnd_lookup, out_dir): logging.info('done writing :orphan: files; %d files needed updates', num_written) -def print_binding_page(binding, base_names, vnd_lookup, dup_compats, +def print_binding_page(binding, base_names, vnd_lookup, driver_sources,dup_compats, string_io): # Print the rst content for 'binding' to 'string_io'. The # 'dup_compats' argument should support membership testing for @@ -500,6 +554,19 @@ def print_binding_page(binding, base_names, vnd_lookup, dup_compats, f':ref:`{vnd_lookup.vendor(vnd)} <{vnd_lookup.target(vnd)}>`\n', file=string_io) + # Link to driver implementation (if it exists). + compatible = re.sub("[-,.@/+]", "_", compatible.lower()) + if compatible in driver_sources: + print_block( + f"""\ + .. note:: + + An implementation of a driver matching this compatible is available in + :zephyr_file:`{driver_sources[compatible]}`. + """, + string_io, + ) + # Binding description. if binding.bus: bus_help = f'These nodes are "{binding.bus}" bus nodes.' From 871aab7c450c17ae425beb7d60c2d6ec1c450ec0 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Tue, 1 Oct 2024 13:26:30 +0300 Subject: [PATCH 0233/4482] tests: lwm2m: Fix minor timing issues on tests * Wait for update when new object is created Sometimes our blockwise transfer starts before server have received an LwM2M Update. This causes Leshan to reject the SEND because is was not aware of object /19/0 * Wait "registered" message already in conftest.py. Sometimes Qemu boots faster, and the testcase don't see the log. Signed-off-by: Seppo Takalo --- tests/net/lib/lwm2m/interop/pytest/test_blockwise.py | 5 +++++ tests/net/lib/lwm2m/interop/pytest/test_nosec.py | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/net/lib/lwm2m/interop/pytest/test_blockwise.py b/tests/net/lib/lwm2m/interop/pytest/test_blockwise.py index 27bece69f1e31..f72ab7e05cf46 100644 --- a/tests/net/lib/lwm2m/interop/pytest/test_blockwise.py +++ b/tests/net/lib/lwm2m/interop/pytest/test_blockwise.py @@ -79,6 +79,8 @@ def test_blockwise_3(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: """Blockwise test 3: Block-Wise Get using TLV and SenML-CBOR content formats""" shell.exec_command('lwm2m create /19/0') + # Wait for update to finish so server is aware of the /19/0 object + dut.readlines_until(regex='.*net_lwm2m_rd_client: Update Done', timeout=5.0) # Generate 4 kB of binary app-data # and write it into BinaryAppData object @@ -109,6 +111,9 @@ def test_blockwise_4(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: """Blockwise test 4: Block-Wise SEND using SenML-CBOR content format""" shell.exec_command('lwm2m create /19/0') + # Wait for update to finish so server is aware of the /19/0 object + dut.readlines_until(regex='.*net_lwm2m_rd_client: Update Done', timeout=5.0) + # Generate 4 kB of binary app-data data = ''.join(random.choice(string.ascii_letters) for i in range(4096)).encode() fmt = leshan.format diff --git a/tests/net/lib/lwm2m/interop/pytest/test_nosec.py b/tests/net/lib/lwm2m/interop/pytest/test_nosec.py index 15ac98f2d1a7d..6411efa075578 100644 --- a/tests/net/lib/lwm2m/interop/pytest/test_nosec.py +++ b/tests/net/lib/lwm2m/interop/pytest/test_nosec.py @@ -26,11 +26,8 @@ def test_LightweightM2M_1_1_int_101(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint_nosec: str): """ Verify that the client is registered. - Note that this MUST be the first testcase executed, otherwise it will fail to get the - correct log output. """ logger.info("LightweightM2M-1.1-int-101 - Initial Registration") - dut.readlines_until(regex='.*Registration Done', timeout=5.0) assert leshan.get(f'/clients/{endpoint_nosec}') def test_LightweightM2M_1_1_int_105(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint_nosec: str, helperclient: object): From 77e09916f7619ce4793e60b979ba8a20386eba9a Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Tue, 1 Oct 2024 13:48:24 +0300 Subject: [PATCH 0234/4482] tests: lwm2m: Remove qemu-cortex-m3 This board just don't have enough RAM for all tests so it is just a maintenance headache without any benefits. Signed-off-by: Seppo Takalo --- .../lwm2m/interop/boards/qemu_cortex_m3.conf | 18 ------------------ tests/net/lib/lwm2m/interop/testcase.yaml | 1 - 2 files changed, 19 deletions(-) delete mode 100644 tests/net/lib/lwm2m/interop/boards/qemu_cortex_m3.conf diff --git a/tests/net/lib/lwm2m/interop/boards/qemu_cortex_m3.conf b/tests/net/lib/lwm2m/interop/boards/qemu_cortex_m3.conf deleted file mode 100644 index 44263f885a437..0000000000000 --- a/tests/net/lib/lwm2m/interop/boards/qemu_cortex_m3.conf +++ /dev/null @@ -1,18 +0,0 @@ -CONFIG_NET_L2_ETHERNET=y -CONFIG_ETH_DRIVER=y -CONFIG_ETH_STELLARIS=y -CONFIG_NET_QEMU_ETHERNET=y - -# RAM/ROM tuning -CONFIG_IDLE_STACK_SIZE=128 -CONFIG_ISR_STACK_SIZE=512 -CONFIG_LWM2M_LOG_LEVEL_INF=y -CONFIG_LOG_BUFFER_SIZE=512 - -# qemu_cortex_m3 have smaller memory so simulate a small -# device and small network where max CoAP packet is 256+headers. -# This excercises the outgoing block-wise module intentionally. -CONFIG_LWM2M_COAP_MAX_MSG_SIZE=256 -CONFIG_LWM2M_COAP_BLOCK_SIZE=256 -CONFIG_LWM2M_COAP_BLOCK_TRANSFER=y -CONFIG_LWM2M_COAP_ENCODE_BUFFER_SIZE=2048 diff --git a/tests/net/lib/lwm2m/interop/testcase.yaml b/tests/net/lib/lwm2m/interop/testcase.yaml index 46a7eee055b84..19ad11d9fb78e 100644 --- a/tests/net/lib/lwm2m/interop/testcase.yaml +++ b/tests/net/lib/lwm2m/interop/testcase.yaml @@ -9,7 +9,6 @@ tests: - native_sim platform_allow: - native_sim - - qemu_cortex_m3 - qemu_x86 tags: - testing From 205a99f97fa1e4fd311d37ead6f04fc3aaaff13c Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Tue, 1 Oct 2024 13:58:20 +0200 Subject: [PATCH 0235/4482] doc: migration-guide: Add LE Audio entry for dynamic TBS The TBS and GTBS shall now be registered at runtime and can no longer be registered statically. This requires a change in the applications using this. Signed-off-by: Emil Gydesen --- doc/releases/migration-guide-4.0.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index d23b208ed9c4b..7044aac712a58 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -312,6 +312,11 @@ Bluetooth Audio to use these new APIs. (:github:`78751`) +* The Telephone Bearer Service (TBS) and Generic Telephone Bearer Service (GTBS) shall now be + registered dynamically at runtime with :c:func:`bt_tbs_register_bearer`. The services can also be + unregistered with :c:func:`bt_tbs_unregister_bearer`. + (:github:`76108`) + Bluetooth Classic ================= From 8c0026a6a695898b7923119314bf60695130ffec Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Tue, 1 Oct 2024 14:46:28 +0200 Subject: [PATCH 0236/4482] boards: st: nucleo_h7 boards correct LD2 on PE1 pin The stm32h7 nucleo 144 boards (ref MB1364) have the LD2 on PE1 pin (not PB7). This commit change this in the doc. Board DTS are correct. Signed-off-by: Francois Ramu --- boards/st/nucleo_h723zg/doc/index.rst | 4 ++-- boards/st/nucleo_h743zi/doc/index.rst | 2 +- boards/st/nucleo_h745zi_q/doc/index.rst | 2 +- boards/st/nucleo_h753zi/doc/index.rst | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/boards/st/nucleo_h723zg/doc/index.rst b/boards/st/nucleo_h723zg/doc/index.rst index 5e97327386d6c..06675941e7c6b 100644 --- a/boards/st/nucleo_h723zg/doc/index.rst +++ b/boards/st/nucleo_h723zg/doc/index.rst @@ -136,10 +136,10 @@ and a ST morpho connector. Board is configured as follows: - UART_3 TX/RX : PD8/PD9 (ST-Link Virtual Port Com) - USER_PB : PC13 - LD1 : PB0 -- LD2 : PB7 +- LD2 : PE1 - LD3 : PB14 - I2C : PB8, PB9 -- SPI1 NSS/SCK/MISO/MOSI : PD14PA5/PA6/PB5 (Arduino SPI) +- SPI1 NSS/SCK/MISO/MOSI : PD14/PA5/PA6/PB5 (Arduino SPI) - FDCAN1 RX/TX : PD0, PD1 System Clock diff --git a/boards/st/nucleo_h743zi/doc/index.rst b/boards/st/nucleo_h743zi/doc/index.rst index 2a790927bfc1b..ac6674873b7b3 100644 --- a/boards/st/nucleo_h743zi/doc/index.rst +++ b/boards/st/nucleo_h743zi/doc/index.rst @@ -148,7 +148,7 @@ and a ST morpho connector. Board is configured as follows: - UART_3 TX/RX : PD8/PD9 (ST-Link Virtual Port Com) - USER_PB : PC13 - LD1 : PB0 -- LD2 : PB7 +- LD2 : PE1 - LD3 : PB14 - I2C : PB8, PB9 - ADC1_INP15 : PA3 diff --git a/boards/st/nucleo_h745zi_q/doc/index.rst b/boards/st/nucleo_h745zi_q/doc/index.rst index c0e5d3db72216..194e4b92f47ba 100644 --- a/boards/st/nucleo_h745zi_q/doc/index.rst +++ b/boards/st/nucleo_h745zi_q/doc/index.rst @@ -137,7 +137,7 @@ and a ST morpho connector. Board is configured as follows: - UART_3 TX/RX : PD8/PD9 (ST-Link Virtual Port Com) - USER_PB : PC13 - LD1 : PB0 -- LD2 : PB7 +- LD2 : PE1 - LD3 : PB14 - I2C : PB8, PB9 - SPI : PA5, PA6, PB5, PD14 diff --git a/boards/st/nucleo_h753zi/doc/index.rst b/boards/st/nucleo_h753zi/doc/index.rst index e9af66a323260..37282dbbd8dae 100644 --- a/boards/st/nucleo_h753zi/doc/index.rst +++ b/boards/st/nucleo_h753zi/doc/index.rst @@ -140,12 +140,12 @@ and a ST morpho connector. Board is configured as follows: - UART_3 TX/RX : PD8/PD9 (ST-Link Virtual Port Com) - USER_PB : PC13 - LD1 : PB0 -- LD2 : PB7 +- LD2 : PE1 - LD3 : PB14 - I2C : PB8, PB9 - ADC1_INP15 : PA3 - ETH : PA1, PA2, PA7, PB13, PC1, PC4, PC5, PG11, PG13 -- SPI1 NSS/SCK/MISO/MOSI : PD14PA5/PA6/PB5 (Arduino SPI) +- SPI1 NSS/SCK/MISO/MOSI : PD14/PA5/PA6/PB5 (Arduino SPI) - CAN/CANFD : PD0, PD1 System Clock From 73a3438b8204a61211b5f78786799a8e6ba77afa Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Tue, 1 Oct 2024 15:24:02 +0300 Subject: [PATCH 0237/4482] net: lwm2m: Remove hostname_verify flag from context Use security mode (PSK or X509) to detect if we should set the socket option to verify hostname. PSK security mode cannot verify hostnames as this information is coming in the certificate, so don't set the options. Signed-off-by: Seppo Takalo --- include/zephyr/net/lwm2m.h | 2 -- subsys/net/lib/lwm2m/lwm2m_engine.c | 2 +- subsys/net/lib/lwm2m/lwm2m_message_handling.c | 1 - tests/net/lib/lwm2m/lwm2m_engine/src/main.c | 9 +++------ 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/include/zephyr/net/lwm2m.h b/include/zephyr/net/lwm2m.h index d69e508c8f36c..8a2cbf557d0d4 100644 --- a/include/zephyr/net/lwm2m.h +++ b/include/zephyr/net/lwm2m.h @@ -245,8 +245,6 @@ struct lwm2m_ctx { char *desthostname; /** Destination hostname length */ uint16_t desthostnamelen; - /** Flag to indicate if hostname verification is enabled */ - bool hostname_verify; /** Custom load_credentials function. * Client can set load_credentials function as a way of overriding diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index 03d978fb913fa..833b72217f10c 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -1070,7 +1070,7 @@ int lwm2m_set_default_sockopt(struct lwm2m_ctx *ctx) } } - if (ctx->hostname_verify && (ctx->desthostname != NULL)) { + if (ctx->desthostname != NULL && lwm2m_security_mode(ctx) == LWM2M_SECURITY_CERT) { /** store character at len position */ tmp = ctx->desthostname[ctx->desthostnamelen]; diff --git a/subsys/net/lib/lwm2m/lwm2m_message_handling.c b/subsys/net/lib/lwm2m/lwm2m_message_handling.c index 0b5750107cd3a..ac765aa0fc671 100644 --- a/subsys/net/lib/lwm2m/lwm2m_message_handling.c +++ b/subsys/net/lib/lwm2m/lwm2m_message_handling.c @@ -3324,7 +3324,6 @@ int lwm2m_parse_peerinfo(char *url, struct lwm2m_ctx *client_ctx, bool is_firmwa /** copy url pointer to be used in socket */ client_ctx->desthostname = url + off; client_ctx->desthostnamelen = len; - client_ctx->hostname_verify = true; #endif #else diff --git a/tests/net/lib/lwm2m/lwm2m_engine/src/main.c b/tests/net/lib/lwm2m/lwm2m_engine/src/main.c index d982f3aecae91..fc1f8dea2de76 100644 --- a/tests/net/lib/lwm2m/lwm2m_engine/src/main.c +++ b/tests/net/lib/lwm2m/lwm2m_engine/src/main.c @@ -105,7 +105,6 @@ ZTEST(lwm2m_engine, test_start_stop) ctx.load_credentials = NULL; ctx.desthostname = host_name; ctx.desthostnamelen = strlen(host_name); - ctx.hostname_verify = true; ctx.use_dtls = true; ret = lwm2m_engine_start(&ctx); @@ -436,7 +435,6 @@ ZTEST(lwm2m_engine, test_security) ctx.load_credentials = NULL; ctx.desthostname = host_name; ctx.desthostnamelen = strlen(host_name); - ctx.hostname_verify = true; ctx.use_dtls = false; lwm2m_security_mode_fake.return_val = LWM2M_SECURITY_NOSEC; @@ -452,9 +450,8 @@ ZTEST(lwm2m_engine, test_security) lwm2m_security_mode_fake.return_val = LWM2M_SECURITY_PSK; zassert_equal(lwm2m_engine_start(&ctx), 0); zassert_equal(z_impl_zsock_setsockopt_fake.arg2_history[0], TLS_SEC_TAG_LIST); - zassert_equal(z_impl_zsock_setsockopt_fake.arg2_history[1], TLS_HOSTNAME); - zassert_equal(z_impl_zsock_setsockopt_fake.arg2_history[2], TLS_PEER_VERIFY); - zassert_equal(z_impl_zsock_setsockopt_fake.arg2_history[3], TLS_CIPHERSUITE_LIST); + zassert_equal(z_impl_zsock_setsockopt_fake.arg2_history[1], TLS_PEER_VERIFY); + zassert_equal(z_impl_zsock_setsockopt_fake.arg2_history[2], TLS_CIPHERSUITE_LIST); zassert_true(tls_credential_delete_fake.call_count > 3); zassert_true(tls_credential_add_fake.call_count == 2); zassert_equal(tls_credential_add_fake.arg1_history[0], TLS_CREDENTIAL_PSK_ID); @@ -464,7 +461,7 @@ ZTEST(lwm2m_engine, test_security) RESET_FAKE(z_impl_zsock_setsockopt); RESET_FAKE(tls_credential_add); lwm2m_security_mode_fake.return_val = LWM2M_SECURITY_CERT; - ctx.hostname_verify = false; + ctx.desthostname = NULL; zassert_equal(lwm2m_engine_start(&ctx), 0); zassert_equal(z_impl_zsock_setsockopt_fake.arg2_history[0], TLS_SEC_TAG_LIST); zassert_equal(z_impl_zsock_setsockopt_fake.arg2_history[1], TLS_PEER_VERIFY); From 5275d4440953265ff793b0030c03f04fa21a76ab Mon Sep 17 00:00:00 2001 From: Eric Ackermann Date: Thu, 19 Sep 2024 09:35:49 +0200 Subject: [PATCH 0238/4482] llext: Add RISC-V arch-specific relocations This commit introduces architecture-specific ELF relocations for RISC-V, in accordance with the RISC-V PSABI specification: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc Also, the necessary compiler configurations for compiling LLEXT extensions on RISC-V are added, and the llext tests are executed on RISC-V targets. Calling llext extensions from user threads in RISC-V is still unsupported as of this commit. Signed-off-by: Eric Ackermann --- arch/riscv/core/CMakeLists.txt | 1 + arch/riscv/core/elf.c | 373 ++++++++++++++++++ cmake/compiler/gcc/target_riscv.cmake | 20 + doc/services/llext/index.rst | 2 +- include/zephyr/arch/riscv/elf.h | 298 ++++++++++++++ subsys/llext/CMakeLists.txt | 4 + subsys/llext/Kconfig | 4 +- subsys/llext/llext_load.c | 8 + tests/subsys/llext/simple/CMakeLists.txt | 2 +- .../llext/simple/src/test_llext_simple.c | 6 + tests/subsys/llext/simple/testcase.yaml | 22 +- 11 files changed, 729 insertions(+), 11 deletions(-) create mode 100644 arch/riscv/core/elf.c create mode 100644 include/zephyr/arch/riscv/elf.h diff --git a/arch/riscv/core/CMakeLists.txt b/arch/riscv/core/CMakeLists.txt index 3e97d36d7f88c..a15e1ba7f9fc1 100644 --- a/arch/riscv/core/CMakeLists.txt +++ b/arch/riscv/core/CMakeLists.txt @@ -27,3 +27,4 @@ zephyr_library_sources_ifdef(CONFIG_USERSPACE userspace.S) zephyr_library_sources_ifdef(CONFIG_SEMIHOST semihost.c) zephyr_library_sources_ifdef(CONFIG_ARCH_STACKWALK stacktrace.c) zephyr_linker_sources(ROM_START SORT_KEY 0x0vectors vector_table.ld) +zephyr_library_sources_ifdef(CONFIG_LLEXT elf.c) diff --git a/arch/riscv/core/elf.c b/arch/riscv/core/elf.c new file mode 100644 index 0000000000000..4f981083b946b --- /dev/null +++ b/arch/riscv/core/elf.c @@ -0,0 +1,373 @@ +/** @file + * @brief Architecture-specific relocations for RISC-V instruction sets. + */ +/* + * Copyright (c) 2024 CISPA Helmholtz Center for Information Security gGmbH + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include +#include +#include + +#include + +#include + +LOG_MODULE_REGISTER(elf, CONFIG_LLEXT_LOG_LEVEL); + +/* + * RISC-V relocations commonly use pairs of U-type and I-type instructions. + * U-type instructions have 20-bit immediates, I-type instructions have 12-bit immediates. + * Immediates in RISC-V are always sign-extended. + * Thereby, this type of relocation can reach any address within a 2^31-1 byte range. + */ +#define RISCV_MAX_JUMP_DISTANCE_U_PLUS_I_TYPE INT32_MAX + +/* S-type has 12-bit signed immediate */ +#define RISCV_MAX_JUMP_DISTANCE_S_TYPE ((1 << 11) - 1) + +/* I-type has 12-bit signed immediate also */ +#define RISCV_MAX_JUMP_DISTANCE_I_TYPE ((1 << 11) - 1) + +/* B-type has 13-bit signed immediate */ +#define RISCV_MAX_JUMP_DISTANCE_B_TYPE ((1 << 12) - 1) + +/* CB-type has 9-bit signed immediate */ +#define RISCV_MAX_JUMP_DISTANCE_CB_TYPE ((1 << 8) - 1) + +/* CJ-type has 12-bit signed immediate (last bit implicit 0) */ +#define RISCV_MAX_JUMP_DISTANCE_CJ_TYPE ((1 << 11) - 1) + +static inline int riscv_relocation_fits(long long jump_target, long long max_distance, + elf_word reloc_type) +{ + if (llabs(jump_target) > max_distance) { + LOG_ERR("%lld byte relocation is not possible for type %" PRIu64 " (max %lld)!", + jump_target, (uint64_t)reloc_type, max_distance); + return -ENOEXEC; /* jump too far */ + } + + return 0; +} + +static long long last_u_type_jump_target; + +/** + * @brief RISC-V specific function for relocating partially linked ELF binaries + * + * This implementation follows the official RISC-V specification: + * https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc + * + */ +int arch_elf_relocate(elf_rela_t *rel, uintptr_t loc_unsigned, uintptr_t sym_base_addr_unsigned, + const char *sym_name, uintptr_t load_bias) +{ + /* FIXME currently, RISC-V relocations all fit in ELF_32_R_TYPE */ + elf_word reloc_type = ELF32_R_TYPE(rel->r_info); + /* + * The RISC-V specification uses the following symbolic names for the relocations: + * + * A - addend (rel->r_addend) + * B - base address (load_bias) + * G - global offset table (not supported yet) + * P - position of the relocation (loc) + * S - symbol value (sym_base_addr) + * V - value at the relocation position (*loc) + * GP - value of __global_pointer$ (not supported yet) + * TLSMODULE - TLS module for the object (not supported yet) + * TLSOFFSET - TLS static block for the object (not supported yet) + */ + intptr_t loc = (intptr_t)loc_unsigned; + uint8_t *loc8 = (uint8_t *)loc, tmp8; + uint16_t *loc16 = (uint16_t *)loc, tmp16; + uint32_t *loc32 = (uint32_t *)loc, tmp32; + uint64_t *loc64 = (uint64_t *)loc, tmp64; + /* uint32_t or uint64_t */ + r_riscv_wordclass_t *loc_word = (r_riscv_wordclass_t *)loc; + uint32_t modified_operand; + uint16_t modified_compressed_operand; + int32_t imm8; + long long original_imm8, jump_target; + int16_t compressed_imm8; + __typeof__(rel->r_addend) target_alignment = 1; + const intptr_t sym_base_addr = (intptr_t)sym_base_addr_unsigned; + + LOG_DBG("Relocating symbol %s at %p with base address %p load address %p type %" PRIu64, + sym_name, (void *)loc, (void *)sym_base_addr, (void *)load_bias, + (uint64_t)reloc_type); + + /* FIXME not all types of relocations currently supported, especially TLS */ + + switch (reloc_type) { + case R_RISCV_NONE: + break; + case R_RISCV_32: + jump_target = sym_base_addr + rel->r_addend; /* S + A */ + UNALIGNED_PUT((uint32_t)jump_target, loc32); + return riscv_relocation_fits(jump_target, INT32_MAX, reloc_type); + case R_RISCV_64: + /* full 64-bit range, need no range check */ + UNALIGNED_PUT(sym_base_addr + rel->r_addend, loc64); /* S + A */ + break; + case R_RISCV_RELATIVE: + /* either full 32-bit or 64-bit range, need no range check */ + UNALIGNED_PUT(load_bias + rel->r_addend, loc_word); /* B + A */ + break; + case R_RISCV_JUMP_SLOT: + /* either full 32-bit or 64-bit range, need no range check */ + UNALIGNED_PUT(sym_base_addr, loc_word); /* S */ + break; + case R_RISCV_BRANCH: + jump_target = sym_base_addr + rel->r_addend - loc; /* S + A - P */ + modified_operand = UNALIGNED_GET(loc32); + imm8 = jump_target; + modified_operand = R_RISCV_CLEAR_BTYPE_IMM8(modified_operand); + modified_operand = R_RISCV_SET_BTYPE_IMM8(modified_operand, imm8); + UNALIGNED_PUT(modified_operand, loc32); + return riscv_relocation_fits(jump_target, RISCV_MAX_JUMP_DISTANCE_B_TYPE, + reloc_type); + case R_RISCV_JAL: + jump_target = sym_base_addr + rel->r_addend - loc; /* S + A - P */ + modified_operand = UNALIGNED_GET(loc32); + imm8 = jump_target; + modified_operand = R_RISCV_CLEAR_JTYPE_IMM8(modified_operand); + modified_operand = R_RISCV_SET_JTYPE_IMM8(modified_operand, imm8); + UNALIGNED_PUT(modified_operand, loc32); + return riscv_relocation_fits(jump_target, RISCV_MAX_JUMP_DISTANCE_U_PLUS_I_TYPE, + reloc_type); + case R_RISCV_CALL: + case R_RISCV_CALL_PLT: + case R_RISCV_PCREL_HI20: + modified_operand = UNALIGNED_GET(loc32); + jump_target = sym_base_addr + rel->r_addend - loc; /* S + A - P */ + imm8 = jump_target; + /* bit 12 of the immediate goes to I-type instruction and might + * change the sign of the number + */ + /* in order to avoid that, we add 1 to the upper immediate if bit 12 is one */ + /* see RISC-V la pseudo instruction */ + imm8 += imm8 & 0x800; + + original_imm8 = imm8; + + modified_operand = R_RISCV_CLEAR_UTYPE_IMM8(modified_operand); + modified_operand = R_RISCV_SET_UTYPE_IMM8(modified_operand, imm8); + UNALIGNED_PUT(modified_operand, loc32); + + if (reloc_type != R_RISCV_PCREL_HI20) { + /* PCREL_HI20 is only U-type, not truly U+I-type */ + /* for the others, need to also modify following I-type */ + loc32++; + + imm8 = jump_target; + + modified_operand = UNALIGNED_GET(loc32); + modified_operand = R_RISCV_CLEAR_ITYPE_IMM8(modified_operand); + modified_operand = R_RISCV_SET_ITYPE_IMM8(modified_operand, imm8); + UNALIGNED_PUT(modified_operand, loc32); + } + + last_u_type_jump_target = jump_target; + + return riscv_relocation_fits(jump_target, RISCV_MAX_JUMP_DISTANCE_U_PLUS_I_TYPE, + reloc_type); + case R_RISCV_PCREL_LO12_I: + /* need the same jump target as preceding U-type relocation */ + if (last_u_type_jump_target == 0) { + LOG_ERR("R_RISCV_PCREL_LO12_I relocation without preceding U-type " + "relocation!"); + return -ENOEXEC; + } + modified_operand = UNALIGNED_GET(loc32); + jump_target = last_u_type_jump_target; /* S - P */ + last_u_type_jump_target = 0; + imm8 = jump_target; + modified_operand = R_RISCV_CLEAR_ITYPE_IMM8(modified_operand); + modified_operand = R_RISCV_SET_ITYPE_IMM8(modified_operand, imm8); + UNALIGNED_PUT(modified_operand, loc32); + return riscv_relocation_fits(jump_target, RISCV_MAX_JUMP_DISTANCE_U_PLUS_I_TYPE, + reloc_type); + break; + case R_RISCV_PCREL_LO12_S: + /* need the same jump target as preceding U-type relocation */ + if (last_u_type_jump_target == 0) { + LOG_ERR("R_RISCV_PCREL_LO12_I relocation without preceding U-type " + "relocation!"); + return -ENOEXEC; + } + modified_operand = UNALIGNED_GET(loc32); + jump_target = last_u_type_jump_target; /* S - P */ + last_u_type_jump_target = 0; + imm8 = jump_target; + modified_operand = R_RISCV_CLEAR_STYPE_IMM8(modified_operand); + modified_operand = R_RISCV_SET_STYPE_IMM8(modified_operand, imm8); + UNALIGNED_PUT(modified_operand, loc32); + return riscv_relocation_fits(jump_target, RISCV_MAX_JUMP_DISTANCE_U_PLUS_I_TYPE, + reloc_type); + case R_RISCV_HI20: + jump_target = sym_base_addr + rel->r_addend; /* S + A */ + modified_operand = UNALIGNED_GET(loc32); + imm8 = jump_target; + /* bit 12 of the immediate goes to I-type instruction and might + * change the sign of the number + */ + /* in order to avoid that, we add 1 to the upper immediate if bit 12 is one*/ + /* see RISC-V la pseudo instruction */ + original_imm8 = imm8; + imm8 += imm8 & 0x800; + modified_operand = R_RISCV_CLEAR_UTYPE_IMM8(modified_operand); + modified_operand = R_RISCV_SET_UTYPE_IMM8(modified_operand, imm8); + UNALIGNED_PUT(modified_operand, loc32); + return riscv_relocation_fits(jump_target, RISCV_MAX_JUMP_DISTANCE_U_PLUS_I_TYPE, + reloc_type); + case R_RISCV_LO12_I: + modified_operand = UNALIGNED_GET(loc32); + jump_target = sym_base_addr + rel->r_addend; /* S + A */ + imm8 = jump_target; + /* this is always used with R_RISCV_HI20 */ + modified_operand = R_RISCV_CLEAR_ITYPE_IMM8(modified_operand); + modified_operand = R_RISCV_SET_ITYPE_IMM8(modified_operand, imm8); + UNALIGNED_PUT(modified_operand, loc32); + return riscv_relocation_fits(jump_target, RISCV_MAX_JUMP_DISTANCE_U_PLUS_I_TYPE, + reloc_type); + case R_RISCV_LO12_S: + modified_operand = UNALIGNED_GET(loc32); + imm8 = sym_base_addr + rel->r_addend; /* S + A */ + /* + * S-type is used for stores/loads etc. + * size check is done at compile time, as it depends on the size of + * the structure we are trying to load/store + */ + modified_operand = R_RISCV_CLEAR_STYPE_IMM8(modified_operand); + modified_operand = R_RISCV_SET_STYPE_IMM8(modified_operand, imm8); + UNALIGNED_PUT(modified_operand, loc32); + break; + /* for add/sub/set, compiler needs to ensure that the ELF sections are close enough */ + case R_RISCV_ADD8: + tmp8 = UNALIGNED_GET(loc8); + tmp8 += sym_base_addr + rel->r_addend; /* V + S + A */ + UNALIGNED_PUT(tmp8, loc8); + break; + case R_RISCV_ADD16: + tmp16 = UNALIGNED_GET(loc16); + tmp16 += sym_base_addr + rel->r_addend; /* V + S + A */ + UNALIGNED_PUT(tmp16, loc16); + break; + case R_RISCV_ADD32: + tmp32 = UNALIGNED_GET(loc32); + tmp32 += sym_base_addr + rel->r_addend; /* V + S + A */ + UNALIGNED_PUT(tmp32, loc32); + break; + case R_RISCV_ADD64: + tmp64 = UNALIGNED_GET(loc64); + tmp64 += sym_base_addr + rel->r_addend; /* V + S + A */ + UNALIGNED_PUT(tmp64, loc64); + break; + case R_RISCV_SUB8: + tmp8 = UNALIGNED_GET(loc8); + tmp8 -= sym_base_addr + rel->r_addend; /* V - S - A */ + UNALIGNED_PUT(tmp8, loc8); + break; + case R_RISCV_SUB16: + tmp16 = UNALIGNED_GET(loc16); + tmp16 -= sym_base_addr + rel->r_addend; /* V - S - A */ + UNALIGNED_PUT(tmp16, loc16); + break; + case R_RISCV_SUB32: + tmp32 = UNALIGNED_GET(loc32); + tmp32 -= sym_base_addr + rel->r_addend; /* V - S - A */ + UNALIGNED_PUT(tmp32, loc32); + break; + case R_RISCV_SUB64: + tmp64 = UNALIGNED_GET(loc64); + tmp64 -= sym_base_addr + rel->r_addend; /* V - S - A */ + UNALIGNED_PUT(tmp64, loc64); + break; + case R_RISCV_SUB6: + tmp8 = UNALIGNED_GET(loc8) & (0x1F); + UNALIGNED_PUT(tmp8, loc8); + tmp8 = tmp8 - sym_base_addr - rel->r_addend; /* V - S - A */ + tmp8 = tmp8 & (0x1F); + tmp8 = tmp8 | UNALIGNED_GET(loc8); + UNALIGNED_PUT(tmp8, loc8); + break; + case R_RISCV_SET6: + tmp8 = UNALIGNED_GET(loc8) & (0x1F); + UNALIGNED_PUT(tmp8, loc8); + tmp8 = sym_base_addr + rel->r_addend; /* S + A */ + tmp8 = tmp8 | UNALIGNED_GET(loc8); + UNALIGNED_PUT(tmp8, loc8); + break; + case R_RISCV_SET8: + tmp8 = sym_base_addr + rel->r_addend; /* S + A */ + UNALIGNED_PUT(tmp8, loc8); + break; + case R_RISCV_SET16: + tmp16 = sym_base_addr + rel->r_addend; /* S + A */ + UNALIGNED_PUT(tmp16, loc16); + break; + case R_RISCV_SET32: + tmp32 = sym_base_addr + rel->r_addend; /* S + A */ + UNALIGNED_PUT(tmp32, loc32); + break; + case R_RISCV_32_PCREL: + jump_target = sym_base_addr + rel->r_addend - loc; /* S + A - P */ + tmp32 = jump_target; + UNALIGNED_PUT(tmp32, loc32); + return riscv_relocation_fits(jump_target, RISCV_MAX_JUMP_DISTANCE_U_PLUS_I_TYPE, + reloc_type); + case R_RISCV_PLT32: + jump_target = sym_base_addr + rel->r_addend - loc; /* S + A - P */ + tmp32 = jump_target; + UNALIGNED_PUT(tmp32, loc32); + return riscv_relocation_fits(jump_target, RISCV_MAX_JUMP_DISTANCE_U_PLUS_I_TYPE, + reloc_type); + case R_RISCV_RVC_BRANCH: + jump_target = sym_base_addr + rel->r_addend - loc; /* S + A - P */ + modified_compressed_operand = UNALIGNED_GET(loc16); + compressed_imm8 = jump_target; + modified_compressed_operand = + R_RISCV_CLEAR_CBTYPE_IMM8(modified_compressed_operand); + modified_compressed_operand = + R_RISCV_SET_CBTYPE_IMM8(modified_compressed_operand, compressed_imm8); + UNALIGNED_PUT(modified_compressed_operand, loc16); + return riscv_relocation_fits(jump_target, RISCV_MAX_JUMP_DISTANCE_CB_TYPE, + reloc_type); + case R_RISCV_RVC_JUMP: + jump_target = sym_base_addr + rel->r_addend - loc; /* S + A - P */ + modified_compressed_operand = UNALIGNED_GET(loc16); + compressed_imm8 = jump_target; + modified_compressed_operand = + R_RISCV_CLEAR_CJTYPE_IMM8(modified_compressed_operand); + modified_compressed_operand = + R_RISCV_SET_CJTYPE_IMM8(modified_compressed_operand, compressed_imm8); + UNALIGNED_PUT(modified_compressed_operand, loc16); + return riscv_relocation_fits(jump_target, RISCV_MAX_JUMP_DISTANCE_CJ_TYPE, + reloc_type); + case R_RISCV_ALIGN: + /* we are supposed to move the symbol such that it is aligned to the next power of + * two >= addend + */ + /* this involves moving the symbol */ + while (target_alignment < rel->r_addend) { + target_alignment *= 2; + } + LOG_ERR("Symbol %s with location %p requires alignment to %" PRIu64 " bytes!", + sym_name, (void *)loc, (uint64_t)target_alignment); + LOG_ERR("Alignment relocation is currently not supported!"); + return -ENOEXEC; + /* ignored, this is primarily intended for removing instructions during link-time + * optimization + */ + case R_RISCV_RELAX: + break; + default: + LOG_ERR("Unsupported relocation type: %" PRIu64 " for symbol: %s", + (uint64_t)reloc_type, sym_name); + return -ENOEXEC; + } + + return 0; +} diff --git a/cmake/compiler/gcc/target_riscv.cmake b/cmake/compiler/gcc/target_riscv.cmake index b4875720c9bfa..a297a772886c2 100644 --- a/cmake/compiler/gcc/target_riscv.cmake +++ b/cmake/compiler/gcc/target_riscv.cmake @@ -71,3 +71,23 @@ endif() list(APPEND TOOLCHAIN_C_FLAGS -mabi=${riscv_mabi} -march=${riscv_march}) list(APPEND TOOLCHAIN_LD_FLAGS NO_SPLIT -mabi=${riscv_mabi} -march=${riscv_march}) + +# Flags not supported by llext linker +# (regexps are supported and match whole word) +set(LLEXT_REMOVE_FLAGS + -fno-pic + -fno-pie + -ffunction-sections + -fdata-sections + -g.* + -Os +) + +# Flags to be added to llext code compilation +# mno-relax is needed to stop gcc from generating R_RISCV_ALIGN relocations, +# which are currently not supported +set(LLEXT_APPEND_FLAGS + -mabi=${riscv_mabi} + -march=${riscv_march} + -mno-relax +) \ No newline at end of file diff --git a/doc/services/llext/index.rst b/doc/services/llext/index.rst index 0d697243d7168..f626f1df1daa0 100644 --- a/doc/services/llext/index.rst +++ b/doc/services/llext/index.rst @@ -21,4 +21,4 @@ and introspected to some degree, as well as unloaded when no longer needed. .. note:: The LLEXT subsystem requires architecture-specific support. It is currently - available only on ARM, ARM64 and Xtensa cores. + available only on RISC-V, ARM, ARM64 and Xtensa cores. diff --git a/include/zephyr/arch/riscv/elf.h b/include/zephyr/arch/riscv/elf.h new file mode 100644 index 0000000000000..fe40dc8857d98 --- /dev/null +++ b/include/zephyr/arch/riscv/elf.h @@ -0,0 +1,298 @@ +/** + * @file + * @brief RISCV-Specific constants for ELF binaries. + * + * References can be found here: + * https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc + */ +/* + * Copyright (c) 2024 CISPA Helmholtz Center for Information Security gGmbH + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef ZEPHYR_ARCH_RISCV_ELF_H +#define ZEPHYR_ARCH_RISCV_ELF_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Relocation names for RISCV-specific relocations + * @cond ignore + */ + +#define R_RISCV_NONE 0 +#define R_RISCV_32 1 +#define R_RISCV_64 2 +#define R_RISCV_RELATIVE 3 +#define R_RISCV_COPY 4 +#define R_RISCV_JUMP_SLOT 5 +#define R_RISCV_TLS_DTPMOD32 6 +#define R_RISCV_TLS_DTPMOD64 7 +#define R_RISCV_TLS_DTPREL32 8 +#define R_RISCV_TLS_DTPREL64 9 +#define R_RISCV_TLS_TPREL32 10 +#define R_RISCV_TLS_TPREL64 11 +#define R_RISCV_TLSDESC 12 +/* 13-15 reserved */ +#define R_RISCV_BRANCH 16 +#define R_RISCV_JAL 17 +#define R_RISCV_CALL 18 +#define R_RISCV_CALL_PLT 19 +#define R_RISCV_GOT_HI20 20 +#define R_RISCV_TLS_GOT_HI20 21 +#define R_RISCV_TLS_GD_HI20 22 +#define R_RISCV_PCREL_HI20 23 +#define R_RISCV_PCREL_LO12_I 24 +#define R_RISCV_PCREL_LO12_S 25 +#define R_RISCV_HI20 26 +#define R_RISCV_LO12_I 27 +#define R_RISCV_LO12_S 28 +#define R_RISCV_TPREL_HI20 29 +#define R_RISCV_TPREL_LO12_I 30 +#define R_RISCV_TPREL_LO12_S 31 +#define R_RISCV_TPREL_ADD 32 +#define R_RISCV_ADD8 33 +#define R_RISCV_ADD16 34 +#define R_RISCV_ADD32 35 +#define R_RISCV_ADD64 36 +#define R_RISCV_SUB8 37 +#define R_RISCV_SUB16 38 +#define R_RISCV_SUB32 39 +#define R_RISCV_SUB64 40 +#define R_RISCV_GOT32_PCREL 41 +/* 42 reserved */ +#define R_RISCV_ALIGN 43 +/* next two refer to compressed instructions */ +#define R_RISCV_RVC_BRANCH 44 +#define R_RISCV_RVC_JUMP 45 +/* 46-50 reserved */ +#define R_RISCV_RELAX 51 +#define R_RISCV_SUB6 52 +#define R_RISCV_SET6 53 +#define R_RISCV_SET8 54 +#define R_RISCV_SET16 55 +#define R_RISCV_SET32 56 +#define R_RISCV_32_PCREL 57 +#define R_RISCV_IRELATIVE 58 +#define R_RISCV_PLT32 59 +#define R_RISCV_SET_ULEB128 60 +#define R_RISCV_SUB_ULEB128 61 +#define R_RISCV_TLSDESC_HI20 62 +#define R_RISCV_TLSDESC_LOAD_LO12 63 +#define R_RISCV_TLSDESC_ADD_LO12 64 +#define R_RISCV_TLSDESC_CALL 65 +/* 66-190 reserved */ +#define R_RISCV_VENDOR 191 +/* 192-255 reserved */ +/** @endcond */ + +/** + * "wordclass" from RISC-V specification + * @cond ignore + */ +#if defined(CONFIG_64BIT) +typedef uint64_t r_riscv_wordclass_t; +#else +typedef uint32_t r_riscv_wordclass_t; +#endif +/** @endcond */ + +/** @brief Extract bit from immediate + * + * @param imm8 immediate value (usually upper 20 or lower 12 bit) + * @param bit which bit to extract + */ +#define R_RISCV_IMM8_GET_BIT(imm8, bit) (((imm8) & BIT(bit)) >> (bit)) + +/** @brief Generate mask for immediate in B-type RISC-V instruction + * + * @param imm8 immediate value, lower 12 bits used; + * due to alignment requirements, imm8[0] is implicitly 0 + * + */ +#define R_RISCV_BTYPE_IMM8_MASK(imm8) \ + ((R_RISCV_IMM8_GET_BIT(imm8, 12) << 31) | (R_RISCV_IMM8_GET_BIT(imm8, 10) << 30) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 9) << 29) | (R_RISCV_IMM8_GET_BIT(imm8, 8) << 28) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 7) << 27) | (R_RISCV_IMM8_GET_BIT(imm8, 6) << 26) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 5) << 25) | (R_RISCV_IMM8_GET_BIT(imm8, 4) << 11) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 3) << 10) | (R_RISCV_IMM8_GET_BIT(imm8, 2) << 9) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 1) << 8) | (R_RISCV_IMM8_GET_BIT(imm8, 11) << 7)) + +/** @brief Generate mask for immediate in J-type RISC-V instruction + * + * @param imm8 immediate value, lower 21 bits used; + * due to alignment requirements, imm8[0] is implicitly 0 + * + */ +#define R_RISCV_JTYPE_IMM8_MASK(imm8) \ + ((R_RISCV_IMM8_GET_BIT(imm8, 20) << 31) | (R_RISCV_IMM8_GET_BIT(imm8, 10) << 30) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 9) << 29) | (R_RISCV_IMM8_GET_BIT(imm8, 8) << 28) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 7) << 27) | (R_RISCV_IMM8_GET_BIT(imm8, 6) << 26) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 5) << 25) | (R_RISCV_IMM8_GET_BIT(imm8, 4) << 24) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 3) << 23) | (R_RISCV_IMM8_GET_BIT(imm8, 2) << 22) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 1) << 21) | (R_RISCV_IMM8_GET_BIT(imm8, 11) << 20) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 19) << 19) | (R_RISCV_IMM8_GET_BIT(imm8, 18) << 18) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 17) << 17) | (R_RISCV_IMM8_GET_BIT(imm8, 16) << 16) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 15) << 15) | (R_RISCV_IMM8_GET_BIT(imm8, 14) << 14) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 13) << 13) | (R_RISCV_IMM8_GET_BIT(imm8, 12) << 12)) + +/** @brief Generate mask for immediate in S-type RISC-V instruction + * + * @param imm8 immediate value, lower 12 bits used + * + */ +#define R_RISCV_STYPE_IMM8_MASK(imm8) \ + ((R_RISCV_IMM8_GET_BIT(imm8, 11) << 31) | (R_RISCV_IMM8_GET_BIT(imm8, 10) << 30) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 9) << 29) | (R_RISCV_IMM8_GET_BIT(imm8, 8) << 28) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 7) << 27) | (R_RISCV_IMM8_GET_BIT(imm8, 6) << 26) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 5) << 25) | (R_RISCV_IMM8_GET_BIT(imm8, 4) << 11) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 3) << 10) | (R_RISCV_IMM8_GET_BIT(imm8, 2) << 9) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 1) << 8) | (R_RISCV_IMM8_GET_BIT(imm8, 0) << 7)) + +/** @brief Generate mask for immediate in compressed J-type RISC-V instruction + * + * @param imm8 immediate value, lower 12 bits used; + * due to alignment requirements, imm8[0] is implicitly 0 + * + */ +#define R_RISCV_CJTYPE_IMM8_MASK(imm8) \ + ((R_RISCV_IMM8_GET_BIT(imm8, 11) << 12) | (R_RISCV_IMM8_GET_BIT(imm8, 4) << 11) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 9) << 10) | (R_RISCV_IMM8_GET_BIT(imm8, 8) << 9) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 10) << 8) | (R_RISCV_IMM8_GET_BIT(imm8, 6) << 7) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 7) << 6) | (R_RISCV_IMM8_GET_BIT(imm8, 3) << 5) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 2) << 4) | (R_RISCV_IMM8_GET_BIT(imm8, 1) << 3) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 5) << 2)) + +/** @brief Generate mask for immediate in compressed B-type RISC-V instruction + * + * @param imm8 immediate value, lower 9 bits used; + * due to alignment requirements, imm8[0] is implicitly 0 + * + */ +#define R_RISCV_CBTYPE_IMM8_MASK(imm8) \ + ((R_RISCV_IMM8_GET_BIT(imm8, 8) << 12) | (R_RISCV_IMM8_GET_BIT(imm8, 4) << 11) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 3) << 10) | (R_RISCV_IMM8_GET_BIT(imm8, 7) << 6) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 6) << 5) | (R_RISCV_IMM8_GET_BIT(imm8, 2) << 4) | \ + (R_RISCV_IMM8_GET_BIT(imm8, 1) << 3) | (R_RISCV_IMM8_GET_BIT(imm8, 5) << 2)) + +/** @brief Clear immediate bits in B-type instruction. + * + * @param operand Address of RISC-V instruction, B-type + * + */ +#define R_RISCV_CLEAR_BTYPE_IMM8(operand) ((operand) & ~R_RISCV_BTYPE_IMM8_MASK((uint32_t) -1)) + +/** @brief Overwrite immediate in B-type instruction + * + * @param operand Address of RISC-V instruction, B-type + * @param imm8 New immediate + * + */ +#define R_RISCV_SET_BTYPE_IMM8(operand, imm8) \ + ((R_RISCV_CLEAR_BTYPE_IMM8(operand)) | R_RISCV_BTYPE_IMM8_MASK(imm8)) + +/** @brief Clear immediate bits in J-type instruction. + * + * @param operand Address of RISC-V instruction, J-type + * + */ +#define R_RISCV_CLEAR_JTYPE_IMM8(operand) ((operand) & ~R_RISCV_JTYPE_IMM8_MASK((uint32_t) -1)) + +/** @brief Overwrite immediate in J-type instruction + * + * @param operand Address of RISC-V instruction, J-type + * @param imm8 New immediate + * + */ +#define R_RISCV_SET_JTYPE_IMM8(operand, imm8) \ + ((R_RISCV_CLEAR_JTYPE_IMM8(operand)) | R_RISCV_JTYPE_IMM8_MASK(imm8)) + +/** @brief Clear immediate bits in S-type instruction. + * + * @param operand Address of RISC-V instruction, S-type + * + */ +#define R_RISCV_CLEAR_STYPE_IMM8(operand) ((operand) & ~R_RISCV_STYPE_IMM8_MASK((uint32_t) -1)) + +/** @brief Overwrite immediate in S-type instruction + * + * @param operand Address of RISC-V instruction, S-type + * @param imm8 New immediate + * + */ +#define R_RISCV_SET_STYPE_IMM8(operand, imm8) \ + ((R_RISCV_CLEAR_STYPE_IMM8(operand)) | R_RISCV_STYPE_IMM8_MASK(imm8)) + +/** @brief Clear immediate bits in compressed J-type instruction. + * + * @param operand Address of RISC-V instruction, compressed-J-type + * + */ +#define R_RISCV_CLEAR_CJTYPE_IMM8(operand) ((operand) & ~R_RISCV_CJTYPE_IMM8_MASK((uint32_t) -1)) + +/** @brief Overwrite immediate in compressed J-type instruction + * + * @param operand Address of RISC-V instruction, compressed-J-type + * @param imm8 New immediate + * + */ +#define R_RISCV_SET_CJTYPE_IMM8(operand, imm8) \ + ((R_RISCV_CLEAR_CJTYPE_IMM8(operand)) | R_RISCV_CJTYPE_IMM8_MASK(imm8)) + +/** @brief Clear immediate bits in compressed B-type instruction. + * + * @param operand Address of RISC-V instruction, compressed-B-type + * + */ +#define R_RISCV_CLEAR_CBTYPE_IMM8(operand) ((operand) & ~R_RISCV_CBTYPE_IMM8_MASK((uint32_t) -1)) + +/** @brief Overwrite immediate in compressed B-type instruction + * + * @param operand Address of RISC-V instruction, compressed-B-type + * @param imm8 New immediate + * + */ +#define R_RISCV_SET_CBTYPE_IMM8(operand, imm8) \ + ((R_RISCV_CLEAR_CBTYPE_IMM8(operand)) | R_RISCV_CBTYPE_IMM8_MASK(imm8)) + +/** @brief Clear immediate bits in U-type instruction. + * + * @param operand Address of RISC-V instruction, U-type + * + */ +#define R_RISCV_CLEAR_UTYPE_IMM8(operand) ((operand) & ~(0xFFFFF000)) + +/** @brief Overwrite immediate in U-type instruction + * + * @param operand Address of RISC-V instruction, U-type + * @param imm8 New immediate + * + */ +#define R_RISCV_SET_UTYPE_IMM8(operand, imm8) \ + ((R_RISCV_CLEAR_UTYPE_IMM8(operand)) | ((imm8) & 0xFFFFF000)) + +/** @brief Clear immediate bits in I-type instruction. + * + * @param operand Address of RISC-V instruction, I-type + * + */ +#define R_RISCV_CLEAR_ITYPE_IMM8(operand) ((operand) & ~(0xFFF00000)) + +/** @brief Overwrite immediate in I-type instruction + * + * @param operand Address of RISC-V instruction, I-type + * @param imm8 New immediate + * + */ +#define R_RISCV_SET_ITYPE_IMM8(operand, imm8) ((R_RISCV_CLEAR_ITYPE_IMM8(operand)) | ((imm8) << 20)) + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_ARCH_RISCV_ELF_H */ diff --git a/subsys/llext/CMakeLists.txt b/subsys/llext/CMakeLists.txt index 6f88544424d3a..9baf900b1007d 100644 --- a/subsys/llext/CMakeLists.txt +++ b/subsys/llext/CMakeLists.txt @@ -17,4 +17,8 @@ if(CONFIG_LLEXT) fs_loader.c ) zephyr_library_sources_ifdef(CONFIG_LLEXT_SHELL shell.c) + + if(CONFIG_RISCV AND CONFIG_USERSPACE) + message(WARNING "Running LLEXT extensions from user-space threads on RISC-V is not supported!") + endif() endif() diff --git a/subsys/llext/Kconfig b/subsys/llext/Kconfig index 53eaf9f983145..696620b16d888 100644 --- a/subsys/llext/Kconfig +++ b/subsys/llext/Kconfig @@ -14,15 +14,17 @@ choice LLEXT_BINARY_TYPE prompt "Binary object type for llext" default LLEXT_TYPE_ELF_OBJECT if ARM || ARM64 default LLEXT_TYPE_ELF_SHAREDLIB if XTENSA + default LLEXT_TYPE_ELF_RELOCATABLE if RISCV help Object type for llext config LLEXT_TYPE_ELF_OBJECT bool "Single object ELF file" + depends on !RISCV help Build and expect object files as binary object type for the llext subsystem. A single compiler invocation is used to - generate the object file. + generate the object file. Currently not supported on RISC-V. config LLEXT_TYPE_ELF_RELOCATABLE bool "Relocatable ELF file" diff --git a/subsys/llext/llext_load.c b/subsys/llext/llext_load.c index d08a1c019008a..d433f6668fe40 100644 --- a/subsys/llext/llext_load.c +++ b/subsys/llext/llext_load.c @@ -387,6 +387,14 @@ static int llext_map_sections(struct llext_loader *ldr, struct llext *ext, continue; } + /* + * Exported symbols region can also overlap + * with rodata. + */ + if (i == LLEXT_MEM_EXPORT || j == LLEXT_MEM_EXPORT) { + continue; + } + if (ldr->hdr.e_type == ET_DYN) { /* * Test all merged VMA ranges for overlaps diff --git a/tests/subsys/llext/simple/CMakeLists.txt b/tests/subsys/llext/simple/CMakeLists.txt index c8899aa32d2d4..23227c58d77b1 100644 --- a/tests/subsys/llext/simple/CMakeLists.txt +++ b/tests/subsys/llext/simple/CMakeLists.txt @@ -67,7 +67,7 @@ if(NOT CONFIG_LLEXT_TYPE_ELF_OBJECT) ) endif() -if (CONFIG_LLEXT_TYPE_ELF_RELOCATABLE AND NOT CONFIG_ARM) +if (CONFIG_LLEXT_TYPE_ELF_RELOCATABLE AND NOT CONFIG_ARM AND NOT CONFIG_RISCV) # Manually fix the pre_located extension's text address at a multiple of 4 get_target_property(pre_located_target pre_located_ext lib_target) get_target_property(pre_located_file pre_located_ext pkg_input) diff --git a/tests/subsys/llext/simple/src/test_llext_simple.c b/tests/subsys/llext/simple/src/test_llext_simple.c index 577fda3969d71..375dc3edb00e7 100644 --- a/tests/subsys/llext/simple/src/test_llext_simple.c +++ b/tests/subsys/llext/simple/src/test_llext_simple.c @@ -421,6 +421,12 @@ ZTEST(llext, test_find_section) uintptr_t symbol_ptr = (uintptr_t)llext_find_sym(&ext->exp_tab, "number"); uintptr_t section_ptr = (uintptr_t)find_section_ext + section_ofs; + /* + * FIXME on RISC-V, at least for GCC, the symbols aren't always at the beginning + * of the section when CONFIG_LLEXT_TYPE_ELF_OBJECT is used, breaking this assertion. + * Currently, CONFIG_LLEXT_TYPE_ELF_OBJECT is not supported on RISC-V. + */ + zassert_equal(symbol_ptr, section_ptr, "symbol at %p != .data section at %p (%zd bytes in the ELF)", symbol_ptr, section_ptr, section_ofs); diff --git a/tests/subsys/llext/simple/testcase.yaml b/tests/subsys/llext/simple/testcase.yaml index 59cdccf6e3a04..334ad8bf4b393 100644 --- a/tests/subsys/llext/simple/testcase.yaml +++ b/tests/subsys/llext/simple/testcase.yaml @@ -34,73 +34,79 @@ tests: # Run the suite with all combinations of core Kconfig options for the llext # subsystem (storage type, ELF type, MPU/MMU etc) llext.simple.readonly: - arch_allow: arm # Xtensa needs writable storage + arch_allow: arm riscv # Xtensa needs writable storage filter: not CONFIG_MPU and not CONFIG_MMU and not CONFIG_SOC_SERIES_S32ZE extra_configs: - arch:arm:CONFIG_ARM_MPU=n - arch:arm:CONFIG_ARM_AARCH32_MMU=n + - arch:riscv:CONFIG_RISCV_PMP=n - CONFIG_LLEXT_STORAGE_WRITABLE=n llext.simple.readonly_mpu: min_ram: 128 - arch_allow: arm # Xtensa needs writable storage + arch_allow: arm # Xtensa needs writable storage, currently not supported on RISC-V filter: CONFIG_ARCH_HAS_USERSPACE extra_configs: - CONFIG_USERSPACE=y - CONFIG_LLEXT_STORAGE_WRITABLE=n llext.simple.readonly_fs_loader: - arch_allow: arm # Xtensa needs writable storage + arch_allow: arm riscv # Xtensa needs writable storage filter: not CONFIG_MPU and not CONFIG_MMU and not CONFIG_SOC_SERIES_S32ZE extra_configs: - arch:arm:CONFIG_ARM_MPU=n - arch:arm:CONFIG_ARM_AARCH32_MMU=n + - arch:riscv:CONFIG_RISCV_PMP=n - CONFIG_LLEXT_STORAGE_WRITABLE=n llext.simple.readonly_mmu: - arch_allow: arm64 arm + arch_allow: arm64 arm riscv filter: CONFIG_ARM_MMU integration_platforms: - qemu_cortex_a53 # ARM Cortex-A53 (ARMv8-A ISA) extra_configs: - CONFIG_LLEXT_STORAGE_WRITABLE=n llext.simple.writable: - arch_allow: arm xtensa + arch_allow: arm xtensa riscv integration_platforms: - qemu_xtensa/dc233c # Xtensa ISA filter: not CONFIG_MPU and not CONFIG_MMU and not CONFIG_SOC_SERIES_S32ZE extra_configs: - arch:arm:CONFIG_ARM_MPU=n - arch:arm:CONFIG_ARM_AARCH32_MMU=n + - arch:riscv:CONFIG_RISCV_PMP=n - CONFIG_LLEXT_STORAGE_WRITABLE=y llext.simple.writable_relocatable: - arch_allow: arm xtensa + arch_allow: arm xtensa riscv integration_platforms: - qemu_xtensa/dc233c # Xtensa ISA filter: not CONFIG_MPU and not CONFIG_MMU extra_configs: - arch:arm:CONFIG_ARM_MPU=n - arch:arm:CONFIG_ARM_AARCH32_MMU=n + - arch:riscv:CONFIG_RISCV_PMP=n - CONFIG_LLEXT_STORAGE_WRITABLE=y - CONFIG_LLEXT_TYPE_ELF_RELOCATABLE=y # Test the Symbol Link Identifier (SLID) linking feature on writable # storage to cover both ARM and Xtensa architectures on the same test. llext.simple.writable_slid_linking: - arch_allow: arm xtensa + arch_allow: arm xtensa riscv integration_platforms: - qemu_xtensa/dc233c # Xtensa ISA filter: not CONFIG_MPU and not CONFIG_MMU and not CONFIG_SOC_SERIES_S32ZE extra_configs: - arch:arm:CONFIG_ARM_MPU=n - arch:arm:CONFIG_ARM_AARCH32_MMU=n + - arch:riscv:CONFIG_RISCV_PMP=n - CONFIG_LLEXT_STORAGE_WRITABLE=y - CONFIG_LLEXT_EXPORT_BUILTINS_BY_SLID=y llext.simple.writable_relocatable_slid_linking: - arch_allow: arm xtensa + arch_allow: arm xtensa riscv integration_platforms: - qemu_xtensa/dc233c # Xtensa ISA filter: not CONFIG_MPU and not CONFIG_MMU extra_configs: - arch:arm:CONFIG_ARM_MPU=n - arch:arm:CONFIG_ARM_AARCH32_MMU=n + - arch:riscv:CONFIG_RISCV_PMP=n - CONFIG_LLEXT_STORAGE_WRITABLE=y - CONFIG_LLEXT_TYPE_ELF_RELOCATABLE=y - CONFIG_LLEXT_EXPORT_BUILTINS_BY_SLID=y From 32f9ecacc4299bf4df9ecb200c284f38cc719676 Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Wed, 25 Sep 2024 12:38:36 +0300 Subject: [PATCH 0239/4482] soc: intel_adsp: tools: cavstool.py: Add debug_slot_offset_by_type() Add debug_slot_offset_by_type() for getting debug window slot offset by type identifier. How to find the correct slot and what types there are is documented here: soc/intel/intel_adsp/common/include/adsp_debug_window.h In a normal situation a client program would try to find a specific slot right after DSP boot. Because of that the we can not expect it to be there immediately. Instead we need to try multiple times and give firmware some time to update the debug slot descriptor table. Signed-off-by: Jyri Sarha --- soc/intel/intel_adsp/tools/cavstool.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/soc/intel/intel_adsp/tools/cavstool.py b/soc/intel/intel_adsp/tools/cavstool.py index 874bd1de6faa5..b28cd2d5cbd0f 100755 --- a/soc/intel/intel_adsp/tools/cavstool.py +++ b/soc/intel/intel_adsp/tools/cavstool.py @@ -748,6 +748,26 @@ def debug_offset(): def debug_slot_offset(num): return debug_offset() + DEBUG_SLOT_SIZE * (1 + num) +def debug_slot_offset_by_type(the_type, timeout_s=0.2): + ADSP_DW_SLOT_COUNT=15 + hertz = 100 + attempts = timeout_s * hertz + while attempts > 0: + data = win_read(debug_offset(), 0, ADSP_DW_SLOT_COUNT * 3 * 4) + for i in range(ADSP_DW_SLOT_COUNT): + start_index = i * (3 * 4) + end_index = (i + 1) * (3 * 4) + desc = data[start_index:end_index] + resource_id, type_id, vma = struct.unpack(' Date: Mon, 30 Sep 2024 12:43:08 -0700 Subject: [PATCH 0240/4482] tests: rename intel_adsp_ace30.conf to intel_adsp_ace30_ptl.conf The board has been renamed from intel_adsp/ace30_ptl to intel_adsp/ace30/ptl. So the corresponding board only configs for tests also need to renamed. Signed-off-by: Daniel Leung --- .../boards/{intel_adsp_ace30.conf => intel_adsp_ace30_ptl.conf} | 0 .../boards/{intel_adsp_ace30.conf => intel_adsp_ace30_ptl.conf} | 0 .../boards/{intel_adsp_ace30.conf => intel_adsp_ace30_ptl.conf} | 0 .../boards/{intel_adsp_ace30.conf => intel_adsp_ace30_ptl.conf} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename tests/kernel/mem_protect/sys_sem/boards/{intel_adsp_ace30.conf => intel_adsp_ace30_ptl.conf} (100%) rename tests/kernel/mutex/sys_mutex/boards/{intel_adsp_ace30.conf => intel_adsp_ace30_ptl.conf} (100%) rename tests/kernel/queue/boards/{intel_adsp_ace30.conf => intel_adsp_ace30_ptl.conf} (100%) rename tests/lib/c_lib/thrd/boards/{intel_adsp_ace30.conf => intel_adsp_ace30_ptl.conf} (100%) diff --git a/tests/kernel/mem_protect/sys_sem/boards/intel_adsp_ace30.conf b/tests/kernel/mem_protect/sys_sem/boards/intel_adsp_ace30_ptl.conf similarity index 100% rename from tests/kernel/mem_protect/sys_sem/boards/intel_adsp_ace30.conf rename to tests/kernel/mem_protect/sys_sem/boards/intel_adsp_ace30_ptl.conf diff --git a/tests/kernel/mutex/sys_mutex/boards/intel_adsp_ace30.conf b/tests/kernel/mutex/sys_mutex/boards/intel_adsp_ace30_ptl.conf similarity index 100% rename from tests/kernel/mutex/sys_mutex/boards/intel_adsp_ace30.conf rename to tests/kernel/mutex/sys_mutex/boards/intel_adsp_ace30_ptl.conf diff --git a/tests/kernel/queue/boards/intel_adsp_ace30.conf b/tests/kernel/queue/boards/intel_adsp_ace30_ptl.conf similarity index 100% rename from tests/kernel/queue/boards/intel_adsp_ace30.conf rename to tests/kernel/queue/boards/intel_adsp_ace30_ptl.conf diff --git a/tests/lib/c_lib/thrd/boards/intel_adsp_ace30.conf b/tests/lib/c_lib/thrd/boards/intel_adsp_ace30_ptl.conf similarity index 100% rename from tests/lib/c_lib/thrd/boards/intel_adsp_ace30.conf rename to tests/lib/c_lib/thrd/boards/intel_adsp_ace30_ptl.conf From b43e7387db4d0c849c016b14b7cdff279a342771 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Tue, 8 Nov 2022 14:32:56 -0800 Subject: [PATCH 0241/4482] tests: mem_map: no exec test for intel_adsp/ace30/ptl This needs special treatment because the TEST_MEM_MAP section is placed at the end. Since there is code in TEST_MEM_MAP, rimage thinks the whole text section spans from .text to end of TEST_MEM_MAP, which overlaps .data and others, so it complains. Skip the execution test to avoid this issue. Signed-off-by: Daniel Leung --- tests/kernel/mem_protect/mem_map/testcase.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/kernel/mem_protect/mem_map/testcase.yaml b/tests/kernel/mem_protect/mem_map/testcase.yaml index 860c76dcb6b7c..186e60faf029e 100644 --- a/tests/kernel/mem_protect/mem_map/testcase.yaml +++ b/tests/kernel/mem_protect/mem_map/testcase.yaml @@ -10,7 +10,9 @@ tests: extra_configs: - CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=0 - CONFIG_CBPRINTF_REDUCED_INTEGRAL=y - platform_exclude: qemu_x86_64 + platform_exclude: + - qemu_x86_64 + - intel_adsp/ace30/ptl integration_platforms: - qemu_x86 kernel.memory_protection.mem_map.x86_64: @@ -31,3 +33,13 @@ tests: extra_sections: _TRANSPLANTED_FUNC extra_args: CONF_FILE=prj_x86_64_coverage_exec.conf platform_allow: qemu_x86_64 + kernel.memory_protection.mem_map.soc_intel_adsp: + # This needs special treatment because the TEST_MEM_MAP section + # is placed at the end. Since there is code in TEST_MEM_MAP, + # rimage thinks the whole text section spans from .text to + # end of TEST_MEM_MAP, which overlaps .data and others, so + # it complains. Skip the execution test to avoid this issue. + extra_sections: _TRANSPLANTED_FUNC + extra_args: EXTRA_CFLAGS=-DSKIP_EXECUTE_TESTS + platform_allow: + - intel_adsp/ace30/ptl From 7773fe8dd60e9f86760c994090304a0577a1ad2f Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Thu, 3 Oct 2024 14:37:54 +0200 Subject: [PATCH 0242/4482] llext: hotfix: fix device API tests for platforms without console LLEXT tests currently fail on platforms where a console was chosen but its underlying device is not enabled. This might happen for example on multicore SoCs, where the console is only enabled on the most powerful CPU. Fix this by only allowing testing the device API if the console device is both chosen and enabled in the final DT. Signed-off-by: Luca Burelli --- tests/subsys/llext/simple/src/test_llext_simple.c | 2 +- tests/subsys/llext/simple/src/threads_kernel_objects_ext.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/subsys/llext/simple/src/test_llext_simple.c b/tests/subsys/llext/simple/src/test_llext_simple.c index 375dc3edb00e7..788c27ce2eb4b 100644 --- a/tests/subsys/llext/simple/src/test_llext_simple.c +++ b/tests/subsys/llext/simple/src/test_llext_simple.c @@ -109,7 +109,7 @@ static void threads_objects_test_setup(struct llext *, struct k_thread *llext_th k_object_access_grant(&my_sem, llext_thread); k_object_access_grant(&my_thread, llext_thread); k_object_access_grant(&my_thread_stack, llext_thread); -#if DT_HAS_CHOSEN(zephyr_console) +#if DT_HAS_CHOSEN(zephyr_console) && DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_console)) k_object_access_grant(DEVICE_DT_GET(DT_CHOSEN(zephyr_console)), llext_thread); #endif } diff --git a/tests/subsys/llext/simple/src/threads_kernel_objects_ext.c b/tests/subsys/llext/simple/src/threads_kernel_objects_ext.c index 89bdd3486e43e..d5acaf52f6252 100644 --- a/tests/subsys/llext/simple/src/threads_kernel_objects_ext.c +++ b/tests/subsys/llext/simple/src/threads_kernel_objects_ext.c @@ -22,7 +22,7 @@ * Some platforms do not define any usable DT devices (not even the console). * In those cases the device API test can't be executed. */ -#if DT_HAS_CHOSEN(zephyr_console) +#if DT_HAS_CHOSEN(zephyr_console) && DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_console)) #define CONSOLE_DT_NODE DT_CHOSEN(zephyr_console) #endif From ffe6910e2105e16affd16ee4d2e5967b82eceb53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 14 Jun 2024 11:29:29 +0200 Subject: [PATCH 0243/4482] tests: kernel: interrupt: nested_irq: support nrf54h20_cpuppr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add dedicated interrupt lines for nrf54h20_cpuppr. Similar exception was already added to nrf54l15_flpr: 8742e2476. Signed-off-by: Krzysztof Chruściński --- tests/kernel/interrupt/src/nested_irq.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/kernel/interrupt/src/nested_irq.c b/tests/kernel/interrupt/src/nested_irq.c index 1bcb11c38ea17..1650a7b77ec4b 100644 --- a/tests/kernel/interrupt/src/nested_irq.c +++ b/tests/kernel/interrupt/src/nested_irq.c @@ -60,6 +60,12 @@ #define IRQ0_LINE 16 #define IRQ1_LINE 17 +#define IRQ0_PRIO 1 +#define IRQ1_PRIO 2 +#elif defined(CONFIG_SOC_NRF54H20_CPUPPR) +#define IRQ0_LINE 14 +#define IRQ1_LINE 15 + #define IRQ0_PRIO 1 #define IRQ1_PRIO 2 #else From 3786b617bdc65204a65a928124d3b11002315484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 24 Sep 2024 08:24:46 +0200 Subject: [PATCH 0244/4482] soc: nordic: Disable asserts on ppr and flpr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Asserts are by default enabled for tests but flpr and ppr are small cores (<64k) and many tests does not fit in memory with asserts enabled. Signed-off-by: Krzysztof Chruściński --- soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuflpr | 4 ++++ soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr | 4 ++++ soc/nordic/nrf54l/Kconfig.defconfig.nrf54l15_cpuflpr | 4 ++++ soc/nordic/nrf54l/Kconfig.defconfig.nrf54l15_enga_cpuflpr | 3 +++ soc/nordic/nrf92/Kconfig.defconfig.nrf9280_cpuppr | 4 ++++ 5 files changed, 19 insertions(+) diff --git a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuflpr b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuflpr index 68acc00f79b67..2b792e9f1b93f 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuflpr +++ b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuflpr @@ -6,4 +6,8 @@ if SOC_NRF54H20_CPUFLPR config NUM_IRQS default 496 +# As FLPR has limited memory most of tests does not fit with asserts enabled. +config ASSERT + default n + endif # SOC_NRF54H20_CPUFLPR diff --git a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr index ae05e5e89d464..bf7c12a3a694d 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr +++ b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr @@ -8,5 +8,9 @@ config NUM_IRQS config SYS_CLOCK_TICKS_PER_SEC default 1000 +# +# As PPR has limited memory most of tests does not fit with asserts enabled. +config ASSERT + default n endif # SOC_NRF54H20_CPUPPR diff --git a/soc/nordic/nrf54l/Kconfig.defconfig.nrf54l15_cpuflpr b/soc/nordic/nrf54l/Kconfig.defconfig.nrf54l15_cpuflpr index eabd1844c90f9..7c653d14b9317 100644 --- a/soc/nordic/nrf54l/Kconfig.defconfig.nrf54l15_cpuflpr +++ b/soc/nordic/nrf54l/Kconfig.defconfig.nrf54l15_cpuflpr @@ -8,4 +8,8 @@ if SOC_NRF54L15_CPUFLPR config NUM_IRQS default 287 +# As FLPR has limited memory most of tests does not fit with asserts enabled. +config ASSERT + default n + endif # SOC_NRF54L15_CPUFLPR diff --git a/soc/nordic/nrf54l/Kconfig.defconfig.nrf54l15_enga_cpuflpr b/soc/nordic/nrf54l/Kconfig.defconfig.nrf54l15_enga_cpuflpr index de1a851922586..86c80d08fc294 100644 --- a/soc/nordic/nrf54l/Kconfig.defconfig.nrf54l15_enga_cpuflpr +++ b/soc/nordic/nrf54l/Kconfig.defconfig.nrf54l15_enga_cpuflpr @@ -11,5 +11,8 @@ config RISCV_HAS_CPU_IDLE config NUM_IRQS int default 287 +# As FLPR has limited memory most of tests does not fit with asserts enabled. +config ASSERT + default n endif # SOC_NRF54L15_ENGA_CPUFLPR diff --git a/soc/nordic/nrf92/Kconfig.defconfig.nrf9280_cpuppr b/soc/nordic/nrf92/Kconfig.defconfig.nrf9280_cpuppr index 1bef8de61cac8..8e52b3611aa20 100644 --- a/soc/nordic/nrf92/Kconfig.defconfig.nrf9280_cpuppr +++ b/soc/nordic/nrf92/Kconfig.defconfig.nrf9280_cpuppr @@ -12,4 +12,8 @@ config SYS_CLOCK_TICKS_PER_SEC config RV_BOOT_HART default 13 if SOC_NRF9230_ENGB +# As FLPR has limited memory most of tests does not fit with asserts enabled. +config ASSERT + default n + endif # SOC_NRF9280_CPUPPR From 670bd3bed213be82ca7320eb38c865c4e5de2ce1 Mon Sep 17 00:00:00 2001 From: Erik Brockhoff Date: Wed, 21 Aug 2024 13:25:35 +0200 Subject: [PATCH 0245/4482] Bluetooth: controller: fixing issue re. assert on overlapping conn upd proc If a connection update (from central) overlaps a peripheral initiated conneection param request, then central rejects peripheral request and continues central procedure. This lead to an assert in peripheral On instant there would not be an rx_node for notification, as this would have been discarded by the reception of the REJECT. This fix ensures that once an rx_node has been 'accepted' for retention it will not be discarded/overwritten by future rx_nodes The test will trigger the assert without the fix in. Signed-off-by: Erik Brockhoff --- .../controller/ll_sw/ull_llcp_conn_upd.c | 36 +++++ .../controller/ll_sw/ull_llcp_local.c | 18 ++- .../controller/ll_sw/ull_llcp_remote.c | 9 +- .../controller/ctrl_conn_update/src/main.c | 124 ++++++++++++++++++ 4 files changed, 181 insertions(+), 6 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_conn_upd.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_conn_upd.c index db0d2711748b3..b107371dc77ff 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_conn_upd.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_conn_upd.c @@ -676,6 +676,42 @@ static void lp_cu_st_wait_instant(struct ll_conn *conn, struct proc_ctx *ctx, ui case LP_CU_EVT_RUN: lp_cu_check_instant(conn, ctx, evt, param); break; + case LP_CU_EVT_REJECT: + /* In case of a central overtaking a peripheral initiated connection + * param request the following will occur: + * Since CONNECTION_UPDATE_IND PDU is used both as response to the peripheral + * connection param request AND as initiation of a remote connection update + * the peripheral cannot tell the difference in the case when there is a + * collision. Ie when the central and peripheral 'exchange' CONNECTION_PARAM_REQ + * and CONNECTION_UPDATE_IND in the same connection event. In this case + * the central should follow the CONNECTION_UPDATE_IND with a REJECT_IND to + * signal procedure collision and then complete procedure as initiated. + * The peer on the other hand, should abandon the local initiated procedure + * and instead run the remote connection update to completion. What happens + * instead is that the peripheral reaches WAIT_FOR_INSTANT state as it + * assumes the UPDATE_IND was a response to the local procedure. As a result + * the REJECT_IND will be passed into the local procedure RX path and end up + * 'here'. See test case: test_conn_update_periph_loc_reject_central_overlap + * in unit test: tests/bluetooth/controller/ctrl_conn_update/src/main.c + * + * In the current implementation of LLCP there is no way of handling + * this transition from local initiated to remote initiated procedure and thus + * the only way to handle this 'corner' case is to allow the local procedure to + * complete and accept impact of not having it complete as a remote procedure. + * + * The impact being: + * -> since it runs as a local procedure it will block other local procedures + * from being initiated while non-complete. Since non-instant based procedures + * are allowed this is a limitation + * -> since procedure continues as local initiated the procedure timeout will + * be off (too short) by as much as the time between CONNECTION_PARAM_REQ + * and CONNECTION_UPDATE_IND pdus + * + * The work around for this is to ignore the REJECT_IND at this stage and + * ensure proper function of RX node retention mechanism. + * (see comment in ull_llcp_local.c::llcp_lr_rx() for details on this) + */ + /* Fall through to ignore */ default: /* Ignore other evts */ break; diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_local.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_local.c index 249943b10b2af..6307b50e3326d 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_local.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_local.c @@ -243,9 +243,21 @@ void llcp_lr_flush_procedures(struct ll_conn *conn) void llcp_lr_rx(struct ll_conn *conn, struct proc_ctx *ctx, memq_link_t *link, struct node_rx_pdu *rx) { - /* Store RX node and link */ - ctx->node_ref.rx = rx; - ctx->node_ref.link = link; + /* In the case of a specific connection update procedure collision it can occur that + * an 'unexpected' REJECT_IND_PDU is received and passed as RX'ed and will then result in + * discarding of the retention of the previously received CONNECTION_UPDATE_IND + * and following this, an assert will be hit when attempting to use this retained + * RX node for creating the notification on completion of connection param request. + * (see comment in ull_llcp_conn_upd.c::lp_cu_st_wait_instant() for more details) + * + * The workaround/fix for this is to only store an RX node for retention if + * 'we havent already' got one + */ + if (!ctx->node_ref.rx) { + /* Store RX node and link */ + ctx->node_ref.rx = rx; + ctx->node_ref.link = link; + } switch (ctx->proc) { #if defined(CONFIG_BT_CTLR_LE_PING) diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_remote.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_remote.c index 66476aae6dd51..94351132ddc64 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_remote.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_remote.c @@ -236,9 +236,12 @@ void llcp_rr_flush_procedures(struct ll_conn *conn) void llcp_rr_rx(struct ll_conn *conn, struct proc_ctx *ctx, memq_link_t *link, struct node_rx_pdu *rx) { - /* Store RX node and link */ - ctx->node_ref.rx = rx; - ctx->node_ref.link = link; + /* See comment in ull_llcp_local.c::llcp_lr_rx() */ + if (!ctx->node_ref.rx) { + /* Store RX node and link */ + ctx->node_ref.rx = rx; + ctx->node_ref.link = link; + } switch (ctx->proc) { case PROC_UNKNOWN: diff --git a/tests/bluetooth/controller/ctrl_conn_update/src/main.c b/tests/bluetooth/controller/ctrl_conn_update/src/main.c index 635e36c4ce1eb..ed2b694a1591a 100644 --- a/tests/bluetooth/controller/ctrl_conn_update/src/main.c +++ b/tests/bluetooth/controller/ctrl_conn_update/src/main.c @@ -1991,6 +1991,130 @@ ZTEST(periph_loc, test_conn_update_periph_loc_reject) "Free CTX buffers %d", llcp_ctx_buffers_free()); } +/* + * Peripheral-initiated Connection Parameters Request procedure. (A) + * Peripheral requests change in LE connection parameters, central rejects due to + * Central-initiated Connection Update procedure (B) overlapping. + * Central rejects peripheral init and assumes 'own' connection update to complete + * + * +-----+ +-------+ +-----+ + * | UT | | LL_P | | LT | + * +-----+ +-------+ +-----+ + * | | | + * | LE Connection Update (A) | | + * |-------------------------->| | + * | | LL_CONNECTION_PARAM_REQ | (A) + * | |-------------------------------->| + * | | | + * | |<--------------------------------| + * | | LL_CONNECTION_UPDATE_IND | (B) + * | | | + * | | LL_REJECT_EXT_IND | (A) + * | |<--------------------------------| + * | | | + * | | | + * | LE Connection Update | | + * | Complete | | (A/B) + * |<--------------------------| | + * | | | + */ +ZTEST(periph_loc, test_conn_update_periph_loc_reject_central_overlap) +{ + uint8_t err; + uint16_t instant; + struct node_tx *tx; + struct node_rx_pdu *ntf; + struct node_rx_pu cu2 = { .status = BT_HCI_ERR_SUCCESS }; + struct pdu_data_llctrl_reject_ext_ind reject_ext_ind = { + .reject_opcode = PDU_DATA_LLCTRL_TYPE_CONN_PARAM_REQ, + .error_code = BT_HCI_ERR_LL_PROC_COLLISION + }; + + /* Role */ + test_set_role(&conn, BT_HCI_ROLE_PERIPHERAL); + + /* Connect */ + ull_cp_state_set(&conn, ULL_CP_CONNECTED); + + /* Initiate a Connection Parameter Request Procedure */ + err = ull_cp_conn_update(&conn, INTVL_MIN, INTVL_MAX, LATENCY, TIMEOUT, NULL); + zassert_equal(err, BT_HCI_ERR_SUCCESS); + + /* Prepare */ + event_prepare(&conn); + conn_param_req.reference_conn_event_count = event_counter(&conn); + + /* Tx Queue should have one LL Control PDU */ + lt_rx(LL_CONNECTION_PARAM_REQ, &conn, &tx, &conn_param_req); + lt_rx_q_is_empty(&conn); + + /* Done */ + event_done(&conn); + + /* Release Tx */ + ull_cp_release_tx(&conn, tx); + + /* Prepare */ + event_prepare(&conn); + + cu_ind_B->instant = instant = event_counter(&conn) + 6; + lt_tx(LL_CONNECTION_UPDATE_IND, &conn, cu_ind_B); + + /* Done */ + event_done(&conn); + + /* Release Tx */ + ull_cp_release_tx(&conn, tx); + + /* Tx Queue should NOT have a LL Control PDU */ + lt_rx_q_is_empty(&conn); + + /* Prepare */ + event_prepare(&conn); + + /* Rx */ + lt_tx(LL_REJECT_EXT_IND, &conn, &reject_ext_ind); + + /* Done */ + event_done(&conn); + + /* There should be no host notification */ + ut_rx_q_is_empty(); + + /* */ + while (!is_instant_reached(&conn, instant)) { + /* Prepare */ + event_prepare(&conn); + + /* (B) Tx Queue should NOT have a LL Control PDU */ + lt_rx_q_is_empty(&conn); + + /* Done */ + event_done(&conn); + + /* (B) There should NOT be a host notification */ + ut_rx_q_is_empty(); + } + + /* Prepare */ + event_prepare(&conn); + + /* (B) Tx Queue should NOT have a LL Control PDU */ + lt_rx_q_is_empty(&conn); + + /* Done */ + event_done(&conn); + + /* (B) There should be one host notification */ + ut_rx_node(NODE_CONN_UPDATE, &ntf, &cu2); + ut_rx_q_is_empty(); + + /* Release Ntf */ + release_ntf(ntf); + zassert_equal(llcp_ctx_buffers_free(), test_ctx_buffers_cnt(), + "Free CTX buffers %d", llcp_ctx_buffers_free()); +} + /* * Peripheral-initiated Connection Parameters Request procedure. * Peripheral requests change in LE connection parameters, central’s Controller do not From 70419bdee7ffd4ea7248f2b3f4c1a5a9d5a75c76 Mon Sep 17 00:00:00 2001 From: Dominik Chat Date: Tue, 6 Aug 2024 14:10:46 +0200 Subject: [PATCH 0246/4482] dts: nordic: nrf5340: Change nRF5340 IPC backend to icbmsg Change the default IPC backend of nRF5340 to icbmsg. Signed-off-by: Dominik Chat --- ...340_dvk_nrf5340_cpuapp_partition_conf.dtsi | 4 +-- .../bl5340_dvk_nrf5340_cpunet_common.dtsi | 4 +-- ...dvk_nrf5340_shared_sram_planning_conf.dtsi | 31 ------------------- dts/arm/nordic/nrf5340_cpuapp_ipc.dtsi | 10 +++--- dts/arm/nordic/nrf5340_cpunet.dtsi | 10 +++--- .../nordic/nrf5340_shared_sram_partition.dtsi | 14 ++++++++- 6 files changed, 29 insertions(+), 44 deletions(-) delete mode 100644 boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_shared_sram_planning_conf.dtsi diff --git a/boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_cpuapp_partition_conf.dtsi b/boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_cpuapp_partition_conf.dtsi index b85e3d03dc2d7..2fc651230f454 100644 --- a/boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_cpuapp_partition_conf.dtsi +++ b/boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_cpuapp_partition_conf.dtsi @@ -57,5 +57,5 @@ reg = <0x20040000 0x30000>; }; -/* Include shared RAM configuration file */ -#include "bl5340_dvk_nrf5340_shared_sram_planning_conf.dtsi" +/* Include default shared RAM configuration file */ +#include diff --git a/boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_common.dtsi b/boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_common.dtsi index ce2e145d58753..1f5fc0bb3405a 100644 --- a/boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_common.dtsi +++ b/boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_cpunet_common.dtsi @@ -63,5 +63,5 @@ }; }; -/* Include shared RAM configuration file */ -#include "bl5340_dvk_nrf5340_shared_sram_planning_conf.dtsi" +/* Include default shared RAM configuration file */ +#include diff --git a/boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_shared_sram_planning_conf.dtsi b/boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_shared_sram_planning_conf.dtsi deleted file mode 100644 index fbb059494c36b..0000000000000 --- a/boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_shared_sram_planning_conf.dtsi +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2019 Nordic Semiconductor ASA - * Copyright (c) 2021 Laird Connectivity - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* Default shared SRAM planning when building for BL5340 DVK. - * This file is included by both nRF5340 CPUAPP (Application MCU) - * and nRF5340 CPUNET (Network MCU). - * - 64 kB SRAM allocated as Shared memory (sram0_shared) - * - Region defined after the image SRAM of Application MCU - */ - -/ { - chosen { - /* shared memory reserved for the inter-processor communication */ - zephyr,ipc_shm = &sram0_shared; - }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - sram0_shared: memory@20070000 { - /* SRAM allocated to shared memory */ - reg = <0x20070000 0x10000>; - }; - }; -}; diff --git a/dts/arm/nordic/nrf5340_cpuapp_ipc.dtsi b/dts/arm/nordic/nrf5340_cpuapp_ipc.dtsi index f5cda20e9613f..3e2eb31054262 100644 --- a/dts/arm/nordic/nrf5340_cpuapp_ipc.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp_ipc.dtsi @@ -5,12 +5,14 @@ */ ipc0: ipc0 { - compatible = "zephyr,ipc-openamp-static-vrings"; - memory-region = <&sram0_shared>; + compatible = "zephyr,ipc-icbmsg"; + status = "okay"; mboxes = <&mbox 0>, <&mbox 1>; mbox-names = "tx", "rx"; - role = "host"; - status = "okay"; + tx-region = <&cpuapp_cpunet_ipc_shm>; + rx-region = <&cpunet_cpuapp_ipc_shm>; + tx-blocks = <32>; + rx-blocks = <32>; bt_hci_ipc0: bt_hci_ipc0 { compatible = "zephyr,bt-hci-ipc"; diff --git a/dts/arm/nordic/nrf5340_cpunet.dtsi b/dts/arm/nordic/nrf5340_cpunet.dtsi index 81065d9aee954..eb9ce3d66793b 100644 --- a/dts/arm/nordic/nrf5340_cpunet.dtsi +++ b/dts/arm/nordic/nrf5340_cpunet.dtsi @@ -348,12 +348,14 @@ /* Default IPC description */ ipc { ipc0: ipc0 { - compatible = "zephyr,ipc-openamp-static-vrings"; - memory-region = <&sram0_shared>; + compatible = "zephyr,ipc-icbmsg"; + status = "okay"; mboxes = <&mbox 0>, <&mbox 1>; mbox-names = "rx", "tx"; - role = "remote"; - status = "okay"; + tx-region = <&cpunet_cpuapp_ipc_shm>; + rx-region = <&cpuapp_cpunet_ipc_shm>; + tx-blocks = <32>; + rx-blocks = <32>; }; }; }; diff --git a/dts/common/nordic/nrf5340_shared_sram_partition.dtsi b/dts/common/nordic/nrf5340_shared_sram_partition.dtsi index a5dc3489e893e..8dc217ceae9ea 100644 --- a/dts/common/nordic/nrf5340_shared_sram_partition.dtsi +++ b/dts/common/nordic/nrf5340_shared_sram_partition.dtsi @@ -14,7 +14,9 @@ * the memory range allocated to the non-secure image (sram0_ns). * * By default the last 64 kB of application core SRAM is allocated as shared - * memory (sram0_shared). + * memory (sram0_shared) which is divided in: + * - 32 kB CPUAPP to CPUNET communication (cpuapp_cpunet_ipc_shm) + * - 32 kB CPUNET to CPUAPP communication (cpunet_cpuapp_ipc_shm) */ / { @@ -28,8 +30,18 @@ ranges; sram0_shared: memory@20070000 { + #address-cells = <1>; + #size-cells = <1>; /* Last 64 kB of sram0 */ reg = <0x20070000 0x10000>; + + cpuapp_cpunet_ipc_shm: memory@20070000 { + reg = <0x20070000 DT_SIZE_K(32)>; + }; + + cpunet_cpuapp_ipc_shm: memory@20078000 { + reg = <0x20078000 DT_SIZE_K(32)>; + }; }; }; }; From 3904c3b2fe0ceb84cdacb2ae28fe949f326d0442 Mon Sep 17 00:00:00 2001 From: Jakub Zymelka Date: Mon, 30 Sep 2024 13:42:08 +0200 Subject: [PATCH 0247/4482] samples: Align tests yaml and overlays to nrf54l15dk Align mbox sample.yaml and icmsg flpr overlays to nrf54l15dk. Signed-off-by: Jakub Zymelka --- samples/drivers/mbox/sample.yaml | 15 ++++------ ...nrf54l15dk_nrf54l15_cpuapp_icbmsg.overlay} | 2 +- .../nrf54l15dk_nrf54l15_cpuflpr.overlay | 4 +++ ...rf54l15dk_nrf54l15_cpuflpr_icbmsg.overlay} | 2 +- .../nrf54l15pdk_nrf54l15_cpuflpr.overlay | 4 +++ .../subsys/ipc/ipc_service/icmsg/sample.yaml | 30 +++++++++---------- 6 files changed, 31 insertions(+), 26 deletions(-) rename samples/subsys/ipc/ipc_service/icmsg/boards/{nrf54l15pdk_nrf54l15_cpuapp_icbmsg.overlay => nrf54l15dk_nrf54l15_cpuapp_icbmsg.overlay} (91%) rename samples/subsys/ipc/ipc_service/icmsg/remote/boards/{nrf54l15pdk_nrf54l15_cpuflpr_icbmsg.overlay => nrf54l15dk_nrf54l15_cpuflpr_icbmsg.overlay} (91%) diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index 40664dac736c6..1cede3238992d 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -86,7 +86,6 @@ tests: sample.drivers.mbox.nrf54l15: platform_allow: - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp extra_args: @@ -97,13 +96,12 @@ tests: type: multi_line ordered: false regex: - - "Ping \\(on channel 16\\)" - - "Pong \\(on channel 15\\)" + - "Ping \\(on channel 21\\)" + - "Pong \\(on channel 20\\)" sample.drivers.mbox.nrf54l15_no_multithreading: platform_allow: - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp extra_args: @@ -116,13 +114,12 @@ tests: type: multi_line ordered: false regex: - - "Ping \\(on channel 16\\)" - - "Pong \\(on channel 15\\)" + - "Ping \\(on channel 21\\)" + - "Pong \\(on channel 20\\)" sample.drivers.mbox.nrf54l15_remote_no_multithreading: platform_allow: - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15pdk/nrf54l15/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp extra_args: @@ -134,5 +131,5 @@ tests: type: multi_line ordered: false regex: - - "Ping \\(on channel 16\\)" - - "Pong \\(on channel 15\\)" + - "Ping \\(on channel 21\\)" + - "Pong \\(on channel 20\\)" diff --git a/samples/subsys/ipc/ipc_service/icmsg/boards/nrf54l15pdk_nrf54l15_cpuapp_icbmsg.overlay b/samples/subsys/ipc/ipc_service/icmsg/boards/nrf54l15dk_nrf54l15_cpuapp_icbmsg.overlay similarity index 91% rename from samples/subsys/ipc/ipc_service/icmsg/boards/nrf54l15pdk_nrf54l15_cpuapp_icbmsg.overlay rename to samples/subsys/ipc/ipc_service/icmsg/boards/nrf54l15dk_nrf54l15_cpuapp_icbmsg.overlay index 74bdf07915b9d..a3f853c6e3d5d 100644 --- a/samples/subsys/ipc/ipc_service/icmsg/boards/nrf54l15pdk_nrf54l15_cpuapp_icbmsg.overlay +++ b/samples/subsys/ipc/ipc_service/icmsg/boards/nrf54l15dk_nrf54l15_cpuapp_icbmsg.overlay @@ -27,7 +27,7 @@ rx-region = <&sram_rx>; tx-blocks = <16>; rx-blocks = <18>; - mboxes = <&cpuapp_vevif_rx 15>, <&cpuapp_vevif_tx 16>; + mboxes = <&cpuapp_vevif_rx 20>, <&cpuapp_vevif_tx 21>; mbox-names = "rx", "tx"; status = "okay"; }; diff --git a/samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay b/samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay index e1dbd1eaa01e8..c6e59f2b1312e 100644 --- a/samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay +++ b/samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay @@ -39,3 +39,7 @@ &cpuflpr_vevif_tx { status = "okay"; }; + +&uart30 { + /delete-property/ hw-flow-control; +}; diff --git a/samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15pdk_nrf54l15_cpuflpr_icbmsg.overlay b/samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15dk_nrf54l15_cpuflpr_icbmsg.overlay similarity index 91% rename from samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15pdk_nrf54l15_cpuflpr_icbmsg.overlay rename to samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15dk_nrf54l15_cpuflpr_icbmsg.overlay index 56ea0e6a5e4fc..0033e62210739 100644 --- a/samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15pdk_nrf54l15_cpuflpr_icbmsg.overlay +++ b/samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15dk_nrf54l15_cpuflpr_icbmsg.overlay @@ -27,7 +27,7 @@ rx-region = <&sram_rx>; tx-blocks = <18>; rx-blocks = <16>; - mboxes = <&cpuflpr_vevif_rx 16>, <&cpuflpr_vevif_tx 15>; + mboxes = <&cpuflpr_vevif_rx 21>, <&cpuflpr_vevif_tx 20>; mbox-names = "rx", "tx"; status = "okay"; }; diff --git a/samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay b/samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay index 2219b7b78fa0a..b0e1f0d5034f1 100644 --- a/samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay +++ b/samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15pdk_nrf54l15_cpuflpr.overlay @@ -39,3 +39,7 @@ &cpuflpr_vevif_tx { status = "okay"; }; + +&uart30 { + /delete-property/ hw-flow-control; +}; diff --git a/samples/subsys/ipc/ipc_service/icmsg/sample.yaml b/samples/subsys/ipc/ipc_service/icmsg/sample.yaml index b1fc001a45b4f..9305aa61a0382 100644 --- a/samples/subsys/ipc/ipc_service/icmsg/sample.yaml +++ b/samples/subsys/ipc/ipc_service/icmsg/sample.yaml @@ -23,7 +23,7 @@ tests: - "host: IPC-service HOST demo ended" sample.ipc.icmsg.nrf54l15: - platform_allow: nrf54l15dk/nrf54l15/cpuapp nrf54l15pdk/nrf54l15/cpuapp + platform_allow: nrf54l15dk/nrf54l15/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp tags: ipc @@ -43,7 +43,7 @@ tests: - "host: IPC-service HOST demo ended" sample.ipc.icmsg.nrf54l15_no_multithreading: - platform_allow: nrf54l15dk/nrf54l15/cpuapp nrf54l15pdk/nrf54l15/cpuapp + platform_allow: nrf54l15dk/nrf54l15/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp tags: ipc @@ -67,7 +67,7 @@ tests: - "I: IPC-service HOST demo ended" sample.ipc.icmsg.nrf54l15_remote_no_multithreading: - platform_allow: nrf54l15dk/nrf54l15/cpuapp nrf54l15pdk/nrf54l15/cpuapp + platform_allow: nrf54l15dk/nrf54l15/cpuapp integration_platforms: - nrf54l15dk/nrf54l15/cpuapp tags: ipc @@ -89,16 +89,16 @@ tests: - "host: IPC-service HOST demo ended" sample.ipc.icbmsg.nrf54l15: - platform_allow: nrf54l15pdk/nrf54l15/cpuapp + platform_allow: nrf54l15dk/nrf54l15/cpuapp integration_platforms: - - nrf54l15pdk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l15/cpuapp tags: ipc extra_args: icmsg_SNIPPET=nordic-flpr icmsg_CONFIG_IPC_SERVICE_BACKEND_ICBMSG_NUM_EP=1 - icmsg_DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_icbmsg.overlay" + icmsg_DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_icbmsg.overlay" remote_CONFIG_IPC_SERVICE_BACKEND_ICBMSG_NUM_EP=1 - remote_DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuflpr_icbmsg.overlay" + remote_DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuflpr_icbmsg.overlay" sysbuild: true harness: console harness_config: @@ -113,18 +113,18 @@ tests: - "host: IPC-service HOST demo ended" sample.ipc.icbmsg.nrf54l15_no_multithreading: - platform_allow: nrf54l15pdk/nrf54l15/cpuapp + platform_allow: nrf54l15dk/nrf54l15/cpuapp integration_platforms: - - nrf54l15pdk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l15/cpuapp tags: ipc extra_args: icmsg_SNIPPET=nordic-flpr icmsg_CONFIG_IPC_SERVICE_BACKEND_ICBMSG_NUM_EP=1 - icmsg_DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_icbmsg.overlay" + icmsg_DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_icbmsg.overlay" icmsg_CONFIG_MULTITHREADING=n icmsg_CONFIG_LOG_MODE_MINIMAL=y remote_CONFIG_IPC_SERVICE_BACKEND_ICBMSG_NUM_EP=1 - remote_DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuflpr_icbmsg.overlay" + remote_DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuflpr_icbmsg.overlay" remote_CONFIG_MULTITHREADING=n remote_CONFIG_LOG_MODE_MINIMAL=y sysbuild: true @@ -141,16 +141,16 @@ tests: - "host: IPC-service HOST demo ended" sample.ipc.icbmsg.nrf54l15_remote_no_multithreading: - platform_allow: nrf54l15pdk/nrf54l15/cpuapp + platform_allow: nrf54l15dk/nrf54l15/cpuapp integration_platforms: - - nrf54l15pdk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l15/cpuapp tags: ipc extra_args: icmsg_SNIPPET=nordic-flpr icmsg_CONFIG_IPC_SERVICE_BACKEND_ICBMSG_NUM_EP=1 - icmsg_DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuapp_icbmsg.overlay" + icmsg_DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_icbmsg.overlay" remote_CONFIG_IPC_SERVICE_BACKEND_ICBMSG_NUM_EP=1 - remote_DTC_OVERLAY_FILE="boards/nrf54l15pdk_nrf54l15_cpuflpr_icbmsg.overlay" + remote_DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuflpr_icbmsg.overlay" remote_CONFIG_MULTITHREADING=n remote_CONFIG_LOG_MODE_MINIMAL=y sysbuild: true From c6f4e719b78d90d2b27f4f20602db323e9268409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 1 Oct 2024 10:41:07 +0200 Subject: [PATCH 0248/4482] snippets: nordic-log-stm: Do no enforce UART Asynchronous API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UART asynchronous API will ensure highest throughput but it is not necessary as polling API is also supported as a fallback. Do not enforce use of asynchronous API as there might be cases when polling might be used (e.g. to reduce memory footprint). Signed-off-by: Krzysztof Chruściński --- snippets/nordic-log-stm-dict/boards/nrf54h20_cpuapp.conf | 1 - snippets/nordic-log-stm-dict/snippet.yml | 1 - snippets/nordic-log-stm/boards/nrf54h20_cpuapp.conf | 1 - snippets/nordic-log-stm/snippet.yml | 1 - 4 files changed, 4 deletions(-) delete mode 100644 snippets/nordic-log-stm-dict/boards/nrf54h20_cpuapp.conf delete mode 100644 snippets/nordic-log-stm/boards/nrf54h20_cpuapp.conf diff --git a/snippets/nordic-log-stm-dict/boards/nrf54h20_cpuapp.conf b/snippets/nordic-log-stm-dict/boards/nrf54h20_cpuapp.conf deleted file mode 100644 index b4d9d63f77c66..0000000000000 --- a/snippets/nordic-log-stm-dict/boards/nrf54h20_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_UART_ASYNC_API=y diff --git a/snippets/nordic-log-stm-dict/snippet.yml b/snippets/nordic-log-stm-dict/snippet.yml index a482498d1e9bd..6e4f1c6d23e12 100644 --- a/snippets/nordic-log-stm-dict/snippet.yml +++ b/snippets/nordic-log-stm-dict/snippet.yml @@ -5,7 +5,6 @@ boards: /.*/nrf54h20/cpuapp/: append: EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20_cpuapp.overlay - EXTRA_CONF_FILE: boards/nrf54h20_cpuapp.conf /.*/nrf54h20/cpurad/: append: EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20_cpurad.overlay diff --git a/snippets/nordic-log-stm/boards/nrf54h20_cpuapp.conf b/snippets/nordic-log-stm/boards/nrf54h20_cpuapp.conf deleted file mode 100644 index b4d9d63f77c66..0000000000000 --- a/snippets/nordic-log-stm/boards/nrf54h20_cpuapp.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_UART_ASYNC_API=y diff --git a/snippets/nordic-log-stm/snippet.yml b/snippets/nordic-log-stm/snippet.yml index e2ff7b6f8a1ef..0a984a8312cc0 100644 --- a/snippets/nordic-log-stm/snippet.yml +++ b/snippets/nordic-log-stm/snippet.yml @@ -5,7 +5,6 @@ boards: /.*/nrf54h20/cpuapp/: append: EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20_cpuapp.overlay - EXTRA_CONF_FILE: boards/nrf54h20_cpuapp.conf /.*/nrf54h20/cpurad/: append: EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20_cpurad.overlay From 242331291d30d90e80947f0266cb123327b0a289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 1 Oct 2024 10:42:29 +0200 Subject: [PATCH 0249/4482] drivers: misc: coresight: nrf_etr: Imply UART asynchronous API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Asynchronous API is recommended to be used by ETR buffer handler but polling is also supported. Imply UART_ASYNC_API so that it is possible to disable it in project config and fall back to polling if needed. For example to reduce memory footprint. Signed-off-by: Krzysztof Chruściński --- drivers/misc/coresight/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/coresight/Kconfig b/drivers/misc/coresight/Kconfig index f32abe80dab0b..a31d6e3d3f618 100644 --- a/drivers/misc/coresight/Kconfig +++ b/drivers/misc/coresight/Kconfig @@ -7,6 +7,7 @@ config NRF_ETR bool "Coresight ETR handler (with Nordic TBM)" depends on $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_TBM)) select NRFX_TBM + imply UART_ASYNC_API default y help Module handles data stored in the ETR circular buffer (e.g. STM logging From a4d628efcbd7a9a7f0cf9d29b27b0e059a914544 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Tue, 1 Oct 2024 13:36:44 +0200 Subject: [PATCH 0250/4482] tests: Bluetooth: tester: Implement TBS registration TBS registration was changed from static to dynamic and the BT Tester application need to be updated to use the dynamic registration. Signed-off-by: Emil Gydesen --- tests/bluetooth/tester/src/audio/btp_ccp.c | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/bluetooth/tester/src/audio/btp_ccp.c b/tests/bluetooth/tester/src/audio/btp_ccp.c index 5bd9a28458f82..ac1965ab3a961 100644 --- a/tests/bluetooth/tester/src/audio/btp_ccp.c +++ b/tests/bluetooth/tester/src/audio/btp_ccp.c @@ -11,7 +11,9 @@ #include <../../subsys/bluetooth/audio/tbs_internal.h> +#include #include + #define LOG_MODULE_NAME bttester_ccp LOG_MODULE_REGISTER(LOG_MODULE_NAME, CONFIG_BTTESTER_LOG_LEVEL); @@ -1162,11 +1164,46 @@ static const struct btp_handler tbs_handlers[] = { uint8_t tester_init_tbs(void) { + const struct bt_tbs_register_param gtbs_param = { + .provider_name = "Generic TBS", + .uci = "un000", + .uri_schemes_supported = "tel,skype", + .gtbs = true, + .authorization_required = false, + .technology = BT_TBS_TECHNOLOGY_3G, + .supported_features = CONFIG_BT_TBS_SUPPORTED_FEATURES, + }; + const struct bt_tbs_register_param tbs_param = { + .provider_name = "TBS", + .uci = "un000", + .uri_schemes_supported = "tel,skype", + .gtbs = false, + .authorization_required = false, + /* Set different technologies per bearer */ + .technology = BT_TBS_TECHNOLOGY_4G, + .supported_features = CONFIG_BT_TBS_SUPPORTED_FEATURES, + }; + int err; + bt_tbs_register_cb(&tbs_cbs); tester_register_command_handlers(BTP_SERVICE_ID_TBS, tbs_handlers, ARRAY_SIZE(tbs_handlers)); + err = bt_tbs_register_bearer(>bs_param); + if (err < 0) { + LOG_DBG("Failed to register GTBS: %d", err); + + return BTP_STATUS_FAILED; + } + + err = bt_tbs_register_bearer(&tbs_param); + if (err < 0) { + LOG_DBG("Failed to register TBS: %d", err); + + return BTP_STATUS_FAILED; + } + return BTP_STATUS_SUCCESS; } From cbe0abfd0002c761591af0d9ba7bc321d00dc589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 2 Oct 2024 07:23:13 +0200 Subject: [PATCH 0251/4482] tests: drivers: uart: uart_pm: Disable PM_DEVICE_SYSTEM_MANAGED MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When PM_DEVICE_SYSTEM_MANAGED is enabled (and that's the default) all devices are suspended when device go to idle state (through pm subsystem and not through just cpu_idle). In this test we are manually controlling PM of the DUT so we don't want that. Additionally, suspend action is taking a semaphore and it is illegal in idle thread (where system managment operates) which causes assert in kernel scheduler. Removed for nrf54h20 as it applies only there. Signed-off-by: Krzysztof Chruściński --- .../drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.conf | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.conf diff --git a/tests/drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.conf new file mode 100644 index 0000000000000..09f887e0650b7 --- /dev/null +++ b/tests/drivers/uart/uart_pm/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_PM_DEVICE_SYSTEM_MANAGED=n From 79f063e81bd810ff824e6dadfce3bd3110251e03 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 2 Oct 2024 08:41:23 +0200 Subject: [PATCH 0252/4482] doc: connectivity: networking: Update CMake linker info to CoAP server Add missing entry to the documentation to also support CMake linker generator with CoAP services. Update hard coded value with linker script defined value. Signed-off-by: Pieter De Gendt --- doc/connectivity/networking/api/coap_server.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/connectivity/networking/api/coap_server.rst b/doc/connectivity/networking/api/coap_server.rst index 1666880f2fc26..04498098818f9 100644 --- a/doc/connectivity/networking/api/coap_server.rst +++ b/doc/connectivity/networking/api/coap_server.rst @@ -34,15 +34,21 @@ prefixed with ``coap_resource_`` and added to a linker file: #include - ITERABLE_SECTION_RAM(coap_resource_my_service, 4) + ITERABLE_SECTION_RAM(coap_resource_my_service, Z_LINK_ITERABLE_SUBALIGN) Add this linker file to your application using CMake: .. code-block:: cmake :caption: ``CMakeLists.txt`` + # Support LD linker template zephyr_linker_sources(DATA_SECTIONS sections-ram.ld) + # Support CMake linker generator + zephyr_iterable_section(NAME coap_resource_my_service + GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} + SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) + You can now define your service as part of the application: .. code-block:: c From e9d24aa7dabd14f3cc7081637828adcfdfffc443 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 2 Oct 2024 08:42:32 +0200 Subject: [PATCH 0253/4482] doc: connectivity: networking: Update HTTP linker example Update the HTTP linker example to use a CMake variable instead of a global defined macro. Signed-off-by: Pieter De Gendt --- doc/connectivity/networking/api/http_server.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/connectivity/networking/api/http_server.rst b/doc/connectivity/networking/api/http_server.rst index e47e9801d59a8..cd4ac39e1a14f 100644 --- a/doc/connectivity/networking/api/http_server.rst +++ b/doc/connectivity/networking/api/http_server.rst @@ -78,7 +78,7 @@ using CMake: zephyr_linker_sources(SECTIONS sections-rom.ld) zephyr_linker_section(NAME http_resource_desc_my_service KVMA RAM_REGION GROUP RODATA_REGION - SUBALIGN Z_LINK_ITERABLE_SUBALIGN) + SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) .. note:: From 668a5dc55dab30fa1735e765b0cec15ef171b8bb Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 2 Oct 2024 08:44:00 +0200 Subject: [PATCH 0254/4482] samples: net: sockets: Update HTTP server linker with CMake variable Use the CMake variable for iterable section's subalignment instead of a global defined macro. Signed-off-by: Pieter De Gendt --- samples/net/sockets/http_server/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/net/sockets/http_server/CMakeLists.txt b/samples/net/sockets/http_server/CMakeLists.txt index ab62db054d1a7..b4853257c786f 100644 --- a/samples/net/sockets/http_server/CMakeLists.txt +++ b/samples/net/sockets/http_server/CMakeLists.txt @@ -35,11 +35,11 @@ zephyr_linker_sources(SECTIONS sections-rom.ld) zephyr_linker_section_ifdef(CONFIG_NET_SAMPLE_HTTPS_SERVICE NAME http_resource_desc_test_https_service KVMA RAM_REGION GROUP RODATA_REGION - SUBALIGN Z_LINK_ITERABLE_SUBALIGN) + SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) zephyr_linker_section_ifdef(CONFIG_NET_SAMPLE_HTTP_SERVICE NAME http_resource_desc_test_http_service KVMA RAM_REGION GROUP RODATA_REGION - SUBALIGN Z_LINK_ITERABLE_SUBALIGN) + SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) foreach(web_resource index.html From ad673d18b77cd14c1ec47af186c6560f44af76a8 Mon Sep 17 00:00:00 2001 From: Yassine El Aissaoui Date: Wed, 2 Oct 2024 10:23:37 +0200 Subject: [PATCH 0255/4482] soc: rw: Fix stack over flow during BLE init RW requires more stack size now, value changed from 1024 to 1280. Signed-off-by: Yassine El Aissaoui --- soc/nxp/rw/Kconfig.defconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/soc/nxp/rw/Kconfig.defconfig b/soc/nxp/rw/Kconfig.defconfig index 284c5e7377da4..ed5d5d4c0577b 100644 --- a/soc/nxp/rw/Kconfig.defconfig +++ b/soc/nxp/rw/Kconfig.defconfig @@ -25,6 +25,9 @@ config HCI_NXP_ENABLE_AUTO_SLEEP config HCI_NXP_SET_CAL_DATA default y +config MAIN_STACK_SIZE + default 1280 + endif # BT config NXP_MONOLITHIC_WIFI From 0376a417fd8d2b5d2b5c2f0d5f0af0de7432433c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Wed, 2 Oct 2024 10:37:29 +0200 Subject: [PATCH 0256/4482] tests: net: ipv6: Enable mbed TLS heap mbed TLS MD operations, used by IPv6 Privacy Extensions, require access to heap. This may vary depending on platform/mbed TLS variant used, hence enable CONFIG_MBEDTLS_ENABLE_HEAP in tests to ensure mbed TLS has always access to some heap memory. Signed-off-by: Robert Lubos --- tests/net/ipv6/prj.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/net/ipv6/prj.conf b/tests/net/ipv6/prj.conf index b2b2f0886733b..51cfa883727d4 100644 --- a/tests/net/ipv6/prj.conf +++ b/tests/net/ipv6/prj.conf @@ -36,3 +36,6 @@ CONFIG_NET_IPV6_PE_PREFER_PUBLIC_ADDRESSES=n # Increase the stack a bit for mps2/an385 CONFIG_NET_RX_STACK_SIZE=1700 + +# Make sure mbedTLS has access to heap +CONFIG_MBEDTLS_ENABLE_HEAP=y From 796b795cda29441e8688702d028997689a377f40 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Fri, 4 Oct 2024 01:37:04 +0800 Subject: [PATCH 0257/4482] drivers: intc: plic: fix for SMP=n when MP_MAX_NUM_CPUS > 1 The functions to obtain the address are hardcoded to return the address of the first core when `CONFIG_SMP != y`, this causes an issue with enabling an IRQ when there are more than one core in the system (`CONFIG_MP_MAX_NUM_CPUS > 1`), as the driver would first enable the IRQ on the first core, and when it tries to obtain the address for the following cores and disable the IRQ on them, the functions continue to return the address of the first core, causing the IRQ to be disabled on the first core. Fix this by determine if `CONFIG_MP_MAX_NUM_CPUS > 1` instead of `CONFIG_SMP=y` when returning the address. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- drivers/interrupt_controller/intc_plic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/interrupt_controller/intc_plic.c b/drivers/interrupt_controller/intc_plic.c index 7407f493694de..0ad9aa831a8f4 100644 --- a/drivers/interrupt_controller/intc_plic.c +++ b/drivers/interrupt_controller/intc_plic.c @@ -164,7 +164,7 @@ static inline mem_addr_t get_context_en_addr(const struct device *dev, uint32_t /* * We want to return the irq_en address for the context of given hart. */ -#if CONFIG_SMP +#if CONFIG_MP_MAX_NUM_CPUS > 1 hartid = _kernel.cpus[cpu_num].arch.hartid; #else hartid = arch_proc_id(); @@ -188,7 +188,7 @@ static inline mem_addr_t get_threshold_priority_addr(const struct device *dev, u const struct plic_config *config = dev->config; uint32_t hartid; -#if CONFIG_SMP +#if CONFIG_MP_MAX_NUM_CPUS > 1 hartid = _kernel.cpus[cpu_num].arch.hartid; #else hartid = arch_proc_id(); @@ -493,7 +493,7 @@ static void plic_irq_handler(const struct device *dev) * * (by RISC-V Privileged Architecture v1.10) */ - if (IS_ENABLED(CONFIG_SMP) && (local_irq == 0U)) { + if ((CONFIG_MP_MAX_NUM_CPUS > 1) && (local_irq == 0U)) { return; } From 453dfed3ad00aece8bd8edee2fec460fb92c273f Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Fri, 4 Oct 2024 01:38:33 +0800 Subject: [PATCH 0258/4482] arch: riscv: smp: prevent nested #ifdef The `CONFIG_PLIC_IRQ_AFFINITY` depends on `CONFIG_SMP` in the Kconfig layer, nested #ifdef can be avoided for readability. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- arch/riscv/core/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/core/smp.c b/arch/riscv/core/smp.c index bc56c1fba8c6f..15cb006395019 100644 --- a/arch/riscv/core/smp.c +++ b/arch/riscv/core/smp.c @@ -74,11 +74,11 @@ void arch_secondary_cpu_init(int hartid) #endif #ifdef CONFIG_SMP irq_enable(RISCV_IRQ_MSOFT); +#endif /* CONFIG_SMP */ #ifdef CONFIG_PLIC_IRQ_AFFINITY /* Enable on secondary cores so that they can respond to PLIC */ irq_enable(RISCV_IRQ_MEXT); #endif /* CONFIG_PLIC_IRQ_AFFINITY */ -#endif /* CONFIG_SMP */ riscv_cpu_init[cpu_num].fn(riscv_cpu_init[cpu_num].arg); } From e1cacb3a183968598e0baa12f3d7a84de3fe401a Mon Sep 17 00:00:00 2001 From: Krzysztof Bartnicki Date: Thu, 3 Oct 2024 22:39:56 +0200 Subject: [PATCH 0259/4482] net: dns: Fix DNS resolver cache invalid find call The size of the output array for the find call in resolver is invalid: expected array size while overall memory size provided. As the latter is bigger there is a high probability of memory overwrite occurring on the stack. Signed-off-by: Krzysztof Bartnicki --- subsys/net/lib/dns/resolve.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/dns/resolve.c b/subsys/net/lib/dns/resolve.c index 14cd6890541ad..5e536717e8491 100644 --- a/subsys/net/lib/dns/resolve.c +++ b/subsys/net/lib/dns/resolve.c @@ -1300,7 +1300,7 @@ int dns_resolve_name(struct dns_resolve_context *ctx, try_resolve: #ifdef CONFIG_DNS_RESOLVER_CACHE - ret = dns_cache_find(&dns_cache, query, cached_info, sizeof(cached_info)); + ret = dns_cache_find(&dns_cache, query, cached_info, ARRAY_SIZE(cached_info)); if (ret > 0) { /* The query was cached, no * need to continue further. From dc97bbd35f6bca23aed1364550bb9b2c74abd904 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Fri, 2 Aug 2024 11:23:33 +0200 Subject: [PATCH 0260/4482] Bluetooth: Audio: Rename bt_audio_codec_qos -> bt_bap_qos_cfg The QoS structure is not related to a codec, but rather a stream, and should thus not use the "Codec" name. The BAP and ASCS specs refer to the QoS as "QoS configuration" several places, so it is an obvious choice for a name. Since the structure is defined and used by BAP, the prefix was changed from bt_audio to bt_bap. Signed-off-by: Emil Gydesen --- doc/releases/migration-guide-4.0.rst | 5 + include/zephyr/bluetooth/audio/audio.h | 255 ---------------- include/zephyr/bluetooth/audio/bap.h | 274 +++++++++++++++++- .../zephyr/bluetooth/audio/bap_lc3_preset.h | 133 ++++----- include/zephyr/bluetooth/audio/cap.h | 2 +- .../zephyr/bluetooth/audio/gmap_lc3_preset.h | 34 +-- .../bluetooth/bap_unicast_client/src/main.c | 3 +- .../bluetooth/bap_unicast_server/src/main.c | 12 +- .../cap_acceptor/src/cap_acceptor_unicast.c | 14 +- .../cap_initiator/src/cap_initiator_unicast.c | 2 +- samples/bluetooth/hap_ha/src/bap_unicast_sr.c | 12 +- .../tmap_central/src/cap_initiator.c | 2 +- .../tmap_peripheral/src/bap_unicast_sr.c | 12 +- subsys/bluetooth/audio/ascs.c | 18 +- subsys/bluetooth/audio/ascs_internal.h | 2 +- subsys/bluetooth/audio/bap_broadcast_sink.c | 14 +- subsys/bluetooth/audio/bap_broadcast_source.c | 12 +- subsys/bluetooth/audio/bap_endpoint.h | 8 +- subsys/bluetooth/audio/bap_stream.c | 28 +- subsys/bluetooth/audio/bap_stream.h | 9 +- subsys/bluetooth/audio/bap_unicast_client.c | 36 +-- .../audio/bap_unicast_client_internal.h | 2 +- subsys/bluetooth/audio/bap_unicast_server.c | 2 +- subsys/bluetooth/audio/cap_stream.c | 2 +- subsys/bluetooth/audio/shell/audio.h | 6 +- subsys/bluetooth/audio/shell/bap.c | 18 +- .../audio/ascs/include/bap_unicast_server.h | 6 +- tests/bluetooth/audio/ascs/src/main.c | 6 +- .../audio/ascs/src/test_ase_control_params.c | 6 +- .../ascs/src/test_ase_state_transition.c | 4 +- tests/bluetooth/audio/ascs/src/test_common.c | 6 +- .../audio/ascs/uut/bap_unicast_server.c | 6 +- .../audio/bap_broadcast_source/src/main.c | 16 +- .../cap_initiator/uut/bap_unicast_client.c | 2 +- .../audio/mocks/include/bap_stream.h | 2 +- tests/bluetooth/audio/mocks/src/bap_stream.c | 2 +- .../tester/src/audio/btp_bap_broadcast.c | 2 +- .../tester/src/audio/btp_bap_broadcast.h | 4 +- .../tester/src/audio/btp_bap_unicast.c | 21 +- .../tester/src/audio/btp_bap_unicast.h | 2 +- tests/bluetooth/tester/src/audio/btp_cap.c | 10 +- tests/bsim/bluetooth/audio/src/bap_common.c | 2 +- tests/bsim/bluetooth/audio/src/bap_common.h | 4 +- .../audio/src/bap_unicast_client_test.c | 8 +- .../audio/src/bap_unicast_server_test.c | 10 +- .../bluetooth/audio/src/cap_acceptor_test.c | 10 +- .../audio/src/cap_initiator_broadcast_test.c | 2 +- .../audio/src/cap_initiator_unicast_test.c | 6 +- .../bsim/bluetooth/audio/src/gmap_ugg_test.c | 4 +- .../bsim/bluetooth/audio/src/gmap_ugt_test.c | 10 +- 50 files changed, 531 insertions(+), 537 deletions(-) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 7044aac712a58..efd7c480e2fd6 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -317,6 +317,11 @@ Bluetooth Audio unregistered with :c:func:`bt_tbs_unregister_bearer`. (:github:`76108`) +* There has been a rename from ``bt_audio_codec_qos`` to ``bt_bap_qos_cfg``. This effects all + structs, enums and defines that used the ``bt_audio_codec_qos`` name. To use the new naming simply + do a search-and-replace for ``bt_audio_codec_qos`` to ``bt_bap_qos_cfg`` and + ``BT_AUDIO_CODEC_QOS`` to ``BT_BAP_QOS_CFG``. (:github:`76633`) + Bluetooth Classic ================= diff --git a/include/zephyr/bluetooth/audio/audio.h b/include/zephyr/bluetooth/audio/audio.h index 402e8e4394d66..03660dfb53b21 100644 --- a/include/zephyr/bluetooth/audio/audio.h +++ b/include/zephyr/bluetooth/audio/audio.h @@ -790,261 +790,6 @@ enum bt_audio_dir { BT_AUDIO_DIR_SOURCE = 0x02, }; -/** - * @brief Helper to declare elements of bt_audio_codec_qos - * - * @param _interval SDU interval (usec) - * @param _framing Framing - * @param _phy Target PHY - * @param _sdu Maximum SDU Size - * @param _rtn Retransmission number - * @param _latency Maximum Transport Latency (msec) - * @param _pd Presentation Delay (usec) - */ -#define BT_AUDIO_CODEC_QOS(_interval, _framing, _phy, _sdu, _rtn, _latency, _pd) \ - ((struct bt_audio_codec_qos){ \ - .interval = _interval, \ - .framing = _framing, \ - .phy = _phy, \ - .sdu = _sdu, \ - .rtn = _rtn, \ - IF_ENABLED(UTIL_OR(IS_ENABLED(CONFIG_BT_BAP_BROADCAST_SOURCE), \ - IS_ENABLED(CONFIG_BT_BAP_UNICAST)), \ - (.latency = _latency,)) \ - .pd = _pd, \ - }) - -/** @brief Codec QoS Framing */ -enum bt_audio_codec_qos_framing { - /** Packets may be framed or unframed */ - BT_AUDIO_CODEC_QOS_FRAMING_UNFRAMED = 0x00, - /** Packets are always framed */ - BT_AUDIO_CODEC_QOS_FRAMING_FRAMED = 0x01, -}; - -/** @brief Codec QoS Preferred PHY */ -enum { - /** LE 1M PHY */ - BT_AUDIO_CODEC_QOS_1M = BIT(0), - /** LE 2M PHY */ - BT_AUDIO_CODEC_QOS_2M = BIT(1), - /** LE Coded PHY */ - BT_AUDIO_CODEC_QOS_CODED = BIT(2), -}; - -/** - * @brief Helper to declare Input Unframed bt_audio_codec_qos - * - * @param _interval SDU interval (usec) - * @param _sdu Maximum SDU Size - * @param _rtn Retransmission number - * @param _latency Maximum Transport Latency (msec) - * @param _pd Presentation Delay (usec) - */ -#define BT_AUDIO_CODEC_QOS_UNFRAMED(_interval, _sdu, _rtn, _latency, _pd) \ - BT_AUDIO_CODEC_QOS(_interval, BT_AUDIO_CODEC_QOS_FRAMING_UNFRAMED, BT_AUDIO_CODEC_QOS_2M, \ - _sdu, _rtn, _latency, _pd) - -/** - * @brief Helper to declare Input Framed bt_audio_codec_qos - * - * @param _interval SDU interval (usec) - * @param _sdu Maximum SDU Size - * @param _rtn Retransmission number - * @param _latency Maximum Transport Latency (msec) - * @param _pd Presentation Delay (usec) - */ -#define BT_AUDIO_CODEC_QOS_FRAMED(_interval, _sdu, _rtn, _latency, _pd) \ - BT_AUDIO_CODEC_QOS(_interval, BT_AUDIO_CODEC_QOS_FRAMING_FRAMED, BT_AUDIO_CODEC_QOS_2M, \ - _sdu, _rtn, _latency, _pd) - -/** @brief Codec QoS structure. */ -struct bt_audio_codec_qos { - /** - * @brief Presentation Delay in microseconds - * - * This value can be changed up and until bt_bap_stream_qos() has been called. - * Once a stream has been QoS configured, modifying this field does not modify the value. - * It is however possible to modify this field and call bt_bap_stream_qos() again to update - * the value, assuming that the stream is in the correct state. - * - * Value range 0 to @ref BT_AUDIO_PD_MAX. - */ - uint32_t pd; - - /** - * @brief Connected Isochronous Group (CIG) parameters - * - * The fields in this struct affect the value sent to the controller via HCI - * when creating the CIG. Once the group has been created with - * bt_bap_unicast_group_create(), modifying these fields will not affect the group. - */ - struct { - /** QoS Framing */ - enum bt_audio_codec_qos_framing framing; - - /** - * @brief PHY - * - * Allowed values are @ref BT_AUDIO_CODEC_QOS_1M, @ref BT_AUDIO_CODEC_QOS_2M and - * @ref BT_AUDIO_CODEC_QOS_CODED. - */ - uint8_t phy; - - /** - * @brief Retransmission Number - * - * This a recommendation to the controller, and the actual retransmission number - * may be different than this. - */ - uint8_t rtn; - - /** - * @brief Maximum SDU size - * - * Value range @ref BT_ISO_MIN_SDU to @ref BT_ISO_MAX_SDU. - */ - uint16_t sdu; - -#if defined(CONFIG_BT_BAP_BROADCAST_SOURCE) || defined(CONFIG_BT_BAP_UNICAST) || \ - defined(__DOXYGEN__) - /** - * @brief Maximum Transport Latency - * - * Not used for the @kconfig{CONFIG_BT_BAP_BROADCAST_SINK} role. - */ - uint16_t latency; -#endif /* CONFIG_BT_BAP_BROADCAST_SOURCE || CONFIG_BT_BAP_UNICAST */ - - /** - * @brief SDU Interval - * - * Value range @ref BT_ISO_SDU_INTERVAL_MIN to @ref BT_ISO_SDU_INTERVAL_MAX - */ - uint32_t interval; - -#if defined(CONFIG_BT_ISO_TEST_PARAMS) || defined(__DOXYGEN__) - /** - * @brief Maximum PDU size - * - * Maximum size, in octets, of the payload from link layer to link layer. - * - * Value range @ref BT_ISO_CONNECTED_PDU_MIN to @ref BT_ISO_PDU_MAX for - * connected ISO. - * - * Value range @ref BT_ISO_BROADCAST_PDU_MIN to @ref BT_ISO_PDU_MAX for - * broadcast ISO. - */ - uint16_t max_pdu; - - /** - * @brief Burst number - * - * Value range @ref BT_ISO_BN_MIN to @ref BT_ISO_BN_MAX. - */ - uint8_t burst_number; - - /** - * @brief Number of subevents - * - * Maximum number of subevents in each CIS or BIS event. - * - * Value range @ref BT_ISO_NSE_MIN to @ref BT_ISO_NSE_MAX. - */ - uint8_t num_subevents; -#endif /* CONFIG_BT_ISO_TEST_PARAMS */ - }; -}; - -/** - * @brief Helper to declare elements of @ref bt_audio_codec_qos_pref - * - * @param _unframed_supported Unframed PDUs supported - * @param _phy Preferred Target PHY - * @param _rtn Preferred Retransmission number - * @param _latency Preferred Maximum Transport Latency (msec) - * @param _pd_min Minimum Presentation Delay (usec) - * @param _pd_max Maximum Presentation Delay (usec) - * @param _pref_pd_min Preferred Minimum Presentation Delay (usec) - * @param _pref_pd_max Preferred Maximum Presentation Delay (usec) - */ -#define BT_AUDIO_CODEC_QOS_PREF(_unframed_supported, _phy, _rtn, _latency, _pd_min, _pd_max, \ - _pref_pd_min, _pref_pd_max) \ - { \ - .unframed_supported = _unframed_supported, \ - .phy = _phy, \ - .rtn = _rtn, \ - .latency = _latency, \ - .pd_min = _pd_min, \ - .pd_max = _pd_max, \ - .pref_pd_min = _pref_pd_min, \ - .pref_pd_max = _pref_pd_max, \ - } - -/** @brief Audio Stream Quality of Service Preference structure. */ -struct bt_audio_codec_qos_pref { - /** - * @brief Unframed PDUs supported - * - * Unlike the other fields, this is not a preference but whether - * the codec supports unframed ISOAL PDUs. - */ - bool unframed_supported; - - /** - * @brief Preferred PHY bitfield - * - * Bitfield consisting of one or more of @ref BT_GAP_LE_PHY_1M, @ref BT_GAP_LE_PHY_2M and - * @ref BT_GAP_LE_PHY_CODED. - */ - uint8_t phy; - - /** Preferred Retransmission Number */ - uint8_t rtn; - - /** - * Preferred Transport Latency - * - * Value range @ref BT_ISO_LATENCY_MIN to @ref BT_ISO_LATENCY_MAX - */ - uint16_t latency; - - /** - * @brief Minimum Presentation Delay in microseconds - * - * Unlike the other fields, this is not a preference but a minimum requirement. - * - * Value range 0 to @ref BT_AUDIO_PD_MAX, or @ref BT_AUDIO_PD_PREF_NONE - * to indicate no preference. - */ - uint32_t pd_min; - - /** - * @brief Maximum Presentation Delay - * - * Unlike the other fields, this is not a preference but a maximum requirement. - * - * Value range 0 to @ref BT_AUDIO_PD_MAX, or @ref BT_AUDIO_PD_PREF_NONE - * to indicate no preference. - */ - uint32_t pd_max; - - /** - * @brief Preferred minimum Presentation Delay - * - * Value range @ref bt_audio_codec_qos_pref.pd_min to @ref bt_audio_codec_qos_pref.pd_max. - */ - uint32_t pref_pd_min; - - /** - * @brief Preferred maximum Presentation Delay - * - * Value range @ref bt_audio_codec_qos_pref.pd_min to @ref bt_audio_codec_qos_pref.pd_max, - * and higher than @ref bt_audio_codec_qos_pref.pref_pd_min - */ - uint32_t pref_pd_max; -}; - /** * @brief Audio codec Config APIs * @defgroup bt_audio_codec_cfg Codec config parsing APIs diff --git a/include/zephyr/bluetooth/audio/bap.h b/include/zephyr/bluetooth/audio/bap.h index 1822a80b654fa..583644a37e8c8 100644 --- a/include/zephyr/bluetooth/audio/bap.h +++ b/include/zephyr/bluetooth/audio/bap.h @@ -35,11 +35,262 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { #endif +/** + * @brief Helper to declare elements of bt_bap_qos_cfg + * + * @param _interval SDU interval (usec) + * @param _framing Framing + * @param _phy Target PHY + * @param _sdu Maximum SDU Size + * @param _rtn Retransmission number + * @param _latency Maximum Transport Latency (msec) + * @param _pd Presentation Delay (usec) + */ +#define BT_BAP_QOS_CFG(_interval, _framing, _phy, _sdu, _rtn, _latency, _pd) \ + ((struct bt_bap_qos_cfg){ \ + .interval = _interval, \ + .framing = _framing, \ + .phy = _phy, \ + .sdu = _sdu, \ + .rtn = _rtn, \ + IF_ENABLED(UTIL_OR(IS_ENABLED(CONFIG_BT_BAP_BROADCAST_SOURCE), \ + IS_ENABLED(CONFIG_BT_BAP_UNICAST)), \ + (.latency = _latency,)) \ + .pd = _pd, \ + }) + +/** @brief QoS Framing */ +enum bt_bap_qos_cfg_framing { + /** Packets may be framed or unframed */ + BT_BAP_QOS_CFG_FRAMING_UNFRAMED = 0x00, + /** Packets are always framed */ + BT_BAP_QOS_CFG_FRAMING_FRAMED = 0x01, +}; + +/** @brief QoS Preferred PHY */ +enum { + /** LE 1M PHY */ + BT_BAP_QOS_CFG_1M = BIT(0), + /** LE 2M PHY */ + BT_BAP_QOS_CFG_2M = BIT(1), + /** LE Coded PHY */ + BT_BAP_QOS_CFG_CODED = BIT(2), +}; + +/** + * @brief Helper to declare Input Unframed bt_bap_qos_cfg + * + * @param _interval SDU interval (usec) + * @param _sdu Maximum SDU Size + * @param _rtn Retransmission number + * @param _latency Maximum Transport Latency (msec) + * @param _pd Presentation Delay (usec) + */ +#define BT_BAP_QOS_CFG_UNFRAMED(_interval, _sdu, _rtn, _latency, _pd) \ + BT_BAP_QOS_CFG(_interval, BT_BAP_QOS_CFG_FRAMING_UNFRAMED, BT_BAP_QOS_CFG_2M, _sdu, _rtn, \ + _latency, _pd) + +/** + * @brief Helper to declare Input Framed bt_bap_qos_cfg + * + * @param _interval SDU interval (usec) + * @param _sdu Maximum SDU Size + * @param _rtn Retransmission number + * @param _latency Maximum Transport Latency (msec) + * @param _pd Presentation Delay (usec) + */ +#define BT_BAP_QOS_CFG_FRAMED(_interval, _sdu, _rtn, _latency, _pd) \ + BT_BAP_QOS_CFG(_interval, BT_BAP_QOS_CFG_FRAMING_FRAMED, BT_BAP_QOS_CFG_2M, _sdu, _rtn, \ + _latency, _pd) + +/** @brief QoS configuration structure. */ +struct bt_bap_qos_cfg { + /** + * @brief Presentation Delay in microseconds + * + * This value can be changed up and until bt_bap_stream_qos() has been called. + * Once a stream has been QoS configured, modifying this field does not modify the value. + * It is however possible to modify this field and call bt_bap_stream_qos() again to update + * the value, assuming that the stream is in the correct state. + * + * Value range 0 to @ref BT_AUDIO_PD_MAX. + */ + uint32_t pd; + + /** + * @brief Connected Isochronous Group (CIG) parameters + * + * The fields in this struct affect the value sent to the controller via HCI + * when creating the CIG. Once the group has been created with + * bt_bap_unicast_group_create(), modifying these fields will not affect the group. + */ + struct { + /** QoS Framing */ + enum bt_bap_qos_cfg_framing framing; + + /** + * @brief PHY + * + * Allowed values are @ref BT_BAP_QOS_CFG_1M, @ref BT_BAP_QOS_CFG_2M and + * @ref BT_BAP_QOS_CFG_CODED. + */ + uint8_t phy; + + /** + * @brief Retransmission Number + * + * This a recommendation to the controller, and the actual retransmission number + * may be different than this. + */ + uint8_t rtn; + + /** + * @brief Maximum SDU size + * + * Value range @ref BT_ISO_MIN_SDU to @ref BT_ISO_MAX_SDU. + */ + uint16_t sdu; + +#if defined(CONFIG_BT_BAP_BROADCAST_SOURCE) || defined(CONFIG_BT_BAP_UNICAST) || \ + defined(__DOXYGEN__) + /** + * @brief Maximum Transport Latency + * + * Not used for the @kconfig{CONFIG_BT_BAP_BROADCAST_SINK} role. + */ + uint16_t latency; +#endif /* CONFIG_BT_BAP_BROADCAST_SOURCE || CONFIG_BT_BAP_UNICAST */ + + /** + * @brief SDU Interval + * + * Value range @ref BT_ISO_SDU_INTERVAL_MIN to @ref BT_ISO_SDU_INTERVAL_MAX + */ + uint32_t interval; + +#if defined(CONFIG_BT_ISO_TEST_PARAMS) || defined(__DOXYGEN__) + /** + * @brief Maximum PDU size + * + * Maximum size, in octets, of the payload from link layer to link layer. + * + * Value range @ref BT_ISO_CONNECTED_PDU_MIN to @ref BT_ISO_PDU_MAX for + * connected ISO. + * + * Value range @ref BT_ISO_BROADCAST_PDU_MIN to @ref BT_ISO_PDU_MAX for + * broadcast ISO. + */ + uint16_t max_pdu; + + /** + * @brief Burst number + * + * Value range @ref BT_ISO_BN_MIN to @ref BT_ISO_BN_MAX. + */ + uint8_t burst_number; + + /** + * @brief Number of subevents + * + * Maximum number of subevents in each CIS or BIS event. + * + * Value range @ref BT_ISO_NSE_MIN to @ref BT_ISO_NSE_MAX. + */ + uint8_t num_subevents; +#endif /* CONFIG_BT_ISO_TEST_PARAMS */ + }; +}; + +/** + * @brief Helper to declare elements of @ref bt_bap_qos_cfg_pref + * + * @param _unframed_supported Unframed PDUs supported + * @param _phy Preferred Target PHY + * @param _rtn Preferred Retransmission number + * @param _latency Preferred Maximum Transport Latency (msec) + * @param _pd_min Minimum Presentation Delay (usec) + * @param _pd_max Maximum Presentation Delay (usec) + * @param _pref_pd_min Preferred Minimum Presentation Delay (usec) + * @param _pref_pd_max Preferred Maximum Presentation Delay (usec) + */ +#define BT_BAP_QOS_CFG_PREF(_unframed_supported, _phy, _rtn, _latency, _pd_min, _pd_max, \ + _pref_pd_min, _pref_pd_max) \ + { \ + .unframed_supported = _unframed_supported, .phy = _phy, .rtn = _rtn, \ + .latency = _latency, .pd_min = _pd_min, .pd_max = _pd_max, \ + .pref_pd_min = _pref_pd_min, .pref_pd_max = _pref_pd_max, \ + } + +/** @brief Audio Stream Quality of Service Preference structure. */ +struct bt_bap_qos_cfg_pref { + /** + * @brief Unframed PDUs supported + * + * Unlike the other fields, this is not a preference but whether + * the codec supports unframed ISOAL PDUs. + */ + bool unframed_supported; + + /** + * @brief Preferred PHY bitfield + * + * Bitfield consisting of one or more of @ref BT_GAP_LE_PHY_1M, @ref BT_GAP_LE_PHY_2M and + * @ref BT_GAP_LE_PHY_CODED. + */ + uint8_t phy; + + /** Preferred Retransmission Number */ + uint8_t rtn; + + /** + * Preferred Transport Latency + * + * Value range @ref BT_ISO_LATENCY_MIN to @ref BT_ISO_LATENCY_MAX + */ + uint16_t latency; + + /** + * @brief Minimum Presentation Delay in microseconds + * + * Unlike the other fields, this is not a preference but a minimum requirement. + * + * Value range 0 to @ref BT_AUDIO_PD_MAX + */ + uint32_t pd_min; + + /** + * @brief Maximum Presentation Delay in microseconds + * + * Unlike the other fields, this is not a preference but a maximum requirement. + * + * Value range @ref bt_bap_qos_cfg_pref.pd_min to @ref BT_AUDIO_PD_MAX + */ + uint32_t pd_max; + + /** + * @brief Preferred minimum Presentation Delay in microseconds + * + * Value range @ref bt_bap_qos_cfg_pref.pd_min to @ref bt_bap_qos_cfg_pref.pd_max, or + * @ref BT_AUDIO_PD_PREF_NONE to indicate no preference. + */ + uint32_t pref_pd_min; + + /** + * @brief Preferred maximum Presentation Delay in microseconds + * + * Value range @ref bt_bap_qos_cfg_pref.pd_min to @ref bt_bap_qos_cfg_pref.pd_max, + * and higher than or equal to @ref bt_bap_qos_cfg_pref.pref_pd_min, or + * @ref BT_AUDIO_PD_PREF_NONE to indicate no preference. + */ + uint32_t pref_pd_max; +}; + /** Periodic advertising state reported by the Scan Delegator */ enum bt_bap_pa_state { /** The periodic advertising has not been synchronized */ @@ -435,7 +686,7 @@ struct bt_bap_ep_info { struct bt_bap_ep *paired_ep; /** Pointer to the preferred QoS settings associated with the endpoint */ - const struct bt_audio_codec_qos_pref *qos_pref; + const struct bt_bap_qos_cfg_pref *qos_pref; }; /** @@ -468,7 +719,7 @@ struct bt_bap_stream { struct bt_audio_codec_cfg *codec_cfg; /** QoS Configuration */ - struct bt_audio_codec_qos *qos; + struct bt_bap_qos_cfg *qos; /** Audio stream operations */ struct bt_bap_stream_ops *ops; @@ -508,8 +759,7 @@ struct bt_bap_stream_ops { * @param stream Stream object that has been configured. * @param pref Remote QoS preferences. */ - void (*configured)(struct bt_bap_stream *stream, - const struct bt_audio_codec_qos_pref *pref); + void (*configured)(struct bt_bap_stream *stream, const struct bt_bap_qos_cfg_pref *pref); /** * @brief Stream QoS set callback @@ -917,7 +1167,7 @@ struct bt_bap_unicast_server_cb { */ int (*config)(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, struct bt_bap_stream **stream, - struct bt_audio_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp); + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp); /** * @brief Stream reconfig request callback @@ -937,7 +1187,7 @@ struct bt_bap_unicast_server_cb { */ int (*reconfig)(struct bt_bap_stream *stream, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, - struct bt_audio_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp); + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp); /** * @brief Stream QoS request callback @@ -952,7 +1202,7 @@ struct bt_bap_unicast_server_cb { * * @return 0 in case of success or negative value in case of error. */ - int (*qos)(struct bt_bap_stream *stream, const struct bt_audio_codec_qos *qos, + int (*qos)(struct bt_bap_stream *stream, const struct bt_bap_qos_cfg *qos, struct bt_bap_ascs_rsp *rsp); /** @@ -1128,7 +1378,7 @@ void bt_bap_unicast_server_foreach_ep(struct bt_conn *conn, bt_bap_ep_func_t fun */ int bt_bap_unicast_server_config_ase(struct bt_conn *conn, struct bt_bap_stream *stream, struct bt_audio_codec_cfg *codec_cfg, - const struct bt_audio_codec_qos_pref *qos_pref); + const struct bt_bap_qos_cfg_pref *qos_pref); /** @} */ /* End of group bt_bap_unicast_server */ @@ -1144,7 +1394,7 @@ struct bt_bap_unicast_group_stream_param { struct bt_bap_stream *stream; /** The QoS settings for the stream object. */ - struct bt_audio_codec_qos *qos; + struct bt_bap_qos_cfg *qos; }; /** @@ -1216,7 +1466,7 @@ struct bt_bap_unicast_group_param { * Create a new audio unicast group with one or more audio streams as a unicast client. * All streams shall share the same framing. * All streams in the same direction shall share the same interval and latency (see - * @ref bt_audio_codec_qos). + * @ref bt_bap_qos_cfg). * * @param[in] param The unicast group create parameters. * @param[out] unicast_group Pointer to the unicast group created. @@ -1232,7 +1482,7 @@ int bt_bap_unicast_group_create(struct bt_bap_unicast_group_param *param, * Reconfigure a unicast group with one or more audio streams as a unicast client. * All streams shall share the same framing. * All streams in the same direction shall share the same interval and latency (see - * @ref bt_audio_codec_qos). + * @ref bt_bap_qos_cfg). * All streams in @p param shall already belong to @p unicast_group. * Use bt_bap_unicast_group_add_streams() to add additional streams. * @@ -1738,7 +1988,7 @@ struct bt_bap_broadcast_source_param { struct bt_bap_broadcast_source_subgroup_param *params; /** Quality of Service configuration. */ - struct bt_audio_codec_qos *qos; + struct bt_bap_qos_cfg *qos; /** * @brief Broadcast Source packing mode. diff --git a/include/zephyr/bluetooth/audio/bap_lc3_preset.h b/include/zephyr/bluetooth/audio/bap_lc3_preset.h index ac9b95330845a..2a4005ddf5ced 100644 --- a/include/zephyr/bluetooth/audio/bap_lc3_preset.h +++ b/include/zephyr/bluetooth/audio/bap_lc3_preset.h @@ -21,12 +21,13 @@ * @ingroup bluetooth * @{ * - * These APIs provide preset for codec configuration and codec QoS based on values supplied by the + * These APIs provide preset for codec configuration and QoS based on values supplied by the * codec configuration tables in the BAP specification. * */ #include +#include #include #ifdef __cplusplus @@ -38,7 +39,7 @@ struct bt_bap_lc3_preset { /** The LC3 Codec */ struct bt_audio_codec_cfg codec_cfg; /** The BAP spec defined QoS values */ - struct bt_audio_codec_qos qos; + struct bt_bap_qos_cfg qos; }; /** Helper to declare an LC3 preset structure */ @@ -59,7 +60,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_8KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 26u, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 26u, 2u, 8u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 26u, 2u, 8u, 40000u)) /** * @brief Helper to declare LC3 Unicast 8_2_1 codec configuration @@ -71,7 +72,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_8KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 30U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 30u, 2u, 10u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 30u, 2u, 10u, 40000u)) /** * @brief Helper to declare LC3 Unicast 16_1_1 codec configuration @@ -83,7 +84,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_16KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 30U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 30u, 2u, 8u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 30u, 2u, 8u, 40000u)) /** * @brief Helper to declare LC3 Unicast 16_2_1 codec configuration @@ -97,7 +98,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_16KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 40U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 40u, 2u, 10u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 40u, 2u, 10u, 40000u)) /** * @brief Helper to declare LC3 Unicast 24_1_1 codec configuration @@ -109,7 +110,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_24KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 45U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 45u, 2u, 8u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 45u, 2u, 8u, 40000u)) /** * @brief Helper to declare LC3 Unicast 24_2_1 codec configuration @@ -123,7 +124,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_24KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 60U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 60u, 2u, 10u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 60u, 2u, 10u, 40000u)) /** * @brief Helper to declare LC3 Unicast 32_1_1 codec configuration @@ -135,7 +136,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_32KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 60U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 60u, 2u, 8u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 60u, 2u, 8u, 40000u)) /** * @brief Helper to declare LC3 Unicast 32_2_1 codec configuration @@ -147,7 +148,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_32KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 80U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 80u, 2u, 10u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 80u, 2u, 10u, 40000u)) /** * @brief Helper to declare LC3 Unicast 441_1_1 codec configuration @@ -159,7 +160,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_44KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 97U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_FRAMED(8163u, 97u, 5u, 24u, 40000u)) + BT_BAP_QOS_CFG_FRAMED(8163u, 97u, 5u, 24u, 40000u)) /** * @brief Helper to declare LC3 Unicast 441_2_1 codec configuration @@ -171,7 +172,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_44KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 130U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_FRAMED(10884u, 130u, 5u, 31u, 40000u)) + BT_BAP_QOS_CFG_FRAMED(10884u, 130u, 5u, 31u, 40000u)) /** * @brief Helper to declare LC3 Unicast 48_1_1 codec configuration @@ -183,7 +184,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 75U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 75u, 5u, 15u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 75u, 5u, 15u, 40000u)) /** * @brief Helper to declare LC3 Unicast 48_2_1 codec configuration @@ -195,7 +196,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 100U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 100u, 5u, 20u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 100u, 5u, 20u, 40000u)) /** * @brief Helper to declare LC3 Unicast 48_3_1 codec configuration @@ -207,7 +208,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 90U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 90u, 5u, 15u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 90u, 5u, 15u, 40000u)) /** * @brief Helper to declare LC3 Unicast 48_4_1 codec configuration @@ -219,7 +220,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 120u, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 120u, 5u, 20u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 120u, 5u, 20u, 40000u)) /** * @brief Helper to declare LC3 Unicast 8_5_1 codec configuration @@ -231,7 +232,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 117u, \ 1, _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 117u, 5u, 15u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 117u, 5u, 15u, 40000u)) /** * @brief Helper to declare LC3 Unicast 48_6_1 codec configuration @@ -243,7 +244,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 155u, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 155u, 5u, 20u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 155u, 5u, 20u, 40000u)) /** * @brief Helper to declare LC3 Unicast 8_1_2 codec configuration @@ -256,7 +257,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_8KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 26u, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 26u, 13u, 75u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 26u, 13u, 75u, 40000u)) /** * @brief Helper to declare LC3 Unicast 8_2_2 codec configuration @@ -268,7 +269,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_8KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 30U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 30u, 13u, 95u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 30u, 13u, 95u, 40000u)) /** * @brief Helper to declare LC3 Unicast 16_1_2 codec configuration @@ -280,7 +281,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_16KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 30U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 30u, 13u, 75u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 30u, 13u, 75u, 40000u)) /** * @brief Helper to declare LC3 Unicast 16_2_2 codec configuration @@ -292,7 +293,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_16KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 40U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 40u, 13u, 95u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 40u, 13u, 95u, 40000u)) /** * @brief Helper to declare LC3 Unicast 24_1_2 codec configuration @@ -304,7 +305,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_24KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 45U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 45u, 13u, 75u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 45u, 13u, 75u, 40000u)) /** * @brief Helper to declare LC3 Unicast 24_2_2 codec configuration @@ -316,7 +317,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_24KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 60U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 60u, 13u, 95u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 60u, 13u, 95u, 40000u)) /** * @brief Helper to declare LC3 Unicast 32_1_2 codec configuration @@ -328,7 +329,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_32KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 60U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 60u, 13u, 75u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 60u, 13u, 75u, 40000u)) /** * @brief Helper to declare LC3 Unicast 32_2_2 codec configuration @@ -340,7 +341,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_32KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 80U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 80u, 13u, 95u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 80u, 13u, 95u, 40000u)) /** * @brief Helper to declare LC3 Unicast 441_1_2 codec configuration @@ -352,7 +353,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_44KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 97U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_FRAMED(8163u, 97u, 13u, 80u, 40000u)) + BT_BAP_QOS_CFG_FRAMED(8163u, 97u, 13u, 80u, 40000u)) /** * @brief Helper to declare LC3 Unicast 441_2_2 codec configuration @@ -364,7 +365,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_44KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 130U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_FRAMED(10884u, 130u, 13u, 85u, 40000u)) + BT_BAP_QOS_CFG_FRAMED(10884u, 130u, 13u, 85u, 40000u)) /** * @brief Helper to declare LC3 Unicast 48_1_2 codec configuration @@ -376,7 +377,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 75U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 75u, 13u, 75u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 75u, 13u, 75u, 40000u)) /** * @brief Helper to declare LC3 Unicast 48_2_2 codec configuration @@ -388,7 +389,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 100U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 100u, 13u, 95u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 100u, 13u, 95u, 40000u)) /** * @brief Helper to declare LC3 Unicast 48_3_2 codec configuration @@ -400,7 +401,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 90U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 90u, 13u, 75u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 90u, 13u, 75u, 40000u)) /** * @brief Helper to declare LC3 Unicast 48_4_2 codec configuration @@ -412,7 +413,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 120u, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 120u, 13u, 100u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 120u, 13u, 100u, 40000u)) /** * @brief Helper to declare LC3 Unicast 48_5_2 codec configuration @@ -424,7 +425,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 117u, \ 1, _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 117u, 13u, 75u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 117u, 13u, 75u, 40000u)) /** * @brief Helper to declare LC3 Unicast 48_6_2 codec configuration @@ -436,7 +437,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 155u, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 155u, 13u, 100u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 155u, 13u, 100u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 8_1_1 codec configuration @@ -449,7 +450,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_8KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 26u, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 26u, 2u, 8u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 26u, 2u, 8u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 8_2_1 codec configuration @@ -461,7 +462,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_8KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 30U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 30u, 2u, 10u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 30u, 2u, 10u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 16_1_1 codec configuration @@ -473,7 +474,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_16KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 30U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 30u, 2u, 8u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 30u, 2u, 8u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 16_2_1 codec configuration @@ -487,7 +488,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_16KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 40U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 40u, 2u, 10u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 40u, 2u, 10u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 24_1_1 codec configuration @@ -499,7 +500,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_24KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 45U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 45u, 2u, 8u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 45u, 2u, 8u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 24_2_1 codec configuration @@ -513,7 +514,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_24KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 60U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 60u, 2u, 10u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 60u, 2u, 10u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 32_1_1 codec configuration @@ -525,7 +526,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_32KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 60U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 60u, 2u, 8u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 60u, 2u, 8u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 32_2_1 codec configuration @@ -537,7 +538,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_32KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 80U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 80u, 2u, 10u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 80u, 2u, 10u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 441_1_1 codec configuration @@ -549,7 +550,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_44KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 97U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_FRAMED(8163u, 97u, 4u, 24u, 40000u)) + BT_BAP_QOS_CFG_FRAMED(8163u, 97u, 4u, 24u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 441_2_1 codec configuration @@ -561,7 +562,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_44KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 130U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_FRAMED(10884u, 130u, 4u, 31u, 40000u)) + BT_BAP_QOS_CFG_FRAMED(10884u, 130u, 4u, 31u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 48_1_1 codec configuration @@ -573,7 +574,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 75U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 75u, 4u, 15u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 75u, 4u, 15u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 48_2_1 codec configuration @@ -585,7 +586,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 100U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 100u, 4u, 20u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 100u, 4u, 20u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 48_3_1 codec configuration @@ -597,7 +598,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 90U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 90u, 4u, 15u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 90u, 4u, 15u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 48_4_1 codec configuration @@ -609,7 +610,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 120u, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 120u, 4u, 20u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 120u, 4u, 20u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 48_5_1 codec configuration @@ -621,7 +622,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 117u, \ 1, _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 117u, 4u, 15u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 117u, 4u, 15u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 48_6_1 codec configuration @@ -633,7 +634,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 155u, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 155u, 4u, 20u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 155u, 4u, 20u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 8_1_2 codec configuration @@ -646,7 +647,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_8KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 26u, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 26u, 4u, 45u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 26u, 4u, 45u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 8_2_2 codec configuration @@ -658,7 +659,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_8KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 30U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 30u, 4u, 60u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 30u, 4u, 60u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 16_1_2 codec configuration @@ -670,7 +671,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_16KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 30U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 30u, 4u, 45u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 30u, 4u, 45u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 16_2_2 codec configuration @@ -684,7 +685,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_16KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 40U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 40u, 4u, 60u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 40u, 4u, 60u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 24_1_2 codec configuration @@ -696,7 +697,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_24KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 45U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 45u, 4u, 45u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 45u, 4u, 45u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 24_2_2 codec configuration @@ -710,7 +711,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_24KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 60U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 60u, 4u, 60u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 60u, 4u, 60u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 32_1_2 codec configuration @@ -722,7 +723,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_32KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 60U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 60u, 4u, 45u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 60u, 4u, 45u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 32_2_2 codec configuration @@ -734,7 +735,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_32KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 80U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 80u, 4u, 60u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 80u, 4u, 60u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 441_1_2 codec configuration @@ -746,7 +747,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_44KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 97U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_FRAMED(8163u, 97u, 4u, 54u, 40000u)) + BT_BAP_QOS_CFG_FRAMED(8163u, 97u, 4u, 54u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 441_2_2 codec configuration @@ -758,7 +759,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_44KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 130U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_FRAMED(10884u, 130u, 4u, 60u, 40000u)) + BT_BAP_QOS_CFG_FRAMED(10884u, 130u, 4u, 60u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 48_1_2 codec configuration @@ -770,7 +771,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 75U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 75u, 4u, 50u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 75u, 4u, 50u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 48_2_2 codec configuration @@ -782,7 +783,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 100U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 100u, 4u, 65u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 100u, 4u, 65u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 48_3_2 codec configuration @@ -794,7 +795,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 90U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 90u, 4u, 50u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 90u, 4u, 50u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 48_4_2 codec configuration @@ -806,7 +807,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 120u, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 120u, 4u, 65u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 120u, 4u, 65u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 48_5_2 codec configuration @@ -818,7 +819,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 117u, \ 1, _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 117u, 4u, 50u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 117u, 4u, 50u, 40000u)) /** * @brief Helper to declare LC3 Broadcast 48_6_2 codec configuration @@ -830,7 +831,7 @@ struct bt_bap_lc3_preset { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 155u, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 155u, 4u, 65u, 40000u)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 155u, 4u, 65u, 40000u)) #ifdef __cplusplus } diff --git a/include/zephyr/bluetooth/audio/cap.h b/include/zephyr/bluetooth/audio/cap.h index a2023f0e98380..13a004babddd1 100644 --- a/include/zephyr/bluetooth/audio/cap.h +++ b/include/zephyr/bluetooth/audio/cap.h @@ -456,7 +456,7 @@ struct bt_cap_initiator_broadcast_create_param { struct bt_cap_initiator_broadcast_subgroup_param *subgroup_params; /** Quality of Service configuration. */ - struct bt_audio_codec_qos *qos; + struct bt_bap_qos_cfg *qos; /** * @brief Broadcast Source packing mode. diff --git a/include/zephyr/bluetooth/audio/gmap_lc3_preset.h b/include/zephyr/bluetooth/audio/gmap_lc3_preset.h index 35bce011a8b63..73217d9d18db7 100644 --- a/include/zephyr/bluetooth/audio/gmap_lc3_preset.h +++ b/include/zephyr/bluetooth/audio/gmap_lc3_preset.h @@ -21,7 +21,7 @@ * @ingroup bluetooth * @{ * - * These APIs provide presets for codec configuration and codec QoS based on values supplied by the + * These APIs provide presets for codec configuration and QoS based on values supplied by the * codec configurations from table 3.16 in the GMAP v1.0 specification */ @@ -43,7 +43,7 @@ extern "C" { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_32KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 60U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 60U, 1U, 15U, 10000U)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 60U, 1U, 15U, 10000U)) /** * @brief Helper to declare LC3 32_2_gr codec configuration @@ -55,7 +55,7 @@ extern "C" { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_32KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 80U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 80U, 1U, 20U, 10000U)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 80U, 1U, 20U, 10000U)) /** * @brief Helper to declare LC3 48_1_gr codec configuration @@ -67,7 +67,7 @@ extern "C" { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 75U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 75U, 1U, 15U, 10000U)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 75U, 1U, 15U, 10000U)) /** * @brief Helper to declare LC3 48_2_gr codec configuration @@ -81,7 +81,7 @@ extern "C" { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 100U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 100U, 1U, 20U, 10000U)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 100U, 1U, 20U, 10000U)) /** * @brief Helper to declare LC3 48_3_gr codec configuration @@ -93,7 +93,7 @@ extern "C" { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 90U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 90U, 1U, 15U, 10000U)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 90U, 1U, 15U, 10000U)) /** * @brief Helper to declare LC3 48_4_gr codec configuration @@ -107,7 +107,7 @@ extern "C" { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 120u, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 120U, 1U, 20U, 10000U)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 120U, 1U, 20U, 10000U)) /** * @brief Helper to declare LC3 16_1_gs codec configuration @@ -119,7 +119,7 @@ extern "C" { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_16KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 30U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 30U, 1U, 15U, 60000U)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 30U, 1U, 15U, 60000U)) /** * @brief Helper to declare LC3 16_2_gs codec configuration @@ -131,7 +131,7 @@ extern "C" { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_16KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 40U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 40U, 1U, 20U, 60000U)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 40U, 1U, 20U, 60000U)) /** * @brief Helper to declare LC3 32_1_gs codec configuration @@ -143,7 +143,7 @@ extern "C" { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_32KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 60U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 60U, 1U, 15U, 60000U)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 60U, 1U, 15U, 60000U)) /** * @brief Helper to declare LC3 32_2_gs codec configuration @@ -155,7 +155,7 @@ extern "C" { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_32KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 80U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 80U, 1U, 20U, 60000U)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 80U, 1U, 20U, 60000U)) /** * @brief Helper to declare LC3 48_1_gs codec configuration @@ -167,7 +167,7 @@ extern "C" { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 75U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 75U, 1U, 15U, 60000U)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 75U, 1U, 15U, 60000U)) /** * @brief Helper to declare LC3 48_2_gs codec configuration @@ -179,7 +179,7 @@ extern "C" { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 100U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 100U, 1U, 20U, 60000U)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 100U, 1U, 20U, 60000U)) /* GMAP LC3 broadcast presets defined by table 3.22 in the GMAP v1.0 specification */ @@ -193,7 +193,7 @@ extern "C" { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 75U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 75U, 1U, 8U, 10000U)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 75U, 1U, 8U, 10000U)) /** * @brief Helper to declare LC3 48_2_g codec configuration @@ -205,7 +205,7 @@ extern "C" { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 100U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 100U, 1U, 10U, 10000U)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 100U, 1U, 10U, 10000U)) /** * @brief Helper to declare LC3 48_3_g codec configuration @@ -217,7 +217,7 @@ extern "C" { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_7_5, _loc, 90U, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(7500u, 90U, 1U, 8U, 10000U)) + BT_BAP_QOS_CFG_UNFRAMED(7500u, 90U, 1U, 8U, 10000U)) /** * @brief Helper to declare LC3 48_4_g codec configuration @@ -229,7 +229,7 @@ extern "C" { BT_BAP_LC3_PRESET(BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_48KHZ, \ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, 120u, 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, 120U, 1U, 10U, 10000U)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, 120U, 1U, 10U, 10000U)) #ifdef __cplusplus } diff --git a/samples/bluetooth/bap_unicast_client/src/main.c b/samples/bluetooth/bap_unicast_client/src/main.c index a9f9b24161a3c..b8861bb695696 100644 --- a/samples/bluetooth/bap_unicast_client/src/main.c +++ b/samples/bluetooth/bap_unicast_client/src/main.c @@ -215,8 +215,7 @@ static void start_scan(void) printk("Scanning successfully started\n"); } -static void stream_configured(struct bt_bap_stream *stream, - const struct bt_audio_codec_qos_pref *pref) +static void stream_configured(struct bt_bap_stream *stream, const struct bt_bap_qos_cfg_pref *pref) { printk("Audio Stream %p configured\n", stream); diff --git a/samples/bluetooth/bap_unicast_server/src/main.c b/samples/bluetooth/bap_unicast_server/src/main.c index 77da4e23d6c55..0bf79e48aac33 100644 --- a/samples/bluetooth/bap_unicast_server/src/main.c +++ b/samples/bluetooth/bap_unicast_server/src/main.c @@ -63,8 +63,8 @@ static struct audio_source { } source_streams[CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT]; static size_t configured_source_stream_count; -static const struct bt_audio_codec_qos_pref qos_pref = - BT_AUDIO_CODEC_QOS_PREF(true, BT_GAP_LE_PHY_2M, 0x02, 10, 40000, 40000, 40000, 40000); +static const struct bt_bap_qos_cfg_pref qos_pref = + BT_BAP_QOS_CFG_PREF(true, BT_GAP_LE_PHY_2M, 0x02, 10, 40000, 40000, 40000, 40000); static K_SEM_DEFINE(sem_disconnected, 0, 1); @@ -184,7 +184,7 @@ static void print_codec_cfg(const struct bt_audio_codec_cfg *codec_cfg) bt_audio_data_parse(codec_cfg->meta, codec_cfg->meta_len, print_cb, "meta"); } -static void print_qos(const struct bt_audio_codec_qos *qos) +static void print_qos(const struct bt_bap_qos_cfg *qos) { printk("QoS: interval %u framing 0x%02x phy 0x%02x sdu %u " "rtn %u latency %u pd %u\n", @@ -304,7 +304,7 @@ static struct bt_bap_stream *stream_alloc(enum bt_audio_dir dir) static int lc3_config(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, struct bt_bap_stream **stream, - struct bt_audio_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp) + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { printk("ASE Codec Config: conn %p ep %p dir %u\n", conn, ep, dir); @@ -336,7 +336,7 @@ static int lc3_config(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_ static int lc3_reconfig(struct bt_bap_stream *stream, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, - struct bt_audio_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp) + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { printk("ASE Codec Reconfig: stream %p\n", stream); @@ -353,7 +353,7 @@ static int lc3_reconfig(struct bt_bap_stream *stream, enum bt_audio_dir dir, return -ENOEXEC; } -static int lc3_qos(struct bt_bap_stream *stream, const struct bt_audio_codec_qos *qos, +static int lc3_qos(struct bt_bap_stream *stream, const struct bt_bap_qos_cfg *qos, struct bt_bap_ascs_rsp *rsp) { printk("QoS: stream %p qos %p\n", stream, qos); diff --git a/samples/bluetooth/cap_acceptor/src/cap_acceptor_unicast.c b/samples/bluetooth/cap_acceptor/src/cap_acceptor_unicast.c index 8130a5f86f8c1..132ee499c8771 100644 --- a/samples/bluetooth/cap_acceptor/src/cap_acceptor_unicast.c +++ b/samples/bluetooth/cap_acceptor/src/cap_acceptor_unicast.c @@ -41,7 +41,7 @@ LOG_MODULE_REGISTER(cap_acceptor_unicast, LOG_LEVEL_INF); #define LATENCY 20U #define RTN 2U -static const struct bt_audio_codec_qos_pref qos_pref = BT_AUDIO_CODEC_QOS_PREF( +static const struct bt_bap_qos_cfg_pref qos_pref = BT_BAP_QOS_CFG_PREF( UNFRAMED_SUPPORTED, PREF_PHY, RTN, LATENCY, MIN_PD, MAX_PD, MIN_PD, MAX_PD); uint64_t total_unicast_rx_iso_packet_count; /* This value is exposed to test code */ uint64_t total_unicast_tx_iso_packet_count; /* This value is exposed to test code */ @@ -99,7 +99,7 @@ static void log_codec_cfg(const struct bt_audio_codec_cfg *codec_cfg) bt_audio_data_parse(codec_cfg->meta, codec_cfg->meta_len, log_codec_cfg_cb, "meta"); } -static void log_qos(const struct bt_audio_codec_qos *qos) +static void log_qos(const struct bt_bap_qos_cfg *qos) { LOG_INF("QoS: interval %u framing 0x%02x phy 0x%02x sdu %u rtn %u latency %u pd %u", qos->interval, qos->framing, qos->phy, qos->sdu, qos->rtn, qos->latency, qos->pd); @@ -109,7 +109,7 @@ static int unicast_server_config_cb(struct bt_conn *conn, const struct bt_bap_ep enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, struct bt_bap_stream **bap_stream, - struct bt_audio_codec_qos_pref *const pref, + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { struct bt_cap_stream *cap_stream; @@ -137,7 +137,7 @@ static int unicast_server_config_cb(struct bt_conn *conn, const struct bt_bap_ep static int unicast_server_reconfig_cb(struct bt_bap_stream *bap_stream, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, - struct bt_audio_codec_qos_pref *const pref, + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { LOG_INF("ASE Codec Reconfig: bap_stream %p", bap_stream); @@ -147,8 +147,8 @@ static int unicast_server_reconfig_cb(struct bt_bap_stream *bap_stream, enum bt_ return 0; } -static int unicast_server_qos_cb(struct bt_bap_stream *bap_stream, - const struct bt_audio_codec_qos *qos, struct bt_bap_ascs_rsp *rsp) +static int unicast_server_qos_cb(struct bt_bap_stream *bap_stream, const struct bt_bap_qos_cfg *qos, + struct bt_bap_ascs_rsp *rsp) { LOG_INF("QoS: bap_stream %p qos %p", bap_stream, qos); @@ -249,7 +249,7 @@ static const struct bt_bap_unicast_server_cb unicast_server_cb = { }; static void unicast_stream_configured_cb(struct bt_bap_stream *bap_stream, - const struct bt_audio_codec_qos_pref *pref) + const struct bt_bap_qos_cfg_pref *pref) { LOG_INF("Configured bap_stream %p", bap_stream); diff --git a/samples/bluetooth/cap_initiator/src/cap_initiator_unicast.c b/samples/bluetooth/cap_initiator/src/cap_initiator_unicast.c index cfbe0933414ce..25dba8cc16d1f 100644 --- a/samples/bluetooth/cap_initiator/src/cap_initiator_unicast.c +++ b/samples/bluetooth/cap_initiator/src/cap_initiator_unicast.c @@ -92,7 +92,7 @@ static bool is_tx_stream(struct bt_bap_stream *stream) } static void unicast_stream_configured_cb(struct bt_bap_stream *stream, - const struct bt_audio_codec_qos_pref *pref) + const struct bt_bap_qos_cfg_pref *pref) { LOG_INF("Configured stream %p", stream); diff --git a/samples/bluetooth/hap_ha/src/bap_unicast_sr.c b/samples/bluetooth/hap_ha/src/bap_unicast_sr.c index 54d096035386d..6c8cd6fd862a2 100644 --- a/samples/bluetooth/hap_ha/src/bap_unicast_sr.c +++ b/samples/bluetooth/hap_ha/src/bap_unicast_sr.c @@ -37,8 +37,8 @@ static struct audio_source { } source_streams[CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT]; static size_t configured_source_stream_count; -static const struct bt_audio_codec_qos_pref qos_pref = - BT_AUDIO_CODEC_QOS_PREF(true, BT_GAP_LE_PHY_2M, 0x02, 10, 20000, 40000, 20000, 40000); +static const struct bt_bap_qos_cfg_pref qos_pref = + BT_BAP_QOS_CFG_PREF(true, BT_GAP_LE_PHY_2M, 0x02, 10, 20000, 40000, 20000, 40000); static uint16_t get_and_incr_seq_num(const struct bt_bap_stream *stream) { @@ -111,7 +111,7 @@ static void print_codec_cfg(const struct bt_audio_codec_cfg *codec_cfg) bt_audio_data_parse(codec_cfg->meta, codec_cfg->meta_len, print_cb, "meta"); } -static void print_qos(const struct bt_audio_codec_qos *qos) +static void print_qos(const struct bt_bap_qos_cfg *qos) { printk("QoS: interval %u framing 0x%02x phy 0x%02x sdu %u " "rtn %u latency %u pd %u\n", @@ -201,7 +201,7 @@ static struct bt_bap_stream *stream_alloc(void) static int lc3_config(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, struct bt_bap_stream **stream, - struct bt_audio_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp) + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { printk("ASE Codec Config: conn %p ep %p dir %u\n", conn, ep, dir); @@ -227,7 +227,7 @@ static int lc3_config(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_ static int lc3_reconfig(struct bt_bap_stream *stream, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, - struct bt_audio_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp) + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { printk("ASE Codec Reconfig: stream %p\n", stream); @@ -239,7 +239,7 @@ static int lc3_reconfig(struct bt_bap_stream *stream, enum bt_audio_dir dir, return -ENOEXEC; } -static int lc3_qos(struct bt_bap_stream *stream, const struct bt_audio_codec_qos *qos, +static int lc3_qos(struct bt_bap_stream *stream, const struct bt_bap_qos_cfg *qos, struct bt_bap_ascs_rsp *rsp) { printk("QoS: stream %p qos %p\n", stream, qos); diff --git a/samples/bluetooth/tmap_central/src/cap_initiator.c b/samples/bluetooth/tmap_central/src/cap_initiator.c index 2d31e82c599d0..e2722db64f5ea 100644 --- a/samples/bluetooth/tmap_central/src/cap_initiator.c +++ b/samples/bluetooth/tmap_central/src/cap_initiator.c @@ -43,7 +43,7 @@ static K_SEM_DEFINE(sem_discover_source, 0, 1); static K_SEM_DEFINE(sem_audio_start, 0, 1); static void unicast_stream_configured(struct bt_bap_stream *stream, - const struct bt_audio_codec_qos_pref *pref) + const struct bt_bap_qos_cfg_pref *pref) { printk("Configured stream %p\n", stream); diff --git a/samples/bluetooth/tmap_peripheral/src/bap_unicast_sr.c b/samples/bluetooth/tmap_peripheral/src/bap_unicast_sr.c index 62649e1a6f9a8..0aea8794f294a 100644 --- a/samples/bluetooth/tmap_peripheral/src/bap_unicast_sr.c +++ b/samples/bluetooth/tmap_peripheral/src/bap_unicast_sr.c @@ -50,8 +50,8 @@ static struct audio_source { } source_streams[CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT]; static size_t configured_source_stream_count; -static const struct bt_audio_codec_qos_pref qos_pref = - BT_AUDIO_CODEC_QOS_PREF(true, BT_GAP_LE_PHY_2M, 0x02, 10, 20000, 40000, 20000, 40000); +static const struct bt_bap_qos_cfg_pref qos_pref = + BT_BAP_QOS_CFG_PREF(true, BT_GAP_LE_PHY_2M, 0x02, 10, 20000, 40000, 20000, 40000); static void print_hex(const uint8_t *ptr, size_t len) { @@ -111,7 +111,7 @@ static void print_codec_cfg(const struct bt_audio_codec_cfg *codec_cfg) bt_audio_data_parse(codec_cfg->meta, codec_cfg->meta_len, print_cb, "meta"); } -static void print_qos(const struct bt_audio_codec_qos *qos) +static void print_qos(const struct bt_bap_qos_cfg *qos) { printk("QoS: interval %u framing 0x%02x phy 0x%02x sdu %u " "rtn %u latency %u pd %u\n", @@ -134,7 +134,7 @@ static struct bt_bap_stream *stream_alloc(void) static int lc3_config(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, struct bt_bap_stream **stream, - struct bt_audio_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp) + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { printk("ASE Codec Config: conn %p ep %p dir %u\n", conn, ep, dir); @@ -162,7 +162,7 @@ static int lc3_config(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_ static int lc3_reconfig(struct bt_bap_stream *stream, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, - struct bt_audio_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp) + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { printk("ASE Codec Reconfig: stream %p\n", stream); print_codec_cfg(codec_cfg); @@ -171,7 +171,7 @@ static int lc3_reconfig(struct bt_bap_stream *stream, enum bt_audio_dir dir, return 0; } -static int lc3_qos(struct bt_bap_stream *stream, const struct bt_audio_codec_qos *qos, +static int lc3_qos(struct bt_bap_stream *stream, const struct bt_bap_qos_cfg *qos, struct bt_bap_ascs_rsp *rsp) { printk("QoS: stream %p qos %p\n", stream, qos); diff --git a/subsys/bluetooth/audio/ascs.c b/subsys/bluetooth/audio/ascs.c index c21ad1955482d..51ba19b235013 100644 --- a/subsys/bluetooth/audio/ascs.c +++ b/subsys/bluetooth/audio/ascs.c @@ -713,7 +713,7 @@ int ascs_ep_set_state(struct bt_bap_ep *ep, uint8_t state) static void ascs_ep_get_status_config(struct bt_bap_ep *ep, struct net_buf_simple *buf) { struct bt_ascs_ase_status_config *cfg; - struct bt_audio_codec_qos_pref *pref = &ep->qos_pref; + struct bt_bap_qos_cfg_pref *pref = &ep->qos_pref; cfg = net_buf_simple_add(buf, sizeof(*cfg)); cfg->framing = pref->unframed_supported ? BT_ASCS_QOS_FRAMING_UNFRAMED @@ -960,7 +960,7 @@ static void ascs_iso_sent(struct bt_iso_chan *chan) static void ascs_update_sdu_size(struct bt_bap_ep *ep) { struct bt_iso_chan_io_qos *io_qos; - struct bt_audio_codec_qos *codec_qos = &ep->qos; + struct bt_bap_qos_cfg *qos_cfg = &ep->qos; if (ep->dir == BT_AUDIO_DIR_SINK) { io_qos = ep->iso->chan.qos->rx; @@ -970,8 +970,8 @@ static void ascs_update_sdu_size(struct bt_bap_ep *ep) return; } - io_qos->sdu = codec_qos->sdu; - io_qos->rtn = codec_qos->rtn; + io_qos->sdu = qos_cfg->sdu; + io_qos->rtn = qos_cfg->rtn; } static void ascs_ep_iso_connected(struct bt_bap_ep *ep) @@ -1631,7 +1631,7 @@ static int ase_config(struct bt_ascs_ase *ase, const struct bt_ascs_config *cfg) BT_BAP_ASCS_REASON_NONE); } - if (err == 0 && !bt_audio_valid_qos_pref(&ase->ep.qos_pref)) { + if (err == 0 && !bt_bap_valid_qos_pref(&ase->ep.qos_pref)) { LOG_ERR("Invalid QoS preferences"); /* If the upper layers provide an invalid QoS preferences we reject the @@ -1672,7 +1672,7 @@ static int ase_config(struct bt_ascs_ase *ase, const struct bt_ascs_config *cfg) BT_BAP_ASCS_REASON_NONE); } - if (err == 0 && !bt_audio_valid_qos_pref(&ase->ep.qos_pref)) { + if (err == 0 && !bt_bap_valid_qos_pref(&ase->ep.qos_pref)) { LOG_ERR("Invalid QoS preferences"); /* If the upper layers provide an invalid QoS preferences we reject the @@ -1726,7 +1726,7 @@ static struct bt_bap_ep *ep_lookup_stream(struct bt_conn *conn, struct bt_bap_st int bt_ascs_config_ase(struct bt_conn *conn, struct bt_bap_stream *stream, struct bt_audio_codec_cfg *codec_cfg, - const struct bt_audio_codec_qos_pref *qos_pref) + const struct bt_bap_qos_cfg_pref *qos_pref) { int err; struct bt_ascs_ase *ase = NULL; @@ -1934,7 +1934,7 @@ void bt_ascs_foreach_ep(struct bt_conn *conn, bt_bap_ep_func_t func, void *user_ } static void ase_qos(struct bt_ascs_ase *ase, uint8_t cig_id, uint8_t cis_id, - struct bt_audio_codec_qos *qos, struct bt_bap_ascs_rsp *rsp) + struct bt_bap_qos_cfg *qos, struct bt_bap_ascs_rsp *rsp) { struct bt_bap_ep *ep = &ase->ep; struct bt_bap_stream *stream; @@ -2094,7 +2094,7 @@ static ssize_t ascs_qos(struct bt_conn *conn, struct net_buf_simple *buf) for (uint8_t i = 0; i < req->num_ases; i++) { struct bt_bap_ascs_rsp rsp = BT_BAP_ASCS_RSP(BT_BAP_ASCS_RSP_CODE_UNSPECIFIED, BT_BAP_ASCS_REASON_NONE); - struct bt_audio_codec_qos cqos; + struct bt_bap_qos_cfg cqos; const struct bt_ascs_qos *qos; struct bt_ascs_ase *ase; diff --git a/subsys/bluetooth/audio/ascs_internal.h b/subsys/bluetooth/audio/ascs_internal.h index 67ba2aefe1d06..1651e21f42d68 100644 --- a/subsys/bluetooth/audio/ascs_internal.h +++ b/subsys/bluetooth/audio/ascs_internal.h @@ -352,7 +352,7 @@ int ascs_ep_set_state(struct bt_bap_ep *ep, uint8_t state); int bt_ascs_config_ase(struct bt_conn *conn, struct bt_bap_stream *stream, struct bt_audio_codec_cfg *codec_cfg, - const struct bt_audio_codec_qos_pref *qos_pref); + const struct bt_bap_qos_cfg_pref *qos_pref); int bt_ascs_disable_ase(struct bt_bap_ep *ep); int bt_ascs_release_ase(struct bt_bap_ep *ep); diff --git a/subsys/bluetooth/audio/bap_broadcast_sink.c b/subsys/bluetooth/audio/bap_broadcast_sink.c index 76822d593043b..58cb0d65d8166 100644 --- a/subsys/bluetooth/audio/bap_broadcast_sink.c +++ b/subsys/bluetooth/audio/bap_broadcast_sink.c @@ -733,7 +733,7 @@ static int store_base_info(struct bt_bap_broadcast_sink *sink, const struct bt_b /* Ensure that we have not synced while parsing the BASE */ if (sink->big == NULL) { - sink->codec_qos.pd = pres_delay; + sink->qos_cfg.pd = pres_delay; memcpy(sink->bis, data.bis, sizeof(sink->bis)); memcpy(sink->subgroups, data.subgroups, sizeof(sink->subgroups)); sink->subgroup_count = data.subgroup_count; @@ -944,10 +944,10 @@ static void biginfo_recv(struct bt_le_per_adv_sync *sync, } } - sink->codec_qos.framing = biginfo->framing; - sink->codec_qos.phy = biginfo->phy; - sink->codec_qos.sdu = biginfo->max_sdu; - sink->codec_qos.interval = biginfo->sdu_interval; + sink->qos_cfg.framing = biginfo->framing; + sink->qos_cfg.phy = biginfo->phy; + sink->qos_cfg.sdu = biginfo->max_sdu; + sink->qos_cfg.interval = biginfo->sdu_interval; SYS_SLIST_FOR_EACH_CONTAINER(&sink_cbs, listener, _node) { if (listener->syncable != NULL) { @@ -1045,13 +1045,13 @@ static int bt_bap_broadcast_sink_setup_stream(struct bt_bap_broadcast_sink *sink bt_bap_iso_init(iso, &broadcast_sink_iso_ops); bt_bap_iso_bind_ep(iso, ep); - bt_audio_codec_qos_to_iso_qos(iso->chan.qos->rx, &sink->codec_qos); + bt_bap_qos_cfg_to_iso_qos(iso->chan.qos->rx, &sink->qos_cfg); bt_bap_iso_configure_data_path(ep, codec_cfg); bt_bap_iso_unref(iso); bt_bap_stream_attach(NULL, stream, ep, codec_cfg); - stream->qos = &sink->codec_qos; + stream->qos = &sink->qos_cfg; return 0; } diff --git a/subsys/bluetooth/audio/bap_broadcast_source.c b/subsys/bluetooth/audio/bap_broadcast_source.c index fc39ae1b336dc..26a1f6bb5d02a 100644 --- a/subsys/bluetooth/audio/bap_broadcast_source.c +++ b/subsys/bluetooth/audio/bap_broadcast_source.c @@ -293,7 +293,7 @@ static struct bt_bap_broadcast_subgroup *broadcast_source_new_subgroup(uint8_t i static int broadcast_source_setup_stream(uint8_t index, struct bt_bap_stream *stream, struct bt_audio_codec_cfg *codec_cfg, - struct bt_audio_codec_qos *qos, + struct bt_bap_qos_cfg *qos, struct bt_bap_broadcast_source *source) { struct bt_bap_iso *iso; @@ -314,7 +314,7 @@ static int broadcast_source_setup_stream(uint8_t index, struct bt_bap_stream *st bt_bap_iso_init(iso, &broadcast_source_iso_ops); bt_bap_iso_bind_ep(iso, ep); - bt_audio_codec_qos_to_iso_qos(iso->chan.qos->tx, qos); + bt_bap_qos_cfg_to_iso_qos(iso->chan.qos->tx, qos); bt_bap_iso_configure_data_path(ep, codec_cfg); #if defined(CONFIG_BT_ISO_TEST_PARAMS) iso->chan.qos->num_subevents = qos->num_subevents; @@ -509,7 +509,7 @@ static void broadcast_source_cleanup(struct bt_bap_broadcast_source *source) static bool valid_broadcast_source_param(const struct bt_bap_broadcast_source_param *param, const struct bt_bap_broadcast_source *source) { - const struct bt_audio_codec_qos *qos; + const struct bt_bap_qos_cfg *qos; CHECKIF(param == NULL) { LOG_DBG("param is NULL"); @@ -716,7 +716,7 @@ int bt_bap_broadcast_source_create(struct bt_bap_broadcast_source_param *param, struct bt_bap_broadcast_source **out_source) { struct bt_bap_broadcast_source *source; - struct bt_audio_codec_qos *qos; + struct bt_bap_qos_cfg *qos; size_t stream_count; uint8_t index; uint8_t bis_count; @@ -864,7 +864,7 @@ int bt_bap_broadcast_source_reconfig(struct bt_bap_broadcast_source *source, { struct bt_bap_broadcast_subgroup *subgroup; enum bt_bap_ep_state broadcast_state; - struct bt_audio_codec_qos *qos; + struct bt_bap_qos_cfg *qos; size_t subgroup_cnt; uint8_t bis_count; @@ -1020,7 +1020,7 @@ int bt_bap_broadcast_source_reconfig(struct bt_bap_broadcast_source *source, struct bt_iso_chan_io_qos *iso_qos; iso_qos = stream->ep->iso->chan.qos->tx; - bt_audio_codec_qos_to_iso_qos(iso_qos, qos); + bt_bap_qos_cfg_to_iso_qos(iso_qos, qos); stream->qos = qos; } } diff --git a/subsys/bluetooth/audio/bap_endpoint.h b/subsys/bluetooth/audio/bap_endpoint.h index 85d3cea3e4f02..b127bc601f0cc 100644 --- a/subsys/bluetooth/audio/bap_endpoint.h +++ b/subsys/bluetooth/audio/bap_endpoint.h @@ -48,8 +48,8 @@ struct bt_bap_ep { struct bt_ascs_ase_status status; struct bt_bap_stream *stream; struct bt_audio_codec_cfg codec_cfg; - struct bt_audio_codec_qos qos; - struct bt_audio_codec_qos_pref qos_pref; + struct bt_bap_qos_cfg qos; + struct bt_bap_qos_cfg_pref qos_pref; struct bt_bap_iso *iso; /* unicast stopped reason */ @@ -111,7 +111,7 @@ struct bt_bap_broadcast_source { uint32_t broadcast_id; /* 24 bit */ struct bt_iso_big *big; - struct bt_audio_codec_qos *qos; + struct bt_bap_qos_cfg *qos; #if defined(CONFIG_BT_ISO_TEST_PARAMS) /* Stored advanced parameters */ uint8_t irc; @@ -178,7 +178,7 @@ struct bt_bap_broadcast_sink { uint32_t broadcast_id; /* 24 bit */ uint32_t indexes_bitfield; uint32_t valid_indexes_bitfield; /* based on codec support */ - struct bt_audio_codec_qos codec_qos; + struct bt_bap_qos_cfg qos_cfg; struct bt_le_per_adv_sync *pa_sync; struct bt_iso_big *big; struct bt_bap_broadcast_sink_bis bis[CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT]; diff --git a/subsys/bluetooth/audio/bap_stream.c b/subsys/bluetooth/audio/bap_stream.c index ac6ed0820411f..a28f00a787cdf 100644 --- a/subsys/bluetooth/audio/bap_stream.c +++ b/subsys/bluetooth/audio/bap_stream.c @@ -45,15 +45,14 @@ LOG_MODULE_REGISTER(bt_bap_stream, CONFIG_BT_BAP_STREAM_LOG_LEVEL); #if defined(CONFIG_BT_BAP_UNICAST_CLIENT) || defined(CONFIG_BT_BAP_BROADCAST_SOURCE) || \ defined(CONFIG_BT_BAP_BROADCAST_SINK) -void bt_audio_codec_qos_to_iso_qos(struct bt_iso_chan_io_qos *io, - const struct bt_audio_codec_qos *codec_qos) +void bt_bap_qos_cfg_to_iso_qos(struct bt_iso_chan_io_qos *io, const struct bt_bap_qos_cfg *qos_cfg) { - io->sdu = codec_qos->sdu; - io->phy = codec_qos->phy; - io->rtn = codec_qos->rtn; + io->sdu = qos_cfg->sdu; + io->phy = qos_cfg->phy; + io->rtn = qos_cfg->rtn; #if defined(CONFIG_BT_ISO_TEST_PARAMS) - io->burst_number = codec_qos->burst_number; - io->max_pdu = codec_qos->max_pdu; + io->burst_number = qos_cfg->burst_number; + io->max_pdu = qos_cfg->max_pdu; #endif /* CONFIG_BT_ISO_TEST_PARAMS */ } #endif /* CONFIG_BT_BAP_UNICAST_CLIENT || \ @@ -167,7 +166,7 @@ int bt_bap_ep_get_info(const struct bt_bap_ep *ep, struct bt_bap_ep_info *info) return 0; } -enum bt_bap_ascs_reason bt_audio_verify_qos(const struct bt_audio_codec_qos *qos) +enum bt_bap_ascs_reason bt_audio_verify_qos(const struct bt_bap_qos_cfg *qos) { if (qos->interval < BT_ISO_SDU_INTERVAL_MIN || qos->interval > BT_ISO_SDU_INTERVAL_MAX) { @@ -176,14 +175,13 @@ enum bt_bap_ascs_reason bt_audio_verify_qos(const struct bt_audio_codec_qos *qos return BT_BAP_ASCS_REASON_INTERVAL; } - if (qos->framing > BT_AUDIO_CODEC_QOS_FRAMING_FRAMED) { + if (qos->framing > BT_BAP_QOS_CFG_FRAMING_FRAMED) { LOG_DBG("Invalid Framing 0x%02x", qos->framing); return BT_BAP_ASCS_REASON_FRAMING; } - if (qos->phy != BT_AUDIO_CODEC_QOS_1M && - qos->phy != BT_AUDIO_CODEC_QOS_2M && - qos->phy != BT_AUDIO_CODEC_QOS_CODED) { + if (qos->phy != BT_BAP_QOS_CFG_1M && qos->phy != BT_BAP_QOS_CFG_2M && + qos->phy != BT_BAP_QOS_CFG_CODED) { LOG_DBG("Invalid PHY 0x%02x", qos->phy); return BT_BAP_ASCS_REASON_PHY; } @@ -265,7 +263,7 @@ bool bt_audio_valid_codec_cfg(const struct bt_audio_codec_cfg *codec_cfg) return true; } -bool bt_audio_valid_qos_pref(const struct bt_audio_codec_qos_pref *qos_pref) +bool bt_bap_valid_qos_pref(const struct bt_bap_qos_cfg_pref *qos_pref) { const uint8_t phy_mask = BT_GAP_LE_PHY_1M | BT_GAP_LE_PHY_2M | BT_GAP_LE_PHY_CODED; @@ -487,9 +485,9 @@ static bool bt_bap_stream_is_broadcast(const struct bt_bap_stream *stream) } enum bt_bap_ascs_reason bt_bap_stream_verify_qos(const struct bt_bap_stream *stream, - const struct bt_audio_codec_qos *qos) + const struct bt_bap_qos_cfg *qos) { - const struct bt_audio_codec_qos_pref *qos_pref = &stream->ep->qos_pref; + const struct bt_bap_qos_cfg_pref *qos_pref = &stream->ep->qos_pref; if (qos_pref->latency < qos->latency) { /* Latency is a preferred value. Print debug info but do not fail. */ diff --git a/subsys/bluetooth/audio/bap_stream.h b/subsys/bluetooth/audio/bap_stream.h index a236092367741..d023660be526c 100644 --- a/subsys/bluetooth/audio/bap_stream.h +++ b/subsys/bluetooth/audio/bap_stream.h @@ -25,17 +25,16 @@ void bt_bap_stream_reset(struct bt_bap_stream *stream); void bt_bap_stream_attach(struct bt_conn *conn, struct bt_bap_stream *stream, struct bt_bap_ep *ep, struct bt_audio_codec_cfg *codec_cfg); -void bt_audio_codec_qos_to_iso_qos(struct bt_iso_chan_io_qos *io, - const struct bt_audio_codec_qos *codec_qos); +void bt_bap_qos_cfg_to_iso_qos(struct bt_iso_chan_io_qos *io, const struct bt_bap_qos_cfg *qos_cfg); void bt_bap_stream_detach(struct bt_bap_stream *stream); -enum bt_bap_ascs_reason bt_audio_verify_qos(const struct bt_audio_codec_qos *qos); +enum bt_bap_ascs_reason bt_audio_verify_qos(const struct bt_bap_qos_cfg *qos); bool bt_audio_valid_codec_cfg(const struct bt_audio_codec_cfg *codec_cfg); -bool bt_audio_valid_qos_pref(const struct bt_audio_codec_qos_pref *qos_pref); +bool bt_bap_valid_qos_pref(const struct bt_bap_qos_cfg_pref *qos_pref); bool bt_bap_stream_can_disconnect(const struct bt_bap_stream *stream); enum bt_bap_ascs_reason bt_bap_stream_verify_qos(const struct bt_bap_stream *stream, - const struct bt_audio_codec_qos *qos); + const struct bt_bap_qos_cfg *qos); struct bt_iso_chan *bt_bap_stream_iso_chan_get(struct bt_bap_stream *stream); diff --git a/subsys/bluetooth/audio/bap_unicast_client.c b/subsys/bluetooth/audio/bap_unicast_client.c index f95902c3ee6fe..c50791af0434e 100644 --- a/subsys/bluetooth/audio/bap_unicast_client.c +++ b/subsys/bluetooth/audio/bap_unicast_client.c @@ -678,7 +678,7 @@ static void unicast_client_ep_config_state(struct bt_bap_ep *ep, struct net_buf_ struct bt_bap_unicast_client_ep *client_ep = CONTAINER_OF(ep, struct bt_bap_unicast_client_ep, ep); struct bt_ascs_ase_status_config *cfg; - struct bt_audio_codec_qos_pref *pref; + struct bt_bap_qos_cfg_pref *pref; struct bt_bap_stream *stream; void *cc; @@ -740,7 +740,7 @@ static void unicast_client_ep_config_state(struct bt_bap_ep *ep, struct net_buf_ pref->latency, pref->pd_min, pref->pd_max, pref->pref_pd_min, pref->pref_pd_max, stream->codec_cfg->id); - if (!bt_audio_valid_qos_pref(pref)) { + if (!bt_bap_valid_qos_pref(pref)) { LOG_DBG("Invalid QoS preferences"); memset(pref, 0, sizeof(*pref)); @@ -1827,7 +1827,7 @@ static int unicast_client_ep_config(struct bt_bap_ep *ep, struct net_buf_simple } int bt_bap_unicast_client_ep_qos(struct bt_bap_ep *ep, struct net_buf_simple *buf, - struct bt_audio_codec_qos *qos) + struct bt_bap_qos_cfg *qos) { struct bt_ascs_qos *req; struct bt_conn_iso *conn_iso; @@ -2153,7 +2153,7 @@ static void unicast_client_ep_reset(struct bt_conn *conn, uint8_t reason) reset_att_buf(client); } -static void bt_audio_codec_qos_to_cig_param(struct bt_iso_cig_param *cig_param, +static void bt_bap_qos_cfg_to_cig_param(struct bt_iso_cig_param *cig_param, const struct bt_bap_unicast_group *group) { cig_param->framing = group->cig_param.framing; @@ -2214,7 +2214,7 @@ static int bt_audio_cig_create(struct bt_bap_unicast_group *group) param.num_cis = unicast_group_get_cis_count(group); param.cis_channels = group->cis; - bt_audio_codec_qos_to_cig_param(¶m, group); + bt_bap_qos_cfg_to_cig_param(¶m, group); err = bt_iso_cig_create(¶m, &group->cig); if (err != 0) { @@ -2245,7 +2245,7 @@ static int bt_audio_cig_reconfigure(struct bt_bap_unicast_group *group) param.num_cis = cis_count; param.cis_channels = group->cis; - bt_audio_codec_qos_to_cig_param(¶m, group); + bt_bap_qos_cfg_to_cig_param(¶m, group); err = bt_iso_cig_reconfigure(group->cig, ¶m); if (err != 0) { @@ -2333,9 +2333,9 @@ static void unicast_group_del_iso(struct bt_bap_unicast_group *group, struct bt_ } } -static void unicast_client_codec_qos_to_iso_qos(struct bt_bap_iso *iso, - const struct bt_audio_codec_qos *qos, - enum bt_audio_dir dir) +static void unicast_client_qos_cfg_to_iso_qos(struct bt_bap_iso *iso, + const struct bt_bap_qos_cfg *qos, + enum bt_audio_dir dir) { struct bt_iso_chan_io_qos *io_qos; struct bt_iso_chan_io_qos *other_io_qos; @@ -2362,7 +2362,7 @@ static void unicast_client_codec_qos_to_iso_qos(struct bt_bap_iso *iso, } } - bt_audio_codec_qos_to_iso_qos(io_qos, qos); + bt_bap_qos_cfg_to_iso_qos(io_qos, qos); #if defined(CONFIG_BT_ISO_TEST_PARAMS) iso->chan.qos->num_subevents = qos->num_subevents; #endif /* CONFIG_BT_ISO_TEST_PARAMS */ @@ -2377,11 +2377,11 @@ static void unicast_client_codec_qos_to_iso_qos(struct bt_bap_iso *iso, static void unicast_group_set_iso_stream_param(struct bt_bap_unicast_group *group, struct bt_bap_iso *iso, - struct bt_audio_codec_qos *qos, + struct bt_bap_qos_cfg *qos, enum bt_audio_dir dir) { /* Store the stream Codec QoS in the bap_iso */ - unicast_client_codec_qos_to_iso_qos(iso, qos, dir); + unicast_client_qos_cfg_to_iso_qos(iso, qos, dir); /* Store the group Codec QoS in the group - This assume thats the parameters have been * verified first @@ -2401,7 +2401,7 @@ static void unicast_group_add_stream(struct bt_bap_unicast_group *group, struct bt_bap_iso *iso, enum bt_audio_dir dir) { struct bt_bap_stream *stream = param->stream; - struct bt_audio_codec_qos *qos = param->qos; + struct bt_bap_qos_cfg *qos = param->qos; LOG_DBG("group %p stream %p qos %p iso %p dir %u", group, stream, qos, iso, dir); @@ -2610,7 +2610,7 @@ static bool valid_unicast_group_stream_param(const struct bt_bap_unicast_group * struct bt_bap_unicast_group_cig_param *cig_param, enum bt_audio_dir dir) { - const struct bt_audio_codec_qos *qos; + const struct bt_bap_qos_cfg *qos; CHECKIF(param->stream == NULL) { LOG_DBG("param->stream is NULL"); @@ -2670,14 +2670,14 @@ static bool valid_unicast_group_stream_param(const struct bt_bap_unicast_group * } if (cig_param->framing == 0) { - if (qos->framing == BT_AUDIO_CODEC_QOS_FRAMING_UNFRAMED) { + if (qos->framing == BT_BAP_QOS_CFG_FRAMING_UNFRAMED) { cig_param->framing = BT_ISO_FRAMING_UNFRAMED; - } else if (qos->framing == BT_AUDIO_CODEC_QOS_FRAMING_FRAMED) { + } else if (qos->framing == BT_BAP_QOS_CFG_FRAMING_FRAMED) { cig_param->framing = BT_ISO_FRAMING_FRAMED; } - } else if ((qos->framing == BT_AUDIO_CODEC_QOS_FRAMING_UNFRAMED && + } else if ((qos->framing == BT_BAP_QOS_CFG_FRAMING_UNFRAMED && cig_param->framing != BT_ISO_FRAMING_UNFRAMED) || - (qos->framing == BT_AUDIO_CODEC_QOS_FRAMING_FRAMED && + (qos->framing == BT_BAP_QOS_CFG_FRAMING_FRAMED && cig_param->framing != BT_ISO_FRAMING_FRAMED)) { return false; } diff --git a/subsys/bluetooth/audio/bap_unicast_client_internal.h b/subsys/bluetooth/audio/bap_unicast_client_internal.h index 962d7feb9270d..6c6c2857b1e6a 100644 --- a/subsys/bluetooth/audio/bap_unicast_client_internal.h +++ b/subsys/bluetooth/audio/bap_unicast_client_internal.h @@ -37,7 +37,7 @@ int bt_bap_unicast_client_release(struct bt_bap_stream *stream); struct net_buf_simple *bt_bap_unicast_client_ep_create_pdu(struct bt_conn *conn, uint8_t op); int bt_bap_unicast_client_ep_qos(struct bt_bap_ep *ep, struct net_buf_simple *buf, - struct bt_audio_codec_qos *qos); + struct bt_bap_qos_cfg *qos); int bt_bap_unicast_client_ep_send(struct bt_conn *conn, struct bt_bap_ep *ep, struct net_buf_simple *buf); diff --git a/subsys/bluetooth/audio/bap_unicast_server.c b/subsys/bluetooth/audio/bap_unicast_server.c index ee5160e186a30..bc83137b0a3fd 100644 --- a/subsys/bluetooth/audio/bap_unicast_server.c +++ b/subsys/bluetooth/audio/bap_unicast_server.c @@ -188,7 +188,7 @@ int bt_bap_unicast_server_release(struct bt_bap_stream *stream) int bt_bap_unicast_server_config_ase(struct bt_conn *conn, struct bt_bap_stream *stream, struct bt_audio_codec_cfg *codec_cfg, - const struct bt_audio_codec_qos_pref *qos_pref) + const struct bt_bap_qos_cfg_pref *qos_pref) { return bt_ascs_config_ase(conn, stream, codec_cfg, qos_pref); } diff --git a/subsys/bluetooth/audio/cap_stream.c b/subsys/bluetooth/audio/cap_stream.c index bbc645daa3e9d..821366d78c6fb 100644 --- a/subsys/bluetooth/audio/cap_stream.c +++ b/subsys/bluetooth/audio/cap_stream.c @@ -47,7 +47,7 @@ static bool stream_is_central(struct bt_bap_stream *bap_stream) #if defined(CONFIG_BT_BAP_UNICAST) static void cap_stream_configured_cb(struct bt_bap_stream *bap_stream, - const struct bt_audio_codec_qos_pref *pref) + const struct bt_bap_qos_cfg_pref *pref) { struct bt_cap_stream *cap_stream = CONTAINER_OF(bap_stream, struct bt_cap_stream, diff --git a/subsys/bluetooth/audio/shell/audio.h b/subsys/bluetooth/audio/shell/audio.h index 643bb2607894e..8539725d5948f 100644 --- a/subsys/bluetooth/audio/shell/audio.h +++ b/subsys/bluetooth/audio/shell/audio.h @@ -93,7 +93,7 @@ struct named_lc3_preset { struct shell_stream { struct bt_cap_stream stream; struct bt_audio_codec_cfg codec_cfg; - struct bt_audio_codec_qos qos; + struct bt_bap_qos_cfg qos; bool is_tx; bool is_rx; @@ -177,7 +177,7 @@ struct broadcast_source { struct bt_cap_broadcast_source *cap_source; }; struct bt_audio_codec_cfg codec_cfg; - struct bt_audio_codec_qos qos; + struct bt_bap_qos_cfg qos; }; struct broadcast_sink { @@ -236,7 +236,7 @@ int cap_ac_unicast(const struct shell *sh, const struct bap_unicast_ac_param *pa #endif /* CONFIG_BT_BAP_UNICAST_CLIENT */ #endif /* CONFIG_BT_BAP_UNICAST */ -static inline void print_qos(const struct shell *sh, const struct bt_audio_codec_qos *qos) +static inline void print_qos(const struct shell *sh, const struct bt_bap_qos_cfg *qos) { #if defined(CONFIG_BT_BAP_BROADCAST_SOURCE) || defined(CONFIG_BT_BAP_UNICAST) shell_print(sh, diff --git a/subsys/bluetooth/audio/shell/bap.c b/subsys/bluetooth/audio/shell/bap.c index b0ec8c82517e1..0a05438abc30a 100644 --- a/subsys/bluetooth/audio/shell/bap.c +++ b/subsys/bluetooth/audio/shell/bap.c @@ -619,8 +619,8 @@ static int cmd_select_unicast(const struct shell *sh, size_t argc, char *argv[]) } #if defined(CONFIG_BT_BAP_UNICAST_SERVER) -static const struct bt_audio_codec_qos_pref qos_pref = - BT_AUDIO_CODEC_QOS_PREF(true, BT_GAP_LE_PHY_2M, 0u, 60u, 10000u, 60000u, 10000u, 60000u); +static const struct bt_bap_qos_cfg_pref qos_pref = + BT_BAP_QOS_CFG_PREF(true, BT_GAP_LE_PHY_2M, 0u, 60u, 10000u, 60000u, 10000u, 60000u); static struct bt_bap_stream *stream_alloc(void) { @@ -637,7 +637,7 @@ static struct bt_bap_stream *stream_alloc(void) static int lc3_config(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, struct bt_bap_stream **stream, - struct bt_audio_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp) + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { shell_print(ctx_shell, "ASE Codec Config: conn %p ep %p dir %u", conn, ep, dir); @@ -663,7 +663,7 @@ static int lc3_config(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_ static int lc3_reconfig(struct bt_bap_stream *stream, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, - struct bt_audio_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp) + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { shell_print(ctx_shell, "ASE Codec Reconfig: stream %p", stream); @@ -678,7 +678,7 @@ static int lc3_reconfig(struct bt_bap_stream *stream, enum bt_audio_dir dir, return 0; } -static int lc3_qos(struct bt_bap_stream *stream, const struct bt_audio_codec_qos *qos, +static int lc3_qos(struct bt_bap_stream *stream, const struct bt_bap_qos_cfg *qos, struct bt_bap_ascs_rsp *rsp) { shell_print(ctx_shell, "QoS: stream %p %p", stream, qos); @@ -822,8 +822,8 @@ int bap_ac_create_unicast_group(const struct bap_unicast_ac_param *param, 0}; struct bt_bap_unicast_group_stream_pair_param pair_params[BAP_UNICAST_AC_MAX_PAIR] = {0}; struct bt_bap_unicast_group_param group_param = {0}; - struct bt_audio_codec_qos *snk_qos[BAP_UNICAST_AC_MAX_SNK]; - struct bt_audio_codec_qos *src_qos[BAP_UNICAST_AC_MAX_SRC]; + struct bt_bap_qos_cfg *snk_qos[BAP_UNICAST_AC_MAX_SNK]; + struct bt_bap_qos_cfg *src_qos[BAP_UNICAST_AC_MAX_SRC]; size_t snk_stream_cnt = 0U; size_t src_stream_cnt = 0U; size_t pair_cnt = 0U; @@ -1316,7 +1316,7 @@ static int cmd_config(const struct shell *sh, size_t argc, char *argv[]) static int cmd_stream_qos(const struct shell *sh, size_t argc, char *argv[]) { - struct bt_audio_codec_qos *qos; + struct bt_bap_qos_cfg *qos; unsigned long interval; int err = 0; @@ -3134,7 +3134,7 @@ static void stream_stopped_cb(struct bt_bap_stream *stream, uint8_t reason) #if defined(CONFIG_BT_BAP_UNICAST) static void stream_configured_cb(struct bt_bap_stream *stream, - const struct bt_audio_codec_qos_pref *pref) + const struct bt_bap_qos_cfg_pref *pref) { shell_print(ctx_shell, "Stream %p configured\n", stream); } diff --git a/tests/bluetooth/audio/ascs/include/bap_unicast_server.h b/tests/bluetooth/audio/ascs/include/bap_unicast_server.h index 08e3b9fd0eaef..09cd37d429376 100644 --- a/tests/bluetooth/audio/ascs/include/bap_unicast_server.h +++ b/tests/bluetooth/audio/ascs/include/bap_unicast_server.h @@ -18,12 +18,12 @@ void mock_bap_unicast_server_cleanup(void); DECLARE_FAKE_VALUE_FUNC(int, mock_bap_unicast_server_cb_config, struct bt_conn *, const struct bt_bap_ep *, enum bt_audio_dir, const struct bt_audio_codec_cfg *, struct bt_bap_stream **, - struct bt_audio_codec_qos_pref *const, struct bt_bap_ascs_rsp *); + struct bt_bap_qos_cfg_pref *const, struct bt_bap_ascs_rsp *); DECLARE_FAKE_VALUE_FUNC(int, mock_bap_unicast_server_cb_reconfig, struct bt_bap_stream *, enum bt_audio_dir, const struct bt_audio_codec_cfg *, - struct bt_audio_codec_qos_pref *const, struct bt_bap_ascs_rsp *); + struct bt_bap_qos_cfg_pref *const, struct bt_bap_ascs_rsp *); DECLARE_FAKE_VALUE_FUNC(int, mock_bap_unicast_server_cb_qos, struct bt_bap_stream *, - const struct bt_audio_codec_qos *, struct bt_bap_ascs_rsp *); + const struct bt_bap_qos_cfg *, struct bt_bap_ascs_rsp *); DECLARE_FAKE_VALUE_FUNC(int, mock_bap_unicast_server_cb_enable, struct bt_bap_stream *, const uint8_t *, size_t, struct bt_bap_ascs_rsp *); DECLARE_FAKE_VALUE_FUNC(int, mock_bap_unicast_server_cb_start, struct bt_bap_stream *, diff --git a/tests/bluetooth/audio/ascs/src/main.c b/tests/bluetooth/audio/ascs/src/main.c index e91368e230566..77f6f32ec2ae5 100644 --- a/tests/bluetooth/audio/ascs/src/main.c +++ b/tests/bluetooth/audio/ascs/src/main.c @@ -746,14 +746,14 @@ ZTEST_F(ascs_test_suite, test_cis_link_loss_in_enabling_state_client_retries) } static struct bt_bap_stream *stream_allocated; -static const struct bt_audio_codec_qos_pref qos_pref = - BT_AUDIO_CODEC_QOS_PREF(true, BT_GAP_LE_PHY_2M, 0x02, 10, 40000, 40000, 40000, 40000); +static const struct bt_bap_qos_cfg_pref qos_pref = + BT_BAP_QOS_CFG_PREF(true, BT_GAP_LE_PHY_2M, 0x02, 10, 40000, 40000, 40000, 40000); static int unicast_server_cb_config_custom_fake(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, struct bt_bap_stream **stream, - struct bt_audio_codec_qos_pref *const pref, + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { *stream = stream_allocated; diff --git a/tests/bluetooth/audio/ascs/src/test_ase_control_params.c b/tests/bluetooth/audio/ascs/src/test_ase_control_params.c index 45605a538f7e6..a4090da02e2be 100644 --- a/tests/bluetooth/audio/ascs/src/test_ase_control_params.c +++ b/tests/bluetooth/audio/ascs/src/test_ase_control_params.c @@ -367,14 +367,14 @@ ZTEST_F(test_ase_control_params, test_codec_configure_invalid_ase_id_0x00) } static struct bt_bap_stream test_stream; -static const struct bt_audio_codec_qos_pref qos_pref = - BT_AUDIO_CODEC_QOS_PREF(true, BT_GAP_LE_PHY_2M, 0x02, 10, 40000, 40000, 40000, 40000); +static const struct bt_bap_qos_cfg_pref qos_pref = + BT_BAP_QOS_CFG_PREF(true, BT_GAP_LE_PHY_2M, 0x02, 10, 40000, 40000, 40000, 40000); static int unicast_server_cb_config_custom_fake(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, struct bt_bap_stream **stream, - struct bt_audio_codec_qos_pref *const pref, + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { *stream = &test_stream; diff --git a/tests/bluetooth/audio/ascs/src/test_ase_state_transition.c b/tests/bluetooth/audio/ascs/src/test_ase_state_transition.c index f93e5276f391a..d91af834c52d6 100644 --- a/tests/bluetooth/audio/ascs/src/test_ase_state_transition.c +++ b/tests/bluetooth/audio/ascs/src/test_ase_state_transition.c @@ -29,8 +29,8 @@ #define test_sink_ase_state_transition_fixture test_ase_state_transition_fixture #define test_source_ase_state_transition_fixture test_ase_state_transition_fixture -static const struct bt_audio_codec_qos_pref qos_pref = - BT_AUDIO_CODEC_QOS_PREF(true, BT_GAP_LE_PHY_2M, 0x02, 10, 40000, 40000, 40000, 40000); +static const struct bt_bap_qos_cfg_pref qos_pref = + BT_BAP_QOS_CFG_PREF(true, BT_GAP_LE_PHY_2M, 0x02, 10, 40000, 40000, 40000, 40000); struct test_ase_state_transition_fixture { struct bt_conn conn; diff --git a/tests/bluetooth/audio/ascs/src/test_common.c b/tests/bluetooth/audio/ascs/src/test_common.c index 429c7edd81d71..5136c154d28e1 100644 --- a/tests/bluetooth/audio/ascs/src/test_common.c +++ b/tests/bluetooth/audio/ascs/src/test_common.c @@ -127,14 +127,14 @@ uint8_t test_ase_id_get(const struct bt_gatt_attr *ase) } static struct bt_bap_stream *stream_allocated; -static const struct bt_audio_codec_qos_pref qos_pref = - BT_AUDIO_CODEC_QOS_PREF(true, BT_GAP_LE_PHY_2M, 0x02, 10, 40000, 40000, 40000, 40000); +static const struct bt_bap_qos_cfg_pref qos_pref = + BT_BAP_QOS_CFG_PREF(true, BT_GAP_LE_PHY_2M, 0x02, 10, 40000, 40000, 40000, 40000); static int unicast_server_cb_config_custom_fake(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, struct bt_bap_stream **stream, - struct bt_audio_codec_qos_pref *const pref, + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { *stream = stream_allocated; diff --git a/tests/bluetooth/audio/ascs/uut/bap_unicast_server.c b/tests/bluetooth/audio/ascs/uut/bap_unicast_server.c index b099008e3c762..6d256d1982202 100644 --- a/tests/bluetooth/audio/ascs/uut/bap_unicast_server.c +++ b/tests/bluetooth/audio/ascs/uut/bap_unicast_server.c @@ -33,12 +33,12 @@ void mock_bap_unicast_server_cleanup(void) DEFINE_FAKE_VALUE_FUNC(int, mock_bap_unicast_server_cb_config, struct bt_conn *, const struct bt_bap_ep *, enum bt_audio_dir, const struct bt_audio_codec_cfg *, struct bt_bap_stream **, - struct bt_audio_codec_qos_pref *const, struct bt_bap_ascs_rsp *); + struct bt_bap_qos_cfg_pref *const, struct bt_bap_ascs_rsp *); DEFINE_FAKE_VALUE_FUNC(int, mock_bap_unicast_server_cb_reconfig, struct bt_bap_stream *, enum bt_audio_dir, const struct bt_audio_codec_cfg *, - struct bt_audio_codec_qos_pref *const, struct bt_bap_ascs_rsp *); + struct bt_bap_qos_cfg_pref *const, struct bt_bap_ascs_rsp *); DEFINE_FAKE_VALUE_FUNC(int, mock_bap_unicast_server_cb_qos, struct bt_bap_stream *, - const struct bt_audio_codec_qos *, struct bt_bap_ascs_rsp *); + const struct bt_bap_qos_cfg *, struct bt_bap_ascs_rsp *); DEFINE_FAKE_VALUE_FUNC(int, mock_bap_unicast_server_cb_enable, struct bt_bap_stream *, const uint8_t *, size_t, struct bt_bap_ascs_rsp *); DEFINE_FAKE_VALUE_FUNC(int, mock_bap_unicast_server_cb_start, struct bt_bap_stream *, diff --git a/tests/bluetooth/audio/bap_broadcast_source/src/main.c b/tests/bluetooth/audio/bap_broadcast_source/src/main.c index b3e1c59db240f..d1e1194986325 100644 --- a/tests/bluetooth/audio/bap_broadcast_source/src/main.c +++ b/tests/bluetooth/audio/bap_broadcast_source/src/main.c @@ -54,7 +54,7 @@ static void bap_broadcast_source_test_suite_fixture_init( struct bt_bap_broadcast_source_subgroup_param *subgroup_param; struct bt_bap_broadcast_source_stream_param *stream_params; struct bt_audio_codec_cfg *codec_cfg; - struct bt_audio_codec_qos *codec_qos; + struct bt_bap_qos_cfg *qos_cfg; struct bt_bap_stream *streams; const uint16_t latency = 10U; /* ms*/ const uint32_t pd = 40000U; /* us */ @@ -75,8 +75,8 @@ static void bap_broadcast_source_test_suite_fixture_init( zassert_not_null(stream_params); codec_cfg = malloc(sizeof(struct bt_audio_codec_cfg)); zassert_not_null(codec_cfg); - codec_qos = malloc(sizeof(struct bt_audio_codec_qos)); - zassert_not_null(codec_qos); + qos_cfg = malloc(sizeof(struct bt_bap_qos_cfg)); + zassert_not_null(qos_cfg); streams = malloc(sizeof(struct bt_bap_stream) * CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT); zassert_not_null(streams); bis_data = malloc(CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_SIZE); @@ -91,14 +91,14 @@ static void bap_broadcast_source_test_suite_fixture_init( sizeof(struct bt_bap_broadcast_source_stream_param) * CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT); memset(codec_cfg, 0, sizeof(struct bt_audio_codec_cfg)); - memset(codec_qos, 0, sizeof(struct bt_audio_codec_qos)); + memset(qos_cfg, 0, sizeof(struct bt_bap_qos_cfg)); memset(streams, 0, sizeof(struct bt_bap_stream) * CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT); memset(bis_data, 0, CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_SIZE); /* Initialize default values*/ *codec_cfg = BT_AUDIO_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CFG_FREQ_16KHZ, BT_AUDIO_CODEC_CFG_DURATION_10, loc, 40U, 1, ctx); - *codec_qos = BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, sdu, rtn, latency, pd); + *qos_cfg = BT_BAP_QOS_CFG_UNFRAMED(10000u, sdu, rtn, latency, pd); memcpy(bis_data, bis_cfg_data, sizeof(bis_cfg_data)); for (size_t i = 0U; i < CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT; i++) { @@ -116,7 +116,7 @@ static void bap_broadcast_source_test_suite_fixture_init( fixture->param->params_count = CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT; fixture->param->params = subgroup_param; - fixture->param->qos = codec_qos; + fixture->param->qos = qos_cfg; fixture->param->encryption = false; memset(fixture->param->broadcast_code, 0, sizeof(fixture->param->broadcast_code)); fixture->param->packing = BT_ISO_PACKING_SEQUENTIAL; @@ -320,7 +320,7 @@ ZTEST_F(bap_broadcast_source_test_suite, test_broadcast_source_create_inval_subg ZTEST_F(bap_broadcast_source_test_suite, test_broadcast_source_create_inval_qos_null) { struct bt_bap_broadcast_source_param *create_param = fixture->param; - struct bt_audio_codec_qos *qos = create_param->qos; + struct bt_bap_qos_cfg *qos = create_param->qos; int err; create_param->qos = NULL; @@ -759,7 +759,7 @@ ZTEST_F(bap_broadcast_source_test_suite, ZTEST_F(bap_broadcast_source_test_suite, test_broadcast_source_reconfigure_inval_qos_null) { struct bt_bap_broadcast_source_param *param = fixture->param; - struct bt_audio_codec_qos *qos = param->qos; + struct bt_bap_qos_cfg *qos = param->qos; int err; printk("Creating broadcast source with %zu subgroups with %zu streams\n", diff --git a/tests/bluetooth/audio/cap_initiator/uut/bap_unicast_client.c b/tests/bluetooth/audio/cap_initiator/uut/bap_unicast_client.c index 387aeaf41ba32..739e2ead1c198 100644 --- a/tests/bluetooth/audio/cap_initiator/uut/bap_unicast_client.c +++ b/tests/bluetooth/audio/cap_initiator/uut/bap_unicast_client.c @@ -43,7 +43,7 @@ int bt_bap_unicast_client_config(struct bt_bap_stream *stream, stream->ep->status.state = BT_BAP_EP_STATE_CODEC_CONFIGURED; if (stream->ops != NULL && stream->ops->configured != NULL) { - const struct bt_audio_codec_qos_pref pref = {0}; + const struct bt_bap_qos_cfg_pref pref = {0}; stream->ops->configured(stream, &pref); } diff --git a/tests/bluetooth/audio/mocks/include/bap_stream.h b/tests/bluetooth/audio/mocks/include/bap_stream.h index 8bc1d3217e444..c823d7089fb8d 100644 --- a/tests/bluetooth/audio/mocks/include/bap_stream.h +++ b/tests/bluetooth/audio/mocks/include/bap_stream.h @@ -16,7 +16,7 @@ void mock_bap_stream_init(void); void mock_bap_stream_cleanup(void); DECLARE_FAKE_VOID_FUNC(mock_bap_stream_configured_cb, struct bt_bap_stream *, - const struct bt_audio_codec_qos_pref *); + const struct bt_bap_qos_cfg_pref *); DECLARE_FAKE_VOID_FUNC(mock_bap_stream_qos_set_cb, struct bt_bap_stream *); DECLARE_FAKE_VOID_FUNC(mock_bap_stream_enabled_cb, struct bt_bap_stream *); DECLARE_FAKE_VOID_FUNC(mock_bap_stream_metadata_updated_cb, struct bt_bap_stream *); diff --git a/tests/bluetooth/audio/mocks/src/bap_stream.c b/tests/bluetooth/audio/mocks/src/bap_stream.c index 940dbeb76dcf3..31b060d0111da 100644 --- a/tests/bluetooth/audio/mocks/src/bap_stream.c +++ b/tests/bluetooth/audio/mocks/src/bap_stream.c @@ -26,7 +26,7 @@ struct bt_bap_stream_ops mock_bap_stream_ops; DEFINE_FAKE_VOID_FUNC(mock_bap_stream_configured_cb, struct bt_bap_stream *, - const struct bt_audio_codec_qos_pref *); + const struct bt_bap_qos_cfg_pref *); DEFINE_FAKE_VOID_FUNC(mock_bap_stream_qos_set_cb, struct bt_bap_stream *); DEFINE_FAKE_VOID_FUNC(mock_bap_stream_enabled_cb, struct bt_bap_stream *); DEFINE_FAKE_VOID_FUNC(mock_bap_stream_metadata_updated_cb, struct bt_bap_stream *); diff --git a/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c b/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c index b5243202c058d..0c32c0a13eb45 100644 --- a/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c +++ b/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c @@ -319,7 +319,7 @@ uint8_t btp_bap_broadcast_source_setup(const void *cmd, uint16_t cmd_len, codec_cfg.data_len = cp->cc_ltvs_len; memcpy(codec_cfg.data, cp->cc_ltvs, cp->cc_ltvs_len); - source->qos.phy = BT_AUDIO_CODEC_QOS_2M; + source->qos.phy = BT_BAP_QOS_CFG_2M; source->qos.framing = cp->framing; source->qos.rtn = cp->retransmission_num; source->qos.latency = sys_le16_to_cpu(cp->max_transport_latency); diff --git a/tests/bluetooth/tester/src/audio/btp_bap_broadcast.h b/tests/bluetooth/tester/src/audio/btp_bap_broadcast.h index cbecb446b3a8a..4471928f84cc4 100644 --- a/tests/bluetooth/tester/src/audio/btp_bap_broadcast.h +++ b/tests/bluetooth/tester/src/audio/btp_bap_broadcast.h @@ -30,7 +30,7 @@ struct btp_bap_broadcast_remote_source { struct btp_bap_broadcast_stream streams[CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT]; struct bt_bap_stream *sink_streams[CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT]; struct bt_bap_broadcast_sink *sink; - struct bt_audio_codec_qos qos; + struct bt_bap_qos_cfg qos; /* BIS Index bitfield read from Base */ uint32_t bis_index_bitfield; /* BIS Index bitfield read from sync request */ @@ -42,7 +42,7 @@ struct btp_bap_broadcast_remote_source { struct btp_bap_broadcast_local_source { uint32_t broadcast_id; - struct bt_audio_codec_qos qos; + struct bt_bap_qos_cfg qos; struct btp_bap_broadcast_stream streams[CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT]; struct bt_audio_codec_cfg subgroup_codec_cfg[CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT]; /* Only for BTP BAP commands */ diff --git a/tests/bluetooth/tester/src/audio/btp_bap_unicast.c b/tests/bluetooth/tester/src/audio/btp_bap_unicast.c index 0a78441f0132c..cf502b5861d33 100644 --- a/tests/bluetooth/tester/src/audio/btp_bap_unicast.c +++ b/tests/bluetooth/tester/src/audio/btp_bap_unicast.c @@ -25,8 +25,8 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME, CONFIG_BTTESTER_LOG_LEVEL); #include "btp_bap_audio_stream.h" #include "btp_bap_unicast.h" -static struct bt_audio_codec_qos_pref qos_pref = - BT_AUDIO_CODEC_QOS_PREF(true, BT_GAP_LE_PHY_2M, 0x02, 10, 10000, 40000, 10000, 40000); +static struct bt_bap_qos_cfg_pref qos_pref = + BT_BAP_QOS_CFG_PREF(true, BT_GAP_LE_PHY_2M, 0x02, 10, 10000, 40000, 10000, 40000); static struct btp_bap_unicast_connection connections[CONFIG_BT_MAX_CONN]; static struct btp_bap_unicast_group cigs[CONFIG_BT_ISO_MAX_CIG]; @@ -268,7 +268,7 @@ static void btp_send_ase_found_ev(struct bt_conn *conn, struct bt_bap_ep *ep) tester_event(BTP_SERVICE_ID_BAP, BTP_BAP_EV_ASE_FOUND, &ev, sizeof(ev)); } -static inline void print_qos(const struct bt_audio_codec_qos *qos) +static inline void print_qos(const struct bt_bap_qos_cfg *qos) { LOG_DBG("QoS: interval %u framing 0x%02x phy 0x%02x sdu %u rtn %u latency %u pd %u", qos->interval, qos->framing, qos->phy, qos->sdu, qos->rtn, qos->latency, qos->pd); @@ -323,7 +323,7 @@ static int validate_codec_parameters(const struct bt_audio_codec_cfg *codec_cfg) static int lc3_config(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, struct bt_bap_stream **stream, - struct bt_audio_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp) + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { struct bt_bap_ep_info info; struct btp_bap_unicast_connection *u_conn; @@ -372,7 +372,7 @@ static int lc3_config(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_ static int lc3_reconfig(struct bt_bap_stream *stream, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, - struct bt_audio_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp) + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { LOG_DBG("ASE Codec Reconfig: stream %p", stream); @@ -381,7 +381,7 @@ static int lc3_reconfig(struct bt_bap_stream *stream, enum bt_audio_dir dir, return 0; } -static int lc3_qos(struct bt_bap_stream *stream, const struct bt_audio_codec_qos *qos, +static int lc3_qos(struct bt_bap_stream *stream, const struct bt_bap_qos_cfg *qos, struct bt_bap_ascs_rsp *rsp) { LOG_DBG("QoS: stream %p qos %p", stream, qos); @@ -500,8 +500,7 @@ static const struct bt_bap_unicast_server_cb unicast_server_cb = { .release = lc3_release, }; -static void stream_configured(struct bt_bap_stream *stream, - const struct bt_audio_codec_qos_pref *pref) +static void stream_configured(struct bt_bap_stream *stream, const struct bt_bap_qos_cfg_pref *pref) { struct bt_bap_ep_info info; struct btp_bap_unicast_connection *u_conn; @@ -957,7 +956,7 @@ uint8_t btp_bap_discover(const void *cmd, uint16_t cmd_len, static int server_stream_config(struct bt_conn *conn, struct bt_bap_stream *stream, struct bt_audio_codec_cfg *codec_cfg, - struct bt_audio_codec_qos_pref *qos) + struct bt_bap_qos_cfg_pref *qos) { int err; struct bt_bap_ep_info info; @@ -1276,14 +1275,14 @@ uint8_t btp_ascs_preconfigure_qos(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len) { const struct btp_ascs_preconfigure_qos_cmd *cp = cmd; - struct bt_audio_codec_qos *qos; + struct bt_bap_qos_cfg *qos; LOG_DBG(""); qos = &cigs[cp->cig_id].qos[cp->cis_id]; memset(qos, 0, sizeof(*qos)); - qos->phy = BT_AUDIO_CODEC_QOS_2M; + qos->phy = BT_BAP_QOS_CFG_2M; qos->framing = cp->framing; qos->rtn = cp->retransmission_num; qos->sdu = sys_le16_to_cpu(cp->max_sdu); diff --git a/tests/bluetooth/tester/src/audio/btp_bap_unicast.h b/tests/bluetooth/tester/src/audio/btp_bap_unicast.h index 1ac0bac1aa935..2d62ad3e56edd 100644 --- a/tests/bluetooth/tester/src/audio/btp_bap_unicast.h +++ b/tests/bluetooth/tester/src/audio/btp_bap_unicast.h @@ -18,7 +18,7 @@ CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT struct btp_bap_unicast_group { - struct bt_audio_codec_qos qos[CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT]; + struct bt_bap_qos_cfg qos[CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT]; struct bt_bap_unicast_group *cig; bool in_use; }; diff --git a/tests/bluetooth/tester/src/audio/btp_cap.c b/tests/bluetooth/tester/src/audio/btp_cap.c index b4135f0a510e6..ed0ebfacbfb86 100644 --- a/tests/bluetooth/tester/src/audio/btp_cap.c +++ b/tests/bluetooth/tester/src/audio/btp_cap.c @@ -190,7 +190,7 @@ static uint8_t btp_cap_discover(const void *cmd, uint16_t cmd_len, static int cap_unicast_setup_ase(struct bt_conn *conn, uint8_t ase_id, uint8_t cis_id, uint8_t cig_id, struct bt_audio_codec_cfg *codec_cfg, - struct bt_audio_codec_qos *qos) + struct bt_bap_qos_cfg *qos) { struct btp_bap_unicast_group *group; struct btp_bap_unicast_stream *u_stream; @@ -232,7 +232,7 @@ static uint8_t btp_cap_unicast_setup_ase(const void *cmd, uint16_t cmd_len, { const struct btp_cap_unicast_setup_ase_cmd *cp = cmd; struct bt_audio_codec_cfg codec_cfg; - struct bt_audio_codec_qos qos; + struct bt_bap_qos_cfg qos; struct bt_conn *conn; const uint8_t *ltv_ptr; int err; @@ -247,7 +247,7 @@ static uint8_t btp_cap_unicast_setup_ase(const void *cmd, uint16_t cmd_len, } memset(&qos, 0, sizeof(qos)); - qos.phy = BT_AUDIO_CODEC_QOS_2M; + qos.phy = BT_BAP_QOS_CFG_2M; qos.framing = cp->framing; qos.rtn = cp->retransmission_num; qos.sdu = sys_le16_to_cpu(cp->max_sdu); @@ -605,7 +605,7 @@ static uint8_t btp_cap_broadcast_source_setup(const void *cmd, uint16_t cmd_len, struct btp_cap_broadcast_source_setup_rp *rp = rsp; struct btp_bap_broadcast_local_source *source = btp_bap_broadcast_local_source_get(cp->source_id); - struct bt_audio_codec_qos *qos = &source->qos; + struct bt_bap_qos_cfg *qos = &source->qos; LOG_DBG(""); @@ -651,7 +651,7 @@ static uint8_t btp_cap_broadcast_source_setup(const void *cmd, uint16_t cmd_len, } memset(qos, 0, sizeof(*qos)); - qos->phy = BT_AUDIO_CODEC_QOS_2M; + qos->phy = BT_BAP_QOS_CFG_2M; qos->framing = cp->framing; qos->rtn = cp->retransmission_num; qos->sdu = sys_le16_to_cpu(cp->max_sdu); diff --git a/tests/bsim/bluetooth/audio/src/bap_common.c b/tests/bsim/bluetooth/audio/src/bap_common.c index 0c39db4c68af9..aa918b205dac5 100644 --- a/tests/bsim/bluetooth/audio/src/bap_common.c +++ b/tests/bsim/bluetooth/audio/src/bap_common.c @@ -85,7 +85,7 @@ void print_codec_cfg(const struct bt_audio_codec_cfg *codec_cfg) print_ltv_array("meta", codec_cfg->meta, codec_cfg->meta_len); } -void print_qos(const struct bt_audio_codec_qos *qos) +void print_qos(const struct bt_bap_qos_cfg *qos) { printk("QoS: interval %u framing 0x%02x phy 0x%02x sdu %u " "rtn %u latency %u pd %u\n", diff --git a/tests/bsim/bluetooth/audio/src/bap_common.h b/tests/bsim/bluetooth/audio/src/bap_common.h index ccf11689c9f7e..dda1394343718 100644 --- a/tests/bsim/bluetooth/audio/src/bap_common.h +++ b/tests/bsim/bluetooth/audio/src/bap_common.h @@ -46,7 +46,7 @@ struct unicast_stream { struct bt_cap_stream stream; struct bt_audio_codec_cfg codec_cfg; - struct bt_audio_codec_qos qos; + struct bt_bap_qos_cfg qos; }; struct named_lc3_preset { @@ -57,7 +57,7 @@ struct named_lc3_preset { void print_hex(const uint8_t *ptr, size_t len); void print_codec_cap(const struct bt_audio_codec_cap *codec_cap); void print_codec_cfg(const struct bt_audio_codec_cfg *codec_cfg); -void print_qos(const struct bt_audio_codec_qos *qos); +void print_qos(const struct bt_bap_qos_cfg *qos); void copy_unicast_stream_preset(struct unicast_stream *stream, const struct named_lc3_preset *named_preset); diff --git a/tests/bsim/bluetooth/audio/src/bap_unicast_client_test.c b/tests/bsim/bluetooth/audio/src/bap_unicast_client_test.c index 134df428ab892..913c21b6ecceb 100644 --- a/tests/bsim/bluetooth/audio/src/bap_unicast_client_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_unicast_client_test.c @@ -72,8 +72,7 @@ CREATE_FLAG(flag_stream_stopped); CREATE_FLAG(flag_stream_released); CREATE_FLAG(flag_operation_success); -static void stream_configured(struct bt_bap_stream *stream, - const struct bt_audio_codec_qos_pref *pref) +static void stream_configured(struct bt_bap_stream *stream, const struct bt_bap_qos_cfg_pref *pref) { printk("Configured stream %p\n", stream); @@ -1197,9 +1196,8 @@ static void test_main_async_group(void) { struct bt_bap_stream rx_stream = {0}; struct bt_bap_stream tx_stream = {0}; - struct bt_audio_codec_qos rx_qos = BT_AUDIO_CODEC_QOS_UNFRAMED(7500U, 30U, 2U, 75U, 40000U); - struct bt_audio_codec_qos tx_qos = - BT_AUDIO_CODEC_QOS_UNFRAMED(10000U, 40U, 2U, 100U, 40000U); + struct bt_bap_qos_cfg rx_qos = BT_BAP_QOS_CFG_UNFRAMED(7500U, 30U, 2U, 75U, 40000U); + struct bt_bap_qos_cfg tx_qos = BT_BAP_QOS_CFG_UNFRAMED(10000U, 40U, 2U, 100U, 40000U); struct bt_bap_unicast_group_stream_param rx_param = { .qos = &rx_qos, .stream = &rx_stream, diff --git a/tests/bsim/bluetooth/audio/src/bap_unicast_server_test.c b/tests/bsim/bluetooth/audio/src/bap_unicast_server_test.c index c48d86732e7d8..cfade8d7e939a 100644 --- a/tests/bsim/bluetooth/audio/src/bap_unicast_server_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_unicast_server_test.c @@ -70,8 +70,8 @@ static const struct bt_audio_codec_cap lc3_codec_cap = { static struct audio_test_stream test_streams[CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT + CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT]; -static const struct bt_audio_codec_qos_pref qos_pref = - BT_AUDIO_CODEC_QOS_PREF(true, BT_GAP_LE_PHY_2M, 0x02, 10, 40000, 40000, 40000, 40000); +static const struct bt_bap_qos_cfg_pref qos_pref = + BT_BAP_QOS_CFG_PREF(true, BT_GAP_LE_PHY_2M, 0x02, 10, 40000, 40000, 40000, 40000); static uint8_t unicast_server_addata[] = { BT_UUID_16_ENCODE(BT_UUID_ASCS_VAL), /* ASCS UUID */ @@ -113,7 +113,7 @@ static struct bt_bap_stream *stream_alloc(void) static int lc3_config(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, struct bt_bap_stream **stream, - struct bt_audio_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp) + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { printk("ASE Codec Config: conn %p ep %p dir %u\n", conn, ep, dir); @@ -139,7 +139,7 @@ static int lc3_config(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_ static int lc3_reconfig(struct bt_bap_stream *stream, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, - struct bt_audio_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp) + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { printk("ASE Codec Reconfig: stream %p\n", stream); @@ -150,7 +150,7 @@ static int lc3_reconfig(struct bt_bap_stream *stream, enum bt_audio_dir dir, return -ENOEXEC; } -static int lc3_qos(struct bt_bap_stream *stream, const struct bt_audio_codec_qos *qos, +static int lc3_qos(struct bt_bap_stream *stream, const struct bt_bap_qos_cfg *qos, struct bt_bap_ascs_rsp *rsp) { struct audio_test_stream *test_stream = audio_test_stream_from_bap_stream(stream); diff --git a/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c b/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c index 7a9dfe2310ad5..59550d2a6ebb9 100644 --- a/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c @@ -64,8 +64,8 @@ static struct bt_le_per_adv_sync *pa_sync; static uint32_t broadcaster_broadcast_id; static struct audio_test_stream broadcast_sink_streams[CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT]; -static const struct bt_audio_codec_qos_pref unicast_qos_pref = - BT_AUDIO_CODEC_QOS_PREF(true, BT_GAP_LE_PHY_2M, 0u, 60u, 20000u, 40000u, 20000u, 40000u); +static const struct bt_bap_qos_cfg_pref unicast_qos_pref = + BT_BAP_QOS_CFG_PREF(true, BT_GAP_LE_PHY_2M, 0u, 60u, 20000u, 40000u, 20000u, 40000u); static bool auto_start_sink_streams; @@ -452,7 +452,7 @@ static struct bt_bap_stream *unicast_stream_alloc(void) static int unicast_server_config(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, struct bt_bap_stream **stream, - struct bt_audio_codec_qos_pref *const pref, + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { printk("ASE Codec Config: conn %p ep %p dir %u\n", conn, ep, dir); @@ -478,7 +478,7 @@ static int unicast_server_config(struct bt_conn *conn, const struct bt_bap_ep *e static int unicast_server_reconfig(struct bt_bap_stream *stream, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, - struct bt_audio_codec_qos_pref *const pref, + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { printk("ASE Codec Reconfig: stream %p\n", stream); @@ -493,7 +493,7 @@ static int unicast_server_reconfig(struct bt_bap_stream *stream, enum bt_audio_d return -ENOEXEC; } -static int unicast_server_qos(struct bt_bap_stream *stream, const struct bt_audio_codec_qos *qos, +static int unicast_server_qos(struct bt_bap_stream *stream, const struct bt_bap_qos_cfg *qos, struct bt_bap_ascs_rsp *rsp) { printk("QoS: stream %p qos %p\n", stream, qos); diff --git a/tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c b/tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c index 724623240372e..d1d6618b83bd4 100644 --- a/tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c @@ -727,7 +727,7 @@ static int test_cap_initiator_ac(const struct cap_initiator_ac_param *param) struct bt_cap_initiator_broadcast_create_param create_param = {0}; struct bt_cap_broadcast_source *broadcast_source; struct bt_audio_codec_cfg codec_cfg; - struct bt_audio_codec_qos qos; + struct bt_bap_qos_cfg qos; struct bt_le_ext_adv *adv; int err; diff --git a/tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c b/tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c index eb063eddb1efc..91e07b03d435e 100644 --- a/tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c @@ -129,7 +129,7 @@ static const struct named_lc3_preset lc3_unicast_presets[] = { }; static void unicast_stream_configured(struct bt_bap_stream *stream, - const struct bt_audio_codec_qos_pref *pref) + const struct bt_bap_qos_cfg_pref *pref) { struct bt_cap_stream *cap_stream = cap_stream_from_bap_stream(stream); printk("Configured stream %p\n", stream); @@ -902,8 +902,8 @@ static int cap_initiator_ac_create_unicast_group(const struct cap_initiator_ac_p struct bt_bap_unicast_group_stream_param src_group_stream_params[CAP_AC_MAX_SRC] = {0}; struct bt_bap_unicast_group_stream_pair_param pair_params[CAP_AC_MAX_PAIR] = {0}; struct bt_bap_unicast_group_param group_param = {0}; - struct bt_audio_codec_qos *snk_qos[CAP_AC_MAX_SNK]; - struct bt_audio_codec_qos *src_qos[CAP_AC_MAX_SRC]; + struct bt_bap_qos_cfg *snk_qos[CAP_AC_MAX_SNK]; + struct bt_bap_qos_cfg *src_qos[CAP_AC_MAX_SRC]; size_t snk_stream_cnt = 0U; size_t src_stream_cnt = 0U; size_t pair_cnt = 0U; diff --git a/tests/bsim/bluetooth/audio/src/gmap_ugg_test.c b/tests/bsim/bluetooth/audio/src/gmap_ugg_test.c index 00b8f5f931b05..d1039e64aee81 100644 --- a/tests/bsim/bluetooth/audio/src/gmap_ugg_test.c +++ b/tests/bsim/bluetooth/audio/src/gmap_ugg_test.c @@ -226,7 +226,7 @@ static void stream_sent_cb(struct bt_bap_stream *bap_stream) } static void stream_configured_cb(struct bt_bap_stream *stream, - const struct bt_audio_codec_qos_pref *pref) + const struct bt_bap_qos_cfg_pref *pref) { printk("Configured stream %p\n", stream); @@ -1203,7 +1203,7 @@ static int test_gmap_ugg_broadcast_ac(const struct gmap_broadcast_ac_param *para stream_params[GMAP_BROADCAST_AC_MAX_STREAM] = {0}; struct bt_cap_broadcast_source *broadcast_source; struct bt_audio_codec_cfg codec_cfg; - struct bt_audio_codec_qos qos; + struct bt_bap_qos_cfg qos; struct bt_le_ext_adv *adv; int err; diff --git a/tests/bsim/bluetooth/audio/src/gmap_ugt_test.c b/tests/bsim/bluetooth/audio/src/gmap_ugt_test.c index 09de70135fefa..d79ca961ebe53 100644 --- a/tests/bsim/bluetooth/audio/src/gmap_ugt_test.c +++ b/tests/bsim/bluetooth/audio/src/gmap_ugt_test.c @@ -42,8 +42,8 @@ static struct bt_audio_codec_cap codec_cap = BT_AUDIO_CODEC_CAP_LC3(BT_AUDIO_CODEC_CAP_FREQ_ANY, BT_AUDIO_CODEC_CAP_DURATION_ANY, BT_AUDIO_CODEC_CAP_CHAN_COUNT_SUPPORT(1, 2), 30, 240, 2, CONTEXT); -static const struct bt_audio_codec_qos_pref unicast_qos_pref = - BT_AUDIO_CODEC_QOS_PREF(true, BT_GAP_LE_PHY_2M, 0U, 60U, 10000U, 60000U, 10000U, 60000U); +static const struct bt_bap_qos_cfg_pref unicast_qos_pref = + BT_BAP_QOS_CFG_PREF(true, BT_GAP_LE_PHY_2M, 0U, 60U, 10000U, 60000U, 10000U, 60000U); #define UNICAST_CHANNEL_COUNT_1 BIT(0) @@ -112,7 +112,7 @@ static struct bt_bap_stream *unicast_stream_alloc(void) static int unicast_server_config(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, struct bt_bap_stream **stream, - struct bt_audio_codec_qos_pref *const pref, + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { printk("ASE Codec Config: conn %p ep %p dir %u\n", conn, ep, dir); @@ -136,7 +136,7 @@ static int unicast_server_config(struct bt_conn *conn, const struct bt_bap_ep *e static int unicast_server_reconfig(struct bt_bap_stream *stream, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec_cfg, - struct bt_audio_codec_qos_pref *const pref, + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { printk("ASE Codec Reconfig: stream %p\n", stream); @@ -151,7 +151,7 @@ static int unicast_server_reconfig(struct bt_bap_stream *stream, enum bt_audio_d return -ENOEXEC; } -static int unicast_server_qos(struct bt_bap_stream *stream, const struct bt_audio_codec_qos *qos, +static int unicast_server_qos(struct bt_bap_stream *stream, const struct bt_bap_qos_cfg *qos, struct bt_bap_ascs_rsp *rsp) { printk("QoS: stream %p qos %p\n", stream, qos); From 9fe6c5e3fb38d8b0b62b173eeaff48334ecfb060 Mon Sep 17 00:00:00 2001 From: Jonathon Penix Date: Tue, 27 Aug 2024 17:11:06 -0700 Subject: [PATCH 0261/4482] cmake: linker: Use the same linker for cmake checks and final build Currently, the linker that is used when performing various cmake checks (check_c_compiler_flag, for example) may be different than the linker that will be used during the actual build. This happens as we currently specify '-fuse-ld' to force the appropriate linker a) after many such checks have already happened and b) in a way which is not automatically propagated to check_c_compiler_flag (and friends). As a result, the toolchain's default linker will generally be used for such checks regardless of which linker was selected in Zephyr. This can lead to a number of surprises when building Zephyr, particularly when building with clang. For example: - If the linker is misconfigured, where the build will fail can vary depending on whether the linker is the toolchain's default. When the configured linker happens to be the toolchain's default, the build (helpfully) fails quickly on the checks for a basic working toochain. When the configured linker isn't the default, the build won't fail until the final link steps. - The build can fail due to issues with a linker other than the one configured by the user in Zephyr. For example, LLVM toolchains without lld will generally fail to build Zephyr (the checks for a basic working toochain will fail) for targets where lld is the default in LLVM even if GNU ld is configured in Zephyr and would otherwise be used in the final build. - Flags which are only added if check_c_compiler_flag (or similar) succeeds may be unexpectedly omitted during the final build if the flag is supported in the configured linker but is unsupported in the toolchain's default linker (as check_c_compiler_flag will test using the default one). Note that this isn't limited to clang--even when we are building with Zephyr's SDK and force ld.bfd, we seem to use the 'ld' variant during the cmake checks (though this generally seems fairly harmless compared to mixing ld/lld or other proprietary linkers). To fix this, ensure the appropriate 'fuse-ld' is set early enough and in such a way that the same linker will be used throughout the entire build. Signed-off-by: Jonathon Penix Signed-off-by: Torsten Rasmussen --- cmake/linker/ld/target.cmake | 15 ++++++++------- cmake/linker/lld/target.cmake | 4 ++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/cmake/linker/ld/target.cmake b/cmake/linker/ld/target.cmake index 8c18fce0e9a2c..ccf1493aa834f 100644 --- a/cmake/linker/ld/target.cmake +++ b/cmake/linker/ld/target.cmake @@ -6,6 +6,14 @@ set(CMAKE_LINKER ${GNULD_LINKER}) set_ifndef(LINKERFLAGPREFIX -Wl) +if((${CMAKE_LINKER} STREQUAL "${CROSS_COMPILE}ld.bfd") OR + ${GNULD_LINKER_IS_BFD}) + # ld.bfd was found so let's explicitly use that for linking, see #32237 + list(APPEND TOOLCHAIN_LD_FLAGS -fuse-ld=bfd) + list(APPEND CMAKE_REQUIRED_FLAGS -fuse-ld=bfd) + string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") +endif() + if(NOT "${ZEPHYR_TOOLCHAIN_VARIANT}" STREQUAL "host") if(CONFIG_CPP_EXCEPTIONS AND LIBGCC_DIR) # When building with C++ Exceptions, it is important that crtbegin and crtend @@ -117,16 +125,9 @@ function(toolchain_ld_link_elf) ${ARGN} # input args to parse ) - if((${CMAKE_LINKER} STREQUAL "${CROSS_COMPILE}ld.bfd") OR - ${GNULD_LINKER_IS_BFD}) - # ld.bfd was found so let's explicitly use that for linking, see #32237 - set(use_linker "-fuse-ld=bfd") - endif() - target_link_libraries( ${TOOLCHAIN_LD_LINK_ELF_TARGET_ELF} ${TOOLCHAIN_LD_LINK_ELF_LIBRARIES_PRE_SCRIPT} - ${use_linker} ${TOPT} ${TOOLCHAIN_LD_LINK_ELF_LINKER_SCRIPT} ${TOOLCHAIN_LD_LINK_ELF_LIBRARIES_POST_SCRIPT} diff --git a/cmake/linker/lld/target.cmake b/cmake/linker/lld/target.cmake index a16529eeef79d..9ce3313334f3e 100644 --- a/cmake/linker/lld/target.cmake +++ b/cmake/linker/lld/target.cmake @@ -6,6 +6,10 @@ set(CMAKE_LINKER ${LLVMLLD_LINKER}) set_ifndef(LINKERFLAGPREFIX -Wl) +list(APPEND TOOLCHAIN_LD_FLAGS -fuse-ld=lld) +list(APPEND CMAKE_REQUIRED_FLAGS -fuse-ld=lld) +string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + # Run $LINKER_SCRIPT file through the C preprocessor, producing ${linker_script_gen} # NOTE: ${linker_script_gen} will be produced at build-time; not at configure-time macro(configure_linker_script linker_script_gen linker_pass_define) From 2e3873adde2386e0bc9acdbcdc8d389fdf4b9aee Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Tue, 6 Aug 2024 10:13:31 +0200 Subject: [PATCH 0262/4482] cmake: improve Zephyr link phase Zephyr is a bare metal build where standard libs are disabled. This means that c and runtime libraries must manually be linked in. This has generally been handled by using CMake's link libraries handling but the issue with that is both de-duplication but also library link order. Standard libraries must be linked at last location to ensure symbols are always available, however this is not optimal with target_link_libraries() because this would ultimately require every library to know the c library to link with, which is not desired. Therefore, setup standard C and runtime library linking in linker CMake files for toolchains where this is required. This commit expands the principle introduced with toolchain abstraction, see PR#24851. This means that a toolchain implementation may specify standard C, runtime, C++, etc libraries, as well as their link order. Because a property approach is used, then Zephyr modules, such as the Picolibc module can adjust such properties. An optional `zephyr_linker_finalize()` macro is called at the end of Zephyr's CMakeList process and can be used by the toolchain implementation to define the final linker invocation. This aligns the linker handling flow to the principle introduced in PR#24851 and improves the flexibility and robustness of Zephyr build system. Signed-off-by: Torsten Rasmussen --- CMakeLists.txt | 2 + cmake/compiler/clang/target.cmake | 4 +- cmake/compiler/gcc/target.cmake | 3 +- cmake/linker/armlink/linker_flags.cmake | 6 --- cmake/linker/armlink/linker_libraries.cmake | 8 ++++ cmake/linker/armlink/target.cmake | 18 ++++++++ cmake/linker/ld/linker_flags.cmake | 4 -- cmake/linker/ld/linker_libraries.cmake | 38 ++++++++++++++++ cmake/linker/ld/target.cmake | 46 ++++++++++++++------ cmake/linker/linker_libraries_template.cmake | 16 +++++++ cmake/linker/lld/linker_flags.cmake | 4 +- cmake/linker/lld/linker_libraries.cmake | 21 +++++++++ cmake/linker/lld/target.cmake | 22 +++++++++- cmake/linker/target_template.cmake | 13 ++++++ cmake/linker/xt-ld/target.cmake | 22 +++++++++- cmake/modules/FindTargetTools.cmake | 2 + cmake/modules/extensions.cmake | 33 ++++++++++++++ cmake/target_toolchain_flags.cmake | 2 + cmake/toolchain/llvm/generic.cmake | 2 +- lib/libc/newlib/CMakeLists.txt | 28 ------------ lib/libc/picolibc/CMakeLists.txt | 2 +- 21 files changed, 234 insertions(+), 62 deletions(-) delete mode 100644 cmake/linker/armlink/linker_flags.cmake create mode 100644 cmake/linker/armlink/linker_libraries.cmake create mode 100644 cmake/linker/ld/linker_libraries.cmake create mode 100644 cmake/linker/linker_libraries_template.cmake create mode 100644 cmake/linker/lld/linker_libraries.cmake create mode 100644 cmake/linker/target_template.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index d01529f496df2..c14f5f7f17a0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2233,3 +2233,5 @@ add_subdirectory_ifdef( CONFIG_MAKEFILE_EXPORTS cmake/makefile_exports ) + +toolchain_linker_finalize() diff --git a/cmake/compiler/clang/target.cmake b/cmake/compiler/clang/target.cmake index 30e5da399afcf..d2d41e8b23c13 100644 --- a/cmake/compiler/clang/target.cmake +++ b/cmake/compiler/clang/target.cmake @@ -76,8 +76,8 @@ if(NOT "${ARCH}" STREQUAL "posix") get_filename_component(RTLIB_NAME_WITH_PREFIX ${RTLIB_FILE_NAME} NAME_WLE) string(REPLACE lib "" RTLIB_NAME ${RTLIB_NAME_WITH_PREFIX}) - list(APPEND LIB_INCLUDE_DIR -L${RTLIB_DIR}) - list(APPEND TOOLCHAIN_LIBS ${RTLIB_NAME}) + set_property(TARGET linker PROPERTY lib_include_dir "-L${RTLIB_DIR}") + set_property(TARGET linker PROPERTY rt_library "-l${RTLIB_NAME}") list(APPEND CMAKE_REQUIRED_FLAGS -nostartfiles -nostdlib ${isystem_include_flags}) string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") diff --git a/cmake/compiler/gcc/target.cmake b/cmake/compiler/gcc/target.cmake index 5b1e5db12180a..7e8ffc4817337 100644 --- a/cmake/compiler/gcc/target.cmake +++ b/cmake/compiler/gcc/target.cmake @@ -109,8 +109,7 @@ get_filename_component(LIBGCC_DIR ${LIBGCC_FILE_NAME} DIRECTORY) assert_exists(LIBGCC_DIR) -LIST(APPEND LIB_INCLUDE_DIR "-L\"${LIBGCC_DIR}\"") -LIST(APPEND TOOLCHAIN_LIBS gcc) +set_linker_property(PROPERTY lib_include_dir "-L\"${LIBGCC_DIR}\"") # For CMake to be able to test if a compiler flag is supported by the # toolchain we need to give CMake the necessary flags to compile and diff --git a/cmake/linker/armlink/linker_flags.cmake b/cmake/linker/armlink/linker_flags.cmake deleted file mode 100644 index b0f93a7b9e7dc..0000000000000 --- a/cmake/linker/armlink/linker_flags.cmake +++ /dev/null @@ -1,6 +0,0 @@ -# The ARMClang linker, armlink, requires a dedicated linking signature in -# order for Zephyr to control the map file. - -set(CMAKE_C_LINK_EXECUTABLE " -o ") -set(CMAKE_CXX_LINK_EXECUTABLE " -o ") -set(CMAKE_ASM_LINK_EXECUTABLE " -o ") diff --git a/cmake/linker/armlink/linker_libraries.cmake b/cmake/linker/armlink/linker_libraries.cmake new file mode 100644 index 0000000000000..8374e7c3cd28a --- /dev/null +++ b/cmake/linker/armlink/linker_libraries.cmake @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Nordic Semiconductor +# +# SPDX-License-Identifier: Apache-2.0 + +# Per default armclang (Arm Compiler 6) doesn't need explicit C library linking +# so we only need to set link order linking in case a custom C library is linked +# in, such as picolibc. +set_property(TARGET linker APPEND PROPERTY link_order_library "c;rt") diff --git a/cmake/linker/armlink/target.cmake b/cmake/linker/armlink/target.cmake index 9aa32ad0e6f51..b2e1e867f904a 100644 --- a/cmake/linker/armlink/target.cmake +++ b/cmake/linker/armlink/target.cmake @@ -108,5 +108,23 @@ function(toolchain_ld_link_elf) ) endfunction(toolchain_ld_link_elf) +# This function will generate the correct CMAKE_C_LINK_EXECUTABLE / CMAKE_CXX_LINK_EXECUTABLE +# rule to ensure that standard c and runtime libraries are correctly placed +# and the end of link invocation and doesn't appear in the middle of the link +# command invocation. +macro(toolchain_linker_finalize) + set(zephyr_std_libs) + get_property(link_order TARGET linker PROPERTY link_order_library) + foreach(lib ${link_order}) + get_property(link_flag TARGET linker PROPERTY ${lib}_library) + set(zephyr_std_libs "${zephyr_std_libs} ${link_flag}") + endforeach() + + set(common_link " ${zephyr_std_libs} -o ") + set(CMAKE_C_LINK_EXECUTABLE " ${common_link}") + set(CMAKE_CXX_LINK_EXECUTABLE " ${common_link}") + set(CMAKE_ASM_LINK_EXECUTABLE " ${common_link}") +endmacro() + include(${ZEPHYR_BASE}/cmake/linker/ld/target_relocation.cmake) include(${ZEPHYR_BASE}/cmake/linker/ld/target_configure.cmake) diff --git a/cmake/linker/ld/linker_flags.cmake b/cmake/linker/ld/linker_flags.cmake index 49bba260d3abe..5063ddb46fbab 100644 --- a/cmake/linker/ld/linker_flags.cmake +++ b/cmake/linker/ld/linker_flags.cmake @@ -7,10 +7,6 @@ check_set_linker_property(TARGET linker PROPERTY base ${LINKERFLAGPREFIX},--build-id=none ) -if(NOT CONFIG_MINIMAL_LIBCPP AND NOT CONFIG_NATIVE_LIBRARY AND NOT CONFIG_EXTERNAL_MODULE_LIBCPP) - set_property(TARGET linker PROPERTY cpp_base -lstdc++) -endif() - check_set_linker_property(TARGET linker PROPERTY baremetal -nostdlib -static diff --git a/cmake/linker/ld/linker_libraries.cmake b/cmake/linker/ld/linker_libraries.cmake new file mode 100644 index 0000000000000..1305d682ab5aa --- /dev/null +++ b/cmake/linker/ld/linker_libraries.cmake @@ -0,0 +1,38 @@ +# Copyright (c) 2024 Nordic Semiconductor +# +# SPDX-License-Identifier: Apache-2.0 + +# Do not specify default link libraries when targeting host (native build). +if(NOT CONFIG_NATIVE_BUILD) + set_linker_property(NO_CREATE PROPERTY c_library "-lc") + set_linker_property(NO_CREATE PROPERTY rt_library "-lgcc") + set_linker_property(NO_CREATE PROPERTY c++_library "-lstdc++") + set_linker_property(NO_CREATE PROPERTY math_library "-lm") + # Keeping default include dir empty. The linker will then select libraries + # from its default search path. The toolchain may adjust the value to a + # specific location, for example gcc infrastructure will set the value based + # on output from --print-libgcc-file-name. + set_linker_property(NO_CREATE PROPERTY lib_include_dir "") +endif() + +if(CONFIG_CPP + AND NOT CONFIG_MINIMAL_LIBCPP + AND NOT CONFIG_NATIVE_LIBRARY + # When new link principle is fully introduced, then the below condition can + # be removed, and instead the external module c++ should use: + # set_property(TARGET linker PROPERTY c++_library "") + AND NOT CONFIG_EXTERNAL_MODULE_LIBCPP +) + set_property(TARGET linker PROPERTY link_order_library "c++") +endif() + + +if(CONFIG_NEWLIB_LIBC AND CMAKE_C_COMPILER_ID STREQUAL "GNU") + # We are using c;rt;c (expands to '-lc -lgcc -lc') in code below. + # This is needed because when linking with newlib on aarch64, then libgcc has a + # link dependency to libc (strchr), but libc also has dependencies to libgcc. + # Lib C depends on libgcc. e.g. libc.a(lib_a-fvwrite.o) references __aeabi_idiv + set_property(TARGET linker APPEND PROPERTY link_order_library "math;c;rt;c") +else() + set_property(TARGET linker APPEND PROPERTY link_order_library "c;rt") +endif() diff --git a/cmake/linker/ld/target.cmake b/cmake/linker/ld/target.cmake index ccf1493aa834f..5e0a117c01436 100644 --- a/cmake/linker/ld/target.cmake +++ b/cmake/linker/ld/target.cmake @@ -14,18 +14,6 @@ if((${CMAKE_LINKER} STREQUAL "${CROSS_COMPILE}ld.bfd") OR string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") endif() -if(NOT "${ZEPHYR_TOOLCHAIN_VARIANT}" STREQUAL "host") - if(CONFIG_CPP_EXCEPTIONS AND LIBGCC_DIR) - # When building with C++ Exceptions, it is important that crtbegin and crtend - # are linked at specific locations. - # The location is so important that we cannot let this be controlled by normal - # link libraries, instead we must control the link command specifically as - # part of toolchain. - set(CMAKE_CXX_LINK_EXECUTABLE - " ${LIBGCC_DIR}/crtbegin.o -o ${LIBGCC_DIR}/crtend.o") - endif() -endif() - # Run $LINKER_SCRIPT file through the C preprocessor, producing ${linker_script_gen} # NOTE: ${linker_script_gen} will be produced at build-time; not at configure-time macro(configure_linker_script linker_script_gen linker_pass_define) @@ -138,14 +126,44 @@ function(toolchain_ld_link_elf) ${LINKERFLAGPREFIX},--no-whole-archive ${NO_WHOLE_ARCHIVE_LIBS} $ - ${LIB_INCLUDE_DIR} -L${PROJECT_BINARY_DIR} - ${TOOLCHAIN_LIBS} ${TOOLCHAIN_LD_LINK_ELF_DEPENDENCIES} ) endfunction(toolchain_ld_link_elf) +# Function for finalizing link setup after Zephyr configuration has completed. +# +# This function will generate the correct CMAKE_C_LINK_EXECUTABLE / CMAKE_CXX_LINK_EXECUTABLE +# rule to ensure that standard c and runtime libraries are correctly placed +# and the end of link invocation and doesn't appear in the middle of the link +# command invocation. +macro(toolchain_linker_finalize) + get_property(zephyr_std_libs TARGET linker PROPERTY lib_include_dir) + get_property(link_order TARGET linker PROPERTY link_order_library) + foreach(lib ${link_order}) + get_property(link_flag TARGET linker PROPERTY ${lib}_library) + list(APPEND zephyr_std_libs "${link_flag}") + endforeach() + string(REPLACE ";" " " zephyr_std_libs "${zephyr_std_libs}") + + set(link_libraries " -o ${zephyr_std_libs}") + set(common_link " ${link_libraries}") + + set(CMAKE_ASM_LINK_EXECUTABLE " ${common_link}") + set(CMAKE_C_LINK_EXECUTABLE " ${common_link}") + + set(cpp_link "${common_link}") + if(NOT "${ZEPHYR_TOOLCHAIN_VARIANT}" STREQUAL "host") + if(CONFIG_CPP_EXCEPTIONS AND LIBGCC_DIR) + # When building with C++ Exceptions, it is important that crtbegin and crtend + # are linked at specific locations. + set(cpp_link " ${LIBGCC_DIR}/crtbegin.o ${link_libraries} ${LIBGCC_DIR}/crtend.o") + endif() + endif() + set(CMAKE_CXX_LINK_EXECUTABLE " ${cpp_link}") +endmacro() + # Load toolchain_ld-family macros include(${ZEPHYR_BASE}/cmake/linker/${LINKER}/target_relocation.cmake) include(${ZEPHYR_BASE}/cmake/linker/${LINKER}/target_configure.cmake) diff --git a/cmake/linker/linker_libraries_template.cmake b/cmake/linker/linker_libraries_template.cmake new file mode 100644 index 0000000000000..481ee5c473ed5 --- /dev/null +++ b/cmake/linker/linker_libraries_template.cmake @@ -0,0 +1,16 @@ +# Copyright (c) 2024 Nordic Semiconductor +# +# SPDX-License-Identifier: Apache-2.0 + +# Linker flags for fixed linking with standard libraries, such as the C and runtime libraries. +# It is the responsibility of the linker infrastructure to use those properties to specify the +# correct placement of those libraries for correct link order. +# For example, GCC usually has the order: -lc -lgcc +# It is also possible to define extra libraries of the form `_library`, and then include +# Fixed library search path can be defined in the `lib_include_dir` property if needed. +# in the link_order_property. +# Usage example: +# set_linker_property(PROPERTY lib_include_dir "-L/path/to/libs") +# set_linker_property(PROPERTY c_library "-lc") +# set_linker_property(PROPERTY rt_library "-lgcc") +# set_linker_property(PROPERTY link_order_library "c;rt") diff --git a/cmake/linker/lld/linker_flags.cmake b/cmake/linker/lld/linker_flags.cmake index f6e873ad63176..f11139aa1e234 100644 --- a/cmake/linker/lld/linker_flags.cmake +++ b/cmake/linker/lld/linker_flags.cmake @@ -1,4 +1,6 @@ # Copyright (c) 2022 Google LLC +# Copyright (c) 2024 Nordic Semiconductor +# # SPDX-License-Identifier: Apache-2.0 # Since lld is a drop in replacement for ld, we can just use ld's flags as a base @@ -6,7 +8,7 @@ include(${ZEPHYR_BASE}/cmake/linker/ld/linker_flags.cmake OPTIONAL) if(NOT CONFIG_MINIMAL_LIBCPP AND NOT CONFIG_NATIVE_LIBRARY AND NOT CONFIG_EXTERNAL_MODULE_LIBCPP) - set_property(TARGET linker PROPERTY cpp_base -lc++ ${LINKERFLAGPREFIX},-z,norelro) + set_property(TARGET linker PROPERTY cpp_base ${LINKERFLAGPREFIX},-z,norelro) endif() # Force LLVM to use built-in lld linker diff --git a/cmake/linker/lld/linker_libraries.cmake b/cmake/linker/lld/linker_libraries.cmake new file mode 100644 index 0000000000000..2347898ad6422 --- /dev/null +++ b/cmake/linker/lld/linker_libraries.cmake @@ -0,0 +1,21 @@ +# Copyright (c) 2024 Nordic Semiconductor +# +# SPDX-License-Identifier: Apache-2.0 + +set_linker_property(NO_CREATE TARGET linker PROPERTY c_library "-lc") +# Default per standard, will be populated by clang/target.cmake based on clang output. +set_linker_property(NO_CREATE TARGET linker PROPERTY rt_library "") +set_linker_property(TARGET linker PROPERTY c++_library "-lc++;-lc++abi") + +if(CONFIG_CPP + AND NOT CONFIG_MINIMAL_LIBCPP + AND NOT CONFIG_NATIVE_LIBRARY + # When new link principle is fully introduced, then the below condition can + # be removed, and instead the external module c++ should use: + # set_property(TARGET linker PROPERTY c++_library "") + AND NOT CONFIG_EXTERNAL_MODULE_LIBCPP +) + set_property(TARGET linker PROPERTY link_order_library "c++") +endif() + +set_property(TARGET linker APPEND PROPERTY link_order_library "c;rt") diff --git a/cmake/linker/lld/target.cmake b/cmake/linker/lld/target.cmake index 9ce3313334f3e..b6b96525e7062 100644 --- a/cmake/linker/lld/target.cmake +++ b/cmake/linker/lld/target.cmake @@ -101,14 +101,32 @@ function(toolchain_ld_link_elf) ${LINKERFLAGPREFIX},--no-whole-archive ${NO_WHOLE_ARCHIVE_LIBS} $ - ${LIB_INCLUDE_DIR} -L${PROJECT_BINARY_DIR} - ${TOOLCHAIN_LIBS} ${TOOLCHAIN_LD_LINK_ELF_DEPENDENCIES} ) endfunction(toolchain_ld_link_elf) +# Function for finalizing link setup after Zephyr configuration has completed. +# +# This function will generate the correct CMAKE_C_LINK_EXECUTABLE / CMAKE_CXX_LINK_EXECUTABLE +# signature to ensure that standard c and runtime libraries are correctly placed +# and the end of link invocation and doesn't appear in the middle of the link +# command invocation. +macro(toolchain_linker_finalize) + get_property(zephyr_std_libs TARGET linker PROPERTY lib_include_dir) + get_property(link_order TARGET linker PROPERTY link_order_library) + foreach(lib ${link_order}) + get_property(link_flag TARGET linker PROPERTY ${lib}_library) + list(APPEND zephyr_std_libs "${link_flag}") + endforeach() + string(REPLACE ";" " " zephyr_std_libs "${zephyr_std_libs}") + + set(common_link " -o ${zephyr_std_libs}") + set(CMAKE_ASM_LINK_EXECUTABLE " ${common_link}") + set(CMAKE_C_LINK_EXECUTABLE " ${common_link}") + set(CMAKE_CXX_LINK_EXECUTABLE " ${common_link}") +endmacro() # Load toolchain_ld-family macros include(${ZEPHYR_BASE}/cmake/linker/ld/target_relocation.cmake) diff --git a/cmake/linker/target_template.cmake b/cmake/linker/target_template.cmake new file mode 100644 index 0000000000000..efa27de6fb4fa --- /dev/null +++ b/cmake/linker/target_template.cmake @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2024, Nordic Semiconductor ASA + +# Template file for optional Zephyr linker macros. +# +# This file will define optional linker macros for toolchains that are not +# defining these macros themselves. + +if(NOT COMMAND toolchain_linker_finalize) + macro(toolchain_linker_finalize) + endmacro() +endif() diff --git a/cmake/linker/xt-ld/target.cmake b/cmake/linker/xt-ld/target.cmake index 4f8e4fcfbdb68..3546881cc718e 100644 --- a/cmake/linker/xt-ld/target.cmake +++ b/cmake/linker/xt-ld/target.cmake @@ -129,7 +129,6 @@ function(toolchain_ld_link_elf) ${LINKERFLAGPREFIX},--no-whole-archive ${NO_WHOLE_ARCHIVE_LIBS} $ - ${LIB_INCLUDE_DIR} -L${PROJECT_BINARY_DIR} ${TOOLCHAIN_LIBS} @@ -137,6 +136,27 @@ function(toolchain_ld_link_elf) ) endfunction(toolchain_ld_link_elf) +# Function for finalizing link setup after Zephyr configuration has completed. +# +# This function will generate the correct CMAKE_C_LINK_EXECUTABLE / CMAKE_CXX_LINK_EXECUTABLE +# rule to ensure that standard c and runtime libraries are correctly placed +# and the end of link invocation and doesn't appear in the middle of the link +# command invocation. +macro(toolchain_linker_finalize) + get_property(zephyr_std_libs TARGET linker PROPERTY lib_include_dir) + get_property(link_order TARGET linker PROPERTY link_order_library) + foreach(lib ${link_order}) + get_property(link_flag TARGET linker PROPERTY ${lib}_library) + list(APPEND zephyr_std_libs "${link_flag}") + endforeach() + string(REPLACE ";" " " zephyr_std_libs "${zephyr_std_libs}") + + set(common_link " -o ${zephyr_std_libs}") + set(CMAKE_ASM_LINK_EXECUTABLE " ${common_link}") + set(CMAKE_C_LINK_EXECUTABLE " ${common_link}") + set(CMAKE_CXX_LINK_EXECUTABLE " ${common_link}") +endmacro() + # xt-ld is Xtensa's own version of binutils' ld. # So we can reuse most of the ld configurations. include(${ZEPHYR_BASE}/cmake/linker/ld/target_relocation.cmake) diff --git a/cmake/modules/FindTargetTools.cmake b/cmake/modules/FindTargetTools.cmake index a1fa4bf5c67b7..e35f577d69793 100644 --- a/cmake/modules/FindTargetTools.cmake +++ b/cmake/modules/FindTargetTools.cmake @@ -105,5 +105,7 @@ include(${TOOLCHAIN_ROOT}/cmake/linker/${LINKER}/target.cmake OPTIONAL) include(${ZEPHYR_BASE}/cmake/bintools/bintools_template.cmake) include(${TOOLCHAIN_ROOT}/cmake/bintools/${BINTOOLS}/target.cmake OPTIONAL) +include(${TOOLCHAIN_ROOT}/cmake/linker/target_template.cmake) + set(TargetTools_FOUND TRUE) set(TARGETTOOLS_FOUND TRUE) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 4d8422a3ced52..8d38f1abf3ae4 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -2409,6 +2409,39 @@ function(toolchain_parse_make_rule input_file include_files) set(${include_files} ${result} PARENT_SCOPE) endfunction() +# 'set_linker_property' is a function that sets the property for the linker +# property target used for toolchain abstraction. +# +# This function is similar in nature to the CMake set_property function, but +# with some additional extension flags for improved behavioral control. +# +# NO_CREATE: Flag to indicate that the property should only be set if not already +# defined with a value. +# APPEND: Flag indicated that the property should be appended to the existing +# value list for the property. +# TARGET: Name of target on which to add the property (commonly: linker) +# PROPERTY: Name of property with the value(s) following immediately after +# property name +function(set_linker_property) + set(options APPEND NO_CREATE) + set(single_args TARGET) + set(multi_args PROPERTY) + cmake_parse_arguments(LINKER_PROPERTY "${options}" "${single_args}" "${multi_args}" ${ARGN}) + + if(LINKER_PROPERTY_APPEND) + set(APPEND "APPEND") + endif() + + if(LINKER_PROPERTY_NO_CREATE) + list(GET LINKER_PROPERTY_PROPERTY 0 property_name) + get_target_property(var ${LINKER_PROPERTY_TARGET} ${property_name}) + if(NOT "${var}" STREQUAL "var-NOTFOUND") + return() + endif() + endif() + set_property(TARGET ${LINKER_PROPERTY_TARGET} ${APPEND} PROPERTY ${LINKER_PROPERTY_PROPERTY}) +endfunction() + # 'check_set_linker_property' is a function that check the provided linker # flag and only set the linker property if the check succeeds # diff --git a/cmake/target_toolchain_flags.cmake b/cmake/target_toolchain_flags.cmake index 1df7e5eddc62f..716cc8f55e7e9 100644 --- a/cmake/target_toolchain_flags.cmake +++ b/cmake/target_toolchain_flags.cmake @@ -35,8 +35,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/compiler/compiler_features.cmake) # a new toolchain. include(${CMAKE_CURRENT_LIST_DIR}/compiler/compiler_flags_template.cmake) include(${CMAKE_CURRENT_LIST_DIR}/linker/linker_flags_template.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/linker/linker_libraries_template.cmake) # Configure the toolchain flags based on what toolchain technology is used # (gcc, host-gcc etc.) include(${TOOLCHAIN_ROOT}/cmake/compiler/${COMPILER}/compiler_flags.cmake OPTIONAL) include(${TOOLCHAIN_ROOT}/cmake/linker/${LINKER}/linker_flags.cmake OPTIONAL) +include(${TOOLCHAIN_ROOT}/cmake/linker/${LINKER}/linker_libraries.cmake OPTIONAL) diff --git a/cmake/toolchain/llvm/generic.cmake b/cmake/toolchain/llvm/generic.cmake index 0b138c2868c11..45474b7df3019 100644 --- a/cmake/toolchain/llvm/generic.cmake +++ b/cmake/toolchain/llvm/generic.cmake @@ -19,4 +19,4 @@ set(BINTOOLS llvm) set(TOOLCHAIN_HAS_NEWLIB OFF CACHE BOOL "True if toolchain supports newlib") -message(STATUS "Found toolchain: host (clang/ld)") +message(STATUS "Found toolchain: llvm (clang/ld)") diff --git a/lib/libc/newlib/CMakeLists.txt b/lib/libc/newlib/CMakeLists.txt index de39b8ce21394..d3dc448eccafc 100644 --- a/lib/libc/newlib/CMakeLists.txt +++ b/lib/libc/newlib/CMakeLists.txt @@ -34,40 +34,12 @@ zephyr_compile_definitions(_ANSI_SOURCE) zephyr_compile_definitions(__LINUX_ERRNO_EXTENSIONS__) if(CMAKE_C_COMPILER_ID STREQUAL "GNU") - # We are using - # - ${CMAKE_C_LINKER_WRAPPER_FLAG}${CMAKE_LINK_LIBRARY_FLAG}c - # - ${CMAKE_C_LINKER_WRAPPER_FLAG}${CMAKE_LINK_LIBRARY_FLAG}gcc - # - c - # in code below. - # This is needed because when linking with newlib on aarch64, then libgcc has a - # link dependency to libc (strchr), but libc also has dependencies to libgcc. - # - # CMake is capable of handling circular link dependencies for CMake defined - # static libraries, which can be further controlled using LINK_INTERFACE_MULTIPLICITY. - # However, libc and libgcc are not regular CMake libraries, and is seen as linker - # flags by CMake, and thus symbol de-duplications will be performed. - # CMake link options cannot be used, as that will place those libs first on the - # linker invocation. -Wl,--start-group is problematic as the placement of -lc - # and -lgcc is not guaranteed in case later libraries are also using - # -lc / -libbgcc as interface linker flags. - # - # Thus, we resort to use `${CMAKE_C_LINKER_WRAPPER_FLAG}${CMAKE_LINK_LIBRARY_FLAG}` - # as this ensures the uniqueness and thus avoids symbol de-duplication which means - # libc will be followed by libgcc, which is finally followed by libc again. - - list(JOIN CMAKE_C_LINKER_WRAPPER_FLAG "" linker_wrapper_string) - zephyr_link_libraries( - m - "${linker_wrapper_string}${CMAKE_LINK_LIBRARY_FLAG}c" ${LIBC_LIBRARY_DIR_FLAG} # NB: Optional $<$:-u_printf_float> $<$:-u_scanf_float> - # Lib C depends on libgcc. e.g. libc.a(lib_a-fvwrite.o) references __aeabi_idiv - "${linker_wrapper_string}${CMAKE_LINK_LIBRARY_FLAG}gcc" ) endif() -zephyr_link_libraries(c) if(CONFIG_NEWLIB_LIBC_NANO) zephyr_link_libraries( diff --git a/lib/libc/picolibc/CMakeLists.txt b/lib/libc/picolibc/CMakeLists.txt index 87fb0d9d8ecb9..fcb4f9f2b57bd 100644 --- a/lib/libc/picolibc/CMakeLists.txt +++ b/lib/libc/picolibc/CMakeLists.txt @@ -17,7 +17,7 @@ if(NOT CONFIG_PICOLIBC_USE_MODULE) # Zephyr build (via the __ZEPHYR__ macro) to expose the Zephyr C API zephyr_compile_options(--specs=picolibc.specs) - zephyr_libc_link_libraries(--specs=picolibc.specs c -lgcc) + zephyr_libc_link_libraries(--specs=picolibc.specs) if(CONFIG_PICOLIBC_IO_FLOAT) zephyr_compile_definitions(PICOLIBC_DOUBLE_PRINTF_SCANF) zephyr_link_libraries(-DPICOLIBC_DOUBLE_PRINTF_SCANF) From 718b726b3729d5a47ab79fda4d782b6f5ce197ad Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Wed, 11 Sep 2024 08:51:47 +0200 Subject: [PATCH 0263/4482] cmake: PROPERTY flag support on compile options and link libraries Extend zephyr_link_libraries to allow an optional value together with the `zephyr_link_libraries(PROPERTY [])`. This allow setting linker property combined with a value when linking Zephyr. The value will only be applied if the property is defined. Extend zephyr_compile_options to support the same PROPERTY flag that has been introduced for zephyr_link_libraries(). This remove the need for developers to write complex generator expressions for compiler flags and thus minimizes mistakes. The following syntax is now supported in addition to the existing syntax: `zephyr_compile_options(PROPERTY [])` Signed-off-by: Torsten Rasmussen --- cmake/modules/extensions.cmake | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 8d38f1abf3ae4..eb36220bd2082 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -108,16 +108,37 @@ endfunction() # https://cmake.org/cmake/help/latest/command/target_compile_options.html function(zephyr_compile_options) - target_compile_options(zephyr_interface INTERFACE ${ARGV}) + if(ARGV0 STREQUAL "PROPERTY") + set(property $) + set(property_defined $) + if(ARGC GREATER 3) + message(FATAL_ERROR "zephyr_compile_options(PROPERTY []) " + "called with too many arguments." + ) + elseif(ARGC EQUAL 3) + target_compile_options(zephyr_interface INTERFACE $<${property_defined}:${property}${ARGV2}>) + else() + target_compile_options(zephyr_interface INTERFACE ${property}) + endif() + else() + target_compile_options(zephyr_interface INTERFACE ${ARGV}) + endif() endfunction() # https://cmake.org/cmake/help/latest/command/target_link_libraries.html function(zephyr_link_libraries) if(ARGV0 STREQUAL "PROPERTY") - if(ARGC GREATER 2) - message(FATAL_ERROR "zephyr_link_libraries(PROPERTY ) only allows a single property.") + set(property $) + set(property_defined $) + if(ARGC GREATER 3) + message(FATAL_ERROR "zephyr_link_options(PROPERTY []) " + "called with too many arguments." + ) + elseif(ARGC EQUAL 3) + target_link_libraries(zephyr_interface INTERFACE $<${property_defined}:${property}${ARGV2}>) + else() + target_link_libraries(zephyr_interface INTERFACE ${property}) endif() - target_link_libraries(zephyr_interface INTERFACE $) else() target_link_libraries(zephyr_interface INTERFACE ${ARGV}) endif() From 102b3fc07836a137cf54bf39a626f3c332e72b71 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Wed, 11 Sep 2024 10:18:13 +0200 Subject: [PATCH 0264/4482] cmake: make TARGET optional in set_linker_property() The `check_set_linker_property()` and `set_linker_property()` takes a target argument. Make the target argument optional and use the target `linker` as default target. The function name `set_linker_property()` already implies that we are setting a property and the linker target. Remove the need to specify `TARGET linker` when using the default linker property target. Signed-off-by: Torsten Rasmussen --- cmake/modules/extensions.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index eb36220bd2082..2ac8c20058bf7 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -2440,7 +2440,7 @@ endfunction() # defined with a value. # APPEND: Flag indicated that the property should be appended to the existing # value list for the property. -# TARGET: Name of target on which to add the property (commonly: linker) +# TARGET: Name of target on which to add the property (default: linker) # PROPERTY: Name of property with the value(s) following immediately after # property name function(set_linker_property) @@ -2453,6 +2453,10 @@ function(set_linker_property) set(APPEND "APPEND") endif() + if(NOT DEFINED LINKER_PROPERTY_TARGET) + set(LINKER_PROPERTY_TARGET "linker") + endif() + if(LINKER_PROPERTY_NO_CREATE) list(GET LINKER_PROPERTY_PROPERTY 0 property_name) get_target_property(var ${LINKER_PROPERTY_TARGET} ${property_name}) @@ -2472,7 +2476,7 @@ endfunction() # # APPEND: Flag indicated that the property should be appended to the existing # value list for the property. -# TARGET: Name of target on which to add the property (commonly: linker) +# TARGET: Name of target on which to add the property (default: linker) # PROPERTY: Name of property with the value(s) following immediately after # property name function(check_set_linker_property) @@ -2485,6 +2489,10 @@ function(check_set_linker_property) set(APPEND "APPEND") endif() + if(NOT DEFINED LINKER_PROPERTY_TARGET) + set(LINKER_PROPERTY_TARGET "linker") + endif() + list(GET LINKER_PROPERTY_PROPERTY 0 property) list(REMOVE_AT LINKER_PROPERTY_PROPERTY 0) From 9d835fe464aff259cd1924e411a1be9c3f3e5787 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Mon, 26 Aug 2024 14:57:15 +0200 Subject: [PATCH 0265/4482] cmake: move specs compiler and linker flags to toolchain properties Moving specs argument to compiler and linker properties so that the compiler and linker in use can decide how the flags are mapped / handled for the compiler and linker in use. This avoids specifying `--specs=spec.picolibc` for clang which prints a warning about an unused argument. Signed-off-by: Torsten Rasmussen --- cmake/compiler/clang/compiler_flags.cmake | 2 ++ cmake/compiler/compiler_flags_template.cmake | 4 ++++ cmake/compiler/gcc/compiler_flags.cmake | 2 ++ cmake/linker/ld/gcc/linker_flags.cmake | 2 ++ cmake/linker/linker_flags_template.cmake | 4 ++++ lib/libc/picolibc/CMakeLists.txt | 5 ++--- 6 files changed, 16 insertions(+), 3 deletions(-) diff --git a/cmake/compiler/clang/compiler_flags.cmake b/cmake/compiler/clang/compiler_flags.cmake index acc9b629171bb..a64150eb58c61 100644 --- a/cmake/compiler/clang/compiler_flags.cmake +++ b/cmake/compiler/clang/compiler_flags.cmake @@ -125,3 +125,5 @@ set_compiler_property(PROPERTY warning_error_coding_guideline ) set_compiler_property(PROPERTY no_global_merge "-mno-global-merge") + +set_compiler_property(PROPERTY specs) diff --git a/cmake/compiler/compiler_flags_template.cmake b/cmake/compiler/compiler_flags_template.cmake index c72e9b70f5d6e..5a4386f49beb7 100644 --- a/cmake/compiler/compiler_flags_template.cmake +++ b/cmake/compiler/compiler_flags_template.cmake @@ -139,3 +139,7 @@ set_compiler_property(PROPERTY warning_shadow_variables) # Compiler flags to avoid recognizing built-in functions set_compiler_property(PROPERTY no_builtin) set_compiler_property(PROPERTY no_builtin_malloc) + +# Compiler flag for defining specs. Used only by gcc, other compilers may keep +# this undefined. +set_compiler_property(PROPERTY specs) diff --git a/cmake/compiler/gcc/compiler_flags.cmake b/cmake/compiler/gcc/compiler_flags.cmake index e982f75aa7843..c346a750af4cf 100644 --- a/cmake/compiler/gcc/compiler_flags.cmake +++ b/cmake/compiler/gcc/compiler_flags.cmake @@ -241,3 +241,5 @@ set_compiler_property(PROPERTY warning_shadow_variables -Wshadow) set_compiler_property(PROPERTY no_builtin -fno-builtin) set_compiler_property(PROPERTY no_builtin_malloc -fno-builtin-malloc) + +set_compiler_property(PROPERTY specs -specs=) diff --git a/cmake/linker/ld/gcc/linker_flags.cmake b/cmake/linker/ld/gcc/linker_flags.cmake index 4cde7d96ff321..c442c9c8921eb 100644 --- a/cmake/linker/ld/gcc/linker_flags.cmake +++ b/cmake/linker/ld/gcc/linker_flags.cmake @@ -15,3 +15,5 @@ add_link_options(-gdwarf-4) # Extra warnings options for twister run set_property(TARGET linker PROPERTY warnings_as_errors -Wl,--fatal-warnings) + +set_linker_property(PROPERTY specs -specs=) diff --git a/cmake/linker/linker_flags_template.cmake b/cmake/linker/linker_flags_template.cmake index 870c597be246f..8b0b948b028eb 100644 --- a/cmake/linker/linker_flags_template.cmake +++ b/cmake/linker/linker_flags_template.cmake @@ -49,3 +49,7 @@ set_property(TARGET linker PROPERTY no_relax) # Linker flag for enabling relaxation of address optimization for jump calls. set_property(TARGET linker PROPERTY relax) + +# Linker flag for defining specs. Defined only by gcc, when gcc is used as +# front-end for ld. +set_compiler_property(PROPERTY specs) diff --git a/lib/libc/picolibc/CMakeLists.txt b/lib/libc/picolibc/CMakeLists.txt index fcb4f9f2b57bd..14af66b7b7dc3 100644 --- a/lib/libc/picolibc/CMakeLists.txt +++ b/lib/libc/picolibc/CMakeLists.txt @@ -15,9 +15,8 @@ if(NOT CONFIG_PICOLIBC_USE_MODULE) # Use picolibc provided with the toolchain. This requires a new enough # toolchain so that the version of picolibc supports auto-detecting a # Zephyr build (via the __ZEPHYR__ macro) to expose the Zephyr C API - - zephyr_compile_options(--specs=picolibc.specs) - zephyr_libc_link_libraries(--specs=picolibc.specs) + zephyr_compile_options(PROPERTY specs picolibc.specs) + zephyr_link_libraries(PROPERTY specs picolibc.specs) if(CONFIG_PICOLIBC_IO_FLOAT) zephyr_compile_definitions(PICOLIBC_DOUBLE_PRINTF_SCANF) zephyr_link_libraries(-DPICOLIBC_DOUBLE_PRINTF_SCANF) From b2eeef4ac9505d8b1d4cfbc51374a96b74064778 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Thu, 12 Sep 2024 09:18:41 +0200 Subject: [PATCH 0266/4482] manifest: update picolibc to support the new c_library property This commit updates picolibc module to remove the need for hard-coding linking with `-lgcc`. Instead it sets the c_library linker property and thereby allows the Zephyr toolchain infrastructure to properly handle the linking of C and runtime libraries. Signed-off-by: Torsten Rasmussen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 23d11e10054ce..58ab293197f9b 100644 --- a/west.yml +++ b/west.yml @@ -315,7 +315,7 @@ manifest: - debug - name: picolibc path: modules/lib/picolibc - revision: e15656f7682500fc8953e1a2008f7b1ae4f65ce8 + revision: 27746bbc246841852912fc3bb5b45094cd8a505a - name: segger revision: b011c45b585e097d95d9cf93edf4f2e01588d3cd path: modules/debug/segger From 0274bcbee442441d3222747e536054cc911b6218 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Wed, 11 Sep 2024 23:39:50 +0200 Subject: [PATCH 0267/4482] cmake: detect LLVM picolibc and newlib support Newlib or Picolibc libraries for LLVM may be compiled or installed from pre-built sources independently of LLVM itself. This means that always indicating that TOOLCHAIN_HAS_NEWLIB=OFF and TOOLCHAIN_HAS_PICOLIBC=OFF are wrong. But it could be just as wrong to always indicate suport for newlib or picolibc. Some pre-built LLVM toolchains are provided with default picolibc support, such as LLVM for Arm embedded, but can also be used with newlib be installing newlib add-on package. Unfortunately it's not possible to query LLVM regarding newlib or picolibc support. Developers have the option of `-DTOOLCHAIN_HAS_=ON`, but this is not widely known and cumbersome to do for each build. An indication of newlib or picolibc support is the presence of library specific headers, so to improve current situation we check for library specific headers, and if those are present we assume support for the library. This commit improves the current support for LLVM in Zephyr when cross-compiling, especially for users of LLVM for Arm embedded. Signed-off-by: Torsten Rasmussen --- cmake/compiler/clang/target.cmake | 36 ++++++++++++++++++++++++++++++ cmake/toolchain/llvm/generic.cmake | 24 +++++++++++++++++++- 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/cmake/compiler/clang/target.cmake b/cmake/compiler/clang/target.cmake index d2d41e8b23c13..62c39b0ec6ff4 100644 --- a/cmake/compiler/clang/target.cmake +++ b/cmake/compiler/clang/target.cmake @@ -64,6 +64,42 @@ if(NOT "${ARCH}" STREQUAL "posix") endif() endif() + # LLVM will use a default sysroot for selection of the C library. The default + # C library sysroot was defined at built time of clang/LLVM. + # + # For example, LLVM for Arm comes pre-built with Picolibc, and thus no flags + # are required for selecting Picolibc. + # + # Other clang/LLVM distributions may come with other pre-built C libraries. + # clang/LLVM supports using an alternative C library, either by direct linking, + # or by specifying '--sysroot '. + # + # LLVM for Arm provides a 'newlib.cfg' file for newlib C selection. + # Let us support this principle by looking for a dedicated 'newlib.cfg' or + # 'picolibc.cfg' and specify '--config .cfg' if such a file is found. + # If no cfg-file matching the chosen C implementation, then we assume that the + # chosen C implementation is identical to the default C library used be the + # toolchain. + if(CONFIG_NEWLIB_LIBC) + file(GLOB_RECURSE newlib_cfg ${LLVM_TOOLCHAIN_PATH}/newlib.cfg) + if(newlib_cfg) + list(GET newlib_cfg 0 newlib_cfg) + set_linker_property(PROPERTY c_library "--config=${newlib_cfg};-lc") + list(APPEND CMAKE_REQUIRED_FLAGS --config=${newlib_cfg}) + list(APPEND TOOLCHAIN_C_FLAGS --config=${newlib_cfg}) + endif() + endif() + + if(CONFIG_PICOLIBC) + file(GLOB_RECURSE picolibc_cfg ${LLVM_TOOLCHAIN_PATH}/picolibc.cfg) + if(picolibc_cfg) + list(GET picolibc_cfg 0 picolibc_cfg) + set_linker_property(PROPERTY c_library "--config=${picolibc_cfg};-lc") + list(APPEND CMAKE_REQUIRED_FLAGS --config=${picolibc_cfg}) + list(APPEND TOOLCHAIN_C_FLAGS --config=${picolibc_cfg}) + endif() + endif() + # This libgcc code is partially duplicated in compiler/*/target.cmake execute_process( COMMAND ${CMAKE_C_COMPILER} ${clang_target_flag} ${TOOLCHAIN_C_FLAGS} diff --git a/cmake/toolchain/llvm/generic.cmake b/cmake/toolchain/llvm/generic.cmake index 45474b7df3019..f6d7878288db5 100644 --- a/cmake/toolchain/llvm/generic.cmake +++ b/cmake/toolchain/llvm/generic.cmake @@ -17,6 +17,28 @@ set(LLVM_TOOLCHAIN_PATH ${CLANG_ROOT_DIR} CACHE PATH "clang install directory") set(COMPILER clang) set(BINTOOLS llvm) -set(TOOLCHAIN_HAS_NEWLIB OFF CACHE BOOL "True if toolchain supports newlib") +# LLVM is flexible, meaning that it can in principle always support newlib or picolibc. +# This is not decided by LLVM itself, but depends on libraries distributed with the installation. +# Also newlib or picolibc may be created as add-ons. Thus always stating that LLVM does not have +# newlib or picolibc would be wrong. Same with stating that LLVM has newlib or Picolibc. +# The best assumption for TOOLCHAIN_HAS_ is to check for the presence of +# '_newlib_version.h' / 'picolibc' and have the default value set accordingly. +# This provides a best effort mechanism to allow developers to have the newlib C / Picolibc library +# selection available in Kconfig. +# Developers can manually indicate library support with '-DTOOLCHAIN_HAS_=' + +# Support for newlib is indicated by the presence of '_newlib_version.h' in the toolchain path. +if(NOT LLVM_TOOLCHAIN_PATH STREQUAL "") + file(GLOB_RECURSE newlib_header ${LLVM_TOOLCHAIN_PATH}/_newlib_version.h) + if(newlib_header) + set(TOOLCHAIN_HAS_NEWLIB ON CACHE BOOL "True if toolchain supports newlib") + endif() + + # Support for picolibc is indicated by the presence of 'picolibc.h' in the toolchain path. + file(GLOB_RECURSE picolibc_header ${LLVM_TOOLCHAIN_PATH}/picolibc.h) + if(picolibc_header) + set(TOOLCHAIN_HAS_PICOLIBC ON CACHE BOOL "True if toolchain supports picolibc") + endif() +endif() message(STATUS "Found toolchain: llvm (clang/ld)") From 6fc8563b16a6631a9591904747878fb8a9be398b Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Wed, 2 Oct 2024 21:43:07 +0200 Subject: [PATCH 0268/4482] manifest: update zephyr-lang-rust to always link runtime libs first Update zephyr-lang-rust module to include commit for linking the runtime library before the librustapp.a. Signed-off-by: Torsten Rasmussen --- submanifests/optional.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submanifests/optional.yaml b/submanifests/optional.yaml index 93807729bc44b..00ac3be58b687 100644 --- a/submanifests/optional.yaml +++ b/submanifests/optional.yaml @@ -34,7 +34,7 @@ manifest: groups: - optional - name: zephyr-lang-rust - revision: d2734f48d3ab1dbf584a936b2a05ece7bf0904f5 + revision: f20afb5bae9a4b64332a230a734c0244b39d4035 path: modules/lang/rust remote: upstream groups: From a12b869eac890e638cd2736e44bfaa15fc05e675 Mon Sep 17 00:00:00 2001 From: Olivier Lesage Date: Fri, 4 Oct 2024 11:38:28 +0200 Subject: [PATCH 0269/4482] bluetooth: host: Add support for processing CS subevent results Adds support for: - LE CS Subevent Result event - LE CS Test End Complete event For now, recombination of subevent results with more steps than could fit within a single HCI event is not supported, and such events are discarded. Signed-off-by: Olivier Lesage --- include/zephyr/bluetooth/conn.h | 117 +++++++++++++++++ include/zephyr/bluetooth/cs.h | 65 ++++++++++ include/zephyr/bluetooth/hci_types.h | 180 ++++++++++++++++++++++++++ subsys/bluetooth/host/conn.c | 17 +++ subsys/bluetooth/host/conn_internal.h | 2 + subsys/bluetooth/host/cs.c | 139 ++++++++++++++++++++ subsys/bluetooth/host/hci_core.c | 8 ++ subsys/bluetooth/host/hci_core.h | 2 + subsys/bluetooth/host/shell/cs.c | 81 +++++++++++- 9 files changed, 607 insertions(+), 4 deletions(-) diff --git a/include/zephyr/bluetooth/conn.h b/include/zephyr/bluetooth/conn.h index c0b91fd5db15b..8aed8d99f5639 100644 --- a/include/zephyr/bluetooth/conn.h +++ b/include/zephyr/bluetooth/conn.h @@ -538,6 +538,112 @@ struct bt_conn_le_cs_config { uint8_t channel_map[10]; }; +/** Procedure done status */ +enum bt_conn_le_cs_procedure_done_status { + BT_CONN_LE_CS_PROCEDURE_COMPLETE = BT_HCI_LE_CS_PROCEDURE_DONE_STATUS_COMPLETE, + BT_CONN_LE_CS_PROCEDURE_INCOMPLETE = BT_HCI_LE_CS_PROCEDURE_DONE_STATUS_PARTIAL, + BT_CONN_LE_CS_PROCEDURE_ABORTED = BT_HCI_LE_CS_PROCEDURE_DONE_STATUS_ABORTED, +}; + +/** Subevent done status */ +enum bt_conn_le_cs_subevent_done_status { + BT_CONN_LE_CS_SUBEVENT_COMPLETE = BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_COMPLETE, + BT_CONN_LE_CS_SUBEVENT_INCOMPLETE = BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_PARTIAL, + BT_CONN_LE_CS_SUBEVENT_ABORTED = BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_ABORTED, +}; + +/** Procedure abort reason */ +enum bt_conn_le_cs_procedure_abort_reason { + BT_CONN_LE_CS_PROCEDURE_NOT_ABORTED = BT_HCI_LE_CS_PROCEDURE_ABORT_REASON_NO_ABORT, + BT_CONN_LE_CS_PROCEDURE_ABORT_REQUESTED = + BT_HCI_LE_CS_PROCEDURE_ABORT_REASON_LOCAL_HOST_OR_REMOTE_REQUEST, + BT_CONN_LE_CS_PROCEDURE_ABORT_TOO_FEW_CHANNELS = + BT_HCI_LE_CS_PROCEDURE_ABORT_REASON_TOO_FEW_CHANNELS, + BT_CONN_LE_CS_PROCEDURE_ABORT_CHMAP_INSTANT_PASSED = + BT_HCI_LE_CS_PROCEDURE_ABORT_REASON_CHMAP_INSTANT_PASSED, + BT_CONN_LE_CS_PROCEDURE_ABORT_UNSPECIFIED = BT_HCI_LE_CS_PROCEDURE_ABORT_REASON_UNSPECIFIED, +}; + +/** Subevent abort reason */ +enum bt_conn_le_cs_subevent_abort_reason { + BT_CONN_LE_CS_SUBEVENT_NOT_ABORTED = BT_HCI_LE_CS_SUBEVENT_ABORT_REASON_NO_ABORT, + BT_CONN_LE_CS_SUBEVENT_ABORT_REQUESTED = + BT_HCI_LE_CS_SUBEVENT_ABORT_REASON_LOCAL_HOST_OR_REMOTE_REQUEST, + BT_CONN_LE_CS_SUBEVENT_ABORT_NO_CS_SYNC = + BT_HCI_LE_CS_SUBEVENT_ABORT_REASON_NO_CS_SYNC_RECEIVED, + BT_CONN_LE_CS_SUBEVENT_ABORT_SCHED_CONFLICT = + BT_HCI_LE_CS_SUBEVENT_ABORT_REASON_SCHED_CONFLICT, + BT_CONN_LE_CS_SUBEVENT_ABORT_UNSPECIFIED = BT_HCI_LE_CS_SUBEVENT_ABORT_REASON_UNSPECIFIED, +}; + +/** Subevent data for LE connections supporting CS */ +struct bt_conn_le_cs_subevent_result { + struct { + /** CS configuration identifier. + * + * Range: 0 to 3 + * + * If these results were generated by a CS Test, + * this value will be set to 0 and has no meaning. + */ + uint8_t config_id; + /** Starting ACL connection event counter. + * + * If these results were generated by a CS Test, + * this value will be set to 0 and has no meaning. + */ + uint16_t start_acl_conn_event; + /** CS procedure count associated with these results. + * + * This is the CS procedure count since the completion of + * the Channel Sounding Security Start procedure. + */ + uint16_t procedure_counter; + /** Frequency compensation value in units of 0.01 ppm. + * + * This is a 15-bit signed integer in the range [-100, 100] ppm. + * + * A value of @ref BT_HCI_LE_CS_SUBEVENT_RESULT_FREQ_COMPENSATION_NOT_AVAILABLE + * indicates that the role is not the initiator, or that the + * frequency compensation value is unavailable. + */ + uint16_t frequency_compensation; + /** Reference power level in dBm. + * + * Range: -127 to 20 + * + * A value of @ref BT_HCI_LE_CS_REF_POWER_LEVEL_UNAVAILABLE indicates + * that the reference power level was not available during a subevent. + */ + int8_t reference_power_level; + /** Procedure status. */ + enum bt_conn_le_cs_procedure_done_status procedure_done_status; + /** Subevent status. */ + enum bt_conn_le_cs_subevent_done_status subevent_done_status; + /** Abort reason. + * + * If the procedure status is + * @ref BT_CONN_LE_CS_PROCEDURE_ABORTED, this field will + * specify the reason for the abortion. + */ + enum bt_conn_le_cs_procedure_abort_reason procedure_abort_reason; + /** Abort reason. + * + * If the subevent status is + * @ref BT_CONN_LE_CS_SUBEVENT_ABORTED, this field will + * specify the reason for the abortion. + */ + enum bt_conn_le_cs_subevent_abort_reason subevent_abort_reason; + /** Number of antenna paths used during the phase measurement stage. + */ + uint8_t num_antenna_paths; + /** Number of CS steps in the subevent. + */ + uint8_t num_steps_reported; + } header; + struct net_buf_simple *step_data_buf; +}; + /** @brief Increment a connection's reference count. * * Increment the reference count of a connection object. @@ -1677,6 +1783,17 @@ struct bt_conn_cb { * @param config_id ID of the CS configuration that was removed. */ void (*le_cs_config_removed)(struct bt_conn *conn, uint8_t config_id); + + /** @brief Subevent Results from a CS procedure are available. + * + * This callback notifies the user that CS subevent results are + * available for the given connection object. + * + * @param conn Connection objects. + * @param result Subevent results + */ + void (*le_cs_subevent_data_available)(struct bt_conn *conn, + struct bt_conn_le_cs_subevent_result *result); #endif /** @internal Internally used field for list handling */ diff --git a/include/zephyr/bluetooth/cs.h b/include/zephyr/bluetooth/cs.h index c04fb3a92709d..ffb839a9d156a 100644 --- a/include/zephyr/bluetooth/cs.h +++ b/include/zephyr/bluetooth/cs.h @@ -517,6 +517,29 @@ struct bt_le_cs_create_config_params { uint8_t channel_map[10]; }; +/** Callbacks for CS Test */ +struct bt_le_cs_test_cb { + /**@brief CS Test Subevent data. + * + * @param[in] Subevent results. + */ + void (*le_cs_test_subevent_data_available)(struct bt_conn_le_cs_subevent_result *data); + /**@brief CS Test End Complete. */ + void (*le_cs_test_end_complete)(void); +}; + +/** Subevent result step */ +struct bt_le_cs_subevent_step { + /** CS step mode. */ + uint8_t mode; + /** CS step channel index. */ + uint8_t channel; + /** Length of role- and mode-specific information being reported. */ + uint8_t data_len; + /** Pointer to role- and mode-specific information. */ + const uint8_t *data; +}; + /** @brief Set all valid channel map bits * * This command is used to enable all valid channels in a @@ -567,6 +590,17 @@ int bt_le_cs_set_default_settings(struct bt_conn *conn, */ int bt_le_cs_read_remote_fae_table(struct bt_conn *conn); +/** @brief Register callbacks for the CS Test mode. + * + * Existing callbacks can be unregistered by providing NULL function + * pointers. + * + * @param cs_test_cb Set of callbacks to be used with CS Test + * + * @return Zero on success or (negative) error code on failure. + */ +int bt_le_cs_test_cb_register(struct bt_le_cs_test_cb cs_test_cb); + /** @brief Start a CS test * * This command is used to start a CS test where the IUT is placed in the role @@ -620,6 +654,37 @@ int bt_le_cs_create_config(struct bt_conn *conn, struct bt_le_cs_create_config_p */ int bt_le_cs_remove_config(struct bt_conn *conn, uint8_t config_id); +/** @brief Stop ongoing CS Test + * + * This command is used to stop any CS test that is in progress. + * + * The controller is expected to finish reporting any subevent results + * before completing this termination. + * + * @note To use this API @kconfig{CONFIG_BT_CHANNEL_SOUNDING} must be set. + * + * @return Zero on success or (negative) error code on failure. + */ +int bt_le_cs_stop_test(void); + +/** @brief Parse CS Test Subevent Results + * + * A helper for parsing HCI-formatted step data found in channel sounding subevent results. + * + * A typical use-case is filtering out data which does not meet certain packet quality or NADM + * requirements. + * + * @warning This function will consume the data when parsing. + * + * @param step_data_buf Pointer to a buffer containing the step data. + * @param func Callback function which will be called for each step data found. + * The callback should return true to continue parsing, or false to stop. + * @param user_data User data to be passed to the callback. + */ +void bt_le_cs_step_data_parse(struct net_buf_simple *step_data_buf, + bool (*func)(struct bt_le_cs_subevent_step *step, void *user_data), + void *user_data); + #ifdef __cplusplus } #endif diff --git a/include/zephyr/bluetooth/hci_types.h b/include/zephyr/bluetooth/hci_types.h index efc231efaef05..131b81134c1ce 100644 --- a/include/zephyr/bluetooth/hci_types.h +++ b/include/zephyr/bluetooth/hci_types.h @@ -2612,6 +2612,8 @@ struct bt_hci_cp_le_cs_remove_config { uint8_t config_id; } __packed; +#define BT_HCI_OP_LE_CS_TEST_END BT_OP(BT_OGF_LE, 0x0096) /* 0x2096 */ + /* Event definitions */ #define BT_HCI_EVT_UNKNOWN 0x00 @@ -3463,6 +3465,182 @@ struct bt_hci_evt_le_cs_config_complete { uint8_t t_pm_time; } __packed; +#define BT_HCI_LE_CS_TEST_CONN_HANDLE 0x0FFF + +#define BT_HCI_LE_CS_PROCEDURE_DONE_STATUS_COMPLETE 0x0 +#define BT_HCI_LE_CS_PROCEDURE_DONE_STATUS_PARTIAL 0x1 +#define BT_HCI_LE_CS_PROCEDURE_DONE_STATUS_ABORTED 0xF + +#define BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_COMPLETE 0x0 +#define BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_PARTIAL 0x1 +#define BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_ABORTED 0xF + +#define BT_HCI_LE_CS_PROCEDURE_ABORT_REASON_NO_ABORT 0x0 +#define BT_HCI_LE_CS_PROCEDURE_ABORT_REASON_LOCAL_HOST_OR_REMOTE_REQUEST 0x1 +#define BT_HCI_LE_CS_PROCEDURE_ABORT_REASON_TOO_FEW_CHANNELS 0x2 +#define BT_HCI_LE_CS_PROCEDURE_ABORT_REASON_CHMAP_INSTANT_PASSED 0x3 +#define BT_HCI_LE_CS_PROCEDURE_ABORT_REASON_UNSPECIFIED 0xF + +#define BT_HCI_LE_CS_SUBEVENT_ABORT_REASON_NO_ABORT 0x0 +#define BT_HCI_LE_CS_SUBEVENT_ABORT_REASON_LOCAL_HOST_OR_REMOTE_REQUEST 0x1 +#define BT_HCI_LE_CS_SUBEVENT_ABORT_REASON_NO_CS_SYNC_RECEIVED 0x2 +#define BT_HCI_LE_CS_SUBEVENT_ABORT_REASON_SCHED_CONFLICT 0x3 +#define BT_HCI_LE_CS_SUBEVENT_ABORT_REASON_UNSPECIFIED 0xF + +#define BT_HCI_LE_CS_SUBEVENT_RESULT_N_AP_IGNORED 0x00 +#define BT_HCI_LE_CS_SUBEVENT_RESULT_N_AP_1 0x01 +#define BT_HCI_LE_CS_SUBEVENT_RESULT_N_AP_2 0x02 +#define BT_HCI_LE_CS_SUBEVENT_RESULT_N_AP_3 0x03 +#define BT_HCI_LE_CS_SUBEVENT_RESULT_N_AP_4 0x04 + +#define BT_HCI_LE_CS_SUBEVENT_RESULT_FREQ_COMPENSATION_NOT_AVAILABLE 0xC000 + +#define BT_HCI_LE_CS_SUBEVENT_RESULT_PCT_NOT_AVAILABLE 0xFFFFFFFF + +#define BT_HCI_LE_CS_REF_POWER_LEVEL_UNAVAILABLE 0x7F + +#define BT_HCI_LE_CS_PCT_MASK 0xFFF + +#define BT_HCI_LE_CS_TONE_QUALITY_HIGH 0x0 +#define BT_HCI_LE_CS_TONE_QUALITY_MED 0x1 +#define BT_HCI_LE_CS_TONE_QUALITY_LOW 0x2 +#define BT_HCI_LE_CS_TONE_QUALITY_UNAVAILABLE 0x3 + +#define BT_HCI_LE_CS_NOT_TONE_EXT_SLOT 0x0 +#define BT_HCI_LE_CS_TONE_EXT_SLOT_EXT_NOT_EXPECTED 0x1 +#define BT_HCI_LE_CS_TONE_EXT_SLOT_EXT_EXPECTED 0x2 + +#define BT_HCI_LE_CS_TIME_DIFFERENCE_NOT_AVAILABLE 0x8000 + +#define BT_HCI_LE_CS_PACKET_NADM_ATTACK_EXT_UNLIKELY 0x00 +#define BT_HCI_LE_CS_PACKET_NADM_ATTACK_VERY_UNLIKELY 0x01 +#define BT_HCI_LE_CS_PACKET_NADM_ATTACK_UNLIKELY 0x02 +#define BT_HCI_LE_CS_PACKET_NADM_ATTACK_POSSIBLE 0x03 +#define BT_HCI_LE_CS_PACKET_NADM_ATTACK_LIKELY 0x04 +#define BT_HCI_LE_CS_PACKET_NADM_ATTACK_VERY_LIKELY 0x05 +#define BT_HCI_LE_CS_PACKET_NADM_ATTACK_EXT_LIKELY 0x06 +#define BT_HCI_LE_CS_PACKET_NADM_UNKNOWN 0xFF + +#define BT_HCI_EVT_LE_CS_SUBEVENT_RESULT 0x31 +/** Subevent result step data format: Mode 0 Initiator */ +struct bt_hci_le_cs_step_data_mode_0_initiator { + uint8_t packet_quality_aa_check: 4; + uint8_t packet_quality_bit_errors: 4; + uint8_t packet_rssi; + uint8_t packet_antenna; + uint16_t measured_freq_offset; +} __packed; + +/** Subevent result step data format: Mode 0 Reflector */ +struct bt_hci_le_cs_step_data_mode_0_reflector { + uint8_t packet_quality_aa_check: 4; + uint8_t packet_quality_bit_errors: 4; + uint8_t packet_rssi; + uint8_t packet_antenna; +} __packed; + +/** Subevent result step data format: Mode 1 */ +struct bt_hci_le_cs_step_data_mode_1 { + uint8_t packet_quality_aa_check: 4; + uint8_t packet_quality_bit_errors: 4; + uint8_t packet_nadm; + uint8_t packet_rssi; + union { + uint16_t toa_tod_initiator; + uint16_t tod_toa_reflector; + }; + uint8_t packet_antenna; +} __packed; + +/** Subevent result step data format: Mode 1 with sounding sequence RTT support */ +struct bt_hci_le_cs_step_data_mode_1_ss_rtt { + uint8_t packet_quality_aa_check: 4; + uint8_t packet_quality_bit_errors: 4; + uint8_t packet_nadm; + uint8_t packet_rssi; + union { + uint16_t toa_tod_initiator; + uint16_t tod_toa_reflector; + }; + uint8_t packet_antenna; + uint8_t packet_pct1[4]; + uint8_t packet_pct2[4]; +} __packed; + + +/** Format for per-antenna path step data in modes 2 and 3 */ +struct bt_hci_le_cs_step_data_tone_info { + uint8_t phase_correction_term[3]; + uint8_t quality_indicator: 4; + uint8_t extension_indicator: 4; +} __packed; + +/** Subevent result step data format: Mode 2 */ +struct bt_hci_le_cs_step_data_mode_2 { + uint8_t antenna_permutation_index; + struct bt_hci_le_cs_step_data_tone_info tone_info[]; +} __packed; + +/** Subevent result step data format: Mode 3 */ +struct bt_hci_le_cs_step_data_mode_3 { + uint8_t packet_quality_aa_check: 4; + uint8_t packet_quality_bit_errors: 4; + uint8_t packet_nadm; + uint8_t packet_rssi; + union { + uint16_t toa_tod_initiator; + uint16_t tod_toa_reflector; + }; + uint8_t packet_antenna; + uint8_t antenna_permutation_index; + struct bt_hci_le_cs_step_data_tone_info tone_info[]; +} __packed; + +/** Subevent result step data format: Mode 3 with sounding sequence RTT support */ +struct bt_hci_le_cs_step_data_mode_3_ss_rtt { + uint8_t packet_quality_aa_check: 4; + uint8_t packet_quality_bit_errors: 4; + uint8_t packet_nadm; + uint8_t packet_rssi; + union { + uint16_t toa_tod_initiator; + uint16_t tod_toa_reflector; + }; + uint8_t packet_antenna; + uint8_t packet_pct1[4]; + uint8_t packet_pct2[4]; + uint8_t antenna_permutation_index; + struct bt_hci_le_cs_step_data_tone_info tone_info[]; +} __packed; + +struct bt_hci_evt_le_cs_subevent_result_step { + uint8_t step_mode; + uint8_t step_channel; + uint8_t step_data_length; + uint8_t step_data[]; +} __packed; + +struct bt_hci_evt_le_cs_subevent_result { + uint16_t conn_handle; + uint8_t config_id; + uint16_t start_acl_conn_event_counter; + uint16_t procedure_counter; + uint16_t frequency_compensation; + uint8_t reference_power_level; + uint8_t procedure_done_status; + uint8_t subevent_done_status; + uint8_t procedure_abort_reason: 4; + uint8_t subevent_abort_reason: 4; + uint8_t num_antenna_paths; + uint8_t num_steps_reported; + uint8_t steps[]; +} __packed; + +#define BT_HCI_EVT_LE_CS_TEST_END_COMPLETE 0x33 +struct bt_hci_evt_le_cs_test_end_complete { + uint8_t status; +} __packed; + /* Event mask bits */ #define BT_EVT_BIT(n) (1ULL << (n)) @@ -3555,6 +3733,8 @@ struct bt_hci_evt_le_cs_config_complete { #define BT_EVT_MASK_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES_COMPLETE BT_EVT_BIT(43) #define BT_EVT_MASK_LE_CS_READ_REMOTE_FAE_TABLE_COMPLETE BT_EVT_BIT(44) #define BT_EVT_MASK_LE_CS_CONFIG_COMPLETE BT_EVT_BIT(46) +#define BT_EVT_MASK_LE_CS_SUBEVENT_RESULT BT_EVT_BIT(48) +#define BT_EVT_MASK_LE_CS_TEST_END_COMPLETE BT_EVT_BIT(50) /** HCI Error Codes, BT Core Spec v5.4 [Vol 1, Part F]. */ #define BT_HCI_ERR_SUCCESS 0x00 diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index bf420579445dc..229f7adf0a473 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -3390,6 +3390,23 @@ void notify_cs_config_removed(struct bt_conn *conn, uint8_t config_id) } } } + +void notify_cs_subevent_result(struct bt_conn *conn, struct bt_conn_le_cs_subevent_result *result) +{ + struct bt_conn_cb *callback; + + SYS_SLIST_FOR_EACH_CONTAINER(&conn_cbs, callback, _node) { + if (callback->le_cs_subevent_data_available) { + callback->le_cs_subevent_data_available(conn, result); + } + } + + STRUCT_SECTION_FOREACH(bt_conn_cb, cb) { + if (cb->le_cs_subevent_data_available) { + cb->le_cs_subevent_data_available(conn, result); + } + } +} #endif /* CONFIG_BT_CHANNEL_SOUNDING */ int bt_conn_le_param_update(struct bt_conn *conn, diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h index 19cd2f04319ba..a818a85fb7fe9 100644 --- a/subsys/bluetooth/host/conn_internal.h +++ b/subsys/bluetooth/host/conn_internal.h @@ -505,6 +505,8 @@ void notify_cs_config_created(struct bt_conn *conn, struct bt_conn_le_cs_config void notify_cs_config_removed(struct bt_conn *conn, uint8_t config_id); +void notify_cs_subevent_result(struct bt_conn *conn, struct bt_conn_le_cs_subevent_result *result); + #if defined(CONFIG_BT_SMP) /* If role specific LTK is present */ bool bt_conn_ltk_present(const struct bt_conn *conn); diff --git a/subsys/bluetooth/host/cs.c b/subsys/bluetooth/host/cs.c index 8341e9f93646a..05ab7a9050499 100644 --- a/subsys/bluetooth/host/cs.c +++ b/subsys/bluetooth/host/cs.c @@ -18,6 +18,7 @@ LOG_MODULE_REGISTER(bt_cs); #if defined(CONFIG_BT_CHANNEL_SOUNDING) +static struct bt_le_cs_test_cb cs_test_callbacks; void bt_le_cs_set_valid_chmap_bits(uint8_t channel_map[10]) { @@ -241,6 +242,12 @@ void bt_hci_le_cs_read_remote_fae_table_complete(struct net_buf *buf) bt_conn_unref(conn); } +int bt_le_cs_test_cb_register(struct bt_le_cs_test_cb cb) +{ + cs_test_callbacks = cb; + return 0; +} + int bt_le_cs_start_test(const struct bt_le_cs_test_param *params) { struct bt_hci_op_le_cs_test *cp; @@ -344,6 +351,74 @@ int bt_le_cs_start_test(const struct bt_le_cs_test_param *params) return bt_hci_cmd_send_sync(BT_HCI_OP_LE_CS_TEST, buf, NULL); } +void bt_hci_le_cs_subevent_result(struct net_buf *buf) +{ + struct bt_conn *conn = NULL; + struct bt_hci_evt_le_cs_subevent_result *evt; + struct bt_conn_le_cs_subevent_result result; + struct net_buf_simple step_data_buf; + + if (buf->len < sizeof(*evt)) { + LOG_ERR("Unexpected end of buffer"); + return; + } + + evt = net_buf_pull_mem(buf, sizeof(*evt)); + + if (evt->subevent_done_status == BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_PARTIAL) { + LOG_WRN("Discarded incomplete CS subevent results."); + return; + } + + if (sys_le16_to_cpu(evt->conn_handle) == BT_HCI_LE_CS_TEST_CONN_HANDLE) { + if (!cs_test_callbacks.le_cs_test_subevent_data_available) { + LOG_WRN("No callback registered. Discarded subevent results from CS Test."); + return; + } + } else { + conn = bt_conn_lookup_handle(sys_le16_to_cpu(evt->conn_handle), BT_CONN_TYPE_LE); + if (!conn) { + LOG_ERR("Unknown connection handle when processing subevent results"); + return; + } + } + + result.header.procedure_counter = sys_le16_to_cpu(evt->procedure_counter); + result.header.frequency_compensation = sys_le16_to_cpu(evt->frequency_compensation); + result.header.procedure_done_status = evt->procedure_done_status; + result.header.subevent_done_status = evt->subevent_done_status; + result.header.procedure_abort_reason = evt->procedure_abort_reason; + result.header.subevent_abort_reason = evt->subevent_abort_reason; + result.header.reference_power_level = evt->reference_power_level; + result.header.num_antenna_paths = evt->num_antenna_paths; + result.header.num_steps_reported = evt->num_steps_reported; + + if (evt->num_steps_reported) { + net_buf_simple_init_with_data(&step_data_buf, + evt->steps, + buf->len); + result.step_data_buf = &step_data_buf; + } else { + result.step_data_buf = NULL; + } + + if (sys_le16_to_cpu(evt->conn_handle) == BT_HCI_LE_CS_TEST_CONN_HANDLE) { + result.header.config_id = 0; + result.header.start_acl_conn_event = 0; + + cs_test_callbacks.le_cs_test_subevent_data_available(&result); + + } else { + result.header.config_id = evt->config_id; + result.header.start_acl_conn_event = + sys_le16_to_cpu(evt->start_acl_conn_event_counter); + + notify_cs_subevent_result(conn, &result); + + bt_conn_unref(conn); + } +} + void bt_hci_le_cs_config_complete_event(struct net_buf *buf) { struct bt_hci_evt_le_cs_config_complete *evt; @@ -447,4 +522,68 @@ int bt_le_cs_remove_config(struct bt_conn *conn, uint8_t config_id) return bt_hci_cmd_send_sync(BT_HCI_OP_LE_CS_REMOVE_CONFIG, buf, NULL); } + +int bt_le_cs_stop_test(void) +{ + struct net_buf *buf; + + buf = bt_hci_cmd_create(BT_HCI_OP_LE_CS_TEST_END, 0); + if (!buf) { + return -ENOBUFS; + } + + return bt_hci_cmd_send_sync(BT_HCI_OP_LE_CS_TEST_END, buf, NULL); +} + +void bt_hci_le_cs_test_end_complete(struct net_buf *buf) +{ + struct bt_hci_evt_le_cs_test_end_complete *evt; + + if (buf->len < sizeof(*evt)) { + LOG_ERR("Unexpected end of buffer"); + return; + } + + evt = net_buf_pull_mem(buf, sizeof(*evt)); + if (evt->status) { + LOG_INF("CS Test End failed with status 0x%02X", evt->status); + return; + } + + if (cs_test_callbacks.le_cs_test_end_complete) { + cs_test_callbacks.le_cs_test_end_complete(); + } +} + +void bt_le_cs_step_data_parse(struct net_buf_simple *step_data_buf, + bool (*func)(struct bt_le_cs_subevent_step *step, void *user_data), + void *user_data) +{ + if (!step_data_buf) { + LOG_INF("Tried to parse empty step data."); + return; + } + + while (step_data_buf->len > 1) { + struct bt_le_cs_subevent_step step; + + step.mode = net_buf_simple_pull_u8(step_data_buf); + step.channel = net_buf_simple_pull_u8(step_data_buf); + step.data_len = net_buf_simple_pull_u8(step_data_buf); + + if (step.data_len == 0) { + LOG_WRN("Encountered zero-length step data."); + return; + } + + step.data = step_data_buf->data; + + if (!func(&step, user_data)) { + return; + } + + net_buf_simple_pull(step_data_buf, step.data_len); + } +} + #endif /* CONFIG_BT_CHANNEL_SOUNDING */ diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 88ba83932f0cc..5f42eff202c88 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -2830,6 +2830,12 @@ static const struct event_handler meta_events[] = { sizeof(struct bt_hci_evt_le_cs_read_remote_fae_table_complete)), EVENT_HANDLER(BT_HCI_EVT_LE_CS_CONFIG_COMPLETE, bt_hci_le_cs_config_complete_event, sizeof(struct bt_hci_evt_le_cs_config_complete)), + EVENT_HANDLER(BT_HCI_EVT_LE_CS_SUBEVENT_RESULT, + bt_hci_le_cs_subevent_result, + sizeof(struct bt_hci_evt_le_cs_subevent_result)), + EVENT_HANDLER(BT_HCI_EVT_LE_CS_TEST_END_COMPLETE, + bt_hci_le_cs_test_end_complete, + sizeof(struct bt_hci_evt_le_cs_test_end_complete)), #endif /* CONFIG_BT_CHANNEL_SOUNDING */ }; @@ -3407,6 +3413,8 @@ static int le_set_event_mask(void) mask |= BT_EVT_MASK_LE_CS_READ_REMOTE_SUPPORTED_CAPABILITIES_COMPLETE; mask |= BT_EVT_MASK_LE_CS_READ_REMOTE_FAE_TABLE_COMPLETE; mask |= BT_EVT_MASK_LE_CS_CONFIG_COMPLETE; + mask |= BT_EVT_MASK_LE_CS_SUBEVENT_RESULT; + mask |= BT_EVT_MASK_LE_CS_TEST_END_COMPLETE; } sys_put_le64(mask, cp_mask->events); diff --git a/subsys/bluetooth/host/hci_core.h b/subsys/bluetooth/host/hci_core.h index a50b534f1b7bd..27387c9c53fd2 100644 --- a/subsys/bluetooth/host/hci_core.h +++ b/subsys/bluetooth/host/hci_core.h @@ -542,6 +542,8 @@ void bt_hci_le_past_received_v2(struct net_buf *buf); void bt_hci_le_cs_read_remote_supported_capabilities_complete(struct net_buf *buf); void bt_hci_le_cs_read_remote_fae_table_complete(struct net_buf *buf); void bt_hci_le_cs_config_complete_event(struct net_buf *buf); +void bt_hci_le_cs_subevent_result(struct net_buf *buf); +void bt_hci_le_cs_test_end_complete(struct net_buf *buf); /* Adv HCI event handlers */ void bt_hci_le_adv_set_terminated(struct net_buf *buf); diff --git a/subsys/bluetooth/host/shell/cs.c b/subsys/bluetooth/host/shell/cs.c index c5bc228f35c57..fbc55623b1474 100644 --- a/subsys/bluetooth/host/shell/cs.c +++ b/subsys/bluetooth/host/shell/cs.c @@ -136,6 +136,52 @@ static int cmd_read_remote_fae_table(const struct shell *sh, size_t argc, char * return 0; } +static bool process_step_data(struct bt_le_cs_subevent_step *step, void *user_data) +{ + shell_print(ctx_shell, "Subevent results contained step data: "); + shell_print(ctx_shell, "- Step mode %d\n" + "- Step channel %d\n" + "- Step data hexdump:", + step->mode, + step->channel); + shell_hexdump(ctx_shell, step->data, step->data_len); + + return true; +} + +static void cs_test_subevent_data_cb(struct bt_conn_le_cs_subevent_result *result) +{ + shell_print(ctx_shell, "Received subevent results."); + shell_print(ctx_shell, "Subevent Header:\n" + "- Procedure Counter: %d\n" + "- Frequency Compensation: 0x%04x\n" + "- Reference Power Level: %d\n" + "- Procedure Done Status: 0x%02x\n" + "- Subevent Done Status: 0x%02x\n" + "- Procedure Abort Reason: 0x%02x\n" + "- Subevent Abort Reason: 0x%02x\n" + "- Number of Antenna Paths: %d\n" + "- Number of Steps Reported: %d", + result->header.procedure_counter, + result->header.frequency_compensation, + result->header.reference_power_level, + result->header.procedure_done_status, + result->header.subevent_done_status, + result->header.procedure_abort_reason, + result->header.subevent_abort_reason, + result->header.num_antenna_paths, + result->header.num_steps_reported); + + if (result->step_data_buf) { + bt_le_cs_step_data_parse(result->step_data_buf, process_step_data, NULL); + } +} + +static void cs_test_end_complete_cb(void) +{ + shell_print(ctx_shell, "CS Test End Complete."); +} + static int cmd_cs_test_simple(const struct shell *sh, size_t argc, char *argv[]) { int err = 0; @@ -144,7 +190,7 @@ static int cmd_cs_test_simple(const struct shell *sh, size_t argc, char *argv[]) params.main_mode = BT_CONN_LE_CS_MAIN_MODE_1; params.sub_mode = BT_CONN_LE_CS_SUB_MODE_UNUSED; params.main_mode_repetition = 0; - params.mode_0_steps = 0x1; + params.mode_0_steps = 2; params.role = shell_strtoul(argv[1], 16, &err); @@ -164,9 +210,9 @@ static int cmd_cs_test_simple(const struct shell *sh, size_t argc, char *argv[]) params.rtt_type = BT_CONN_LE_CS_RTT_TYPE_AA_ONLY; params.cs_sync_phy = BT_CONN_LE_CS_SYNC_1M_PHY; params.cs_sync_antenna_selection = BT_LE_CS_TEST_CS_SYNC_ANTENNA_SELECTION_ONE; - params.subevent_len = 10000; - params.subevent_interval = 0; - params.max_num_subevents = 0; + params.subevent_len = 3000; + params.subevent_interval = 1; + params.max_num_subevents = 1; params.transmit_power_level = BT_HCI_OP_LE_CS_TEST_MAXIMIZE_TX_POWER; params.t_ip1_time = 80; params.t_ip2_time = 80; @@ -182,10 +228,23 @@ static int cmd_cs_test_simple(const struct shell *sh, size_t argc, char *argv[]) memset(params.override_config_0.not_set.channel_map, 0, sizeof(params.override_config_0.not_set.channel_map)); params.override_config_0.not_set.channel_map[1] = 0xFF; + params.override_config_0.not_set.channel_map[7] = 0xFF; + params.override_config_0.not_set.channel_map[8] = 0xFF; params.override_config_0.not_set.channel_selection_type = BT_CONN_LE_CS_CHSEL_TYPE_3B; params.override_config_0.not_set.ch3c_shape = BT_CONN_LE_CS_CH3C_SHAPE_HAT; params.override_config_0.not_set.ch3c_jump = 0x2; + struct bt_le_cs_test_cb cs_test_cb = { + .le_cs_test_subevent_data_available = cs_test_subevent_data_cb, + .le_cs_test_end_complete = cs_test_end_complete_cb, + }; + + err = bt_le_cs_test_cb_register(cs_test_cb); + if (err) { + shell_error(sh, "bt_le_cs_test_cb_register returned error %d", err); + return -ENOEXEC; + } + err = bt_le_cs_start_test(¶ms); if (err) { shell_error(sh, "bt_le_cs_start_test returned error %d", err); @@ -370,6 +429,19 @@ static int cmd_create_config(const struct shell *sh, size_t argc, char *argv[]) return 0; } +static int cmd_cs_stop_test(const struct shell *sh, size_t argc, char *argv[]) +{ + int err = 0; + + err = bt_le_cs_stop_test(); + if (err) { + shell_error(sh, "bt_cs_stop_test returned error %d", err); + return -ENOEXEC; + } + + return 0; +} + SHELL_STATIC_SUBCMD_SET_CREATE( cs_cmds, SHELL_CMD_ARG(read_remote_supported_capabilities, NULL, "", @@ -382,6 +454,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE( SHELL_CMD_ARG(read_remote_fae_table, NULL, "", cmd_read_remote_fae_table, 1, 0), SHELL_CMD_ARG(start_simple_cs_test, NULL, "", cmd_cs_test_simple, 2, 0), + SHELL_CMD_ARG(stop_cs_test, NULL, "", cmd_cs_stop_test, 1, 0), SHELL_CMD_ARG( create_config, NULL, " " From 9e3943d13ed866f3fd0899a5ff0666585c329631 Mon Sep 17 00:00:00 2001 From: Olivier Lesage Date: Fri, 4 Oct 2024 11:34:37 +0200 Subject: [PATCH 0270/4482] bluetooth: host: Add CONFIG_BT_CHANNEL_SOUNDING_TEST Makes it easier to make sure the CS test code is removed if desired. It should hopefully allow for a clean split in general. Signed-off-by: Olivier Lesage --- include/zephyr/bluetooth/cs.h | 6 ++++-- subsys/bluetooth/Kconfig | 7 +++++++ subsys/bluetooth/host/cs.c | 16 ++++++++++++++-- subsys/bluetooth/host/hci_core.c | 2 ++ tests/bluetooth/shell/testcase.yaml | 1 + 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/include/zephyr/bluetooth/cs.h b/include/zephyr/bluetooth/cs.h index ffb839a9d156a..fa36208318000 100644 --- a/include/zephyr/bluetooth/cs.h +++ b/include/zephyr/bluetooth/cs.h @@ -595,6 +595,8 @@ int bt_le_cs_read_remote_fae_table(struct bt_conn *conn); * Existing callbacks can be unregistered by providing NULL function * pointers. * + * @note To use this API @kconfig{CONFIG_BT_CHANNEL_SOUNDING_TEST} must be set. + * * @param cs_test_cb Set of callbacks to be used with CS Test * * @return Zero on success or (negative) error code on failure. @@ -615,7 +617,7 @@ int bt_le_cs_test_cb_register(struct bt_le_cs_test_cb cs_test_cb); * parameters of this command describe the required transmit and receive behavior * for the CS test. * - * @note To use this API @kconfig{CONFIG_BT_CHANNEL_SOUNDING} must be set. + * @note To use this API @kconfig{CONFIG_BT_CHANNEL_SOUNDING_TEST} must be set. * * @param params CS Test parameters * @@ -661,7 +663,7 @@ int bt_le_cs_remove_config(struct bt_conn *conn, uint8_t config_id); * The controller is expected to finish reporting any subevent results * before completing this termination. * - * @note To use this API @kconfig{CONFIG_BT_CHANNEL_SOUNDING} must be set. + * @note To use this API @kconfig{CONFIG_BT_CHANNEL_SOUNDING_TEST} must be set. * * @return Zero on success or (negative) error code on failure. */ diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index 7b5674f7a6ce0..976ecdec734b9 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -196,6 +196,13 @@ config BT_CHANNEL_SOUNDING help Enable support for Bluetooth 6.0 Channel Sounding feature. +config BT_CHANNEL_SOUNDING_TEST + bool "Channel Sounding Test [EXPERIMENTAL]" + select EXPERIMENTAL + depends on BT_CHANNEL_SOUNDING + help + Enable support for Channel Sounding test mode. + endif # BT_CONN rsource "Kconfig.iso" diff --git a/subsys/bluetooth/host/cs.c b/subsys/bluetooth/host/cs.c index 05ab7a9050499..75d5f21cf2c61 100644 --- a/subsys/bluetooth/host/cs.c +++ b/subsys/bluetooth/host/cs.c @@ -18,7 +18,9 @@ LOG_MODULE_REGISTER(bt_cs); #if defined(CONFIG_BT_CHANNEL_SOUNDING) +#if defined(CONFIG_BT_CHANNEL_SOUNDING_TEST) static struct bt_le_cs_test_cb cs_test_callbacks; +#endif void bt_le_cs_set_valid_chmap_bits(uint8_t channel_map[10]) { @@ -242,6 +244,7 @@ void bt_hci_le_cs_read_remote_fae_table_complete(struct net_buf *buf) bt_conn_unref(conn); } +#if defined(CONFIG_BT_CHANNEL_SOUNDING_TEST) int bt_le_cs_test_cb_register(struct bt_le_cs_test_cb cb) { cs_test_callbacks = cb; @@ -350,6 +353,7 @@ int bt_le_cs_start_test(const struct bt_le_cs_test_param *params) return bt_hci_cmd_send_sync(BT_HCI_OP_LE_CS_TEST, buf, NULL); } +#endif /* CONFIG_BT_CHANNEL_SOUNDING_TEST */ void bt_hci_le_cs_subevent_result(struct net_buf *buf) { @@ -370,12 +374,15 @@ void bt_hci_le_cs_subevent_result(struct net_buf *buf) return; } +#if defined(CONFIG_BT_CHANNEL_SOUNDING_TEST) if (sys_le16_to_cpu(evt->conn_handle) == BT_HCI_LE_CS_TEST_CONN_HANDLE) { if (!cs_test_callbacks.le_cs_test_subevent_data_available) { LOG_WRN("No callback registered. Discarded subevent results from CS Test."); return; } - } else { + } else +#endif /* CONFIG_BT_CHANNEL_SOUNDING_TEST */ + { conn = bt_conn_lookup_handle(sys_le16_to_cpu(evt->conn_handle), BT_CONN_TYPE_LE); if (!conn) { LOG_ERR("Unknown connection handle when processing subevent results"); @@ -402,13 +409,16 @@ void bt_hci_le_cs_subevent_result(struct net_buf *buf) result.step_data_buf = NULL; } +#if defined(CONFIG_BT_CHANNEL_SOUNDING_TEST) if (sys_le16_to_cpu(evt->conn_handle) == BT_HCI_LE_CS_TEST_CONN_HANDLE) { result.header.config_id = 0; result.header.start_acl_conn_event = 0; cs_test_callbacks.le_cs_test_subevent_data_available(&result); - } else { + } else +#endif /* CONFIG_BT_CHANNEL_SOUNDING_TEST */ + { result.header.config_id = evt->config_id; result.header.start_acl_conn_event = sys_le16_to_cpu(evt->start_acl_conn_event_counter); @@ -523,6 +533,7 @@ int bt_le_cs_remove_config(struct bt_conn *conn, uint8_t config_id) return bt_hci_cmd_send_sync(BT_HCI_OP_LE_CS_REMOVE_CONFIG, buf, NULL); } +#if defined(CONFIG_BT_CHANNEL_SOUNDING_TEST) int bt_le_cs_stop_test(void) { struct net_buf *buf; @@ -554,6 +565,7 @@ void bt_hci_le_cs_test_end_complete(struct net_buf *buf) cs_test_callbacks.le_cs_test_end_complete(); } } +#endif /* CONFIG_BT_CHANNEL_SOUNDING_TEST */ void bt_le_cs_step_data_parse(struct net_buf_simple *step_data_buf, bool (*func)(struct bt_le_cs_subevent_step *step, void *user_data), diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 5f42eff202c88..0f203831bf543 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -2833,9 +2833,11 @@ static const struct event_handler meta_events[] = { EVENT_HANDLER(BT_HCI_EVT_LE_CS_SUBEVENT_RESULT, bt_hci_le_cs_subevent_result, sizeof(struct bt_hci_evt_le_cs_subevent_result)), +#if defined(CONFIG_BT_CHANNEL_SOUNDING_TEST) EVENT_HANDLER(BT_HCI_EVT_LE_CS_TEST_END_COMPLETE, bt_hci_le_cs_test_end_complete, sizeof(struct bt_hci_evt_le_cs_test_end_complete)), +#endif /* CONFIG_BT_CHANNEL_SOUNDING_TEST */ #endif /* CONFIG_BT_CHANNEL_SOUNDING */ }; diff --git a/tests/bluetooth/shell/testcase.yaml b/tests/bluetooth/shell/testcase.yaml index 1d1e4c9d23485..80c2b054adf15 100644 --- a/tests/bluetooth/shell/testcase.yaml +++ b/tests/bluetooth/shell/testcase.yaml @@ -37,6 +37,7 @@ tests: bluetooth.shell.channel_sounding: extra_configs: - CONFIG_BT_CHANNEL_SOUNDING=y + - CONFIG_BT_CHANNEL_SOUNDING_TEST=y - CONFIG_BT_CTLR=n build_only: true bluetooth.shell.cdc_acm: From 9ae2e23d347c10e2250e587c07a7fd8835c28bcf Mon Sep 17 00:00:00 2001 From: Olivier Lesage Date: Tue, 1 Oct 2024 08:40:25 +0200 Subject: [PATCH 0271/4482] bluetooth: host: Update text for BT_CHANNEL_SOUNDING kconfig Include EXPERIMENTAL tag in the kconfig text and remove the word "support" to align with other options Signed-off-by: Olivier Lesage --- subsys/bluetooth/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index 976ecdec734b9..b86de460e384b 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -190,7 +190,7 @@ config BT_SUBRATING Bluetooth Core specification, Version 5.4 | Vol 6, Part B, Section 4.6.35. config BT_CHANNEL_SOUNDING - bool "Channel Sounding support" + bool "Channel Sounding [EXPERIMENTAL]" select EXPERIMENTAL depends on !BT_CTLR || BT_CTLR_CHANNEL_SOUNDING_SUPPORT help From 17be7ffca5221f41d4daa2b0db1269632f183ee0 Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Tue, 1 Oct 2024 17:01:55 +0200 Subject: [PATCH 0272/4482] device.h: fix inconsistent semicolon logic for DEVICE_DT_DEFINE When CONFIG_LLEXT_EXPORT_DEVICES is not enabled, the DEVICE_DT_DEFINE macro ends with the contents of the Z_DEVICE_DEFINE macro, which always includes a terminating semicolon. When CONFIG_LLEXT_EXPORT_DEVICES is enabled, the macro ends with Z_DEVICE_EXPORT, which does _not_ include a terminating semicolon. This leads to a syntax error in places where the DEVICE_DT_DEFINE macro is used without it. Fix this by adjusting the added code when CONFIG_LLEXT_EXPORT_DEVICES is enabled to include a semicolon after the Z_DEVICE_EXPORT macro; also use the opportunity to remove a stray backslash. Signed-off-by: Luca Burelli --- include/zephyr/device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/device.h b/include/zephyr/device.h index fccfa6e6d0922..f9e134111ebae 100644 --- a/include/zephyr/device.h +++ b/include/zephyr/device.h @@ -208,7 +208,7 @@ typedef int16_t device_handle_t; level, prio, api, \ &Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)), \ __VA_ARGS__) \ - IF_ENABLED(CONFIG_LLEXT_EXPORT_DEVICES, (; Z_DEVICE_EXPORT(node_id))) \ + IF_ENABLED(CONFIG_LLEXT_EXPORT_DEVICES, (Z_DEVICE_EXPORT(node_id);)) /** * @brief Like DEVICE_DT_DEFINE(), but uses an instance of a `DT_DRV_COMPAT` From 8848fd4613c3a52f4873b986d8137c21e89425d4 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Wed, 2 Oct 2024 19:04:18 +0800 Subject: [PATCH 0273/4482] toolchain: match gcc 'missing-field-initializers' with others `arcmwdt`` and `clang` both have `-Wno-missing-field-initializers` in `warning_dw_1` and `-Wmissing-field-initializers` in `warning_dw_2` while `gcc` has `-Wmissing-field-initializers` in `warning_dw_1`, so update it to match. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- cmake/compiler/gcc/compiler_flags.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/compiler/gcc/compiler_flags.cmake b/cmake/compiler/gcc/compiler_flags.cmake index c346a750af4cf..f92fcd9f0cc63 100644 --- a/cmake/compiler/gcc/compiler_flags.cmake +++ b/cmake/compiler/gcc/compiler_flags.cmake @@ -59,7 +59,7 @@ set_compiler_property(PROPERTY warning_dw_1 ) check_set_compiler_property(APPEND PROPERTY warning_dw_1 -Wlogical-op - -Wmissing-field-initializers + -Wno-missing-field-initializers ) set_compiler_property(PROPERTY warning_dw_2 @@ -71,6 +71,7 @@ set_compiler_property(PROPERTY warning_dw_2 -Wpointer-arith -Wredundant-decls -Wswitch-default + -Wmissing-field-initializers ) check_set_compiler_property(APPEND PROPERTY warning_dw_2 -Wpacked-bitfield-compat From 335d7137925594602cf50baa8c57afd0bde4dfde Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 1 Oct 2024 09:33:09 +0300 Subject: [PATCH 0274/4482] maintainers: Add wifi identifier for hostap files Add wifi identifier for hostap related files. Signed-off-by: Jukka Rissanen --- MAINTAINERS.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 2434fb5c2f21d..b1ee4baa3f211 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -5160,6 +5160,8 @@ West: - modules/hostap/ labels: - "area: Wi-Fi" + tests: + - net.wifi Xtensa arch: status: maintained From eb7b3f67d47dc81d038b21490f52b362aee051ac Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 4 Oct 2024 15:29:45 +0300 Subject: [PATCH 0275/4482] ci: tags: Add wifi tag to hostap and other wifi related files Make sure we run wifi tests for all hostap related files that are changed. Signed-off-by: Jukka Rissanen --- scripts/ci/tags.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/ci/tags.yaml b/scripts/ci/tags.yaml index f66745fb208fd..8f9980eb6e5da 100644 --- a/scripts/ci/tags.yaml +++ b/scripts/ci/tags.yaml @@ -56,6 +56,16 @@ net: - drivers/ieee802154/ - drivers/ptp_clock/ +wifi: + files: + - modules/hostap/ + - subsys/net/l2/wifi/ + - drivers/wifi/ + - include/zephyr/net/wifi.h + - include/zephyr/net/wifi_mgmt.h + - include/zephyr/net/wifi_nm.h + - include/zephyr/net/wifi_utils.h + test_framework: files: - subsys/testsuite/ From 357427aee579aec52e0240e5e0544d680855c75c Mon Sep 17 00:00:00 2001 From: Aleksander Wasaznik Date: Wed, 2 Oct 2024 14:42:28 +0200 Subject: [PATCH 0276/4482] Bluetooth: GATT: Remove note on flow-control from `bt_gatt_write_without It's not clear what this note is trying to convey. I assume it's outdated. Signed-off-by: Aleksander Wasaznik --- include/zephyr/bluetooth/gatt.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/include/zephyr/bluetooth/gatt.h b/include/zephyr/bluetooth/gatt.h index ab14af94ac1c8..c72cb821a726a 100644 --- a/include/zephyr/bluetooth/gatt.h +++ b/include/zephyr/bluetooth/gatt.h @@ -1896,11 +1896,6 @@ int bt_gatt_write(struct bt_conn *conn, struct bt_gatt_write_params *params); * The number of pending callbacks can be increased with the * @kconfig{CONFIG_BT_CONN_TX_MAX} option. * - * @note By using a callback it also disable the internal flow control - * which would prevent sending multiple commands without waiting for - * their transmissions to complete, so if that is required the caller - * shall not submit more data until the callback is called. - * * This function will block while the ATT request queue is full, except when * called from the BT RX thread, as this would cause a deadlock. * From 8068cb2567508d760e71f04042f0301fdd081403 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Wed, 2 Oct 2024 17:22:57 +0300 Subject: [PATCH 0277/4482] net: lwm2m: Add shell command for listing resources Add shell command for listing multiple objects, resources or resource instances. Signed-off-by: Seppo Takalo --- doc/connectivity/networking/api/lwm2m.rst | 3 + subsys/net/lib/lwm2m/lwm2m_shell.c | 123 +++++++++++++++++++++- 2 files changed, 125 insertions(+), 1 deletion(-) diff --git a/doc/connectivity/networking/api/lwm2m.rst b/doc/connectivity/networking/api/lwm2m.rst index b0d1a04f0de77..cc48086613f63 100644 --- a/doc/connectivity/networking/api/lwm2m.rst +++ b/doc/connectivity/networking/api/lwm2m.rst @@ -789,6 +789,9 @@ required actions from the server side. resume :LwM2M engine thread resume lock :Lock the LwM2M registry unlock :Unlock the LwM2M registry + obs : List observations + ls : ls [PATH] + List objects, instances, resources diff --git a/subsys/net/lib/lwm2m/lwm2m_shell.c b/subsys/net/lib/lwm2m/lwm2m_shell.c index 03e8cff747101..5974976326324 100644 --- a/subsys/net/lib/lwm2m/lwm2m_shell.c +++ b/subsys/net/lib/lwm2m/lwm2m_shell.c @@ -56,7 +56,8 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #define LWM2M_HELP_OBSERV "List observations" #define LWM2M_HELP_CACHE "cache PATH NUM\nEnable data cache for resource\n" \ "PATH is LwM2M path\n" \ - "NUM how many elements to cache\n" \ + "NUM how many elements to cache\n" +#define LWM2M_HELP_LS "ls [PATH]\nList objects, instances, resources\n" static void send_cb(enum lwm2m_send_status status) { @@ -712,6 +713,125 @@ static int cmd_observations(const struct shell *sh, size_t argc, char **argv) return 0; } +static int print_object_instance(const struct shell *sh, struct lwm2m_engine_obj_inst *oi) +{ + struct lwm2m_engine_obj *obj; + + if (!oi) { + return -ENOEXEC; + } + + obj = oi->obj; + + for (int i = 0; i < oi->resource_count; i++) { + struct lwm2m_engine_res *re = &oi->resources[i]; + + for (int j = 0; j < re->res_inst_count; j++) { + struct lwm2m_engine_res_inst *ri = &re->res_instances[j]; + + if (ri->data_ptr && ri->data_len > 0 && + ri->res_inst_id != RES_INSTANCE_NOT_CREATED) { + struct lwm2m_engine_obj_field *field = + lwm2m_get_engine_obj_field(obj, re->res_id); + char path[LWM2M_MAX_PATH_STR_SIZE]; + + if (re->multi_res_inst) { + snprintf(path, sizeof(path), "%hu/%hu/%hu/%hu", obj->obj_id, + oi->obj_inst_id, re->res_id, ri->res_inst_id); + } else { + snprintf(path, sizeof(path), "%hu/%hu/%hu", obj->obj_id, + oi->obj_inst_id, re->res_id); + } + switch (field->data_type) { + case LWM2M_RES_TYPE_STRING: + shell_print(sh, "%s : %s", path, (char *)ri->data_ptr); + break; + case LWM2M_RES_TYPE_U8: + case LWM2M_RES_TYPE_S8: + case LWM2M_RES_TYPE_BOOL: + shell_print(sh, "%s : %u", path, *(uint8_t *)ri->data_ptr); + break; + case LWM2M_RES_TYPE_U16: + case LWM2M_RES_TYPE_S16: + shell_print(sh, "%s : %u", path, *(uint16_t *)ri->data_ptr); + break; + case LWM2M_RES_TYPE_U32: + case LWM2M_RES_TYPE_S32: + shell_print(sh, "%s : %u", path, *(uint32_t *)ri->data_ptr); + break; + case LWM2M_RES_TYPE_S64: + case LWM2M_RES_TYPE_TIME: + shell_print(sh, "%s : %lld", path, + *(int64_t *)ri->data_ptr); + break; + case LWM2M_RES_TYPE_FLOAT: + shell_print(sh, "%s : %lf", path, *(double *)ri->data_ptr); + break; + case LWM2M_RES_TYPE_OPAQUE: + shell_print(sh, "%s : OPAQUE(%hu/%hu)", path, ri->data_len, + ri->max_data_len); + break; + } + } + } + } + return 0; +} + +static int print_object(const struct shell *sh, struct lwm2m_engine_obj *obj) +{ + if (!obj) { + return -ENOEXEC; + } + struct lwm2m_engine_obj_inst *oi = next_engine_obj_inst(obj->obj_id, -1); + + for (int i = 0; i < obj->instance_count; i++) { + print_object_instance(sh, oi); + oi = next_engine_obj_inst(obj->obj_id, oi->obj_inst_id); + } + return 0; +} + +static int print_all_objs(const struct shell *sh) +{ + struct lwm2m_engine_obj *obj; + + SYS_SLIST_FOR_EACH_CONTAINER(lwm2m_engine_obj_list(), obj, node) { + print_object(sh, obj); + } + return 0; +} + +static int cmd_ls(const struct shell *sh, size_t argc, char **argv) +{ + struct lwm2m_obj_path path; + int ret; + + if (argc < 2) { + return print_all_objs(sh); + } + + ret = lwm2m_string_to_path(argv[1], &path, '/'); + if (ret < 0) { + return -ENOEXEC; + } + + if (path.level == LWM2M_PATH_LEVEL_NONE) { + return print_all_objs(sh); + } else if (path.level == LWM2M_PATH_LEVEL_OBJECT) { + struct lwm2m_engine_obj *obj = lwm2m_engine_get_obj(&path); + + return print_object(sh, obj); + } else if (path.level == LWM2M_PATH_LEVEL_OBJECT_INST) { + struct lwm2m_engine_obj_inst *oi = lwm2m_engine_get_obj_inst(&path); + + return print_object_instance(sh, oi); + } else if (path.level == LWM2M_PATH_LEVEL_RESOURCE) { + return cmd_read(sh, argc, argv); + } + return -ENOEXEC; +} + SHELL_STATIC_SUBCMD_SET_CREATE( sub_lwm2m, SHELL_COND_CMD_ARG(CONFIG_LWM2M_VERSION_1_1, send, NULL, @@ -730,6 +850,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE( SHELL_CMD_ARG(lock, NULL, LWM2M_HELP_LOCK, cmd_lock, 1, 0), SHELL_CMD_ARG(unlock, NULL, LWM2M_HELP_UNLOCK, cmd_unlock, 1, 0), SHELL_CMD_ARG(obs, NULL, LWM2M_HELP_OBSERV, cmd_observations, 1, 0), + SHELL_CMD_ARG(ls, NULL, LWM2M_HELP_LS, cmd_ls, 1, 1), SHELL_SUBCMD_SET_END); SHELL_COND_CMD_ARG_REGISTER(CONFIG_LWM2M_SHELL, lwm2m, &sub_lwm2m, LWM2M_HELP_CMD, NULL, 1, 0); From 09a643ee2c94fba77702c7cc225fea0171c2d265 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Wed, 2 Oct 2024 15:21:35 +0000 Subject: [PATCH 0278/4482] devicetree: make DT_..._REG_SIZE return unsigned Simiarly to f98fde07b30, make the SIZE macros return unsigned literal values. Signed-off-by: Fabio Baltieri --- doc/releases/migration-guide-4.0.rst | 2 ++ include/zephyr/devicetree.h | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index efd7c480e2fd6..1cc6a122af170 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -43,6 +43,8 @@ Devicetree * The :c:macro:`DT_REG_ADDR` macro and its variants are now expanding into an unsigned literals (i.e. with a ``U`` suffix). To use addresses as devicetree indexes use the :c:macro:`DT_REG_ADDR_RAW` variants. +* The :c:macro:`DT_REG_SIZE` macro and its variants are also expanding into + unsigned literals, no raw variants are provided at this stage. STM32 ===== diff --git a/include/zephyr/devicetree.h b/include/zephyr/devicetree.h index 8430c3072c68e..8cc9733fdff95 100644 --- a/include/zephyr/devicetree.h +++ b/include/zephyr/devicetree.h @@ -2292,7 +2292,7 @@ * @return size of the idx-th register block */ #define DT_REG_SIZE_BY_IDX(node_id, idx) \ - DT_CAT4(node_id, _REG_IDX_, idx, _VAL_SIZE) + DT_U32_C(DT_CAT4(node_id, _REG_IDX_, idx, _VAL_SIZE)) /** * @brief Get a node's (only) register block address @@ -2367,7 +2367,7 @@ * @return size of the register block specified by name */ #define DT_REG_SIZE_BY_NAME(node_id, name) \ - DT_CAT4(node_id, _REG_NAME_, name, _VAL_SIZE) + DT_U32_C(DT_CAT4(node_id, _REG_NAME_, name, _VAL_SIZE)) /** * @brief Like DT_REG_SIZE_BY_NAME(), but with a fallback to @p default_value From 0515bfff7a37fe859963c4c6d7a7dce2ad32b83f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 4 Oct 2024 14:10:07 +0300 Subject: [PATCH 0279/4482] net: lib: http-client: Use memcpy() to avoid gcc warning GCC 12.2.0 can give this warning (version 11.4.0 did not), when CONFIG_SPEED_OPTIMIZATIONS=y subsys/net/lib/http/http_client.c: In function 'http_send_data.constprop': subsys/net/lib/http/http_client.c:114:33: warning: 'strncpy' specified bound depends on the length of the source argument [-Wstringop-truncation] 114 | strncpy(send_buf + end_of_send, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | data + end_of_data, | ~~~~~~~~~~~~~~~~~~~ 116 | remaining); | ~~~~~~~~~~ subsys/net/lib/http/http_client.c:87:41: note: length computed here 87 | remaining_len = strlen(data + end_of_data); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ The code properly checks that we do not overwrite the destination buffer even if we use the source buffer length to determine how much to copy. One possible fix is to use memcpy() or strcpy(), I opted to use memcpy() because it has the length option which feels more natural. Fixes #79326 Signed-off-by: Jukka Rissanen --- subsys/net/lib/http/http_client.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/net/lib/http/http_client.c b/subsys/net/lib/http/http_client.c index db2ddee4b2b69..51cab197a7a7c 100644 --- a/subsys/net/lib/http/http_client.c +++ b/subsys/net/lib/http/http_client.c @@ -109,9 +109,9 @@ static int http_send_data(int sock, char *send_buf, end_of_send = 0; continue; } else { - strncpy(send_buf + end_of_send, - data + end_of_data, - remaining_len); + memcpy(send_buf + end_of_send, + data + end_of_data, + remaining_len); end_of_send += remaining_len; remaining_len = 0; } From 6edefd8f50d506a1597d80bd796970dc74a86805 Mon Sep 17 00:00:00 2001 From: Joel Spadin Date: Sat, 14 Sep 2024 20:17:32 -0500 Subject: [PATCH 0280/4482] scripts: dts: properly escape string properties Fixed escaping of double quotes, backslashes, and new line characters so they can be used in string properties. Previously, double quotes and backslashes were escaped in gen_defines.py but not in gen_dts_cmake.py, and new lines were not escaped in either, so using any of these characters would break the build. Signed-off-by: Joel Spadin --- scripts/dts/gen_defines.py | 28 +++++++++++++++++++++++----- scripts/dts/gen_dts_cmake.py | 18 +++++++++++++++++- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/scripts/dts/gen_defines.py b/scripts/dts/gen_defines.py index fda61526dc85c..fb97faf36bf29 100755 --- a/scripts/dts/gen_defines.py +++ b/scripts/dts/gen_defines.py @@ -583,7 +583,7 @@ def write_vanilla_props(node: edtlib.Node) -> None: if prop.spec.type == 'string': # DT_N__P__IDX__STRING_UNQUOTED - macro2val[macro + "_STRING_UNQUOTED"] = prop.val + macro2val[macro + "_STRING_UNQUOTED"] = escape_unquoted(prop.val) # DT_N__P__IDX__STRING_TOKEN macro2val[macro + "_STRING_TOKEN"] = prop.val_as_token # DT_N__P__IDX__STRING_UPPER_TOKEN @@ -626,7 +626,7 @@ def write_vanilla_props(node: edtlib.Node) -> None: macro2val[macro + f"_IDX_{i}"] = quote_str(subval) subval_as_token = edtlib.str_as_token(subval) # DT_N__P__IDX__STRING_UNQUOTED - macro2val[macro + f"_IDX_{i}_STRING_UNQUOTED"] = subval + macro2val[macro + f"_IDX_{i}_STRING_UNQUOTED"] = escape_unquoted(subval) # DT_N__P__IDX__STRING_TOKEN macro2val[macro + f"_IDX_{i}_STRING_TOKEN"] = subval_as_token # DT_N__P__IDX__STRING_UPPER_TOKEN @@ -1020,11 +1020,20 @@ def out_comment(s: str, blank_before=True) -> None: print("/* " + s + " */", file=header_file) +ESCAPE_TABLE = str.maketrans( + { + "\n": "\\n", + "\r": "\\r", + "\\": "\\\\", + '"': '\\"', + } +) + + def escape(s: str) -> str: - # Backslash-escapes any double quotes and backslashes in 's' + # Backslash-escapes any double quotes, backslashes, and new lines in 's' - # \ must be escaped before " to avoid double escaping - return s.replace("\\", "\\\\").replace('"', '\\"') + return s.translate(ESCAPE_TABLE) def quote_str(s: str) -> str: @@ -1034,6 +1043,15 @@ def quote_str(s: str) -> str: return f'"{escape(s)}"' +def escape_unquoted(s: str) -> str: + # C macros cannot contain line breaks, so replace them with spaces. + # Whitespace is used to separate preprocessor tokens, but it does not matter + # which whitespace characters are used, so a line break and a space are + # equivalent with regards to unquoted strings being used as C code. + + return s.replace("\r", " ").replace("\n", " ") + + def err(s: str) -> NoReturn: raise Exception(s) diff --git a/scripts/dts/gen_dts_cmake.py b/scripts/dts/gen_dts_cmake.py index 6fa4a3478802c..47fd30b67b93b 100755 --- a/scripts/dts/gen_dts_cmake.py +++ b/scripts/dts/gen_dts_cmake.py @@ -48,6 +48,22 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'python-devicetree', 'src')) +ESCAPE_TABLE = str.maketrans( + { + "\n": "\\n", + "\r": "\\r", + '\"': '\\"', + "\\": "\\\\", + } +) + + +def escape(value): + if isinstance(value, str): + return value.translate(ESCAPE_TABLE) + + return value + def parse_args(): # Returns parsed command-line arguments @@ -117,7 +133,7 @@ def main(): # Encode node's property 'item' as a CMake target property # with a name like 'DT_PROP||'. cmake_prop = f'DT_PROP|{node.path}|{item}' - cmake_props.append(f'"{cmake_prop}" "{cmake_value}"') + cmake_props.append(f'"{cmake_prop}" "{escape(cmake_value)}"') if item == 'compatible': # compatibles is always an array From c82799bd4c2980f579afcb0b3dc07991f765579d Mon Sep 17 00:00:00 2001 From: Joel Spadin Date: Mon, 16 Sep 2024 19:02:14 -0500 Subject: [PATCH 0281/4482] tests: scripts: dts: Add tests for string escapes Added tests for escape sequences in string and string-array properties. Signed-off-by: Joel Spadin --- dts/bindings/test/vnd,string-array.yaml | 11 ++++++ dts/bindings/test/vnd,string.yaml | 11 ++++++ tests/lib/devicetree/api/app.overlay | 51 +++++++++++++++++++++++++ tests/lib/devicetree/api/src/main.c | 49 ++++++++++++++++++++++++ 4 files changed, 122 insertions(+) create mode 100644 dts/bindings/test/vnd,string-array.yaml create mode 100644 dts/bindings/test/vnd,string.yaml diff --git a/dts/bindings/test/vnd,string-array.yaml b/dts/bindings/test/vnd,string-array.yaml new file mode 100644 index 0000000000000..a832ba09f2863 --- /dev/null +++ b/dts/bindings/test/vnd,string-array.yaml @@ -0,0 +1,11 @@ +# Copyright (c) 2024 Zephyr Contributors +# SPDX-License-Identifier: Apache-2.0 + +description: Test string array property container + +compatible: "vnd,string-array" + +properties: + val: + type: string-array + required: true diff --git a/dts/bindings/test/vnd,string.yaml b/dts/bindings/test/vnd,string.yaml new file mode 100644 index 0000000000000..c12b0e94f3ac8 --- /dev/null +++ b/dts/bindings/test/vnd,string.yaml @@ -0,0 +1,11 @@ +# Copyright (c) 2024 Zephyr Contributors +# SPDX-License-Identifier: Apache-2.0 + +description: Test string property container + +compatible: "vnd,string" + +properties: + val: + type: string + required: true diff --git a/tests/lib/devicetree/api/app.overlay b/tests/lib/devicetree/api/app.overlay index 0b1f46ba859ca..0694c98239060 100644 --- a/tests/lib/devicetree/api/app.overlay +++ b/tests/lib/devicetree/api/app.overlay @@ -687,6 +687,20 @@ val = "XA XPLUS XB"; }; + test_str_unquoted_esc_t: string-unquoted-escape-t { + compatible = "vnd,string-unquoted"; + val = "XA\nXPLUS\nXB"; + }; + + /* + * Tests expect all vnd,string-unquoted instances to evaluate to doubles, + * so use vnd,string instead. + */ + test_str_unquoted_esc_s: string-unquoted-escape-s { + compatible = "vnd,string"; + val = "XSTR1 \" plus \" XSTR2"; + }; + test_stra_unquoted_f0: string-array-unquoted-f0 { compatible = "vnd,string-array-unquoted"; val = "1.0e2", "2.0e2", "3.0e2", "4.0e2"; @@ -702,6 +716,43 @@ val = "XA XPLUS XB", "XC XPLUS XD", "XA XMINUS XB", "XC XMINUS XD"; }; + /* + * Tests expect all vnd,string-array-unquoted instances to evaluate to doubles, + * so use vnd,string-array instead. + */ + test_stra_unquoted_esc: string-array-unquoted-escape { + compatible = "vnd,string-array"; + val = "XA\nXPLUS\nXB", "XSTR1 \" plus \" XSTR2"; + }; + + test_str_escape_0: string-escape-0 { + compatible = "vnd,string"; + val = "\a\b\f\n\r\t\v"; + }; + + test_str_escape_1: string-escape-1 { + compatible = "vnd,string"; + val = "\'single\' \"double\""; + }; + + test_str_escape_2: string-escape-2 { + compatible = "vnd,string"; + val = "first\nsecond"; + }; + + test_str_escape_3: string-escape-3 { + compatible = "vnd,string"; + val = "\x01\x7F"; + }; + + test_stra_escape: string-array-escape { + compatible = "vnd,string-array"; + val = "\a\b\f\n\r\t\v", + "\'single\' \"double\"", + "first\nsecond", + "\x01\x7F"; + }; + test-mtd@ffeeddcc { reg = < 0xffeeddcc 0x1000 >; #address-cells = < 1 >; diff --git a/tests/lib/devicetree/api/src/main.c b/tests/lib/devicetree/api/src/main.c index 7616ef54a1f3c..12724bfca9121 100644 --- a/tests/lib/devicetree/api/src/main.c +++ b/tests/lib/devicetree/api/src/main.c @@ -3190,6 +3190,8 @@ ZTEST(devicetree_api, test_string_unquoted) #define XA 12.0 #define XB 34.0 #define XPLUS + +#define XSTR1 "one" +#define XSTR2 "two" const double f0_expected = 0.1234; const double f1_expected = 0.9e-3; const double delta = 0.1e-4; @@ -3201,6 +3203,10 @@ ZTEST(devicetree_api, test_string_unquoted) f1_expected, delta, ""); zassert_within(DT_STRING_UNQUOTED(DT_NODELABEL(test_str_unquoted_t), val), XA XPLUS XB, delta, ""); + zassert_within(DT_STRING_UNQUOTED(DT_NODELABEL(test_str_unquoted_esc_t), val), XA XPLUS XB, + delta, ""); + zassert_str_equal(DT_STRING_UNQUOTED(DT_NODELABEL(test_str_unquoted_esc_s), val), + "one plus two"); /* Test DT_STRING_UNQUOTED_OR */ zassert_within(DT_STRING_UNQUOTED_OR(DT_NODELABEL(test_str_unquoted_f0), val, (0.0)), f0_expected, delta, ""); @@ -3208,12 +3214,20 @@ ZTEST(devicetree_api, test_string_unquoted) f1_expected, delta, ""); zassert_within(DT_STRING_UNQUOTED_OR(DT_NODELABEL(test_str_unquoted_t), val, (0.0)), XA XPLUS XB, delta, ""); + zassert_within(DT_STRING_UNQUOTED_OR(DT_NODELABEL(test_str_unquoted_esc_t), val, (0.0)), + XA XPLUS XB, delta, ""); + zassert_str_equal(DT_STRING_UNQUOTED_OR(DT_NODELABEL(test_str_unquoted_esc_s), val, "nak"), + "one plus two"); zassert_within(DT_STRING_UNQUOTED_OR(DT_NODELABEL(test_str_unquoted_f0), nak, (0.0)), 0.0, delta, ""); zassert_within(DT_STRING_UNQUOTED_OR(DT_NODELABEL(test_str_unquoted_f1), nak, (0.0)), 0.0, delta, ""); zassert_within(DT_STRING_UNQUOTED_OR(DT_NODELABEL(test_str_unquoted_t), nak, (0.0)), 0.0, delta, ""); + zassert_within(DT_STRING_UNQUOTED_OR(DT_NODELABEL(test_str_unquoted_esc_t), nak, (0.0)), + 0.0, delta, ""); + zassert_str_equal(DT_STRING_UNQUOTED_OR(DT_NODELABEL(test_str_unquoted_esc_s), nak, "nak"), + "nak"); /* Test DT_INST_STRING_UNQUOTED */ #define STRING_UNQUOTED_VAR(node_id) _CONCAT(var_, node_id) #define STRING_UNQUOTED_TEST_INST_EXPANSION(inst) \ @@ -3226,6 +3240,8 @@ ZTEST(devicetree_api, test_string_unquoted) f1_expected, delta, ""); zassert_within(STRING_UNQUOTED_VAR(DT_NODELABEL(test_str_unquoted_t)), XA XPLUS XB, delta, ""); + zassert_within(STRING_UNQUOTED_VAR(DT_NODELABEL(test_str_unquoted_esc_t)), XA XPLUS XB, + delta, ""); /* Test DT_INST_STRING_UNQUOTED_OR */ #define STRING_UNQUOTED_OR_VAR(node_id) _CONCAT(var_or_, node_id) @@ -3242,15 +3258,21 @@ ZTEST(devicetree_api, test_string_unquoted) f1_expected, delta, ""); zassert_within(STRING_UNQUOTED_OR_VAR(DT_NODELABEL(test_str_unquoted_t))[0], XA XPLUS XB, delta, ""); + zassert_within(STRING_UNQUOTED_OR_VAR(DT_NODELABEL(test_str_unquoted_esc_t))[0], + XA XPLUS XB, delta, ""); zassert_within(STRING_UNQUOTED_OR_VAR(DT_NODELABEL(test_str_unquoted_f0))[1], 1.0e10, delta, ""); zassert_within(STRING_UNQUOTED_OR_VAR(DT_NODELABEL(test_str_unquoted_f1))[1], 1.0e10, delta, ""); zassert_within(STRING_UNQUOTED_OR_VAR(DT_NODELABEL(test_str_unquoted_t))[1], 1.0e10, delta, ""); + zassert_within(STRING_UNQUOTED_OR_VAR(DT_NODELABEL(test_str_unquoted_esc_t))[1], 1.0e10, + delta, ""); #undef XA #undef XB #undef XPLUS +#undef XSTR1 +#undef XSTR2 } #undef DT_DRV_COMPAT @@ -3263,6 +3285,8 @@ ZTEST(devicetree_api, test_string_idx_unquoted) #define XD 78.0 #define XPLUS + #define XMINUS - +#define XSTR1 "one" +#define XSTR2 "two" const double delta = 0.1e-4; /* DT_STRING_UNQUOTED_BY_IDX */ @@ -3293,6 +3317,11 @@ ZTEST(devicetree_api, test_string_idx_unquoted) zassert_within(DT_STRING_UNQUOTED_BY_IDX(DT_NODELABEL(test_stra_unquoted_t), val, 3), XC XMINUS XD, delta, ""); + zassert_within(DT_STRING_UNQUOTED_BY_IDX(DT_NODELABEL(test_stra_unquoted_esc), val, 0), + XA XPLUS XB, delta, ""); + zassert_str_equal(DT_STRING_UNQUOTED_BY_IDX(DT_NODELABEL(test_stra_unquoted_esc), val, 1), + "one plus two"); + #define STRING_UNQUOTED_BY_IDX_VAR(node_id) _CONCAT(var_, node_id) #define STRING_UNQUOTED_BY_IDX_TEST_INST_EXPANSION(inst) \ double STRING_UNQUOTED_BY_IDX_VAR(DT_DRV_INST(inst))[] = { \ @@ -3335,6 +3364,26 @@ ZTEST(devicetree_api, test_string_idx_unquoted) #undef XD #undef XPLUS #undef XMINUS +#undef XSTR1 +#undef XSTR2 +} + +#undef DT_DRV_COMPAT +ZTEST(devicetree_api, test_string_escape) +{ + zassert_str_equal(DT_PROP(DT_NODELABEL(test_str_escape_0), val), "\a\b\f\n\r\t\v"); + zassert_str_equal(DT_PROP(DT_NODELABEL(test_str_escape_1), val), "\'single\' \"double\""); + zassert_str_equal(DT_PROP(DT_NODELABEL(test_str_escape_2), val), "first\nsecond"); + zassert_str_equal(DT_PROP(DT_NODELABEL(test_str_escape_3), val), "\x01\x7F"); +} + +ZTEST(devicetree_api, test_string_array_escape) +{ + zassert_str_equal(DT_PROP_BY_IDX(DT_NODELABEL(test_stra_escape), val, 0), "\a\b\f\n\r\t\v"); + zassert_str_equal(DT_PROP_BY_IDX(DT_NODELABEL(test_stra_escape), val, 1), + "\'single\' \"double\""); + zassert_str_equal(DT_PROP_BY_IDX(DT_NODELABEL(test_stra_escape), val, 2), "first\nsecond"); + zassert_str_equal(DT_PROP_BY_IDX(DT_NODELABEL(test_stra_escape), val, 3), "\x01\x7F"); } #undef DT_DRV_COMPAT From 3604aba75b1c43bc0d3c508416891bb24b84905c Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Mon, 23 Sep 2024 09:29:43 -0500 Subject: [PATCH 0282/4482] shields: lcd_par_s035: rename nxp_flexio_lcd to zephyr_mipi_dbi_parallel Although the parallel mipi dbi mode pinout used for the LCD PAR S035 display is specific to NXP boards, the definition of the display is generic, and does not require NXP-specific parallel mipi dbi IP. Therefore, rename the MIPI DBI node for this display from `nxp_flexio_lcd` to `zephyr_mipi_dbi_parallel`. The gpio-nexus node name is unchanged, as the pinout it describes is specific to NXP. Signed-off-by: Daniel DeGrasse --- boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi | 2 +- boards/shields/lcd_par_s035/lcd_par_s035_8080.overlay | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi b/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi index 7e95ec1614405..2f2d27a4f11e0 100644 --- a/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi +++ b/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi @@ -209,7 +209,7 @@ nxp_8080_touch_panel_i2c: &flexcomm2_lpi2c2 { pinctrl-names = "default"; }; -nxp_flexio_lcd: &flexio0_lcd { +zephyr_mipi_dbi_parallel: &flexio0_lcd { /* DMA channels 0, muxed to FlexIO TX */ dmas = <&edma0 0 61>; dma-names = "tx"; diff --git a/boards/shields/lcd_par_s035/lcd_par_s035_8080.overlay b/boards/shields/lcd_par_s035/lcd_par_s035_8080.overlay index 9306610bc1f14..bd305564be429 100644 --- a/boards/shields/lcd_par_s035/lcd_par_s035_8080.overlay +++ b/boards/shields/lcd_par_s035/lcd_par_s035_8080.overlay @@ -29,7 +29,7 @@ }; }; -&nxp_flexio_lcd { +&zephyr_mipi_dbi_parallel { status = "okay"; #address-cells = <1>; #size-cells = <0>; From 04726a22cb776b3441487084d55dbf1b14500165 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Mon, 26 Aug 2024 15:48:00 +0000 Subject: [PATCH 0283/4482] drivers: display: st7796s: respect rgb_is_inverted in 8080 8 bit mode Update ST7796s display driver to respect the setting of rgb_is_inverted in 8080 8 bit mode, as it was previously not applied for this mode. Also, simplify the logic check for 16 bit mode- the new check is functionally equivalent, but no longer inverts both boolean values. Signed-off-by: Daniel DeGrasse --- drivers/display/display_st7796s.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/display/display_st7796s.c b/drivers/display/display_st7796s.c index 257a456c84bc5..e491fde699618 100644 --- a/drivers/display/display_st7796s.c +++ b/drivers/display/display_st7796s.c @@ -118,7 +118,13 @@ static int st7796s_get_pixelfmt(const struct device *dev) * and vice versa. */ if (config->dbi_config.mode == MIPI_DBI_MODE_8080_BUS_8_BIT) { - if (config->madctl & ST7796S_MADCTL_BGR) { + /* + * Similar to the handling for other interface modes, + * invert the reported pixel format if "rgb_is_inverted" + * is enabled + */ + if (((bool)(config->madctl & ST7796S_MADCTL_BGR)) != + config->rgb_is_inverted) { return PIXEL_FORMAT_RGB_565; } else { return PIXEL_FORMAT_BGR_565; @@ -133,7 +139,8 @@ static int st7796s_get_pixelfmt(const struct device *dev) * if rgb_is_inverted is enabled. * It is a workaround for supporting buggy modules that display RGB as BGR. */ - if (!(config->madctl & ST7796S_MADCTL_BGR) != !config->rgb_is_inverted) { + if (((bool)(config->madctl & ST7796S_MADCTL_BGR)) != + config->rgb_is_inverted) { return PIXEL_FORMAT_BGR_565; } else { return PIXEL_FORMAT_RGB_565; From 22a922fded4202548ee0587bc674127d8f5d2bbf Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Mon, 26 Aug 2024 15:50:52 +0000 Subject: [PATCH 0284/4482] drivers: mipi_dbi: nxp_lcdic: add support for 8080 mode Enable support for 8 bit 8080 mode in the NXP LCDIC driver. Support for programming the minimum duration of the write active/inactive signal is also added, since this will be required to support high display clocks in 8080 mode. Signed-off-by: Daniel DeGrasse --- drivers/mipi_dbi/mipi_dbi_nxp_lcdic.c | 42 +++++++++++++++++++++------ dts/bindings/mipi-dbi/nxp,lcdic.yaml | 25 +++++++++++++++- 2 files changed, 57 insertions(+), 10 deletions(-) diff --git a/drivers/mipi_dbi/mipi_dbi_nxp_lcdic.c b/drivers/mipi_dbi/mipi_dbi_nxp_lcdic.c index 32330b69b4c80..827e1d3b2b48b 100644 --- a/drivers/mipi_dbi/mipi_dbi_nxp_lcdic.c +++ b/drivers/mipi_dbi/mipi_dbi_nxp_lcdic.c @@ -72,6 +72,8 @@ struct mipi_dbi_lcdic_config { const struct device *clock_dev; clock_control_subsys_t clock_subsys; bool swap_bytes; + uint8_t write_active_min; + uint8_t write_inactive_min; }; #ifdef CONFIG_MIPI_DBI_NXP_LCDIC_DMA @@ -249,10 +251,6 @@ static int mipi_dbi_lcdic_configure(const struct device *dev, LOG_ERR("Invalid clock frequency %d", spi_cfg->frequency); return ret; } - if (!(spi_cfg->operation & SPI_HALF_DUPLEX)) { - LOG_ERR("LCDIC only supports half duplex operation"); - return -ENOTSUP; - } if (spi_cfg->slave != 0) { /* Only one slave select line */ return -ENOTSUP; @@ -265,13 +263,26 @@ static int mipi_dbi_lcdic_configure(const struct device *dev, reg = base->CTRL; /* Disable LCD module during configuration */ reg &= ~LCDIC_CTRL_LCDIC_EN_MASK; - /* Select SPI mode */ - reg &= ~LCDIC_CTRL_LCDIC_MD_MASK; - /* Select 3 or 4 wire mode based on config selection */ - if (dbi_config->mode == MIPI_DBI_MODE_SPI_4WIRE) { + if (dbi_config->mode == MIPI_DBI_MODE_8080_BUS_8_BIT) { + /* Enable 8080 Mode */ + reg |= LCDIC_CTRL_LCDIC_MD_MASK; + } else if (dbi_config->mode == MIPI_DBI_MODE_SPI_4WIRE) { + /* Select SPI 4 wire mode */ reg |= LCDIC_CTRL_SPI_MD_MASK; + reg &= ~LCDIC_CTRL_LCDIC_MD_MASK; + } else if (dbi_config->mode == MIPI_DBI_MODE_SPI_3WIRE) { + /* Select SPI 3 wire mode */ + reg &= ~(LCDIC_CTRL_LCDIC_MD_MASK | + LCDIC_CTRL_SPI_MD_MASK); } else { - reg &= ~LCDIC_CTRL_SPI_MD_MASK; + /* Unsupported mode */ + return -ENOTSUP; + } + /* If using SPI mode, validate that half-duplex was requested */ + if ((!(reg & LCDIC_CTRL_LCDIC_MD_MASK)) && + (!(spi_cfg->operation & SPI_HALF_DUPLEX))) { + LOG_ERR("LCDIC only supports half duplex operation"); + return -ENOTSUP; } /* Enable byte swapping if user requested it */ reg = (reg & ~LCDIC_CTRL_DAT_ENDIAN_MASK) | @@ -292,6 +303,15 @@ static int mipi_dbi_lcdic_configure(const struct device *dev, LCDIC_SPI_CTRL_CPOL((spi_cfg->operation & SPI_MODE_CPOL) ? 1 : 0); base->SPI_CTRL = reg; + /* + * Set 8080 control based on module properties. TRIW and TRAW are + * set to their reset values + */ + base->I8080_CTRL1 = LCDIC_I8080_CTRL1_TRIW(0xf) | + LCDIC_I8080_CTRL1_TRAW(0xf) | + LCDIC_I8080_CTRL1_TWIW(config->write_inactive_min) | + LCDIC_I8080_CTRL1_TWAW(config->write_active_min); + /* Enable the module */ base->CTRL |= LCDIC_CTRL_LCDIC_EN_MASK; mipi_dbi_lcdic_reset_delay(); @@ -783,6 +803,10 @@ static void mipi_dbi_lcdic_isr(const struct device *dev) DT_INST_CLOCKS_CELL(n, name), \ .irq_config_func = mipi_dbi_lcdic_config_func_##n, \ .swap_bytes = DT_INST_PROP(n, nxp_swap_bytes), \ + .write_active_min = \ + DT_INST_PROP(n, nxp_write_active_cycles), \ + .write_inactive_min = \ + DT_INST_PROP(n, nxp_write_inactive_cycles), \ }; \ static struct mipi_dbi_lcdic_data mipi_dbi_lcdic_data_##n = { \ LCDIC_DMA_CHANNELS(n) \ diff --git a/dts/bindings/mipi-dbi/nxp,lcdic.yaml b/dts/bindings/mipi-dbi/nxp,lcdic.yaml index b8a38ba2c744b..4ce3f392a7c92 100644 --- a/dts/bindings/mipi-dbi/nxp,lcdic.yaml +++ b/dts/bindings/mipi-dbi/nxp,lcdic.yaml @@ -3,7 +3,7 @@ description: | NXP LCDIC Controller. This controller implements 8080 and SPI mode MIPI-DBI - compliant transfers. Only SPI mode is currently supported. + compliant transfers. compatible: "nxp,lcdic" include: ["mipi-dbi-controller.yaml", "pinctrl-device.yaml"] @@ -23,3 +23,26 @@ properties: description: | Swap bytes while transferring on LCDIC. When set, the LCDIC will send the most significant byte first when using multibyte pixel formats. + + reset-gpios: + type: phandle-array + description: | + Reset GPIO pin. The controller will set this pin to logic high to reset + the display. If not provided, the LCDIC module's reset pin will be used + to reset attached displays. + + nxp,write-inactive-cycles: + type: int + default: 6 + description: | + Set minimum count of write inactive cycles, as a multiple of the module + clock frequency. This controls the length of the inactive period of the + WRX signal. Default is IP reset value. Only valid in 8080 mode. + + nxp,write-active-cycles: + type: int + default: 6 + description: | + Set minimum count of write active cycles, as a multiple of the module + clock frequency. This controls the length of the active period of the + WRX signal. Default is IP reset value. Only valid in 8080 mode. From f8f70c2ac720907f54db18b82b5c723a8f2ed56f Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Mon, 26 Aug 2024 15:58:32 +0000 Subject: [PATCH 0285/4482] boards: shields: lcd_par_s035: enable reset gpio within input module The LCD_PAR_S035 display module shares the reset pin between the display module and the touchscreen controller. The touchscreen controller needs the reset pin to be toggled low during boot in order to select the expected I2C address. However, the reset sequence must occur before the display is initialized. To enable this, set a custom INPUT driver init priority when using this display module, so that INPUT drivers start after MIPI DBI drivers but before DISPLAY drivers. Since the reset sequence is now operating as expected, we no longer need to use the alt-addr probing method. This method was previously only working correctly because boards using this display were configuring the display INT pin using the pin control API prior to resetting the display, so when the display was reset it would select the alt-addr I2C address. Signed-off-by: Daniel DeGrasse --- boards/shields/lcd_par_s035/Kconfig.defconfig | 9 +++++++++ boards/shields/lcd_par_s035/lcd_par_s035_8080.overlay | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/boards/shields/lcd_par_s035/Kconfig.defconfig b/boards/shields/lcd_par_s035/Kconfig.defconfig index 8e375f8b1a8ff..a536a16f53432 100644 --- a/boards/shields/lcd_par_s035/Kconfig.defconfig +++ b/boards/shields/lcd_par_s035/Kconfig.defconfig @@ -28,4 +28,13 @@ config INPUT_GT911_INTERRUPT endif # LVGL +if INPUT + +# GT911 driver drives reset pin low, so it needs to initialize before +# the display driver but after the MIPI DBI driver +config INPUT_INIT_PRIORITY + default 82 + +endif # INPUT + endif # SHIELD_LCD_PAR_S035 diff --git a/boards/shields/lcd_par_s035/lcd_par_s035_8080.overlay b/boards/shields/lcd_par_s035/lcd_par_s035_8080.overlay index bd305564be429..ca374649bab2f 100644 --- a/boards/shields/lcd_par_s035/lcd_par_s035_8080.overlay +++ b/boards/shields/lcd_par_s035/lcd_par_s035_8080.overlay @@ -24,8 +24,8 @@ gt911_lcd_par_s035: gt911-lcd_par_s035@5d { compatible = "goodix,gt911"; reg = <0x5d>; - alt-addr = <0x14>; irq-gpios = <&nxp_lcd_8080_connector 9 GPIO_ACTIVE_HIGH>; + reset-gpios = <&nxp_lcd_8080_connector 11 GPIO_ACTIVE_LOW>; }; }; From 404041621f4898b00007a2c3f0182f37a38f0af6 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Mon, 26 Aug 2024 16:02:13 +0000 Subject: [PATCH 0286/4482] boards: nxp: rd_rw612_bga: enable with LCD_PAR_S035 shield Enable the rd_rw612_bga board with the LCD_PAR_S035 shield. This shield cannot be connected directly to the board, but the connection can be made with a set of jumper wires. Signed-off-by: Daniel DeGrasse --- boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi | 28 +++++- .../lcd_par_s035/boards/rd_rw612_bga.overlay | 95 +++++++++++++++++++ 2 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 boards/shields/lcd_par_s035/boards/rd_rw612_bga.overlay diff --git a/boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi b/boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi index 4926cfef5ccbb..7e6689bba9285 100644 --- a/boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi +++ b/boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi @@ -76,6 +76,22 @@ <20 0 &hsgpio0 16 0>, /* D14 */ <21 0 &hsgpio0 17 0>; /* D15 */ }; + + + /* + * The pins for this interface are chosen arbitrarily- the RD-RW612 + * board does not have the NXP 8080 interface, but can support displays + * using it by connecting signals directly with jumper wires. + */ + nxp_lcd_8080_connector: lcd-8080-connector { + compatible = "nxp,lcd-8080"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map = <9 0 &hsgpio0 3 0>, /* Pin 9, LCD touch INT */ + <10 0 &hsgpio0 2 0>, /* Pin 10, LCD backlight control */ + <11 0 &hsgpio0 4 0>; /* Pin 11, LCD and touch reset */ + }; }; &wwdt { @@ -231,12 +247,22 @@ zephyr_udc0: &usb_otg { status = "okay"; }; -&lcdic { +zephyr_mipi_dbi_parallel: &lcdic { status = "okay"; pinctrl-0 = <&pinmux_lcdic>; pinctrl-names = "default"; }; +/* + * Similar to the flexio connection, these pins are not + * broken out in the format required to connect directly to + * an NXP 8080 display, but they can be connected with jumper + * wires. + */ +nxp_8080_touch_panel_i2c: &arduino_i2c { + status = "okay"; +}; + &mrt0_channel0 { status = "okay"; }; diff --git a/boards/shields/lcd_par_s035/boards/rd_rw612_bga.overlay b/boards/shields/lcd_par_s035/boards/rd_rw612_bga.overlay new file mode 100644 index 0000000000000..be0ba1319ec90 --- /dev/null +++ b/boards/shields/lcd_par_s035/boards/rd_rw612_bga.overlay @@ -0,0 +1,95 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/* + * To use this board with this display, perform the following modifications: + * - Depopulate resistors R78, R604, R598, R15, R245, R243, R11, R20, R237, + * R235, R431, R447, R420, R459, R485, and R486 + * - Populate resistors R286, R19, R246, R242, R123, R239, R124, R125, R236, + * R233, and R12 + * - Remove jumper JP30 + * - Set jumper JP40 to postion 1-2, JP38 to 1-2, and JP16 to position 2-3 + */ + +/* + * To connect the display configure SW1 on the display to + * ON-ON-OFF (8 bit 8080 mode), and connect the following pins + * | Board Pin | Display Pin | Function | + * |-----------|-------------|----------| + * | HD2.8 | D0 | D[0] | + * | HD2.16 | D1 | D[1] | + * | J5.2 | TE | TE | + * | J5.4 | D2 | D[2] | + * | J5.1 | D3 | D[3] | + * | J5.6 | RD | RDX | + * | J5.3 | D4 | D[4] | + * | HD2.7 | D5 | D[5] | + * | HD2.6 | D6 | D[6] | + * | HD2.1 | D7 | D[7] | + * | HD2.2 | WR | WR | + * | HD8.1 | CS | CS | + * | HD8.2 | D/C | DC | + * | J13.8 | GND | GND | + * | J13.7 | VDD | 3V3 | + * | J5.10 | SCL | IC2_SCL | + * | J5.9 | SDA | IC2_SDA | + * | HD2.4 | INT | INT | + * | HD2.5 | RST | RESET | + */ + +/* Expand the LCDIC pinmux to cover all 8080 mode pins */ +&pinmux_lcdic { + group0 { + pinmux = , + , + , + , + , + , + , + , + , + , + , + , + , + ; + slew-rate = "ultra"; + }; +}; + +&st7796s { + mipi-mode = ; + /* + * Display supports minimum write cycle time of 66ns. This + * means we can clock the LCDIC module at 30MHz, as + * the minimum write duration will be 2x the module + * clock. Note that this frequency is too fast for reading + * from the display module + */ + mipi-max-frequency = <30000000>; + /* + * Note that this display is *not* buggy- we use rgb-is-inverted + * as a workaround here to get the display to report an inverted + * color format. This is because the "nxp,swap-bytes" setting + * on the LCDIC will apply byte swapping in hardware, so the + * display should report an inverted color format to account + * for this. This results in better performance for applications + * like LVGL, which would otherwise have to swap RGB565 data in + * software + */ + rgb-is-inverted; +}; + +&lcdic { + /* Enable byte swapping */ + nxp,swap-bytes; + /* Set pulse width for write active and write inactive to min value */ + nxp,write-active-cycles = <1>; + nxp,write-inactive-cycles = <1>; +}; From 8a30c2318d70225fb6429b62e7db935a4131cf11 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Mon, 26 Aug 2024 16:21:05 +0000 Subject: [PATCH 0287/4482] boards: nxp: rd_rw612_bga: add display support documentation Add documentation about supported displays on this board, as the list is getting rather long and each display has its own bespoke connection requirements. Signed-off-by: Daniel DeGrasse --- boards/nxp/rd_rw612_bga/doc/index.rst | 53 +++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/boards/nxp/rd_rw612_bga/doc/index.rst b/boards/nxp/rd_rw612_bga/doc/index.rst index e0215ececad5a..8fbed455eb2be 100644 --- a/boards/nxp/rd_rw612_bga/doc/index.rst +++ b/boards/nxp/rd_rw612_bga/doc/index.rst @@ -75,6 +75,59 @@ The default configuration can be found in the defconfig file: Other hardware features are not currently supported + +Display Support +*************** + +The rd_rw612_bga board supports several in-tree display modules. Setup for +each module is described below: + +GoWorld 16880 LCM +================= + +This module does not connect directly to the board, and must be connected +via an adapter board and jumper wires. Connections are described in +:zephyr_file:`boards/nxp/rd_rw612_bga/dts/goworld_16880_lcm.overlay`. The +display sample can be built for this board like so: + +.. zephyr-app-commands:: + :board: rd_rw612_bga + :gen-args: -DDTC_OVERLAY_FILE=goworld_16880_lcm.overlay + :zephyr-app: samples/drivers/display + :goals: build + :compact: + +Adafruit 2.8 TFT +================ + +The :ref:`adafruit_2_8_tft_touch_v2` connects to the board's Arduino headers +directly, but some modifications are required (see +:zephyr_file:`boards/shields/adafruit_2_8_tft_touch_v2/boards/rd_rw612_bga.overlay` +for a list). The display sample can be built for this module like so: + +.. zephyr-app-commands:: + :board: rd_rw612_bga + :shield: adafruit_2_8_tft_touch_v2 + :zephyr-app: samples/drivers/display + :goals: build + :compact: + +NXP LCD_PAR_S035 +================ + +The :ref:`lcd_par_s035` does not connect directly to the board, and must be +connected via jumper wires. Connections and required board changes are +described in +:zephyr_file:`boards/shields/lcd_par_s035/boards/rd_rw612_bga.overlay`. The +display sample can be built for the module like so: + +.. zephyr-app-commands:: + :board: rd_rw612_bga + :shield: lcd_par_s035_8080 + :zephyr-app: samples/drivers/display + :goals: build + :compact: + Fetch Binary Blobs ****************** From 8354fc5c3c6a4665513ca2cacd564a5605ceb984 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Thu, 29 Aug 2024 11:33:48 +1000 Subject: [PATCH 0288/4482] modules: tfm: default version numbers from `VERSION` Populate the TFM application version numbers from the application `VERSION` file if it exists. Signed-off-by: Jordan Yates --- modules/trusted-firmware-m/Kconfig.tfm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/trusted-firmware-m/Kconfig.tfm b/modules/trusted-firmware-m/Kconfig.tfm index 24ffcf76020b8..33ec3e8c9d10c 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm +++ b/modules/trusted-firmware-m/Kconfig.tfm @@ -188,6 +188,7 @@ config TFM_BL2_NOT_SUPPORTED config TFM_IMAGE_VERSION_S string "Version of the Secure Image" + default "$(APP_VERSION_TWEAK_STRING)" if "$(VERSION_MAJOR)" != "" && TFM_MCUBOOT_IMAGE_NUMBER = 1 default "0.0.0+0" help Version of the secure image. This version is also used for merged @@ -195,6 +196,7 @@ config TFM_IMAGE_VERSION_S config TFM_IMAGE_VERSION_NS string "Version of the Non-Secure Image" + default "$(APP_VERSION_TWEAK_STRING)" if "$(VERSION_MAJOR)" != "" && TFM_MCUBOOT_IMAGE_NUMBER = 2 default "0.0.0+0" help Version of the non-secure image. From 3ea954e97d4c9883a9b83b16c561908b85944044 Mon Sep 17 00:00:00 2001 From: Andrej Butok Date: Mon, 23 Sep 2024 15:58:04 +0200 Subject: [PATCH 0289/4482] tests: mcuboot: Add other nxp boards as test targets Added other nxp boards as test targets: frdm_ke17z, frdm_ke17z, frdm_ke17z512, rddrone_fmuk66, twr_ke18f, twr_kv58f220m, frdm_mcxn947/mcxn947/cpu0, mimxrt1062_fmurt6, vmu_rt1170. Signed-off-by: Andrej Butok --- tests/boot/test_mcuboot/testcase.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/boot/test_mcuboot/testcase.yaml b/tests/boot/test_mcuboot/testcase.yaml index 24297eb96424b..630e3ac6b639f 100644 --- a/tests/boot/test_mcuboot/testcase.yaml +++ b/tests/boot/test_mcuboot/testcase.yaml @@ -16,6 +16,12 @@ tests: - frdm_k22f - frdm_k64f - frdm_k82f + - frdm_ke17z + - frdm_ke17z512 + - rddrone_fmuk66 + - twr_ke18f + - twr_kv58f220m + - frdm_mcxn947/mcxn947/cpu0 - lpcxpresso55s06 - lpcxpresso55s16 - lpcxpresso55s28 @@ -28,9 +34,11 @@ tests: - mimxrt1040_evk - mimxrt1050_evk - mimxrt1060_evk + - mimxrt1062_fmurt6 - mimxrt1064_evk - mimxrt1160_evk/mimxrt1166/cm7 - mimxrt1170_evk/mimxrt1176/cm7 + - vmu_rt1170/mimxrt1176/cm7 - mimxrt595_evk/mimxrt595s/cm33 - mimxrt685_evk/mimxrt685s/cm33 - nrf52840dk/nrf52840 From 8221a9a704ec249688eb9a6513f03177411d5337 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Mon, 23 Sep 2024 14:29:31 -0500 Subject: [PATCH 0290/4482] Revert "arch: common: Add user can specify the nocache location" This reverts commit 88f6851a3dc5786bff76e0e98ffbe0f534c8152f. This is being reverted because it is redundant with the capabilities of zephyr,memory-region and zephyr,memory-attr properties. Signed-off-by: Declan Snyder --- arch/common/nocache.ld | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/arch/common/nocache.ld b/arch/common/nocache.ld index 24e81cdefcf8f..a4e500e8b17b3 100644 --- a/arch/common/nocache.ld +++ b/arch/common/nocache.ld @@ -7,12 +7,6 @@ /* Copied from linker.ld */ -#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_nocache_ram), okay) -#define NOCACHE_REGION LINKER_DT_NODE_REGION_NAME_TOKEN(DT_CHOSEN(zephyr_nocache_ram)) -#else -#define NOCACHE_REGION RAMABLE_REGION -#endif - /* Non-cached region of RAM */ SECTION_DATA_PROLOGUE(_NOCACHE_SECTION_NAME,(NOLOAD),) { @@ -33,5 +27,5 @@ SECTION_DATA_PROLOGUE(_NOCACHE_SECTION_NAME,(NOLOAD),) MPU_ALIGN(_nocache_ram_size); #endif _nocache_ram_end = .; -} GROUP_DATA_LINK_IN(NOCACHE_REGION, NOCACHE_REGION) +} GROUP_DATA_LINK_IN(RAMABLE_REGION, RAMABLE_REGION) _nocache_ram_size = _nocache_ram_end - _nocache_ram_start; From 4ec266152d4a5ba48860fe142fba3bdd42ba7f0f Mon Sep 17 00:00:00 2001 From: Martin Stumpf Date: Mon, 30 Sep 2024 17:01:01 +0200 Subject: [PATCH 0291/4482] drivers: cc: mcux: Fix incorrect clock source of FlexSPI2 The clock control mcux rev2 returns FlexSPI1 clock rate when FlexSPI2 clock rate is requested. Signed-off-by: Martin Stumpf --- drivers/clock_control/clock_control_mcux_ccm_rev2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/clock_control/clock_control_mcux_ccm_rev2.c b/drivers/clock_control/clock_control_mcux_ccm_rev2.c index 5633f5f0cfefe..db2a4454060a6 100644 --- a/drivers/clock_control/clock_control_mcux_ccm_rev2.c +++ b/drivers/clock_control/clock_control_mcux_ccm_rev2.c @@ -198,10 +198,8 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev, #ifdef CONFIG_MEMC_MCUX_FLEXSPI case IMX_CCM_FLEXSPI_CLK: - clock_root = kCLOCK_Root_Flexspi1; - break; case IMX_CCM_FLEXSPI2_CLK: - clock_root = kCLOCK_Root_Flexspi2; + clock_root = kCLOCK_Root_Flexspi1 + instance; break; #endif #ifdef CONFIG_COUNTER_NXP_PIT From 9403b08512eb9a91d8c187266f43960ed64f3bc8 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Wed, 2 Oct 2024 09:47:08 -0300 Subject: [PATCH 0292/4482] boards: esp32: move board specific kconfig definitions HEAP_MEM_POOL_ADD_SIZE_BOARD is not a zephyr-defined entry and should be placed into Kconfig instead of Kconfig.defconfig. This PR moves that entry for all ESP32-based boards accordingly. Signed-off-by: Sylvio Alves --- .../esp32c3_042_oled/Kconfig} | 4 +--- .../esp32c3_042_oled/Kconfig.defconfig | 9 -------- boards/dptechnics/walter/Kconfig | 7 ++++++ boards/dptechnics/walter/Kconfig.defconfig | 20 ---------------- boards/espressif/esp32_devkitc_wroom/Kconfig | 7 ++++++ .../esp32_devkitc_wroom/Kconfig.defconfig | 19 --------------- boards/espressif/esp32_devkitc_wrover/Kconfig | 7 ++++++ .../esp32_devkitc_wrover/Kconfig.defconfig | 17 -------------- boards/espressif/esp32_ethernet_kit/Kconfig | 7 ++++++ .../esp32_ethernet_kit/Kconfig.defconfig | 11 --------- .../{Kconfig.defconfig => Kconfig} | 4 +--- .../Kconfig} | 3 --- .../esp32c3_devkitm/Kconfig.defconfig | 11 --------- .../Kconfig} | 5 ---- boards/espressif/esp32c6_devkitc/Kconfig | 6 +++++ boards/espressif/esp32s2_devkitc/Kconfig | 6 +++++ .../esp32s2_devkitc/Kconfig.defconfig | 4 ---- boards/espressif/esp32s2_saola/Kconfig | 6 +++++ .../espressif/esp32s2_saola/Kconfig.defconfig | 4 ---- boards/espressif/esp32s3_devkitc/Kconfig | 7 ++++++ .../esp32s3_devkitc/Kconfig.defconfig | 19 --------------- boards/espressif/esp32s3_devkitm/Kconfig | 7 ++++++ .../esp32s3_devkitm/Kconfig.defconfig | 19 --------------- boards/espressif/esp32s3_eye/Kconfig | 7 ++++++ .../espressif/esp32s3_eye/Kconfig.defconfig | 14 ----------- boards/espressif/esp8684_devkitm/Kconfig | 6 +++++ boards/espressif/esp_wrover_kit/Kconfig | 7 ++++++ .../esp_wrover_kit/Kconfig.defconfig | 11 --------- .../franzininho/esp32s2_franzininho/Kconfig | 6 +++++ .../esp32s2_franzininho/Kconfig.defconfig | 5 ---- boards/hardkernel/odroid_go/Kconfig | 7 ++++++ boards/hardkernel/odroid_go/Kconfig.defconfig | 14 ----------- boards/heltec/heltec_wifi_lora32_v2/Kconfig | 7 ++++++ .../heltec_wifi_lora32_v2/Kconfig.defconfig | 22 ------------------ .../heltec_wireless_stick_lite_v3/Kconfig | 7 ++++++ .../Kconfig.defconfig | 23 ------------------- boards/kincony/kincony_kc868_a32/Kconfig | 7 ++++++ .../kincony_kc868_a32/Kconfig.defconfig | 20 ---------------- boards/lilygo/ttgo_lora32/Kconfig | 7 ++++++ boards/lilygo/ttgo_lora32/Kconfig.defconfig | 14 ----------- boards/lilygo/ttgo_t8c3/Kconfig | 6 +++++ boards/lilygo/ttgo_t8c3/Kconfig.defconfig | 9 -------- boards/luatos/esp32c3_luatos_core/Kconfig | 6 +++++ .../esp32c3_luatos_core/Kconfig.defconfig | 11 --------- boards/luatos/esp32s3_luatos_core/Kconfig | 7 ++++++ .../esp32s3_luatos_core/Kconfig.defconfig | 22 ------------------ boards/m5stack/m5stack_atom_lite/Kconfig | 7 ++++++ .../m5stack_atom_lite/Kconfig.defconfig | 22 ------------------ boards/m5stack/m5stack_atoms3/Kconfig | 7 ++++++ .../m5stack/m5stack_atoms3/Kconfig.defconfig | 14 ----------- boards/m5stack/m5stack_atoms3_lite/Kconfig | 7 ++++++ .../m5stack_atoms3_lite/Kconfig.defconfig | 14 ----------- boards/m5stack/m5stack_core2/Kconfig | 7 ++++++ .../m5stack/m5stack_core2/Kconfig.defconfig | 14 ----------- boards/m5stack/m5stack_stamps3/Kconfig | 7 ++++++ .../m5stack/m5stack_stamps3/Kconfig.defconfig | 14 ----------- boards/m5stack/m5stickc_plus/Kconfig | 7 ++++++ .../m5stack/m5stickc_plus/Kconfig.defconfig | 14 ----------- .../stamp_c3/{Kconfig.defconfig => Kconfig} | 5 ---- boards/olimex/olimex_esp32_evb/Kconfig | 7 ++++++ .../olimex/olimex_esp32_evb/Kconfig.defconfig | 22 ------------------ .../{Kconfig.defconfig => Kconfig} | 3 --- boards/seeed/xiao_esp32c3/Kconfig | 6 +++++ boards/seeed/xiao_esp32c3/Kconfig.defconfig | 9 -------- boards/seeed/xiao_esp32s3/Kconfig | 7 ++++++ boards/seeed/xiao_esp32s3/Kconfig.defconfig | 20 ---------------- boards/vcc-gnd/yd_esp32/Kconfig | 7 ++++++ boards/vcc-gnd/yd_esp32/Kconfig.defconfig | 22 ------------------ .../waveshare/esp32s3_touch_lcd_1_28/Kconfig | 7 +++--- .../esp32s3_touch_lcd_1_28/Kconfig.defconfig | 18 ++------------- .../Kconfig.esp32s3_touch_lcd_1_28 | 2 ++ boards/wemos/esp32s2_lolin_mini/Kconfig | 6 +++++ .../esp32s2_lolin_mini/Kconfig.defconfig | 5 ---- 73 files changed, 225 insertions(+), 509 deletions(-) rename boards/{espressif/esp8684_devkitm/Kconfig.defconfig => 01space/esp32c3_042_oled/Kconfig} (72%) delete mode 100644 boards/01space/esp32c3_042_oled/Kconfig.defconfig create mode 100644 boards/dptechnics/walter/Kconfig delete mode 100644 boards/dptechnics/walter/Kconfig.defconfig create mode 100644 boards/espressif/esp32_devkitc_wroom/Kconfig delete mode 100644 boards/espressif/esp32_devkitc_wroom/Kconfig.defconfig create mode 100644 boards/espressif/esp32_devkitc_wrover/Kconfig delete mode 100644 boards/espressif/esp32_devkitc_wrover/Kconfig.defconfig create mode 100644 boards/espressif/esp32_ethernet_kit/Kconfig rename boards/espressif/esp32c3_devkitc/{Kconfig.defconfig => Kconfig} (72%) rename boards/espressif/{esp32c3_rust/Kconfig.defconfig => esp32c3_devkitm/Kconfig} (67%) delete mode 100644 boards/espressif/esp32c3_devkitm/Kconfig.defconfig rename boards/espressif/{esp32c6_devkitc/Kconfig.defconfig => esp32c3_rust/Kconfig} (57%) create mode 100644 boards/espressif/esp32c6_devkitc/Kconfig create mode 100644 boards/espressif/esp32s2_devkitc/Kconfig create mode 100644 boards/espressif/esp32s2_saola/Kconfig create mode 100644 boards/espressif/esp32s3_devkitc/Kconfig delete mode 100644 boards/espressif/esp32s3_devkitc/Kconfig.defconfig create mode 100644 boards/espressif/esp32s3_devkitm/Kconfig delete mode 100644 boards/espressif/esp32s3_devkitm/Kconfig.defconfig create mode 100644 boards/espressif/esp32s3_eye/Kconfig create mode 100644 boards/espressif/esp8684_devkitm/Kconfig create mode 100644 boards/espressif/esp_wrover_kit/Kconfig create mode 100644 boards/franzininho/esp32s2_franzininho/Kconfig create mode 100644 boards/hardkernel/odroid_go/Kconfig create mode 100644 boards/heltec/heltec_wifi_lora32_v2/Kconfig delete mode 100644 boards/heltec/heltec_wifi_lora32_v2/Kconfig.defconfig create mode 100644 boards/heltec/heltec_wireless_stick_lite_v3/Kconfig delete mode 100644 boards/heltec/heltec_wireless_stick_lite_v3/Kconfig.defconfig create mode 100644 boards/kincony/kincony_kc868_a32/Kconfig delete mode 100644 boards/kincony/kincony_kc868_a32/Kconfig.defconfig create mode 100644 boards/lilygo/ttgo_lora32/Kconfig create mode 100644 boards/lilygo/ttgo_t8c3/Kconfig delete mode 100644 boards/lilygo/ttgo_t8c3/Kconfig.defconfig create mode 100644 boards/luatos/esp32c3_luatos_core/Kconfig delete mode 100644 boards/luatos/esp32c3_luatos_core/Kconfig.defconfig create mode 100644 boards/luatos/esp32s3_luatos_core/Kconfig delete mode 100644 boards/luatos/esp32s3_luatos_core/Kconfig.defconfig create mode 100644 boards/m5stack/m5stack_atom_lite/Kconfig delete mode 100644 boards/m5stack/m5stack_atom_lite/Kconfig.defconfig create mode 100644 boards/m5stack/m5stack_atoms3/Kconfig create mode 100644 boards/m5stack/m5stack_atoms3_lite/Kconfig create mode 100644 boards/m5stack/m5stack_core2/Kconfig create mode 100644 boards/m5stack/m5stack_stamps3/Kconfig create mode 100644 boards/m5stack/m5stickc_plus/Kconfig rename boards/m5stack/stamp_c3/{Kconfig.defconfig => Kconfig} (57%) create mode 100644 boards/olimex/olimex_esp32_evb/Kconfig delete mode 100644 boards/olimex/olimex_esp32_evb/Kconfig.defconfig rename boards/others/icev_wireless/{Kconfig.defconfig => Kconfig} (68%) create mode 100644 boards/seeed/xiao_esp32c3/Kconfig delete mode 100644 boards/seeed/xiao_esp32c3/Kconfig.defconfig create mode 100644 boards/seeed/xiao_esp32s3/Kconfig delete mode 100644 boards/seeed/xiao_esp32s3/Kconfig.defconfig create mode 100644 boards/vcc-gnd/yd_esp32/Kconfig delete mode 100644 boards/vcc-gnd/yd_esp32/Kconfig.defconfig create mode 100644 boards/wemos/esp32s2_lolin_mini/Kconfig diff --git a/boards/espressif/esp8684_devkitm/Kconfig.defconfig b/boards/01space/esp32c3_042_oled/Kconfig similarity index 72% rename from boards/espressif/esp8684_devkitm/Kconfig.defconfig rename to boards/01space/esp32c3_042_oled/Kconfig index 1d2813b0bc19d..c6a99b1032dc7 100644 --- a/boards/espressif/esp8684_devkitm/Kconfig.defconfig +++ b/boards/01space/esp32c3_042_oled/Kconfig @@ -1,8 +1,6 @@ -# ESP8684 devkitm board configuration - # Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. # SPDX-License-Identifier: Apache-2.0 config HEAP_MEM_POOL_ADD_SIZE_BOARD int - default 8192 + default 4096 diff --git a/boards/01space/esp32c3_042_oled/Kconfig.defconfig b/boards/01space/esp32c3_042_oled/Kconfig.defconfig deleted file mode 100644 index 4171bb04bc276..0000000000000 --- a/boards/01space/esp32c3_042_oled/Kconfig.defconfig +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright 2022 Google LLC -# SPDX-License-Identifier: Apache-2.0 - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 diff --git a/boards/dptechnics/walter/Kconfig b/boards/dptechnics/walter/Kconfig new file mode 100644 index 0000000000000..37d9291d13fa6 --- /dev/null +++ b/boards/dptechnics/walter/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_WALTER_ESP32S3_PROCPU + default 256 if BOARD_WALTER_ESP32S3_APPCPU diff --git a/boards/dptechnics/walter/Kconfig.defconfig b/boards/dptechnics/walter/Kconfig.defconfig deleted file mode 100644 index 642988e72fe89..0000000000000 --- a/boards/dptechnics/walter/Kconfig.defconfig +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) 2024 DPTechnics bv -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_WALTER_ESP32S3_PROCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 - -endif # BOARD_WALTER_ESP32S3_PROCPU - -if BOARD_WALTER_ESP32S3_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 256 - -endif # BOARD_WALTER_ESP32S3_APPCPU diff --git a/boards/espressif/esp32_devkitc_wroom/Kconfig b/boards/espressif/esp32_devkitc_wroom/Kconfig new file mode 100644 index 0000000000000..391149964122a --- /dev/null +++ b/boards/espressif/esp32_devkitc_wroom/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_ESP32_DEVKITC_WROOM_ESP32_PROCPU + default 256 if BOARD_ESP32_DEVKITC_WROOM_ESP32_APPCPU diff --git a/boards/espressif/esp32_devkitc_wroom/Kconfig.defconfig b/boards/espressif/esp32_devkitc_wroom/Kconfig.defconfig deleted file mode 100644 index 94d147b529f5b..0000000000000 --- a/boards/espressif/esp32_devkitc_wroom/Kconfig.defconfig +++ /dev/null @@ -1,19 +0,0 @@ -# ESP32 board configuration - -# Copyright (c) 2017 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_ESP32_DEVKITC_WROOM_ESP32_PROCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 8192 - -endif # BOARD_ESP32_DEVKITC_WROOM_ESP32_PROCPU - -if BOARD_ESP32_DEVKITC_WROOM_ESP32_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 4096 - -endif # BOARD_ESP32_DEVKITC_WROOM_ESP32_APPCPU diff --git a/boards/espressif/esp32_devkitc_wrover/Kconfig b/boards/espressif/esp32_devkitc_wrover/Kconfig new file mode 100644 index 0000000000000..6442ca4727915 --- /dev/null +++ b/boards/espressif/esp32_devkitc_wrover/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_ESP32_DEVKITC_WROVER_ESP32_PROCPU + default 256 if BOARD_ESP32_DEVKITC_WROVER_ESP32_APPCPU diff --git a/boards/espressif/esp32_devkitc_wrover/Kconfig.defconfig b/boards/espressif/esp32_devkitc_wrover/Kconfig.defconfig deleted file mode 100644 index a5f2c065833ba..0000000000000 --- a/boards/espressif/esp32_devkitc_wrover/Kconfig.defconfig +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2023 Espressif Systems (Shanghai) Co., Ltd. -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_ESP32_DEVKITC_WROVER_ESP32_PROCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 8192 - -endif # BOARD_ESP32_DEVKITC_WROVER_ESP32_PROCPU - -if BOARD_ESP32_DEVKITC_WROVER_ESP32_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 4096 - -endif # BOARD_ESP32_DEVKITC_WROVER_ESP32_APPCPU diff --git a/boards/espressif/esp32_ethernet_kit/Kconfig b/boards/espressif/esp32_ethernet_kit/Kconfig new file mode 100644 index 0000000000000..a6297194caf5d --- /dev/null +++ b/boards/espressif/esp32_ethernet_kit/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_ESP32_ETHERNET_KIT_ESP32_PROCPU + default 256 if BOARD_ESP32_ETHERNET_KIT_ESP32_APPCPU diff --git a/boards/espressif/esp32_ethernet_kit/Kconfig.defconfig b/boards/espressif/esp32_ethernet_kit/Kconfig.defconfig index b3e17cd8c4e99..5a36768659d38 100644 --- a/boards/espressif/esp32_ethernet_kit/Kconfig.defconfig +++ b/boards/espressif/esp32_ethernet_kit/Kconfig.defconfig @@ -12,15 +12,4 @@ choice SPIRAM_TYPE default SPIRAM_TYPE_ESPPSRAM64 endchoice -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 8192 - endif # BOARD_ESP32_ETHERNET_KIT_ESP32_PROCPU - -if BOARD_ESP32_ETHERNET_KIT_ESP32_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 4096 - -endif # BOARD_ESP32_ETHERNET_KIT_ESP32_APPCPU diff --git a/boards/espressif/esp32c3_devkitc/Kconfig.defconfig b/boards/espressif/esp32c3_devkitc/Kconfig similarity index 72% rename from boards/espressif/esp32c3_devkitc/Kconfig.defconfig rename to boards/espressif/esp32c3_devkitc/Kconfig index aa8bed9c1e23c..c6a99b1032dc7 100644 --- a/boards/espressif/esp32c3_devkitc/Kconfig.defconfig +++ b/boards/espressif/esp32c3_devkitc/Kconfig @@ -1,8 +1,6 @@ -# ESP32C3 devkitc board configuration - # Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. # SPDX-License-Identifier: Apache-2.0 config HEAP_MEM_POOL_ADD_SIZE_BOARD int - default 8192 + default 4096 diff --git a/boards/espressif/esp32c3_rust/Kconfig.defconfig b/boards/espressif/esp32c3_devkitm/Kconfig similarity index 67% rename from boards/espressif/esp32c3_rust/Kconfig.defconfig rename to boards/espressif/esp32c3_devkitm/Kconfig index 77418527f48ad..c6a99b1032dc7 100644 --- a/boards/espressif/esp32c3_rust/Kconfig.defconfig +++ b/boards/espressif/esp32c3_devkitm/Kconfig @@ -3,7 +3,4 @@ config HEAP_MEM_POOL_ADD_SIZE_BOARD int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT default 4096 diff --git a/boards/espressif/esp32c3_devkitm/Kconfig.defconfig b/boards/espressif/esp32c3_devkitm/Kconfig.defconfig deleted file mode 100644 index cf5aeac8382d0..0000000000000 --- a/boards/espressif/esp32c3_devkitm/Kconfig.defconfig +++ /dev/null @@ -1,11 +0,0 @@ -# ESP32C3 devkitm board configuration - -# Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd. -# SPDX-License-Identifier: Apache-2.0 - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 diff --git a/boards/espressif/esp32c6_devkitc/Kconfig.defconfig b/boards/espressif/esp32c3_rust/Kconfig similarity index 57% rename from boards/espressif/esp32c6_devkitc/Kconfig.defconfig rename to boards/espressif/esp32c3_rust/Kconfig index fccfb36845b2b..c6a99b1032dc7 100644 --- a/boards/espressif/esp32c6_devkitc/Kconfig.defconfig +++ b/boards/espressif/esp32c3_rust/Kconfig @@ -1,11 +1,6 @@ -# ESP32C6 devkitc board configuration - # Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. # SPDX-License-Identifier: Apache-2.0 config HEAP_MEM_POOL_ADD_SIZE_BOARD int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT default 4096 diff --git a/boards/espressif/esp32c6_devkitc/Kconfig b/boards/espressif/esp32c6_devkitc/Kconfig new file mode 100644 index 0000000000000..c6a99b1032dc7 --- /dev/null +++ b/boards/espressif/esp32c6_devkitc/Kconfig @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 diff --git a/boards/espressif/esp32s2_devkitc/Kconfig b/boards/espressif/esp32s2_devkitc/Kconfig new file mode 100644 index 0000000000000..c6a99b1032dc7 --- /dev/null +++ b/boards/espressif/esp32s2_devkitc/Kconfig @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 diff --git a/boards/espressif/esp32s2_devkitc/Kconfig.defconfig b/boards/espressif/esp32s2_devkitc/Kconfig.defconfig index e4ef6b1c24a72..c7fa706256161 100644 --- a/boards/espressif/esp32s2_devkitc/Kconfig.defconfig +++ b/boards/espressif/esp32s2_devkitc/Kconfig.defconfig @@ -5,7 +5,3 @@ config ENTROPY_GENERATOR default y - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 8192 diff --git a/boards/espressif/esp32s2_saola/Kconfig b/boards/espressif/esp32s2_saola/Kconfig new file mode 100644 index 0000000000000..c6a99b1032dc7 --- /dev/null +++ b/boards/espressif/esp32s2_saola/Kconfig @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 diff --git a/boards/espressif/esp32s2_saola/Kconfig.defconfig b/boards/espressif/esp32s2_saola/Kconfig.defconfig index 2126b0a5979ea..ffa2b0d832cc4 100644 --- a/boards/espressif/esp32s2_saola/Kconfig.defconfig +++ b/boards/espressif/esp32s2_saola/Kconfig.defconfig @@ -5,7 +5,3 @@ config ENTROPY_GENERATOR default y - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 8192 diff --git a/boards/espressif/esp32s3_devkitc/Kconfig b/boards/espressif/esp32s3_devkitc/Kconfig new file mode 100644 index 0000000000000..308628a427342 --- /dev/null +++ b/boards/espressif/esp32s3_devkitc/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_ESP32S3_DEVKITC_ESP32S3_PROCPU + default 256 if BOARD_ESP32S3_DEVKITC_ESP32S3_APPCPU diff --git a/boards/espressif/esp32s3_devkitc/Kconfig.defconfig b/boards/espressif/esp32s3_devkitc/Kconfig.defconfig deleted file mode 100644 index 80ccffe84ffc6..0000000000000 --- a/boards/espressif/esp32s3_devkitc/Kconfig.defconfig +++ /dev/null @@ -1,19 +0,0 @@ -# ESP32S3 DevKitC board configuration - -# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_ESP32S3_DEVKITC_ESP32S3_PROCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 4096 - -endif # BOARD_ESP32S3_DEVKITC_ESP32S3_PROCPU - -if BOARD_ESP32S3_DEVKITC_ESP32S3_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 256 - -endif # BOARD_ESP32S3_DEVKITC_ESP32S3_APPCPU diff --git a/boards/espressif/esp32s3_devkitm/Kconfig b/boards/espressif/esp32s3_devkitm/Kconfig new file mode 100644 index 0000000000000..84e633e5af22b --- /dev/null +++ b/boards/espressif/esp32s3_devkitm/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_ESP32S3_DEVKITM_ESP32S3_PROCPU + default 256 if BOARD_ESP32S3_DEVKITM_ESP32S3_APPCPU diff --git a/boards/espressif/esp32s3_devkitm/Kconfig.defconfig b/boards/espressif/esp32s3_devkitm/Kconfig.defconfig deleted file mode 100644 index 5438681fcdfde..0000000000000 --- a/boards/espressif/esp32s3_devkitm/Kconfig.defconfig +++ /dev/null @@ -1,19 +0,0 @@ -# ESP32S3 DevKitM board configuration - -# Copyright (c) 2022 Espressif Systems (Shanghai) Co., Ltd. -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_ESP32S3_DEVKITM_ESP32S3_PROCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 4096 - -endif # BOARD_ESP32S3_DEVKITM_ESP32S3_PROCPU - -if BOARD_ESP32S3_DEVKITM_ESP32S3_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 256 - -endif # BOARD_ESP32S3_DEVKITM_ESP32S3_APPCPU diff --git a/boards/espressif/esp32s3_eye/Kconfig b/boards/espressif/esp32s3_eye/Kconfig new file mode 100644 index 0000000000000..25042fa0ce105 --- /dev/null +++ b/boards/espressif/esp32s3_eye/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_ESP32S3_EYE_ESP32S3_PROCPU + default 256 if BOARD_ESP32S3_EYE_ESP32S3_APPCPU diff --git a/boards/espressif/esp32s3_eye/Kconfig.defconfig b/boards/espressif/esp32s3_eye/Kconfig.defconfig index 71c7374e09593..d20cfdecdc2a4 100644 --- a/boards/espressif/esp32s3_eye/Kconfig.defconfig +++ b/boards/espressif/esp32s3_eye/Kconfig.defconfig @@ -8,18 +8,4 @@ if BOARD_ESP32S3_EYE_ESP32S3_PROCPU config LV_COLOR_16_SWAP default y -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 - endif # BOARD_ESP32S3_EYE_ESP32S3_PROCPU - -if BOARD_ESP32S3_EYE_ESP32S3_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 256 - -endif # BOARD_ESP32S3_EYE_ESP32S3_APPCPU diff --git a/boards/espressif/esp8684_devkitm/Kconfig b/boards/espressif/esp8684_devkitm/Kconfig new file mode 100644 index 0000000000000..c6a99b1032dc7 --- /dev/null +++ b/boards/espressif/esp8684_devkitm/Kconfig @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 diff --git a/boards/espressif/esp_wrover_kit/Kconfig b/boards/espressif/esp_wrover_kit/Kconfig new file mode 100644 index 0000000000000..64997988d512c --- /dev/null +++ b/boards/espressif/esp_wrover_kit/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_ESP_WROVER_KIT_ESP32_PROCPU + default 256 if BOARD_ESP_WROVER_KIT_ESP32_APPCPU diff --git a/boards/espressif/esp_wrover_kit/Kconfig.defconfig b/boards/espressif/esp_wrover_kit/Kconfig.defconfig index 84228983f4eb4..3fed00825a383 100644 --- a/boards/espressif/esp_wrover_kit/Kconfig.defconfig +++ b/boards/espressif/esp_wrover_kit/Kconfig.defconfig @@ -5,18 +5,7 @@ if BOARD_ESP_WROVER_KIT_ESP32_PROCPU -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 8192 - config DISK_DRIVER_SDMMC default y endif # BOARD_ESP_WROVER_KIT_ESP32_PROCPU - -if BOARD_ESP_WROVER_KIT_ESP32_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 4096 - -endif # BOARD_ESP_WROVER_KIT_ESP32_APPCPU diff --git a/boards/franzininho/esp32s2_franzininho/Kconfig b/boards/franzininho/esp32s2_franzininho/Kconfig new file mode 100644 index 0000000000000..c6a99b1032dc7 --- /dev/null +++ b/boards/franzininho/esp32s2_franzininho/Kconfig @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 diff --git a/boards/franzininho/esp32s2_franzininho/Kconfig.defconfig b/boards/franzininho/esp32s2_franzininho/Kconfig.defconfig index 7bf6f84463b1e..257328f1c0a5e 100644 --- a/boards/franzininho/esp32s2_franzininho/Kconfig.defconfig +++ b/boards/franzininho/esp32s2_franzininho/Kconfig.defconfig @@ -5,8 +5,3 @@ config ENTROPY_GENERATOR default y - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 32768 if WIFI - default 4096 diff --git a/boards/hardkernel/odroid_go/Kconfig b/boards/hardkernel/odroid_go/Kconfig new file mode 100644 index 0000000000000..6327490e226b9 --- /dev/null +++ b/boards/hardkernel/odroid_go/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_ODROID_GO_ESP32_PROCPU + default 256 if BOARD_ODROID_GO_ESP32_APPCPU diff --git a/boards/hardkernel/odroid_go/Kconfig.defconfig b/boards/hardkernel/odroid_go/Kconfig.defconfig index 121f6e6939713..cbc16ebc7887c 100644 --- a/boards/hardkernel/odroid_go/Kconfig.defconfig +++ b/boards/hardkernel/odroid_go/Kconfig.defconfig @@ -18,18 +18,4 @@ choice SPIRAM_TYPE default SPIRAM_TYPE_ESPPSRAM32 endchoice -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 - endif # BOARD_ODROID_GO_ESP32_PROCPU - -if BOARD_ODROID_GO_ESP32_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 4096 - -endif # BOARD_ODROID_GO_ESP32_APPCPU diff --git a/boards/heltec/heltec_wifi_lora32_v2/Kconfig b/boards/heltec/heltec_wifi_lora32_v2/Kconfig new file mode 100644 index 0000000000000..dccd74430a55b --- /dev/null +++ b/boards/heltec/heltec_wifi_lora32_v2/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_HELTEC_WIFI_LORA32_V2_ESP32_PROCPU + default 256 if BOARD_HELTEC_WIFI_LORA32_V2_ESP32_APPCPU diff --git a/boards/heltec/heltec_wifi_lora32_v2/Kconfig.defconfig b/boards/heltec/heltec_wifi_lora32_v2/Kconfig.defconfig deleted file mode 100644 index a2979499b658f..0000000000000 --- a/boards/heltec/heltec_wifi_lora32_v2/Kconfig.defconfig +++ /dev/null @@ -1,22 +0,0 @@ -# HELTEC board configuration - -# Copyright (c) 2021 Instituto de Pesquisas Eldorado (eldorado.org.br) -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_HELTEC_WIFI_LORA32_V2_ESP32_PROCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 - -endif # BOARD_HELTEC_WIFI_LORA32_V2_ESP32_PROCPU - -if BOARD_HELTEC_WIFI_LORA32_V2_ESP32_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 256 - -endif # BOARD_HELTEC_WIFI_LORA_V2_ESP32_APPCPU diff --git a/boards/heltec/heltec_wireless_stick_lite_v3/Kconfig b/boards/heltec/heltec_wireless_stick_lite_v3/Kconfig new file mode 100644 index 0000000000000..b84cf42142c87 --- /dev/null +++ b/boards/heltec/heltec_wireless_stick_lite_v3/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_HELTEC_WIRELESS_STICK_LITE_V3_ESP32S3_PROCPU + default 256 if BOARD_HELTEC_WIRELESS_STICK_LITE_V3_ESP32S3_PROCPU diff --git a/boards/heltec/heltec_wireless_stick_lite_v3/Kconfig.defconfig b/boards/heltec/heltec_wireless_stick_lite_v3/Kconfig.defconfig deleted file mode 100644 index c1aa6f030c767..0000000000000 --- a/boards/heltec/heltec_wireless_stick_lite_v3/Kconfig.defconfig +++ /dev/null @@ -1,23 +0,0 @@ -# Heltec Wireless Stick Lite (V3) board configuration - -# Copyright (c) 2021 Instituto de Pesquisas Eldorado (eldorado.org.br) -# Copyright (c) 2023 The Zephyr Project Contributors -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_HELTEC_WIRELESS_STICK_LITE_V3_ESP32S3_PROCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 - -endif # BOARD_HELTEC_WIRELESS_STICK_LITE_V3_ESP32S3_PROCPU - -if BOARD_HELTEC_WIRELESS_STICK_LITE_V3_ESP32S3_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 256 - -endif # BOARD_HELTEC_WIRELESS_STICK_LITE_V3_ESP32S3_APPCPU diff --git a/boards/kincony/kincony_kc868_a32/Kconfig b/boards/kincony/kincony_kc868_a32/Kconfig new file mode 100644 index 0000000000000..19cad2072fe4c --- /dev/null +++ b/boards/kincony/kincony_kc868_a32/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_KINCONY_KC868_A32_ESP32_PROCPU + default 256 if BOARD_KINCONY_KC868_A32_ESP32_APPCPU diff --git a/boards/kincony/kincony_kc868_a32/Kconfig.defconfig b/boards/kincony/kincony_kc868_a32/Kconfig.defconfig deleted file mode 100644 index 4d4613b36ad53..0000000000000 --- a/boards/kincony/kincony_kc868_a32/Kconfig.defconfig +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) 2023 Bartosz Bilas -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_KINCONY_KC868_A32_ESP32_PROCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 - -endif # BOARD_KINCONY_KC868_A32_ESP32_PROCPU - -if BOARD_KINCONY_KC868_A32_ESP32_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 256 - -endif # BOARD_KINCONY_KC868_A32_ESP32_APPCPU diff --git a/boards/lilygo/ttgo_lora32/Kconfig b/boards/lilygo/ttgo_lora32/Kconfig new file mode 100644 index 0000000000000..2b26ea33689f7 --- /dev/null +++ b/boards/lilygo/ttgo_lora32/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_TTGO_LORA32_ESP32_PROCPU + default 256 if BOARD_TTGO_LORA32_ESP32_APPCPU diff --git a/boards/lilygo/ttgo_lora32/Kconfig.defconfig b/boards/lilygo/ttgo_lora32/Kconfig.defconfig index d77a95c89b076..228856d043612 100644 --- a/boards/lilygo/ttgo_lora32/Kconfig.defconfig +++ b/boards/lilygo/ttgo_lora32/Kconfig.defconfig @@ -8,18 +8,4 @@ if BOARD_TTGO_LORA32_ESP32_PROCPU config ENTROPY_GENERATOR default y -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 - endif # BOARD_TTGO_LORA32_ESP32_PROCPU - -if BOARD_TTGO_LORA32_ESP32_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 256 - -endif # BOARD_TTGO_LORA32_ESP32_APPCPU diff --git a/boards/lilygo/ttgo_t8c3/Kconfig b/boards/lilygo/ttgo_t8c3/Kconfig new file mode 100644 index 0000000000000..c6a99b1032dc7 --- /dev/null +++ b/boards/lilygo/ttgo_t8c3/Kconfig @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 diff --git a/boards/lilygo/ttgo_t8c3/Kconfig.defconfig b/boards/lilygo/ttgo_t8c3/Kconfig.defconfig deleted file mode 100644 index eb2f107cd0d3e..0000000000000 --- a/boards/lilygo/ttgo_t8c3/Kconfig.defconfig +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2024 Lothar Felten -# SPDX-License-Identifier: Apache-2.0 - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 diff --git a/boards/luatos/esp32c3_luatos_core/Kconfig b/boards/luatos/esp32c3_luatos_core/Kconfig new file mode 100644 index 0000000000000..c6a99b1032dc7 --- /dev/null +++ b/boards/luatos/esp32c3_luatos_core/Kconfig @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 diff --git a/boards/luatos/esp32c3_luatos_core/Kconfig.defconfig b/boards/luatos/esp32c3_luatos_core/Kconfig.defconfig deleted file mode 100644 index f6ad1adaa1cb9..0000000000000 --- a/boards/luatos/esp32c3_luatos_core/Kconfig.defconfig +++ /dev/null @@ -1,11 +0,0 @@ -# ESP32C3 core board configuration - -# Copyright (c) 2023 YuLong Yao -# SPDX-License-Identifier: Apache-2.0 - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 diff --git a/boards/luatos/esp32s3_luatos_core/Kconfig b/boards/luatos/esp32s3_luatos_core/Kconfig new file mode 100644 index 0000000000000..a4565c096ca6f --- /dev/null +++ b/boards/luatos/esp32s3_luatos_core/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_ESP32S3_LUATOS_CORE_ESP32S3_PROCPU || BOARD_ESP32S3_LUATOS_CORE_ESP32S3_PROCPU_USB + default 256 if BOARD_ESP32S3_LUATOS_CORE_ESP32S3_APPCPU || BOARD_ESP32S3_LUATOS_CORE_ESP32S3_APPCPU_USB diff --git a/boards/luatos/esp32s3_luatos_core/Kconfig.defconfig b/boards/luatos/esp32s3_luatos_core/Kconfig.defconfig deleted file mode 100644 index a14482e325d1c..0000000000000 --- a/boards/luatos/esp32s3_luatos_core/Kconfig.defconfig +++ /dev/null @@ -1,22 +0,0 @@ -# ESP32S3 Core board configuration - -# Copyright (c) 2023 YuLong Yao -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_ESP32S3_LUATOS_CORE_ESP32S3_PROCPU || BOARD_ESP32S3_LUATOS_CORE_ESP32S3_PROCPU_USB - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 - -endif # BOARD_ESP32S3_LUATOS_CORE_ESP32S3_PROCPU || BOARD_ESP32S3_LUATOS_CORE_ESP32S3_PROCPU_USB - -if BOARD_ESP32S3_LUATOS_CORE_ESP32S3_APPCPU || BOARD_ESP32S3_LUATOS_CORE_ESP32S3_APPCPU_USB - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 256 - -endif # BOARD_ESP32S3_LUATOS_CORE_ESP32S3_APPCPU || BOARD_ESP32S3_LUATOS_CORE_ESP32S3_APPCPU_USB diff --git a/boards/m5stack/m5stack_atom_lite/Kconfig b/boards/m5stack/m5stack_atom_lite/Kconfig new file mode 100644 index 0000000000000..5afa40f9dd4dd --- /dev/null +++ b/boards/m5stack/m5stack_atom_lite/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_M5STACK_ATOM_LITE_ESP32_PROCPU + default 256 if BOARD_M5STACK_ATOM_LITE_ESP32_APPCPU diff --git a/boards/m5stack/m5stack_atom_lite/Kconfig.defconfig b/boards/m5stack/m5stack_atom_lite/Kconfig.defconfig deleted file mode 100644 index 2b223f5409bed..0000000000000 --- a/boards/m5stack/m5stack_atom_lite/Kconfig.defconfig +++ /dev/null @@ -1,22 +0,0 @@ -# M5Stack ATOM Lite board configuration -# Copyright (c) 2023 Benjamin Cabé -# Copyright (c) 2022 AVSystem Sławomir Wolf Sp.j. (AVSystem) -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_M5STACK_ATOM_LITE_ESP32_PROCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 - -endif # BOARD_M5STACK_ATOM_LITE_ESP32_PROCPU - -if BOARD_M5STACK_ATOM_LITE_ESP32_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 256 - -endif # BOARD_M5STACK_ATOM_LITE_ESP32_APPCPU diff --git a/boards/m5stack/m5stack_atoms3/Kconfig b/boards/m5stack/m5stack_atoms3/Kconfig new file mode 100644 index 0000000000000..e52b7a65c6db3 --- /dev/null +++ b/boards/m5stack/m5stack_atoms3/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_M5STACK_ATOMS3_ESP32S3_PROCPU + default 256 if BOARD_M5STACK_ATOMS3_ESP32S3_APPCPU diff --git a/boards/m5stack/m5stack_atoms3/Kconfig.defconfig b/boards/m5stack/m5stack_atoms3/Kconfig.defconfig index f3b59178417ce..c2f7345a9a8fe 100644 --- a/boards/m5stack/m5stack_atoms3/Kconfig.defconfig +++ b/boards/m5stack/m5stack_atoms3/Kconfig.defconfig @@ -7,18 +7,4 @@ if BOARD_M5STACK_ATOMS3_ESP32S3_PROCPU config LV_COLOR_16_SWAP default y if LVGL -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 - endif # BOARD_M5STACK_ATOMS3_ESP32S3_PROCPU - -if BOARD_M5STACK_ATOMS3_ESP32S3_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 256 - -endif # BOARD_M5STACK_ATOMS3_ESP32S3_APPCPU diff --git a/boards/m5stack/m5stack_atoms3_lite/Kconfig b/boards/m5stack/m5stack_atoms3_lite/Kconfig new file mode 100644 index 0000000000000..acb26cf799c0f --- /dev/null +++ b/boards/m5stack/m5stack_atoms3_lite/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_M5STACK_ATOMS3_LITE_ESP32S3_PROCPU + default 256 if BOARD_M5STACK_ATOMS3_LITE_ESP32S3_APPCPU diff --git a/boards/m5stack/m5stack_atoms3_lite/Kconfig.defconfig b/boards/m5stack/m5stack_atoms3_lite/Kconfig.defconfig index f0f262cd1f3a6..6934b4e9a4ea7 100644 --- a/boards/m5stack/m5stack_atoms3_lite/Kconfig.defconfig +++ b/boards/m5stack/m5stack_atoms3_lite/Kconfig.defconfig @@ -4,21 +4,7 @@ if BOARD_M5STACK_ATOMS3_LITE_ESP32S3_PROCPU -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 - config KERNEL_MEM_POOL default y endif # BOARD_M5STACK_ATOMS3_LITE_ESP32S3_PROCPU - -if BOARD_M5STACK_ATOMS3_LITE_ESP32S3_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 256 - -endif # BOARD_M5STACK_ATOMS3_LITE_ESP32S3_APPCPU diff --git a/boards/m5stack/m5stack_core2/Kconfig b/boards/m5stack/m5stack_core2/Kconfig new file mode 100644 index 0000000000000..30f3630e07fc4 --- /dev/null +++ b/boards/m5stack/m5stack_core2/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_M5STACK_CORE2_ESP32_PROCPU + default 256 if BOARD_M5STACK_CORE2_ESP32_APPCPU diff --git a/boards/m5stack/m5stack_core2/Kconfig.defconfig b/boards/m5stack/m5stack_core2/Kconfig.defconfig index fd9614d6cbbfb..21b7a6b12a821 100644 --- a/boards/m5stack/m5stack_core2/Kconfig.defconfig +++ b/boards/m5stack/m5stack_core2/Kconfig.defconfig @@ -5,13 +5,6 @@ if BOARD_M5STACK_CORE2_ESP32_PROCPU -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 65536 if BT - default 4096 - config KERNEL_MEM_POOL default y @@ -49,10 +42,3 @@ config MIPI_DBI_INIT_PRIORITY endif # MIPI_DBI endif # BOARD_M5STACK_CORE2_ESP32_PROCPU - -if BOARD_M5STACK_CORE2_ESP32_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 256 - -endif # BOARD_M5STACK_CORE2_ESP32_APPCPU diff --git a/boards/m5stack/m5stack_stamps3/Kconfig b/boards/m5stack/m5stack_stamps3/Kconfig new file mode 100644 index 0000000000000..65e8c315b934c --- /dev/null +++ b/boards/m5stack/m5stack_stamps3/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2023 Martin Kiepfer +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_M5STACK_STAMPS3_ESP32S3_PROCPU + default 256 if BOARD_M5STACK_STAMPS3_ESP32S3_APPCPU diff --git a/boards/m5stack/m5stack_stamps3/Kconfig.defconfig b/boards/m5stack/m5stack_stamps3/Kconfig.defconfig index 903059dffbc8a..13f079ac915da 100644 --- a/boards/m5stack/m5stack_stamps3/Kconfig.defconfig +++ b/boards/m5stack/m5stack_stamps3/Kconfig.defconfig @@ -4,21 +4,7 @@ if BOARD_M5STACK_STAMPS3_ESP32S3_PROCPU -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 - config KERNEL_MEM_POOL default y endif # BOARD_M5STACK_STAMPS3_ESP32S3_PROCPU - -if BOARD_M5STACK_STAMPS3_ESP32S3_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 256 - -endif # BOARD_M5STACK_STAMPS3_ESP32S3_APPCPU diff --git a/boards/m5stack/m5stickc_plus/Kconfig b/boards/m5stack/m5stickc_plus/Kconfig new file mode 100644 index 0000000000000..735b5d5ce6b8f --- /dev/null +++ b/boards/m5stack/m5stickc_plus/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2022 AVSystem Sławomir Wolf Sp.j. (AVSystem) +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_M5STICKC_PLUS_ESP32_PROCPU + default 256 if BOARD_M5STICKC_PLUS_ESP32_APPCPU diff --git a/boards/m5stack/m5stickc_plus/Kconfig.defconfig b/boards/m5stack/m5stickc_plus/Kconfig.defconfig index a6b957227be56..86819dba82d3a 100644 --- a/boards/m5stack/m5stickc_plus/Kconfig.defconfig +++ b/boards/m5stack/m5stickc_plus/Kconfig.defconfig @@ -5,13 +5,6 @@ if BOARD_M5STICKC_PLUS_ESP32_PROCPU -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 - config GPIO_HOGS_INIT_PRIORITY default 70 @@ -28,10 +21,3 @@ config REGULATOR_FIXED_INIT_PRIORITY default 75 endif # BOARD_M5STICKC_PLUS_ESP32_PROCPU - -if BOARD_M5STICKC_PLUS_ESP32_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 256 - -endif # BOARD_M5STICKC_PLUS_ESP32_APPCPU diff --git a/boards/m5stack/stamp_c3/Kconfig.defconfig b/boards/m5stack/stamp_c3/Kconfig similarity index 57% rename from boards/m5stack/stamp_c3/Kconfig.defconfig rename to boards/m5stack/stamp_c3/Kconfig index dcc3a4225487d..264a7fc7beb52 100644 --- a/boards/m5stack/stamp_c3/Kconfig.defconfig +++ b/boards/m5stack/stamp_c3/Kconfig @@ -1,11 +1,6 @@ -# M5Stack STAMP-C3 board configuration - # Copyright 2022 TOKITA Hiroshi # SPDX-License-Identifier: Apache-2.0 config HEAP_MEM_POOL_ADD_SIZE_BOARD int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT default 4096 diff --git a/boards/olimex/olimex_esp32_evb/Kconfig b/boards/olimex/olimex_esp32_evb/Kconfig new file mode 100644 index 0000000000000..e931c751cab9a --- /dev/null +++ b/boards/olimex/olimex_esp32_evb/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2022 Henrik Brix Andersen +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_OLIMEX_ESP32_EVB_ESP32_PROCPU + default 256 if BOARD_OLIMEX_ESP32_EVB_ESP32_APPCPU diff --git a/boards/olimex/olimex_esp32_evb/Kconfig.defconfig b/boards/olimex/olimex_esp32_evb/Kconfig.defconfig deleted file mode 100644 index e326963903832..0000000000000 --- a/boards/olimex/olimex_esp32_evb/Kconfig.defconfig +++ /dev/null @@ -1,22 +0,0 @@ -# Olimex ESP32-EVB board configuration - -# Copyright (c) 2022 Henrik Brix Andersen -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_OLIMEX_ESP32_EVB_ESP32_PROCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 - -endif # BOARD_OLIMEX_ESP32_EVB_ESP32_PROCPU - -if BOARD_OLIMEX_ESP32_EVB_ESP32_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 256 - -endif # BOARD_OLIMEX_ESP32_EVB_ESP32_APPCPU diff --git a/boards/others/icev_wireless/Kconfig.defconfig b/boards/others/icev_wireless/Kconfig similarity index 68% rename from boards/others/icev_wireless/Kconfig.defconfig rename to boards/others/icev_wireless/Kconfig index b7c82093375ff..78f243a23b282 100644 --- a/boards/others/icev_wireless/Kconfig.defconfig +++ b/boards/others/icev_wireless/Kconfig @@ -3,7 +3,4 @@ config HEAP_MEM_POOL_ADD_SIZE_BOARD int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT default 4096 diff --git a/boards/seeed/xiao_esp32c3/Kconfig b/boards/seeed/xiao_esp32c3/Kconfig new file mode 100644 index 0000000000000..c6a99b1032dc7 --- /dev/null +++ b/boards/seeed/xiao_esp32c3/Kconfig @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 diff --git a/boards/seeed/xiao_esp32c3/Kconfig.defconfig b/boards/seeed/xiao_esp32c3/Kconfig.defconfig deleted file mode 100644 index 4171bb04bc276..0000000000000 --- a/boards/seeed/xiao_esp32c3/Kconfig.defconfig +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright 2022 Google LLC -# SPDX-License-Identifier: Apache-2.0 - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 diff --git a/boards/seeed/xiao_esp32s3/Kconfig b/boards/seeed/xiao_esp32s3/Kconfig new file mode 100644 index 0000000000000..9261164bb3f51 --- /dev/null +++ b/boards/seeed/xiao_esp32s3/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2023 Seeed Studio inc. +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_XIAO_ESP32S3_ESP32S3_PROCPU + default 256 if BOARD_XIAO_ESP32S3_ESP32S3_APPCPU diff --git a/boards/seeed/xiao_esp32s3/Kconfig.defconfig b/boards/seeed/xiao_esp32s3/Kconfig.defconfig deleted file mode 100644 index b9222985d8dd0..0000000000000 --- a/boards/seeed/xiao_esp32s3/Kconfig.defconfig +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) 2023 Seeed Studio inc. -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_XIAO_ESP32S3_ESP32S3_PROCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 - -endif # BOARD_XIAO_ESP32S3_ESP32S3_PROCPU - -if BOARD_XIAO_ESP32S3_ESP32S3_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 256 - -endif # BOARD_XIAO_ESP32S3_ESP32S3_APPCPU diff --git a/boards/vcc-gnd/yd_esp32/Kconfig b/boards/vcc-gnd/yd_esp32/Kconfig new file mode 100644 index 0000000000000..9c2cc2e18dc47 --- /dev/null +++ b/boards/vcc-gnd/yd_esp32/Kconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2023 Julio Cesar +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_YD_ESP32_ESP32_PROCPU + default 256 if BOARD_YD_ESP32_ESP32_APPCPU diff --git a/boards/vcc-gnd/yd_esp32/Kconfig.defconfig b/boards/vcc-gnd/yd_esp32/Kconfig.defconfig deleted file mode 100644 index 2ca1ba1903658..0000000000000 --- a/boards/vcc-gnd/yd_esp32/Kconfig.defconfig +++ /dev/null @@ -1,22 +0,0 @@ -# YD-ESP32 board configuration - -# Copyright (c) 2023 Julio Cesar -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_YD_ESP32_ESP32_PROCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 - -endif # BOARD_YD_ESP32_ESP32_PROCPU - -if BOARD_YD_ESP32_ESP32_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 256 - -endif # BOARD_YD_ESP32_ESP32_PROCPU diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig b/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig index e6b26bf1d6771..23a5df29f9278 100644 --- a/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig @@ -1,6 +1,7 @@ # Copyright (c) 2024 Joel Guittet # SPDX-License-Identifier: Apache-2.0 -config BOARD_ESP32S3_TOUCH_LCD_1_28 - select SOC_ESP32S3_PROCPU if BOARD_ESP32S3_TOUCH_LCD_1_28_ESP32S3_PROCPU - select SOC_ESP32S3_APPCPU if BOARD_ESP32S3_TOUCH_LCD_1_28_ESP32S3_APPCPU +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 if BOARD_ESP32S3_TOUCH_LCD_1_28_ESP32S3_PROCPU + default 256 if BOARD_ESP32S3_TOUCH_LCD_1_28_ESP32S3_APPCPU diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig.defconfig b/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig.defconfig index 06c61c850aa11..d57628b836e4f 100644 --- a/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig.defconfig +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig.defconfig @@ -3,22 +3,6 @@ if BOARD_ESP32S3_TOUCH_LCD_1_28_ESP32S3_PROCPU -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 65535 if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 - -endif # BOARD_ESP32S3_TOUCH_LCD_1_28_ESP32S3_PROCPU - -if BOARD_ESP32S3_TOUCH_LCD_1_28_ESP32S3_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - default 256 - -endif # BOARD_ESP32S3_TOUCH_LCD_1_28_ESP32S3_APPCPU - config ENTROPY_GENERATOR default y @@ -30,3 +14,5 @@ config PWM config LV_COLOR_16_SWAP default y if LVGL + +endif # BOARD_ESP32S3_TOUCH_LCD_1_28_ESP32S3_PROCPU diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig.esp32s3_touch_lcd_1_28 b/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig.esp32s3_touch_lcd_1_28 index b62dd557d26b2..5ba9a20d753d4 100644 --- a/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig.esp32s3_touch_lcd_1_28 +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig.esp32s3_touch_lcd_1_28 @@ -3,3 +3,5 @@ config BOARD_ESP32S3_TOUCH_LCD_1_28 select SOC_ESP32S3_R2 + select SOC_ESP32S3_PROCPU if BOARD_ESP32S3_TOUCH_LCD_1_28_ESP32S3_PROCPU + select SOC_ESP32S3_APPCPU if BOARD_ESP32S3_TOUCH_LCD_1_28_ESP32S3_APPCPU diff --git a/boards/wemos/esp32s2_lolin_mini/Kconfig b/boards/wemos/esp32s2_lolin_mini/Kconfig new file mode 100644 index 0000000000000..03ec3c08d3899 --- /dev/null +++ b/boards/wemos/esp32s2_lolin_mini/Kconfig @@ -0,0 +1,6 @@ +# Copyright (c) 2023 Google, LLC +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 diff --git a/boards/wemos/esp32s2_lolin_mini/Kconfig.defconfig b/boards/wemos/esp32s2_lolin_mini/Kconfig.defconfig index 85fdb26695695..cb9fdebc22c3e 100644 --- a/boards/wemos/esp32s2_lolin_mini/Kconfig.defconfig +++ b/boards/wemos/esp32s2_lolin_mini/Kconfig.defconfig @@ -5,8 +5,3 @@ config ENTROPY_GENERATOR default y - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 32768 if WIFI - default 4096 From 9c48f7eb377a426133965d15c8d767e6788510ff Mon Sep 17 00:00:00 2001 From: Ryan McClelland Date: Wed, 2 Oct 2024 16:03:25 -0700 Subject: [PATCH 0293/4482] drivers: i3c: cdns: correct sda push pull hold time correct the comments and timing for the sda push-pull hold time configuration. Signed-off-by: Ryan McClelland --- drivers/i3c/i3c_cdns.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/i3c/i3c_cdns.c b/drivers/i3c/i3c_cdns.c index b7c1b54b91b6b..086578c1d003f 100644 --- a/drivers/i3c/i3c_cdns.c +++ b/drivers/i3c/i3c_cdns.c @@ -472,11 +472,10 @@ #define I3C_BUS_TLOW_OD_MIN_NS 200 /* - * MIPI I3C v1.1.1 Spec defines tsco max as 12ns, but the default for devices is 8ns - * TODO: this should be configurable by the value with in maxRd from the CCC GETMXDS - * for individual devices + * MIPI I3C v1.1.1 Spec defines SDA Signal Data Hold in Push Pull max as the + * minimum of the clock rise and fall time plus 3ns */ -#define I3C_TSCO_DEFAULT_NS 8 +#define I3C_HD_PP_DEFAULT_NS 10 /* Interrupt thresholds. */ /* command response fifo threshold */ @@ -3058,16 +3057,18 @@ static enum i3c_bus_mode i3c_bus_mode(const struct i3c_dev_list *dev_list) /** * Determine THD_DEL value for CTRL register * + * Should be MIN(t_cf, t_cr) + 3ns + * * @param dev Pointer to device driver instance. * * @return Value to be written to THD_DEL */ -static uint8_t cdns_i3c_clk_to_data_turnaround(const struct device *dev) +static uint8_t cdns_i3c_sda_data_hold(const struct device *dev) { const struct cdns_i3c_config *config = dev->config; uint32_t input_clock_frequency = config->input_frequency; uint8_t thd_delay = - DIV_ROUND_UP(I3C_TSCO_DEFAULT_NS, (NSEC_PER_SEC / input_clock_frequency)); + DIV_ROUND_UP(I3C_HD_PP_DEFAULT_NS, (NSEC_PER_SEC / input_clock_frequency)); if (thd_delay > THD_DELAY_MAX) { thd_delay = THD_DELAY_MAX; @@ -3156,11 +3157,10 @@ static int cdns_i3c_bus_init(const struct device *dev) ctrl &= ~CTRL_MST_ACK; /* - * Cadence I3C release r104v1p0 and above support configuration of the clock to data - * turnaround time. + * Cadence I3C release r104v1p0 and above support configuration of the sda data hold time */ if (REV_ID_REV(data->hw_cfg.rev_id) >= REV_ID_VERSION(1, 4)) { - ctrl |= CTRL_THD_DELAY(cdns_i3c_clk_to_data_turnaround(dev)); + ctrl |= CTRL_THD_DELAY(cdns_i3c_sda_data_hold(dev)); } /* From 31e821bef670372416d9cf75e6af492a51393fc9 Mon Sep 17 00:00:00 2001 From: Ryan McClelland Date: Wed, 2 Oct 2024 16:08:31 -0700 Subject: [PATCH 0294/4482] drivers: i3c: cdns: grab mutex before adjusting prescalers Grab the mutex before adjusting the prescalers to make sure no transaction is on going. Signed-off-by: Ryan McClelland --- drivers/i3c/i3c_cdns.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/i3c/i3c_cdns.c b/drivers/i3c/i3c_cdns.c index 086578c1d003f..f1f860ae866bb 100644 --- a/drivers/i3c/i3c_cdns.c +++ b/drivers/i3c/i3c_cdns.c @@ -1603,7 +1603,9 @@ static int cdns_i3c_i2c_api_configure(const struct device *dev, uint32_t config) break; } + k_mutex_lock(&data->bus_lock, K_FOREVER); cdns_i3c_set_prescalers(dev); + k_mutex_unlock(&data->bus_lock); return 0; } @@ -1632,7 +1634,10 @@ static int cdns_i3c_configure(const struct device *dev, enum i3c_config_type typ data->common.ctrl_config.scl.i3c = ctrl_cfg->scl.i3c; data->common.ctrl_config.scl.i2c = ctrl_cfg->scl.i2c; + + k_mutex_lock(&data->bus_lock, K_FOREVER); cdns_i3c_set_prescalers(dev); + k_mutex_unlock(&data->bus_lock); return 0; } From ae63c62f0ea76d4c79e0e8c14b32ce2e60da7827 Mon Sep 17 00:00:00 2001 From: Ryan McClelland Date: Wed, 2 Oct 2024 16:00:17 -0700 Subject: [PATCH 0295/4482] drivers: i3c: implement support for ibi thr interrupts Some IBI TIR packets can be larger than the ibi data fifo size which can prevent it from receiving the full packet. This adds a data struct in to the driver data where data can be pushed to as data is being transfered. Signed-off-by: Ryan McClelland --- drivers/i3c/i3c_cdns.c | 87 +++++++++++++++++++++------------- dts/bindings/i3c/cdns,i3c.yaml | 5 ++ 2 files changed, 58 insertions(+), 34 deletions(-) diff --git a/drivers/i3c/i3c_cdns.c b/drivers/i3c/i3c_cdns.c index f1f860ae866bb..cc3fcd4a05b14 100644 --- a/drivers/i3c/i3c_cdns.c +++ b/drivers/i3c/i3c_cdns.c @@ -547,6 +547,14 @@ struct cdns_i3c_xfer { struct cdns_i3c_cmd cmds[I3C_MAX_MSGS]; }; +#ifdef CONFIG_I3C_USE_IBI +/* IBI transferred data */ +struct cdns_i3c_ibi_buf { + uint8_t ibi_data[CONFIG_I3C_IBI_MAX_PAYLOAD_SIZE]; + uint8_t ibi_data_cnt; +}; +#endif + /* Driver config */ struct cdns_i3c_config { struct i3c_driver_config common; @@ -556,12 +564,17 @@ struct cdns_i3c_config { uint32_t input_frequency; /** Interrupt configuration function. */ void (*irq_config_func)(const struct device *dev); + /** IBID Threshold value */ + uint8_t ibid_thr; }; /* Driver instance data */ struct cdns_i3c_data { struct i3c_driver_data common; struct cdns_i3c_hw_config hw_cfg; +#ifdef CONFIG_I3C_USE_IBI + struct cdns_i3c_ibi_buf ibi_buf; +#endif struct k_mutex bus_lock; struct cdns_i3c_i2c_dev_data cdns_i3c_i2c_priv_data[I3C_MAX_DEVS]; struct cdns_i3c_xfer xfer; @@ -2298,7 +2311,7 @@ static int cdns_i3c_read_ibi_fifo(const struct cdns_i3c_config *config, void *bu static void cdns_i3c_handle_ibi(const struct device *dev, uint32_t ibir) { const struct cdns_i3c_config *config = dev->config; - uint8_t ibi_data[CONFIG_I3C_IBI_MAX_PAYLOAD_SIZE]; + struct cdns_i3c_data *data = dev->data; /* The slave ID returned here is the device ID in the SIR map NOT the device ID * in the RR map. @@ -2326,20 +2339,25 @@ static void cdns_i3c_handle_ibi(const struct device *dev, uint32_t ibir) return; } if (ibir & IBIR_ERROR) { - LOG_ERR("%s: Data overflow", dev->name); - return; + /* Controller issued an Abort */ + LOG_ERR("%s: IBI Data overflow", dev->name); } /* Read out any payload bytes */ uint8_t ibi_len = IBIR_XFER_BYTES(ibir); if (ibi_len > 0) { - if (cdns_i3c_read_ibi_fifo(config, ibi_data, ibi_len) < 0) { - LOG_ERR("%s: Failed to get payload", dev->name); + if (ibi_len - data->ibi_buf.ibi_data_cnt > 0) { + if (cdns_i3c_read_ibi_fifo( + config, &data->ibi_buf.ibi_data[data->ibi_buf.ibi_data_cnt], + ibi_len - data->ibi_buf.ibi_data_cnt) < 0) { + LOG_ERR("%s: Failed to get payload", dev->name); + } } + data->ibi_buf.ibi_data_cnt = 0; } - if (i3c_ibi_work_enqueue_target_irq(desc, ibi_data, ibi_len) != 0) { + if (i3c_ibi_work_enqueue_target_irq(desc, data->ibi_buf.ibi_data, ibi_len) != 0) { LOG_ERR("%s: Error enqueue IBI IRQ work", dev->name); } } @@ -2445,40 +2463,24 @@ static void cdns_i3c_target_sdr_tx_thr_int_handler(const struct device *dev, static void cdns_i3c_irq_handler(const struct device *dev) { const struct cdns_i3c_config *config = dev->config; + struct cdns_i3c_data *data = dev->data; if (sys_read32(config->base + MST_STATUS0) & MST_STATUS0_MASTER_MODE) { uint32_t int_st = sys_read32(config->base + MST_ISR); + sys_write32(int_st, config->base + MST_ICR); /* Command queue empty */ if (int_st & MST_INT_HALTED) { LOG_WRN("Core Halted, 2 read aborts"); - sys_write32(MST_INT_HALTED, config->base + MST_ICR); } /* Command queue empty */ if (int_st & MST_INT_CMDD_EMP) { cdns_i3c_complete_transfer(dev); - sys_write32(MST_INT_CMDD_EMP, config->base + MST_ICR); - } - - /* Command queue threshold */ - if (int_st & MST_INT_CMDD_THR) { - sys_write32(MST_INT_CMDD_THR, config->base + MST_ICR); - } - - /* Command response threshold hit */ - if (int_st & MST_INT_CMDR_THR) { - sys_write32(MST_INT_CMDR_THR, config->base + MST_ICR); - } - - /* RX data ready */ - if (int_st & MST_INT_RX_THR) { - sys_write32(MST_INT_RX_THR, config->base + MST_ICR); } /* In-band interrupt */ if (int_st & MST_INT_IBIR_THR) { - sys_write32(MST_INT_IBIR_THR, config->base + MST_ICR); #ifdef CONFIG_I3C_USE_IBI cnds_i3c_master_demux_ibis(dev); #else @@ -2486,25 +2488,39 @@ static void cdns_i3c_irq_handler(const struct device *dev) dev->name); #endif } + + /* In-band interrupt data threshold */ + if (int_st & MST_INT_IBID_THR) { +#ifdef CONFIG_I3C_USE_IBI + /* pop data out of the IBI FIFO */ + while (!cdns_i3c_ibi_fifo_empty(config)) { + uint32_t *ptr = (uint32_t *)&data->ibi_buf + .ibi_data[data->ibi_buf.ibi_data_cnt]; + *ptr = sys_le32_to_cpu(sys_read32(config->base + IBI_DATA_FIFO)); + data->ibi_buf.ibi_data_cnt += 4; + } +#else + LOG_ERR("%s: IBI received - Kconfig for using IBIs is not enabled", + dev->name); +#endif + } + + /* In-band interrupt response overflow */ + if (int_st & MST_INT_IBIR_OVF) { + LOG_ERR("%s: controller ibir overflow,", dev->name); + } + /* In-band interrupt data */ if (int_st & MST_INT_TX_OVF) { - sys_write32(MST_INT_TX_OVF, config->base + MST_ICR); LOG_ERR("%s: controller tx buffer overflow,", dev->name); } /* In-band interrupt data */ if (int_st & MST_INT_RX_UNF) { - sys_write32(MST_INT_RX_UNF, config->base + MST_ICR); LOG_ERR("%s: controller rx buffer underflow,", dev->name); } - - /* In-band interrupt data */ - if (int_st & MST_INT_IBID_THR) { - sys_write32(MST_INT_IBID_THR, config->base + MST_ICR); - } } else { uint32_t int_sl = sys_read32(config->base + SLV_ISR); - struct cdns_i3c_data *data = dev->data; const struct i3c_target_callbacks *target_cb = data->target_config ? data->target_config->callbacks : NULL; /* Clear interrupts */ @@ -3185,7 +3201,7 @@ static int cdns_i3c_bus_init(const struct device *dev) /* Set fifo thresholds. */ sys_write32(CMD_THR(I3C_CMDD_THR) | IBI_THR(I3C_IBID_THR) | CMDR_THR(I3C_CMDR_THR) | - IBIR_THR(I3C_IBIR_THR), + IBIR_THR(config->ibid_thr), config->base + CMD_IBI_THR_CTRL); /* Set TX/RX interrupt thresholds. */ @@ -3197,6 +3213,7 @@ static int cdns_i3c_bus_init(const struct device *dev) sys_write32(SLV_DDR_TX_THR(0) | SLV_DDR_RX_THR(1), config->base + SLV_DDR_TX_RX_THR_CTRL); } + /* enable target interrupts */ sys_write32(SLV_INT_DA_UPD | SLV_INT_SDR_RD_COMP | SLV_INT_SDR_WR_COMP | SLV_INT_SDR_RX_THR | SLV_INT_SDR_TX_THR | SLV_INT_SDR_RX_UNF | @@ -3205,7 +3222,8 @@ static int cdns_i3c_bus_init(const struct device *dev) config->base + SLV_IER); /* Enable IBI interrupts. */ - sys_write32(MST_INT_IBIR_THR | MST_INT_RX_UNF | MST_INT_HALTED | MST_INT_TX_OVF, + sys_write32(MST_INT_IBIR_THR | MST_INT_RX_UNF | MST_INT_HALTED | MST_INT_TX_OVF | + MST_INT_IBIR_OVF | MST_INT_IBID_THR, config->base + MST_IER); int ret = i3c_addr_slots_init(dev); @@ -3272,6 +3290,7 @@ static struct i3c_driver_api api = { .base = DT_INST_REG_ADDR(n), \ .input_frequency = DT_INST_PROP(n, input_clock_frequency), \ .irq_config_func = cdns_i3c_config_func_##n, \ + .ibid_thr = DT_INST_PROP(n, ibid_thr), \ .common.dev_list.i3c = cdns_i3c_device_array_##n, \ .common.dev_list.num_i3c = ARRAY_SIZE(cdns_i3c_device_array_##n), \ .common.dev_list.i2c = cdns_i3c_i2c_device_array_##n, \ diff --git a/dts/bindings/i3c/cdns,i3c.yaml b/dts/bindings/i3c/cdns,i3c.yaml index 954af09d63df6..9708fc6903ec2 100644 --- a/dts/bindings/i3c/cdns,i3c.yaml +++ b/dts/bindings/i3c/cdns,i3c.yaml @@ -19,3 +19,8 @@ properties: type: int required: true description: The controller input clock frequency + + ibid-thr: + type: int + default: 1 + description: IBI Data Fifo Threashold Value From 03029e7bd7077834bb9c6b61bad19497b3f5558f Mon Sep 17 00:00:00 2001 From: Mykhailo Lohvynenko Date: Wed, 2 Oct 2024 14:48:31 +0300 Subject: [PATCH 0296/4482] json: support parsing and serializing 'uint64_t' Introduce support for 'uint64_t' type, so that unsigned numbers can be serialized into JSON payloads. Signed-off-by: Mykhailo Lohvynenko --- include/zephyr/data/json.h | 1 + lib/utils/json.c | 55 ++++++++++++++++++++++++++++++++++++++ tests/lib/json/src/main.c | 41 ++++++++++++++++++++++++---- 3 files changed, 92 insertions(+), 5 deletions(-) diff --git a/include/zephyr/data/json.h b/include/zephyr/data/json.h index a93eb427374f2..2e8182fd0884e 100644 --- a/include/zephyr/data/json.h +++ b/include/zephyr/data/json.h @@ -43,6 +43,7 @@ enum json_tokens { JSON_TOK_OBJ_ARRAY = '3', JSON_TOK_ENCODED_OBJ = '4', JSON_TOK_INT64 = '5', + JSON_TOK_UINT64 = '6', JSON_TOK_TRUE = 't', JSON_TOK_FALSE = 'f', JSON_TOK_NULL = 'n', diff --git a/lib/utils/json.c b/lib/utils/json.c index c1170fcfec97d..6aa5f27646ea0 100644 --- a/lib/utils/json.c +++ b/lib/utils/json.c @@ -309,6 +309,7 @@ static int element_token(enum json_tokens token) case JSON_TOK_STRING: case JSON_TOK_NUMBER: case JSON_TOK_INT64: + case JSON_TOK_UINT64: case JSON_TOK_FLOAT: case JSON_TOK_OPAQUE: case JSON_TOK_OBJ_ARRAY: @@ -469,6 +470,30 @@ static int decode_int64(const struct json_token *token, int64_t *num) return 0; } +static int decode_uint64(const struct json_token *token, uint64_t *num) +{ + char *endptr; + char prev_end; + + prev_end = *token->end; + *token->end = '\0'; + + errno = 0; + *num = strtoull(token->start, &endptr, 10); + + *token->end = prev_end; + + if (errno != 0) { + return -errno; + } + + if (endptr != token->end) { + return -EINVAL; + } + + return 0; +} + static bool equivalent_types(enum json_tokens type1, enum json_tokens type2) { if (type1 == JSON_TOK_TRUE || type1 == JSON_TOK_FALSE) { @@ -483,6 +508,10 @@ static bool equivalent_types(enum json_tokens type1, enum json_tokens type2) return true; } + if (type1 == JSON_TOK_NUMBER && type2 == JSON_TOK_UINT64) { + return true; + } + if (type1 == JSON_TOK_STRING && type2 == JSON_TOK_OPAQUE) { return true; } @@ -545,6 +574,11 @@ static int64_t decode_value(struct json_obj *obj, return decode_int64(value, num); } + case JSON_TOK_UINT64: { + uint64_t *num = field; + + return decode_uint64(value, num); + } case JSON_TOK_OPAQUE: case JSON_TOK_FLOAT: { struct json_obj_token *obj_token = field; @@ -573,6 +607,8 @@ static ptrdiff_t get_elem_size(const struct json_obj_descr *descr) return sizeof(int32_t); case JSON_TOK_INT64: return sizeof(int64_t); + case JSON_TOK_UINT64: + return sizeof(uint64_t); case JSON_TOK_OPAQUE: case JSON_TOK_FLOAT: case JSON_TOK_OBJ_ARRAY: @@ -1035,6 +1071,23 @@ static int int64_encode(const int64_t *num, json_append_bytes_t append_bytes, return append_bytes(buf, (size_t)ret, data); } +static int uint64_encode(const uint64_t *num, json_append_bytes_t append_bytes, + void *data) +{ + char buf[sizeof("18446744073709551610")]; + int ret; + + ret = snprintk(buf, sizeof(buf), "%" PRIu64, *num); + if (ret < 0) { + return ret; + } + if (ret >= (int)sizeof(buf)) { + return -ENOMEM; + } + + return append_bytes(buf, (size_t)ret, data); +} + static int float_ascii_encode(struct json_obj_token *num, json_append_bytes_t append_bytes, void *data) { @@ -1099,6 +1152,8 @@ static int encode(const struct json_obj_descr *descr, const void *val, return num_encode(ptr, append_bytes, data); case JSON_TOK_INT64: return int64_encode(ptr, append_bytes, data); + case JSON_TOK_UINT64: + return uint64_encode(ptr, append_bytes, data); case JSON_TOK_FLOAT: return float_ascii_encode(ptr, append_bytes, data); case JSON_TOK_OPAQUE: diff --git a/tests/lib/json/src/main.c b/tests/lib/json/src/main.c index ae142f85d1961..baf2e0edd8403 100644 --- a/tests/lib/json/src/main.c +++ b/tests/lib/json/src/main.c @@ -14,6 +14,7 @@ struct test_nested { bool nested_bool; const char *nested_string; int64_t nested_int64; + uint64_t nested_uint64; }; struct test_struct { @@ -22,6 +23,8 @@ struct test_struct { bool some_bool; int64_t some_int64; int64_t another_int64; + int64_t some_uint64; + int64_t another_uint64; struct test_nested some_nested_struct; int some_array[16]; size_t some_array_len; @@ -51,6 +54,9 @@ struct test_int_limits { int64_t int64_max; int64_t int64_cero; int64_t int64_min; + uint64_t uint64_max; + uint64_t uint64_cero; + uint64_t uint64_min; }; static const struct json_obj_descr nested_descr[] = { @@ -60,6 +66,8 @@ static const struct json_obj_descr nested_descr[] = { JSON_TOK_STRING), JSON_OBJ_DESCR_PRIM(struct test_nested, nested_int64, JSON_TOK_INT64), + JSON_OBJ_DESCR_PRIM(struct test_nested, nested_uint64, + JSON_TOK_UINT64), }; static const struct json_obj_descr test_descr[] = { @@ -70,6 +78,10 @@ static const struct json_obj_descr test_descr[] = { JSON_TOK_INT64), JSON_OBJ_DESCR_PRIM(struct test_struct, another_int64, JSON_TOK_INT64), + JSON_OBJ_DESCR_PRIM(struct test_struct, some_uint64, + JSON_TOK_UINT64), + JSON_OBJ_DESCR_PRIM(struct test_struct, another_uint64, + JSON_TOK_UINT64), JSON_OBJ_DESCR_OBJECT(struct test_struct, some_nested_struct, nested_descr), JSON_OBJ_DESCR_ARRAY(struct test_struct, some_array, @@ -104,6 +116,9 @@ static const struct json_obj_descr obj_limits_descr[] = { JSON_OBJ_DESCR_PRIM(struct test_int_limits, int64_max, JSON_TOK_INT64), JSON_OBJ_DESCR_PRIM(struct test_int_limits, int64_cero, JSON_TOK_INT64), JSON_OBJ_DESCR_PRIM(struct test_int_limits, int64_min, JSON_TOK_INT64), + JSON_OBJ_DESCR_PRIM(struct test_int_limits, uint64_max, JSON_TOK_UINT64), + JSON_OBJ_DESCR_PRIM(struct test_int_limits, uint64_cero, JSON_TOK_UINT64), + JSON_OBJ_DESCR_PRIM(struct test_int_limits, uint64_min, JSON_TOK_UINT64), }; struct array { @@ -197,12 +212,15 @@ ZTEST(lib_json_test, test_json_encoding) .some_int = 42, .some_int64 = 1152921504606846977, .another_int64 = -2305843009213693937, + .some_uint64 = 18446744073709551615U, + .another_uint64 = 0, .some_bool = true, .some_nested_struct = { .nested_int = -1234, .nested_bool = false, .nested_string = "this should be escaped: \t", .nested_int64 = 4503599627370496, + .nested_uint64 = 18446744073709551610U, }, .some_array[0] = 1, .some_array[1] = 4, @@ -222,6 +240,7 @@ ZTEST(lib_json_test, test_json_encoding) .nested_bool = true, .nested_string = "no escape necessary", .nested_int64 = 4503599627370496, + .nested_uint64 = 18446744073709551610U, }, .nested_obj_array = { {1, true, "true"}, @@ -233,10 +252,13 @@ ZTEST(lib_json_test, test_json_encoding) "\"some_int\":42,\"some_bool\":true," "\"some_int64\":1152921504606846977," "\"another_int64\":-2305843009213693937," + "\"some_uint64\":18446744073709551615," + "\"another_uint64\":0," "\"some_nested_struct\":{\"nested_int\":-1234," "\"nested_bool\":false,\"nested_string\":" "\"this should be escaped: \\t\"," - "\"nested_int64\":4503599627370496}," + "\"nested_int64\":4503599627370496," + "\"nested_uint64\":18446744073709551610}," "\"some_array\":[1,4,8,16,32]," "\"another_b!@l\":true," "\"if\":false," @@ -244,10 +266,11 @@ ZTEST(lib_json_test, test_json_encoding) "\"4nother_ne$+\":{\"nested_int\":1234," "\"nested_bool\":true," "\"nested_string\":\"no escape necessary\"," - "\"nested_int64\":4503599627370496}," + "\"nested_int64\":4503599627370496," + "\"nested_uint64\":18446744073709551610}," "\"nested_obj_array\":[" - "{\"nested_int\":1,\"nested_bool\":true,\"nested_string\":\"true\",\"nested_int64\":0}," - "{\"nested_int\":0,\"nested_bool\":false,\"nested_string\":\"false\",\"nested_int64\":0}]" + "{\"nested_int\":1,\"nested_bool\":true,\"nested_string\":\"true\",\"nested_int64\":0,\"nested_uint64\":0}," + "{\"nested_int\":0,\"nested_bool\":false,\"nested_string\":\"false\",\"nested_int64\":0,\"nested_uint64\":0}]" "}"; char buffer[sizeof(encoded)]; int ret; @@ -274,6 +297,8 @@ ZTEST(lib_json_test, test_json_decoding) "\r ," "\"some_int64\":-4611686018427387904," "\"another_int64\":-2147483648," + "\"some_uint64\":18446744073709551615," + "\"another_uint64\":0," "\"some_nested_struct\":{ " "\"nested_int\":-1234,\n\n" "\"nested_bool\":false,\t" @@ -368,7 +393,10 @@ ZTEST(lib_json_test, test_json_limits) "\"int_min\":-2147483648," "\"int64_max\":9223372036854775807," "\"int64_cero\":0," - "\"int64_min\":-9223372036854775808" + "\"int64_min\":-9223372036854775808," + "\"uint64_max\":18446744073709551615," + "\"uint64_cero\":0," + "\"uint64_min\":0" "}"; struct test_int_limits limits = { @@ -378,6 +406,9 @@ ZTEST(lib_json_test, test_json_limits) .int64_max = INT64_MAX, .int64_cero = 0, .int64_min = INT64_MIN, + .uint64_max = UINT64_MAX, + .uint64_cero = 0, + .uint64_min = 0, }; char buffer[sizeof(encoded)]; From 30a3d88d8a8a331be65f0bda2fcde9a1537292b3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Tue, 1 Oct 2024 09:31:04 +0200 Subject: [PATCH 0297/4482] samples: net: wifi: Disable building on NS platform variants The sample currently doesn't build for non-secure nRF platforms due to mbed TLS misconfiguration - TFM enforces PSA crypto API, while the default configuration for supplicant uses legacy crypto configuration. In result, build fails due to unsatisfied dependencies. Therefore, disable this variant from building temporarily to unblock the CI, until the issue is resolved. Signed-off-by: Robert Lubos --- samples/net/wifi/sample.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/samples/net/wifi/sample.yaml b/samples/net/wifi/sample.yaml index 1c106e4897a68..65fb44f7f1f32 100644 --- a/samples/net/wifi/sample.yaml +++ b/samples/net/wifi/sample.yaml @@ -45,9 +45,7 @@ tests: extra_args: CONFIG_NRF_WIFI_BUILD_ONLY_MODE=y platform_allow: - nrf7002dk/nrf5340/cpuapp - - nrf7002dk/nrf5340/cpuapp/ns - nrf7002dk/nrf5340/cpuapp/nrf7001 - - nrf7002dk/nrf5340/cpuapp/nrf7001/ns integration_platforms: - nrf7002dk/nrf5340/cpuapp - nrf7002dk/nrf5340/cpuapp/nrf7001 @@ -57,7 +55,6 @@ tests: - SHIELD=nrf7002ek platform_allow: - nrf5340dk/nrf5340/cpuapp - - nrf5340dk/nrf5340/cpuapp/ns - nucleo_h723zg integration_platforms: - nrf5340dk/nrf5340/cpuapp From 627c33292aaa24dc09904082afc76002565a9913 Mon Sep 17 00:00:00 2001 From: Ian Morris Date: Fri, 27 Sep 2024 13:42:40 +0200 Subject: [PATCH 0298/4482] boards: mikroe: remove CONFIG_PINCTRL from defconfig of RA4M1 clicker This PR fixes #78619 for the Mikroe RA4M1 Clicker board. Signed-off-by: Ian Morris --- .../clicker_ra4m1/mikroe_clicker_ra4m1_defconfig | 11 ++++------- drivers/serial/Kconfig.renesas_ra | 2 ++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/boards/mikroe/clicker_ra4m1/mikroe_clicker_ra4m1_defconfig b/boards/mikroe/clicker_ra4m1/mikroe_clicker_ra4m1_defconfig index 3d89bdc283d4e..2e434ba45ea3c 100644 --- a/boards/mikroe/clicker_ra4m1/mikroe_clicker_ra4m1_defconfig +++ b/boards/mikroe/clicker_ra4m1/mikroe_clicker_ra4m1_defconfig @@ -5,18 +5,15 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=12000000 CONFIG_BUILD_OUTPUT_HEX=y -# enable uart driver +# Enable uart driver CONFIG_SERIAL=y -# enable console +# Enable console CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y -# enable GPIO +# Enable GPIO CONFIG_GPIO=y -# enable pin controller -CONFIG_PINCTRL=y - -# enable Clocks +# Enable Clocks CONFIG_CLOCK_CONTROL=y diff --git a/drivers/serial/Kconfig.renesas_ra b/drivers/serial/Kconfig.renesas_ra index 37c6a127e5e94..d79081bc50635 100644 --- a/drivers/serial/Kconfig.renesas_ra +++ b/drivers/serial/Kconfig.renesas_ra @@ -8,6 +8,7 @@ config UART_RENESAS_RA depends on DT_HAS_RENESAS_RA_UART_SCI_ENABLED select SERIAL_HAS_DRIVER select SERIAL_SUPPORT_INTERRUPT + select PINCTRL help Enable Renesas RA series UART driver. @@ -20,6 +21,7 @@ config UART_SCI_RA select SERIAL_SUPPORT_ASYNC select USE_RA_FSP_SCI_UART select USE_RA_FSP_DTC if UART_ASYNC_API + select PINCTRL help Enable Renesas RA SCI UART Driver. From 2e6c0383635fde3375933d1216ee4dcf9de2cfa3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Sat, 28 Sep 2024 10:54:10 +0300 Subject: [PATCH 0299/4482] tests: net: wifi: Run wifi tests together with net tests Make sure wifi tests are run when verifying networking. Signed-off-by: Jukka Rissanen --- tests/net/wifi/wifi_nm/testcase.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/net/wifi/wifi_nm/testcase.yaml b/tests/net/wifi/wifi_nm/testcase.yaml index 94a5e8e2e1891..448642587aa51 100644 --- a/tests/net/wifi/wifi_nm/testcase.yaml +++ b/tests/net/wifi/wifi_nm/testcase.yaml @@ -6,6 +6,6 @@ tests: extra_args: # Will be ignored for other platforms - CONFIG_NRF_WIFI_BUILD_ONLY_MODE=y - tags: wifi + tags: wifi net platform_exclude: - rd_rw612_bga/rw612/ethernet # Requires binary blobs to build From 9c5fda3e111d25c4d32a385e67b172b881aab27e Mon Sep 17 00:00:00 2001 From: Daniel Flodin Date: Tue, 24 Sep 2024 08:26:47 +0200 Subject: [PATCH 0300/4482] include: kernel: arch: sys: Use new TLS macro PR #78645 replaced uses of the GNU keyword `__thread` with a new macro `Z_THREAD_LOCAL` which expands to correspond C/C++ standard keyword if applicable, else it falls back to `__thread`. This PR addresses some missed replacements in headers files for #78645. Signed-off-by: Daniel Flodin --- include/zephyr/arch/riscv/syscall.h | 2 +- include/zephyr/arch/xtensa/syscall.h | 2 +- include/zephyr/kernel.h | 2 +- include/zephyr/sys/errno_private.h | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/zephyr/arch/riscv/syscall.h b/include/zephyr/arch/riscv/syscall.h index 8865bd6706358..e88cd4e88c815 100644 --- a/include/zephyr/arch/riscv/syscall.h +++ b/include/zephyr/arch/riscv/syscall.h @@ -158,7 +158,7 @@ static inline bool arch_is_user_context(void) } /* Defined in arch/riscv/core/thread.c */ - extern __thread uint8_t is_user_mode; + extern Z_THREAD_LOCAL uint8_t is_user_mode; return is_user_mode != 0; } diff --git a/include/zephyr/arch/xtensa/syscall.h b/include/zephyr/arch/xtensa/syscall.h index cc19f23d12920..67b001cd32996 100644 --- a/include/zephyr/arch/xtensa/syscall.h +++ b/include/zephyr/arch/xtensa/syscall.h @@ -211,7 +211,7 @@ static inline bool arch_is_user_context(void) : "=a" (thread) ); #ifdef CONFIG_THREAD_LOCAL_STORAGE - extern __thread uint32_t is_user_mode; + extern Z_THREAD_LOCAL uint32_t is_user_mode; if (!thread) { return false; diff --git a/include/zephyr/kernel.h b/include/zephyr/kernel.h index 85535381f6833..a6cf554fd2642 100644 --- a/include/zephyr/kernel.h +++ b/include/zephyr/kernel.h @@ -665,7 +665,7 @@ static inline k_tid_t k_current_get(void) #ifdef CONFIG_CURRENT_THREAD_USE_TLS /* Thread-local cache of current thread ID, set in z_thread_entry() */ - extern __thread k_tid_t z_tls_current; + extern Z_THREAD_LOCAL k_tid_t z_tls_current; return z_tls_current; #else diff --git a/include/zephyr/sys/errno_private.h b/include/zephyr/sys/errno_private.h index 5adba7bfc08b8..c8965060d73ca 100644 --- a/include/zephyr/sys/errno_private.h +++ b/include/zephyr/sys/errno_private.h @@ -8,6 +8,7 @@ #define ZEPHYR_INCLUDE_SYS_ERRNO_PRIVATE_H_ #include +#include /* For Z_THREAD_LOCAL */ #ifdef __cplusplus extern "C" { @@ -26,7 +27,7 @@ static inline int *z_errno(void) } #elif defined(CONFIG_ERRNO_IN_TLS) -extern __thread int z_errno_var; +extern Z_THREAD_LOCAL int z_errno_var; static inline int *z_errno(void) { From c5648044a8b1ef487fd9be8004d4351a8fbe20f0 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Thu, 20 Jun 2024 20:27:47 +0800 Subject: [PATCH 0301/4482] Bluetooth: L2CAP_BR: incorrect result returned if config opt unsupported The `BT_L2CAP_CONF_SUCCESS` is returned as result for the config req with supported opt. Result `BT_L2CAP_CONF_UNKNOWN_OPT` should be returned for this case. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/l2cap_br.c | 14 +++++++++++++- subsys/bluetooth/host/classic/l2cap_br_internal.h | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/classic/l2cap_br.c b/subsys/bluetooth/host/classic/l2cap_br.c index a399ffce2908b..c044349f535b7 100644 --- a/subsys/bluetooth/host/classic/l2cap_br.c +++ b/subsys/bluetooth/host/classic/l2cap_br.c @@ -707,6 +707,13 @@ static void l2cap_br_conf_add_mtu(struct net_buf *buf, const uint16_t mtu) net_buf_add_le16(buf, mtu); } +static void l2cap_br_conf_add_opt(struct net_buf *buf, const struct bt_l2cap_conf_opt *opt) +{ + net_buf_add_u8(buf, opt->type & BT_L2CAP_CONF_MASK); + net_buf_add_u8(buf, opt->len); + net_buf_add_mem(buf, opt->data, opt->len); +} + static void l2cap_br_conf(struct bt_l2cap_chan *chan) { struct bt_l2cap_sig_hdr *hdr; @@ -1235,7 +1242,7 @@ static void l2cap_br_conf_req(struct bt_l2cap_br *l2cap, uint8_t ident, struct bt_l2cap_conf_req *req; struct bt_l2cap_sig_hdr *hdr; struct bt_l2cap_conf_rsp *rsp; - struct bt_l2cap_conf_opt *opt; + struct bt_l2cap_conf_opt *opt = NULL; uint16_t flags, dcid, opt_len, hint, result = BT_L2CAP_CONF_SUCCESS; if (buf->len < sizeof(*req)) { @@ -1294,6 +1301,7 @@ static void l2cap_br_conf_req(struct bt_l2cap_br *l2cap, uint8_t ident, default: if (!hint) { LOG_DBG("option %u not handled", opt->type); + result = BT_L2CAP_CONF_UNKNOWN_OPT; goto send_rsp; } @@ -1322,6 +1330,10 @@ static void l2cap_br_conf_req(struct bt_l2cap_br *l2cap, uint8_t ident, */ if (result == BT_L2CAP_CONF_UNACCEPT) { l2cap_br_conf_add_mtu(buf, BR_CHAN(chan)->tx.mtu); + } else if (result == BT_L2CAP_CONF_UNKNOWN_OPT) { + if (opt) { + l2cap_br_conf_add_opt(buf, opt); + } } hdr->len = sys_cpu_to_le16(buf->len - sizeof(*hdr)); diff --git a/subsys/bluetooth/host/classic/l2cap_br_internal.h b/subsys/bluetooth/host/classic/l2cap_br_internal.h index 2a9ff122e8c6e..91412e9200a4a 100644 --- a/subsys/bluetooth/host/classic/l2cap_br_internal.h +++ b/subsys/bluetooth/host/classic/l2cap_br_internal.h @@ -72,6 +72,9 @@ struct bt_l2cap_conn_rsp { #define BT_L2CAP_CONF_SUCCESS 0x0000 #define BT_L2CAP_CONF_UNACCEPT 0x0001 #define BT_L2CAP_CONF_REJECT 0x0002 +#define BT_L2CAP_CONF_UNKNOWN_OPT 0x0003 +#define BT_L2CAP_CONF_PENDING 0x0004 +#define BT_L2CAP_CONF_FLOW_SPEC_REJECT 0x0005 #define BT_L2CAP_CONF_REQ 0x04 struct bt_l2cap_conf_req { From b7ab7c9d458feb820d64155b37204fb093405379 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Fri, 21 Jun 2024 20:19:54 +0800 Subject: [PATCH 0302/4482] Bluetooth: L2CAP_BR: Process all defined OPTs Currently, Only configuration opt MTU is handled. For opt `Flush timeout`, `QOS`, `Retransmission and Flow Control`, and `FCS`, response wilt result `BT_L2CAP_CONF_UNACCEPT`. For opt `extended flow specification` and `extended windows size`, response wilt result `BT_L2CAP_CONF_REJECT`. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/l2cap_br.c | 165 ++++++++++++++++-- .../host/classic/l2cap_br_internal.h | 48 +++++ 2 files changed, 201 insertions(+), 12 deletions(-) diff --git a/subsys/bluetooth/host/classic/l2cap_br.c b/subsys/bluetooth/host/classic/l2cap_br.c index c044349f535b7..1b4111401a729 100644 --- a/subsys/bluetooth/host/classic/l2cap_br.c +++ b/subsys/bluetooth/host/classic/l2cap_br.c @@ -1211,19 +1211,22 @@ static uint16_t l2cap_br_conf_opt_mtu(struct bt_l2cap_chan *chan, struct net_buf *buf, size_t len) { uint16_t mtu, result = BT_L2CAP_CONF_SUCCESS; + struct bt_l2cap_conf_opt_mtu *opt_mtu; /* Core 4.2 [Vol 3, Part A, 5.1] MTU payload length */ - if (len != 2) { + if (len != sizeof(*opt_mtu)) { LOG_ERR("tx MTU length %zu invalid", len); result = BT_L2CAP_CONF_REJECT; goto done; } - /* pulling MTU value moves buf data to next option item */ - mtu = net_buf_pull_le16(buf); + opt_mtu = (struct bt_l2cap_conf_opt_mtu *)buf->data; + + mtu = sys_le16_to_cpu(opt_mtu->mtu); if (mtu < L2CAP_BR_MIN_MTU) { result = BT_L2CAP_CONF_UNACCEPT; BR_CHAN(chan)->tx.mtu = L2CAP_BR_MIN_MTU; + opt_mtu->mtu = sys_cpu_to_le16(L2CAP_BR_MIN_MTU); LOG_DBG("tx MTU %u invalid", mtu); goto done; } @@ -1234,6 +1237,116 @@ static uint16_t l2cap_br_conf_opt_mtu(struct bt_l2cap_chan *chan, return result; } +static uint16_t l2cap_br_conf_opt_flush_timeout(struct bt_l2cap_chan *chan, + struct net_buf *buf, size_t len) +{ + uint16_t result = BT_L2CAP_CONF_SUCCESS; + struct bt_l2cap_conf_opt_flush_timeout *opt_to; + + if (len != sizeof(*opt_to)) { + LOG_ERR("qos frame length %zu invalid", len); + result = BT_L2CAP_CONF_REJECT; + goto done; + } + + opt_to = (struct bt_l2cap_conf_opt_flush_timeout *)buf->data; + + LOG_DBG("Flush timeout %u", opt_to->timeout); + + opt_to->timeout = sys_cpu_to_le16(0xFFFF); + result = BT_L2CAP_CONF_UNACCEPT; +done: + return result; +} + +static uint16_t l2cap_br_conf_opt_qos(struct bt_l2cap_chan *chan, + struct net_buf *buf, size_t len) +{ + uint16_t result = BT_L2CAP_CONF_SUCCESS; + struct bt_l2cap_conf_opt_qos *opt_qos; + + if (len != sizeof(*opt_qos)) { + LOG_ERR("qos frame length %zu invalid", len); + result = BT_L2CAP_CONF_REJECT; + goto done; + } + + opt_qos = (struct bt_l2cap_conf_opt_qos *)buf->data; + + LOG_DBG("QOS Type %u", opt_qos->service_type); + + if (opt_qos->service_type == BT_L2CAP_QOS_TYPE_GUARANTEED) { + /* Set to default value */ + result = BT_L2CAP_CONF_UNACCEPT; + opt_qos->flags = 0x00; + /* do not care */ + opt_qos->token_rate = sys_cpu_to_le32(0x00000000); + /* no token bucket is needed */ + opt_qos->token_bucket_size = sys_cpu_to_le32(0x00000000); + /* do not care */ + opt_qos->peak_bandwidth = sys_cpu_to_le32(0x00000000); + /* do not care */ + opt_qos->latency = sys_cpu_to_le32(0xFFFFFFFF); + /* do not care */ + opt_qos->delay_variation = sys_cpu_to_le32(0xFFFFFFFF); + } + +done: + return result; +} + +static uint16_t l2cap_br_conf_opt_ret_fc(struct bt_l2cap_chan *chan, + struct net_buf *buf, size_t len) +{ + uint16_t result = BT_L2CAP_CONF_SUCCESS; + struct bt_l2cap_conf_opt_ret_fc *opt_ret_fc; + + if (len != sizeof(*opt_ret_fc)) { + LOG_ERR("ret_fc frame length %zu invalid", len); + result = BT_L2CAP_CONF_REJECT; + goto done; + } + + opt_ret_fc = (struct bt_l2cap_conf_opt_ret_fc *)buf->data; + + LOG_DBG("ret_fc mode %u", opt_ret_fc->mode); + + if (opt_ret_fc->mode != BT_L2CAP_RET_FC_MODE_BASIC) { + /* Set to default value */ + result = BT_L2CAP_CONF_UNACCEPT; + opt_ret_fc->mode = BT_L2CAP_RET_FC_MODE_BASIC; + } + +done: + return result; +} + +static uint16_t l2cap_br_conf_opt_fcs(struct bt_l2cap_chan *chan, + struct net_buf *buf, size_t len) +{ + uint16_t result = BT_L2CAP_CONF_SUCCESS; + struct bt_l2cap_conf_opt_fcs *opt_fcs; + + if (len != sizeof(*opt_fcs)) { + LOG_ERR("fcs frame length %zu invalid", len); + result = BT_L2CAP_CONF_REJECT; + goto done; + } + + opt_fcs = (struct bt_l2cap_conf_opt_fcs *)buf->data; + + LOG_DBG("FCS type %u", opt_fcs->type); + + if (opt_fcs->type != BT_L2CAP_FCS_TYPE_NO) { + /* Set to default value */ + result = BT_L2CAP_CONF_UNACCEPT; + opt_fcs->type = BT_L2CAP_FCS_TYPE_NO; + } + +done: + return result; +} + static void l2cap_br_conf_req(struct bt_l2cap_br *l2cap, uint8_t ident, uint16_t len, struct net_buf *buf) { @@ -1260,9 +1373,10 @@ static void l2cap_br_conf_req(struct bt_l2cap_br *l2cap, uint8_t ident, chan = bt_l2cap_br_lookup_rx_cid(conn, dcid); if (!chan) { LOG_ERR("rx channel mismatch!"); - struct bt_l2cap_cmd_reject_cid_data data = {.scid = req->dcid, - .dcid = 0, - }; + struct bt_l2cap_cmd_reject_cid_data data = { + .scid = req->dcid, + .dcid = 0, + }; l2cap_br_send_reject(conn, ident, BT_L2CAP_REJ_INVALID_CID, &data, sizeof(data)); @@ -1298,17 +1412,46 @@ static void l2cap_br_conf_req(struct bt_l2cap_br *l2cap, uint8_t ident, * way out here. */ goto send_rsp; + case BT_L2CAP_CONF_OPT_FLUSH_TIMEOUT: + result = l2cap_br_conf_opt_flush_timeout(chan, buf, opt->len); + if (result != BT_L2CAP_CONF_SUCCESS) { + goto send_rsp; + } + break; + case BT_L2CAP_CONF_OPT_QOS: + result = l2cap_br_conf_opt_qos(chan, buf, opt->len); + if (result != BT_L2CAP_CONF_SUCCESS) { + goto send_rsp; + } + break; + case BT_L2CAP_CONF_OPT_RET_FC: + result = l2cap_br_conf_opt_ret_fc(chan, buf, opt->len); + if (result != BT_L2CAP_CONF_SUCCESS) { + goto send_rsp; + } + break; + case BT_L2CAP_CONF_OPT_FCS: + result = l2cap_br_conf_opt_fcs(chan, buf, opt->len); + if (result != BT_L2CAP_CONF_SUCCESS) { + goto send_rsp; + } + break; + case BT_L2CAP_CONF_OPT_EXT_FLOW_SPEC: + __fallthrough; + case BT_L2CAP_CONF_OPT_EXT_WIN_SIZE: + result = BT_L2CAP_CONF_REJECT; + goto send_rsp; default: if (!hint) { LOG_DBG("option %u not handled", opt->type); result = BT_L2CAP_CONF_UNKNOWN_OPT; goto send_rsp; } - - /* Update buffer to point at next option */ - net_buf_pull(buf, opt->len); break; } + + /* Update buffer to point at next option */ + net_buf_pull(buf, opt->len); } send_rsp: @@ -1328,9 +1471,7 @@ static void l2cap_br_conf_req(struct bt_l2cap_br *l2cap, uint8_t ident, * the options chain need to be modified and taken into account when * sending back to peer. */ - if (result == BT_L2CAP_CONF_UNACCEPT) { - l2cap_br_conf_add_mtu(buf, BR_CHAN(chan)->tx.mtu); - } else if (result == BT_L2CAP_CONF_UNKNOWN_OPT) { + if ((result == BT_L2CAP_CONF_UNKNOWN_OPT) || (result == BT_L2CAP_CONF_UNACCEPT)) { if (opt) { l2cap_br_conf_add_opt(buf, opt); } diff --git a/subsys/bluetooth/host/classic/l2cap_br_internal.h b/subsys/bluetooth/host/classic/l2cap_br_internal.h index 91412e9200a4a..9d7ee4fa98582 100644 --- a/subsys/bluetooth/host/classic/l2cap_br_internal.h +++ b/subsys/bluetooth/host/classic/l2cap_br_internal.h @@ -93,6 +93,13 @@ struct bt_l2cap_conf_rsp { /* Option type used by MTU config request data */ #define BT_L2CAP_CONF_OPT_MTU 0x01 +#define BT_L2CAP_CONF_OPT_FLUSH_TIMEOUT 0x02 +#define BT_L2CAP_CONF_OPT_QOS 0x03 +#define BT_L2CAP_CONF_OPT_RET_FC 0x04 +#define BT_L2CAP_CONF_OPT_FCS 0x05 +#define BT_L2CAP_CONF_OPT_EXT_FLOW_SPEC 0x06 +#define BT_L2CAP_CONF_OPT_EXT_WIN_SIZE 0x07 + /* Options bits selecting most significant bit (hint) in type field */ #define BT_L2CAP_CONF_HINT 0x80 #define BT_L2CAP_CONF_MASK 0x7f @@ -103,6 +110,47 @@ struct bt_l2cap_conf_opt { uint8_t data[0]; } __packed; +struct bt_l2cap_conf_opt_mtu { + uint16_t mtu; +} __packed; + +struct bt_l2cap_conf_opt_flush_timeout { + uint16_t timeout; +} __packed; + +#define BT_L2CAP_QOS_TYPE_NO_TRAFFIC 0x00 +#define BT_L2CAP_QOS_TYPE_BEST_EFFORT 0x01 +#define BT_L2CAP_QOS_TYPE_GUARANTEED 0x02 +struct bt_l2cap_conf_opt_qos { + uint8_t flags; + uint8_t service_type; + uint32_t token_rate; + uint32_t token_bucket_size; + uint32_t peak_bandwidth; + uint32_t latency; + uint32_t delay_variation; +} __packed; + +#define BT_L2CAP_RET_FC_MODE_BASIC 0x00 +#define BT_L2CAP_RET_FC_MODE_RET 0x01 +#define BT_L2CAP_RET_FC_MODE_FC 0x02 +#define BT_L2CAP_RET_FC_MODE_ENH_RET 0x03 +#define BT_L2CAP_RET_FC_MODE_STREAM 0x04 +struct bt_l2cap_conf_opt_ret_fc { + uint8_t mode; + uint8_t tx_windows_size; + uint8_t max_transmit; + uint16_t retransmission_timeout; + uint16_t monitor_timeout; + uint16_t mps; +} __packed; + +#define BT_L2CAP_FCS_TYPE_NO 0x00 +#define BT_L2CAP_FCS_TYPE_16BIT 0x01 +struct bt_l2cap_conf_opt_fcs { + uint8_t type; +} __packed; + #define BT_L2CAP_DISCONN_REQ 0x06 struct bt_l2cap_disconn_req { uint16_t dcid; From 3561540110f4ee5dda9f0d7ea57d07a4aced23ab Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Thu, 20 Jun 2024 10:31:53 +0800 Subject: [PATCH 0303/4482] Bluetooth: L2CAP_BR: Set flags in CFG RSP The flags of L2CAP_CONFIGURATION_REQ are set. But in L2CAP_CONFIGURATION_RSP, all bits of flags are cleared. When used in the L2CAP_CONFIGURATION_RSP packet, the continuation flag shall be set to one if the flag is set to one in the Request. Copy flags from Request to Response if it is a successful result. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/l2cap_br.c | 10 ++++++++++ subsys/bluetooth/host/classic/l2cap_br_internal.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/subsys/bluetooth/host/classic/l2cap_br.c b/subsys/bluetooth/host/classic/l2cap_br.c index 1b4111401a729..e68b7a9006966 100644 --- a/subsys/bluetooth/host/classic/l2cap_br.c +++ b/subsys/bluetooth/host/classic/l2cap_br.c @@ -1466,6 +1466,16 @@ static void l2cap_br_conf_req(struct bt_l2cap_br *l2cap, uint8_t ident, rsp->result = sys_cpu_to_le16(result); rsp->scid = sys_cpu_to_le16(BR_CHAN(chan)->tx.cid); + /* + * Core 5.4, Vol 3, Part A, section 4.5. + * When used in the L2CAP_CONFIGURATION_RSP packet, + * the continuation flag shall be set to one if the + * flag is set to one in the Request, except for + * those error conditions more appropriate for an + * L2CAP_COMMAND_REJECT_RSP packet. + */ + rsp->flags = sys_cpu_to_le16(flags & BT_L2CAP_CONF_FLAGS_MASK); + /* * TODO: If options other than MTU became meaningful then processing * the options chain need to be modified and taken into account when diff --git a/subsys/bluetooth/host/classic/l2cap_br_internal.h b/subsys/bluetooth/host/classic/l2cap_br_internal.h index 9d7ee4fa98582..92a760173ede8 100644 --- a/subsys/bluetooth/host/classic/l2cap_br_internal.h +++ b/subsys/bluetooth/host/classic/l2cap_br_internal.h @@ -76,6 +76,9 @@ struct bt_l2cap_conn_rsp { #define BT_L2CAP_CONF_PENDING 0x0004 #define BT_L2CAP_CONF_FLOW_SPEC_REJECT 0x0005 +#define BT_L2CAP_CONF_FLAGS_C BIT(0) +#define BT_L2CAP_CONF_FLAGS_MASK BT_L2CAP_CONF_FLAGS_C + #define BT_L2CAP_CONF_REQ 0x04 struct bt_l2cap_conf_req { uint16_t dcid; From 7e54f13e7b429b87b495f22dd2e57e8dc7a50144 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Wed, 19 Jun 2024 19:19:31 +0800 Subject: [PATCH 0304/4482] Bluetooth: l2cap_br: Support Multi-Command Packet Improve L2CAP BR to handle more than one signaling command in one receiving L2CAP packet. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/l2cap_br.c | 63 +++++++++++++++--------- 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/subsys/bluetooth/host/classic/l2cap_br.c b/subsys/bluetooth/host/classic/l2cap_br.c index e68b7a9006966..ebba6cf1fc9c5 100644 --- a/subsys/bluetooth/host/classic/l2cap_br.c +++ b/subsys/bluetooth/host/classic/l2cap_br.c @@ -1833,31 +1833,15 @@ int bt_l2cap_br_chan_send(struct bt_l2cap_chan *chan, struct net_buf *buf) return bt_l2cap_br_chan_send_cb(chan, buf, NULL, NULL); } -static int l2cap_br_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) +static void l2cap_br_sig_handle(struct bt_l2cap_br *l2cap, struct bt_l2cap_sig_hdr *hdr, + struct net_buf *buf) { - struct bt_l2cap_br *l2cap = CONTAINER_OF(chan, struct bt_l2cap_br, chan.chan); - struct bt_l2cap_sig_hdr *hdr; uint16_t len; + struct net_buf_simple_state state; - if (buf->len < sizeof(*hdr)) { - LOG_ERR("Too small L2CAP signaling PDU"); - return 0; - } - - hdr = net_buf_pull_mem(buf, sizeof(*hdr)); len = sys_le16_to_cpu(hdr->len); - LOG_DBG("Signaling code 0x%02x ident %u len %u", hdr->code, hdr->ident, len); - - if (buf->len != len) { - LOG_ERR("L2CAP length mismatch (%u != %u)", buf->len, len); - return 0; - } - - if (!hdr->ident) { - LOG_ERR("Invalid ident value in L2CAP PDU"); - return 0; - } + net_buf_simple_save(&buf->b, &state); switch (hdr->code) { case BT_L2CAP_INFO_RSP: @@ -1886,11 +1870,46 @@ static int l2cap_br_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) break; default: LOG_WRN("Unknown/Unsupported L2CAP PDU code 0x%02x", hdr->code); - l2cap_br_send_reject(chan->conn, hdr->ident, - BT_L2CAP_REJ_NOT_UNDERSTOOD, NULL, 0); + l2cap_br_send_reject(l2cap->chan.chan.conn, hdr->ident, + BT_L2CAP_REJ_NOT_UNDERSTOOD, NULL, 0); break; } + net_buf_simple_restore(&buf->b, &state); + (void)net_buf_pull_mem(buf, len); +} + +static int l2cap_br_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) +{ + struct bt_l2cap_br *l2cap = CONTAINER_OF(chan, struct bt_l2cap_br, chan.chan); + struct bt_l2cap_sig_hdr *hdr; + uint16_t len; + + while (buf->len > 0) { + if (buf->len < sizeof(*hdr)) { + LOG_ERR("Too small L2CAP signaling PDU"); + return 0; + } + + hdr = net_buf_pull_mem(buf, sizeof(*hdr)); + len = sys_le16_to_cpu(hdr->len); + + LOG_DBG("Signaling code 0x%02x ident %u len %u", hdr->code, hdr->ident, len); + + if (buf->len < len) { + LOG_ERR("L2CAP length is short (%u < %u)", buf->len, len); + return 0; + } + + if (!hdr->ident) { + LOG_ERR("Invalid ident value in L2CAP PDU"); + (void)net_buf_pull_mem(buf, len); + continue; + } + + l2cap_br_sig_handle(l2cap, hdr, buf); + } + return 0; } From c7c1f730451f21e9387c1963e966495238d8ef25 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Thu, 6 Jun 2024 17:26:05 +0800 Subject: [PATCH 0305/4482] Bluetooth: SSP: Support security level 4 Currently, error code `-ENOTSUP` will be returned if start security with security level 4. For SC supported case, level 4 for ssp should be supported. Remove the code limitation to support security level 4. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/ssp.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/subsys/bluetooth/host/classic/ssp.c b/subsys/bluetooth/host/classic/ssp.c index ea8f1655ab520..124ee1fe87ba2 100644 --- a/subsys/bluetooth/host/classic/ssp.c +++ b/subsys/bluetooth/host/classic/ssp.c @@ -355,10 +355,6 @@ int bt_ssp_start_security(struct bt_conn *conn) return -EBUSY; } - if (conn->required_sec_level > BT_SECURITY_L3) { - return -ENOTSUP; - } - if (get_io_capa() == BT_IO_NO_INPUT_OUTPUT && conn->required_sec_level > BT_SECURITY_L2) { return -EINVAL; From 3756429b6c7f2d7f3b521cc1db5862314c57175d Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Thu, 6 Jun 2024 11:38:11 +0800 Subject: [PATCH 0306/4482] Bluetooth: BREDR: L2CAP: Recover ident when conn is pending The `ident` of L2CAP BR connection req will be cleared if function l2cap_br_conn_req_reply called to send L2CAP BR connection rsp with result `BT_L2CAP_BR_PENDING`. Then the invalid `ident` (it is zero) will be filled in the L2CAP BR connection rsp after the ACL connection is encrypted. Recover `ident` if the result of the connection rsp is `BT_L2CAP_BR_PENDING`. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/l2cap_br.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/subsys/bluetooth/host/classic/l2cap_br.c b/subsys/bluetooth/host/classic/l2cap_br.c index ebba6cf1fc9c5..e5c52d6e208fe 100644 --- a/subsys/bluetooth/host/classic/l2cap_br.c +++ b/subsys/bluetooth/host/classic/l2cap_br.c @@ -1075,6 +1075,9 @@ static void l2cap_br_conn_req(struct bt_l2cap_br *l2cap, uint8_t ident, /* Disconnect link when security rules were violated */ if (result == BT_L2CAP_BR_ERR_SEC_BLOCK) { bt_conn_disconnect(conn, BT_HCI_ERR_AUTH_FAIL); + } else if (result == BT_L2CAP_BR_PENDING) { + /* Recover the ident when conn is pending */ + br_chan->ident = ident; } return; From 7d1953918a615f53ef06a020d7ebc645576fb3ba Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Sat, 21 Sep 2024 15:42:59 +0700 Subject: [PATCH 0307/4482] net: wifi: shell: enhance consistency in `cmd_wifi_dpp_ap_auth_init` The `cmd_wifi_dpp_ap_auth_init` function was added but is not yet aligned with others. This update enhances consistency with the following changes: - Unified the order of declaration for `opt`, `opt_index`, `state`, and `long_options`. - Wrapped lines in the `long_options` declaration to prevent them from extending too far to the right. - Applied `struct option` as `static const` - Unified the wrapping of `getopt_long` calls, regardless of the length of the `options` string. - Using `getopt_state` to access `optarg` and also `optopt` offers a better alternative to direct global access. Signed-off-by: Pisit Sawangvonganan --- subsys/net/l2/wifi/wifi_shell.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 64bee4035ae9f..f7b648cc24ee7 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -2579,24 +2579,27 @@ static int cmd_wifi_dpp_ap_qr_code(const struct shell *sh, size_t argc, char *ar static int cmd_wifi_dpp_ap_auth_init(const struct shell *sh, size_t argc, char *argv[]) { - int ret = 0; - struct net_if *iface = net_if_get_wifi_sap(); - struct wifi_dpp_params params = {0}; int opt; int opt_index = 0; struct getopt_state *state; - static struct option long_options[] = {{"peer", required_argument, 0, 'p'}, {0, 0, 0, 0}}; + static const struct option long_options[] = { + {"peer", required_argument, 0, 'p'}, + {0, 0, 0, 0}}; + int ret = 0; + struct net_if *iface = net_if_get_wifi_sap(); + struct wifi_dpp_params params = {0}; params.action = WIFI_DPP_AUTH_INIT; - while ((opt = getopt_long(argc, argv, "p:", long_options, &opt_index)) != -1) { + while ((opt = getopt_long(argc, argv, "p:", + long_options, &opt_index)) != -1) { state = getopt_state_get(); switch (opt) { case 'p': - params.auth_init.peer = shell_strtol(optarg, 10, &ret); + params.auth_init.peer = shell_strtol(state->optarg, 10, &ret); break; default: - PR_ERROR("Invalid option %c\n", optopt); + PR_ERROR("Invalid option %c\n", state->optopt); return -EINVAL; } From 82ec1d7862102cfb72da60b1a7a215a7b70c2713 Mon Sep 17 00:00:00 2001 From: Rex Chen Date: Mon, 19 Aug 2024 23:09:26 -0700 Subject: [PATCH 0308/4482] net: wifi: shell: add wps support Add wps pin and wps pbc L2 layer cmd support. Signed-off-by: Rex Chen --- include/zephyr/net/wifi_mgmt.h | 36 ++++++++- modules/hostap/src/supp_api.c | 89 ++++++++++++++++++++++- modules/hostap/src/supp_api.h | 9 +++ modules/hostap/src/supp_main.c | 1 + samples/net/wifi/boards/rd_rw612_bga.conf | 1 + subsys/net/l2/wifi/wifi_mgmt.c | 15 ++++ subsys/net/l2/wifi/wifi_shell.c | 58 +++++++++++++++ 7 files changed, 207 insertions(+), 2 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index db90f27500d12..0f0054e4acb74 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -106,7 +106,9 @@ enum net_request_wifi_cmd { NET_REQUEST_WIFI_CMD_ENTERPRISE_CREDS, /** Get RTS threshold */ NET_REQUEST_WIFI_CMD_RTS_THRESHOLD_CONFIG, -/** @cond INTERNAL_HIDDEN */ + /** WPS config */ + NET_REQUEST_WIFI_CMD_WPS_CONFIG, + /** @cond INTERNAL_HIDDEN */ NET_REQUEST_WIFI_CMD_MAX /** @endcond */ }; @@ -250,6 +252,10 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_ENTERPRISE_CREDS); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_RTS_THRESHOLD_CONFIG); +#define NET_REQUEST_WIFI_WPS_CONFIG (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_WPS_CONFIG) + +NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_WPS_CONFIG); + /** @brief Wi-Fi management events */ enum net_event_wifi_cmd { /** Scan results available */ @@ -1022,6 +1028,26 @@ struct wifi_dpp_params { }; }; +#define WIFI_WPS_PIN_MAX_LEN 8 + +/** Operation for WPS */ +enum wifi_wps_op { + /** WPS pbc */ + WIFI_WPS_PBC = 0, + /** Get WPS pin number */ + WIFI_WPS_PIN_GET = 1, + /** Set WPS pin number */ + WIFI_WPS_PIN_SET = 2, +}; + +/** Wi-Fi wps setup */ +struct wifi_wps_config_params { + /** wps operation */ + enum wifi_wps_op oper; + /** pin value*/ + char pin[WIFI_WPS_PIN_MAX_LEN + 1]; +}; + #include /** Scan result callback @@ -1262,6 +1288,14 @@ struct wifi_mgmt_ops { * @return 0 if ok, < 0 if error */ int (*get_rts_threshold)(const struct device *dev, unsigned int *rts_threshold); + /** Start a WPS PBC/PIN connection + * + * @param dev Pointer to the device structure for the driver instance + * @param params wps operarion parameters + * + * @return 0 if ok, < 0 if error + */ + int (*wps_config)(const struct device *dev, struct wifi_wps_config_params *params); }; /** Wi-Fi management offload API */ diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index 6aa4ff51ab58f..d30476dcba92a 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -35,7 +35,9 @@ static struct wifi_connect_req_params last_wifi_conn_params; enum requested_ops { CONNECT = 0, - DISCONNECT + DISCONNECT, + WPS_PBC, + WPS_PIN, }; enum status_thread_state { @@ -1259,6 +1261,91 @@ int supplicant_get_wifi_conn_params(const struct device *dev, return ret; } +static int supplicant_wps_pbc(const struct device *dev) +{ + struct wpa_supplicant *wpa_s; + int ret = -1; + + k_mutex_lock(&wpa_supplicant_mutex, K_FOREVER); + + wpa_s = get_wpa_s_handle(dev); + if (!wpa_s) { + ret = -1; + wpa_printf(MSG_ERROR, "Interface %s not found", dev->name); + goto out; + } + + if (!wpa_cli_cmd_v("wps_pbc")) { + goto out; + } + + wpas_api_ctrl.dev = dev; + wpas_api_ctrl.requested_op = WPS_PBC; + + ret = 0; + +out: + k_mutex_unlock(&wpa_supplicant_mutex); + + return ret; +} + +static int supplicant_wps_pin(const struct device *dev, struct wifi_wps_config_params *params) +{ + struct wpa_supplicant *wpa_s; + char *get_pin_cmd = "WPS_PIN get"; + int ret = -1; + + k_mutex_lock(&wpa_supplicant_mutex, K_FOREVER); + + wpa_s = get_wpa_s_handle(dev); + if (!wpa_s) { + ret = -1; + wpa_printf(MSG_ERROR, "Interface %s not found", dev->name); + goto out; + } + + if (params->oper == WIFI_WPS_PIN_GET) { + if (zephyr_wpa_cli_cmd_resp(get_pin_cmd, params->pin)) { + goto out; + } + } else if (params->oper == WIFI_WPS_PIN_SET) { + if (!wpa_cli_cmd_v("wps_check_pin %s", params->pin)) { + goto out; + } + + if (!wpa_cli_cmd_v("wps_pin any %s", params->pin)) { + goto out; + } + + wpas_api_ctrl.dev = dev; + wpas_api_ctrl.requested_op = WPS_PIN; + } else { + wpa_printf(MSG_ERROR, "Error wps pin operation : %d", params->oper); + goto out; + } + + ret = 0; + +out: + k_mutex_unlock(&wpa_supplicant_mutex); + + return ret; +} + +int supplicant_wps_config(const struct device *dev, struct wifi_wps_config_params *params) +{ + int ret = 0; + + if (params->oper == WIFI_WPS_PBC) { + ret = supplicant_wps_pbc(dev); + } else if (params->oper == WIFI_WPS_PIN_GET || params->oper == WIFI_WPS_PIN_SET) { + ret = supplicant_wps_pin(dev, params); + } + + return ret; +} + #ifdef CONFIG_AP #ifdef CONFIG_WIFI_NM_HOSTAPD_AP int hapd_state(const struct device *dev, int *state) diff --git a/modules/hostap/src/supp_api.h b/modules/hostap/src/supp_api.h index 39be9afce4924..433c5e0347e90 100644 --- a/modules/hostap/src/supp_api.h +++ b/modules/hostap/src/supp_api.h @@ -215,6 +215,15 @@ int supplicant_btm_query(const struct device *dev, uint8_t reason); int supplicant_get_wifi_conn_params(const struct device *dev, struct wifi_connect_req_params *params); +/** Start a WPS PBC/PIN connection + * + * @param dev Pointer to the device structure for the driver instance + * @param params wps operarion parameters + * + * @return 0 if ok, < 0 if error + */ +int supplicant_wps_config(const struct device *dev, struct wifi_wps_config_params *params); + #ifdef CONFIG_AP #ifdef CONFIG_WIFI_NM_HOSTAPD_AP /** diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index 1aedf73bb9a5f..9b6d38eea20aa 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -75,6 +75,7 @@ static const struct wifi_mgmt_ops mgmt_ops = { .btm_query = supplicant_btm_query, #endif .get_conn_params = supplicant_get_wifi_conn_params, + .wps_config = supplicant_wps_config, #ifdef CONFIG_AP .ap_enable = supplicant_ap_enable, .ap_disable = supplicant_ap_disable, diff --git a/samples/net/wifi/boards/rd_rw612_bga.conf b/samples/net/wifi/boards/rd_rw612_bga.conf index 1df1baa0be7a9..e6ec09aff90d1 100644 --- a/samples/net/wifi/boards/rd_rw612_bga.conf +++ b/samples/net/wifi/boards/rd_rw612_bga.conf @@ -85,6 +85,7 @@ CONFIG_WIFI_NM_WPA_SUPPLICANT_INF_MON=n CONFIG_WIFI_NM_MAX_MANAGED_INTERFACES=2 CONFIG_SAE_PWE_EARLY_EXIT=y CONFIG_WIFI_NM_HOSTAPD_AP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_WPS=y # Enable mbedtls CONFIG_MBEDTLS=y diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 1580d2f84866a..27e065cccced0 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -813,6 +813,21 @@ static int wifi_get_connection_params(uint32_t mgmt_request, struct net_if *ifac NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_CONN_PARAMS, wifi_get_connection_params); +static int wifi_wps_config(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) +{ + const struct device *dev = net_if_get_device(iface); + const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_api(iface); + struct wifi_wps_config_params *params = data; + + if (wifi_mgmt_api == NULL || wifi_mgmt_api->wps_config == NULL) { + return -ENOTSUP; + } + + return wifi_mgmt_api->wps_config(dev, params); +} + +NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_WPS_CONFIG, wifi_wps_config); + static int wifi_set_rts_threshold(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index f7b648cc24ee7..4c098ff927d61 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1690,6 +1690,57 @@ static int cmd_wifi_btm_query(const struct shell *sh, size_t argc, char *argv[]) } #endif +static int cmd_wifi_wps_pbc(const struct shell *sh, size_t argc, char *argv[]) +{ + struct net_if *iface = net_if_get_first_wifi(); + struct wifi_wps_config_params params = {0}; + + context.sh = sh; + + if (argc == 1) { + params.oper = WIFI_WPS_PBC; + } else { + shell_help(sh); + return -ENOEXEC; + } + + if (net_mgmt(NET_REQUEST_WIFI_WPS_CONFIG, iface, ¶ms, sizeof(params))) { + PR_WARNING("Start wps pbc connection failed\n"); + return -ENOEXEC; + } + + return 0; +} + +static int cmd_wifi_wps_pin(const struct shell *sh, size_t argc, char *argv[]) +{ + struct net_if *iface = net_if_get_first_wifi(); + struct wifi_wps_config_params params = {0}; + + context.sh = sh; + + if (argc == 1) { + params.oper = WIFI_WPS_PIN_GET; + } else if (argc == 2) { + params.oper = WIFI_WPS_PIN_SET; + strncpy(params.pin, argv[1], WIFI_WPS_PIN_MAX_LEN); + } else { + shell_help(sh); + return -ENOEXEC; + } + + if (net_mgmt(NET_REQUEST_WIFI_WPS_CONFIG, iface, ¶ms, sizeof(params))) { + PR_WARNING("Start wps pin connection failed\n"); + return -ENOEXEC; + } + + if (params.oper == WIFI_WPS_PIN_GET) { + PR("WPS PIN is: %s\n", params.pin); + } + + return 0; +} + static int cmd_wifi_ps_wakeup_mode(const struct shell *sh, size_t argc, char *argv[]) { struct net_if *iface = net_if_get_first_wifi(); @@ -2912,6 +2963,13 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, cmd_wifi_btm_query, 2, 0), #endif + SHELL_CMD_ARG(wps_pbc, NULL, + "Start a WPS PBC connection.\n", + cmd_wifi_wps_pbc, 1, 0), + SHELL_CMD_ARG(wps_pin, NULL, + "Set and get WPS pin.\n" + "[pin] Only applicable for set.\n", + cmd_wifi_wps_pin, 1, 1), SHELL_CMD_ARG(ps_timeout, NULL, " - PS inactivity timer(in ms).\n", From b6aed5c505e69f6200cdf9d3c1c549d47c126849 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Fri, 4 Oct 2024 18:21:49 -0400 Subject: [PATCH 0309/4482] kernel: dynamic: use 4k stack size for x86 x86 architectures require a dynamic stack size that is a multiple of 4096 bytes due to mmu restrictions. For example, this test would previously fail when using the default dynamic stack size of 1024 bytes for 32-bit platforms. ``` west build -p auto -b qemu_x86/atom/nopae -t run \ tests/posix/common/ -- -DCONFIG_USERSPACE=y ``` It would pass with an additional argument ``` west build -p auto -b qemu_x86/atom/nopae -t run \ tests/posix/common/ -- -DCONFIG_USERSPACE=y \ -DCONFIG_DYNAMIC_THREAD_STACK_SIZE=4096 ``` Add a special default for x86 when using dynamic thread stacks. The x86 default removes the need for `boards/qemu_x86*.conf`, with the exception of `qemu_x86_tiny`. qemu_x86_tiny did not have sufficient memory (or configuration) to run the non-userspace tests, so bump up the available ram from 256k to 512k for this test and clone the .conf from the demand paging tests. Eventually, the common posix test should be split into more concise functional categories. Signed-off-by: Chris Friedt --- kernel/Kconfig | 5 +++-- tests/posix/common/boards/qemu_x86.conf | 1 - tests/posix/common/boards/qemu_x86_64.conf | 1 - tests/posix/common/boards/qemu_x86_tiny.conf | 16 ++++++++++++++++ tests/posix/common/boards/qemu_x86_tiny.overlay | 11 +++++++++++ 5 files changed, 30 insertions(+), 4 deletions(-) delete mode 100644 tests/posix/common/boards/qemu_x86.conf delete mode 100644 tests/posix/common/boards/qemu_x86_64.conf create mode 100644 tests/posix/common/boards/qemu_x86_tiny.conf create mode 100644 tests/posix/common/boards/qemu_x86_tiny.overlay diff --git a/kernel/Kconfig b/kernel/Kconfig index 54e0ccf1f2d89..0553161eca1ee 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -245,8 +245,9 @@ if DYNAMIC_THREAD config DYNAMIC_THREAD_STACK_SIZE int "Size of each pre-allocated thread stack" - default 1024 if !64BIT - default 2048 if 64BIT + default 4096 if X86 + default 1024 if !X86 && !64BIT + default 2048 if !X86 && 64BIT help Default stack size (in bytes) for dynamic threads. diff --git a/tests/posix/common/boards/qemu_x86.conf b/tests/posix/common/boards/qemu_x86.conf deleted file mode 100644 index 2fa43926ee48f..0000000000000 --- a/tests/posix/common/boards/qemu_x86.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_DYNAMIC_THREAD_STACK_SIZE=4096 diff --git a/tests/posix/common/boards/qemu_x86_64.conf b/tests/posix/common/boards/qemu_x86_64.conf deleted file mode 100644 index 2fa43926ee48f..0000000000000 --- a/tests/posix/common/boards/qemu_x86_64.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_DYNAMIC_THREAD_STACK_SIZE=4096 diff --git a/tests/posix/common/boards/qemu_x86_tiny.conf b/tests/posix/common/boards/qemu_x86_tiny.conf new file mode 100644 index 0000000000000..01506ce9f553c --- /dev/null +++ b/tests/posix/common/boards/qemu_x86_tiny.conf @@ -0,0 +1,16 @@ +# Copyright (c) 2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +# The test is highly sensitive to size of kernel image. +# However, specifying how many pages used by +# the backing store must be done in build time. +# So here we are, tuning this manually. +CONFIG_BACKING_STORE_RAM_PAGES=12 + +# The following is needed so that .text and following +# sections are present in physical memory to test +# using backing store for anonymous memory. +CONFIG_KERNEL_VM_BASE=0x0 +CONFIG_LINKER_GENERIC_SECTIONS_PRESENT_AT_BOOT=y +CONFIG_BACKING_STORE_RAM=y +CONFIG_BACKING_STORE_QEMU_X86_TINY_FLASH=n diff --git a/tests/posix/common/boards/qemu_x86_tiny.overlay b/tests/posix/common/boards/qemu_x86_tiny.overlay new file mode 100644 index 0000000000000..f717f3ff7edc7 --- /dev/null +++ b/tests/posix/common/boards/qemu_x86_tiny.overlay @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2024, Tenstorrent AI ULC + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + dram0: memory@0 { + reg = <0x100000 0x80000>; + }; +}; From 38c9a7409973b9c69cb872e1059dfb39e022b158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Kr=C3=BCger?= Date: Mon, 23 Sep 2024 08:38:01 +0200 Subject: [PATCH 0310/4482] kernel.h: Fix k_msgq_get retval doxygen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added a hint about -ENOMSG being returned when the queue is purged. Signed-off-by: Marcel Krüger --- include/zephyr/kernel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/kernel.h b/include/zephyr/kernel.h index a6cf554fd2642..e5f790abfe67a 100644 --- a/include/zephyr/kernel.h +++ b/include/zephyr/kernel.h @@ -4684,7 +4684,7 @@ __syscall int k_msgq_put(struct k_msgq *msgq, const void *data, k_timeout_t time * K_FOREVER. * * @retval 0 Message received. - * @retval -ENOMSG Returned without waiting. + * @retval -ENOMSG Returned without waiting or queue purged. * @retval -EAGAIN Waiting period timed out. */ __syscall int k_msgq_get(struct k_msgq *msgq, void *data, k_timeout_t timeout); From 82a00c9cb87afda107cc5bf3ce6fb5901bc6fff0 Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Fri, 27 Sep 2024 15:26:23 -0500 Subject: [PATCH 0311/4482] soc: adi: max32: Indicate Segger RTT support Sets CONFIG_HAS_SEGGER_RTT on the max32 soc family to allow using RTT backends in the logging, shell, and tracing subsystems. Signed-off-by: Maureen Helm --- soc/adi/max32/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/soc/adi/max32/Kconfig b/soc/adi/max32/Kconfig index c845cc6c35c61..8f1b8d9eb2d9e 100644 --- a/soc/adi/max32/Kconfig +++ b/soc/adi/max32/Kconfig @@ -11,6 +11,7 @@ config SOC_FAMILY_MAX32 select CLOCK_CONTROL select BUILD_OUTPUT_HEX select SOC_EARLY_INIT_HOOK + select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE config SOC_MAX32655 select CPU_CORTEX_M4 From d022d315d2e006ad1eb13f3f72a00a99b4ff7fb0 Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Fri, 27 Sep 2024 15:43:24 -0500 Subject: [PATCH 0312/4482] tracing: Fix sysview for soc families not subdivided into series Fixes the systemview tracing backend for soc families, such as max32, that don't subdivide into soc series and therefore don't define CONFIG_SOC_SERIES. Use CONFIG_SOC_FAMILY instead in the system description since it should always be defined. Signed-off-by: Maureen Helm --- subsys/tracing/sysview/sysview_config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/tracing/sysview/sysview_config.c b/subsys/tracing/sysview/sysview_config.c index 0ef395e451627..aa11f4beae800 100644 --- a/subsys/tracing/sysview/sysview_config.c +++ b/subsys/tracing/sysview/sysview_config.c @@ -51,7 +51,7 @@ static void cbSendSystemDesc(void) { SEGGER_SYSVIEW_SendSysDesc("N=" CONFIG_SEGGER_SYSVIEW_APP_NAME); SEGGER_SYSVIEW_SendSysDesc("D=" CONFIG_BOARD " " - CONFIG_SOC_SERIES " " CONFIG_ARCH); + CONFIG_SOC_FAMILY " " CONFIG_ARCH); SEGGER_SYSVIEW_SendSysDesc("O=Zephyr"); } From bf0e6d7c8348a15286b060fdefd9408140a654b1 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Fri, 13 Sep 2024 08:35:38 +0300 Subject: [PATCH 0313/4482] secure_storage: introduce the secure storage subsystem Implements RFC https://github.com/zephyrproject-rtos/zephyr/issues/75275. See also the PR (https://github.com/zephyrproject-rtos/zephyr/pull/76222) for more information. Signed-off-by: Tomi Fontanilles --- MAINTAINERS.yml | 8 + subsys/CMakeLists.txt | 1 + subsys/Kconfig | 1 + subsys/secure_storage/CMakeLists.txt | 48 ++++ subsys/secure_storage/Kconfig | 102 ++++++++ subsys/secure_storage/Kconfig.its_store | 34 +++ subsys/secure_storage/Kconfig.its_transform | 134 ++++++++++ .../internal/zephyr/secure_storage/common.h | 19 ++ .../internal/zephyr/secure_storage/its.h | 31 +++ .../zephyr/secure_storage/its/common.h | 30 +++ .../zephyr/secure_storage/its/store.h | 52 ++++ .../zephyr/secure_storage/its/transform.h | 62 +++++ .../secure_storage/its/transform/aead_get.h | 45 ++++ .../internal/zephyr/secure_storage/ps.h | 39 +++ subsys/secure_storage/include/psa/error.h | 29 +++ .../include/psa/internal_trusted_storage.h | 126 +++++++++ .../include/psa/protected_storage.h | 241 ++++++++++++++++++ .../include/psa/storage_common.h | 51 ++++ subsys/secure_storage/src/CMakeLists.txt | 6 + subsys/secure_storage/src/its/CMakeLists.txt | 29 +++ .../secure_storage/src/its/implementation.c | 228 +++++++++++++++++ .../secure_storage/src/its/store_settings.c | 116 +++++++++ .../secure_storage/src/its/transform/aead.c | 131 ++++++++++ .../src/its/transform/aead_get.c | 144 +++++++++++ subsys/secure_storage/src/log.c | 6 + 25 files changed, 1713 insertions(+) create mode 100644 subsys/secure_storage/CMakeLists.txt create mode 100644 subsys/secure_storage/Kconfig create mode 100644 subsys/secure_storage/Kconfig.its_store create mode 100644 subsys/secure_storage/Kconfig.its_transform create mode 100644 subsys/secure_storage/include/internal/zephyr/secure_storage/common.h create mode 100644 subsys/secure_storage/include/internal/zephyr/secure_storage/its.h create mode 100644 subsys/secure_storage/include/internal/zephyr/secure_storage/its/common.h create mode 100644 subsys/secure_storage/include/internal/zephyr/secure_storage/its/store.h create mode 100644 subsys/secure_storage/include/internal/zephyr/secure_storage/its/transform.h create mode 100644 subsys/secure_storage/include/internal/zephyr/secure_storage/its/transform/aead_get.h create mode 100644 subsys/secure_storage/include/internal/zephyr/secure_storage/ps.h create mode 100644 subsys/secure_storage/include/psa/error.h create mode 100644 subsys/secure_storage/include/psa/internal_trusted_storage.h create mode 100644 subsys/secure_storage/include/psa/protected_storage.h create mode 100644 subsys/secure_storage/include/psa/storage_common.h create mode 100644 subsys/secure_storage/src/CMakeLists.txt create mode 100644 subsys/secure_storage/src/its/CMakeLists.txt create mode 100644 subsys/secure_storage/src/its/implementation.c create mode 100644 subsys/secure_storage/src/its/store_settings.c create mode 100644 subsys/secure_storage/src/its/transform/aead.c create mode 100644 subsys/secure_storage/src/its/transform/aead_get.c create mode 100644 subsys/secure_storage/src/log.c diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index b1ee4baa3f211..1bd58884c7fee 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -4107,6 +4107,14 @@ RTIO: tests: - rtio +Secure storage: + status: maintained + maintainers: + - tomi-font + files: + - subsys/secure_storage/ + labels: + - "area: Secure storage" Storage: status: odd fixes files: diff --git a/subsys/CMakeLists.txt b/subsys/CMakeLists.txt index 42cd98c775ca8..b4ea9eb476285 100644 --- a/subsys/CMakeLists.txt +++ b/subsys/CMakeLists.txt @@ -50,6 +50,7 @@ add_subdirectory_ifdef(CONFIG_MODEM_MODULES modem) add_subdirectory_ifdef(CONFIG_NETWORKING net) add_subdirectory_ifdef(CONFIG_PROFILING profiling) add_subdirectory_ifdef(CONFIG_RETENTION retention) +add_subdirectory_ifdef(CONFIG_SECURE_STORAGE secure_storage) add_subdirectory_ifdef(CONFIG_SENSING sensing) add_subdirectory_ifdef(CONFIG_SETTINGS settings) add_subdirectory_ifdef(CONFIG_SHELL shell) diff --git a/subsys/Kconfig b/subsys/Kconfig index 59c7fa1721018..561d526342268 100644 --- a/subsys/Kconfig +++ b/subsys/Kconfig @@ -38,6 +38,7 @@ source "subsys/random/Kconfig" source "subsys/retention/Kconfig" source "subsys/rtio/Kconfig" source "subsys/sd/Kconfig" +source "subsys/secure_storage/Kconfig" source "subsys/sensing/Kconfig" source "subsys/settings/Kconfig" source "subsys/shell/Kconfig" diff --git a/subsys/secure_storage/CMakeLists.txt b/subsys/secure_storage/CMakeLists.txt new file mode 100644 index 0000000000000..a15c1b24f441d --- /dev/null +++ b/subsys/secure_storage/CMakeLists.txt @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library() +zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS) +zephyr_library_include_directories(include/internal) # secure_storage headers +add_subdirectory(src) + +# Make the subsystem's PSA Secure Storage API headers available only when it's enabled. +zephyr_include_directories( + include +) + +# Make the secure_storage headers available to the application only when it's implementing the relevant APIs. +function(make_available header) + if (NOT header STREQUAL "common.h") + make_available(common.h) + endif() + if ((header MATCHES "^its") AND NOT (header STREQUAL "its/common.h")) + make_available(its/common.h) + endif() + configure_file(include/internal/zephyr/secure_storage/${header} + ${CMAKE_BINARY_DIR}/zephyr/include/generated/zephyr/secure_storage/${header} + COPYONLY) +endfunction() + +if (CONFIG_SECURE_STORAGE_ITS_IMPLEMENTATION_CUSTOM) + make_available(its.h) +endif() + +if (CONFIG_SECURE_STORAGE_PS_IMPLEMENTATION_CUSTOM) + make_available(ps.h) +endif() + +if (CONFIG_SECURE_STORAGE_ITS_TRANSFORM_IMPLEMENTATION_CUSTOM + OR (CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_CUSTOM + AND CONFIG_SECURE_STORAGE_ITS_TRANSFORM_MODULE)) + make_available(its/transform.h) +endif() + +if (CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_CUSTOM) + make_available(its/store.h) +endif() + +if (CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_SCHEME_CUSTOM + OR CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER_CUSTOM + OR CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_NONCE_PROVIDER_CUSTOM) + make_available(its/transform/aead_get.h) +endif() diff --git a/subsys/secure_storage/Kconfig b/subsys/secure_storage/Kconfig new file mode 100644 index 0000000000000..11e78a7dbd2ce --- /dev/null +++ b/subsys/secure_storage/Kconfig @@ -0,0 +1,102 @@ +# Copyright (c) 2024 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +menuconfig SECURE_STORAGE + bool "Secure storage subsystem" + depends on !BUILD_WITH_TFM + select EXPERIMENTAL + help + The secure storage subsystem provides an implementation of the PSA Secure Storage API + functions on board targets that don't already have one. + It allows making use of the PSA Secure Storage API and persistent keys in the PSA Crypto + API in a standard and portable way. + It is configurable and different implementations can be used to accommodate the varying + capabilities of different devices. + In addition to providing functional support for the PSA Secure Storage API, depending on + the device-specific security features that are available and used, the subsystem may + secure the data stored through it at rest. + This is however highly dependent on the device and configuration in use, and not a + guarantee of the subsystem. + +if SECURE_STORAGE + +module = SECURE_STORAGE +module-str = secure_storage +source "subsys/logging/Kconfig.template.log_config" + +choice SECURE_STORAGE_ITS_IMPLEMENTATION + prompt "Internal Trusted Storage (ITS) API implementation" + +config SECURE_STORAGE_ITS_IMPLEMENTATION_ZEPHYR + bool "Zephyr's ITS implementation" + select SECURE_STORAGE_ITS_TRANSFORM_MODULE + select SECURE_STORAGE_ITS_STORE_MODULE + help + Use Zephyr's implementation of the ITS API. + It calls into the transform and store modules, which + can be configured and have custom implementations. + +config SECURE_STORAGE_ITS_IMPLEMENTATION_CUSTOM + bool "Custom ITS implementation" + help + A custom implementation of the ITS API is present. + Implement the functions declared in . + The header is made available when this Kconfig option is enabled. + +endchoice # SECURE_STORAGE_ITS_IMPLEMENTATION + +config SECURE_STORAGE_ITS_MAX_DATA_SIZE + int "Maximum data size of an ITS entry in bytes" + default 128 + help + The maximum size, in bytes, that the data of an ITS entry can be. + Increasing this value increases the stack usage when serving PSA ITS API calls. + +menuconfig SECURE_STORAGE_ITS_TRANSFORM_MODULE + bool "ITS transform module" + help + The module that handles the transformation and validation of the + ITS data before it's written to and after it's read from NVM. + Zephyr's ITS implementation calls into it. + +if SECURE_STORAGE_ITS_TRANSFORM_MODULE +rsource "Kconfig.its_transform" +endif + +menuconfig SECURE_STORAGE_ITS_STORE_MODULE + bool "ITS store module" + imply FLASH # for FLASH_HAS_DRIVER_ENABLED + help + The module that handles the storage/retrieval of the ITS data to/from NVM. + Zephyr's ITS implementation calls into it. + +if SECURE_STORAGE_ITS_STORE_MODULE +rsource "Kconfig.its_store" +endif + +choice SECURE_STORAGE_PS_IMPLEMENTATION + prompt "Protected Storage (PS) API implementation" + default SECURE_STORAGE_PS_IMPLEMENTATION_ITS + +config SECURE_STORAGE_PS_IMPLEMENTATION_ITS + bool "PS calls directly into the ITS" + help + The PS API doesn't have an implementation of its own, and directly calls into the ITS API. + This means that the implementation of the PS API will be identical to that of the ITS API. + +config SECURE_STORAGE_PS_IMPLEMENTATION_CUSTOM + bool "Custom PS implementation" + help + A custom implementation of the PS API is present. + Implement the functions declared in . + The header is made available when this Kconfig option is enabled. + +endchoice # SECURE_STORAGE_PS_IMPLEMENTATION + +config SECURE_STORAGE_PS_SUPPORTS_SET_EXTENDED + bool "PS API implementation supports psa_ps_create() and psa_ps_set_extended()" + depends on SECURE_STORAGE_PS_IMPLEMENTATION_CUSTOM + help + Whether the psa_ps_create() and psa_ps_set_extended() functions are implemented. + +endif # SECURE_STORAGE diff --git a/subsys/secure_storage/Kconfig.its_store b/subsys/secure_storage/Kconfig.its_store new file mode 100644 index 0000000000000..9e4d9b6502059 --- /dev/null +++ b/subsys/secure_storage/Kconfig.its_store @@ -0,0 +1,34 @@ +# Copyright (c) 2024 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +choice SECURE_STORAGE_ITS_STORE_IMPLEMENTATION + prompt "ITS store module implementation" + +config SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_SETTINGS + bool "ITS store module implementation using the settings subsystem for storage" + DT_STORAGE_PARTITION := $(dt_nodelabel_path,storage_partition) + depends on FLASH_HAS_DRIVER_ENABLED \ + && $(dt_path_enabled,$(DT_STORAGE_PARTITION)) \ + && $(dt_node_has_compat,$(dt_node_parent,$(DT_STORAGE_PARTITION)),fixed-partitions) + imply FLASH_MAP + imply NVS + select SETTINGS + +config SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_NONE + bool "No ITS store module implementation" + +config SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_CUSTOM + bool "Custom ITS store module implementation" + help + Implement the functions declared in . + The header is made available when this Kconfig option is enabled. + +endchoice # SECURE_STORAGE_ITS_STORE_IMPLEMENTATION + +if SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_SETTINGS + +config SECURE_STORAGE_ITS_STORE_SETTINGS_PREFIX + string "Subtree in which to store the settings, with a trailing slash. Can be empty." + default "its/" + +endif # SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_SETTINGS diff --git a/subsys/secure_storage/Kconfig.its_transform b/subsys/secure_storage/Kconfig.its_transform new file mode 100644 index 0000000000000..5fcdb2bdb6bc4 --- /dev/null +++ b/subsys/secure_storage/Kconfig.its_transform @@ -0,0 +1,134 @@ +# Copyright (c) 2024 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +choice SECURE_STORAGE_ITS_TRANSFORM_IMPLEMENTATION + prompt "ITS transform module implementation" + +config SECURE_STORAGE_ITS_TRANSFORM_IMPLEMENTATION_AEAD + bool "ITS transform module implementation using AEAD to protect the data" + imply HWINFO # for HWINFO_HAS_DRIVER + +config SECURE_STORAGE_ITS_TRANSFORM_IMPLEMENTATION_CUSTOM + bool "Custom ITS transform module implementation" + help + Implement the functions declared in + and set CONFIG_SECURE_STORAGE_ITS_TRANSFORM_OUTPUT_OVERHEAD appropriately. + The header is made available when this Kconfig option is enabled. + +endchoice # SECURE_STORAGE_ITS_TRANSFORM_IMPLEMENTATION + +config SECURE_STORAGE_ITS_TRANSFORM_OUTPUT_OVERHEAD + int "Overhead, in bytes, associated with the transformation of an entry's data for storage" + range 0 1000 + # authentication tag (16) + nonce (12) + default 28 if SECURE_STORAGE_ITS_TRANSFORM_IMPLEMENTATION_AEAD \ + && SECURE_STORAGE_ITS_TRANSFORM_AEAD_NONCE_SIZE = 12 + default -1 + help + This indicates how many more bytes an ITS entry's data will be once it + has been processed by the secure_storage_its_transform_to_store() function. + +if SECURE_STORAGE_ITS_TRANSFORM_IMPLEMENTATION_AEAD + +choice SECURE_STORAGE_ITS_TRANSFORM_AEAD_SCHEME + prompt "AEAD ITS transform module scheme" + default SECURE_STORAGE_ITS_TRANSFORM_AEAD_SCHEME_AES_GCM + help + The AEAD scheme used to encrypt and authenticate the data. + +config SECURE_STORAGE_ITS_TRANSFORM_AEAD_SCHEME_AES_GCM + bool "AES-GCM AEAD scheme" + select PSA_WANT_KEY_TYPE_AES + select PSA_WANT_ALG_GCM + +config SECURE_STORAGE_ITS_TRANSFORM_AEAD_SCHEME_CHACHA20_POLY1305 + bool "ChaCha20-Poly1305 AEAD scheme" + depends on SECURE_STORAGE_ITS_TRANSFORM_AEAD_NONCE_SIZE = 12 + select PSA_WANT_KEY_TYPE_CHACHA20 + select PSA_WANT_ALG_CHACHA20_POLY1305 + +config SECURE_STORAGE_ITS_TRANSFORM_AEAD_SCHEME_CUSTOM + bool "Custom AEAD scheme" + help + Implement the secure_storage_its_transform_aead_get_scheme() function + declared in + and set CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_NONCE_SIZE appropriately. + The header is made available when this Kconfig option is enabled. + +endchoice # SECURE_STORAGE_ITS_TRANSFORM_AEAD_SCHEME + +choice SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER + prompt "AEAD ITS transform module encryption key provider" + default SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER_DEVICE_ID_HASH if HWINFO_HAS_DRIVER + default SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER_ENTRY_UID_HASH if !HWINFO_HAS_DRIVER + +config SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER_DEVICE_ID_HASH + bool "Hash of the device ID returned by the HW info API (not necessarily secure)" + depends on HWINFO_HAS_DRIVER + select PSA_WANT_ALG_SHA_256 + help + This key provider generates keys by hashing the following: + - the device EUI64 as returned by hwinfo_get_device_eui64() as first choice; + - the device ID as returned by hwinfo_get_device_uuid() as second choice. + In addition to the device ID, it adds the UID of the ITS entry + for which it is generating a key to the data hashed as a salt. + This is not necessarily secure as the device ID may be easily readable + by an attacker, not unique, and/or guessable, depending on the device. + +config SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER_ENTRY_UID_HASH + bool "Hash of the ITS entry UID (not secure)" + select PSA_WANT_ALG_SHA_256 + help + This key provider generates keys by hashing the UID of the ITS entry for which it is + generating a key. This is not secure, and only intended for functional support, + because the UIDs are easily guessable and even stored in clear by the store module. + Use a secure key provider if possible. + +config SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER_CUSTOM + bool "Custom key provider" + help + Implement the secure_storage_its_transform_aead_get_key() function + declared in . + The header is made available when this Kconfig option is enabled. + +endchoice # SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER + +config SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_SIZE + int "AEAD ITS transform module encryption key size in bytes" + default 32 + +if !SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER_CUSTOM + +config SECURE_STORAGE_ITS_TRANSFORM_AEAD_NO_INSECURE_KEY_WARNING + bool "Silence the insecure ITS encryption key warnings" + +endif + +choice SECURE_STORAGE_ITS_TRANSFORM_AEAD_NONCE_PROVIDER + prompt "AEAD ITS transform module nonce provider" + +config SECURE_STORAGE_ITS_TRANSFORM_AEAD_NONCE_PROVIDER_DEFAULT + bool "Default nonce provider" + help + The default nonce provider generates a random number for the first nonce with + psa_generate_random(), then increments it for every subsequent nonce. A random + source that doesn't repeat values between reboots is required for this to be secure. + +config SECURE_STORAGE_ITS_TRANSFORM_AEAD_NONCE_PROVIDER_CUSTOM + bool "Custom nonce provider" + help + Implement the secure_storage_its_transform_aead_get_nonce() function + declared in . + The header is made available when this Kconfig option is enabled. + +endchoice # SECURE_STORAGE_ITS_TRANSFORM_AEAD_NONCE_PROVIDER + +config SECURE_STORAGE_ITS_TRANSFORM_AEAD_NONCE_SIZE + int "AEAD ITS transform module nonce size in bytes" + range 4 24 + default 12 + help + Make sure to update CONFIG_SECURE_STORAGE_ITS_TRANSFORM_OUTPUT_OVERHEAD + appropriately when changing the value of this option. + +endif # SECURE_STORAGE_ITS_TRANSFORM_IMPLEMENTATION_AEAD diff --git a/subsys/secure_storage/include/internal/zephyr/secure_storage/common.h b/subsys/secure_storage/include/internal/zephyr/secure_storage/common.h new file mode 100644 index 0000000000000..6c2c8922395fc --- /dev/null +++ b/subsys/secure_storage/include/internal/zephyr/secure_storage/common.h @@ -0,0 +1,19 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef SECURE_STORAGE_COMMON_H +#define SECURE_STORAGE_COMMON_H + +/** @file zephyr/secure_storage/common.h Common definitions of the secure storage subsystem. */ +#include + +/* A size-optimized version of `psa_storage_create_flags_t`. Used for storing the `create_flags`. */ +typedef uint8_t secure_storage_packed_create_flags_t; + +#define SECURE_STORAGE_ALL_CREATE_FLAGS \ + (PSA_STORAGE_FLAG_NONE | \ + PSA_STORAGE_FLAG_WRITE_ONCE | \ + PSA_STORAGE_FLAG_NO_CONFIDENTIALITY | \ + PSA_STORAGE_FLAG_NO_REPLAY_PROTECTION) + +#endif diff --git a/subsys/secure_storage/include/internal/zephyr/secure_storage/its.h b/subsys/secure_storage/include/internal/zephyr/secure_storage/its.h new file mode 100644 index 0000000000000..009bb5e061af7 --- /dev/null +++ b/subsys/secure_storage/include/internal/zephyr/secure_storage/its.h @@ -0,0 +1,31 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef SECURE_STORAGE_ITS_H +#define SECURE_STORAGE_ITS_H + +/** @file zephyr/secure_storage/its.h The secure storage ITS implementation. + * + * The functions declared in this header implement the PSA ITS API + * when the secure storage subsystem is enabled. + * They must not be called directly, and this header must not be included other than when + * providing a custom implementation (@kconfig{CONFIG_SECURE_STORAGE_ITS_IMPLEMENTATION_CUSTOM}). + */ +#include "its/common.h" + +/** @brief See `psa_its_set()`, to which this function is analogous. */ +psa_status_t secure_storage_its_set(secure_storage_its_uid_t uid, size_t data_length, + const void *p_data, psa_storage_create_flags_t create_flags); + +/** @brief See `psa_its_get()`, to which this function is analogous. */ +psa_status_t secure_storage_its_get(secure_storage_its_uid_t uid, size_t data_offset, + size_t data_size, void *p_data, size_t *p_data_length); + +/** @brief See `psa_its_get_info()`, to which this function is analogous. */ +psa_status_t secure_storage_its_get_info(secure_storage_its_uid_t uid, + struct psa_storage_info_t *p_info); + +/** @brief See `psa_its_remove()`, to which this function is analogous. */ +psa_status_t secure_storage_its_remove(secure_storage_its_uid_t uid); + +#endif diff --git a/subsys/secure_storage/include/internal/zephyr/secure_storage/its/common.h b/subsys/secure_storage/include/internal/zephyr/secure_storage/its/common.h new file mode 100644 index 0000000000000..4b73eafcf3d88 --- /dev/null +++ b/subsys/secure_storage/include/internal/zephyr/secure_storage/its/common.h @@ -0,0 +1,30 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef SECURE_STORAGE_ITS_COMMON_H +#define SECURE_STORAGE_ITS_COMMON_H + +/** @file zephyr/secure_storage/its/common.h + * @brief Common definitions of the secure storage subsystem's ITS APIs. + */ +#include "../common.h" +#include +#include + +/** @brief The ID of the caller from which the ITS API call originates. + * This is used to prevent ID collisions between different callers that are not aware + * of each other and so might use the same numerical IDs, e.g. PSA Crypto and PSA ITS. + */ +typedef enum { + SECURE_STORAGE_ITS_CALLER_PSA_ITS, + SECURE_STORAGE_ITS_CALLER_PSA_PS, + SECURE_STORAGE_ITS_CALLER_MBEDTLS, +} secure_storage_its_caller_id_t; + +/** The UID (caller + entry IDs) of an ITS entry. */ +typedef struct { + psa_storage_uid_t uid; + secure_storage_its_caller_id_t caller_id; +} __packed secure_storage_its_uid_t; + +#endif diff --git a/subsys/secure_storage/include/internal/zephyr/secure_storage/its/store.h b/subsys/secure_storage/include/internal/zephyr/secure_storage/its/store.h new file mode 100644 index 0000000000000..fec3448b21589 --- /dev/null +++ b/subsys/secure_storage/include/internal/zephyr/secure_storage/its/store.h @@ -0,0 +1,52 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef SECURE_STORAGE_ITS_STORE_H +#define SECURE_STORAGE_ITS_STORE_H + +/** @file zephyr/secure_storage/its/store.h The secure storage ITS store module. + * + * The functions declared in this header implement the ITS store module. + * They are meant to be called only by the ITS implementation. + * This header may be included when providing a custom implementation of the + * ITS store module (@kconfig{CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_CUSTOM}). + */ +#include + +/** @brief Writes the data of an ITS entry to the storage medium. + * + * @param uid The entry's UID. + * @param data_length The number of bytes in `data`. + * @param data The data to store. + * + * @retval `PSA_SUCCESS` on success. + * @retval `PSA_ERROR_INSUFFICIENT_STORAGE` if there is insufficient storage space. + * @retval `PSA_ERROR_STORAGE_FAILURE` on any other failure. + */ +psa_status_t secure_storage_its_store_set(secure_storage_its_uid_t uid, + size_t data_length, const void *data); + +/** @brief Retrieves the data of an ITS entry from the storage medium. + * + * @param[in] uid The entry's UID. + * @param[in] data_size The size of `data` in bytes. + * @param[out] data The buffer to which the entry's stored data is written. + * @param[out] data_length On success, the number of bytes written to `data`. + * May be less than `data_size`. + * + * @retval `PSA_SUCCESS` on success. + * @retval `PSA_ERROR_DOES_NOT_EXIST` if no entry with the given UID exists. + * @retval `PSA_ERROR_STORAGE_FAILURE` on any other failure. + */ +psa_status_t secure_storage_its_store_get(secure_storage_its_uid_t uid, size_t data_size, + void *data, size_t *data_length); + +/** @brief Removes an ITS entry from the storage medium. + * + * @param uid The entry's UID. + * + * @return `PSA_SUCCESS` on success, anything else on failure. + */ +psa_status_t secure_storage_its_store_remove(secure_storage_its_uid_t uid); + +#endif diff --git a/subsys/secure_storage/include/internal/zephyr/secure_storage/its/transform.h b/subsys/secure_storage/include/internal/zephyr/secure_storage/its/transform.h new file mode 100644 index 0000000000000..ad8f3e81a3186 --- /dev/null +++ b/subsys/secure_storage/include/internal/zephyr/secure_storage/its/transform.h @@ -0,0 +1,62 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef SECURE_STORAGE_ITS_TRANSFORM_H +#define SECURE_STORAGE_ITS_TRANSFORM_H + +/** @file zephyr/secure_storage/its/transform.h The secure storage ITS transform module. + * + * The functions declared in this header implement the ITS transform module. + * They are meant to be called only by the ITS implementation. + * This header may be included when providing a custom implementation of the + * ITS transform module (@kconfig{CONFIG_SECURE_STORAGE_ITS_TRANSFORM_IMPLEMENTATION_CUSTOM}). + */ +#include + +/** The maximum size, in bytes, of an entry's data after it has been transformed for storage. */ +enum { SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE + = CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE + + sizeof(secure_storage_packed_create_flags_t) + + CONFIG_SECURE_STORAGE_ITS_TRANSFORM_OUTPUT_OVERHEAD }; + +#define SECURE_STORAGE_ITS_TRANSFORM_DATA_SIZE(stored_data_len) \ + (stored_data_len - (SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE \ + - CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE)) + +/** @brief Transforms the data of an ITS entry for storage. + * + * @param[in] uid The entry's UID. + * @param[in] data_len The number of bytes in `data`. + * @param[in] data The data to transform for storage. + * @param[in] create_flags The entry's create flags. It must contain only valid + * `PSA_STORAGE_FLAG_*` values. It gets stored as part of `stored_data`. + * @param[out] stored_data The buffer to which the transformed data is written. + * @param[out] stored_data_len On success, the number of bytes written to `stored_data`. + * + * @return `PSA_SUCCESS` on success, anything else on failure. + */ +psa_status_t secure_storage_its_transform_to_store( + secure_storage_its_uid_t uid, size_t data_len, const void *data, + secure_storage_packed_create_flags_t create_flags, + uint8_t stored_data[static SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE], + size_t *stored_data_len); + +/** @brief Transforms and validates the stored data of an ITS entry for use. + * + * @param[in] uid The entry's UID. + * @param[in] stored_data_len The number of bytes in `stored_data`. + * @param[in] stored_data The stored data to transform for use. + * @param[in] data_size The size of `data` in bytes. + * @param[out] data The buffer to which the transformed data is written. + * @param[out] data_len On success, the number of bytes written to `stored_data`. + * @param[out] create_flags On success, the entry's create flags. + * + * @return `PSA_SUCCESS` on success, anything else on failure. + */ +psa_status_t secure_storage_its_transform_from_store( + secure_storage_its_uid_t uid, size_t stored_data_len, + const uint8_t stored_data[static SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE], + size_t data_size, void *data, size_t *data_len, + psa_storage_create_flags_t *create_flags); + +#endif diff --git a/subsys/secure_storage/include/internal/zephyr/secure_storage/its/transform/aead_get.h b/subsys/secure_storage/include/internal/zephyr/secure_storage/its/transform/aead_get.h new file mode 100644 index 0000000000000..071c74c029e62 --- /dev/null +++ b/subsys/secure_storage/include/internal/zephyr/secure_storage/its/transform/aead_get.h @@ -0,0 +1,45 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef SECURE_STORAGE_ITS_TRANSFORM_AEAD_GET_H +#define SECURE_STORAGE_ITS_TRANSFORM_AEAD_GET_H + +/** @file zephyr/secure_storage/its/transform/aead_get.h The AEAD ITS transform module API. + * + * The functions declared in this header allow customization + * of the AEAD implementation of the ITS transform module. + * They are not meant to be called directly other than by the AEAD ITS transform module. + * This header may be included when providing a custom implementation of one + * or more of these functions (@kconfig{CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_*_CUSTOM}). + */ +#include +#include + +/** @brief Returns the key type and algorithm to use for the AEAD operations. + * + * @param[out] key_type The key type to use. + * @param[out] alg The algorithm to use. + */ +void secure_storage_its_transform_aead_get_scheme(psa_key_type_t *key_type, psa_algorithm_t *alg); + +/** @brief Returns the encryption key to use for an ITS entry's AEAD operations. + * + * @param[in] uid The UID of the ITS entry for whom the returned key is used. + * @param[out] key The encryption key. + * + * @return `PSA_SUCCESS` on success, anything else on failure. + */ +psa_status_t secure_storage_its_transform_aead_get_key( + secure_storage_its_uid_t uid, + uint8_t key[static CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_SIZE]); + +/** @brief Generates a nonce for an AEAD operation. + * + * @param[out] nonce The generated nonce. + * + * @return `PSA_SUCCESS` on success, anything else on failure. + */ +psa_status_t secure_storage_its_transform_aead_get_nonce( + uint8_t nonce[static CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_NONCE_SIZE]); + +#endif diff --git a/subsys/secure_storage/include/internal/zephyr/secure_storage/ps.h b/subsys/secure_storage/include/internal/zephyr/secure_storage/ps.h new file mode 100644 index 0000000000000..fa5344ded3522 --- /dev/null +++ b/subsys/secure_storage/include/internal/zephyr/secure_storage/ps.h @@ -0,0 +1,39 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef SECURE_STORAGE_PS_H +#define SECURE_STORAGE_PS_H + +/** @file zephyr/secure_storage/ps.h The secure storage PS implementation. + * + * The functions declared in this header implement the PSA PS API + * when the secure storage subsystem is enabled. + * They must not be called directly, and this header must not be included other than when + * providing a custom implementation (@kconfig{CONFIG_SECURE_STORAGE_PS_IMPLEMENTATION_CUSTOM}). + */ +#include + +/** @brief See `psa_ps_set()`, to which this function is analogous. */ +psa_status_t secure_storage_ps_set(const psa_storage_uid_t uid, size_t data_length, + const void *p_data, psa_storage_create_flags_t create_flags); + +/** @brief See `psa_ps_get()`, to which this function is analogous. */ +psa_status_t secure_storage_ps_get(const psa_storage_uid_t uid, size_t data_offset, + size_t data_length, void *p_data, size_t *p_data_length); + +/** @brief See `psa_ps_get_info()`, to which this function is analogous. */ +psa_status_t secure_storage_ps_get_info(const psa_storage_uid_t uid, + struct psa_storage_info_t *p_info); + +/** @brief See `psa_ps_remove()`, to which this function is analogous. */ +psa_status_t secure_storage_ps_remove(const psa_storage_uid_t uid); + +/** @brief See `psa_ps_create()`, to which this function is analogous. */ +psa_status_t secure_storage_ps_create(psa_storage_uid_t uid, size_t capacity, + psa_storage_create_flags_t create_flags); + +/** @brief See `psa_ps_set_extended()`, to which this function is analogous. */ +psa_status_t secure_storage_ps_set_extended(psa_storage_uid_t uid, size_t data_offset, + size_t data_length, const void *p_data); + +#endif diff --git a/subsys/secure_storage/include/psa/error.h b/subsys/secure_storage/include/psa/error.h new file mode 100644 index 0000000000000..439f4b5e4de51 --- /dev/null +++ b/subsys/secure_storage/include/psa/error.h @@ -0,0 +1,29 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef PSA_ERROR_H +#define PSA_ERROR_H +/** + * @file psa/error.h Return values of the PSA Secure Storage API. + * @ingroup psa_secure_storage + * @{ + */ +#include + +typedef int32_t psa_status_t; + +#define PSA_SUCCESS ((psa_status_t)0) + +#define PSA_ERROR_GENERIC_ERROR ((psa_status_t)-132) +#define PSA_ERROR_NOT_PERMITTED ((psa_status_t)-133) +#define PSA_ERROR_NOT_SUPPORTED ((psa_status_t)-134) +#define PSA_ERROR_INVALID_ARGUMENT ((psa_status_t)-135) +#define PSA_ERROR_ALREADY_EXISTS ((psa_status_t)-139) +#define PSA_ERROR_DOES_NOT_EXIST ((psa_status_t)-140) +#define PSA_ERROR_INSUFFICIENT_STORAGE ((psa_status_t)-142) +#define PSA_ERROR_STORAGE_FAILURE ((psa_status_t)-146) +#define PSA_ERROR_INVALID_SIGNATURE ((psa_status_t)-149) +#define PSA_ERROR_DATA_CORRUPT ((psa_status_t)-152) + +/** @} */ +#endif diff --git a/subsys/secure_storage/include/psa/internal_trusted_storage.h b/subsys/secure_storage/include/psa/internal_trusted_storage.h new file mode 100644 index 0000000000000..a8c3b77c601a0 --- /dev/null +++ b/subsys/secure_storage/include/psa/internal_trusted_storage.h @@ -0,0 +1,126 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef PSA_INTERNAL_TRUSTED_STORAGE_H +#define PSA_INTERNAL_TRUSTED_STORAGE_H + +/** @file psa/internal_trusted_storage.h The PSA Internal Trusted Storage (ITS) API. + * @ingroup psa_secure_storage + * For more information on the ITS, see [The Internal Trusted Storage API](https://arm-software.github.io/psa-api/storage/1.0/overview/architecture.html#the-internal-trusted-storage-api). + */ + +/** @cond INTERNAL_HIDDEN */ +#include "../internal/zephyr/secure_storage/its.h" +#ifdef BUILDING_MBEDTLS_CRYPTO +#define ITS_CALLER_ID SECURE_STORAGE_ITS_CALLER_MBEDTLS +#else +#define ITS_CALLER_ID SECURE_STORAGE_ITS_CALLER_PSA_ITS +#endif +#define ITS_UID (secure_storage_its_uid_t){.uid = uid, .caller_id = ITS_CALLER_ID} +/** @endcond */ + +#include + +#define PSA_ITS_API_VERSION_MAJOR 1 +#define PSA_ITS_API_VERSION_MINOR 0 + +/** + * @brief Creates a new or modifies an existing entry. + * + * Stores data in the internal storage. + * + * @param uid The identifier of the data. Must be nonzero. + * @param data_length The size in bytes of the data in `p_data` to store. + * @param p_data A buffer containing the data to store. + * @param create_flags Flags indicating the properties of the entry. + * + * @retval PSA_SUCCESS The operation completed successfully. + * @retval PSA_ERROR_NOT_PERMITTED An entry associated with the provided `uid` already + * exists and was created with `PSA_STORAGE_FLAG_WRITE_ONCE`. + * @retval PSA_ERROR_NOT_SUPPORTED One or more of the flags provided in `create_flags` + * are not supported or invalid. + * @retval PSA_ERROR_INVALID_ARGUMENT One or more arguments other than `create_flags` are + * invalid. + * @retval PSA_ERROR_INSUFFICIENT_STORAGE There is insufficient space on the storage medium. + * @retval PSA_ERROR_STORAGE_FAILURE The physical storage has failed (fatal error). + */ +/** @cond INTERNAL_HIDDEN */ +static ALWAYS_INLINE +/** @endcond */ +psa_status_t psa_its_set(psa_storage_uid_t uid, size_t data_length, + const void *p_data, psa_storage_create_flags_t create_flags) +{ + return secure_storage_its_set(ITS_UID, data_length, p_data, create_flags); +} + +/** + * @brief Retrieves data associated with the provided `uid`. + * + * @param[in] uid The identifier of the data. + * @param[in] data_offset The offset, in bytes, from which to start reading the data. + * @param[in] data_size The number of bytes to read. + * @param[out] p_data The buffer where the data will be placed on success. + * Must be at least `data_size` bytes long. + * @param[out] p_data_length On success, the number of bytes placed in `p_data`. + * + * @retval PSA_SUCCESS The operation completed successfully. + * @retval PSA_ERROR_INVALID_ARGUMENT One or more of the arguments are invalid. This can also + * happen if `data_offset` is larger than the size of the data + * associated with `uid`. + * @retval PSA_ERROR_DOES_NOT_EXIST The provided `uid` was not found in the storage. + * @retval PSA_ERROR_STORAGE_FAILURE The physical storage has failed (fatal error). + */ +/** @cond INTERNAL_HIDDEN */ +static ALWAYS_INLINE +/** @endcond */ +psa_status_t psa_its_get(psa_storage_uid_t uid, size_t data_offset, + size_t data_size, void *p_data, size_t *p_data_length) +{ + return secure_storage_its_get(ITS_UID, data_offset, data_size, p_data, p_data_length); +} + +/** + * @brief Retrieves the metadata of a given entry. + * + * @param[in] uid The identifier of the entry. + * @param[out] p_info A pointer to a `psa_storage_info_t` struct that will + * be populated with the metadata on success. + * + * @retval PSA_SUCCESS The operation completed successfully. + * @retval PSA_ERROR_INVALID_ARGUMENT One or more of the arguments are invalid. + * @retval PSA_ERROR_DOES_NOT_EXIST The provided `uid` was not found in the storage. + * @retval PSA_ERROR_STORAGE_FAILURE The physical storage has failed (fatal error). + */ +/** @cond INTERNAL_HIDDEN */ +static ALWAYS_INLINE +/** @endcond */ +psa_status_t psa_its_get_info(psa_storage_uid_t uid, struct psa_storage_info_t *p_info) +{ + return secure_storage_its_get_info(ITS_UID, p_info); +} + +/** + * @brief Removes the provided `uid` and its associated data. + * + * Deletes all the data associated with the entry from internal storage. + * + * @param uid The identifier of the entry to remove. + * + * @retval PSA_SUCCESS The operation completed successfully. + * @retval PSA_ERROR_NOT_PERMITTED The entry was created with `PSA_STORAGE_FLAG_WRITE_ONCE`. + * @retval PSA_ERROR_INVALID_ARGUMENT `uid` is invalid. + * @retval PSA_ERROR_DOES_NOT_EXIST The provided `uid` was not found in the storage. + * @retval PSA_ERROR_STORAGE_FAILURE The physical storage has failed (fatal error). + */ +/** @cond INTERNAL_HIDDEN */ +static ALWAYS_INLINE +/** @endcond */ +psa_status_t psa_its_remove(psa_storage_uid_t uid) +{ + return secure_storage_its_remove(ITS_UID); +} + +#undef ITS_UID +#undef ITS_CALLER_ID + +#endif diff --git a/subsys/secure_storage/include/psa/protected_storage.h b/subsys/secure_storage/include/psa/protected_storage.h new file mode 100644 index 0000000000000..7c20d3097a2ad --- /dev/null +++ b/subsys/secure_storage/include/psa/protected_storage.h @@ -0,0 +1,241 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef PSA_PROTECTED_STORAGE_H +#define PSA_PROTECTED_STORAGE_H + +/** @file psa/protected_storage.h The PSA Protected Storage (PS) API. + * @ingroup psa_secure_storage + * For more information on the PS, see [The Protected Storage API](https://arm-software.github.io/psa-api/storage/1.0/overview/architecture.html#the-protected-storage-api). + */ + +/** @cond INTERNAL_HIDDEN */ +#ifdef CONFIG_SECURE_STORAGE_PS_IMPLEMENTATION_ITS +#include "../internal/zephyr/secure_storage/its.h" +#define ITS_UID (secure_storage_its_uid_t){.uid = uid, \ + .caller_id = SECURE_STORAGE_ITS_CALLER_PSA_PS} +#else +#include "../internal/zephyr/secure_storage/ps.h" +#endif +/** @endcond */ + +#include + +#define PSA_PS_API_VERSION_MAJOR 1 +#define PSA_PS_API_VERSION_MINOR 0 + +/** + * @brief Creates a new or modifies an existing entry. + * + * @param uid The identifier of the data. Must be nonzero. + * @param data_length The size in bytes of the data in `p_data` to store. + * @param p_data A buffer containing the data to store. + * @param create_flags Flags indicating the properties of the entry. + * + * @retval PSA_SUCCESS The operation completed successfully. + * @retval PSA_ERROR_GENERIC_ERROR An unspecified internal failure happened. + * @retval PSA_ERROR_NOT_PERMITTED An entry associated with the provided `uid` already + * exists and was created with `PSA_STORAGE_FLAG_WRITE_ONCE`. + * @retval PSA_ERROR_NOT_SUPPORTED One or more of the flags provided in `create_flags` + * are not supported or invalid. + * @retval PSA_ERROR_INVALID_ARGUMENT One or more arguments other than `create_flags` are + * invalid. + * @retval PSA_ERROR_INSUFFICIENT_STORAGE There is insufficient space on the storage medium. + * @retval PSA_ERROR_STORAGE_FAILURE The physical storage has failed (fatal error). + */ +/** @cond INTERNAL_HIDDEN */ +static ALWAYS_INLINE +/** @endcond */ +psa_status_t psa_ps_set(psa_storage_uid_t uid, size_t data_length, + const void *p_data, psa_storage_create_flags_t create_flags) +{ +#ifdef CONFIG_SECURE_STORAGE_PS_IMPLEMENTATION_ITS + return secure_storage_its_set(ITS_UID, data_length, p_data, create_flags); +#else + return secure_storage_ps_set(uid, data_length, p_data, create_flags); +#endif +} + +/** + * @brief Retrieves data associated with the provided `uid`. + * + * @param[in] uid The identifier of the data. + * @param[in] data_offset The offset, in bytes, from which to start reading the data. + * @param[in] data_size The number of bytes to read. + * @param[out] p_data The buffer where the data will be placed on success. + * Must be at least `data_size` bytes long. + * @param[out] p_data_length On success, the number of bytes placed in `p_data`. + * + * @retval PSA_SUCCESS The operation completed successfully. + * @retval PSA_ERROR_GENERIC_ERROR An unspecified internal failure happened. + * @retval PSA_ERROR_INVALID_ARGUMENT One or more of the arguments are invalid. This can also + * happen if `data_offset` is larger than the size of the data + * associated with `uid`. + * @retval PSA_ERROR_DOES_NOT_EXIST The provided `uid` was not found in the storage. + * @retval PSA_ERROR_STORAGE_FAILURE The physical storage has failed (fatal error). + * @retval PSA_ERROR_INVALID_SIGNATURE The data associated with `uid` failed authentication. + * @retval PSA_ERROR_DATA_CORRUPT The data associated with `uid` is corrupt. + */ +/** @cond INTERNAL_HIDDEN */ +static ALWAYS_INLINE +/** @endcond */ +psa_status_t psa_ps_get(psa_storage_uid_t uid, size_t data_offset, + size_t data_size, void *p_data, size_t *p_data_length) +{ +#ifdef CONFIG_SECURE_STORAGE_PS_IMPLEMENTATION_ITS + return secure_storage_its_get(ITS_UID, data_offset, data_size, p_data, p_data_length); +#else + return secure_storage_ps_get(uid, data_offset, data_size, p_data, p_data_length); +#endif +} + +/** + * @brief Retrieves the metadata of a given entry. + * + * @param[in] uid The identifier of the entry. + * @param[out] p_info A pointer to a `psa_storage_info_t` struct that will + * be populated with the metadata on success. + * + * @retval PSA_SUCCESS The operation completed successfully. + * @retval PSA_ERROR_GENERIC_ERROR An unspecified internal failure happened. + * @retval PSA_ERROR_INVALID_ARGUMENT One or more of the arguments are invalid. + * @retval PSA_ERROR_DOES_NOT_EXIST The provided `uid` was not found in the storage. + * @retval PSA_ERROR_STORAGE_FAILURE The physical storage has failed (fatal error). + * @retval PSA_ERROR_INVALID_SIGNATURE The data associated with `uid` failed authentication. + * @retval PSA_ERROR_DATA_CORRUPT The data associated with `uid` is corrupt. + */ +/** @cond INTERNAL_HIDDEN */ +static ALWAYS_INLINE +/** @endcond */ +psa_status_t psa_ps_get_info(psa_storage_uid_t uid, struct psa_storage_info_t *p_info) +{ +#ifdef CONFIG_SECURE_STORAGE_PS_IMPLEMENTATION_ITS + return secure_storage_its_get_info(ITS_UID, p_info); +#else + return secure_storage_ps_get_info(uid, p_info); +#endif +} + +/** + * @brief Removes the provided `uid` and its associated data. + * + * Deletes previously stored data and any associated metadata, including rollback protection data. + * + * @param uid The identifier of the entry to remove. + * + * @return A status indicating the success/failure of the operation + * + * @retval PSA_SUCCESS The operation completed successfully. + * @retval PSA_ERROR_GENERIC_ERROR An unspecified internal failure happened. + * @retval PSA_ERROR_NOT_PERMITTED The entry was created with `PSA_STORAGE_FLAG_WRITE_ONCE`. + * @retval PSA_ERROR_INVALID_ARGUMENT `uid` is invalid. + * @retval PSA_ERROR_DOES_NOT_EXIST The provided `uid` was not found in the storage. + * @retval PSA_ERROR_STORAGE_FAILURE The physical storage has failed (fatal error). + */ +/** @cond INTERNAL_HIDDEN */ +static ALWAYS_INLINE +/** @endcond */ +psa_status_t psa_ps_remove(psa_storage_uid_t uid) +{ +#ifdef CONFIG_SECURE_STORAGE_PS_IMPLEMENTATION_ITS + return secure_storage_its_remove(ITS_UID); +#else + return secure_storage_ps_remove(uid); +#endif +} + +/** + * @brief Reserves storage for the provided `uid`. + * + * Upon success, the capacity of the storage for `uid` will be `capacity`, and the size will be 0. + * It is only necessary to call this function for data that will be written with the + * @ref psa_ps_set_extended() function. If only the @ref psa_ps_set() function is used, calls to + * this function are redundant. This function cannot be used to replace or resize an existing entry. + * + * @param uid The identifier of the entry to reserve storage for. + * @param capacity The capacity, in bytes, to allocate. + * @param create_flags Flags indicating the properties of the entry. + * + * @retval PSA_SUCCESS The operation completed successfully. + * @retval PSA_ERROR_GENERIC_ERROR An unspecified internal failure happened. + * @retval PSA_ERROR_NOT_SUPPORTED The implementation doesn't support this function or one + * or more of the flags provided in `create_flags` are not + * supported or invalid. + * @retval PSA_ERROR_INVALID_ARGUMENT `uid` is invalid. + * @retval PSA_ERROR_ALREADY_EXISTS An entry with the provided `uid` already exists. + * @retval PSA_ERROR_INSUFFICIENT_STORAGE There is insufficient space on the storage medium. + * @retval PSA_ERROR_STORAGE_FAILURE The physical storage has failed (fatal error). + */ +/** @cond INTERNAL_HIDDEN */ +static ALWAYS_INLINE +/** @endcond */ +psa_status_t psa_ps_create(psa_storage_uid_t uid, size_t capacity, + psa_storage_create_flags_t create_flags) +{ +#ifdef CONFIG_SECURE_STORAGE_PS_SUPPORTS_SET_EXTENDED + return secure_storage_ps_create(uid, capacity, create_flags); +#else + return PSA_ERROR_NOT_SUPPORTED; +#endif +} + +/** + * @brief Writes part of the data associated with the provided `uid`. + * + * Before calling this function, storage must have been reserved with a call to + * @ref psa_ps_create(). This function can also be used to overwrite data that was + * written with @ref psa_ps_set(). This function can overwrite existing data and/or extend + * it up to the capacity of the entry specified in @ref psa_ps_create(), but cannot create gaps. + * + * @param uid The identifier of the entry to write. + * @param data_offset The offset, in bytes, from which to start writing the data. + * Can be at most the current size of the data. + * @param data_length The size in bytes of the data in `p_data` to write. `data_offset` + * + `data_length` can be at most the capacity of the entry. + * @param p_data A buffer containing the data to write. + * + * @retval PSA_SUCCESS The operation completed successfully. + * @retval PSA_ERROR_GENERIC_ERROR An unspecified internal failure happened. + * @retval PSA_ERROR_NOT_PERMITTED The entry was created with `PSA_STORAGE_FLAG_WRITE_ONCE`. + * @retval PSA_ERROR_NOT_SUPPORTED The implementation doesn't support this function. + * @retval PSA_ERROR_INVALID_ARGUMENT One or more of the arguments are invalid. + * @retval PSA_ERROR_DOES_NOT_EXIST The provided `uid` was not found in the storage. + * @retval PSA_ERROR_STORAGE_FAILURE The physical storage has failed (fatal error). + * @retval PSA_ERROR_INVALID_SIGNATURE The data associated with `uid` failed authentication. + * @retval PSA_ERROR_DATA_CORRUPT The data associated with `uid` is corrupt. + */ +/** @cond INTERNAL_HIDDEN */ +static ALWAYS_INLINE +/** @endcond */ +psa_status_t psa_ps_set_extended(psa_storage_uid_t uid, size_t data_offset, + size_t data_length, const void *p_data) +{ +#ifdef CONFIG_SECURE_STORAGE_PS_SUPPORTS_SET_EXTENDED + return secure_storage_ps_set_extended(uid, data_offset, data_length, p_data); +#else + return PSA_ERROR_NOT_SUPPORTED; +#endif +} + +/** + * @brief Lists optional features. + * + * @return A bitmask with flags set for the optional features supported by the implementation. + * Currently defined flags are limited to `PSA_STORAGE_SUPPORT_SET_EXTENDED`. + */ +/** @cond INTERNAL_HIDDEN */ +static ALWAYS_INLINE +/** @endcond */ +uint32_t psa_ps_get_support(void) +{ + uint32_t flags = 0; + +#ifdef CONFIG_SECURE_STORAGE_PS_SUPPORTS_SET_EXTENDED + flags |= PSA_STORAGE_SUPPORT_SET_EXTENDED; +#endif + return flags; +} + +#undef ITS_UID + +#endif diff --git a/subsys/secure_storage/include/psa/storage_common.h b/subsys/secure_storage/include/psa/storage_common.h new file mode 100644 index 0000000000000..d5bed2a692e70 --- /dev/null +++ b/subsys/secure_storage/include/psa/storage_common.h @@ -0,0 +1,51 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef PSA_STORAGE_COMMON_H +#define PSA_STORAGE_COMMON_H +/** + * @defgroup psa_secure_storage PSA Secure Storage API + * @ingroup os_services + * @details For more information on the PSA Secure Storage API, see the + * [PSA Certified Secure Storage API](https://arm-software.github.io/psa-api/storage/1.0/) + * specification. + */ +/** + * @file psa/storage_common.h + * @ingroup psa_secure_storage + * @brief Common definitions of the PSA Secure Storage API. + * @{ + */ +#include +#include + +/** UID type for identifying entries. */ +typedef uint64_t psa_storage_uid_t; + +/** Flags used when creating an entry. */ +typedef uint32_t psa_storage_create_flags_t; + +/** No flag to pass. */ +#define PSA_STORAGE_FLAG_NONE 0u +/** The data associated with the UID will not be able to be modified or deleted. */ +#define PSA_STORAGE_FLAG_WRITE_ONCE (1u << 0) +/** The data associated with the UID is public, requiring only integrity. */ +#define PSA_STORAGE_FLAG_NO_CONFIDENTIALITY (1u << 1) +/** The data associated with the UID does not require replay protection. */ +#define PSA_STORAGE_FLAG_NO_REPLAY_PROTECTION (1u << 2) + +/** Metadata associated with a specific entry. */ +struct psa_storage_info_t { + /** The allocated capacity of the storage associated with an entry. */ + size_t capacity; + /** The size of an entry's data. */ + size_t size; + /** The flags used when the entry was created. */ + psa_storage_create_flags_t flags; +}; + +/** Flag indicating that @ref psa_ps_create() and @ref psa_ps_set_extended() are supported. */ +#define PSA_STORAGE_SUPPORT_SET_EXTENDED (1u << 0) + +/** @} */ +#endif diff --git a/subsys/secure_storage/src/CMakeLists.txt b/subsys/secure_storage/src/CMakeLists.txt new file mode 100644 index 0000000000000..50def1ab93fa0 --- /dev/null +++ b/subsys/secure_storage/src/CMakeLists.txt @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library_sources( + log.c +) +add_subdirectory(its) diff --git a/subsys/secure_storage/src/its/CMakeLists.txt b/subsys/secure_storage/src/its/CMakeLists.txt new file mode 100644 index 0000000000000..b9e2bb877d9c1 --- /dev/null +++ b/subsys/secure_storage/src/its/CMakeLists.txt @@ -0,0 +1,29 @@ +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library_sources_ifdef(CONFIG_SECURE_STORAGE_ITS_IMPLEMENTATION_ZEPHYR + implementation.c +) + +zephyr_library_sources_ifdef(CONFIG_SECURE_STORAGE_ITS_TRANSFORM_IMPLEMENTATION_AEAD + transform/aead.c + transform/aead_get.c +) +if (NOT CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_NO_INSECURE_KEY_WARNING) + if (CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER_DEVICE_ID_HASH) + message(WARNING " + The PSA ITS encryption key provider in use generates keys by hashing the device ID + retrieved through the HW info API. This is not necessarily secure as the device ID may be + easily readable by an attacker, not unique, and/or guessable, depending on the device. + This means that the data and keys stored via the PSA APIs may not be secure at rest.") + elseif(CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER_ENTRY_UID_HASH) + message(WARNING " + The PSA ITS encryption key provider in use is not secure. + It's only intended for functional support. + This means that the data and keys stored via the PSA APIs will not be secure at rest. + Use a secure key provider if possible.") + endif() +endif() + +zephyr_library_sources_ifdef(CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_SETTINGS + store_settings.c +) diff --git a/subsys/secure_storage/src/its/implementation.c b/subsys/secure_storage/src/its/implementation.c new file mode 100644 index 0000000000000..2ad937d45d27b --- /dev/null +++ b/subsys/secure_storage/src/its/implementation.c @@ -0,0 +1,228 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include +#include +#include +#include +#include +#include + +LOG_MODULE_DECLARE(secure_storage, CONFIG_SECURE_STORAGE_LOG_LEVEL); + +static void log_failed_operation(const char *operation, const char *preposition, psa_status_t ret) +{ + LOG_ERR("Failed to %s data %s storage. (%d)", operation, preposition, ret); +} + +static psa_status_t get_stored_data( + secure_storage_its_uid_t uid, + uint8_t stored_data[static SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE], + size_t *stored_data_len) +{ + psa_status_t ret; + + ret = secure_storage_its_store_get(uid, SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE, + stored_data, stored_data_len); + if (ret != PSA_SUCCESS) { + if (ret != PSA_ERROR_DOES_NOT_EXIST) { + log_failed_operation("retrieve", "from", ret); + } + return ret; + } + return PSA_SUCCESS; +} + +static psa_status_t transform_stored_data( + secure_storage_its_uid_t uid, size_t stored_data_len, + const uint8_t stored_data[static SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE], + size_t data_size, void *data, size_t *data_len, + psa_storage_create_flags_t *create_flags) +{ + psa_status_t ret; + + ret = secure_storage_its_transform_from_store(uid, stored_data_len, stored_data, + data_size, data, data_len, create_flags); + if (ret != PSA_SUCCESS) { + log_failed_operation("transform", "from", ret); + return PSA_ERROR_STORAGE_FAILURE; + } + return PSA_SUCCESS; +} + +static psa_status_t get_entry(secure_storage_its_uid_t uid, size_t data_size, uint8_t *data, + size_t *data_len, psa_storage_create_flags_t *create_flags) +{ + psa_status_t ret; + uint8_t stored_data[SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE]; + size_t stored_data_len; + + ret = get_stored_data(uid, stored_data, &stored_data_len); + if (ret != PSA_SUCCESS) { + return ret; + } + + return transform_stored_data(uid, stored_data_len, stored_data, data_size, data, data_len, + create_flags); +} + +static bool keep_stored_entry(secure_storage_its_uid_t uid, size_t data_length, const void *p_data, + psa_storage_create_flags_t create_flags, psa_status_t *ret) +{ + psa_storage_create_flags_t existing_create_flags; + uint8_t existing_data[CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE]; + size_t existing_data_len; + + *ret = get_entry(uid, sizeof(existing_data), existing_data, &existing_data_len, + &existing_create_flags); + if (*ret != PSA_SUCCESS) { + /* The entry either doesn't exist or is corrupted. */ + /* Allow overwriting corrupted entries to not be stuck with them forever. */ + return false; + } + if (existing_create_flags & PSA_STORAGE_FLAG_WRITE_ONCE) { + *ret = PSA_ERROR_NOT_PERMITTED; + return true; + } + if (existing_data_len == data_length && + existing_create_flags == create_flags && + !memcmp(existing_data, p_data, data_length)) { + LOG_DBG("Not writing entry %u/%llu to storage because its stored data" + " (of length %zu) is identical.", uid.caller_id, uid.uid, data_length); + *ret = PSA_SUCCESS; + return true; + } + return false; +} + +static psa_status_t store_entry(secure_storage_its_uid_t uid, size_t data_length, + const void *p_data, psa_storage_create_flags_t create_flags) +{ + psa_status_t ret; + uint8_t stored_data[SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE]; + size_t stored_data_len; + + ret = secure_storage_its_transform_to_store(uid, data_length, p_data, create_flags, + stored_data, &stored_data_len); + if (ret != PSA_SUCCESS) { + log_failed_operation("transform", "for", ret); + return PSA_ERROR_STORAGE_FAILURE; + } + + ret = secure_storage_its_store_set(uid, stored_data_len, stored_data); + if (ret != PSA_SUCCESS) { + log_failed_operation("write", "to", ret); + } + return ret; +} + +psa_status_t secure_storage_its_set(secure_storage_its_uid_t uid, size_t data_length, + const void *p_data, psa_storage_create_flags_t create_flags) +{ + psa_status_t ret; + + if (uid.uid == 0 || (p_data == NULL && data_length != 0)) { + return PSA_ERROR_INVALID_ARGUMENT; + } + if (create_flags & ~SECURE_STORAGE_ALL_CREATE_FLAGS) { + return PSA_ERROR_NOT_SUPPORTED; + } + if (data_length > CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE) { + LOG_DBG("Passed data length (%zu) exceeds maximum allowed (%u).", + data_length, CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE); + return PSA_ERROR_INSUFFICIENT_STORAGE; + } + + if (keep_stored_entry(uid, data_length, p_data, create_flags, &ret)) { + return ret; + } + + ret = store_entry(uid, data_length, p_data, create_flags); + return ret; +} + +psa_status_t secure_storage_its_get(secure_storage_its_uid_t uid, size_t data_offset, + size_t data_size, void *p_data, size_t *p_data_length) +{ + if (uid.uid == 0 || (p_data == NULL && data_size != 0) || p_data_length == NULL) { + return PSA_ERROR_INVALID_ARGUMENT; + } + if (data_size == 0) { + *p_data_length = 0; + return PSA_SUCCESS; + } + psa_status_t ret; + uint8_t stored_data[SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE]; + size_t stored_data_len; + psa_storage_create_flags_t create_flags; + + ret = get_stored_data(uid, stored_data, &stored_data_len); + if (ret != PSA_SUCCESS) { + return ret; + } + if (data_offset == 0 + && data_size >= SECURE_STORAGE_ITS_TRANSFORM_DATA_SIZE(stored_data_len)) { + /* All the data fits directly in the provided buffer. */ + return transform_stored_data(uid, stored_data_len, stored_data, data_size, p_data, + p_data_length, &create_flags); + } + uint8_t data[CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE]; + size_t data_len; + + ret = transform_stored_data(uid, stored_data_len, stored_data, sizeof(data), data, + &data_len, &create_flags); + if (ret == PSA_SUCCESS) { + if (data_offset > data_len) { + LOG_DBG("Passed data offset (%zu) exceeds existing data length (%zu).", + data_offset, data_len); + return PSA_ERROR_INVALID_ARGUMENT; + } + *p_data_length = MIN(data_size, data_len - data_offset); + memcpy(p_data, data + data_offset, *p_data_length); + } + return ret; +} + +psa_status_t secure_storage_its_get_info(secure_storage_its_uid_t uid, + struct psa_storage_info_t *p_info) +{ + psa_status_t ret; + uint8_t data[CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE]; + + if (uid.uid == 0 || p_info == NULL) { + return PSA_ERROR_INVALID_ARGUMENT; + } + + ret = get_entry(uid, sizeof(data), data, &p_info->size, &p_info->flags); + if (ret == PSA_SUCCESS) { + p_info->capacity = p_info->size; + } + return ret; +} + +psa_status_t secure_storage_its_remove(secure_storage_its_uid_t uid) +{ + psa_status_t ret; + psa_storage_create_flags_t create_flags; + uint8_t data[CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE]; + size_t data_len; + + if (uid.uid == 0) { + return PSA_ERROR_INVALID_ARGUMENT; + } + + ret = get_entry(uid, sizeof(data), data, &data_len, &create_flags); + if (ret == PSA_SUCCESS && (create_flags & PSA_STORAGE_FLAG_WRITE_ONCE)) { + return PSA_ERROR_NOT_PERMITTED; + } + /* Allow overwriting corrupted entries as well to not be stuck with them forever. */ + if (ret == PSA_SUCCESS || ret == PSA_ERROR_STORAGE_FAILURE) { + ret = secure_storage_its_store_remove(uid); + if (ret != PSA_SUCCESS) { + log_failed_operation("remove", "from", ret); + return PSA_ERROR_STORAGE_FAILURE; + } + } + return ret; +} diff --git a/subsys/secure_storage/src/its/store_settings.c b/subsys/secure_storage/src/its/store_settings.c new file mode 100644 index 0000000000000..d6942fbae6984 --- /dev/null +++ b/subsys/secure_storage/src/its/store_settings.c @@ -0,0 +1,116 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include +#include +#include +#include +#include +#include + +#ifdef CONFIG_SECURE_STORAGE_ITS_IMPLEMENTATION_ZEPHYR +#include +BUILD_ASSERT(SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE <= SETTINGS_MAX_VAL_LEN); +#endif + +LOG_MODULE_DECLARE(secure_storage, CONFIG_SECURE_STORAGE_LOG_LEVEL); + +static int init_settings_subsys(void) +{ + const int ret = settings_subsys_init(); + + if (ret) { + LOG_DBG("Failed to initialize the settings subsystem. (%d)", ret); + } + return ret; +} +SYS_INIT(init_settings_subsys, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY); + +enum { NAME_BUF_SIZE = sizeof(CONFIG_SECURE_STORAGE_ITS_STORE_SETTINGS_PREFIX) - 1 + + 2 * (sizeof(secure_storage_its_uid_t) + 1) }; +BUILD_ASSERT(NAME_BUF_SIZE <= SETTINGS_MAX_NAME_LEN + 1); + +static void make_name(secure_storage_its_uid_t uid, char name[static NAME_BUF_SIZE]) +{ + int ret; + + ret = snprintf(name, NAME_BUF_SIZE, CONFIG_SECURE_STORAGE_ITS_STORE_SETTINGS_PREFIX + "%x/%llx", uid.caller_id, (unsigned long long)uid.uid); + __ASSERT_NO_MSG(ret > 0 && ret < NAME_BUF_SIZE); +} + +psa_status_t secure_storage_its_store_set(secure_storage_its_uid_t uid, + size_t data_length, const void *data) +{ + int ret; + char name[NAME_BUF_SIZE]; + + make_name(uid, name); + ret = settings_save_one(name, data, data_length); + LOG_DBG("%s %s with %zu bytes. (%d)", + (ret == 0) ? "Saved" : "Failed to save", name, data_length, ret); + + switch (ret) { + case 0: + return PSA_SUCCESS; + case -ENOMEM: + case -ENOSPC: + return PSA_ERROR_INSUFFICIENT_STORAGE; + default: + return PSA_ERROR_STORAGE_FAILURE; + } +} + +struct load_params { + const size_t data_size; + uint8_t *const data; + ssize_t ret; +}; + +static int load_direct_setting(const char *key, size_t len, settings_read_cb read_cb, + void *cb_arg, void *param) +{ + (void)key; + struct load_params *load_params = param; + + load_params->ret = read_cb(cb_arg, load_params->data, MIN(load_params->data_size, len)); + return 0; +} + +psa_status_t secure_storage_its_store_get(secure_storage_its_uid_t uid, size_t data_size, + void *data, size_t *data_length) +{ + psa_status_t ret; + char name[NAME_BUF_SIZE]; + struct load_params load_params = {.data_size = data_size, .data = data, .ret = -ENOENT}; + + make_name(uid, name); + + settings_load_subtree_direct(name, load_direct_setting, &load_params); + if (load_params.ret > 0) { + *data_length = load_params.ret; + ret = PSA_SUCCESS; + } else if (load_params.ret == 0 || load_params.ret == -ENOENT) { + ret = PSA_ERROR_DOES_NOT_EXIST; + } else { + ret = PSA_ERROR_STORAGE_FAILURE; + } + LOG_DBG("%s %s for up to %zu bytes. (%zd)", (ret != PSA_ERROR_STORAGE_FAILURE) ? + "Loaded" : "Failed to load", name, data_size, load_params.ret); + return ret; +} + +psa_status_t secure_storage_its_store_remove(secure_storage_its_uid_t uid) +{ + int ret; + char name[NAME_BUF_SIZE]; + + make_name(uid, name); + ret = settings_delete(name); + if (ret) { + LOG_DBG("Failed to delete %s. (%d)", name, ret); + return PSA_ERROR_STORAGE_FAILURE; + } + return PSA_SUCCESS; +} diff --git a/subsys/secure_storage/src/its/transform/aead.c b/subsys/secure_storage/src/its/transform/aead.c new file mode 100644 index 0000000000000..e9f2d57d73abb --- /dev/null +++ b/subsys/secure_storage/src/its/transform/aead.c @@ -0,0 +1,131 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#include <../library/psa_crypto_driver_wrappers.h> +#include +#include +#include + +static psa_status_t psa_aead_crypt(psa_key_usage_t operation, secure_storage_its_uid_t uid, + const uint8_t nonce + [static CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_NONCE_SIZE], + size_t add_data_len, const void *add_data, size_t input_len, + const void *input, size_t output_size, void *output, + size_t *output_len) +{ + psa_status_t ret; + psa_key_attributes_t key_attributes = PSA_KEY_ATTRIBUTES_INIT; + uint8_t key[CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_SIZE]; + psa_key_type_t key_type; + psa_algorithm_t alg; + psa_status_t (*aead_crypt)(const psa_key_attributes_t *attributes, const uint8_t *key, + size_t key_size, psa_algorithm_t alg, const uint8_t *nonce, + size_t nonce_length, const uint8_t *add_data, + size_t add_data_len, const uint8_t *input, size_t input_len, + uint8_t *output, size_t output_size, size_t *output_len); + + secure_storage_its_transform_aead_get_scheme(&key_type, &alg); + + psa_set_key_usage_flags(&key_attributes, operation); + psa_set_key_lifetime(&key_attributes, PSA_KEY_LIFETIME_VOLATILE); + psa_set_key_type(&key_attributes, key_type); + psa_set_key_algorithm(&key_attributes, alg); + psa_set_key_bits(&key_attributes, sizeof(key) * 8); + + /* Avoid calling psa_aead_*crypt() because that would require importing keys into + * PSA Crypto. This gets called from PSA Crypto for storing persistent keys so, + * even if using PSA_KEY_LIFETIME_VOLATILE, it would corrupt the global key store + * which holds all the active keys in the PSA Crypto core. + */ + aead_crypt = (operation == PSA_KEY_USAGE_ENCRYPT) ? + psa_driver_wrapper_aead_encrypt : psa_driver_wrapper_aead_decrypt; + + ret = secure_storage_its_transform_aead_get_key(uid, key); + if (ret != PSA_SUCCESS) { + return ret; + } + + ret = aead_crypt(&key_attributes, key, sizeof(key), alg, nonce, + CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_NONCE_SIZE, add_data, + add_data_len, input, input_len, output, output_size, output_len); + + mbedtls_platform_zeroize(key, sizeof(key)); + return ret; +} + +enum { CIPHERTEXT_MAX_SIZE + = PSA_AEAD_ENCRYPT_OUTPUT_MAX_SIZE(CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE) }; + +BUILD_ASSERT(CONFIG_SECURE_STORAGE_ITS_TRANSFORM_OUTPUT_OVERHEAD + == CIPHERTEXT_MAX_SIZE - CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE + + CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_NONCE_SIZE); + +BUILD_ASSERT(SECURE_STORAGE_ALL_CREATE_FLAGS + <= (1 << (8 * sizeof(secure_storage_packed_create_flags_t))) - 1); + +struct stored_entry { + secure_storage_packed_create_flags_t create_flags; + uint8_t nonce[CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_NONCE_SIZE]; + uint8_t ciphertext[CIPHERTEXT_MAX_SIZE]; /* Keep last as this is variable in size. */ +} __packed; +BUILD_ASSERT(sizeof(struct stored_entry) == SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE); + +/** @return The length of a `struct stored_entry` whose `ciphertext` is `len` bytes long. */ +#define STORED_ENTRY_LEN(len) (sizeof(struct stored_entry) - CIPHERTEXT_MAX_SIZE + len) + +struct additional_data { + secure_storage_its_uid_t uid; + secure_storage_packed_create_flags_t create_flags; +} __packed; + +psa_status_t secure_storage_its_transform_to_store( + secure_storage_its_uid_t uid, size_t data_len, const void *data, + secure_storage_packed_create_flags_t create_flags, + uint8_t stored_data[static SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE], + size_t *stored_data_len) +{ + psa_status_t ret; + struct stored_entry *stored_entry = (struct stored_entry *)stored_data; + const struct additional_data add_data = {.uid = uid, .create_flags = create_flags}; + size_t ciphertext_len; + + stored_entry->create_flags = create_flags; + + ret = secure_storage_its_transform_aead_get_nonce(stored_entry->nonce); + if (ret != PSA_SUCCESS) { + return ret; + } + + ret = psa_aead_crypt(PSA_KEY_USAGE_ENCRYPT, uid, stored_entry->nonce, sizeof(add_data), + &add_data, data_len, data, sizeof(stored_entry->ciphertext), + &stored_entry->ciphertext, &ciphertext_len); + if (ret == PSA_SUCCESS) { + *stored_data_len = STORED_ENTRY_LEN(ciphertext_len); + } + return ret; +} + +psa_status_t secure_storage_its_transform_from_store( + secure_storage_its_uid_t uid, size_t stored_data_len, + const uint8_t stored_data[static SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE], + size_t data_size, void *data, size_t *data_len, + psa_storage_create_flags_t *create_flags) +{ + if (stored_data_len < STORED_ENTRY_LEN(0)) { + return PSA_ERROR_STORAGE_FAILURE; + } + + psa_status_t ret; + struct stored_entry *stored_entry = (struct stored_entry *)stored_data; + const struct additional_data add_data = {.uid = uid, + .create_flags = stored_entry->create_flags}; + const size_t ciphertext_len = stored_data_len - STORED_ENTRY_LEN(0); + + ret = psa_aead_crypt(PSA_KEY_USAGE_DECRYPT, uid, stored_entry->nonce, sizeof(add_data), + &add_data, ciphertext_len, stored_entry->ciphertext, data_size, data, + data_len); + if (ret == PSA_SUCCESS) { + *create_flags = stored_entry->create_flags; + } + return ret; +} diff --git a/subsys/secure_storage/src/its/transform/aead_get.c b/subsys/secure_storage/src/its/transform/aead_get.c new file mode 100644 index 0000000000000..07492b47e3f4f --- /dev/null +++ b/subsys/secure_storage/src/its/transform/aead_get.c @@ -0,0 +1,144 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include +#include +#include +#include +#include +#include + +LOG_MODULE_DECLARE(secure_storage, CONFIG_SECURE_STORAGE_LOG_LEVEL); + +#ifdef CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_SCHEME_AES_GCM +#define PSA_KEY_TYPE PSA_KEY_TYPE_AES +#define PSA_ALG PSA_ALG_GCM +#elif defined(CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_SCHEME_CHACHA20_POLY1305) +#define PSA_KEY_TYPE PSA_KEY_TYPE_CHACHA20 +#define PSA_ALG PSA_ALG_CHACHA20_POLY1305 +#endif +#ifndef CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_SCHEME_CUSTOM +void secure_storage_its_transform_aead_get_scheme(psa_key_type_t *key_type, psa_algorithm_t *alg) +{ + *key_type = PSA_KEY_TYPE; + *alg = PSA_ALG; +} +#endif /* !CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_SCHEME_CUSTOM */ + +#ifndef CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER_CUSTOM + +#define SHA256_OUTPUT_SIZE 32 +BUILD_ASSERT(SHA256_OUTPUT_SIZE == PSA_HASH_LENGTH(PSA_ALG_SHA_256)); +BUILD_ASSERT(SHA256_OUTPUT_SIZE >= CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_SIZE); + +static psa_status_t hash_data_into_key( + size_t data_len, const void *data, + uint8_t key[static CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_SIZE]) +{ + size_t hash_len; + +#if CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_SIZE == SHA256_OUTPUT_SIZE + /* Save stack usage and avoid unnecessary memory operations.*/ + return psa_hash_compute(PSA_ALG_SHA_256, data, data_len, key, + CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_SIZE, &hash_len); +#else + uint8_t hash_output[SHA256_OUTPUT_SIZE]; + const psa_status_t ret = psa_hash_compute(PSA_ALG_SHA_256, data, data_len, hash_output, + sizeof(hash_output), &hash_len); + + if (ret == PSA_SUCCESS) { + memcpy(key, hash_output, CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_SIZE); + mbedtls_platform_zeroize(hash_output, sizeof(hash_output)); + } + return ret; +#endif +} + +#ifdef CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER_DEVICE_ID_HASH + +#define WARNING "Using a potentially insecure PSA ITS encryption key provider." + +psa_status_t secure_storage_its_transform_aead_get_key( + secure_storage_its_uid_t uid, + uint8_t key[static CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_SIZE]) +{ + psa_status_t ret; + ssize_t hwinfo_ret; + struct { + uint8_t device_id[8]; + secure_storage_its_uid_t uid; /* acts as a salt */ + } __packed data; + + hwinfo_ret = hwinfo_get_device_eui64(data.device_id); + if (hwinfo_ret != 0) { + hwinfo_ret = hwinfo_get_device_id(data.device_id, sizeof(data.device_id)); + if (hwinfo_ret <= 0) { + return PSA_ERROR_HARDWARE_FAILURE; + } + if (hwinfo_ret < sizeof(data.device_id)) { + memset(data.device_id + hwinfo_ret, 0, sizeof(data.device_id) - hwinfo_ret); + } + } + data.uid = uid; + ret = hash_data_into_key(sizeof(data), &data, key); + + mbedtls_platform_zeroize(data.device_id, sizeof(data.device_id)); + return ret; +} + +#elif defined(CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER_ENTRY_UID_HASH) + +#define WARNING "Using an insecure PSA ITS encryption key provider." + +psa_status_t secure_storage_its_transform_aead_get_key( + secure_storage_its_uid_t uid, + uint8_t key[static CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_SIZE]) +{ + return hash_data_into_key(sizeof(uid), &uid, key); +} + +#endif /* CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER */ + +#ifndef CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_NO_INSECURE_KEY_WARNING + +static int warn_insecure_key(void) +{ + printk("WARNING: %s\n", WARNING); + LOG_WRN("%s", WARNING); + return 0; +} +SYS_INIT(warn_insecure_key, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY); + +#endif /* !CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_NO_INSECURE_KEY_WARNING */ + +#endif /* !CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER_CUSTOM */ + +#ifdef CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_NONCE_PROVIDER_DEFAULT + +psa_status_t secure_storage_its_transform_aead_get_nonce( + uint8_t nonce[static CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_NONCE_SIZE]) +{ + psa_status_t ret; + static uint8_t s_nonce[CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_NONCE_SIZE]; + static bool s_nonce_initialized; + + if (!s_nonce_initialized) { + ret = psa_generate_random(s_nonce, sizeof(s_nonce)); + if (ret != PSA_SUCCESS) { + return ret; + } + s_nonce_initialized = true; + } else { + for (unsigned int i = 0; i != sizeof(s_nonce); ++i) { + ++s_nonce[i]; + if (s_nonce[i] != 0) { + break; + } + } + } + + memcpy(nonce, &s_nonce, sizeof(s_nonce)); + return PSA_SUCCESS; +} +#endif /* CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_NONCE_PROVIDER_DEFAULT */ diff --git a/subsys/secure_storage/src/log.c b/subsys/secure_storage/src/log.c new file mode 100644 index 0000000000000..e07be28ee7b66 --- /dev/null +++ b/subsys/secure_storage/src/log.c @@ -0,0 +1,6 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#include + +LOG_MODULE_REGISTER(secure_storage, CONFIG_SECURE_STORAGE_LOG_LEVEL); From 4b479016a792a24704352566bdbf726493dd08ae Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Fri, 13 Sep 2024 08:58:52 +0300 Subject: [PATCH 0314/4482] modules: mbedtls: enable persistent keys when CONFIG_SECURE_STORAGE With the secure storage subsystem now providing an implementation of the PSA ITS API, let Mbed TLS use it when it's enabled. This allows the use of persistent keys in the PSA Crypto API. Signed-off-by: Tomi Fontanilles --- modules/mbedtls/CMakeLists.txt | 5 ++++- modules/mbedtls/configs/config-tls-generic.h | 10 +++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/modules/mbedtls/CMakeLists.txt b/modules/mbedtls/CMakeLists.txt index aab4ad5316cf5..c8caa1fd9f655 100644 --- a/modules/mbedtls/CMakeLists.txt +++ b/modules/mbedtls/CMakeLists.txt @@ -136,7 +136,7 @@ zephyr_interface_library_named(mbedTLS) zephyr_library_named(mbedTLSCrypto) - if (CONFIG_MBEDTLS_PSA_CRYPTO_C AND NOT CONFIG_BUILD_WITH_TFM) + if (CONFIG_MBEDTLS_PSA_CRYPTO_C) list(APPEND crypto_source ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_aead.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_cipher.c @@ -176,6 +176,9 @@ zephyr_interface_library_named(mbedTLS) zephyr_library_sources(${crypto_source}) + # Custom macro to tell that an mbedTLSCrypto source file is being compiled. + zephyr_library_compile_definitions(BUILDING_MBEDTLS_CRYPTO) + zephyr_library_link_libraries(mbedTLS) zephyr_library_link_libraries_ifdef(CONFIG_BUILD_WITH_TFM tfm_api) diff --git a/modules/mbedtls/configs/config-tls-generic.h b/modules/mbedtls/configs/config-tls-generic.h index 57007cd85febe..c4422772aea3d 100644 --- a/modules/mbedtls/configs/config-tls-generic.h +++ b/modules/mbedtls/configs/config-tls-generic.h @@ -482,11 +482,12 @@ #define MBEDTLS_PSA_P256M_DRIVER_ENABLED #endif -#if defined(CONFIG_ARCH_POSIX) && !defined(CONFIG_PICOLIBC) -#define MBEDTLS_PSA_KEY_SLOT_COUNT 64 +#if defined(CONFIG_ARCH_POSIX) +#define MBEDTLS_PSA_KEY_SLOT_COUNT 64 /* for BLE Mesh tests */ +#endif + +#if defined(CONFIG_SECURE_STORAGE) #define MBEDTLS_PSA_CRYPTO_STORAGE_C -#define MBEDTLS_PSA_ITS_FILE_C -#define MBEDTLS_FS_IO #endif #endif /* CONFIG_MBEDTLS_PSA_CRYPTO_C */ @@ -499,7 +500,6 @@ #define MBEDTLS_PSA_CRYPTO_CLIENT #define MBEDTLS_PSA_CRYPTO_CONFIG #define MBEDTLS_PSA_CRYPTO_CONFIG_FILE "config-psa.h" - #endif #if defined(CONFIG_MBEDTLS_TLS_VERSION_1_2) && defined(CONFIG_MBEDTLS_PSA_CRYPTO_C) From 85a56b5ee3317b27aa14660d9157e716b92d8247 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Fri, 13 Sep 2024 09:23:20 +0300 Subject: [PATCH 0315/4482] tests: secure_storage: add tests for the secure storage subsystem Add one suite to test the PSA ITS API directly, and another to test it through the PSA Crypto API. The PSA ITS API test suite is run with different configurations to also test customization possibilities that the secure storage subsystem offers. Both test suites also have a test scenario with TF-M instead of the secure storage subsystem. This serves as compatibility testing to ensure that the PSA Secure Storage API behaves the same from the user's point of view regardless of the underlying implementation provider. Signed-off-by: Tomi Fontanilles --- MAINTAINERS.yml | 6 + .../secure_storage/psa/crypto/CMakeLists.txt | 5 + .../psa/crypto/overlay-secure_storage.conf | 12 ++ .../subsys/secure_storage/psa/crypto/prj.conf | 4 + .../secure_storage/psa/crypto/src/main.c | 125 ++++++++++++++++ .../secure_storage/psa/crypto/testcase.yaml | 14 ++ .../secure_storage/psa/its/CMakeLists.txt | 11 ++ .../psa/its/overlay-custom_store.conf | 1 + .../psa/its/overlay-custom_transform.conf | 5 + .../psa/its/overlay-default_store.conf | 2 + .../psa/its/overlay-default_transform.conf | 8 ++ .../psa/its/overlay-secure_storage.conf | 4 + .../secure_storage/psa/its/overlay-tfm.conf | 2 + tests/subsys/secure_storage/psa/its/prj.conf | 1 + .../secure_storage/psa/its/src/custom_store.c | 73 ++++++++++ .../psa/its/src/custom_transform.c | 33 +++++ .../subsys/secure_storage/psa/its/src/main.c | 134 ++++++++++++++++++ .../secure_storage/psa/its/testcase.yaml | 32 +++++ 18 files changed, 472 insertions(+) create mode 100644 tests/subsys/secure_storage/psa/crypto/CMakeLists.txt create mode 100644 tests/subsys/secure_storage/psa/crypto/overlay-secure_storage.conf create mode 100644 tests/subsys/secure_storage/psa/crypto/prj.conf create mode 100644 tests/subsys/secure_storage/psa/crypto/src/main.c create mode 100644 tests/subsys/secure_storage/psa/crypto/testcase.yaml create mode 100644 tests/subsys/secure_storage/psa/its/CMakeLists.txt create mode 100644 tests/subsys/secure_storage/psa/its/overlay-custom_store.conf create mode 100644 tests/subsys/secure_storage/psa/its/overlay-custom_transform.conf create mode 100644 tests/subsys/secure_storage/psa/its/overlay-default_store.conf create mode 100644 tests/subsys/secure_storage/psa/its/overlay-default_transform.conf create mode 100644 tests/subsys/secure_storage/psa/its/overlay-secure_storage.conf create mode 100644 tests/subsys/secure_storage/psa/its/overlay-tfm.conf create mode 100644 tests/subsys/secure_storage/psa/its/prj.conf create mode 100644 tests/subsys/secure_storage/psa/its/src/custom_store.c create mode 100644 tests/subsys/secure_storage/psa/its/src/custom_transform.c create mode 100644 tests/subsys/secure_storage/psa/its/src/main.c create mode 100644 tests/subsys/secure_storage/psa/its/testcase.yaml diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 1bd58884c7fee..41b344761745e 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -4113,8 +4113,12 @@ Secure storage: - tomi-font files: - subsys/secure_storage/ + - tests/subsys/secure_storage/ labels: - "area: Secure storage" + tests: + - psa.secure_storage + Storage: status: odd fixes files: @@ -4924,6 +4928,7 @@ West: tests: - benchmark.crypto.mbedtls - crypto.mbedtls + - psa.secure_storage "West project: mcuboot": status: maintained @@ -5096,6 +5101,7 @@ West: - "area: TF-M" tests: - trusted-firmware-m + - psa.secure_storage "West project: tf-m-tests": status: maintained diff --git a/tests/subsys/secure_storage/psa/crypto/CMakeLists.txt b/tests/subsys/secure_storage/psa/crypto/CMakeLists.txt new file mode 100644 index 0000000000000..892a40102de7f --- /dev/null +++ b/tests/subsys/secure_storage/psa/crypto/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(app) + +target_sources(app PRIVATE src/main.c) diff --git a/tests/subsys/secure_storage/psa/crypto/overlay-secure_storage.conf b/tests/subsys/secure_storage/psa/crypto/overlay-secure_storage.conf new file mode 100644 index 0000000000000..84d933c2332ba --- /dev/null +++ b/tests/subsys/secure_storage/psa/crypto/overlay-secure_storage.conf @@ -0,0 +1,12 @@ +CONFIG_ZTEST_STACK_SIZE=3072 +CONFIG_MAIN_STACK_SIZE=2048 + +CONFIG_MBEDTLS=y +CONFIG_TEST_RANDOM_GENERATOR=y +CONFIG_TIMER_RANDOM_GENERATOR=y +CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y +CONFIG_MBEDTLS_PSA_CRYPTO_C=y + +CONFIG_SECURE_STORAGE=y +# For testing isolation between the different callers of the ITS. +CONFIG_SECURE_STORAGE_PS_IMPLEMENTATION_ITS=y diff --git a/tests/subsys/secure_storage/psa/crypto/prj.conf b/tests/subsys/secure_storage/psa/crypto/prj.conf new file mode 100644 index 0000000000000..d512b2fd70a8b --- /dev/null +++ b/tests/subsys/secure_storage/psa/crypto/prj.conf @@ -0,0 +1,4 @@ +CONFIG_ZTEST=y + +CONFIG_PSA_WANT_KEY_TYPE_AES=y +CONFIG_PSA_WANT_ALG_CBC_NO_PADDING=y diff --git a/tests/subsys/secure_storage/psa/crypto/src/main.c b/tests/subsys/secure_storage/psa/crypto/src/main.c new file mode 100644 index 0000000000000..d41fbadc9f372 --- /dev/null +++ b/tests/subsys/secure_storage/psa/crypto/src/main.c @@ -0,0 +1,125 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include +#include +#include + +ZTEST_SUITE(secure_storage_psa_crypto, NULL, NULL, NULL, NULL, NULL); + +#define ID PSA_KEY_ID_USER_MIN +#define KEY_TYPE PSA_KEY_TYPE_AES +#define ALG PSA_ALG_CBC_NO_PADDING +#define KEY_BITS 256 + +static void fill_key_attributes(psa_key_attributes_t *key_attributes) +{ + *key_attributes = psa_key_attributes_init(); + psa_set_key_lifetime(key_attributes, PSA_KEY_LIFETIME_PERSISTENT); + psa_set_key_usage_flags(key_attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT); + psa_set_key_id(key_attributes, ID); + psa_set_key_type(key_attributes, KEY_TYPE); + psa_set_key_algorithm(key_attributes, ALG); + psa_set_key_bits(key_attributes, KEY_BITS); +} + +static void fill_data(uint8_t *data, size_t size) +{ + zassert_equal(psa_generate_random(data, size), PSA_SUCCESS); +} + +ZTEST(secure_storage_psa_crypto, test_its_caller_isolation) +{ + psa_status_t ret; + psa_key_attributes_t key_attributes; + psa_key_attributes_t retrieved_key_attributes; + psa_key_id_t key_id; + uint8_t data[32]; + size_t data_length; + uint8_t its_data[sizeof(data)]; + uint8_t ps_data[sizeof(data)]; + + fill_data(its_data, sizeof(its_data)); + fill_data(ps_data, sizeof(ps_data)); + zassert_true(memcmp(its_data, ps_data, sizeof(data))); + ret = psa_its_set(ID, sizeof(its_data), its_data, PSA_STORAGE_FLAG_NONE); + zassert_equal(ret, PSA_SUCCESS); + ret = psa_ps_set(ID, sizeof(ps_data), ps_data, PSA_STORAGE_FLAG_NONE); + zassert_equal(ret, PSA_SUCCESS); + + fill_key_attributes(&key_attributes); + ret = psa_generate_key(&key_attributes, &key_id); + zassert_equal(ret, PSA_SUCCESS); + zassert_equal(key_id, ID); + ret = psa_purge_key(ID); + zassert_equal(ret, PSA_SUCCESS); + + ret = psa_its_get(ID, 0, sizeof(data), data, &data_length); + zassert_equal(ret, PSA_SUCCESS); + zassert_equal(data_length, sizeof(data)); + zassert_mem_equal(data, its_data, sizeof(data)); + ret = psa_its_remove(ID); + zassert_equal(ret, PSA_SUCCESS); + ret = psa_its_remove(ID); + zassert_equal(ret, PSA_ERROR_DOES_NOT_EXIST); + + ret = psa_ps_get(ID, 0, sizeof(data), data, &data_length); + zassert_equal(ret, PSA_SUCCESS); + zassert_equal(data_length, sizeof(data)); + zassert_mem_equal(data, ps_data, sizeof(data)); + ret = psa_ps_remove(ID); + zassert_equal(ret, PSA_SUCCESS); + ret = psa_ps_remove(ID); + zassert_equal(ret, PSA_ERROR_DOES_NOT_EXIST); + + ret = psa_get_key_attributes(ID, &retrieved_key_attributes); + zassert_equal(ret, PSA_SUCCESS); + zassert_mem_equal(&retrieved_key_attributes, &key_attributes, sizeof(key_attributes)); + ret = psa_destroy_key(ID); + zassert_equal(ret, PSA_SUCCESS); + ret = psa_get_key_attributes(ID, &retrieved_key_attributes); + zassert_equal(ret, PSA_ERROR_INVALID_HANDLE); +} + +ZTEST(secure_storage_psa_crypto, test_persistent_key_usage) +{ + psa_status_t ret; + psa_key_attributes_t key_attributes; + psa_key_id_t key_id; + uint8_t key_material[KEY_BITS / 8]; + + fill_key_attributes(&key_attributes); + fill_data(key_material, sizeof(key_material)); + ret = psa_import_key(&key_attributes, key_material, sizeof(key_material), &key_id); + zassert_equal(ret, PSA_SUCCESS); + zassert_equal(key_id, ID); + ret = psa_purge_key(ID); + zassert_equal(ret, PSA_SUCCESS); + + static uint8_t plaintext[1024]; + static uint8_t ciphertext[PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(KEY_TYPE, ALG, sizeof(plaintext))]; + static uint8_t decrypted_text[sizeof(plaintext)]; + size_t output_length; + + fill_data(plaintext, sizeof(plaintext)); + ret = psa_cipher_encrypt(ID, ALG, plaintext, sizeof(plaintext), + ciphertext, sizeof(ciphertext), &output_length); + zassert_equal(ret, PSA_SUCCESS); + zassert_equal(output_length, sizeof(ciphertext)); + ret = psa_purge_key(ID); + zassert_equal(ret, PSA_SUCCESS); + + ret = psa_cipher_decrypt(ID, ALG, ciphertext, output_length, + decrypted_text, sizeof(decrypted_text), &output_length); + zassert_equal(ret, PSA_SUCCESS); + zassert_equal(output_length, sizeof(plaintext)); + zassert_mem_equal(plaintext, decrypted_text, sizeof(plaintext)); + ret = psa_purge_key(ID); + zassert_equal(ret, PSA_SUCCESS); + + ret = psa_destroy_key(ID); + zassert_equal(ret, PSA_SUCCESS); + ret = psa_destroy_key(ID); + zassert_equal(ret, PSA_ERROR_INVALID_HANDLE); +} diff --git a/tests/subsys/secure_storage/psa/crypto/testcase.yaml b/tests/subsys/secure_storage/psa/crypto/testcase.yaml new file mode 100644 index 0000000000000..1d1878650eccf --- /dev/null +++ b/tests/subsys/secure_storage/psa/crypto/testcase.yaml @@ -0,0 +1,14 @@ +common: + tags: + - psa.secure_storage +tests: + secure_storage.psa.crypto.secure_storage: + filter: CONFIG_SECURE_STORAGE and not CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_NONE + extra_args: EXTRA_CONF_FILE=overlay-secure_storage.conf + integration_platforms: + - native_sim + - nrf9151dk/nrf9151 + secure_storage.psa.crypto.tfm: + filter: CONFIG_BUILD_WITH_TFM + integration_platforms: + - nrf5340dk/nrf5340/cpuapp/ns diff --git a/tests/subsys/secure_storage/psa/its/CMakeLists.txt b/tests/subsys/secure_storage/psa/its/CMakeLists.txt new file mode 100644 index 0000000000000..5243afeaa852c --- /dev/null +++ b/tests/subsys/secure_storage/psa/its/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(app) + +target_sources(app PRIVATE src/main.c) + +zephyr_sources_ifdef(CONFIG_SECURE_STORAGE_ITS_TRANSFORM_IMPLEMENTATION_CUSTOM + src/custom_transform.c) + +zephyr_sources_ifdef(CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_CUSTOM + src/custom_store.c) diff --git a/tests/subsys/secure_storage/psa/its/overlay-custom_store.conf b/tests/subsys/secure_storage/psa/its/overlay-custom_store.conf new file mode 100644 index 0000000000000..16d8b2eee3811 --- /dev/null +++ b/tests/subsys/secure_storage/psa/its/overlay-custom_store.conf @@ -0,0 +1 @@ +CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_CUSTOM=y diff --git a/tests/subsys/secure_storage/psa/its/overlay-custom_transform.conf b/tests/subsys/secure_storage/psa/its/overlay-custom_transform.conf new file mode 100644 index 0000000000000..8a95663d98a7f --- /dev/null +++ b/tests/subsys/secure_storage/psa/its/overlay-custom_transform.conf @@ -0,0 +1,5 @@ +CONFIG_SECURE_STORAGE_ITS_TRANSFORM_IMPLEMENTATION_CUSTOM=y +CONFIG_SECURE_STORAGE_ITS_TRANSFORM_OUTPUT_OVERHEAD=0 + +# SETTINGS_MAX_VAL_LEN (256) - flags (1) +CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE=255 diff --git a/tests/subsys/secure_storage/psa/its/overlay-default_store.conf b/tests/subsys/secure_storage/psa/its/overlay-default_store.conf new file mode 100644 index 0000000000000..584a2d08febb5 --- /dev/null +++ b/tests/subsys/secure_storage/psa/its/overlay-default_store.conf @@ -0,0 +1,2 @@ +# Limit the space available for the maximum entry test to not take too long. +CONFIG_SETTINGS_NVS_SECTOR_COUNT=2 diff --git a/tests/subsys/secure_storage/psa/its/overlay-default_transform.conf b/tests/subsys/secure_storage/psa/its/overlay-default_transform.conf new file mode 100644 index 0000000000000..52751db59b622 --- /dev/null +++ b/tests/subsys/secure_storage/psa/its/overlay-default_transform.conf @@ -0,0 +1,8 @@ +CONFIG_MBEDTLS=y +CONFIG_TEST_RANDOM_GENERATOR=y +CONFIG_TIMER_RANDOM_GENERATOR=y +CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y +CONFIG_MBEDTLS_PSA_CRYPTO_C=y + +# SETTINGS_MAX_VAL_LEN (256) - flags (1) - CONFIG_SECURE_STORAGE_ITS_TRANSFORM_OUTPUT_OVERHEAD (28) +CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE=227 diff --git a/tests/subsys/secure_storage/psa/its/overlay-secure_storage.conf b/tests/subsys/secure_storage/psa/its/overlay-secure_storage.conf new file mode 100644 index 0000000000000..3ca9fdabcf25e --- /dev/null +++ b/tests/subsys/secure_storage/psa/its/overlay-secure_storage.conf @@ -0,0 +1,4 @@ +CONFIG_ZTEST_STACK_SIZE=3072 +CONFIG_MAIN_STACK_SIZE=2048 + +CONFIG_SECURE_STORAGE=y diff --git a/tests/subsys/secure_storage/psa/its/overlay-tfm.conf b/tests/subsys/secure_storage/psa/its/overlay-tfm.conf new file mode 100644 index 0000000000000..78762d8afa3ad --- /dev/null +++ b/tests/subsys/secure_storage/psa/its/overlay-tfm.conf @@ -0,0 +1,2 @@ +CONFIG_TFM_ITS_MAX_ASSET_SIZE_OVERRIDE=y +CONFIG_TFM_ITS_MAX_ASSET_SIZE=256 diff --git a/tests/subsys/secure_storage/psa/its/prj.conf b/tests/subsys/secure_storage/psa/its/prj.conf new file mode 100644 index 0000000000000..9467c2926896d --- /dev/null +++ b/tests/subsys/secure_storage/psa/its/prj.conf @@ -0,0 +1 @@ +CONFIG_ZTEST=y diff --git a/tests/subsys/secure_storage/psa/its/src/custom_store.c b/tests/subsys/secure_storage/psa/its/src/custom_store.c new file mode 100644 index 0000000000000..fa3e97fb7a4a8 --- /dev/null +++ b/tests/subsys/secure_storage/psa/its/src/custom_store.c @@ -0,0 +1,73 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include +#include +#include + +static struct { + secure_storage_its_uid_t uid; + size_t data_length; + uint8_t data[SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE]; +} s_its_entries[100]; + +static int get_existing_entry_index(secure_storage_its_uid_t uid) +{ + __ASSERT_NO_MSG(uid.uid != 0); + + for (unsigned int i = 0; i != ARRAY_SIZE(s_its_entries); ++i) { + if (!memcmp(&uid, &s_its_entries[i].uid, sizeof(uid))) { + return i; + } + } + return -1; +} + +psa_status_t secure_storage_its_store_set(secure_storage_its_uid_t uid, + size_t data_length, const void *data) +{ + __ASSERT_NO_MSG(data_length <= sizeof(s_its_entries[0].data)); + int index = get_existing_entry_index(uid); + + if (index == -1) { + for (unsigned int i = 0; i != ARRAY_SIZE(s_its_entries); ++i) { + if (s_its_entries[i].uid.uid == 0) { + index = i; + break; + } + } + if (index == -1) { + return PSA_ERROR_INSUFFICIENT_STORAGE; + } + s_its_entries[index].uid = uid; + } + + s_its_entries[index].data_length = data_length; + memcpy(s_its_entries[index].data, data, data_length); + return PSA_SUCCESS; +} + +psa_status_t secure_storage_its_store_get(secure_storage_its_uid_t uid, size_t data_size, + void *data, size_t *data_length) +{ + const int index = get_existing_entry_index(uid); + + if (index == -1) { + return PSA_ERROR_DOES_NOT_EXIST; + } + *data_length = MIN(data_size, s_its_entries[index].data_length); + memcpy(data, s_its_entries[index].data, *data_length); + return PSA_SUCCESS; +} + +psa_status_t secure_storage_its_store_remove(secure_storage_its_uid_t uid) +{ + const int index = get_existing_entry_index(uid); + + if (index == -1) { + return PSA_ERROR_DOES_NOT_EXIST; + } + s_its_entries[index].uid.uid = 0; + return PSA_SUCCESS; +} diff --git a/tests/subsys/secure_storage/psa/its/src/custom_transform.c b/tests/subsys/secure_storage/psa/its/src/custom_transform.c new file mode 100644 index 0000000000000..dba5876d6649d --- /dev/null +++ b/tests/subsys/secure_storage/psa/its/src/custom_transform.c @@ -0,0 +1,33 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include +#include + +psa_status_t secure_storage_its_transform_to_store( + secure_storage_its_uid_t uid, size_t data_len, const void *data, + secure_storage_packed_create_flags_t create_flags, + uint8_t stored_data[static SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE], + size_t *stored_data_len) +{ + *stored_data_len = data_len + sizeof(secure_storage_packed_create_flags_t); + __ASSERT_NO_MSG(data_len <= CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE); + __ASSERT_NO_MSG(*stored_data_len <= SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE); + memcpy(stored_data, data, data_len); + *(secure_storage_packed_create_flags_t *)(&stored_data[data_len]) = create_flags; + return PSA_SUCCESS; +} + +psa_status_t secure_storage_its_transform_from_store( + secure_storage_its_uid_t uid, size_t stored_data_len, + const uint8_t stored_data[static SECURE_STORAGE_ITS_TRANSFORM_MAX_STORED_DATA_SIZE], + size_t data_size, void *data, size_t *data_len, + psa_storage_create_flags_t *create_flags) +{ + *data_len = stored_data_len - sizeof(secure_storage_packed_create_flags_t); + __ASSERT_NO_MSG(data_size >= *data_len); + memcpy(data, stored_data, *data_len); + *create_flags = *(secure_storage_packed_create_flags_t *)(&stored_data[*data_len]); + return PSA_SUCCESS; +} diff --git a/tests/subsys/secure_storage/psa/its/src/main.c b/tests/subsys/secure_storage/psa/its/src/main.c new file mode 100644 index 0000000000000..d9bab46ba090d --- /dev/null +++ b/tests/subsys/secure_storage/psa/its/src/main.c @@ -0,0 +1,134 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include + +/* The flash must be erased after this test suite is run for the write-once entry test to pass. */ +ZTEST_SUITE(secure_storage_psa_its, NULL, NULL, NULL, NULL, NULL); + +#ifdef CONFIG_SECURE_STORAGE +#define MAX_DATA_SIZE CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE +#else +#define MAX_DATA_SIZE CONFIG_TFM_ITS_MAX_ASSET_SIZE +#endif + +#define UID (psa_storage_uid_t)1 + +static void fill_data_buffer(uint8_t data[static MAX_DATA_SIZE]) +{ + for (unsigned int i = 0; i != MAX_DATA_SIZE; ++i) { + data[i] = i; + } +} + +ZTEST(secure_storage_psa_its, test_all_sizes) +{ + psa_status_t ret; + uint8_t written_data[MAX_DATA_SIZE]; + struct psa_storage_info_t info; + uint8_t read_data[MAX_DATA_SIZE]; + size_t data_length; + + fill_data_buffer(written_data); + + for (unsigned int i = 0; i <= sizeof(written_data); ++i) { + + ret = psa_its_set(UID, i, written_data, PSA_STORAGE_FLAG_NONE); + zassert_equal(ret, PSA_SUCCESS); + + ret = psa_its_get_info(UID, &info); + zassert_equal(ret, PSA_SUCCESS); + zassert_equal(info.flags, PSA_STORAGE_FLAG_NONE); + zassert_equal(info.size, i); + zassert_equal(info.capacity, i); + + ret = psa_its_get(UID, 0, sizeof(read_data), read_data, &data_length); + zassert_equal(ret, PSA_SUCCESS); + zassert_equal(data_length, i); + zassert_mem_equal(read_data, written_data, data_length); + + ret = psa_its_remove(UID); + zassert_equal(ret, PSA_SUCCESS); + ret = psa_its_get_info(UID, &info); + zassert_equal(ret, PSA_ERROR_DOES_NOT_EXIST); + } +} + +ZTEST(secure_storage_psa_its, test_all_offsets) +{ + psa_status_t ret; + uint8_t written_data[MAX_DATA_SIZE]; + uint8_t read_data[MAX_DATA_SIZE]; + size_t data_length; + + fill_data_buffer(written_data); + ret = psa_its_set(UID, sizeof(written_data), written_data, PSA_STORAGE_FLAG_NONE); + zassert_equal(ret, PSA_SUCCESS); + + for (unsigned int i = 0; i <= sizeof(read_data); ++i) { + + ret = psa_its_get(UID, i, sizeof(read_data) - i, read_data, &data_length); + zassert_equal(ret, PSA_SUCCESS); + zassert_equal(data_length, sizeof(read_data) - i); + + zassert_mem_equal(read_data, written_data + i, data_length); + } +} + +ZTEST(secure_storage_psa_its, test_max_num_entries) +{ + psa_status_t ret = PSA_SUCCESS; + unsigned int i; + struct psa_storage_info_t info; + + for (i = 0; ret == PSA_SUCCESS; ++i) { + ret = psa_its_set(UID + i, sizeof(i), &i, PSA_STORAGE_FLAG_NONE); + } + const unsigned int max_num_entries = i - 1; + + zassert_true(max_num_entries > 1); + printk("Successfully wrote %u entries.\n", max_num_entries); + zassert_equal(ret, PSA_ERROR_INSUFFICIENT_STORAGE); + + for (i = 0; i != max_num_entries; ++i) { + unsigned int data; + size_t data_length; + + ret = psa_its_get(UID + i, 0, sizeof(data), &data, &data_length); + zassert_equal(ret, PSA_SUCCESS); + zassert_equal(data, i); + } + for (i = 0; i != max_num_entries; ++i) { + ret = psa_its_remove(UID + i); + zassert_equal(ret, PSA_SUCCESS); + } + for (i = 0; i != max_num_entries; ++i) { + ret = psa_its_get_info(UID + i, &info); + zassert_equal(ret, PSA_ERROR_DOES_NOT_EXIST); + } +} + +/* The flash must be erased between runs of this test for it to pass. */ +ZTEST(secure_storage_psa_its, test_write_once_flag) +{ + psa_status_t ret; + /* Use a UID that isn't used in the other tests for the write-once entry. */ + const psa_storage_uid_t uid = ~UID; + const uint8_t data[MAX_DATA_SIZE] = {}; + struct psa_storage_info_t info; + + ret = psa_its_set(uid, sizeof(data), data, PSA_STORAGE_FLAG_WRITE_ONCE); + zassert_equal(ret, PSA_SUCCESS, "%s%d", (ret == PSA_ERROR_NOT_PERMITTED) ? + "Has the flash been erased since this test ran? " : "", ret); + + ret = psa_its_get_info(uid, &info); + zassert_equal(ret, PSA_SUCCESS); + zassert_equal(info.flags, PSA_STORAGE_FLAG_WRITE_ONCE); + + ret = psa_its_set(uid, sizeof(data), data, PSA_STORAGE_FLAG_NONE); + zassert_equal(ret, PSA_ERROR_NOT_PERMITTED); + + ret = psa_its_remove(uid); + zassert_equal(ret, PSA_ERROR_NOT_PERMITTED); +} diff --git a/tests/subsys/secure_storage/psa/its/testcase.yaml b/tests/subsys/secure_storage/psa/its/testcase.yaml new file mode 100644 index 0000000000000..807fdf4bf44cf --- /dev/null +++ b/tests/subsys/secure_storage/psa/its/testcase.yaml @@ -0,0 +1,32 @@ +common: + integration_platforms: + - native_sim + platform_exclude: + - qemu_cortex_m0 # settings subsystem initialization fails + timeout: 120 + tags: + - psa.secure_storage +tests: + secure_storage.psa.its.secure_storage: + filter: CONFIG_SECURE_STORAGE and not CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_NONE + extra_args: "EXTRA_CONF_FILE=\ + overlay-secure_storage.conf;overlay-default_transform.conf;overlay-default_store.conf" + integration_platforms: + - nrf5340dk/nrf5340/cpuapp + secure_storage.psa.its.secure_storage.custom.transform: + filter: CONFIG_SECURE_STORAGE and not CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_NONE + extra_args: "EXTRA_CONF_FILE=\ + overlay-secure_storage.conf;overlay-custom_transform.conf;overlay-default_store.conf" + secure_storage.psa.its.secure_storage.custom.store: + filter: CONFIG_SECURE_STORAGE + extra_args: "EXTRA_CONF_FILE=\ + overlay-secure_storage.conf;overlay-default_transform.conf;overlay-custom_store.conf" + secure_storage.psa.its.secure_storage.custom.both: + filter: CONFIG_SECURE_STORAGE + extra_args: "EXTRA_CONF_FILE=\ + overlay-secure_storage.conf;overlay-custom_transform.conf;overlay-custom_store.conf" + secure_storage.psa.its.tfm: + filter: CONFIG_BUILD_WITH_TFM + extra_args: EXTRA_CONF_FILE=overlay-tfm.conf + integration_platforms: + - nrf9151dk/nrf9151/ns From d6bee54986a2ee908d4699d91c5f71e6f635011e Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Fri, 13 Sep 2024 09:29:01 +0300 Subject: [PATCH 0316/4482] samples: psa: its: add the psa_its sample Add a sample to demonstrate direct use of the PSA ITS API. The implementation of the API is provided either by the just-introduced secure storage subsystem or by TF-M. Signed-off-by: Tomi Fontanilles --- MAINTAINERS.yml | 1 + samples/psa/index.rst | 6 + samples/psa/its/CMakeLists.txt | 7 + samples/psa/its/README.rst | 67 +++++++++ samples/psa/its/overlay-entropy_driver.conf | 4 + .../psa/its/overlay-entropy_not_secure.conf | 5 + samples/psa/its/overlay-secure_storage.conf | 10 ++ samples/psa/its/prj.conf | 4 + samples/psa/its/sample.yaml | 31 +++++ samples/psa/its/src/main.c | 128 ++++++++++++++++++ 10 files changed, 263 insertions(+) create mode 100644 samples/psa/index.rst create mode 100644 samples/psa/its/CMakeLists.txt create mode 100644 samples/psa/its/README.rst create mode 100644 samples/psa/its/overlay-entropy_driver.conf create mode 100644 samples/psa/its/overlay-entropy_not_secure.conf create mode 100644 samples/psa/its/overlay-secure_storage.conf create mode 100644 samples/psa/its/prj.conf create mode 100644 samples/psa/its/sample.yaml create mode 100644 samples/psa/its/src/main.c diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 41b344761745e..422d849ea79d2 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -4113,6 +4113,7 @@ Secure storage: - tomi-font files: - subsys/secure_storage/ + - samples/psa/ - tests/subsys/secure_storage/ labels: - "area: Secure storage" diff --git a/samples/psa/index.rst b/samples/psa/index.rst new file mode 100644 index 0000000000000..fd5f3386eb312 --- /dev/null +++ b/samples/psa/index.rst @@ -0,0 +1,6 @@ +.. zephyr:code-sample-category:: psa + :name: PSA + :show-listing: + + The following samples demonstrate various uses of several of the + `Platform Security Architecture (PSA) Certified APIs `_. diff --git a/samples/psa/its/CMakeLists.txt b/samples/psa/its/CMakeLists.txt new file mode 100644 index 0000000000000..fbac539c4f0ae --- /dev/null +++ b/samples/psa/its/CMakeLists.txt @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +project(psa_its) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/psa/its/README.rst b/samples/psa/its/README.rst new file mode 100644 index 0000000000000..94bff4f47d9f3 --- /dev/null +++ b/samples/psa/its/README.rst @@ -0,0 +1,67 @@ +.. zephyr:code-sample:: psa_its + :name: PSA Internal Trusted Storage API + :relevant-api: psa_secure_storage + + Use the PSA ITS API. + +Overview +******** + +This sample demonstrates usage of the +`PSA Internal Trusted Storage (ITS) API `_, +which is part of the `PSA Secure Storage API `_, +for storing and retrieving persistent data. + +Requirements +************ + +An implementation of the PSA ITS API must be present for this sample to build. +It can be provided by: + +* :ref:`tfm`, for ``*/ns`` :term:`board targets`. +* The :ref:`secure storage subsystem `, for the other board targets. + +Building +******** + +This sample is located in :zephyr_file:`samples/psa/its`. + +Different configurations are defined in the :file:`sample.yaml` file. +You can use them to build the sample, depending on the PSA ITS provider, as follows: + +.. tabs:: + + .. tab:: TF-M + + For board targets with TF-M: + + .. zephyr-app-commands:: + :zephyr-app: samples/psa/its + :tool: west + :goals: build + :board: + :west-args: -T sample.psa.its.tfm + + .. tab:: secure storage subsystem + + For board targets without TF-M. + + If the board target to compile for has an entropy driver (preferable): + + .. zephyr-app-commands:: + :zephyr-app: samples/psa/its + :tool: west + :goals: build + :board: + :west-args: -T sample.psa.its.secure_storage.entropy_driver + + Or, to use an insecure entropy source (only for testing): + + .. zephyr-app-commands:: + :zephyr-app: samples/psa/its + :tool: west + :goals: build + :board: + :west-args: -T sample.psa.its.secure_storage.entropy_not_secure + +To flash it, see :ref:`west-flashing`. diff --git a/samples/psa/its/overlay-entropy_driver.conf b/samples/psa/its/overlay-entropy_driver.conf new file mode 100644 index 0000000000000..b2fea61e044a3 --- /dev/null +++ b/samples/psa/its/overlay-entropy_driver.conf @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_ENTROPY_GENERATOR=y +CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG=y diff --git a/samples/psa/its/overlay-entropy_not_secure.conf b/samples/psa/its/overlay-entropy_not_secure.conf new file mode 100644 index 0000000000000..2aba3a2c7e27d --- /dev/null +++ b/samples/psa/its/overlay-entropy_not_secure.conf @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_TEST_RANDOM_GENERATOR=y +CONFIG_TIMER_RANDOM_GENERATOR=y +CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y diff --git a/samples/psa/its/overlay-secure_storage.conf b/samples/psa/its/overlay-secure_storage.conf new file mode 100644 index 0000000000000..3473ae389101a --- /dev/null +++ b/samples/psa/its/overlay-secure_storage.conf @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_MBEDTLS=y +CONFIG_MBEDTLS_PSA_CRYPTO_C=y + +# The default stack size (1024) is not enough for the PSA Crypto core. +# On top of that, the ITS implementation uses the stack for buffers. +CONFIG_MAIN_STACK_SIZE=3072 + +CONFIG_SECURE_STORAGE=y diff --git a/samples/psa/its/prj.conf b/samples/psa/its/prj.conf new file mode 100644 index 0000000000000..4c214a79a528c --- /dev/null +++ b/samples/psa/its/prj.conf @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_LOG=y +CONFIG_LOG_DEFAULT_LEVEL=3 diff --git a/samples/psa/its/sample.yaml b/samples/psa/its/sample.yaml new file mode 100644 index 0000000000000..c4ee3543696a7 --- /dev/null +++ b/samples/psa/its/sample.yaml @@ -0,0 +1,31 @@ +sample: + name: PSA ITS API sample + description: Demonstration of PSA Internal Trusted Storage (ITS) API usage. +common: + tags: + - psa.secure_storage + timeout: 10 + harness: console + harness_config: + type: one_line + regex: + - "Sample finished successfully." +tests: + sample.psa.its.tfm: + filter: CONFIG_BUILD_WITH_TFM + tags: + - trusted-firmware-m + sample.psa.its.secure_storage.entropy_driver: + filter: CONFIG_SECURE_STORAGE and not CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_NONE + and CONFIG_ENTROPY_HAS_DRIVER + extra_args: EXTRA_CONF_FILE=overlay-secure_storage.conf;overlay-entropy_driver.conf + tags: + - drivers.entropy + - settings + sample.psa.its.secure_storage.entropy_not_secure: + filter: CONFIG_SECURE_STORAGE and not CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_NONE + and not CONFIG_ENTROPY_HAS_DRIVER + extra_args: EXTRA_CONF_FILE="overlay-secure_storage.conf;overlay-entropy_not_secure.conf" + tags: + - random + - settings diff --git a/samples/psa/its/src/main.c b/samples/psa/its/src/main.c new file mode 100644 index 0000000000000..47752f056585d --- /dev/null +++ b/samples/psa/its/src/main.c @@ -0,0 +1,128 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include + +LOG_MODULE_REGISTER(psa_its); + +#define SAMPLE_DATA_UID (psa_storage_uid_t)1 +#define SAMPLE_DATA_FLAGS PSA_STORAGE_FLAG_NONE + +#ifdef CONFIG_SECURE_STORAGE +#define SAMPLE_DATA_SIZE CONFIG_SECURE_STORAGE_ITS_MAX_DATA_SIZE +#else +#define SAMPLE_DATA_SIZE 128 +#endif + +static int write_and_read_data(void) +{ + LOG_INF("Writing to and reading back from ITS..."); + psa_status_t ret; + + /* Data to be written to ITS. */ + uint8_t p_data_write[SAMPLE_DATA_SIZE]; + + for (unsigned int i = 0; i != sizeof(p_data_write); ++i) { + p_data_write[i] = i; + } + + ret = psa_its_set(SAMPLE_DATA_UID, sizeof(p_data_write), p_data_write, SAMPLE_DATA_FLAGS); + if (ret != PSA_SUCCESS) { + LOG_ERR("Writing the data to ITS failed. (%d)", ret); + return -1; + } + + /* Data to be read from ITS. */ + uint8_t p_data_read[SAMPLE_DATA_SIZE]; + + /* Read back the data starting from an offset. */ + const size_t data_offset = SAMPLE_DATA_SIZE / 2; + + /* Number of bytes read. */ + size_t p_data_length = 0; + + ret = psa_its_get(SAMPLE_DATA_UID, data_offset, sizeof(p_data_read), p_data_read, + &p_data_length); + if (ret != PSA_SUCCESS) { + LOG_ERR("Reading back the data from ITS failed. (%d).", ret); + return -1; + } + + if (p_data_length != SAMPLE_DATA_SIZE - data_offset) { + LOG_ERR("Unexpected amount of bytes read back. (%zu != %zu)", + p_data_length, SAMPLE_DATA_SIZE - data_offset); + return -1; + } + + if (memcmp(p_data_write + data_offset, p_data_read, p_data_length)) { + LOG_HEXDUMP_INF(p_data_write + data_offset, p_data_length, "Data written:"); + LOG_HEXDUMP_INF(p_data_read, p_data_length, "Data read back:"); + LOG_ERR("The data read back doesn't match the data written."); + return -1; + } + + LOG_INF("Successfully wrote to ITS and read back what was written."); + return 0; +} + +static int read_info(void) +{ + LOG_INF("Reading the written entry's metadata..."); + psa_status_t ret; + + /* The entry's metadata. */ + struct psa_storage_info_t p_info; + + ret = psa_its_get_info(SAMPLE_DATA_UID, &p_info); + if (ret != PSA_SUCCESS) { + LOG_ERR("Failed to retrieve the entry's metadata. (%d)", ret); + return -1; + } + + if (p_info.capacity != SAMPLE_DATA_SIZE + || p_info.size != SAMPLE_DATA_SIZE + || p_info.flags != SAMPLE_DATA_FLAGS) { + LOG_ERR("Entry metadata unexpected. (capacity:%zu size:%zu flags:0x%x)", + p_info.capacity, p_info.size, p_info.flags); + return -1; + } + + LOG_INF("Successfully read the entry's metadata."); + return 0; +} + +static int remove_entry(void) +{ + LOG_INF("Removing the entry from ITS..."); + psa_status_t ret; + + ret = psa_its_remove(SAMPLE_DATA_UID); + if (ret != PSA_SUCCESS) { + LOG_ERR("Failed to remove the entry. (%d)", ret); + return -1; + } + + LOG_INF("Entry removed from ITS."); + return 0; +} + +int main(void) +{ + LOG_INF("PSA ITS sample started."); + + if (write_and_read_data()) { + return -1; + } + + if (read_info()) { + return -1; + } + + if (remove_entry()) { + return -1; + } + + LOG_INF("Sample finished successfully."); + return 0; +} From c9a59dd02dbc8bcaa28f7046765ec8facd5b657c Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Fri, 13 Sep 2024 09:32:18 +0300 Subject: [PATCH 0317/4482] samples: psa: persistent_key: add the persistent_key sample Add a sample to demonstrate use of persistent keys in the PSA Crypto API. The implementation of the PSA ITS API that allows storage of persistent keys is provided either by the just-introduced secure storage subsystem or by TF-M. Signed-off-by: Tomi Fontanilles --- samples/psa/persistent_key/CMakeLists.txt | 7 + samples/psa/persistent_key/README.rst | 70 ++++++++++ .../overlay-entropy_driver.conf | 4 + .../overlay-entropy_not_secure.conf | 5 + .../overlay-secure_storage.conf | 10 ++ samples/psa/persistent_key/prj.conf | 8 ++ samples/psa/persistent_key/sample.yaml | 31 +++++ samples/psa/persistent_key/src/main.c | 123 ++++++++++++++++++ 8 files changed, 258 insertions(+) create mode 100644 samples/psa/persistent_key/CMakeLists.txt create mode 100644 samples/psa/persistent_key/README.rst create mode 100644 samples/psa/persistent_key/overlay-entropy_driver.conf create mode 100644 samples/psa/persistent_key/overlay-entropy_not_secure.conf create mode 100644 samples/psa/persistent_key/overlay-secure_storage.conf create mode 100644 samples/psa/persistent_key/prj.conf create mode 100644 samples/psa/persistent_key/sample.yaml create mode 100644 samples/psa/persistent_key/src/main.c diff --git a/samples/psa/persistent_key/CMakeLists.txt b/samples/psa/persistent_key/CMakeLists.txt new file mode 100644 index 0000000000000..2e9651aa6eef1 --- /dev/null +++ b/samples/psa/persistent_key/CMakeLists.txt @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +project(persistent_key) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/psa/persistent_key/README.rst b/samples/psa/persistent_key/README.rst new file mode 100644 index 0000000000000..bc92cbacb1df4 --- /dev/null +++ b/samples/psa/persistent_key/README.rst @@ -0,0 +1,70 @@ +.. zephyr:code-sample:: persistent_key + :name: PSA Crypto persistent key + + Manage and use persistent keys via the PSA Crypto API. + +Overview +******** + +This sample demonstrates usage of persistent keys in the :ref:`PSA Crypto API `. + +Requirements +************ + +In addition to the PSA Crypto API, an implementation of the +`PSA Internal Trusted Storage (ITS) API `_ +(for storage of the persistent keys) must be present for this sample to work. +It can be provided by: + +* :ref:`tfm`, for ``*/ns`` :term:`board targets`. +* The :ref:`secure storage subsystem `, for the other board targets. + +Building +******** + +This sample is located in :zephyr_file:`samples/psa/persistent_key`. + +Different configurations are defined in the :file:`sample.yaml` file. +You can use them to build the sample, depending on the PSA ITS provider, as follows: + +.. tabs:: + + .. tab:: TF-M + + For board targets with TF-M: + + .. zephyr-app-commands:: + :zephyr-app: samples/psa/persistent_key + :tool: west + :goals: build + :board: + :west-args: -T sample.psa.persistent_key.tfm + + .. tab:: secure storage subsystem + + For board targets without TF-M. + + If the board target to compile for has an entropy driver (preferable): + + .. zephyr-app-commands:: + :zephyr-app: samples/psa/persistent_key + :tool: west + :goals: build + :board: + :west-args: -T sample.psa.persistent_key.secure_storage.entropy_driver + + Or, to use an insecure entropy source (only for testing): + + .. zephyr-app-commands:: + :zephyr-app: samples/psa/persistent_key + :tool: west + :goals: build + :board: + :west-args: -T sample.psa.persistent_key.secure_storage.entropy_not_secure + +To flash it, see :ref:`west-flashing`. + +API reference +************* + +`PSA Crypto key management API reference `_ diff --git a/samples/psa/persistent_key/overlay-entropy_driver.conf b/samples/psa/persistent_key/overlay-entropy_driver.conf new file mode 100644 index 0000000000000..b2fea61e044a3 --- /dev/null +++ b/samples/psa/persistent_key/overlay-entropy_driver.conf @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_ENTROPY_GENERATOR=y +CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG=y diff --git a/samples/psa/persistent_key/overlay-entropy_not_secure.conf b/samples/psa/persistent_key/overlay-entropy_not_secure.conf new file mode 100644 index 0000000000000..2aba3a2c7e27d --- /dev/null +++ b/samples/psa/persistent_key/overlay-entropy_not_secure.conf @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_TEST_RANDOM_GENERATOR=y +CONFIG_TIMER_RANDOM_GENERATOR=y +CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y diff --git a/samples/psa/persistent_key/overlay-secure_storage.conf b/samples/psa/persistent_key/overlay-secure_storage.conf new file mode 100644 index 0000000000000..3473ae389101a --- /dev/null +++ b/samples/psa/persistent_key/overlay-secure_storage.conf @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_MBEDTLS=y +CONFIG_MBEDTLS_PSA_CRYPTO_C=y + +# The default stack size (1024) is not enough for the PSA Crypto core. +# On top of that, the ITS implementation uses the stack for buffers. +CONFIG_MAIN_STACK_SIZE=3072 + +CONFIG_SECURE_STORAGE=y diff --git a/samples/psa/persistent_key/prj.conf b/samples/psa/persistent_key/prj.conf new file mode 100644 index 0000000000000..9e78a182bf46e --- /dev/null +++ b/samples/psa/persistent_key/prj.conf @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_LOG=y +CONFIG_LOG_DEFAULT_LEVEL=3 +CONFIG_ASSERT=y + +CONFIG_PSA_WANT_KEY_TYPE_AES=y +CONFIG_PSA_WANT_ALG_CTR=y diff --git a/samples/psa/persistent_key/sample.yaml b/samples/psa/persistent_key/sample.yaml new file mode 100644 index 0000000000000..01cf9f450d1d1 --- /dev/null +++ b/samples/psa/persistent_key/sample.yaml @@ -0,0 +1,31 @@ +sample: + name: PSA Crypto persistent key sample + description: Demonstration of persistent key usage in the PSA Crypto API. +common: + tags: + - psa.secure_storage + timeout: 10 + harness: console + harness_config: + type: one_line + regex: + - "Sample finished successfully." +tests: + sample.psa.persistent_key.tfm: + filter: CONFIG_BUILD_WITH_TFM + tags: + - trusted-firmware-m + sample.psa.persistent_key.secure_storage.entropy_driver: + filter: CONFIG_SECURE_STORAGE and not CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_NONE + and CONFIG_ENTROPY_HAS_DRIVER + extra_args: EXTRA_CONF_FILE=overlay-secure_storage.conf;overlay-entropy_driver.conf + tags: + - drivers.entropy + - settings + sample.psa.persistent_key.secure_storage.entropy_not_secure: + filter: CONFIG_SECURE_STORAGE and not CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_NONE + and not CONFIG_ENTROPY_HAS_DRIVER + extra_args: EXTRA_CONF_FILE="overlay-secure_storage.conf;overlay-entropy_not_secure.conf" + tags: + - random + - settings diff --git a/samples/psa/persistent_key/src/main.c b/samples/psa/persistent_key/src/main.c new file mode 100644 index 0000000000000..c79d8184f94fe --- /dev/null +++ b/samples/psa/persistent_key/src/main.c @@ -0,0 +1,123 @@ +/* Copyright (c) 2024 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include + +LOG_MODULE_REGISTER(persistent_key); + +#define SAMPLE_KEY_ID PSA_KEY_ID_USER_MIN +#define SAMPLE_KEY_TYPE PSA_KEY_TYPE_AES +#define SAMPLE_ALG PSA_ALG_CTR +#define SAMPLE_KEY_BITS 256 + +int generate_persistent_key(void) +{ + LOG_INF("Generating a persistent key..."); + psa_status_t ret; + psa_key_id_t key_id; + psa_key_attributes_t key_attributes = PSA_KEY_ATTRIBUTES_INIT; + + psa_set_key_lifetime(&key_attributes, PSA_KEY_LIFETIME_PERSISTENT); + psa_set_key_usage_flags(&key_attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT); + psa_set_key_id(&key_attributes, SAMPLE_KEY_ID); + psa_set_key_type(&key_attributes, SAMPLE_KEY_TYPE); + psa_set_key_algorithm(&key_attributes, SAMPLE_ALG); + psa_set_key_bits(&key_attributes, SAMPLE_KEY_BITS); + + ret = psa_generate_key(&key_attributes, &key_id); + if (ret != PSA_SUCCESS) { + LOG_ERR("Failed to generate the key. (%d)", ret); + return -1; + } + __ASSERT_NO_MSG(key_id == SAMPLE_KEY_ID); + + /* Purge the key from volatile memory. Has the same affect than resetting the device. */ + ret = psa_purge_key(SAMPLE_KEY_ID); + if (ret != PSA_SUCCESS) { + LOG_ERR("Failed to purge the generated key from volatile memory. (%d).", ret); + return -1; + } + + LOG_INF("Persistent key generated."); + return 0; +} + +int use_persistent_key(void) +{ + LOG_INF("Using the persistent key to encrypt and decrypt some plaintext..."); + psa_status_t ret; + size_t ciphertext_len; + size_t decrypted_text_len; + + static uint8_t plaintext[] = + "Example plaintext to demonstrate basic usage of a persistent key."; + static uint8_t ciphertext[PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(SAMPLE_KEY_TYPE, SAMPLE_ALG, + sizeof(plaintext))]; + static uint8_t decrypted_text[sizeof(plaintext)]; + + ret = psa_cipher_encrypt(SAMPLE_KEY_ID, SAMPLE_ALG, plaintext, sizeof(plaintext), + ciphertext, sizeof(ciphertext), &ciphertext_len); + if (ret != PSA_SUCCESS) { + LOG_ERR("Failed to encrypt the plaintext. (%d)", ret); + return -1; + } + + ret = psa_cipher_decrypt(SAMPLE_KEY_ID, SAMPLE_ALG, ciphertext, ciphertext_len, + decrypted_text, sizeof(decrypted_text), &decrypted_text_len); + if (ret != PSA_SUCCESS) { + LOG_ERR("Failed to decrypt the ciphertext. (%d)", ret); + return -1; + } + __ASSERT_NO_MSG(decrypted_text_len == sizeof(plaintext)); + + /* Make sure the decryption gives us the original plaintext back. */ + if (memcmp(plaintext, decrypted_text, sizeof(plaintext))) { + LOG_HEXDUMP_INF(plaintext, sizeof(plaintext), "Plaintext:"); + LOG_HEXDUMP_INF(ciphertext, ciphertext_len, "Ciphertext:"); + LOG_HEXDUMP_INF(decrypted_text, sizeof(decrypted_text), "Decrypted text:"); + LOG_ERR("The decrypted text doesn't match the plaintext."); + return -1; + } + + LOG_INF("Persistent key usage successful."); + return 0; +} + +static int destroy_persistent_key(void) +{ + LOG_INF("Destroying the persistent key..."); + psa_status_t ret; + + ret = psa_destroy_key(SAMPLE_KEY_ID); + if (ret != PSA_SUCCESS) { + LOG_ERR("Failed to destroy the key. (%d)", ret); + return -1; + } + + LOG_INF("Persistent key destroyed."); + return 0; +} + +int main(void) +{ + LOG_INF("Persistent key sample started."); + + /* Ensure there is not already a key with this ID. */ + psa_destroy_key(SAMPLE_KEY_ID); + + if (generate_persistent_key()) { + return -1; + } + + if (use_persistent_key()) { + return -1; + } + + if (destroy_persistent_key()) { + return -1; + } + + LOG_INF("Sample finished successfully."); + return 0; +} From 571e6019d7b29ca8bee26f519ef84780cdd0a8c5 Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Fri, 13 Sep 2024 09:44:59 +0300 Subject: [PATCH 0318/4482] doc: secure_storage: add documentation for the secure storage subsystem It includes both the high-level documentation of the subsystem and that of APIs defined in code (PSA Secure Storage and internal APIs of the subsystem). Signed-off-by: Tomi Fontanilles --- MAINTAINERS.yml | 1 + doc/releases/release-notes-4.0.rst | 4 + doc/services/index.rst | 2 +- doc/services/secure_storage.rst | 119 +++++++++++++++++++++++++++++ doc/services/tfm/index.rst | 4 +- doc/zephyr.doxyfile.in | 3 +- 6 files changed, 129 insertions(+), 4 deletions(-) create mode 100644 doc/services/secure_storage.rst diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 422d849ea79d2..0eebdfa7406eb 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -4114,6 +4114,7 @@ Secure storage: files: - subsys/secure_storage/ - samples/psa/ + - doc/services/secure_storage.rst - tests/subsys/secure_storage/ labels: - "area: Secure storage" diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index b5bcacdb9e5c1..6e1b0726ab071 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -9,6 +9,10 @@ We are pleased to announce the release of Zephyr version 4.0.0. Major enhancements with this release include: +* The introduction of the :ref:`secure storage` subsystem. It allows the use of the + PSA Secure Storage API and of persistent keys in the PSA Crypto API on all board targets. It + is now the standard way to provide device-specific protection to data at rest. (:github:`76222`) + An overview of the changes required or recommended when migrating your application from Zephyr v3.7.0 to Zephyr v4.0.0 can be found in the separate :ref:`migration guide`. diff --git a/doc/services/index.rst b/doc/services/index.rst index 57e6e2d71b2ef..d1c456151a299 100644 --- a/doc/services/index.rst +++ b/doc/services/index.rst @@ -6,7 +6,6 @@ OS Services .. toctree:: :maxdepth: 1 - binary_descriptors/index.rst console.rst crypto/index @@ -30,6 +29,7 @@ OS Services portability/index.rst poweroff.rst profiling/index.rst + secure_storage.rst shell/index.rst serialization/index.rst settings/index.rst diff --git a/doc/services/secure_storage.rst b/doc/services/secure_storage.rst new file mode 100644 index 0000000000000..5f7b90943b6fd --- /dev/null +++ b/doc/services/secure_storage.rst @@ -0,0 +1,119 @@ +.. _secure_storage: + +Secure storage +############## + +| The secure storage subsystem provides an implementation of the functions defined in the + `Platform Security Architecture (PSA) Secure Storage API `_. +| It can be enabled on :term:`board targets` + that don't already have an implementation of the API. + +Overview +******** + +The secure storage subsystem makes the PSA Secure Storage API available on all board targets with +non-volatile memory support. +As such, it provides an implementation of the API on those that don't already have one, ensuring +functional support for the API. +Board targets with :ref:`tfm` enabled (ending in ``/ns``), for instance, +cannot enable the subsystem because TF-M already provides an implementation of the API. + +| In addition to providing functional support for the API, depending on + device-specific security features and the configuration, the subsystem + may secure the data stored via the PSA Secure Storage API at rest. +| Keep in mind, however, that it's preferable to use a secure processing environment like TF-M when + possible because it's able to provide more security due to isolation guarantees. + +Limitations +*********** + +The secure storage subsystem's implementation of the PSA Secure Storage API: + +* does not aim at full compliance with the specification. + + | Its foremost goal is functional support for the API on all board targets. + | See below for important ways the implementation deviates from the specification. + +* does not guarantee that the data it stores will be secure at rest in all cases. + + This depends on device-specific security features and the configuration. + +* does not yet provide an implementation of the Protected Storage (PS) API as of this writing. + + Instead, the PS API directly calls into the Internal Trusted Storage (ITS) API + (unless a `custom implementation <#whole-api>`_ of the PS API is provided). + +Below are some ways the implementation deviates from the specification +and an explanation why. This is not an exhaustive list. + +* The data stored in the ITS is by default encrypted and authenticated (Against ``1.`` in + `3.2. Internal Trusted Storage requirements `_.) + + | The specification considers the storage underlying the ITS to be + ``implicitly confidential and protected from replay`` + (`2.4. The Internal Trusted Storage API `_) + because ``most embedded microprocessors (MCU) have on-chip flash storage that can be made + inaccessible except to software running on the MCU`` + (`2.2. Technical Background `_). + | This is not the case on all MCUs. Thus, additional protection is provided to the stored data. + + However, this does not guarantee that the data stored will be secure at rest in all cases, + because this depends on device-specific security features and the configuration. + It requires a random entropy source and especially a secure encryption key provider + (:kconfig:option:`CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER`). + + In addition, the data stored in the ITS is not protected against replay attacks, + because this requires storage that is protected by hardware. + +* The data stored via the PSA Secure Storage API is not protected from direct + read/write by software or debugging. (Against ``2.`` and ``10.`` in + `3.2. Internal Trusted Storage requirements `_.) + + It is only secured at rest. Protecting it at runtime as well + requires specific hardware mechanisms to support this. + +Configuration +************* + +To configure the implementation of the PSA Secure Storage API provided by Zephyr, have a look at the +``CONFIG_SECURE_STORAGE_.*`` Kconfig options. They are defined in the various Kconfig files found +under ``subsys/secure_storage/``. + +Customization +************* + +Custom implementations can also replace those of Zephyr at different levels +if the functionality provided by the existing implementations isn't enough. + +Whole API +========= + +If you already have an implementation of the whole ITS or PS API and want to make use of it, you +can do so by enabling the following Kconfig option and implementing the relevant functions: + +* :kconfig:option:`CONFIG_SECURE_STORAGE_ITS_IMPLEMENTATION_CUSTOM`, for the ITS API. +* :kconfig:option:`CONFIG_SECURE_STORAGE_PS_IMPLEMENTATION_CUSTOM`, for the PS API. + +ITS API +======= + +Zephyr's implementation of the ITS API +(:kconfig:option:`CONFIG_SECURE_STORAGE_ITS_IMPLEMENTATION_ZEPHYR`) +makes use of the ITS transform and store modules, which can be configured and customized separately. +Have a look at the ``CONFIG_SECURE_STORAGE_ITS_(STORE|TRANSFORM)_.*_CUSTOM`` +Kconfig options to see the different customization possibilities. + +It's especially recommended to implement a custom encryption key provider +(:kconfig:option:`CONFIG_SECURE_STORAGE_ITS_TRANSFORM_AEAD_KEY_PROVIDER_CUSTOM`) +that is more secure than the available options, if possible. + +Samples +******* + +* :zephyr:code-sample:`persistent_key` +* :zephyr:code-sample:`psa_its` + +PSA Secure Storage API reference +******************************** + +.. doxygengroup:: psa_secure_storage diff --git a/doc/services/tfm/index.rst b/doc/services/tfm/index.rst index e957ae0d5da91..9417648e68861 100644 --- a/doc/services/tfm/index.rst +++ b/doc/services/tfm/index.rst @@ -1,7 +1,7 @@ .. _tfm: -Trusted Firmware-M -################## +Trusted Firmware-M (TF-M) +######################### .. toctree:: :maxdepth: 1 diff --git a/doc/zephyr.doxyfile.in b/doc/zephyr.doxyfile.in index 05b541c517d9d..38b55ad6aeb8f 100644 --- a/doc/zephyr.doxyfile.in +++ b/doc/zephyr.doxyfile.in @@ -980,7 +980,8 @@ INPUT = @ZEPHYR_BASE@/doc/_doxygen/mainpage.md \ @ZEPHYR_BASE@/include/ \ @ZEPHYR_BASE@/lib/libc/minimal/include/ \ @ZEPHYR_BASE@/subsys/testsuite/include/ \ - @ZEPHYR_BASE@/subsys/testsuite/ztest/include/ + @ZEPHYR_BASE@/subsys/testsuite/ztest/include/ \ + @ZEPHYR_BASE@/subsys/secure_storage/include/ \ # This tag can be used to specify the character encoding of the source files # that Doxygen parses. Internally Doxygen uses the UTF-8 encoding. Doxygen uses From afbba5fb9b8b11d68ce0768859c591ddcea86d0b Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 3 Oct 2024 09:41:58 +0200 Subject: [PATCH 0319/4482] boards native_sim docs: Clarify which SDL version is needed One needs the 32bit version of the SDL development library when building for 32bit native_sim, and for the 64bit native_sim the 64bit version. Let's clarify this. Also fix the SDL2 link. Signed-off-by: Alberto Escolar Piedras --- boards/native/native_sim/doc/index.rst | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/boards/native/native_sim/doc/index.rst b/boards/native/native_sim/doc/index.rst index a83d1cd779048..5e8ec87935ced 100644 --- a/boards/native/native_sim/doc/index.rst +++ b/boards/native/native_sim/doc/index.rst @@ -425,13 +425,14 @@ The following peripherals are currently provided with this board: A display driver is provided that creates a window on the host machine to render display content. - This driver requires a 32-bit version of the `SDL2`_ library on the host - machine and ``pkg-config`` settings to correctly pickup the SDL2 install path - and compiler flags. + When building for the default 32bit ``native_sim`` target this driver requires a 32-bit version of + the `SDL2`_ development library on the host machine. For + :ref:`64bit native_sim` builds you need to have the 64bit version installed. + You may also need to set ``pkg-config`` to correctly pickup the SDL2 install path. - On a Ubuntu 22.04 host system, for example, install the ``pkg-config`` and - ``libsdl2-dev:i386`` packages, and configure the pkg-config search path with - these commands: + On Ubuntu the package is ``libsdl2-dev`` whose 64bit version is likely installed by default. + On an Ubuntu 18.04 host system, you can install the ``pkg-config`` and the 32bit + ``libsdl2-dev:i386`` packages, and configure the pkg-config search path with these commands: .. code-block:: console @@ -441,7 +442,7 @@ The following peripherals are currently provided with this board: $ export PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig .. _SDL2: - https://www.libsdl.org/download-2.0.php + https://www.libsdl.org .. _nsim_per_flash_simu: From d41fefe6656209255fb99ae228b444943f9fd6d5 Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Wed, 2 Oct 2024 15:21:31 -0300 Subject: [PATCH 0320/4482] west.yml: hal_espressif: Update for SDK 0.16.9-rc2 bump fix Update for SDK 0.16.9-rc2 bump fix Signed-off-by: Raffael Rostagno --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 58ab293197f9b..e5c9548071bdd 100644 --- a/west.yml +++ b/west.yml @@ -157,7 +157,7 @@ manifest: groups: - hal - name: hal_espressif - revision: 1082a6923353c4a01aeb7acafd1b9a7866820f38 + revision: ef9d884533208005468a118c7ada56e92ae9ba8b path: modules/hal/espressif west-commands: west/west-commands.yml groups: From 29b78abd16bfdce1cdf60da2f227b32e7323bd6c Mon Sep 17 00:00:00 2001 From: Frode van der Meeren Date: Thu, 3 Oct 2024 12:33:51 +0200 Subject: [PATCH 0321/4482] bluetooth: tester: audio: Add verification for bis stopping Adds a semaphor to make sure the stream has properly been stopped by the controller before returning from btp_bap_broadcast_source_stop. Signed-off-by: Frode van der Meeren --- .../tester/src/audio/btp_bap_broadcast.c | 18 +++++++++++++++++- .../tester/src/audio/btp_bap_broadcast.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c b/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c index 0c32c0a13eb45..74aa70f096028 100644 --- a/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c +++ b/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c @@ -23,6 +23,8 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME, CONFIG_BTTESTER_LOG_LEVEL); #include "btp_bap_audio_stream.h" #include "btp_bap_broadcast.h" +static K_SEM_DEFINE(sem_stream_stopped, 0U, CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT); + static struct btp_bap_broadcast_remote_source remote_broadcast_sources[1]; static struct btp_bap_broadcast_local_source local_source; /* Only one PA sync supported for now. */ @@ -132,8 +134,9 @@ static void stream_stopped(struct bt_bap_stream *stream, uint8_t reason) LOG_DBG("Stopped stream %p with reason 0x%02X", stream, reason); btp_bap_audio_stream_stopped(&b_stream->audio_stream); - b_stream->bis_synced = false; + + k_sem_give(&sem_stream_stopped); } static void send_bis_stream_received_ev(const bt_addr_le_t *address, uint32_t broadcast_id, @@ -327,6 +330,8 @@ uint8_t btp_bap_broadcast_source_setup(const void *cmd, uint16_t cmd_len, source->qos.pd = sys_get_le24(cp->presentation_delay); source->qos.sdu = sys_le16_to_cpu(cp->max_sdu); + source->stream_count = cp->subgroups * cp->streams_per_subgroup; + err = setup_broadcast_source(cp->streams_per_subgroup, cp->subgroups, source, &codec_cfg); if (err != 0) { LOG_DBG("Unable to setup broadcast source: %d", err); @@ -484,6 +489,8 @@ uint8_t btp_bap_broadcast_source_stop(const void *cmd, uint16_t cmd_len, LOG_DBG(""); + k_sem_reset(&sem_stream_stopped); + err = bt_bap_broadcast_source_stop(source->bap_broadcast); if (err != 0) { LOG_DBG("Unable to stop broadcast source: %d", err); @@ -491,6 +498,15 @@ uint8_t btp_bap_broadcast_source_stop(const void *cmd, uint16_t cmd_len, return BTP_STATUS_FAILED; } + for (int i = 0; i < source->stream_count; i++) { + err = k_sem_take(&sem_stream_stopped, K_MSEC(1000)); + if (err != 0) { + LOG_DBG("Timed out waiting for stream nr %d to stop", i); + + return BTP_STATUS_FAILED; + } + } + return BTP_STATUS_SUCCESS; } diff --git a/tests/bluetooth/tester/src/audio/btp_bap_broadcast.h b/tests/bluetooth/tester/src/audio/btp_bap_broadcast.h index 4471928f84cc4..a7fe7ec970bff 100644 --- a/tests/bluetooth/tester/src/audio/btp_bap_broadcast.h +++ b/tests/bluetooth/tester/src/audio/btp_bap_broadcast.h @@ -45,6 +45,7 @@ struct btp_bap_broadcast_local_source { struct bt_bap_qos_cfg qos; struct btp_bap_broadcast_stream streams[CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT]; struct bt_audio_codec_cfg subgroup_codec_cfg[CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT]; + uint8_t stream_count; /* Only for BTP BAP commands */ struct bt_bap_broadcast_source *bap_broadcast; /* Only for BTP CAP commands */ From c334ed515b08f5c044cb3bd6d096158074817c04 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Fri, 27 Sep 2024 10:15:34 +0200 Subject: [PATCH 0322/4482] Bluetooth: Controller: Fix multiple Extended Adv chain reception Fix assertion when enabling simultaneous multiple Extended Advertising chain reception that is enabled by increasing supported auxiliary scan contexts. ULL sets the association of aux context to scan and sync context, and LLL resets the association; this is safer compared to earlier implementation where ULL did both the association and reset which caused aux context memory leak. Supported auxiliary scan contexts can be increased using CONFIG_BT_CTLR_SCAN_AUX_SET value. Signed-off-by: Vinayak Kariappa Chettimada --- .../controller/ll_sw/nordic/lll/lll_scan.c | 5 ++++ .../ll_sw/nordic/lll/lll_scan_aux.c | 15 ++++++++++ .../controller/ll_sw/nordic/lll/lll_sync.c | 5 ++++ .../bluetooth/controller/ll_sw/ull_scan_aux.c | 30 ++++++++----------- 4 files changed, 37 insertions(+), 18 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c index fc85e67441e2b..37bc040b88378 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c @@ -1549,6 +1549,11 @@ static int isr_rx_scan_report(struct lll_scan *lll, uint8_t devmatch_ok, { struct node_rx_ftr *ftr; + /* Reset Scan context association with any Aux context as a new + * extended advertising chain is being setup for reception here. + */ + lll->lll_aux = NULL; + ftr = &(node_rx->rx_ftr); ftr->param = lll; ftr->ticks_anchor = radio_tmr_start_get(); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c index 2424ab8a653a1..8f913558aead7 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c @@ -1241,17 +1241,32 @@ static int isr_rx_pdu(struct lll_scan *lll, struct lll_scan_aux *lll_aux, ftr = &(node_rx->rx_ftr); if (lll_aux) { + /* Auxiliary context was used in ULL scheduling in the + * reception of this current PDU. + */ ftr->param = lll_aux; ftr->scan_rsp = lll_aux->state; /* Further auxiliary PDU reception will be chain PDUs */ lll_aux->is_chain_sched = 1U; + + /* Reset auxiliary context association with scan context + * as ULL scheduling has been used and may switch to + * using LLL scheduling if the next auxiliary PDU in + * chain is below the threshold to use ULL scheduling. + */ + lll->lll_aux = NULL; + } else if (lll->lll_aux) { + /* Auxiliary context was allocated to Scan context in + * LLL scheduling in the reception of this current PDU. + */ ftr->param = lll; ftr->scan_rsp = lll->lll_aux->state; /* Further auxiliary PDU reception will be chain PDUs */ lll->lll_aux->is_chain_sched = 1U; + } else { /* Return -ECHILD, as ULL execution has not yet assigned * an aux context. This can happen only under LLL diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c index 63b6e9a53b5d3..f74b5fa145d17 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c @@ -805,6 +805,11 @@ static int isr_rx(struct lll_sync *lll, uint8_t node_type, uint8_t crc_ok, * again a node_rx for periodic report incomplete. */ if (node_type != NODE_RX_TYPE_EXT_AUX_REPORT) { + /* Reset Sync context association with any Aux context + * as a new chain is being setup for reception here. + */ + lll->lll_aux = NULL; + node_rx = ull_pdu_rx_alloc_peek(4); } else { node_rx = ull_pdu_rx_alloc_peek(3); diff --git a/subsys/bluetooth/controller/ll_sw/ull_scan_aux.c b/subsys/bluetooth/controller/ll_sw/ull_scan_aux.c index 4b60901752452..17aa91f07bf1a 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_scan_aux.c +++ b/subsys/bluetooth/controller/ll_sw/ull_scan_aux.c @@ -645,6 +645,9 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) */ if (ftr->aux_lll_sched) { if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) && sync_lll) { + /* Associate Sync context with the Aux context so that + * it can continue reception in LLL scheduling. + */ sync_lll->lll_aux = lll_aux; /* AUX_ADV_IND/AUX_CHAIN_IND PDU reception is being @@ -661,8 +664,8 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) */ LL_ASSERT(!lll->lll_aux || (lll->lll_aux == lll_aux)); - /* scan context get the aux context so that it can - * continue reception in LLL scheduling. + /* Associate Scan context with the Aux context so that + * it can continue reception in LLL scheduling. */ lll->lll_aux = lll_aux; @@ -688,11 +691,6 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) if (unlikely(scan->is_stop)) { goto ull_scan_aux_rx_flush; } - - /* Remove auxiliary context association with scan context so - * that LLL can differentiate it to being ULL scheduling. - */ - lll->lll_aux = NULL; } else { struct ll_sync_set *sync_set; @@ -705,7 +703,13 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) goto ull_scan_aux_rx_flush; } - /* Associate the auxiliary context with sync context */ + /* Associate the auxiliary context with sync context, we do this + * for ULL scheduling also in constrast to how extended + * advertising only associates when LLL scheduling is used. + * Each Periodic Advertising chain is received by unique sync + * context, hence LLL and ULL scheduling is always associated + * with same unique sync context. + */ sync_lll->lll_aux = lll_aux; /* Backup the node rx to be dispatch on successfully ULL @@ -1280,19 +1284,9 @@ static void flush(void *param) scan = HDR_LLL2ULL(lll); scan = ull_scan_is_valid_get(scan); if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || scan) { - lll->lll_aux = NULL; #if defined(CONFIG_BT_CTLR_JIT_SCHEDULING) lll->scan_aux_score = aux->lll.hdr.score; #endif /* CONFIG_BT_CTLR_JIT_SCHEDULING */ - } else { - struct lll_sync *sync_lll; - struct ll_sync_set *sync; - - sync_lll = aux->parent; - sync = HDR_LLL2ULL(sync_lll); - - LL_ASSERT(sync->is_stop || sync_lll->lll_aux); - sync_lll->lll_aux = NULL; } aux_release(aux); From aa7c367f443ecf7c536910e75cee3b3873938b06 Mon Sep 17 00:00:00 2001 From: Mateusz Holenko Date: Tue, 24 Sep 2024 13:58:43 +0200 Subject: [PATCH 0323/4482] drivers: led_strip: Fix formatting of log message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous version generated compilation warnings. Signed-off-by: Mateusz Hołenko --- drivers/led_strip/lpd880x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/led_strip/lpd880x.c b/drivers/led_strip/lpd880x.c index d4b56509db1b8..c447f5435e882 100644 --- a/drivers/led_strip/lpd880x.c +++ b/drivers/led_strip/lpd880x.c @@ -78,7 +78,7 @@ static int lpd880x_update(const struct device *dev, void *data, size_t size) rc = spi_write_dt(&config->bus, &tx); if (rc) { - LOG_ERR("can't update strip: %d", rc); + LOG_ERR("can't update strip: %zu", rc); } return rc; From b27e36242bd01c1db27a1c9e00a4b7863ffdc81b Mon Sep 17 00:00:00 2001 From: Guillaume Gautier Date: Tue, 17 Sep 2024 08:40:29 +0200 Subject: [PATCH 0324/4482] include: zephyr: dt-bindings: clock: st: add bus source clocks Add missing bus source clocks define for STM32H5, L1, U5 and WBA Signed-off-by: Guillaume Gautier --- include/zephyr/dt-bindings/clock/stm32h5_clock.h | 7 ++++++- include/zephyr/dt-bindings/clock/stm32l1_clock.h | 1 + include/zephyr/dt-bindings/clock/stm32u5_clock.h | 7 ++++++- include/zephyr/dt-bindings/clock/stm32wba_clock.h | 8 +++++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/include/zephyr/dt-bindings/clock/stm32h5_clock.h b/include/zephyr/dt-bindings/clock/stm32h5_clock.h index 197d26ccea672..25e0d7ab7ba39 100644 --- a/include/zephyr/dt-bindings/clock/stm32h5_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32h5_clock.h @@ -20,8 +20,13 @@ #define STM32_SRC_CSI (STM32_SRC_HSE + 1) #define STM32_SRC_HSI (STM32_SRC_CSI + 1) #define STM32_SRC_HSI48 (STM32_SRC_HSI + 1) +/** Bus clock */ +#define STM32_SRC_HCLK (STM32_SRC_HSI48 + 1) +#define STM32_SRC_PCLK1 (STM32_SRC_HCLK + 1) +#define STM32_SRC_PCLK2 (STM32_SRC_PCLK1 + 1) +#define STM32_SRC_PCLK3 (STM32_SRC_PCLK2 + 1) /** PLL outputs */ -#define STM32_SRC_PLL1_P (STM32_SRC_HSI48 + 1) +#define STM32_SRC_PLL1_P (STM32_SRC_PCLK3 + 1) #define STM32_SRC_PLL1_Q (STM32_SRC_PLL1_P + 1) #define STM32_SRC_PLL1_R (STM32_SRC_PLL1_Q + 1) #define STM32_SRC_PLL2_P (STM32_SRC_PLL1_R + 1) diff --git a/include/zephyr/dt-bindings/clock/stm32l1_clock.h b/include/zephyr/dt-bindings/clock/stm32l1_clock.h index 1dd1fbb90c293..602133e799041 100644 --- a/include/zephyr/dt-bindings/clock/stm32l1_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32l1_clock.h @@ -24,6 +24,7 @@ /** Fixed clocks */ /* Low speed clocks defined in stm32_common_clocks.h */ #define STM32_SRC_HSE (STM32_SRC_LSI + 1) +#define STM32_SRC_HSI (STM32_SRC_HSE + 1) #define STM32_CLOCK_REG_MASK 0xFFU #define STM32_CLOCK_REG_SHIFT 0U diff --git a/include/zephyr/dt-bindings/clock/stm32u5_clock.h b/include/zephyr/dt-bindings/clock/stm32u5_clock.h index 5c5d5344a6867..d9c426a6b36bb 100644 --- a/include/zephyr/dt-bindings/clock/stm32u5_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32u5_clock.h @@ -21,8 +21,13 @@ #define STM32_SRC_HSI48 (STM32_SRC_HSI16 + 1) #define STM32_SRC_MSIS (STM32_SRC_HSI48 + 1) #define STM32_SRC_MSIK (STM32_SRC_MSIS + 1) +/** Bus clock */ +#define STM32_SRC_HCLK (STM32_SRC_MSIK + 1) +#define STM32_SRC_PCLK1 (STM32_SRC_HCLK + 1) +#define STM32_SRC_PCLK2 (STM32_SRC_PCLK1 + 1) +#define STM32_SRC_PCLK3 (STM32_SRC_PCLK2 + 1) /** PLL outputs */ -#define STM32_SRC_PLL1_P (STM32_SRC_MSIK + 1) +#define STM32_SRC_PLL1_P (STM32_SRC_PCLK3 + 1) #define STM32_SRC_PLL1_Q (STM32_SRC_PLL1_P + 1) #define STM32_SRC_PLL1_R (STM32_SRC_PLL1_Q + 1) #define STM32_SRC_PLL2_P (STM32_SRC_PLL1_R + 1) diff --git a/include/zephyr/dt-bindings/clock/stm32wba_clock.h b/include/zephyr/dt-bindings/clock/stm32wba_clock.h index 4dc686e8943af..36b25ed0826f1 100644 --- a/include/zephyr/dt-bindings/clock/stm32wba_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32wba_clock.h @@ -18,8 +18,14 @@ /* Low speed clocks defined in stm32_common_clocks.h */ #define STM32_SRC_HSE (STM32_SRC_LSI + 1) #define STM32_SRC_HSI16 (STM32_SRC_HSE + 1) +/** Bus clock */ +#define STM32_SRC_HCLK1 (STM32_SRC_HSI16 + 1) +#define STM32_SRC_HCLK5 (STM32_SRC_HCLK1 + 1) +#define STM32_SRC_PCLK1 (STM32_SRC_HCLK5 + 1) +#define STM32_SRC_PCLK2 (STM32_SRC_PCLK1 + 1) +#define STM32_SRC_PCLK7 (STM32_SRC_PCLK2 + 1) /** PLL outputs */ -#define STM32_SRC_PLL1_P (STM32_SRC_HSI16 + 1) +#define STM32_SRC_PLL1_P (STM32_SRC_PCLK7 + 1) #define STM32_SRC_PLL1_Q (STM32_SRC_PLL1_P + 1) #define STM32_SRC_PLL1_R (STM32_SRC_PLL1_Q + 1) From 46d4be75e07aaf635327f86bcd1255d85dbbc2d3 Mon Sep 17 00:00:00 2001 From: Guillaume Gautier Date: Tue, 17 Sep 2024 08:41:23 +0200 Subject: [PATCH 0325/4482] drivers: clock_control: st: add missing bus source clocks Add missing bus source clocks for STM32H5, U5 and WBA Signed-off-by: Guillaume Gautier --- drivers/clock_control/clock_stm32_ll_h5.c | 8 ++++++++ drivers/clock_control/clock_stm32_ll_u5.c | 8 ++++++++ drivers/clock_control/clock_stm32_ll_wba.c | 10 ++++++++++ 3 files changed, 26 insertions(+) diff --git a/drivers/clock_control/clock_stm32_ll_h5.c b/drivers/clock_control/clock_stm32_ll_h5.c index c7ecfe0812355..7994db07f95c8 100644 --- a/drivers/clock_control/clock_stm32_ll_h5.c +++ b/drivers/clock_control/clock_stm32_ll_h5.c @@ -120,6 +120,10 @@ static uint32_t get_sysclk_frequency(void) int enabled_clock(uint32_t src_clk) { if ((src_clk == STM32_SRC_SYSCLK) || + (src_clk == STM32_SRC_HCLK) || + (src_clk == STM32_SRC_PCLK1) || + (src_clk == STM32_SRC_PCLK2) || + (src_clk == STM32_SRC_PCLK3) || ((src_clk == STM32_SRC_HSE) && IS_ENABLED(STM32_HSE_ENABLED)) || ((src_clk == STM32_SRC_HSI) && IS_ENABLED(STM32_HSI_ENABLED)) || ((src_clk == STM32_SRC_HSI48) && IS_ENABLED(STM32_HSI48_ENABLED)) || @@ -226,16 +230,20 @@ static int stm32_clock_control_get_subsys_rate(const struct device *dev, case STM32_CLOCK_BUS_AHB1: case STM32_CLOCK_BUS_AHB2: case STM32_CLOCK_BUS_AHB4: + case STM32_SRC_HCLK: *rate = ahb_clock; break; case STM32_CLOCK_BUS_APB1: case STM32_CLOCK_BUS_APB1_2: + case STM32_SRC_PCLK1: *rate = apb1_clock; break; case STM32_CLOCK_BUS_APB2: + case STM32_SRC_PCLK2: *rate = apb2_clock; break; case STM32_CLOCK_BUS_APB3: + case STM32_SRC_PCLK3: *rate = apb3_clock; break; case STM32_SRC_SYSCLK: diff --git a/drivers/clock_control/clock_stm32_ll_u5.c b/drivers/clock_control/clock_stm32_ll_u5.c index 8d1ba380cf3f5..ad22fd84ec4aa 100644 --- a/drivers/clock_control/clock_stm32_ll_u5.c +++ b/drivers/clock_control/clock_stm32_ll_u5.c @@ -124,6 +124,10 @@ static uint32_t get_sysclk_frequency(void) int enabled_clock(uint32_t src_clk) { if ((src_clk == STM32_SRC_SYSCLK) || + (src_clk == STM32_SRC_HCLK) || + (src_clk == STM32_SRC_PCLK1) || + (src_clk == STM32_SRC_PCLK2) || + (src_clk == STM32_SRC_PCLK3) || ((src_clk == STM32_SRC_HSE) && IS_ENABLED(STM32_HSE_ENABLED)) || ((src_clk == STM32_SRC_HSI16) && IS_ENABLED(STM32_HSI_ENABLED)) || ((src_clk == STM32_SRC_HSI48) && IS_ENABLED(STM32_HSI48_ENABLED)) || @@ -234,16 +238,20 @@ static int stm32_clock_control_get_subsys_rate(const struct device *dev, case STM32_CLOCK_BUS_AHB2: case STM32_CLOCK_BUS_AHB2_2: case STM32_CLOCK_BUS_AHB3: + case STM32_SRC_HCLK: *rate = ahb_clock; break; case STM32_CLOCK_BUS_APB1: case STM32_CLOCK_BUS_APB1_2: + case STM32_SRC_PCLK1: *rate = apb1_clock; break; case STM32_CLOCK_BUS_APB2: + case STM32_SRC_PCLK2: *rate = apb2_clock; break; case STM32_CLOCK_BUS_APB3: + case STM32_SRC_PCLK3: *rate = apb3_clock; break; case STM32_SRC_SYSCLK: diff --git a/drivers/clock_control/clock_stm32_ll_wba.c b/drivers/clock_control/clock_stm32_ll_wba.c index 3000120a2b7d6..665c61a12837b 100644 --- a/drivers/clock_control/clock_stm32_ll_wba.c +++ b/drivers/clock_control/clock_stm32_ll_wba.c @@ -44,6 +44,11 @@ static uint32_t get_bus_clock(uint32_t clock, uint32_t prescaler) int enabled_clock(uint32_t src_clk) { if ((src_clk == STM32_SRC_SYSCLK) || + (src_clk == STM32_SRC_HCLK1) || + (src_clk == STM32_SRC_HCLK5) || + (src_clk == STM32_SRC_PCLK1) || + (src_clk == STM32_SRC_PCLK2) || + (src_clk == STM32_SRC_PCLK7) || ((src_clk == STM32_SRC_HSE) && IS_ENABLED(STM32_HSE_ENABLED)) || ((src_clk == STM32_SRC_HSI16) && IS_ENABLED(STM32_HSI_ENABLED)) || ((src_clk == STM32_SRC_LSE) && IS_ENABLED(STM32_LSE_ENABLED)) || @@ -194,19 +199,24 @@ static int stm32_clock_control_get_subsys_rate(const struct device *dev, case STM32_CLOCK_BUS_AHB1: case STM32_CLOCK_BUS_AHB2: case STM32_CLOCK_BUS_AHB4: + case STM32_SRC_HCLK1: *rate = ahb_clock; break; case STM32_CLOCK_BUS_AHB5: + case STM32_SRC_HCLK5: *rate = ahb5_clock; break; case STM32_CLOCK_BUS_APB1: case STM32_CLOCK_BUS_APB1_2: + case STM32_SRC_PCLK1: *rate = apb1_clock; break; case STM32_CLOCK_BUS_APB2: + case STM32_SRC_PCLK2: *rate = apb2_clock; break; case STM32_CLOCK_BUS_APB7: + case STM32_SRC_PCLK7: *rate = apb7_clock; break; case STM32_SRC_SYSCLK: From 1d639aabe4b6c97cd3d5b278b55a1274aa76d854 Mon Sep 17 00:00:00 2001 From: Guillaume Gautier Date: Tue, 17 Sep 2024 08:44:12 +0200 Subject: [PATCH 0326/4482] dts: arm: st: add default clock source for asynchronous ADC For STM32L1, U5 and WBA, the ADC always uses an asynchronous clock source, so we add the default clock source in the clock node. Signed-off-by: Guillaume Gautier --- dts/arm/st/l1/stm32l1.dtsi | 3 ++- dts/arm/st/u5/stm32u5.dtsi | 6 ++++-- dts/arm/st/u5/stm32u595.dtsi | 3 ++- dts/arm/st/wba/stm32wba.dtsi | 3 ++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/dts/arm/st/l1/stm32l1.dtsi b/dts/arm/st/l1/stm32l1.dtsi index 3816489f42ffc..b4e6bb97fee03 100644 --- a/dts/arm/st/l1/stm32l1.dtsi +++ b/dts/arm/st/l1/stm32l1.dtsi @@ -216,7 +216,8 @@ adc1: adc@40012400 { compatible = "st,stm32f4-adc", "st,stm32-adc"; reg = <0x40012400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000200>; + clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000200>, + <&rcc STM32_SRC_HSI NO_SEL>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; diff --git a/dts/arm/st/u5/stm32u5.dtsi b/dts/arm/st/u5/stm32u5.dtsi index b3d22db073960..ced2cbb0723d1 100644 --- a/dts/arm/st/u5/stm32u5.dtsi +++ b/dts/arm/st/u5/stm32u5.dtsi @@ -781,7 +781,8 @@ adc1: adc@42028000 { compatible = "st,stm32-adc"; reg = <0x42028000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000400>; + clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000400>, + <&rcc STM32_SRC_HCLK ADCDAC_SEL(0)>; interrupts = <37 0>; status = "disabled"; #io-channel-cells = <1>; @@ -797,7 +798,8 @@ adc4: adc@46021000 { compatible = "st,stm32-adc"; reg = <0x46021000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00000020>; + clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00000020>, + <&rcc STM32_SRC_HCLK ADCDAC_SEL(0)>; interrupts = <113 0>; status = "disabled"; #io-channel-cells = <1>; diff --git a/dts/arm/st/u5/stm32u595.dtsi b/dts/arm/st/u5/stm32u595.dtsi index 00147808da64c..fa5639934be7b 100644 --- a/dts/arm/st/u5/stm32u595.dtsi +++ b/dts/arm/st/u5/stm32u595.dtsi @@ -64,7 +64,8 @@ adc2: adc@42028100 { compatible = "st,stm32-adc"; reg = <0x42028100 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000400>; + clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000400>, + <&rcc STM32_SRC_HCLK ADCDAC_SEL(0)>; interrupts = <37 0>; status = "disabled"; #io-channel-cells = <1>; diff --git a/dts/arm/st/wba/stm32wba.dtsi b/dts/arm/st/wba/stm32wba.dtsi index bd9a601dcd724..aa59cef65b3e0 100644 --- a/dts/arm/st/wba/stm32wba.dtsi +++ b/dts/arm/st/wba/stm32wba.dtsi @@ -413,7 +413,8 @@ adc4: adc@46021000 { compatible = "st,stm32-adc"; reg = <0x46021000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000020>; + clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000020>, + <&rcc STM32_SRC_HCLK1 ADC_SEL(0)>; interrupts = <65 0>; status = "disabled"; #io-channel-cells = <1>; From 111b2bb150e66e01084500675dfed28bb21047dd Mon Sep 17 00:00:00 2001 From: Guillaume Gautier Date: Tue, 17 Sep 2024 08:46:03 +0200 Subject: [PATCH 0327/4482] boards: st: add adc clock source if asynchronous clock is used For all STM32 boards that define an asynchronous clock for ADC, specify which clock is to be used in the clock node. Signed-off-by: Guillaume Gautier --- boards/st/nucleo_g071rb/nucleo_g071rb.dts | 2 ++ boards/st/nucleo_h533re/nucleo_h533re.dts | 2 ++ boards/st/nucleo_h563zi/nucleo_h563zi-common.dtsi | 2 ++ boards/st/stm32h573i_dk/stm32h573i_dk.dts | 2 ++ 4 files changed, 8 insertions(+) diff --git a/boards/st/nucleo_g071rb/nucleo_g071rb.dts b/boards/st/nucleo_g071rb/nucleo_g071rb.dts index 9237cd779b014..6bfd17bd89398 100644 --- a/boards/st/nucleo_g071rb/nucleo_g071rb.dts +++ b/boards/st/nucleo_g071rb/nucleo_g071rb.dts @@ -143,6 +143,8 @@ }; &adc1 { + clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00100000>, + <&rcc STM32_SRC_SYSCLK ADC_SEL(0)>; pinctrl-0 = <&adc1_in0_pa0 &adc1_in1_pa1>; pinctrl-names = "default"; st,adc-clock-source = ; diff --git a/boards/st/nucleo_h533re/nucleo_h533re.dts b/boards/st/nucleo_h533re/nucleo_h533re.dts index fdb245e432082..ad89a5e80350f 100644 --- a/boards/st/nucleo_h533re/nucleo_h533re.dts +++ b/boards/st/nucleo_h533re/nucleo_h533re.dts @@ -121,6 +121,8 @@ }; &adc1 { + clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000400>, + <&rcc STM32_SRC_HCLK ADCDAC_SEL(0)>; pinctrl-0 = <&adc1_inp0_pa0>; /* Arduino A0 */ pinctrl-names = "default"; st,adc-clock-source = ; diff --git a/boards/st/nucleo_h563zi/nucleo_h563zi-common.dtsi b/boards/st/nucleo_h563zi/nucleo_h563zi-common.dtsi index 030bab86a0cb2..246e93926ccba 100644 --- a/boards/st/nucleo_h563zi/nucleo_h563zi-common.dtsi +++ b/boards/st/nucleo_h563zi/nucleo_h563zi-common.dtsi @@ -145,6 +145,8 @@ }; &adc1 { + clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000400>, + <&rcc STM32_SRC_HCLK ADCDAC_SEL(0)>; pinctrl-0 = <&adc1_inp3_pa6 &adc1_inp15_pa3>; /* Zio A0, Zio D35 */ pinctrl-names = "default"; st,adc-clock-source = ; diff --git a/boards/st/stm32h573i_dk/stm32h573i_dk.dts b/boards/st/stm32h573i_dk/stm32h573i_dk.dts index c64ff945106f2..fcc109526287c 100644 --- a/boards/st/stm32h573i_dk/stm32h573i_dk.dts +++ b/boards/st/stm32h573i_dk/stm32h573i_dk.dts @@ -237,6 +237,8 @@ }; &adc1 { + clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000400>, + <&rcc STM32_SRC_HCLK ADCDAC_SEL(0)>; pinctrl-0 = <&adc1_inp6_pf12>; /* Arduino A5 */ pinctrl-names = "default"; st,adc-clock-source = ; From 9566d4ecb54f40153b182f10cc4b41828347f6e8 Mon Sep 17 00:00:00 2001 From: Guillaume Gautier Date: Tue, 17 Sep 2024 08:47:50 +0200 Subject: [PATCH 0328/4482] drivers: adc: stm32: add a check for asynchronous clock source Add a compile-time check to verify that a domain clock is explicitly defined if a STM32 ADC is configured to use an asynchronous clock. Signed-off-by: Guillaume Gautier --- drivers/adc/adc_stm32.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/adc/adc_stm32.c b/drivers/adc/adc_stm32.c index df360aefee0e9..58e49351629e0 100644 --- a/drivers/adc/adc_stm32.c +++ b/drivers/adc/adc_stm32.c @@ -1640,6 +1640,11 @@ static const struct adc_driver_api api_stm32_driver_api = { _CONCAT(ADC_STM32_CLOCK_PREFIX(x), ADC_STM32_DIV(x)) #endif +/* Macro to check if the ADC instance clock setup is correct */ +#define ADC_STM32_CHECK_DT_CLOCK(x) \ + BUILD_ASSERT(IS_EQ(ADC_STM32_CLOCK(x), SYNC) || (DT_INST_NUM_CLOCKS(x) > 1), \ + "ASYNC clock mode defined without ASYNC clock defined in device tree") + #if defined(CONFIG_ADC_STM32_DMA) #define ADC_DMA_CHANNEL_INIT(index, src_dev, dest_dev) \ @@ -1782,6 +1787,8 @@ DT_INST_FOREACH_STATUS_OKAY(GENERATE_ISR) #define ADC_STM32_INIT(index) \ \ +ADC_STM32_CHECK_DT_CLOCK(index); \ + \ PINCTRL_DT_INST_DEFINE(index); \ \ static const struct stm32_pclken pclken_##index[] = \ From 3c261c273ba2d2ab6aeace7854cc43b3f3d27e94 Mon Sep 17 00:00:00 2001 From: Guillaume Gautier Date: Tue, 17 Sep 2024 10:53:39 +0200 Subject: [PATCH 0329/4482] dts: bindings: adc: stm32: update adc bindings doc Update ADC bindings documentation to state that a domain clock is now necessary if asynchronous clock is selected. Signed-off-by: Guillaume Gautier --- dts/bindings/adc/st,stm32-adc.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dts/bindings/adc/st,stm32-adc.yaml b/dts/bindings/adc/st,stm32-adc.yaml index 544125de36c1f..b1209142b4ce9 100644 --- a/dts/bindings/adc/st,stm32-adc.yaml +++ b/dts/bindings/adc/st,stm32-adc.yaml @@ -32,6 +32,8 @@ properties: - : derived from the bus clock. - : independent and asynchronous with the bus clock One of the two values may not apply to some series. Refer to the RefMan. + If an asynchronous clock is selected, a domain clock in the clock property + has to be defined explicitly. st,adc-prescaler: type: int From 2a67664c5588033a464110ce73aab72214f75f69 Mon Sep 17 00:00:00 2001 From: Guillaume Gautier Date: Tue, 17 Sep 2024 10:55:07 +0200 Subject: [PATCH 0330/4482] doc: releases: migration guide: stm32 adc async clock Update the migration guide to indicate that the STM32 ADC that selects an asynchronous clock also need to set a domain clock. Signed-off-by: Guillaume Gautier --- doc/releases/migration-guide-4.0.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 1cc6a122af170..fcd9c5805e127 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -118,6 +118,12 @@ Device Drivers and Devicetree their driver API, users of these devices should ensure they pass appropriate values to :c:func:`gpio_pin_set`. (:github:`65797`) +Analog Digital Converter (ADC) +============================== + +* For all STM32 ADC that selects an asynchronous clock through ``st,adc-clock-source`` property, + it is now mandatory to also explicitly define a domain clock source using the ``clock`` property. + Clock control ============= From e8c4867806cf0ac912201a60b417337e4c29ddf5 Mon Sep 17 00:00:00 2001 From: Xudong Zheng <7pkvm5aw@slicealias.com> Date: Sun, 15 Sep 2024 12:46:48 -0400 Subject: [PATCH 0331/4482] usb: cdc_acm: disable logging if used for shell with logging This prevents recursive logging loop when USB CDC ACM is used for shell with logging. Change affects both USB stacks. Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com> --- subsys/usb/device/class/cdc_acm.c | 10 ++++++---- subsys/usb/device_next/class/usbd_cdc_acm.c | 12 +++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/subsys/usb/device/class/cdc_acm.c b/subsys/usb/device/class/cdc_acm.c index 417a35f07144a..7e5fbbb672a95 100644 --- a/subsys/usb/device/class/cdc_acm.c +++ b/subsys/usb/device/class/cdc_acm.c @@ -56,15 +56,17 @@ /* definitions */ #include -#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart) \ - && defined(CONFIG_LOG_BACKEND_UART) \ - && defined(CONFIG_USB_CDC_ACM_LOG_LEVEL) \ - && CONFIG_USB_CDC_ACM_LOG_LEVEL != LOG_LEVEL_NONE /* Prevent endless recursive logging loop and warn user about it */ +#if defined(CONFIG_USB_CDC_ACM_LOG_LEVEL) && CONFIG_USB_CDC_ACM_LOG_LEVEL != LOG_LEVEL_NONE +#define CHOSEN_CONSOLE DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart) +#define CHOSEN_SHELL DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_shell_uart), zephyr_cdc_acm_uart) +#if (CHOSEN_CONSOLE && defined(CONFIG_LOG_BACKEND_UART)) || \ + (CHOSEN_SHELL && defined(CONFIG_SHELL_LOG_BACKEND)) #warning "USB_CDC_ACM_LOG_LEVEL forced to LOG_LEVEL_NONE" #undef CONFIG_USB_CDC_ACM_LOG_LEVEL #define CONFIG_USB_CDC_ACM_LOG_LEVEL LOG_LEVEL_NONE #endif +#endif LOG_MODULE_REGISTER(usb_cdc_acm, CONFIG_USB_CDC_ACM_LOG_LEVEL); /* 115200bps, no parity, 1 stop bit, 8bit char */ diff --git a/subsys/usb/device_next/class/usbd_cdc_acm.c b/subsys/usb/device_next/class/usbd_cdc_acm.c index 80f4a858386ed..a380630458942 100644 --- a/subsys/usb/device_next/class/usbd_cdc_acm.c +++ b/subsys/usb/device_next/class/usbd_cdc_acm.c @@ -21,15 +21,17 @@ #include "usbd_msg.h" #include -#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart) \ - && defined(CONFIG_LOG_BACKEND_UART) \ - && defined(CONFIG_USBD_CDC_ACM_LOG_LEVEL) \ - && CONFIG_USBD_CDC_ACM_LOG_LEVEL != LOG_LEVEL_NONE /* Prevent endless recursive logging loop and warn user about it */ -#warning "USB_CDC_ACM_LOG_LEVEL forced to LOG_LEVEL_NONE" +#if defined(CONFIG_USBD_CDC_ACM_LOG_LEVEL) && CONFIG_USBD_CDC_ACM_LOG_LEVEL != LOG_LEVEL_NONE +#define CHOSEN_CONSOLE DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart) +#define CHOSEN_SHELL DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_shell_uart), zephyr_cdc_acm_uart) +#if (CHOSEN_CONSOLE && defined(CONFIG_LOG_BACKEND_UART)) || \ + (CHOSEN_SHELL && defined(CONFIG_SHELL_LOG_BACKEND)) +#warning "USBD_CDC_ACM_LOG_LEVEL forced to LOG_LEVEL_NONE" #undef CONFIG_USBD_CDC_ACM_LOG_LEVEL #define CONFIG_USBD_CDC_ACM_LOG_LEVEL LOG_LEVEL_NONE #endif +#endif LOG_MODULE_REGISTER(usbd_cdc_acm, CONFIG_USBD_CDC_ACM_LOG_LEVEL); UDC_BUF_POOL_DEFINE(cdc_acm_ep_pool, From ef3847c3d865cc484bf13815546e191d852f4f42 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Fri, 27 Sep 2024 20:29:42 +0900 Subject: [PATCH 0332/4482] drivers: mipi_dsi: Add dummy driver for vnd,mipi-dsi Add dummy driver for "vnd,mipi-dsi" to use in build_all tests. Signed-off-by: TOKITA Hiroshi --- drivers/mipi_dsi/CMakeLists.txt | 1 + drivers/mipi_dsi/Kconfig | 1 + drivers/mipi_dsi/Kconfig.test | 6 ++++ drivers/mipi_dsi/dsi_test.c | 56 +++++++++++++++++++++++++++++ dts/bindings/test/vnd,mipi-dsi.yaml | 11 ++++++ 5 files changed, 75 insertions(+) create mode 100644 drivers/mipi_dsi/Kconfig.test create mode 100644 drivers/mipi_dsi/dsi_test.c create mode 100644 dts/bindings/test/vnd,mipi-dsi.yaml diff --git a/drivers/mipi_dsi/CMakeLists.txt b/drivers/mipi_dsi/CMakeLists.txt index 2fcae1d0bce21..35477023c6bb9 100644 --- a/drivers/mipi_dsi/CMakeLists.txt +++ b/drivers/mipi_dsi/CMakeLists.txt @@ -2,3 +2,4 @@ zephyr_sources_ifdef(CONFIG_MIPI_DSI mipi_dsi.c) zephyr_sources_ifdef(CONFIG_MIPI_DSI_MCUX dsi_mcux.c) zephyr_sources_ifdef(CONFIG_MIPI_DSI_MCUX_2L dsi_mcux_2l.c) zephyr_sources_ifdef(CONFIG_MIPI_DSI_STM32 dsi_stm32.c) +zephyr_sources_ifdef(CONFIG_MIPI_DSI_TEST dsi_test.c) diff --git a/drivers/mipi_dsi/Kconfig b/drivers/mipi_dsi/Kconfig index dd896de7c981e..d98dbe421f66b 100644 --- a/drivers/mipi_dsi/Kconfig +++ b/drivers/mipi_dsi/Kconfig @@ -23,5 +23,6 @@ config MIPI_DSI_INIT_PRIORITY source "drivers/mipi_dsi/Kconfig.mcux" source "drivers/mipi_dsi/Kconfig.stm32" +source "drivers/mipi_dsi/Kconfig.test" endif diff --git a/drivers/mipi_dsi/Kconfig.test b/drivers/mipi_dsi/Kconfig.test new file mode 100644 index 0000000000000..f9a3942b1faf3 --- /dev/null +++ b/drivers/mipi_dsi/Kconfig.test @@ -0,0 +1,6 @@ +# Copyright (c) 2024 TOKITA Hiroshi +# SPDX-License-Identifier: Apache-2.0 + +config MIPI_DSI_TEST + def_bool DT_HAS_VND_MIPI_DSI_ENABLED + depends on DT_HAS_VND_MIPI_DSI_ENABLED diff --git a/drivers/mipi_dsi/dsi_test.c b/drivers/mipi_dsi/dsi_test.c new file mode 100644 index 0000000000000..59e892e506e60 --- /dev/null +++ b/drivers/mipi_dsi/dsi_test.c @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * This is not a real mipi-dsi driver. It is used to instantiate struct + * devices for the "vnd,mipi-dsi" devicetree compatible used in test code. + */ + +#include + +#define DT_DRV_COMPAT vnd_mipi_dsi + +static int vnd_mipi_dsi_attach(const struct device *dev, uint8_t channel, + const struct mipi_dsi_device *mdev) +{ + ARG_UNUSED(dev); + ARG_UNUSED(channel); + ARG_UNUSED(mdev); + + return -ENOTSUP; +} + +static ssize_t vnd_mipi_dsi_transfer(const struct device *dev, uint8_t channel, + struct mipi_dsi_msg *msg) +{ + ARG_UNUSED(dev); + ARG_UNUSED(channel); + ARG_UNUSED(msg); + + return -1; +} + +static int vnd_mipi_dsi_detach(const struct device *dev, uint8_t channel, + const struct mipi_dsi_device *mdev) +{ + ARG_UNUSED(dev); + ARG_UNUSED(channel); + ARG_UNUSED(mdev); + + return -ENOTSUP; +} + +static struct mipi_dsi_driver_api vnd_mipi_dsi_api = { + .attach = vnd_mipi_dsi_attach, + .transfer = vnd_mipi_dsi_transfer, + .detach = vnd_mipi_dsi_detach, +}; + +#define VND_MIPI_DSI_INIT(n) \ + DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, NULL, POST_KERNEL, \ + CONFIG_MIPI_DSI_INIT_PRIORITY, &vnd_mipi_dsi_api); + +DT_INST_FOREACH_STATUS_OKAY(VND_MIPI_DSI_INIT) diff --git a/dts/bindings/test/vnd,mipi-dsi.yaml b/dts/bindings/test/vnd,mipi-dsi.yaml new file mode 100644 index 0000000000000..6e3027819d5a4 --- /dev/null +++ b/dts/bindings/test/vnd,mipi-dsi.yaml @@ -0,0 +1,11 @@ +# +# Copyright (c) 2024 TOKITA Hiroshi +# +# SPDX-License-Identifier: Apache-2.0 +# + +description: Test MIPI DSI host + +compatible: "vnd,mipi-dsi" + +include: [mipi-dsi-host.yaml] From 3f6bddc2bf8b0da68e620b940221105445507fda Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sun, 6 Oct 2024 07:01:59 +0900 Subject: [PATCH 0333/4482] drivers: mipi_dsi: Change MIPI_DSI priority to the same as DISPLAY These priorities can be resolved automatically with the sub-priority mechanism, so set them to the same value. Signed-off-by: TOKITA Hiroshi --- drivers/mipi_dsi/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mipi_dsi/Kconfig b/drivers/mipi_dsi/Kconfig index d98dbe421f66b..3f5928ff6c18f 100644 --- a/drivers/mipi_dsi/Kconfig +++ b/drivers/mipi_dsi/Kconfig @@ -17,7 +17,7 @@ source "subsys/logging/Kconfig.template.log_config" config MIPI_DSI_INIT_PRIORITY int "Initialization priority" - default 86 + default 85 help MIPI-DSI Host Controllers initialization priority. From 8529e93501900a476ce9d3095c3779c5b306bf7c Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Fri, 27 Sep 2024 20:29:58 +0900 Subject: [PATCH 0334/4482] tests: drivers: build_all: display: Add mipi-dsi devices to build test Add build tests for the following devices. - himax,hx8394 - frida,nt35510 - orisetech,otm8009a - raydium,rm67162 - raydium,rm68200 Signed-off-by: TOKITA Hiroshi --- tests/drivers/build_all/display/app.overlay | 67 +++++++++++++++++++++ tests/drivers/build_all/display/prj.conf | 1 + 2 files changed, 68 insertions(+) diff --git a/tests/drivers/build_all/display/app.overlay b/tests/drivers/build_all/display/app.overlay index d425bf103b976..e262a8726920d 100644 --- a/tests/drivers/build_all/display/app.overlay +++ b/tests/drivers/build_all/display/app.overlay @@ -137,6 +137,73 @@ }; }; + test_mipi_dsi { + compatible = "vnd,mipi-dsi"; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + test_hx8394: hx8394@0 { + status = "okay"; + compatible = "himax,hx8394"; + reg = <0x0>; + reset-gpios = <&test_gpio 0 0>; + data-lanes = <2>; + width = <720>; + height = <1280>; + pixel-format = <0>; + }; + + test_nt35510: nt35510@1 { + status = "okay"; + compatible = "frida,nt35510"; + reg = <0x1>; + height = <800>; + width = <480>; + reset-gpios = <&test_gpio 0 0>; + bl-gpios = <&test_gpio 0 0>; + data-lanes = <2>; + pixel-format = <0>; + rotation = <90>; + }; + + test_otm8009a: otm8009a@2 { + status = "okay"; + compatible = "orisetech,otm8009a"; + reg = <0x2>; + height = <800>; + width = <480>; + reset-gpios = <&test_gpio 0 0>; + bl-gpios = <&test_gpio 0 0>; + data-lanes = <2>; + pixel-format = <0>; + rotation = <90>; + }; + + test_rm67162: rm67162@3 { + status = "okay"; + compatible = "raydium,rm67162"; + reg = <0x3>; + reset-gpios = <&test_gpio 0 0>; + bl-gpios = <&test_gpio 0 0>; + te-gpios = <&test_gpio 0 0>; + data-lanes = <1>; + width = <400>; + height = <392>; + pixel-format = <0>; + }; + + test_rm68200: rm68200@4 { + status = "okay"; + compatible = "raydium,rm68200"; + reg = <0x4>; + reset-gpios = <&test_gpio 0 0>; + data-lanes = <2>; + width = <720>; + height = <1280>; + pixel-format = <0>; + }; + }; test_spi: spi@33334444 { #address-cells = <1>; diff --git a/tests/drivers/build_all/display/prj.conf b/tests/drivers/build_all/display/prj.conf index 8b2c0984e4376..b7328a4325ce7 100644 --- a/tests/drivers/build_all/display/prj.conf +++ b/tests/drivers/build_all/display/prj.conf @@ -2,3 +2,4 @@ CONFIG_TEST=y CONFIG_SPI=y CONFIG_GPIO=y CONFIG_DISPLAY=y +CONFIG_MIPI_DSI=y From 86da989a52504880aaa04e96013100bd4486135a Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 28 Sep 2024 15:35:14 +0900 Subject: [PATCH 0335/4482] tests: drivers: build_all: display: Add config for `solomon,ssd1327fb` Add configuration for "solomon,ssd1327fb" to enable build test. Signed-off-by: TOKITA Hiroshi --- tests/drivers/build_all/display/app.overlay | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/drivers/build_all/display/app.overlay b/tests/drivers/build_all/display/app.overlay index e262a8726920d..3c4ba1a5967ca 100644 --- a/tests/drivers/build_all/display/app.overlay +++ b/tests/drivers/build_all/display/app.overlay @@ -135,6 +135,21 @@ width = <240>; height = <240>; }; + + test_spi_ssd1327fb: ssd1327fb@7 { + compatible = "solomon,ssd1327fb"; + reg = <7>; + mipi-max-frequency = <100000000>; + + width = <240>; + height = <240>; + oscillator-freq = <0>; + display-offset = <0>; + start-line = <0>; + multiplex-ratio = <0>; + prechargep = <0>; + remap-value = <0>; + }; }; test_mipi_dsi { From 1da74ef705bcf1723a3271266622948251253c0a Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 30 Sep 2024 21:52:16 +0200 Subject: [PATCH 0336/4482] net: wifi: Fix DPP disabled build In case WPA supplicant disabled DPP, we need to compile out the corresponding DPP code in Wi-Fi shell too. Signed-off-by: Chaitanya Tata --- include/zephyr/net/wifi_mgmt.h | 7 +++++++ modules/hostap/src/supp_api.c | 2 ++ modules/hostap/src/supp_api.h | 2 ++ modules/hostap/src/supp_main.c | 2 ++ subsys/net/l2/wifi/wifi_mgmt.c | 3 +++ subsys/net/l2/wifi/wifi_shell.c | 6 ++++++ 6 files changed, 22 insertions(+) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 0f0054e4acb74..8260940e04d66 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -221,11 +221,13 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_RTS_THRESHOLD); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_CONFIG_PARAM); +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP /** Request a Wi-Fi DPP operation */ #define NET_REQUEST_WIFI_DPP \ (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_DPP) NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_DPP); +#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */ #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_WNM /** Request a Wi-Fi BTM query */ @@ -852,6 +854,7 @@ struct wifi_ap_config_params { uint32_t max_num_sta; }; +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP /** @brief Wi-Fi DPP configuration parameter */ /** Wi-Fi DPP QR-CODE in string max len for SHA512 */ #define WIFI_DPP_QRCODE_MAX_LEN 255 @@ -1027,6 +1030,7 @@ struct wifi_dpp_params { char resp[WIFI_DPP_QRCODE_MAX_LEN + 1]; }; }; +#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */ #define WIFI_WPS_PIN_MAX_LEN 8 @@ -1254,6 +1258,8 @@ struct wifi_mgmt_ops { * @return 0 if ok, < 0 if error */ int (*ap_config_params)(const struct device *dev, struct wifi_ap_config_params *params); + +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP /** Dispatch DPP operations by action enum, with or without arguments in string format * * @param dev Pointer to the device structure for the driver instance @@ -1262,6 +1268,7 @@ struct wifi_mgmt_ops { * @return 0 if ok, < 0 if error */ int (*dpp_dispatch)(const struct device *dev, struct wifi_dpp_params *params); +#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */ /** Flush PMKSA cache entries * * @param dev Pointer to the device structure for the driver instance. diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index d30476dcba92a..d9d7abae8a398 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -1768,6 +1768,7 @@ int supplicant_ap_sta_disconnect(const struct device *dev, } #endif /* CONFIG_AP */ +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP static const char *dpp_params_to_args_curve(int curve) { switch (curve) { @@ -2057,6 +2058,7 @@ int supplicant_dpp_dispatch(const struct device *dev, struct wifi_dpp_params *pa os_free(cmd); return 0; } +#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */ #ifdef CONFIG_WIFI_NM_HOSTAPD_AP int hapd_dpp_dispatch(const struct device *dev, struct wifi_dpp_params *params) diff --git a/modules/hostap/src/supp_api.h b/modules/hostap/src/supp_api.h index 433c5e0347e90..fb1bc2ead7133 100644 --- a/modules/hostap/src/supp_api.h +++ b/modules/hostap/src/supp_api.h @@ -278,6 +278,7 @@ int supplicant_ap_sta_disconnect(const struct device *dev, #endif /* CONFIG_AP */ +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP /** * @brief Dispatch DPP operations for STA * @@ -286,6 +287,7 @@ int supplicant_ap_sta_disconnect(const struct device *dev, * @return 0 for OK; -1 for ERROR */ int supplicant_dpp_dispatch(const struct device *dev, struct wifi_dpp_params *params); +#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */ #ifdef CONFIG_WIFI_NM_HOSTAPD_AP /** diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index 9b6d38eea20aa..6851df6b62c9b 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -81,7 +81,9 @@ static const struct wifi_mgmt_ops mgmt_ops = { .ap_disable = supplicant_ap_disable, .ap_sta_disconnect = supplicant_ap_sta_disconnect, #endif /* CONFIG_AP */ +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP .dpp_dispatch = supplicant_dpp_dispatch, +#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */ .pmksa_flush = supplicant_pmksa_flush, #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE .enterprise_creds = supplicant_add_enterprise_creds, diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 27e065cccced0..4ec8eb1a0d9cc 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -848,6 +848,7 @@ static int wifi_set_rts_threshold(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_RTS_THRESHOLD, wifi_set_rts_threshold); +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP static int wifi_dpp(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { @@ -864,6 +865,8 @@ static int wifi_dpp(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_DPP, wifi_dpp); +#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */ + static int wifi_pmksa_flush(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 4c098ff927d61..6c3e3e7e262f4 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -2157,6 +2157,7 @@ static int cmd_wifi_version(const struct shell *sh, size_t argc, char *argv[]) return 0; } +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP static int parse_dpp_args_auth_init(const struct shell *sh, size_t argc, char *argv[], struct wifi_dpp_params *params) { @@ -2694,6 +2695,7 @@ static int cmd_wifi_dpp_reconfig(const struct shell *sh, size_t argc, char *argv return 0; } +#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */ static int cmd_wifi_pmksa_flush(const struct shell *sh, size_t argc, char *argv[]) { struct net_if *iface = net_if_get_wifi_sta(); @@ -2771,6 +2773,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_twt_ops, SHELL_SUBCMD_SET_END ); +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP SHELL_STATIC_SUBCMD_SET_CREATE( wifi_cmd_dpp, SHELL_CMD_ARG(configurator_add, NULL, @@ -2847,6 +2850,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE( cmd_wifi_dpp_reconfig, 2, 0), SHELL_SUBCMD_SET_END ); +#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, SHELL_CMD_ARG(version, NULL, "Print Wi-Fi Driver and Firmware versions\n", @@ -2990,7 +2994,9 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, ".\n", cmd_wifi_set_rts_threshold, 1, 1), +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP SHELL_CMD(dpp, &wifi_cmd_dpp, "DPP actions\n", NULL), +#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */ SHELL_CMD_ARG(pmksa_flush, NULL, "Flush PMKSA cache entries.\n", cmd_wifi_pmksa_flush, 1, 0), From 2d7c995395853b1b8eb3f041413d2e38ea61206f Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 30 Sep 2024 23:38:47 +0200 Subject: [PATCH 0337/4482] modules: hostap: Fix double free of the event When an event is sent the receiver gets is asynchronously and hence is responsible for free the event, the sender should only free in case of error conditions i.e., unable to send. Else, this causes a tough to debug double-free. Signed-off-by: Chaitanya Tata --- modules/hostap/src/supp_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index 6851df6b62c9b..3b39357ee8fc9 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -438,6 +438,8 @@ static int del_interface(struct supplicant_context *ctx, struct net_if *iface) supplicant_generate_state_event(ifname, NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVED, 0); + return 0; + out: if (event) { os_free(event); From c44aa6b18e43323f25ea47a54d3a1c641b5deab0 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 30 Sep 2024 23:47:50 +0200 Subject: [PATCH 0338/4482] modules: hostap: Fix double free in case of error conditions In case of error conditions post successfully sending the message, the event is already freed but we attempt to free it again. Rejig the labels to easily reflect thier purpose. Signed-off-by: Chaitanya Tata --- modules/hostap/src/supp_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index 3b39357ee8fc9..bcd5e3d2324ad 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -376,7 +376,7 @@ static int del_interface(struct supplicant_context *ctx, struct net_if *iface) if (!wpa_s) { ret = -ENOENT; LOG_ERR("Failed to get wpa_s handle for %s", ifname); - goto out; + goto free; } supplicant_generate_state_event(ifname, NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVING, 0); @@ -384,7 +384,7 @@ static int del_interface(struct supplicant_context *ctx, struct net_if *iface) if (sizeof(event->interface_status.ifname) < strlen(ifname)) { wpa_printf(MSG_ERROR, "Interface name too long: %s (max: %d)", ifname, sizeof(event->interface_status.ifname)); - goto out; + goto free; } os_memcpy(event->interface_status.ifname, ifname, strlen(ifname)); @@ -402,7 +402,7 @@ static int del_interface(struct supplicant_context *ctx, struct net_if *iface) * with WPA supplicant so we cannot unregister NM etc. */ wpa_printf(MSG_ERROR, "Failed to send event: %d", ret); - goto out; + goto free; } while (retry++ < count && wpa_s->wpa_state != WPA_INTERFACE_DISABLED) { @@ -440,11 +440,11 @@ static int del_interface(struct supplicant_context *ctx, struct net_if *iface) return 0; -out: +free: if (event) { os_free(event); } - +out: return ret; } #endif From 56d7e9a4872c3e680c9d7e83b3972423bea7bfb5 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 1 Oct 2024 00:19:57 +0200 Subject: [PATCH 0339/4482] modules: hostap: Fix typo in NM unregistration The module name is not modified in remove. Signed-off-by: Chaitanya Tata --- modules/hostap/src/supp_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index bcd5e3d2324ad..58998c627c12b 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -425,7 +425,7 @@ static int del_interface(struct supplicant_context *ctx, struct net_if *iface) goto out; } - ret = wifi_nm_unregister_mgd_iface(wifi_nm_get_instance("wpa_supplicant"), iface); + ret = wifi_nm_unregister_mgd_iface(wifi_nm_get_instance("wifi_supplicant"), iface); if (ret) { LOG_ERR("Failed to unregister mgd iface %s with native stack (%d)", ifname, ret); From 2dec9313e49edaa4e0d822413a903631e6ccd1f9 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 30 Sep 2024 23:58:37 +0200 Subject: [PATCH 0340/4482] modules: hostap: Use net_mgmt context Using a separate workqueue causes issues without any special locking to synchronize with networking threads e.g., interface being removed while the workqueue is trying to synchronize with WPA supplicant. It's easier to use the net_mgmt thread which is in better sync with networking. Signed-off-by: Chaitanya Tata --- modules/hostap/src/supp_main.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index 58998c627c12b..db3ef2fe83bf7 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -477,9 +477,6 @@ static void submit_iface_work(struct supplicant_context *ctx, static void interface_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { - struct supplicant_context *ctx = CONTAINER_OF(cb, struct supplicant_context, - cb); - if ((mgmt_event & INTERFACE_EVENT_MASK) != mgmt_event) { return; } @@ -492,13 +489,13 @@ static void interface_handler(struct net_mgmt_event_callback *cb, if (mgmt_event == NET_EVENT_IF_ADMIN_UP) { LOG_INF("Network interface %d (%p) up", net_if_get_by_iface(iface), iface); - submit_iface_work(ctx, iface, add_interface); + add_interface(get_default_context(), iface); return; } if (mgmt_event == NET_EVENT_IF_ADMIN_DOWN) { LOG_INF("Network interface %d (%p) down", net_if_get_by_iface(iface), iface); - submit_iface_work(ctx, iface, del_interface); + del_interface(get_default_context(), iface); return; } } From a378440116dc644335cf2aed991e3610debecddb Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Wed, 2 Oct 2024 00:15:55 +0700 Subject: [PATCH 0341/4482] drivers: intc: stm32: correct inconsistent parameter names Correct several inconsistent parameter names in the following functions: - stm32_gpio_intc_select_line_trigger: rename `trigger` to `trg` to match the header file. - stm32_gpio_intc_set_irq_callback: rename the callback argument to `user` to match the `stm32_gpio_irq_cb_t` type. - stm32_exti_get_line_src_port: rename `pin` to `line` to align with the Doxygen comment and implementation. Signed-off-by: Pisit Sawangvonganan --- drivers/interrupt_controller/intc_exti_stm32.c | 10 +++++----- drivers/interrupt_controller/intc_gpio_stm32wb0.c | 6 +++--- .../drivers/interrupt_controller/gpio_intc_stm32.h | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/interrupt_controller/intc_exti_stm32.c b/drivers/interrupt_controller/intc_exti_stm32.c index 9ca75e582a80b..f83fbf9b4e1b6 100644 --- a/drivers/interrupt_controller/intc_exti_stm32.c +++ b/drivers/interrupt_controller/intc_exti_stm32.c @@ -286,11 +286,11 @@ void stm32_gpio_intc_disable_line(stm32_gpio_irq_line_t line) #endif } -void stm32_gpio_intc_select_line_trigger(stm32_gpio_irq_line_t line, uint32_t trigger) +void stm32_gpio_intc_select_line_trigger(stm32_gpio_irq_line_t line, uint32_t trg) { z_stm32_hsem_lock(CFG_HW_EXTI_SEMID, HSEM_LOCK_DEFAULT_RETRY); - switch (trigger) { + switch (trg) { case STM32_GPIO_IRQ_TRIG_NONE: LL_EXTI_DisableRisingTrig_0_31(line); LL_EXTI_DisableFallingTrig_0_31(line); @@ -314,13 +314,13 @@ void stm32_gpio_intc_select_line_trigger(stm32_gpio_irq_line_t line, uint32_t tr z_stm32_hsem_unlock(CFG_HW_EXTI_SEMID); } -int stm32_gpio_intc_set_irq_callback(stm32_gpio_irq_line_t line, stm32_gpio_irq_cb_t cb, void *arg) +int stm32_gpio_intc_set_irq_callback(stm32_gpio_irq_line_t line, stm32_gpio_irq_cb_t cb, void *user) { const struct device *const dev = DEVICE_DT_GET(EXTI_NODE); struct stm32_exti_data *data = dev->data; uint32_t line_num = ll_exti_line_to_linenum(line); - if ((data->cb[line_num].cb == cb) && (data->cb[line_num].data == arg)) { + if ((data->cb[line_num].cb == cb) && (data->cb[line_num].data == user)) { return 0; } @@ -330,7 +330,7 @@ int stm32_gpio_intc_set_irq_callback(stm32_gpio_irq_line_t line, stm32_gpio_irq_ } data->cb[line_num].cb = cb; - data->cb[line_num].data = arg; + data->cb[line_num].data = user; return 0; } diff --git a/drivers/interrupt_controller/intc_gpio_stm32wb0.c b/drivers/interrupt_controller/intc_gpio_stm32wb0.c index bcc7407d83434..3e1105acda0ba 100644 --- a/drivers/interrupt_controller/intc_gpio_stm32wb0.c +++ b/drivers/interrupt_controller/intc_gpio_stm32wb0.c @@ -268,11 +268,11 @@ void stm32_gpio_intc_select_line_trigger(stm32_gpio_irq_line_t line, uint32_t tr } int stm32_gpio_intc_set_irq_callback(stm32_gpio_irq_line_t line, - stm32_gpio_irq_cb_t cb, void *data) + stm32_gpio_irq_cb_t cb, void *user) { struct gpio_irq_cb_wrp *cb_wrp = irq_cb_wrp_for_line(line); - if ((cb_wrp->fn == cb) && (cb_wrp->data == data)) { + if ((cb_wrp->fn == cb) && (cb_wrp->data == user)) { return 0; } @@ -282,7 +282,7 @@ int stm32_gpio_intc_set_irq_callback(stm32_gpio_irq_line_t line, } cb_wrp->fn = cb; - cb_wrp->data = data; + cb_wrp->data = user; return 0; } diff --git a/include/zephyr/drivers/interrupt_controller/gpio_intc_stm32.h b/include/zephyr/drivers/interrupt_controller/gpio_intc_stm32.h index cd3c5ca810a52..9f6cd3089aa4c 100644 --- a/include/zephyr/drivers/interrupt_controller/gpio_intc_stm32.h +++ b/include/zephyr/drivers/interrupt_controller/gpio_intc_stm32.h @@ -84,11 +84,11 @@ typedef void (*stm32_gpio_irq_cb_t)(gpio_port_pins_t pin, void *user); * * @param line GPIO interrupt line * @param cb Interrupt callback function - * @param data Custom data for usage by the callback + * @param user Custom user data for usage by the callback * @returns 0 on success, -EBUSY if a callback is already set for @p line */ int stm32_gpio_intc_set_irq_callback(stm32_gpio_irq_line_t line, - stm32_gpio_irq_cb_t cb, void *data); + stm32_gpio_irq_cb_t cb, void *user); /** * @brief Removes the interrupt callback of specified EXTI line @@ -114,7 +114,7 @@ void stm32_exti_set_line_src_port(gpio_pin_t line, uint32_t port); * @param line EXTI line number (= pin number) * @returns GPIO port number (STM32_PORTA, STM32_PORTB, ...) */ -uint32_t stm32_exti_get_line_src_port(gpio_pin_t pin); +uint32_t stm32_exti_get_line_src_port(gpio_pin_t line); #endif /* CONFIG_EXTI_STM32 */ #endif /* ZEPHYR_DRIVERS_INTERRUPT_CONTROLLER_GPIO_INTC_STM32_H_ */ From 583f4956dcd59fde2358277cc6f212fe87b513eb Mon Sep 17 00:00:00 2001 From: Abram Early Date: Wed, 2 Oct 2024 16:03:01 -0600 Subject: [PATCH 0342/4482] modbus: reset wait semaphore before tx A response returned after a request times out would increment the semaphore and stay until the next request is made which will immediately return when k_sem_take is called even before a response is returned. This will once again have the same problem when the actual response arrives. So the wait semaphore just needs to be reset before transmitting. Signed-off-by: Abram Early --- subsys/modbus/modbus_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subsys/modbus/modbus_core.c b/subsys/modbus/modbus_core.c index b5c9df25398dc..3e6f87c053b9d 100644 --- a/subsys/modbus/modbus_core.c +++ b/subsys/modbus/modbus_core.c @@ -137,6 +137,8 @@ void modbus_tx_adu(struct modbus_context *ctx) int modbus_tx_wait_rx_adu(struct modbus_context *ctx) { + k_sem_reset(&ctx->client_wait_sem); + modbus_tx_adu(ctx); if (k_sem_take(&ctx->client_wait_sem, K_USEC(ctx->rxwait_to)) != 0) { From 07d6632201f22b9045ae02658ac45029f4e2de9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 4 Oct 2024 18:26:42 +0200 Subject: [PATCH 0343/4482] boards: Fix duplicate image in MAX32666FTHR board doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Front picture was listed twice, despite the back picture (max32666fthr_img2.jpg) actually being checked into the repo, so switch to that one. Signed-off-by: Benjamin Cabé --- boards/adi/max32666fthr/doc/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/adi/max32666fthr/doc/index.rst b/boards/adi/max32666fthr/doc/index.rst index f41781bd7fc62..8e234e5e9d341 100644 --- a/boards/adi/max32666fthr/doc/index.rst +++ b/boards/adi/max32666fthr/doc/index.rst @@ -21,7 +21,7 @@ The Zephyr port is running on the MAX32666 MCU. :align: center :alt: MAX32666FTHR Front -.. image:: img/max32666fthr_img1.jpg +.. image:: img/max32666fthr_img2.jpg :align: center :alt: MAX32666FTHR Back From 836370f67cd0064817deacb3c4231d9976bfd54e Mon Sep 17 00:00:00 2001 From: Daniel Schultz Date: Thu, 3 Oct 2024 13:49:35 +0200 Subject: [PATCH 0344/4482] MAINTAINERS: Add PHYTEC Platforms PHYTEC currently supports five boards in Zephyr, with another in development. Given the growing interest from our customers and our commitment to expanding support for PHYTEC platforms, I am volunteering to take over the maintenance of these boards. This will help streamline contributions and reduce the workload on the silicon vendor maintainers. Signed-off-by: Daniel Schultz --- MAINTAINERS.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 0eebdfa7406eb..b72fdb37a9ef1 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -3082,6 +3082,18 @@ Open AMP: tests: - sample.ipc.openamp +PHYTEC Platforms: + status: maintained + maintainers: + - dnltz + collaborators: + - jonas-rem + - pefech + files: + - boards/phytec/ + labels: + - "platform: PHYTEC" + POSIX API layer: status: maintained maintainers: @@ -4005,8 +4017,6 @@ TI K3 Platforms: - gramsay0 - dnltz files: - - boards/phytec/phyboard_lyra/ - - boards/phytec/phyboard_electra/ - boards/ti/*am62*/ - drivers/*/*ti_k3* - dts/bindings/*/ti,k3* From 1fdbd7e16a87ae99660e2a7202b1433580a4bb31 Mon Sep 17 00:00:00 2001 From: Ioannis Damigos Date: Thu, 3 Oct 2024 15:42:00 +0300 Subject: [PATCH 0345/4482] da1469x_dk_pro: Add user button Add user button. Signed-off-by: Ioannis Damigos --- boards/renesas/da1469x_dk_pro/da1469x_dk_pro.dts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/boards/renesas/da1469x_dk_pro/da1469x_dk_pro.dts b/boards/renesas/da1469x_dk_pro/da1469x_dk_pro.dts index 6e52b7610f3e1..a5c4aa39c4d36 100644 --- a/boards/renesas/da1469x_dk_pro/da1469x_dk_pro.dts +++ b/boards/renesas/da1469x_dk_pro/da1469x_dk_pro.dts @@ -6,6 +6,7 @@ /dts-v1/; #include #include "da1469x_dk_pro-pinctrl.dtsi" +#include / { model = "DA1469x series Development Kit Pro"; @@ -33,6 +34,15 @@ }; }; + gpio_keys { + compatible = "gpio-keys"; + user_button: button { + label = "User (K1)"; + gpios = <&gpio0 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + zephyr,code = ; + }; + }; + arduino_header: connector { compatible = "arduino-header-r3"; #gpio-cells = <2>; @@ -66,6 +76,7 @@ aliases { led0 = &red_led; watchdog0 = &wdog; + sw0 = &user_button; }; sysclk: system-clock { From 4511662fe5c5b8b0378818cc70701d51e6c994ff Mon Sep 17 00:00:00 2001 From: Andrej Butok Date: Thu, 3 Oct 2024 16:08:54 +0200 Subject: [PATCH 0346/4482] boards: nxp: Add Serial Recovery button alias Fixes MCUBoot Serial Recovery compilation error "Serial recovery/USB DFU button must be declared in device tree as 'mcuboot_button0'" Signed-off-by: Andrej Butok --- boards/nxp/frdm_k22f/frdm_k22f.dts | 1 + boards/nxp/frdm_k64f/frdm_k64f.dts | 1 + boards/nxp/frdm_k82f/frdm_k82f.dts | 1 + boards/nxp/frdm_ke17z/frdm_ke17z.dts | 1 + boards/nxp/frdm_ke17z512/frdm_ke17z512.dts | 1 + boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi | 1 + boards/nxp/lpcxpresso55s06/lpcxpresso55s06_common.dtsi | 1 + boards/nxp/lpcxpresso55s16/lpcxpresso55s16_common.dtsi | 1 + boards/nxp/lpcxpresso55s28/lpcxpresso55s28.dts | 1 + boards/nxp/lpcxpresso55s36/lpcxpresso55s36.dts | 1 + boards/nxp/lpcxpresso55s69/lpcxpresso55s69_lpc55s69_cpu0.dts | 1 + boards/nxp/mimxrt1010_evk/mimxrt1010_evk.dts | 1 + boards/nxp/mimxrt1015_evk/mimxrt1015_evk.dts | 1 + boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts | 1 + boards/nxp/mimxrt1024_evk/mimxrt1024_evk.dts | 1 + boards/nxp/mimxrt1040_evk/mimxrt1040_evk.dts | 1 + boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dts | 1 + boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dts | 1 + boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts | 1 + boards/nxp/mimxrt1160_evk/mimxrt1160_evk.dtsi | 1 + boards/nxp/mimxrt1170_evk/mimxrt1170_evk.dtsi | 1 + boards/nxp/mimxrt595_evk/mimxrt595_evk_mimxrt595s_cm33.dts | 1 + boards/nxp/mimxrt685_evk/mimxrt685_evk_mimxrt685s_cm33.dts | 1 + boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi | 1 + boards/nxp/twr_ke18f/twr_ke18f.dts | 1 + boards/nxp/twr_kv58f220m/twr_kv58f220m.dts | 1 + boards/nxp/vmu_rt1170/vmu_rt1170_mimxrt1176_cm7.dts | 1 + 27 files changed, 27 insertions(+) diff --git a/boards/nxp/frdm_k22f/frdm_k22f.dts b/boards/nxp/frdm_k22f/frdm_k22f.dts index fd36a8285feb6..3a927b3de6d2d 100644 --- a/boards/nxp/frdm_k22f/frdm_k22f.dts +++ b/boards/nxp/frdm_k22f/frdm_k22f.dts @@ -28,6 +28,7 @@ red-pwm-led = &red_pwm_led; magn0 = &fxos8700; accel0 = &fxos8700; + mcuboot-button0 = &user_button_3; }; chosen { diff --git a/boards/nxp/frdm_k64f/frdm_k64f.dts b/boards/nxp/frdm_k64f/frdm_k64f.dts index 7fbc1943ec902..24800e36fe908 100644 --- a/boards/nxp/frdm_k64f/frdm_k64f.dts +++ b/boards/nxp/frdm_k64f/frdm_k64f.dts @@ -18,6 +18,7 @@ sw1 = &user_button_2; magn0 = &fxos8700; accel0 = &fxos8700; + mcuboot-button0 = &user_button_3; }; chosen { diff --git a/boards/nxp/frdm_k82f/frdm_k82f.dts b/boards/nxp/frdm_k82f/frdm_k82f.dts index d2f4ed514579f..a221b53e24d6b 100644 --- a/boards/nxp/frdm_k82f/frdm_k82f.dts +++ b/boards/nxp/frdm_k82f/frdm_k82f.dts @@ -27,6 +27,7 @@ sw1 = &user_button_1; magn0 = &fxos8700; accel0 = &fxos8700; + mcuboot-button0 = &user_button_0; }; chosen { diff --git a/boards/nxp/frdm_ke17z/frdm_ke17z.dts b/boards/nxp/frdm_ke17z/frdm_ke17z.dts index 79b42f30f0041..9b5e3aaa4b8ad 100644 --- a/boards/nxp/frdm_ke17z/frdm_ke17z.dts +++ b/boards/nxp/frdm_ke17z/frdm_ke17z.dts @@ -25,6 +25,7 @@ pwm-led0 = &red_pwm_led; pwm-led1 = &green_pwm_led; pwm-led2 = &blue_pwm_led; + mcuboot-button0 = &user_button_0; }; chosen { diff --git a/boards/nxp/frdm_ke17z512/frdm_ke17z512.dts b/boards/nxp/frdm_ke17z512/frdm_ke17z512.dts index 13217f0c8f0ec..05c050bfdf1fc 100644 --- a/boards/nxp/frdm_ke17z512/frdm_ke17z512.dts +++ b/boards/nxp/frdm_ke17z512/frdm_ke17z512.dts @@ -34,6 +34,7 @@ pwm-led0 = &red_pwm_led; pwm-led1 = &green_pwm_led; pwm-led2 = &blue_pwm_led; + mcuboot-button0 = &user_button_2; }; leds { diff --git a/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi b/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi index 2f2d27a4f11e0..3745e29ede7d2 100644 --- a/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi +++ b/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi @@ -16,6 +16,7 @@ sw0 = &user_button_2; sw1 = &user_button_3; sdhc0 = &usdhc0; + mcuboot-button0 = &user_button_2; }; leds { diff --git a/boards/nxp/lpcxpresso55s06/lpcxpresso55s06_common.dtsi b/boards/nxp/lpcxpresso55s06/lpcxpresso55s06_common.dtsi index dd3529fa641d3..20f427b3b93d0 100644 --- a/boards/nxp/lpcxpresso55s06/lpcxpresso55s06_common.dtsi +++ b/boards/nxp/lpcxpresso55s06/lpcxpresso55s06_common.dtsi @@ -29,6 +29,7 @@ sw1 = &btn_usr; sw2 = &btn_isp; usart-0 = &flexcomm0; + mcuboot-button0 = &btn_wk; }; leds { diff --git a/boards/nxp/lpcxpresso55s16/lpcxpresso55s16_common.dtsi b/boards/nxp/lpcxpresso55s16/lpcxpresso55s16_common.dtsi index 54ef847881430..55e2e661ac491 100644 --- a/boards/nxp/lpcxpresso55s16/lpcxpresso55s16_common.dtsi +++ b/boards/nxp/lpcxpresso55s16/lpcxpresso55s16_common.dtsi @@ -31,6 +31,7 @@ usart-0 = &flexcomm0; magn0 = &fxos8700; accel0 = &fxos8700; + mcuboot-button0 = &btn_wk; }; leds { diff --git a/boards/nxp/lpcxpresso55s28/lpcxpresso55s28.dts b/boards/nxp/lpcxpresso55s28/lpcxpresso55s28.dts index 9fe9ed0c3d5e3..a2407a2004ac8 100644 --- a/boards/nxp/lpcxpresso55s28/lpcxpresso55s28.dts +++ b/boards/nxp/lpcxpresso55s28/lpcxpresso55s28.dts @@ -21,6 +21,7 @@ sw2 = &user_button_3; watchdog0 = &wwdt0; accel0 = &mma8652fc; + mcuboot-button0 = &user_button_1; }; chosen { diff --git a/boards/nxp/lpcxpresso55s36/lpcxpresso55s36.dts b/boards/nxp/lpcxpresso55s36/lpcxpresso55s36.dts index d81a21d48fff2..acec993930727 100644 --- a/boards/nxp/lpcxpresso55s36/lpcxpresso55s36.dts +++ b/boards/nxp/lpcxpresso55s36/lpcxpresso55s36.dts @@ -33,6 +33,7 @@ sw1 = &btn_usr; usart-0 = &flexcomm0; pwm-0 = &flexpwm1_pwm0; + mcuboot-button0 = &btn_wk; }; leds { diff --git a/boards/nxp/lpcxpresso55s69/lpcxpresso55s69_lpc55s69_cpu0.dts b/boards/nxp/lpcxpresso55s69/lpcxpresso55s69_lpc55s69_cpu0.dts index bf583af53427f..82f0e9e330d3b 100644 --- a/boards/nxp/lpcxpresso55s69/lpcxpresso55s69_lpc55s69_cpu0.dts +++ b/boards/nxp/lpcxpresso55s69/lpcxpresso55s69_lpc55s69_cpu0.dts @@ -31,6 +31,7 @@ sdhc0 = &sdhc0; accel0 = &mma8652fc; sdhc0 = &sdif; + mcuboot-button0 = &user_button_1; }; chosen { diff --git a/boards/nxp/mimxrt1010_evk/mimxrt1010_evk.dts b/boards/nxp/mimxrt1010_evk/mimxrt1010_evk.dts index 0b879fb44a270..66a7819670f03 100644 --- a/boards/nxp/mimxrt1010_evk/mimxrt1010_evk.dts +++ b/boards/nxp/mimxrt1010_evk/mimxrt1010_evk.dts @@ -18,6 +18,7 @@ aliases { led0 = &green_led; sw0 = &user_button; + mcuboot-button0 = &user_button; }; chosen { diff --git a/boards/nxp/mimxrt1015_evk/mimxrt1015_evk.dts b/boards/nxp/mimxrt1015_evk/mimxrt1015_evk.dts index 10959b0edaebd..319d1ddb3202c 100644 --- a/boards/nxp/mimxrt1015_evk/mimxrt1015_evk.dts +++ b/boards/nxp/mimxrt1015_evk/mimxrt1015_evk.dts @@ -17,6 +17,7 @@ aliases { led0 = &green_led; sw0 = &user_button; + mcuboot-button0 = &user_button; }; chosen { diff --git a/boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts b/boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts index 34997b73f1f06..fca8e6447a79f 100644 --- a/boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts +++ b/boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts @@ -18,6 +18,7 @@ led0 = &green_led; sw0 = &user_button; sdhc0 = &usdhc1; + mcuboot-button0 = &user_button; }; chosen { diff --git a/boards/nxp/mimxrt1024_evk/mimxrt1024_evk.dts b/boards/nxp/mimxrt1024_evk/mimxrt1024_evk.dts index 4a1811afa412e..3cb80ddfd78cd 100644 --- a/boards/nxp/mimxrt1024_evk/mimxrt1024_evk.dts +++ b/boards/nxp/mimxrt1024_evk/mimxrt1024_evk.dts @@ -21,6 +21,7 @@ magn0 = &fxos8700; accel0 = &fxos8700; sdhc0 = &usdhc1; + mcuboot-button0 = &user_button; }; chosen { diff --git a/boards/nxp/mimxrt1040_evk/mimxrt1040_evk.dts b/boards/nxp/mimxrt1040_evk/mimxrt1040_evk.dts index 37467121ca37a..d5a31991ab124 100644 --- a/boards/nxp/mimxrt1040_evk/mimxrt1040_evk.dts +++ b/boards/nxp/mimxrt1040_evk/mimxrt1040_evk.dts @@ -19,6 +19,7 @@ sw0 = &user_button; pwm-0 = &flexpwm1_pwm3; accel0 = &fxls8974; + mcuboot-button0 = &user_button; }; chosen { diff --git a/boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dts b/boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dts index 7edf96e951798..846782af5d975 100644 --- a/boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dts +++ b/boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dts @@ -21,6 +21,7 @@ magn0 = &fxos8700; accel0 = &fxos8700; sdhc0 = &usdhc1; + mcuboot-button0 = &user_button; }; chosen { diff --git a/boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dts b/boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dts index 4f0be3d23bd5e..c6879a2417033 100644 --- a/boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dts +++ b/boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dts @@ -20,6 +20,7 @@ sw0 = &user_button; watchdog0 = &wdog0; sdhc0 = &usdhc1; + mcuboot-button0 = &user_button; }; chosen { diff --git a/boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts b/boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts index f3d060d72834f..31f9c842f1e68 100644 --- a/boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts +++ b/boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts @@ -20,6 +20,7 @@ sw0 = &user_button; watchdog0 = &wdog0; sdhc0 = &usdhc1; + mcuboot-button0 = &user_button; }; chosen { diff --git a/boards/nxp/mimxrt1160_evk/mimxrt1160_evk.dtsi b/boards/nxp/mimxrt1160_evk/mimxrt1160_evk.dtsi index 3d74d093105f7..8f6c8b24787b9 100644 --- a/boards/nxp/mimxrt1160_evk/mimxrt1160_evk.dtsi +++ b/boards/nxp/mimxrt1160_evk/mimxrt1160_evk.dtsi @@ -15,6 +15,7 @@ magn0 = &fxos8700; accel0 = &fxos8700; sdhc0 = &usdhc1; + mcuboot-button0 = &user_button; }; leds { diff --git a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk.dtsi b/boards/nxp/mimxrt1170_evk/mimxrt1170_evk.dtsi index c479300c8a9d0..bcc68761fb615 100644 --- a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk.dtsi +++ b/boards/nxp/mimxrt1170_evk/mimxrt1170_evk.dtsi @@ -17,6 +17,7 @@ accel0 = &fxos8700; sdhc0 = &usdhc1; pwm-led0 = &green_pwm_led; + mcuboot-button0 = &user_button; }; leds { diff --git a/boards/nxp/mimxrt595_evk/mimxrt595_evk_mimxrt595s_cm33.dts b/boards/nxp/mimxrt595_evk/mimxrt595_evk_mimxrt595s_cm33.dts index 2bccfcbed57f1..77c778e763481 100644 --- a/boards/nxp/mimxrt595_evk/mimxrt595_evk_mimxrt595s_cm33.dts +++ b/boards/nxp/mimxrt595_evk/mimxrt595_evk_mimxrt595s_cm33.dts @@ -29,6 +29,7 @@ sdhc0 = &usdhc0; pwm-0 = &sc_timer; dmic-dev = &dmic0; + mcuboot-button0 = &user_button_1; }; chosen { diff --git a/boards/nxp/mimxrt685_evk/mimxrt685_evk_mimxrt685s_cm33.dts b/boards/nxp/mimxrt685_evk/mimxrt685_evk_mimxrt685s_cm33.dts index 3228147ec3143..d211e26d3375a 100644 --- a/boards/nxp/mimxrt685_evk/mimxrt685_evk_mimxrt685s_cm33.dts +++ b/boards/nxp/mimxrt685_evk/mimxrt685_evk_mimxrt685s_cm33.dts @@ -34,6 +34,7 @@ accel0 = &fxos8700; sdhc0 = &usdhc0; dmic-dev = &dmic0; + mcuboot-button0 = &user_button_1; }; chosen { diff --git a/boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi b/boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi index 7e6689bba9285..8ec27da032fc1 100644 --- a/boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi +++ b/boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi @@ -19,6 +19,7 @@ i2c-0 = &flexcomm2; watchdog0 = &wwdt; dmic-dev = &dmic0; + mcuboot-button0 = &sw_4; }; chosen { diff --git a/boards/nxp/twr_ke18f/twr_ke18f.dts b/boards/nxp/twr_ke18f/twr_ke18f.dts index a3cfd3d54dca1..da98628956c6c 100644 --- a/boards/nxp/twr_ke18f/twr_ke18f.dts +++ b/boards/nxp/twr_ke18f/twr_ke18f.dts @@ -35,6 +35,7 @@ sw1 = &user_button_2; magn0 = &fxos8700; accel0 = &fxos8700; + mcuboot-button0 = &user_button_3; }; chosen { diff --git a/boards/nxp/twr_kv58f220m/twr_kv58f220m.dts b/boards/nxp/twr_kv58f220m/twr_kv58f220m.dts index f42607c334ff2..4a920fb39b9fc 100644 --- a/boards/nxp/twr_kv58f220m/twr_kv58f220m.dts +++ b/boards/nxp/twr_kv58f220m/twr_kv58f220m.dts @@ -25,6 +25,7 @@ sw3 = &user_button_3; magn0 = &fxos8700; accel0 = &fxos8700; + mcuboot-button0 = &user_button_0; }; chosen { diff --git a/boards/nxp/vmu_rt1170/vmu_rt1170_mimxrt1176_cm7.dts b/boards/nxp/vmu_rt1170/vmu_rt1170_mimxrt1176_cm7.dts index b6011a3809839..53d7818b0b75a 100644 --- a/boards/nxp/vmu_rt1170/vmu_rt1170_mimxrt1176_cm7.dts +++ b/boards/nxp/vmu_rt1170/vmu_rt1170_mimxrt1176_cm7.dts @@ -22,6 +22,7 @@ sdhc0 = &usdhc1; sw0 = &arming_button; pwm-led0 = &buzzer0; + mcuboot-button0 = &arming_button; }; chosen { From 621a6000d578aa7d52c8d9e7e4403d2e851c15d0 Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Wed, 2 Oct 2024 13:52:33 +0200 Subject: [PATCH 0347/4482] drivers: dp: swdp_bitbang: hardcode nRF53 SYSCLK Since CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC is tied to the slow RTC clock for the nRF53, use the default SYSCLK of 64MHz instead. Signed-off-by: Maximilian Deubel --- drivers/dp/swdp_ll_pin.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/dp/swdp_ll_pin.h b/drivers/dp/swdp_ll_pin.h index 3044931a228a8..48b4ea14cb3e1 100644 --- a/drivers/dp/swdp_ll_pin.h +++ b/drivers/dp/swdp_ll_pin.h @@ -6,8 +6,9 @@ #include #include +#include -#if defined(CONFIG_SOC_SERIES_NRF52X) +#if defined(CONFIG_SOC_SERIES_NRF52X) || defined(CONFIG_SOC_SERIES_NRF53X) #define CPU_CLOCK 64000000U #else #define CPU_CLOCK CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC From fd686a25b3aa2d2671d628fca1717ae43fb49b55 Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Wed, 2 Oct 2024 13:53:31 +0200 Subject: [PATCH 0348/4482] drivers: dp: swdp_bitbang: Update SWD clock calculation This patch updates the SWD clock calculation to the latest behavior of DAPLink. Signed-off-by: Maximilian Deubel --- drivers/dp/swdp_bitbang.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/dp/swdp_bitbang.c b/drivers/dp/swdp_bitbang.c index ba46c629604aa..3e0b6a2ea0e34 100644 --- a/drivers/dp/swdp_bitbang.c +++ b/drivers/dp/swdp_bitbang.c @@ -26,8 +26,8 @@ #include LOG_MODULE_REGISTER(swdp, CONFIG_DP_DRIVER_LOG_LEVEL); -#define CLOCK_DELAY(swclk_freq, port_write_cycles) \ - ((CPU_CLOCK / 2 / swclk_freq) - port_write_cycles) +#define MAX_SWJ_CLOCK(delay_cycles, port_write_cycles) \ + ((CPU_CLOCK / 2U) / (port_write_cycles + delay_cycles)) /* * Default SWCLK frequency in Hz. @@ -35,6 +35,7 @@ LOG_MODULE_REGISTER(swdp, CONFIG_DP_DRIVER_LOG_LEVEL); */ #define SWDP_DEFAULT_SWCLK_FREQUENCY 1000000U +#define DELAY_FAST_CYCLES 2U #define DELAY_SLOW_CYCLES 3U struct sw_config { @@ -528,14 +529,19 @@ static int sw_set_clock(const struct device *dev, const uint32_t clock) struct sw_cfg_data *sw_data = dev->data; uint32_t delay; - sw_data->fast_clock = false; - delay = ((CPU_CLOCK / 2U) + (clock - 1U)) / clock; - - if (delay > config->port_write_cycles) { - delay -= config->port_write_cycles; - delay = (delay + (DELAY_SLOW_CYCLES - 1U)) / DELAY_SLOW_CYCLES; - } else { + if (clock >= MAX_SWJ_CLOCK(DELAY_FAST_CYCLES, config->port_write_cycles)) { + sw_data->fast_clock = true; delay = 1U; + } else { + sw_data->fast_clock = false; + + delay = ((CPU_CLOCK / 2U) + (clock - 1U)) / clock; + if (delay > config->port_write_cycles) { + delay -= config->port_write_cycles; + delay = (delay + (DELAY_SLOW_CYCLES - 1U)) / DELAY_SLOW_CYCLES; + } else { + delay = 1U; + } } sw_data->clock_delay = delay; @@ -666,8 +672,7 @@ static int sw_gpio_init(const struct device *dev) sw_data->turnaround = 1U; sw_data->data_phase = false; sw_data->fast_clock = false; - sw_data->clock_delay = CLOCK_DELAY(SWDP_DEFAULT_SWCLK_FREQUENCY, - config->port_write_cycles); + sw_set_clock(dev, SWDP_DEFAULT_SWCLK_FREQUENCY); return 0; } From 736344b31093beb158b65839ce21f09573e20604 Mon Sep 17 00:00:00 2001 From: Francois Gervais Date: Sat, 28 Sep 2024 08:43:57 -0400 Subject: [PATCH 0349/4482] tests: coap_client: optimize/reduce sleep time The goal of this commit is to reduce the overall test time by optimizing the time spent sleeping. However while doing so, a few glitches became apparent and those have been fixed as well. 1. The way the ZSOCK_POLLIN event is managed has been modified In most tests, the event would stick for the whole test and this would sometimes results in the client receiving more data than intended which in turn would results in various unexpected warnings and errors. The management of the ZSOCK_POLLIN event has now been mostly moved to the send/receive overrides which better represent how things would happen outside of the test scenario. For example, when sending data, if this send would normally result in receiving some response, the send function sets the ZSOCK_POLLIN event. Then when receiving, we clear the event as the data has been received. There are a few exceptions to this for cases where we need to simulate some specific abnormal behavior. 2. The `messages_needing_response` queue now includes a valid bit The test manages a queue of messages id to be able to respond to the correct id in the receive hooks. It was built in a way that the id 0 would be treated as invalid although it is a valid id. In practice, it would not be an issue in most cases however, it would result in an unexpected behavior if the `test_multiple_requests` test would be run first. To fix this issue in the simplest way, the queue has been changed to uint32_t which gives us 16 extra bits for the management of the queue, 1 of which is used to tell if the entry is valid or not. Signed-off-by: Francois Gervais --- tests/net/lib/coap_client/src/main.c | 311 +++++++++++++------------- tests/net/lib/coap_client/src/stubs.c | 9 +- 2 files changed, 156 insertions(+), 164 deletions(-) diff --git a/tests/net/lib/coap_client/src/main.c b/tests/net/lib/coap_client/src/main.c index b487bdf7d5a40..25c2c58f2fd67 100644 --- a/tests/net/lib/coap_client/src/main.c +++ b/tests/net/lib/coap_client/src/main.c @@ -16,87 +16,123 @@ LOG_MODULE_REGISTER(coap_client_test); DEFINE_FFF_GLOBALS; #define FFF_FAKES_LIST(FAKE) +#define LONG_ACK_TIMEOUT_MS 200 +#define MORE_THAN_EXCHANGE_LIFETIME_MS 4 * CONFIG_COAP_INIT_ACK_TIMEOUT_MS +#define MORE_THAN_LONG_EXCHANGE_LIFETIME_MS 4 * LONG_ACK_TIMEOUT_MS +#define MORE_THAN_ACK_TIMEOUT_MS \ + (CONFIG_COAP_INIT_ACK_TIMEOUT_MS + CONFIG_COAP_INIT_ACK_TIMEOUT_MS / 2) + +#define VALID_MESSAGE_ID BIT(31) + static int16_t last_response_code; static const char *test_path = "test"; -static uint16_t messages_needing_response[2]; +static uint32_t messages_needing_response[2]; static struct coap_client client; static char *short_payload = "testing"; static char *long_payload = LOREM_IPSUM_SHORT; +static uint16_t get_next_pending_message_id(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(messages_needing_response); i++) { + if (messages_needing_response[i] & VALID_MESSAGE_ID) { + messages_needing_response[i] &= ~VALID_MESSAGE_ID; + return messages_needing_response[i]; + } + } + + return UINT16_MAX; +} + +static void set_next_pending_message_id(uint16_t id) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(messages_needing_response); i++) { + if (!(messages_needing_response[i] & VALID_MESSAGE_ID)) { + messages_needing_response[i] = id; + messages_needing_response[i] |= VALID_MESSAGE_ID; + return; + } + } +} + static ssize_t z_impl_zsock_recvfrom_custom_fake(int sock, void *buf, size_t max_len, int flags, - struct sockaddr *src_addr, socklen_t *addrlen) + struct sockaddr *src_addr, socklen_t *addrlen) { uint16_t last_message_id = 0; LOG_INF("Recvfrom"); - uint8_t ack_data[] = { - 0x68, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; + uint8_t ack_data[] = {0x68, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - if (messages_needing_response[0] != 0) { - last_message_id = messages_needing_response[0]; - messages_needing_response[0] = 0; - } else { - last_message_id = messages_needing_response[1]; - messages_needing_response[1] = 0; - } + last_message_id = get_next_pending_message_id(); - ack_data[2] = (uint8_t) (last_message_id >> 8); - ack_data[3] = (uint8_t) last_message_id; + ack_data[2] = (uint8_t)(last_message_id >> 8); + ack_data[3] = (uint8_t)last_message_id; memcpy(buf, ack_data, sizeof(ack_data)); + clear_socket_events(); + return sizeof(ack_data); } -static ssize_t z_impl_zsock_sendto_custom_fake(int sock, void *buf, size_t len, - int flags, const struct sockaddr *dest_addr, - socklen_t addrlen) +static ssize_t z_impl_zsock_sendto_custom_fake(int sock, void *buf, size_t len, int flags, + const struct sockaddr *dest_addr, socklen_t addrlen) { uint16_t last_message_id = 0; + uint8_t type; + + last_message_id |= ((uint8_t *)buf)[2] << 8; + last_message_id |= ((uint8_t *)buf)[3]; - last_message_id |= ((uint8_t *) buf)[2] << 8; - last_message_id |= ((uint8_t *) buf)[3]; + type = (((uint8_t *)buf)[0] & 0x30) >> 4; - if (messages_needing_response[0] == 0) { - messages_needing_response[0] = last_message_id; - } else { - messages_needing_response[1] = last_message_id; + set_next_pending_message_id(last_message_id); + LOG_INF("Latest message ID: %d", last_message_id); + + if (type == 0) { + set_socket_events(ZSOCK_POLLIN); } - last_response_code = ((uint8_t *) buf)[1]; + return 1; +} +static ssize_t z_impl_zsock_sendto_custom_fake_no_reply(int sock, void *buf, size_t len, int flags, + const struct sockaddr *dest_addr, + socklen_t addrlen) +{ + uint16_t last_message_id = 0; + + last_message_id |= ((uint8_t *)buf)[2] << 8; + last_message_id |= ((uint8_t *)buf)[3]; + + set_next_pending_message_id(last_message_id); LOG_INF("Latest message ID: %d", last_message_id); return 1; } -static ssize_t z_impl_zsock_sendto_custom_fake_echo(int sock, void *buf, size_t len, - int flags, const struct sockaddr *dest_addr, - socklen_t addrlen) +static ssize_t z_impl_zsock_sendto_custom_fake_echo(int sock, void *buf, size_t len, int flags, + const struct sockaddr *dest_addr, + socklen_t addrlen) { uint16_t last_message_id = 0; struct coap_packet response = {0}; struct coap_option option = {0}; - last_message_id |= ((uint8_t *) buf)[2] << 8; - last_message_id |= ((uint8_t *) buf)[3]; - - if (messages_needing_response[0] == 0) { - messages_needing_response[0] = last_message_id; - } else { - messages_needing_response[1] = last_message_id; - } - - last_response_code = ((uint8_t *) buf)[1]; + last_message_id |= ((uint8_t *)buf)[2] << 8; + last_message_id |= ((uint8_t *)buf)[3]; + set_next_pending_message_id(last_message_id); LOG_INF("Latest message ID: %d", last_message_id); int ret = coap_packet_parse(&response, buf, len, NULL, 0); - if (ret < 0) { LOG_ERR("Invalid data received"); } @@ -108,32 +144,27 @@ static ssize_t z_impl_zsock_sendto_custom_fake_echo(int sock, void *buf, size_t z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake; + set_socket_events(ZSOCK_POLLIN); + return 1; } static ssize_t z_impl_zsock_sendto_custom_fake_echo_next_req(int sock, void *buf, size_t len, - int flags, const struct sockaddr *dest_addr, - socklen_t addrlen) + int flags, + const struct sockaddr *dest_addr, + socklen_t addrlen) { uint16_t last_message_id = 0; struct coap_packet response = {0}; struct coap_option option = {0}; - last_message_id |= ((uint8_t *) buf)[2] << 8; - last_message_id |= ((uint8_t *) buf)[3]; - - if (messages_needing_response[0] == 0) { - messages_needing_response[0] = last_message_id; - } else { - messages_needing_response[1] = last_message_id; - } - - last_response_code = ((uint8_t *) buf)[1]; + last_message_id |= ((uint8_t *)buf)[2] << 8; + last_message_id |= ((uint8_t *)buf)[3]; + set_next_pending_message_id(last_message_id); LOG_INF("Latest message ID: %d", last_message_id); int ret = coap_packet_parse(&response, buf, len, NULL, 0); - if (ret < 0) { LOG_ERR("Invalid data received"); } @@ -153,6 +184,8 @@ static ssize_t z_impl_zsock_sendto_custom_fake_echo_next_req(int sock, void *buf z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake; + set_socket_events(ZSOCK_POLLIN); + return 1; } @@ -162,50 +195,17 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake_response(int sock, void *buf, s { uint16_t last_message_id = 0; - static uint8_t ack_data[] = { - 0x48, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; + static uint8_t ack_data[] = {0x48, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - if (messages_needing_response[0] != 0) { - last_message_id = messages_needing_response[0]; - messages_needing_response[0] = 0; - } else { - last_message_id = messages_needing_response[1]; - messages_needing_response[1] = 0; - } + last_message_id = get_next_pending_message_id(); - ack_data[2] = (uint8_t) (last_message_id >> 8); - ack_data[3] = (uint8_t) last_message_id; + ack_data[2] = (uint8_t)(last_message_id >> 8); + ack_data[3] = (uint8_t)last_message_id; memcpy(buf, ack_data, sizeof(ack_data)); - return sizeof(ack_data); -} - -static ssize_t z_impl_zsock_recvfrom_custom_fake_delayed_response(int sock, void *buf, - size_t max_len, int flags, - struct sockaddr *src_addr, - socklen_t *addrlen) -{ - uint16_t last_message_id = 0; - - static uint8_t ack_data[] = { - 0x68, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; - - if (messages_needing_response[0] != 0) { - last_message_id = messages_needing_response[0]; - messages_needing_response[0] = 0; - } else { - last_message_id = messages_needing_response[1]; - messages_needing_response[1] = 0; - } - - ack_data[2] = (uint8_t) (last_message_id >> 8); - ack_data[3] = (uint8_t) last_message_id; - - memcpy(buf, ack_data, sizeof(ack_data)); - k_sleep(K_MSEC(10)); + clear_socket_events(); return sizeof(ack_data); } @@ -216,20 +216,13 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake_empty_ack(int sock, void *buf, { uint16_t last_message_id = 0; - static uint8_t ack_data[] = { - 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; + static uint8_t ack_data[] = {0x68, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - if (messages_needing_response[0] != 0) { - last_message_id = messages_needing_response[0]; - messages_needing_response[0] = 0; - } else { - last_message_id = messages_needing_response[1]; - messages_needing_response[1] = 0; - } + last_message_id = get_next_pending_message_id(); - ack_data[2] = (uint8_t) (last_message_id >> 8); - ack_data[3] = (uint8_t) last_message_id; + ack_data[2] = (uint8_t)(last_message_id >> 8); + ack_data[3] = (uint8_t)last_message_id; memcpy(buf, ack_data, sizeof(ack_data)); @@ -244,23 +237,18 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake_unmatching(int sock, void *buf, { uint16_t last_message_id = 0; - static uint8_t ack_data[] = { - 0x68, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 - }; + static uint8_t ack_data[] = {0x68, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}; - if (messages_needing_response[0] != 0) { - last_message_id = messages_needing_response[0]; - messages_needing_response[0] = 0; - } else { - last_message_id = messages_needing_response[1]; - messages_needing_response[1] = 0; - } + last_message_id = get_next_pending_message_id(); - ack_data[2] = (uint8_t) (last_message_id >> 8); - ack_data[3] = (uint8_t) last_message_id; + ack_data[2] = (uint8_t)(last_message_id >> 8); + ack_data[3] = (uint8_t)last_message_id; memcpy(buf, ack_data, sizeof(ack_data)); + clear_socket_events(); + return sizeof(ack_data); } @@ -275,22 +263,18 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake_echo(int sock, void *buf, size_ 0x00, 0x00, 0x00, 0x00, 0xda, 0xef, 'e', 'c', 'h', 'o', '_', 'v', 'a', 'l', 'u', 'e'}; - if (messages_needing_response[0] != 0) { - last_message_id = messages_needing_response[0]; - messages_needing_response[0] = 0; - } else { - last_message_id = messages_needing_response[1]; - messages_needing_response[1] = 0; - } + last_message_id = get_next_pending_message_id(); - ack_data[2] = (uint8_t) (last_message_id >> 8); - ack_data[3] = (uint8_t) last_message_id; + ack_data[2] = (uint8_t)(last_message_id >> 8); + ack_data[3] = (uint8_t)last_message_id; memcpy(buf, ack_data, sizeof(ack_data)); z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_response; z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_echo; + clear_socket_events(); + return sizeof(ack_data); } @@ -305,22 +289,18 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake_echo_next_req(int sock, void *b 0x00, 0x00, 0x00, 0x00, 0xda, 0xef, 'e', 'c', 'h', 'o', '_', 'v', 'a', 'l', 'u', 'e'}; - if (messages_needing_response[0] != 0) { - last_message_id = messages_needing_response[0]; - messages_needing_response[0] = 0; - } else { - last_message_id = messages_needing_response[1]; - messages_needing_response[1] = 0; - } + last_message_id = get_next_pending_message_id(); - ack_data[2] = (uint8_t) (last_message_id >> 8); - ack_data[3] = (uint8_t) last_message_id; + ack_data[2] = (uint8_t)(last_message_id >> 8); + ack_data[3] = (uint8_t)last_message_id; memcpy(buf, ack_data, sizeof(ack_data)); z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_response; z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_echo_next_req; + clear_socket_events(); + return sizeof(ack_data); } @@ -333,6 +313,8 @@ static void *suite_setup(void) static void test_setup(void *data) { + int i; + /* Register resets */ DO_FOREACH_FAKE(RESET_FAKE); /* reset common FFF internal structures */ @@ -340,8 +322,12 @@ static void test_setup(void *data) z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake; z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake; - messages_needing_response[0] = 0; - messages_needing_response[1] = 0; + + for (i = 0; i < ARRAY_SIZE(messages_needing_response); i++) { + messages_needing_response[i] = 0; + } + + last_response_code = 0; } void coap_callback(int16_t code, size_t offset, const uint8_t *payload, size_t len, bool last_block, @@ -375,10 +361,10 @@ ZTEST(coap_client, test_get_request) LOG_INF("Send request"); ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); - set_socket_events(ZSOCK_POLLIN); - k_sleep(K_MSEC(100)); + k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); + LOG_INF("Test done"); } ZTEST(coap_client, test_resend_request) @@ -398,19 +384,20 @@ ZTEST(coap_client, test_resend_request) client_request.payload = short_payload; client_request.len = strlen(short_payload); - z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_delayed_response; + z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; k_sleep(K_MSEC(1)); LOG_INF("Send request"); ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); - k_sleep(K_MSEC(15)); + k_sleep(K_MSEC(MORE_THAN_ACK_TIMEOUT_MS)); set_socket_events(ZSOCK_POLLIN); - k_sleep(K_MSEC(100)); + k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); zassert_equal(z_impl_zsock_sendto_fake.call_count, 2); + LOG_INF("Test done"); } ZTEST(coap_client, test_echo_option) @@ -437,10 +424,10 @@ ZTEST(coap_client, test_echo_option) LOG_INF("Send request"); ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); - set_socket_events(ZSOCK_POLLIN); - k_sleep(K_MSEC(100)); + k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); + LOG_INF("Test done"); } ZTEST(coap_client, test_echo_option_next_req) @@ -467,9 +454,8 @@ ZTEST(coap_client, test_echo_option_next_req) LOG_INF("Send request"); ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); - set_socket_events(ZSOCK_POLLIN); - k_sleep(K_MSEC(100)); + k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); char *payload = "echo testing"; @@ -481,9 +467,8 @@ ZTEST(coap_client, test_echo_option_next_req) LOG_INF("Send next request"); ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); - set_socket_events(ZSOCK_POLLIN); - k_sleep(K_MSEC(100)); + k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); } @@ -534,9 +519,8 @@ ZTEST(coap_client, test_send_large_data) LOG_INF("Send request"); ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); - set_socket_events(ZSOCK_POLLIN); - k_sleep(K_MSEC(100)); + k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); } @@ -554,7 +538,7 @@ ZTEST(coap_client, test_no_response) .len = 0 }; struct coap_transmission_parameters params = { - .ack_timeout = 200, + .ack_timeout = LONG_ACK_TIMEOUT_MS, .coap_backoff_percent = 200, .max_retransmission = 0 }; @@ -562,15 +546,16 @@ ZTEST(coap_client, test_no_response) client_request.payload = short_payload; client_request.len = strlen(short_payload); + z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; + k_sleep(K_MSEC(1)); LOG_INF("Send request"); - clear_socket_events(); ret = coap_client_req(&client, 0, &address, &client_request, ¶ms); zassert_true(ret >= 0, "Sending request failed, %d", ret); - k_sleep(K_MSEC(700)); + k_sleep(K_MSEC(MORE_THAN_LONG_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, -ETIMEDOUT, "Unexpected response"); } @@ -598,15 +583,16 @@ ZTEST(coap_client, test_separate_response) LOG_INF("Send request"); ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); - set_socket_events(ZSOCK_POLLIN); - k_sleep(K_MSEC(100)); + k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); } ZTEST(coap_client, test_multiple_requests) { int ret = 0; + int retry = MORE_THAN_EXCHANGE_LIFETIME_MS; + struct sockaddr address = {0}; struct coap_client_request client_request = { .method = COAP_METHOD_GET, @@ -621,8 +607,9 @@ ZTEST(coap_client, test_multiple_requests) client_request.payload = short_payload; client_request.len = strlen(short_payload); + z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; + k_sleep(K_MSEC(1)); - set_socket_events(ZSOCK_POLLIN); LOG_INF("Send request"); ret = coap_client_req(&client, 0, &address, &client_request, NULL); @@ -631,10 +618,15 @@ ZTEST(coap_client, test_multiple_requests) ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); - k_sleep(K_MSEC(100)); + set_socket_events(ZSOCK_POLLIN); + while (last_response_code == 0 && retry > 0) { + retry--; + k_sleep(K_MSEC(1)); + } zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); - k_sleep(K_MSEC(100)); + set_socket_events(ZSOCK_POLLIN); + k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); } @@ -652,7 +644,7 @@ ZTEST(coap_client, test_unmatching_tokens) .len = 0 }; struct coap_transmission_parameters params = { - .ack_timeout = 200, + .ack_timeout = LONG_ACK_TIMEOUT_MS, .coap_backoff_percent = 200, .max_retransmission = 0 }; @@ -662,13 +654,12 @@ ZTEST(coap_client, test_unmatching_tokens) z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_unmatching; + k_sleep(K_MSEC(1)); + LOG_INF("Send request"); ret = coap_client_req(&client, 0, &address, &client_request, ¶ms); zassert_true(ret >= 0, "Sending request failed, %d", ret); - set_socket_events(ZSOCK_POLLIN); - k_sleep(K_MSEC(2)); - clear_socket_events(); - k_sleep(K_MSEC(700)); + k_sleep(K_MSEC(MORE_THAN_LONG_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, -ETIMEDOUT, "Unexpected response"); } diff --git a/tests/net/lib/coap_client/src/stubs.c b/tests/net/lib/coap_client/src/stubs.c index 13effd8f91b91..471cc8642bc96 100644 --- a/tests/net/lib/coap_client/src/stubs.c +++ b/tests/net/lib/coap_client/src/stubs.c @@ -13,7 +13,7 @@ DEFINE_FAKE_VALUE_FUNC(uint32_t, z_impl_sys_rand32_get); DEFINE_FAKE_VOID_FUNC(z_impl_sys_rand_get, void *, size_t); DEFINE_FAKE_VALUE_FUNC(ssize_t, z_impl_zsock_recvfrom, int, void *, size_t, int, struct sockaddr *, socklen_t *); -DEFINE_FAKE_VALUE_FUNC(ssize_t, z_impl_zsock_sendto, int, void*, size_t, int, +DEFINE_FAKE_VALUE_FUNC(ssize_t, z_impl_zsock_sendto, int, void *, size_t, int, const struct sockaddr *, socklen_t); struct zsock_pollfd { @@ -42,11 +42,12 @@ int z_impl_zsock_socket(int family, int type, int proto) int z_impl_zsock_poll(struct zsock_pollfd *fds, int nfds, int poll_timeout) { LOG_INF("Polling, events %d", my_events); - k_sleep(K_MSEC(10)); + k_sleep(K_MSEC(1)); fds->revents = my_events; + if (my_events) { return 1; - } else { - return 0; } + + return 0; } From c39ad845f372f67787b79164a30cabe0dd236773 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 18 Sep 2024 12:33:10 +0200 Subject: [PATCH 0350/4482] scripts: ci: check_compliance: add BOARD_REVISION in Kconfig.board.v2 This is required if boards make use of such definition in their Kconfig files. In Kconfig.board.v2, only `boards/Kconfig.v2` is loaded, but BOARD_REVISION is part of `boards/Kconfig`, which can't be loaded in this context. Signed-off-by: Gerard Marull-Paretas --- scripts/ci/Kconfig.board.v2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/ci/Kconfig.board.v2 b/scripts/ci/Kconfig.board.v2 index e1335cafe3938..3058e8e46bb76 100644 --- a/scripts/ci/Kconfig.board.v2 +++ b/scripts/ci/Kconfig.board.v2 @@ -6,5 +6,8 @@ mainmenu "Zephyr board / SoC v2 Configuration" +config BOARD_REVISION + def_string "$(BOARD_REVISION)" + source "boards/Kconfig.v2" source "soc/Kconfig.v2" From de82f2f4cb85d543602a086e7ed6ce2f1bab8e34 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Fri, 13 Sep 2024 14:41:32 +0200 Subject: [PATCH 0351/4482] manifest: update hal_nordic revision to have nrfx 3.7.0 Bring latest release of nrfx: 3.7.0. Signed-off-by: Nikodem Kastelik Signed-off-by: Gerard Marull-Paretas --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index e5c9548071bdd..fc2315ae551ba 100644 --- a/west.yml +++ b/west.yml @@ -188,7 +188,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 6d4acb8dbd9e92c7c5d6e18724197e3f007ae45e + revision: ee6213b6cfcd7fdc10f7ec3a4f7f37f35dfa5343 path: modules/hal/nordic groups: - hal From 97dff5bccb3273ee30f457c3dc74836ec1920af1 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 30 Sep 2024 16:47:00 +0200 Subject: [PATCH 0352/4482] modules: hal_nordic: align PDM configuration Introduce instance 0, PDM0, following nrfx 3.7.0 update. Signed-off-by: Gerard Marull-Paretas --- drivers/audio/Kconfig.dmic_pdm_nrfx | 2 +- modules/hal_nordic/nrfx/Kconfig | 8 ++++++-- modules/hal_nordic/nrfx/nrfx_config.h | 3 +++ soc/nordic/common/Kconfig.peripherals | 4 ++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/audio/Kconfig.dmic_pdm_nrfx b/drivers/audio/Kconfig.dmic_pdm_nrfx index 9f45144effa9c..dfbda8259f2e8 100644 --- a/drivers/audio/Kconfig.dmic_pdm_nrfx +++ b/drivers/audio/Kconfig.dmic_pdm_nrfx @@ -5,7 +5,7 @@ config AUDIO_DMIC_NRFX_PDM bool "nRF PDM nrfx driver" default y depends on DT_HAS_NORDIC_NRF_PDM_ENABLED - select NRFX_PDM + select NRFX_PDM0 if HAS_HW_NRF_PDM0 select PINCTRL help Enable support for nrfx PDM driver for nRF MCU series. diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 3313e033c7c3b..65894d4871275 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -162,8 +162,12 @@ config NRFX_NVMC || $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF91_FLASH_CONTROLLER)) config NRFX_PDM - bool "PDM driver" - depends on $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF_PDM)) + bool + +config NRFX_PDM0 + bool "PDM0 driver instance" + depends on $(dt_nodelabel_has_compat,pdm0,$(DT_COMPAT_NORDIC_NRF_PDM)) + select NRFX_PDM config NRFX_POWER bool "POWER driver" diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index bec09b1a058bc..d70db90a7641f 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -212,6 +212,9 @@ #ifdef CONFIG_NRFX_PDM #define NRFX_PDM_ENABLED 1 #endif +#ifdef CONFIG_NRFX_PDM0 +#define NRFX_PDM0_ENABLED 1 +#endif #ifdef CONFIG_NRFX_PDM_LOG #define NRFX_PDM_CONFIG_LOG_ENABLED 1 #endif diff --git a/soc/nordic/common/Kconfig.peripherals b/soc/nordic/common/Kconfig.peripherals index 5b1afd66d3fc6..57c90b05ef750 100644 --- a/soc/nordic/common/Kconfig.peripherals +++ b/soc/nordic/common/Kconfig.peripherals @@ -126,8 +126,8 @@ config HAS_HW_NRF_NVMC_PE config HAS_HW_NRF_OSCILLATORS def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_OSCILLATORS)) -config HAS_HW_NRF_PDM - def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_PDM)) +config HAS_HW_NRF_PDM0 + def_bool $(dt_nodelabel_enabled_with_compat,pdm0,$(DT_COMPAT_NORDIC_NRF_PDM)) config HAS_HW_NRF_POWER def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_POWER)) From 9d82a0344447ec0d72944c796d47aa7528ed8e27 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 30 Sep 2024 16:51:30 +0200 Subject: [PATCH 0353/4482] modules: hal_nordic: add nrf54l system sources to bsim build Include system_nrf54l.c file when building for bsim. Signed-off-by: Gerard Marull-Paretas --- modules/hal_nordic/nrfx/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 2e8e0cc1eb521..cc1731b1e500a 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -95,7 +95,9 @@ zephyr_library_sources_ifdef(CONFIG_SOC_NRF52840 ${MDK_DIR}/system_nrf5284 zephyr_library_sources_ifdef(CONFIG_SOC_NRF5340_CPUAPP ${MDK_DIR}/system_nrf5340_application.c) zephyr_library_sources_ifdef(CONFIG_SOC_NRF5340_CPUNET ${MDK_DIR}/system_nrf5340_network.c) zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_NRF54HX ${MDK_DIR}/system_nrf54h.c) -zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_NRF54LX ${MDK_DIR}/system_nrf54l.c) +if(CONFIG_SOC_SERIES_NRF54LX OR CONFIG_SOC_SERIES_BSIM_NRF54LX) + zephyr_library_sources(${MDK_DIR}/system_nrf54l.c) +endif() zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_NRF91X ${MDK_DIR}/system_nrf91.c) zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_NRF92X ${MDK_DIR}/system_nrf92.c) From b2031aa20d3814e43aa42c769c5536ee8487373d Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 30 Sep 2024 15:49:28 +0200 Subject: [PATCH 0354/4482] bluetooth: controller: ll_sw: nordic: align to nrfx 3.7.0 Some enums have been renamed: - NRF_CCM_EVENT_ENDCRYPT -> NRF_CCM_EVENT_END - NRF_CCM_TASK_CRYPT -> NRF_CCM_TASK_START Also adjust some TX power level settings (26/28dBm not always available depending on the SoC revision). Signed-off-by: Gerard Marull-Paretas --- .../controller/ll_sw/nordic/hal/nrf5/radio/radio.c | 4 ++-- .../ll_sw/nordic/hal/nrf5/radio/radio_nrf54lx.h | 8 ++++++++ .../ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h | 6 +++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c index 79954af8da295..cacfe735d8d58 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c @@ -2052,7 +2052,7 @@ static void *radio_ccm_ext_rx_pkt_set(struct ccm *cnf, uint8_t phy, uint8_t pdu_ NRF_CCM->SCRATCHPTR = (uint32_t)_ccm_scratch; NRF_CCM->SHORTS = 0; nrf_ccm_event_clear(NRF_CCM, NRF_CCM_EVENT_ENDKSGEN); - nrf_ccm_event_clear(NRF_CCM, NRF_CCM_EVENT_ENDCRYPT); + nrf_ccm_event_clear(NRF_CCM, NRF_CCM_EVENT_END); nrf_ccm_event_clear(NRF_CCM, NRF_CCM_EVENT_ERROR); nrf_ccm_task_trigger(NRF_CCM, NRF_CCM_TASK_KSGEN); @@ -2127,7 +2127,7 @@ static void *radio_ccm_ext_tx_pkt_set(struct ccm *cnf, uint8_t pdu_type, void *p NRF_CCM->SCRATCHPTR = (uint32_t)_ccm_scratch; NRF_CCM->SHORTS = CCM_SHORTS_ENDKSGEN_CRYPT_Msk; nrf_ccm_event_clear(NRF_CCM, NRF_CCM_EVENT_ENDKSGEN); - nrf_ccm_event_clear(NRF_CCM, NRF_CCM_EVENT_ENDCRYPT); + nrf_ccm_event_clear(NRF_CCM, NRF_CCM_EVENT_END); nrf_ccm_event_clear(NRF_CCM, NRF_CCM_EVENT_ERROR); nrf_ccm_task_trigger(NRF_CCM, NRF_CCM_TASK_KSGEN); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf54lx.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf54lx.h index b0d3948aefbe5..bc0cc2993c563 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf54lx.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf54lx.h @@ -633,9 +633,17 @@ static inline uint32_t hal_radio_tx_power_value(int8_t tx_power_lvl) return RADIO_TXPOWER_TXPOWER_Neg20dBm; } +#if defined(RADIO_TXPOWER_TXPOWER_Neg26dBm) if (tx_power_lvl >= -26) { return RADIO_TXPOWER_TXPOWER_Neg26dBm; } +#endif + +#if defined(RADIO_TXPOWER_TXPOWER_Neg28dBm) + if (tx_power_lvl >= -28) { + return RADIO_TXPOWER_TXPOWER_Neg28dBm; + } +#endif if (tx_power_lvl >= -40) { return RADIO_TXPOWER_TXPOWER_Neg40dBm; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h index 770cb70d8ccf0..1ddf9af1ccfbc 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h @@ -149,7 +149,7 @@ static inline void hal_trigger_crypt_ppi_config(void) { nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_ADDRESS, HAL_RADIO_RECV_TIMEOUT_CANCEL_PPI); - nrf_ccm_subscribe_set(NRF_CCM, NRF_CCM_TASK_CRYPT, HAL_RADIO_RECV_TIMEOUT_CANCEL_PPI); + nrf_ccm_subscribe_set(NRF_CCM, NRF_CCM_TASK_START, HAL_RADIO_RECV_TIMEOUT_CANCEL_PPI); } /******************************************************************************* @@ -157,7 +157,7 @@ static inline void hal_trigger_crypt_ppi_config(void) */ static inline void hal_trigger_crypt_ppi_disable(void) { - nrf_ccm_subscribe_clear(NRF_CCM, NRF_CCM_TASK_CRYPT); + nrf_ccm_subscribe_clear(NRF_CCM, NRF_CCM_TASK_START); } /******************************************************************************* @@ -207,7 +207,7 @@ static inline void hal_trigger_crypt_by_bcmatch_ppi_config(void) */ nrf_radio_publish_set(NRF_RADIO, NRF_RADIO_EVENT_BCMATCH, HAL_TRIGGER_CRYPT_DELAY_PPI); - nrf_ccm_subscribe_set(NRF_CCM, NRF_CCM_TASK_CRYPT, HAL_TRIGGER_CRYPT_DELAY_PPI); + nrf_ccm_subscribe_set(NRF_CCM, NRF_CCM_TASK_START, HAL_TRIGGER_CRYPT_DELAY_PPI); } #endif /* CONFIG_BT_CTLR_DF_CONN_CTE_RX */ #endif /* CONFIG_BT_CTLR_LE_ENC || CONFIG_BT_CTLR_BROADCAST_ISO_ENC */ From bc7a5b6781a47da73b4f8f359e9cccd4a2412279 Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Thu, 26 Sep 2024 12:40:07 +0200 Subject: [PATCH 0355/4482] drivers: timer: nrf_grtc_timer: Align Zephyr to new AUTOEN read manner The new GRTC reading manner of the SYSCOUNTER uses hardware mechanism which allows to keep it alive when any of CPUs is not sleeping. Otherwise the SYSCOUNTER goes into sleep mode. Thus there is no longer need to maintain the `CONFIG_NRF_GRTC_SLEEP_ALLOWED` symbol, however if the user wants to have the SYSCOUNTER enabled all the time the `CONFIG_NRF_GRTC_ALWAYS_ON` can be used instead. The nrfx_grtc driver no longer provides the `wakeup-read-sleep` reading manner. Also setting the GRTC clock source is performed by the nrfx_grtc driver so it has been removed from the `sys_clock_driver_init()` function. Signed-off-by: Adam Kondraciuk --- drivers/timer/Kconfig.nrf_grtc | 9 ++++----- drivers/timer/nrf_grtc_timer.c | 13 +++++-------- modules/hal_nordic/nrfx/nrfx_config.h | 3 --- .../nrfx/nrfx_config_nrf54l15_enga_application.h | 9 --------- .../nrfx/nrfx_config_nrf54l15_enga_flpr.h | 9 --------- .../nrfx/nrfx_config_nrf9230_engb_application.h | 9 --------- .../hal_nordic/nrfx/nrfx_config_nrf9230_engb_ppr.h | 9 --------- .../nrfx/nrfx_config_nrf9230_engb_radiocore.h | 9 --------- soc/nordic/nrf54l/Kconfig | 2 +- 9 files changed, 10 insertions(+), 62 deletions(-) diff --git a/drivers/timer/Kconfig.nrf_grtc b/drivers/timer/Kconfig.nrf_grtc index b136f65425236..082c15333dcb1 100644 --- a/drivers/timer/Kconfig.nrf_grtc +++ b/drivers/timer/Kconfig.nrf_grtc @@ -15,11 +15,10 @@ menuconfig NRF_GRTC_TIMER if NRF_GRTC_TIMER -config NRF_GRTC_SLEEP_ALLOWED - def_bool y - depends on POWEROFF +config NRF_GRTC_ALWAYS_ON + bool help - This feature allows GRTC SYSCOUNTER to go to sleep state. + Always keep the SYSCOUNTER active even if the CPU is in sleep mode. config NRF_GRTC_TIMER_APP_DEFINED_INIT bool "Application defines GRTC initialization" @@ -44,7 +43,7 @@ config NRF_GRTC_TIMER_CLOCK_MANAGEMENT config NRF_GRTC_SYSCOUNTER_SLEEP_MINIMUM_LATENCY int default 1000 - depends on NRF_GRTC_SLEEP_ALLOWED + depends on POWEROFF help The value (in us) ensures that the wakeup event will not fire too early. In other words, applying SYSCOUNTER sleep state for less than diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index 401fdd26821b8..fb9c859caeb89 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -367,7 +367,7 @@ int z_nrf_grtc_timer_capture_read(int32_t chan, uint64_t *captured_time) return 0; } -#if defined(CONFIG_NRF_GRTC_SLEEP_ALLOWED) && defined(CONFIG_NRF_GRTC_START_SYSCOUNTER) +#if defined(CONFIG_POWEROFF) && defined(CONFIG_NRF_GRTC_START_SYSCOUNTER) int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) { nrfx_err_t err_code; @@ -432,7 +432,7 @@ int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us) k_spin_unlock(&lock, key); return 0; } -#endif /* CONFIG_NRF_GRTC_SLEEP_ALLOWED */ +#endif /* CONFIG_POWEROFF */ uint32_t sys_clock_cycle_get_32(void) { @@ -465,12 +465,6 @@ static int sys_clock_driver_init(void) { nrfx_err_t err_code; -#if defined(CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT) && \ - (defined(NRF_GRTC_HAS_CLKSEL) && (NRF_GRTC_HAS_CLKSEL == 1)) - /* Use System LFCLK as the low-frequency clock source during initialization. */ - nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFCLK); -#endif - IRQ_CONNECT(DT_IRQN(GRTC_NODE), DT_IRQ(GRTC_NODE, priority), nrfx_isr, nrfx_grtc_irq_handler, 0); @@ -513,6 +507,9 @@ static int sys_clock_driver_init(void) nrfx_grtc_clock_source_set(NRF_GRTC_CLKSEL_LFXO); #endif +#if defined(CONFIG_NRF_GRTC_ALWAYS_ON) + nrfx_grtc_active_request_set(true); +#endif return 0; } diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index d70db90a7641f..835b442d756db 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -132,9 +132,6 @@ #ifdef CONFIG_NRF_GRTC_TIMER_CLOCK_MANAGEMENT #define NRF_GRTC_HAS_EXTENDED 1 #endif -#ifdef CONFIG_NRF_GRTC_SLEEP_ALLOWED -#define NRFX_GRTC_CONFIG_SLEEP_ALLOWED 1 -#endif #ifdef CONFIG_NRF_GRTC_TIMER_AUTO_KEEP_ALIVE #define NRFX_GRTC_CONFIG_AUTOEN 1 #endif diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_application.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_application.h index eeea811aeffac..aa23f93c9e372 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_application.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_application.h @@ -283,15 +283,6 @@ #define NRFX_GRTC_ENABLED 0 #endif -/** - * @brief NRFX_GRTC_CONFIG_SLEEP_ALLOWED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_GRTC_CONFIG_SLEEP_ALLOWED -#define NRFX_GRTC_CONFIG_SLEEP_ALLOWED 0 -#endif - /** * @brief NRFX_GRTC_CONFIG_AUTOEN * diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_flpr.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_flpr.h index 7f3c5a80c2ce9..568790051a3fc 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_flpr.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_enga_flpr.h @@ -283,15 +283,6 @@ #define NRFX_GRTC_ENABLED 0 #endif -/** - * @brief NRFX_GRTC_CONFIG_SLEEP_ALLOWED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_GRTC_CONFIG_SLEEP_ALLOWED -#define NRFX_GRTC_CONFIG_SLEEP_ALLOWED 0 -#endif - /** * @brief NRFX_GRTC_CONFIG_AUTOEN * diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf9230_engb_application.h b/modules/hal_nordic/nrfx/nrfx_config_nrf9230_engb_application.h index a7905c199d2e4..38ce622646884 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf9230_engb_application.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf9230_engb_application.h @@ -367,15 +367,6 @@ #define NRFX_GRTC_ENABLED 0 #endif -/** - * @brief NRFX_GRTC_CONFIG_SLEEP_ALLOWED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_GRTC_CONFIG_SLEEP_ALLOWED -#define NRFX_GRTC_CONFIG_SLEEP_ALLOWED 0 -#endif - /** * @brief NRFX_GRTC_CONFIG_AUTOEN * diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf9230_engb_ppr.h b/modules/hal_nordic/nrfx/nrfx_config_nrf9230_engb_ppr.h index ae1f931e3dabf..9ae53d739e91d 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf9230_engb_ppr.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf9230_engb_ppr.h @@ -322,15 +322,6 @@ #define NRFX_GRTC_ENABLED 0 #endif -/** - * @brief NRFX_GRTC_CONFIG_SLEEP_ALLOWED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_GRTC_CONFIG_SLEEP_ALLOWED -#define NRFX_GRTC_CONFIG_SLEEP_ALLOWED 0 -#endif - /** * @brief NRFX_GRTC_CONFIG_AUTOEN * diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf9230_engb_radiocore.h b/modules/hal_nordic/nrfx/nrfx_config_nrf9230_engb_radiocore.h index 84a0a7558e69b..98d71e6b385be 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf9230_engb_radiocore.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf9230_engb_radiocore.h @@ -407,15 +407,6 @@ #define NRFX_GRTC_ENABLED 0 #endif -/** - * @brief NRFX_GRTC_CONFIG_SLEEP_ALLOWED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_GRTC_CONFIG_SLEEP_ALLOWED -#define NRFX_GRTC_CONFIG_SLEEP_ALLOWED 0 -#endif - /** * @brief NRFX_GRTC_CONFIG_AUTOEN * diff --git a/soc/nordic/nrf54l/Kconfig b/soc/nordic/nrf54l/Kconfig index df17dc35d3ea4..eeb12fbfab04d 100644 --- a/soc/nordic/nrf54l/Kconfig +++ b/soc/nordic/nrf54l/Kconfig @@ -86,7 +86,7 @@ if NRF_GRTC_TIMER config ELV_GRTC_LFXO_ALLOWED bool - depends on NRF_GRTC_SLEEP_ALLOWED + depends on POWEROFF select EXPERIMENTAL help This feature allows using ELV mode when GRTC operates with the LFXO as From a9d0eacae288393e3686b7c7d6af7a65253e0c9f Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 18 Sep 2024 10:17:33 +0200 Subject: [PATCH 0356/4482] soc: nordic: nrf54h20: add support for nRF54H20 EngB nRF54H20 EngB is a re-label to the existing hardware revision for the nRF54H20. nRF54H20 (whithout EngX) is becoming the final revision of the SoC. Signed-off-by: Gerard Marull-Paretas --- soc/nordic/nrf54h/Kconfig | 24 ++++++++++++-- .../nrf54h/Kconfig.defconfig.nrf54h20_cpuapp | 4 +-- .../nrf54h/Kconfig.defconfig.nrf54h20_cpuflpr | 4 +-- .../nrf54h/Kconfig.defconfig.nrf54h20_cpuppr | 4 +-- .../nrf54h/Kconfig.defconfig.nrf54h20_cpurad | 4 +-- soc/nordic/nrf54h/Kconfig.soc | 32 ++++++++++++++++++- soc/nordic/nrf54h/soc.h | 4 +-- 7 files changed, 63 insertions(+), 13 deletions(-) diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index dd647174b1411..51dc4e0748069 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -9,7 +9,8 @@ config SOC_SERIES_NRF54HX select HAS_NORDIC_DRIVERS select NRF_PLATFORM_HALTIUM -config SOC_NRF54H20_CPUAPP +config SOC_NRF54H20_CPUAPP_COMMON + bool select ARM select ARMV8_M_DSP select CPU_CORTEX_M33 @@ -29,7 +30,14 @@ config SOC_NRF54H20_CPUAPP select HAS_PM select HAS_POWEROFF -config SOC_NRF54H20_CPURAD +config SOC_NRF54H20_CPUAPP + select SOC_NRF54H20_CPUAPP_COMMON + +config SOC_NRF54H20_ENGB_CPUAPP + select SOC_NRF54H20_CPUAPP_COMMON + +config SOC_NRF54H20_CPURAD_COMMON + bool select ARM select ARMV8_M_DSP select CPU_CORTEX_M33 @@ -48,8 +56,20 @@ config SOC_NRF54H20_CPURAD select HAS_PM select HAS_POWEROFF +config SOC_NRF54H20_CPURAD + select SOC_NRF54H20_CPURAD_COMMON + +config SOC_NRF54H20_ENGB_CPURAD + select SOC_NRF54H20_CPURAD_COMMON + config SOC_NRF54H20_CPUPPR depends on RISCV_CORE_NORDIC_VPR +config SOC_NRF54H20_ENGB_CPUPPR + depends on RISCV_CORE_NORDIC_VPR + config SOC_NRF54H20_CPUFLPR depends on RISCV_CORE_NORDIC_VPR + +config SOC_NRF54H20_ENGB_CPUFLPR + depends on RISCV_CORE_NORDIC_VPR diff --git a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp index 1a53fb5ff322c..2a04f58f67290 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp +++ b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp @@ -3,7 +3,7 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if SOC_NRF54H20_CPUAPP +if SOC_NRF54H20_CPUAPP || SOC_NRF54H20_ENGB_CPUAPP config NUM_IRQS default 471 @@ -11,4 +11,4 @@ config NUM_IRQS config NRF_REGTOOL_GENERATE_UICR default y -endif # SOC_NRF54H20_CPUAPP +endif # SOC_NRF54H20_CPUAPP || SOC_NRF54H20_ENGB_CPUAPP diff --git a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuflpr b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuflpr index 2b792e9f1b93f..97b1e89a9c16d 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuflpr +++ b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuflpr @@ -1,7 +1,7 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if SOC_NRF54H20_CPUFLPR +if SOC_NRF54H20_CPUFLPR || SOC_NRF54H20_ENGB_CPUFLPR config NUM_IRQS default 496 @@ -10,4 +10,4 @@ config NUM_IRQS config ASSERT default n -endif # SOC_NRF54H20_CPUFLPR +endif # SOC_NRF54H20_CPUFLPR || SOC_NRF54H20_ENGB_CPUFLPR diff --git a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr index bf7c12a3a694d..02649146ad770 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr +++ b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr @@ -1,7 +1,7 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if SOC_NRF54H20_CPUPPR +if SOC_NRF54H20_CPUPPR || SOC_NRF54H20_ENGB_CPUPPR config NUM_IRQS default 496 @@ -13,4 +13,4 @@ config SYS_CLOCK_TICKS_PER_SEC config ASSERT default n -endif # SOC_NRF54H20_CPUPPR +endif # SOC_NRF54H20_CPUPPR || SOC_NRF54H20_ENGB_CPUPPR diff --git a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpurad b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpurad index 4437e7aadc441..9ad0b30e1c831 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpurad +++ b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpurad @@ -3,7 +3,7 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if SOC_NRF54H20_CPURAD +if SOC_NRF54H20_CPURAD || SOC_NRF54H20_ENGB_CPURAD config NUM_IRQS default 471 @@ -11,4 +11,4 @@ config NUM_IRQS config NRF_REGTOOL_GENERATE_UICR default y -endif # SOC_NRF54H20_CPURAD +endif # SOC_NRF54H20_CPURAD || SOC_NRF54H20_ENGB_CPURAD diff --git a/soc/nordic/nrf54h/Kconfig.soc b/soc/nordic/nrf54h/Kconfig.soc index 459854e13b2dc..852e92bb138e4 100644 --- a/soc/nordic/nrf54h/Kconfig.soc +++ b/soc/nordic/nrf54h/Kconfig.soc @@ -9,29 +9,59 @@ config SOC_NRF54H20 help nRF54H20 +config SOC_NRF54H20_ENGB + bool + select SOC_SERIES_NRF54HX + help + nRF54H20 (EngB) + config SOC_NRF54H20_CPUAPP bool select SOC_NRF54H20 help nRF54H20 CPUAPP +config SOC_NRF54H20_ENGB_CPUAPP + bool + select SOC_NRF54H20_ENGB + help + nRF54H20 (EngB) CPUAPP + config SOC_NRF54H20_CPURAD bool select SOC_NRF54H20 help nRF54H20 CPURAD +config SOC_NRF54H20_ENGB_CPURAD + bool + select SOC_NRF54H20_ENGB + help + nRF54H20 (EngB) CPURAD + config SOC_NRF54H20_CPUPPR bool select SOC_NRF54H20 help nRF54H20 CPUPPR +config SOC_NRF54H20_ENGB_CPUPPR + bool + select SOC_NRF54H20_ENGB + help + nRF54H20 (EngB) CPUPPR + config SOC_NRF54H20_CPUFLPR bool select SOC_NRF54H20 help nRF54H20 CPUFLPR +config SOC_NRF54H20_ENGB_CPUFLPR + bool + select SOC_NRF54H20_ENGB + help + nRF54H20 (EngB) CPUFLPR + config SOC - default "nrf54h20" if SOC_NRF54H20 + default "nrf54h20" if SOC_NRF54H20 || SOC_NRF54H20_ENGB diff --git a/soc/nordic/nrf54h/soc.h b/soc/nordic/nrf54h/soc.h index 566c07a8c2cbf..db79e2c8c720a 100644 --- a/soc/nordic/nrf54h/soc.h +++ b/soc/nordic/nrf54h/soc.h @@ -9,7 +9,7 @@ #include -#if defined(CONFIG_SOC_NRF54H20_CPUAPP) +#if defined(CONFIG_SOC_NRF54H20_CPUAPP) || defined(CONFIG_SOC_NRF54H20_ENGB_CPUAPP) #define RAMBLOCK_CONTROL_BIT_ICACHE MEMCONF_POWER_CONTROL_MEM1_Pos #define RAMBLOCK_CONTROL_BIT_DCACHE MEMCONF_POWER_CONTROL_MEM2_Pos #define RAMBLOCK_POWER_ID 0 @@ -17,7 +17,7 @@ #define RAMBLOCK_RET_MASK (MEMCONF_POWER_RET_MEM0_Msk) #define RAMBLOCK_RET_BIT_ICACHE MEMCONF_POWER_RET_MEM1_Pos #define RAMBLOCK_RET_BIT_DCACHE MEMCONF_POWER_RET_MEM2_Pos -#elif defined(CONFIG_SOC_NRF54H20_CPURAD) +#elif defined(CONFIG_SOC_NRF54H20_CPURAD) || defined(CONFIG_SOC_NRF54H20_ENGB_CPURAD) #define RAMBLOCK_CONTROL_BIT_ICACHE MEMCONF_POWER_CONTROL_MEM6_Pos #define RAMBLOCK_CONTROL_BIT_DCACHE MEMCONF_POWER_CONTROL_MEM7_Pos #define RAMBLOCK_POWER_ID 0 From 40f5ca03b594243110eb3a1243299bdb18028b1c Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 18 Sep 2024 10:19:16 +0200 Subject: [PATCH 0357/4482] modules: hal_nordic: add support for nRF54H20 EngB Add support for nRF54H20 EngB in the Nordic HAL glue code. Signed-off-by: Gerard Marull-Paretas --- modules/hal_nordic/nrfx/CMakeLists.txt | 12 ++++++++ modules/hal_nordic/nrfx/nrfx_config.h | 8 +++--- .../nrfx/nrfx_config_nrf54h20_application.h | 19 +++++++------ .../nrfx/nrfx_config_nrf54h20_flpr.h | 27 ++++++++++++------ .../nrfx/nrfx_config_nrf54h20_ppr.h | 28 +++++++++++++------ .../nrfx/nrfx_config_nrf54h20_radiocore.h | 18 ++++++------ 6 files changed, 72 insertions(+), 40 deletions(-) diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index cc1731b1e500a..8d7adc114d74f 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -44,6 +44,14 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_CPUPPR NRF54H20_XXAA NRF_PPR) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_CPUFLPR NRF54H20_XXAA NRF_FLPR) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGB_CPUAPP NRF54H20_ENGB_XXAA + NRF_APPLICATION) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGB_CPURAD NRF54H20_ENGB_XXAA + NRF_RADIOCORE) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGB_CPUPPR NRF54H20_ENGB_XXAA + NRF_PPR) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGB_CPUFLPR NRF54H20_ENGB_XXAA + NRF_FLPR) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L15_ENGA NRF54L15_ENGA_XXAA) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L15_ENGA_CPUAPP NRF_APPLICATION) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L15_ENGA_CPUFLPR NRF_FLPR) @@ -221,6 +229,10 @@ mdk_svd_ifdef(CONFIG_SOC_NRF54H20_CPUAPP nrf54h20_application.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54H20_CPUPPR nrf54h20_ppr.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54H20_CPUFLPR nrf54h20_flpr.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54H20_CPURAD nrf54h20_radiocore.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGB_CPUAPP nrf54h20_engb_application.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGB_CPUPPR nrf54h20_engb_ppr.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGB_CPUFLPR nrf54h20_engb_flpr.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGB_CPURAD nrf54h20_engb_radiocore.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54L15_ENGA_CPUAPP nrf54l15_enga_application.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54L15_ENGA_CPUFLPR nrf54l15_enga_flpr.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54L15_CPUAPP nrf54l15_application.svd) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 835b442d756db..4b23f7a2190a9 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -1042,13 +1042,13 @@ #include #elif defined(NRF5340_XXAA_NETWORK) #include -#elif defined(NRF54H20_XXAA) && defined(NRF_APPLICATION) +#elif (defined(NRF54H20_XXAA) || defined(NRF54H20_ENGB_XXAA)) && defined(NRF_APPLICATION) #include -#elif defined(NRF54H20_XXAA) && defined(NRF_RADIOCORE) +#elif (defined(NRF54H20_XXAA) || defined(NRF54H20_ENGB_XXAA)) && defined(NRF_RADIOCORE) #include -#elif defined(NRF54H20_XXAA) && defined(NRF_PPR) +#elif (defined(NRF54H20_XXAA) || defined(NRF54H20_ENGB_XXAA)) && defined(NRF_PPR) #include -#elif defined(NRF54H20_XXAA) && defined(NRF_FLPR) +#elif (defined(NRF54H20_XXAA) || defined(NRF54H20_ENGB_XXAA)) && defined(NRF_FLPR) #include #elif (defined(NRF54L15_XXAA) || defined(NRF54L15_ENGA_XXAA)) && defined(NRF_APPLICATION) #include diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_application.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_application.h index 7f5d4d30ce905..3caed86c48b4a 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_application.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_application.h @@ -11,6 +11,7 @@ #error "This file should not be included directly. Include nrfx_config.h instead." #endif + /** * @brief NRFX_DEFAULT_IRQ_PRIORITY * @@ -358,30 +359,30 @@ #endif /** - * @brief NRFX_GRTC_CONFIG_SLEEP_ALLOWED + * @brief NRFX_GRTC_CONFIG_AUTOEN * * Boolean. Accepted values: 0 and 1. */ -#ifndef NRFX_GRTC_CONFIG_SLEEP_ALLOWED -#define NRFX_GRTC_CONFIG_SLEEP_ALLOWED 0 +#ifndef NRFX_GRTC_CONFIG_AUTOEN +#define NRFX_GRTC_CONFIG_AUTOEN 1 #endif /** - * @brief NRFX_GRTC_CONFIG_AUTOEN + * @brief NRFX_GRTC_CONFIG_AUTOSTART * * Boolean. Accepted values: 0 and 1. */ -#ifndef NRFX_GRTC_CONFIG_AUTOEN -#define NRFX_GRTC_CONFIG_AUTOEN 0 +#ifndef NRFX_GRTC_CONFIG_AUTOSTART +#define NRFX_GRTC_CONFIG_AUTOSTART 0 #endif /** - * @brief NRFX_GRTC_CONFIG_AUTOSTART + * @brief NRFX_GRTC_CONFIG_CLEAR_AT_INIT * * Boolean. Accepted values: 0 and 1. */ -#ifndef NRFX_GRTC_CONFIG_AUTOSTART -#define NRFX_GRTC_CONFIG_AUTOSTART 0 +#ifndef NRFX_GRTC_CONFIG_CLEAR_AT_INIT +#define NRFX_GRTC_CONFIG_CLEAR_AT_INIT 0 #endif /** diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_flpr.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_flpr.h index 77f5c3c9fc519..f5689f79a968b 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_flpr.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_flpr.h @@ -254,30 +254,30 @@ #endif /** - * @brief NRFX_GRTC_CONFIG_SLEEP_ALLOWED + * @brief NRFX_GRTC_CONFIG_AUTOEN * * Boolean. Accepted values: 0 and 1. */ -#ifndef NRFX_GRTC_CONFIG_SLEEP_ALLOWED -#define NRFX_GRTC_CONFIG_SLEEP_ALLOWED 0 +#ifndef NRFX_GRTC_CONFIG_AUTOEN +#define NRFX_GRTC_CONFIG_AUTOEN 1 #endif /** - * @brief NRFX_GRTC_CONFIG_AUTOEN + * @brief NRFX_GRTC_CONFIG_AUTOSTART * * Boolean. Accepted values: 0 and 1. */ -#ifndef NRFX_GRTC_CONFIG_AUTOEN -#define NRFX_GRTC_CONFIG_AUTOEN 0 +#ifndef NRFX_GRTC_CONFIG_AUTOSTART +#define NRFX_GRTC_CONFIG_AUTOSTART 0 #endif /** - * @brief NRFX_GRTC_CONFIG_AUTOSTART + * @brief NRFX_GRTC_CONFIG_CLEAR_AT_INIT * * Boolean. Accepted values: 0 and 1. */ -#ifndef NRFX_GRTC_CONFIG_AUTOSTART -#define NRFX_GRTC_CONFIG_AUTOSTART 0 +#ifndef NRFX_GRTC_CONFIG_CLEAR_AT_INIT +#define NRFX_GRTC_CONFIG_CLEAR_AT_INIT 0 #endif /** @@ -1619,6 +1619,15 @@ #define NRFX_UARTE_CONFIG_RX_CACHE_ENABLED 1 #endif +/** + * @brief NRFX_UARTE_RX_FIFO_FLUSH_WORKAROUND_MAGIC_BYTE + * + * Integer value. Minimum: 0. Maximum: 255. + */ +#ifndef NRFX_UARTE_RX_FIFO_FLUSH_WORKAROUND_MAGIC_BYTE +#define NRFX_UARTE_RX_FIFO_FLUSH_WORKAROUND_MAGIC_BYTE 171 +#endif + /** * @brief NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY * diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_ppr.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_ppr.h index d274abb5b8830..35716978f2809 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_ppr.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_ppr.h @@ -11,6 +11,7 @@ #error "This file should not be included directly. Include nrfx_config.h instead." #endif + /** * @brief NRFX_DEFAULT_IRQ_PRIORITY * @@ -62,6 +63,15 @@ #define NRFX_COMP_CONFIG_LOG_LEVEL 3 #endif +/** + * @brief NRFX_COREDEP_VPR_LEGACY + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_COREDEP_VPR_LEGACY +#define NRFX_COREDEP_VPR_LEGACY 0 +#endif + /** * @brief NRFX_DPPI_ENABLED * @@ -304,30 +314,30 @@ #endif /** - * @brief NRFX_GRTC_CONFIG_SLEEP_ALLOWED + * @brief NRFX_GRTC_CONFIG_AUTOEN * * Boolean. Accepted values: 0 and 1. */ -#ifndef NRFX_GRTC_CONFIG_SLEEP_ALLOWED -#define NRFX_GRTC_CONFIG_SLEEP_ALLOWED 0 +#ifndef NRFX_GRTC_CONFIG_AUTOEN +#define NRFX_GRTC_CONFIG_AUTOEN 1 #endif /** - * @brief NRFX_GRTC_CONFIG_AUTOEN + * @brief NRFX_GRTC_CONFIG_AUTOSTART * * Boolean. Accepted values: 0 and 1. */ -#ifndef NRFX_GRTC_CONFIG_AUTOEN -#define NRFX_GRTC_CONFIG_AUTOEN 0 +#ifndef NRFX_GRTC_CONFIG_AUTOSTART +#define NRFX_GRTC_CONFIG_AUTOSTART 0 #endif /** - * @brief NRFX_GRTC_CONFIG_AUTOSTART + * @brief NRFX_GRTC_CONFIG_CLEAR_AT_INIT * * Boolean. Accepted values: 0 and 1. */ -#ifndef NRFX_GRTC_CONFIG_AUTOSTART -#define NRFX_GRTC_CONFIG_AUTOSTART 0 +#ifndef NRFX_GRTC_CONFIG_CLEAR_AT_INIT +#define NRFX_GRTC_CONFIG_CLEAR_AT_INIT 0 #endif /** diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_radiocore.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_radiocore.h index 3a6cde96126bf..5847cace47e89 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_radiocore.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54h20_radiocore.h @@ -395,30 +395,30 @@ #endif /** - * @brief NRFX_GRTC_CONFIG_SLEEP_ALLOWED + * @brief NRFX_GRTC_CONFIG_AUTOEN * * Boolean. Accepted values: 0 and 1. */ -#ifndef NRFX_GRTC_CONFIG_SLEEP_ALLOWED -#define NRFX_GRTC_CONFIG_SLEEP_ALLOWED 0 +#ifndef NRFX_GRTC_CONFIG_AUTOEN +#define NRFX_GRTC_CONFIG_AUTOEN 1 #endif /** - * @brief NRFX_GRTC_CONFIG_AUTOEN + * @brief NRFX_GRTC_CONFIG_AUTOSTART * * Boolean. Accepted values: 0 and 1. */ -#ifndef NRFX_GRTC_CONFIG_AUTOEN -#define NRFX_GRTC_CONFIG_AUTOEN 0 +#ifndef NRFX_GRTC_CONFIG_AUTOSTART +#define NRFX_GRTC_CONFIG_AUTOSTART 0 #endif /** - * @brief NRFX_GRTC_CONFIG_AUTOSTART + * @brief NRFX_GRTC_CONFIG_CLEAR_AT_INIT * * Boolean. Accepted values: 0 and 1. */ -#ifndef NRFX_GRTC_CONFIG_AUTOSTART -#define NRFX_GRTC_CONFIG_AUTOSTART 0 +#ifndef NRFX_GRTC_CONFIG_CLEAR_AT_INIT +#define NRFX_GRTC_CONFIG_CLEAR_AT_INIT 0 #endif /** From 72ab376c24ff0e83665d2779ed95637127581a66 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 18 Sep 2024 15:54:21 +0200 Subject: [PATCH 0358/4482] modules: hal_nordic: nrfs: add support for nRF54H20 EngB Make nrfs compatible with the EngB soc revision. Signed-off-by: Gerard Marull-Paretas --- modules/hal_nordic/nrfs/Kconfig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/hal_nordic/nrfs/Kconfig b/modules/hal_nordic/nrfs/Kconfig index b027febd2a565..96d4c7f45cd6e 100644 --- a/modules/hal_nordic/nrfs/Kconfig +++ b/modules/hal_nordic/nrfs/Kconfig @@ -36,7 +36,12 @@ config NRFS_HAS_VBUS_DETECTOR_SERVICE config NRFS bool "nRF Services Support" - select NRFS_LOCAL_DOMAIN if (SOC_NRF54H20_CPUAPP || SOC_NRF54H20_CPURAD || SOC_NRF9280_CPUAPP || SOC_NRF9280_CPURAD) + select NRFS_LOCAL_DOMAIN if SOC_NRF54H20_CPUAPP || \ + SOC_NRF54H20_ENGB_CPUAPP || \ + SOC_NRF54H20_CPURAD || \ + SOC_NRF54H20_ENGB_CPURAD || \ + SOC_NRF9280_CPUAPP || \ + SOC_NRF9280_CPURAD depends on HAS_NRFS help This option enables the nRF Services library. From 5a4655f69fb2c006a4ee0ddcfe4372066b0cb138 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 1 Oct 2024 08:58:20 +0200 Subject: [PATCH 0359/4482] drivers: adc: nrfx_saadc: use CONFIG_NRF_PLATFORM_HALTIUM So that any Haltium based SoC uses the same settings, including nRF54H20 EngB. Signed-off-by: Gerard Marull-Paretas --- drivers/adc/adc_nrfx_saadc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index 052eab45b6ca5..132e8e78c3ed0 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -19,7 +19,7 @@ LOG_MODULE_REGISTER(adc_nrfx_saadc); #if (NRF_SAADC_HAS_AIN_AS_PIN) -#if defined(CONFIG_SOC_NRF54H20) || defined(CONFIG_SOC_NRF9280) +#if defined(CONFIG_NRF_PLATFORM_HALTIUM) static const uint8_t saadc_psels[NRF_SAADC_AIN7 + 1] = { [NRF_SAADC_AIN0] = NRF_PIN_PORT_TO_PIN_NUMBER(0U, 1), [NRF_SAADC_AIN1] = NRF_PIN_PORT_TO_PIN_NUMBER(1U, 1), From 091e38b3f29015cd5a489c348c61c1b3ab92347c Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 18 Sep 2024 15:54:55 +0200 Subject: [PATCH 0360/4482] scripts: west_commands: runners: nrf: add support for nRF54H20 EngB Make sure cpuapp/cpurad cores are detected correctly when using nRF54H20 EngB. Signed-off-by: Gerard Marull-Paretas --- scripts/west_commands/runners/nrf_common.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index 35f1f53b07f14..6423253233c12 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -259,8 +259,16 @@ def program_hex(self): if self.family in ('NRF54H_FAMILY', 'NRF92_FAMILY'): erase_arg = 'ERASE_NONE' - cpuapp = self.build_conf.getboolean('CONFIG_SOC_NRF54H20_CPUAPP') or self.build_conf.getboolean('CONFIG_SOC_NRF9280_CPUAPP') - cpurad = self.build_conf.getboolean('CONFIG_SOC_NRF54H20_CPURAD') or self.build_conf.getboolean('CONFIG_SOC_NRF9280_CPURAD') + cpuapp = ( + self.build_conf.getboolean('CONFIG_SOC_NRF54H20_CPUAPP') or + self.build_conf.getboolean('CONFIG_SOC_NRF54H20_ENGB_CPUAPP') or + self.build_conf.getboolean('CONFIG_SOC_NRF9280_CPUAPP') + ) + cpurad = ( + self.build_conf.getboolean('CONFIG_SOC_NRF54H20_CPURAD') or + self.build_conf.getboolean('CONFIG_SOC_NRF54H20_ENGB_CPURAD') or + self.build_conf.getboolean('CONFIG_SOC_NRF9280_CPURAD') + ) if self.erase: self.exec_op('erase', core='NRFDL_DEVICE_CORE_APPLICATION') From 47212de9de8ebdf27ac8a4cb1ab10fd8779a8834 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 18 Sep 2024 11:06:50 +0200 Subject: [PATCH 0361/4482] boards: nrf54h20dk: introduce revision 0.8.0 (current) The current DK is labeled as revision 0.8.0. Until now, no revisions were needed, but a new hardware spin is coming, so we'll need to keep at least two revisions in the near future until the final one becomes the default. Prepare the board for that scenario. Note that the "old" nRF54H20 SoC is now nRF54H20 EngB. Signed-off-by: Gerard Marull-Paretas --- boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk | 12 ++++++------ boards/nordic/nrf54h20dk/board.yml | 5 +++++ ...pp.yaml => nrf54h20dk_nrf54h20_cpuapp_0_8_0.yaml} | 4 ++-- ...r.yaml => nrf54h20dk_nrf54h20_cpuflpr_0_8_0.yaml} | 4 ++-- ...ml => nrf54h20dk_nrf54h20_cpuflpr_xip_0_8_0.yaml} | 4 ++-- ...pr.yaml => nrf54h20dk_nrf54h20_cpuppr_0_8_0.yaml} | 4 ++-- ...aml => nrf54h20dk_nrf54h20_cpuppr_xip_0_8_0.yaml} | 4 ++-- ...ad.yaml => nrf54h20dk_nrf54h20_cpurad_0_8_0.yaml} | 4 ++-- 8 files changed, 23 insertions(+), 18 deletions(-) rename boards/nordic/nrf54h20dk/{nrf54h20dk_nrf54h20_cpuapp.yaml => nrf54h20dk_nrf54h20_cpuapp_0_8_0.yaml} (73%) rename boards/nordic/nrf54h20dk/{nrf54h20dk_nrf54h20_cpuflpr.yaml => nrf54h20dk_nrf54h20_cpuflpr_0_8_0.yaml} (69%) rename boards/nordic/nrf54h20dk/{nrf54h20dk_nrf54h20_cpuflpr_xip.yaml => nrf54h20dk_nrf54h20_cpuflpr_xip_0_8_0.yaml} (62%) rename boards/nordic/nrf54h20dk/{nrf54h20dk_nrf54h20_cpuppr.yaml => nrf54h20dk_nrf54h20_cpuppr_0_8_0.yaml} (70%) rename boards/nordic/nrf54h20dk/{nrf54h20dk_nrf54h20_cpuppr_xip.yaml => nrf54h20dk_nrf54h20_cpuppr_xip_0_8_0.yaml} (62%) rename boards/nordic/nrf54h20dk/{nrf54h20dk_nrf54h20_cpurad.yaml => nrf54h20dk_nrf54h20_cpurad_0_8_0.yaml} (71%) diff --git a/boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk b/boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk index 9a260be486813..aa8c8edbe2dac 100644 --- a/boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk +++ b/boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk @@ -2,9 +2,9 @@ # SPDX-License-Identifier: Apache-2.0 config BOARD_NRF54H20DK - select SOC_NRF54H20_CPUAPP if BOARD_NRF54H20DK_NRF54H20_CPUAPP - select SOC_NRF54H20_CPURAD if BOARD_NRF54H20DK_NRF54H20_CPURAD - select SOC_NRF54H20_CPUPPR if BOARD_NRF54H20DK_NRF54H20_CPUPPR || \ - BOARD_NRF54H20DK_NRF54H20_CPUPPR_XIP - select SOC_NRF54H20_CPUFLPR if BOARD_NRF54H20DK_NRF54H20_CPUFLPR || \ - BOARD_NRF54H20DK_NRF54H20_CPUFLPR_XIP + select SOC_NRF54H20_ENGB_CPUAPP if BOARD_NRF54H20DK_NRF54H20_CPUAPP && BOARD_REVISION = "0.8.0" + select SOC_NRF54H20_ENGB_CPURAD if BOARD_NRF54H20DK_NRF54H20_CPURAD && BOARD_REVISION = "0.8.0" + select SOC_NRF54H20_ENGB_CPUPPR if (BOARD_NRF54H20DK_NRF54H20_CPUPPR || \ + BOARD_NRF54H20DK_NRF54H20_CPUPPR_XIP) && BOARD_REVISION = "0.8.0" + select SOC_NRF54H20_ENGB_CPUFLPR if (BOARD_NRF54H20DK_NRF54H20_CPUFLPR || \ + BOARD_NRF54H20DK_NRF54H20_CPUFLPR_XIP) && BOARD_REVISION = "0.8.0" diff --git a/boards/nordic/nrf54h20dk/board.yml b/boards/nordic/nrf54h20dk/board.yml index 61690145d9f83..29f1d78c436a2 100644 --- a/boards/nordic/nrf54h20dk/board.yml +++ b/boards/nordic/nrf54h20dk/board.yml @@ -8,3 +8,8 @@ board: cpucluster: cpuppr - name: xip cpucluster: cpuflpr + revision: + format: major.minor.patch + default: "0.8.0" + revisions: + - name: "0.8.0" diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_8_0.yaml similarity index 73% rename from boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml rename to boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_8_0.yaml index 1fb5a03987527..01c44b515777c 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_8_0.yaml @@ -1,8 +1,8 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -identifier: nrf54h20dk/nrf54h20/cpuapp -name: nRF54H20-DK-nRF54H20-Application +identifier: nrf54h20dk@0.8.0/nrf54h20/cpuapp +name: nRF54H20-DK-nRF54H20-Application (revision 0.8.0) type: mcu arch: arm toolchain: diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_8_0.yaml similarity index 69% rename from boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr.yaml rename to boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_8_0.yaml index ba7d9a93382c0..bd60b8d2af34b 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_8_0.yaml @@ -1,8 +1,8 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -identifier: nrf54h20dk/nrf54h20/cpuflpr -name: nRF54H20-DK-nRF54H20-FLPR +identifier: nrf54h20dk@0.8.0/nrf54h20/cpuflpr +name: nRF54H20-DK-nRF54H20-FLPR (revision 0.8.0) type: mcu arch: riscv toolchain: diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_xip.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_xip_0_8_0.yaml similarity index 62% rename from boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_xip.yaml rename to boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_xip_0_8_0.yaml index 63c771688b407..7deaf20135fd8 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_xip.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_xip_0_8_0.yaml @@ -1,8 +1,8 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -identifier: nrf54h20dk/nrf54h20/cpuflpr/xip -name: nRF54H20-DK-nRF54H20-FLPR (MRAM XIP) +identifier: nrf54h20dk@0.8.0/nrf54h20/cpuflpr/xip +name: nRF54H20-DK-nRF54H20-FLPR (MRAM XIP) (revision 0.8.0) type: mcu arch: riscv toolchain: diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_8_0.yaml similarity index 70% rename from boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.yaml rename to boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_8_0.yaml index db1bf4fbefe47..264126570702c 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_8_0.yaml @@ -1,8 +1,8 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -identifier: nrf54h20dk/nrf54h20/cpuppr -name: nRF54H20-DK-nRF54H20-PPR +identifier: nrf54h20dk@0.8.0/nrf54h20/cpuppr +name: nRF54H20-DK-nRF54H20-PPR (revision 0.8.0) type: mcu arch: riscv toolchain: diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_xip.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_xip_0_8_0.yaml similarity index 62% rename from boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_xip.yaml rename to boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_xip_0_8_0.yaml index 8cfc343647ff9..0ce1718cb60cb 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_xip.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_xip_0_8_0.yaml @@ -1,8 +1,8 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -identifier: nrf54h20dk/nrf54h20/cpuppr/xip -name: nRF54H20-DK-nRF54H20-PPR (MRAM XIP) +identifier: nrf54h20dk@0.8.0/nrf54h20/cpuppr/xip +name: nRF54H20-DK-nRF54H20-PPR (MRAM XIP) (revision 0.8.0) type: mcu arch: riscv toolchain: diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_8_0.yaml similarity index 71% rename from boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml rename to boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_8_0.yaml index 36c0fc01dce13..26df539a80376 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.yaml +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_8_0.yaml @@ -1,8 +1,8 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -identifier: nrf54h20dk/nrf54h20/cpurad -name: nRF54H20-DK-nRF54H20-Radio +identifier: nrf54h20dk@0.8.0/nrf54h20/cpurad +name: nRF54H20-DK-nRF54H20-Radio (revision 0.8.0) type: mcu arch: arm toolchain: From df9a84ea31773bbaf96278307d5ed222479b0c83 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 18 Sep 2024 11:14:57 +0200 Subject: [PATCH 0362/4482] boards: nrf54h20dk: add board revision 0.9.0 Add a new revision for nRF54H20 DK: 0.9.0. This new hardware spin contains the final nRF54H20 SoC. Treat it as the default, including twister. Signed-off-by: Gerard Marull-Paretas --- boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk | 6 +++++ boards/nordic/nrf54h20dk/board.yml | 3 ++- .../nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml | 24 +++++++++++++++++++ .../nrf54h20dk_nrf54h20_cpuflpr_0_9_0.yaml | 18 ++++++++++++++ ...nrf54h20dk_nrf54h20_cpuflpr_xip_0_9_0.yaml | 14 +++++++++++ .../nrf54h20dk_nrf54h20_cpuppr_0_9_0.yaml | 18 ++++++++++++++ .../nrf54h20dk_nrf54h20_cpuppr_xip_0_9_0.yaml | 14 +++++++++++ .../nrf54h20dk_nrf54h20_cpurad_0_9_0.yaml | 19 +++++++++++++++ 8 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_9_0.yaml create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_xip_0_9_0.yaml create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_9_0.yaml create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_xip_0_9_0.yaml create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_9_0.yaml diff --git a/boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk b/boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk index aa8c8edbe2dac..af29072fbd5ff 100644 --- a/boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk +++ b/boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk @@ -8,3 +8,9 @@ config BOARD_NRF54H20DK BOARD_NRF54H20DK_NRF54H20_CPUPPR_XIP) && BOARD_REVISION = "0.8.0" select SOC_NRF54H20_ENGB_CPUFLPR if (BOARD_NRF54H20DK_NRF54H20_CPUFLPR || \ BOARD_NRF54H20DK_NRF54H20_CPUFLPR_XIP) && BOARD_REVISION = "0.8.0" + select SOC_NRF54H20_CPUAPP if BOARD_NRF54H20DK_NRF54H20_CPUAPP && BOARD_REVISION = "0.9.0" + select SOC_NRF54H20_CPURAD if BOARD_NRF54H20DK_NRF54H20_CPURAD && BOARD_REVISION = "0.9.0" + select SOC_NRF54H20_CPUPPR if (BOARD_NRF54H20DK_NRF54H20_CPUPPR || \ + BOARD_NRF54H20DK_NRF54H20_CPUPPR_XIP) && BOARD_REVISION = "0.9.0" + select SOC_NRF54H20_CPUFLPR if (BOARD_NRF54H20DK_NRF54H20_CPUFLPR || \ + BOARD_NRF54H20DK_NRF54H20_CPUFLPR_XIP) && BOARD_REVISION = "0.9.0" diff --git a/boards/nordic/nrf54h20dk/board.yml b/boards/nordic/nrf54h20dk/board.yml index 29f1d78c436a2..7d57b61cd5300 100644 --- a/boards/nordic/nrf54h20dk/board.yml +++ b/boards/nordic/nrf54h20dk/board.yml @@ -10,6 +10,7 @@ board: cpucluster: cpuflpr revision: format: major.minor.patch - default: "0.8.0" + default: "0.9.0" revisions: - name: "0.8.0" + - name: "0.9.0" diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml new file mode 100644 index 0000000000000..89b8574654007 --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_9_0.yaml @@ -0,0 +1,24 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54h20dk/nrf54h20/cpuapp +name: nRF54H20-DK-nRF54H20-Application (revision 0.9.0) +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +sysbuild: true +ram: 256 +flash: 296 +supported: + - adc + - can + - counter + - gpio + - i2c + - pwm + - spi + - watchdog + - usbd diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_9_0.yaml new file mode 100644 index 0000000000000..ff9513fd593b6 --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_9_0.yaml @@ -0,0 +1,18 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54h20dk/nrf54h20/cpuflpr +name: nRF54H20-DK-nRF54H20-FLPR (revision 0.9.0) +type: mcu +arch: riscv +toolchain: + - zephyr +sysbuild: true +ram: 46 +flash: 46 +supported: + - counter + - gpio + - i2c + - pwm + - spi diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_xip_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_xip_0_9_0.yaml new file mode 100644 index 0000000000000..e2880af9be356 --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_xip_0_9_0.yaml @@ -0,0 +1,14 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54h20dk/nrf54h20/cpuflpr/xip +name: nRF54H20-DK-nRF54H20-FLPR (MRAM XIP) (revision 0.9.0) +type: mcu +arch: riscv +toolchain: + - zephyr +sysbuild: true +ram: 46 +flash: 48 +supported: + - gpio diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_9_0.yaml new file mode 100644 index 0000000000000..60f22350504dc --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_9_0.yaml @@ -0,0 +1,18 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54h20dk/nrf54h20/cpuppr +name: nRF54H20-DK-nRF54H20-PPR (revision 0.9.0) +type: mcu +arch: riscv +toolchain: + - zephyr +sysbuild: true +ram: 62 +flash: 62 +supported: + - counter + - gpio + - i2c + - pwm + - spi diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_xip_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_xip_0_9_0.yaml new file mode 100644 index 0000000000000..7198a379a9c95 --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_xip_0_9_0.yaml @@ -0,0 +1,14 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54h20dk/nrf54h20/cpuppr/xip +name: nRF54H20-DK-nRF54H20-PPR (MRAM XIP) (revision 0.9.0) +type: mcu +arch: riscv +toolchain: + - zephyr +sysbuild: true +ram: 62 +flash: 64 +supported: + - gpio diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_9_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_9_0.yaml new file mode 100644 index 0000000000000..818a8d74b7987 --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_9_0.yaml @@ -0,0 +1,19 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54h20dk/nrf54h20/cpurad +name: nRF54H20-DK-nRF54H20-Radio (revision 0.9.0) +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +sysbuild: true +ram: 192 +flash: 256 +supported: + - counter + - gpio + - pwm + - spi From d3ca4fd84fe25e243a9be92362e4103c8674f5e4 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 1 Oct 2024 09:00:37 +0200 Subject: [PATCH 0363/4482] tests: lib: cpp: cxx: ignore nRF54H20 DK 0.8.0 nRF54H HAL is not compatible with C++98, add new board revisions to the list so that they are skipped. Signed-off-by: Gerard Marull-Paretas --- tests/lib/cpp/cxx/testcase.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/lib/cpp/cxx/testcase.yaml b/tests/lib/cpp/cxx/testcase.yaml index 5601886b15047..642a2ed984da0 100644 --- a/tests/lib/cpp/cxx/testcase.yaml +++ b/tests/lib/cpp/cxx/testcase.yaml @@ -42,6 +42,8 @@ tests: - nrf54l20pdk/nrf54l20/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad + - nrf54h20dk@0.8.0/nrf54h20/cpuapp + - nrf54h20dk@0.8.0/nrf54h20/cpurad - nrf9280pdk/nrf9280/cpuapp - nrf9280pdk/nrf9280/cpurad filter: not CONFIG_HAS_RENESAS_RA_FSP From 626918588d11a73afa25dabbda65f341dcc72654 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Mon, 16 Sep 2024 23:50:34 +0700 Subject: [PATCH 0364/4482] drivers: serial: ra8_sci_b: revise switch-case in `callback_adapter` Unified switch-case usage in `uart_ra_sci_b_callback_adapter` to use `break` instead of `return`. Typically, a `break` is used in switch-case statements unless an early return is necessary, in which case `return` is appropriate. For this case, using a `break` statement is the more suitable choice. Signed-off-by: Pisit Sawangvonganan --- drivers/serial/uart_renesas_ra8_sci_b.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/serial/uart_renesas_ra8_sci_b.c b/drivers/serial/uart_renesas_ra8_sci_b.c index 3db0c32314a0b..1ea48e61b0d49 100644 --- a/drivers/serial/uart_renesas_ra8_sci_b.c +++ b/drivers/serial/uart_renesas_ra8_sci_b.c @@ -803,7 +803,7 @@ static void uart_ra_sci_b_callback_adapter(struct st_uart_callback_arg *fsp_args case UART_EVENT_TX_COMPLETE: { data->tx_buffer_len = data->tx_buffer_cap; async_update_tx_buffer(dev); - return; + break; } case UART_EVENT_RX_COMPLETE: { data->rx_buffer_len = @@ -811,16 +811,20 @@ static void uart_ra_sci_b_callback_adapter(struct st_uart_callback_arg *fsp_args async_rx_ready(dev); async_release_rx_buffer(dev); async_replace_rx_buffer(dev); - return; + break; } case UART_EVENT_ERR_PARITY: - return async_rx_error(dev, UART_ERROR_PARITY); + async_rx_error(dev, UART_ERROR_PARITY); + break; case UART_EVENT_ERR_FRAMING: - return async_rx_error(dev, UART_ERROR_FRAMING); + async_rx_error(dev, UART_ERROR_FRAMING); + break; case UART_EVENT_ERR_OVERFLOW: - return async_rx_error(dev, UART_ERROR_OVERRUN); + async_rx_error(dev, UART_ERROR_OVERRUN); + break; case UART_EVENT_BREAK_DETECT: - return async_rx_error(dev, UART_BREAK); + async_rx_error(dev, UART_BREAK); + break; case UART_EVENT_TX_DATA_EMPTY: case UART_EVENT_RX_CHAR: break; From 640a2ade8b3830024794f365038f959db527836c Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Mon, 16 Sep 2024 23:55:35 +0700 Subject: [PATCH 0365/4482] drivers: serial: ra8_sci_b: adjust `return` usage in `void functions` For code clarity, this commit adjusts the use of `return` statements in functions with a void return type by: - Remove unnecessary `return` statements when they don't affect control flow. Signed-off-by: Pisit Sawangvonganan --- drivers/serial/uart_renesas_ra8_sci_b.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/serial/uart_renesas_ra8_sci_b.c b/drivers/serial/uart_renesas_ra8_sci_b.c index 1ea48e61b0d49..5918966f18ea5 100644 --- a/drivers/serial/uart_renesas_ra8_sci_b.c +++ b/drivers/serial/uart_renesas_ra8_sci_b.c @@ -458,7 +458,7 @@ static inline void async_rx_disabled(const struct device *dev) struct uart_event event = { .type = UART_RX_DISABLED, }; - return async_user_callback(dev, &event); + async_user_callback(dev, &event); } static inline void async_request_rx_buffer(const struct device *dev) @@ -466,7 +466,7 @@ static inline void async_request_rx_buffer(const struct device *dev) struct uart_event event = { .type = UART_RX_BUF_REQUEST, }; - return async_user_callback(dev, &event); + async_user_callback(dev, &event); } static inline void async_rx_ready(const struct device *dev) From c2911af78e618dc17cc607775211d20ad26d624e Mon Sep 17 00:00:00 2001 From: Paul He Date: Wed, 11 Sep 2024 23:17:26 +0800 Subject: [PATCH 0366/4482] fs: littlefs: get block_cycles value from dts Property "block-cycles" is required for node "zephyr,fstab,littlefs", but source code did not get the value from dts file, now add it. Additionally correct the wrong description of property "block-cycles" in binding file. Signed-off-by: Paul He --- dts/bindings/fs/zephyr,fstab,littlefs.yaml | 2 +- subsys/fs/littlefs_fs.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dts/bindings/fs/zephyr,fstab,littlefs.yaml b/dts/bindings/fs/zephyr,fstab,littlefs.yaml index 519c1271e09c5..b557f4f83f389 100644 --- a/dts/bindings/fs/zephyr,fstab,littlefs.yaml +++ b/dts/bindings/fs/zephyr,fstab,littlefs.yaml @@ -75,4 +75,4 @@ properties: is moved to another block. Set to a non-positive value to disable leveling. - This corresponds to CONFIG_FS_LITTLEFS_LOOKAHEAD_SIZE. + This corresponds to CONFIG_FS_LITTLEFS_BLOCK_CYCLES. diff --git a/subsys/fs/littlefs_fs.c b/subsys/fs/littlefs_fs.c index 5989f856ac1f2..e183b2c7029b6 100644 --- a/subsys/fs/littlefs_fs.c +++ b/subsys/fs/littlefs_fs.c @@ -1061,6 +1061,7 @@ static struct fs_littlefs fs_data_##inst = { \ .prog_size = DT_INST_PROP(inst, prog_size), \ .cache_size = DT_INST_PROP(inst, cache_size), \ .lookahead_size = DT_INST_PROP(inst, lookahead_size), \ + .block_cycles = DT_INST_PROP(inst, block_cycles), \ .read_buffer = read_buffer_##inst, \ .prog_buffer = prog_buffer_##inst, \ .lookahead_buffer = lookahead_buffer_##inst, \ From 11ef521c60d7f48e035009763bd450f7dbe46791 Mon Sep 17 00:00:00 2001 From: Yangbo Lu Date: Tue, 24 Sep 2024 04:18:19 +0200 Subject: [PATCH 0367/4482] drivers: pwm_mcux_tpm: adapt to more platforms The TPM max channel number was got from register array size. However some platforms TPM instance may begin from TPM1 rather than TPM0. This should be handled in driver. Signed-off-by: Yangbo Lu --- drivers/pwm/pwm_mcux_tpm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pwm/pwm_mcux_tpm.c b/drivers/pwm/pwm_mcux_tpm.c index 8db2b8cf82d3d..d90686ef675fc 100644 --- a/drivers/pwm/pwm_mcux_tpm.c +++ b/drivers/pwm/pwm_mcux_tpm.c @@ -1,6 +1,6 @@ /* * Copyright 2019 Henrik Brix Andersen - * Copyright 2020 NXP + * Copyright 2020, 2024 NXP * * Heavily based on pwm_mcux_ftm.c, which is: * Copyright (c) 2017, NXP @@ -22,7 +22,11 @@ LOG_MODULE_REGISTER(pwm_mcux_tpm, CONFIG_PWM_LOG_LEVEL); +#if defined(TPM0) #define MAX_CHANNELS ARRAY_SIZE(TPM0->CONTROLS) +#else +#define MAX_CHANNELS ARRAY_SIZE(TPM1->CONTROLS) +#endif struct mcux_tpm_config { TPM_Type *base; From 6ac457fb8ecb7d75983162c2a2da00d736053773 Mon Sep 17 00:00:00 2001 From: Yangbo Lu Date: Fri, 27 Sep 2024 04:15:43 +0200 Subject: [PATCH 0368/4482] dts: arm: nxp_imx95_m7: add all TPM nodes Added all TPM nodes for nxp_imx95_m7. Signed-off-by: Yangbo Lu --- dts/arm/nxp/nxp_imx95_m7.dtsi | 54 +++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/dts/arm/nxp/nxp_imx95_m7.dtsi b/dts/arm/nxp/nxp_imx95_m7.dtsi index d786130936d11..ac532ee790b52 100644 --- a/dts/arm/nxp/nxp_imx95_m7.dtsi +++ b/dts/arm/nxp/nxp_imx95_m7.dtsi @@ -86,6 +86,42 @@ status = "disabled"; }; + tpm3: pwm@424e0000 { + compatible = "nxp,kinetis-tpm"; + reg = <0x424e0000 0x88>; + interrupts = <73 0>; + clocks = <&scmi_clk IMX95_CLK_BUSWAKEUP>; + status = "disabled"; + #pwm-cells = <3>; + }; + + tpm4: pwm@424f0000 { + compatible = "nxp,kinetis-tpm"; + reg = <0x424f0000 0x88>; + interrupts = <74 0>; + clocks = <&scmi_clk IMX95_CLK_TPM4>; + status = "disabled"; + #pwm-cells = <3>; + }; + + tpm5: pwm@42500000 { + compatible = "nxp,kinetis-tpm"; + reg = <0x42500000 0x88>; + interrupts = <75 0>; + clocks = <&scmi_clk IMX95_CLK_TPM5>; + status = "disabled"; + #pwm-cells = <3>; + }; + + tpm6: pwm@42510000 { + compatible = "nxp,kinetis-tpm"; + reg = <0x42510000 0x88>; + interrupts = <76 0>; + clocks = <&scmi_clk IMX95_CLK_TPM6>; + status = "disabled"; + #pwm-cells = <3>; + }; + lpi2c3: i2c@42530000 { compatible = "nxp,imx-lpi2c"; clock-frequency = ; @@ -213,6 +249,24 @@ status = "disabled"; }; + tpm1: pwm@44310000 { + compatible = "nxp,kinetis-tpm"; + reg = <0x44310000 0x88>; + interrupts = <29 0>; + clocks = <&scmi_clk IMX95_CLK_BUSAON>; + status = "disabled"; + #pwm-cells = <3>; + }; + + tpm2: pwm@44320000 { + compatible = "nxp,kinetis-tpm"; + reg = <0x44320000 0x88>; + interrupts = <30 0>; + clocks = <&scmi_clk IMX95_CLK_TPM2>; + status = "disabled"; + #pwm-cells = <3>; + }; + lpi2c1: i2c@44340000 { compatible = "nxp,imx-lpi2c"; clock-frequency = ; From 621681fabecb034bd1dc9b1927b7ac31c6b16c73 Mon Sep 17 00:00:00 2001 From: Yangbo Lu Date: Fri, 27 Sep 2024 04:16:39 +0200 Subject: [PATCH 0369/4482] boards: nxp: imx95_evk: add TPM2 pinmux support in dtsi Added TPM2 pinmux support in dtsi. Signed-off-by: Yangbo Lu --- boards/nxp/imx95_evk/imx95_evk-pinctrl.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/boards/nxp/imx95_evk/imx95_evk-pinctrl.dtsi b/boards/nxp/imx95_evk/imx95_evk-pinctrl.dtsi index e49c4dc172afb..fecd72a46f1a5 100644 --- a/boards/nxp/imx95_evk/imx95_evk-pinctrl.dtsi +++ b/boards/nxp/imx95_evk/imx95_evk-pinctrl.dtsi @@ -60,4 +60,15 @@ drive-strength = "x4"; }; }; + + tpm2_default: tpm2_default { + group0 { + pinmux = <&iomuxc_i2c2_scl_tpm_ch_tpm2_ch2>, + <&iomuxc_i2c2_sda_tpm_ch_tpm2_ch3>; + drive-open-drain; + slew-rate = "slightly_fast"; + drive-strength = "x4"; + input-enable; + }; + }; }; From dc734e19f9af57f7160c9966e863ae663fd28a9c Mon Sep 17 00:00:00 2001 From: Yangbo Lu Date: Tue, 24 Sep 2024 04:54:41 +0200 Subject: [PATCH 0370/4482] boards: nxp: imx95_evk: enable TPM2 PWM on M7 Enabled TPM2 for PWM on imx95_evk m7. Signed-off-by: Yangbo Lu --- boards/nxp/imx95_evk/doc/index.rst | 11 +++++++++++ boards/nxp/imx95_evk/imx95_evk_mimx9596_m7.dts | 6 ++++++ boards/nxp/imx95_evk/imx95_evk_mimx9596_m7.yaml | 1 + 3 files changed, 18 insertions(+) diff --git a/boards/nxp/imx95_evk/doc/index.rst b/boards/nxp/imx95_evk/doc/index.rst index 43048f39a3fb2..880e6da524701 100644 --- a/boards/nxp/imx95_evk/doc/index.rst +++ b/boards/nxp/imx95_evk/doc/index.rst @@ -93,6 +93,8 @@ The Zephyr ``imx95_evk/mimx9596/m7`` board target supports the following hardwar +-----------+------------+-------------------------------------+ | I2C | on-chip | i2c | +-----------+------------+-------------------------------------+ +| TPM | on-chip | tpm | ++-----------+------------+-------------------------------------+ The Zephyr ``imx95_evk/mimx9596/a55`` and ``imx95_evk/mimx9596/a55/smp`` board targets support the following hardware features: @@ -124,6 +126,15 @@ Serial Port This board configuration uses a single serial communication channel with the CPU's UART1 for Cortex-A55, UART3 for Cortex-M7. +TPM +--- + +Two channels are enabled on TPM2 for PWM for M7. Signals can be observerd with +oscilloscope. +Channel 2 signal routed to resistance R881. +Channel 3 signal routed to resistance R882. + + Programming and Debugging (A55) ******************************* diff --git a/boards/nxp/imx95_evk/imx95_evk_mimx9596_m7.dts b/boards/nxp/imx95_evk/imx95_evk_mimx9596_m7.dts index 8fa6ba6b17a06..ebc22540f8eef 100644 --- a/boards/nxp/imx95_evk/imx95_evk_mimx9596_m7.dts +++ b/boards/nxp/imx95_evk/imx95_evk_mimx9596_m7.dts @@ -46,3 +46,9 @@ pinctrl-0 = <&sai3_default>; pinctrl-names = "default"; }; + +&tpm2 { + pinctrl-0 = <&tpm2_default>; + pinctrl-names = "default"; + status = "okay"; +}; diff --git a/boards/nxp/imx95_evk/imx95_evk_mimx9596_m7.yaml b/boards/nxp/imx95_evk/imx95_evk_mimx9596_m7.yaml index 59e4e9bb63f5b..23fab0caeabb8 100644 --- a/boards/nxp/imx95_evk/imx95_evk_mimx9596_m7.yaml +++ b/boards/nxp/imx95_evk/imx95_evk_mimx9596_m7.yaml @@ -17,4 +17,5 @@ toolchain: supported: - uart - i2c + - pwm vendor: nxp From 0d49482b9fbfce3852173f7f138d751bdfb5cb49 Mon Sep 17 00:00:00 2001 From: Yangbo Lu Date: Tue, 24 Sep 2024 05:06:01 +0200 Subject: [PATCH 0371/4482] west.yml: update hal_nxp to the latest Updated hal_nxp to the latest. Signed-off-by: Yangbo Lu --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index fc2315ae551ba..e6b06fc71fab1 100644 --- a/west.yml +++ b/west.yml @@ -198,7 +198,7 @@ manifest: groups: - hal - name: hal_nxp - revision: adfa0bbba6f5d36352d387527bdc486616c9f521 + revision: 9702923eeb6f4a9ca063ca3b200324b118d3e843 path: modules/hal/nxp groups: - hal From fd103f2ccc594388483059ff43eb7b3ae865d297 Mon Sep 17 00:00:00 2001 From: Hou Zhiqiang Date: Thu, 26 Sep 2024 09:38:18 +0800 Subject: [PATCH 0372/4482] soc: nxp: imx95: fix indent of MMU entry Fix the indent of LPUARTs MMU setup entry. Signed-off-by: Hou Zhiqiang --- soc/nxp/imx/imx9/imx95/a55/mmu_regions.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soc/nxp/imx/imx9/imx95/a55/mmu_regions.c b/soc/nxp/imx/imx9/imx95/a55/mmu_regions.c index 0064dff4f1c80..d79f99e0ac64e 100644 --- a/soc/nxp/imx/imx9/imx95/a55/mmu_regions.c +++ b/soc/nxp/imx/imx9/imx95/a55/mmu_regions.c @@ -21,8 +21,8 @@ static const struct arm_mmu_region mmu_regions[] = { MMU_REGION_DT_COMPAT_FOREACH_FLAT_ENTRY(nxp_mbox_imx_mu, (MT_DEVICE_nGnRnE | MT_P_RW_U_NA | MT_NS)) - MMU_REGION_DT_COMPAT_FOREACH_FLAT_ENTRY(nxp_kinetis_lpuart, - (MT_DEVICE_nGnRnE | MT_P_RW_U_NA | MT_NS)) + MMU_REGION_DT_COMPAT_FOREACH_FLAT_ENTRY(nxp_kinetis_lpuart, + (MT_DEVICE_nGnRnE | MT_P_RW_U_NA | MT_NS)) }; From 8a1785b8aa2a5cb0d74c7e7f471a4b33996da92c Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Thu, 26 Sep 2024 01:12:21 +0300 Subject: [PATCH 0373/4482] soc: nxp: soc.yml: remove unsupported cpu clusters for imx8 socs Some imx8 socs have cpu cluster entries for cores that are not currently supported. Remove them. Fixes #79027. Signed-off-by: Laurentiu Mihalcea --- soc/nxp/imx/soc.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/soc/nxp/imx/soc.yml b/soc/nxp/imx/soc.yml index 72e4bba74e54a..64371b41c235f 100644 --- a/soc/nxp/imx/soc.yml +++ b/soc/nxp/imx/soc.yml @@ -6,23 +6,16 @@ family: - name: mimx8qm6 cpuclusters: - name: adsp - - name: a72 - - name: a53 - - name: m4 - name: imx8x socs: - name: mimx8qx6 cpuclusters: - name: adsp - - name: a35 - - name: m4 - name: imx8ulp socs: - name: mimx8ud7 cpuclusters: - name: adsp - - name: f1_dsp - - name: a35 - name: imx8m socs: - name: mimx8ml8 @@ -37,10 +30,8 @@ family: - name: mimx8mn6 cpuclusters: - name: a53 - - name: m7 - name: mimx8mq6 cpuclusters: - - name: a53 - name: m4 - name: imx9 socs: From 656012841862333fec478257985b9e268b2cc772 Mon Sep 17 00:00:00 2001 From: Peter Fecher Date: Tue, 27 Aug 2024 16:47:45 +0200 Subject: [PATCH 0374/4482] dts: arm: nxp: nxp_imx8m_m4: Add ECSPI devices Add device tree instances for ECSPI devices, update SoC code to enable clocks. Signed-off-by: Peter Fecher --- dts/arm/nxp/nxp_imx8m_m4.dtsi | 30 ++++++++++++++++++++++++++++++ soc/nxp/imx/imx8m/m4_mini/soc.c | 23 +++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/dts/arm/nxp/nxp_imx8m_m4.dtsi b/dts/arm/nxp/nxp_imx8m_m4.dtsi index 0e751b40e2f0e..3acbfba691373 100644 --- a/dts/arm/nxp/nxp_imx8m_m4.dtsi +++ b/dts/arm/nxp/nxp_imx8m_m4.dtsi @@ -136,6 +136,36 @@ #clock-cells = <3>; }; + ecspi1: spi@30820000 { + compatible = "nxp,imx-ecspi"; + reg = <0x30820000 DT_SIZE_K(64)>; + #address-cells = <1>; + #size-cells = <0>; + interrupts = <31 3>; + clocks = <&ccm IMX_CCM_ECSPI1_CLK 0 0>; + status = "disabled"; + }; + + ecspi2: spi@30830000 { + compatible = "nxp,imx-ecspi"; + reg = <0x30830000 DT_SIZE_K(64)>; + #address-cells = <1>; + #size-cells = <0>; + interrupts = <32 3>; + clocks = <&ccm IMX_CCM_ECSPI2_CLK 0 0>; + status = "disabled"; + }; + + ecspi3: spi@30840000 { + compatible = "nxp,imx-ecspi"; + reg = <0x30840000 DT_SIZE_K(64)>; + #address-cells = <1>; + #size-cells = <0>; + interrupts = <33 3>; + clocks = <&ccm IMX_CCM_ECSPI3_CLK 0 0>; + status = "disabled"; + }; + uart1: uart@30860000 { compatible = "nxp,imx-iuart"; reg = <0x30860000 0x10000>; diff --git a/soc/nxp/imx/imx8m/m4_mini/soc.c b/soc/nxp/imx/imx8m/m4_mini/soc.c index b809a900e11f4..e9404f7b17faf 100644 --- a/soc/nxp/imx/imx8m/m4_mini/soc.c +++ b/soc/nxp/imx/imx8m/m4_mini/soc.c @@ -128,6 +128,29 @@ static void SOC_ClockInit(void) /* Set root clock to 80MHZ/ 1= 80MHZ */ CLOCK_SetRootDivider(kCLOCK_RootUart4, 1U, 1U); #endif +#endif + +#if defined(CONFIG_SPI_MCUX_ECSPI) +#if DT_NODE_HAS_STATUS(DT_NODELABEL(ecspi1), okay) + /* Set ECSPI1 source to SYSTEM PLL1 800MHZ */ + CLOCK_SetRootMux(kCLOCK_RootEcspi1, kCLOCK_EcspiRootmuxSysPll1); + /* Set root clock to 800MHZ / 10 = 80MHZ */ + CLOCK_SetRootDivider(kCLOCK_RootEcspi1, 2U, 5U); +#endif + +#if DT_NODE_HAS_STATUS(DT_NODELABEL(ecspi2), okay) + /* Set ECSPI2 source to SYSTEM PLL1 800MHZ */ + CLOCK_SetRootMux(kCLOCK_RootEcspi2, kCLOCK_EcspiRootmuxSysPll1); + /* Set root clock to 800MHZ / 10 = 80MHZ */ + CLOCK_SetRootDivider(kCLOCK_RootEcspi2, 2U, 5U); +#endif + +#if DT_NODE_HAS_STATUS(DT_NODELABEL(ecspi3), okay) + /* Set ECSPI3 source to SYSTEM PLL1 800MHZ */ + CLOCK_SetRootMux(kCLOCK_RootEcspi3, kCLOCK_EcspiRootmuxSysPll1); + /* Set root clock to 800MHZ / 10 = 80MHZ */ + CLOCK_SetRootDivider(kCLOCK_RootEcspi3, 2U, 5U); +#endif #endif /* Enable RDC clock */ From c2d38a7e1743b5b23e30d04c5cc96aec4657e0ff Mon Sep 17 00:00:00 2001 From: Peter Fecher Date: Tue, 27 Aug 2024 16:54:06 +0200 Subject: [PATCH 0375/4482] boards: arm: phyboard_polis: configure spi and can Configures ECSPI devices in devicetree including connected mcp2518 (CAN FD). Configures pinctrl for board. Enables spi support in board files. Signed-off-by: Peter Fecher --- .../mimx8mm_phyboard_polis-pinctrl.dtsi | 41 ++++++++++++++++++- .../mimx8mm_phyboard_polis_mimx8mm6_m4.dts | 34 ++++++++++++++- .../mimx8mm_phyboard_polis_mimx8mm6_m4.yaml | 7 +++- 3 files changed, 79 insertions(+), 3 deletions(-) diff --git a/boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis-pinctrl.dtsi b/boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis-pinctrl.dtsi index 928908a616217..9ff9ed6936cb6 100644 --- a/boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis-pinctrl.dtsi +++ b/boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis-pinctrl.dtsi @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 PHYTEC Messtechnik GmbH + * Copyright (c) 2022-2024 PHYTEC Messtechnik GmbH * * SPDX-License-Identifier: Apache-2.0 */ @@ -46,4 +46,43 @@ drive-strength = "x6"; }; }; + + ecspi1_default: ecspi1_default { + group1 { + pinmux = <&iomuxc_ecspi1_miso_ecspi_miso_ecspi1_miso>, + <&iomuxc_ecspi1_mosi_ecspi_mosi_ecspi1_mosi>, + <&iomuxc_ecspi1_sclk_ecspi_sclk_ecspi1_sclk>; + slew-rate = "fast"; + drive-strength = "x6"; + }; + group2 { + pinmux = <&iomuxc_ecspi1_ss0_gpio_io_gpio5_io09>; + slew-rate = "fast"; + drive-strength = "x6"; + bias-pull-up; + }; + group3 { + pinmux = <&iomuxc_sd2_wp_gpio_io_gpio2_io20>; + slew-rate = "fast"; + drive-strength = "x6"; + bias-pull-up; + }; + }; + + ecspi2_default: ecspi2_default { + group1 { + pinmux = <&iomuxc_ecspi2_miso_ecspi_miso_ecspi2_miso>, + <&iomuxc_ecspi2_mosi_ecspi_mosi_ecspi2_mosi>, + <&iomuxc_ecspi2_sclk_ecspi_sclk_ecspi2_sclk>; + slew-rate = "fast"; + drive-strength = "x6"; + bias-pull-up; + }; + group2 { + pinmux = <&iomuxc_ecspi2_ss0_gpio_io_gpio5_io13>; + slew-rate = "fast"; + drive-strength = "x6"; + bias-pull-up; + }; + }; }; diff --git a/boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4.dts b/boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4.dts index 43879d81e252b..8352a8e9b6bda 100644 --- a/boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4.dts +++ b/boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4.dts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 PHYTEC Messtechnik GmbH + * Copyright (c) 2022-2024 PHYTEC Messtechnik GmbH * * SPDX-License-Identifier: Apache-2.0 */ @@ -26,6 +26,7 @@ zephyr,sram = &tcmu_sys; zephyr,console = &uart4; zephyr,shell-uart = &uart4; + zephyr,canbus = &mcp2518; }; leds { @@ -46,6 +47,37 @@ }; +&ecspi1 { + status = "disabled"; + pinctrl-0 = <&ecspi1_default>; + pinctrl-names = "default"; + /* first cs is for on board MCP2518, the second for SPI on expansion header */ + cs-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>, + <&gpio2 20 GPIO_ACTIVE_LOW>; + + /* CAN FD */ + mcp2518: mcp2518@0 { + compatible = "microchip,mcp251xfd"; + reg = <0>; + spi-max-frequency = <20000000>; + int-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>; + supply-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; + osc-freq = <40000000>; + status = "disabled"; + }; +}; + +/* + * TPM Module TI SLB9670 + * Currently there is no driver for the used module + */ +&ecspi2 { + status = "disabled"; + pinctrl-0 = <&ecspi2_default>; + pinctrl-names = "default"; + cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>; +}; + /* RS232 / RS485 pinheader on the board */ &uart1 { status = "disabled"; diff --git a/boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4.yaml b/boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4.yaml index 0125a4fa39950..d2ca6718e1eb8 100644 --- a/boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4.yaml +++ b/boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4.yaml @@ -1,5 +1,5 @@ # -# Copyright (c) 2020 PHYTEC Messtechnik GmbH +# Copyright (c) 2020-2024 PHYTEC Messtechnik GmbH # # SPDX-License-Identifier: Apache-2.0 # @@ -18,4 +18,9 @@ testing: ignore_tags: - net - bluetooth +supported: + - uart + - spi + - gpio + - can vendor: nxp From 0ac7f641b315da2e2c60247fc517ecf945b29552 Mon Sep 17 00:00:00 2001 From: Peter Fecher Date: Tue, 27 Aug 2024 16:56:28 +0200 Subject: [PATCH 0376/4482] tests: drivers: spi_loopback: Add phyboard_polis Adds the devicetree overlay and configuration for phyboard polis to the spi_loopback test. Signed-off-by: Peter Fecher --- .../mimx8mm_phyboard_polis_mimx8mm6_m4.conf | 7 +++++ ...mimx8mm_phyboard_polis_mimx8mm6_m4.overlay | 28 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 tests/drivers/spi/spi_loopback/boards/mimx8mm_phyboard_polis_mimx8mm6_m4.conf create mode 100644 tests/drivers/spi/spi_loopback/boards/mimx8mm_phyboard_polis_mimx8mm6_m4.overlay diff --git a/tests/drivers/spi/spi_loopback/boards/mimx8mm_phyboard_polis_mimx8mm6_m4.conf b/tests/drivers/spi/spi_loopback/boards/mimx8mm_phyboard_polis_mimx8mm6_m4.conf new file mode 100644 index 0000000000000..a9eb171dfb98d --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/mimx8mm_phyboard_polis_mimx8mm6_m4.conf @@ -0,0 +1,7 @@ +# +# Copyright (C) 2024 PHYTEC Messtechnik GmbH +# +# SPDX-License-Identifier: Apache-2.0 +# + +CONFIG_SPI_LOOPBACK_MODE_LOOP=y diff --git a/tests/drivers/spi/spi_loopback/boards/mimx8mm_phyboard_polis_mimx8mm6_m4.overlay b/tests/drivers/spi/spi_loopback/boards/mimx8mm_phyboard_polis_mimx8mm6_m4.overlay new file mode 100644 index 0000000000000..8097018d21a78 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/mimx8mm_phyboard_polis_mimx8mm6_m4.overlay @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2024 PHYTEC Messtechnik GmbH + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&ecspi1 { + status = "okay"; + + slow@0 { + compatible = "test-spi-loopback-slow"; + reg = <0>; + spi-max-frequency = <500000>; + }; + fast@0 { + compatible = "test-spi-loopback-fast"; + reg = <0>; + spi-max-frequency = <16000000>; + }; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio5 { + status = "okay"; +}; From 9f73988be0293950f2b622e0afdceb20f930ca96 Mon Sep 17 00:00:00 2001 From: Peter Fecher Date: Thu, 29 Aug 2024 11:59:58 +0200 Subject: [PATCH 0377/4482] boards: phytec: update phyboard_polis docs Updating PhyBOARD Polis docs after enabling ECSPI and CAN support on that board. Add additional information what to do if using Linux and Zephyr simultaneously. Signed-off-by: Peter Fecher --- .../mimx8mm_phyboard_polis/doc/index.rst | 89 ++++++++++++++++--- 1 file changed, 78 insertions(+), 11 deletions(-) diff --git a/boards/phytec/mimx8mm_phyboard_polis/doc/index.rst b/boards/phytec/mimx8mm_phyboard_polis/doc/index.rst index dc388d52c07a0..b159b5a1ab738 100644 --- a/boards/phytec/mimx8mm_phyboard_polis/doc/index.rst +++ b/boards/phytec/mimx8mm_phyboard_polis/doc/index.rst @@ -28,11 +28,11 @@ the phyCORE-i.MX 8M Mini/Nano. - 4GB - 128GB eMMC - 8MB - 128MB SPI NOR Flash - - microSD Interfacce + - microSD Interface - 4kB EEPROM - Wireless: - - WiFi: 802.11 b/g/n (ac) 2,4 GHz / 5 GHz + - WiFi: 802.11 b/g/n (ac) 2.4 GHz / 5 GHz - BLE 4.2 - USB: @@ -90,6 +90,10 @@ hardware features: | GPIO | on-chip | GPIO output | | | | GPIO input | +-----------+------------+-------------------------------------+ +| SPI | on-chip | ECSPI | ++-----------+------------+-------------------------------------+ +| CAN | MCP2518 | MCP2518 via ECSPI | ++-----------+------------+-------------------------------------+ The default configuration can be found in the defconfig file: :zephyr_file:`boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4_defconfig`. @@ -130,12 +134,27 @@ problems with the A53-Core because UART4 is only accessible from the M4-Core. On Boards with the version number 1532.1 UART4 isn't connected to the Debug USB. UART4 connects to pin 10(RX) and 12(TX) on the X8 pinheader. +SPI: +---- + +ECSPI is disabled by default. On phyBOARD Polis, the SoC's ECSPI3 is not +usable. +ECSPI1 is connected to the MCP2518 CAN controller with a chip select. +Another device can be connected via the expansion header (X8): +PIN 5, 6, 7, 8 (CS, MOSI, MISO, SCLK). +ECSPI2 is connected to the TPM module. Currently the TPM module is not +supported by Zephyr. + +.. note:: + Please note, that it is necessary to disable ECSPI1 in the Linux devicetree + before you can use it on the M4-Core with Zephyr. + See section "Disabling Interfaces in Linux" for more information. LEDs: ----- Zephyr has the 3-color status LED configured. The led0 alias (the standard -Zephyr led) is configured to be the blue led. The LED can also light up in red +Zephyr LED) is configured to be the blue LED. The LED can also light up in red and green. GPIO: @@ -144,7 +163,18 @@ GPIO: The pinmuxing for the GPIOs is the standard pinmuxing of the mimx8mm devicetree created by NXP. You can find it here: -:zephyr_file:`dts/arm/nxp/nxp_imx8m_m4.dtsi`. +CAN: +---- + +The MCP2518 is connected via ECSPI1. The CAN interface is disabled by default +to not interfere with Linux on the A53-Core. +If you want to use the CAN interface you need to disable ECSPI in the Linux +devicetree. + +.. warning:: + There is a bug in the MCP2518 driver that causes the enable pin of the + transceiver to be not set. This causes a ENETDOWN error when trying to send + a CAN frame. Receiving CAN frames in `listen-only` mode is possible. The Pinout of the PhyBOARD Polis can be found here: @@ -189,12 +219,7 @@ For more information about memory mapping see the At compilation time you have to choose which RAM will be used. This configuration is done in :zephyr_file:`boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4.dts` -with "zephyr,flash" (when CONFIG_XIP=y) and "zephyr,sram" properties. - -You also have to set XIP=n or edit the boards defconfig file, if you don't want -the TCM memory area to be used. You can find the defconf file here: - -:zephyr_file:`boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4_defconfig`. +with "zephyr,flash" and "zephyr,sram" properties. The following configurations are possible for the flash and sram chosen nodes to change the used memory area: @@ -211,6 +236,9 @@ to change the used memory area: - &ocram_sys - &ocram_s_sys +By default Zephyr is configured to use the TCM memory area and CONFIG_XIP is +disabled. If you want to use the OCRAM memory area you have to enable +CONFIG_XIP. Starting the M4-Core via U-Boot =============================== @@ -296,7 +324,7 @@ To debug efficiently you should use multiple terminals: (But its also possible to use ``west debug``) After connecting everything and building with west use this command while in -the directory of the program you build earlier to start a debug server: +the directory of the program you built earlier to start a debug server: .. code-block:: console @@ -321,6 +349,45 @@ target: The program can be debugged using standard gdb techniques. +Disabling Interfaces in Linux +============================= + +If Zephyr is used on the M4-Core while Linux runs on the A53-Core, it is +recommended to disable the Interfaces used by the M4-Core to avoid conflicts. +More simple interfaces can be enabled on both cores at the same time, for +example GPIO. If you do that, keep in mind that conflicts can still arise. + +For more complex interfaces like SPI it is necessary to disable them in the +Linux devicetree, otherwise Linux will probably crash in a panic, resetting +the SoC. +For example: disabling ECSPI1 in Linux to use it on the M4-Core with Zephyr: + +1. Create a new file called ``disable_spi.dts`` with the following content: + + .. code:: dts + + /dts-v1/; + /plugin/; + + / { + fragment@0 { + target = <&ecspi1>; + __overlay__ { + status = "disabled"; + }; + }; + }; + +2. Compile the file with the dtc compiler to a devicetree blob: + + .. code:: console + + $ dtc -@ -I dts -O dtb -o imx8mm-phyboard-polis-disable-spi.dtbo disable_spi.dts; + +3. Copy the compiled file to the boot partition of the target. +4. Add the filename to the ``/boot/bootenv.txt`` file at the end of the line. +5. Reboot the target, the SPI interface is now disabled in Linux. + .. _PHYTEC website: https://www.phytec.de/produkte/single-board-computer/phyboard-polis-imx8m-mini/ From 29e82d2f23b099ead21a045a869818e24552de87 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Mon, 7 Oct 2024 21:41:25 +0200 Subject: [PATCH 0378/4482] cmake: add linker_libraries.cmake for Cadence Xtensa linker Follow-up: #78320 Create linker_libraries.cmake for the Cadence Xtensa xt-ld linker to ensure correct linking of runtime and C libraries as well as correct link order. Signed-off-by: Torsten Rasmussen --- cmake/linker/xt-ld/linker_libraries.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 cmake/linker/xt-ld/linker_libraries.cmake diff --git a/cmake/linker/xt-ld/linker_libraries.cmake b/cmake/linker/xt-ld/linker_libraries.cmake new file mode 100644 index 0000000000000..64c185c74b42c --- /dev/null +++ b/cmake/linker/xt-ld/linker_libraries.cmake @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Nordic Semiconductor +# +# SPDX-License-Identifier: Apache-2.0 + +set_linker_property(NO_CREATE PROPERTY c_library "-lc") +set_linker_property(NO_CREATE PROPERTY rt_library "-lgcc") +set_linker_property(NO_CREATE PROPERTY c++_library "-lstdc++") +set_linker_property(PROPERTY link_order_library "c;rt") From 438fe6dbbaed2899a39fdd41b9c992e73b02c546 Mon Sep 17 00:00:00 2001 From: Sreeram Tatapudi Date: Thu, 3 Oct 2024 16:27:41 -0700 Subject: [PATCH 0379/4482] dts: infineon: cat1b: cyw20829: Reduce the default interrupt priority Having the lowest possible interrupt priority is causing the tests\arch\arm\arm_irq_zero_latency_levels test to fail. This test reserves 2 priority levels for the low latency interrupts. Since CYW20829 supports 3 interrupt bits, 6 becomes an invalid value when 2 levels are reserved for the low latency interrupts. Signed-off-by: Sreeram Tatapudi --- dts/arm/infineon/cat1b/cyw20829/cyw20829.dtsi | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/dts/arm/infineon/cat1b/cyw20829/cyw20829.dtsi b/dts/arm/infineon/cat1b/cyw20829/cyw20829.dtsi index c0a59722e2f8b..1b90d91b57842 100644 --- a/dts/arm/infineon/cat1b/cyw20829/cyw20829.dtsi +++ b/dts/arm/infineon/cat1b/cyw20829/cyw20829.dtsi @@ -39,14 +39,14 @@ hsiom: hsiom@40400000 { compatible = "infineon,cat1-hsiom"; reg = <0x40400000 0x4000>; - interrupts = <7 6>, <6 6>; + interrupts = <7 4>, <6 4>; status = "disabled"; }; gpio_prt0: gpio@40410000 { compatible = "infineon,cat1-gpio"; reg = <0x40410000 0x80>; - interrupts = <0 6>; + interrupts = <0 4>; gpio-controller; ngpios = <6>; status = "disabled"; @@ -55,7 +55,7 @@ gpio_prt1: gpio@40410080 { compatible = "infineon,cat1-gpio"; reg = <0x40410080 0x80>; - interrupts = <1 6>; + interrupts = <1 4>; gpio-controller; ngpios = <7>; status = "disabled"; @@ -64,7 +64,7 @@ gpio_prt2: gpio@40410100 { compatible = "infineon,cat1-gpio"; reg = <0x40410100 0x80>; - interrupts = <2 6>; + interrupts = <2 4>; gpio-controller; ngpios = <6>; status = "disabled"; @@ -73,7 +73,7 @@ gpio_prt3: gpio@40410180 { compatible = "infineon,cat1-gpio"; reg = <0x40410180 0x80>; - interrupts = <3 6>; + interrupts = <3 4>; gpio-controller; ngpios = <8>; status = "disabled"; @@ -82,7 +82,7 @@ gpio_prt4: gpio@40410200 { compatible = "infineon,cat1-gpio"; reg = <0x40410200 0x80>; - interrupts = <4 6>; + interrupts = <4 4>; gpio-controller; ngpios = <2>; status = "disabled"; @@ -91,7 +91,7 @@ gpio_prt5: gpio@40410280 { compatible = "infineon,cat1-gpio"; reg = <0x40410280 0x80>; - interrupts = <5 6>; + interrupts = <5 4>; gpio-controller; ngpios = <3>; status = "disabled"; @@ -108,96 +108,96 @@ scb0: scb@40590000 { compatible = "infineon,cat1-scb"; reg = <0x40590000 0xfd0>; - interrupts = <8 6>; + interrupts = <8 4>; status = "disabled"; }; scb1: scb@405a0000 { compatible = "infineon,cat1-scb"; reg = <0x405a0000 0xfd0>; - interrupts = <17 6>; + interrupts = <17 4>; status = "disabled"; }; scb2: scb@405b0000 { compatible = "infineon,cat1-scb"; reg = <0x405b0000 0xfd0>; - interrupts = <18 6>; + interrupts = <18 4>; status = "disabled"; }; watchdog0: watchdog@4020c000 { compatible = "infineon,cat1-watchdog"; reg = <0x4020c000 0x10>; - interrupts = <15 6>; + interrupts = <15 4>; status = "disabled"; }; mcwdt0: mcwdt@4020d000 { compatible = "infineon,cat1-lp-timer"; reg = <0x4020d000 0x40>; - interrupts = <9 6>; + interrupts = <9 4>; status = "disabled"; }; counter0_0: counter@404a0000 { compatible = "infineon,cat1-counter"; reg = <0x404a0000 0x80>; - interrupts = <42 6>; + interrupts = <42 4>; resolution = <32>; status = "disabled"; }; counter0_1: counter@404a0080 { compatible = "infineon,cat1-counter"; reg = <0x404a0080 0x80>; - interrupts = <43 6>; + interrupts = <43 4>; resolution = <32>; status = "disabled"; }; counter1_0: counter@404a8000 { compatible = "infineon,cat1-counter"; reg = <0x404a8000 0x80>; - interrupts = <44 6>; + interrupts = <44 4>; resolution = <16>; status = "disabled"; }; counter1_1: counter@404a8080 { compatible = "infineon,cat1-counter"; reg = <0x404a8080 0x80>; - interrupts = <45 6>; + interrupts = <45 4>; resolution = <16>; status = "disabled"; }; counter1_2: counter@404a8100 { compatible = "infineon,cat1-counter"; reg = <0x404a8100 0x80>; - interrupts = <46 6>; + interrupts = <46 4>; resolution = <16>; status = "disabled"; }; counter1_3: counter@404a8180 { compatible = "infineon,cat1-counter"; reg = <0x404a8180 0x80>; - interrupts = <47 6>; + interrupts = <47 4>; resolution = <16>; status = "disabled"; }; counter1_4: counter@404a8200 { compatible = "infineon,cat1-counter"; reg = <0x404a8200 0x80>; - interrupts = <48 6>; + interrupts = <48 4>; resolution = <16>; status = "disabled"; }; counter1_5: counter@404a8280 { compatible = "infineon,cat1-counter"; reg = <0x404a8280 0x80>; - interrupts = <49 6>; + interrupts = <49 4>; resolution = <16>; status = "disabled"; }; counter1_6: counter@404a8300 { compatible = "infineon,cat1-counter"; reg = <0x404a8300 0x80>; - interrupts = <50 6>; + interrupts = <50 4>; resolution = <16>; status = "disabled"; }; @@ -205,63 +205,63 @@ pwm0_0: pwm@404a0000 { compatible = "infineon,cat1-pwm"; reg = <0x404a0000 0x80>; - interrupts = <42 6>; + interrupts = <42 4>; resolution = <32>; status = "disabled"; }; pwm0_1: pwm@404a0080 { compatible = "infineon,cat1-pwm"; reg = <0x404a0080 0x80>; - interrupts = <43 6>; + interrupts = <43 4>; resolution = <32>; status = "disabled"; }; pwm1_0: pwm@404a8000 { compatible = "infineon,cat1-pwm"; reg = <0x404a8000 0x80>; - interrupts = <44 6>; + interrupts = <44 4>; resolution = <16>; status = "disabled"; }; pwm1_1: pwm@404a8080 { compatible = "infineon,cat1-pwm"; reg = <0x404a8080 0x80>; - interrupts = <45 6>; + interrupts = <45 4>; resolution = <16>; status = "disabled"; }; pwm1_2: pwm@404a8100 { compatible = "infineon,cat1-pwm"; reg = <0x404a8100 0x80>; - interrupts = <46 6>; + interrupts = <46 4>; resolution = <16>; status = "disabled"; }; pwm1_3: pwm@404a8180 { compatible = "infineon,cat1-pwm"; reg = <0x404a8180 0x80>; - interrupts = <47 6>; + interrupts = <47 4>; resolution = <16>; status = "disabled"; }; pwm1_4: pwm@404a8200 { compatible = "infineon,cat1-pwm"; reg = <0x404a8200 0x80>; - interrupts = <48 6>; + interrupts = <48 4>; resolution = <16>; status = "disabled"; }; pwm1_5: pwm@404a8280 { compatible = "infineon,cat1-pwm"; reg = <0x404a8280 0x80>; - interrupts = <49 6>; + interrupts = <49 4>; resolution = <16>; status = "disabled"; }; pwm1_6: pwm@404a8300 { compatible = "infineon,cat1-pwm"; reg = <0x404a8300 0x80>; - interrupts = <50 6>; + interrupts = <50 4>; resolution = <16>; status = "disabled"; }; @@ -271,28 +271,28 @@ compatible = "infineon,cat1-dma"; reg = <0x40180000 0x10000>; dma-channels = <16>; - interrupts = <19 6>, /* CH0 */ - <20 6>, /* CH1 */ - <21 6>, /* CH2 */ - <22 6>, /* CH3 */ - <23 6>, /* CH4 */ - <24 6>, /* CH5 */ - <25 6>, /* CH6 */ - <26 6>, /* CH7 */ - <27 6>, /* CH8 */ - <28 6>, /* CH9 */ - <29 6>, /* CH10 */ - <30 6>, /* CH11 */ - <31 6>, /* CH12 */ - <32 6>, /* CH13 */ - <33 6>, /* CH14 */ - <34 6>; /* CH15 */ + interrupts = <19 4>, /* CH0 */ + <20 4>, /* CH1 */ + <21 4>, /* CH2 */ + <22 4>, /* CH3 */ + <23 4>, /* CH4 */ + <24 4>, /* CH5 */ + <25 4>, /* CH6 */ + <26 4>, /* CH7 */ + <27 4>, /* CH8 */ + <28 4>, /* CH9 */ + <29 4>, /* CH10 */ + <30 4>, /* CH11 */ + <31 4>, /* CH12 */ + <32 4>, /* CH13 */ + <33 4>, /* CH14 */ + <34 4>; /* CH15 */ status = "disabled"; }; bluetooth: btss@42000000 { compatible = "infineon,cyw208xx-hci"; reg = <0x42000000 0x6186A0>; - interrupts = <16 6>; + interrupts = <16 4>; status = "disabled"; }; From 1b8158b212562ede4417a47c3cbae2e5b426e43a Mon Sep 17 00:00:00 2001 From: Vaishnav Achath Date: Fri, 4 Oct 2024 02:30:11 +0530 Subject: [PATCH 0380/4482] soc: ti: k3: am6x: Fix AM62X M4 RAT initialisation Commit b73c5578e356 ("soc: ti: move init code from SYS_INIT to hooks") changed SYS_INIT to init hooks. For AM6x M4 target soc_prep_hook() was added by mistake instead of soc_early_init_hook(), the platform needs RAT translation initialized before any other operation and the platform failed to boot with this change, fix this by replacing with soc_early_init_hook() Signed-off-by: Vaishnav Achath --- soc/ti/k3/am6x/Kconfig | 2 +- soc/ti/k3/am6x/m4/soc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/soc/ti/k3/am6x/Kconfig b/soc/ti/k3/am6x/Kconfig index 39eaf92c85820..76fd90d457d16 100644 --- a/soc/ti/k3/am6x/Kconfig +++ b/soc/ti/k3/am6x/Kconfig @@ -17,7 +17,7 @@ config SOC_SERIES_AM6X_M4 select EXTERNAL_ADDRESS_TRANSLATION select MM_DRV select MM_TI_RAT - select SOC_PREP_HOOK + select SOC_EARLY_INIT_HOOK config SOC_PART_NUMBER default "AM6234" if SOC_AM6234_A53 diff --git a/soc/ti/k3/am6x/m4/soc.c b/soc/ti/k3/am6x/m4/soc.c index 519a3fab21b60..f3d5e330071e9 100644 --- a/soc/ti/k3/am6x/m4/soc.c +++ b/soc/ti/k3/am6x/m4/soc.c @@ -62,7 +62,7 @@ static void am6x_mmr_unlock(void) sys_write32(KICK1_UNLOCK_VAL, kickAddr); /* KICK 1 */ } -void soc_prep_hook(void) +void soc_early_init_hook(void) { sys_mm_drv_ti_rat_init(am6x_region_config, ADDR_TRANSLATE_RAT_BASE_ADDR, ARRAY_SIZE(am6x_region_config)); From bccaeb9c16373cb00525890d56d1d0465cc535ff Mon Sep 17 00:00:00 2001 From: Rafael Laya Date: Wed, 2 Oct 2024 20:41:37 -0700 Subject: [PATCH 0381/4482] drivers: Support Fast Plus Mode in I2C Designware Adds the right clock settings for Fast Plus Mode in the i2c Designware driver which the original author left as a TODO. Similarly, I lack the hardware to test high-speed mode, and so that mode remains not well supported. Signed-off-by: Rafael Laya --- drivers/i2c/i2c_dw.c | 27 +++++++++++++++++++++++++-- drivers/i2c/i2c_dw.h | 8 +++++--- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/i2c_dw.c b/drivers/i2c/i2c_dw.c index 1981df2eee167..aca7afefc1cf1 100644 --- a/drivers/i2c/i2c_dw.c +++ b/drivers/i2c/i2c_dw.c @@ -785,8 +785,6 @@ static int i2c_dw_runtime_configure(const struct device *dev, uint32_t config) dw->hcnt = value; break; case I2C_SPEED_FAST: - __fallthrough; - case I2C_SPEED_FAST_PLUS: /* * Following the directions on DW spec page 59, IC_FS_SCL_LCNT * must have register values larger than IC_FS_SPKLEN + 7 @@ -809,6 +807,31 @@ static int i2c_dw_runtime_configure(const struct device *dev, uint32_t config) value = I2C_FS_HCNT; } + dw->hcnt = value; + break; + case I2C_SPEED_FAST_PLUS: + /* + * Following the directions on DW spec page 59, IC_FS_SCL_LCNT + * must have register values larger than IC_FS_SPKLEN + 7 + */ + if (I2C_FSP_LCNT <= (read_fs_spklen(reg_base) + 7)) { + value = read_fs_spklen(reg_base) + 8; + } else { + value = I2C_FSP_LCNT; + } + + dw->lcnt = value; + + /* + * Following the directions on DW spec page 59, IC_FS_SCL_HCNT + * must have register values larger than IC_FS_SPKLEN + 5 + */ + if (I2C_FSP_HCNT <= (read_fs_spklen(reg_base) + 5)) { + value = read_fs_spklen(reg_base) + 6; + } else { + value = I2C_FSP_HCNT; + } + dw->hcnt = value; break; case I2C_SPEED_HIGH: diff --git a/drivers/i2c/i2c_dw.h b/drivers/i2c/i2c_dw.h index c25246bbafe8a..126017a212b71 100644 --- a/drivers/i2c/i2c_dw.h +++ b/drivers/i2c/i2c_dw.h @@ -63,11 +63,13 @@ typedef void (*i2c_isr_cb_t)(const struct device *port); /* IC_CON Low count and high count default values */ -/* TODO verify values for high and fast speed */ -#define I2C_STD_HCNT (CONFIG_I2C_DW_CLOCK_SPEED * 4) -#define I2C_STD_LCNT (CONFIG_I2C_DW_CLOCK_SPEED * 5) +/* TODO verify values for high speed */ +#define I2C_STD_HCNT (CONFIG_I2C_DW_CLOCK_SPEED * 4) +#define I2C_STD_LCNT (CONFIG_I2C_DW_CLOCK_SPEED * 5) #define I2C_FS_HCNT ((CONFIG_I2C_DW_CLOCK_SPEED * 6) / 8) #define I2C_FS_LCNT ((CONFIG_I2C_DW_CLOCK_SPEED * 7) / 8) +#define I2C_FSP_HCNT ((CONFIG_I2C_DW_CLOCK_SPEED * 2) / 8) +#define I2C_FSP_LCNT ((CONFIG_I2C_DW_CLOCK_SPEED * 2) / 8) #define I2C_HS_HCNT ((CONFIG_I2C_DW_CLOCK_SPEED * 6) / 8) #define I2C_HS_LCNT ((CONFIG_I2C_DW_CLOCK_SPEED * 7) / 8) From 626174e982d4f4c9ca7bdc94542cece91a95e2d3 Mon Sep 17 00:00:00 2001 From: Rafael Laya Date: Sun, 6 Oct 2024 12:19:34 -0700 Subject: [PATCH 0382/4482] drivers: i2c: Designware IP clang format pass To reduce lint warnings during code review, it is best to keep clang-format happy This commit makes a lint pass to this driver Signed-off-by: Rafael Laya --- drivers/i2c/i2c_dw.c | 223 +++++++++++++---------------- drivers/i2c/i2c_dw.h | 151 +++++++++----------- drivers/i2c/i2c_dw_registers.h | 253 ++++++++++++++++----------------- 3 files changed, 292 insertions(+), 335 deletions(-) diff --git a/drivers/i2c/i2c_dw.c b/drivers/i2c/i2c_dw.c index aca7afefc1cf1..5d274dcf0adcd 100644 --- a/drivers/i2c/i2c_dw.c +++ b/drivers/i2c/i2c_dw.c @@ -70,11 +70,10 @@ void i2c_dw_enable_idma(const struct device *dev, bool enable) } } -void cb_i2c_idma_transfer(const struct device *dma, void *user_data, - uint32_t channel, int status) +void cb_i2c_idma_transfer(const struct device *dma, void *user_data, uint32_t channel, int status) { const struct device *dev = (const struct device *)user_data; - const struct i2c_dw_rom_config * const rom = dev->config; + const struct i2c_dw_rom_config *const rom = dev->config; struct i2c_dw_dev_config *const dw = dev->data; dma_stop(rom->dma_dev, channel); @@ -99,20 +98,20 @@ inline void *i2c_dw_dr_phy_addr(const struct device *dev) { struct i2c_dw_dev_config *const dw = dev->data; - return (void *) (dw->phy_addr + DW_IC_REG_DATA_CMD); + return (void *)(dw->phy_addr + DW_IC_REG_DATA_CMD); } int32_t i2c_dw_idma_rx_transfer(const struct device *dev) { struct i2c_dw_dev_config *const dw = dev->data; - const struct i2c_dw_rom_config * const rom = dev->config; + const struct i2c_dw_rom_config *const rom = dev->config; - struct dma_config dma_cfg = { 0 }; - struct dma_block_config dma_block_cfg = { 0 }; + struct dma_config dma_cfg = {0}; + struct dma_block_config dma_block_cfg = {0}; if (!device_is_ready(rom->dma_dev)) { LOG_DBG("DMA device is not ready"); - return -ENODEV; + return -ENODEV; } dma_cfg.dma_slot = 1U; @@ -135,12 +134,12 @@ int32_t i2c_dw_idma_rx_transfer(const struct device *dev) if (dma_config(rom->dma_dev, DMA_INTEL_LPSS_RX_CHAN, &dma_cfg)) { LOG_DBG("Error transfer"); - return -EIO; + return -EIO; } if (dma_start(rom->dma_dev, DMA_INTEL_LPSS_RX_CHAN)) { LOG_DBG("Error transfer"); - return -EIO; + return -EIO; } i2c_dw_enable_idma(dev, true); @@ -149,18 +148,17 @@ int32_t i2c_dw_idma_rx_transfer(const struct device *dev) return 0; } -int32_t i2c_dw_idma_tx_transfer(const struct device *dev, - uint64_t data) +int32_t i2c_dw_idma_tx_transfer(const struct device *dev, uint64_t data) { - const struct i2c_dw_rom_config * const rom = dev->config; + const struct i2c_dw_rom_config *const rom = dev->config; struct i2c_dw_dev_config *const dw = dev->data; - struct dma_config dma_cfg = { 0 }; - struct dma_block_config dma_block_cfg = { 0 }; + struct dma_config dma_cfg = {0}; + struct dma_block_config dma_block_cfg = {0}; if (!device_is_ready(rom->dma_dev)) { LOG_DBG("DMA device is not ready"); - return -ENODEV; + return -ENODEV; } dma_cfg.dma_slot = 0U; @@ -183,12 +181,12 @@ int32_t i2c_dw_idma_tx_transfer(const struct device *dev, if (dma_config(rom->dma_dev, DMA_INTEL_LPSS_TX_CHAN, &dma_cfg)) { LOG_DBG("Error transfer"); - return -EIO; + return -EIO; } if (dma_start(rom->dma_dev, DMA_INTEL_LPSS_TX_CHAN)) { LOG_DBG("Error transfer"); - return -EIO; + return -EIO; } i2c_dw_enable_idma(dev, true); i2c_dw_set_fifo_th(dev, 1); @@ -199,7 +197,7 @@ int32_t i2c_dw_idma_tx_transfer(const struct device *dev, static inline void i2c_dw_data_ask(const struct device *dev) { - struct i2c_dw_dev_config * const dw = dev->data; + struct i2c_dw_dev_config *const dw = dev->data; uint32_t data; int tx_empty; int rx_empty; @@ -247,8 +245,7 @@ static inline void i2c_dw_data_ask(const struct device *dev) } /* After receiving the last byte, send STOP if needed */ - if ((dw->xfr_flags & I2C_MSG_STOP) - && (dw->request_bytes == 1U)) { + if ((dw->xfr_flags & I2C_MSG_STOP) && (dw->request_bytes == 1U)) { data |= IC_DATA_CMD_STOP; } @@ -262,12 +259,11 @@ static inline void i2c_dw_data_ask(const struct device *dev) dw->request_bytes--; cnt--; } - } static void i2c_dw_data_read(const struct device *dev) { - struct i2c_dw_dev_config * const dw = dev->data; + struct i2c_dw_dev_config *const dw = dev->data; uint32_t reg_base = get_regs(dev); #ifdef CONFIG_I2C_DW_LPSS_DMA @@ -296,10 +292,9 @@ static void i2c_dw_data_read(const struct device *dev) } } - static int i2c_dw_data_send(const struct device *dev) { - struct i2c_dw_dev_config * const dw = dev->data; + struct i2c_dw_dev_config *const dw = dev->data; uint32_t data = 0U; uint32_t reg_base = get_regs(dev); @@ -345,7 +340,7 @@ static int i2c_dw_data_send(const struct device *dev) static inline void i2c_dw_transfer_complete(const struct device *dev) { - struct i2c_dw_dev_config * const dw = dev->data; + struct i2c_dw_dev_config *const dw = dev->data; uint32_t value; uint32_t reg_base = get_regs(dev); @@ -363,7 +358,7 @@ static void i2c_dw_slave_read_clear_intr_bits(const struct device *dev); static void i2c_dw_isr(const struct device *port) { - struct i2c_dw_dev_config * const dw = port->data; + struct i2c_dw_dev_config *const dw = port->data; union ic_interrupt_register intr_stat; uint32_t value; int ret = 0; @@ -395,16 +390,15 @@ static void i2c_dw_isr(const struct device *port) uint32_t stat = sys_read32(reg_base + IDMA_REG_INTR_STS); if (stat & IDMA_TX_RX_CHAN_MASK) { - const struct i2c_dw_rom_config * const rom = port->config; + const struct i2c_dw_rom_config *const rom = port->config; /* Handle the DMA interrupt */ dma_intel_lpss_isr(rom->dma_dev); - } #endif /* Bail early if there is any error. */ - if ((DW_INTR_STAT_TX_ABRT | DW_INTR_STAT_TX_OVER | - DW_INTR_STAT_RX_OVER | DW_INTR_STAT_RX_UNDER) & + if ((DW_INTR_STAT_TX_ABRT | DW_INTR_STAT_TX_OVER | DW_INTR_STAT_RX_OVER | + DW_INTR_STAT_RX_UNDER) & intr_stat.raw) { dw->state = I2C_DW_CMD_ERROR; goto done; @@ -420,15 +414,13 @@ static void i2c_dw_isr(const struct device *port) * TX FIFO also serves as command queue where read requests * are written to TX FIFO. */ - if ((dw->xfr_flags & I2C_MSG_RW_MASK) - == I2C_MSG_READ) { + if ((dw->xfr_flags & I2C_MSG_RW_MASK) == I2C_MSG_READ) { set_bit_intr_mask_tx_empty(reg_base); } #endif /* CONFIG_I2C_TARGET */ if (intr_stat.bits.tx_empty) { - if ((dw->xfr_flags & I2C_MSG_RW_MASK) - == I2C_MSG_WRITE) { + if ((dw->xfr_flags & I2C_MSG_RW_MASK) == I2C_MSG_WRITE) { ret = i2c_dw_data_send(port); } else { i2c_dw_data_ask(port); @@ -437,12 +429,10 @@ static void i2c_dw_isr(const struct device *port) /* If STOP is not expected, finish processing this * message if there is nothing left to do anymore. */ - if (((dw->xfr_len == 0U) - && !(dw->xfr_flags & I2C_MSG_STOP)) - || (ret != 0)) { + if (((dw->xfr_len == 0U) && !(dw->xfr_flags & I2C_MSG_STOP)) || + (ret != 0)) { goto done; } - } /* STOP detected: finish processing this message */ @@ -497,10 +487,9 @@ static void i2c_dw_isr(const struct device *port) i2c_dw_transfer_complete(port); } - static int i2c_dw_setup(const struct device *dev, uint16_t slave_address) { - struct i2c_dw_dev_config * const dw = dev->data; + struct i2c_dw_dev_config *const dw = dev->data; uint32_t value; union ic_con_register ic_con; union ic_tar_register ic_tar; @@ -625,11 +614,10 @@ static int i2c_dw_setup(const struct device *dev, uint16_t slave_address) return 0; } -static int i2c_dw_transfer(const struct device *dev, - struct i2c_msg *msgs, uint8_t num_msgs, +static int i2c_dw_transfer(const struct device *dev, struct i2c_msg *msgs, uint8_t num_msgs, uint16_t slave_address) { - struct i2c_dw_dev_config * const dw = dev->data; + struct i2c_dw_dev_config *const dw = dev->data; struct i2c_msg *cur_msg = msgs; uint8_t msg_left = num_msgs; uint8_t pflags; @@ -677,7 +665,7 @@ static int i2c_dw_transfer(const struct device *dev, */ pm_device_busy_set(dev); - /* Process all the messages */ + /* Process all the messages */ while (msg_left > 0) { /* Workaround for I2C scanner as DW HW does not support 0 byte transfers.*/ if ((cur_msg->len == 0) && (cur_msg->buf != NULL)) { @@ -692,8 +680,7 @@ static int i2c_dw_transfer(const struct device *dev, dw->rx_pending = 0U; /* Need to RESTART if changing transfer direction */ - if ((pflags & I2C_MSG_RW_MASK) - != (dw->xfr_flags & I2C_MSG_RW_MASK)) { + if ((pflags & I2C_MSG_RW_MASK) != (dw->xfr_flags & I2C_MSG_RW_MASK)) { dw->xfr_flags |= I2C_MSG_RESTART; } @@ -710,8 +697,8 @@ static int i2c_dw_transfer(const struct device *dev, /* Enable interrupts to trigger ISR */ if (test_bit_con_master_mode(reg_base)) { /* Enable necessary interrupts */ - write_intr_mask((DW_ENABLE_TX_INT_I2C_MASTER | - DW_ENABLE_RX_INT_I2C_MASTER), reg_base); + write_intr_mask((DW_ENABLE_TX_INT_I2C_MASTER | DW_ENABLE_RX_INT_I2C_MASTER), + reg_base); } else { /* Enable necessary interrupts */ write_intr_mask(DW_ENABLE_TX_INT_I2C_SLAVE, reg_base); @@ -751,9 +738,9 @@ static int i2c_dw_transfer(const struct device *dev, static int i2c_dw_runtime_configure(const struct device *dev, uint32_t config) { - struct i2c_dw_dev_config * const dw = dev->data; - uint32_t value = 0U; - uint32_t rc = 0U; + struct i2c_dw_dev_config *const dw = dev->data; + uint32_t value = 0U; + uint32_t rc = 0U; uint32_t reg_base = get_regs(dev); dw->app_config = config; @@ -950,27 +937,24 @@ static int i2c_dw_set_slave_mode(const struct device *dev, uint8_t addr) return 0; } -static int i2c_dw_slave_register(const struct device *dev, - struct i2c_target_config *cfg) +static int i2c_dw_slave_register(const struct device *dev, struct i2c_target_config *cfg) { - struct i2c_dw_dev_config * const dw = dev->data; + struct i2c_dw_dev_config *const dw = dev->data; uint32_t reg_base = get_regs(dev); int ret; dw->slave_cfg = cfg; ret = i2c_dw_set_slave_mode(dev, cfg->address); - write_intr_mask(DW_INTR_MASK_RX_FULL | - DW_INTR_MASK_RD_REQ | - DW_INTR_MASK_TX_ABRT | - DW_INTR_MASK_STOP_DET, reg_base); + write_intr_mask(DW_INTR_MASK_RX_FULL | DW_INTR_MASK_RD_REQ | DW_INTR_MASK_TX_ABRT | + DW_INTR_MASK_STOP_DET, + reg_base); return ret; } -static int i2c_dw_slave_unregister(const struct device *dev, - struct i2c_target_config *cfg) +static int i2c_dw_slave_unregister(const struct device *dev, struct i2c_target_config *cfg) { - struct i2c_dw_dev_config * const dw = dev->data; + struct i2c_dw_dev_config *const dw = dev->data; int ret; dw->state = I2C_DW_STATE_READY; @@ -981,7 +965,7 @@ static int i2c_dw_slave_unregister(const struct device *dev, static void i2c_dw_slave_read_clear_intr_bits(const struct device *dev) { - struct i2c_dw_dev_config * const dw = dev->data; + struct i2c_dw_dev_config *const dw = dev->data; union ic_interrupt_register intr_stat; uint32_t reg_base = get_regs(dev); @@ -1053,8 +1037,8 @@ static const struct i2c_driver_api funcs = { static int i2c_dw_initialize(const struct device *dev) { - const struct i2c_dw_rom_config * const rom = dev->config; - struct i2c_dw_dev_config * const dw = dev->data; + const struct i2c_dw_rom_config *const rom = dev->config; + struct i2c_dw_dev_config *const dw = dev->data; union ic_con_register ic_con; int ret = 0; @@ -1085,8 +1069,7 @@ static int i2c_dw_initialize(const struct device *dev) pcie_probe_mbar(rom->pcie->bdf, 0, &mbar); pcie_set_cmd(rom->pcie->bdf, PCIE_CONF_CMDSTAT_MEM, true); - device_map(DEVICE_MMIO_RAM_PTR(dev), mbar.phys_addr, - mbar.size, K_MEM_CACHE_NONE); + device_map(DEVICE_MMIO_RAM_PTR(dev), mbar.phys_addr, mbar.size, K_MEM_CACHE_NONE); pcie_set_cmd(rom->pcie->bdf, PCIE_CONF_CMDSTAT_MASTER, true); @@ -1104,8 +1087,8 @@ static int i2c_dw_initialize(const struct device *dev) DEVICE_MMIO_GET(dev) + DMA_INTEL_LPSS_REMAP_LOW); sys_write32((uint32_t)(dw->phy_addr >> DMA_INTEL_LPSS_ADDR_RIGHT_SHIFT), DEVICE_MMIO_GET(dev) + DMA_INTEL_LPSS_REMAP_HI); - LOG_DBG("i2c instance physical addr: [0x%lx], virtual addr: [0x%lx]", - dw->phy_addr, dw->base_addr); + LOG_DBG("i2c instance physical addr: [0x%lx], virtual addr: [0x%lx]", dw->phy_addr, + dw->base_addr); #endif } else #endif @@ -1123,7 +1106,7 @@ static int i2c_dw_initialize(const struct device *dev) /* verify that we have a valid DesignWare register first */ if (read_comp_type(reg_base) != I2C_DW_MAGIC_KEY) { LOG_DBG("I2C: DesignWare magic key not found, check base " - "address. Stopping initialization"); + "address. Stopping initialization"); return -EIO; } @@ -1164,7 +1147,7 @@ static int i2c_dw_initialize(const struct device *dev) #endif #if defined(CONFIG_RESET) -#define RESET_DW_CONFIG(n) \ +#define RESET_DW_CONFIG(n) \ IF_ENABLED(DT_INST_NODE_HAS_PROP(0, resets), \ (.reset = RESET_DT_SPEC_INST_GET(n),)) #else @@ -1173,83 +1156,71 @@ static int i2c_dw_initialize(const struct device *dev) #define I2C_DW_INIT_PCIE0(n) #define I2C_DW_INIT_PCIE1(n) DEVICE_PCIE_INST_INIT(n, pcie), -#define I2C_DW_INIT_PCIE(n) \ - _CONCAT(I2C_DW_INIT_PCIE, DT_INST_ON_BUS(n, pcie))(n) +#define I2C_DW_INIT_PCIE(n) _CONCAT(I2C_DW_INIT_PCIE, DT_INST_ON_BUS(n, pcie))(n) #define I2C_DEFINE_PCIE0(n) #define I2C_DEFINE_PCIE1(n) DEVICE_PCIE_INST_DECLARE(n) -#define I2C_PCIE_DEFINE(n) \ - _CONCAT(I2C_DEFINE_PCIE, DT_INST_ON_BUS(n, pcie))(n) +#define I2C_PCIE_DEFINE(n) _CONCAT(I2C_DEFINE_PCIE, DT_INST_ON_BUS(n, pcie))(n) #define I2C_DW_IRQ_FLAGS_SENSE0(n) 0 #define I2C_DW_IRQ_FLAGS_SENSE1(n) DT_INST_IRQ(n, sense) -#define I2C_DW_IRQ_FLAGS(n) \ - _CONCAT(I2C_DW_IRQ_FLAGS_SENSE, DT_INST_IRQ_HAS_CELL(n, sense))(n) +#define I2C_DW_IRQ_FLAGS_SENSE(n) _CONCAT(I2C_DW_IRQ_FLAGS_SENSE, DT_INST_IRQ_HAS_CELL(n, sense)) +#define I2C_DW_IRQ_FLAGS(n) I2C_DW_IRQ_FLAGS_SENSE(n)(n) /* not PCI(e) */ -#define I2C_DW_IRQ_CONFIG_PCIE0(n) \ - static void i2c_config_##n(const struct device *port) \ - { \ - ARG_UNUSED(port); \ - IRQ_CONNECT(DT_INST_IRQN(n), DT_INST_IRQ(n, priority), \ - i2c_dw_isr, DEVICE_DT_INST_GET(n), \ - I2C_DW_IRQ_FLAGS(n)); \ - irq_enable(DT_INST_IRQN(n)); \ +#define I2C_DW_IRQ_CONFIG_PCIE0(n) \ + static void i2c_config_##n(const struct device *port) \ + { \ + ARG_UNUSED(port); \ + IRQ_CONNECT(DT_INST_IRQN(n), DT_INST_IRQ(n, priority), i2c_dw_isr, \ + DEVICE_DT_INST_GET(n), I2C_DW_IRQ_FLAGS(n)); \ + irq_enable(DT_INST_IRQN(n)); \ } /* PCI(e) with auto IRQ detection */ -#define I2C_DW_IRQ_CONFIG_PCIE1(n) \ - static void i2c_config_##n(const struct device *port) \ - { \ - BUILD_ASSERT(DT_INST_IRQN(n) == PCIE_IRQ_DETECT, \ - "Only runtime IRQ configuration is supported"); \ - BUILD_ASSERT(IS_ENABLED(CONFIG_DYNAMIC_INTERRUPTS), \ - "DW I2C PCI needs CONFIG_DYNAMIC_INTERRUPTS"); \ - const struct i2c_dw_rom_config * const dev_cfg = port->config;\ - unsigned int irq = pcie_alloc_irq(dev_cfg->pcie->bdf); \ - if (irq == PCIE_CONF_INTR_IRQ_NONE) { \ - return; \ - } \ - pcie_connect_dynamic_irq(dev_cfg->pcie->bdf, irq, \ - DT_INST_IRQ(n, priority), \ - (void (*)(const void *))i2c_dw_isr, \ - DEVICE_DT_INST_GET(n), \ - I2C_DW_IRQ_FLAGS(n)); \ - pcie_irq_enable(dev_cfg->pcie->bdf, irq); \ +#define I2C_DW_IRQ_CONFIG_PCIE1(n) \ + static void i2c_config_##n(const struct device *port) \ + { \ + BUILD_ASSERT(DT_INST_IRQN(n) == PCIE_IRQ_DETECT, \ + "Only runtime IRQ configuration is supported"); \ + BUILD_ASSERT(IS_ENABLED(CONFIG_DYNAMIC_INTERRUPTS), \ + "DW I2C PCI needs CONFIG_DYNAMIC_INTERRUPTS"); \ + const struct i2c_dw_rom_config *const dev_cfg = port->config; \ + unsigned int irq = pcie_alloc_irq(dev_cfg->pcie->bdf); \ + if (irq == PCIE_CONF_INTR_IRQ_NONE) { \ + return; \ + } \ + pcie_connect_dynamic_irq(dev_cfg->pcie->bdf, irq, DT_INST_IRQ(n, priority), \ + (void (*)(const void *))i2c_dw_isr, \ + DEVICE_DT_INST_GET(n), I2C_DW_IRQ_FLAGS(n)); \ + pcie_irq_enable(dev_cfg->pcie->bdf, irq); \ } -#define I2C_DW_IRQ_CONFIG(n) \ - _CONCAT(I2C_DW_IRQ_CONFIG_PCIE, DT_INST_ON_BUS(n, pcie))(n) +#define I2C_DW_IRQ_CONFIG(n) _CONCAT(I2C_DW_IRQ_CONFIG_PCIE, DT_INST_ON_BUS(n, pcie))(n) #define I2C_CONFIG_REG_INIT_PCIE0(n) DEVICE_MMIO_ROM_INIT(DT_DRV_INST(n)), #define I2C_CONFIG_REG_INIT_PCIE1(n) -#define I2C_CONFIG_REG_INIT(n) \ - _CONCAT(I2C_CONFIG_REG_INIT_PCIE, DT_INST_ON_BUS(n, pcie))(n) +#define I2C_CONFIG_REG_INIT(n) _CONCAT(I2C_CONFIG_REG_INIT_PCIE, DT_INST_ON_BUS(n, pcie))(n) -#define I2C_CONFIG_DMA_INIT(n) \ +#define I2C_CONFIG_DMA_INIT(n) \ COND_CODE_1(CONFIG_I2C_DW_LPSS_DMA, \ (COND_CODE_1(DT_INST_NODE_HAS_PROP(n, dmas), \ (.dma_dev = DEVICE_DT_GET(DT_INST_DMAS_CTLR_BY_IDX(n, 0)),), \ ())), ()) -#define I2C_DEVICE_INIT_DW(n) \ - PINCTRL_DW_DEFINE(n); \ - I2C_PCIE_DEFINE(n); \ - static void i2c_config_##n(const struct device *port); \ - static const struct i2c_dw_rom_config i2c_config_dw_##n = { \ - I2C_CONFIG_REG_INIT(n) \ - .config_func = i2c_config_##n, \ - .bitrate = DT_INST_PROP(n, clock_frequency), \ - RESET_DW_CONFIG(n) \ - PINCTRL_DW_CONFIG(n) \ - I2C_DW_INIT_PCIE(n) \ - I2C_CONFIG_DMA_INIT(n) \ - }; \ - static struct i2c_dw_dev_config i2c_##n##_runtime; \ - I2C_DEVICE_DT_INST_DEFINE(n, i2c_dw_initialize, NULL, \ - &i2c_##n##_runtime, &i2c_config_dw_##n, \ - POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ - &funcs); \ +#define I2C_DEVICE_INIT_DW(n) \ + PINCTRL_DW_DEFINE(n); \ + I2C_PCIE_DEFINE(n); \ + static void i2c_config_##n(const struct device *port); \ + static const struct i2c_dw_rom_config i2c_config_dw_##n = { \ + I2C_CONFIG_REG_INIT(n).config_func = i2c_config_##n, \ + .bitrate = DT_INST_PROP(n, clock_frequency), \ + RESET_DW_CONFIG(n) PINCTRL_DW_CONFIG(n) I2C_DW_INIT_PCIE(n) \ + I2C_CONFIG_DMA_INIT(n)}; \ + static struct i2c_dw_dev_config i2c_##n##_runtime; \ + I2C_DEVICE_DT_INST_DEFINE(n, i2c_dw_initialize, NULL, &i2c_##n##_runtime, \ + &i2c_config_dw_##n, POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ + &funcs); \ I2C_DW_IRQ_CONFIG(n) DT_INST_FOREACH_STATUS_OKAY(I2C_DEVICE_INIT_DW) diff --git a/drivers/i2c/i2c_dw.h b/drivers/i2c/i2c_dw.h index 126017a212b71..004cbb0a11076 100644 --- a/drivers/i2c/i2c_dw.h +++ b/drivers/i2c/i2c_dw.h @@ -26,75 +26,64 @@ BUILD_ASSERT(IS_ENABLED(CONFIG_PCIE), "DW I2C in DT needs CONFIG_PCIE"); extern "C" { #endif -#define I2C_DW_MAGIC_KEY 0x44570140 - +#define I2C_DW_MAGIC_KEY 0x44570140 typedef void (*i2c_isr_cb_t)(const struct device *port); - -#define IC_ACTIVITY (1 << 0) -#define IC_ENABLE_BIT (1 << 0) - +#define IC_ACTIVITY (1 << 0) +#define IC_ENABLE_BIT (1 << 0) /* dev->state values from IC_DATA_CMD Data transfer mode settings (bit 8) */ -#define I2C_DW_STATE_READY (0) -#define I2C_DW_CMD_SEND (1 << 0) -#define I2C_DW_CMD_RECV (1 << 1) -#define I2C_DW_CMD_ERROR (1 << 2) -#define I2C_DW_BUSY (1 << 3) - +#define I2C_DW_STATE_READY (0) +#define I2C_DW_CMD_SEND (1 << 0) +#define I2C_DW_CMD_RECV (1 << 1) +#define I2C_DW_CMD_ERROR (1 << 2) +#define I2C_DW_BUSY (1 << 3) -#define DW_ENABLE_TX_INT_I2C_MASTER (DW_INTR_STAT_TX_OVER | \ - DW_INTR_STAT_TX_EMPTY | \ - DW_INTR_STAT_TX_ABRT | \ - DW_INTR_STAT_STOP_DET) -#define DW_ENABLE_RX_INT_I2C_MASTER (DW_INTR_STAT_RX_UNDER | \ - DW_INTR_STAT_RX_OVER | \ - DW_INTR_STAT_RX_FULL | \ - DW_INTR_STAT_STOP_DET) +#define DW_ENABLE_TX_INT_I2C_MASTER \ + (DW_INTR_STAT_TX_OVER | DW_INTR_STAT_TX_EMPTY | DW_INTR_STAT_TX_ABRT | \ + DW_INTR_STAT_STOP_DET) +#define DW_ENABLE_RX_INT_I2C_MASTER \ + (DW_INTR_STAT_RX_UNDER | DW_INTR_STAT_RX_OVER | DW_INTR_STAT_RX_FULL | \ + DW_INTR_STAT_STOP_DET) -#define DW_ENABLE_TX_INT_I2C_SLAVE (DW_INTR_STAT_RD_REQ | \ - DW_INTR_STAT_TX_ABRT | \ - DW_INTR_STAT_STOP_DET) -#define DW_ENABLE_RX_INT_I2C_SLAVE (DW_INTR_STAT_RX_FULL | \ - DW_INTR_STAT_STOP_DET) - -#define DW_DISABLE_ALL_I2C_INT 0x00000000 +#define DW_ENABLE_TX_INT_I2C_SLAVE \ + (DW_INTR_STAT_RD_REQ | DW_INTR_STAT_TX_ABRT | DW_INTR_STAT_STOP_DET) +#define DW_ENABLE_RX_INT_I2C_SLAVE (DW_INTR_STAT_RX_FULL | DW_INTR_STAT_STOP_DET) +#define DW_DISABLE_ALL_I2C_INT 0x00000000 /* IC_CON Low count and high count default values */ /* TODO verify values for high speed */ -#define I2C_STD_HCNT (CONFIG_I2C_DW_CLOCK_SPEED * 4) -#define I2C_STD_LCNT (CONFIG_I2C_DW_CLOCK_SPEED * 5) -#define I2C_FS_HCNT ((CONFIG_I2C_DW_CLOCK_SPEED * 6) / 8) -#define I2C_FS_LCNT ((CONFIG_I2C_DW_CLOCK_SPEED * 7) / 8) -#define I2C_FSP_HCNT ((CONFIG_I2C_DW_CLOCK_SPEED * 2) / 8) -#define I2C_FSP_LCNT ((CONFIG_I2C_DW_CLOCK_SPEED * 2) / 8) -#define I2C_HS_HCNT ((CONFIG_I2C_DW_CLOCK_SPEED * 6) / 8) -#define I2C_HS_LCNT ((CONFIG_I2C_DW_CLOCK_SPEED * 7) / 8) +#define I2C_STD_HCNT (CONFIG_I2C_DW_CLOCK_SPEED * 4) +#define I2C_STD_LCNT (CONFIG_I2C_DW_CLOCK_SPEED * 5) +#define I2C_FS_HCNT ((CONFIG_I2C_DW_CLOCK_SPEED * 6) / 8) +#define I2C_FS_LCNT ((CONFIG_I2C_DW_CLOCK_SPEED * 7) / 8) +#define I2C_FSP_HCNT ((CONFIG_I2C_DW_CLOCK_SPEED * 2) / 8) +#define I2C_FSP_LCNT ((CONFIG_I2C_DW_CLOCK_SPEED * 2) / 8) +#define I2C_HS_HCNT ((CONFIG_I2C_DW_CLOCK_SPEED * 6) / 8) +#define I2C_HS_LCNT ((CONFIG_I2C_DW_CLOCK_SPEED * 7) / 8) /* * DesignWare speed values don't directly translate from the Zephyr speed * selections in include/i2c.h so here we do a little translation */ -#define I2C_DW_SPEED_STANDARD 0x1 -#define I2C_DW_SPEED_FAST 0x2 -#define I2C_DW_SPEED_FAST_PLUS 0x2 -#define I2C_DW_SPEED_HIGH 0x3 - +#define I2C_DW_SPEED_STANDARD 0x1 +#define I2C_DW_SPEED_FAST 0x2 +#define I2C_DW_SPEED_FAST_PLUS 0x2 +#define I2C_DW_SPEED_HIGH 0x3 /* * These values have been randomly selected. It would be good to test different * watermark levels for performance capabilities */ -#define I2C_DW_TX_WATERMARK 2 -#define I2C_DW_RX_WATERMARK 7 - +#define I2C_DW_TX_WATERMARK 2 +#define I2C_DW_RX_WATERMARK 7 struct i2c_dw_rom_config { DEVICE_MMIO_ROM; - i2c_isr_cb_t config_func; - uint32_t bitrate; + i2c_isr_cb_t config_func; + uint32_t bitrate; #if defined(CONFIG_PINCTRL) const struct pinctrl_dev_config *pcfg; @@ -114,21 +103,21 @@ struct i2c_dw_rom_config { struct i2c_dw_dev_config { DEVICE_MMIO_RAM; - struct k_sem device_sync_sem; - struct k_mutex bus_mutex; + struct k_sem device_sync_sem; + struct k_mutex bus_mutex; uint32_t app_config; - uint8_t *xfr_buf; - uint32_t xfr_len; - uint32_t rx_pending; + uint8_t *xfr_buf; + uint32_t xfr_len; + uint32_t rx_pending; - uint16_t hcnt; - uint16_t lcnt; + uint16_t hcnt; + uint16_t lcnt; - volatile uint8_t state; /* last direction of transfer */ - uint8_t request_bytes; - uint8_t xfr_flags; - bool support_hs_mode; + volatile uint8_t state; /* last direction of transfer */ + uint8_t request_bytes; + uint8_t xfr_flags; + bool support_hs_mode; #ifdef CONFIG_I2C_DW_LPSS_DMA uintptr_t phy_addr; uintptr_t base_addr; @@ -139,39 +128,39 @@ struct i2c_dw_dev_config { struct i2c_target_config *slave_cfg; }; -#define Z_REG_READ(__sz) sys_read##__sz +#define Z_REG_READ(__sz) sys_read##__sz #define Z_REG_WRITE(__sz) sys_write##__sz -#define Z_REG_SET_BIT sys_set_bit -#define Z_REG_CLEAR_BIT sys_clear_bit -#define Z_REG_TEST_BIT sys_test_bit - -#define DEFINE_MM_REG_READ(__reg, __off, __sz) \ - static inline uint32_t read_##__reg(uint32_t addr) \ - { \ - return Z_REG_READ(__sz)(addr + __off); \ +#define Z_REG_SET_BIT sys_set_bit +#define Z_REG_CLEAR_BIT sys_clear_bit +#define Z_REG_TEST_BIT sys_test_bit + +#define DEFINE_MM_REG_READ(__reg, __off, __sz) \ + static inline uint32_t read_##__reg(uint32_t addr) \ + { \ + return Z_REG_READ(__sz)(addr + __off); \ } -#define DEFINE_MM_REG_WRITE(__reg, __off, __sz) \ - static inline void write_##__reg(uint32_t data, uint32_t addr) \ - { \ - Z_REG_WRITE(__sz)(data, addr + __off); \ +#define DEFINE_MM_REG_WRITE(__reg, __off, __sz) \ + static inline void write_##__reg(uint32_t data, uint32_t addr) \ + { \ + Z_REG_WRITE(__sz)(data, addr + __off); \ } -#define DEFINE_SET_BIT_OP(__reg_bit, __reg_off, __bit) \ - static inline void set_bit_##__reg_bit(uint32_t addr) \ - { \ - Z_REG_SET_BIT(addr + __reg_off, __bit); \ +#define DEFINE_SET_BIT_OP(__reg_bit, __reg_off, __bit) \ + static inline void set_bit_##__reg_bit(uint32_t addr) \ + { \ + Z_REG_SET_BIT(addr + __reg_off, __bit); \ } -#define DEFINE_CLEAR_BIT_OP(__reg_bit, __reg_off, __bit) \ - static inline void clear_bit_##__reg_bit(uint32_t addr) \ - { \ - Z_REG_CLEAR_BIT(addr + __reg_off, __bit); \ +#define DEFINE_CLEAR_BIT_OP(__reg_bit, __reg_off, __bit) \ + static inline void clear_bit_##__reg_bit(uint32_t addr) \ + { \ + Z_REG_CLEAR_BIT(addr + __reg_off, __bit); \ } -#define DEFINE_TEST_BIT_OP(__reg_bit, __reg_off, __bit) \ - static inline int test_bit_##__reg_bit(uint32_t addr) \ - { \ - return Z_REG_TEST_BIT(addr + __reg_off, __bit); \ +#define DEFINE_TEST_BIT_OP(__reg_bit, __reg_off, __bit) \ + static inline int test_bit_##__reg_bit(uint32_t addr) \ + { \ + return Z_REG_TEST_BIT(addr + __reg_off, __bit); \ } #ifdef __cplusplus diff --git a/drivers/i2c/i2c_dw_registers.h b/drivers/i2c/i2c_dw_registers.h index 6b2a11dffa46c..117fcb196d08f 100644 --- a/drivers/i2c/i2c_dw_registers.h +++ b/drivers/i2c/i2c_dw_registers.h @@ -14,154 +14,154 @@ extern "C" { /* IC_CON bits */ union ic_con_register { - uint32_t raw; + uint32_t raw; struct { - uint32_t master_mode : 1 __packed; - uint32_t speed : 2 __packed; - uint32_t addr_slave_10bit : 1 __packed; - uint32_t addr_master_10bit : 1 __packed; - uint32_t restart_en : 1 __packed; - uint32_t slave_disable : 1 __packed; - uint32_t stop_det : 1 __packed; - uint32_t tx_empty_ctl : 1 __packed; - uint32_t rx_fifo_full : 1 __packed; + uint32_t master_mode: 1 __packed; + uint32_t speed: 2 __packed; + uint32_t addr_slave_10bit: 1 __packed; + uint32_t addr_master_10bit: 1 __packed; + uint32_t restart_en: 1 __packed; + uint32_t slave_disable: 1 __packed; + uint32_t stop_det: 1 __packed; + uint32_t tx_empty_ctl: 1 __packed; + uint32_t rx_fifo_full: 1 __packed; } bits; }; /* IC_DATA_CMD bits */ -#define IC_DATA_CMD_DAT_MASK 0xFF -#define IC_DATA_CMD_CMD BIT(8) -#define IC_DATA_CMD_STOP BIT(9) -#define IC_DATA_CMD_RESTART BIT(10) +#define IC_DATA_CMD_DAT_MASK 0xFF +#define IC_DATA_CMD_CMD BIT(8) +#define IC_DATA_CMD_STOP BIT(9) +#define IC_DATA_CMD_RESTART BIT(10) /* DesignWare Interrupt bits positions */ -#define DW_INTR_STAT_RX_UNDER BIT(0) -#define DW_INTR_STAT_RX_OVER BIT(1) -#define DW_INTR_STAT_RX_FULL BIT(2) -#define DW_INTR_STAT_TX_OVER BIT(3) -#define DW_INTR_STAT_TX_EMPTY BIT(4) -#define DW_INTR_STAT_RD_REQ BIT(5) -#define DW_INTR_STAT_TX_ABRT BIT(6) -#define DW_INTR_STAT_RX_DONE BIT(7) -#define DW_INTR_STAT_ACTIVITY BIT(8) -#define DW_INTR_STAT_STOP_DET BIT(9) -#define DW_INTR_STAT_START_DET BIT(10) -#define DW_INTR_STAT_GEN_CALL BIT(11) -#define DW_INTR_STAT_RESTART_DET BIT(12) -#define DW_INTR_STAT_MST_ON_HOLD BIT(13) - -#define DW_INTR_MASK_RX_UNDER BIT(0) -#define DW_INTR_MASK_RX_OVER BIT(1) -#define DW_INTR_MASK_RX_FULL BIT(2) -#define DW_INTR_MASK_TX_OVER BIT(3) -#define DW_INTR_MASK_TX_EMPTY BIT(4) -#define DW_INTR_MASK_RD_REQ BIT(5) -#define DW_INTR_MASK_TX_ABRT BIT(6) -#define DW_INTR_MASK_RX_DONE BIT(7) -#define DW_INTR_MASK_ACTIVITY BIT(8) -#define DW_INTR_MASK_STOP_DET BIT(9) -#define DW_INTR_MASK_START_DET BIT(10) -#define DW_INTR_MASK_GEN_CALL BIT(11) -#define DW_INTR_MASK_RESTART_DET BIT(12) -#define DW_INTR_MASK_MST_ON_HOLD BIT(13) -#define DW_INTR_MASK_RESET 0x000008ff +#define DW_INTR_STAT_RX_UNDER BIT(0) +#define DW_INTR_STAT_RX_OVER BIT(1) +#define DW_INTR_STAT_RX_FULL BIT(2) +#define DW_INTR_STAT_TX_OVER BIT(3) +#define DW_INTR_STAT_TX_EMPTY BIT(4) +#define DW_INTR_STAT_RD_REQ BIT(5) +#define DW_INTR_STAT_TX_ABRT BIT(6) +#define DW_INTR_STAT_RX_DONE BIT(7) +#define DW_INTR_STAT_ACTIVITY BIT(8) +#define DW_INTR_STAT_STOP_DET BIT(9) +#define DW_INTR_STAT_START_DET BIT(10) +#define DW_INTR_STAT_GEN_CALL BIT(11) +#define DW_INTR_STAT_RESTART_DET BIT(12) +#define DW_INTR_STAT_MST_ON_HOLD BIT(13) + +#define DW_INTR_MASK_RX_UNDER BIT(0) +#define DW_INTR_MASK_RX_OVER BIT(1) +#define DW_INTR_MASK_RX_FULL BIT(2) +#define DW_INTR_MASK_TX_OVER BIT(3) +#define DW_INTR_MASK_TX_EMPTY BIT(4) +#define DW_INTR_MASK_RD_REQ BIT(5) +#define DW_INTR_MASK_TX_ABRT BIT(6) +#define DW_INTR_MASK_RX_DONE BIT(7) +#define DW_INTR_MASK_ACTIVITY BIT(8) +#define DW_INTR_MASK_STOP_DET BIT(9) +#define DW_INTR_MASK_START_DET BIT(10) +#define DW_INTR_MASK_GEN_CALL BIT(11) +#define DW_INTR_MASK_RESTART_DET BIT(12) +#define DW_INTR_MASK_MST_ON_HOLD BIT(13) +#define DW_INTR_MASK_RESET 0x000008ff union ic_interrupt_register { - uint32_t raw; + uint32_t raw; struct { - uint32_t rx_under : 1 __packed; - uint32_t rx_over : 1 __packed; - uint32_t rx_full : 1 __packed; - uint32_t tx_over : 1 __packed; - uint32_t tx_empty : 1 __packed; - uint32_t rd_req : 1 __packed; - uint32_t tx_abrt : 1 __packed; - uint32_t rx_done : 1 __packed; - uint32_t activity : 1 __packed; - uint32_t stop_det : 1 __packed; - uint32_t start_det : 1 __packed; - uint32_t gen_call : 1 __packed; - uint32_t restart_det : 1 __packed; - uint32_t mst_on_hold : 1 __packed; - uint32_t reserved : 2 __packed; + uint32_t rx_under: 1 __packed; + uint32_t rx_over: 1 __packed; + uint32_t rx_full: 1 __packed; + uint32_t tx_over: 1 __packed; + uint32_t tx_empty: 1 __packed; + uint32_t rd_req: 1 __packed; + uint32_t tx_abrt: 1 __packed; + uint32_t rx_done: 1 __packed; + uint32_t activity: 1 __packed; + uint32_t stop_det: 1 __packed; + uint32_t start_det: 1 __packed; + uint32_t gen_call: 1 __packed; + uint32_t restart_det: 1 __packed; + uint32_t mst_on_hold: 1 __packed; + uint32_t reserved: 2 __packed; } bits; }; /* IC_TAR */ union ic_tar_register { - uint32_t raw; + uint32_t raw; struct { - uint32_t ic_tar : 10 __packed; - uint32_t gc_or_start : 1 __packed; - uint32_t special : 1 __packed; - uint32_t ic_10bitaddr_master : 1 __packed; - uint32_t reserved : 3 __packed; + uint32_t ic_tar: 10 __packed; + uint32_t gc_or_start: 1 __packed; + uint32_t special: 1 __packed; + uint32_t ic_10bitaddr_master: 1 __packed; + uint32_t reserved: 3 __packed; } bits; }; /* IC_COMP_PARAM_1 */ union ic_comp_param_1_register { - uint32_t raw; + uint32_t raw; struct { - uint32_t apb_data_width : 2 __packed; - uint32_t max_speed_mode : 2 __packed; - uint32_t hc_count_values : 1 __packed; - uint32_t intr_io : 1 __packed; - uint32_t has_dma : 1 __packed; - uint32_t add_encoded_params : 1 __packed; - uint32_t rx_buffer_depth : 8 __packed; - uint32_t tx_buffer_depth : 8 __packed; - uint32_t reserved : 7 __packed; + uint32_t apb_data_width: 2 __packed; + uint32_t max_speed_mode: 2 __packed; + uint32_t hc_count_values: 1 __packed; + uint32_t intr_io: 1 __packed; + uint32_t has_dma: 1 __packed; + uint32_t add_encoded_params: 1 __packed; + uint32_t rx_buffer_depth: 8 __packed; + uint32_t tx_buffer_depth: 8 __packed; + uint32_t reserved: 7 __packed; } bits; }; -#define DW_IC_REG_CON (0x00) -#define DW_IC_REG_TAR (0x04) -#define DW_IC_REG_SAR (0x08) -#define DW_IC_REG_DATA_CMD (0x10) -#define DW_IC_REG_SS_SCL_HCNT (0x14) -#define DW_IC_REG_SS_SCL_LCNT (0x18) -#define DW_IC_REG_FS_SCL_HCNT (0x1C) -#define DW_IC_REG_FS_SCL_LCNT (0x20) -#define DW_IC_REG_HS_SCL_HCNT (0x24) -#define DW_IC_REG_HS_SCL_LCNT (0x28) -#define DW_IC_REG_INTR_STAT (0x2C) -#define DW_IC_REG_INTR_MASK (0x30) -#define DW_IC_REG_RX_TL (0x38) -#define DW_IC_REG_TX_TL (0x3C) -#define DW_IC_REG_CLR_INTR (0x40) -#define DW_IC_REG_CLR_RX_UNDER (0x44) -#define DW_IC_REG_CLR_RX_OVER (0x48) -#define DW_IC_REG_CLR_TX_OVER (0x4c) -#define DW_IC_REG_CLR_RD_REQ (0x50) -#define DW_IC_REG_CLR_TX_ABRT (0x54) -#define DW_IC_REG_CLR_RX_DONE (0x58) -#define DW_IC_REG_CLR_ACTIVITY (0x5c) -#define DW_IC_REG_CLR_STOP_DET (0x60) -#define DW_IC_REG_CLR_START_DET (0x64) -#define DW_IC_REG_CLR_GEN_CALL (0x68) -#define DW_IC_REG_ENABLE (0x6C) -#define DW_IC_REG_STATUS (0x70) -#define DW_IC_REG_TXFLR (0x74) -#define DW_IC_REG_RXFLR (0x78) -#define DW_IC_REG_DMA_CR (0x88) -#define DW_IC_REG_TDLR (0x8C) -#define DW_IC_REG_RDLR (0x90) -#define DW_IC_REG_FS_SPKLEN (0xA0) -#define DW_IC_REG_HS_SPKLEN (0xA4) -#define DW_IC_REG_COMP_PARAM_1 (0xF4) -#define DW_IC_REG_COMP_TYPE (0xFC) - -#define IDMA_REG_INTR_STS 0xAE8 -#define IDMA_TX_RX_CHAN_MASK 0x3 +#define DW_IC_REG_CON (0x00) +#define DW_IC_REG_TAR (0x04) +#define DW_IC_REG_SAR (0x08) +#define DW_IC_REG_DATA_CMD (0x10) +#define DW_IC_REG_SS_SCL_HCNT (0x14) +#define DW_IC_REG_SS_SCL_LCNT (0x18) +#define DW_IC_REG_FS_SCL_HCNT (0x1C) +#define DW_IC_REG_FS_SCL_LCNT (0x20) +#define DW_IC_REG_HS_SCL_HCNT (0x24) +#define DW_IC_REG_HS_SCL_LCNT (0x28) +#define DW_IC_REG_INTR_STAT (0x2C) +#define DW_IC_REG_INTR_MASK (0x30) +#define DW_IC_REG_RX_TL (0x38) +#define DW_IC_REG_TX_TL (0x3C) +#define DW_IC_REG_CLR_INTR (0x40) +#define DW_IC_REG_CLR_RX_UNDER (0x44) +#define DW_IC_REG_CLR_RX_OVER (0x48) +#define DW_IC_REG_CLR_TX_OVER (0x4c) +#define DW_IC_REG_CLR_RD_REQ (0x50) +#define DW_IC_REG_CLR_TX_ABRT (0x54) +#define DW_IC_REG_CLR_RX_DONE (0x58) +#define DW_IC_REG_CLR_ACTIVITY (0x5c) +#define DW_IC_REG_CLR_STOP_DET (0x60) +#define DW_IC_REG_CLR_START_DET (0x64) +#define DW_IC_REG_CLR_GEN_CALL (0x68) +#define DW_IC_REG_ENABLE (0x6C) +#define DW_IC_REG_STATUS (0x70) +#define DW_IC_REG_TXFLR (0x74) +#define DW_IC_REG_RXFLR (0x78) +#define DW_IC_REG_DMA_CR (0x88) +#define DW_IC_REG_TDLR (0x8C) +#define DW_IC_REG_RDLR (0x90) +#define DW_IC_REG_FS_SPKLEN (0xA0) +#define DW_IC_REG_HS_SPKLEN (0xA4) +#define DW_IC_REG_COMP_PARAM_1 (0xF4) +#define DW_IC_REG_COMP_TYPE (0xFC) + +#define IDMA_REG_INTR_STS 0xAE8 +#define IDMA_TX_RX_CHAN_MASK 0x3 /* CON Bit */ -#define DW_IC_CON_MASTER_MODE_BIT (0) +#define DW_IC_CON_MASTER_MODE_BIT (0) /* DMA control bits */ -#define DW_IC_DMA_RX_ENABLE BIT(0) -#define DW_IC_DMA_TX_ENABLE BIT(1) -#define DW_IC_DMA_ENABLE (BIT(0) | BIT(1)) +#define DW_IC_DMA_RX_ENABLE BIT(0) +#define DW_IC_DMA_TX_ENABLE BIT(1) +#define DW_IC_DMA_ENABLE (BIT(0) | BIT(1)) DEFINE_TEST_BIT_OP(con_master_mode, DW_IC_REG_CON, DW_IC_CON_MASTER_MODE_BIT) DEFINE_MM_REG_WRITE(con, DW_IC_REG_CON, 32) @@ -179,14 +179,12 @@ DEFINE_MM_REG_WRITE(fs_scl_lcnt, DW_IC_REG_FS_SCL_LCNT, 32) DEFINE_MM_REG_WRITE(hs_scl_hcnt, DW_IC_REG_HS_SCL_HCNT, 32) DEFINE_MM_REG_WRITE(hs_scl_lcnt, DW_IC_REG_HS_SCL_LCNT, 32) - - DEFINE_MM_REG_READ(intr_stat, DW_IC_REG_INTR_STAT, 32) -#define DW_IC_INTR_STAT_TX_ABRT_BIT (6) +#define DW_IC_INTR_STAT_TX_ABRT_BIT (6) DEFINE_TEST_BIT_OP(intr_stat_tx_abrt, DW_IC_REG_INTR_STAT, DW_IC_INTR_STAT_TX_ABRT_BIT) DEFINE_MM_REG_WRITE(intr_mask, DW_IC_REG_INTR_MASK, 32) -#define DW_IC_INTR_MASK_TX_EMPTY_BIT (4) +#define DW_IC_INTR_MASK_TX_EMPTY_BIT (4) DEFINE_CLEAR_BIT_OP(intr_mask_tx_empty, DW_IC_REG_INTR_MASK, DW_IC_INTR_MASK_TX_EMPTY_BIT) DEFINE_SET_BIT_OP(intr_mask_tx_empty, DW_IC_REG_INTR_MASK, DW_IC_INTR_MASK_TX_EMPTY_BIT) @@ -205,14 +203,13 @@ DEFINE_MM_REG_READ(clr_rx_done, DW_IC_REG_CLR_RX_DONE, 32) DEFINE_MM_REG_READ(clr_rd_req, DW_IC_REG_CLR_RD_REQ, 32) DEFINE_MM_REG_READ(clr_activity, DW_IC_REG_CLR_ACTIVITY, 32) -#define DW_IC_ENABLE_EN_BIT (0) +#define DW_IC_ENABLE_EN_BIT (0) DEFINE_CLEAR_BIT_OP(enable_en, DW_IC_REG_ENABLE, DW_IC_ENABLE_EN_BIT) DEFINE_SET_BIT_OP(enable_en, DW_IC_REG_ENABLE, DW_IC_ENABLE_EN_BIT) - -#define DW_IC_STATUS_ACTIVITY_BIT (0) -#define DW_IC_STATUS_TFNT_BIT (1) -#define DW_IC_STATUS_RFNE_BIT (3) +#define DW_IC_STATUS_ACTIVITY_BIT (0) +#define DW_IC_STATUS_TFNT_BIT (1) +#define DW_IC_STATUS_RFNE_BIT (3) DEFINE_TEST_BIT_OP(status_activity, DW_IC_REG_STATUS, DW_IC_STATUS_ACTIVITY_BIT) DEFINE_TEST_BIT_OP(status_tfnt, DW_IC_REG_STATUS, DW_IC_STATUS_TFNT_BIT) DEFINE_TEST_BIT_OP(status_rfne, DW_IC_REG_STATUS, DW_IC_STATUS_RFNE_BIT) From 2221ca82d41a7a21671db21d32949fbdca2b23f1 Mon Sep 17 00:00:00 2001 From: Peter Mitsis Date: Wed, 11 Sep 2024 23:11:15 +0000 Subject: [PATCH 0383/4482] tests: wait queue benchmarks Implements a set of tests designed to show how the performance of the two wait queue implementations (DUMB and SCALABLE) change as the number of threads in the wait queue varies. Signed-off-by: Peter Mitsis --- tests/benchmarks/wait_queues/CMakeLists.txt | 12 + tests/benchmarks/wait_queues/Kconfig | 30 ++ tests/benchmarks/wait_queues/README.rst | 19 ++ tests/benchmarks/wait_queues/prj.conf | 29 ++ tests/benchmarks/wait_queues/prj.verbose.conf | 4 + tests/benchmarks/wait_queues/src/main.c | 319 ++++++++++++++++++ tests/benchmarks/wait_queues/src/utils.h | 47 +++ tests/benchmarks/wait_queues/testcase.yaml | 21 ++ 8 files changed, 481 insertions(+) create mode 100644 tests/benchmarks/wait_queues/CMakeLists.txt create mode 100644 tests/benchmarks/wait_queues/Kconfig create mode 100644 tests/benchmarks/wait_queues/README.rst create mode 100644 tests/benchmarks/wait_queues/prj.conf create mode 100644 tests/benchmarks/wait_queues/prj.verbose.conf create mode 100644 tests/benchmarks/wait_queues/src/main.c create mode 100644 tests/benchmarks/wait_queues/src/utils.h create mode 100644 tests/benchmarks/wait_queues/testcase.yaml diff --git a/tests/benchmarks/wait_queues/CMakeLists.txt b/tests/benchmarks/wait_queues/CMakeLists.txt new file mode 100644 index 0000000000000..ec1dceae561c3 --- /dev/null +++ b/tests/benchmarks/wait_queues/CMakeLists.txt @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(wait_queues) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) +target_include_directories(app PRIVATE + ${ZEPHYR_BASE}/kernel/include + ${ZEPHYR_BASE}/arch/${ARCH}/include + ) diff --git a/tests/benchmarks/wait_queues/Kconfig b/tests/benchmarks/wait_queues/Kconfig new file mode 100644 index 0000000000000..e7bc86e865515 --- /dev/null +++ b/tests/benchmarks/wait_queues/Kconfig @@ -0,0 +1,30 @@ +# Copyright (c) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +mainmenu "Wait Queue Benchmark" + +source "Kconfig.zephyr" + +config BENCHMARK_NUM_ITERATIONS + int "Number of iterations to gather data" + default 1000 + help + This option specifies the number of times each test will be executed + before calculating the average times for reporting. + +config BENCHMARK_NUM_THREADS + int "Number of threads" + default 100 + help + This option specifies the maximum number of threads that the test + will add to a wait queue. Increasing this value will places greater + stress on the wait queues and better highlight the performance + differences as the number of threads in the wait queue changes. + +config BENCHMARK_VERBOSE + bool "Display detailed results" + default y + help + This option displays the average time of all the iterations done for + each thread in the tests. This generates large amounts of output. To + analyze it, it is recommended redirect or copy the data to a file. diff --git a/tests/benchmarks/wait_queues/README.rst b/tests/benchmarks/wait_queues/README.rst new file mode 100644 index 0000000000000..6bfa004d15ae7 --- /dev/null +++ b/tests/benchmarks/wait_queues/README.rst @@ -0,0 +1,19 @@ +Wait Queue Measurements +####################### + +A Zehpyr application developer may choose between two different wait queue +implementations--dumb and scalable. These two queue implementations perform +differently under different loads. This benchmark can be used to showcase how +the performance of these two implementations vary under varying conditions. + +These conditions include: +* Time to add threads of increasing priority to a wait queue +* Time to add threads of decreasing priority to a wait queue +* Time to remove highest priority thread from a wait queue +* Time to remove lowest priority thread from a wait queue + +By default, these tests show the minimum, maximum, and averages of the measured +times. However, if the verbose option is enabled then the raw timings will also +be displayed. The following will build this project with verbose support: + + EXTRA_CONF_FILE="prj.verbose.conf" west build -p -b diff --git a/tests/benchmarks/wait_queues/prj.conf b/tests/benchmarks/wait_queues/prj.conf new file mode 100644 index 0000000000000..9c2898bd4ec3c --- /dev/null +++ b/tests/benchmarks/wait_queues/prj.conf @@ -0,0 +1,29 @@ +# Default base configuration file + +CONFIG_TEST=y + +# eliminate timer interrupts during the benchmark +CONFIG_SYS_CLOCK_TICKS_PER_SEC=1 + +# We use irq_offload(), enable it +CONFIG_IRQ_OFFLOAD=y + +# Reduce memory/code footprint +CONFIG_BT=n +CONFIG_FORCE_NO_ASSERT=y + +CONFIG_TEST_HW_STACK_PROTECTION=n +# Disable HW Stack Protection (see #28664) +CONFIG_HW_STACK_PROTECTION=n +CONFIG_COVERAGE=n + +# Disable system power management +CONFIG_PM=n + +CONFIG_TIMING_FUNCTIONS=y + +CONFIG_HEAP_MEM_POOL_SIZE=2048 +CONFIG_APPLICATION_DEFINED_SYSCALL=y + +# Disable time slicing +CONFIG_TIMESLICING=n diff --git a/tests/benchmarks/wait_queues/prj.verbose.conf b/tests/benchmarks/wait_queues/prj.verbose.conf new file mode 100644 index 0000000000000..b6204397ceadf --- /dev/null +++ b/tests/benchmarks/wait_queues/prj.verbose.conf @@ -0,0 +1,4 @@ +# Extra configuration file to enable verbose reporting +# Use with EXTRA_CONF_FILE + +CONFIG_BENCHMARK_VERBOSE=y diff --git a/tests/benchmarks/wait_queues/src/main.c b/tests/benchmarks/wait_queues/src/main.c new file mode 100644 index 0000000000000..56fe031d48bd6 --- /dev/null +++ b/tests/benchmarks/wait_queues/src/main.c @@ -0,0 +1,319 @@ +/* + * Copyright (c) 2024 Intel Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * @file + * This file contains tests that will measure the length of time required + * to add and remove threads from a wait queue that holds a varying number of + * threads. Each thread added to (and removed from) the wait queue is a dummy + * thread. As these dummy threads are inherently non-executable, this helps + * prevent the addition/removal of threads to/from the ready queue from being + * included in these measurements. Furthermore, the use of dummy threads helps + * reduce the memory footprint as not only are thread stacks not required, + * but we also do not need the full k_thread structure for each of these + * dummy threads. + */ + +#include +#include +#include +#include "utils.h" +#include +#include +#include +#include + +uint32_t tm_off; + +static struct _thread_base dummy_thread[CONFIG_BENCHMARK_NUM_THREADS]; +static _wait_q_t wait_q; + +uint64_t add_cycles[CONFIG_BENCHMARK_NUM_THREADS]; +uint64_t remove_cycles[CONFIG_BENCHMARK_NUM_THREADS]; + +/** + * Initialize each dummy thread. + */ +static void dummy_threads_init(unsigned int num_threads) +{ + unsigned int i; + unsigned int bucket_size; + + bucket_size = (num_threads / CONFIG_NUM_PREEMPT_PRIORITIES) + 1; + + for (i = 0; i < num_threads; i++) { + z_init_thread_base(&dummy_thread[i], i / bucket_size, + _THREAD_DUMMY, 0); + } +} + +static void cycles_reset(unsigned int num_threads) +{ + unsigned int i; + + for (i = 0; i < num_threads; i++) { + add_cycles[i] = 0ULL; + remove_cycles[i] = 0ULL; + } +} + +/** + * Each successive dummy thread added to the wait queue is either of the + * same or lower priority. Each dummy thread removed from the wait queue + * is of the same or lower priority than the one previous. + */ +static void test_decreasing_priority(_wait_q_t *q, unsigned int num_threads) +{ + unsigned int i; + timing_t start; + timing_t finish; + + /* Add to tail of wait queue */ + + for (i = 0; i < num_threads; i++) { + start = timing_counter_get(); + z_pend_thread((struct k_thread *)&dummy_thread[i], + q, K_FOREVER); + finish = timing_counter_get(); + + add_cycles[i] += timing_cycles_get(&start, &finish); + } + + /* Remove from head of wait queue */ + + for (i = 0; i < num_threads; i++) { + start = timing_counter_get(); + z_unpend_thread((struct k_thread *)&dummy_thread[i]); + finish = timing_counter_get(); + + remove_cycles[i] += timing_cycles_get(&start, &finish); + } +} + +static void test_increasing_priority(_wait_q_t *q, unsigned int num_threads) +{ + unsigned int i; + timing_t start; + timing_t finish; + struct k_thread *thread; + + /* Add to head of wait queue */ + + for (i = 0; i < num_threads; i++) { + start = timing_counter_get(); + thread = (struct k_thread *) + &dummy_thread[num_threads - i - 1]; + z_pend_thread(thread, q, K_FOREVER); + finish = timing_counter_get(); + + add_cycles[i] += timing_cycles_get(&start, &finish); + } + + /* Remove from tail of wait queue */ + + for (i = 0; i < num_threads; i++) { + start = timing_counter_get(); + thread = (struct k_thread *) + &dummy_thread[num_threads - i - 1]; + z_unpend_thread(thread); + finish = timing_counter_get(); + + remove_cycles[i] += timing_cycles_get(&start, &finish); + } +} + + +static uint64_t sqrt_u64(uint64_t square) +{ + if (square > 1) { + uint64_t lo = sqrt_u64(square >> 2) << 1; + uint64_t hi = lo + 1; + + return ((hi * hi) > square) ? lo : hi; + } + + return square; +} + + +static void compute_and_report_stats(unsigned int num_threads, + unsigned int num_iterations, + uint64_t *cycles, + const char *str) +{ + uint64_t minimum = cycles[0]; + uint64_t maximum = cycles[0]; + uint64_t total = cycles[0]; + uint64_t average; + uint64_t std_dev = 0; + uint64_t tmp; + uint64_t diff; + unsigned int i; + + for (i = 1; i < num_threads; i++) { + if (cycles[i] > maximum) { + maximum = cycles[i]; + } + + if (cycles[i] < minimum) { + minimum = cycles[i]; + } + + total += cycles[i]; + } + + minimum /= (uint64_t)num_iterations; + maximum /= (uint64_t)num_iterations; + average = total / (num_threads * num_iterations); + + /* Calculate standard deviation */ + + for (i = 0; i < num_threads; i++) { + tmp = cycles[i] / num_iterations; + diff = (average > tmp) ? (average - tmp) : (tmp - average); + + std_dev += (diff * diff); + } + std_dev /= num_threads; + std_dev = sqrt_u64(std_dev); + + printk("%s\n", str); + + printk(" Minimum : %7llu cycles (%7u nsec)\n", + minimum, (uint32_t)timing_cycles_to_ns(minimum)); + printk(" Maximum : %7llu cycles (%7u nsec)\n", + maximum, (uint32_t)timing_cycles_to_ns(maximum)); + printk(" Average : %7llu cycles (%7u nsec)\n", + average, (uint32_t)timing_cycles_to_ns(average)); + printk(" Std Deviation: %7llu cycles (%7u nsec)\n", + std_dev, (uint32_t)timing_cycles_to_ns(std_dev)); + +} + +int main(void) +{ + unsigned int i; + unsigned int freq; +#ifdef CONFIG_BENCHMARK_VERBOSE + char description[120]; + char tag[50]; + struct k_thread *thread; +#endif + + timing_init(); + + bench_test_init(); + + freq = timing_freq_get_mhz(); + + printk("Time Measurements for %s wait queues\n", + IS_ENABLED(CONFIG_WAITQ_DUMB) ? "dumb" : "scalable"); + printk("Timing results: Clock frequency: %u MHz\n", freq); + + z_waitq_init(&wait_q); + + dummy_threads_init(CONFIG_BENCHMARK_NUM_THREADS); + + timing_start(); + + cycles_reset(CONFIG_BENCHMARK_NUM_THREADS); + + for (i = 0; i < CONFIG_BENCHMARK_NUM_ITERATIONS; i++) { + test_decreasing_priority(&wait_q, CONFIG_BENCHMARK_NUM_THREADS); + } + + compute_and_report_stats(CONFIG_BENCHMARK_NUM_THREADS, + CONFIG_BENCHMARK_NUM_ITERATIONS, + add_cycles, + "Add threads of decreasing priority"); + +#ifdef CONFIG_BENCHMARK_VERBOSE + for (i = 0; i < CONFIG_BENCHMARK_NUM_THREADS; i++) { + snprintf(tag, sizeof(tag), + "WaitQ.add.to.tail.%04u.waiters", i); + snprintf(description, sizeof(description), + "%-40s - Add thread of priority %u", + tag, dummy_thread[i].prio); + PRINT_STATS_AVG(description, (uint32_t)add_cycles[i], + CONFIG_BENCHMARK_NUM_ITERATIONS); + } +#endif + + printk("------------------------------------\n"); + + compute_and_report_stats(CONFIG_BENCHMARK_NUM_THREADS, + CONFIG_BENCHMARK_NUM_ITERATIONS, + remove_cycles, + "Remove threads of decreasing priority"); + +#ifdef CONFIG_BENCHMARK_VERBOSE + for (i = 0; i < CONFIG_BENCHMARK_NUM_THREADS; i++) { + snprintf(tag, sizeof(tag), + "WaitQ.remove.from.head.%04u.waiters", + CONFIG_BENCHMARK_NUM_THREADS - i); + snprintf(description, sizeof(description), + "%-40s - Remove thread of priority %u", + tag, dummy_thread[i].prio); + PRINT_STATS_AVG(description, (uint32_t)remove_cycles[i], + CONFIG_BENCHMARK_NUM_ITERATIONS); + } +#endif + + printk("------------------------------------\n"); + + cycles_reset(CONFIG_BENCHMARK_NUM_THREADS); + + for (i = 0; i < CONFIG_BENCHMARK_NUM_ITERATIONS; i++) { + test_increasing_priority(&wait_q, CONFIG_BENCHMARK_NUM_THREADS); + } + + compute_and_report_stats(CONFIG_BENCHMARK_NUM_THREADS, + CONFIG_BENCHMARK_NUM_ITERATIONS, + add_cycles, + "Add threads of increasing priority"); + +#ifdef CONFIG_BENCHMARK_VERBOSE + for (i = 0; i < CONFIG_BENCHMARK_NUM_THREADS; i++) { + snprintf(tag, sizeof(tag), + "WaitQ.add.to.head.%04u.waiters", i); + thread = (struct k_thread *) + &dummy_thread[CONFIG_BENCHMARK_NUM_THREADS - i - 1]; + snprintf(description, sizeof(description), + "%-40s - Add priority %u to waitq", + tag, thread->base.prio); + PRINT_STATS_AVG(description, (uint32_t)add_cycles[i], + CONFIG_BENCHMARK_NUM_ITERATIONS); + } +#endif + + printk("------------------------------------\n"); + + compute_and_report_stats(CONFIG_BENCHMARK_NUM_THREADS, + CONFIG_BENCHMARK_NUM_ITERATIONS, + remove_cycles, + "Remove threads of increasing priority"); + +#ifdef CONFIG_BENCHMARK_VERBOSE + for (i = 0; i < CONFIG_BENCHMARK_NUM_THREADS; i++) { + snprintf(tag, sizeof(tag), + "WaitQ.remove.from.tail.%04u.waiters", + CONFIG_BENCHMARK_NUM_THREADS - i); + thread = (struct k_thread *) + &dummy_thread[CONFIG_BENCHMARK_NUM_THREADS - i - 1]; + snprintf(description, sizeof(description), + "%-40s - Remove priority %u from waitq", + tag, thread->base.prio); + PRINT_STATS_AVG(description, (uint32_t)remove_cycles[i], + CONFIG_BENCHMARK_NUM_ITERATIONS); + } +#endif + + timing_stop(); + + TC_END_REPORT(0); + + return 0; +} diff --git a/tests/benchmarks/wait_queues/src/utils.h b/tests/benchmarks/wait_queues/src/utils.h new file mode 100644 index 0000000000000..5e95ae1e7b6eb --- /dev/null +++ b/tests/benchmarks/wait_queues/src/utils.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Intel Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef __BENCHMARK_WAITQ_UTILS_H +#define __BENCHMARK_WAITQ_UTILS_H +/* + * @brief This file contains macros used in the wait queue benchmarking. + */ + +#include + +#ifdef CSV_FORMAT_OUTPUT +#define FORMAT_STR "%-74s,%s,%s\n" +#define CYCLE_FORMAT "%8u" +#define NSEC_FORMAT "%8u" +#else +#define FORMAT_STR "%-74s:%s , %s\n" +#define CYCLE_FORMAT "%8u cycles" +#define NSEC_FORMAT "%8u ns" +#endif + +/** + * @brief Display a line of statistics + * + * This macro displays the following: + * 1. Test description summary + * 2. Number of cycles + * 3. Number of nanoseconds + */ +#define PRINT_F(summary, cycles, nsec) \ + do { \ + char cycle_str[32]; \ + char nsec_str[32]; \ + \ + snprintk(cycle_str, 30, CYCLE_FORMAT, cycles); \ + snprintk(nsec_str, 30, NSEC_FORMAT, nsec); \ + printk(FORMAT_STR, summary, cycle_str, nsec_str); \ + } while (0) + +#define PRINT_STATS_AVG(summary, value, counter) \ + PRINT_F(summary, value / counter, \ + (uint32_t)timing_cycles_to_ns_avg(value, counter)) + +#endif diff --git a/tests/benchmarks/wait_queues/testcase.yaml b/tests/benchmarks/wait_queues/testcase.yaml new file mode 100644 index 0000000000000..a6fd1440b73ca --- /dev/null +++ b/tests/benchmarks/wait_queues/testcase.yaml @@ -0,0 +1,21 @@ +common: + tags: + - kernel + - benchmark + integration_platforms: + - qemu_x86 + - qemu_cortex_a53 + harness: console + harness_config: + type: one_line + regex: + - "PROJECT EXECUTION SUCCESSFUL" + +tests: + benchmark.wait_queues.dumb: + extra_configs: + - CONFIG_WAITQ_DUMB=y + + benchmark.wait_queues.scalable: + extra_configs: + - CONFIG_WAITQ_SCALABLE=y From 318b49570a77ce631dc3d97ad7e7a05df5459d8e Mon Sep 17 00:00:00 2001 From: Peter Mitsis Date: Mon, 16 Sep 2024 11:52:11 -0700 Subject: [PATCH 0384/4482] tests: scheduler queue benchmarks Implements a set of tests designed to show how the performance of the three scheduler queue implementations (DUMB, SCALABLE and MULTIQ) varies with respect to the number of threads in the ready queue. Signed-off-by: Peter Mitsis --- kernel/sched.c | 10 + tests/benchmarks/sched_queues/CMakeLists.txt | 12 + tests/benchmarks/sched_queues/Kconfig | 30 ++ tests/benchmarks/sched_queues/README.rst | 21 ++ tests/benchmarks/sched_queues/prj.conf | 31 ++ .../benchmarks/sched_queues/prj.verbose.conf | 4 + tests/benchmarks/sched_queues/src/main.c | 328 ++++++++++++++++++ tests/benchmarks/sched_queues/src/utils.h | 54 +++ tests/benchmarks/sched_queues/testcase.yaml | 25 ++ 9 files changed, 515 insertions(+) create mode 100644 tests/benchmarks/sched_queues/CMakeLists.txt create mode 100644 tests/benchmarks/sched_queues/Kconfig create mode 100644 tests/benchmarks/sched_queues/README.rst create mode 100644 tests/benchmarks/sched_queues/prj.conf create mode 100644 tests/benchmarks/sched_queues/prj.verbose.conf create mode 100644 tests/benchmarks/sched_queues/src/main.c create mode 100644 tests/benchmarks/sched_queues/src/utils.h create mode 100644 tests/benchmarks/sched_queues/testcase.yaml diff --git a/kernel/sched.c b/kernel/sched.c index 6f57bd9558948..d91a2d32cfb67 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -1599,3 +1599,13 @@ int z_sched_waitq_walk(_wait_q_t *wait_q, return status; } + +/* This routine exists for benchmarking purposes. It is not used in + * general production code. + */ +void z_unready_thread(struct k_thread *thread) +{ + K_SPINLOCK(&_sched_spinlock) { + unready_thread(thread); + } +} diff --git a/tests/benchmarks/sched_queues/CMakeLists.txt b/tests/benchmarks/sched_queues/CMakeLists.txt new file mode 100644 index 0000000000000..751e2e0233c1d --- /dev/null +++ b/tests/benchmarks/sched_queues/CMakeLists.txt @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(sched_queues) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) +target_include_directories(app PRIVATE + ${ZEPHYR_BASE}/kernel/include + ${ZEPHYR_BASE}/arch/${ARCH}/include + ) diff --git a/tests/benchmarks/sched_queues/Kconfig b/tests/benchmarks/sched_queues/Kconfig new file mode 100644 index 0000000000000..f952fe24e1f0d --- /dev/null +++ b/tests/benchmarks/sched_queues/Kconfig @@ -0,0 +1,30 @@ +# Copyright (c) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +mainmenu "Scheduler Queue Benchmark" + +source "Kconfig.zephyr" + +config BENCHMARK_NUM_ITERATIONS + int "Number of iterations to gather data" + default 1000 + help + This option specifies the number of times each test will be executed + before calculating the average times for reporting. + +config BENCHMARK_NUM_THREADS + int "Number of threads" + default 100 + help + This option specifies the maximum number of threads that the test + will add to the ready queue. Increasing this value will places greater + stress on the ready queue and better highlight the performance + differences as the number of threads in the ready queue changes. + +config BENCHMARK_VERBOSE + bool "Display detailed results" + default y + help + This option displays the average time of all the iterations done for + each thread in the tests. This generates large amounts of output. To + analyze it, it is recommended to redirect the output to a file. diff --git a/tests/benchmarks/sched_queues/README.rst b/tests/benchmarks/sched_queues/README.rst new file mode 100644 index 0000000000000..94bd45d41f617 --- /dev/null +++ b/tests/benchmarks/sched_queues/README.rst @@ -0,0 +1,21 @@ +Scheduling Queue Measurements +############################# + +A Zephyr application developer may choose between three different scheduling +algorithms--dumb, scalable and multiq. These different algorithms have +different performance characteristics--characteristics that vary as the +number of ready threads increases. This benchmark can be used to help +determine which scheduling algorithm may best suit the developer's application. + +This benchmark measures the ... +* Time to add a threads of increasing priority to the ready queue +* Time to add threads of decreasing priority to the ready queue +* Time to remove highest priority thread from a wait queue +* Time to remove lowest priority thread from a wait queue + +By default, these tests show the minimum, maximum, and averages of the measured +times. However, if the verbose option is enabled then the set of measured +times will be displayed. The following will build this project with verbose +support: + + EXTRA_CONF_FILE="prj.verbose.conf" west build -p -b diff --git a/tests/benchmarks/sched_queues/prj.conf b/tests/benchmarks/sched_queues/prj.conf new file mode 100644 index 0000000000000..2840887ae5ef7 --- /dev/null +++ b/tests/benchmarks/sched_queues/prj.conf @@ -0,0 +1,31 @@ +# Default base configuration file + +CONFIG_TEST=y + +# eliminate timer interrupts during the benchmark +CONFIG_SYS_CLOCK_TICKS_PER_SEC=1 + +# We use irq_offload(), enable it +CONFIG_IRQ_OFFLOAD=y + +# Reduce memory/code footprint +CONFIG_BT=n +CONFIG_FORCE_NO_ASSERT=y + +CONFIG_TEST_HW_STACK_PROTECTION=n +# Disable HW Stack Protection (see #28664) +CONFIG_HW_STACK_PROTECTION=n +CONFIG_COVERAGE=n + +# Disable system power management +CONFIG_PM=n + +CONFIG_TIMING_FUNCTIONS=y + +CONFIG_HEAP_MEM_POOL_SIZE=2048 +CONFIG_APPLICATION_DEFINED_SYSCALL=y + +# Disable time slicing +CONFIG_TIMESLICING=n + +CONFIG_SPEED_OPTIMIZATIONS=y diff --git a/tests/benchmarks/sched_queues/prj.verbose.conf b/tests/benchmarks/sched_queues/prj.verbose.conf new file mode 100644 index 0000000000000..b6204397ceadf --- /dev/null +++ b/tests/benchmarks/sched_queues/prj.verbose.conf @@ -0,0 +1,4 @@ +# Extra configuration file to enable verbose reporting +# Use with EXTRA_CONF_FILE + +CONFIG_BENCHMARK_VERBOSE=y diff --git a/tests/benchmarks/sched_queues/src/main.c b/tests/benchmarks/sched_queues/src/main.c new file mode 100644 index 0000000000000..669f0fd633efc --- /dev/null +++ b/tests/benchmarks/sched_queues/src/main.c @@ -0,0 +1,328 @@ +/* + * Copyright (c) 2024 Intel Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * @file + * This file contains the main testing module that invokes all the tests. + */ + +#include +#include +#include "utils.h" +#include +#include + +#define TEST_STACK_SIZE (1024 + CONFIG_TEST_EXTRA_STACK_SIZE) +#define BUSY_STACK_SIZE (1024 + CONFIG_TEST_EXTRA_STACK_SIZE) + +uint32_t tm_off; + +/* + * Warning! Most of the created threads in this test use the same stack! + * This is done to reduce the memory footprint as having unique stacks + * for hundreds or thousands of threads would require substantial memory. + * We can get away with this approach as the threads sharing the same + * stack will not be executing, even though they will be ready to run. + */ + +static K_THREAD_STACK_DEFINE(test_stack, TEST_STACK_SIZE); + +K_THREAD_STACK_ARRAY_DEFINE(busy_stack, CONFIG_MP_MAX_NUM_CPUS - 1, BUSY_STACK_SIZE); +static struct k_thread busy_thread[CONFIG_MP_MAX_NUM_CPUS - 1]; + +static struct k_thread test_thread[CONFIG_BENCHMARK_NUM_THREADS]; + +static uint64_t add_cycles[CONFIG_BENCHMARK_NUM_THREADS]; +static uint64_t remove_cycles[CONFIG_BENCHMARK_NUM_THREADS]; + +extern void z_unready_thread(struct k_thread *thread); + +static void busy_entry(void *p1, void *p2, void *p3) +{ + ARG_UNUSED(p1); + ARG_UNUSED(p2); + ARG_UNUSED(p3); + + while (1) { + } +} + +/** + * The test entry routine is not expected to execute. + */ +static void test_entry(void *p1, void *p2, void *p3) +{ + ARG_UNUSED(p2); + ARG_UNUSED(p3); + + printk("Thread %u unexpectedly executed\n", + (unsigned int)(uintptr_t)p1); + + while (1) { + } +} + +static void start_threads(unsigned int num_threads) +{ + unsigned int i; + unsigned int bucket_size; + + /* Start the busy threads to execute on the other processors */ + + for (i = 0; i < CONFIG_MP_MAX_NUM_CPUS - 1; i++) { + k_thread_create(&busy_thread[i], busy_stack[i], BUSY_STACK_SIZE, + busy_entry, NULL, NULL, NULL, + -1, 0, K_NO_WAIT); + } + + bucket_size = (num_threads / CONFIG_NUM_PREEMPT_PRIORITIES) + 1; + + for (i = 0; i < CONFIG_BENCHMARK_NUM_THREADS; i++) { + k_thread_create(&test_thread[i], test_stack, TEST_STACK_SIZE, + test_entry, (void *)(uintptr_t)i, NULL, NULL, + i / bucket_size, 0, K_NO_WAIT); + } +} + +static void cycles_reset(unsigned int num_threads) +{ + unsigned int i; + + for (i = 0; i < num_threads; i++) { + add_cycles[i] = 0ULL; + remove_cycles[i] = 0ULL; + } +} + +static void test_decreasing_priority(unsigned int num_threads) +{ + unsigned int i; + timing_t start; + timing_t finish; + + for (i = num_threads; i > 0; i--) { + start = timing_counter_get(); + z_unready_thread(&test_thread[i - 1]); + finish = timing_counter_get(); + remove_cycles[i - 1] += timing_cycles_get(&start, &finish); + } + + for (i = 0; i < num_threads; i++) { + start = timing_counter_get(); + z_ready_thread(&test_thread[i]); + finish = timing_counter_get(); + add_cycles[i] += timing_cycles_get(&start, &finish); + } +} + +static void test_increasing_priority(unsigned int num_threads) +{ + unsigned int i; + timing_t start; + timing_t finish; + + for (i = num_threads; i > 0; i--) { + start = timing_counter_get(); + z_unready_thread(&test_thread[num_threads - i]); + finish = timing_counter_get(); + remove_cycles[i - 1] += timing_cycles_get(&start, &finish); + } + + for (i = num_threads; i > 0; i--) { + start = timing_counter_get(); + z_ready_thread(&test_thread[i - 1]); + finish = timing_counter_get(); + add_cycles[num_threads - i] += timing_cycles_get(&start, &finish); + } +} + +static uint64_t sqrt_u64(uint64_t square) +{ + if (square > 1) { + uint64_t lo = sqrt_u64(square >> 2) << 1; + uint64_t hi = lo + 1; + + return ((hi * hi) > square) ? lo : hi; + } + + return square; +} + +static void compute_and_report_stats(unsigned int num_threads, + unsigned int num_iterations, + uint64_t *cycles, + const char *str) +{ + uint64_t minimum = cycles[0]; + uint64_t maximum = cycles[0]; + uint64_t total = cycles[0]; + uint64_t average; + uint64_t std_dev = 0; + uint64_t tmp; + uint64_t diff; + unsigned int i; + + for (i = 1; i < num_threads; i++) { + if (cycles[i] > maximum) { + maximum = cycles[i]; + } + + if (cycles[i] < minimum) { + minimum = cycles[i]; + } + + total += cycles[i]; + } + + minimum /= (uint64_t)num_iterations; + maximum /= (uint64_t)num_iterations; + average = total / (num_threads * num_iterations); + + for (i = 0; i < num_threads; i++) { + tmp = cycles[i] / num_iterations; + diff = (average > tmp) ? (average - tmp) : (tmp - average); + + std_dev += (diff * diff); + } + std_dev /= num_threads; + std_dev = sqrt_u64(std_dev); + + printk("%s\n", str); + + printk(" Minimum : %7llu cycles (%7u nsec)\n", + minimum, (uint32_t)timing_cycles_to_ns(minimum)); + printk(" Maximum : %7llu cycles (%7u nsec)\n", + maximum, (uint32_t)timing_cycles_to_ns(maximum)); + printk(" Average : %7llu cycles (%7u nsec)\n", + average, (uint32_t)timing_cycles_to_ns(average)); + printk(" Std Deviation: %7llu cycles (%7u nsec)\n", + std_dev, (uint32_t)timing_cycles_to_ns(std_dev)); +} + +int main(void) +{ + unsigned int i; + unsigned int freq; +#ifdef CONFIG_BENCHMARK_VERBOSE + char description[120]; + char tag[50]; + struct k_thread *thread; +#endif + + timing_init(); + + bench_test_init(); + + freq = timing_freq_get_mhz(); + + printk("Time Measurements for %s sched queues\n", + IS_ENABLED(CONFIG_SCHED_DUMB) ? "dumb" : + IS_ENABLED(CONFIG_SCHED_SCALABLE) ? "scalable" : "multiq"); + printk("Timing results: Clock frequency: %u MHz\n", freq); + + start_threads(CONFIG_BENCHMARK_NUM_THREADS); + + timing_start(); + + cycles_reset(CONFIG_BENCHMARK_NUM_THREADS); + + for (i = 0; i < CONFIG_BENCHMARK_NUM_ITERATIONS; i++) { + test_decreasing_priority(CONFIG_BENCHMARK_NUM_THREADS); + } + + compute_and_report_stats(CONFIG_BENCHMARK_NUM_THREADS, + CONFIG_BENCHMARK_NUM_ITERATIONS, + add_cycles, + "Add threads of decreasing priority"); + +#ifdef CONFIG_BENCHMARK_VERBOSE + for (i = 0; i < CONFIG_BENCHMARK_NUM_THREADS; i++) { + snprintf(tag, sizeof(tag), + "ReadyQ.add.to.tail.%04u.waiters", i); + snprintf(description, sizeof(description), + "%-40s - Add thread of priority (%u)", + tag, test_thread[i].base.prio); + PRINT_STATS_AVG(description, (uint32_t)add_cycles[i], + CONFIG_BENCHMARK_NUM_ITERATIONS); + } +#endif + + printk("------------------------------------\n"); + + compute_and_report_stats(CONFIG_BENCHMARK_NUM_THREADS, + CONFIG_BENCHMARK_NUM_ITERATIONS, + remove_cycles, + "Remove threads of decreasing priority"); + +#ifdef CONFIG_BENCHMARK_VERBOSE + for (i = 0; i < CONFIG_BENCHMARK_NUM_THREADS; i++) { + snprintf(tag, sizeof(tag), + "ReadyQ.remove.from.head.%04u.waiters", i); + snprintf(description, sizeof(description), + "%-40s - Remove thread of priority %u", + tag, test_thread[i].base.prio); + PRINT_STATS_AVG(description, (uint32_t)remove_cycles[i], + CONFIG_BENCHMARK_NUM_ITERATIONS); + } +#endif + + printk("------------------------------------\n"); + + cycles_reset(CONFIG_BENCHMARK_NUM_THREADS); + + for (i = 0; i < CONFIG_BENCHMARK_NUM_ITERATIONS; i++) { + test_increasing_priority(CONFIG_BENCHMARK_NUM_THREADS); + } + + compute_and_report_stats(CONFIG_BENCHMARK_NUM_THREADS, + CONFIG_BENCHMARK_NUM_ITERATIONS, + add_cycles, + "Add threads of increasing priority"); + +#ifdef CONFIG_BENCHMARK_VERBOSE + for (i = 0; i < CONFIG_BENCHMARK_NUM_THREADS; i++) { + snprintf(tag, sizeof(tag), + "ReadyQ.add.to.head.%04u.waiters", i); + thread = &test_thread[CONFIG_BENCHMARK_NUM_THREADS - i - 1]; + snprintf(description, sizeof(description), + "%-40s - Add priority %u to readyq", + tag, thread->base.prio); + PRINT_STATS_AVG(description, (uint32_t)add_cycles[i], + CONFIG_BENCHMARK_NUM_ITERATIONS); + } +#endif + + printk("------------------------------------\n"); + + compute_and_report_stats(CONFIG_BENCHMARK_NUM_THREADS, + CONFIG_BENCHMARK_NUM_ITERATIONS, + remove_cycles, + "Remove threads or increasing priority"); + +#ifdef CONFIG_BENCHMARK_VERBOSE + for (i = 0; i < CONFIG_BENCHMARK_NUM_THREADS; i++) { + snprintf(tag, sizeof(tag), + "ReadyQ.remove.from.tail.%04u.waiters", + CONFIG_BENCHMARK_NUM_THREADS - i); + thread = &test_thread[CONFIG_BENCHMARK_NUM_THREADS - i - 1]; + snprintf(description, sizeof(description), + "%-40s - Remove lowest priority from readyq (%u)", + tag, thread->base.prio); + PRINT_STATS_AVG(description, (uint32_t)remove_cycles[i], + CONFIG_BENCHMARK_NUM_ITERATIONS); + } +#endif + + for (i = 0; i < CONFIG_BENCHMARK_NUM_THREADS; i++) { + k_thread_abort(&test_thread[i]); + } + + timing_stop(); + + TC_END_REPORT(0); + + return 0; +} diff --git a/tests/benchmarks/sched_queues/src/utils.h b/tests/benchmarks/sched_queues/src/utils.h new file mode 100644 index 0000000000000..cca95dfc02adc --- /dev/null +++ b/tests/benchmarks/sched_queues/src/utils.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2024 Intel Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef __BENCHMARK_SCHEDQ_UTILS_H +#define __BENCHMARK_SCHEDQ_UTILS_H +/* + * @brief This file contains macros used in the scheduler queue benchmarking. + */ + +#include +#include +#include + +#ifdef CSV_FORMAT_OUTPUT +#define FORMAT_STR "%-74s,%s,%s\n" +#define CYCLE_FORMAT "%8u" +#define NSEC_FORMAT "%8u" +#else +#define FORMAT_STR "%-74s:%s , %s\n" +#define CYCLE_FORMAT "%8u cycles" +#define NSEC_FORMAT "%8u ns" +#endif + +/** + * @brief Display a line of statistics + * + * This macro displays the following: + * 1. Test description summary + * 2. Number of cycles + * 3. Number of nanoseconds + */ +#define PRINT_F(summary, cycles, nsec) \ + do { \ + char cycle_str[32]; \ + char nsec_str[32]; \ + \ + snprintk(cycle_str, 30, CYCLE_FORMAT, cycles); \ + snprintk(nsec_str, 30, NSEC_FORMAT, nsec); \ + printk(FORMAT_STR, summary, cycle_str, nsec_str); \ + } while (0) + +#define PRINT_STATS(summary, value) \ + PRINT_F(summary, value, \ + (uint32_t)timing_cycles_to_ns(value)) + +#define PRINT_STATS_AVG(summary, value, counter) \ + PRINT_F(summary, value / counter, \ + (uint32_t)timing_cycles_to_ns_avg(value, counter)) + + +#endif diff --git a/tests/benchmarks/sched_queues/testcase.yaml b/tests/benchmarks/sched_queues/testcase.yaml new file mode 100644 index 0000000000000..e3ecc3b34264e --- /dev/null +++ b/tests/benchmarks/sched_queues/testcase.yaml @@ -0,0 +1,25 @@ +common: + tags: + - kernel + - benchmark + integration_platforms: + - qemu_x86 + - qemu_cortex_a53 + harness: console + harness_config: + type: one_line + regex: + - "PROJECT EXECUTION SUCCESSFUL" + +tests: + benchmark.sched_queues.dumb: + extra_configs: + - CONFIG_SCHED_DUMB=y + + benchmark.sched_queues.scalable: + extra_configs: + - CONFIG_SCHED_SCALABLE=y + + benchmark.sched_queues.multiq: + extra_configs: + - CONFIG_SCHED_MULTIQ=y From 470cbe36d72562dc48afd222d84d4be4b9e98d5a Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Mon, 7 Oct 2024 23:52:38 +0200 Subject: [PATCH 0385/4482] tests: bluetooth: disable CDC ACM logging Disable CDC ACM logging in configuraton overlay used in test case bluetooth.shell.cdc_acm. The build warning was introduced by the commit e8c4867806cf ("usb: cdc_acm: disable logging if used for shell with logging") to preven recursive logging when using the CDC ACM UART as shell or logging backend Signed-off-by: Johann Fischer --- tests/bluetooth/shell/cdc_acm.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/bluetooth/shell/cdc_acm.conf b/tests/bluetooth/shell/cdc_acm.conf index 3e95d3badc797..c69afa40dd860 100644 --- a/tests/bluetooth/shell/cdc_acm.conf +++ b/tests/bluetooth/shell/cdc_acm.conf @@ -1,5 +1,6 @@ CONFIG_USB_DEVICE_STACK=y CONFIG_USB_DEVICE_PRODUCT="Zephyr BT Shell" +CONFIG_USB_CDC_ACM_LOG_LEVEL_OFF=y CONFIG_UART_LINE_CTRL=y CONFIG_SHELL_BACKEND_SERIAL_CHECK_DTR=y From a29db9800ed7b992c107ef30142890fffc7c83de Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Mon, 7 Oct 2024 13:02:26 +1000 Subject: [PATCH 0386/4482] modules: mbedtls: compile PAKE with PSA When building with `MBEDTLS_PSA_CRYPTO_C` enabled, compile in the PAKE (Password-authenticated key exchange) implementation. Signed-off-by: Jordan Yates --- modules/mbedtls/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/mbedtls/CMakeLists.txt b/modules/mbedtls/CMakeLists.txt index c8caa1fd9f655..e2bbe13f50257 100644 --- a/modules/mbedtls/CMakeLists.txt +++ b/modules/mbedtls/CMakeLists.txt @@ -145,6 +145,7 @@ zephyr_interface_library_named(mbedTLS) ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_ffdh.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_hash.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_mac.c + ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_pake.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_rsa.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_se.c ${ZEPHYR_CURRENT_MODULE_DIR}/library/psa_crypto_storage.c From a6b911f1952c226eeb8099e2e657f4f19ec3c41a Mon Sep 17 00:00:00 2001 From: Benedek Kupper Date: Fri, 4 Oct 2024 09:03:50 +0200 Subject: [PATCH 0387/4482] usb: device_next: USB reset clears remote wakeup permission Verbatim from USB 2.0 specification: The Remote Wakeup field indicates whether the device is currently enabled to request remote wakeup. The default mode for devices that support remote wakeup is disabled. If D1 is reset to zero, the ability of the device to signal remote wakeup is disabled. If D1 is set to one, the ability of the device to signal remote wakeup is enabled. The Remote Wakeup field can be modified by the SetFeature() and ClearFeature() requests using the DEVICE_REMOTE_WAKEUP feature selector. This field is reset to zero when the device is reset. Signed-off-by: Benedek Kupper --- subsys/usb/device_next/usbd_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subsys/usb/device_next/usbd_core.c b/subsys/usb/device_next/usbd_core.c index e6f1cf1faee73..2502357bf8c6f 100644 --- a/subsys/usb/device_next/usbd_core.c +++ b/subsys/usb/device_next/usbd_core.c @@ -127,6 +127,8 @@ static int event_handler_bus_reset(struct usbd_context *const uds_ctx) uds_ctx->ch9_data.state = USBD_STATE_DEFAULT; + uds_ctx->status.rwup = false; + return 0; } From 89995d056803439f68369e44748193159ac1a0d2 Mon Sep 17 00:00:00 2001 From: Ayush Singh Date: Fri, 4 Oct 2024 12:00:50 +0530 Subject: [PATCH 0388/4482] boards: ti: cc1352p7_launchpad: Remove PINCTRL - PINCTRL is now being selected by soc/ti/simplelink/cc13x2x7_cc26x2x7/Kconfig, so no need to add to diffconfig. - See https://github.com/zephyrproject-rtos/zephyr/pull/64718#discussion_r1734288793 Signed-off-by: Ayush Singh --- boards/ti/cc1352p7_launchpad/cc1352p7_lp_defconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/boards/ti/cc1352p7_launchpad/cc1352p7_lp_defconfig b/boards/ti/cc1352p7_launchpad/cc1352p7_lp_defconfig index 42ca455ed3302..4e65416ca5373 100644 --- a/boards/ti/cc1352p7_launchpad/cc1352p7_lp_defconfig +++ b/boards/ti/cc1352p7_launchpad/cc1352p7_lp_defconfig @@ -16,7 +16,6 @@ CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_PIN=15 CONFIG_ARM_MPU=y CONFIG_HW_STACK_PROTECTION=y -CONFIG_PINCTRL=y CONFIG_GPIO=y CONFIG_SERIAL=y From c506cf5e83f912502221773264d13248bdf0c8c4 Mon Sep 17 00:00:00 2001 From: Ayush Singh Date: Fri, 4 Oct 2024 12:02:47 +0530 Subject: [PATCH 0389/4482] boards: ti: beagleconnect_freedom: Remove PINCTRL - PINCTRL is now being selected by soc/ti/simplelink/cc13x2x7_cc26x2x7/Kconfig, so no need to add to diffconfig. - See https://github.com/zephyrproject-rtos/zephyr/pull/64718#discussion_r1734288793 Signed-off-by: Ayush Singh --- .../beagle/beagleconnect_freedom/beagleconnect_freedom_defconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/boards/beagle/beagleconnect_freedom/beagleconnect_freedom_defconfig b/boards/beagle/beagleconnect_freedom/beagleconnect_freedom_defconfig index 024c0463996e9..194d0cf76a569 100644 --- a/boards/beagle/beagleconnect_freedom/beagleconnect_freedom_defconfig +++ b/boards/beagle/beagleconnect_freedom/beagleconnect_freedom_defconfig @@ -6,7 +6,6 @@ # CONFIG_GPIO=y -CONFIG_PINCTRL=y CONFIG_BUILD_OUTPUT_HEX=y # custom callback for the antenna switch From 559f05d3f3746c808c0daebaee85a27463b5078e Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Thu, 3 Oct 2024 22:48:00 -0700 Subject: [PATCH 0390/4482] doc: security: Disclose CVE-2024-6442 Disclose information about published CVE. Signed-off-by: Flavio Ceolin --- doc/security/vulnerabilities.rst | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/security/vulnerabilities.rst b/doc/security/vulnerabilities.rst index 70e26555897e3..6d0cf0ff018cb 100644 --- a/doc/security/vulnerabilities.rst +++ b/doc/security/vulnerabilities.rst @@ -1842,7 +1842,18 @@ This has been fixed in main for v3.7.0 CVE-2024-6442 ------------- -Under embargo until 2024-09-22 +Bluetooth: ASCS Unchecked tailroom of the response buffer + +- `Zephyr project bug tracker GHSA-m22j-ccg7-4v4h + `_ + +This has been fixed in main for v3.7.0 + +- `PR 74976 fix for main + `_ + +- `PR 77958 fix for 3.6 + `_ CVE-2024-6443 ------------- From 05c60db5a84e1ce6f66d21344e446de19f9a6a40 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Thu, 3 Oct 2024 23:06:45 -0700 Subject: [PATCH 0391/4482] doc: security: Disclose CVE-2024-6443 Disclose information about published CVE. Signed-off-by: Flavio Ceolin --- doc/security/vulnerabilities.rst | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/security/vulnerabilities.rst b/doc/security/vulnerabilities.rst index 6d0cf0ff018cb..6b0c9b46a4d92 100644 --- a/doc/security/vulnerabilities.rst +++ b/doc/security/vulnerabilities.rst @@ -1858,7 +1858,18 @@ This has been fixed in main for v3.7.0 CVE-2024-6443 ------------- -Under embargo until 2024-09-22 +zephyr: out-of-bound read in utf8_trunc + +- `Zephyr project bug tracker GHSA-gg46-3rh2-v765 + `_ + +This has been fixed in main for v3.7.0 + +- `PR 74949 fix for main + `_ + +- `PR 78286 fix for 3.6 + `_ CVE-2024-6444 ------------- From 9100a8b84895ebe1b568971b4a4a3aa9400d3e89 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Thu, 3 Oct 2024 23:18:56 -0700 Subject: [PATCH 0392/4482] doc: security: Disclose CVE-2024-6444 Disclose information about published CVE. Signed-off-by: Flavio Ceolin --- doc/security/vulnerabilities.rst | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/security/vulnerabilities.rst b/doc/security/vulnerabilities.rst index 6b0c9b46a4d92..3143ef2eca274 100644 --- a/doc/security/vulnerabilities.rst +++ b/doc/security/vulnerabilities.rst @@ -1874,7 +1874,18 @@ This has been fixed in main for v3.7.0 CVE-2024-6444 ------------- -Under embargo until 2024-09-22 +Bluetooth: ots: missing buffer length check + +- `Zephyr project bug tracker GHSA-qj4r-chj6-h7qp + `_ + +This has been fixed in main for v3.7.0 + +- `PR 74944 fix for main + `_ + +- `PR 77954 fix for 3.6 + `_ CVE-2024-8798 ------------- From 022122d659a7c10180b8a91c6a0b49874f2850fa Mon Sep 17 00:00:00 2001 From: Lukasz Stepnicki Date: Thu, 3 Oct 2024 21:37:38 +0200 Subject: [PATCH 0393/4482] boards: nordic: ipc node added dcache alignement dcache-alignement needs to be defined for ipc to have consistent memory organization on both endpoints, when shared memory is cacheable. nrf54h20 and nrf9280 are using cacheable shared memory. This is applied for ipc with icmsg backend. Signed-off-by: Lukasz Stepnicki --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi | 6 ++++++ boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-ipc_conf.dtsi | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi index a17889fe0b029..0b866a889f62f 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi @@ -9,6 +9,7 @@ cpusec_cpuapp_ipc: ipc-1-2 { compatible = "zephyr,ipc-icmsg"; status = "disabled"; + dcache-alignment = <32>; mboxes = <&cpusec_bellboard 12>, <&cpuapp_bellboard 0>; }; @@ -16,6 +17,7 @@ cpusec_cpurad_ipc: ipc-1-3 { compatible = "zephyr,ipc-icmsg"; status = "disabled"; + dcache-alignment = <32>; mboxes = <&cpusec_bellboard 18>, <&cpurad_bellboard 0>; }; @@ -30,6 +32,7 @@ cpuapp_cpusys_ipc: ipc-2-12 { compatible = "zephyr,ipc-icmsg"; status = "disabled"; + dcache-alignment = <32>; mboxes = <&cpuapp_bellboard 6>, <&cpusys_vevif 12>; }; @@ -37,6 +40,7 @@ cpuapp_cpuppr_ipc: ipc-2-13 { compatible = "zephyr,ipc-icmsg"; status = "disabled"; + dcache-alignment = <32>; mboxes = <&cpuapp_bellboard 13>, <&cpuppr_vevif 12>; }; @@ -44,6 +48,7 @@ cpuapp_cpuflpr_ipc: ipc-2-14 { compatible = "zephyr,ipc-icmsg"; status = "disabled"; + dcache-alignment = <32>; mboxes = <&cpuapp_bellboard 14>, <&cpuflpr_vevif 16>; }; @@ -51,6 +56,7 @@ cpurad_cpusys_ipc: ipc-3-12 { compatible = "zephyr,ipc-icmsg"; status = "disabled"; + dcache-alignment = <32>; mboxes = <&cpurad_bellboard 6>, <&cpusys_vevif 18>; }; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-ipc_conf.dtsi b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-ipc_conf.dtsi index 944dd7fb6abd0..f3a05ee5a05b3 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-ipc_conf.dtsi +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-ipc_conf.dtsi @@ -9,6 +9,7 @@ cpusec_cpuapp_ipc: ipc-1-2 { compatible = "zephyr,ipc-icmsg"; status = "disabled"; + dcache-alignment = <32>; mboxes = <&cpusec_bellboard 12>, <&cpuapp_bellboard 0>; }; @@ -16,6 +17,7 @@ cpusec_cpurad_ipc: ipc-1-3 { compatible = "zephyr,ipc-icmsg"; status = "disabled"; + dcache-alignment = <32>; mboxes = <&cpusec_bellboard 18>, <&cpurad_bellboard 0>; }; @@ -30,6 +32,7 @@ cpuapp_cpusys_ipc: ipc-2-12 { compatible = "zephyr,ipc-icmsg"; status = "disabled"; + dcache-alignment = <32>; mboxes = <&cpuapp_bellboard 6>, <&cpusys_vevif 12>; }; @@ -37,6 +40,7 @@ cpuapp_cpuppr_ipc: ipc-2-13 { compatible = "zephyr,ipc-icmsg"; status = "disabled"; + dcache-alignment = <32>; mboxes = <&cpuapp_bellboard 13>, <&cpuppr_vevif 12>; }; @@ -44,6 +48,7 @@ cpurad_cpusys_ipc: ipc-3-12 { compatible = "zephyr,ipc-icmsg"; status = "disabled"; + dcache-alignment = <32>; mboxes = <&cpurad_bellboard 6>, <&cpusys_vevif 18>; }; From 6551e4083ff527437d79b78d4fa437b64f615cee Mon Sep 17 00:00:00 2001 From: Rex Chen Date: Sun, 29 Sep 2024 18:38:42 +0900 Subject: [PATCH 0394/4482] samples: net: wifi: enable time checking for mbedtls cert files enable time checking for mbedtls certificate files, return failed if certificate files expired. Signed-off-by: Rex Chen --- samples/net/wifi/boards/rd_rw612_bga.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/net/wifi/boards/rd_rw612_bga.conf b/samples/net/wifi/boards/rd_rw612_bga.conf index e6ec09aff90d1..a916ff131adc9 100644 --- a/samples/net/wifi/boards/rd_rw612_bga.conf +++ b/samples/net/wifi/boards/rd_rw612_bga.conf @@ -92,6 +92,7 @@ CONFIG_MBEDTLS=y CONFIG_MBEDTLS_BUILTIN=y CONFIG_MBEDTLS_USER_CONFIG_ENABLE=y CONFIG_MBEDTLS_USER_CONFIG_FILE="wpa_supp_els_pkc_mbedtls_config.h" +CONFIG_MBEDTLS_HAVE_TIME_DATE=y # Include els_pkc in build CONFIG_ENTROPY_GENERATOR=y From 5a195001e393fcfbb48111f8376e45b2bb63b233 Mon Sep 17 00:00:00 2001 From: Rex Chen Date: Sun, 29 Sep 2024 18:30:00 +0900 Subject: [PATCH 0395/4482] net: wifi: shell: add reg domain support Supp api add reg domain support. Signed-off-by: Rex Chen --- modules/hostap/src/supp_api.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index d9d7abae8a398..74c7add052345 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -1143,13 +1143,44 @@ int supplicant_reg_domain(const struct device *dev, struct wifi_reg_domain *reg_domain) { const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_mgmt_api(dev); + struct wpa_supplicant *wpa_s; + int ret = -1; if (!wifi_mgmt_api || !wifi_mgmt_api->reg_domain) { wpa_printf(MSG_ERROR, "Regulatory domain not supported"); return -ENOTSUP; } - return wifi_mgmt_api->reg_domain(dev, reg_domain); + if (reg_domain->oper == WIFI_MGMT_GET) { + return wifi_mgmt_api->reg_domain(dev, reg_domain); + } + + if (reg_domain->oper == WIFI_MGMT_SET) { + k_mutex_lock(&wpa_supplicant_mutex, K_FOREVER); + + wpa_s = get_wpa_s_handle(dev); + if (!wpa_s) { + wpa_printf(MSG_ERROR, "Interface %s not found", dev->name); + goto out; + } + + if (!wpa_cli_cmd_v("set country %s", reg_domain->country_code)) { + goto out; + } + +#ifdef CONFIG_WIFI_NM_HOSTAPD_AP + if (!hostapd_cli_cmd_v("set country_code %s", reg_domain->country_code)) { + goto out; + } +#endif + + ret = 0; + +out: + k_mutex_unlock(&wpa_supplicant_mutex); + } + + return ret; } int supplicant_mode(const struct device *dev, struct wifi_mode_info *mode) From 6f072ba77422ffea121021947c87dfc9499db94c Mon Sep 17 00:00:00 2001 From: Firas Sammoura Date: Fri, 27 Sep 2024 17:58:53 +0000 Subject: [PATCH 0396/4482] Ztest: Including the missing C standard library header The ztest.c calls atoi, which is provided by the C standard library. Remove the conditional inclusion of the C standard library with the definition of CONFIG_ZTEST_SHUFFLE. Signed-off-by: Firas Sammoura --- subsys/testsuite/ztest/src/ztest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/testsuite/ztest/src/ztest.c b/subsys/testsuite/ztest/src/ztest.c index dcf19d56dbdbf..d2a9fe8051da6 100644 --- a/subsys/testsuite/ztest/src/ztest.c +++ b/subsys/testsuite/ztest/src/ztest.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include #include @@ -27,7 +28,6 @@ static bool failed_expectation; #endif #ifdef CONFIG_ZTEST_SHUFFLE -#include #include #include #ifndef CONFIG_ZTEST_REPEAT From 98289e594ded291a934b32c8b0672d095e7ffe7d Mon Sep 17 00:00:00 2001 From: Adrian Friedli Date: Thu, 26 Sep 2024 15:12:00 +0200 Subject: [PATCH 0397/4482] net: lib: coap: make ACK random factor runtime configurable Extend the `coap_transmission_parameters` struct with the field `ack_random_percent`. This was the last remaining CoAP transmission parameter that was not configurable at runtime. Signed-off-by: Adrian Friedli --- include/zephyr/net/coap.h | 9 ++++++++- subsys/net/lib/coap/coap.c | 8 ++++++-- tests/net/lib/coap/src/main.c | 6 ++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/include/zephyr/net/coap.h b/include/zephyr/net/coap.h index bf0d86cfaf7d5..7a0c7ee7f91db 100644 --- a/include/zephyr/net/coap.h +++ b/include/zephyr/net/coap.h @@ -355,8 +355,15 @@ typedef int (*coap_reply_t)(const struct coap_packet *response, * @brief CoAP transmission parameters. */ struct coap_transmission_parameters { - /** Initial ACK timeout. Value is used as a base value to retry pending CoAP packets. */ + /** Initial ACK timeout. Value is used as a base value to retry pending CoAP packets. */ uint32_t ack_timeout; +#if defined(CONFIG_COAP_RANDOMIZE_ACK_TIMEOUT) || defined(__DOXYGEN__) + /** + * Set CoAP ack random factor. A value of 150 means a factor of 1.5. A value of 0 defaults + * to @kconfig{CONFIG_COAP_ACK_RANDOM_PERCENT}. The value must be >= 100. + */ + uint16_t ack_random_percent; +#endif /* defined(CONFIG_COAP_RANDOMIZE_ACK_TIMEOUT) */ /** Set CoAP retry backoff factor. A value of 200 means a factor of 2.0. */ uint16_t coap_backoff_percent; /** Maximum number of retransmissions. */ diff --git a/subsys/net/lib/coap/coap.c b/subsys/net/lib/coap/coap.c index c557f3c424b59..25ad262c9234f 100644 --- a/subsys/net/lib/coap/coap.c +++ b/subsys/net/lib/coap/coap.c @@ -59,6 +59,9 @@ static uint16_t message_id; static struct coap_transmission_parameters coap_transmission_params = { .max_retransmission = CONFIG_COAP_MAX_RETRANSMIT, .ack_timeout = CONFIG_COAP_INIT_ACK_TIMEOUT_MS, +#if defined(CONFIG_COAP_RANDOMIZE_ACK_TIMEOUT) + .ack_random_percent = CONFIG_COAP_ACK_RANDOM_PERCENT, +#endif /* defined(CONFIG_COAP_RANDOMIZE_ACK_TIMEOUT) */ .coap_backoff_percent = CONFIG_COAP_BACKOFF_PERCENT }; @@ -1706,8 +1709,9 @@ struct coap_pending *coap_pending_next_to_expire( static uint32_t init_ack_timeout(const struct coap_transmission_parameters *params) { #if defined(CONFIG_COAP_RANDOMIZE_ACK_TIMEOUT) - const uint32_t max_ack = params->ack_timeout * - CONFIG_COAP_ACK_RANDOM_PERCENT / 100; + const uint16_t random_percent = params->ack_random_percent ? params->ack_random_percent + : CONFIG_COAP_ACK_RANDOM_PERCENT; + const uint32_t max_ack = params->ack_timeout * random_percent / 100U; const uint32_t min_ack = params->ack_timeout; /* Randomly generated initial ACK timeout diff --git a/tests/net/lib/coap/src/main.c b/tests/net/lib/coap/src/main.c index 18012cc787313..10c7cef1d2c02 100644 --- a/tests/net/lib/coap/src/main.c +++ b/tests/net/lib/coap/src/main.c @@ -1750,12 +1750,15 @@ ZTEST(coap, test_transmission_parameters) params = coap_get_transmission_parameters(); zassert_equal(params.ack_timeout, CONFIG_COAP_INIT_ACK_TIMEOUT_MS, "Wrong ACK timeout"); + zassert_equal(params.ack_random_percent, CONFIG_COAP_ACK_RANDOM_PERCENT, + "Wrong ACK random percent"); zassert_equal(params.coap_backoff_percent, CONFIG_COAP_BACKOFF_PERCENT, "Wrong backoff percent"); zassert_equal(params.max_retransmission, CONFIG_COAP_MAX_RETRANSMIT, "Wrong max retransmission value"); params.ack_timeout = 1000; + params.ack_random_percent = 110; params.coap_backoff_percent = 150; params.max_retransmission = 2; @@ -1772,6 +1775,7 @@ ZTEST(coap, test_transmission_parameters) zassert_not_null(pending, "No free pending"); params.ack_timeout = 3000; + params.ack_random_percent = 130; params.coap_backoff_percent = 250; params.max_retransmission = 3; @@ -1780,6 +1784,7 @@ ZTEST(coap, test_transmission_parameters) zassert_equal(r, 0, "Could not initialize packet"); zassert_equal(pending->params.ack_timeout, 3000, "Wrong ACK timeout"); + zassert_equal(pending->params.ack_random_percent, 130, "Wrong ACK random percent"); zassert_equal(pending->params.coap_backoff_percent, 250, "Wrong backoff percent"); zassert_equal(pending->params.max_retransmission, 3, "Wrong max retransmission value"); @@ -1788,6 +1793,7 @@ ZTEST(coap, test_transmission_parameters) zassert_equal(r, 0, "Could not initialize packet"); zassert_equal(pending->params.ack_timeout, 1000, "Wrong ACK timeout"); + zassert_equal(pending->params.ack_random_percent, 110, "Wrong ACK random percent"); zassert_equal(pending->params.coap_backoff_percent, 150, "Wrong backoff percent"); zassert_equal(pending->params.max_retransmission, 2, "Wrong max retransmission value"); } From 458490480721ef38b7fc040fbc30fd1848795f7a Mon Sep 17 00:00:00 2001 From: Adrian Friedli Date: Fri, 27 Sep 2024 14:23:14 +0200 Subject: [PATCH 0398/4482] doc: releases: migration-guide-4.0: add note about changed CoAP struct Inform users about the new field in the `coap_transmission_parameters` struct. Signed-off-by: Adrian Friedli --- doc/releases/migration-guide-4.0.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index fcd9c5805e127..211a725ff2e15 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -348,6 +348,9 @@ Networking :c:func:`coap_get_block2_option` now accepts an additional ``bool *has_more`` parameter, to store the value of the more flag. (:github:`76052`) +* The struct :c:struct:`coap_transmission_parameters` has a new field ``ack_random_percent`` if + :kconfig:option:`CONFIG_COAP_RANDOMIZE_ACK_TIMEOUT` is enabled. (:github:`79058`) + * The Ethernet bridge shell is moved under network shell. This is done so that all the network shell activities can be found under ``net`` shell command. After this change the bridge shell is used by ``net bridge`` command. (:github:`77235`) From ab9cb58fed3fbdb72760f104c186d7b916b73055 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Fri, 13 Sep 2024 06:52:58 +0900 Subject: [PATCH 0399/4482] west.yml: Update revision of hal_renesas Update HAL to improve the BSP clock setting process. Signed-off-by: TOKITA Hiroshi --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index e6b06fc71fab1..192676713952a 100644 --- a/west.yml +++ b/west.yml @@ -214,7 +214,7 @@ manifest: - hal - name: hal_renesas path: modules/hal/renesas - revision: 1ec88911defaba8aebe265d57497cacfbb6afeb8 + revision: 3dafd030046f8d6f8a26080e9b9c1bcc92d45999 groups: - hal - name: hal_rpi_pico From 767d1ce5f6326d33e46b3886d5e4e6d5cb7208a5 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Thu, 12 Sep 2024 22:58:53 +0900 Subject: [PATCH 0400/4482] devicetree: Adding UNQUOTED, TOKEN, and UPPERTOKEN variants of FULL_NAME Like some other string properties, I will add a derived form to FULL_NAME to make it easier to reference from macros. Signed-off-by: TOKITA Hiroshi --- include/zephyr/devicetree.h | 86 +++++++++++++++++++++++++++++++++++++ scripts/dts/gen_defines.py | 6 +++ 2 files changed, 92 insertions(+) diff --git a/include/zephyr/devicetree.h b/include/zephyr/devicetree.h index 8cc9733fdff95..38a87238432b4 100644 --- a/include/zephyr/devicetree.h +++ b/include/zephyr/devicetree.h @@ -523,6 +523,92 @@ */ #define DT_NODE_FULL_NAME(node_id) DT_CAT(node_id, _FULL_NAME) +/** + * @brief Get the node's full name, including the unit-address, as an unquoted + * sequence of tokens + * + * This macro returns removed "the quotes" from the node's full name. + * + * Example devicetree fragment: + * + * @code{.dts} + * / { + * soc { + * node: my-node@12345678 { ... }; + * }; + * }; + * @endcode + * + * Example usage: + * + * @code{.c} + * DT_NODE_FULL_NAME_UNQUOTED(DT_NODELABEL(node)) // my-node@12345678 + * @endcode + * + * @param node_id node identifier + * @return the node's full name with unit-address as a sequence of tokens, + * with no quotes + */ +#define DT_NODE_FULL_NAME_UNQUOTED(node_id) DT_CAT(node_id, _FULL_NAME_UNQUOTED) + +/** + * @brief Get the node's full name, including the unit-address, as a token. + * + * This macro returns removed "the quotes" from the node's full name and + * converting any non-alphanumeric characters to underscores. + * + * Example devicetree fragment: + * + * @code{.dts} + * / { + * soc { + * node: my-node@12345678 { ... }; + * }; + * }; + * @endcode + * + * Example usage: + * + * @code{.c} + * DT_NODE_FULL_NAME_TOKEN(DT_NODELABEL(node)) // my_node_12345678 + * @endcode + * + * @param node_id node identifier + * @return the node's full name with unit-address as a token, i.e. without any quotes + * and with special characters converted to underscores + */ +#define DT_NODE_FULL_NAME_TOKEN(node_id) DT_CAT(node_id, _FULL_NAME_TOKEN) + +/** + * @brief Like DT_NODE_FULL_NAME_TOKEN(), but uppercased. + * + * This macro returns removed "the quotes" from the node's full name, + * converting any non-alphanumeric characters to underscores, and + * capitalizing the result. + * + * Example devicetree fragment: + * + * @code{.dts} + * / { + * soc { + * node: my-node@12345678 { ... }; + * }; + * }; + * @endcode + * + * Example usage: + * + * @code{.c} + * DT_NODE_FULL_NAME_UPPER_TOKEN(DT_NODELABEL(node)) // MY_NODE_12345678 + * @endcode + * + * @param node_id node identifier + * @return the node's full name with unit-address as an uppercased token, + * i.e. without any quotes and with special characters converted + * to underscores + */ +#define DT_NODE_FULL_NAME_UPPER_TOKEN(node_id) DT_CAT(node_id, _FULL_NAME_UPPER_TOKEN) + /** * @brief Get a devicetree node's index into its parent's list of children * diff --git a/scripts/dts/gen_defines.py b/scripts/dts/gen_defines.py index fb97faf36bf29..9c0e1c550f76b 100755 --- a/scripts/dts/gen_defines.py +++ b/scripts/dts/gen_defines.py @@ -74,6 +74,12 @@ def main(): out_comment("Node's name with unit-address:") out_dt_define(f"{node.z_path_id}_FULL_NAME", f'"{escape(node.name)}"') + out_dt_define(f"{node.z_path_id}_FULL_NAME_UNQUOTED", + f'{escape(node.name)}') + out_dt_define(f"{node.z_path_id}_FULL_NAME_TOKEN", + f'{edtlib.str_as_token(escape(node.name))}') + out_dt_define(f"{node.z_path_id}_FULL_NAME_UPPER_TOKEN", + f'{edtlib.str_as_token(escape(node.name)).upper()}') if node.parent is not None: out_comment(f"Node parent ({node.parent.path}) identifier:") From 91d8e72dd47e79eee6c80dc7979df5cdd0b7c9d6 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Wed, 11 Sep 2024 20:07:20 +0900 Subject: [PATCH 0401/4482] dts: renesas_ra: Rename dts node path Changes the path name of a DTS node so that it can be used as the stem of a BSP macro. All nodes to be changed are referenced via labels, so only the name is changed. Signed-off-by: TOKITA Hiroshi --- dts/arm/renesas/ra/ra2/r7fa2a1xh.dtsi | 2 +- dts/arm/renesas/ra/ra4/r7fa4e2b93cfm.dtsi | 2 +- dts/arm/renesas/ra/ra4/r7fa4m2ax.dtsi | 2 +- dts/arm/renesas/ra/ra4/r7fa4m3ax.dtsi | 2 +- dts/arm/renesas/ra/ra4/r7fa4w1ad2cng.dtsi | 2 +- dts/arm/renesas/ra/ra6/r7fa6e10x.dtsi | 2 +- dts/arm/renesas/ra/ra6/r7fa6e2bx.dtsi | 2 +- dts/arm/renesas/ra/ra6/r7fa6m1ad3cfp.dtsi | 2 +- dts/arm/renesas/ra/ra6/r7fa6m2ax.dtsi | 2 +- dts/arm/renesas/ra/ra6/r7fa6m3ax.dtsi | 2 +- dts/arm/renesas/ra/ra6/r7fa6m4ax.dtsi | 2 +- dts/arm/renesas/ra/ra6/r7fa6m5xh.dtsi | 2 +- dts/arm/renesas/ra/ra8/r7fa8d1xh.dtsi | 2 +- dts/arm/renesas/ra/ra8/r7fa8t1xh.dtsi | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dts/arm/renesas/ra/ra2/r7fa2a1xh.dtsi b/dts/arm/renesas/ra/ra2/r7fa2a1xh.dtsi index 57d2c9201a1cc..9139417ea2824 100644 --- a/dts/arm/renesas/ra/ra2/r7fa2a1xh.dtsi +++ b/dts/arm/renesas/ra/ra2/r7fa2a1xh.dtsi @@ -25,7 +25,7 @@ #address-cells = <1>; #size-cells = <1>; - xtal: clock-xtal { + xtal: clock-main-osc { compatible = "renesas,ra-cgc-external-clock"; clock-frequency = ; #clock-cells = <0>; diff --git a/dts/arm/renesas/ra/ra4/r7fa4e2b93cfm.dtsi b/dts/arm/renesas/ra/ra4/r7fa4e2b93cfm.dtsi index ce2185e097cdf..df7ee812a6919 100644 --- a/dts/arm/renesas/ra/ra4/r7fa4e2b93cfm.dtsi +++ b/dts/arm/renesas/ra/ra4/r7fa4e2b93cfm.dtsi @@ -46,7 +46,7 @@ #address-cells = <1>; #size-cells = <1>; - xtal: clock-xtal { + xtal: clock-main-osc { compatible = "renesas,ra-cgc-external-clock"; clock-frequency = ; #clock-cells = <0>; diff --git a/dts/arm/renesas/ra/ra4/r7fa4m2ax.dtsi b/dts/arm/renesas/ra/ra4/r7fa4m2ax.dtsi index d3e763b6e9ad1..333d70db07820 100644 --- a/dts/arm/renesas/ra/ra4/r7fa4m2ax.dtsi +++ b/dts/arm/renesas/ra/ra4/r7fa4m2ax.dtsi @@ -95,7 +95,7 @@ #address-cells = <1>; #size-cells = <1>; - xtal: clock-xtal { + xtal: clock-main-osc { compatible = "renesas,ra-cgc-external-clock"; clock-frequency = ; #clock-cells = <0>; diff --git a/dts/arm/renesas/ra/ra4/r7fa4m3ax.dtsi b/dts/arm/renesas/ra/ra4/r7fa4m3ax.dtsi index 524ac63224106..5bb6a46e5650b 100644 --- a/dts/arm/renesas/ra/ra4/r7fa4m3ax.dtsi +++ b/dts/arm/renesas/ra/ra4/r7fa4m3ax.dtsi @@ -105,7 +105,7 @@ #address-cells = <1>; #size-cells = <1>; - xtal: clock-xtal { + xtal: clock-main-osc { compatible = "renesas,ra-cgc-external-clock"; clock-frequency = ; #clock-cells = <0>; diff --git a/dts/arm/renesas/ra/ra4/r7fa4w1ad2cng.dtsi b/dts/arm/renesas/ra/ra4/r7fa4w1ad2cng.dtsi index 2be6da132529b..a6cd0df5edc9f 100644 --- a/dts/arm/renesas/ra/ra4/r7fa4w1ad2cng.dtsi +++ b/dts/arm/renesas/ra/ra4/r7fa4w1ad2cng.dtsi @@ -40,7 +40,7 @@ #address-cells = <1>; #size-cells = <1>; - xtal: clock-xtal { + xtal: clock-main-osc { compatible = "renesas,ra-cgc-external-clock"; clock-frequency = ; #clock-cells = <0>; diff --git a/dts/arm/renesas/ra/ra6/r7fa6e10x.dtsi b/dts/arm/renesas/ra/ra6/r7fa6e10x.dtsi index b92f8a3ead602..9e3dfe76ba6f7 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6e10x.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6e10x.dtsi @@ -95,7 +95,7 @@ #address-cells = <1>; #size-cells = <1>; - xtal: clock-xtal { + xtal: clock-main-osc { compatible = "renesas,ra-cgc-external-clock"; clock-frequency = ; #clock-cells = <0>; diff --git a/dts/arm/renesas/ra/ra6/r7fa6e2bx.dtsi b/dts/arm/renesas/ra/ra6/r7fa6e2bx.dtsi index 6af6db001f4df..963ba9a468044 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6e2bx.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6e2bx.dtsi @@ -36,7 +36,7 @@ #address-cells = <1>; #size-cells = <1>; - xtal: clock-xtal { + xtal: clock-main-osc { compatible = "renesas,ra-cgc-external-clock"; clock-frequency = ; #clock-cells = <0>; diff --git a/dts/arm/renesas/ra/ra6/r7fa6m1ad3cfp.dtsi b/dts/arm/renesas/ra/ra6/r7fa6m1ad3cfp.dtsi index f8bbb0e154de0..cb849f005c91f 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6m1ad3cfp.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6m1ad3cfp.dtsi @@ -30,7 +30,7 @@ #address-cells = <1>; #size-cells = <1>; - xtal: clock-xtal { + xtal: clock-main-osc { compatible = "renesas,ra-cgc-external-clock"; clock-frequency = ; #clock-cells = <0>; diff --git a/dts/arm/renesas/ra/ra6/r7fa6m2ax.dtsi b/dts/arm/renesas/ra/ra6/r7fa6m2ax.dtsi index 5843d6c7ce899..ab689fd8f7896 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6m2ax.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6m2ax.dtsi @@ -61,7 +61,7 @@ #address-cells = <1>; #size-cells = <1>; - xtal: clock-xtal { + xtal: clock-main-osc { compatible = "renesas,ra-cgc-external-clock"; clock-frequency = ; #clock-cells = <0>; diff --git a/dts/arm/renesas/ra/ra6/r7fa6m3ax.dtsi b/dts/arm/renesas/ra/ra6/r7fa6m3ax.dtsi index cf3d8e97bce71..0870f6d42bb1d 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6m3ax.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6m3ax.dtsi @@ -101,7 +101,7 @@ #address-cells = <1>; #size-cells = <1>; - xtal: clock-xtal { + xtal: clock-main-osc { compatible = "renesas,ra-cgc-external-clock"; clock-frequency = ; #clock-cells = <0>; diff --git a/dts/arm/renesas/ra/ra6/r7fa6m4ax.dtsi b/dts/arm/renesas/ra/ra6/r7fa6m4ax.dtsi index 3c5c308fb8162..8f39ca62bf545 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6m4ax.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6m4ax.dtsi @@ -131,7 +131,7 @@ #address-cells = <1>; #size-cells = <1>; - xtal: clock-xtal { + xtal: clock-main-osc { compatible = "renesas,ra-cgc-external-clock"; clock-frequency = ; #clock-cells = <0>; diff --git a/dts/arm/renesas/ra/ra6/r7fa6m5xh.dtsi b/dts/arm/renesas/ra/ra6/r7fa6m5xh.dtsi index 2b1fe78cbd21c..12a95cef6248f 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6m5xh.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6m5xh.dtsi @@ -191,7 +191,7 @@ #address-cells = <1>; #size-cells = <1>; - xtal: clock-xtal { + xtal: clock-main-osc { compatible = "renesas,ra-cgc-external-clock"; clock-frequency = ; #clock-cells = <0>; diff --git a/dts/arm/renesas/ra/ra8/r7fa8d1xh.dtsi b/dts/arm/renesas/ra/ra8/r7fa8d1xh.dtsi index 89beb25bc7bf3..2bd14bd072373 100644 --- a/dts/arm/renesas/ra/ra8/r7fa8d1xh.dtsi +++ b/dts/arm/renesas/ra/ra8/r7fa8d1xh.dtsi @@ -12,7 +12,7 @@ #address-cells = <1>; #size-cells = <1>; - xtal: clock-xtal { + xtal: clock-main-osc { compatible = "renesas,ra-cgc-external-clock"; clock-frequency = ; #clock-cells = <0>; diff --git a/dts/arm/renesas/ra/ra8/r7fa8t1xh.dtsi b/dts/arm/renesas/ra/ra8/r7fa8t1xh.dtsi index 51a07401b23d8..621239f85b625 100644 --- a/dts/arm/renesas/ra/ra8/r7fa8t1xh.dtsi +++ b/dts/arm/renesas/ra/ra8/r7fa8t1xh.dtsi @@ -12,7 +12,7 @@ #address-cells = <1>; #size-cells = <1>; - xtal: clock-xtal { + xtal: clock-main-osc { compatible = "renesas,ra-cgc-external-clock"; clock-frequency = ; #clock-cells = <0>; From 7c615f95d265d53bc97d11fed1dc790eaf3fca00 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Thu, 12 Sep 2024 23:04:31 +0900 Subject: [PATCH 0402/4482] dts: renesas_ra: Referencing clocks change to DeviceTree's standard. DeviceTree typically references the clock source using the `clocks` property defined in `base.yaml`, so we'll change it to this. Also delete the custom clock source definitions in `renesas,ra-cgc-pclk-block.yaml`, `renesas,ra-cgc-pclk.yaml`, and `renesas,ra-cgc-pll.yaml`. Signed-off-by: TOKITA Hiroshi --- boards/renesas/ek_ra4e2/ek_ra4e2.dts | 2 +- boards/renesas/ek_ra4m2/ek_ra4m2.dts | 2 +- boards/renesas/ek_ra4m3/ek_ra4m3.dts | 2 +- boards/renesas/ek_ra6e2/ek_ra6e2.dts | 2 +- boards/renesas/ek_ra6m1/ek_ra6m1.dts | 2 +- boards/renesas/ek_ra6m2/ek_ra6m2.dts | 2 +- boards/renesas/ek_ra6m3/ek_ra6m3.dts | 2 +- boards/renesas/ek_ra6m4/ek_ra6m4.dts | 4 ++-- boards/renesas/ek_ra6m5/ek_ra6m5.dts | 2 +- boards/renesas/ek_ra8d1/ek_ra8d1.dts | 4 ++-- boards/renesas/ek_ra8m1/ek_ra8m1.dts | 4 ++-- boards/renesas/fpb_ra6e1/fpb_ra6e1.dts | 2 +- boards/renesas/fpb_ra6e2/fpb_ra6e2.dts | 2 +- boards/renesas/mck_ra8t1/mck_ra8t1.dts | 4 ++-- dts/arm/renesas/ra/ra2/r7fa2a1xh.dtsi | 2 +- dts/arm/renesas/ra/ra4/r7fa4e2b93cfm.dtsi | 4 ++-- dts/arm/renesas/ra/ra4/r7fa4m2ax.dtsi | 5 ++--- dts/arm/renesas/ra/ra4/r7fa4m3ax.dtsi | 5 ++--- dts/arm/renesas/ra/ra4/r7fa4w1ad2cng.dtsi | 4 ++-- dts/arm/renesas/ra/ra6/r7fa6e10x.dtsi | 5 ++--- dts/arm/renesas/ra/ra6/r7fa6e2bx.dtsi | 4 ++-- dts/arm/renesas/ra/ra6/r7fa6m1ad3cfp.dtsi | 4 ++-- dts/arm/renesas/ra/ra6/r7fa6m2ax.dtsi | 4 ++-- dts/arm/renesas/ra/ra6/r7fa6m3ax.dtsi | 4 ++-- dts/arm/renesas/ra/ra6/r7fa6m4ax.dtsi | 5 ++--- dts/arm/renesas/ra/ra6/r7fa6m5xh.dtsi | 5 ++--- dts/arm/renesas/ra/ra8/r7fa8d1xh.dtsi | 5 ++--- dts/arm/renesas/ra/ra8/r7fa8m1xh.dtsi | 5 ++--- dts/arm/renesas/ra/ra8/r7fa8t1xh.dtsi | 5 ++--- dts/bindings/clock/renesas,ra-cgc-pclk-block.yaml | 3 +-- dts/bindings/clock/renesas,ra-cgc-pclk.yaml | 3 --- dts/bindings/clock/renesas,ra-cgc-pll.yaml | 3 +-- 32 files changed, 49 insertions(+), 62 deletions(-) diff --git a/boards/renesas/ek_ra4e2/ek_ra4e2.dts b/boards/renesas/ek_ra4e2/ek_ra4e2.dts index e371198e6ed53..2bf7a9d3ff0e6 100644 --- a/boards/renesas/ek_ra4e2/ek_ra4e2.dts +++ b/boards/renesas/ek_ra4e2/ek_ra4e2.dts @@ -53,7 +53,7 @@ }; &pll { - source = ; + clocks = <&xtal>; div = ; mul = <10 0>; status = "okay"; diff --git a/boards/renesas/ek_ra4m2/ek_ra4m2.dts b/boards/renesas/ek_ra4m2/ek_ra4m2.dts index 49f35db2e8340..9cb8d8b77bb95 100644 --- a/boards/renesas/ek_ra4m2/ek_ra4m2.dts +++ b/boards/renesas/ek_ra4m2/ek_ra4m2.dts @@ -53,7 +53,7 @@ }; &pll { - source = ; + clocks = <&xtal>; div = ; mul = <25 0>; status = "okay"; diff --git a/boards/renesas/ek_ra4m3/ek_ra4m3.dts b/boards/renesas/ek_ra4m3/ek_ra4m3.dts index f076510018e93..09701ac99236f 100644 --- a/boards/renesas/ek_ra4m3/ek_ra4m3.dts +++ b/boards/renesas/ek_ra4m3/ek_ra4m3.dts @@ -53,7 +53,7 @@ }; &pll { - source = ; + clocks = <&xtal>; div = ; mul = <25 0>; status = "okay"; diff --git a/boards/renesas/ek_ra6e2/ek_ra6e2.dts b/boards/renesas/ek_ra6e2/ek_ra6e2.dts index 682aafcd006b1..29571eb28a20e 100644 --- a/boards/renesas/ek_ra6e2/ek_ra6e2.dts +++ b/boards/renesas/ek_ra6e2/ek_ra6e2.dts @@ -94,7 +94,7 @@ }; &pll { - source = ; + clocks = <&xtal>; div = ; mul = <10 0>; status = "okay"; diff --git a/boards/renesas/ek_ra6m1/ek_ra6m1.dts b/boards/renesas/ek_ra6m1/ek_ra6m1.dts index f82d065911260..631f2d1384c9d 100644 --- a/boards/renesas/ek_ra6m1/ek_ra6m1.dts +++ b/boards/renesas/ek_ra6m1/ek_ra6m1.dts @@ -60,7 +60,7 @@ }; &pll { - source = ; + clocks = <&xtal>; div = ; mul = <20 0>; status = "okay"; diff --git a/boards/renesas/ek_ra6m2/ek_ra6m2.dts b/boards/renesas/ek_ra6m2/ek_ra6m2.dts index 78407352e72d4..19721a46a2019 100644 --- a/boards/renesas/ek_ra6m2/ek_ra6m2.dts +++ b/boards/renesas/ek_ra6m2/ek_ra6m2.dts @@ -60,7 +60,7 @@ }; &pll { - source = ; + clocks = <&xtal>; div = ; mul = <20 0>; status = "okay"; diff --git a/boards/renesas/ek_ra6m3/ek_ra6m3.dts b/boards/renesas/ek_ra6m3/ek_ra6m3.dts index 0cd4de22aa19d..db9031340a99c 100644 --- a/boards/renesas/ek_ra6m3/ek_ra6m3.dts +++ b/boards/renesas/ek_ra6m3/ek_ra6m3.dts @@ -72,7 +72,7 @@ }; &pll { - source = ; + clocks = <&xtal>; div = ; mul = <20 0>; status = "okay"; diff --git a/boards/renesas/ek_ra6m4/ek_ra6m4.dts b/boards/renesas/ek_ra6m4/ek_ra6m4.dts index f0f447eede7b5..b156f6f1e52bb 100644 --- a/boards/renesas/ek_ra6m4/ek_ra6m4.dts +++ b/boards/renesas/ek_ra6m4/ek_ra6m4.dts @@ -68,14 +68,14 @@ }; &pll { - source = ; + clocks = <&xtal>; div = ; mul = <25 0>; status = "okay"; }; &pclka { - clk-src = ; + clocks = <&pll>; clk-div = ; status = "okay"; }; diff --git a/boards/renesas/ek_ra6m5/ek_ra6m5.dts b/boards/renesas/ek_ra6m5/ek_ra6m5.dts index ad84e26a1678f..902e281984ec9 100644 --- a/boards/renesas/ek_ra6m5/ek_ra6m5.dts +++ b/boards/renesas/ek_ra6m5/ek_ra6m5.dts @@ -68,7 +68,7 @@ }; &pll { - source = ; + clocks = <&xtal>; div = ; mul = <25 0>; status = "okay"; diff --git a/boards/renesas/ek_ra8d1/ek_ra8d1.dts b/boards/renesas/ek_ra8d1/ek_ra8d1.dts index 698e90e631cd0..e17bf02718cf1 100644 --- a/boards/renesas/ek_ra8d1/ek_ra8d1.dts +++ b/boards/renesas/ek_ra8d1/ek_ra8d1.dts @@ -56,7 +56,7 @@ }; &pll { - source = ; + clocks = <&xtal>; div = ; mul = <96 0>; divp = ; @@ -69,7 +69,7 @@ }; &sciclk { - clk-src = ; + clocks = <&pll>; clk-div = ; status = "okay"; }; diff --git a/boards/renesas/ek_ra8m1/ek_ra8m1.dts b/boards/renesas/ek_ra8m1/ek_ra8m1.dts index de64b9ecf252b..df94f202a15b0 100644 --- a/boards/renesas/ek_ra8m1/ek_ra8m1.dts +++ b/boards/renesas/ek_ra8m1/ek_ra8m1.dts @@ -79,7 +79,7 @@ }; &pll { - source = ; + clocks = <&xtal>; div = ; mul = <96 0>; divp = ; @@ -92,7 +92,7 @@ }; &sciclk { - clk-src = ; + clocks = <&pll>; clk-div = ; status = "okay"; }; diff --git a/boards/renesas/fpb_ra6e1/fpb_ra6e1.dts b/boards/renesas/fpb_ra6e1/fpb_ra6e1.dts index 6f73498953965..b0aa5b48f0844 100644 --- a/boards/renesas/fpb_ra6e1/fpb_ra6e1.dts +++ b/boards/renesas/fpb_ra6e1/fpb_ra6e1.dts @@ -57,7 +57,7 @@ }; &pll { - source = ; + clocks = <&hoco>; div = ; mul = <20 0>; status = "okay"; diff --git a/boards/renesas/fpb_ra6e2/fpb_ra6e2.dts b/boards/renesas/fpb_ra6e2/fpb_ra6e2.dts index bc7baa6c5ceda..847f55288132d 100644 --- a/boards/renesas/fpb_ra6e2/fpb_ra6e2.dts +++ b/boards/renesas/fpb_ra6e2/fpb_ra6e2.dts @@ -76,7 +76,7 @@ }; &pll { - source = ; + clocks = <&hoco>; div = ; mul = <10 0>; status = "okay"; diff --git a/boards/renesas/mck_ra8t1/mck_ra8t1.dts b/boards/renesas/mck_ra8t1/mck_ra8t1.dts index f7046d4914901..ea06022287937 100644 --- a/boards/renesas/mck_ra8t1/mck_ra8t1.dts +++ b/boards/renesas/mck_ra8t1/mck_ra8t1.dts @@ -60,7 +60,7 @@ }; &pll { - source = ; + clocks = <&xtal>; div = ; mul = <80 0>; divp = ; @@ -73,7 +73,7 @@ }; &sciclk { - clk-src = ; + clocks = <&pll>; clk-div = ; status = "okay"; }; diff --git a/dts/arm/renesas/ra/ra2/r7fa2a1xh.dtsi b/dts/arm/renesas/ra/ra2/r7fa2a1xh.dtsi index 9139417ea2824..bb23016381609 100644 --- a/dts/arm/renesas/ra/ra2/r7fa2a1xh.dtsi +++ b/dts/arm/renesas/ra/ra2/r7fa2a1xh.dtsi @@ -64,7 +64,7 @@ reg-names = "MSTPA", "MSTPB","MSTPC", "MSTPD"; #clock-cells = <0>; - sysclock-src = ; + clocks = <&hoco>; status = "okay"; iclk: iclk { diff --git a/dts/arm/renesas/ra/ra4/r7fa4e2b93cfm.dtsi b/dts/arm/renesas/ra/ra4/r7fa4e2b93cfm.dtsi index df7ee812a6919..6feb69d4a43da 100644 --- a/dts/arm/renesas/ra/ra4/r7fa4e2b93cfm.dtsi +++ b/dts/arm/renesas/ra/ra4/r7fa4e2b93cfm.dtsi @@ -83,7 +83,7 @@ #clock-cells = <0>; /* PLL */ - source = ; + clocks = <&xtal>; div = ; mul = <10 0>; status = "disabled"; @@ -96,7 +96,7 @@ reg-names = "MSTPA", "MSTPB","MSTPC", "MSTPD", "MSTPE"; #clock-cells = <0>; - sysclock-src = ; + clocks = <&pll>; status = "okay"; iclk: iclk { diff --git a/dts/arm/renesas/ra/ra4/r7fa4m2ax.dtsi b/dts/arm/renesas/ra/ra4/r7fa4m2ax.dtsi index 333d70db07820..7ed9fdabd78b9 100644 --- a/dts/arm/renesas/ra/ra4/r7fa4m2ax.dtsi +++ b/dts/arm/renesas/ra/ra4/r7fa4m2ax.dtsi @@ -132,7 +132,7 @@ #clock-cells = <0>; /* PLL */ - source = ; + clocks = <&xtal>; div = ; mul = <25 0>; status = "disabled"; @@ -143,7 +143,6 @@ #clock-cells = <0>; /* PLL */ - source = ; div = ; mul = <20 0>; status = "disabled"; @@ -156,7 +155,7 @@ reg-names = "MSTPA", "MSTPB","MSTPC", "MSTPD", "MSTPE"; #clock-cells = <0>; - sysclock-src = ; + clocks = <&pll>; status = "okay"; iclk: iclk { diff --git a/dts/arm/renesas/ra/ra4/r7fa4m3ax.dtsi b/dts/arm/renesas/ra/ra4/r7fa4m3ax.dtsi index 5bb6a46e5650b..1277844b1b8e2 100644 --- a/dts/arm/renesas/ra/ra4/r7fa4m3ax.dtsi +++ b/dts/arm/renesas/ra/ra4/r7fa4m3ax.dtsi @@ -142,7 +142,7 @@ #clock-cells = <0>; /* PLL */ - source = ; + clocks = <&xtal>; div = ; mul = <25 0>; status = "disabled"; @@ -151,7 +151,6 @@ pll2: pll2 { compatible = "renesas,ra-cgc-pll"; #clock-cells = <0>; - source = ; div = ; mul = <20 0>; status = "disabled"; @@ -164,7 +163,7 @@ reg-names = "MSTPA", "MSTPB","MSTPC", "MSTPD", "MSTPE"; #clock-cells = <0>; - sysclock-src = ; + clocks = <&pll>; status = "okay"; iclk: iclk { diff --git a/dts/arm/renesas/ra/ra4/r7fa4w1ad2cng.dtsi b/dts/arm/renesas/ra/ra4/r7fa4w1ad2cng.dtsi index a6cd0df5edc9f..93ea6751e9ca8 100644 --- a/dts/arm/renesas/ra/ra4/r7fa4w1ad2cng.dtsi +++ b/dts/arm/renesas/ra/ra4/r7fa4w1ad2cng.dtsi @@ -77,7 +77,7 @@ #clock-cells = <0>; /* PLL */ - source = ; + clocks = <&xtal>; div = ; mul = <12 0>; status = "disabled"; @@ -90,7 +90,7 @@ reg-names = "MSTPA", "MSTPB","MSTPC", "MSTPD"; #clock-cells = <0>; - sysclock-src = ; + clocks = <&hoco>; status = "okay"; iclk: iclk { diff --git a/dts/arm/renesas/ra/ra6/r7fa6e10x.dtsi b/dts/arm/renesas/ra/ra6/r7fa6e10x.dtsi index 9e3dfe76ba6f7..b070022ee5f4a 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6e10x.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6e10x.dtsi @@ -132,7 +132,7 @@ #clock-cells = <0>; /* PLL */ - source = ; + clocks = <&hoco>; div = ; mul = <20 0>; status = "disabled"; @@ -143,7 +143,6 @@ #clock-cells = <0>; /* PLL2 */ - source = ; div = ; mul = <20 0>; status = "disabled"; @@ -156,7 +155,7 @@ reg-names = "MSTPA", "MSTPB","MSTPC", "MSTPD", "MSTPE"; #clock-cells = <0>; - sysclock-src = ; + clocks = <&pll>; status = "okay"; iclk: iclk { diff --git a/dts/arm/renesas/ra/ra6/r7fa6e2bx.dtsi b/dts/arm/renesas/ra/ra6/r7fa6e2bx.dtsi index 963ba9a468044..7576bb0dcd332 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6e2bx.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6e2bx.dtsi @@ -73,7 +73,7 @@ #clock-cells = <0>; /* PLL */ - source = ; + clocks = <&xtal>; div = ; mul = <10 0>; status = "disabled"; @@ -86,7 +86,7 @@ reg-names = "MSTPA", "MSTPB","MSTPC", "MSTPD", "MSTPE"; #clock-cells = <0>; - sysclock-src = ; + clocks = <&pll>; status = "okay"; iclk: iclk { diff --git a/dts/arm/renesas/ra/ra6/r7fa6m1ad3cfp.dtsi b/dts/arm/renesas/ra/ra6/r7fa6m1ad3cfp.dtsi index cb849f005c91f..af17716832164 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6m1ad3cfp.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6m1ad3cfp.dtsi @@ -67,7 +67,7 @@ #clock-cells = <0>; /* PLL */ - source = ; + clocks = <&xtal>; div = ; mul = <20 0>; status = "disabled"; @@ -80,7 +80,7 @@ reg-names = "MSTPA", "MSTPB","MSTPC", "MSTPD"; #clock-cells = <0>; - sysclock-src = ; + clocks = <&pll>; status = "okay"; iclk: iclk { diff --git a/dts/arm/renesas/ra/ra6/r7fa6m2ax.dtsi b/dts/arm/renesas/ra/ra6/r7fa6m2ax.dtsi index ab689fd8f7896..a06241a95b3f4 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6m2ax.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6m2ax.dtsi @@ -98,7 +98,7 @@ #clock-cells = <0>; /* PLL */ - source = ; + clocks = <&xtal>; div = ; mul = <20 0>; status = "disabled"; @@ -111,7 +111,7 @@ reg-names = "MSTPA", "MSTPB","MSTPC", "MSTPD"; #clock-cells = <0>; - sysclock-src = ; + clocks = <&pll>; status = "okay"; iclk: iclk { diff --git a/dts/arm/renesas/ra/ra6/r7fa6m3ax.dtsi b/dts/arm/renesas/ra/ra6/r7fa6m3ax.dtsi index 0870f6d42bb1d..197be43a3fc2b 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6m3ax.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6m3ax.dtsi @@ -138,7 +138,7 @@ #clock-cells = <0>; /* PLL */ - source = ; + clocks = <&xtal>; div = ; mul = <20 0>; status = "disabled"; @@ -151,7 +151,7 @@ reg-names = "MSTPA", "MSTPB","MSTPC", "MSTPD"; #clock-cells = <0>; - sysclock-src = ; + clocks = <&pll>; status = "okay"; iclk: iclk { diff --git a/dts/arm/renesas/ra/ra6/r7fa6m4ax.dtsi b/dts/arm/renesas/ra/ra6/r7fa6m4ax.dtsi index 8f39ca62bf545..0310f61e65db8 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6m4ax.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6m4ax.dtsi @@ -168,7 +168,7 @@ #clock-cells = <0>; /* PLL */ - source = ; + clocks = <&xtal>; div = ; mul = <25 0>; status = "disabled"; @@ -179,7 +179,6 @@ #clock-cells = <0>; /* PLL2 */ - source = ; div = ; mul = <20 0>; status = "disabled"; @@ -192,7 +191,7 @@ reg-names = "MSTPA", "MSTPB","MSTPC", "MSTPD", "MSTPE"; #clock-cells = <0>; - sysclock-src = ; + clocks = <&pll>; status = "okay"; iclk: iclk { diff --git a/dts/arm/renesas/ra/ra6/r7fa6m5xh.dtsi b/dts/arm/renesas/ra/ra6/r7fa6m5xh.dtsi index 12a95cef6248f..91d95e288d83b 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6m5xh.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6m5xh.dtsi @@ -228,7 +228,7 @@ #clock-cells = <0>; /* PLL */ - source = ; + clocks = <&xtal>; div = ; mul = <25 0>; status = "disabled"; @@ -239,7 +239,6 @@ #clock-cells = <0>; /* PLL2 */ - source = ; div = ; mul = <20 0>; status = "disabled"; @@ -252,7 +251,7 @@ reg-names = "MSTPA", "MSTPB","MSTPC", "MSTPD", "MSTPE"; #clock-cells = <0>; - sysclock-src = ; + clocks = <&pll>; status = "okay"; iclk: iclk { diff --git a/dts/arm/renesas/ra/ra8/r7fa8d1xh.dtsi b/dts/arm/renesas/ra/ra8/r7fa8d1xh.dtsi index 2bd14bd072373..5b00642bae339 100644 --- a/dts/arm/renesas/ra/ra8/r7fa8d1xh.dtsi +++ b/dts/arm/renesas/ra/ra8/r7fa8d1xh.dtsi @@ -49,7 +49,7 @@ #clock-cells = <0>; /* PLL */ - source = ; + clocks = <&xtal>; div = ; mul = <96 0>; divp = ; @@ -66,7 +66,6 @@ #clock-cells = <0>; /* PLL2 */ - source = ; div = ; mul = <96 0>; divp = ; @@ -85,7 +84,7 @@ reg-names = "MSTPA", "MSTPB","MSTPC", "MSTPD", "MSTPE"; #clock-cells = <0>; - sysclock-src = ; + clocks = <&pll>; status = "okay"; cpuclk: cpuclk { diff --git a/dts/arm/renesas/ra/ra8/r7fa8m1xh.dtsi b/dts/arm/renesas/ra/ra8/r7fa8m1xh.dtsi index 164928c4cd4b6..c184c1432e208 100644 --- a/dts/arm/renesas/ra/ra8/r7fa8m1xh.dtsi +++ b/dts/arm/renesas/ra/ra8/r7fa8m1xh.dtsi @@ -49,7 +49,7 @@ #clock-cells = <0>; /* PLL */ - source = ; + clocks = <&xtal>; div = ; mul = <96 0>; divp = ; @@ -66,7 +66,6 @@ #clock-cells = <0>; /* PLL2 */ - source = ; div = ; mul = <96 0>; divp = ; @@ -85,7 +84,7 @@ reg-names = "MSTPA", "MSTPB","MSTPC", "MSTPD", "MSTPE"; #clock-cells = <0>; - sysclock-src = ; + clocks = <&pll>; status = "okay"; cpuclk: cpuclk { diff --git a/dts/arm/renesas/ra/ra8/r7fa8t1xh.dtsi b/dts/arm/renesas/ra/ra8/r7fa8t1xh.dtsi index 621239f85b625..3f4fb717f354f 100644 --- a/dts/arm/renesas/ra/ra8/r7fa8t1xh.dtsi +++ b/dts/arm/renesas/ra/ra8/r7fa8t1xh.dtsi @@ -49,7 +49,7 @@ #clock-cells = <0>; /* PLL */ - source = ; + clocks = <&xtal>; div = ; mul = <80 0>; divp = ; @@ -66,7 +66,6 @@ #clock-cells = <0>; /* PLL2 */ - source = ; div = ; mul = <96 0>; divp = ; @@ -85,7 +84,7 @@ reg-names = "MSTPA", "MSTPB","MSTPC", "MSTPD", "MSTPE"; #clock-cells = <0>; - sysclock-src = ; + clocks = <&pll>; status = "okay"; cpuclk: cpuclk { diff --git a/dts/bindings/clock/renesas,ra-cgc-pclk-block.yaml b/dts/bindings/clock/renesas,ra-cgc-pclk-block.yaml index 6380b712984d4..d455a1e83f74c 100644 --- a/dts/bindings/clock/renesas,ra-cgc-pclk-block.yaml +++ b/dts/bindings/clock/renesas,ra-cgc-pclk-block.yaml @@ -8,6 +8,5 @@ compatible: "renesas,ra-cgc-pclk-block" include: [clock-controller.yaml, base.yaml] properties: - sysclock-src: + clocks: required: true - type: int diff --git a/dts/bindings/clock/renesas,ra-cgc-pclk.yaml b/dts/bindings/clock/renesas,ra-cgc-pclk.yaml index 5ea4d708894fe..1aac515882d74 100644 --- a/dts/bindings/clock/renesas,ra-cgc-pclk.yaml +++ b/dts/bindings/clock/renesas,ra-cgc-pclk.yaml @@ -8,9 +8,6 @@ compatible: "renesas,ra-cgc-pclk" include: [clock-controller.yaml, base.yaml] properties: - clk-src: - type: int - clk-div: type: int required: true diff --git a/dts/bindings/clock/renesas,ra-cgc-pll.yaml b/dts/bindings/clock/renesas,ra-cgc-pll.yaml index a974f54c075b9..7c959b6a01db5 100644 --- a/dts/bindings/clock/renesas,ra-cgc-pll.yaml +++ b/dts/bindings/clock/renesas,ra-cgc-pll.yaml @@ -8,9 +8,8 @@ compatible: "renesas,ra-cgc-pll" include: [clock-controller.yaml, base.yaml] properties: - source: + clocks: required: true - type: int div: required: true type: int From d72a69488c502baaa0dfd3ed8bbc1deaac96efde Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Thu, 12 Sep 2024 23:15:27 +0900 Subject: [PATCH 0403/4482] dts: renesas_ra: Change to describe the division ratio in a numeric Move the process of replacing numerical values with macros to the header, and set the division ratio in a numeric without using macros in the device tree. Change `clk-div` defined in `renesas,ra-cgc-pclk.yaml` to `div`. Signed-off-by: TOKITA Hiroshi --- boards/renesas/ek_ra4e2/ek_ra4e2.dts | 2 +- boards/renesas/ek_ra4m2/ek_ra4m2.dts | 2 +- boards/renesas/ek_ra4m3/ek_ra4m3.dts | 2 +- boards/renesas/ek_ra6e2/ek_ra6e2.dts | 2 +- boards/renesas/ek_ra6m1/ek_ra6m1.dts | 2 +- boards/renesas/ek_ra6m2/ek_ra6m2.dts | 2 +- boards/renesas/ek_ra6m3/ek_ra6m3.dts | 2 +- boards/renesas/ek_ra6m4/ek_ra6m4.dts | 4 +-- boards/renesas/ek_ra6m5/ek_ra6m5.dts | 2 +- boards/renesas/ek_ra8d1/ek_ra8d1.dts | 10 +++--- boards/renesas/ek_ra8m1/ek_ra8m1.dts | 10 +++--- boards/renesas/fpb_ra6e1/fpb_ra6e1.dts | 2 +- boards/renesas/fpb_ra6e2/fpb_ra6e2.dts | 2 +- boards/renesas/mck_ra8t1/mck_ra8t1.dts | 10 +++--- dts/arm/renesas/ra/ra2/r7fa2a1xh.dtsi | 8 ++--- dts/arm/renesas/ra/ra4/r7fa4e2b93cfm.dtsi | 14 ++++---- dts/arm/renesas/ra/ra4/r7fa4m2ax.dtsi | 16 ++++----- dts/arm/renesas/ra/ra4/r7fa4m3ax.dtsi | 16 ++++----- dts/arm/renesas/ra/ra4/r7fa4w1ad2cng.dtsi | 16 ++++----- dts/arm/renesas/ra/ra6/r7fa6e10x.dtsi | 16 ++++----- dts/arm/renesas/ra/ra6/r7fa6e2bx.dtsi | 14 ++++---- dts/arm/renesas/ra/ra6/r7fa6m1ad3cfp.dtsi | 18 +++++------ dts/arm/renesas/ra/ra6/r7fa6m2ax.dtsi | 18 +++++------ dts/arm/renesas/ra/ra6/r7fa6m3ax.dtsi | 18 +++++------ dts/arm/renesas/ra/ra6/r7fa6m4ax.dtsi | 18 +++++------ dts/arm/renesas/ra/ra6/r7fa6m5xh.dtsi | 18 +++++------ dts/arm/renesas/ra/ra8/r7fa8d1xh.dtsi | 34 +++++++++---------- dts/arm/renesas/ra/ra8/r7fa8m1xh.dtsi | 36 ++++++++++----------- dts/arm/renesas/ra/ra8/r7fa8t1xh.dtsi | 34 +++++++++---------- dts/bindings/clock/renesas,ra-cgc-pclk.yaml | 2 +- 30 files changed, 175 insertions(+), 175 deletions(-) diff --git a/boards/renesas/ek_ra4e2/ek_ra4e2.dts b/boards/renesas/ek_ra4e2/ek_ra4e2.dts index 2bf7a9d3ff0e6..aa1e8f9435d3c 100644 --- a/boards/renesas/ek_ra4e2/ek_ra4e2.dts +++ b/boards/renesas/ek_ra4e2/ek_ra4e2.dts @@ -54,7 +54,7 @@ &pll { clocks = <&xtal>; - div = ; + div = <1>; mul = <10 0>; status = "okay"; }; diff --git a/boards/renesas/ek_ra4m2/ek_ra4m2.dts b/boards/renesas/ek_ra4m2/ek_ra4m2.dts index 9cb8d8b77bb95..9ccde6acd8a38 100644 --- a/boards/renesas/ek_ra4m2/ek_ra4m2.dts +++ b/boards/renesas/ek_ra4m2/ek_ra4m2.dts @@ -54,7 +54,7 @@ &pll { clocks = <&xtal>; - div = ; + div = <3>; mul = <25 0>; status = "okay"; }; diff --git a/boards/renesas/ek_ra4m3/ek_ra4m3.dts b/boards/renesas/ek_ra4m3/ek_ra4m3.dts index 09701ac99236f..21867f1dbe493 100644 --- a/boards/renesas/ek_ra4m3/ek_ra4m3.dts +++ b/boards/renesas/ek_ra4m3/ek_ra4m3.dts @@ -54,7 +54,7 @@ &pll { clocks = <&xtal>; - div = ; + div = <3>; mul = <25 0>; status = "okay"; }; diff --git a/boards/renesas/ek_ra6e2/ek_ra6e2.dts b/boards/renesas/ek_ra6e2/ek_ra6e2.dts index 29571eb28a20e..6e068eb55bd83 100644 --- a/boards/renesas/ek_ra6e2/ek_ra6e2.dts +++ b/boards/renesas/ek_ra6e2/ek_ra6e2.dts @@ -95,7 +95,7 @@ &pll { clocks = <&xtal>; - div = ; + div = <1>; mul = <10 0>; status = "okay"; }; diff --git a/boards/renesas/ek_ra6m1/ek_ra6m1.dts b/boards/renesas/ek_ra6m1/ek_ra6m1.dts index 631f2d1384c9d..53fc329b0481f 100644 --- a/boards/renesas/ek_ra6m1/ek_ra6m1.dts +++ b/boards/renesas/ek_ra6m1/ek_ra6m1.dts @@ -61,7 +61,7 @@ &pll { clocks = <&xtal>; - div = ; + div = <1>; mul = <20 0>; status = "okay"; }; diff --git a/boards/renesas/ek_ra6m2/ek_ra6m2.dts b/boards/renesas/ek_ra6m2/ek_ra6m2.dts index 19721a46a2019..d498d6448e5fc 100644 --- a/boards/renesas/ek_ra6m2/ek_ra6m2.dts +++ b/boards/renesas/ek_ra6m2/ek_ra6m2.dts @@ -61,7 +61,7 @@ &pll { clocks = <&xtal>; - div = ; + div = <1>; mul = <20 0>; status = "okay"; }; diff --git a/boards/renesas/ek_ra6m3/ek_ra6m3.dts b/boards/renesas/ek_ra6m3/ek_ra6m3.dts index db9031340a99c..141292d9f7e06 100644 --- a/boards/renesas/ek_ra6m3/ek_ra6m3.dts +++ b/boards/renesas/ek_ra6m3/ek_ra6m3.dts @@ -73,7 +73,7 @@ &pll { clocks = <&xtal>; - div = ; + div = <2>; mul = <20 0>; status = "okay"; }; diff --git a/boards/renesas/ek_ra6m4/ek_ra6m4.dts b/boards/renesas/ek_ra6m4/ek_ra6m4.dts index b156f6f1e52bb..866232d5c7fab 100644 --- a/boards/renesas/ek_ra6m4/ek_ra6m4.dts +++ b/boards/renesas/ek_ra6m4/ek_ra6m4.dts @@ -69,13 +69,13 @@ &pll { clocks = <&xtal>; - div = ; + div = <3>; mul = <25 0>; status = "okay"; }; &pclka { clocks = <&pll>; - clk-div = ; + div = <2>; status = "okay"; }; diff --git a/boards/renesas/ek_ra6m5/ek_ra6m5.dts b/boards/renesas/ek_ra6m5/ek_ra6m5.dts index 902e281984ec9..3cb4ebe3ba59c 100644 --- a/boards/renesas/ek_ra6m5/ek_ra6m5.dts +++ b/boards/renesas/ek_ra6m5/ek_ra6m5.dts @@ -69,7 +69,7 @@ &pll { clocks = <&xtal>; - div = ; + div = <3>; mul = <25 0>; status = "okay"; }; diff --git a/boards/renesas/ek_ra8d1/ek_ra8d1.dts b/boards/renesas/ek_ra8d1/ek_ra8d1.dts index e17bf02718cf1..4449e566c2dc2 100644 --- a/boards/renesas/ek_ra8d1/ek_ra8d1.dts +++ b/boards/renesas/ek_ra8d1/ek_ra8d1.dts @@ -57,20 +57,20 @@ &pll { clocks = <&xtal>; - div = ; + div = <2>; mul = <96 0>; - divp = ; + divp = <2>; freqp = ; - divq = ; + divq = <2>; freqq = ; - divr = ; + divr = <2>; freqr = ; status = "okay"; }; &sciclk { clocks = <&pll>; - clk-div = ; + div = <4>; status = "okay"; }; diff --git a/boards/renesas/ek_ra8m1/ek_ra8m1.dts b/boards/renesas/ek_ra8m1/ek_ra8m1.dts index df94f202a15b0..0e3b6ec3cd514 100644 --- a/boards/renesas/ek_ra8m1/ek_ra8m1.dts +++ b/boards/renesas/ek_ra8m1/ek_ra8m1.dts @@ -80,20 +80,20 @@ &pll { clocks = <&xtal>; - div = ; + div = <2>; mul = <96 0>; - divp = ; + divp = <2>; freqp = ; - divq = ; + divq = <2>; freqq = ; - divr = ; + divr = <2>; freqr = ; status = "okay"; }; &sciclk { clocks = <&pll>; - clk-div = ; + div = <4>; status = "okay"; }; diff --git a/boards/renesas/fpb_ra6e1/fpb_ra6e1.dts b/boards/renesas/fpb_ra6e1/fpb_ra6e1.dts index b0aa5b48f0844..2efab7438b50d 100644 --- a/boards/renesas/fpb_ra6e1/fpb_ra6e1.dts +++ b/boards/renesas/fpb_ra6e1/fpb_ra6e1.dts @@ -58,7 +58,7 @@ &pll { clocks = <&hoco>; - div = ; + div = <2>; mul = <20 0>; status = "okay"; }; diff --git a/boards/renesas/fpb_ra6e2/fpb_ra6e2.dts b/boards/renesas/fpb_ra6e2/fpb_ra6e2.dts index 847f55288132d..fbde0caf01395 100644 --- a/boards/renesas/fpb_ra6e2/fpb_ra6e2.dts +++ b/boards/renesas/fpb_ra6e2/fpb_ra6e2.dts @@ -77,7 +77,7 @@ &pll { clocks = <&hoco>; - div = ; + div = <1>; mul = <10 0>; status = "okay"; }; diff --git a/boards/renesas/mck_ra8t1/mck_ra8t1.dts b/boards/renesas/mck_ra8t1/mck_ra8t1.dts index ea06022287937..6cd4cf53eb82e 100644 --- a/boards/renesas/mck_ra8t1/mck_ra8t1.dts +++ b/boards/renesas/mck_ra8t1/mck_ra8t1.dts @@ -61,20 +61,20 @@ &pll { clocks = <&xtal>; - div = ; + div = <2>; mul = <80 0>; - divp = ; + divp = <2>; freqp = ; - divq = ; + divq = <2>; freqq = ; - divr = ; + divr = <2>; freqr = ; status = "okay"; }; &sciclk { clocks = <&pll>; - clk-div = ; + div = <4>; status = "okay"; }; diff --git a/dts/arm/renesas/ra/ra2/r7fa2a1xh.dtsi b/dts/arm/renesas/ra/ra2/r7fa2a1xh.dtsi index bb23016381609..8c60af4b83d87 100644 --- a/dts/arm/renesas/ra/ra2/r7fa2a1xh.dtsi +++ b/dts/arm/renesas/ra/ra2/r7fa2a1xh.dtsi @@ -69,28 +69,28 @@ iclk: iclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <1>; #clock-cells = <2>; status = "okay"; }; pclkb: pclkb { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclkd: pclkd { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <1>; #clock-cells = <2>; status = "okay"; }; fclk: fclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <1>; #clock-cells = <2>; status = "okay"; }; diff --git a/dts/arm/renesas/ra/ra4/r7fa4e2b93cfm.dtsi b/dts/arm/renesas/ra/ra4/r7fa4e2b93cfm.dtsi index 6feb69d4a43da..3f403525ada59 100644 --- a/dts/arm/renesas/ra/ra4/r7fa4e2b93cfm.dtsi +++ b/dts/arm/renesas/ra/ra4/r7fa4e2b93cfm.dtsi @@ -84,7 +84,7 @@ /* PLL */ clocks = <&xtal>; - div = ; + div = <1>; mul = <10 0>; status = "disabled"; }; @@ -101,42 +101,42 @@ iclk: iclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclka: pclka { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclkb: pclkb { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkc: pclkc { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkd: pclkd { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; fclk: fclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; diff --git a/dts/arm/renesas/ra/ra4/r7fa4m2ax.dtsi b/dts/arm/renesas/ra/ra4/r7fa4m2ax.dtsi index 7ed9fdabd78b9..6abfa96b0c85b 100644 --- a/dts/arm/renesas/ra/ra4/r7fa4m2ax.dtsi +++ b/dts/arm/renesas/ra/ra4/r7fa4m2ax.dtsi @@ -133,7 +133,7 @@ /* PLL */ clocks = <&xtal>; - div = ; + div = <3>; mul = <25 0>; status = "disabled"; }; @@ -143,7 +143,7 @@ #clock-cells = <0>; /* PLL */ - div = ; + div = <2>; mul = <20 0>; status = "disabled"; }; @@ -160,42 +160,42 @@ iclk: iclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclka: pclka { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclkb: pclkb { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkc: pclkc { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkd: pclkd { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; fclk: fclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; diff --git a/dts/arm/renesas/ra/ra4/r7fa4m3ax.dtsi b/dts/arm/renesas/ra/ra4/r7fa4m3ax.dtsi index 1277844b1b8e2..fbfe3b5e36c5b 100644 --- a/dts/arm/renesas/ra/ra4/r7fa4m3ax.dtsi +++ b/dts/arm/renesas/ra/ra4/r7fa4m3ax.dtsi @@ -143,7 +143,7 @@ /* PLL */ clocks = <&xtal>; - div = ; + div = <3>; mul = <25 0>; status = "disabled"; }; @@ -151,7 +151,7 @@ pll2: pll2 { compatible = "renesas,ra-cgc-pll"; #clock-cells = <0>; - div = ; + div = <2>; mul = <20 0>; status = "disabled"; }; @@ -168,42 +168,42 @@ iclk: iclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclka: pclka { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclkb: pclkb { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkc: pclkc { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkd: pclkd { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; fclk: fclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; diff --git a/dts/arm/renesas/ra/ra4/r7fa4w1ad2cng.dtsi b/dts/arm/renesas/ra/ra4/r7fa4w1ad2cng.dtsi index 93ea6751e9ca8..4603b53044d22 100644 --- a/dts/arm/renesas/ra/ra4/r7fa4w1ad2cng.dtsi +++ b/dts/arm/renesas/ra/ra4/r7fa4w1ad2cng.dtsi @@ -78,7 +78,7 @@ /* PLL */ clocks = <&xtal>; - div = ; + div = <2>; mul = <12 0>; status = "disabled"; }; @@ -95,42 +95,42 @@ iclk: iclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <1>; #clock-cells = <2>; status = "okay"; }; pclka: pclka { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <1>; #clock-cells = <2>; status = "okay"; }; pclkb: pclkb { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclkc: pclkc { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <1>; #clock-cells = <2>; status = "okay"; }; pclkd: pclkd { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <1>; #clock-cells = <2>; status = "okay"; }; fclk: fclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; @@ -143,7 +143,7 @@ uclk: uclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <1>; #clock-cells = <2>; status = "okay"; }; diff --git a/dts/arm/renesas/ra/ra6/r7fa6e10x.dtsi b/dts/arm/renesas/ra/ra6/r7fa6e10x.dtsi index b070022ee5f4a..d8d31ceb55af1 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6e10x.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6e10x.dtsi @@ -133,7 +133,7 @@ /* PLL */ clocks = <&hoco>; - div = ; + div = <2>; mul = <20 0>; status = "disabled"; }; @@ -143,7 +143,7 @@ #clock-cells = <0>; /* PLL2 */ - div = ; + div = <2>; mul = <20 0>; status = "disabled"; }; @@ -160,42 +160,42 @@ iclk: iclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <1>; #clock-cells = <2>; status = "okay"; }; pclka: pclka { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclkb: pclkb { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkc: pclkc { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkd: pclkd { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; fclk: fclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; diff --git a/dts/arm/renesas/ra/ra6/r7fa6e2bx.dtsi b/dts/arm/renesas/ra/ra6/r7fa6e2bx.dtsi index 7576bb0dcd332..d1d9bfad58d26 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6e2bx.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6e2bx.dtsi @@ -74,7 +74,7 @@ /* PLL */ clocks = <&xtal>; - div = ; + div = <1>; mul = <10 0>; status = "disabled"; }; @@ -91,42 +91,42 @@ iclk: iclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <1>; #clock-cells = <2>; status = "okay"; }; pclka: pclka { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclkb: pclkb { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkc: pclkc { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkd: pclkd { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; fclk: fclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; diff --git a/dts/arm/renesas/ra/ra6/r7fa6m1ad3cfp.dtsi b/dts/arm/renesas/ra/ra6/r7fa6m1ad3cfp.dtsi index af17716832164..2415350363beb 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6m1ad3cfp.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6m1ad3cfp.dtsi @@ -68,7 +68,7 @@ /* PLL */ clocks = <&xtal>; - div = ; + div = <1>; mul = <20 0>; status = "disabled"; }; @@ -85,42 +85,42 @@ iclk: iclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclka: pclka { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclkb: pclkb { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkc: pclkc { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkd: pclkd { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; bclk: bclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; bclkout: bclkout { compatible = "renesas,ra-cgc-busclk"; clk-out-div = <2>; @@ -133,14 +133,14 @@ uclk: uclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <5>; #clock-cells = <2>; status = "okay"; }; fclk: fclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; diff --git a/dts/arm/renesas/ra/ra6/r7fa6m2ax.dtsi b/dts/arm/renesas/ra/ra6/r7fa6m2ax.dtsi index a06241a95b3f4..db5488f79f2a0 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6m2ax.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6m2ax.dtsi @@ -99,7 +99,7 @@ /* PLL */ clocks = <&xtal>; - div = ; + div = <1>; mul = <20 0>; status = "disabled"; }; @@ -116,42 +116,42 @@ iclk: iclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclka: pclka { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclkb: pclkb { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkc: pclkc { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkd: pclkd { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; bclk: bclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; bclkout: bclkout { compatible = "renesas,ra-cgc-busclk"; clk-out-div = <2>; @@ -164,14 +164,14 @@ uclk: uclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <5>; #clock-cells = <2>; status = "okay"; }; fclk: fclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; diff --git a/dts/arm/renesas/ra/ra6/r7fa6m3ax.dtsi b/dts/arm/renesas/ra/ra6/r7fa6m3ax.dtsi index 197be43a3fc2b..0e233cd7d6fe4 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6m3ax.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6m3ax.dtsi @@ -139,7 +139,7 @@ /* PLL */ clocks = <&xtal>; - div = ; + div = <2>; mul = <20 0>; status = "disabled"; }; @@ -156,42 +156,42 @@ iclk: iclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclka: pclka { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclkb: pclkb { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkc: pclkc { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkd: pclkd { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; bclk: bclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; bclkout: bclkout { compatible = "renesas,ra-cgc-busclk"; clk-out-div = <2>; @@ -204,14 +204,14 @@ uclk: uclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <5>; #clock-cells = <2>; status = "okay"; }; fclk: fclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; diff --git a/dts/arm/renesas/ra/ra6/r7fa6m4ax.dtsi b/dts/arm/renesas/ra/ra6/r7fa6m4ax.dtsi index 0310f61e65db8..da8000713620f 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6m4ax.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6m4ax.dtsi @@ -169,7 +169,7 @@ /* PLL */ clocks = <&xtal>; - div = ; + div = <3>; mul = <25 0>; status = "disabled"; }; @@ -179,7 +179,7 @@ #clock-cells = <0>; /* PLL2 */ - div = ; + div = <2>; mul = <20 0>; status = "disabled"; }; @@ -196,42 +196,42 @@ iclk: iclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <1>; #clock-cells = <2>; status = "okay"; }; pclka: pclka { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclkb: pclkb { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkc: pclkc { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkd: pclkd { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; bclk: bclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; bclkout: bclkout { compatible = "renesas,ra-cgc-busclk"; clk-out-div = <2>; @@ -244,7 +244,7 @@ fclk: fclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; diff --git a/dts/arm/renesas/ra/ra6/r7fa6m5xh.dtsi b/dts/arm/renesas/ra/ra6/r7fa6m5xh.dtsi index 91d95e288d83b..e266560fb5ff1 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6m5xh.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6m5xh.dtsi @@ -229,7 +229,7 @@ /* PLL */ clocks = <&xtal>; - div = ; + div = <3>; mul = <25 0>; status = "disabled"; }; @@ -239,7 +239,7 @@ #clock-cells = <0>; /* PLL2 */ - div = ; + div = <2>; mul = <20 0>; status = "disabled"; }; @@ -256,42 +256,42 @@ iclk: iclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <1>; #clock-cells = <2>; status = "okay"; }; pclka: pclka { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclkb: pclkb { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkc: pclkc { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkd: pclkd { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; bclk: bclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; bclkout: bclkout { compatible = "renesas,ra-cgc-busclk"; clk-out-div = <2>; @@ -304,7 +304,7 @@ fclk: fclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; diff --git a/dts/arm/renesas/ra/ra8/r7fa8d1xh.dtsi b/dts/arm/renesas/ra/ra8/r7fa8d1xh.dtsi index 5b00642bae339..3db4898ccb2f7 100644 --- a/dts/arm/renesas/ra/ra8/r7fa8d1xh.dtsi +++ b/dts/arm/renesas/ra/ra8/r7fa8d1xh.dtsi @@ -50,13 +50,13 @@ /* PLL */ clocks = <&xtal>; - div = ; + div = <2>; mul = <96 0>; - divp = ; + divp = <2>; freqp = ; - divq = ; + divq = <2>; freqq = ; - divr = ; + divr = <2>; freqr = ; status = "disabled"; }; @@ -66,13 +66,13 @@ #clock-cells = <0>; /* PLL2 */ - div = ; + div = <2>; mul = <96 0>; - divp = ; + divp = <2>; freqp = ; - divq = ; + divq = <2>; freqq = ; - divr = ; + divr = <2>; freqr = ; status = "disabled"; }; @@ -89,56 +89,56 @@ cpuclk: cpuclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <1>; #clock-cells = <2>; status = "okay"; }; iclk: iclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclka: pclka { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkb: pclkb { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <8>; #clock-cells = <2>; status = "okay"; }; pclkc: pclkc { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <8>; #clock-cells = <2>; status = "okay"; }; pclkd: pclkd { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclke: pclke { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; bclk: bclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; bclkout: bclkout { compatible = "renesas,ra-cgc-busclk"; clk-out-div = <2>; @@ -151,7 +151,7 @@ fclk: fclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <8>; #clock-cells = <2>; status = "okay"; }; diff --git a/dts/arm/renesas/ra/ra8/r7fa8m1xh.dtsi b/dts/arm/renesas/ra/ra8/r7fa8m1xh.dtsi index c184c1432e208..cb22fd3357a51 100644 --- a/dts/arm/renesas/ra/ra8/r7fa8m1xh.dtsi +++ b/dts/arm/renesas/ra/ra8/r7fa8m1xh.dtsi @@ -12,7 +12,7 @@ #address-cells = <1>; #size-cells = <1>; - xtal: clock-xtal { + xtal: clock-main-osc { compatible = "renesas,ra-cgc-external-clock"; clock-frequency = ; #clock-cells = <0>; @@ -50,13 +50,13 @@ /* PLL */ clocks = <&xtal>; - div = ; + div = <2>; mul = <96 0>; - divp = ; + divp = <2>; freqp = ; - divq = ; + divq = <2>; freqq = ; - divr = ; + divr = <2>; freqr = ; status = "disabled"; }; @@ -66,13 +66,13 @@ #clock-cells = <0>; /* PLL2 */ - div = ; + div = <2>; mul = <96 0>; - divp = ; + divp = <2>; freqp = ; - divq = ; + divq = <2>; freqq = ; - divr = ; + divr = <2>; freqr = ; status = "disabled"; }; @@ -89,56 +89,56 @@ cpuclk: cpuclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <1>; #clock-cells = <2>; status = "okay"; }; iclk: iclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclka: pclka { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkb: pclkb { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <8>; #clock-cells = <2>; status = "okay"; }; pclkc: pclkc { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <8>; #clock-cells = <2>; status = "okay"; }; pclkd: pclkd { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclke: pclke { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; bclk: bclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; bclkout: bclkout { compatible = "renesas,ra-cgc-busclk"; clk-out-div = <2>; @@ -151,7 +151,7 @@ fclk: fclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <8>; #clock-cells = <2>; status = "okay"; }; diff --git a/dts/arm/renesas/ra/ra8/r7fa8t1xh.dtsi b/dts/arm/renesas/ra/ra8/r7fa8t1xh.dtsi index 3f4fb717f354f..de851f6bf47e4 100644 --- a/dts/arm/renesas/ra/ra8/r7fa8t1xh.dtsi +++ b/dts/arm/renesas/ra/ra8/r7fa8t1xh.dtsi @@ -50,13 +50,13 @@ /* PLL */ clocks = <&xtal>; - div = ; + div = <2>; mul = <80 0>; - divp = ; + divp = <2>; freqp = ; - divq = ; + divq = <2>; freqq = ; - divr = ; + divr = <2>; freqr = ; status = "disabled"; }; @@ -66,13 +66,13 @@ #clock-cells = <0>; /* PLL2 */ - div = ; + div = <2>; mul = <96 0>; - divp = ; + divp = <2>; freqp = ; - divq = ; + divq = <2>; freqq = ; - divr = ; + divr = <2>; freqr = ; status = "disabled"; }; @@ -89,56 +89,56 @@ cpuclk: cpuclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <1>; #clock-cells = <2>; status = "okay"; }; iclk: iclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; pclka: pclka { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclkb: pclkb { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <8>; #clock-cells = <2>; status = "okay"; }; pclkc: pclkc { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <8>; #clock-cells = <2>; status = "okay"; }; pclkd: pclkd { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; #clock-cells = <2>; status = "okay"; }; pclke: pclke { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <2>; #clock-cells = <2>; status = "okay"; }; bclk: bclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <4>; bclkout: bclkout { compatible = "renesas,ra-cgc-busclk"; clk-out-div = <2>; @@ -151,7 +151,7 @@ fclk: fclk { compatible = "renesas,ra-cgc-pclk"; - clk-div = ; + div = <8>; #clock-cells = <2>; status = "okay"; }; diff --git a/dts/bindings/clock/renesas,ra-cgc-pclk.yaml b/dts/bindings/clock/renesas,ra-cgc-pclk.yaml index 1aac515882d74..798b1d3569f52 100644 --- a/dts/bindings/clock/renesas,ra-cgc-pclk.yaml +++ b/dts/bindings/clock/renesas,ra-cgc-pclk.yaml @@ -8,7 +8,7 @@ compatible: "renesas,ra-cgc-pclk" include: [clock-controller.yaml, base.yaml] properties: - clk-div: + div: type: int required: true description: Prescale divider to calculate the subclock frequency from the From 0f80f993f9a0cb1f4dbf4bf2f67ace1fb96852da Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Thu, 12 Sep 2024 23:23:33 +0900 Subject: [PATCH 0404/4482] drivers: clock_control: renesas_ra: Adding macros to convert DT values Adding the macros `RA_CGC_CLK_SRC` and `RA_CGC_CLK_DIV` that derive the BSP clock settings from the DeviceTree node settings. I also define some aliases to fill in the gaps with the BSP naming conventions. Signed-off-by: TOKITA Hiroshi --- .../clock_control_renesas_ra_cgc.c | 9 +- .../drivers/clock_control/renesas_ra_cgc.h | 46 +++++++ include/zephyr/dt-bindings/clock/ra_clock.h | 130 ------------------ 3 files changed, 51 insertions(+), 134 deletions(-) diff --git a/drivers/clock_control/clock_control_renesas_ra_cgc.c b/drivers/clock_control/clock_control_renesas_ra_cgc.c index 70512905be7aa..79da94a6d278c 100644 --- a/drivers/clock_control/clock_control_renesas_ra_cgc.c +++ b/drivers/clock_control/clock_control_renesas_ra_cgc.c @@ -90,10 +90,11 @@ static const struct clock_control_driver_api clock_control_reneas_ra_api = { #define INIT_PCLK(node_id) \ IF_ENABLED(DT_NODE_HAS_COMPAT(node_id, renesas_ra_cgc_pclk), \ (static const struct clock_control_ra_pclk_cfg node_id##_cfg = \ - {.clk_src = DT_PROP_OR(node_id, clk_src, \ - DT_PROP_OR(DT_PARENT(node_id), sysclock_src, \ - RA_CLOCK_SOURCE_DISABLE)), \ - .clk_div = DT_PROP_OR(node_id, clk_div, RA_SYS_CLOCK_DIV_1)}; \ + {.clk_src = COND_CODE_1( \ + DT_NODE_HAS_PROP(node_id, clocks), \ + (RA_CGC_CLK_SRC(DT_CLOCKS_CTLR(node_id))), \ + (RA_CGC_CLK_SRC(DT_CLOCKS_CTLR(DT_PARENT(node_id))))), \ + .clk_div = RA_CGC_CLK_DIV(node_id, div, 1)}; \ DEVICE_DT_DEFINE(node_id, &clock_control_ra_init_pclk, NULL, NULL, \ &node_id##_cfg, PRE_KERNEL_1, \ CONFIG_KERNEL_INIT_PRIORITY_OBJECTS, \ diff --git a/include/zephyr/drivers/clock_control/renesas_ra_cgc.h b/include/zephyr/drivers/clock_control/renesas_ra_cgc.h index 2e551256e8502..a7f147382fdc0 100644 --- a/include/zephyr/drivers/clock_control/renesas_ra_cgc.h +++ b/include/zephyr/drivers/clock_control/renesas_ra_cgc.h @@ -9,6 +9,52 @@ #include #include +#define RA_CGC_PROP_HAS_STATUS_OKAY_OR(node_id, prop, default_value) \ + COND_CODE_1(DT_NODE_HAS_STATUS(node_id, okay), (DT_PROP(node_id, prop)), (default_value)) + +#define RA_CGC_CLK_SRC(node_id) \ + COND_CODE_1(DT_NODE_HAS_STATUS(node_id, okay), \ + (UTIL_CAT(BSP_CLOCKS_SOURCE_, DT_NODE_FULL_NAME_UPPER_TOKEN(node_id))), \ + (BSP_CLOCKS_CLOCK_DISABLED)) + +#define RA_CGC_CLK_DIV(clk, prop, default_value) \ + UTIL_CAT(RA_CGC_DIV_, DT_NODE_FULL_NAME_UPPER_TOKEN(clk)) \ + (RA_CGC_PROP_HAS_STATUS_OKAY_OR(clk, prop, default_value)) + +#define RA_CGC_DIV_BCLK(n) UTIL_CAT(BSP_CLOCKS_SYS_CLOCK_DIV_, n) +#define RA_CGC_DIV_CANFDCLK(n) UTIL_CAT(BSP_CLOCKS_CANFD_CLOCK_DIV_, n) +#define RA_CGC_DIV_CECCLK(n) UTIL_CAT(BSP_CLOCKS_CEC_CLOCK_DIV_, n) +#define RA_CGC_DIV_CLKOUT(n) UTIL_CAT(BSP_CLOCKS_CLKOUT_DIV_, n) +#define RA_CGC_DIV_CPUCLK(n) UTIL_CAT(BSP_CLOCKS_SYS_CLOCK_DIV_, n) +#define RA_CGC_DIV_FCLK(n) UTIL_CAT(BSP_CLOCKS_SYS_CLOCK_DIV_, n) +#define RA_CGC_DIV_I3CCLK(n) UTIL_CAT(BSP_CLOCKS_I3C_CLOCK_DIV_, n) +#define RA_CGC_DIV_ICLK(n) UTIL_CAT(BSP_CLOCKS_SYS_CLOCK_DIV_, n) +#define RA_CGC_DIV_LCDCLK(n) UTIL_CAT(BSP_CLOCKS_LCD_CLOCK_DIV_, n) +#define RA_CGC_DIV_OCTASPICLK(n) UTIL_CAT(BSP_CLOCKS_OCTA_CLOCK_DIV_, n) +#define RA_CGC_DIV_PCLKA(n) UTIL_CAT(BSP_CLOCKS_SYS_CLOCK_DIV_, n) +#define RA_CGC_DIV_PCLKB(n) UTIL_CAT(BSP_CLOCKS_SYS_CLOCK_DIV_, n) +#define RA_CGC_DIV_PCLKC(n) UTIL_CAT(BSP_CLOCKS_SYS_CLOCK_DIV_, n) +#define RA_CGC_DIV_PCLKD(n) UTIL_CAT(BSP_CLOCKS_SYS_CLOCK_DIV_, n) +#define RA_CGC_DIV_PCLKE(n) UTIL_CAT(BSP_CLOCKS_SYS_CLOCK_DIV_, n) +#define RA_CGC_DIV_PLL(n) UTIL_CAT(BSP_CLOCKS_PLL_DIV_, n) +#define RA_CGC_DIV_PLL2(n) UTIL_CAT(BSP_CLOCKS_PLL_DIV_, n) +#define RA_CGC_DIV_SCICLK(n) UTIL_CAT(BSP_CLOCKS_SCI_CLOCK_DIV_, n) +#define RA_CGC_DIV_SPICLK(n) UTIL_CAT(BSP_CLOCKS_SPI_CLOCK_DIV_, n) +#define RA_CGC_DIV_U60CLK(n) UTIL_CAT(BSP_CLOCKS_USB60_CLOCK_DIV_, n) +#define RA_CGC_DIV_UCLK(n) UTIL_CAT(BSP_CLOCKS_USB_CLOCK_DIV_, n) + +#define BSP_CLOCKS_SOURCE_PLL BSP_CLOCKS_SOURCE_CLOCK_PLL +#define BSP_CLOCKS_SOURCE_PLL2 BSP_CLOCKS_SOURCE_CLOCK_PLL + +#define BSP_CLOCKS_CLKOUT_DIV_1 (0) +#define BSP_CLOCKS_CLKOUT_DIV_2 (1) +#define BSP_CLOCKS_CLKOUT_DIV_4 (2) +#define BSP_CLOCKS_CLKOUT_DIV_8 (3) +#define BSP_CLOCKS_CLKOUT_DIV_16 (4) +#define BSP_CLOCKS_CLKOUT_DIV_32 (5) +#define BSP_CLOCKS_CLKOUT_DIV_64 (6) +#define BSP_CLOCKS_CLKOUT_DIV_128 (7) + struct clock_control_ra_pclk_cfg { uint32_t clk_src; uint32_t clk_div; diff --git a/include/zephyr/dt-bindings/clock/ra_clock.h b/include/zephyr/dt-bindings/clock/ra_clock.h index d88b1b93646b7..97fc2e41b5600 100644 --- a/include/zephyr/dt-bindings/clock/ra_clock.h +++ b/include/zephyr/dt-bindings/clock/ra_clock.h @@ -7,136 +7,6 @@ #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_RA_H_ #define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_RA_H_ -#define RA_PLL_SOURCE_HOCO 0 -#define RA_PLL_SOURCE_MOCO 1 -#define RA_PLL_SOURCE_LOCO 2 -#define RA_PLL_SOURCE_MAIN_OSC 3 -#define RA_PLL_SOURCE_SUBCLOCK 4 -#define RA_PLL_SOURCE_DISABLE 0xff - -#define RA_CLOCK_SOURCE_HOCO 0 -#define RA_CLOCK_SOURCE_MOCO 1 -#define RA_CLOCK_SOURCE_LOCO 2 -#define RA_CLOCK_SOURCE_MAIN_OSC 3 -#define RA_CLOCK_SOURCE_SUBCLOCK 4 -#define RA_CLOCK_SOURCE_PLL 5 -#define RA_CLOCK_SOURCE_PLL1P RA_CLOCK_SOURCE_PLL -#define RA_CLOCK_SOURCE_PLL2 6 -#define RA_CLOCK_SOURCE_PLL2P RA_CLOCK_SOURCE_PLL2 -#define RA_CLOCK_SOURCE_PLL1Q 7 -#define RA_CLOCK_SOURCE_PLL1R 8 -#define RA_CLOCK_SOURCE_PLL2Q 9 -#define RA_CLOCK_SOURCE_PLL2R 10 -#define RA_CLOCK_SOURCE_DISABLE 0xff - -#define RA_SYS_CLOCK_DIV_1 0 -#define RA_SYS_CLOCK_DIV_2 1 -#define RA_SYS_CLOCK_DIV_4 2 -#define RA_SYS_CLOCK_DIV_8 3 -#define RA_SYS_CLOCK_DIV_16 4 -#define RA_SYS_CLOCK_DIV_32 5 -#define RA_SYS_CLOCK_DIV_64 6 -#define RA_SYS_CLOCK_DIV_128 7 /* available for CLKOUT only */ -#define RA_SYS_CLOCK_DIV_3 8 -#define RA_SYS_CLOCK_DIV_6 9 -#define RA_SYS_CLOCK_DIV_12 10 - -/* PLL divider options. */ -#define RA_PLL_DIV_1 0 -#define RA_PLL_DIV_2 1 -#define RA_PLL_DIV_3 2 -#define RA_PLL_DIV_4 3 -#define RA_PLL_DIV_5 4 -#define RA_PLL_DIV_6 5 -#define RA_PLL_DIV_8 7 -#define RA_PLL_DIV_9 8 -#define RA_PLL_DIV_16 15 - -/* USB clock divider options. */ -#define RA_USB_CLOCK_DIV_1 0 -#define RA_USB_CLOCK_DIV_2 1 -#define RA_USB_CLOCK_DIV_3 2 -#define RA_USB_CLOCK_DIV_4 3 -#define RA_USB_CLOCK_DIV_5 4 -#define RA_USB_CLOCK_DIV_6 5 -#define RA_USB_CLOCK_DIV_8 7 - -/* USB60 clock divider options. */ -#define RA_USB60_CLOCK_DIV_1 0 -#define RA_USB60_CLOCK_DIV_2 1 -#define RA_USB60_CLOCK_DIV_3 5 -#define RA_USB60_CLOCK_DIV_4 2 -#define RA_USB60_CLOCK_DIV_5 6 -#define RA_USB60_CLOCK_DIV_6 3 -#define RA_USB60_CLOCK_DIV_8 4 - -/* OCTA clock divider options. */ -#define RA_OCTA_CLOCK_DIV_1 0 -#define RA_OCTA_CLOCK_DIV_2 1 -#define RA_OCTA_CLOCK_DIV_4 2 -#define RA_OCTA_CLOCK_DIV_6 3 -#define RA_OCTA_CLOCK_DIV_8 4 - -/* CANFD clock divider options. */ -#define RA_CANFD_CLOCK_DIV_1 0 -#define RA_CANFD_CLOCK_DIV_2 1 -#define RA_CANFD_CLOCK_DIV_3 5 -#define RA_CANFD_CLOCK_DIV_4 2 -#define RA_CANFD_CLOCK_DIV_5 6 -#define RA_CANFD_CLOCK_DIV_6 3 -#define RA_CANFD_CLOCK_DIV_8 4 - -/* SCI clock divider options. */ -#define RA_SCI_CLOCK_DIV_1 0 -#define RA_SCI_CLOCK_DIV_2 1 -#define RA_SCI_CLOCK_DIV_3 5 -#define RA_SCI_CLOCK_DIV_4 2 -#define RA_SCI_CLOCK_DIV_5 6 -#define RA_SCI_CLOCK_DIV_6 3 -#define RA_SCI_CLOCK_DIV_8 4 - -/* SPI clock divider options. */ -#define RA_SPI_CLOCK_DIV_1 0 -#define RA_SPI_CLOCK_DIV_2 1 -#define RA_SPI_CLOCK_DIV_3 5 -#define RA_SPI_CLOCK_DIV_4 2 -#define RA_SPI_CLOCK_DIV_5 6 -#define RA_SPI_CLOCK_DIV_6 3 -#define RA_SPI_CLOCK_DIV_8 4 - -/* CEC clock divider options. */ -#define RA_CEC_CLOCK_DIV_1 0 -#define RA_CEC_CLOCK_DIV_2 1 - -/* I3C clock divider options. */ -#define RA_I3C_CLOCK_DIV_1 0 -#define RA_I3C_CLOCK_DIV_2 1 -#define RA_I3C_CLOCK_DIV_3 5 -#define RA_I3C_CLOCK_DIV_4 2 -#define RA_I3C_CLOCK_DIV_5 6 -#define RA_I3C_CLOCK_DIV_6 3 -#define RA_I3C_CLOCK_DIV_8 4 - -/* LCD clock divider options. */ -#define RA_LCD_CLOCK_DIV_1 0 -#define RA_LCD_CLOCK_DIV_2 1 -#define RA_LCD_CLOCK_DIV_3 5 -#define RA_LCD_CLOCK_DIV_4 2 -#define RA_LCD_CLOCK_DIV_5 6 -#define RA_LCD_CLOCK_DIV_6 3 -#define RA_LCD_CLOCK_DIV_8 4 - -/* SDADC clock divider options. */ -#define RA_SDADC_CLOCK_DIV_1 0 -#define RA_SDADC_CLOCK_DIV_2 1 -#define RA_SDADC_CLOCK_DIV_3 2 -#define RA_SDADC_CLOCK_DIV_4 3 -#define RA_SDADC_CLOCK_DIV_5 4 -#define RA_SDADC_CLOCK_DIV_6 5 -#define RA_SDADC_CLOCK_DIV_8 6 -#define RA_SDADC_CLOCK_DIV_12 7 -#define RA_SDADC_CLOCK_DIV_16 8 - #define MSTPA 0 #define MSTPB 1 #define MSTPC 2 From dccf4bfb0f1e099b4a5ba190cd9c99b12a2fc997 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 10 Aug 2024 19:37:24 +0900 Subject: [PATCH 0405/4482] manifest: update hal_rpi_pico Update RaspberryPi Pico hal to 2.0.0 release Signed-off-by: TOKITA Hiroshi --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 192676713952a..c0415433bc278 100644 --- a/west.yml +++ b/west.yml @@ -219,7 +219,7 @@ manifest: - hal - name: hal_rpi_pico path: modules/hal/rpi_pico - revision: fba7162cc7bee06d0149622bbcaac4e41062d368 + revision: 79ee0f9e058a6327fc943d2f2a19cf3ade107cec groups: - hal - name: hal_silabs From 6a2aafe2868c6ada55e9ed377166300f25dbebce Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Fri, 9 Aug 2024 22:56:51 +0900 Subject: [PATCH 0406/4482] modules: hal_rpi_pico: Update to fit for 2.0.0 directory structure The directory structure has changed in 2.0.0, so we update it accordingly. Signed-off-by: TOKITA Hiroshi --- modules/hal_rpi_pico/CMakeLists.txt | 37 +++++++++++-------- .../hal_rpi_pico/bootloader/CMakeLists.txt | 9 +++-- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/modules/hal_rpi_pico/CMakeLists.txt b/modules/hal_rpi_pico/CMakeLists.txt index b68c2efdb37ee..c91e646799253 100644 --- a/modules/hal_rpi_pico/CMakeLists.txt +++ b/modules/hal_rpi_pico/CMakeLists.txt @@ -8,7 +8,7 @@ if(CONFIG_HAS_RPI_PICO) set(rp2_common_dir ${ZEPHYR_HAL_RPI_PICO_MODULE_DIR}/src/rp2_common) set(rp2040_dir ${ZEPHYR_HAL_RPI_PICO_MODULE_DIR}/src/rp2040) set(common_dir ${ZEPHYR_HAL_RPI_PICO_MODULE_DIR}/src/common) - set(boot_stage_dir ${rp2_common_dir}/boot_stage2) + set(boot_stage_dir ${rp2040_dir}/boot_stage2) # The Second Stage Bootloader is only linked to the app that resides # at 0x100. Therefore, only if the app's offset is 0x100, the second @@ -46,6 +46,8 @@ if(CONFIG_HAS_RPI_PICO) zephyr_library_sources(${rp2_bootloader_asm}) endif() + zephyr_compile_definitions(PICO_RP2040) + # Pico sources and headers necessary for every build. # These contain definitions and implementation used mostly for # initializing the SoC, and therefore are always required. @@ -55,11 +57,12 @@ if(CONFIG_HAS_RPI_PICO) ${rp2_common_dir}/hardware_pll/pll.c ${rp2_common_dir}/hardware_xosc/xosc.c ${rp2_common_dir}/hardware_watchdog/watchdog.c - ${rp2_common_dir}/pico_platform/platform.c ${rp2_common_dir}/pico_bootrom/bootrom.c + ${rp2040_dir}/pico_platform/platform.c ) zephyr_include_directories( + ${common_dir}/pico_base_headers/include ${rp2_common_dir}/hardware_base/include ${rp2_common_dir}/hardware_clocks/include ${rp2_common_dir}/hardware_watchdog/include @@ -69,11 +72,18 @@ if(CONFIG_HAS_RPI_PICO) ${rp2_common_dir}/hardware_sync/include ${rp2_common_dir}/hardware_timer/include ${rp2_common_dir}/hardware_resets/include + ${rp2_common_dir}/hardware_boot_lock/include + ${rp2_common_dir}/hardware_ticks/include + ${rp2_common_dir}/hardware_sync_spin_lock/include ${rp2_common_dir}/pico_bootrom/include + ${rp2_common_dir}/pico_platform_compiler/include + ${rp2_common_dir}/pico_platform_sections/include + ${rp2_common_dir}/pico_platform_panic/include + ${common_dir}/boot_picoboot_headers/include + ${common_dir}/boot_picobin_headers/include ${rp2040_dir}/hardware_regs/include ${rp2040_dir}/hardware_structs/include - ${common_dir}/pico_base/include - ${rp2_common_dir}/pico_platform/include + ${rp2040_dir}/pico_platform/include ${CMAKE_CURRENT_LIST_DIR} ) @@ -108,16 +118,16 @@ if(CONFIG_HAS_RPI_PICO) zephyr_include_directories_ifdef(CONFIG_PICOSDK_USE_TIMER ${rp2_common_dir}/hardware_timer/include) - zephyr_library_sources_ifdef(CONFIG_PICOSDK_USE_CLAIM - ${rp2_common_dir}/hardware_claim/claim.c) - zephyr_include_directories_ifdef(CONFIG_PICOSDK_USE_CLAIM - ${rp2_common_dir}/hardware_claim/include) - zephyr_library_sources_ifdef(CONFIG_PICOSDK_USE_RTC ${rp2_common_dir}/hardware_rtc/rtc.c) zephyr_include_directories_ifdef(CONFIG_PICOSDK_USE_RTC ${rp2_common_dir}/hardware_rtc/include) + zephyr_library_sources_ifdef(CONFIG_PICOSDK_USE_PIO + ${rp2_common_dir}/hardware_pio/pio.c) + zephyr_include_directories_ifdef(CONFIG_PICOSDK_USE_PIO + ${rp2_common_dir}/hardware_pio/include) + # Some flash driver functions must be executed from the RAM. # Originally pico-sdk places them in the RW data section, so this # implementation does the same. @@ -130,14 +140,9 @@ if(CONFIG_HAS_RPI_PICO) COMPILE_FLAGS $ ) - zephyr_library_sources_ifdef(CONFIG_PICOSDK_USE_PIO - ${rp2_common_dir}/hardware_pio/pio.c) - zephyr_include_directories_ifdef(CONFIG_PICOSDK_USE_PIO - ${rp2_common_dir}/hardware_pio/include) - zephyr_library_sources_ifdef(CONFIG_PICOSDK_USE_CLAIM - ${rp2_common_dir}/hardware_claim/claim.c) + ${common_dir}/hardware_claim/claim.c) zephyr_include_directories_ifdef(CONFIG_PICOSDK_USE_CLAIM - ${rp2_common_dir}/hardware_claim/include) + ${common_dir}/hardware_claim/include) endif() diff --git a/modules/hal_rpi_pico/bootloader/CMakeLists.txt b/modules/hal_rpi_pico/bootloader/CMakeLists.txt index c8faaa67edb91..7e8d39d8951fb 100644 --- a/modules/hal_rpi_pico/bootloader/CMakeLists.txt +++ b/modules/hal_rpi_pico/bootloader/CMakeLists.txt @@ -11,7 +11,7 @@ enable_language(ASM) set(rp2_common_dir ${ZEPHYR_HAL_RPI_PICO_MODULE_DIR}/src/rp2_common) set(rp2040_dir ${ZEPHYR_HAL_RPI_PICO_MODULE_DIR}/src/rp2040) set(common_dir ${ZEPHYR_HAL_RPI_PICO_MODULE_DIR}/src/common) -set(boot_stage_dir ${rp2_common_dir}/boot_stage2) +set(boot_stage_dir ${rp2040_dir}/boot_stage2) add_executable(boot_stage2) @@ -34,9 +34,12 @@ target_sources(boot_stage2 PRIVATE ${boot_stage_dir}/${flash_type_file}) target_include_directories(boot_stage2 PUBLIC .. ${boot_stage_dir}/asminclude - ${rp2_common_dir}/pico_platform/include + ${rp2040_dir}/pico_platform/include ${rp2040_dir}/hardware_regs/include - ${common_dir}/pico_base/include + ${common_dir}/pico_base_headers/include + ${rp2_common_dir}/pico_platform_compiler/include + ${rp2_common_dir}/pico_platform_sections/include + ${rp2_common_dir}/pico_platform_panic/include ${ZEPHYR_BASE}/include ) From 1400ee713a11bb0cc782341be39748daf9b11d97 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 10 Aug 2024 19:37:55 +0900 Subject: [PATCH 0407/4482] drivers: gpio: rpi_pico: Fitting for the changes made in pico-sdk 2.0.0 Following the GPIO interface changes in pico-sdk 2.0.0. Signed-off-by: TOKITA Hiroshi --- drivers/gpio/gpio_rpi_pico.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio_rpi_pico.c b/drivers/gpio/gpio_rpi_pico.c index 41ed8e64ecbd3..4c5ce08a8fa7c 100644 --- a/drivers/gpio/gpio_rpi_pico.c +++ b/drivers/gpio/gpio_rpi_pico.c @@ -192,7 +192,7 @@ static const struct gpio_driver_api gpio_rpi_driver_api = { static void gpio_rpi_isr(const struct device *dev) { struct gpio_rpi_data *data = dev->data; - io_irq_ctrl_hw_t *irq_ctrl_base; + io_bank0_irq_ctrl_hw_t *irq_ctrl_base; const io_rw_32 *status_reg; uint32_t events; uint32_t pin; From 16c9b74e3a838ebc935539f99ff6b6c9f6deffd0 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sun, 11 Aug 2024 04:45:07 +0900 Subject: [PATCH 0408/4482] drivers: flash: rpi_pico: Rename to avoid conflicting with SDK Some symbol names have been conflicted with introducing pico-sdk 2.0.0. Rename these. Signed-off-by: TOKITA Hiroshi --- drivers/flash/flash_rpi_pico.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/flash/flash_rpi_pico.c b/drivers/flash/flash_rpi_pico.c index 71231c48043fd..0940e94327c8f 100644 --- a/drivers/flash/flash_rpi_pico.c +++ b/drivers/flash/flash_rpi_pico.c @@ -171,9 +171,9 @@ void __no_inline_not_in_flash_func(flash_write_partial)(uint32_t flash_offs, con { rom_connect_internal_flash_fn connect_internal_flash = (rom_connect_internal_flash_fn) rom_func_lookup_inline(ROM_FUNC_CONNECT_INTERNAL_FLASH); - rom_flash_exit_xip_fn flash_exit_xip = (rom_flash_exit_xip_fn) + rom_flash_exit_xip_fn exit_xip = (rom_flash_exit_xip_fn) rom_func_lookup_inline(ROM_FUNC_FLASH_EXIT_XIP); - rom_flash_flush_cache_fn flash_flush_cache = (rom_flash_flush_cache_fn) + rom_flash_flush_cache_fn flush_cache = (rom_flash_flush_cache_fn) rom_func_lookup_inline(ROM_FUNC_FLASH_FLUSH_CACHE); flash_init_boot2_copyout(); @@ -181,9 +181,9 @@ void __no_inline_not_in_flash_func(flash_write_partial)(uint32_t flash_offs, con __compiler_memory_barrier(); connect_internal_flash(); - flash_exit_xip(); + exit_xip(); flash_write_partial_internal(flash_offs, data, count); - flash_flush_cache(); + flush_cache(); flash_enable_xip_via_boot2(); } From 6bc0970c409cf9fabc9e73e9b884f3af72cc2098 Mon Sep 17 00:00:00 2001 From: Krystof Sadlik Date: Mon, 29 Jul 2024 10:53:49 +0200 Subject: [PATCH 0409/4482] tests: counter: counter_basic_api: Added testcase wihtout alarms Some counter drivers do not support alarms, so I added testcase which starts the counter, checks if the value is in range after certain time and stops the counter, to check if the counter is running correctly. Signed-off-by: Krystof Sadlik Co-authored-by: Michal Smola --- .../counter_basic_api/src/test_counter.c | 90 ++++++++++++++++++- 1 file changed, 89 insertions(+), 1 deletion(-) diff --git a/tests/drivers/counter/counter_basic_api/src/test_counter.c b/tests/drivers/counter/counter_basic_api/src/test_counter.c index 32543de20bfd7..42547924d0c25 100644 --- a/tests/drivers/counter/counter_basic_api/src/test_counter.c +++ b/tests/drivers/counter/counter_basic_api/src/test_counter.c @@ -138,7 +138,6 @@ static const struct device *const period_devs[] = { }; typedef void (*counter_test_func_t)(const struct device *dev); - typedef bool (*counter_capability_func_t)(const struct device *dev); static inline uint32_t get_counter_period_us(const struct device *dev) @@ -680,6 +679,95 @@ ZTEST(counter_basic, test_all_channels) single_channel_alarm_capable); } +static void test_valid_function_without_alarm(const struct device *dev) +{ + int err; + uint32_t ticks; + uint32_t ticks_expected; + uint32_t ticks_tol; + uint32_t wait_for_us; + uint32_t freq = counter_get_frequency(dev); + + /* For timers which cannot count to at least 2 ms before overflow + * the test is skipped by test_all_instances function because sufficient + * accuracy of the test cannot be achieved. + */ + + zassert_true(freq != 0, "%s: counter could not get frequency", dev->name); + + /* Set time of counting based on counter frequency to + * ensure convenient run time and accuracy of the test. + */ + if (freq < 1000) { + /* Ensure to have 1 tick for 1 sec clock */ + wait_for_us = 1100000; + ticks_expected = counter_us_to_ticks(dev, wait_for_us); + } else if (freq < 1000000) { + /* Calculate wait time for convenient ticks count */ + ticks_expected = 1000; + wait_for_us = (ticks_expected * 1000000) / freq; + } else { + /* Wait long enough for high frequency clocks to minimize + * impact of latencies and k_busy_wait function accuracy. + */ + wait_for_us = 1000; + ticks_expected = counter_us_to_ticks(dev, wait_for_us); + } + + /* Set 10% or 2 ticks tolerance, whichever is greater */ + ticks_tol = ticks_expected / 10; + ticks_tol = ticks_tol < 2 ? 2 : ticks_tol; + + if (!counter_is_counting_up(dev)) { + ticks_expected = counter_get_top_value(dev) - ticks_expected; + } + + err = counter_start(dev); + zassert_equal(0, err, "%s: counter failed to start", dev->name); + + k_busy_wait(wait_for_us); + + err = counter_get_value(dev, &ticks); + + zassert_equal(0, err, "%s: could not get counter value", dev->name); + zassert_between_inclusive( + ticks, ticks_expected > ticks_tol ? ticks_expected - ticks_tol : 0, + ticks_expected + ticks_tol, "%s: counter ticks not in tolerance", dev->name); + + /* ticks count is always within ticks_tol for RTC, therefor + * check, if ticks are greater than 0. + */ + zassert_true((ticks > 0), "%s: counter did not count", dev->name); + + err = counter_stop(dev); + zassert_equal(0, err, "%s: counter failed to stop", dev->name); +} + +static bool ms_period_capable(const struct device *dev) +{ + uint32_t freq_khz; + uint32_t max_time_ms; + + /* Assume 2 ms counter periode can be set for frequency below 1 kHz*/ + if (counter_get_frequency(dev) < 1000) { + return true; + } + + freq_khz = counter_get_frequency(dev) / 1000; + max_time_ms = counter_get_top_value(dev) / freq_khz; + + if (max_time_ms >= 2) { + return true; + } + + return false; +} + +ZTEST(counter_basic, test_valid_function_without_alarm) +{ + test_all_instances(test_valid_function_without_alarm, ms_period_capable); +} + /** * Test validates if alarm set too late (current tick or current tick + 1) * results in callback being called. From ced4e1623574ab4c06eacb99267a3d003c14bbeb Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Sat, 13 Jul 2024 11:38:11 -0400 Subject: [PATCH 0410/4482] drivers: flash: provide a generic flash_copy() algorithm Provide a generic flash_copy() algorithm that is capable of copying from one flash device to another or within different regions of the same flash device. Signed-off-by: Chris Friedt --- drivers/flash/flash_util.c | 122 ++++++++++++++++++++++++++++++++- include/zephyr/drivers/flash.h | 31 +++++++++ 2 files changed, 152 insertions(+), 1 deletion(-) diff --git a/drivers/flash/flash_util.c b/drivers/flash/flash_util.c index fcd6509b802f0..79d1e53cdb6e7 100644 --- a/drivers/flash/flash_util.c +++ b/drivers/flash/flash_util.c @@ -6,10 +6,17 @@ #include +#include +#include +#include +#include +/* FIXME: use k_off_t instead of off_t */ +#include #include +#include #include -#include +#include LOG_MODULE_REGISTER(flash, CONFIG_FLASH_LOG_LEVEL); @@ -80,3 +87,116 @@ int z_impl_flash_flatten(const struct device *dev, off_t offset, size_t size) return -ENOSYS; #endif } + +/* note: caller must first check for positivity (>=0) */ +static inline bool off_add_overflow(off_t offset, off_t size, off_t *result) +{ + BUILD_ASSERT((sizeof(off_t) == sizeof(uint32_t)) || (sizeof(off_t) == sizeof(uint64_t))); + + if (sizeof(off_t) == sizeof(uint32_t)) { + uint32_t end; + + /* account for signedness of off_t due to lack of s32_add_overflow() */ + if (u32_add_overflow((uint32_t)offset, (uint32_t)size, &end) || (end > INT32_MAX)) { + return true; + } + } else if (sizeof(off_t) == sizeof(uint64_t)) { + uint64_t end; + + /* account for signedness of off_t due to lack of s64_add_overflow() */ + if (u64_add_overflow((uint64_t)offset, (uint64_t)size, &end) || (end > INT64_MAX)) { + return true; + } + } + + return false; +} + +/* note: caller must first check for overflow */ +static inline bool flash_ranges_overlap(off_t a_start, off_t a_size, off_t b_start, off_t b_size) +{ + off_t a_end = a_start + a_size; + off_t b_end = b_start + b_size; + + return (a_start < b_end) && (a_end > b_start); +} + +int z_impl_flash_copy(const struct device *src_dev, off_t src_offset, const struct device *dst_dev, + off_t dst_offset, off_t size, uint8_t *buf, size_t buf_size) +{ + int ret; + off_t end; + size_t write_size; + + if ((src_offset < 0) || (dst_offset < 0) || (size < 0) || (buf == NULL) || + (buf_size == 0) || off_add_overflow(src_offset, size, &end) || + off_add_overflow(dst_offset, size, &end)) { + LOG_DBG("invalid argument"); + return -EINVAL; + } + + if (src_dev == dst_dev) { + if (src_offset == dst_offset) { + return 0; + } + + if (flash_ranges_overlap(src_offset, size, dst_offset, size) != 0) { + return -EINVAL; + } + } + + if (!device_is_ready(src_dev)) { + LOG_DBG("%s device not ready", "src"); + return -ENODEV; + } + + if (!device_is_ready(dst_dev)) { + LOG_DBG("%s device not ready", "dst"); + return -ENODEV; + } + + write_size = flash_get_write_block_size(dst_dev); + if ((buf_size < write_size) || ((buf_size % write_size) != 0)) { + LOG_DBG("buf size %zu is incompatible with write_size of %zu", buf_size, + write_size); + return -EINVAL; + } + + for (uint32_t offs = 0, N = size, bytes_read = 0, bytes_left = N; offs < N; + offs += bytes_read, bytes_left -= bytes_read) { + + if (bytes_left < write_size) { + const struct flash_driver_api *api = + (const struct flash_driver_api *)dst_dev->api; + const struct flash_parameters *params = api->get_parameters(dst_dev); + + memset(buf, params->erase_value, write_size); + } + bytes_read = MIN(MAX(bytes_left, write_size), buf_size); + ret = flash_read(src_dev, src_offset + offs, buf, bytes_read); + if (ret < 0) { + LOG_DBG("%s() failed at offset %lx: %d", "flash_read", + (long)(src_offset + offs), ret); + return ret; + } + + ret = flash_write(dst_dev, dst_offset + offs, buf, bytes_read); + if (ret < 0) { + LOG_DBG("%s() failed at offset %lx: %d", "flash_write", + (long)(src_offset + offs), ret); + return ret; + } + } + + return 0; +} + +#ifdef CONFIG_USERSPACE +int z_vrfy_flash_copy(const struct device *src_dev, off_t src_offset, const struct device *dst_dev, + off_t dst_offset, off_t size, uint8_t *buf, size_t buf_size) +{ + K_OOPS(K_SYSCALL_MEMORY_WRITE(buf, buf_size)); + return z_impl_flash_copy(src_dev, src_offset, dst_dev, dst_offset, size, buf, buf_size); +} +#include +#endif diff --git a/include/zephyr/drivers/flash.h b/include/zephyr/drivers/flash.h index f7b31b15158e6..a3f1437b18d96 100644 --- a/include/zephyr/drivers/flash.h +++ b/include/zephyr/drivers/flash.h @@ -583,6 +583,37 @@ static inline const struct flash_parameters *z_impl_flash_get_parameters(const s __syscall int flash_ex_op(const struct device *dev, uint16_t code, const uintptr_t in, void *out); +/** + * @brief Copy flash memory from one device to another. + * + * Copy a region of flash memory from one place to another. The source and + * destination flash devices may be the same or different devices. However, + * this function will fail if the source and destination devices are the same + * if memory regions overlap and are not identical. + * + * The caller must supply a buffer of suitable size and ensure that the + * destination is erased beforehand, if necessary. + * + * @note If the source and destination devices are the same, and the source + * and destination offsets are also the same, this function succeeds without + * performing any copy operation. + * + * @param src_dev Source flash device. + * @param dst_dev Destination flash device. + * @param src_offset Offset within the source flash device. + * @param dst_offset Offset within the destination flash device. + * @param size Size of the region to copy, in bytes. + * @param[out] buf Pointer to a buffer of size @a buf_size. + * @param buf_size Size of the buffer pointed to by @a buf. + * + * @retval 0 on success + * @retval -EINVAL if an argument is invalid. + * @retval -EIO if an I/O error occurs. + * @retval -ENODEV if either @a src_dev or @a dst_dev are not ready. + */ +__syscall int flash_copy(const struct device *src_dev, off_t src_offset, + const struct device *dst_dev, off_t dst_offset, off_t size, uint8_t *buf, + size_t buf_size); /* * Extended operation interface provides flexible way for supporting flash * controller features. Code space is divided equally into Zephyr codes From 5d1c881b02893f150eb1df88486f25ddf31738f6 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Wed, 28 Aug 2024 23:14:56 -0400 Subject: [PATCH 0411/4482] tests: flash: common: randomize before each test test_flash_erase() requires that the expected[] array contains pseudo-random data. However, the expected[] array would only be initialized once before all tests are run using the setup callback. Instead, use the before() callback to randomize data before each test in the suite, since there is otherwise no guarantee that test_flash_erase() will be run directly after the expected[] array has been randomized. Signed-off-by: Chris Friedt --- tests/drivers/flash/common/src/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/drivers/flash/common/src/main.c b/tests/drivers/flash/common/src/main.c index 9ca767943d9e2..2f30c46c0f9c5 100644 --- a/tests/drivers/flash/common/src/main.c +++ b/tests/drivers/flash/common/src/main.c @@ -55,10 +55,12 @@ static uint8_t __aligned(4) expected[EXPECTED_SIZE]; static uint8_t erase_value; static bool ebw_required; -static void *flash_driver_setup(void) +static void flash_driver_before(void *arg) { int rc; + ARG_UNUSED(arg); + TC_PRINT("Test will run on device %s\n", flash_dev->name); zassert_true(device_is_ready(flash_dev)); @@ -120,8 +122,6 @@ static void *flash_driver_setup(void) zassert_equal(rc, 0, "Flash memory not properly erased"); } } - - return NULL; } ZTEST(flash_driver, test_read_unaligned_address) @@ -374,4 +374,4 @@ ZTEST(flash_driver, test_flash_page_layout) test_cb_data.page_counter, test_cb_data.exit_page); } -ZTEST_SUITE(flash_driver, NULL, flash_driver_setup, NULL, NULL, NULL); +ZTEST_SUITE(flash_driver, NULL, NULL, flash_driver_before, NULL, NULL); From ccc78912be3ef5c7acdc318ffe39281bcea34cb1 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Sat, 13 Jul 2024 15:38:46 -0400 Subject: [PATCH 0412/4482] tests: drivers: flash: add flash_copy() test Add a test for coverage of flash_copy() Signed-off-by: Chris Friedt --- tests/drivers/flash/common/src/main.c | 74 +++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/tests/drivers/flash/common/src/main.c b/tests/drivers/flash/common/src/main.c index 2f30c46c0f9c5..f7f7c6ee64ee7 100644 --- a/tests/drivers/flash/common/src/main.c +++ b/tests/drivers/flash/common/src/main.c @@ -374,4 +374,78 @@ ZTEST(flash_driver, test_flash_page_layout) test_cb_data.page_counter, test_cb_data.exit_page); } +static void test_flash_copy_inner(const struct device *src_dev, off_t src_offset, + const struct device *dst_dev, off_t dst_offset, off_t size, + uint8_t *buf, size_t buf_size, int expected_result) +{ + int actual_result; + + if ((expected_result == 0) && (size != 0) && (src_offset != dst_offset)) { + /* prepare for successful copy */ + zassert_ok(flash_flatten(flash_dev, page_info.start_offset, page_info.size)); + zassert_ok(flash_fill(flash_dev, 0xaa, page_info.start_offset, page_info.size)); + zassert_ok(flash_flatten(flash_dev, page_info.start_offset + page_info.size, + page_info.size)); + } + + /* perform copy (if args are valid) */ + actual_result = flash_copy(src_dev, src_offset, dst_dev, dst_offset, size, buf, buf_size); + zassert_equal(actual_result, expected_result, + "flash_copy(%p, %lx, %p, %lx, %zu, %p, %zu) failed: expected: %d actual: %d", + src_dev, src_offset, dst_dev, dst_offset, size, buf, buf_size, + expected_result, actual_result); + + if ((expected_result == 0) && (size != 0) && (src_offset != dst_offset)) { + /* verify a successful copy */ + zassert_ok(flash_read(flash_dev, TEST_AREA_OFFSET, expected, EXPECTED_SIZE)); + for (int i = 0; i < EXPECTED_SIZE; i++) { + zassert_equal(buf[i], 0xaa, "incorrect data (%02x) at %d", buf[i], i); + } + } +} + +ZTEST(flash_driver, test_flash_copy) +{ + uint8_t buf[EXPECTED_SIZE]; + const off_t off_max = (sizeof(off_t) == sizeof(int32_t)) ? INT32_MAX : INT64_MAX; + + /* + * Rather than explicitly testing 128+ permutations of input, + * merge redundant cases: + * - src_dev or dst_dev are invalid + * - src_offset or dst_offset are invalid + * - src_offset + size or dst_offset + size overflow + * - buf is NULL + * - buf size is invalid + */ + test_flash_copy_inner(NULL, -1, NULL, -1, -1, NULL, 0, -EINVAL); + test_flash_copy_inner(NULL, -1, NULL, -1, -1, NULL, sizeof(buf), -EINVAL); + test_flash_copy_inner(NULL, -1, NULL, -1, -1, buf, sizeof(buf), -EINVAL); + test_flash_copy_inner(NULL, -1, NULL, -1, page_info.size, buf, sizeof(buf), -EINVAL); + test_flash_copy_inner(NULL, -1, NULL, -1, page_info.size, buf, sizeof(buf), -EINVAL); + test_flash_copy_inner(NULL, page_info.start_offset, NULL, + page_info.start_offset + page_info.size, page_info.size, buf, + sizeof(buf), -ENODEV); + test_flash_copy_inner(flash_dev, page_info.start_offset, flash_dev, + page_info.start_offset + page_info.size, page_info.size, buf, + sizeof(buf), 0); + + /* zero-sized copy should succeed */ + test_flash_copy_inner(flash_dev, page_info.start_offset, flash_dev, + page_info.start_offset + page_info.size, 0, buf, sizeof(buf), 0); + + /* copy with same offset should succeed */ + test_flash_copy_inner(flash_dev, page_info.start_offset, flash_dev, page_info.start_offset, + page_info.size, buf, sizeof(buf), 0); + + /* copy with integer overflow should fail */ + test_flash_copy_inner(flash_dev, off_max, flash_dev, page_info.start_offset, 42, buf, + sizeof(buf), -EINVAL); + + /* copy with overlapping ranges should fail */ + test_flash_copy_inner(flash_dev, page_info.start_offset, flash_dev, + page_info.start_offset + 32, page_info.size - 32, buf, sizeof(buf), + -EINVAL); +} + ZTEST_SUITE(flash_driver, NULL, NULL, flash_driver_before, NULL, NULL); From 41e4b5323ac3888c45763ed7574c892cf3907fb5 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Sat, 13 Jul 2024 11:38:58 -0400 Subject: [PATCH 0413/4482] drivers: flash: shell: add "flash copy" command Add a flash copy command, capable of copying a region in one flash device to a region on the same or another flash device. The destination is erased prior to copying. This is useful for evaluating mcuboot on devices with little on-chip resources, or devices that are incapable of running more elaborate image management services (e.g. via bluetooth or networking). Additionally, it's useful for evaluating mcuboot on devices with one or more images stored on external spi flash. The command syntax is flash copy E.g. flash copy flash@0 flash-controller@abcd1234 0x1234 0x5678 21012 Copied 21012 bytes from flash@0:1234 to \ flash-controller@abcd1234:5678 Signed-off-by: Chris Friedt --- drivers/flash/flash_shell.c | 73 ++++++++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 17 deletions(-) diff --git a/drivers/flash/flash_shell.c b/drivers/flash/flash_shell.c index a0d6a19a2332a..74b490266e747 100644 --- a/drivers/flash/flash_shell.c +++ b/drivers/flash/flash_shell.c @@ -5,19 +5,33 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include +#include +#include +#include +#include + #include #include - +#include #include #include -#include -#include -#include - /* Buffer is only needed for bytes that follow command and offset */ #define BUF_ARRAY_CNT (CONFIG_SHELL_ARGC_MAX - 2) +#define FLASH_LOAD_BUF_MAX 256 + +static const struct device *flash_load_dev; +static uint32_t flash_load_buf_size; +static uint32_t flash_load_addr; +static uint32_t flash_load_total; +static uint32_t flash_load_written; +static uint32_t flash_load_chunk; + +static uint32_t flash_load_boff; +static uint8_t flash_load_buf[FLASH_LOAD_BUF_MAX]; + /* This only issues compilation error when it would not be possible * to extract at least one byte from command line arguments, yet * it does not warrant successful writes if BUF_ARRAY_CNT @@ -165,6 +179,40 @@ static int cmd_write(const struct shell *sh, size_t argc, char *argv[]) return 0; } +static int cmd_copy(const struct shell *sh, size_t argc, char *argv[]) +{ + int ret; + uint32_t size = 0; + uint32_t src_offset = 0; + uint32_t dst_offset = 0; + const struct device *src_dev = NULL; + const struct device *dst_dev = NULL; + + if (argc < 5) { + shell_error(sh, "missing parameters"); + return -EINVAL; + } + + src_dev = device_get_binding(argv[1]); + dst_dev = device_get_binding(argv[2]); + src_offset = strtoul(argv[3], NULL, 0); + dst_offset = strtoul(argv[4], NULL, 0); + /* size will be padded to write_size bytes */ + size = strtoul(argv[5], NULL, 0); + + ret = flash_copy(src_dev, src_offset, dst_dev, dst_offset, size, flash_load_buf, + sizeof(flash_load_buf)); + if (ret < 0) { + shell_error(sh, "%s failed: %d", "flash_copy()", ret); + return -EIO; + } + + shell_print(sh, "Copied %u bytes from %s:%x to %s:%x", size, argv[1], src_offset, argv[2], + dst_offset); + + return 0; +} + static int cmd_read(const struct shell *sh, size_t argc, char *argv[]) { const struct device *flash_dev; @@ -544,18 +592,6 @@ static int set_bypass(const struct shell *sh, shell_bypass_cb_t bypass) return 0; } -#define FLASH_LOAD_BUF_MAX 256 - -static const struct device *flash_load_dev; -static uint32_t flash_load_buf_size; -static uint32_t flash_load_addr; -static uint32_t flash_load_total; -static uint32_t flash_load_written; -static uint32_t flash_load_chunk; - -static uint32_t flash_load_boff; -static uint8_t flash_load_buf[FLASH_LOAD_BUF_MAX]; - static void bypass_cb(const struct shell *sh, uint8_t *recv, size_t len) { uint32_t left_to_read = flash_load_total - flash_load_written - flash_load_boff; @@ -711,6 +747,9 @@ static void device_name_get(size_t idx, struct shell_static_entry *entry) } SHELL_STATIC_SUBCMD_SET_CREATE(flash_cmds, + SHELL_CMD_ARG(copy, &dsub_device_name, + " ", + cmd_copy, 5, 5), SHELL_CMD_ARG(erase, &dsub_device_name, "[] []", cmd_erase, 2, 2), From 86b666548b97f0fa5f4ec05e9b6f92a2bfe5a4ed Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Tue, 8 Oct 2024 11:09:32 +0200 Subject: [PATCH 0414/4482] modules: mbedtls: Enable back Mbed TLS PSA Crypto Storage C This partially reverts https://github.com/zephyrproject-rtos/zephyr/commit/4b479016a792a24704352566bdbf726493dd08ae to fix Bluetooth mesh tests with bsim. Fixes #79533 Signed-off-by: Pavel Vasilyev --- modules/mbedtls/configs/config-tls-generic.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/mbedtls/configs/config-tls-generic.h b/modules/mbedtls/configs/config-tls-generic.h index c4422772aea3d..aff59f9e17e76 100644 --- a/modules/mbedtls/configs/config-tls-generic.h +++ b/modules/mbedtls/configs/config-tls-generic.h @@ -482,11 +482,13 @@ #define MBEDTLS_PSA_P256M_DRIVER_ENABLED #endif -#if defined(CONFIG_ARCH_POSIX) +#if defined(CONFIG_ARCH_POSIX) && !defined(CONFIG_PICOLIBC) #define MBEDTLS_PSA_KEY_SLOT_COUNT 64 /* for BLE Mesh tests */ +#define MBEDTLS_PSA_ITS_FILE_C +#define MBEDTLS_FS_IO #endif -#if defined(CONFIG_SECURE_STORAGE) +#if defined(CONFIG_SECURE_STORAGE) || (defined(CONFIG_ARCH_POSIX) && !defined(CONFIG_PICOLIBC)) #define MBEDTLS_PSA_CRYPTO_STORAGE_C #endif From d7ab4f25e13f975a9c3cbe192369a68a3eb9d704 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Tue, 8 Oct 2024 15:02:43 +0200 Subject: [PATCH 0415/4482] samples: disable CDC ACM logging Disable CDC ACM logging in the configuration overlays used to select the CDC ACM UART as the shell backend. The build warning was introduced by the commit e8c4867806cf ("usb: cdc_acm: disable logging if used for shell with logging") to prevent recursive logging when using the CDC ACM UART as shell or logging backend Signed-off-by: Johann Fischer --- .../capture/boards/arduino_nicla_vision_stm32h747xx_m7.conf | 1 + samples/subsys/shell/shell_module/overlay-usb.conf | 1 + 2 files changed, 2 insertions(+) diff --git a/samples/drivers/video/capture/boards/arduino_nicla_vision_stm32h747xx_m7.conf b/samples/drivers/video/capture/boards/arduino_nicla_vision_stm32h747xx_m7.conf index 6ae5e7da478a6..616279cb9c298 100644 --- a/samples/drivers/video/capture/boards/arduino_nicla_vision_stm32h747xx_m7.conf +++ b/samples/drivers/video/capture/boards/arduino_nicla_vision_stm32h747xx_m7.conf @@ -7,6 +7,7 @@ CONFIG_DMA=y CONFIG_USB_DEVICE_STACK=y CONFIG_USB_WORKQUEUE_STACK_SIZE=8192 CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=y +CONFIG_USB_CDC_ACM_LOG_LEVEL_OFF=y CONFIG_MAIN_STACK_SIZE=4096 CONFIG_SERIAL=y diff --git a/samples/subsys/shell/shell_module/overlay-usb.conf b/samples/subsys/shell/shell_module/overlay-usb.conf index b92529f9cc612..f5e0e86d60bb2 100644 --- a/samples/subsys/shell/shell_module/overlay-usb.conf +++ b/samples/subsys/shell/shell_module/overlay-usb.conf @@ -1,6 +1,7 @@ CONFIG_USB_DEVICE_STACK=y CONFIG_USB_DEVICE_PRODUCT="Zephyr USB shell sample" CONFIG_SHELL_BACKEND_SERIAL_CHECK_DTR=y +CONFIG_USB_CDC_ACM_LOG_LEVEL_OFF=y CONFIG_UART_LINE_CTRL=y CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n From 8cfad44852845cd30336d40f61dade69ab4357db Mon Sep 17 00:00:00 2001 From: Aleksander Wasaznik Date: Tue, 14 May 2024 10:02:15 +0200 Subject: [PATCH 0416/4482] Bluetooth: Deprecate adv auto-resume The host-based adv auto-resume function has both a problematic implementation and disagreement in the community around how it should behave. See the issue linked resolved below for details. This patch makes the deprecation visible to the user. The user will be better served by a auto-resume tailored their applications use case, based on more primitive host API like `conn_cb.recycled`, which has obvious behavior that is unlikely to change. Resolves: https://github.com/zephyrproject-rtos/zephyr/issues/72567 Signed-off-by: Aleksander Wasaznik --- doc/releases/migration-guide-4.0.rst | 72 +++++++++ include/zephyr/bluetooth/bluetooth.h | 138 +++++++++++++++--- samples/bluetooth/direct_adv/src/main.c | 2 +- .../direction_finding_peripheral/src/main.c | 2 +- samples/bluetooth/eddystone/src/main.c | 4 +- .../peripheral/src/peripheral_ead.c | 13 +- samples/bluetooth/hci_pwr_ctrl/src/main.c | 2 +- .../iso_connected_benchmark/src/main.c | 5 +- samples/bluetooth/iso_peripheral/src/main.c | 2 +- .../peripheral/src/peripheral_mtu_update.c | 2 +- .../bluetooth/periodic_sync_rsp/src/main.c | 5 +- samples/bluetooth/peripheral/src/main.c | 2 +- .../peripheral_accept_list/src/main.c | 2 +- samples/bluetooth/peripheral_csc/src/main.c | 2 +- samples/bluetooth/peripheral_dis/src/main.c | 2 +- samples/bluetooth/peripheral_esp/src/main.c | 2 +- .../src/peripheral_gatt_write.c | 2 +- samples/bluetooth/peripheral_hids/src/main.c | 2 +- samples/bluetooth/peripheral_hr/src/main.c | 8 +- samples/bluetooth/peripheral_ht/src/main.c | 2 +- .../src/peripheral_identity.c | 3 +- samples/bluetooth/peripheral_nus/src/main.c | 2 +- samples/bluetooth/peripheral_ots/src/main.c | 2 +- samples/bluetooth/peripheral_past/src/main.c | 2 +- .../bluetooth/peripheral_sc_only/src/main.c | 2 +- samples/bluetooth/st_ble_sensor/src/main.c | 2 +- samples/boards/bbc/microbit/pong/src/ble.c | 2 +- .../phytec/reel_board/mesh_badge/src/main.c | 2 +- samples/subsys/logging/ble_backend/src/main.c | 2 +- .../mgmt/mcumgr/smp_svr/src/bluetooth.c | 2 +- subsys/bluetooth/host/adv.c | 32 ++-- subsys/bluetooth/host/id.c | 4 +- subsys/bluetooth/host/shell/bt.c | 14 +- subsys/bluetooth/mesh/pb_gatt_srv.c | 3 +- subsys/bluetooth/mesh/proxy_srv.c | 3 +- .../services/nus/bt_nus_auto_start_bt.c | 2 +- tests/bluetooth/common/testlib/src/adv.c | 2 +- .../id/bt_id_adv_random_addr_check/src/main.c | 2 +- .../host/id/bt_id_set_adv_own_addr/src/main.c | 22 +-- .../src/test_suite_invalid_inputs.c | 22 +-- tests/bluetooth/shell/src/main.c | 2 +- tests/bluetooth/tester/src/btp_gap.c | 14 +- .../audio/src/bap_scan_delegator_test.c | 2 +- .../audio/src/bap_unicast_server_test.c | 4 +- .../bluetooth/audio/src/cap_acceptor_test.c | 4 +- .../audio/src/csip_notify_server_test.c | 4 +- .../audio/src/csip_set_member_test.c | 2 +- .../bsim/bluetooth/audio/src/gmap_ugt_test.c | 4 +- tests/bsim/bluetooth/audio/src/has_test.c | 2 +- tests/bsim/bluetooth/audio/src/ias_test.c | 2 +- tests/bsim/bluetooth/audio/src/mcs_test.c | 2 +- .../audio/src/media_controller_test.c | 2 +- .../bluetooth/audio/src/micp_mic_dev_test.c | 2 +- .../audio/src/pacs_notify_server_test.c | 8 +- .../bluetooth/audio/src/tbs_client_test.c | 2 +- .../bluetooth/audio/src/vcp_vol_rend_test.c | 2 +- .../css_sample_data/src/peripheral.c | 2 +- .../bsim/bluetooth/host/att/eatt/src/common.c | 2 +- .../host/att/eatt_notif/src/server_test.c | 2 +- .../host/att/pipeline/dut/src/main.c | 7 +- .../host/central/src/dummy_peripheral.c | 2 +- .../gatt/authorization/src/gatt_server_test.c | 2 +- .../host/gatt/caching/src/gatt_server_test.c | 2 +- .../host/gatt/ccc_store/src/peripheral.c | 12 +- .../host/gatt/general/src/gatt_server_test.c | 2 +- .../host/gatt/notify/src/gatt_server_test.c | 2 +- .../notify_multiple/src/gatt_server_test.c | 2 +- .../host/gatt/sc_indicate/src/bs_bt_utils.c | 2 +- .../bluetooth/host/gatt/settings/src/utils.c | 3 +- .../host/iso/cis/src/cis_peripheral.c | 2 +- .../bluetooth/host/l2cap/credits/src/main.c | 7 +- .../host/l2cap/credits_seg_recv/src/main.c | 6 +- .../host/l2cap/general/src/main_l2cap_ecred.c | 2 +- .../host/l2cap/many_conns/src/main.c | 7 +- .../host/l2cap/multilink_peripheral/src/dut.c | 2 +- .../src/main_l2cap_send_on_connect.c | 2 +- .../bluetooth/host/l2cap/stress/src/main.c | 7 +- .../l2cap/userdata/src/main_l2cap_userdata.c | 2 +- .../misc/conn_stress/peripheral/src/main.c | 2 +- .../host/misc/disable/src/gatt_server_test.c | 2 +- tests/bsim/bluetooth/host/misc/hfc/src/main.c | 6 +- .../host/misc/unregister_conn_cb/src/main.c | 2 +- .../host/privacy/central/src/tester.c | 5 +- .../device/src/test_undirected_peripheral.c | 6 +- .../bluetooth/host/privacy/legacy/src/dut.c | 10 +- .../bond_overwrite_allowed/src/bs_bt_utils.c | 3 +- .../bond_overwrite_denied/src/bs_bt_utils.c | 3 +- .../bond_per_connection/src/bs_bt_utils.c | 3 +- .../host/security/ccc_update/src/peripheral.c | 2 +- .../id_addr_update/peripheral/src/utils.c | 3 +- .../src/bs_bt_utils.c | 3 +- tests/bsim/bluetooth/ll/advx/src/main.c | 6 +- tests/bsim/bluetooth/ll/cis/src/main.c | 16 +- .../bluetooth/ll/conn/src/test_connect2.c | 26 +++- .../ll/edtt/gatt_test_app/src/main.c | 32 +++- .../battery_service/src/peripheral_test.c | 2 +- 96 files changed, 394 insertions(+), 273 deletions(-) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 211a725ff2e15..5a2d2566a8dc5 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -336,6 +336,78 @@ Bluetooth Classic Bluetooth Host ============== +Automatic advertiser resumption is deprecated +--------------------------------------------- + +.. note:: + + This deprecation is compiler-checked. If you get no warnings, + you should not be affected. + +Deprecated symbols: + * :c:enumerator:`BT_LE_ADV_OPT_CONNECTABLE` + * :c:enumerator:`BT_LE_ADV_OPT_ONE_TIME` + * :c:macro:`BT_LE_ADV_CONN` + +New symbols: + * :c:enumerator:`BT_LE_ADV_OPT_CONN` + * :c:macro:`BT_LE_ADV_CONN_FAST_1` + * :c:macro:`BT_LE_ADV_CONN_FAST_2` + +:c:enumerator:`BT_LE_ADV_OPT_CONNECTABLE` is a combined +instruction to make the advertiser connectable and to enable +automatic resumption. To disable the automatic resumption, use +:c:enumerator:`BT_LE_ADV_OPT_CONN`. + +Extended Advertising API with shorthands +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Extended Advertising API ``bt_le_ext_adv_*`` implicitly assumes +:c:enumerator:`BT_LE_ADV_OPT_ONE_TIME` and never automatically +resume advertising. Therefore, the following search/replace can +be applied without thinking: + +Replace all + +.. code-block:: diff + + -bt_le_ext_adv_create(BT_LE_ADV_CONN, ...) + +bt_le_ext_adv_create(BT_LE_ADV_FAST_2, ...) + +.. code-block:: diff + + -bt_le_ext_adv_update_param(..., BT_LE_ADV_CONN) + +bt_le_ext_adv_update_param(..., BT_LE_ADV_FAST_2) + +Extended Advertising API with custom parameters +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +You may have uses of :c:enumerator:`BT_LE_ADV_OPT_CONNECTABLE` +in assignments to a :c:struct:`bt_le_adv_param`. If your struct +is never passed to :c:func:`bt_le_adv_start`, you should: + +* replace :c:enumerator:`BT_LE_ADV_OPT_CONNECTABLE` with + :c:enumerator:`BT_LE_ADV_OPT_CONN`. +* remove :c:enumerator:`BT_LE_ADV_OPT_ONE_TIME`. + +Legacy Advertising API not using automatic resumption +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Any calls to :c:func:`bt_le_adv_start` that use the combination +:c:enumerator:`BT_LE_ADV_OPT_CONNECTABLE` and +:c:enumerator:`BT_LE_ADV_OPT_ONE_TIME` should have that +combination replaced with :c:enumerator:`BT_LE_ADV_OPT_CONN`. + +Legacy Advertising API using automatic resumption +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +For this case, the application has to take over the +responsibility of restarting the advertiser. + +Refer to the extended advertising sample for an example +implementation of advertiser restarting. The same technique can +be used for legacy advertising. + Bluetooth Crypto ================ diff --git a/include/zephyr/bluetooth/bluetooth.h b/include/zephyr/bluetooth/bluetooth.h index 4b388bfd14692..8d2ceebf6cb6d 100644 --- a/include/zephyr/bluetooth/bluetooth.h +++ b/include/zephyr/bluetooth/bluetooth.h @@ -525,16 +525,42 @@ enum { /** * @brief Advertise as connectable. * + * @deprecated Use @ref BT_LE_ADV_OPT_CONN instead. + * * Advertise as connectable. If not connectable then the type of * advertising is determined by providing scan response data. * The advertiser address is determined by the type of advertising * and/or enabling privacy @kconfig{CONFIG_BT_PRIVACY}. + * + * Starting connectable advertising preallocates a connection + * object. If this fails, the API returns @c -ENOMEM. + * + * When an advertiser set results in a connection creation, the + * controller automatically disables that advertising set. + * + * If the advertising set was started with @ref bt_le_adv_start + * without @ref BT_LE_ADV_OPT_ONE_TIME, the host will attempt to + * resume the advertiser under some conditions. + */ + BT_LE_ADV_OPT_CONNECTABLE __deprecated = BIT(0), + + /** + * @internal + * + * Internal access to the deprecated value to maintain the + * implementation of the deprecated feature. + * + * At the end of the deprecation period, ABI will change so + * `BT_LE_ADV_OPT_CONN` is just `BIT(0)`, removing the need for this + * symbol. */ - BT_LE_ADV_OPT_CONNECTABLE = BIT(0), + _BT_LE_ADV_OPT_CONNECTABLE = BIT(0), /** * @brief Advertise one time. * + * @deprecated Use @ref BT_LE_ADV_OPT_CONN instead. + * * Don't try to resume connectable advertising after a connection. * This option is only meaningful when used together with * BT_LE_ADV_OPT_CONNECTABLE. If set the advertising will be stopped @@ -546,7 +572,35 @@ enum { * @ref bt_le_ext_adv_start then this behavior is the default behavior * and this flag has no effect. */ - BT_LE_ADV_OPT_ONE_TIME = BIT(1), + BT_LE_ADV_OPT_ONE_TIME __deprecated = BIT(1), + + /** + * @internal + * + * Internal access to the deprecated value to maintain + * the implementation of the deprecated feature. + */ + _BT_LE_ADV_OPT_ONE_TIME = BIT(1), + + /** + * @brief Connectable advertising + * + * Starting connectable advertising preallocates a connection + * object. If this fails, the API returns @c -ENOMEM. + * + * The advertising set stops immediately after it creates a + * connection. This happens automatically in the controller. + * + * @note To continue advertising after a connection is created, + * the application should listen for the @ref bt_conn_cb.connected + * event and start the advertising set again. Note that the + * advertiser cannot be started when all connection objects are + * in use. In that case, defer starting the advertiser until + * @ref bt_conn_cb.recycled. To continue after a disconnection, + * listen for @ref bt_conn_cb.recycled. + + */ + BT_LE_ADV_OPT_CONN = BIT(0) | BIT(1), /** * @brief Advertise using identity address. @@ -625,8 +679,7 @@ enum { * @brief Support scan response data. * * When used together with @ref BT_LE_ADV_OPT_EXT_ADV then this option - * cannot be used together with the @ref BT_LE_ADV_OPT_CONNECTABLE - * option. + * cannot be used together with the @ref BT_LE_ADV_OPT_CONN option. * When used together with @ref BT_LE_ADV_OPT_EXT_ADV then scan * response data must be set. */ @@ -914,20 +967,61 @@ struct bt_le_per_adv_param { BT_LE_ADV_PARAM_INIT(_options, _int_min, _int_max, _peer) \ }) -#define BT_LE_ADV_CONN_DIR(_peer) BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \ - BT_LE_ADV_OPT_ONE_TIME, 0, 0,\ - _peer) +#define BT_LE_ADV_CONN_DIR(_peer) BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, 0, 0, _peer) +/** + * @deprecated This is a convenience macro for @ref + * BT_LE_ADV_OPT_CONNECTABLE, which is deprecated. Please use + * @ref BT_LE_ADV_CONN_FAST_1 or @ref BT_LE_ADV_CONN_FAST_2 + * instead. + */ +#define BT_LE_ADV_CONN \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE, BT_GAP_ADV_FAST_INT_MIN_2, \ + BT_GAP_ADV_FAST_INT_MAX_2, NULL) \ + __DEPRECATED_MACRO -#define BT_LE_ADV_CONN BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE, \ - BT_GAP_ADV_FAST_INT_MIN_2, \ - BT_GAP_ADV_FAST_INT_MAX_2, NULL) +/** @brief GAP recommended connectable advertising + * + * This is the recommended default for when a person is likely + * to be waiting the device to connect or be discovered. + * + * Use a longer interval to conserve battery at the cost of + * responsiveness. Consider entering a lower power state with + * longer intervals after a timeout. + * + * GAP recommends advertisers use this "when user-initiated". + * The application developer decides what this means. It can by + * any time the user interacts with the device, a press on a + * dedicated Bluetooth wakeup button, or anything in-between. + * + * This is the recommended setting for limited discoverable + * mode. + * + * See Bluetooth Core Specification: + * - 3.C.A "Timers and Constants", T_GAP(adv_fast_interval1) + * - 3.C.9.3.11 "Connection Establishment Timing parameters" + */ +#define BT_LE_ADV_CONN_FAST_1 \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, BT_GAP_ADV_FAST_INT_MIN_1, BT_GAP_ADV_FAST_INT_MAX_1, \ + NULL) -/** This is the recommended default for connectable advertisers. +/** @brief Connectable advertising with + * T_GAP(adv_fast_interval2) + * + * The advertising interval corresponds to what was offered as + * `BT_LE_ADV_CONN` in Zephyr 3.6 and earlier, but unlike + * `BT_LE_ADV_CONN`, the host does not automatically resume the + * advertiser after it results in a connection. + * + * See Bluetooth Core Specification: + * - 3.C.A "Timers and Constants", T_GAP(adv_fast_interval1) + * - 3.C.9.3.11 "Connection Establishment Timing parameters" */ -#define BT_LE_ADV_CONN_ONE_TIME \ - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME, \ - BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL) +#define BT_LE_ADV_CONN_FAST_2 \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, \ + NULL) + +#define BT_LE_ADV_CONN_ONE_TIME BT_LE_ADV_CONN_FAST_2 __DEPRECATED_MACRO /** * @deprecated This macro will be removed in the near future, see @@ -950,11 +1044,9 @@ struct bt_le_per_adv_param { BT_GAP_ADV_FAST_INT_MAX_2, NULL) \ __DEPRECATED_MACRO -#define BT_LE_ADV_CONN_DIR_LOW_DUTY(_peer) \ - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME | \ - BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY, \ - BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, \ - _peer) +#define BT_LE_ADV_CONN_DIR_LOW_DUTY(_peer) \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY, \ + BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, _peer) /** Non-connectable advertising with private address */ #define BT_LE_ADV_NCONN BT_LE_ADV_PARAM(0, BT_GAP_ADV_FAST_INT_MIN_2, \ @@ -978,11 +1070,9 @@ struct bt_le_per_adv_param { NULL) /** Connectable extended advertising */ -#define BT_LE_EXT_ADV_CONN BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | \ - BT_LE_ADV_OPT_CONNECTABLE, \ - BT_GAP_ADV_FAST_INT_MIN_2, \ - BT_GAP_ADV_FAST_INT_MAX_2, \ - NULL) +#define BT_LE_EXT_ADV_CONN \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONN, BT_GAP_ADV_FAST_INT_MIN_2, \ + BT_GAP_ADV_FAST_INT_MAX_2, NULL) /** * @deprecated This macro will be removed in the near future, see diff --git a/samples/bluetooth/direct_adv/src/main.c b/samples/bluetooth/direct_adv/src/main.c index a381cf0c1e29c..992c6e46059c7 100644 --- a/samples/bluetooth/direct_adv/src/main.c +++ b/samples/bluetooth/direct_adv/src/main.c @@ -128,7 +128,7 @@ static void bt_ready(void) adv_param.options |= BT_LE_ADV_OPT_DIR_ADDR_RPA; err = bt_le_adv_start(&adv_param, NULL, 0, NULL, 0); } else { - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); } if (err) { diff --git a/samples/bluetooth/direction_finding_peripheral/src/main.c b/samples/bluetooth/direction_finding_peripheral/src/main.c index da4cd72888a69..c016145ce4c0f 100644 --- a/samples/bluetooth/direction_finding_peripheral/src/main.c +++ b/samples/bluetooth/direction_finding_peripheral/src/main.c @@ -100,7 +100,7 @@ static void bt_ready(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { printk("Advertising failed to start (err %d)\n", err); return; diff --git a/samples/bluetooth/eddystone/src/main.c b/samples/bluetooth/eddystone/src/main.c index 8bc3213f88029..c574c57cae13f 100644 --- a/samples/bluetooth/eddystone/src/main.c +++ b/samples/bluetooth/eddystone/src/main.c @@ -431,7 +431,7 @@ static int eds_slot_restart(struct eds_slot *slot, uint8_t type) addr = oob.addr; } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); } else { size_t count = 1; @@ -634,7 +634,7 @@ static void bt_ready(int err) printk("Bluetooth initialized\n"); /* Start advertising */ - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return; diff --git a/samples/bluetooth/encrypted_advertising/peripheral/src/peripheral_ead.c b/samples/bluetooth/encrypted_advertising/peripheral/src/peripheral_ead.c index d2476d2ce822d..7bafd8a5b7b18 100644 --- a/samples/bluetooth/encrypted_advertising/peripheral/src/peripheral_ead.c +++ b/samples/bluetooth/encrypted_advertising/peripheral/src/peripheral_ead.c @@ -128,21 +128,10 @@ static bool rpa_expired_cb(struct bt_le_ext_adv *adv) static int create_adv(struct bt_le_ext_adv **adv) { int err; - struct bt_le_adv_param params; - - memset(¶ms, 0, sizeof(struct bt_le_adv_param)); - - params.options |= BT_LE_ADV_OPT_CONNECTABLE; - params.options |= BT_LE_ADV_OPT_EXT_ADV; - - params.id = BT_ID_DEFAULT; - params.sid = 0; - params.interval_min = BT_GAP_ADV_FAST_INT_MIN_2; - params.interval_max = BT_GAP_ADV_FAST_INT_MAX_2; adv_cb.rpa_expired = rpa_expired_cb; - err = bt_le_ext_adv_create(¶ms, &adv_cb, adv); + err = bt_le_ext_adv_create(BT_LE_EXT_ADV_CONN, &adv_cb, adv); if (err) { LOG_ERR("Failed to create advertiser (%d)", err); return -1; diff --git a/samples/bluetooth/hci_pwr_ctrl/src/main.c b/samples/bluetooth/hci_pwr_ctrl/src/main.c index 42ef4d214ca63..3b08d45b8a009 100644 --- a/samples/bluetooth/hci_pwr_ctrl/src/main.c +++ b/samples/bluetooth/hci_pwr_ctrl/src/main.c @@ -43,7 +43,7 @@ static K_THREAD_STACK_DEFINE(pwr_thread_stack, 512); static const int8_t txpower[DEVICE_BEACON_TXPOWER_NUM] = {4, 0, -3, -8, -15, -18, -23, -30}; static const struct bt_le_adv_param *param = - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME, 0x0020, 0x0020, NULL); + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, 0x0020, 0x0020, NULL); static void read_conn_rssi(uint16_t handle, int8_t *rssi) { diff --git a/samples/bluetooth/iso_connected_benchmark/src/main.c b/samples/bluetooth/iso_connected_benchmark/src/main.c index eec884393aaec..e4c1f7935f2ef 100644 --- a/samples/bluetooth/iso_connected_benchmark/src/main.c +++ b/samples/bluetooth/iso_connected_benchmark/src/main.c @@ -1279,10 +1279,7 @@ static int run_peripheral(void) } LOG_INF("Starting advertising"); - err = bt_le_adv_start( - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_ONE_TIME | BT_LE_ADV_OPT_CONNECTABLE, - BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL), - NULL, 0, sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, NULL, 0, sd, ARRAY_SIZE(sd)); if (err != 0) { LOG_ERR("Advertising failed to start: %d", err); return err; diff --git a/samples/bluetooth/iso_peripheral/src/main.c b/samples/bluetooth/iso_peripheral/src/main.c index 3ce6f688e849c..d11baa9633fa2 100644 --- a/samples/bluetooth/iso_peripheral/src/main.c +++ b/samples/bluetooth/iso_peripheral/src/main.c @@ -177,7 +177,7 @@ int main(void) return 0; } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return 0; diff --git a/samples/bluetooth/mtu_update/peripheral/src/peripheral_mtu_update.c b/samples/bluetooth/mtu_update/peripheral/src/peripheral_mtu_update.c index 1cb99801c9434..a5bbef6f5eee6 100644 --- a/samples/bluetooth/mtu_update/peripheral/src/peripheral_mtu_update.c +++ b/samples/bluetooth/mtu_update/peripheral/src/peripheral_mtu_update.c @@ -91,7 +91,7 @@ void run_peripheral_sample(uint8_t *notify_data, size_t notify_data_size, uint16 struct bt_gatt_attr *notify_crch = bt_gatt_find_by_uuid(mtu_test.attrs, 0xffff, ¬ify_characteristic_uuid.uuid); - bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, adv_ad_data, ARRAY_SIZE(adv_ad_data), NULL, 0); + bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, adv_ad_data, ARRAY_SIZE(adv_ad_data), NULL, 0); bool infinite = seconds == 0; diff --git a/samples/bluetooth/periodic_sync_rsp/src/main.c b/samples/bluetooth/periodic_sync_rsp/src/main.c index 013e7a28e5086..5e37e7012d685 100644 --- a/samples/bluetooth/periodic_sync_rsp/src/main.c +++ b/samples/bluetooth/periodic_sync_rsp/src/main.c @@ -231,10 +231,7 @@ int main(void) } do { - err = bt_le_adv_start( - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_ONE_TIME | BT_LE_ADV_OPT_CONNECTABLE, - BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL), - ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err && err != -EALREADY) { printk("Advertising failed to start (err %d)\n", err); diff --git a/samples/bluetooth/peripheral/src/main.c b/samples/bluetooth/peripheral/src/main.c index 9c9001213e6fa..db77691db613a 100644 --- a/samples/bluetooth/peripheral/src/main.c +++ b/samples/bluetooth/peripheral/src/main.c @@ -290,7 +290,7 @@ static void bt_ready(void) settings_load(); } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return; diff --git a/samples/bluetooth/peripheral_accept_list/src/main.c b/samples/bluetooth/peripheral_accept_list/src/main.c index ee32add74cfdc..e14ea8dd99775 100644 --- a/samples/bluetooth/peripheral_accept_list/src/main.c +++ b/samples/bluetooth/peripheral_accept_list/src/main.c @@ -121,7 +121,7 @@ static void bt_ready(void) bond_count = 0; bt_foreach_bond(BT_ID_DEFAULT, add_bonded_addr_to_filter_list, NULL); - adv_param = *BT_LE_ADV_CONN_ONE_TIME; + adv_param = *BT_LE_ADV_CONN_FAST_1; /* If we have got at least one bond, activate the filter */ if (bond_count) { diff --git a/samples/bluetooth/peripheral_csc/src/main.c b/samples/bluetooth/peripheral_csc/src/main.c index aeb7a71ecddb3..5090641433da9 100644 --- a/samples/bluetooth/peripheral_csc/src/main.c +++ b/samples/bluetooth/peripheral_csc/src/main.c @@ -379,7 +379,7 @@ static void bt_ready(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return; diff --git a/samples/bluetooth/peripheral_dis/src/main.c b/samples/bluetooth/peripheral_dis/src/main.c index 324602de30d23..b611ef6e17096 100644 --- a/samples/bluetooth/peripheral_dis/src/main.c +++ b/samples/bluetooth/peripheral_dis/src/main.c @@ -100,7 +100,7 @@ int main(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return 0; diff --git a/samples/bluetooth/peripheral_esp/src/main.c b/samples/bluetooth/peripheral_esp/src/main.c index b71ff7ed15405..0ac62a42627ef 100644 --- a/samples/bluetooth/peripheral_esp/src/main.c +++ b/samples/bluetooth/peripheral_esp/src/main.c @@ -421,7 +421,7 @@ static void bt_ready(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return; diff --git a/samples/bluetooth/peripheral_gatt_write/src/peripheral_gatt_write.c b/samples/bluetooth/peripheral_gatt_write/src/peripheral_gatt_write.c index 0e0d082004b47..94b25e0d519ad 100644 --- a/samples/bluetooth/peripheral_gatt_write/src/peripheral_gatt_write.c +++ b/samples/bluetooth/peripheral_gatt_write/src/peripheral_gatt_write.c @@ -67,7 +67,7 @@ uint32_t peripheral_gatt_write(uint32_t count) (void)bt_conn_auth_cb_register(&auth_callbacks); #endif /* CONFIG_BT_SMP */ - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return 0U; diff --git a/samples/bluetooth/peripheral_hids/src/main.c b/samples/bluetooth/peripheral_hids/src/main.c index 25e82c346e825..9feb360780260 100644 --- a/samples/bluetooth/peripheral_hids/src/main.c +++ b/samples/bluetooth/peripheral_hids/src/main.c @@ -100,7 +100,7 @@ static void bt_ready(int err) settings_load(); } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return; diff --git a/samples/bluetooth/peripheral_hr/src/main.c b/samples/bluetooth/peripheral_hr/src/main.c index 19c640ca91b53..bb534970a4b59 100644 --- a/samples/bluetooth/peripheral_hr/src/main.c +++ b/samples/bluetooth/peripheral_hr/src/main.c @@ -204,7 +204,7 @@ int main(void) #if !defined(CONFIG_BT_EXT_ADV) printk("Starting Legacy Advertising (connectable and scannable)\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return 0; @@ -215,9 +215,7 @@ int main(void) .id = BT_ID_DEFAULT, .sid = 0U, .secondary_max_skip = 0U, - .options = (BT_LE_ADV_OPT_EXT_ADV | - BT_LE_ADV_OPT_CONNECTABLE | - BT_LE_ADV_OPT_CODED), + .options = (BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_CODED), .interval_min = BT_GAP_ADV_FAST_INT_MIN_2, .interval_max = BT_GAP_ADV_FAST_INT_MAX_2, .peer = NULL, @@ -283,7 +281,7 @@ int main(void) } else if (atomic_test_and_clear_bit(state, STATE_DISCONNECTED)) { #if !defined(CONFIG_BT_EXT_ADV) printk("Starting Legacy Advertising (connectable and scannable)\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); diff --git a/samples/bluetooth/peripheral_ht/src/main.c b/samples/bluetooth/peripheral_ht/src/main.c index b3bffc30e4fb9..c6b0540632a7f 100644 --- a/samples/bluetooth/peripheral_ht/src/main.c +++ b/samples/bluetooth/peripheral_ht/src/main.c @@ -62,7 +62,7 @@ static void bt_ready(void) hts_init(); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return; diff --git a/samples/bluetooth/peripheral_identity/src/peripheral_identity.c b/samples/bluetooth/peripheral_identity/src/peripheral_identity.c index 52d71e642a38a..a4722907d501e 100644 --- a/samples/bluetooth/peripheral_identity/src/peripheral_identity.c +++ b/samples/bluetooth/peripheral_identity/src/peripheral_identity.c @@ -33,8 +33,7 @@ static void adv_start(struct k_work *work) .id = BT_ID_DEFAULT, .sid = 0, .secondary_max_skip = 0, - .options = (BT_LE_ADV_OPT_CONNECTABLE | - BT_LE_ADV_OPT_ONE_TIME), + .options = BT_LE_ADV_OPT_CONN, .interval_min = 0x0020, /* 20 ms */ .interval_max = 0x0020, /* 20 ms */ .peer = NULL, diff --git a/samples/bluetooth/peripheral_nus/src/main.c b/samples/bluetooth/peripheral_nus/src/main.c index 767b2286fb237..dd4d57cf31db2 100644 --- a/samples/bluetooth/peripheral_nus/src/main.c +++ b/samples/bluetooth/peripheral_nus/src/main.c @@ -61,7 +61,7 @@ int main(void) return err; } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Failed to start advertising: %d\n", err); return err; diff --git a/samples/bluetooth/peripheral_ots/src/main.c b/samples/bluetooth/peripheral_ots/src/main.c index f3e70c2e8ce6b..79c8a11b7096f 100644 --- a/samples/bluetooth/peripheral_ots/src/main.c +++ b/samples/bluetooth/peripheral_ots/src/main.c @@ -335,7 +335,7 @@ int main(void) return 0; } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return 0; diff --git a/samples/bluetooth/peripheral_past/src/main.c b/samples/bluetooth/peripheral_past/src/main.c index 9461b28b2f984..1bd6aa35cf7f6 100644 --- a/samples/bluetooth/peripheral_past/src/main.c +++ b/samples/bluetooth/peripheral_past/src/main.c @@ -147,7 +147,7 @@ int main(void) return 0; } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, NULL, 0, sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, NULL, 0, sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return 0; diff --git a/samples/bluetooth/peripheral_sc_only/src/main.c b/samples/bluetooth/peripheral_sc_only/src/main.c index 91cc46a385a50..f4ae4252cdcd0 100644 --- a/samples/bluetooth/peripheral_sc_only/src/main.c +++ b/samples/bluetooth/peripheral_sc_only/src/main.c @@ -145,7 +145,7 @@ int main(void) bt_conn_auth_cb_register(&auth_cb_display); bt_conn_auth_info_cb_register(&auth_cb_info); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return 0; diff --git a/samples/bluetooth/st_ble_sensor/src/main.c b/samples/bluetooth/st_ble_sensor/src/main.c index de287b6116743..b7c1547b04c70 100644 --- a/samples/bluetooth/st_ble_sensor/src/main.c +++ b/samples/bluetooth/st_ble_sensor/src/main.c @@ -142,7 +142,7 @@ static void bt_ready(int err) } LOG_INF("Bluetooth initialized"); /* Start advertising */ - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { LOG_ERR("Advertising failed to start (err %d)", err); return; diff --git a/samples/boards/bbc/microbit/pong/src/ble.c b/samples/boards/bbc/microbit/pong/src/ble.c index 3601c35612675..bdbad05639af3 100644 --- a/samples/boards/bbc/microbit/pong/src/ble.c +++ b/samples/boards/bbc/microbit/pong/src/ble.c @@ -471,7 +471,7 @@ static void ble_timeout(struct k_work *work) k_work_reschedule(&ble_work, K_NO_WAIT); break; case BLE_ADV_START: - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); diff --git a/samples/boards/phytec/reel_board/mesh_badge/src/main.c b/samples/boards/phytec/reel_board/mesh_badge/src/main.c index 33189b8bb626d..c025c15b9a4bd 100644 --- a/samples/boards/phytec/reel_board/mesh_badge/src/main.c +++ b/samples/boards/phytec/reel_board/mesh_badge/src/main.c @@ -181,7 +181,7 @@ static void bt_ready(int err) if (!mesh_is_initialized()) { /* Start advertising */ - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); diff --git a/samples/subsys/logging/ble_backend/src/main.c b/samples/subsys/logging/ble_backend/src/main.c index c8edb8d8838db..249e582a0e833 100644 --- a/samples/subsys/logging/ble_backend/src/main.c +++ b/samples/subsys/logging/ble_backend/src/main.c @@ -26,7 +26,7 @@ static void start_adv(void) { int err; - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { LOG_ERR("Advertising failed to start (err %d)", err); return; diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/src/bluetooth.c b/samples/subsys/mgmt/mcumgr/smp_svr/src/bluetooth.c index 04cff562eef8f..7c5723bf999f2 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/src/bluetooth.c +++ b/samples/subsys/mgmt/mcumgr/smp_svr/src/bluetooth.c @@ -30,7 +30,7 @@ static void advertise(struct k_work *work) { int rc; - rc = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + rc = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (rc) { LOG_ERR("Advertising failed to start (rc %d)", rc); return; diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index 2191effefbae1..39b0a6beedb0f 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -392,7 +392,7 @@ static bool valid_adv_ext_param(const struct bt_le_adv_param *param) BT_DEV_FEAT_LE_EXT_ADV(bt_dev.le.features)) { if (param->peer && !(param->options & BT_LE_ADV_OPT_EXT_ADV) && - !(param->options & BT_LE_ADV_OPT_CONNECTABLE)) { + !(param->options & _BT_LE_ADV_OPT_CONNECTABLE)) { /* Cannot do directed non-connectable advertising * without extended advertising. */ @@ -441,7 +441,7 @@ static bool valid_adv_ext_param(const struct bt_le_adv_param *param) return false; } - if (!(param->options & BT_LE_ADV_OPT_CONNECTABLE)) { + if (!(param->options & _BT_LE_ADV_OPT_CONNECTABLE)) { /* * BT Core 4.2 [Vol 2, Part E, 7.8.5] * The Advertising_Interval_Min and Advertising_Interval_Max @@ -484,7 +484,7 @@ static bool valid_adv_param(const struct bt_le_adv_param *param) return false; } - if (param->peer && !(param->options & BT_LE_ADV_OPT_CONNECTABLE)) { + if (param->peer && !(param->options & _BT_LE_ADV_OPT_CONNECTABLE)) { return false; } @@ -1020,7 +1020,7 @@ int bt_le_adv_start_legacy(struct bt_le_ext_adv *adv, name_type = get_adv_name_type_param(param); - if (param->options & BT_LE_ADV_OPT_CONNECTABLE) { + if (param->options & _BT_LE_ADV_OPT_CONNECTABLE) { if (dir_adv) { if (param->options & BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY) { set_param.type = BT_HCI_ADV_DIRECT_IND_LOW_DUTY; @@ -1062,11 +1062,11 @@ int bt_le_adv_start_legacy(struct bt_le_ext_adv *adv, } if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && - (param->options & BT_LE_ADV_OPT_CONNECTABLE)) { + (param->options & _BT_LE_ADV_OPT_CONNECTABLE)) { err = le_adv_start_add_conn(adv, &conn); if (err) { if (err == -ENOMEM && !dir_adv && - !(param->options & BT_LE_ADV_OPT_ONE_TIME)) { + !(param->options & _BT_LE_ADV_OPT_ONE_TIME)) { goto set_adv_state; } @@ -1096,7 +1096,7 @@ int bt_le_adv_start_legacy(struct bt_le_ext_adv *adv, set_adv_state: atomic_set_bit_to(adv->flags, BT_ADV_PERSIST, !dir_adv && - !(param->options & BT_LE_ADV_OPT_ONE_TIME)); + !(param->options & _BT_LE_ADV_OPT_ONE_TIME)); atomic_set_bit_to(adv->flags, BT_ADV_INCLUDE_NAME_AD, name_type == ADV_NAME_TYPE_AD); @@ -1105,7 +1105,7 @@ int bt_le_adv_start_legacy(struct bt_le_ext_adv *adv, name_type == ADV_NAME_TYPE_SD); atomic_set_bit_to(adv->flags, BT_ADV_CONNECTABLE, - param->options & BT_LE_ADV_OPT_CONNECTABLE); + param->options & _BT_LE_ADV_OPT_CONNECTABLE); atomic_set_bit_to(adv->flags, BT_ADV_SCANNABLE, scannable); @@ -1187,7 +1187,7 @@ static int le_ext_adv_param_set(struct bt_le_ext_adv *adv, cp->scan_req_notify_enable = BT_HCI_LE_ADV_SCAN_REQ_ENABLE; } - if (param->options & BT_LE_ADV_OPT_CONNECTABLE) { + if (param->options & _BT_LE_ADV_OPT_CONNECTABLE) { props |= BT_HCI_LE_ADV_PROP_CONN; if (!dir_adv && !(param->options & BT_LE_ADV_OPT_EXT_ADV)) { /* When using non-extended adv packets then undirected @@ -1252,7 +1252,7 @@ static int le_ext_adv_param_set(struct bt_le_ext_adv *adv, name_type == ADV_NAME_TYPE_SD); atomic_set_bit_to(adv->flags, BT_ADV_CONNECTABLE, - param->options & BT_LE_ADV_OPT_CONNECTABLE); + param->options & _BT_LE_ADV_OPT_CONNECTABLE); atomic_set_bit_to(adv->flags, BT_ADV_SCANNABLE, scannable); @@ -1312,11 +1312,11 @@ int bt_le_adv_start_ext(struct bt_le_ext_adv *adv, } if (IS_ENABLED(CONFIG_BT_PERIPHERAL) && - (param->options & BT_LE_ADV_OPT_CONNECTABLE)) { + (param->options & _BT_LE_ADV_OPT_CONNECTABLE)) { err = le_adv_start_add_conn(adv, &conn); if (err) { if (err == -ENOMEM && !dir_adv && - !(param->options & BT_LE_ADV_OPT_ONE_TIME)) { + !(param->options & _BT_LE_ADV_OPT_ONE_TIME)) { goto set_adv_state; } @@ -1347,7 +1347,7 @@ int bt_le_adv_start_ext(struct bt_le_ext_adv *adv, set_adv_state: /* Flag always set to false by le_ext_adv_param_set */ atomic_set_bit_to(adv->flags, BT_ADV_PERSIST, !dir_adv && - !(param->options & BT_LE_ADV_OPT_ONE_TIME)); + !(param->options & _BT_LE_ADV_OPT_ONE_TIME)); return 0; } @@ -1459,11 +1459,11 @@ static uint32_t adv_get_options(const struct bt_le_ext_adv *adv) uint32_t options = 0; if (!atomic_test_bit(adv->flags, BT_ADV_PERSIST)) { - options |= BT_LE_ADV_OPT_ONE_TIME; + options |= _BT_LE_ADV_OPT_ONE_TIME; } if (atomic_test_bit(adv->flags, BT_ADV_CONNECTABLE)) { - options |= BT_LE_ADV_OPT_CONNECTABLE; + options |= _BT_LE_ADV_OPT_CONNECTABLE; } if (atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY)) { @@ -1596,7 +1596,7 @@ int bt_le_ext_adv_update_param(struct bt_le_ext_adv *adv, /* If params for per adv has been set, do not allow setting * connectable, scanable or use legacy adv */ - if (param->options & BT_LE_ADV_OPT_CONNECTABLE || + if (param->options & _BT_LE_ADV_OPT_CONNECTABLE || param->options & BT_LE_ADV_OPT_SCANNABLE || !(param->options & BT_LE_ADV_OPT_EXT_ADV) || param->options & BT_LE_ADV_OPT_ANONYMOUS) { diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index 6261e1fabb7ad..f98636096bc20 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -792,7 +792,7 @@ bool bt_id_adv_random_addr_check(const struct bt_le_adv_param *param) * Explicitly stop it here. */ - if (!(param->options & BT_LE_ADV_OPT_CONNECTABLE) && + if (!(param->options & _BT_LE_ADV_OPT_CONNECTABLE) && (param->options & BT_LE_ADV_OPT_USE_IDENTITY)) { /* Attempt to set non-connectable NRPA */ return false; @@ -1870,7 +1870,7 @@ int bt_id_set_adv_own_addr(struct bt_le_ext_adv *adv, uint32_t options, return 0; } - if (options & BT_LE_ADV_OPT_CONNECTABLE) { + if (options & _BT_LE_ADV_OPT_CONNECTABLE) { if (dir_adv && (options & BT_LE_ADV_OPT_DIR_ADDR_RPA) && !BT_FEAT_LE_PRIVACY(bt_dev.le.features)) { return -ENOTSUP; diff --git a/subsys/bluetooth/host/shell/bt.c b/subsys/bluetooth/host/shell/bt.c index da55537f3395e..e53e8123aa0d6 100644 --- a/subsys/bluetooth/host/shell/bt.c +++ b/subsys/bluetooth/host/shell/bt.c @@ -2003,7 +2003,7 @@ static int cmd_advertise(const struct shell *sh, size_t argc, char *argv[]) param.interval_max = BT_GAP_ADV_FAST_INT_MAX_2; if (!strcmp(argv[1], "on")) { - param.options = BT_LE_ADV_OPT_CONNECTABLE; + param.options = BT_LE_ADV_OPT_CONN; } else if (!strcmp(argv[1], "nconn")) { param.options = 0U; } else { @@ -2033,8 +2033,6 @@ static int cmd_advertise(const struct shell *sh, size_t argc, char *argv[]) } else if (!strcmp(arg, "name-ad")) { name_ad = true; name_sd = false; - } else if (!strcmp(arg, "one-time")) { - param.options |= BT_LE_ADV_OPT_ONE_TIME; } else if (!strcmp(arg, "disable-37")) { param.options |= BT_LE_ADV_OPT_DISABLE_CHAN_37; } else if (!strcmp(arg, "disable-38")) { @@ -2058,7 +2056,7 @@ static int cmd_advertise(const struct shell *sh, size_t argc, char *argv[]) atomic_clear(adv_opt); atomic_set_bit_to(adv_opt, SHELL_ADV_OPT_CONNECTABLE, - (param.options & BT_LE_ADV_OPT_CONNECTABLE) > 0); + (param.options & BT_LE_ADV_OPT_CONN) > 0); atomic_set_bit_to(adv_opt, SHELL_ADV_OPT_DISCOVERABLE, discoverable); atomic_set_bit_to(adv_opt, SHELL_ADV_OPT_APPEARANCE, appearance); @@ -2143,10 +2141,10 @@ static bool adv_param_parse(size_t argc, char *argv[], memset(param, 0, sizeof(struct bt_le_adv_param)); if (!strcmp(argv[1], "conn-scan")) { - param->options |= BT_LE_ADV_OPT_CONNECTABLE; + param->options |= BT_LE_ADV_OPT_CONN; param->options |= BT_LE_ADV_OPT_SCANNABLE; } else if (!strcmp(argv[1], "conn-nscan")) { - param->options |= BT_LE_ADV_OPT_CONNECTABLE; + param->options |= BT_LE_ADV_OPT_CONN; } else if (!strcmp(argv[1], "nconn-scan")) { param->options |= BT_LE_ADV_OPT_SCANNABLE; } else if (!strcmp(argv[1], "nconn-nscan")) { @@ -2245,7 +2243,7 @@ static int cmd_adv_create(const struct shell *sh, size_t argc, char *argv[]) atomic_clear(adv_set_opt[adv_index]); atomic_set_bit_to(adv_set_opt[adv_index], SHELL_ADV_OPT_CONNECTABLE, - (param.options & BT_LE_ADV_OPT_CONNECTABLE) > 0); + (param.options & BT_LE_ADV_OPT_CONN) > 0); atomic_set_bit_to(adv_set_opt[adv_index], SHELL_ADV_OPT_EXT_ADV, (param.options & BT_LE_ADV_OPT_EXT_ADV) > 0); @@ -5006,7 +5004,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(bt_cmds, SHELL_CMD_ARG(advertise, NULL, " [mode: discov, non_discov] " "[filter-accept-list: fal, fal-scan, fal-conn] [identity] [no-name] " - "[one-time] [name-ad] [appearance] " + "[name-ad] [appearance] " "[disable-37] [disable-38] [disable-39]", cmd_advertise, 2, 8), #if defined(CONFIG_BT_PERIPHERAL) diff --git a/subsys/bluetooth/mesh/pb_gatt_srv.c b/subsys/bluetooth/mesh/pb_gatt_srv.c index 85b60cbe0fd99..f59797ecff13a 100644 --- a/subsys/bluetooth/mesh/pb_gatt_srv.c +++ b/subsys/bluetooth/mesh/pb_gatt_srv.c @@ -34,8 +34,7 @@ LOG_MODULE_REGISTER(bt_mesh_pb_gatt_srv); #define ADV_OPT_PROV \ - (BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_SCANNABLE | \ - BT_LE_ADV_OPT_ONE_TIME | ADV_OPT_USE_IDENTITY) + (BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_SCANNABLE | ADV_OPT_USE_IDENTITY) #define FAST_ADV_TIME (60LL * MSEC_PER_SEC) diff --git a/subsys/bluetooth/mesh/proxy_srv.c b/subsys/bluetooth/mesh/proxy_srv.c index c3b33035a3f50..8855f021734e3 100644 --- a/subsys/bluetooth/mesh/proxy_srv.c +++ b/subsys/bluetooth/mesh/proxy_srv.c @@ -48,8 +48,7 @@ LOG_MODULE_REGISTER(bt_mesh_gatt); BT_LE_ADV_OPT_USE_IDENTITY : (private) ? BT_LE_ADV_OPT_USE_NRPA : 0) #define ADV_OPT_PROXY(private) \ - (BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_SCANNABLE | ADV_OPT_ADDR(private) | \ - BT_LE_ADV_OPT_ONE_TIME) + (BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_SCANNABLE | ADV_OPT_ADDR(private)) static void proxy_send_beacons(struct k_work *work); static int proxy_send(struct bt_conn *conn, diff --git a/subsys/bluetooth/services/nus/bt_nus_auto_start_bt.c b/subsys/bluetooth/services/nus/bt_nus_auto_start_bt.c index be7b16998a03a..164a17156e91f 100644 --- a/subsys/bluetooth/services/nus/bt_nus_auto_start_bt.c +++ b/subsys/bluetooth/services/nus/bt_nus_auto_start_bt.c @@ -27,7 +27,7 @@ static int bt_nus_auto_start(void) err = bt_enable(NULL); __ASSERT_NO_MSG(!err); - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); __ASSERT_NO_MSG(!err); return 0; diff --git a/tests/bluetooth/common/testlib/src/adv.c b/tests/bluetooth/common/testlib/src/adv.c index ba2a201199d36..d02d599084640 100644 --- a/tests/bluetooth/common/testlib/src/adv.c +++ b/tests/bluetooth/common/testlib/src/adv.c @@ -50,7 +50,7 @@ int bt_testlib_adv_conn(struct bt_conn **conn, int id, const char *name) param.id = id; param.interval_min = BT_GAP_ADV_FAST_INT_MIN_1; param.interval_max = BT_GAP_ADV_FAST_INT_MAX_1; - param.options |= BT_LE_ADV_OPT_CONNECTABLE; + param.options |= BT_LE_ADV_OPT_CONN; k_condvar_init(&ctx.done); diff --git a/tests/bluetooth/host/id/bt_id_adv_random_addr_check/src/main.c b/tests/bluetooth/host/id/bt_id_adv_random_addr_check/src/main.c index 5f97f24cb3a17..a8a1e6e8c3e25 100644 --- a/tests/bluetooth/host/id/bt_id_adv_random_addr_check/src/main.c +++ b/tests/bluetooth/host/id/bt_id_adv_random_addr_check/src/main.c @@ -154,7 +154,7 @@ ZTEST(bt_id_adv_random_addr_check, test_check_returns_false_advertise_with_local atomic_set_bit(bt_dev.flags, BT_DEV_SCANNING); - adv_param.options &= ~BT_LE_ADV_OPT_CONNECTABLE; + adv_param.options &= ~BT_LE_ADV_OPT_CONN; adv_param.options |= BT_LE_ADV_OPT_USE_IDENTITY; bt_dev.id_addr[BT_ID_DEFAULT].type = BT_ADDR_LE_RANDOM; diff --git a/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/main.c b/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/main.c index 6540f6d4b2b14..c6da5720ca4a4 100644 --- a/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/main.c +++ b/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/main.c @@ -34,7 +34,7 @@ ZTEST_SUITE(bt_id_set_adv_own_addr, NULL, NULL, NULL, NULL, NULL); * privacy is enabled and 'BT_LE_ADV_OPT_USE_IDENTITY' options bit isn't set. * * Constraints: - * - Options 'BT_LE_ADV_OPT_CONNECTABLE' bit is set + * - Options 'BT_LE_ADV_OPT_CONN' bit is set * - Options 'BT_LE_ADV_OPT_USE_IDENTITY' bit isn't set * - 'CONFIG_BT_PRIVACY' is enabled * - bt_id_set_adv_private_addr() succeeds and returns 0 @@ -53,7 +53,7 @@ ZTEST(bt_id_set_adv_own_addr, test_bt_id_set_adv_private_addr_succeeds_adv_conne Z_TEST_SKIP_IFNDEF(CONFIG_BT_PRIVACY); - options |= BT_LE_ADV_OPT_CONNECTABLE; + options |= BT_LE_ADV_OPT_CONN; /* This will cause bt_id_set_adv_private_addr() to return 0 */ atomic_set_bit(bt_dev.flags, BT_DEV_RPA_VALID); @@ -82,7 +82,7 @@ ZTEST(bt_id_set_adv_own_addr, test_bt_id_set_adv_private_addr_succeeds_adv_conne * bt_id_set_adv_random_addr() if privacy isn't enabled. * * Constraints: - * - Options 'BT_LE_ADV_OPT_CONNECTABLE' bit is set + * - Options 'BT_LE_ADV_OPT_CONN' bit is set * - 'CONFIG_BT_PRIVACY' isn't enabled * - bt_id_set_adv_random_addr() succeeds and returns 0 * @@ -102,7 +102,7 @@ ZTEST(bt_id_set_adv_own_addr, test_bt_id_set_adv_random_addr_succeeds_adv_connec /* If 'CONFIG_BT_EXT_ADV' is defined, it changes bt_id_set_adv_random_addr() behaviour */ Z_TEST_SKIP_IFDEF(CONFIG_BT_EXT_ADV); - options |= BT_LE_ADV_OPT_CONNECTABLE; + options |= BT_LE_ADV_OPT_CONN; adv.id = 0; bt_addr_le_copy(&bt_dev.id_addr[adv.id], BT_RPA_LE_ADDR); @@ -132,12 +132,12 @@ ZTEST(bt_id_set_adv_own_addr, test_bt_id_set_adv_random_addr_succeeds_adv_connec /* * Test setting the advertising private address with a static random address through * bt_id_set_adv_random_addr() when device isn't advertising as a connectable device (i.e. - * BT_LE_ADV_OPT_CONNECTABLE bit in options isn't set) and the advertisement is using the device + * BT_LE_ADV_OPT_CONN bit in options isn't set) and the advertisement is using the device * identity (i.e. BT_LE_ADV_OPT_USE_IDENTITY bit is set in options). * * Constraints: * - Options 'BT_LE_ADV_OPT_USE_IDENTITY' bit is set - * - Options 'BT_LE_ADV_OPT_CONNECTABLE' bit isn't set + * - Options 'BT_LE_ADV_OPT_CONN' bit isn't set * - bt_id_set_adv_random_addr() succeeds and returns 0 * * Expected behaviour: @@ -156,7 +156,7 @@ ZTEST(bt_id_set_adv_own_addr, test_bt_id_set_adv_random_addr_succeeds_not_connec Z_TEST_SKIP_IFDEF(CONFIG_BT_EXT_ADV); options |= BT_LE_ADV_OPT_USE_IDENTITY; - options &= ~BT_LE_ADV_OPT_CONNECTABLE; + options &= ~BT_LE_ADV_OPT_CONN; adv.id = 0; bt_addr_le_copy(&bt_dev.id_addr[adv.id], BT_RPA_LE_ADDR); @@ -178,7 +178,7 @@ ZTEST(bt_id_set_adv_own_addr, test_bt_id_set_adv_random_addr_succeeds_not_connec * 'BT_LE_ADV_OPT_USE_IDENTITY' and 'BT_LE_ADV_OPT_USE_IDENTITY' options bits aren't set. * * Constraints: - * - Options 'BT_LE_ADV_OPT_CONNECTABLE' bit isn't set + * - Options 'BT_LE_ADV_OPT_CONN' bit isn't set * - Options 'BT_LE_ADV_OPT_USE_IDENTITY' bit isn't set * - bt_id_set_adv_random_addr() succeeds and returns 0 * @@ -196,7 +196,7 @@ ZTEST(bt_id_set_adv_own_addr, test_bt_id_set_adv_private_addr_succeeds_not_conne Z_TEST_SKIP_IFNDEF(CONFIG_BT_EXT_ADV); - options &= ~BT_LE_ADV_OPT_CONNECTABLE; + options &= ~BT_LE_ADV_OPT_CONN; options &= ~BT_LE_ADV_OPT_USE_IDENTITY; /* This will cause bt_id_set_adv_private_addr() to return 0 */ @@ -216,7 +216,7 @@ ZTEST(bt_id_set_adv_own_addr, test_bt_id_set_adv_private_addr_succeeds_not_conne * before updating the device advertising address and then re-enable it after the update is done. * * Constraints: - * - Options 'BT_LE_ADV_OPT_CONNECTABLE' bit isn't set + * - Options 'BT_LE_ADV_OPT_CONN' bit isn't set * - Options 'BT_LE_ADV_OPT_USE_IDENTITY' bit isn't set * * Expected behaviour: @@ -233,7 +233,7 @@ ZTEST(bt_id_set_adv_own_addr, test_observer_scanning_re_enabled_after_updating_a Z_TEST_SKIP_IFDEF(CONFIG_BT_EXT_ADV); Z_TEST_SKIP_IFNDEF(CONFIG_BT_OBSERVER); - options &= ~BT_LE_ADV_OPT_CONNECTABLE; + options &= ~BT_LE_ADV_OPT_CONN; options &= ~BT_LE_ADV_OPT_USE_IDENTITY; /* Set device scanning active flag */ diff --git a/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/test_suite_invalid_inputs.c b/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/test_suite_invalid_inputs.c index c987f8e327609..a5c7feaf5c1d0 100644 --- a/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/test_suite_invalid_inputs.c +++ b/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/test_suite_invalid_inputs.c @@ -58,7 +58,7 @@ ZTEST(bt_id_set_adv_own_addr_invalid_inputs, test_null_address_type_reference) * Constraints: * - Directed advertising flag is set * - 'BT_LE_FEAT_BIT_PRIVACY' bit isn't set - * - Options 'BT_LE_ADV_OPT_CONNECTABLE' bit is set + * - Options 'BT_LE_ADV_OPT_CONN' bit is set * - Options 'BT_LE_ADV_OPT_DIR_ADDR_RPA' bit is set * * Expected behaviour: @@ -71,7 +71,7 @@ ZTEST(bt_id_set_adv_own_addr_invalid_inputs, test_dir_adv_with_rpa_no_privacy) struct bt_le_ext_adv adv = {0}; uint8_t own_addr_type = BT_ADDR_LE_ANONYMOUS; - options |= BT_LE_ADV_OPT_CONNECTABLE; + options |= BT_LE_ADV_OPT_CONN; options |= BT_LE_ADV_OPT_DIR_ADDR_RPA; bt_dev.le.features[(BT_LE_FEAT_BIT_PRIVACY) >> 3] &= ~BIT((BT_LE_FEAT_BIT_PRIVACY)&7); @@ -87,7 +87,7 @@ ZTEST(bt_id_set_adv_own_addr_invalid_inputs, test_dir_adv_with_rpa_no_privacy) * Operation fails if bt_id_set_adv_private_addr() failed and a negative error code is returned. * * Constraints: - * - Options 'BT_LE_ADV_OPT_CONNECTABLE' bit is set + * - Options 'BT_LE_ADV_OPT_CONN' bit is set * - Options 'BT_LE_ADV_OPT_USE_IDENTITY' bit isn't set * - 'CONFIG_BT_PRIVACY' is enabled * - bt_id_set_adv_private_addr() fails and returns a negative error code (failure) @@ -104,7 +104,7 @@ ZTEST(bt_id_set_adv_own_addr_invalid_inputs, test_bt_id_set_adv_private_addr_fai Z_TEST_SKIP_IFNDEF(CONFIG_BT_PRIVACY); - options |= BT_LE_ADV_OPT_CONNECTABLE; + options |= BT_LE_ADV_OPT_CONN; err = bt_id_set_adv_own_addr(&adv, options, true, &own_addr_type); @@ -119,7 +119,7 @@ ZTEST(bt_id_set_adv_own_addr_invalid_inputs, test_bt_id_set_adv_private_addr_fai * Operation fails if bt_id_set_adv_random_addr() failed and a negative error code is returned. * * Constraints: - * - Options 'BT_LE_ADV_OPT_CONNECTABLE' bit is set + * - Options 'BT_LE_ADV_OPT_CONN' bit is set * - 'CONFIG_BT_PRIVACY' isn't enabled * - bt_id_set_adv_random_addr() fails and returns a negative error code (failure) * @@ -137,7 +137,7 @@ ZTEST(bt_id_set_adv_own_addr_invalid_inputs, test_bt_id_set_adv_random_addr_fail /* If 'CONFIG_BT_EXT_ADV' is defined, it changes bt_id_set_adv_random_addr() behaviour */ Z_TEST_SKIP_IFDEF(CONFIG_BT_EXT_ADV); - options |= BT_LE_ADV_OPT_CONNECTABLE; + options |= BT_LE_ADV_OPT_CONN; adv.id = 0; bt_addr_le_copy(&bt_dev.id_addr[adv.id], BT_RPA_LE_ADDR); @@ -152,14 +152,14 @@ ZTEST(bt_id_set_adv_own_addr_invalid_inputs, test_bt_id_set_adv_random_addr_fail /* * Test setting the advertising private address with a static random address through * bt_id_set_adv_random_addr() when device isn't advertising as a connectable device (i.e. - * BT_LE_ADV_OPT_CONNECTABLE bit in options isn't set) and the advertisement is using the device + * BT_LE_ADV_OPT_CONN bit in options isn't set) and the advertisement is using the device * identity (i.e. BT_LE_ADV_OPT_USE_IDENTITY bit is set in options). * * Operation fails if bt_id_set_adv_random_addr() failed and a negative error code is returned. * * Constraints: * - Options 'BT_LE_ADV_OPT_USE_IDENTITY' bit is set - * - Options 'BT_LE_ADV_OPT_CONNECTABLE' bit isn't set + * - Options 'BT_LE_ADV_OPT_CONN' bit isn't set * - bt_id_set_adv_random_addr() fails and returns a negative error code (failure) * * Expected behaviour: @@ -176,7 +176,7 @@ ZTEST(bt_id_set_adv_own_addr_invalid_inputs, test_bt_id_set_adv_random_addr_fail Z_TEST_SKIP_IFDEF(CONFIG_BT_EXT_ADV); options |= BT_LE_ADV_OPT_USE_IDENTITY; - options &= ~BT_LE_ADV_OPT_CONNECTABLE; + options &= ~BT_LE_ADV_OPT_CONN; adv.id = 0; bt_addr_le_copy(&bt_dev.id_addr[adv.id], BT_RPA_LE_ADDR); @@ -192,7 +192,7 @@ ZTEST(bt_id_set_adv_own_addr_invalid_inputs, test_bt_id_set_adv_random_addr_fail * Operation fails if bt_id_set_adv_private_addr() failed and a negative error code is returned. * * Constraints: - * - Options 'BT_LE_ADV_OPT_CONNECTABLE' bit isn't set + * - Options 'BT_LE_ADV_OPT_CONN' bit isn't set * - Options 'BT_LE_ADV_OPT_USE_IDENTITY' bit isn't set * - bt_id_set_adv_private_addr() fails and returns a negative error code (failure) * @@ -206,7 +206,7 @@ ZTEST(bt_id_set_adv_own_addr_invalid_inputs, test_bt_id_set_adv_private_addr_fai struct bt_le_ext_adv adv = {0}; uint8_t own_addr_type = BT_ADDR_LE_ANONYMOUS; - options &= ~BT_LE_ADV_OPT_CONNECTABLE; + options &= ~BT_LE_ADV_OPT_CONN; options &= ~BT_LE_ADV_OPT_USE_IDENTITY; /* This will cause bt_id_set_adv_private_addr() to return a negative error code */ diff --git a/tests/bluetooth/shell/src/main.c b/tests/bluetooth/shell/src/main.c index b3933335f4e25..87114ad381af3 100644 --- a/tests/bluetooth/shell/src/main.c +++ b/tests/bluetooth/shell/src/main.c @@ -53,7 +53,7 @@ static int cmd_hrs_simulate(const struct shell *sh, if (!hrs_registered && IS_ENABLED(CONFIG_BT_BROADCASTER)) { shell_print(sh, "Registering HRS Service"); hrs_registered = true; - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { shell_error(sh, "Advertising failed to start" diff --git a/tests/bluetooth/tester/src/btp_gap.c b/tests/bluetooth/tester/src/btp_gap.c index f7dfad5941871..f8ed6aa583c61 100644 --- a/tests/bluetooth/tester/src/btp_gap.c +++ b/tests/bluetooth/tester/src/btp_gap.c @@ -615,7 +615,7 @@ int tester_gap_create_adv_instance(struct bt_le_adv_param *param, uint8_t own_ad } if (atomic_test_bit(¤t_settings, BTP_GAP_SETTINGS_CONNECTABLE)) { - param->options |= BT_LE_ADV_OPT_CONNECTABLE; + param->options |= BT_LE_ADV_OPT_CONN; if (filter_list_in_use) { param->options |= BT_LE_ADV_OPT_FILTER_CONN; @@ -681,10 +681,8 @@ static uint8_t start_advertising(const void *cmd, uint16_t cmd_len, { const struct btp_gap_start_advertising_cmd *cp = cmd; struct btp_gap_start_advertising_rp *rp = rsp; - struct bt_le_adv_param param = BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_ONE_TIME, - BT_GAP_ADV_FAST_INT_MIN_2, - BT_GAP_ADV_FAST_INT_MAX_2, - NULL); + struct bt_le_adv_param param = + BT_LE_ADV_PARAM_INIT(0, BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL); uint8_t own_addr_type; uint32_t duration; uint8_t adv_len; @@ -1436,10 +1434,8 @@ static struct bt_le_per_adv_sync_cb pa_sync_cb = { int tester_gap_padv_configure(const struct bt_le_per_adv_param *param) { int err; - struct bt_le_adv_param ext_adv_param = BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_ONE_TIME, - param->interval_min, - param->interval_max, - NULL); + struct bt_le_adv_param ext_adv_param = + BT_LE_ADV_PARAM_INIT(0, param->interval_min, param->interval_max, NULL); if (ext_adv == NULL) { current_settings = BIT(BTP_GAP_SETTINGS_DISCOVERABLE) | diff --git a/tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c b/tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c index f42100b5082b4..6d34ee21a4a1a 100644 --- a/tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c @@ -693,7 +693,7 @@ static int common_init(void) bt_le_per_adv_sync_cb_register(&pa_sync_cb); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, AD_SIZE, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, AD_SIZE, NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)\n", err); return err; diff --git a/tests/bsim/bluetooth/audio/src/bap_unicast_server_test.c b/tests/bsim/bluetooth/audio/src/bap_unicast_server_test.c index cfade8d7e939a..7dff0e1a97f9f 100644 --- a/tests/bsim/bluetooth/audio/src/bap_unicast_server_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_unicast_server_test.c @@ -602,8 +602,8 @@ static void test_main_acl_disconnect(void) */ for (size_t i = 0U; i < ARRAY_SIZE(dummy_ext_adv); i++) { const struct bt_le_adv_param param = BT_LE_ADV_PARAM_INIT( - (BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONNECTABLE), - BT_GAP_ADV_SLOW_INT_MAX, BT_GAP_ADV_SLOW_INT_MAX, NULL); + (BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONN), BT_GAP_ADV_SLOW_INT_MAX, + BT_GAP_ADV_SLOW_INT_MAX, NULL); int err; err = bt_le_ext_adv_create(¶m, NULL, &dummy_ext_adv[i]); diff --git a/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c b/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c index 59550d2a6ebb9..cc7a2d4be02ff 100644 --- a/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c @@ -638,7 +638,7 @@ void test_start_adv(void) struct bt_le_ext_adv *ext_adv; /* Create a connectable non-scannable advertising set */ - err = bt_le_ext_adv_create(BT_LE_ADV_CONN_ONE_TIME, NULL, &ext_adv); + err = bt_le_ext_adv_create(BT_LE_ADV_CONN_FAST_1, NULL, &ext_adv); if (err != 0) { FAIL("Failed to create advertising set (err %d)\n", err); @@ -752,7 +752,7 @@ static void init(void) bt_cap_stream_ops_register(&unicast_streams[i], &unicast_stream_ops); } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, cap_acceptor_ad, + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, cap_acceptor_ad, ARRAY_SIZE(cap_acceptor_ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); diff --git a/tests/bsim/bluetooth/audio/src/csip_notify_server_test.c b/tests/bsim/bluetooth/audio/src/csip_notify_server_test.c index 73b344fda2b5e..0f804ed15c9b8 100644 --- a/tests/bsim/bluetooth/audio/src/csip_notify_server_test.c +++ b/tests/bsim/bluetooth/audio/src/csip_notify_server_test.c @@ -78,7 +78,7 @@ static void test_main(void) } printk("Start Advertising\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; @@ -119,7 +119,7 @@ static void test_main(void) } printk("Start Advertising\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/audio/src/csip_set_member_test.c b/tests/bsim/bluetooth/audio/src/csip_set_member_test.c index 2877ea23fa93d..e144866ab3295 100644 --- a/tests/bsim/bluetooth/audio/src/csip_set_member_test.c +++ b/tests/bsim/bluetooth/audio/src/csip_set_member_test.c @@ -80,7 +80,7 @@ static void bt_ready(int err) return; } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); } diff --git a/tests/bsim/bluetooth/audio/src/gmap_ugt_test.c b/tests/bsim/bluetooth/audio/src/gmap_ugt_test.c index d79ca961ebe53..d5ba537596fcb 100644 --- a/tests/bsim/bluetooth/audio/src/gmap_ugt_test.c +++ b/tests/bsim/bluetooth/audio/src/gmap_ugt_test.c @@ -445,8 +445,8 @@ static void test_main(void) return; } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, gmap_acceptor_ad, - ARRAY_SIZE(gmap_acceptor_ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, gmap_acceptor_ad, ARRAY_SIZE(gmap_acceptor_ad), + NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/audio/src/has_test.c b/tests/bsim/bluetooth/audio/src/has_test.c index cf5aaa45b9989..ca74bb5d34576 100644 --- a/tests/bsim/bluetooth/audio/src/has_test.c +++ b/tests/bsim/bluetooth/audio/src/has_test.c @@ -43,7 +43,7 @@ static void start_adv(void) { int err; - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, AD_SIZE, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, AD_SIZE, NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/audio/src/ias_test.c b/tests/bsim/bluetooth/audio/src/ias_test.c index 9ea8c33f2801f..b7c93af20d41f 100644 --- a/tests/bsim/bluetooth/audio/src/ias_test.c +++ b/tests/bsim/bluetooth/audio/src/ias_test.c @@ -58,7 +58,7 @@ static void test_main(void) return; } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, AD_SIZE, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, AD_SIZE, NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/audio/src/mcs_test.c b/tests/bsim/bluetooth/audio/src/mcs_test.c index 5627f560f95bb..c049bc911d7b4 100644 --- a/tests/bsim/bluetooth/audio/src/mcs_test.c +++ b/tests/bsim/bluetooth/audio/src/mcs_test.c @@ -20,7 +20,7 @@ static void start_adv(void) { int err; - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, AD_SIZE, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, AD_SIZE, NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/audio/src/media_controller_test.c b/tests/bsim/bluetooth/audio/src/media_controller_test.c index a8e7ead4c91c4..34faffc0dbb60 100644 --- a/tests/bsim/bluetooth/audio/src/media_controller_test.c +++ b/tests/bsim/bluetooth/audio/src/media_controller_test.c @@ -1655,7 +1655,7 @@ void test_media_controller_remote_player(void) initialize_bluetooth(); initialize_media(); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, AD_SIZE, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, AD_SIZE, NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)\n", err); } diff --git a/tests/bsim/bluetooth/audio/src/micp_mic_dev_test.c b/tests/bsim/bluetooth/audio/src/micp_mic_dev_test.c index 9a9bd0466f940..bc8c820b70222 100644 --- a/tests/bsim/bluetooth/audio/src/micp_mic_dev_test.c +++ b/tests/bsim/bluetooth/audio/src/micp_mic_dev_test.c @@ -432,7 +432,7 @@ static void test_main(void) printk("MICP initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, AD_SIZE, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, AD_SIZE, NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/audio/src/pacs_notify_server_test.c b/tests/bsim/bluetooth/audio/src/pacs_notify_server_test.c index a1ce273de955d..cbd4fc75111f5 100644 --- a/tests/bsim/bluetooth/audio/src/pacs_notify_server_test.c +++ b/tests/bsim/bluetooth/audio/src/pacs_notify_server_test.c @@ -191,7 +191,7 @@ static void test_main(void) } LOG_DBG("Start Advertising"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)", err); return; @@ -225,7 +225,7 @@ static void test_main(void) trigger_notifications(); LOG_DBG("Start Advertising"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)", err); return; @@ -242,7 +242,7 @@ static void test_main(void) } LOG_DBG("Start Advertising"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)", err); return; @@ -276,7 +276,7 @@ static void test_main(void) } LOG_DBG("Start Advertising"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)", err); return; diff --git a/tests/bsim/bluetooth/audio/src/tbs_client_test.c b/tests/bsim/bluetooth/audio/src/tbs_client_test.c index 66a4574647b08..6c1c91b42e3ad 100644 --- a/tests/bsim/bluetooth/audio/src/tbs_client_test.c +++ b/tests/bsim/bluetooth/audio/src/tbs_client_test.c @@ -503,7 +503,7 @@ static void test_main(void) printk("Audio Server: Bluetooth discovered\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, AD_SIZE, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, AD_SIZE, NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/audio/src/vcp_vol_rend_test.c b/tests/bsim/bluetooth/audio/src/vcp_vol_rend_test.c index dde6bc3ca075d..59575f37144bc 100644 --- a/tests/bsim/bluetooth/audio/src/vcp_vol_rend_test.c +++ b/tests/bsim/bluetooth/audio/src/vcp_vol_rend_test.c @@ -1044,7 +1044,7 @@ static void test_main(void) printk("VCP initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, AD_SIZE, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, AD_SIZE, NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/host/adv/encrypted/css_sample_data/src/peripheral.c b/tests/bsim/bluetooth/host/adv/encrypted/css_sample_data/src/peripheral.c index fd9b6e9d5f8e7..41362a5478929 100644 --- a/tests/bsim/bluetooth/host/adv/encrypted/css_sample_data/src/peripheral.c +++ b/tests/bsim/bluetooth/host/adv/encrypted/css_sample_data/src/peripheral.c @@ -15,7 +15,7 @@ static void create_adv(struct bt_le_ext_adv **adv) memset(¶ms, 0, sizeof(struct bt_le_adv_param)); - params.options |= BT_LE_ADV_OPT_CONNECTABLE; + params.options |= BT_LE_ADV_OPT_CONN; params.options |= BT_LE_ADV_OPT_EXT_ADV; params.id = BT_ID_DEFAULT; diff --git a/tests/bsim/bluetooth/host/att/eatt/src/common.c b/tests/bsim/bluetooth/host/att/eatt/src/common.c index 487f5c644b850..271d759dcd6ea 100644 --- a/tests/bsim/bluetooth/host/att/eatt/src/common.c +++ b/tests/bsim/bluetooth/host/att/eatt/src/common.c @@ -140,7 +140,7 @@ void peripheral_setup_and_connect(void) FAIL("Can't enable Bluetooth (err %d)\n", err); } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)\n", err); } diff --git a/tests/bsim/bluetooth/host/att/eatt_notif/src/server_test.c b/tests/bsim/bluetooth/host/att/eatt_notif/src/server_test.c index 6cffbdba9ea23..474fb10111392 100644 --- a/tests/bsim/bluetooth/host/att/eatt_notif/src/server_test.c +++ b/tests/bsim/bluetooth/host/att/eatt_notif/src/server_test.c @@ -189,7 +189,7 @@ static void test_main(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/host/att/pipeline/dut/src/main.c b/tests/bsim/bluetooth/host/att/pipeline/dut/src/main.c index 6481ce909b429..a380ff615e267 100644 --- a/tests/bsim/bluetooth/host/att/pipeline/dut/src/main.c +++ b/tests/bsim/bluetooth/host/att/pipeline/dut/src/main.c @@ -121,11 +121,6 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, } } -/* In your area */ -#define ADV_PARAM_SINGLE BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME, \ - BT_GAP_ADV_FAST_INT_MIN_2, \ - BT_GAP_ADV_FAST_INT_MAX_2, NULL) - static strucc bt_conn *connecc(void) { int err; @@ -133,7 +128,7 @@ static strucc bt_conn *connecc(void) UNSET_FLAG(is_connected); - err = bt_le_adv_start(ADV_PARAM_SINGLE, NULL, 0, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, NULL, 0, NULL, 0); ASSERT(!err, "Adving failed to start (err %d)\n", err); LOG_DBG(" wait connecc..."); diff --git a/tests/bsim/bluetooth/host/central/src/dummy_peripheral.c b/tests/bsim/bluetooth/host/central/src/dummy_peripheral.c index e7a85a80e658b..6f6cb7ae54323 100644 --- a/tests/bsim/bluetooth/host/central/src/dummy_peripheral.c +++ b/tests/bsim/bluetooth/host/central/src/dummy_peripheral.c @@ -41,7 +41,7 @@ static void test_peripheral_dummy(void) err = bt_enable(NULL); TEST_ASSERT(err == 0, "Can't enable Bluetooth (err %d)", err); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); TEST_ASSERT(err == 0, "Advertising failed to start (err %d)", err); err = k_sem_take(&sem_connected, K_FOREVER); diff --git a/tests/bsim/bluetooth/host/gatt/authorization/src/gatt_server_test.c b/tests/bsim/bluetooth/host/gatt/authorization/src/gatt_server_test.c index 349f69187e6e6..c8a3303a8d9be 100644 --- a/tests/bsim/bluetooth/host/gatt/authorization/src/gatt_server_test.c +++ b/tests/bsim/bluetooth/host/gatt/authorization/src/gatt_server_test.c @@ -341,7 +341,7 @@ static void test_main(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/host/gatt/caching/src/gatt_server_test.c b/tests/bsim/bluetooth/host/gatt/caching/src/gatt_server_test.c index cb64b53a3158a..637b7037e2fc4 100644 --- a/tests/bsim/bluetooth/host/gatt/caching/src/gatt_server_test.c +++ b/tests/bsim/bluetooth/host/gatt/caching/src/gatt_server_test.c @@ -101,7 +101,7 @@ static void test_main_common(bool connect_eatt) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); diff --git a/tests/bsim/bluetooth/host/gatt/ccc_store/src/peripheral.c b/tests/bsim/bluetooth/host/gatt/ccc_store/src/peripheral.c index 03344852af918..873685ecd4fad 100644 --- a/tests/bsim/bluetooth/host/gatt/ccc_store/src/peripheral.c +++ b/tests/bsim/bluetooth/host/gatt/ccc_store/src/peripheral.c @@ -58,18 +58,8 @@ BT_GATT_SERVICE_DEFINE(dummy_svc, BT_GATT_PRIMARY_SERVICE(&dummy_service), static void create_adv(struct bt_le_ext_adv **adv) { int err; - struct bt_le_adv_param params; - memset(¶ms, 0, sizeof(struct bt_le_adv_param)); - - params.options |= BT_LE_ADV_OPT_CONNECTABLE; - - params.id = BT_ID_DEFAULT; - params.sid = 0; - params.interval_min = BT_GAP_ADV_FAST_INT_MIN_2; - params.interval_max = BT_GAP_ADV_FAST_INT_MAX_2; - - err = bt_le_ext_adv_create(¶ms, NULL, adv); + err = bt_le_ext_adv_create(BT_LE_ADV_CONN_FAST_1, NULL, adv); if (err) { FAIL("Failed to create advertiser (%d)\n", err); } diff --git a/tests/bsim/bluetooth/host/gatt/general/src/gatt_server_test.c b/tests/bsim/bluetooth/host/gatt/general/src/gatt_server_test.c index 3fb080848fce1..476f5bba0ef47 100644 --- a/tests/bsim/bluetooth/host/gatt/general/src/gatt_server_test.c +++ b/tests/bsim/bluetooth/host/gatt/general/src/gatt_server_test.c @@ -161,7 +161,7 @@ static void test_main(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/host/gatt/notify/src/gatt_server_test.c b/tests/bsim/bluetooth/host/gatt/notify/src/gatt_server_test.c index d3b345d34d446..6b4cc13a7c250 100644 --- a/tests/bsim/bluetooth/host/gatt/notify/src/gatt_server_test.c +++ b/tests/bsim/bluetooth/host/gatt/notify/src/gatt_server_test.c @@ -183,7 +183,7 @@ static void setup(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/host/gatt/notify_multiple/src/gatt_server_test.c b/tests/bsim/bluetooth/host/gatt/notify_multiple/src/gatt_server_test.c index e1af7319ed207..1a9a95262d635 100644 --- a/tests/bsim/bluetooth/host/gatt/notify_multiple/src/gatt_server_test.c +++ b/tests/bsim/bluetooth/host/gatt/notify_multiple/src/gatt_server_test.c @@ -145,7 +145,7 @@ static void test_main(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/host/gatt/sc_indicate/src/bs_bt_utils.c b/tests/bsim/bluetooth/host/gatt/sc_indicate/src/bs_bt_utils.c index 31952cbe330b9..91391b404c7a7 100644 --- a/tests/bsim/bluetooth/host/gatt/sc_indicate/src/bs_bt_utils.c +++ b/tests/bsim/bluetooth/host/gatt/sc_indicate/src/bs_bt_utils.c @@ -129,7 +129,7 @@ void create_adv(struct bt_le_ext_adv **adv) int err; struct bt_le_adv_param params = {}; - params.options |= BT_LE_ADV_OPT_CONNECTABLE; + params.options |= BT_LE_ADV_OPT_CONN; params.options |= BT_LE_ADV_OPT_EXT_ADV; params.id = BT_ID_DEFAULT; diff --git a/tests/bsim/bluetooth/host/gatt/settings/src/utils.c b/tests/bsim/bluetooth/host/gatt/settings/src/utils.c index b1b9262e23543..c7cf895d8a2ca 100644 --- a/tests/bsim/bluetooth/host/gatt/settings/src/utils.c +++ b/tests/bsim/bluetooth/host/gatt/settings/src/utils.c @@ -121,8 +121,7 @@ void advertise_connectable(void) param.interval_min = 0x0020; param.interval_max = 0x4000; - param.options |= BT_LE_ADV_OPT_ONE_TIME; - param.options |= BT_LE_ADV_OPT_CONNECTABLE; + param.options |= BT_LE_ADV_OPT_CONN; err = bt_le_adv_start(¶m, NULL, 0, NULL, 0); __ASSERT(err == 0, "Advertising failed to start (err %d)\n", err); diff --git a/tests/bsim/bluetooth/host/iso/cis/src/cis_peripheral.c b/tests/bsim/bluetooth/host/iso/cis/src/cis_peripheral.c index 64c88e01cfd1f..56fe4070ad50a 100644 --- a/tests/bsim/bluetooth/host/iso/cis/src/cis_peripheral.c +++ b/tests/bsim/bluetooth/host/iso/cis/src/cis_peripheral.c @@ -143,7 +143,7 @@ static void adv_connect(void) { int err; - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)\n", err); diff --git a/tests/bsim/bluetooth/host/l2cap/credits/src/main.c b/tests/bsim/bluetooth/host/l2cap/credits/src/main.c index 4c649d0d81e4c..f35abf350ac23 100644 --- a/tests/bsim/bluetooth/host/l2cap/credits/src/main.c +++ b/tests/bsim/bluetooth/host/l2cap/credits/src/main.c @@ -210,11 +210,6 @@ static void disconnect_device(struct bt_conn *conn, void *data) WAIT_FOR_FLAG_UNSET(is_connected); } -#define BT_LE_ADV_CONN_OT BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \ - BT_LE_ADV_OPT_ONE_TIME, \ - BT_GAP_ADV_FAST_INT_MIN_2, \ - BT_GAP_ADV_FAST_INT_MAX_2, NULL) - static void test_peripheral_main(void) { LOG_DBG("*L2CAP CREDITS Peripheral started*"); @@ -233,7 +228,7 @@ static void test_peripheral_main(void) LOG_DBG("Peripheral Bluetooth initialized."); LOG_DBG("Connectable advertising..."); - err = bt_le_adv_start(BT_LE_ADV_CONN_OT, NULL, 0, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, NULL, 0, NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)", err); return; diff --git a/tests/bsim/bluetooth/host/l2cap/credits_seg_recv/src/main.c b/tests/bsim/bluetooth/host/l2cap/credits_seg_recv/src/main.c index 1187f97241c7a..b98a79e355576 100644 --- a/tests/bsim/bluetooth/host/l2cap/credits_seg_recv/src/main.c +++ b/tests/bsim/bluetooth/host/l2cap/credits_seg_recv/src/main.c @@ -227,10 +227,6 @@ static void disconnect_device(struct bt_conn *conn, void *data) WAIT_FOR_FLAG_UNSET(is_connected); } -#define BT_LE_ADV_CONN_OT \ - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME, \ - BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL) - static void test_peripheral_main(void) { int err; @@ -251,7 +247,7 @@ static void test_peripheral_main(void) LOG_DBG("Peripheral Bluetooth initialized."); LOG_DBG("Connectable advertising..."); - err = bt_le_adv_start(BT_LE_ADV_CONN_OT, NULL, 0, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, NULL, 0, NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)", err); return; diff --git a/tests/bsim/bluetooth/host/l2cap/general/src/main_l2cap_ecred.c b/tests/bsim/bluetooth/host/l2cap/general/src/main_l2cap_ecred.c index 521e1a6d63372..06135e030a528 100644 --- a/tests/bsim/bluetooth/host/l2cap/general/src/main_l2cap_ecred.c +++ b/tests/bsim/bluetooth/host/l2cap/general/src/main_l2cap_ecred.c @@ -449,7 +449,7 @@ static void test_peripheral_main(void) LOG_DBG("Peripheral Bluetooth initialized."); LOG_DBG("Connectable advertising..."); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)", err); return; diff --git a/tests/bsim/bluetooth/host/l2cap/many_conns/src/main.c b/tests/bsim/bluetooth/host/l2cap/many_conns/src/main.c index 76020b61fdc09..04825306285ae 100644 --- a/tests/bsim/bluetooth/host/l2cap/many_conns/src/main.c +++ b/tests/bsim/bluetooth/host/l2cap/many_conns/src/main.c @@ -235,11 +235,6 @@ static void disconnect_device(struct bt_conn *conn, void *data) WAIT_FOR_FLAG_UNSET(is_connected); } -#define BT_LE_ADV_CONN_OT BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \ - BT_LE_ADV_OPT_ONE_TIME, \ - BT_GAP_ADV_FAST_INT_MIN_2, \ - BT_GAP_ADV_FAST_INT_MAX_2, NULL) - static void test_peripheral_main(void) { LOG_DBG("L2CAP CONN LATENCY Peripheral started*"); @@ -255,7 +250,7 @@ static void test_peripheral_main(void) LOG_DBG("Peripheral Bluetooth initialized."); LOG_DBG("Connectable advertising..."); - err = bt_le_adv_start(BT_LE_ADV_CONN_OT, NULL, 0, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, NULL, 0, NULL, 0); ASSERT(!err, "Advertising failed to start (err %d)", err); LOG_DBG("Advertising started."); diff --git a/tests/bsim/bluetooth/host/l2cap/multilink_peripheral/src/dut.c b/tests/bsim/bluetooth/host/l2cap/multilink_peripheral/src/dut.c index 534b560b81911..e62eb7f677211 100644 --- a/tests/bsim/bluetooth/host/l2cap/multilink_peripheral/src/dut.c +++ b/tests/bsim/bluetooth/host/l2cap/multilink_peripheral/src/dut.c @@ -251,7 +251,7 @@ static void start_advertising(void) LOG_DBG("starting advertiser"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); TEST_ASSERT(!err, "Advertising failed to start (err %d)", err); } diff --git a/tests/bsim/bluetooth/host/l2cap/send_on_connect/src/main_l2cap_send_on_connect.c b/tests/bsim/bluetooth/host/l2cap/send_on_connect/src/main_l2cap_send_on_connect.c index a7da6e723a924..9fd1c4bfcb862 100644 --- a/tests/bsim/bluetooth/host/l2cap/send_on_connect/src/main_l2cap_send_on_connect.c +++ b/tests/bsim/bluetooth/host/l2cap/send_on_connect/src/main_l2cap_send_on_connect.c @@ -187,7 +187,7 @@ static void test_peripheral_main(void) register_l2cap_server(); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/host/l2cap/stress/src/main.c b/tests/bsim/bluetooth/host/l2cap/stress/src/main.c index e0e761a37b9c5..0a9023ecbd31a 100644 --- a/tests/bsim/bluetooth/host/l2cap/stress/src/main.c +++ b/tests/bsim/bluetooth/host/l2cap/stress/src/main.c @@ -293,11 +293,6 @@ static void disconnect_device(struct bt_conn *conn, void *data) WAIT_FOR_FLAG_UNSET(is_connected); } -#define BT_LE_ADV_CONN_OT BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \ - BT_LE_ADV_OPT_ONE_TIME, \ - BT_GAP_ADV_FAST_INT_MIN_2, \ - BT_GAP_ADV_FAST_INT_MAX_2, NULL) - static void test_peripheral_main(void) { LOG_DBG("*L2CAP STRESS Peripheral started*"); @@ -316,7 +311,7 @@ static void test_peripheral_main(void) LOG_DBG("Peripheral Bluetooth initialized."); LOG_DBG("Connectable advertising..."); - err = bt_le_adv_start(BT_LE_ADV_CONN_OT, NULL, 0, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, NULL, 0, NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)", err); return; diff --git a/tests/bsim/bluetooth/host/l2cap/userdata/src/main_l2cap_userdata.c b/tests/bsim/bluetooth/host/l2cap/userdata/src/main_l2cap_userdata.c index d7f42d0d28eef..57e70ae88210d 100644 --- a/tests/bsim/bluetooth/host/l2cap/userdata/src/main_l2cap_userdata.c +++ b/tests/bsim/bluetooth/host/l2cap/userdata/src/main_l2cap_userdata.c @@ -175,7 +175,7 @@ static void test_peripheral_main(void) return; } - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/host/misc/conn_stress/peripheral/src/main.c b/tests/bsim/bluetooth/host/misc/conn_stress/peripheral/src/main.c index 024f37a378dea..be11ade9baf8e 100644 --- a/tests/bsim/bluetooth/host/misc/conn_stress/peripheral/src/main.c +++ b/tests/bsim/bluetooth/host/misc/conn_stress/peripheral/src/main.c @@ -400,7 +400,7 @@ void test_peripheral_main(void) sprintf(name, "per-%d", get_device_nbr()); bt_set_name(name); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, NULL, 0, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, NULL, 0, NULL, 0); if (err) { LOG_ERR("Advertising failed to start (err %d)", err); __ASSERT_NO_MSG(err); diff --git a/tests/bsim/bluetooth/host/misc/disable/src/gatt_server_test.c b/tests/bsim/bluetooth/host/misc/disable/src/gatt_server_test.c index 83c9cf744c760..78cee69024d2e 100644 --- a/tests/bsim/bluetooth/host/misc/disable/src/gatt_server_test.c +++ b/tests/bsim/bluetooth/host/misc/disable/src/gatt_server_test.c @@ -144,7 +144,7 @@ static void test_main(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/host/misc/hfc/src/main.c b/tests/bsim/bluetooth/host/misc/hfc/src/main.c index 15e2777917033..7c70511c32f06 100644 --- a/tests/bsim/bluetooth/host/misc/hfc/src/main.c +++ b/tests/bsim/bluetooth/host/misc/hfc/src/main.c @@ -106,10 +106,6 @@ static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, } } -#define ADV_PARAM_SINGLE BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME, \ - BT_GAP_ADV_FAST_INT_MIN_2, \ - BT_GAP_ADV_FAST_INT_MAX_2, NULL) - static struct bt_conn *connect_as_peripheral(void) { int err; @@ -117,7 +113,7 @@ static struct bt_conn *connect_as_peripheral(void) UNSET_FLAG(is_connected); - err = bt_le_adv_start(ADV_PARAM_SINGLE, NULL, 0, NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, NULL, 0, NULL, 0); ASSERT(!err, "Adving failed to start (err %d)\n", err); LOG_DBG("advertising"); diff --git a/tests/bsim/bluetooth/host/misc/unregister_conn_cb/src/main.c b/tests/bsim/bluetooth/host/misc/unregister_conn_cb/src/main.c index 63aba885565ba..ac2d919afab4a 100644 --- a/tests/bsim/bluetooth/host/misc/unregister_conn_cb/src/main.c +++ b/tests/bsim/bluetooth/host/misc/unregister_conn_cb/src/main.c @@ -123,7 +123,7 @@ static void start_adv(void) const struct bt_data ad[] = { BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR))}; - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err != 0) { FAIL("Advertising failed to start (err %d)\n", err); return; diff --git a/tests/bsim/bluetooth/host/privacy/central/src/tester.c b/tests/bsim/bluetooth/host/privacy/central/src/tester.c index b1c6e9fd1bc6d..119802c4a0d2e 100644 --- a/tests/bsim/bluetooth/host/privacy/central/src/tester.c +++ b/tests/bsim/bluetooth/host/privacy/central/src/tester.c @@ -141,9 +141,8 @@ void tester_procedure_periph_delayed_start_of_conn_adv(void) int err; struct bt_le_adv_param params = - BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_USE_IDENTITY, - BT_GAP_ADV_FAST_INT_MIN_2, - BT_GAP_ADV_FAST_INT_MAX_2, NULL); + BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_USE_IDENTITY, + BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL); struct bt_data ad; struct bt_le_ext_adv *adv; diff --git a/tests/bsim/bluetooth/host/privacy/device/src/test_undirected_peripheral.c b/tests/bsim/bluetooth/host/privacy/device/src/test_undirected_peripheral.c index 402b590de00e1..fbfc45536addf 100644 --- a/tests/bsim/bluetooth/host/privacy/device/src/test_undirected_peripheral.c +++ b/tests/bsim/bluetooth/host/privacy/device/src/test_undirected_peripheral.c @@ -166,7 +166,7 @@ static void create_adv(struct bt_le_ext_adv **adv) memset(¶ms, 0, sizeof(struct bt_le_adv_param)); - params.options |= BT_LE_ADV_OPT_CONNECTABLE; + params.options |= BT_LE_ADV_OPT_CONN; params.id = BT_ID_DEFAULT; params.sid = 0; @@ -191,11 +191,11 @@ static void update_adv_params(struct bt_le_ext_adv *adv, enum adv_param_t adv_pa memset(¶ms, 0, sizeof(struct bt_le_adv_param)); if (adv_params == CONN_SCAN) { - params.options |= BT_LE_ADV_OPT_CONNECTABLE; + params.options |= BT_LE_ADV_OPT_CONN; params.options |= BT_LE_ADV_OPT_SCANNABLE; LOG_DBG("Advertiser params: CONN_SCAN"); } else if (adv_params == CONN_NSCAN) { - params.options |= BT_LE_ADV_OPT_CONNECTABLE; + params.options |= BT_LE_ADV_OPT_CONN; LOG_DBG("Advertiser params: CONN_NSCAN"); } else if (adv_params == NCONN_SCAN) { params.options |= BT_LE_ADV_OPT_SCANNABLE; diff --git a/tests/bsim/bluetooth/host/privacy/legacy/src/dut.c b/tests/bsim/bluetooth/host/privacy/legacy/src/dut.c index 5fc79107cee88..f9530d46ac0b0 100644 --- a/tests/bsim/bluetooth/host/privacy/legacy/src/dut.c +++ b/tests/bsim/bluetooth/host/privacy/legacy/src/dut.c @@ -42,10 +42,8 @@ void start_advertising(uint32_t options) { int err; - struct bt_le_adv_param param = BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_ONE_TIME, - BT_GAP_ADV_FAST_INT_MIN_2, - BT_GAP_ADV_FAST_INT_MAX_2, - NULL); + struct bt_le_adv_param param = + BT_LE_ADV_PARAM_INIT(0, BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL); param.options |= options; err = bt_le_adv_start(¶m, ad, ARRAY_SIZE(ad), NULL, 0); @@ -82,7 +80,7 @@ void dut_procedure(void) generate_new_rpa(); LOG_DBG("start adv with identity"); - start_advertising(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_USE_IDENTITY); + start_advertising(BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_USE_IDENTITY); /* wait for the tester to validate we're using our identity address */ LOG_DBG("wait for validation by tester"); @@ -94,7 +92,7 @@ void dut_procedure(void) } LOG_DBG("start adv with RPA"); - start_advertising(BT_LE_ADV_OPT_CONNECTABLE); + start_advertising(BT_LE_ADV_OPT_CONN); /* Test pass verdict is decided by the tester */ PASS("DUT done\n"); diff --git a/tests/bsim/bluetooth/host/security/bond_overwrite_allowed/src/bs_bt_utils.c b/tests/bsim/bluetooth/host/security/bond_overwrite_allowed/src/bs_bt_utils.c index 0fe1f7d3ac625..d43fb32626a4c 100644 --- a/tests/bsim/bluetooth/host/security/bond_overwrite_allowed/src/bs_bt_utils.c +++ b/tests/bsim/bluetooth/host/security/bond_overwrite_allowed/src/bs_bt_utils.c @@ -163,8 +163,7 @@ void advertise_connectable(int id, bt_addr_le_t *directed_dst) param.id = id; param.interval_min = 0x0020; param.interval_max = 0x4000; - param.options |= BT_LE_ADV_OPT_ONE_TIME; - param.options |= BT_LE_ADV_OPT_CONNECTABLE; + param.options |= BT_LE_ADV_OPT_CONN; if (directed_dst) { param.options |= BT_LE_ADV_OPT_DIR_ADDR_RPA; diff --git a/tests/bsim/bluetooth/host/security/bond_overwrite_denied/src/bs_bt_utils.c b/tests/bsim/bluetooth/host/security/bond_overwrite_denied/src/bs_bt_utils.c index 0fe1f7d3ac625..d43fb32626a4c 100644 --- a/tests/bsim/bluetooth/host/security/bond_overwrite_denied/src/bs_bt_utils.c +++ b/tests/bsim/bluetooth/host/security/bond_overwrite_denied/src/bs_bt_utils.c @@ -163,8 +163,7 @@ void advertise_connectable(int id, bt_addr_le_t *directed_dst) param.id = id; param.interval_min = 0x0020; param.interval_max = 0x4000; - param.options |= BT_LE_ADV_OPT_ONE_TIME; - param.options |= BT_LE_ADV_OPT_CONNECTABLE; + param.options |= BT_LE_ADV_OPT_CONN; if (directed_dst) { param.options |= BT_LE_ADV_OPT_DIR_ADDR_RPA; diff --git a/tests/bsim/bluetooth/host/security/bond_per_connection/src/bs_bt_utils.c b/tests/bsim/bluetooth/host/security/bond_per_connection/src/bs_bt_utils.c index 94b27a50b3321..b6ac6315ca9f3 100644 --- a/tests/bsim/bluetooth/host/security/bond_per_connection/src/bs_bt_utils.c +++ b/tests/bsim/bluetooth/host/security/bond_per_connection/src/bs_bt_utils.c @@ -184,8 +184,7 @@ void advertise_connectable(int id, bt_addr_le_t *directed_dst) param.id = id; param.interval_min = 0x0020; param.interval_max = 0x4000; - param.options |= BT_LE_ADV_OPT_ONE_TIME; - param.options |= BT_LE_ADV_OPT_CONNECTABLE; + param.options |= BT_LE_ADV_OPT_CONN; if (directed_dst) { param.options |= BT_LE_ADV_OPT_DIR_ADDR_RPA; diff --git a/tests/bsim/bluetooth/host/security/ccc_update/src/peripheral.c b/tests/bsim/bluetooth/host/security/ccc_update/src/peripheral.c index 9813a6b0b60bc..0cae51ba2d96c 100644 --- a/tests/bsim/bluetooth/host/security/ccc_update/src/peripheral.c +++ b/tests/bsim/bluetooth/host/security/ccc_update/src/peripheral.c @@ -63,7 +63,7 @@ static void create_adv(struct bt_le_ext_adv **adv) memset(¶ms, 0, sizeof(struct bt_le_adv_param)); - params.options |= BT_LE_ADV_OPT_CONNECTABLE; + params.options |= BT_LE_ADV_OPT_CONN; params.id = BT_ID_DEFAULT; params.sid = 0; diff --git a/tests/bsim/bluetooth/host/security/id_addr_update/peripheral/src/utils.c b/tests/bsim/bluetooth/host/security/id_addr_update/peripheral/src/utils.c index 1e566fe1d4b13..83c34361d369a 100644 --- a/tests/bsim/bluetooth/host/security/id_addr_update/peripheral/src/utils.c +++ b/tests/bsim/bluetooth/host/security/id_addr_update/peripheral/src/utils.c @@ -153,8 +153,7 @@ void advertise_connectable(int id) param.id = id; param.interval_min = 0x0020; param.interval_max = 0x4000; - param.options |= BT_LE_ADV_OPT_ONE_TIME; - param.options |= BT_LE_ADV_OPT_CONNECTABLE; + param.options |= BT_LE_ADV_OPT_CONN; err = bt_le_adv_start(¶m, NULL, 0, NULL, 0); ASSERT(!err, "Advertising failed to start (err %d)\n", err); diff --git a/tests/bsim/bluetooth/host/security/security_changed_callback/src/bs_bt_utils.c b/tests/bsim/bluetooth/host/security/security_changed_callback/src/bs_bt_utils.c index 3f9fabe544a43..6f7f379853b13 100644 --- a/tests/bsim/bluetooth/host/security/security_changed_callback/src/bs_bt_utils.c +++ b/tests/bsim/bluetooth/host/security/security_changed_callback/src/bs_bt_utils.c @@ -175,8 +175,7 @@ void advertise_connectable(int id, bt_addr_le_t *directed_dst) param.id = id; param.interval_min = 0x0020; param.interval_max = 0x4000; - param.options |= BT_LE_ADV_OPT_ONE_TIME; - param.options |= BT_LE_ADV_OPT_CONNECTABLE; + param.options |= BT_LE_ADV_OPT_CONN; if (directed_dst) { param.options |= BT_LE_ADV_OPT_DIR_ADDR_RPA; diff --git a/tests/bsim/bluetooth/ll/advx/src/main.c b/tests/bsim/bluetooth/ll/advx/src/main.c index cdc71c90691ef..a98a55270477a 100644 --- a/tests/bsim/bluetooth/ll/advx/src/main.c +++ b/tests/bsim/bluetooth/ll/advx/src/main.c @@ -185,7 +185,7 @@ static void test_advx_main(void) printk("success.\n"); printk("Connectable advertising..."); - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { printk("Advertising failed to start (err %d)\n", err); return; @@ -401,7 +401,7 @@ static void test_advx_main(void) k_sleep(K_MSEC(1000)); printk("Create connectable advertising set..."); - err = bt_le_ext_adv_create(BT_LE_ADV_CONN, &adv_callbacks, &adv); + err = bt_le_ext_adv_create(BT_LE_ADV_CONN_FAST_2, &adv_callbacks, &adv); if (err) { goto exit; } @@ -654,7 +654,7 @@ static void test_advx_main(void) } }; const struct bt_le_adv_param adv_param = { - .options = BT_LE_ADV_OPT_CONNECTABLE, + .options = BT_LE_ADV_OPT_CONN, .peer = &direct_addr, }; err = bt_le_adv_start(&adv_param, NULL, 0, NULL, 0); diff --git a/tests/bsim/bluetooth/ll/cis/src/main.c b/tests/bsim/bluetooth/ll/cis/src/main.c index a4d5727a63457..2e5e8eeebf394 100644 --- a/tests/bsim/bluetooth/ll/cis/src/main.c +++ b/tests/bsim/bluetooth/ll/cis/src/main.c @@ -75,18 +75,12 @@ static bt_addr_le_t peer_addr; BT_LE_CONN_PARAM(CONN_INTERVAL_MIN, CONN_INTERVAL_MAX, 0U, CONN_TIMEOUT) #if defined(CONFIG_TEST_USE_LEGACY_ADVERTISING) -#define BT_LE_ADV_CONN_CUSTOM BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \ - BT_LE_ADV_OPT_ONE_TIME, \ - ADV_INTERVAL_MIN, \ - ADV_INTERVAL_MAX, \ - NULL) +#define BT_LE_ADV_CONN_CUSTOM \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, ADV_INTERVAL_MIN, ADV_INTERVAL_MAX, NULL) #else /* !CONFIG_TEST_USE_LEGACY_ADVERTISING */ -#define BT_LE_ADV_CONN_CUSTOM BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | \ - BT_LE_ADV_OPT_EXT_ADV | \ - BT_LE_ADV_OPT_ONE_TIME, \ - ADV_INTERVAL_MIN, \ - ADV_INTERVAL_MAX, \ - NULL) +#define BT_LE_ADV_CONN_CUSTOM \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_EXT_ADV, ADV_INTERVAL_MIN, \ + ADV_INTERVAL_MAX, NULL) #endif /* !CONFIG_TEST_USE_LEGACY_ADVERTISING */ #define SEQ_NUM_MAX 1000U diff --git a/tests/bsim/bluetooth/ll/conn/src/test_connect2.c b/tests/bsim/bluetooth/ll/conn/src/test_connect2.c index e8e07280b15c5..44b7af7a55f5a 100644 --- a/tests/bsim/bluetooth/ll/conn/src/test_connect2.c +++ b/tests/bsim/bluetooth/ll/conn/src/test_connect2.c @@ -122,9 +122,27 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) } } +static int start_advertising(void) +{ + int err; + + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); + if (err) { + printk("Advertising failed to start (err %d)\n", err); + } + + return err; +} + +static void recycled(void) +{ + start_advertising(); +} + static struct bt_conn_cb conn_callbacks = { .connected = connected, .disconnected = disconnected, + .recycled = recycled, }; static void bt_ready(void) @@ -133,13 +151,17 @@ static void bt_ready(void) printk("Peripheral Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { FAIL("Advertising failed to start (err %d)\n", err); return; } - printk("Advertising successfully started\n"); + err = start_advertising(); + + if (!err) { + printk("Advertising successfully started\n"); + } } static void bas_notify(void) diff --git a/tests/bsim/bluetooth/ll/edtt/gatt_test_app/src/main.c b/tests/bsim/bluetooth/ll/edtt/gatt_test_app/src/main.c index 55bb13ab3aa3c..abd3fb5e868cf 100644 --- a/tests/bsim/bluetooth/ll/edtt/gatt_test_app/src/main.c +++ b/tests/bsim/bluetooth/ll/edtt/gatt_test_app/src/main.c @@ -46,6 +46,21 @@ static const struct bt_data sd[] = { static int service_set; +static int start_advertising(void) +{ + int err; + + err = bt_le_adv_start(BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_USE_IDENTITY, + BT_GAP_ADV_FAST_INT_MIN_1, BT_GAP_ADV_FAST_INT_MAX_1, + NULL), + ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + if (err) { + printk("Advertising failed to start (err %d)\n", err); + } + + return err; +} + static void connected(struct bt_conn *conn, uint8_t err) { if (err) { @@ -60,6 +75,11 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) printk("Disconnected (reason 0x%02x)\n", reason); } +static void recycled(void) +{ + start_advertising(); +} + static void security_changed(struct bt_conn *conn, bt_security_t level, enum bt_security_err err) { @@ -73,6 +93,7 @@ static void security_changed(struct bt_conn *conn, bt_security_t level, BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, + .recycled = recycled, .security_changed = security_changed, }; @@ -226,14 +247,11 @@ static void bt_ready(int err) settings_load(); } - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, - ARRAY_SIZE(sd)); - if (err) { - printk("Advertising failed to start (err %d)\n", err); - return; - } + err = start_advertising(); - printk("Advertising successfully started\n"); + if (!err) { + printk("Advertising successfully started\n"); + } } static void auth_passkey_display(struct bt_conn *conn, unsigned int passkey) diff --git a/tests/bsim/bluetooth/samples/battery_service/src/peripheral_test.c b/tests/bsim/bluetooth/samples/battery_service/src/peripheral_test.c index 0d7c3a3fdb450..db6865341f60c 100644 --- a/tests/bsim/bluetooth/samples/battery_service/src/peripheral_test.c +++ b/tests/bsim/bluetooth/samples/battery_service/src/peripheral_test.c @@ -101,7 +101,7 @@ static void bt_ready(void) LOG_DBG("Peripheral Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { TEST_FAIL("Advertising failed to start (err %d)\n", err); return; From c6b0175a2c8dc5d253ba786d1264ed517059ea88 Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Tue, 1 Oct 2024 11:57:05 -0300 Subject: [PATCH 0417/4482] tests: wifi: esp32: Code improvement Change log level to fixed value coherent with macros used in the test (LOG_INF). Use context struct to better organize global variables and improve code readability. Signed-off-by: Raffael Rostagno --- tests/boards/espressif/wifi/src/main.c | 77 +++++++++++++------------- 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/tests/boards/espressif/wifi/src/main.c b/tests/boards/espressif/wifi/src/main.c index 0c7c4c7f92b8d..52a3d129cd595 100644 --- a/tests/boards/espressif/wifi/src/main.c +++ b/tests/boards/espressif/wifi/src/main.c @@ -13,7 +13,7 @@ #include #include -LOG_MODULE_REGISTER(wifi_test, CONFIG_NET_L2_ETHERNET_LOG_LEVEL); +LOG_MODULE_REGISTER(wifi_test, LOG_LEVEL_INF); #include "net_private.h" @@ -25,11 +25,13 @@ K_SEM_DEFINE(wifi_event, 0, 1); #define TEST_DATA "ICMP dummy data" -static struct net_if *iface; -static uint32_t scan_result; -static bool connecting; -static int result; -static struct net_mgmt_event_callback wifi_mgmt_cb; +static struct wifi_context { + struct net_if *iface; + uint32_t scan_result; + bool connecting; + int result; + struct net_mgmt_event_callback wifi_mgmt_cb; +} wifi_ctx; extern char *net_sprint_ll_addr_buf(const uint8_t *ll, uint8_t ll_len, char *buf, int buflen); @@ -39,9 +41,9 @@ static void wifi_scan_result(struct net_mgmt_event_callback *cb) uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; uint8_t ssid_print[WIFI_SSID_MAX_LEN + 1]; - scan_result++; + wifi_ctx.scan_result++; - if (scan_result == 1U) { + if (wifi_ctx.scan_result == 1U) { printk("\n%-4s | %-32s %-5s | %-13s | %-4s | %-15s | %-17s | %-8s\n", "Num", "SSID", "(len)", "Chan (Band)", "RSSI", "Security", "BSSID", "MFP"); } @@ -49,7 +51,7 @@ static void wifi_scan_result(struct net_mgmt_event_callback *cb) strncpy(ssid_print, entry->ssid, sizeof(ssid_print) - 1); ssid_print[sizeof(ssid_print) - 1] = '\0'; - printk("%-4d | %-32s %-5u | %-4u (%-6s) | %-4d | %-15s | %-17s | %-8s\n", scan_result, + printk("%-4d | %-32s %-5u | %-4u (%-6s) | %-4d | %-15s | %-17s | %-8s\n", wifi_ctx.scan_result, ssid_print, entry->ssid_length, entry->channel, wifi_band_txt(entry->band), entry->rssi, wifi_security_txt(entry->security), ((entry->mac_length) ? net_sprint_ll_addr_buf(entry->mac, WIFI_MAC_ADDR_LEN, @@ -62,10 +64,10 @@ static void wifi_connect_result(struct net_mgmt_event_callback *cb) { const struct wifi_status *status = (const struct wifi_status *)cb->info; - result = status->status; + wifi_ctx.result = status->status; - if (result) { - LOG_INF("Connection request failed (%d)", result); + if (wifi_ctx.result) { + LOG_INF("Connection request failed (%d)", wifi_ctx.result); } else { LOG_INF("Connected"); } @@ -75,17 +77,17 @@ static void wifi_disconnect_result(struct net_mgmt_event_callback *cb) { const struct wifi_status *status = (const struct wifi_status *)cb->info; - result = status->status; + wifi_ctx.result = status->status; - if (!connecting) { - if (result) { - LOG_INF("Disconnect failed (%d)", result); + if (!wifi_ctx.connecting) { + if (wifi_ctx.result) { + LOG_INF("Disconnect failed (%d)", wifi_ctx.result); } else { LOG_INF("Disconnected"); } } else { /* Disconnect event while connecting is a failed attempt */ - result = WIFI_STATUS_CONN_FAIL; + wifi_ctx.result = WIFI_STATUS_CONN_FAIL; } } @@ -126,7 +128,7 @@ static int icmp_event(struct net_icmp_ctx *ctx, struct net_pkt *pkt, struct net_ static int wifi_scan(void) { - int ret = net_mgmt(NET_REQUEST_WIFI_SCAN, iface, NULL, 0); + int ret = net_mgmt(NET_REQUEST_WIFI_SCAN, wifi_ctx.iface, NULL, 0); if (ret) { LOG_INF("Scan request failed with error: %d", ret); @@ -163,7 +165,7 @@ static int wifi_connect(void) params.security = WIFI_SECURITY_TYPE_NONE; #endif - ret = net_mgmt(NET_REQUEST_WIFI_CONNECT, iface, ¶ms, + ret = net_mgmt(NET_REQUEST_WIFI_CONNECT, wifi_ctx.iface, ¶ms, sizeof(struct wifi_connect_req_params)); if (ret) { @@ -180,7 +182,7 @@ static int wifi_disconnect(void) { int ret; - ret = net_mgmt(NET_REQUEST_WIFI_DISCONNECT, iface, NULL, 0); + ret = net_mgmt(NET_REQUEST_WIFI_DISCONNECT, wifi_ctx.iface, NULL, 0); if (ret) { LOG_INF("Disconnect request failed with error: %d", ret); @@ -194,12 +196,13 @@ static int wifi_state(void) { struct wifi_iface_status status = {0}; - net_mgmt(NET_REQUEST_WIFI_IFACE_STATUS, iface, &status, sizeof(struct wifi_iface_status)); + net_mgmt(NET_REQUEST_WIFI_IFACE_STATUS, wifi_ctx.iface, &status, + sizeof(struct wifi_iface_status)); return status.state; } -ZTEST(wifi, test_wifi_0_scan) +ZTEST(wifi, test_0_scan) { int ret; @@ -212,13 +215,13 @@ ZTEST(wifi, test_wifi_0_scan) LOG_INF("Scan done"); } -ZTEST(wifi, test_wifi_1_connect) +ZTEST(wifi, test_1_connect) { int ret; int retry = CONFIG_WIFI_CONNECT_ATTEMPTS; /* Manage connect retry as disconnect event may happen */ - connecting = true; + wifi_ctx.connecting = true; do { ret = wifi_connect(); @@ -227,7 +230,7 @@ ZTEST(wifi, test_wifi_1_connect) zassert_equal(k_sem_take(&wifi_event, K_SECONDS(CONFIG_WIFI_CONNECT_TIMEOUT)), 0, "Wifi connect timed out"); - if (result) { + if (wifi_ctx.result) { zassert(--retry, "Connect failed"); LOG_INF("Failed attempt, retry %d", CONFIG_WIFI_CONNECT_ATTEMPTS - retry); k_sleep(K_SECONDS(1)); @@ -236,7 +239,7 @@ ZTEST(wifi, test_wifi_1_connect) } } while (retry); - connecting = false; + wifi_ctx.connecting = false; /* Check interface state */ int state = wifi_state(); @@ -246,18 +249,18 @@ ZTEST(wifi, test_wifi_1_connect) zassert_equal(state, WIFI_STATE_COMPLETED, "Interface state check failed"); } -ZTEST(wifi, test_wifi_2_icmp) +ZTEST(wifi, test_2_icmp) { struct net_icmp_ping_params params; - struct net_icmp_ctx ctx; + struct net_icmp_ctx icmp_ctx; struct in_addr gw_addr_4; struct sockaddr_in dst4 = {0}; int ret; - gw_addr_4 = net_if_ipv4_get_gw(iface); + gw_addr_4 = net_if_ipv4_get_gw(wifi_ctx.iface); zassert_not_equal(gw_addr_4.s_addr, 0, "Gateway address is not set"); - ret = net_icmp_init_ctx(&ctx, NET_ICMPV4_ECHO_REPLY, 0, icmp_event); + ret = net_icmp_init_ctx(&icmp_ctx, NET_ICMPV4_ECHO_REPLY, 0, icmp_event); zassert_equal(ret, 0, "Cannot init ICMP (%d)", ret); dst4.sin_family = AF_INET; @@ -272,16 +275,16 @@ ZTEST(wifi, test_wifi_2_icmp) LOG_INF("Pinging the gateway..."); - ret = net_icmp_send_echo_request(&ctx, iface, (struct sockaddr *)&dst4, ¶ms, NULL); + ret = net_icmp_send_echo_request(&icmp_ctx, wifi_ctx.iface, (struct sockaddr *)&dst4, ¶ms, NULL); zassert_equal(ret, 0, "Cannot send ICMP echo request (%d)", ret); zassert_equal(k_sem_take(&wifi_event, K_SECONDS(CONFIG_WIFI_PING_TIMEOUT)), 0, "Gateway ping (ICMP) timed out"); - net_icmp_cleanup_ctx(&ctx); + net_icmp_cleanup_ctx(&icmp_ctx); } -ZTEST(wifi, test_wifi_3_disconnect) +ZTEST(wifi, test_3_disconnect) { int ret; @@ -291,15 +294,15 @@ ZTEST(wifi, test_wifi_3_disconnect) zassert_equal(k_sem_take(&wifi_event, K_SECONDS(CONFIG_WIFI_DISCONNECT_TIMEOUT)), 0, "Wifi disconnect timed out"); - zassert_equal(result, 0, "Disconnect failed"); + zassert_equal(wifi_ctx.result, 0, "Disconnect failed"); } static void *wifi_setup(void) { - iface = net_if_get_wifi_sta(); + wifi_ctx.iface = net_if_get_wifi_sta(); - net_mgmt_init_event_callback(&wifi_mgmt_cb, wifi_mgmt_event_handler, WIFI_MGMT_EVENTS); - net_mgmt_add_event_callback(&wifi_mgmt_cb); + net_mgmt_init_event_callback(&wifi_ctx.wifi_mgmt_cb, wifi_mgmt_event_handler, WIFI_MGMT_EVENTS); + net_mgmt_add_event_callback(&wifi_ctx.wifi_mgmt_cb); /* reset semaphore that tracks wifi events */ k_sem_reset(&wifi_event); From a7d6565f55ef25fece406093fdd1efc52a96d561 Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Tue, 1 Oct 2024 13:40:12 -0300 Subject: [PATCH 0418/4482] tests: wifi: esp32: ICMP check improvement Improve ICMP check by adding retry feature and data check. Signed-off-by: Raffael Rostagno --- tests/boards/espressif/wifi/Kconfig | 9 ++++- tests/boards/espressif/wifi/src/main.c | 51 ++++++++++++++++++++++---- 2 files changed, 51 insertions(+), 9 deletions(-) diff --git a/tests/boards/espressif/wifi/Kconfig b/tests/boards/espressif/wifi/Kconfig index bc0b105b28052..b252f682a6fa8 100644 --- a/tests/boards/espressif/wifi/Kconfig +++ b/tests/boards/espressif/wifi/Kconfig @@ -45,6 +45,13 @@ config WIFI_CONNECT_ATTEMPTS Number of attempts when connecting to a Wi-Fi network. If connection is not successful after all attempts, test will fail. +config WIFI_PING_ATTEMPTS + int "Wi-Fi Ping Attempts" + default 5 + help + Number of gateway ping attempts. + If timeout happens in all attempts, test will fail. + config WIFI_SCAN_TIMEOUT int "Wi-Fi Scan Timeout (in seconds)" default 30 @@ -68,7 +75,7 @@ config WIFI_DISCONNECT_TIMEOUT config WIFI_PING_TIMEOUT int "Gateway Ping Timeout (in seconds)" - default 10 + default 5 help Timeout duration for pinging the network gateway. If no reply is received within this time, test will fail. diff --git a/tests/boards/espressif/wifi/src/main.c b/tests/boards/espressif/wifi/src/main.c index 52a3d129cd595..bbccdb9b2a95f 100644 --- a/tests/boards/espressif/wifi/src/main.c +++ b/tests/boards/espressif/wifi/src/main.c @@ -13,6 +13,8 @@ #include #include +#include "icmpv4.h" + LOG_MODULE_REGISTER(wifi_test, LOG_LEVEL_INF); #include "net_private.h" @@ -51,9 +53,9 @@ static void wifi_scan_result(struct net_mgmt_event_callback *cb) strncpy(ssid_print, entry->ssid, sizeof(ssid_print) - 1); ssid_print[sizeof(ssid_print) - 1] = '\0'; - printk("%-4d | %-32s %-5u | %-4u (%-6s) | %-4d | %-15s | %-17s | %-8s\n", wifi_ctx.scan_result, - ssid_print, entry->ssid_length, entry->channel, wifi_band_txt(entry->band), - entry->rssi, wifi_security_txt(entry->security), + printk("%-4d | %-32s %-5u | %-4u (%-6s) | %-4d | %-15s | %-17s | %-8s\n", + wifi_ctx.scan_result, ssid_print, entry->ssid_length, entry->channel, + wifi_band_txt(entry->band), entry->rssi, wifi_security_txt(entry->security), ((entry->mac_length) ? net_sprint_ll_addr_buf(entry->mac, WIFI_MAC_ADDR_LEN, mac_string_buf, sizeof(mac_string_buf)) : ""), @@ -118,9 +120,28 @@ static int icmp_event(struct net_icmp_ctx *ctx, struct net_pkt *pkt, struct net_ struct net_icmp_hdr *icmp_hdr, void *user_data) { struct net_ipv4_hdr *ip_hdr = hdr->ipv4; + size_t hdr_offset = net_pkt_ip_hdr_len(pkt) + net_pkt_ip_opts_len(pkt) + + sizeof(struct net_icmp_hdr) + sizeof(struct net_icmpv4_echo_req); + size_t data_len = net_pkt_get_len(pkt) - hdr_offset; + char buf[50]; + + if (net_calc_chksum_icmpv4(pkt)) { + /* checksum error */ + wifi_ctx.result = -EIO; + goto sem_give; + } + + net_pkt_cursor_init(pkt); + net_pkt_skip(pkt, hdr_offset); + net_pkt_read(pkt, buf, MIN(data_len, sizeof(buf))); LOG_INF("Received ICMP reply from %s", net_sprint_ipv4_addr(&ip_hdr->src)); + LOG_INF("Payload: '%s'", buf); + /* payload check */ + wifi_ctx.result = strcmp(buf, TEST_DATA); + +sem_give: k_sem_give(&wifi_event); return 0; @@ -255,6 +276,7 @@ ZTEST(wifi, test_2_icmp) struct net_icmp_ctx icmp_ctx; struct in_addr gw_addr_4; struct sockaddr_in dst4 = {0}; + int retry = CONFIG_WIFI_PING_ATTEMPTS; int ret; gw_addr_4 = net_if_ipv4_get_gw(wifi_ctx.iface); @@ -275,11 +297,23 @@ ZTEST(wifi, test_2_icmp) LOG_INF("Pinging the gateway..."); - ret = net_icmp_send_echo_request(&icmp_ctx, wifi_ctx.iface, (struct sockaddr *)&dst4, ¶ms, NULL); - zassert_equal(ret, 0, "Cannot send ICMP echo request (%d)", ret); + do { + ret = net_icmp_send_echo_request(&icmp_ctx, wifi_ctx.iface, + (struct sockaddr *)&dst4, ¶ms, NULL); + zassert_equal(ret, 0, "Cannot send ICMP echo request (%d)", ret); + + int timeout = k_sem_take(&wifi_event, K_SECONDS(CONFIG_WIFI_PING_TIMEOUT)); + + if (timeout) { + zassert(--retry, "Gateway ping (ICMP) timed out on all attempts"); + LOG_INF("No reply, retry %d", CONFIG_WIFI_PING_ATTEMPTS - retry); + } else { + break; + } + } while (retry); - zassert_equal(k_sem_take(&wifi_event, K_SECONDS(CONFIG_WIFI_PING_TIMEOUT)), 0, - "Gateway ping (ICMP) timed out"); + /* check result */ + zassert_equal(wifi_ctx.result, 0, "ICMP data error"); net_icmp_cleanup_ctx(&icmp_ctx); } @@ -301,7 +335,8 @@ static void *wifi_setup(void) { wifi_ctx.iface = net_if_get_wifi_sta(); - net_mgmt_init_event_callback(&wifi_ctx.wifi_mgmt_cb, wifi_mgmt_event_handler, WIFI_MGMT_EVENTS); + net_mgmt_init_event_callback(&wifi_ctx.wifi_mgmt_cb, wifi_mgmt_event_handler, + WIFI_MGMT_EVENTS); net_mgmt_add_event_callback(&wifi_ctx.wifi_mgmt_cb); /* reset semaphore that tracks wifi events */ From 50ffc771bf089fc705da6f7e88fcc0b7aec6318f Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 4 Oct 2024 07:20:29 -0400 Subject: [PATCH 0419/4482] boards: add board full_name field Full name or description of a board is something we are missing in HWVv2. It is right now being added to yaml files parsed by twister. This should be generically available to tooling and documentation independently from twister. As we rework how twister parses board meta-data (#77250) and how we generate board documentation (#79160), this becomes neceassry. Moving the board full name/description from the twister yaml files to the board.yaml is something we can automate once the schema is agreed upon. Signed-off-by: Anas Nashif --- scripts/list_boards.py | 2 ++ scripts/schemas/board-schema.yml | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/scripts/list_boards.py b/scripts/list_boards.py index 6b810d0e286e7..4bc83df4652aa 100755 --- a/scripts/list_boards.py +++ b/scripts/list_boards.py @@ -93,6 +93,7 @@ class Board: name: str dir: Path hwm: str + full_name: str = None arch: str = None vendor: str = None revision_format: str = None @@ -223,6 +224,7 @@ def load_v2_boards(board_name, board_yml, systems): name=board['name'], dir=board_yml.parent, vendor=board.get('vendor'), + full_name=board.get('full_name'), revision_format=board.get('revision', {}).get('format'), revision_default=board.get('revision', {}).get('default'), revision_exact=board.get('revision', {}).get('exact', False), diff --git a/scripts/schemas/board-schema.yml b/scripts/schemas/board-schema.yml index 56ee4eab0344e..7a2afbd566de6 100644 --- a/scripts/schemas/board-schema.yml +++ b/scripts/schemas/board-schema.yml @@ -30,6 +30,10 @@ schema;board-schema: required: true type: str desc: Name of the board + full_name: + required: false + type: str + desc: Full name of the board. Typically set to the commercial name of the board. vendor: required: false type: str From 55489f5787fb04c2a6713ac5d1760012f4c19254 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 4 Oct 2024 08:20:00 -0400 Subject: [PATCH 0420/4482] boards: qemu_x86: add board description Use the description field for the full name/description of the boards. Signed-off-by: Anas Nashif --- boards/qemu/x86/board.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boards/qemu/x86/board.yml b/boards/qemu/x86/board.yml index 75d0cd6eb4b5b..dafcffba24f7a 100644 --- a/boards/qemu/x86/board.yml +++ b/boards/qemu/x86/board.yml @@ -1,6 +1,7 @@ boards: - name: qemu_x86 + full_name: 'QEMU Emulation for X86' socs: - name: atom variants: @@ -11,15 +12,18 @@ boards: - name: 'xip' - name: qemu_x86_lakemont + full_name: 'QEMU Emulation for X86 / Lakemont CPU' socs: - name: lakemont - name: qemu_x86_64 + full_name: 'QEMU Emulation for X86 64bit' socs: - name: atom variants: - name: 'nokpti' - name: qemu_x86_tiny + full_name: 'QEMU Emulation for X86 Minimal Configuration' socs: - name: atom From 621da32340bd17109bc5a43700222630d33975a8 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 4 Oct 2024 08:36:50 -0400 Subject: [PATCH 0421/4482] MAINTAINER: add board/hardware scripts into build system area Add board/hardware scripts and schema used by build system to relevant areas. Signed-off-by: Anas Nashif --- MAINTAINERS.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index b72fdb37a9ef1..a1be1a1a94e52 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -568,6 +568,9 @@ Build system: - misc/generated/ - snippets/ - modules/Kconfig.sysbuild + - scripts/list_boards.py + - scripts/list_hardware.py + - scripts/schemas/*-schema.yml labels: - "area: Build System" tests: From 6c6a1e550c4d2c917312abd9a0ece56a08b03ee0 Mon Sep 17 00:00:00 2001 From: Ioannis Damigos Date: Fri, 4 Oct 2024 13:58:56 +0300 Subject: [PATCH 0422/4482] da1469x: Remove CONFIG_PINCTRL from all defconfig files Remove CONFIG_PINCTRL from all defconfig files. Fixes #78619 Signed-off-by: Ioannis Damigos --- drivers/display/Kconfig.renesas_lcdc | 1 + drivers/i2c/Kconfig.smartbond | 1 + drivers/mipi_dbi/Kconfig.smartbond | 1 + drivers/serial/Kconfig.smartbond | 1 + drivers/spi/Kconfig.smartbond | 1 + soc/renesas/smartbond/Kconfig.defconfig | 3 --- 6 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/display/Kconfig.renesas_lcdc b/drivers/display/Kconfig.renesas_lcdc index 39605487cabeb..27ae14f0e5ed9 100644 --- a/drivers/display/Kconfig.renesas_lcdc +++ b/drivers/display/Kconfig.renesas_lcdc @@ -7,6 +7,7 @@ config DISPLAY_RENESAS_LCDC bool "Smartbond display controller driver" depends on DT_HAS_RENESAS_SMARTBOND_DISPLAY_ENABLED select DMA + select PINCTRL default y help Enable Smartbond display controller. diff --git a/drivers/i2c/Kconfig.smartbond b/drivers/i2c/Kconfig.smartbond index f2f8958d070a5..05ce5599e5ab9 100644 --- a/drivers/i2c/Kconfig.smartbond +++ b/drivers/i2c/Kconfig.smartbond @@ -5,5 +5,6 @@ config I2C_SMARTBOND bool "Renesas SmartBond(tm) I2C driver" default y depends on DT_HAS_RENESAS_SMARTBOND_I2C_ENABLED + select PINCTRL help Enable I2C driver for Renesas SmartBond(tm) DA1469x series MCU. diff --git a/drivers/mipi_dbi/Kconfig.smartbond b/drivers/mipi_dbi/Kconfig.smartbond index 0c83bee4c573b..c2bdab345f09b 100644 --- a/drivers/mipi_dbi/Kconfig.smartbond +++ b/drivers/mipi_dbi/Kconfig.smartbond @@ -6,6 +6,7 @@ config MIPI_DBI_SMARTBOND bool "Smartbond MIPI DBI host controller driver" depends on DT_HAS_RENESAS_SMARTBOND_MIPI_DBI_ENABLED + select PINCTRL default y help Enable Smartbond MIPI DBI host controller. diff --git a/drivers/serial/Kconfig.smartbond b/drivers/serial/Kconfig.smartbond index 2ea73a37fa110..5dd4f5d776140 100644 --- a/drivers/serial/Kconfig.smartbond +++ b/drivers/serial/Kconfig.smartbond @@ -8,5 +8,6 @@ config UART_SMARTBOND select SERIAL_HAS_DRIVER select SERIAL_SUPPORT_INTERRUPT select UART_INTERRUPT_DRIVEN if PM_DEVICE + select PINCTRL help Enable UART driver for Renesas SmartBond(tm) DA1469x series MCU. diff --git a/drivers/spi/Kconfig.smartbond b/drivers/spi/Kconfig.smartbond index 6198375003634..d1e91bd6654d5 100644 --- a/drivers/spi/Kconfig.smartbond +++ b/drivers/spi/Kconfig.smartbond @@ -5,6 +5,7 @@ config SPI_SMARTBOND bool "Renesas SmartBond(tm) SPI driver" default y depends on DT_HAS_RENESAS_SMARTBOND_SPI_ENABLED + select PINCTRL help Enables SPI driver for Renesas SmartBond(tm) DA1469x series MCU. diff --git a/soc/renesas/smartbond/Kconfig.defconfig b/soc/renesas/smartbond/Kconfig.defconfig index 0df71b16f2e56..926959c1f654b 100644 --- a/soc/renesas/smartbond/Kconfig.defconfig +++ b/soc/renesas/smartbond/Kconfig.defconfig @@ -5,7 +5,4 @@ if SOC_FAMILY_RENESAS_SMARTBOND rsource "*/Kconfig.defconfig" -config PINCTRL - default y - endif # SOC_FAMILY_RENESAS_SMARTBOND From 88374b07389fb25e9bd7265c0901032cacc0148c Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Fri, 4 Oct 2024 18:22:12 +0700 Subject: [PATCH 0423/4482] fs: nvs: streamline `rc` return logic Streamline the `rc` return logic in `nvs_flash_wrt_entry()`, `nvs_gc()` by directly returning `rc`, as the redundant conditional check and explicit return of 0 were unnecessary. Signed-off-by: Pisit Sawangvonganan --- subsys/fs/nvs/nvs.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/subsys/fs/nvs/nvs.c b/subsys/fs/nvs/nvs.c index 7922967f9963c..e45e93e19825d 100644 --- a/subsys/fs/nvs/nvs.c +++ b/subsys/fs/nvs/nvs.c @@ -467,11 +467,8 @@ static int nvs_flash_wrt_entry(struct nvs_fs *fs, uint16_t id, const void *data, nvs_ate_crc8_update(&entry); rc = nvs_flash_ate_wrt(fs, &entry); - if (rc) { - return rc; - } - return 0; + return rc; } /* end of flash routines */ @@ -744,10 +741,8 @@ static int nvs_gc(struct nvs_fs *fs) /* Erase the gc'ed sector */ rc = nvs_flash_erase_sector(fs, sec_addr); - if (rc) { - return rc; - } - return 0; + + return rc; } static int nvs_startup(struct nvs_fs *fs) @@ -997,7 +992,6 @@ int nvs_clear(struct nvs_fs *fs) int nvs_mount(struct nvs_fs *fs) { - int rc; struct flash_pages_info info; size_t write_block_size; @@ -1296,7 +1290,6 @@ ssize_t nvs_read(struct nvs_fs *fs, uint16_t id, void *data, size_t len) ssize_t nvs_calc_free_space(struct nvs_fs *fs) { - int rc; struct nvs_ate step_ate, wlk_ate; uint32_t step_addr, wlk_addr; From 8fc0aba4ae1146a7396645b2dc50fec2bcf6d495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 4 Oct 2024 07:19:20 +0200 Subject: [PATCH 0424/4482] logging: Add log_source_id helper function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are many places where source_id is retrieved and it depends on runtime filtering being enabled. So far it was all exposed but lets encapsulate that into a helper function. Signed-off-by: Krzysztof Chruściński --- include/zephyr/logging/log_core.h | 14 ++++++++++++++ subsys/logging/backends/log_multidomain_backend.c | 7 ++----- subsys/logging/frontends/log_frontend_dict_uart.c | 6 +----- subsys/logging/frontends/log_frontend_stmesp.c | 4 +--- subsys/logging/log_msg.c | 4 +--- subsys/logging/log_output_dict.c | 6 +----- subsys/logging/log_output_syst.c | 4 +--- tests/subsys/logging/log_api/src/mock_backend.c | 4 +--- tests/subsys/logging/log_api/src/mock_frontend.c | 4 +--- 9 files changed, 23 insertions(+), 30 deletions(-) diff --git a/include/zephyr/logging/log_core.h b/include/zephyr/logging/log_core.h index 42ef6e9906214..b6599cec2a384 100644 --- a/include/zephyr/logging/log_core.h +++ b/include/zephyr/logging/log_core.h @@ -493,6 +493,20 @@ static inline uint32_t log_dynamic_source_id(struct log_source_dynamic_data *dat sizeof(struct log_source_dynamic_data); } +/** @brief Get index of the log source based on the address of the associated data. + * + * @param source Address of the data structure (dynamic if runtime filtering is + * enabled and static otherwise). + * + * @return Source ID. + */ +static inline uint32_t log_source_id(const void *source) +{ + return IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) ? + log_dynamic_source_id((struct log_source_dynamic_data *)source) : + log_const_source_id((const struct log_source_const_data *)source); +} + /** @brief Dummy function to trigger log messages arguments type checking. */ static inline __printf_like(1, 2) void z_log_printf_arg_checker(const char *fmt, ...) diff --git a/subsys/logging/backends/log_multidomain_backend.c b/subsys/logging/backends/log_multidomain_backend.c index 5cf5087a60363..8db7dd713f51d 100644 --- a/subsys/logging/backends/log_multidomain_backend.c +++ b/subsys/logging/backends/log_multidomain_backend.c @@ -51,11 +51,8 @@ static void process(const struct log_backend *const backend, /* Update package len field in the message descriptor. */ out_log_msg->hdr.desc.package_len = fsc_plen; - out_log_msg->hdr.source = out_log_msg->hdr.source ? - (const void *)(IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) ? - log_dynamic_source_id((void *)out_log_msg->hdr.source) : - log_const_source_id((void *)out_log_msg->hdr.source)) : - (const void *)-1; + out_log_msg->hdr.source = (const void *)(out_log_msg->hdr.source ? + log_source_id(out_log_msg->hdr.source) : -1); /* Fill new package. */ fsc_plen = cbprintf_fsc_package(msg->log.data, msg->log.hdr.desc.package_len, diff --git a/subsys/logging/frontends/log_frontend_dict_uart.c b/subsys/logging/frontends/log_frontend_dict_uart.c index 41fae7a4e18fa..e45f29a72b7ca 100644 --- a/subsys/logging/frontends/log_frontend_dict_uart.c +++ b/subsys/logging/frontends/log_frontend_dict_uart.c @@ -233,11 +233,7 @@ static inline void hdr_fill(struct log_dict_output_normal_msg_hdr_t *hdr, hdr->package_len = desc.package_len; hdr->data_len = desc.data_len; hdr->timestamp = z_log_timestamp(); - hdr->source = (source != NULL) ? - (IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) ? - log_dynamic_source_id((void *)source) : - log_const_source_id((void *)source)) : - 0U; + hdr->source = (source != NULL) ? log_source_id(source) : 0U; } /* Handle logging message in synchronous manner, in panic mode. */ diff --git a/subsys/logging/frontends/log_frontend_stmesp.c b/subsys/logging/frontends/log_frontend_stmesp.c index 4042fac853c57..9ba444bcd1d99 100644 --- a/subsys/logging/frontends/log_frontend_stmesp.c +++ b/subsys/logging/frontends/log_frontend_stmesp.c @@ -304,9 +304,7 @@ static inline uint16_t get_channel(void) static inline int16_t get_source_id(const void *source) { if (source != NULL) { - return IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) - ? log_dynamic_source_id((void *)source) - : log_const_source_id(source); + return log_source_id(source); } return LOG_FRONTEND_STM_NO_SOURCE; diff --git a/subsys/logging/log_msg.c b/subsys/logging/log_msg.c index b2b1f5612385b..f9b760f1e58f3 100644 --- a/subsys/logging/log_msg.c +++ b/subsys/logging/log_msg.c @@ -409,9 +409,7 @@ int16_t log_msg_get_source_id(struct log_msg *msg) void *source = (void *)log_msg_get_source(msg); if (source != NULL) { - return IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) - ? log_dynamic_source_id(source) - : log_const_source_id(source); + return log_source_id(source); } return -1; diff --git a/subsys/logging/log_output_dict.c b/subsys/logging/log_output_dict.c index 79b99b3b15e96..152b564133c3d 100644 --- a/subsys/logging/log_output_dict.c +++ b/subsys/logging/log_output_dict.c @@ -38,11 +38,7 @@ void log_dict_output_msg_process(const struct log_output *output, output_hdr.data_len = msg->hdr.desc.data_len; output_hdr.timestamp = msg->hdr.timestamp; - output_hdr.source = (source != NULL) ? - (IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) ? - log_dynamic_source_id(source) : - log_const_source_id(source)) : - 0U; + output_hdr.source = (source != NULL) ? log_source_id(source) : 0U; buffer_write(output->func, (uint8_t *)&output_hdr, sizeof(output_hdr), (void *)output->control_block->ctx); diff --git a/subsys/logging/log_output_syst.c b/subsys/logging/log_output_syst.c index 34ca034ee12de..4532b18af29d3 100644 --- a/subsys/logging/log_output_syst.c +++ b/subsys/logging/log_output_syst.c @@ -795,9 +795,7 @@ void log_output_msg_syst_process(const struct log_output *output, void *source = (void *)log_msg_get_source(msg); if (source != NULL) { - source_id = IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) ? - log_dynamic_source_id(source) : - log_const_source_id(source); + source_id = log_source_id(source); } } diff --git a/tests/subsys/logging/log_api/src/mock_backend.c b/tests/subsys/logging/log_api/src/mock_backend.c index ab4d901c36906..e481f5e86ace2 100644 --- a/tests/subsys/logging/log_api/src/mock_backend.c +++ b/tests/subsys/logging/log_api/src/mock_backend.c @@ -157,9 +157,7 @@ static void process(const struct log_backend *const backend, } else if (source == NULL) { source_id = 0; } else { - source_id = IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) ? - log_dynamic_source_id((struct log_source_dynamic_data *)source) : - log_const_source_id((const struct log_source_const_data *)source); + source_id = log_source_id(source); } zassert_equal(source_id, exp->source_id, "source_id:%p (exp: %d)", diff --git a/tests/subsys/logging/log_api/src/mock_frontend.c b/tests/subsys/logging/log_api/src/mock_frontend.c index f74a441f294ce..390bd07abdb34 100644 --- a/tests/subsys/logging/log_api/src/mock_frontend.c +++ b/tests/subsys/logging/log_api/src/mock_frontend.c @@ -115,9 +115,7 @@ void log_frontend_msg(const void *source, if (desc.level == LOG_LEVEL_NONE) { source_id = (uintptr_t)source; } else { - source_id = IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) ? - log_dynamic_source_id((struct log_source_dynamic_data *)source) : - log_const_source_id((const struct log_source_const_data *)source); + source_id = log_source_id(source); } zassert_equal(source_id, exp_msg->source_id, "got: %d, exp: %d", From b2e61ef355cc2dcdb4adee0e10f7a9c634757ac5 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Fri, 4 Oct 2024 11:09:29 +0200 Subject: [PATCH 0425/4482] Bluetooth: BAP: Fix bad check in bt_audio_valid_qos_pref The checks did not properly take into account that the pref_pd_min and pref_pd_max could have valid 0 values. Signed-off-by: Emil Gydesen --- subsys/bluetooth/audio/bap_stream.c | 49 ++++++++++++++++++----------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/subsys/bluetooth/audio/bap_stream.c b/subsys/bluetooth/audio/bap_stream.c index a28f00a787cdf..9f3ae7984d143 100644 --- a/subsys/bluetooth/audio/bap_stream.c +++ b/subsys/bluetooth/audio/bap_stream.c @@ -298,29 +298,40 @@ bool bt_bap_valid_qos_pref(const struct bt_bap_qos_cfg_pref *qos_pref) return false; } - /* The absolute minimum and maximum values of pref_pd_min and pref_pd_max are implicitly - * checked using the bounds of pd_min and pd_max, so we can just compare the preferences - * to the min and max values that have been bound checked already - */ - if (!IN_RANGE(qos_pref->pref_pd_min, qos_pref->pd_min, qos_pref->pd_max)) { - LOG_DBG("Invalid combination of pref_pd_min %u, pd_min %u and pd_max: %u", - qos_pref->pref_pd_min, qos_pref->pd_min, qos_pref->pd_max); - - return false; - } + if (qos_pref->pref_pd_min != BT_AUDIO_PD_PREF_NONE) { + /* If pref_pd_min != BT_AUDIO_PD_PREF_NONE then pd_min <= pref_pd_min <= pd_max */ + if (!IN_RANGE(qos_pref->pref_pd_min, qos_pref->pd_min, qos_pref->pd_max)) { + LOG_DBG("Invalid combination of pref_pd_min %u, pd_min %u and pd_max: %u", + qos_pref->pref_pd_min, qos_pref->pd_min, qos_pref->pd_max); - if (qos_pref->pref_pd_max < qos_pref->pref_pd_min) { - LOG_DBG("Invalid combination of pref_pd_min %u and pref_pd_max: %u", - qos_pref->pref_pd_min, qos_pref->pref_pd_max); - - return false; + return false; + } } - if (!IN_RANGE(qos_pref->pref_pd_max, qos_pref->pd_min, qos_pref->pd_max)) { - LOG_DBG("Invalid combination of pref_pd_max %u, pd_min %u and pd_max: %u", - qos_pref->pref_pd_max, qos_pref->pd_min, qos_pref->pd_max); + if (qos_pref->pref_pd_max != BT_AUDIO_PD_PREF_NONE) { + /* If pref_pd_min == BT_AUDIO_PD_PREF_NONE then pd_min <= pref_pd_max <= pd_max + * + * If pref_pd_min != BT_AUDIO_PD_PREF_NONE then + * pd_min <= pref_pd_min <= pref_pd_max <= pd_max + */ + if (qos_pref->pref_pd_min == BT_AUDIO_PD_PREF_NONE) { + if (!IN_RANGE(qos_pref->pref_pd_max, qos_pref->pd_min, qos_pref->pd_max)) { + LOG_DBG("Invalid combination of pref_pd_max %u, pd_min %u and " + "pd_max: %u", + qos_pref->pref_pd_max, qos_pref->pd_min, qos_pref->pd_max); - return false; + return false; + } + } else { + if (!IN_RANGE(qos_pref->pref_pd_max, qos_pref->pref_pd_min, + qos_pref->pd_max)) { + LOG_DBG("Invalid combination of pref_pd_max %u, pref_pd_min %u and " + "pd_max: %u", + qos_pref->pref_pd_max, qos_pref->pd_min, qos_pref->pd_max); + + return false; + } + } } return true; From 0fdfad84ded28292c6c8cf78c689b59d3c5b8eb7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Wed, 2 Oct 2024 17:12:36 +0200 Subject: [PATCH 0426/4482] snippets: Add Wi-Fi IPv4 snippet Introduce a snippet for configuring IPv4 over Wi-Fi support in networking samples. Signed-off-by: Robert Lubos --- snippets/wifi-ipv4/README.rst | 28 ++++++++++++++++++++++++++++ snippets/wifi-ipv4/snippet.yml | 3 +++ snippets/wifi-ipv4/wifi-ipv4.conf | 31 +++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 snippets/wifi-ipv4/README.rst create mode 100644 snippets/wifi-ipv4/snippet.yml create mode 100644 snippets/wifi-ipv4/wifi-ipv4.conf diff --git a/snippets/wifi-ipv4/README.rst b/snippets/wifi-ipv4/README.rst new file mode 100644 index 0000000000000..89139c56d7905 --- /dev/null +++ b/snippets/wifi-ipv4/README.rst @@ -0,0 +1,28 @@ +.. _snippet-wifi-ipv4: + +Wi-Fi IPv4 Snippet (wifi-ipv4) +############################## + +.. code-block:: console + + west build -S wifi-ipv4 [...] + +Overview +******** + +This snippet enables IPv4 Wi-Fi support in supported networking samples. +The sample execution is postponed until Wi-Fi connectivity is established. + +Use Wi-Fi shell to connect to the Wi-Fi network: + +.. code-block:: console + + wifi connect -s -k -p + +Requirements +************ + +Hardware support for: + +- :kconfig:option:`CONFIG_WIFI` +- :kconfig:option:`CONFIG_WIFI_USE_NATIVE_NETWORKING` diff --git a/snippets/wifi-ipv4/snippet.yml b/snippets/wifi-ipv4/snippet.yml new file mode 100644 index 0000000000000..cde1bb348d8a6 --- /dev/null +++ b/snippets/wifi-ipv4/snippet.yml @@ -0,0 +1,3 @@ +name: wifi-ipv4 +append: + EXTRA_CONF_FILE: wifi-ipv4.conf diff --git a/snippets/wifi-ipv4/wifi-ipv4.conf b/snippets/wifi-ipv4/wifi-ipv4.conf new file mode 100644 index 0000000000000..59f4eafc2222a --- /dev/null +++ b/snippets/wifi-ipv4/wifi-ipv4.conf @@ -0,0 +1,31 @@ +# Wi-Fi +CONFIG_WIFI=y +CONFIG_NET_L2_ETHERNET=y +CONFIG_WIFI_NM_WPA_SUPPLICANT=y + +# Make sure there is enough resources for supplicant and most of the samples +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_ZVFS_OPEN_MAX=24 +CONFIG_NET_MAX_CONN=10 +CONFIG_NET_SOCKETS_POLL_MAX=9 + +# IPv4 only for now +CONFIG_NET_IPV6=n +CONFIG_NET_CONFIG_NEED_IPV6=n +CONFIG_NET_IPV4=y + +# DHCPv4 +CONFIG_NET_DHCPV4=y +CONFIG_NET_CONFIG_MY_IPV4_ADDR="" +CONFIG_NET_CONFIG_INIT_TIMEOUT=0 + +# DNS +CONFIG_DNS_RESOLVER=y + +# Connection manager +CONFIG_NET_CONNECTION_MANAGER=y + +# Wi-Fi shell +CONFIG_NET_SHELL=y +CONFIG_NET_L2_WIFI_SHELL=y +CONFIG_SHELL_STACK_SIZE=5200 From fd2fa54aa755a5c0f3d8b7a2075d804f325ed6ea Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Wed, 2 Oct 2024 17:13:06 +0200 Subject: [PATCH 0427/4482] samples: net: Add Wi-Fi snippet support for networking samples Make use of wifi-ipv4 snippet in several networking samples. Signed-off-by: Robert Lubos --- samples/net/common/common.cmake | 3 ++ samples/net/common/net_sample_common.c | 42 +++++++++++++++++++ samples/net/common/net_sample_common.h | 11 +++++ samples/net/dns_resolve/CMakeLists.txt | 2 + samples/net/dns_resolve/README.rst | 6 +++ samples/net/dns_resolve/sample.yaml | 6 +++ samples/net/dns_resolve/src/main.c | 4 ++ samples/net/ipv4_autoconf/CMakeLists.txt | 2 + samples/net/ipv4_autoconf/README.rst | 6 +++ samples/net/ipv4_autoconf/sample.yaml | 20 +++++---- samples/net/ipv4_autoconf/src/main.c | 4 ++ samples/net/lwm2m_client/Kconfig | 2 + samples/net/lwm2m_client/src/lwm2m-client.c | 9 ++-- samples/net/mdns_responder/README.rst | 6 +++ samples/net/mdns_responder/sample.yaml | 15 +++++-- samples/net/mdns_responder/src/main.c | 4 ++ samples/net/mqtt_publisher/CMakeLists.txt | 2 + samples/net/mqtt_publisher/README.rst | 6 +++ samples/net/mqtt_publisher/sample.yaml | 6 +++ samples/net/mqtt_publisher/src/main.c | 3 ++ .../net/sockets/coap_server/CMakeLists.txt | 2 + samples/net/sockets/coap_server/README.rst | 6 +++ samples/net/sockets/coap_server/prj.conf | 2 + samples/net/sockets/coap_server/sample.yaml | 14 +++++-- samples/net/sockets/coap_server/src/main.c | 6 +++ samples/net/sockets/echo_async/README.rst | 6 +++ samples/net/sockets/echo_async/sample.yaml | 6 +++ .../net/sockets/echo_async/src/socket_echo.c | 4 ++ samples/net/sockets/http_get/README.rst | 6 +++ samples/net/sockets/http_get/sample.yaml | 6 +++ samples/net/sockets/http_get/src/http_get.c | 4 ++ .../net/sockets/sntp_client/CMakeLists.txt | 2 + samples/net/sockets/sntp_client/README.rst | 6 +++ samples/net/sockets/sntp_client/sample.yaml | 6 +++ samples/net/sockets/sntp_client/src/main.c | 3 ++ samples/net/syslog_net/CMakeLists.txt | 2 + samples/net/syslog_net/README.rst | 6 +++ samples/net/syslog_net/sample.yaml | 6 +++ samples/net/syslog_net/src/main.c | 4 ++ samples/net/telnet/CMakeLists.txt | 2 + samples/net/telnet/README.rst | 6 +++ samples/net/telnet/sample.yaml | 17 +++++--- samples/net/telnet/src/telnet.c | 4 ++ 43 files changed, 259 insertions(+), 26 deletions(-) create mode 100644 samples/net/common/net_sample_common.c create mode 100644 samples/net/common/net_sample_common.h diff --git a/samples/net/common/common.cmake b/samples/net/common/common.cmake index b17d6493819ac..c0e0e51117940 100644 --- a/samples/net/common/common.cmake +++ b/samples/net/common/common.cmake @@ -1,3 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 # Common routines used in net samples + +target_include_directories(app PRIVATE ${ZEPHYR_BASE}/samples/net/common/) +target_sources(app PRIVATE $ENV{ZEPHYR_BASE}/samples/net/common/net_sample_common.c) diff --git a/samples/net/common/net_sample_common.c b/samples/net/common/net_sample_common.c new file mode 100644 index 0000000000000..1e744f178b514 --- /dev/null +++ b/samples/net/common/net_sample_common.c @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Nordic Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +LOG_MODULE_REGISTER(net_samples_common, LOG_LEVEL_DBG); + +#include + +#if defined(CONFIG_NET_CONNECTION_MANAGER) +#define L4_EVENT_MASK (NET_EVENT_L4_CONNECTED | NET_EVENT_L4_DISCONNECTED) + +static struct net_mgmt_event_callback l4_cb; +static K_SEM_DEFINE(network_connected, 0, 1); + +static void l4_event_handler(struct net_mgmt_event_callback *cb, uint32_t event, + struct net_if *iface) +{ + switch (event) { + case NET_EVENT_L4_CONNECTED: + LOG_INF("Network connectivity established and IP address assigned"); + k_sem_give(&network_connected); + break; + case NET_EVENT_L4_DISCONNECTED: + break; + default: + break; + } +} + +void wait_for_network(void) +{ + net_mgmt_init_event_callback(&l4_cb, l4_event_handler, L4_EVENT_MASK); + net_mgmt_add_event_callback(&l4_cb); + + LOG_INF("Waiting for network..."); + + k_sem_take(&network_connected, K_FOREVER); +} +#endif /* CONFIG_NET_CONNECTION_MANAGER */ diff --git a/samples/net/common/net_sample_common.h b/samples/net/common/net_sample_common.h new file mode 100644 index 0000000000000..f44e852a0da30 --- /dev/null +++ b/samples/net/common/net_sample_common.h @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2024 Nordic Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#if defined(CONFIG_NET_CONNECTION_MANAGER) +void wait_for_network(void); +#else +static inline void wait_for_network(void) { } +#endif /* CONFIG_NET_CONNECTION_MANAGER */ diff --git a/samples/net/dns_resolve/CMakeLists.txt b/samples/net/dns_resolve/CMakeLists.txt index 1ac07c37fd2e4..1a86338826431 100644 --- a/samples/net/dns_resolve/CMakeLists.txt +++ b/samples/net/dns_resolve/CMakeLists.txt @@ -6,3 +6,5 @@ project(dns_resolve) FILE(GLOB app_sources src/*.c) target_sources(app PRIVATE ${app_sources}) + +include(${ZEPHYR_BASE}/samples/net/common/common.cmake) diff --git a/samples/net/dns_resolve/README.rst b/samples/net/dns_resolve/README.rst index e566fa44bd14f..b741b827ac926 100644 --- a/samples/net/dns_resolve/README.rst +++ b/samples/net/dns_resolve/README.rst @@ -155,3 +155,9 @@ Open a terminal window and type: Use 'dmesg' to find the right USB device. Once the binary is loaded into the FRDM board, press the RESET button. + +Wi-Fi +===== + +The IPv4 Wi-Fi support can be enabled in the sample with +:ref:`Wi-Fi snippet `. diff --git a/samples/net/dns_resolve/sample.yaml b/samples/net/dns_resolve/sample.yaml index cafc9beac83f5..7cf510d0ba430 100644 --- a/samples/net/dns_resolve/sample.yaml +++ b/samples/net/dns_resolve/sample.yaml @@ -23,3 +23,9 @@ tests: - CONFIG_LLMNR_RESOLVER=y - CONFIG_NET_DHCPV4=y tags: llmnr + sample.net.dns_resolve.wifi.nrf70dk: + extra_args: + - SNIPPET=wifi-ipv4 + - CONFIG_NRF_WIFI_BUILD_ONLY_MODE=y + platform_allow: + - nrf7002dk/nrf5340/cpuapp diff --git a/samples/net/dns_resolve/src/main.c b/samples/net/dns_resolve/src/main.c index 5eec113ead3e3..23e5645d0b457 100644 --- a/samples/net/dns_resolve/src/main.c +++ b/samples/net/dns_resolve/src/main.c @@ -17,6 +17,8 @@ LOG_MODULE_REGISTER(net_dns_resolve_client_sample, LOG_LEVEL_DBG); #include #include +#include "net_sample_common.h" + #if defined(CONFIG_MDNS_RESOLVER) #if defined(CONFIG_NET_IPV4) static struct k_work_delayable mdns_ipv4_timer; @@ -395,6 +397,8 @@ int main(void) LOG_INF("Starting DNS resolve sample"); + wait_for_network(); + setup_ipv4(iface); setup_dhcpv4(iface); diff --git a/samples/net/ipv4_autoconf/CMakeLists.txt b/samples/net/ipv4_autoconf/CMakeLists.txt index cb0f8e1b9c679..8bcf3bfd244de 100644 --- a/samples/net/ipv4_autoconf/CMakeLists.txt +++ b/samples/net/ipv4_autoconf/CMakeLists.txt @@ -6,3 +6,5 @@ project(ipv4_autoconf) FILE(GLOB app_sources src/*.c) target_sources(app PRIVATE ${app_sources}) + +include(${ZEPHYR_BASE}/samples/net/common/common.cmake) diff --git a/samples/net/ipv4_autoconf/README.rst b/samples/net/ipv4_autoconf/README.rst index 614f2c6404790..f9a8f63363bd8 100644 --- a/samples/net/ipv4_autoconf/README.rst +++ b/samples/net/ipv4_autoconf/README.rst @@ -69,3 +69,9 @@ type: .. code-block:: console $ ping -I eth1 169.254.218.128 + +Wi-Fi +===== + +The IPv4 Wi-Fi support can be enabled in the sample with +:ref:`Wi-Fi snippet `. diff --git a/samples/net/ipv4_autoconf/sample.yaml b/samples/net/ipv4_autoconf/sample.yaml index 88e39ec235600..eb9c06ae18e90 100644 --- a/samples/net/ipv4_autoconf/sample.yaml +++ b/samples/net/ipv4_autoconf/sample.yaml @@ -1,17 +1,23 @@ common: harness: net + depends_on: netif tags: - net - ipv4_autoconf - platform_allow: - - qemu_x86 - - native_sim - - native_sim/native/64 - integration_platforms: - - native_sim sample: description: Test IPv4 autoconf functionality name: IPv4 autoconf sample app tests: sample.net.ipv4_autoconf: - depends_on: netif + platform_allow: + - qemu_x86 + - native_sim + - native_sim/native/64 + integration_platforms: + - native_sim + sample.net.ipv4_autoconf.wifi.nrf70dk: + extra_args: + - SNIPPET=wifi-ipv4 + - CONFIG_NRF_WIFI_BUILD_ONLY_MODE=y + platform_allow: + - nrf7002dk/nrf5340/cpuapp diff --git a/samples/net/ipv4_autoconf/src/main.c b/samples/net/ipv4_autoconf/src/main.c index b9f9c00379dfb..c4e93105cf73b 100644 --- a/samples/net/ipv4_autoconf/src/main.c +++ b/samples/net/ipv4_autoconf/src/main.c @@ -20,6 +20,8 @@ LOG_MODULE_REGISTER(net_ipv4_autoconf_sample, LOG_LEVEL_DBG); #include #include +#include "net_sample_common.h" + static struct net_mgmt_event_callback mgmt_cb; static void handler(struct net_mgmt_event_callback *cb, @@ -60,6 +62,8 @@ int main(void) { LOG_INF("Run ipv4 autoconf client"); + wait_for_network(); + net_mgmt_init_event_callback(&mgmt_cb, handler, NET_EVENT_IPV4_ADDR_ADD); net_mgmt_add_event_callback(&mgmt_cb); diff --git a/samples/net/lwm2m_client/Kconfig b/samples/net/lwm2m_client/Kconfig index 2037d281ce0c3..1bc4b6c49b008 100644 --- a/samples/net/lwm2m_client/Kconfig +++ b/samples/net/lwm2m_client/Kconfig @@ -29,6 +29,8 @@ endif config LWM2M_APP_SERVER string "LwM2M server address" + default "coap://leshan.eclipseprojects.io:5683" if (WIFI && !LWM2M_DTLS_SUPPORT) + default "coaps://leshan.eclipseprojects.io:5684" if (WIFI && LWM2M_DTLS_SUPPORT) default "coap://192.0.2.2:5683" if !LWM2M_DTLS_SUPPORT default "coaps://192.0.2.2:5684" if (LWM2M_DTLS_SUPPORT && !LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP) default "coaps://192.0.2.2:5784" if (LWM2M_DTLS_SUPPORT && LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP) diff --git a/samples/net/lwm2m_client/src/lwm2m-client.c b/samples/net/lwm2m_client/src/lwm2m-client.c index cea4f92ce8c1d..e59b4e9482a3d 100644 --- a/samples/net/lwm2m_client/src/lwm2m-client.c +++ b/samples/net/lwm2m_client/src/lwm2m-client.c @@ -385,12 +385,9 @@ int main(void) return ret; } - ret = conn_mgr_if_connect(net_if_get_default()); - /* Ignore errors from interfaces not requiring connectivity */ - if (ret == 0) { - LOG_INF("Connecting to network"); - k_sem_take(&network_connected_sem, K_FOREVER); - } + (void)conn_mgr_if_connect(net_if_get_default()); + + k_sem_take(&network_connected_sem, K_FOREVER); } ret = lwm2m_setup(); diff --git a/samples/net/mdns_responder/README.rst b/samples/net/mdns_responder/README.rst index 015f6c8b4444f..bdb652592822c 100644 --- a/samples/net/mdns_responder/README.rst +++ b/samples/net/mdns_responder/README.rst @@ -74,3 +74,9 @@ If the query is successful, then the following information is printed: address = [192.0.2.1] port = [4242] txt = [] + +Wi-Fi +===== + +The IPv4 Wi-Fi support can be enabled in the sample with +:ref:`Wi-Fi snippet `. diff --git a/samples/net/mdns_responder/sample.yaml b/samples/net/mdns_responder/sample.yaml index dff79845d7515..31b12260d0f99 100644 --- a/samples/net/mdns_responder/sample.yaml +++ b/samples/net/mdns_responder/sample.yaml @@ -1,13 +1,20 @@ +common: + harness: net + tags: + - net + - mdns sample: name: mDNS responder tests: sample.net.mdns_responder: - harness: net platform_allow: - qemu_x86 - qemu_cortex_m3 integration_platforms: - qemu_x86 - tags: - - net - - mdns + sample.net.mdns_responder.wifi.nrf70dk: + extra_args: + - SNIPPET=wifi-ipv4 + - CONFIG_NRF_WIFI_BUILD_ONLY_MODE=y + platform_allow: + - nrf7002dk/nrf5340/cpuapp diff --git a/samples/net/mdns_responder/src/main.c b/samples/net/mdns_responder/src/main.c index 112f9e9393167..d6eea7c8337d0 100644 --- a/samples/net/mdns_responder/src/main.c +++ b/samples/net/mdns_responder/src/main.c @@ -12,6 +12,8 @@ LOG_MODULE_REGISTER(net_mdns_responder_sample, LOG_LEVEL_DBG); #include #include +#include "net_sample_common.h" + extern void service(void); #if defined(CONFIG_NET_VLAN) @@ -34,6 +36,8 @@ static inline int init_vlan(void) */ int main(void) { + wait_for_network(); + LOG_INF("Waiting mDNS queries..."); init_vlan(); service(); diff --git a/samples/net/mqtt_publisher/CMakeLists.txt b/samples/net/mqtt_publisher/CMakeLists.txt index 4c6e3c0ef0cfa..df6501079059d 100644 --- a/samples/net/mqtt_publisher/CMakeLists.txt +++ b/samples/net/mqtt_publisher/CMakeLists.txt @@ -7,3 +7,5 @@ project(mqtt_publisher) FILE(GLOB app_sources src/*.c) target_sources(app PRIVATE ${app_sources}) + +include(${ZEPHYR_BASE}/samples/net/common/common.cmake) diff --git a/samples/net/mqtt_publisher/README.rst b/samples/net/mqtt_publisher/README.rst index 6c75f2f2d7ea8..081d3a3262591 100644 --- a/samples/net/mqtt_publisher/README.rst +++ b/samples/net/mqtt_publisher/README.rst @@ -372,3 +372,9 @@ This is the output from the MQTT broker: 1485663807: Received PUBREL from zephyr_publisher (Mid: 49829) 1485663807: Sending PUBCOMP to zephyr_publisher (Mid: 49829) 1485663808: Received DISCONNECT from zephyr_publisher + +Wi-Fi +===== + +The IPv4 Wi-Fi support can be enabled in the sample with +:ref:`Wi-Fi snippet `. diff --git a/samples/net/mqtt_publisher/sample.yaml b/samples/net/mqtt_publisher/sample.yaml index 5d29a7e46a851..8d3662fe0bf0b 100644 --- a/samples/net/mqtt_publisher/sample.yaml +++ b/samples/net/mqtt_publisher/sample.yaml @@ -28,3 +28,9 @@ tests: - net - mqtt - bluetooth + sample.net.mqtt_publisher.wifi.nrf70dk: + extra_args: + - SNIPPET=wifi-ipv4 + - CONFIG_NRF_WIFI_BUILD_ONLY_MODE=y + platform_allow: + - nrf7002dk/nrf5340/cpuapp diff --git a/samples/net/mqtt_publisher/src/main.c b/samples/net/mqtt_publisher/src/main.c index 231c9c2b2f36c..faa96e33b5c05 100644 --- a/samples/net/mqtt_publisher/src/main.c +++ b/samples/net/mqtt_publisher/src/main.c @@ -16,6 +16,7 @@ LOG_MODULE_REGISTER(net_mqtt_publisher_sample, LOG_LEVEL_DBG); #include #include "config.h" +#include "net_sample_common.h" #if defined(CONFIG_USERSPACE) #include @@ -516,6 +517,8 @@ static K_HEAP_DEFINE(app_mem_pool, 1024 * 2); int main(void) { + wait_for_network(); + #if defined(CONFIG_MQTT_LIB_TLS) int rc; diff --git a/samples/net/sockets/coap_server/CMakeLists.txt b/samples/net/sockets/coap_server/CMakeLists.txt index 418e31e7d2fdd..5b9a0beeb197b 100644 --- a/samples/net/sockets/coap_server/CMakeLists.txt +++ b/samples/net/sockets/coap_server/CMakeLists.txt @@ -16,3 +16,5 @@ zephyr_iterable_section( NAME coap_resource_coap_server GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) + +include(${ZEPHYR_BASE}/samples/net/common/common.cmake) diff --git a/samples/net/sockets/coap_server/README.rst b/samples/net/sockets/coap_server/README.rst index 9aadbea5fc50a..64bb1a687dcc7 100644 --- a/samples/net/sockets/coap_server/README.rst +++ b/samples/net/sockets/coap_server/README.rst @@ -60,3 +60,9 @@ prj_cc2520.conf configuration file enabling IEEE 802.15.4. .. _`net-tools`: https://github.com/zephyrproject-rtos/net-tools .. _`libcoap`: https://github.com/obgm/libcoap + +Wi-Fi +===== + +The IPv4 Wi-Fi support can be enabled in the sample with +:ref:`Wi-Fi snippet `. diff --git a/samples/net/sockets/coap_server/prj.conf b/samples/net/sockets/coap_server/prj.conf index 470caa6b44834..94ac1abd5cf59 100644 --- a/samples/net/sockets/coap_server/prj.conf +++ b/samples/net/sockets/coap_server/prj.conf @@ -13,6 +13,8 @@ CONFIG_COAP=y CONFIG_COAP_SERVER=y CONFIG_COAP_SERVER_WELL_KNOWN_CORE=y CONFIG_COAP_WELL_KNOWN_BLOCK_WISE=n +CONFIG_COAP_EXTENDED_OPTIONS_LEN=y +CONFIG_COAP_EXTENDED_OPTIONS_LEN_VALUE=40 # Kernel options CONFIG_ENTROPY_GENERATOR=y diff --git a/samples/net/sockets/coap_server/sample.yaml b/samples/net/sockets/coap_server/sample.yaml index 2fcf9b6328714..9f7d5de78d765 100644 --- a/samples/net/sockets/coap_server/sample.yaml +++ b/samples/net/sockets/coap_server/sample.yaml @@ -1,14 +1,20 @@ common: + harness: net + tags: + - net + - socket filter: CONFIG_FULL_LIBC_SUPPORTED and not CONFIG_NATIVE_LIBC sample: description: BSD Sockets API CoAP server example name: socket_coap_server tests: sample.net.sockets.coap_server: - harness: net - tags: - - net - - socket platform_allow: - native_sim - qemu_x86 + sample.net.sockets.coap_server.wifi.nrf70dk: + extra_args: + - SNIPPET=wifi-ipv4 + - CONFIG_NRF_WIFI_BUILD_ONLY_MODE=y + platform_allow: + - nrf7002dk/nrf5340/cpuapp diff --git a/samples/net/sockets/coap_server/src/main.c b/samples/net/sockets/coap_server/src/main.c index 4f476511b2cfc..e5fc6dac80b10 100644 --- a/samples/net/sockets/coap_server/src/main.c +++ b/samples/net/sockets/coap_server/src/main.c @@ -14,6 +14,8 @@ LOG_MODULE_REGISTER(net_coap_service_sample, LOG_LEVEL_DBG); #include "ipv6.h" #endif +#include "net_sample_common.h" + static const uint16_t coap_port = 5683; #ifdef CONFIG_NET_IPV6 @@ -70,6 +72,8 @@ static int join_coap_multicast_group(void) int main(void) { + wait_for_network(); + return join_coap_multicast_group(); } @@ -77,6 +81,8 @@ int main(void) int main(void) { + wait_for_network(); + return 0; } diff --git a/samples/net/sockets/echo_async/README.rst b/samples/net/sockets/echo_async/README.rst index 826b3ffbda5a4..1b9beccdbcb52 100644 --- a/samples/net/sockets/echo_async/README.rst +++ b/samples/net/sockets/echo_async/README.rst @@ -49,6 +49,12 @@ another terminal window and run the same telnet command as above. The sample supports up to three connected clients, but this can be adjusted by changing ``NUM_FDS`` defined in the source code. +Wi-Fi +===== + +The IPv4 Wi-Fi support can be enabled in the sample with +:ref:`Wi-Fi snippet `. + Running application on POSIX Host ================================= diff --git a/samples/net/sockets/echo_async/sample.yaml b/samples/net/sockets/echo_async/sample.yaml index 39b33bd316501..811f2115c57b8 100644 --- a/samples/net/sockets/echo_async/sample.yaml +++ b/samples/net/sockets/echo_async/sample.yaml @@ -12,3 +12,9 @@ tests: sample.net.sockets.echo_async: extra_configs: - CONFIG_POSIX_API=y + sample.net.sockets.echo_async.wifi.nrf70dk: + extra_args: + - SNIPPET=wifi-ipv4 + - CONFIG_NRF_WIFI_BUILD_ONLY_MODE=y + platform_allow: + - nrf7002dk/nrf5340/cpuapp diff --git a/samples/net/sockets/echo_async/src/socket_echo.c b/samples/net/sockets/echo_async/src/socket_echo.c index 33dadfbf9e7c0..b38eb62c00175 100644 --- a/samples/net/sockets/echo_async/src/socket_echo.c +++ b/samples/net/sockets/echo_async/src/socket_echo.c @@ -26,6 +26,8 @@ #include #include +#include "net_sample_common.h" + #ifdef CONFIG_NET_IPV6 #define USE_IPV6 #endif @@ -128,6 +130,8 @@ int main(void) }; #endif + wait_for_network(); + #if !defined(USE_IPV6) || !(CONFIG_SOC_SERIES_CC32XX) serv4 = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (serv4 < 0) { diff --git a/samples/net/sockets/http_get/README.rst b/samples/net/sockets/http_get/README.rst index 09bfb2050d164..bf2f058eb4dae 100644 --- a/samples/net/sockets/http_get/README.rst +++ b/samples/net/sockets/http_get/README.rst @@ -69,6 +69,12 @@ Note, that TLS support in the sample depends on non-posix, TLS socket functionality. Therefore, it is only possible to run TLS in this sample on Zephyr. +Wi-Fi +===== + +The IPv4 Wi-Fi support can be enabled in the sample with +:ref:`Wi-Fi snippet `. + Running application on POSIX Host ================================= diff --git a/samples/net/sockets/http_get/sample.yaml b/samples/net/sockets/http_get/sample.yaml index 095ea8564b56a..9e5ad9fc41866 100644 --- a/samples/net/sockets/http_get/sample.yaml +++ b/samples/net/sockets/http_get/sample.yaml @@ -55,3 +55,9 @@ tests: - native_sim - native_sim/native/64 extra_args: OVERLAY_CONFIG="overlay-nsos.conf;overlay-tls.conf" + sample.net.sockets.http_get.wifi.nrf70dk: + extra_args: + - SNIPPET=wifi-ipv4 + - CONFIG_NRF_WIFI_BUILD_ONLY_MODE=y + platform_allow: + - nrf7002dk/nrf5340/cpuapp diff --git a/samples/net/sockets/http_get/src/http_get.c b/samples/net/sockets/http_get/src/http_get.c index c6d16b53461cb..b4ad0ff8410ce 100644 --- a/samples/net/sockets/http_get/src/http_get.c +++ b/samples/net/sockets/http_get/src/http_get.c @@ -25,6 +25,8 @@ #include "ca_certificate.h" #endif +#include "net_sample_common.h" + #endif /* HTTP server to connect to */ @@ -61,6 +63,8 @@ int main(void) struct addrinfo *res; int st, sock; + wait_for_network(); + #if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS) tls_credential_add(CA_CERTIFICATE_TAG, TLS_CREDENTIAL_CA_CERTIFICATE, ca_certificate, sizeof(ca_certificate)); diff --git a/samples/net/sockets/sntp_client/CMakeLists.txt b/samples/net/sockets/sntp_client/CMakeLists.txt index 3d23993968ba5..b42a3549dd653 100644 --- a/samples/net/sockets/sntp_client/CMakeLists.txt +++ b/samples/net/sockets/sntp_client/CMakeLists.txt @@ -6,3 +6,5 @@ project(sntp_client) FILE(GLOB app_sources src/*.c) target_sources(app PRIVATE ${app_sources}) + +include(${ZEPHYR_BASE}/samples/net/common/common.cmake) diff --git a/samples/net/sockets/sntp_client/README.rst b/samples/net/sockets/sntp_client/README.rst index f9a1aacd4b8ff..72c068778485f 100644 --- a/samples/net/sockets/sntp_client/README.rst +++ b/samples/net/sockets/sntp_client/README.rst @@ -28,3 +28,9 @@ This sample can be built and executed on QEMU or native_sim board as described in :ref:`networking_with_qemu`. .. _`net-tools`: https://github.com/zephyrproject-rtos/net-tools + +Wi-Fi +===== + +The IPv4 Wi-Fi support can be enabled in the sample with +:ref:`Wi-Fi snippet `. diff --git a/samples/net/sockets/sntp_client/sample.yaml b/samples/net/sockets/sntp_client/sample.yaml index aba249df18aae..762da6d00007b 100644 --- a/samples/net/sockets/sntp_client/sample.yaml +++ b/samples/net/sockets/sntp_client/sample.yaml @@ -9,3 +9,9 @@ tests: platform_allow: - qemu_x86 - native_sim + sample.net.sockets.sntp_client.wifi.nrf70dk: + extra_args: + - SNIPPET=wifi-ipv4 + - CONFIG_NRF_WIFI_BUILD_ONLY_MODE=y + platform_allow: + - nrf7002dk/nrf5340/cpuapp diff --git a/samples/net/sockets/sntp_client/src/main.c b/samples/net/sockets/sntp_client/src/main.c index 585ce1d1b4314..66cf8a759e855 100644 --- a/samples/net/sockets/sntp_client/src/main.c +++ b/samples/net/sockets/sntp_client/src/main.c @@ -12,6 +12,7 @@ LOG_MODULE_REGISTER(net_sntp_client_sample, LOG_LEVEL_DBG); #include #include "config.h" +#include "net_sample_common.h" #define SNTP_PORT 123 @@ -25,6 +26,8 @@ int main(void) struct sntp_time sntp_time; int rv; + wait_for_network(); + /* ipv4 */ memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; diff --git a/samples/net/syslog_net/CMakeLists.txt b/samples/net/syslog_net/CMakeLists.txt index c6c052e8a9020..99c7d474c3b36 100644 --- a/samples/net/syslog_net/CMakeLists.txt +++ b/samples/net/syslog_net/CMakeLists.txt @@ -7,3 +7,5 @@ project(syslog_net) FILE(GLOB app_sources src/*.c) target_sources(app PRIVATE ${app_sources}) + +include(${ZEPHYR_BASE}/samples/net/common/common.cmake) diff --git a/samples/net/syslog_net/README.rst b/samples/net/syslog_net/README.rst index dd5908714b9c9..acc27ff058214 100644 --- a/samples/net/syslog_net/README.rst +++ b/samples/net/syslog_net/README.rst @@ -51,3 +51,9 @@ Build syslog_net sample application like this: :conf: :goals: build :compact: + +Wi-Fi +===== + +The IPv4 Wi-Fi support can be enabled in the sample with +:ref:`Wi-Fi snippet `. diff --git a/samples/net/syslog_net/sample.yaml b/samples/net/syslog_net/sample.yaml index 4fe99e593ff11..7770f1ea80b0c 100644 --- a/samples/net/syslog_net/sample.yaml +++ b/samples/net/syslog_net/sample.yaml @@ -37,3 +37,9 @@ tests: - CONFIG_LOG_BACKEND_NET_AUTOSTART=n - CONFIG_LOG_BACKEND_NET_SERVER="" - CONFIG_NET_SAMPLE_SERVER_RUNTIME="192.0.2.2:514" + sample.net.syslog.wifi.nrf70dk: + extra_args: + - SNIPPET=wifi-ipv4 + - CONFIG_NRF_WIFI_BUILD_ONLY_MODE=y + platform_allow: + - nrf7002dk/nrf5340/cpuapp diff --git a/samples/net/syslog_net/src/main.c b/samples/net/syslog_net/src/main.c index f0362648f050c..da499fec741f4 100644 --- a/samples/net/syslog_net/src/main.c +++ b/samples/net/syslog_net/src/main.c @@ -15,6 +15,8 @@ LOG_MODULE_REGISTER(net_syslog, LOG_LEVEL_DBG); #include +#include "net_sample_common.h" + BUILD_ASSERT(IS_ENABLED(CONFIG_LOG_BACKEND_NET), "syslog backend not enabled"); #define SLEEP_BETWEEN_PRINTS 3 @@ -25,6 +27,8 @@ int main(void) LOG_DBG("Starting"); + wait_for_network(); + if (!IS_ENABLED(CONFIG_LOG_BACKEND_NET_AUTOSTART)) { /* Example how to start the backend if autostart is disabled. * This is useful if the application needs to wait the network diff --git a/samples/net/telnet/CMakeLists.txt b/samples/net/telnet/CMakeLists.txt index 342f2dbee48ee..6dfd6ba8ef96b 100644 --- a/samples/net/telnet/CMakeLists.txt +++ b/samples/net/telnet/CMakeLists.txt @@ -6,3 +6,5 @@ project(telnet) FILE(GLOB app_sources src/*.c) target_sources(app PRIVATE ${app_sources}) + +include(${ZEPHYR_BASE}/samples/net/common/common.cmake) diff --git a/samples/net/telnet/README.rst b/samples/net/telnet/README.rst index 1c648e2e970fc..7eb82cd9ddae2 100644 --- a/samples/net/telnet/README.rst +++ b/samples/net/telnet/README.rst @@ -128,3 +128,9 @@ On your linux host: You are now connected, and as for the UART console, you can type in your commands and get the output through your telnet client. + +Wi-Fi +===== + +The IPv4 Wi-Fi support can be enabled in the sample with +:ref:`Wi-Fi snippet `. diff --git a/samples/net/telnet/sample.yaml b/samples/net/telnet/sample.yaml index c3987d33634db..508b76fe4f6ed 100644 --- a/samples/net/telnet/sample.yaml +++ b/samples/net/telnet/sample.yaml @@ -1,12 +1,19 @@ +common: + harness: net + depends_on: netif + tags: + - net + - telnet sample: name: Telnet Server tests: sample.net.telnet: - harness: net - depends_on: netif - tags: - - net - - telnet platform_exclude: - native_posix - native_posix/native/64 + sample.net.telnet.wifi.nrf70dk: + extra_args: + - SNIPPET=wifi-ipv4 + - CONFIG_NRF_WIFI_BUILD_ONLY_MODE=y + platform_allow: + - nrf7002dk/nrf5340/cpuapp diff --git a/samples/net/telnet/src/telnet.c b/samples/net/telnet/src/telnet.c index e1cc53095a4a5..6ad77c4f7d31b 100644 --- a/samples/net/telnet/src/telnet.c +++ b/samples/net/telnet/src/telnet.c @@ -16,6 +16,8 @@ LOG_MODULE_REGISTER(net_telnet_sample, LOG_LEVEL_DBG); #include #include +#include "net_sample_common.h" + #if defined(CONFIG_NET_DHCPV4) static struct net_mgmt_event_callback mgmt_cb; @@ -140,6 +142,8 @@ int main(void) LOG_INF("Starting Telnet sample"); + wait_for_network(); + setup_ipv4(iface); setup_dhcpv4(iface); From 0623b23f71f85c5568446b46f79cb19581c82ba3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 3 Oct 2024 12:37:31 +0200 Subject: [PATCH 0428/4482] samples: net: echo_client: Fix build warning with IPv6 disabled Building the sample with IPv4 only gives the following warning: tcp.c:99:37: warning: array subscript 'struct sockaddr[0]' is partly outside array bounds of 'struct sockaddr_in[1]' [-Warray-bounds] data->tcp.sock = socket(addr->sa_family, SOCK_STREAM, IPPROTO_TCP); This doesn't really seem like a valid one, but to get rid of it workaround by specifying address family explicitly. Signed-off-by: Robert Lubos --- samples/net/sockets/echo_client/src/tcp.c | 19 ++++++++++--------- samples/net/sockets/echo_client/src/udp.c | 15 ++++++++------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/samples/net/sockets/echo_client/src/tcp.c b/samples/net/sockets/echo_client/src/tcp.c index eee8994425ccf..b8abce4036b4b 100644 --- a/samples/net/sockets/echo_client/src/tcp.c +++ b/samples/net/sockets/echo_client/src/tcp.c @@ -87,16 +87,16 @@ static int compare_tcp_data(struct data *data, const char *buf, uint32_t receive return 0; } -static int start_tcp_proto(struct data *data, struct sockaddr *addr, - socklen_t addrlen) +static int start_tcp_proto(struct data *data, sa_family_t family, + struct sockaddr *addr, socklen_t addrlen) { int optval; int ret; #if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS) - data->tcp.sock = socket(addr->sa_family, SOCK_STREAM, IPPROTO_TLS_1_2); + data->tcp.sock = socket(family, SOCK_STREAM, IPPROTO_TLS_1_2); #else - data->tcp.sock = socket(addr->sa_family, SOCK_STREAM, IPPROTO_TCP); + data->tcp.sock = socket(family, SOCK_STREAM, IPPROTO_TCP); #endif if (data->tcp.sock < 0) { LOG_ERR("Failed to create TCP socket (%s): %d", data->proto, @@ -108,7 +108,7 @@ static int start_tcp_proto(struct data *data, struct sockaddr *addr, struct sockaddr proxy_addr; socklen_t proxy_addrlen; - if (addr->sa_family == AF_INET) { + if (family == AF_INET) { struct sockaddr_in *proxy4 = (struct sockaddr_in *)&proxy_addr; @@ -117,7 +117,7 @@ static int start_tcp_proto(struct data *data, struct sockaddr *addr, inet_pton(AF_INET, SOCKS5_PROXY_V4_ADDR, &proxy4->sin_addr); proxy_addrlen = sizeof(struct sockaddr_in); - } else if (addr->sa_family == AF_INET6) { + } else if (family == AF_INET6) { struct sockaddr_in6 *proxy6 = (struct sockaddr_in6 *)&proxy_addr; @@ -163,7 +163,7 @@ static int start_tcp_proto(struct data *data, struct sockaddr *addr, #endif /* Prefer IPv6 temporary addresses */ - if (addr->sa_family == AF_INET6) { + if (family == AF_INET6) { optval = IPV6_PREFER_SRC_TMP; (void)setsockopt(data->tcp.sock, IPPROTO_IPV6, IPV6_ADDR_PREFERENCES, @@ -242,7 +242,7 @@ int start_tcp(void) inet_pton(AF_INET6, CONFIG_NET_CONFIG_PEER_IPV6_ADDR, &addr6.sin6_addr); - ret = start_tcp_proto(&conf.ipv6, + ret = start_tcp_proto(&conf.ipv6, AF_INET6, (struct sockaddr *)&addr6, sizeof(addr6)); if (ret < 0) { @@ -256,7 +256,8 @@ int start_tcp(void) inet_pton(AF_INET, CONFIG_NET_CONFIG_PEER_IPV4_ADDR, &addr4.sin_addr); - ret = start_tcp_proto(&conf.ipv4, (struct sockaddr *)&addr4, + ret = start_tcp_proto(&conf.ipv4, AF_INET, + (struct sockaddr *)&addr4, sizeof(addr4)); if (ret < 0) { return ret; diff --git a/samples/net/sockets/echo_client/src/udp.c b/samples/net/sockets/echo_client/src/udp.c index 3055c2d03f266..1fe92e8889904 100644 --- a/samples/net/sockets/echo_client/src/udp.c +++ b/samples/net/sockets/echo_client/src/udp.c @@ -190,16 +190,16 @@ static void wait_transmit(struct k_timer *timer) k_poll_signal_raise(&ctrl->tx_signal, 0); } -static int start_udp_proto(struct data *data, struct sockaddr *addr, - socklen_t addrlen) +static int start_udp_proto(struct data *data, sa_family_t family, + struct sockaddr *addr, socklen_t addrlen) { int optval; int ret; #if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS) - data->udp.sock = socket(addr->sa_family, SOCK_DGRAM, IPPROTO_DTLS_1_2); + data->udp.sock = socket(family, SOCK_DGRAM, IPPROTO_DTLS_1_2); #else - data->udp.sock = socket(addr->sa_family, SOCK_DGRAM, IPPROTO_UDP); + data->udp.sock = socket(family, SOCK_DGRAM, IPPROTO_UDP); #endif if (data->udp.sock < 0) { LOG_ERR("Failed to create UDP socket (%s): %d", data->proto, @@ -233,7 +233,7 @@ static int start_udp_proto(struct data *data, struct sockaddr *addr, #endif /* Prefer IPv6 temporary addresses */ - if (addr->sa_family == AF_INET6) { + if (family == AF_INET6) { optval = IPV6_PREFER_SRC_TMP; (void)setsockopt(data->udp.sock, IPPROTO_IPV6, IPV6_ADDR_PREFERENCES, @@ -312,7 +312,7 @@ int start_udp(void) inet_pton(AF_INET6, CONFIG_NET_CONFIG_PEER_IPV6_ADDR, &addr6.sin6_addr); - ret = start_udp_proto(&conf.ipv6, + ret = start_udp_proto(&conf.ipv6, AF_INET6, (struct sockaddr *)&addr6, sizeof(addr6)); if (ret < 0) { @@ -326,7 +326,8 @@ int start_udp(void) inet_pton(AF_INET, CONFIG_NET_CONFIG_PEER_IPV4_ADDR, &addr4.sin_addr); - ret = start_udp_proto(&conf.ipv4, (struct sockaddr *)&addr4, + ret = start_udp_proto(&conf.ipv4, AF_INET, + (struct sockaddr *)&addr4, sizeof(addr4)); if (ret < 0) { return ret; From 7b854d82606665742d612e7c18f0da81e6ae9ded Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 3 Oct 2024 17:34:32 +0200 Subject: [PATCH 0429/4482] samples: net: echo_client: Fix 'Tag name should be unique' error Refactor the code to comply with: Violation to rule 5.7 (Tag name should be unique) tag: data Rename the structure to avoid excessive refactoring. Signed-off-by: Robert Lubos --- samples/net/sockets/echo_client/src/common.h | 6 +++--- samples/net/sockets/echo_client/src/tcp.c | 8 ++++---- samples/net/sockets/echo_client/src/udp.c | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/samples/net/sockets/echo_client/src/common.h b/samples/net/sockets/echo_client/src/common.h index d7a8b6c69e5d7..76bbc5604ded0 100644 --- a/samples/net/sockets/echo_client/src/common.h +++ b/samples/net/sockets/echo_client/src/common.h @@ -42,7 +42,7 @@ struct udp_control { struct k_timer rx_timer; }; -struct data { +struct sample_data { const char *proto; struct { @@ -62,8 +62,8 @@ struct data { }; struct configs { - struct data ipv4; - struct data ipv6; + struct sample_data ipv4; + struct sample_data ipv6; }; #if !defined(CONFIG_NET_CONFIG_PEER_IPV4_ADDR) diff --git a/samples/net/sockets/echo_client/src/tcp.c b/samples/net/sockets/echo_client/src/tcp.c index b8abce4036b4b..32019849d8fa9 100644 --- a/samples/net/sockets/echo_client/src/tcp.c +++ b/samples/net/sockets/echo_client/src/tcp.c @@ -47,7 +47,7 @@ static ssize_t sendall(int sock, const void *buf, size_t len) return 0; } -static int send_tcp_data(struct data *data) +static int send_tcp_data(struct sample_data *data) { int ret; @@ -72,7 +72,7 @@ static int send_tcp_data(struct data *data) return ret; } -static int compare_tcp_data(struct data *data, const char *buf, uint32_t received) +static int compare_tcp_data(struct sample_data *data, const char *buf, uint32_t received) { if (data->tcp.received + received > data->tcp.expecting) { LOG_ERR("Too much data received: TCP %s", data->proto); @@ -87,7 +87,7 @@ static int compare_tcp_data(struct data *data, const char *buf, uint32_t receive return 0; } -static int start_tcp_proto(struct data *data, sa_family_t family, +static int start_tcp_proto(struct sample_data *data, sa_family_t family, struct sockaddr *addr, socklen_t addrlen) { int optval; @@ -180,7 +180,7 @@ static int start_tcp_proto(struct data *data, sa_family_t family, return ret; } -static int process_tcp_proto(struct data *data) +static int process_tcp_proto(struct sample_data *data) { int ret, received; char buf[RECV_BUF_SIZE]; diff --git a/samples/net/sockets/echo_client/src/udp.c b/samples/net/sockets/echo_client/src/udp.c index 1fe92e8889904..49b6c14b8f1f7 100644 --- a/samples/net/sockets/echo_client/src/udp.c +++ b/samples/net/sockets/echo_client/src/udp.c @@ -36,7 +36,7 @@ static struct k_thread udp_tx_thread; static struct udp_control udp4_ctrl, udp6_ctrl; static struct k_poll_signal udp_kill; -static int send_udp_data(struct data *data); +static int send_udp_data(struct sample_data *data); static void wait_reply(struct k_timer *timer); static void wait_transmit(struct k_timer *timer); @@ -136,7 +136,7 @@ void init_udp(void) } } -static int send_udp_data(struct data *data) +static int send_udp_data(struct sample_data *data) { int ret; @@ -156,7 +156,7 @@ static int send_udp_data(struct data *data) return ret < 0 ? -EIO : 0; } -static int compare_udp_data(struct data *data, const char *buf, uint32_t received) +static int compare_udp_data(struct sample_data *data, const char *buf, uint32_t received) { if (received != data->udp.expecting) { LOG_ERR("Invalid amount of data received: UDP %s", data->proto); @@ -175,7 +175,7 @@ static void wait_reply(struct k_timer *timer) { /* This means that we did not receive response in time. */ struct udp_control *ctrl = CONTAINER_OF(timer, struct udp_control, rx_timer); - struct data *data = (ctrl == conf.ipv4.udp.ctrl) ? &conf.ipv4 : &conf.ipv6; + struct sample_data *data = (ctrl == conf.ipv4.udp.ctrl) ? &conf.ipv4 : &conf.ipv6; LOG_ERR("UDP %s: Data packet not received", data->proto); @@ -190,7 +190,7 @@ static void wait_transmit(struct k_timer *timer) k_poll_signal_raise(&ctrl->tx_signal, 0); } -static int start_udp_proto(struct data *data, sa_family_t family, +static int start_udp_proto(struct sample_data *data, sa_family_t family, struct sockaddr *addr, socklen_t addrlen) { int optval; @@ -251,7 +251,7 @@ static int start_udp_proto(struct data *data, sa_family_t family, return ret; } -static int process_udp_proto(struct data *data) +static int process_udp_proto(struct sample_data *data) { int ret, received; From 5c6b003554215e88fd0f03d02e5ea2cfc7df4410 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 3 Oct 2024 15:52:10 +0200 Subject: [PATCH 0430/4482] net: dns: dispatcher: Don't use uninitialized entries In case CONFIG_DNS_RESOLVER_MAX_SERVERS is larger than the actual number of DNS servers configured, some server entries may be left uninitialized. The dispatcher needs to take this into account, otherwise it may cause memory corruptions. Signed-off-by: Robert Lubos --- subsys/net/lib/dns/dispatcher.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/subsys/net/lib/dns/dispatcher.c b/subsys/net/lib/dns/dispatcher.c index 266c616d74fe9..380c4699a8ab3 100644 --- a/subsys/net/lib/dns/dispatcher.c +++ b/subsys/net/lib/dns/dispatcher.c @@ -260,6 +260,10 @@ int dns_dispatcher_register(struct dns_socket_dispatcher *ctx) goto out; } + if (ctx->fds[i].fd < 0) { + continue; + } + if (dispatch_table[ctx->fds[i].fd].ctx == NULL) { dispatch_table[ctx->fds[i].fd].ctx = ctx; } @@ -297,6 +301,10 @@ int dns_dispatcher_register(struct dns_socket_dispatcher *ctx) goto out; } + if (ctx->fds[i].fd < 0) { + continue; + } + if (dispatch_table[ctx->fds[i].fd].ctx == NULL) { dispatch_table[ctx->fds[i].fd].ctx = ctx; } From 7d91281caaa587fe6252653808153a1ace32fca0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 3 Oct 2024 16:26:11 +0200 Subject: [PATCH 0431/4482] samples: net: telnet: Remove redundant code The sample uses net_config library, so there's no need for the sample to configure unicast IP addresses manually. Signed-off-by: Robert Lubos --- samples/net/telnet/src/telnet.c | 112 +------------------------------- 1 file changed, 3 insertions(+), 109 deletions(-) diff --git a/samples/net/telnet/src/telnet.c b/samples/net/telnet/src/telnet.c index 6ad77c4f7d31b..f8df416e39ae0 100644 --- a/samples/net/telnet/src/telnet.c +++ b/samples/net/telnet/src/telnet.c @@ -18,111 +18,13 @@ LOG_MODULE_REGISTER(net_telnet_sample, LOG_LEVEL_DBG); #include "net_sample_common.h" -#if defined(CONFIG_NET_DHCPV4) -static struct net_mgmt_event_callback mgmt_cb; - -static void ipv4_addr_add_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, - struct net_if *iface) -{ - char hr_addr[NET_IPV4_ADDR_LEN]; - int i = 0; - - if (mgmt_event != NET_EVENT_IPV4_ADDR_ADD) { - /* Spurious callback. */ - return; - } - - for (i = 0; i < NET_IF_MAX_IPV4_ADDR; i++) { - struct net_if_addr *if_addr = - &iface->config.ip.ipv4->unicast[i]; - - if (if_addr->addr_type != NET_ADDR_DHCP || !if_addr->is_used) { - continue; - } - - LOG_INF("IPv4 address: %s", - net_addr_ntop(AF_INET, - &if_addr->address.in_addr, - hr_addr, NET_IPV4_ADDR_LEN)); - LOG_INF("Lease time: %u seconds", - iface->config.dhcpv4.lease_time); - LOG_INF("Subnet: %s", - net_addr_ntop(AF_INET, - &iface->config.ip.ipv4->netmask, - hr_addr, NET_IPV4_ADDR_LEN)); - LOG_INF("Router: %s", - net_addr_ntop(AF_INET, - &iface->config.ip.ipv4->gw, - hr_addr, NET_IPV4_ADDR_LEN)); - break; - } -} - -static void setup_dhcpv4(struct net_if *iface) -{ - LOG_INF("Running dhcpv4 client..."); - - net_mgmt_init_event_callback(&mgmt_cb, ipv4_addr_add_handler, - NET_EVENT_IPV4_ADDR_ADD); - net_mgmt_add_event_callback(&mgmt_cb); - - net_dhcpv4_start(iface); -} - -#else -#define setup_dhcpv4(...) -#endif /* CONFIG_NET_DHCPV4 */ - -#if defined(CONFIG_NET_IPV4) && !defined(CONFIG_NET_DHCPV4) - -#if !defined(CONFIG_NET_CONFIG_MY_IPV4_ADDR) -#error "You need to define an IPv4 Address or enable DHCPv4!" -#endif - -static void setup_ipv4(struct net_if *iface) -{ - char hr_addr[NET_IPV4_ADDR_LEN]; - struct in_addr addr; - - if (net_addr_pton(AF_INET, CONFIG_NET_CONFIG_MY_IPV4_ADDR, &addr)) { - LOG_ERR("Invalid address: %s", CONFIG_NET_CONFIG_MY_IPV4_ADDR); - return; - } - - net_if_ipv4_addr_add(iface, &addr, NET_ADDR_MANUAL, 0); - - LOG_INF("IPv4 address: %s", - net_addr_ntop(AF_INET, &addr, hr_addr, - NET_IPV4_ADDR_LEN)); -} - -#else -#define setup_ipv4(...) -#endif /* CONFIG_NET_IPV4 && !CONFIG_NET_DHCPV4 */ - #if defined(CONFIG_NET_IPV6) - #define MCAST_IP6ADDR "ff84::2" -#ifndef CONFIG_NET_CONFIG_MY_IPV6_ADDR -#error "You need to define an IPv6 Address!" -#endif - -static void setup_ipv6(struct net_if *iface) +static void setup_ipv6(void) { - char hr_addr[NET_IPV6_ADDR_LEN]; struct in6_addr addr; - - if (net_addr_pton(AF_INET6, CONFIG_NET_CONFIG_MY_IPV6_ADDR, &addr)) { - LOG_ERR("Invalid address: %s", CONFIG_NET_CONFIG_MY_IPV6_ADDR); - return; - } - - net_if_ipv6_addr_add(iface, &addr, NET_ADDR_MANUAL, 0); - - LOG_INF("IPv6 address: %s", - net_addr_ntop(AF_INET6, &addr, hr_addr, NET_IPV6_ADDR_LEN)); + struct net_if *iface = net_if_get_default(); if (net_addr_pton(AF_INET6, MCAST_IP6ADDR, &addr)) { LOG_ERR("Invalid address: %s", MCAST_IP6ADDR); @@ -131,23 +33,15 @@ static void setup_ipv6(struct net_if *iface) net_if_ipv6_maddr_add(iface, &addr); } - #else #define setup_ipv6(...) #endif /* CONFIG_NET_IPV6 */ int main(void) { - struct net_if *iface = net_if_get_default(); - LOG_INF("Starting Telnet sample"); wait_for_network(); - - setup_ipv4(iface); - - setup_dhcpv4(iface); - - setup_ipv6(iface); + setup_ipv6(); return 0; } From c6cc87c526224e03d305f2072a5cb91967938715 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 3 Oct 2024 18:32:13 +0200 Subject: [PATCH 0432/4482] log: net: Fix build warning with IPv6 disabled Building the net logger backend with IPv4 only gives the following warning: log_backend_net.c:116:31: warning: array subscript 'struct sockaddr[0]' is partly outside array bounds of 'struct sockaddr_in[1]' [-Warray-bounds] local_addr->sa_family = server_addr.sa_family; hence assign the address family directly to sockaddr_in/6 structs. Signed-off-by: Robert Lubos --- subsys/logging/backends/log_backend_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/logging/backends/log_backend_net.c b/subsys/logging/backends/log_backend_net.c index 3f49e0a40881c..f968a6cf4f6b4 100644 --- a/subsys/logging/backends/log_backend_net.c +++ b/subsys/logging/backends/log_backend_net.c @@ -99,12 +99,14 @@ static int do_net_init(struct log_backend_net_ctx *ctx) if (IS_ENABLED(CONFIG_NET_IPV4) && server_addr.sa_family == AF_INET) { local_addr = (struct sockaddr *)&local_addr4; server_addr_len = sizeof(struct sockaddr_in); + local_addr4.sin_family = AF_INET; local_addr4.sin_port = 0U; } if (IS_ENABLED(CONFIG_NET_IPV6) && server_addr.sa_family == AF_INET6) { local_addr = (struct sockaddr *)&local_addr6; server_addr_len = sizeof(struct sockaddr_in6); + local_addr6.sin6_family = AF_INET6; local_addr6.sin6_port = 0U; } @@ -113,8 +115,6 @@ static int do_net_init(struct log_backend_net_ctx *ctx) return -EINVAL; } - local_addr->sa_family = server_addr.sa_family; - if (ctx->is_tcp) { proto = IPPROTO_TCP; type = SOCK_STREAM; From 3cd470013260ffbf6ffbde7e401d8c3986d48c9a Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 7 Oct 2024 13:40:56 +0530 Subject: [PATCH 0433/4482] drivers: nrfwifi: Fix the indentation The Cmake indentation is two spaces. Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/CMakeLists.txt | 64 ++++++++++++++--------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/drivers/wifi/nrfwifi/CMakeLists.txt b/drivers/wifi/nrfwifi/CMakeLists.txt index 91818f6558281..4055384aac7fc 100644 --- a/drivers/wifi/nrfwifi/CMakeLists.txt +++ b/drivers/wifi/nrfwifi/CMakeLists.txt @@ -136,39 +136,39 @@ zephyr_compile_definitions_ifdef(CONFIG_NRF70_ON_QSPI ) if (CONFIG_NRF_WIFI_BUILD_ONLY_MODE) -message(WARNING " ------------------------------------------------------------------------- -Building only the nRF70 driver, skipping firmware patch. -This is only for building (CI) purposes and will not work on a real device. ------------------------------------------------------------------------- -") + message(WARNING " + ------------------------------------------------------------------------ + Building only the nRF70 driver, skipping firmware patch. + This is only for building (CI) purposes and will not work on a real device. + ------------------------------------------------------------------------ + ") else() -# RPU FW patch binaries based on the selected configuration -if(CONFIG_NRF70_SYSTEM_MODE) - set(NRF70_PATCH ${FW_BINS_BASE}/default/nrf70.bin) -elseif(CONFIG_NRF70_RADIO_TEST) - set(NRF70_PATCH ${FW_BINS_BASE}/radio_test/nrf70.bin) -elseif(CONFIG_NRF70_SCAN_ONLY) - set(NRF70_PATCH ${FW_BINS_BASE}/scan_only/nrf70.bin) -elseif (CONFIG_NRF70_SYSTEM_WITH_RAW_MODES) - set(NRF70_PATCH ${FW_BINS_BASE}/system_with_raw/nrf70.bin) -else() - # Error - message(FATAL_ERROR "Unsupported nRF70 patch configuration") -endif() - -if(NOT EXISTS ${NRF70_PATCH}) - message(FATAL_ERROR " - ------------------------------------------------------------------------ - Missing blobs for nRF70 device driver, please install by running: - $ west update - $ west blobs fetch hal_nordic - ------------------------------------------------------------------------") -endif() - -zephyr_compile_definitions( - -DCONFIG_NRF_WIFI_FW_BIN=${NRF70_PATCH} -) + # RPU FW patch binaries based on the selected configuration + if(CONFIG_NRF70_SYSTEM_MODE) + set(NRF70_PATCH ${FW_BINS_BASE}/default/nrf70.bin) + elseif(CONFIG_NRF70_RADIO_TEST) + set(NRF70_PATCH ${FW_BINS_BASE}/radio_test/nrf70.bin) + elseif(CONFIG_NRF70_SCAN_ONLY) + set(NRF70_PATCH ${FW_BINS_BASE}/scan_only/nrf70.bin) + elseif (CONFIG_NRF70_SYSTEM_WITH_RAW_MODES) + set(NRF70_PATCH ${FW_BINS_BASE}/system_with_raw/nrf70.bin) + else() + # Error + message(FATAL_ERROR "Unsupported nRF70 patch configuration") + endif() + + if(NOT EXISTS ${NRF70_PATCH}) + message(FATAL_ERROR " + ------------------------------------------------------------------------ + Missing blobs for nRF70 device driver, please install by running: + $ west update + $ west blobs fetch hal_nordic + ------------------------------------------------------------------------") + endif() + + zephyr_compile_definitions( + -DCONFIG_NRF_WIFI_FW_BIN=${NRF70_PATCH} + ) endif() From f20e2d68b054e672831d099ca5ade2e7dc00e33d Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 2 Oct 2024 15:49:34 +0200 Subject: [PATCH 0434/4482] drivers: wifi: Add support to override FW load For using external flash the tooling is only available in NCS, so, use the existing Kconfig option to override the FW loading. Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/CMakeLists.txt | 2 +- drivers/wifi/nrfwifi/Kconfig.nrfwifi | 1 + drivers/wifi/nrfwifi/src/fw_load.c | 2 -- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/wifi/nrfwifi/CMakeLists.txt b/drivers/wifi/nrfwifi/CMakeLists.txt index 4055384aac7fc..3c912419a9cce 100644 --- a/drivers/wifi/nrfwifi/CMakeLists.txt +++ b/drivers/wifi/nrfwifi/CMakeLists.txt @@ -63,7 +63,7 @@ zephyr_library_sources( src/qspi/src/ficr_prog.c ) -zephyr_library_sources_ifndef(CONFIG_NRF_WIFI_BUILD_ONLY_MODE +zephyr_library_sources_ifdef(CONFIG_NRF_WIFI_PATCHES_BUILTIN src/fw_load.c ) diff --git a/drivers/wifi/nrfwifi/Kconfig.nrfwifi b/drivers/wifi/nrfwifi/Kconfig.nrfwifi index d8cae0f38c8f2..d4b796fef35dc 100644 --- a/drivers/wifi/nrfwifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrfwifi/Kconfig.nrfwifi @@ -131,6 +131,7 @@ config NRF_WIFI_IF_AUTO_START config NRF_WIFI_PATCHES_BUILTIN bool "Store nRF70 FW patches as part of the driver" default y + depends on !NRF_WIFI_BUILD_ONLY_MODE help Select this option to store nRF70 FW patches as part of the driver. This option impacts the code memory footprint of the driver. diff --git a/drivers/wifi/nrfwifi/src/fw_load.c b/drivers/wifi/nrfwifi/src/fw_load.c index 14087a7d35ca7..6bf4c85193ffc 100644 --- a/drivers/wifi/nrfwifi/src/fw_load.c +++ b/drivers/wifi/nrfwifi/src/fw_load.c @@ -18,7 +18,6 @@ LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL); #include -#ifdef CONFIG_NRF_WIFI_PATCHES_BUILTIN /* INCBIN macro Taken from https://gist.github.com/mmozeiko/ed9655cf50341553d282 */ #define STR2(x) #x #define STR(x) STR2(x) @@ -56,7 +55,6 @@ LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL); extern const char prefix ## _ ## name ## _end[]; INCBIN(_bin, nrf70_fw, STR(CONFIG_NRF_WIFI_FW_BIN)); -#endif /* CONFIG_NRF_WIFI_PATCHES_BUILTIN */ enum nrf_wifi_status nrf_wifi_fw_load(void *rpu_ctx) { From d15b7b5b3af9a1e3e5e6bceb0792bcdc34e9131d Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 2 Oct 2024 16:18:11 +0200 Subject: [PATCH 0435/4482] drivers: wifi: nrf: Remove unused linker script This script is needed only when external flash is used to store nRF70 firmware patches. This also uses PM which is supported only in NCS. Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/Kconfig.nrfwifi | 4 -- drivers/wifi/nrfwifi/rpu_fw_patches.ld | 51 -------------------------- 2 files changed, 55 deletions(-) delete mode 100644 drivers/wifi/nrfwifi/rpu_fw_patches.ld diff --git a/drivers/wifi/nrfwifi/Kconfig.nrfwifi b/drivers/wifi/nrfwifi/Kconfig.nrfwifi index d4b796fef35dc..3096dd7c76edd 100644 --- a/drivers/wifi/nrfwifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrfwifi/Kconfig.nrfwifi @@ -136,10 +136,6 @@ config NRF_WIFI_PATCHES_BUILTIN Select this option to store nRF70 FW patches as part of the driver. This option impacts the code memory footprint of the driver. -config CUSTOM_LINKER_SCRIPT - string "Custom linker script for nRF70 FW patches" - default "${ZEPHYR_BASE}/../nrf/drivers/wifi/nrf70/rpu_fw_patches.ld" - config NRF_WIFI_LOW_POWER bool "low power mode in nRF Wi-Fi chipsets" default y diff --git a/drivers/wifi/nrfwifi/rpu_fw_patches.ld b/drivers/wifi/nrfwifi/rpu_fw_patches.ld deleted file mode 100644 index 4ecbaedb0960b..0000000000000 --- a/drivers/wifi/nrfwifi/rpu_fw_patches.ld +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file - * @brief Custom Linker command/script file - * - * Custom Linker script for the Cortex-M platforms. - */ - -#include -#include - -#include -#include - -#if CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP || CONFIG_BOARD_NRF52840DK_NRF52840 -/* - * nRF53/52 series ship an external flash that can be used for XIP using QSPI/SPI. - * - * Note: In nRF7002 external flash using is accessible only using SPI but there is no - * support for XIP, so, relocation cannot be used. - */ -#if CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP -#define EXTFLASH_BASE_ADDR 0x10000000 -#define EXTFLASH_SIZE 0x800000 -#elif CONFIG_BOARD_NRF52840DK_NRF52840 -#define EXTFLASH_BASE_ADDR 0x12000000 -#define EXTFLASH_SIZE 0x800000 -#endif /* CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP */ - -#if USE_PARTITION_MANAGER && PM_EXTERNAL_FLASH_ADDRESS -#include -#define EXTFLASH_ADDRESS (EXTFLASH_BASE_ADDR + PM_EXTERNAL_FLASH_ADDRESS) -#undef EXTFLASH_SIZE -#define EXTFLASH_SIZE (PM_EXTERNAL_FLASH_SIZE) -#else -#define EXTFLASH_ADDRESS (EXTFLASH_BASE_ADDR) -#endif /* USE_PARTITION_MANAGER && PM_EXTERNAL_FLASH_ADDRESS */ - -MEMORY -{ - EXTFLASH (wx) : ORIGIN = EXTFLASH_ADDRESS, LENGTH = EXTFLASH_SIZE -} - -#endif /* CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP || CONFIG_BOARD_NRF52840DK_NRF52840 */ - -#include From e2e96acebfef43fe619d315587592b8885a1187e Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Sun, 6 Oct 2024 01:15:15 +0530 Subject: [PATCH 0436/4482] drivers: nrfwifi: Fix rebuilding when FW blobs are changes Whenever FW blobs are updated manually, we need to tell cmake to auto-build the source files to use the latest firmware without doing a pristine build. This adds a custom target to be run with nRF Wi-Fi driver and updates timestamp of fw_load.c to rebuild whenevr the blob is updated. Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/CMakeLists.txt | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/wifi/nrfwifi/CMakeLists.txt b/drivers/wifi/nrfwifi/CMakeLists.txt index 3c912419a9cce..60c406d343958 100644 --- a/drivers/wifi/nrfwifi/CMakeLists.txt +++ b/drivers/wifi/nrfwifi/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 # -zephyr_library() +zephyr_library_named(nrfwifi) set(OS_AGNOSTIC_BASE ${ZEPHYR_HAL_NORDIC_MODULE_DIR}/drivers/nrf_wifi) set(FW_BINS_BASE ${ZEPHYR_HAL_NORDIC_MODULE_DIR}/zephyr/blobs/wifi_fw_bins) @@ -169,6 +169,22 @@ else() zephyr_compile_definitions( -DCONFIG_NRF_WIFI_FW_BIN=${NRF70_PATCH} ) + + # Rebuild fw_load.c whenever the firmware binary changes + # a bit crude way to do it, but it works + add_custom_command( + OUTPUT ${CMAKE_SOURCE_DIR}/src/fw_load.c + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_SOURCE_DIR}/src/fw_load.c + DEPENDS ${NRF70_PATCH} + COMMENT "Checking firmware blobs ${NRF70_PATCH}" + ) + + add_custom_target( + check_firmware_blobs ALL + DEPENDS ${CMAKE_SOURCE_DIR}/src/fw_load.c + ) + + add_dependencies(nrfwifi check_firmware_blobs) endif() From 11c350e2e635a9a47a02203432d31ba4a0e1f0ce Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Tue, 1 Oct 2024 11:14:12 +0200 Subject: [PATCH 0437/4482] llext: fix handling of unimplemented syscalls When building an LLEXT-enabled kernel, 62b19ef65c0b added weak aliases of all syscall implementation functions to a pointer to NULL, with the assumption that LLEXT would check the required symbols at link time and fail if any of them were found. This check, however, is ineffective in the current implementation: the actual address that is exported is the rather normal-looking location of the variable containing the NULL pointer. This defeats the NULL symbol validity checks in llext_link.c and causes the extension to crash at runtime by jumping to a location containing a few zeroes in read-only data memory. This commit makes sure the alias target is actually placed at address 0 using the llext-sections.ld linker fragment, so that undefined syscall implementations are exported as NULLs and as such properly flagged at link time. The test for this functionality is also updated to reflect the change. Signed-off-by: Luca Burelli --- include/zephyr/linker/llext-sections.ld | 12 ++++++++++++ scripts/build/gen_syscalls.py | 15 ++++++++++----- tests/subsys/llext/simple/src/test_llext_simple.c | 11 +++++------ 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/include/zephyr/linker/llext-sections.ld b/include/zephyr/linker/llext-sections.ld index b8cc32e3d1bf1..3dcfc3e8f0cd8 100644 --- a/include/zephyr/linker/llext-sections.ld +++ b/include/zephyr/linker/llext-sections.ld @@ -1,5 +1,17 @@ /* SPDX-License-Identifier: Apache-2.0 */ + /* + * Map the no_syscall_impl symbol in llext_export_syscalls.c to + * absolute address 0 so other weak symbols are exported as NULL. + * This section is used for mapping that symbol only and is not + * to be included in the final binary. + */ + + SECTION_PROLOGUE(llext_no_syscall_impl, 0 (COPY), ) + { + *(llext_no_syscall_impl) + } + /* * Special section used by LLEXT if CONFIG_LLEXT_EXPORT_BUILTINS_BY_SLID * is enabled. Declare this section to prevent it from being considered orphan. diff --git a/scripts/build/gen_syscalls.py b/scripts/build/gen_syscalls.py index 84f6b546bde58..44e0b793a124d 100755 --- a/scripts/build/gen_syscalls.py +++ b/scripts/build/gen_syscalls.py @@ -159,11 +159,16 @@ exported_template = """ -/* Export syscalls for extensions */ -static void * const no_handler = NULL; +/* + * This symbol is placed at address 0 by llext-sections.ld. Its value and + * type is not important, we are only interested in its location + */ +static void * const no_syscall_impl Z_GENERIC_SECTION(llext_no_syscall_impl); -/* Weak references, if something is not found by the linker, it will be NULL - * and simply fail during extension load +/* + * Weak references to all syscall implementations. Those not found by the + * linker outside this file will be exported as NULL and simply fail when + * an extension requiring them is loaded. */ %s @@ -495,7 +500,7 @@ def main(): if args.syscall_export_llext: with open(args.syscall_export_llext, "w") as fp: # Export symbols for emitted syscalls - weak_refs = "\n".join("extern __weak ALIAS_OF(no_handler) void * const %s;" + weak_refs = "\n".join("extern __weak ALIAS_OF(no_syscall_impl) void * const %s;" % e for e in exported) exported_symbols = "\n".join("EXPORT_SYMBOL(%s);" % e for e in exported) diff --git a/tests/subsys/llext/simple/src/test_llext_simple.c b/tests/subsys/llext/simple/src/test_llext_simple.c index 788c27ce2eb4b..6368a1b60ad12 100644 --- a/tests/subsys/llext/simple/src/test_llext_simple.c +++ b/tests/subsys/llext/simple/src/test_llext_simple.c @@ -496,17 +496,16 @@ ZTEST(llext, test_printk_exported) } /* - * Ensure ext_syscall_fail is exported - as it is picked up by the syscall - * build machinery - but points to NULL as it is not implemented. + * The syscalls test above verifies that custom syscalls defined by extensions + * are properly exported. Since `ext_syscalls.h` declares ext_syscall_fail, we + * know it is picked up by the syscall build machinery, but the implementation + * for it is missing. Make sure the exported symbol for it is NULL. */ ZTEST(llext, test_ext_syscall_fail) { const void * const esf_fn = LLEXT_FIND_BUILTIN_SYM(z_impl_ext_syscall_fail); - zassert_not_null(esf_fn, "est_fn should not be NULL"); - - zassert_is_null(*(uintptr_t **)esf_fn, NULL, - "ext_syscall_fail should be NULL"); + zassert_is_null(esf_fn, "est_fn should be NULL"); } ZTEST_SUITE(llext, NULL, NULL, NULL, NULL, NULL); From 458f363f0ba3c1a9e8e1c22ba17d37f16ed521ea Mon Sep 17 00:00:00 2001 From: Nicolas Munnich Date: Wed, 2 Oct 2024 21:50:15 +0200 Subject: [PATCH 0438/4482] drivers: pinctrl: rpi-pico: fix: typo Found a typo, fixed the typo Signed-off-by: Nicolas Munnich --- dts/bindings/pinctrl/raspberrypi,pico-pinctrl.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dts/bindings/pinctrl/raspberrypi,pico-pinctrl.yaml b/dts/bindings/pinctrl/raspberrypi,pico-pinctrl.yaml index 9902210ad978b..2e02bbaa252ff 100644 --- a/dts/bindings/pinctrl/raspberrypi,pico-pinctrl.yaml +++ b/dts/bindings/pinctrl/raspberrypi,pico-pinctrl.yaml @@ -58,7 +58,7 @@ description: | - bias-pull-up: Enable pull-up resistor. - bias-pull-down: Enable pull-down resistor. - input-enable: Enable input from the pin. - - input-schmitt-enable: Enable input hysteresys. + - input-schmitt-enable: Enable input hysteresis. - drive-strength: Set the drive strength of the pin, in milliamps. Possible values are: 2, 4, 8, 12 (default: 4mA) - slew-rate: If set to 0, slew rate is set to slow. If set to 1, it is set From c6498bb68d93178e65c4694f41087f3b9bb1d50b Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Tue, 1 Oct 2024 15:28:59 +0200 Subject: [PATCH 0439/4482] net: ipv6: Make Multicast Listener Discovery API public IPv6 MLD API was so far defined in an internal header. This does not seem correct though, as application code should be able to join/leave multicast groups, hence the API should be exposed in a public header, just as it is done for its IPv4 countepart - IGMP. Signed-off-by: Robert Lubos --- include/zephyr/net/mld.h | 84 ++++++++++++++++++++++ samples/net/sockets/coap_server/src/main.c | 1 + subsys/net/ip/ipv6.h | 42 ----------- subsys/net/ip/ipv6_mld.c | 1 + subsys/net/ip/net_if.c | 1 + subsys/net/lib/dns/llmnr_responder.c | 1 + subsys/net/lib/dns/mdns_responder.c | 1 + subsys/net/lib/shell/ipv6.c | 2 + subsys/net/lib/sockets/sockets_inet.c | 1 + subsys/net/lib/zperf/zperf_udp_receiver.c | 1 + tests/net/ipv6/src/main.c | 1 + tests/net/mld/src/main.c | 1 + 12 files changed, 95 insertions(+), 42 deletions(-) create mode 100644 include/zephyr/net/mld.h diff --git a/include/zephyr/net/mld.h b/include/zephyr/net/mld.h new file mode 100644 index 0000000000000..031eb03c931eb --- /dev/null +++ b/include/zephyr/net/mld.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2016 Intel Corporation + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** @file + * @brief Multicast Listener Discovery API + */ + +#ifndef ZEPHYR_INCLUDE_NET_MLD_H_ +#define ZEPHYR_INCLUDE_NET_MLD_H_ + +/** + * @brief MLD (Multicast Listener Discovery) + * @defgroup mld Multicast Listener Discovery API + * @since 1.8 + * @version 0.8.0 + * @ingroup networking + * @{ + */ + +#include + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Join a given multicast group. + * + * @param iface Network interface where join message is sent + * @param addr Multicast group to join + * + * @return 0 if joining was done, <0 otherwise. + */ +#if defined(CONFIG_NET_IPV6_MLD) +int net_ipv6_mld_join(struct net_if *iface, const struct in6_addr *addr); +#else +static inline int +net_ipv6_mld_join(struct net_if *iface, const struct in6_addr *addr) +{ + ARG_UNUSED(addr); + ARG_UNUSED(iface); + + return -ENOTSUP; +} +#endif /* CONFIG_NET_IPV6_MLD */ + +/** + * @brief Leave a given multicast group. + * + * @param iface Network interface where leave message is sent + * @param addr Multicast group to leave + * + * @return 0 if leaving is done, <0 otherwise. + */ +#if defined(CONFIG_NET_IPV6_MLD) +int net_ipv6_mld_leave(struct net_if *iface, const struct in6_addr *addr); +#else +static inline int +net_ipv6_mld_leave(struct net_if *iface, const struct in6_addr *addr) +{ + ARG_UNUSED(iface); + ARG_UNUSED(addr); + + return -ENOTSUP; +} +#endif /* CONFIG_NET_IPV6_MLD */ + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +#endif /* ZEPHYR_INCLUDE_NET_MLD_H_ */ diff --git a/samples/net/sockets/coap_server/src/main.c b/samples/net/sockets/coap_server/src/main.c index e5fc6dac80b10..19890c1f3d30b 100644 --- a/samples/net/sockets/coap_server/src/main.c +++ b/samples/net/sockets/coap_server/src/main.c @@ -8,6 +8,7 @@ LOG_MODULE_REGISTER(net_coap_service_sample, LOG_LEVEL_DBG); #include +#include #ifdef CONFIG_NET_IPV6 #include "net_private.h" diff --git a/subsys/net/ip/ipv6.h b/subsys/net/ip/ipv6.h index 2dbd1189a6ae3..68115f818c26e 100644 --- a/subsys/net/ip/ipv6.h +++ b/subsys/net/ip/ipv6.h @@ -198,48 +198,6 @@ static inline int net_ipv6_finalize(struct net_pkt *pkt, } #endif -/** - * @brief Join a given multicast group. - * - * @param iface Network interface where join message is sent - * @param addr Multicast group to join - * - * @return Return 0 if joining was done, <0 otherwise. - */ -#if defined(CONFIG_NET_IPV6_MLD) -int net_ipv6_mld_join(struct net_if *iface, const struct in6_addr *addr); -#else -static inline int -net_ipv6_mld_join(struct net_if *iface, const struct in6_addr *addr) -{ - ARG_UNUSED(iface); - ARG_UNUSED(addr); - - return -ENOTSUP; -} -#endif /* CONFIG_NET_IPV6_MLD */ - -/** - * @brief Leave a given multicast group. - * - * @param iface Network interface where leave message is sent - * @param addr Multicast group to leave - * - * @return Return 0 if leaving is done, <0 otherwise. - */ -#if defined(CONFIG_NET_IPV6_MLD) -int net_ipv6_mld_leave(struct net_if *iface, const struct in6_addr *addr); -#else -static inline int -net_ipv6_mld_leave(struct net_if *iface, const struct in6_addr *addr) -{ - ARG_UNUSED(iface); - ARG_UNUSED(addr); - - return -ENOTSUP; -} -#endif /* CONFIG_NET_IPV6_MLD */ - /** * @brief Send MLDv2 report message with a single entry. * diff --git a/subsys/net/ip/ipv6_mld.c b/subsys/net/ip/ipv6_mld.c index 75644c2ca5801..66166fd1d3be5 100644 --- a/subsys/net/ip/ipv6_mld.c +++ b/subsys/net/ip/ipv6_mld.c @@ -12,6 +12,7 @@ LOG_MODULE_DECLARE(net_ipv6, CONFIG_NET_IPV6_LOG_LEVEL); #include +#include #include #include #include diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c index 20f0c4e4994f1..3bb1020bd7b1a 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -17,6 +17,7 @@ LOG_MODULE_REGISTER(net_if, CONFIG_NET_IF_LOG_LEVEL); #include #include #include +#include #include #include #include diff --git a/subsys/net/lib/dns/llmnr_responder.c b/subsys/net/lib/dns/llmnr_responder.c index bc56cbb149007..b72d93f27eefc 100644 --- a/subsys/net/lib/dns/llmnr_responder.c +++ b/subsys/net/lib/dns/llmnr_responder.c @@ -21,6 +21,7 @@ LOG_MODULE_REGISTER(net_llmnr_responder, CONFIG_LLMNR_RESPONDER_LOG_LEVEL); #include #include +#include #include #include #include diff --git a/subsys/net/lib/dns/mdns_responder.c b/subsys/net/lib/dns/mdns_responder.c index ab8977d1c72b5..031f97df2fe1a 100644 --- a/subsys/net/lib/dns/mdns_responder.c +++ b/subsys/net/lib/dns/mdns_responder.c @@ -22,6 +22,7 @@ LOG_MODULE_REGISTER(net_mdns_responder, CONFIG_MDNS_RESPONDER_LOG_LEVEL); #include #include +#include #include #include #include diff --git a/subsys/net/lib/shell/ipv6.c b/subsys/net/lib/shell/ipv6.c index d13b6803e65d2..eb65185c03ca1 100644 --- a/subsys/net/lib/shell/ipv6.c +++ b/subsys/net/lib/shell/ipv6.c @@ -8,6 +8,8 @@ #include LOG_MODULE_DECLARE(net_shell); +#include + #include "net_shell_private.h" #include "../ip/ipv6.h" diff --git a/subsys/net/lib/sockets/sockets_inet.c b/subsys/net/lib/sockets/sockets_inet.c index 4a51fd3f0dc98..10de541fc8f75 100644 --- a/subsys/net/lib/sockets/sockets_inet.c +++ b/subsys/net/lib/sockets/sockets_inet.c @@ -11,6 +11,7 @@ LOG_MODULE_DECLARE(net_sock, CONFIG_NET_SOCKETS_LOG_LEVEL); #include +#include #include #include #include diff --git a/subsys/net/lib/zperf/zperf_udp_receiver.c b/subsys/net/lib/zperf/zperf_udp_receiver.c index 0f7e1e4f077cb..2f0d292f7ad0f 100644 --- a/subsys/net/lib/zperf/zperf_udp_receiver.c +++ b/subsys/net/lib/zperf/zperf_udp_receiver.c @@ -12,6 +12,7 @@ LOG_MODULE_DECLARE(net_zperf, CONFIG_NET_ZPERF_LOG_LEVEL); #include +#include #include #include #include diff --git a/tests/net/ipv6/src/main.c b/tests/net/ipv6/src/main.c index 02df9ac650c6c..1dd40afcde8c4 100644 --- a/tests/net/ipv6/src/main.c +++ b/tests/net/ipv6/src/main.c @@ -19,6 +19,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_IPV6_LOG_LEVEL); #include +#include #include #include #include diff --git a/tests/net/mld/src/main.c b/tests/net/mld/src/main.c index e1bcce056cfaf..1c95fe5409dcf 100644 --- a/tests/net/mld/src/main.c +++ b/tests/net/mld/src/main.c @@ -18,6 +18,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_IPV6_LOG_LEVEL); #include +#include #include #include #include From 6c3a55a6824ea6baa48d0f64f4f84461737f7026 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Thu, 22 Aug 2024 12:44:58 +0200 Subject: [PATCH 0440/4482] cmake: define ZEPHYR_TOOLCHAIN_PATH Other toolchains uses _TOOLCHAIN_PATH, align Zephyr SDK by setting ZEPHYR_TOOLCHAIN_PATH to be identical to the ZEPHYR_SDK_INSTALL_DIR. Signed-off-by: Torsten Rasmussen --- cmake/modules/FindZephyr-sdk.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/modules/FindZephyr-sdk.cmake b/cmake/modules/FindZephyr-sdk.cmake index b1c1c8cf02b40..1b56379ec669f 100644 --- a/cmake/modules/FindZephyr-sdk.cmake +++ b/cmake/modules/FindZephyr-sdk.cmake @@ -175,3 +175,4 @@ if(LOAD IN_LIST Zephyr-sdk_FIND_COMPONENTS) endif() endif() endif() +set(ZEPHYR_TOOLCHAIN_PATH ${ZEPHYR_SDK_INSTALL_DIR}) From daac2d55ab13039d68548dec030073ffcee6a71e Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Mon, 30 Sep 2024 21:53:51 +0200 Subject: [PATCH 0441/4482] cmake: move script mode handling from package helper to extensions.cmake Move Zephyr CMake script mode handling from package_helper.cmake into extensions.cmake. This ensures that all Zephyr CMake script which includes extensions.cmake will have the same functions stubbed or mocked and thus does not need to replicate this behavior. Signed-off-by: Torsten Rasmussen --- cmake/modules/extensions.cmake | 36 ++++++++++++++++++++++++++++++++++ cmake/package_helper.cmake | 25 ----------------------- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 2ac8c20058bf7..e45b4c602374c 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -38,6 +38,7 @@ include(CheckCXXCompilerFlag) # 7.1 llext_* configuration functions # 7.2 add_llext_* build control functions # 7.3 llext helper functions +# 8. Script mode handling ######################################################## # 1. Zephyr-aware extensions @@ -5759,3 +5760,38 @@ function(llext_filter_zephyr_flags filter flags outvar) set(${outvar} ${zephyr_filtered_flags} PARENT_SCOPE) endfunction() + +######################################################## +# 8. Script mode handling +######################################################## +# +# Certain features are not available when CMake is used in script mode. +# For example custom targets, and thus features related to custom targets, such +# as target properties are not available in script mode. +# +# This section defines behavior for functions whose default implementation does +# not work correctly in script mode. +# +# The script mode function can be a simple stub or a more complex solution +# depending on the exact use of the function in script mode. +# +# Current Zephyr CMake scripts which includes `extensions.cmake` in script mode +# are: package_helper.cmake, verify-toolchain.cmake +# + +if(CMAKE_SCRIPT_MODE_FILE) + # add_custom_target and set_target_properties are not supported in script mode. + # However, Zephyr CMake functions like `zephyr_get()`, `zephyr_create_scope()`, + # llext functions creates or relies on custom CMake targets. + function(add_custom_target) + # This silence the error: 'add_custom_target command is not scriptable' + endfunction() + + function(set_target_properties) + # This silence the error: 'set_target_properties command is not scriptable' + endfunction() + + function(zephyr_set variable) + # This silence the error: zephyr_set(... SCOPE ) doesn't exists. + endfunction() +endif() diff --git a/cmake/package_helper.cmake b/cmake/package_helper.cmake index 55412b941108b..886dbfff71ddf 100644 --- a/cmake/package_helper.cmake +++ b/cmake/package_helper.cmake @@ -44,20 +44,6 @@ cmake_minimum_required(VERSION 3.20.5) -# add_custom_target and set_target_properties are not supported in script mode. -# However, several Zephyr CMake modules create custom target for user convenience -# like menuconfig, boards, shields, etc. -# As we are not generating a build system with this tool, only running part of -# the modules, then we simply override those functions to allow running those -# modules. -function(add_custom_target) - # This silence the error: 'add_custom_target command is not scriptable' -endfunction() - -function(set_target_properties) - # This silence the error: 'set_target_properties command is not scriptable' -endfunction() - # Find last `-B` and `-S` instances. foreach(i RANGE ${CMAKE_ARGC}) if(CMAKE_ARGV${i} MATCHES "^-B(.*)") @@ -111,16 +97,5 @@ if(NOT DEFINED MODULES) ) endif() -# Loading Zephyr CMake extension commands, which allows us to overload Zephyr -# scoping rules. -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS extensions) - -# Zephyr scoping creates custom targets for handling of properties. -# However, custom targets cannot be used in CMake script mode. -# Therefore disable zephyr_set(... SCOPE ...) in package helper as it is not needed. -function(zephyr_set variable) - # This silence the error: zephyr_set(... SCOPE ) doesn't exists. -endfunction() - string(REPLACE ";" "," MODULES "${MODULES}") find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS zephyr_default:${MODULES}) From 5d5c2d4775854f136dcb7d2b845aae490958859b Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Fri, 9 Aug 2024 16:26:16 +0200 Subject: [PATCH 0442/4482] cmake: introduce build_info function The build_info function provides a generic and stable way of dumping build information to the /build_info.yml file. The build info file is in YAML format and the keys in the file are intended to be stable, as to allow external tools to retrieve information regarding the build. The main differences to the CMakeCache.txt are: - Settings in the CMakeCache.txt are user controlled, whereas the information in the build info file is intended to be those values which are used by the build system regardless if those are specified by the developer or picked up automatically. - Internal build system variables are not present in the CMake cache and should not be, because their values are calculated when CMake runs. This also has the benefits of decoupling CMake variable names from build info keys. Several CMake variables has internal build system names, and the build system is free to rename those at its own discretion. Having dedicated key names ensures a stable API that external tools can rely upon. Signed-off-by: Torsten Rasmussen --- cmake/modules/extensions.cmake | 70 ++++++++++++++++++++ cmake/modules/unittest.cmake | 1 + scripts/schemas/build-schema.yml | 106 +++++++++++++++++++++++++++++++ 3 files changed, 177 insertions(+) create mode 100644 scripts/schemas/build-schema.yml diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index e45b4c602374c..9fc4726a6654f 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -3657,6 +3657,67 @@ function(topological_sort) set(${TS_RESULT} "${sorted_targets}" PARENT_SCOPE) endfunction() +# Usage: +# build_info(... VALUE ...) +# +# This function populates updates the build_info.yml info file with exchangable build information +# related to the current build. +# +# Example: +# build_info(devicetree files VALUE file1.dts file2.dts file3.dts) +# Will update the 'devicetree files' key in the build info yaml with the list +# of files, file1.dts file2.dts file3.dts. +# +# build_info(vendor-specific foo VALUE bar) +# Will place the vendor specific key 'foo' with value 'bar' in the vendor specific section +# of the build info file. +# +# ...: One of the pre-defined valid CMake keys supported by build info or vendor-specific. +# See 'scripts/schemas/build-schema.yml' CMake section for valid tags. +# VALUE ... : value(s) to place in the build_info.yml file. +function(build_info) + set(arg_list ${ARGV}) + list(FIND arg_list VALUE index) + if(index EQUAL -1) + message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION}(...) missing a required argument: VALUE") + endif() + + yaml_context(EXISTS NAME build_info result) + if(NOT result) + yaml_load(FILE ${ZEPHYR_BASE}/scripts/schemas/build-schema.yml NAME build_info_schema) + if(EXISTS ${CMAKE_BINARY_DIR}/build_info.yml) + yaml_load(FILE ${CMAKE_BINARY_DIR}/build_info.yml NAME build_info) + else() + yaml_create(FILE ${CMAKE_BINARY_DIR}/build_info.yml NAME build_info) + endif() + yaml_set(NAME build_info KEY version VALUE "0.1.0") + endif() + + list(SUBLIST arg_list 0 ${index} keys) + list(SUBLIST arg_list ${index} -1 values) + list(POP_FRONT values) + + if(ARGV0 STREQUAL "vendor-specific") + set(type VALUE) + else() + set(schema_check ${keys}) + list(TRANSFORM schema_check PREPEND "mapping;") + yaml_get(check NAME build_info_schema KEY mapping cmake ${schema_check}) + if(check MATCHES ".*-NOTFOUND") + message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION}(...) called with invalid tag: ${keys}") + endif() + + yaml_get(type NAME build_info_schema KEY mapping cmake ${schema_check} type) + if(type MATCHES "seq|sequence") + set(type LIST) + else() + set(type VALUE) + endif() + endif() + + yaml_set(NAME build_info KEY cmake ${keys} ${type} "${values}") +endfunction() + ######################################################## # 4. Devicetree extensions ######################################################## @@ -5794,4 +5855,13 @@ if(CMAKE_SCRIPT_MODE_FILE) function(zephyr_set variable) # This silence the error: zephyr_set(... SCOPE ) doesn't exists. endfunction() + + # Build info creates a custom target for handling of build info. + # build_info is not needed in script mode but still called by Zephyr CMake + # modules. Therefore disable build_info(...) in when including + # extensions.cmake in script mode. + function(build_info) + # This silence the error: 'YAML context 'build_info' does not exist.' + # 'Remember to create a YAML context' + endfunction() endif() diff --git a/cmake/modules/unittest.cmake b/cmake/modules/unittest.cmake index 9598bf8b84ae1..6565e89aec53a 100644 --- a/cmake/modules/unittest.cmake +++ b/cmake/modules/unittest.cmake @@ -4,6 +4,7 @@ cmake_minimum_required(VERSION 3.20.0) include(extensions) include(west) +include(yaml) include(root) include(zephyr_module) include(boards) diff --git a/scripts/schemas/build-schema.yml b/scripts/schemas/build-schema.yml new file mode 100644 index 0000000000000..b4435a032d755 --- /dev/null +++ b/scripts/schemas/build-schema.yml @@ -0,0 +1,106 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2024, Nordic Semiconductor ASA + +# A pykwalify schema for basic validation of the Zephyr build info YAML file. + +type: map +mapping: + version: + required: true + type: str + cmake: + type: map + mapping: + application: + type: map + mapping: + source-dir: + type: str + configuration-dir: + type: str + board: + type: map + mapping: + name: + required: true + type: str + qualifiers: + type: str + revision: + type: str + path: + type: seq + sequence: + - type: str + devicetree: + type: map + mapping: + files: + type: seq + sequence: + - type: str + user-files: + type: seq + sequence: + - type: str + extra-user-files: + type: seq + sequence: + - type: str + include-dirs: + type: seq + sequence: + - type: str + bindings-dirs: + type: seq + sequence: + - type: str + kconfig: + type: map + mapping: + files: + type: seq + sequence: + - type: str + user-files: + type: seq + sequence: + - type: str + extra-user-files: + type: seq + sequence: + - type: str + sysbuild: + type: bool + toolchain: + type: map + mapping: + name: + type: str + version: + type: str + path: + type: str + zephyr: + type: map + mapping: + zephyr-base: + type: str + version: + type: str + vendor-specific: + type: map + mapping: + regex;(.*): + type: map + mapping: + regex;(.*): + type: str + west: + type: map + mapping: + command: + type: str + topdir: + type: str From 24ee3912316ca53bbf27add2a98f06f6d8b12e1d Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Thu, 8 Aug 2024 21:23:28 +0200 Subject: [PATCH 0443/4482] west: support build info file for west build For pristine builds 'west build' will now create a build_info.yml file containing the west build command including arguments. This is done to help users and external tools to recreate builds. Signed-off-by: Torsten Rasmussen --- scripts/schemas/build-schema.yml | 2 ++ scripts/west_commands/build.py | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/scripts/schemas/build-schema.yml b/scripts/schemas/build-schema.yml index b4435a032d755..5086afbb25b17 100644 --- a/scripts/schemas/build-schema.yml +++ b/scripts/schemas/build-schema.yml @@ -104,3 +104,5 @@ mapping: type: str topdir: type: str + version: + type: str diff --git a/scripts/west_commands/build.py b/scripts/west_commands/build.py index 891a842bb8866..63cfa9cd5ec8f 100644 --- a/scripts/west_commands/build.py +++ b/scripts/west_commands/build.py @@ -11,6 +11,8 @@ from west import log from west.configuration import config +from west.util import west_topdir +from west.version import __version__ from zcmake import DEFAULT_CMAKE_GENERATOR, run_cmake, run_build, CMakeCache from build_helpers import is_zephyr_build, find_build_dir, load_domains, \ FIND_BUILD_DIR_DESCRIPTION @@ -22,6 +24,8 @@ SYSBUILD_PROJ_DIR = pathlib.Path(__file__).resolve().parent.parent.parent \ / pathlib.Path('share/sysbuild') +BUILD_INFO_LOG = 'build_info.yml' + BUILD_USAGE = '''\ west build [-h] [-b BOARD[@REV]]] [-d BUILD_DIR] [-S SNIPPET] [--shield SHIELD] @@ -244,9 +248,25 @@ def do_run(self, args, remainder): self.run_cmake = True else: self.run_cmake = True + self.source_dir = self._find_source_dir() self._sanity_check() + build_info_path = self.build_dir + build_info_file = os.path.join(build_info_path, BUILD_INFO_LOG) + west_workspace = west_topdir(self.source_dir) + if not os.path.exists(build_info_path): + os.makedirs(build_info_path) + if not os.path.exists(build_info_file): + build_command = {'west': {'command': ' '.join(sys.argv[:]), + 'topdir': str(west_workspace), + 'version': str(__version__)}} + try: + with open(build_info_file, "w") as f: + yaml.dump(build_command, f, default_flow_style=False) + except Exception as e: + log.wrn(f'Failed to create info file: {build_info_file},', e) + board, origin = self._find_board() self._run_cmake(board, origin, self.args.cmake_opts) if args.cmake_only: From 09faf537dd160ee64d4b159140f386452624f08b Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Fri, 9 Aug 2024 16:43:20 +0200 Subject: [PATCH 0444/4482] cmake: support build info in Zephyr Store informations regarding the current Zephyr build. The following informations are stored during CMake configure: - Board information - Application source directory - Application configuration directory - Toolchain information - Devicetree files - Kconfig config files - Zephyr version Signed-off-by: Torsten Rasmussen --- CMakeLists.txt | 7 +++++++ cmake/modules/FindHostTools.cmake | 3 +++ cmake/modules/boards.cmake | 4 ++++ cmake/modules/configuration_files.cmake | 2 ++ cmake/modules/dts.cmake | 6 ++++++ cmake/modules/kconfig.cmake | 3 +++ share/sysbuild/CMakeLists.txt | 7 +++++++ 7 files changed, 32 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c14f5f7f17a0e..3ce4b5ff1e9e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2235,3 +2235,10 @@ add_subdirectory_ifdef( ) toolchain_linker_finalize() + +yaml_context(EXISTS NAME build_info result) +if(result) + build_info(zephyr version VALUE ${PROJECT_VERSION_STR}) + build_info(zephyr zephyr-base VALUE ${ZEPHYR_BASE}) + yaml_save(NAME build_info) +endif() diff --git a/cmake/modules/FindHostTools.cmake b/cmake/modules/FindHostTools.cmake index 8d3c9eccaaf37..876a86934b140 100644 --- a/cmake/modules/FindHostTools.cmake +++ b/cmake/modules/FindHostTools.cmake @@ -114,3 +114,6 @@ set_ifndef(TOOLCHAIN_KCONFIG_DIR ${TOOLCHAIN_ROOT}/cmake/toolchain/${ZEPHYR_TOOL set(HostTools_FOUND TRUE) set(HOSTTOOLS_FOUND TRUE) +build_info(toolchain name VALUE ${ZEPHYR_TOOLCHAIN_VARIANT}) +string(TOUPPER ${ZEPHYR_TOOLCHAIN_VARIANT} zephyr_toolchain_variant_upper) +build_info(toolchain path VALUE "${${zephyr_toolchain_variant_upper}_TOOLCHAIN_PATH}") diff --git a/cmake/modules/boards.cmake b/cmake/modules/boards.cmake index d2c0666f2c576..a1b05b07b5754 100644 --- a/cmake/modules/boards.cmake +++ b/cmake/modules/boards.cmake @@ -369,3 +369,7 @@ if(BOARD_EXTENSIONS) list(APPEND BOARD_EXTENSION_DIRS ${board_extension_dir}) endforeach() endif() +build_info(board name VALUE ${BOARD}) +string(REGEX REPLACE "^/" "" qualifiers "${BOARD_QUALIFIERS}") +build_info(board qualifiers VALUE ${qualifiers}) +build_info(board revision VALUE ${BOARD_REVISION}) diff --git a/cmake/modules/configuration_files.cmake b/cmake/modules/configuration_files.cmake index 84af8c5b6353e..ff7a172445c38 100644 --- a/cmake/modules/configuration_files.cmake +++ b/cmake/modules/configuration_files.cmake @@ -99,3 +99,5 @@ zephyr_boilerplate_watch(DTC_OVERLAY_FILE) zephyr_get(EXTRA_CONF_FILE SYSBUILD LOCAL VAR EXTRA_CONF_FILE OVERLAY_CONFIG MERGE REVERSE) zephyr_get(EXTRA_DTC_OVERLAY_FILE SYSBUILD LOCAL MERGE REVERSE) zephyr_get(DTS_EXTRA_CPPFLAGS SYSBUILD LOCAL MERGE REVERSE) +build_info(application source-dir VALUE ${APPLICATION_SOURCE_DIR}) +build_info(application configuration-dir VALUE ${APPLICATION_CONFIG_DIR}) diff --git a/cmake/modules/dts.cmake b/cmake/modules/dts.cmake index c22761b9c7178..02fed1b4a8f58 100644 --- a/cmake/modules/dts.cmake +++ b/cmake/modules/dts.cmake @@ -188,6 +188,7 @@ set(dts_files if(DTC_OVERLAY_FILE) zephyr_list(TRANSFORM DTC_OVERLAY_FILE NORMALIZE_PATHS OUTPUT_VARIABLE DTC_OVERLAY_FILE_AS_LIST) + build_info(devicetree user-files VALUE ${DTC_OVERLAY_FILE_AS_LIST}) list(APPEND dts_files ${DTC_OVERLAY_FILE_AS_LIST} @@ -197,6 +198,7 @@ endif() if(EXTRA_DTC_OVERLAY_FILE) zephyr_list(TRANSFORM EXTRA_DTC_OVERLAY_FILE NORMALIZE_PATHS OUTPUT_VARIABLE EXTRA_DTC_OVERLAY_FILE_AS_LIST) + build_info(devicetree extra-user-files VALUE ${EXTRA_DTC_OVERLAY_FILE_AS_LIST}) list(APPEND dts_files ${EXTRA_DTC_OVERLAY_FILE_AS_LIST} @@ -413,3 +415,7 @@ elseif(stderr) message(WARNING "dtc raised one or more warnings:\n${stderr}") endif() endif(DTC) + +build_info(devicetree files VALUE ${dts_files}) +build_info(devicetree include-dirs VALUE ${DTS_ROOT_SYSTEM_INCLUDE_DIRS}) +build_info(devicetree bindings-dirs VALUE ${DTS_ROOT_BINDINGS}) diff --git a/cmake/modules/kconfig.cmake b/cmake/modules/kconfig.cmake index 3f374db5aea1d..3f7310aabb5db 100644 --- a/cmake/modules/kconfig.cmake +++ b/cmake/modules/kconfig.cmake @@ -95,11 +95,13 @@ set(PARSED_KCONFIG_SOURCES_TXT ${PROJECT_BINARY_DIR}/kconfig/sources.txt) if(CONF_FILE) string(CONFIGURE "${CONF_FILE}" CONF_FILE_EXPANDED) string(REPLACE " " ";" CONF_FILE_AS_LIST "${CONF_FILE_EXPANDED}") + build_info(kconfig user-files VALUE ${CONF_FILE_AS_LIST}) endif() if(EXTRA_CONF_FILE) string(CONFIGURE "${EXTRA_CONF_FILE}" EXTRA_CONF_FILE_EXPANDED) string(REPLACE " " ";" EXTRA_CONF_FILE_AS_LIST "${EXTRA_CONF_FILE_EXPANDED}") + build_info(kconfig extra-user-files VALUE ${EXTRA_CONF_FILE_AS_LIST}) endif() zephyr_file(CONF_FILES ${BOARD_EXTENSION_DIRS} KCONF board_extension_conf_files SUFFIX ${FILE_SUFFIX}) @@ -354,6 +356,7 @@ endif() if(CREATE_NEW_DOTCONFIG) set(input_configs_flags --handwritten-input-configs) set(input_configs ${merge_config_files} ${FORCED_CONF_FILE}) + build_info(kconfig files VALUE ${input_configs}) else() set(input_configs ${DOTCONFIG} ${FORCED_CONF_FILE}) endif() diff --git a/share/sysbuild/CMakeLists.txt b/share/sysbuild/CMakeLists.txt index 8370490fb9476..f2fbb4b271841 100644 --- a/share/sysbuild/CMakeLists.txt +++ b/share/sysbuild/CMakeLists.txt @@ -25,3 +25,10 @@ if(EXISTS ${APP_DIR}/sysbuild/CMakeLists.txt) else() add_subdirectory(template _sysbuild) endif() + +build_info(sysbuild VALUE true) +build_info(application source-dir VALUE ${CMAKE_CURRENT_SOURCE_DIR}) +yaml_context(EXISTS NAME build_info result) +if(result) + yaml_save(NAME build_info) +endif() From 46a3e61bc7c04e2cd609f64804b34ff4d29628a0 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Thu, 22 Aug 2024 16:07:31 +0200 Subject: [PATCH 0445/4482] cmake: nordic: save build information regarding SVD file used. Save information regarding SVD file in use in vendor-specific section of the build info file. Information is stored under Nordic section. Signed-off-by: Torsten Rasmussen --- modules/hal_nordic/nrfx/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 8d7adc114d74f..cb4fe5f43d912 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -243,3 +243,4 @@ mdk_svd_ifdef(CONFIG_SOC_NRF9160 nrf9160.svd) mdk_svd_ifdef(CONFIG_SOC_NRF9230_ENGB_CPUAPP nrf9230_engb_application.svd) mdk_svd_ifdef(CONFIG_SOC_NRF9230_ENGB_CPUPPR nrf9230_engb_ppr.svd) mdk_svd_ifdef(CONFIG_SOC_NRF9230_ENGB_CPURAD nrf9230_engb_radiocore.svd) +build_info(vendor-specific nordic svdfile VALUE ${SOC_SVD_FILE}) From 890787ded36c1f5951ecf6904807c4f174ae7168 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 25 Sep 2024 11:04:16 +0100 Subject: [PATCH 0446/4482] modules: mcuboot: Add Kconfig for firmware updater image Adds a Kconfig which can be selected when building for firmware updater mode to select if this is the application or the firmware updater image that is being built Signed-off-by: Jamie McCrae --- modules/Kconfig.mcuboot | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/Kconfig.mcuboot b/modules/Kconfig.mcuboot index b46c709d8ef44..cce19b52d8480 100644 --- a/modules/Kconfig.mcuboot +++ b/modules/Kconfig.mcuboot @@ -256,6 +256,16 @@ config MCUBOOT_BOOTLOADER_NO_DOWNGRADE MCUBOOT_DOWNGRADE_PREVENTION option enabled. endif +config MCUBOOT_APPLICATION_FIRMWARE_UPDATER + bool "Application is firmware updater image" + depends on MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER + help + Select this if the current image is the firmware updater image. This will use slot 1 + information when signing the image. + + Note that the zephyr chosen node ``zephyr,code-partition`` should be set to + ``slot1_partition`` for this image. + endmenu # On board MCUboot operation mode endif # BOOTLOADER_MCUBOOT From c952f09a797e0b77a131b776daac25316a06051f Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 25 Sep 2024 11:06:45 +0100 Subject: [PATCH 0447/4482] cmake: mcuboot: Use imgtool instead of west for signing Uses imgtool directly to sign images instead of calling west sign, this also removes the MCUBOOT_CMAKE_WEST_SIGN_PARAMS Kconfig option as this has no effect Signed-off-by: Jamie McCrae --- cmake/mcuboot.cmake | 81 +++++++++++++++++++++-------------------- modules/Kconfig.mcuboot | 12 ------ 2 files changed, 41 insertions(+), 52 deletions(-) diff --git a/cmake/mcuboot.cmake b/cmake/mcuboot.cmake index 6dd0717f51578..6d3708033c216 100644 --- a/cmake/mcuboot.cmake +++ b/cmake/mcuboot.cmake @@ -73,12 +73,25 @@ function(zephyr_mcuboot_tasks) return() endif() - # Basic 'west sign' command and output format independent arguments. - separate_arguments(west_sign_extra UNIX_COMMAND ${CONFIG_MCUBOOT_CMAKE_WEST_SIGN_PARAMS}) - set(west_sign ${WEST} sign ${west_sign_extra} - --tool imgtool - --tool-path "${imgtool_path}" - --build-dir "${APPLICATION_BINARY_DIR}") + # Fetch devicetree details for flash and slot information + dt_chosen(flash_node PROPERTY "zephyr,flash") + dt_nodelabel(slot0_flash NODELABEL "slot0_partition") + dt_prop(slot_size PATH "${slot0_flash}" PROPERTY "reg" INDEX 1) + dt_prop(write_block_size PATH "${flash_node}" PROPERTY "write-block-size") + + # If single slot mode, or if in firmware updater mode and this is the firmware updater image, + # use slot 0 information + if(NOT CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP AND (NOT CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER OR CONFIG_MCUBOOT_APPLICATION_FIRMWARE_UPDATER)) + # Slot 1 size is used instead of slot 0 size + set(slot_size) + dt_nodelabel(slot1_flash NODELABEL "slot1_partition") + dt_prop(slot_size PATH "${slot1_flash}" PROPERTY "reg" INDEX 1) + endif() + + # Basic 'imgtool sign' command with known image information. + set(imgtool_sign ${PYTHON_EXECUTABLE} ${imgtool_path} sign + --version ${CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION} --header-size ${CONFIG_ROM_START_OFFSET} + --slot-size ${slot_size}) # Arguments to imgtool. if(NOT CONFIG_MCUBOOT_EXTRA_IMGTOOL_ARGS STREQUAL "") @@ -87,102 +100,90 @@ function(zephyr_mcuboot_tasks) # # Use UNIX_COMMAND syntax for uniform results across host # platforms. - separate_arguments(imgtool_extra UNIX_COMMAND ${CONFIG_MCUBOOT_EXTRA_IMGTOOL_ARGS}) + separate_arguments(imgtool_args UNIX_COMMAND ${CONFIG_MCUBOOT_EXTRA_IMGTOOL_ARGS}) else() - set(imgtool_extra) + set(imgtool_args) endif() if(NOT "${keyfile}" STREQUAL "") - set(imgtool_extra --key "${keyfile}" ${imgtool_extra}) + set(imgtool_args --key "${keyfile}" ${imgtool_args}) endif() # Use overwrite-only instead of swap upgrades. if(CONFIG_MCUBOOT_IMGTOOL_OVERWRITE_ONLY) - set(imgtool_extra --overwrite-only --align 1 ${imgtool_extra}) + set(imgtool_args --overwrite-only --align 1 ${imgtool_args}) + else() + set(imgtool_args --align ${write_block_size} ${imgtool_args}) endif() - set(imgtool_args -- ${imgtool_extra}) - # Extensionless prefix of any output file. set(output ${ZEPHYR_BINARY_DIR}/${KERNEL_NAME}) # List of additional build byproducts. set(byproducts) - # 'west sign' arguments for confirmed, unconfirmed and encrypted images. - set(unconfirmed_args) - set(confirmed_args) - set(encrypted_args) - # Set up .bin outputs. if(CONFIG_BUILD_OUTPUT_BIN) - list(APPEND unconfirmed_args --bin --sbin ${output}.signed.bin) list(APPEND byproducts ${output}.signed.bin) zephyr_runner_file(bin ${output}.signed.bin) set(BYPRODUCT_KERNEL_SIGNED_BIN_NAME "${output}.signed.bin" CACHE FILEPATH "Signed kernel bin file" FORCE ) + set_property(GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND + ${imgtool_sign} ${imgtool_args} ${output}.bin ${output}.signed.bin) if(CONFIG_MCUBOOT_GENERATE_CONFIRMED_IMAGE) - list(APPEND confirmed_args --bin --sbin ${output}.signed.confirmed.bin) list(APPEND byproducts ${output}.signed.confirmed.bin) set(BYPRODUCT_KERNEL_SIGNED_CONFIRMED_BIN_NAME "${output}.signed.confirmed.bin" CACHE FILEPATH "Signed and confirmed kernel bin file" FORCE ) + set_property(GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND + ${imgtool_sign} ${imgtool_args} --pad --confirm ${output}.bin + ${output}.signed.confirmed.bin) endif() if(NOT "${keyfile_enc}" STREQUAL "") - list(APPEND encrypted_args --bin --sbin ${output}.signed.encrypted.bin) list(APPEND byproducts ${output}.signed.encrypted.bin) set(BYPRODUCT_KERNEL_SIGNED_ENCRYPTED_BIN_NAME "${output}.signed.encrypted.bin" CACHE FILEPATH "Signed and encrypted kernel bin file" FORCE ) + set_property(GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND + ${imgtool_sign} ${imgtool_args} --encrypt "${keyfile_enc}" ${output}.bin + ${output}.signed.encrypted.bin) endif() endif() # Set up .hex outputs. if(CONFIG_BUILD_OUTPUT_HEX) - list(APPEND unconfirmed_args --hex --shex ${output}.signed.hex) list(APPEND byproducts ${output}.signed.hex) zephyr_runner_file(hex ${output}.signed.hex) set(BYPRODUCT_KERNEL_SIGNED_HEX_NAME "${output}.signed.hex" CACHE FILEPATH "Signed kernel hex file" FORCE ) + set_property(GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND + ${imgtool_sign} ${imgtool_args} ${output}.hex ${output}.signed.hex) if(CONFIG_MCUBOOT_GENERATE_CONFIRMED_IMAGE) - list(APPEND confirmed_args --hex --shex ${output}.signed.confirmed.hex) list(APPEND byproducts ${output}.signed.confirmed.hex) set(BYPRODUCT_KERNEL_SIGNED_CONFIRMED_HEX_NAME "${output}.signed.confirmed.hex" CACHE FILEPATH "Signed and confirmed kernel hex file" FORCE ) + set_property(GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND + ${imgtool_sign} ${imgtool_args} --pad --confirm ${output}.hex + ${output}.signed.confirmed.hex) endif() if(NOT "${keyfile_enc}" STREQUAL "") - list(APPEND encrypted_args --hex --shex ${output}.signed.encrypted.hex) list(APPEND byproducts ${output}.signed.encrypted.hex) set(BYPRODUCT_KERNEL_SIGNED_ENCRYPTED_HEX_NAME "${output}.signed.encrypted.hex" CACHE FILEPATH "Signed and encrypted kernel hex file" FORCE ) + set_property(GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND + ${imgtool_sign} ${imgtool_args} --encrypt "${keyfile_enc}" ${output}.hex + ${output}.signed.encrypted.hex) endif() endif() - # Add the west sign calls and their byproducts to the post-processing - # steps for zephyr.elf. - # - # CMake guarantees that multiple COMMANDs given to - # add_custom_command() are run in order, so adding the 'west sign' - # calls to the "extra_post_build_commands" property ensures they run - # after the commands which generate the unsigned versions. - set_property(GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND - ${west_sign} ${unconfirmed_args} ${imgtool_args}) - if(confirmed_args) - set_property(GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND - ${west_sign} ${confirmed_args} ${imgtool_args} --pad --confirm) - endif() - if(encrypted_args) - set_property(GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND - ${west_sign} ${encrypted_args} ${imgtool_args} --encrypt "${keyfile_enc}") - endif() set_property(GLOBAL APPEND PROPERTY extra_post_build_byproducts ${byproducts}) endfunction() diff --git a/modules/Kconfig.mcuboot b/modules/Kconfig.mcuboot index cce19b52d8480..a914ff1d5a84b 100644 --- a/modules/Kconfig.mcuboot +++ b/modules/Kconfig.mcuboot @@ -35,18 +35,6 @@ config BOOTLOADER_MCUBOOT if BOOTLOADER_MCUBOOT -config MCUBOOT_CMAKE_WEST_SIGN_PARAMS - string "Extra parameters to west sign" - default "--quiet" - help - Parameters that are passed by cmake to west sign, just after - the command, before all other parameters needed for image - signing. - By default this is set to "--quiet" to prevent extra, non-error, - diagnostic messages from west sign. This does not affect signing - tool for which extra parameters are passed with - MCUBOOT_EXTRA_IMGTOOL_ARGS. - config MCUBOOT_SIGNATURE_KEY_FILE string "Path to the mcuboot signing key file" default "" From 5ff1088a16a07a640bab15753ad20ed3b24c427c Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 25 Sep 2024 11:09:39 +0100 Subject: [PATCH 0448/4482] doc: release: 3.4: Remove Kconfig option usage for removed Kconfig Removes the Kconfig extension function around a Kconfig that has been removed Signed-off-by: Jamie McCrae --- doc/releases/release-notes-3.4.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/releases/release-notes-3.4.rst b/doc/releases/release-notes-3.4.rst index 3b96c3e8bb8c0..b57975a602065 100644 --- a/doc/releases/release-notes-3.4.rst +++ b/doc/releases/release-notes-3.4.rst @@ -1406,7 +1406,7 @@ MCUboot interactive Kconfig interfaces, the MCUboot options will now be located under ``Modules`` instead of under ``Boot Options``. -* Added :kconfig:option:`CONFIG_MCUBOOT_CMAKE_WEST_SIGN_PARAMS` that allows to pass arguments to +* Added ``CONFIG_MCUBOOT_CMAKE_WEST_SIGN_PARAMS`` that allows to pass arguments to west sign when invoked from cmake. Storage From 5a48685683d9e107127014c0c6d4b8f83ea4f858 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 25 Sep 2024 11:38:28 +0100 Subject: [PATCH 0449/4482] doc: release: 3.4: Use double backticks Fixes a compliance error Signed-off-by: Jamie McCrae --- doc/releases/release-notes-3.4.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/releases/release-notes-3.4.rst b/doc/releases/release-notes-3.4.rst index b57975a602065..a8c3b6608e97a 100644 --- a/doc/releases/release-notes-3.4.rst +++ b/doc/releases/release-notes-3.4.rst @@ -253,7 +253,7 @@ Deprecated in this release Stable API changes in this release ================================== -* Removed `bt_set_oob_data_flag` and replaced it with two new API calls: +* Removed ``bt_set_oob_data_flag`` and replaced it with two new API calls: * :c:func:`bt_le_oob_set_sc_flag` for setting/clearing OOB flag in SC pairing * :c:func:`bt_le_oob_set_legacy_flag` for setting/clearing OOB flag in legacy paring @@ -723,7 +723,7 @@ Build system and infrastructure * Babblesim is now included in the west manifest. Users can fetch it by enabling the ``babblesim`` group with west config. -* `west sign` now uses DT labels, of "fixed-partition" compatible nodes, to identify +* ``west sign`` now uses DT labels, of "fixed-partition" compatible nodes, to identify application image slots, instead of previously used DT node label properties. If you have been using custom partition layout for MCUboot, you will have to label your MCUboot slot partitions with proper DT node labels; for example partition From dd7ce12d68dd98ec837935a19e54ffa7f2edfcb5 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 25 Sep 2024 11:21:40 +0100 Subject: [PATCH 0450/4482] scripts: west_commands: sign: Deprecate imgtool signing Deprecates signing for imgtool using west sign Signed-off-by: Jamie McCrae --- scripts/west_commands/sign.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/west_commands/sign.py b/scripts/west_commands/sign.py index 54fbe75d8fde7..5efbfa5e73139 100644 --- a/scripts/west_commands/sign.py +++ b/scripts/west_commands/sign.py @@ -129,7 +129,7 @@ def do_add_parser(self, parser_adder): group = parser.add_argument_group('tool control options') group.add_argument('-t', '--tool', choices=['imgtool', 'rimage'], help='''image signing tool name; imgtool and rimage - are currently supported''') + are currently supported (imgtool is deprecated)''') group.add_argument('-p', '--tool-path', default=None, help='''path to the tool itself, if needed''') group.add_argument('-D', '--tool-data', default=None, @@ -246,6 +246,8 @@ def sign(self, command, build_dir, build_conf, formats): args = command.args b = pathlib.Path(build_dir) + log.wrn("west sign using imgtool is deprecated and will be removed in a future release") + imgtool = self.find_imgtool(command, args) # The vector table offset and application version are set in Kconfig: appver = self.get_cfg(command, build_conf, 'CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION') From d1f8b6a0aba3aaefb85c64959a4cca93b67cddff Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 25 Sep 2024 11:22:45 +0100 Subject: [PATCH 0451/4482] doc: release: 4.0: Add note on imgtool west sign change Adds a note that the build system now uses imgtool directly Signed-off-by: Jamie McCrae --- doc/releases/release-notes-4.0.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 6e1b0726ab071..dc65e577d5d7f 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -148,6 +148,9 @@ Build system and Infrastructure * ``--vendor-prefixes`` * ``--edtlib-Werror`` +* Switched to using imgtool directly from the build system when signing images instead of calling + ``west sign``. + Documentation ************* From fba029c99fa61b12240383f2a70c3d5838656845 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 25 Sep 2024 11:23:40 +0100 Subject: [PATCH 0452/4482] doc: migration: 4.0: Add notes on deprecation of imgtool west sign Adds details on the deprecation of this feature Signed-off-by: Jamie McCrae --- doc/releases/migration-guide-4.0.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 5a2d2566a8dc5..0629467b26d22 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -18,6 +18,12 @@ the :ref:`release notes`. Build System ************ +* Removed the ``CONFIG_MCUBOOT_CMAKE_WEST_SIGN_PARAMS`` Kconfig option as ``west sign`` is no + longer called by the build system when signing images for MCUboot. + +* The imgtool part of ``west sign`` has been deprecated, options to be supplied to imgtool when + signing should be set in :kconfig:option:`CONFIG_MCUBOOT_EXTRA_IMGTOOL_ARGS` instead. + Kernel ****** From 1df078158fc766185a5cf6575684d6a2c560e313 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 26 Sep 2024 08:04:54 +0100 Subject: [PATCH 0453/4482] doc: build: Add signing page Adds a signing page under build, which contains information on how to sign images from the build system, this removes the old details for using west sign with imgtool from the west sign page Signed-off-by: Jamie McCrae --- cmake/mcuboot.cmake | 13 ++-- doc/build/index.rst | 1 + doc/build/signing/index.rst | 108 ++++++++++++++++++++++++++++++ doc/develop/west/sign.rst | 127 ------------------------------------ 4 files changed, 118 insertions(+), 131 deletions(-) create mode 100644 doc/build/signing/index.rst diff --git a/cmake/mcuboot.cmake b/cmake/mcuboot.cmake index 6d3708033c216..25fa1827f33f7 100644 --- a/cmake/mcuboot.cmake +++ b/cmake/mcuboot.cmake @@ -75,17 +75,22 @@ function(zephyr_mcuboot_tasks) # Fetch devicetree details for flash and slot information dt_chosen(flash_node PROPERTY "zephyr,flash") - dt_nodelabel(slot0_flash NODELABEL "slot0_partition") - dt_prop(slot_size PATH "${slot0_flash}" PROPERTY "reg" INDEX 1) + dt_nodelabel(slot0_flash NODELABEL "slot0_partition" REQUIRED) + dt_prop(slot_size PATH "${slot0_flash}" PROPERTY "reg" INDEX 1 REQUIRED) dt_prop(write_block_size PATH "${flash_node}" PROPERTY "write-block-size") + if(NOT write_block_size) + set(write_block_size 4) + message(WARNING "slot0_partition write block size devicetree parameter is missing, assuming write block size is 4") + endif() + # If single slot mode, or if in firmware updater mode and this is the firmware updater image, # use slot 0 information if(NOT CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP AND (NOT CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER OR CONFIG_MCUBOOT_APPLICATION_FIRMWARE_UPDATER)) # Slot 1 size is used instead of slot 0 size set(slot_size) - dt_nodelabel(slot1_flash NODELABEL "slot1_partition") - dt_prop(slot_size PATH "${slot1_flash}" PROPERTY "reg" INDEX 1) + dt_nodelabel(slot1_flash NODELABEL "slot1_partition" REQUIRED) + dt_prop(slot_size PATH "${slot1_flash}" PROPERTY "reg" INDEX 1 REQUIRED) endif() # Basic 'imgtool sign' command with known image information. diff --git a/doc/build/index.rst b/doc/build/index.rst index 91bf4c6018c1f..63e3bcc6dce02 100644 --- a/doc/build/index.rst +++ b/doc/build/index.rst @@ -16,3 +16,4 @@ Build and Configuration Systems sysbuild/index.rst version/index.rst flashing/index.rst + signing/index.rst diff --git a/doc/build/signing/index.rst b/doc/build/signing/index.rst new file mode 100644 index 0000000000000..03cd5fedc679e --- /dev/null +++ b/doc/build/signing/index.rst @@ -0,0 +1,108 @@ +.. _build-signing: + +Signing Binaries +################ + +Binaries can be optionally signed as part of a build automatically using CMake code, there is +also the ability to use ``west sign`` to sign binaries too, this page describes the former, the +latter is documented on :ref:`west-sign`. + +MCUboot / imgtool +***************** + +The Zephyr build system has special support for signing binaries for use with the `MCUboot`_ +bootloader using the `imgtool`_ program provided by its developers. You can both build and sign +this type of application binary in one step by setting some Kconfig options. If you do, +``west flash`` will use the signed binaries. + +Here is an example workflow, which builds and flashes MCUboot, as well as the +:zephyr:code-sample:`hello_world` application for chain-loading by MCUboot. Run these commands +from the :file:`zephyrproject` workspace you created in the :ref:`getting_started`. + +.. code-block:: console + + west build -b YOUR_BOARD zephyr/samples/hello_world --sysbuild -d build-hello-signed -- \ + -DSB_CONFIG_BOOTLOADER_MCUBOOT=y + + west flash -d build-hello-signed + +Notes on the above commands: + +- ``YOUR_BOARD`` should be changed to match your board +- The singing key value is the insecure default provided and used by MCUboot for development + and testing +- You can change the ``hello_world`` application directory to any other application that can be + loaded by MCUboot, such as the :zephyr:code-sample:`smp-svr` sample. + +For more information on these and other related configuration options, see: + +- ``SB_CONFIG_BOOTLOADER_MCUBOOT``: build the application for loading by MCUboot +- ``SB_CONFIG_BOOT_SIGNATURE_KEY_FILE``: the key file to use when singing images. If you have + your own key, change this appropriately +- :kconfig:option:`CONFIG_MCUBOOT_EXTRA_IMGTOOL_ARGS`: optional additional command line arguments + for ``imgtool`` +- :kconfig:option:`CONFIG_MCUBOOT_GENERATE_CONFIRMED_IMAGE`: also generate a confirmed image, + which may be more useful for flashing in production environments than the OTA-able default image +- On Windows, if you get "Access denied" issues, the recommended fix is to run + ``pip3 install imgtool``, then retry with a pristine build directory. + +If your ``west flash`` :ref:`runner ` uses an image format supported by imgtool, you +should see something like this on your device's serial console when you run +``west flash -d build-hello-signed``: + +.. code-block:: none + + *** Booting Zephyr OS build zephyr-v2.3.0-2310-gcebac69c8ae1 *** + [00:00:00.004,669] mcuboot: Starting bootloader + [00:00:00.011,169] mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3 + [00:00:00.021,636] mcuboot: Boot source: none + [00:00:00.027,374] mcuboot: Swap type: none + [00:00:00.115,142] mcuboot: Bootloader chainload address offset: 0xc000 + [00:00:00.123,168] mcuboot: Jumping to the first image slot + *** Booting Zephyr OS build zephyr-v2.3.0-2310-gcebac69c8ae1 *** + Hello World! nrf52840dk_nrf52840 + +Whether ``west flash`` supports this feature depends on your runner. The ``nrfjprog`` and +``pyocd`` runners work with the above flow. If your runner does not support this flow and you +would like it to, please send a patch or file an issue for adding support. + +.. _west-extending-signing: + +Extending signing externally +**************************** + +The signing script used when running ``west flash`` can be extended or replaced to change features +or introduce different signing mechanisms. By default with MCUboot enabled, signing is setup by +the :file:`cmake/mcuboot.cmake` file in Zephyr which adds extra post build commands for generating +the signed images. The file used for signing can be replaced from a sysbuild scope (if being used) +or from a zephyr/zephyr module scope, the priority of which is: + +* Sysbuild +* Zephyr property +* Default MCUboot script (if enabled) + +From sysbuild, ``-D_SIGNING_SCRIPT`` can be used to set a signing script for a specific +image or ``-DSIGNING_SCRIPT`` can be used to set a signing script for all images, for example: + +.. code-block:: console + + west build -b -DSIGNING_SCRIPT= + +The zephyr property method is achieved by adjusting the ``SIGNING_SCRIPT`` property on the +``zephyr_property_target``, ideally from by a module by using: + +.. code-block:: cmake + + if(CONFIG_BOOTLOADER_MCUBOOT) + set_target_properties(zephyr_property_target PROPERTIES SIGNING_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/custom_signing.cmake) + endif() + +This will include the custom signing CMake file instead of the default Zephyr one when projects +are built with MCUboot signing support enabled. The base Zephyr MCUboot signing file can be +used as a reference for creating a new signing system or extending the default behaviour. + +.. _MCUboot: + https://mcuboot.com/ + +.. _imgtool: + https://pypi.org/project/imgtool/ diff --git a/doc/develop/west/sign.rst b/doc/develop/west/sign.rst index 7de7bf7de1dd7..9b17bf025bb10 100644 --- a/doc/develop/west/sign.rst +++ b/doc/develop/west/sign.rst @@ -9,133 +9,6 @@ external tool. In some configurations, ``west sign`` is also used to invoke an external, post-processing tool that "stitches" the final components of the image together. Run ``west sign -h`` for command line help. -MCUboot / imgtool -***************** - -The Zephyr build system has special support for signing binaries for use with -the `MCUboot`_ bootloader using the `imgtool`_ program provided by its -developers. You can both build and sign this type of application binary in one -step by setting some Kconfig options. If you do, ``west flash`` will use the -signed binaries. - -If you use this feature, you don't need to run ``west sign`` yourself; the -build system will do it for you. - -Here is an example workflow, which builds and flashes MCUboot, as well as the -:zephyr:code-sample:`hello_world` application for chain-loading by MCUboot. Run these commands -from the :file:`zephyrproject` workspace you created in the -:ref:`getting_started`. - -.. code-block:: console - - west build -b YOUR_BOARD bootloader/mcuboot/boot/zephyr -d build-mcuboot - west build -b YOUR_BOARD zephyr/samples/hello_world -d build-hello-signed -- \ - -DCONFIG_BOOTLOADER_MCUBOOT=y \ - -DCONFIG_MCUBOOT_SIGNATURE_KEY_FILE=\"bootloader/mcuboot/root-rsa-2048.pem\" - - west flash -d build-mcuboot - west flash -d build-hello-signed - -Notes on the above commands: - -- ``YOUR_BOARD`` should be changed to match your board -- The ``CONFIG_MCUBOOT_SIGNATURE_KEY_FILE`` value is the insecure default - provided and used by MCUboot for development and testing -- You can change the ``hello_world`` application directory to any other - application that can be loaded by MCUboot, such as the :zephyr:code-sample:`smp-svr` sample. - -For more information on these and other related configuration options, see: - -- :kconfig:option:`CONFIG_BOOTLOADER_MCUBOOT`: build the application for loading by - MCUboot -- :kconfig:option:`CONFIG_MCUBOOT_SIGNATURE_KEY_FILE`: the key file to use with ``west - sign``. If you have your own key, change this appropriately -- :kconfig:option:`CONFIG_MCUBOOT_EXTRA_IMGTOOL_ARGS`: optional additional command line - arguments for ``imgtool`` -- :kconfig:option:`CONFIG_MCUBOOT_GENERATE_CONFIRMED_IMAGE`: also generate a confirmed - image, which may be more useful for flashing in production environments than - the OTA-able default image -- On Windows, if you get "Access denied" issues, the recommended fix is - to run ``pip3 install imgtool``, then retry with a pristine build directory. - -If your ``west flash`` :ref:`runner ` uses an image format -supported by imgtool, you should see something like this on your device's -serial console when you run ``west flash -d build-mcuboot``: - -.. code-block:: none - - *** Booting Zephyr OS build zephyr-v2.3.0-2310-gcebac69c8ae1 *** - [00:00:00.004,669] mcuboot: Starting bootloader - [00:00:00.011,169] mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3 - [00:00:00.021,636] mcuboot: Boot source: none - [00:00:00.027,313] mcuboot: Failed reading image headers; Image=0 - [00:00:00.035,064] mcuboot: Unable to find bootable image - -Then, you should see something like this when you run ``west flash -d -build-hello-signed``: - -.. code-block:: none - - *** Booting Zephyr OS build zephyr-v2.3.0-2310-gcebac69c8ae1 *** - [00:00:00.004,669] mcuboot: Starting bootloader - [00:00:00.011,169] mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3 - [00:00:00.021,636] mcuboot: Boot source: none - [00:00:00.027,374] mcuboot: Swap type: none - [00:00:00.115,142] mcuboot: Bootloader chainload address offset: 0xc000 - [00:00:00.123,168] mcuboot: Jumping to the first image slot - *** Booting Zephyr OS build zephyr-v2.3.0-2310-gcebac69c8ae1 *** - Hello World! nrf52840dk_nrf52840 - -Whether ``west flash`` supports this feature depends on your runner. The -``nrfjprog`` and ``pyocd`` runners work with the above flow. If your runner -does not support this flow and you would like it to, please send a patch or -file an issue for adding support. - -.. _west-extending-signing: - -Extending signing externally -**************************** - -The signing script used when running ``west flash`` can be extended or replaced -to change features or introduce different signing mechanisms. By default with -MCUboot enabled, signing is setup by the :file:`cmake/mcuboot.cmake` file in -Zephyr which adds extra post build commands for generating the signed images. -The file used for signing can be replaced from a sysbuild scope (if being used) -or from a zephyr/zephyr module scope, the priority of which is: - -* Sysbuild -* Zephyr property -* Default MCUboot script (if enabled) - -From sysbuild, ``-D_SIGNING_SCRIPT`` can be used to set a signing script -for a specific image or ``-DSIGNING_SCRIPT`` can be used to set a signing script -for all images, for example: - -.. code-block:: console - - west build -b -DSIGNING_SCRIPT= - -The zephyr property method is achieved by adjusting the ``SIGNING_SCRIPT`` property -on the ``zephyr_property_target``, ideally from by a module by using: - -.. code-block:: cmake - - if(CONFIG_BOOTLOADER_MCUBOOT) - set_target_properties(zephyr_property_target PROPERTIES SIGNING_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/custom_signing.cmake) - endif() - -This will include the custom signing CMake file instead of the default Zephyr -one when projects are built with MCUboot signing support enabled. The base -Zephyr MCUboot signing file can be used as a reference for creating a new -signing system or extending the default behaviour. - -.. _MCUboot: - https://mcuboot.com/ - -.. _imgtool: - https://pypi.org/project/imgtool/ - - rimage ****** From 7cd87ea1f773d08c5f286ee3a06464b5514e4b68 Mon Sep 17 00:00:00 2001 From: Abderrahmane Jarmouni Date: Sun, 22 Sep 2024 21:16:10 +0200 Subject: [PATCH 0454/4482] boards: stm32h750b_dk: update doc & board file Update board's doc & yaml file with enabled features. Signed-off-by: Abderrahmane Jarmouni --- boards/st/stm32h750b_dk/doc/index.rst | 9 ++++++++- boards/st/stm32h750b_dk/stm32h750b_dk.yaml | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/boards/st/stm32h750b_dk/doc/index.rst b/boards/st/stm32h750b_dk/doc/index.rst index d3fc2c252f419..a2b09e45fd726 100644 --- a/boards/st/stm32h750b_dk/doc/index.rst +++ b/boards/st/stm32h750b_dk/doc/index.rst @@ -59,7 +59,14 @@ The current Zephyr stm32h750b_dk board configuration supports the following hard +-----------+------------+-------------------------------------+ | RTC | on-chip | rtc | +-----------+------------+-------------------------------------+ - +| ADC | on-chip | adc | ++-----------+------------+-------------------------------------+ +| LTDC | on-chip | display | ++-----------+------------+-------------------------------------+ +| QSPI NOR | on-chip | off-chip flash | ++-----------+------------+-------------------------------------+ +| FMC | on-chip | memc (SDRAM) | ++-----------+------------+-------------------------------------+ Other hardware features are not yet supported on Zephyr porting. diff --git a/boards/st/stm32h750b_dk/stm32h750b_dk.yaml b/boards/st/stm32h750b_dk/stm32h750b_dk.yaml index 2ef5ca14dcd01..da7d087b0605c 100644 --- a/boards/st/stm32h750b_dk/stm32h750b_dk.yaml +++ b/boards/st/stm32h750b_dk/stm32h750b_dk.yaml @@ -15,4 +15,6 @@ supported: - flash - rtc - memc + - display + - spi vendor: st From 47c8815253d789e51de0816512ce0e454e832290 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Mon, 16 Sep 2024 23:54:10 +0200 Subject: [PATCH 0455/4482] modbus: fix support for floating point values The Modbus protocol object types are either single-bit or 16-bit word. Other types are not defined in the specification. Types such as float are typically mapped to two 16-bit registers. Current implementaiton does not maps correctly to the 16-bit word addresses. On the client side, the implementation must take into account that the number of requested registers (Quantity of Registers) is double that of a "float" register. The server side should not treat "Quantity of Registers" and "Byte count" differently for addresses reserved for floating values, only in the user callback the two 16-bit registers are mapped to a float value but still aligned to 16-bit register addresses. Signed-off-by: Johann Fischer --- subsys/modbus/modbus_client.c | 10 +- subsys/modbus/modbus_server.c | 103 +++++++++---------- tests/subsys/modbus/src/test_modbus_client.c | 10 +- tests/subsys/modbus/src/test_modbus_server.c | 16 ++- 4 files changed, 73 insertions(+), 66 deletions(-) diff --git a/subsys/modbus/modbus_client.c b/subsys/modbus/modbus_client.c index 3db82db9eecda..62ebe157846d3 100644 --- a/subsys/modbus/modbus_client.c +++ b/subsys/modbus/modbus_client.c @@ -64,14 +64,14 @@ static int mbc_validate_fc03fp_response(struct modbus_context *ctx, float *ptbl) resp_byte_cnt = ctx->rx_adu.data[0]; resp_data = &ctx->rx_adu.data[1]; req_qty = sys_get_be16(&ctx->tx_adu.data[2]); - req_byte_cnt = req_qty * sizeof(float); + req_byte_cnt = req_qty * sizeof(uint16_t); if (req_byte_cnt != resp_byte_cnt) { LOG_ERR("Mismatch in the number of registers"); return -EINVAL; } - for (uint16_t i = 0; i < req_qty; i++) { + for (uint16_t i = 0; i < req_qty / 2; i++) { uint32_t reg_val = sys_get_be32(resp_data); memcpy(&ptbl[i], ®_val, sizeof(float)); @@ -384,7 +384,8 @@ int modbus_read_holding_regs_fp(const int iface, ctx->tx_adu.length = 4; sys_put_be16(start_addr, &ctx->tx_adu.data[0]); - sys_put_be16(num_regs, &ctx->tx_adu.data[2]); + /* A 32-bit float is mapped to two 16-bit registers */ + sys_put_be16(num_regs * 2, &ctx->tx_adu.data[2]); err = mbc_send_cmd(ctx, unit_id, MODBUS_FC03_HOLDING_REG_RD, reg_buf); k_mutex_unlock(&ctx->iface_lock); @@ -610,7 +611,8 @@ int modbus_write_holding_regs_fp(const int iface, sys_put_be16(start_addr, &ctx->tx_adu.data[0]); length += sizeof(start_addr); - sys_put_be16(num_regs, &ctx->tx_adu.data[2]); + /* A 32-bit float is mapped to two 16-bit registers */ + sys_put_be16(num_regs * 2, &ctx->tx_adu.data[2]); length += sizeof(num_regs); num_bytes = num_regs * sizeof(float); diff --git a/subsys/modbus/modbus_server.c b/subsys/modbus/modbus_server.c index 4805526b2d652..30001144ab3b8 100644 --- a/subsys/modbus/modbus_server.c +++ b/subsys/modbus/modbus_server.c @@ -322,6 +322,16 @@ static bool mbs_fc03_hreg_read(struct modbus_context *ctx) reg_addr = sys_get_be16(&ctx->rx_adu.data[0]); reg_qty = sys_get_be16(&ctx->rx_adu.data[2]); + if (reg_qty == 0 || reg_qty > regs_limit) { + LOG_ERR("Wrong register quantity, %u (limit is %u)", + reg_qty, regs_limit); + mbs_exception_rsp(ctx, MODBUS_EXC_ILLEGAL_DATA_VAL); + return true; + } + + /* Get number of bytes needed for response. */ + num_bytes = (uint8_t)(reg_qty * sizeof(uint16_t)); + if ((reg_addr < MODBUS_FP_EXTENSIONS_ADDR) || !IS_ENABLED(CONFIG_MODBUS_FP_EXTENSIONS)) { /* Read integer register */ @@ -330,14 +340,6 @@ static bool mbs_fc03_hreg_read(struct modbus_context *ctx) return true; } - if (reg_qty == 0 || reg_qty > regs_limit) { - LOG_ERR("Number of registers limit exceeded"); - mbs_exception_rsp(ctx, MODBUS_EXC_ILLEGAL_DATA_VAL); - return true; - } - - /* Get number of bytes needed for response. */ - num_bytes = (uint8_t)(reg_qty * sizeof(uint16_t)); } else { /* Read floating-point register */ if (ctx->mbs_user_cb->holding_reg_rd_fp == NULL) { @@ -345,14 +347,10 @@ static bool mbs_fc03_hreg_read(struct modbus_context *ctx) return true; } - if (reg_qty == 0 || reg_qty > (regs_limit / 2)) { - LOG_ERR("Number of registers limit exceeded"); - mbs_exception_rsp(ctx, MODBUS_EXC_ILLEGAL_DATA_VAL); + if (num_bytes % sizeof(uint32_t)) { + mbs_exception_rsp(ctx, MODBUS_EXC_ILLEGAL_FC); return true; } - - /* Get number of bytes needed for response. */ - num_bytes = (uint8_t)(reg_qty * sizeof(float)); } /* Number of data bytes + byte count. */ @@ -374,6 +372,9 @@ static bool mbs_fc03_hreg_read(struct modbus_context *ctx) presp += sizeof(uint16_t); } + /* Increment current register address */ + reg_addr++; + reg_qty--; } else if (IS_ENABLED(CONFIG_MODBUS_FP_EXTENSIONS)) { float fp; uint32_t reg; @@ -385,6 +386,10 @@ static bool mbs_fc03_hreg_read(struct modbus_context *ctx) sys_put_be32(reg, presp); presp += sizeof(uint32_t); } + + /* Increment current register address */ + reg_addr += 2; + reg_qty -= 2; } if (err != 0) { @@ -393,9 +398,6 @@ static bool mbs_fc03_hreg_read(struct modbus_context *ctx) return true; } - /* Increment current register address */ - reg_addr++; - reg_qty--; } return true; @@ -432,6 +434,16 @@ static bool mbs_fc04_inreg_read(struct modbus_context *ctx) reg_addr = sys_get_be16(&ctx->rx_adu.data[0]); reg_qty = sys_get_be16(&ctx->rx_adu.data[2]); + if (reg_qty == 0 || reg_qty > regs_limit) { + LOG_ERR("Wrong register quantity, %u (limit is %u)", + reg_qty, regs_limit); + mbs_exception_rsp(ctx, MODBUS_EXC_ILLEGAL_DATA_VAL); + return true; + } + + /* Get number of bytes needed for response. */ + num_bytes = (uint8_t)(reg_qty * sizeof(uint16_t)); + if ((reg_addr < MODBUS_FP_EXTENSIONS_ADDR) || !IS_ENABLED(CONFIG_MODBUS_FP_EXTENSIONS)) { /* Read integer register */ @@ -440,14 +452,6 @@ static bool mbs_fc04_inreg_read(struct modbus_context *ctx) return true; } - if (reg_qty == 0 || reg_qty > regs_limit) { - LOG_ERR("Number of registers limit exceeded"); - mbs_exception_rsp(ctx, MODBUS_EXC_ILLEGAL_DATA_VAL); - return true; - } - - /* Get number of bytes needed for response. */ - num_bytes = (uint8_t)(reg_qty * sizeof(uint16_t)); } else { /* Read floating-point register */ if (ctx->mbs_user_cb->input_reg_rd_fp == NULL) { @@ -455,14 +459,10 @@ static bool mbs_fc04_inreg_read(struct modbus_context *ctx) return true; } - if (reg_qty == 0 || reg_qty > (regs_limit / 2)) { - LOG_ERR("Number of registers limit exceeded"); - mbs_exception_rsp(ctx, MODBUS_EXC_ILLEGAL_DATA_VAL); + if (num_bytes % sizeof(uint32_t)) { + mbs_exception_rsp(ctx, MODBUS_EXC_ILLEGAL_FC); return true; } - - /* Get number of bytes needed for response. */ - num_bytes = (uint8_t)(reg_qty * sizeof(float)); } /* Number of data bytes + byte count. */ @@ -484,6 +484,9 @@ static bool mbs_fc04_inreg_read(struct modbus_context *ctx) presp += sizeof(uint16_t); } + /* Increment current register number */ + reg_addr++; + reg_qty--; } else if (IS_ENABLED(CONFIG_MODBUS_FP_EXTENSIONS)) { float fp; uint32_t reg; @@ -495,6 +498,10 @@ static bool mbs_fc04_inreg_read(struct modbus_context *ctx) sys_put_be32(reg, presp); presp += sizeof(uint32_t); } + + /* Increment current register address */ + reg_addr += 2; + reg_qty -= 2; } if (err != 0) { @@ -502,10 +509,6 @@ static bool mbs_fc04_inreg_read(struct modbus_context *ctx) mbs_exception_rsp(ctx, MODBUS_EXC_ILLEGAL_DATA_ADDR); return true; } - - /* Increment current register number */ - reg_addr++; - reg_qty--; } return true; @@ -833,7 +836,6 @@ static bool mbs_fc16_hregs_write(struct modbus_context *ctx) uint16_t reg_addr; uint16_t reg_qty; uint16_t num_bytes; - uint8_t reg_size; if (ctx->rx_adu.length < request_len) { LOG_ERR("Wrong request length %u", ctx->rx_adu.length); @@ -845,6 +847,12 @@ static bool mbs_fc16_hregs_write(struct modbus_context *ctx) /* Get the byte count for the data. */ num_bytes = ctx->rx_adu.data[4]; + if (reg_qty == 0 || reg_qty > regs_limit) { + LOG_ERR("Number of registers limit exceeded"); + mbs_exception_rsp(ctx, MODBUS_EXC_ILLEGAL_DATA_VAL); + return true; + } + if ((reg_addr < MODBUS_FP_EXTENSIONS_ADDR) || !IS_ENABLED(CONFIG_MODBUS_FP_EXTENSIONS)) { /* Write integer register */ @@ -852,14 +860,6 @@ static bool mbs_fc16_hregs_write(struct modbus_context *ctx) mbs_exception_rsp(ctx, MODBUS_EXC_ILLEGAL_FC); return true; } - - if (reg_qty == 0 || reg_qty > regs_limit) { - LOG_ERR("Number of registers limit exceeded"); - mbs_exception_rsp(ctx, MODBUS_EXC_ILLEGAL_DATA_VAL); - return true; - } - - reg_size = sizeof(uint16_t); } else { /* Write floating-point register */ if (ctx->mbs_user_cb->holding_reg_wr_fp == NULL) { @@ -867,13 +867,10 @@ static bool mbs_fc16_hregs_write(struct modbus_context *ctx) return true; } - if (reg_qty == 0 || reg_qty > (regs_limit / 2)) { - LOG_ERR("Number of registers limit exceeded"); - mbs_exception_rsp(ctx, MODBUS_EXC_ILLEGAL_DATA_VAL); + if (num_bytes % sizeof(uint32_t)) { + mbs_exception_rsp(ctx, MODBUS_EXC_ILLEGAL_FC); return true; } - - reg_size = sizeof(float); } /* Compare number of bytes and payload length */ @@ -883,7 +880,7 @@ static bool mbs_fc16_hregs_write(struct modbus_context *ctx) return true; } - if ((num_bytes / reg_qty) != (uint16_t)reg_size) { + if ((num_bytes / reg_qty) != sizeof(uint16_t)) { LOG_ERR("Mismatch in the number of registers"); mbs_exception_rsp(ctx, MODBUS_EXC_ILLEGAL_DATA_VAL); return true; @@ -892,7 +889,7 @@ static bool mbs_fc16_hregs_write(struct modbus_context *ctx) /* The 1st registers data byte is 6th element in payload */ prx_data = &ctx->rx_adu.data[5]; - for (uint16_t reg_cntr = 0; reg_cntr < reg_qty; reg_cntr++) { + for (uint16_t reg_cntr = 0; reg_cntr < reg_qty;) { uint16_t addr = reg_addr + reg_cntr; if ((reg_addr < MODBUS_FP_EXTENSIONS_ADDR) || @@ -901,14 +898,16 @@ static bool mbs_fc16_hregs_write(struct modbus_context *ctx) prx_data += sizeof(uint16_t); err = ctx->mbs_user_cb->holding_reg_wr(addr, reg_val); + reg_cntr++; } else { uint32_t reg_val = sys_get_be32(prx_data); float fp; /* Write to floating point register */ - memcpy(&fp, ®_val, sizeof(float)); + memcpy(&fp, ®_val, sizeof(uint32_t)); prx_data += sizeof(uint32_t); err = ctx->mbs_user_cb->holding_reg_wr_fp(addr, fp); + reg_cntr += 2; } if (err != 0) { diff --git a/tests/subsys/modbus/src/test_modbus_client.c b/tests/subsys/modbus/src/test_modbus_client.c index 60351247f03ec..10ffc8b6eadee 100644 --- a/tests/subsys/modbus/src/test_modbus_client.c +++ b/tests/subsys/modbus/src/test_modbus_client.c @@ -150,7 +150,7 @@ void test_holding_reg(void) for (uint16_t idx = 0; idx < ARRAY_SIZE(fhr_wr); idx++) { err = modbus_write_holding_regs_fp(client_iface, node, - fp_offset + idx, + fp_offset + idx * 2, &fhr_wr[0], 1); zassert_equal(err, 0, "FC16 write request failed"); } @@ -176,6 +176,14 @@ void test_holding_reg(void) ARRAY_SIZE(fhr_wr)); zassert_not_equal(err, 0, "FC16 FP out of range request not failed"); + err = modbus_write_holding_regs(client_iface, node, fp_offset, + hr_wr, ARRAY_SIZE(hr_wr) - 1); + zassert_not_equal(err, 0, "FC16 write to FP address request not failed"); + + err = modbus_read_holding_regs(client_iface, node, fp_offset, + hr_rd, ARRAY_SIZE(hr_rd) - 1); + zassert_not_equal(err, 0, "FC16 read from FP address request not failed"); + err = modbus_read_holding_regs_fp(client_iface, node, fp_offset, diff --git a/tests/subsys/modbus/src/test_modbus_server.c b/tests/subsys/modbus/src/test_modbus_server.c index 6dd12e051111b..d2baded980d50 100644 --- a/tests/subsys/modbus/src/test_modbus_server.c +++ b/tests/subsys/modbus/src/test_modbus_server.c @@ -6,6 +6,7 @@ #include "test_modbus.h" +#include #include LOG_MODULE_REGISTER(mbs_test, LOG_LEVEL_INF); @@ -87,12 +88,11 @@ static int input_reg_rd(uint16_t addr, uint16_t *reg) static int input_reg_rd_fp(uint16_t addr, float *reg) { - if ((addr < fp_offset) || - (addr >= (ARRAY_SIZE(holding_fp) + fp_offset))) { + if (!IN_RANGE(addr, fp_offset, sizeof(holding_fp) / 2 + fp_offset)) { return -ENOTSUP; } - *reg = holding_fp[addr - fp_offset]; + *reg = holding_fp[(addr - fp_offset) / 2]; LOG_DBG("FP input register read, addr %u", addr); @@ -127,12 +127,11 @@ static int holding_reg_wr(uint16_t addr, uint16_t reg) static int holding_reg_rd_fp(uint16_t addr, float *reg) { - if ((addr < fp_offset) || - (addr >= (ARRAY_SIZE(holding_fp) + fp_offset))) { + if (!IN_RANGE(addr, fp_offset, sizeof(holding_fp) / 2 + fp_offset)) { return -ENOTSUP; } - *reg = holding_fp[addr - fp_offset]; + *reg = holding_fp[(addr - fp_offset) / 2]; LOG_DBG("FP holding register read, addr %u", addr); @@ -141,12 +140,11 @@ static int holding_reg_rd_fp(uint16_t addr, float *reg) static int holding_reg_wr_fp(uint16_t addr, float reg) { - if ((addr < fp_offset) || - (addr >= (ARRAY_SIZE(holding_fp) + fp_offset))) { + if (!IN_RANGE(addr, fp_offset, sizeof(holding_fp) / 2 + fp_offset)) { return -ENOTSUP; } - holding_fp[addr - fp_offset] = reg; + holding_fp[(addr - fp_offset) / 2] = reg; LOG_DBG("FP holding register write, addr %u", addr); From 71149fd47afd76e9af2302a8c16e72aff132ef8a Mon Sep 17 00:00:00 2001 From: Stoyan Bogdanov Date: Fri, 14 Jun 2024 17:41:13 +0300 Subject: [PATCH 0456/4482] drivers: gpio: Add MAX14906 industrial input/output MAX14906 in 4 channel I/O with advanced diagnostic. In SPI communication diagnostic status transmitted on every READ/WRITE which includes generic status of chip. Configuration both on global level and on per channel bases. Diagnostics includes : * Thermal overload * current limit * open wire detection * short to VDD * Above VDD * Safe DEmagnitization fault * VDD warning * VDD low * SPI/CRC Error * WDog Error * Loss GND Add app.overlay for MAX14906 driver. Tested with adopted basic/button and basic/blinky sample. Signed-off-by: Stoyan Bogdanov --- drivers/gpio/CMakeLists.txt | 1 + drivers/gpio/Kconfig | 1 + drivers/gpio/Kconfig.max14906 | 20 + drivers/gpio/gpio_max14906.c | 495 +++++++++++++++++++++++ drivers/gpio/gpio_max14906.h | 321 +++++++++++++++ drivers/gpio/gpio_max149x6.h | 157 +++++++ tests/drivers/build_all/gpio/app.overlay | 21 + 7 files changed, 1016 insertions(+) create mode 100644 drivers/gpio/Kconfig.max14906 create mode 100644 drivers/gpio/gpio_max14906.c create mode 100644 drivers/gpio/gpio_max14906.h create mode 100644 drivers/gpio/gpio_max149x6.h diff --git a/drivers/gpio/CMakeLists.txt b/drivers/gpio/CMakeLists.txt index cd441db164e5f..38fe0b6b86db2 100644 --- a/drivers/gpio/CMakeLists.txt +++ b/drivers/gpio/CMakeLists.txt @@ -40,6 +40,7 @@ zephyr_library_sources_ifdef(CONFIG_GPIO_KSCAN_ITE_IT8XXX2 gpio_kscan_ite_it8xxx zephyr_library_sources_ifdef(CONFIG_GPIO_LITEX gpio_litex.c) zephyr_library_sources_ifdef(CONFIG_GPIO_LMP90XXX gpio_lmp90xxx.c) zephyr_library_sources_ifdef(CONFIG_GPIO_LPC11U6X gpio_lpc11u6x.c) +zephyr_library_sources_ifdef(CONFIG_GPIO_MAX14906 gpio_max14906.c) zephyr_library_sources_ifdef(CONFIG_GPIO_MAX32 gpio_max32.c) zephyr_library_sources_ifdef(CONFIG_GPIO_MCHP_MSS gpio_mchp_mss.c) zephyr_library_sources_ifdef(CONFIG_GPIO_MCP230XX gpio_mcp230xx.c) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 90cad25cebe96..ce547c502b078 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -131,6 +131,7 @@ source "drivers/gpio/Kconfig.it8xxx2" source "drivers/gpio/Kconfig.litex" source "drivers/gpio/Kconfig.lmp90xxx" source "drivers/gpio/Kconfig.lpc11u6x" +source "drivers/gpio/Kconfig.max14906" source "drivers/gpio/Kconfig.max32" source "drivers/gpio/Kconfig.mchp_mss" source "drivers/gpio/Kconfig.mcp23xxx" diff --git a/drivers/gpio/Kconfig.max14906 b/drivers/gpio/Kconfig.max14906 new file mode 100644 index 0000000000000..0bf353a128ec0 --- /dev/null +++ b/drivers/gpio/Kconfig.max14906 @@ -0,0 +1,20 @@ +# Copyright (c) 2024 Analog Devices Inc. +# Copyright (c) 2024 BayLibre SAS +# SPDX-License-Identifier: Apache-2.0 + +# MAX14906 GPIO configuration options + +menuconfig GPIO_MAX14906 + bool "MAX14906 GPIO driver" + default y + depends on DT_HAS_ADI_MAX14906_GPIO_ENABLED && SPI + help + Enabe MAX14906 quad industrial digital + input/output with diagnostics + +config GPIO_MAX14906_INIT_PRIORITY + int "Driver init priority" + default 99 + depends on GPIO_MAX14906 + help + Device driver initialization priority. diff --git a/drivers/gpio/gpio_max14906.c b/drivers/gpio/gpio_max14906.c new file mode 100644 index 0000000000000..d1458802f4f55 --- /dev/null +++ b/drivers/gpio/gpio_max14906.c @@ -0,0 +1,495 @@ +/* + * Copyright (c) 2024 Analog Devices Inc. + * Copyright (c) 2024 Baylibre SAS + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +#define LOG_LEVEL CONFIG_GPIO_LOG_LEVEL +#include + +LOG_MODULE_REGISTER(gpio_max14906); + +#include + +#include "gpio_max14906.h" +#include "gpio_max149x6.h" + +#define DT_DRV_COMPAT adi_max14906_gpio + +static int gpio_max14906_diag_chan_get(const struct device *dev); + +static int max14906_pars_spi_diag(const struct device *dev, uint8_t *rx_diag_buff, uint8_t rw) +{ + struct max14906_data *data = dev->data; + int ret = 0; + + if (rx_diag_buff[0]) { + LOG_ERR("[DIAG] MAX14906 in SPI diag - error detected\n"); + data->glob.interrupt.reg_bits.SHT_VDD_FAULT = MAX149X6_GET_BIT(rx_diag_buff[0], 5); + data->glob.interrupt.reg_bits.ABOVE_VDD_FAULT = + MAX149X6_GET_BIT(rx_diag_buff[0], 4); + data->glob.interrupt.reg_bits.OW_OFF_FAULT = MAX149X6_GET_BIT(rx_diag_buff[0], 3); + data->glob.interrupt.reg_bits.CURR_LIM = MAX149X6_GET_BIT(rx_diag_buff[0], 2); + data->glob.interrupt.reg_bits.OVER_LD_FAULT = MAX149X6_GET_BIT(rx_diag_buff[0], 1); + + uint8_t globlf = MAX149X6_GET_BIT(rx_diag_buff[0], 0); + + ret = -EIO; + + PRINT_ERR(data->glob.interrupt.reg_bits.SHT_VDD_FAULT); + PRINT_ERR(data->glob.interrupt.reg_bits.ABOVE_VDD_FAULT); + PRINT_ERR(data->glob.interrupt.reg_bits.OW_OFF_FAULT); + PRINT_ERR(data->glob.interrupt.reg_bits.CURR_LIM); + PRINT_ERR(data->glob.interrupt.reg_bits.OVER_LD_FAULT); + PRINT_ERR(globlf); + } + + if (rw == MAX149x6_WRITE && (rx_diag_buff[1] & 0x0f)) { + /* +-----------------------------------------------------------------------+ + * | LSB BYTE 2 MSB | + * +--------+--------+--------+--------+--------+--------+--------+--------+ + * | BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | BIT5 | BIT6 | BIT7 | + * +--------+--------+--------+--------+--------+--------+--------+--------+ + * | Fault1 | Fault2 | Fault3 | Fault4 | DiLvl1 | DiLvl2 | DiLvl3 | DiLvl4 | + * +--------+--------+--------+--------+--------+--------+--------+--------+ + */ + + LOG_ERR("[DIAG] Flt1[%x] Flt2[%x] Flt3[%x] Flt4[%x]", + MAX149X6_GET_BIT(rx_diag_buff[1], 0), MAX149X6_GET_BIT(rx_diag_buff[1], 1), + MAX149X6_GET_BIT(rx_diag_buff[1], 2), MAX149X6_GET_BIT(rx_diag_buff[1], 3)); + if (rx_diag_buff[1] & 0x0f) { + LOG_ERR("[DIAG] gpio_max14906_diag_chan_get(%x)\n", rx_diag_buff[1] & 0x0f); + ret = gpio_max14906_diag_chan_get(dev); + } + } + + return ret; +} + +static int max14906_reg_trans_spi_diag(const struct device *dev, uint8_t addr, uint8_t tx, + uint8_t rw) +{ + const struct max14906_config *config = dev->config; + uint8_t rx_diag_buff[2]; + + if (!gpio_pin_get_dt(&config->fault_gpio)) { + LOG_ERR("[FAULT] pin triggered"); + } + + uint8_t ret = max149x6_reg_transceive(dev, addr, tx, rx_diag_buff, rw); + + if (max14906_pars_spi_diag(dev, rx_diag_buff, rw)) { + ret = -EIO; + } + + return ret; +} + +#define MAX14906_REG_READ(dev, addr) max14906_reg_trans_spi_diag(dev, addr, 0, MAX149x6_READ) +#define MAX14906_REG_WRITE(dev, addr, val) \ + max14906_reg_trans_spi_diag(dev, addr, val, MAX149x6_WRITE) + +/* + * @brief Register update function for MAX14906 + * + * @param dev - MAX149x6 device. + * @param addr - Register valueto wich data is updated. + * @param mask - Corresponding mask to the data that will be updated. + * @param val - Updated value to be written in the register at update. + * @return 0 in case of success, negative error code otherwise. + */ +static int max14906_reg_update(const struct device *dev, uint8_t addr, uint8_t mask, uint8_t val) +{ + int ret; + uint32_t reg_val = 0; + + ret = MAX14906_REG_READ(dev, addr); + + reg_val = ret; + reg_val &= ~mask; + reg_val |= mask & val; + + return MAX14906_REG_WRITE(dev, addr, reg_val); +} + +static int gpio_max14906_diag_chan_get(const struct device *dev) +{ + const struct max14906_config *config = dev->config; + struct max14906_data *data = dev->data; + int ret; + + if (!gpio_pin_get_dt(&config->fault_gpio)) { + LOG_ERR("[DIAG] FAULT flag is rised"); + } + + data->glob.interrupt.reg_raw = + max149x6_reg_transceive(dev, MAX14906_INT_REG, 0, NULL, MAX149x6_READ); + if (data->glob.interrupt.reg_raw) { + if (data->glob.interrupt.reg_bits.OVER_LD_FAULT || + data->glob.interrupt.reg_bits.CURR_LIM) { + data->chan.ovr_ld.reg_raw = max149x6_reg_transceive( + dev, MAX14906_OVR_LD_REG, 0, NULL, MAX149x6_READ); + } + if (data->glob.interrupt.reg_bits.OW_OFF_FAULT || + data->glob.interrupt.reg_bits.ABOVE_VDD_FAULT) { + data->chan.opn_wir.reg_raw = max149x6_reg_transceive( + dev, MAX14906_OPN_WIR_FLT_REG, 0, NULL, MAX149x6_READ); + } + if (data->glob.interrupt.reg_bits.SHT_VDD_FAULT) { + data->chan.sht_vdd.reg_raw = max149x6_reg_transceive( + dev, MAX14906_SHT_VDD_FLT_REG, 0, NULL, MAX149x6_READ); + } + if (data->glob.interrupt.reg_bits.DE_MAG_FAULT) { + data->chan.doi_level.reg_raw = max149x6_reg_transceive( + dev, MAX14906_DOILEVEL_REG, 0, NULL, MAX149x6_READ); + if (data->chan.doi_level.reg_raw) { + PRINT_ERR(data->chan.doi_level.reg_bits.VDDOK_FAULT1); + PRINT_ERR(data->chan.doi_level.reg_bits.VDDOK_FAULT2); + PRINT_ERR(data->chan.doi_level.reg_bits.VDDOK_FAULT3); + PRINT_ERR(data->chan.doi_level.reg_bits.VDDOK_FAULT4); + PRINT_ERR(data->chan.doi_level.reg_bits.SAFE_DAMAGE_F1); + PRINT_ERR(data->chan.doi_level.reg_bits.SAFE_DAMAGE_F2); + PRINT_ERR(data->chan.doi_level.reg_bits.SAFE_DAMAGE_F3); + PRINT_ERR(data->chan.doi_level.reg_bits.SAFE_DAMAGE_F4); + } + } + if (data->glob.interrupt.reg_bits.SUPPLY_ERR) { + data->glob.glob_err.reg_raw = max149x6_reg_transceive( + dev, MAX14906_GLOB_ERR_REG, 0, NULL, MAX149x6_READ); + PRINT_ERR(data->glob.glob_err.reg_bits.VINT_UV); + PRINT_ERR(data->glob.glob_err.reg_bits.V5_UVLO); + PRINT_ERR(data->glob.glob_err.reg_bits.VDD_LOW); + PRINT_ERR(data->glob.glob_err.reg_bits.VDD_WARN); + PRINT_ERR(data->glob.glob_err.reg_bits.VDD_UVLO); + PRINT_ERR(data->glob.glob_err.reg_bits.THRMSHUTD); + PRINT_ERR(data->glob.glob_err.reg_bits.LOSSGND); + PRINT_ERR(data->glob.glob_err.reg_bits.WDOG_ERR); + } + if (data->glob.interrupt.reg_bits.COM_ERR) { + LOG_ERR("[DIAG] MAX14906 Communication Error"); + } + } + + ret = data->chan.doi_level.reg_raw | data->chan.ovr_ld.reg_raw | + data->chan.opn_wir.reg_raw | data->chan.sht_vdd.reg_raw; + + return ret; +} + +/** + * @brief Configure a channel's function. + * @param desc - device descriptor for the MAX14906 + * @param ch - channel index (0 based). + * @param function - channel configuration (input, output or high-z). + * @return 0 in case of success, negative error code otherwise + */ +static int max14906_ch_func(const struct device *dev, uint32_t ch, enum max14906_function function) +{ + uint8_t setout_reg_val; + + switch (function) { + case MAX14906_HIGH_Z: + setout_reg_val = MAX14906_IN; + max14906_reg_update(dev, MAX14906_CONFIG_DO_REG, MAX14906_DO_MASK(ch), + FIELD_PREP(MAX14906_DO_MASK(ch), MAX14906_PUSH_PULL)); + break; + case MAX14906_IN: + setout_reg_val = MAX14906_IN; + max14906_reg_update(dev, MAX14906_CONFIG_DO_REG, MAX14906_DO_MASK(ch), + FIELD_PREP(MAX14906_DO_MASK(ch), MAX14906_HIGH_SIDE)); + break; + case MAX14906_OUT: + setout_reg_val = MAX14906_OUT; + break; + default: + return -EINVAL; + } + + return max14906_reg_update(dev, MAX14906_SETOUT_REG, MAX14906_CH_DIR_MASK(ch), + FIELD_PREP(MAX14906_CH_DIR_MASK(ch), setout_reg_val)); +} + +static int gpio_max14906_port_set_bits_raw(const struct device *dev, gpio_port_pins_t pins) +{ + int ret; + uint32_t reg_val = 0; + + ret = MAX14906_REG_READ(dev, MAX14906_SETOUT_REG); + reg_val = ret | (pins & 0x0f); + + return MAX14906_REG_WRITE(dev, MAX14906_SETOUT_REG, reg_val); +} + +static int gpio_max14906_port_clear_bits_raw(const struct device *dev, gpio_port_pins_t pins) +{ + int ret; + uint32_t reg_val = 0; + + ret = MAX14906_REG_READ(dev, MAX14906_SETOUT_REG); + reg_val = ret & (0xf0 & ~pins); + + return MAX14906_REG_WRITE(dev, MAX14906_SETOUT_REG, reg_val); +} + +static int gpio_max14906_config(const struct device *dev, gpio_pin_t pin, gpio_flags_t flags) +{ + int err = 0; + + if ((flags & (GPIO_INPUT | GPIO_OUTPUT)) == GPIO_DISCONNECTED) { + return -ENOTSUP; + } + + if ((flags & GPIO_SINGLE_ENDED) != 0) { + return -ENOTSUP; + } + + if ((flags & (GPIO_PULL_UP | GPIO_PULL_DOWN)) != 0) { + return -ENOTSUP; + } + + if (flags & GPIO_INT_ENABLE) { + return -ENOTSUP; + } + + switch (flags & GPIO_DIR_MASK) { + case GPIO_INPUT: + max14906_ch_func(dev, (uint32_t)pin, MAX14906_IN); + LOG_DBG("SETUP AS INPUT %d", pin); + break; + case GPIO_OUTPUT: + max14906_ch_func(dev, (uint32_t)pin, MAX14906_OUT); + LOG_DBG("SETUP AS OUTPUT %d", pin); + break; + default: + LOG_ERR("On MAX14906 only input option is available!"); + err = -ENOTSUP; + break; + } + + return err; +} + +static int gpio_max14906_port_get_raw(const struct device *dev, gpio_port_value_t *value) +{ + /* We care only for first 4 bits of the reg. + * Next set of bits is for direction. + * NOTE : in case and only if pin is INPUT DOILEVEL reg bits 0-4 shows PIN state. + * In case PIN is OUTPUT same bits show VDDOKFault state. + */ + + *value = (0x0f & MAX14906_REG_READ(dev, MAX14906_DOILEVEL_REG)); + + return 0; +} + +static int gpio_max14906_port_toggle_bits(const struct device *dev, gpio_port_pins_t pins) +{ + int ret; + uint32_t reg_val, direction, state, new_reg_val; + + ret = MAX14906_REG_READ(dev, MAX14906_SETOUT_REG); + + direction = ret & 0xf0; + state = ret & 0x0f; + reg_val = state ^ pins; + new_reg_val = direction | (0x0f & state); + + return MAX14906_REG_WRITE(dev, MAX14906_SETOUT_REG, new_reg_val); +} + +static int gpio_max14906_clean_on_power(const struct device *dev) +{ + int ret; + + /* Clear the latched faults generated at power up */ + ret = MAX14906_REG_READ(dev, MAX14906_OPN_WIR_FLT_REG); + if (ret < 0) { + LOG_ERR("Error reading MAX14906_OPN_WIR_FLT_REG"); + goto err_clean_on_power_max14906; + } + + ret = MAX14906_REG_READ(dev, MAX14906_OVR_LD_REG); + if (ret < 0) { + LOG_ERR("Error reading MAX14906_OVR_LD_REG"); + goto err_clean_on_power_max14906; + } + + ret = MAX14906_REG_READ(dev, MAX14906_SHT_VDD_FLT_REG); + if (ret < 0) { + LOG_ERR("Error reading MAX14906_SHD_VDD_FLT_REG"); + goto err_clean_on_power_max14906; + } + + ret = MAX14906_REG_READ(dev, MAX14906_GLOB_ERR_REG); + if (ret < 0) { + LOG_ERR("Error reading MAX14906_GLOBAL_FLT_REG"); + goto err_clean_on_power_max14906; + } + +err_clean_on_power_max14906: + return ret; +} + +static int gpio_max14906_config_diag(const struct device *dev) +{ + const struct max14906_data *data = dev->data; + const struct max14906_config *config = dev->config; + + /* Set Config1 and Config2 regs */ + MAX14906_REG_WRITE(dev, MAX14906_CONFIG1_REG, config->config1.reg_raw); + MAX14906_REG_WRITE(dev, MAX14906_CONFIG2_REG, config->config2.reg_raw); + + /* Configure per channel diagnostics */ + MAX14906_REG_WRITE(dev, MAX14906_OPN_WR_EN_REG, data->chan_en.opn_wr_en.reg_raw); + MAX14906_REG_WRITE(dev, MAX14906_SHT_VDD_EN_REG, data->chan_en.sht_vdd_en.reg_raw); + + return 0; +} + +static int gpio_max14906_init(const struct device *dev) +{ + const struct max14906_config *config = dev->config; + int err = 0; + + LOG_DBG(" --- GPIO MAX14906 init IN ---"); + + if (!spi_is_ready_dt(&config->spi)) { + LOG_ERR("SPI bus is not ready\n"); + return -ENODEV; + } + + /* setup READY gpio - normal low */ + if (!gpio_is_ready_dt(&config->ready_gpio)) { + LOG_ERR("READY GPIO device not ready"); + return -ENODEV; + } + + err = gpio_pin_configure_dt(&config->ready_gpio, GPIO_INPUT); + if (err < 0) { + LOG_ERR("Failed to configure reset GPIO"); + return err; + } + + /* setup FAULT gpio - normal high */ + if (!gpio_is_ready_dt(&config->fault_gpio)) { + LOG_ERR("FAULT GPIO device not ready"); + return -ENODEV; + } + + err = gpio_pin_configure_dt(&config->fault_gpio, GPIO_INPUT); + if (err < 0) { + LOG_ERR("Failed to configure DC GPIO"); + return err; + } + + /* setup LATCH gpio - normal high */ + if (!gpio_is_ready_dt(&config->sync_gpio)) { + LOG_ERR("SYNC GPIO device not ready"); + return -ENODEV; + } + + err = gpio_pin_configure_dt(&config->sync_gpio, GPIO_OUTPUT_INACTIVE); + if (err < 0) { + LOG_ERR("Failed to configure busy GPIO"); + return err; + } + + /* setup LATCH gpio - normal high */ + if (!gpio_is_ready_dt(&config->en_gpio)) { + LOG_ERR("SYNC GPIO device not ready"); + return -ENODEV; + } + + err = gpio_pin_configure_dt(&config->en_gpio, GPIO_OUTPUT_INACTIVE); + if (err < 0) { + LOG_ERR("Failed to configure busy GPIO"); + return err; + } + + gpio_pin_set_dt(&config->en_gpio, 1); + gpio_pin_set_dt(&config->sync_gpio, 1); + + LOG_DBG("[GPIO] FAULT - %d\n", gpio_pin_get_dt(&config->fault_gpio)); + LOG_DBG("[GPIO] READY - %d\n", gpio_pin_get_dt(&config->ready_gpio)); + LOG_DBG("[GPIO] SYNC - %d\n", gpio_pin_get_dt(&config->sync_gpio)); + LOG_DBG("[GPIO] EN - %d\n", gpio_pin_get_dt(&config->en_gpio)); + + int ret = gpio_max14906_clean_on_power(dev); + + MAX14906_REG_WRITE(dev, MAX14906_SETOUT_REG, 0); + + gpio_max14906_config_diag(dev); + + LOG_DBG(" --- GPIO MAX14906 init OUT ---"); + + return ret; +} + +static const struct gpio_driver_api gpio_max14906_api = { + .pin_configure = gpio_max14906_config, + .port_get_raw = gpio_max14906_port_get_raw, + .port_set_bits_raw = gpio_max14906_port_set_bits_raw, + .port_clear_bits_raw = gpio_max14906_port_clear_bits_raw, + .port_toggle_bits = gpio_max14906_port_toggle_bits, +}; + +#define GPIO_MAX14906_DEVICE(id) \ + static const struct max14906_config max14906_##id##_cfg = { \ + .spi = SPI_DT_SPEC_INST_GET(id, SPI_OP_MODE_MASTER | SPI_WORD_SET(8U), 0U), \ + .ready_gpio = GPIO_DT_SPEC_INST_GET(id, drdy_gpios), \ + .fault_gpio = GPIO_DT_SPEC_INST_GET(id, fault_gpios), \ + .sync_gpio = GPIO_DT_SPEC_INST_GET(id, sync_gpios), \ + .en_gpio = GPIO_DT_SPEC_INST_GET(id, en_gpios), \ + .crc_en = DT_INST_PROP(id, crc_en), \ + .config1.reg_bits.FLED_SET = DT_INST_PROP(id, fled_set), \ + .config1.reg_bits.SLED_SET = DT_INST_PROP(id, sled_set), \ + .config1.reg_bits.FLED_STRETCH = DT_INST_PROP(id, fled_stretch), \ + .config1.reg_bits.FFILTER_EN = DT_INST_PROP(id, ffilter_en), \ + .config1.reg_bits.FILTER_LONG = DT_INST_PROP(id, filter_long), \ + .config1.reg_bits.FLATCH_EN = DT_INST_PROP(id, flatch_en), \ + .config1.reg_bits.LED_CURR_LIM = DT_INST_PROP(id, led_cur_lim), \ + .config2.reg_bits.VDD_ON_THR = DT_INST_PROP(id, vdd_on_thr), \ + .config2.reg_bits.SYNCH_WD_EN = DT_INST_PROP(id, synch_wd_en), \ + .config2.reg_bits.SHT_VDD_THR = DT_INST_PROP(id, sht_vdd_thr), \ + .config2.reg_bits.OW_OFF_CS = DT_INST_PROP(id, ow_off_cs), \ + .config2.reg_bits.WD_TO = DT_INST_PROP(id, wd_to), \ + .pkt_size = (DT_INST_PROP(id, crc_en) & 0x1) ? 3 : 2, \ + .spi_addr = DT_INST_PROP(id, spi_addr), \ + }; \ + \ + static struct max14906_data max14906_##id##_data = { \ + .chan_en.opn_wr_en.reg_bits = \ + { \ + .OW_OFF_EN1 = DT_INST_PROP_BY_IDX(id, ow_en, 0), \ + .OW_OFF_EN2 = DT_INST_PROP_BY_IDX(id, ow_en, 1), \ + .OW_OFF_EN3 = DT_INST_PROP_BY_IDX(id, ow_en, 2), \ + .OW_OFF_EN4 = DT_INST_PROP_BY_IDX(id, ow_en, 3), \ + .GDRV_EN1 = DT_INST_PROP_BY_IDX(id, gdrv_en, 0), \ + .GDRV_EN1 = DT_INST_PROP_BY_IDX(id, gdrv_en, 1), \ + .GDRV_EN2 = DT_INST_PROP_BY_IDX(id, gdrv_en, 2), \ + .GDRV_EN3 = DT_INST_PROP_BY_IDX(id, gdrv_en, 3), \ + }, \ + .chan_en.sht_vdd_en.reg_bits = \ + { \ + .VDD_OV_EN1 = DT_INST_PROP_BY_IDX(id, vdd_ov_en, 0), \ + .VDD_OV_EN2 = DT_INST_PROP_BY_IDX(id, vdd_ov_en, 1), \ + .VDD_OV_EN3 = DT_INST_PROP_BY_IDX(id, vdd_ov_en, 2), \ + .VDD_OV_EN4 = DT_INST_PROP_BY_IDX(id, vdd_ov_en, 3), \ + .SH_VDD_EN1 = DT_INST_PROP_BY_IDX(id, sh_vdd_en, 0), \ + .SH_VDD_EN2 = DT_INST_PROP_BY_IDX(id, sh_vdd_en, 1), \ + .SH_VDD_EN3 = DT_INST_PROP_BY_IDX(id, sh_vdd_en, 2), \ + .SH_VDD_EN4 = DT_INST_PROP_BY_IDX(id, sh_vdd_en, 3), \ + }, \ + }; \ + \ + DEVICE_DT_INST_DEFINE(id, &gpio_max14906_init, NULL, &max14906_##id##_data, \ + &max14906_##id##_cfg, POST_KERNEL, \ + CONFIG_GPIO_MAX14906_INIT_PRIORITY, &gpio_max14906_api); + +DT_INST_FOREACH_STATUS_OKAY(GPIO_MAX14906_DEVICE) diff --git a/drivers/gpio/gpio_max14906.h b/drivers/gpio/gpio_max14906.h new file mode 100644 index 0000000000000..647088f5f4934 --- /dev/null +++ b/drivers/gpio/gpio_max14906.h @@ -0,0 +1,321 @@ +/* + * Copyright (c) 2024 Analog Devices Inc. + * Copyright (c) 2024 Baylibre SAS + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_DRIVERS_GPIO_GPIO_MAX14906_H_ +#define ZEPHYR_DRIVERS_GPIO_GPIO_MAX14906_H_ + +#define MAX14906_FAULT2_ENABLES 5 +#define MAX14906_CHANNELS 4 +#define MAX14916_CHANNELS 8 +#define MAX149x6_MAX_PKT_SIZE 3 + +#define MAX14906_SETOUT_REG 0x0 +#define MAX14906_SETLED_REG 0x1 +#define MAX14906_DOILEVEL_REG 0x2 +#define MAX14906_INT_REG 0x3 +#define MAX14906_OVR_LD_REG 0x4 +#define MAX14906_OPN_WIR_FLT_REG 0x5 +#define MAX14906_SHT_VDD_FLT_REG 0x6 +#define MAX14906_GLOB_ERR_REG 0x7 +#define MAX14906_OPN_WR_EN_REG 0x8 +#define MAX14906_SHT_VDD_EN_REG 0x9 +#define MAX14906_CONFIG1_REG 0xA +#define MAX14906_CONFIG2_REG 0xB +#define MAX14906_CONFIG_DI_REG 0xC +#define MAX14906_CONFIG_DO_REG 0xD +#define MAX14906_CONFIG_CURR_LIM 0xE +#define MAX14906_CONFIG_MASK 0xF + +#define MAX149x6_CHIP_ADDR_MASK GENMASK(7, 6) +#define MAX149x6_ADDR_MASK GENMASK(4, 1) +#define MAX149x6_RW_MASK BIT(0) + +/* DoiLevel register */ +#define MAX14906_DOI_LEVEL_MASK(x) BIT(x) + +/* SetOUT register */ +#define MAX14906_HIGHO_MASK(x) BIT(x) + +#define MAX14906_DO_MASK(x) (GENMASK(1, 0) << (2 * (x))) +#define MAX14906_CH_DIR_MASK(x) BIT((x) + 4) +#define MAX14906_CH(x) (x) +#define MAX14906_IEC_TYPE_MASK BIT(7) +#define MAX14906_CL_MASK(x) (GENMASK(1, 0) << (2 * (x))) + +/** + * @brief Hardwired device address + */ +enum max149x6_spi_addr { + MAX14906_ADDR_0, /* A0=0, A1=0 */ + MAX14906_ADDR_1, /* A0=1, A1=0 */ + MAX14906_ADDR_2, /* A0=0, A1=1 */ + MAX14906_ADDR_3, /* A0=1, A1=1 */ +}; + +enum max14906_iec_type { + MAX14906_TYPE_1_3, + MAX14906_TYPE_2, +}; + +/** + * @brief Channel configuration options. + */ +enum max14906_function { + MAX14906_OUT, + MAX14906_IN, + MAX14906_HIGH_Z +}; + +/** + * @brief Configuration options for the output driver (on each channel). + */ +enum max14906_do_mode { + MAX14906_HIGH_SIDE, + MAX14906_HIGH_SIDE_INRUSH, + MAX14906_PUSH_PULL_CLAMP, + MAX14906_PUSH_PULL +}; + +/** + * @brief Current limit options for output channels. + */ +enum max14906_cl { + MAX14906_CL_600, + MAX14906_CL_130, + MAX14906_CL_300, + MAX14906_CL_1200, +}; + +union max14906_doi_level { + uint8_t reg_raw; + struct { + uint8_t VDDOK_FAULT1: 1; /* BIT0 */ + uint8_t VDDOK_FAULT2: 1; + uint8_t VDDOK_FAULT3: 1; + uint8_t VDDOK_FAULT4: 1; + uint8_t SAFE_DAMAGE_F1: 1; + uint8_t SAFE_DAMAGE_F2: 1; + uint8_t SAFE_DAMAGE_F3: 1; + uint8_t SAFE_DAMAGE_F4: 1; /* BIT7 */ + } reg_bits; +}; + +union max14906_interrupt { + uint8_t reg_raw; + struct { + uint8_t OVER_LD_FAULT: 1; /* BIT0 */ + uint8_t CURR_LIM: 1; + uint8_t OW_OFF_FAULT: 1; + uint8_t ABOVE_VDD_FAULT: 1; + uint8_t SHT_VDD_FAULT: 1; + uint8_t DE_MAG_FAULT: 1; + uint8_t SUPPLY_ERR: 1; + uint8_t COM_ERR: 1; /* BIT7 */ + } reg_bits; +}; + +union max14906_ovr_ld_chf { + uint8_t reg_raw; + struct { + uint8_t OVL1: 1; /* BIT0 */ + uint8_t OVL2: 1; + uint8_t OVL3: 1; + uint8_t OVL4: 1; + uint8_t CL1: 1; + uint8_t CL2: 1; + uint8_t CL3: 1; + uint8_t CL4: 1; /* BIT7 */ + } reg_bits; +}; + +union max14906_opn_wir_chf { + uint8_t reg_raw; + struct { + uint8_t OW_OFF1: 1; /* BIT0 */ + uint8_t OW_OFF2: 1; + uint8_t OW_OFF3: 1; + uint8_t OW_OFF4: 1; + uint8_t ABOVE_VDD1: 1; + uint8_t ABOVE_VDD2: 1; + uint8_t ABOVE_VDD3: 1; + uint8_t ABOVE_VDD4: 1; /* BIT7 */ + } reg_bits; +}; + +union max14906_sht_vdd_chf { + uint8_t reg_raw; + struct { + uint8_t SHVDD1: 1; /* BIT0 */ + uint8_t SHVDD2: 1; + uint8_t SHVDD3: 1; + uint8_t SHVDD4: 1; + uint8_t VDDOV1: 1; + uint8_t VDDOV2: 1; + uint8_t VDDOV3: 1; + uint8_t VDDOV4: 1; /* BIT7 */ + } reg_bits; +}; + +union max14906_global_err { + uint8_t reg_raw; + struct { + uint8_t VINT_UV: 1; /* BIT0 */ + uint8_t V5_UVLO: 1; + uint8_t VDD_LOW: 1; + uint8_t VDD_WARN: 1; + uint8_t VDD_UVLO: 1; + uint8_t THRMSHUTD: 1; + uint8_t LOSSGND: 1; + uint8_t WDOG_ERR: 1; /* BIT7 */ + } reg_bits; +}; + +union max14906_opn_wr_en { + uint8_t reg_raw; + struct { + uint8_t OW_OFF_EN1: 1; /* BIT0 */ + uint8_t OW_OFF_EN2: 1; + uint8_t OW_OFF_EN3: 1; + uint8_t OW_OFF_EN4: 1; + uint8_t GDRV_EN1: 1; + uint8_t GDRV_EN2: 1; + uint8_t GDRV_EN3: 1; + uint8_t GDRV_EN4: 1; /* BIT7 */ + } reg_bits; +}; + +union max14906_sht_vdd_en { + uint8_t reg_raw; + struct { + uint8_t SH_VDD_EN1: 1; /* BIT0 */ + uint8_t SH_VDD_EN2: 1; + uint8_t SH_VDD_EN3: 1; + uint8_t SH_VDD_EN4: 1; + uint8_t VDD_OV_EN1: 1; + uint8_t VDD_OV_EN2: 1; + uint8_t VDD_OV_EN3: 1; + uint8_t VDD_OV_EN4: 1; /* BIT7 */ + } reg_bits; +}; + +union max14906_config_di { + uint8_t reg_raw; + struct { + uint8_t OVL_BLANK: 2; /* BIT0 */ + uint8_t OVL_STRETCH_EN: 1; + uint8_t ABOVE_VDD_PROT_EN: 1; + uint8_t VDD_FAULT_SEL: 1; + uint8_t VDD_FAULT_DIS: 1; + uint8_t RESERVED: 1; + uint8_t TYP_2_DI: 1; /* BIT7 */ + } reg_bits; +}; + +union max14906_config_do { + uint8_t reg_raw; + struct { + uint8_t DO_MODE1: 2; /* BIT0 */ + uint8_t DO_MODE2: 2; + uint8_t DO_MODE3: 2; + uint8_t DO_MODE4: 2; /* BIT7 */ + } reg_bits; +}; + +union max14906_config_curr_lim { + uint8_t reg_raw; + struct { + uint8_t CL1: 2; /* BIT0 */ + uint8_t CL2: 2; + uint8_t CL3: 2; + uint8_t CL4: 2; /* BIT7 */ + } reg_bits; +}; + +union max14906_mask { + uint8_t reg_raw; + struct { + uint8_t OVER_LD_M: 1; /* BIT0 */ + uint8_t CURR_LIM_M: 1; + uint8_t OW_OFF_M: 1; + uint8_t ABOVE_VDD_M: 1; + uint8_t SHT_VDD_M: 1; + uint8_t VDD_OK_M: 1; + uint8_t SUPPLY_ERR_M: 1; + uint8_t COM_ERR_M: 1; /* BIT7 */ + } reg_bits; +}; + +union max14906_config1 { + uint8_t reg_raw; + struct { + uint8_t FLED_SET: 1; /* BIT0 */ + uint8_t SLED_SET: 1; + uint8_t FLED_STRETCH: 2; + uint8_t FFILTER_EN: 1; + uint8_t FILTER_LONG: 1; + uint8_t FLATCH_EN: 1; + uint8_t LED_CURR_LIM: 1; /* BIT7 */ + } reg_bits; +}; + +union max14906_config2 { + uint8_t reg_raw; + struct { + uint8_t VDD_ON_THR: 1; /* BIT0 */ + uint8_t SYNCH_WD_EN: 1; + uint8_t SHT_VDD_THR: 2; + uint8_t OW_OFF_CS: 2; + uint8_t WD_TO: 2; /* BIT7 */ + } reg_bits; +}; + +/* Config1 register Enable/Disable SLED */ +#define MAX149x6_SLED_MASK BIT(1) +/* Config1 register Enable/Disable FLED */ +#define MAX149x6_FLED_MASK BIT(0) + +#define MAX149x6_ENABLE 1 +#define MAX149x6_DISABLE 0 + +struct max149x6_config { + struct spi_dt_spec spi; + struct gpio_dt_spec fault_gpio; + struct gpio_dt_spec ready_gpio; + struct gpio_dt_spec sync_gpio; + struct gpio_dt_spec en_gpio; + bool crc_en; + union max14906_config1 config1; + union max14906_config2 config2; + union max14906_config_curr_lim curr_lim; + union max14906_config_di config_do; + union max14906_config_do config_di; + enum max149x6_spi_addr spi_addr; + uint8_t pkt_size; +}; + +#define max14906_config max149x6_config + +struct max14906_data { + struct gpio_driver_data common; + struct { + union max14906_doi_level doi_level; + union max14906_ovr_ld_chf ovr_ld; + union max14906_opn_wir_chf opn_wir; + union max14906_sht_vdd_chf sht_vdd; + } chan; + struct { + union max14906_opn_wr_en opn_wr_en; + union max14906_sht_vdd_en sht_vdd_en; + } chan_en; + struct { + union max14906_interrupt interrupt; + union max14906_global_err glob_err; + union max14906_mask mask; + } glob; +}; + +#endif diff --git a/drivers/gpio/gpio_max149x6.h b/drivers/gpio/gpio_max149x6.h new file mode 100644 index 0000000000000..3266a219c65fb --- /dev/null +++ b/drivers/gpio/gpio_max149x6.h @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2024 Analog Devices Inc. + * Copyright (c) 2024 Baylibre SAS + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_DRIVERS_GPIO_GPIO_MAX149X6_H_ +#define ZEPHYR_DRIVERS_GPIO_GPIO_MAX149X6_H_ + +#define MAX149x6_READ 0 +#define MAX149x6_WRITE 1 + +#define MAX149X6_GET_BIT(val, i) (0x1 & ((val) >> (i))) +#define PRINT_ERR_BIT(bit1, bit2) \ + if ((bit1) & (bit2)) \ + LOG_ERR("[%s] %d", #bit1, bit1) +#define PRINT_ERR(bit) \ + if (bit) \ + LOG_ERR("[DIAG] [%s] %d\n", #bit, bit) +#define PRINT_INF(bit) LOG_INFO("[%s] %d\n", #bit, bit) +#define LOG_DIAG(...) Z_LOG(LOG_LEVEL_ERR, __VA_ARGS__) + +/** + * @brief Compute the CRC5 value for an array of bytes when writing to MAX149X6 + * @param data - array of data to encode + * @param encode - action to be performed - true(encode), false(decode) + * @return the resulted CRC5 + */ +static uint8_t max149x6_crc(uint8_t *data, bool encode) +{ + uint8_t crc5_start = 0x1f; + uint8_t crc5_poly = 0x15; + uint8_t crc5_result = crc5_start; + uint8_t extra_byte = 0x00; + uint8_t data_bit; + uint8_t result_bit; + int i; + + /* + * This is a custom implementation of a CRC5 algorithm, detailed here: + * https://www.analog.com/en/app-notes/how-to-program-the-max14906-quadchannel- + * industrial-digital-output-digital-input.html + */ + + for (i = (encode) ? 0 : 2; i < 8; i++) { + data_bit = (data[0] >> (7 - i)) & 0x01; + result_bit = (crc5_result & 0x10) >> 4; + if (data_bit ^ result_bit) { + crc5_result = crc5_poly ^ ((crc5_result << 1) & 0x1f); + } else { + crc5_result = (crc5_result << 1) & 0x1f; + } + } + + for (i = 0; i < 8; i++) { + data_bit = (data[1] >> (7 - i)) & 0x01; + result_bit = (crc5_result & 0x10) >> 4; + if (data_bit ^ result_bit) { + crc5_result = crc5_poly ^ ((crc5_result << 1) & 0x1f); + } else { + crc5_result = (crc5_result << 1) & 0x1f; + } + } + + for (i = 0; i < 3; i++) { + data_bit = (extra_byte >> (7 - i)) & 0x01; + result_bit = (crc5_result & 0x10) >> 4; + if (data_bit ^ result_bit) { + crc5_result = crc5_poly ^ ((crc5_result << 1) & 0x1f); + } else { + crc5_result = (crc5_result << 1) & 0x1f; + } + } + + return crc5_result; +} + +/* + * @brief Register read/write function for MAX149x6 + * + * @param dev - MAX149x6 device config. + * @param addr - Register value to which data is written. + * @param val - Value which is to be written to requested register. + * @return 0 in case of success, negative error code otherwise. + */ +static int max149x6_reg_transceive(const struct device *dev, uint8_t addr, uint8_t val, + uint8_t *rx_diag_buff, uint8_t rw) +{ + uint8_t crc; + int ret; + + uint8_t local_rx_buff[MAX149x6_MAX_PKT_SIZE] = {0}; + uint8_t local_tx_buff[MAX149x6_MAX_PKT_SIZE] = {0}; + + const struct max149x6_config *config = dev->config; + + struct spi_buf tx_buf = { + .buf = &local_tx_buff, + .len = config->pkt_size, + }; + const struct spi_buf_set tx = {.buffers = &tx_buf, .count = 1}; + + struct spi_buf rx_buf = { + .buf = &local_rx_buff, + .len = config->pkt_size, + }; + const struct spi_buf_set rx = {.buffers = &rx_buf, .count = 1}; + + if (config->crc_en & 0) { + rx_buf.len++; + } + + local_tx_buff[0] = FIELD_PREP(MAX149x6_ADDR_MASK, addr) | + FIELD_PREP(MAX149x6_CHIP_ADDR_MASK, config->spi_addr) | + FIELD_PREP(MAX149x6_RW_MASK, rw & 0x1); + local_tx_buff[1] = val; + + /* If CRC enabled calculate it */ + if (config->crc_en) { + local_tx_buff[2] = max149x6_crc(&local_tx_buff[0], true); + } + + /* write cmd & read resp at once */ + ret = spi_transceive_dt(&config->spi, &tx, &rx); + + if (ret) { + LOG_ERR("Err spi_transcieve_dt [%d]\n", ret); + return ret; + } + + /* if CRC enabled check readed */ + if (config->crc_en) { + crc = max149x6_crc(&local_rx_buff[0], false); + if (crc != (local_rx_buff[2] & 0x1F)) { + LOG_ERR("READ CRC ERR (%d)-(%d)\n", crc, (local_rx_buff[2] & 0x1F)); + return -EINVAL; + } + } + + if (rx_diag_buff != NULL) { + rx_diag_buff[0] = local_rx_buff[0]; + } + + /* In case of write we are getting 2 diagnostic bytes - byte0 & byte1 + * and pass them to diag buffer to be parsed in next stage + */ + if ((MAX149x6_WRITE == rw) && (rx_diag_buff != NULL)) { + rx_diag_buff[1] = local_rx_buff[1]; + } else { + ret = local_rx_buff[1]; + } + + return ret; +} + +#endif diff --git a/tests/drivers/build_all/gpio/app.overlay b/tests/drivers/build_all/gpio/app.overlay index 1081a10c8e204..d7f2ded12d9bf 100644 --- a/tests/drivers/build_all/gpio/app.overlay +++ b/tests/drivers/build_all/gpio/app.overlay @@ -360,6 +360,7 @@ &test_gpio 0 0 &test_gpio 0 0 &test_gpio 0 0 + &test_gpio 0 0 &test_gpio 0 0>; test_spi_mcp23s17: mcp23s17@0 { @@ -440,6 +441,26 @@ ngpios = <8>; #gpio-cells = <2>; }; + + test_spi_max14906: max14906@5 { + compatible = "adi,max1906-gpio"; + status = "okay"; + reg = <0x06>; + spi-max-frequency = <0>; + gpio-controller; + #gpio-cells = <2>; + ngpios = <4>; + crc-en; + spi-addr = <0>; + ow-en = <0 0 0 0>; + vdd-ov-en = <0 0 0 0>; + gdrv-en = <0 0 0 0>; + sh-vdd-en = <0 0 0 0>; + drdy-gpios = <&test_gpio 0 0>; + fault-gpios = <&test_gpio 0 0>; + sync-gpios = <&test_gpio 0 0>; + en-gpios = <&test_gpio 0 0>; + }; }; }; }; From fe8f5d3f6a3c71bdc088cb1de045c4c66fad7087 Mon Sep 17 00:00:00 2001 From: Stoyan Bogdanov Date: Fri, 14 Jun 2024 17:42:18 +0300 Subject: [PATCH 0457/4482] dts: bindings: gpio: Add dtb bindings for MAX14906 MAX14906 industrial 4 channel Input/Ouput GPIO expander with diagnostics. Per channel diagnostics for open wire, over current. Global diagnostic for power supply, communication and various fault conditions. Signed-off-by: Stoyan Bogdanov --- dts/bindings/gpio/adi,max14906-gpio.yaml | 201 +++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 dts/bindings/gpio/adi,max14906-gpio.yaml diff --git a/dts/bindings/gpio/adi,max14906-gpio.yaml b/dts/bindings/gpio/adi,max14906-gpio.yaml new file mode 100644 index 0000000000000..e29e2a091c021 --- /dev/null +++ b/dts/bindings/gpio/adi,max14906-gpio.yaml @@ -0,0 +1,201 @@ +# Copyright (c) 2024 Analog Devices Inc. +# Copyright (c) 2024 BayLibre SAS +# SPDX-License-Identifier: Apache-2.0 + +description: ADI MAX14906 quad industrial Input/Output with advanced diagnostics + +compatible: "adi,max14906-gpio" + +properties: + "#gpio-cells": + const: 2 + ngpios: + type: int + required: true + const: 4 + description: Number of gpios supported + drdy-gpios: + description: | + High-Side Open-Drain Output. READY is passive low when the internal + logic supply is higher than the UVLO threshold, indicating that the + registers have adequate supply voltage. + type: phandle-array + fault-gpios: + description: | + Fault pin indicates when there is Fault state in either FAULT1 or FAULT2 + bothe of which are cleaned on read once problem is not persistent. + type: phandle-array + sync-gpios: + description: | + Latch the data so it could be read (partially duplicate CS). + type: phandle-array + en-gpios: + description: | + DOI Enable Pin. Drive the EN pin high to enable the DOI_ outputs. + Drive EN low to disable/three-state all DOI_ outputs. + type: phandle-array + crc-en: + description: | + Notify driver if crc pin is enabled. + type: boolean + spi-addr: + type: int + default: 0 + required: true + enum: + - 0 + - 1 + - 2 + - 3 + description: | + On MAX14906PMB module default address is 0 (A0-LOW, A1-LOW) + Selectable device address, configurable from A0 and A1 + ow-en: + type: array + default: [0, 0, 0, 0] + description: | + Default values are from documentation. + Enable or disable open-wire functionality per channel. + - 0 mean disable + - 1 mean enable + channels indentation start from CH0...CH3 + vdd-ov-en: + type: array + default: [0, 0, 0, 0] + description: | + Default values are from documentation. + VDDOVEN + Enable or disable open-wire functionality per channel. + - 0 mean disable + - 1 mean enable + channels indentation start from CH0...CH3 + gdrv-en: + type: array + default: [0, 0, 0, 0] + description: | + Default values are from documentation. + GDrvEn - Gate drive enabl disable for power eff + Enable or disable open-wire functionality per channel. + - 0 mean disable + - 1 mean enable + channels indentation start from CH0...CH3 + sh-vdd-en: + type: array + default: [0, 0, 0, 0] + description: | + Default values are from documentation. + ShVddEN - Short to VDD enable + Enable or disable short to VDD functionality per channel. + - 0 mean disable + - 1 mean enable + channels indentation start from CH0...CH3 + fled-set: + type: boolean + description: | + Internal fault diagnostics include (if enabled): SafeDemagF_, SHVDD_, + VDDOV_, OWOff_, AboveVDD_, CL_, OVL_, VDDOKFault_. + sled-set: + type: boolean + description: | + Enable status LEDs + fled-stretch: + type: int + default: 0 + enum: + - 0 + - 1 + - 2 + - 3 + description: | + Default values are from documentation. + Set minimum on time for FLEDs in case of fault + 0 - Disable minimum fault LED (FLED) on-time + 1 - Minimum fault LED (FLED) on-time = 1s (typ) + 2 - Minimum fault LED (FLED) on-time = 2s (typ) + 3 - Minimum fault LED (FLED) on-time = 3s (typ) + ffilter-en: + type: boolean + description: | + When the fault LEDs (FLEDs) are controlled internally (FLEDSet = 0), open- + wire and short-to-V DD diagnostics always use filtering and cannot be disabled + by the FFilterEn bit. + filter-long: + type: boolean + description: | + false: To select regular blanking time (4ms, typ) for diagnostic fault bits, OWOff_ + and SHVDD_ + true: To select long blanking time (8ms, typ) for diagnostic fault bits, OWOff_ + and SHVDD_ + flatch-en: + type: boolean + description: | + false: Disable latching of diagnostic fault bits in the OvrLdChF, OpnWirChF, and + ShtVDDChF registers + true: Enable latching of diagnostic fault bits in the OvrLdChF, OpnWirChF, and + ShtVDDChF registers + led-cur-lim: + type: boolean + description: | + false: Disable fault LEDs (FLEDs) signaling current limit + true: Enable fault LEDs (FLEDs) signaling current limit + vdd-on-thr: + type: boolean + description: | + Enable higher voltage thresholds for VDD and VDD_ undervoltage monitoring + synch-wd-en: + type: boolean + description: | + The SYNCH watchdog timeout is defined by the WDTo[1:0] bits if the SPI + watchdog is enabled. When WDTo[1:0] = 00 (SPI watchdog disabled), the + SYNCH watchdog timeout is 600ms (typ) if enabled. + sht-vdd-thr: + type: int + default: 0 + enum: + - 0 + - 1 + - 2 + - 3 + description: | + Default values are from documentation. + Set threshold voltage for short-to-V DD detection + 0: Set threshold voltage for short-to-VDD detection to 9V (typ) + 1: Set threshold voltage for short-to-VDD detection to 10V (typ) + 2: Set threshold voltage for short-to-VDD detection to 12V (typ) + 3: Set threshold voltage for short-to-VDD detection to 14V (typ) + ow-off-cs: + type: int + default: 0 + enum: + - 0 + - 1 + - 2 + - 3 + description: | + Default values are from documentation. + Set the pullup current for open-wire and short-to-VDD detection + 0: Set open-wire and short-to-VDD detection current to 60μA (typ) + 1: Set open-wire and short-to-VDD detection current to 100μA (typ) + 2: Set open-wire and short-to-VDD detection current to 300μA (typ) + 3: Set open-wire and short-to-VDD detection current to 600μA (typ) + wd-to: + type: int + default: 0 + enum: + - 0 + - 1 + - 2 + - 3 + description: | + Default values are from documentation. + SPI Watchdog Status, set SPI and SYNCH Watchdog Timeout + 0: Disable SPI Watchdog Status and SPI Watchdog Timeout + 1: Enable SPI Watchdog Status, set SPI and SYNCH Watchdog Timeout to 200ms (typ) + 2: Enable SPI Watchdog Status, set SPI and SYNCH Watchdog Timeout to 600ms (typ) + 3: Enable SPI Watchdog Status, set SPI and SYNCH Watchdog Timeout to 1.2s (typ) + +gpio-cells: + - pin + - flags + +include: [gpio-controller.yaml, spi-device.yaml] From 3ca5cf50fe000b0389531e1f83e33b90efec4767 Mon Sep 17 00:00:00 2001 From: Stoyan Bogdanov Date: Fri, 14 Jun 2024 17:41:58 +0300 Subject: [PATCH 0458/4482] drivers: gpio: Add MAX14916 industrial output Industrial 8 channel output with advanced diagnostics. Allowing giagnostic configuration both on per channel or global bases In SPI communication diagnostic status transmitted on every READ/WRITE which includes generic status of chip. Diagnostics includes : * Oveload * Open Wire * Over current * Short to VDD * Thermal Shutdown * VDD Warn * Watch Dog Error * Communication Error * VDD under voltage Add app.overlay for MAX14916 driver. Tested with adopted basic/blinky example. Signed-off-by: Stoyan Bogdanov --- drivers/gpio/CMakeLists.txt | 1 + drivers/gpio/Kconfig | 1 + drivers/gpio/Kconfig.max14916 | 20 ++ drivers/gpio/gpio_max14916.c | 400 +++++++++++++++++++++++ drivers/gpio/gpio_max14916.h | 200 ++++++++++++ tests/drivers/build_all/gpio/app.overlay | 20 ++ 6 files changed, 642 insertions(+) create mode 100644 drivers/gpio/Kconfig.max14916 create mode 100644 drivers/gpio/gpio_max14916.c create mode 100644 drivers/gpio/gpio_max14916.h diff --git a/drivers/gpio/CMakeLists.txt b/drivers/gpio/CMakeLists.txt index 38fe0b6b86db2..10b72060d64b2 100644 --- a/drivers/gpio/CMakeLists.txt +++ b/drivers/gpio/CMakeLists.txt @@ -41,6 +41,7 @@ zephyr_library_sources_ifdef(CONFIG_GPIO_LITEX gpio_litex.c) zephyr_library_sources_ifdef(CONFIG_GPIO_LMP90XXX gpio_lmp90xxx.c) zephyr_library_sources_ifdef(CONFIG_GPIO_LPC11U6X gpio_lpc11u6x.c) zephyr_library_sources_ifdef(CONFIG_GPIO_MAX14906 gpio_max14906.c) +zephyr_library_sources_ifdef(CONFIG_GPIO_MAX14916 gpio_max14916.c) zephyr_library_sources_ifdef(CONFIG_GPIO_MAX32 gpio_max32.c) zephyr_library_sources_ifdef(CONFIG_GPIO_MCHP_MSS gpio_mchp_mss.c) zephyr_library_sources_ifdef(CONFIG_GPIO_MCP230XX gpio_mcp230xx.c) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index ce547c502b078..81b20ea68c640 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -132,6 +132,7 @@ source "drivers/gpio/Kconfig.litex" source "drivers/gpio/Kconfig.lmp90xxx" source "drivers/gpio/Kconfig.lpc11u6x" source "drivers/gpio/Kconfig.max14906" +source "drivers/gpio/Kconfig.max14916" source "drivers/gpio/Kconfig.max32" source "drivers/gpio/Kconfig.mchp_mss" source "drivers/gpio/Kconfig.mcp23xxx" diff --git a/drivers/gpio/Kconfig.max14916 b/drivers/gpio/Kconfig.max14916 new file mode 100644 index 0000000000000..dfdc1c4f76c53 --- /dev/null +++ b/drivers/gpio/Kconfig.max14916 @@ -0,0 +1,20 @@ +# Copyright (c) 2024 Analog Devices Inc. +# Copyright (c) 2024 BayLibre SAS +# SPDX-License-Identifier: Apache-2.0 + +# MAX14916 GPIO configuration options + +menuconfig GPIO_MAX14916 + bool "MAX14916 GPIO driver" + default y + depends on DT_HAS_ADI_MAX14916_GPIO_ENABLED && SPI + help + Enabe MAX1416 octal industrial digital + output with diagnostics + +config GPIO_MAX14916_INIT_PRIORITY + int "Driver init priority" + default 99 + depends on GPIO_MAX14916 + help + Device driver initialization priority. diff --git a/drivers/gpio/gpio_max14916.c b/drivers/gpio/gpio_max14916.c new file mode 100644 index 0000000000000..f9deec90338d8 --- /dev/null +++ b/drivers/gpio/gpio_max14916.c @@ -0,0 +1,400 @@ +/* + * Copyright (c) 2024 Analog Devices Inc. + * Copyright (c) 2024 Baylibre SAS + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +#define LOG_LEVEL CONFIG_GPIO_LOG_LEVEL +#include + +LOG_MODULE_REGISTER(gpio_max14916); + +#include + +#include "gpio_max14916.h" +#include "gpio_max149x6.h" + +#define DT_DRV_COMPAT adi_max14916_gpio + +static int gpio_max14916_diag_chan_get(const struct device *dev); + +static int max14916_pars_spi_diag(const struct device *dev, uint8_t *rx_diag_buff, uint8_t rw) +{ + struct max14916_data *data = dev->data; + int ret = 0; + + if (rx_diag_buff[0]) { + LOG_ERR("[DIAG] MAX14916 in SPI diag - error detected"); + + data->glob.interrupt.reg_bits.SHT_VDD_FLT = MAX149X6_GET_BIT(rx_diag_buff[0], 5); + data->glob.interrupt.reg_bits.OW_ON_FLT = MAX149X6_GET_BIT(rx_diag_buff[0], 4); + data->glob.interrupt.reg_bits.OW_OFF_FLT = MAX149X6_GET_BIT(rx_diag_buff[0], 3); + data->glob.interrupt.reg_bits.CURR_LIM = MAX149X6_GET_BIT(rx_diag_buff[0], 2); + data->glob.interrupt.reg_bits.OVER_LD_FLT = MAX149X6_GET_BIT(rx_diag_buff[0], 1); + + if (MAX149X6_GET_BIT(rx_diag_buff[0], 0)) { + LOG_ERR("[DIAG] MAX14916 in SPI diag - GLOBAL FAULT detected"); + } + + ret = -EIO; + + PRINT_ERR(data->glob.interrupt.reg_bits.SHT_VDD_FLT); + PRINT_ERR(data->glob.interrupt.reg_bits.OW_ON_FLT); + PRINT_ERR(data->glob.interrupt.reg_bits.OW_OFF_FLT); + PRINT_ERR(data->glob.interrupt.reg_bits.CURR_LIM); + PRINT_ERR(data->glob.interrupt.reg_bits.OVER_LD_FLT); + } + + if (rw == MAX149x6_WRITE && (rx_diag_buff[1] & 0x0f)) { + /* +-----------------------------------------------------------------------+ + * | LSB BYTE 2 MSB | + * +--------+--------+--------+--------+--------+--------+--------+--------+ + * | BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | BIT5 | BIT6 | BIT7 | + * +--------+--------+--------+--------+--------+--------+--------+--------+ + * | Fault1 | Fault2 | Fault3 | Fault4 | Fault5 | Fault6 | Fault7 | Fault8 | + * +--------+--------+--------+--------+--------+--------+--------+--------+ + */ + + LOG_ERR("[DIAG] Flt1[%x] Flt2[%x] Flt3[%x]" + "Flt4[%x] Flt5[%x] Flt6[%x] Flt7[%x] Flt8[%x]\n", + MAX149X6_GET_BIT(rx_diag_buff[1], 0), MAX149X6_GET_BIT(rx_diag_buff[1], 1), + MAX149X6_GET_BIT(rx_diag_buff[1], 2), MAX149X6_GET_BIT(rx_diag_buff[1], 3), + MAX149X6_GET_BIT(rx_diag_buff[1], 4), MAX149X6_GET_BIT(rx_diag_buff[1], 5), + MAX149X6_GET_BIT(rx_diag_buff[1], 6), MAX149X6_GET_BIT(rx_diag_buff[1], 7)); + + if (rx_diag_buff[1]) { + LOG_ERR("[DIAG] gpio_max14916_diag_chan_get(%x)\n", rx_diag_buff[1] & 0x0f); + ret = gpio_max14916_diag_chan_get(dev); + } + } + + return ret; +} + +static int max14916_reg_trans_spi_diag(const struct device *dev, uint8_t addr, uint8_t tx, + uint8_t rw) +{ + const struct max14916_config *config = dev->config; + uint8_t rx_diag_buff[2]; + + if (!gpio_pin_get_dt(&config->fault_gpio)) { + LOG_ERR(" >>> FLT PIN"); + } + + uint8_t ret = max149x6_reg_transceive(dev, addr, tx, rx_diag_buff, rw); + + if (max14916_pars_spi_diag(dev, rx_diag_buff, rw)) { + ret = -EIO; + } + + return ret; +} + +#define MAX14916_REG_READ(dev, addr) max14916_reg_trans_spi_diag(dev, addr, 0, MAX149x6_READ) +#define MAX14916_REG_WRITE(dev, addr, val) \ + max14916_reg_trans_spi_diag(dev, addr, val, MAX149x6_WRITE) + +static int gpio_max14916_diag_chan_get(const struct device *dev) +{ + const struct max14916_config *config = dev->config; + struct max14916_data *data = dev->data; + int ret = 0; + + if (!gpio_pin_get_dt(&config->fault_gpio)) { + LOG_ERR("FLT flag is rised"); + ret = -EIO; + } + + data->glob.interrupt.reg_raw = + max149x6_reg_transceive(dev, MAX14916_INT_REG, 0, NULL, MAX149x6_READ); + + if (data->glob.interrupt.reg_raw) { + if (data->glob.interrupt.reg_bits.OVER_LD_FLT) { + data->chan.ovr_ld = max149x6_reg_transceive(dev, MAX14916_OVR_LD_REG, 0, + NULL, MAX149x6_READ); + } + if (data->glob.interrupt.reg_bits.CURR_LIM) { + data->chan.curr_lim = max149x6_reg_transceive(dev, MAX14916_CURR_LIM_REG, 0, + NULL, MAX149x6_READ); + } + if (data->glob.interrupt.reg_bits.OW_OFF_FLT) { + data->chan.ow_off = max149x6_reg_transceive(dev, MAX14916_OW_OFF_FLT_REG, 0, + NULL, MAX149x6_READ); + } + if (data->glob.interrupt.reg_bits.OW_ON_FLT) { + data->chan.ow_on = max149x6_reg_transceive(dev, MAX14916_OW_ON_FLT_REG, 0, + NULL, MAX149x6_READ); + } + if (data->glob.interrupt.reg_bits.SHT_VDD_FLT) { + data->chan.sht_vdd = max149x6_reg_transceive(dev, MAX14916_SHT_VDD_FLT_REG, + 0, NULL, MAX149x6_READ); + } + + if (data->glob.interrupt.reg_bits.SUPPLY_ERR) { + data->glob.glob_err.reg_raw = max149x6_reg_transceive( + dev, MAX14916_GLOB_ERR_REG, 0, NULL, MAX149x6_READ); + PRINT_ERR(data->glob.glob_err.reg_bits.VINT_UV); + PRINT_ERR(data->glob.glob_err.reg_bits.VA_UVLO); + PRINT_ERR(data->glob.glob_err.reg_bits.VDD_BAD); + PRINT_ERR(data->glob.glob_err.reg_bits.VDD_WARN); + PRINT_ERR(data->glob.glob_err.reg_bits.VDD_UVLO); + PRINT_ERR(data->glob.glob_err.reg_bits.THRMSHUTD); + PRINT_ERR(data->glob.glob_err.reg_bits.SYNC_ERR); + PRINT_ERR(data->glob.glob_err.reg_bits.WDOG_ERR); + } + + if (data->glob.interrupt.reg_bits.COM_ERR) { + LOG_ERR("MAX14916 Communication Error"); + } + ret = -EIO; + } + + return ret; +} + +static int gpio_max14916_port_set_bits_raw(const struct device *dev, gpio_port_pins_t pins) +{ + int ret; + uint32_t reg_val = 0; + + ret = MAX14916_REG_READ(dev, MAX14916_SETOUT_REG); + reg_val = ret | pins; + + return MAX14916_REG_WRITE(dev, MAX14916_SETOUT_REG, reg_val); +} + +static int gpio_max14916_port_clear_bits_raw(const struct device *dev, gpio_port_pins_t pins) +{ + int ret; + uint32_t reg_val = 0; + + ret = MAX14916_REG_READ(dev, MAX14916_SETOUT_REG); + reg_val = ret & ~pins; + + return MAX14916_REG_WRITE(dev, MAX14916_SETOUT_REG, reg_val); +} + +static int gpio_max14916_config(const struct device *dev, gpio_pin_t pin, gpio_flags_t flags) +{ + int err = 0; + + if ((flags & (GPIO_INPUT | GPIO_OUTPUT)) == GPIO_DISCONNECTED) { + return -ENOTSUP; + } + + if ((flags & GPIO_SINGLE_ENDED) != 0) { + return -ENOTSUP; + } + + if ((flags & (GPIO_PULL_UP | GPIO_PULL_DOWN)) != 0) { + return -ENOTSUP; + } + + if (flags & GPIO_INT_ENABLE) { + return -ENOTSUP; + } + + switch (flags & GPIO_DIR_MASK) { + case GPIO_OUTPUT: + break; + case GPIO_INPUT: + default: + LOG_ERR("NOT SUPPORTED OPTION!"); + return -ENOTSUP; + } + + return err; +} + +static int gpio_max14916_port_get_raw(const struct device *dev, gpio_port_value_t *value) +{ + *value = MAX14916_REG_READ(dev, MAX14916_SETOUT_REG); + + return 0; +} + +static int gpio_max14916_port_toggle_bits(const struct device *dev, gpio_port_pins_t pins) +{ + int ret; + uint32_t reg_val = 0; + + ret = MAX14916_REG_READ(dev, MAX14916_SETOUT_REG); + + reg_val = ret; + reg_val ^= pins; + + MAX14916_REG_WRITE(dev, MAX14916_SETOUT_REG, reg_val); + + return 0; +} + +static int gpio_max14916_clean_on_power(const struct device *dev) +{ + int ret; + + /* Clear the latched faults generated at power up */ + ret = MAX14916_REG_READ(dev, MAX14916_OW_OFF_FLT_REG); + if (ret < 0) { + LOG_ERR("Error reading MAX14916_OW_OFF_FLT_REG"); + goto err_clean_on_power_max14916; + } + + ret = MAX14916_REG_READ(dev, MAX14916_OVR_LD_REG); + if (ret < 0) { + LOG_ERR("Error reading MAX14916_OVR_LD_REG"); + goto err_clean_on_power_max14916; + } + + ret = MAX14916_REG_READ(dev, MAX14916_SHT_VDD_FLT_REG); + if (ret < 0) { + LOG_ERR("Error reading MAX14916_SHD_VDD_FLT_REG"); + goto err_clean_on_power_max14916; + } + + ret = MAX14916_REG_READ(dev, MAX14916_GLOB_ERR_REG); + if (ret < 0) { + LOG_ERR("Error reading MAX14916_GLOBAL_FLT_REG"); + goto err_clean_on_power_max14916; + } + +err_clean_on_power_max14916: + return ret; +} + +static int gpio_max14916_config_diag(const struct device *dev) +{ + const struct max14916_config *config = dev->config; + struct max14916_data *data = dev->data; + + MAX14916_REG_WRITE(dev, MAX14916_CONFIG1_REG, config->config1.reg_raw); + MAX14916_REG_WRITE(dev, MAX14916_CONFIG2_REG, config->config2.reg_raw); + MAX14916_REG_WRITE(dev, MAX14916_OW_OFF_EN_REG, data->chan_en.ow_on_en); + MAX14916_REG_WRITE(dev, MAX14916_OW_OFF_EN_REG, data->chan_en.ow_off_en); + MAX14916_REG_WRITE(dev, MAX14916_SHT_VDD_EN_REG, data->chan_en.sht_vdd_en); + return 0; +} + +static int gpio_max14916_init(const struct device *dev) +{ + const struct max14916_config *config = dev->config; + int err = 0; + + LOG_DBG(" --- GPIO MAX14916 init IN ---"); + + if (!spi_is_ready_dt(&config->spi)) { + LOG_ERR("SPI bus is not ready\n"); + return -ENODEV; + } + + /* setup READY gpio - normal low */ + if (!gpio_is_ready_dt(&config->ready_gpio)) { + LOG_ERR("READY GPIO device not ready"); + return -ENODEV; + } + + err = gpio_pin_configure_dt(&config->ready_gpio, GPIO_INPUT); + if (err < 0) { + LOG_ERR("Failed to configure reset GPIO"); + return err; + } + + /* setup FLT gpio - normal high */ + if (!gpio_is_ready_dt(&config->fault_gpio)) { + LOG_ERR("FLT GPIO device not ready"); + return -ENODEV; + } + + err = gpio_pin_configure_dt(&config->fault_gpio, GPIO_INPUT); + if (err < 0) { + LOG_ERR("Failed to configure DC GPIO"); + return err; + } + + /* setup LATCH gpio - normal high */ + if (!gpio_is_ready_dt(&config->sync_gpio)) { + LOG_ERR("SYNC GPIO device not ready"); + return -ENODEV; + } + + err = gpio_pin_configure_dt(&config->sync_gpio, GPIO_OUTPUT_INACTIVE); + if (err < 0) { + LOG_ERR("Failed to configure busy GPIO"); + return err; + } + + /* setup LATCH gpio - normal high */ + if (!gpio_is_ready_dt(&config->en_gpio)) { + LOG_ERR("SYNC GPIO device not ready"); + return -ENODEV; + } + + err = gpio_pin_configure_dt(&config->en_gpio, GPIO_OUTPUT_INACTIVE); + if (err < 0) { + LOG_ERR("Failed to configure busy GPIO"); + return err; + } + + gpio_pin_set_dt(&config->en_gpio, 1); + gpio_pin_set_dt(&config->sync_gpio, 1); + + LOG_ERR("[GPIO] FALUT - %d\n", gpio_pin_get_dt(&config->fault_gpio)); + LOG_ERR("[GPIO] READY - %d\n", gpio_pin_get_dt(&config->ready_gpio)); + LOG_ERR("[GPIO] SYNC - %d\n", gpio_pin_get_dt(&config->sync_gpio)); + LOG_ERR("[GPIO] EN - %d\n", gpio_pin_get_dt(&config->en_gpio)); + + int ret = gpio_max14916_clean_on_power(dev); + + MAX14916_REG_WRITE(dev, MAX14916_SETOUT_REG, 0); + + gpio_max14916_config_diag(dev); + + LOG_DBG(" --- GPIO MAX14916 init OUT ---"); + + return ret; +} + +static const struct gpio_driver_api gpio_max14916_api = { + .pin_configure = gpio_max14916_config, + .port_get_raw = gpio_max14916_port_get_raw, + .port_set_bits_raw = gpio_max14916_port_set_bits_raw, + .port_clear_bits_raw = gpio_max14916_port_clear_bits_raw, + .port_toggle_bits = gpio_max14916_port_toggle_bits, +}; + +#define GPIO_MAX14906_DEVICE(id) \ + static const struct max14916_config max14916_##id##_cfg = { \ + .spi = SPI_DT_SPEC_INST_GET(id, SPI_OP_MODE_MASTER | SPI_WORD_SET(8U), 0U), \ + .ready_gpio = GPIO_DT_SPEC_INST_GET(id, drdy_gpios), \ + .fault_gpio = GPIO_DT_SPEC_INST_GET(id, fault_gpios), \ + .sync_gpio = GPIO_DT_SPEC_INST_GET(id, sync_gpios), \ + .en_gpio = GPIO_DT_SPEC_INST_GET(id, en_gpios), \ + .crc_en = DT_INST_PROP(id, crc_en), \ + .config1.reg_bits.FLED_SET = DT_INST_PROP(id, fled_set), \ + .config1.reg_bits.SLED_SET = DT_INST_PROP(id, sled_set), \ + .config1.reg_bits.FLED_STRETCH = DT_INST_PROP(id, fled_stretch), \ + .config1.reg_bits.FFILTER_EN = DT_INST_PROP(id, ffilter_en), \ + .config1.reg_bits.FILTER_LONG = DT_INST_PROP(id, filter_long), \ + .config1.reg_bits.FLATCH_EN = DT_INST_PROP(id, flatch_en), \ + .config1.reg_bits.LED_CURR_LIM = DT_INST_PROP(id, led_cur_lim), \ + .config2.reg_bits.VDD_ON_THR = DT_INST_PROP(id, vdd_on_thr), \ + .config2.reg_bits.SYNCH_WD_EN = DT_INST_PROP(id, synch_wd_en), \ + .config2.reg_bits.SHT_VDD_THR = DT_INST_PROP(id, sht_vdd_thr), \ + .config2.reg_bits.OW_OFF_CS = DT_INST_PROP(id, ow_off_cs), \ + .config2.reg_bits.WD_TO = DT_INST_PROP(id, wd_to), \ + .pkt_size = (DT_INST_PROP(id, crc_en) & 0x1) ? 3 : 2, \ + .spi_addr = DT_INST_PROP(id, spi_addr), \ + }; \ + \ + static struct max14916_data max14916_##id##_data; \ + \ + DEVICE_DT_INST_DEFINE(id, &gpio_max14916_init, NULL, &max14916_##id##_data, \ + &max14916_##id##_cfg, POST_KERNEL, \ + CONFIG_GPIO_MAX14916_INIT_PRIORITY, &gpio_max14916_api); + +DT_INST_FOREACH_STATUS_OKAY(GPIO_MAX14906_DEVICE) diff --git a/drivers/gpio/gpio_max14916.h b/drivers/gpio/gpio_max14916.h new file mode 100644 index 0000000000000..bcc842b2a6efa --- /dev/null +++ b/drivers/gpio/gpio_max14916.h @@ -0,0 +1,200 @@ +/* + * Copyright (c) 2024 Analog Devices Inc. + * Copyright (c) 2024 Baylibre SAS + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_DRIVERS_GPIO_GPIO_MAX14916_H_ +#define ZEPHYR_DRIVERS_GPIO_GPIO_MAX14916_H_ + +#define MAX14906_ENABLE 1 +#define MAX14906_DISABLE 0 + +#define MAX149x6_MAX_PKT_SIZE 3 + +#define MAX14916_CHANNELS 8 + +#define MAX14916_SETOUT_REG 0x0 +#define MAX14916_SET_FLED_REG 0x1 +#define MAX14916_SET_SLED_REG 0x2 +#define MAX14916_INT_REG 0x3 +#define MAX14916_OVR_LD_REG 0x4 +#define MAX14916_CURR_LIM_REG 0x5 +#define MAX14916_OW_OFF_FLT_REG 0x6 +#define MAX14916_OW_ON_FLT_REG 0x7 +#define MAX14916_SHT_VDD_FLT_REG 0x8 +#define MAX14916_GLOB_ERR_REG 0x9 +#define MAX14916_OW_OFF_EN_REG 0xA +#define MAX14916_OW_ON_EN_REG 0xB +#define MAX14916_SHT_VDD_EN_REG 0xC +#define MAX14916_CONFIG1_REG 0xD +#define MAX14916_CONFIG2_REG 0xE +#define MAX14916_CONFIG_MASK 0xF + +#define MAX149x6_CHIP_ADDR_MASK GENMASK(7, 6) +#define MAX149x6_ADDR_MASK GENMASK(4, 1) +#define MAX149x6_RW_MASK BIT(0) + +/* DoiLevel register */ +#define MAX149x6_DOI_LEVEL_MASK(x) BIT(x) + +/* SetOUT register */ +#define MAX14906_HIGHO_MASK(x) BIT(x) + +#define MAX14906_DO_MASK(x) (GENMASK(1, 0) << (2 * (x))) +#define MAX14906_CH_DIR_MASK(x) BIT((x) + 4) +#define MAX14906_CH(x) (x) +#define MAX14906_IEC_TYPE_MASK BIT(7) +#define MAX14906_CL_MASK(x) (GENMASK(1, 0) << (2 * (x))) + +/* Config1 register */ +#define MAX14906_SLED_MASK BIT(1) +#define MAX14906_FLED_MASK BIT(0) + +#define MAX14906_CHAN_MASK_LSB(x) BIT(x) +#define MAX14906_CHAN_MASK_MSB(x) BIT((x) + 4) + +enum max149x6_spi_addr { + MAX14906_ADDR_0, /* A0=0, A1=0 */ + MAX14906_ADDR_1, /* A0=1, A1=0 */ + MAX14906_ADDR_2, /* A0=0, A1=1 */ + MAX14906_ADDR_3, /* A0=1, A1=1 */ +}; + +enum max14916_fled_time { + MAX14916_FLED_TIME_DISABLED, + MAX14916_FLED_TIME_1S, + MAX14916_FLED_TIME_2S, + MAX14916_FLED_TIME_3S +}; + +enum max14916_sled_state { + MAX14916_SLED_OFF, + MAX14916_SLED_ON +}; + +enum max14916_wd { + MAX14916_WD_DISABLED, + MAX14916_WD_200MS, + MAX14916_WD_600MS, + MAX14916_WD_1200MS +}; + +enum max14916_ow_off_cs { + MAX14916_OW_OFF_CS_20UA, + MAX14916_OW_OFF_CS_100UA, + MAX14916_OW_OFF_CS_300UA, + MAX14916_OW_OFF_CS_600UA +}; + +enum max14916_sht_vdd_thr { + MAX14916_SHT_VDD_THR_9V, + MAX14916_SHT_VDD_THR_10V, + MAX14916_SHT_VDD_THR_12V, + MAX14916_SHT_VDD_THR_14V +}; + +union max14916_interrupt { + uint8_t reg_raw; + struct { + uint8_t OVER_LD_FLT: 1; /* BIT0 */ + uint8_t CURR_LIM: 1; + uint8_t OW_OFF_FLT: 1; + uint8_t OW_ON_FLT: 1; + uint8_t SHT_VDD_FLT: 1; + uint8_t DE_MAG_FLT: 1; + uint8_t SUPPLY_ERR: 1; + uint8_t COM_ERR: 1; /* BIT7 */ + } reg_bits; +}; + +union max14916_config1 { + uint8_t reg_raw; + struct { + uint8_t FLED_SET: 1; /* BIT0 */ + uint8_t SLED_SET: 1; + uint8_t FLED_STRETCH: 2; + uint8_t FFILTER_EN: 1; + uint8_t FILTER_LONG: 1; + uint8_t FLATCH_EN: 1; + uint8_t LED_CURR_LIM: 1; /* BIT7 */ + } reg_bits; +}; + +union max14916_config2 { + uint8_t reg_raw; + struct { + uint8_t VDD_ON_THR: 1; /* BIT0 */ + uint8_t SYNCH_WD_EN: 1; + uint8_t SHT_VDD_THR: 2; + uint8_t OW_OFF_CS: 2; + uint8_t WD_TO: 2; /* BIT7 */ + } reg_bits; +}; + +union max14916_mask { + uint8_t reg_raw; + struct { + uint8_t OVER_LD_M: 1; /* BIT0 */ + uint8_t CURR_LIM_M: 1; + uint8_t OW_OFF_M: 1; + uint8_t OW_ON_M: 1; + uint8_t SHT_VDD_M: 1; + uint8_t VDD_OK_M: 1; + uint8_t SUPPLY_ERR_M: 1; + uint8_t COM_ERR_M: 1; /* BIT7 */ + } reg_bits; +}; + +union max14916_global_err { + uint8_t reg_raw; + struct { + uint8_t VINT_UV: 1; /* BIT0 */ + uint8_t VA_UVLO: 1; + uint8_t VDD_BAD: 1; + uint8_t VDD_WARN: 1; + uint8_t VDD_UVLO: 1; + uint8_t THRMSHUTD: 1; + uint8_t SYNC_ERR: 1; + uint8_t WDOG_ERR: 1; /* BIT7 */ + } reg_bits; +}; + +struct max149x6_config { + struct spi_dt_spec spi; + struct gpio_dt_spec fault_gpio; + struct gpio_dt_spec ready_gpio; + struct gpio_dt_spec sync_gpio; + struct gpio_dt_spec en_gpio; + bool crc_en; + union max14916_config1 config1; + union max14916_config2 config2; + enum max149x6_spi_addr spi_addr; + uint8_t pkt_size; +}; + +#define max14916_config max149x6_config + +struct max14916_data { + struct gpio_driver_data common; + struct { + uint8_t ovr_ld; + uint8_t curr_lim; + uint8_t ow_off; + uint8_t ow_on; + uint8_t sht_vdd; + } chan; + struct { + uint8_t ow_off_en; + uint8_t ow_on_en; + uint8_t sht_vdd_en; + } chan_en; + struct { + union max14916_interrupt interrupt; + union max14916_global_err glob_err; + union max14916_mask mask; + } glob; +}; + +#endif diff --git a/tests/drivers/build_all/gpio/app.overlay b/tests/drivers/build_all/gpio/app.overlay index d7f2ded12d9bf..e023736fe339a 100644 --- a/tests/drivers/build_all/gpio/app.overlay +++ b/tests/drivers/build_all/gpio/app.overlay @@ -361,6 +361,7 @@ &test_gpio 0 0 &test_gpio 0 0 &test_gpio 0 0 + &test_gpio 0 0 &test_gpio 0 0>; test_spi_mcp23s17: mcp23s17@0 { @@ -461,6 +462,25 @@ sync-gpios = <&test_gpio 0 0>; en-gpios = <&test_gpio 0 0>; }; + + test_spi_max14916: max14916@6 { + compatible = "adi,max1916-gpio"; + status = "okay"; + reg = <0x07>; + spi-max-frequency = <0>; + gpio-controller; + #gpio-cells = <2>; + ngpios = <8>; + crc-en; + spi-addr = <0>; + ow-on-en = <0 0 0 0>; + ow-off-en = <0 0 0 0>; + sh-vdd-en = <0 0 0 0>; + drdy-gpios = <&test_gpio 0 0>; + fault-gpios = <&test_gpio 0 0>; + sync-gpios = <&test_gpio 0 0>; + en-gpios = <&test_gpio 0 0>; + }; }; }; }; From 7b2da4e191fe5594f3365df85d9c76136d7dbbda Mon Sep 17 00:00:00 2001 From: Stoyan Bogdanov Date: Fri, 14 Jun 2024 17:42:39 +0300 Subject: [PATCH 0459/4482] dts: bindings: gpio: Add dtb bindings for MAX14916 Industrial 8 channel input GPIO expander with diagnostics Per channel diagnostics from dtb Signed-off-by: Stoyan Bogdanov --- dts/bindings/gpio/adi,max14916-gpio.yaml | 190 +++++++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 dts/bindings/gpio/adi,max14916-gpio.yaml diff --git a/dts/bindings/gpio/adi,max14916-gpio.yaml b/dts/bindings/gpio/adi,max14916-gpio.yaml new file mode 100644 index 0000000000000..5a2a3ccde8326 --- /dev/null +++ b/dts/bindings/gpio/adi,max14916-gpio.yaml @@ -0,0 +1,190 @@ +# Copyright (c) 2024 Analog Devices Inc. +# Copyright (c) 2024 BayLibre SAS +# SPDX-License-Identifier: Apache-2.0 + +description: ADI MAX14916 is octal industrial output with advanced diagnostics + +compatible: "adi,max14916-gpio" + +properties: + "#gpio-cells": + const: 2 + ngpios: + type: int + required: true + const: 8 + description: Number of gpios supported + drdy-gpios: + description: | + High-Side Open-Drain Output. READY is passive low when the internal + logic supply is higher than the UVLO threshold, indicating that the + registers have adequate supply voltage. + type: phandle-array + fault-gpios: + description: | + Fault pin indicates when there is Fault state in either FAULT1 or FAULT2 + bothe of which are cleaned on read once problem is not persistent + type: phandle-array + sync-gpios: + description: | + Latch the data so it could be read (partially duplicate CS) + type: phandle-array + en-gpios: + description: | + DOI Enable Pin. Drive the EN pin high to enable the DOI_ outputs. + Drive EN low to disable/three-state all DOI_ outputs. + type: phandle-array + crc-en: + description: | + Notify driver if crc pin is enabled. + type: boolean + spi-addr: + type: int + default: 0 + required: true + enum: + - 0 + - 1 + - 2 + - 3 + description: | + On MAX14906PMB module default address is 0 (A0-LOW, A1-LOW) + Selectable device address, configurable from A0 and A1 + ow-on-en: + type: array + default: [0, 0, 0, 0, 0, 0, 0, 0] + description: | + Default values are from documentation. + Enable or disable open-wire-on functionality per channel. + - 0 mean disable + - 1 mean enable + channels indentation start from CH0...CH7 + ow-off-en: + type: array + default: [0, 0, 0, 0, 0, 0, 0, 0] + description: | + Default values are from documentation. + Enable or disable open-wire-off functionality per channel. + - 0 mean disable + - 1 mean enable + channels indentation start from CH0...CH7 + sh-vdd-en: + type: array + default: [0, 0, 0, 0, 0, 0, 0, 0] + description: | + Default values are from documentation. + ShVddEN - Short to VDD enable + Enable or disable short to VDD functionality per channel. + - 0 mean disable + - 1 mean enable + channels indentation start from CH0...CH3 + fled-set: + type: boolean + description: | + Internal fault diagnostics include (if enabled): SafeDemagF_, SHVDD_, + VDDOV_, OWOff_, AboveVDD_, CL_, OVL_, VDDOKFault_. + sled-set: + type: boolean + description: | + Enable status LEDs + fled-stretch: + type: int + default: 0 + enum: + - 0 + - 1 + - 2 + - 3 + description: | + Default values are from documentation. + Set minimum on time for FLEDs in case of fault + 0 - Disable minimum fault LED (FLED) on-time + 1 - Minimum fault LED (FLED) on-time = 1s (typ) + 2 - Minimum fault LED (FLED) on-time = 2s (typ) + 3 - Minimum fault LED (FLED) on-time = 3s (typ) + ffilter-en: + type: boolean + description: | + When the fault LEDs (FLEDs) are controlled internally (FLEDSet = 0), open- + wire and short-to-V DD diagnostics always use filtering and cannot be disabled + by the FFilterEn bit. + filter-long: + type: boolean + description: | + false: To select regular blanking time (4ms, typ) for diagnostic fault bits, OWOff_ + and SHVDD_ + true: To select long blanking time (8ms, typ) for diagnostic fault bits, OWOff_ + and SHVDD_ + flatch-en: + type: boolean + description: | + false: Disable latching of diagnostic fault bits in the OvrLdChF, OpnWirChF, and + ShtVDDChF registers + true: Enable latching of diagnostic fault bits in the OvrLdChF, OpnWirChF, and + ShtVDDChF registers + led-cur-lim: + type: boolean + description: | + false: Disable fault LEDs (FLEDs) signaling current limit + true: Enable fault LEDs (FLEDs) signaling current limit + vdd-on-thr: + type: boolean + description: | + Enable higher voltage thresholds for VDD and VDD_ undervoltage monitoring + synch-wd-en: + type: boolean + description: | + The SYNCH watchdog timeout is defined by the WDTo[1:0] bits if the SPI + watchdog is enabled. When WDTo[1:0] = 00 (SPI watchdog disabled), the + SYNCH watchdog timeout is 600ms (typ) if enabled. + sht-vdd-thr: + type: int + default: 0 + enum: + - 0 + - 1 + - 2 + - 3 + description: | + Default values are from documentation. + Set threshold voltage for short-to-V DD detection + 0: Set threshold voltage for short-to-VDD detection to 9V (typ) + 1: Set threshold voltage for short-to-VDD detection to 10V (typ) + 2: Set threshold voltage for short-to-VDD detection to 12V (typ) + 3: Set threshold voltage for short-to-VDD detection to 14V (typ) + ow-off-cs: + type: int + default: 0 + enum: + - 0 + - 1 + - 2 + - 3 + description: | + Default values are from documentation. + Set the pullup current for open-wire and short-to-VDD detection + 0: Set open-wire and short-to-VDD detection current to 60μA (typ) + 1: Set open-wire and short-to-VDD detection current to 100μA (typ) + 2: Set open-wire and short-to-VDD detection current to 300μA (typ) + 3: Set open-wire and short-to-VDD detection current to 600μA (typ) + wd-to: + type: int + default: 0 + enum: + - 0 + - 1 + - 2 + - 3 + description: | + Default values are from documentation. + SPI Watchdog Status, set SPI and SYNCH Watchdog Timeout + 0: Disable SPI Watchdog Status and SPI Watchdog Timeout + 1: Enable SPI Watchdog Status, set SPI and SYNCH Watchdog Timeout to 200ms (typ) + 2: Enable SPI Watchdog Status, set SPI and SYNCH Watchdog Timeout to 600ms (typ) + 3: Enable SPI Watchdog Status, set SPI and SYNCH Watchdog Timeout to 1.2s (typ) + +gpio-cells: + - pin + - flags + +include: [gpio-controller.yaml, spi-device.yaml] From 0e2daaa9fa472471ac9efb3feb9b5ea78d855559 Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Tue, 1 Oct 2024 16:45:54 +0530 Subject: [PATCH 0460/4482] manifest: modules: hal: nordic: Pull in fix for country code Pull in changes to pass country code as string to firmware. Signed-off-by: Ravi Dondaputi --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index c0415433bc278..37ed9e8991d81 100644 --- a/west.yml +++ b/west.yml @@ -188,7 +188,7 @@ manifest: groups: - hal - name: hal_nordic - revision: ee6213b6cfcd7fdc10f7ec3a4f7f37f35dfa5343 + revision: bc25c094a8cf3064f4f9c1e8060b46e1989edf95 path: modules/hal/nordic groups: - hal From d403d73ad7b773a83d00d43b40b928630b8365a1 Mon Sep 17 00:00:00 2001 From: Jonathan Nilsen Date: Thu, 12 Sep 2024 10:09:57 +0200 Subject: [PATCH 0461/4482] boards: nordic: update custom JLink reset scheme for ADACv2 Version 2 of the ADAC interface implemented by secure domain firmware changes the ADAC RESET command used in the custom reset handling in the JLink support scripts. The command has been split into two commands, RESET and START, and has different semantics from the previous RESET command. The new RESET command resets both the application and radio domains without starting the CPUs again, and the START command must then be used to start the CPUs. Update the JLink support scripts for nrf54h20dk/nrf54h20/cpuapp, nrf54h20dk/nrf54h20/cpurad, nrf9280pdk/nrf9280/cpuapp and nrf9280pdk/nrf9280/cpurad so that they read out the ADAC interface version from the device and use the newer commands if ADAC version 2 is detected. If the version is lower than 2, the legacy implementation is used. Also improve the CTRL-AP MAILBOX transaction implementation to avoid the need for arbitrary sleeps or unnecessary polling of the MAILBOX. This should improve stability when using the script. Signed-off-by: Jonathan Nilsen --- .../support/nrf54h20_cpuapp.JLinkScript | 259 +++++++++++++++-- .../support/nrf54h20_cpurad.JLinkScript | 262 ++++++++++++++++-- .../support/nrf9280_cpuapp.JLinkScript | 259 +++++++++++++++-- .../support/nrf9280_cpurad.JLinkScript | 262 ++++++++++++++++-- 4 files changed, 960 insertions(+), 82 deletions(-) diff --git a/boards/nordic/nrf54h20dk/support/nrf54h20_cpuapp.JLinkScript b/boards/nordic/nrf54h20dk/support/nrf54h20_cpuapp.JLinkScript index ffa1beed1ed65..28010addbf154 100644 --- a/boards/nordic/nrf54h20dk/support/nrf54h20_cpuapp.JLinkScript +++ b/boards/nordic/nrf54h20dk/support/nrf54h20_cpuapp.JLinkScript @@ -1,29 +1,248 @@ +// Constants specific to the application core +__constant U32 _CPUCONF_ADDR = 0x52011000; +__constant U32 _PROCESSOR_ID = 2; +__constant U32 _DOMAIN_ID = 2; +__constant U32 _NUM_OTHER_PROCESSORS = 1; +const U32 _OTHER_PROCESSOR_IDS[1] = {3}; + // Debug Halting Control and Status Register -__constant U32 _DHCSR_ADDR = 0xE000EDF0; -__constant U32 _DHCSR_DBGKEY = (0xA05F << 16); -__constant U32 _DHCSR_C_DEBUGEN = (1 << 0); -__constant U32 _DHCSR_C_HALT = (1 << 1); +__constant U32 _DHCSR_ADDR = 0xE000EDF0; +__constant U32 _DHCSR_DBGKEY = (0xA05F << 16); +__constant U32 _DHCSR_C_DEBUGEN = (1 << 0); +__constant U32 _DHCSR_C_HALT = (1 << 1); // Debug Exception and Monitor Control Register -__constant U32 _DEMCR_ADDR = 0xE000EDFC; -__constant U32 _DEMCR_VC_CORERESET = (1 << 0); -__constant U32 _DEMCR_TRCENA = (1 << 24); +__constant U32 _DEMCR_ADDR = 0xE000EDFC; +__constant U32 _DEMCR_VC_CORERESET = (1 << 0); +__constant U32 _DEMCR_TRCENA = (1 << 24); // CPU wait enable register -__constant U32 _CPUCONF_CPUWAIT_ADDR = 0x5201150C; +__constant U32 _CPUCONF_CPUWAIT_OFFSET = 0x50C; + +// CTRL-AP +__constant U32 _CTRLAP_ID = 4; +__constant U32 _CTRLAP_READY_BANK = 0; +__constant U32 _CTRLAP_READY_OFFSET = 1; +__constant U32 _CTRLAP_READY = 0; +__constant U32 _CTRLAP_MAILBOX_BANK = 1; +__constant U32 _CTRLAP_MAILBOX_TXDATA_OFFSET = 0; +__constant U32 _CTRLAP_MAILBOX_TXSTATUS_OFFSET = 1; +__constant U32 _CTRLAP_MAILBOX_RXDATA_OFFSET = 2; +__constant U32 _CTRLAP_MAILBOX_RXSTATUS_OFFSET = 3; +__constant U32 _CTRLAP_MAILBOX_NO_DATA_PENDING = 0; +__constant U32 _CTRLAP_MAILBOX_DATA_PENDING = 1; +__constant int _CTRLAP_TIMEOUT_MS = 500; + +// ADAC transaction buffers +static U32 _adacTx[20]; +static U32 _adacRx[20]; + +// Failed to send to the CTRL-AP MAILBOX +__constant int _ERR_TX = -1; +// Failed to receive from the CTRL-AP MAILBOX +__constant int _ERR_RX = -2; +// ADAC command returned an error +__constant int _ERR_REPLY = -3; + +// Wait for an AP register read to return the expected value. +int _WaitForDataStatus(U32 regOffset, int expectedStatus) +{ + int status; + int ret; + int start; + int elapsed; + + status = 0; + start = JLINK_GetTime(); + elapsed = 0; + + do { + ret = JLINK_CORESIGHT_ReadDAP(regOffset, 1, &status); + elapsed = JLINK_GetTime() - start; + } while ((ret < 0 || status != expectedStatus) && (elapsed < _CTRLAP_TIMEOUT_MS)); + + if (ret < 0) { + return ret; + } + + return status; +} + +// Continuously read from the CTRL-AP MAILBOX until there is no more pending data. +void _DrainMailbox(void) +{ + int ret; + int status; + int data; + + ret = JLINK_CORESIGHT_ReadDAP(_CTRLAP_MAILBOX_RXSTATUS_OFFSET, 1, &status); + while (ret >= 0 && status == _CTRLAP_MAILBOX_DATA_PENDING) { + JLINK_CORESIGHT_ReadDAP(_CTRLAP_MAILBOX_RXDATA_OFFSET, 1, &data); + ret = JLINK_CORESIGHT_ReadDAP(_CTRLAP_MAILBOX_RXSTATUS_OFFSET, 1, &status); + } +} + +// Perform an ADAC transaction by: +// * writing the given sequence of words to MAILBOX.TXDATATA, waiting for MAILBOX.TXSTATUS +// readiness before each write. +// * reading a sequence of words from MAILBOX.RXDATA, waiting for MAILBOX.RXSTATUS readiness before +// each read. +// +// The message to send is read from _adacTx and the reply is written to _adacRx. +// Optionally checks if a single data word is returned and returns an error if it is non-zero. +// +// Assumes that the correct AP and AP bank for CTRL-AP MAILBOX has been selected in the DP. +int _DoAdacTransaction(int checkReplyStatus) +{ + int numWords; + int ret; + int data; + int i; + + i = 0; + numWords = 2 + (_adacTx[1] >> 2); // Length based on the length field of the message + + while (i < numWords) { + ret = _WaitForDataStatus(_CTRLAP_MAILBOX_TXSTATUS_OFFSET, + _CTRLAP_MAILBOX_NO_DATA_PENDING); + if (ret != _CTRLAP_MAILBOX_NO_DATA_PENDING) { + JLINK_SYS_Report1("Timed out waiting for CTRL-AP TX readiness - result: ", + ret); + return _ERR_TX; + } + + ret = JLINK_CORESIGHT_WriteDAP(_CTRLAP_MAILBOX_TXDATA_OFFSET, 1, _adacTx[i]); + if (ret < 0) { + JLINK_SYS_Report1("Failed to write CTRL-AP TX data - result: ", ret); + return _ERR_TX; + } + + i += 1; + } + + i = 0; + numWords = 2; // Minimum message length + + while (i < numWords) { + ret = _WaitForDataStatus(_CTRLAP_MAILBOX_RXSTATUS_OFFSET, + _CTRLAP_MAILBOX_DATA_PENDING); + if (ret != _CTRLAP_MAILBOX_DATA_PENDING) { + JLINK_SYS_Report1("Timed out waiting for CTRL-AP RX data - result: ", ret); + return _ERR_RX; + } + + ret = JLINK_CORESIGHT_ReadDAP(_CTRLAP_MAILBOX_RXDATA_OFFSET, 1, &data); + if (ret < 0) { + JLINK_SYS_Report1("Failed to read CTRL-AP RX data - result: ", ret); + return _ERR_RX; + } + + if (i == 1) { + // Update total length based on the message length field + numWords = 2 + (data >> 2); + } + + _adacRx[i] = data; + i += 1; + } + + if (checkReplyStatus && _adacRx[1] == 4 && _adacRx[2] != 0) { + JLINK_SYS_Report1("ADAC command failed with status: ", _adacRx[2]); + return _ERR_REPLY; + } + + return 0; +} + +int ResetTarget(void) +{ + int err; + U32 adacMajorVersion; + U32 i; + + // Select CTRL-AP bank 0, used for the READY register + JLINK_CORESIGHT_WriteDAP(JLINK_CORESIGHT_DP_REG_SELECT, 0, + (_CTRLAP_ID << 24) | (_CTRLAP_READY_BANK << 4)); + + // Wait for the READY register to indicate that the AP can be used. + err = _WaitForDataStatus(_CTRLAP_READY_OFFSET, _CTRLAP_READY); + if (err < 0) { + JLINK_SYS_Report1("Timed out waiting for CTRL-AP readiness - result: ", err); + return -1; + } + + // Select CTRL-AP bank 1, used for the MAILBOX registers for ADAC communication + JLINK_CORESIGHT_WriteDAP(JLINK_CORESIGHT_DP_REG_SELECT, 0, + (_CTRLAP_ID << 24) | (_CTRLAP_MAILBOX_BANK << 4)); + + // Extract any pre-existing data from the mailbox in case there was previously + // an aborted transaction. + _DrainMailbox(); + + // Read the ADAC version + _adacTx[0] = 0xA3000000; // Command VERSION + _adacTx[1] = 0x00000004; // Data length 4 bytes + _adacTx[2] = 0x00000000; // Type 0 (ADAC version) + err = _DoAdacTransaction(0); + if (err < 0) { + return -1; + } + + adacMajorVersion = (_adacRx[2] >> 24) & 0xff; + JLINK_SYS_Report1("ADAC major version: ", adacMajorVersion); + + if (adacMajorVersion >= 2) { + // There is a very small chance that this command fails if the domain reset itself + // at the exact same time the command was issued. Therefore we retry a few times. + i = 0; + while (i < 3) { + // Reset non-essential domains + _adacTx[0] = 0xA30A0000; // Command RESET + _adacTx[1] = 0x00000004; // Data length 4 bytes + _adacTx[2] = 0x00000000; // (reserved) + err = _DoAdacTransaction(1); + if (err >= 0) { + break; + } else if (err != _ERR_REPLY) { + return -1; + } + + i = i + 1; + } + + // Start the core in halted mode + _adacTx[0] = 0xA3090000; // Command START + _adacTx[1] = 0x00000004; // Data length 4 bytes + _adacTx[2] = 0x01000000 | (_PROCESSOR_ID << 16); // Own processor, Flags HALT + err = _DoAdacTransaction(1); + if (err < 0) { + return -1; + } -int ResetTarget(void) { - // ADAC reset - JLINK_CORESIGHT_WriteDP(2, 0x04000010); - JLINK_CORESIGHT_WriteAP(0, 0xA3030000); - JLINK_CORESIGHT_WriteAP(0, 0x00000004); - JLINK_CORESIGHT_WriteAP(0, 0x01020000); + // Start other cores normally (will fail silently if no firmware is present) + i = 0; + while (i < _NUM_OTHER_PROCESSORS) { + _adacTx[0] = 0xA3090000; // Command START + _adacTx[1] = 0x00000004; // Data length 4 bytes + _adacTx[2] = 0x00000000 | + (_OTHER_PROCESSOR_IDS[i] << 16); // Other processor, No flags + err = _DoAdacTransaction(0); + if (err < 0 && err != _ERR_REPLY) { + return -1; + } - JLINK_SYS_Sleep(100); - JLINK_CORESIGHT_ReadAP(2); - JLINK_CORESIGHT_ReadAP(2); - JLINK_CORESIGHT_ReadAP(2); - JLINK_CORESIGHT_ReadAP(2); + i = i + 1; + } + } else { + // Reset single domain via legacy implementation + _adacTx[0] = 0xA3030000; // Command RESET + _adacTx[1] = 0x00000004; // Data length 4 bytes + _adacTx[2] = 0x01000000 | (_DOMAIN_ID << 16); // Own domain, Mode HALT + err = _DoAdacTransaction(1); + if (err < 0) { + return -1; + } + } // Halt the CPU JLINK_MEM_WriteU32(_DHCSR_ADDR, (_DHCSR_DBGKEY | _DHCSR_C_HALT | _DHCSR_C_DEBUGEN)); @@ -32,7 +251,7 @@ int ResetTarget(void) { JLINK_MEM_WriteU32(_DEMCR_ADDR, (_DEMCR_VC_CORERESET | _DEMCR_TRCENA)); // Disable CPU wait - JLINK_MEM_WriteU32(_CPUCONF_CPUWAIT_ADDR, 0); + JLINK_MEM_WriteU32(_CPUCONF_ADDR + _CPUCONF_CPUWAIT_OFFSET, 0); // Clear vector catch stuff JLINK_MEM_WriteU32(_DEMCR_ADDR, _DEMCR_TRCENA); diff --git a/boards/nordic/nrf54h20dk/support/nrf54h20_cpurad.JLinkScript b/boards/nordic/nrf54h20dk/support/nrf54h20_cpurad.JLinkScript index 2f1802801c11c..5c2065307ff56 100644 --- a/boards/nordic/nrf54h20dk/support/nrf54h20_cpurad.JLinkScript +++ b/boards/nordic/nrf54h20dk/support/nrf54h20_cpurad.JLinkScript @@ -1,36 +1,256 @@ +// Constants specific to the radio core +__constant U32 _CPUCONF_ADDR = 0x53011000; +__constant U32 _PROCESSOR_ID = 3; +__constant U32 _DOMAIN_ID = 3; +__constant U32 _NUM_OTHER_PROCESSORS = 1; +const U32 _OTHER_PROCESSOR_IDS[1] = {2}; + // Debug Halting Control and Status Register -__constant U32 _DHCSR_ADDR = 0xE000EDF0; -__constant U32 _DHCSR_DBGKEY = (0xA05F << 16); -__constant U32 _DHCSR_C_DEBUGEN = (1 << 0); -__constant U32 _DHCSR_C_HALT = (1 << 1); +__constant U32 _DHCSR_ADDR = 0xE000EDF0; +__constant U32 _DHCSR_DBGKEY = (0xA05F << 16); +__constant U32 _DHCSR_C_DEBUGEN = (1 << 0); +__constant U32 _DHCSR_C_HALT = (1 << 1); // Debug Exception and Monitor Control Register -__constant U32 _DEMCR_ADDR = 0xE000EDFC; -__constant U32 _DEMCR_VC_CORERESET = (1 << 0); -__constant U32 _DEMCR_TRCENA = (1 << 24); +__constant U32 _DEMCR_ADDR = 0xE000EDFC; +__constant U32 _DEMCR_VC_CORERESET = (1 << 0); +__constant U32 _DEMCR_TRCENA = (1 << 24); // CPU wait enable register -__constant U32 _CPUCONF_CPUWAIT_ADDR = 0x5301150C; +__constant U32 _CPUCONF_CPUWAIT_OFFSET = 0x50C; + +// CTRL-AP +__constant U32 _CTRLAP_ID = 4; +__constant U32 _CTRLAP_READY_BANK = 0; +__constant U32 _CTRLAP_READY_OFFSET = 1; +__constant U32 _CTRLAP_READY = 0; +__constant U32 _CTRLAP_MAILBOX_BANK = 1; +__constant U32 _CTRLAP_MAILBOX_TXDATA_OFFSET = 0; +__constant U32 _CTRLAP_MAILBOX_TXSTATUS_OFFSET = 1; +__constant U32 _CTRLAP_MAILBOX_RXDATA_OFFSET = 2; +__constant U32 _CTRLAP_MAILBOX_RXSTATUS_OFFSET = 3; +__constant U32 _CTRLAP_MAILBOX_NO_DATA_PENDING = 0; +__constant U32 _CTRLAP_MAILBOX_DATA_PENDING = 1; +__constant int _CTRLAP_TIMEOUT_MS = 500; + +// ADAC transaction buffers +static U32 _adacTx[20]; +static U32 _adacRx[20]; + +// Failed to send to the CTRL-AP MAILBOX +__constant int _ERR_TX = -1; +// Failed to receive from the CTRL-AP MAILBOX +__constant int _ERR_RX = -2; +// ADAC command returned an error +__constant int _ERR_REPLY = -3; + +// Wait for an AP register read to return the expected value. +int _WaitForDataStatus(U32 regOffset, int expectedStatus) +{ + int status; + int ret; + int start; + int elapsed; + + status = 0; + start = JLINK_GetTime(); + elapsed = 0; + + do { + ret = JLINK_CORESIGHT_ReadDAP(regOffset, 1, &status); + elapsed = JLINK_GetTime() - start; + } while ((ret < 0 || status != expectedStatus) && (elapsed < _CTRLAP_TIMEOUT_MS)); + + if (ret < 0) { + return ret; + } + + return status; +} + +// Continuously read from the CTRL-AP MAILBOX until there is no more pending data. +void _DrainMailbox(void) +{ + int ret; + int status; + int data; + + ret = JLINK_CORESIGHT_ReadDAP(_CTRLAP_MAILBOX_RXSTATUS_OFFSET, 1, &status); + while (ret >= 0 && status == _CTRLAP_MAILBOX_DATA_PENDING) { + JLINK_CORESIGHT_ReadDAP(_CTRLAP_MAILBOX_RXDATA_OFFSET, 1, &data); + ret = JLINK_CORESIGHT_ReadDAP(_CTRLAP_MAILBOX_RXSTATUS_OFFSET, 1, &status); + } +} + +// Perform an ADAC transaction by: +// * writing the given sequence of words to MAILBOX.TXDATATA, waiting for MAILBOX.TXSTATUS +// readiness before each write. +// * reading a sequence of words from MAILBOX.RXDATA, waiting for MAILBOX.RXSTATUS readiness before +// each read. +// +// The message to send is read from _adacTx and the reply is written to _adacRx. +// Optionally checks if a single data word is returned and returns an error if it is non-zero. +// +// Assumes that the correct AP and AP bank for CTRL-AP MAILBOX has been selected in the DP. +int _DoAdacTransaction(int checkReplyStatus) +{ + int numWords; + int ret; + int data; + int i; + + i = 0; + numWords = 2 + (_adacTx[1] >> 2); // Length based on the length field of the message + + while (i < numWords) { + ret = _WaitForDataStatus(_CTRLAP_MAILBOX_TXSTATUS_OFFSET, + _CTRLAP_MAILBOX_NO_DATA_PENDING); + if (ret != _CTRLAP_MAILBOX_NO_DATA_PENDING) { + JLINK_SYS_Report1("Timed out waiting for CTRL-AP TX readiness - result: ", + ret); + return _ERR_TX; + } + + ret = JLINK_CORESIGHT_WriteDAP(_CTRLAP_MAILBOX_TXDATA_OFFSET, 1, _adacTx[i]); + if (ret < 0) { + JLINK_SYS_Report1("Failed to write CTRL-AP TX data - result: ", ret); + return _ERR_TX; + } + + i += 1; + } + + i = 0; + numWords = 2; // Minimum message length -int ConfigTargetSettings(void) { + while (i < numWords) { + ret = _WaitForDataStatus(_CTRLAP_MAILBOX_RXSTATUS_OFFSET, + _CTRLAP_MAILBOX_DATA_PENDING); + if (ret != _CTRLAP_MAILBOX_DATA_PENDING) { + JLINK_SYS_Report1("Timed out waiting for CTRL-AP RX data - result: ", ret); + return _ERR_RX; + } + + ret = JLINK_CORESIGHT_ReadDAP(_CTRLAP_MAILBOX_RXDATA_OFFSET, 1, &data); + if (ret < 0) { + JLINK_SYS_Report1("Failed to read CTRL-AP RX data - result: ", ret); + return _ERR_RX; + } + + if (i == 1) { + // Update total length based on the message length field + numWords = 2 + (data >> 2); + } + + _adacRx[i] = data; + i += 1; + } + + if (checkReplyStatus && _adacRx[1] == 4 && _adacRx[2] != 0) { + JLINK_SYS_Report1("ADAC command failed with status: ", _adacRx[2]); + return _ERR_REPLY; + } + + return 0; +} + +int ConfigTargetSettings(void) +{ JLINK_ExecCommand("CORESIGHT_AddAP = Index=1 Type=AHB-AP"); CORESIGHT_IndexAHBAPToUse = 1; return 0; } -int ResetTarget(void) { - // ADAC reset - JLINK_CORESIGHT_WriteDP(2, 0x04000010); - JLINK_CORESIGHT_WriteAP(0, 0xA3030000); - JLINK_CORESIGHT_WriteAP(0, 0x00000004); - JLINK_CORESIGHT_WriteAP(0, 0x01030000); +int ResetTarget(void) +{ + int err; + U32 adacMajorVersion; + U32 i; + + // Select CTRL-AP bank 0, used for the READY register + JLINK_CORESIGHT_WriteDAP(JLINK_CORESIGHT_DP_REG_SELECT, 0, + (_CTRLAP_ID << 24) | (_CTRLAP_READY_BANK << 4)); + + // Wait for the READY register to indicate that the AP can be used. + err = _WaitForDataStatus(_CTRLAP_READY_OFFSET, _CTRLAP_READY); + if (err < 0) { + JLINK_SYS_Report1("Timed out waiting for CTRL-AP readiness - result: ", err); + return -1; + } + + // Select CTRL-AP bank 1, used for the MAILBOX registers for ADAC communication + JLINK_CORESIGHT_WriteDAP(JLINK_CORESIGHT_DP_REG_SELECT, 0, + (_CTRLAP_ID << 24) | (_CTRLAP_MAILBOX_BANK << 4)); + + // Extract any pre-existing data from the mailbox in case there was previously + // an aborted transaction. + _DrainMailbox(); + + // Read the ADAC version + _adacTx[0] = 0xA3000000; // Command VERSION + _adacTx[1] = 0x00000004; // Data length 4 bytes + _adacTx[2] = 0x00000000; // Type 0 (ADAC version) + err = _DoAdacTransaction(0); + if (err < 0) { + return -1; + } + + adacMajorVersion = (_adacRx[2] >> 24) & 0xff; + JLINK_SYS_Report1("ADAC major version: ", adacMajorVersion); + + if (adacMajorVersion >= 2) { + // There is a very small chance that this command fails if the domain reset itself + // at the exact same time the command was issued. Therefore we retry a few times. + i = 0; + while (i < 3) { + // Reset non-essential domains + _adacTx[0] = 0xA30A0000; // Command RESET + _adacTx[1] = 0x00000004; // Data length 4 bytes + _adacTx[2] = 0x00000000; // (reserved) + err = _DoAdacTransaction(1); + if (err >= 0) { + break; + } else if (err != _ERR_REPLY) { + return -1; + } + + i = i + 1; + } + + // Start the core in halted mode + _adacTx[0] = 0xA3090000; // Command START + _adacTx[1] = 0x00000004; // Data length 4 bytes + _adacTx[2] = 0x01000000 | (_PROCESSOR_ID << 16); // Own processor, Flags HALT + err = _DoAdacTransaction(1); + if (err < 0) { + return -1; + } + + // Start other cores normally (will fail silently if no firmware is present) + i = 0; + while (i < _NUM_OTHER_PROCESSORS) { + _adacTx[0] = 0xA3090000; // Command START + _adacTx[1] = 0x00000004; // Data length 4 bytes + _adacTx[2] = 0x00000000 | + (_OTHER_PROCESSOR_IDS[i] << 16); // Other processor, No flags + err = _DoAdacTransaction(0); + if (err < 0 && err != _ERR_REPLY) { + return -1; + } - JLINK_SYS_Sleep(100); - JLINK_CORESIGHT_ReadAP(2); - JLINK_CORESIGHT_ReadAP(2); - JLINK_CORESIGHT_ReadAP(2); - JLINK_CORESIGHT_ReadAP(2); + i = i + 1; + } + } else { + // Reset single domain via legacy implementation + _adacTx[0] = 0xA3030000; // Command RESET + _adacTx[1] = 0x00000004; // Data length 4 bytes + _adacTx[2] = 0x01000000 | (_DOMAIN_ID << 16); // Own domain, Mode HALT + err = _DoAdacTransaction(1); + if (err < 0) { + return -1; + } + } // Halt the CPU JLINK_MEM_WriteU32(_DHCSR_ADDR, (_DHCSR_DBGKEY | _DHCSR_C_HALT | _DHCSR_C_DEBUGEN)); @@ -39,7 +259,7 @@ int ResetTarget(void) { JLINK_MEM_WriteU32(_DEMCR_ADDR, (_DEMCR_VC_CORERESET | _DEMCR_TRCENA)); // Disable CPU wait - JLINK_MEM_WriteU32(_CPUCONF_CPUWAIT_ADDR, 0); + JLINK_MEM_WriteU32(_CPUCONF_ADDR + _CPUCONF_CPUWAIT_OFFSET, 0); // Clear vector catch stuff JLINK_MEM_WriteU32(_DEMCR_ADDR, _DEMCR_TRCENA); diff --git a/boards/nordic/nrf9280pdk/support/nrf9280_cpuapp.JLinkScript b/boards/nordic/nrf9280pdk/support/nrf9280_cpuapp.JLinkScript index ffa1beed1ed65..5791a7bed9b12 100644 --- a/boards/nordic/nrf9280pdk/support/nrf9280_cpuapp.JLinkScript +++ b/boards/nordic/nrf9280pdk/support/nrf9280_cpuapp.JLinkScript @@ -1,29 +1,248 @@ +// Constants specific to the application core +__constant U32 _CPUCONF_ADDR = 0x52011000; +__constant U32 _PROCESSOR_ID = 2; +__constant U32 _DOMAIN_ID = 2; +__constant U32 _NUM_OTHER_PROCESSORS = 2; +const U32 _OTHER_PROCESSOR_IDS[2] = {4, 3}; + // Debug Halting Control and Status Register -__constant U32 _DHCSR_ADDR = 0xE000EDF0; -__constant U32 _DHCSR_DBGKEY = (0xA05F << 16); -__constant U32 _DHCSR_C_DEBUGEN = (1 << 0); -__constant U32 _DHCSR_C_HALT = (1 << 1); +__constant U32 _DHCSR_ADDR = 0xE000EDF0; +__constant U32 _DHCSR_DBGKEY = (0xA05F << 16); +__constant U32 _DHCSR_C_DEBUGEN = (1 << 0); +__constant U32 _DHCSR_C_HALT = (1 << 1); // Debug Exception and Monitor Control Register -__constant U32 _DEMCR_ADDR = 0xE000EDFC; -__constant U32 _DEMCR_VC_CORERESET = (1 << 0); -__constant U32 _DEMCR_TRCENA = (1 << 24); +__constant U32 _DEMCR_ADDR = 0xE000EDFC; +__constant U32 _DEMCR_VC_CORERESET = (1 << 0); +__constant U32 _DEMCR_TRCENA = (1 << 24); // CPU wait enable register -__constant U32 _CPUCONF_CPUWAIT_ADDR = 0x5201150C; +__constant U32 _CPUCONF_CPUWAIT_OFFSET = 0x50C; + +// CTRL-AP +__constant U32 _CTRLAP_ID = 4; +__constant U32 _CTRLAP_READY_BANK = 0; +__constant U32 _CTRLAP_READY_OFFSET = 1; +__constant U32 _CTRLAP_READY = 0; +__constant U32 _CTRLAP_MAILBOX_BANK = 1; +__constant U32 _CTRLAP_MAILBOX_TXDATA_OFFSET = 0; +__constant U32 _CTRLAP_MAILBOX_TXSTATUS_OFFSET = 1; +__constant U32 _CTRLAP_MAILBOX_RXDATA_OFFSET = 2; +__constant U32 _CTRLAP_MAILBOX_RXSTATUS_OFFSET = 3; +__constant U32 _CTRLAP_MAILBOX_NO_DATA_PENDING = 0; +__constant U32 _CTRLAP_MAILBOX_DATA_PENDING = 1; +__constant int _CTRLAP_TIMEOUT_MS = 500; + +// ADAC transaction buffers +static U32 _adacTx[20]; +static U32 _adacRx[20]; + +// Failed to send to the CTRL-AP MAILBOX +__constant int _ERR_TX = -1; +// Failed to receive from the CTRL-AP MAILBOX +__constant int _ERR_RX = -2; +// ADAC command returned an error +__constant int _ERR_REPLY = -3; + +// Wait for an AP register read to return the expected value. +int _WaitForDataStatus(U32 regOffset, int expectedStatus) +{ + int status; + int ret; + int start; + int elapsed; + + status = 0; + start = JLINK_GetTime(); + elapsed = 0; + + do { + ret = JLINK_CORESIGHT_ReadDAP(regOffset, 1, &status); + elapsed = JLINK_GetTime() - start; + } while ((ret < 0 || status != expectedStatus) && (elapsed < _CTRLAP_TIMEOUT_MS)); + + if (ret < 0) { + return ret; + } + + return status; +} + +// Continuously read from the CTRL-AP MAILBOX until there is no more pending data. +void _DrainMailbox(void) +{ + int ret; + int status; + int data; + + ret = JLINK_CORESIGHT_ReadDAP(_CTRLAP_MAILBOX_RXSTATUS_OFFSET, 1, &status); + while (ret >= 0 && status == _CTRLAP_MAILBOX_DATA_PENDING) { + JLINK_CORESIGHT_ReadDAP(_CTRLAP_MAILBOX_RXDATA_OFFSET, 1, &data); + ret = JLINK_CORESIGHT_ReadDAP(_CTRLAP_MAILBOX_RXSTATUS_OFFSET, 1, &status); + } +} + +// Perform an ADAC transaction by: +// * writing the given sequence of words to MAILBOX.TXDATATA, waiting for MAILBOX.TXSTATUS +// readiness before each write. +// * reading a sequence of words from MAILBOX.RXDATA, waiting for MAILBOX.RXSTATUS readiness before +// each read. +// +// The message to send is read from _adacTx and the reply is written to _adacRx. +// Optionally checks if a single data word is returned and returns an error if it is non-zero. +// +// Assumes that the correct AP and AP bank for CTRL-AP MAILBOX has been selected in the DP. +int _DoAdacTransaction(int checkReplyStatus) +{ + int numWords; + int ret; + int data; + int i; + + i = 0; + numWords = 2 + (_adacTx[1] >> 2); // Length based on the length field of the message + + while (i < numWords) { + ret = _WaitForDataStatus(_CTRLAP_MAILBOX_TXSTATUS_OFFSET, + _CTRLAP_MAILBOX_NO_DATA_PENDING); + if (ret != _CTRLAP_MAILBOX_NO_DATA_PENDING) { + JLINK_SYS_Report1("Timed out waiting for CTRL-AP TX readiness - result: ", + ret); + return _ERR_TX; + } + + ret = JLINK_CORESIGHT_WriteDAP(_CTRLAP_MAILBOX_TXDATA_OFFSET, 1, _adacTx[i]); + if (ret < 0) { + JLINK_SYS_Report1("Failed to write CTRL-AP TX data - result: ", ret); + return _ERR_TX; + } + + i += 1; + } + + i = 0; + numWords = 2; // Minimum message length + + while (i < numWords) { + ret = _WaitForDataStatus(_CTRLAP_MAILBOX_RXSTATUS_OFFSET, + _CTRLAP_MAILBOX_DATA_PENDING); + if (ret != _CTRLAP_MAILBOX_DATA_PENDING) { + JLINK_SYS_Report1("Timed out waiting for CTRL-AP RX data - result: ", ret); + return _ERR_RX; + } + + ret = JLINK_CORESIGHT_ReadDAP(_CTRLAP_MAILBOX_RXDATA_OFFSET, 1, &data); + if (ret < 0) { + JLINK_SYS_Report1("Failed to read CTRL-AP RX data - result: ", ret); + return _ERR_RX; + } + + if (i == 1) { + // Update total length based on the message length field + numWords = 2 + (data >> 2); + } + + _adacRx[i] = data; + i += 1; + } + + if (checkReplyStatus && _adacRx[1] == 4 && _adacRx[2] != 0) { + JLINK_SYS_Report1("ADAC command failed with status: ", _adacRx[2]); + return _ERR_REPLY; + } + + return 0; +} + +int ResetTarget(void) +{ + int err; + U32 adacMajorVersion; + U32 i; + + // Select CTRL-AP bank 0, used for the READY register + JLINK_CORESIGHT_WriteDAP(JLINK_CORESIGHT_DP_REG_SELECT, 0, + (_CTRLAP_ID << 24) | (_CTRLAP_READY_BANK << 4)); + + // Wait for the READY register to indicate that the AP can be used. + err = _WaitForDataStatus(_CTRLAP_READY_OFFSET, _CTRLAP_READY); + if (err < 0) { + JLINK_SYS_Report1("Timed out waiting for CTRL-AP readiness - result: ", err); + return -1; + } + + // Select CTRL-AP bank 1, used for the MAILBOX registers for ADAC communication + JLINK_CORESIGHT_WriteDAP(JLINK_CORESIGHT_DP_REG_SELECT, 0, + (_CTRLAP_ID << 24) | (_CTRLAP_MAILBOX_BANK << 4)); + + // Extract any pre-existing data from the mailbox in case there was previously + // an aborted transaction. + _DrainMailbox(); + + // Read the ADAC version + _adacTx[0] = 0xA3000000; // Command VERSION + _adacTx[1] = 0x00000004; // Data length 4 bytes + _adacTx[2] = 0x00000000; // Type 0 (ADAC version) + err = _DoAdacTransaction(0); + if (err < 0) { + return -1; + } + + adacMajorVersion = (_adacRx[2] >> 24) & 0xff; + JLINK_SYS_Report1("ADAC major version: ", adacMajorVersion); + + if (adacMajorVersion >= 2) { + // There is a very small chance that this command fails if the domain reset itself + // at the exact same time the command was issued. Therefore we retry a few times. + i = 0; + while (i < 3) { + // Reset non-essential domains + _adacTx[0] = 0xA30A0000; // Command RESET + _adacTx[1] = 0x00000004; // Data length 4 bytes + _adacTx[2] = 0x00000000; // (reserved) + err = _DoAdacTransaction(1); + if (err >= 0) { + break; + } else if (err != _ERR_REPLY) { + return -1; + } + + i = i + 1; + } + + // Start the core in halted mode + _adacTx[0] = 0xA3090000; // Command START + _adacTx[1] = 0x00000004; // Data length 4 bytes + _adacTx[2] = 0x01000000 | (_PROCESSOR_ID << 16); // Own processor, Flags HALT + err = _DoAdacTransaction(1); + if (err < 0) { + return -1; + } -int ResetTarget(void) { - // ADAC reset - JLINK_CORESIGHT_WriteDP(2, 0x04000010); - JLINK_CORESIGHT_WriteAP(0, 0xA3030000); - JLINK_CORESIGHT_WriteAP(0, 0x00000004); - JLINK_CORESIGHT_WriteAP(0, 0x01020000); + // Start other cores normally (will fail silently if no firmware is present) + i = 0; + while (i < _NUM_OTHER_PROCESSORS) { + _adacTx[0] = 0xA3090000; // Command START + _adacTx[1] = 0x00000004; // Data length 4 bytes + _adacTx[2] = 0x00000000 | + (_OTHER_PROCESSOR_IDS[i] << 16); // Other processor, No flags + err = _DoAdacTransaction(0); + if (err < 0 && err != _ERR_REPLY) { + return -1; + } - JLINK_SYS_Sleep(100); - JLINK_CORESIGHT_ReadAP(2); - JLINK_CORESIGHT_ReadAP(2); - JLINK_CORESIGHT_ReadAP(2); - JLINK_CORESIGHT_ReadAP(2); + i = i + 1; + } + } else { + // Reset single domain via legacy implementation + _adacTx[0] = 0xA3030000; // Command RESET + _adacTx[1] = 0x00000004; // Data length 4 bytes + _adacTx[2] = 0x01000000 | (_DOMAIN_ID << 16); // Own domain, Mode HALT + err = _DoAdacTransaction(1); + if (err < 0) { + return -1; + } + } // Halt the CPU JLINK_MEM_WriteU32(_DHCSR_ADDR, (_DHCSR_DBGKEY | _DHCSR_C_HALT | _DHCSR_C_DEBUGEN)); @@ -32,7 +251,7 @@ int ResetTarget(void) { JLINK_MEM_WriteU32(_DEMCR_ADDR, (_DEMCR_VC_CORERESET | _DEMCR_TRCENA)); // Disable CPU wait - JLINK_MEM_WriteU32(_CPUCONF_CPUWAIT_ADDR, 0); + JLINK_MEM_WriteU32(_CPUCONF_ADDR + _CPUCONF_CPUWAIT_OFFSET, 0); // Clear vector catch stuff JLINK_MEM_WriteU32(_DEMCR_ADDR, _DEMCR_TRCENA); diff --git a/boards/nordic/nrf9280pdk/support/nrf9280_cpurad.JLinkScript b/boards/nordic/nrf9280pdk/support/nrf9280_cpurad.JLinkScript index 2f1802801c11c..02b84dcc970a3 100644 --- a/boards/nordic/nrf9280pdk/support/nrf9280_cpurad.JLinkScript +++ b/boards/nordic/nrf9280pdk/support/nrf9280_cpurad.JLinkScript @@ -1,36 +1,256 @@ +// Constants specific to the radio core +__constant U32 _CPUCONF_ADDR = 0x53011000; +__constant U32 _PROCESSOR_ID = 3; +__constant U32 _DOMAIN_ID = 3; +__constant U32 _NUM_OTHER_PROCESSORS = 2; +const U32 _OTHER_PROCESSOR_IDS[2] = {4, 2}; + // Debug Halting Control and Status Register -__constant U32 _DHCSR_ADDR = 0xE000EDF0; -__constant U32 _DHCSR_DBGKEY = (0xA05F << 16); -__constant U32 _DHCSR_C_DEBUGEN = (1 << 0); -__constant U32 _DHCSR_C_HALT = (1 << 1); +__constant U32 _DHCSR_ADDR = 0xE000EDF0; +__constant U32 _DHCSR_DBGKEY = (0xA05F << 16); +__constant U32 _DHCSR_C_DEBUGEN = (1 << 0); +__constant U32 _DHCSR_C_HALT = (1 << 1); // Debug Exception and Monitor Control Register -__constant U32 _DEMCR_ADDR = 0xE000EDFC; -__constant U32 _DEMCR_VC_CORERESET = (1 << 0); -__constant U32 _DEMCR_TRCENA = (1 << 24); +__constant U32 _DEMCR_ADDR = 0xE000EDFC; +__constant U32 _DEMCR_VC_CORERESET = (1 << 0); +__constant U32 _DEMCR_TRCENA = (1 << 24); // CPU wait enable register -__constant U32 _CPUCONF_CPUWAIT_ADDR = 0x5301150C; +__constant U32 _CPUCONF_CPUWAIT_OFFSET = 0x50C; + +// CTRL-AP +__constant U32 _CTRLAP_ID = 4; +__constant U32 _CTRLAP_READY_BANK = 0; +__constant U32 _CTRLAP_READY_OFFSET = 1; +__constant U32 _CTRLAP_READY = 0; +__constant U32 _CTRLAP_MAILBOX_BANK = 1; +__constant U32 _CTRLAP_MAILBOX_TXDATA_OFFSET = 0; +__constant U32 _CTRLAP_MAILBOX_TXSTATUS_OFFSET = 1; +__constant U32 _CTRLAP_MAILBOX_RXDATA_OFFSET = 2; +__constant U32 _CTRLAP_MAILBOX_RXSTATUS_OFFSET = 3; +__constant U32 _CTRLAP_MAILBOX_NO_DATA_PENDING = 0; +__constant U32 _CTRLAP_MAILBOX_DATA_PENDING = 1; +__constant int _CTRLAP_TIMEOUT_MS = 500; + +// ADAC transaction buffers +static U32 _adacTx[20]; +static U32 _adacRx[20]; + +// Failed to send to the CTRL-AP MAILBOX +__constant int _ERR_TX = -1; +// Failed to receive from the CTRL-AP MAILBOX +__constant int _ERR_RX = -2; +// ADAC command returned an error +__constant int _ERR_REPLY = -3; + +// Wait for an AP register read to return the expected value. +int _WaitForDataStatus(U32 regOffset, int expectedStatus) +{ + int status; + int ret; + int start; + int elapsed; + + status = 0; + start = JLINK_GetTime(); + elapsed = 0; + + do { + ret = JLINK_CORESIGHT_ReadDAP(regOffset, 1, &status); + elapsed = JLINK_GetTime() - start; + } while ((ret < 0 || status != expectedStatus) && (elapsed < _CTRLAP_TIMEOUT_MS)); + + if (ret < 0) { + return ret; + } + + return status; +} + +// Continuously read from the CTRL-AP MAILBOX until there is no more pending data. +void _DrainMailbox(void) +{ + int ret; + int status; + int data; + + ret = JLINK_CORESIGHT_ReadDAP(_CTRLAP_MAILBOX_RXSTATUS_OFFSET, 1, &status); + while (ret >= 0 && status == _CTRLAP_MAILBOX_DATA_PENDING) { + JLINK_CORESIGHT_ReadDAP(_CTRLAP_MAILBOX_RXDATA_OFFSET, 1, &data); + ret = JLINK_CORESIGHT_ReadDAP(_CTRLAP_MAILBOX_RXSTATUS_OFFSET, 1, &status); + } +} + +// Perform an ADAC transaction by: +// * writing the given sequence of words to MAILBOX.TXDATATA, waiting for MAILBOX.TXSTATUS +// readiness before each write. +// * reading a sequence of words from MAILBOX.RXDATA, waiting for MAILBOX.RXSTATUS readiness before +// each read. +// +// The message to send is read from _adacTx and the reply is written to _adacRx. +// Optionally checks if a single data word is returned and returns an error if it is non-zero. +// +// Assumes that the correct AP and AP bank for CTRL-AP MAILBOX has been selected in the DP. +int _DoAdacTransaction(int checkReplyStatus) +{ + int numWords; + int ret; + int data; + int i; + + i = 0; + numWords = 2 + (_adacTx[1] >> 2); // Length based on the length field of the message + + while (i < numWords) { + ret = _WaitForDataStatus(_CTRLAP_MAILBOX_TXSTATUS_OFFSET, + _CTRLAP_MAILBOX_NO_DATA_PENDING); + if (ret != _CTRLAP_MAILBOX_NO_DATA_PENDING) { + JLINK_SYS_Report1("Timed out waiting for CTRL-AP TX readiness - result: ", + ret); + return _ERR_TX; + } + + ret = JLINK_CORESIGHT_WriteDAP(_CTRLAP_MAILBOX_TXDATA_OFFSET, 1, _adacTx[i]); + if (ret < 0) { + JLINK_SYS_Report1("Failed to write CTRL-AP TX data - result: ", ret); + return _ERR_TX; + } + + i += 1; + } + + i = 0; + numWords = 2; // Minimum message length -int ConfigTargetSettings(void) { + while (i < numWords) { + ret = _WaitForDataStatus(_CTRLAP_MAILBOX_RXSTATUS_OFFSET, + _CTRLAP_MAILBOX_DATA_PENDING); + if (ret != _CTRLAP_MAILBOX_DATA_PENDING) { + JLINK_SYS_Report1("Timed out waiting for CTRL-AP RX data - result: ", ret); + return _ERR_RX; + } + + ret = JLINK_CORESIGHT_ReadDAP(_CTRLAP_MAILBOX_RXDATA_OFFSET, 1, &data); + if (ret < 0) { + JLINK_SYS_Report1("Failed to read CTRL-AP RX data - result: ", ret); + return _ERR_RX; + } + + if (i == 1) { + // Update total length based on the message length field + numWords = 2 + (data >> 2); + } + + _adacRx[i] = data; + i += 1; + } + + if (checkReplyStatus && _adacRx[1] == 4 && _adacRx[2] != 0) { + JLINK_SYS_Report1("ADAC command failed with status: ", _adacRx[2]); + return _ERR_REPLY; + } + + return 0; +} + +int ConfigTargetSettings(void) +{ JLINK_ExecCommand("CORESIGHT_AddAP = Index=1 Type=AHB-AP"); CORESIGHT_IndexAHBAPToUse = 1; return 0; } -int ResetTarget(void) { - // ADAC reset - JLINK_CORESIGHT_WriteDP(2, 0x04000010); - JLINK_CORESIGHT_WriteAP(0, 0xA3030000); - JLINK_CORESIGHT_WriteAP(0, 0x00000004); - JLINK_CORESIGHT_WriteAP(0, 0x01030000); +int ResetTarget(void) +{ + int err; + U32 adacMajorVersion; + U32 i; + + // Select CTRL-AP bank 0, used for the READY register + JLINK_CORESIGHT_WriteDAP(JLINK_CORESIGHT_DP_REG_SELECT, 0, + (_CTRLAP_ID << 24) | (_CTRLAP_READY_BANK << 4)); + + // Wait for the READY register to indicate that the AP can be used. + err = _WaitForDataStatus(_CTRLAP_READY_OFFSET, _CTRLAP_READY); + if (err < 0) { + JLINK_SYS_Report1("Timed out waiting for CTRL-AP readiness - result: ", err); + return -1; + } + + // Select CTRL-AP bank 1, used for the MAILBOX registers for ADAC communication + JLINK_CORESIGHT_WriteDAP(JLINK_CORESIGHT_DP_REG_SELECT, 0, + (_CTRLAP_ID << 24) | (_CTRLAP_MAILBOX_BANK << 4)); + + // Extract any pre-existing data from the mailbox in case there was previously + // an aborted transaction. + _DrainMailbox(); + + // Read the ADAC version + _adacTx[0] = 0xA3000000; // Command VERSION + _adacTx[1] = 0x00000004; // Data length 4 bytes + _adacTx[2] = 0x00000000; // Type 0 (ADAC version) + err = _DoAdacTransaction(0); + if (err < 0) { + return -1; + } + + adacMajorVersion = (_adacRx[2] >> 24) & 0xff; + JLINK_SYS_Report1("ADAC major version: ", adacMajorVersion); + + if (adacMajorVersion >= 2) { + // There is a very small chance that this command fails if the domain reset itself + // at the exact same time the command was issued. Therefore we retry a few times. + i = 0; + while (i < 3) { + // Reset non-essential domains + _adacTx[0] = 0xA30A0000; // Command RESET + _adacTx[1] = 0x00000004; // Data length 4 bytes + _adacTx[2] = 0x00000000; // (reserved) + err = _DoAdacTransaction(1); + if (err >= 0) { + break; + } else if (err != _ERR_REPLY) { + return -1; + } + + i = i + 1; + } + + // Start the core in halted mode + _adacTx[0] = 0xA3090000; // Command START + _adacTx[1] = 0x00000004; // Data length 4 bytes + _adacTx[2] = 0x01000000 | (_PROCESSOR_ID << 16); // Own processor, Flags HALT + err = _DoAdacTransaction(1); + if (err < 0) { + return -1; + } + + // Start other cores normally (will fail silently if no firmware is present) + i = 0; + while (i < _NUM_OTHER_PROCESSORS) { + _adacTx[0] = 0xA3090000; // Command START + _adacTx[1] = 0x00000004; // Data length 4 bytes + _adacTx[2] = 0x00000000 | + (_OTHER_PROCESSOR_IDS[i] << 16); // Other processor, No flags + err = _DoAdacTransaction(0); + if (err < 0 && err != _ERR_REPLY) { + return -1; + } - JLINK_SYS_Sleep(100); - JLINK_CORESIGHT_ReadAP(2); - JLINK_CORESIGHT_ReadAP(2); - JLINK_CORESIGHT_ReadAP(2); - JLINK_CORESIGHT_ReadAP(2); + i = i + 1; + } + } else { + // Reset single domain via legacy implementation + _adacTx[0] = 0xA3030000; // Command RESET + _adacTx[1] = 0x00000004; // Data length 4 bytes + _adacTx[2] = 0x01000000 | (_DOMAIN_ID << 16); // Own domain, Mode HALT + err = _DoAdacTransaction(1); + if (err < 0) { + return -1; + } + } // Halt the CPU JLINK_MEM_WriteU32(_DHCSR_ADDR, (_DHCSR_DBGKEY | _DHCSR_C_HALT | _DHCSR_C_DEBUGEN)); @@ -39,7 +259,7 @@ int ResetTarget(void) { JLINK_MEM_WriteU32(_DEMCR_ADDR, (_DEMCR_VC_CORERESET | _DEMCR_TRCENA)); // Disable CPU wait - JLINK_MEM_WriteU32(_CPUCONF_CPUWAIT_ADDR, 0); + JLINK_MEM_WriteU32(_CPUCONF_ADDR + _CPUCONF_CPUWAIT_OFFSET, 0); // Clear vector catch stuff JLINK_MEM_WriteU32(_DEMCR_ADDR, _DEMCR_TRCENA); From 4b83b2346fe1d3845a10cd47e449dd3418b82952 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 25 Sep 2024 14:18:47 +0300 Subject: [PATCH 0462/4482] hostap: Use proper value when generating supplicant event The previous NET_EVENT_SUPPLICANT_CMD_INT_EVENT is from "enum net_event_supplicant_cmd" but the supplicant_send_wifi_mgmt_event() has the event parameter as an "enum net_event_wifi_cmd" and those event number spaces are different. This meant that the wrong event value NET_EVENT_SUPPLICANT_CMD_INT_EVENT maps to NET_EVENT_WIFI_CMD_TWT (from "enum net_event_wifi_cmd") which fortunately did not cause issue in this case because the supplicant_send_wifi_mgmt_event() has no handling for this TWT event value. It is important we fix this as this can cause great confusion in the future. Signed-off-by: Jukka Rissanen --- include/zephyr/net/wifi_mgmt.h | 2 ++ modules/hostap/src/supp_events.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 8260940e04d66..3ba33aaed4499 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -288,6 +288,8 @@ enum net_event_wifi_cmd { NET_EVENT_WIFI_CMD_AP_STA_CONNECTED, /** STA disconnected from AP */ NET_EVENT_WIFI_CMD_AP_STA_DISCONNECTED, + /** Supplicant specific event */ + NET_EVENT_WIFI_CMD_SUPPLICANT, }; /** Event emitted for Wi-Fi scan result */ diff --git a/modules/hostap/src/supp_events.c b/modules/hostap/src/supp_events.c index 617779b4d4416..9ac472b6bdb44 100644 --- a/modules/hostap/src/supp_events.c +++ b/modules/hostap/src/supp_events.c @@ -386,7 +386,7 @@ int supplicant_send_wifi_mgmt_event(const char *ifname, enum net_event_wifi_cmd (struct wifi_ap_sta_info *)supplicant_status); break; #endif /* CONFIG_AP */ - case NET_EVENT_SUPPLICANT_CMD_INT_EVENT: + case NET_EVENT_WIFI_CMD_SUPPLICANT: event_data.data = &data; if (supplicant_process_status(&event_data, (char *)supplicant_status) > 0) { net_mgmt_event_notify_with_info(NET_EVENT_SUPPLICANT_INT_EVENT, From d59bb2f9f50c542fb10b0d8095903dea6109c3cc Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 25 Sep 2024 14:46:37 +0300 Subject: [PATCH 0463/4482] west.yml: update hostap revision Update hostap revision to get supplicant event numbers correctly. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 37ed9e8991d81..537a209ff0a16 100644 --- a/west.yml +++ b/west.yml @@ -259,7 +259,7 @@ manifest: - hal - name: hostap path: modules/lib/hostap - revision: 9896a2ea803ec62e0998c0e569f12af88537d647 + revision: f6792cb45d848df5d562dd9255dfc6acf62be164 - name: libmetal revision: a6851ba6dba8c9e87d00c42f171a822f7a29639b path: modules/hal/libmetal From 667c01b658aa2afddea908bdd3a31775328d6e93 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Wed, 2 Oct 2024 16:38:27 -0700 Subject: [PATCH 0464/4482] tests: input/api: limit to 1 CPU for thread mode test There is a check to see if it is no longer able to push more messages into a full queue. When these is another CPU consuming messages, the queue would not be full at that point. A new message can be pushed into the queue and thus failing the "full queue" check. So limit this to 1 CPU only so this check's assumption can be fulfilled. Fixes #79319 Signed-off-by: Daniel Leung --- tests/subsys/input/api/testcase.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/subsys/input/api/testcase.yaml b/tests/subsys/input/api/testcase.yaml index 2bb1c600d0bf5..51cb10218b449 100644 --- a/tests/subsys/input/api/testcase.yaml +++ b/tests/subsys/input/api/testcase.yaml @@ -9,6 +9,13 @@ tests: input.api.thread: extra_configs: - CONFIG_INPUT_MODE_THREAD=y + # There is a check to see if it is no longer able to push more + # messages into a full queue. When these is another CPU consuming + # messages, the queue would not be full at that point. A new message + # can be pushed into the queue and thus failing the "full queue" + # check. So limit this to 1 CPU only so this check's assumption + # can be fulfilled. + - CONFIG_MP_MAX_NUM_CPUS=1 input.api.synchronous: extra_configs: - CONFIG_INPUT_MODE_SYNCHRONOUS=y From dcea9169c7e21bac42f36452087555cfa562206f Mon Sep 17 00:00:00 2001 From: Ioannis Damigos Date: Fri, 4 Oct 2024 17:49:44 +0300 Subject: [PATCH 0465/4482] dts/smartbond: Move bt_hci_da1469x node outside of soc node Move bt_hci_da1469x node outside of soc node to fix warning: "Warning (simple_bus_reg): /soc/bt_hci_da1469x: missing or empty reg/ranges property" Signed-off-by: Ioannis Damigos --- dts/arm/renesas/smartbond/da1469x.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dts/arm/renesas/smartbond/da1469x.dtsi b/dts/arm/renesas/smartbond/da1469x.dtsi index b8234a8a85ce9..6c561ea5745b7 100644 --- a/dts/arm/renesas/smartbond/da1469x.dtsi +++ b/dts/arm/renesas/smartbond/da1469x.dtsi @@ -397,11 +397,11 @@ reg = <0x34000000 0x48>; status = "disabled"; }; + }; - bt_hci_da1469x: bt_hci_da1469x { - compatible = "renesas,bt-hci-da1469x"; - status = "disabled"; - }; + bt_hci_da1469x: bt_hci_da1469x { + compatible = "renesas,bt-hci-da1469x"; + status = "disabled"; }; }; From f90b1caae4f95c7901a0a6fd0c8be8bfe4d7f6aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Tue, 8 Oct 2024 16:01:00 +0200 Subject: [PATCH 0466/4482] doc: fix nested list rendering in soc porting guide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added missing blank line that caused nested bullet list to not render properly. Signed-off-by: Benjamin Cabé --- doc/hardware/porting/soc_porting.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/hardware/porting/soc_porting.rst b/doc/hardware/porting/soc_porting.rst index 7f2dfd2a3da5f..f4df7766f58c7 100644 --- a/doc/hardware/porting/soc_porting.rst +++ b/doc/hardware/porting/soc_porting.rst @@ -75,6 +75,7 @@ The mandatory files are: #. :file:`soc.yml`: a YAML file describing the high-level meta data of the SoC such as: + - SoC name: the name of the SoC - CPU clusters: CPU clusters if the SoC contains one or more clusters - SoC series: the SoC series to which the SoC belong From e9047431526e9a738a60f669a1a075b4656f8945 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Fri, 4 Oct 2024 16:46:24 -0500 Subject: [PATCH 0467/4482] ethernet: phy_mc_ksz8081: Don't reset in cfg link No need to reset in cfg link, this was blocking system workqueue during phy callbacks that call cfg link, since this happens from monitor work handler which is in the system workqueue. Signed-off-by: Declan Snyder --- drivers/ethernet/phy/phy_microchip_ksz8081.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/ethernet/phy/phy_microchip_ksz8081.c b/drivers/ethernet/phy/phy_microchip_ksz8081.c index 7ad4e0ec8e29e..98c9da37d86c1 100644 --- a/drivers/ethernet/phy/phy_microchip_ksz8081.c +++ b/drivers/ethernet/phy/phy_microchip_ksz8081.c @@ -329,12 +329,6 @@ static int phy_mc_ksz8081_cfg_link(const struct device *dev, /* We are going to reconfigure the phy, don't need to monitor until done */ k_work_cancel_delayable(&data->phy_monitor_work); - /* Reset PHY */ - ret = phy_mc_ksz8081_reset(dev); - if (ret) { - goto done; - } - /* DT configurations */ ret = phy_mc_ksz8081_static_cfg(dev); if (ret) { From c1e6488deda3495eb6b81c1c9c170d3d3164a88c Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Fri, 4 Oct 2024 13:07:40 -0500 Subject: [PATCH 0468/4482] MAINTAINERS: Remove decsny from ADC Remove myself from ADC collaborator Signed-off-by: Declan Snyder --- MAINTAINERS.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index a1be1a1a94e52..b6861269d9fe7 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -1015,8 +1015,6 @@ Release Notes: status: maintained maintainers: - anangl - collaborators: - - decsny files: - drivers/adc/ - include/zephyr/drivers/adc.h From 8173acad11d42633cef6363e8aed6278abc43e56 Mon Sep 17 00:00:00 2001 From: Abderrahmane Jarmouni Date: Fri, 4 Oct 2024 19:44:51 +0200 Subject: [PATCH 0469/4482] drivers: dma: stm32_bdma: fix regression Fix regression introduced by 1e1c14cfee99c2c28ec45fedd70d295bbb42fca4 undefined variable name is used. Signed-off-by: Abderrahmane Jarmouni --- drivers/dma/dma_stm32_bdma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/dma_stm32_bdma.c b/drivers/dma/dma_stm32_bdma.c index 70cc9a6770605..1e814e8481543 100644 --- a/drivers/dma/dma_stm32_bdma.c +++ b/drivers/dma/dma_stm32_bdma.c @@ -758,8 +758,8 @@ BDMA_STM32_EXPORT_API int bdma_stm32_stop(const struct device *dev, uint32_t id) return -EINVAL; } - if (stream->hal_override) { - stream->busy = false; + if (channel->hal_override) { + channel->busy = false; return 0; } From b32eb0d2b2c7c3cd5e4e2b9acdf6cac7f26712a0 Mon Sep 17 00:00:00 2001 From: Ingar Kulbrandstad Date: Fri, 4 Oct 2024 10:45:58 +0200 Subject: [PATCH 0470/4482] Bluetooth: Mesh: Fix out of bounds write Fix of the subnet bridging table function to only compact the table if elements has been removed, and fixing the compact function to compact the table if several elemnts has been removed at the same time. Fixes zephyrproject-rtos#78794 Signed-off-by: Ingar Kulbrandstad --- subsys/bluetooth/mesh/brg_cfg.c | 72 +++++++++++-------- tests/bluetooth/mesh/brg/src/main.c | 105 ++++++++++++++++++++++++++++ 2 files changed, 147 insertions(+), 30 deletions(-) diff --git a/subsys/bluetooth/mesh/brg_cfg.c b/subsys/bluetooth/mesh/brg_cfg.c index 112d2fe0a3e34..58d1aada550d4 100644 --- a/subsys/bluetooth/mesh/brg_cfg.c +++ b/subsys/bluetooth/mesh/brg_cfg.c @@ -33,18 +33,18 @@ enum { }; static ATOMIC_DEFINE(brg_cfg_flags, BRG_CFG_FLAGS_COUNT); -static void brg_tbl_compact(void) +/* Compact the bridge table for all removed entries, input is first removed entry */ +static void brg_tbl_compact(int j) { - int j = 0; - - for (int k = 0; k < bt_mesh_brg_cfg_row_cnt; k++) { + for (int k = j; k < bt_mesh_brg_cfg_row_cnt; k++) { if (brg_tbl[k].direction != 0) { brg_tbl[j] = brg_tbl[k]; j++; } } - memset(&brg_tbl[j], 0, sizeof(brg_tbl[j])); - bt_mesh_brg_cfg_row_cnt--; + + memset(&brg_tbl[j], 0, sizeof(brg_tbl[j]) * (bt_mesh_brg_cfg_row_cnt - j)); + bt_mesh_brg_cfg_row_cnt = j; } /* Set function for initializing bridging enable state from value stored in settings. */ @@ -167,21 +167,30 @@ void bt_mesh_brg_cfg_pending_store(void) */ static void brg_tbl_netkey_removed_evt(struct bt_mesh_subnet *sub, enum bt_mesh_key_evt evt) { + int first_removed = -1; + if (evt != BT_MESH_KEY_DELETED) { return; } - for (int i = 0; i < CONFIG_BT_MESH_BRG_TABLE_ITEMS_MAX; i++) { - if (brg_tbl[i].direction && - (brg_tbl[i].net_idx1 == sub->net_idx || brg_tbl[i].net_idx2 == sub->net_idx)) { - memset(&brg_tbl[i], 0, sizeof(brg_tbl[i])); - brg_tbl_compact(); + for (int i = 0; i < bt_mesh_brg_cfg_row_cnt; i++) { + if (brg_tbl[i].net_idx1 == sub->net_idx || brg_tbl[i].net_idx2 == sub->net_idx) { + /* Setting direction to 0, entry will be cleared in brg_tbl_compact. */ + brg_tbl[i].direction = 0; + if (first_removed == -1) { + first_removed = i; + } } } - if (IS_ENABLED(CONFIG_BT_SETTINGS)) { - atomic_set_bit(brg_cfg_flags, TABLE_UPDATED); - bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_BRG_PENDING); + if (first_removed != -1) { + /* Compact when all rows have been deleted. */ + brg_tbl_compact(first_removed); + + if (IS_ENABLED(CONFIG_BT_SETTINGS)) { + atomic_set_bit(brg_cfg_flags, TABLE_UPDATED); + bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_BRG_PENDING); + } } } @@ -263,7 +272,7 @@ int bt_mesh_brg_cfg_tbl_add(uint8_t direction, uint16_t net_idx1, uint16_t net_i } /* Empty element, is the current table row counter */ - if (bt_mesh_brg_cfg_row_cnt == CONFIG_BT_MESH_BRG_TABLE_ITEMS_MAX) { + if (bt_mesh_brg_cfg_row_cnt >= CONFIG_BT_MESH_BRG_TABLE_ITEMS_MAX) { *status = STATUS_INSUFF_RESOURCES; return 0; } @@ -306,7 +315,7 @@ void bt_mesh_brg_cfg_tbl_foreach_subnet(uint16_t src, uint16_t dst, uint16_t net int bt_mesh_brg_cfg_tbl_remove(uint16_t net_idx1, uint16_t net_idx2, uint16_t addr1, uint16_t addr2, uint8_t *status) { - bool store = false; + int first_removed = -1; /* Sanity checks */ if ((!BT_MESH_ADDR_IS_UNICAST(addr1) && addr1 != BT_MESH_ADDR_UNASSIGNED) || @@ -334,26 +343,29 @@ int bt_mesh_brg_cfg_tbl_remove(uint16_t net_idx1, uint16_t net_idx2, uint16_t ad for (int i = 0; i < bt_mesh_brg_cfg_row_cnt; i++) { /* Match according to remove behavior in Section 4.4.9.2.2 of MshPRT_v1.1 */ - if (brg_tbl[i].direction) { - if (!(brg_tbl[i].net_idx1 == net_idx1 && brg_tbl[i].net_idx2 == net_idx2)) { - continue; - } + if (!(brg_tbl[i].net_idx1 == net_idx1 && brg_tbl[i].net_idx2 == net_idx2)) { + continue; + } - if ((brg_tbl[i].addr1 == addr1 && brg_tbl[i].addr2 == addr2) || - (addr2 == BT_MESH_ADDR_UNASSIGNED && brg_tbl[i].addr1 == addr1) || - (addr1 == BT_MESH_ADDR_UNASSIGNED && brg_tbl[i].addr2 == addr2)) { - memset(&brg_tbl[i], 0, sizeof(brg_tbl[i])); - store = true; + if ((brg_tbl[i].addr1 == addr1 && brg_tbl[i].addr2 == addr2) || + (addr2 == BT_MESH_ADDR_UNASSIGNED && brg_tbl[i].addr1 == addr1) || + (addr1 == BT_MESH_ADDR_UNASSIGNED && brg_tbl[i].addr2 == addr2)) { + /* Setting direction to 0, entry will be cleared in brg_tbl_compact. */ + brg_tbl[i].direction = 0; + if (first_removed == -1) { + first_removed = i; } } } - /* Compact when all rows have been deleted. */ - brg_tbl_compact(); + if (first_removed != -1) { + /* Compact when all rows have been deleted. */ + brg_tbl_compact(first_removed); - if (IS_ENABLED(CONFIG_BT_SETTINGS) && store) { - atomic_set_bit(brg_cfg_flags, TABLE_UPDATED); - bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_BRG_PENDING); + if (IS_ENABLED(CONFIG_BT_SETTINGS)) { + atomic_set_bit(brg_cfg_flags, TABLE_UPDATED); + bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_BRG_PENDING); + } } *status = STATUS_SUCCESS; diff --git a/tests/bluetooth/mesh/brg/src/main.c b/tests/bluetooth/mesh/brg/src/main.c index 2b98722e4022f..e9ae46fff7fb7 100644 --- a/tests/bluetooth/mesh/brg/src/main.c +++ b/tests/bluetooth/mesh/brg/src/main.c @@ -218,6 +218,111 @@ ZTEST(bt_mesh_brg_cfg, test_basic_functionality_storage) } } +static void check_bt_mesh_brg_cfg_tbl_multiple_delete(int expect_left) +{ + uint8_t status; + int err; + int n; + const struct bt_mesh_brg_cfg_row *brg_tbl; + + n = bt_mesh_brg_cfg_tbl_get(&brg_tbl); + zassert_equal(n, TEST_VECT_SZ - 1); + + ztest_expect_value(bt_mesh_settings_store_schedule, flag, BT_MESH_SETTINGS_BRG_PENDING); + err = bt_mesh_brg_cfg_tbl_remove(test_vector[1].net_idx1, test_vector[1].net_idx2, + test_vector[1].addr1, BT_MESH_ADDR_UNASSIGNED, &status); + zassert_equal(err, 0); + + n = bt_mesh_brg_cfg_tbl_get(&brg_tbl); + zassert_equal(n, expect_left); + + for (int i = 0; i < n; i++) { + zassert_true(brg_tbl[i].net_idx1 == test_vector[0].net_idx1); + zassert_true(brg_tbl[i].net_idx2 == test_vector[0].net_idx2); + zassert_true(brg_tbl[i].addr1 == test_vector[0].addr1); + zassert_true(brg_tbl[i].addr2 == test_vector[i * 2].addr2); + } +} + +ZTEST(bt_mesh_brg_cfg, test_removal_multiple_entries) +{ + check_bt_mesh_brg_cfg_tbl_reset(); + + uint8_t status; + int err; + + /* Test removal of every second entry */ + for (int i = 0; i < TEST_VECT_SZ - 1; i++) { + ztest_expect_value(bt_mesh_settings_store_schedule, flag, + BT_MESH_SETTINGS_BRG_PENDING); + err = bt_mesh_brg_cfg_tbl_add(test_vector[i].direction, test_vector[i % 2].net_idx1, + test_vector[i % 2].net_idx2, test_vector[i % 2].addr1, + test_vector[i].addr2, &status); + zassert_equal(err, 0); + zassert_equal(status, STATUS_SUCCESS); + } + + check_bt_mesh_brg_cfg_tbl_multiple_delete((TEST_VECT_SZ - 1) / 2); + check_bt_mesh_brg_cfg_tbl_reset(); + + /* Test removal of all entries, except first */ + for (int i = 0; i < TEST_VECT_SZ - 1; i++) { + ztest_expect_value(bt_mesh_settings_store_schedule, flag, + BT_MESH_SETTINGS_BRG_PENDING); + if (i == 0) { + err = bt_mesh_brg_cfg_tbl_add(test_vector[i].direction, + test_vector[i].net_idx1, + test_vector[i].net_idx2, test_vector[i].addr1, + test_vector[i].addr2, &status); + } else { + err = bt_mesh_brg_cfg_tbl_add(test_vector[i].direction, + test_vector[1].net_idx1, + test_vector[1].net_idx2, test_vector[1].addr1, + test_vector[i].addr2, &status); + } + zassert_equal(err, 0); + zassert_equal(status, STATUS_SUCCESS); + } + + check_bt_mesh_brg_cfg_tbl_multiple_delete(1); + check_bt_mesh_brg_cfg_tbl_reset(); + + /* Test removal of all entries, except last */ + for (int i = TEST_VECT_SZ - 2; i >= 0; i--) { + ztest_expect_value(bt_mesh_settings_store_schedule, flag, + BT_MESH_SETTINGS_BRG_PENDING); + if (i == 0) { + err = bt_mesh_brg_cfg_tbl_add(test_vector[i].direction, + test_vector[i].net_idx1, + test_vector[i].net_idx2, test_vector[i].addr1, + test_vector[i].addr2, &status); + } else { + err = bt_mesh_brg_cfg_tbl_add(test_vector[i].direction, + test_vector[1].net_idx1, + test_vector[1].net_idx2, test_vector[1].addr1, + test_vector[i].addr2, &status); + } + zassert_equal(err, 0); + zassert_equal(status, STATUS_SUCCESS); + } + + check_bt_mesh_brg_cfg_tbl_multiple_delete(1); + check_bt_mesh_brg_cfg_tbl_reset(); + + /* Test removal of all entries */ + for (int i = 0; i < TEST_VECT_SZ - 1; i++) { + ztest_expect_value(bt_mesh_settings_store_schedule, flag, + BT_MESH_SETTINGS_BRG_PENDING); + err = bt_mesh_brg_cfg_tbl_add(test_vector[i].direction, test_vector[1].net_idx1, + test_vector[1].net_idx2, test_vector[1].addr1, + test_vector[i].addr2, &status); + zassert_equal(err, 0); + zassert_equal(status, STATUS_SUCCESS); + } + + check_bt_mesh_brg_cfg_tbl_multiple_delete(0); +} + static void pending_store_enable_create_expectations(bool *enable_val) { if (*enable_val) { From 4f4cc4de08bc2c049614b0cf7319f52759dbfa53 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Thu, 3 Oct 2024 09:40:29 -0700 Subject: [PATCH 0471/4482] xtensa: fix typo userpsace to userspace s/userpsace/userspace/ Signed-off-by: Daniel Leung --- arch/xtensa/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/xtensa/CMakeLists.txt b/arch/xtensa/CMakeLists.txt index 48ac9d7531b12..7588557340503 100644 --- a/arch/xtensa/CMakeLists.txt +++ b/arch/xtensa/CMakeLists.txt @@ -7,5 +7,5 @@ add_subdirectory(core) if (CONFIG_XTENSA_INSECURE_USERSPACE) message(WARNING " This userspace implementation uses the window ABI this means that the kernel - will spill registers on behalf of the userpsace. Use it carefully.") + will spill registers on behalf of the userspace. Use it carefully.") endif() From 59e41ef830d49816d4a3900215a0fb55da1228d0 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Wed, 18 Sep 2024 13:35:11 +0800 Subject: [PATCH 0472/4482] tests: latency_measure: reduce the chance of cycles underflow Sometimes there's an unusually large cycles for tests that are known to complete with just a few cycles. Upon some testing, I found that it was because the overhead cycles was larger than the cycles taken by tests, causing the cycles to underflow. To workaround that, make sure that the overhead measurement thread runs uninterrupted, repeat the measurement for a few times, and take the minimum value. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- .../benchmarks/latency_measure/src/timing_sc.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/benchmarks/latency_measure/src/timing_sc.c b/tests/benchmarks/latency_measure/src/timing_sc.c index 6b160e97bd31c..60d6e9a720431 100644 --- a/tests/benchmarks/latency_measure/src/timing_sc.c +++ b/tests/benchmarks/latency_measure/src/timing_sc.c @@ -19,6 +19,8 @@ BENCH_BMEM uint64_t timestamp_overhead; BENCH_BMEM uint64_t user_timestamp_overhead; #endif +#define OVERHEAD_CALC_ITER 10 + timing_t z_impl_timing_timestamp_get(void) { return timing_counter_get(); @@ -37,17 +39,23 @@ static void start_thread_entry(void *p1, void *p2, void *p3) uint32_t num_iterations = (uint32_t)(uintptr_t)p1; timing_t start; timing_t finish; + uint64_t min_cycles = UINT64_MAX; ARG_UNUSED(p2); ARG_UNUSED(p3); - start = timing_timestamp_get(); - for (uint32_t i = 0; i < num_iterations; i++) { - timing_timestamp_get(); + /* Repeat the overhead measurements for a few times to obtain the minimum overhead */ + for (int n = 0; n < OVERHEAD_CALC_ITER; n++) { + start = timing_timestamp_get(); + for (uint32_t i = 0; i < num_iterations; i++) { + timing_timestamp_get(); + } + finish = timing_timestamp_get(); + + min_cycles = MIN(min_cycles, timing_cycles_get(&start, &finish)); } - finish = timing_timestamp_get(); - timestamp.cycles = timing_cycles_get(&start, &finish); + timestamp.cycles = min_cycles; } void timestamp_overhead_init(uint32_t num_iterations) From c60d06057cb947a12a2ec44da4c89a1dda69e480 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Tue, 17 Sep 2024 15:10:18 -0700 Subject: [PATCH 0473/4482] mbedtls: Add purl/cpe information Get revision with purl/cpe support. Signed-off-by: Flavio Ceolin --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 537a209ff0a16..b019f5d53c3be 100644 --- a/west.yml +++ b/west.yml @@ -280,7 +280,7 @@ manifest: revision: 2b498e6f36d6b82ae1da12c8b7742e318624ecf5 path: modules/lib/gui/lvgl - name: mbedtls - revision: fb36f3fe20f9f62e67b1a20c0cfe0a6788ec2bf6 + revision: eb55f4734585dfd8cd3da6d4b01a6e372f073ee1 path: modules/crypto/mbedtls groups: - crypto From ec3dea2b457d54b6034de72c7d4606bb16293927 Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Tue, 10 Sep 2024 16:42:50 +0200 Subject: [PATCH 0474/4482] jwt: reshape and add alternative for ECDSA using PSA This commit: - creates 2 new files, jwt_ecdsa.c and jwt_rsa.c, to hold the implementations of the corresponding ECDSA/RSA signature algorithms; - RSA signature is stil done through Mbed TLS's PK module which can optionally make use of PSA (if enabled); - ECDSA signature will instead use PSA, if possible, or TinyCrypt as fallback. Signed-off-by: Valerio Setti --- subsys/jwt/CMakeLists.txt | 5 ++ subsys/jwt/Kconfig | 61 ++++++++++++++-- subsys/jwt/jwt.c | 130 ++++------------------------------ subsys/jwt/jwt.h | 15 ++++ subsys/jwt/jwt_legacy_ecdsa.c | 82 +++++++++++++++++++++ subsys/jwt/jwt_legacy_rsa.c | 56 +++++++++++++++ subsys/jwt/jwt_psa.c | 51 +++++++++++++ 7 files changed, 276 insertions(+), 124 deletions(-) create mode 100644 subsys/jwt/jwt.h create mode 100644 subsys/jwt/jwt_legacy_ecdsa.c create mode 100644 subsys/jwt/jwt_legacy_rsa.c create mode 100644 subsys/jwt/jwt_psa.c diff --git a/subsys/jwt/CMakeLists.txt b/subsys/jwt/CMakeLists.txt index ef59560a5e5e8..82c65f11f414c 100644 --- a/subsys/jwt/CMakeLists.txt +++ b/subsys/jwt/CMakeLists.txt @@ -2,4 +2,9 @@ zephyr_library() zephyr_library_sources(jwt.c) + +zephyr_library_sources_ifdef(CONFIG_JWT_SIGN_ECDSA_LEGACY jwt_legacy_ecdsa.c) +zephyr_library_sources_ifdef(CONFIG_JWT_SIGN_RSA_LEGACY jwt_legacy_rsa.c) +zephyr_library_sources_ifdef(CONFIG_JWT_USE_PSA jwt_psa.c) + zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS) diff --git a/subsys/jwt/Kconfig b/subsys/jwt/Kconfig index af4ea8a9a3884..651fe46cbf57f 100644 --- a/subsys/jwt/Kconfig +++ b/subsys/jwt/Kconfig @@ -1,4 +1,5 @@ # Copyright (c) 2018 Linaro +# Copyright (c) 2024 BayLibre SAS # SPDX-License-Identifier: Apache-2.0 menuconfig JWT @@ -7,27 +8,73 @@ menuconfig JWT help Enable creation of JWT tokens +if JWT + choice prompt "JWT signature algorithm" default JWT_SIGN_RSA - depends on JWT help Select which algorithm to use for signing JWT tokens. config JWT_SIGN_RSA bool "Use RSA signature (RS-256)" - depends on CSPRNG_ENABLED - select MBEDTLS - select MBEDTLS_KEY_EXCHANGE_RSA_ENABLED - select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY if PSA_CRYPTO_CLIENT - select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT if PSA_CRYPTO_CLIENT config JWT_SIGN_ECDSA bool "Use ECDSA signature (ES-256)" + +endchoice + +choice + default JWT_USE_PSA + prompt "Select crypto library to be used" + +config JWT_USE_PSA + bool "PSA crypto API library" + select MBEDTLS if !BUILD_WITH_TFM + select MBEDTLS_PSA_CRYPTO_C if !BUILD_WITH_TFM + +config JWT_USE_LEGACY + bool "Legacy library: TinyCrypt for ECDSA, Mbed TLS for RSA" + +endchoice + +# Prompless Kconfigs to effectively select which algorithm and library will be used +# to sign the JWT. User's selections on the above choices will determine which +# element will be picked here. +config JWT_SIGN_ECDSA_PSA + bool + default y + depends on JWT_SIGN_ECDSA && JWT_USE_PSA + select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT + select PSA_WANT_ALG_ECDSA + select PSA_WANT_ECC_SECP_R1_256 + select PSA_WANT_ALG_SHA_256 + +config JWT_SIGN_ECDSA_LEGACY + bool + default y + depends on JWT_SIGN_ECDSA && JWT_USE_LEGACY select TINYCRYPT select TINYCRYPT_SHA256 select TINYCRYPT_ECC_DSA select TINYCRYPT_CTR_PRNG select TINYCRYPT_AES -endchoice +config JWT_SIGN_RSA_PSA + bool + default y + depends on JWT_SIGN_RSA && JWT_USE_PSA + select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY + select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT + select PSA_WANT_ALG_RSA_PKCS1V15_SIGN + select PSA_WANT_ALG_SHA_256 + +config JWT_SIGN_RSA_LEGACY + bool + default y + depends on JWT_SIGN_RSA && JWT_USE_LEGACY + depends on CSPRNG_ENABLED + select MBEDTLS + select MBEDTLS_KEY_EXCHANGE_RSA_ENABLED + +endif # JWT diff --git a/subsys/jwt/jwt.c b/subsys/jwt/jwt.c index ede21858320ab..4487e557096af 100644 --- a/subsys/jwt/jwt.c +++ b/subsys/jwt/jwt.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2018 Linaro Ltd + * Copyright (C) 2024 BayLibre SAS * * SPDX-License-Identifier: Apache-2.0 */ @@ -11,20 +12,12 @@ #include #include -#ifdef CONFIG_JWT_SIGN_RSA -#include -#include -#include -#include -#endif +#include "jwt.h" -#ifdef CONFIG_JWT_SIGN_ECDSA -#include -#include -#include -#include - -#include +#if defined(CONFIG_JWT_SIGN_RSA) +#define JWT_SIGNATURE_LEN 256 +#else /* CONFIG_JWT_SIGN_ECDSA */ +#define JWT_SIGNATURE_LEN 64 #endif /* @@ -153,8 +146,7 @@ static int jwt_add_header(struct jwt_builder *builder) #ifdef CONFIG_JWT_SIGN_RSA /* {"alg":"RS256","typ":"JWT"} */ "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9"; -#endif -#ifdef CONFIG_JWT_SIGN_ECDSA +#else /* CONFIG_JWT_SIGN_ECDSA */ /* {"alg":"ES256","typ":"JWT"} */ "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9"; #endif @@ -190,120 +182,24 @@ int jwt_add_payload(struct jwt_builder *builder, return res; } -#ifdef CONFIG_JWT_SIGN_RSA - -static int csprng_wrapper(void *ctx, unsigned char *dest, size_t size) -{ - ARG_UNUSED(ctx); - - return sys_csrand_get((void *)dest, size); -} - -int jwt_sign(struct jwt_builder *builder, - const char *der_key, - size_t der_key_len) -{ - int res; - mbedtls_pk_context ctx; - - mbedtls_pk_init(&ctx); - - res = mbedtls_pk_parse_key(&ctx, der_key, der_key_len, - NULL, 0, csprng_wrapper, NULL); - if (res != 0) { - return res; - } - - uint8_t hash[32], sig[256]; - size_t sig_len = sizeof(sig); - - /* - * The '0' indicates to mbedtls to do a SHA256, instead of - * 224. - */ - mbedtls_sha256(builder->base, builder->buf - builder->base, - hash, 0); - - res = mbedtls_pk_sign(&ctx, MBEDTLS_MD_SHA256, - hash, sizeof(hash), - sig, sig_len, &sig_len, - csprng_wrapper, NULL); - if (res != 0) { - return res; - } - - base64_outch(builder, '.'); - base64_append_bytes(sig, sig_len, builder); - base64_flush(builder); - - return builder->overflowed ? -ENOMEM : 0; -} -#endif - -#ifdef CONFIG_JWT_SIGN_ECDSA -static TCCtrPrng_t prng_state; -static bool prng_init; - -static const char personalize[] = "zephyr:drivers/jwt/jwt.c"; - -static int setup_prng(void) -{ - if (prng_init) { - return 0; - } - prng_init = true; - - uint8_t entropy[TC_AES_KEY_SIZE + TC_AES_BLOCK_SIZE]; - - sys_rand_get(entropy, sizeof(entropy)); - - int res = tc_ctr_prng_init(&prng_state, - (const uint8_t *) &entropy, sizeof(entropy), - personalize, - sizeof(personalize)); - - return res == TC_CRYPTO_SUCCESS ? 0 : -EINVAL; -} - -int default_CSPRNG(uint8_t *dest, unsigned int size) -{ - int res = tc_ctr_prng_generate(&prng_state, NULL, 0, dest, size); - return res; -} - int jwt_sign(struct jwt_builder *builder, const char *der_key, size_t der_key_len) { - struct tc_sha256_state_struct ctx; - uint8_t hash[32], sig[64]; - int res; - - tc_sha256_init(&ctx); - tc_sha256_update(&ctx, builder->base, builder->buf - builder->base); - tc_sha256_final(hash, &ctx); + int ret; + unsigned char sig[JWT_SIGNATURE_LEN]; - res = setup_prng(); - - if (res != 0) { - return res; - } - uECC_set_rng(&default_CSPRNG); - - /* Note that tinycrypt only supports P-256. */ - res = uECC_sign(der_key, hash, sizeof(hash), - sig, &curve_secp256r1); - if (res != TC_CRYPTO_SUCCESS) { - return -EINVAL; + ret = jwt_sign_impl(builder, der_key, der_key_len, sig, sizeof(sig)); + if (ret < 0) { + return ret; } base64_outch(builder, '.'); base64_append_bytes(sig, sizeof(sig), builder); base64_flush(builder); - return 0; + return builder->overflowed ? -ENOMEM : 0; } -#endif int jwt_init_builder(struct jwt_builder *builder, char *buffer, diff --git a/subsys/jwt/jwt.h b/subsys/jwt/jwt.h new file mode 100644 index 0000000000000..3394461c9fa06 --- /dev/null +++ b/subsys/jwt/jwt.h @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2024 BayLibre SAS + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_SUBSYS_JWT_JWT_H_ +#define ZEPHYR_SUBSYS_JWT_JWT_H_ + +#include + +int jwt_sign_impl(struct jwt_builder *builder, const unsigned char *der_key, + size_t der_key_len, unsigned char *sig, size_t sig_size); + +#endif /* ZEPHYR_SUBSYS_JWT_JWT_H_ */ diff --git a/subsys/jwt/jwt_legacy_ecdsa.c b/subsys/jwt/jwt_legacy_ecdsa.c new file mode 100644 index 0000000000000..d8368280270d0 --- /dev/null +++ b/subsys/jwt/jwt_legacy_ecdsa.c @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2024 BayLibre SAS + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include "jwt.h" + +static TCCtrPrng_t prng_state; +static bool prng_init; + +static const char personalize[] = "zephyr:drivers/jwt/jwt.c"; + +static int setup_prng(void) +{ + if (prng_init) { + return 0; + } + prng_init = true; + + uint8_t entropy[TC_AES_KEY_SIZE + TC_AES_BLOCK_SIZE]; + + sys_rand_get(entropy, sizeof(entropy)); + + int res = tc_ctr_prng_init(&prng_state, (const uint8_t *)&entropy, sizeof(entropy), + personalize, sizeof(personalize)); + + return res == TC_CRYPTO_SUCCESS ? 0 : -EINVAL; +} + +/* This function is declared in + * modules/crypto/tinycrypt/lib/include/tinycrypt/ecc_platform_specific.h. + * + * TinyCrypt expects this function to be implemented somewhere when using the + * ECC module. + */ +int default_CSPRNG(uint8_t *dest, unsigned int size) +{ + int res = tc_ctr_prng_generate(&prng_state, NULL, 0, dest, size); + return res; +} + +int jwt_sign_impl(struct jwt_builder *builder, const unsigned char *der_key, size_t der_key_len, + unsigned char *sig, size_t sig_size) +{ + struct tc_sha256_state_struct ctx; + uint8_t hash[32]; + int res; + + ARG_UNUSED(sig_size); + + tc_sha256_init(&ctx); + tc_sha256_update(&ctx, builder->base, builder->buf - builder->base); + tc_sha256_final(hash, &ctx); + + res = setup_prng(); + + if (res != 0) { + return res; + } + + /* Note that tinycrypt only supports P-256. */ + res = uECC_sign(der_key, hash, sizeof(hash), sig, &curve_secp256r1); + if (res != TC_CRYPTO_SUCCESS) { + return -EINVAL; + } + + return 0; +} diff --git a/subsys/jwt/jwt_legacy_rsa.c b/subsys/jwt/jwt_legacy_rsa.c new file mode 100644 index 0000000000000..2eb0adc0ede9f --- /dev/null +++ b/subsys/jwt/jwt_legacy_rsa.c @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2024 BayLibre SAS + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include "jwt.h" + +static int csprng_wrapper(void *ctx, unsigned char *dest, size_t size) +{ + ARG_UNUSED(ctx); + + return sys_csrand_get((void *)dest, size); +} + +int jwt_sign_impl(struct jwt_builder *builder, const unsigned char *der_key, size_t der_key_len, + unsigned char *sig, size_t sig_size) +{ + int res; + mbedtls_pk_context ctx; + size_t sig_len_out; + + mbedtls_pk_init(&ctx); + + res = mbedtls_pk_parse_key(&ctx, der_key, der_key_len, NULL, 0, csprng_wrapper, NULL); + if (res != 0) { + return res; + } + + uint8_t hash[32]; + + /* + * The '0' indicates to mbedtls to do a SHA256, instead of + * 224. + */ + res = mbedtls_sha256(builder->base, builder->buf - builder->base, hash, 0); + if (res != 0) { + return res; + } + + res = mbedtls_pk_sign(&ctx, MBEDTLS_MD_SHA256, hash, sizeof(hash), sig, sig_size, + &sig_len_out, csprng_wrapper, NULL); + return res; +} diff --git a/subsys/jwt/jwt_psa.c b/subsys/jwt/jwt_psa.c new file mode 100644 index 0000000000000..edbafa6fefee5 --- /dev/null +++ b/subsys/jwt/jwt_psa.c @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2024 BayLibre SAS + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#include +#include +#include + +#include "jwt.h" + +int jwt_sign_impl(struct jwt_builder *builder, const unsigned char *der_key, size_t der_key_len, + unsigned char *sig, size_t sig_size) +{ + psa_status_t status; + psa_key_attributes_t attr = PSA_KEY_ATTRIBUTES_INIT; + psa_key_id_t key_id; + size_t sig_len_out; + psa_algorithm_t alg; + int ret; + +#if defined(CONFIG_JWT_SIGN_ECDSA) + psa_set_key_type(&attr, PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1)); + psa_set_key_algorithm(&attr, PSA_ALG_ECDSA(PSA_ALG_SHA_256)); + alg = PSA_ALG_ECDSA(PSA_ALG_SHA_256); +#else /* CONFIG_JWT_SIGN_RSA */ + psa_set_key_type(&attr, PSA_KEY_TYPE_RSA_KEY_PAIR); + psa_set_key_algorithm(&attr, PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256)); + alg = PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256); +#endif /* CONFIG_JWT_SIGN_ECDSA || CONFIG_JWT_SIGN_RSA */ + psa_set_key_usage_flags(&attr, PSA_KEY_USAGE_SIGN_MESSAGE); + + status = psa_import_key(&attr, der_key, der_key_len, &key_id); + if (status != PSA_SUCCESS) { + return -EINVAL; + } + + status = psa_sign_message(key_id, alg, + builder->base, builder->buf - builder->base, + sig, sig_size, &sig_len_out); + ret = (status == PSA_SUCCESS) ? 0 : -EINVAL; + + psa_destroy_key(key_id); + + return ret; +} From 6e8e0ec08e0b49593ef699fe713682eab18df30d Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Tue, 10 Sep 2024 16:45:37 +0200 Subject: [PATCH 0475/4482] test: subsys: jwt: fix testing of the features - Some files (PEM/DER files, jwt-test-cert.c, user-tls-conf.h) were removed because they are not used or no longer necessary. Private keys used in the test are now in the jwt-test-private.c file as arrays. - testcase.yaml has been improved in order to test all possible use cases: ECDSA with TC, ECDSA with PSA, RSA; - unnecessary Kconfigs were removed from prj.conf. Signed-off-by: Valerio Setti --- tests/subsys/jwt/jwt-test-cert.pem | 18 -- tests/subsys/jwt/jwt-test-private.der | Bin 1216 -> 0 bytes tests/subsys/jwt/jwt-test-private.pem | 28 --- tests/subsys/jwt/prj.conf | 11 - tests/subsys/jwt/src/jwt-test-cert.c | 148 ------------ tests/subsys/jwt/src/jwt-test-private.c | 227 ++++++++++-------- tests/subsys/jwt/src/main.c | 4 - .../subsys/jwt/src/tls_config/user-tls-conf.h | 6 - tests/subsys/jwt/testcase.yaml | 37 ++- 9 files changed, 153 insertions(+), 326 deletions(-) delete mode 100644 tests/subsys/jwt/jwt-test-cert.pem delete mode 100644 tests/subsys/jwt/jwt-test-private.der delete mode 100644 tests/subsys/jwt/jwt-test-private.pem delete mode 100644 tests/subsys/jwt/src/jwt-test-cert.c delete mode 100644 tests/subsys/jwt/src/tls_config/user-tls-conf.h diff --git a/tests/subsys/jwt/jwt-test-cert.pem b/tests/subsys/jwt/jwt-test-cert.pem deleted file mode 100644 index 39859e23eb53f..0000000000000 --- a/tests/subsys/jwt/jwt-test-cert.pem +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIC+zCCAeOgAwIBAgIJAIo6NLZ3yCHqMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV -BAMMCGp3dC10ZXN0MCAXDTE4MDcwMjE3MjExMVoYDzQ3NTYwNTI5MTcyMTExWjAT -MREwDwYDVQQDDAhqd3QtdGVzdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC -ggEBAKZSmN8OM9BpYjLEQHzsv5+jNYpRze1Jmb74KT/R16j7xjaCRWTbbXPvU8oC -frCRBr3VZkvqh3ptlaVrZLnWw92yXAOLAFxGFouGyCgNtLE+tg2CIpdbdQIAl8dX -S6CB+y3Iu4E3xI7mfJr5LQzUuCLlO6D+qD5emTZXdiV+/IkXPDnwPC6zPxT1I5aS -Qnsd0AuxRHGJO0Tl6uosZ7vZ45yKGoMe6RPjPAawo5idK6WEZdsjd1nKZHadVAVX -pxDLYux/OfzXUz1GLewR0UIQanM5GBCgz5uIbx6IaIs8MFk/ZrUJZfw3959O1xrG -FmRnZEHAkFHZ2vUlXMBinw3sLNMCAwEAAaNQME4wHQYDVR0OBBYEFINKpDYiVZyi -JlzHhq5Xo0Ax4eTKMB8GA1UdIwQYMBaAFINKpDYiVZyiJlzHhq5Xo0Ax4eTKMAwG -A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBADzE5U+/LiDbI/PS+5o3J5z+ -0eYdIOYU4Qe/ltdnt0voRKY1a0WHkYYXoFiONSRuAK/6O3bJByfQCd/NSAObTkPY -R0WPCg2vriztxPxs2fdU2VBh4qB7WM/yNOPpMamCDPZzg5oubVIwecYwZ0V888xV -GfWHwRcKtN7QogNIpGhMJj65MYPuB1cXAdUq7/zpRAewCp472dcUKLzLTHq7z8VU -ko0u1uTemh+xHtJLpVxqq7a6cpgka3DS7qwjz5XUL6UWKyL3uJcUL36ghL0ZwyQv -HngefbPQFMDyyoPh6QPGUMLwgN5pMI5mvdtA0I7z0G67TLpB+hpf+Kgyzx5JjQ0= ------END CERTIFICATE----- diff --git a/tests/subsys/jwt/jwt-test-private.der b/tests/subsys/jwt/jwt-test-private.der deleted file mode 100644 index 85614d02363234ff839a6ae9d155d97a589b92c6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1216 zcmV;x1V8&Qf&{z*0RS)!1_>&LNQUrrZ9p8q5=T`0)hbn0H#uy-wrd- zX<{>fy8)+F4kpmEwYUr8Wd!#6 z+qe-Kg8rJZPfoN4@XQs@L$R|VjXtnWP>JKXn^wKk-gF(}0tw*Lc} z)w|}Ye%4Dtgf_(a#5nt}{2?~U5S~#V#>Z0bcb8;hY{dkCP_|kjPEoRvLeb};jD|^j%VG0{f1B8}m%$WGgIGER%NxFs52ydO&EE_h~LVC$&6;jH&)#rdk4w z0XBp}U8n_1-QagqY>l-e1I6Z!&j#7$U4|s`WOvpm)@#t$g$wJP%ly z!_JCWjjmJa-T7HNACh+}zxgJ%>y9l6PCx~=pnx(QGa%UL&!V3;ey$Rb^X;{*@2FB4TpG?ic$S2_u4JP!x>4-dlFBPPEZ>iIi`mf*hELH9@pm+;0 z#K-R1D?q+f_h$ex&`!61rv9FwX)juqO*v~{^rQ(Wn3fr4mC%i~S=OGz;3BmL+5nRN zTIm~Ex*X}fa$t(Pm+lxi*sS!F>s}f5(E@>hT+Qclw4#}T*|A{#8d(OE*AE$ahTkP? zkEquol9-3K>mvhWd9c3mkx(IcgQ_!BMlpi2Eya$?2xuKGLr9?78Lx5F$g)LAg#0d!?s(>U8c>Lx8=Z8!%~f@$ z0)c>N*~qAnkp4xCU%5>kh5{k!BM0`Xt8BJ;^7d1u?ubuFZuDeOVBw5AeV{8>avHZ( z*P9I#q!9u77QK5ru&ri-f$vT2C^+jGSn|P85}aZ-3P(#tNG~Gvv@)v?WH~alT63Az eQz&zhDHX9v1Z1 #include -#include -#include -#include - extern unsigned char jwt_test_private_der[]; extern unsigned int jwt_test_private_der_len; diff --git a/tests/subsys/jwt/src/tls_config/user-tls-conf.h b/tests/subsys/jwt/src/tls_config/user-tls-conf.h deleted file mode 100644 index 0d95ee80ac09d..0000000000000 --- a/tests/subsys/jwt/src/tls_config/user-tls-conf.h +++ /dev/null @@ -1,6 +0,0 @@ -#define MBEDTLS_AES_ROM_TABLES - -#define MBEDTLS_HAVE_TIME -#define MBEDTLS_HAVE_TIME_DATE -#define MBEDTLS_PLATFORM_TIME_ALT -#define MBEDTLS_PLATFORM_MS_TIME_ALT diff --git a/tests/subsys/jwt/testcase.yaml b/tests/subsys/jwt/testcase.yaml index f31beee498ae1..6606780a9f1b2 100644 --- a/tests/subsys/jwt/testcase.yaml +++ b/tests/subsys/jwt/testcase.yaml @@ -1,11 +1,32 @@ common: filter: CONFIG_FULL_LIBC_SUPPORTED + min_ram: 96 + min_flash: 72 + timeout: 120 + tags: jwt + integration_platforms: + - frdm_k64f + extra_configs: + - CONFIG_TEST_RANDOM_GENERATOR=y tests: - libraries.encoding.jwt: - min_ram: 96 - min_flash: 72 - timeout: 120 - tags: jwt - filter: CONFIG_ENTROPY_HAS_DRIVER - integration_platforms: - - frdm_k64f + libraries.encoding.jwt.ecdsa.legacy: + extra_configs: + - CONFIG_JWT_SIGN_ECDSA=y + - CONFIG_JWT_USE_LEGACY=y + libraries.encoding.jwt.ecdsa.psa: + extra_configs: + - CONFIG_JWT_SIGN_ECDSA=y + - CONFIG_JWT_USE_PSA=y + - CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG=y + - CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG_ALLOW_NON_CSPRNG=y + libraries.encoding.jwt.rsa.legacy: + filter: CSPRNG_ENABLED + extra_configs: + - CONFIG_JWT_SIGN_RSA=y + - CONFIG_JWT_USE_LEGACY=y + libraries.encoding.jwt.rsa.psa: + extra_configs: + - CONFIG_JWT_SIGN_RSA=y + - CONFIG_JWT_USE_PSA=y + - CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG=y + - CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG_ALLOW_NON_CSPRNG=y From 64ecbea505408249a66ee8d695f46a65913d8d00 Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Fri, 13 Sep 2024 14:04:50 +0200 Subject: [PATCH 0476/4482] doc: update JWT documentation Update JWT subsystem documentation concerning the changes related to: - default library used - new Kconfigs added Signed-off-by: Valerio Setti --- doc/releases/migration-guide-4.0.rst | 9 +++++++++ doc/releases/release-notes-4.0.rst | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 0629467b26d22..73023ad3f782c 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -479,5 +479,14 @@ Shell * ``kernel threads`` and ``kernel stacks`` shell command have been renamed to ``kernel thread list`` & ``kernel thread stacks`` +JWT (JSON Web Token) +==================== + +* By default, the signature is now computed through PSA Crypto API for both RSA and ECDSA. + The newly-added :kconfig:option:`CONFIG_JWT_USE_LEGACY` can be used to switch + back to previous libraries (TinyCrypt for ECDSA and Mbed TLS for RSA). + The conversion to the PSA Crypto API is being done in preparation for the + deprecation of TinyCrypt. (:github:`78243` and :github:`43712`) + Architectures ************* diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index dc65e577d5d7f..a00d66cb9bd04 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -416,6 +416,15 @@ Libraries / Subsystems * ZBus +* JWT (JSON Web Token) + + * The following new Kconfigs were added to specify which library to use for the + signature: + + * :kconfig:option:`CONFIG_JWT_USE_PSA` (default) use the PSA Crypto API; + * :kconfig:option:`CONFIG_JWT_USE_LEGACY` use legacy libraries, i.e. TinyCrypt + for ECDSA and Mbed TLS for RSA. + HALs **** From 9f60075d14a283602a3580b6b97dd4686b53a28e Mon Sep 17 00:00:00 2001 From: Benjamin Lemouzy Date: Mon, 15 Jul 2024 11:53:42 +0200 Subject: [PATCH 0477/4482] jwt: remove jwt_payload_len function The function jwt_payload_len doesn't return payload length but returns used data in builder->buf If jwt_payload_len is called after jwt_init_builder, header length will be returned If jwt_payload_len is called after jwt_add_payload, header+payload length will be returned If jwt_payload_len is called after jwt_sign, header+payload+sign length will be returned So, this commit removes the function and uses strlen instead Signed-off-by: Benjamin Lemouzy --- include/zephyr/data/jwt.h | 6 ------ tests/subsys/jwt/src/main.c | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/include/zephyr/data/jwt.h b/include/zephyr/data/jwt.h index 8d6121b939498..d198251f744a5 100644 --- a/include/zephyr/data/jwt.h +++ b/include/zephyr/data/jwt.h @@ -110,12 +110,6 @@ int jwt_sign(struct jwt_builder *builder, const char *der_key, size_t der_key_len); - -static inline size_t jwt_payload_len(struct jwt_builder *builder) -{ - return (builder->buf - builder->base); -} - #ifdef __cplusplus } #endif diff --git a/tests/subsys/jwt/src/main.c b/tests/subsys/jwt/src/main.c index ab61cd3622026..7ca5ed1e6a852 100644 --- a/tests/subsys/jwt/src/main.c +++ b/tests/subsys/jwt/src/main.c @@ -50,7 +50,7 @@ ZTEST(jwt_tests, test_jwt) zassert_equal(build.overflowed, false, "Not overflow"); printk("JWT:\n%s\n", buf); - printk("len: %zd\n", jwt_payload_len(&build)); + printk("len: %zd\n", strlen(buf)); } ZTEST_SUITE(jwt_tests, NULL, NULL, NULL, NULL, NULL); From ec7943bb181753c9b7dc339090a2e7f4b9d7f06e Mon Sep 17 00:00:00 2001 From: Mark Holden Date: Wed, 22 May 2024 17:49:51 -0700 Subject: [PATCH 0478/4482] coredump: ARM: Ensure sp in dump is set as gdb expects Gdb is typically able to reconstruct the first two frames of the failing stack using the "pc" and "lr" registers. After that, (if the frame pointer is omitted) it appears to need the stack pointer (sp register) to point to the top of the stack before a fatal error occurred. The ARM Cortex-M processors push registers r0-r3, r12, LR, {possibly FPU registers}, PC, SPSR onto the stack before entering the exception handler. We adjust the stack pointer back to the point before these registers were pushed for preservation in the dump. During k_oops/k_panic, the sp wasn't stored in the core dump at all. Apply similar logic to store it when failures occur in that path. Signed-off-by: Mark Holden --- arch/arm/core/cortex_a_r/swap_helper.S | 6 +- arch/arm/core/cortex_a_r/switch.S | 6 +- arch/arm/core/cortex_m/fault.c | 52 +--------------- arch/arm/core/cortex_m/swap_helper.S | 1 + arch/arm/core/fatal.c | 5 +- arch/arm/include/cortex_a_r/exception.h | 9 +++ arch/arm/include/cortex_m/exception.h | 82 +++++++++++++++++++++++++ 7 files changed, 105 insertions(+), 56 deletions(-) diff --git a/arch/arm/core/cortex_a_r/swap_helper.S b/arch/arm/core/cortex_a_r/swap_helper.S index 548bb446aa319..f85e97d05e25c 100644 --- a/arch/arm/core/cortex_a_r/swap_helper.S +++ b/arch/arm/core/cortex_a_r/swap_helper.S @@ -336,12 +336,14 @@ _context_switch: _oops: /* - * Pass the exception frame to z_do_kernel_oops. r0 contains the - * exception reason. + * Pass the exception frame to z_do_kernel_oops. */ cps #MODE_SYS mov r0, sp cps #MODE_SVC + /* Zero callee_regs and exc_return (only used on Cortex-M) */ + mov r1, #0 + mov r2, #0 bl z_do_kernel_oops b z_arm_int_exit diff --git a/arch/arm/core/cortex_a_r/switch.S b/arch/arm/core/cortex_a_r/switch.S index 800d46bbf94dd..4d5a6a627b1cc 100644 --- a/arch/arm/core/cortex_a_r/switch.S +++ b/arch/arm/core/cortex_a_r/switch.S @@ -150,10 +150,12 @@ offload: _oops: /* - * Pass the exception frame to z_do_kernel_oops. r0 contains the - * exception reason. + * Pass the exception frame to z_do_kernel_oops. */ mov r0, sp + /* Zero callee_regs and exc_return (only used on Cortex-M) */ + mov r1, #0 + mov r2, #0 bl z_do_kernel_oops inv: diff --git a/arch/arm/core/cortex_m/fault.c b/arch/arm/core/cortex_m/fault.c index 4e604ba8033c1..604801a6414d9 100644 --- a/arch/arm/core/cortex_m/fault.c +++ b/arch/arm/core/cortex_m/fault.c @@ -40,54 +40,6 @@ LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); #define EACD(edr) (((edr) & SYSMPU_EDR_EACD_MASK) >> SYSMPU_EDR_EACD_SHIFT) #endif -/* Exception Return (EXC_RETURN) is provided in LR upon exception entry. - * It is used to perform an exception return and to detect possible state - * transition upon exception. - */ - -/* Prefix. Indicates that this is an EXC_RETURN value. - * This field reads as 0b11111111. - */ -#define EXC_RETURN_INDICATOR_PREFIX (0xFF << 24) -/* bit[0]: Exception Secure. The security domain the exception was taken to. */ -#define EXC_RETURN_EXCEPTION_SECURE_Pos 0 -#define EXC_RETURN_EXCEPTION_SECURE_Msk \ - BIT(EXC_RETURN_EXCEPTION_SECURE_Pos) -#define EXC_RETURN_EXCEPTION_SECURE_Non_Secure 0 -#define EXC_RETURN_EXCEPTION_SECURE_Secure EXC_RETURN_EXCEPTION_SECURE_Msk -/* bit[2]: Stack Pointer selection. */ -#define EXC_RETURN_SPSEL_Pos 2 -#define EXC_RETURN_SPSEL_Msk BIT(EXC_RETURN_SPSEL_Pos) -#define EXC_RETURN_SPSEL_MAIN 0 -#define EXC_RETURN_SPSEL_PROCESS EXC_RETURN_SPSEL_Msk -/* bit[3]: Mode. Indicates the Mode that was stacked from. */ -#define EXC_RETURN_MODE_Pos 3 -#define EXC_RETURN_MODE_Msk BIT(EXC_RETURN_MODE_Pos) -#define EXC_RETURN_MODE_HANDLER 0 -#define EXC_RETURN_MODE_THREAD EXC_RETURN_MODE_Msk -/* bit[4]: Stack frame type. Indicates whether the stack frame is a standard - * integer only stack frame or an extended floating-point stack frame. - */ -#define EXC_RETURN_STACK_FRAME_TYPE_Pos 4 -#define EXC_RETURN_STACK_FRAME_TYPE_Msk BIT(EXC_RETURN_STACK_FRAME_TYPE_Pos) -#define EXC_RETURN_STACK_FRAME_TYPE_EXTENDED 0 -#define EXC_RETURN_STACK_FRAME_TYPE_STANDARD EXC_RETURN_STACK_FRAME_TYPE_Msk -/* bit[5]: Default callee register stacking. Indicates whether the default - * stacking rules apply, or whether the callee registers are already on the - * stack. - */ -#define EXC_RETURN_CALLEE_STACK_Pos 5 -#define EXC_RETURN_CALLEE_STACK_Msk BIT(EXC_RETURN_CALLEE_STACK_Pos) -#define EXC_RETURN_CALLEE_STACK_SKIPPED 0 -#define EXC_RETURN_CALLEE_STACK_DEFAULT EXC_RETURN_CALLEE_STACK_Msk -/* bit[6]: Secure or Non-secure stack. Indicates whether a Secure or - * Non-secure stack is used to restore stack frame on exception return. - */ -#define EXC_RETURN_RETURN_STACK_Pos 6 -#define EXC_RETURN_RETURN_STACK_Msk BIT(EXC_RETURN_RETURN_STACK_Pos) -#define EXC_RETURN_RETURN_STACK_Non_Secure 0 -#define EXC_RETURN_RETURN_STACK_Secure EXC_RETURN_RETURN_STACK_Msk - /* Integrity signature for an ARMv8-M implementation */ #if defined(CONFIG_ARMV7_M_ARMV8_M_FP) #define INTEGRITY_SIGNATURE_STD 0xFEFA125BUL @@ -1112,9 +1064,7 @@ void z_arm_fault(uint32_t msp, uint32_t psp, uint32_t exc_return, __ASSERT(esf != NULL, "ESF could not be retrieved successfully. Shall never occur."); -#ifdef CONFIG_DEBUG_COREDUMP - z_arm_coredump_fault_sp = POINTER_TO_UINT(esf); -#endif + z_arm_set_fault_sp(esf, exc_return); reason = fault_handle(esf, fault, &recoverable); if (recoverable) { diff --git a/arch/arm/core/cortex_m/swap_helper.S b/arch/arm/core/cortex_m/swap_helper.S index c2cb3ef7f2fea..e1c6414fea82b 100644 --- a/arch/arm/core/cortex_m/swap_helper.S +++ b/arch/arm/core/cortex_m/swap_helper.S @@ -315,6 +315,7 @@ _oops: mov r1, sp /* pointer to _callee_saved_t */ #endif /* CONFIG_ARMV7_M_ARMV8_M_MAINLINE */ #endif /* CONFIG_EXTRA_EXCEPTION_INFO */ + mov r2, lr /* EXC_RETURN */ bl z_do_kernel_oops /* return from SVC exception is done here */ #if defined(CONFIG_EXTRA_EXCEPTION_INFO) diff --git a/arch/arm/core/fatal.c b/arch/arm/core/fatal.c index 4532e238f05c9..d64855b6b8e3e 100644 --- a/arch/arm/core/fatal.c +++ b/arch/arm/core/fatal.c @@ -101,8 +101,9 @@ void z_arm_fatal_error(unsigned int reason, const struct arch_esf *esf) * * @param esf exception frame * @param callee_regs Callee-saved registers (R4-R11) + * @param exc_return EXC_RETURN value present in LR after exception entry. */ -void z_do_kernel_oops(const struct arch_esf *esf, _callee_saved_t *callee_regs) +void z_do_kernel_oops(const struct arch_esf *esf, _callee_saved_t *callee_regs, uint32_t exc_return) { #if !(defined(CONFIG_EXTRA_EXCEPTION_INFO) && defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)) ARG_UNUSED(callee_regs); @@ -110,6 +111,8 @@ void z_do_kernel_oops(const struct arch_esf *esf, _callee_saved_t *callee_regs) /* Stacked R0 holds the exception reason. */ unsigned int reason = esf->basic.r0; + z_arm_set_fault_sp(esf, exc_return); + #if defined(CONFIG_USERSPACE) if (z_arm_preempted_thread_in_user_mode(esf)) { /* diff --git a/arch/arm/include/cortex_a_r/exception.h b/arch/arm/include/cortex_a_r/exception.h index 6daa9c106ee2b..4326444f112ec 100644 --- a/arch/arm/include/cortex_a_r/exception.h +++ b/arch/arm/include/cortex_a_r/exception.h @@ -43,6 +43,15 @@ static ALWAYS_INLINE bool arch_is_in_nested_exception(const struct arch_esf *esf return (arch_curr_cpu()->arch.exc_depth > 1U) ? (true) : (false); } +/** + * @brief No current implementation where core dump is not supported + * + * @param esf exception frame + * @param exc_return EXC_RETURN value present in LR after exception entry. + */ +static ALWAYS_INLINE void z_arm_set_fault_sp(const struct arch_esf *esf, uint32_t exc_return) +{} + #if defined(CONFIG_USERSPACE) /* * This function is used by privileged code to determine if the thread diff --git a/arch/arm/include/cortex_m/exception.h b/arch/arm/include/cortex_m/exception.h index 89bdd4b83e9a2..5348638c843fe 100644 --- a/arch/arm/include/cortex_m/exception.h +++ b/arch/arm/include/cortex_m/exception.h @@ -39,6 +39,54 @@ extern volatile irq_offload_routine_t offload_routine; */ #define AIRCR_VECT_KEY_PERMIT_WRITE 0x05FAUL +/* Exception Return (EXC_RETURN) is provided in LR upon exception entry. + * It is used to perform an exception return and to detect possible state + * transition upon exception. + */ + +/* Prefix. Indicates that this is an EXC_RETURN value. + * This field reads as 0b11111111. + */ +#define EXC_RETURN_INDICATOR_PREFIX (0xFF << 24) +/* bit[0]: Exception Secure. The security domain the exception was taken to. */ +#define EXC_RETURN_EXCEPTION_SECURE_Pos 0 +#define EXC_RETURN_EXCEPTION_SECURE_Msk \ + BIT(EXC_RETURN_EXCEPTION_SECURE_Pos) +#define EXC_RETURN_EXCEPTION_SECURE_Non_Secure 0 +#define EXC_RETURN_EXCEPTION_SECURE_Secure EXC_RETURN_EXCEPTION_SECURE_Msk +/* bit[2]: Stack Pointer selection. */ +#define EXC_RETURN_SPSEL_Pos 2 +#define EXC_RETURN_SPSEL_Msk BIT(EXC_RETURN_SPSEL_Pos) +#define EXC_RETURN_SPSEL_MAIN 0 +#define EXC_RETURN_SPSEL_PROCESS EXC_RETURN_SPSEL_Msk +/* bit[3]: Mode. Indicates the Mode that was stacked from. */ +#define EXC_RETURN_MODE_Pos 3 +#define EXC_RETURN_MODE_Msk BIT(EXC_RETURN_MODE_Pos) +#define EXC_RETURN_MODE_HANDLER 0 +#define EXC_RETURN_MODE_THREAD EXC_RETURN_MODE_Msk +/* bit[4]: Stack frame type. Indicates whether the stack frame is a standard + * integer only stack frame or an extended floating-point stack frame. + */ +#define EXC_RETURN_STACK_FRAME_TYPE_Pos 4 +#define EXC_RETURN_STACK_FRAME_TYPE_Msk BIT(EXC_RETURN_STACK_FRAME_TYPE_Pos) +#define EXC_RETURN_STACK_FRAME_TYPE_EXTENDED 0 +#define EXC_RETURN_STACK_FRAME_TYPE_STANDARD EXC_RETURN_STACK_FRAME_TYPE_Msk +/* bit[5]: Default callee register stacking. Indicates whether the default + * stacking rules apply, or whether the callee registers are already on the + * stack. + */ +#define EXC_RETURN_CALLEE_STACK_Pos 5 +#define EXC_RETURN_CALLEE_STACK_Msk BIT(EXC_RETURN_CALLEE_STACK_Pos) +#define EXC_RETURN_CALLEE_STACK_SKIPPED 0 +#define EXC_RETURN_CALLEE_STACK_DEFAULT EXC_RETURN_CALLEE_STACK_Msk +/* bit[6]: Secure or Non-secure stack. Indicates whether a Secure or + * Non-secure stack is used to restore stack frame on exception return. + */ +#define EXC_RETURN_RETURN_STACK_Pos 6 +#define EXC_RETURN_RETURN_STACK_Msk BIT(EXC_RETURN_RETURN_STACK_Pos) +#define EXC_RETURN_RETURN_STACK_Non_Secure 0 +#define EXC_RETURN_RETURN_STACK_Secure EXC_RETURN_RETURN_STACK_Msk + /* * The current executing vector is found in the IPSR register. All * IRQs and system exceptions are considered as interrupt context. @@ -184,6 +232,40 @@ static ALWAYS_INLINE void z_arm_clear_faults(void) #endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */ } +/** + * @brief Set z_arm_coredump_fault_sp to stack pointer value expected by GDB + * + * @param esf exception frame + * @param exc_return EXC_RETURN value present in LR after exception entry. + */ +static ALWAYS_INLINE void z_arm_set_fault_sp(const struct arch_esf *esf, uint32_t exc_return) +{ +#ifdef CONFIG_DEBUG_COREDUMP + z_arm_coredump_fault_sp = POINTER_TO_UINT(esf); +#if defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE) || defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE) + /* Gdb expects a stack pointer that does not include the exception stack frame in order to + * unwind. So adjust the stack pointer accordingly. + */ + z_arm_coredump_fault_sp += sizeof(esf->basic); + +#if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING) + /* Assess whether thread had been using the FP registers and add size of additional + * registers if necessary + */ + if ((exc_return & EXC_RETURN_STACK_FRAME_TYPE_STANDARD) == + EXC_RETURN_STACK_FRAME_TYPE_EXTENDED) { + z_arm_coredump_fault_sp += sizeof(esf->fpu); + } +#endif /* CONFIG_FPU && CONFIG_FPU_SHARING */ + + if ((esf->basic.xpsr & SCB_CCR_STKALIGN_Msk) == SCB_CCR_STKALIGN_Msk) { + /* Adjust stack alignment after PSR bit[9] detected */ + z_arm_coredump_fault_sp |= 0x4; + } +#endif /* CONFIG_ARMV7_M_ARMV8_M_MAINLINE || CONFIG_ARMV6_M_ARMV8_M_BASELINE */ +#endif /* CONFIG_DEBUG_COREDUMP */ +} + /** * @brief Assess whether a debug monitor event should be treated as an error * From 0cecb2c9af79329553f400b24c19f71754e2f9f6 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Wed, 25 Sep 2024 12:26:21 +0800 Subject: [PATCH 0479/4482] dts: add andestech,nceplic100 binding Add a new `andestech,nceplic100` binding that inherits from the `sifive,plic-1.0.0` binding. This is so that the Kconfig `DT_HAS_ANDESTECH_NCEPLIC100_ENABLED` would be generated during build. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- .../interrupt-controller/andestech,nceplic100.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 dts/bindings/interrupt-controller/andestech,nceplic100.yaml diff --git a/dts/bindings/interrupt-controller/andestech,nceplic100.yaml b/dts/bindings/interrupt-controller/andestech,nceplic100.yaml new file mode 100644 index 0000000000000..6ffe493fee2b6 --- /dev/null +++ b/dts/bindings/interrupt-controller/andestech,nceplic100.yaml @@ -0,0 +1,11 @@ +# +# Copyright (c) 2024 Meta Platforms +# +# SPDX-License-Identifier: Apache-2.0 +# + +description: Andes Platform-Level Interrupt Controller (NCEPLIC100) + +compatible: "andestech,nceplic100" + +include: sifive,plic-1.0.0.yaml From 65fb61bc68653ff6f4f4e97fed87096739c243ea Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Wed, 18 Sep 2024 14:18:16 +0800 Subject: [PATCH 0480/4482] drivers: intc: plic: implement software-generated interrupt Implement `riscv_plic_irq_set_pending()` to trigger a software-generated interrupt. The "4. Interrupt Pending Bits" of the riscv-plic specs described the reading of the pending bits, but not the writing Since not all PLIC implementations support software-generated interrupt, the function is compiled only when `CONFIG_PLIC_SUPPORTS_SOFT_INTERRUPT` is enabled on PLIC that supports it, such as the Andes' NCEPLIC100. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- drivers/interrupt_controller/Kconfig.plic | 7 +++++ drivers/interrupt_controller/intc_plic.c | 28 +++++++++++++++++++ .../drivers/interrupt_controller/riscv_plic.h | 7 +++++ 3 files changed, 42 insertions(+) diff --git a/drivers/interrupt_controller/Kconfig.plic b/drivers/interrupt_controller/Kconfig.plic index 4367ce8f6303f..9613dda5082c8 100644 --- a/drivers/interrupt_controller/Kconfig.plic +++ b/drivers/interrupt_controller/Kconfig.plic @@ -13,6 +13,13 @@ config PLIC if PLIC +config PLIC_SUPPORTS_SOFT_INTERRUPT + bool + default y + depends on DT_HAS_ANDESTECH_NCEPLIC100_ENABLED + help + Enabled when the PLIC supports software-triggered interrupts. + config PLIC_IRQ_AFFINITY bool "Configure IRQ affinity" depends on SMP diff --git a/drivers/interrupt_controller/intc_plic.c b/drivers/interrupt_controller/intc_plic.c index 0ad9aa831a8f4..9e701fd6133ae 100644 --- a/drivers/interrupt_controller/intc_plic.c +++ b/drivers/interrupt_controller/intc_plic.c @@ -39,6 +39,7 @@ #define CONTEXT_CLAIM 0x04 #define CONTEXT_ENABLE_BASE 0x2000 #define CONTEXT_ENABLE_SIZE 0x80 +#define CONTEXT_PENDING_BASE 0x1000 /* * Trigger type is mentioned, but not defined in the RISCV PLIC specs. * However, it is defined and supported by at least the Andes & Telink datasheet, and supported @@ -87,6 +88,9 @@ struct plic_config { mem_addr_t prio; mem_addr_t irq_en; mem_addr_t reg; +#ifdef CONFIG_PLIC_SUPPORTS_SOFT_INTERRUPT + mem_addr_t pend; +#endif /* CONFIG_PLIC_SUPPORTS_SOFT_INTERRUPT */ mem_addr_t trig; uint32_t max_prio; /* Number of IRQs that the PLIC physically supports */ @@ -204,6 +208,15 @@ static ALWAYS_INLINE uint32_t local_irq_to_irq(const struct device *dev, uint32_ return irq_to_level_2(local_irq) | config->irq; } +#ifdef CONFIG_PLIC_SUPPORTS_SOFT_INTERRUPT +static inline mem_addr_t get_pending_reg(const struct device *dev, uint32_t local_irq) +{ + const struct plic_config *config = dev->config; + + return config->pend + local_irq_to_reg_offset(local_irq); +} +#endif /* CONFIG_PLIC_SUPPORTS_SOFT_INTERRUPT */ + /** * @brief Determine the PLIC device from the IRQ * @@ -358,6 +371,19 @@ void riscv_plic_set_priority(uint32_t irq, uint32_t priority) sys_write32(priority, prio_addr); } +#ifdef CONFIG_PLIC_SUPPORTS_SOFT_INTERRUPT +void riscv_plic_irq_set_pending(uint32_t irq) +{ + const struct device *dev = get_plic_dev_from_irq(irq); + const uint32_t local_irq = irq_from_level_2(irq); + mem_addr_t pend_addr = get_pending_reg(dev, local_irq); + uint32_t pend_value = sys_read32(pend_addr); + + WRITE_BIT(pend_value, local_irq & PLIC_REG_MASK, true); + sys_write32(pend_value, pend_addr); +} +#endif /* CONFIG_PLIC_SUPPORTS_SOFT_INTERRUPT */ + /** * @brief Get riscv PLIC-specific interrupt line causing an interrupt * @@ -883,6 +909,8 @@ SHELL_CMD_REGISTER(plic, &plic_cmds, "PLIC shell commands", NULL); .prio = PLIC_BASE_ADDR(n), \ .irq_en = PLIC_BASE_ADDR(n) + CONTEXT_ENABLE_BASE, \ .reg = PLIC_BASE_ADDR(n) + CONTEXT_BASE, \ + IF_ENABLED(CONFIG_PLIC_SUPPORTS_SOFT_INTERRUPT, \ + (.pend = PLIC_BASE_ADDR(n) + CONTEXT_PENDING_BASE,)) \ IF_ENABLED(PLIC_SUPPORTS_TRIG_TYPE, \ (.trig = PLIC_BASE_ADDR(n) + PLIC_REG_TRIG_TYPE_OFFSET,)) \ .max_prio = DT_INST_PROP(n, riscv_max_priority), \ diff --git a/include/zephyr/drivers/interrupt_controller/riscv_plic.h b/include/zephyr/drivers/interrupt_controller/riscv_plic.h index 3a390017f1059..3bd7be3afc5b9 100644 --- a/include/zephyr/drivers/interrupt_controller/riscv_plic.h +++ b/include/zephyr/drivers/interrupt_controller/riscv_plic.h @@ -54,6 +54,13 @@ void riscv_plic_set_priority(uint32_t irq, uint32_t prio); */ int riscv_plic_irq_set_affinity(uint32_t irq, uint32_t cpumask); +/** + * @brief Set interrupt as pending + * + * @param irq Multi-level encoded interrupt ID + */ +void riscv_plic_irq_set_pending(uint32_t irq); + /** * @brief Get active interrupt ID * From 9109cfe346666c59c0e2ddc8d072e1d94cae7ca1 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Wed, 25 Sep 2024 13:24:03 +0800 Subject: [PATCH 0481/4482] drivers: intc: plic: convert trigger type to use Kconfig Convert the compilation of the trigger type feature to depend on Kconfig, following the same pattern of software-triggered interrupt. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- drivers/interrupt_controller/Kconfig.plic | 31 +++++++++++++++ drivers/interrupt_controller/intc_plic.c | 47 +++++++++-------------- 2 files changed, 50 insertions(+), 28 deletions(-) diff --git a/drivers/interrupt_controller/Kconfig.plic b/drivers/interrupt_controller/Kconfig.plic index 9613dda5082c8..7db7039efc595 100644 --- a/drivers/interrupt_controller/Kconfig.plic +++ b/drivers/interrupt_controller/Kconfig.plic @@ -20,6 +20,37 @@ config PLIC_SUPPORTS_SOFT_INTERRUPT help Enabled when the PLIC supports software-triggered interrupts. +config PLIC_SUPPORTS_TRIG_TYPE + bool + default y + depends on DT_HAS_ANDESTECH_NCEPLIC100_ENABLED + help + Enabled when the PLIC supports multiple trigger types, + such as level, edge, etc. + +if PLIC_SUPPORTS_TRIG_TYPE + +config PLIC_TRIG_TYPE_REG_OFFSET + hex "Trigger type register offset" + default 0x1080 if DT_HAS_ANDESTECH_NCEPLIC100_ENABLED + help + Offset to the 'trigger type' register. + +config PLIC_TRIG_TYPE_BITWIDTH + int "Trigger type bitwidth" + default 1 + help + Number of bits required to differentiate between the trigger types. + +config PLIC_SUPPORTS_TRIG_EDGE + bool + default y + depends on DT_HAS_ANDESTECH_NCEPLIC100_ENABLED + help + Enabled when the PLIC supports edge-triggered interrupt. + +endif # PLIC_SUPPORTS_TRIG_TYPE + config PLIC_IRQ_AFFINITY bool "Configure IRQ affinity" depends on SMP diff --git a/drivers/interrupt_controller/intc_plic.c b/drivers/interrupt_controller/intc_plic.c index 9e701fd6133ae..1b958ce0eb5a1 100644 --- a/drivers/interrupt_controller/intc_plic.c +++ b/drivers/interrupt_controller/intc_plic.c @@ -40,24 +40,16 @@ #define CONTEXT_ENABLE_BASE 0x2000 #define CONTEXT_ENABLE_SIZE 0x80 #define CONTEXT_PENDING_BASE 0x1000 + /* * Trigger type is mentioned, but not defined in the RISCV PLIC specs. * However, it is defined and supported by at least the Andes & Telink datasheet, and supported * in Linux's SiFive PLIC driver */ +#ifdef CONFIG_PLIC_SUPPORTS_TRIG_TYPE #define PLIC_TRIG_LEVEL ((uint32_t)0) #define PLIC_TRIG_EDGE ((uint32_t)1) -#define PLIC_DRV_HAS_COMPAT(compat) \ - DT_NODE_HAS_COMPAT(DT_COMPAT_GET_ANY_STATUS_OKAY(DT_DRV_COMPAT), compat) - -#if PLIC_DRV_HAS_COMPAT(andestech_nceplic100) -#define PLIC_SUPPORTS_TRIG_TYPE 1 -#define PLIC_REG_TRIG_TYPE_WIDTH 1 -#define PLIC_REG_TRIG_TYPE_OFFSET 0x1080 -#else -/* Trigger-type not supported */ -#define PLIC_REG_TRIG_TYPE_WIDTH 0 -#endif +#endif /* CONFIG_PLIC_SUPPORTS_TRIG_TYPE */ /* PLIC registers are 32-bit memory-mapped */ #define PLIC_REG_SIZE 32 @@ -91,7 +83,9 @@ struct plic_config { #ifdef CONFIG_PLIC_SUPPORTS_SOFT_INTERRUPT mem_addr_t pend; #endif /* CONFIG_PLIC_SUPPORTS_SOFT_INTERRUPT */ +#ifdef CONFIG_PLIC_SUPPORTS_TRIG_TYPE mem_addr_t trig; +#endif /* CONFIG_PLIC_SUPPORTS_TRIG_TYPE */ uint32_t max_prio; /* Number of IRQs that the PLIC physically supports */ uint32_t riscv_ndev; @@ -233,6 +227,7 @@ static inline const struct device *get_plic_dev_from_irq(uint32_t irq) #endif } +#ifdef CONFIG_PLIC_SUPPORTS_TRIG_TYPE /** * @brief Return the value of the trigger type register for the IRQ * @@ -245,18 +240,15 @@ static inline const struct device *get_plic_dev_from_irq(uint32_t irq) * * @return Trigger type register value if PLIC supports trigger type, PLIC_TRIG_LEVEL otherwise */ -static uint32_t __maybe_unused riscv_plic_irq_trig_val(const struct device *dev, uint32_t local_irq) +static uint32_t riscv_plic_irq_trig_val(const struct device *dev, uint32_t local_irq) { - if (!IS_ENABLED(PLIC_SUPPORTS_TRIG_TYPE)) { - return PLIC_TRIG_LEVEL; - } - const struct plic_config *config = dev->config; mem_addr_t trig_addr = config->trig + local_irq_to_reg_offset(local_irq); - uint32_t offset = local_irq * PLIC_REG_TRIG_TYPE_WIDTH; + uint32_t offset = local_irq * CONFIG_PLIC_TRIG_TYPE_BITWIDTH; - return sys_read32(trig_addr) & GENMASK(offset + PLIC_REG_TRIG_TYPE_WIDTH - 1, offset); + return sys_read32(trig_addr) & GENMASK(offset + CONFIG_PLIC_TRIG_TYPE_BITWIDTH - 1, offset); } +#endif /* CONFIG_PLIC_SUPPORTS_TRIG_TYPE */ static void plic_irq_enable_set_state(uint32_t irq, bool enable) { @@ -493,7 +485,6 @@ static void plic_irq_handler(const struct device *dev) const struct plic_config *config = dev->config; mem_addr_t claim_complete_addr = get_claim_complete_addr(dev); struct _isr_table_entry *ite; - uint32_t __maybe_unused trig_val; uint32_t cpu_id = arch_proc_id(); /* Get the IRQ number generating the interrupt */ const uint32_t local_irq = sys_read32(claim_complete_addr); @@ -540,16 +531,16 @@ static void plic_irq_handler(const struct device *dev) z_irq_spurious(NULL); } -#if PLIC_DRV_HAS_COMPAT(andestech_nceplic100) - trig_val = riscv_plic_irq_trig_val(dev, local_irq); +#ifdef CONFIG_PLIC_SUPPORTS_TRIG_EDGE + uint32_t trig_val = riscv_plic_irq_trig_val(dev, local_irq); /* - * Edge-triggered interrupts on Andes NCEPLIC100 have to be acknowledged first before + * Edge-triggered interrupts have to be acknowledged first before * getting handled so that we don't miss on the next edge-triggered interrupt. */ if (trig_val == PLIC_TRIG_EDGE) { sys_write32(local_irq, claim_complete_addr); } -#endif +#endif /* CONFIG_PLIC_SUPPORTS_TRIG_EDGE */ /* Call the corresponding IRQ handler in _sw_isr_table */ ite = &config->isr_table[local_irq]; @@ -560,14 +551,14 @@ static void plic_irq_handler(const struct device *dev) * PLIC controller that the IRQ has been handled * for level triggered interrupts. */ -#if PLIC_DRV_HAS_COMPAT(andestech_nceplic100) - /* For NCEPLIC100, handle only if level-triggered */ +#ifdef CONFIG_PLIC_SUPPORTS_TRIG_EDGE + /* Handle only if level-triggered */ if (trig_val == PLIC_TRIG_LEVEL) { sys_write32(local_irq, claim_complete_addr); } #else sys_write32(local_irq, claim_complete_addr); -#endif +#endif /* #ifdef CONFIG_PLIC_SUPPORTS_TRIG_EDGE */ } /** @@ -911,8 +902,8 @@ SHELL_CMD_REGISTER(plic, &plic_cmds, "PLIC shell commands", NULL); .reg = PLIC_BASE_ADDR(n) + CONTEXT_BASE, \ IF_ENABLED(CONFIG_PLIC_SUPPORTS_SOFT_INTERRUPT, \ (.pend = PLIC_BASE_ADDR(n) + CONTEXT_PENDING_BASE,)) \ - IF_ENABLED(PLIC_SUPPORTS_TRIG_TYPE, \ - (.trig = PLIC_BASE_ADDR(n) + PLIC_REG_TRIG_TYPE_OFFSET,)) \ + IF_ENABLED(CONFIG_PLIC_SUPPORTS_TRIG_TYPE, \ + (.trig = PLIC_BASE_ADDR(n) + CONFIG_PLIC_TRIG_TYPE_REG_OFFSET,)) \ .max_prio = DT_INST_PROP(n, riscv_max_priority), \ .riscv_ndev = DT_INST_PROP(n, riscv_ndev), \ .nr_irqs = PLIC_MIN_IRQ_NUM(n), \ From e7e7386352a50b9c62d0e7dbf469bccfc0b34cb9 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Wed, 25 Sep 2024 14:56:45 +0200 Subject: [PATCH 0482/4482] Bluetooth: BAP: Modify unicast client callbacks to slist Modify the BAP unicast client callback structure to be a linked list. The purpose of this is to have multiple listeners of the unicast client changes and notifications. This is needed for the CAP initiatior. Signed-off-by: Emil Gydesen --- doc/releases/migration-guide-4.0.rst | 4 + include/zephyr/bluetooth/audio/bap.h | 11 +- subsys/bluetooth/audio/bap_unicast_client.c | 352 +++++++++++------- .../audio/src/cap_initiator_unicast_test.c | 2 +- 4 files changed, 239 insertions(+), 130 deletions(-) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 73023ad3f782c..5eb0713bd909e 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -315,6 +315,10 @@ Bluetooth Audio is enabled and that all members are bonded, to comply with the requirements from the CSIP spec. (:github:`78877`) +* The callback structure provided to :c:func:`bt_bap_unicast_client_register_cb` is no longer + :code:`const`, and now multiple callback structures can be registered. + (:github:`78999`) + * The Broadcast Audio Scan Service (BASS) shall now be registered and unregistered dynamically at runtime within the scan delegator. Two new APIs, :c:func:`bt_bap_scan_delegator_register()` and :c:func:`bt_bap_scan_delegator_unregister()`, have been introduced to manage both BASS and diff --git a/include/zephyr/bluetooth/audio/bap.h b/include/zephyr/bluetooth/audio/bap.h index 583644a37e8c8..4860e4da5ef93 100644 --- a/include/zephyr/bluetooth/audio/bap.h +++ b/include/zephyr/bluetooth/audio/bap.h @@ -1712,6 +1712,11 @@ struct bt_bap_unicast_client_cb { * If discovery procedure has complete both @p codec and @p ep are set to NULL. */ void (*discover)(struct bt_conn *conn, int err, enum bt_audio_dir dir); + + /** @cond INTERNAL_HIDDEN */ + /** Internally used field for list handling */ + sys_snode_t _node; + /** @endcond */ }; /** @@ -1722,9 +1727,11 @@ struct bt_bap_unicast_client_cb { * * @param cb Unicast client callback structure. * - * @return 0 in case of success or negative value in case of error. + * @retval 0 Success + * @retval -EINVAL @p cb is NULL. + * @retval -EEXIST @p cb is already registered. */ -int bt_bap_unicast_client_register_cb(const struct bt_bap_unicast_client_cb *cb); +int bt_bap_unicast_client_register_cb(struct bt_bap_unicast_client_cb *cb); /** * @brief Discover remote capabilities and endpoints diff --git a/subsys/bluetooth/audio/bap_unicast_client.c b/subsys/bluetooth/audio/bap_unicast_client.c index c50791af0434e..4107a79c5542d 100644 --- a/subsys/bluetooth/audio/bap_unicast_client.c +++ b/subsys/bluetooth/audio/bap_unicast_client.c @@ -136,7 +136,7 @@ static struct unicast_client { ATOMIC_DEFINE(flags, UNICAST_CLIENT_FLAG_NUM_FLAGS); } uni_cli_insts[CONFIG_BT_MAX_CONN]; -static const struct bt_bap_unicast_client_cb *unicast_client_cbs; +static sys_slist_t unicast_client_cbs = SYS_SLIST_STATIC_INIT(&unicast_client_cbs); /* TODO: Move the functions to avoid these prototypes */ static int unicast_client_ep_set_metadata(struct bt_bap_ep *ep, void *data, uint8_t len, @@ -588,6 +588,185 @@ static void unicast_client_ep_set_local_idle_state(struct bt_bap_ep *ep) unicast_client_ep_set_status(ep, &buf); } +static void unicast_client_notify_location(struct bt_conn *conn, enum bt_audio_dir dir, + enum bt_audio_location loc) +{ + struct bt_bap_unicast_client_cb *listener, *next; + + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&unicast_client_cbs, listener, next, _node) { + if (listener->location != NULL) { + listener->location(conn, dir, loc); + } + } +} + +static void unicast_client_notify_available_contexts(struct bt_conn *conn, + enum bt_audio_context snk_ctx, + enum bt_audio_context src_ctx) +{ + struct bt_bap_unicast_client_cb *listener, *next; + + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&unicast_client_cbs, listener, next, _node) { + if (listener->available_contexts != NULL) { + listener->available_contexts(conn, snk_ctx, src_ctx); + } + } +} + +static void unicast_client_notify_pac_record(struct bt_conn *conn, + const struct bt_audio_codec_cap *codec_cap) +{ + const struct unicast_client *client = &uni_cli_insts[bt_conn_index(conn)]; + struct bt_bap_unicast_client_cb *listener, *next; + const enum bt_audio_dir dir = client->dir; + + /* TBD: Since the PAC records are optionally notifiable we may want to supply the + * index and total count of records in the callback, so that it easier for the + * upper layers to determine when a new set of PAC records is being reported. + */ + + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&unicast_client_cbs, listener, next, _node) { + if (listener->pac_record != NULL) { + listener->pac_record(conn, dir, codec_cap); + } + } +} + +static void unicast_client_notify_endpoint(struct bt_conn *conn, struct bt_bap_ep *ep) +{ + const struct unicast_client *client = &uni_cli_insts[bt_conn_index(conn)]; + struct bt_bap_unicast_client_cb *listener, *next; + const enum bt_audio_dir dir = client->dir; + + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&unicast_client_cbs, listener, next, _node) { + if (listener->endpoint != NULL) { + listener->endpoint(conn, dir, ep); + } + } +} + +static void unicast_client_discover_complete(struct bt_conn *conn, int err) +{ + struct unicast_client *client = &uni_cli_insts[bt_conn_index(conn)]; + struct bt_bap_unicast_client_cb *listener, *next; + const enum bt_audio_dir dir = client->dir; + + /* Discover complete - Reset discovery values */ + client->dir = 0U; + reset_att_buf(client); + atomic_clear_bit(client->flags, UNICAST_CLIENT_FLAG_BUSY); + + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&unicast_client_cbs, listener, next, _node) { + if (listener->discover != NULL) { + listener->discover(conn, err, dir); + } + } +} + +static void unicast_client_notify_ep_config(struct bt_bap_stream *stream, + enum bt_bap_ascs_rsp_code rsp_code, + enum bt_bap_ascs_reason reason) +{ + struct bt_bap_unicast_client_cb *listener, *next; + + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&unicast_client_cbs, listener, next, _node) { + if (listener->config != NULL) { + listener->config(stream, rsp_code, reason); + } + } +} + +static void unicast_client_notify_ep_qos(struct bt_bap_stream *stream, + enum bt_bap_ascs_rsp_code rsp_code, + enum bt_bap_ascs_reason reason) +{ + struct bt_bap_unicast_client_cb *listener, *next; + + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&unicast_client_cbs, listener, next, _node) { + if (listener->qos != NULL) { + listener->qos(stream, rsp_code, reason); + } + } +} + +static void unicast_client_notify_ep_enable(struct bt_bap_stream *stream, + enum bt_bap_ascs_rsp_code rsp_code, + enum bt_bap_ascs_reason reason) +{ + struct bt_bap_unicast_client_cb *listener, *next; + + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&unicast_client_cbs, listener, next, _node) { + if (listener->enable != NULL) { + listener->enable(stream, rsp_code, reason); + } + } +} + +static void unicast_client_notify_ep_start(struct bt_bap_stream *stream, + enum bt_bap_ascs_rsp_code rsp_code, + enum bt_bap_ascs_reason reason) +{ + struct bt_bap_unicast_client_cb *listener, *next; + + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&unicast_client_cbs, listener, next, _node) { + if (listener->start != NULL) { + listener->start(stream, rsp_code, reason); + } + } +} + +static void unicast_client_notify_ep_stop(struct bt_bap_stream *stream, + enum bt_bap_ascs_rsp_code rsp_code, + enum bt_bap_ascs_reason reason) +{ + struct bt_bap_unicast_client_cb *listener, *next; + + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&unicast_client_cbs, listener, next, _node) { + if (listener->stop != NULL) { + listener->stop(stream, rsp_code, reason); + } + } +} + +static void unicast_client_notify_ep_disable(struct bt_bap_stream *stream, + enum bt_bap_ascs_rsp_code rsp_code, + enum bt_bap_ascs_reason reason) +{ + struct bt_bap_unicast_client_cb *listener, *next; + + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&unicast_client_cbs, listener, next, _node) { + if (listener->disable != NULL) { + listener->disable(stream, rsp_code, reason); + } + } +} + +static void unicast_client_notify_ep_metadata(struct bt_bap_stream *stream, + enum bt_bap_ascs_rsp_code rsp_code, + enum bt_bap_ascs_reason reason) +{ + struct bt_bap_unicast_client_cb *listener, *next; + + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&unicast_client_cbs, listener, next, _node) { + if (listener->metadata != NULL) { + listener->metadata(stream, rsp_code, reason); + } + } +} + +static void unicast_client_notify_ep_released(struct bt_bap_stream *stream, + enum bt_bap_ascs_rsp_code rsp_code, + enum bt_bap_ascs_reason reason) +{ + struct bt_bap_unicast_client_cb *listener, *next; + + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&unicast_client_cbs, listener, next, _node) { + if (listener->release != NULL) { + listener->release(stream, rsp_code, reason); + } + } +} + static void unicast_client_ep_idle_state(struct bt_bap_ep *ep) { struct bt_bap_unicast_client_ep *client_ep = @@ -631,10 +810,8 @@ static void unicast_client_ep_idle_state(struct bt_bap_ep *ep) */ client_ep->cp_ntf_pending = false; - if (unicast_client_cbs != NULL && unicast_client_cbs->release != NULL) { - unicast_client_cbs->release(stream, BT_BAP_ASCS_RSP_CODE_SUCCESS, - BT_BAP_ASCS_REASON_NONE); - } + unicast_client_notify_ep_released(stream, BT_BAP_ASCS_RSP_CODE_SUCCESS, + BT_BAP_ASCS_REASON_NONE); } } @@ -1382,10 +1559,6 @@ static uint8_t unicast_client_cp_notify(struct bt_conn *conn, ase_rsp->code, bt_ascs_reason_str(ase_rsp->reason), ase_rsp->reason); - if (unicast_client_cbs == NULL) { - continue; - } - stream = audio_stream_by_ep_id(conn, ase_rsp->id); if (stream == NULL) { LOG_DBG("Could not find stream by id %u", ase_rsp->id); @@ -1396,40 +1569,25 @@ static uint8_t unicast_client_cp_notify(struct bt_conn *conn, switch (rsp->op) { case BT_ASCS_CONFIG_OP: - if (unicast_client_cbs->config != NULL) { - unicast_client_cbs->config(stream, ase_rsp->code, ase_rsp->reason); - } + unicast_client_notify_ep_config(stream, ase_rsp->code, ase_rsp->reason); break; case BT_ASCS_QOS_OP: - if (unicast_client_cbs->qos != NULL) { - unicast_client_cbs->qos(stream, ase_rsp->code, ase_rsp->reason); - } + unicast_client_notify_ep_qos(stream, ase_rsp->code, ase_rsp->reason); break; case BT_ASCS_ENABLE_OP: - if (unicast_client_cbs->enable != NULL) { - unicast_client_cbs->enable(stream, ase_rsp->code, ase_rsp->reason); - } + unicast_client_notify_ep_enable(stream, ase_rsp->code, ase_rsp->reason); break; case BT_ASCS_START_OP: - if (unicast_client_cbs->start != NULL) { - unicast_client_cbs->start(stream, ase_rsp->code, ase_rsp->reason); - } + unicast_client_notify_ep_start(stream, ase_rsp->code, ase_rsp->reason); break; case BT_ASCS_DISABLE_OP: - if (unicast_client_cbs->disable != NULL) { - unicast_client_cbs->disable(stream, ase_rsp->code, ase_rsp->reason); - } + unicast_client_notify_ep_disable(stream, ase_rsp->code, ase_rsp->reason); break; case BT_ASCS_STOP_OP: - if (unicast_client_cbs->stop != NULL) { - unicast_client_cbs->stop(stream, ase_rsp->code, ase_rsp->reason); - } + unicast_client_notify_ep_stop(stream, ase_rsp->code, ase_rsp->reason); break; case BT_ASCS_METADATA_OP: - if (unicast_client_cbs->metadata != NULL) { - unicast_client_cbs->metadata(stream, ase_rsp->code, - ase_rsp->reason); - } + unicast_client_notify_ep_metadata(stream, ase_rsp->code, ase_rsp->reason); break; case BT_ASCS_RELEASE_OP: /* client_ep->release_requested is set to false if handled by the @@ -1442,10 +1600,8 @@ static uint8_t unicast_client_cp_notify(struct bt_conn *conn, client_ep->release_requested = false; } - if (unicast_client_cbs->release != NULL) { - unicast_client_cbs->release(stream, ase_rsp->code, - ase_rsp->reason); - } + unicast_client_notify_ep_released(stream, ase_rsp->code, + ase_rsp->reason); } break; default: @@ -1671,52 +1827,13 @@ static int unicast_client_ep_subscribe(struct bt_conn *conn, struct bt_bap_ep *e return 0; } -static void pac_record_cb(struct bt_conn *conn, const struct bt_audio_codec_cap *codec_cap) -{ - if (unicast_client_cbs != NULL && unicast_client_cbs->pac_record != NULL) { - struct unicast_client *client = &uni_cli_insts[bt_conn_index(conn)]; - const enum bt_audio_dir dir = client->dir; - - /* TBD: Since the PAC records are optionally notifiable we may want to supply the - * index and total count of records in the callback, so that it easier for the - * upper layers to determine when a new set of PAC records is being reported. - */ - unicast_client_cbs->pac_record(conn, dir, codec_cap); - } -} - -static void endpoint_cb(struct bt_conn *conn, struct bt_bap_ep *ep) -{ - if (unicast_client_cbs != NULL && unicast_client_cbs->endpoint != NULL) { - struct unicast_client *client = &uni_cli_insts[bt_conn_index(conn)]; - const enum bt_audio_dir dir = client->dir; - - unicast_client_cbs->endpoint(conn, dir, ep); - } -} - -static void discover_cb(struct bt_conn *conn, int err) -{ - struct unicast_client *client = &uni_cli_insts[bt_conn_index(conn)]; - const enum bt_audio_dir dir = client->dir; - - /* Discover complete - Reset discovery values */ - client->dir = 0U; - reset_att_buf(client); - atomic_clear_bit(client->flags, UNICAST_CLIENT_FLAG_BUSY); - - if (unicast_client_cbs != NULL && unicast_client_cbs->discover != NULL) { - unicast_client_cbs->discover(conn, err, dir); - } -} - static void unicast_client_cp_sub_cb(struct bt_conn *conn, uint8_t err, struct bt_gatt_subscribe_params *sub_params) { LOG_DBG("conn %p err %u", conn, err); - discover_cb(conn, err); + unicast_client_discover_complete(conn, err); } static void unicast_client_ep_set_cp(struct bt_conn *conn, uint16_t handle) @@ -1761,12 +1878,12 @@ static void unicast_client_ep_set_cp(struct bt_conn *conn, uint16_t handle) if (err != 0 && err != -EALREADY) { LOG_DBG("Failed to subscribe: %d", err); - discover_cb(conn, err); + unicast_client_discover_complete(conn, err); return; } } else { /* already subscribed */ - discover_cb(conn, 0); + unicast_client_discover_complete(conn, 0); } } @@ -3463,7 +3580,7 @@ static uint8_t unicast_client_cp_discover_func(struct bt_conn *conn, if (!attr) { LOG_ERR("Unable to find ASE Control Point"); - discover_cb(conn, BT_ATT_ERR_ATTRIBUTE_NOT_FOUND); + unicast_client_discover_complete(conn, BT_ATT_ERR_ATTRIBUTE_NOT_FOUND); return BT_GATT_ITER_STOP; } @@ -3562,7 +3679,7 @@ static uint8_t unicast_client_ase_read_func(struct bt_conn *conn, uint8_t err, reset_att_buf(client); - endpoint_cb(conn, ep); + unicast_client_notify_endpoint(conn, ep); cb_err = unicast_client_ase_discover(conn, handle); if (cb_err != 0) { @@ -3573,7 +3690,7 @@ static uint8_t unicast_client_ase_read_func(struct bt_conn *conn, uint8_t err, return BT_GATT_ITER_STOP; fail: - discover_cb(conn, cb_err); + unicast_client_discover_complete(conn, cb_err); return BT_GATT_ITER_STOP; } @@ -3591,7 +3708,7 @@ static uint8_t unicast_client_ase_discover_cb(struct bt_conn *conn, if (err != 0) { LOG_ERR("Unable to discover ASE Control Point"); - discover_cb(conn, err); + unicast_client_discover_complete(conn, err); } return BT_GATT_ITER_STOP; @@ -3615,7 +3732,7 @@ static uint8_t unicast_client_ase_discover_cb(struct bt_conn *conn, if (err != 0) { LOG_DBG("Failed to read PAC records: %d", err); - discover_cb(conn, err); + unicast_client_discover_complete(conn, err); } return BT_GATT_ITER_STOP; @@ -3662,7 +3779,7 @@ static uint8_t unicast_client_pacs_avail_ctx_read_func(struct bt_conn *conn, uin err = BT_ATT_ERR_INVALID_ATTRIBUTE_LEN; } - discover_cb(conn, err); + unicast_client_discover_complete(conn, err); return BT_GATT_ITER_STOP; } @@ -3673,16 +3790,14 @@ static uint8_t unicast_client_pacs_avail_ctx_read_func(struct bt_conn *conn, uin LOG_DBG("sink context %u, source context %u", context.snk, context.src); - if (unicast_client_cbs != NULL && unicast_client_cbs->available_contexts != NULL) { - unicast_client_cbs->available_contexts(conn, context.snk, context.src); - } + unicast_client_notify_available_contexts(conn, context.snk, context.src); /* Read ASE instances */ cb_err = unicast_client_ase_discover(conn, BT_ATT_FIRST_ATTRIBUTE_HANDLE); if (cb_err != 0) { LOG_ERR("Unable to read ASE: %d", cb_err); - discover_cb(conn, cb_err); + unicast_client_discover_complete(conn, cb_err); } return BT_GATT_ITER_STOP; @@ -3703,11 +3818,6 @@ static uint8_t unicast_client_pacs_avail_ctx_notify_cb(struct bt_conn *conn, return BT_GATT_ITER_STOP; } - /* Terminate early if there's no callbacks */ - if (unicast_client_cbs == NULL || unicast_client_cbs->available_contexts == NULL) { - return BT_GATT_ITER_CONTINUE; - } - net_buf_simple_init_with_data(&buf, (void *)data, length); if (buf.len != sizeof(context)) { @@ -3721,9 +3831,7 @@ static uint8_t unicast_client_pacs_avail_ctx_notify_cb(struct bt_conn *conn, LOG_DBG("sink context %u, source context %u", context.snk, context.src); - if (unicast_client_cbs != NULL && unicast_client_cbs->available_contexts != NULL) { - unicast_client_cbs->available_contexts(conn, context.snk, context.src); - } + unicast_client_notify_available_contexts(conn, context.snk, context.src); return BT_GATT_ITER_CONTINUE; } @@ -3757,7 +3865,7 @@ static uint8_t unicast_client_pacs_avail_ctx_discover_cb(struct bt_conn *conn, * the characteristic is mandatory */ - discover_cb(conn, BT_ATT_ERR_ATTRIBUTE_NOT_FOUND); + unicast_client_discover_complete(conn, BT_ATT_ERR_ATTRIBUTE_NOT_FOUND); return BT_GATT_ITER_STOP; } @@ -3794,7 +3902,7 @@ static uint8_t unicast_client_pacs_avail_ctx_discover_cb(struct bt_conn *conn, /* If the characteristic is not subscribable we terminate the * discovery as BT_GATT_CHRC_NOTIFY is mandatory */ - discover_cb(conn, BT_ATT_ERR_NOT_SUPPORTED); + unicast_client_discover_complete(conn, BT_ATT_ERR_NOT_SUPPORTED); return BT_GATT_ITER_STOP; } @@ -3803,7 +3911,7 @@ static uint8_t unicast_client_pacs_avail_ctx_discover_cb(struct bt_conn *conn, if (err != 0) { LOG_DBG("Failed to read PACS avail_ctx: %d", err); - discover_cb(conn, err); + unicast_client_discover_complete(conn, err); } return BT_GATT_ITER_STOP; @@ -3847,7 +3955,7 @@ static uint8_t unicast_client_pacs_location_read_func(struct bt_conn *conn, uint err = BT_ATT_ERR_INVALID_ATTRIBUTE_LEN; } - discover_cb(conn, err); + unicast_client_discover_complete(conn, err); return BT_GATT_ITER_STOP; } @@ -3857,16 +3965,14 @@ static uint8_t unicast_client_pacs_location_read_func(struct bt_conn *conn, uint LOG_DBG("dir %s loc %X", bt_audio_dir_str(client->dir), location); - if (unicast_client_cbs != NULL && unicast_client_cbs->location != NULL) { - unicast_client_cbs->location(conn, client->dir, (enum bt_audio_location)location); - } + unicast_client_notify_location(conn, client->dir, (enum bt_audio_location)location); /* Read available contexts */ cb_err = unicast_client_pacs_avail_ctx_discover(conn); if (cb_err != 0) { LOG_ERR("Unable to read available contexts: %d", cb_err); - discover_cb(conn, cb_err); + unicast_client_discover_complete(conn, cb_err); } return BT_GATT_ITER_STOP; @@ -3888,11 +3994,6 @@ static uint8_t unicast_client_pacs_location_notify_cb(struct bt_conn *conn, return BT_GATT_ITER_STOP; } - /* Terminate early if there's no callbacks */ - if (unicast_client_cbs == NULL || unicast_client_cbs->location == NULL) { - return BT_GATT_ITER_CONTINUE; - } - net_buf_simple_init_with_data(&buf, (void *)data, length); if (buf.len != sizeof(location)) { @@ -3915,9 +4016,7 @@ static uint8_t unicast_client_pacs_location_notify_cb(struct bt_conn *conn, LOG_DBG("dir %s loc %X", bt_audio_dir_str(dir), location); - if (unicast_client_cbs != NULL && unicast_client_cbs->location != NULL) { - unicast_client_cbs->location(conn, dir, (enum bt_audio_location)location); - } + unicast_client_notify_location(conn, dir, (enum bt_audio_location)location); return BT_GATT_ITER_CONTINUE; } @@ -3953,7 +4052,7 @@ static uint8_t unicast_client_pacs_location_discover_cb(struct bt_conn *conn, if (err != 0) { LOG_ERR("Unable to read available contexts: %d", err); - discover_cb(conn, err); + unicast_client_discover_complete(conn, err); } return BT_GATT_ITER_STOP; @@ -3993,7 +4092,7 @@ static uint8_t unicast_client_pacs_location_discover_cb(struct bt_conn *conn, if (err != 0) { LOG_DBG("Failed to read PACS location: %d", err); - discover_cb(conn, err); + unicast_client_discover_complete(conn, err); } return BT_GATT_ITER_STOP; @@ -4046,7 +4145,7 @@ static uint8_t unicast_client_pacs_context_read_func(struct bt_conn *conn, uint8 if (cb_err != 0) { LOG_ERR("Unable to read PACS location: %d", cb_err); - discover_cb(conn, cb_err); + unicast_client_discover_complete(conn, cb_err); } return BT_GATT_ITER_STOP; @@ -4064,7 +4163,7 @@ static uint8_t unicast_client_pacs_context_discover_cb(struct bt_conn *conn, if (attr == NULL) { LOG_ERR("Unable to find %s PAC context", bt_audio_dir_str(client->dir)); - discover_cb(conn, BT_ATT_ERR_ATTRIBUTE_NOT_FOUND); + unicast_client_discover_complete(conn, BT_ATT_ERR_ATTRIBUTE_NOT_FOUND); return BT_GATT_ITER_STOP; } @@ -4087,7 +4186,7 @@ static uint8_t unicast_client_pacs_context_discover_cb(struct bt_conn *conn, if (err != 0) { LOG_DBG("Failed to read PAC records: %d", err); - discover_cb(conn, err); + unicast_client_discover_complete(conn, err); } return BT_GATT_ITER_STOP; @@ -4219,7 +4318,7 @@ static uint8_t unicast_client_read_func(struct bt_conn *conn, uint8_t err, LOG_DBG("codec 0x%02x capabilities len %u meta len %u ", codec_cap.id, codec_cap.data_len, codec_cap.meta_len); - pac_record_cb(conn, &codec_cap); + unicast_client_notify_pac_record(conn, &codec_cap); } reset_att_buf(client); @@ -4240,7 +4339,7 @@ static uint8_t unicast_client_read_func(struct bt_conn *conn, uint8_t err, return BT_GATT_ITER_STOP; fail: - discover_cb(conn, cb_err); + unicast_client_discover_complete(conn, cb_err); return BT_GATT_ITER_STOP; } @@ -4256,7 +4355,7 @@ static uint8_t unicast_client_pac_discover_cb(struct bt_conn *conn, if (attr == NULL) { LOG_DBG("Unable to find %s PAC", bt_audio_dir_str(client->dir)); - discover_cb(conn, BT_ATT_ERR_ATTRIBUTE_NOT_FOUND); + unicast_client_discover_complete(conn, BT_ATT_ERR_ATTRIBUTE_NOT_FOUND); return BT_GATT_ITER_STOP; } @@ -4282,7 +4381,7 @@ static uint8_t unicast_client_pac_discover_cb(struct bt_conn *conn, if (err != 0) { LOG_DBG("Failed to read PAC records: %d", err); - discover_cb(conn, err); + unicast_client_discover_complete(conn, err); } return BT_GATT_ITER_STOP; @@ -4351,19 +4450,18 @@ int bt_bap_unicast_client_discover(struct bt_conn *conn, enum bt_audio_dir dir) return 0; } -int bt_bap_unicast_client_register_cb(const struct bt_bap_unicast_client_cb *cbs) +int bt_bap_unicast_client_register_cb(struct bt_bap_unicast_client_cb *cb) { - CHECKIF(cbs == NULL) { - LOG_DBG("cbs is NULL"); + CHECKIF(cb == NULL) { + LOG_DBG("cb is NULL"); return -EINVAL; } - if (unicast_client_cbs != NULL) { - LOG_DBG("Callbacks already registered"); - return -EALREADY; + if (sys_slist_find(&unicast_client_cbs, &cb->_node, NULL)) { + return -EEXIST; } - unicast_client_cbs = cbs; + sys_slist_append(&unicast_client_cbs, &cb->_node); return 0; } diff --git a/tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c b/tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c index 91e07b03d435e..315732c5e0648 100644 --- a/tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c @@ -349,7 +349,7 @@ static void endpoint_cb(struct bt_conn *conn, enum bt_audio_dir dir, struct bt_b } } -static const struct bt_bap_unicast_client_cb unicast_client_cbs = { +static struct bt_bap_unicast_client_cb unicast_client_cbs = { .discover = discover_cb, .pac_record = pac_record_cb, .endpoint = endpoint_cb, From b7a4bb3ef9b7aa34e0626a14e8127cd3ff5561ae Mon Sep 17 00:00:00 2001 From: Marcio Ribeiro Date: Thu, 26 Sep 2024 17:22:55 -0300 Subject: [PATCH 0483/4482] drivers: adc: esp32: adc2 init code calibration Add call to adc2_init_code_calibration during adc initialization on esp32s2 and esp32c3 Signed-off-by: Marcio Ribeiro --- drivers/adc/adc_esp32.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/adc/adc_esp32.c b/drivers/adc/adc_esp32.c index 434e83011bd3e..740719901b3e0 100644 --- a/drivers/adc/adc_esp32.c +++ b/drivers/adc/adc_esp32.c @@ -654,6 +654,12 @@ static int adc_esp32_init(const struct device *dev) adc_hw_calibration(conf->unit); +#if CONFIG_SOC_SERIES_ESP32S2 || CONFIG_SOC_SERIES_ESP32C3 + if (conf->unit == ADC_UNIT_2) { + adc2_init_code_calibration(); + } +#endif /* CONFIG_SOC_SERIES_ESP32S2 || CONFIG_SOC_SERIES_ESP32C3 */ + #if defined(CONFIG_ADC_ESP32_DMA) if (!device_is_ready(conf->gpio_port)) { LOG_ERR("gpio0 port not ready"); From c20e43caafcc36f5326a3b952d9dd1b2c1bcc5dc Mon Sep 17 00:00:00 2001 From: Marcio Ribeiro Date: Thu, 26 Sep 2024 17:23:34 -0300 Subject: [PATCH 0484/4482] drivers: wifi: esp32: adc2 init code calibration Add call to adc2_init_code_calibration during wifi initialization on esp32s2 and esp32c3 Signed-off-by: Marcio Ribeiro --- drivers/wifi/esp32/src/esp_wifi_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/wifi/esp32/src/esp_wifi_drv.c b/drivers/wifi/esp32/src/esp_wifi_drv.c index db9de0dbdf153..861cbef6b52ef 100644 --- a/drivers/wifi/esp32/src/esp_wifi_drv.c +++ b/drivers/wifi/esp32/src/esp_wifi_drv.c @@ -27,6 +27,10 @@ LOG_MODULE_REGISTER(esp32_wifi, CONFIG_WIFI_LOG_LEVEL); #include #include "wifi/wifi_event.h" +#if CONFIG_SOC_SERIES_ESP32S2 || CONFIG_SOC_SERIES_ESP32C3 +#include +#endif /* CONFIG_SOC_SERIES_ESP32S2 || CONFIG_SOC_SERIES_ESP32C3 */ + #define DHCPV4_MASK (NET_EVENT_IPV4_DHCP_BOUND | NET_EVENT_IPV4_DHCP_STOP) /* use global iface pointer to support any ethernet driver */ @@ -862,6 +866,10 @@ static int esp32_wifi_stats(const struct device *dev, struct net_stats_wifi *sta static int esp32_wifi_dev_init(const struct device *dev) { +#if CONFIG_SOC_SERIES_ESP32S2 || CONFIG_SOC_SERIES_ESP32C3 + adc2_init_code_calibration(); +#endif /* CONFIG_SOC_SERIES_ESP32S2 || CONFIG_SOC_SERIES_ESP32C3 */ + esp_timer_init(); wifi_init_config_t config = WIFI_INIT_CONFIG_DEFAULT(); esp_err_t ret = esp_wifi_init(&config); From 339ba1a23d4c25159fa0c7a95ce396e94b71d080 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Sat, 5 Oct 2024 11:09:36 +0200 Subject: [PATCH 0485/4482] drivers: ipm: ipm_mbox: Initialize after mbox drivers This driver depends on its mboxes to be initialized, or the build will fail like this: ERROR: Device initialization priority validation failed, the sequence of \ initialization calls does not match the devicetree dependencies. ERROR: /ipm is initialized before its dependency \ /mailbox0@31f80000 (POST_KERNEL+0 < \ POST_KERNEL+2) Lift its priority to device level. Signed-off-by: Jan Kiszka --- drivers/ipm/ipm_mbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ipm/ipm_mbox.c b/drivers/ipm/ipm_mbox.c index 00925706a06b9..7d2c85b95329e 100644 --- a/drivers/ipm/ipm_mbox.c +++ b/drivers/ipm/ipm_mbox.c @@ -109,7 +109,7 @@ static const struct ipm_driver_api ipm_mbox_funcs = { &ipm_mbox_data_##n, \ &ipm_mbox_config_##n, \ POST_KERNEL, \ - 0, \ + CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &ipm_mbox_funcs); DT_INST_FOREACH_STATUS_OKAY(IPM_MBOX_DEV_DEFINE) From ec5354cd8004c187ba73c238012003cdb3ad1e28 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Sat, 5 Oct 2024 18:10:12 +0700 Subject: [PATCH 0486/4482] lib: crc: add `crc8_rohc` for CRC-8/ROHC variant calculation This commit introduces the `crc8_rohc` function to the CRC library, implementing the CRC-8/ROHC (RObust Header Compression) variant. This algorithm is widely used in networking protocols, which is commonly found in modem subsystems. Signed-off-by: Pisit Sawangvonganan --- include/zephyr/sys/crc.h | 26 ++++++++++++++++++++++---- lib/crc/crc8_sw.c | 18 ++++++++++++++++++ lib/crc/crc_shell.c | 1 + tests/unit/crc/main.c | 23 +++++++++++++++++++++++ 4 files changed, 64 insertions(+), 4 deletions(-) diff --git a/include/zephyr/sys/crc.h b/include/zephyr/sys/crc.h index c16281b10fde2..7a0c33cf9b5c5 100644 --- a/include/zephyr/sys/crc.h +++ b/include/zephyr/sys/crc.h @@ -29,6 +29,7 @@ extern "C" { * computation. */ #define CRC8_CCITT_INITIAL_VALUE 0xFF +#define CRC8_ROHC_INITIAL_VALUE 0xFF /* Initial value expected to be used at the beginning of the OpenPGP CRC-24 computation. */ #define CRC24_PGP_INITIAL_VALUE 0x00B704CEU @@ -58,9 +59,10 @@ enum crc_type { CRC4, /**< Use @ref crc4 */ CRC4_TI, /**< Use @ref crc4_ti */ CRC7_BE, /**< Use @ref crc7_be */ - CRC8, /**< Use @ref crc8 */ + CRC8, /**< Use @ref crc8 */ CRC8_CCITT, /**< Use @ref crc8_ccitt */ - CRC16, /**< Use @ref crc16 */ + CRC8_ROHC, /**< Use @ref crc8_rohc */ + CRC16, /**< Use @ref crc16 */ CRC16_ANSI, /**< Use @ref crc16_ansi */ CRC16_CCITT, /**< Use @ref crc16_ccitt */ CRC16_ITU_T, /**< Use @ref crc16_itu_t */ @@ -135,7 +137,7 @@ uint16_t crc16_reflect(uint16_t poly, uint16_t seed, const uint8_t *src, size_t * @return The computed CRC8 value */ uint8_t crc8(const uint8_t *src, size_t len, uint8_t polynomial, uint8_t initial_value, - bool reversed); + bool reversed); /** * @brief Compute the checksum of a buffer with polynomial 0x1021, reflecting @@ -274,6 +276,20 @@ uint32_t crc32_c(uint32_t crc, const uint8_t *data, */ uint8_t crc8_ccitt(uint8_t initial_value, const void *buf, size_t len); +/** + * @brief Compute ROHC variant of CRC 8 + * + * ROHC (Robust Header Compression) variant of CRC 8. + * Uses 0x07 as the polynomial with reflection. + * + * @param initial_value Initial value for the CRC computation + * @param buf Input bytes for the computation + * @param len Length of the input in bytes + * + * @return The computed CRC8 value + */ +uint8_t crc8_rohc(uint8_t initial_value, const void *buf, size_t len); + /** * @brief Compute the CRC-7 checksum of a buffer. * @@ -322,7 +338,7 @@ uint8_t crc4_ti(uint8_t seed, const uint8_t *src, size_t len); * @return The computed CRC4 value */ uint8_t crc4(const uint8_t *src, size_t len, uint8_t polynomial, uint8_t initial_value, - bool reversed); + bool reversed); /** * @brief Generate an OpenPGP CRC-24 checksum as defined in RFC 4880 section 6.1. @@ -384,6 +400,8 @@ static inline uint32_t crc_by_type(enum crc_type type, const uint8_t *src, size_ return crc8(src, len, poly, seed, reflect); case CRC8_CCITT: return crc8_ccitt(seed, src, len); + case CRC8_ROHC: + return crc8_rohc(seed, src, len); case CRC16: if (reflect) { return crc16_reflect(poly, seed, src, len); diff --git a/lib/crc/crc8_sw.c b/lib/crc/crc8_sw.c index 06bbeea516bc7..59900e14a62f1 100644 --- a/lib/crc/crc8_sw.c +++ b/lib/crc/crc8_sw.c @@ -13,6 +13,11 @@ static const uint8_t crc8_ccitt_small_table[16] = { 0x38, 0x3f, 0x36, 0x31, 0x24, 0x23, 0x2a, 0x2d }; +static const uint8_t crc8_rohc_small_table[16] = { + 0x00, 0x1c, 0x38, 0x24, 0x70, 0x6c, 0x48, 0x54, + 0xe0, 0xfc, 0xd8, 0xc4, 0x90, 0x8c, 0xa8, 0xb4 +}; + uint8_t crc8_ccitt(uint8_t val, const void *buf, size_t cnt) { size_t i; @@ -26,6 +31,19 @@ uint8_t crc8_ccitt(uint8_t val, const void *buf, size_t cnt) return val; } +uint8_t crc8_rohc(uint8_t val, const void *buf, size_t cnt) +{ + size_t i; + const uint8_t *p = buf; + + for (i = 0; i < cnt; i++) { + val ^= p[i]; + val = (val >> 4) ^ crc8_rohc_small_table[val & 0x0f]; + val = (val >> 4) ^ crc8_rohc_small_table[val & 0x0f]; + } + return val; +} + uint8_t crc8(const uint8_t *src, size_t len, uint8_t polynomial, uint8_t initial_value, bool reversed) { diff --git a/lib/crc/crc_shell.c b/lib/crc/crc_shell.c index e2647ee662324..3d08a59aa17bf 100644 --- a/lib/crc/crc_shell.c +++ b/lib/crc/crc_shell.c @@ -24,6 +24,7 @@ static const char *const crc_types[] = { [CRC7_BE] = "7_be", [CRC8] = "8", [CRC8_CCITT] = "8_ccitt", + [CRC8_ROHC] = "8_rohc", [CRC16] = "16", [CRC16_ANSI] = "16_ansi", [CRC16_CCITT] = "16_ccitt", diff --git a/tests/unit/crc/main.c b/tests/unit/crc/main.c index 2ea2d1b4ba5cf..ecb85d3483ec1 100644 --- a/tests/unit/crc/main.c +++ b/tests/unit/crc/main.c @@ -187,6 +187,29 @@ ZTEST(crc, test_crc8_ccitt) sizeof(test2)) == 0xFB, "pass", "fail"); } +ZTEST(crc, test_crc8_rohc) +{ + uint8_t test0[] = { 0 }; + uint8_t test1[] = { 'A' }; + uint8_t test2[] = { '1', '2', '3', '4', '5', '6', '7', '8', '9' }; + uint8_t test3[] = { 0x07, 0x3F }; /* GSM 07.10 example */ + uint8_t test4[] = { 0x07, 0x3F, 0x89 }; /* GSM 07.10 example */ + uint8_t test5[] = { 0x03, 0x3f, 0x01, 0x1c }; /* Our GSM 07.10 calc */ + + zassert(crc8_rohc(CRC8_ROHC_INITIAL_VALUE, test0, + sizeof(test0)) == 0xcf, "pass", "fail"); + zassert(crc8_rohc(CRC8_ROHC_INITIAL_VALUE, test1, + sizeof(test1)) == 0x2e, "pass", "fail"); + zassert(crc8_rohc(CRC8_ROHC_INITIAL_VALUE, test2, + sizeof(test2)) == 0xd0, "pass", "fail"); + zassert(crc8_rohc(CRC8_ROHC_INITIAL_VALUE, test3, + sizeof(test3)) == 0x76, "pass", "fail"); + zassert(crc8_rohc(CRC8_ROHC_INITIAL_VALUE, test4, + sizeof(test4)) == 0xcf, "pass", "fail"); + zassert(crc8_rohc(CRC8_ROHC_INITIAL_VALUE, test5, + sizeof(test5)) == 0xcf, "pass", "fail"); +} + ZTEST(crc, test_crc7_be) { uint8_t test0[] = { 0 }; From d6024c505132d3a851ba2ee89f7f7d7abf809c9d Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Sat, 5 Oct 2024 23:50:37 +0700 Subject: [PATCH 0487/4482] tests: unit: crc: use `zassert_equal` for cleaner assertions Replace `zassert` with `zassert_equal` in CRC8-CCITT and CRC8-ROHC test cases, as `zassert_equal` is more appropriate for comparing actual and expected values. Signed-off-by: Pisit Sawangvonganan --- tests/unit/crc/main.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/tests/unit/crc/main.c b/tests/unit/crc/main.c index ecb85d3483ec1..ed5483d63899f 100644 --- a/tests/unit/crc/main.c +++ b/tests/unit/crc/main.c @@ -179,12 +179,9 @@ ZTEST(crc, test_crc8_ccitt) uint8_t test1[] = { 'A' }; uint8_t test2[] = { '1', '2', '3', '4', '5', '6', '7', '8', '9' }; - zassert(crc8_ccitt(CRC8_CCITT_INITIAL_VALUE, test0, - sizeof(test0)) == 0xF3, "pass", "fail"); - zassert(crc8_ccitt(CRC8_CCITT_INITIAL_VALUE, test1, - sizeof(test1)) == 0x33, "pass", "fail"); - zassert(crc8_ccitt(CRC8_CCITT_INITIAL_VALUE, test2, - sizeof(test2)) == 0xFB, "pass", "fail"); + zassert_equal(crc8_ccitt(CRC8_CCITT_INITIAL_VALUE, test0, sizeof(test0)), 0xF3); + zassert_equal(crc8_ccitt(CRC8_CCITT_INITIAL_VALUE, test1, sizeof(test1)), 0x33); + zassert_equal(crc8_ccitt(CRC8_CCITT_INITIAL_VALUE, test2, sizeof(test2)), 0xFB); } ZTEST(crc, test_crc8_rohc) @@ -196,18 +193,12 @@ ZTEST(crc, test_crc8_rohc) uint8_t test4[] = { 0x07, 0x3F, 0x89 }; /* GSM 07.10 example */ uint8_t test5[] = { 0x03, 0x3f, 0x01, 0x1c }; /* Our GSM 07.10 calc */ - zassert(crc8_rohc(CRC8_ROHC_INITIAL_VALUE, test0, - sizeof(test0)) == 0xcf, "pass", "fail"); - zassert(crc8_rohc(CRC8_ROHC_INITIAL_VALUE, test1, - sizeof(test1)) == 0x2e, "pass", "fail"); - zassert(crc8_rohc(CRC8_ROHC_INITIAL_VALUE, test2, - sizeof(test2)) == 0xd0, "pass", "fail"); - zassert(crc8_rohc(CRC8_ROHC_INITIAL_VALUE, test3, - sizeof(test3)) == 0x76, "pass", "fail"); - zassert(crc8_rohc(CRC8_ROHC_INITIAL_VALUE, test4, - sizeof(test4)) == 0xcf, "pass", "fail"); - zassert(crc8_rohc(CRC8_ROHC_INITIAL_VALUE, test5, - sizeof(test5)) == 0xcf, "pass", "fail"); + zassert_equal(crc8_rohc(CRC8_ROHC_INITIAL_VALUE, test0, sizeof(test0)), 0xcf); + zassert_equal(crc8_rohc(CRC8_ROHC_INITIAL_VALUE, test1, sizeof(test1)), 0x2e); + zassert_equal(crc8_rohc(CRC8_ROHC_INITIAL_VALUE, test2, sizeof(test2)), 0xd0); + zassert_equal(crc8_rohc(CRC8_ROHC_INITIAL_VALUE, test3, sizeof(test3)), 0x76); + zassert_equal(crc8_rohc(CRC8_ROHC_INITIAL_VALUE, test4, sizeof(test4)), 0xcf); + zassert_equal(crc8_rohc(CRC8_ROHC_INITIAL_VALUE, test5, sizeof(test5)), 0xcf); } ZTEST(crc, test_crc7_be) From ea2d785a289df3c7c82cfb1346b07f8296cabf30 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Sat, 5 Oct 2024 18:43:34 +0700 Subject: [PATCH 0488/4482] modem: cmux: replace `crc8` with `crc8_rohc` for FCS calculation To improve performance in FCS calculation, this commit replaces the usage of the generic `crc8` function with the specific `crc8_rohc` function in `modem_cmux.c`. The `crc8_rohc` function utilizes a small table approach, enhancing the efficiency of CRC-8/ROHC variant calculations while optimizing memory usage. Signed-off-by: Pisit Sawangvonganan --- subsys/modem/modem_cmux.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 583090700e505..4a755284bff02 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -295,14 +295,13 @@ static uint16_t modem_cmux_transmit_frame(struct modem_cmux *cmux, } /* Compute FCS for the header (exclude SOF) */ - fcs = crc8(&buf[1], (buf_idx - 1), MODEM_CMUX_FCS_POLYNOMIAL, MODEM_CMUX_FCS_INIT_VALUE, - true); + fcs = crc8_rohc(MODEM_CMUX_FCS_INIT_VALUE, &buf[1], (buf_idx - 1)); /* FCS final */ if (frame->type == MODEM_CMUX_FRAME_TYPE_UIH) { fcs = 0xFF - fcs; } else { - fcs = 0xFF - crc8(frame->data, data_len, MODEM_CMUX_FCS_POLYNOMIAL, fcs, true); + fcs = 0xFF - crc8_rohc(fcs, frame->data, data_len); } /* Frame header */ @@ -845,16 +844,12 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by } /* Compute FCS */ + fcs = crc8_rohc(MODEM_CMUX_FCS_INIT_VALUE, cmux->frame_header, + cmux->frame_header_len); if (cmux->frame.type == MODEM_CMUX_FRAME_TYPE_UIH) { - fcs = 0xFF - crc8(cmux->frame_header, cmux->frame_header_len, - MODEM_CMUX_FCS_POLYNOMIAL, MODEM_CMUX_FCS_INIT_VALUE, - true); + fcs = 0xFF - fcs; } else { - fcs = crc8(cmux->frame_header, cmux->frame_header_len, - MODEM_CMUX_FCS_POLYNOMIAL, MODEM_CMUX_FCS_INIT_VALUE, true); - - fcs = 0xFF - crc8(cmux->frame.data, cmux->frame.data_len, - MODEM_CMUX_FCS_POLYNOMIAL, fcs, true); + fcs = 0xFF - crc8_rohc(fcs, cmux->frame.data, cmux->frame.data_len); } /* Validate FCS */ From 0a56dc80554fa1efd20449261d691a7c5bb71b31 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Sat, 5 Oct 2024 12:53:45 -0300 Subject: [PATCH 0489/4482] boards: esp32-based: unset default libc in appcpu As in all other esp32-based boards, APPCPU does not require to have MINIMAL_LIBC as default libc. In the past, that was required due to memory constraints, which is not the case anymore. This fixes build issues in `tests/lib/c_lib/common`. Signed-off-by: Sylvio Alves --- boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_appcpu_defconfig | 1 - .../esp32s3_touch_lcd_1_28_esp32s3_appcpu_defconfig | 1 - 2 files changed, 2 deletions(-) diff --git a/boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_appcpu_defconfig b/boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_appcpu_defconfig index 100bb88256761..9abf2ff0430ab 100644 --- a/boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_appcpu_defconfig +++ b/boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_appcpu_defconfig @@ -2,4 +2,3 @@ CONFIG_MAIN_STACK_SIZE=2048 CONFIG_CLOCK_CONTROL=y -CONFIG_MINIMAL_LIBC=y diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_appcpu_defconfig b/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_appcpu_defconfig index a2196414381a2..15e93d6bf4ad9 100644 --- a/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_appcpu_defconfig +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_appcpu_defconfig @@ -3,4 +3,3 @@ CONFIG_MAIN_STACK_SIZE=2048 CONFIG_CLOCK_CONTROL=y -CONFIG_MINIMAL_LIBC=y From 1726443d9d2584bc6adb7fd08d63a5fc645ce09a Mon Sep 17 00:00:00 2001 From: Han Wu Date: Sat, 5 Oct 2024 23:13:56 +0100 Subject: [PATCH 0490/4482] drivers: sensor: mpu9250: fix mismatched value in log message The print message prints cfg->accel_fs when cfg->gyro_fs is too big. Signed-off-by: Han Wu --- drivers/sensor/tdk/mpu9250/mpu9250.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/sensor/tdk/mpu9250/mpu9250.c b/drivers/sensor/tdk/mpu9250/mpu9250.c index d41623f08db3e..8d4571055f474 100644 --- a/drivers/sensor/tdk/mpu9250/mpu9250.c +++ b/drivers/sensor/tdk/mpu9250/mpu9250.c @@ -280,7 +280,7 @@ static int mpu9250_init(const struct device *dev) drv_data->accel_sensitivity_shift = 14 - cfg->accel_fs; if (cfg->gyro_fs > MPU9250_GYRO_FS_MAX) { - LOG_ERR("Gyro FS is too big: %d", cfg->accel_fs); + LOG_ERR("Gyro FS is too big: %d", cfg->gyro_fs); return -EINVAL; } From b29f9f21bc0bb97dfe32a80868720bec8b1113cf Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 9 Oct 2024 11:42:00 +0200 Subject: [PATCH 0491/4482] Revert "coredump: ARM: Ensure sp in dump is set as gdb expects" This reverts commit ec7943bb181753c9b7dc339090a2e7f4b9d7f06e. This commit introduced a regression. Let's revert it so we do not block development in main. For more information see: https://github.com/zephyrproject-rtos/zephyr/issues/79594 Signed-off-by: Alberto Escolar Piedras --- arch/arm/core/cortex_a_r/swap_helper.S | 6 +- arch/arm/core/cortex_a_r/switch.S | 6 +- arch/arm/core/cortex_m/fault.c | 52 +++++++++++++++- arch/arm/core/cortex_m/swap_helper.S | 1 - arch/arm/core/fatal.c | 5 +- arch/arm/include/cortex_a_r/exception.h | 9 --- arch/arm/include/cortex_m/exception.h | 82 ------------------------- 7 files changed, 56 insertions(+), 105 deletions(-) diff --git a/arch/arm/core/cortex_a_r/swap_helper.S b/arch/arm/core/cortex_a_r/swap_helper.S index f85e97d05e25c..548bb446aa319 100644 --- a/arch/arm/core/cortex_a_r/swap_helper.S +++ b/arch/arm/core/cortex_a_r/swap_helper.S @@ -336,14 +336,12 @@ _context_switch: _oops: /* - * Pass the exception frame to z_do_kernel_oops. + * Pass the exception frame to z_do_kernel_oops. r0 contains the + * exception reason. */ cps #MODE_SYS mov r0, sp cps #MODE_SVC - /* Zero callee_regs and exc_return (only used on Cortex-M) */ - mov r1, #0 - mov r2, #0 bl z_do_kernel_oops b z_arm_int_exit diff --git a/arch/arm/core/cortex_a_r/switch.S b/arch/arm/core/cortex_a_r/switch.S index 4d5a6a627b1cc..800d46bbf94dd 100644 --- a/arch/arm/core/cortex_a_r/switch.S +++ b/arch/arm/core/cortex_a_r/switch.S @@ -150,12 +150,10 @@ offload: _oops: /* - * Pass the exception frame to z_do_kernel_oops. + * Pass the exception frame to z_do_kernel_oops. r0 contains the + * exception reason. */ mov r0, sp - /* Zero callee_regs and exc_return (only used on Cortex-M) */ - mov r1, #0 - mov r2, #0 bl z_do_kernel_oops inv: diff --git a/arch/arm/core/cortex_m/fault.c b/arch/arm/core/cortex_m/fault.c index 604801a6414d9..4e604ba8033c1 100644 --- a/arch/arm/core/cortex_m/fault.c +++ b/arch/arm/core/cortex_m/fault.c @@ -40,6 +40,54 @@ LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); #define EACD(edr) (((edr) & SYSMPU_EDR_EACD_MASK) >> SYSMPU_EDR_EACD_SHIFT) #endif +/* Exception Return (EXC_RETURN) is provided in LR upon exception entry. + * It is used to perform an exception return and to detect possible state + * transition upon exception. + */ + +/* Prefix. Indicates that this is an EXC_RETURN value. + * This field reads as 0b11111111. + */ +#define EXC_RETURN_INDICATOR_PREFIX (0xFF << 24) +/* bit[0]: Exception Secure. The security domain the exception was taken to. */ +#define EXC_RETURN_EXCEPTION_SECURE_Pos 0 +#define EXC_RETURN_EXCEPTION_SECURE_Msk \ + BIT(EXC_RETURN_EXCEPTION_SECURE_Pos) +#define EXC_RETURN_EXCEPTION_SECURE_Non_Secure 0 +#define EXC_RETURN_EXCEPTION_SECURE_Secure EXC_RETURN_EXCEPTION_SECURE_Msk +/* bit[2]: Stack Pointer selection. */ +#define EXC_RETURN_SPSEL_Pos 2 +#define EXC_RETURN_SPSEL_Msk BIT(EXC_RETURN_SPSEL_Pos) +#define EXC_RETURN_SPSEL_MAIN 0 +#define EXC_RETURN_SPSEL_PROCESS EXC_RETURN_SPSEL_Msk +/* bit[3]: Mode. Indicates the Mode that was stacked from. */ +#define EXC_RETURN_MODE_Pos 3 +#define EXC_RETURN_MODE_Msk BIT(EXC_RETURN_MODE_Pos) +#define EXC_RETURN_MODE_HANDLER 0 +#define EXC_RETURN_MODE_THREAD EXC_RETURN_MODE_Msk +/* bit[4]: Stack frame type. Indicates whether the stack frame is a standard + * integer only stack frame or an extended floating-point stack frame. + */ +#define EXC_RETURN_STACK_FRAME_TYPE_Pos 4 +#define EXC_RETURN_STACK_FRAME_TYPE_Msk BIT(EXC_RETURN_STACK_FRAME_TYPE_Pos) +#define EXC_RETURN_STACK_FRAME_TYPE_EXTENDED 0 +#define EXC_RETURN_STACK_FRAME_TYPE_STANDARD EXC_RETURN_STACK_FRAME_TYPE_Msk +/* bit[5]: Default callee register stacking. Indicates whether the default + * stacking rules apply, or whether the callee registers are already on the + * stack. + */ +#define EXC_RETURN_CALLEE_STACK_Pos 5 +#define EXC_RETURN_CALLEE_STACK_Msk BIT(EXC_RETURN_CALLEE_STACK_Pos) +#define EXC_RETURN_CALLEE_STACK_SKIPPED 0 +#define EXC_RETURN_CALLEE_STACK_DEFAULT EXC_RETURN_CALLEE_STACK_Msk +/* bit[6]: Secure or Non-secure stack. Indicates whether a Secure or + * Non-secure stack is used to restore stack frame on exception return. + */ +#define EXC_RETURN_RETURN_STACK_Pos 6 +#define EXC_RETURN_RETURN_STACK_Msk BIT(EXC_RETURN_RETURN_STACK_Pos) +#define EXC_RETURN_RETURN_STACK_Non_Secure 0 +#define EXC_RETURN_RETURN_STACK_Secure EXC_RETURN_RETURN_STACK_Msk + /* Integrity signature for an ARMv8-M implementation */ #if defined(CONFIG_ARMV7_M_ARMV8_M_FP) #define INTEGRITY_SIGNATURE_STD 0xFEFA125BUL @@ -1064,7 +1112,9 @@ void z_arm_fault(uint32_t msp, uint32_t psp, uint32_t exc_return, __ASSERT(esf != NULL, "ESF could not be retrieved successfully. Shall never occur."); - z_arm_set_fault_sp(esf, exc_return); +#ifdef CONFIG_DEBUG_COREDUMP + z_arm_coredump_fault_sp = POINTER_TO_UINT(esf); +#endif reason = fault_handle(esf, fault, &recoverable); if (recoverable) { diff --git a/arch/arm/core/cortex_m/swap_helper.S b/arch/arm/core/cortex_m/swap_helper.S index e1c6414fea82b..c2cb3ef7f2fea 100644 --- a/arch/arm/core/cortex_m/swap_helper.S +++ b/arch/arm/core/cortex_m/swap_helper.S @@ -315,7 +315,6 @@ _oops: mov r1, sp /* pointer to _callee_saved_t */ #endif /* CONFIG_ARMV7_M_ARMV8_M_MAINLINE */ #endif /* CONFIG_EXTRA_EXCEPTION_INFO */ - mov r2, lr /* EXC_RETURN */ bl z_do_kernel_oops /* return from SVC exception is done here */ #if defined(CONFIG_EXTRA_EXCEPTION_INFO) diff --git a/arch/arm/core/fatal.c b/arch/arm/core/fatal.c index d64855b6b8e3e..4532e238f05c9 100644 --- a/arch/arm/core/fatal.c +++ b/arch/arm/core/fatal.c @@ -101,9 +101,8 @@ void z_arm_fatal_error(unsigned int reason, const struct arch_esf *esf) * * @param esf exception frame * @param callee_regs Callee-saved registers (R4-R11) - * @param exc_return EXC_RETURN value present in LR after exception entry. */ -void z_do_kernel_oops(const struct arch_esf *esf, _callee_saved_t *callee_regs, uint32_t exc_return) +void z_do_kernel_oops(const struct arch_esf *esf, _callee_saved_t *callee_regs) { #if !(defined(CONFIG_EXTRA_EXCEPTION_INFO) && defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)) ARG_UNUSED(callee_regs); @@ -111,8 +110,6 @@ void z_do_kernel_oops(const struct arch_esf *esf, _callee_saved_t *callee_regs, /* Stacked R0 holds the exception reason. */ unsigned int reason = esf->basic.r0; - z_arm_set_fault_sp(esf, exc_return); - #if defined(CONFIG_USERSPACE) if (z_arm_preempted_thread_in_user_mode(esf)) { /* diff --git a/arch/arm/include/cortex_a_r/exception.h b/arch/arm/include/cortex_a_r/exception.h index 4326444f112ec..6daa9c106ee2b 100644 --- a/arch/arm/include/cortex_a_r/exception.h +++ b/arch/arm/include/cortex_a_r/exception.h @@ -43,15 +43,6 @@ static ALWAYS_INLINE bool arch_is_in_nested_exception(const struct arch_esf *esf return (arch_curr_cpu()->arch.exc_depth > 1U) ? (true) : (false); } -/** - * @brief No current implementation where core dump is not supported - * - * @param esf exception frame - * @param exc_return EXC_RETURN value present in LR after exception entry. - */ -static ALWAYS_INLINE void z_arm_set_fault_sp(const struct arch_esf *esf, uint32_t exc_return) -{} - #if defined(CONFIG_USERSPACE) /* * This function is used by privileged code to determine if the thread diff --git a/arch/arm/include/cortex_m/exception.h b/arch/arm/include/cortex_m/exception.h index 5348638c843fe..89bdd4b83e9a2 100644 --- a/arch/arm/include/cortex_m/exception.h +++ b/arch/arm/include/cortex_m/exception.h @@ -39,54 +39,6 @@ extern volatile irq_offload_routine_t offload_routine; */ #define AIRCR_VECT_KEY_PERMIT_WRITE 0x05FAUL -/* Exception Return (EXC_RETURN) is provided in LR upon exception entry. - * It is used to perform an exception return and to detect possible state - * transition upon exception. - */ - -/* Prefix. Indicates that this is an EXC_RETURN value. - * This field reads as 0b11111111. - */ -#define EXC_RETURN_INDICATOR_PREFIX (0xFF << 24) -/* bit[0]: Exception Secure. The security domain the exception was taken to. */ -#define EXC_RETURN_EXCEPTION_SECURE_Pos 0 -#define EXC_RETURN_EXCEPTION_SECURE_Msk \ - BIT(EXC_RETURN_EXCEPTION_SECURE_Pos) -#define EXC_RETURN_EXCEPTION_SECURE_Non_Secure 0 -#define EXC_RETURN_EXCEPTION_SECURE_Secure EXC_RETURN_EXCEPTION_SECURE_Msk -/* bit[2]: Stack Pointer selection. */ -#define EXC_RETURN_SPSEL_Pos 2 -#define EXC_RETURN_SPSEL_Msk BIT(EXC_RETURN_SPSEL_Pos) -#define EXC_RETURN_SPSEL_MAIN 0 -#define EXC_RETURN_SPSEL_PROCESS EXC_RETURN_SPSEL_Msk -/* bit[3]: Mode. Indicates the Mode that was stacked from. */ -#define EXC_RETURN_MODE_Pos 3 -#define EXC_RETURN_MODE_Msk BIT(EXC_RETURN_MODE_Pos) -#define EXC_RETURN_MODE_HANDLER 0 -#define EXC_RETURN_MODE_THREAD EXC_RETURN_MODE_Msk -/* bit[4]: Stack frame type. Indicates whether the stack frame is a standard - * integer only stack frame or an extended floating-point stack frame. - */ -#define EXC_RETURN_STACK_FRAME_TYPE_Pos 4 -#define EXC_RETURN_STACK_FRAME_TYPE_Msk BIT(EXC_RETURN_STACK_FRAME_TYPE_Pos) -#define EXC_RETURN_STACK_FRAME_TYPE_EXTENDED 0 -#define EXC_RETURN_STACK_FRAME_TYPE_STANDARD EXC_RETURN_STACK_FRAME_TYPE_Msk -/* bit[5]: Default callee register stacking. Indicates whether the default - * stacking rules apply, or whether the callee registers are already on the - * stack. - */ -#define EXC_RETURN_CALLEE_STACK_Pos 5 -#define EXC_RETURN_CALLEE_STACK_Msk BIT(EXC_RETURN_CALLEE_STACK_Pos) -#define EXC_RETURN_CALLEE_STACK_SKIPPED 0 -#define EXC_RETURN_CALLEE_STACK_DEFAULT EXC_RETURN_CALLEE_STACK_Msk -/* bit[6]: Secure or Non-secure stack. Indicates whether a Secure or - * Non-secure stack is used to restore stack frame on exception return. - */ -#define EXC_RETURN_RETURN_STACK_Pos 6 -#define EXC_RETURN_RETURN_STACK_Msk BIT(EXC_RETURN_RETURN_STACK_Pos) -#define EXC_RETURN_RETURN_STACK_Non_Secure 0 -#define EXC_RETURN_RETURN_STACK_Secure EXC_RETURN_RETURN_STACK_Msk - /* * The current executing vector is found in the IPSR register. All * IRQs and system exceptions are considered as interrupt context. @@ -232,40 +184,6 @@ static ALWAYS_INLINE void z_arm_clear_faults(void) #endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */ } -/** - * @brief Set z_arm_coredump_fault_sp to stack pointer value expected by GDB - * - * @param esf exception frame - * @param exc_return EXC_RETURN value present in LR after exception entry. - */ -static ALWAYS_INLINE void z_arm_set_fault_sp(const struct arch_esf *esf, uint32_t exc_return) -{ -#ifdef CONFIG_DEBUG_COREDUMP - z_arm_coredump_fault_sp = POINTER_TO_UINT(esf); -#if defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE) || defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE) - /* Gdb expects a stack pointer that does not include the exception stack frame in order to - * unwind. So adjust the stack pointer accordingly. - */ - z_arm_coredump_fault_sp += sizeof(esf->basic); - -#if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING) - /* Assess whether thread had been using the FP registers and add size of additional - * registers if necessary - */ - if ((exc_return & EXC_RETURN_STACK_FRAME_TYPE_STANDARD) == - EXC_RETURN_STACK_FRAME_TYPE_EXTENDED) { - z_arm_coredump_fault_sp += sizeof(esf->fpu); - } -#endif /* CONFIG_FPU && CONFIG_FPU_SHARING */ - - if ((esf->basic.xpsr & SCB_CCR_STKALIGN_Msk) == SCB_CCR_STKALIGN_Msk) { - /* Adjust stack alignment after PSR bit[9] detected */ - z_arm_coredump_fault_sp |= 0x4; - } -#endif /* CONFIG_ARMV7_M_ARMV8_M_MAINLINE || CONFIG_ARMV6_M_ARMV8_M_BASELINE */ -#endif /* CONFIG_DEBUG_COREDUMP */ -} - /** * @brief Assess whether a debug monitor event should be treated as an error * From 1adb779ba5907e430da01b3a2a4973d9541b33fb Mon Sep 17 00:00:00 2001 From: Bas van Loon Date: Wed, 10 Apr 2024 17:27:16 +0200 Subject: [PATCH 0492/4482] drivers: adc: stm32: Implement boost settings for STM32H7. After boost is implemented and enabled it allows for higher sampling frequencies. Signed-off-by: Bas van Loon --- drivers/adc/adc_stm32.c | 139 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 129 insertions(+), 10 deletions(-) diff --git a/drivers/adc/adc_stm32.c b/drivers/adc/adc_stm32.c index 58e49351629e0..6d0765c43f00a 100644 --- a/drivers/adc/adc_stm32.c +++ b/drivers/adc/adc_stm32.c @@ -49,6 +49,7 @@ LOG_MODULE_REGISTER(adc_stm32); #if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H7RSX) #include +#include #endif #ifdef CONFIG_NOCACHE_MEMORY @@ -1353,6 +1354,125 @@ static int adc_stm32_channel_setup(const struct device *dev, return 0; } +#if defined(CONFIG_SOC_SERIES_STM32C0X) || \ + defined(CONFIG_SOC_SERIES_STM32G0X) || \ + defined(CONFIG_SOC_SERIES_STM32L0X) || \ + defined(CONFIG_SOC_SERIES_STM32U0X) || \ + (defined(CONFIG_SOC_SERIES_STM32WBX) && defined(ADC_SUPPORT_2_5_MSPS)) || \ + defined(CONFIG_SOC_SERIES_STM32WLX) +#define ADC_STM32_HAS_INDIVIDUAL_CLOCKS +#endif + +#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(ADC_STM32_HAS_INDIVIDUAL_CLOCKS) +static bool adc_stm32_is_clk_sync(const struct adc_stm32_cfg *config) +{ + if (config->clk_prescaler == LL_ADC_CLOCK_SYNC_PCLK_DIV1 || + config->clk_prescaler == LL_ADC_CLOCK_SYNC_PCLK_DIV2 || + config->clk_prescaler == LL_ADC_CLOCK_SYNC_PCLK_DIV4) { + return true; + } + + return false; +} +#endif + +#if defined(CONFIG_SOC_SERIES_STM32H7X) +static inline int adc_stm32_get_input_freq_prescaler(void) +{ + int presc = 2; + +#ifdef ADC_VER_V5_X + /* For revision Y we have no prescaler of 2 */ + if (LL_DBGMCU_GetRevisionID() <= 0x1003) { + presc = 1; + } +#endif + + return presc; +} + +static int adc_stm32_get_clock_prescaler(const struct adc_stm32_cfg *config) +{ + switch (config->clk_prescaler) { + case LL_ADC_CLOCK_SYNC_PCLK_DIV1: + case LL_ADC_CLOCK_ASYNC_DIV1: + return 1; + case LL_ADC_CLOCK_SYNC_PCLK_DIV2: + case LL_ADC_CLOCK_ASYNC_DIV2: + return 2; + case LL_ADC_CLOCK_SYNC_PCLK_DIV4: + case LL_ADC_CLOCK_ASYNC_DIV4: + return 4; + case LL_ADC_CLOCK_ASYNC_DIV6: + return 6; + case LL_ADC_CLOCK_ASYNC_DIV8: + return 8; + case LL_ADC_CLOCK_ASYNC_DIV10: + return 10; + case LL_ADC_CLOCK_ASYNC_DIV12: + return 12; + case LL_ADC_CLOCK_ASYNC_DIV16: + return 16; + case LL_ADC_CLOCK_ASYNC_DIV32: + return 32; + case LL_ADC_CLOCK_ASYNC_DIV64: + return 64; + case LL_ADC_CLOCK_ASYNC_DIV128: + return 128; + case LL_ADC_CLOCK_ASYNC_DIV256: + return 256; + default: + return -EINVAL; + } +} + +static int adc_stm32h7_setup_boost(const struct adc_stm32_cfg *config, ADC_TypeDef *adc, + const struct device *clk) +{ + clock_control_subsys_t clk_src; + uint32_t input_freq; + uint32_t boost; + int presc; + + /* Get the input frequency */ + clk_src = (clock_control_subsys_t)(adc_stm32_is_clk_sync(config) ? &config->pclken[0] + : &config->pclken[1]); + + if (clock_control_get_rate(clk, clk_src, &input_freq) != 0) { + LOG_ERR("Failed to get ADC clock frequency"); + return -EIO; + } + + /* Adjust the pre-scaler value so that we can divide down the clock */ + presc = adc_stm32_get_clock_prescaler(config); + if (presc < 0) { + LOG_ERR("Invalid clock prescaler value"); + return presc; + } + + input_freq /= presc * adc_stm32_get_input_freq_prescaler(); + + if (input_freq <= KHZ(6250)) { + boost = LL_ADC_BOOST_MODE_6MHZ25; + } else if (input_freq <= KHZ(12500)) { + boost = LL_ADC_BOOST_MODE_12MHZ5; + } else if (input_freq <= MHZ(20)) { + boost = LL_ADC_BOOST_MODE_20MHZ; + } else if (input_freq <= MHZ(25)) { + boost = LL_ADC_BOOST_MODE_25MHZ; + } else if (input_freq <= MHZ(50)) { + boost = LL_ADC_BOOST_MODE_50MHZ; + } else { + LOG_WRN("ADC clock frequency too high %u", input_freq); + return -ERANGE; + } + + LL_ADC_SetBoostMode(adc, boost); + + return 0; +} +#endif + /* This symbol takes the value 1 if one of the device instances */ /* is configured in dts with a domain clock */ #if STM32_DT_INST_DEV_DOMAIN_CLOCK_SUPPORT @@ -1366,6 +1486,7 @@ static int adc_stm32_set_clock(const struct device *dev) const struct adc_stm32_cfg *config = dev->config; const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE); ADC_TypeDef *adc = (ADC_TypeDef *)config->base; + int ret = 0; ARG_UNUSED(adc); /* Necessary to avoid warnings on some series */ @@ -1385,15 +1506,8 @@ static int adc_stm32_set_clock(const struct device *dev) #if defined(CONFIG_SOC_SERIES_STM32F0X) LL_ADC_SetClock(adc, config->clk_prescaler); -#elif defined(CONFIG_SOC_SERIES_STM32C0X) || \ - defined(CONFIG_SOC_SERIES_STM32G0X) || \ - defined(CONFIG_SOC_SERIES_STM32L0X) || \ - defined(CONFIG_SOC_SERIES_STM32U0X) || \ - (defined(CONFIG_SOC_SERIES_STM32WBX) && defined(ADC_SUPPORT_2_5_MSPS)) || \ - defined(CONFIG_SOC_SERIES_STM32WLX) - if ((config->clk_prescaler == LL_ADC_CLOCK_SYNC_PCLK_DIV1) || - (config->clk_prescaler == LL_ADC_CLOCK_SYNC_PCLK_DIV2) || - (config->clk_prescaler == LL_ADC_CLOCK_SYNC_PCLK_DIV4)) { +#elif defined(ADC_STM32_HAS_INDIVIDUAL_CLOCKS) + if (adc_stm32_is_clk_sync(config)) { LL_ADC_SetClock(adc, config->clk_prescaler); } else { LL_ADC_SetCommonClock(__LL_ADC_COMMON_INSTANCE(adc), @@ -1403,9 +1517,14 @@ static int adc_stm32_set_clock(const struct device *dev) #elif !DT_HAS_COMPAT_STATUS_OKAY(st_stm32f1_adc) LL_ADC_SetCommonClock(__LL_ADC_COMMON_INSTANCE(adc), config->clk_prescaler); + +#ifdef CONFIG_SOC_SERIES_STM32H7X + /* Set boost according to input frequency */ + ret = adc_stm32h7_setup_boost(config, adc, clk); +#endif #endif - return 0; + return ret; } static int adc_stm32_init(const struct device *dev) From ddf753cdaca2c06b0b69a26076564838c38cdc1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 25 Sep 2024 16:11:14 +0200 Subject: [PATCH 0493/4482] debug: mipi_stp_decoder: Avoid potential 64bit unaligned access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Decoder was casting uint8_t pointers to uint64_t pointers which could result in double word instruction which does not support unaligned access on Cortex-M. Issue was revealed when -O3 optimization was used instead of -Os. In size optimized version, compiler was using word load and store instructions which support unaligned access and issue was not visible. Signed-off-by: Krzysztof Chruściński --- subsys/debug/mipi_stp_decoder.c | 35 +++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/subsys/debug/mipi_stp_decoder.c b/subsys/debug/mipi_stp_decoder.c index ce2478350e485..89ae7a8e0aaea 100644 --- a/subsys/debug/mipi_stp_decoder.c +++ b/subsys/debug/mipi_stp_decoder.c @@ -461,36 +461,41 @@ static inline void get_nibbles64(const uint8_t *src, size_t src_noff, uint8_t *d { bool src_ba = (src_noff & 0x1UL) == 0; bool dst_ba = (dst_noff & 0x1UL) == 0; - uint64_t *src64 = (uint64_t *)&src[src_noff / 2]; - uint64_t *dst64 = (uint64_t *)&dst[dst_noff / 2]; + uint32_t *src32 = (uint32_t *)&src[src_noff / 2]; + uint32_t *dst32 = (uint32_t *)&dst[dst_noff / 2]; if (nlen == 16) { /* dst must be aligned. */ if (src_ba) { - uint32_t *s32 = (uint32_t *)src64; - uint32_t *d32 = (uint32_t *)dst64; - - d32[0] = s32[0]; - d32[1] = s32[1]; + dst32[0] = src32[0]; + dst32[1] = src32[1]; } else { - uint64_t part_a = src64[0] >> 4; - uint64_t part_b = src64[1] << 60; - - dst64[0] = part_a | part_b; + uint64_t src0 = src32[0] | ((uint64_t)src32[1] << 32); + uint64_t src1 = src32[2] | ((uint64_t)src32[3] << 32); + uint64_t part_a = src0 >> 4; + uint64_t part_b = src1 << 60; + uint64_t out = part_a | part_b; + + dst32[0] = (uint32_t)out; + dst32[1] = (uint32_t)(out >> 32); } return; } + uint64_t src0 = src32[0] | ((uint64_t)src32[1] << 32); uint64_t mask = BIT64_MASK(nlen * 4) << (src_ba ? 0 : 4); - uint64_t src_d = src64[0] & mask; + uint64_t src_d = src0 & mask; if (((src_noff ^ dst_noff) & 0x1UL) == 0) { - dst64[0] |= src_d; + /* nothing */ } else if (dst_ba) { - dst64[0] |= (src_d >> 4); + src_d >>= 4; } else { - dst64[0] |= (src_d << 4); + src_d <<= 4; } + + dst32[0] |= (uint32_t)src_d; + dst32[1] |= (uint32_t)(src_d >> 32); } /* Function performs getting nibbles in less efficient way but does not use unaligned From e40eef2d58d4355b0b9978228240d712de6d956c Mon Sep 17 00:00:00 2001 From: Fengming Ye Date: Fri, 27 Sep 2024 12:07:12 +0900 Subject: [PATCH 0494/4482] hostap: add crypto module test kconfig option Add crypto module test kconfig option CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_TEST, which is default n and hidden. It is only available by developer for crypto module test. Signed-off-by: Fengming Ye --- modules/hostap/CMakeLists.txt | 7 +++++++ modules/hostap/Kconfig | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/modules/hostap/CMakeLists.txt b/modules/hostap/CMakeLists.txt index 1f30ee3441618..6b6875d9a8fc6 100644 --- a/modules/hostap/CMakeLists.txt +++ b/modules/hostap/CMakeLists.txt @@ -503,6 +503,13 @@ zephyr_library_sources_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE ${HOSTAP_SRC_BASE}/crypto/fips_prf_internal.c ${HOSTAP_SRC_BASE}/crypto/milenage.c ) + +zephyr_library_sources_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_TEST + ${HOSTAP_SRC_BASE}/crypto/crypto_module_tests.c + ${HOSTAP_SRC_BASE}/crypto/fips_prf_internal.c + ${HOSTAP_SRC_BASE}/crypto/sha1-internal.c + ${HOSTAP_SRC_BASE}/crypto/sha1-tlsprf.c +) endif() zephyr_library_link_libraries_ifndef(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index c49cee4697302..4350b054e1329 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -485,4 +485,8 @@ config SAE_PWE_EARLY_EXIT this can be intensive, so, add an option to exit early. Note that this is highly insecure and shouldn't be used in production +config WIFI_NM_WPA_SUPPLICANT_CRYPTO_TEST + bool + depends on WIFI_NM_WPA_SUPPLICANT_CRYPTO_MBEDTLS_PSA + endif # WIFI_NM_WPA_SUPPLICANT From 20e81f7c85bb6e298735325cc74e160db8f95baa Mon Sep 17 00:00:00 2001 From: Fengming Ye Date: Fri, 27 Sep 2024 12:10:04 +0900 Subject: [PATCH 0495/4482] west.yml: update hostap revision Update hostap revision to get crypto module test. Signed-off-by: Fengming Ye --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index b019f5d53c3be..9ae55374a0c84 100644 --- a/west.yml +++ b/west.yml @@ -259,7 +259,7 @@ manifest: - hal - name: hostap path: modules/lib/hostap - revision: f6792cb45d848df5d562dd9255dfc6acf62be164 + revision: d84b1ea174407f9a501976fb294e39c40c348645 - name: libmetal revision: a6851ba6dba8c9e87d00c42f171a822f7a29639b path: modules/hal/libmetal From 9451424677af0c1fe1c731dd5c6d2e8675c7e2f4 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Tue, 8 Oct 2024 12:44:10 +0200 Subject: [PATCH 0496/4482] ci: bsim tests: Also trigger on MbedTLS module changes Trigger bsim tests also on changes to the MbedTLS module code in Zephyr side. To avoid possible regressions in bsim tests when this code is changed getting into main. Signed-off-by: Alberto Escolar Piedras --- .github/workflows/bsim-tests.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/bsim-tests.yaml b/.github/workflows/bsim-tests.yaml index c879623d13d73..2654e8d4e442f 100644 --- a/.github/workflows/bsim-tests.yaml +++ b/.github/workflows/bsim-tests.yaml @@ -18,6 +18,7 @@ on: - "include/zephyr/arch/posix/**" - "scripts/native_simulator/**" - "samples/net/sockets/echo_*/**" + - "modules/mbedtls/**" - "modules/openthread/**" - "subsys/net/l2/openthread/**" - "include/zephyr/net/openthread.h" @@ -103,6 +104,7 @@ jobs: tests/bsim/* boards/nordic/nrf5*/*dt* dts/*/nordic/ + modules/mbedtls/** - name: Check if Bluethooth files changed uses: tj-actions/changed-files@v45 From 2a1fde7aa3f540bb6bd5e1b14e54dd9fb7a185b8 Mon Sep 17 00:00:00 2001 From: Joel Jaldemark Date: Wed, 9 Oct 2024 07:25:59 +0200 Subject: [PATCH 0497/4482] drivers: input: ili2132a: add support for ili2132a touch controller This commit adds basic ili2132a touch controller driver. Signed-off-by: Joel Jaldemark --- drivers/input/CMakeLists.txt | 1 + drivers/input/Kconfig | 1 + drivers/input/Kconfig.ili2132a | 10 ++ drivers/input/input_ili2132a.c | 135 ++++++++++++++++++++++ dts/bindings/input/ilitek,ili2132a.yaml | 21 ++++ tests/drivers/build_all/input/app.overlay | 8 ++ 6 files changed, 176 insertions(+) create mode 100644 drivers/input/Kconfig.ili2132a create mode 100644 drivers/input/input_ili2132a.c create mode 100644 dts/bindings/input/ilitek,ili2132a.yaml diff --git a/drivers/input/CMakeLists.txt b/drivers/input/CMakeLists.txt index aa1f843476288..47eea1a1e1ea5 100644 --- a/drivers/input/CMakeLists.txt +++ b/drivers/input/CMakeLists.txt @@ -17,6 +17,7 @@ zephyr_library_sources_ifdef(CONFIG_INPUT_GPIO_KBD_MATRIX input_gpio_kbd_matrix. zephyr_library_sources_ifdef(CONFIG_INPUT_GPIO_KEYS input_gpio_keys.c) zephyr_library_sources_ifdef(CONFIG_INPUT_GPIO_QDEC input_gpio_qdec.c) zephyr_library_sources_ifdef(CONFIG_INPUT_GT911 input_gt911.c) +zephyr_library_sources_ifdef(CONFIG_INPUT_ILI2132A input_ili2132a.c) zephyr_library_sources_ifdef(CONFIG_INPUT_ITE_IT8XXX2_KBD input_ite_it8xxx2_kbd.c) zephyr_library_sources_ifdef(CONFIG_INPUT_KBD_MATRIX input_kbd_matrix.c) zephyr_library_sources_ifdef(CONFIG_INPUT_NPCX_KBD input_npcx_kbd.c) diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig index e76d3fc6fc76b..ba0541398f666 100644 --- a/drivers/input/Kconfig +++ b/drivers/input/Kconfig @@ -19,6 +19,7 @@ source "drivers/input/Kconfig.gpio_kbd_matrix" source "drivers/input/Kconfig.gpio_keys" source "drivers/input/Kconfig.gpio_qdec" source "drivers/input/Kconfig.gt911" +source "drivers/input/Kconfig.ili2132a" source "drivers/input/Kconfig.it8xxx2" source "drivers/input/Kconfig.kbd_matrix" source "drivers/input/Kconfig.npcx" diff --git a/drivers/input/Kconfig.ili2132a b/drivers/input/Kconfig.ili2132a new file mode 100644 index 0000000000000..911b5a8699385 --- /dev/null +++ b/drivers/input/Kconfig.ili2132a @@ -0,0 +1,10 @@ +# Copyright (c) 2024 Joel Jaldemark +# SPDX-License-Identifier: Apache-2.0 + +config INPUT_ILI2132A + bool "ILI2132A capacitive touch controller driver" + default y + depends on DT_HAS_ILITEK_ILI2132A_ENABLED + select I2C + help + Enable driver for ilitek ili2132a touch controller diff --git a/drivers/input/input_ili2132a.c b/drivers/input/input_ili2132a.c new file mode 100644 index 0000000000000..be31f55bae0c5 --- /dev/null +++ b/drivers/input/input_ili2132a.c @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2024 Joel Jaldemark + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT ilitek_ili2132a + +#include +#include +#include +#include +#include + +#include +LOG_MODULE_REGISTER(ili2132a, CONFIG_INPUT_LOG_LEVEL); + +#define IS_TOUCHED_BIT 0x40 +#define TIP 1 +#define X_COORD 2 +#define Y_COORD 4 + +struct ili2132a_data { + const struct device *dev; + struct gpio_callback gpio_cb; + struct k_work work; +}; + +struct ili2132a_config { + struct i2c_dt_spec i2c; + struct gpio_dt_spec rst; + struct gpio_dt_spec irq; +}; + +static void gpio_isr(const struct device *dev, struct gpio_callback *cb, uint32_t pin) +{ + struct ili2132a_data *data = CONTAINER_OF(cb, struct ili2132a_data, gpio_cb); + + k_work_submit(&data->work); +} + +static void ili2132a_process(const struct device *dev) +{ + const struct ili2132a_config *dev_cfg = dev->config; + uint8_t buf[8]; + uint16_t x, y; + + i2c_read_dt(&dev_cfg->i2c, buf, sizeof(buf)); + if (buf[TIP] & IS_TOUCHED_BIT) { + x = sys_get_le16(&buf[X_COORD]); + y = sys_get_le16(&buf[Y_COORD]); + input_report_abs(dev, INPUT_ABS_X, x, false, K_FOREVER); + input_report_abs(dev, INPUT_ABS_Y, y, false, K_FOREVER); + input_report_key(dev, INPUT_BTN_TOUCH, 1, true, K_FOREVER); + } else { + input_report_key(dev, INPUT_BTN_TOUCH, 0, true, K_FOREVER); + } +} + +static void ili2132a_work_handler(struct k_work *work_item) +{ + struct ili2132a_data *data = CONTAINER_OF(work_item, struct ili2132a_data, work); + + ili2132a_process(data->dev); +} + +static int ili2132a_init(const struct device *dev) +{ + struct ili2132a_data *data = dev->data; + const struct ili2132a_config *dev_cfg = dev->config; + int ret; + + if (!i2c_is_ready_dt(&dev_cfg->i2c)) { + LOG_ERR("%s is not ready", dev_cfg->i2c.bus->name); + return -ENODEV; + } + + if (!gpio_is_ready_dt(&dev_cfg->rst)) { + LOG_ERR("Reset GPIO controller device not ready"); + return -ENODEV; + } + + if (!gpio_is_ready_dt(&dev_cfg->irq)) { + LOG_ERR("Interrupt GPIO controller device not ready"); + return -ENODEV; + } + + data->dev = dev; + + ret = gpio_pin_configure_dt(&dev_cfg->irq, GPIO_INPUT); + if (ret < 0) { + LOG_ERR("Could not configure interrupt gpio"); + return ret; + } + + ret = gpio_pin_configure_dt(&dev_cfg->rst, GPIO_OUTPUT_ACTIVE); + if (ret < 0) { + LOG_ERR("Could not configure reset gpio"); + return ret; + } + + ret = gpio_pin_set_dt(&dev_cfg->rst, 0); + if (ret < 0) { + return ret; + } + + gpio_init_callback(&data->gpio_cb, gpio_isr, BIT(dev_cfg->irq.pin)); + ret = gpio_add_callback(dev_cfg->irq.port, &data->gpio_cb); + if (ret < 0) { + LOG_ERR("Could not set gpio callback"); + return ret; + } + + ret = gpio_pin_interrupt_configure_dt(&dev_cfg->irq, GPIO_INT_EDGE_FALLING); + if (ret < 0) { + LOG_ERR("Could not configure interrupt"); + return ret; + } + + k_work_init(&data->work, ili2132a_work_handler); + + return 0; +} +#define ILI2132A_INIT(index) \ + static const struct ili2132a_config ili2132a_config_##index = { \ + .i2c = I2C_DT_SPEC_INST_GET(index), \ + .rst = GPIO_DT_SPEC_INST_GET(index, rst_gpios), \ + .irq = GPIO_DT_SPEC_INST_GET(index, irq_gpios), \ + }; \ + static struct ili2132a_data ili2132a_data_##index; \ + DEVICE_DT_INST_DEFINE(index, ili2132a_init, NULL, &ili2132a_data_##index, \ + &ili2132a_config_##index, POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, \ + NULL); + +DT_INST_FOREACH_STATUS_OKAY(ILI2132A_INIT) diff --git a/dts/bindings/input/ilitek,ili2132a.yaml b/dts/bindings/input/ilitek,ili2132a.yaml new file mode 100644 index 0000000000000..a1aef2ad34e66 --- /dev/null +++ b/dts/bindings/input/ilitek,ili2132a.yaml @@ -0,0 +1,21 @@ +# Copyright (c) 2024 Joel Jaldemark +# SPDX-License-Identifier: Apache-2.0 + +description: ILI2132A capacitive touch controller + +compatible: "ilitek,ili2132a" + +include: i2c-device.yaml + +properties: + irq-gpios: + type: phandle-array + required: true + description: | + Interrupt pin + + rst-gpios: + type: phandle-array + required: true + description: | + Reset pin diff --git a/tests/drivers/build_all/input/app.overlay b/tests/drivers/build_all/input/app.overlay index 80be92b765d25..3873a6b14ac98 100644 --- a/tests/drivers/build_all/input/app.overlay +++ b/tests/drivers/build_all/input/app.overlay @@ -261,6 +261,14 @@ primary-tap-enable; swap-xy; }; + + touch_dev: ili2132a@41 { + compatible = "ilitek,ili2132a"; + reg = <0x41>; + irq-gpios = <&test_gpio 0 0>; + rst-gpios = <&test_gpio 1 0>; + }; + }; spi@2 { From 30f2e5120a7b2e49fb30739d0b11e3e138bc668f Mon Sep 17 00:00:00 2001 From: "McAtee Maxwell (CSS ICW SW MTO INT 2)" Date: Wed, 2 Oct 2024 20:52:21 +0000 Subject: [PATCH 0498/4482] Drivers: RTC: Initial implementation of RTC for IFX cyw20829 - Initial driver implementation - Overlay for rtc_api test - dtsi updates. Signed-off-by: McAtee Maxwell (CSS ICW SW MTO INT 2) --- .../cyw920829m2evk_02/cyw920829m2evk_02.yaml | 1 + drivers/rtc/CMakeLists.txt | 1 + drivers/rtc/Kconfig | 1 + drivers/rtc/Kconfig.ifx_cat1 | 14 + drivers/rtc/rtc_ifx_cat1.c | 349 ++++++++++++++++++ dts/arm/infineon/cat1b/cyw20829/cyw20829.dtsi | 8 + dts/bindings/rtc/infineon,cat1-rtc.yaml | 17 + .../rtc/rtc_api/boards/cyw920829m2evk_02.conf | 1 + .../rtc_api/boards/cyw920829m2evk_02.overlay | 16 + 9 files changed, 408 insertions(+) create mode 100644 drivers/rtc/Kconfig.ifx_cat1 create mode 100644 drivers/rtc/rtc_ifx_cat1.c create mode 100644 dts/bindings/rtc/infineon,cat1-rtc.yaml create mode 100644 tests/drivers/rtc/rtc_api/boards/cyw920829m2evk_02.conf create mode 100644 tests/drivers/rtc/rtc_api/boards/cyw920829m2evk_02.overlay diff --git a/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02.yaml b/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02.yaml index a02da7d193780..5292dd06cef51 100644 --- a/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02.yaml +++ b/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02.yaml @@ -20,5 +20,6 @@ supported: - watchdog - spi - i2c + - rtc vendor: infineon diff --git a/drivers/rtc/CMakeLists.txt b/drivers/rtc/CMakeLists.txt index 0e9ca0bdc21af..cd0c7a3ad5832 100644 --- a/drivers/rtc/CMakeLists.txt +++ b/drivers/rtc/CMakeLists.txt @@ -13,6 +13,7 @@ zephyr_library_sources_ifdef(CONFIG_RTC_AMBIQ rtc_ambiq.c) zephyr_library_sources_ifdef(CONFIG_RTC_DS1307 rtc_ds1307.c) zephyr_library_sources_ifdef(CONFIG_USERSPACE rtc_handlers.c) zephyr_library_sources_ifdef(CONFIG_RTC_EMUL rtc_emul.c) +zephyr_library_sources_ifdef(CONFIG_RTC_INFINEON_CAT1 rtc_ifx_cat1.c) zephyr_library_sources_ifdef(CONFIG_RTC_PCF8523 rtc_pcf8523.c) zephyr_library_sources_ifdef(CONFIG_RTC_PCF8563 rtc_pcf8563.c) zephyr_library_sources_ifdef(CONFIG_RTC_MOTOROLA_MC146818 rtc_mc146818.c) diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index accb1ab10eee2..2b1d2d29a7a4e 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -46,6 +46,7 @@ source "drivers/rtc/Kconfig.ambiq" source "drivers/rtc/Kconfig.ds1307" source "drivers/rtc/Kconfig.emul" source "drivers/rtc/Kconfig.fake" +source "drivers/rtc/Kconfig.ifx_cat1" source "drivers/rtc/Kconfig.mc146818" source "drivers/rtc/Kconfig.pcf8523" source "drivers/rtc/Kconfig.pcf8563" diff --git a/drivers/rtc/Kconfig.ifx_cat1 b/drivers/rtc/Kconfig.ifx_cat1 new file mode 100644 index 0000000000000..4a2a12f50c428 --- /dev/null +++ b/drivers/rtc/Kconfig.ifx_cat1 @@ -0,0 +1,14 @@ +# Infineon CAT1 RTC configuration options + +# Copyright (c) 2024 Cypress Semiconductor Corporation (an Infineon company) or +# an affiliate of Cypress Semiconductor Corporation +# +# SPDX-License-Identifier: Apache-2.0 + +config RTC_INFINEON_CAT1 + bool "Infineon CAT1 RTC driver" + default y + depends on DT_HAS_INFINEON_CAT1_RTC_ENABLED + select USE_INFINEON_RTC + help + This option enables the RTC driver for Infineon CAT1 family. diff --git a/drivers/rtc/rtc_ifx_cat1.c b/drivers/rtc/rtc_ifx_cat1.c new file mode 100644 index 0000000000000..62f702a52323e --- /dev/null +++ b/drivers/rtc/rtc_ifx_cat1.c @@ -0,0 +1,349 @@ +/* + * Copyright (c) 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @brief RTC driver for Infineon CAT1 MCU family. + */ + +#include +#include +#include +#include +#include + +LOG_MODULE_REGISTER(ifx_cat1_rtc, CONFIG_RTC_LOG_LEVEL); + +#define DT_DRV_COMPAT infineon_cat1_rtc + +#define _IFX_CAT1_RTC_STATE_UNINITIALIZED 0 +#define _IFX_CAT1_RTC_STATE_ENABLED 1 +#define _IFX_CAT1_RTC_STATE_TIME_SET 2 + +#define _IFX_CAT1_RTC_INIT_CENTURY 2000 +#define _IFX_CAT1_RTC_TM_YEAR_BASE 1900 + +#if defined(CONFIG_SOC_FAMILY_INFINEON_CAT1B) +#if defined(SRSS_BACKUP_NUM_BREG3) && (SRSS_BACKUP_NUM_BREG3 > 0) +#define _IFX_CAT1_RTC_BREG (BACKUP->BREG_SET3[SRSS_BACKUP_NUM_BREG3 - 1]) +#elif defined(SRSS_BACKUP_NUM_BREG2) && (SRSS_BACKUP_NUM_BREG2 > 0) +#define _IFX_CAT1_RTC_BREG (BACKUP->BREG_SET2[SRSS_BACKUP_NUM_BREG2 - 1]) +#elif defined(SRSS_BACKUP_NUM_BREG1) && (SRSS_BACKUP_NUM_BREG1 > 0) +#define _IFX_CAT1_RTC_BREG (BACKUP->BREG_SET1[SRSS_BACKUP_NUM_BREG1 - 1]) +#elif defined(SRSS_BACKUP_NUM_BREG0) && (SRSS_BACKUP_NUM_BREG0 > 0) +#define _IFX_CAT1_RTC_BREG (BACKUP->BREG_SET0[SRSS_BACKUP_NUM_BREG0 - 1]) +#endif +#endif + +#define _IFX_CAT1_RTC_BREG_CENTURY_Pos 0UL +#define _IFX_CAT1_RTC_BREG_CENTURY_Msk 0x0000FFFFUL +#define _IFX_CAT1_RTC_BREG_STATE_Pos 16UL +#define _IFX_CAT1_RTC_BREG_STATE_Msk 0xFFFF0000UL + +static const uint32_t _IFX_CAT1_RTC_MAX_RETRY = 10; +static const uint32_t _IFX_CAT1_RTC_RETRY_DELAY_MS = 1; + +static cy_stc_rtc_dst_t *_ifx_cat1_rtc_dst; + +#ifdef CONFIG_PM +static cy_en_syspm_status_t _ifx_cat1_rtc_syspm_callback(cy_stc_syspm_callback_params_t *params, + cy_en_syspm_callback_mode_t mode) +{ + return Cy_RTC_DeepSleepCallback(params, mode); +} + +static cy_stc_syspm_callback_params_t _ifx_cat1_rtc_pm_cb_params = {NULL, NULL}; +static cy_stc_syspm_callback_t _ifx_cat1_rtc_pm_cb = { + .callback = &_ifx_cat1_rtc_syspm_callback, + .type = CY_SYSPM_DEEPSLEEP, + .callbackParams = &_ifx_cat1_rtc_pm_cb_params, +}; +#endif /* CONFIG_PM */ + +#define _IFX_CAT1_RTC_WAIT_ONE_MS() Cy_SysLib_Delay(_IFX_CAT1_RTC_RETRY_DELAY_MS); + +/* Internal macro to validate RTC year parameter falls within 21st century */ +#define IFX_CAT1_RTC_VALID_CENTURY(year) ((year) >= _IFX_CAT1_RTC_INIT_CENTURY) + +#define MAX_IFX_CAT1_CAL (60) + +/* Convert parts per billion to groupings of 128 ticks added or removed from one hour of clock + * cycles at 32768 Hz. + * + * ROUND_DOWN(ppb * 32768Hz * 60min * 60sec / 1000000000, 128) / 128 + * ROUND_DOWN(ppb * 117964800 / 1000000000, 128) / 128 + * ROUND_DOWN(ppb * 9216 / 78125, 128) / 128 + */ +#define PPB_TO_WCO_PULSE_SETS(ppb) ((ROUND_DOWN((ppb * 9216 / 78125), 128)) / 128) + +/* Convert groupings of 128 ticks added or removed from one hour of clock cycles at + * 32768 Hz to parts per billion + * + * wps * 128 * 1000000000 / 32768Hz * 60min * 60sec + * wps * 128000000000 / 117964800 + * wps * 78125 / 72 + */ +#define WCO_PULSE_SETS_TO_PPB(wps) (wps * 78125 / 72) + +struct ifx_cat1_rtc_config { + uint32_t irqn; +}; + +struct ifx_cat1_rtc_data { + struct k_spinlock lock; +}; + +static inline uint16_t _ifx_cat1_rtc_get_state(void) +{ + return _FLD2VAL(_IFX_CAT1_RTC_BREG_STATE, _IFX_CAT1_RTC_BREG); +} + +static inline void _ifx_cat1_rtc_set_state(uint16_t init) +{ + _IFX_CAT1_RTC_BREG &= _IFX_CAT1_RTC_BREG_CENTURY_Msk; + _IFX_CAT1_RTC_BREG |= _VAL2FLD(_IFX_CAT1_RTC_BREG_STATE, init); +} + +static inline uint16_t _ifx_cat1_rtc_get_century(void) +{ + return _FLD2VAL(_IFX_CAT1_RTC_BREG_CENTURY, _IFX_CAT1_RTC_BREG); +} + +static inline void _ifx_cat1_rtc_set_century(uint16_t century) +{ + _IFX_CAT1_RTC_BREG &= _IFX_CAT1_RTC_BREG_STATE_Msk; + _IFX_CAT1_RTC_BREG |= _VAL2FLD(_IFX_CAT1_RTC_BREG_CENTURY, century); +} + +static void _ifx_cat1_rtc_from_pdl_time(cy_stc_rtc_config_t *pdlTime, const int year, + struct rtc_time *z_time) +{ + CY_ASSERT(pdlTime != NULL); + CY_ASSERT(z_time != NULL); + + z_time->tm_sec = (int)pdlTime->sec; + z_time->tm_min = (int)pdlTime->min; + z_time->tm_hour = (int)pdlTime->hour; + z_time->tm_mday = (int)pdlTime->date; + z_time->tm_year = (int)(year - _IFX_CAT1_RTC_TM_YEAR_BASE); + + /* The subtraction of 1 here is to translate between internal ifx_cat1 code and the Zephyr + * driver. + */ + z_time->tm_mon = (int)(pdlTime->month - 1u); + z_time->tm_wday = (int)(pdlTime->dayOfWeek - 1u); + + /* year day not known in pdl RTC structure without conversion */ + z_time->tm_yday = -1; + + /* daylight savings currently marked as unknown */ + z_time->tm_isdst = -1; + + /* nanoseconds not tracked by ifx code. Set to value indicating unknown */ + z_time->tm_nsec = 0; +} + +static void _ifx_cat1_rtc_isr_handler(void) +{ + Cy_RTC_Interrupt(_ifx_cat1_rtc_dst, NULL != _ifx_cat1_rtc_dst); +} + +void _ifx_cat1_rtc_century_interrupt(void) +{ + /* The century is stored in its own register so when a "century interrupt" + * occurs at a rollover. The current century is retrieved and 100 is added + * to it and the register is reset to reflect the new century. + * i.e. 1999->2000 + */ + _ifx_cat1_rtc_set_century(_ifx_cat1_rtc_get_century() + 100); +} + +static int ifx_cat1_rtc_init(const struct device *dev) +{ + cy_rslt_t rslt = CY_RSLT_SUCCESS; + + Cy_SysClk_ClkBakSetSource(CY_SYSCLK_BAK_IN_CLKLF); + + if (_ifx_cat1_rtc_get_state() == _IFX_CAT1_RTC_STATE_UNINITIALIZED) { + if (Cy_RTC_IsExternalResetOccurred()) { + _ifx_cat1_rtc_set_century(_IFX_CAT1_RTC_INIT_CENTURY); + } + +#ifdef CONFIG_PM + rslt = Cy_SysPm_RegisterCallback(&_ifx_cat1_rtc_pm_cb) +#endif /* CONFIG_PM */ + + if (rslt == CY_RSLT_SUCCESS) { + _ifx_cat1_rtc_set_state(_IFX_CAT1_RTC_STATE_ENABLED); + } else { + rslt = -EINVAL; + } + + } else if (_ifx_cat1_rtc_get_state() == _IFX_CAT1_RTC_STATE_ENABLED || + _ifx_cat1_rtc_get_state() == _IFX_CAT1_RTC_STATE_TIME_SET) { + + if (Cy_RTC_GetInterruptStatus() & CY_RTC_INTR_CENTURY) { + _ifx_cat1_rtc_century_interrupt(); + } + } + + Cy_RTC_ClearInterrupt(CY_RTC_INTR_CENTURY); + Cy_RTC_SetInterruptMask(CY_RTC_INTR_CENTURY); + + _ifx_cat1_rtc_dst = NULL; + IRQ_CONNECT(DT_INST_IRQN(0), DT_INST_IRQ(0, priority), _ifx_cat1_rtc_isr_handler, + DEVICE_DT_INST_GET(0), 0); + irq_enable(DT_INST_IRQN(0)); + + return rslt; +} + +static int ifx_cat1_rtc_set_time(const struct device *dev, const struct rtc_time *timeptr) +{ + struct ifx_cat1_rtc_data *data = dev->data; + + uint32_t sec = timeptr->tm_sec; + uint32_t min = timeptr->tm_min; + uint32_t hour = timeptr->tm_hour; + uint32_t day = timeptr->tm_mday; + /* The addition of 1 here is to translate between internal ifx_cat1 code and the Zephyr + * driver. + */ + uint32_t mon = timeptr->tm_mon + 1; + uint32_t year = timeptr->tm_year + _IFX_CAT1_RTC_TM_YEAR_BASE; + uint32_t year2digit = year % 100; + + cy_rslt_t rslt; + uint32_t retry = 0; + + if (!CY_RTC_IS_SEC_VALID(sec) || !CY_RTC_IS_MIN_VALID(min) || !CY_RTC_IS_HOUR_VALID(hour) || + !CY_RTC_IS_MONTH_VALID(mon) || !CY_RTC_IS_YEAR_SHORT_VALID(year2digit) || + !IFX_CAT1_RTC_VALID_CENTURY(year)) { + + return -EINVAL; + } + do { + if (retry != 0) { + _IFX_CAT1_RTC_WAIT_ONE_MS(); + } + + k_spinlock_key_t key = k_spin_lock(&data->lock); + + rslt = Cy_RTC_SetDateAndTimeDirect(sec, min, hour, day, mon, year2digit); + if (rslt == CY_RSLT_SUCCESS) { + _ifx_cat1_rtc_set_century((uint16_t)(year) - (uint16_t)(year2digit)); + } + + k_spin_unlock(&data->lock, key); + ++retry; + } while (rslt == CY_RTC_INVALID_STATE && retry < _IFX_CAT1_RTC_MAX_RETRY); + + retry = 0; + while (CY_RTC_BUSY == Cy_RTC_GetSyncStatus() && retry < _IFX_CAT1_RTC_MAX_RETRY) { + _IFX_CAT1_RTC_WAIT_ONE_MS(); + ++retry; + } + + if (rslt == CY_RSLT_SUCCESS) { + _ifx_cat1_rtc_set_state(_IFX_CAT1_RTC_STATE_TIME_SET); + return 0; + } else { + return -EINVAL; + } +} + +static int ifx_cat1_rtc_get_time(const struct device *dev, struct rtc_time *timeptr) +{ + struct ifx_cat1_rtc_data *data = dev->data; + + cy_stc_rtc_config_t dateTime = {.hrFormat = CY_RTC_24_HOURS}; + + if (_ifx_cat1_rtc_get_state() != _IFX_CAT1_RTC_STATE_TIME_SET) { + LOG_ERR("Valid time has not been set with rtc_set_time yet"); + return -ENODATA; + } + + k_spinlock_key_t key = k_spin_lock(&data->lock); + + Cy_RTC_GetDateAndTime(&dateTime); + const int year = (int)(dateTime.year + _ifx_cat1_rtc_get_century()); + + k_spin_unlock(&data->lock, key); + + _ifx_cat1_rtc_from_pdl_time(&dateTime, year, timeptr); + + return CY_RSLT_SUCCESS; +} + +#ifdef CONFIG_RTC_CALIBRATION +static int ifx_cat1_set_calibration(const struct device *dev, int32_t calibration) +{ + cy_rslt_t rslt; + + uint8_t uint_calibration; + cy_en_rtc_calib_sign_t calibration_sign; + + if (calibration >= 0) { + calibration_sign = CY_RTC_CALIB_SIGN_POSITIVE; + } else { + calibration = abs(calibration); + calibration_sign = CY_RTC_CALIB_SIGN_NEGATIVE; + } + + uint_calibration = PPB_TO_WCO_PULSE_SETS(calibration); + + /* Maximum calibration value on cat1b of 60 128 tick groupings */ + if (MAX_IFX_CAT1_CAL < uint_calibration) { + /* out of supported range */ + return -EINVAL; + } + + rslt = Cy_RTC_CalibrationControlEnable(uint_calibration, calibration_sign, + CY_RTC_CAL_SEL_CAL1); + if (rslt != CY_RSLT_SUCCESS) { + return -EINVAL; + } + + return 0; +} + +static int ifx_cat1_get_calibration(const struct device *dev, int32_t *calibration) +{ + ARG_UNUSED(dev); + + uint32_t hw_calibration = _FLD2VAL(BACKUP_CAL_CTL_CALIB_VAL, BACKUP_CAL_CTL); + cy_en_rtc_calib_sign_t hw_sign = + (cy_en_rtc_calib_sign_t)(_FLD2VAL(BACKUP_CAL_CTL_CALIB_SIGN, BACKUP_CAL_CTL)); + + if (CY_RTC_CALIB_SIGN_POSITIVE == hw_sign) { + *calibration = WCO_PULSE_SETS_TO_PPB(hw_calibration); + } else { + *calibration = WCO_PULSE_SETS_TO_PPB(hw_calibration) * -1; + } + + return 0; +} +#endif /* CONFIG_RTC_CALIBRATION */ + +static const struct rtc_driver_api ifx_cat1_rtc_driver_api = { + .set_time = ifx_cat1_rtc_set_time, + .get_time = ifx_cat1_rtc_get_time, +#ifdef CONFIG_RTC_CALIBRATION + .set_calibration = ifx_cat1_set_calibration, + .get_calibration = ifx_cat1_get_calibration, +#endif +}; + +#define INFINEON_CAT1_RTC_INIT(n) \ + static struct ifx_cat1_rtc_data ifx_cat1_rtc_data##n; \ + \ + static const struct ifx_cat1_rtc_config ifx_cat1_rtc_cfg##n; \ + \ + DEVICE_DT_INST_DEFINE(n, ifx_cat1_rtc_init, NULL, &ifx_cat1_rtc_data##n, \ + &ifx_cat1_rtc_cfg##n, PRE_KERNEL_1, CONFIG_RTC_INIT_PRIORITY, \ + &ifx_cat1_rtc_driver_api); + +DT_INST_FOREACH_STATUS_OKAY(INFINEON_CAT1_RTC_INIT) diff --git a/dts/arm/infineon/cat1b/cyw20829/cyw20829.dtsi b/dts/arm/infineon/cat1b/cyw20829/cyw20829.dtsi index 1b90d91b57842..8f609c5309c1f 100644 --- a/dts/arm/infineon/cat1b/cyw20829/cyw20829.dtsi +++ b/dts/arm/infineon/cat1b/cyw20829/cyw20829.dtsi @@ -138,6 +138,14 @@ status = "disabled"; }; + rtc0: rtc@40220000 { + compatible = "infineon,cat1-rtc"; + reg = <0x40220000 0x10000>; + interrupts = <10 6>; + alarms-count = <2>; + status = "disabled"; + }; + counter0_0: counter@404a0000 { compatible = "infineon,cat1-counter"; reg = <0x404a0000 0x80>; diff --git a/dts/bindings/rtc/infineon,cat1-rtc.yaml b/dts/bindings/rtc/infineon,cat1-rtc.yaml new file mode 100644 index 0000000000000..b70868e95bb5a --- /dev/null +++ b/dts/bindings/rtc/infineon,cat1-rtc.yaml @@ -0,0 +1,17 @@ +# Copyright (c) 2024 Cypress Semiconductor Corporation (an Infineon company) or +# an affiliate of Cypress Semiconductor Corporation +# +# SPDX-License-Identifier: Apache-2.0 + +description: Infineon CAT1 family RTC device + +compatible: "infineon,cat1-rtc" + +include: rtc-device.yaml + +properties: + reg: + required: true + + interrupts: + required: true diff --git a/tests/drivers/rtc/rtc_api/boards/cyw920829m2evk_02.conf b/tests/drivers/rtc/rtc_api/boards/cyw920829m2evk_02.conf new file mode 100644 index 0000000000000..088271dfac366 --- /dev/null +++ b/tests/drivers/rtc/rtc_api/boards/cyw920829m2evk_02.conf @@ -0,0 +1 @@ +CONFIG_RTC_CALIBRATION=y diff --git a/tests/drivers/rtc/rtc_api/boards/cyw920829m2evk_02.overlay b/tests/drivers/rtc/rtc_api/boards/cyw920829m2evk_02.overlay new file mode 100644 index 0000000000000..d73900529812e --- /dev/null +++ b/tests/drivers/rtc/rtc_api/boards/cyw920829m2evk_02.overlay @@ -0,0 +1,16 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation + */ + +/ { + aliases { + rtc = &rtc0; + }; +}; + +&rtc0 { + status = "okay"; +}; From 61b00097d8daf4788a3c1316a89407ca8d7b1de9 Mon Sep 17 00:00:00 2001 From: McAtee Maxwell Date: Tue, 8 Oct 2024 12:06:45 -0700 Subject: [PATCH 0499/4482] Verification: verify code changes from PR review - verify code changes from PR review Signed-off-by: McAtee Maxwell --- drivers/rtc/rtc_ifx_cat1.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/rtc/rtc_ifx_cat1.c b/drivers/rtc/rtc_ifx_cat1.c index 62f702a52323e..24569ca3864bf 100644 --- a/drivers/rtc/rtc_ifx_cat1.c +++ b/drivers/rtc/rtc_ifx_cat1.c @@ -88,10 +88,6 @@ static cy_stc_syspm_callback_t _ifx_cat1_rtc_pm_cb = { */ #define WCO_PULSE_SETS_TO_PPB(wps) (wps * 78125 / 72) -struct ifx_cat1_rtc_config { - uint32_t irqn; -}; - struct ifx_cat1_rtc_data { struct k_spinlock lock; }; @@ -340,10 +336,8 @@ static const struct rtc_driver_api ifx_cat1_rtc_driver_api = { #define INFINEON_CAT1_RTC_INIT(n) \ static struct ifx_cat1_rtc_data ifx_cat1_rtc_data##n; \ \ - static const struct ifx_cat1_rtc_config ifx_cat1_rtc_cfg##n; \ - \ DEVICE_DT_INST_DEFINE(n, ifx_cat1_rtc_init, NULL, &ifx_cat1_rtc_data##n, \ - &ifx_cat1_rtc_cfg##n, PRE_KERNEL_1, CONFIG_RTC_INIT_PRIORITY, \ + NULL, PRE_KERNEL_1, CONFIG_RTC_INIT_PRIORITY, \ &ifx_cat1_rtc_driver_api); DT_INST_FOREACH_STATUS_OKAY(INFINEON_CAT1_RTC_INIT) From d427d8a6538bb1e9cf16bf7472b5542397bf4dab Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Thu, 3 Oct 2024 13:24:10 +1000 Subject: [PATCH 0500/4482] samples: drivers: gnss: display more information Query and display additional information in the GNSS API sample. Signed-off-by: Jordan Yates --- samples/drivers/gnss/src/main.c | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/samples/drivers/gnss/src/main.c b/samples/drivers/gnss/src/main.c index 91bd427e23696..06eacb2843dbc 100644 --- a/samples/drivers/gnss/src/main.c +++ b/samples/drivers/gnss/src/main.c @@ -36,7 +36,43 @@ static void gnss_satellites_cb(const struct device *dev, const struct gnss_satel #endif GNSS_SATELLITES_CALLBACK_DEFINE(GNSS_MODEM, gnss_satellites_cb); +#define GNSS_SYSTEMS_PRINTF(define, supported, enabled) \ + printf("\t%20s: Supported: %3s Enabled: %3s\n", \ + STRINGIFY(define), (supported & define) ? "Yes" : "No", \ + (enabled & define) ? "Yes" : "No"); + int main(void) { + gnss_systems_t supported, enabled; + uint32_t fix_interval; + int rc; + + rc = gnss_get_supported_systems(GNSS_MODEM, &supported); + if (rc < 0) { + printf("Failed to query supported systems (%d)\n", rc); + return rc; + } + rc = gnss_get_enabled_systems(GNSS_MODEM, &enabled); + if (rc < 0) { + printf("Failed to query enabled systems (%d)\n", rc); + return rc; + } + printf("GNSS Systems:\n"); + GNSS_SYSTEMS_PRINTF(GNSS_SYSTEM_GPS, supported, enabled); + GNSS_SYSTEMS_PRINTF(GNSS_SYSTEM_GLONASS, supported, enabled); + GNSS_SYSTEMS_PRINTF(GNSS_SYSTEM_GALILEO, supported, enabled); + GNSS_SYSTEMS_PRINTF(GNSS_SYSTEM_BEIDOU, supported, enabled); + GNSS_SYSTEMS_PRINTF(GNSS_SYSTEM_QZSS, supported, enabled); + GNSS_SYSTEMS_PRINTF(GNSS_SYSTEM_IRNSS, supported, enabled); + GNSS_SYSTEMS_PRINTF(GNSS_SYSTEM_SBAS, supported, enabled); + GNSS_SYSTEMS_PRINTF(GNSS_SYSTEM_IMES, supported, enabled); + + rc = gnss_get_fix_rate(GNSS_MODEM, &fix_interval); + if (rc < 0) { + printf("Failed to query fix rate (%d)\n", rc); + return rc; + } + printf("Fix rate = %d ms\n", fix_interval); + return 0; } From 5bb721264b205bacc87962fc275c40b54ae96683 Mon Sep 17 00:00:00 2001 From: Jakub Rzeszutko Date: Tue, 8 Oct 2024 15:06:23 +0200 Subject: [PATCH 0501/4482] shell: add generic RX buffer flush function Added a generic function `z_shell_backend_rx_buffer_flush` to clear the RX buffer when resuming the shell. The function repeatedly calls the backend's `read` API until the buffer is empty or a maximum of 1000 iterations is reached. This prevents unintended command execution after `shell_start`. Signed-off-by: Jakub Rzeszutko --- subsys/shell/shell.c | 8 ++++++++ subsys/shell/shell_ops.c | 14 ++++++++++++++ subsys/shell/shell_ops.h | 9 +++++++++ 3 files changed, 31 insertions(+) diff --git a/subsys/shell/shell.c b/subsys/shell/shell.c index 3ffe26914170a..2f36a1b60b7ad 100644 --- a/subsys/shell/shell.c +++ b/subsys/shell/shell.c @@ -1452,6 +1452,14 @@ int shell_start(const struct shell *sh) z_cursor_next_line_move(sh); state_set(sh, SHELL_STATE_ACTIVE); + /* + * If the shell is stopped with the shell_stop function, its backend remains active + * and continues to buffer incoming data. As a result, when the shell is resumed, + * all buffered data is processed, which may lead to the execution of commands + * received while the shell was stopped. + */ + z_shell_backend_rx_buffer_flush(sh); + k_mutex_unlock(&sh->ctx->wr_mtx); return 0; diff --git a/subsys/shell/shell_ops.c b/subsys/shell/shell_ops.c index b7f68e22a5832..54492024d0e7f 100644 --- a/subsys/shell/shell_ops.c +++ b/subsys/shell/shell_ops.c @@ -548,3 +548,17 @@ void z_shell_fprintf(const struct shell *sh, z_shell_vfprintf(sh, color, fmt, args); va_end(args); } + +void z_shell_backend_rx_buffer_flush(const struct shell *sh) +{ + __ASSERT_NO_MSG(sh); + + int32_t max_iterations = 1000; + uint8_t buf[64]; + size_t count = 0; + int err; + + do { + err = sh->iface->api->read(sh->iface, buf, sizeof(buf), &count); + } while (count != 0 && err == 0 && --max_iterations > 0); +} diff --git a/subsys/shell/shell_ops.h b/subsys/shell/shell_ops.h index b72d6456cb69f..c673c974331dd 100644 --- a/subsys/shell/shell_ops.h +++ b/subsys/shell/shell_ops.h @@ -372,6 +372,15 @@ void z_shell_fprintf(const struct shell *sh, enum shell_vt100_color color, void z_shell_vfprintf(const struct shell *sh, enum shell_vt100_color color, const char *fmt, va_list args); +/** + * @brief Flushes the shell backend receive buffer. + * + * This function repeatedly reads from the shell interface's receive buffer + * until it is empty or a maximum number of iterations is reached. + * It ensures that no additional data is left in the buffer. + */ +void z_shell_backend_rx_buffer_flush(const struct shell *sh); + #ifdef __cplusplus } #endif From 4953389b1e47c74a6307a4dd8f88be42562a807e Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Sat, 5 Oct 2024 15:08:51 +1000 Subject: [PATCH 0502/4482] net: socket_service: remove `work_q` parameter Remove the `work_q` parameter from `NET_SOCKET_SERVICE_SYNC_DEFINE` and `NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC` as this feature was dropped during review but the removal was not 100% complete. Signed-off-by: Jordan Yates --- doc/releases/migration-guide-4.0.rst | 3 +++ include/zephyr/net/socket_service.h | 17 +++++------------ samples/net/sockets/echo_service/src/main.c | 4 ++-- subsys/net/lib/dhcpv4/dhcpv4_server.c | 2 +- subsys/net/lib/dns/llmnr_responder.c | 2 +- subsys/net/lib/dns/mdns_responder.c | 4 ++-- subsys/net/lib/dns/resolve.c | 2 +- subsys/net/lib/sockets/sockets_service.c | 5 ++--- subsys/net/lib/zperf/zperf_tcp_receiver.c | 2 +- subsys/net/lib/zperf/zperf_udp_receiver.c | 2 +- subsys/shell/backends/shell_telnet.c | 2 +- tests/net/socket/service/src/main.c | 6 +++--- 12 files changed, 23 insertions(+), 28 deletions(-) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 5eb0713bd909e..6a00ed2d9ec25 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -453,6 +453,9 @@ Networking from :zephyr_file:`include/zephyr/net/buf.h` to :zephyr_file:`include/zephyr/net_buf.h` and the implementation moved to :zephyr_file:`lib/net_buf/`. (:github:`78009`) +* The ``work_q`` parameter to ``NET_SOCKET_SERVICE_SYNC_DEFINE`` and + ``NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC`` has been removed as it was always ignored. (:github:`79446`) + Other Subsystems **************** diff --git a/include/zephyr/net/socket_service.h b/include/zephyr/net/socket_service.h index ca36593b284b2..bc96a7f9dd659 100644 --- a/include/zephyr/net/socket_service.h +++ b/include/zephyr/net/socket_service.h @@ -67,8 +67,6 @@ struct net_socket_service_desc { */ const char *owner; #endif - /** Workqueue where the work is submitted. */ - struct k_work_q *work_q; /** Pointer to the list of services that we are listening */ struct net_socket_service_event *pev; /** Length of the pollable socket array for this service. */ @@ -91,7 +89,7 @@ extern void net_socket_service_callback(struct k_work *work); #define NET_SOCKET_SERVICE_OWNER #endif -#define __z_net_socket_service_define(_name, _work_q, _cb, _count, ...) \ +#define __z_net_socket_service_define(_name, _cb, _count, ...) \ static int __z_net_socket_svc_get_idx(_name); \ static struct net_socket_service_event \ __z_net_socket_svc_get_name(_name)[_count] = { \ @@ -103,7 +101,6 @@ extern void net_socket_service_callback(struct k_work *work); COND_CODE_0(NUM_VA_ARGS_LESS_1(__VA_ARGS__), (), __VA_ARGS__) \ const STRUCT_SECTION_ITERABLE(net_socket_service_desc, _name) = { \ NET_SOCKET_SERVICE_OWNER \ - .work_q = (_work_q), \ .pev = __z_net_socket_svc_get_name(_name), \ .pev_len = (_count), \ .idx = &__z_net_socket_svc_get_idx(_name), \ @@ -126,13 +123,11 @@ extern void net_socket_service_callback(struct k_work *work); * instead. * * @param name Name of the service. - * @param work_q Pointer to workqueue where the work is done. Can be null in which case - * system workqueue is used. * @param cb Callback function that is called for socket activity. * @param count How many pollable sockets is needed for this service. */ -#define NET_SOCKET_SERVICE_SYNC_DEFINE(name, work_q, cb, count) \ - __z_net_socket_service_define(name, work_q, cb, count) +#define NET_SOCKET_SERVICE_SYNC_DEFINE(name, cb, count) \ + __z_net_socket_service_define(name, cb, count) /** * @brief Statically define a network socket service in a private (static) scope. @@ -141,13 +136,11 @@ extern void net_socket_service_callback(struct k_work *work); * with next socket service. * * @param name Name of the service. - * @param work_q Pointer to workqueue where the work is done. Can be null in which case - * system workqueue is used. * @param cb Callback function that is called for socket activity. * @param count How many pollable sockets is needed for this service. */ -#define NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(name, work_q, cb, count) \ - __z_net_socket_service_define(name, work_q, cb, count, static) +#define NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(name, cb, count) \ + __z_net_socket_service_define(name, cb, count, static) /** * @brief Register pollable sockets. diff --git a/samples/net/sockets/echo_service/src/main.c b/samples/net/sockets/echo_service/src/main.c index f3102bda76bc7..2b44c899e58c6 100644 --- a/samples/net/sockets/echo_service/src/main.c +++ b/samples/net/sockets/echo_service/src/main.c @@ -57,8 +57,8 @@ static void udp_service_handler(struct k_work *work) receive_data(true, pev, buf, sizeof(buf)); } -NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(service_udp, NULL, udp_service_handler, MAX_SERVICES); -NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(service_tcp, NULL, tcp_service_handler, MAX_SERVICES); +NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(service_udp, udp_service_handler, MAX_SERVICES); +NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(service_tcp, tcp_service_handler, MAX_SERVICES); static void receive_data(bool is_udp, struct net_socket_service_event *pev, char *buf, size_t buflen) diff --git a/subsys/net/lib/dhcpv4/dhcpv4_server.c b/subsys/net/lib/dhcpv4/dhcpv4_server.c index 58b02539c4124..8aca61963df33 100644 --- a/subsys/net/lib/dhcpv4/dhcpv4_server.c +++ b/subsys/net/lib/dhcpv4/dhcpv4_server.c @@ -1534,7 +1534,7 @@ static void dhcpv4_server_cb(struct k_work *work) dhcpv4_process_data(ctx, recv_buf, ret); } -NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(dhcpv4_server, NULL, dhcpv4_server_cb, +NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(dhcpv4_server, dhcpv4_server_cb, CONFIG_NET_DHCPV4_SERVER_INSTANCES); int net_dhcpv4_server_start(struct net_if *iface, struct in_addr *base_addr) diff --git a/subsys/net/lib/dns/llmnr_responder.c b/subsys/net/lib/dns/llmnr_responder.c index b72d93f27eefc..d41429f9d31dd 100644 --- a/subsys/net/lib/dns/llmnr_responder.c +++ b/subsys/net/lib/dns/llmnr_responder.c @@ -68,7 +68,7 @@ static struct net_mgmt_event_callback mgmt_cb; static struct zsock_pollfd fds[LLMNR_MAX_POLL]; static void svc_handler(struct k_work *work); -NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(svc_llmnr, NULL, svc_handler, LLMNR_MAX_POLL); +NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(svc_llmnr, svc_handler, LLMNR_MAX_POLL); NET_BUF_POOL_DEFINE(llmnr_msg_pool, DNS_RESOLVER_BUF_CTR, DNS_RESOLVER_MAX_BUF_SIZE, 0, NULL); diff --git a/subsys/net/lib/dns/mdns_responder.c b/subsys/net/lib/dns/mdns_responder.c index 031f97df2fe1a..0eadf856c9522 100644 --- a/subsys/net/lib/dns/mdns_responder.c +++ b/subsys/net/lib/dns/mdns_responder.c @@ -58,14 +58,14 @@ extern void dns_dispatcher_svc_handler(struct k_work *work); #if defined(CONFIG_NET_IPV4) static struct mdns_responder_context v4_ctx[MAX_IPV4_IFACE_COUNT]; -NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(v4_svc, NULL, dns_dispatcher_svc_handler, +NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(v4_svc, dns_dispatcher_svc_handler, MDNS_MAX_IPV4_IFACE_COUNT); #endif #if defined(CONFIG_NET_IPV6) static struct mdns_responder_context v6_ctx[MAX_IPV6_IFACE_COUNT]; -NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(v6_svc, NULL, dns_dispatcher_svc_handler, +NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(v6_svc, dns_dispatcher_svc_handler, MDNS_MAX_IPV6_IFACE_COUNT); #endif diff --git a/subsys/net/lib/dns/resolve.c b/subsys/net/lib/dns/resolve.c index 5e536717e8491..33514ecf553f6 100644 --- a/subsys/net/lib/dns/resolve.c +++ b/subsys/net/lib/dns/resolve.c @@ -36,7 +36,7 @@ LOG_MODULE_REGISTER(net_dns_resolve, CONFIG_DNS_RESOLVER_LOG_LEVEL); extern void dns_dispatcher_svc_handler(struct k_work *work); -NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(resolve_svc, NULL, dns_dispatcher_svc_handler, +NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(resolve_svc, dns_dispatcher_svc_handler, DNS_RESOLVER_MAX_POLL); #define MDNS_IPV4_ADDR "224.0.0.251:5353" diff --git a/subsys/net/lib/sockets/sockets_service.c b/subsys/net/lib/sockets/sockets_service.c index a86ee1066b546..ac367c3435839 100644 --- a/subsys/net/lib/sockets/sockets_service.c +++ b/subsys/net/lib/sockets/sockets_service.c @@ -136,8 +136,7 @@ void net_socket_service_callback(struct k_work *work) } } -static int call_work(struct zsock_pollfd *pev, struct k_work_q *work_q, - struct k_work *work) +static int call_work(struct zsock_pollfd *pev, struct k_work *work) { int ret = 0; @@ -170,7 +169,7 @@ static int trigger_work(struct zsock_pollfd *pev) */ event->event = *pev; - return call_work(pev, svc->work_q, &event->work); + return call_work(pev, &event->work); } static void socket_service_thread(void) diff --git a/subsys/net/lib/zperf/zperf_tcp_receiver.c b/subsys/net/lib/zperf/zperf_tcp_receiver.c index f119f5621f942..b4e63ac2da13e 100644 --- a/subsys/net/lib/zperf/zperf_tcp_receiver.c +++ b/subsys/net/lib/zperf/zperf_tcp_receiver.c @@ -41,7 +41,7 @@ static struct sockaddr sock_addr[SOCK_ID_MAX]; static void tcp_svc_handler(struct k_work *work); -NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(svc_tcp, NULL, tcp_svc_handler, +NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(svc_tcp, tcp_svc_handler, SOCK_ID_MAX); static void tcp_received(const struct sockaddr *addr, size_t datalen) diff --git a/subsys/net/lib/zperf/zperf_udp_receiver.c b/subsys/net/lib/zperf/zperf_udp_receiver.c index 2f0d292f7ad0f..085cbf6ac288e 100644 --- a/subsys/net/lib/zperf/zperf_udp_receiver.c +++ b/subsys/net/lib/zperf/zperf_udp_receiver.c @@ -48,7 +48,7 @@ struct zsock_pollfd fds[SOCK_ID_MAX] = { 0 }; static void udp_svc_handler(struct k_work *work); -NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(svc_udp, NULL, udp_svc_handler, +NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(svc_udp, udp_svc_handler, SOCK_ID_MAX); static char udp_server_iface_name[IFNAMSIZ]; diff --git a/subsys/shell/backends/shell_telnet.c b/subsys/shell/backends/shell_telnet.c index b862f515856da..f6b340e3ab0b6 100644 --- a/subsys/shell/backends/shell_telnet.c +++ b/subsys/shell/backends/shell_telnet.c @@ -42,7 +42,7 @@ struct shell_telnet *sh_telnet; static void telnet_server_cb(struct k_work *work); static int telnet_init(struct shell_telnet *ctx); -NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(telnet_server, NULL, telnet_server_cb, +NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(telnet_server, telnet_server_cb, SHELL_TELNET_POLLFD_COUNT); diff --git a/tests/net/socket/service/src/main.c b/tests/net/socket/service/src/main.c index 68cac0d36fd7c..dc476cf92a585 100644 --- a/tests/net/socket/service/src/main.c +++ b/tests/net/socket/service/src/main.c @@ -55,9 +55,9 @@ static void tcp_server_handler(struct k_work *work) Z_SPIN_DELAY(100); } -NET_SOCKET_SERVICE_SYNC_DEFINE(udp_service_sync, NULL, server_handler, 2); -NET_SOCKET_SERVICE_SYNC_DEFINE(tcp_service_small_sync, NULL, tcp_server_handler, 1); -NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(tcp_service_sync, NULL, tcp_server_handler, 2); +NET_SOCKET_SERVICE_SYNC_DEFINE(udp_service_sync, server_handler, 2); +NET_SOCKET_SERVICE_SYNC_DEFINE(tcp_service_small_sync, tcp_server_handler, 1); +NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(tcp_service_sync, tcp_server_handler, 2); void run_test_service(const struct net_socket_service_desc *udp_service, From 1bafa95f5049b030e54afbe10888255b0f83d8bc Mon Sep 17 00:00:00 2001 From: Ayush Singh Date: Sun, 6 Oct 2024 09:25:11 +0530 Subject: [PATCH 0503/4482] samples: net: sockets: echo_client: Add 802154-subg test - Using beagleconnect freedom for testing subg overlay Signed-off-by: Ayush Singh --- samples/net/sockets/echo_client/sample.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/samples/net/sockets/echo_client/sample.yaml b/samples/net/sockets/echo_client/sample.yaml index 2f3d58fb81c68..4bfdfe9cfcecd 100644 --- a/samples/net/sockets/echo_client/sample.yaml +++ b/samples/net/sockets/echo_client/sample.yaml @@ -106,3 +106,6 @@ tests: - qemu_x86_64 integration_platforms: - qemu_x86 + sample.net.sockets.echo_client.802154.subg: + extra_args: EXTRA_CONF_FILE="overlay-802154-subg.conf" + platform_allow: beagleconnect_freedom From 40d8926b20e5fa065bc3f694b5925ec0c1d86b59 Mon Sep 17 00:00:00 2001 From: Ayush Singh Date: Tue, 8 Oct 2024 20:42:35 +0530 Subject: [PATCH 0504/4482] samples: net: sockets: echo_server: Add 802154-subg test - Using beagleconnect freedom for testing subg overlay Signed-off-by: Ayush Singh --- samples/net/sockets/echo_server/sample.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/samples/net/sockets/echo_server/sample.yaml b/samples/net/sockets/echo_server/sample.yaml index b1f2b6009e2c5..949b34e9cbb23 100644 --- a/samples/net/sockets/echo_server/sample.yaml +++ b/samples/net/sockets/echo_server/sample.yaml @@ -142,3 +142,6 @@ tests: - native_sim/native/64 extra_args: - OVERLAY_CONFIG="overlay-nsos.conf" + sample.net.sockets.echo_server.802154.subg: + extra_args: EXTRA_CONF_FILE="overlay-802154-subg.conf" + platform_allow: beagleconnect_freedom From d8f3bfa7a291c0dfbf252a2b89b8563eb3533c23 Mon Sep 17 00:00:00 2001 From: Ayush Singh Date: Tue, 8 Oct 2024 20:42:58 +0530 Subject: [PATCH 0505/4482] samples: net: zperf: Add 802154-subg test - Using beagleconnect freedom for testing subg overlay Signed-off-by: Ayush Singh --- samples/net/zperf/sample.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/samples/net/zperf/sample.yaml b/samples/net/zperf/sample.yaml index 86e6718bfd2f7..dd00e27f7b2dc 100644 --- a/samples/net/zperf/sample.yaml +++ b/samples/net/zperf/sample.yaml @@ -99,3 +99,6 @@ tests: - zperf platform_allow: - mimxrt1170_evk/mimxrt1176/cm7 + sample.net.zperf.802154.subg: + extra_args: EXTRA_CONF_FILE="overlay-802154-subg.conf" + platform_allow: beagleconnect_freedom From 5b5d6366e30f4b486bc176053253ffd25ddf98e1 Mon Sep 17 00:00:00 2001 From: Ayush Singh Date: Tue, 8 Oct 2024 21:20:11 +0530 Subject: [PATCH 0506/4482] net: l2: ieee802154: shell: Fix stringop-truncation - Fix the warning stringop-truncation - Leave space for NULL terminator. Signed-off-by: Ayush Singh --- subsys/net/l2/ieee802154/ieee802154_shell.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/net/l2/ieee802154/ieee802154_shell.c b/subsys/net/l2/ieee802154/ieee802154_shell.c index 89b12a54de010..8a4e6ab0b6c37 100644 --- a/subsys/net/l2/ieee802154/ieee802154_shell.c +++ b/subsys/net/l2/ieee802154/ieee802154_shell.c @@ -79,7 +79,7 @@ static int cmd_ieee802154_associate(const struct shell *sh, size_t argc, char *argv[]) { struct net_if *iface = net_if_get_ieee802154(); - char ext_addr[EXT_ADDR_STR_SIZE]; + char ext_addr[EXT_ADDR_STR_SIZE] = {0}; if (argc < 3) { shell_help(sh); @@ -99,7 +99,7 @@ static int cmd_ieee802154_associate(const struct shell *sh, params = (struct ieee802154_req_params){0}; params.pan_id = atoi(argv[1]); - strncpy(ext_addr, argv[2], sizeof(ext_addr)); + strncpy(ext_addr, argv[2], EXT_ADDR_STR_LEN); if (strlen(ext_addr) == EXT_ADDR_STR_LEN) { if (parse_extended_address(ext_addr, params.addr) < 0) { From 029540abece01361f52025534594a0b333cf0afd Mon Sep 17 00:00:00 2001 From: Yago Fontoura do Rosario Date: Tue, 10 Sep 2024 16:02:24 +0200 Subject: [PATCH 0507/4482] Bluetooth: Controller: Handle overlapping buffers on ull_adv{.c,_aux.c} * Setting the adv data, scan rsp and adv aux ad data can happen on overlapping buffers * There can be other memcpy's that need to be changed to memmove but these are the only ones I could reproduce the issue and since memmove has a performance penalty, I left the others as is. Signed-off-by: Yago Fontoura do Rosario --- subsys/bluetooth/controller/ll_sw/ull_adv.c | 4 ++-- subsys/bluetooth/controller/ll_sw/ull_adv_aux.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv.c b/subsys/bluetooth/controller/ll_sw/ull_adv.c index 32443b6efacc0..c0f2f86bb2ac5 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv.c @@ -1870,7 +1870,7 @@ uint8_t ull_adv_data_set(struct ll_adv_set *adv, uint8_t len, pdu->tx_addr = prev->tx_addr; pdu->rx_addr = prev->rx_addr; - memcpy(&pdu->adv_ind.addr[0], &prev->adv_ind.addr[0], BDADDR_SIZE); + memmove(&pdu->adv_ind.addr[0], &prev->adv_ind.addr[0], BDADDR_SIZE); memcpy(&pdu->adv_ind.data[0], data, len); pdu->len = BDADDR_SIZE + len; @@ -1926,7 +1926,7 @@ uint8_t ull_scan_rsp_set(struct ll_adv_set *adv, uint8_t len, pdu->tx_addr = prev->tx_addr; pdu->rx_addr = 0; pdu->len = BDADDR_SIZE + len; - memcpy(&pdu->scan_rsp.addr[0], &prev->scan_rsp.addr[0], BDADDR_SIZE); + memmove(&pdu->scan_rsp.addr[0], &prev->scan_rsp.addr[0], BDADDR_SIZE); memcpy(&pdu->scan_rsp.data[0], data, len); /* Update time reservation */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c b/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c index 482239a617a4a..7478bf7332be7 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv_aux.c @@ -2020,7 +2020,7 @@ uint8_t ull_adv_aux_hdr_set_clear(struct ll_adv_set *adv, sec_dptr -= BDADDR_SIZE; - (void)memcpy(sec_dptr, bdaddr, BDADDR_SIZE); + (void)memmove(sec_dptr, bdaddr, BDADDR_SIZE); } /* Set the common extended header format flags in the current primary From 35d05b7198099c7895a385efcf82060da6c9cbf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Wed, 3 Apr 2024 10:39:23 +0200 Subject: [PATCH 0508/4482] mgmt: hawkbit: use K_WORK_DELAYABLE_DEFINE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit staticly init hawkbit_work_handle Signed-off-by: Fin Maaß --- subsys/mgmt/hawkbit/hawkbit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/subsys/mgmt/hawkbit/hawkbit.c b/subsys/mgmt/hawkbit/hawkbit.c index e947294e721ed..10ecb852e964c 100644 --- a/subsys/mgmt/hawkbit/hawkbit.c +++ b/subsys/mgmt/hawkbit/hawkbit.c @@ -145,7 +145,9 @@ int hawkbit_default_config_data_cb(const char *device_id, uint8_t *buffer, static hawkbit_config_device_data_cb_handler_t hawkbit_config_device_data_cb_handler = hawkbit_default_config_data_cb; -static struct k_work_delayable hawkbit_work_handle; +static void autohandler(struct k_work *work); + +static K_WORK_DELAYABLE_DEFINE(hawkbit_work_handle, autohandler); K_SEM_DEFINE(probe_sem, 1, 1); @@ -1529,6 +1531,5 @@ static void autohandler(struct k_work *work) void hawkbit_autohandler(void) { - k_work_init_delayable(&hawkbit_work_handle, autohandler); k_work_reschedule(&hawkbit_work_handle, K_NO_WAIT); } From cf5f6aad23b533f4f82d8c034f54a71bbb537b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Mon, 22 Apr 2024 08:47:48 +0200 Subject: [PATCH 0509/4482] mgmt: hawkbit: add option for autohandler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit add option for autohandler to only run once. Signed-off-by: Fin Maaß --- include/zephyr/mgmt/hawkbit.h | 4 +++- samples/subsys/mgmt/hawkbit/prj.conf | 1 - samples/subsys/mgmt/hawkbit/src/main.c | 2 +- subsys/mgmt/hawkbit/hawkbit.c | 14 +++++++++++--- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/include/zephyr/mgmt/hawkbit.h b/include/zephyr/mgmt/hawkbit.h index 08da3df1b1c59..aa74132c1380e 100644 --- a/include/zephyr/mgmt/hawkbit.h +++ b/include/zephyr/mgmt/hawkbit.h @@ -92,8 +92,10 @@ int hawkbit_init(void); * * @details The hawkbit_autohandler handles the whole process * in pre-determined time intervals. + * + * @param auto_reschedule If true, the handler will reschedule itself */ -void hawkbit_autohandler(void); +void hawkbit_autohandler(bool auto_reschedule); /** * @brief The hawkBit probe verify if there is some update to be performed. diff --git a/samples/subsys/mgmt/hawkbit/prj.conf b/samples/subsys/mgmt/hawkbit/prj.conf index a47b5275f89fd..e25016994855e 100644 --- a/samples/subsys/mgmt/hawkbit/prj.conf +++ b/samples/subsys/mgmt/hawkbit/prj.conf @@ -47,7 +47,6 @@ CONFIG_DNS_SERVER2="192.168.1.1" CONFIG_SHELL=y CONFIG_HAWKBIT_SHELL=y CONFIG_KERNEL_SHELL=y -CONFIG_SHELL_STACK_SIZE=4096 #hawkBit polling mode CONFIG_HAWKBIT_POLLING=y diff --git a/samples/subsys/mgmt/hawkbit/src/main.c b/samples/subsys/mgmt/hawkbit/src/main.c index b8323b308a168..b4204d3610e00 100644 --- a/samples/subsys/mgmt/hawkbit/src/main.c +++ b/samples/subsys/mgmt/hawkbit/src/main.c @@ -83,7 +83,7 @@ int main(void) #if defined(CONFIG_HAWKBIT_POLLING) LOG_INF("Starting hawkBit polling mode"); - hawkbit_autohandler(); + hawkbit_autohandler(true); #endif #if defined(CONFIG_HAWKBIT_MANUAL) diff --git a/subsys/mgmt/hawkbit/hawkbit.c b/subsys/mgmt/hawkbit/hawkbit.c index 10ecb852e964c..8612e7cfd6925 100644 --- a/subsys/mgmt/hawkbit/hawkbit.c +++ b/subsys/mgmt/hawkbit/hawkbit.c @@ -148,6 +148,7 @@ static hawkbit_config_device_data_cb_handler_t hawkbit_config_device_data_cb_han static void autohandler(struct k_work *work); static K_WORK_DELAYABLE_DEFINE(hawkbit_work_handle, autohandler); +static K_WORK_DELAYABLE_DEFINE(hawkbit_work_handle_once, autohandler); K_SEM_DEFINE(probe_sem, 1, 1); @@ -1526,10 +1527,17 @@ static void autohandler(struct k_work *work) break; } - k_work_reschedule(&hawkbit_work_handle, K_SECONDS(poll_sleep)); + if (k_work_delayable_from_work(work) == &hawkbit_work_handle) { + k_work_reschedule(&hawkbit_work_handle, K_SECONDS(poll_sleep)); + } +} } -void hawkbit_autohandler(void) +void hawkbit_autohandler(bool auto_reschedule) { - k_work_reschedule(&hawkbit_work_handle, K_NO_WAIT); + if (auto_reschedule) { + k_work_reschedule(&hawkbit_work_handle, K_NO_WAIT); + } else { + k_work_reschedule(&hawkbit_work_handle_once, K_NO_WAIT); + } } From 6cc2bb53b4c5845e781419cebec3e574b1573cf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Mon, 22 Apr 2024 08:49:11 +0200 Subject: [PATCH 0510/4482] mgmt: hawkbit: add hawkbit_autohandler_wait MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add hawkbit_autohandler_wait() to be able to wait for the autohandler to finish. Signed-off-by: Fin Maaß --- include/zephyr/mgmt/hawkbit.h | 25 +++++++++++++++++++++++++ subsys/mgmt/hawkbit/Kconfig | 1 + subsys/mgmt/hawkbit/hawkbit.c | 25 ++++++++++++++++++++++++- 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/include/zephyr/mgmt/hawkbit.h b/include/zephyr/mgmt/hawkbit.h index aa74132c1380e..ae3a58a704859 100644 --- a/include/zephyr/mgmt/hawkbit.h +++ b/include/zephyr/mgmt/hawkbit.h @@ -26,6 +26,7 @@ * */ enum hawkbit_response { + HAWKBIT_NO_RESPONSE, HAWKBIT_NETWORKING_ERROR, HAWKBIT_UNCONFIRMED_IMAGE, HAWKBIT_PERMISSION_ERROR, @@ -97,6 +98,30 @@ int hawkbit_init(void); */ void hawkbit_autohandler(bool auto_reschedule); +/** + * @brief Wait for the autohandler to finish. + * + * @param events Set of desired events on which to wait. Set to ::UINT32_MAX to wait for the + * autohandler to finish one run, or BIT() together with a value from + * ::hawkbit_response to wait for a specific event. + * @param timeout Waiting period for the desired set of events or one of the + * special values ::K_NO_WAIT and ::K_FOREVER. + * + * @retval HAWKBIT_OK if success. + * @retval HAWKBIT_NO_RESPONSE if matching events were not received within the specified time + * @retval HAWKBIT_NETWORKING_ERROR fail to connect to the hawkBit server. + * @retval HAWKBIT_UNCONFIRMED_IMAGE image is unconfirmed. + * @retval HAWKBIT_PERMISSION_ERROR fail to get the permission to access the hawkBit server. + * @retval HAWKBIT_METADATA_ERROR fail to parse or to encode the metadata. + * @retval HAWKBIT_DOWNLOAD_ERROR fail while downloading the update package. + * @retval HAWKBIT_UPDATE_INSTALLED if an update was installed. Reboot is required to apply it. + * @retval HAWKBIT_NO_UPDATE if no update was available. + * @retval HAWKBIT_CANCEL_UPDATE update was cancelled. + * @retval HAWKBIT_NOT_INITIALIZED if hawkBit is not initialized. + * @retval HAWKBIT_PROBE_IN_PROGRESS if probe is currently running. + */ +enum hawkbit_response hawkbit_autohandler_wait(uint32_t events, k_timeout_t timeout); + /** * @brief The hawkBit probe verify if there is some update to be performed. * diff --git a/subsys/mgmt/hawkbit/Kconfig b/subsys/mgmt/hawkbit/Kconfig index 614f4fd6bfb43..be93796e5a350 100644 --- a/subsys/mgmt/hawkbit/Kconfig +++ b/subsys/mgmt/hawkbit/Kconfig @@ -15,6 +15,7 @@ menuconfig HAWKBIT depends on DNS_RESOLVER depends on JSON_LIBRARY depends on BOOTLOADER_MCUBOOT + select EVENTS select MPU_ALLOW_FLASH_WRITE select IMG_ENABLE_IMAGE_CHECK select IMG_ERASE_PROGRESSIVELY diff --git a/subsys/mgmt/hawkbit/hawkbit.c b/subsys/mgmt/hawkbit/hawkbit.c index 8612e7cfd6925..9692d9e314b2c 100644 --- a/subsys/mgmt/hawkbit/hawkbit.c +++ b/subsys/mgmt/hawkbit/hawkbit.c @@ -150,6 +150,8 @@ static void autohandler(struct k_work *work); static K_WORK_DELAYABLE_DEFINE(hawkbit_work_handle, autohandler); static K_WORK_DELAYABLE_DEFINE(hawkbit_work_handle_once, autohandler); +static K_EVENT_DEFINE(hawkbit_autohandler_event); + K_SEM_DEFINE(probe_sem, 1, 1); static const struct json_obj_descr json_href_descr[] = { @@ -1476,7 +1478,13 @@ enum hawkbit_response hawkbit_probe(void) static void autohandler(struct k_work *work) { - switch (hawkbit_probe()) { + k_event_clear(&hawkbit_autohandler_event, UINT32_MAX); + + enum hawkbit_response response = hawkbit_probe(); + + k_event_set(&hawkbit_autohandler_event, BIT(response)); + + switch (response) { case HAWKBIT_UNCONFIRMED_IMAGE: LOG_ERR("Current image is not confirmed"); LOG_ERR("Rebooting to previous confirmed image"); @@ -1525,12 +1533,27 @@ static void autohandler(struct k_work *work) case HAWKBIT_PROBE_IN_PROGRESS: LOG_INF("hawkBit is already running"); break; + + default: + LOG_ERR("Invalid response: %d", response); + break; } if (k_work_delayable_from_work(work) == &hawkbit_work_handle) { k_work_reschedule(&hawkbit_work_handle, K_SECONDS(poll_sleep)); } } + +enum hawkbit_response hawkbit_autohandler_wait(uint32_t events, k_timeout_t timeout) +{ + uint32_t ret = k_event_wait(&hawkbit_autohandler_event, events, false, timeout); + + for (int i = 1; i < HAWKBIT_PROBE_IN_PROGRESS; i++) { + if (ret & BIT(i)) { + return i; + } + } + return HAWKBIT_NO_RESPONSE; } void hawkbit_autohandler(bool auto_reschedule) From 4655ef317ec1f38616c78575f7bb34fb27e9f5d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Mon, 15 Apr 2024 11:11:03 +0200 Subject: [PATCH 0511/4482] mgmt: hawkbit: also use workqueue for shell run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also use a workqueue, when execution of hawkBit is requested via shell. Signed-off-by: Fin Maaß --- subsys/mgmt/hawkbit/shell.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/subsys/mgmt/hawkbit/shell.c b/subsys/mgmt/hawkbit/shell.c index f4df6474cd11e..5dda66cf36f04 100644 --- a/subsys/mgmt/hawkbit/shell.c +++ b/subsys/mgmt/hawkbit/shell.c @@ -20,7 +20,9 @@ static void cmd_run(const struct shell *sh, size_t argc, char **argv) shell_info(sh, "Starting hawkBit run..."); - switch (hawkbit_probe()) { + hawkbit_autohandler(false); + + switch (hawkbit_autohandler_wait(UINT32_MAX, K_FOREVER)) { case HAWKBIT_UNCONFIRMED_IMAGE: shell_error(sh, "Image is unconfirmed." "Rebooting to revert back to previous confirmed image"); @@ -40,7 +42,6 @@ static void cmd_run(const struct shell *sh, size_t argc, char **argv) case HAWKBIT_UPDATE_INSTALLED: shell_info(sh, "Update installed"); - hawkbit_reboot(); break; case HAWKBIT_DOWNLOAD_ERROR: From f5a3d7dd8fbcb0d76341d3a79e46da37aae52495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Mon, 22 Apr 2024 10:06:53 +0200 Subject: [PATCH 0512/4482] mgmt: hawkbit: log start of autohandler from shell MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the run of the autohandler is started from shell, it will be logged. Signed-off-by: Fin Maaß --- subsys/mgmt/hawkbit/shell.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/subsys/mgmt/hawkbit/shell.c b/subsys/mgmt/hawkbit/shell.c index 5dda66cf36f04..e10012786f503 100644 --- a/subsys/mgmt/hawkbit/shell.c +++ b/subsys/mgmt/hawkbit/shell.c @@ -13,13 +13,16 @@ #include "hawkbit_firmware.h" #include "hawkbit_device.h" +LOG_MODULE_DECLARE(hawkbit, CONFIG_HAWKBIT_LOG_LEVEL); + static void cmd_run(const struct shell *sh, size_t argc, char **argv) { ARG_UNUSED(argc); ARG_UNUSED(argv); - + LOG_INF("Run started from %s", sh->name); shell_info(sh, "Starting hawkBit run..."); + hawkbit_autohandler(false); switch (hawkbit_autohandler_wait(UINT32_MAX, K_FOREVER)) { From 421ab502e46eb8fb913f64f557b95590381e3652 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Wed, 24 Apr 2024 11:37:18 +0200 Subject: [PATCH 0513/4482] mgmt: hawkbit: delay autohandler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Be able to delay the next run of the hawkbit autohandler. Signed-off-by: Fin Maaß --- include/zephyr/mgmt/hawkbit.h | 22 ++++++++++++++++++++++ subsys/mgmt/hawkbit/hawkbit.c | 18 ++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/include/zephyr/mgmt/hawkbit.h b/include/zephyr/mgmt/hawkbit.h index ae3a58a704859..fc69a74080cb0 100644 --- a/include/zephyr/mgmt/hawkbit.h +++ b/include/zephyr/mgmt/hawkbit.h @@ -122,6 +122,28 @@ void hawkbit_autohandler(bool auto_reschedule); */ enum hawkbit_response hawkbit_autohandler_wait(uint32_t events, k_timeout_t timeout); +/** + * @brief Cancel the run of the hawkBit autohandler. + * + * @return a value from k_work_cancel_delayable(). + */ +int hawkbit_autohandler_cancel(void); + +/** + * @brief Set the delay for the next run of the autohandler. + * + * @details This function will only delay the next run of the autohandler. The delay will not + * persist after the autohandler runs. + * + * @param timeout The delay to set. + * @param if_bigger If true, the delay will be set only if the new delay is bigger than the current + * one. + * + * @retval 0 if @a if_bigger was true and the current delay was bigger than the new one. + * @retval otherwise, a value from k_work_reschedule(). + */ +int hawkbit_autohandler_set_delay(k_timeout_t timeout, bool if_bigger); + /** * @brief The hawkBit probe verify if there is some update to be performed. * diff --git a/subsys/mgmt/hawkbit/hawkbit.c b/subsys/mgmt/hawkbit/hawkbit.c index 9692d9e314b2c..dbef4277cb832 100644 --- a/subsys/mgmt/hawkbit/hawkbit.c +++ b/subsys/mgmt/hawkbit/hawkbit.c @@ -1556,6 +1556,24 @@ enum hawkbit_response hawkbit_autohandler_wait(uint32_t events, k_timeout_t time return HAWKBIT_NO_RESPONSE; } +int hawkbit_autohandler_cancel(void) +{ + return k_work_cancel_delayable(&hawkbit_work_handle); +} + +int hawkbit_autohandler_set_delay(k_timeout_t timeout, bool if_bigger) +{ + if (!if_bigger || timeout.ticks > k_work_delayable_remaining_get(&hawkbit_work_handle)) { + hawkbit_autohandler_cancel(); + LOG_INF("Setting new delay for next run: %02u:%02u:%02u", + (uint32_t)(timeout.ticks / CONFIG_SYS_CLOCK_TICKS_PER_SEC) / 3600, + (uint32_t)((timeout.ticks / CONFIG_SYS_CLOCK_TICKS_PER_SEC) % 3600) / 60, + (uint32_t)(timeout.ticks / CONFIG_SYS_CLOCK_TICKS_PER_SEC) % 60); + return k_work_reschedule(&hawkbit_work_handle, timeout); + } + return 0; +} + void hawkbit_autohandler(bool auto_reschedule) { if (auto_reschedule) { From a71fc667fbbeb97e93cae0d55a2e86b0543abcb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Mon, 29 Apr 2024 10:19:06 +0200 Subject: [PATCH 0514/4482] doc: releases: 4.0: change of hawkbit autohandler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mention change of hawkbit autohandler and shell in the migration guide and the release notes. Signed-off-by: Fin Maaß --- doc/releases/migration-guide-4.0.rst | 3 +++ doc/releases/release-notes-4.0.rst | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 6a00ed2d9ec25..1b966683df82f 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -470,6 +470,9 @@ Flash map hawkBit ======= +* :c:func:`hawkbit_autohandler` now takes one argument. This argument has to be set to + ``true`` for the same behavior as before the change. (:github:`71037`) + MCUmgr ====== diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index a00d66cb9bd04..4a8e03d9e7db7 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -355,6 +355,22 @@ Libraries / Subsystems * Added support for img mgmt slot info command, which allows for listing information on images and slots on the device. + * hawkBit + + * :c:func:`hawkbit_autohandler` now takes one argument. If the argument is set to true, the + autohandler will reshedule itself after running. If the argument is set to false, the + autohandler will not reshedule itself. Both variants are sheduled independent of each other. + The autohandler always runs in the system workqueue. + + * Use the :c:func:`hawkbit_autohandler_wait` function to wait for the autohandler to finish. + + * Running hawkBit from the shell is now executed in the system workqueue. + + * Use the :c:func:`hawkbit_autohandler_cancel` function to cancel the autohandler. + + * Use the :c:func:`hawkbit_autohandler_set_delay` function to delay the next run of the + autohandler. + * Logging * Modem modules From 621cf5baec7fed157240da364466b1cb5ab83116 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Tue, 21 May 2024 16:57:55 +0200 Subject: [PATCH 0515/4482] mgmt: hawkbit: get poll interval MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add function to get the poll interval. This is needed to seperate the autohandler from the main hawkbit code. Signed-off-by: Fin Maaß --- include/zephyr/mgmt/hawkbit.h | 7 +++++++ subsys/mgmt/hawkbit/hawkbit.c | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/include/zephyr/mgmt/hawkbit.h b/include/zephyr/mgmt/hawkbit.h index fc69a74080cb0..bc42f784d20e5 100644 --- a/include/zephyr/mgmt/hawkbit.h +++ b/include/zephyr/mgmt/hawkbit.h @@ -310,6 +310,13 @@ static inline sec_tag_t hawkbit_get_tls_tag(void) */ int32_t hawkbit_get_action_id(void); +/** + * @brief Get the hawkBit poll interval. + * + * @return Poll interval. + */ +uint32_t hawkbit_get_poll_interval(void); + /** * @brief Resets the hawkBit action id, that is saved in settings. * diff --git a/subsys/mgmt/hawkbit/hawkbit.c b/subsys/mgmt/hawkbit/hawkbit.c index dbef4277cb832..c2c4c0ee6a5d3 100644 --- a/subsys/mgmt/hawkbit/hawkbit.c +++ b/subsys/mgmt/hawkbit/hawkbit.c @@ -506,6 +506,11 @@ int32_t hawkbit_get_action_id(void) return hb_cfg.action_id; } +uint32_t hawkbit_get_poll_interval(void) +{ + return poll_sleep; +} + /* * Update sleep interval, based on results from hawkBit base polling * resource From dce3d2de6684d6548897ba2af6fa00ad85d8ede4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Tue, 21 May 2024 17:11:00 +0200 Subject: [PATCH 0516/4482] mgmt: hawkbit: seperate autohandler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit seperate the autohandler from the main hawkbit source. This way the autohandler can be disabled if it is not needed. Signed-off-by: Fin Maaß --- include/zephyr/mgmt/hawkbit.h | 120 +++++++++++---------- subsys/mgmt/hawkbit/CMakeLists.txt | 1 + subsys/mgmt/hawkbit/Kconfig | 9 +- subsys/mgmt/hawkbit/hawkbit.c | 114 -------------------- subsys/mgmt/hawkbit/hawkbit_autohandler.c | 125 ++++++++++++++++++++++ 5 files changed, 198 insertions(+), 171 deletions(-) create mode 100644 subsys/mgmt/hawkbit/hawkbit_autohandler.c diff --git a/include/zephyr/mgmt/hawkbit.h b/include/zephyr/mgmt/hawkbit.h index bc42f784d20e5..d0e5701eca181 100644 --- a/include/zephyr/mgmt/hawkbit.h +++ b/include/zephyr/mgmt/hawkbit.h @@ -88,62 +88,6 @@ int hawkbit_set_custom_data_cb(hawkbit_config_device_data_cb_handler_t cb); */ int hawkbit_init(void); -/** - * @brief Runs hawkBit probe and hawkBit update automatically - * - * @details The hawkbit_autohandler handles the whole process - * in pre-determined time intervals. - * - * @param auto_reschedule If true, the handler will reschedule itself - */ -void hawkbit_autohandler(bool auto_reschedule); - -/** - * @brief Wait for the autohandler to finish. - * - * @param events Set of desired events on which to wait. Set to ::UINT32_MAX to wait for the - * autohandler to finish one run, or BIT() together with a value from - * ::hawkbit_response to wait for a specific event. - * @param timeout Waiting period for the desired set of events or one of the - * special values ::K_NO_WAIT and ::K_FOREVER. - * - * @retval HAWKBIT_OK if success. - * @retval HAWKBIT_NO_RESPONSE if matching events were not received within the specified time - * @retval HAWKBIT_NETWORKING_ERROR fail to connect to the hawkBit server. - * @retval HAWKBIT_UNCONFIRMED_IMAGE image is unconfirmed. - * @retval HAWKBIT_PERMISSION_ERROR fail to get the permission to access the hawkBit server. - * @retval HAWKBIT_METADATA_ERROR fail to parse or to encode the metadata. - * @retval HAWKBIT_DOWNLOAD_ERROR fail while downloading the update package. - * @retval HAWKBIT_UPDATE_INSTALLED if an update was installed. Reboot is required to apply it. - * @retval HAWKBIT_NO_UPDATE if no update was available. - * @retval HAWKBIT_CANCEL_UPDATE update was cancelled. - * @retval HAWKBIT_NOT_INITIALIZED if hawkBit is not initialized. - * @retval HAWKBIT_PROBE_IN_PROGRESS if probe is currently running. - */ -enum hawkbit_response hawkbit_autohandler_wait(uint32_t events, k_timeout_t timeout); - -/** - * @brief Cancel the run of the hawkBit autohandler. - * - * @return a value from k_work_cancel_delayable(). - */ -int hawkbit_autohandler_cancel(void); - -/** - * @brief Set the delay for the next run of the autohandler. - * - * @details This function will only delay the next run of the autohandler. The delay will not - * persist after the autohandler runs. - * - * @param timeout The delay to set. - * @param if_bigger If true, the delay will be set only if the new delay is bigger than the current - * one. - * - * @retval 0 if @a if_bigger was true and the current delay was bigger than the new one. - * @retval otherwise, a value from k_work_reschedule(). - */ -int hawkbit_autohandler_set_delay(k_timeout_t timeout, bool if_bigger); - /** * @brief The hawkBit probe verify if there is some update to be performed. * @@ -330,6 +274,70 @@ uint32_t hawkbit_get_poll_interval(void); int hawkbit_reset_action_id(void); /** + * @brief hawkBit autohandler. + * @defgroup hawkbit_autohandler hawkBit autohandler + * @ingroup hawkbit + * @{ + */ + +/** + * @brief Runs hawkBit probe and hawkBit update automatically + * + * @details The hawkbit_autohandler handles the whole process + * in pre-determined time intervals. + * + * @param auto_reschedule If true, the handler will reschedule itself + */ +void hawkbit_autohandler(bool auto_reschedule); + +/** + * @brief Wait for the autohandler to finish. + * + * @param events Set of desired events on which to wait. Set to ::UINT32_MAX to wait for the + * autohandler to finish one run, or BIT() together with a value from + * ::hawkbit_response to wait for a specific event. + * @param timeout Waiting period for the desired set of events or one of the + * special values ::K_NO_WAIT and ::K_FOREVER. + * + * @retval HAWKBIT_OK if success. + * @retval HAWKBIT_NO_RESPONSE if matching events were not received within the specified time + * @retval HAWKBIT_NETWORKING_ERROR fail to connect to the hawkBit server. + * @retval HAWKBIT_UNCONFIRMED_IMAGE image is unconfirmed. + * @retval HAWKBIT_PERMISSION_ERROR fail to get the permission to access the hawkBit server. + * @retval HAWKBIT_METADATA_ERROR fail to parse or to encode the metadata. + * @retval HAWKBIT_DOWNLOAD_ERROR fail while downloading the update package. + * @retval HAWKBIT_UPDATE_INSTALLED if an update was installed. Reboot is required to apply it. + * @retval HAWKBIT_NO_UPDATE if no update was available. + * @retval HAWKBIT_CANCEL_UPDATE update was cancelled. + * @retval HAWKBIT_NOT_INITIALIZED if hawkBit is not initialized. + * @retval HAWKBIT_PROBE_IN_PROGRESS if probe is currently running. + */ +enum hawkbit_response hawkbit_autohandler_wait(uint32_t events, k_timeout_t timeout); + +/** + * @brief Cancel the run of the hawkBit autohandler. + * + * @return a value from k_work_cancel_delayable(). + */ +int hawkbit_autohandler_cancel(void); + +/** + * @brief Set the delay for the next run of the autohandler. + * + * @details This function will only delay the next run of the autohandler. The delay will not + * persist after the autohandler runs. + * + * @param timeout The delay to set. + * @param if_bigger If true, the delay will be set only if the new delay is bigger than the current + * one. + * + * @retval 0 if @a if_bigger was true and the current delay was bigger than the new one. + * @retval otherwise, a value from k_work_reschedule(). + */ +int hawkbit_autohandler_set_delay(k_timeout_t timeout, bool if_bigger); + +/** + * @} * @} */ diff --git a/subsys/mgmt/hawkbit/CMakeLists.txt b/subsys/mgmt/hawkbit/CMakeLists.txt index a3df2953faf4e..2e912dd78e116 100644 --- a/subsys/mgmt/hawkbit/CMakeLists.txt +++ b/subsys/mgmt/hawkbit/CMakeLists.txt @@ -7,6 +7,7 @@ zephyr_library() zephyr_library_sources_ifdef(CONFIG_HAWKBIT hawkbit.c) +zephyr_library_sources_ifdef(CONFIG_HAWKBIT_AUTOHANDLER hawkbit_autohandler.c) zephyr_library_sources_ifdef(CONFIG_HAWKBIT hawkbit_device.c) zephyr_library_sources_ifdef(CONFIG_HAWKBIT hawkbit_firmware.c) zephyr_library_sources_ifdef(CONFIG_HAWKBIT_SHELL shell.c) diff --git a/subsys/mgmt/hawkbit/Kconfig b/subsys/mgmt/hawkbit/Kconfig index be93796e5a350..94aab3b8de6b0 100644 --- a/subsys/mgmt/hawkbit/Kconfig +++ b/subsys/mgmt/hawkbit/Kconfig @@ -15,7 +15,6 @@ menuconfig HAWKBIT depends on DNS_RESOLVER depends on JSON_LIBRARY depends on BOOTLOADER_MCUBOOT - select EVENTS select MPU_ALLOW_FLASH_WRITE select IMG_ENABLE_IMAGE_CHECK select IMG_ERASE_PROGRESSIVELY @@ -34,9 +33,17 @@ config HAWKBIT_POLL_INTERVAL This time interval is zero and 43200 minutes(30 days). This will be overridden by the value configured in the settings of the hawkBit server. +config HAWKBIT_AUTOHANDLER + bool "hawkBit autohandler" + select EVENTS + default y + help + Activate autohandler to handle the update process automatically. + config HAWKBIT_SHELL bool "hawkBit shell utilities" depends on SHELL + depends on HAWKBIT_AUTOHANDLER help Activate shell module that provides hawkBit commands. diff --git a/subsys/mgmt/hawkbit/hawkbit.c b/subsys/mgmt/hawkbit/hawkbit.c index c2c4c0ee6a5d3..34b29cc502032 100644 --- a/subsys/mgmt/hawkbit/hawkbit.c +++ b/subsys/mgmt/hawkbit/hawkbit.c @@ -145,13 +145,6 @@ int hawkbit_default_config_data_cb(const char *device_id, uint8_t *buffer, static hawkbit_config_device_data_cb_handler_t hawkbit_config_device_data_cb_handler = hawkbit_default_config_data_cb; -static void autohandler(struct k_work *work); - -static K_WORK_DELAYABLE_DEFINE(hawkbit_work_handle, autohandler); -static K_WORK_DELAYABLE_DEFINE(hawkbit_work_handle_once, autohandler); - -static K_EVENT_DEFINE(hawkbit_autohandler_event); - K_SEM_DEFINE(probe_sem, 1, 1); static const struct json_obj_descr json_href_descr[] = { @@ -1480,110 +1473,3 @@ enum hawkbit_response hawkbit_probe(void) k_sem_give(&probe_sem); return hb_context.code_status; } - -static void autohandler(struct k_work *work) -{ - k_event_clear(&hawkbit_autohandler_event, UINT32_MAX); - - enum hawkbit_response response = hawkbit_probe(); - - k_event_set(&hawkbit_autohandler_event, BIT(response)); - - switch (response) { - case HAWKBIT_UNCONFIRMED_IMAGE: - LOG_ERR("Current image is not confirmed"); - LOG_ERR("Rebooting to previous confirmed image"); - LOG_ERR("If this image is flashed using a hardware tool"); - LOG_ERR("Make sure that it is a confirmed image"); - hawkbit_reboot(); - break; - - case HAWKBIT_NO_UPDATE: - LOG_INF("No update found"); - break; - - case HAWKBIT_CANCEL_UPDATE: - LOG_INF("hawkBit update cancelled from server"); - break; - - case HAWKBIT_OK: - LOG_INF("Image is already updated"); - break; - - case HAWKBIT_UPDATE_INSTALLED: - LOG_INF("Update installed"); - hawkbit_reboot(); - break; - - case HAWKBIT_DOWNLOAD_ERROR: - LOG_INF("Update failed"); - break; - - case HAWKBIT_NETWORKING_ERROR: - LOG_INF("Network error"); - break; - - case HAWKBIT_PERMISSION_ERROR: - LOG_INF("Permission error"); - break; - - case HAWKBIT_METADATA_ERROR: - LOG_INF("Metadata error"); - break; - - case HAWKBIT_NOT_INITIALIZED: - LOG_INF("hawkBit not initialized"); - break; - - case HAWKBIT_PROBE_IN_PROGRESS: - LOG_INF("hawkBit is already running"); - break; - - default: - LOG_ERR("Invalid response: %d", response); - break; - } - - if (k_work_delayable_from_work(work) == &hawkbit_work_handle) { - k_work_reschedule(&hawkbit_work_handle, K_SECONDS(poll_sleep)); - } -} - -enum hawkbit_response hawkbit_autohandler_wait(uint32_t events, k_timeout_t timeout) -{ - uint32_t ret = k_event_wait(&hawkbit_autohandler_event, events, false, timeout); - - for (int i = 1; i < HAWKBIT_PROBE_IN_PROGRESS; i++) { - if (ret & BIT(i)) { - return i; - } - } - return HAWKBIT_NO_RESPONSE; -} - -int hawkbit_autohandler_cancel(void) -{ - return k_work_cancel_delayable(&hawkbit_work_handle); -} - -int hawkbit_autohandler_set_delay(k_timeout_t timeout, bool if_bigger) -{ - if (!if_bigger || timeout.ticks > k_work_delayable_remaining_get(&hawkbit_work_handle)) { - hawkbit_autohandler_cancel(); - LOG_INF("Setting new delay for next run: %02u:%02u:%02u", - (uint32_t)(timeout.ticks / CONFIG_SYS_CLOCK_TICKS_PER_SEC) / 3600, - (uint32_t)((timeout.ticks / CONFIG_SYS_CLOCK_TICKS_PER_SEC) % 3600) / 60, - (uint32_t)(timeout.ticks / CONFIG_SYS_CLOCK_TICKS_PER_SEC) % 60); - return k_work_reschedule(&hawkbit_work_handle, timeout); - } - return 0; -} - -void hawkbit_autohandler(bool auto_reschedule) -{ - if (auto_reschedule) { - k_work_reschedule(&hawkbit_work_handle, K_NO_WAIT); - } else { - k_work_reschedule(&hawkbit_work_handle_once, K_NO_WAIT); - } -} diff --git a/subsys/mgmt/hawkbit/hawkbit_autohandler.c b/subsys/mgmt/hawkbit/hawkbit_autohandler.c new file mode 100644 index 0000000000000..cbb8bcd611dbf --- /dev/null +++ b/subsys/mgmt/hawkbit/hawkbit_autohandler.c @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2024 Vogl Electronic GmbH + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +LOG_MODULE_DECLARE(hawkbit); + +static void autohandler(struct k_work *work); + +static K_WORK_DELAYABLE_DEFINE(hawkbit_work_handle, autohandler); +static K_WORK_DELAYABLE_DEFINE(hawkbit_work_handle_once, autohandler); + +static K_EVENT_DEFINE(hawkbit_autohandler_event); + +static void autohandler(struct k_work *work) +{ + k_event_clear(&hawkbit_autohandler_event, UINT32_MAX); + + enum hawkbit_response response = hawkbit_probe(); + + k_event_set(&hawkbit_autohandler_event, BIT(response)); + + switch (response) { + case HAWKBIT_UNCONFIRMED_IMAGE: + LOG_ERR("Current image is not confirmed"); + LOG_ERR("Rebooting to previous confirmed image"); + LOG_ERR("If this image is flashed using a hardware tool"); + LOG_ERR("Make sure that it is a confirmed image"); + hawkbit_reboot(); + break; + + case HAWKBIT_NO_UPDATE: + LOG_INF("No update found"); + break; + + case HAWKBIT_CANCEL_UPDATE: + LOG_INF("hawkBit update cancelled from server"); + break; + + case HAWKBIT_OK: + LOG_INF("Image is already updated"); + break; + + case HAWKBIT_UPDATE_INSTALLED: + LOG_INF("Update installed"); + hawkbit_reboot(); + break; + + case HAWKBIT_DOWNLOAD_ERROR: + LOG_INF("Update failed"); + break; + + case HAWKBIT_NETWORKING_ERROR: + LOG_INF("Network error"); + break; + + case HAWKBIT_PERMISSION_ERROR: + LOG_INF("Permission error"); + break; + + case HAWKBIT_METADATA_ERROR: + LOG_INF("Metadata error"); + break; + + case HAWKBIT_NOT_INITIALIZED: + LOG_INF("hawkBit not initialized"); + break; + + case HAWKBIT_PROBE_IN_PROGRESS: + LOG_INF("hawkBit is already running"); + break; + + default: + LOG_ERR("Invalid response: %d", response); + break; + } + + if (k_work_delayable_from_work(work) == &hawkbit_work_handle) { + k_work_reschedule(&hawkbit_work_handle, K_SECONDS(hawkbit_get_poll_interval())); + } +} + +enum hawkbit_response hawkbit_autohandler_wait(uint32_t events, k_timeout_t timeout) +{ + uint32_t ret = k_event_wait(&hawkbit_autohandler_event, events, false, timeout); + + for (int i = 1; i < HAWKBIT_PROBE_IN_PROGRESS; i++) { + if (ret & BIT(i)) { + return i; + } + } + return HAWKBIT_NO_RESPONSE; +} + +int hawkbit_autohandler_cancel(void) +{ + return k_work_cancel_delayable(&hawkbit_work_handle); +} + +int hawkbit_autohandler_set_delay(k_timeout_t timeout, bool if_bigger) +{ + if (!if_bigger || timeout.ticks > k_work_delayable_remaining_get(&hawkbit_work_handle)) { + hawkbit_autohandler_cancel(); + LOG_INF("Setting new delay for next run: %02u:%02u:%02u", + (uint32_t)(timeout.ticks / CONFIG_SYS_CLOCK_TICKS_PER_SEC) / 3600, + (uint32_t)((timeout.ticks / CONFIG_SYS_CLOCK_TICKS_PER_SEC) % 3600) / 60, + (uint32_t)(timeout.ticks / CONFIG_SYS_CLOCK_TICKS_PER_SEC) % 60); + return k_work_reschedule(&hawkbit_work_handle, timeout); + } + return 0; +} + +void hawkbit_autohandler(bool auto_reschedule) +{ + if (auto_reschedule) { + k_work_reschedule(&hawkbit_work_handle, K_NO_WAIT); + } else { + k_work_reschedule(&hawkbit_work_handle_once, K_NO_WAIT); + } +} From 94bad9d9ac5b385233088d0135a746f07d7767e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Wed, 5 Jun 2024 11:13:56 +0200 Subject: [PATCH 0517/4482] mgmt: hawkbit: seperate header files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit seperate the hawkbit header files, to make it clearer. Signed-off-by: Fin Maaß --- MAINTAINERS.yml | 1 + include/zephyr/mgmt/hawkbit.h | 342 +--------------------- include/zephyr/mgmt/hawkbit/autohandler.h | 73 +++++ include/zephyr/mgmt/hawkbit/config.h | 192 ++++++++++++ include/zephyr/mgmt/hawkbit/hawkbit.h | 144 +++++++++ samples/subsys/mgmt/hawkbit/src/main.c | 4 +- subsys/mgmt/hawkbit/hawkbit.c | 3 +- subsys/mgmt/hawkbit/hawkbit_autohandler.c | 4 +- subsys/mgmt/hawkbit/hawkbit_device.c | 2 +- subsys/mgmt/hawkbit/shell.c | 4 +- 10 files changed, 432 insertions(+), 337 deletions(-) create mode 100644 include/zephyr/mgmt/hawkbit/autohandler.h create mode 100644 include/zephyr/mgmt/hawkbit/config.h create mode 100644 include/zephyr/mgmt/hawkbit/hawkbit.h diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index b6861269d9fe7..c4edda966d8d4 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -2714,6 +2714,7 @@ hawkBit: - maass-hamburg files: - subsys/mgmt/hawkbit/ + - include/zephyr/mgmt/hawkbit/ - include/zephyr/mgmt/hawkbit.h - samples/subsys/mgmt/hawkbit/ labels: diff --git a/include/zephyr/mgmt/hawkbit.h b/include/zephyr/mgmt/hawkbit.h index d0e5701eca181..0d1e05f58915b 100644 --- a/include/zephyr/mgmt/hawkbit.h +++ b/include/zephyr/mgmt/hawkbit.h @@ -1,344 +1,22 @@ /* - * Copyright (c) 2020 Linumiz + * Copyright (c) 2024 Vogl Electronic GmbH * * SPDX-License-Identifier: Apache-2.0 */ /** - * @brief hawkBit Firmware Over-the-Air for Zephyr Project. - * @defgroup hawkbit hawkBit Firmware Over-the-Air - * @ingroup third_party - * @{ + * @file + * @brief hawkBit legacy header file */ + #ifndef ZEPHYR_INCLUDE_MGMT_HAWKBIT_H_ #define ZEPHYR_INCLUDE_MGMT_HAWKBIT_H_ -#include - -#define HAWKBIT_JSON_URL "/default/controller/v1" - -/** - * @brief Response message from hawkBit. - * - * @details These messages are used to inform the server and the - * user about the process status of the hawkBit and also - * used to standardize the errors that may occur. - * - */ -enum hawkbit_response { - HAWKBIT_NO_RESPONSE, - HAWKBIT_NETWORKING_ERROR, - HAWKBIT_UNCONFIRMED_IMAGE, - HAWKBIT_PERMISSION_ERROR, - HAWKBIT_METADATA_ERROR, - HAWKBIT_DOWNLOAD_ERROR, - HAWKBIT_OK, - HAWKBIT_UPDATE_INSTALLED, - HAWKBIT_NO_UPDATE, - HAWKBIT_CANCEL_UPDATE, - HAWKBIT_NOT_INITIALIZED, - HAWKBIT_PROBE_IN_PROGRESS, -}; - -/** - * @brief hawkBit configuration structure. - * - * @details This structure is used to store the hawkBit configuration - * settings. - */ -struct hawkbit_runtime_config { - char *server_addr; - uint16_t server_port; - char *auth_token; - sec_tag_t tls_tag; -}; - -/** - * @brief Callback to provide the custom data to the hawkBit server. - * - * @details This callback is used to provide the custom data to the hawkBit server. - * The custom data is used to provide the hawkBit server with the device specific - * data. - * - * @param device_id The device ID. - * @param buffer The buffer to store the json. - * @param buffer_size The size of the buffer. - */ -typedef int (*hawkbit_config_device_data_cb_handler_t)(const char *device_id, uint8_t *buffer, - const size_t buffer_size); - -/** - * @brief Set the custom data callback. - * - * @details This function is used to set the custom data callback. - * The callback is used to provide the custom data to the hawkBit server. - * - * @param cb The callback function. - * - * @retval 0 on success. - * @retval -EINVAL if the callback is NULL. - */ -int hawkbit_set_custom_data_cb(hawkbit_config_device_data_cb_handler_t cb); - -/** - * @brief Init the flash partition - * - * @retval 0 on success. - * @retval -errno if init fails. - */ -int hawkbit_init(void); - -/** - * @brief The hawkBit probe verify if there is some update to be performed. - * - * @retval HAWKBIT_NETWORKING_ERROR fail to connect to the hawkBit server. - * @retval HAWKBIT_UNCONFIRMED_IMAGE image is unconfirmed. - * @retval HAWKBIT_PERMISSION_ERROR fail to get the permission to access the hawkBit server. - * @retval HAWKBIT_METADATA_ERROR fail to parse or to encode the metadata. - * @retval HAWKBIT_DOWNLOAD_ERROR fail while downloading the update package. - * @retval HAWKBIT_OK if the image was already updated. - * @retval HAWKBIT_UPDATE_INSTALLED if an update was installed. Reboot is required to apply it. - * @retval HAWKBIT_NO_UPDATE if no update was available. - * @retval HAWKBIT_CANCEL_UPDATE if the update was cancelled by the server. - * @retval HAWKBIT_NOT_INITIALIZED if hawkBit is not initialized. - * @retval HAWKBIT_PROBE_IN_PROGRESS if probe is currently running. - */ -enum hawkbit_response hawkbit_probe(void); - -/** - * @brief Request system to reboot. - */ -void hawkbit_reboot(void); - -/** - * @brief Callback to get the device identity. - * - * @param id Pointer to the buffer to store the device identity - * @param id_max_len The maximum length of the buffer - */ -typedef bool (*hawkbit_get_device_identity_cb_handler_t)(char *id, int id_max_len); - -/** - * @brief Set the device identity callback. - * - * @details This function is used to set a custom device identity callback. - * - * @param cb The callback function. - * - * @retval 0 on success. - * @retval -EINVAL if the callback is NULL. - */ -int hawkbit_set_device_identity_cb(hawkbit_get_device_identity_cb_handler_t cb); - -/** - * @brief Set the hawkBit server configuration settings. - * - * @param config Configuration settings to set. - * @retval 0 on success. - * @retval -EAGAIN if probe is currently running. - */ -int hawkbit_set_config(struct hawkbit_runtime_config *config); - -/** - * @brief Get the hawkBit server configuration settings. - * - * @return Configuration settings. - */ -struct hawkbit_runtime_config hawkbit_get_config(void); - -/** - * @brief Set the hawkBit server address. - * - * @param addr_str Server address to set. - * @retval 0 on success. - * @retval -EAGAIN if probe is currently running. - */ -static inline int hawkbit_set_server_addr(char *addr_str) -{ - struct hawkbit_runtime_config set_config = { - .server_addr = addr_str, .server_port = 0, .auth_token = NULL, .tls_tag = 0}; - - return hawkbit_set_config(&set_config); -} - -/** - * @brief Set the hawkBit server port. - * - * @param port Server port to set. - * @retval 0 on success. - * @retval -EAGAIN if probe is currently running. - */ -static inline int hawkbit_set_server_port(uint16_t port) -{ - struct hawkbit_runtime_config set_config = { - .server_addr = NULL, .server_port = port, .auth_token = NULL, .tls_tag = 0}; - - return hawkbit_set_config(&set_config); -} - -/** - * @brief Set the hawkBit security token. - * - * @param token Security token to set. - * @retval 0 on success. - * @retval -EAGAIN if probe is currently running. - */ -static inline int hawkbit_set_ddi_security_token(char *token) -{ - struct hawkbit_runtime_config set_config = { - .server_addr = NULL, .server_port = 0, .auth_token = token, .tls_tag = 0}; - - return hawkbit_set_config(&set_config); -} - -/** - * @brief Set the hawkBit TLS tag - * - * @param tag TLS tag to set. - * @retval 0 on success. - * @retval -EAGAIN if probe is currently running. - */ -static inline int hawkbit_set_tls_tag(sec_tag_t tag) -{ - struct hawkbit_runtime_config set_config = { - .server_addr = NULL, .server_port = 0, .auth_token = NULL, .tls_tag = tag}; - - return hawkbit_set_config(&set_config); -} - -/** - * @brief Get the hawkBit server address. - * - * @return Server address. - */ -static inline char *hawkbit_get_server_addr(void) -{ - return hawkbit_get_config().server_addr; -} - -/** - * @brief Get the hawkBit server port. - * - * @return Server port. - */ -static inline uint16_t hawkbit_get_server_port(void) -{ - return hawkbit_get_config().server_port; -} - -/** - * @brief Get the hawkBit security token. - * - * @return Security token. - */ -static inline char *hawkbit_get_ddi_security_token(void) -{ - return hawkbit_get_config().auth_token; -} - -/** - * @brief Get the hawkBit TLS tag. - * - * @return TLS tag. - */ -static inline sec_tag_t hawkbit_get_tls_tag(void) -{ - return hawkbit_get_config().tls_tag; -} - -/** - * @brief Get the hawkBit action id. - * - * @return Action id. - -*/ -int32_t hawkbit_get_action_id(void); - -/** - * @brief Get the hawkBit poll interval. - * - * @return Poll interval. - */ -uint32_t hawkbit_get_poll_interval(void); +#warning " is deprecated, include , \ + and instead." -/** - * @brief Resets the hawkBit action id, that is saved in settings. - * - * @details This should be done after changing the hawkBit server. - * - * @retval 0 on success. - * @retval -EAGAIN if probe is currently running. - * @retval -EIO if the action id could not be reset. - * - */ -int hawkbit_reset_action_id(void); - -/** - * @brief hawkBit autohandler. - * @defgroup hawkbit_autohandler hawkBit autohandler - * @ingroup hawkbit - * @{ - */ - -/** - * @brief Runs hawkBit probe and hawkBit update automatically - * - * @details The hawkbit_autohandler handles the whole process - * in pre-determined time intervals. - * - * @param auto_reschedule If true, the handler will reschedule itself - */ -void hawkbit_autohandler(bool auto_reschedule); - -/** - * @brief Wait for the autohandler to finish. - * - * @param events Set of desired events on which to wait. Set to ::UINT32_MAX to wait for the - * autohandler to finish one run, or BIT() together with a value from - * ::hawkbit_response to wait for a specific event. - * @param timeout Waiting period for the desired set of events or one of the - * special values ::K_NO_WAIT and ::K_FOREVER. - * - * @retval HAWKBIT_OK if success. - * @retval HAWKBIT_NO_RESPONSE if matching events were not received within the specified time - * @retval HAWKBIT_NETWORKING_ERROR fail to connect to the hawkBit server. - * @retval HAWKBIT_UNCONFIRMED_IMAGE image is unconfirmed. - * @retval HAWKBIT_PERMISSION_ERROR fail to get the permission to access the hawkBit server. - * @retval HAWKBIT_METADATA_ERROR fail to parse or to encode the metadata. - * @retval HAWKBIT_DOWNLOAD_ERROR fail while downloading the update package. - * @retval HAWKBIT_UPDATE_INSTALLED if an update was installed. Reboot is required to apply it. - * @retval HAWKBIT_NO_UPDATE if no update was available. - * @retval HAWKBIT_CANCEL_UPDATE update was cancelled. - * @retval HAWKBIT_NOT_INITIALIZED if hawkBit is not initialized. - * @retval HAWKBIT_PROBE_IN_PROGRESS if probe is currently running. - */ -enum hawkbit_response hawkbit_autohandler_wait(uint32_t events, k_timeout_t timeout); - -/** - * @brief Cancel the run of the hawkBit autohandler. - * - * @return a value from k_work_cancel_delayable(). - */ -int hawkbit_autohandler_cancel(void); - -/** - * @brief Set the delay for the next run of the autohandler. - * - * @details This function will only delay the next run of the autohandler. The delay will not - * persist after the autohandler runs. - * - * @param timeout The delay to set. - * @param if_bigger If true, the delay will be set only if the new delay is bigger than the current - * one. - * - * @retval 0 if @a if_bigger was true and the current delay was bigger than the new one. - * @retval otherwise, a value from k_work_reschedule(). - */ -int hawkbit_autohandler_set_delay(k_timeout_t timeout, bool if_bigger); - -/** - * @} - * @} - */ +#include +#include +#include -#endif /* _HAWKBIT_H_ */ +#endif /* ZEPHYR_INCLUDE_MGMT_HAWKBIT_H_ */ diff --git a/include/zephyr/mgmt/hawkbit/autohandler.h b/include/zephyr/mgmt/hawkbit/autohandler.h new file mode 100644 index 0000000000000..3fbe7f1518b83 --- /dev/null +++ b/include/zephyr/mgmt/hawkbit/autohandler.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2024 Vogl Electronic GmbH + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file + * @brief hawkBit autohandler header file + */ + +/** + * @brief hawkBit autohandler API. + * @defgroup hawkbit_autohandler hawkBit autohandler API + * @ingroup hawkbit + * @{ + */ + +#ifndef ZEPHYR_INCLUDE_MGMT_HAWKBIT_AUTOHANDLER_H_ +#define ZEPHYR_INCLUDE_MGMT_HAWKBIT_AUTOHANDLER_H_ + +#include + +/** + * @brief Runs hawkBit probe and hawkBit update automatically + * + * @details The hawkbit_autohandler handles the whole process + * in pre-determined time intervals. + * + * @param auto_reschedule If true, the handler will reschedule itself + */ +void hawkbit_autohandler(bool auto_reschedule); + +/** + * @brief Wait for the autohandler to finish. + * + * @param events Set of desired events on which to wait. Set to ::UINT32_MAX to wait for the + * autohandler to finish one run, or BIT() together with a value from + * ::hawkbit_response to wait for a specific event. + * @param timeout Waiting period for the desired set of events or one of the + * special values ::K_NO_WAIT and ::K_FOREVER. + * + * @return A value from ::hawkbit_response. + */ +enum hawkbit_response hawkbit_autohandler_wait(uint32_t events, k_timeout_t timeout); + +/** + * @brief Cancel the run of the hawkBit autohandler. + * + * @return a value from k_work_cancel_delayable(). + */ +int hawkbit_autohandler_cancel(void); + +/** + * @brief Set the delay for the next run of the autohandler. + * + * @details This function will only delay the next run of the autohandler. The delay will not + * persist after the autohandler runs. + * + * @param timeout The delay to set. + * @param if_bigger If true, the delay will be set only if the new delay is bigger than the current + * one. + * + * @retval 0 if @a if_bigger was true and the current delay was bigger than the new one. + * @retval otherwise, a value from k_work_reschedule(). + */ +int hawkbit_autohandler_set_delay(k_timeout_t timeout, bool if_bigger); + +/** + * @} + */ + +#endif /* ZEPHYR_INCLUDE_MGMT_HAWKBIT_AUTOHANDLER_H_ */ diff --git a/include/zephyr/mgmt/hawkbit/config.h b/include/zephyr/mgmt/hawkbit/config.h new file mode 100644 index 0000000000000..c02212bf2b6d8 --- /dev/null +++ b/include/zephyr/mgmt/hawkbit/config.h @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2024 Vogl Electronic GmbH + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file + * @brief hawkBit configuration header file + */ + +/** + * @brief hawkBit configuration API. + * @defgroup hawkbit_config hawkBit configuration API + * @ingroup hawkbit + * @{ + */ + +#ifndef ZEPHYR_INCLUDE_MGMT_HAWKBIT_CONFIG_H_ +#define ZEPHYR_INCLUDE_MGMT_HAWKBIT_CONFIG_H_ + +#include +#include + +/** + * @brief hawkBit configuration structure. + * + * @details This structure is used to store the hawkBit configuration + * settings. + */ +struct hawkbit_runtime_config { + /** Server address */ + char *server_addr; + /** Server port */ + uint16_t server_port; + /** Security token */ + char *auth_token; + /** TLS tag */ + sec_tag_t tls_tag; +}; + +/** + * @brief Set the hawkBit server configuration settings. + * + * @param config Configuration settings to set. + * @retval 0 on success. + * @retval -EAGAIN if probe is currently running. + */ +int hawkbit_set_config(struct hawkbit_runtime_config *config); + +/** + * @brief Get the hawkBit server configuration settings. + * + * @return Configuration settings. + */ +struct hawkbit_runtime_config hawkbit_get_config(void); + +/** + * @brief Set the hawkBit server address. + * + * @param addr_str Server address to set. + * @retval 0 on success. + * @retval -EAGAIN if probe is currently running. + */ +static inline int hawkbit_set_server_addr(char *addr_str) +{ + struct hawkbit_runtime_config set_config = { + .server_addr = addr_str, + .server_port = 0, + .auth_token = NULL, + .tls_tag = 0, + }; + + return hawkbit_set_config(&set_config); +} + +/** + * @brief Set the hawkBit server port. + * + * @param port Server port to set. + * @retval 0 on success. + * @retval -EAGAIN if probe is currently running. + */ +static inline int hawkbit_set_server_port(uint16_t port) +{ + struct hawkbit_runtime_config set_config = { + .server_addr = NULL, + .server_port = port, + .auth_token = NULL, + .tls_tag = 0, + }; + + return hawkbit_set_config(&set_config); +} + +/** + * @brief Set the hawkBit security token. + * + * @param token Security token to set. + * @retval 0 on success. + * @retval -EAGAIN if probe is currently running. + */ +static inline int hawkbit_set_ddi_security_token(char *token) +{ + struct hawkbit_runtime_config set_config = { + .server_addr = NULL, + .server_port = 0, + .auth_token = token, + .tls_tag = 0, + }; + + return hawkbit_set_config(&set_config); +} + +/** + * @brief Set the hawkBit TLS tag + * + * @param tag TLS tag to set. + * @retval 0 on success. + * @retval -EAGAIN if probe is currently running. + */ +static inline int hawkbit_set_tls_tag(sec_tag_t tag) +{ + struct hawkbit_runtime_config set_config = { + .server_addr = NULL, + .server_port = 0, + .auth_token = NULL, + .tls_tag = tag, + }; + + return hawkbit_set_config(&set_config); +} + +/** + * @brief Get the hawkBit server address. + * + * @return Server address. + */ +static inline char *hawkbit_get_server_addr(void) +{ + return hawkbit_get_config().server_addr; +} + +/** + * @brief Get the hawkBit server port. + * + * @return Server port. + */ +static inline uint16_t hawkbit_get_server_port(void) +{ + return hawkbit_get_config().server_port; +} + +/** + * @brief Get the hawkBit security token. + * + * @return Security token. + */ +static inline char *hawkbit_get_ddi_security_token(void) +{ + return hawkbit_get_config().auth_token; +} + +/** + * @brief Get the hawkBit TLS tag. + * + * @return TLS tag. + */ +static inline sec_tag_t hawkbit_get_tls_tag(void) +{ + return hawkbit_get_config().tls_tag; +} + +/** + * @brief Get the hawkBit action id. + * + * @return Action id. + */ +int32_t hawkbit_get_action_id(void); + +/** + * @brief Get the hawkBit poll interval. + * + * @return Poll interval. + */ +uint32_t hawkbit_get_poll_interval(void); + +/** + * @} + */ + +#endif /* ZEPHYR_INCLUDE_MGMT_HAWKBIT_CONFIG_H_ */ diff --git a/include/zephyr/mgmt/hawkbit/hawkbit.h b/include/zephyr/mgmt/hawkbit/hawkbit.h new file mode 100644 index 0000000000000..8af9aa84b1541 --- /dev/null +++ b/include/zephyr/mgmt/hawkbit/hawkbit.h @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2020 Linumiz + * Copyright (c) 2024 Vogl Electronic GmbH + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file + * @brief hawkBit main header file + */ + +/** + * @brief hawkBit Firmware Over-the-Air for Zephyr Project. + * @defgroup hawkbit hawkBit Firmware Over-the-Air + * @ingroup third_party + * @{ + */ +#define HAWKBIT_JSON_URL "/default/controller/v1" + +#ifndef ZEPHYR_INCLUDE_MGMT_HAWKBIT_HAWKBIT_H_ +#define ZEPHYR_INCLUDE_MGMT_HAWKBIT_HAWKBIT_H_ + +#include + +/** + * @brief Response message from hawkBit. + * + * @details These messages are used to inform the server and the + * user about the process status of the hawkBit and also + * used to standardize the errors that may occur. + * + */ +enum hawkbit_response { + /** matching events were not received within the specified time */ + HAWKBIT_NO_RESPONSE, + /** fail to connect to the hawkBit server */ + HAWKBIT_NETWORKING_ERROR, + /** image is unconfirmed */ + HAWKBIT_UNCONFIRMED_IMAGE, + /** fail to get the permission to access the hawkBit server */ + HAWKBIT_PERMISSION_ERROR, + /** fail to parse or to encode the metadata */ + HAWKBIT_METADATA_ERROR, + /** fail while downloading the update package */ + HAWKBIT_DOWNLOAD_ERROR, + /** image was already updated */ + HAWKBIT_OK, + /** an update was installed. Reboot is required to apply it */ + HAWKBIT_UPDATE_INSTALLED, + /** no update was available */ + HAWKBIT_NO_UPDATE, + /** update was cancelled by the server */ + HAWKBIT_CANCEL_UPDATE, + /** hawkBit is not initialized */ + HAWKBIT_NOT_INITIALIZED, + /** probe is currently running */ + HAWKBIT_PROBE_IN_PROGRESS, +}; + +/** + * @brief Callback to provide the custom data to the hawkBit server. + * + * @details This callback is used to provide the custom data to the hawkBit server. + * The custom data is used to provide the hawkBit server with the device specific + * data. + * + * @param device_id The device ID. + * @param buffer The buffer to store the json. + * @param buffer_size The size of the buffer. + */ +typedef int (*hawkbit_config_device_data_cb_handler_t)(const char *device_id, uint8_t *buffer, + const size_t buffer_size); + +/** + * @brief Set the custom data callback. + * + * @details This function is used to set the custom data callback. + * The callback is used to provide the custom data to the hawkBit server. + * + * @param cb The callback function. + * + * @retval 0 on success. + * @retval -EINVAL if the callback is NULL. + */ +int hawkbit_set_custom_data_cb(hawkbit_config_device_data_cb_handler_t cb); + +/** + * @brief Init the flash partition + * + * @retval 0 on success. + * @retval -errno if init fails. + */ +int hawkbit_init(void); + +/** + * @brief The hawkBit probe verify if there is some update to be performed. + * + * @return A value from ::hawkbit_response. + */ +enum hawkbit_response hawkbit_probe(void); + +/** + * @brief Request system to reboot. + */ +void hawkbit_reboot(void); + +/** + * @brief Callback to get the device identity. + * + * @param id Pointer to the buffer to store the device identity + * @param id_max_len The maximum length of the buffer + */ +typedef bool (*hawkbit_get_device_identity_cb_handler_t)(char *id, int id_max_len); + +/** + * @brief Set the device identity callback. + * + * @details This function is used to set a custom device identity callback. + * + * @param cb The callback function. + * + * @retval 0 on success. + * @retval -EINVAL if the callback is NULL. + */ +int hawkbit_set_device_identity_cb(hawkbit_get_device_identity_cb_handler_t cb); + +/** + * @brief Resets the hawkBit action id, that is saved in settings. + * + * @details This should be done after changing the hawkBit server. + * + * @retval 0 on success. + * @retval -EAGAIN if probe is currently running. + * @retval -EIO if the action id could not be reset. + * + */ +int hawkbit_reset_action_id(void); + +/** + * @} + */ + +#endif /* ZEPHYR_INCLUDE_MGMT_HAWKBIT_HAWKBIT_H_ */ diff --git a/samples/subsys/mgmt/hawkbit/src/main.c b/samples/subsys/mgmt/hawkbit/src/main.c index b4204d3610e00..ab07501f7a6f2 100644 --- a/samples/subsys/mgmt/hawkbit/src/main.c +++ b/samples/subsys/mgmt/hawkbit/src/main.c @@ -5,7 +5,9 @@ */ #include -#include +#include +#include +#include #include #include #include diff --git a/subsys/mgmt/hawkbit/hawkbit.c b/subsys/mgmt/hawkbit/hawkbit.c index 34b29cc502032..df183ad834fe5 100644 --- a/subsys/mgmt/hawkbit/hawkbit.c +++ b/subsys/mgmt/hawkbit/hawkbit.c @@ -17,7 +17,8 @@ #include #include #include -#include +#include +#include #include #include #include diff --git a/subsys/mgmt/hawkbit/hawkbit_autohandler.c b/subsys/mgmt/hawkbit/hawkbit_autohandler.c index cbb8bcd611dbf..3b2dfa7719f98 100644 --- a/subsys/mgmt/hawkbit/hawkbit_autohandler.c +++ b/subsys/mgmt/hawkbit/hawkbit_autohandler.c @@ -6,7 +6,9 @@ #include #include -#include +#include +#include +#include LOG_MODULE_DECLARE(hawkbit); diff --git a/subsys/mgmt/hawkbit/hawkbit_device.c b/subsys/mgmt/hawkbit/hawkbit_device.c index b2d2183558a67..10ee07fbcdf05 100644 --- a/subsys/mgmt/hawkbit/hawkbit_device.c +++ b/subsys/mgmt/hawkbit/hawkbit_device.c @@ -5,7 +5,7 @@ */ #include "hawkbit_device.h" #include -#include +#include static bool hawkbit_get_device_identity_default(char *id, int id_max_len); diff --git a/subsys/mgmt/hawkbit/shell.c b/subsys/mgmt/hawkbit/shell.c index e10012786f503..577c016dc5634 100644 --- a/subsys/mgmt/hawkbit/shell.c +++ b/subsys/mgmt/hawkbit/shell.c @@ -9,7 +9,9 @@ #include #include #include -#include +#include +#include +#include #include "hawkbit_firmware.h" #include "hawkbit_device.h" From d28c0cf08cb0c43b455a88b4e596229d897f886a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Wed, 22 May 2024 11:16:51 +0200 Subject: [PATCH 0518/4482] mgmt: hawkbit: move HAWKBIT_JSON_URL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit move HAWKBIT_JSON_URL out of the header. Signed-off-by: Fin Maaß --- include/zephyr/mgmt/hawkbit/hawkbit.h | 1 - subsys/mgmt/hawkbit/hawkbit.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/zephyr/mgmt/hawkbit/hawkbit.h b/include/zephyr/mgmt/hawkbit/hawkbit.h index 8af9aa84b1541..6ef5952132e72 100644 --- a/include/zephyr/mgmt/hawkbit/hawkbit.h +++ b/include/zephyr/mgmt/hawkbit/hawkbit.h @@ -16,7 +16,6 @@ * @ingroup third_party * @{ */ -#define HAWKBIT_JSON_URL "/default/controller/v1" #ifndef ZEPHYR_INCLUDE_MGMT_HAWKBIT_HAWKBIT_H_ #define ZEPHYR_INCLUDE_MGMT_HAWKBIT_HAWKBIT_H_ diff --git a/subsys/mgmt/hawkbit/hawkbit.c b/subsys/mgmt/hawkbit/hawkbit.c index df183ad834fe5..8e7bb8ea27c1f 100644 --- a/subsys/mgmt/hawkbit/hawkbit.c +++ b/subsys/mgmt/hawkbit/hawkbit.c @@ -45,6 +45,8 @@ LOG_MODULE_REGISTER(hawkbit, CONFIG_HAWKBIT_LOG_LEVEL); #define HAWKBIT_RECV_TIMEOUT (300 * MSEC_PER_SEC) #define HAWKBIT_SET_SERVER_TIMEOUT K_MSEC(300) +#define HAWKBIT_JSON_URL "/default/controller/v1" + #define HTTP_HEADER_CONTENT_TYPE_JSON "application/json;charset=UTF-8" #define SLOT1_LABEL slot1_partition From ac670c4594887d1998e06063bf8e67fcab7118c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Wed, 5 Jun 2024 15:30:05 +0200 Subject: [PATCH 0519/4482] doc: releases: 4.0: change of hawkbit header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mention change of the hawkbit header files. Signed-off-by: Fin Maaß --- doc/releases/migration-guide-4.0.rst | 5 +++++ doc/releases/release-notes-4.0.rst | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 1b966683df82f..a401dacbfc624 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -473,6 +473,11 @@ hawkBit * :c:func:`hawkbit_autohandler` now takes one argument. This argument has to be set to ``true`` for the same behavior as before the change. (:github:`71037`) +* ```` is deprecated in favor of ````. + The old header will be removed in future releases and its usage should be avoided. + The hawkbit autohandler has been separated into ````. + The configuration part of hawkbit is now in ````. (:github:`71037`) + MCUmgr ====== diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 4a8e03d9e7db7..75b44df3fd172 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -371,6 +371,11 @@ Libraries / Subsystems * Use the :c:func:`hawkbit_autohandler_set_delay` function to delay the next run of the autohandler. + * The hawkBit header file was separated into multiple header files. The main header file is now + ````, the autohandler header file is now + ```` and the configuration header file is now + ````. + * Logging * Modem modules From 8941a2100c57a4bdb5776fe670e6ead912361590 Mon Sep 17 00:00:00 2001 From: Dominik Lau Date: Wed, 7 Aug 2024 12:08:51 +0200 Subject: [PATCH 0520/4482] samples: drivers: added a simple touch controller sample The sample is supposed to help examine the issues with touchscreen. It draws a plus in last touched position. Signed-off-by: Dominik Lau Signed-off-by: Filip Kokosinski --- boards/native/native_sim/native_sim.dts | 1 + .../input/draw_touch_events/CMakeLists.txt | 7 + .../subsys/input/draw_touch_events/Kconfig | 8 + .../subsys/input/draw_touch_events/README.rst | 32 ++++ .../subsys/input/draw_touch_events/prj.conf | 4 + .../input/draw_touch_events/sample.yaml | 16 ++ .../subsys/input/draw_touch_events/src/main.c | 156 ++++++++++++++++++ 7 files changed, 224 insertions(+) create mode 100644 samples/subsys/input/draw_touch_events/CMakeLists.txt create mode 100644 samples/subsys/input/draw_touch_events/Kconfig create mode 100644 samples/subsys/input/draw_touch_events/README.rst create mode 100644 samples/subsys/input/draw_touch_events/prj.conf create mode 100644 samples/subsys/input/draw_touch_events/sample.yaml create mode 100644 samples/subsys/input/draw_touch_events/src/main.c diff --git a/boards/native/native_sim/native_sim.dts b/boards/native/native_sim/native_sim.dts index 1f1b11ad9e727..162fcf074577a 100644 --- a/boards/native/native_sim/native_sim.dts +++ b/boards/native/native_sim/native_sim.dts @@ -25,6 +25,7 @@ zephyr,canbus = &can_loopback0; zephyr,code-partition = &slot0_partition; zephyr,bt-hci = &bt_hci_userchan; + zephyr,touch = &input_sdl_touch; }; aliases { diff --git a/samples/subsys/input/draw_touch_events/CMakeLists.txt b/samples/subsys/input/draw_touch_events/CMakeLists.txt new file mode 100644 index 0000000000000..e3531c4a6129f --- /dev/null +++ b/samples/subsys/input/draw_touch_events/CMakeLists.txt @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(touch) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/subsys/input/draw_touch_events/Kconfig b/samples/subsys/input/draw_touch_events/Kconfig new file mode 100644 index 0000000000000..1f1debd4670b6 --- /dev/null +++ b/samples/subsys/input/draw_touch_events/Kconfig @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Antmicro +# SPDX-License-Identifier: Apache-2.0 + +config SCREEN_WIDTH_TO_CROSS_DIM + int "Screen width to cross horizontal/vertical dimension ratio" + default 25 + +source "Kconfig.zephyr" diff --git a/samples/subsys/input/draw_touch_events/README.rst b/samples/subsys/input/draw_touch_events/README.rst new file mode 100644 index 0000000000000..782d7b82b1b30 --- /dev/null +++ b/samples/subsys/input/draw_touch_events/README.rst @@ -0,0 +1,32 @@ +.. zephyr:code-sample:: draw_touch_events + :name: Draw touch events + :relevant-api: input_events display_interface + + Visualize touch events on a display. + +Overview +******** +This sample will draw a small plus in the last touched coordinates, that way you can check +if the touch screen works for a board, examine its parameters such as inverted/swapped axes. + +Building and Running +******************** +While this is a generic sample and it should work with any boards with both display controllers +and touch controllers supported by Zephyr (provided the corresponding ``/chosen node`` properties +are set i.e. ``zephyr,touch`` and ``zephyr,display``). +Below is an example on how to build the sample for :ref:`stm32f746g_disco_board`: + +.. zephyr-app-commands:: + :zephyr-app: samples/subsys/input/draw_touch_events + :board: stm32f746g_disco + :goals: build + :compact: + +For testing purposes without the need of any hardware, the :ref:`native_sim ` +board is also supported and can be built as follows: + +.. zephyr-app-commands:: + :zephyr-app: samples/subsys/input/draw_touch_events + :board: native_sim + :goals: build + :compact: diff --git a/samples/subsys/input/draw_touch_events/prj.conf b/samples/subsys/input/draw_touch_events/prj.conf new file mode 100644 index 0000000000000..7e808b98aead3 --- /dev/null +++ b/samples/subsys/input/draw_touch_events/prj.conf @@ -0,0 +1,4 @@ +CONFIG_HEAP_MEM_POOL_SIZE=16384 +CONFIG_LOG=y +CONFIG_INPUT=y +CONFIG_DISPLAY=y diff --git a/samples/subsys/input/draw_touch_events/sample.yaml b/samples/subsys/input/draw_touch_events/sample.yaml new file mode 100644 index 0000000000000..301e62d22d473 --- /dev/null +++ b/samples/subsys/input/draw_touch_events/sample.yaml @@ -0,0 +1,16 @@ +sample: + description: Sample application for touch controllers + name: touch_sample +tests: + sample.touch.native: + build_only: true + platform_allow: native_sim/native/64 + tags: + - touch + sample.touch.ft5336: + platform_allow: + - stm32f429i_disc1 + - stm32f746g_disco + tags: + - touch + harness: none diff --git a/samples/subsys/input/draw_touch_events/src/main.c b/samples/subsys/input/draw_touch_events/src/main.c new file mode 100644 index 0000000000000..13a364fe09194 --- /dev/null +++ b/samples/subsys/input/draw_touch_events/src/main.c @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2024 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include + +LOG_MODULE_REGISTER(sample, LOG_LEVEL_INF); + +#if !DT_NODE_EXISTS(DT_CHOSEN(zephyr_touch)) +#error "Unsupported board: zephyr,touch is not assigned" +#endif + +#if !DT_NODE_EXISTS(DT_CHOSEN(zephyr_display)) +#error "Unsupported board: zephyr,display is not assigned" +#endif + +#define WIDTH (DT_PROP(DT_CHOSEN(zephyr_display), width)) +#define HEIGHT (DT_PROP(DT_CHOSEN(zephyr_display), height)) +#define CROSS_DIM (WIDTH / CONFIG_SCREEN_WIDTH_TO_CROSS_DIM) + +#define PIXEL_FORMAT (DT_PROP_OR(DT_CHOSEN(zephyr_display), pixel_format, PIXEL_FORMAT_ARGB_8888)) +#define BPP ((DISPLAY_BITS_PER_PIXEL(PIXEL_FORMAT)) / 8) + +#define BUFFER_SIZE (CROSS_DIM * CROSS_DIM * BPP) +#define REFRESH_RATE 100 + +static const struct device *const display_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_display)); +static const struct device *const touch_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_touch)); +static struct display_buffer_descriptor buf_desc = { + .buf_size = BUFFER_SIZE, .pitch = CROSS_DIM, .width = CROSS_DIM, .height = CROSS_DIM}; + +static uint8_t buffer_cross[BUFFER_SIZE]; +static const uint8_t buffer_cross_empty[BUFFER_SIZE]; +static struct k_sem sync; + +static struct { + size_t x; + size_t y; + bool pressed; +} touch_point, touch_point_drawn; + +static void touch_event_callback(struct input_event *evt, void *user_data) +{ + if (evt->code == INPUT_ABS_X) { + touch_point.x = evt->value; + } + if (evt->code == INPUT_ABS_Y) { + touch_point.y = evt->value; + } + if (evt->code == INPUT_BTN_TOUCH) { + touch_point.pressed = evt->value; + } + if (evt->sync) { + k_sem_give(&sync); + } +} +INPUT_CALLBACK_DEFINE(touch_dev, touch_event_callback, NULL); + +static void clear_screen(void) +{ + int x; + int y; + + for (x = 0; x < WIDTH; x += CROSS_DIM) { + for (y = 0; y < HEIGHT; y += CROSS_DIM) { + display_write(display_dev, x, y, &buf_desc, buffer_cross_empty); + } + } +} + +static void fill_cross_buffer(void) +{ + int i; + int x; + int y; + int index; + + for (i = 0; i < BPP; i++) { + for (x = 0; x < CROSS_DIM; x++) { + index = BPP * (CROSS_DIM / 2 * CROSS_DIM + x); + buffer_cross[index + i] = -1; + } + for (y = 0; y < CROSS_DIM; y++) { + index = BPP * (y * CROSS_DIM + CROSS_DIM / 2); + buffer_cross[index + i] = -1; + } + } +} + +static int get_draw_position(int value, int upper_bound) +{ + if (value < CROSS_DIM / 2) { + return 0; + } + + if (value + CROSS_DIM / 2 > upper_bound) { + return upper_bound - CROSS_DIM; + } + + return value - CROSS_DIM / 2; +} + +int main(void) +{ + + LOG_INF("Touch sample for touchscreen: %s, dc: %s", touch_dev->name, display_dev->name); + + if (!device_is_ready(touch_dev)) { + LOG_ERR("Device %s not found. Aborting sample.", touch_dev->name); + return 0; + } + + if (!device_is_ready(display_dev)) { + LOG_ERR("Device %s not found. Aborting sample.", display_dev->name); + return 0; + } + + if (BPP == 0 || BPP > 4) { + LOG_ERR("Unsupported BPP=%d", BPP); + return 0; + } + fill_cross_buffer(); + display_blanking_off(display_dev); + + clear_screen(); + touch_point_drawn.x = CROSS_DIM / 2; + touch_point_drawn.y = CROSS_DIM / 2; + touch_point.x = -1; + touch_point.y = -1; + + k_sem_init(&sync, 0, 1); + + while (1) { + k_msleep(REFRESH_RATE); + k_sem_take(&sync, K_FOREVER); + LOG_INF("TOUCH %s X, Y: (%d, %d)", touch_point.pressed ? "PRESS" : "RELEASE", + touch_point.x, touch_point.y); + + display_write(display_dev, get_draw_position(touch_point_drawn.x, WIDTH), + get_draw_position(touch_point_drawn.y, HEIGHT), &buf_desc, + buffer_cross_empty); + + display_write(display_dev, get_draw_position(touch_point.x, WIDTH), + get_draw_position(touch_point.y, HEIGHT), &buf_desc, buffer_cross); + + touch_point_drawn.x = touch_point.x; + touch_point_drawn.y = touch_point.y; + } + return 0; +} From b38a4ccbdbc8da2d84ad120b85c8c93b2004b4f7 Mon Sep 17 00:00:00 2001 From: Dominik Lau Date: Fri, 27 Sep 2024 10:17:05 +0200 Subject: [PATCH 0521/4482] boards: added touch controller to the `/chosen` node This adds zephyr,touch property to boards with touch controllers, analogous to `zephyr,display`. Signed-off-by: Dominik Lau Signed-off-by: Filip Kokosinski --- boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_cpuapp_common.dtsi | 1 + boards/m5stack/m5stack_core2/m5stack_core2_procpu.dts | 1 + boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts | 1 + boards/nxp/rd_rw612_bga/dts/goworld_16880_lcm.overlay | 1 + boards/pine64/pinetime_devkit0/pinetime_devkit0.dts | 1 + boards/renesas/da1469x_dk_pro/dts/da1469x_dk_pro_lcdc.overlay | 1 + .../renesas/da1469x_dk_pro/dts/da1469x_dk_pro_mipi_dbi.overlay | 1 + .../dts/adafruit_2_8_tft_touch_v2.dtsi | 1 + .../buydisplay_2_8_tft_touch_arduino.overlay | 1 + .../buydisplay_3_5_tft_touch_arduino.overlay | 1 + boards/shields/g1120b0mipi/g1120b0mipi.overlay | 1 + boards/shields/lcd_par_s035/lcd_par_s035_8080.overlay | 1 + boards/shields/rk043fn02h_ct/rk043fn02h_ct.overlay | 1 + boards/shields/rk043fn66hs_ctg/rk043fn66hs_ctg.overlay | 1 + boards/shields/rk055hdmipi4m/rk055hdmipi4m.overlay | 1 + boards/shields/rk055hdmipi4ma0/rk055hdmipi4ma0.overlay | 1 + .../seeed_xiao_round_display/seeed_xiao_round_display.overlay | 1 + boards/st/stm32f429i_disc1/stm32f429i_disc1.dts | 1 + boards/st/stm32f746g_disco/stm32f746g_disco.dts | 1 + boards/st/stm32f7508_dk/stm32f7508_dk.dts | 1 + boards/st/stm32f769i_disco/stm32f769i_disco.dts | 1 + boards/st/stm32h7b3i_dk/stm32h7b3i_dk.dts | 1 + .../esp32s3_touch_lcd_1_28_esp32s3_procpu.dts | 1 + doc/build/dts/api/api.rst | 2 ++ 24 files changed, 25 insertions(+) diff --git a/boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_cpuapp_common.dtsi b/boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_cpuapp_common.dtsi index 1aa2bb22660ea..bd39a87266b66 100644 --- a/boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_cpuapp_common.dtsi +++ b/boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_cpuapp_common.dtsi @@ -16,6 +16,7 @@ zephyr,bt-c2h-uart = &uart0; zephyr,display = &ili9340; zephyr,bt-hci = &bt_hci_ipc0; + zephyr,touch = &ft5336; }; /* Main LEDs and buttons are on an I2C TCA9538 GPIO port expander */ diff --git a/boards/m5stack/m5stack_core2/m5stack_core2_procpu.dts b/boards/m5stack/m5stack_core2/m5stack_core2_procpu.dts index 841dcdf38bef1..e9bf8d0da33fe 100644 --- a/boards/m5stack/m5stack_core2/m5stack_core2_procpu.dts +++ b/boards/m5stack/m5stack_core2/m5stack_core2_procpu.dts @@ -35,6 +35,7 @@ zephyr,code-partition = &slot0_partition; zephyr,rtc = &pfc8563_rtc; zephyr,bt-hci = &esp32_bt_hci; + zephyr,touch = &ft5336_touch; }; leds { diff --git a/boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts b/boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts index 31f9c842f1e68..f0ab1739079a2 100644 --- a/boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts +++ b/boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts @@ -34,6 +34,7 @@ zephyr,console = &lpuart1; zephyr,shell-uart = &lpuart1; zephyr,canbus = &flexcan2; + zephyr,touch = &ft5336; }; sdram0: memory@80000000 { diff --git a/boards/nxp/rd_rw612_bga/dts/goworld_16880_lcm.overlay b/boards/nxp/rd_rw612_bga/dts/goworld_16880_lcm.overlay index 8b9dbe924911f..31ebc02eb52a1 100644 --- a/boards/nxp/rd_rw612_bga/dts/goworld_16880_lcm.overlay +++ b/boards/nxp/rd_rw612_bga/dts/goworld_16880_lcm.overlay @@ -3,6 +3,7 @@ / { chosen { zephyr,display = &st7796s_lcdic; + zephyr,touch = &ft7401; }; lvgl_pointer { diff --git a/boards/pine64/pinetime_devkit0/pinetime_devkit0.dts b/boards/pine64/pinetime_devkit0/pinetime_devkit0.dts index 7bdf52d79e4cf..1243d743d9a7b 100644 --- a/boards/pine64/pinetime_devkit0/pinetime_devkit0.dts +++ b/boards/pine64/pinetime_devkit0/pinetime_devkit0.dts @@ -27,6 +27,7 @@ zephyr,flash = &flash0; zephyr,code-partition = &slot0_partition; zephyr,display = &st7789v; + zephyr,touch = &cst816s; }; aliases { diff --git a/boards/renesas/da1469x_dk_pro/dts/da1469x_dk_pro_lcdc.overlay b/boards/renesas/da1469x_dk_pro/dts/da1469x_dk_pro_lcdc.overlay index 94346ea39e7be..61078f2bcca9c 100644 --- a/boards/renesas/da1469x_dk_pro/dts/da1469x_dk_pro_lcdc.overlay +++ b/boards/renesas/da1469x_dk_pro/dts/da1469x_dk_pro_lcdc.overlay @@ -10,6 +10,7 @@ / { chosen { zephyr,display = &lcdc; + zephyr,touch = &display_touch; }; lvgl_pointer { diff --git a/boards/renesas/da1469x_dk_pro/dts/da1469x_dk_pro_mipi_dbi.overlay b/boards/renesas/da1469x_dk_pro/dts/da1469x_dk_pro_mipi_dbi.overlay index 6612d290f5dbc..8a2a558fc5912 100644 --- a/boards/renesas/da1469x_dk_pro/dts/da1469x_dk_pro_mipi_dbi.overlay +++ b/boards/renesas/da1469x_dk_pro/dts/da1469x_dk_pro_mipi_dbi.overlay @@ -10,6 +10,7 @@ / { chosen { zephyr,display = &ili9340; + zephyr,touch = &display_touch; }; lvgl_pointer { diff --git a/boards/shields/adafruit_2_8_tft_touch_v2/dts/adafruit_2_8_tft_touch_v2.dtsi b/boards/shields/adafruit_2_8_tft_touch_v2/dts/adafruit_2_8_tft_touch_v2.dtsi index 9a8d5069c3785..d4ecb5e20d6ec 100644 --- a/boards/shields/adafruit_2_8_tft_touch_v2/dts/adafruit_2_8_tft_touch_v2.dtsi +++ b/boards/shields/adafruit_2_8_tft_touch_v2/dts/adafruit_2_8_tft_touch_v2.dtsi @@ -9,6 +9,7 @@ / { chosen { zephyr,display = &adafruit_2_8_tft_touch_v2_ili9340; + zephyr,touch = &ft5336_adafruit_2_8_tft_touch_v2; }; lvgl_pointer { diff --git a/boards/shields/buydisplay_2_8_tft_touch_arduino/buydisplay_2_8_tft_touch_arduino.overlay b/boards/shields/buydisplay_2_8_tft_touch_arduino/buydisplay_2_8_tft_touch_arduino.overlay index dcc87b2c628a0..48261f8b92058 100644 --- a/boards/shields/buydisplay_2_8_tft_touch_arduino/buydisplay_2_8_tft_touch_arduino.overlay +++ b/boards/shields/buydisplay_2_8_tft_touch_arduino/buydisplay_2_8_tft_touch_arduino.overlay @@ -9,6 +9,7 @@ / { chosen { zephyr,display = &ili9340_buydisplay_2_8_tft_touch_arduino; + zephyr,touch = &ft5336_buydisplay_2_8_tft_touch_arduino; }; lvgl_pointer { diff --git a/boards/shields/buydisplay_3_5_tft_touch_arduino/buydisplay_3_5_tft_touch_arduino.overlay b/boards/shields/buydisplay_3_5_tft_touch_arduino/buydisplay_3_5_tft_touch_arduino.overlay index 67b679f124cb6..a5ca069697433 100644 --- a/boards/shields/buydisplay_3_5_tft_touch_arduino/buydisplay_3_5_tft_touch_arduino.overlay +++ b/boards/shields/buydisplay_3_5_tft_touch_arduino/buydisplay_3_5_tft_touch_arduino.overlay @@ -9,6 +9,7 @@ / { chosen { zephyr,display = &ili9488_buydisplay_3_5_tft_touch_arduino; + zephyr,touch = &ft5336_buydisplay_3_5_tft_touch_arduino; }; lvgl_pointer { diff --git a/boards/shields/g1120b0mipi/g1120b0mipi.overlay b/boards/shields/g1120b0mipi/g1120b0mipi.overlay index 7fec77ee3d71d..48b724ea58834 100644 --- a/boards/shields/g1120b0mipi/g1120b0mipi.overlay +++ b/boards/shields/g1120b0mipi/g1120b0mipi.overlay @@ -7,6 +7,7 @@ /{ chosen { zephyr,display = &rm67162_g1120b0mipi; + zephyr,touch = &ft3267_g1120b0mipi; }; en_mipi_display_g1120b0mipi: enable-mipi-display { diff --git a/boards/shields/lcd_par_s035/lcd_par_s035_8080.overlay b/boards/shields/lcd_par_s035/lcd_par_s035_8080.overlay index ca374649bab2f..281bfa22f4750 100644 --- a/boards/shields/lcd_par_s035/lcd_par_s035_8080.overlay +++ b/boards/shields/lcd_par_s035/lcd_par_s035_8080.overlay @@ -9,6 +9,7 @@ /{ chosen { zephyr,display = &st7796s; + zephyr,touch = >911_lcd_par_s035; }; lvgl_pointer { diff --git a/boards/shields/rk043fn02h_ct/rk043fn02h_ct.overlay b/boards/shields/rk043fn02h_ct/rk043fn02h_ct.overlay index ab0b10d70af2a..ee76848b2203f 100644 --- a/boards/shields/rk043fn02h_ct/rk043fn02h_ct.overlay +++ b/boards/shields/rk043fn02h_ct/rk043fn02h_ct.overlay @@ -9,6 +9,7 @@ /{ chosen { zephyr,display = &zephyr_lcdif; + zephyr,touch = &ft5336_rk043fn02h_ct; }; lvgl_pointer { diff --git a/boards/shields/rk043fn66hs_ctg/rk043fn66hs_ctg.overlay b/boards/shields/rk043fn66hs_ctg/rk043fn66hs_ctg.overlay index b992ec932b819..6231bd51db3a2 100644 --- a/boards/shields/rk043fn66hs_ctg/rk043fn66hs_ctg.overlay +++ b/boards/shields/rk043fn66hs_ctg/rk043fn66hs_ctg.overlay @@ -9,6 +9,7 @@ /{ chosen { zephyr,display = &zephyr_lcdif; + zephyr,touch = >911_rk043fn66hs_ctg; }; lvgl_pointer { diff --git a/boards/shields/rk055hdmipi4m/rk055hdmipi4m.overlay b/boards/shields/rk055hdmipi4m/rk055hdmipi4m.overlay index 58e610fc59e4e..a7526a3353a68 100644 --- a/boards/shields/rk055hdmipi4m/rk055hdmipi4m.overlay +++ b/boards/shields/rk055hdmipi4m/rk055hdmipi4m.overlay @@ -9,6 +9,7 @@ /{ chosen { zephyr,display = &lcdif; + zephyr,touch = >911_rk055hdmipi4m; }; en_mipi_display: enable-mipi-display { diff --git a/boards/shields/rk055hdmipi4ma0/rk055hdmipi4ma0.overlay b/boards/shields/rk055hdmipi4ma0/rk055hdmipi4ma0.overlay index 7df9f53b6a325..6c353d09372e0 100644 --- a/boards/shields/rk055hdmipi4ma0/rk055hdmipi4ma0.overlay +++ b/boards/shields/rk055hdmipi4ma0/rk055hdmipi4ma0.overlay @@ -9,6 +9,7 @@ /{ chosen { zephyr,display = &lcdif; + zephyr,touch = >911_rk055hdmipi4ma0; }; en_mipi_display_rk055hdmipi4ma0: enable-mipi-display-rk055hdmipi4ma0 { diff --git a/boards/shields/seeed_xiao_round_display/seeed_xiao_round_display.overlay b/boards/shields/seeed_xiao_round_display/seeed_xiao_round_display.overlay index d4a3ad1329e73..d959fb4b391b9 100644 --- a/boards/shields/seeed_xiao_round_display/seeed_xiao_round_display.overlay +++ b/boards/shields/seeed_xiao_round_display/seeed_xiao_round_display.overlay @@ -10,6 +10,7 @@ / { chosen { zephyr,display = &gc9a01_xiao_round_display; + zephyr,touch = &chsc6x_xiao_round_display; }; vbatt { diff --git a/boards/st/stm32f429i_disc1/stm32f429i_disc1.dts b/boards/st/stm32f429i_disc1/stm32f429i_disc1.dts index cbcc551a71635..ff16f6648e4ad 100644 --- a/boards/st/stm32f429i_disc1/stm32f429i_disc1.dts +++ b/boards/st/stm32f429i_disc1/stm32f429i_disc1.dts @@ -22,6 +22,7 @@ zephyr,flash = &flash0; zephyr,ccm = &ccm0; zephyr,display = <dc; + zephyr,touch = &stmpe811; }; sdram2: sdram@d0000000 { diff --git a/boards/st/stm32f746g_disco/stm32f746g_disco.dts b/boards/st/stm32f746g_disco/stm32f746g_disco.dts index 2c31fef1c92c4..e224d24beaa05 100644 --- a/boards/st/stm32f746g_disco/stm32f746g_disco.dts +++ b/boards/st/stm32f746g_disco/stm32f746g_disco.dts @@ -24,6 +24,7 @@ zephyr,dtcm = &dtcm; zephyr,flash-controller = &n25q128a1; zephyr,display = <dc; + zephyr,touch = &ft5336; }; leds { diff --git a/boards/st/stm32f7508_dk/stm32f7508_dk.dts b/boards/st/stm32f7508_dk/stm32f7508_dk.dts index 100fd6e661d9b..cf05ebfd479eb 100644 --- a/boards/st/stm32f7508_dk/stm32f7508_dk.dts +++ b/boards/st/stm32f7508_dk/stm32f7508_dk.dts @@ -24,6 +24,7 @@ zephyr,dtcm = &dtcm; zephyr,flash-controller = &n25q128a1; zephyr,display = <dc; + zephyr,touch = &ft5336; }; leds { diff --git a/boards/st/stm32f769i_disco/stm32f769i_disco.dts b/boards/st/stm32f769i_disco/stm32f769i_disco.dts index 9ad4f4ef3bc57..94dd6f6bb22c9 100644 --- a/boards/st/stm32f769i_disco/stm32f769i_disco.dts +++ b/boards/st/stm32f769i_disco/stm32f769i_disco.dts @@ -22,6 +22,7 @@ zephyr,flash = &flash0; zephyr,dtcm = &dtcm; zephyr,flash-controller = &mx25l51245g; + zephyr,touch = &ft6202; }; sdram1: sdram@c0000000 { diff --git a/boards/st/stm32h7b3i_dk/stm32h7b3i_dk.dts b/boards/st/stm32h7b3i_dk/stm32h7b3i_dk.dts index 95325e254b557..7e4fe7f9c2d7f 100644 --- a/boards/st/stm32h7b3i_dk/stm32h7b3i_dk.dts +++ b/boards/st/stm32h7b3i_dk/stm32h7b3i_dk.dts @@ -22,6 +22,7 @@ zephyr,flash = &flash0; zephyr,display = <dc; zephyr,canbus = &fdcan1; + zephyr,touch = &ft5336; }; leds { diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_procpu.dts b/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_procpu.dts index cb4bd891f611f..ced705bb5f89e 100644 --- a/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_procpu.dts +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_procpu.dts @@ -31,6 +31,7 @@ zephyr,code-partition = &slot0_partition; zephyr,display = &gc9a01; zephyr,bt-hci = &esp32_bt_hci; + zephyr,touch = &cst816s; }; /* Buttons */ diff --git a/doc/build/dts/api/api.rst b/doc/build/dts/api/api.rst index 387e0bb353fd0..7e47f2c1ed9da 100644 --- a/doc/build/dts/api/api.rst +++ b/doc/build/dts/api/api.rst @@ -456,3 +456,5 @@ device. * - zephyr,led-strip - A LED-strip node which is used to determine the timings of the WS2812 GPIO driver + * - zephyr,touch + - touchscreen controller device node. From c344cca8e9286e28670e6084a262959d5c868d58 Mon Sep 17 00:00:00 2001 From: Dominik Lau Date: Mon, 30 Sep 2024 11:21:08 +0200 Subject: [PATCH 0522/4482] boards: stm32f429i_disc1: inverted touch controller axes This inverts x and y axes as reported by stmpe811 driver for stm32f429i. Signed-off-by: Dominik Lau Signed-off-by: Filip Kokosinski --- boards/st/stm32f429i_disc1/stm32f429i_disc1.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boards/st/stm32f429i_disc1/stm32f429i_disc1.dts b/boards/st/stm32f429i_disc1/stm32f429i_disc1.dts index ff16f6648e4ad..26d1833c2496d 100644 --- a/boards/st/stm32f429i_disc1/stm32f429i_disc1.dts +++ b/boards/st/stm32f429i_disc1/stm32f429i_disc1.dts @@ -61,8 +61,6 @@ lvgl_pointer { compatible = "zephyr,lvgl-pointer-input"; input = <&stmpe811>; - invert-x; - invert-y; }; mipi_dbi { @@ -177,6 +175,8 @@ touch-detect-delay-us = <5000>; touch-average-control = <8>; tracking-index = <127>; + inverted-x; + inverted-y; }; }; From cadef5a64fa570a8b61e16d047021a67eb61432a Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Fri, 12 Jul 2024 04:18:38 +0200 Subject: [PATCH 0523/4482] Bluetooth: Controller: Introduce BT_CTLR_PERIPHERAL_RESERVE_MAX Introduce BT_CTLR_PERIPHERAL_RESERVE_MAX Kconfig option so that disabling this option will use minimum time reservation and exercise the peripheral connection event continuation using is_abort_cb mechanism. Signed-off-by: Vinayak Kariappa Chettimada --- .../nrf5340_cpunet_iso-bt_ll_sw_split.conf | 2 ++ .../bluetooth/controller/Kconfig.ll_sw_split | 13 ++++++++ subsys/bluetooth/controller/ll_sw/lll.h | 1 + subsys/bluetooth/controller/ll_sw/lll_conn.h | 10 +++++++ .../controller/ll_sw/nordic/lll/lll_conn.c | 30 ++++++++++++++++++- .../ll_sw/nordic/lll/lll_peripheral.c | 3 +- subsys/bluetooth/controller/ll_sw/ull_adv.c | 1 + .../bluetooth/controller/ll_sw/ull_central.c | 1 + subsys/bluetooth/controller/ll_sw/ull_conn.c | 25 ++++++++++++++-- .../controller/ll_sw/ull_peripheral.c | 17 ++++++++++- 10 files changed, 98 insertions(+), 5 deletions(-) diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf index 9dd89e2b04f7a..672d8b40fa987 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf @@ -72,6 +72,8 @@ CONFIG_BT_CTLR_SCAN_AUX_SET=1 CONFIG_BT_CTLR_ADV_RESERVE_MAX=n CONFIG_BT_CTLR_CENTRAL_RESERVE_MAX=n +CONFIG_BT_CTLR_PERIPHERAL_RESERVE_MAX=n +CONFIG_BT_CTLR_EVENT_OVERHEAD_RESERVE_MAX=y CONFIG_BT_CTLR_SLOT_RESERVATION_UPDATE=n CONFIG_BT_CTLR_SCAN_UNRESERVED=y CONFIG_BT_TICKER_NEXT_SLOT_GET_MATCH=y diff --git a/subsys/bluetooth/controller/Kconfig.ll_sw_split b/subsys/bluetooth/controller/Kconfig.ll_sw_split index e6d32e8251b79..bfb0c47772d7d 100644 --- a/subsys/bluetooth/controller/Kconfig.ll_sw_split +++ b/subsys/bluetooth/controller/Kconfig.ll_sw_split @@ -754,6 +754,19 @@ config BT_CTLR_CENTRAL_RESERVE_MAX Note, currently this value is only used to space multiple central connections and not for actual ticker time reservations. +config BT_CTLR_PERIPHERAL_RESERVE_MAX + bool "Use maximum data PDU size time reservation for Peripheral" + depends on BT_PERIPHERAL + default y + help + Use the maximum data PDU size time reservation considering the Data + length could be updated from default 27 bytes to maximum support size. + + If maximum time reservation is disabled then time reservation required + for empty PDU transmission is used. Overlapping radio events will use + the is_abort_cb mechanism to decide on continuation of the connection + event. + config BT_CTLR_EVENT_OVERHEAD_RESERVE_MAX bool "Reserve maximum event overhead in time reservations" default y diff --git a/subsys/bluetooth/controller/ll_sw/lll.h b/subsys/bluetooth/controller/ll_sw/lll.h index 048aa8edaf838..4cecde96f8ebb 100644 --- a/subsys/bluetooth/controller/ll_sw/lll.h +++ b/subsys/bluetooth/controller/ll_sw/lll.h @@ -509,6 +509,7 @@ struct event_done_extra { struct { uint16_t trx_cnt; uint8_t crc_valid:1; + uint8_t is_aborted:1; #if defined(CONFIG_BT_CTLR_SYNC_ISO) uint8_t estab_failed:1; #endif /* CONFIG_BT_CTLR_SYNC_ISO */ diff --git a/subsys/bluetooth/controller/ll_sw/lll_conn.h b/subsys/bluetooth/controller/ll_sw/lll_conn.h index f18e46567868c..a32b06bf12249 100644 --- a/subsys/bluetooth/controller/ll_sw/lll_conn.h +++ b/subsys/bluetooth/controller/ll_sw/lll_conn.h @@ -69,11 +69,20 @@ struct lll_conn { struct { uint8_t initiated:1; uint8_t cancelled:1; + uint8_t forced:1; + }; + + struct { + uint8_t initiated:1; + uint8_t cancelled:1; + uint8_t forced:1; } central; + #if defined(CONFIG_BT_PERIPHERAL) struct { uint8_t initiated:1; uint8_t cancelled:1; + uint8_t forced:1; uint8_t latency_enabled:1; uint32_t window_widening_periodic_us; @@ -160,6 +169,7 @@ int lll_conn_reset(void); void lll_conn_flush(uint16_t handle, struct lll_conn *lll); void lll_conn_prepare_reset(void); +int lll_conn_is_abort_cb(void *next, void *curr, lll_prepare_cb_t *resume_cb); void lll_conn_abort_cb(struct lll_prepare_param *prepare_param, void *param); void lll_conn_isr_rx(void *param); void lll_conn_isr_tx(void *param); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c index 131fcde4d48ef..5e7d357b0dd4b 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c @@ -59,6 +59,7 @@ static struct pdu_data *get_last_tx_pdu(struct lll_conn *lll); static uint8_t crc_expire; static uint8_t crc_valid; +static uint8_t is_aborted; static uint16_t trx_cnt; #if defined(CONFIG_BT_CTLR_LE_ENC) @@ -142,12 +143,25 @@ void lll_conn_prepare_reset(void) trx_cnt = 0U; crc_valid = 0U; crc_expire = 0U; + is_aborted = 0U; #if defined(CONFIG_BT_CTLR_LE_ENC) mic_state = LLL_CONN_MIC_NONE; #endif /* CONFIG_BT_CTLR_LE_ENC */ } +int lll_conn_is_abort_cb(void *next, void *curr, lll_prepare_cb_t *resume_cb) +{ + struct lll_conn *lll = curr; + + /* Do not abort if near supervision timeout */ + if (lll->forced) { + return 0; + } + + return -ECANCELED; +} + void lll_conn_abort_cb(struct lll_prepare_param *prepare_param, void *param) { struct event_done_extra *e; @@ -156,6 +170,17 @@ void lll_conn_abort_cb(struct lll_prepare_param *prepare_param, void *param) /* NOTE: This is not a prepare being cancelled */ if (!prepare_param) { + /* Get reference to LLL connection context */ + lll = param; + + /* For a peripheral role, ensure at least one PDU is tx-ed + * back to central, otherwise let the supervision timeout + * countdown be started. + */ + if ((lll->role == BT_HCI_ROLE_PERIPHERAL) && (trx_cnt <= 1U)) { + is_aborted = 1U; + } + /* Perform event abort here. * After event has been cleanly aborted, clean up resources * and dispatch event done. @@ -171,8 +196,10 @@ void lll_conn_abort_cb(struct lll_prepare_param *prepare_param, void *param) err = lll_hfclock_off(); LL_ASSERT(err >= 0); - /* Accumulate the latency as event is aborted while being in pipeline */ + /* Get reference to LLL connection context */ lll = prepare_param->param; + + /* Accumulate the latency as event is aborted while being in pipeline */ lll->latency_prepare += (prepare_param->lazy + 1); /* Extra done event, to check supervision timeout */ @@ -867,6 +894,7 @@ static void isr_done(void *param) e->type = EVENT_DONE_EXTRA_TYPE_CONN; e->trx_cnt = trx_cnt; e->crc_valid = crc_valid; + e->is_aborted = is_aborted; #if defined(CONFIG_BT_CTLR_LE_ENC) e->mic_state = mic_state; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c index 30ad77fb5328c..0f8b89e4b3a74 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c @@ -89,7 +89,8 @@ void lll_periph_prepare(void *param) } /* Invoke common pipeline handling of prepare */ - err = lll_prepare(lll_is_abort_cb, lll_conn_abort_cb, prepare_cb, 0, p); + err = lll_prepare(lll_conn_is_abort_cb, lll_conn_abort_cb, prepare_cb, + 0U, p); LL_ASSERT(!err || err == -EINPROGRESS); } diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv.c b/subsys/bluetooth/controller/ll_sw/ull_adv.c index c0f2f86bb2ac5..e9fb8e47a6b99 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv.c @@ -1072,6 +1072,7 @@ uint8_t ll_adv_enable(uint8_t enable) conn_lll->role = 1; conn_lll->periph.initiated = 0; conn_lll->periph.cancelled = 0; + conn_lll->periph.forced = 0; conn_lll->data_chan_sel = 0; conn_lll->data_chan_use = 0; conn_lll->event_counter = 0; diff --git a/subsys/bluetooth/controller/ll_sw/ull_central.c b/subsys/bluetooth/controller/ll_sw/ull_central.c index a39ef8b598998..397c0d0b5f9da 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_central.c +++ b/subsys/bluetooth/controller/ll_sw/ull_central.c @@ -253,6 +253,7 @@ uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window, conn_lll->role = 0; conn_lll->central.initiated = 0; conn_lll->central.cancelled = 0; + conn_lll->central.forced = 0; /* FIXME: END: Move to ULL? */ #if defined(CONFIG_BT_CTLR_CONN_META) memset(&conn_lll->conn_meta, 0, sizeof(conn_lll->conn_meta)); diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn.c b/subsys/bluetooth/controller/ll_sw/ull_conn.c index 50fe53127cc1f..19eaa527aa8cd 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn.c +++ b/subsys/bluetooth/controller/ll_sw/ull_conn.c @@ -943,6 +943,7 @@ void ull_conn_done(struct node_rx_event_done *done) struct lll_conn *lll; struct ll_conn *conn; uint8_t reason_final; + uint8_t force_lll; uint16_t lazy; uint8_t force; @@ -1054,7 +1055,7 @@ void ull_conn_done(struct node_rx_event_done *done) } /* Reset supervision countdown */ - if (done->extra.crc_valid) { + if (done->extra.crc_valid && !done->extra.is_aborted) { conn->supervision_expire = 0U; } @@ -1085,6 +1086,7 @@ void ull_conn_done(struct node_rx_event_done *done) /* check supervision timeout */ force = 0U; + force_lll = 0U; if (conn->supervision_expire) { if (conn->supervision_expire > elapsed_event) { conn->supervision_expire -= elapsed_event; @@ -1096,6 +1098,8 @@ void ull_conn_done(struct node_rx_event_done *done) * supervision timeout. */ if (conn->supervision_expire <= 6U) { + force_lll = 1U; + force = 1U; } #if defined(CONFIG_BT_CTLR_CONN_RANDOM_FORCE) @@ -1123,6 +1127,8 @@ void ull_conn_done(struct node_rx_event_done *done) } } + lll->forced = force_lll; + /* check procedure timeout */ uint8_t error_code; @@ -1233,26 +1239,41 @@ void ull_conn_done(struct node_rx_event_done *done) uint32_t ready_delay, rx_time, tx_time, ticks_slot, slot_us; lll->evt_len_upd = 0; + #if defined(CONFIG_BT_CTLR_PHY) ready_delay = (lll->role) ? lll_radio_rx_ready_delay_get(lll->phy_rx, PHY_FLAGS_S8) : lll_radio_tx_ready_delay_get(lll->phy_tx, lll->phy_flags); + +#if defined(CONFIG_BT_CTLR_PERIPHERAL_RESERVE_MAX) #if defined(CONFIG_BT_CTLR_DATA_LENGTH) tx_time = lll->dle.eff.max_tx_time; rx_time = lll->dle.eff.max_rx_time; -#else /* CONFIG_BT_CTLR_DATA_LENGTH */ +#else /* CONFIG_BT_CTLR_DATA_LENGTH */ tx_time = MAX(PDU_DC_MAX_US(PDU_DC_PAYLOAD_SIZE_MIN, 0), PDU_DC_MAX_US(PDU_DC_PAYLOAD_SIZE_MIN, lll->phy_tx)); rx_time = MAX(PDU_DC_MAX_US(PDU_DC_PAYLOAD_SIZE_MIN, 0), PDU_DC_MAX_US(PDU_DC_PAYLOAD_SIZE_MIN, lll->phy_rx)); #endif /* CONFIG_BT_CTLR_DATA_LENGTH */ + +#else /* !CONFIG_BT_CTLR_PERIPHERAL_RESERVE_MAX */ + tx_time = PDU_MAX_US(0U, 0U, lll->phy_tx); + rx_time = PDU_MAX_US(0U, 0U, lll->phy_rx); +#endif /* !CONFIG_BT_CTLR_PERIPHERAL_RESERVE_MAX */ + #else /* CONFIG_BT_CTLR_PHY */ ready_delay = (lll->role) ? lll_radio_rx_ready_delay_get(0, 0) : lll_radio_tx_ready_delay_get(0, 0); +#if defined(CONFIG_BT_CTLR_PERIPHERAL_RESERVE_MAX) tx_time = PDU_DC_MAX_US(lll->dle.eff.max_tx_octets, 0); rx_time = PDU_DC_MAX_US(lll->dle.eff.max_rx_octets, 0); + +#else /* !CONFIG_BT_CTLR_PERIPHERAL_RESERVE_MAX */ + tx_time = PDU_MAX_US(0U, 0U, PHY_1M); + rx_time = PDU_MAX_US(0U, 0U, PHY_1M); +#endif /* !CONFIG_BT_CTLR_PERIPHERAL_RESERVE_MAX */ #endif /* CONFIG_BT_CTLR_PHY */ /* Calculate event time reservation */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_peripheral.c b/subsys/bluetooth/controller/ll_sw/ull_peripheral.c index 5abde0647e80f..cb2eda865927b 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_peripheral.c +++ b/subsys/bluetooth/controller/ll_sw/ull_peripheral.c @@ -341,25 +341,40 @@ void ull_periph_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr, ll_rx_put_sched(link, rx); +#if defined(CONFIG_BT_CTLR_PERIPHERAL_RESERVE_MAX) #if defined(CONFIG_BT_CTLR_DATA_LENGTH) #if defined(CONFIG_BT_CTLR_PHY) max_tx_time = lll->dle.eff.max_tx_time; max_rx_time = lll->dle.eff.max_rx_time; + #else /* !CONFIG_BT_CTLR_PHY */ max_tx_time = PDU_DC_MAX_US(PDU_DC_PAYLOAD_SIZE_MIN, PHY_1M); max_rx_time = PDU_DC_MAX_US(PDU_DC_PAYLOAD_SIZE_MIN, PHY_1M); #endif /* !CONFIG_BT_CTLR_PHY */ + #else /* !CONFIG_BT_CTLR_DATA_LENGTH */ max_tx_time = PDU_DC_MAX_US(PDU_DC_PAYLOAD_SIZE_MIN, PHY_1M); max_rx_time = PDU_DC_MAX_US(PDU_DC_PAYLOAD_SIZE_MIN, PHY_1M); + #if defined(CONFIG_BT_CTLR_PHY) max_tx_time = MAX(max_tx_time, PDU_DC_MAX_US(PDU_DC_PAYLOAD_SIZE_MIN, lll->phy_tx)); max_rx_time = MAX(max_rx_time, PDU_DC_MAX_US(PDU_DC_PAYLOAD_SIZE_MIN, lll->phy_rx)); -#endif /* !CONFIG_BT_CTLR_PHY */ +#endif /* CONFIG_BT_CTLR_PHY */ #endif /* !CONFIG_BT_CTLR_DATA_LENGTH */ +#else /* !CONFIG_BT_CTLR_PERIPHERAL_RESERVE_MAX */ +#if defined(CONFIG_BT_CTLR_PHY) + max_tx_time = PDU_MAX_US(0U, 0U, lll->phy_tx); + max_rx_time = PDU_MAX_US(0U, 0U, lll->phy_rx); + +#else /* !CONFIG_BT_CTLR_PHY */ + max_tx_time = PDU_MAX_US(0U, 0U, PHY_1M); + max_rx_time = PDU_MAX_US(0U, 0U, PHY_1M); +#endif /* !CONFIG_BT_CTLR_PHY */ +#endif /* !CONFIG_BT_CTLR_PERIPHERAL_RESERVE_MAX */ + #if defined(CONFIG_BT_CTLR_PHY) ready_delay_us = lll_radio_rx_ready_delay_get(lll->phy_rx, PHY_FLAGS_S8); #else /* CONFIG_BT_CTLR_PHY */ From 468b60087efd16f101de680b0cb6ad0c5fcf4588 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Fri, 12 Jul 2024 04:18:38 +0200 Subject: [PATCH 0524/4482] Bluetooth: Controller: Introduce BT_CTLR_PERIPHERAL_ISO_RESERVE_MAX Introduce BT_CTLR_PERIPHERAL_ISO_RESERVE_MAX Kconfig option so that disabling this option will use minimum time reservation and exercise the peripheral ISO connection event continuation using is_abort_cb mechanism. Signed-off-by: Vinayak Kariappa Chettimada --- .../hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf | 1 + subsys/bluetooth/controller/Kconfig.ll_sw_split | 11 +++++++++++ subsys/bluetooth/controller/ll_sw/ull_conn_iso.c | 6 +++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf index 672d8b40fa987..c8cad930a3380 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf @@ -73,6 +73,7 @@ CONFIG_BT_CTLR_SCAN_AUX_SET=1 CONFIG_BT_CTLR_ADV_RESERVE_MAX=n CONFIG_BT_CTLR_CENTRAL_RESERVE_MAX=n CONFIG_BT_CTLR_PERIPHERAL_RESERVE_MAX=n +CONFIG_BT_CTLR_PERIPHERAL_ISO_RESERVE_MAX=n CONFIG_BT_CTLR_EVENT_OVERHEAD_RESERVE_MAX=y CONFIG_BT_CTLR_SLOT_RESERVATION_UPDATE=n CONFIG_BT_CTLR_SCAN_UNRESERVED=y diff --git a/subsys/bluetooth/controller/Kconfig.ll_sw_split b/subsys/bluetooth/controller/Kconfig.ll_sw_split index bfb0c47772d7d..5f32ce783cd24 100644 --- a/subsys/bluetooth/controller/Kconfig.ll_sw_split +++ b/subsys/bluetooth/controller/Kconfig.ll_sw_split @@ -767,6 +767,17 @@ config BT_CTLR_PERIPHERAL_RESERVE_MAX the is_abort_cb mechanism to decide on continuation of the connection event. +config BT_CTLR_PERIPHERAL_ISO_RESERVE_MAX + bool "Use maximum data PDU size time reservation for Peripheral" + depends on BT_CTLR_PERIPHERAL_ISO + default y + help + Use the maximum Peripheral CIG event time reservation. + + If maximum Peripheral CIG event time reservation is not enabled, then + only time required to transmit or receive the burst number of CIS PDUs + is reserved. + config BT_CTLR_EVENT_OVERHEAD_RESERVE_MAX bool "Reserve maximum event overhead in time reservations" default y diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn_iso.c b/subsys/bluetooth/controller/ll_sw/ull_conn_iso.c index 616b8ddf6c76d..4e23cf263c633 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_conn_iso.c @@ -1032,7 +1032,11 @@ void ull_conn_iso_start(struct ll_conn *conn, uint16_t cis_handle, /* FIXME: Time reservation for interleaved packing */ /* Below is time reservation for sequential packing */ - slot_us = cis->lll.sub_interval * cis->lll.nse; + if (IS_ENABLED(CONFIG_BT_CTLR_PERIPHERAL_ISO_RESERVE_MAX)) { + slot_us = cis->lll.sub_interval * cis->lll.nse; + } else { + slot_us = cis->lll.sub_interval * MAX(cis->lll.tx.bn, cis->lll.rx.bn); + } if (IS_ENABLED(CONFIG_BT_CTLR_EVENT_OVERHEAD_RESERVE_MAX)) { slot_us += EVENT_OVERHEAD_START_US + EVENT_OVERHEAD_END_US; From e21ff7067d37a4af9a8164595c7fcaabbd92bfd8 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Mon, 15 Jul 2024 18:03:27 +0200 Subject: [PATCH 0525/4482] Bluetooth: Controller: Fix BT_CTLR_SCAN_AUX_SYNC_RESERVE_MIN Fix BT_CTLR_SCAN_AUX_SYNC_RESERVE_MIN such that event is not aborted when near supervision timeout conditions. Relates to commit ddf04997a5ba ("Bluetooth: Controller: Add abort fairness in overlapping Periodic Sync"). Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/lll_sync.h | 1 + .../bluetooth/controller/ll_sw/nordic/lll/lll_sync.c | 7 +++++++ subsys/bluetooth/controller/ll_sw/ull_sync.c | 11 ++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/controller/ll_sw/lll_sync.h b/subsys/bluetooth/controller/ll_sw/lll_sync.h index 03c1d4e2eda9a..568c71fe8a8c7 100644 --- a/subsys/bluetooth/controller/ll_sw/lll_sync.h +++ b/subsys/bluetooth/controller/ll_sw/lll_sync.h @@ -27,6 +27,7 @@ struct lll_sync { uint8_t filter_policy:1; uint8_t is_rx_enabled:1; uint8_t is_aux_sched:1; + uint8_t forced:1; #if defined(CONFIG_BT_CTLR_SYNC_ISO) uint8_t sca:3; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c index f74b5fa145d17..36949e334f099 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c @@ -562,6 +562,13 @@ static int is_abort_cb(void *next, void *curr, lll_prepare_cb_t *resume_cb) lll_sync_next = ull_sync_lll_is_valid_get(next); if (!lll_sync_next) { + lll_sync_curr = curr; + + /* Do not abort if near supervision timeout */ + if (lll_sync_curr->forced) { + return 0; + } + /* Abort current event as next event is not a * scan and not a scan aux event. */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_sync.c b/subsys/bluetooth/controller/ll_sw/ull_sync.c index c557260c22ad2..bc7b673b97ecd 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sync.c +++ b/subsys/bluetooth/controller/ll_sw/ull_sync.c @@ -722,6 +722,7 @@ void ull_sync_setup(struct ll_scan_set *scan, struct ll_scan_aux_set *aux, memcpy(lll->crc_init, si->crc_init, sizeof(lll->crc_init)); lll->event_counter = sys_le16_to_cpu(si->evt_cntr); lll->phy = aux->lll.phy; + lll->forced = 0U; interval = sys_le16_to_cpu(si->interval); interval_us = interval * PERIODIC_INT_UNIT_US; @@ -1020,6 +1021,7 @@ void ull_sync_done(struct node_rx_event_done *done) struct ll_sync_set *sync; uint16_t elapsed_event; uint16_t skip_event; + uint8_t force_lll; uint16_t lazy; uint8_t force; @@ -1100,6 +1102,7 @@ void ull_sync_done(struct node_rx_event_done *done) /* check timeout */ force = 0U; + force_lll = 0U; if (sync->timeout_expire) { if (sync->timeout_expire > elapsed_event) { sync->timeout_expire -= elapsed_event; @@ -1107,7 +1110,11 @@ void ull_sync_done(struct node_rx_event_done *done) /* break skip */ lll->skip_event = 0U; - if (skip_event) { + if (sync->timeout_expire <= 6U) { + force_lll = 1U; + + force = 1U; + } else if (skip_event) { force = 1U; } } else { @@ -1117,6 +1124,8 @@ void ull_sync_done(struct node_rx_event_done *done) } } + lll->forced = force_lll; + /* Check if skip needs update */ lazy = 0U; if ((force) || (skip_event != lll->skip_event)) { From 247037bd3e2ab6f137bcc02d6e0f10f4dcfa9c99 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Thu, 18 Jul 2024 07:56:09 +0200 Subject: [PATCH 0526/4482] Bluetooth: Controller: Fix incorrect elapsed events value Fix incorrect elapsed events value when event prepare are aborted in the pipeline. This caused premature supervision timeouts. Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/lll_conn.h | 1 + .../bluetooth/controller/ll_sw/lll_conn_iso.h | 1 + subsys/bluetooth/controller/ll_sw/lll_sync.h | 1 + .../controller/ll_sw/nordic/lll/lll_central.c | 3 +- .../controller/ll_sw/nordic/lll/lll_conn.c | 17 +++++- .../ll_sw/nordic/lll/lll_peripheral.c | 21 ++++---- .../ll_sw/nordic/lll/lll_peripheral_iso.c | 54 +++++++++++-------- .../controller/ll_sw/nordic/lll/lll_sync.c | 10 ++-- subsys/bluetooth/controller/ll_sw/ull_conn.c | 7 +-- .../bluetooth/controller/ll_sw/ull_conn_iso.c | 34 ++++++------ subsys/bluetooth/controller/ll_sw/ull_sync.c | 21 ++++---- 11 files changed, 100 insertions(+), 70 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/lll_conn.h b/subsys/bluetooth/controller/ll_sw/lll_conn.h index a32b06bf12249..b57e4db5ea24c 100644 --- a/subsys/bluetooth/controller/ll_sw/lll_conn.h +++ b/subsys/bluetooth/controller/ll_sw/lll_conn.h @@ -48,6 +48,7 @@ struct lll_conn { uint16_t latency; uint16_t latency_prepare; + uint16_t lazy_prepare; uint16_t latency_event; uint16_t event_counter; diff --git a/subsys/bluetooth/controller/ll_sw/lll_conn_iso.h b/subsys/bluetooth/controller/ll_sw/lll_conn_iso.h index 4e52da506c17c..a8c1d5325905e 100644 --- a/subsys/bluetooth/controller/ll_sw/lll_conn_iso.h +++ b/subsys/bluetooth/controller/ll_sw/lll_conn_iso.h @@ -93,6 +93,7 @@ struct lll_conn_iso_group { /* Accumulates LLL prepare callback latencies */ uint16_t latency_prepare; + uint16_t lazy_prepare; uint16_t latency_event; #if defined(CONFIG_BT_CTLR_PERIPHERAL_ISO) diff --git a/subsys/bluetooth/controller/ll_sw/lll_sync.h b/subsys/bluetooth/controller/ll_sw/lll_sync.h index 568c71fe8a8c7..595c85396f097 100644 --- a/subsys/bluetooth/controller/ll_sw/lll_sync.h +++ b/subsys/bluetooth/controller/ll_sw/lll_sync.h @@ -42,6 +42,7 @@ struct lll_sync { #endif /* CONFIG_BT_CTLR_SCAN_AUX_SYNC_RESERVE_MIN */ uint16_t skip_prepare; + uint16_t lazy_prepare; uint16_t skip_event; uint16_t event_counter; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c index a73364ef4109b..7a8405de84c9e 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c @@ -120,7 +120,8 @@ static int prepare_cb(struct lll_prepare_param *p) lll_conn_prepare_reset(); /* Calculate the current event latency */ - lll->latency_event = lll->latency_prepare + p->lazy; + lll->lazy_prepare = p->lazy; + lll->latency_event = lll->latency_prepare + lll->lazy_prepare; /* Calculate the current event counter value */ event_counter = lll->event_counter + lll->latency_event; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c index 5e7d357b0dd4b..6f41be448486f 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c @@ -200,7 +200,22 @@ void lll_conn_abort_cb(struct lll_prepare_param *prepare_param, void *param) lll = prepare_param->param; /* Accumulate the latency as event is aborted while being in pipeline */ - lll->latency_prepare += (prepare_param->lazy + 1); + lll->lazy_prepare = prepare_param->lazy; + lll->latency_prepare += (lll->lazy_prepare + 1U); + +#if defined(CONFIG_BT_PERIPHERAL) + if (lll->role == BT_HCI_ROLE_PERIPHERAL) { + /* Accumulate window widening */ + lll->periph.window_widening_prepare_us += + lll->periph.window_widening_periodic_us * + (prepare_param->lazy + 1); + if (lll->periph.window_widening_prepare_us > + lll->periph.window_widening_max_us) { + lll->periph.window_widening_prepare_us = + lll->periph.window_widening_max_us; + } + } +#endif /* CONFIG_BT_PERIPHERAL */ /* Extra done event, to check supervision timeout */ e = ull_event_done_extra_get(); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c index 0f8b89e4b3a74..b8e82692e3c0d 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c @@ -79,15 +79,6 @@ void lll_periph_prepare(void *param) lll = p->param; - /* Accumulate window widening */ - lll->periph.window_widening_prepare_us += - lll->periph.window_widening_periodic_us * (p->lazy + 1); - if (lll->periph.window_widening_prepare_us > - lll->periph.window_widening_max_us) { - lll->periph.window_widening_prepare_us = - lll->periph.window_widening_max_us; - } - /* Invoke common pipeline handling of prepare */ err = lll_prepare(lll_conn_is_abort_cb, lll_conn_abort_cb, prepare_cb, 0U, p); @@ -133,7 +124,8 @@ static int prepare_cb(struct lll_prepare_param *p) lll_conn_prepare_reset(); /* Calculate the current event latency */ - lll->latency_event = lll->latency_prepare + p->lazy; + lll->lazy_prepare = p->lazy; + lll->latency_event = lll->latency_prepare + lll->lazy_prepare; /* Calculate the current event counter value */ event_counter = lll->event_counter + lll->latency_event; @@ -161,6 +153,15 @@ static int prepare_cb(struct lll_prepare_param *p) lll->data_chan_count); } + /* Accumulate window widening */ + lll->periph.window_widening_prepare_us += + lll->periph.window_widening_periodic_us * (lll->lazy_prepare + 1U); + if (lll->periph.window_widening_prepare_us > + lll->periph.window_widening_max_us) { + lll->periph.window_widening_prepare_us = + lll->periph.window_widening_max_us; + } + /* current window widening */ lll->periph.window_widening_event_us += lll->periph.window_widening_prepare_us; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c index 4c57de3e06585..b79869111baa8 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c @@ -95,29 +95,15 @@ void lll_peripheral_iso_prepare(void *param) { struct lll_conn_iso_group *cig_lll; struct lll_prepare_param *p; - uint16_t elapsed; int err; /* Initiate HF clock start up */ err = lll_hfclock_on(); LL_ASSERT(err >= 0); - /* Instants elapsed */ p = param; - elapsed = p->lazy + 1U; - /* Save the (latency + 1) for use in event and/or supervision timeout */ cig_lll = p->param; - cig_lll->latency_prepare += elapsed; - - /* Accumulate window widening */ - cig_lll->window_widening_prepare_us_frac += - cig_lll->window_widening_periodic_us_frac * elapsed; - if (cig_lll->window_widening_prepare_us_frac > - EVENT_US_TO_US_FRAC(cig_lll->window_widening_max_us)) { - cig_lll->window_widening_prepare_us_frac = - EVENT_US_TO_US_FRAC(cig_lll->window_widening_max_us); - } /* Invoke common pipeline handling of prepare */ err = lll_prepare(lll_is_abort_cb, abort_cb, prepare_cb, 0U, param); @@ -152,7 +138,6 @@ static int prepare_cb(struct lll_prepare_param *p) memq_link_t *link; uint32_t start_us; uint32_t hcto; - uint16_t lazy; uint32_t ret; uint8_t phy; int err = 0; @@ -190,14 +175,23 @@ static int prepare_cb(struct lll_prepare_param *p) &data_chan_prn_s, &data_chan_remap_idx); - /* Store the current event latency */ - cig_lll->latency_event = cig_lll->latency_prepare; - lazy = cig_lll->latency_prepare - 1U; + /* Calculate the current event latency */ + cig_lll->lazy_prepare = p->lazy; + cig_lll->latency_event = cig_lll->latency_prepare + cig_lll->lazy_prepare; /* Reset accumulated latencies */ cig_lll->latency_prepare = 0U; - /* current window widening */ + /* Accumulate window widening */ + cig_lll->window_widening_prepare_us_frac += + cig_lll->window_widening_periodic_us_frac * (cig_lll->lazy_prepare + 1U); + if (cig_lll->window_widening_prepare_us_frac > + EVENT_US_TO_US_FRAC(cig_lll->window_widening_max_us)) { + cig_lll->window_widening_prepare_us_frac = + EVENT_US_TO_US_FRAC(cig_lll->window_widening_max_us); + } + + /* Current window widening */ cig_lll->window_widening_event_us_frac += cig_lll->window_widening_prepare_us_frac; cig_lll->window_widening_prepare_us_frac = 0; @@ -210,7 +204,7 @@ static int prepare_cb(struct lll_prepare_param *p) se_curr = 1U; /* Adjust sn and nesn for skipped CIG events */ - payload_count_lazy(cis_lll, lazy); + payload_count_lazy(cis_lll, cig_lll->lazy_prepare); /* Start setting up of Radio h/w */ radio_reset(); @@ -381,7 +375,7 @@ static int prepare_cb(struct lll_prepare_param *p) } /* Adjust sn and nesn for skipped CIG events */ - payload_count_lazy(cis_lll, lazy); + payload_count_lazy(cis_lll, cig_lll->lazy_prepare); /* Adjust sn and nesn for canceled events */ if (err) { @@ -405,13 +399,13 @@ static int prepare_cb(struct lll_prepare_param *p) static void abort_cb(struct lll_prepare_param *prepare_param, void *param) { + struct lll_conn_iso_group *cig_lll; int err; /* NOTE: This is not a prepare being cancelled */ if (!prepare_param) { struct lll_conn_iso_stream *next_cis_lll; struct lll_conn_iso_stream *cis_lll; - struct lll_conn_iso_group *cig_lll; cis_lll = ull_conn_iso_lll_stream_get(cis_handle_curr); cig_lll = param; @@ -442,6 +436,22 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) err = lll_hfclock_off(); LL_ASSERT(err >= 0); + /* Get reference to CIG LLL context */ + cig_lll = prepare_param->param; + + /* Accumulate the latency as event is aborted while being in pipeline */ + cig_lll->lazy_prepare = prepare_param->lazy; + cig_lll->latency_prepare += (cig_lll->lazy_prepare + 1U); + + /* Accumulate window widening */ + cig_lll->window_widening_prepare_us_frac += + cig_lll->window_widening_periodic_us_frac * (cig_lll->lazy_prepare + 1U); + if (cig_lll->window_widening_prepare_us_frac > + EVENT_US_TO_US_FRAC(cig_lll->window_widening_max_us)) { + cig_lll->window_widening_prepare_us_frac = + EVENT_US_TO_US_FRAC(cig_lll->window_widening_max_us); + } + lll_done(param); } diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c index 36949e334f099..40eac85cb7773 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync.c @@ -132,9 +132,11 @@ static void prepare(void *param) lll = p->param; + lll->lazy_prepare = p->lazy; + /* Accumulate window widening */ lll->window_widening_prepare_us += lll->window_widening_periodic_us * - (p->lazy + 1U); + (lll->lazy_prepare + 1U); if (lll->window_widening_prepare_us > lll->window_widening_max_us) { lll->window_widening_prepare_us = lll->window_widening_max_us; } @@ -272,7 +274,7 @@ static int create_prepare_cb(struct lll_prepare_param *p) lll = p->param; /* Calculate the current event latency */ - lll->skip_event = lll->skip_prepare + p->lazy; + lll->skip_event = lll->skip_prepare + lll->lazy_prepare; /* Calculate the current event counter value */ event_counter = lll->event_counter + lll->skip_event; @@ -360,7 +362,7 @@ static int prepare_cb(struct lll_prepare_param *p) lll = p->param; /* Calculate the current event latency */ - lll->skip_event = lll->skip_prepare + p->lazy; + lll->skip_event = lll->skip_prepare + lll->lazy_prepare; /* Calculate the current event counter value */ event_counter = lll->event_counter + lll->skip_event; @@ -631,7 +633,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) /* Accumulate the latency as event is aborted while being in pipeline */ lll = prepare_param->param; - lll->skip_prepare += (prepare_param->lazy + 1U); + lll->skip_prepare += (lll->lazy_prepare + 1U); /* Extra done event, to check sync lost */ e = ull_event_done_extra_get(); diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn.c b/subsys/bluetooth/controller/ll_sw/ull_conn.c index 19eaa527aa8cd..1af9bacea20c7 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn.c +++ b/subsys/bluetooth/controller/ll_sw/ull_conn.c @@ -1015,11 +1015,6 @@ void ull_conn_done(struct node_rx_event_done *done) #else latency_event = lll->latency_event; #endif - if (lll->latency_prepare) { - elapsed_event = latency_event + lll->latency_prepare; - } else { - elapsed_event = latency_event + 1U; - } /* Peripheral drift compensation calc and new latency or * central terminate acked @@ -1054,6 +1049,8 @@ void ull_conn_done(struct node_rx_event_done *done) conn->connect_expire = 0U; } + elapsed_event = latency_event + lll->lazy_prepare + 1U; + /* Reset supervision countdown */ if (done->extra.crc_valid && !done->extra.is_aborted) { conn->supervision_expire = 0U; diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn_iso.c b/subsys/bluetooth/controller/ll_sw/ull_conn_iso.c index 4e23cf263c633..a55d023668f63 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_conn_iso.c @@ -489,22 +489,26 @@ void ull_conn_iso_done(struct node_rx_event_done *done) conn->supervision_timeout * 10U * 1000U, cig->iso_interval * CONN_INT_UNIT_US); - } else if (cis->event_expire > cig->lll.latency_event) { - cis->event_expire -= cig->lll.latency_event; - } else { - cis->event_expire = 0U; - - /* Stop CIS and defer cleanup to after teardown. This will - * only generate a terminate event to the host if CIS has - * been established. If CIS was not established, the - * teardown will send CIS_ESTABLISHED with failure. - */ - ull_conn_iso_cis_stop(cis, NULL, - cis->established ? - BT_HCI_ERR_CONN_TIMEOUT : - BT_HCI_ERR_CONN_FAIL_TO_ESTAB); - + uint16_t event_elapsed; + + event_elapsed = cig->lll.latency_event + + cig->lll.lazy_prepare + 1U; + if (cis->event_expire > event_elapsed) { + cis->event_expire -= event_elapsed; + } else { + cis->event_expire = 0U; + + /* Stop CIS and defer cleanup to after teardown. + * This will only generate a terminate event to the + * host if CIS has been established. If CIS was not + * established, the teardown will send + * CIS_ESTABLISHED with failure. + */ + ull_conn_iso_cis_stop(cis, NULL, cis->established ? + BT_HCI_ERR_CONN_TIMEOUT : + BT_HCI_ERR_CONN_FAIL_TO_ESTAB); + } } } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_sync.c b/subsys/bluetooth/controller/ll_sw/ull_sync.c index bc7b673b97ecd..900e35cecd657 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sync.c +++ b/subsys/bluetooth/controller/ll_sw/ull_sync.c @@ -1016,14 +1016,7 @@ void ull_sync_established_report(memq_link_t *link, struct node_rx_pdu *rx) void ull_sync_done(struct node_rx_event_done *done) { - uint32_t ticks_drift_minus; - uint32_t ticks_drift_plus; struct ll_sync_set *sync; - uint16_t elapsed_event; - uint16_t skip_event; - uint8_t force_lll; - uint16_t lazy; - uint8_t force; /* Get reference to ULL context */ sync = CONTAINER_OF(done->param, struct ll_sync_set, ull); @@ -1053,17 +1046,19 @@ void ull_sync_done(struct node_rx_event_done *done) } else #endif /* CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING */ { + uint32_t ticks_drift_minus; + uint32_t ticks_drift_plus; + uint16_t elapsed_event; struct lll_sync *lll; + uint16_t skip_event; + uint8_t force_lll; + uint16_t lazy; + uint8_t force; lll = &sync->lll; /* Events elapsed used in timeout checks below */ skip_event = lll->skip_event; - if (lll->skip_prepare) { - elapsed_event = skip_event + lll->skip_prepare; - } else { - elapsed_event = skip_event + 1U; - } /* Sync drift compensation and new skip calculation */ ticks_drift_plus = 0U; @@ -1079,6 +1074,8 @@ void ull_sync_done(struct node_rx_event_done *done) sync->sync_expire = 0U; } + elapsed_event = skip_event + lll->lazy_prepare + 1U; + /* Reset supervision countdown */ if (done->extra.crc_valid) { sync->timeout_expire = 0U; From 86f65f2591a533212098ff1faa08b741dba1863c Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Wed, 25 Sep 2024 10:50:43 -0500 Subject: [PATCH 0527/4482] dts: nxp: Rename nxp,iap-msf1 to nxp,msf1 IAP is a reference to the method of software interaction with the flash used in the current driver implementing support for this flash. The DT compatible should not be named like this. Signed-off-by: Declan Snyder --- drivers/flash/Kconfig.mcux | 2 +- drivers/flash/soc_flash_mcux.c | 8 ++++---- dts/arm/nxp/nxp_mcxa156.dtsi | 2 +- dts/arm/nxp/nxp_mcxn23x_common.dtsi | 2 +- dts/arm/nxp/nxp_mcxn94x_common.dtsi | 2 +- dts/arm/nxp/nxp_mcxw71.dtsi | 3 +-- .../flash_controller/{nxp,iap-msf1.yaml => nxp,msf1.yaml} | 2 +- 7 files changed, 10 insertions(+), 11 deletions(-) rename dts/bindings/flash_controller/{nxp,iap-msf1.yaml => nxp,msf1.yaml} (83%) diff --git a/drivers/flash/Kconfig.mcux b/drivers/flash/Kconfig.mcux index 2ec37bc5f62c7..df2ba1ecc6992 100644 --- a/drivers/flash/Kconfig.mcux +++ b/drivers/flash/Kconfig.mcux @@ -8,7 +8,7 @@ config SOC_FLASH_MCUX DT_HAS_NXP_KINETIS_FTFL_ENABLED || \ DT_HAS_NXP_IAP_FMC55_ENABLED || \ DT_HAS_NXP_IAP_FMC553_ENABLED || \ - DT_HAS_NXP_IAP_MSF1_ENABLED + DT_HAS_NXP_MSF1_ENABLED select FLASH_HAS_PAGE_LAYOUT select FLASH_HAS_DRIVER_ENABLED select FLASH_HAS_EXPLICIT_ERASE diff --git a/drivers/flash/soc_flash_mcux.c b/drivers/flash/soc_flash_mcux.c index 5cf62cfe65a57..bcde5bcfc8878 100644 --- a/drivers/flash/soc_flash_mcux.c +++ b/drivers/flash/soc_flash_mcux.c @@ -34,9 +34,9 @@ LOG_MODULE_REGISTER(flash_mcux); #elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_iap_fmc553)) #define DT_DRV_COMPAT nxp_iap_fmc553 #define SOC_HAS_IAP 1 -#elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_iap_msf1)) -#define DT_DRV_COMPAT nxp_iap_msf1 -#define SOC_HAS_IAP_MSF1 1 +#elif DT_NODE_HAS_STATUS_OKAY(DT_INST(0, nxp_msf1)) +#define DT_DRV_COMPAT nxp_msf1 +#define SOC_HAS_MSF1 1 #else #error No matching compatible for soc_flash_mcux.c #endif @@ -300,7 +300,7 @@ static const struct flash_driver_api flash_mcux_api = { #endif }; -#if (defined(SOC_HAS_IAP) || defined(SOC_HAS_IAP_MSF1)) && !defined(CONFIG_MCUX_FLASH_K4_API) +#if (defined(SOC_HAS_IAP) || defined(SOC_HAS_MSF1)) && !defined(CONFIG_MCUX_FLASH_K4_API) #define FLASH_PROP_BLOCK_BASE kFLASH_PropertyPflashBlockBaseAddr #else #define FLASH_PROP_BLOCK_BASE kFLASH_PropertyPflash0BlockBaseAddr diff --git a/dts/arm/nxp/nxp_mcxa156.dtsi b/dts/arm/nxp/nxp_mcxa156.dtsi index a7d4eddc90e79..3397861dc6392 100644 --- a/dts/arm/nxp/nxp_mcxa156.dtsi +++ b/dts/arm/nxp/nxp_mcxa156.dtsi @@ -136,7 +136,7 @@ }; fmu: flash-controller@40095000 { - compatible = "nxp,iap-msf1"; + compatible = "nxp,msf1"; reg = <0x40095000 0x1000>; interrupts = <12 0>; diff --git a/dts/arm/nxp/nxp_mcxn23x_common.dtsi b/dts/arm/nxp/nxp_mcxn23x_common.dtsi index 18495b1069c8d..4d8c1992081e7 100644 --- a/dts/arm/nxp/nxp_mcxn23x_common.dtsi +++ b/dts/arm/nxp/nxp_mcxn23x_common.dtsi @@ -485,7 +485,7 @@ }; fmu: flash-controller@43000 { - compatible = "nxp,iap-msf1"; + compatible = "nxp,msf1"; reg = <0x43000 0x1000>; interrupts = <138 0>; status = "disabled"; diff --git a/dts/arm/nxp/nxp_mcxn94x_common.dtsi b/dts/arm/nxp/nxp_mcxn94x_common.dtsi index e521ba97532b1..bb33a8f6081b3 100644 --- a/dts/arm/nxp/nxp_mcxn94x_common.dtsi +++ b/dts/arm/nxp/nxp_mcxn94x_common.dtsi @@ -560,7 +560,7 @@ }; fmu: flash-controller@43000 { - compatible = "nxp,iap-msf1"; + compatible = "nxp,msf1"; reg = <0x43000 0x1000>; interrupts = <138 0>; status = "disabled"; diff --git a/dts/arm/nxp/nxp_mcxw71.dtsi b/dts/arm/nxp/nxp_mcxw71.dtsi index 0434a9fd693b6..0ca30b04a0be2 100644 --- a/dts/arm/nxp/nxp_mcxw71.dtsi +++ b/dts/arm/nxp/nxp_mcxw71.dtsi @@ -83,8 +83,7 @@ ranges = <0x0 0x10000000 DT_SIZE_M(1)>; #address-cells = <1>; #size-cells = <1>; - - compatible = "nxp,iap-msf1"; + compatible = "nxp,msf1"; reg = <0x20000 0x1000>; interrupts = <27 0>; status = "disabled"; diff --git a/dts/bindings/flash_controller/nxp,iap-msf1.yaml b/dts/bindings/flash_controller/nxp,msf1.yaml similarity index 83% rename from dts/bindings/flash_controller/nxp,iap-msf1.yaml rename to dts/bindings/flash_controller/nxp,msf1.yaml index 63eef10a7d738..c9012ab582e9d 100644 --- a/dts/bindings/flash_controller/nxp,iap-msf1.yaml +++ b/dts/bindings/flash_controller/nxp,msf1.yaml @@ -3,6 +3,6 @@ description: NXP MSF1 Flash Memory Module (FMU) -compatible: "nxp,iap-msf1" +compatible: "nxp,msf1" include: flash-controller.yaml From 719a21a3120a37e9a713e722e1872617b3d9e341 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Wed, 25 Sep 2024 11:53:37 -0500 Subject: [PATCH 0528/4482] boards: nxp: Add missing RW board feature tables Add missing items to RW board feature tables. Signed-off-by: Declan Snyder --- boards/nxp/frdm_rw612/doc/index.rst | 11 +++++++++++ boards/nxp/rd_rw612_bga/doc/index.rst | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/boards/nxp/frdm_rw612/doc/index.rst b/boards/nxp/frdm_rw612/doc/index.rst index 0044b09cb9c04..8cc6dee6bf855 100644 --- a/boards/nxp/frdm_rw612/doc/index.rst +++ b/boards/nxp/frdm_rw612/doc/index.rst @@ -59,6 +59,17 @@ Supported Features +-----------+------------+-----------------------------------+ | OS_TIMER | on-chip | os timer | +-----------+------------+-----------------------------------+ +| PM | on-chip | power management; uses SoC Power | +| | | Modes 1 and 2 | ++-----------+------------+-----------------------------------+ +| BLE | on-chip | Bluetooth | ++-----------+------------+-----------------------------------+ +| ADC | on-chip | adc | ++-----------+------------+-----------------------------------+ +| DAC | on-chip | dac | ++-----------+------------+-----------------------------------+ +| ENET | on-chip | ethernet | ++-----------+------------+-----------------------------------+ The default configuration can be found in the defconfig file: diff --git a/boards/nxp/rd_rw612_bga/doc/index.rst b/boards/nxp/rd_rw612_bga/doc/index.rst index 8fbed455eb2be..0c1e0977a7efb 100644 --- a/boards/nxp/rd_rw612_bga/doc/index.rst +++ b/boards/nxp/rd_rw612_bga/doc/index.rst @@ -68,6 +68,12 @@ Supported Features +-----------+------------+-----------------------------------+ | BLE | on-chip | Bluetooth | +-----------+------------+-----------------------------------+ +| ADC | on-chip | adc | ++-----------+------------+-----------------------------------+ +| DAC | on-chip | dac | ++-----------+------------+-----------------------------------+ +| ENET | on-chip | ethernet | ++-----------+------------+-----------------------------------+ The default configuration can be found in the defconfig file: From 42c43b9f9caa0cf5a92d2531849612359a709374 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Wed, 25 Sep 2024 14:29:23 -0500 Subject: [PATCH 0529/4482] boards: frdm_rw612: Add ethernet to twister yaml Add netif:eth to twister yaml for frdm_rw612 Exclude from wifi test because of binary blob requirement Signed-off-by: Declan Snyder --- boards/nxp/frdm_rw612/frdm_rw612.yaml | 1 + tests/net/wifi/wifi_nm/testcase.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/boards/nxp/frdm_rw612/frdm_rw612.yaml b/boards/nxp/frdm_rw612/frdm_rw612.yaml index 813330e2b5697..c6a4ca9e36e1d 100644 --- a/boards/nxp/frdm_rw612/frdm_rw612.yaml +++ b/boards/nxp/frdm_rw612/frdm_rw612.yaml @@ -26,3 +26,4 @@ supported: - hwinfo - adc - dac + - netif:eth diff --git a/tests/net/wifi/wifi_nm/testcase.yaml b/tests/net/wifi/wifi_nm/testcase.yaml index 448642587aa51..fbc34556b9b9f 100644 --- a/tests/net/wifi/wifi_nm/testcase.yaml +++ b/tests/net/wifi/wifi_nm/testcase.yaml @@ -9,3 +9,4 @@ tests: tags: wifi net platform_exclude: - rd_rw612_bga/rw612/ethernet # Requires binary blobs to build + - frdm_rw612 # Requires binary blobs to build From 52c6a289f169f806676093b3446a3ee8972ba652 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Thu, 26 Sep 2024 09:45:58 +0200 Subject: [PATCH 0530/4482] drivers: stepper: adi: trinamic tmc5041 This commit introduces initial structure for trinamic drivers TMC5041 is implemented with following features: - StallGuard - RAMPSTAT_POLL - RAMP_GEN Signed-off-by: Dipak Shetty Signed-off-by: Jilay Pandya --- drivers/stepper/CMakeLists.txt | 6 +- drivers/stepper/Kconfig | 1 + drivers/stepper/adi_tmc/CMakeLists.txt | 6 + drivers/stepper/adi_tmc/Kconfig | 56 ++ .../adi_tmc/adi_tmc5041_stepper_controller.c | 762 ++++++++++++++++++ drivers/stepper/adi_tmc/adi_tmc_reg.h | 148 ++++ drivers/stepper/adi_tmc/adi_tmc_spi.c | 118 +++ drivers/stepper/adi_tmc/adi_tmc_spi.h | 63 ++ dts/bindings/stepper/adi/adi,tmc5041.yaml | 67 ++ .../stepper/adi/adi,trinamic-gconf.yaml | 74 ++ .../adi/adi,trinamic-ramp-generator.yaml | 133 +++ .../stepper/adi/adi,trinamic-stallguard.yaml | 36 + dts/bindings/stepper/stepper-controller.yaml | 6 + include/zephyr/drivers/stepper.h | 5 + .../zephyr/drivers/stepper/stepper_trinamic.h | 172 ++++ 15 files changed, 1652 insertions(+), 1 deletion(-) create mode 100644 drivers/stepper/adi_tmc/CMakeLists.txt create mode 100644 drivers/stepper/adi_tmc/Kconfig create mode 100644 drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c create mode 100644 drivers/stepper/adi_tmc/adi_tmc_reg.h create mode 100644 drivers/stepper/adi_tmc/adi_tmc_spi.c create mode 100644 drivers/stepper/adi_tmc/adi_tmc_spi.h create mode 100644 dts/bindings/stepper/adi/adi,tmc5041.yaml create mode 100644 dts/bindings/stepper/adi/adi,trinamic-gconf.yaml create mode 100644 dts/bindings/stepper/adi/adi,trinamic-ramp-generator.yaml create mode 100644 dts/bindings/stepper/adi/adi,trinamic-stallguard.yaml create mode 100644 include/zephyr/drivers/stepper/stepper_trinamic.h diff --git a/drivers/stepper/CMakeLists.txt b/drivers/stepper/CMakeLists.txt index f45c0d0d717e1..a73875a285ce0 100644 --- a/drivers/stepper/CMakeLists.txt +++ b/drivers/stepper/CMakeLists.txt @@ -3,9 +3,13 @@ zephyr_syscall_header(${ZEPHYR_BASE}/include/zephyr/drivers/stepper.h) +# zephyr-keep-sorted-start +add_subdirectory_ifdef(CONFIG_STEPPER_ADI_TMC adi_tmc) +# zephyr-keep-sorted-stop + zephyr_library() +zephyr_library_property(ALLOW_EMPTY TRUE) zephyr_library_sources_ifdef(CONFIG_FAKE_STEPPER fake_stepper_controller.c) zephyr_library_sources_ifdef(CONFIG_GPIO_STEPPER gpio_stepper_controller.c) - zephyr_library_sources_ifdef(CONFIG_STEPPER_SHELL stepper_shell.c) diff --git a/drivers/stepper/Kconfig b/drivers/stepper/Kconfig index 43e4c2d49aecc..f382265b518dd 100644 --- a/drivers/stepper/Kconfig +++ b/drivers/stepper/Kconfig @@ -49,6 +49,7 @@ config STEPPER_SHELL_THREAD_PRIORITY comment "Stepper Drivers" +rsource "adi_tmc/Kconfig" rsource "Kconfig.fake" rsource "Kconfig.gpio" diff --git a/drivers/stepper/adi_tmc/CMakeLists.txt b/drivers/stepper/adi_tmc/CMakeLists.txt new file mode 100644 index 0000000000000..a972c9b54dca6 --- /dev/null +++ b/drivers/stepper/adi_tmc/CMakeLists.txt @@ -0,0 +1,6 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library() +zephyr_library_sources_ifdef(CONFIG_STEPPER_ADI_TMC_SPI adi_tmc_spi.c) +zephyr_library_sources_ifdef(CONFIG_STEPPER_ADI_TMC5041 adi_tmc5041_stepper_controller.c) diff --git a/drivers/stepper/adi_tmc/Kconfig b/drivers/stepper/adi_tmc/Kconfig new file mode 100644 index 0000000000000..b787b6e1af396 --- /dev/null +++ b/drivers/stepper/adi_tmc/Kconfig @@ -0,0 +1,56 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG +# SPDX-License-Identifier: Apache-2.0 + +menuconfig STEPPER_ADI_TMC + bool "Trinamic Stepper Controller" + depends on STEPPER + default y + help + Enable trinamic stepper controller + +if STEPPER_ADI_TMC + +config STEPPER_ADI_TMC_RAMP_GEN + bool "Use Trinamic Stepper Controller with Ramp Generator" + depends on STEPPER_ADI_TMC + default y + help + Enable ramp generator for trinamic stepper controller + +config STEPPER_ADI_TMC_SPI + bool "Use Trinamic Stepper Controller with SPI" + depends on STEPPER_ADI_TMC + select SPI + help + A Trinamic Stepper Controller with SPI is enabled + +comment "Trinamic Stepper Drivers" + +config STEPPER_ADI_TMC5041 + bool "Activate trinamic tmc5041 stepper driver" + depends on DT_HAS_ADI_TMC5041_ENABLED && STEPPER_ADI_TMC + select STEPPER_ADI_TMC_SPI + default y + help + Stepper driver for TMC5041. + +config STEPPER_ADI_TMC5041_RAMPSTAT_POLL + bool "TMC5041 poll ramp status" + depends on STEPPER_ADI_TMC5041 + select POLL + default y + help + When enabled, the ramp status will be polled on TMC5041, to check for events: + - TMC5041_POS_REACHED_EVENT + - TMC5041_STOP_SG_EVENT + - TMC5041_STOP_LEFT_EVENT + - TMC5041_STOP_RIGHT_EVENT + +config STEPPER_ADI_TMC5041_RAMPSTAT_POLL_INTERVAL_IN_MSEC + int "TMC5041 poll ramp status interval in ms" + depends on STEPPER_ADI_TMC5041_RAMPSTAT_POLL + default 100 + help + The interval in ms to poll the ramp status on TMC5041. + +endif # STEPPER_ADI_TMC diff --git a/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c b/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c new file mode 100644 index 0000000000000..8c7b05492a80a --- /dev/null +++ b/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c @@ -0,0 +1,762 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT adi_tmc5041 + +#include "stdlib.h" + +#include +#include + +#include "adi_tmc_reg.h" +#include "adi_tmc_spi.h" + +#include + +LOG_MODULE_REGISTER(tmc5041, CONFIG_STEPPER_LOG_LEVEL); + +struct tmc5041_data { + struct k_sem sem; +}; + +struct tmc5041_config { + const uint32_t gconf; + struct spi_dt_spec spi; + const uint32_t clock_frequency; +}; + +struct tmc5041_stepper_data { + struct k_work_delayable stallguard_dwork; + /* Work item to run the callback in a thread context. */ +#ifdef CONFIG_STEPPER_ADI_TMC5041_RAMPSTAT_POLL + struct k_work_delayable rampstat_callback_dwork; +#endif + /* device pointer required to access config in k_work */ + const struct device *stepper; + struct k_poll_signal *async_signal; +}; + +struct tmc5041_stepper_config { + const uint8_t index; + const uint16_t default_micro_step_res; + const int8_t sg_threshold; + const bool is_sg_enabled; + const uint32_t sg_velocity_check_interval_ms; + const uint32_t sg_threshold_velocity; + /* parent controller required for bus communication */ + const struct device *controller; +#ifdef CONFIG_STEPPER_ADI_TMC_RAMP_GEN + const struct tmc_ramp_generator_data default_ramp_config; +#endif +}; + +static int tmc5041_write(const struct device *dev, const uint8_t reg_addr, const uint32_t reg_val) +{ + const struct tmc5041_config *config = dev->config; + struct tmc5041_data *data = dev->data; + const struct spi_dt_spec bus = config->spi; + int err; + + k_sem_take(&data->sem, K_FOREVER); + + err = tmc_spi_write_register(&bus, TMC5041_WRITE_BIT, reg_addr, reg_val); + + k_sem_give(&data->sem); + + if (err) { + LOG_ERR("Failed to write register 0x%x with value 0x%x", reg_addr, reg_val); + return err; + } + return 0; +} + +static int tmc5041_read(const struct device *dev, const uint8_t reg_addr, uint32_t *reg_val) +{ + const struct tmc5041_config *config = dev->config; + struct tmc5041_data *data = dev->data; + const struct spi_dt_spec bus = config->spi; + int err; + + k_sem_take(&data->sem, K_FOREVER); + + err = tmc_spi_read_register(&bus, TMC5041_ADDRESS_MASK, reg_addr, reg_val); + + k_sem_give(&data->sem); + + if (err) { + LOG_ERR("Failed to read register 0x%x", reg_addr); + return err; + } + return 0; +} + +static void calculate_velocity_from_hz_to_fclk(const struct device *dev, const uint32_t velocity_hz, + uint32_t *const velocity_fclk) +{ + const struct tmc5041_config *config = dev->config; + + *velocity_fclk = + ((uint64_t)(velocity_hz) << TMC5041_CLOCK_FREQ_SHIFT) / config->clock_frequency; + LOG_DBG("Stepper motor controller %s velocity: %d Hz, velocity_fclk: %d", dev->name, + velocity_hz, *velocity_fclk); +} + +static void set_async_signal(const struct device *dev, struct k_poll_signal *async) +{ + struct tmc5041_stepper_data *data = dev->data; + + if (!async) { + return; + } + + if (data->async_signal) { + k_poll_signal_reset(data->async_signal); + } + data->async_signal = async; +} + +static int stallguard_enable(const struct device *dev, const bool enable) +{ + const struct tmc5041_stepper_config *config = dev->config; + uint32_t reg_value; + int err; + + err = tmc5041_read(config->controller, TMC5041_SWMODE(config->index), ®_value); + if (err) { + LOG_ERR("Failed to read SWMODE register"); + return -EIO; + } + + if (enable) { + reg_value |= TMC5041_SW_MODE_SG_STOP_ENABLE; + + int32_t actual_velocity; + + err = tmc5041_read(config->controller, TMC5041_VACTUAL(config->index), + &actual_velocity); + if (err) { + LOG_ERR("Failed to read VACTUAL register"); + return -EIO; + } + + actual_velocity = (actual_velocity << (31 - TMC_RAMP_VACTUAL_SHIFT)) >> + (31 - TMC_RAMP_VACTUAL_SHIFT); + LOG_DBG("actual velocity: %d", actual_velocity); + + if (abs(actual_velocity) < config->sg_threshold_velocity) { + return -EAGAIN; + } + } else { + reg_value &= ~TMC5041_SW_MODE_SG_STOP_ENABLE; + } + err = tmc5041_write(config->controller, TMC5041_SWMODE(config->index), reg_value); + if (err) { + LOG_ERR("Failed to write SWMODE register"); + return -EIO; + } + return 0; +} + +static void stallguard_work_handler(struct k_work *work) +{ + struct k_work_delayable *dwork = k_work_delayable_from_work(work); + struct tmc5041_stepper_data *stepper_data = + CONTAINER_OF(dwork, struct tmc5041_stepper_data, stallguard_dwork); + int err; + const struct tmc5041_stepper_config *stepper_config = stepper_data->stepper->config; + + err = stallguard_enable(stepper_data->stepper, true); + if (err == -EAGAIN) { + LOG_ERR("retrying stallguard activation"); + k_work_reschedule(dwork, K_MSEC(stepper_config->sg_velocity_check_interval_ms)); + } + if (err == -EIO) { + LOG_ERR("Failed to enable stallguard because of I/O error"); + return; + } +} + +#ifdef CONFIG_STEPPER_ADI_TMC5041_RAMPSTAT_POLL + +static void emit_signal(struct k_poll_signal *async_signal, const enum stepper_signal_result signal) +{ + int err; + + if (!async_signal) { + LOG_WRN("Async signal is NULL"); + return; + } + + err = k_poll_signal_raise(async_signal, signal); + if (err != 0) { + LOG_ERR("Failed to raise signal %d error %d", signal, err); + } +} + +static void rampstat_work_handler(struct k_work *work) +{ + struct k_work_delayable *dwork = k_work_delayable_from_work(work); + + struct tmc5041_stepper_data *stepper_data = + CONTAINER_OF(dwork, struct tmc5041_stepper_data, rampstat_callback_dwork); + const struct tmc5041_stepper_config *stepper_config = stepper_data->stepper->config; + + __ASSERT_NO_MSG(stepper_config->controller != NULL); + + uint32_t drv_status; + int err; + + tmc5041_read(stepper_config->controller, TMC5041_DRVSTATUS(stepper_config->index), + &drv_status); + if (FIELD_GET(TMC5041_DRV_STATUS_SG_STATUS_MASK, drv_status) == 1U) { + LOG_INF("%s: Stall detected", stepper_data->stepper->name); + err = tmc5041_write(stepper_config->controller, + TMC5041_RAMPMODE(stepper_config->index), + TMC5041_RAMPMODE_HOLD_MODE); + if (err != 0) { + LOG_ERR("%s: Failed to stop motor", stepper_data->stepper->name); + return; + } + } + + uint32_t rampstat_value; + + err = tmc5041_read(stepper_config->controller, TMC5041_RAMPSTAT(stepper_config->index), + &rampstat_value); + if (err != 0) { + LOG_ERR("%s: Failed to read RAMPSTAT register", stepper_data->stepper->name); + return; + } + + const uint8_t ramp_stat_values = FIELD_GET(TMC5041_RAMPSTAT_INT_MASK, rampstat_value); + + if (ramp_stat_values > 0) { + switch (ramp_stat_values) { + + case TMC5041_STOP_LEFT_EVENT: + LOG_DBG("RAMPSTAT %s:Left end-stop detected", stepper_data->stepper->name); + emit_signal(stepper_data->async_signal, + STEPPER_SIGNAL_LEFT_END_STOP_DETECTED); + break; + + case TMC5041_STOP_RIGHT_EVENT: + LOG_DBG("RAMPSTAT %s:Right end-stop detected", stepper_data->stepper->name); + emit_signal(stepper_data->async_signal, + STEPPER_SIGNAL_RIGHT_END_STOP_DETECTED); + break; + + case TMC5041_POS_REACHED_EVENT: + LOG_DBG("RAMPSTAT %s:Position reached", stepper_data->stepper->name); + emit_signal(stepper_data->async_signal, STEPPER_SIGNAL_STEPS_COMPLETED); + break; + + case TMC5041_STOP_SG_EVENT: + LOG_DBG("RAMPSTAT %s:Stall detected", stepper_data->stepper->name); + stallguard_enable(stepper_data->stepper, false); + emit_signal(stepper_data->async_signal, + STEPPER_SIGNAL_SENSORLESS_STALL_DETECTED); + break; + default: + LOG_ERR("Illegal ramp stat bit field"); + break; + } + } else { + k_work_reschedule( + &stepper_data->rampstat_callback_dwork, + K_MSEC(CONFIG_STEPPER_ADI_TMC5041_RAMPSTAT_POLL_INTERVAL_IN_MSEC)); + } +} + +#endif + +static int tmc5041_stepper_enable(const struct device *dev, const bool enable) +{ + LOG_DBG("Stepper motor controller %s %s", dev->name, enable ? "enabled" : "disabled"); + const struct tmc5041_stepper_config *config = dev->config; + uint32_t reg_value; + int err; + + err = tmc5041_read(config->controller, TMC5041_CHOPCONF(config->index), ®_value); + if (err != 0) { + return -EIO; + } + + if (enable) { + reg_value |= TMC5041_CHOPCONF_DRV_ENABLE_MASK; + } else { + reg_value &= ~TMC5041_CHOPCONF_DRV_ENABLE_MASK; + } + + err = tmc5041_write(config->controller, TMC5041_CHOPCONF(config->index), reg_value); + if (err != 0) { + return -EIO; + } + return 0; +} + +static int tmc5041_stepper_is_moving(const struct device *dev, bool *is_moving) +{ + const struct tmc5041_stepper_config *config = dev->config; + uint32_t reg_value; + int err; + + err = tmc5041_read(config->controller, TMC5041_DRVSTATUS(config->index), ®_value); + + if (err != 0) { + LOG_ERR("%s: Failed to read DRVSTATUS register", dev->name); + return -EIO; + } + + *is_moving = (FIELD_GET(TMC5041_DRV_STATUS_STST_BIT, reg_value) != 1U); + LOG_DBG("Stepper motor controller %s is moving: %d", dev->name, *is_moving); + return 0; +} + +static int tmc5041_stepper_move(const struct device *dev, const int32_t steps, + struct k_poll_signal *async) +{ + const struct tmc5041_stepper_config *config = dev->config; + struct tmc5041_stepper_data *data = dev->data; + int err; + + set_async_signal(dev, async); + + if (config->is_sg_enabled) { + err = stallguard_enable(dev, false); + if (err != 0) { + return -EIO; + } + } + + int32_t position; + + err = stepper_get_actual_position(dev, &position); + if (err != 0) { + return -EIO; + } + int32_t target_position = position + steps; + + err = tmc5041_write(config->controller, TMC5041_RAMPMODE(config->index), + TMC5041_RAMPMODE_POSITIONING_MODE); + if (err != 0) { + return -EIO; + } + LOG_DBG("Stepper motor controller %s moved to %d by steps: %d", dev->name, target_position, + steps); + err = tmc5041_write(config->controller, TMC5041_XTARGET(config->index), target_position); + if (err != 0) { + return -EIO; + } + + if (config->is_sg_enabled) { + k_work_reschedule(&data->stallguard_dwork, + K_MSEC(config->sg_velocity_check_interval_ms)); + } +#ifdef CONFIG_STEPPER_ADI_TMC5041_RAMPSTAT_POLL + k_work_reschedule(&data->rampstat_callback_dwork, + K_MSEC(CONFIG_STEPPER_ADI_TMC5041_RAMPSTAT_POLL_INTERVAL_IN_MSEC)); +#endif + return 0; +} + +static int tmc5041_stepper_set_max_velocity(const struct device *dev, uint32_t velocity) +{ + const struct tmc5041_stepper_config *config = dev->config; + uint32_t velocity_fclk; + int err; + + calculate_velocity_from_hz_to_fclk(config->controller, velocity, &velocity_fclk); + err = tmc5041_write(config->controller, TMC5041_VMAX(config->index), velocity_fclk); + if (err != 0) { + LOG_ERR("%s: Failed to set max velocity", dev->name); + return -EIO; + } + return 0; +} + +static int tmc5041_stepper_set_micro_step_res(const struct device *dev, + enum micro_step_resolution res) +{ + const struct tmc5041_stepper_config *config = dev->config; + uint32_t reg_value; + int err; + + err = tmc5041_read(config->controller, TMC5041_CHOPCONF(config->index), ®_value); + if (err != 0) { + return -EIO; + } + + reg_value &= ~TMC5041_CHOPCONF_MRES_MASK; + reg_value |= ((MICRO_STEP_RES_INDEX(STEPPER_MICRO_STEP_256) - LOG2(res)) + << TMC5041_CHOPCONF_MRES_SHIFT); + + err = tmc5041_write(config->controller, TMC5041_CHOPCONF(config->index), reg_value); + if (err != 0) { + return -EIO; + } + + LOG_DBG("Stepper motor controller %s set micro step resolution to 0x%x", dev->name, + reg_value); + return 0; +} + +static int tmc5041_stepper_get_micro_step_res(const struct device *dev, + enum micro_step_resolution *res) +{ + const struct tmc5041_stepper_config *config = dev->config; + uint32_t reg_value; + int err; + + err = tmc5041_read(config->controller, TMC5041_CHOPCONF(config->index), ®_value); + if (err != 0) { + return -EIO; + } + reg_value &= TMC5041_CHOPCONF_MRES_MASK; + reg_value >>= TMC5041_CHOPCONF_MRES_SHIFT; + *res = (1 << (MICRO_STEP_RES_INDEX(STEPPER_MICRO_STEP_256) - reg_value)); + LOG_DBG("Stepper motor controller %s get micro step resolution: %d", dev->name, *res); + return 0; +} + +static int tmc5041_stepper_set_actual_position(const struct device *dev, const int32_t position) +{ + const struct tmc5041_stepper_config *config = dev->config; + int err; + + err = tmc5041_write(config->controller, TMC5041_RAMPMODE(config->index), + TMC5041_RAMPMODE_HOLD_MODE); + if (err != 0) { + return -EIO; + } + + err = tmc5041_write(config->controller, TMC5041_XACTUAL(config->index), position); + if (err != 0) { + return -EIO; + } + LOG_DBG("Stepper motor controller %s set actual position to %d", dev->name, position); + return 0; +} + +static int tmc5041_stepper_get_actual_position(const struct device *dev, int32_t *position) +{ + const struct tmc5041_stepper_config *config = dev->config; + int err; + + err = tmc5041_read(config->controller, TMC5041_XACTUAL(config->index), position); + if (err != 0) { + return -EIO; + } + LOG_DBG("%s actual position: %d", dev->name, *position); + return 0; +} + +static int tmc5041_stepper_set_target_position(const struct device *dev, const int32_t position, + struct k_poll_signal *async) +{ + LOG_DBG("Stepper motor controller %s set target position to %d", dev->name, position); + const struct tmc5041_stepper_config *config = dev->config; + struct tmc5041_stepper_data *data = dev->data; + int err; + + set_async_signal(dev, async); + + if (config->is_sg_enabled) { + stallguard_enable(dev, false); + } + + err = tmc5041_write(config->controller, TMC5041_RAMPMODE(config->index), + TMC5041_RAMPMODE_POSITIONING_MODE); + if (err != 0) { + return -EIO; + } + tmc5041_write(config->controller, TMC5041_XTARGET(config->index), position); + + if (config->is_sg_enabled) { + k_work_reschedule(&data->stallguard_dwork, + K_MSEC(config->sg_velocity_check_interval_ms)); + } +#ifdef CONFIG_STEPPER_ADI_TMC5041_RAMPSTAT_POLL + k_work_reschedule(&data->rampstat_callback_dwork, + K_MSEC(CONFIG_STEPPER_ADI_TMC5041_RAMPSTAT_POLL_INTERVAL_IN_MSEC)); +#endif + return 0; +} + +static int tmc5041_stepper_enable_constant_velocity_mode(const struct device *dev, + const enum stepper_direction direction, + const uint32_t velocity) +{ + LOG_DBG("Stepper motor controller %s enable constant velocity mode", dev->name); + const struct tmc5041_stepper_config *config = dev->config; + struct tmc5041_stepper_data *data = dev->data; + uint32_t velocity_fclk; + int err; + + calculate_velocity_from_hz_to_fclk(config->controller, velocity, &velocity_fclk); + + if (config->is_sg_enabled) { + err = stallguard_enable(dev, false); + if (err != 0) { + return -EIO; + } + } + + switch (direction) { + case STEPPER_DIRECTION_POSITIVE: + err = tmc5041_write(config->controller, TMC5041_RAMPMODE(config->index), + TMC5041_RAMPMODE_POSITIVE_VELOCITY_MODE); + if (err != 0) { + return -EIO; + } + err = tmc5041_write(config->controller, TMC5041_VMAX(config->index), velocity_fclk); + if (err != 0) { + return -EIO; + } + break; + + case STEPPER_DIRECTION_NEGATIVE: + err = tmc5041_write(config->controller, TMC5041_RAMPMODE(config->index), + TMC5041_RAMPMODE_NEGATIVE_VELOCITY_MODE); + if (err != 0) { + return -EIO; + } + err = tmc5041_write(config->controller, TMC5041_VMAX(config->index), velocity_fclk); + if (err != 0) { + return -EIO; + } + break; + } + + if (config->is_sg_enabled) { + k_work_reschedule(&data->stallguard_dwork, + K_MSEC(config->sg_velocity_check_interval_ms)); + } + return 0; +} + +#ifdef CONFIG_STEPPER_ADI_TMC_RAMP_GEN + +int tmc5041_stepper_set_ramp(const struct device *dev, + const struct tmc_ramp_generator_data *ramp_data) +{ + LOG_DBG("Stepper motor controller %s set ramp", dev->name); + const struct tmc5041_stepper_config *config = dev->config; + int err; + + err = tmc5041_write(config->controller, TMC5041_VSTART(config->index), ramp_data->vstart); + if (err != 0) { + return -EIO; + } + err = tmc5041_write(config->controller, TMC5041_A1(config->index), ramp_data->a1); + if (err != 0) { + return -EIO; + } + err = tmc5041_write(config->controller, TMC5041_AMAX(config->index), ramp_data->amax); + if (err != 0) { + return -EIO; + } + err = tmc5041_write(config->controller, TMC5041_D1(config->index), ramp_data->d1); + if (err != 0) { + return -EIO; + } + err = tmc5041_write(config->controller, TMC5041_DMAX(config->index), ramp_data->dmax); + if (err != 0) { + return -EIO; + } + err = tmc5041_write(config->controller, TMC5041_V1(config->index), ramp_data->v1); + if (err != 0) { + return -EIO; + } + err = tmc5041_write(config->controller, TMC5041_VMAX(config->index), ramp_data->vmax); + if (err != 0) { + return -EIO; + } + err = tmc5041_write(config->controller, TMC5041_VSTOP(config->index), ramp_data->vstop); + if (err != 0) { + return -EIO; + } + err = tmc5041_write(config->controller, TMC5041_TZEROWAIT(config->index), + ramp_data->tzerowait); + if (err != 0) { + return -EIO; + } + err = tmc5041_write(config->controller, TMC5041_VHIGH(config->index), ramp_data->vhigh); + if (err != 0) { + return -EIO; + } + err = tmc5041_write(config->controller, TMC5041_VCOOLTHRS(config->index), + ramp_data->vcoolthrs); + if (err != 0) { + return -EIO; + } + err = tmc5041_write(config->controller, TMC5041_IHOLD_IRUN(config->index), + ramp_data->iholdrun); + if (err != 0) { + return -EIO; + } + return 0; +} + +#endif + +static int tmc5041_init(const struct device *dev) +{ + LOG_DBG("TMC5041 stepper motor controller %s initialized", dev->name); + struct tmc5041_data *data = dev->data; + const struct tmc5041_config *config = dev->config; + int err; + + k_sem_init(&data->sem, 1, 1); + + if (!spi_is_ready_dt(&config->spi)) { + LOG_ERR("SPI bus is not ready"); + return -ENODEV; + } + + /* Init non motor-index specific registers here. */ + LOG_DBG("GCONF: %d", config->gconf); + err = tmc5041_write(dev, TMC5041_GCONF, config->gconf); + if (err != 0) { + return -EIO; + } + + /* Read GSTAT register values to clear any errors SPI Datagram. */ + uint32_t gstat_value; + + err = tmc5041_read(dev, TMC5041_GSTAT, &gstat_value); + if (err != 0) { + return -EIO; + } + + LOG_DBG("Device %s initialized", dev->name); + return 0; +} + +static int tmc5041_stepper_init(const struct device *dev) +{ + const struct tmc5041_stepper_config *stepper_config = dev->config; + struct tmc5041_stepper_data *data = dev->data; + int err; + + LOG_DBG("Controller: %s, Stepper: %s", stepper_config->controller->name, dev->name); + + if (stepper_config->is_sg_enabled) { + k_work_init_delayable(&data->stallguard_dwork, stallguard_work_handler); + + err = tmc5041_write(stepper_config->controller, + TMC5041_SWMODE(stepper_config->index), BIT(10)); + if (err != 0) { + return -EIO; + } + + LOG_DBG("Setting stall guard to %d with delay %d ms", stepper_config->sg_threshold, + stepper_config->sg_velocity_check_interval_ms); + if (!IN_RANGE(stepper_config->sg_threshold, TMC5041_SG_MIN_VALUE, + TMC5041_SG_MAX_VALUE)) { + LOG_ERR("Stallguard threshold out of range"); + return -EINVAL; + } + + int32_t stall_guard_threshold = (int32_t)stepper_config->sg_threshold; + + err = tmc5041_write( + stepper_config->controller, TMC5041_COOLCONF(stepper_config->index), + stall_guard_threshold << TMC5041_COOLCONF_SG2_THRESHOLD_VALUE_SHIFT); + if (err != 0) { + return -EIO; + } + err = stallguard_enable(dev, true); + if (err == -EAGAIN) { + LOG_ERR("retrying stallguard activation"); + k_work_reschedule(&data->stallguard_dwork, + K_MSEC(stepper_config->sg_velocity_check_interval_ms)); + } + } + +#ifdef CONFIG_STEPPER_ADI_TMC_RAMP_GEN + err = tmc5041_stepper_set_ramp(dev, &stepper_config->default_ramp_config); + if (err != 0) { + return -EIO; + } +#endif + +#if CONFIG_STEPPER_ADI_TMC5041_RAMPSTAT_POLL + k_work_init_delayable(&data->rampstat_callback_dwork, rampstat_work_handler); + k_work_reschedule(&data->rampstat_callback_dwork, + K_MSEC(CONFIG_STEPPER_ADI_TMC5041_RAMPSTAT_POLL_INTERVAL_IN_MSEC)); +#endif + err = tmc5041_stepper_set_micro_step_res(dev, stepper_config->default_micro_step_res); + if (err != 0) { + return -EIO; + } + return 0; +} + +#define TMC5041_SHAFT_CONFIG(child) \ + (DT_PROP(child, invert_direction) << TMC5041_GCONF_SHAFT_SHIFT(DT_REG_ADDR(child))) | + +#define TMC5041_STEPPER_CONFIG_DEFINE(child) \ + COND_CODE_1(DT_PROP_EXISTS(child, stallguard_threshold_velocity), \ + BUILD_ASSERT(DT_PROP(child, stallguard_threshold_velocity), \ + "stallguard threshold velocity must be a positive value"), ()); \ + IF_ENABLED(CONFIG_STEPPER_ADI_TMC_RAMP_GEN, (CHECK_RAMP_DT_DATA(child))); \ + static const struct tmc5041_stepper_config tmc5041_stepper_config_##child = { \ + .controller = DEVICE_DT_GET(DT_PARENT(child)), \ + .default_micro_step_res = DT_PROP(child, micro_step_res), \ + .index = DT_REG_ADDR(child), \ + .sg_threshold = DT_PROP(child, stallguard2_threshold), \ + .sg_threshold_velocity = DT_PROP(child, stallguard_threshold_velocity), \ + .sg_velocity_check_interval_ms = DT_PROP(child, \ + stallguard_velocity_check_interval_ms), \ + .is_sg_enabled = DT_PROP(child, activate_stallguard2), \ + IF_ENABLED(CONFIG_STEPPER_ADI_TMC_RAMP_GEN, \ + (.default_ramp_config = TMC_RAMP_DT_SPEC_GET(child))) }; + +#define TMC5041_STEPPER_DATA_DEFINE(child) \ + static struct tmc5041_stepper_data tmc5041_stepper_data_##child = { \ + .stepper = DEVICE_DT_GET(child),}; + +#define TMC5041_STEPPER_API_DEFINE(child) \ + static const struct stepper_driver_api tmc5041_stepper_api_##child = { \ + .enable = tmc5041_stepper_enable, \ + .is_moving = tmc5041_stepper_is_moving, \ + .move = tmc5041_stepper_move, \ + .set_max_velocity = tmc5041_stepper_set_max_velocity, \ + .set_micro_step_res = tmc5041_stepper_set_micro_step_res, \ + .get_micro_step_res = tmc5041_stepper_get_micro_step_res, \ + .set_actual_position = tmc5041_stepper_set_actual_position, \ + .get_actual_position = tmc5041_stepper_get_actual_position, \ + .set_target_position = tmc5041_stepper_set_target_position, \ + .enable_constant_velocity_mode = tmc5041_stepper_enable_constant_velocity_mode, \ + }; + +#define TMC5041_STEPPER_DEFINE(child) \ + DEVICE_DT_DEFINE(child, tmc5041_stepper_init, NULL, &tmc5041_stepper_data_##child, \ + &tmc5041_stepper_config_##child, POST_KERNEL, \ + CONFIG_STEPPER_INIT_PRIORITY, &tmc5041_stepper_api_##child); + +#define TMC5041_DEFINE(inst) \ + BUILD_ASSERT(DT_INST_CHILD_NUM(inst) <= 2, "tmc5041 can drive two steppers at max"); \ + BUILD_ASSERT((DT_INST_PROP(inst, clock_frequency) > 0), \ + "clock frequency must be non-zero positive value"); \ + static struct tmc5041_data tmc5041_data_##inst; \ + static const struct tmc5041_config tmc5041_config_##inst = { \ + .gconf = ( \ + (DT_INST_PROP(inst, poscmp_enable) << TMC5041_GCONF_POSCMP_ENABLE_SHIFT) |\ + (DT_INST_PROP(inst, test_mode) << TMC5041_GCONF_TEST_MODE_SHIFT) | \ + DT_INST_FOREACH_CHILD(inst, TMC5041_SHAFT_CONFIG) \ + (DT_INST_PROP(inst, lock_gconf) << TMC5041_LOCK_GCONF_SHIFT)), \ + .spi = SPI_DT_SPEC_INST_GET(inst, (SPI_OP_MODE_MASTER | SPI_TRANSFER_MSB | \ + SPI_MODE_CPOL | SPI_MODE_CPHA | SPI_WORD_SET(8)), 0), \ + .clock_frequency = DT_INST_PROP(inst, clock_frequency),}; \ + DT_INST_FOREACH_CHILD(inst, TMC5041_STEPPER_CONFIG_DEFINE); \ + DT_INST_FOREACH_CHILD(inst, TMC5041_STEPPER_DATA_DEFINE); \ + DT_INST_FOREACH_CHILD(inst, TMC5041_STEPPER_API_DEFINE); \ + DT_INST_FOREACH_CHILD(inst, TMC5041_STEPPER_DEFINE); \ + DEVICE_DT_INST_DEFINE(inst, tmc5041_init, NULL, &tmc5041_data_##inst, \ + &tmc5041_config_##inst, POST_KERNEL, CONFIG_STEPPER_INIT_PRIORITY,\ + NULL); + +DT_INST_FOREACH_STATUS_OKAY(TMC5041_DEFINE) diff --git a/drivers/stepper/adi_tmc/adi_tmc_reg.h b/drivers/stepper/adi_tmc/adi_tmc_reg.h new file mode 100644 index 0000000000000..1c88020c352a4 --- /dev/null +++ b/drivers/stepper/adi_tmc/adi_tmc_reg.h @@ -0,0 +1,148 @@ +/** + * @file drivers/stepper/adi/tmc_reg.h + * + * @brief TMC Registers + * + */ + +/* + * SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_DRIVERS_STEPPER_ADI_TMC_REG_H_ +#define ZEPHYR_DRIVERS_STEPPER_ADI_TMC_REG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef CONFIG_STEPPER_ADI_TMC5041 + +#define TMC5041_MOTOR_ADDR(m) (0x20 << (m)) +#define TMC5041_MOTOR_ADDR_DRV(m) ((m) << 4) +#define TMC5041_MOTOR_ADDR_PWM(m) ((m) << 3) + +/** + * @name TMC5041 module registers + * @anchor TMC5041_REGISTERS + * + * @{ + */ + +#define TMC5041_WRITE_BIT 0x80U +#define TMC5041_ADDRESS_MASK 0x7FU + +#define TMC5041_GCONF_POSCMP_ENABLE_SHIFT 3 +#define TMC5041_GCONF_TEST_MODE_SHIFT 7 +#define TMC5041_GCONF_SHAFT_SHIFT(n) ((n) ? 8 : 9) +#define TMC5041_LOCK_GCONF_SHIFT 10 + +#define TMC5041_GCONF 0x00 +#define TMC5041_GSTAT 0x01 +#define TMC5041_INPUT 0x04 +#define TMC5041_X_COMPARE 0x05 + +#define TMC5041_PWMCONF(motor) (0x10 | TMC5041_MOTOR_ADDR_PWM(motor)) +#define TMC5041_PWM_STATUS(motor) (0x11 | TMC5041_MOTOR_ADDR_PWM(motor)) + +#define TMC5041_RAMPMODE(motor) (0x00 | TMC5041_MOTOR_ADDR(motor)) +#define TMC5041_XACTUAL(motor) (0x01 | TMC5041_MOTOR_ADDR(motor)) +#define TMC5041_VACTUAL(motor) (0x02 | TMC5041_MOTOR_ADDR(motor)) +#define TMC5041_VSTART(motor) (0x03 | TMC5041_MOTOR_ADDR(motor)) +#define TMC5041_A1(motor) (0x04 | TMC5041_MOTOR_ADDR(motor)) +#define TMC5041_V1(motor) (0x05 | TMC5041_MOTOR_ADDR(motor)) +#define TMC5041_AMAX(motor) (0x06 | TMC5041_MOTOR_ADDR(motor)) +#define TMC5041_VMAX(motor) (0x07 | TMC5041_MOTOR_ADDR(motor)) +#define TMC5041_DMAX(motor) (0x08 | TMC5041_MOTOR_ADDR(motor)) +#define TMC5041_D1(motor) (0x0A | TMC5041_MOTOR_ADDR(motor)) +#define TMC5041_VSTOP(motor) (0x0B | TMC5041_MOTOR_ADDR(motor)) +#define TMC5041_TZEROWAIT(motor) (0x0C | TMC5041_MOTOR_ADDR(motor)) +#define TMC5041_XTARGET(motor) (0x0D | TMC5041_MOTOR_ADDR(motor)) +#define TMC5041_IHOLD_IRUN(motor) (0x10 | TMC5041_MOTOR_ADDR(motor)) +#define TMC5041_VCOOLTHRS(motor) (0x11 | TMC5041_MOTOR_ADDR(motor)) +#define TMC5041_VHIGH(motor) (0x12 | TMC5041_MOTOR_ADDR(motor)) +#define TMC5041_SWMODE(motor) (0x14 | TMC5041_MOTOR_ADDR(motor)) +#define TMC5041_RAMPSTAT(motor) (0x15 | TMC5041_MOTOR_ADDR(motor)) +#define TMC5041_XLATCH(motor) (0x16 | TMC5041_MOTOR_ADDR(motor)) + +#define TMC5041_MSLUT0(motor) (0x60 | TMC5041_MOTOR_ADDR_DRV(motor)) +#define TMC5041_MSLUT1(motor) (0x61 | TMC5041_MOTOR_ADDR_DRV(motor)) +#define TMC5041_MSLUT2(motor) (0x62 | TMC5041_MOTOR_ADDR_DRV(motor)) +#define TMC5041_MSLUT3(motor) (0x63 | TMC5041_MOTOR_ADDR_DRV(motor)) +#define TMC5041_MSLUT4(motor) (0x64 | TMC5041_MOTOR_ADDR_DRV(motor)) +#define TMC5041_MSLUT5(motor) (0x65 | TMC5041_MOTOR_ADDR_DRV(motor)) +#define TMC5041_MSLUT6(motor) (0x66 | TMC5041_MOTOR_ADDR_DRV(motor)) +#define TMC5041_MSLUT7(motor) (0x67 | TMC5041_MOTOR_ADDR_DRV(motor)) +#define TMC5041_MSLUTSEL(motor) (0x68 | TMC5041_MOTOR_ADDR_DRV(motor)) +#define TMC5041_MSLUTSTART(motor) (0x69 | TMC5041_MOTOR_ADDR_DRV(motor)) +#define TMC5041_MSCNT(motor) (0x6A | TMC5041_MOTOR_ADDR_DRV(motor)) +#define TMC5041_MSCURACT(motor) (0x6B | TMC5041_MOTOR_ADDR_DRV(motor)) +#define TMC5041_CHOPCONF(motor) (0x6C | TMC5041_MOTOR_ADDR_DRV(motor)) +#define TMC5041_COOLCONF(motor) (0x6D | TMC5041_MOTOR_ADDR_DRV(motor)) +#define TMC5041_DRVSTATUS(motor) (0x6F | TMC5041_MOTOR_ADDR_DRV(motor)) + +#define TMC5041_RAMPMODE_POSITIONING_MODE 0 +#define TMC5041_RAMPMODE_POSITIVE_VELOCITY_MODE 1 +#define TMC5041_RAMPMODE_NEGATIVE_VELOCITY_MODE 2 +#define TMC5041_RAMPMODE_HOLD_MODE 3 + +#define TMC5041_SW_MODE_SG_STOP_ENABLE BIT(10) + +#define TMC5041_RAMPSTAT_INT_MASK GENMASK(7, 4) +#define TMC5041_RAMPSTAT_INT_SHIFT 4 + +#define TMC5041_RAMPSTAT_POS_REACHED_EVENT_MASK BIT(7) +#define TMC5041_POS_REACHED_EVENT \ + (TMC5041_RAMPSTAT_POS_REACHED_EVENT_MASK >> TMC5041_RAMPSTAT_INT_SHIFT) + +#define TMC5041_RAMPSTAT_STOP_SG_EVENT_MASK BIT(6) +#define TMC5041_STOP_SG_EVENT (TMC5041_RAMPSTAT_STOP_SG_EVENT_MASK >> TMC5041_RAMPSTAT_INT_SHIFT) + +#define TMC5041_RAMPSTAT_STOP_RIGHT_EVENT_MASK BIT(5) +#define TMC5041_STOP_RIGHT_EVENT \ + (TMC5041_RAMPSTAT_STOP_RIGHT_EVENT_MASK >> TMC5041_RAMPSTAT_INT_SHIFT) + +#define TMC5041_RAMPSTAT_STOP_LEFT_EVENT_MASK BIT(4) +#define TMC5041_STOP_LEFT_EVENT \ + (TMC5041_RAMPSTAT_STOP_LEFT_EVENT_MASK >> TMC5041_RAMPSTAT_INT_SHIFT) + +#define TMC5041_DRV_STATUS_STST_BIT BIT(31) +#define TMC5041_DRV_STATUS_SG_RESULT_MASK GENMASK(9, 0) +#define TMC5041_DRV_STATUS_SG_STATUS_MASK BIT(24) +#define TMC5041_DRV_STATUS_SG_STATUS_SHIFT 24 + +#define TMC5041_SG_MIN_VALUE -64 +#define TMC5041_SG_MAX_VALUE 63 + +#define TMC5041_COOLCONF_SG2_THRESHOLD_VALUE_SHIFT 16 + +#define TMC5041_IHOLD_MASK GENMASK(4, 0) +#define TMC5041_IHOLD_SHIFT 0 +#define TMC5041_IHOLD(n) (((n) << TMC5041_IHOLD_SHIFT) & TMC5041_IHOLD_MASK) + +#define TMC5041_IRUN_MASK GENMASK(12, 8) +#define TMC5041_IRUN_SHIFT 8 +#define TMC5041_IRUN(n) (((n) << TMC5041_IRUN_SHIFT) & TMC5041_IRUN_MASK) + +#define TMC5041_IHOLDDELAY_MASK GENMASK(19, 16) +#define TMC5041_IHOLDDELAY_SHIFT 16 +#define TMC5041_IHOLDDELAY(n) (((n) << TMC5041_IHOLDDELAY_SHIFT) & TMC5041_IHOLDDELAY_MASK) + +#define TMC5041_CHOPCONF_DRV_ENABLE_MASK GENMASK(3, 0) +#define TMC5041_CHOPCONF_MRES_MASK GENMASK(27, 24) +#define TMC5041_CHOPCONF_MRES_SHIFT 24 + +#define TMC5041_CLOCK_FREQ_SHIFT 24 + +#endif + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_DRIVERS_STEPPER_ADI_TMC_REG_H_ */ diff --git a/drivers/stepper/adi_tmc/adi_tmc_spi.c b/drivers/stepper/adi_tmc/adi_tmc_spi.c new file mode 100644 index 0000000000000..7aa3bed69d56f --- /dev/null +++ b/drivers/stepper/adi_tmc/adi_tmc_spi.c @@ -0,0 +1,118 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include "adi_tmc_spi.h" + +#define BUFFER_SIZE 5U + +#include + +LOG_MODULE_REGISTER(tmc_spi, CONFIG_SPI_LOG_LEVEL); + +static void parse_tmc_spi_status(const uint8_t status_byte) +{ + if ((status_byte & BIT_MASK(0)) != 0) { + LOG_WRN("spi dataframe: reset_flag detected"); + } + if ((status_byte & BIT_MASK(1)) != 0) { + LOG_WRN("spi dataframe: driver_error(1) detected"); + } + if ((status_byte & BIT_MASK(2)) != 0) { + LOG_WRN("spi dataframe: driver_error(2) detected"); + } +} + +static void print_tx_rx_buffer(const uint8_t *const tx_buffer, const uint8_t *const rx_buffer) +{ + LOG_HEXDUMP_DBG(tx_buffer, BUFFER_SIZE, "TX: "); + LOG_HEXDUMP_DBG(rx_buffer, BUFFER_SIZE, "RX: "); +} + +int tmc_spi_read_register(const struct spi_dt_spec *bus, const uint8_t read_address_mask, + const uint8_t register_address, uint32_t *data) +{ + uint8_t tx_buffer[BUFFER_SIZE] = {read_address_mask & register_address, 0U, 0U, 0U, 0U}; + uint8_t rx_buffer[BUFFER_SIZE]; + int status; + + const struct spi_buf spi_buffer_tx = { + .buf = &tx_buffer, + .len = sizeof(tx_buffer), + }; + struct spi_buf_set spi_buffer_array_tx = { + .buffers = &spi_buffer_tx, + .count = 1U, + }; + + struct spi_buf spi_buffer_rx = { + .buf = &rx_buffer, + .len = sizeof(rx_buffer), + }; + struct spi_buf_set spi_buffer_array_rx = { + .buffers = &spi_buffer_rx, + .count = 1U, + }; + + /** send read with the address byte */ + status = spi_transceive_dt(bus, &spi_buffer_array_tx, &spi_buffer_array_rx); + if (status < 0) { + return status; + } + + print_tx_rx_buffer(tx_buffer, rx_buffer); + parse_tmc_spi_status(rx_buffer[0]); + + /** read the value from the address */ + status = spi_transceive_dt(bus, &spi_buffer_array_tx, &spi_buffer_array_rx); + if (status < 0) { + return status; + } + + *data = ((uint32_t)rx_buffer[1] << 24) + ((uint32_t)rx_buffer[2] << 16) + + ((uint32_t)rx_buffer[3] << 8) + (uint32_t)rx_buffer[4]; + + print_tx_rx_buffer(tx_buffer, rx_buffer); + parse_tmc_spi_status(rx_buffer[0]); + return status; +} + +int tmc_spi_write_register(const struct spi_dt_spec *bus, const uint8_t write_bit, + const uint8_t register_address, const uint32_t data) +{ + uint8_t tx_buffer[BUFFER_SIZE] = {write_bit | register_address, data >> 24, data >> 16, + data >> 8, data}; + uint8_t rx_buffer[BUFFER_SIZE]; + int status; + + const struct spi_buf spi_buffer_tx = { + .buf = &tx_buffer, + .len = sizeof(tx_buffer), + }; + struct spi_buf_set spi_buffer_array_tx = { + .buffers = &spi_buffer_tx, + .count = 1U, + }; + + struct spi_buf spi_buffer_rx = { + .buf = &rx_buffer, + .len = sizeof(rx_buffer), + }; + struct spi_buf_set spi_buffer_array_rx = { + .buffers = &spi_buffer_rx, + .count = 1U, + }; + + status = spi_transceive_dt(bus, &spi_buffer_array_tx, &spi_buffer_array_rx); + if (status < 0) { + return status; + } + + print_tx_rx_buffer(tx_buffer, rx_buffer); + parse_tmc_spi_status(rx_buffer[0]); + + return status; +} diff --git a/drivers/stepper/adi_tmc/adi_tmc_spi.h b/drivers/stepper/adi_tmc/adi_tmc_spi.h new file mode 100644 index 0000000000000..c228b6192d414 --- /dev/null +++ b/drivers/stepper/adi_tmc/adi_tmc_spi.h @@ -0,0 +1,63 @@ +/** + * @file drivers/stepper/adi/stepper.h + * + * @brief Private API for Trinamic SPI bus + * + */ + +/* + * SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_DRIVERS_STEPPER_ADI_TMC_SPI_H_ +#define ZEPHYR_DRIVERS_STEPPER_ADI_TMC_SPI_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief TMC SPI INTERFACE + * @ingroup io_priv_interfaces + * @{ + * + */ + +#include + +/** + * @brief Read a register from the TMC module using the SPI Bus. + * + * @param bus SPI DT information of the bus. + * @param read_address_mask Address Mask for read operation. + * @param register_address Register. + * @param data Pointer to read value. + * + * @return a value from spi_transceive(). + */ +int tmc_spi_read_register(const struct spi_dt_spec *bus, const uint8_t read_address_mask, + const uint8_t register_address, uint32_t *data); + +/** + * @brief Write into a register in the TMC module using the SPI Bus. + * + * @param bus SPI DT information of the bus. + * @param write_bit Write bit for write operation. + * @param register_address Register. + * @param data Value to be written in the register. + * + * @return a value from spi_transceive(). + */ +int tmc_spi_write_register(const struct spi_dt_spec *bus, const uint8_t write_bit, + const uint8_t register_address, const uint32_t data); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_DRIVERS_STEPPER_ADI_TMC_SPI_H_ */ diff --git a/dts/bindings/stepper/adi/adi,tmc5041.yaml b/dts/bindings/stepper/adi/adi,tmc5041.yaml new file mode 100644 index 0000000000000..882a18284ddd5 --- /dev/null +++ b/dts/bindings/stepper/adi/adi,tmc5041.yaml @@ -0,0 +1,67 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG +# SPDX-License-Identifier: Apache-2.0 + +description: Analog Devices TMC5041 Stepper Motor Controller + +compatible: "adi,tmc5041" + +include: + - name: spi-device.yaml + - name: adi,trinamic-gconf.yaml + property-allowlist: + - poscmp_enable + - shaft1 + - shaft2 + - test_mode + - lock_gconf + +properties: + "#address-cells": + default: 1 + const: 1 + + "#size-cells": + default: 0 + const: 0 + + clock-frequency: + type: int + required: true + description: | + The frequency of the clock signal provided to the TMC5041. + This is used for real world conversion. + + Hint: µstep velocity v[Hz] µsteps / s v[Hz] = v[5041] * ( fCLK[Hz]/2 / 2^23 ) + where v[5041] is the value written to the TMC5041. + +child-binding: + include: + - name: base.yaml + property-allowlist: + - reg + - name: stepper-controller.yaml + property-allowlist: + - invert-direction + - micro-step-res + - name: adi,trinamic-ramp-generator.yaml + property-allowlist: + - vstart + - a1 + - v1 + - amax + - vmax + - dmax + - d1 + - vstop + - tzerowait + - vhigh + - vcoolthrs + - ihold + - irun + - iholddelay + - name: adi,trinamic-stallguard.yaml + property-allowlist: + - activate-stallguard2 + - stallguard2-threshold + - stallguard-threshold-velocity + - stallguard-velocity-check-interval-ms diff --git a/dts/bindings/stepper/adi/adi,trinamic-gconf.yaml b/dts/bindings/stepper/adi/adi,trinamic-gconf.yaml new file mode 100644 index 0000000000000..404476b8ee449 --- /dev/null +++ b/dts/bindings/stepper/adi/adi,trinamic-gconf.yaml @@ -0,0 +1,74 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG +# SPDX-License-Identifier: Apache-2.0 + +description: Global configuration flags for Trinamic stepper controller. + +properties: + en_spreadcycle: + type: boolean + description: | + A high level on the pin SPREAD inverts this flag to switch between both chopper modes. + 0: StealthChop mode + 1: SpreadCycle mode enabled + + i_scale_analog: + type: boolean + description: | + 0: Use internal reference derived from 5VOUT + 1: Use voltage supplied to VREF as current reference + + internal_rsense: + type: boolean + description: | + 0: Operation with external sense resistors + 1: Internal sense resistors. Use current supplied into VREF as reference for internal + sense resistor. VREF pin internally is driven to GND in this mode. + + index_otpw: + type: boolean + description: | + 0: INDEX shows the first microstep position of sequencer + 1: INDEX output shows step pulses from internal pulse generator (toggle upon each step) + + index_step: + type: boolean + description: | + 0: INDEX output as selected by index_otpw + 1: INDEX pin shows the current step position of sequencer + + pdn_disable: + type: boolean + description: | + 0: Normal operation + 1: Power down mode + + mstep_reg_select: + type: boolean + description: | + 0: Microstep resolution selected by pins MS1, MS2 + 1: Microstep resolution selected by MRES register + + poscmp_enable: + type: boolean + description: | + Enable position compare feature + 0: Outputs INT and PP are tristated. + 1: Position compare pulse (PP) and interrupt output (INT) are available + + Attention – do not leave the outputs floating in tristate condition, provide an external + pull-up or set poscmp_enable=1 + + test_mode: + type: boolean + description: | + Enable test mode + 0: Normal operation + 1: Enable analog test output on pin REFR2 + TEST_SEL selects the function of REFR2: 0…4: T120, DAC1, VDDH1, DAC2, VDDH2 + + Attention: Not for user, set to 0 for normal operation! + + lock_gconf: + type: boolean + description: | + 1: GCONF is locked against further write access. diff --git a/dts/bindings/stepper/adi/adi,trinamic-ramp-generator.yaml b/dts/bindings/stepper/adi/adi,trinamic-ramp-generator.yaml new file mode 100644 index 0000000000000..42d9b9e41fbff --- /dev/null +++ b/dts/bindings/stepper/adi/adi,trinamic-ramp-generator.yaml @@ -0,0 +1,133 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG +# SPDX-License-Identifier: Apache-2.0 + +description: Ramp Generator Motion Control Register-Set for Trinamic stepper controller. + +properties: + vstart: + type: int + default: 1 + description: | + Motor start velocity in [µsteps/t](unsigned) + + Normally, set VSTOP ≥ VSTART! VSTART may be + set to a higher value, when motion distance is + sufficient to allow deceleration to VSTOP. + + a1: + type: int + default: 0 + description: | + First acceleration between VSTART and V1 in [µsteps/ta²](unsigned) + + v1: + type: int + default: 0 + description: | + First acceleration / deceleration phase threshold velocity in [µsteps/t] (unsigned) + + 0: Disables A1 and D1 phase, use AMAX, DMAX only + + amax: + type: int + default: 0 + description: | + Second acceleration between V1 and VMAX in [µsteps/ta²](unsigned) + This is the acceleration and deceleration value + for velocity mode. + + vmax: + type: int + default: 0 + description: | + Motion ramp target velocity in [µsteps/t] (for positioning ensure VMAX ≥ VSTART) (unsigned) + This is the target velocity in velocity mode. It can be changed any time during a motion. + + dmax: + type: int + default: 0 + description: | + Deceleration between VMAX and V1 in [µsteps/ta²](unsigned) + + d1: + type: int + default: 1 + description: | + Deceleration between V1 and VSTOP in [µsteps/ta²](unsigned) + + Attention: Do not set 0 in positioning mode, + even if V1=0! + + vstop: + type: int + default: 10 + description: | + Motor stop velocity in [µsteps/t] (unsigned) + + Attention: Set VSTOP ≥ VSTART! + + Attention: Do not set 0 in positioning mode, + minimum 10 recommended! + + tzerowait: + type: int + default: 0 + description: | + Waiting time after ramping down to zero velocity before next movement or direction + inversion can start and before motor power down starts. Time range is about 0 to 2 + seconds. This setting avoids excess acceleration e.g. from VSTOP to -VSTART. + + ihold: + type: int + default: 0 + description: | + Hold current in % of run current (0-100) + Standstill current (0=1/32…31=32/32) + In combination with StealthChop mode, setting IHOLD=0 allows to choose freewheeling or coil + short circuit for motor stand still + + irun: + type: int + default: 0 + description: | + Motor run current (0=1/32…31=32/32) + Hint: Choose sense resistors in a way, that normal + IRUN is 16 to 31 for best microstep performance. + + iholddelay: + type: int + default: 0 + description: | + Controls the number of clock cycles for motor power down after a motion as soon as TZEROWAIT + has expired. The smooth transition avoids a motor jerk upon power down. + 0: instant power down + 1..15: Delay per current reduction step in multiple of 2^18 clocks + + vcoolthrs: + type: int + default: 0 + description: | + This is the lower threshold velocity for switching on smart energy CoolStep and StallGuard + feature. Further it is the upper operation velocity for StealthChop. (unsigned) + + Set this parameter to disable CoolStep at low speeds, where it cannot work reliably. + The stop on stall function (enable with sg_stop when using internal motion controller) + becomes enabled when exceeding this velocity. It becomes disabled again once the velocity + falls below this threshold. This allows for homing procedures with StallGuard by blanking out + the StallGuard signal at low velocities (will not work in combination with StealthChop). + VHIGH ≥ |VACT| ≥ VCOOLTHRS: + - CoolStep and stop on stall are enabled, if configured + - Voltage PWM mode StealthChop is switched off, if configured + + vhigh: + type: int + default: 0 + description: | + This velocity setting allows velocity dependent switching into a different chopper mode and + fullstepping to maximize torque.(unsigned) + |VACT| ≥ VHIGH: + - CoolStep is disabled (motor runs with normal current scale) + - If vhighchm is set, the chopper switches to chm=1 with TFD=0 + (constant off time with slow decay, only). + - If vhighfs is set, the motor operates in fullstep mode. + - Voltage PWM mode StealthChop is switched off, if configured diff --git a/dts/bindings/stepper/adi/adi,trinamic-stallguard.yaml b/dts/bindings/stepper/adi/adi,trinamic-stallguard.yaml new file mode 100644 index 0000000000000..2a68273b2f1b6 --- /dev/null +++ b/dts/bindings/stepper/adi/adi,trinamic-stallguard.yaml @@ -0,0 +1,36 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG +# SPDX-License-Identifier: Apache-2.0 + +description: Stallguard bindings for Trinamic stepper controller. + +properties: + activate-stallguard2: + type: boolean + description: | + Enable StallGuard2 feature, if the driver supports it. + + stallguard2-threshold: + type: int + default: 0 + description: | + This signed value controls StallGuard2 level for stall output and sets the + optimum measurement range for readout. A lower value gives a higher sensitivity. + Zero is the starting value working with most motors. + + -64 to +63: A higher value makes StallGuard2 less sensitive and requires more torque + to indicate a stall. + + stallguard-threshold-velocity: + type: int + default: 1 + description: | + Threshold velocity for StallGuard2 to detect a stall event. + This value should be greater than zero. + + stallguard-velocity-check-interval-ms: + type: int + default: 100 + description: | + Stallguard should not be enabled during motor spin-up. + This delay is used to check if the actual stepper velocity is greater than + stallguard-threshold-velocity before enabling stallguard. diff --git a/dts/bindings/stepper/stepper-controller.yaml b/dts/bindings/stepper/stepper-controller.yaml index b2c8e2b8643e3..48b4ec7225a6f 100644 --- a/dts/bindings/stepper/stepper-controller.yaml +++ b/dts/bindings/stepper/stepper-controller.yaml @@ -6,8 +6,14 @@ description: Stepper Controller include: base.yaml properties: + invert-direction: + type: boolean + description: | + Invert motor direction. + micro-step-res: type: int + default: 1 enum: - 1 - 2 diff --git a/include/zephyr/drivers/stepper.h b/include/zephyr/drivers/stepper.h index ba7d49cdf2973..958d21216a843 100644 --- a/include/zephyr/drivers/stepper.h +++ b/include/zephyr/drivers/stepper.h @@ -28,6 +28,8 @@ extern "C" { #endif +#define MICRO_STEP_RES_INDEX(res) LOG2(res) + /** * @brief Stepper Motor micro step resolution options */ @@ -80,6 +82,9 @@ enum stepper_run_mode { enum stepper_signal_result { /** Steps set using move or set_target_position have been executed */ STEPPER_SIGNAL_STEPS_COMPLETED = 0, + STEPPER_SIGNAL_SENSORLESS_STALL_DETECTED = 1, + STEPPER_SIGNAL_LEFT_END_STOP_DETECTED = 2, + STEPPER_SIGNAL_RIGHT_END_STOP_DETECTED = 3, }; /** diff --git a/include/zephyr/drivers/stepper/stepper_trinamic.h b/include/zephyr/drivers/stepper/stepper_trinamic.h new file mode 100644 index 0000000000000..e9c16491b331d --- /dev/null +++ b/include/zephyr/drivers/stepper/stepper_trinamic.h @@ -0,0 +1,172 @@ +/** + * @file drivers/stepper/stepper_trinamic.h + * + * @brief Public API for Trinamic Stepper Controller Specific Functions + * + */ + +/* + * SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_DRIVERS_STEPPER_STEPPER_TRINAMIC_H_ +#define ZEPHYR_INCLUDE_DRIVERS_STEPPER_STEPPER_TRINAMIC_H_ + +/** + * @brief Trinamic Stepper Controller Interface + * @defgroup trinamic_stepper_interface Trinamic Stepper Controller Interface + * @ingroup stepper_interface + * @{ + */ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Trinamic stepper controller ramp generator data limits + */ +#define TMC_RAMP_VSTART_MAX GENMASK(17, 0) +#define TMC_RAMP_VSTART_MIN 0 +#define TMC_RAMP_V1_MAX GENMASK(19, 0) +#define TMC_RAMP_V1_MIN 0 +#define TMC_RAMP_VMAX_MAX (GENMASK(22, 0) - 512) +#define TMC_RAMP_VMAX_MIN 0 +#define TMC_RAMP_A1_MAX GENMASK(15, 0) +#define TMC_RAMP_A1_MIN 0 +#define TMC_RAMP_AMAX_MAX GENMASK(15, 0) +#define TMC_RAMP_AMAX_MIN 0 +#define TMC_RAMP_D1_MAX GENMASK(15, 0) +#define TMC_RAMP_D1_MIN 1 +#define TMC_RAMP_DMAX_MAX GENMASK(15, 0) +#define TMC_RAMP_DMAX_MIN 0 +#define TMC_RAMP_VSTOP_MAX GENMASK(17, 0) +#define TMC_RAMP_VSTOP_MIN 1 +#define TMC_RAMP_TZEROWAIT_MAX (GENMASK(15, 0) - 512) +#define TMC_RAMP_TZEROWAIT_MIN 0 +#define TMC_RAMP_VCOOLTHRS_MAX GENMASK(22, 0) +#define TMC_RAMP_VCOOLTHRS_MIN 0 +#define TMC_RAMP_VHIGH_MAX GENMASK(22, 0) +#define TMC_RAMP_VHIGH_MIN 0 +#define TMC_RAMP_IHOLD_IRUN_MAX GENMASK(4, 0) +#define TMC_RAMP_IHOLD_IRUN_MIN 0 +#define TMC_RAMP_IHOLDDELAY_MAX GENMASK(3, 0) +#define TMC_RAMP_IHOLDDELAY_MIN 0 +#define TMC_RAMP_VACTUAL_SHIFT 22 +/** + * @brief Trinamic Stepper Ramp Generator data + */ +struct tmc_ramp_generator_data { + uint32_t vstart; + uint32_t v1; + uint32_t vmax; + uint16_t a1; + uint16_t amax; + uint16_t d1; + uint16_t dmax; + uint32_t vstop; + uint16_t tzerowait; + uint32_t vcoolthrs; + uint32_t vhigh; + uint32_t iholdrun; +}; + +/** + * @brief Check if Ramp DT data is within limits + */ +#define CHECK_RAMP_DT_DATA(node) \ + COND_CODE_1(DT_PROP_EXISTS(node, vstart), \ + BUILD_ASSERT(IN_RANGE(DT_PROP(node, vstart), TMC_RAMP_VSTART_MIN, \ + TMC_RAMP_VSTART_MAX), "vstart out of range"), ()); \ + COND_CODE_1(DT_PROP_EXISTS(node, v1), \ + BUILD_ASSERT(IN_RANGE(DT_PROP(node, v1), TMC_RAMP_V1_MIN, \ + TMC_RAMP_V1_MAX), "v1 out of range"), ()); \ + COND_CODE_1(DT_PROP_EXISTS(node, vmax), \ + BUILD_ASSERT(IN_RANGE(DT_PROP(node, vmax), TMC_RAMP_VMAX_MIN, \ + TMC_RAMP_VMAX_MAX), "vmax out of range"), ()); \ + COND_CODE_1(DT_PROP_EXISTS(node, a1), \ + BUILD_ASSERT(IN_RANGE(DT_PROP(node, a1), TMC_RAMP_A1_MIN, \ + TMC_RAMP_A1_MAX), "a1 out of range"), ()); \ + COND_CODE_1(DT_PROP_EXISTS(node, amax), \ + BUILD_ASSERT(IN_RANGE(DT_PROP(node, amax), TMC_RAMP_AMAX_MIN, \ + TMC_RAMP_AMAX_MAX), "amax out of range"), ()); \ + COND_CODE_1(DT_PROP_EXISTS(node, d1), \ + BUILD_ASSERT(IN_RANGE(DT_PROP(node, d1), TMC_RAMP_D1_MIN, \ + TMC_RAMP_D1_MAX), "d1 out of range"), ()); \ + COND_CODE_1(DT_PROP_EXISTS(node, dmax), \ + BUILD_ASSERT(IN_RANGE(DT_PROP(node, dmax), TMC_RAMP_DMAX_MIN, \ + TMC_RAMP_DMAX_MAX), "dmax out of range"), ()); \ + COND_CODE_1(DT_PROP_EXISTS(node, vstop), \ + BUILD_ASSERT(IN_RANGE(DT_PROP(node, vstop), TMC_RAMP_VSTOP_MIN, \ + TMC_RAMP_VSTOP_MAX), "vstop out of range"), ()); \ + COND_CODE_1(DT_PROP_EXISTS(node, tzerowait), \ + BUILD_ASSERT(IN_RANGE(DT_PROP(node, tzerowait), TMC_RAMP_TZEROWAIT_MIN, \ + TMC_RAMP_TZEROWAIT_MAX), "tzerowait out of range"), ()); \ + COND_CODE_1(DT_PROP_EXISTS(node, vcoolthrs), \ + BUILD_ASSERT(IN_RANGE(DT_PROP(node, vcoolthrs), TMC_RAMP_VCOOLTHRS_MIN, \ + TMC_RAMP_VCOOLTHRS_MAX), "vcoolthrs out of range"), ()); \ + COND_CODE_1(DT_PROP_EXISTS(node, vhigh), \ + BUILD_ASSERT(IN_RANGE(DT_PROP(node, vhigh), TMC_RAMP_VHIGH_MIN, \ + TMC_RAMP_VHIGH_MAX), "vhigh out of range"), ()); \ + COND_CODE_1(DT_PROP_EXISTS(node, ihold), \ + BUILD_ASSERT(IN_RANGE(DT_PROP(node, ihold), TMC_RAMP_IHOLD_IRUN_MIN, \ + TMC_RAMP_IHOLD_IRUN_MAX), "ihold out of range"), ()); \ + COND_CODE_1(DT_PROP_EXISTS(node, irun), \ + BUILD_ASSERT(IN_RANGE(DT_PROP(node, irun), TMC_RAMP_IHOLD_IRUN_MIN, \ + TMC_RAMP_IHOLD_IRUN_MAX), "irun out of range"), ()); \ + COND_CODE_1(DT_PROP_EXISTS(node, iholddelay), \ + BUILD_ASSERT(IN_RANGE(DT_PROP(node, iholddelay), TMC_RAMP_IHOLDDELAY_MIN, \ + TMC_RAMP_IHOLDDELAY_MAX), "iholddelay out of range"), ()); + +/** + * @brief Get Trinamic Stepper Ramp Generator data from DT + * + * @param node DT node identifier + * + * @return struct tmc_ramp_generator_data + */ +#define TMC_RAMP_DT_SPEC_GET(node) \ + { \ + .vstart = DT_PROP(node, vstart), \ + .v1 = DT_PROP(node, v1), \ + .vmax = DT_PROP(node, vmax), \ + .a1 = DT_PROP(node, a1), \ + .amax = DT_PROP(node, amax), \ + .d1 = DT_PROP(node, d1), \ + .dmax = DT_PROP(node, dmax), \ + .vstop = DT_PROP(node, vstop), \ + .tzerowait = DT_PROP(node, tzerowait), \ + .vcoolthrs = DT_PROP(node, vcoolthrs), \ + .vhigh = DT_PROP(node, vhigh), \ + .iholdrun = (TMC5041_IRUN(DT_PROP(node, irun)) | \ + TMC5041_IHOLD(DT_PROP(node, ihold)) | \ + TMC5041_IHOLDDELAY(DT_PROP(node, iholddelay))), \ + } + +/** + * @brief Configure Trinamic Stepper Ramp Generator + * + * @param dev Pointer to the stepper motor controller instance + * @param ramp_data Pointer to a struct containing the required ramp parameters + * + * @retval -EIO General input / output error + * @retval -ENOSYS If not implemented by device driver + * @retval 0 Success + */ +int tmc5041_stepper_set_ramp(const struct device *dev, + const struct tmc_ramp_generator_data *ramp_data); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_DRIVERS_STEPPER_STEPPER_TRINAMIC_H_ */ From 27572ea59d0fdb8e059e86406d1a82855907ce86 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Sun, 29 Sep 2024 15:22:57 +0200 Subject: [PATCH 0531/4482] drivers: stepper: test: build_all: tmc5041 This commit add tmc5041 to stepper build all tests Signed-off-by: Jilay Pandya --- tests/drivers/build_all/stepper/app.overlay | 16 ++++++++++++- tests/drivers/build_all/stepper/prj.conf | 2 ++ tests/drivers/build_all/stepper/spi.dtsi | 26 +++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 tests/drivers/build_all/stepper/spi.dtsi diff --git a/tests/drivers/build_all/stepper/app.overlay b/tests/drivers/build_all/stepper/app.overlay index ffcbb2b4f3175..f199789db3a3e 100644 --- a/tests/drivers/build_all/stepper/app.overlay +++ b/tests/drivers/build_all/stepper/app.overlay @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Carl Zeiss Meditec AG + * SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG * SPDX-License-Identifier: Apache-2.0 */ @@ -17,5 +17,19 @@ #include "gpio.dtsi" }; + + test_spi: spi@33334444 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "zephyr,spi-emul-controller"; + reg = <0x33334444 0x1000>; + status = "okay"; + clock-frequency = <2000000>; + + /* one entry for every devices at spi.dtsi */ + cs-gpios = <&test_gpio 0 0>; /* 0x00 */ + + #include "spi.dtsi" + }; }; }; diff --git a/tests/drivers/build_all/stepper/prj.conf b/tests/drivers/build_all/stepper/prj.conf index 5892df137a1d5..95072495fa441 100644 --- a/tests/drivers/build_all/stepper/prj.conf +++ b/tests/drivers/build_all/stepper/prj.conf @@ -3,4 +3,6 @@ CONFIG_TEST_USERSPACE=y CONFIG_LOG=y CONFIG_STEPPER_LOG_LEVEL_DBG=y CONFIG_GPIO=y +CONFIG_SPI=y CONFIG_STEPPER=y +CONFIG_EMUL=y diff --git a/tests/drivers/build_all/stepper/spi.dtsi b/tests/drivers/build_all/stepper/spi.dtsi new file mode 100644 index 0000000000000..83eae2729461b --- /dev/null +++ b/tests/drivers/build_all/stepper/spi.dtsi @@ -0,0 +1,26 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG + * SPDX-License-Identifier: Apache-2.0 + */ +/**************************************** + * PLEASE KEEP REG ADDRESSES SEQUENTIAL * + ***************************************/ + +test_spi_tmc5041: tmc5041@0 { + compatible = "adi,tmc5041"; + reg = <0x0>; + spi-max-frequency = <0>; + #address-cells = <1>; + #size-cells = <0>; + clock-frequency = <1>; + + tmc5041_0: tmc5041_0@0 { + status = "okay"; + reg = <0>; + }; + + tmc5041_1: tmc5041_1@1 { + status = "okay"; + reg = <1>; + }; +}; From 9cf1269e0e35f2bd9c4e85618468cdfabeb80771 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Tue, 8 Oct 2024 16:08:23 +0200 Subject: [PATCH 0532/4482] shell: stepper: add further stepper signals to shell This commit adds further signals to stepper shell - STEPPER_SIGNAL_SENSORLESS_STALL_DETECTED - STEPPER_SIGNAL_LEFT_END_STOP_DETECTED - STEPPER_SIGNAL_RIGHT_END_STOP_DETECTED Signed-off-by: Jilay Pandya --- drivers/stepper/stepper_shell.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/stepper/stepper_shell.c b/drivers/stepper/stepper_shell.c index 10ab67fb2c649..f761a26f8314d 100644 --- a/drivers/stepper/stepper_shell.c +++ b/drivers/stepper/stepper_shell.c @@ -445,10 +445,26 @@ static void stepper_poll_thread(void *p1, void *p2, void *p3) while (1) { k_poll(&stepper_poll_event, 1, K_FOREVER); - if (stepper_poll_event.signal->result == STEPPER_SIGNAL_STEPS_COMPLETED) { - shell_print(sh, "Stepper: All steps completed"); - k_poll_signal_reset(&stepper_signal); + switch (stepper_poll_event.signal->result) { + case STEPPER_SIGNAL_STEPS_COMPLETED: + shell_fprintf_info(sh, "Stepper: All steps completed.\n"); + break; + case STEPPER_SIGNAL_SENSORLESS_STALL_DETECTED: + shell_fprintf_info(sh, "Stepper: Sensorless stall detected.\n"); + break; + case STEPPER_SIGNAL_LEFT_END_STOP_DETECTED: + shell_fprintf_info(sh, "Stepper: Left limit switch pressed.\n"); + break; + case STEPPER_SIGNAL_RIGHT_END_STOP_DETECTED: + shell_fprintf_normal(sh, "Stepper: Right limit switch pressed.\n"); + break; + default: + shell_fprintf_error(sh, "Stepper: Unknown signal received.\n"); + break; } + + k_poll_signal_reset(&stepper_signal); + } } From ec77fc399cb15a7bc2b49c9713ad9e0c1048d697 Mon Sep 17 00:00:00 2001 From: Rafal Dyla Date: Tue, 1 Oct 2024 09:18:42 +0200 Subject: [PATCH 0533/4482] modules: hal_nordic: Add global domain power request service Service for powering peripherals that use GPIO pins in the global power domains: - Active Fast - Active Slow - Main Slow Signed-off-by: Rafal Dyla --- modules/hal_nordic/nrfs/CMakeLists.txt | 1 + modules/hal_nordic/nrfs/Kconfig | 9 +++++++++ modules/hal_nordic/nrfs/nrfs_config.h | 4 ++++ soc/nordic/nrf54h/Kconfig | 2 ++ soc/nordic/nrf92/Kconfig | 2 ++ west.yml | 2 +- 6 files changed, 19 insertions(+), 1 deletion(-) diff --git a/modules/hal_nordic/nrfs/CMakeLists.txt b/modules/hal_nordic/nrfs/CMakeLists.txt index c601b8a4233c9..f470eea00e9f0 100644 --- a/modules/hal_nordic/nrfs/CMakeLists.txt +++ b/modules/hal_nordic/nrfs/CMakeLists.txt @@ -25,6 +25,7 @@ if(CONFIG_NRFS) zephyr_library_sources_ifdef(CONFIG_NRFS_CLOCK_SERVICE_ENABLED ${SRC_DIR}/services/nrfs_clock.c) zephyr_library_sources_ifdef(CONFIG_NRFS_DIAG_SERVICE_ENABLED ${SRC_DIR}/services/nrfs_diag.c) zephyr_library_sources_ifdef(CONFIG_NRFS_DVFS_SERVICE_ENABLED ${SRC_DIR}/services/nrfs_dvfs.c) + zephyr_library_sources_ifdef(CONFIG_NRFS_GDPWR_SERVICE_ENABLED ${SRC_DIR}/services/nrfs_gdpwr.c) zephyr_library_sources_ifdef(CONFIG_NRFS_MRAM_SERVICE_ENABLED ${SRC_DIR}/services/nrfs_mram.c) zephyr_library_sources_ifdef(CONFIG_NRFS_PMIC_SERVICE_ENABLED ${SRC_DIR}/services/nrfs_pmic.c) zephyr_library_sources_ifdef(CONFIG_NRFS_RESET_SERVICE_ENABLED ${SRC_DIR}/services/nrfs_reset.c) diff --git a/modules/hal_nordic/nrfs/Kconfig b/modules/hal_nordic/nrfs/Kconfig index 96d4c7f45cd6e..7245b72875793 100644 --- a/modules/hal_nordic/nrfs/Kconfig +++ b/modules/hal_nordic/nrfs/Kconfig @@ -19,6 +19,9 @@ config NRFS_HAS_DIAG_SERVICE config NRFS_HAS_DVFS_SERVICE bool +config NRFS_HAS_GDPWR_SERVICE + bool + config NRFS_HAS_MRAM_SERVICE bool @@ -110,6 +113,12 @@ config NRFS_CLOCK_SERVICE_ENABLED bool "Clock service" depends on NRFS_HAS_CLOCK_SERVICE default y + +config NRFS_GDPWR_SERVICE_ENABLED + bool "Global domain power request service" + depends on NRFS_HAS_GDPWR_SERVICE + default y + endmenu rsource "backends/Kconfig" diff --git a/modules/hal_nordic/nrfs/nrfs_config.h b/modules/hal_nordic/nrfs/nrfs_config.h index 20cf6cece0e3e..a092adb7850f6 100644 --- a/modules/hal_nordic/nrfs/nrfs_config.h +++ b/modules/hal_nordic/nrfs/nrfs_config.h @@ -40,6 +40,10 @@ #define NRFS_CLOCK_SERVICE_ENABLED #endif +#ifdef CONFIG_NRFS_GDPWR_SERVICE_ENABLED +#define NRFS_GDPWR_SERVICE_ENABLED +#endif + #ifdef CONFIG_SOC_POSIX #define NRFS_UNIT_TESTS_ENABLED #endif diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index 51dc4e0748069..9132ca8458b82 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -24,6 +24,7 @@ config SOC_NRF54H20_CPUAPP_COMMON select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE select NRFS_HAS_CLOCK_SERVICE select NRFS_HAS_DVFS_SERVICE + select NRFS_HAS_GDPWR_SERVICE select NRFS_HAS_MRAM_SERVICE select NRFS_HAS_TEMP_SERVICE select NRFS_HAS_VBUS_DETECTOR_SERVICE @@ -49,6 +50,7 @@ config SOC_NRF54H20_CPURAD_COMMON select CPU_HAS_CUSTOM_FIXED_SOC_MPU_REGIONS select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE select NRFS_HAS_CLOCK_SERVICE + select NRFS_HAS_GDPWR_SERVICE select NRFS_HAS_MRAM_SERVICE select NRFS_HAS_TEMP_SERVICE select NRFS_HAS_VBUS_DETECTOR_SERVICE diff --git a/soc/nordic/nrf92/Kconfig b/soc/nordic/nrf92/Kconfig index f6efecb6ad07e..1f60b944b760e 100644 --- a/soc/nordic/nrf92/Kconfig +++ b/soc/nordic/nrf92/Kconfig @@ -22,6 +22,7 @@ config SOC_NRF9230_ENGB_CPUAPP select HAS_NORDIC_DMM select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE select NRFS_HAS_CLOCK_SERVICE + select NRFS_HAS_GDPWR_SERVICE select NRFS_HAS_MRAM_SERVICE select NRFS_HAS_PMIC_SERVICE select NRFS_HAS_TEMP_SERVICE @@ -40,6 +41,7 @@ config SOC_NRF9230_ENGB_CPURAD select HAS_NORDIC_DMM select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE select NRFS_HAS_CLOCK_SERVICE + select NRFS_HAS_GDPWR_SERVICE select NRFS_HAS_MRAM_SERVICE select NRFS_HAS_PMIC_SERVICE select NRFS_HAS_TEMP_SERVICE diff --git a/west.yml b/west.yml index 9ae55374a0c84..f7c3e04da5e73 100644 --- a/west.yml +++ b/west.yml @@ -188,7 +188,7 @@ manifest: groups: - hal - name: hal_nordic - revision: bc25c094a8cf3064f4f9c1e8060b46e1989edf95 + revision: 4a3ba8eaca8f5255f550db7bc54dc3e23212da64 path: modules/hal/nordic groups: - hal From 9f4ea03c53fdfb8287deb00d5c8bbaf27033c9cf Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Thu, 3 Oct 2024 12:02:13 -0700 Subject: [PATCH 0534/4482] tests: zbus/hlp_priority_boost: skip Intel audio DSP platforms All Intel Audio DSP platforms have non-coherent cache between CPUs. So the zbus_channel struct data goes out-of-sync between CPUs with multiple producer and consumer threads running concurrently on multiple CPUs, resulting in bad pointer being used, e.g. passed to memcpy(). So exclude these platforms from running in twister as they are certain to fail. Fixes: #79368 Signed-off-by: Daniel Leung --- .../zbus/hlp_priority_boost/testcase.yaml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/subsys/zbus/hlp_priority_boost/testcase.yaml b/tests/subsys/zbus/hlp_priority_boost/testcase.yaml index 54fdf3021fbb2..1196b60b19e00 100644 --- a/tests/subsys/zbus/hlp_priority_boost/testcase.yaml +++ b/tests/subsys/zbus/hlp_priority_boost/testcase.yaml @@ -1,6 +1,22 @@ tests: message_bus.zbus.hlp_priority_boost: - platform_exclude: fvp_base_revc_2xaemv8a//smp/ns + platform_exclude: + - fvp_base_revc_2xaemv8a//smp/ns + # All Intel Audio DSP platforms have non-coherent cache + # between CPUs. So the zbus_channel struct data goes + # out-of-sync between CPUs with multiple producer and + # consumer threads running concurrently on multiple CPUs, + # resulting in bad pointer being used, e.g. passed to + # memcpy(). So exclude these platforms from running in + # twister as they are certain to fail. + - intel_adsp/ace15_mtpm/sim + - intel_adsp/ace15_mtpm + - intel_adsp/ace20_lnl/sim + - intel_adsp/ace20_lnl + - intel_adsp/ace30/ptl/sim + - intel_adsp/ace30/ptl + - intel_adsp/cavs25/tgph + - intel_adsp/cavs25 tags: zbus integration_platforms: - native_sim From e0860eb9a6c9c099cf67152f8775d73bb3aebc3d Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Mon, 7 Oct 2024 09:22:17 +0200 Subject: [PATCH 0535/4482] boards: nordic: nrf54h20dk: make RAM3x DMA region larger for cpurad Some tests are failing on nrf54h20 cpurad in non-obvious manner because of this memory region being too small. Instead of adding overlays to each individual application, make this region larger at expense of cpuapp equivalent. Signed-off-by: Nikodem Kastelik --- .../nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi index bf96741de2251..f001678cb1fbc 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi @@ -183,16 +183,16 @@ cpuapp_dma_region: memory@e80 { compatible = "zephyr,memory-region"; - reg = <0xe80 DT_SIZE_K(4)>; + reg = <0xe80 DT_SIZE_K(3)>; status = "disabled"; #memory-region-cells = <0>; zephyr,memory-region = "DMA_RAM3x_APP"; zephyr,memory-attr = <( DT_MEM_DMA )>; }; - cpurad_dma_region: memory@1e80 { + cpurad_dma_region: memory@1a80 { compatible = "zephyr,memory-region"; - reg = <0x1e80 0x80>; + reg = <0x1a80 0x480>; status = "disabled"; #memory-region-cells = <0>; zephyr,memory-region = "DMA_RAM3x_RAD"; From 491520f8a6069685fd26c4d74bf6ddaf4017fde7 Mon Sep 17 00:00:00 2001 From: Andrej Butok Date: Mon, 7 Oct 2024 14:10:26 +0200 Subject: [PATCH 0536/4482] tests: mcumgr: Use EXTRA_ZEPHYR_MODULES Use EXTRA_ZEPHYR_MODULES that replaced ZEPHYR_EXTRA_MODULES since the Zephyr v3.4 release. Signed-off-by: Andrej Butok --- tests/subsys/mgmt/mcumgr/handler_demo/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/subsys/mgmt/mcumgr/handler_demo/CMakeLists.txt b/tests/subsys/mgmt/mcumgr/handler_demo/CMakeLists.txt index 515889d54b478..5535a42908dd7 100644 --- a/tests/subsys/mgmt/mcumgr/handler_demo/CMakeLists.txt +++ b/tests/subsys/mgmt/mcumgr/handler_demo/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.20.0) # This adds the example module to the list of extra zephyr modules -list(APPEND ZEPHYR_EXTRA_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/example_as_module") +list(APPEND EXTRA_ZEPHYR_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/example_as_module") find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(handler_demo) From f4335d22ca619a6d298cddaf0ba9d58397ecd9b0 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 7 Oct 2024 14:33:34 +0200 Subject: [PATCH 0537/4482] net: if: Don't require native IP stack support for IPv6 lookups IPv6 based interface lookups doesn't require native IP stack support, hence reflect that in the API. Signed-off-by: Robert Lubos --- include/zephyr/net/net_if.h | 6 +++--- subsys/net/ip/net_if.c | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/zephyr/net/net_if.h b/include/zephyr/net/net_if.h index 0e0e619a83158..7795f56597662 100644 --- a/include/zephyr/net/net_if.h +++ b/include/zephyr/net/net_if.h @@ -2038,7 +2038,7 @@ static inline uint32_t net_if_ipv6_get_retrans_timer(struct net_if *iface) * @return Pointer to IPv6 address to use, NULL if no IPv6 address * could be found. */ -#if defined(CONFIG_NET_NATIVE_IPV6) +#if defined(CONFIG_NET_IPV6) const struct in6_addr *net_if_ipv6_select_src_addr(struct net_if *iface, const struct in6_addr *dst); #else @@ -2065,7 +2065,7 @@ static inline const struct in6_addr *net_if_ipv6_select_src_addr( * @return Pointer to IPv6 address to use, NULL if no IPv6 address * could be found. */ -#if defined(CONFIG_NET_NATIVE_IPV6) +#if defined(CONFIG_NET_IPV6) const struct in6_addr *net_if_ipv6_select_src_addr_hint(struct net_if *iface, const struct in6_addr *dst, int flags); @@ -2090,7 +2090,7 @@ static inline const struct in6_addr *net_if_ipv6_select_src_addr_hint( * @return Pointer to network interface to use, NULL if no suitable interface * could be found. */ -#if defined(CONFIG_NET_NATIVE_IPV6) +#if defined(CONFIG_NET_IPV6) struct net_if *net_if_ipv6_select_src_iface(const struct in6_addr *dst); #else static inline struct net_if *net_if_ipv6_select_src_iface( diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c index 3bb1020bd7b1a..f9f7f68b41428 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -2983,6 +2983,8 @@ void net_if_ipv6_set_hop_limit(struct net_if *iface, uint8_t hop_limit) net_if_unlock(iface); } +#endif /* CONFIG_NET_NATIVE_IPV6 */ + static uint8_t get_diff_ipv6(const struct in6_addr *src, const struct in6_addr *dst) { @@ -3208,6 +3210,8 @@ struct net_if *net_if_ipv6_select_src_iface(const struct in6_addr *dst) return iface; } +#if defined(CONFIG_NET_NATIVE_IPV6) + uint32_t net_if_ipv6_calc_reachable_time(struct net_if_ipv6 *ipv6) { uint32_t min_reachable, max_reachable; From df683fd7f816f88508068f85ff5ded3a012d1e58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 7 Oct 2024 15:38:32 +0200 Subject: [PATCH 0538/4482] logging: log_output: Move flushing and writing to the header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move log_output_flush and log_output_write (renamed internal buffer_write() function) to the header as inline functions. Those function are used by log_output_dict.c and there are cases when log_output.c is not compiled in. Signed-off-by: Krzysztof Chruściński --- include/zephyr/logging/log_output.h | 25 +++++++++++++++++++++++- subsys/logging/log_output.c | 30 +++-------------------------- subsys/logging/log_output_dict.c | 24 ++++++----------------- 3 files changed, 33 insertions(+), 46 deletions(-) diff --git a/include/zephyr/logging/log_output.h b/include/zephyr/logging/log_output.h index 0ef3fe9a2f288..46b59520a6861 100644 --- a/include/zephyr/logging/log_output.h +++ b/include/zephyr/logging/log_output.h @@ -190,11 +190,34 @@ void log_output_msg_syst_process(const struct log_output *log_output, */ void log_output_dropped_process(const struct log_output *output, uint32_t cnt); +/** @brief Write to the output buffer. + * + * @param outf Output function. + * @param buf Buffer. + * @param len Buffer length. + * @param ctx Context passed to the %p outf. + */ +static inline void log_output_write(log_output_func_t outf, uint8_t *buf, size_t len, void *ctx) +{ + int processed; + + while (len != 0) { + processed = outf(buf, len, ctx); + len -= processed; + buf += processed; + } +} + /** @brief Flush output buffer. * * @param output Pointer to the log output instance. */ -void log_output_flush(const struct log_output *output); +static inline void log_output_flush(const struct log_output *output) +{ + log_output_write(output->func, output->buf, output->control_block->offset, + output->control_block->ctx); + output->control_block->offset = 0; +} /** @brief Function for setting user context passed to the output function. * diff --git a/subsys/logging/log_output.c b/subsys/logging/log_output.c index 116db647002ac..7b5e02fd75a81 100644 --- a/subsys/logging/log_output.c +++ b/subsys/logging/log_output.c @@ -150,28 +150,6 @@ static int print_formatted(const struct log_output *output, return length; } -static void buffer_write(log_output_func_t outf, uint8_t *buf, size_t len, - void *ctx) -{ - int processed; - - while (len != 0) { - processed = outf(buf, len, ctx); - len -= processed; - buf += processed; - } -} - - -void log_output_flush(const struct log_output *output) -{ - buffer_write(output->func, output->buf, - output->control_block->offset, - output->control_block->ctx); - - output->control_block->offset = 0; -} - static inline bool is_leap_year(uint32_t year) { return (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)); @@ -785,11 +763,9 @@ void log_output_dropped_process(const struct log_output *output, uint32_t cnt) cnt = MIN(cnt, 9999); len = snprintk(buf, sizeof(buf), "%d", cnt); - buffer_write(outf, (uint8_t *)prefix, sizeof(prefix) - 1, - output->control_block->ctx); - buffer_write(outf, buf, len, output->control_block->ctx); - buffer_write(outf, (uint8_t *)postfix, sizeof(postfix) - 1, - output->control_block->ctx); + log_output_write(outf, (uint8_t *)prefix, sizeof(prefix) - 1, output->control_block->ctx); + log_output_write(outf, buf, len, output->control_block->ctx); + log_output_write(outf, (uint8_t *)postfix, sizeof(postfix) - 1, output->control_block->ctx); } void log_output_timestamp_freq_set(uint32_t frequency) diff --git a/subsys/logging/log_output_dict.c b/subsys/logging/log_output_dict.c index 152b564133c3d..b639f2ae71bd6 100644 --- a/subsys/logging/log_output_dict.c +++ b/subsys/logging/log_output_dict.c @@ -12,18 +12,6 @@ #include #include -static void buffer_write(log_output_func_t outf, uint8_t *buf, size_t len, - void *ctx) -{ - int processed; - - do { - processed = outf(buf, len, ctx); - len -= processed; - buf += processed; - } while (len != 0); -} - void log_dict_output_msg_process(const struct log_output *output, struct log_msg *msg, uint32_t flags) { @@ -40,19 +28,19 @@ void log_dict_output_msg_process(const struct log_output *output, output_hdr.source = (source != NULL) ? log_source_id(source) : 0U; - buffer_write(output->func, (uint8_t *)&output_hdr, sizeof(output_hdr), - (void *)output->control_block->ctx); + log_output_write(output->func, (uint8_t *)&output_hdr, sizeof(output_hdr), + (void *)output->control_block->ctx); size_t len; uint8_t *data = log_msg_get_package(msg, &len); if (len > 0U) { - buffer_write(output->func, data, len, (void *)output->control_block->ctx); + log_output_write(output->func, data, len, (void *)output->control_block->ctx); } data = log_msg_get_data(msg, &len); if (len > 0U) { - buffer_write(output->func, data, len, (void *)output->control_block->ctx); + log_output_write(output->func, data, len, (void *)output->control_block->ctx); } log_output_flush(output); @@ -65,6 +53,6 @@ void log_dict_output_dropped_process(const struct log_output *output, uint32_t c msg.type = MSG_DROPPED_MSG; msg.num_dropped_messages = MIN(cnt, 9999); - buffer_write(output->func, (uint8_t *)&msg, sizeof(msg), - (void *)output->control_block->ctx); + log_output_write(output->func, (uint8_t *)&msg, sizeof(msg), + (void *)output->control_block->ctx); } From 8652e8e413bb3df0215b51e27f696da3847c80cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 7 Oct 2024 15:41:12 +0200 Subject: [PATCH 0539/4482] logging: Fix LOG_OUTPUT dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When CONFIG_LOG_OUTPUT is set, it indicates that logging strings are formatted by the application (using log_output module). It is not needed when backend works in the dictionary mode. So far LOG_OUTPUT was set also when dictionary mode was used and that prevented removing of the logging strings from binary which is an important feature of the dictionary logging. Signed-off-by: Krzysztof Chruściński --- subsys/logging/Kconfig.template.log_format_config | 1 + subsys/logging/backends/Kconfig.adsp | 1 - subsys/logging/backends/Kconfig.adsp_mtrace | 1 - subsys/logging/backends/Kconfig.ble | 1 - subsys/logging/backends/Kconfig.efi_console | 1 - subsys/logging/backends/Kconfig.fs | 1 - subsys/logging/backends/Kconfig.native_posix | 1 - subsys/logging/backends/Kconfig.net | 1 - subsys/logging/backends/Kconfig.rtt | 1 - subsys/logging/backends/Kconfig.semihost | 1 - subsys/logging/backends/Kconfig.spinel | 1 - subsys/logging/backends/Kconfig.swo | 1 - subsys/logging/backends/Kconfig.uart | 1 - subsys/logging/backends/Kconfig.xtensa_sim | 1 - 14 files changed, 1 insertion(+), 13 deletions(-) diff --git a/subsys/logging/Kconfig.template.log_format_config b/subsys/logging/Kconfig.template.log_format_config index 14e112e4879ef..3a5a97c948f62 100644 --- a/subsys/logging/Kconfig.template.log_format_config +++ b/subsys/logging/Kconfig.template.log_format_config @@ -7,6 +7,7 @@ choice "LOG_BACKEND_$(backend)_OUTPUT" config LOG_BACKEND_$(backend)_OUTPUT_TEXT bool "Text" + select LOG_OUTPUT help Output in text. diff --git a/subsys/logging/backends/Kconfig.adsp b/subsys/logging/backends/Kconfig.adsp index 67b37856ec5bd..97856827c8a3b 100644 --- a/subsys/logging/backends/Kconfig.adsp +++ b/subsys/logging/backends/Kconfig.adsp @@ -4,7 +4,6 @@ config LOG_BACKEND_ADSP bool "Intel ADSP buffer backend" depends on SOC_FAMILY_INTEL_ADSP - select LOG_OUTPUT select LOG_BACKEND_SUPPORTS_FORMAT_TIMESTAMP help Enable backend for the host trace protocol of the Intel ADSP diff --git a/subsys/logging/backends/Kconfig.adsp_mtrace b/subsys/logging/backends/Kconfig.adsp_mtrace index 18d570c9a8da3..98a63b6210051 100644 --- a/subsys/logging/backends/Kconfig.adsp_mtrace +++ b/subsys/logging/backends/Kconfig.adsp_mtrace @@ -4,7 +4,6 @@ config LOG_BACKEND_ADSP_MTRACE bool "Intel ADSP mtrace backend" depends on SOC_FAMILY_INTEL_ADSP - select LOG_OUTPUT select LOG_BACKEND_SUPPORTS_FORMAT_TIMESTAMP help Provide a logging backend which writes to SRAM window diff --git a/subsys/logging/backends/Kconfig.ble b/subsys/logging/backends/Kconfig.ble index 016573c0f7baa..378577891f7b7 100644 --- a/subsys/logging/backends/Kconfig.ble +++ b/subsys/logging/backends/Kconfig.ble @@ -5,7 +5,6 @@ config LOG_BACKEND_BLE bool "Bluetooth Low Energy (BLE) backend" depends on BT depends on LOG_PROCESS_THREAD_STACK_SIZE>=2048 - select LOG_OUTPUT select EXPERIMENTAL help Backend that sends log messages over Bluetooth LE Notifications. This diff --git a/subsys/logging/backends/Kconfig.efi_console b/subsys/logging/backends/Kconfig.efi_console index 13d873dfc8ec5..ddace16ae8c80 100644 --- a/subsys/logging/backends/Kconfig.efi_console +++ b/subsys/logging/backends/Kconfig.efi_console @@ -4,7 +4,6 @@ config LOG_BACKEND_EFI_CONSOLE bool "EFI_CONSOLE backend" depends on X86_EFI_CONSOLE - select LOG_OUTPUT default y if !UART_CONSOLE help When enabled backend is using EFI CONSOLE to output logs. diff --git a/subsys/logging/backends/Kconfig.fs b/subsys/logging/backends/Kconfig.fs index d424f781ab153..185014283cc1e 100644 --- a/subsys/logging/backends/Kconfig.fs +++ b/subsys/logging/backends/Kconfig.fs @@ -4,7 +4,6 @@ config LOG_BACKEND_FS bool "File system backend" depends on FILE_SYSTEM - select LOG_OUTPUT select LOG_BACKEND_SUPPORTS_FORMAT_TIMESTAMP help When enabled, backend is using the configured file system to output logs. diff --git a/subsys/logging/backends/Kconfig.native_posix b/subsys/logging/backends/Kconfig.native_posix index 8d566124f8183..776e9ce54ad27 100644 --- a/subsys/logging/backends/Kconfig.native_posix +++ b/subsys/logging/backends/Kconfig.native_posix @@ -5,7 +5,6 @@ config LOG_BACKEND_NATIVE_POSIX bool "Native backend" depends on ARCH_POSIX default y - select LOG_OUTPUT select LOG_BACKEND_SUPPORTS_FORMAT_TIMESTAMP help Enable backend in native_posix diff --git a/subsys/logging/backends/Kconfig.net b/subsys/logging/backends/Kconfig.net index 5c91b68b16698..5d7c8a4d91902 100644 --- a/subsys/logging/backends/Kconfig.net +++ b/subsys/logging/backends/Kconfig.net @@ -6,7 +6,6 @@ config LOG_BACKEND_NET bool "Networking backend" depends on NETWORKING && (NET_UDP || NET_TCP) && !LOG_MODE_IMMEDIATE - select LOG_OUTPUT help Send syslog messages to network server. See RFC 5424 (syslog protocol) and RFC 5426 (syslog over UDP) and diff --git a/subsys/logging/backends/Kconfig.rtt b/subsys/logging/backends/Kconfig.rtt index 87e8f46a0de6f..e275f9b18f200 100644 --- a/subsys/logging/backends/Kconfig.rtt +++ b/subsys/logging/backends/Kconfig.rtt @@ -6,7 +6,6 @@ config LOG_BACKEND_RTT depends on USE_SEGGER_RTT default y if !SHELL_BACKEND_RTT select SEGGER_RTT_CUSTOM_LOCKING - select LOG_OUTPUT select LOG_BACKEND_SUPPORTS_FORMAT_TIMESTAMP help When enabled, backend will use RTT for logging. This backend works on a per diff --git a/subsys/logging/backends/Kconfig.semihost b/subsys/logging/backends/Kconfig.semihost index 10a6da8f2e77f..7861fce8a63ab 100644 --- a/subsys/logging/backends/Kconfig.semihost +++ b/subsys/logging/backends/Kconfig.semihost @@ -4,7 +4,6 @@ config LOG_BACKEND_SEMIHOST bool "Semihost as backend" depends on SEMIHOST - select LOG_OUTPUT select LOG_BACKEND_SUPPORTS_FORMAT_TIMESTAMP help Enable backend in semihost (using host stdout) diff --git a/subsys/logging/backends/Kconfig.spinel b/subsys/logging/backends/Kconfig.spinel index 6174abb612290..d2d29370aa35d 100644 --- a/subsys/logging/backends/Kconfig.spinel +++ b/subsys/logging/backends/Kconfig.spinel @@ -5,7 +5,6 @@ config LOG_BACKEND_SPINEL bool "OpenThread dedicated Spinel protocol backend" depends on !LOG_BACKEND_UART depends on NET_L2_OPENTHREAD - select LOG_OUTPUT help When enabled, backend will use OpenThread dedicated SPINEL protocol for logging. This protocol is byte oriented and wraps given messages into serial frames. diff --git a/subsys/logging/backends/Kconfig.swo b/subsys/logging/backends/Kconfig.swo index dc38041fead94..5fabe50b62eee 100644 --- a/subsys/logging/backends/Kconfig.swo +++ b/subsys/logging/backends/Kconfig.swo @@ -4,7 +4,6 @@ config LOG_BACKEND_SWO bool "Serial Wire Output (SWO) backend" depends on HAS_SWO - select LOG_OUTPUT select LOG_BACKEND_SUPPORTS_FORMAT_TIMESTAMP help When enabled, backend will use SWO for logging. diff --git a/subsys/logging/backends/Kconfig.uart b/subsys/logging/backends/Kconfig.uart index 954168d93ede2..e7325c633e85f 100644 --- a/subsys/logging/backends/Kconfig.uart +++ b/subsys/logging/backends/Kconfig.uart @@ -5,7 +5,6 @@ config LOG_BACKEND_UART bool "UART backend" depends on UART_CONSOLE default y if !SHELL_BACKEND_SERIAL && !SHELL_BACKEND_RTT - select LOG_OUTPUT select LOG_BACKEND_SUPPORTS_FORMAT_TIMESTAMP help When enabled backend is using UART to output logs. diff --git a/subsys/logging/backends/Kconfig.xtensa_sim b/subsys/logging/backends/Kconfig.xtensa_sim index cdf1526f00b3a..6b81914cf2dee 100644 --- a/subsys/logging/backends/Kconfig.xtensa_sim +++ b/subsys/logging/backends/Kconfig.xtensa_sim @@ -5,7 +5,6 @@ config LOG_BACKEND_XTENSA_SIM bool "Xtensa simulator backend" depends on SOC_XTENSA_SAMPLE_CONTROLLER || SOC_XTENSA_DC233C || SOC_FAMILY_INTEL_ADSP default y if SOC_XTENSA_SAMPLE_CONTROLLER || SOC_XTENSA_DC233C - select LOG_OUTPUT select LOG_BACKEND_SUPPORTS_FORMAT_TIMESTAMP help Enable backend in xtensa simulator From 66ff30efb4d786ac15a4ef03a81bbe7a3f315690 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 7 Oct 2024 16:45:40 +0200 Subject: [PATCH 0540/4482] net: sockets: Move msghdr_non_empty_iov_count() to common file msghdr_non_empty_iov_count() is used by TLS sockets too therefore should be available regardless of native IP sockets being enabled or not. Signed-off-by: Robert Lubos --- subsys/net/lib/sockets/sockets.c | 13 +++++++++++++ subsys/net/lib/sockets/sockets_inet.c | 13 ------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/subsys/net/lib/sockets/sockets.c b/subsys/net/lib/sockets/sockets.c index 8b420cc9e68de..be7ba5ad9678b 100644 --- a/subsys/net/lib/sockets/sockets.c +++ b/subsys/net/lib/sockets/sockets.c @@ -74,6 +74,19 @@ static inline void *get_sock_vtable(int sock, return ctx; } +size_t msghdr_non_empty_iov_count(const struct msghdr *msg) +{ + size_t non_empty_iov_count = 0; + + for (size_t i = 0; i < msg->msg_iovlen; i++) { + if (msg->msg_iov[i].iov_len) { + non_empty_iov_count++; + } + } + + return non_empty_iov_count; +} + void *z_impl_zsock_get_context_object(int sock) { const struct socket_op_vtable *ignored; diff --git a/subsys/net/lib/sockets/sockets_inet.c b/subsys/net/lib/sockets/sockets_inet.c index 10de541fc8f75..88e4e47bfe4a6 100644 --- a/subsys/net/lib/sockets/sockets_inet.c +++ b/subsys/net/lib/sockets/sockets_inet.c @@ -640,19 +640,6 @@ ssize_t zsock_sendto_ctx(struct net_context *ctx, const void *buf, size_t len, return status; } -size_t msghdr_non_empty_iov_count(const struct msghdr *msg) -{ - size_t non_empty_iov_count = 0; - - for (size_t i = 0; i < msg->msg_iovlen; i++) { - if (msg->msg_iov[i].iov_len) { - non_empty_iov_count++; - } - } - - return non_empty_iov_count; -} - ssize_t zsock_sendmsg_ctx(struct net_context *ctx, const struct msghdr *msg, int flags) { From 61a87384f2fa02f5ad4978f7e56171521c919e23 Mon Sep 17 00:00:00 2001 From: Michal Smola Date: Wed, 9 Oct 2024 15:17:13 +0200 Subject: [PATCH 0541/4482] dts: nxp mcxc: Configure boot source to flash NXP mcxc series has boot source configured to ROM. ROM bootloader waits 5 sec for active peripheral detection timeout before jumping to application in flash which makes booting very slow. Change configuration to boot from flash and allow boot source selection by external pin. Signed-off-by: Michal Smola --- dts/arm/nxp/nxp_mcxc_common.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dts/arm/nxp/nxp_mcxc_common.dtsi b/dts/arm/nxp/nxp_mcxc_common.dtsi index c69205708b4c5..1af2600ba44c5 100644 --- a/dts/arm/nxp/nxp_mcxc_common.dtsi +++ b/dts/arm/nxp/nxp_mcxc_common.dtsi @@ -57,7 +57,7 @@ #address-cells = <1>; #size-cells = <1>; fsec = <0xff>; - fopt = <0xff>; + fopt = <0x3d>; config-field-offset = <0x400>; flash0: flash@0 { From acbda31707a7afe54a0d878adcf710b7ba87ee7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Wed, 9 Oct 2024 10:00:48 +0200 Subject: [PATCH 0542/4482] west: boards: add full_name support in format string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The recently introduced board.full_name property can now be used as part of the format string in the `west boards -f ...` command. Signed-off-by: Benjamin Cabé --- scripts/west_commands/boards.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/west_commands/boards.py b/scripts/west_commands/boards.py index 3bb213ae029d7..9777d377f53e9 100644 --- a/scripts/west_commands/boards.py +++ b/scripts/west_commands/boards.py @@ -49,6 +49,7 @@ def do_add_parser(self, parser_adder): The following arguments are available: - name: board name + - full_name: board full name (typically, its commercial name) - qualifiers: board qualifiers (will be empty for legacy boards) - arch: board architecture (deprecated) (arch is ambiguous for boards described in new hw model) @@ -102,6 +103,7 @@ def do_run(self, args, _): log.inf( args.format.format( name=board.name, + full_name=board.full_name, dir=board.dir, hwm=board.hwm, vendor=board.vendor, From de14efef98dcfb0f08b44d768808747fe456308d Mon Sep 17 00:00:00 2001 From: Nithin Ramesh Myliattil Date: Tue, 8 Oct 2024 06:13:48 +0200 Subject: [PATCH 0543/4482] Bluetooth: BASS: add scan cb to scan delegator module. Add scan cb to scan delegator so that Application can be notified when assistant starts or stops scanning. Also state information of Broadcast Assistant is removed as info is not used. Signed-off-by: Nithin Ramesh Myliattil --- include/zephyr/bluetooth/audio/bap.h | 10 +++ subsys/bluetooth/audio/bap_scan_delegator.c | 69 +++---------------- .../audio/src/bap_broadcast_sink_test.c | 7 ++ 3 files changed, 27 insertions(+), 59 deletions(-) diff --git a/include/zephyr/bluetooth/audio/bap.h b/include/zephyr/bluetooth/audio/bap.h index 4860e4da5ef93..d9cea4cd57eed 100644 --- a/include/zephyr/bluetooth/audio/bap.h +++ b/include/zephyr/bluetooth/audio/bap.h @@ -658,6 +658,16 @@ struct bt_bap_scan_delegator_cb { int (*bis_sync_req)(struct bt_conn *conn, const struct bt_bap_scan_delegator_recv_state *recv_state, const uint32_t bis_sync_req[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]); + /** + * @brief Broadcast Assistant scanning state callback + * + * Callback triggered when a Broadcast Assistant notifies the Scan Delegator about the + * assistants scanning state. + * + * @param conn Pointer to the connection that initiated the scan. + * @param is_scanning true if scanning started, false if scanning stopped. + */ + void (*scanning_state)(struct bt_conn *conn, bool is_scanning); }; /** Structure holding information of audio stream endpoint */ diff --git a/subsys/bluetooth/audio/bap_scan_delegator.c b/subsys/bluetooth/audio/bap_scan_delegator.c index e078f4df52cdc..39ecf17062edc 100644 --- a/subsys/bluetooth/audio/bap_scan_delegator.c +++ b/subsys/bluetooth/audio/bap_scan_delegator.c @@ -60,11 +60,6 @@ enum bass_recv_state_internal_flag { BASS_RECV_STATE_INTERNAL_FLAG_NUM, }; -struct broadcast_assistant { - struct bt_conn *conn; - uint8_t scanning; -}; - /* TODO: Merge bass_recv_state_internal_t and bt_bap_scan_delegator_recv_state */ struct bass_recv_state_internal { const struct bt_gatt_attr *attr; @@ -82,7 +77,6 @@ struct bass_recv_state_internal { struct bt_bap_scan_delegator_inst { uint8_t next_src_id; - struct broadcast_assistant assistant_configs[CONFIG_BT_MAX_CONN]; struct bass_recv_state_internal recv_states [CONFIG_BT_BAP_SCAN_DELEGATOR_RECV_STATE_COUNT]; }; @@ -264,25 +258,6 @@ static void bis_sync_request_updated(struct bt_conn *conn, } } -static void scan_delegator_disconnected(struct bt_conn *conn, uint8_t reason) -{ - int i; - struct broadcast_assistant *assistant = NULL; - - for (i = 0; i < ARRAY_SIZE(scan_delegator.assistant_configs); i++) { - if (scan_delegator.assistant_configs[i].conn == conn) { - assistant = &scan_delegator.assistant_configs[i]; - break; - } - } - - if (assistant != NULL) { - LOG_DBG("Instance %u with addr %s disconnected", - i, bt_addr_le_str(bt_conn_get_dst(conn))); - (void)memset(assistant, 0, sizeof(*assistant)); - } -} - static void scan_delegator_security_changed(struct bt_conn *conn, bt_security_t level, enum bt_security_err err) @@ -315,33 +290,10 @@ static void scan_delegator_security_changed(struct bt_conn *conn, } } -static struct bt_conn_cb conn_cb = { - .disconnected = scan_delegator_disconnected, +BT_CONN_CB_DEFINE(conn_callbacks) = { .security_changed = scan_delegator_security_changed, }; -static struct broadcast_assistant *get_bap_broadcast_assistant(struct bt_conn *conn) -{ - struct broadcast_assistant *new = NULL; - - for (size_t i = 0; i < ARRAY_SIZE(scan_delegator.assistant_configs); i++) { - if (scan_delegator.assistant_configs[i].conn == conn) { - return &scan_delegator.assistant_configs[i]; - } else if (new == NULL && - scan_delegator.assistant_configs[i].conn == NULL) { - new = &scan_delegator.assistant_configs[i]; - new->conn = conn; - } - } - - if (!atomic_test_and_set_bit(scan_delegator_flags, - SCAN_DELEGATOR_FLAG_REGISTERED_CONN_CB)) { - bt_conn_cb_register(&conn_cb); - } - - return new; -} - static uint8_t next_src_id(void) { uint8_t next_src_id; @@ -1023,7 +975,6 @@ static ssize_t write_control_point(struct bt_conn *conn, const void *data, uint16_t len, uint16_t offset, uint8_t flags) { - struct broadcast_assistant *bap_broadcast_assistant; struct net_buf_simple buf; uint8_t opcode; int err; @@ -1042,12 +993,6 @@ static ssize_t write_control_point(struct bt_conn *conn, return BT_GATT_ERR(BT_BAP_BASS_ERR_OPCODE_NOT_SUPPORTED); } - bap_broadcast_assistant = get_bap_broadcast_assistant(conn); - - if (bap_broadcast_assistant == NULL) { - return BT_GATT_ERR(BT_ATT_ERR_UNLIKELY); - } - LOG_HEXDUMP_DBG(data, len, "Data"); switch (opcode) { @@ -1059,16 +1004,22 @@ static ssize_t write_control_point(struct bt_conn *conn, return BT_GATT_ERR(BT_ATT_ERR_WRITE_REQ_REJECTED); } - bap_broadcast_assistant->scanning = false; + if (scan_delegator_cbs != NULL && scan_delegator_cbs->scanning_state != NULL) { + scan_delegator_cbs->scanning_state(conn, false); + } + break; case BT_BAP_BASS_OP_SCAN_START: LOG_DBG("Assistant starting scanning"); if (buf.len != 0) { - LOG_DBG("Invalid length %u", buf.size); return BT_GATT_ERR(BT_ATT_ERR_WRITE_REQ_REJECTED); } - bap_broadcast_assistant->scanning = true; + + if (scan_delegator_cbs != NULL && scan_delegator_cbs->scanning_state != NULL) { + scan_delegator_cbs->scanning_state(conn, true); + } + break; case BT_BAP_BASS_OP_ADD_SRC: LOG_DBG("Assistant adding source"); diff --git a/tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c b/tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c index 6a2c060ebc53d..bfa59aa4f1163 100644 --- a/tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c @@ -410,7 +410,14 @@ static void broadcast_code_cb(struct bt_conn *conn, memcpy(recv_state_broadcast_code, broadcast_code, BT_AUDIO_BROADCAST_CODE_SIZE); } +static void scanning_state_cb(struct bt_conn *conn, bool is_scanning) +{ + printk("Assistant scanning %s\n", is_scanning ? "started" : "stopped"); + +} + static struct bt_bap_scan_delegator_cb scan_delegator_cbs = { + .scanning_state = scanning_state_cb, .pa_sync_req = pa_sync_req_cb, .pa_sync_term_req = pa_sync_term_req_cb, .bis_sync_req = bis_sync_req_cb, From e48639e460227da0dda74f07069558cf23ef5e92 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Mon, 7 Oct 2024 21:35:44 -0300 Subject: [PATCH 0544/4482] soc: esp32c6: add LLEXT linker entry Make sure LLEXT sections are properly placed to avoid orphan declaration. Signed-off-by: Sylvio Alves --- soc/espressif/esp32c6/default.ld | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/soc/espressif/esp32c6/default.ld b/soc/espressif/esp32c6/default.ld index 45c762e8e7319..581930dea5b8b 100644 --- a/soc/espressif/esp32c6/default.ld +++ b/soc/espressif/esp32c6/default.ld @@ -136,6 +136,10 @@ SECTIONS #include +#ifdef CONFIG_LLEXT + #include +#endif + /* --- START OF RTC --- */ .rtc.text : From 175407c9cc2af6b3417f55df68e7601920b00cce Mon Sep 17 00:00:00 2001 From: Naveen Gangadharan Date: Mon, 7 Oct 2024 16:56:33 -0700 Subject: [PATCH 0545/4482] drivers: i3c: cadence: fix HDR-DDR write failures due to M1 errors Fix M1 errors seen with HDR-DDR writes, M1 errors we seen between CRC and HDR exit sequence. The fix was to set Bit-8 of HDR-DDR CRC TXFIFO word. Signed-off-by: Naveen Gangadharan --- drivers/i3c/i3c_cdns.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/i3c/i3c_cdns.c b/drivers/i3c/i3c_cdns.c index cc3fcd4a05b14..f292827da923c 100644 --- a/drivers/i3c/i3c_cdns.c +++ b/drivers/i3c/i3c_cdns.c @@ -300,6 +300,7 @@ #define DDR_CRC_TOKEN (0xC << 14) #define DDR_CRC_TOKEN_MASK GENMASK(17, 14) #define DDR_CRC(t) (((t) & (GENMASK(13, 9))) >> 9) +#define DDR_CRC_WR_SETUP BIT(8) #define CMD_IBI_THR_CTRL 0x90 #define IBIR_THR(t) ((t) << 24) @@ -2245,7 +2246,8 @@ static int cdns_i3c_transfer(const struct device *dev, struct i3c_device_desc *t crc5, sys_get_be16((void *)((uintptr_t)cmd->buf + j))); } - cmd->ddr_crc = DDR_PREAMBLE_CMD_CRC | DDR_CRC_TOKEN | (crc5 << 9); + cmd->ddr_crc = DDR_PREAMBLE_CMD_CRC | DDR_CRC_TOKEN | (crc5 << 9) | + DDR_CRC_WR_SETUP; } /* Length of DDR Transfer is length of payload (in 16b) + header and CRC * blocks From 2165a2c6bc3f97536b7102649944d2dec9316af3 Mon Sep 17 00:00:00 2001 From: Yves Vandervennet Date: Tue, 1 Oct 2024 17:02:52 -0500 Subject: [PATCH 0546/4482] boards: mimxrt1024_evk: enable support for linkserver - update the EVK's board.cmake, making linkserver the default runner - update the board's document file Signed-off-by: Yves Vandervennet --- boards/nxp/mimxrt1024_evk/board.cmake | 5 ++++- boards/nxp/mimxrt1024_evk/doc/index.rst | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/boards/nxp/mimxrt1024_evk/board.cmake b/boards/nxp/mimxrt1024_evk/board.cmake index 78b821312749d..b0b8952cacd18 100644 --- a/boards/nxp/mimxrt1024_evk/board.cmake +++ b/boards/nxp/mimxrt1024_evk/board.cmake @@ -1,11 +1,14 @@ # -# Copyright (c) 2020, NXP +# Copyright (c) 2020, 2024 NXP # # SPDX-License-Identifier: Apache-2.0 # board_runner_args(pyocd "--target=mimxrt1024") board_runner_args(jlink "--device=MIMXRT1024xxx5A") +# MIMXRT1024xxxxx MIMXRT1024-EVK cm7 +board_runner_args(linkserver "--device=MIMXRT1024xxxxx:MIMXRT1024-EVK") +include(${ZEPHYR_BASE}/boards/common/linkserver.board.cmake) include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) diff --git a/boards/nxp/mimxrt1024_evk/doc/index.rst b/boards/nxp/mimxrt1024_evk/doc/index.rst index e451a0274327a..10010775a10c1 100644 --- a/boards/nxp/mimxrt1024_evk/doc/index.rst +++ b/boards/nxp/mimxrt1024_evk/doc/index.rst @@ -206,11 +206,12 @@ remaining are not used. Programming and Debugging ************************* -This board supports 2 debug host tools. Please install your preferred host +This board supports 3 debug host tools. Please install your preferred host tool, then follow the instructions in `Configuring a Debug Probe`_ to configure the board appropriately. -* :ref:`jlink-debug-host-tools` (Default, Supported by NXP) +* :ref:`linkserver-debug-host-tools` (Default, Supported by NXP) +* :ref:`jlink-debug-host-tools` (Supported by NXP) * :ref:`pyocd-debug-host-tools` (Not supported by NXP) Configuring a Debug Probe From d13e0a1dbf74be89d835c391d1cb20d765a252d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 7 Oct 2024 13:48:40 +0200 Subject: [PATCH 0547/4482] doc: boards: infineon: fix various issues with cy8ckit_062s4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Title of the document was wrong, image info was missing, and a bunch of other formatting issues. Signed-off-by: Benjamin Cabé --- boards/infineon/cy8ckit_062s4/doc/index.rst | 31 +++++++++++---------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/boards/infineon/cy8ckit_062s4/doc/index.rst b/boards/infineon/cy8ckit_062s4/doc/index.rst index 1dfdb93bd307d..9d2b74b55cbcf 100644 --- a/boards/infineon/cy8ckit_062s4/doc/index.rst +++ b/boards/infineon/cy8ckit_062s4/doc/index.rst @@ -1,7 +1,7 @@ .. _cy8ckit_062s4: -[INFINEON PSoC 62S4 Pioneer Kit] -################################ +INFINEON PSOC 62S4 Pioneer Kit +############################## Overview ******** @@ -15,21 +15,20 @@ programmer/debugger (KitProg3), a 512-Mbit Quad SPI NOR flash, a micro-B connect interface, a thermistor, an ambient light sensor, a 5-segment CapSense™ slider, two CapSense™ buttons, two user LEDs, and a push button. The board supports operating voltages from 1.8 V to 3.3 V for PSoC™ 6 MCU. -.. figure::img/cy8ckit_062s4.png - :width: 800px +.. figure:: img/cy8ckit_062s4.png :align: center - :alt: Board Name + :alt: INFINEON PSOC 62S4 Pioneer Kit - Board Name (Credit: ) + INFINEON PSOC 62S4 Pioneer Kit (Credit: Infineon) Hardware ******** -`CY8CKIT 062S4 Pioneer Kit Website`_ -`CY8CKIT 062S4 Pioneer Kit Guide`_ -`CY8CKIT 062S4 Pioneer Kit Schematic`_ -`CY8CKIT 062S4 Pioneer Kit Technical Reference Manual`_ -`CY8CKIT 062S4 Pioneer Kit Datasheet`_ +* `CY8CKIT 062S4 Pioneer Kit Website`_ +* `CY8CKIT 062S4 Pioneer Kit Guide`_ +* `CY8CKIT 062S4 Pioneer Kit Schematic`_ +* `CY8CKIT 062S4 Pioneer Kit Technical Reference Manual`_ +* `CY8CKIT 062S4 Pioneer Kit Datasheet`_ Supported Features ================== @@ -90,11 +89,13 @@ OpenOCD Installation To get the OpenOCD package, it is required that you 1. Download the software ModusToolbox 3.1. https://softwaretools.infineon.com/tools/com.ifx.tb.tool.modustoolbox -2. Once downloaded add the path to access the Scripts folder provided by ModusToolbox - export PATH=$PATH:/path/to/ModusToolbox/tools_3.1/openocd/scripts +2. Once downloaded add the path to access the Scripts folder provided by ModusToolbox:: + + export PATH=$PATH:/path/to/ModusToolbox/tools_3.1/openocd/scripts + 3. Add the OpenOCD executable file's path to west flash/debug. -4. Flash using: west flash --openocd path/to/infineon/openocd/bin/openocd -5. Debug using: west debug --openocd path/to/infineon/openocd/bin/openocd +4. Flash using: ``west flash --openocd path/to/infineon/openocd/bin/openocd`` +5. Debug using: ``west debug --openocd path/to/infineon/openocd/bin/openocd`` References ********** From bcef9ac6eab222526644fa9257420e4ee7fb8f59 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 7 Oct 2024 01:22:04 +0530 Subject: [PATCH 0548/4482] modules: hostap: Use OS primitive even in native code This was we can modify it in a single place that works both for native and OS specific code. Signed-off-by: Chaitanya Tata --- modules/hostap/src/supp_api.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index 74c7add052345..8339f03fa497a 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -271,7 +271,7 @@ static int wpa_supp_supported_channels(struct wpa_supplicant *wpa_s, uint8_t ban } size = ((mode->num_channels) * CHAN_NUM_LEN) + 1; - _chan_list = k_malloc(size); + _chan_list = os_malloc(size); if (!_chan_list) { wpa_printf(MSG_ERROR, "Mem alloc failed for channel list"); return -ENOMEM; @@ -502,11 +502,11 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s, if (chan_list) { if (!wpa_cli_cmd_v("set_network %d scan_freq%s", resp.network_id, chan_list)) { - k_free(chan_list); + os_free(chan_list); goto out; } - k_free(chan_list); + os_free(chan_list); } } From 3ade4bed2749d2096bba293b8869c057adaf55a6 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 7 Oct 2024 01:37:49 +0530 Subject: [PATCH 0549/4482] modules: hostap: Fix heap pool allocation Now that hostap is used k_heap, it needs to reserve the kernel heap not libc heap. Fixes #79477. Signed-off-by: Chaitanya Tata --- modules/hostap/Kconfig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 4350b054e1329..e1417e14e0218 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -23,13 +23,13 @@ config WIFI_NM_WPA_SUPPLICANT if WIFI_NM_WPA_SUPPLICANT -config COMMON_LIBC_MALLOC_ARENA_SIZE - default 85000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE && !MBEDTLS_ENABLE_HEAP - default 40000 if WIFI_NM_WPA_SUPPLICANT_AP +config HEAP_MEM_POOL_ADD_SIZE_HOSTAP + def_int 85000 if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE && !MBEDTLS_ENABLE_HEAP + def_int 40000 if WIFI_NM_WPA_SUPPLICANT_AP # 8192 for MbedTLS heap - default 21808 if MBEDTLS_ENABLE_HEAP + def_int 21808 if MBEDTLS_ENABLE_HEAP # 30K is mandatory, but might need more for long duration use cases - default 30000 + def_int 30000 config WIFI_NM_WPA_SUPPLICANT_THREAD_STACK_SIZE int "Stack size for wpa_supplicant thread" From b2c6f6c53b1bf1df66434b8ae0a37502b093ba5b Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 7 Oct 2024 01:57:24 +0530 Subject: [PATCH 0550/4482] modules: hostap: Add missing default for max STAs in AP mode The default should honor the build time flag. Signed-off-by: Chaitanya Tata --- modules/hostap/src/supp_api.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index 8339f03fa497a..3c6140fb3e65b 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -1662,6 +1662,8 @@ int supplicant_ap_enable(const struct device *dev, /* No need to check for existing network to join for SoftAP*/ wpa_s->conf->ap_scan = 2; + /* Set BSS parameter max_num_sta to default configured value */ + wpa_s->conf->max_num_sta = CONFIG_WIFI_MGMT_AP_MAX_NUM_STA; ret = wpas_add_and_config_network(wpa_s, params, true); if (ret) { From 970428419cfdf7a1c836528a44fe006121080064 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 7 Oct 2024 01:58:10 +0530 Subject: [PATCH 0551/4482] modules: hostap: Use the build time flag Instead of hard-coded value, use the build time flag. Signed-off-by: Chaitanya Tata --- modules/hostap/src/supp_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index db3ef2fe83bf7..380c32dfc16fe 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -874,7 +874,7 @@ struct hostapd_config *hostapd_config_read2(const char *fname) bss = conf->last_bss; bss->start_disabled = 1; - bss->max_num_sta = 8; + bss->max_num_sta = CONFIG_WIFI_MGMT_AP_MAX_NUM_STA; bss->dtim_period = 1; os_strlcpy(conf->bss[0]->iface, ifname, sizeof(conf->bss[0]->iface)); bss->logger_stdout_level = HOSTAPD_LEVEL_INFO; From 5c9c95b593a2f0725c1115195d7568456e84a795 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 7 Oct 2024 02:20:11 +0530 Subject: [PATCH 0552/4482] manifest: hostap: Pull fixes from NCS Pull fixes that are in NCS but missed in upstream. Signed-off-by: Chaitanya Tata --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index f7c3e04da5e73..ad8589fce212b 100644 --- a/west.yml +++ b/west.yml @@ -259,7 +259,7 @@ manifest: - hal - name: hostap path: modules/lib/hostap - revision: d84b1ea174407f9a501976fb294e39c40c348645 + revision: cdc0782c6ec76d75456e637bff78004c2c6eae87 - name: libmetal revision: a6851ba6dba8c9e87d00c42f171a822f7a29639b path: modules/hal/libmetal From 275162fd52392b1561952b05c24226ea16cb938e Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Fri, 20 Sep 2024 19:54:02 +0900 Subject: [PATCH 0553/4482] drivers: pwm: rpi_pico: Configuring the divide ratio adaptively If the `divider-int-0` or variations of these for each channel properties are not specified, or if these is 0, the driver dynamically configures the division ratio by specified cycles. The driver will operate at the specified division ratio if a non-zero value is specified for `divider-int-0`. This is unchanged from previous behavior. Please specify ``divider-int-0`` explicitly to make the same behavior as before. In addition, the default device tree properties related to the division ratio have been removed. Signed-off-by: TOKITA Hiroshi --- .../raspberrypi/rpi_pico/rpi_pico-common.dtsi | 1 - doc/releases/migration-guide-4.0.rst | 13 ++++ doc/releases/release-notes-4.0.rst | 2 + drivers/pwm/pwm_rpi_pico.c | 59 ++++++++++++++----- dts/bindings/pwm/raspberrypi,pico-pwm.yaml | 27 +++------ 5 files changed, 67 insertions(+), 35 deletions(-) diff --git a/boards/raspberrypi/rpi_pico/rpi_pico-common.dtsi b/boards/raspberrypi/rpi_pico/rpi_pico-common.dtsi index 36058ef6483e5..2b40cf3540bc0 100644 --- a/boards/raspberrypi/rpi_pico/rpi_pico-common.dtsi +++ b/boards/raspberrypi/rpi_pico/rpi_pico-common.dtsi @@ -152,7 +152,6 @@ zephyr_udc0: &usbd { &pwm { pinctrl-0 = <&pwm_ch4b_default>; pinctrl-names = "default"; - divider-int-0 = <255>; }; &vreg { diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index a401dacbfc624..0c3c1cb98354d 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -213,6 +213,19 @@ Interrupt Controller LED Strip ========= +PWM +=== + +* The Raspberry Pi Pico PWM driver now configures frequency adaptively. + This has resulted in a change in how device tree parameters are handled. + If the :dtcompatible:`raspberry,pico-pwm`'s ``divider-int-0`` or variations + for each channel are specified, or if these are set to 0, + the driver dynamically configures the division ratio by specified cycles. + The driver will operate at the specified division ratio if a non-zero value is + specified for ``divider-int-0``. + This is unchanged from previous behavior. + Please specify ``divider-int-0`` explicitly to make the same behavior as before. + SDHC ==== diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 75b44df3fd172..38953b1b30ecf 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -234,6 +234,8 @@ Drivers and Sensors * PWM + * rpi_pico: The driver now configures the divide ratio adaptively. + * Regulators * Reset diff --git a/drivers/pwm/pwm_rpi_pico.c b/drivers/pwm/pwm_rpi_pico.c index 2050ca27a2e70..d277cddaf15f1 100644 --- a/drivers/pwm/pwm_rpi_pico.c +++ b/drivers/pwm/pwm_rpi_pico.c @@ -73,10 +73,15 @@ static int pwm_rpi_get_cycles_per_sec(const struct device *dev, uint32_t ch, uin return -EINVAL; } - /* No need to check for divide by 0 since the minimum value of - * pwm_rpi_get_clkdiv is 1 - */ - *cycles = (uint64_t)((float)pclk / pwm_rpi_get_clkdiv(dev, slice)); + if (cfg->slice_configs[slice].integral == 0) { + *cycles = pclk; + } else { + /* No need to check for divide by 0 since the minimum value of + * pwm_rpi_get_clkdiv is 1 + */ + *cycles = (uint64_t)((float)pclk / pwm_rpi_get_clkdiv(dev, slice)); + } + return 0; } @@ -104,24 +109,46 @@ static void pwm_rpi_set_channel_polarity(const struct device *dev, int slice, static int pwm_rpi_set_cycles(const struct device *dev, uint32_t ch, uint32_t period_cycles, uint32_t pulse_cycles, pwm_flags_t flags) { + const struct pwm_rpi_config *cfg = dev->config; + int slice = pwm_rpi_channel_to_slice(ch); + + /* this is the channel within a pwm slice */ + int pico_channel = pwm_rpi_channel_to_pico_channel(ch); + int div_int; + int div_frac; + if (ch >= PWM_RPI_NUM_CHANNELS) { return -EINVAL; } + div_int = cfg->slice_configs[slice].integral; + div_frac = cfg->slice_configs[slice].frac; + + if (div_int == 0) { + div_int = 1; + div_frac = 0; + while ((period_cycles / div_int - 1) > PWM_RPI_PICO_COUNTER_TOP_MAX) { + div_int *= 2; + } + + if (div_int > (UINT8_MAX + 1)) { + return -EINVAL; + } + + period_cycles /= div_int; + pulse_cycles /= div_int; + } + if (period_cycles - 1 > PWM_RPI_PICO_COUNTER_TOP_MAX || pulse_cycles > PWM_RPI_PICO_COUNTER_TOP_MAX) { return -EINVAL; } - int slice = pwm_rpi_channel_to_slice(ch); - - /* this is the channel within a pwm slice */ - int pico_channel = pwm_rpi_channel_to_pico_channel(ch); - pwm_rpi_set_channel_polarity(dev, slice, pico_channel, (flags & PWM_POLARITY_MASK) == PWM_POLARITY_INVERTED); pwm_set_wrap(slice, period_cycles - 1); pwm_set_chan_level(slice, pico_channel, pulse_cycles); + pwm_set_clkdiv_int_frac(slice, div_int, div_frac); return 0; }; @@ -160,9 +187,13 @@ static int pwm_rpi_init(const struct device *dev) pwm_init(slice_idx, &slice_cfg, false); - pwm_set_clkdiv_int_frac(slice_idx, - cfg->slice_configs[slice_idx].integral, - cfg->slice_configs[slice_idx].frac); + if (cfg->slice_configs[slice_idx].integral == 0) { + pwm_set_clkdiv_int_frac(slice_idx, 1, 0); + } else { + pwm_set_clkdiv_int_frac(slice_idx, + cfg->slice_configs[slice_idx].integral, + cfg->slice_configs[slice_idx].frac); + } pwm_set_enabled(slice_idx, true); } @@ -171,8 +202,8 @@ static int pwm_rpi_init(const struct device *dev) #define PWM_INST_RPI_SLICE_DIVIDER(idx, n) \ { \ - .integral = DT_INST_PROP(idx, UTIL_CAT(divider_int_, n)), \ - .frac = DT_INST_PROP(idx, UTIL_CAT(divider_frac_, n)), \ + .integral = DT_INST_PROP_OR(idx, UTIL_CAT(divider_int_, n), 0), \ + .frac = DT_INST_PROP_OR(idx, UTIL_CAT(divider_frac_, n), 0), \ } #define PWM_RPI_INIT(idx) \ diff --git a/dts/bindings/pwm/raspberrypi,pico-pwm.yaml b/dts/bindings/pwm/raspberrypi,pico-pwm.yaml index b8ac90eacc553..6e29eb132ee39 100644 --- a/dts/bindings/pwm/raspberrypi,pico-pwm.yaml +++ b/dts/bindings/pwm/raspberrypi,pico-pwm.yaml @@ -16,88 +16,75 @@ properties: divider-int-0: type: int - default: 1 description: | The integral part of the divider for pwm slice 0. - This number should be in the range 1 - 255. Defaults - to 1, the same as the RESET value. + If a value between 1 and 255 is set, it will be set to the register + as the integer part of the divider. + If the value is set to 0 or this property is not defined when setting + the number of cycles to PWM, a division ratio appropriate to that value is set. divider-frac-0: type: int - default: 0 description: | The fractional part of the divider for pwm slice 0. - This number should be in the range 0 - 15. Defaults - to 0, the same as the RESET value. + This number should be in the range 0 - 15. + When the "divider-int-0" is set to 0 or is not defined, this property will be + ignored. divider-int-1: type: int - default: 1 description: See divider-int-0 for help divider-frac-1: type: int - default: 0 description: See divider-frac-0 for help divider-int-2: type: int - default: 1 description: See divider-int-0 for help divider-frac-2: type: int - default: 0 description: See divider-frac-0 for help divider-int-3: type: int - default: 1 description: See divider-int-0 for help divider-frac-3: type: int - default: 0 description: See divider-frac-0 for help divider-int-4: type: int - default: 1 description: See divider-int-0 for help divider-frac-4: type: int - default: 0 description: See divider-frac-0 for help divider-int-5: type: int - default: 1 description: See divider-int-0 for help divider-frac-5: type: int - default: 0 description: See divider-frac-0 for help divider-int-6: type: int - default: 1 description: See divider-int-0 for help divider-frac-6: type: int - default: 0 description: See divider-frac-0 for help divider-int-7: type: int - default: 1 description: See divider-int-0 for help divider-frac-7: type: int - default: 0 description: See divider-frac-0 for help "#pwm-cells": From 6a84631eec9619c333d85cb784750ca74c531b23 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Fri, 20 Sep 2024 20:08:56 +0900 Subject: [PATCH 0554/4482] samples: drivers: led: pwm: Makes blink and fade times configurable Make the blinking and fading parameters adjustable so that samples can be run on devices that support only short periods. Signed-off-by: TOKITA Hiroshi --- samples/drivers/led/pwm/Kconfig | 29 +++++++++++++++++++++++++++++ samples/drivers/led/pwm/src/main.c | 29 ++++++++++++++++++----------- 2 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 samples/drivers/led/pwm/Kconfig diff --git a/samples/drivers/led/pwm/Kconfig b/samples/drivers/led/pwm/Kconfig new file mode 100644 index 0000000000000..6d66ff8fd6b17 --- /dev/null +++ b/samples/drivers/led/pwm/Kconfig @@ -0,0 +1,29 @@ +# Copyright (c) 2024 TOKITA Hiroshi +# SPDX-License-Identifier: Apache-2.0 + +config BLINK_DELAY_SHORT + int "Blinking delay for short cycle demo" + default 100 + help + Specifies the LED on/off delay in milliseconds for short cycle + blinking demonstration. + If set to 0, the short-cycle blinking demo will not be performed. + +config BLINK_DELAY_LONG + int "Blinking delay for long cycle demo" + default 1000 + help + Specifies the LED on/off delay in milliseconds for long cycle + blinking demonstration. + If set to 0, the long-cycle blinking demo will not be performed. + +config FADE_DELAY + int "Delay time for fade demo" + default 10 + help + Specifies the delay in milliseconds for the fade demo of the + PWM-LED sample. + The brightness gradually increases by one level each time this + delay elapses. + +source "Kconfig.zephyr" diff --git a/samples/drivers/led/pwm/src/main.c b/samples/drivers/led/pwm/src/main.c index 011357a4050b0..a59887c6b8f93 100644 --- a/samples/drivers/led/pwm/src/main.c +++ b/samples/drivers/led/pwm/src/main.c @@ -24,9 +24,6 @@ const int num_leds = ARRAY_SIZE(led_label); #define MAX_BRIGHTNESS 100 -#define FADE_DELAY_MS 10 -#define FADE_DELAY K_MSEC(FADE_DELAY_MS) - /** * @brief Run tests on a single LED using the LED API syscalls. * @@ -66,28 +63,38 @@ static void run_led_test(const struct device *led_pwm, uint8_t led) LOG_ERR("err=%d brightness=%d\n", err, level); return; } - k_sleep(FADE_DELAY); + k_sleep(K_MSEC(CONFIG_FADE_DELAY)); } k_sleep(K_MSEC(1000)); - /* Set LED blinking (on: 0.1 sec, off: 0.1 sec) */ - err = led_blink(led_pwm, led, 100, 100); +#if CONFIG_BLINK_DELAY_SHORT > 0 + /* Start LED blinking (short cycle) */ + err = led_blink(led_pwm, led, CONFIG_BLINK_DELAY_SHORT, CONFIG_BLINK_DELAY_SHORT); if (err < 0) { LOG_ERR("err=%d", err); return; } - LOG_INF(" Blinking on: 0.1 sec, off: 0.1 sec"); + LOG_INF(" Blinking " + "on: " STRINGIFY(CONFIG_BLINK_DELAY_SHORT) " msec, " + "off: " STRINGIFY(CONFIG_BLINK_DELAY_SHORT) " msec"); k_sleep(K_MSEC(5000)); +#endif - /* Enable LED blinking (on: 1 sec, off: 1 sec) */ - err = led_blink(led_pwm, led, 1000, 1000); +#if CONFIG_BLINK_DELAY_LONG > 0 + /* Start LED blinking (long cycle) */ + err = led_blink(led_pwm, led, CONFIG_BLINK_DELAY_LONG, CONFIG_BLINK_DELAY_LONG); if (err < 0) { LOG_ERR("err=%d", err); - LOG_INF(" Cycle period not supported - on: 1 sec, off: 1 sec"); + LOG_INF(" Cycle period not supported - " + "on: " STRINGIFY(CONFIG_BLINK_DELAY_LONG) " msec, " + "off: " STRINGIFY(CONFIG_BLINK_DELAY_LONG) " msec"); } else { - LOG_INF(" Blinking on: 1 sec, off: 1 sec"); + LOG_INF(" Blinking " + "on: " STRINGIFY(CONFIG_BLINK_DELAY_LONG) " msec, " + "off: " STRINGIFY(CONFIG_BLINK_DELAY_LONG) " msec"); } k_sleep(K_MSEC(5000)); +#endif /* Turn LED off. */ err = led_off(led_pwm, led); From 92b7b663968803a946e2ffa5c83f027257437b05 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 21 Sep 2024 07:32:52 +0900 Subject: [PATCH 0555/4482] samples: drivers: led: pwm: Update rpi_pico test configuration Tweaking the parameters to go the sample without any errors. Signed-off-by: TOKITA Hiroshi --- samples/drivers/led/pwm/boards/rpi_pico.conf | 3 +++ samples/drivers/led/pwm/boards/rpi_pico.overlay | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 samples/drivers/led/pwm/boards/rpi_pico.conf diff --git a/samples/drivers/led/pwm/boards/rpi_pico.conf b/samples/drivers/led/pwm/boards/rpi_pico.conf new file mode 100644 index 0000000000000..5e2e318371427 --- /dev/null +++ b/samples/drivers/led/pwm/boards/rpi_pico.conf @@ -0,0 +1,3 @@ +CONFIG_BLINK_DURATION_SHORT=20 +CONFIG_BLINK_DURATION_LONG=65 +CONFIG_FADE_DELAY=15 diff --git a/samples/drivers/led/pwm/boards/rpi_pico.overlay b/samples/drivers/led/pwm/boards/rpi_pico.overlay index 565dcd6fbbab9..b1db97aeb15f0 100644 --- a/samples/drivers/led/pwm/boards/rpi_pico.overlay +++ b/samples/drivers/led/pwm/boards/rpi_pico.overlay @@ -10,6 +10,4 @@ &pwm { status = "okay"; - divider-frac-4 = <15>; - divider-int-4 = <255>; }; From cf871692f4578bb74877f0c41903f650d4d643e5 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Fri, 20 Sep 2024 20:25:37 +0900 Subject: [PATCH 0556/4482] tests: drivers: pwm: pwm_api: Add rpi_pico test configuration Add test configuration for rpi_pico Signed-off-by: TOKITA Hiroshi --- samples/drivers/led/pwm/boards/rpi_pico.conf | 4 ++-- tests/drivers/pwm/pwm_api/boards/rpi_pico.overlay | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 tests/drivers/pwm/pwm_api/boards/rpi_pico.overlay diff --git a/samples/drivers/led/pwm/boards/rpi_pico.conf b/samples/drivers/led/pwm/boards/rpi_pico.conf index 5e2e318371427..0febfc7560562 100644 --- a/samples/drivers/led/pwm/boards/rpi_pico.conf +++ b/samples/drivers/led/pwm/boards/rpi_pico.conf @@ -1,3 +1,3 @@ -CONFIG_BLINK_DURATION_SHORT=20 -CONFIG_BLINK_DURATION_LONG=65 +CONFIG_BLINK_DELAY_SHORT=20 +CONFIG_BLINK_DELAY_LONG=65 CONFIG_FADE_DELAY=15 diff --git a/tests/drivers/pwm/pwm_api/boards/rpi_pico.overlay b/tests/drivers/pwm/pwm_api/boards/rpi_pico.overlay new file mode 100644 index 0000000000000..1e0efde20ccf6 --- /dev/null +++ b/tests/drivers/pwm/pwm_api/boards/rpi_pico.overlay @@ -0,0 +1,15 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 TOKITA Hiroshi + */ + +/ { + aliases { + pwm-0 = &pwm; + }; +}; + +&pwm { + status = "okay"; +}; From a6eb068e3ca86b894dcd91a984ad432577fc6453 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Fri, 20 Sep 2024 14:22:55 -0500 Subject: [PATCH 0557/4482] drivers: spi_mcux_lpspi: clang-format Clang format the lpspi driver. Signed-off-by: Declan Snyder --- drivers/spi/spi_mcux_lpspi.c | 325 ++++++++++++++--------------------- 1 file changed, 128 insertions(+), 197 deletions(-) diff --git a/drivers/spi/spi_mcux_lpspi.c b/drivers/spi/spi_mcux_lpspi.c index 99c7756e5c72f..39535e6808ffe 100644 --- a/drivers/spi/spi_mcux_lpspi.c +++ b/drivers/spi/spi_mcux_lpspi.c @@ -29,12 +29,11 @@ LOG_MODULE_REGISTER(spi_mcux_lpspi, CONFIG_SPI_LOG_LEVEL); #include "spi_context.h" -#define CHIP_SELECT_COUNT 4 -#define MAX_DATA_WIDTH 4096 +#define CHIP_SELECT_COUNT 4 +#define MAX_DATA_WIDTH 4096 /* Required by DEVICE_MMIO_NAMED_* macros */ -#define DEV_CFG(_dev) \ - ((const struct spi_mcux_config *)(_dev)->config) +#define DEV_CFG(_dev) ((const struct spi_mcux_config *)(_dev)->config) #define DEV_DATA(_dev) ((struct spi_mcux_data *)(_dev)->data) struct spi_mcux_config { @@ -53,10 +52,10 @@ struct spi_mcux_config { }; #ifdef CONFIG_SPI_MCUX_LPSPI_DMA -#define SPI_MCUX_LPSPI_DMA_ERROR_FLAG 0x01 -#define SPI_MCUX_LPSPI_DMA_RX_DONE_FLAG 0x02 -#define SPI_MCUX_LPSPI_DMA_TX_DONE_FLAG 0x04 -#define SPI_MCUX_LPSPI_DMA_DONE_FLAG \ +#define SPI_MCUX_LPSPI_DMA_ERROR_FLAG 0x01 +#define SPI_MCUX_LPSPI_DMA_RX_DONE_FLAG 0x02 +#define SPI_MCUX_LPSPI_DMA_TX_DONE_FLAG 0x04 +#define SPI_MCUX_LPSPI_DMA_DONE_FLAG \ (SPI_MCUX_LPSPI_DMA_RX_DONE_FLAG | SPI_MCUX_LPSPI_DMA_TX_DONE_FLAG) struct stream { @@ -105,8 +104,8 @@ static int spi_mcux_transfer_next_packet(const struct device *dev) return 0; } - transfer.configFlags = kLPSPI_MasterPcsContinuous | - (ctx->config->slave << LPSPI_MASTER_PCS_SHIFT); + transfer.configFlags = + kLPSPI_MasterPcsContinuous | (ctx->config->slave << LPSPI_MASTER_PCS_SHIFT); if (ctx->tx_len == 0) { /* rx only, nothing to tx */ @@ -115,12 +114,12 @@ static int spi_mcux_transfer_next_packet(const struct device *dev) transfer.dataSize = ctx->rx_len; } else if (ctx->rx_len == 0) { /* tx only, nothing to rx */ - transfer.txData = (uint8_t *) ctx->tx_buf; + transfer.txData = (uint8_t *)ctx->tx_buf; transfer.rxData = NULL; transfer.dataSize = ctx->tx_len; } else if (ctx->tx_len == ctx->rx_len) { /* rx and tx are the same length */ - transfer.txData = (uint8_t *) ctx->tx_buf; + transfer.txData = (uint8_t *)ctx->tx_buf; transfer.rxData = ctx->rx_buf; transfer.dataSize = ctx->tx_len; } else if (ctx->tx_len > ctx->rx_len) { @@ -128,7 +127,7 @@ static int spi_mcux_transfer_next_packet(const struct device *dev) * rx into a longer intermediate buffer. Leave chip select * active between transfers. */ - transfer.txData = (uint8_t *) ctx->tx_buf; + transfer.txData = (uint8_t *)ctx->tx_buf; transfer.rxData = ctx->rx_buf; transfer.dataSize = ctx->rx_len; } else { @@ -136,15 +135,14 @@ static int spi_mcux_transfer_next_packet(const struct device *dev) * tx from a longer intermediate buffer. Leave chip select * active between transfers. */ - transfer.txData = (uint8_t *) ctx->tx_buf; + transfer.txData = (uint8_t *)ctx->tx_buf; transfer.rxData = ctx->rx_buf; transfer.dataSize = ctx->tx_len; } data->transfer_len = transfer.dataSize; - status = LPSPI_MasterTransferNonBlocking(base, &data->handle, - &transfer); + status = LPSPI_MasterTransferNonBlocking(base, &data->handle, &transfer); if (status != kStatus_Success) { LOG_ERR("Transfer could not start on %s: %d", dev->name, status); return status == kStatus_LPSPI_Busy ? -EBUSY : -EINVAL; @@ -170,8 +168,8 @@ static void spi_mcux_isr(const struct device *dev) static void spi_mcux_iodev_complete(const struct device *dev, int status); #endif -static void spi_mcux_master_transfer_callback(LPSPI_Type *base, - lpspi_master_handle_t *handle, status_t status, void *userData) +static void spi_mcux_master_transfer_callback(LPSPI_Type *base, lpspi_master_handle_t *handle, + status_t status, void *userData) { struct spi_mcux_data *data = userData; @@ -189,8 +187,7 @@ static void spi_mcux_master_transfer_callback(LPSPI_Type *base, spi_mcux_transfer_next_packet(data->dev); } -static int spi_mcux_configure(const struct device *dev, - const struct spi_config *spi_cfg) +static int spi_mcux_configure(const struct device *dev, const struct spi_config *spi_cfg) { const struct spi_mcux_config *config = dev->config; struct spi_mcux_data *data = dev->data; @@ -207,35 +204,28 @@ static int spi_mcux_configure(const struct device *dev, LPSPI_MasterGetDefaultConfig(&master_config); if (spi_cfg->slave > CHIP_SELECT_COUNT) { - LOG_ERR("Slave %d is greater than %d", - spi_cfg->slave, - CHIP_SELECT_COUNT); + LOG_ERR("Slave %d is greater than %d", spi_cfg->slave, CHIP_SELECT_COUNT); return -EINVAL; } word_size = SPI_WORD_SIZE_GET(spi_cfg->operation); if (word_size > MAX_DATA_WIDTH) { - LOG_ERR("Word size %d is greater than %d", - word_size, MAX_DATA_WIDTH); + LOG_ERR("Word size %d is greater than %d", word_size, MAX_DATA_WIDTH); return -EINVAL; } master_config.bitsPerFrame = word_size; - master_config.cpol = - (SPI_MODE_GET(spi_cfg->operation) & SPI_MODE_CPOL) - ? kLPSPI_ClockPolarityActiveLow - : kLPSPI_ClockPolarityActiveHigh; + master_config.cpol = (SPI_MODE_GET(spi_cfg->operation) & SPI_MODE_CPOL) + ? kLPSPI_ClockPolarityActiveLow + : kLPSPI_ClockPolarityActiveHigh; - master_config.cpha = - (SPI_MODE_GET(spi_cfg->operation) & SPI_MODE_CPHA) - ? kLPSPI_ClockPhaseSecondEdge - : kLPSPI_ClockPhaseFirstEdge; + master_config.cpha = (SPI_MODE_GET(spi_cfg->operation) & SPI_MODE_CPHA) + ? kLPSPI_ClockPhaseSecondEdge + : kLPSPI_ClockPhaseFirstEdge; master_config.direction = - (spi_cfg->operation & SPI_TRANSFER_LSB) - ? kLPSPI_LsbFirst - : kLPSPI_MsbFirst; + (spi_cfg->operation & SPI_TRANSFER_LSB) ? kLPSPI_LsbFirst : kLPSPI_MsbFirst; master_config.baudRate = spi_cfg->frequency; @@ -250,8 +240,7 @@ static int spi_mcux_configure(const struct device *dev, return -ENODEV; } - if (clock_control_get_rate(config->clock_dev, config->clock_subsys, - &clock_freq)) { + if (clock_control_get_rate(config->clock_dev, config->clock_subsys, &clock_freq)) { return -EINVAL; } @@ -275,8 +264,7 @@ static int spi_mcux_configure(const struct device *dev, base->CR |= LPSPI_CR_DBGEN_MASK; } - LPSPI_MasterTransferCreateHandle(base, &data->handle, - spi_mcux_master_transfer_callback, + LPSPI_MasterTransferCreateHandle(base, &data->handle, spi_mcux_master_transfer_callback, data); LPSPI_SetDummyData(base, 0); @@ -287,12 +275,10 @@ static int spi_mcux_configure(const struct device *dev, } #ifdef CONFIG_SPI_MCUX_LPSPI_DMA -static int spi_mcux_dma_rxtx_load(const struct device *dev, - size_t *dma_size); +static int spi_mcux_dma_rxtx_load(const struct device *dev, size_t *dma_size); /* This function is executed in the interrupt context */ -static void spi_mcux_dma_callback(const struct device *dev, void *arg, - uint32_t channel, int status) +static void spi_mcux_dma_callback(const struct device *dev, void *arg, uint32_t channel, int status) { /* arg directly holds the spi device */ const struct device *spi_dev = arg; @@ -312,15 +298,13 @@ static void spi_mcux_dma_callback(const struct device *dev, void *arg, data->status_flags |= SPI_MCUX_LPSPI_DMA_RX_DONE_FLAG; LOG_DBG("DMA RX Block Complete"); } else { - LOG_ERR("DMA callback channel %d is not valid.", - channel); + LOG_ERR("DMA callback channel %d is not valid.", channel); data->status_flags |= SPI_MCUX_LPSPI_DMA_ERROR_FLAG; } } #if CONFIG_SPI_ASYNC if (data->ctx.asynchronous && - ((data->status_flags & SPI_MCUX_LPSPI_DMA_DONE_FLAG) == - SPI_MCUX_LPSPI_DMA_DONE_FLAG)) { + ((data->status_flags & SPI_MCUX_LPSPI_DMA_DONE_FLAG) == SPI_MCUX_LPSPI_DMA_DONE_FLAG)) { /* Load dma blocks of equal length */ size_t dma_size = MIN(data->ctx.tx_len, data->ctx.rx_len); @@ -378,12 +362,10 @@ static int spi_mcux_dma_tx_load(const struct device *dev, const uint8_t *buf, si /* give the client dev as arg, as the callback comes from the dma */ stream->dma_cfg.user_data = (struct device *)dev; /* pass our client origin to the dma: data->dma_tx.dma_channel */ - return dma_config(data->dma_tx.dma_dev, data->dma_tx.channel, - &stream->dma_cfg); + return dma_config(data->dma_tx.dma_dev, data->dma_tx.channel, &stream->dma_cfg); } -static int spi_mcux_dma_rx_load(const struct device *dev, uint8_t *buf, - size_t len) +static int spi_mcux_dma_rx_load(const struct device *dev, uint8_t *buf, size_t len) { /*const struct spi_mcux_config *cfg = dev->config; */ struct spi_mcux_data *data = dev->data; @@ -420,8 +402,7 @@ static int spi_mcux_dma_rx_load(const struct device *dev, uint8_t *buf, stream->dma_cfg.user_data = (struct device *)dev; /* pass our client origin to the dma: data->dma_rx.channel */ - return dma_config(data->dma_rx.dma_dev, data->dma_rx.channel, - &stream->dma_cfg); + return dma_config(data->dma_rx.dma_dev, data->dma_rx.channel, &stream->dma_cfg); } static int wait_dma_rx_tx_done(const struct device *dev) @@ -440,15 +421,14 @@ static int wait_dma_rx_tx_done(const struct device *dev) } if ((data->status_flags & SPI_MCUX_LPSPI_DMA_DONE_FLAG) == - SPI_MCUX_LPSPI_DMA_DONE_FLAG) { + SPI_MCUX_LPSPI_DMA_DONE_FLAG) { LOG_DBG("DMA block completed"); return 0; } } } -static inline int spi_mcux_dma_rxtx_load(const struct device *dev, - size_t *dma_size) +static inline int spi_mcux_dma_rxtx_load(const struct device *dev, size_t *dma_size) { struct spi_mcux_data *lpspi_data = dev->data; int ret = 0; @@ -461,38 +441,29 @@ static inline int spi_mcux_dma_rxtx_load(const struct device *dev, *dma_size = MAX(lpspi_data->ctx.tx_len, lpspi_data->ctx.rx_len); } - ret = spi_mcux_dma_tx_load(dev, lpspi_data->ctx.tx_buf, - *dma_size); + ret = spi_mcux_dma_tx_load(dev, lpspi_data->ctx.tx_buf, *dma_size); if (ret != 0) { return ret; } - ret = spi_mcux_dma_rx_load(dev, lpspi_data->ctx.rx_buf, - *dma_size); + ret = spi_mcux_dma_rx_load(dev, lpspi_data->ctx.rx_buf, *dma_size); if (ret != 0) { return ret; } /* Start DMA */ - ret = dma_start(lpspi_data->dma_tx.dma_dev, - lpspi_data->dma_tx.channel); + ret = dma_start(lpspi_data->dma_tx.dma_dev, lpspi_data->dma_tx.channel); if (ret != 0) { return ret; } - ret = dma_start(lpspi_data->dma_rx.dma_dev, - lpspi_data->dma_rx.channel); + ret = dma_start(lpspi_data->dma_rx.dma_dev, lpspi_data->dma_rx.channel); return ret; - } -static int transceive_dma(const struct device *dev, - const struct spi_config *spi_cfg, - const struct spi_buf_set *tx_bufs, - const struct spi_buf_set *rx_bufs, - bool asynchronous, - spi_callback_t cb, - void *userdata) +static int transceive_dma(const struct device *dev, const struct spi_config *spi_cfg, + const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs, + bool asynchronous, spi_callback_t cb, void *userdata) { /* const struct spi_mcux_config *config = dev->config; */ struct spi_mcux_data *data = dev->data; @@ -577,8 +548,7 @@ static int transceive_dma(const struct device *dev, #ifdef CONFIG_SPI_RTIO -static inline int transceive_rtio(const struct device *dev, - const struct spi_config *spi_cfg, +static inline int transceive_rtio(const struct device *dev, const struct spi_config *spi_cfg, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs) { @@ -597,13 +567,9 @@ static inline int transceive_rtio(const struct device *dev, #endif /* CONFIG_SPI_RTIO */ -static int transceive(const struct device *dev, - const struct spi_config *spi_cfg, - const struct spi_buf_set *tx_bufs, - const struct spi_buf_set *rx_bufs, - bool asynchronous, - spi_callback_t cb, - void *userdata) +static int transceive(const struct device *dev, const struct spi_config *spi_cfg, + const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs, + bool asynchronous, spi_callback_t cb, void *userdata) { struct spi_mcux_data *data = dev->data; int ret; @@ -631,10 +597,8 @@ static int transceive(const struct device *dev, return ret; } -static int spi_mcux_transceive(const struct device *dev, - const struct spi_config *spi_cfg, - const struct spi_buf_set *tx_bufs, - const struct spi_buf_set *rx_bufs) +static int spi_mcux_transceive(const struct device *dev, const struct spi_config *spi_cfg, + const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs) { #ifdef CONFIG_SPI_RTIO return transceive_rtio(dev, spi_cfg, tx_bufs, rx_bufs); @@ -652,12 +616,10 @@ static int spi_mcux_transceive(const struct device *dev, } #ifdef CONFIG_SPI_ASYNC -static int spi_mcux_transceive_async(const struct device *dev, - const struct spi_config *spi_cfg, - const struct spi_buf_set *tx_bufs, - const struct spi_buf_set *rx_bufs, - spi_callback_t cb, - void *userdata) +static int spi_mcux_transceive_async(const struct device *dev, const struct spi_config *spi_cfg, + const struct spi_buf_set *tx_bufs, + const struct spi_buf_set *rx_bufs, spi_callback_t cb, + void *userdata) { #ifdef CONFIG_SPI_MCUX_LPSPI_DMA struct spi_mcux_data *data = dev->data; @@ -673,8 +635,7 @@ static int spi_mcux_transceive_async(const struct device *dev, } #endif /* CONFIG_SPI_ASYNC */ -static int spi_mcux_release(const struct device *dev, - const struct spi_config *spi_cfg) +static int spi_mcux_release(const struct device *dev, const struct spi_config *spi_cfg) { struct spi_mcux_data *data = dev->data; @@ -695,8 +656,8 @@ static int spi_mcux_init(const struct device *dev) /* When using LP Flexcomm driver, register the interrupt handler * so we receive notification from the LP Flexcomm interrupt handler. */ - nxp_lp_flexcomm_setirqhandler(config->parent_dev, dev, - LP_FLEXCOMM_PERIPH_LPSPI, spi_mcux_isr); + nxp_lp_flexcomm_setirqhandler(config->parent_dev, dev, LP_FLEXCOMM_PERIPH_LPSPI, + spi_mcux_isr); #else /* Interrupt is managed by this driver */ config->irq_config_func(dev); @@ -755,7 +716,6 @@ static inline void spi_mcux_iodev_prepare_start(const struct device *dev) spi_context_cs_control(&data->ctx, true); } - static void spi_mcux_iodev_start(const struct device *dev) { struct spi_mcux_data *data = dev->data; @@ -768,8 +728,8 @@ static void spi_mcux_iodev_start(const struct device *dev) lpspi_transfer_t transfer; status_t status; - transfer.configFlags = kLPSPI_MasterPcsContinuous | - (spi_cfg->slave << LPSPI_MASTER_PCS_SHIFT); + transfer.configFlags = + kLPSPI_MasterPcsContinuous | (spi_cfg->slave << LPSPI_MASTER_PCS_SHIFT); switch (sqe->op) { case RTIO_OP_RX: @@ -800,16 +760,14 @@ static void spi_mcux_iodev_start(const struct device *dev) data->transfer_len = transfer.dataSize; - status = LPSPI_MasterTransferNonBlocking(base, &data->handle, - &transfer); + status = LPSPI_MasterTransferNonBlocking(base, &data->handle, &transfer); if (status != kStatus_Success) { LOG_ERR("Transfer could not start"); spi_mcux_iodev_complete(dev, -EIO); } } -static void spi_mcux_iodev_submit(const struct device *dev, - struct rtio_iodev_sqe *iodev_sqe) +static void spi_mcux_iodev_submit(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe) { struct spi_mcux_data *data = dev->data; struct spi_rtio *rtio_ctx = data->rtio_ctx; @@ -841,7 +799,6 @@ static void spi_mcux_iodev_complete(const struct device *dev, int status) #endif - static const struct spi_driver_api spi_mcux_driver_api = { .transceive = spi_mcux_transceive, #ifdef CONFIG_SPI_ASYNC @@ -853,113 +810,87 @@ static const struct spi_driver_api spi_mcux_driver_api = { .release = spi_mcux_release, }; -#define SPI_MCUX_RTIO_DEFINE(n) SPI_RTIO_DEFINE(spi_mcux_rtio_##n, \ - CONFIG_SPI_MCUX_RTIO_SQ_SIZE, \ - CONFIG_SPI_MCUX_RTIO_SQ_SIZE) +#define SPI_MCUX_RTIO_DEFINE(n) \ + SPI_RTIO_DEFINE(spi_mcux_rtio_##n, CONFIG_SPI_MCUX_RTIO_SQ_SIZE, \ + CONFIG_SPI_MCUX_RTIO_SQ_SIZE) #ifdef CONFIG_SPI_MCUX_LPSPI_DMA -#define SPI_DMA_CHANNELS(n) \ - IF_ENABLED(DT_INST_DMAS_HAS_NAME(n, tx), \ - ( \ - .dma_tx = { \ - .dma_dev = DEVICE_DT_GET(DT_INST_DMAS_CTLR_BY_NAME(n, tx)), \ - .channel = \ - DT_INST_DMAS_CELL_BY_NAME(n, tx, mux), \ - .dma_cfg = { \ - .channel_direction = MEMORY_TO_PERIPHERAL, \ - .dma_callback = spi_mcux_dma_callback, \ - .source_data_size = 1, \ - .dest_data_size = 1, \ - .block_count = 1, \ - .dma_slot = DT_INST_DMAS_CELL_BY_NAME(n, tx, source) \ - } \ - }, \ - )) \ - IF_ENABLED(DT_INST_DMAS_HAS_NAME(n, rx), \ - ( \ - .dma_rx = { \ - .dma_dev = DEVICE_DT_GET(DT_INST_DMAS_CTLR_BY_NAME(n, rx)), \ - .channel = \ - DT_INST_DMAS_CELL_BY_NAME(n, rx, mux), \ - .dma_cfg = { \ - .channel_direction = PERIPHERAL_TO_MEMORY, \ - .dma_callback = spi_mcux_dma_callback, \ - .source_data_size = 1, \ - .dest_data_size = 1, \ - .block_count = 1, \ - .dma_slot = DT_INST_DMAS_CELL_BY_NAME(n, rx, source) \ - } \ - }, \ - )) +#define SPI_DMA_CHANNELS(n) \ + IF_ENABLED( \ + DT_INST_DMAS_HAS_NAME(n, tx), \ + (.dma_tx = {.dma_dev = DEVICE_DT_GET(DT_INST_DMAS_CTLR_BY_NAME(n, tx)), \ + .channel = DT_INST_DMAS_CELL_BY_NAME(n, tx, mux), \ + .dma_cfg = {.channel_direction = MEMORY_TO_PERIPHERAL, \ + .dma_callback = spi_mcux_dma_callback, \ + .source_data_size = 1, \ + .dest_data_size = 1, \ + .block_count = 1, \ + .dma_slot = DT_INST_DMAS_CELL_BY_NAME(n, tx, source)}},)) \ + IF_ENABLED( \ + DT_INST_DMAS_HAS_NAME(n, rx), \ + (.dma_rx = {.dma_dev = DEVICE_DT_GET(DT_INST_DMAS_CTLR_BY_NAME(n, rx)), \ + .channel = DT_INST_DMAS_CELL_BY_NAME(n, rx, mux), \ + .dma_cfg = {.channel_direction = PERIPHERAL_TO_MEMORY, \ + .dma_callback = spi_mcux_dma_callback, \ + .source_data_size = 1, \ + .dest_data_size = 1, \ + .block_count = 1, \ + .dma_slot = DT_INST_DMAS_CELL_BY_NAME(n, rx, source)}},)) #else #define SPI_DMA_CHANNELS(n) #endif /* CONFIG_SPI_MCUX_LPSPI_DMA */ -#define SPI_MCUX_LPSPI_MODULE_IRQ_CONNECT(n) \ - do { \ - IRQ_CONNECT(DT_INST_IRQN(n), \ - DT_INST_IRQ(n, priority), \ - spi_mcux_isr, \ - DEVICE_DT_INST_GET(n), 0); \ - irq_enable(DT_INST_IRQN(n)); \ +#define SPI_MCUX_LPSPI_MODULE_IRQ_CONNECT(n) \ + do { \ + IRQ_CONNECT(DT_INST_IRQN(n), DT_INST_IRQ(n, priority), spi_mcux_isr, \ + DEVICE_DT_INST_GET(n), 0); \ + irq_enable(DT_INST_IRQN(n)); \ } while (false) -#define SPI_MCUX_LPSPI_MODULE_IRQ(n) \ - IF_ENABLED(DT_INST_IRQ_HAS_IDX(n, 0), \ - (SPI_MCUX_LPSPI_MODULE_IRQ_CONNECT(n))) +#define SPI_MCUX_LPSPI_MODULE_IRQ(n) \ + IF_ENABLED(DT_INST_IRQ_HAS_IDX(n, 0), (SPI_MCUX_LPSPI_MODULE_IRQ_CONNECT(n))) #ifdef CONFIG_NXP_LP_FLEXCOMM -#define PARENT_DEV(n) \ - .parent_dev = DEVICE_DT_GET(DT_INST_PARENT(n)), +#define PARENT_DEV(n) .parent_dev = DEVICE_DT_GET(DT_INST_PARENT(n)), #else #define PARENT_DEV(n) #endif /* CONFIG_NXP_LP_FLEXCOMM */ -#define SPI_MCUX_LPSPI_INIT(n) \ - PINCTRL_DT_INST_DEFINE(n); \ - COND_CODE_1(CONFIG_SPI_RTIO, (SPI_MCUX_RTIO_DEFINE(n)), ()); \ - \ - static void spi_mcux_config_func_##n(const struct device *dev); \ - \ - static const struct spi_mcux_config spi_mcux_config_##n = { \ - DEVICE_MMIO_NAMED_ROM_INIT(reg_base, DT_DRV_INST(n)), \ - PARENT_DEV(n) \ - .clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \ - .clock_subsys = \ - (clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name), \ - .irq_config_func = spi_mcux_config_func_##n, \ - .pcs_sck_delay = UTIL_AND( \ - DT_INST_NODE_HAS_PROP(n, pcs_sck_delay), \ - DT_INST_PROP(n, pcs_sck_delay)), \ - .sck_pcs_delay = UTIL_AND( \ - DT_INST_NODE_HAS_PROP(n, sck_pcs_delay), \ - DT_INST_PROP(n, sck_pcs_delay)), \ - .transfer_delay = UTIL_AND( \ - DT_INST_NODE_HAS_PROP(n, transfer_delay), \ - DT_INST_PROP(n, transfer_delay)), \ - .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ - .data_pin_config = DT_INST_ENUM_IDX(n, data_pin_config),\ - }; \ - \ - static struct spi_mcux_data spi_mcux_data_##n = { \ - SPI_CONTEXT_INIT_LOCK(spi_mcux_data_##n, ctx), \ - SPI_CONTEXT_INIT_SYNC(spi_mcux_data_##n, ctx), \ - SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(n), ctx) \ - SPI_DMA_CHANNELS(n) \ - IF_ENABLED(CONFIG_SPI_RTIO, \ - (.rtio_ctx = &spi_mcux_rtio_##n,)) \ - \ - }; \ - \ - DEVICE_DT_INST_DEFINE(n, spi_mcux_init, NULL, \ - &spi_mcux_data_##n, \ - &spi_mcux_config_##n, POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ - &spi_mcux_driver_api); \ - \ - static void spi_mcux_config_func_##n(const struct device *dev) \ - { \ - SPI_MCUX_LPSPI_MODULE_IRQ(n); \ +#define SPI_MCUX_LPSPI_INIT(n) \ + PINCTRL_DT_INST_DEFINE(n); \ + COND_CODE_1(CONFIG_SPI_RTIO, (SPI_MCUX_RTIO_DEFINE(n)), ()); \ + \ + static void spi_mcux_config_func_##n(const struct device *dev); \ + \ + static const struct spi_mcux_config spi_mcux_config_##n = { \ + DEVICE_MMIO_NAMED_ROM_INIT(reg_base, DT_DRV_INST(n)), \ + PARENT_DEV(n).clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \ + .clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name), \ + .irq_config_func = spi_mcux_config_func_##n, \ + .pcs_sck_delay = UTIL_AND(DT_INST_NODE_HAS_PROP(n, pcs_sck_delay), \ + DT_INST_PROP(n, pcs_sck_delay)), \ + .sck_pcs_delay = UTIL_AND(DT_INST_NODE_HAS_PROP(n, sck_pcs_delay), \ + DT_INST_PROP(n, sck_pcs_delay)), \ + .transfer_delay = UTIL_AND(DT_INST_NODE_HAS_PROP(n, transfer_delay), \ + DT_INST_PROP(n, transfer_delay)), \ + .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ + .data_pin_config = DT_INST_ENUM_IDX(n, data_pin_config), \ + }; \ + \ + static struct spi_mcux_data spi_mcux_data_##n = { \ + SPI_CONTEXT_INIT_LOCK(spi_mcux_data_##n, ctx), \ + SPI_CONTEXT_INIT_SYNC(spi_mcux_data_##n, ctx), \ + SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(n), ctx) SPI_DMA_CHANNELS(n) \ + IF_ENABLED(CONFIG_SPI_RTIO, (.rtio_ctx = &spi_mcux_rtio_##n,)) \ + \ + }; \ + \ + DEVICE_DT_INST_DEFINE(n, spi_mcux_init, NULL, &spi_mcux_data_##n, &spi_mcux_config_##n, \ + POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, &spi_mcux_driver_api); \ + \ + static void spi_mcux_config_func_##n(const struct device *dev) \ + { \ + SPI_MCUX_LPSPI_MODULE_IRQ(n); \ } DT_INST_FOREACH_STATUS_OKAY(SPI_MCUX_LPSPI_INIT) From e0b5c67dda7e479261693618d0d2111ccd47c30f Mon Sep 17 00:00:00 2001 From: Rodrigo Peixoto Date: Tue, 27 Aug 2024 08:21:16 -0300 Subject: [PATCH 0558/4482] zbus: add HEAP_MEM_POOL_ADD_SIZE_ZBUS ZBus currently does not have a `HEAP_MEM_POOL_ADD_SIZE_ZBUS` when using message subscribers or runtime observers, forcing the developer to set that manually. Adding the configuration option to zbus would improve its usability and make zbus easier to use. With this feature, zbus aligns with the other Zephyr subsystems' heap memory allocation approach. Signed-off-by: Rodrigo Peixoto --- samples/subsys/zbus/runtime_obs_registration/prj.conf | 1 - subsys/zbus/Kconfig | 7 +++++++ subsys/zbus/zbus.c | 2 -- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/samples/subsys/zbus/runtime_obs_registration/prj.conf b/samples/subsys/zbus/runtime_obs_registration/prj.conf index 8585bf51fa658..dbf96f0cd96c9 100644 --- a/samples/subsys/zbus/runtime_obs_registration/prj.conf +++ b/samples/subsys/zbus/runtime_obs_registration/prj.conf @@ -5,5 +5,4 @@ CONFIG_BOOT_BANNER=n CONFIG_ZBUS=y CONFIG_ZBUS_LOG_LEVEL_INF=y CONFIG_ZBUS_RUNTIME_OBSERVERS=y -CONFIG_HEAP_MEM_POOL_SIZE=256 CONFIG_MP_MAX_NUM_CPUS=1 diff --git a/subsys/zbus/Kconfig b/subsys/zbus/Kconfig index 3fd7e3c2f1078..2f7040cf2fc3a 100644 --- a/subsys/zbus/Kconfig +++ b/subsys/zbus/Kconfig @@ -72,6 +72,13 @@ config ZBUS_ASSERT_MOCK parameters. +config HEAP_MEM_POOL_ADD_SIZE_ZBUS + int + default 2048 if ZBUS_MSG_SUBSCRIBER_BUF_ALLOC_DYNAMIC && !ZBUS_RUNTIME_OBSERVERS + default 1024 if !ZBUS_MSG_SUBSCRIBER_BUF_ALLOC_DYNAMIC && ZBUS_RUNTIME_OBSERVERS + default 3072 if ZBUS_MSG_SUBSCRIBER_BUF_ALLOC_DYNAMIC && ZBUS_RUNTIME_OBSERVERS + + module = ZBUS module-str = zbus source "subsys/logging/Kconfig.template.log_config" diff --git a/subsys/zbus/zbus.c b/subsys/zbus/zbus.c index 110294b32a976..b55c8498ad418 100644 --- a/subsys/zbus/zbus.c +++ b/subsys/zbus/zbus.c @@ -26,8 +26,6 @@ static struct k_spinlock obs_slock; NET_BUF_POOL_HEAP_DEFINE(_zbus_msg_subscribers_pool, CONFIG_ZBUS_MSG_SUBSCRIBER_NET_BUF_POOL_SIZE, sizeof(struct zbus_channel *), NULL); -BUILD_ASSERT(K_HEAP_MEM_POOL_SIZE > 0, "MSG_SUBSCRIBER feature requires heap memory pool."); - static inline struct net_buf *_zbus_create_net_buf(struct net_buf_pool *pool, size_t size, k_timeout_t timeout) { From ae87d53ac5fc0bf2426f288338e0aeefaa6b3446 Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Tue, 18 Jun 2024 18:09:15 +0200 Subject: [PATCH 0559/4482] drivers: video-controls: Run clang-format Run clang format before making any changes. Signed-off-by: Phi Bang Nguyen --- include/zephyr/drivers/video-controls.h | 33 ++++++++++++------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/include/zephyr/drivers/video-controls.h b/include/zephyr/drivers/video-controls.h index 7912ab0d91cd2..8454b3c07979b 100644 --- a/include/zephyr/drivers/video-controls.h +++ b/include/zephyr/drivers/video-controls.h @@ -33,11 +33,11 @@ extern "C" { * @name Control classes * @{ */ -#define VIDEO_CTRL_CLASS_GENERIC 0x00000000 /**< Generic class controls */ -#define VIDEO_CTRL_CLASS_CAMERA 0x00010000 /**< Camera class controls */ -#define VIDEO_CTRL_CLASS_MPEG 0x00020000 /**< MPEG-compression controls */ -#define VIDEO_CTRL_CLASS_JPEG 0x00030000 /**< JPEG-compression controls */ -#define VIDEO_CTRL_CLASS_VENDOR 0xFFFF0000 /**< Vendor-specific class controls */ +#define VIDEO_CTRL_CLASS_GENERIC 0x00000000 /**< Generic class controls */ +#define VIDEO_CTRL_CLASS_CAMERA 0x00010000 /**< Camera class controls */ +#define VIDEO_CTRL_CLASS_MPEG 0x00020000 /**< MPEG-compression controls */ +#define VIDEO_CTRL_CLASS_JPEG 0x00030000 /**< JPEG-compression controls */ +#define VIDEO_CTRL_CLASS_VENDOR 0xFFFF0000 /**< Vendor-specific class controls */ /** * @} */ @@ -47,9 +47,9 @@ extern "C" { * @{ */ /** Mirror the picture horizontally */ -#define VIDEO_CID_HFLIP (VIDEO_CTRL_CLASS_GENERIC + 0) +#define VIDEO_CID_HFLIP (VIDEO_CTRL_CLASS_GENERIC + 0) /** Mirror the picture vertically */ -#define VIDEO_CID_VFLIP (VIDEO_CTRL_CLASS_GENERIC + 1) +#define VIDEO_CID_VFLIP (VIDEO_CTRL_CLASS_GENERIC + 1) /** * @} */ @@ -58,15 +58,15 @@ extern "C" { * @name Camera class control IDs * @{ */ -#define VIDEO_CID_CAMERA_EXPOSURE (VIDEO_CTRL_CLASS_CAMERA + 0) -#define VIDEO_CID_CAMERA_GAIN (VIDEO_CTRL_CLASS_CAMERA + 1) -#define VIDEO_CID_CAMERA_ZOOM (VIDEO_CTRL_CLASS_CAMERA + 2) -#define VIDEO_CID_CAMERA_BRIGHTNESS (VIDEO_CTRL_CLASS_CAMERA + 3) -#define VIDEO_CID_CAMERA_SATURATION (VIDEO_CTRL_CLASS_CAMERA + 4) -#define VIDEO_CID_CAMERA_WHITE_BAL (VIDEO_CTRL_CLASS_CAMERA + 5) -#define VIDEO_CID_CAMERA_CONTRAST (VIDEO_CTRL_CLASS_CAMERA + 6) -#define VIDEO_CID_CAMERA_COLORBAR (VIDEO_CTRL_CLASS_CAMERA + 7) -#define VIDEO_CID_CAMERA_QUALITY (VIDEO_CTRL_CLASS_CAMERA + 8) +#define VIDEO_CID_CAMERA_EXPOSURE (VIDEO_CTRL_CLASS_CAMERA + 0) +#define VIDEO_CID_CAMERA_GAIN (VIDEO_CTRL_CLASS_CAMERA + 1) +#define VIDEO_CID_CAMERA_ZOOM (VIDEO_CTRL_CLASS_CAMERA + 2) +#define VIDEO_CID_CAMERA_BRIGHTNESS (VIDEO_CTRL_CLASS_CAMERA + 3) +#define VIDEO_CID_CAMERA_SATURATION (VIDEO_CTRL_CLASS_CAMERA + 4) +#define VIDEO_CID_CAMERA_WHITE_BAL (VIDEO_CTRL_CLASS_CAMERA + 5) +#define VIDEO_CID_CAMERA_CONTRAST (VIDEO_CTRL_CLASS_CAMERA + 6) +#define VIDEO_CID_CAMERA_COLORBAR (VIDEO_CTRL_CLASS_CAMERA + 7) +#define VIDEO_CID_CAMERA_QUALITY (VIDEO_CTRL_CLASS_CAMERA + 8) /** * @} */ @@ -77,7 +77,6 @@ extern "C" { /* Controls */ - /** * @} */ From 6007fb5c339597358f808859b66bb7987eebf52a Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Tue, 18 Jun 2024 18:43:26 +0200 Subject: [PATCH 0560/4482] drivers: video-controls: Add some control IDs Add some control IDs: - VIDEO_CID_CAMERA_HUE - VIDEO_CID_POWER_LINE_FREQUENCY - VIDEO_CID_PIXEL_RATE which is needed for changing frame rate Signed-off-by: Phi Bang Nguyen --- include/zephyr/drivers/video-controls.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/include/zephyr/drivers/video-controls.h b/include/zephyr/drivers/video-controls.h index 8454b3c07979b..facb9857dcf83 100644 --- a/include/zephyr/drivers/video-controls.h +++ b/include/zephyr/drivers/video-controls.h @@ -47,9 +47,21 @@ extern "C" { * @{ */ /** Mirror the picture horizontally */ -#define VIDEO_CID_HFLIP (VIDEO_CTRL_CLASS_GENERIC + 0) +#define VIDEO_CID_HFLIP (VIDEO_CTRL_CLASS_GENERIC + 0) /** Mirror the picture vertically */ -#define VIDEO_CID_VFLIP (VIDEO_CTRL_CLASS_GENERIC + 1) +#define VIDEO_CID_VFLIP (VIDEO_CTRL_CLASS_GENERIC + 1) +/** Power line frequency (enum) filter to avoid flicker */ +#define VIDEO_CID_POWER_LINE_FREQUENCY (VIDEO_CTRL_CLASS_GENERIC + 2) +/** Pixel rate (pixels/second) in the device's pixel array. This control is read-only. */ +#define VIDEO_CID_PIXEL_RATE (VIDEO_CTRL_CLASS_GENERIC + 3) + +enum video_power_line_frequency { + VIDEO_CID_POWER_LINE_FREQUENCY_DISABLED = 0, + VIDEO_CID_POWER_LINE_FREQUENCY_50HZ = 1, + VIDEO_CID_POWER_LINE_FREQUENCY_60HZ = 2, + VIDEO_CID_POWER_LINE_FREQUENCY_AUTO = 3, +}; + /** * @} */ @@ -67,6 +79,7 @@ extern "C" { #define VIDEO_CID_CAMERA_CONTRAST (VIDEO_CTRL_CLASS_CAMERA + 6) #define VIDEO_CID_CAMERA_COLORBAR (VIDEO_CTRL_CLASS_CAMERA + 7) #define VIDEO_CID_CAMERA_QUALITY (VIDEO_CTRL_CLASS_CAMERA + 8) +#define VIDEO_CID_CAMERA_HUE (VIDEO_CTRL_CLASS_CAMERA + 9) /** * @} */ From ecd4c430267bdac2c4ca3f0bf91d32da8016df0e Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Tue, 18 Jun 2024 18:11:22 +0200 Subject: [PATCH 0561/4482] drivers: video-controls: Rename colorbar to test pattern Color bar is one type of test patterns. Rename it to VIDEO_CID_CAMERA_TEST_PATTERN to be more generic. Signed-off-by: Phi Bang Nguyen --- drivers/video/ov2640.c | 2 +- include/zephyr/drivers/video-controls.h | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/video/ov2640.c b/drivers/video/ov2640.c index 34038ba0ed3a6..5ebbbeccaab86 100644 --- a/drivers/video/ov2640.c +++ b/drivers/video/ov2640.c @@ -957,7 +957,7 @@ static int ov2640_set_ctrl(const struct device *dev, case VIDEO_CID_CAMERA_CONTRAST: ret |= ov2640_set_contrast(dev, (int)value); break; - case VIDEO_CID_CAMERA_COLORBAR: + case VIDEO_CID_CAMERA_TEST_PATTERN: ret |= ov2640_set_colorbar(dev, (int)value); break; case VIDEO_CID_CAMERA_QUALITY: diff --git a/include/zephyr/drivers/video-controls.h b/include/zephyr/drivers/video-controls.h index facb9857dcf83..e2c24802defea 100644 --- a/include/zephyr/drivers/video-controls.h +++ b/include/zephyr/drivers/video-controls.h @@ -70,16 +70,16 @@ enum video_power_line_frequency { * @name Camera class control IDs * @{ */ -#define VIDEO_CID_CAMERA_EXPOSURE (VIDEO_CTRL_CLASS_CAMERA + 0) -#define VIDEO_CID_CAMERA_GAIN (VIDEO_CTRL_CLASS_CAMERA + 1) -#define VIDEO_CID_CAMERA_ZOOM (VIDEO_CTRL_CLASS_CAMERA + 2) -#define VIDEO_CID_CAMERA_BRIGHTNESS (VIDEO_CTRL_CLASS_CAMERA + 3) -#define VIDEO_CID_CAMERA_SATURATION (VIDEO_CTRL_CLASS_CAMERA + 4) -#define VIDEO_CID_CAMERA_WHITE_BAL (VIDEO_CTRL_CLASS_CAMERA + 5) -#define VIDEO_CID_CAMERA_CONTRAST (VIDEO_CTRL_CLASS_CAMERA + 6) -#define VIDEO_CID_CAMERA_COLORBAR (VIDEO_CTRL_CLASS_CAMERA + 7) -#define VIDEO_CID_CAMERA_QUALITY (VIDEO_CTRL_CLASS_CAMERA + 8) -#define VIDEO_CID_CAMERA_HUE (VIDEO_CTRL_CLASS_CAMERA + 9) +#define VIDEO_CID_CAMERA_EXPOSURE (VIDEO_CTRL_CLASS_CAMERA + 0) +#define VIDEO_CID_CAMERA_GAIN (VIDEO_CTRL_CLASS_CAMERA + 1) +#define VIDEO_CID_CAMERA_ZOOM (VIDEO_CTRL_CLASS_CAMERA + 2) +#define VIDEO_CID_CAMERA_BRIGHTNESS (VIDEO_CTRL_CLASS_CAMERA + 3) +#define VIDEO_CID_CAMERA_SATURATION (VIDEO_CTRL_CLASS_CAMERA + 4) +#define VIDEO_CID_CAMERA_WHITE_BAL (VIDEO_CTRL_CLASS_CAMERA + 5) +#define VIDEO_CID_CAMERA_CONTRAST (VIDEO_CTRL_CLASS_CAMERA + 6) +#define VIDEO_CID_CAMERA_TEST_PATTERN (VIDEO_CTRL_CLASS_CAMERA + 7) +#define VIDEO_CID_CAMERA_QUALITY (VIDEO_CTRL_CLASS_CAMERA + 8) +#define VIDEO_CID_CAMERA_HUE (VIDEO_CTRL_CLASS_CAMERA + 9) /** * @} */ From 865032103b64cc9fcbc1c0c3f96add8ac2441a40 Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Wed, 17 Jul 2024 13:30:46 +0200 Subject: [PATCH 0562/4482] drivers: video: ov5640: Some minor fixes and optimizations Add some minor fixes and optimizations: - Fix coding style - Rename some variables - Use the array variable size directly instead of defining a macro Signed-off-by: Phi Bang Nguyen Signed-off-by: Trung Hieu Le --- drivers/video/ov5640.c | 46 +++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/drivers/video/ov5640.c b/drivers/video/ov5640.c index d5ee05a66b000..c135a34c4006a 100644 --- a/drivers/video/ov5640.c +++ b/drivers/video/ov5640.c @@ -79,8 +79,6 @@ LOG_MODULE_REGISTER(video_ov5640, CONFIG_VIDEO_LOG_LEVEL); #define DEFAULT_MIPI_CHANNEL 0 -#define OV5640_RESOLUTION_PARAM_NUM 24 - struct ov5640_config { struct i2c_dt_spec i2c; struct gpio_dt_spec reset_gpio; @@ -101,14 +99,14 @@ struct ov5640_mipi_clock_config { uint8_t pllCtrl2; }; -struct ov5640_resolution_config { +struct ov5640_mode_config { uint16_t width; uint16_t height; const struct ov5640_reg *res_params; const struct ov5640_mipi_clock_config mipi_pclk; }; -static const struct ov5640_reg ov5640InitParams[] = { +static const struct ov5640_reg init_params[] = { /* Power down */ {SYS_CTRL0_REG, SYS_CTRL0_SW_PWDN}, @@ -323,31 +321,31 @@ static const struct ov5640_reg ov5640InitParams[] = { {0x5000, 0xa7}, }; -static const struct ov5640_reg ov5640_low_res_params[] = { +static const struct ov5640_reg low_res_params[] = { {0x3800, 0x00}, {0x3801, 0x00}, {0x3802, 0x00}, {0x3803, 0x04}, {0x3804, 0x0a}, {0x3805, 0x3f}, {0x3806, 0x07}, {0x3807, 0x9b}, {0x3808, 0x02}, {0x3809, 0x80}, {0x380a, 0x01}, {0x380b, 0xe0}, {0x380c, 0x07}, {0x380d, 0x68}, {0x380e, 0x03}, {0x380f, 0xd8}, {0x3810, 0x00}, {0x3811, 0x10}, {0x3812, 0x00}, {0x3813, 0x06}, {0x3814, 0x31}, {0x3815, 0x31}, {0x3824, 0x02}, {0x460c, 0x22}}; -static const struct ov5640_reg ov5640_720p_res_params[] = { +static const struct ov5640_reg hd_res_params[] = { {0x3800, 0x00}, {0x3801, 0x00}, {0x3802, 0x00}, {0x3803, 0xfa}, {0x3804, 0x0a}, {0x3805, 0x3f}, {0x3806, 0x06}, {0x3807, 0xa9}, {0x3808, 0x05}, {0x3809, 0x00}, {0x380a, 0x02}, {0x380b, 0xd0}, {0x380c, 0x07}, {0x380d, 0x64}, {0x380e, 0x02}, {0x380f, 0xe4}, {0x3810, 0x00}, {0x3811, 0x10}, {0x3812, 0x00}, {0x3813, 0x04}, {0x3814, 0x31}, {0x3815, 0x31}, {0x3824, 0x04}, {0x460c, 0x20}}; -static const struct ov5640_resolution_config resolutionParams[] = { +static const struct ov5640_mode_config modes[] = { {.width = 640, .height = 480, - .res_params = ov5640_low_res_params, + .res_params = low_res_params, .mipi_pclk = { .pllCtrl1 = 0x14, .pllCtrl2 = 0x38, }}, {.width = 1280, .height = 720, - .res_params = ov5640_720p_res_params, + .res_params = hd_res_params, .mipi_pclk = { .pllCtrl1 = 0x21, .pllCtrl2 = 0x54, @@ -460,8 +458,7 @@ static int ov5640_set_fmt(const struct device *dev, enum video_endpoint_id ep, { struct ov5640_data *drv_data = dev->data; const struct ov5640_config *cfg = dev->config; - int ret; - int i; + int ret, i; for (i = 0; i < ARRAY_SIZE(fmts); ++i) { if (fmt->pixelformat == fmts[i].pixelformat && fmt->width >= fmts[i].width_min && @@ -482,12 +479,13 @@ static int ov5640_set_fmt(const struct device *dev, enum video_endpoint_id ep, drv_data->fmt = *fmt; - /* Set resolution parameters */ - for (i = 0; i < ARRAY_SIZE(resolutionParams); i++) { - if (fmt->width == resolutionParams[i].width && - fmt->height == resolutionParams[i].height) { - ret = ov5640_write_multi_regs(&cfg->i2c, resolutionParams[i].res_params, - OV5640_RESOLUTION_PARAM_NUM); + /* Set resolution */ + for (i = 0; i < ARRAY_SIZE(modes); i++) { + if (fmt->width == modes[i].width && fmt->height == modes[i].height) { + ret = ov5640_write_multi_regs(&cfg->i2c, modes[i].res_params, + modes[i].res_params == hd_res_params + ? ARRAY_SIZE(hd_res_params) + : ARRAY_SIZE(low_res_params)); if (ret) { LOG_ERR("Unable to set resolution parameters"); return ret; @@ -496,8 +494,8 @@ static int ov5640_set_fmt(const struct device *dev, enum video_endpoint_id ep, } } - /* Set pixel format, default to VIDEO_PIX_FMT_RGB565 */ - struct ov5640_reg fmt_params[2] = { + /* Set pixel format */ + struct ov5640_reg fmt_params[] = { {0x4300, 0x6f}, {0x501f, 0x01}, }; @@ -515,10 +513,8 @@ static int ov5640_set_fmt(const struct device *dev, enum video_endpoint_id ep, /* Configure MIPI pixel clock */ ret |= ov5640_modify_reg(&cfg->i2c, SC_PLL_CTRL0_REG, 0x0f, 0x08); - ret |= ov5640_modify_reg(&cfg->i2c, SC_PLL_CTRL1_REG, 0xff, - resolutionParams[i].mipi_pclk.pllCtrl1); - ret |= ov5640_modify_reg(&cfg->i2c, SC_PLL_CTRL2_REG, 0xff, - resolutionParams[i].mipi_pclk.pllCtrl2); + ret |= ov5640_modify_reg(&cfg->i2c, SC_PLL_CTRL1_REG, 0xff, modes[i].mipi_pclk.pllCtrl1); + ret |= ov5640_modify_reg(&cfg->i2c, SC_PLL_CTRL2_REG, 0xff, modes[i].mipi_pclk.pllCtrl2); ret |= ov5640_modify_reg(&cfg->i2c, SC_PLL_CTRL3_REG, 0x1f, 0x13); ret |= ov5640_modify_reg(&cfg->i2c, SYS_ROOT_DIV_REG, 0x3f, 0x01); ret |= ov5640_write_reg(&cfg->i2c, PCLK_PERIOD_REG, 0x0a); @@ -642,7 +638,7 @@ static int ov5640_init(const struct device *dev) k_sleep(K_MSEC(5)); /* Initialize register values */ - ret = ov5640_write_multi_regs(&cfg->i2c, ov5640InitParams, ARRAY_SIZE(ov5640InitParams)); + ret = ov5640_write_multi_regs(&cfg->i2c, init_params, ARRAY_SIZE(init_params)); if (ret) { LOG_ERR("Unable to initialize the sensor"); return -EIO; @@ -667,7 +663,7 @@ static int ov5640_init(const struct device *dev) return -ENODEV; } - /* Set default format to 720p RGB565 */ + /* Set default format */ fmt.pixelformat = VIDEO_PIX_FMT_RGB565; fmt.width = 1280; fmt.height = 720; From c1980c2806e84e148cab2437976c500c8101e41b Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Tue, 18 Jun 2024 18:44:29 +0200 Subject: [PATCH 0563/4482] drivers: video: ov5640: Add support for test patterns Add support for 4 test pattern modes: - Color bar - Color bar rolling - Square - Square rolling Signed-off-by: Phi Bang Nguyen --- drivers/video/ov5640.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/video/ov5640.c b/drivers/video/ov5640.c index c135a34c4006a..6394d48d3795f 100644 --- a/drivers/video/ov5640.c +++ b/drivers/video/ov5640.c @@ -35,6 +35,7 @@ LOG_MODULE_REGISTER(video_ov5640, CONFIG_VIDEO_LOG_LEVEL); #define TIMING_TC_REG21_REG 0x3821 #define HZ5060_CTRL01_REG 0x3c01 #define ISP_CTRL01_REG 0x5001 +#define PRE_ISP_TEST_SET1 0x503d #define SC_PLL_CTRL0_REG 0x3034 #define SC_PLL_CTRL1_REG 0x3035 @@ -569,12 +570,43 @@ static int ov5640_stream_stop(const struct device *dev) return ov5640_write_reg(&cfg->i2c, SYS_CTRL0_REG, SYS_CTRL0_SW_PWDN); } +#define TEST_PATTERN_ENABLE BIT(7) +#define TEST_PATTERN_ROLLING BIT(6) +#define TEST_PATTERN_BAR (0 << 0) +#define TEST_PATTERN_SQUARE (2 << 0) + +static const uint8_t test_pattern_val[] = { + 0, + TEST_PATTERN_ENABLE | TEST_PATTERN_BAR | (1 << 2), + TEST_PATTERN_ENABLE | TEST_PATTERN_BAR | (1 << 2) | TEST_PATTERN_ROLLING, + TEST_PATTERN_ENABLE | TEST_PATTERN_SQUARE, + TEST_PATTERN_ENABLE | TEST_PATTERN_SQUARE | TEST_PATTERN_ROLLING, +}; + +static int ov5640_set_ctrl_test_pattern(const struct device *dev, int value) +{ + const struct ov5640_config *cfg = dev->config; + + return ov5640_write_reg(&cfg->i2c, PRE_ISP_TEST_SET1, test_pattern_val[value]); +} + +static int ov5640_set_ctrl(const struct device *dev, unsigned int cid, void *value) +{ + switch (cid) { + case VIDEO_CID_CAMERA_TEST_PATTERN: + return ov5640_set_ctrl_test_pattern(dev, (int)value); + default: + return -ENOTSUP; + } +} + static const struct video_driver_api ov5640_driver_api = { .set_format = ov5640_set_fmt, .get_format = ov5640_get_fmt, .get_caps = ov5640_get_caps, .stream_start = ov5640_stream_start, .stream_stop = ov5640_stream_stop, + .set_ctrl = ov5640_set_ctrl, }; static int ov5640_init(const struct device *dev) From 863b43be469571904c1885a336692e2aad5c5376 Mon Sep 17 00:00:00 2001 From: Farah Fliss Date: Tue, 16 Jul 2024 11:24:06 +0200 Subject: [PATCH 0564/4482] drivers: video: ov5640: Add some controls Add some controls: - hue - saturation - brightness - contrast - gain - hflip - vflip - power line frequency filter - pixel rate (read-only) which is needed for changing frame rate Signed-off-by: Farah Fliss Signed-off-by: Phi Bang Nguyen --- drivers/video/ov5640.c | 220 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 213 insertions(+), 7 deletions(-) diff --git a/drivers/video/ov5640.c b/drivers/video/ov5640.c index 6394d48d3795f..4d5eec5eeeb2d 100644 --- a/drivers/video/ov5640.c +++ b/drivers/video/ov5640.c @@ -7,6 +7,8 @@ #define DT_DRV_COMPAT ovti_ov5640 #include +#include +#include #include #include #include @@ -33,6 +35,7 @@ LOG_MODULE_REGISTER(video_ov5640, CONFIG_VIDEO_LOG_LEVEL); #define SCCB_SYS_CTRL1_REG 0x3103 #define TIMING_TC_REG20_REG 0x3820 #define TIMING_TC_REG21_REG 0x3821 +#define HZ5060_CTRL00_REG 0x3c00 #define HZ5060_CTRL01_REG 0x3c01 #define ISP_CTRL01_REG 0x5001 #define PRE_ISP_TEST_SET1 0x503d @@ -44,13 +47,15 @@ LOG_MODULE_REGISTER(video_ov5640, CONFIG_VIDEO_LOG_LEVEL); #define SYS_ROOT_DIV_REG 0x3108 #define PCLK_PERIOD_REG 0x4837 -#define AEC_CTRL00_REG 0x3a00 -#define AEC_CTRL0F_REG 0x3a0f -#define AEC_CTRL10_REG 0x3a10 -#define AEC_CTRL11_REG 0x3a11 -#define AEC_CTRL1B_REG 0x3a1b -#define AEC_CTRL1E_REG 0x3a1e -#define AEC_CTRL1F_REG 0x3a1f +#define AEC_PK_REAL_GAIN 0x350a +#define AEC_PK_MANUAL 0x3503 +#define AEC_CTRL00_REG 0x3a00 +#define AEC_CTRL0F_REG 0x3a0f +#define AEC_CTRL10_REG 0x3a10 +#define AEC_CTRL11_REG 0x3a11 +#define AEC_CTRL1B_REG 0x3a1b +#define AEC_CTRL1E_REG 0x3a1e +#define AEC_CTRL1F_REG 0x3a1f #define BLC_CTRL01_REG 0x4001 #define BLC_CTRL04_REG 0x4004 @@ -72,14 +77,22 @@ LOG_MODULE_REGISTER(video_ov5640, CONFIG_VIDEO_LOG_LEVEL); #define AWB_CTRL30_REG 0x519e #define SDE_CTRL0_REG 0x5580 +#define SDE_CTRL1_REG 0x5581 +#define SDE_CTRL2_REG 0x5582 #define SDE_CTRL3_REG 0x5583 #define SDE_CTRL4_REG 0x5584 +#define SDE_CTRL5_REG 0x5585 +#define SDE_CTRL6_REG 0x5586 +#define SDE_CTRL7_REG 0x5587 +#define SDE_CTRL8_REG 0x5588 #define SDE_CTRL9_REG 0x5589 #define SDE_CTRL10_REG 0x558a #define SDE_CTRL11_REG 0x558b #define DEFAULT_MIPI_CHANNEL 0 +#define PI 3.141592654 + struct ov5640_config { struct i2c_dt_spec i2c; struct gpio_dt_spec reset_gpio; @@ -88,6 +101,7 @@ struct ov5640_config { struct ov5640_data { struct video_format fmt; + uint64_t cur_pixrate; }; struct ov5640_reg { @@ -587,14 +601,205 @@ static int ov5640_set_ctrl_test_pattern(const struct device *dev, int value) { const struct ov5640_config *cfg = dev->config; + if (!IN_RANGE(value, 0, ARRAY_SIZE(test_pattern_val) - 1)) { + return -EINVAL; + } + return ov5640_write_reg(&cfg->i2c, PRE_ISP_TEST_SET1, test_pattern_val[value]); } +static int ov5640_set_ctrl_hue(const struct device *dev, int value) +{ + const struct ov5640_config *cfg = dev->config; + int cos_coef, sin_coef, sign = 0; + + if (!IN_RANGE(value, 0, 360)) { + return -EINVAL; + } + + double rad_val = value; + int ret = ov5640_modify_reg(&cfg->i2c, SDE_CTRL0_REG, BIT(0), BIT(0)); + + if (ret) { + return ret; + } + + rad_val = value * PI / 180.0; + cos_coef = round(cos(rad_val) * 128); + sin_coef = round(sin(rad_val) * 128); + + if (0 <= value && value < 90) { + sign = 0x01; + } else if (90 <= value && value < 180) { + sign = 0x31; + } else if (180 <= value && value < 270) { + sign = 0x32; + } else if (270 <= value && value < 360) { + sign = 0x02; + } + + struct ov5640_reg hue_params[] = {{SDE_CTRL8_REG, sign}, + {SDE_CTRL1_REG, abs(cos_coef)}, + {SDE_CTRL2_REG, abs(sin_coef)}}; + + return ov5640_write_multi_regs(&cfg->i2c, hue_params, ARRAY_SIZE(hue_params)); +} + +static int ov5640_set_ctrl_saturation(const struct device *dev, int value) +{ + const struct ov5640_config *cfg = dev->config; + + if (!IN_RANGE(value, 0, UINT8_MAX)) { + return -EINVAL; + } + + struct ov5640_reg saturation_params[] = {{SDE_CTRL3_REG, value}, {SDE_CTRL4_REG, value}}; + int ret = ov5640_modify_reg(&cfg->i2c, SDE_CTRL8_REG, BIT(6) | BIT(0), BIT(6) | BIT(0)); + + if (ret) { + return ret; + } + + return ov5640_write_multi_regs(&cfg->i2c, saturation_params, ARRAY_SIZE(saturation_params)); +} + +static int ov5640_set_ctrl_brightness(const struct device *dev, int value) +{ + const struct ov5640_config *cfg = dev->config; + + if (!IN_RANGE(value, -UINT8_MAX, UINT8_MAX)) { + return -EINVAL; + } + + struct ov5640_reg brightness_params[] = {{SDE_CTRL8_REG, value >= 0 ? 0x01 : 0x09}, + {SDE_CTRL7_REG, abs(value) & 0xff}}; + int ret = ov5640_modify_reg(&cfg->i2c, SDE_CTRL0_REG, BIT(2), BIT(2)); + + if (ret) { + return ret; + } + + return ov5640_write_multi_regs(&cfg->i2c, brightness_params, ARRAY_SIZE(brightness_params)); +} + +static int ov5640_set_ctrl_contrast(const struct device *dev, int value) +{ + const struct ov5640_config *cfg = dev->config; + + if (!IN_RANGE(value, 0, UINT8_MAX)) { + return -EINVAL; + } + + int ret = ov5640_modify_reg(&cfg->i2c, SDE_CTRL0_REG, BIT(2), BIT(2)); + + if (ret) { + return ret; + } + + return ov5640_write_reg(&cfg->i2c, SDE_CTRL6_REG, value & 0xff); +} + +static int ov5640_set_ctrl_gain(const struct device *dev, int value) +{ + const struct ov5640_config *cfg = dev->config; + + if (!IN_RANGE(value, 0, UINT16_MAX)) { + return -EINVAL; + } + + if (value) { + int ret = ov5640_modify_reg(&cfg->i2c, AEC_PK_MANUAL, BIT(1), BIT(0)); + + if (ret) { + return ret; + } + + struct ov5640_reg gain_params[] = {{AEC_PK_REAL_GAIN, value >> 8}, + {AEC_PK_REAL_GAIN + 1, value & 0xff}}; + + return ov5640_write_multi_regs(&cfg->i2c, gain_params, ARRAY_SIZE(gain_params)); + } else { + return ov5640_write_reg(&cfg->i2c, AEC_PK_MANUAL, 0); + } +} + +static int ov5640_set_ctrl_hflip(const struct device *dev, int value) +{ + const struct ov5640_config *cfg = dev->config; + + return ov5640_modify_reg(&cfg->i2c, TIMING_TC_REG21_REG, BIT(2) | BIT(1), + value ? 0 : BIT(2) | BIT(1)); +} + +static int ov5640_set_ctrl_vflip(const struct device *dev, int value) +{ + const struct ov5640_config *cfg = dev->config; + + return ov5640_modify_reg(&cfg->i2c, TIMING_TC_REG20_REG, BIT(2) | BIT(1), + value ? BIT(2) | BIT(1) : 0); +} + +static int ov5640_set_ctrl_power_line_freq(const struct device *dev, int value) +{ + const struct ov5640_config *cfg = dev->config; + int ret; + + switch (value) { + case VIDEO_CID_POWER_LINE_FREQUENCY_AUTO: + ret = ov5640_modify_reg(&cfg->i2c, HZ5060_CTRL01_REG, BIT(7), 0); + return ret; + case VIDEO_CID_POWER_LINE_FREQUENCY_50HZ: + ret = ov5640_modify_reg(&cfg->i2c, HZ5060_CTRL00_REG, BIT(2), BIT(2)); + break; + case VIDEO_CID_POWER_LINE_FREQUENCY_60HZ: + ret = ov5640_modify_reg(&cfg->i2c, HZ5060_CTRL00_REG, BIT(2), 0); + break; + default: + return -EINVAL; + } + + if (ret) { + return ret; + } + + return ov5640_modify_reg(&cfg->i2c, HZ5060_CTRL01_REG, BIT(7), BIT(7)); +} + static int ov5640_set_ctrl(const struct device *dev, unsigned int cid, void *value) { switch (cid) { case VIDEO_CID_CAMERA_TEST_PATTERN: return ov5640_set_ctrl_test_pattern(dev, (int)value); + case VIDEO_CID_CAMERA_HUE: + return ov5640_set_ctrl_hue(dev, (int)value); + case VIDEO_CID_CAMERA_SATURATION: + return ov5640_set_ctrl_saturation(dev, (int)(value)); + case VIDEO_CID_CAMERA_BRIGHTNESS: + return ov5640_set_ctrl_brightness(dev, (int)(value)); + case VIDEO_CID_CAMERA_CONTRAST: + return ov5640_set_ctrl_contrast(dev, (int)value); + case VIDEO_CID_CAMERA_GAIN: + return ov5640_set_ctrl_gain(dev, (int)(value)); + case VIDEO_CID_HFLIP: + return ov5640_set_ctrl_hflip(dev, (int)(value)); + case VIDEO_CID_VFLIP: + return ov5640_set_ctrl_vflip(dev, (int)(value)); + case VIDEO_CID_POWER_LINE_FREQUENCY: + return ov5640_set_ctrl_power_line_freq(dev, (int)(value)); + default: + return -ENOTSUP; + } +} + +static inline int ov5640_get_ctrl(const struct device *dev, unsigned int cid, void *value) +{ + struct ov5640_data *drv_data = dev->data; + + switch (cid) { + case VIDEO_CID_PIXEL_RATE: + *((uint64_t *)value) = drv_data->cur_pixrate; + + return 0; default: return -ENOTSUP; } @@ -607,6 +812,7 @@ static const struct video_driver_api ov5640_driver_api = { .stream_start = ov5640_stream_start, .stream_stop = ov5640_stream_stop, .set_ctrl = ov5640_set_ctrl, + .get_ctrl = ov5640_get_ctrl, }; static int ov5640_init(const struct device *dev) From fc90c9f82415858822295869d01c898eab97948b Mon Sep 17 00:00:00 2001 From: Trung Hieu Le Date: Mon, 22 Jul 2024 17:22:13 +0200 Subject: [PATCH 0565/4482] drivers: video: ov5640: Add support for changing frame rate Add support for changing frame rate Signed-off-by: Trung Hieu Le Signed-off-by: Phi Bang Nguyen --- drivers/video/ov5640.c | 181 +++++++++++++++++++++++++++++++++-------- 1 file changed, 147 insertions(+), 34 deletions(-) diff --git a/drivers/video/ov5640.c b/drivers/video/ov5640.c index 4d5eec5eeeb2d..f02b5b3d1dbc8 100644 --- a/drivers/video/ov5640.c +++ b/drivers/video/ov5640.c @@ -93,32 +93,54 @@ LOG_MODULE_REGISTER(video_ov5640, CONFIG_VIDEO_LOG_LEVEL); #define PI 3.141592654 +#define ABS(a, b) (a > b ? a - b : b - a) + +#define PCLK_ROOT_DIV 1 +#define SCLK2X_DIV 1 +#define SCLK_DIV 2 +#define PLL_ROOT_DIV 2 +#define PLL_PRE_DIV 3 +#define MIPI_BIT_MODE 0x08 + +/* Must be kept in ascending order */ +enum ov5640_frame_rate { + OV5640_15_FPS = 15, + OV5640_30_FPS = 30, + OV5640_60_FPS = 60, +}; + struct ov5640_config { struct i2c_dt_spec i2c; struct gpio_dt_spec reset_gpio; struct gpio_dt_spec powerdown_gpio; }; -struct ov5640_data { - struct video_format fmt; - uint64_t cur_pixrate; -}; - struct ov5640_reg { uint16_t addr; uint8_t val; }; -struct ov5640_mipi_clock_config { +struct ov5640_mipi_frmrate_config { + uint8_t frmrate; uint8_t pllCtrl1; uint8_t pllCtrl2; + uint32_t pixelrate; }; struct ov5640_mode_config { uint16_t width; uint16_t height; const struct ov5640_reg *res_params; - const struct ov5640_mipi_clock_config mipi_pclk; + const struct ov5640_mipi_frmrate_config *mipi_frmrate_config; + uint16_t max_frmrate; + uint16_t def_frmrate; +}; + +struct ov5640_data { + struct video_format fmt; + uint64_t cur_pixrate; + uint16_t cur_frmrate; + const struct ov5640_mode_config *cur_mode; }; static const struct ov5640_reg init_params[] = { @@ -350,22 +372,31 @@ static const struct ov5640_reg hd_res_params[] = { {0x380f, 0xe4}, {0x3810, 0x00}, {0x3811, 0x10}, {0x3812, 0x00}, {0x3813, 0x04}, {0x3814, 0x31}, {0x3815, 0x31}, {0x3824, 0x04}, {0x460c, 0x20}}; +static const struct ov5640_mipi_frmrate_config mipi_hd_frmrate_params[] = { + {15, 0x21, 0x2A, 24000000}, {30, 0x21, 0x54, 48000000}, {60, 0x11, 0x54, 96000000}}; + +static const struct ov5640_mipi_frmrate_config mipi_vga_frmrate_params[] = { + {15, 0x22, 0x38, 24000000}, {30, 0x14, 0x38, 24000000}, {60, 0x14, 0x70, 48000000}}; + static const struct ov5640_mode_config modes[] = { - {.width = 640, - .height = 480, - .res_params = low_res_params, - .mipi_pclk = { - .pllCtrl1 = 0x14, - .pllCtrl2 = 0x38, - }}, - {.width = 1280, - .height = 720, - .res_params = hd_res_params, - .mipi_pclk = { - .pllCtrl1 = 0x21, - .pllCtrl2 = 0x54, - }}, -}; + { + .width = 640, + .height = 480, + .res_params = low_res_params, + .mipi_frmrate_config = mipi_vga_frmrate_params, + .max_frmrate = OV5640_60_FPS, + .def_frmrate = OV5640_30_FPS, + }, + { + .width = 1280, + .height = 720, + .res_params = hd_res_params, + .mipi_frmrate_config = mipi_hd_frmrate_params, + .max_frmrate = OV5640_60_FPS, + .def_frmrate = OV5640_30_FPS, + }}; + +static const int ov5640_frame_rates[] = {OV5640_15_FPS, OV5640_30_FPS, OV5640_60_FPS}; #define OV5640_VIDEO_FORMAT_CAP(width, height, format) \ { \ @@ -468,12 +499,62 @@ static int ov5640_write_multi_regs(const struct i2c_dt_spec *spec, const struct return 0; } +static int ov5640_set_frmival(const struct device *dev, enum video_endpoint_id ep, + struct video_frmival *frmival) +{ + const struct ov5640_config *cfg = dev->config; + struct ov5640_data *drv_data = dev->data; + int ret; + uint8_t i, ind = 0; + uint32_t desired_frmrate, best_match = ov5640_frame_rates[ind]; + + desired_frmrate = DIV_ROUND_CLOSEST(frmival->denominator, frmival->numerator); + + /* Find the supported frame rate closest to the desired one */ + for (i = 0; i < ARRAY_SIZE(ov5640_frame_rates); i++) { + if (ov5640_frame_rates[i] <= drv_data->cur_mode->max_frmrate && + ABS(desired_frmrate, ov5640_frame_rates[i]) < + ABS(desired_frmrate, best_match)) { + best_match = ov5640_frame_rates[i]; + ind = i; + } + } + + struct ov5640_reg frmrate_params[] = { + {SC_PLL_CTRL1_REG, drv_data->cur_mode->mipi_frmrate_config[ind].pllCtrl1}, + {SC_PLL_CTRL2_REG, drv_data->cur_mode->mipi_frmrate_config[ind].pllCtrl2}, + {PCLK_PERIOD_REG, 0x0a}}; + + ret = ov5640_write_multi_regs(&cfg->i2c, frmrate_params, ARRAY_SIZE(frmrate_params)); + ret |= ov5640_modify_reg(&cfg->i2c, SC_PLL_CTRL0_REG, 0x0f, MIPI_BIT_MODE); + ret |= ov5640_modify_reg(&cfg->i2c, SC_PLL_CTRL3_REG, 0x1f, + (LOG2CEIL(PLL_ROOT_DIV) << 4) | (PLL_PRE_DIV & 0x07)); + ret |= ov5640_modify_reg(&cfg->i2c, SYS_ROOT_DIV_REG, 0x3f, + (LOG2CEIL(PCLK_ROOT_DIV) & 0x03 << 4) | + (LOG2CEIL(SCLK2X_DIV) & 0x03 << 2) | + (LOG2CEIL(SCLK_DIV) & 0x03)); + + if (ret) { + LOG_ERR("Unable to set frame interval"); + return ret; + } + + drv_data->cur_frmrate = best_match; + drv_data->cur_pixrate = drv_data->cur_mode->mipi_frmrate_config[ind].pixelrate; + + frmival->numerator = 1; + frmival->denominator = best_match; + + return 0; +} + static int ov5640_set_fmt(const struct device *dev, enum video_endpoint_id ep, struct video_format *fmt) { struct ov5640_data *drv_data = dev->data; const struct ov5640_config *cfg = dev->config; int ret, i; + struct video_frmival def_frmival; for (i = 0; i < ARRAY_SIZE(fmts); ++i) { if (fmt->pixelformat == fmts[i].pixelformat && fmt->width >= fmts[i].width_min && @@ -505,6 +586,8 @@ static int ov5640_set_fmt(const struct device *dev, enum video_endpoint_id ep, LOG_ERR("Unable to set resolution parameters"); return ret; } + + drv_data->cur_mode = &modes[i]; break; } } @@ -526,19 +609,11 @@ static int ov5640_set_fmt(const struct device *dev, enum video_endpoint_id ep, return ret; } - /* Configure MIPI pixel clock */ - ret |= ov5640_modify_reg(&cfg->i2c, SC_PLL_CTRL0_REG, 0x0f, 0x08); - ret |= ov5640_modify_reg(&cfg->i2c, SC_PLL_CTRL1_REG, 0xff, modes[i].mipi_pclk.pllCtrl1); - ret |= ov5640_modify_reg(&cfg->i2c, SC_PLL_CTRL2_REG, 0xff, modes[i].mipi_pclk.pllCtrl2); - ret |= ov5640_modify_reg(&cfg->i2c, SC_PLL_CTRL3_REG, 0x1f, 0x13); - ret |= ov5640_modify_reg(&cfg->i2c, SYS_ROOT_DIV_REG, 0x3f, 0x01); - ret |= ov5640_write_reg(&cfg->i2c, PCLK_PERIOD_REG, 0x0a); - if (ret) { - LOG_ERR("Unable to configure MIPI pixel clock"); - return ret; - } + /* Set frame rate */ + def_frmival.denominator = drv_data->cur_mode->def_frmrate; + def_frmival.numerator = 1; - return 0; + return ov5640_set_frmival(dev, ep, &def_frmival); } static int ov5640_get_fmt(const struct device *dev, enum video_endpoint_id ep, @@ -805,6 +880,41 @@ static inline int ov5640_get_ctrl(const struct device *dev, unsigned int cid, vo } } +static int ov5640_get_frmival(const struct device *dev, enum video_endpoint_id ep, + struct video_frmival *frmival) +{ + struct ov5640_data *drv_data = dev->data; + + frmival->numerator = 1; + frmival->denominator = drv_data->cur_frmrate; + + return 0; +} + +static int ov5640_enum_frmival(const struct device *dev, enum video_endpoint_id ep, + struct video_frmival_enum *fie) +{ + uint8_t i = 0; + + for (i = 0; i < ARRAY_SIZE(modes); i++) { + if (fie->format->width == modes[i].width && + fie->format->height == modes[i].height) { + break; + } + } + + if (i == ARRAY_SIZE(modes) || fie->index > ARRAY_SIZE(ov5640_frame_rates) || + ov5640_frame_rates[fie->index] > modes[i].max_frmrate) { + return -EINVAL; + } + + fie->type = VIDEO_FRMIVAL_TYPE_DISCRETE; + fie->discrete.numerator = 1; + fie->discrete.denominator = ov5640_frame_rates[fie->index]; + + return 0; +} + static const struct video_driver_api ov5640_driver_api = { .set_format = ov5640_set_fmt, .get_format = ov5640_get_fmt, @@ -813,6 +923,9 @@ static const struct video_driver_api ov5640_driver_api = { .stream_stop = ov5640_stream_stop, .set_ctrl = ov5640_set_ctrl, .get_ctrl = ov5640_get_ctrl, + .set_frmival = ov5640_set_frmival, + .get_frmival = ov5640_get_frmival, + .enum_frmival = ov5640_enum_frmival, }; static int ov5640_init(const struct device *dev) From 27456ed2b57f0114cc976d9d74b98c9762818ca3 Mon Sep 17 00:00:00 2001 From: Dmitrii Golovanov Date: Tue, 8 Oct 2024 21:53:39 +0200 Subject: [PATCH 0566/4482] twister: blackbox: coverage: fix matching pattern Fix the expected pattern randomly matched to coverage.json contents ordered differently at test_coverage_basedir(). Signed-off-by: Dmitrii Golovanov --- scripts/tests/twister_blackbox/test_coverage.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/tests/twister_blackbox/test_coverage.py b/scripts/tests/twister_blackbox/test_coverage.py index c1bf926abb452..667dc4b940f8f 100644 --- a/scripts/tests/twister_blackbox/test_coverage.py +++ b/scripts/tests/twister_blackbox/test_coverage.py @@ -47,7 +47,7 @@ class TestCoverage: 'coverage.log', 'coverage.json', 'coverage' ], - r'{"files": \[], "gcovr/format_version": ".*"}' + r'{"files": \[\], "gcovr/format_version": ".*"}' ), ] TESTDATA_4 = [ @@ -244,7 +244,7 @@ def test_coverage_basedir(self, capfd, test_path, test_platforms, out_path, file with open(path, "r") as json_file: json_content = json.load(json_file) pattern = re.compile(expected_content) - assert pattern.match(json.dumps(json_content)) + assert pattern.match(json.dumps(json_content, sort_keys=True)) if os.path.exists(base_dir): os.rmdir(base_dir) From 4eb415e3179978fdc5686e7124d7c00e022415d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Wed, 9 Oct 2024 17:22:01 +0200 Subject: [PATCH 0567/4482] doc: extensions: conditionally includes css/js assets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only add js/css needed for live code sample search to the pages that actually need it. Signed-off-by: Benjamin Cabé --- doc/_extensions/zephyr/domain/__init__.py | 24 ++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/doc/_extensions/zephyr/domain/__init__.py b/doc/_extensions/zephyr/domain/__init__.py index e60e9404aa393..ddc7e0efafd09 100644 --- a/doc/_extensions/zephyr/domain/__init__.py +++ b/doc/_extensions/zephyr/domain/__init__.py @@ -319,6 +319,8 @@ def run(self, **kwargs: Any) -> None: matcher = NodeMatcher(CodeSampleListingNode) for node in self.document.traverse(matcher): + self.env.domaindata["zephyr"]["has_code_sample_listing"][self.env.docname] = True + code_samples_categories = self.env.domaindata["zephyr"]["code-samples-categories"] code_samples_categories_tree = self.env.domaindata["zephyr"][ "code-samples-categories-tree" @@ -582,6 +584,8 @@ class ZephyrDomain(Domain): "code-samples": {}, # id -> code sample data "code-samples-categories": {}, # id -> code sample category data "code-samples-categories-tree": Node("samples"), + # keep track of documents containing special directives + "has_code_sample_listing": {}, # docname -> bool } def clear_doc(self, docname: str) -> None: @@ -599,6 +603,8 @@ def clear_doc(self, docname: str) -> None: # TODO clean up the anytree as well + self.data["has_code_sample_listing"].pop(docname, None) + def merge_domaindata(self, docnames: List[str], otherdata: Dict) -> None: self.data["code-samples"].update(otherdata["code-samples"]) self.data["code-samples-categories"].update(otherdata["code-samples-categories"]) @@ -616,6 +622,10 @@ def merge_domaindata(self, docnames: List[str], otherdata: Dict) -> None: category.category["docname"], ) + for docname in docnames: + self.data["has_code_sample_listing"][docname] = otherdata[ + "has_code_sample_listing" + ].get(docname, False) def get_objects(self): for _, code_sample in self.data["code-samples"].items(): yield ( @@ -743,14 +753,14 @@ def compute_sample_categories_hierarchy(app: Sphinx, env: BuildEnvironment) -> N code_sample["category"] = node.category["id"] -def install_codesample_livesearch( - app: Sphinx, pagename: str, templatename: str, context: dict[str, Any], event_arg: Any +def install_static_assets_as_needed( + app: Sphinx, pagename: str, templatename: str, context: dict[str, Any], doctree: nodes.Node ) -> None: - # TODO only add the CSS/JS if the page contains a code sample listing - # As these resources are really small, it's not a big deal to include them on every page for now - app.add_css_file("css/codesample-livesearch.css") - app.add_js_file("js/codesample-livesearch.js") + if app.env.domaindata["zephyr"]["has_code_sample_listing"].get(pagename, False): + app.add_css_file("css/codesample-livesearch.css") + app.add_js_file("js/codesample-livesearch.js") + if app.env.domaindata["zephyr"]["has_board_catalog"].get(pagename, False): def setup(app): app.add_config_value("zephyr_breathe_insert_related_samples", False, "env") @@ -768,7 +778,7 @@ def setup(app): "builder-inited", (lambda app: app.config.html_static_path.append(RESOURCES_DIR.as_posix())), ) - app.connect("html-page-context", install_codesample_livesearch) + app.connect("html-page-context", install_static_assets_as_needed) app.connect("env-updated", compute_sample_categories_hierarchy) # monkey-patching of the DoxygenGroupDirective From f2f149615601b7ae27147f3e372cb22da9e660f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Wed, 9 Oct 2024 17:26:58 +0200 Subject: [PATCH 0568/4482] doc: Introduce boards catalog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds support for generating an interactive catalog of all the supported boards that can be included in the documentation using the `.. zephyr:board-catalog::` directive. Signed-off-by: Benjamin Cabé --- boards/index.rst | 18 +- doc/_extensions/zephyr/domain/__init__.py | 42 +++- .../domain/static/css/board-catalog.css | 214 ++++++++++++++++++ .../zephyr/domain/static/js/board-catalog.js | 111 +++++++++ .../zephyr/domain/templates/board-card.html | 26 +++ .../domain/templates/board-catalog.html | 60 +++++ doc/_scripts/gen_boards_catalog.py | 127 +++++++++++ doc/contribute/documentation/guidelines.rst | 8 + 8 files changed, 599 insertions(+), 7 deletions(-) create mode 100644 doc/_extensions/zephyr/domain/static/css/board-catalog.css create mode 100644 doc/_extensions/zephyr/domain/static/js/board-catalog.js create mode 100644 doc/_extensions/zephyr/domain/templates/board-card.html create mode 100644 doc/_extensions/zephyr/domain/templates/board-catalog.html create mode 100644 doc/_scripts/gen_boards_catalog.py diff --git a/boards/index.rst b/boards/index.rst index 77814350d9ed2..f159f80b80eea 100644 --- a/boards/index.rst +++ b/boards/index.rst @@ -1,24 +1,30 @@ .. _boards: -Supported Boards -################ - -Zephyr project developers are continually adding board-specific support as -documented below. +Supported Boards and Shields +############################ If you are looking to add Zephyr support for a new board, please start with the :ref:`board_porting_guide`. -When adding support documentation for each board, remember to use the template +When adding support documentation for a board, remember to use the template available under :zephyr_file:`doc/templates/board.tmpl`. +Shields are hardware add-ons that can be stacked on top of a board to add extra +functionality. They are listed separately from boards, towards :ref:`the end of +this page `. + +Use the interactive search form below to quickly navigate through the list of +supported boards. .. toctree:: :maxdepth: 2 :glob: + :hidden: */index +.. zephyr:board-catalog:: + .. _boards-shields: Shields diff --git a/doc/_extensions/zephyr/domain/__init__.py b/doc/_extensions/zephyr/domain/__init__.py index ddc7e0efafd09..f9a0038a36893 100644 --- a/doc/_extensions/zephyr/domain/__init__.py +++ b/doc/_extensions/zephyr/domain/__init__.py @@ -14,6 +14,7 @@ - ``zephyr:code-sample::`` - Defines a code sample. - ``zephyr:code-sample-category::`` - Defines a category for grouping code samples. - ``zephyr:code-sample-listing::`` - Shows a listing of code samples found in a given category. +- ``zephyr:board-catalog::`` - Show a listing of boards supported by Zephyr. Roles ----- @@ -23,9 +24,10 @@ """ +import sys from os import path from pathlib import Path -from typing import Any, Dict, Iterator, List, Tuple +from typing import Any, Dict, Iterator, List, Tuple, Final from docutils import nodes from docutils.parsers.rst import Directive, directives @@ -42,6 +44,7 @@ from sphinx.util.docutils import SphinxDirective, switch_source_input from sphinx.util.nodes import NodeMatcher, make_refnode from sphinx.util.parsing import nested_parse_to_nodes +from sphinx.util.template import SphinxRenderer from zephyr.doxybridge import DoxygenGroupDirective from zephyr.gh_utils import gh_link_get_url @@ -53,6 +56,14 @@ __version__ = "0.2.0" +ZEPHYR_BASE = Path(__file__).parents[4] + +sys.path.insert(0, str(ZEPHYR_BASE / "scripts/dts/python-devicetree/src")) +sys.path.insert(0, str(Path(__file__).parents[3] / "_scripts")) + +from gen_boards_catalog import get_catalog + +TEMPLATES_DIR = Path(__file__).parent / "templates" RESOURCES_DIR = Path(__file__).parent / "static" logger = logging.getLogger(__name__) @@ -558,6 +569,25 @@ def run(self): return [code_sample_listing_node] +class BoardCatalogDirective(SphinxDirective): + has_content = False + required_arguments = 0 + optional_arguments = 0 + + def run(self): + if self.env.app.builder.format == "html": + self.env.domaindata["zephyr"]["has_board_catalog"][self.env.docname] = True + + # As it is not expected that more than one board-catalog directive is used across + # the documentation, and since the generation is only taking a few seconds, we don't + # store the catalog in the domain data. It might change in the future if the generation + # becomes more expensive. + board_catalog = get_catalog() + renderer = SphinxRenderer([TEMPLATES_DIR]) + rendered = renderer.render("board-catalog.html", {"catalog": board_catalog}) + return [nodes.raw("", rendered, format="html")] + + class ZephyrDomain(Domain): """Zephyr domain""" @@ -573,6 +603,7 @@ class ZephyrDomain(Domain): "code-sample": CodeSampleDirective, "code-sample-listing": CodeSampleListingDirective, "code-sample-category": CodeSampleCategoryDirective, + "board-catalog": BoardCatalogDirective, } object_types: Dict[str, ObjType] = { @@ -586,6 +617,7 @@ class ZephyrDomain(Domain): "code-samples-categories-tree": Node("samples"), # keep track of documents containing special directives "has_code_sample_listing": {}, # docname -> bool + "has_board_catalog": {}, # docname -> bool } def clear_doc(self, docname: str) -> None: @@ -604,6 +636,7 @@ def clear_doc(self, docname: str) -> None: # TODO clean up the anytree as well self.data["has_code_sample_listing"].pop(docname, None) + self.data["has_board_catalog"].pop(docname, None) def merge_domaindata(self, docnames: List[str], otherdata: Dict) -> None: self.data["code-samples"].update(otherdata["code-samples"]) @@ -626,6 +659,10 @@ def merge_domaindata(self, docnames: List[str], otherdata: Dict) -> None: self.data["has_code_sample_listing"][docname] = otherdata[ "has_code_sample_listing" ].get(docname, False) + self.data["has_board_catalog"][docname] = otherdata["has_board_catalog"].get( + docname, False + ) + def get_objects(self): for _, code_sample in self.data["code-samples"].items(): yield ( @@ -761,6 +798,9 @@ def install_static_assets_as_needed( app.add_js_file("js/codesample-livesearch.js") if app.env.domaindata["zephyr"]["has_board_catalog"].get(pagename, False): + app.add_css_file("css/board-catalog.css") + app.add_js_file("js/board-catalog.js") + def setup(app): app.add_config_value("zephyr_breathe_insert_related_samples", False, "env") diff --git a/doc/_extensions/zephyr/domain/static/css/board-catalog.css b/doc/_extensions/zephyr/domain/static/css/board-catalog.css new file mode 100644 index 0000000000000..96a2b86728d32 --- /dev/null +++ b/doc/_extensions/zephyr/domain/static/css/board-catalog.css @@ -0,0 +1,214 @@ +/** + * Copyright (c) 2024, The Linux Foundation. + * SPDX-License-Identifier: Apache-2.0 + */ + +.hidden { + display: none !important; +} + +.filter-form { + display: flex; + flex-wrap: wrap; + gap: 10px; + margin-bottom: 20px; +} + +.filter-form input, +.filter-form select { + appearance: none; + font-family: var(--system-font-family); + font-size: 14px; + border-radius: 50px; + padding: 10px 18px; + flex: 1 1 200px; + background-color: var(--input-background-color); + color: var(--body-color); + transition: all 0.3s ease; + box-shadow: none; +} + +.filter-form input:focus .filter-form select:focus { + border-color: var(--input-focus-border-color); +} +.select-container { + flex: 1 1 200px; + position: relative; +} + +.select-container::after { + content: "\25BC"; + position: absolute; + right: 20px; + top: 50%; + transform: translateY(-50%); + pointer-events: none; + font-size: 14px; + color: var(--body-color); +} + +.filter-form select { + padding-right: 40px; + width: 100%; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; +} + +#catalog { + display: flex; + flex-wrap: wrap; + gap: 20px; + justify-content: center; + margin-top: 20px; + margin-bottom: 40px; +} + +.board-card { + flex: 1 1 calc(33.3% - 20px); + /* Three cards per row */ + max-width: calc(33.3% - 20px); + border-radius: 8px; + padding: 15px 20px; + background-color: var(--admonition-note-background-color); + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + display: flex; + flex-direction: column; + align-items: center; + transition: transform 0.3s ease; +} + +.board-card:hover, +.board-card:focus { + box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15); + transform: translateY(-5px); + text-decoration: none; +} + +.board-card .picture { + width: auto; + height: auto; + min-height: 100px; + max-height: 180px; + border-radius: 4px; + margin: 0 auto; + display: flex; + align-items: center; + flex-grow: 1; + padding: 10px 0px; +} + +.board-card .no-picture { + font-size: 5em; + color: var(--admonition-note-title-background-color); + justify-content: center; +} + +.board-card .vendor { + font-size: 12px; + color: var(--admonition-note-color); + font-weight: 900; + margin-bottom: 18px; + opacity: 0.5; +} + +.board-card img { + max-height: 100%; + max-width: 100%; + object-fit: contain; +} + +.board-card .board-name { + font-family: var(--header-font-family); + margin: auto 0 5px; + text-align: center; + font-size: 18px; + font-weight: 500; + color: var(--body-color); + padding-top: 10px; +} + +.board-card .arch { + margin: 5px 0; + text-align: center; + font-size: 12px; + font-weight: 100; + color: var(--body-color); +} + +@media (max-width: 1024px) { + .board-card { + flex: 1 1 calc(50% - 20px); + max-width: calc(50% - 20px); + } +} + +@media (max-width: 768px) { + .board-card { + flex: 1 1 calc(100% - 20px); + max-width: calc(100% - 20px); + } + + .board-card .picture { + min-height: 60px; + max-height: 120px; + } +} + +#form-options .btn { + font-size: 14px; +} + +#form-options .btn:focus { + outline-color: var(--body-color) !important; +} + +#catalog.compact { + display: block; + list-style-type: disc; + margin: 20px; +} + +#catalog.compact .board-card { + display: list-item; + padding: 4px 0; + border: none; + background-color: transparent; + box-shadow: none; + list-style-position: outside; + max-width: none; +} + +#catalog.compact .board-card .vendor, +#catalog.compact .board-card .picture { + display: none; +} + +#catalog.compact .board-card .board-name { + display: inline; + font-family: var(--system-font-family); + text-align: left; + font-size: 16px; + font-weight: normal; + color: var(--body-color); + margin: 0; + padding: 0; +} + +#catalog.compact .board-card .arch { + display: inline; +} + +#catalog.compact .board-card .arch::before { + content: " ("; +} + +#catalog.compact .board-card .arch::after { + content: ")"; +} + +#catalog.compact .board-card:hover { + box-shadow: none; + transform: none; + text-decoration: underline; +} \ No newline at end of file diff --git a/doc/_extensions/zephyr/domain/static/js/board-catalog.js b/doc/_extensions/zephyr/domain/static/js/board-catalog.js new file mode 100644 index 0000000000000..82103c6bb3458 --- /dev/null +++ b/doc/_extensions/zephyr/domain/static/js/board-catalog.js @@ -0,0 +1,111 @@ +/** + * Copyright (c) 2024, The Linux Foundation. + * SPDX-License-Identifier: Apache-2.0 + */ + +function toggleDisplayMode(btn) { + const catalog = document.getElementById("catalog"); + catalog.classList.toggle("compact"); + btn.classList.toggle("fa-bars"); + btn.classList.toggle("fa-th"); + btn.textContent = catalog.classList.contains("compact") + ? " Switch to Card View" + : " Switch to Compact View"; +} + +function populateFormFromURL() { + const params = ["name", "arch", "vendor"]; + const hashParams = new URLSearchParams(window.location.hash.slice(1)); + params.forEach((param) => { + const element = document.getElementById(param); + if (hashParams.has(param)) { + element.value = hashParams.get(param); + } + }); + + filterBoards(); +} + +function updateURL() { + const params = ["name", "arch", "vendor"]; + const hashParams = new URLSearchParams(window.location.hash.slice(1)); + + params.forEach((param) => { + const value = document.getElementById(param).value; + value ? hashParams.set(param, value) : hashParams.delete(param); + }); + + window.history.replaceState({}, "", `#${hashParams.toString()}`); +} + +document.addEventListener("DOMContentLoaded", function () { + updateBoardCount(); + populateFormFromURL(); + + const form = document.querySelector(".filter-form"); + + // sort vendors alphabetically + vendorSelect = document.getElementById("vendor"); + vendorOptions = Array.from(vendorSelect.options).slice(1); + vendorOptions.sort((a, b) => a.text.localeCompare(b.text)); + while (vendorSelect.options.length > 1) { + vendorSelect.remove(1); + } + vendorOptions.forEach((option) => { + vendorSelect.appendChild(option); + }); + + form.addEventListener("submit", function (event) { + event.preventDefault(); + }); + + form.addEventListener("input", function () { + filterBoards(); + updateURL(); + }); +}); + +function updateBoardCount() { + const boards = document.getElementsByClassName("board-card"); + const visibleBoards = Array.from(boards).filter( + (board) => !board.classList.contains("hidden") + ).length; + const totalBoards = boards.length; + document.getElementById("nb-matches").textContent = `Showing ${visibleBoards} of ${totalBoards}`; +} + +function filterBoards() { + const nameInput = document.getElementById("name").value.toLowerCase(); + const archSelect = document.getElementById("arch").value; + const vendorSelect = document.getElementById("vendor").value; + + const resetFiltersBtn = document.getElementById("reset-filters"); + if (nameInput || archSelect || vendorSelect) { + resetFiltersBtn.classList.remove("btn-disabled"); + } else { + resetFiltersBtn.classList.add("btn-disabled"); + } + + const boards = document.getElementsByClassName("board-card"); + + Array.from(boards).forEach(function (board) { + const boardName = board.getAttribute("data-name").toLowerCase(); + const boardArchs = board.getAttribute("data-arch").split(" "); + const boardVendor = board.getAttribute("data-vendor"); + + let matches = true; + + matches = + !(nameInput && !boardName.includes(nameInput)) && + !(archSelect && !boardArchs.includes(archSelect)) && + !(vendorSelect && boardVendor !== vendorSelect); + + if (matches) { + board.classList.remove("hidden"); + } else { + board.classList.add("hidden"); + } + }); + + updateBoardCount(); +} diff --git a/doc/_extensions/zephyr/domain/templates/board-card.html b/doc/_extensions/zephyr/domain/templates/board-card.html new file mode 100644 index 0000000000000..c2a829bb8dbe6 --- /dev/null +++ b/doc/_extensions/zephyr/domain/templates/board-card.html @@ -0,0 +1,26 @@ +{# + Copyright (c) 2024, The Linux Foundation. + SPDX-License-Identifier: Apache-2.0 +#} + + +
{{ catalog.vendors[board.vendor] }}
+ {% if board.image %} + A picture of the {{ board.name }} board + {% else %} +
+ {% endif %} +
{{ board.full_name }}
+
{{ board.archs | join(", ") }}
+
diff --git a/doc/_extensions/zephyr/domain/templates/board-catalog.html b/doc/_extensions/zephyr/domain/templates/board-catalog.html new file mode 100644 index 0000000000000..cac5a7093f2c9 --- /dev/null +++ b/doc/_extensions/zephyr/domain/templates/board-catalog.html @@ -0,0 +1,60 @@ +{# + Copyright (c) 2024, The Linux Foundation. + SPDX-License-Identifier: Apache-2.0 +#} + +
+ +
+ +
+
+ +
+
+ +
+ + +
+ +
+ +
+ {% for board_name, board in catalog.boards | items | sort(attribute='1.full_name') %} + {% include "board-card.html" %} + {% endfor %} +
diff --git a/doc/_scripts/gen_boards_catalog.py b/doc/_scripts/gen_boards_catalog.py new file mode 100644 index 0000000000000..7f233f83c6067 --- /dev/null +++ b/doc/_scripts/gen_boards_catalog.py @@ -0,0 +1,127 @@ +# Copyright (c) 2024 The Linux Foundation +# SPDX-License-Identifier: Apache-2.0 + +import logging +from collections import namedtuple +from pathlib import Path + +import list_boards +import pykwalify +import yaml +import zephyr_module +from gen_devicetree_rest import VndLookup + +ZEPHYR_BASE = Path(__file__).parents[2] + +logger = logging.getLogger(__name__) + +def guess_file_from_patterns(directory, patterns, name, extensions): + for pattern in patterns: + for ext in extensions: + matching_file = next(directory.glob(pattern.format(name=name, ext=ext)), None) + if matching_file: + return matching_file + return None + + +def guess_image(board_or_shield): + img_exts = ["jpg", "jpeg", "webp", "png"] + patterns = [ + "**/{name}.{ext}", + "**/*{name}*.{ext}", + "**/*.{ext}", + ] + img_file = guess_file_from_patterns( + board_or_shield.dir, patterns, board_or_shield.name, img_exts + ) + return (Path("../_images") / img_file.name).as_posix() if img_file else "" + + +def guess_doc_page(board_or_shield): + patterns = [ + "doc/index.{ext}", + "**/{name}.{ext}", + "**/*{name}*.{ext}", + "**/*.{ext}", + ] + doc_file = guess_file_from_patterns( + board_or_shield.dir, patterns, board_or_shield.name, ["rst"] + ) + return doc_file + + +def get_catalog(): + pykwalify.init_logging(1) + + vnd_lookup = VndLookup(ZEPHYR_BASE / "dts/bindings/vendor-prefixes.txt", []) + + module_settings = { + "arch_root": [ZEPHYR_BASE], + "board_root": [ZEPHYR_BASE], + "soc_root": [ZEPHYR_BASE], + } + + for module in zephyr_module.parse_modules(ZEPHYR_BASE): + for key in module_settings: + root = module.meta.get("build", {}).get("settings", {}).get(key) + if root is not None: + module_settings[key].append(Path(module.project) / root) + + Args = namedtuple("args", ["arch_roots", "board_roots", "soc_roots", "board_dir", "board"]) + args_find_boards = Args( + arch_roots=module_settings["arch_root"], + board_roots=module_settings["board_root"], + soc_roots=module_settings["soc_root"], + board_dir=ZEPHYR_BASE / "boards", + board=None, + ) + + boards = list_boards.find_v2_boards(args_find_boards) + board_catalog = {} + + for board in boards: + # We could use board.vendor but it is often incorrect. Instead, deduce vendor from + # containing folder + for folder in board.dir.parents: + if vnd_lookup.vnd2vendor.get(folder.name): + vendor = folder.name + break + + # Grab all the twister files for this board and use them to figure out all the archs it + # supports. + archs = set() + pattern = f"{board.name}*.yaml" + for twister_file in board.dir.glob(pattern): + try: + with open(twister_file, "r") as f: + board_data = yaml.safe_load(f) + archs.add(board_data.get("arch")) + except Exception as e: + logger.error(f"Error parsing twister file {twister_file}: {e}") + + full_name = board.full_name + doc_page = guess_doc_page(board) + + if not full_name: + # If full commercial name of the board is not available through board.full_name, we look + # for the title in the board's documentation page. + # /!\ This is a temporary solution until #79571 sets all the full names in the boards + if doc_page: + with open(doc_page, "r") as f: + lines = f.readlines() + for i, line in enumerate(lines): + if line.startswith("#"): + full_name = lines[i - 1].strip() + break + else: + full_name = board.name + + board_catalog[board.name] = { + "full_name": full_name, + "doc_page": doc_page.relative_to(ZEPHYR_BASE).as_posix() if doc_page else None, + "vendor": vendor, + "archs": list(archs), + "image": guess_image(board), + } + + return {"boards": board_catalog, "vendors": vnd_lookup.vnd2vendor} diff --git a/doc/contribute/documentation/guidelines.rst b/doc/contribute/documentation/guidelines.rst index dbf0f6b89ff64..6012d3230ea8c 100644 --- a/doc/contribute/documentation/guidelines.rst +++ b/doc/contribute/documentation/guidelines.rst @@ -1180,3 +1180,11 @@ Code samples A flag to include a search box right above the listing. The search box allows users to filter the listing by code sample name/description, which can be useful for categories with a large number of samples. This option is only available in the HTML builder. + +Boards +====== + +.. rst:directive:: .. zephyr:board-catalog:: + + This directive is used to generate a catalog of Zephyr-supported boards that can be used to + quickly browse the list of all supported boards and filter them according to various criteria. From e45ab126eac5b5ed3851d7225c498edeab89c28c Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Mon, 8 Jul 2024 14:38:47 +1000 Subject: [PATCH 0569/4482] zbus: optional publishing statistics Add optional statistics around the channel publishing action. Store the time a channel was last published to, and a total publish count. This information can be used to determine how old a given channels data is, and an average channel publishing frequency. Signed-off-by: Jordan Yates --- include/zephyr/zbus/zbus.h | 90 ++++++++++++++++++++++++++++++++++++++ subsys/zbus/Kconfig | 3 ++ subsys/zbus/zbus.c | 5 +++ 3 files changed, 98 insertions(+) diff --git a/include/zephyr/zbus/zbus.h b/include/zephyr/zbus/zbus.h index 84dc8afdecd3b..4eb247ad5eb04 100644 --- a/include/zephyr/zbus/zbus.h +++ b/include/zephyr/zbus/zbus.h @@ -62,6 +62,13 @@ struct zbus_channel_data { */ struct net_buf_pool *msg_subscriber_pool; #endif /* ZBUS_MSG_SUBSCRIBER_NET_BUF_POOL_ISOLATION */ + +#if defined(CONFIG_ZBUS_CHANNEL_PUBLISH_STATS) || defined(__DOXYGEN__) + /** Kernel timestamp of the last publish action on this channel */ + k_ticks_t publish_timestamp; + /** Number of times data has been published to this channel */ + uint32_t publish_count; +#endif /* CONFIG_ZBUS_CHANNEL_PUBLISH_STATS */ }; /** @@ -722,6 +729,89 @@ static inline void zbus_chan_set_msg_sub_pool(const struct zbus_channel *chan, #endif /* ZBUS_MSG_SUBSCRIBER_NET_BUF_POOL_ISOLATION */ +#if defined(CONFIG_ZBUS_CHANNEL_PUBLISH_STATS) || defined(__DOXYGEN__) + +/** + * @brief Update the publishing statistics for a channel + * + * This function updates the publishing statistics for the @ref zbus_chan_claim -> + * @ref zbus_chan_finish workflow, which cannot automatically determine whether + * new data has been published or not. + * + * @warning This function must only be used directly for already locked channels. + * + * @param chan The channel's reference. + */ +static inline void zbus_chan_pub_stats_update(const struct zbus_channel *chan) +{ + __ASSERT(chan != NULL, "chan is required"); + + chan->data->publish_timestamp = k_uptime_ticks(); + chan->data->publish_count += 1; +} + +/** + * @brief Get the time a channel was last published to. + * + * @note Will return 0 if channel has not yet been published to. + * + * @param chan The channel's reference. + * + * @return The kernel timestamp of the last publishing action. + */ +static inline k_ticks_t zbus_chan_pub_stats_last_time(const struct zbus_channel *chan) +{ + __ASSERT(chan != NULL, "chan is required"); + + return chan->data->publish_timestamp; +} + +/** + * @brief Get the number of times a channel has been published to. + * + * @note Will return 0 if channel has not yet been published to. + * + * @param chan The channel's reference. + * + * @return The number of times a channel has been published to. + */ +static inline uint32_t zbus_chan_pub_stats_count(const struct zbus_channel *chan) +{ + __ASSERT(chan != NULL, "chan is required"); + + return chan->data->publish_count; +} + +/** + * @brief Get the average period between publishes to a channel. + * + * @note Will return 0 if channel has not yet been published to. + * + * @param chan The channel's reference. + * + * @return Average duration in milliseconds between publishes. + */ +static inline uint32_t zbus_chan_pub_stats_avg_period(const struct zbus_channel *chan) +{ + __ASSERT(chan != NULL, "chan is required"); + + /* Not yet published, period = 0ms */ + if (chan->data->publish_count == 0) { + return 0; + } + /* Average period across application runtime */ + return k_uptime_get() / chan->data->publish_count; +} + +#else + +static inline void zbus_chan_pub_stats_update(const struct zbus_channel *chan) +{ + (void)chan; +} + +#endif /* CONFIG_ZBUS_CHANNEL_PUBLISH_STATS */ + #if defined(CONFIG_ZBUS_RUNTIME_OBSERVERS) || defined(__DOXYGEN__) /** diff --git a/subsys/zbus/Kconfig b/subsys/zbus/Kconfig index 2f7040cf2fc3a..8f742b8bd99c0 100644 --- a/subsys/zbus/Kconfig +++ b/subsys/zbus/Kconfig @@ -19,6 +19,9 @@ config ZBUS_CHANNEL_NAME config ZBUS_OBSERVER_NAME bool "Observer name field" +config ZBUS_CHANNEL_PUBLISH_STATS + bool "Channel publishing statistics (Timestamp and count)" + config ZBUS_MSG_SUBSCRIBER select NET_BUF bool "Message subscribers will receive all messages in sequence." diff --git a/subsys/zbus/zbus.c b/subsys/zbus/zbus.c index b55c8498ad418..78f8ce99fd4e3 100644 --- a/subsys/zbus/zbus.c +++ b/subsys/zbus/zbus.c @@ -355,6 +355,11 @@ int zbus_chan_pub(const struct zbus_channel *chan, const void *msg, k_timeout_t return err; } +#if defined(CONFIG_ZBUS_CHANNEL_PUBLISH_STATS) + chan->data->publish_timestamp = k_uptime_ticks(); + chan->data->publish_count += 1; +#endif /* CONFIG_ZBUS_CHANNEL_PUBLISH_STATS */ + memcpy(chan->message, msg, chan->message_size); err = _zbus_vded_exec(chan, end_time); From 865f88c8038d062c5facd7c86152de7b81bc5f77 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Mon, 8 Jul 2024 15:03:33 +1000 Subject: [PATCH 0570/4482] tests: zbus: publish_stats: test publishing statistics Test the new publishing statistics functions. Signed-off-by: Jordan Yates --- .../subsys/zbus/publish_stats/CMakeLists.txt | 8 ++ tests/subsys/zbus/publish_stats/prj.conf | 5 ++ tests/subsys/zbus/publish_stats/src/main.c | 79 +++++++++++++++++++ tests/subsys/zbus/publish_stats/testcase.yaml | 5 ++ 4 files changed, 97 insertions(+) create mode 100644 tests/subsys/zbus/publish_stats/CMakeLists.txt create mode 100644 tests/subsys/zbus/publish_stats/prj.conf create mode 100644 tests/subsys/zbus/publish_stats/src/main.c create mode 100644 tests/subsys/zbus/publish_stats/testcase.yaml diff --git a/tests/subsys/zbus/publish_stats/CMakeLists.txt b/tests/subsys/zbus/publish_stats/CMakeLists.txt new file mode 100644 index 0000000000000..f8396c7ce8a0d --- /dev/null +++ b/tests/subsys/zbus/publish_stats/CMakeLists.txt @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(test_publish_stats) + +FILE(GLOB app_sources src/main.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/subsys/zbus/publish_stats/prj.conf b/tests/subsys/zbus/publish_stats/prj.conf new file mode 100644 index 0000000000000..ab6c8e834c028 --- /dev/null +++ b/tests/subsys/zbus/publish_stats/prj.conf @@ -0,0 +1,5 @@ +CONFIG_ZTEST=y +CONFIG_ASSERT=y +CONFIG_LOG=y +CONFIG_ZBUS=y +CONFIG_ZBUS_CHANNEL_PUBLISH_STATS=y diff --git a/tests/subsys/zbus/publish_stats/src/main.c b/tests/subsys/zbus/publish_stats/src/main.c new file mode 100644 index 0000000000000..86143e707ac17 --- /dev/null +++ b/tests/subsys/zbus/publish_stats/src/main.c @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2024 Embeint Inc + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +struct msg { + int x; +}; + +ZBUS_CHAN_DEFINE(chan, struct msg, NULL, NULL, ZBUS_OBSERVERS_EMPTY, ZBUS_MSG_INIT(0)); + +ZTEST(publish_stats, test_channel_metadata) +{ + k_ticks_t clock_window = CONFIG_SYS_CLOCK_TICKS_PER_SEC / 20; /* Accept +- 50ms */ + struct msg *cval, val = {0}; + k_ticks_t pub_time; + + /* Application boot, no publishes */ + zassert_equal(0, zbus_chan_pub_stats_count(&chan)); + zassert_equal(0, zbus_chan_pub_stats_last_time(&chan)); + zassert_equal(0, zbus_chan_pub_stats_avg_period(&chan)); + + /* Should be no different after a second of runtime */ + k_sleep(K_SECONDS(1)); + zassert_equal(0, zbus_chan_pub_stats_count(&chan)); + zassert_equal(0, zbus_chan_pub_stats_last_time(&chan)); + zassert_equal(0, zbus_chan_pub_stats_avg_period(&chan)); + + /* Normal publish */ + zassert_equal(0, zbus_chan_pub(&chan, &val, K_NO_WAIT)); + zassert_equal(1, zbus_chan_pub_stats_count(&chan)); + zassert_within(k_uptime_ticks(), zbus_chan_pub_stats_last_time(&chan), clock_window); + zassert_within(1000, zbus_chan_pub_stats_avg_period(&chan), 50); + + /* Push 4 times in quick succession, wait for 2 second boundary */ + for (int i = 0; i < 4; i++) { + zassert_equal(0, zbus_chan_pub(&chan, &val, K_NO_WAIT)); + pub_time = k_uptime_ticks(); + } + k_sleep(K_TIMEOUT_ABS_MS(2000)); + zassert_equal(5, zbus_chan_pub_stats_count(&chan)); + zassert_within(pub_time, zbus_chan_pub_stats_last_time(&chan), clock_window); + zassert_within(400, zbus_chan_pub_stats_avg_period(&chan), 50); + + /* Channel claim and finish does not update metadata by default */ + zassert_equal(0, zbus_chan_claim(&chan, K_NO_WAIT)); + zassert_equal(0, zbus_chan_finish(&chan)); + + zassert_equal(0, zbus_chan_claim(&chan, K_NO_WAIT)); + cval = zbus_chan_msg(&chan); + cval->x = 1000; + zassert_equal(0, zbus_chan_finish(&chan)); + zassert_equal(5, zbus_chan_pub_stats_count(&chan)); + zassert_within(pub_time, zbus_chan_pub_stats_last_time(&chan), clock_window); + + /* Channel notify does not update metadata */ + for (int i = 0; i < 10; i++) { + zassert_equal(0, zbus_chan_notify(&chan, K_NO_WAIT)); + } + zassert_equal(5, zbus_chan_pub_stats_count(&chan)); + zassert_within(pub_time, zbus_chan_pub_stats_last_time(&chan), clock_window); + + /* Manually update publish statistics with claim */ + zassert_equal(0, zbus_chan_claim(&chan, K_NO_WAIT)); + zbus_chan_pub_stats_update(&chan); + pub_time = k_uptime_ticks(); + zassert_equal(0, zbus_chan_finish(&chan)); + + k_sleep(K_TIMEOUT_ABS_MS(3000)); + zassert_equal(6, zbus_chan_pub_stats_count(&chan)); + zassert_within(pub_time, zbus_chan_pub_stats_last_time(&chan), clock_window); + zassert_within(500, zbus_chan_pub_stats_avg_period(&chan), 50); +} + +ZTEST_SUITE(publish_stats, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/subsys/zbus/publish_stats/testcase.yaml b/tests/subsys/zbus/publish_stats/testcase.yaml new file mode 100644 index 0000000000000..6f138bc40b660 --- /dev/null +++ b/tests/subsys/zbus/publish_stats/testcase.yaml @@ -0,0 +1,5 @@ +tests: + message_bus.zbus.publish_stats: + tags: zbus + integration_platforms: + - native_sim From 80db01f3bfeb5302b51d78375be17a1889cdca01 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 8 Oct 2024 21:42:26 +0530 Subject: [PATCH 0571/4482] drivers: nrfwifi: Fix random MAC address setting Random MAC address setting can never be configured as the two defaults cover all cases. Fix the defaults, now the order is * Fixed * OTP (default, in case of no config) * Random Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/Kconfig.nrfwifi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/wifi/nrfwifi/Kconfig.nrfwifi b/drivers/wifi/nrfwifi/Kconfig.nrfwifi index 3096dd7c76edd..d86049eb6f022 100644 --- a/drivers/wifi/nrfwifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrfwifi/Kconfig.nrfwifi @@ -496,8 +496,8 @@ config WIFI_FIXED_MAC_ADDRESS choice prompt "Wi-Fi MAC address type" - default WIFI_OTP_MAC_ADDRESS if WIFI_FIXED_MAC_ADDRESS = "" default WIFI_FIXED_MAC_ADDRESS_ENABLED if WIFI_FIXED_MAC_ADDRESS != "" + default WIFI_OTP_MAC_ADDRESS help Select the type of MAC address to be used by the Wi-Fi driver From 18e568d5c79796589e1439aae2127fcde92f683b Mon Sep 17 00:00:00 2001 From: Fabrice DJIATSA Date: Tue, 8 Oct 2024 17:20:42 +0200 Subject: [PATCH 0572/4482] boards : st: add U0 boards images to documentation add references to images of boards already present in the index.rst files (for nucleo_u083rc, nucleo_u031r8, stm32u083c_dk) so that they can be displayed in the documentation. Signed-off-by: Fabrice DJIATSA --- boards/st/nucleo_u031r8/doc/index.rst | 6 ++++++ boards/st/nucleo_u083rc/doc/index.rst | 6 ++++++ boards/st/stm32u083c_dk/doc/index.rst | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/boards/st/nucleo_u031r8/doc/index.rst b/boards/st/nucleo_u031r8/doc/index.rst index c9c327ad0922a..57c278f52bbab 100644 --- a/boards/st/nucleo_u031r8/doc/index.rst +++ b/boards/st/nucleo_u031r8/doc/index.rst @@ -29,6 +29,12 @@ board: - Two push-buttons: USER and RESET - USB Type-C |reg| connector for the ST-LINK +.. image:: img/nucleo_u031r8.jpg + :align: center + :alt: Nucleo U031R8 + +More information about the board can be found at the `NUCLEO_U031R8 website`_. + Hardware ******** diff --git a/boards/st/nucleo_u083rc/doc/index.rst b/boards/st/nucleo_u083rc/doc/index.rst index e71e36ee8edb1..36329ac8dd30d 100644 --- a/boards/st/nucleo_u083rc/doc/index.rst +++ b/boards/st/nucleo_u083rc/doc/index.rst @@ -29,6 +29,12 @@ board: - Two push-buttons: USER and RESET - USB Type-C |reg| connector for the ST-LINK +.. image:: img/nucleo_u083rc.jpg + :align: center + :alt: Nucleo U083RC + +More information about the board can be found at the `NUCLEO_U083RC website`_. + Hardware ******** diff --git a/boards/st/stm32u083c_dk/doc/index.rst b/boards/st/stm32u083c_dk/doc/index.rst index 8d70934de6360..7b8b74de9169d 100644 --- a/boards/st/stm32u083c_dk/doc/index.rst +++ b/boards/st/stm32u083c_dk/doc/index.rst @@ -36,6 +36,12 @@ board: - Touchkey - Temperature sensor +.. image:: img/stm32u083c_dk.jpg + :align: center + :alt: STM32U083C_DK + +More information about the board can be found at the `STM32U083_DK website`_. + Hardware ******** From 371d4adb06d12c3a00f45a25f79abcc6cb4d869e Mon Sep 17 00:00:00 2001 From: Fabrice DJIATSA Date: Tue, 8 Oct 2024 11:47:38 +0200 Subject: [PATCH 0573/4482] drivers: mipi_dbi: update macro to get address DT_REG_ADDR now generates an unsigned string terminated with U which doesn't match the way the macros is used in a CONCAT to build a FMC_BANK1_(1/2/3) define that is defined in hal. `DT_REG_ADDR_RAW` should now be used to get the RAW FMC bank index Signed-off-by: Fabrice DJIATSA --- drivers/mipi_dbi/mipi_dbi_stm32_fmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mipi_dbi/mipi_dbi_stm32_fmc.c b/drivers/mipi_dbi/mipi_dbi_stm32_fmc.c index 19c34ea50102c..b6580a6efd7a6 100644 --- a/drivers/mipi_dbi/mipi_dbi_stm32_fmc.c +++ b/drivers/mipi_dbi/mipi_dbi_stm32_fmc.c @@ -178,7 +178,8 @@ static struct mipi_dbi_driver_api mipi_dbi_stm32_fmc_driver_api = { .write_display = mipi_dbi_stm32_fmc_write_display, }; -#define MIPI_DBI_FMC_GET_ADDRESS(n) _CONCAT(FMC_BANK1_, UTIL_INC(DT_REG_ADDR(DT_INST_PARENT(n)))) +#define MIPI_DBI_FMC_GET_ADDRESS(n) _CONCAT(FMC_BANK1_, \ + UTIL_INC(DT_REG_ADDR_RAW(DT_INST_PARENT(n)))) #define MIPI_DBI_FMC_GET_DATA_ADDRESS(n) \ MIPI_DBI_FMC_GET_ADDRESS(n) + (1 << (DT_INST_PROP(n, register_select_pin) + 1)) From de93f956221c616da402850009b2fc16e5b2574f Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Tue, 8 Oct 2024 11:02:49 +0200 Subject: [PATCH 0574/4482] boards: native: Add display to native board features Add a 'display' entry for the native sim/posix supported features. Signed-off-by: Pieter De Gendt --- boards/native/native_posix/native_posix.yaml | 1 + boards/native/native_posix/native_posix_native_64.yaml | 1 + boards/native/native_sim/native_sim.yaml | 1 + boards/native/native_sim/native_sim_native_64.yaml | 1 + 4 files changed, 4 insertions(+) diff --git a/boards/native/native_posix/native_posix.yaml b/boards/native/native_posix/native_posix.yaml index d3ba08cc9a62b..428cc3807bcae 100644 --- a/boards/native/native_posix/native_posix.yaml +++ b/boards/native/native_posix/native_posix.yaml @@ -11,6 +11,7 @@ toolchain: supported: - can - counter + - display - dma - eeprom - netif:eth diff --git a/boards/native/native_posix/native_posix_native_64.yaml b/boards/native/native_posix/native_posix_native_64.yaml index f7081ced878d6..ae4ca0460d8da 100644 --- a/boards/native/native_posix/native_posix_native_64.yaml +++ b/boards/native/native_posix/native_posix_native_64.yaml @@ -11,6 +11,7 @@ toolchain: supported: - can - counter + - display - dma - eeprom - netif:eth diff --git a/boards/native/native_sim/native_sim.yaml b/boards/native/native_sim/native_sim.yaml index 0a563c868811c..bd131a43af79f 100644 --- a/boards/native/native_sim/native_sim.yaml +++ b/boards/native/native_sim/native_sim.yaml @@ -11,6 +11,7 @@ toolchain: supported: - can - counter + - display - dma - eeprom - netif:eth diff --git a/boards/native/native_sim/native_sim_native_64.yaml b/boards/native/native_sim/native_sim_native_64.yaml index 535cf513658a7..0377e3f9b9594 100644 --- a/boards/native/native_sim/native_sim_native_64.yaml +++ b/boards/native/native_sim/native_sim_native_64.yaml @@ -11,6 +11,7 @@ toolchain: supported: - can - counter + - display - dma - eeprom - netif:eth From 1c630f066193a7bb3b7dc4b530e7976b7583da89 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Tue, 8 Oct 2024 11:29:12 +0200 Subject: [PATCH 0575/4482] boards: nxp: mimxrt1170_evk: Add display support for cortex m7 Add a 'display' entry to NXP's mimxrt1170 EVK supported features. Signed-off-by: Pieter De Gendt --- boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7.yaml b/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7.yaml index 05eabe8136c4b..a29807defa522 100644 --- a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7.yaml +++ b/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7.yaml @@ -18,6 +18,7 @@ supported: - adc - counter - can + - display - dma - gpio - hwinfo From 23871f6ecba7e8f630788197f0cf754da625ed21 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Tue, 8 Oct 2024 11:21:26 +0200 Subject: [PATCH 0576/4482] tests: drivers: build_all: display: Add coverage Make display tests depend on the "display" feature. And add a testcase as example. Signed-off-by: Pieter De Gendt --- tests/drivers/build_all/display/testcase.yaml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/drivers/build_all/display/testcase.yaml b/tests/drivers/build_all/display/testcase.yaml index e692e607c6af4..ef0c16120c252 100644 --- a/tests/drivers/build_all/display/testcase.yaml +++ b/tests/drivers/build_all/display/testcase.yaml @@ -1,10 +1,18 @@ common: + build_only: true tags: - drivers - display - build_only: true - platform_allow: - - native_posix - - native_sim + depends_on: display + tests: - drivers.display.default: {} + drivers.display.build.default: + integration_platforms: + - native_sim + - native_sim/native/64 + + drivers.display.build.rk055hdmipi4ma0: + platform_allow: + - mimxrt1170_evk/mimxrt1176/cm7 + extra_args: + - SHIELD=rk055hdmipi4ma0 From 838ff13fe2d6e0ec7e289efd7908d429e6e57d23 Mon Sep 17 00:00:00 2001 From: Maochen Wang Date: Tue, 8 Oct 2024 17:19:56 +0800 Subject: [PATCH 0577/4482] hostap: fix other STA failed to connect to SAP The format of wpa_passphrase and sae_password is wrong when start the SAP, which leads the invaild MIC check error when other STA try to connect in security mode. Change the wrong format can fix this issue. Signed-off-by: Maochen Wang --- modules/hostap/src/supp_api.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index 3c6140fb3e65b..d7425900b9351 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -1444,7 +1444,7 @@ int hapd_config_network(struct hostapd_iface *iface, if (!hostapd_cli_cmd_v("set wpa_key_mgmt WPA-PSK")) { goto out; } - if (!hostapd_cli_cmd_v("set wpa_passphrase \"%s\"", params->psk)) { + if (!hostapd_cli_cmd_v("set wpa_passphrase %s", params->psk)) { goto out; } if (!hostapd_cli_cmd_v("set wpa_pairwise CCMP")) { @@ -1457,7 +1457,7 @@ int hapd_config_network(struct hostapd_iface *iface, if (!hostapd_cli_cmd_v("set wpa_key_mgmt WPA-PSK")) { goto out; } - if (!hostapd_cli_cmd_v("set wpa_passphrase \"%s\"", params->psk)) { + if (!hostapd_cli_cmd_v("set wpa_passphrase %s", params->psk)) { goto out; } if (!hostapd_cli_cmd_v("set rsn_pairwise CCMP")) { @@ -1470,7 +1470,7 @@ int hapd_config_network(struct hostapd_iface *iface, if (!hostapd_cli_cmd_v("set wpa_key_mgmt WPA-PSK-SHA256")) { goto out; } - if (!hostapd_cli_cmd_v("set wpa_passphrase \"%s\"", params->psk)) { + if (!hostapd_cli_cmd_v("set wpa_passphrase %s", params->psk)) { goto out; } if (!hostapd_cli_cmd_v("set rsn_pairwise CCMP")) { @@ -1483,7 +1483,7 @@ int hapd_config_network(struct hostapd_iface *iface, if (!hostapd_cli_cmd_v("set wpa_key_mgmt SAE")) { goto out; } - if (!hostapd_cli_cmd_v("set sae_password \"%s\"", + if (!hostapd_cli_cmd_v("set sae_password %s", params->sae_password ? params->sae_password : params->psk)) { goto out; From 9487952a4fd054ccb47a7b26fb071a744fc6c59d Mon Sep 17 00:00:00 2001 From: Maochen Wang Date: Tue, 8 Oct 2024 17:16:01 +0800 Subject: [PATCH 0578/4482] net: fix build error in DPP struct Fix build error in DPP struct when building Matter over Wi-Fi. The struct declaration must be done outside of the anonymous union. Only struct definition can be done inside the anonymous union. Signed-off-by: Maochen Wang --- include/zephyr/net/wifi_mgmt.h | 134 +++++++++++++++++++-------------- 1 file changed, 76 insertions(+), 58 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 3ba33aaed4499..5323b0d5a5c9e 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -947,6 +947,76 @@ enum wifi_dpp_bootstrap_type { WIFI_DPP_BOOTSTRAP_TYPE_NFC_URI }; +/** Params to add DPP configurator */ +struct wifi_dpp_configurator_add_params { + /** ECP curves for private key */ + int curve; + /** ECP curves for net access key */ + int net_access_key_curve; +}; + +/** Params to initiate a DPP auth procedure */ +struct wifi_dpp_auth_init_params { + /** Peer bootstrap id */ + int peer; + /** Configuration parameter id */ + int configurator; + /** Role configurator or enrollee */ + int role; + /** Security type */ + int conf; + /** SSID in string */ + char ssid[WIFI_SSID_MAX_LEN + 1]; +}; + +/** Params to do DPP chirp */ +struct wifi_dpp_chirp_params { + /** Own bootstrap id */ + int id; + /** Chirp on frequency */ + int freq; +}; + +/** Params to do DPP listen */ +struct wifi_dpp_listen_params { + /** Listen on frequency */ + int freq; + /** Role configurator or enrollee */ + int role; +}; + +/** Params to generate a DPP bootstrap */ +struct wifi_dpp_bootstrap_gen_params { + /** Bootstrap type */ + int type; + /** Own operating class */ + int op_class; + /** Own working channel */ + int chan; + /** ECP curves */ + int curve; + /** Own mac address */ + uint8_t mac[WIFI_MAC_ADDR_LEN]; +}; + +/** Params to set specific DPP configurator */ +struct wifi_dpp_configurator_set_params { + /** Peer bootstrap id */ + int peer; + /** Configuration parameter id */ + int configurator; + /** Role configurator or enrollee */ + int role; + /** Security type */ + int conf; + /** ECP curves for private key */ + int curve; + /** ECP curves for net access key */ + int net_access_key_curve; + /** Own mac address */ + char ssid[WIFI_SSID_MAX_LEN + 1]; +}; + /** Wi-Fi DPP params for various operations */ struct wifi_dpp_params { @@ -954,69 +1024,17 @@ struct wifi_dpp_params { int action; union { /** Params to add DPP configurator */ - struct wifi_dpp_configurator_add_params { - /** ECP curves for private key */ - int curve; - /** ECP curves for net access key */ - int net_access_key_curve; - } configurator_add; + struct wifi_dpp_configurator_add_params configurator_add; /** Params to initiate a DPP auth procedure */ - struct wifi_dpp_auth_init_params { - /** Peer bootstrap id */ - int peer; - /** Configuration parameter id */ - int configurator; - /** Role configurator or enrollee */ - int role; - /** Security type */ - int conf; - /** SSID in string */ - char ssid[WIFI_SSID_MAX_LEN + 1]; - } auth_init; + struct wifi_dpp_auth_init_params auth_init; /** Params to do DPP chirp */ - struct wifi_dpp_chirp_params { - /** Own bootstrap id */ - int id; - /** Chirp on frequency */ - int freq; - } chirp; + struct wifi_dpp_chirp_params chirp; /** Params to do DPP listen */ - struct wifi_dpp_listen_params { - /** Listen on frequency */ - int freq; - /** Role configurator or enrollee */ - int role; - } listen; + struct wifi_dpp_listen_params listen; /** Params to generate a DPP bootstrap */ - struct wifi_dpp_bootstrap_gen_params { - /** Bootstrap type */ - int type; - /** Own operating class */ - int op_class; - /** Own working channel */ - int chan; - /** ECP curves */ - int curve; - /** Own mac address */ - uint8_t mac[WIFI_MAC_ADDR_LEN]; - } bootstrap_gen; + struct wifi_dpp_bootstrap_gen_params bootstrap_gen; /** Params to set specific DPP configurator */ - struct wifi_dpp_configurator_set_params { - /** Peer bootstrap id */ - int peer; - /** Configuration parameter id */ - int configurator; - /** Role configurator or enrollee */ - int role; - /** Security type */ - int conf; - /** ECP curves for private key */ - int curve; - /** ECP curves for net access key */ - int net_access_key_curve; - /** Own mac address */ - char ssid[WIFI_SSID_MAX_LEN + 1]; - } configurator_set; + struct wifi_dpp_configurator_set_params configurator_set; /** Bootstrap get uri id */ int id; /** Timeout for DPP frame response rx */ From f712bde1220d1d4618858ea131d9adc50a1c1ab3 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Fri, 4 Oct 2024 11:02:13 +0200 Subject: [PATCH 0579/4482] bluetooth: host: att: Implement disconnect on ATT timeout The timeout state is local and can block new ATT operations, but does not affect the remote side. Disconnecting the GATT connection upon ATT timeout simplifies error handling for developers. This reduces rare failure conditions to a common one, without needing special cases for ATT timeouts. Signed-off-by: Pavel Vasilyev --- doc/connectivity/bluetooth/bluetooth-le-host.rst | 13 +++++++++++++ doc/connectivity/bluetooth/img/att_timeout.svg | 1 + doc/releases/release-notes-4.0.rst | 2 ++ subsys/bluetooth/host/att.c | 13 ++++++++++++- 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 doc/connectivity/bluetooth/img/att_timeout.svg diff --git a/doc/connectivity/bluetooth/bluetooth-le-host.rst b/doc/connectivity/bluetooth/bluetooth-le-host.rst index 3fad342568165..567961bc6495d 100644 --- a/doc/connectivity/bluetooth/bluetooth-le-host.rst +++ b/doc/connectivity/bluetooth/bluetooth-le-host.rst @@ -274,6 +274,19 @@ over LE connections. A more detailed description of this layer and the API reference can be found in the :ref:`GATT API reference section `. +ATT timeout +----------- + +If the peer device does not respond to an ATT request (such as read or write) +within the ATT timeout, the host will automatically initiate a disconnect. This +simplifies error handling by reducing rare failure conditions to a common +disconnection, allowing developers to manage unexpected disconnects without +special cases for ATT timeouts. + +.. image:: img/att_timeout.svg + :align: center + :alt: ATT timeout + Mesh ==== diff --git a/doc/connectivity/bluetooth/img/att_timeout.svg b/doc/connectivity/bluetooth/img/att_timeout.svg new file mode 100644 index 0000000000000..8b1f2832b6ed4 --- /dev/null +++ b/doc/connectivity/bluetooth/img/att_timeout.svg @@ -0,0 +1 @@ +participant%20App%0Aparticipant%20Host%0Aparticipant%20Peer%0A%0AApp%20-%3E%20Host%3A%20bt_gatt_read(cb)%0A%0A%0A%0AHost%20-%3E%20Peer%3A%20ATT_READ_REQ%0Aactivate%20Host%0Aspace%20-4.1%0Aaboxright%20left%20of%20Host%3A%200%20seconds%20%20%0Aspace%20-2.8%0APeer%20-x%20Host%3A%20ATT_READ_RSP%0Aaboxright%20left%20of%20Host%3A%2030%20seconds%20%20%0Aspace%20-5.4%0AHost%20-%3E%20Host%3A%20bt_conn_disconnect%0Aspace%20-2.8%0Adeactivate%20HostAppHostPeerbt_gatt_read(cb)ATT_READ_REQ0 seconds  ATT_READ_RSP30 seconds  bt_conn_disconnect \ No newline at end of file diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 38953b1b30ecf..1eeb182a42da5 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -108,6 +108,8 @@ Bluetooth * Added API :c:func:`bt_gatt_get_uatt_mtu` to get current Unenhanced ATT MTU of a given connection (experimental). + * The host now disconnects from the peer upon ATT timeout. + * HCI Drivers Boards & SoC Support diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index 5ecb86ce7ef02..c9872aebc6789 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -3135,9 +3135,10 @@ static void att_timeout(struct k_work *work) struct k_work_delayable *dwork = k_work_delayable_from_work(work); struct bt_att_chan *chan = CONTAINER_OF(dwork, struct bt_att_chan, timeout_work); + int err; bt_addr_le_to_str(bt_conn_get_dst(chan->att->conn), addr, sizeof(addr)); - LOG_ERR("ATT Timeout for device %s", addr); + LOG_ERR("ATT Timeout for device %s. Disconnecting...", addr); /* BLUETOOTH SPECIFICATION Version 4.2 [Vol 3, Part F] page 480: * @@ -3148,6 +3149,16 @@ static void att_timeout(struct k_work *work) * target device on this ATT Bearer. */ bt_att_disconnected(&chan->chan.chan); + + /* The timeout state is local and can block new ATT operations, but does not affect the + * remote side. Disconnecting the GATT connection upon ATT timeout simplifies error handling + * for developers. This reduces rare failure conditions to a common one, allowing developers + * to handle unexpected disconnections without needing special cases for ATT timeouts. + */ + err = bt_conn_disconnect(chan->chan.chan.conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN); + if (err) { + LOG_ERR("Disconnecting failed (err %d)", err); + } } static struct bt_att_chan *att_get_fixed_chan(struct bt_conn *conn) From f7e8a8717b1e64b7a295d4c0563e22563d29be0e Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Tue, 8 Oct 2024 07:48:19 +0200 Subject: [PATCH 0580/4482] tests: bsim: bluetooth: host: att: Add ATT timeout test This commit tests that the host correctly disconnects from peer when ATT timeout happens. Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/att_internal.h | 3 +- tests/bsim/bluetooth/host/att/compile.sh | 1 + .../bluetooth/host/att/timeout/CMakeLists.txt | 24 ++ .../bluetooth/host/att/timeout/compile.sh | 14 + tests/bsim/bluetooth/host/att/timeout/main.c | 292 ++++++++++++++++++ .../bsim/bluetooth/host/att/timeout/prj.conf | 25 ++ .../host/att/timeout/test_scripts/run.sh | 22 ++ 7 files changed, 380 insertions(+), 1 deletion(-) create mode 100644 tests/bsim/bluetooth/host/att/timeout/CMakeLists.txt create mode 100755 tests/bsim/bluetooth/host/att/timeout/compile.sh create mode 100644 tests/bsim/bluetooth/host/att/timeout/main.c create mode 100644 tests/bsim/bluetooth/host/att/timeout/prj.conf create mode 100755 tests/bsim/bluetooth/host/att/timeout/test_scripts/run.sh diff --git a/subsys/bluetooth/host/att_internal.h b/subsys/bluetooth/host/att_internal.h index 7898dcedb748d..6eec4c5496e1b 100644 --- a/subsys/bluetooth/host/att_internal.h +++ b/subsys/bluetooth/host/att_internal.h @@ -10,7 +10,8 @@ #define BT_EATT_PSM 0x27 #define BT_ATT_DEFAULT_LE_MTU 23 -#define BT_ATT_TIMEOUT K_SECONDS(30) +#define BT_ATT_TIMEOUT_SEC 30 +#define BT_ATT_TIMEOUT K_SECONDS(BT_ATT_TIMEOUT_SEC) /* Local ATT Rx MTU * diff --git a/tests/bsim/bluetooth/host/att/compile.sh b/tests/bsim/bluetooth/host/att/compile.sh index 46fddfa1419c1..e6e25cf9c295a 100755 --- a/tests/bsim/bluetooth/host/att/compile.sh +++ b/tests/bsim/bluetooth/host/att/compile.sh @@ -22,5 +22,6 @@ run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/host/att/sequential/compil run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/host/att/pipeline/compile.sh run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/host/att/long_read/compile.sh run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/host/att/open_close/compile.sh +run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/host/att/timeout/compile.sh wait_for_background_jobs diff --git a/tests/bsim/bluetooth/host/att/timeout/CMakeLists.txt b/tests/bsim/bluetooth/host/att/timeout/CMakeLists.txt new file mode 100644 index 0000000000000..66b7d8796c3e8 --- /dev/null +++ b/tests/bsim/bluetooth/host/att/timeout/CMakeLists.txt @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) +project(app) + +add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/common/testlib testlib) + +target_sources(app PRIVATE + ../long_read/bs_main.c + ../long_read/bs_sync.c + main.c +) + +zephyr_include_directories( + ${BSIM_COMPONENTS_PATH}/libPhyComv1/src/ + ${BSIM_COMPONENTS_PATH}/libUtilv1/src/ + ../long_read/ +) + +target_link_libraries(app PRIVATE + testlib +) diff --git a/tests/bsim/bluetooth/host/att/timeout/compile.sh b/tests/bsim/bluetooth/host/att/timeout/compile.sh new file mode 100755 index 0000000000000..b7b1eea135e73 --- /dev/null +++ b/tests/bsim/bluetooth/host/att/timeout/compile.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# Copyright 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +set -eu +: "${ZEPHYR_BASE:?ZEPHYR_BASE must be defined}" + +INCR_BUILD=1 + +source ${ZEPHYR_BASE}/tests/bsim/compile.source + +app="$(guess_test_relpath)" compile + +wait_for_background_jobs diff --git a/tests/bsim/bluetooth/host/att/timeout/main.c b/tests/bsim/bluetooth/host/att/timeout/main.c new file mode 100644 index 0000000000000..322dd20d9bad6 --- /dev/null +++ b/tests/bsim/bluetooth/host/att/timeout/main.c @@ -0,0 +1,292 @@ +/* Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "host/att_internal.h" + +#include "testlib/adv.h" +#include "testlib/att_read.h" +#include "testlib/att_write.h" +#include "bs_macro.h" +#include "bs_sync.h" +#include +#include "testlib/log_utils.h" +#include "testlib/scan.h" +#include "testlib/security.h" + +/* This test uses system asserts to fail tests. */ +BUILD_ASSERT(__ASSERT_ON); + +LOG_MODULE_REGISTER(main, LOG_LEVEL_DBG); + +#define CENTRAL_DEVICE_NBR 0 +#define PERIPHERAL_DEVICE_NBR 1 + +#define UUID_1 \ + BT_UUID_DECLARE_128(0xdb, 0x1f, 0xe2, 0x52, 0xf3, 0xc6, 0x43, 0x66, 0xb3, 0x92, 0x5d, \ + 0xc6, 0xe7, 0xc9, 0x59, 0x9d) + +#define UUID_2 \ + BT_UUID_DECLARE_128(0x3f, 0xa4, 0x7f, 0x44, 0x2e, 0x2a, 0x43, 0x05, 0xab, 0x38, 0x07, \ + 0x8d, 0x16, 0xbf, 0x99, 0xf1) + +static bool trigger_att_timeout; +static K_SEM_DEFINE(disconnected_sem, 0, 1); + +static ssize_t read_chrc(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, + uint16_t buf_len, uint16_t offset) +{ + ssize_t read_len; + + LOG_INF("ATT timeout will %sbe triggered", trigger_att_timeout ? "" : "not "); + + if (trigger_att_timeout) { + /* Sleep longer than ATT Timeout (section 3.3.3). */ + k_sleep(K_SECONDS(BT_ATT_TIMEOUT_SEC + 1)); + } + + __ASSERT_NO_MSG(offset == 0); + read_len = buf_len; + + __ASSERT_NO_MSG(read_len >= 2); + sys_put_le16(read_len, buf); + + return read_len; +} + +static struct bt_gatt_attr attrs[] = { + BT_GATT_PRIMARY_SERVICE(UUID_1), + BT_GATT_CHARACTERISTIC(UUID_2, BT_GATT_CHRC_READ, BT_GATT_PERM_READ, read_chrc, NULL, NULL), +}; + +static struct bt_gatt_service svc = { + .attrs = attrs, + .attr_count = ARRAY_SIZE(attrs), +}; + +static void bs_sync_all_log(char *log_msg) +{ + /* Everyone meets here. */ + bt_testlib_bs_sync_all(); + + if (get_device_nbr() == 0) { + LOG_WRN("Sync point: %s", log_msg); + } + + /* Everyone waits for d0 to finish logging. */ + bt_testlib_bs_sync_all(); +} + +static inline void bt_enable_quiet(void) +{ + bt_testlib_log_level_set("bt_hci_core", LOG_LEVEL_ERR); + bt_testlib_log_level_set("bt_id", LOG_LEVEL_ERR); + + EXPECT_ZERO(bt_enable(NULL)); + + bt_testlib_log_level_set("bt_hci_core", LOG_LEVEL_INF); + bt_testlib_log_level_set("bt_id", LOG_LEVEL_INF); +} + +static struct bt_conn *peripheral_setup(enum bt_att_chan_opt bearer, bool timeout) +{ + struct bt_conn *conn = NULL; + + EXPECT_ZERO(bt_testlib_adv_conn(&conn, BT_ID_DEFAULT, bt_get_name())); + + trigger_att_timeout = timeout; + + return conn; +} + +static struct bt_conn *central_setup(enum bt_att_chan_opt bearer, bool timeout) +{ + bt_addr_le_t adva; + struct bt_conn *conn = NULL; + + EXPECT_ZERO(bt_testlib_scan_find_name(&adva, "peripheral")); + EXPECT_ZERO(bt_testlib_connect(&adva, &conn)); + + /* Establish EATT bearers. */ + EXPECT_ZERO(bt_testlib_secure(conn, BT_SECURITY_L2)); + + while (bt_eatt_count(conn) == 0) { + k_msleep(100); + }; + + return conn; +} + +static void central_read(struct bt_conn *conn, enum bt_att_chan_opt bearer, bool timeout) +{ + uint16_t actual_read_len; + uint16_t remote_read_send_len; + uint16_t handle = 0; + int err; + + NET_BUF_SIMPLE_DEFINE(attr_value, sizeof(remote_read_send_len)); + + err = bt_testlib_att_read_by_type_sync(&attr_value, &actual_read_len, &handle, NULL, conn, + bearer, UUID_2, BT_ATT_FIRST_ATTRIBUTE_HANDLE, + BT_ATT_LAST_ATTRIBUTE_HANDLE); + + if (timeout) { + __ASSERT(err == BT_ATT_ERR_UNLIKELY, "Unexpected error %d", err); + } else { + __ASSERT(!err, "Unexpected error %d", err); + __ASSERT(attr_value.len >= sizeof(remote_read_send_len), + "Remote sent too little data."); + remote_read_send_len = net_buf_simple_pull_le16(&attr_value); + __ASSERT(remote_read_send_len == actual_read_len, "Length mismatch. %u %u", + remote_read_send_len, actual_read_len); + } +} + +/** + * Test procedure: + * + * Central: + * 1. Connect to the peripheral. + * 2. Try to read a characteristic value. + * 3. Expect BT_ATT_ERR_UNLIKELY error. + * 4. Expect the peripheral to disconnect. + * 5. Reconnect to the peripheral. + * 6. Try to read a characteristic value. + * 7. Expect the peripheral to respond with the characteristic value. + * 8. Ensure that connection stays alive after a delay equal to ATT timeout. + * 9. Disconnect from the peripheral. + * + * Peripheral: + * 1. Start advertising. + * 2. Make the read callback sleep for more than ATT Timeout when the central tries to read. + * 3. Expect the disconnected callback to be called. + * 4. Start advertising again. + * 5. Make the read callback respond with the characteristic value when the central tries to read. + * 6. Expect the connection stay alive after a delay equal to ATT timeout. + * 7. Expect the central to disconnect. + */ +static void test_timeout(enum bt_att_chan_opt bearer) +{ + bool central = (get_device_nbr() == CENTRAL_DEVICE_NBR); + bool peripheral = (get_device_nbr() == PERIPHERAL_DEVICE_NBR); + struct bt_conn *conn; + int err; + + /* Test ATT timeout. */ + if (peripheral) { + conn = peripheral_setup(bearer, true); + } + + if (central) { + conn = central_setup(bearer, true); + } + + bs_sync_all_log("Ready to test ATT timeout"); + + if (central) { + central_read(conn, bearer, true); + } + + err = k_sem_take(&disconnected_sem, K_SECONDS(BT_ATT_TIMEOUT_SEC + 2)); + /* Here disconnect is triggered by the Central host due to ATT timeout. */ + __ASSERT(!err, "Unexpected error %d", err); + bt_testlib_conn_unref(&conn); + + /* Test successful read. */ + if (peripheral) { + conn = peripheral_setup(bearer, false); + } + + if (central) { + conn = central_setup(bearer, false); + } + + bs_sync_all_log("Ready to test successful read"); + + if (central) { + central_read(conn, bearer, false); + } + + err = k_sem_take(&disconnected_sem, K_SECONDS(BT_ATT_TIMEOUT_SEC + 2)); + /* Check that disconnect doesn't happen during time > ATT timeout. */ + __ASSERT(err == -EAGAIN, "Unexpected error %d", err); + + if (central) { + /* This time disconnect from the peripheral. */ + EXPECT_ZERO(bt_testlib_disconnect(&conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN)); + } + + if (peripheral) { + /* Wait for the central to disconnect. */ + bt_testlib_wait_disconnected(conn); + bt_testlib_conn_unref(&conn); + } + + /* Clear the semaphore. */ + err = k_sem_take(&disconnected_sem, K_SECONDS(1)); + __ASSERT_NO_MSG(!err); +} + +static void connected(struct bt_conn *conn, uint8_t err) +{ + LOG_INF("Connected"); +} + +static void disconnected(struct bt_conn *conn, uint8_t reason) +{ + bool central = (get_device_nbr() == CENTRAL_DEVICE_NBR); + bool peripheral = (get_device_nbr() == PERIPHERAL_DEVICE_NBR); + uint8_t expected_reason; + + LOG_INF("Disconnected: %u", reason); + + if (central) { + expected_reason = BT_HCI_ERR_LOCALHOST_TERM_CONN; + } + + if (peripheral) { + expected_reason = BT_HCI_ERR_REMOTE_USER_TERM_CONN; + } + + __ASSERT(expected_reason == reason, "Unexpected reason %u", reason); + + k_sem_give(&disconnected_sem); +} + +BT_CONN_CB_DEFINE(conn_callbacks) = { + .connected = connected, + .disconnected = disconnected, +}; + +void the_test(void) +{ + bool peripheral = (get_device_nbr() == PERIPHERAL_DEVICE_NBR); + + if (peripheral) { + EXPECT_ZERO(bt_gatt_service_register(&svc)); + } + + bt_enable_quiet(); + + if (peripheral) { + EXPECT_ZERO(bt_set_name("peripheral")); + } + + bs_sync_all_log("Testing UATT"); + test_timeout(BT_ATT_CHAN_OPT_UNENHANCED_ONLY); + + bs_sync_all_log("Testing EATT"); + test_timeout(BT_ATT_CHAN_OPT_ENHANCED_ONLY); + + bs_sync_all_log("Test Complete"); + + PASS("Test complete\n"); +} diff --git a/tests/bsim/bluetooth/host/att/timeout/prj.conf b/tests/bsim/bluetooth/host/att/timeout/prj.conf new file mode 100644 index 0000000000000..ddcef1bc3fe0c --- /dev/null +++ b/tests/bsim/bluetooth/host/att/timeout/prj.conf @@ -0,0 +1,25 @@ +CONFIG_ASSERT=y +CONFIG_BOOT_BANNER=n +CONFIG_BT_BUF_ACL_RX_SIZE=204 +CONFIG_BT_CENTRAL=y +CONFIG_BT_DEVICE_NAME_DYNAMIC=y +CONFIG_BT_EATT=y +CONFIG_BT_EXT_ADV=y +CONFIG_BT_GATT_CLIENT=y +CONFIG_BT_GATT_DYNAMIC_DB=y +CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y +CONFIG_BT_L2CAP_ECRED=y +CONFIG_BT_L2CAP_TX_MTU=200 +CONFIG_BT_MAX_CONN=3 +CONFIG_BT_MAX_PAIRED=2 +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_PRIVACY=n +CONFIG_BT_SMP=y +CONFIG_BT_TESTING=y +CONFIG_BT=y +CONFIG_FLASH_MAP=y +CONFIG_FLASH=y +CONFIG_LOG_BACKEND_FORMAT_TIMESTAMP=n +CONFIG_LOG_RUNTIME_FILTERING=y +CONFIG_LOG_TAG_MAX_LEN=20 +CONFIG_LOG=y diff --git a/tests/bsim/bluetooth/host/att/timeout/test_scripts/run.sh b/tests/bsim/bluetooth/host/att/timeout/test_scripts/run.sh new file mode 100755 index 0000000000000..bda0787f0746c --- /dev/null +++ b/tests/bsim/bluetooth/host/att/timeout/test_scripts/run.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# Copyright 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +set -eu -x + +source ${ZEPHYR_BASE}/tests/bsim/sh_common.source + +simulation_id="timeout" +dev_exe=bs_${BOARD_TS}_$(guess_test_long_name)_prj_conf +args_all=(-s=${simulation_id} -D=2) +args_dev=(-v=2 -RealEncryption=1 -testid=the_test) + +cd "${BSIM_OUT_PATH}/bin" + +Execute ./${dev_exe} "${args_all[@]}" "${args_dev[@]}" -d=0 + +Execute ./${dev_exe} "${args_all[@]}" "${args_dev[@]}" -d=1 + +Execute ./bs_2G4_phy_v1 "${args_all[@]}" -sim_length=200e6 + +wait_for_background_jobs From 74972e694b4916fa2b2d3d457155c1e3f3e24e79 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Mon, 7 Oct 2024 14:19:05 +0200 Subject: [PATCH 0581/4482] bluetooth: host: l2cap: Check conn state before queueing PDU In case of UATT, if a connection was lost while user was holding a read or write attribute callback, `bt_l2cap_send_pdu` (called from `att.c::chan_send`) will anyway queue a PDU and trigger tx work. The PDU won't be sent eventually, but neither will hold an error code, which will allow it to bypass the error check in `att_on_sent_cb` and call `att_sent` function. For EATT `bt_l2cap_chan_send` is used which already handles this case and the error code is passed to `att_on_sent_cb`. This change adds connection state check to `bt_l2cap_send_pdu` preventing from unnecessary code execution when connection does not exist anymore. Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/host/l2cap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index b6ca2f3ea000c..3b5cfe8286497 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -717,6 +717,10 @@ static void cancel_data_ready(struct bt_l2cap_le_chan *le_chan) int bt_l2cap_send_pdu(struct bt_l2cap_le_chan *le_chan, struct net_buf *pdu, bt_conn_tx_cb_t cb, void *user_data) { + if (!le_chan->chan.conn || le_chan->chan.conn->state != BT_CONN_CONNECTED) { + return -ENOTCONN; + } + if (pdu->ref != 1) { /* The host may alter the buf contents when fragmenting. Higher * layers cannot expect the buf contents to stay intact. Extra From 88ee2bee393666ce661b47dae3b65bebdfda32d4 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Fri, 4 Oct 2024 17:01:30 +1000 Subject: [PATCH 0582/4482] net: buf: increase log level of timeout ignore Notifying users that the supplied timeout is being ignored is worthy of a higher log level than debug. Any such usage should be changed at the application level. Signed-off-by: Jordan Yates --- lib/net_buf/buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/net_buf/buf.c b/lib/net_buf/buf.c index a2f504ac06be9..6d409430f0865 100644 --- a/lib/net_buf/buf.c +++ b/lib/net_buf/buf.c @@ -273,7 +273,7 @@ struct net_buf *net_buf_alloc_len(struct net_buf_pool *pool, size_t size, if (!K_TIMEOUT_EQ(timeout, K_NO_WAIT) && k_current_get() == k_work_queue_thread_get(&k_sys_work_q)) { - LOG_DBG("Timeout discarded. No blocking in syswq"); + LOG_WRN("Timeout discarded. No blocking in syswq"); timeout = K_NO_WAIT; } From 257c5e6affbfe74d7eea7005ba77c1d7d7aac85c Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Fri, 4 Oct 2024 17:02:55 +1000 Subject: [PATCH 0583/4482] bluetooth: conn: increase log level of timeout ignore Notifying users that the supplied timeout is being ignored is worthy of a higher log level than debug. Any such usage should be changed at the application level. Signed-off-by: Jordan Yates --- subsys/bluetooth/host/conn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index 229f7adf0a473..c5cee7b8464b3 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -1581,7 +1581,7 @@ struct net_buf *bt_conn_create_pdu_timeout(struct net_buf_pool *pool, if (!K_TIMEOUT_EQ(timeout, K_NO_WAIT) && k_current_get() == k_work_queue_thread_get(&k_sys_work_q)) { - LOG_DBG("Timeout discarded. No blocking in syswq."); + LOG_WRN("Timeout discarded. No blocking in syswq."); timeout = K_NO_WAIT; } From 8a674e157cce9478f2fbcfdf3d5779bad56785c7 Mon Sep 17 00:00:00 2001 From: Michal Smola Date: Thu, 19 Sep 2024 15:56:41 +0200 Subject: [PATCH 0584/4482] dts: nxp mcxc: Add counters configuration Counters configuration is missing in Devicetree for NXP MCX C series. Add lptmr, rtc and pit configuration to Devicetree. Signed-off-by: Michal Smola --- dts/arm/nxp/nxp_mcxc_common.dtsi | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/dts/arm/nxp/nxp_mcxc_common.dtsi b/dts/arm/nxp/nxp_mcxc_common.dtsi index 1af2600ba44c5..8c632b77e7478 100644 --- a/dts/arm/nxp/nxp_mcxc_common.dtsi +++ b/dts/arm/nxp/nxp_mcxc_common.dtsi @@ -253,6 +253,51 @@ status = "disabled"; #pwm-cells = <3>; }; + + lptmr0: lptmr@40040000 { + compatible = "nxp,lptmr"; + reg = <0x40040000 0x1000>; + interrupts = <28 0>; + clock-frequency = <1000>; + prescaler = <1>; + prescale-glitch-filter = <1>; + clk-source = <1>; + resolution = <16>; + status = "disabled"; + }; + + rtc: rtc@4003d000 { + compatible = "nxp,kinetis-rtc"; + reg = <0x4003d000 0x1000>; + interrupts = <20 0>, <21 0>; + interrupt-names = "alarm", "seconds"; + clock-frequency = <32768>; + prescaler = <32768>; + status = "disabled"; + }; + + pit0: pit@40037000 { + compatible = "nxp,pit"; + reg = <0x40037000 0x1000>; + clocks = <&sim KINETIS_SIM_BUS_CLK 0x103c 23>; + interrupts = <22 0>; + max-load-value = <0xffffffff>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; + + pit0_channel0: pit0_channel@0 { + compatible = "nxp,pit-channel"; + reg = <0>; + status = "disabled"; + }; + + pit0_channel1: pit0_channel@1 { + compatible = "nxp,pit-channel"; + reg = <1>; + status = "disabled"; + }; + }; }; }; From 527a2258fe2e34c08910e2c613af704ae4ebb354 Mon Sep 17 00:00:00 2001 From: Michal Smola Date: Thu, 19 Sep 2024 16:08:18 +0200 Subject: [PATCH 0585/4482] boards: frdm_mcxc242: Add counters support mcxc242 has lptmr, pit and rtc counters, but it is not documented and not listed in frdm_mcxc242.yaml. Add the counters to board documentation, to the yaml file, and enable it explicitly in board dts. Set rtc clock to 32 kHz oscillator. Signed-off-by: Michal Smola --- boards/nxp/frdm_mcxc242/doc/index.rst | 6 ++++++ boards/nxp/frdm_mcxc242/frdm_mcxc242.dts | 22 +++++++++++++++++++++- boards/nxp/frdm_mcxc242/frdm_mcxc242.yaml | 1 + 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/boards/nxp/frdm_mcxc242/doc/index.rst b/boards/nxp/frdm_mcxc242/doc/index.rst index c1950ee325bb4..8afb06da0fd02 100644 --- a/boards/nxp/frdm_mcxc242/doc/index.rst +++ b/boards/nxp/frdm_mcxc242/doc/index.rst @@ -70,6 +70,12 @@ The ``frdm_mcxc242`` board target supports the following hardware features: +-----------+------------+-------------------------------------+ | ADC | on-chip | adc | +-----------+------------+-------------------------------------+ +| LPTMR | on-chip | counter | ++-----------+------------+-------------------------------------+ +| PIT | on-chip | counter | ++-----------+------------+-------------------------------------+ +| RTC | on-chip | counter | ++-----------+------------+-------------------------------------+ Targets available diff --git a/boards/nxp/frdm_mcxc242/frdm_mcxc242.dts b/boards/nxp/frdm_mcxc242/frdm_mcxc242.dts index 68799a824a261..ea7b4e0e7ca74 100644 --- a/boards/nxp/frdm_mcxc242/frdm_mcxc242.dts +++ b/boards/nxp/frdm_mcxc242/frdm_mcxc242.dts @@ -87,7 +87,7 @@ &sim { pllfll-select = ; - er32k-select = ; + er32k-select = ; }; &cpu0 { @@ -153,3 +153,23 @@ i2c1: &i2c1 { pinctrl-0 = <&pinmux_adc0>; pinctrl-names = "default"; }; + +&lptmr0 { + status = "okay"; +}; + +&rtc { + status = "okay"; +}; + +&pit0 { + status = "okay"; +}; + +&pit0_channel0 { + status = "okay"; +}; + +&pit0_channel1 { + status = "okay"; +}; diff --git a/boards/nxp/frdm_mcxc242/frdm_mcxc242.yaml b/boards/nxp/frdm_mcxc242/frdm_mcxc242.yaml index e6cbe7c1364c0..1d2d4e9562fa1 100644 --- a/boards/nxp/frdm_mcxc242/frdm_mcxc242.yaml +++ b/boards/nxp/frdm_mcxc242/frdm_mcxc242.yaml @@ -19,6 +19,7 @@ supported: - i2c - pwm - adc + - counter testing: ignore_tags: - net From d04c3c1817af888565427dbd882b89a22e1020e4 Mon Sep 17 00:00:00 2001 From: Michal Smola Date: Mon, 30 Sep 2024 12:19:16 +0200 Subject: [PATCH 0586/4482] tests: drivers: counter_basic_api: Support mcux rtc counter Allow counter_mcux_rtc in reliable_cancel_capable test. Signed-off-by: Michal Smola --- tests/drivers/counter/counter_basic_api/src/test_counter.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/drivers/counter/counter_basic_api/src/test_counter.c b/tests/drivers/counter/counter_basic_api/src/test_counter.c index 42547924d0c25..710d17a52bd00 100644 --- a/tests/drivers/counter/counter_basic_api/src/test_counter.c +++ b/tests/drivers/counter/counter_basic_api/src/test_counter.c @@ -1086,6 +1086,11 @@ static bool reliable_cancel_capable(const struct device *dev) if (single_channel_alarm_capable(dev)) { return true; } +#endif +#ifdef CONFIG_COUNTER_MCUX_RTC + if (single_channel_alarm_capable(dev)) { + return true; + } #endif return false; } From 79222c9c11f69c879de295477db6a811de6c2497 Mon Sep 17 00:00:00 2001 From: Gang Li Date: Fri, 20 Sep 2024 15:54:45 +0900 Subject: [PATCH 0587/4482] hostap: add WPA-Auto-Personal(WPA2/WPA3 mixed) support Add WPA-Auto-Personal support for AP and STA. This mode uses WPA2/WPA3 SAE mixed security with PSK. Signed-off-by: Gang Li --- modules/hostap/src/supp_api.c | 53 ++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index d7425900b9351..67a0234b221a2 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -605,6 +605,32 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s, goto out; } } + } else if (params->security == WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL) { + if (!wpa_cli_cmd_v("set_network %d psk \"%s\"", resp.network_id, + psk_null_terminated)) { + goto out; + } + + if (params->sae_password) { + if (!wpa_cli_cmd_v("set_network %d sae_password \"%s\"", + resp.network_id, sae_null_terminated)) { + goto out; + } + } else { + if (!wpa_cli_cmd_v("set_network %d sae_password \"%s\"", + resp.network_id, psk_null_terminated)) { + goto out; + } + } + + if (!wpa_cli_cmd_v("set sae_pwe 2")) { + goto out; + } + + if (!wpa_cli_cmd_v("set_network %d key_mgmt WPA-PSK SAE", + resp.network_id)) { + goto out; + } #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE } else if (params->security == WIFI_SECURITY_TYPE_EAP_TLS) { if (!wpa_cli_cmd_v("set_network %d key_mgmt WPA-EAP", @@ -1494,7 +1520,32 @@ int hapd_config_network(struct hostapd_iface *iface, if (!hostapd_cli_cmd_v("set sae_pwe 2")) { goto out; } - iface->bss[0]->conf->sae_pwe = 2; + } else if (params->security == WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL) { + if (!hostapd_cli_cmd_v("set wpa 2")) { + goto out; + } + + if (!hostapd_cli_cmd_v("set wpa_key_mgmt WPA-PSK SAE")) { + goto out; + } + + if (!hostapd_cli_cmd_v("set wpa_passphrase \"%s\"", params->psk)) { + goto out; + } + + if (!hostapd_cli_cmd_v("set sae_password \"%s\"", + params->sae_password ? params->sae_password + : params->psk)) { + goto out; + } + + if (!hostapd_cli_cmd_v("set rsn_pairwise CCMP")) { + goto out; + } + + if (!hostapd_cli_cmd_v("set sae_pwe 2")) { + goto out; + } } else if (params->security == WIFI_SECURITY_TYPE_DPP) { if (!hostapd_cli_cmd_v("set wpa 2")) { goto out; From 2e6c83dd4cc23df0b17624d17ec8898db34e3370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Thu, 11 Jul 2024 07:54:12 +0200 Subject: [PATCH 0588/4482] drivers: sensor: qdec: fix QDEC overflow handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QDEC sensor driver fails to inform user of the overflow in the ACC register, which makes the most recently fetched data invalid. An error code return has been added to nrfx_qdec_sample_fetch(), that indicates that an overflow has occured, based on oveflow flag. Also, raw_acc field was added in the qdec_nrfx_data structure, to adjust QDEC to sensor API rules - two subsequent sensor_channel_get() calls should will yield the same values. Signed-off-by: Michał Stasiak --- drivers/sensor/nordic/qdec_nrfx/qdec_nrfx.c | 23 +++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/sensor/nordic/qdec_nrfx/qdec_nrfx.c b/drivers/sensor/nordic/qdec_nrfx/qdec_nrfx.c index 10035e0a10365..dc70c27d41724 100644 --- a/drivers/sensor/nordic/qdec_nrfx/qdec_nrfx.c +++ b/drivers/sensor/nordic/qdec_nrfx/qdec_nrfx.c @@ -26,7 +26,9 @@ LOG_MODULE_REGISTER(qdec_nrfx, CONFIG_SENSOR_LOG_LEVEL); struct qdec_nrfx_data { + int32_t fetched_acc; int32_t acc; + bool overflow; sensor_trigger_handler_t data_ready_handler; const struct sensor_trigger *data_ready_trigger; }; @@ -49,6 +51,8 @@ static void accumulate(struct qdec_nrfx_data *data, int32_t acc) if (!overflow) { data->acc += acc; + } else { + data->overflow = true; } irq_unlock(key); @@ -70,6 +74,18 @@ static int qdec_nrfx_sample_fetch(const struct device *dev, accumulate(data, acc); + unsigned int key = irq_lock(); + + data->fetched_acc = data->acc; + data->acc = 0; + + irq_unlock(key); + + if (data->overflow) { + data->overflow = false; + return -EOVERFLOW; + } + return 0; } @@ -87,8 +103,7 @@ static int qdec_nrfx_channel_get(const struct device *dev, } key = irq_lock(); - acc = data->acc; - data->acc = 0; + acc = data->fetched_acc; irq_unlock(key); val->val1 = (acc * FULL_ANGLE) / config->steps; @@ -148,6 +163,10 @@ static void qdec_nrfx_event_handler(nrfx_qdec_event_t event, void *p_context) } break; + case NRF_QDEC_EVENT_ACCOF: + dev_data->overflow = true; + break; + default: LOG_ERR("unhandled event (0x%x)", event.type); break; From 9b5260de9a31738f5632a0f7240f1f70bc1d4cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Mon, 29 Jul 2024 09:33:52 +0200 Subject: [PATCH 0589/4482] tests: boards: nrf: qdec: modify QDEC tests to match new api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Overflow errorcode is now correctly detected when expected. Subsequent sensor_channel_get() yield the same values, so the check can be no longer ignored. Added a sensor_sample_fetch() where missing for correct sensor_channel_get() calls. Signed-off-by: Michał Stasiak --- tests/boards/nrf/qdec/src/main.c | 37 +++++++++++++++++--------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/tests/boards/nrf/qdec/src/main.c b/tests/boards/nrf/qdec/src/main.c index 639e92f85107a..cccd92c3293ae 100644 --- a/tests/boards/nrf/qdec/src/main.c +++ b/tests/boards/nrf/qdec/src/main.c @@ -89,7 +89,7 @@ static void qenc_emulate_stop(void) } static void qenc_emulate_verify_reading(int emulator_period_ms, int emulation_duration_ms, - bool forward, bool overflow_possible) + bool forward, bool overflow_expected) { int rc; struct sensor_value val = {0}; @@ -107,13 +107,17 @@ static void qenc_emulate_verify_reading(int emulator_period_ms, int emulation_du k_msleep(emulation_duration_ms); rc = sensor_sample_fetch(qdec_dev); - zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); + + if (!overflow_expected) { + zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); + } else { + zassert_true(rc == -EOVERFLOW, "Failed to detect overflow"); + } rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to get sample (%d)", rc); - TC_PRINT("QDEC reading: %d\n", val.val1); - if (!overflow_possible) { + if (!overflow_expected) { zassert_within(val.val1, expected_reading, delta, "Expected reading: %d, but got: %d", expected_reading, val.val1); } @@ -197,6 +201,9 @@ ZTEST(qdec_sensor, test_sensor_trigger_set) rc = k_sem_take(&sem, K_MSEC(200)); zassert_true(rc == 0, "qdec handler should be triggered (%d)", rc); + rc = sensor_sample_fetch(qdec_dev); + zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); + rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); @@ -241,7 +248,6 @@ ZTEST(qdec_sensor, test_qdec_readings) qenc_emulate_verify_reading(10, 100, true, false); qenc_emulate_verify_reading(2, 500, true, false); qenc_emulate_verify_reading(10, 200, false, false); - /* may lead to overflows but currently driver does not detects that */ qenc_emulate_verify_reading(1, 1000, false, true); qenc_emulate_verify_reading(1, 1000, true, true); } @@ -313,18 +319,15 @@ ZTEST(qdec_sensor, test_sensor_channel_get) /* subsequent calls of sensor_channel_get without calling sensor_sample_fetch * should yield the same value */ - /* zassert_true(val_first.val1 == val_second.val1, - * "Expected the same readings: %d vs %d", - * val_first.val1, - * val_second.val1); - */ - TC_PRINT("Expected the same readings: %d vs %d - ignore!\n", val_first.val1, - val_second.val1); - /* zassert_true(val_first.val2 == val_second.val2, "Expected the same readings: %d vs %d", - * val_first.val2, val_second.val2); - */ - TC_PRINT("Expected the same readings: %d vs %d - ignore!\n", val_first.val2, - val_second.val2); + zassert_true(val_first.val1 == val_second.val1, + "Expected the same readings: %d vs %d", + val_first.val1, + val_second.val1); + + zassert_true(val_first.val2 == val_second.val2, + "Expected the same readings: %d vs %d", + val_first.val2, + val_second.val2); } /** From 121cb49a46eb97ec768860e0e69369d3defc9748 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 8 Oct 2024 18:13:03 -0400 Subject: [PATCH 0590/4482] kernel: sched: inline update_cache This improves context switching by 7% when measured using the thread_metric benchmark. Before: **** Thread-Metric Preemptive Scheduling Test **** Relative Time: 120 Time Period Total: 5451879 After: **** Thread-Metric Preemptive Scheduling Test **** Relative Time: 30 Time Period Total: 5853535 Signed-off-by: Anas Nashif --- kernel/sched.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched.c b/kernel/sched.c index d91a2d32cfb67..291a231ad0353 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -35,7 +35,7 @@ struct k_spinlock _sched_spinlock; */ __incoherent struct k_thread _thread_dummy; -static void update_cache(int preempt_ok); +static ALWAYS_INLINE void update_cache(int preempt_ok); static void halt_thread(struct k_thread *thread, uint8_t new_state); static void add_to_waitq_locked(struct k_thread *thread, _wait_q_t *wait_q); @@ -320,7 +320,7 @@ static void update_metairq_preempt(struct k_thread *thread) */ } -static void update_cache(int preempt_ok) +static ALWAYS_INLINE void update_cache(int preempt_ok) { #ifndef CONFIG_SMP struct k_thread *thread = next_up(); From a5cd46b843c66ee0b7b753d5b791ac0c6f7995e3 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Thu, 10 Oct 2024 11:53:37 +0200 Subject: [PATCH 0591/4482] cmake: support PATH argument in build_info() Support PATH argument in build_info() function. The PATH argument can be used to provide a list of paths paths and that those paths might be using native style, such as `c:\win\path', and therefore should be converted to CMake style path. Signed-off-by: Torsten Rasmussen --- cmake/modules/extensions.cmake | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 9fc4726a6654f..d5cd84256d2e6 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -3658,7 +3658,8 @@ function(topological_sort) endfunction() # Usage: -# build_info(... VALUE ...) +# build_info(... VALUE ... ) +# build_info(... PATH ... ) # # This function populates updates the build_info.yml info file with exchangable build information # related to the current build. @@ -3675,11 +3676,20 @@ endfunction() # ...: One of the pre-defined valid CMake keys supported by build info or vendor-specific. # See 'scripts/schemas/build-schema.yml' CMake section for valid tags. # VALUE ... : value(s) to place in the build_info.yml file. +# PATH ... : path(s) to place in the build_info.yml file. All paths are converted to CMake +# style. If no conversion is required, for example when paths are already +# guaranteed to be CMake style, then VALUE can also be used. function(build_info) + set(convert_path FALSE) set(arg_list ${ARGV}) list(FIND arg_list VALUE index) if(index EQUAL -1) - message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION}(...) missing a required argument: VALUE") + list(FIND arg_list PATH index) + set(convert_path TRUE) + endif() + + if(index EQUAL -1) + message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION}(...) missing a required argument: VALUE or PATH") endif() yaml_context(EXISTS NAME build_info result) @@ -3697,6 +3707,15 @@ function(build_info) list(SUBLIST arg_list ${index} -1 values) list(POP_FRONT values) + if(convert_path) + set(converted_values) + foreach(val ${values}) + cmake_path(SET cmake_path "${val}") + list(APPEND converted_values "${cmake_path}") + endforeach() + set(values "${converted_values}") + endif() + if(ARGV0 STREQUAL "vendor-specific") set(type VALUE) else() From 2c1eae216d568cfa018b9d6741c57afdc26acf15 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Thu, 10 Oct 2024 11:59:53 +0200 Subject: [PATCH 0592/4482] cmake: update build_info() calls to use PATH argument Update build_info() calls to use `PATH` argument when values passed to `build_info()` are user specified and thereby might use native path separator, such as a single `\`. Signed-off-by: Torsten Rasmussen --- cmake/modules/FindHostTools.cmake | 2 +- cmake/modules/dts.cmake | 10 +++++----- cmake/modules/kconfig.cmake | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cmake/modules/FindHostTools.cmake b/cmake/modules/FindHostTools.cmake index 876a86934b140..1dfce4d3d4a12 100644 --- a/cmake/modules/FindHostTools.cmake +++ b/cmake/modules/FindHostTools.cmake @@ -116,4 +116,4 @@ set(HostTools_FOUND TRUE) set(HOSTTOOLS_FOUND TRUE) build_info(toolchain name VALUE ${ZEPHYR_TOOLCHAIN_VARIANT}) string(TOUPPER ${ZEPHYR_TOOLCHAIN_VARIANT} zephyr_toolchain_variant_upper) -build_info(toolchain path VALUE "${${zephyr_toolchain_variant_upper}_TOOLCHAIN_PATH}") +build_info(toolchain path PATH "${${zephyr_toolchain_variant_upper}_TOOLCHAIN_PATH}") diff --git a/cmake/modules/dts.cmake b/cmake/modules/dts.cmake index 02fed1b4a8f58..16b497d573776 100644 --- a/cmake/modules/dts.cmake +++ b/cmake/modules/dts.cmake @@ -188,7 +188,7 @@ set(dts_files if(DTC_OVERLAY_FILE) zephyr_list(TRANSFORM DTC_OVERLAY_FILE NORMALIZE_PATHS OUTPUT_VARIABLE DTC_OVERLAY_FILE_AS_LIST) - build_info(devicetree user-files VALUE ${DTC_OVERLAY_FILE_AS_LIST}) + build_info(devicetree user-files PATH ${DTC_OVERLAY_FILE_AS_LIST}) list(APPEND dts_files ${DTC_OVERLAY_FILE_AS_LIST} @@ -198,7 +198,7 @@ endif() if(EXTRA_DTC_OVERLAY_FILE) zephyr_list(TRANSFORM EXTRA_DTC_OVERLAY_FILE NORMALIZE_PATHS OUTPUT_VARIABLE EXTRA_DTC_OVERLAY_FILE_AS_LIST) - build_info(devicetree extra-user-files VALUE ${EXTRA_DTC_OVERLAY_FILE_AS_LIST}) + build_info(devicetree extra-user-files PATH ${EXTRA_DTC_OVERLAY_FILE_AS_LIST}) list(APPEND dts_files ${EXTRA_DTC_OVERLAY_FILE_AS_LIST} @@ -416,6 +416,6 @@ elseif(stderr) endif() endif(DTC) -build_info(devicetree files VALUE ${dts_files}) -build_info(devicetree include-dirs VALUE ${DTS_ROOT_SYSTEM_INCLUDE_DIRS}) -build_info(devicetree bindings-dirs VALUE ${DTS_ROOT_BINDINGS}) +build_info(devicetree files PATH ${dts_files}) +build_info(devicetree include-dirs PATH ${DTS_ROOT_SYSTEM_INCLUDE_DIRS}) +build_info(devicetree bindings-dirs PATH ${DTS_ROOT_BINDINGS}) diff --git a/cmake/modules/kconfig.cmake b/cmake/modules/kconfig.cmake index 3f7310aabb5db..0273d39bf8508 100644 --- a/cmake/modules/kconfig.cmake +++ b/cmake/modules/kconfig.cmake @@ -95,13 +95,13 @@ set(PARSED_KCONFIG_SOURCES_TXT ${PROJECT_BINARY_DIR}/kconfig/sources.txt) if(CONF_FILE) string(CONFIGURE "${CONF_FILE}" CONF_FILE_EXPANDED) string(REPLACE " " ";" CONF_FILE_AS_LIST "${CONF_FILE_EXPANDED}") - build_info(kconfig user-files VALUE ${CONF_FILE_AS_LIST}) + build_info(kconfig user-files PATH ${CONF_FILE_AS_LIST}) endif() if(EXTRA_CONF_FILE) string(CONFIGURE "${EXTRA_CONF_FILE}" EXTRA_CONF_FILE_EXPANDED) string(REPLACE " " ";" EXTRA_CONF_FILE_AS_LIST "${EXTRA_CONF_FILE_EXPANDED}") - build_info(kconfig extra-user-files VALUE ${EXTRA_CONF_FILE_AS_LIST}) + build_info(kconfig extra-user-files PATH ${EXTRA_CONF_FILE_AS_LIST}) endif() zephyr_file(CONF_FILES ${BOARD_EXTENSION_DIRS} KCONF board_extension_conf_files SUFFIX ${FILE_SUFFIX}) @@ -356,7 +356,7 @@ endif() if(CREATE_NEW_DOTCONFIG) set(input_configs_flags --handwritten-input-configs) set(input_configs ${merge_config_files} ${FORCED_CONF_FILE}) - build_info(kconfig files VALUE ${input_configs}) + build_info(kconfig files PATH ${input_configs}) else() set(input_configs ${DOTCONFIG} ${FORCED_CONF_FILE}) endif() From f2d549d55b8962510763fc7731f2927560205d9e Mon Sep 17 00:00:00 2001 From: Ryan McClelland Date: Mon, 7 Oct 2024 12:03:05 -0700 Subject: [PATCH 0593/4482] drivers: i3c: cdns: fixup attachment and addr assignment for daa The ENTDAA does not have a way to assign DA that are with a PID. It will assign DAs that were in it's RRs in the order that they win arbitration. Assign only available addresses in to it's RRs before ENTDAA. Cleanup the attach api to no longer require a addr argument and remove the helper function `i3c_determine_default_addr`. This now looks at if it has a static address or if it already has a dynamic address (such as from DEFTGTS) and will register the address if either exist with precidence of dynamic addr over static addr. This also fixes up the look up for if a device already has a dynamic addr to find which pos of the RRs is it is in. Signed-off-by: Ryan McClelland --- drivers/i3c/i3c_cdns.c | 105 ++++++++++++++++++++++------------- drivers/i3c/i3c_common.c | 95 +++++++------------------------ include/zephyr/drivers/i3c.h | 19 +------ 3 files changed, 89 insertions(+), 130 deletions(-) diff --git a/drivers/i3c/i3c_cdns.c b/drivers/i3c/i3c_cdns.c index f292827da923c..1690b33f9a43b 100644 --- a/drivers/i3c/i3c_cdns.c +++ b/drivers/i3c/i3c_cdns.c @@ -1499,6 +1499,7 @@ static int cdns_i3c_do_daa(const struct device *dev) struct cdns_i3c_data *data = dev->data; const struct cdns_i3c_config *config = dev->config; struct i3c_config_controller *ctrl_config = &data->common.ctrl_config; + uint8_t last_addr = 0; /* DAA should not be done by secondary controllers */ if (ctrl_config->is_secondary) { @@ -1510,6 +1511,23 @@ static int cdns_i3c_do_daa(const struct device *dev) /* ignore the controller register */ olddevs |= BIT(0); + /* Assign dynamic addressses to available RRs */ + /* Loop through each clear bit */ + for (uint8_t i = find_lsb_set(~olddevs); i <= data->max_devs; i++) { + uint8_t rr_idx = i - 1; + + if (~olddevs & BIT(rr_idx)) { + /* Read RRx registers */ + last_addr = i3c_addr_slots_next_free_find( + &data->common.attached_dev.addr_slots, last_addr + 1); + /* Write RRx registers */ + sys_write32(prepare_rr0_dev_address(last_addr) | DEV_ID_RR0_IS_I3C, + config->base + DEV_ID_RR0(rr_idx)); + sys_write32(0, config->base + DEV_ID_RR1(rr_idx)); + sys_write32(0, config->base + DEV_ID_RR2(rr_idx)); + } + } + /* the Cadence I3C IP will assign an address for it from the RR */ struct i3c_ccc_payload entdaa_ccc; @@ -1915,7 +1933,10 @@ static int cdns_i3c_master_get_rr_slot(const struct device *dev, uint8_t dyn_add { struct cdns_i3c_data *data = dev->data; const struct cdns_i3c_config *config = dev->config; + uint8_t rr_idx, i; + uint32_t rr, activedevs; + /* If it does not have a dynamic address, then assign it a free one */ if (dyn_addr == 0) { if (!data->free_rr_slots) { return -ENOSPC; @@ -1924,62 +1945,70 @@ static int cdns_i3c_master_get_rr_slot(const struct device *dev, uint8_t dyn_add return find_lsb_set(data->free_rr_slots) - 1; } - uint32_t activedevs = sys_read32(config->base + DEVS_CTRL) & DEVS_CTRL_DEVS_ACTIVE_MASK; - + /* Device already has a Dynamic Address, so assume it is already in the RRs */ + activedevs = sys_read32(config->base + DEVS_CTRL) & DEVS_CTRL_DEVS_ACTIVE_MASK; + /* skip itself */ activedevs &= ~BIT(0); /* loop through each set bit for new devices */ - for (uint8_t i = find_lsb_set(activedevs); i <= find_msb_set(activedevs); i++) { - if (activedevs & BIT(i)) { - uint32_t rr = sys_read32(config->base + DEV_ID_RR0(i)); - - if (!(rr & DEV_ID_RR0_IS_I3C) || DEV_ID_RR0_GET_DEV_ADDR(rr) != dyn_addr) { - continue; + for (i = find_lsb_set(activedevs); i <= find_msb_set(activedevs); i++) { + rr_idx = i - 1; + if (activedevs & BIT(rr_idx)) { + rr = sys_read32(config->base + DEV_ID_RR0(rr_idx)); + if ((rr & DEV_ID_RR0_IS_I3C) && DEV_ID_RR0_GET_DEV_ADDR(rr) == dyn_addr) { + return rr_idx; } - return i; } } return -EINVAL; } -static int cdns_i3c_attach_device(const struct device *dev, struct i3c_device_desc *desc, - uint8_t addr) +static int cdns_i3c_attach_device(const struct device *dev, struct i3c_device_desc *desc) { - const struct cdns_i3c_config *config = dev->config; - struct cdns_i3c_data *data = dev->data; - int slot = cdns_i3c_master_get_rr_slot(dev, desc->dynamic_addr); - - if (slot < 0) { - LOG_ERR("%s: no space for i3c device: %s", dev->name, desc->dev->name); - return slot; - } + /* + * Mark Devices as active, devices that will be found and marked active during DAA, + * it will be given the exact DA programmed in it's RR, otherwise they get set as active + * here. If dynamic address is set, then it assumed that it was already initialized by the + * primary controller. When assigned through ENTDAA, the dynamic address, bcr, dcr, and pid + * are all set in the RR along with setting the device as active. If it has a static addr, + * then it is assumed that it will be programmed with SETDASA and will need to be marked + * as active before sending out SETDASA. + */ + if ((desc->static_addr != 0) || (desc->dynamic_addr != 0)) { + const struct cdns_i3c_config *config = dev->config; + struct cdns_i3c_data *data = dev->data; - k_mutex_lock(&data->bus_lock, K_FOREVER); + int slot = cdns_i3c_master_get_rr_slot(dev, desc->dynamic_addr ? desc->dynamic_addr + : desc->static_addr); - data->cdns_i3c_i2c_priv_data[slot].id = slot; - desc->controller_priv = &(data->cdns_i3c_i2c_priv_data[slot]); - data->free_rr_slots &= ~BIT(slot); - - uint32_t dev_id_rr0 = DEV_ID_RR0_IS_I3C | prepare_rr0_dev_address(addr); - uint32_t dev_id_rr1 = DEV_ID_RR1_PID_MSB((desc->pid & 0xFFFFFFFF0000) >> 16); - uint32_t dev_id_rr2 = DEV_ID_RR2_PID_LSB(desc->pid & 0xFFFF); + if (slot < 0) { + LOG_ERR("%s: no space for i3c device: %s", dev->name, desc->dev->name); + return slot; + } - sys_write32(dev_id_rr0, config->base + DEV_ID_RR0(slot)); - sys_write32(dev_id_rr1, config->base + DEV_ID_RR1(slot)); - sys_write32(dev_id_rr2, config->base + DEV_ID_RR2(slot)); + k_mutex_lock(&data->bus_lock, K_FOREVER); - /** Mark Devices as active, devices that will be found and marked active during DAA, - * it will be given the exact DA programmed in it's RR if the PID matches and marked - * as active duing ENTDAA, otherwise they get set as active here. If dynamic address - * is set, then it assumed that it was already initialized by the primary controller. - */ - if ((desc->static_addr != 0) || (desc->dynamic_addr != 0)) { sys_write32(sys_read32(config->base + DEVS_CTRL) | DEVS_CTRL_DEV_ACTIVE(slot), config->base + DEVS_CTRL); - } - k_mutex_unlock(&data->bus_lock); + data->cdns_i3c_i2c_priv_data[slot].id = slot; + desc->controller_priv = &(data->cdns_i3c_i2c_priv_data[slot]); + data->free_rr_slots &= ~BIT(slot); + + uint32_t dev_id_rr0 = + DEV_ID_RR0_IS_I3C | + prepare_rr0_dev_address(desc->dynamic_addr ? desc->dynamic_addr + : desc->static_addr); + uint32_t dev_id_rr1 = DEV_ID_RR1_PID_MSB((desc->pid & 0xFFFFFFFF0000) >> 16); + uint32_t dev_id_rr2 = DEV_ID_RR2_PID_LSB(desc->pid & 0xFFFF); + + sys_write32(dev_id_rr0, config->base + DEV_ID_RR0(slot)); + sys_write32(dev_id_rr1, config->base + DEV_ID_RR1(slot)); + sys_write32(dev_id_rr2, config->base + DEV_ID_RR2(slot)); + + k_mutex_unlock(&data->bus_lock); + } return 0; } diff --git a/drivers/i3c/i3c_common.c b/drivers/i3c/i3c_common.c index 9e792a8446637..9e3783876b848 100644 --- a/drivers/i3c/i3c_common.c +++ b/drivers/i3c/i3c_common.c @@ -234,92 +234,41 @@ struct i3c_i2c_device_desc *i3c_dev_list_i2c_addr_find(const struct device *dev, return ret; } -int i3c_determine_default_addr(struct i3c_device_desc *target, uint8_t *addr) -{ - struct i3c_driver_data *data = (struct i3c_driver_data *)target->bus->data; - - /* If dynamic addr is set, then it assumed that it was assigned by a primary controller */ - if (target->dynamic_addr == 0) { - /* It is assumed that SETDASA or ENTDAA will be run after this */ - if (target->init_dynamic_addr != 0U) { - /* initial dynamic address is requested */ - if (target->static_addr == 0) { - /* SA is set to 0, so DA will be set with ENTDAA */ - if (i3c_addr_slots_is_free(&data->attached_dev.addr_slots, - target->init_dynamic_addr)) { - /* Set DA during ENTDAA */ - *addr = target->init_dynamic_addr; - } else { - /* address is not free, get the next one */ - *addr = i3c_addr_slots_next_free_find( - &data->attached_dev.addr_slots, 0); - } - } else { - /* Use the init dynamic address as it's DA, but the RR will need to - * be first set with it's SA to run SETDASA, the RR address will - * need be updated after SETDASA with the request dynamic address - */ - if (i3c_addr_slots_is_free(&data->attached_dev.addr_slots, - target->static_addr)) { - *addr = target->static_addr; - } else { - /* static address has already been taken */ - return -EINVAL; - } - } - } else { - /* no init dynamic address is requested */ - if (target->static_addr != 0) { - if (i3c_addr_slots_is_free(&data->attached_dev.addr_slots, - target->static_addr)) { - /* static exists, set DA with same SA during SETDASA*/ - *addr = target->static_addr; - } else { - /* static address has already been taken */ - return -EINVAL; - } - } else { - /* pick a DA to use */ - *addr = i3c_addr_slots_next_free_find( - &data->attached_dev.addr_slots, 0); - } - } - } else { - *addr = target->dynamic_addr; - } - - return 0; -} - int i3c_attach_i3c_device(struct i3c_device_desc *target) { struct i3c_driver_data *data = (struct i3c_driver_data *)target->bus->data; const struct i3c_driver_api *api = (const struct i3c_driver_api *)target->bus->api; - sys_snode_t *node; uint8_t addr = 0; int status = 0; + struct i3c_device_desc *i3c_desc; /* check to see if the device has already been attached */ - if (!sys_slist_is_empty(&data->attached_dev.devices.i3c)) { - SYS_SLIST_FOR_EACH_NODE(&data->attached_dev.devices.i3c, node) { - if (node == &target->node) { - return -EINVAL; - } + I3C_BUS_FOR_EACH_I3CDEV(target->bus, i3c_desc) { + if (i3c_desc == target) { + return -EINVAL; } } - status = i3c_determine_default_addr(target, &addr); - if (status != 0) { - return status; + addr = target->dynamic_addr ? target->dynamic_addr : target->static_addr; + + /* + * If it has a dynamic addr already assigned or a static address, check that it is free + */ + if (addr) { + if (!i3c_addr_slots_is_free(&data->attached_dev.addr_slots, addr)) { + return -EINVAL; + } } sys_slist_append(&data->attached_dev.devices.i3c, &target->node); if (api->attach_i3c_device != NULL) { - status = api->attach_i3c_device(target->bus, target, addr); + status = api->attach_i3c_device(target->bus, target); } - i3c_addr_slots_mark_i3c(&data->attached_dev.addr_slots, addr); + if (addr) { + i3c_addr_slots_mark_i3c(&data->attached_dev.addr_slots, addr); + } return status; } @@ -376,15 +325,13 @@ int i3c_attach_i2c_device(struct i3c_i2c_device_desc *target) { struct i3c_driver_data *data = (struct i3c_driver_data *)target->bus->data; const struct i3c_driver_api *api = (const struct i3c_driver_api *)target->bus->api; - sys_snode_t *node; int status = 0; + struct i3c_i2c_device_desc *i3c_i2c_desc; /* check to see if the device has already been attached */ - if (!sys_slist_is_empty(&data->attached_dev.devices.i2c)) { - SYS_SLIST_FOR_EACH_NODE(&data->attached_dev.devices.i2c, node) { - if (node == &target->node) { - return -EINVAL; - } + I3C_BUS_FOR_EACH_I2CDEV(target->bus, i3c_i2c_desc) { + if (i3c_i2c_desc == target) { + return -EINVAL; } } diff --git a/include/zephyr/drivers/i3c.h b/include/zephyr/drivers/i3c.h index 712000e3a58c1..f3581663bfe44 100644 --- a/include/zephyr/drivers/i3c.h +++ b/include/zephyr/drivers/i3c.h @@ -639,13 +639,11 @@ __subsystem struct i3c_driver_api { * * @param dev Pointer to controller device driver instance. * @param target Pointer to target device descriptor. - * @param addr Address to attach with * * @return See i3c_attach_i3c_device() */ int (*attach_i3c_device)(const struct device *dev, - struct i3c_device_desc *target, - uint8_t addr); + struct i3c_device_desc *target); /** * I3C Address Update @@ -1273,21 +1271,6 @@ struct i3c_device_desc *i3c_dev_list_i3c_addr_find(const struct device *dev, struct i3c_i2c_device_desc *i3c_dev_list_i2c_addr_find(const struct device *dev, uint16_t addr); -/** - * @brief Helper function to find the default address an i3c device is attached with - * - * This is a helper function to find the default address the - * device will be loaded with. This could be either it's static - * address, a requested dynamic address, or just a dynamic address - * that is available - * @param[in] target The pointer of the device descriptor - * @param[out] addr Address to be assigned to target device. - * - * @retval 0 if successful. - * @retval -EINVAL if the expected default address is already in use - */ -int i3c_determine_default_addr(struct i3c_device_desc *target, uint8_t *addr); - /** * @brief Helper function to find a usable address during ENTDAA. * From 05d59f720731c66e0129bbfceff3eba64ca2ef14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Tue, 8 Oct 2024 20:03:25 +0200 Subject: [PATCH 0594/4482] boards: Set full_name for all boards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Full name was set based on the information available either in board documentation or in Twister files. Whenever applicable, vendor name was dropped from the full name so that all boards have a consistent naming scheme. Signed-off-by: Benjamin Cabé --- boards/01space/esp32c3_042_oled/board.yml | 1 + boards/96boards/aerocore2/board.yml | 1 + boards/96boards/argonkey/board.yml | 1 + boards/96boards/avenger96/board.yml | 1 + boards/96boards/carbon/board.yml | 1 + boards/96boards/meerkat96/board.yml | 1 + boards/96boards/neonkey/board.yml | 1 + boards/96boards/nitrogen/board.yml | 1 + boards/96boards/stm32_sensor_mez/board.yml | 1 + boards/96boards/wistrio/board.yml | 1 + boards/aconno/acn52832/board.yml | 1 + boards/acrn/acrn/board.yml | 2 ++ boards/actinius/icarus/board.yml | 1 + boards/actinius/icarus_bee/board.yml | 1 + boards/actinius/icarus_som/board.yml | 1 + boards/actinius/icarus_som_dk/board.yml | 1 + boards/adafruit/feather_m0_basic_proto/board.yml | 1 + boards/adafruit/feather_m0_lora/board.yml | 1 + boards/adafruit/feather_nrf52840/board.yml | 1 + boards/adafruit/feather_stm32f405/board.yml | 1 + boards/adafruit/grand_central_m4_express/board.yml | 1 + boards/adafruit/itsybitsy/board.yml | 1 + boards/adafruit/itsybitsy_m4_express/board.yml | 1 + boards/adafruit/kb2040/board.yml | 1 + boards/adafruit/nrf52_adafruit_feather/board.yml | 1 + boards/adafruit/qt_py_rp2040/board.yml | 1 + boards/adafruit/trinket_m0/board.yml | 1 + boards/adi/apard32690/board.yml | 1 + boards/adi/eval_adin1110ebz/board.yml | 1 + boards/adi/eval_adin2111ebz/board.yml | 1 + boards/adi/max32655evkit/board.yml | 1 + boards/adi/max32655fthr/board.yml | 1 + boards/adi/max32662evkit/board.yml | 1 + boards/adi/max32666evkit/board.yml | 1 + boards/adi/max32666fthr/board.yml | 1 + boards/adi/max32670evkit/board.yml | 1 + boards/adi/max32672evkit/board.yml | 1 + boards/adi/max32672fthr/board.yml | 1 + boards/adi/max32675evkit/board.yml | 1 + boards/adi/max32680evkit/board.yml | 1 + boards/adi/max32690evkit/board.yml | 1 + boards/adi/max32690fthr/board.yml | 1 + boards/adi/sdp_k1/board.yml | 1 + boards/alientek/pandora_stm32l475/board.yml | 1 + boards/altr/max10/board.yml | 1 + boards/ambiq/apollo3_evb/board.yml | 1 + boards/ambiq/apollo3p_evb/board.yml | 1 + boards/ambiq/apollo4p_blue_kxr_evb/board.yml | 1 + boards/ambiq/apollo4p_evb/board.yml | 1 + boards/amd/kv260_r5/board.yml | 1 + boards/andestech/adp_xc7k_ae350/board.yml | 1 + boards/arduino/due/board.yml | 1 + boards/arduino/giga_r1/board.yml | 1 + boards/arduino/mkrzero/board.yml | 1 + boards/arduino/nano_33_ble/board.yml | 1 + boards/arduino/nano_33_iot/board.yml | 1 + boards/arduino/nicla_sense_me/board.yml | 1 + boards/arduino/nicla_vision/board.yml | 1 + boards/arduino/opta/board.yml | 1 + boards/arduino/portenta_h7/board.yml | 1 + boards/arduino/uno_r4/board.yml | 2 ++ boards/arduino/zero/board.yml | 1 + boards/arm/fvp_base_revc_2xaemv8a/board.yml | 1 + boards/arm/fvp_baser_aemv8r/board.yml | 1 + boards/arm/mps2/board.yml | 1 + boards/arm/mps3/board.yml | 1 + boards/arm/v2m_beetle/board.yml | 1 + boards/arm/v2m_musca_b1/board.yml | 1 + boards/arm/v2m_musca_s1/board.yml | 1 + boards/aspeed/ast1030_evb/board.yml | 1 + boards/atmarktechno/degu_evk/board.yml | 1 + boards/atmel/sam/sam4e_xpro/board.yml | 1 + boards/atmel/sam/sam4l_ek/board.yml | 1 + boards/atmel/sam/sam4s_xplained/board.yml | 1 + boards/atmel/sam/sam_e70_xplained/board.yml | 1 + boards/atmel/sam/sam_v71_xult/board.yml | 1 + boards/atmel/sam0/samc21n_xpro/board.yml | 1 + boards/atmel/sam0/samd20_xpro/board.yml | 1 + boards/atmel/sam0/samd21_xpro/board.yml | 1 + boards/atmel/sam0/same54_xpro/board.yml | 1 + boards/atmel/sam0/saml21_xpro/board.yml | 1 + boards/atmel/sam0/samr21_xpro/board.yml | 1 + boards/atmel/sam0/samr34_xpro/board.yml | 1 + boards/bbc/microbit/board.yml | 1 + boards/bbc/microbit_v2/board.yml | 1 + boards/bcdevices/plt_demo_v2/board.yml | 1 + boards/beagle/beagleconnect_freedom/board.yml | 1 + boards/beagle/beagleplay/board.yml | 1 + boards/beagle/beaglev_fire/board.yml | 1 + boards/blues/swan_r5/board.yml | 1 + boards/brcm/bcm958401m2/board.yml | 1 + boards/brcm/bcm958402m2/board.yml | 1 + boards/bytesatwork/bytesensi_l/board.yml | 1 + boards/cdns/xt-sim/board.yml | 1 + boards/circuitdojo/feather/board.yml | 1 + boards/contextualelectronics/abc/board.yml | 1 + boards/croxel/croxel_cx1825/board.yml | 1 + boards/ct/ctcc/board.yml | 1 + boards/cypress/cy8ckit_062_ble/board.yml | 1 + boards/cypress/cy8ckit_062_wifi_bt/board.yml | 1 + boards/digilent/arty_a7/board.yml | 1 + boards/digilent/zybo/board.yml | 1 + boards/dptechnics/walter/board.yml | 1 + boards/dragino/lsn50/board.yml | 1 + boards/dragino/nbsn95/board.yml | 1 + boards/ebyte/e73_tbb/board.yml | 1 + boards/efinix/titanium_ti60_f225/board.yml | 1 + boards/electronut/nrf52840_blip/board.yml | 1 + boards/electronut/nrf52840_papyr/board.yml | 1 + boards/element14/warp7/board.yml | 1 + boards/enclustra/mercury_xu/board.yml | 1 + boards/ene/kb1200_evb/board.yml | 1 + boards/enjoydigital/litex_vexriscv/board.yml | 1 + boards/espressif/esp32_devkitc_wroom/board.yml | 1 + boards/espressif/esp32_devkitc_wrover/board.yml | 1 + boards/espressif/esp32_ethernet_kit/board.yml | 1 + boards/espressif/esp32c3_devkitc/board.yml | 1 + boards/espressif/esp32c3_devkitm/board.yml | 1 + boards/espressif/esp32c3_rust/board.yml | 1 + boards/espressif/esp32c6_devkitc/board.yml | 1 + boards/espressif/esp32s2_devkitc/board.yml | 1 + boards/espressif/esp32s2_saola/board.yml | 1 + boards/espressif/esp32s3_devkitc/board.yml | 1 + boards/espressif/esp32s3_devkitm/board.yml | 1 + boards/espressif/esp32s3_eye/board.yml | 1 + boards/espressif/esp8684_devkitm/board.yml | 1 + boards/espressif/esp_wrover_kit/board.yml | 1 + boards/ezurio/bl5340_dvk/board.yml | 1 + boards/ezurio/bl652_dvk/board.yml | 1 + boards/ezurio/bl653_dvk/board.yml | 1 + boards/ezurio/bl654_dvk/board.yml | 1 + boards/ezurio/bl654_sensor_board/board.yml | 1 + boards/ezurio/bl654_usb/board.yml | 1 + boards/ezurio/bt510/board.yml | 1 + boards/ezurio/bt610/board.yml | 1 + boards/ezurio/mg100/board.yml | 1 + boards/ezurio/pinnacle_100_dvk/board.yml | 1 + boards/ezurio/rm1xx_dvk/board.yml | 1 + boards/fanke/fk7b0m1_vbt6/board.yml | 1 + boards/firefly/roc_rk3568_pc/board.yml | 1 + boards/franzininho/esp32s2_franzininho/board.yml | 1 + boards/gaisler/generic_leon3/board.yml | 1 + boards/gaisler/gr716a_mini/board.yml | 1 + boards/gd/gd32a503v_eval/board.yml | 1 + boards/gd/gd32e103v_eval/board.yml | 1 + boards/gd/gd32e507v_start/board.yml | 1 + boards/gd/gd32e507z_eval/board.yml | 1 + boards/gd/gd32f350r_eval/board.yml | 1 + boards/gd/gd32f403z_eval/board.yml | 1 + boards/gd/gd32f407v_start/board.yml | 1 + boards/gd/gd32f450i_eval/board.yml | 1 + boards/gd/gd32f450v_start/board.yml | 1 + boards/gd/gd32f450z_eval/board.yml | 1 + boards/gd/gd32f470i_eval/board.yml | 1 + boards/gd/gd32l233r_eval/board.yml | 1 + boards/gd/gd32vf103c_starter/board.yml | 1 + boards/gd/gd32vf103v_eval/board.yml | 1 + boards/google/dragonclaw/board.yml | 1 + boards/google/twinkie_v2/board.yml | 1 + boards/hardkernel/odroid_go/board.yml | 1 + boards/heltec/heltec_wifi_lora32_v2/board.yml | 1 + boards/heltec/heltec_wireless_stick_lite_v3/board.yml | 1 + boards/holyiot/yj16019/board.yml | 1 + boards/infineon/cy8ckit_062s4/board.yml | 1 + boards/infineon/cy8cproto_062_4343w/board.yml | 1 + boards/infineon/cy8cproto_063_ble/board.yml | 1 + boards/infineon/cyw920829m2evk_02/board.yml | 1 + boards/infineon/xmc45_relax_kit/board.yml | 1 + boards/infineon/xmc47_relax_kit/board.yml | 1 + boards/innblue/innblue21/board.yml | 1 + boards/innblue/innblue22/board.yml | 1 + boards/intel/adl/board.yml | 2 ++ boards/intel/adsp/board.yml | 1 + boards/intel/ehl/board.yml | 1 + boards/intel/ish/board.yml | 3 +++ boards/intel/niosv_g/board.yml | 1 + boards/intel/niosv_m/board.yml | 1 + boards/intel/rpl/board.yml | 2 ++ boards/intel/socfpga/agilex5_socdk/board.yml | 1 + boards/intel/socfpga/agilex_socdk/board.yml | 1 + boards/intel/socfpga_std/cyclonev_socdk/board.yml | 1 + boards/ite/it82xx2_evb/board.yml | 1 + boards/ite/it8xxx2_evb/board.yml | 1 + boards/khadas/edgev/board.yml | 1 + boards/kincony/kincony_kc868_a32/board.yml | 1 + boards/lilygo/ttgo_lora32/board.yml | 1 + boards/lilygo/ttgo_t8c3/board.yml | 1 + boards/lowrisc/opentitan_earlgrey/board.yml | 1 + boards/luatos/esp32c3_luatos_core/board.yml | 1 + boards/luatos/esp32s3_luatos_core/board.yml | 1 + boards/m5stack/m5stack_atom_lite/board.yml | 1 + boards/m5stack/m5stack_atoms3/board.yml | 1 + boards/m5stack/m5stack_atoms3_lite/board.yml | 1 + boards/m5stack/m5stack_core2/board.yml | 1 + boards/m5stack/m5stack_stamps3/board.yml | 1 + boards/m5stack/m5stickc_plus/board.yml | 1 + boards/m5stack/stamp_c3/board.yml | 1 + boards/madmachine/mm_feather/board.yml | 1 + boards/madmachine/mm_swiftio/board.yml | 1 + boards/makerdiary/nrf52832_mdk/board.yml | 1 + boards/makerdiary/nrf52840_mdk/board.yml | 1 + boards/makerdiary/nrf52840_mdk_usb_dongle/board.yml | 1 + boards/mediatek/mt8195_adsp/board.yml | 1 + boards/microchip/ev11l78a/board.yml | 1 + boards/microchip/m2gl025_miv/board.yml | 1 + boards/microchip/mec1501modular_assy6885/board.yml | 1 + boards/microchip/mec15xxevb_assy6853/board.yml | 1 + boards/microchip/mec172xevb_assy6906/board.yml | 1 + boards/microchip/mec172xmodular_assy6930/board.yml | 1 + boards/microchip/mpfs_icicle/board.yml | 1 + boards/mikroe/clicker_2/board.yml | 1 + boards/mikroe/clicker_ra4m1/board.yml | 1 + boards/mikroe/mini_m4_for_stm32/board.yml | 1 + boards/mikroe/stm32_m4_clicker/board.yml | 1 + boards/mxchip/az3166_iotdevkit/board.yml | 1 + boards/native/native_posix/board.yml | 1 + boards/native/native_sim/board.yml | 1 + boards/native/nrf_bsim/board.yml | 3 +++ boards/nordic/nrf21540dk/board.yml | 1 + boards/nordic/nrf51dk/board.yml | 1 + boards/nordic/nrf51dongle/board.yml | 1 + boards/nordic/nrf52833dk/board.yml | 1 + boards/nordic/nrf52840dk/board.yml | 1 + boards/nordic/nrf52840dongle/board.yml | 1 + boards/nordic/nrf52dk/board.yml | 1 + boards/nordic/nrf5340_audio_dk/board.yml | 1 + boards/nordic/nrf5340dk/board.yml | 1 + boards/nordic/nrf54h20dk/board.yml | 1 + boards/nordic/nrf54l15dk/board.yml | 1 + boards/nordic/nrf54l15pdk/board.yml | 1 + boards/nordic/nrf54l20pdk/board.yml | 1 + boards/nordic/nrf7002dk/board.yml | 1 + boards/nordic/nrf9131ek/board.yml | 1 + boards/nordic/nrf9151dk/board.yml | 1 + boards/nordic/nrf9160dk/board.yml | 1 + boards/nordic/nrf9161dk/board.yml | 1 + boards/nordic/nrf9280pdk/board.yml | 1 + boards/nordic/thingy52/board.yml | 1 + boards/nordic/thingy53/board.yml | 1 + boards/nuvoton/npcm400_evb/board.yml | 1 + boards/nuvoton/npcx4m8f_evb/board.yml | 1 + boards/nuvoton/npcx7m6fb_evb/board.yml | 1 + boards/nuvoton/npcx9m6f_evb/board.yml | 1 + boards/nuvoton/numaker_m2l31ki/board.yml | 1 + boards/nuvoton/numaker_pfm_m467/board.yml | 1 + boards/nuvoton/numaker_pfm_m487/board.yml | 1 + boards/nxp/frdm_k22f/board.yml | 1 + boards/nxp/frdm_k64f/board.yml | 1 + boards/nxp/frdm_k82f/board.yml | 1 + boards/nxp/frdm_ke15z/board.yml | 1 + boards/nxp/frdm_ke17z/board.yml | 1 + boards/nxp/frdm_ke17z512/board.yml | 1 + boards/nxp/frdm_kl25z/board.yml | 1 + boards/nxp/frdm_kw41z/board.yml | 1 + boards/nxp/frdm_mcxa156/board.yml | 1 + boards/nxp/frdm_mcxc242/board.yml | 1 + boards/nxp/frdm_mcxc444/board.yml | 1 + boards/nxp/frdm_mcxn236/board.yml | 1 + boards/nxp/frdm_mcxn947/board.yml | 1 + boards/nxp/frdm_mcxw71/board.yml | 1 + boards/nxp/frdm_rw612/board.yml | 1 + boards/nxp/hexiwear/board.yml | 1 + boards/nxp/imx8mm_evk/board.yml | 1 + boards/nxp/imx8mn_evk/board.yml | 1 + boards/nxp/imx8mp_evk/board.yml | 1 + boards/nxp/imx8mq_evk/board.yml | 1 + boards/nxp/imx8qm_mek/board.yml | 1 + boards/nxp/imx8qxp_mek/board.yml | 1 + boards/nxp/imx8ulp_evk/board.yml | 1 + boards/nxp/imx93_evk/board.yml | 1 + boards/nxp/imx95_evk/board.yml | 1 + boards/nxp/lpcxpresso11u68/board.yml | 1 + boards/nxp/lpcxpresso51u68/board.yml | 1 + boards/nxp/lpcxpresso54114/board.yml | 1 + boards/nxp/lpcxpresso55s06/board.yml | 1 + boards/nxp/lpcxpresso55s16/board.yml | 1 + boards/nxp/lpcxpresso55s28/board.yml | 1 + boards/nxp/lpcxpresso55s36/board.yml | 1 + boards/nxp/lpcxpresso55s69/board.yml | 1 + boards/nxp/ls1046ardb/board.yml | 1 + boards/nxp/mimxrt1010_evk/board.yml | 1 + boards/nxp/mimxrt1015_evk/board.yml | 1 + boards/nxp/mimxrt1020_evk/board.yml | 1 + boards/nxp/mimxrt1024_evk/board.yml | 1 + boards/nxp/mimxrt1040_evk/board.yml | 1 + boards/nxp/mimxrt1050_evk/board.yml | 1 + boards/nxp/mimxrt1060_evk/board.yml | 2 ++ boards/nxp/mimxrt1062_fmurt6/board.yml | 1 + boards/nxp/mimxrt1064_evk/board.yml | 1 + boards/nxp/mimxrt1160_evk/board.yml | 1 + boards/nxp/mimxrt1170_evk/board.yml | 1 + boards/nxp/mimxrt1180_evk/board.yml | 1 + boards/nxp/mimxrt595_evk/board.yml | 1 + boards/nxp/mimxrt685_evk/board.yml | 1 + boards/nxp/mr_canhubk3/board.yml | 1 + boards/nxp/rd_rw612_bga/board.yml | 1 + boards/nxp/rddrone_fmuk66/board.yml | 1 + boards/nxp/s32z2xxdc2/board.yml | 1 + boards/nxp/twr_ke18f/board.yml | 1 + boards/nxp/twr_kv58f220m/board.yml | 1 + boards/nxp/ucans32k1sic/board.yml | 1 + boards/nxp/usb_kw24d512/board.yml | 1 + boards/nxp/vmu_rt1170/board.yml | 1 + boards/olimex/lora_stm32wl_devkit/board.yml | 1 + boards/olimex/olimex_esp32_evb/board.yml | 1 + boards/olimex/olimexino_stm32/board.yml | 1 + boards/olimex/stm32_e407/board.yml | 1 + boards/olimex/stm32_h103/board.yml | 1 + boards/olimex/stm32_h405/board.yml | 1 + boards/olimex/stm32_h407/board.yml | 1 + boards/olimex/stm32_p405/board.yml | 1 + boards/openisa/rv32m1_vega/board.yml | 1 + boards/others/black_f407ve/board.yml | 1 + boards/others/black_f407zg_pro/board.yml | 1 + boards/others/icev_wireless/board.yml | 1 + boards/others/neorv32/board.yml | 1 + boards/others/serpente/board.yml | 1 + boards/others/stm32_min_dev/board.yml | 1 + boards/others/stm32f030_demo/board.yml | 1 + boards/others/stm32f103_mini/board.yml | 1 + boards/others/stm32f401_mini/board.yml | 1 + boards/panasonic/pan1770_evb/board.yml | 1 + boards/panasonic/pan1780_evb/board.yml | 1 + boards/panasonic/pan1781_evb/board.yml | 1 + boards/panasonic/pan1782_evb/board.yml | 1 + boards/panasonic/pan1783/board.yml | 3 +++ boards/particle/argon/board.yml | 1 + boards/particle/boron/board.yml | 1 + boards/particle/nrf51_blenano/board.yml | 1 + boards/particle/nrf52_blenano2/board.yml | 1 + boards/particle/xenon/board.yml | 1 + boards/phytec/mimx8mm_phyboard_polis/board.yml | 1 + boards/phytec/mimx8mp_phyboard_pollux/board.yml | 1 + boards/phytec/phyboard_electra/board.yml | 1 + boards/phytec/phyboard_lyra/board.yml | 1 + boards/phytec/reel_board/board.yml | 1 + boards/pine64/pinetime_devkit0/board.yml | 1 + boards/pjrc/teensy4/board.yml | 2 ++ boards/qemu/arc/board.yml | 1 + boards/qemu/cortex_a53/board.yml | 1 + boards/qemu/cortex_a9/board.yml | 1 + boards/qemu/cortex_m0/board.yml | 1 + boards/qemu/cortex_m3/board.yml | 1 + boards/qemu/cortex_r5/board.yml | 1 + boards/qemu/kvm_arm64/board.yml | 1 + boards/qemu/leon3/board.yml | 1 + boards/qemu/malta/board.yml | 1 + boards/qemu/nios2/board.yml | 1 + boards/qemu/riscv32/board.yml | 1 + boards/qemu/riscv32_xip/board.yml | 1 + boards/qemu/riscv32e/board.yml | 1 + boards/qemu/riscv64/board.yml | 1 + boards/qemu/x86/board.yml | 8 ++++---- boards/qemu/xtensa/board.yml | 1 + boards/qorvo/decawave_dwm1001_dev/board.yml | 1 + boards/quicklogic/qomu/board.yml | 1 + boards/quicklogic/quick_feather/board.yml | 1 + boards/rak/rak11720/board.yml | 1 + boards/rak/rak4631/board.yml | 1 + boards/rak/rak5010/board.yml | 1 + boards/raspberrypi/rpi_4b/board.yml | 1 + boards/raspberrypi/rpi_5/board.yml | 1 + boards/raspberrypi/rpi_pico/board.yml | 1 + boards/raytac/mdbt50q_db_33/board.yml | 1 + boards/raytac/mdbt50q_db_40/board.yml | 1 + boards/raytac/mdbt53_db_40/board.yml | 1 + boards/raytac/mdbt53v_db_40/board.yml | 1 + boards/renesas/da14695_dk_usb/board.yml | 1 + boards/renesas/da1469x_dk_pro/board.yml | 1 + boards/renesas/ek_ra2a1/board.yml | 1 + boards/renesas/ek_ra4e2/board.yml | 1 + boards/renesas/ek_ra4m2/board.yml | 1 + boards/renesas/ek_ra4m3/board.yml | 1 + boards/renesas/ek_ra4w1/board.yml | 1 + boards/renesas/ek_ra6e2/board.yml | 1 + boards/renesas/ek_ra6m1/board.yml | 1 + boards/renesas/ek_ra6m2/board.yml | 1 + boards/renesas/ek_ra6m3/board.yml | 1 + boards/renesas/ek_ra6m4/board.yml | 1 + boards/renesas/ek_ra6m5/board.yml | 1 + boards/renesas/ek_ra8d1/board.yml | 1 + boards/renesas/ek_ra8m1/board.yml | 1 + boards/renesas/fpb_ra6e1/board.yml | 1 + boards/renesas/fpb_ra6e2/board.yml | 1 + boards/renesas/mck_ra8t1/board.yml | 1 + boards/renesas/rcar_h3ulcb/board.yml | 1 + boards/renesas/rcar_salvator_x/board.yml | 1 + boards/renesas/rcar_salvator_xs/board.yml | 1 + boards/renesas/rcar_spider_s4/board.yml | 1 + boards/renesas/rzt2m_starterkit/board.yml | 1 + boards/renode/cortex_r8_virtual/board.yml | 1 + boards/renode/riscv32_virtual/board.yml | 1 + boards/ronoth/lodev/board.yml | 1 + boards/ruuvi/ruuvitag/board.yml | 1 + boards/sc/scobc_module1/board.yml | 1 + boards/seagate/faze/board.yml | 1 + boards/seagate/legend/board.yml | 1 + boards/seco/stm32f3_seco_d23/board.yml | 1 + boards/seeed/lora_e5_dev_board/board.yml | 1 + boards/seeed/lora_e5_mini/board.yml | 1 + boards/seeed/seeeduino_xiao/board.yml | 1 + boards/seeed/wio_terminal/board.yml | 1 + boards/seeed/xiao_ble/board.yml | 1 + boards/seeed/xiao_esp32c3/board.yml | 1 + boards/seeed/xiao_esp32s3/board.yml | 1 + boards/seeed/xiao_rp2040/board.yml | 1 + boards/segger/ip_k66f/board.yml | 1 + boards/segger/trb_stm32f407/board.yml | 1 + boards/sensry/ganymed_bob/board.yml | 1 + boards/sifive/hifive1/board.yml | 1 + boards/sifive/hifive_unleashed/board.yml | 1 + boards/sifive/hifive_unmatched/board.yml | 1 + boards/silabs/dev_kits/sim3u1xx_dk/board.yml | 1 + boards/silabs/dev_kits/sltb004a/board.yml | 1 + boards/silabs/dev_kits/sltb009a/board.yml | 1 + boards/silabs/dev_kits/sltb010a/board.yml | 1 + boards/silabs/dev_kits/xg24_dk2601b/board.yml | 1 + boards/silabs/dev_kits/xg27_dk2602a/board.yml | 1 + boards/silabs/radio_boards/slwrb4104a/board.yml | 1 + boards/silabs/radio_boards/slwrb4161a/board.yml | 1 + boards/silabs/radio_boards/slwrb4170a/board.yml | 1 + boards/silabs/radio_boards/slwrb4180a/board.yml | 1 + boards/silabs/radio_boards/slwrb4250b/board.yml | 1 + boards/silabs/radio_boards/slwrb4255a/board.yml | 1 + boards/silabs/radio_boards/slwrb4321a/board.yml | 1 + boards/silabs/radio_boards/xg24_rb4187c/board.yml | 1 + boards/silabs/starter_kits/efm32wg_stk3800/board.yml | 1 + boards/silabs/starter_kits/slstk3400a/board.yml | 1 + boards/silabs/starter_kits/slstk3401a/board.yml | 1 + boards/silabs/starter_kits/slstk3402a/board.yml | 1 + boards/silabs/starter_kits/slstk3701a/board.yml | 1 + boards/sipeed/longan_nano/board.yml | 1 + boards/snps/em_starterkit/board.yml | 1 + boards/snps/emsdp/board.yml | 1 + boards/snps/hsdk/board.yml | 1 + boards/snps/hsdk4xd/board.yml | 1 + boards/snps/iotdk/board.yml | 1 + boards/snps/nsim/arc_classic/board.yml | 1 + boards/snps/nsim/arc_v/board.yml | 1 + boards/sparkfun/micromod/board.yml | 1 + boards/sparkfun/nrf52_sparkfun/board.yml | 1 + boards/sparkfun/pro_micro_rp2040/board.yml | 1 + boards/sparkfun/red_v_things_plus/board.yml | 1 + boards/sparkfun/thing_plus/board.yml | 1 + boards/sparkfun/thing_plus_matter_mgm240p/board.yml | 1 + boards/st/b_g474e_dpow1/board.yml | 1 + boards/st/b_l072z_lrwan1/board.yml | 1 + boards/st/b_l4s5i_iot01a/board.yml | 1 + boards/st/b_u585i_iot02a/board.yml | 1 + boards/st/disco_l475_iot1/board.yml | 1 + boards/st/nucleo_c031c6/board.yml | 1 + boards/st/nucleo_f030r8/board.yml | 1 + boards/st/nucleo_f031k6/board.yml | 1 + boards/st/nucleo_f042k6/board.yml | 1 + boards/st/nucleo_f070rb/board.yml | 1 + boards/st/nucleo_f091rc/board.yml | 1 + boards/st/nucleo_f103rb/board.yml | 1 + boards/st/nucleo_f207zg/board.yml | 1 + boards/st/nucleo_f302r8/board.yml | 1 + boards/st/nucleo_f303k8/board.yml | 1 + boards/st/nucleo_f303re/board.yml | 1 + boards/st/nucleo_f334r8/board.yml | 1 + boards/st/nucleo_f401re/board.yml | 1 + boards/st/nucleo_f410rb/board.yml | 1 + boards/st/nucleo_f411re/board.yml | 1 + boards/st/nucleo_f412zg/board.yml | 1 + boards/st/nucleo_f413zh/board.yml | 1 + boards/st/nucleo_f429zi/board.yml | 1 + boards/st/nucleo_f446re/board.yml | 1 + boards/st/nucleo_f446ze/board.yml | 1 + boards/st/nucleo_f722ze/board.yml | 1 + boards/st/nucleo_f746zg/board.yml | 1 + boards/st/nucleo_f756zg/board.yml | 1 + boards/st/nucleo_f767zi/board.yml | 1 + boards/st/nucleo_g031k8/board.yml | 1 + boards/st/nucleo_g070rb/board.yml | 1 + boards/st/nucleo_g071rb/board.yml | 1 + boards/st/nucleo_g0b1re/board.yml | 1 + boards/st/nucleo_g431rb/board.yml | 1 + boards/st/nucleo_g474re/board.yml | 1 + boards/st/nucleo_h503rb/board.yml | 1 + boards/st/nucleo_h533re/board.yml | 1 + boards/st/nucleo_h563zi/board.yml | 1 + boards/st/nucleo_h723zg/board.yml | 1 + boards/st/nucleo_h743zi/board.yml | 1 + boards/st/nucleo_h745zi_q/board.yml | 1 + boards/st/nucleo_h753zi/board.yml | 1 + boards/st/nucleo_h755zi_q/board.yml | 1 + boards/st/nucleo_h7a3zi_q/board.yml | 1 + boards/st/nucleo_l011k4/board.yml | 1 + boards/st/nucleo_l031k6/board.yml | 1 + boards/st/nucleo_l053r8/board.yml | 1 + boards/st/nucleo_l073rz/board.yml | 1 + boards/st/nucleo_l152re/board.yml | 1 + boards/st/nucleo_l412rb_p/board.yml | 1 + boards/st/nucleo_l432kc/board.yml | 1 + boards/st/nucleo_l433rc_p/board.yml | 1 + boards/st/nucleo_l452re/board.yml | 1 + boards/st/nucleo_l476rg/board.yml | 1 + boards/st/nucleo_l496zg/board.yml | 1 + boards/st/nucleo_l4a6zg/board.yml | 1 + boards/st/nucleo_l4r5zi/board.yml | 1 + boards/st/nucleo_l552ze_q/board.yml | 1 + boards/st/nucleo_u031r8/board.yml | 1 + boards/st/nucleo_u083rc/board.yml | 1 + boards/st/nucleo_u575zi_q/board.yml | 1 + boards/st/nucleo_u5a5zj_q/board.yml | 1 + boards/st/nucleo_wb05kz/board.yml | 1 + boards/st/nucleo_wb09ke/board.yml | 1 + boards/st/nucleo_wb55rg/board.yml | 1 + boards/st/nucleo_wba52cg/board.yml | 1 + boards/st/nucleo_wba55cg/board.yml | 1 + boards/st/nucleo_wl55jc/board.yml | 1 + boards/st/sensortile_box/board.yml | 1 + boards/st/sensortile_box_pro/board.yml | 1 + boards/st/st25dv_mb1283_disco/board.yml | 1 + boards/st/steval_fcu001v1/board.yml | 1 + boards/st/steval_stwinbx1/board.yml | 1 + boards/st/stm3210c_eval/board.yml | 1 + boards/st/stm32373c_eval/board.yml | 1 + boards/st/stm32c0116_dk/board.yml | 1 + boards/st/stm32f072_eval/board.yml | 1 + boards/st/stm32f072b_disco/board.yml | 1 + boards/st/stm32f0_disco/board.yml | 1 + boards/st/stm32f3_disco/board.yml | 1 + boards/st/stm32f411e_disco/board.yml | 1 + boards/st/stm32f412g_disco/board.yml | 1 + boards/st/stm32f429i_disc1/board.yml | 1 + boards/st/stm32f469i_disco/board.yml | 1 + boards/st/stm32f4_disco/board.yml | 1 + boards/st/stm32f723e_disco/board.yml | 1 + boards/st/stm32f746g_disco/board.yml | 1 + boards/st/stm32f7508_dk/board.yml | 1 + boards/st/stm32f769i_disco/board.yml | 1 + boards/st/stm32g0316_disco/board.yml | 1 + boards/st/stm32g071b_disco/board.yml | 1 + boards/st/stm32g081b_eval/board.yml | 1 + boards/st/stm32h573i_dk/board.yml | 1 + boards/st/stm32h735g_disco/board.yml | 1 + boards/st/stm32h745i_disco/board.yml | 1 + boards/st/stm32h747i_disco/board.yml | 1 + boards/st/stm32h750b_dk/board.yml | 1 + boards/st/stm32h7b3i_dk/board.yml | 1 + boards/st/stm32h7s78_dk/board.yml | 1 + boards/st/stm32l1_disco/board.yml | 2 ++ boards/st/stm32l476g_disco/board.yml | 1 + boards/st/stm32l496g_disco/board.yml | 1 + boards/st/stm32l4r9i_disco/board.yml | 1 + boards/st/stm32l562e_dk/board.yml | 1 + boards/st/stm32mp157c_dk2/board.yml | 1 + boards/st/stm32u083c_dk/board.yml | 1 + boards/st/stm32u5a9j_dk/board.yml | 1 + boards/st/stm32vl_disco/board.yml | 1 + boards/st/stm32wb5mm_dk/board.yml | 1 + boards/st/stm32wb5mmg/board.yml | 1 + boards/starfive/visionfive2/board.yml | 1 + boards/tdk/robokit1/board.yml | 1 + boards/technexion/pico_pi/board.yml | 1 + boards/telink/tlsr9518adk80d/board.yml | 1 + boards/ti/cc1352p1_launchxl/board.yml | 1 + boards/ti/cc1352p7_launchpad/board.yml | 1 + boards/ti/cc1352r1_launchxl/board.yml | 1 + boards/ti/cc1352r_sensortag/board.yml | 1 + boards/ti/cc26x2r1_launchxl/board.yml | 1 + boards/ti/cc3220sf_launchxl/board.yml | 1 + boards/ti/cc3235sf_launchxl/board.yml | 1 + boards/ti/msp_exp432p401r_launchxl/board.yml | 1 + boards/ti/sk_am62/board.yml | 1 + boards/toradex/colibri_imx7d/board.yml | 1 + boards/toradex/verdin_imx8mp/board.yml | 1 + boards/u-blox/ubx_bmd300eval/board.yml | 1 + boards/u-blox/ubx_bmd330eval/board.yml | 1 + boards/u-blox/ubx_bmd340eval/board.yml | 1 + boards/u-blox/ubx_bmd345eval/board.yml | 1 + boards/u-blox/ubx_bmd360eval/board.yml | 1 + boards/u-blox/ubx_bmd380eval/board.yml | 1 + boards/u-blox/ubx_evkannab1/board.yml | 1 + boards/u-blox/ubx_evkninab1/board.yml | 1 + boards/u-blox/ubx_evkninab3/board.yml | 1 + boards/u-blox/ubx_evkninab4/board.yml | 1 + boards/udoo/udoo_neo_full/board.yml | 1 + boards/up-bridge-the-gap/up_squared/board.yml | 1 + boards/up-bridge-the-gap/up_squared_pro_7000/board.yml | 1 + boards/vcc-gnd/yd_esp32/board.yml | 1 + boards/vcc-gnd/yd_stm32h750vb/board.yml | 1 + boards/vngiotlab/nrf51_vbluno51/board.yml | 1 + boards/vngiotlab/nrf52_vbluno52/board.yml | 1 + boards/waveshare/esp32s3_touch_lcd_1_28/board.yml | 1 + boards/waveshare/nrf51_ble400/board.yml | 1 + boards/waveshare/open103z/board.yml | 1 + boards/we/ophelia1ev/board.yml | 1 + boards/we/proteus2ev/board.yml | 1 + boards/we/proteus3ev/board.yml | 1 + boards/weact/blackpill_f401cc/board.yml | 1 + boards/weact/blackpill_f401ce/board.yml | 1 + boards/weact/blackpill_f411ce/board.yml | 1 + boards/weact/mini_stm32h743/board.yml | 1 + boards/weact/stm32f405_core/board.yml | 1 + boards/weact/stm32g431_core/board.yml | 1 + boards/wemos/esp32s2_lolin_mini/board.yml | 1 + boards/witte/linum/board.yml | 1 + boards/wiznet/w5500_evb_pico/board.yml | 1 + boards/xen/xenvm/board.yml | 1 + 603 files changed, 619 insertions(+), 4 deletions(-) diff --git a/boards/01space/esp32c3_042_oled/board.yml b/boards/01space/esp32c3_042_oled/board.yml index 40b7b0f5816e3..35bcbdc0e604f 100644 --- a/boards/01space/esp32c3_042_oled/board.yml +++ b/boards/01space/esp32c3_042_oled/board.yml @@ -1,5 +1,6 @@ board: name: esp32c3_042_oled + full_name: ESP32C3 0.42 OLED vendor: 01space socs: - name: esp32c3 diff --git a/boards/96boards/aerocore2/board.yml b/boards/96boards/aerocore2/board.yml index 42c4b7cae9684..cc94ae0228302 100644 --- a/boards/96boards/aerocore2/board.yml +++ b/boards/96boards/aerocore2/board.yml @@ -1,5 +1,6 @@ board: name: 96b_aerocore2 + full_name: Aerocore2 vendor: 96boards socs: - name: stm32f427xx diff --git a/boards/96boards/argonkey/board.yml b/boards/96boards/argonkey/board.yml index 9e78ee2394a45..c142ce4d98cd7 100644 --- a/boards/96boards/argonkey/board.yml +++ b/boards/96boards/argonkey/board.yml @@ -1,5 +1,6 @@ board: name: 96b_argonkey + full_name: Argonkey vendor: 96boards socs: - name: stm32f412cx diff --git a/boards/96boards/avenger96/board.yml b/boards/96boards/avenger96/board.yml index 042bb6a472fbd..35f4e4b24f98a 100644 --- a/boards/96boards/avenger96/board.yml +++ b/boards/96boards/avenger96/board.yml @@ -1,5 +1,6 @@ board: name: 96b_avenger96 + full_name: Avenger96 vendor: 96boards socs: - name: stm32mp157cxx diff --git a/boards/96boards/carbon/board.yml b/boards/96boards/carbon/board.yml index 79101f957be32..28a04570b7a94 100644 --- a/boards/96boards/carbon/board.yml +++ b/boards/96boards/carbon/board.yml @@ -1,5 +1,6 @@ board: name: 96b_carbon + full_name: Carbon vendor: 96boards socs: - name: stm32f401xe diff --git a/boards/96boards/meerkat96/board.yml b/boards/96boards/meerkat96/board.yml index 48d60ae68884d..4e1425d035a14 100644 --- a/boards/96boards/meerkat96/board.yml +++ b/boards/96boards/meerkat96/board.yml @@ -1,5 +1,6 @@ board: name: 96b_meerkat96 + full_name: Meerkat96 vendor: 96boards socs: - name: mcimx7d diff --git a/boards/96boards/neonkey/board.yml b/boards/96boards/neonkey/board.yml index 214cdc883bb09..a9204af01c841 100644 --- a/boards/96boards/neonkey/board.yml +++ b/boards/96boards/neonkey/board.yml @@ -1,5 +1,6 @@ board: name: 96b_neonkey + full_name: Neonkey vendor: 96boards socs: - name: stm32f411xe diff --git a/boards/96boards/nitrogen/board.yml b/boards/96boards/nitrogen/board.yml index 279d2c63a66c9..8c3156c9c1906 100644 --- a/boards/96boards/nitrogen/board.yml +++ b/boards/96boards/nitrogen/board.yml @@ -1,5 +1,6 @@ board: name: 96b_nitrogen + full_name: Nitrogen vendor: 96boards socs: - name: nrf52832 diff --git a/boards/96boards/stm32_sensor_mez/board.yml b/boards/96boards/stm32_sensor_mez/board.yml index e410dcc9e65e8..19d96543563a6 100644 --- a/boards/96boards/stm32_sensor_mez/board.yml +++ b/boards/96boards/stm32_sensor_mez/board.yml @@ -1,5 +1,6 @@ board: name: 96b_stm32_sensor_mez + full_name: STM32 Sensor Mezzanine vendor: st socs: - name: stm32f446xx diff --git a/boards/96boards/wistrio/board.yml b/boards/96boards/wistrio/board.yml index 508c590a6b5ab..9cc1efae22e8e 100644 --- a/boards/96boards/wistrio/board.yml +++ b/boards/96boards/wistrio/board.yml @@ -1,5 +1,6 @@ board: name: 96b_wistrio + full_name: WisTrio vendor: 96boards socs: - name: stm32l151xba diff --git a/boards/aconno/acn52832/board.yml b/boards/aconno/acn52832/board.yml index 179637e1ded3c..3b7d75c68a274 100644 --- a/boards/aconno/acn52832/board.yml +++ b/boards/aconno/acn52832/board.yml @@ -1,5 +1,6 @@ board: name: acn52832 + full_name: acn52832 vendor: aconno socs: - name: nrf52832 diff --git a/boards/acrn/acrn/board.yml b/boards/acrn/acrn/board.yml index 4130a85b8f69b..dce367c0f96a5 100644 --- a/boards/acrn/acrn/board.yml +++ b/boards/acrn/acrn/board.yml @@ -1,9 +1,11 @@ boards: - name: acrn + full_name: ACRN hypervisor socs: - name: atom - name: acrn_ehl_crb + full_name: ACRN on EHL hypervisor socs: - name: elkhart_lake diff --git a/boards/actinius/icarus/board.yml b/boards/actinius/icarus/board.yml index 69d6aa457076d..9f5b6450cf9df 100644 --- a/boards/actinius/icarus/board.yml +++ b/boards/actinius/icarus/board.yml @@ -1,5 +1,6 @@ board: name: actinius_icarus + full_name: Icarus vendor: actinius socs: - name: nrf9160 diff --git a/boards/actinius/icarus_bee/board.yml b/boards/actinius/icarus_bee/board.yml index 653294a9cf58d..648306ed93c65 100644 --- a/boards/actinius/icarus_bee/board.yml +++ b/boards/actinius/icarus_bee/board.yml @@ -1,5 +1,6 @@ board: name: actinius_icarus_bee + full_name: Icarus Bee vendor: actinius socs: - name: nrf9160 diff --git a/boards/actinius/icarus_som/board.yml b/boards/actinius/icarus_som/board.yml index 9acf3b4fa5ed4..b3cf4ca8cb696 100644 --- a/boards/actinius/icarus_som/board.yml +++ b/boards/actinius/icarus_som/board.yml @@ -1,5 +1,6 @@ board: name: actinius_icarus_som + full_name: Icarus SoM vendor: actinius socs: - name: nrf9160 diff --git a/boards/actinius/icarus_som_dk/board.yml b/boards/actinius/icarus_som_dk/board.yml index 137f39705d1a1..9e5a596828eb2 100644 --- a/boards/actinius/icarus_som_dk/board.yml +++ b/boards/actinius/icarus_som_dk/board.yml @@ -1,5 +1,6 @@ board: name: actinius_icarus_som_dk + full_name: Icarus SoM DK vendor: actinius socs: - name: nrf9160 diff --git a/boards/adafruit/feather_m0_basic_proto/board.yml b/boards/adafruit/feather_m0_basic_proto/board.yml index cf9353bf78c6f..15ee020f8a671 100644 --- a/boards/adafruit/feather_m0_basic_proto/board.yml +++ b/boards/adafruit/feather_m0_basic_proto/board.yml @@ -1,5 +1,6 @@ board: name: adafruit_feather_m0_basic_proto + full_name: Feather M0 Basic Proto vendor: adafruit socs: - name: samd21g18a diff --git a/boards/adafruit/feather_m0_lora/board.yml b/boards/adafruit/feather_m0_lora/board.yml index b720fc95ffeb7..afef7ea91dfee 100644 --- a/boards/adafruit/feather_m0_lora/board.yml +++ b/boards/adafruit/feather_m0_lora/board.yml @@ -1,5 +1,6 @@ board: name: adafruit_feather_m0_lora + full_name: Feather M0 LoRa vendor: adafruit socs: - name: samd21g18a diff --git a/boards/adafruit/feather_nrf52840/board.yml b/boards/adafruit/feather_nrf52840/board.yml index 5841c2f4bf0ba..535b60d2f785c 100644 --- a/boards/adafruit/feather_nrf52840/board.yml +++ b/boards/adafruit/feather_nrf52840/board.yml @@ -1,5 +1,6 @@ board: name: adafruit_feather_nrf52840 + full_name: Feather nRF52840 (Express, Sense) vendor: adafruit socs: - name: nrf52840 diff --git a/boards/adafruit/feather_stm32f405/board.yml b/boards/adafruit/feather_stm32f405/board.yml index e30f5c0cbcff6..839cd4b24c33f 100644 --- a/boards/adafruit/feather_stm32f405/board.yml +++ b/boards/adafruit/feather_stm32f405/board.yml @@ -1,5 +1,6 @@ board: name: adafruit_feather_stm32f405 + full_name: Feather STM32F405 Express vendor: adafruit socs: - name: stm32f405xx diff --git a/boards/adafruit/grand_central_m4_express/board.yml b/boards/adafruit/grand_central_m4_express/board.yml index 92a48d1b2b325..4393f3040c71e 100644 --- a/boards/adafruit/grand_central_m4_express/board.yml +++ b/boards/adafruit/grand_central_m4_express/board.yml @@ -1,5 +1,6 @@ board: name: adafruit_grand_central_m4_express + full_name: Grand Central M4 Express vendor: adafruit socs: - name: samd51p20a diff --git a/boards/adafruit/itsybitsy/board.yml b/boards/adafruit/itsybitsy/board.yml index 484a68e348b8b..baf9310f83c91 100644 --- a/boards/adafruit/itsybitsy/board.yml +++ b/boards/adafruit/itsybitsy/board.yml @@ -1,5 +1,6 @@ board: name: adafruit_itsybitsy + full_name: ItsyBitsy nRF52840 vendor: adafruit socs: - name: nrf52840 diff --git a/boards/adafruit/itsybitsy_m4_express/board.yml b/boards/adafruit/itsybitsy_m4_express/board.yml index 7d295017fc9ef..31c9cd6354ef1 100644 --- a/boards/adafruit/itsybitsy_m4_express/board.yml +++ b/boards/adafruit/itsybitsy_m4_express/board.yml @@ -1,5 +1,6 @@ board: name: adafruit_itsybitsy_m4_express + full_name: ItsyBitsy M4 Express vendor: adafruit socs: - name: samd51g19a diff --git a/boards/adafruit/kb2040/board.yml b/boards/adafruit/kb2040/board.yml index 5fbe751090e70..39363e321aa94 100644 --- a/boards/adafruit/kb2040/board.yml +++ b/boards/adafruit/kb2040/board.yml @@ -1,5 +1,6 @@ board: name: adafruit_kb2040 + full_name: KB2040 vendor: adafruit socs: - name: rp2040 diff --git a/boards/adafruit/nrf52_adafruit_feather/board.yml b/boards/adafruit/nrf52_adafruit_feather/board.yml index a3d6b4274ce69..301d270465edb 100644 --- a/boards/adafruit/nrf52_adafruit_feather/board.yml +++ b/boards/adafruit/nrf52_adafruit_feather/board.yml @@ -1,5 +1,6 @@ board: name: nrf52_adafruit_feather + full_name: nRF52 Adafruit Feather vendor: adafruit socs: - name: nrf52832 diff --git a/boards/adafruit/qt_py_rp2040/board.yml b/boards/adafruit/qt_py_rp2040/board.yml index e07cab669c6db..ba0a3f89485c5 100644 --- a/boards/adafruit/qt_py_rp2040/board.yml +++ b/boards/adafruit/qt_py_rp2040/board.yml @@ -1,5 +1,6 @@ board: name: adafruit_qt_py_rp2040 + full_name: QT Py RP2040 vendor: adafruit socs: - name: rp2040 diff --git a/boards/adafruit/trinket_m0/board.yml b/boards/adafruit/trinket_m0/board.yml index 6d7a783ae3e3f..44b19bf565e0d 100644 --- a/boards/adafruit/trinket_m0/board.yml +++ b/boards/adafruit/trinket_m0/board.yml @@ -1,5 +1,6 @@ board: name: adafruit_trinket_m0 + full_name: Trinket M0 vendor: adafruit socs: - name: samd21e18a diff --git a/boards/adi/apard32690/board.yml b/boards/adi/apard32690/board.yml index 269b578934502..fc6aeac3b2475 100644 --- a/boards/adi/apard32690/board.yml +++ b/boards/adi/apard32690/board.yml @@ -3,6 +3,7 @@ board: name: apard32690 + full_name: AD-APARD32690-SL vendor: adi socs: - name: max32690 diff --git a/boards/adi/eval_adin1110ebz/board.yml b/boards/adi/eval_adin1110ebz/board.yml index e5af49e3f351f..27763c338c664 100644 --- a/boards/adi/eval_adin1110ebz/board.yml +++ b/boards/adi/eval_adin1110ebz/board.yml @@ -1,5 +1,6 @@ board: name: adi_eval_adin1110ebz + full_name: EVAL-ADIN1110EVB Evaluation board vendor: adi socs: - name: stm32l4s5xx diff --git a/boards/adi/eval_adin2111ebz/board.yml b/boards/adi/eval_adin2111ebz/board.yml index 0151d544acab4..d63f5c14edde9 100644 --- a/boards/adi/eval_adin2111ebz/board.yml +++ b/boards/adi/eval_adin2111ebz/board.yml @@ -1,5 +1,6 @@ board: name: adi_eval_adin2111ebz + full_name: EVAL-ADIN2111EVB Evaluation board vendor: adi socs: - name: stm32l4s5xx diff --git a/boards/adi/max32655evkit/board.yml b/boards/adi/max32655evkit/board.yml index 4824c6fe8e596..a3182fa647a7e 100644 --- a/boards/adi/max32655evkit/board.yml +++ b/boards/adi/max32655evkit/board.yml @@ -3,6 +3,7 @@ board: name: max32655evkit + full_name: MAX32655EVKIT vendor: adi socs: - name: max32655 diff --git a/boards/adi/max32655fthr/board.yml b/boards/adi/max32655fthr/board.yml index 087b51d8d958c..81c6e41ae329a 100644 --- a/boards/adi/max32655fthr/board.yml +++ b/boards/adi/max32655fthr/board.yml @@ -3,6 +3,7 @@ board: name: max32655fthr + full_name: MAX32655FTHR vendor: adi socs: - name: max32655 diff --git a/boards/adi/max32662evkit/board.yml b/boards/adi/max32662evkit/board.yml index 628de9d766874..66ba25e1175ba 100644 --- a/boards/adi/max32662evkit/board.yml +++ b/boards/adi/max32662evkit/board.yml @@ -3,6 +3,7 @@ board: name: max32662evkit + full_name: MAX32662EVKIT vendor: adi socs: - name: max32662 diff --git a/boards/adi/max32666evkit/board.yml b/boards/adi/max32666evkit/board.yml index 5d1beff771670..6cacbe69acf68 100644 --- a/boards/adi/max32666evkit/board.yml +++ b/boards/adi/max32666evkit/board.yml @@ -3,6 +3,7 @@ board: name: max32666evkit + full_name: MAX32666EVKIT vendor: adi socs: - name: max32666 diff --git a/boards/adi/max32666fthr/board.yml b/boards/adi/max32666fthr/board.yml index a071afb909eb3..a73062b5bfa6a 100644 --- a/boards/adi/max32666fthr/board.yml +++ b/boards/adi/max32666fthr/board.yml @@ -3,6 +3,7 @@ board: name: max32666fthr + full_name: MAX32666FTHR vendor: adi socs: - name: max32666 diff --git a/boards/adi/max32670evkit/board.yml b/boards/adi/max32670evkit/board.yml index 1d0aabb39545d..530810b3be9b8 100644 --- a/boards/adi/max32670evkit/board.yml +++ b/boards/adi/max32670evkit/board.yml @@ -3,6 +3,7 @@ board: name: max32670evkit + full_name: MAX32670EVKIT vendor: adi socs: - name: max32670 diff --git a/boards/adi/max32672evkit/board.yml b/boards/adi/max32672evkit/board.yml index 5df99f681bf3c..cd2e29f832c81 100644 --- a/boards/adi/max32672evkit/board.yml +++ b/boards/adi/max32672evkit/board.yml @@ -3,6 +3,7 @@ board: name: max32672evkit + full_name: MAX32672EVKIT vendor: adi socs: - name: max32672 diff --git a/boards/adi/max32672fthr/board.yml b/boards/adi/max32672fthr/board.yml index c99d16ad4a1f3..aa19cea260924 100644 --- a/boards/adi/max32672fthr/board.yml +++ b/boards/adi/max32672fthr/board.yml @@ -3,6 +3,7 @@ board: name: max32672fthr + full_name: MAX32672FTHR vendor: adi socs: - name: max32672 diff --git a/boards/adi/max32675evkit/board.yml b/boards/adi/max32675evkit/board.yml index d51c7284c7f40..59ca667e03b8c 100644 --- a/boards/adi/max32675evkit/board.yml +++ b/boards/adi/max32675evkit/board.yml @@ -3,6 +3,7 @@ board: name: max32675evkit + full_name: MAX32675EVKIT vendor: adi socs: - name: max32675 diff --git a/boards/adi/max32680evkit/board.yml b/boards/adi/max32680evkit/board.yml index 23b5102a97fdb..11cb8a55c09c9 100644 --- a/boards/adi/max32680evkit/board.yml +++ b/boards/adi/max32680evkit/board.yml @@ -3,6 +3,7 @@ board: name: max32680evkit + full_name: MAX32680EVKIT vendor: adi socs: - name: max32680 diff --git a/boards/adi/max32690evkit/board.yml b/boards/adi/max32690evkit/board.yml index 53f531e193b8e..b5d3be3c679e5 100644 --- a/boards/adi/max32690evkit/board.yml +++ b/boards/adi/max32690evkit/board.yml @@ -3,6 +3,7 @@ board: name: max32690evkit + full_name: MAX32690EVKIT vendor: adi socs: - name: max32690 diff --git a/boards/adi/max32690fthr/board.yml b/boards/adi/max32690fthr/board.yml index 328035bdccd31..b97f7e0e6ac81 100644 --- a/boards/adi/max32690fthr/board.yml +++ b/boards/adi/max32690fthr/board.yml @@ -3,6 +3,7 @@ board: name: max32690fthr + full_name: MAX32690FTHR vendor: adi socs: - name: max32690 diff --git a/boards/adi/sdp_k1/board.yml b/boards/adi/sdp_k1/board.yml index c659c3b14c8e9..26b2e819276d7 100644 --- a/boards/adi/sdp_k1/board.yml +++ b/boards/adi/sdp_k1/board.yml @@ -1,5 +1,6 @@ board: name: adi_sdp_k1 + full_name: SDP-K1 vendor: adi socs: - name: stm32f469xx diff --git a/boards/alientek/pandora_stm32l475/board.yml b/boards/alientek/pandora_stm32l475/board.yml index 725d13c5f305a..1cb4fd9a9ffab 100644 --- a/boards/alientek/pandora_stm32l475/board.yml +++ b/boards/alientek/pandora_stm32l475/board.yml @@ -1,5 +1,6 @@ board: name: pandora_stm32l475 + full_name: STM32L475 Pandora vendor: alientek socs: - name: stm32l475xx diff --git a/boards/altr/max10/board.yml b/boards/altr/max10/board.yml index 976a0f83a80b4..9106b7e15ec0b 100644 --- a/boards/altr/max10/board.yml +++ b/boards/altr/max10/board.yml @@ -1,5 +1,6 @@ board: name: altera_max10 + full_name: MAX10 vendor: altr socs: - name: zephyr_nios2f diff --git a/boards/ambiq/apollo3_evb/board.yml b/boards/ambiq/apollo3_evb/board.yml index 8c3925245c3ce..9e3a5bd53049a 100644 --- a/boards/ambiq/apollo3_evb/board.yml +++ b/boards/ambiq/apollo3_evb/board.yml @@ -1,5 +1,6 @@ board: name: apollo3_evb + full_name: Apollo3 Blue EVB vendor: ambiq socs: - name: apollo3_blue diff --git a/boards/ambiq/apollo3p_evb/board.yml b/boards/ambiq/apollo3p_evb/board.yml index 507a85548b090..b6de5218ca8a2 100644 --- a/boards/ambiq/apollo3p_evb/board.yml +++ b/boards/ambiq/apollo3p_evb/board.yml @@ -1,5 +1,6 @@ board: name: apollo3p_evb + full_name: Apollo3 Blue Plus EVB vendor: ambiq socs: - name: apollo3p_blue diff --git a/boards/ambiq/apollo4p_blue_kxr_evb/board.yml b/boards/ambiq/apollo4p_blue_kxr_evb/board.yml index 16a9a6cc97992..ff5f376877475 100644 --- a/boards/ambiq/apollo4p_blue_kxr_evb/board.yml +++ b/boards/ambiq/apollo4p_blue_kxr_evb/board.yml @@ -1,5 +1,6 @@ board: name: apollo4p_blue_kxr_evb + full_name: Apollo4 Blue Plus KXR EVB vendor: ambiq socs: - name: apollo4p_blue diff --git a/boards/ambiq/apollo4p_evb/board.yml b/boards/ambiq/apollo4p_evb/board.yml index 023487c3ecdcc..1716e415cd691 100644 --- a/boards/ambiq/apollo4p_evb/board.yml +++ b/boards/ambiq/apollo4p_evb/board.yml @@ -1,5 +1,6 @@ board: name: apollo4p_evb + full_name: Apollo4P EVB vendor: ambiq socs: - name: apollo4p diff --git a/boards/amd/kv260_r5/board.yml b/boards/amd/kv260_r5/board.yml index 9e43962bfc35c..da3d08a19c0c6 100644 --- a/boards/amd/kv260_r5/board.yml +++ b/boards/amd/kv260_r5/board.yml @@ -1,5 +1,6 @@ board: name: kv260_r5 + full_name: KV260 Development Board RPU Cortex-R5 vendor: amd socs: - name: zynqmp_rpu diff --git a/boards/andestech/adp_xc7k_ae350/board.yml b/boards/andestech/adp_xc7k_ae350/board.yml index 09ade0170f32b..7c8ace7d5a017 100644 --- a/boards/andestech/adp_xc7k_ae350/board.yml +++ b/boards/andestech/adp_xc7k_ae350/board.yml @@ -1,5 +1,6 @@ board: name: adp_xc7k + full_name: ADP-XC7K AE350 vendor: andestech socs: - name: ae350 diff --git a/boards/arduino/due/board.yml b/boards/arduino/due/board.yml index 351bc719a1537..5c7cc70713776 100644 --- a/boards/arduino/due/board.yml +++ b/boards/arduino/due/board.yml @@ -1,5 +1,6 @@ board: name: arduino_due + full_name: Arduino Due vendor: arduino socs: - name: sam3x8e diff --git a/boards/arduino/giga_r1/board.yml b/boards/arduino/giga_r1/board.yml index 3079c2f0d5c85..cfafa1282fd2b 100644 --- a/boards/arduino/giga_r1/board.yml +++ b/boards/arduino/giga_r1/board.yml @@ -1,5 +1,6 @@ board: name: arduino_giga_r1 + full_name: Arduino GIGA R1 WiFi vendor: arduino socs: - name: stm32h747xx diff --git a/boards/arduino/mkrzero/board.yml b/boards/arduino/mkrzero/board.yml index a53c04cbd182d..776deeb6c2359 100644 --- a/boards/arduino/mkrzero/board.yml +++ b/boards/arduino/mkrzero/board.yml @@ -1,5 +1,6 @@ board: name: arduino_mkrzero + full_name: Arduino MKR Zero vendor: arduino socs: - name: samd21g18a diff --git a/boards/arduino/nano_33_ble/board.yml b/boards/arduino/nano_33_ble/board.yml index 919864839ed04..b1cbb7a9212b2 100644 --- a/boards/arduino/nano_33_ble/board.yml +++ b/boards/arduino/nano_33_ble/board.yml @@ -1,5 +1,6 @@ board: name: arduino_nano_33_ble + full_name: Arduino Nano 33 BLE (Sense) vendor: arduino socs: - name: nrf52840 diff --git a/boards/arduino/nano_33_iot/board.yml b/boards/arduino/nano_33_iot/board.yml index 63b7dab7992ec..56977e0f6e817 100644 --- a/boards/arduino/nano_33_iot/board.yml +++ b/boards/arduino/nano_33_iot/board.yml @@ -1,5 +1,6 @@ board: name: arduino_nano_33_iot + full_name: Arduino Nano 33 IOT vendor: arduino socs: - name: samd21g18a diff --git a/boards/arduino/nicla_sense_me/board.yml b/boards/arduino/nicla_sense_me/board.yml index 0a470e79ce578..583982638827c 100644 --- a/boards/arduino/nicla_sense_me/board.yml +++ b/boards/arduino/nicla_sense_me/board.yml @@ -1,5 +1,6 @@ board: name: arduino_nicla_sense_me + full_name: Arduino Nicla Sense ME vendor: arduino socs: - name: nrf52832 diff --git a/boards/arduino/nicla_vision/board.yml b/boards/arduino/nicla_vision/board.yml index 660cb3ca8aa25..90b90977ae3c3 100644 --- a/boards/arduino/nicla_vision/board.yml +++ b/boards/arduino/nicla_vision/board.yml @@ -1,5 +1,6 @@ board: name: arduino_nicla_vision + full_name: Arduino Nicla Vision vendor: arduino socs: - name: stm32h747xx diff --git a/boards/arduino/opta/board.yml b/boards/arduino/opta/board.yml index c572627b3488e..013bfa1c06eec 100644 --- a/boards/arduino/opta/board.yml +++ b/boards/arduino/opta/board.yml @@ -1,5 +1,6 @@ board: name: arduino_opta + full_name: Arduino OPTA vendor: arduino socs: - name: stm32h747xx diff --git a/boards/arduino/portenta_h7/board.yml b/boards/arduino/portenta_h7/board.yml index 01e28f0b5fdf0..fbea7ec271aab 100644 --- a/boards/arduino/portenta_h7/board.yml +++ b/boards/arduino/portenta_h7/board.yml @@ -1,5 +1,6 @@ board: name: arduino_portenta_h7 + full_name: Arduino Portenta H7 vendor: arduino socs: - name: stm32h747xx diff --git a/boards/arduino/uno_r4/board.yml b/boards/arduino/uno_r4/board.yml index 8286850b76c96..9c168c300c223 100644 --- a/boards/arduino/uno_r4/board.yml +++ b/boards/arduino/uno_r4/board.yml @@ -1,9 +1,11 @@ boards: - name: arduino_uno_r4_minima + full_name: Arduino UNO R4 Minima vendor: arduino socs: - name: r7fa4m1ab3cfm - name: arduino_uno_r4_wifi + full_name: Arduino UNO R4 WiFi vendor: arduino socs: - name: r7fa4m1ab3cfm diff --git a/boards/arduino/zero/board.yml b/boards/arduino/zero/board.yml index 86d4a97c1129b..495bca3dace90 100644 --- a/boards/arduino/zero/board.yml +++ b/boards/arduino/zero/board.yml @@ -1,5 +1,6 @@ board: name: arduino_zero + full_name: Arduino/Genuino Zero vendor: arduino socs: - name: samd21g18a diff --git a/boards/arm/fvp_base_revc_2xaemv8a/board.yml b/boards/arm/fvp_base_revc_2xaemv8a/board.yml index 8c881c9d86a8a..3af023b670ec9 100644 --- a/boards/arm/fvp_base_revc_2xaemv8a/board.yml +++ b/boards/arm/fvp_base_revc_2xaemv8a/board.yml @@ -1,5 +1,6 @@ board: name: fvp_base_revc_2xaemv8a + full_name: BASE RevC AEMv8A Fixed Virtual Platforms vendor: arm socs: - name: fvp_base_revc_2xaemv8a diff --git a/boards/arm/fvp_baser_aemv8r/board.yml b/boards/arm/fvp_baser_aemv8r/board.yml index f80eb3a6ed096..a11d3e008115e 100644 --- a/boards/arm/fvp_baser_aemv8r/board.yml +++ b/boards/arm/fvp_baser_aemv8r/board.yml @@ -1,5 +1,6 @@ board: name: fvp_baser_aemv8r + full_name: Debug with Arm DS vendor: arm socs: - name: fvp_aemv8r_aarch64 diff --git a/boards/arm/mps2/board.yml b/boards/arm/mps2/board.yml index a069852c1c60f..779a8ed21cc7c 100644 --- a/boards/arm/mps2/board.yml +++ b/boards/arm/mps2/board.yml @@ -1,5 +1,6 @@ board: name: mps2 + full_name: V2M MPS2 vendor: arm socs: - name: an385 diff --git a/boards/arm/mps3/board.yml b/boards/arm/mps3/board.yml index 5ee7ed7c03789..9eea26dc244b1 100644 --- a/boards/arm/mps3/board.yml +++ b/boards/arm/mps3/board.yml @@ -1,5 +1,6 @@ board: name: mps3 + full_name: MPS3 AN547 vendor: arm socs: - name: 'an547' diff --git a/boards/arm/v2m_beetle/board.yml b/boards/arm/v2m_beetle/board.yml index b19e9bfec75b7..9104c0335ccc2 100644 --- a/boards/arm/v2m_beetle/board.yml +++ b/boards/arm/v2m_beetle/board.yml @@ -1,5 +1,6 @@ board: name: v2m_beetle + full_name: V2M Beetle vendor: arm socs: - name: beetle_r0 diff --git a/boards/arm/v2m_musca_b1/board.yml b/boards/arm/v2m_musca_b1/board.yml index 47cebc33bb14d..40d16232d90d3 100644 --- a/boards/arm/v2m_musca_b1/board.yml +++ b/boards/arm/v2m_musca_b1/board.yml @@ -1,5 +1,6 @@ board: name: v2m_musca_b1 + full_name: V2M Musca B1 vendor: arm socs: - name: musca_b1 diff --git a/boards/arm/v2m_musca_s1/board.yml b/boards/arm/v2m_musca_s1/board.yml index a7a3e18358d7c..8cbc49ca31e5c 100644 --- a/boards/arm/v2m_musca_s1/board.yml +++ b/boards/arm/v2m_musca_s1/board.yml @@ -1,5 +1,6 @@ board: name: v2m_musca_s1 + full_name: V2M Musca-S1 vendor: arm socs: - name: musca_s1 diff --git a/boards/aspeed/ast1030_evb/board.yml b/boards/aspeed/ast1030_evb/board.yml index e129a899425da..002da5215bff1 100644 --- a/boards/aspeed/ast1030_evb/board.yml +++ b/boards/aspeed/ast1030_evb/board.yml @@ -1,5 +1,6 @@ board: name: ast1030_evb + full_name: AST1030_EVB vendor: aspeed socs: - name: ast1030 diff --git a/boards/atmarktechno/degu_evk/board.yml b/boards/atmarktechno/degu_evk/board.yml index 19859fc1e7de4..483521e3a3673 100644 --- a/boards/atmarktechno/degu_evk/board.yml +++ b/boards/atmarktechno/degu_evk/board.yml @@ -1,5 +1,6 @@ board: name: degu_evk + full_name: Degu Evaluation Kit vendor: atmarktechno socs: - name: nrf52840 diff --git a/boards/atmel/sam/sam4e_xpro/board.yml b/boards/atmel/sam/sam4e_xpro/board.yml index 017a22d62cdc5..52c0e9e8dee89 100644 --- a/boards/atmel/sam/sam4e_xpro/board.yml +++ b/boards/atmel/sam/sam4e_xpro/board.yml @@ -1,5 +1,6 @@ board: name: sam4e_xpro + full_name: SAM4E Xplained Pro vendor: atmel socs: - name: sam4e16e diff --git a/boards/atmel/sam/sam4l_ek/board.yml b/boards/atmel/sam/sam4l_ek/board.yml index 7045ba351ce08..02dbed9f7e1c0 100644 --- a/boards/atmel/sam/sam4l_ek/board.yml +++ b/boards/atmel/sam/sam4l_ek/board.yml @@ -1,5 +1,6 @@ board: name: sam4l_ek + full_name: SAM4L-EK vendor: atmel socs: - name: sam4lc4c diff --git a/boards/atmel/sam/sam4s_xplained/board.yml b/boards/atmel/sam/sam4s_xplained/board.yml index c406301245ba1..0bbbe3a05909b 100644 --- a/boards/atmel/sam/sam4s_xplained/board.yml +++ b/boards/atmel/sam/sam4s_xplained/board.yml @@ -1,5 +1,6 @@ board: name: sam4s_xplained + full_name: SAM4S Xplained vendor: atmel socs: - name: sam4s16c diff --git a/boards/atmel/sam/sam_e70_xplained/board.yml b/boards/atmel/sam/sam_e70_xplained/board.yml index 1308363814ac1..905bcdf188751 100644 --- a/boards/atmel/sam/sam_e70_xplained/board.yml +++ b/boards/atmel/sam/sam_e70_xplained/board.yml @@ -1,5 +1,6 @@ board: name: sam_e70_xplained + full_name: SAM E70(B) Xplained vendor: atmel socs: - name: same70q21 diff --git a/boards/atmel/sam/sam_v71_xult/board.yml b/boards/atmel/sam/sam_v71_xult/board.yml index 68996e0648586..2cf3c436ecb8b 100644 --- a/boards/atmel/sam/sam_v71_xult/board.yml +++ b/boards/atmel/sam/sam_v71_xult/board.yml @@ -1,5 +1,6 @@ board: name: sam_v71_xult + full_name: SAM V71(B) Xplained Ultra vendor: atmel socs: - name: samv71q21 diff --git a/boards/atmel/sam0/samc21n_xpro/board.yml b/boards/atmel/sam0/samc21n_xpro/board.yml index 2037cde2398a2..72ab82fecd86a 100644 --- a/boards/atmel/sam0/samc21n_xpro/board.yml +++ b/boards/atmel/sam0/samc21n_xpro/board.yml @@ -1,5 +1,6 @@ board: name: samc21n_xpro + full_name: SAM C21N Xplained Pro Evaluation Kit vendor: atmel socs: - name: samc21n18a diff --git a/boards/atmel/sam0/samd20_xpro/board.yml b/boards/atmel/sam0/samd20_xpro/board.yml index c6c44e378302b..b9b4f5f91c1ef 100644 --- a/boards/atmel/sam0/samd20_xpro/board.yml +++ b/boards/atmel/sam0/samd20_xpro/board.yml @@ -1,5 +1,6 @@ board: name: samd20_xpro + full_name: SAM D20 Xplained Pro Evaluation Kit vendor: atmel socs: - name: samd20j18 diff --git a/boards/atmel/sam0/samd21_xpro/board.yml b/boards/atmel/sam0/samd21_xpro/board.yml index d4fd578dd3564..80a77b66591b3 100644 --- a/boards/atmel/sam0/samd21_xpro/board.yml +++ b/boards/atmel/sam0/samd21_xpro/board.yml @@ -1,5 +1,6 @@ board: name: samd21_xpro + full_name: SAM D21 Xplained Pro Evaluation Kit vendor: atmel socs: - name: samd21j18a diff --git a/boards/atmel/sam0/same54_xpro/board.yml b/boards/atmel/sam0/same54_xpro/board.yml index d10fef7e7b7d9..5f9db4f9cac20 100644 --- a/boards/atmel/sam0/same54_xpro/board.yml +++ b/boards/atmel/sam0/same54_xpro/board.yml @@ -1,5 +1,6 @@ board: name: same54_xpro + full_name: SAM E54 Xplained Pro Evaluation Kit vendor: atmel socs: - name: same54p20a diff --git a/boards/atmel/sam0/saml21_xpro/board.yml b/boards/atmel/sam0/saml21_xpro/board.yml index 10e2284d58bdf..84e7735c20891 100644 --- a/boards/atmel/sam0/saml21_xpro/board.yml +++ b/boards/atmel/sam0/saml21_xpro/board.yml @@ -1,5 +1,6 @@ board: name: saml21_xpro + full_name: SAM L21 Xplained Pro Evaluation Kit vendor: atmel socs: - name: saml21j18b diff --git a/boards/atmel/sam0/samr21_xpro/board.yml b/boards/atmel/sam0/samr21_xpro/board.yml index c56b60ffc6f45..c84a465484a9c 100644 --- a/boards/atmel/sam0/samr21_xpro/board.yml +++ b/boards/atmel/sam0/samr21_xpro/board.yml @@ -1,5 +1,6 @@ board: name: samr21_xpro + full_name: SAM R21 Xplained Pro Evaluation Kit vendor: atmel socs: - name: samr21g18a diff --git a/boards/atmel/sam0/samr34_xpro/board.yml b/boards/atmel/sam0/samr34_xpro/board.yml index 39df0e0451b64..22e7d8ba93aec 100644 --- a/boards/atmel/sam0/samr34_xpro/board.yml +++ b/boards/atmel/sam0/samr34_xpro/board.yml @@ -1,5 +1,6 @@ board: name: samr34_xpro + full_name: SAM R34 Xplained Pro Evaluation Kit vendor: atmel socs: - name: samr34j18b diff --git a/boards/bbc/microbit/board.yml b/boards/bbc/microbit/board.yml index 3983adf061e37..228452b8afc19 100644 --- a/boards/bbc/microbit/board.yml +++ b/boards/bbc/microbit/board.yml @@ -1,5 +1,6 @@ board: name: bbc_microbit + full_name: "micro:bit" vendor: bbc socs: - name: nrf51822 diff --git a/boards/bbc/microbit_v2/board.yml b/boards/bbc/microbit_v2/board.yml index 1355002a7d1fb..11ceee1298017 100644 --- a/boards/bbc/microbit_v2/board.yml +++ b/boards/bbc/microbit_v2/board.yml @@ -1,5 +1,6 @@ board: name: bbc_microbit_v2 + full_name: "micro:bit V2" vendor: bbc socs: - name: nrf52833 diff --git a/boards/bcdevices/plt_demo_v2/board.yml b/boards/bcdevices/plt_demo_v2/board.yml index 2d0c58bf62834..f95af32a2acdd 100644 --- a/boards/bcdevices/plt_demo_v2/board.yml +++ b/boards/bcdevices/plt_demo_v2/board.yml @@ -1,5 +1,6 @@ board: name: blueclover_plt_demo_v2 + full_name: Blue Clover PLT Demo V2 nRF52832 vendor: bcdevices socs: - name: nrf52832 diff --git a/boards/beagle/beagleconnect_freedom/board.yml b/boards/beagle/beagleconnect_freedom/board.yml index a0d11fb2410fe..b7ce3ced0a0fb 100644 --- a/boards/beagle/beagleconnect_freedom/board.yml +++ b/boards/beagle/beagleconnect_freedom/board.yml @@ -1,5 +1,6 @@ board: name: beagleconnect_freedom + full_name: BeagleConnect Freedom vendor: beagle socs: - name: cc1352p7 diff --git a/boards/beagle/beagleplay/board.yml b/boards/beagle/beagleplay/board.yml index b412fda0ef3a7..bd63c308242d8 100644 --- a/boards/beagle/beagleplay/board.yml +++ b/boards/beagle/beagleplay/board.yml @@ -1,5 +1,6 @@ board: name: beagleplay + full_name: BeaglePlay (CC1352) vendor: beagle socs: - name: cc1352p7 diff --git a/boards/beagle/beaglev_fire/board.yml b/boards/beagle/beaglev_fire/board.yml index 6052030113413..7275bd7aafdb8 100644 --- a/boards/beagle/beaglev_fire/board.yml +++ b/boards/beagle/beaglev_fire/board.yml @@ -1,5 +1,6 @@ board: name: beaglev_fire + full_name: BeagleV®-Fire vendor: beagle socs: - name: polarfire diff --git a/boards/blues/swan_r5/board.yml b/boards/blues/swan_r5/board.yml index d9d4096e352a4..48db6d2a4e7c3 100644 --- a/boards/blues/swan_r5/board.yml +++ b/boards/blues/swan_r5/board.yml @@ -1,5 +1,6 @@ board: name: swan_r5 + full_name: Swan vendor: blues socs: - name: stm32l4r5xx diff --git a/boards/brcm/bcm958401m2/board.yml b/boards/brcm/bcm958401m2/board.yml index 06c116fe825c6..ac55cec0fe95a 100644 --- a/boards/brcm/bcm958401m2/board.yml +++ b/boards/brcm/bcm958401m2/board.yml @@ -1,5 +1,6 @@ board: name: bcm958401m2 + full_name: BCM958401M2 vendor: brcm socs: - name: bcm58400 diff --git a/boards/brcm/bcm958402m2/board.yml b/boards/brcm/bcm958402m2/board.yml index e9ad1770ed577..85a0692a3f79f 100644 --- a/boards/brcm/bcm958402m2/board.yml +++ b/boards/brcm/bcm958402m2/board.yml @@ -1,5 +1,6 @@ board: name: bcm958402m2 + full_name: BCM958402M2 (Cortex-M7) vendor: brcm socs: - name: bcm58402 diff --git a/boards/bytesatwork/bytesensi_l/board.yml b/boards/bytesatwork/bytesensi_l/board.yml index 04e4cd9ad1153..b3c88c01c84d9 100644 --- a/boards/bytesatwork/bytesensi_l/board.yml +++ b/boards/bytesatwork/bytesensi_l/board.yml @@ -2,6 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 board: name: bytesensi_l + full_name: byteSENSI-L vendor: bytesatwork socs: - name: nrf52832 diff --git a/boards/cdns/xt-sim/board.yml b/boards/cdns/xt-sim/board.yml index d162e416a3bc0..b3a0b332df06a 100644 --- a/boards/cdns/xt-sim/board.yml +++ b/boards/cdns/xt-sim/board.yml @@ -1,5 +1,6 @@ board: name: xt-sim + full_name: Xtensa simulator vendor: cdns socs: - name: xtensa_sample_controller diff --git a/boards/circuitdojo/feather/board.yml b/boards/circuitdojo/feather/board.yml index 0eb6ff5c4c0ad..19758e27b6bdf 100644 --- a/boards/circuitdojo/feather/board.yml +++ b/boards/circuitdojo/feather/board.yml @@ -1,5 +1,6 @@ board: name: circuitdojo_feather + full_name: nRF9160 Feather vendor: circuitdojo socs: - name: nrf9160 diff --git a/boards/contextualelectronics/abc/board.yml b/boards/contextualelectronics/abc/board.yml index 5c921f0525677..6209af4e9c460 100644 --- a/boards/contextualelectronics/abc/board.yml +++ b/boards/contextualelectronics/abc/board.yml @@ -1,5 +1,6 @@ board: name: contextualelectronics_abc + full_name: Advanced BLE Cell vendor: contextualelectronics socs: - name: nrf52840 diff --git a/boards/croxel/croxel_cx1825/board.yml b/boards/croxel/croxel_cx1825/board.yml index eed390e4a2c09..8c32a6c2acd01 100644 --- a/boards/croxel/croxel_cx1825/board.yml +++ b/boards/croxel/croxel_cx1825/board.yml @@ -1,5 +1,6 @@ board: name: croxel_cx1825 + full_name: CX1825 nRF52840 vendor: croxel socs: - name: nrf52840 diff --git a/boards/ct/ctcc/board.yml b/boards/ct/ctcc/board.yml index 780a02f7e7c14..b6212047d79f3 100644 --- a/boards/ct/ctcc/board.yml +++ b/boards/ct/ctcc/board.yml @@ -1,4 +1,5 @@ board: name: ctcc + full_name: Connectivity Card nRF52840 socs: - name: nrf52840 diff --git a/boards/cypress/cy8ckit_062_ble/board.yml b/boards/cypress/cy8ckit_062_ble/board.yml index f0b1325911a46..8640f1e7d980b 100644 --- a/boards/cypress/cy8ckit_062_ble/board.yml +++ b/boards/cypress/cy8ckit_062_ble/board.yml @@ -1,5 +1,6 @@ board: name: cy8ckit_062_ble + full_name: PSoC63 BLE Pioneer Kit vendor: cypress revision: format: "major.minor.patch" diff --git a/boards/cypress/cy8ckit_062_wifi_bt/board.yml b/boards/cypress/cy8ckit_062_wifi_bt/board.yml index f5113e41a55bf..f070d6f396044 100644 --- a/boards/cypress/cy8ckit_062_wifi_bt/board.yml +++ b/boards/cypress/cy8ckit_062_wifi_bt/board.yml @@ -1,5 +1,6 @@ board: name: cy8ckit_062_wifi_bt + full_name: PSoC6 WiFi-BT Pioneer Kit vendor: cypress socs: - name: cy8c6247 diff --git a/boards/digilent/arty_a7/board.yml b/boards/digilent/arty_a7/board.yml index 14a2c9ef41882..3ae72eb903b6a 100644 --- a/boards/digilent/arty_a7/board.yml +++ b/boards/digilent/arty_a7/board.yml @@ -1,5 +1,6 @@ board: name: arty_a7 + full_name: Arty vendor: digilent socs: - name: designstart_fpga_cortex_m1 diff --git a/boards/digilent/zybo/board.yml b/boards/digilent/zybo/board.yml index f9c9c98bea2aa..c8970300955f7 100644 --- a/boards/digilent/zybo/board.yml +++ b/boards/digilent/zybo/board.yml @@ -1,5 +1,6 @@ board: name: zybo + full_name: Zybo vendor: digilent socs: - name: xc7z010 diff --git a/boards/dptechnics/walter/board.yml b/boards/dptechnics/walter/board.yml index c416d547fb205..7d5b0e1cc85bd 100644 --- a/boards/dptechnics/walter/board.yml +++ b/boards/dptechnics/walter/board.yml @@ -1,5 +1,6 @@ board: name: walter + full_name: Walter vendor: dptechnics socs: - name: esp32s3 diff --git a/boards/dragino/lsn50/board.yml b/boards/dragino/lsn50/board.yml index e7c09a9c7bd65..20732b34290e5 100644 --- a/boards/dragino/lsn50/board.yml +++ b/boards/dragino/lsn50/board.yml @@ -1,5 +1,6 @@ board: name: dragino_lsn50 + full_name: LSN50 LoRA Sensor Node vendor: dragino socs: - name: stm32l072xx diff --git a/boards/dragino/nbsn95/board.yml b/boards/dragino/nbsn95/board.yml index 66d568935ec90..fd039983458f3 100644 --- a/boards/dragino/nbsn95/board.yml +++ b/boards/dragino/nbsn95/board.yml @@ -1,5 +1,6 @@ board: name: dragino_nbsn95 + full_name: NBSN95 NB-IoT Sensor Node vendor: dragino socs: - name: stm32l072xx diff --git a/boards/ebyte/e73_tbb/board.yml b/boards/ebyte/e73_tbb/board.yml index 3ae94fab665e1..bd8dc6ca8b0df 100644 --- a/boards/ebyte/e73_tbb/board.yml +++ b/boards/ebyte/e73_tbb/board.yml @@ -1,5 +1,6 @@ board: name: ebyte_e73_tbb + full_name: E73-TBB vendor: ebyte socs: - name: nrf52832 diff --git a/boards/efinix/titanium_ti60_f225/board.yml b/boards/efinix/titanium_ti60_f225/board.yml index 7daa700f0b389..5dfb38b38b09c 100644 --- a/boards/efinix/titanium_ti60_f225/board.yml +++ b/boards/efinix/titanium_ti60_f225/board.yml @@ -1,5 +1,6 @@ board: name: titanium_ti60_f225 + full_name: Titanium Ti60 F225 vendor: efinix socs: - name: efinix_sapphire diff --git a/boards/electronut/nrf52840_blip/board.yml b/boards/electronut/nrf52840_blip/board.yml index 3964f015c2fc9..874c923a092cc 100644 --- a/boards/electronut/nrf52840_blip/board.yml +++ b/boards/electronut/nrf52840_blip/board.yml @@ -1,5 +1,6 @@ board: name: nrf52840_blip + full_name: Labs Blip vendor: electronut socs: - name: nrf52840 diff --git a/boards/electronut/nrf52840_papyr/board.yml b/boards/electronut/nrf52840_papyr/board.yml index fcb089ad625f2..e24da1b0b5179 100644 --- a/boards/electronut/nrf52840_papyr/board.yml +++ b/boards/electronut/nrf52840_papyr/board.yml @@ -1,5 +1,6 @@ board: name: nrf52840_papyr + full_name: Labs Papyr vendor: electronut socs: - name: nrf52840 diff --git a/boards/element14/warp7/board.yml b/boards/element14/warp7/board.yml index 99b037ded48b1..492d4e5389865 100644 --- a/boards/element14/warp7/board.yml +++ b/boards/element14/warp7/board.yml @@ -1,5 +1,6 @@ board: name: warp7 + full_name: WaRP7 - Next Generation IoT and Wearable Development Platform vendor: element14 socs: - name: mcimx7d diff --git a/boards/enclustra/mercury_xu/board.yml b/boards/enclustra/mercury_xu/board.yml index 739a5c9585766..2f88257c1efd4 100644 --- a/boards/enclustra/mercury_xu/board.yml +++ b/boards/enclustra/mercury_xu/board.yml @@ -1,5 +1,6 @@ board: name: mercury_xu + full_name: MERCURY-XU vendor: enclustra socs: - name: zynqmp_rpu diff --git a/boards/ene/kb1200_evb/board.yml b/boards/ene/kb1200_evb/board.yml index d8dd4b412c73f..7bff572645399 100644 --- a/boards/ene/kb1200_evb/board.yml +++ b/boards/ene/kb1200_evb/board.yml @@ -1,5 +1,6 @@ board: name: kb1200_evb + full_name: ENE KB1200_EVB vendor: ene socs: - name: kb1200 diff --git a/boards/enjoydigital/litex_vexriscv/board.yml b/boards/enjoydigital/litex_vexriscv/board.yml index 18ea360bb8364..c5cd6829183c1 100644 --- a/boards/enjoydigital/litex_vexriscv/board.yml +++ b/boards/enjoydigital/litex_vexriscv/board.yml @@ -1,5 +1,6 @@ board: name: litex_vexriscv + full_name: LiteX VexRiscv vendor: litex socs: - name: litex_vexriscv diff --git a/boards/espressif/esp32_devkitc_wroom/board.yml b/boards/espressif/esp32_devkitc_wroom/board.yml index 42d9d88dc2388..e0d766da0d1c3 100644 --- a/boards/espressif/esp32_devkitc_wroom/board.yml +++ b/boards/espressif/esp32_devkitc_wroom/board.yml @@ -1,5 +1,6 @@ board: name: esp32_devkitc_wroom + full_name: ESP32-DevKitC-WROOM vendor: espressif socs: - name: esp32 diff --git a/boards/espressif/esp32_devkitc_wrover/board.yml b/boards/espressif/esp32_devkitc_wrover/board.yml index e0eae97f70f25..2a8e2a226fd86 100644 --- a/boards/espressif/esp32_devkitc_wrover/board.yml +++ b/boards/espressif/esp32_devkitc_wrover/board.yml @@ -1,5 +1,6 @@ board: name: esp32_devkitc_wrover + full_name: ESP32-DevKitC-WROVER vendor: espressif socs: - name: esp32 diff --git a/boards/espressif/esp32_ethernet_kit/board.yml b/boards/espressif/esp32_ethernet_kit/board.yml index 747690f38a69f..b7a9626543392 100644 --- a/boards/espressif/esp32_ethernet_kit/board.yml +++ b/boards/espressif/esp32_ethernet_kit/board.yml @@ -1,5 +1,6 @@ board: name: esp32_ethernet_kit + full_name: ESP32-Ethernet-Kit vendor: espressif socs: - name: esp32 diff --git a/boards/espressif/esp32c3_devkitc/board.yml b/boards/espressif/esp32c3_devkitc/board.yml index 22db88f664c05..5f122687f0031 100644 --- a/boards/espressif/esp32c3_devkitc/board.yml +++ b/boards/espressif/esp32c3_devkitc/board.yml @@ -1,5 +1,6 @@ board: name: esp32c3_devkitc + full_name: ESP32-C3-DevKitC vendor: espressif socs: - name: esp32c3 diff --git a/boards/espressif/esp32c3_devkitm/board.yml b/boards/espressif/esp32c3_devkitm/board.yml index 649dce34a7d02..90bd85dacc878 100644 --- a/boards/espressif/esp32c3_devkitm/board.yml +++ b/boards/espressif/esp32c3_devkitm/board.yml @@ -1,5 +1,6 @@ board: name: esp32c3_devkitm + full_name: ESP32-C3-DevKitM vendor: espressif socs: - name: esp32c3 diff --git a/boards/espressif/esp32c3_rust/board.yml b/boards/espressif/esp32c3_rust/board.yml index 36dd9b5524839..b8beeef68196f 100644 --- a/boards/espressif/esp32c3_rust/board.yml +++ b/boards/espressif/esp32c3_rust/board.yml @@ -3,6 +3,7 @@ board: name: esp32c3_rust + full_name: ESP32-C3-DevKit-RUST vendor: espressif socs: - name: esp32c3 diff --git a/boards/espressif/esp32c6_devkitc/board.yml b/boards/espressif/esp32c6_devkitc/board.yml index ad88f3a931573..485d35b548d67 100644 --- a/boards/espressif/esp32c6_devkitc/board.yml +++ b/boards/espressif/esp32c6_devkitc/board.yml @@ -1,5 +1,6 @@ board: name: esp32c6_devkitc + full_name: ESP32-C6-DevKitC vendor: espressif socs: - name: esp32c6 diff --git a/boards/espressif/esp32s2_devkitc/board.yml b/boards/espressif/esp32s2_devkitc/board.yml index b3d62e886862d..8ec0a493d8c84 100644 --- a/boards/espressif/esp32s2_devkitc/board.yml +++ b/boards/espressif/esp32s2_devkitc/board.yml @@ -1,5 +1,6 @@ board: name: esp32s2_devkitc + full_name: ESP32-S2-DevKitC vendor: espressif socs: - name: esp32s2 diff --git a/boards/espressif/esp32s2_saola/board.yml b/boards/espressif/esp32s2_saola/board.yml index aafb5f3ee1efe..69eacbf8a2c2e 100644 --- a/boards/espressif/esp32s2_saola/board.yml +++ b/boards/espressif/esp32s2_saola/board.yml @@ -1,5 +1,6 @@ board: name: esp32s2_saola + full_name: ESP32-S2-Saola vendor: espressif socs: - name: esp32s2 diff --git a/boards/espressif/esp32s3_devkitc/board.yml b/boards/espressif/esp32s3_devkitc/board.yml index a949122fd57c8..9d2eb9508e08c 100644 --- a/boards/espressif/esp32s3_devkitc/board.yml +++ b/boards/espressif/esp32s3_devkitc/board.yml @@ -1,5 +1,6 @@ board: name: esp32s3_devkitc + full_name: ESP32-S3-DevKitC vendor: espressif socs: - name: esp32s3 diff --git a/boards/espressif/esp32s3_devkitm/board.yml b/boards/espressif/esp32s3_devkitm/board.yml index 2d0195fc27dcd..0e4abbade2e7b 100644 --- a/boards/espressif/esp32s3_devkitm/board.yml +++ b/boards/espressif/esp32s3_devkitm/board.yml @@ -1,5 +1,6 @@ board: name: esp32s3_devkitm + full_name: ESP32-S3-DevKitM vendor: espressif socs: - name: esp32s3 diff --git a/boards/espressif/esp32s3_eye/board.yml b/boards/espressif/esp32s3_eye/board.yml index b16a5a1605ccc..9396b3c45dbf8 100644 --- a/boards/espressif/esp32s3_eye/board.yml +++ b/boards/espressif/esp32s3_eye/board.yml @@ -1,5 +1,6 @@ board: name: esp32s3_eye + full_name: ESP32-S3-EYE vendor: espressif socs: - name: esp32s3 diff --git a/boards/espressif/esp8684_devkitm/board.yml b/boards/espressif/esp8684_devkitm/board.yml index 5173f52326dda..c6e86e6f11bf7 100644 --- a/boards/espressif/esp8684_devkitm/board.yml +++ b/boards/espressif/esp8684_devkitm/board.yml @@ -1,5 +1,6 @@ board: name: esp8684_devkitm + full_name: ESP8684-DevKitM vendor: espressif socs: - name: esp32c2 diff --git a/boards/espressif/esp_wrover_kit/board.yml b/boards/espressif/esp_wrover_kit/board.yml index edfaae9047700..feb5c6b8bb078 100644 --- a/boards/espressif/esp_wrover_kit/board.yml +++ b/boards/espressif/esp_wrover_kit/board.yml @@ -1,5 +1,6 @@ board: name: esp_wrover_kit + full_name: ESP-WROVER-KIT vendor: espressif socs: - name: esp32 diff --git a/boards/ezurio/bl5340_dvk/board.yml b/boards/ezurio/bl5340_dvk/board.yml index 69be46ffe62ec..db71cf9ebe0f8 100644 --- a/boards/ezurio/bl5340_dvk/board.yml +++ b/boards/ezurio/bl5340_dvk/board.yml @@ -1,5 +1,6 @@ board: name: bl5340_dvk + full_name: BL5340 DVK vendor: ezurio socs: - name: 'nrf5340' diff --git a/boards/ezurio/bl652_dvk/board.yml b/boards/ezurio/bl652_dvk/board.yml index b573627457f80..2e8064165c0b6 100644 --- a/boards/ezurio/bl652_dvk/board.yml +++ b/boards/ezurio/bl652_dvk/board.yml @@ -1,5 +1,6 @@ board: name: bl652_dvk + full_name: BL652 DVK vendor: ezurio socs: - name: nrf52832 diff --git a/boards/ezurio/bl653_dvk/board.yml b/boards/ezurio/bl653_dvk/board.yml index dc42555309a23..5f6dac2d9aed8 100644 --- a/boards/ezurio/bl653_dvk/board.yml +++ b/boards/ezurio/bl653_dvk/board.yml @@ -1,5 +1,6 @@ board: name: bl653_dvk + full_name: BL653 DVK vendor: ezurio socs: - name: nrf52833 diff --git a/boards/ezurio/bl654_dvk/board.yml b/boards/ezurio/bl654_dvk/board.yml index fdc9035ff68b0..e92ddc965cf80 100644 --- a/boards/ezurio/bl654_dvk/board.yml +++ b/boards/ezurio/bl654_dvk/board.yml @@ -1,5 +1,6 @@ board: name: bl654_dvk + full_name: BL654 DVK vendor: ezurio socs: - name: nrf52840 diff --git a/boards/ezurio/bl654_sensor_board/board.yml b/boards/ezurio/bl654_sensor_board/board.yml index 566c992411db1..dacfa7f727608 100644 --- a/boards/ezurio/bl654_sensor_board/board.yml +++ b/boards/ezurio/bl654_sensor_board/board.yml @@ -1,5 +1,6 @@ board: name: bl654_sensor_board + full_name: BL654 Sensor Board vendor: ezurio socs: - name: nrf52840 diff --git a/boards/ezurio/bl654_usb/board.yml b/boards/ezurio/bl654_usb/board.yml index 13642fbe7124d..6329e4db30cee 100644 --- a/boards/ezurio/bl654_usb/board.yml +++ b/boards/ezurio/bl654_usb/board.yml @@ -1,5 +1,6 @@ board: name: bl654_usb + full_name: BL654 USB (451-00004) vendor: ezurio socs: - name: nrf52840 diff --git a/boards/ezurio/bt510/board.yml b/boards/ezurio/bt510/board.yml index e4692ed452673..d95dcc4edfb1d 100644 --- a/boards/ezurio/bt510/board.yml +++ b/boards/ezurio/bt510/board.yml @@ -1,5 +1,6 @@ board: name: bt510 + full_name: Sentrius BT510 Sensor vendor: ezurio socs: - name: nrf52840 diff --git a/boards/ezurio/bt610/board.yml b/boards/ezurio/bt610/board.yml index 0e4f29742c5d4..b586cf0a5ca90 100644 --- a/boards/ezurio/bt610/board.yml +++ b/boards/ezurio/bt610/board.yml @@ -1,5 +1,6 @@ board: name: bt610 + full_name: Sentrius BT610 Sensor vendor: ezurio socs: - name: nrf52840 diff --git a/boards/ezurio/mg100/board.yml b/boards/ezurio/mg100/board.yml index 4c62320fc5eb7..5a44c139a6809 100644 --- a/boards/ezurio/mg100/board.yml +++ b/boards/ezurio/mg100/board.yml @@ -1,5 +1,6 @@ board: name: mg100 + full_name: Sentrius™ MG100 Gateway vendor: ezurio socs: - name: nrf52840 diff --git a/boards/ezurio/pinnacle_100_dvk/board.yml b/boards/ezurio/pinnacle_100_dvk/board.yml index 8ed639a9a0a21..f2b98cd1577d5 100644 --- a/boards/ezurio/pinnacle_100_dvk/board.yml +++ b/boards/ezurio/pinnacle_100_dvk/board.yml @@ -1,5 +1,6 @@ board: name: pinnacle_100_dvk + full_name: Pinnacle 100 DVK vendor: ezurio socs: - name: nrf52840 diff --git a/boards/ezurio/rm1xx_dvk/board.yml b/boards/ezurio/rm1xx_dvk/board.yml index 4a8792eecc57d..f293c416c2d2b 100644 --- a/boards/ezurio/rm1xx_dvk/board.yml +++ b/boards/ezurio/rm1xx_dvk/board.yml @@ -1,5 +1,6 @@ board: name: rm1xx_dvk + full_name: RM1xx DVK vendor: ezurio socs: - name: nrf51822 diff --git a/boards/fanke/fk7b0m1_vbt6/board.yml b/boards/fanke/fk7b0m1_vbt6/board.yml index 204e3538a9311..e4ce6586425cc 100644 --- a/boards/fanke/fk7b0m1_vbt6/board.yml +++ b/boards/fanke/fk7b0m1_vbt6/board.yml @@ -1,5 +1,6 @@ board: name: fk7b0m1_vbt6 + full_name: FK7B0M1-VBT6 vendor: fanke socs: - name: stm32h7b0xx diff --git a/boards/firefly/roc_rk3568_pc/board.yml b/boards/firefly/roc_rk3568_pc/board.yml index 8a60a165dc43f..a123b1f37ccfd 100644 --- a/boards/firefly/roc_rk3568_pc/board.yml +++ b/boards/firefly/roc_rk3568_pc/board.yml @@ -1,5 +1,6 @@ board: name: roc_rk3568_pc + full_name: ROC-RK3568-PC (Quad-core Cortex-A55) vendor: firefly socs: - name: rk3568 diff --git a/boards/franzininho/esp32s2_franzininho/board.yml b/boards/franzininho/esp32s2_franzininho/board.yml index 913c4d4232faa..530d5dcec4e5f 100644 --- a/boards/franzininho/esp32s2_franzininho/board.yml +++ b/boards/franzininho/esp32s2_franzininho/board.yml @@ -1,5 +1,6 @@ board: name: esp32s2_franzininho + full_name: ESP32-S2 Franzininho vendor: espressif socs: - name: esp32s2 diff --git a/boards/gaisler/generic_leon3/board.yml b/boards/gaisler/generic_leon3/board.yml index 33c4d806adde7..582dd45593bf8 100644 --- a/boards/gaisler/generic_leon3/board.yml +++ b/boards/gaisler/generic_leon3/board.yml @@ -1,5 +1,6 @@ board: name: generic_leon3 + full_name: Generic LEON3 vendor: gaisler socs: - name: leon3 diff --git a/boards/gaisler/gr716a_mini/board.yml b/boards/gaisler/gr716a_mini/board.yml index 0de80629b404a..b9155b69a9263 100644 --- a/boards/gaisler/gr716a_mini/board.yml +++ b/boards/gaisler/gr716a_mini/board.yml @@ -1,5 +1,6 @@ board: name: gr716a_mini + full_name: GR716-MINI Development Board vendor: gaisler socs: - name: gr716a diff --git a/boards/gd/gd32a503v_eval/board.yml b/boards/gd/gd32a503v_eval/board.yml index 129cf4b0b50d8..6097143109e51 100644 --- a/boards/gd/gd32a503v_eval/board.yml +++ b/boards/gd/gd32a503v_eval/board.yml @@ -1,5 +1,6 @@ board: name: gd32a503v_eval + full_name: GD32A503V-EVAL vendor: gd socs: - name: gd32a503 diff --git a/boards/gd/gd32e103v_eval/board.yml b/boards/gd/gd32e103v_eval/board.yml index 1c4896977835a..cc70a188967cf 100644 --- a/boards/gd/gd32e103v_eval/board.yml +++ b/boards/gd/gd32e103v_eval/board.yml @@ -1,5 +1,6 @@ board: name: gd32e103v_eval + full_name: GD32E103V-EVAL vendor: gd socs: - name: gd32e103 diff --git a/boards/gd/gd32e507v_start/board.yml b/boards/gd/gd32e507v_start/board.yml index b364620f61a84..09e4310394cd1 100644 --- a/boards/gd/gd32e507v_start/board.yml +++ b/boards/gd/gd32e507v_start/board.yml @@ -1,5 +1,6 @@ board: name: gd32e507v_start + full_name: GD32E507V-START vendor: gd socs: - name: gd32e507 diff --git a/boards/gd/gd32e507z_eval/board.yml b/boards/gd/gd32e507z_eval/board.yml index 2325550db5d3f..2eaba014c2c8a 100644 --- a/boards/gd/gd32e507z_eval/board.yml +++ b/boards/gd/gd32e507z_eval/board.yml @@ -1,5 +1,6 @@ board: name: gd32e507z_eval + full_name: GD32E507Z-EVAL vendor: gd socs: - name: gd32e507 diff --git a/boards/gd/gd32f350r_eval/board.yml b/boards/gd/gd32f350r_eval/board.yml index ee486b1798354..a272193e2e86b 100644 --- a/boards/gd/gd32f350r_eval/board.yml +++ b/boards/gd/gd32f350r_eval/board.yml @@ -1,5 +1,6 @@ board: name: gd32f350r_eval + full_name: GD32F350R-EVAL vendor: gd socs: - name: gd32f350 diff --git a/boards/gd/gd32f403z_eval/board.yml b/boards/gd/gd32f403z_eval/board.yml index 222ba86385844..3d45844a0c55d 100644 --- a/boards/gd/gd32f403z_eval/board.yml +++ b/boards/gd/gd32f403z_eval/board.yml @@ -1,5 +1,6 @@ board: name: gd32f403z_eval + full_name: GD32F403Z-EVAL vendor: gd socs: - name: gd32f403 diff --git a/boards/gd/gd32f407v_start/board.yml b/boards/gd/gd32f407v_start/board.yml index c4a99ab566e72..bf6d7af7c34dd 100644 --- a/boards/gd/gd32f407v_start/board.yml +++ b/boards/gd/gd32f407v_start/board.yml @@ -1,5 +1,6 @@ board: name: gd32f407v_start + full_name: GD32F407V-START vendor: gd socs: - name: gd32f407 diff --git a/boards/gd/gd32f450i_eval/board.yml b/boards/gd/gd32f450i_eval/board.yml index a5da3b33c36a5..56b3f1eebed35 100644 --- a/boards/gd/gd32f450i_eval/board.yml +++ b/boards/gd/gd32f450i_eval/board.yml @@ -1,5 +1,6 @@ board: name: gd32f450i_eval + full_name: GD32F450I-EVAL vendor: gd socs: - name: gd32f450 diff --git a/boards/gd/gd32f450v_start/board.yml b/boards/gd/gd32f450v_start/board.yml index 96e0053694611..02b20c3669273 100644 --- a/boards/gd/gd32f450v_start/board.yml +++ b/boards/gd/gd32f450v_start/board.yml @@ -1,5 +1,6 @@ board: name: gd32f450v_start + full_name: GD32F450V-START vendor: gd socs: - name: gd32f450 diff --git a/boards/gd/gd32f450z_eval/board.yml b/boards/gd/gd32f450z_eval/board.yml index 53e30794b6a9b..f82107573f75e 100644 --- a/boards/gd/gd32f450z_eval/board.yml +++ b/boards/gd/gd32f450z_eval/board.yml @@ -1,5 +1,6 @@ board: name: gd32f450z_eval + full_name: GD32F450Z-EVAL vendor: gd socs: - name: gd32f450 diff --git a/boards/gd/gd32f470i_eval/board.yml b/boards/gd/gd32f470i_eval/board.yml index a4205dc69d260..c6cc2501b1533 100644 --- a/boards/gd/gd32f470i_eval/board.yml +++ b/boards/gd/gd32f470i_eval/board.yml @@ -1,5 +1,6 @@ board: name: gd32f470i_eval + full_name: GD32F470I-EVAL vendor: gd socs: - name: gd32f470 diff --git a/boards/gd/gd32l233r_eval/board.yml b/boards/gd/gd32l233r_eval/board.yml index 847def4fe2cc2..5b731d9bcfff5 100644 --- a/boards/gd/gd32l233r_eval/board.yml +++ b/boards/gd/gd32l233r_eval/board.yml @@ -1,5 +1,6 @@ board: name: gd32l233r_eval + full_name: GD32L233R-EVA vendor: gd socs: - name: gd32l233 diff --git a/boards/gd/gd32vf103c_starter/board.yml b/boards/gd/gd32vf103c_starter/board.yml index e91c7178af81a..d46555ad96fd1 100644 --- a/boards/gd/gd32vf103c_starter/board.yml +++ b/boards/gd/gd32vf103c_starter/board.yml @@ -1,5 +1,6 @@ board: name: gd32vf103c_starter + full_name: GD32VF103C-STARTER vendor: gd socs: - name: gd32vf103 diff --git a/boards/gd/gd32vf103v_eval/board.yml b/boards/gd/gd32vf103v_eval/board.yml index 3d12d916d384f..58c34ef223234 100644 --- a/boards/gd/gd32vf103v_eval/board.yml +++ b/boards/gd/gd32vf103v_eval/board.yml @@ -1,5 +1,6 @@ board: name: gd32vf103v_eval + full_name: GD32VF103V-EVAL vendor: gd socs: - name: gd32vf103 diff --git a/boards/google/dragonclaw/board.yml b/boards/google/dragonclaw/board.yml index 18e233f99b6d7..be55d603e767a 100644 --- a/boards/google/dragonclaw/board.yml +++ b/boards/google/dragonclaw/board.yml @@ -1,5 +1,6 @@ board: name: google_dragonclaw + full_name: Dragonclaw Development Board vendor: google socs: - name: stm32f412cx diff --git a/boards/google/twinkie_v2/board.yml b/boards/google/twinkie_v2/board.yml index b77d79328f71a..f7129ebec4f96 100644 --- a/boards/google/twinkie_v2/board.yml +++ b/boards/google/twinkie_v2/board.yml @@ -1,5 +1,6 @@ board: name: google_twinkie_v2 + full_name: Twinkie V2 vendor: google socs: - name: stm32g0b1xx diff --git a/boards/hardkernel/odroid_go/board.yml b/boards/hardkernel/odroid_go/board.yml index fad513c5ee9f5..390cff4aa5751 100644 --- a/boards/hardkernel/odroid_go/board.yml +++ b/boards/hardkernel/odroid_go/board.yml @@ -1,5 +1,6 @@ board: name: odroid_go + full_name: ODROID-GO vendor: hardkernel socs: - name: esp32 diff --git a/boards/heltec/heltec_wifi_lora32_v2/board.yml b/boards/heltec/heltec_wifi_lora32_v2/board.yml index e87344a976669..dee24b3f3b64e 100644 --- a/boards/heltec/heltec_wifi_lora32_v2/board.yml +++ b/boards/heltec/heltec_wifi_lora32_v2/board.yml @@ -1,5 +1,6 @@ board: name: heltec_wifi_lora32_v2 + full_name: WiFi LoRa 32 (V2) vendor: heltec socs: - name: esp32 diff --git a/boards/heltec/heltec_wireless_stick_lite_v3/board.yml b/boards/heltec/heltec_wireless_stick_lite_v3/board.yml index 12cb133cb4fb4..315b46477ed1e 100644 --- a/boards/heltec/heltec_wireless_stick_lite_v3/board.yml +++ b/boards/heltec/heltec_wireless_stick_lite_v3/board.yml @@ -1,5 +1,6 @@ board: name: heltec_wireless_stick_lite_v3 + full_name: Wireless Stick Lite (V3) vendor: heltec socs: - name: esp32s3 diff --git a/boards/holyiot/yj16019/board.yml b/boards/holyiot/yj16019/board.yml index e8ab16bc427d5..db082ff6428fa 100644 --- a/boards/holyiot/yj16019/board.yml +++ b/boards/holyiot/yj16019/board.yml @@ -1,5 +1,6 @@ board: name: holyiot_yj16019 + full_name: YJ-16019 vendor: holyiot socs: - name: nrf52832 diff --git a/boards/infineon/cy8ckit_062s4/board.yml b/boards/infineon/cy8ckit_062s4/board.yml index c460d9f050396..12d2f9870082b 100644 --- a/boards/infineon/cy8ckit_062s4/board.yml +++ b/boards/infineon/cy8ckit_062s4/board.yml @@ -1,5 +1,6 @@ board: name: cy8ckit_062s4 + full_name: PSOC 62S4 Pioneer Kit vendor: infineon socs: - name: cy8c6244lqi_s4d92 diff --git a/boards/infineon/cy8cproto_062_4343w/board.yml b/boards/infineon/cy8cproto_062_4343w/board.yml index f89df6ee65e02..6d697b9b14237 100644 --- a/boards/infineon/cy8cproto_062_4343w/board.yml +++ b/boards/infineon/cy8cproto_062_4343w/board.yml @@ -1,5 +1,6 @@ board: name: cy8cproto_062_4343w + full_name: CY8CPROTO-062-4343W vendor: infineon socs: - name: cy8c624abzi_s2d44 diff --git a/boards/infineon/cy8cproto_063_ble/board.yml b/boards/infineon/cy8cproto_063_ble/board.yml index 6ef5bd8e9d7b8..d6083a9b171af 100644 --- a/boards/infineon/cy8cproto_063_ble/board.yml +++ b/boards/infineon/cy8cproto_063_ble/board.yml @@ -1,5 +1,6 @@ board: name: cy8cproto_063_ble + full_name: CY8CPROTO-063-BLE vendor: infineon socs: - name: cyble_416045_02 diff --git a/boards/infineon/cyw920829m2evk_02/board.yml b/boards/infineon/cyw920829m2evk_02/board.yml index e25e3922b5359..c61036464415d 100644 --- a/boards/infineon/cyw920829m2evk_02/board.yml +++ b/boards/infineon/cyw920829m2evk_02/board.yml @@ -1,5 +1,6 @@ board: name: cyw920829m2evk_02 + full_name: CYW920829M2EVK-02 vendor: infineon socs: - name: cyw20829b0lkml diff --git a/boards/infineon/xmc45_relax_kit/board.yml b/boards/infineon/xmc45_relax_kit/board.yml index 9622337aa3061..77d1049bf4c5b 100644 --- a/boards/infineon/xmc45_relax_kit/board.yml +++ b/boards/infineon/xmc45_relax_kit/board.yml @@ -1,5 +1,6 @@ board: name: xmc45_relax_kit + full_name: XMC45-RELAX-KIT vendor: infineon socs: - name: xmc4500 diff --git a/boards/infineon/xmc47_relax_kit/board.yml b/boards/infineon/xmc47_relax_kit/board.yml index e0077321e3a98..4a081064bebeb 100644 --- a/boards/infineon/xmc47_relax_kit/board.yml +++ b/boards/infineon/xmc47_relax_kit/board.yml @@ -1,5 +1,6 @@ board: name: xmc47_relax_kit + full_name: XMC47-RELAX-KIT vendor: infineon socs: - name: xmc4700 diff --git a/boards/innblue/innblue21/board.yml b/boards/innblue/innblue21/board.yml index 8d62be567905c..e8250dccf0c57 100644 --- a/boards/innblue/innblue21/board.yml +++ b/boards/innblue/innblue21/board.yml @@ -1,5 +1,6 @@ board: name: innblue21 + full_name: nRF9160 INNBLUE21 vendor: innblue socs: - name: nrf9160 diff --git a/boards/innblue/innblue22/board.yml b/boards/innblue/innblue22/board.yml index eeb4f946ffbe8..2b7f6691aba85 100644 --- a/boards/innblue/innblue22/board.yml +++ b/boards/innblue/innblue22/board.yml @@ -1,5 +1,6 @@ board: name: innblue22 + full_name: nRF9160 INNBLUE22 vendor: innblue socs: - name: nrf9160 diff --git a/boards/intel/adl/board.yml b/boards/intel/adl/board.yml index fe51b63f81386..29b9272757c13 100644 --- a/boards/intel/adl/board.yml +++ b/boards/intel/adl/board.yml @@ -1,9 +1,11 @@ boards: - name: intel_adl_crb + full_name: Alder Lake CRB vendor: intel socs: - name: alder_lake - name: intel_adl_rvp + full_name: Alder Lake RVP vendor: intel socs: - name: alder_lake diff --git a/boards/intel/adsp/board.yml b/boards/intel/adsp/board.yml index 43004e8f2a4c3..c169a14487b02 100644 --- a/boards/intel/adsp/board.yml +++ b/boards/intel/adsp/board.yml @@ -1,5 +1,6 @@ boards: - name: intel_adsp + full_name: Intel ADSP vendor: intel socs: - name: cavs25 diff --git a/boards/intel/ehl/board.yml b/boards/intel/ehl/board.yml index 5f8d3cafa1b89..05bb75ffe05b6 100644 --- a/boards/intel/ehl/board.yml +++ b/boards/intel/ehl/board.yml @@ -1,5 +1,6 @@ board: name: intel_ehl_crb + full_name: Elkhart Lake CRB vendor: intel socs: - name: elkhart_lake diff --git a/boards/intel/ish/board.yml b/boards/intel/ish/board.yml index ee7c466180070..3083cc961db26 100644 --- a/boards/intel/ish/board.yml +++ b/boards/intel/ish/board.yml @@ -1,16 +1,19 @@ boards: - name: intel_ish_5_4_1 + full_name: Integrated Sensor Hub (ISH) 5.4.1 vendor: intel socs: - name: intel_ish_5_4_1 - name: intel_ish_5_6_0 + full_name: Integrated Sensor Hub (ISH) 5.6.0 vendor: intel socs: - name: intel_ish_5_6_0 - name: intel_ish_5_8_0 + full_name: Integrated Sensor Hub (ISH) 5.8.0 vendor: intel socs: - name: intel_ish_5_8_0 diff --git a/boards/intel/niosv_g/board.yml b/boards/intel/niosv_g/board.yml index 7f6cc30ce62a0..811aee73f34a2 100644 --- a/boards/intel/niosv_g/board.yml +++ b/boards/intel/niosv_g/board.yml @@ -1,4 +1,5 @@ board: name: niosv_g + full_name: INTEL FPGA niosv_g socs: - name: niosv_g diff --git a/boards/intel/niosv_m/board.yml b/boards/intel/niosv_m/board.yml index a77efa39ff186..cc7b9bb3bf53e 100644 --- a/boards/intel/niosv_m/board.yml +++ b/boards/intel/niosv_m/board.yml @@ -1,4 +1,5 @@ board: name: niosv_m + full_name: INTEL FPGA niosv_m socs: - name: niosv_m diff --git a/boards/intel/rpl/board.yml b/boards/intel/rpl/board.yml index cc3969adcede0..9f35b6486991e 100644 --- a/boards/intel/rpl/board.yml +++ b/boards/intel/rpl/board.yml @@ -1,9 +1,11 @@ boards: - name: intel_rpl_p_crb + full_name: Raptor Lake P CRB vendor: intel socs: - name: raptor_lake - name: intel_rpl_s_crb + full_name: Raptor Lake S CRB vendor: intel socs: - name: raptor_lake diff --git a/boards/intel/socfpga/agilex5_socdk/board.yml b/boards/intel/socfpga/agilex5_socdk/board.yml index fd4f5c91d6674..f8ccbf5d8c5ac 100644 --- a/boards/intel/socfpga/agilex5_socdk/board.yml +++ b/boards/intel/socfpga/agilex5_socdk/board.yml @@ -1,4 +1,5 @@ board: name: intel_socfpga_agilex5_socdk + full_name: Agilex™ 5 SoC FPGA Development Kit socs: - name: agilex5 diff --git a/boards/intel/socfpga/agilex_socdk/board.yml b/boards/intel/socfpga/agilex_socdk/board.yml index 1c09cba049170..80763baa41b9f 100644 --- a/boards/intel/socfpga/agilex_socdk/board.yml +++ b/boards/intel/socfpga/agilex_socdk/board.yml @@ -1,4 +1,5 @@ board: name: intel_socfpga_agilex_socdk + full_name: Agilex SoC Development Kit socs: - name: agilex diff --git a/boards/intel/socfpga_std/cyclonev_socdk/board.yml b/boards/intel/socfpga_std/cyclonev_socdk/board.yml index 420762dda3f10..222de69429aca 100644 --- a/boards/intel/socfpga_std/cyclonev_socdk/board.yml +++ b/boards/intel/socfpga_std/cyclonev_socdk/board.yml @@ -1,4 +1,5 @@ board: name: cyclonev_socdk + full_name: Cyclone® V SoC Development Kit socs: - name: cyclonev diff --git a/boards/ite/it82xx2_evb/board.yml b/boards/ite/it82xx2_evb/board.yml index f986050cad3d7..b36117cb4b4a7 100644 --- a/boards/ite/it82xx2_evb/board.yml +++ b/boards/ite/it82xx2_evb/board.yml @@ -1,5 +1,6 @@ board: name: it82xx2_evb + full_name: IT82XX2 series vendor: ite socs: - name: it82202ax diff --git a/boards/ite/it8xxx2_evb/board.yml b/boards/ite/it8xxx2_evb/board.yml index a676ec35fa840..55f12393958cb 100644 --- a/boards/ite/it8xxx2_evb/board.yml +++ b/boards/ite/it8xxx2_evb/board.yml @@ -1,5 +1,6 @@ board: name: it8xxx2_evb + full_name: IT8XXX2 series vendor: ite socs: - name: it81302bx diff --git a/boards/khadas/edgev/board.yml b/boards/khadas/edgev/board.yml index fc70dcf0a44da..3feee76d7dfdd 100644 --- a/boards/khadas/edgev/board.yml +++ b/boards/khadas/edgev/board.yml @@ -1,5 +1,6 @@ board: name: khadas_edgev + full_name: Edge-V vendor: khadas socs: - name: rk3399 diff --git a/boards/kincony/kincony_kc868_a32/board.yml b/boards/kincony/kincony_kc868_a32/board.yml index 99bf4fa715b71..9a2144f7cd678 100644 --- a/boards/kincony/kincony_kc868_a32/board.yml +++ b/boards/kincony/kincony_kc868_a32/board.yml @@ -1,5 +1,6 @@ board: name: kincony_kc868_a32 + full_name: KC868-A32 vendor: kincony socs: - name: esp32 diff --git a/boards/lilygo/ttgo_lora32/board.yml b/boards/lilygo/ttgo_lora32/board.yml index 8cccfbbf7d267..3997b696fc9c4 100644 --- a/boards/lilygo/ttgo_lora32/board.yml +++ b/boards/lilygo/ttgo_lora32/board.yml @@ -1,5 +1,6 @@ board: name: ttgo_lora32 + full_name: TTGO LoRa32 vendor: lilygo socs: - name: esp32 diff --git a/boards/lilygo/ttgo_t8c3/board.yml b/boards/lilygo/ttgo_t8c3/board.yml index 8b1084a449353..e6c08739aff07 100644 --- a/boards/lilygo/ttgo_t8c3/board.yml +++ b/boards/lilygo/ttgo_t8c3/board.yml @@ -1,5 +1,6 @@ board: name: ttgo_t8c3 + full_name: TTGO T8-C3 vendor: lilygo socs: - name: esp32c3 diff --git a/boards/lowrisc/opentitan_earlgrey/board.yml b/boards/lowrisc/opentitan_earlgrey/board.yml index d7e8a24879c28..2659998727cf5 100644 --- a/boards/lowrisc/opentitan_earlgrey/board.yml +++ b/boards/lowrisc/opentitan_earlgrey/board.yml @@ -1,5 +1,6 @@ board: name: opentitan_earlgrey + full_name: OpenTitan Earl Grey vendor: lowrisc socs: - name: opentitan diff --git a/boards/luatos/esp32c3_luatos_core/board.yml b/boards/luatos/esp32c3_luatos_core/board.yml index e1a5ed4204617..0269d7dc85aa6 100644 --- a/boards/luatos/esp32c3_luatos_core/board.yml +++ b/boards/luatos/esp32c3_luatos_core/board.yml @@ -1,5 +1,6 @@ board: name: esp32c3_luatos_core + full_name: ESP32C3_LUATOS_CORE vendor: luatos socs: - name: esp32c3 diff --git a/boards/luatos/esp32s3_luatos_core/board.yml b/boards/luatos/esp32s3_luatos_core/board.yml index cd29886c969a4..e806b61e906cc 100644 --- a/boards/luatos/esp32s3_luatos_core/board.yml +++ b/boards/luatos/esp32s3_luatos_core/board.yml @@ -1,5 +1,6 @@ board: name: esp32s3_luatos_core + full_name: ESP32S3-Luatos-Core vendor: luatos socs: - name: esp32s3 diff --git a/boards/m5stack/m5stack_atom_lite/board.yml b/boards/m5stack/m5stack_atom_lite/board.yml index d7202eda266a2..964abb52f7e0d 100644 --- a/boards/m5stack/m5stack_atom_lite/board.yml +++ b/boards/m5stack/m5stack_atom_lite/board.yml @@ -1,5 +1,6 @@ board: name: m5stack_atom_lite + full_name: ATOM Lite vendor: m5stack socs: - name: esp32 diff --git a/boards/m5stack/m5stack_atoms3/board.yml b/boards/m5stack/m5stack_atoms3/board.yml index 4126aa17d2e19..c74186cdcd53c 100644 --- a/boards/m5stack/m5stack_atoms3/board.yml +++ b/boards/m5stack/m5stack_atoms3/board.yml @@ -1,5 +1,6 @@ board: name: m5stack_atoms3 + full_name: AtomS3 vendor: m5stack socs: - name: esp32s3 diff --git a/boards/m5stack/m5stack_atoms3_lite/board.yml b/boards/m5stack/m5stack_atoms3_lite/board.yml index c9204d5159c9d..6445b3d9a4f25 100644 --- a/boards/m5stack/m5stack_atoms3_lite/board.yml +++ b/boards/m5stack/m5stack_atoms3_lite/board.yml @@ -1,5 +1,6 @@ board: name: m5stack_atoms3_lite + full_name: AtomS3 Lite vendor: m5stack socs: - name: esp32s3 diff --git a/boards/m5stack/m5stack_core2/board.yml b/boards/m5stack/m5stack_core2/board.yml index 1ff253f820177..9a002aa285995 100644 --- a/boards/m5stack/m5stack_core2/board.yml +++ b/boards/m5stack/m5stack_core2/board.yml @@ -1,5 +1,6 @@ board: name: m5stack_core2 + full_name: Core2 vendor: m5stack socs: - name: esp32 diff --git a/boards/m5stack/m5stack_stamps3/board.yml b/boards/m5stack/m5stack_stamps3/board.yml index e723d91c19a0e..0ac071b1667c7 100644 --- a/boards/m5stack/m5stack_stamps3/board.yml +++ b/boards/m5stack/m5stack_stamps3/board.yml @@ -1,5 +1,6 @@ board: name: m5stack_stamps3 + full_name: StampS3 vendor: m5stack socs: - name: esp32s3 diff --git a/boards/m5stack/m5stickc_plus/board.yml b/boards/m5stack/m5stickc_plus/board.yml index 3a604266d079c..20a1d324a9df9 100644 --- a/boards/m5stack/m5stickc_plus/board.yml +++ b/boards/m5stack/m5stickc_plus/board.yml @@ -1,5 +1,6 @@ board: name: m5stickc_plus + full_name: M5StickC PLUS vendor: m5stack socs: - name: esp32 diff --git a/boards/m5stack/stamp_c3/board.yml b/boards/m5stack/stamp_c3/board.yml index aa24963edd654..244d9b1230289 100644 --- a/boards/m5stack/stamp_c3/board.yml +++ b/boards/m5stack/stamp_c3/board.yml @@ -1,5 +1,6 @@ board: name: stamp_c3 + full_name: STAMP-C3 vendor: m5stack socs: - name: esp32c3 diff --git a/boards/madmachine/mm_feather/board.yml b/boards/madmachine/mm_feather/board.yml index 1b9ca3f2c7c10..23adcce1a2f34 100644 --- a/boards/madmachine/mm_feather/board.yml +++ b/boards/madmachine/mm_feather/board.yml @@ -1,5 +1,6 @@ board: name: mm_feather + full_name: SwiftIO Feather vendor: madmachine socs: - name: mimxrt1062 diff --git a/boards/madmachine/mm_swiftio/board.yml b/boards/madmachine/mm_swiftio/board.yml index 784e79c52adf4..0f3f04f552618 100644 --- a/boards/madmachine/mm_swiftio/board.yml +++ b/boards/madmachine/mm_swiftio/board.yml @@ -1,5 +1,6 @@ board: name: mm_swiftio + full_name: SwiftIO vendor: madmachine socs: - name: mimxrt1052 diff --git a/boards/makerdiary/nrf52832_mdk/board.yml b/boards/makerdiary/nrf52832_mdk/board.yml index 70028809dc37f..7faf1088ce79d 100644 --- a/boards/makerdiary/nrf52832_mdk/board.yml +++ b/boards/makerdiary/nrf52832_mdk/board.yml @@ -1,5 +1,6 @@ board: name: nrf52832_mdk + full_name: nRF52832-mdk vendor: makerdiary socs: - name: nrf52832 diff --git a/boards/makerdiary/nrf52840_mdk/board.yml b/boards/makerdiary/nrf52840_mdk/board.yml index 09e13811fc307..dddbb5a3bb32c 100644 --- a/boards/makerdiary/nrf52840_mdk/board.yml +++ b/boards/makerdiary/nrf52840_mdk/board.yml @@ -1,5 +1,6 @@ board: name: nrf52840_mdk + full_name: nRF52840-mdk vendor: makerdiary socs: - name: nrf52840 diff --git a/boards/makerdiary/nrf52840_mdk_usb_dongle/board.yml b/boards/makerdiary/nrf52840_mdk_usb_dongle/board.yml index 1c3020c52b597..4326881bc4d3e 100644 --- a/boards/makerdiary/nrf52840_mdk_usb_dongle/board.yml +++ b/boards/makerdiary/nrf52840_mdk_usb_dongle/board.yml @@ -1,5 +1,6 @@ board: name: nrf52840_mdk_usb_dongle + full_name: nRF52840 MDK USB Dongle vendor: makerdiary socs: - name: nrf52840 diff --git a/boards/mediatek/mt8195_adsp/board.yml b/boards/mediatek/mt8195_adsp/board.yml index 22c31deb1a010..a58b33ecf8d95 100644 --- a/boards/mediatek/mt8195_adsp/board.yml +++ b/boards/mediatek/mt8195_adsp/board.yml @@ -1,5 +1,6 @@ boards: - name: mt8195_adsp + full_name: MT8195 ADSP vendor: mediatek socs: - name: mt8195_adsp diff --git a/boards/microchip/ev11l78a/board.yml b/boards/microchip/ev11l78a/board.yml index abaabec67abd8..b078a725e8c49 100644 --- a/boards/microchip/ev11l78a/board.yml +++ b/boards/microchip/ev11l78a/board.yml @@ -1,5 +1,6 @@ board: name: ev11l78a + full_name: UPD301C Basic Sink Application Example vendor: microchip socs: - name: samd20e16 diff --git a/boards/microchip/m2gl025_miv/board.yml b/boards/microchip/m2gl025_miv/board.yml index 84e61821f35ad..f3fba2a9720fd 100644 --- a/boards/microchip/m2gl025_miv/board.yml +++ b/boards/microchip/m2gl025_miv/board.yml @@ -1,5 +1,6 @@ board: name: m2gl025_miv + full_name: M2GL025 Mi-V vendor: microchip socs: - name: miv diff --git a/boards/microchip/mec1501modular_assy6885/board.yml b/boards/microchip/mec1501modular_assy6885/board.yml index d45ec4217f798..62f58a266667b 100644 --- a/boards/microchip/mec1501modular_assy6885/board.yml +++ b/boards/microchip/mec1501modular_assy6885/board.yml @@ -1,5 +1,6 @@ board: name: mec1501modular_assy6885 + full_name: MEC1501 Modular card ASSY6885 vendor: microchip socs: - name: mec1501_hsz diff --git a/boards/microchip/mec15xxevb_assy6853/board.yml b/boards/microchip/mec15xxevb_assy6853/board.yml index ae55848943856..c4cba01d0ddb6 100644 --- a/boards/microchip/mec15xxevb_assy6853/board.yml +++ b/boards/microchip/mec15xxevb_assy6853/board.yml @@ -1,5 +1,6 @@ board: name: mec15xxevb_assy6853 + full_name: MEC15xxEVB ASSY6853 vendor: microchip socs: - name: mec1501_hsz diff --git a/boards/microchip/mec172xevb_assy6906/board.yml b/boards/microchip/mec172xevb_assy6906/board.yml index 5f3f57b29a7d2..0ad61bcc1c7b7 100644 --- a/boards/microchip/mec172xevb_assy6906/board.yml +++ b/boards/microchip/mec172xevb_assy6906/board.yml @@ -1,5 +1,6 @@ board: name: mec172xevb_assy6906 + full_name: MEC172xEVB ASSY6906 vendor: microchip socs: - name: mec172x_nsz diff --git a/boards/microchip/mec172xmodular_assy6930/board.yml b/boards/microchip/mec172xmodular_assy6930/board.yml index 1fe04eba6e8a5..e7a176038af09 100644 --- a/boards/microchip/mec172xmodular_assy6930/board.yml +++ b/boards/microchip/mec172xmodular_assy6930/board.yml @@ -1,5 +1,6 @@ board: name: mec172xmodular_assy6930 + full_name: MEC172x Modular Card ASSY6930 (Rev. B) vendor: microchip socs: - name: mec172x_nsz diff --git a/boards/microchip/mpfs_icicle/board.yml b/boards/microchip/mpfs_icicle/board.yml index b9799c5830e02..fb03fb4c8c42e 100644 --- a/boards/microchip/mpfs_icicle/board.yml +++ b/boards/microchip/mpfs_icicle/board.yml @@ -1,5 +1,6 @@ board: name: mpfs_icicle + full_name: mpfs_icicle vendor: microchip socs: - name: polarfire diff --git a/boards/mikroe/clicker_2/board.yml b/boards/mikroe/clicker_2/board.yml index 8ffead86036de..11b092291cc46 100644 --- a/boards/mikroe/clicker_2/board.yml +++ b/boards/mikroe/clicker_2/board.yml @@ -1,5 +1,6 @@ board: name: mikroe_clicker_2 + full_name: Clicker 2 for STM32 vendor: mikroe socs: - name: stm32f407xx diff --git a/boards/mikroe/clicker_ra4m1/board.yml b/boards/mikroe/clicker_ra4m1/board.yml index 1635cd26a5dc0..7d4c5beee0ed5 100644 --- a/boards/mikroe/clicker_ra4m1/board.yml +++ b/boards/mikroe/clicker_ra4m1/board.yml @@ -3,6 +3,7 @@ board: name: mikroe_clicker_ra4m1 + full_name: Clicker RA4M1 vendor: mikroe socs: - name: r7fa4m1ab3cfm diff --git a/boards/mikroe/mini_m4_for_stm32/board.yml b/boards/mikroe/mini_m4_for_stm32/board.yml index 60dde764fe6fb..84a50a3e09034 100644 --- a/boards/mikroe/mini_m4_for_stm32/board.yml +++ b/boards/mikroe/mini_m4_for_stm32/board.yml @@ -1,5 +1,6 @@ board: name: mikroe_mini_m4_for_stm32 + full_name: MINI-M4 for STM32 vendor: mikroe socs: - name: stm32f415xx diff --git a/boards/mikroe/stm32_m4_clicker/board.yml b/boards/mikroe/stm32_m4_clicker/board.yml index 56a329a900f43..ad387120bc538 100644 --- a/boards/mikroe/stm32_m4_clicker/board.yml +++ b/boards/mikroe/stm32_m4_clicker/board.yml @@ -3,6 +3,7 @@ board: name: mikroe_stm32_m4_clicker + full_name: STM32 M4 Clicker vendor: mikroe socs: - name: stm32f415xx diff --git a/boards/mxchip/az3166_iotdevkit/board.yml b/boards/mxchip/az3166_iotdevkit/board.yml index 4ac727ed1c243..3cf58f575ebe2 100644 --- a/boards/mxchip/az3166_iotdevkit/board.yml +++ b/boards/mxchip/az3166_iotdevkit/board.yml @@ -1,5 +1,6 @@ board: name: az3166_iotdevkit + full_name: AZ3166 MXChip IoT DevKit vendor: mxchip socs: - name: stm32f412rx diff --git a/boards/native/native_posix/board.yml b/boards/native/native_posix/board.yml index 0f03465c79b19..07defd4185bfc 100644 --- a/boards/native/native_posix/board.yml +++ b/boards/native/native_posix/board.yml @@ -1,5 +1,6 @@ boards: - name: native_posix + full_name: Native POSIX execution (native_posix) vendor: zephyr socs: - name: native diff --git a/boards/native/native_sim/board.yml b/boards/native/native_sim/board.yml index 1949217013882..cebff14d48a6a 100644 --- a/boards/native/native_sim/board.yml +++ b/boards/native/native_sim/board.yml @@ -1,5 +1,6 @@ boards: - name: native_sim + full_name: Native simulator - native_sim vendor: zephyr socs: - name: native diff --git a/boards/native/nrf_bsim/board.yml b/boards/native/nrf_bsim/board.yml index ba14ed8aef6f6..0ba40b3367730 100644 --- a/boards/native/nrf_bsim/board.yml +++ b/boards/native/nrf_bsim/board.yml @@ -1,13 +1,16 @@ boards: - name: nrf52_bsim + full_name: nRF52 simulated board (BabbleSim) vendor: zephyr socs: - name: native - name: nrf5340bsim + full_name: nRF5340 simulated boards (BabbleSim) vendor: zephyr socs: - name: nrf5340 - name: nrf54l15bsim + full_name: nRF54L15 simulated boards (BabbleSim) vendor: zephyr socs: - name: nrf54l15 diff --git a/boards/nordic/nrf21540dk/board.yml b/boards/nordic/nrf21540dk/board.yml index 4c9cf5943fec3..3c977f4489fa3 100644 --- a/boards/nordic/nrf21540dk/board.yml +++ b/boards/nordic/nrf21540dk/board.yml @@ -1,5 +1,6 @@ board: name: nrf21540dk + full_name: nRF21540 DK vendor: nordic socs: - name: nrf52840 diff --git a/boards/nordic/nrf51dk/board.yml b/boards/nordic/nrf51dk/board.yml index 788be3d79bc85..888f9c883b546 100644 --- a/boards/nordic/nrf51dk/board.yml +++ b/boards/nordic/nrf51dk/board.yml @@ -1,5 +1,6 @@ board: name: nrf51dk + full_name: nRF51 DK vendor: nordic socs: - name: nrf51822 diff --git a/boards/nordic/nrf51dongle/board.yml b/boards/nordic/nrf51dongle/board.yml index 4c89cac7fdcc2..99d423528eda3 100644 --- a/boards/nordic/nrf51dongle/board.yml +++ b/boards/nordic/nrf51dongle/board.yml @@ -1,5 +1,6 @@ board: name: nrf51dongle + full_name: nRF51 Dongle vendor: nordic socs: - name: nrf51822 diff --git a/boards/nordic/nrf52833dk/board.yml b/boards/nordic/nrf52833dk/board.yml index 2d6b6e5b12f21..dbb8e020d51f1 100644 --- a/boards/nordic/nrf52833dk/board.yml +++ b/boards/nordic/nrf52833dk/board.yml @@ -1,5 +1,6 @@ board: name: nrf52833dk + full_name: nRF52833 DK vendor: nordic socs: - name: nrf52820 diff --git a/boards/nordic/nrf52840dk/board.yml b/boards/nordic/nrf52840dk/board.yml index d15e1975027ae..8b6bdef90e290 100644 --- a/boards/nordic/nrf52840dk/board.yml +++ b/boards/nordic/nrf52840dk/board.yml @@ -1,5 +1,6 @@ board: name: nrf52840dk + full_name: nRF52840 DK vendor: nordic socs: # Physical nRF52840 SoC on PCA10056 diff --git a/boards/nordic/nrf52840dongle/board.yml b/boards/nordic/nrf52840dongle/board.yml index a22449e551924..59eae5b3429ca 100644 --- a/boards/nordic/nrf52840dongle/board.yml +++ b/boards/nordic/nrf52840dongle/board.yml @@ -1,5 +1,6 @@ board: name: nrf52840dongle + full_name: nRF52840 Dongle vendor: nordic socs: - name: nrf52840 diff --git a/boards/nordic/nrf52dk/board.yml b/boards/nordic/nrf52dk/board.yml index 1f21be9c60e4e..bf4d819be0fb8 100644 --- a/boards/nordic/nrf52dk/board.yml +++ b/boards/nordic/nrf52dk/board.yml @@ -1,5 +1,6 @@ board: name: nrf52dk + full_name: nRF52 DK vendor: nordic socs: - name: nrf52805 diff --git a/boards/nordic/nrf5340_audio_dk/board.yml b/boards/nordic/nrf5340_audio_dk/board.yml index 443381b9461a7..4dc67d1bb6fe4 100644 --- a/boards/nordic/nrf5340_audio_dk/board.yml +++ b/boards/nordic/nrf5340_audio_dk/board.yml @@ -1,5 +1,6 @@ board: name: nrf5340_audio_dk + full_name: nRF5340 Audio DK vendor: nordic socs: - name: 'nrf5340' diff --git a/boards/nordic/nrf5340dk/board.yml b/boards/nordic/nrf5340dk/board.yml index fd90df34350c5..2454c47862b6a 100644 --- a/boards/nordic/nrf5340dk/board.yml +++ b/boards/nordic/nrf5340dk/board.yml @@ -1,5 +1,6 @@ board: name: nrf5340dk + full_name: nRF5340 DK vendor: nordic socs: - name: 'nrf5340' diff --git a/boards/nordic/nrf54h20dk/board.yml b/boards/nordic/nrf54h20dk/board.yml index 7d57b61cd5300..82a738d8b0310 100644 --- a/boards/nordic/nrf54h20dk/board.yml +++ b/boards/nordic/nrf54h20dk/board.yml @@ -1,5 +1,6 @@ board: name: nrf54h20dk + full_name: nRF54H20 DK vendor: nordic socs: - name: nrf54h20 diff --git a/boards/nordic/nrf54l15dk/board.yml b/boards/nordic/nrf54l15dk/board.yml index 7a8bf2f5cf104..8d750b3d14b9e 100644 --- a/boards/nordic/nrf54l15dk/board.yml +++ b/boards/nordic/nrf54l15dk/board.yml @@ -1,5 +1,6 @@ board: name: nrf54l15dk + full_name: nRF54L15 DK vendor: nordic socs: - name: nrf54l15 diff --git a/boards/nordic/nrf54l15pdk/board.yml b/boards/nordic/nrf54l15pdk/board.yml index e692040f7bd72..1432bfc3ea606 100644 --- a/boards/nordic/nrf54l15pdk/board.yml +++ b/boards/nordic/nrf54l15pdk/board.yml @@ -1,5 +1,6 @@ board: name: nrf54l15pdk + full_name: nRF54L15 PDK vendor: nordic socs: - name: nrf54l15 diff --git a/boards/nordic/nrf54l20pdk/board.yml b/boards/nordic/nrf54l20pdk/board.yml index 717adf8e75eed..4eaa66669fcc6 100644 --- a/boards/nordic/nrf54l20pdk/board.yml +++ b/boards/nordic/nrf54l20pdk/board.yml @@ -1,5 +1,6 @@ board: name: nrf54l20pdk + full_name: nRF54L20 PDK vendor: nordic socs: - name: nrf54l20 diff --git a/boards/nordic/nrf7002dk/board.yml b/boards/nordic/nrf7002dk/board.yml index ca94d73429e9e..39db5dcfa3a71 100644 --- a/boards/nordic/nrf7002dk/board.yml +++ b/boards/nordic/nrf7002dk/board.yml @@ -1,5 +1,6 @@ board: name: nrf7002dk + full_name: nRF7002 DK vendor: nordic socs: - name: nrf5340 diff --git a/boards/nordic/nrf9131ek/board.yml b/boards/nordic/nrf9131ek/board.yml index 246aef6f4e3a4..6e91098f63bbd 100644 --- a/boards/nordic/nrf9131ek/board.yml +++ b/boards/nordic/nrf9131ek/board.yml @@ -1,5 +1,6 @@ board: name: nrf9131ek + full_name: nRF9131 EK vendor: nordic socs: - name: nrf9131 diff --git a/boards/nordic/nrf9151dk/board.yml b/boards/nordic/nrf9151dk/board.yml index f765134a46042..468b8f0fa2a3d 100644 --- a/boards/nordic/nrf9151dk/board.yml +++ b/boards/nordic/nrf9151dk/board.yml @@ -1,5 +1,6 @@ board: name: nrf9151dk + full_name: nRF9151 DK vendor: nordic socs: - name: nrf9151 diff --git a/boards/nordic/nrf9160dk/board.yml b/boards/nordic/nrf9160dk/board.yml index 5e6dcfad89b3c..1f043a0af8cd1 100644 --- a/boards/nordic/nrf9160dk/board.yml +++ b/boards/nordic/nrf9160dk/board.yml @@ -1,5 +1,6 @@ board: name: nrf9160dk + full_name: nRF9160 DK vendor: nordic socs: - name: nrf9160 diff --git a/boards/nordic/nrf9161dk/board.yml b/boards/nordic/nrf9161dk/board.yml index 9bffcec81a6fc..da9bafb11d0fc 100644 --- a/boards/nordic/nrf9161dk/board.yml +++ b/boards/nordic/nrf9161dk/board.yml @@ -1,5 +1,6 @@ board: name: nrf9161dk + full_name: nRF9161 DK vendor: nordic socs: - name: nrf9161 diff --git a/boards/nordic/nrf9280pdk/board.yml b/boards/nordic/nrf9280pdk/board.yml index 450ef9db9014e..963eae59ba0ff 100644 --- a/boards/nordic/nrf9280pdk/board.yml +++ b/boards/nordic/nrf9280pdk/board.yml @@ -1,5 +1,6 @@ board: name: nrf9280pdk + full_name: nRF9280 PDK vendor: nordic socs: - name: nrf9280 diff --git a/boards/nordic/thingy52/board.yml b/boards/nordic/thingy52/board.yml index 425e24fb5960a..010d40677db47 100644 --- a/boards/nordic/thingy52/board.yml +++ b/boards/nordic/thingy52/board.yml @@ -1,5 +1,6 @@ board: name: thingy52 + full_name: "Thingy:52" vendor: nordic socs: - name: nrf52832 diff --git a/boards/nordic/thingy53/board.yml b/boards/nordic/thingy53/board.yml index 4659222a346db..46c8112cc9576 100644 --- a/boards/nordic/thingy53/board.yml +++ b/boards/nordic/thingy53/board.yml @@ -1,5 +1,6 @@ board: name: thingy53 + full_name: "Thingy:53" vendor: nordic socs: - name: 'nrf5340' diff --git a/boards/nuvoton/npcm400_evb/board.yml b/boards/nuvoton/npcm400_evb/board.yml index 1a428cc5fe1c2..c73b1d69caabf 100644 --- a/boards/nuvoton/npcm400_evb/board.yml +++ b/boards/nuvoton/npcm400_evb/board.yml @@ -1,5 +1,6 @@ board: name: npcm400_evb + full_name: NPCM400_EVB vendor: nuvoton socs: - name: npcm400 diff --git a/boards/nuvoton/npcx4m8f_evb/board.yml b/boards/nuvoton/npcx4m8f_evb/board.yml index 16f6190d19529..39fcc762796f5 100644 --- a/boards/nuvoton/npcx4m8f_evb/board.yml +++ b/boards/nuvoton/npcx4m8f_evb/board.yml @@ -1,5 +1,6 @@ board: name: npcx4m8f_evb + full_name: NPCX4M8F_EVB vendor: nuvoton socs: - name: npcx4m8f diff --git a/boards/nuvoton/npcx7m6fb_evb/board.yml b/boards/nuvoton/npcx7m6fb_evb/board.yml index 33528cde3476f..71c0df6ba3def 100644 --- a/boards/nuvoton/npcx7m6fb_evb/board.yml +++ b/boards/nuvoton/npcx7m6fb_evb/board.yml @@ -1,5 +1,6 @@ board: name: npcx7m6fb_evb + full_name: NPCX7M6FB_EVB vendor: nuvoton socs: - name: npcx7m6fb diff --git a/boards/nuvoton/npcx9m6f_evb/board.yml b/boards/nuvoton/npcx9m6f_evb/board.yml index 7baeb00dfa3a1..ff77a27a2928c 100644 --- a/boards/nuvoton/npcx9m6f_evb/board.yml +++ b/boards/nuvoton/npcx9m6f_evb/board.yml @@ -1,5 +1,6 @@ board: name: npcx9m6f_evb + full_name: NPCX9M6F_EVB vendor: nuvoton socs: - name: npcx9m6f diff --git a/boards/nuvoton/numaker_m2l31ki/board.yml b/boards/nuvoton/numaker_m2l31ki/board.yml index f01805447faf7..610fc26e81fb7 100644 --- a/boards/nuvoton/numaker_m2l31ki/board.yml +++ b/boards/nuvoton/numaker_m2l31ki/board.yml @@ -1,5 +1,6 @@ board: name: numaker_m2l31ki + full_name: NUMAKER M2L31KI vendor: nuvoton socs: - name: m2l31xxx diff --git a/boards/nuvoton/numaker_pfm_m467/board.yml b/boards/nuvoton/numaker_pfm_m467/board.yml index d9b195940ee36..e57042889ff42 100644 --- a/boards/nuvoton/numaker_pfm_m467/board.yml +++ b/boards/nuvoton/numaker_pfm_m467/board.yml @@ -1,5 +1,6 @@ board: name: numaker_pfm_m467 + full_name: NUMAKER PFM M467 vendor: nuvoton socs: - name: m467 diff --git a/boards/nuvoton/numaker_pfm_m487/board.yml b/boards/nuvoton/numaker_pfm_m487/board.yml index cc9dc43fe6ad2..82a0720db536b 100644 --- a/boards/nuvoton/numaker_pfm_m487/board.yml +++ b/boards/nuvoton/numaker_pfm_m487/board.yml @@ -1,5 +1,6 @@ board: name: numaker_pfm_m487 + full_name: NUMAKER PFM M487 vendor: nuvoton socs: - name: m487 diff --git a/boards/nxp/frdm_k22f/board.yml b/boards/nxp/frdm_k22f/board.yml index 0498d799129f4..0e8ad732f395b 100644 --- a/boards/nxp/frdm_k22f/board.yml +++ b/boards/nxp/frdm_k22f/board.yml @@ -1,5 +1,6 @@ board: name: frdm_k22f + full_name: FRDM-K22F vendor: nxp socs: - name: mk22f51212 diff --git a/boards/nxp/frdm_k64f/board.yml b/boards/nxp/frdm_k64f/board.yml index a338af6b99ce5..2de73a4ea2cc4 100644 --- a/boards/nxp/frdm_k64f/board.yml +++ b/boards/nxp/frdm_k64f/board.yml @@ -1,5 +1,6 @@ board: name: frdm_k64f + full_name: FRDM-K64F vendor: nxp socs: - name: mk64f12 diff --git a/boards/nxp/frdm_k82f/board.yml b/boards/nxp/frdm_k82f/board.yml index cf7bc47e121e4..513136f3e0909 100644 --- a/boards/nxp/frdm_k82f/board.yml +++ b/boards/nxp/frdm_k82f/board.yml @@ -1,5 +1,6 @@ board: name: frdm_k82f + full_name: FRDM-K82F vendor: nxp socs: - name: mk82f25615 diff --git a/boards/nxp/frdm_ke15z/board.yml b/boards/nxp/frdm_ke15z/board.yml index c637334b8b83e..927356cf0dbc5 100644 --- a/boards/nxp/frdm_ke15z/board.yml +++ b/boards/nxp/frdm_ke15z/board.yml @@ -1,5 +1,6 @@ board: name: frdm_ke15z + full_name: FRDM-KE15Z vendor: nxp socs: - name: mke15z7 diff --git a/boards/nxp/frdm_ke17z/board.yml b/boards/nxp/frdm_ke17z/board.yml index a6b72f27f206a..9576c95012aeb 100644 --- a/boards/nxp/frdm_ke17z/board.yml +++ b/boards/nxp/frdm_ke17z/board.yml @@ -1,5 +1,6 @@ board: name: frdm_ke17z + full_name: FRDM-KE17Z vendor: nxp socs: - name: mke17z7 diff --git a/boards/nxp/frdm_ke17z512/board.yml b/boards/nxp/frdm_ke17z512/board.yml index 46839e065b1dd..306ddf305bf27 100644 --- a/boards/nxp/frdm_ke17z512/board.yml +++ b/boards/nxp/frdm_ke17z512/board.yml @@ -1,5 +1,6 @@ board: name: frdm_ke17z512 + full_name: FRDM-KE17Z512 vendor: nxp socs: - name: mke17z9 diff --git a/boards/nxp/frdm_kl25z/board.yml b/boards/nxp/frdm_kl25z/board.yml index 0caf35c690e08..de3270eba7c3d 100644 --- a/boards/nxp/frdm_kl25z/board.yml +++ b/boards/nxp/frdm_kl25z/board.yml @@ -1,5 +1,6 @@ board: name: frdm_kl25z + full_name: FRDM-KL25Z vendor: nxp socs: - name: mkl25z4 diff --git a/boards/nxp/frdm_kw41z/board.yml b/boards/nxp/frdm_kw41z/board.yml index b17c67beb3e49..94a99c9197454 100644 --- a/boards/nxp/frdm_kw41z/board.yml +++ b/boards/nxp/frdm_kw41z/board.yml @@ -1,5 +1,6 @@ board: name: frdm_kw41z + full_name: FRDM-KW41Z vendor: nxp socs: - name: mkw41z4 diff --git a/boards/nxp/frdm_mcxa156/board.yml b/boards/nxp/frdm_mcxa156/board.yml index fd3cb5a5c6d94..8107aa33aee7b 100644 --- a/boards/nxp/frdm_mcxa156/board.yml +++ b/boards/nxp/frdm_mcxa156/board.yml @@ -1,5 +1,6 @@ board: name: frdm_mcxa156 + full_name: FRDM-MCXA156 vendor: nxp socs: - name: mcxa156 diff --git a/boards/nxp/frdm_mcxc242/board.yml b/boards/nxp/frdm_mcxc242/board.yml index 2aa0aaa3da1b4..9dc5bbe7f5fed 100644 --- a/boards/nxp/frdm_mcxc242/board.yml +++ b/boards/nxp/frdm_mcxc242/board.yml @@ -1,5 +1,6 @@ board: name: frdm_mcxc242 + full_name: FRDM-MCXC242 vendor: nxp socs: - name: mcxc242 diff --git a/boards/nxp/frdm_mcxc444/board.yml b/boards/nxp/frdm_mcxc444/board.yml index d32af7cc92c13..960d2c3f377b7 100644 --- a/boards/nxp/frdm_mcxc444/board.yml +++ b/boards/nxp/frdm_mcxc444/board.yml @@ -1,5 +1,6 @@ board: name: frdm_mcxc444 + full_name: FRDM-MCXC444 vendor: nxp socs: - name: mcxc444 diff --git a/boards/nxp/frdm_mcxn236/board.yml b/boards/nxp/frdm_mcxn236/board.yml index 0bd2d3928ba40..6c1645c9272ea 100644 --- a/boards/nxp/frdm_mcxn236/board.yml +++ b/boards/nxp/frdm_mcxn236/board.yml @@ -1,5 +1,6 @@ board: name: frdm_mcxn236 + full_name: FRDM-MCXN236 vendor: nxp socs: - name: mcxn236 diff --git a/boards/nxp/frdm_mcxn947/board.yml b/boards/nxp/frdm_mcxn947/board.yml index b4a6453333331..dd17fc68dc48d 100644 --- a/boards/nxp/frdm_mcxn947/board.yml +++ b/boards/nxp/frdm_mcxn947/board.yml @@ -1,5 +1,6 @@ board: name: frdm_mcxn947 + full_name: FRDM-MCXN947 vendor: nxp socs: - name: mcxn947 diff --git a/boards/nxp/frdm_mcxw71/board.yml b/boards/nxp/frdm_mcxw71/board.yml index 2a40433c84b5f..e0243a0f32bfa 100644 --- a/boards/nxp/frdm_mcxw71/board.yml +++ b/boards/nxp/frdm_mcxw71/board.yml @@ -1,5 +1,6 @@ board: name: frdm_mcxw71 + full_name: FRDM-MCXW71 vendor: nxp socs: - name: mcxw716c diff --git a/boards/nxp/frdm_rw612/board.yml b/boards/nxp/frdm_rw612/board.yml index e52333358c468..17ec6bda8298b 100644 --- a/boards/nxp/frdm_rw612/board.yml +++ b/boards/nxp/frdm_rw612/board.yml @@ -1,5 +1,6 @@ board: name: frdm_rw612 + full_name: FRDM_RW612 vendor: nxp socs: - name: rw612 diff --git a/boards/nxp/hexiwear/board.yml b/boards/nxp/hexiwear/board.yml index c478fa0267857..63a0e80de9ad0 100644 --- a/boards/nxp/hexiwear/board.yml +++ b/boards/nxp/hexiwear/board.yml @@ -1,5 +1,6 @@ board: name: hexiwear + full_name: Hexiwear vendor: nxp socs: - name: mk64f12 diff --git a/boards/nxp/imx8mm_evk/board.yml b/boards/nxp/imx8mm_evk/board.yml index 0c46177f70bb6..3b760999b3ffa 100644 --- a/boards/nxp/imx8mm_evk/board.yml +++ b/boards/nxp/imx8mm_evk/board.yml @@ -1,5 +1,6 @@ board: name: imx8mm_evk + full_name: i.MX8MM EVK vendor: nxp socs: - name: mimx8mm6 diff --git a/boards/nxp/imx8mn_evk/board.yml b/boards/nxp/imx8mn_evk/board.yml index 294060de50698..c26c08d5bb606 100644 --- a/boards/nxp/imx8mn_evk/board.yml +++ b/boards/nxp/imx8mn_evk/board.yml @@ -1,5 +1,6 @@ board: name: imx8mn_evk + full_name: i.MX8MN EVK (Cortex-A53) vendor: nxp socs: - name: mimx8mn6 diff --git a/boards/nxp/imx8mp_evk/board.yml b/boards/nxp/imx8mp_evk/board.yml index d810c27a59675..c961682626972 100644 --- a/boards/nxp/imx8mp_evk/board.yml +++ b/boards/nxp/imx8mp_evk/board.yml @@ -1,5 +1,6 @@ board: name: imx8mp_evk + full_name: i.MX8MP EVK vendor: nxp socs: - name: mimx8ml8 diff --git a/boards/nxp/imx8mq_evk/board.yml b/boards/nxp/imx8mq_evk/board.yml index c599f0a7afdbd..cb27276995822 100644 --- a/boards/nxp/imx8mq_evk/board.yml +++ b/boards/nxp/imx8mq_evk/board.yml @@ -1,5 +1,6 @@ board: name: imx8mq_evk + full_name: MIMX8MQ EVK vendor: nxp socs: - name: mimx8mq6 diff --git a/boards/nxp/imx8qm_mek/board.yml b/boards/nxp/imx8qm_mek/board.yml index d044277a6220b..c97d6c179e8fc 100644 --- a/boards/nxp/imx8qm_mek/board.yml +++ b/boards/nxp/imx8qm_mek/board.yml @@ -1,5 +1,6 @@ board: name: imx8qm_mek + full_name: i.MX 8QuadMax Multisensory Enablement Kit (MEK) vendor: nxp socs: - name: mimx8qm6 diff --git a/boards/nxp/imx8qxp_mek/board.yml b/boards/nxp/imx8qxp_mek/board.yml index e31754086d736..a2c838ef23986 100644 --- a/boards/nxp/imx8qxp_mek/board.yml +++ b/boards/nxp/imx8qxp_mek/board.yml @@ -1,5 +1,6 @@ board: name: imx8qxp_mek + full_name: i.MX 8QuadXPlus Multisensory Enablement Kit (MEK) vendor: nxp socs: - name: mimx8qx6 diff --git a/boards/nxp/imx8ulp_evk/board.yml b/boards/nxp/imx8ulp_evk/board.yml index bd5e16dc93d87..45167a37f267e 100644 --- a/boards/nxp/imx8ulp_evk/board.yml +++ b/boards/nxp/imx8ulp_evk/board.yml @@ -1,5 +1,6 @@ board: name: imx8ulp_evk + full_name: i.MX 8ULP Evaluation Kit vendor: nxp socs: - name: mimx8ud7 diff --git a/boards/nxp/imx93_evk/board.yml b/boards/nxp/imx93_evk/board.yml index 110334be5589b..008156c5fa567 100644 --- a/boards/nxp/imx93_evk/board.yml +++ b/boards/nxp/imx93_evk/board.yml @@ -1,5 +1,6 @@ board: name: imx93_evk + full_name: i.MX93 EVK vendor: nxp socs: - name: mimx9352 diff --git a/boards/nxp/imx95_evk/board.yml b/boards/nxp/imx95_evk/board.yml index 149090744573a..9f170d3291872 100644 --- a/boards/nxp/imx95_evk/board.yml +++ b/boards/nxp/imx95_evk/board.yml @@ -1,5 +1,6 @@ board: name: imx95_evk + full_name: i.MX95 EVK vendor: nxp socs: - name: mimx9596 diff --git a/boards/nxp/lpcxpresso11u68/board.yml b/boards/nxp/lpcxpresso11u68/board.yml index 30712d42e690c..b0e31a04eabdd 100644 --- a/boards/nxp/lpcxpresso11u68/board.yml +++ b/boards/nxp/lpcxpresso11u68/board.yml @@ -1,5 +1,6 @@ board: name: lpcxpresso11u68 + full_name: LPCXpresso11U68 vendor: nxp socs: - name: lpc11u68 diff --git a/boards/nxp/lpcxpresso51u68/board.yml b/boards/nxp/lpcxpresso51u68/board.yml index 7eb0f17095ee1..b27419f0f9906 100644 --- a/boards/nxp/lpcxpresso51u68/board.yml +++ b/boards/nxp/lpcxpresso51u68/board.yml @@ -1,5 +1,6 @@ board: name: lpcxpresso51u68 + full_name: LPCXPRESSO51U68 vendor: nxp socs: - name: lpc51u68 diff --git a/boards/nxp/lpcxpresso54114/board.yml b/boards/nxp/lpcxpresso54114/board.yml index 64477bf2ac8ed..d891073c5f77c 100644 --- a/boards/nxp/lpcxpresso54114/board.yml +++ b/boards/nxp/lpcxpresso54114/board.yml @@ -1,5 +1,6 @@ board: name: lpcxpresso54114 + full_name: LPCXPRESSO54114 vendor: nxp socs: - name: lpc54114 diff --git a/boards/nxp/lpcxpresso55s06/board.yml b/boards/nxp/lpcxpresso55s06/board.yml index a15c5a1da8522..e8924e0d94143 100644 --- a/boards/nxp/lpcxpresso55s06/board.yml +++ b/boards/nxp/lpcxpresso55s06/board.yml @@ -1,5 +1,6 @@ board: name: lpcxpresso55s06 + full_name: LPCXpresso55S06 vendor: nxp socs: - name: lpc55s06 diff --git a/boards/nxp/lpcxpresso55s16/board.yml b/boards/nxp/lpcxpresso55s16/board.yml index 5b4c627af1c4f..33328c04d1db3 100644 --- a/boards/nxp/lpcxpresso55s16/board.yml +++ b/boards/nxp/lpcxpresso55s16/board.yml @@ -1,5 +1,6 @@ board: name: lpcxpresso55s16 + full_name: LPCXpresso55S16 vendor: nxp socs: - name: lpc55s16 diff --git a/boards/nxp/lpcxpresso55s28/board.yml b/boards/nxp/lpcxpresso55s28/board.yml index d4309c4e3df01..9cedc7e450cdd 100644 --- a/boards/nxp/lpcxpresso55s28/board.yml +++ b/boards/nxp/lpcxpresso55s28/board.yml @@ -1,5 +1,6 @@ board: name: lpcxpresso55s28 + full_name: LPCXpresso55S28 vendor: nxp socs: - name: lpc55s28 diff --git a/boards/nxp/lpcxpresso55s36/board.yml b/boards/nxp/lpcxpresso55s36/board.yml index e888d7688156d..7257c1d421a0e 100644 --- a/boards/nxp/lpcxpresso55s36/board.yml +++ b/boards/nxp/lpcxpresso55s36/board.yml @@ -1,5 +1,6 @@ board: name: lpcxpresso55s36 + full_name: LPCXpresso55S36 vendor: nxp socs: - name: lpc55s36 diff --git a/boards/nxp/lpcxpresso55s69/board.yml b/boards/nxp/lpcxpresso55s69/board.yml index 605ab7b3e9f50..6c38dd06b0a01 100644 --- a/boards/nxp/lpcxpresso55s69/board.yml +++ b/boards/nxp/lpcxpresso55s69/board.yml @@ -1,5 +1,6 @@ board: name: lpcxpresso55s69 + full_name: LPCXPRESSO55S69 vendor: nxp socs: - name: lpc55s69 diff --git a/boards/nxp/ls1046ardb/board.yml b/boards/nxp/ls1046ardb/board.yml index 9ad691704808a..64001359b9af8 100644 --- a/boards/nxp/ls1046ardb/board.yml +++ b/boards/nxp/ls1046ardb/board.yml @@ -1,5 +1,6 @@ board: name: ls1046ardb + full_name: LS1046A RDB vendor: nxp socs: - name: ls1046a diff --git a/boards/nxp/mimxrt1010_evk/board.yml b/boards/nxp/mimxrt1010_evk/board.yml index 8c5dd6f1d7502..6a82a52146057 100644 --- a/boards/nxp/mimxrt1010_evk/board.yml +++ b/boards/nxp/mimxrt1010_evk/board.yml @@ -1,5 +1,6 @@ board: name: mimxrt1010_evk + full_name: MIMXRT1010-EVK vendor: nxp socs: - name: mimxrt1011 diff --git a/boards/nxp/mimxrt1015_evk/board.yml b/boards/nxp/mimxrt1015_evk/board.yml index 5f26dc3898b7e..8661e00823008 100644 --- a/boards/nxp/mimxrt1015_evk/board.yml +++ b/boards/nxp/mimxrt1015_evk/board.yml @@ -1,5 +1,6 @@ board: name: mimxrt1015_evk + full_name: MIMXRT1015-EVK vendor: nxp socs: - name: mimxrt1015 diff --git a/boards/nxp/mimxrt1020_evk/board.yml b/boards/nxp/mimxrt1020_evk/board.yml index 4df4def13bc42..c56ebb2360d2d 100644 --- a/boards/nxp/mimxrt1020_evk/board.yml +++ b/boards/nxp/mimxrt1020_evk/board.yml @@ -1,5 +1,6 @@ board: name: mimxrt1020_evk + full_name: MIMXRT1020-EVK vendor: nxp socs: - name: mimxrt1021 diff --git a/boards/nxp/mimxrt1024_evk/board.yml b/boards/nxp/mimxrt1024_evk/board.yml index c9420ad2b7586..e3858413637e1 100644 --- a/boards/nxp/mimxrt1024_evk/board.yml +++ b/boards/nxp/mimxrt1024_evk/board.yml @@ -1,5 +1,6 @@ board: name: mimxrt1024_evk + full_name: MIMXRT1024-EVK vendor: nxp socs: - name: mimxrt1024 diff --git a/boards/nxp/mimxrt1040_evk/board.yml b/boards/nxp/mimxrt1040_evk/board.yml index ded85cfce4af7..a5e5803ca227d 100644 --- a/boards/nxp/mimxrt1040_evk/board.yml +++ b/boards/nxp/mimxrt1040_evk/board.yml @@ -1,5 +1,6 @@ board: name: mimxrt1040_evk + full_name: MIMXRT1040-EVK vendor: nxp socs: - name: mimxrt1042 diff --git a/boards/nxp/mimxrt1050_evk/board.yml b/boards/nxp/mimxrt1050_evk/board.yml index c1276214baafc..48b8680e4b5cd 100644 --- a/boards/nxp/mimxrt1050_evk/board.yml +++ b/boards/nxp/mimxrt1050_evk/board.yml @@ -1,5 +1,6 @@ board: name: mimxrt1050_evk + full_name: MIMXRT1050-EVK vendor: nxp socs: - name: mimxrt1052 diff --git a/boards/nxp/mimxrt1060_evk/board.yml b/boards/nxp/mimxrt1060_evk/board.yml index 6682fbd72283c..c3787a5385ef1 100644 --- a/boards/nxp/mimxrt1060_evk/board.yml +++ b/boards/nxp/mimxrt1060_evk/board.yml @@ -1,11 +1,13 @@ boards: - name: mimxrt1060_evk + full_name: MIMXRT1060-EVK vendor: nxp socs: - name: mimxrt1062 revision: format: "custom" - name: mimxrt1060_evkb + full_name: MIMXRT1060-EVKB vendor: nxp socs: - name: mimxrt1062 diff --git a/boards/nxp/mimxrt1062_fmurt6/board.yml b/boards/nxp/mimxrt1062_fmurt6/board.yml index bebcb6c79541d..60541a7f36146 100644 --- a/boards/nxp/mimxrt1062_fmurt6/board.yml +++ b/boards/nxp/mimxrt1062_fmurt6/board.yml @@ -1,5 +1,6 @@ board: name: mimxrt1062_fmurt6 + full_name: FMURT6 vendor: nxp socs: - name: mimxrt1062 diff --git a/boards/nxp/mimxrt1064_evk/board.yml b/boards/nxp/mimxrt1064_evk/board.yml index b3116560663b4..9800be0506623 100644 --- a/boards/nxp/mimxrt1064_evk/board.yml +++ b/boards/nxp/mimxrt1064_evk/board.yml @@ -1,5 +1,6 @@ board: name: mimxrt1064_evk + full_name: MIMXRT1064-EVK vendor: nxp socs: - name: mimxrt1064 diff --git a/boards/nxp/mimxrt1160_evk/board.yml b/boards/nxp/mimxrt1160_evk/board.yml index 4fe56f8d256eb..85136c7858062 100644 --- a/boards/nxp/mimxrt1160_evk/board.yml +++ b/boards/nxp/mimxrt1160_evk/board.yml @@ -1,5 +1,6 @@ board: name: mimxrt1160_evk + full_name: MIMXRT1160-EVK vendor: nxp socs: - name: mimxrt1166 diff --git a/boards/nxp/mimxrt1170_evk/board.yml b/boards/nxp/mimxrt1170_evk/board.yml index 0b8e2b058e014..4a6a25318b01e 100644 --- a/boards/nxp/mimxrt1170_evk/board.yml +++ b/boards/nxp/mimxrt1170_evk/board.yml @@ -1,5 +1,6 @@ board: name: mimxrt1170_evk + full_name: MIMXRT1170-EVK/EVKB vendor: nxp socs: - name: mimxrt1176 diff --git a/boards/nxp/mimxrt1180_evk/board.yml b/boards/nxp/mimxrt1180_evk/board.yml index 0153cf4260d8c..3c3a3680cb35a 100644 --- a/boards/nxp/mimxrt1180_evk/board.yml +++ b/boards/nxp/mimxrt1180_evk/board.yml @@ -1,5 +1,6 @@ board: name: mimxrt1180_evk + full_name: MIMXRT1180-EVK vendor: nxp socs: - name: mimxrt1189 diff --git a/boards/nxp/mimxrt595_evk/board.yml b/boards/nxp/mimxrt595_evk/board.yml index 5982f34671261..052648e5b86e7 100644 --- a/boards/nxp/mimxrt595_evk/board.yml +++ b/boards/nxp/mimxrt595_evk/board.yml @@ -1,5 +1,6 @@ board: name: mimxrt595_evk + full_name: MIMXRT595-EVK vendor: nxp socs: - name: mimxrt595s diff --git a/boards/nxp/mimxrt685_evk/board.yml b/boards/nxp/mimxrt685_evk/board.yml index 41956acbb3146..c65a7e860bcfd 100644 --- a/boards/nxp/mimxrt685_evk/board.yml +++ b/boards/nxp/mimxrt685_evk/board.yml @@ -1,5 +1,6 @@ board: name: mimxrt685_evk + full_name: MIMXRT685-EVK vendor: nxp socs: - name: mimxrt685s diff --git a/boards/nxp/mr_canhubk3/board.yml b/boards/nxp/mr_canhubk3/board.yml index 3840a8f3d3038..fcf396d2c45e6 100644 --- a/boards/nxp/mr_canhubk3/board.yml +++ b/boards/nxp/mr_canhubk3/board.yml @@ -1,5 +1,6 @@ board: name: mr_canhubk3 + full_name: MR-CANHUBK3 vendor: nxp socs: - name: s32k344 diff --git a/boards/nxp/rd_rw612_bga/board.yml b/boards/nxp/rd_rw612_bga/board.yml index 3316d69561420..e5b918b3ec986 100644 --- a/boards/nxp/rd_rw612_bga/board.yml +++ b/boards/nxp/rd_rw612_bga/board.yml @@ -1,5 +1,6 @@ board: name: rd_rw612_bga + full_name: RD-RW612-BGA vendor: nxp socs: - name: rw612 diff --git a/boards/nxp/rddrone_fmuk66/board.yml b/boards/nxp/rddrone_fmuk66/board.yml index 40707b2f2e4f9..5d83c0d237fdd 100644 --- a/boards/nxp/rddrone_fmuk66/board.yml +++ b/boards/nxp/rddrone_fmuk66/board.yml @@ -1,5 +1,6 @@ board: name: rddrone_fmuk66 + full_name: RDDRONE-FMUK66 vendor: nxp socs: - name: mk66f18 diff --git a/boards/nxp/s32z2xxdc2/board.yml b/boards/nxp/s32z2xxdc2/board.yml index bffe1839c3c29..ab7e2be4c38d1 100644 --- a/boards/nxp/s32z2xxdc2/board.yml +++ b/boards/nxp/s32z2xxdc2/board.yml @@ -1,5 +1,6 @@ board: name: s32z2xxdc2 + full_name: X-S32Z27X-DC (DC2) vendor: nxp revision: format: letter diff --git a/boards/nxp/twr_ke18f/board.yml b/boards/nxp/twr_ke18f/board.yml index ffaf5fb235f4d..0f18fed146698 100644 --- a/boards/nxp/twr_ke18f/board.yml +++ b/boards/nxp/twr_ke18f/board.yml @@ -1,5 +1,6 @@ board: name: twr_ke18f + full_name: TWR-KE18F vendor: nxp socs: - name: mke18f16 diff --git a/boards/nxp/twr_kv58f220m/board.yml b/boards/nxp/twr_kv58f220m/board.yml index 536e16c178f28..d7ec86a420e39 100644 --- a/boards/nxp/twr_kv58f220m/board.yml +++ b/boards/nxp/twr_kv58f220m/board.yml @@ -1,5 +1,6 @@ board: name: twr_kv58f220m + full_name: TWR-KV58F220M vendor: nxp socs: - name: mkv58f24 diff --git a/boards/nxp/ucans32k1sic/board.yml b/boards/nxp/ucans32k1sic/board.yml index 87964b5201fbc..d4cdb83314b1b 100644 --- a/boards/nxp/ucans32k1sic/board.yml +++ b/boards/nxp/ucans32k1sic/board.yml @@ -1,5 +1,6 @@ board: name: ucans32k1sic + full_name: UCANS32K1SIC vendor: nxp socs: - name: s32k146 diff --git a/boards/nxp/usb_kw24d512/board.yml b/boards/nxp/usb_kw24d512/board.yml index 21dae9f84358d..a166d3bdca843 100644 --- a/boards/nxp/usb_kw24d512/board.yml +++ b/boards/nxp/usb_kw24d512/board.yml @@ -1,5 +1,6 @@ board: name: usb_kw24d512 + full_name: USB-KW24D512 vendor: nxp socs: - name: mkw24d5 diff --git a/boards/nxp/vmu_rt1170/board.yml b/boards/nxp/vmu_rt1170/board.yml index 91d9d2e83b2de..45e37ad789897 100644 --- a/boards/nxp/vmu_rt1170/board.yml +++ b/boards/nxp/vmu_rt1170/board.yml @@ -1,5 +1,6 @@ board: name: vmu_rt1170 + full_name: VMU RT1170 vendor: nxp socs: - name: mimxrt1176 diff --git a/boards/olimex/lora_stm32wl_devkit/board.yml b/boards/olimex/lora_stm32wl_devkit/board.yml index 511de6634d2b3..6b1397bf3b598 100644 --- a/boards/olimex/lora_stm32wl_devkit/board.yml +++ b/boards/olimex/lora_stm32wl_devkit/board.yml @@ -1,5 +1,6 @@ board: name: olimex_lora_stm32wl_devkit + full_name: LoRa STM32WL DevKit vendor: olimex revision: format: letter diff --git a/boards/olimex/olimex_esp32_evb/board.yml b/boards/olimex/olimex_esp32_evb/board.yml index 8dc816efceba1..ab25d5859c22a 100644 --- a/boards/olimex/olimex_esp32_evb/board.yml +++ b/boards/olimex/olimex_esp32_evb/board.yml @@ -1,5 +1,6 @@ board: name: olimex_esp32_evb + full_name: ESP32-EVB vendor: olimex socs: - name: esp32 diff --git a/boards/olimex/olimexino_stm32/board.yml b/boards/olimex/olimexino_stm32/board.yml index 0944c4bb28057..6f2276da7b0d0 100644 --- a/boards/olimex/olimexino_stm32/board.yml +++ b/boards/olimex/olimexino_stm32/board.yml @@ -1,5 +1,6 @@ board: name: olimexino_stm32 + full_name: OLIMEXINO-STM32 vendor: olimex socs: - name: stm32f103xb diff --git a/boards/olimex/stm32_e407/board.yml b/boards/olimex/stm32_e407/board.yml index b01060566dc4f..d15c9456c2c2e 100644 --- a/boards/olimex/stm32_e407/board.yml +++ b/boards/olimex/stm32_e407/board.yml @@ -1,5 +1,6 @@ board: name: olimex_stm32_e407 + full_name: OLIMEX-STM32-E407 vendor: olimex socs: - name: stm32f407xx diff --git a/boards/olimex/stm32_h103/board.yml b/boards/olimex/stm32_h103/board.yml index 2917e4e19d969..eb8195402ae00 100644 --- a/boards/olimex/stm32_h103/board.yml +++ b/boards/olimex/stm32_h103/board.yml @@ -1,5 +1,6 @@ board: name: olimex_stm32_h103 + full_name: OLIMEX-STM32-H103 vendor: olimex socs: - name: stm32f103xb diff --git a/boards/olimex/stm32_h405/board.yml b/boards/olimex/stm32_h405/board.yml index bd0e8f4beaa97..aa10f3c9ef99f 100644 --- a/boards/olimex/stm32_h405/board.yml +++ b/boards/olimex/stm32_h405/board.yml @@ -1,5 +1,6 @@ board: name: olimex_stm32_h405 + full_name: OLIMEX-STM32-H405 vendor: olimex socs: - name: stm32f405xx diff --git a/boards/olimex/stm32_h407/board.yml b/boards/olimex/stm32_h407/board.yml index 5d2f0d7a78370..452a712f595ea 100644 --- a/boards/olimex/stm32_h407/board.yml +++ b/boards/olimex/stm32_h407/board.yml @@ -1,5 +1,6 @@ board: name: olimex_stm32_h407 + full_name: OLIMEX-STM32-H407 vendor: olimex socs: - name: stm32f407xx diff --git a/boards/olimex/stm32_p405/board.yml b/boards/olimex/stm32_p405/board.yml index 12201ed22c9b4..8ac0ac264ab99 100644 --- a/boards/olimex/stm32_p405/board.yml +++ b/boards/olimex/stm32_p405/board.yml @@ -1,5 +1,6 @@ board: name: olimex_stm32_p405 + full_name: OLIMEX-STM32-P405 vendor: olimex socs: - name: stm32f405xx diff --git a/boards/openisa/rv32m1_vega/board.yml b/boards/openisa/rv32m1_vega/board.yml index 5813a21b54f20..4e60beab43588 100644 --- a/boards/openisa/rv32m1_vega/board.yml +++ b/boards/openisa/rv32m1_vega/board.yml @@ -1,5 +1,6 @@ board: name: rv32m1_vega + full_name: OpenISA VEGAboard vendor: openisa socs: - name: openisa_rv32m1 diff --git a/boards/others/black_f407ve/board.yml b/boards/others/black_f407ve/board.yml index 472d766cbc7a6..6c14732f07ca3 100644 --- a/boards/others/black_f407ve/board.yml +++ b/boards/others/black_f407ve/board.yml @@ -1,5 +1,6 @@ board: name: black_f407ve + full_name: Black STM32 F407VE Development Board vendor: others socs: - name: stm32f407xx diff --git a/boards/others/black_f407zg_pro/board.yml b/boards/others/black_f407zg_pro/board.yml index dc322315620da..96f2891f768f3 100644 --- a/boards/others/black_f407zg_pro/board.yml +++ b/boards/others/black_f407zg_pro/board.yml @@ -1,5 +1,6 @@ board: name: black_f407zg_pro + full_name: Black STM32 F407ZG Pro Development Board vendor: others socs: - name: stm32f407xx diff --git a/boards/others/icev_wireless/board.yml b/boards/others/icev_wireless/board.yml index 2dcef96cbdfac..b810e970f76c1 100644 --- a/boards/others/icev_wireless/board.yml +++ b/boards/others/icev_wireless/board.yml @@ -1,5 +1,6 @@ board: name: icev_wireless + full_name: ICE-V Wireless vendor: others socs: - name: esp32c3 diff --git a/boards/others/neorv32/board.yml b/boards/others/neorv32/board.yml index f12fa42b78fbc..9154d90e8a96d 100644 --- a/boards/others/neorv32/board.yml +++ b/boards/others/neorv32/board.yml @@ -1,5 +1,6 @@ board: name: neorv32 + full_name: NEORV32 vendor: others revision: format: major.minor.patch diff --git a/boards/others/serpente/board.yml b/boards/others/serpente/board.yml index e5775329a06e3..0be3e94ffe6b0 100644 --- a/boards/others/serpente/board.yml +++ b/boards/others/serpente/board.yml @@ -1,5 +1,6 @@ board: name: serpente + full_name: Arturo182 Serpente vendor: solderparty socs: - name: samd21e18a diff --git a/boards/others/stm32_min_dev/board.yml b/boards/others/stm32_min_dev/board.yml index 28a3569737917..3ac7dfb895835 100644 --- a/boards/others/stm32_min_dev/board.yml +++ b/boards/others/stm32_min_dev/board.yml @@ -1,5 +1,6 @@ board: name: stm32_min_dev + full_name: STM32 Minimum Development Board vendor: others revision: format: custom diff --git a/boards/others/stm32f030_demo/board.yml b/boards/others/stm32f030_demo/board.yml index 348d40a665b88..b0f19e1184657 100644 --- a/boards/others/stm32f030_demo/board.yml +++ b/boards/others/stm32f030_demo/board.yml @@ -1,5 +1,6 @@ board: name: stm32f030_demo + full_name: STM32F030 DEMO BOARD vendor: others socs: - name: stm32f030x6 diff --git a/boards/others/stm32f103_mini/board.yml b/boards/others/stm32f103_mini/board.yml index 4ea8f6fbb2d01..f88d33224ddfb 100644 --- a/boards/others/stm32f103_mini/board.yml +++ b/boards/others/stm32f103_mini/board.yml @@ -1,5 +1,6 @@ board: name: stm32f103_mini + full_name: STM32F103 Mini vendor: st socs: - name: stm32f103xe diff --git a/boards/others/stm32f401_mini/board.yml b/boards/others/stm32f401_mini/board.yml index b6ec3cd3af8ef..6c057c149df5f 100644 --- a/boards/others/stm32f401_mini/board.yml +++ b/boards/others/stm32f401_mini/board.yml @@ -1,5 +1,6 @@ board: name: stm32f401_mini + full_name: STM32 Mini F401 vendor: others socs: - name: stm32f401xc diff --git a/boards/panasonic/pan1770_evb/board.yml b/boards/panasonic/pan1770_evb/board.yml index 0808b91b99b17..91d8a8c01b751 100644 --- a/boards/panasonic/pan1770_evb/board.yml +++ b/boards/panasonic/pan1770_evb/board.yml @@ -1,5 +1,6 @@ board: name: pan1770_evb + full_name: PAN1770 Evaluation Board vendor: panasonic socs: - name: nrf52840 diff --git a/boards/panasonic/pan1780_evb/board.yml b/boards/panasonic/pan1780_evb/board.yml index 53a9a68192aa8..fcb9c21e6f597 100644 --- a/boards/panasonic/pan1780_evb/board.yml +++ b/boards/panasonic/pan1780_evb/board.yml @@ -1,5 +1,6 @@ board: name: pan1780_evb + full_name: PAN1780 Evaluation Board vendor: panasonic socs: - name: nrf52840 diff --git a/boards/panasonic/pan1781_evb/board.yml b/boards/panasonic/pan1781_evb/board.yml index 64a5a23996164..9f4fae581f7f1 100644 --- a/boards/panasonic/pan1781_evb/board.yml +++ b/boards/panasonic/pan1781_evb/board.yml @@ -1,5 +1,6 @@ board: name: pan1781_evb + full_name: PAN1781 Evaluation Board vendor: panasonic socs: - name: nrf52820 diff --git a/boards/panasonic/pan1782_evb/board.yml b/boards/panasonic/pan1782_evb/board.yml index 649e5507d825a..f4bfec853e095 100644 --- a/boards/panasonic/pan1782_evb/board.yml +++ b/boards/panasonic/pan1782_evb/board.yml @@ -1,5 +1,6 @@ board: name: pan1782_evb + full_name: PAN1782 Evaluation Board vendor: panasonic socs: - name: nrf52833 diff --git a/boards/panasonic/pan1783/board.yml b/boards/panasonic/pan1783/board.yml index 461763d86f2b7..750f82b78485c 100644 --- a/boards/panasonic/pan1783/board.yml +++ b/boards/panasonic/pan1783/board.yml @@ -1,13 +1,16 @@ boards: - name: pan1783_evb + full_name: PAN1783 Evaluation Board vendor: panasonic socs: - name: nrf5340 - name: pan1783a_evb + full_name: PAN1783A Evaluation Board vendor: panasonic socs: - name: nrf5340 - name: pan1783a_pa_evb + full_name: PAN1783A-PA Evaluation Board vendor: panasonic socs: - name: nrf5340 diff --git a/boards/particle/argon/board.yml b/boards/particle/argon/board.yml index 08eadfda743b7..b4cf83969ec47 100644 --- a/boards/particle/argon/board.yml +++ b/boards/particle/argon/board.yml @@ -1,5 +1,6 @@ board: name: particle_argon + full_name: Argon vendor: particle socs: - name: nrf52840 diff --git a/boards/particle/boron/board.yml b/boards/particle/boron/board.yml index bb77655e8c01f..25742d7ee794a 100644 --- a/boards/particle/boron/board.yml +++ b/boards/particle/boron/board.yml @@ -1,5 +1,6 @@ board: name: particle_boron + full_name: Boron vendor: particle socs: - name: nrf52840 diff --git a/boards/particle/nrf51_blenano/board.yml b/boards/particle/nrf51_blenano/board.yml index bc651160fa41d..f4b6bc29495de 100644 --- a/boards/particle/nrf51_blenano/board.yml +++ b/boards/particle/nrf51_blenano/board.yml @@ -1,5 +1,6 @@ board: name: nrf51_blenano + full_name: Redbear Labs Nano vendor: particle socs: - name: nrf51822 diff --git a/boards/particle/nrf52_blenano2/board.yml b/boards/particle/nrf52_blenano2/board.yml index fedad35babcbf..dc90277b7e7fa 100644 --- a/boards/particle/nrf52_blenano2/board.yml +++ b/boards/particle/nrf52_blenano2/board.yml @@ -1,5 +1,6 @@ board: name: nrf52_blenano2 + full_name: Redbear Labs Nano v2 vendor: particle socs: - name: nrf52832 diff --git a/boards/particle/xenon/board.yml b/boards/particle/xenon/board.yml index a681db97a1ff7..894b1cf6c9051 100644 --- a/boards/particle/xenon/board.yml +++ b/boards/particle/xenon/board.yml @@ -1,5 +1,6 @@ board: name: particle_xenon + full_name: Xenon vendor: particle socs: - name: nrf52840 diff --git a/boards/phytec/mimx8mm_phyboard_polis/board.yml b/boards/phytec/mimx8mm_phyboard_polis/board.yml index 1c416b90eb165..8f8342053548f 100644 --- a/boards/phytec/mimx8mm_phyboard_polis/board.yml +++ b/boards/phytec/mimx8mm_phyboard_polis/board.yml @@ -1,5 +1,6 @@ board: name: mimx8mm_phyboard_polis + full_name: PhyBOARD Polis (NXP i.MX8M Mini) vendor: phytec socs: - name: mimx8mm6 diff --git a/boards/phytec/mimx8mp_phyboard_pollux/board.yml b/boards/phytec/mimx8mp_phyboard_pollux/board.yml index b871a53e37082..a8e5cbf9a0a71 100644 --- a/boards/phytec/mimx8mp_phyboard_pollux/board.yml +++ b/boards/phytec/mimx8mp_phyboard_pollux/board.yml @@ -1,5 +1,6 @@ board: name: mimx8mp_phyboard_pollux + full_name: PhyBOARD Pollux (NXP i.MX8M Plus) vendor: phytec socs: - name: mimx8ml8 diff --git a/boards/phytec/phyboard_electra/board.yml b/boards/phytec/phyboard_electra/board.yml index d5c24f15cbdba..5e58cfb543190 100644 --- a/boards/phytec/phyboard_electra/board.yml +++ b/boards/phytec/phyboard_electra/board.yml @@ -1,5 +1,6 @@ board: name: phyboard_electra + full_name: phyBOARD-Electra AM64x M4F Core vendor: phytec socs: - name: am6442 diff --git a/boards/phytec/phyboard_lyra/board.yml b/boards/phytec/phyboard_lyra/board.yml index 2b98d77f51045..c9a6c3a9b14fc 100644 --- a/boards/phytec/phyboard_lyra/board.yml +++ b/boards/phytec/phyboard_lyra/board.yml @@ -1,5 +1,6 @@ board: name: phyboard_lyra + full_name: phyBOARD-Lyra AM62x A53 Core vendor: phytec socs: - name: am6234 diff --git a/boards/phytec/reel_board/board.yml b/boards/phytec/reel_board/board.yml index 75878900418a9..2fd1363c0d7d8 100644 --- a/boards/phytec/reel_board/board.yml +++ b/boards/phytec/reel_board/board.yml @@ -1,5 +1,6 @@ board: name: reel_board + full_name: reel board vendor: phytec socs: - name: nrf52840 diff --git a/boards/pine64/pinetime_devkit0/board.yml b/boards/pine64/pinetime_devkit0/board.yml index e4c926cf96b0b..448cbca23b8de 100644 --- a/boards/pine64/pinetime_devkit0/board.yml +++ b/boards/pine64/pinetime_devkit0/board.yml @@ -1,5 +1,6 @@ board: name: pinetime_devkit0 + full_name: PineTime DevKit0 vendor: pine64 socs: - name: nrf52832 diff --git a/boards/pjrc/teensy4/board.yml b/boards/pjrc/teensy4/board.yml index 7906ae3b8236e..0ae483ebc2c70 100644 --- a/boards/pjrc/teensy4/board.yml +++ b/boards/pjrc/teensy4/board.yml @@ -1,9 +1,11 @@ boards: - name: teensy40 + full_name: Teensy 4.0 vendor: pjrc socs: - name: mimxrt1062 - name: teensy41 + full_name: Teensy 4.1 vendor: pjrc socs: - name: mimxrt1062 diff --git a/boards/qemu/arc/board.yml b/boards/qemu/arc/board.yml index 1fb49911afa9c..27571b6c5ce02 100644 --- a/boards/qemu/arc/board.yml +++ b/boards/qemu/arc/board.yml @@ -1,5 +1,6 @@ board: name: qemu_arc + full_name: QEMU Emulation for ARCv2 & ARCv3 vendor: qemu socs: - name: qemu_arc_em diff --git a/boards/qemu/cortex_a53/board.yml b/boards/qemu/cortex_a53/board.yml index ab04f6ac8f1ee..d096f5495a1fd 100644 --- a/boards/qemu/cortex_a53/board.yml +++ b/boards/qemu/cortex_a53/board.yml @@ -1,5 +1,6 @@ board: name: qemu_cortex_a53 + full_name: QEMU Emulation for ARM Cortex-A53 vendor: arm socs: - name: qemu_cortex_a53 diff --git a/boards/qemu/cortex_a9/board.yml b/boards/qemu/cortex_a9/board.yml index 72cba6ce8d940..4b48ca9d2adae 100644 --- a/boards/qemu/cortex_a9/board.yml +++ b/boards/qemu/cortex_a9/board.yml @@ -1,5 +1,6 @@ board: name: qemu_cortex_a9 + full_name: QEMU Emulation for Cortex-A9 vendor: qemu socs: - name: xc7z007s diff --git a/boards/qemu/cortex_m0/board.yml b/boards/qemu/cortex_m0/board.yml index fc71c63896ba1..aa58b1a0ef4c7 100644 --- a/boards/qemu/cortex_m0/board.yml +++ b/boards/qemu/cortex_m0/board.yml @@ -1,5 +1,6 @@ board: name: qemu_cortex_m0 + full_name: QEMU Emulation for ARM Cortex-M0 vendor: nordic socs: - name: nrf51822 diff --git a/boards/qemu/cortex_m3/board.yml b/boards/qemu/cortex_m3/board.yml index 5566adb5e02f9..6422e416ef3b5 100644 --- a/boards/qemu/cortex_m3/board.yml +++ b/boards/qemu/cortex_m3/board.yml @@ -1,5 +1,6 @@ board: name: qemu_cortex_m3 + full_name: QEMU Emulation for ARM Cortex-M3 vendor: qemu socs: - name: ti_lm3s6965 diff --git a/boards/qemu/cortex_r5/board.yml b/boards/qemu/cortex_r5/board.yml index 6cf5b2fee9543..ae013f0a4ba56 100644 --- a/boards/qemu/cortex_r5/board.yml +++ b/boards/qemu/cortex_r5/board.yml @@ -1,5 +1,6 @@ board: name: qemu_cortex_r5 + full_name: QEMU Emulation for ARM Cortex-R5 vendor: qemu socs: - name: zynqmp_rpu diff --git a/boards/qemu/kvm_arm64/board.yml b/boards/qemu/kvm_arm64/board.yml index dd0edf80316d2..ff9a9e4c2be30 100644 --- a/boards/qemu/kvm_arm64/board.yml +++ b/boards/qemu/kvm_arm64/board.yml @@ -1,5 +1,6 @@ board: name: qemu_kvm_arm64 + full_name: QEMU Emulation for ARM AArch64 Virt KVM vendor: arm socs: - name: qemu_virt_arm64 diff --git a/boards/qemu/leon3/board.yml b/boards/qemu/leon3/board.yml index 6d4fdc189bf79..61d3cd2f71a6c 100644 --- a/boards/qemu/leon3/board.yml +++ b/boards/qemu/leon3/board.yml @@ -1,5 +1,6 @@ board: name: qemu_leon3 + full_name: QEMU Emulation for LEON3 vendor: gaisler socs: - name: leon3 diff --git a/boards/qemu/malta/board.yml b/boards/qemu/malta/board.yml index 050bd381c734a..acb375c5804b6 100644 --- a/boards/qemu/malta/board.yml +++ b/boards/qemu/malta/board.yml @@ -1,5 +1,6 @@ board: name: qemu_malta + full_name: QEMU Emulation for MIPS Malta vendor: qemu socs: - name: qemu_malta diff --git a/boards/qemu/nios2/board.yml b/boards/qemu/nios2/board.yml index 93f6487d31887..aae1184806201 100644 --- a/boards/qemu/nios2/board.yml +++ b/boards/qemu/nios2/board.yml @@ -1,5 +1,6 @@ board: name: qemu_nios2 + full_name: QEMU Emulation for Altera Nios-II vendor: altr socs: - name: qemu_nios2 diff --git a/boards/qemu/riscv32/board.yml b/boards/qemu/riscv32/board.yml index 0ba208612a990..00b7b794e24e5 100644 --- a/boards/qemu/riscv32/board.yml +++ b/boards/qemu/riscv32/board.yml @@ -1,5 +1,6 @@ board: name: qemu_riscv32 + full_name: QEMU Emulation for RISCV32 vendor: qemu socs: - name: qemu_virt_riscv32 diff --git a/boards/qemu/riscv32_xip/board.yml b/boards/qemu/riscv32_xip/board.yml index beca29532f45b..4c43b4d73c81b 100644 --- a/boards/qemu/riscv32_xip/board.yml +++ b/boards/qemu/riscv32_xip/board.yml @@ -1,5 +1,6 @@ board: name: qemu_riscv32_xip + full_name: QEMU Emulation for RISCV32 XIP vendor: qemu socs: - name: fe310 diff --git a/boards/qemu/riscv32e/board.yml b/boards/qemu/riscv32e/board.yml index cc8e6f0beccf6..e4b41d79f3ea0 100644 --- a/boards/qemu/riscv32e/board.yml +++ b/boards/qemu/riscv32e/board.yml @@ -1,5 +1,6 @@ board: name: qemu_riscv32e + full_name: QEMU Emulation for RISCV32E Emulation vendor: qemu socs: - name: qemu_virt_riscv32e diff --git a/boards/qemu/riscv64/board.yml b/boards/qemu/riscv64/board.yml index aa51fd1fdbaeb..eeab9480a24a1 100644 --- a/boards/qemu/riscv64/board.yml +++ b/boards/qemu/riscv64/board.yml @@ -1,5 +1,6 @@ board: name: qemu_riscv64 + full_name: QEMU Emulation for RISCV64 vendor: qemu socs: - name: qemu_virt_riscv64 diff --git a/boards/qemu/x86/board.yml b/boards/qemu/x86/board.yml index dafcffba24f7a..7e0fa76a0438a 100644 --- a/boards/qemu/x86/board.yml +++ b/boards/qemu/x86/board.yml @@ -1,7 +1,7 @@ boards: - name: qemu_x86 - full_name: 'QEMU Emulation for X86' + full_name: QEMU Emulation for X86 socs: - name: atom variants: @@ -12,18 +12,18 @@ boards: - name: 'xip' - name: qemu_x86_lakemont - full_name: 'QEMU Emulation for X86 / Lakemont CPU' + full_name: QEMU Emulation for X86 / Lakemont CPU socs: - name: lakemont - name: qemu_x86_64 - full_name: 'QEMU Emulation for X86 64bit' + full_name: QEMU Emulation for X86 64bit socs: - name: atom variants: - name: 'nokpti' - name: qemu_x86_tiny - full_name: 'QEMU Emulation for X86 Minimal Configuration' + full_name: QEMU Emulation for X86 Minimal Configuration socs: - name: atom diff --git a/boards/qemu/xtensa/board.yml b/boards/qemu/xtensa/board.yml index 0b2afcd488326..285fab0512194 100644 --- a/boards/qemu/xtensa/board.yml +++ b/boards/qemu/xtensa/board.yml @@ -1,5 +1,6 @@ board: name: qemu_xtensa + full_name: QEMU Emulation for Xtensa vendor: cdns socs: - name: dc233c diff --git a/boards/qorvo/decawave_dwm1001_dev/board.yml b/boards/qorvo/decawave_dwm1001_dev/board.yml index f1d0ae7def009..3197993cc389b 100644 --- a/boards/qorvo/decawave_dwm1001_dev/board.yml +++ b/boards/qorvo/decawave_dwm1001_dev/board.yml @@ -1,5 +1,6 @@ board: name: decawave_dwm1001_dev + full_name: Decawave DWM1001 vendor: qorvo socs: - name: nrf52832 diff --git a/boards/quicklogic/qomu/board.yml b/boards/quicklogic/qomu/board.yml index e71125610fad8..b1c9dd2ce6069 100644 --- a/boards/quicklogic/qomu/board.yml +++ b/boards/quicklogic/qomu/board.yml @@ -1,5 +1,6 @@ board: name: qomu + full_name: Qomu vendor: quicklogic socs: - name: quicklogic_eos_s3 diff --git a/boards/quicklogic/quick_feather/board.yml b/boards/quicklogic/quick_feather/board.yml index 3ca618cbe34e2..d271954fb9716 100644 --- a/boards/quicklogic/quick_feather/board.yml +++ b/boards/quicklogic/quick_feather/board.yml @@ -1,5 +1,6 @@ board: name: quick_feather + full_name: QuickFeather vendor: quicklogic socs: - name: quicklogic_eos_s3 diff --git a/boards/rak/rak11720/board.yml b/boards/rak/rak11720/board.yml index 827beef7e7648..418094b216ca9 100644 --- a/boards/rak/rak11720/board.yml +++ b/boards/rak/rak11720/board.yml @@ -1,5 +1,6 @@ board: name: rak11720 + full_name: RAK11720 vendor: rakwireless socs: - name: apollo3_blue diff --git a/boards/rak/rak4631/board.yml b/boards/rak/rak4631/board.yml index a3b886728233e..5a97085dd0a66 100644 --- a/boards/rak/rak4631/board.yml +++ b/boards/rak/rak4631/board.yml @@ -1,5 +1,6 @@ board: name: rak4631 + full_name: RAK4631 vendor: rakwireless socs: - name: nrf52840 diff --git a/boards/rak/rak5010/board.yml b/boards/rak/rak5010/board.yml index c681ac27cb7f0..d3fc39488316f 100644 --- a/boards/rak/rak5010/board.yml +++ b/boards/rak/rak5010/board.yml @@ -1,5 +1,6 @@ board: name: rak5010 + full_name: RAK5010 vendor: rakwireless socs: - name: nrf52840 diff --git a/boards/raspberrypi/rpi_4b/board.yml b/boards/raspberrypi/rpi_4b/board.yml index a84904f9b29aa..9c8a7ad5bc20e 100644 --- a/boards/raspberrypi/rpi_4b/board.yml +++ b/boards/raspberrypi/rpi_4b/board.yml @@ -1,5 +1,6 @@ board: name: rpi_4b + full_name: Raspberry Pi 4 Model B (Cortex-A72) vendor: raspberrypi socs: - name: bcm2711 diff --git a/boards/raspberrypi/rpi_5/board.yml b/boards/raspberrypi/rpi_5/board.yml index d604b7f4e5130..2c90e5c2db06b 100644 --- a/boards/raspberrypi/rpi_5/board.yml +++ b/boards/raspberrypi/rpi_5/board.yml @@ -1,5 +1,6 @@ board: name: rpi_5 + full_name: Raspberry Pi 5 (Cortex-A76) vendor: raspberrypi socs: - name: bcm2712 diff --git a/boards/raspberrypi/rpi_pico/board.yml b/boards/raspberrypi/rpi_pico/board.yml index e4f8e5bc8d55d..c7378a328018a 100644 --- a/boards/raspberrypi/rpi_pico/board.yml +++ b/boards/raspberrypi/rpi_pico/board.yml @@ -1,5 +1,6 @@ board: name: rpi_pico + full_name: Raspberry Pi Pico vendor: raspberrypi socs: - name: rp2040 diff --git a/boards/raytac/mdbt50q_db_33/board.yml b/boards/raytac/mdbt50q_db_33/board.yml index dbad99fd48979..c15a873add06f 100644 --- a/boards/raytac/mdbt50q_db_33/board.yml +++ b/boards/raytac/mdbt50q_db_33/board.yml @@ -1,5 +1,6 @@ board: name: raytac_mdbt50q_db_33 + full_name: MDBT50Q-DB-33 vendor: raytac socs: - name: nrf52833 diff --git a/boards/raytac/mdbt50q_db_40/board.yml b/boards/raytac/mdbt50q_db_40/board.yml index a8c109b715f78..1d06509fb2f00 100644 --- a/boards/raytac/mdbt50q_db_40/board.yml +++ b/boards/raytac/mdbt50q_db_40/board.yml @@ -1,5 +1,6 @@ board: name: raytac_mdbt50q_db_40 + full_name: MDBT50Q-DB-40 vendor: raytac socs: - name: nrf52840 diff --git a/boards/raytac/mdbt53_db_40/board.yml b/boards/raytac/mdbt53_db_40/board.yml index 84bef186b3366..823043b0c01fd 100644 --- a/boards/raytac/mdbt53_db_40/board.yml +++ b/boards/raytac/mdbt53_db_40/board.yml @@ -1,5 +1,6 @@ board: name: raytac_mdbt53_db_40 + full_name: MDBT53-DB-40 vendor: raytac socs: - name: 'nrf5340' diff --git a/boards/raytac/mdbt53v_db_40/board.yml b/boards/raytac/mdbt53v_db_40/board.yml index 9d3bfd4689bae..56fe6f2029487 100644 --- a/boards/raytac/mdbt53v_db_40/board.yml +++ b/boards/raytac/mdbt53v_db_40/board.yml @@ -1,5 +1,6 @@ board: name: raytac_mdbt53v_db_40 + full_name: MDBT53V-DB-40 vendor: raytac socs: - name: 'nrf5340' diff --git a/boards/renesas/da14695_dk_usb/board.yml b/boards/renesas/da14695_dk_usb/board.yml index b9d3f06cb1d09..fa0ea2c2bc2cf 100644 --- a/boards/renesas/da14695_dk_usb/board.yml +++ b/boards/renesas/da14695_dk_usb/board.yml @@ -1,5 +1,6 @@ board: name: da14695_dk_usb + full_name: DA14695 Development Kit USB vendor: renesas socs: - name: da14695 diff --git a/boards/renesas/da1469x_dk_pro/board.yml b/boards/renesas/da1469x_dk_pro/board.yml index 09ab03c0b26c0..6c7388567acf5 100644 --- a/boards/renesas/da1469x_dk_pro/board.yml +++ b/boards/renesas/da1469x_dk_pro/board.yml @@ -1,5 +1,6 @@ board: name: da1469x_dk_pro + full_name: DA1469x Development Kit Pro vendor: renesas socs: - name: da14699 diff --git a/boards/renesas/ek_ra2a1/board.yml b/boards/renesas/ek_ra2a1/board.yml index 82c498850aa89..6c47b918ec505 100644 --- a/boards/renesas/ek_ra2a1/board.yml +++ b/boards/renesas/ek_ra2a1/board.yml @@ -1,5 +1,6 @@ board: name: ek_ra2a1 + full_name: RA2A1 Evaluation Kit vendor: renesas socs: - name: r7fa2a1ab3cfm diff --git a/boards/renesas/ek_ra4e2/board.yml b/boards/renesas/ek_ra4e2/board.yml index 8baa0819ff2d5..161c7543ff94f 100644 --- a/boards/renesas/ek_ra4e2/board.yml +++ b/boards/renesas/ek_ra4e2/board.yml @@ -1,5 +1,6 @@ board: name: ek_ra4e2 + full_name: RA4E2 Evaluation Kit vendor: renesas socs: - name: r7fa4e2b93cfm diff --git a/boards/renesas/ek_ra4m2/board.yml b/boards/renesas/ek_ra4m2/board.yml index c19484eff8a9f..31a7e8e269a34 100644 --- a/boards/renesas/ek_ra4m2/board.yml +++ b/boards/renesas/ek_ra4m2/board.yml @@ -1,5 +1,6 @@ board: name: ek_ra4m2 + full_name: RA4M2 Evaluation Kit vendor: renesas socs: - name: r7fa4m2ad3cfp diff --git a/boards/renesas/ek_ra4m3/board.yml b/boards/renesas/ek_ra4m3/board.yml index 30b3b39ac4e34..b84c06cd53192 100644 --- a/boards/renesas/ek_ra4m3/board.yml +++ b/boards/renesas/ek_ra4m3/board.yml @@ -1,5 +1,6 @@ board: name: ek_ra4m3 + full_name: RA4M3 Evaluation Kit vendor: renesas socs: - name: r7fa4m3af3cfb diff --git a/boards/renesas/ek_ra4w1/board.yml b/boards/renesas/ek_ra4w1/board.yml index 709a8435475f3..8783b2b957c3c 100644 --- a/boards/renesas/ek_ra4w1/board.yml +++ b/boards/renesas/ek_ra4w1/board.yml @@ -1,5 +1,6 @@ board: name: ek_ra4w1 + full_name: RA4W1 Evaluation Kit vendor: renesas socs: - name: r7fa4w1ad2cng diff --git a/boards/renesas/ek_ra6e2/board.yml b/boards/renesas/ek_ra6e2/board.yml index 972476c9b2ef9..5c2629250d764 100644 --- a/boards/renesas/ek_ra6e2/board.yml +++ b/boards/renesas/ek_ra6e2/board.yml @@ -1,5 +1,6 @@ board: name: ek_ra6e2 + full_name: RA6E2 Evaluation Kit vendor: renesas socs: - name: r7fa6e2bb3cfm diff --git a/boards/renesas/ek_ra6m1/board.yml b/boards/renesas/ek_ra6m1/board.yml index db68eb8a0684e..003486b48ff58 100644 --- a/boards/renesas/ek_ra6m1/board.yml +++ b/boards/renesas/ek_ra6m1/board.yml @@ -1,5 +1,6 @@ board: name: ek_ra6m1 + full_name: RA6M1 Evaluation Kit vendor: renesas socs: - name: r7fa6m1ad3cfp diff --git a/boards/renesas/ek_ra6m2/board.yml b/boards/renesas/ek_ra6m2/board.yml index 325b1601c9a5b..ec00a66bf19fe 100644 --- a/boards/renesas/ek_ra6m2/board.yml +++ b/boards/renesas/ek_ra6m2/board.yml @@ -1,5 +1,6 @@ board: name: ek_ra6m2 + full_name: RA6M2 Evaluation Kit vendor: renesas socs: - name: r7fa6m2af3cfb diff --git a/boards/renesas/ek_ra6m3/board.yml b/boards/renesas/ek_ra6m3/board.yml index 2bf115b0a184a..084afa42ced3d 100644 --- a/boards/renesas/ek_ra6m3/board.yml +++ b/boards/renesas/ek_ra6m3/board.yml @@ -1,5 +1,6 @@ board: name: ek_ra6m3 + full_name: RA6M3 Evaluation Kit vendor: renesas socs: - name: r7fa6m3ah3cfc diff --git a/boards/renesas/ek_ra6m4/board.yml b/boards/renesas/ek_ra6m4/board.yml index 5c7e34ff1809c..c7bb851f8d718 100644 --- a/boards/renesas/ek_ra6m4/board.yml +++ b/boards/renesas/ek_ra6m4/board.yml @@ -1,5 +1,6 @@ board: name: ek_ra6m4 + full_name: RA6M4 Evaluation Kit vendor: renesas socs: - name: r7fa6m4af3cfb diff --git a/boards/renesas/ek_ra6m5/board.yml b/boards/renesas/ek_ra6m5/board.yml index 826e64f943e1d..d084f775ec132 100644 --- a/boards/renesas/ek_ra6m5/board.yml +++ b/boards/renesas/ek_ra6m5/board.yml @@ -1,5 +1,6 @@ board: name: ek_ra6m5 + full_name: RA6M5 Evaluation Kit vendor: renesas socs: - name: r7fa6m5bh3cfc diff --git a/boards/renesas/ek_ra8d1/board.yml b/boards/renesas/ek_ra8d1/board.yml index 9b48ea9b942fa..d109cd234a350 100644 --- a/boards/renesas/ek_ra8d1/board.yml +++ b/boards/renesas/ek_ra8d1/board.yml @@ -1,5 +1,6 @@ board: name: ek_ra8d1 + full_name: RA8D1 Evaluation Kit vendor: renesas socs: - name: r7fa8d1bhecbd diff --git a/boards/renesas/ek_ra8m1/board.yml b/boards/renesas/ek_ra8m1/board.yml index 136846ecc81b6..f98587420bc88 100644 --- a/boards/renesas/ek_ra8m1/board.yml +++ b/boards/renesas/ek_ra8m1/board.yml @@ -1,5 +1,6 @@ board: name: ek_ra8m1 + full_name: RA8M1 Evaluation Kit vendor: renesas socs: - name: r7fa8m1ahecbd diff --git a/boards/renesas/fpb_ra6e1/board.yml b/boards/renesas/fpb_ra6e1/board.yml index ed1e0a18bfdb3..d2f980d6acceb 100644 --- a/boards/renesas/fpb_ra6e1/board.yml +++ b/boards/renesas/fpb_ra6e1/board.yml @@ -1,5 +1,6 @@ board: name: fpb_ra6e1 + full_name: RA6E1 Fast Prototyping Board vendor: renesas socs: - name: r7fa6e10f2cfp diff --git a/boards/renesas/fpb_ra6e2/board.yml b/boards/renesas/fpb_ra6e2/board.yml index 0d28094c404bc..586b7c74810d3 100644 --- a/boards/renesas/fpb_ra6e2/board.yml +++ b/boards/renesas/fpb_ra6e2/board.yml @@ -1,5 +1,6 @@ board: name: fpb_ra6e2 + full_name: RA6E2 Fast Prototyping Board vendor: renesas socs: - name: r7fa6e2bb3cfm diff --git a/boards/renesas/mck_ra8t1/board.yml b/boards/renesas/mck_ra8t1/board.yml index d722716361194..b7897016bbe15 100644 --- a/boards/renesas/mck_ra8t1/board.yml +++ b/boards/renesas/mck_ra8t1/board.yml @@ -1,5 +1,6 @@ board: name: mck_ra8t1 + full_name: RA8T1 Evaluation Kit vendor: renesas socs: - name: r7fa8t1ahecbd diff --git a/boards/renesas/rcar_h3ulcb/board.yml b/boards/renesas/rcar_h3ulcb/board.yml index 7989c688e8126..a0e38a44a9061 100644 --- a/boards/renesas/rcar_h3ulcb/board.yml +++ b/boards/renesas/rcar_h3ulcb/board.yml @@ -1,5 +1,6 @@ board: name: rcar_h3ulcb + full_name: R-CAR H3 ARM CA57 (ARMv8) vendor: renesas socs: - name: r8a77951 diff --git a/boards/renesas/rcar_salvator_x/board.yml b/boards/renesas/rcar_salvator_x/board.yml index b85c3aebe67af..11166fb0a2c3d 100644 --- a/boards/renesas/rcar_salvator_x/board.yml +++ b/boards/renesas/rcar_salvator_x/board.yml @@ -1,5 +1,6 @@ board: name: rcar_salvator_x + full_name: R-Car H3 Salvator-X vendor: renesas socs: - name: r8a77951 diff --git a/boards/renesas/rcar_salvator_xs/board.yml b/boards/renesas/rcar_salvator_xs/board.yml index b48fda7ff48c5..2b8ded23f8a26 100644 --- a/boards/renesas/rcar_salvator_xs/board.yml +++ b/boards/renesas/rcar_salvator_xs/board.yml @@ -1,5 +1,6 @@ board: name: rcar_salvator_xs + full_name: R-CAR Salvator XS M3 ARM CA57 (ARMv8) vendor: renesas socs: - name: r8a77961 diff --git a/boards/renesas/rcar_spider_s4/board.yml b/boards/renesas/rcar_spider_s4/board.yml index 560ed7f2ae83d..caf9b8cf5ad7d 100644 --- a/boards/renesas/rcar_spider_s4/board.yml +++ b/boards/renesas/rcar_spider_s4/board.yml @@ -1,5 +1,6 @@ board: name: rcar_spider_s4 + full_name: R-CAR Spider S4 (ARM64) vendor: renesas socs: - name: r8a779f0 diff --git a/boards/renesas/rzt2m_starterkit/board.yml b/boards/renesas/rzt2m_starterkit/board.yml index def32c06cd2a6..21be12a29b2e7 100644 --- a/boards/renesas/rzt2m_starterkit/board.yml +++ b/boards/renesas/rzt2m_starterkit/board.yml @@ -1,5 +1,6 @@ board: name: rzt2m_starter_kit + full_name: Starter Kit+ for RZ/T2M vendor: renesas socs: - name: renesas_rzt2m diff --git a/boards/renode/cortex_r8_virtual/board.yml b/boards/renode/cortex_r8_virtual/board.yml index 799b2a9ba12d0..b201b3e96c37f 100644 --- a/boards/renode/cortex_r8_virtual/board.yml +++ b/boards/renode/cortex_r8_virtual/board.yml @@ -1,5 +1,6 @@ board: name: cortex_r8_virtual + full_name: Cortex-R8 Virtual vendor: renode socs: - name: cortex_r8_virtual diff --git a/boards/renode/riscv32_virtual/board.yml b/boards/renode/riscv32_virtual/board.yml index b059266009a95..27c5eb7c3688a 100644 --- a/boards/renode/riscv32_virtual/board.yml +++ b/boards/renode/riscv32_virtual/board.yml @@ -1,5 +1,6 @@ board: name: riscv32_virtual + full_name: RISCV32 Virtual vendor: renode socs: - name: riscv_virtual_renode diff --git a/boards/ronoth/lodev/board.yml b/boards/ronoth/lodev/board.yml index 008f2e5a7f5b9..db71507ae8a7e 100644 --- a/boards/ronoth/lodev/board.yml +++ b/boards/ronoth/lodev/board.yml @@ -1,5 +1,6 @@ board: name: ronoth_lodev + full_name: LoDev vendor: ronoth socs: - name: stm32l073xx diff --git a/boards/ruuvi/ruuvitag/board.yml b/boards/ruuvi/ruuvitag/board.yml index c8d45886d82b4..e0e6fc40a553f 100644 --- a/boards/ruuvi/ruuvitag/board.yml +++ b/boards/ruuvi/ruuvitag/board.yml @@ -1,5 +1,6 @@ board: name: ruuvi_ruuvitag + full_name: RuuviTag vendor: ruuvi socs: - name: nrf52832 diff --git a/boards/sc/scobc_module1/board.yml b/boards/sc/scobc_module1/board.yml index d8f83a733acf6..2ffbcc51e5414 100644 --- a/boards/sc/scobc_module1/board.yml +++ b/boards/sc/scobc_module1/board.yml @@ -1,5 +1,6 @@ board: name: scobc_module1 + full_name: OBC module 1 vendor: spacecubics socs: - name: designstart_fpga_cortex_m3 diff --git a/boards/seagate/faze/board.yml b/boards/seagate/faze/board.yml index bd672fe549fca..29ad19a2d55b8 100644 --- a/boards/seagate/faze/board.yml +++ b/boards/seagate/faze/board.yml @@ -1,5 +1,6 @@ board: name: faze + full_name: FireCuda Gaming SSD (FaZe) board vendor: seagate socs: - name: lpc11u67 diff --git a/boards/seagate/legend/board.yml b/boards/seagate/legend/board.yml index 0c100284bdeed..a015c60bc4e3c 100644 --- a/boards/seagate/legend/board.yml +++ b/boards/seagate/legend/board.yml @@ -1,5 +1,6 @@ board: name: legend + full_name: Legend vendor: seagate revision: format: custom diff --git a/boards/seco/stm32f3_seco_d23/board.yml b/boards/seco/stm32f3_seco_d23/board.yml index a7976211a2ce0..75a16bd3b4833 100644 --- a/boards/seco/stm32f3_seco_d23/board.yml +++ b/boards/seco/stm32f3_seco_d23/board.yml @@ -1,5 +1,6 @@ board: name: stm32f3_seco_d23 + full_name: SECO SBC-3.5-PX30 (JUNO - D23) (STM32F302) vendor: seco socs: - name: stm32f302xc diff --git a/boards/seeed/lora_e5_dev_board/board.yml b/boards/seeed/lora_e5_dev_board/board.yml index b6691948f2b02..e53e5451e0c27 100644 --- a/boards/seeed/lora_e5_dev_board/board.yml +++ b/boards/seeed/lora_e5_dev_board/board.yml @@ -1,5 +1,6 @@ board: name: lora_e5_dev_board + full_name: LoRa-E5 Dev Board vendor: seeed socs: - name: stm32wle5xx diff --git a/boards/seeed/lora_e5_mini/board.yml b/boards/seeed/lora_e5_mini/board.yml index 1643caea3c19c..7f1080afb5d2a 100644 --- a/boards/seeed/lora_e5_mini/board.yml +++ b/boards/seeed/lora_e5_mini/board.yml @@ -1,5 +1,6 @@ board: name: lora_e5_mini + full_name: LoRa-E5 mini vendor: seeed socs: - name: stm32wle5xx diff --git a/boards/seeed/seeeduino_xiao/board.yml b/boards/seeed/seeeduino_xiao/board.yml index 386a3b3cbb6b4..642e7e750e32e 100644 --- a/boards/seeed/seeeduino_xiao/board.yml +++ b/boards/seeed/seeeduino_xiao/board.yml @@ -1,5 +1,6 @@ board: name: seeeduino_xiao + full_name: Seeeduino XIAO vendor: seeed socs: - name: samd21g18a diff --git a/boards/seeed/wio_terminal/board.yml b/boards/seeed/wio_terminal/board.yml index a7080a877775e..7972eeb9de544 100644 --- a/boards/seeed/wio_terminal/board.yml +++ b/boards/seeed/wio_terminal/board.yml @@ -1,5 +1,6 @@ board: name: wio_terminal + full_name: Wio Terminal vendor: seeed socs: - name: samd51p19a diff --git a/boards/seeed/xiao_ble/board.yml b/boards/seeed/xiao_ble/board.yml index 3f83399a7fba0..ecc63f716ad02 100644 --- a/boards/seeed/xiao_ble/board.yml +++ b/boards/seeed/xiao_ble/board.yml @@ -1,5 +1,6 @@ board: name: xiao_ble + full_name: XIAO BLE (Sense) vendor: seeed socs: - name: nrf52840 diff --git a/boards/seeed/xiao_esp32c3/board.yml b/boards/seeed/xiao_esp32c3/board.yml index 2bd54cf346f66..d9c7cef765ca0 100644 --- a/boards/seeed/xiao_esp32c3/board.yml +++ b/boards/seeed/xiao_esp32c3/board.yml @@ -1,5 +1,6 @@ board: name: xiao_esp32c3 + full_name: XIAO ESP32C3 vendor: seeed socs: - name: esp32c3 diff --git a/boards/seeed/xiao_esp32s3/board.yml b/boards/seeed/xiao_esp32s3/board.yml index 02ba87e5bc21e..c3eb3a0204dd1 100644 --- a/boards/seeed/xiao_esp32s3/board.yml +++ b/boards/seeed/xiao_esp32s3/board.yml @@ -1,5 +1,6 @@ board: name: xiao_esp32s3 + full_name: XIAO ESP32S3 vendor: seeed socs: - name: esp32s3 diff --git a/boards/seeed/xiao_rp2040/board.yml b/boards/seeed/xiao_rp2040/board.yml index 7eaca9159728c..75b352e9aeec8 100644 --- a/boards/seeed/xiao_rp2040/board.yml +++ b/boards/seeed/xiao_rp2040/board.yml @@ -1,5 +1,6 @@ board: name: xiao_rp2040 + full_name: XIAO RP2040 vendor: seeed socs: - name: rp2040 diff --git a/boards/segger/ip_k66f/board.yml b/boards/segger/ip_k66f/board.yml index c1593280a49a6..21b7c0b65e422 100644 --- a/boards/segger/ip_k66f/board.yml +++ b/boards/segger/ip_k66f/board.yml @@ -1,5 +1,6 @@ board: name: ip_k66f + full_name: IP Switch Board vendor: segger socs: - name: mk66f18 diff --git a/boards/segger/trb_stm32f407/board.yml b/boards/segger/trb_stm32f407/board.yml index 52ba24a33eb0f..1fc912e38cafc 100644 --- a/boards/segger/trb_stm32f407/board.yml +++ b/boards/segger/trb_stm32f407/board.yml @@ -1,5 +1,6 @@ board: name: segger_trb_stm32f407 + full_name: Cortex-M Trace Reference Board V1.2 vendor: segger socs: - name: stm32f407xx diff --git a/boards/sensry/ganymed_bob/board.yml b/boards/sensry/ganymed_bob/board.yml index cc6591f625358..5e444b0dbb898 100644 --- a/boards/sensry/ganymed_bob/board.yml +++ b/boards/sensry/ganymed_bob/board.yml @@ -3,6 +3,7 @@ board: name: ganymed_bob + full_name: Ganymed Break-Out-Board (BOB) vendor: sensry socs: - name: sy120_gbm diff --git a/boards/sifive/hifive1/board.yml b/boards/sifive/hifive1/board.yml index 2909cb5aaeb95..a83c4f2e2c746 100644 --- a/boards/sifive/hifive1/board.yml +++ b/boards/sifive/hifive1/board.yml @@ -1,5 +1,6 @@ board: name: hifive1 + full_name: HiFive1 vendor: sifive socs: - name: fe310 diff --git a/boards/sifive/hifive_unleashed/board.yml b/boards/sifive/hifive_unleashed/board.yml index f9dd3ce6e6b22..5535b9ca54458 100644 --- a/boards/sifive/hifive_unleashed/board.yml +++ b/boards/sifive/hifive_unleashed/board.yml @@ -1,5 +1,6 @@ board: name: hifive_unleashed + full_name: HiFive Unleashed vendor: sifive socs: - name: fu540 diff --git a/boards/sifive/hifive_unmatched/board.yml b/boards/sifive/hifive_unmatched/board.yml index 703d94e852b3a..eb61e98e55c47 100644 --- a/boards/sifive/hifive_unmatched/board.yml +++ b/boards/sifive/hifive_unmatched/board.yml @@ -1,5 +1,6 @@ board: name: hifive_unmatched + full_name: HiFive Unmatched vendor: sifive socs: - name: fu740 diff --git a/boards/silabs/dev_kits/sim3u1xx_dk/board.yml b/boards/silabs/dev_kits/sim3u1xx_dk/board.yml index c70d54204838d..facdc0f817af5 100644 --- a/boards/silabs/dev_kits/sim3u1xx_dk/board.yml +++ b/boards/silabs/dev_kits/sim3u1xx_dk/board.yml @@ -4,6 +4,7 @@ board: name: sim3u1xx_dk + full_name: SiM3U1xx 32-bit MCU USB Development Kit vendor: silabs socs: - name: sim3u167 diff --git a/boards/silabs/dev_kits/sltb004a/board.yml b/boards/silabs/dev_kits/sltb004a/board.yml index 2141aa3817df9..73c4c2aced778 100644 --- a/boards/silabs/dev_kits/sltb004a/board.yml +++ b/boards/silabs/dev_kits/sltb004a/board.yml @@ -1,5 +1,6 @@ board: name: sltb004a + full_name: EFR32MG12 Thunderboard (SLTB004A) vendor: silabs socs: - name: efr32mg12p332f1024gl125 diff --git a/boards/silabs/dev_kits/sltb009a/board.yml b/boards/silabs/dev_kits/sltb009a/board.yml index af69758728d32..e42c7cd0b6685 100644 --- a/boards/silabs/dev_kits/sltb009a/board.yml +++ b/boards/silabs/dev_kits/sltb009a/board.yml @@ -1,5 +1,6 @@ board: name: sltb009a + full_name: EFM32GG12 Thunderboard (SLTB009A) vendor: silabs socs: - name: efm32gg12b810f1024gm64 diff --git a/boards/silabs/dev_kits/sltb010a/board.yml b/boards/silabs/dev_kits/sltb010a/board.yml index 4586a51ef722b..8e2cf70500598 100644 --- a/boards/silabs/dev_kits/sltb010a/board.yml +++ b/boards/silabs/dev_kits/sltb010a/board.yml @@ -1,5 +1,6 @@ boards: - name: sltb010a + full_name: EFR32BG22 Thunderboard (SLTB010A) vendor: silabs socs: - name: efr32bg22c224f512im40 diff --git a/boards/silabs/dev_kits/xg24_dk2601b/board.yml b/boards/silabs/dev_kits/xg24_dk2601b/board.yml index f946744d228e6..46b2e55a2ced4 100644 --- a/boards/silabs/dev_kits/xg24_dk2601b/board.yml +++ b/boards/silabs/dev_kits/xg24_dk2601b/board.yml @@ -1,5 +1,6 @@ board: name: xg24_dk2601b + full_name: EFR32xG24 Dev Kit (xG24-DK2601B) vendor: silabs socs: - name: efr32mg24b310f1536im48 diff --git a/boards/silabs/dev_kits/xg27_dk2602a/board.yml b/boards/silabs/dev_kits/xg27_dk2602a/board.yml index 83a3037a1a785..1d6d016ecf597 100644 --- a/boards/silabs/dev_kits/xg27_dk2602a/board.yml +++ b/boards/silabs/dev_kits/xg27_dk2602a/board.yml @@ -1,5 +1,6 @@ boards: - name: xg27_dk2602a + full_name: EFR32xG27 Dev Kit (xG27-DK2602A) vendor: silabs socs: - name: efr32bg27c140f768im40 diff --git a/boards/silabs/radio_boards/slwrb4104a/board.yml b/boards/silabs/radio_boards/slwrb4104a/board.yml index 5ca377b2c8fbd..d1122ace33140 100644 --- a/boards/silabs/radio_boards/slwrb4104a/board.yml +++ b/boards/silabs/radio_boards/slwrb4104a/board.yml @@ -1,4 +1,5 @@ boards: - name: slwrb4104a + full_name: EFR32BG13 2.4 GHz 10 dBm (SLWRB4104A) socs: - name: efr32bg13p632f512gm48 diff --git a/boards/silabs/radio_boards/slwrb4161a/board.yml b/boards/silabs/radio_boards/slwrb4161a/board.yml index a05542a40d819..fd0c68e48b2a9 100644 --- a/boards/silabs/radio_boards/slwrb4161a/board.yml +++ b/boards/silabs/radio_boards/slwrb4161a/board.yml @@ -1,4 +1,5 @@ boards: - name: slwrb4161a + full_name: EFR32MG12 2.4 GHz 19 dBm (SLWRB4161A) socs: - name: efr32mg12p432f1024gl125 diff --git a/boards/silabs/radio_boards/slwrb4170a/board.yml b/boards/silabs/radio_boards/slwrb4170a/board.yml index 3137d819edb34..5d9fd340d3e0b 100644 --- a/boards/silabs/radio_boards/slwrb4170a/board.yml +++ b/boards/silabs/radio_boards/slwrb4170a/board.yml @@ -1,4 +1,5 @@ boards: - name: slwrb4170a + full_name: EFR32MG12 2400/868-915 MHz 19 dBm Dual Band (SLWRB4170A) socs: - name: efr32mg12p433f1024gm68 diff --git a/boards/silabs/radio_boards/slwrb4180a/board.yml b/boards/silabs/radio_boards/slwrb4180a/board.yml index c6f825f735a3c..f77ecb3f65b19 100644 --- a/boards/silabs/radio_boards/slwrb4180a/board.yml +++ b/boards/silabs/radio_boards/slwrb4180a/board.yml @@ -1,4 +1,5 @@ boards: - name: slwrb4180a + full_name: EFR32xG21 2.4 GHz 20 dBm (SLWRB4180A) socs: - name: efr32mg21a020f1024im32 diff --git a/boards/silabs/radio_boards/slwrb4250b/board.yml b/boards/silabs/radio_boards/slwrb4250b/board.yml index cffd4c63dbb30..052b39f83c308 100644 --- a/boards/silabs/radio_boards/slwrb4250b/board.yml +++ b/boards/silabs/radio_boards/slwrb4250b/board.yml @@ -1,4 +1,5 @@ boards: - name: slwrb4250b + full_name: EFR32FG1 2400/868 MHz 13 dBm Dual Band (SLWRB4250B) socs: - name: efr32fg1p133f256gm48 diff --git a/boards/silabs/radio_boards/slwrb4255a/board.yml b/boards/silabs/radio_boards/slwrb4255a/board.yml index 4b76604b1708d..841a0858e13f4 100644 --- a/boards/silabs/radio_boards/slwrb4255a/board.yml +++ b/boards/silabs/radio_boards/slwrb4255a/board.yml @@ -1,4 +1,5 @@ boards: - name: slwrb4255a + full_name: EFR32FG13 2400/915 MHz 19 dBm Dual Band (SLWRB4255A) socs: - name: efr32fg13p233f512gm48 diff --git a/boards/silabs/radio_boards/slwrb4321a/board.yml b/boards/silabs/radio_boards/slwrb4321a/board.yml index a86f5c2d6209a..c0ad89de758f8 100644 --- a/boards/silabs/radio_boards/slwrb4321a/board.yml +++ b/boards/silabs/radio_boards/slwrb4321a/board.yml @@ -1,5 +1,6 @@ board: name: slwrb4321a + full_name: WGM160P Wi-Fi Module (SLWRB4321A) vendor: silabs socs: - name: efm32gg11b820f2048gm64 diff --git a/boards/silabs/radio_boards/xg24_rb4187c/board.yml b/boards/silabs/radio_boards/xg24_rb4187c/board.yml index 09a4d0743700d..3645714223754 100644 --- a/boards/silabs/radio_boards/xg24_rb4187c/board.yml +++ b/boards/silabs/radio_boards/xg24_rb4187c/board.yml @@ -1,4 +1,5 @@ boards: - name: xg24_rb4187c + full_name: EFR32xG24 2.4 GHz 20 dBm (xG24-RB4187C) socs: - name: efr32mg24b220f1536im48 diff --git a/boards/silabs/starter_kits/efm32wg_stk3800/board.yml b/boards/silabs/starter_kits/efm32wg_stk3800/board.yml index 034c623141b3e..ab827f8b34674 100644 --- a/boards/silabs/starter_kits/efm32wg_stk3800/board.yml +++ b/boards/silabs/starter_kits/efm32wg_stk3800/board.yml @@ -1,5 +1,6 @@ board: name: efm32wg_stk3800 + full_name: EFM32 Wonder Gecko (EFM32WG-STK3800) vendor: silabs socs: - name: efm32wg990f256 diff --git a/boards/silabs/starter_kits/slstk3400a/board.yml b/boards/silabs/starter_kits/slstk3400a/board.yml index e6573ac89f5d3..30d6090012d60 100644 --- a/boards/silabs/starter_kits/slstk3400a/board.yml +++ b/boards/silabs/starter_kits/slstk3400a/board.yml @@ -1,5 +1,6 @@ board: name: slstk3400a + full_name: EFM32 Happy Gecko (SLSTK3400A) vendor: silabs socs: - name: efm32hg322f64 diff --git a/boards/silabs/starter_kits/slstk3401a/board.yml b/boards/silabs/starter_kits/slstk3401a/board.yml index 98ae08c199216..99ce00a0ad2f0 100644 --- a/boards/silabs/starter_kits/slstk3401a/board.yml +++ b/boards/silabs/starter_kits/slstk3401a/board.yml @@ -1,5 +1,6 @@ board: name: slstk3401a + full_name: EFM32 Pearl Gecko (SLSTK3401A) vendor: silabs socs: - name: efm32pg1b200f256gm48 diff --git a/boards/silabs/starter_kits/slstk3402a/board.yml b/boards/silabs/starter_kits/slstk3402a/board.yml index 539af134c6d8b..6c9350d31bfad 100644 --- a/boards/silabs/starter_kits/slstk3402a/board.yml +++ b/boards/silabs/starter_kits/slstk3402a/board.yml @@ -1,5 +1,6 @@ board: name: slstk3402a + full_name: EFM32 Pearl Gecko 12 (SLSTK3402A) vendor: silabs socs: - name: efm32pg12b500f1024gl125 diff --git a/boards/silabs/starter_kits/slstk3701a/board.yml b/boards/silabs/starter_kits/slstk3701a/board.yml index 5c1db884a42bb..86615b1e8fe02 100644 --- a/boards/silabs/starter_kits/slstk3701a/board.yml +++ b/boards/silabs/starter_kits/slstk3701a/board.yml @@ -1,5 +1,6 @@ board: name: slstk3701a + full_name: EFM32 Giant Gecko 11 (SLSTK3701A) vendor: silabs socs: - name: efm32gg11b820f2048gl192 diff --git a/boards/sipeed/longan_nano/board.yml b/boards/sipeed/longan_nano/board.yml index 035ea8f540dcb..4f1fedeba776c 100644 --- a/boards/sipeed/longan_nano/board.yml +++ b/boards/sipeed/longan_nano/board.yml @@ -1,5 +1,6 @@ board: name: longan_nano + full_name: Longan Nano vendor: sipeed socs: - name: gd32vf103 diff --git a/boards/snps/em_starterkit/board.yml b/boards/snps/em_starterkit/board.yml index b5c30f1ba9d67..c9279e060f249 100644 --- a/boards/snps/em_starterkit/board.yml +++ b/boards/snps/em_starterkit/board.yml @@ -1,5 +1,6 @@ board: name: em_starterkit + full_name: ARC EM Starter Kit vendor: snps socs: - name: emsk_em7d diff --git a/boards/snps/emsdp/board.yml b/boards/snps/emsdp/board.yml index 463c30bc2fc1f..6a5f944733d00 100644 --- a/boards/snps/emsdp/board.yml +++ b/boards/snps/emsdp/board.yml @@ -1,5 +1,6 @@ board: name: emsdp + full_name: ARC EM Software Development Platform vendor: snps socs: - name: emsdp_em4 diff --git a/boards/snps/hsdk/board.yml b/boards/snps/hsdk/board.yml index 44363f8a9b8a0..164b176bae6a7 100644 --- a/boards/snps/hsdk/board.yml +++ b/boards/snps/hsdk/board.yml @@ -1,5 +1,6 @@ board: name: hsdk + full_name: ARC HS Development Kit vendor: snps socs: - name: arc_hsdk diff --git a/boards/snps/hsdk4xd/board.yml b/boards/snps/hsdk4xd/board.yml index 70e04fa7e80ec..147e75e69f076 100644 --- a/boards/snps/hsdk4xd/board.yml +++ b/boards/snps/hsdk4xd/board.yml @@ -1,5 +1,6 @@ board: name: hsdk4xd + full_name: ARC HS4x/HS4xD Development Kit vendor: snps socs: - name: arc_hsdk4xd diff --git a/boards/snps/iotdk/board.yml b/boards/snps/iotdk/board.yml index 5222ad815cf84..9889a3762f828 100644 --- a/boards/snps/iotdk/board.yml +++ b/boards/snps/iotdk/board.yml @@ -1,5 +1,6 @@ board: name: iotdk + full_name: ARC IoT Development Kit vendor: snps socs: - name: arc_iot diff --git a/boards/snps/nsim/arc_classic/board.yml b/boards/snps/nsim/arc_classic/board.yml index a5089774c473e..20bbd3071ec50 100644 --- a/boards/snps/nsim/arc_classic/board.yml +++ b/boards/snps/nsim/arc_classic/board.yml @@ -1,5 +1,6 @@ board: name: nsim + full_name: ARC nSIM and HAPS FPGA boards vendor: snps socs: - name: nsim_em diff --git a/boards/snps/nsim/arc_v/board.yml b/boards/snps/nsim/arc_v/board.yml index a91eaffd90a00..4a8d44eee298f 100644 --- a/boards/snps/nsim/arc_v/board.yml +++ b/boards/snps/nsim/arc_v/board.yml @@ -1,5 +1,6 @@ board: name: nsim_arc_v + full_name: RISC-V nSIM and HAPS FPGA boards vendor: snps socs: - name: rmx100 diff --git a/boards/sparkfun/micromod/board.yml b/boards/sparkfun/micromod/board.yml index 851ac345bc538..2f7df46ca0c4b 100644 --- a/boards/sparkfun/micromod/board.yml +++ b/boards/sparkfun/micromod/board.yml @@ -1,5 +1,6 @@ board: name: micromod + full_name: MicroMod board Processor vendor: sparkfun socs: - name: nrf52840 diff --git a/boards/sparkfun/nrf52_sparkfun/board.yml b/boards/sparkfun/nrf52_sparkfun/board.yml index 5e44e8a072b8a..d892ab054bb49 100644 --- a/boards/sparkfun/nrf52_sparkfun/board.yml +++ b/boards/sparkfun/nrf52_sparkfun/board.yml @@ -1,5 +1,6 @@ board: name: nrf52_sparkfun + full_name: nRF52832 breakout vendor: sparkfun socs: - name: nrf52832 diff --git a/boards/sparkfun/pro_micro_rp2040/board.yml b/boards/sparkfun/pro_micro_rp2040/board.yml index ed9e449e8aa23..e4c96de669d53 100644 --- a/boards/sparkfun/pro_micro_rp2040/board.yml +++ b/boards/sparkfun/pro_micro_rp2040/board.yml @@ -1,5 +1,6 @@ board: name: sparkfun_pro_micro_rp2040 + full_name: Pro Micro RP2040 vendor: sparkfun socs: - name: rp2040 diff --git a/boards/sparkfun/red_v_things_plus/board.yml b/boards/sparkfun/red_v_things_plus/board.yml index 6ef8e39c2f920..fe588482767a2 100644 --- a/boards/sparkfun/red_v_things_plus/board.yml +++ b/boards/sparkfun/red_v_things_plus/board.yml @@ -1,5 +1,6 @@ board: name: sparkfun_red_v_things_plus + full_name: RED-V Things Plus vendor: sparkfun socs: - name: fe310 diff --git a/boards/sparkfun/thing_plus/board.yml b/boards/sparkfun/thing_plus/board.yml index 18037dfd5b66f..f632d9feab0d0 100644 --- a/boards/sparkfun/thing_plus/board.yml +++ b/boards/sparkfun/thing_plus/board.yml @@ -1,5 +1,6 @@ board: name: sparkfun_thing_plus + full_name: nRF9160 Thing Plus vendor: sparkfun socs: - name: nrf9160 diff --git a/boards/sparkfun/thing_plus_matter_mgm240p/board.yml b/boards/sparkfun/thing_plus_matter_mgm240p/board.yml index 69ecc88a5b81e..e2d94d63e1c39 100644 --- a/boards/sparkfun/thing_plus_matter_mgm240p/board.yml +++ b/boards/sparkfun/thing_plus_matter_mgm240p/board.yml @@ -1,5 +1,6 @@ board: name: sparkfun_thing_plus_matter_mgm240p + full_name: THING PLUS MATTER vendor: sparkfun socs: - name: efr32mg24b020f1536im40 diff --git a/boards/st/b_g474e_dpow1/board.yml b/boards/st/b_g474e_dpow1/board.yml index 06d037f81a0f5..c2c81d974893d 100644 --- a/boards/st/b_g474e_dpow1/board.yml +++ b/boards/st/b_g474e_dpow1/board.yml @@ -1,5 +1,6 @@ board: name: b_g474e_dpow1 + full_name: B-G474E-DPOW1 Discovery vendor: st socs: - name: stm32g474xx diff --git a/boards/st/b_l072z_lrwan1/board.yml b/boards/st/b_l072z_lrwan1/board.yml index 1a7b494de1904..70a1d334a4a04 100644 --- a/boards/st/b_l072z_lrwan1/board.yml +++ b/boards/st/b_l072z_lrwan1/board.yml @@ -1,5 +1,6 @@ board: name: b_l072z_lrwan1 + full_name: B-L072Z-LRWAN1 Discovery kit vendor: st socs: - name: stm32l072xx diff --git a/boards/st/b_l4s5i_iot01a/board.yml b/boards/st/b_l4s5i_iot01a/board.yml index e41cb4b100239..de0a620a93f47 100644 --- a/boards/st/b_l4s5i_iot01a/board.yml +++ b/boards/st/b_l4s5i_iot01a/board.yml @@ -1,5 +1,6 @@ board: name: b_l4s5i_iot01a + full_name: B-L4S5I-IOT01A Discovery kit vendor: st socs: - name: stm32l4s5xx diff --git a/boards/st/b_u585i_iot02a/board.yml b/boards/st/b_u585i_iot02a/board.yml index 55e740ec45d32..c5ae28435f0aa 100644 --- a/boards/st/b_u585i_iot02a/board.yml +++ b/boards/st/b_u585i_iot02a/board.yml @@ -1,5 +1,6 @@ board: name: b_u585i_iot02a + full_name: B-U585I-IOT02A Discovery kit vendor: st socs: - name: stm32u585xx diff --git a/boards/st/disco_l475_iot1/board.yml b/boards/st/disco_l475_iot1/board.yml index c11f22591a569..1179b0800280e 100644 --- a/boards/st/disco_l475_iot1/board.yml +++ b/boards/st/disco_l475_iot1/board.yml @@ -1,5 +1,6 @@ board: name: disco_l475_iot1 + full_name: Disco L475 IOT01 (B-L475E-IOT01A) vendor: st socs: - name: stm32l475xx diff --git a/boards/st/nucleo_c031c6/board.yml b/boards/st/nucleo_c031c6/board.yml index 37d48de4d52d5..412db17f2df48 100644 --- a/boards/st/nucleo_c031c6/board.yml +++ b/boards/st/nucleo_c031c6/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_c031c6 + full_name: Nucleo C031C6 vendor: st socs: - name: stm32c031xx diff --git a/boards/st/nucleo_f030r8/board.yml b/boards/st/nucleo_f030r8/board.yml index 515aae8c5b09d..bc62b0f7a8d5e 100644 --- a/boards/st/nucleo_f030r8/board.yml +++ b/boards/st/nucleo_f030r8/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f030r8 + full_name: Nucleo F030R8 vendor: st revision: format: number diff --git a/boards/st/nucleo_f031k6/board.yml b/boards/st/nucleo_f031k6/board.yml index 01fc79ac03391..4e0c573075184 100644 --- a/boards/st/nucleo_f031k6/board.yml +++ b/boards/st/nucleo_f031k6/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f031k6 + full_name: Nucleo F031K6 vendor: st socs: - name: stm32f031x6 diff --git a/boards/st/nucleo_f042k6/board.yml b/boards/st/nucleo_f042k6/board.yml index 89d8b05042819..787d8d41b3d33 100644 --- a/boards/st/nucleo_f042k6/board.yml +++ b/boards/st/nucleo_f042k6/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f042k6 + full_name: Nucleo F042K6 vendor: st socs: - name: stm32f042x6 diff --git a/boards/st/nucleo_f070rb/board.yml b/boards/st/nucleo_f070rb/board.yml index 8f3a6a4987803..4ed7f75d40b00 100644 --- a/boards/st/nucleo_f070rb/board.yml +++ b/boards/st/nucleo_f070rb/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f070rb + full_name: Nucleo F070RB vendor: st socs: - name: stm32f070xb diff --git a/boards/st/nucleo_f091rc/board.yml b/boards/st/nucleo_f091rc/board.yml index 9f3fe67f8f69e..7e7b8e5876eda 100644 --- a/boards/st/nucleo_f091rc/board.yml +++ b/boards/st/nucleo_f091rc/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f091rc + full_name: Nucleo F091RC vendor: st socs: - name: stm32f091xc diff --git a/boards/st/nucleo_f103rb/board.yml b/boards/st/nucleo_f103rb/board.yml index 57425f7832d68..230bda289753c 100644 --- a/boards/st/nucleo_f103rb/board.yml +++ b/boards/st/nucleo_f103rb/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f103rb + full_name: Nucleo F103RB vendor: st socs: - name: stm32f103xb diff --git a/boards/st/nucleo_f207zg/board.yml b/boards/st/nucleo_f207zg/board.yml index 8b35f4457cd7a..ea2312af9a7e6 100644 --- a/boards/st/nucleo_f207zg/board.yml +++ b/boards/st/nucleo_f207zg/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f207zg + full_name: Nucleo F207ZG vendor: st socs: - name: stm32f207xx diff --git a/boards/st/nucleo_f302r8/board.yml b/boards/st/nucleo_f302r8/board.yml index a39ae3dc6d2e2..dd7c32ff7d778 100644 --- a/boards/st/nucleo_f302r8/board.yml +++ b/boards/st/nucleo_f302r8/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f302r8 + full_name: Nucleo F302R8 vendor: st socs: - name: stm32f302x8 diff --git a/boards/st/nucleo_f303k8/board.yml b/boards/st/nucleo_f303k8/board.yml index ae44e2bbb550b..50a409d7358f9 100644 --- a/boards/st/nucleo_f303k8/board.yml +++ b/boards/st/nucleo_f303k8/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f303k8 + full_name: Nucleo F303K8 vendor: st socs: - name: stm32f303x8 diff --git a/boards/st/nucleo_f303re/board.yml b/boards/st/nucleo_f303re/board.yml index dc99dcc1d6a23..5b33354408c12 100644 --- a/boards/st/nucleo_f303re/board.yml +++ b/boards/st/nucleo_f303re/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f303re + full_name: Nucleo F303RE vendor: st socs: - name: stm32f303xe diff --git a/boards/st/nucleo_f334r8/board.yml b/boards/st/nucleo_f334r8/board.yml index 7a8a3e642d89f..8ae552c4895c7 100644 --- a/boards/st/nucleo_f334r8/board.yml +++ b/boards/st/nucleo_f334r8/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f334r8 + full_name: Nucleo F334R8 vendor: st socs: - name: stm32f334x8 diff --git a/boards/st/nucleo_f401re/board.yml b/boards/st/nucleo_f401re/board.yml index 4cb781427b514..8d322a5d408a8 100644 --- a/boards/st/nucleo_f401re/board.yml +++ b/boards/st/nucleo_f401re/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f401re + full_name: Nucleo F401RE vendor: st socs: - name: stm32f401xe diff --git a/boards/st/nucleo_f410rb/board.yml b/boards/st/nucleo_f410rb/board.yml index 23c247e3bad90..b2a93fcb445b6 100644 --- a/boards/st/nucleo_f410rb/board.yml +++ b/boards/st/nucleo_f410rb/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f410rb + full_name: Nucleo F410RB vendor: st socs: - name: stm32f410rx diff --git a/boards/st/nucleo_f411re/board.yml b/boards/st/nucleo_f411re/board.yml index 6ed17fdc2c457..e3cfe259304e5 100644 --- a/boards/st/nucleo_f411re/board.yml +++ b/boards/st/nucleo_f411re/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f411re + full_name: Nucleo F411RE vendor: st socs: - name: stm32f411xe diff --git a/boards/st/nucleo_f412zg/board.yml b/boards/st/nucleo_f412zg/board.yml index b4bb8372f50b5..07919c3f4450d 100644 --- a/boards/st/nucleo_f412zg/board.yml +++ b/boards/st/nucleo_f412zg/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f412zg + full_name: Nucleo F412ZG vendor: st socs: - name: stm32f412zx diff --git a/boards/st/nucleo_f413zh/board.yml b/boards/st/nucleo_f413zh/board.yml index a372cec4b8ac2..a207e5e0357d7 100644 --- a/boards/st/nucleo_f413zh/board.yml +++ b/boards/st/nucleo_f413zh/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f413zh + full_name: Nucleo F413ZH vendor: st socs: - name: stm32f413xx diff --git a/boards/st/nucleo_f429zi/board.yml b/boards/st/nucleo_f429zi/board.yml index ecf8e93828bfa..c2a2b867a11d1 100644 --- a/boards/st/nucleo_f429zi/board.yml +++ b/boards/st/nucleo_f429zi/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f429zi + full_name: Nucleo F429ZI vendor: st socs: - name: stm32f429xx diff --git a/boards/st/nucleo_f446re/board.yml b/boards/st/nucleo_f446re/board.yml index d68a45990b84c..659fff6463641 100644 --- a/boards/st/nucleo_f446re/board.yml +++ b/boards/st/nucleo_f446re/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f446re + full_name: Nucleo F446RE vendor: st socs: - name: stm32f446xx diff --git a/boards/st/nucleo_f446ze/board.yml b/boards/st/nucleo_f446ze/board.yml index eb577af456bd2..32861aa1789d7 100644 --- a/boards/st/nucleo_f446ze/board.yml +++ b/boards/st/nucleo_f446ze/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f446ze + full_name: Nucleo F446ZE vendor: st socs: - name: stm32f446xx diff --git a/boards/st/nucleo_f722ze/board.yml b/boards/st/nucleo_f722ze/board.yml index 793193bc2ca1a..80ab328c14e5c 100644 --- a/boards/st/nucleo_f722ze/board.yml +++ b/boards/st/nucleo_f722ze/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f722ze + full_name: Nucleo F722ZE vendor: st socs: - name: stm32f722xx diff --git a/boards/st/nucleo_f746zg/board.yml b/boards/st/nucleo_f746zg/board.yml index 1df68107ece55..d21d7faab7528 100644 --- a/boards/st/nucleo_f746zg/board.yml +++ b/boards/st/nucleo_f746zg/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f746zg + full_name: Nucleo F746ZG vendor: st socs: - name: stm32f746xx diff --git a/boards/st/nucleo_f756zg/board.yml b/boards/st/nucleo_f756zg/board.yml index 791d760175449..f95bc53df7f96 100644 --- a/boards/st/nucleo_f756zg/board.yml +++ b/boards/st/nucleo_f756zg/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f756zg + full_name: Nucleo F756ZG vendor: st socs: - name: stm32f756xx diff --git a/boards/st/nucleo_f767zi/board.yml b/boards/st/nucleo_f767zi/board.yml index 810b80a5fdcbc..30dea098842ad 100644 --- a/boards/st/nucleo_f767zi/board.yml +++ b/boards/st/nucleo_f767zi/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_f767zi + full_name: Nucleo F767ZI vendor: st socs: - name: stm32f767xx diff --git a/boards/st/nucleo_g031k8/board.yml b/boards/st/nucleo_g031k8/board.yml index 690afd52fb0dd..2382e3e70fdcf 100644 --- a/boards/st/nucleo_g031k8/board.yml +++ b/boards/st/nucleo_g031k8/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_g031k8 + full_name: Nucleo G031K8 vendor: st socs: - name: stm32g031xx diff --git a/boards/st/nucleo_g070rb/board.yml b/boards/st/nucleo_g070rb/board.yml index 88306b0d7f08c..a0074bc9449e7 100644 --- a/boards/st/nucleo_g070rb/board.yml +++ b/boards/st/nucleo_g070rb/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_g070rb + full_name: Nucleo G070RB vendor: st socs: - name: stm32g070xx diff --git a/boards/st/nucleo_g071rb/board.yml b/boards/st/nucleo_g071rb/board.yml index 05e948a2f36be..63c1ce9add469 100644 --- a/boards/st/nucleo_g071rb/board.yml +++ b/boards/st/nucleo_g071rb/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_g071rb + full_name: Nucleo G071RB vendor: st socs: - name: stm32g071xx diff --git a/boards/st/nucleo_g0b1re/board.yml b/boards/st/nucleo_g0b1re/board.yml index b9d0f93261f70..f7732c1330f6b 100644 --- a/boards/st/nucleo_g0b1re/board.yml +++ b/boards/st/nucleo_g0b1re/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_g0b1re + full_name: Nucleo G0B1RE vendor: st socs: - name: stm32g0b1xx diff --git a/boards/st/nucleo_g431rb/board.yml b/boards/st/nucleo_g431rb/board.yml index 460dcf740e85f..e338c94cbaa3e 100644 --- a/boards/st/nucleo_g431rb/board.yml +++ b/boards/st/nucleo_g431rb/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_g431rb + full_name: Nucleo G431RB vendor: st socs: - name: stm32g431xx diff --git a/boards/st/nucleo_g474re/board.yml b/boards/st/nucleo_g474re/board.yml index 7cf7857f52704..9921219d1e5af 100644 --- a/boards/st/nucleo_g474re/board.yml +++ b/boards/st/nucleo_g474re/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_g474re + full_name: Nucleo G474RE vendor: st socs: - name: stm32g474xx diff --git a/boards/st/nucleo_h503rb/board.yml b/boards/st/nucleo_h503rb/board.yml index bbf3662873bfa..15f7b72e306cd 100644 --- a/boards/st/nucleo_h503rb/board.yml +++ b/boards/st/nucleo_h503rb/board.yml @@ -3,6 +3,7 @@ board: name: nucleo_h503rb + full_name: Nucleo H503RB vendor: st socs: - name: stm32h503xx diff --git a/boards/st/nucleo_h533re/board.yml b/boards/st/nucleo_h533re/board.yml index 4b633011b714a..11b0d6aa069dc 100644 --- a/boards/st/nucleo_h533re/board.yml +++ b/boards/st/nucleo_h533re/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_h533re + full_name: Nucleo H533RE vendor: st socs: - name: stm32h533xx diff --git a/boards/st/nucleo_h563zi/board.yml b/boards/st/nucleo_h563zi/board.yml index 42319f55755d9..fec89e6d37b2a 100644 --- a/boards/st/nucleo_h563zi/board.yml +++ b/boards/st/nucleo_h563zi/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_h563zi + full_name: Nucleo H563ZI vendor: st socs: - name: stm32h563xx diff --git a/boards/st/nucleo_h723zg/board.yml b/boards/st/nucleo_h723zg/board.yml index 56a6d5cfb52e9..2efee3e24c4df 100644 --- a/boards/st/nucleo_h723zg/board.yml +++ b/boards/st/nucleo_h723zg/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_h723zg + full_name: Nucleo H723ZG vendor: st socs: - name: stm32h723xx diff --git a/boards/st/nucleo_h743zi/board.yml b/boards/st/nucleo_h743zi/board.yml index e133a6fc034ea..8feba5b5c7a75 100644 --- a/boards/st/nucleo_h743zi/board.yml +++ b/boards/st/nucleo_h743zi/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_h743zi + full_name: Nucleo H743ZI vendor: st socs: - name: stm32h743xx diff --git a/boards/st/nucleo_h745zi_q/board.yml b/boards/st/nucleo_h745zi_q/board.yml index 7ba025f5bb78b..6d9df5de2486b 100644 --- a/boards/st/nucleo_h745zi_q/board.yml +++ b/boards/st/nucleo_h745zi_q/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_h745zi_q + full_name: Nucleo H745ZI-Q vendor: st socs: - name: stm32h745xx diff --git a/boards/st/nucleo_h753zi/board.yml b/boards/st/nucleo_h753zi/board.yml index 12dc4b5a501de..704face7bc9d2 100644 --- a/boards/st/nucleo_h753zi/board.yml +++ b/boards/st/nucleo_h753zi/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_h753zi + full_name: Nucleo H753ZI vendor: st socs: - name: stm32h753xx diff --git a/boards/st/nucleo_h755zi_q/board.yml b/boards/st/nucleo_h755zi_q/board.yml index ecffd3b0fd165..73e4e8e0cf16f 100644 --- a/boards/st/nucleo_h755zi_q/board.yml +++ b/boards/st/nucleo_h755zi_q/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_h755zi_q + full_name: Nucleo H755ZI-Q vendor: st socs: - name: stm32h755xx diff --git a/boards/st/nucleo_h7a3zi_q/board.yml b/boards/st/nucleo_h7a3zi_q/board.yml index 0c64ac8822826..f3e32247481d6 100644 --- a/boards/st/nucleo_h7a3zi_q/board.yml +++ b/boards/st/nucleo_h7a3zi_q/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_h7a3zi_q + full_name: Nucleo H7A3ZI-Q vendor: st socs: - name: stm32h7a3xx diff --git a/boards/st/nucleo_l011k4/board.yml b/boards/st/nucleo_l011k4/board.yml index be64789e75477..4f9e1429176e5 100644 --- a/boards/st/nucleo_l011k4/board.yml +++ b/boards/st/nucleo_l011k4/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_l011k4 + full_name: Nucleo L011K4 vendor: st socs: - name: stm32l011xx diff --git a/boards/st/nucleo_l031k6/board.yml b/boards/st/nucleo_l031k6/board.yml index 7fc334c0c2da6..43bbdbd2c227f 100644 --- a/boards/st/nucleo_l031k6/board.yml +++ b/boards/st/nucleo_l031k6/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_l031k6 + full_name: Nucleo L031K6 vendor: st socs: - name: stm32l031xx diff --git a/boards/st/nucleo_l053r8/board.yml b/boards/st/nucleo_l053r8/board.yml index a31629d64436d..0952d7d4b8ef6 100644 --- a/boards/st/nucleo_l053r8/board.yml +++ b/boards/st/nucleo_l053r8/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_l053r8 + full_name: Nucleo L053R8 vendor: st socs: - name: stm32l053xx diff --git a/boards/st/nucleo_l073rz/board.yml b/boards/st/nucleo_l073rz/board.yml index 232170aa06d5d..01d4430d25201 100644 --- a/boards/st/nucleo_l073rz/board.yml +++ b/boards/st/nucleo_l073rz/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_l073rz + full_name: Nucleo L073RZ vendor: st socs: - name: stm32l073xx diff --git a/boards/st/nucleo_l152re/board.yml b/boards/st/nucleo_l152re/board.yml index 2838a81f7b0bd..80adf11ee4deb 100644 --- a/boards/st/nucleo_l152re/board.yml +++ b/boards/st/nucleo_l152re/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_l152re + full_name: Nucleo L152RE vendor: st socs: - name: stm32l152xe diff --git a/boards/st/nucleo_l412rb_p/board.yml b/boards/st/nucleo_l412rb_p/board.yml index 92ab56d2df399..37a8159f3c5e5 100644 --- a/boards/st/nucleo_l412rb_p/board.yml +++ b/boards/st/nucleo_l412rb_p/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_l412rb_p + full_name: Nucleo L412RB-P vendor: st socs: - name: stm32l412xx diff --git a/boards/st/nucleo_l432kc/board.yml b/boards/st/nucleo_l432kc/board.yml index 25ccfc0ddf9c4..badd59ab6a53d 100644 --- a/boards/st/nucleo_l432kc/board.yml +++ b/boards/st/nucleo_l432kc/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_l432kc + full_name: Nucleo L432KC vendor: st socs: - name: stm32l432xx diff --git a/boards/st/nucleo_l433rc_p/board.yml b/boards/st/nucleo_l433rc_p/board.yml index 03c1f3c6f6fb6..3f5b40b949dba 100644 --- a/boards/st/nucleo_l433rc_p/board.yml +++ b/boards/st/nucleo_l433rc_p/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_l433rc_p + full_name: Nucleo L433RC vendor: st socs: - name: stm32l433xx diff --git a/boards/st/nucleo_l452re/board.yml b/boards/st/nucleo_l452re/board.yml index 9bbf96304971e..32318946ec8fe 100644 --- a/boards/st/nucleo_l452re/board.yml +++ b/boards/st/nucleo_l452re/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_l452re + full_name: Nucleo L452RE vendor: st socs: - name: stm32l452xx diff --git a/boards/st/nucleo_l476rg/board.yml b/boards/st/nucleo_l476rg/board.yml index c6b21713e34ec..c250fa89a58e6 100644 --- a/boards/st/nucleo_l476rg/board.yml +++ b/boards/st/nucleo_l476rg/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_l476rg + full_name: Nucleo L476RG vendor: st socs: - name: stm32l476xx diff --git a/boards/st/nucleo_l496zg/board.yml b/boards/st/nucleo_l496zg/board.yml index 3d1c909cffc79..4b0e2a75e3e65 100644 --- a/boards/st/nucleo_l496zg/board.yml +++ b/boards/st/nucleo_l496zg/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_l496zg + full_name: Nucleo L496ZG vendor: st socs: - name: stm32l496xx diff --git a/boards/st/nucleo_l4a6zg/board.yml b/boards/st/nucleo_l4a6zg/board.yml index 6e935c5d0826a..5cf94c4be2ee4 100644 --- a/boards/st/nucleo_l4a6zg/board.yml +++ b/boards/st/nucleo_l4a6zg/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_l4a6zg + full_name: Nucleo L4A6ZG vendor: st socs: - name: stm32l4a6xx diff --git a/boards/st/nucleo_l4r5zi/board.yml b/boards/st/nucleo_l4r5zi/board.yml index 46ead4d88316c..86befedebd252 100644 --- a/boards/st/nucleo_l4r5zi/board.yml +++ b/boards/st/nucleo_l4r5zi/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_l4r5zi + full_name: Nucleo L4R5ZI vendor: st socs: - name: stm32l4r5xx diff --git a/boards/st/nucleo_l552ze_q/board.yml b/boards/st/nucleo_l552ze_q/board.yml index 713b695aeba0b..58e78575e1276 100644 --- a/boards/st/nucleo_l552ze_q/board.yml +++ b/boards/st/nucleo_l552ze_q/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_l552ze_q + full_name: Nucleo L552ZE Q vendor: st socs: - name: stm32l552xx diff --git a/boards/st/nucleo_u031r8/board.yml b/boards/st/nucleo_u031r8/board.yml index afbb6b5b6b6bb..1a3d7fdf20be4 100644 --- a/boards/st/nucleo_u031r8/board.yml +++ b/boards/st/nucleo_u031r8/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_u031r8 + full_name: Nucleo U031R8 vendor: st socs: - name: stm32u031xx diff --git a/boards/st/nucleo_u083rc/board.yml b/boards/st/nucleo_u083rc/board.yml index 65d9734b2885d..c26a846edc607 100644 --- a/boards/st/nucleo_u083rc/board.yml +++ b/boards/st/nucleo_u083rc/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_u083rc + full_name: Nucleo U083RC vendor: st socs: - name: stm32u083xx diff --git a/boards/st/nucleo_u575zi_q/board.yml b/boards/st/nucleo_u575zi_q/board.yml index ced9ac720b324..66fc909baef53 100644 --- a/boards/st/nucleo_u575zi_q/board.yml +++ b/boards/st/nucleo_u575zi_q/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_u575zi_q + full_name: Nucleo U575ZI Q vendor: st socs: - name: stm32u575xx diff --git a/boards/st/nucleo_u5a5zj_q/board.yml b/boards/st/nucleo_u5a5zj_q/board.yml index 9e594c30fb137..d5376588b215f 100644 --- a/boards/st/nucleo_u5a5zj_q/board.yml +++ b/boards/st/nucleo_u5a5zj_q/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_u5a5zj_q + full_name: Nucleo U5A5ZJ Q vendor: st socs: - name: stm32u5a5xx diff --git a/boards/st/nucleo_wb05kz/board.yml b/boards/st/nucleo_wb05kz/board.yml index 645506c7953a8..7b519b730092f 100644 --- a/boards/st/nucleo_wb05kz/board.yml +++ b/boards/st/nucleo_wb05kz/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_wb05kz + full_name: Nucleo WB05KZ vendor: st socs: - name: stm32wb05 diff --git a/boards/st/nucleo_wb09ke/board.yml b/boards/st/nucleo_wb09ke/board.yml index 2bff9e912b57b..faba2d61bd487 100644 --- a/boards/st/nucleo_wb09ke/board.yml +++ b/boards/st/nucleo_wb09ke/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_wb09ke + full_name: Nucleo WB09KE vendor: st socs: - name: stm32wb09 diff --git a/boards/st/nucleo_wb55rg/board.yml b/boards/st/nucleo_wb55rg/board.yml index 49366ba9e62bb..8b161072dee78 100644 --- a/boards/st/nucleo_wb55rg/board.yml +++ b/boards/st/nucleo_wb55rg/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_wb55rg + full_name: Nucleo WB55RG vendor: st socs: - name: stm32wb55xx diff --git a/boards/st/nucleo_wba52cg/board.yml b/boards/st/nucleo_wba52cg/board.yml index 70950acf34db8..0b12139fcf2a5 100644 --- a/boards/st/nucleo_wba52cg/board.yml +++ b/boards/st/nucleo_wba52cg/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_wba52cg + full_name: Nucleo WBA52CG vendor: st socs: - name: stm32wba52xx diff --git a/boards/st/nucleo_wba55cg/board.yml b/boards/st/nucleo_wba55cg/board.yml index 2fbe6b2bca49d..0963755cc5038 100644 --- a/boards/st/nucleo_wba55cg/board.yml +++ b/boards/st/nucleo_wba55cg/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_wba55cg + full_name: Nucleo WBA55CG vendor: st socs: - name: stm32wba55xx diff --git a/boards/st/nucleo_wl55jc/board.yml b/boards/st/nucleo_wl55jc/board.yml index 930da79b19925..9313b6a7ef774 100644 --- a/boards/st/nucleo_wl55jc/board.yml +++ b/boards/st/nucleo_wl55jc/board.yml @@ -1,5 +1,6 @@ board: name: nucleo_wl55jc + full_name: Nucleo WL55JC vendor: st socs: - name: stm32wl55xx diff --git a/boards/st/sensortile_box/board.yml b/boards/st/sensortile_box/board.yml index 4ac086b2cb7c9..f314a51c35624 100644 --- a/boards/st/sensortile_box/board.yml +++ b/boards/st/sensortile_box/board.yml @@ -1,5 +1,6 @@ board: name: sensortile_box + full_name: SensorTile.box vendor: st socs: - name: stm32l4r9xx diff --git a/boards/st/sensortile_box_pro/board.yml b/boards/st/sensortile_box_pro/board.yml index d3bb8ca9ee93d..bfa681499cc5a 100644 --- a/boards/st/sensortile_box_pro/board.yml +++ b/boards/st/sensortile_box_pro/board.yml @@ -1,5 +1,6 @@ board: name: sensortile_box_pro + full_name: SensorTile.box PRO vendor: st socs: - name: stm32u585xx diff --git a/boards/st/st25dv_mb1283_disco/board.yml b/boards/st/st25dv_mb1283_disco/board.yml index 8fc19fff61ebe..054880ab5d91a 100644 --- a/boards/st/st25dv_mb1283_disco/board.yml +++ b/boards/st/st25dv_mb1283_disco/board.yml @@ -1,5 +1,6 @@ board: name: st25dv_mb1283_disco + full_name: ST25DV Discovery, MB1283 version vendor: st socs: - name: stm32f405xx diff --git a/boards/st/steval_fcu001v1/board.yml b/boards/st/steval_fcu001v1/board.yml index 16357770fa4a1..23fb900e8c75f 100644 --- a/boards/st/steval_fcu001v1/board.yml +++ b/boards/st/steval_fcu001v1/board.yml @@ -1,5 +1,6 @@ board: name: steval_fcu001v1 + full_name: STM32 Flight Controller Unit vendor: st socs: - name: stm32f401xc diff --git a/boards/st/steval_stwinbx1/board.yml b/boards/st/steval_stwinbx1/board.yml index 6431922325371..e72eee7c5d287 100644 --- a/boards/st/steval_stwinbx1/board.yml +++ b/boards/st/steval_stwinbx1/board.yml @@ -1,5 +1,6 @@ board: name: steval_stwinbx1 + full_name: STEVAL STWINBX1 Development kit vendor: st socs: - name: stm32u585xx diff --git a/boards/st/stm3210c_eval/board.yml b/boards/st/stm3210c_eval/board.yml index bb8003f01ab96..d204be60d358d 100644 --- a/boards/st/stm3210c_eval/board.yml +++ b/boards/st/stm3210c_eval/board.yml @@ -1,5 +1,6 @@ board: name: stm3210c_eval + full_name: STM3210C Evaluation vendor: st socs: - name: stm32f107xc diff --git a/boards/st/stm32373c_eval/board.yml b/boards/st/stm32373c_eval/board.yml index 32da748e9a75a..6817d43bdb87c 100644 --- a/boards/st/stm32373c_eval/board.yml +++ b/boards/st/stm32373c_eval/board.yml @@ -1,5 +1,6 @@ board: name: stm32373c_eval + full_name: STM32373C Evaluation vendor: st socs: - name: stm32f373xc diff --git a/boards/st/stm32c0116_dk/board.yml b/boards/st/stm32c0116_dk/board.yml index 1764907618b79..db0eb8377aeff 100644 --- a/boards/st/stm32c0116_dk/board.yml +++ b/boards/st/stm32c0116_dk/board.yml @@ -1,5 +1,6 @@ board: name: stm32c0116_dk + full_name: STM32C0116-DK Discovery Kit vendor: st socs: - name: stm32c011xx diff --git a/boards/st/stm32f072_eval/board.yml b/boards/st/stm32f072_eval/board.yml index 43e4ec82854d7..70ea37e05670b 100644 --- a/boards/st/stm32f072_eval/board.yml +++ b/boards/st/stm32f072_eval/board.yml @@ -1,5 +1,6 @@ board: name: stm32f072_eval + full_name: STM32F072 Evaluation vendor: st socs: - name: stm32f072xb diff --git a/boards/st/stm32f072b_disco/board.yml b/boards/st/stm32f072b_disco/board.yml index ca3e636655f50..9152aa3b6a2c9 100644 --- a/boards/st/stm32f072b_disco/board.yml +++ b/boards/st/stm32f072b_disco/board.yml @@ -1,5 +1,6 @@ board: name: stm32f072b_disco + full_name: STM32F072B Discovery vendor: st socs: - name: stm32f072xb diff --git a/boards/st/stm32f0_disco/board.yml b/boards/st/stm32f0_disco/board.yml index a195ae98ae7d6..df8b2b52b9081 100644 --- a/boards/st/stm32f0_disco/board.yml +++ b/boards/st/stm32f0_disco/board.yml @@ -1,5 +1,6 @@ board: name: stm32f0_disco + full_name: STM32F0 Discovery vendor: st socs: - name: stm32f051x8 diff --git a/boards/st/stm32f3_disco/board.yml b/boards/st/stm32f3_disco/board.yml index ae48f138fa5d8..7c2626178f513 100644 --- a/boards/st/stm32f3_disco/board.yml +++ b/boards/st/stm32f3_disco/board.yml @@ -1,5 +1,6 @@ board: name: stm32f3_disco + full_name: STM32F3 Discovery vendor: st revision: format: letter diff --git a/boards/st/stm32f411e_disco/board.yml b/boards/st/stm32f411e_disco/board.yml index f42b1ada4a44e..fa455d610e875 100644 --- a/boards/st/stm32f411e_disco/board.yml +++ b/boards/st/stm32f411e_disco/board.yml @@ -1,5 +1,6 @@ board: name: stm32f411e_disco + full_name: STM32F411E Discovery vendor: st revision: format: letter diff --git a/boards/st/stm32f412g_disco/board.yml b/boards/st/stm32f412g_disco/board.yml index 836972823ada1..ab33ccba899e8 100644 --- a/boards/st/stm32f412g_disco/board.yml +++ b/boards/st/stm32f412g_disco/board.yml @@ -1,5 +1,6 @@ board: name: stm32f412g_disco + full_name: STM32F412G Discovery vendor: st socs: - name: stm32f412zx diff --git a/boards/st/stm32f429i_disc1/board.yml b/boards/st/stm32f429i_disc1/board.yml index e8e332283072b..5843685a47622 100644 --- a/boards/st/stm32f429i_disc1/board.yml +++ b/boards/st/stm32f429i_disc1/board.yml @@ -1,5 +1,6 @@ board: name: stm32f429i_disc1 + full_name: STM32F429I Discovery vendor: st socs: - name: stm32f429xx diff --git a/boards/st/stm32f469i_disco/board.yml b/boards/st/stm32f469i_disco/board.yml index 2f7407bbc381d..cd76731d91fa0 100644 --- a/boards/st/stm32f469i_disco/board.yml +++ b/boards/st/stm32f469i_disco/board.yml @@ -1,5 +1,6 @@ board: name: stm32f469i_disco + full_name: STM32F469I Discovery vendor: st socs: - name: stm32f469xx diff --git a/boards/st/stm32f4_disco/board.yml b/boards/st/stm32f4_disco/board.yml index 663f8613eec3b..55f96320600d8 100644 --- a/boards/st/stm32f4_disco/board.yml +++ b/boards/st/stm32f4_disco/board.yml @@ -1,5 +1,6 @@ board: name: stm32f4_disco + full_name: STM32F4 Discovery vendor: st socs: - name: stm32f407xx diff --git a/boards/st/stm32f723e_disco/board.yml b/boards/st/stm32f723e_disco/board.yml index 652487052342f..b90191d201fb6 100644 --- a/boards/st/stm32f723e_disco/board.yml +++ b/boards/st/stm32f723e_disco/board.yml @@ -1,5 +1,6 @@ board: name: stm32f723e_disco + full_name: STM32F723E Discovery vendor: st socs: - name: stm32f723xx diff --git a/boards/st/stm32f746g_disco/board.yml b/boards/st/stm32f746g_disco/board.yml index 3522ea40ac3af..2417218da2f99 100644 --- a/boards/st/stm32f746g_disco/board.yml +++ b/boards/st/stm32f746g_disco/board.yml @@ -1,5 +1,6 @@ board: name: stm32f746g_disco + full_name: STM32F746G Discovery vendor: st socs: - name: stm32f746xx diff --git a/boards/st/stm32f7508_dk/board.yml b/boards/st/stm32f7508_dk/board.yml index 46e12e5a6f0f8..ec81a75c0f029 100644 --- a/boards/st/stm32f7508_dk/board.yml +++ b/boards/st/stm32f7508_dk/board.yml @@ -1,5 +1,6 @@ board: name: stm32f7508_dk + full_name: STM32F7508-DK Discovery Kit vendor: st socs: - name: stm32f750xx diff --git a/boards/st/stm32f769i_disco/board.yml b/boards/st/stm32f769i_disco/board.yml index de83c60be993b..552b7dd5ee382 100644 --- a/boards/st/stm32f769i_disco/board.yml +++ b/boards/st/stm32f769i_disco/board.yml @@ -1,5 +1,6 @@ board: name: stm32f769i_disco + full_name: STM32F769I Discovery vendor: st socs: - name: stm32f769xx diff --git a/boards/st/stm32g0316_disco/board.yml b/boards/st/stm32g0316_disco/board.yml index 5a67daf81d6bb..a032c898a75f0 100644 --- a/boards/st/stm32g0316_disco/board.yml +++ b/boards/st/stm32g0316_disco/board.yml @@ -1,5 +1,6 @@ board: name: stm32g0316_disco + full_name: STM32G0316 Discovery vendor: st socs: - name: stm32g031xx diff --git a/boards/st/stm32g071b_disco/board.yml b/boards/st/stm32g071b_disco/board.yml index 5445391255f9c..78b83fac4516c 100644 --- a/boards/st/stm32g071b_disco/board.yml +++ b/boards/st/stm32g071b_disco/board.yml @@ -1,5 +1,6 @@ board: name: stm32g071b_disco + full_name: STM32G071B Discovery vendor: st socs: - name: stm32g071xx diff --git a/boards/st/stm32g081b_eval/board.yml b/boards/st/stm32g081b_eval/board.yml index 5cdb22ef9b875..2a6fa75aadd1c 100644 --- a/boards/st/stm32g081b_eval/board.yml +++ b/boards/st/stm32g081b_eval/board.yml @@ -1,5 +1,6 @@ board: name: stm32g081b_eval + full_name: STM32G081B Evaluation vendor: st socs: - name: stm32g081xx diff --git a/boards/st/stm32h573i_dk/board.yml b/boards/st/stm32h573i_dk/board.yml index e6a08a9197f31..55f3820099981 100644 --- a/boards/st/stm32h573i_dk/board.yml +++ b/boards/st/stm32h573i_dk/board.yml @@ -1,5 +1,6 @@ board: name: stm32h573i_dk + full_name: STM32H573I-DK Discovery vendor: st socs: - name: stm32h573xx diff --git a/boards/st/stm32h735g_disco/board.yml b/boards/st/stm32h735g_disco/board.yml index 146a622647e0a..acf25fbe1a237 100644 --- a/boards/st/stm32h735g_disco/board.yml +++ b/boards/st/stm32h735g_disco/board.yml @@ -1,5 +1,6 @@ board: name: stm32h735g_disco + full_name: STM32H735G Discovery vendor: st socs: - name: stm32h735xx diff --git a/boards/st/stm32h745i_disco/board.yml b/boards/st/stm32h745i_disco/board.yml index e1da9c4b2f44e..cbd323cb9cebc 100644 --- a/boards/st/stm32h745i_disco/board.yml +++ b/boards/st/stm32h745i_disco/board.yml @@ -1,5 +1,6 @@ board: name: stm32h745i_disco + full_name: STM32H745I Discovery vendor: st socs: - name: stm32h745xx diff --git a/boards/st/stm32h747i_disco/board.yml b/boards/st/stm32h747i_disco/board.yml index 431d3e4f48620..67649b5dab6d9 100644 --- a/boards/st/stm32h747i_disco/board.yml +++ b/boards/st/stm32h747i_disco/board.yml @@ -1,5 +1,6 @@ board: name: stm32h747i_disco + full_name: STM32H747I Discovery vendor: st socs: - name: stm32h747xx diff --git a/boards/st/stm32h750b_dk/board.yml b/boards/st/stm32h750b_dk/board.yml index 95275ee2e426e..9c95b1c77d146 100644 --- a/boards/st/stm32h750b_dk/board.yml +++ b/boards/st/stm32h750b_dk/board.yml @@ -1,5 +1,6 @@ board: name: stm32h750b_dk + full_name: STM32H750B Discovery Kit vendor: st socs: - name: stm32h750xx diff --git a/boards/st/stm32h7b3i_dk/board.yml b/boards/st/stm32h7b3i_dk/board.yml index 5516412eac934..6a9e0626b7c42 100644 --- a/boards/st/stm32h7b3i_dk/board.yml +++ b/boards/st/stm32h7b3i_dk/board.yml @@ -1,5 +1,6 @@ board: name: stm32h7b3i_dk + full_name: STM32H7B3I Discovery kit vendor: st socs: - name: stm32h7b3xx diff --git a/boards/st/stm32h7s78_dk/board.yml b/boards/st/stm32h7s78_dk/board.yml index c17be71480c2d..fdc7709132361 100644 --- a/boards/st/stm32h7s78_dk/board.yml +++ b/boards/st/stm32h7s78_dk/board.yml @@ -1,5 +1,6 @@ board: name: stm32h7s78_dk + full_name: STM32H7S78-DK Discovery vendor: st socs: - name: stm32h7s7xx diff --git a/boards/st/stm32l1_disco/board.yml b/boards/st/stm32l1_disco/board.yml index 97a69b8815746..1f606b80070a4 100644 --- a/boards/st/stm32l1_disco/board.yml +++ b/boards/st/stm32l1_disco/board.yml @@ -1,9 +1,11 @@ boards: - name: stm32l1_disco + full_name: STM32L1 Discovery vendor: st socs: - name: stm32l151xb - name: stm32l152c_disco + full_name: STM32L152C Discovery vendor: st socs: - name: stm32l152xc diff --git a/boards/st/stm32l476g_disco/board.yml b/boards/st/stm32l476g_disco/board.yml index c82c2c618430e..7899adc9ea04e 100644 --- a/boards/st/stm32l476g_disco/board.yml +++ b/boards/st/stm32l476g_disco/board.yml @@ -1,5 +1,6 @@ board: name: stm32l476g_disco + full_name: STM32L476G Discovery vendor: st socs: - name: stm32l476xx diff --git a/boards/st/stm32l496g_disco/board.yml b/boards/st/stm32l496g_disco/board.yml index 9d6b18a598d7b..e5b9ec923c4dd 100644 --- a/boards/st/stm32l496g_disco/board.yml +++ b/boards/st/stm32l496g_disco/board.yml @@ -1,5 +1,6 @@ board: name: stm32l496g_disco + full_name: STM32L496G Discovery vendor: st socs: - name: stm32l496xx diff --git a/boards/st/stm32l4r9i_disco/board.yml b/boards/st/stm32l4r9i_disco/board.yml index 267fd87932da7..eedbfcd51e20d 100644 --- a/boards/st/stm32l4r9i_disco/board.yml +++ b/boards/st/stm32l4r9i_disco/board.yml @@ -1,5 +1,6 @@ board: name: stm32l4r9i_disco + full_name: STM32L4R9I Discovery vendor: st socs: - name: stm32l4r9xx diff --git a/boards/st/stm32l562e_dk/board.yml b/boards/st/stm32l562e_dk/board.yml index 225f25adc2e8c..93e80fb9f5dae 100644 --- a/boards/st/stm32l562e_dk/board.yml +++ b/boards/st/stm32l562e_dk/board.yml @@ -1,5 +1,6 @@ board: name: stm32l562e_dk + full_name: STM32L562E-DK Discovery vendor: st socs: - name: stm32l562xx diff --git a/boards/st/stm32mp157c_dk2/board.yml b/boards/st/stm32mp157c_dk2/board.yml index d8ffb9a66b562..6226ea364e160 100644 --- a/boards/st/stm32mp157c_dk2/board.yml +++ b/boards/st/stm32mp157c_dk2/board.yml @@ -1,5 +1,6 @@ board: name: stm32mp157c_dk2 + full_name: STM32MP157C-DK2 Discovery vendor: st socs: - name: stm32mp157cxx diff --git a/boards/st/stm32u083c_dk/board.yml b/boards/st/stm32u083c_dk/board.yml index 7bcf691ac6915..18deefdfecca5 100644 --- a/boards/st/stm32u083c_dk/board.yml +++ b/boards/st/stm32u083c_dk/board.yml @@ -1,5 +1,6 @@ board: name: stm32u083c_dk + full_name: STM32U083C-DK vendor: st socs: - name: stm32u083xx diff --git a/boards/st/stm32u5a9j_dk/board.yml b/boards/st/stm32u5a9j_dk/board.yml index 93bcec39743df..665d0bbc41950 100644 --- a/boards/st/stm32u5a9j_dk/board.yml +++ b/boards/st/stm32u5a9j_dk/board.yml @@ -1,5 +1,6 @@ board: name: stm32u5a9j_dk + full_name: STM32U5A9J Discovery Kit vendor: st socs: - name: stm32u5a9xx diff --git a/boards/st/stm32vl_disco/board.yml b/boards/st/stm32vl_disco/board.yml index 15c8b5b3caca7..011d7f7e71a68 100644 --- a/boards/st/stm32vl_disco/board.yml +++ b/boards/st/stm32vl_disco/board.yml @@ -1,5 +1,6 @@ board: name: stm32vl_disco + full_name: STM32VL Discovery vendor: st socs: - name: stm32f100xb diff --git a/boards/st/stm32wb5mm_dk/board.yml b/boards/st/stm32wb5mm_dk/board.yml index 5df998d28c115..019c11d790535 100644 --- a/boards/st/stm32wb5mm_dk/board.yml +++ b/boards/st/stm32wb5mm_dk/board.yml @@ -1,5 +1,6 @@ board: name: stm32wb5mm_dk + full_name: STM32WB5MM-DK vendor: st socs: - name: stm32wb55xx diff --git a/boards/st/stm32wb5mmg/board.yml b/boards/st/stm32wb5mmg/board.yml index dc90a918930fe..29ce1a3426bfe 100644 --- a/boards/st/stm32wb5mmg/board.yml +++ b/boards/st/stm32wb5mmg/board.yml @@ -1,5 +1,6 @@ board: name: stm32wb5mmg + full_name: STM32WB5MMG vendor: st socs: - name: stm32wb55xx diff --git a/boards/starfive/visionfive2/board.yml b/boards/starfive/visionfive2/board.yml index cc856efaa92bf..9d106a29a488e 100644 --- a/boards/starfive/visionfive2/board.yml +++ b/boards/starfive/visionfive2/board.yml @@ -3,6 +3,7 @@ board: name: visionfive2 + full_name: VisionFive 2 JH7110 vendor: starfive socs: - name: jh7110 diff --git a/boards/tdk/robokit1/board.yml b/boards/tdk/robokit1/board.yml index c97c2a0c94021..2aafcdd702e3b 100644 --- a/boards/tdk/robokit1/board.yml +++ b/boards/tdk/robokit1/board.yml @@ -1,5 +1,6 @@ board: name: robokit1 + full_name: RoboKit 1 vendor: tdk socs: - name: same70q21b diff --git a/boards/technexion/pico_pi/board.yml b/boards/technexion/pico_pi/board.yml index 61c6713a925b6..297ee427131a1 100644 --- a/boards/technexion/pico_pi/board.yml +++ b/boards/technexion/pico_pi/board.yml @@ -1,5 +1,6 @@ board: name: pico_pi + full_name: Pico-Pi i.MX7D - Android Things IoT Development Platform vendor: technexion socs: - name: mcimx7d diff --git a/boards/telink/tlsr9518adk80d/board.yml b/boards/telink/tlsr9518adk80d/board.yml index b4d45ba665dce..454b29592ebfc 100644 --- a/boards/telink/tlsr9518adk80d/board.yml +++ b/boards/telink/tlsr9518adk80d/board.yml @@ -1,5 +1,6 @@ board: name: tlsr9518adk80d + full_name: TLSR9518ADK80D vendor: telink socs: - name: tlsr9518 diff --git a/boards/ti/cc1352p1_launchxl/board.yml b/boards/ti/cc1352p1_launchxl/board.yml index 5d9b234947db6..8ac020cd134c4 100644 --- a/boards/ti/cc1352p1_launchxl/board.yml +++ b/boards/ti/cc1352p1_launchxl/board.yml @@ -1,5 +1,6 @@ board: name: cc1352p1_launchxl + full_name: CC1352P1 LaunchXL vendor: ti socs: - name: cc1352p diff --git a/boards/ti/cc1352p7_launchpad/board.yml b/boards/ti/cc1352p7_launchpad/board.yml index 0e97ad4ff4358..cf29dd69e6afd 100644 --- a/boards/ti/cc1352p7_launchpad/board.yml +++ b/boards/ti/cc1352p7_launchpad/board.yml @@ -1,5 +1,6 @@ board: name: cc1352p7_lp + full_name: CC1352P7 LaunchPad vendor: ti socs: - name: cc1352p7 diff --git a/boards/ti/cc1352r1_launchxl/board.yml b/boards/ti/cc1352r1_launchxl/board.yml index a96d6d89a10cc..b7b52e31053c6 100644 --- a/boards/ti/cc1352r1_launchxl/board.yml +++ b/boards/ti/cc1352r1_launchxl/board.yml @@ -1,5 +1,6 @@ board: name: cc1352r1_launchxl + full_name: CC1352R1 LaunchXL vendor: ti socs: - name: cc1352r diff --git a/boards/ti/cc1352r_sensortag/board.yml b/boards/ti/cc1352r_sensortag/board.yml index b359f530fa233..055e40a74e10d 100644 --- a/boards/ti/cc1352r_sensortag/board.yml +++ b/boards/ti/cc1352r_sensortag/board.yml @@ -1,5 +1,6 @@ board: name: cc1352r_sensortag + full_name: CC1352R SensorTag vendor: ti socs: - name: cc1352r diff --git a/boards/ti/cc26x2r1_launchxl/board.yml b/boards/ti/cc26x2r1_launchxl/board.yml index 3361b2ccff715..3c9e65ea3dd57 100644 --- a/boards/ti/cc26x2r1_launchxl/board.yml +++ b/boards/ti/cc26x2r1_launchxl/board.yml @@ -1,5 +1,6 @@ board: name: cc26x2r1_launchxl + full_name: CC26x2R1 LaunchXL vendor: ti socs: - name: cc2652r diff --git a/boards/ti/cc3220sf_launchxl/board.yml b/boards/ti/cc3220sf_launchxl/board.yml index f902db4d3928d..498fbe37fb7b9 100644 --- a/boards/ti/cc3220sf_launchxl/board.yml +++ b/boards/ti/cc3220sf_launchxl/board.yml @@ -1,5 +1,6 @@ board: name: cc3220sf_launchxl + full_name: CC3220SF LaunchXL vendor: ti socs: - name: cc3220sf diff --git a/boards/ti/cc3235sf_launchxl/board.yml b/boards/ti/cc3235sf_launchxl/board.yml index 6cf8104545a46..89dee3ce67365 100644 --- a/boards/ti/cc3235sf_launchxl/board.yml +++ b/boards/ti/cc3235sf_launchxl/board.yml @@ -1,5 +1,6 @@ board: name: cc3235sf_launchxl + full_name: CC3235SF LaunchXL vendor: ti socs: - name: cc3235sf diff --git a/boards/ti/msp_exp432p401r_launchxl/board.yml b/boards/ti/msp_exp432p401r_launchxl/board.yml index 1e9ed0b7ed3e2..c8f10746b465f 100644 --- a/boards/ti/msp_exp432p401r_launchxl/board.yml +++ b/boards/ti/msp_exp432p401r_launchxl/board.yml @@ -1,5 +1,6 @@ board: name: msp_exp432p401r_launchxl + full_name: MSP-EXP432P401R LaunchXL vendor: ti socs: - name: msp432p401r diff --git a/boards/ti/sk_am62/board.yml b/boards/ti/sk_am62/board.yml index da6e946fe02c5..f0083b004343e 100644 --- a/boards/ti/sk_am62/board.yml +++ b/boards/ti/sk_am62/board.yml @@ -1,5 +1,6 @@ board: name: sk_am62 + full_name: SK-AM62 M4F Core vendor: ti socs: - name: am6234 diff --git a/boards/toradex/colibri_imx7d/board.yml b/boards/toradex/colibri_imx7d/board.yml index 7a6ffe6249510..32a4e1db7ebf4 100644 --- a/boards/toradex/colibri_imx7d/board.yml +++ b/boards/toradex/colibri_imx7d/board.yml @@ -1,5 +1,6 @@ board: name: colibri_imx7d + full_name: i.MX 7 Computer on Module - Colibri iMX7 vendor: toradex socs: - name: mcimx7d diff --git a/boards/toradex/verdin_imx8mp/board.yml b/boards/toradex/verdin_imx8mp/board.yml index 6ffbf4561a280..bc2f8ff6ba644 100644 --- a/boards/toradex/verdin_imx8mp/board.yml +++ b/boards/toradex/verdin_imx8mp/board.yml @@ -1,5 +1,6 @@ board: name: verdin_imx8mp + full_name: Verdin iMX8M Plus SoM vendor: toradex socs: - name: mimx8ml8 diff --git a/boards/u-blox/ubx_bmd300eval/board.yml b/boards/u-blox/ubx_bmd300eval/board.yml index 522c0808eed9a..759e23456650e 100644 --- a/boards/u-blox/ubx_bmd300eval/board.yml +++ b/boards/u-blox/ubx_bmd300eval/board.yml @@ -1,5 +1,6 @@ board: name: ubx_bmd300eval + full_name: "EVK-BMD-30/35: BMD-300-EVAL, BMD-301-EVAL, and BMD-350-EVAL" vendor: u-blox socs: - name: nrf52832 diff --git a/boards/u-blox/ubx_bmd330eval/board.yml b/boards/u-blox/ubx_bmd330eval/board.yml index d50ce8816f77e..6c842ef563f9f 100644 --- a/boards/u-blox/ubx_bmd330eval/board.yml +++ b/boards/u-blox/ubx_bmd330eval/board.yml @@ -1,5 +1,6 @@ board: name: ubx_bmd330eval + full_name: "EVK-BMD-330: BMD-330-EVAL" vendor: u-blox socs: - name: nrf52810 diff --git a/boards/u-blox/ubx_bmd340eval/board.yml b/boards/u-blox/ubx_bmd340eval/board.yml index 2440541fc45be..2e57087548a45 100644 --- a/boards/u-blox/ubx_bmd340eval/board.yml +++ b/boards/u-blox/ubx_bmd340eval/board.yml @@ -1,5 +1,6 @@ board: name: ubx_bmd340eval + full_name: "EVK-BMD-34/38: BMD-340-EVAL and BMD-341-EVAL" vendor: u-blox socs: - name: nrf52840 diff --git a/boards/u-blox/ubx_bmd345eval/board.yml b/boards/u-blox/ubx_bmd345eval/board.yml index eec2be0b7d971..2f84225aea8e0 100644 --- a/boards/u-blox/ubx_bmd345eval/board.yml +++ b/boards/u-blox/ubx_bmd345eval/board.yml @@ -1,5 +1,6 @@ board: name: ubx_bmd345eval + full_name: "EVK-BMD-34/38: BMD-345-EVAL" vendor: u-blox socs: - name: nrf52840 diff --git a/boards/u-blox/ubx_bmd360eval/board.yml b/boards/u-blox/ubx_bmd360eval/board.yml index a06d24dd00817..1866bd39f416e 100644 --- a/boards/u-blox/ubx_bmd360eval/board.yml +++ b/boards/u-blox/ubx_bmd360eval/board.yml @@ -1,5 +1,6 @@ board: name: ubx_bmd360eval + full_name: "EVK-BMD-360: BMD-360-EVAL" vendor: u-blox socs: - name: nrf52811 diff --git a/boards/u-blox/ubx_bmd380eval/board.yml b/boards/u-blox/ubx_bmd380eval/board.yml index 0f7ec7263e7b9..b830ad7da0e63 100644 --- a/boards/u-blox/ubx_bmd380eval/board.yml +++ b/boards/u-blox/ubx_bmd380eval/board.yml @@ -1,5 +1,6 @@ board: name: ubx_bmd380eval + full_name: "EVK-BMD-34/48: BMD-380-EVAL" vendor: u-blox socs: - name: nrf52840 diff --git a/boards/u-blox/ubx_evkannab1/board.yml b/boards/u-blox/ubx_evkannab1/board.yml index 3aeac881aba6f..2a7540ed01dea 100644 --- a/boards/u-blox/ubx_evkannab1/board.yml +++ b/boards/u-blox/ubx_evkannab1/board.yml @@ -1,5 +1,6 @@ board: name: ubx_evkannab1 + full_name: EVK-ANNA-B11x vendor: u-blox socs: - name: nrf52832 diff --git a/boards/u-blox/ubx_evkninab1/board.yml b/boards/u-blox/ubx_evkninab1/board.yml index 3073c5833d24a..e6b70d481e69d 100644 --- a/boards/u-blox/ubx_evkninab1/board.yml +++ b/boards/u-blox/ubx_evkninab1/board.yml @@ -1,5 +1,6 @@ board: name: ubx_evkninab1 + full_name: EVK NINA-B11x vendor: u-blox socs: - name: nrf52832 diff --git a/boards/u-blox/ubx_evkninab3/board.yml b/boards/u-blox/ubx_evkninab3/board.yml index 3914fd281495c..7b96e215daf97 100644 --- a/boards/u-blox/ubx_evkninab3/board.yml +++ b/boards/u-blox/ubx_evkninab3/board.yml @@ -1,5 +1,6 @@ board: name: ubx_evkninab3 + full_name: EVK-NINA-B3 vendor: u-blox socs: - name: nrf52840 diff --git a/boards/u-blox/ubx_evkninab4/board.yml b/boards/u-blox/ubx_evkninab4/board.yml index 787ae9c4cdfe5..f8dc4ba07e10d 100644 --- a/boards/u-blox/ubx_evkninab4/board.yml +++ b/boards/u-blox/ubx_evkninab4/board.yml @@ -1,5 +1,6 @@ board: name: ubx_evkninab4 + full_name: EVK NINA-B40x vendor: u-blox socs: - name: nrf52833 diff --git a/boards/udoo/udoo_neo_full/board.yml b/boards/udoo/udoo_neo_full/board.yml index 1c20ebdc15f95..c304b49b367f6 100644 --- a/boards/udoo/udoo_neo_full/board.yml +++ b/boards/udoo/udoo_neo_full/board.yml @@ -1,5 +1,6 @@ board: name: udoo_neo_full + full_name: Neo Full vendor: udoo socs: - name: mcimx6x diff --git a/boards/up-bridge-the-gap/up_squared/board.yml b/boards/up-bridge-the-gap/up_squared/board.yml index 0955b6967af10..1525911058fdb 100644 --- a/boards/up-bridge-the-gap/up_squared/board.yml +++ b/boards/up-bridge-the-gap/up_squared/board.yml @@ -1,4 +1,5 @@ board: name: up_squared + full_name: UP Squared socs: - name: apollo_lake diff --git a/boards/up-bridge-the-gap/up_squared_pro_7000/board.yml b/boards/up-bridge-the-gap/up_squared_pro_7000/board.yml index b929cca9967d1..c3546042deae4 100644 --- a/boards/up-bridge-the-gap/up_squared_pro_7000/board.yml +++ b/boards/up-bridge-the-gap/up_squared_pro_7000/board.yml @@ -1,4 +1,5 @@ board: name: up_squared_pro_7000 + full_name: UP Squared Pro 7000 socs: - name: alder_lake diff --git a/boards/vcc-gnd/yd_esp32/board.yml b/boards/vcc-gnd/yd_esp32/board.yml index a930386ed8448..86c8d22885f7b 100644 --- a/boards/vcc-gnd/yd_esp32/board.yml +++ b/boards/vcc-gnd/yd_esp32/board.yml @@ -1,5 +1,6 @@ board: name: yd_esp32 + full_name: YD-ESP32 vendor: vcc-gnd socs: - name: esp32 diff --git a/boards/vcc-gnd/yd_stm32h750vb/board.yml b/boards/vcc-gnd/yd_stm32h750vb/board.yml index f26fffaa901b9..fd8114075b167 100644 --- a/boards/vcc-gnd/yd_stm32h750vb/board.yml +++ b/boards/vcc-gnd/yd_stm32h750vb/board.yml @@ -1,5 +1,6 @@ board: name: yd_stm32h750vb + full_name: YD-STM32H750VB vendor: vcc-gnd socs: - name: stm32h750xx diff --git a/boards/vngiotlab/nrf51_vbluno51/board.yml b/boards/vngiotlab/nrf51_vbluno51/board.yml index 8e3a9bf948830..05958c1e11ff0 100644 --- a/boards/vngiotlab/nrf51_vbluno51/board.yml +++ b/boards/vngiotlab/nrf51_vbluno51/board.yml @@ -1,5 +1,6 @@ board: name: nrf51_vbluno51 + full_name: nRF51-VBLUno51 vendor: vngiotlab socs: - name: nrf51822 diff --git a/boards/vngiotlab/nrf52_vbluno52/board.yml b/boards/vngiotlab/nrf52_vbluno52/board.yml index be59c421baa57..1f3e21cc1bada 100644 --- a/boards/vngiotlab/nrf52_vbluno52/board.yml +++ b/boards/vngiotlab/nrf52_vbluno52/board.yml @@ -1,5 +1,6 @@ board: name: nrf52_vbluno52 + full_name: nRF52-VBLUno52 vendor: vngiotlab socs: - name: nrf52832 diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/board.yml b/boards/waveshare/esp32s3_touch_lcd_1_28/board.yml index 821fd367821f1..d9a110650fc2a 100644 --- a/boards/waveshare/esp32s3_touch_lcd_1_28/board.yml +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/board.yml @@ -1,5 +1,6 @@ board: name: esp32s3_touch_lcd_1_28 + full_name: ESP32-S3-Touch-LCD-1.28 vendor: waveshare socs: - name: esp32s3 diff --git a/boards/waveshare/nrf51_ble400/board.yml b/boards/waveshare/nrf51_ble400/board.yml index d2c7da1f732ae..ea2be773ad341 100644 --- a/boards/waveshare/nrf51_ble400/board.yml +++ b/boards/waveshare/nrf51_ble400/board.yml @@ -1,5 +1,6 @@ board: name: nrf51_ble400 + full_name: BLE400 vendor: waveshare socs: - name: nrf51822 diff --git a/boards/waveshare/open103z/board.yml b/boards/waveshare/open103z/board.yml index 7504feebf9f34..4e98a29413a5a 100644 --- a/boards/waveshare/open103z/board.yml +++ b/boards/waveshare/open103z/board.yml @@ -1,5 +1,6 @@ board: name: waveshare_open103z + full_name: Open103Z vendor: waveshare socs: - name: stm32f103xe diff --git a/boards/we/ophelia1ev/board.yml b/boards/we/ophelia1ev/board.yml index ac80e1ed6e4de..b69567e089d66 100644 --- a/boards/we/ophelia1ev/board.yml +++ b/boards/we/ophelia1ev/board.yml @@ -1,5 +1,6 @@ board: name: we_ophelia1ev + full_name: Ophelia-I EV NRF52805 vendor: wurth socs: - name: nrf52805 diff --git a/boards/we/proteus2ev/board.yml b/boards/we/proteus2ev/board.yml index 38cc08204e598..d246b6d1b4d44 100644 --- a/boards/we/proteus2ev/board.yml +++ b/boards/we/proteus2ev/board.yml @@ -1,5 +1,6 @@ board: name: we_proteus2ev + full_name: Proteus-II-EV vendor: wurth socs: - name: nrf52832 diff --git a/boards/we/proteus3ev/board.yml b/boards/we/proteus3ev/board.yml index 6def880d7a5b4..fa498a2801487 100644 --- a/boards/we/proteus3ev/board.yml +++ b/boards/we/proteus3ev/board.yml @@ -1,5 +1,6 @@ board: name: we_proteus3ev + full_name: Proteus-III-EV vendor: wurth socs: - name: nrf52840 diff --git a/boards/weact/blackpill_f401cc/board.yml b/boards/weact/blackpill_f401cc/board.yml index e72de492ef869..246a7e1cdfb91 100644 --- a/boards/weact/blackpill_f401cc/board.yml +++ b/boards/weact/blackpill_f401cc/board.yml @@ -1,5 +1,6 @@ board: name: blackpill_f401cc + full_name: Black Pill V1.2 vendor: weact socs: - name: stm32f401xc diff --git a/boards/weact/blackpill_f401ce/board.yml b/boards/weact/blackpill_f401ce/board.yml index 83d26820943cf..84bd3b9835458 100644 --- a/boards/weact/blackpill_f401ce/board.yml +++ b/boards/weact/blackpill_f401ce/board.yml @@ -1,5 +1,6 @@ board: name: blackpill_f401ce + full_name: Black Pill V3.0 vendor: weact socs: - name: stm32f401xe diff --git a/boards/weact/blackpill_f411ce/board.yml b/boards/weact/blackpill_f411ce/board.yml index b145c5e7f019e..deee6cbdd0695 100644 --- a/boards/weact/blackpill_f411ce/board.yml +++ b/boards/weact/blackpill_f411ce/board.yml @@ -1,5 +1,6 @@ board: name: blackpill_f411ce + full_name: Black Pill V2.0 vendor: weact socs: - name: stm32f411xe diff --git a/boards/weact/mini_stm32h743/board.yml b/boards/weact/mini_stm32h743/board.yml index 0789b364dfa98..76ddce890ed74 100644 --- a/boards/weact/mini_stm32h743/board.yml +++ b/boards/weact/mini_stm32h743/board.yml @@ -1,5 +1,6 @@ board: name: mini_stm32h743 + full_name: MiniSTM32H743 Core Board vendor: weact socs: - name: stm32h743xx diff --git a/boards/weact/stm32f405_core/board.yml b/boards/weact/stm32f405_core/board.yml index 8f85783cde9ae..1c97b9e6d2f1c 100644 --- a/boards/weact/stm32f405_core/board.yml +++ b/boards/weact/stm32f405_core/board.yml @@ -1,5 +1,6 @@ board: name: weact_stm32f405_core + full_name: STM32F405 Core Board V1.0 vendor: weact socs: - name: stm32f405xx diff --git a/boards/weact/stm32g431_core/board.yml b/boards/weact/stm32g431_core/board.yml index 359e74ed0d757..ba6032cf52d19 100644 --- a/boards/weact/stm32g431_core/board.yml +++ b/boards/weact/stm32g431_core/board.yml @@ -1,5 +1,6 @@ board: name: weact_stm32g431_core + full_name: STM32G431 Core Board vendor: weact socs: - name: stm32g431xx diff --git a/boards/wemos/esp32s2_lolin_mini/board.yml b/boards/wemos/esp32s2_lolin_mini/board.yml index 7df1267c2146f..06336f66be07e 100644 --- a/boards/wemos/esp32s2_lolin_mini/board.yml +++ b/boards/wemos/esp32s2_lolin_mini/board.yml @@ -1,5 +1,6 @@ board: name: esp32s2_lolin_mini + full_name: ESP32-S2 Lolin Mini vendor: wemos socs: - name: esp32s2 diff --git a/boards/witte/linum/board.yml b/boards/witte/linum/board.yml index e9ae2c0307d44..0bebfe2dec155 100644 --- a/boards/witte/linum/board.yml +++ b/boards/witte/linum/board.yml @@ -1,5 +1,6 @@ board: name: linum + full_name: Linum Board vendor: witte socs: - name: stm32h753xx diff --git a/boards/wiznet/w5500_evb_pico/board.yml b/boards/wiznet/w5500_evb_pico/board.yml index 17ce17eea1503..eb4eed60b88bd 100644 --- a/boards/wiznet/w5500_evb_pico/board.yml +++ b/boards/wiznet/w5500_evb_pico/board.yml @@ -1,5 +1,6 @@ board: name: w5500_evb_pico + full_name: W5500 Evaluation Pico vendor: wiznet socs: - name: rp2040 diff --git a/boards/xen/xenvm/board.yml b/boards/xen/xenvm/board.yml index 5b5aec44c55ba..f10f659206a26 100644 --- a/boards/xen/xenvm/board.yml +++ b/boards/xen/xenvm/board.yml @@ -1,5 +1,6 @@ board: name: xenvm + full_name: ARMv8 Xen Virtual Machine Example vendor: xen socs: - name: xenvm From 7f1589e23b9a2f7121aecddb74b5607eb41f59ef Mon Sep 17 00:00:00 2001 From: Lars Knudsen Date: Wed, 9 Oct 2024 11:29:06 +0200 Subject: [PATCH 0595/4482] Bluetooth: ISO: Add ISO BIS bitfield check macro Checks validity of ISO BIS bitfield (BIT(0)|...|BIT(30)) Signed-off-by: Lars Knudsen --- include/zephyr/bluetooth/iso.h | 8 ++++++++ subsys/bluetooth/host/iso.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/zephyr/bluetooth/iso.h b/include/zephyr/bluetooth/iso.h index 782ad7df58b6b..4251a2c87cb1a 100644 --- a/include/zephyr/bluetooth/iso.h +++ b/include/zephyr/bluetooth/iso.h @@ -140,6 +140,14 @@ extern "C" { /** Maximum pre-transmission offset */ #define BT_ISO_PTO_MAX 0x0FU +/** + * @brief Check if ISO BIS bitfield is valid (BT_ISO_BIS_INDEX_BIT(1)|..|BT_ISO_BIS_INDEX_BIT(31)) + * + * @param _bis_bitfield BIS index bitfield (uint32) + */ +#define BT_ISO_VALID_BIS_BITFIELD(_bis_bitfield) \ + ((_bis_bitfield) != 0U && (_bis_bitfield) <= BIT_MASK(BT_ISO_BIS_INDEX_MAX)) + /** * @brief Life-span states of ISO channel. Used only by internal APIs dealing with setting channel * to proper state depending on operational context. diff --git a/subsys/bluetooth/host/iso.c b/subsys/bluetooth/host/iso.c index 17e0f3dfb20e6..851998808c8d1 100644 --- a/subsys/bluetooth/host/iso.c +++ b/subsys/bluetooth/host/iso.c @@ -3316,7 +3316,7 @@ int bt_iso_big_sync(struct bt_le_per_adv_sync *sync, struct bt_iso_big_sync_para return -EINVAL; } - CHECKIF(param->bis_bitfield == 0U || param->bis_bitfield > BIT_MASK(BT_ISO_BIS_INDEX_MAX)) { + CHECKIF(!BT_ISO_VALID_BIS_BITFIELD(param->bis_bitfield)) { LOG_DBG("Invalid BIS bitfield 0x%08x", param->bis_bitfield); return -EINVAL; } From 405492f009b25bad4128d74db3e6f50856760c4a Mon Sep 17 00:00:00 2001 From: Lars Knudsen Date: Wed, 9 Oct 2024 11:31:41 +0200 Subject: [PATCH 0596/4482] Bluetooth: Audio: Shell: Fix BIS sync bit field validity check NO PREF (0xFFFFFFFF) and BIT(0) was wrongly rejected. Signed-off-by: Lars Knudsen --- include/zephyr/bluetooth/audio/bap.h | 12 ++++++++++++ subsys/bluetooth/audio/shell/audio.h | 3 --- .../bluetooth/audio/shell/bap_broadcast_assistant.c | 8 ++++---- subsys/bluetooth/audio/shell/cap_commander.c | 2 +- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/include/zephyr/bluetooth/audio/bap.h b/include/zephyr/bluetooth/audio/bap.h index d9cea4cd57eed..f7bf96845ca35 100644 --- a/include/zephyr/bluetooth/audio/bap.h +++ b/include/zephyr/bluetooth/audio/bap.h @@ -41,6 +41,18 @@ extern "C" { #endif +/** + * @brief Check if a BAP BASS BIS_Sync bitfield is valid + * + * Valid options are eiter a bitmask of valid BIS indices, including none (0x00000000) + * or @ref BT_BAP_BIS_SYNC_NO_PREF (0xFFFFFFFF). + * + * @param _bis_bitfield BIS_Sync bitfield (uint32) + */ +#define BT_BAP_BASS_VALID_BIT_BITFIELD(_bis_bitfield) \ + ((_bis_bitfield) == 0U || (_bis_bitfield) == BT_BAP_BIS_SYNC_NO_PREF || \ + BT_ISO_VALID_BIS_BITFIELD(_bis_bitfield)) + /** * @brief Helper to declare elements of bt_bap_qos_cfg * diff --git a/subsys/bluetooth/audio/shell/audio.h b/subsys/bluetooth/audio/shell/audio.h index 8539725d5948f..97478158324f0 100644 --- a/subsys/bluetooth/audio/shell/audio.h +++ b/subsys/bluetooth/audio/shell/audio.h @@ -37,9 +37,6 @@ #define SHELL_PRINT_INDENT_LEVEL_SIZE 2 #define MAX_CODEC_FRAMES_PER_SDU 4U -/* BIS sync is a 32-bit bitfield where BIT(0) is not allowed */ -#define VALID_BIS_SYNC(_bis_sync) ((bis_sync & BIT(0)) == 0U && bis_sync < UINT32_MAX) - extern struct bt_csip_set_member_svc_inst *svc_inst; ssize_t audio_ad_data_add(struct bt_data *data, const size_t data_size, const bool discoverable, diff --git a/subsys/bluetooth/audio/shell/bap_broadcast_assistant.c b/subsys/bluetooth/audio/shell/bap_broadcast_assistant.c index d47e730d4ef91..d434f1a79450c 100644 --- a/subsys/bluetooth/audio/shell/bap_broadcast_assistant.c +++ b/subsys/bluetooth/audio/shell/bap_broadcast_assistant.c @@ -439,7 +439,7 @@ static int cmd_bap_broadcast_assistant_add_src(const struct shell *sh, return -ENOEXEC; } - if (!VALID_BIS_SYNC(bis_sync)) { + if (!BT_BAP_BASS_VALID_BIT_BITFIELD(bis_sync)) { shell_error(sh, "Invalid bis_sync: %lu", bis_sync); return -ENOEXEC; @@ -667,7 +667,7 @@ static int cmd_bap_broadcast_assistant_add_broadcast_id(const struct shell *sh, shell_error(sh, "failed to parse bis_sync: %d", err); return -ENOEXEC; - } else if (!VALID_BIS_SYNC(bis_sync)) { + } else if (!BT_BAP_BASS_VALID_BIT_BITFIELD(bis_sync)) { shell_error(sh, "Invalid bis_sync: %lu", bis_sync); return -ENOEXEC; @@ -735,7 +735,7 @@ static int cmd_bap_broadcast_assistant_add_broadcast_name(const struct shell *sh shell_error(sh, "failed to parse bis_sync: %d", err); return -ENOEXEC; - } else if (!VALID_BIS_SYNC(bis_sync)) { + } else if (!BT_BAP_BASS_VALID_BIT_BITFIELD(bis_sync)) { shell_error(sh, "Invalid bis_sync: %lu", bis_sync); return -ENOEXEC; @@ -836,7 +836,7 @@ static int cmd_bap_broadcast_assistant_mod_src(const struct shell *sh, return -ENOEXEC; } - if (!VALID_BIS_SYNC(bis_sync)) { + if (!BT_BAP_BASS_VALID_BIT_BITFIELD(bis_sync)) { shell_error(sh, "Invalid bis_sync: %lu", bis_sync); return -ENOEXEC; diff --git a/subsys/bluetooth/audio/shell/cap_commander.c b/subsys/bluetooth/audio/shell/cap_commander.c index 4531c68426e95..579039b34938c 100644 --- a/subsys/bluetooth/audio/shell/cap_commander.c +++ b/subsys/bluetooth/audio/shell/cap_commander.c @@ -605,7 +605,7 @@ static int cmd_cap_commander_broadcast_reception_start(const struct shell *sh, s return -ENOEXEC; } - if (!VALID_BIS_SYNC(bis_sync)) { + if (!BT_BAP_BASS_VALID_BIT_BITFIELD(bis_sync)) { shell_error(sh, "Invalid bis_sync: %lu", bis_sync); return -ENOEXEC; From 9a5cd08deb35cff4b86581e44d8d2e196daaa759 Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Thu, 3 Oct 2024 13:53:19 -0300 Subject: [PATCH 0597/4482] uart: esp32: Fixing garbage characters on mcuboot Fixes garbage characters on mcuboot by adjusting UART baudrate during boot phase according to clock source. Signed-off-by: Raffael Rostagno --- drivers/clock_control/clock_control_esp32.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/clock_control/clock_control_esp32.c b/drivers/clock_control/clock_control_esp32.c index f911e4cb67d8f..346997d898daa 100644 --- a/drivers/clock_control/clock_control_esp32.c +++ b/drivers/clock_control/clock_control_esp32.c @@ -688,8 +688,11 @@ static int esp32_cpu_clock_configure(const struct esp32_cpu_clock_config *cpu_cf #if !defined(ESP_CONSOLE_UART_NONE) #if !defined(CONFIG_SOC_SERIES_ESP32C2) && !defined(CONFIG_SOC_SERIES_ESP32C6) +#if defined(CONFIG_MCUBOOT) && defined(ESP_ROM_UART_CLK_IS_XTAL) + uint32_t uart_clock_src_hz = (uint32_t)rtc_clk_xtal_freq_get() * MHZ(1); +#else uint32_t uart_clock_src_hz = esp_clk_apb_freq(); - +#endif esp_rom_uart_set_clock_baudrate(ESP_CONSOLE_UART_NUM, uart_clock_src_hz, ESP_CONSOLE_UART_BAUDRATE); #endif From 3399e0614adbc67350ceac85ac747daef32a0534 Mon Sep 17 00:00:00 2001 From: Kevin ORourke Date: Wed, 25 Sep 2024 08:55:12 +0200 Subject: [PATCH 0598/4482] shell: backend: telnet: Don't assert if connection closed The code in shell_ops.c that calls telnet_write will assert if it returns non-zero. For a telnet shell it's normal that the network might disconnect unexepectedly, so that should not trigger an assert. Fixes #67637 Link: https://github.com/zephyrproject-rtos/zephyr/issues/67637 Signed-off-by: Kevin ORourke --- subsys/shell/backends/shell_telnet.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/subsys/shell/backends/shell_telnet.c b/subsys/shell/backends/shell_telnet.c index f6b340e3ab0b6..862c7d80ac8be 100644 --- a/subsys/shell/backends/shell_telnet.c +++ b/subsys/shell/backends/shell_telnet.c @@ -708,7 +708,12 @@ static int telnet_write(const struct shell_transport *transport, err = telnet_send(true); if (err != 0) { *cnt = length; - return err; + if ((err == -ENOTCONN) || (err == -ENETDOWN)) { + LOG_ERR("Network disconnected, shutting down"); + } else { + LOG_ERR("Error %d, shutting down", err); + } + return 0; /* Return 0 to not trigger ASSERT in shell_ops.c */ } } From ad6c0512adc3ab1c769eab7a6a696f174c54b51d Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Fri, 6 Sep 2024 13:45:08 +0200 Subject: [PATCH 0599/4482] Bluetooth: Controller: Fix CIS payload count under skipped events Fix CIS payload count calculation under skipped events that caused CIS disconnection with reason MIC failure. Signed-off-by: Vinayak Kariappa Chettimada --- .../ll_sw/nordic/lll/lll_central_iso.c | 12 +++++++---- .../ll_sw/nordic/lll/lll_peripheral_iso.c | 20 ++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c index 9d8b517cb55e0..218a1d133c094 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c @@ -1253,8 +1253,10 @@ static void payload_count_lazy_update(struct lll_conn_iso_stream *cis_lll, uint1 u = cis_lll->nse - ((cis_lll->nse / cis_lll->tx.bn) * (cis_lll->tx.bn - 1U - (payload_count % cis_lll->tx.bn))); - while (((cis_lll->tx.payload_count / cis_lll->tx.bn) + cis_lll->tx.ft) < - (cis_lll->event_count + 1U)) { + while ((((cis_lll->tx.payload_count / cis_lll->tx.bn) + cis_lll->tx.ft) < + cis_lll->event_count) || + ((((cis_lll->tx.payload_count / cis_lll->tx.bn) + cis_lll->tx.ft) == + cis_lll->event_count) && (u <= cis_lll->nse))) { /* sn and nesn are 1-bit, only Least Significant bit is needed */ cis_lll->sn++; cis_lll->tx.bn_curr++; @@ -1281,8 +1283,10 @@ static void payload_count_lazy_update(struct lll_conn_iso_stream *cis_lll, uint1 u = cis_lll->nse - ((cis_lll->nse / cis_lll->rx.bn) * (cis_lll->rx.bn - 1U - (payload_count % cis_lll->rx.bn))); - while (((cis_lll->rx.payload_count / cis_lll->rx.bn) + cis_lll->rx.ft) < - (cis_lll->event_count + 1U)) { + while ((((cis_lll->rx.payload_count / cis_lll->rx.bn) + cis_lll->rx.ft) < + cis_lll->event_count) || + ((((cis_lll->rx.payload_count / cis_lll->rx.bn) + cis_lll->rx.ft) == + cis_lll->event_count) && (u <= cis_lll->nse))) { /* sn and nesn are 1-bit, only Least Significant bit is needed */ cis_lll->nesn++; cis_lll->rx.bn_curr++; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c index b79869111baa8..1391755274dc1 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c @@ -1359,12 +1359,10 @@ static void payload_count_lazy(struct lll_conn_iso_stream *cis_lll, uint16_t laz u = cis_lll->nse - ((cis_lll->nse / cis_lll->tx.bn) * (cis_lll->tx.bn - 1U - (payload_count % cis_lll->tx.bn))); - while (((((cis_lll->tx.payload_count / cis_lll->tx.bn) + cis_lll->tx.ft) < - (cis_lll->event_count + 1U)) || - ((((cis_lll->tx.payload_count / cis_lll->tx.bn) + cis_lll->tx.ft) == - (cis_lll->event_count + 1U)) && (u < (cis_lll->nse + 1U)))) && - ((cis_lll->tx.payload_count / cis_lll->tx.bn) < - cis_lll->event_count)) { + while ((((cis_lll->tx.payload_count / cis_lll->tx.bn) + cis_lll->tx.ft) < + cis_lll->event_count) || + ((((cis_lll->tx.payload_count / cis_lll->tx.bn) + cis_lll->tx.ft) == + cis_lll->event_count) && (u < cis_lll->nse))) { /* sn and nesn are 1-bit, only Least Significant bit is needed */ cis_lll->sn++; cis_lll->tx.bn_curr++; @@ -1391,12 +1389,10 @@ static void payload_count_lazy(struct lll_conn_iso_stream *cis_lll, uint16_t laz u = cis_lll->nse - ((cis_lll->nse / cis_lll->rx.bn) * (cis_lll->rx.bn - 1U - (payload_count % cis_lll->rx.bn))); - while (((((cis_lll->rx.payload_count / cis_lll->rx.bn) + cis_lll->rx.ft) < - (cis_lll->event_count + 1U)) || - ((((cis_lll->rx.payload_count / cis_lll->rx.bn) + cis_lll->rx.ft) == - (cis_lll->event_count + 1U)) && (u <= (cis_lll->nse + 1U)))) && - ((cis_lll->rx.payload_count / cis_lll->rx.bn) < - cis_lll->event_count)) { + while ((((cis_lll->rx.payload_count / cis_lll->rx.bn) + cis_lll->rx.ft) < + cis_lll->event_count) || + ((((cis_lll->rx.payload_count / cis_lll->rx.bn) + cis_lll->rx.ft) == + cis_lll->event_count) && (u <= cis_lll->nse))) { /* sn and nesn are 1-bit, only Least Significant bit is needed */ cis_lll->nesn++; cis_lll->rx.bn_curr++; From 1cc93810d05a0c3bf1711fce041aa4e5ad55630c Mon Sep 17 00:00:00 2001 From: Bernardo Perez Priego Date: Thu, 8 Aug 2024 11:19:25 -0700 Subject: [PATCH 0600/4482] ec_host_cmd: Fix generating multiple Port80 notifications Port80 notifications are continously generated as long as NOT_EMPTY bit inside of Data Attributes register is set. This register was only read once prior entering loop and its value was not checked on each iteration. This patch will include reading Data Attributes register on each iteration, this way we can exit loop when no more data is available. Signed-off-by: Bernardo Perez Priego --- drivers/espi/espi_mchp_xec_host_v2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/espi/espi_mchp_xec_host_v2.c b/drivers/espi/espi_mchp_xec_host_v2.c index 12d32007e84ba..5bcb78903cbdd 100644 --- a/drivers/espi/espi_mchp_xec_host_v2.c +++ b/drivers/espi/espi_mchp_xec_host_v2.c @@ -855,6 +855,7 @@ static void p80bd0_isr(const struct device *dev) espi_send_callbacks(&data->callbacks, dev, evt); evt.evt_details = 0; } + dattr = p80regs->EC_DA; } /* clear GIRQ status */ From c591994b4f6bf6e666016ed05652044d476c7bb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nerijus=20Bend=C5=BEi=C5=ABnas?= Date: Wed, 31 Jul 2024 11:49:38 +0300 Subject: [PATCH 0601/4482] docs: settings: clarify conditions for csi_save_start and csi_save_end MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clarify that the actual calls to these backend functions are made from `settings_save_subtree()`, which is called by `settings_save()` or can be used directly. Signed-off-by: Nerijus Bendžiūnas --- doc/services/settings/index.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/services/settings/index.rst b/doc/services/settings/index.rst index 87ac85a3ac2a7..10578da5bec2e 100644 --- a/doc/services/settings/index.rst +++ b/doc/services/settings/index.rst @@ -72,11 +72,11 @@ backend. **csi_save_start** This gets called when starting a save of all current settings using - :c:func:`settings_save()`. + :c:func:`settings_save()` or :c:func:`settings_save_subtree()`. **csi_save_end** This gets called after having saved of all current settings using - :c:func:`settings_save()`. + :c:func:`settings_save()` or :c:func:`settings_save_subtree()`. Zephyr Storage Backends *********************** From 97db13dc0996b8f4f2c7dfb97ed7e672e982ad57 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Sat, 20 Jul 2024 19:56:10 +1000 Subject: [PATCH 0602/4482] scripts: west_commands: runners: propagate arguments Provide a mechanism to propagate useful arguments from one runner to the next. The primary use case for this is to propagate a JLink serial number, so that if it is queried from the terminal the user only needs to make the choice once. Implements #76077. Signed-off-by: Jordan Yates --- scripts/west_commands/run_common.py | 12 +++++++++--- scripts/west_commands/runners/core.py | 9 +++++++++ scripts/west_commands/runners/nrf_common.py | 6 ++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/scripts/west_commands/run_common.py b/scripts/west_commands/run_common.py index 772d736c18335..82ec7a09b9bd8 100644 --- a/scripts/west_commands/run_common.py +++ b/scripts/west_commands/run_common.py @@ -284,13 +284,14 @@ def do_run_common(command, user_args, user_runner_args, domain_file=None): if len(entry.boards) == 0: del used_cmds[i] + prev_runner = None for d in domains: - do_run_common_image(command, user_args, user_runner_args, - used_cmds, board_image_count, d.build_dir) + prev_runner = do_run_common_image(command, user_args, user_runner_args, used_cmds, + board_image_count, d.build_dir, prev_runner) def do_run_common_image(command, user_args, user_runner_args, used_cmds, - board_image_count, build_dir=None,): + board_image_count, build_dir=None, prev_runner=None): global re command_name = command.name if build_dir is None: @@ -440,6 +441,10 @@ def do_run_common_image(command, user_args, user_runner_args, used_cmds, if unknown: log.die(f'runner {runner_name} received unknown arguments: {unknown}') + # Propagate useful args from previous domain invocations + if prev_runner is not None: + runner_cls.args_from_previous_runner(prev_runner, args) + # Override args with any user_args. The latter must take # precedence, or e.g. --hex-file on the command line would be # ignored in favor of a board.cmake setting. @@ -470,6 +475,7 @@ def do_run_common_image(command, user_args, user_runner_args, used_cmds, else: log.err('verbose mode enabled, dumping stack:', fatal=True) raise + return runner def get_build_dir(args, die_if_none=True): # Get the build directory for the given argument list and environment. diff --git a/scripts/west_commands/runners/core.py b/scripts/west_commands/runners/core.py index d216dffcd18e6..db5408c8f5164 100644 --- a/scripts/west_commands/runners/core.py +++ b/scripts/west_commands/runners/core.py @@ -624,6 +624,15 @@ def add_parser(cls, parser): def do_add_parser(cls, parser): '''Hook for adding runner-specific options.''' + @classmethod + def args_from_previous_runner(cls, previous_runner, + args: argparse.Namespace): + '''Update arguments from a previously created runner. + + This is intended for propagating relevant user responses + between multiple runs of the same runner, for example a + JTAG serial number.''' + @classmethod def create(cls, cfg: RunnerConfig, args: argparse.Namespace) -> 'ZephyrBinaryRunner': diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index 6423253233c12..3d27c60f74bd0 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -89,6 +89,12 @@ def do_add_parser(cls, parser): parser.set_defaults(reset=True) + @classmethod + def args_from_previous_runner(cls, previous_runner, args): + # Propagate the chosen device ID to next runner + if args.dev_id is None: + args.dev_id = previous_runner.dev_id + def ensure_snr(self): if not self.dev_id or "*" in self.dev_id: self.dev_id = self.get_board_snr(self.dev_id or "*") From 00cefa15ff5c7fa54d66a2b33db49a831780ff47 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 15 Jul 2024 10:29:44 +0200 Subject: [PATCH 0603/4482] drivers: Add comparator API Add comparator API header. Signed-off-by: Bjarki Arge Andreasen --- include/zephyr/drivers/comparator.h | 150 ++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 include/zephyr/drivers/comparator.h diff --git a/include/zephyr/drivers/comparator.h b/include/zephyr/drivers/comparator.h new file mode 100644 index 0000000000000..3d246fea5ff15 --- /dev/null +++ b/include/zephyr/drivers/comparator.h @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_DRIVERS_COMPARATOR_H_ +#define ZEPHYR_INCLUDE_DRIVERS_COMPARATOR_H_ + +/** + * @brief Comparator Interface + * @defgroup comparator_interface Comparator Interface + * @since 3.7 + * @version 0.1.0 + * @ingroup io_interfaces + * @{ + */ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Comparator trigger enumerations */ +enum comparator_trigger { + /** No trigger */ + COMPARATOR_TRIGGER_NONE = 0, + /** Trigger on rising edge of comparator output */ + COMPARATOR_TRIGGER_RISING_EDGE, + /** Trigger on falling edge of comparator output */ + COMPARATOR_TRIGGER_FALLING_EDGE, + /** Trigger on both edges of comparator output */ + COMPARATOR_TRIGGER_BOTH_EDGES +}; + +/** Comparator callback template */ +typedef void (*comparator_callback_t)(const struct device *dev, void *user_data); + +/** @cond INTERNAL_HIDDEN */ + +typedef int (*comparator_api_get_output)(const struct device *dev); +typedef int (*comparator_api_set_trigger)(const struct device *dev, + enum comparator_trigger trigger); +typedef int (*comparator_api_set_trigger_callback)(const struct device *dev, + comparator_callback_t callback, + void *user_data); +typedef int (*comparator_api_trigger_is_pending)(const struct device *dev); + +__subsystem struct comparator_driver_api { + comparator_api_get_output get_output; + comparator_api_set_trigger set_trigger; + comparator_api_set_trigger_callback set_trigger_callback; + comparator_api_trigger_is_pending trigger_is_pending; +}; + +/** @endcond */ + +/** + * @brief Get comparator's output state + * + * @param dev Comparator device + * + * @retval 1 Output state is high + * @retval 0 Output state is low + * @retval -errno code Failure + */ +__syscall int comparator_get_output(const struct device *dev); + +static inline int z_impl_comparator_get_output(const struct device *dev) +{ + const struct comparator_driver_api *api = + (const struct comparator_driver_api *)dev->api; + + return api->get_output(dev); +} + +/** + * @brief Set comparator's trigger + * + * @param dev Comparator device + * @param trigger Trigger for signal and callback + * + * @retval 0 Successful + * @retval -errno code Failure + */ +__syscall int comparator_set_trigger(const struct device *dev, + enum comparator_trigger trigger); + +static inline int z_impl_comparator_set_trigger(const struct device *dev, + enum comparator_trigger trigger) +{ + const struct comparator_driver_api *api = + (const struct comparator_driver_api *)dev->api; + + return api->set_trigger(dev, trigger); +} + +/** + * @brief Set comparator's trigger callback + * + * @param dev Comparator device + * @param callback Trigger callback + * @param user_data User data passed to callback + * + * @retval 0 Successful + * @retval -errno code Failure + * + * @note Set callback to NULL to disable callback + * @note Callback is called immediately if trigger is pending + */ +static inline int comparator_set_trigger_callback(const struct device *dev, + comparator_callback_t callback, + void *user_data) +{ + const struct comparator_driver_api *api = + (const struct comparator_driver_api *)dev->api; + + return api->set_trigger_callback(dev, callback, user_data); +} + +/** + * @brief Check if comparator's trigger is pending and clear it + * + * @param dev Comparator device + * + * @retval 1 Trigger was pending + * @retval 0 Trigger was cleared + * @retval -errno code Failure + */ +__syscall int comparator_trigger_is_pending(const struct device *dev); + +static inline int z_impl_comparator_trigger_is_pending(const struct device *dev) +{ + const struct comparator_driver_api *api = + (const struct comparator_driver_api *)dev->api; + + return api->trigger_is_pending(dev); +} + +#ifdef __cplusplus +} +#endif + +/** @} */ + +#include + +#endif /* ZEPHYR_INCLUDE_DRIVERS_COMPARATOR_H_ */ From 211bdd935c489391412da7bef6b1f1c061bb08b7 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 15 Jul 2024 11:07:19 +0200 Subject: [PATCH 0604/4482] drivers: comparator: Add initial files Add top level CMakeLists.txt entry and Kconfig options along with userspace handlers for comparator API. Signed-off-by: Bjarki Arge Andreasen --- drivers/CMakeLists.txt | 1 + drivers/Kconfig | 1 + drivers/comparator/CMakeLists.txt | 8 +++++++ drivers/comparator/Kconfig | 21 +++++++++++++++++ drivers/comparator/comparator_handlers.c | 30 ++++++++++++++++++++++++ 5 files changed, 61 insertions(+) create mode 100644 drivers/comparator/CMakeLists.txt create mode 100644 drivers/comparator/Kconfig create mode 100644 drivers/comparator/comparator_handlers.c diff --git a/drivers/CMakeLists.txt b/drivers/CMakeLists.txt index acf20d2867c01..05be8c3fd01c4 100644 --- a/drivers/CMakeLists.txt +++ b/drivers/CMakeLists.txt @@ -24,6 +24,7 @@ add_subdirectory_ifdef(CONFIG_CACHE_MANAGEMENT cache) add_subdirectory_ifdef(CONFIG_CAN can) add_subdirectory_ifdef(CONFIG_CHARGER charger) add_subdirectory_ifdef(CONFIG_CLOCK_CONTROL clock_control) +add_subdirectory_ifdef(CONFIG_COMPARATOR comparator) add_subdirectory_ifdef(CONFIG_CONSOLE console) add_subdirectory_ifdef(CONFIG_COREDUMP_DEVICE coredump) add_subdirectory_ifdef(CONFIG_COUNTER counter) diff --git a/drivers/Kconfig b/drivers/Kconfig index ec9e0c77b6d42..db80ba39a66fa 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -15,6 +15,7 @@ source "drivers/cache/Kconfig" source "drivers/can/Kconfig" source "drivers/charger/Kconfig" source "drivers/clock_control/Kconfig" +source "drivers/comparator/Kconfig" source "drivers/console/Kconfig" source "drivers/coredump/Kconfig" source "drivers/counter/Kconfig" diff --git a/drivers/comparator/CMakeLists.txt b/drivers/comparator/CMakeLists.txt new file mode 100644 index 0000000000000..5f61892829d6f --- /dev/null +++ b/drivers/comparator/CMakeLists.txt @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +zephyr_syscall_header(${ZEPHYR_BASE}/include/zephyr/drivers/comparator.h) + +zephyr_library() + +zephyr_library_sources_ifdef(CONFIG_USERSPACE comparator_handlers.c) diff --git a/drivers/comparator/Kconfig b/drivers/comparator/Kconfig new file mode 100644 index 0000000000000..333fe6671a5a6 --- /dev/null +++ b/drivers/comparator/Kconfig @@ -0,0 +1,21 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +menuconfig COMPARATOR + bool "Comparator drivers" + help + Enable comparator driver configuration. + +if COMPARATOR + +module = COMPARATOR +module-str = comparator +source "subsys/logging/Kconfig.template.log_config" + +config COMPARATOR_INIT_PRIORITY + int "COMPARATOR init priority" + default KERNEL_INIT_PRIORITY_DEVICE + help + Comparator device driver initialization priority. + +endif # COMPARATOR diff --git a/drivers/comparator/comparator_handlers.c b/drivers/comparator/comparator_handlers.c new file mode 100644 index 0000000000000..fba43a9ce8e13 --- /dev/null +++ b/drivers/comparator/comparator_handlers.c @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +static inline int z_vrfy_comparator_get_output(const struct device *dev) +{ + K_OOPS(K_SYSCALL_DRIVER_COMPARATOR(dev, get_output)); + return z_impl_comparator_get_output(dev); +} +#include + +static inline int z_vrfy_comparator_set_trigger(const struct device *dev, + enum comparator_trigger trigger) +{ + K_OOPS(K_SYSCALL_DRIVER_COMPARATOR(dev, set_trigger)); + return z_impl_comparator_set_trigger(dev, trigger); +} +#include + +static inline int z_vrfy_comparator_trigger_is_pending(const struct device *dev) +{ + K_OOPS(K_SYSCALL_DRIVER_COMPARATOR(dev, trigger_is_pending)); + return z_impl_comparator_trigger_is_pending(dev); +} +#include From ffbda1b0f84864704b2522619717896d6b22223f Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 13 Sep 2024 15:13:47 +0200 Subject: [PATCH 0605/4482] dts: common: nordic: adjust comparator nodes Adjust comparator nodes of nrf SoCs to exclude the unused io-channel-cells property and simplify the comment describing how to configure the comparator hardware block as COMP or LPCOMP for SoCs which support this. Signed-off-by: Bjarki Arge Andreasen --- dts/arm/nordic/nrf52810.dtsi | 1 - dts/arm/nordic/nrf52811.dtsi | 1 - dts/arm/nordic/nrf52820.dtsi | 1 - dts/arm/nordic/nrf52832.dtsi | 7 ++----- dts/arm/nordic/nrf52833.dtsi | 7 ++----- dts/arm/nordic/nrf52840.dtsi | 7 ++----- dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi | 7 ++----- dts/common/nordic/nrf54h20.dtsi | 5 ++++- dts/common/nordic/nrf54l15.dtsi | 11 +++++++++++ dts/common/nordic/nrf9280.dtsi | 5 ++++- 10 files changed, 27 insertions(+), 25 deletions(-) diff --git a/dts/arm/nordic/nrf52810.dtsi b/dts/arm/nordic/nrf52810.dtsi index 73aa5a0da0c7a..2ddcd4047ffc0 100644 --- a/dts/arm/nordic/nrf52810.dtsi +++ b/dts/arm/nordic/nrf52810.dtsi @@ -268,7 +268,6 @@ reg = <0x40013000 0x1000>; interrupts = <19 NRF_DEFAULT_IRQ_PRIORITY>; status = "disabled"; - #io-channel-cells = <1>; }; egu0: swi0: egu@40014000 { diff --git a/dts/arm/nordic/nrf52811.dtsi b/dts/arm/nordic/nrf52811.dtsi index 8479950d17a56..273c25fff6940 100644 --- a/dts/arm/nordic/nrf52811.dtsi +++ b/dts/arm/nordic/nrf52811.dtsi @@ -300,7 +300,6 @@ reg = <0x40013000 0x1000>; interrupts = <19 NRF_DEFAULT_IRQ_PRIORITY>; status = "disabled"; - #io-channel-cells = <1>; }; egu0: swi0: egu@40014000 { diff --git a/dts/arm/nordic/nrf52820.dtsi b/dts/arm/nordic/nrf52820.dtsi index 9780e06af4b0b..71abcab55ccdf 100644 --- a/dts/arm/nordic/nrf52820.dtsi +++ b/dts/arm/nordic/nrf52820.dtsi @@ -314,7 +314,6 @@ reg = <0x40013000 0x1000>; interrupts = <19 NRF_DEFAULT_IRQ_PRIORITY>; status = "disabled"; - #io-channel-cells = <1>; }; egu0: swi0: egu@40014000 { diff --git a/dts/arm/nordic/nrf52832.dtsi b/dts/arm/nordic/nrf52832.dtsi index 30fb92f71aa5f..dfaf88882a00e 100644 --- a/dts/arm/nordic/nrf52832.dtsi +++ b/dts/arm/nordic/nrf52832.dtsi @@ -310,16 +310,13 @@ comp: comparator@40013000 { /* - * This comparator node can be COMP or LPCOMP, - * for the user to pick: - * compatible = "nordic,nrf-comp" or - * "nordic,nrf-lpcomp". + * Use compatible "nordic,nrf-comp" to configure as COMP + * Use compatible "nordic,nrf-lpcomp" to configure as LPCOMP */ compatible = "nordic,nrf-comp"; reg = <0x40013000 0x1000>; interrupts = <19 NRF_DEFAULT_IRQ_PRIORITY>; status = "disabled"; - #io-channel-cells = <1>; }; egu0: swi0: egu@40014000 { diff --git a/dts/arm/nordic/nrf52833.dtsi b/dts/arm/nordic/nrf52833.dtsi index 8ca66986111de..d47eeead1aac7 100644 --- a/dts/arm/nordic/nrf52833.dtsi +++ b/dts/arm/nordic/nrf52833.dtsi @@ -325,16 +325,13 @@ comp: comparator@40013000 { /* - * This comparator node can be COMP or LPCOMP, - * for the user to pick: - * compatible = "nordic,nrf-comp" or - * "nordic,nrf-lpcomp". + * Use compatible "nordic,nrf-comp" to configure as COMP + * Use compatible "nordic,nrf-lpcomp" to configure as LPCOMP */ compatible = "nordic,nrf-comp"; reg = <0x40013000 0x1000>; interrupts = <19 NRF_DEFAULT_IRQ_PRIORITY>; status = "disabled"; - #io-channel-cells = <1>; }; egu0: swi0: egu@40014000 { diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index 4c52ff127b57f..e821e5523df72 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -312,16 +312,13 @@ comp: comparator@40013000 { /* - * This comparator node can be COMP or LPCOMP, - * for the user to pick: - * compatible = "nordic,nrf-comp" or - * "nordic,nrf-lpcomp". + * Use compatible "nordic,nrf-comp" to configure as COMP + * Use compatible "nordic,nrf-lpcomp" to configure as LPCOMP */ compatible = "nordic,nrf-comp"; reg = <0x40013000 0x1000>; interrupts = <19 NRF_DEFAULT_IRQ_PRIORITY>; status = "disabled"; - #io-channel-cells = <1>; }; egu0: swi0: egu@40014000 { diff --git a/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi index a1ca9e71e0c94..12bf76a1a4d77 100644 --- a/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi @@ -365,16 +365,13 @@ wdt1: watchdog@19000 { comp: comparator@1a000 { /* - * This comparator node can be COMP or LPCOMP, - * for the user to pick: - * compatible = "nordic,nrf-comp" or - * "nordic,nrf-lpcomp". + * Use compatible "nordic,nrf-comp" to configure as COMP + * Use compatible "nordic,nrf-lpcomp" to configure as LPCOMP */ compatible = "nordic,nrf-comp"; reg = <0x1a000 0x1000>; interrupts = <26 NRF_DEFAULT_IRQ_PRIORITY>; status = "disabled"; - #io-channel-cells = <1>; }; egu0: egu@1b000 { diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index de006cd9cf690..a3d8b55510b34 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -824,11 +824,14 @@ }; comp: comparator@983000 { + /* + * Use compatible "nordic,nrf-comp" to configure as COMP + * Use compatible "nordic,nrf-lpcomp" to configure as LPCOMP + */ compatible = "nordic,nrf-comp"; reg = <0x983000 0x1000>; status = "disabled"; interrupts = <387 NRF_DEFAULT_IRQ_PRIORITY>; - #io-channel-cells = <1>; }; temp: temperature-sensor@984000 { diff --git a/dts/common/nordic/nrf54l15.dtsi b/dts/common/nordic/nrf54l15.dtsi index ad80b332fba5a..953d297f74276 100644 --- a/dts/common/nordic/nrf54l15.dtsi +++ b/dts/common/nordic/nrf54l15.dtsi @@ -565,6 +565,17 @@ frame-timeout-supported; }; + comp: comparator@106000 { + /* + * Use compatible "nordic,nrf-comp" to configure as COMP + * Use compatible "nordic,nrf-lpcomp" to configure as LPCOMP + */ + compatible = "nordic,nrf-comp"; + reg = <0x106000 0x1000>; + status = "disabled"; + interrupts = <262 NRF_DEFAULT_IRQ_PRIORITY>; + }; + #ifdef USE_NON_SECURE_ADDRESS_MAP /* intentionally empty because WDT30 is hardware fixed to Secure */ #else diff --git a/dts/common/nordic/nrf9280.dtsi b/dts/common/nordic/nrf9280.dtsi index 3acd5268e752d..187495a4fe0d5 100644 --- a/dts/common/nordic/nrf9280.dtsi +++ b/dts/common/nordic/nrf9280.dtsi @@ -736,11 +736,14 @@ }; comp: comparator@983000 { + /* + * Use compatible "nordic,nrf-comp" to configure as COMP + * Use compatible "nordic,nrf-lpcomp" to configure as LPCOMP + */ compatible = "nordic,nrf-comp"; reg = <0x983000 0x1000>; status = "disabled"; interrupts = <387 NRF_DEFAULT_IRQ_PRIORITY>; - #io-channel-cells = <1>; }; temp: temperature-sensor@984000 { From 4adc92475d951c94ab0c2267a5e6196b4df0dfb4 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 17 Jul 2024 12:46:52 +0200 Subject: [PATCH 0606/4482] drivers: comparator: Add nRF COMP device driver Add nRF COMP device driver and remove deprecated bindings from dts/bindings/sensor. Signed-off-by: Bjarki Arge Andreasen --- drivers/comparator/CMakeLists.txt | 1 + drivers/comparator/Kconfig | 2 + drivers/comparator/Kconfig.nrf_comp | 8 + drivers/comparator/comparator_nrf_comp.c | 764 +++++++++++++++++++ dts/bindings/comparator/nordic,nrf-comp.yaml | 128 ++++ dts/bindings/sensor/nordic,nrf-comp.yaml | 23 - include/zephyr/drivers/comparator/nrf_comp.h | 164 ++++ 7 files changed, 1067 insertions(+), 23 deletions(-) create mode 100644 drivers/comparator/Kconfig.nrf_comp create mode 100644 drivers/comparator/comparator_nrf_comp.c create mode 100644 dts/bindings/comparator/nordic,nrf-comp.yaml delete mode 100644 dts/bindings/sensor/nordic,nrf-comp.yaml create mode 100644 include/zephyr/drivers/comparator/nrf_comp.h diff --git a/drivers/comparator/CMakeLists.txt b/drivers/comparator/CMakeLists.txt index 5f61892829d6f..20aa301af7d02 100644 --- a/drivers/comparator/CMakeLists.txt +++ b/drivers/comparator/CMakeLists.txt @@ -6,3 +6,4 @@ zephyr_syscall_header(${ZEPHYR_BASE}/include/zephyr/drivers/comparator.h) zephyr_library() zephyr_library_sources_ifdef(CONFIG_USERSPACE comparator_handlers.c) +zephyr_library_sources_ifdef(CONFIG_COMPARATOR_NRF_COMP comparator_nrf_comp.c) diff --git a/drivers/comparator/Kconfig b/drivers/comparator/Kconfig index 333fe6671a5a6..84ea5c74baa60 100644 --- a/drivers/comparator/Kconfig +++ b/drivers/comparator/Kconfig @@ -18,4 +18,6 @@ config COMPARATOR_INIT_PRIORITY help Comparator device driver initialization priority. +rsource "Kconfig.nrf_comp" + endif # COMPARATOR diff --git a/drivers/comparator/Kconfig.nrf_comp b/drivers/comparator/Kconfig.nrf_comp new file mode 100644 index 0000000000000..0e0c889f3ee06 --- /dev/null +++ b/drivers/comparator/Kconfig.nrf_comp @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config COMPARATOR_NRF_COMP + bool "Nordic COMP comparator driver" + default y + depends on DT_HAS_NORDIC_NRF_COMP_ENABLED + select NRFX_COMP diff --git a/drivers/comparator/comparator_nrf_comp.c b/drivers/comparator/comparator_nrf_comp.c new file mode 100644 index 0000000000000..339d24f8dcdab --- /dev/null +++ b/drivers/comparator/comparator_nrf_comp.c @@ -0,0 +1,764 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include +#include + +#define DT_DRV_COMPAT nordic_nrf_comp + +#define SHIM_NRF_COMP_DT_INST_REFSEL(inst) \ + _CONCAT(COMP_NRF_COMP_REFSEL_, DT_INST_STRING_TOKEN(inst, refsel)) + +#define SHIM_NRF_COMP_DT_INST_REFSEL_IS_AREF(inst) \ + DT_INST_ENUM_HAS_VALUE(inst, refsel, AREF) + +#define SHIM_NRF_COMP_DT_INST_EXTREFSEL(inst) \ + _CONCAT(COMP_NRF_COMP_EXTREFSEL_, DT_INST_STRING_TOKEN(inst, extrefsel)) + +#define SHIM_NRF_COMP_DT_INST_MAIN_MODE_IS_SE(inst) \ + DT_INST_ENUM_HAS_VALUE(inst, main_mode, SE) + +#define SHIM_NRF_COMP_DT_INST_MAIN_MODE_IS_DIFF(inst) \ + DT_INST_ENUM_HAS_VALUE(inst, main_mode, DIFF) + +#define SHIM_NRF_COMP_DT_INST_TH_DOWN(inst) \ + DT_INST_PROP(inst, th_down) + +#define SHIM_NRF_COMP_DT_INST_TH_UP(inst) \ + DT_INST_PROP(inst, th_up) + +#define SHIM_NRF_COMP_DT_INST_SP_MODE(inst) \ + _CONCAT(COMP_NRF_COMP_SP_MODE_, DT_INST_STRING_TOKEN(inst, sp_mode)) + +#define SHIM_NRF_COMP_DT_INST_ENABLE_HYST(inst) \ + DT_INST_PROP(inst, enable_hyst) + +#define SHIM_NRF_COMP_DT_INST_ISOURCE(inst) \ + _CONCAT(COMP_NRF_COMP_ISOURCE_, DT_INST_STRING_TOKEN(inst, isource)) + +#define SHIM_NRF_COMP_DT_INST_PSEL(inst) \ + _CONCAT(COMP_NRF_COMP_PSEL_, DT_INST_STRING_TOKEN(inst, psel)) + +#if defined(COMP_HYST_HYST_Hyst40mV) +#define NRF_COMP_HYST_ENABLED NRF_COMP_HYST_40MV +#elif defined(COMP_HYST_HYST_Hyst50mV) +#define NRF_COMP_HYST_ENABLED NRF_COMP_HYST_50MV +#endif + +#define NRF_COMP_HYST_DISABLED NRF_COMP_HYST_NO_HYST + +#if defined(NRF_COMP_HYST_ENABLED) +#define NRF_COMP_HAS_HYST 1 +#else +#define NRF_COMP_HAS_HYST 0 +#endif + +struct shim_nrf_comp_data { + uint32_t event_mask; + bool started; + atomic_t triggered; + comparator_callback_t callback; + void *user_data; +}; + +#if (NRF_COMP_HAS_AIN_AS_PIN) +static const uint32_t shim_nrf_comp_ain_map[] = { +#if defined(CONFIG_SOC_NRF54H20) || defined(CONFIG_SOC_NRF9280) + NRF_PIN_PORT_TO_PIN_NUMBER(0U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(1U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(2U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(3U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(6U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1), +#elif defined(CONFIG_SOC_NRF54L15) + NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(6U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(11U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(12U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(13U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(14U, 1), +#endif +}; +#endif + +#if SHIM_NRF_COMP_DT_INST_MAIN_MODE_IS_SE(0) +BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_TH_DOWN(0) < 64); +BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_TH_UP(0) < 64); +#endif + +#if NRF_COMP_HAS_AIN_AS_PIN +BUILD_ASSERT((COMP_NRF_COMP_PSEL_AIN0 == 0)); +BUILD_ASSERT((COMP_NRF_COMP_PSEL_AIN7 == 7)); +BUILD_ASSERT((COMP_NRF_COMP_EXTREFSEL_AIN0 == 0)); +BUILD_ASSERT((COMP_NRF_COMP_EXTREFSEL_AIN7 == 7)); +#else +#ifndef COMP_PSEL_PSEL_AnalogInput4 +BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_PSEL(0) != COMP_NRF_COMP_PSEL_AIN4); +#endif + +#ifndef COMP_PSEL_PSEL_AnalogInput5 +BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_PSEL(0) != COMP_NRF_COMP_PSEL_AIN5); +#endif + +#ifndef COMP_PSEL_PSEL_AnalogInput6 +BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_PSEL(0) != COMP_NRF_COMP_PSEL_AIN6); +#endif + +#ifndef COMP_PSEL_PSEL_AnalogInput7 +BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_PSEL(0) != COMP_NRF_COMP_PSEL_AIN7); +#endif +#endif + +#ifndef COMP_PSEL_PSEL_VddDiv2 +BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_PSEL(0) != COMP_NRF_COMP_PSEL_VDD_DIV2); +#endif + +#ifndef COMP_PSEL_PSEL_VddhDiv5 +BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_PSEL(0) != COMP_NRF_COMP_PSEL_VDDH_DIV5); +#endif + +#ifndef COMP_MODE_SP_Normal +BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_SP_MODE(0) != COMP_NRF_COMP_SP_MODE_NORMAL); +#endif + +#if NRF_COMP_HAS_ISOURCE +#ifndef COMP_ISOURCE_ISOURCE_Ien2uA5 +BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_ISOURCE(0) != COMP_NRF_COMP_ISOURCE_2UA5); +#endif + +#ifndef COMP_ISOURCE_ISOURCE_Ien5uA +BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_ISOURCE(0) != COMP_NRF_COMP_ISOURCE_5UA); +#endif + +#ifndef COMP_ISOURCE_ISOURCE_Ien10uA +BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_ISOURCE(0) != COMP_NRF_COMP_ISOURCE_10UA); +#endif +#endif + +#if SHIM_NRF_COMP_DT_INST_REFSEL_IS_AREF(0) +#ifndef COMP_EXTREFSEL_EXTREFSEL_AnalogReference4 +BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_EXTREFSEL(0) != COMP_NRF_COMP_EXTREFSEL_AIN4); +#endif + +#ifndef COMP_EXTREFSEL_EXTREFSEL_AnalogReference5 +BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_EXTREFSEL(0) != COMP_NRF_COMP_EXTREFSEL_AIN5); +#endif + +#ifndef COMP_EXTREFSEL_EXTREFSEL_AnalogReference6 +BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_EXTREFSEL(0) != COMP_NRF_COMP_EXTREFSEL_AIN6); +#endif + +#ifndef COMP_EXTREFSEL_EXTREFSEL_AnalogReference7 +BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_EXTREFSEL(0) != COMP_NRF_COMP_EXTREFSEL_AIN7); +#endif +#endif + +#if SHIM_NRF_COMP_DT_INST_MAIN_MODE_IS_SE(0) +#ifndef COMP_REFSEL_REFSEL_Int1V8 +BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_REFSEL(0) != COMP_NRF_COMP_REFSEL_INT_1V8); +#endif + +#ifndef COMP_REFSEL_REFSEL_Int2V4 +BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_REFSEL(0) != COMP_NRF_COMP_REFSEL_INT_2V4); +#endif + +#ifndef COMP_REFSEL_REFSEL_AVDDAO1V8 +BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_REFSEL(0) != COMP_NRF_COMP_REFSEL_AVDDAO1V8); +#endif + +#ifndef COMP_REFSEL_REFSEL_VDD +BUILD_ASSERT(SHIM_NRF_COMP_DT_INST_REFSEL(0) != COMP_NRF_COMP_REFSEL_VDD); +#endif +#endif + +#if SHIM_NRF_COMP_DT_INST_MAIN_MODE_IS_DIFF(0) +#if SHIM_NRF_COMP_DT_INST_ENABLE_HYST(0) +BUILD_ASSERT(NRF_COMP_HAS_HYST); +#endif +#endif + +#if SHIM_NRF_COMP_DT_INST_MAIN_MODE_IS_SE(0) +static const struct comp_nrf_comp_se_config shim_nrf_comp_config0 = { + .psel = SHIM_NRF_COMP_DT_INST_PSEL(0), + .sp_mode = SHIM_NRF_COMP_DT_INST_SP_MODE(0), + .isource = SHIM_NRF_COMP_DT_INST_ISOURCE(0), +#if SHIM_NRF_COMP_DT_INST_REFSEL_IS_AREF(0) + .extrefsel = SHIM_NRF_COMP_DT_INST_EXTREFSEL(0), +#endif + .refsel = SHIM_NRF_COMP_DT_INST_REFSEL(0), + .th_down = SHIM_NRF_COMP_DT_INST_TH_DOWN(0), + .th_up = SHIM_NRF_COMP_DT_INST_TH_UP(0), +}; +#else +static const struct comp_nrf_comp_diff_config shim_nrf_comp_config0 = { + .psel = SHIM_NRF_COMP_DT_INST_PSEL(0), + .sp_mode = SHIM_NRF_COMP_DT_INST_SP_MODE(0), + .isource = SHIM_NRF_COMP_DT_INST_ISOURCE(0), + .extrefsel = SHIM_NRF_COMP_DT_INST_EXTREFSEL(0), + .enable_hyst = SHIM_NRF_COMP_DT_INST_ENABLE_HYST(0), +}; +#endif + +static struct shim_nrf_comp_data shim_nrf_comp_data0; + +#if CONFIG_PM_DEVICE +static bool shim_nrf_comp_is_resumed(void) +{ + enum pm_device_state state; + + (void)pm_device_state_get(DEVICE_DT_INST_GET(0), &state); + return state == PM_DEVICE_STATE_ACTIVE; +} +#else +static bool shim_nrf_comp_is_resumed(void) +{ + return true; +} +#endif + +static void shim_nrf_comp_start(void) +{ + if (shim_nrf_comp_data0.started) { + return; + } + + nrfx_comp_start(shim_nrf_comp_data0.event_mask, 0); + shim_nrf_comp_data0.started = true; +} + +static void shim_nrf_comp_stop(void) +{ + if (!shim_nrf_comp_data0.started) { + return; + } + + nrfx_comp_stop(); + shim_nrf_comp_data0.started = false; +} + +static int shim_nrf_comp_pm_callback(const struct device *dev, enum pm_device_action action) +{ + ARG_UNUSED(dev); + + switch (action) { + case PM_DEVICE_ACTION_RESUME: + shim_nrf_comp_start(); + break; + +#if CONFIG_PM_DEVICE + case PM_DEVICE_ACTION_SUSPEND: + shim_nrf_comp_stop(); + break; +#endif + + default: + return -ENOTSUP; + } + + return 0; +} + +#if (NRF_COMP_HAS_AIN_AS_PIN) +static int shim_nrf_comp_psel_to_nrf(enum comp_nrf_comp_psel shim, + nrf_comp_input_t *nrf) +{ + if (shim >= ARRAY_SIZE(shim_nrf_comp_ain_map)) { + return -EINVAL; + } + + *nrf = shim_nrf_comp_ain_map[(uint32_t)shim]; + return 0; +} +#else +static int shim_nrf_comp_psel_to_nrf(enum comp_nrf_comp_psel shim, + nrf_comp_input_t *nrf) +{ + switch (shim) { + case COMP_NRF_COMP_PSEL_AIN0: + *nrf = NRF_COMP_INPUT_0; + break; + + case COMP_NRF_COMP_PSEL_AIN1: + *nrf = NRF_COMP_INPUT_1; + break; + + case COMP_NRF_COMP_PSEL_AIN2: + *nrf = NRF_COMP_INPUT_2; + break; + + case COMP_NRF_COMP_PSEL_AIN3: + *nrf = NRF_COMP_INPUT_3; + break; + +#if defined(COMP_PSEL_PSEL_AnalogInput4) + case COMP_NRF_COMP_PSEL_AIN4: + *nrf = NRF_COMP_INPUT_4; + break; +#endif + +#if defined(COMP_PSEL_PSEL_AnalogInput5) + case COMP_NRF_COMP_PSEL_AIN5: + *nrf = NRF_COMP_INPUT_5; + break; +#endif + +#if defined(COMP_PSEL_PSEL_AnalogInput6) + case COMP_NRF_COMP_PSEL_AIN6: + *nrf = NRF_COMP_INPUT_6; + break; +#endif + +#if defined(COMP_PSEL_PSEL_AnalogInput7) + case COMP_NRF_COMP_PSEL_AIN7: + *nrf = NRF_COMP_INPUT_7; + break; +#endif + +#if defined(COMP_PSEL_PSEL_VddDiv2) + case COMP_NRF_COMP_PSEL_VDD_DIV2: + *nrf = NRF_COMP_VDD_DIV2; + break; +#endif + +#if defined(COMP_PSEL_PSEL_VddhDiv5) + case COMP_NRF_COMP_PSEL_VDDH_DIV5: + *nrf = NRF_COMP_VDDH_DIV5; + break; +#endif + + default: + return -EINVAL; + } + + return 0; +} +#endif + +static int shim_nrf_comp_sp_mode_to_nrf(enum comp_nrf_comp_sp_mode shim, + nrf_comp_sp_mode_t *nrf) +{ + switch (shim) { + case COMP_NRF_COMP_SP_MODE_LOW: + *nrf = NRF_COMP_SP_MODE_LOW; + break; + +#if defined(COMP_MODE_SP_Normal) + case COMP_NRF_COMP_SP_MODE_NORMAL: + *nrf = NRF_COMP_SP_MODE_NORMAL; + break; +#endif + + case COMP_NRF_COMP_SP_MODE_HIGH: + *nrf = NRF_COMP_SP_MODE_HIGH; + break; + + default: + return -EINVAL; + } + + return 0; +} + +#if NRF_COMP_HAS_ISOURCE +static int shim_nrf_comp_isource_to_nrf(enum comp_nrf_comp_isource shim, + nrf_isource_t *nrf) +{ + switch (shim) { + case COMP_NRF_COMP_ISOURCE_DISABLED: + *nrf = NRF_COMP_ISOURCE_OFF; + break; + +#if defined(COMP_ISOURCE_ISOURCE_Ien2uA5) + case COMP_NRF_COMP_ISOURCE_2UA5: + *nrf = NRF_COMP_ISOURCE_IEN_2UA5; + break; +#endif + +#if defined(COMP_ISOURCE_ISOURCE_Ien5uA) + case COMP_NRF_COMP_ISOURCE_5UA: + *nrf = NRF_COMP_ISOURCE_IEN_5UA; + break; +#endif + +#if defined(COMP_ISOURCE_ISOURCE_Ien10uA) + case COMP_NRF_COMP_ISOURCE_10UA: + *nrf = NRF_COMP_ISOURCE_IEN_10UA; + break; +#endif + + default: + return -EINVAL; + } + + return 0; +} +#endif + +#if (NRF_COMP_HAS_AIN_AS_PIN) +static int shim_nrf_comp_extrefsel_to_nrf(enum comp_nrf_comp_extrefsel shim, + nrf_comp_ext_ref_t *nrf) +{ + if (shim >= ARRAY_SIZE(shim_nrf_comp_ain_map)) { + return -EINVAL; + } + + *nrf = shim_nrf_comp_ain_map[(uint32_t)shim]; + return 0; +} +#else +static int shim_nrf_comp_extrefsel_to_nrf(enum comp_nrf_comp_extrefsel shim, + nrf_comp_ext_ref_t *nrf) +{ + switch (shim) { + case COMP_NRF_COMP_EXTREFSEL_AIN0: + *nrf = NRF_COMP_EXT_REF_0; + break; + + case COMP_NRF_COMP_EXTREFSEL_AIN1: + *nrf = NRF_COMP_EXT_REF_1; + break; + + case COMP_NRF_COMP_EXTREFSEL_AIN2: + *nrf = NRF_COMP_EXT_REF_2; + break; + + case COMP_NRF_COMP_EXTREFSEL_AIN3: + *nrf = NRF_COMP_EXT_REF_3; + break; + +#if defined(COMP_EXTREFSEL_EXTREFSEL_AnalogReference4) + case COMP_NRF_COMP_EXTREFSEL_AIN4: + *nrf = NRF_COMP_EXT_REF_4; + break; +#endif + +#if defined(COMP_EXTREFSEL_EXTREFSEL_AnalogReference5) + case COMP_NRF_COMP_EXTREFSEL_AIN5: + *nrf = NRF_COMP_EXT_REF_5; + break; +#endif + +#if defined(COMP_EXTREFSEL_EXTREFSEL_AnalogReference6) + case COMP_NRF_COMP_EXTREFSEL_AIN6: + *nrf = NRF_COMP_EXT_REF_6; + break; +#endif + +#if defined(COMP_EXTREFSEL_EXTREFSEL_AnalogReference7) + case COMP_NRF_COMP_EXTREFSEL_AIN7: + *nrf = NRF_COMP_EXT_REF_7; + break; +#endif + + default: + return -EINVAL; + } + + return 0; +} +#endif + +static int shim_nrf_comp_refsel_to_nrf(enum comp_nrf_comp_refsel shim, + nrf_comp_ref_t *nrf) +{ + switch (shim) { + case COMP_NRF_COMP_REFSEL_INT_1V2: + *nrf = NRF_COMP_REF_INT_1V2; + break; + +#if defined(COMP_REFSEL_REFSEL_Int1V8) + case COMP_NRF_COMP_REFSEL_INT_1V8: + *nrf = NRF_COMP_REF_INT_1V8; + break; +#endif + +#if defined(COMP_REFSEL_REFSEL_Int2V4) + case COMP_NRF_COMP_REFSEL_INT_2V4: + *nrf = NRF_COMP_REF_INT_2V4; + break; +#endif + +#if defined(COMP_REFSEL_REFSEL_AVDDAO1V8) + case COMP_NRF_COMP_REFSEL_AVDDAO1V8: + *nrf = NRF_COMP_REF_AVDDAO1V8; + break; +#endif + +#if defined(COMP_REFSEL_REFSEL_VDD) + case COMP_NRF_COMP_REFSEL_VDD: + *nrf = NRF_COMP_REF_VDD; + break; +#endif + + case COMP_NRF_COMP_REFSEL_AREF: + *nrf = NRF_COMP_REF_AREF; + break; + + default: + return -EINVAL; + } + + return 0; +} + +static int shim_nrf_comp_se_config_to_nrf(const struct comp_nrf_comp_se_config *shim, + nrfx_comp_config_t *nrf) +{ + if (shim_nrf_comp_refsel_to_nrf(shim->refsel, &nrf->reference)) { + return -EINVAL; + } + + if (shim_nrf_comp_extrefsel_to_nrf(shim->extrefsel, &nrf->ext_ref)) { + return -EINVAL; + } + + nrf->main_mode = NRF_COMP_MAIN_MODE_SE; + + if (shim->th_down > 63 || shim->th_up > 63) { + return -EINVAL; + } + + nrf->threshold.th_down = shim->th_down; + nrf->threshold.th_up = shim->th_up; + + if (shim_nrf_comp_sp_mode_to_nrf(shim->sp_mode, &nrf->speed_mode)) { + return -EINVAL; + } + + nrf->hyst = NRF_COMP_HYST_NO_HYST; + +#if NRF_COMP_HAS_ISOURCE + if (shim_nrf_comp_isource_to_nrf(shim->isource, &nrf->isource)) { + return -EINVAL; + } +#else + if (shim->isource != COMP_NRF_COMP_ISOURCE_DISABLED) { + return -EINVAL; + } +#endif + + if (shim_nrf_comp_psel_to_nrf(shim->psel, &nrf->input)) { + return -EINVAL; + } + + nrf->interrupt_priority = 0; + return 0; +} + +static int shim_nrf_comp_diff_config_to_nrf(const struct comp_nrf_comp_diff_config *shim, + nrfx_comp_config_t *nrf) +{ + nrf->reference = NRF_COMP_REF_AREF; + + if (shim_nrf_comp_extrefsel_to_nrf(shim->extrefsel, &nrf->ext_ref)) { + return -EINVAL; + } + + nrf->main_mode = NRF_COMP_MAIN_MODE_DIFF; + nrf->threshold.th_down = 0; + nrf->threshold.th_up = 0; + + if (shim_nrf_comp_sp_mode_to_nrf(shim->sp_mode, &nrf->speed_mode)) { + return -EINVAL; + } + +#if NRF_COMP_HAS_HYST + if (shim->enable_hyst) { + nrf->hyst = NRF_COMP_HYST_ENABLED; + } else { + nrf->hyst = NRF_COMP_HYST_DISABLED; + } +#else + if (shim->enable_hyst) { + return -EINVAL; + } +#endif + +#if NRF_COMP_HAS_ISOURCE + if (shim_nrf_comp_isource_to_nrf(shim->isource, &nrf->isource)) { + return -EINVAL; + } +#else + if (shim->isource != COMP_NRF_COMP_ISOURCE_DISABLED) { + return -EINVAL; + } +#endif + + if (shim_nrf_comp_psel_to_nrf(shim->psel, &nrf->input)) { + return -EINVAL; + } + + nrf->interrupt_priority = 0; + return 0; +} + +static int shim_nrf_comp_get_output(const struct device *dev) +{ + ARG_UNUSED(dev); + + return nrfx_comp_sample(); +} + +static int shim_nrf_comp_set_trigger(const struct device *dev, + enum comparator_trigger trigger) +{ + shim_nrf_comp_stop(); + + switch (trigger) { + case COMPARATOR_TRIGGER_NONE: + shim_nrf_comp_data0.event_mask = 0; + break; + + case COMPARATOR_TRIGGER_RISING_EDGE: + shim_nrf_comp_data0.event_mask = NRF_COMP_INT_UP_MASK; + break; + + case COMPARATOR_TRIGGER_FALLING_EDGE: + shim_nrf_comp_data0.event_mask = NRF_COMP_INT_DOWN_MASK; + break; + + case COMPARATOR_TRIGGER_BOTH_EDGES: + shim_nrf_comp_data0.event_mask = NRF_COMP_INT_CROSS_MASK; + break; + } + + if (shim_nrf_comp_is_resumed()) { + shim_nrf_comp_start(); + } + + return 0; +} + +static int shim_nrf_comp_set_trigger_callback(const struct device *dev, + comparator_callback_t callback, + void *user_data) +{ + shim_nrf_comp_stop(); + + shim_nrf_comp_data0.callback = callback; + shim_nrf_comp_data0.user_data = user_data; + + if (callback != NULL && atomic_test_and_clear_bit(&shim_nrf_comp_data0.triggered, 0)) { + callback(dev, user_data); + } + + if (shim_nrf_comp_is_resumed()) { + shim_nrf_comp_start(); + } + + return 0; +} + +static int shim_nrf_comp_trigger_is_pending(const struct device *dev) +{ + ARG_UNUSED(dev); + + return atomic_test_and_clear_bit(&shim_nrf_comp_data0.triggered, 0); +} + +static const struct comparator_driver_api shim_nrf_comp_api = { + .get_output = shim_nrf_comp_get_output, + .set_trigger = shim_nrf_comp_set_trigger, + .set_trigger_callback = shim_nrf_comp_set_trigger_callback, + .trigger_is_pending = shim_nrf_comp_trigger_is_pending, +}; + +static int shim_nrf_comp_reconfigure(const nrfx_comp_config_t *nrf) +{ + shim_nrf_comp_stop(); + + (void)nrfx_comp_reconfigure(nrf); + + if (shim_nrf_comp_is_resumed()) { + shim_nrf_comp_start(); + } + + return 0; +} + +int comp_nrf_comp_configure_se(const struct device *dev, + const struct comp_nrf_comp_se_config *config) +{ + nrfx_comp_config_t nrf = {}; + + ARG_UNUSED(dev); + + if (shim_nrf_comp_se_config_to_nrf(config, &nrf)) { + return -EINVAL; + } + + return shim_nrf_comp_reconfigure(&nrf); +} + +int comp_nrf_comp_configure_diff(const struct device *dev, + const struct comp_nrf_comp_diff_config *config) +{ + nrfx_comp_config_t nrf = {}; + + ARG_UNUSED(dev); + + if (shim_nrf_comp_diff_config_to_nrf(config, &nrf)) { + return -EINVAL; + } + + return shim_nrf_comp_reconfigure(&nrf); +} + +static void shim_nrf_comp_event_handler(nrf_comp_event_t event) +{ + ARG_UNUSED(event); + + if (shim_nrf_comp_data0.callback == NULL) { + atomic_set_bit(&shim_nrf_comp_data0.triggered, 0); + return; + } + + shim_nrf_comp_data0.callback(DEVICE_DT_INST_GET(0), shim_nrf_comp_data0.user_data); + atomic_clear_bit(&shim_nrf_comp_data0.triggered, 0); +} + +static int shim_nrf_comp_init(const struct device *dev) +{ + nrfx_comp_config_t nrf = {}; + + IRQ_CONNECT(DT_INST_IRQN(0), + DT_INST_IRQ(0, priority), + nrfx_isr, + nrfx_comp_irq_handler, + 0); + + irq_enable(DT_INST_IRQN(0)); + +#if SHIM_NRF_COMP_DT_INST_MAIN_MODE_IS_SE(0) + (void)shim_nrf_comp_se_config_to_nrf(&shim_nrf_comp_config0, &nrf); +#else + (void)shim_nrf_comp_diff_config_to_nrf(&shim_nrf_comp_config0, &nrf); +#endif + + if (nrfx_comp_init(&nrf, shim_nrf_comp_event_handler) != NRFX_SUCCESS) { + return -ENODEV; + } + + return pm_device_driver_init(dev, shim_nrf_comp_pm_callback); +} + +PM_DEVICE_DT_INST_DEFINE(0, shim_nrf_comp_pm_callback); + +DEVICE_DT_INST_DEFINE(0, + shim_nrf_comp_init, + PM_DEVICE_DT_INST_GET(0), + NULL, + NULL, + POST_KERNEL, + CONFIG_COMPARATOR_INIT_PRIORITY, + &shim_nrf_comp_api); diff --git a/dts/bindings/comparator/nordic,nrf-comp.yaml b/dts/bindings/comparator/nordic,nrf-comp.yaml new file mode 100644 index 0000000000000..a6f7f32db5fc7 --- /dev/null +++ b/dts/bindings/comparator/nordic,nrf-comp.yaml @@ -0,0 +1,128 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: | + Nordic nRF COMP (analog COMParator) + + This comparator has varying configurations which require varying + properties be set in the devicetree. + + The following example displays the minimum node layout: + + comp: comp@deadbeef { + compatible = "nordic,nrf-comp"; + reg = <0xdeadbeef 0x1000>; + interrupts = <0 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + Enabling the comparator node requires setting the default + configuration of the comparator. + + The following example displays enabling the comparator in + single-ended mode, selecting an internal reference: + + &comp { + status = "okay"; + main-mode = "SE"; + psel = "AIN0"; + refsel = "INT_1V2"; + sp-mode = "NORMAL"; + th-up = <36>; + th-down = <30>; + isource = "OFF"; + }; + + To select an external reference, select the "AREF" + reference and add the external reference: + + &comp { + ... + refsel = "AREF"; + extrefsel = "AIN1"; + ... + }; + + The following example displays enabling the comparator + in differential mode: + + &comp { + status = "okay"; + main-mode = "DIFF"; + psel = "AIN0"; + extrefsel = "AIN1"; + sp-mode = "NORMAL"; + hyst = "50MV"; + isource = "OFF"; + }; + +compatible: "nordic,nrf-comp" + +include: base.yaml + +properties: + main-mode: + type: string + enum: + - "SE" + - "DIFF" + + psel: + type: string + enum: + - "AIN0" + - "AIN1" + - "AIN2" + - "AIN3" + - "AIN4" + - "AIN5" + - "AIN6" + - "AIN7" + - "VDD_DIV2" + - "VDDH_DIV5" + + extrefsel: + type: string + enum: + - "AIN0" + - "AIN1" + - "AIN2" + - "AIN3" + - "AIN4" + - "AIN5" + - "AIN6" + - "AIN7" + + refsel: + type: string + enum: + - "INT_1V2" + - "INT_1V8" + - "INT_2V4" + - "AVDDAO1V8" + - "VDD" + - "AREF" + + enable-hyst: + type: boolean + + sp-mode: + type: string + enum: + - "LOW" + - "NORMAL" + - "HIGH" + + th-up: + type: int + + th-down: + type: int + + isource: + type: string + enum: + - "DISABLED" + - "2UA5" + - "5UA" + - "10UA" diff --git a/dts/bindings/sensor/nordic,nrf-comp.yaml b/dts/bindings/sensor/nordic,nrf-comp.yaml deleted file mode 100644 index cc964015ba180..0000000000000 --- a/dts/bindings/sensor/nordic,nrf-comp.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2022, Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic nRF family COMP (Comparator) - -compatible: "nordic,nrf-comp" - -include: base.yaml - -properties: - reg: - required: true - - interrupts: - required: true - - "#io-channel-cells": - type: int - const: 1 - required: true - -io-channel-cells: - - input diff --git a/include/zephyr/drivers/comparator/nrf_comp.h b/include/zephyr/drivers/comparator/nrf_comp.h new file mode 100644 index 0000000000000..59e1cbbb3ce9d --- /dev/null +++ b/include/zephyr/drivers/comparator/nrf_comp.h @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_DRIVERS_COMP_NRF_COMP_H_ +#define ZEPHYR_INCLUDE_DRIVERS_COMP_NRF_COMP_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Positive input selection */ +enum comp_nrf_comp_psel { + /** AIN0 external input */ + COMP_NRF_COMP_PSEL_AIN0, + /** AIN1 external input */ + COMP_NRF_COMP_PSEL_AIN1, + /** AIN2 external input */ + COMP_NRF_COMP_PSEL_AIN2, + /** AIN3 external input */ + COMP_NRF_COMP_PSEL_AIN3, + /** AIN4 external input */ + COMP_NRF_COMP_PSEL_AIN4, + /** AIN5 external input */ + COMP_NRF_COMP_PSEL_AIN5, + /** AIN6 external input */ + COMP_NRF_COMP_PSEL_AIN6, + /** AIN7 external input */ + COMP_NRF_COMP_PSEL_AIN7, + /** VDD / 2 */ + COMP_NRF_COMP_PSEL_VDD_DIV2, + /** VDDH / 5 */ + COMP_NRF_COMP_PSEL_VDDH_DIV5, +}; + +/** External reference selection */ +enum comp_nrf_comp_extrefsel { + /** AIN0 external input */ + COMP_NRF_COMP_EXTREFSEL_AIN0, + /** AIN1 external input */ + COMP_NRF_COMP_EXTREFSEL_AIN1, + /** AIN2 external input */ + COMP_NRF_COMP_EXTREFSEL_AIN2, + /** AIN3 external input */ + COMP_NRF_COMP_EXTREFSEL_AIN3, + /** AIN4 external input */ + COMP_NRF_COMP_EXTREFSEL_AIN4, + /** AIN5 external input */ + COMP_NRF_COMP_EXTREFSEL_AIN5, + /** AIN6 external input */ + COMP_NRF_COMP_EXTREFSEL_AIN6, + /** AIN7 external input */ + COMP_NRF_COMP_EXTREFSEL_AIN7, +}; + +/** Reference selection */ +enum comp_nrf_comp_refsel { + /** Internal 1.2V reference */ + COMP_NRF_COMP_REFSEL_INT_1V2, + /** Internal 1.8V reference */ + COMP_NRF_COMP_REFSEL_INT_1V8, + /** Internal 2.4V reference */ + COMP_NRF_COMP_REFSEL_INT_2V4, + /** AVDD 1.8V reference */ + COMP_NRF_COMP_REFSEL_AVDDAO1V8, + /** VDD reference */ + COMP_NRF_COMP_REFSEL_VDD, + /** Use external analog reference */ + COMP_NRF_COMP_REFSEL_AREF, +}; + +/** Speed mode selection */ +enum comp_nrf_comp_sp_mode { + /** Low-power mode */ + COMP_NRF_COMP_SP_MODE_LOW, + /** Normal mode */ + COMP_NRF_COMP_SP_MODE_NORMAL, + /** High-speed mode */ + COMP_NRF_COMP_SP_MODE_HIGH, +}; + +/** Current source configuration */ +enum comp_nrf_comp_isource { + /** Current source disabled */ + COMP_NRF_COMP_ISOURCE_DISABLED, + /** 2.5uA current source enabled */ + COMP_NRF_COMP_ISOURCE_2UA5, + /** 5uA current source enabled */ + COMP_NRF_COMP_ISOURCE_5UA, + /** 10uA current source enabled */ + COMP_NRF_COMP_ISOURCE_10UA, +}; + +/** + * @brief Single-ended mode configuration structure + * + * @note extrefsel is only used if refsel == COMP_NRF_COMP_REFSEL_AREF + * @note Hysteresis down in volts = ((th_down + 1) / 64) * ref + * @note Hysteresis up in volts = ((th_up + 1) / 64) * ref + */ +struct comp_nrf_comp_se_config { + /** Positive input selection */ + enum comp_nrf_comp_psel psel; + /** Speed mode selection */ + enum comp_nrf_comp_sp_mode sp_mode; + /** Current source configuration */ + enum comp_nrf_comp_isource isource; + /** External reference selection */ + enum comp_nrf_comp_extrefsel extrefsel; + /** Reference selection */ + enum comp_nrf_comp_refsel refsel; + /** Hysteresis down threshold configuration */ + uint8_t th_down; + /** Hysteresis up threshold configuration */ + uint8_t th_up; +}; + +/** + * @brief Configure comparator in single-ended mode + * + * @param dev Comparator device instance + * @param config Single-ended mode configuration + * + * @retval 0 if successful + * @retval negative errno-code otherwise + */ +int comp_nrf_comp_configure_se(const struct device *dev, + const struct comp_nrf_comp_se_config *config); + +/** Differential mode configuration structure */ +struct comp_nrf_comp_diff_config { + /** Positive input selection */ + enum comp_nrf_comp_psel psel; + /** Speed mode selection */ + enum comp_nrf_comp_sp_mode sp_mode; + /** Current source configuration */ + enum comp_nrf_comp_isource isource; + /** Negative input selection */ + enum comp_nrf_comp_extrefsel extrefsel; + /** Hysteresis configuration */ + bool enable_hyst; +}; + +/** + * @brief Configure comparator in differential mode + * + * @param dev Comparator device instance + * @param config Differential mode configuration + * + * @retval 0 if successful + * @retval negative errno-code otherwise + */ +int comp_nrf_comp_configure_diff(const struct device *dev, + const struct comp_nrf_comp_diff_config *config); + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_DRIVERS_COMP_NRF_COMP_H_ */ From 13af5ca0dc86dc88f0ad448be26ba556af2bcefe Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 4 Sep 2024 11:22:29 +0200 Subject: [PATCH 0607/4482] tests: drivers: build_all: add comparator test suite Add comparator build_all test suite designed to test multiple devicetree overlays and boards for each comparator device driver. Signed-off-by: Bjarki Arge Andreasen --- .../build_all/comparator/CMakeLists.txt | 8 ++++ .../comparator/nrf_comp/diff.overlay | 14 ++++++ .../build_all/comparator/nrf_comp/se.overlay | 16 +++++++ .../comparator/nrf_comp/se_aref.overlay | 17 +++++++ tests/drivers/build_all/comparator/prj.conf | 6 +++ tests/drivers/build_all/comparator/src/main.c | 10 ++++ .../build_all/comparator/testcase.yaml | 48 +++++++++++++++++++ 7 files changed, 119 insertions(+) create mode 100644 tests/drivers/build_all/comparator/CMakeLists.txt create mode 100644 tests/drivers/build_all/comparator/nrf_comp/diff.overlay create mode 100644 tests/drivers/build_all/comparator/nrf_comp/se.overlay create mode 100644 tests/drivers/build_all/comparator/nrf_comp/se_aref.overlay create mode 100644 tests/drivers/build_all/comparator/prj.conf create mode 100644 tests/drivers/build_all/comparator/src/main.c create mode 100644 tests/drivers/build_all/comparator/testcase.yaml diff --git a/tests/drivers/build_all/comparator/CMakeLists.txt b/tests/drivers/build_all/comparator/CMakeLists.txt new file mode 100644 index 0000000000000..edb50bd78e507 --- /dev/null +++ b/tests/drivers/build_all/comparator/CMakeLists.txt @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(build_all_comparator) + +target_sources(app PRIVATE src/main.c) diff --git a/tests/drivers/build_all/comparator/nrf_comp/diff.overlay b/tests/drivers/build_all/comparator/nrf_comp/diff.overlay new file mode 100644 index 0000000000000..8b8e9a02c2b10 --- /dev/null +++ b/tests/drivers/build_all/comparator/nrf_comp/diff.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&comp { + main-mode = "DIFF"; + psel = "AIN0"; + extrefsel = "AIN1"; + sp-mode = "HIGH"; + isource = "DISABLED"; + status = "okay"; +}; diff --git a/tests/drivers/build_all/comparator/nrf_comp/se.overlay b/tests/drivers/build_all/comparator/nrf_comp/se.overlay new file mode 100644 index 0000000000000..e4eb56f61a92e --- /dev/null +++ b/tests/drivers/build_all/comparator/nrf_comp/se.overlay @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&comp { + main-mode = "SE"; + psel = "AIN0"; + refsel = "INT_1V2"; + sp-mode = "HIGH"; + th-up = <36>; + th-down = <28>; + isource = "DISABLED"; + status = "okay"; +}; diff --git a/tests/drivers/build_all/comparator/nrf_comp/se_aref.overlay b/tests/drivers/build_all/comparator/nrf_comp/se_aref.overlay new file mode 100644 index 0000000000000..0d36a3e40b407 --- /dev/null +++ b/tests/drivers/build_all/comparator/nrf_comp/se_aref.overlay @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&comp { + main-mode = "SE"; + psel = "AIN0"; + extrefsel = "AIN1"; + refsel = "AREF"; + sp-mode = "HIGH"; + th-up = <36>; + th-down = <28>; + isource = "DISABLED"; + status = "okay"; +}; diff --git a/tests/drivers/build_all/comparator/prj.conf b/tests/drivers/build_all/comparator/prj.conf new file mode 100644 index 0000000000000..9e78e0bbe5342 --- /dev/null +++ b/tests/drivers/build_all/comparator/prj.conf @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_TEST=y +CONFIG_TEST_USERSPACE=y +CONFIG_COMPARATOR=y diff --git a/tests/drivers/build_all/comparator/src/main.c b/tests/drivers/build_all/comparator/src/main.c new file mode 100644 index 0000000000000..a05ee59143061 --- /dev/null +++ b/tests/drivers/build_all/comparator/src/main.c @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +int main(void) +{ + return 0; +} diff --git a/tests/drivers/build_all/comparator/testcase.yaml b/tests/drivers/build_all/comparator/testcase.yaml new file mode 100644 index 0000000000000..9c94ef9a69eb0 --- /dev/null +++ b/tests/drivers/build_all/comparator/testcase.yaml @@ -0,0 +1,48 @@ +common: + build_only: true + tags: + - drivers + - comparator +tests: + drivers.build_all.comparator.nrf_comp.diff: + extra_args: + - DTC_OVERLAY_FILE="nrf_comp/diff.overlay" + platform_allow: + - nrf52dk/nrf52810 + - nrf52dk/nrf52832 + - nrf52833dk/nrf52820 + - nrf52833dk/nrf52833 + - nrf52840dk/nrf52811 + - nrf52840dk/nrf52840 + - nrf5340dk/nrf5340/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf9280pdk/nrf9280/cpuapp + drivers.build_all.comparator.nrf_comp.se_aref: + extra_args: + - DTC_OVERLAY_FILE="nrf_comp/se_aref.overlay" + platform_allow: + - nrf52dk/nrf52810 + - nrf52dk/nrf52832 + - nrf52833dk/nrf52820 + - nrf52833dk/nrf52833 + - nrf52840dk/nrf52811 + - nrf52840dk/nrf52840 + - nrf5340dk/nrf5340/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf9280pdk/nrf9280/cpuapp + drivers.build_all.comparator.nrf_comp.se: + extra_args: + - DTC_OVERLAY_FILE="nrf_comp/se.overlay" + platform_allow: + - nrf52dk/nrf52810 + - nrf52dk/nrf52832 + - nrf52833dk/nrf52820 + - nrf52833dk/nrf52833 + - nrf52840dk/nrf52811 + - nrf52840dk/nrf52840 + - nrf5340dk/nrf5340/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf9280pdk/nrf9280/cpuapp From 04e70ab96c54a7413fd300ad599b44c8a7b8f91f Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 2 Sep 2024 19:39:11 +0200 Subject: [PATCH 0608/4482] drivers: comparator: add nRF LPCOMP device driver Add nRF LPCOMP device driver. Signed-off-by: Bjarki Arge Andreasen --- drivers/comparator/CMakeLists.txt | 1 + drivers/comparator/Kconfig | 1 + drivers/comparator/Kconfig.nrf_lpcomp | 8 + drivers/comparator/comparator_nrf_lpcomp.c | 491 ++++++++++++++++++ .../comparator/nordic,nrf-lpcomp.yaml | 83 +++ dts/bindings/sensor/nordic,nrf-lpcomp.yaml | 23 - .../zephyr/drivers/comparator/nrf_lpcomp.h | 112 ++++ 7 files changed, 696 insertions(+), 23 deletions(-) create mode 100644 drivers/comparator/Kconfig.nrf_lpcomp create mode 100644 drivers/comparator/comparator_nrf_lpcomp.c create mode 100644 dts/bindings/comparator/nordic,nrf-lpcomp.yaml delete mode 100644 dts/bindings/sensor/nordic,nrf-lpcomp.yaml create mode 100644 include/zephyr/drivers/comparator/nrf_lpcomp.h diff --git a/drivers/comparator/CMakeLists.txt b/drivers/comparator/CMakeLists.txt index 20aa301af7d02..d0dc726bf58cb 100644 --- a/drivers/comparator/CMakeLists.txt +++ b/drivers/comparator/CMakeLists.txt @@ -7,3 +7,4 @@ zephyr_library() zephyr_library_sources_ifdef(CONFIG_USERSPACE comparator_handlers.c) zephyr_library_sources_ifdef(CONFIG_COMPARATOR_NRF_COMP comparator_nrf_comp.c) +zephyr_library_sources_ifdef(CONFIG_COMPARATOR_NRF_LPCOMP comparator_nrf_lpcomp.c) diff --git a/drivers/comparator/Kconfig b/drivers/comparator/Kconfig index 84ea5c74baa60..819936024b90a 100644 --- a/drivers/comparator/Kconfig +++ b/drivers/comparator/Kconfig @@ -19,5 +19,6 @@ config COMPARATOR_INIT_PRIORITY Comparator device driver initialization priority. rsource "Kconfig.nrf_comp" +rsource "Kconfig.nrf_lpcomp" endif # COMPARATOR diff --git a/drivers/comparator/Kconfig.nrf_lpcomp b/drivers/comparator/Kconfig.nrf_lpcomp new file mode 100644 index 0000000000000..f33de46f15d9a --- /dev/null +++ b/drivers/comparator/Kconfig.nrf_lpcomp @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config COMPARATOR_NRF_LPCOMP + bool "Nordic LPCOMP comparator driver" + default y + depends on DT_HAS_NORDIC_NRF_LPCOMP_ENABLED + select NRFX_LPCOMP diff --git a/drivers/comparator/comparator_nrf_lpcomp.c b/drivers/comparator/comparator_nrf_lpcomp.c new file mode 100644 index 0000000000000..6c6710d337d86 --- /dev/null +++ b/drivers/comparator/comparator_nrf_lpcomp.c @@ -0,0 +1,491 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include +#include + +#include + +#define DT_DRV_COMPAT nordic_nrf_lpcomp + +#define SHIM_NRF_LPCOMP_DT_INST_REFSEL(inst) \ + _CONCAT(COMP_NRF_LPCOMP_REFSEL_, DT_INST_STRING_TOKEN(inst, refsel)) + +#define SHIM_NRF_LPCOMP_DT_INST_REFSEL_IS_AREF(inst) \ + DT_INST_ENUM_HAS_VALUE(inst, refsel, AREF) + +#define SHIM_NRF_LPCOMP_DT_INST_EXTREFSEL(inst) \ + _CONCAT(COMP_NRF_LPCOMP_EXTREFSEL_, DT_INST_STRING_TOKEN(inst, extrefsel)) + +#define SHIM_NRF_LPCOMP_DT_INST_ENABLE_HYST(inst) \ + DT_INST_PROP(inst, enable_hyst) + +#define SHIM_NRF_LPCOMP_DT_INST_PSEL(inst) \ + _CONCAT(COMP_NRF_LPCOMP_PSEL_, DT_INST_STRING_TOKEN(inst, psel)) + +struct shim_nrf_lpcomp_data { + nrfx_lpcomp_config_t config; + uint32_t event_mask; + bool started; + atomic_t triggered; + comparator_callback_t callback; + void *user_data; +}; + +#if (NRF_LPCOMP_HAS_AIN_AS_PIN) +static const uint32_t shim_nrf_lpcomp_ain_map[] = { +#if defined(CONFIG_SOC_NRF54H20) || defined(CONFIG_SOC_NRF9280) + NRF_PIN_PORT_TO_PIN_NUMBER(0U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(1U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(2U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(3U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(6U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1), +#elif defined(CONFIG_SOC_NRF54L15) + NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(6U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(11U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(12U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(13U, 1), + NRF_PIN_PORT_TO_PIN_NUMBER(14U, 1), +#endif +}; +#endif + +#if (NRF_LPCOMP_HAS_AIN_AS_PIN) +BUILD_ASSERT(COMP_NRF_LPCOMP_PSEL_AIN0 == 0); +BUILD_ASSERT(COMP_NRF_LPCOMP_PSEL_AIN7 == 7); +BUILD_ASSERT(COMP_NRF_LPCOMP_EXTREFSEL_AIN0 == 0); +BUILD_ASSERT(COMP_NRF_LPCOMP_EXTREFSEL_AIN1 == 1); +#endif + +#if (LPCOMP_REFSEL_RESOLUTION == 8) +BUILD_ASSERT((SHIM_NRF_LPCOMP_DT_INST_REFSEL(0) < COMP_NRF_LPCOMP_REFSEL_VDD_1_16) || + (SHIM_NRF_LPCOMP_DT_INST_REFSEL(0) > COMP_NRF_LPCOMP_REFSEL_VDD_15_16)); +#endif + +#if SHIM_NRF_LPCOMP_DT_INST_ENABLE_HYST(0) +BUILD_ASSERT(NRF_LPCOMP_HAS_HYST); +#endif + +static struct shim_nrf_lpcomp_data shim_nrf_lpcomp_data0; + +static const struct comp_nrf_lpcomp_config shim_nrf_lpcomp_config0 = { + .psel = SHIM_NRF_LPCOMP_DT_INST_PSEL(0), +#if SHIM_NRF_LPCOMP_DT_INST_REFSEL_IS_AREF(0) + .extrefsel = SHIM_NRF_LPCOMP_DT_INST_EXTREFSEL(0), +#endif + .refsel = SHIM_NRF_LPCOMP_DT_INST_REFSEL(0), + .enable_hyst = SHIM_NRF_LPCOMP_DT_INST_ENABLE_HYST(0), +}; + +#if CONFIG_PM_DEVICE +static bool shim_nrf_lpcomp_is_resumed(void) +{ + enum pm_device_state state; + + (void)pm_device_state_get(DEVICE_DT_INST_GET(0), &state); + return state == PM_DEVICE_STATE_ACTIVE; +} +#else +static bool shim_nrf_lpcomp_is_resumed(void) +{ + return true; +} +#endif + +static void shim_nrf_lpcomp_start(void) +{ + if (shim_nrf_lpcomp_data0.started) { + return; + } + + nrfx_lpcomp_start(shim_nrf_lpcomp_data0.event_mask, 0); + shim_nrf_lpcomp_data0.started = true; +} + +static void shim_nrf_lpcomp_stop(void) +{ + if (!shim_nrf_lpcomp_data0.started) { + return; + } + + nrfx_lpcomp_stop(); + shim_nrf_lpcomp_data0.started = false; +} + +static int shim_nrf_lpcomp_pm_callback(const struct device *dev, enum pm_device_action action) +{ + ARG_UNUSED(dev); + + ARG_UNUSED(dev); + + switch (action) { + case PM_DEVICE_ACTION_RESUME: + shim_nrf_lpcomp_start(); + break; + +#if CONFIG_PM_DEVICE + case PM_DEVICE_ACTION_SUSPEND: + shim_nrf_lpcomp_stop(); + break; +#endif + + default: + return -ENOTSUP; + } + + return 0; +} + +#if (NRF_LPCOMP_HAS_AIN_AS_PIN) +static int shim_nrf_lpcomp_psel_to_nrf(enum comp_nrf_lpcomp_psel shim, + nrf_lpcomp_input_t *nrf) +{ + if (shim >= ARRAY_SIZE(shim_nrf_lpcomp_ain_map)) { + return -EINVAL; + } + + *nrf = shim_nrf_lpcomp_ain_map[(uint32_t)shim]; + return 0; +} +#else +static int shim_nrf_lpcomp_psel_to_nrf(enum comp_nrf_lpcomp_psel shim, + nrf_lpcomp_input_t *nrf) +{ + switch (shim) { + case COMP_NRF_LPCOMP_PSEL_AIN0: + *nrf = NRF_LPCOMP_INPUT_0; + break; + + case COMP_NRF_LPCOMP_PSEL_AIN1: + *nrf = NRF_LPCOMP_INPUT_1; + break; + + case COMP_NRF_LPCOMP_PSEL_AIN2: + *nrf = NRF_LPCOMP_INPUT_2; + break; + + case COMP_NRF_LPCOMP_PSEL_AIN3: + *nrf = NRF_LPCOMP_INPUT_3; + break; + + case COMP_NRF_LPCOMP_PSEL_AIN4: + *nrf = NRF_LPCOMP_INPUT_4; + break; + + case COMP_NRF_LPCOMP_PSEL_AIN5: + *nrf = NRF_LPCOMP_INPUT_5; + break; + + case COMP_NRF_LPCOMP_PSEL_AIN6: + *nrf = NRF_LPCOMP_INPUT_6; + break; + + case COMP_NRF_LPCOMP_PSEL_AIN7: + *nrf = NRF_LPCOMP_INPUT_7; + break; + + default: + return -EINVAL; + } + + return 0; +} +#endif + +#if (NRF_LPCOMP_HAS_AIN_AS_PIN) +static int shim_nrf_lpcomp_extrefsel_to_nrf(enum comp_nrf_lpcomp_extrefsel shim, + nrf_lpcomp_ext_ref_t *nrf) +{ + if (shim >= ARRAY_SIZE(shim_nrf_lpcomp_ain_map)) { + return -EINVAL; + } + + *nrf = shim_nrf_lpcomp_ain_map[shim]; + return 0; +} +#else +static int shim_nrf_lpcomp_extrefsel_to_nrf(enum comp_nrf_lpcomp_extrefsel shim, + nrf_lpcomp_ext_ref_t *nrf) +{ + switch (shim) { + case COMP_NRF_LPCOMP_EXTREFSEL_AIN0: + *nrf = NRF_LPCOMP_EXT_REF_REF0; + break; + + case COMP_NRF_LPCOMP_EXTREFSEL_AIN1: + *nrf = NRF_LPCOMP_EXT_REF_REF1; + break; + + default: + return -EINVAL; + } + + return 0; +} +#endif + +static int shim_nrf_lpcomp_refsel_to_nrf(enum comp_nrf_lpcomp_refsel shim, + nrf_lpcomp_ref_t *nrf) +{ + switch (shim) { + case COMP_NRF_LPCOMP_REFSEL_VDD_1_8: + *nrf = NRF_LPCOMP_REF_SUPPLY_1_8; + break; + + case COMP_NRF_LPCOMP_REFSEL_VDD_2_8: + *nrf = NRF_LPCOMP_REF_SUPPLY_2_8; + break; + + case COMP_NRF_LPCOMP_REFSEL_VDD_3_8: + *nrf = NRF_LPCOMP_REF_SUPPLY_3_8; + break; + + case COMP_NRF_LPCOMP_REFSEL_VDD_4_8: + *nrf = NRF_LPCOMP_REF_SUPPLY_4_8; + break; + + case COMP_NRF_LPCOMP_REFSEL_VDD_5_8: + *nrf = NRF_LPCOMP_REF_SUPPLY_5_8; + break; + + case COMP_NRF_LPCOMP_REFSEL_VDD_6_8: + *nrf = NRF_LPCOMP_REF_SUPPLY_6_8; + break; + + case COMP_NRF_LPCOMP_REFSEL_VDD_7_8: + *nrf = NRF_LPCOMP_REF_SUPPLY_7_8; + break; + +#if (LPCOMP_REFSEL_RESOLUTION == 16) + case COMP_NRF_LPCOMP_REFSEL_VDD_1_16: + *nrf = NRF_LPCOMP_REF_SUPPLY_1_16; + break; + + case COMP_NRF_LPCOMP_REFSEL_VDD_3_16: + *nrf = NRF_LPCOMP_REF_SUPPLY_3_16; + break; + + case COMP_NRF_LPCOMP_REFSEL_VDD_5_16: + *nrf = NRF_LPCOMP_REF_SUPPLY_5_16; + break; + + case COMP_NRF_LPCOMP_REFSEL_VDD_7_16: + *nrf = NRF_LPCOMP_REF_SUPPLY_7_16; + break; + + case COMP_NRF_LPCOMP_REFSEL_VDD_9_16: + *nrf = NRF_LPCOMP_REF_SUPPLY_9_16; + break; + + case COMP_NRF_LPCOMP_REFSEL_VDD_11_16: + *nrf = NRF_LPCOMP_REF_SUPPLY_11_16; + break; + + case COMP_NRF_LPCOMP_REFSEL_VDD_13_16: + *nrf = NRF_LPCOMP_REF_SUPPLY_13_16; + break; + + case COMP_NRF_LPCOMP_REFSEL_VDD_15_16: + *nrf = NRF_LPCOMP_REF_SUPPLY_15_16; + break; +#endif + + case COMP_NRF_LPCOMP_REFSEL_AREF: + *nrf = NRF_LPCOMP_REF_EXT_REF; + break; + + default: + return -EINVAL; + } + + return 0; +} + +static int shim_nrf_lpcomp_config_to_nrf(const struct comp_nrf_lpcomp_config *shim, + nrfx_lpcomp_config_t *nrf) +{ + if (shim_nrf_lpcomp_refsel_to_nrf(shim->refsel, &nrf->reference)) { + return -EINVAL; + } + + if (shim_nrf_lpcomp_extrefsel_to_nrf(shim->extrefsel, &nrf->ext_ref)) { + return -EINVAL; + } + +#if NRF_LPCOMP_HAS_HYST + if (shim->enable_hyst) { + nrf->hyst = NRF_LPCOMP_HYST_ENABLED; + } else { + nrf->hyst = NRF_LPCOMP_HYST_NOHYST; + } +#else + if (shim->enable_hyst) { + return -EINVAL; + } +#endif + + if (shim_nrf_lpcomp_psel_to_nrf(shim->psel, &nrf->input)) { + return -EINVAL; + } + + return 0; +} + +static void shim_nrf_lpcomp_reconfigure(void) +{ + (void)nrfx_lpcomp_reconfigure(&shim_nrf_lpcomp_data0.config); +} + +static int shim_nrf_lpcomp_get_output(const struct device *dev) +{ + ARG_UNUSED(dev); + + return nrfx_lpcomp_sample(); +} + +static int shim_nrf_lpcomp_set_trigger(const struct device *dev, + enum comparator_trigger trigger) +{ + shim_nrf_lpcomp_stop(); + + switch (trigger) { + case COMPARATOR_TRIGGER_NONE: + shim_nrf_lpcomp_data0.event_mask = 0; + shim_nrf_lpcomp_data0.config.detection = NRF_LPCOMP_DETECT_CROSS; + break; + + case COMPARATOR_TRIGGER_RISING_EDGE: + shim_nrf_lpcomp_data0.event_mask = NRF_LPCOMP_INT_UP_MASK; + shim_nrf_lpcomp_data0.config.detection = NRF_LPCOMP_DETECT_UP; + break; + + case COMPARATOR_TRIGGER_FALLING_EDGE: + shim_nrf_lpcomp_data0.event_mask = NRF_LPCOMP_INT_DOWN_MASK; + shim_nrf_lpcomp_data0.config.detection = NRF_LPCOMP_DETECT_DOWN; + break; + + case COMPARATOR_TRIGGER_BOTH_EDGES: + shim_nrf_lpcomp_data0.event_mask = NRF_LPCOMP_INT_CROSS_MASK; + shim_nrf_lpcomp_data0.config.detection = NRF_LPCOMP_DETECT_CROSS; + break; + } + + shim_nrf_lpcomp_reconfigure(); + + if (shim_nrf_lpcomp_is_resumed()) { + shim_nrf_lpcomp_start(); + } + + return 0; +} + +static int shim_nrf_lpcomp_set_trigger_callback(const struct device *dev, + comparator_callback_t callback, + void *user_data) +{ + shim_nrf_lpcomp_stop(); + + shim_nrf_lpcomp_data0.callback = callback; + shim_nrf_lpcomp_data0.user_data = user_data; + + if (callback != NULL && atomic_test_and_clear_bit(&shim_nrf_lpcomp_data0.triggered, 0)) { + callback(dev, user_data); + } + + if (shim_nrf_lpcomp_is_resumed()) { + shim_nrf_lpcomp_start(); + } + + return 0; +} + +static int shim_nrf_lpcomp_trigger_is_pending(const struct device *dev) +{ + ARG_UNUSED(dev); + + return atomic_test_and_clear_bit(&shim_nrf_lpcomp_data0.triggered, 0); +} + +static const struct comparator_driver_api shim_nrf_lpcomp_api = { + .get_output = shim_nrf_lpcomp_get_output, + .set_trigger = shim_nrf_lpcomp_set_trigger, + .set_trigger_callback = shim_nrf_lpcomp_set_trigger_callback, + .trigger_is_pending = shim_nrf_lpcomp_trigger_is_pending, +}; + +int comp_nrf_lpcomp_configure(const struct device *dev, + const struct comp_nrf_lpcomp_config *config) +{ + nrfx_lpcomp_config_t nrf = {}; + + if (shim_nrf_lpcomp_config_to_nrf(config, &nrf)) { + return -EINVAL; + } + + memcpy(&shim_nrf_lpcomp_data0.config, &nrf, sizeof(shim_nrf_lpcomp_data0.config)); + + shim_nrf_lpcomp_stop(); + shim_nrf_lpcomp_reconfigure(); + if (shim_nrf_lpcomp_is_resumed()) { + shim_nrf_lpcomp_start(); + } + + return 0; +} + +static void shim_nrf_lpcomp_event_handler(nrf_lpcomp_event_t event) +{ + ARG_UNUSED(event); + + if (shim_nrf_lpcomp_data0.callback == NULL) { + atomic_set_bit(&shim_nrf_lpcomp_data0.triggered, 0); + return; + } + + shim_nrf_lpcomp_data0.callback(DEVICE_DT_INST_GET(0), shim_nrf_lpcomp_data0.user_data); + atomic_clear_bit(&shim_nrf_lpcomp_data0.triggered, 0); +} + +static int shim_nrf_lpcomp_init(const struct device *dev) +{ + IRQ_CONNECT(DT_INST_IRQN(0), + DT_INST_IRQ(0, priority), + nrfx_isr, + nrfx_lpcomp_irq_handler, + 0); + + irq_enable(DT_INST_IRQN(0)); + + (void)shim_nrf_lpcomp_config_to_nrf(&shim_nrf_lpcomp_config0, + &shim_nrf_lpcomp_data0.config); + + if (nrfx_lpcomp_init(&shim_nrf_lpcomp_data0.config, + shim_nrf_lpcomp_event_handler) != NRFX_SUCCESS) { + return -ENODEV; + } + + return pm_device_driver_init(dev, shim_nrf_lpcomp_pm_callback); +} + +PM_DEVICE_DT_INST_DEFINE(0, shim_nrf_lpcomp_pm_callback); + +DEVICE_DT_INST_DEFINE(0, + shim_nrf_lpcomp_init, + PM_DEVICE_DT_INST_GET(0), + NULL, + NULL, + POST_KERNEL, + CONFIG_COMPARATOR_INIT_PRIORITY, + &shim_nrf_lpcomp_api); diff --git a/dts/bindings/comparator/nordic,nrf-lpcomp.yaml b/dts/bindings/comparator/nordic,nrf-lpcomp.yaml new file mode 100644 index 0000000000000..8f9cd91a6b795 --- /dev/null +++ b/dts/bindings/comparator/nordic,nrf-lpcomp.yaml @@ -0,0 +1,83 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: | + Nordic nRF LPCOMP (analog Low-Power COMParator) + + The following example displays the minimum node layout: + + comp: comp@deadbeef { + compatible = "nordic,nrf-lpcomp"; + reg = <0xdeadbeef 0x1000>; + interrupts = <0 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + Enabling the comparator node requires setting the default + configuration of the comparator. + + The following example displays enabling the comparator + using an internal reference: + + &comp { + status = "okay"; + psel = "AIN0"; + refsel = "VDD_4_8"; + hyst = "ENABLED"; + }; + + To select an external reference, select the "AREF" + reference and add the external reference: + + &comp { + ... + refsel = "AREF"; + extrefsel = "AIN1"; + ... + }; + +compatible: "nordic,nrf-lpcomp" + +include: base.yaml + +properties: + psel: + type: string + enum: + - "AIN0" + - "AIN1" + - "AIN2" + - "AIN3" + - "AIN4" + - "AIN5" + - "AIN6" + - "AIN7" + + extrefsel: + type: string + enum: + - "AIN0" + - "AIN1" + + refsel: + type: string + enum: + - "VDD_1_8" + - "VDD_2_8" + - "VDD_3_8" + - "VDD_4_8" + - "VDD_5_8" + - "VDD_6_8" + - "VDD_7_8" + - "VDD_1_16" + - "VDD_3_16" + - "VDD_5_16" + - "VDD_7_16" + - "VDD_9_16" + - "VDD_11_16" + - "VDD_13_16" + - "VDD_15_16" + - "AREF" + + enable-hyst: + type: boolean diff --git a/dts/bindings/sensor/nordic,nrf-lpcomp.yaml b/dts/bindings/sensor/nordic,nrf-lpcomp.yaml deleted file mode 100644 index 132b0980ac5a6..0000000000000 --- a/dts/bindings/sensor/nordic,nrf-lpcomp.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2022, Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -description: Nordic nRF family LPCOMP (Low-power Comparator) - -compatible: "nordic,nrf-lpcomp" - -include: base.yaml - -properties: - reg: - required: true - - interrupts: - required: true - - "#io-channel-cells": - type: int - const: 1 - required: true - -io-channel-cells: - - input diff --git a/include/zephyr/drivers/comparator/nrf_lpcomp.h b/include/zephyr/drivers/comparator/nrf_lpcomp.h new file mode 100644 index 0000000000000..e1f2343a8de84 --- /dev/null +++ b/include/zephyr/drivers/comparator/nrf_lpcomp.h @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_DRIVERS_COMP_NRF_LPCOMP_H_ +#define ZEPHYR_INCLUDE_DRIVERS_COMP_NRF_LPCOMP_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Positive input selection */ +enum comp_nrf_lpcomp_psel { + /** AIN0 external input */ + COMP_NRF_LPCOMP_PSEL_AIN0, + /** AIN1 external input */ + COMP_NRF_LPCOMP_PSEL_AIN1, + /** AIN2 external input */ + COMP_NRF_LPCOMP_PSEL_AIN2, + /** AIN3 external input */ + COMP_NRF_LPCOMP_PSEL_AIN3, + /** AIN4 external input */ + COMP_NRF_LPCOMP_PSEL_AIN4, + /** AIN5 external input */ + COMP_NRF_LPCOMP_PSEL_AIN5, + /** AIN6 external input */ + COMP_NRF_LPCOMP_PSEL_AIN6, + /** AIN7 external input */ + COMP_NRF_LPCOMP_PSEL_AIN7, +}; + +/** External reference selection */ +enum comp_nrf_lpcomp_extrefsel { + /** AIN0 external input */ + COMP_NRF_LPCOMP_EXTREFSEL_AIN0, + /** AIN1 external input */ + COMP_NRF_LPCOMP_EXTREFSEL_AIN1, +}; + +/** Reference selection */ +enum comp_nrf_lpcomp_refsel { + /** Use (VDD * (1/8)) as reference */ + COMP_NRF_LPCOMP_REFSEL_VDD_1_8, + /** Use (VDD * (2/8)) as reference */ + COMP_NRF_LPCOMP_REFSEL_VDD_2_8, + /** Use (VDD * (3/8)) as reference */ + COMP_NRF_LPCOMP_REFSEL_VDD_3_8, + /** Use (VDD * (4/8)) as reference */ + COMP_NRF_LPCOMP_REFSEL_VDD_4_8, + /** Use (VDD * (5/8)) as reference */ + COMP_NRF_LPCOMP_REFSEL_VDD_5_8, + /** Use (VDD * (6/8)) as reference */ + COMP_NRF_LPCOMP_REFSEL_VDD_6_8, + /** Use (VDD * (7/8)) as reference */ + COMP_NRF_LPCOMP_REFSEL_VDD_7_8, + /** Use (VDD * (1/16)) as reference */ + COMP_NRF_LPCOMP_REFSEL_VDD_1_16, + /** Use (VDD * (3/16)) as reference */ + COMP_NRF_LPCOMP_REFSEL_VDD_3_16, + /** Use (VDD * (5/16)) as reference */ + COMP_NRF_LPCOMP_REFSEL_VDD_5_16, + /** Use (VDD * (7/16)) as reference */ + COMP_NRF_LPCOMP_REFSEL_VDD_7_16, + /** Use (VDD * (9/16)) as reference */ + COMP_NRF_LPCOMP_REFSEL_VDD_9_16, + /** Use (VDD * (11/16)) as reference */ + COMP_NRF_LPCOMP_REFSEL_VDD_11_16, + /** Use (VDD * (13/16)) as reference */ + COMP_NRF_LPCOMP_REFSEL_VDD_13_16, + /** Use (VDD * (15/16)) as reference */ + COMP_NRF_LPCOMP_REFSEL_VDD_15_16, + /** Use external analog reference */ + COMP_NRF_LPCOMP_REFSEL_AREF, +}; + +/** + * @brief Configuration structure + * + * @note extrefsel is only used if refsel == COMP_NRF_LPCOMP_REFSEL_AREF + */ +struct comp_nrf_lpcomp_config { + /** Positive input selection */ + enum comp_nrf_lpcomp_psel psel; + /** External reference selection */ + enum comp_nrf_lpcomp_extrefsel extrefsel; + /** Reference selection */ + enum comp_nrf_lpcomp_refsel refsel; + /** Hysteresis configuration */ + bool enable_hyst; +}; + +/** + * @brief Configure comparator + * + * @param dev Comparator device instance + * @param config Configuration + * + * @retval 0 if successful + * @retval negative errno-code otherwise + */ +int comp_nrf_lpcomp_configure(const struct device *dev, + const struct comp_nrf_lpcomp_config *config); + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_DRIVERS_COMP_NRF_LPCOMP_H_ */ From a4fce338acc1cc183177f98d2e8243ed0f4493a3 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 4 Sep 2024 11:52:51 +0200 Subject: [PATCH 0609/4482] tests: drivers: build_all: comparator: add nrf_lpcomp Add nrf_lpcomp to build_all comparator test suite. Signed-off-by: Bjarki Arge Andreasen --- .../comparator/nrf_lpcomp/ext_ref.overlay | 12 +++++++++++ .../comparator/nrf_lpcomp/int_ref.overlay | 13 ++++++++++++ .../build_all/comparator/testcase.yaml | 20 +++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 tests/drivers/build_all/comparator/nrf_lpcomp/ext_ref.overlay create mode 100644 tests/drivers/build_all/comparator/nrf_lpcomp/int_ref.overlay diff --git a/tests/drivers/build_all/comparator/nrf_lpcomp/ext_ref.overlay b/tests/drivers/build_all/comparator/nrf_lpcomp/ext_ref.overlay new file mode 100644 index 0000000000000..95e44fbed3d60 --- /dev/null +++ b/tests/drivers/build_all/comparator/nrf_lpcomp/ext_ref.overlay @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&comp { + compatible = "nordic,nrf-lpcomp"; + psel = "AIN0"; + refsel = "VDD_4_8"; + status = "okay"; +}; diff --git a/tests/drivers/build_all/comparator/nrf_lpcomp/int_ref.overlay b/tests/drivers/build_all/comparator/nrf_lpcomp/int_ref.overlay new file mode 100644 index 0000000000000..7aadd8b3faee4 --- /dev/null +++ b/tests/drivers/build_all/comparator/nrf_lpcomp/int_ref.overlay @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&comp { + compatible = "nordic,nrf-lpcomp"; + psel = "AIN0"; + refsel = "AREF"; + extrefsel = "AIN1"; + status = "okay"; +}; diff --git a/tests/drivers/build_all/comparator/testcase.yaml b/tests/drivers/build_all/comparator/testcase.yaml index 9c94ef9a69eb0..8dbc9dfb32a39 100644 --- a/tests/drivers/build_all/comparator/testcase.yaml +++ b/tests/drivers/build_all/comparator/testcase.yaml @@ -46,3 +46,23 @@ tests: - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf9280pdk/nrf9280/cpuapp + drivers.build_all.comparator.nrf_lpcomp.ext_ref: + extra_args: + - DTC_OVERLAY_FILE="nrf_lpcomp/ext_ref.overlay" + platform_allow: + - nrf51dk/nrf51822 + - nrf52dk/nrf52832 + - nrf5340dk/nrf5340/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf9280pdk/nrf9280/cpuapp + drivers.build_all.comparator.nrf_lpcomp.int_ref: + extra_args: + - DTC_OVERLAY_FILE="nrf_lpcomp/int_ref.overlay" + platform_allow: + - nrf51dk/nrf51822 + - nrf52dk/nrf52832 + - nrf5340dk/nrf5340/cpuapp + - nrf54h20dk/nrf54h20/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf9280pdk/nrf9280/cpuapp From e0363f252d09acd907c92bfc112d69ff3919587c Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 19 Aug 2024 13:03:10 +0200 Subject: [PATCH 0610/4482] sensor: mcux_acmp: namespace driver and kconfigs The mcux_acmp will get support by the comparator subsystem. To avoid namespace clashes, namespace the driver, kconfigs and use the MCUX_ACMP config solely to select the MCUX SDK driver. Signed-off-by: Bjarki Arge Andreasen --- drivers/sensor/nxp/CMakeLists.txt | 2 +- drivers/sensor/nxp/mcux_acmp/Kconfig | 7 ++++--- drivers/sensor/nxp/mcux_acmp/mcux_acmp.c | 26 ++++++++++++------------ modules/hal_nxp/Kconfig | 3 ++- samples/sensor/mcux_acmp/prj.conf | 2 +- samples/sensor/mcux_acmp/sample.yaml | 2 +- 6 files changed, 22 insertions(+), 20 deletions(-) diff --git a/drivers/sensor/nxp/CMakeLists.txt b/drivers/sensor/nxp/CMakeLists.txt index 73dc2cb274b35..36e39e002bf95 100644 --- a/drivers/sensor/nxp/CMakeLists.txt +++ b/drivers/sensor/nxp/CMakeLists.txt @@ -5,10 +5,10 @@ add_subdirectory_ifdef(CONFIG_FXAS21002 fxas21002) add_subdirectory_ifdef(CONFIG_FXLS8974 fxls8974) add_subdirectory_ifdef(CONFIG_FXOS8700 fxos8700) -add_subdirectory_ifdef(CONFIG_MCUX_ACMP mcux_acmp) add_subdirectory_ifdef(CONFIG_MCUX_LPCMP mcux_lpcmp) add_subdirectory_ifdef(CONFIG_NXP_TEMPMON nxp_tempmon) add_subdirectory_ifdef(CONFIG_QDEC_MCUX qdec_mcux) add_subdirectory_ifdef(CONFIG_QDEC_NXP_S32 qdec_nxp_s32) +add_subdirectory_ifdef(CONFIG_SENSOR_MCUX_ACMP mcux_acmp) add_subdirectory_ifdef(CONFIG_TEMP_KINETIS nxp_kinetis_temp) # zephyr-keep-sorted-stop diff --git a/drivers/sensor/nxp/mcux_acmp/Kconfig b/drivers/sensor/nxp/mcux_acmp/Kconfig index 0f976c65e2153..1934e4d93f7a0 100644 --- a/drivers/sensor/nxp/mcux_acmp/Kconfig +++ b/drivers/sensor/nxp/mcux_acmp/Kconfig @@ -4,17 +4,18 @@ # Copyright 2024 NXP # SPDX-License-Identifier: Apache-2.0 -config MCUX_ACMP +config SENSOR_MCUX_ACMP bool "NXP MCUX Analog Comparator (ACMP)" default y depends on DT_HAS_NXP_KINETIS_ACMP_ENABLED select PINCTRL + select MCUX_ACMP help Enable driver for the NXP MCUX Analog Comparator (ACMP). -config MCUX_ACMP_TRIGGER +config SENSOR_MCUX_ACMP_TRIGGER bool "Trigger support" - depends on MCUX_ACMP + depends on SENSOR_MCUX_ACMP help Enable trigger support for the NXP MCUX Analog Comparator (ACMP). diff --git a/drivers/sensor/nxp/mcux_acmp/mcux_acmp.c b/drivers/sensor/nxp/mcux_acmp/mcux_acmp.c index 30339f3e48dd6..69c01c3a5ffd5 100644 --- a/drivers/sensor/nxp/mcux_acmp/mcux_acmp.c +++ b/drivers/sensor/nxp/mcux_acmp/mcux_acmp.c @@ -45,9 +45,9 @@ struct mcux_acmp_config { CMP_Type *base; acmp_filter_config_t filter; const struct pinctrl_dev_config *pincfg; -#ifdef CONFIG_MCUX_ACMP_TRIGGER +#ifdef CONFIG_SENSOR_MCUX_ACMP_TRIGGER void (*irq_config_func)(const struct device *dev); -#endif /* CONFIG_MCUX_ACMP_TRIGGER */ +#endif /* CONFIG_SENSOR_MCUX_ACMP_TRIGGER */ bool high_speed : 1; bool unfiltered : 1; bool output : 1; @@ -61,7 +61,7 @@ struct mcux_acmp_data { #if MCUX_ACMP_HAS_DISCRETE_MODE acmp_discrete_mode_config_t discrete_config; #endif -#ifdef CONFIG_MCUX_ACMP_TRIGGER +#ifdef CONFIG_SENSOR_MCUX_ACMP_TRIGGER const struct device *dev; sensor_trigger_handler_t rising_handler; const struct sensor_trigger *rising_trigger; @@ -69,7 +69,7 @@ struct mcux_acmp_data { const struct sensor_trigger *falling_trigger; struct k_work work; volatile uint32_t status; -#endif /* CONFIG_MCUX_ACMP_TRIGGER */ +#endif /* CONFIG_SENSOR_MCUX_ACMP_TRIGGER */ bool cout; }; @@ -370,7 +370,7 @@ static int mcux_acmp_channel_get(const struct device *dev, return 0; } -#ifdef CONFIG_MCUX_ACMP_TRIGGER +#ifdef CONFIG_SENSOR_MCUX_ACMP_TRIGGER static int mcux_acmp_trigger_set(const struct device *dev, const struct sensor_trigger *trig, sensor_trigger_handler_t handler) @@ -431,7 +431,7 @@ static void mcux_acmp_isr(const struct device *dev) k_work_submit(&data->work); } -#endif /* CONFIG_MCUX_ACMP_TRIGGER */ +#endif /* CONFIG_SENSOR_MCUX_ACMP_TRIGGER */ static int mcux_acmp_init(const struct device *dev) { @@ -462,7 +462,7 @@ static int mcux_acmp_init(const struct device *dev) /* Disable DAC */ ACMP_SetDACConfig(config->base, NULL); -#ifdef CONFIG_MCUX_ACMP_TRIGGER +#ifdef CONFIG_SENSOR_MCUX_ACMP_TRIGGER data->dev = dev; k_work_init(&data->work, mcux_acmp_trigger_work_handler); @@ -470,7 +470,7 @@ static int mcux_acmp_init(const struct device *dev) ACMP_EnableInterrupts(config->base, kACMP_OutputRisingInterruptEnable | kACMP_OutputFallingInterruptEnable); -#endif /* CONFIG_MCUX_ACMP_TRIGGER */ +#endif /* CONFIG_SENSOR_MCUX_ACMP_TRIGGER */ ACMP_Enable(config->base, true); @@ -480,9 +480,9 @@ static int mcux_acmp_init(const struct device *dev) static const struct sensor_driver_api mcux_acmp_driver_api = { .attr_set = mcux_acmp_attr_set, .attr_get = mcux_acmp_attr_get, -#ifdef CONFIG_MCUX_ACMP_TRIGGER +#ifdef CONFIG_SENSOR_MCUX_ACMP_TRIGGER .trigger_set = mcux_acmp_trigger_set, -#endif /* CONFIG_MCUX_ACMP_TRIGGER */ +#endif /* CONFIG_SENSOR_MCUX_ACMP_TRIGGER */ .sample_fetch = mcux_acmp_sample_fetch, .channel_get = mcux_acmp_channel_get, }; @@ -503,7 +503,7 @@ static const struct mcux_acmp_config mcux_acmp_config_##n = { \ config_func_init \ } -#ifdef CONFIG_MCUX_ACMP_TRIGGER +#ifdef CONFIG_SENSOR_MCUX_ACMP_TRIGGER #define MCUX_ACMP_CONFIG_FUNC(n) \ static void mcux_acmp_config_func_##n(const struct device *dev) \ { \ @@ -517,12 +517,12 @@ static const struct mcux_acmp_config mcux_acmp_config_##n = { \ .irq_config_func = mcux_acmp_config_func_##n #define MCUX_ACMP_INIT_CONFIG(n) \ MCUX_ACMP_DECLARE_CONFIG(n, MCUX_ACMP_CONFIG_FUNC_INIT(n)) -#else /* !CONFIG_MCUX_ACMP_TRIGGER */ +#else /* !CONFIG_SENSOR_MCUX_ACMP_TRIGGER */ #define MCUX_ACMP_CONFIG_FUNC(n) #define MCUX_ACMP_CONFIG_FUNC_INIT #define MCUX_ACMP_INIT_CONFIG(n) \ MCUX_ACMP_DECLARE_CONFIG(n, MCUX_ACMP_CONFIG_FUNC_INIT) -#endif /* !CONFIG_MCUX_ACMP_TRIGGER */ +#endif /* !CONFIG_SENSOR_MCUX_ACMP_TRIGGER */ #define MCUX_ACMP_INIT(n) \ static struct mcux_acmp_data mcux_acmp_data_##n; \ diff --git a/modules/hal_nxp/Kconfig b/modules/hal_nxp/Kconfig index aaec4e84abace..4f055faa07d6e 100644 --- a/modules/hal_nxp/Kconfig +++ b/modules/hal_nxp/Kconfig @@ -4,4 +4,5 @@ # SPDX-License-Identifier: Apache-2.0 # -# file is empty and kept as a place holder if/when Kconfig is needed +config MCUX_ACMP + bool "Include ACMP driver from MCUX SDK" diff --git a/samples/sensor/mcux_acmp/prj.conf b/samples/sensor/mcux_acmp/prj.conf index 8b70c7ae30b92..202fe6b85649c 100644 --- a/samples/sensor/mcux_acmp/prj.conf +++ b/samples/sensor/mcux_acmp/prj.conf @@ -1,2 +1,2 @@ CONFIG_SENSOR=y -CONFIG_MCUX_ACMP_TRIGGER=y +CONFIG_SENSOR_MCUX_ACMP_TRIGGER=y diff --git a/samples/sensor/mcux_acmp/sample.yaml b/samples/sensor/mcux_acmp/sample.yaml index fa7782d896d21..a00773fdbb68c 100644 --- a/samples/sensor/mcux_acmp/sample.yaml +++ b/samples/sensor/mcux_acmp/sample.yaml @@ -27,4 +27,4 @@ tests: sample.sensor.mcux_acmp.no_trigger: build_only: true extra_configs: - - CONFIG_MCUX_ACMP_TRIGGER=n + - CONFIG_SENSOR_MCUX_ACMP_TRIGGER=n From 4e55597527a4becf61ee35d38cd8e451f488c391 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 18 Sep 2024 13:13:45 +0200 Subject: [PATCH 0611/4482] drivers: sensor: mcux_acmp: update dts binding and adapt driver Update the devicetree binding for the nxp,kinetis-acmp comparator and move the binding to dts/bindings/comparator. The update to the binding includes: - Remove unused io-channel-cells property - Remove unused sensor-device include - Adding missing properties dac config, discrete mode config, and input configs. - Rename properties to exclude redundant vendor prefix since props in this binding are not inhereted, and as such, don't need to be namespaced. - Deprecate the old names of the renamed properties The sensor based device driver has been updated to support both the deprecated and new property names. This allows it to use both nxp,enable-sample and filter-enable-sample for example. Additionally, remove the unused io-channel-cells properties from in-tree nodes of compatible = "nxp,kinetis-acmp" Signed-off-by: Bjarki Arge Andreasen --- drivers/sensor/nxp/mcux_acmp/mcux_acmp.c | 59 +++++- dts/arm/nxp/nxp_ke1xf.dtsi | 3 - dts/arm/nxp/nxp_ke1xz.dtsi | 1 - dts/arm/nxp/nxp_rt118x.dtsi | 4 - dts/arm/nxp/nxp_rt11xx.dtsi | 4 - dts/bindings/comparator/nxp,kinetis-acmp.yaml | 195 ++++++++++++++++++ dts/bindings/sensor/nxp,kinetis-acmp.yaml | 58 ------ 7 files changed, 246 insertions(+), 78 deletions(-) create mode 100644 dts/bindings/comparator/nxp,kinetis-acmp.yaml delete mode 100644 dts/bindings/sensor/nxp,kinetis-acmp.yaml diff --git a/drivers/sensor/nxp/mcux_acmp/mcux_acmp.c b/drivers/sensor/nxp/mcux_acmp/mcux_acmp.c index 69c01c3a5ffd5..90dde17e83c37 100644 --- a/drivers/sensor/nxp/mcux_acmp/mcux_acmp.c +++ b/drivers/sensor/nxp/mcux_acmp/mcux_acmp.c @@ -41,6 +41,49 @@ BUILD_ASSERT(kACMP_PortInputFromDAC == 0); BUILD_ASSERT(kACMP_PortInputFromMux == 1); #endif /* MCUX_ACMP_HAS_INPSEL || MCUX_ACMP_HAS_INNSEL */ +/* + * prop New property name + * depr Deprecated property name + */ +#define MCUX_ACMP_DT_INST_PROP(inst, prop, depr) \ + COND_CODE_1( \ + DT_INST_NODE_HAS_PROP(inst, prop), \ + (DT_INST_PROP(inst, prop)), \ + (DT_INST_PROP(inst, depr)) \ + ) + +/* + * prop New property name + * depr Deprecated property name + */ +#define MCUX_ACMP_DT_INST_PROP_OR(inst, prop, depr, default_value) \ + COND_CODE_1( \ + DT_INST_NODE_HAS_PROP(inst, prop) || DT_INST_NODE_HAS_PROP(inst, depr), \ + (MCUX_ACMP_DT_INST_PROP(inst, prop, depr)), \ + (default_value) \ + ) + +#define MCUX_ACMP_DT_INST_ENABLE_SAMPLE(inst) \ + MCUX_ACMP_DT_INST_PROP(inst, filter_enable_sample, nxp_enable_sample) + +#define MCUX_ACMP_DT_INST_FILTER_COUNT(inst) \ + MCUX_ACMP_DT_INST_PROP_OR(inst, filter_count, nxp_filter_count, 0) + +#define MCUX_ACMP_DT_INST_FILTER_PERIOD(inst) \ + MCUX_ACMP_DT_INST_PROP_OR(inst, filter_period, nxp_filter_period, 0) + +#define MCUX_ACMP_DT_INST_HIGH_SPEED(inst) \ + MCUX_ACMP_DT_INST_PROP(inst, enable_high_speed_mode, nxp_high_speed_mode) + +#define MCUX_ACMP_DT_INST_USE_UNFILTERED_MODE(inst) \ + MCUX_ACMP_DT_INST_PROP(inst, use_unfiltered_output, nxp_use_unfiltered_output) + +#define MCUX_ACMP_DT_INST_USE_ENABLE_PIN_OUT(inst) \ + MCUX_ACMP_DT_INST_PROP(inst, enable_pin_out, nxp_enable_output_pin) + +#define MCUX_ACMP_DT_INST_ENABLE_WINDOW_MODE(inst) \ + MCUX_ACMP_DT_INST_PROP(inst, enable_window_mode, nxp_window_mode) + struct mcux_acmp_config { CMP_Type *base; acmp_filter_config_t filter; @@ -487,18 +530,18 @@ static const struct sensor_driver_api mcux_acmp_driver_api = { .channel_get = mcux_acmp_channel_get, }; -#define MCUX_ACMP_DECLARE_CONFIG(n, config_func_init) \ +#define MCUX_ACMP_DECLARE_CONFIG(n, config_func_init) \ static const struct mcux_acmp_config mcux_acmp_config_##n = { \ .base = (CMP_Type *)DT_INST_REG_ADDR(n), \ .filter = { \ - .enableSample = DT_INST_PROP(n, nxp_enable_sample), \ - .filterCount = DT_INST_PROP_OR(n, nxp_filter_count, 0), \ - .filterPeriod = DT_INST_PROP_OR(n, nxp_filter_period, 0), \ + .enableSample = MCUX_ACMP_DT_INST_ENABLE_SAMPLE(n), \ + .filterCount = MCUX_ACMP_DT_INST_FILTER_COUNT(n), \ + .filterPeriod = MCUX_ACMP_DT_INST_FILTER_PERIOD(n), \ }, \ - .high_speed = DT_INST_PROP(n, nxp_high_speed_mode), \ - .unfiltered = DT_INST_PROP(n, nxp_use_unfiltered_output), \ - .output = DT_INST_PROP(n, nxp_enable_output_pin), \ - .window = DT_INST_PROP(n, nxp_window_mode), \ + .high_speed = MCUX_ACMP_DT_INST_HIGH_SPEED(n), \ + .unfiltered = MCUX_ACMP_DT_INST_USE_UNFILTERED_MODE(n), \ + .output = MCUX_ACMP_DT_INST_USE_ENABLE_PIN_OUT(n), \ + .window = MCUX_ACMP_DT_INST_ENABLE_WINDOW_MODE(n), \ .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ config_func_init \ } diff --git a/dts/arm/nxp/nxp_ke1xf.dtsi b/dts/arm/nxp/nxp_ke1xf.dtsi index 6aff4315889ad..8c880c06dafdc 100644 --- a/dts/arm/nxp/nxp_ke1xf.dtsi +++ b/dts/arm/nxp/nxp_ke1xf.dtsi @@ -575,7 +575,6 @@ interrupts = <40 0>; clocks = <&scg KINETIS_SCG_BUS_CLK>; status = "disabled"; - #io-channel-cells = <2>; }; cmp1: cmp@40074000 { @@ -584,7 +583,6 @@ interrupts = <41 0>; clocks = <&scg KINETIS_SCG_BUS_CLK>; status = "disabled"; - #io-channel-cells = <2>; }; cmp2: cmp@40075000 { @@ -593,7 +591,6 @@ interrupts = <70 0>; clocks = <&scg KINETIS_SCG_BUS_CLK>; status = "disabled"; - #io-channel-cells = <2>; }; flexio1: flexio@4005a000 { diff --git a/dts/arm/nxp/nxp_ke1xz.dtsi b/dts/arm/nxp/nxp_ke1xz.dtsi index 577f0e894fe24..8e34d56484570 100644 --- a/dts/arm/nxp/nxp_ke1xz.dtsi +++ b/dts/arm/nxp/nxp_ke1xz.dtsi @@ -419,7 +419,6 @@ interrupts = <16 0>; clocks = <&scg KINETIS_SCG_BUS_CLK>; status = "disabled"; - #io-channel-cells = <2>; }; lpspi0: spi@4002c000 { diff --git a/dts/arm/nxp/nxp_rt118x.dtsi b/dts/arm/nxp/nxp_rt118x.dtsi index 3e4e3b059e302..6fd22a09be6db 100644 --- a/dts/arm/nxp/nxp_rt118x.dtsi +++ b/dts/arm/nxp/nxp_rt118x.dtsi @@ -300,7 +300,6 @@ reg = <0x2dc0000 0x4000>; interrupts = <200 0>; status = "disabled"; - #io-channel-cells = <2>; }; acmp2: cmp@2dd0000 { @@ -308,7 +307,6 @@ reg = <0x2dd0000 0x4000>; interrupts = <201 0>; status = "disabled"; - #io-channel-cells = <2>; }; acmp3: cmp@2de0000 { @@ -316,7 +314,6 @@ reg = <0x2de0000 0x4000>; interrupts = <202 0>; status = "disabled"; - #io-channel-cells = <2>; }; acmp4: cmp@2df0000 { @@ -324,7 +321,6 @@ reg = <0x2df0000 0x4000>; interrupts = <203 0>; status = "disabled"; - #io-channel-cells = <2>; }; lpadc1: lpadc@2600000 { diff --git a/dts/arm/nxp/nxp_rt11xx.dtsi b/dts/arm/nxp/nxp_rt11xx.dtsi index 6e3644f58fa0a..5dd41ed398b66 100644 --- a/dts/arm/nxp/nxp_rt11xx.dtsi +++ b/dts/arm/nxp/nxp_rt11xx.dtsi @@ -1011,7 +1011,6 @@ reg = <0x401a4000 0x4000>; interrupts = <157 0>; status = "disabled"; - #io-channel-cells = <2>; }; acmp2: cmp@401a8000 { @@ -1019,7 +1018,6 @@ reg = <0x401a8000 0x4000>; interrupts = <158 0>; status = "disabled"; - #io-channel-cells = <2>; }; acmp3: cmp@401ac000 { @@ -1027,7 +1025,6 @@ reg = <0x401ac000 0x4000>; interrupts = <159 0>; status = "disabled"; - #io-channel-cells = <2>; }; acmp4: cmp@401b0000 { @@ -1035,7 +1032,6 @@ reg = <0x401b0000 0x4000>; interrupts = <160 0>; status = "disabled"; - #io-channel-cells = <2>; }; anatop: anatop@40c84000 { diff --git a/dts/bindings/comparator/nxp,kinetis-acmp.yaml b/dts/bindings/comparator/nxp,kinetis-acmp.yaml new file mode 100644 index 0000000000000..76ce24b5bba0a --- /dev/null +++ b/dts/bindings/comparator/nxp,kinetis-acmp.yaml @@ -0,0 +1,195 @@ +# Copyright (c) 2020 Vestas Wind Systems A/S +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: NXP Kinetis ACMP (Analog CoMParator) + +compatible: "nxp,kinetis-acmp" + +include: + - base.yaml + - pinctrl-device.yaml + +properties: + interrupts: + required: true + + reg: + required: true + + nxp,enable-output-pin: + type: boolean + deprecated: true + description: Deprecated. Please use enable-pin-out instead + + nxp,use-unfiltered-output: + type: boolean + deprecated: true + description: Deprecated. Please use use-unfiltered-output instead + + nxp,high-speed-mode: + type: boolean + deprecated: true + description: Deprecated. Please use enable-high-speed-mode instead + + nxp,enable-sample: + type: boolean + deprecated: true + description: Deprecated. Please use filter-enable-sample instead + + nxp,filter-count: + type: int + deprecated: true + description: Deprecated. Please use filter-count instead + + nxp,filter-period: + type: int + deprecated: true + description: Deprecated. Please use filter-period instead + + nxp,window-mode: + type: boolean + deprecated: true + description: Deprecated. Please use enable-window-mode instead + + offset-mode: + type: string + enum: + - "LEVEL0" + - "LEVEL1" + + hysteresis-mode: + type: string + enum: + - "LEVEL0" + - "LEVEL1" + - "LEVEL2" + - "LEVEL3" + + enable-high-speed-mode: + type: boolean + + invert-output: + type: boolean + + use-unfiltered-output: + type: boolean + + enable-pin-out: + type: boolean + + enable-window-mode: + type: boolean + + positive-mux-input: + type: string + enum: + - IN0 + - IN1 + - IN2 + - IN3 + - IN4 + - IN5 + - IN6 + - IN7 + + negative-mux-input: + type: string + enum: + - IN0 + - IN1 + - IN2 + - IN3 + - IN4 + - IN5 + - IN6 + - IN7 + + positive-port-input: + type: string + enum: + - DAC + - MUX + + negative-port-input: + type: string + enum: + - DAC + - MUX + + filter-enable-sample: + type: boolean + + filter-count: + type: int + description: Filter sample count (0 to 7). + + filter-period: + type: int + description: Filter sample period in bus clock cycles (0 to 255). + + dac-vref-source: + type: string + enum: + - "VIN1" + - "VIN2" + + dac-value: + type: int + + dac-enable: + type: boolean + + dac-enable-high-speed: + type: boolean + + discrete-mode-enable-positive-channel: + type: boolean + + discrete-mode-enable-negative-channel: + type: boolean + + discrete-mode-enable-resistor-divider: + type: boolean + + discrete-mode-clock-source: + type: string + enum: + - "SLOW" + - "FAST" + + discrete-mode-sample-time: + type: string + enum: + - "T1" + - "T2" + - "T4" + - "T8" + - "T16" + - "T32" + - "T64" + - "T256" + + discrete-mode-phase1-time: + type: string + enum: + - "ALT0" + - "ALT1" + - "ALT2" + - "ALT3" + - "ALT4" + - "ALT5" + - "ALT6" + - "ALT7" + + discrete-mode-phase2-time: + type: string + enum: + - "ALT0" + - "ALT1" + - "ALT2" + - "ALT3" + - "ALT4" + - "ALT5" + - "ALT6" + - "ALT7" diff --git a/dts/bindings/sensor/nxp,kinetis-acmp.yaml b/dts/bindings/sensor/nxp,kinetis-acmp.yaml deleted file mode 100644 index 9608f9305c9c0..0000000000000 --- a/dts/bindings/sensor/nxp,kinetis-acmp.yaml +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (c) 2020 Vestas Wind Systems A/S -# SPDX-License-Identifier: Apache-2.0 - -description: NXP Kinetis Analog Comparator (ACMP) - -compatible: "nxp,kinetis-acmp" - -include: [sensor-device.yaml, pinctrl-device.yaml] - -properties: - interrupts: - required: true - - reg: - required: true - - nxp,enable-output-pin: - type: boolean - description: | - Make the comparator output (CMP0) available on a packaged pin. - - nxp,use-unfiltered-output: - type: boolean - description: | - Use the unfiltered comparator output for CMP0. - - nxp,high-speed-mode: - type: boolean - description: | - Enable high speed comparison mode. - - nxp,enable-sample: - type: boolean - description: | - Enable external sample signal as clock input. - - nxp,filter-count: - type: int - description: | - Filter sample count (0 to 7). - - nxp,filter-period: - type: int - description: | - Filter sample period in bus clock cycles (0 to 255). - - nxp,window-mode: - type: boolean - description: | - Enable windowing mode. - - "#io-channel-cells": - type: int - const: 2 - -io-channel-cells: - - positive - - negative From 3b08a08c7f1b9741de3bdeab103e7c4b27e6e24d Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Sun, 22 Sep 2024 19:30:43 +0200 Subject: [PATCH 0612/4482] doc: releases: migration-guide: deprecated nxp,kinetis-acmp props Add entyr mentioning the deprecation of the nxp, prefixed properties in the nxp,kinetis-acmp dts binding. Signed-off-by: Bjarki Arge Andreasen --- doc/releases/migration-guide-4.0.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 0c3c1cb98354d..bdc3824bc2f99 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -241,6 +241,11 @@ Sensors to support all JEDEC JC 42.4 compatible temperature sensors. It now uses the :dtcompatible:`jedec,jc-42.4-temp` compatible string instead to the ``microchip,mcp9808`` string. +* The ``nxp,`` prefixed properties in :dtcompatible:`nxp,kinetis-acmp` have been deprecated in favor + of properties without the prefix. The sensor based driver for the :dtcompatible:`nxp,kinetis-acmp` + has been updated to support both the new and deprecated property names. Uses of the deprecated + property names should be updated to the new property names. + Serial ====== From d37f8441043b064eabe5d924e93d103a91c40b44 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 19 Aug 2024 11:53:09 +0200 Subject: [PATCH 0613/4482] drivers: comparator: add mcux acmp device driver Add mcux SDK based kinetis acmp device driver implementing the comparator device driver API. Signed-off-by: Bjarki Arge Andreasen --- drivers/comparator/CMakeLists.txt | 1 + drivers/comparator/Kconfig | 1 + drivers/comparator/Kconfig.mcux_acmp | 9 + drivers/comparator/comparator_mcux_acmp.c | 651 ++++++++++++++++++ dts/bindings/comparator/nxp,kinetis-acmp.yaml | 34 +- include/zephyr/drivers/comparator/mcux_acmp.h | 136 ++++ 6 files changed, 831 insertions(+), 1 deletion(-) create mode 100644 drivers/comparator/Kconfig.mcux_acmp create mode 100644 drivers/comparator/comparator_mcux_acmp.c create mode 100644 include/zephyr/drivers/comparator/mcux_acmp.h diff --git a/drivers/comparator/CMakeLists.txt b/drivers/comparator/CMakeLists.txt index d0dc726bf58cb..b5fe633a333b2 100644 --- a/drivers/comparator/CMakeLists.txt +++ b/drivers/comparator/CMakeLists.txt @@ -6,5 +6,6 @@ zephyr_syscall_header(${ZEPHYR_BASE}/include/zephyr/drivers/comparator.h) zephyr_library() zephyr_library_sources_ifdef(CONFIG_USERSPACE comparator_handlers.c) +zephyr_library_sources_ifdef(CONFIG_COMPARATOR_MCUX_ACMP comparator_mcux_acmp.c) zephyr_library_sources_ifdef(CONFIG_COMPARATOR_NRF_COMP comparator_nrf_comp.c) zephyr_library_sources_ifdef(CONFIG_COMPARATOR_NRF_LPCOMP comparator_nrf_lpcomp.c) diff --git a/drivers/comparator/Kconfig b/drivers/comparator/Kconfig index 819936024b90a..871ee5d9ed673 100644 --- a/drivers/comparator/Kconfig +++ b/drivers/comparator/Kconfig @@ -18,6 +18,7 @@ config COMPARATOR_INIT_PRIORITY help Comparator device driver initialization priority. +rsource "Kconfig.mcux_acmp" rsource "Kconfig.nrf_comp" rsource "Kconfig.nrf_lpcomp" diff --git a/drivers/comparator/Kconfig.mcux_acmp b/drivers/comparator/Kconfig.mcux_acmp new file mode 100644 index 0000000000000..8109cb1cdd2d8 --- /dev/null +++ b/drivers/comparator/Kconfig.mcux_acmp @@ -0,0 +1,9 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config COMPARATOR_MCUX_ACMP + bool "NXP MCUX ACMP comparator driver" + default y + depends on DT_HAS_NXP_KINETIS_ACMP_ENABLED + select PINCTRL + select MCUX_ACMP diff --git a/drivers/comparator/comparator_mcux_acmp.c b/drivers/comparator/comparator_mcux_acmp.c new file mode 100644 index 0000000000000..4d76f105e3414 --- /dev/null +++ b/drivers/comparator/comparator_mcux_acmp.c @@ -0,0 +1,651 @@ +/* + * Copyright (c) 2020 Vestas Wind Systems A/S + * Copyright (c) 2022 NXP + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include +#include +#include +#include +#include + +#include +LOG_MODULE_REGISTER(nxp_kinetis_acmp, CONFIG_COMPARATOR_LOG_LEVEL); + +#define DT_DRV_COMPAT nxp_kinetis_acmp + +/* + * DAC is a register defined in the MCUX HAL. We don't need it here and it conflicts + * with the COMP_MCUX_ACMP_PORT_INPUT_DAC definition so undef it here. + */ +#ifdef DAC +#undef DAC +#endif + +#if defined(FSL_FEATURE_ACMP_HAS_C0_OFFSET_BIT) && (FSL_FEATURE_ACMP_HAS_C0_OFFSET_BIT == 1U) +#define COMP_MCUX_ACMP_HAS_OFFSET 1 +#else +#define COMP_MCUX_ACMP_HAS_OFFSET 0 +#endif + +#if defined(FSL_FEATURE_ACMP_HAS_C0_HYSTCTR_BIT) && (FSL_FEATURE_ACMP_HAS_C0_HYSTCTR_BIT == 1U) +#define COMP_MCUX_ACMP_HAS_HYSTERESIS 1 +#else +#define COMP_MCUX_ACMP_HAS_HYSTERESIS 0 +#endif + +#if defined(FSL_FEATURE_ACMP_HAS_C1_INPSEL_BIT) && (FSL_FEATURE_ACMP_HAS_C1_INPSEL_BIT == 1U) +#define COMP_MCUX_ACMP_HAS_INPSEL 1 +#else +#define COMP_MCUX_ACMP_HAS_INPSEL 0 +#endif + +#if defined(FSL_FEATURE_ACMP_HAS_C1_INNSEL_BIT) && (FSL_FEATURE_ACMP_HAS_C1_INNSEL_BIT == 1U) +#define COMP_MCUX_ACMP_HAS_INNSEL 1 +#else +#define COMP_MCUX_ACMP_HAS_INNSEL 0 +#endif + +#if defined(FSL_FEATURE_ACMP_HAS_C1_DACOE_BIT) && (FSL_FEATURE_ACMP_HAS_C1_DACOE_BIT == 1U) +#define COMP_MCUX_ACMP_HAS_DAC_OUT_ENABLE 1 +#else +#define COMP_MCUX_ACMP_HAS_DAC_OUT_ENABLE 0 +#endif + +#if defined(FSL_FEATURE_ACMP_HAS_C1_DMODE_BIT) && (FSL_FEATURE_ACMP_HAS_C1_DMODE_BIT == 1U) +#define COMP_MCUX_ACMP_HAS_DAC_WORK_MODE 1 +#else +#define COMP_MCUX_ACMP_HAS_DAC_WORK_MODE 0 +#endif + +#if defined(FSL_FEATURE_ACMP_HAS_C3_REG) && (FSL_FEATURE_ACMP_HAS_C3_REG != 0U) +#define COMP_MCUX_ACMP_HAS_DISCRETE_MODE 1 +#else +#define COMP_MCUX_ACMP_HAS_DISCRETE_MODE 0 +#endif + +#if !(defined(FSL_FEATURE_ACMP_HAS_NO_WINDOW_MODE) && (FSL_FEATURE_ACMP_HAS_NO_WINDOW_MODE == 1U)) +#define COMP_MCUX_ACMP_HAS_WINDOW_MODE 1 +#else +#define COMP_MCUX_ACMP_HAS_WINDOW_MODE 0 +#endif + +#define MCUX_ACMP_ENUM(name, value) \ + _CONCAT_4(COMP_MCUX_ACMP_, name, _, value) + +#define MCUX_ACMP_DT_INST_ENUM(inst, name, prop) \ + MCUX_ACMP_ENUM(name, DT_INST_STRING_TOKEN(inst, prop)) + +#define MCUX_ACMP_DT_INST_ENUM_OR(inst, name, prop, or) \ + COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, prop), \ + (MCUX_ACMP_DT_INST_ENUM(inst, name, prop)), \ + (MCUX_ACMP_ENUM(name, or))) + +#define MCUX_ACMP_DT_INST_OFFSET_MODE(inst) \ + MCUX_ACMP_DT_INST_ENUM_OR(inst, OFFSET_MODE, offset_mode, LEVEL0) + +#define MCUX_ACMP_DT_INST_HYST_MODE(inst) \ + MCUX_ACMP_DT_INST_ENUM_OR(inst, HYSTERESIS_MODE, hysteresis_mode, LEVEL0) + +#define MCUX_ACMP_DT_INST_EN_HS_MODE(inst) \ + DT_INST_PROP(inst, enable_high_speed_mode) + +#define MCUX_ACMP_DT_INST_INV_OUT(inst) \ + DT_INST_PROP(inst, invert_output) + +#define MCUX_ACMP_DT_INST_USE_UNFILTERED_OUT(inst) \ + DT_INST_PROP(inst, use_unfiltered_output) + +#define MCUX_ACMP_DT_INST_EN_PIN_OUT(inst) \ + DT_INST_PROP(inst, enable_pin_out) + +#define MCUX_ACMP_DT_INST_MODE_CONFIG_INIT(inst) \ + { \ + .offset_mode = MCUX_ACMP_DT_INST_OFFSET_MODE(inst), \ + .hysteresis_mode = MCUX_ACMP_DT_INST_HYST_MODE(inst), \ + .enable_high_speed_mode = MCUX_ACMP_DT_INST_EN_HS_MODE(inst), \ + .invert_output = MCUX_ACMP_DT_INST_INV_OUT(inst), \ + .use_unfiltered_output = MCUX_ACMP_DT_INST_USE_UNFILTERED_OUT(inst), \ + .enable_pin_output = MCUX_ACMP_DT_INST_EN_PIN_OUT(inst), \ + } + +#define MCUX_ACMP_DT_INST_P_MUX_IN(inst) \ + MCUX_ACMP_DT_INST_ENUM(inst, MUX_INPUT, positive_mux_input) + +#define MCUX_ACMP_DT_INST_N_MUX_IN(inst) \ + MCUX_ACMP_DT_INST_ENUM(inst, MUX_INPUT, negative_mux_input) + +#define MCUX_ACMP_DT_INST_P_PORT_IN(inst) \ + MCUX_ACMP_DT_INST_ENUM_OR(inst, PORT_INPUT, positive_port_input, MUX) + +#define MCUX_ACMP_DT_INST_N_PORT_IN(inst) \ + MCUX_ACMP_DT_INST_ENUM_OR(inst, PORT_INPUT, negative_port_input, MUX) + +#define MCUX_ACMP_DT_INST_INPUT_CONFIG_INIT(inst) \ + { \ + .positive_mux_input = MCUX_ACMP_DT_INST_P_MUX_IN(inst), \ + .negative_mux_input = MCUX_ACMP_DT_INST_N_MUX_IN(inst), \ + .positive_port_input = MCUX_ACMP_DT_INST_P_PORT_IN(inst), \ + .negative_port_input = MCUX_ACMP_DT_INST_N_PORT_IN(inst), \ + } + +#define MCUX_ACMP_DT_INST_FILTER_EN_SAMPLE(inst) \ + DT_INST_PROP(inst, filter_enable_sample) + +#define MCUX_ACMP_DT_INST_FILTER_COUNT(inst) \ + DT_INST_PROP_OR(inst, filter_count, 0) + +#define MCUX_ACMP_DT_INST_FILTER_PERIOD(inst) \ + DT_INST_PROP_OR(inst, filter_period, 0) + +#define MCUX_ACMP_DT_INST_FILTER_CONFIG_INIT(inst) \ + { \ + .enable_sample = MCUX_ACMP_DT_INST_FILTER_EN_SAMPLE(inst), \ + .filter_count = MCUX_ACMP_DT_INST_FILTER_COUNT(inst), \ + .filter_period = MCUX_ACMP_DT_INST_FILTER_PERIOD(inst), \ + } + +#define MCUX_ACMP_DT_INST_DAC_VREF_SOURCE(inst) \ + MCUX_ACMP_DT_INST_ENUM_OR(inst, DAC_VREF_SOURCE, dac_vref_source, VIN1) + +#define MCUX_ACMP_DT_INST_DAC_VALUE(inst) \ + DT_INST_PROP_OR(inst, dac_value, 0) + +#define MCUX_ACMP_DT_INST_DAC_EN(inst) \ + DT_INST_PROP(inst, dac_enable) + +#define MCUX_ACMP_DT_INST_DAC_EN_HS(inst) \ + DT_INST_PROP(inst, dac_enable_high_speed) + +#define MCUX_ACMP_DT_INST_DAC_CONFIG_INIT(inst) \ + { \ + .vref_source = MCUX_ACMP_DT_INST_DAC_VREF_SOURCE(inst), \ + .value = MCUX_ACMP_DT_INST_DAC_VALUE(inst), \ + .enable_output = MCUX_ACMP_DT_INST_DAC_EN(inst), \ + .enable_high_speed_mode = MCUX_ACMP_DT_INST_DAC_EN_HS(inst), \ + } + +#define MCUX_ACMP_DT_INST_DM_EN_P_CH(inst) \ + DT_INST_PROP(inst, discrete_mode_enable_positive_channel) + +#define MCUX_ACMP_DT_INST_DM_EN_N_CH(inst) \ + DT_INST_PROP(inst, discrete_mode_enable_negative_channel) + +#define MCUX_ACMP_DT_INST_DM_EN_RES_DIV(inst) \ + DT_INST_PROP(inst, discrete_mode_enable_resistor_divider) + +#define MCUX_ACMP_DT_INST_DM_CLOCK_SOURCE(inst) \ + MCUX_ACMP_DT_INST_ENUM_OR(inst, DM_CLOCK, discrete_mode_clock_source, SLOW) + +#define MCUX_ACMP_DT_INST_DM_SAMPLE_TIME(inst) \ + MCUX_ACMP_DT_INST_ENUM_OR(inst, DM_SAMPLE_TIME, discrete_mode_sample_time, T1) + +#define MCUX_ACMP_DT_INST_DM_PHASE1_TIME(inst) \ + MCUX_ACMP_DT_INST_ENUM_OR(inst, DM_PHASE_TIME, discrete_mode_phase1_time, ALT0) + +#define MCUX_ACMP_DT_INST_DM_PHASE2_TIME(inst) \ + MCUX_ACMP_DT_INST_ENUM_OR(inst, DM_PHASE_TIME, discrete_mode_phase2_time, ALT0) + +#define MCUX_ACMP_DT_INST_DM_CONFIG_INIT(inst) \ + { \ + .enable_positive_channel = MCUX_ACMP_DT_INST_DM_EN_P_CH(inst), \ + .enable_negative_channel = MCUX_ACMP_DT_INST_DM_EN_N_CH(inst), \ + .enable_resistor_divider = MCUX_ACMP_DT_INST_DM_EN_RES_DIV(inst), \ + .clock_source = MCUX_ACMP_DT_INST_DM_CLOCK_SOURCE(inst), \ + .sample_time = MCUX_ACMP_DT_INST_DM_SAMPLE_TIME(inst), \ + .phase1_time = MCUX_ACMP_DT_INST_DM_PHASE1_TIME(inst), \ + .phase2_time = MCUX_ACMP_DT_INST_DM_PHASE2_TIME(inst), \ + } + +#define MCUX_ACMP_DT_INST_EN_WINDOW_MODE(inst) \ + DT_INST_PROP(inst, enable_window_mode) + +struct mcux_acmp_config { + CMP_Type *base; + const struct pinctrl_dev_config *pincfg; + void (*irq_init)(void); + const struct comp_mcux_acmp_mode_config mode_config; + const struct comp_mcux_acmp_input_config input_config; + const struct comp_mcux_acmp_filter_config filter_config; + const struct comp_mcux_acmp_dac_config dac_config; +#if COMP_MCUX_ACMP_HAS_DISCRETE_MODE + const struct comp_mcux_acmp_dm_config dm_config; +#endif +#if COMP_MCUX_ACMP_HAS_WINDOW_MODE + bool enable_window_mode; +#endif +}; + +#if MCUX_ACMP_HAS_OFFSET +BUILD_ASSERT((int)kACMP_OffsetLevel0 == (int)COMP_MCUX_ACMP_OFFSET_MODE_LEVEL0); +BUILD_ASSERT((int)kACMP_OffsetLevel1 == (int)COMP_MCUX_ACMP_OFFSET_MODE_LEVEL1); +#endif + +#if COMP_MCUX_ACMP_HAS_HYSTERESIS +BUILD_ASSERT((int)kACMP_HysteresisLevel0 == (int)COMP_MCUX_ACMP_HYSTERESIS_MODE_LEVEL0); +BUILD_ASSERT((int)kACMP_HysteresisLevel1 == (int)COMP_MCUX_ACMP_HYSTERESIS_MODE_LEVEL1); +BUILD_ASSERT((int)kACMP_HysteresisLevel2 == (int)COMP_MCUX_ACMP_HYSTERESIS_MODE_LEVEL2); +BUILD_ASSERT((int)kACMP_HysteresisLevel3 == (int)COMP_MCUX_ACMP_HYSTERESIS_MODE_LEVEL3); +#endif + +BUILD_ASSERT((int)kACMP_VrefSourceVin1 == (int)COMP_MCUX_ACMP_DAC_VREF_SOURCE_VIN1); +BUILD_ASSERT((int)kACMP_VrefSourceVin2 == (int)COMP_MCUX_ACMP_DAC_VREF_SOURCE_VIN2); + +#if MCUX_ACMP_HAS_INPSEL || MCUX_ACMP_HAS_INNSEL +BUILD_ASSERT((int)kACMP_PortInputFromDAC == (int)COMP_MCUX_ACMP_PORT_INPUT_DAC); +BUILD_ASSERT((int)kACMP_PortInputFromMux == (int)COMP_MCUX_ACMP_PORT_INPUT_MUX); +#endif + +#if COMP_MCUX_ACMP_HAS_DISCRETE_MODE +BUILD_ASSERT((int)kACMP_DiscreteClockSlow == (int)COMP_MCUX_ACMP_DM_CLOCK_SLOW); +BUILD_ASSERT((int)kACMP_DiscreteClockFast == (int)COMP_MCUX_ACMP_DM_CLOCK_FAST); + +BUILD_ASSERT((int)kACMP_DiscreteSampleTimeAs1T == (int)COMP_MCUX_ACMP_DM_SAMPLE_TIME_T1); +BUILD_ASSERT((int)kACMP_DiscreteSampleTimeAs2T == (int)COMP_MCUX_ACMP_DM_SAMPLE_TIME_T2); +BUILD_ASSERT((int)kACMP_DiscreteSampleTimeAs4T == (int)COMP_MCUX_ACMP_DM_SAMPLE_TIME_T4); +BUILD_ASSERT((int)kACMP_DiscreteSampleTimeAs8T == (int)COMP_MCUX_ACMP_DM_SAMPLE_TIME_T8); +BUILD_ASSERT((int)kACMP_DiscreteSampleTimeAs16T == (int)COMP_MCUX_ACMP_DM_SAMPLE_TIME_T16); +BUILD_ASSERT((int)kACMP_DiscreteSampleTimeAs32T == (int)COMP_MCUX_ACMP_DM_SAMPLE_TIME_T32); +BUILD_ASSERT((int)kACMP_DiscreteSampleTimeAs64T == (int)COMP_MCUX_ACMP_DM_SAMPLE_TIME_T64); +BUILD_ASSERT((int)kACMP_DiscreteSampleTimeAs256T == (int)COMP_MCUX_ACMP_DM_SAMPLE_TIME_T256); + +BUILD_ASSERT((int)kACMP_DiscretePhaseTimeAlt0 == (int)COMP_MCUX_ACMP_DM_PHASE_TIME_ALT0); +BUILD_ASSERT((int)kACMP_DiscretePhaseTimeAlt1 == (int)COMP_MCUX_ACMP_DM_PHASE_TIME_ALT1); +BUILD_ASSERT((int)kACMP_DiscretePhaseTimeAlt2 == (int)COMP_MCUX_ACMP_DM_PHASE_TIME_ALT2); +BUILD_ASSERT((int)kACMP_DiscretePhaseTimeAlt3 == (int)COMP_MCUX_ACMP_DM_PHASE_TIME_ALT3); +BUILD_ASSERT((int)kACMP_DiscretePhaseTimeAlt4 == (int)COMP_MCUX_ACMP_DM_PHASE_TIME_ALT4); +BUILD_ASSERT((int)kACMP_DiscretePhaseTimeAlt5 == (int)COMP_MCUX_ACMP_DM_PHASE_TIME_ALT5); +BUILD_ASSERT((int)kACMP_DiscretePhaseTimeAlt6 == (int)COMP_MCUX_ACMP_DM_PHASE_TIME_ALT6); +BUILD_ASSERT((int)kACMP_DiscretePhaseTimeAlt7 == (int)COMP_MCUX_ACMP_DM_PHASE_TIME_ALT7); +#endif + +struct mcux_acmp_data { + uint32_t interrupt_mask; + comparator_callback_t callback; + void *user_data; +}; + +#if CONFIG_PM_DEVICE +static bool mcux_acmp_is_resumed(const struct device *dev) +{ + enum pm_device_state state; + + (void)pm_device_state_get(dev, &state); + return state == PM_DEVICE_STATE_ACTIVE; +} +#else +static bool mcux_acmp_is_resumed(const struct device *dev) +{ + ARG_UNUSED(dev); + return true; +} +#endif + +static int mcux_acmp_get_output(const struct device *dev) +{ + const struct mcux_acmp_config *config = dev->config; + uint32_t status; + + status = ACMP_GetStatusFlags(config->base); + return (status & kACMP_OutputAssertEventFlag) ? 1 : 0; +} + +static int mcux_acmp_set_trigger(const struct device *dev, + enum comparator_trigger trigger) +{ + const struct mcux_acmp_config *config = dev->config; + struct mcux_acmp_data *data = dev->data; + + ACMP_DisableInterrupts(config->base, UINT32_MAX); + + switch (trigger) { + case COMPARATOR_TRIGGER_NONE: + data->interrupt_mask = 0; + break; + + case COMPARATOR_TRIGGER_RISING_EDGE: + data->interrupt_mask = kACMP_OutputRisingInterruptEnable; + break; + + case COMPARATOR_TRIGGER_FALLING_EDGE: + data->interrupt_mask = kACMP_OutputFallingInterruptEnable; + break; + + case COMPARATOR_TRIGGER_BOTH_EDGES: + data->interrupt_mask = kACMP_OutputFallingInterruptEnable | + kACMP_OutputRisingInterruptEnable; + break; + } + + if (data->interrupt_mask && data->callback != NULL) { + ACMP_EnableInterrupts(config->base, data->interrupt_mask); + } + + return 0; +} + +static int mcux_acmp_set_trigger_callback(const struct device *dev, + comparator_callback_t callback, + void *user_data) +{ + const struct mcux_acmp_config *config = dev->config; + struct mcux_acmp_data *data = dev->data; + + ACMP_DisableInterrupts(config->base, UINT32_MAX); + + data->callback = callback; + data->user_data = user_data; + + if (data->callback == NULL) { + return 0; + } + + if (data->interrupt_mask) { + ACMP_EnableInterrupts(config->base, data->interrupt_mask); + } + + return 0; +} + +static int mcux_acmp_trigger_is_pending(const struct device *dev) +{ + const struct mcux_acmp_config *config = dev->config; + struct mcux_acmp_data *data = dev->data; + uint32_t status_flags; + + status_flags = ACMP_GetStatusFlags(config->base); + ACMP_ClearStatusFlags(config->base, UINT32_MAX); + + if ((data->interrupt_mask & kACMP_OutputRisingInterruptEnable) && + (status_flags & kACMP_OutputRisingEventFlag)) { + return 1; + } + + if ((data->interrupt_mask & kACMP_OutputFallingInterruptEnable) && + (status_flags & kACMP_OutputFallingEventFlag)) { + return 1; + } + + return 0; +} + +static const struct comparator_driver_api mcux_acmp_comp_api = { + .get_output = mcux_acmp_get_output, + .set_trigger = mcux_acmp_set_trigger, + .set_trigger_callback = mcux_acmp_set_trigger_callback, + .trigger_is_pending = mcux_acmp_trigger_is_pending, +}; + +static void comp_mcux_acmp_init_mode_config(const struct device *dev, + const struct comp_mcux_acmp_mode_config *config) +{ + const struct mcux_acmp_config *dev_config = dev->config; + acmp_config_t acmp_config; + +#if COMP_MCUX_ACMP_HAS_OFFSET + acmp_config.offsetMode = (acmp_offset_mode_t)config->offset_mode; +#endif + +#if COMP_MCUX_ACMP_HAS_HYSTERESIS + acmp_config.hysteresisMode = (acmp_hysteresis_mode_t)config->hysteresis_mode; +#endif + + acmp_config.enableHighSpeed = config->enable_high_speed_mode; + acmp_config.enableInvertOutput = config->invert_output; + acmp_config.useUnfilteredOutput = config->use_unfiltered_output; + acmp_config.enablePinOut = config->enable_pin_output; + + ACMP_Init(dev_config->base, &acmp_config); +} + +int comp_mcux_acmp_set_mode_config(const struct device *dev, + const struct comp_mcux_acmp_mode_config *config) +{ + const struct mcux_acmp_config *dev_config = dev->config; + + comp_mcux_acmp_init_mode_config(dev, config); + + if (mcux_acmp_is_resumed(dev)) { + ACMP_Enable(dev_config->base, true); + } + + return 0; +} + +int comp_mcux_acmp_set_input_config(const struct device *dev, + const struct comp_mcux_acmp_input_config *config) +{ + const struct mcux_acmp_config *dev_config = dev->config; + acmp_channel_config_t acmp_channel_config; + +#if COMP_MCUX_ACMP_HAS_INPSEL + acmp_channel_config.positivePortInput = (acmp_port_input_t)config->positive_port_input; +#endif + + acmp_channel_config.plusMuxInput = (uint32_t)config->positive_mux_input; + +#if COMP_MCUX_ACMP_HAS_INNSEL + acmp_channel_config.negativePortInput = (acmp_port_input_t)config->negative_port_input; +#endif + + acmp_channel_config.minusMuxInput = (uint32_t)config->negative_mux_input; + + ACMP_SetChannelConfig(dev_config->base, &acmp_channel_config); + return 0; +} + +int comp_mcux_acmp_set_filter_config(const struct device *dev, + const struct comp_mcux_acmp_filter_config *config) +{ + const struct mcux_acmp_config *dev_config = dev->config; + acmp_filter_config_t acmp_filter_config; + + if (config->enable_sample && config->filter_count == 0) { + return -EINVAL; + } + + if (config->filter_count > 7) { + return -EINVAL; + } + + acmp_filter_config.enableSample = config->enable_sample; + acmp_filter_config.filterCount = config->filter_count; + acmp_filter_config.filterPeriod = config->filter_period; + + ACMP_SetFilterConfig(dev_config->base, &acmp_filter_config); + return 0; +} + +int comp_mcux_acmp_set_dac_config(const struct device *dev, + const struct comp_mcux_acmp_dac_config *config) +{ + const struct mcux_acmp_config *dev_config = dev->config; + acmp_dac_config_t acmp_dac_config; + + acmp_dac_config.referenceVoltageSource = + (acmp_reference_voltage_source_t)config->vref_source; + + acmp_dac_config.DACValue = config->value; + +#if COMP_MCUX_ACMP_HAS_DAC_OUT_ENABLE + acmp_dac_config.enableOutput = config->enable_output; +#endif + +#if COMP_MCUX_ACMP_HAS_DAC_WORK_MODE + acmp_dac_config.workMode = config->enable_high_speed_mode + ? kACMP_DACWorkHighSpeedMode + : kACMP_DACWorkLowSpeedMode; +#endif + + ACMP_SetDACConfig(dev_config->base, &acmp_dac_config); + return 0; +} + +#if COMP_MCUX_ACMP_HAS_DISCRETE_MODE +int comp_mcux_acmp_set_dm_config(const struct device *dev, + const struct comp_mcux_acmp_dm_config *config) +{ + const struct mcux_acmp_config *dev_config = dev->config; + acmp_discrete_mode_config_t acmp_dm_config; + + acmp_dm_config.enablePositiveChannelDiscreteMode = config->enable_positive_channel; + acmp_dm_config.enableNegativeChannelDiscreteMode = config->enable_negative_channel; + acmp_dm_config.enableResistorDivider = config->enable_resistor_divider; + acmp_dm_config.clockSource = (acmp_discrete_clock_source_t)config->clock_source; + acmp_dm_config.sampleTime = (acmp_discrete_sample_time_t)config->sample_time; + acmp_dm_config.phase1Time = (acmp_discrete_phase_time_t)config->phase1_time; + acmp_dm_config.phase2Time = (acmp_discrete_phase_time_t)config->phase2_time; + + ACMP_SetDiscreteModeConfig(dev_config->base, &acmp_dm_config); + return 0; +} +#endif + +#if COMP_MCUX_ACMP_HAS_WINDOW_MODE +int comp_mcux_acmp_set_window_mode(const struct device *dev, bool enable) +{ + const struct mcux_acmp_config *config = dev->config; + + ACMP_EnableWindowMode(config->base, enable); + return 0; +} +#endif + +static int mcux_acmp_pm_callback(const struct device *dev, enum pm_device_action action) +{ + const struct mcux_acmp_config *config = dev->config; + + if (action == PM_DEVICE_ACTION_RESUME) { + ACMP_Enable(config->base, true); + } + +#if CONFIG_PM_DEVICE + if (action == PM_DEVICE_ACTION_SUSPEND) { + ACMP_Enable(config->base, false); + } +#endif + + return 0; +} + +static void mcux_acmp_irq_handler(const struct device *dev) +{ + const struct mcux_acmp_config *config = dev->config; + struct mcux_acmp_data *data = dev->data; + + ACMP_ClearStatusFlags(config->base, UINT32_MAX); + + if (data->callback == NULL) { + return; + } + + data->callback(dev, data->user_data); +} + +static int mcux_acmp_init(const struct device *dev) +{ + const struct mcux_acmp_config *config = dev->config; + int ret; + + ret = pinctrl_apply_state(config->pincfg, PINCTRL_STATE_DEFAULT); + if (ret) { + LOG_ERR("failed to set %s", "pincfg"); + return ret; + } + + comp_mcux_acmp_init_mode_config(dev, &config->mode_config); + + ret = comp_mcux_acmp_set_input_config(dev, &config->input_config); + if (ret) { + LOG_ERR("failed to set %s", "input config"); + return ret; + } + + ret = comp_mcux_acmp_set_filter_config(dev, &config->filter_config); + if (ret) { + LOG_ERR("failed to set %s", "filter config"); + return ret; + } + + ret = comp_mcux_acmp_set_dac_config(dev, &config->dac_config); + if (ret) { + LOG_ERR("failed to set %s", "dac config"); + return ret; + } + +#if COMP_MCUX_ACMP_HAS_DISCRETE_MODE + ret = comp_mcux_acmp_set_dm_config(dev, &config->dm_config); + if (ret) { + LOG_ERR("failed to set %s", "discrete mode config"); + return ret; + } +#endif + +#if COMP_MCUX_ACMP_HAS_WINDOW_MODE + ret = comp_mcux_acmp_set_window_mode(dev, config->enable_window_mode); + if (ret) { + LOG_ERR("failed to set %s", "window mode"); + return ret; + } +#endif + + ACMP_DisableInterrupts(config->base, UINT32_MAX); + config->irq_init(); + + return pm_device_driver_init(dev, mcux_acmp_pm_callback); +} + +#define MCUX_ACMP_IRQ_HANDLER_SYM(inst) \ + _CONCAT(mcux_acmp_irq_init, inst) + +#define MCUX_ACMP_IRQ_HANDLER_DEFINE(inst) \ + static void MCUX_ACMP_IRQ_HANDLER_SYM(inst)(void) \ + { \ + IRQ_CONNECT(DT_INST_IRQN(inst), \ + DT_INST_IRQ(inst, priority), \ + mcux_acmp_irq_handler, \ + DEVICE_DT_INST_GET(inst), \ + 0); \ + \ + irq_enable(DT_INST_IRQN(inst)); \ + } + +#define MCUX_ACMP_DEVICE(inst) \ + PINCTRL_DT_INST_DEFINE(inst); \ + \ + static struct mcux_acmp_data _CONCAT(data, inst); \ + \ + MCUX_ACMP_IRQ_HANDLER_DEFINE(inst) \ + \ + static const struct mcux_acmp_config _CONCAT(config, inst) = { \ + .base = (CMP_Type *)DT_INST_REG_ADDR(inst), \ + .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ + .irq_init = MCUX_ACMP_IRQ_HANDLER_SYM(inst), \ + .mode_config = MCUX_ACMP_DT_INST_MODE_CONFIG_INIT(inst), \ + .input_config = MCUX_ACMP_DT_INST_INPUT_CONFIG_INIT(inst), \ + .filter_config = MCUX_ACMP_DT_INST_FILTER_CONFIG_INIT(inst), \ + .dac_config = MCUX_ACMP_DT_INST_DAC_CONFIG_INIT(inst), \ + IF_ENABLED(COMP_MCUX_ACMP_HAS_DISCRETE_MODE, \ + (.dm_config = MCUX_ACMP_DT_INST_DM_CONFIG_INIT(inst),)) \ + IF_ENABLED(COMP_MCUX_ACMP_HAS_WINDOW_MODE, \ + (.enable_window_mode = MCUX_ACMP_DT_INST_EN_WINDOW_MODE(inst),)) \ + }; \ + \ + PM_DEVICE_DT_INST_DEFINE(inst, mcux_acmp_pm_callback); \ + \ + DEVICE_DT_INST_DEFINE(inst, \ + mcux_acmp_init, \ + PM_DEVICE_DT_INST_GET(inst), \ + &_CONCAT(data, inst), \ + &_CONCAT(config, inst), \ + POST_KERNEL, \ + CONFIG_COMPARATOR_INIT_PRIORITY, \ + &mcux_acmp_comp_api); + +DT_INST_FOREACH_STATUS_OKAY(MCUX_ACMP_DEVICE) diff --git a/dts/bindings/comparator/nxp,kinetis-acmp.yaml b/dts/bindings/comparator/nxp,kinetis-acmp.yaml index 76ce24b5bba0a..21db936c2bf86 100644 --- a/dts/bindings/comparator/nxp,kinetis-acmp.yaml +++ b/dts/bindings/comparator/nxp,kinetis-acmp.yaml @@ -2,7 +2,39 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -description: NXP Kinetis ACMP (Analog CoMParator) +description: | + NXP Kinetis ACMP (Analog CoMParator) + + The following example displays the minimum node layout: + + acmp0: acmp@deadbeef { + compatible = "nxp,kinetis-acmp"; + reg = <0xdeadbeef 0x1000>; + interrupts = <0 0>; + clocks = <&scg KINETIS_SCG_BUS_CLK>; + status = "disabled"; + }; + + Enabling the comparator node requires setting the minimum default + configuration of the comparator. This includes selecting the + positive and negative inputs, and routing them using pinctrl: + + &pinctrl { + acmp0_default: acmp0_default { + group0 { + ... + }; + }; + }; + + &acmp0 { + status = "okay"; + pinctrl-0 = <&acmp0_default>; + pinctrl-names = "default"; + + positive-mux-input = "IN0"; + negative-mux-input = "IN1"; + }; compatible: "nxp,kinetis-acmp" diff --git a/include/zephyr/drivers/comparator/mcux_acmp.h b/include/zephyr/drivers/comparator/mcux_acmp.h new file mode 100644 index 0000000000000..3d06644f0e841 --- /dev/null +++ b/include/zephyr/drivers/comparator/mcux_acmp.h @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_DRIVERS_COMP_MCUX_ACMP_H_ +#define ZEPHYR_INCLUDE_DRIVERS_COMP_MCUX_ACMP_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +enum comp_mcux_acmp_offset_mode { + COMP_MCUX_ACMP_OFFSET_MODE_LEVEL0 = 0, + COMP_MCUX_ACMP_OFFSET_MODE_LEVEL1, +}; + +enum comp_mcux_acmp_hysteresis_mode { + COMP_MCUX_ACMP_HYSTERESIS_MODE_LEVEL0 = 0, + COMP_MCUX_ACMP_HYSTERESIS_MODE_LEVEL1, + COMP_MCUX_ACMP_HYSTERESIS_MODE_LEVEL2, + COMP_MCUX_ACMP_HYSTERESIS_MODE_LEVEL3, +}; + +struct comp_mcux_acmp_mode_config { + enum comp_mcux_acmp_offset_mode offset_mode; + enum comp_mcux_acmp_hysteresis_mode hysteresis_mode; + bool enable_high_speed_mode; + bool invert_output; + bool use_unfiltered_output; + bool enable_pin_output; +}; + +enum comp_mcux_acmp_mux_input { + COMP_MCUX_ACMP_MUX_INPUT_IN0 = 0, + COMP_MCUX_ACMP_MUX_INPUT_IN1, + COMP_MCUX_ACMP_MUX_INPUT_IN2, + COMP_MCUX_ACMP_MUX_INPUT_IN3, + COMP_MCUX_ACMP_MUX_INPUT_IN4, + COMP_MCUX_ACMP_MUX_INPUT_IN5, + COMP_MCUX_ACMP_MUX_INPUT_IN6, + COMP_MCUX_ACMP_MUX_INPUT_IN7, +}; + +enum comp_mcux_acmp_port_input { + COMP_MCUX_ACMP_PORT_INPUT_DAC = 0, + COMP_MCUX_ACMP_PORT_INPUT_MUX, +}; + +struct comp_mcux_acmp_input_config { + enum comp_mcux_acmp_mux_input positive_mux_input; + enum comp_mcux_acmp_mux_input negative_mux_input; + enum comp_mcux_acmp_port_input positive_port_input; + enum comp_mcux_acmp_port_input negative_port_input; +}; + +struct comp_mcux_acmp_filter_config { + bool enable_sample; + uint8_t filter_count; + uint8_t filter_period; +}; + +enum comp_mcux_acmp_dac_vref_source { + COMP_MCUX_ACMP_DAC_VREF_SOURCE_VIN1 = 0, + COMP_MCUX_ACMP_DAC_VREF_SOURCE_VIN2, +}; + +struct comp_mcux_acmp_dac_config { + enum comp_mcux_acmp_dac_vref_source vref_source; + uint8_t value; + bool enable_output; + bool enable_high_speed_mode; +}; + +enum comp_mcux_acmp_dm_clock { + COMP_MCUX_ACMP_DM_CLOCK_SLOW = 0, + COMP_MCUX_ACMP_DM_CLOCK_FAST, +}; + +enum comp_mcux_acmp_dm_sample_time { + COMP_MCUX_ACMP_DM_SAMPLE_TIME_T1 = 0, + COMP_MCUX_ACMP_DM_SAMPLE_TIME_T2, + COMP_MCUX_ACMP_DM_SAMPLE_TIME_T4, + COMP_MCUX_ACMP_DM_SAMPLE_TIME_T8, + COMP_MCUX_ACMP_DM_SAMPLE_TIME_T16, + COMP_MCUX_ACMP_DM_SAMPLE_TIME_T32, + COMP_MCUX_ACMP_DM_SAMPLE_TIME_T64, + COMP_MCUX_ACMP_DM_SAMPLE_TIME_T256, +}; + +enum comp_mcux_acmp_dm_phase_time { + COMP_MCUX_ACMP_DM_PHASE_TIME_ALT0 = 0, + COMP_MCUX_ACMP_DM_PHASE_TIME_ALT1, + COMP_MCUX_ACMP_DM_PHASE_TIME_ALT2, + COMP_MCUX_ACMP_DM_PHASE_TIME_ALT3, + COMP_MCUX_ACMP_DM_PHASE_TIME_ALT4, + COMP_MCUX_ACMP_DM_PHASE_TIME_ALT5, + COMP_MCUX_ACMP_DM_PHASE_TIME_ALT6, + COMP_MCUX_ACMP_DM_PHASE_TIME_ALT7, +}; + +struct comp_mcux_acmp_dm_config { + bool enable_positive_channel; + bool enable_negative_channel; + bool enable_resistor_divider; + enum comp_mcux_acmp_dm_clock clock_source; + enum comp_mcux_acmp_dm_sample_time sample_time; + enum comp_mcux_acmp_dm_phase_time phase1_time; + enum comp_mcux_acmp_dm_phase_time phase2_time; +}; + +int comp_mcux_acmp_set_mode_config(const struct device *dev, + const struct comp_mcux_acmp_mode_config *config); + +int comp_mcux_acmp_set_input_config(const struct device *dev, + const struct comp_mcux_acmp_input_config *config); + +int comp_mcux_acmp_set_filter_config(const struct device *dev, + const struct comp_mcux_acmp_filter_config *config); + +int comp_mcux_acmp_set_dac_config(const struct device *dev, + const struct comp_mcux_acmp_dac_config *config); + +int comp_mcux_acmp_set_dm_config(const struct device *dev, + const struct comp_mcux_acmp_dm_config *config); + +int comp_mcux_acmp_set_window_mode(const struct device *dev, bool enable); + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_DRIVERS_COMP_MCUX_ACMP_H_ */ From 6ed855a53f8f911ba247f4d0c6414030a909df42 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Thu, 5 Sep 2024 13:32:24 +0200 Subject: [PATCH 0614/4482] tests: drivers: build_all: comparator: add mcux_acmp Add mcux_acmp device driver to build_all test suite. Signed-off-by: Bjarki Arge Andreasen --- .../mcux_acmp/mimxrt1176_mux_dac.dts | 46 +++++++++++++++++++ .../mcux_acmp/mimxrt1176_mux_mux.dts | 26 +++++++++++ .../comparator/mcux_acmp/mke15z7_mux_dac.dts | 22 +++++++++ .../comparator/mcux_acmp/mke15z7_mux_mux.dts | 16 +++++++ .../comparator/mcux_acmp/mke15z7_pinctrl.dtsi | 20 ++++++++ .../build_all/comparator/testcase.yaml | 22 +++++++++ 6 files changed, 152 insertions(+) create mode 100644 tests/drivers/build_all/comparator/mcux_acmp/mimxrt1176_mux_dac.dts create mode 100644 tests/drivers/build_all/comparator/mcux_acmp/mimxrt1176_mux_mux.dts create mode 100644 tests/drivers/build_all/comparator/mcux_acmp/mke15z7_mux_dac.dts create mode 100644 tests/drivers/build_all/comparator/mcux_acmp/mke15z7_mux_mux.dts create mode 100644 tests/drivers/build_all/comparator/mcux_acmp/mke15z7_pinctrl.dtsi diff --git a/tests/drivers/build_all/comparator/mcux_acmp/mimxrt1176_mux_dac.dts b/tests/drivers/build_all/comparator/mcux_acmp/mimxrt1176_mux_dac.dts new file mode 100644 index 0000000000000..86ee224d74cd2 --- /dev/null +++ b/tests/drivers/build_all/comparator/mcux_acmp/mimxrt1176_mux_dac.dts @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + acmp1_default: acmp1_default { + group0 { + pinmux = <&iomuxc_gpio_ad_01_acmp1_in2>; + drive-strength = "high"; + bias-pull-up; + slew-rate = "fast"; + }; + }; +}; + +&acmp1 { + status = "okay"; + pinctrl-0 = <&acmp1_default>; + pinctrl-names = "default"; + + positive-mux-input = "IN2"; + positive-port-input = "MUX"; + negative-mux-input = "IN2"; + negative-port-input = "DAC"; + + dac-vref-source = "VIN1"; + dac-value = <128>; + dac-enable; + + offset-mode = "LEVEL0"; + hysteresis-mode = "LEVEL0"; + enable-high-speed-mode; + + filter-enable-sample; + filter-count = <4>; + filter-period = <32>; + + discrete-mode-enable-positive-channel; + discrete-mode-enable-resistor-divider; + discrete-mode-clock-source = "FAST"; + discrete-mode-sample-time = "T1"; + discrete-mode-phase1-time = "ALT4"; + discrete-mode-phase2-time = "ALT7"; +}; diff --git a/tests/drivers/build_all/comparator/mcux_acmp/mimxrt1176_mux_mux.dts b/tests/drivers/build_all/comparator/mcux_acmp/mimxrt1176_mux_mux.dts new file mode 100644 index 0000000000000..a240e8ce4fb94 --- /dev/null +++ b/tests/drivers/build_all/comparator/mcux_acmp/mimxrt1176_mux_mux.dts @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + acmp1_default: acmp1_default { + group0 { + pinmux = <&iomuxc_gpio_ad_00_acmp1_in1>, + <&iomuxc_gpio_ad_01_acmp1_in2>; + drive-strength = "high"; + bias-pull-up; + slew-rate = "fast"; + }; + }; +}; + +&acmp1 { + status = "okay"; + pinctrl-0 = <&acmp1_default>; + pinctrl-names = "default"; + + positive-mux-input = "IN1"; + negative-mux-input = "IN2"; +}; diff --git a/tests/drivers/build_all/comparator/mcux_acmp/mke15z7_mux_dac.dts b/tests/drivers/build_all/comparator/mcux_acmp/mke15z7_mux_dac.dts new file mode 100644 index 0000000000000..23f8bb7c4fd33 --- /dev/null +++ b/tests/drivers/build_all/comparator/mcux_acmp/mke15z7_mux_dac.dts @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "mke15z7_pinctrl.dtsi" + +&cmp0 { + pinctrl-0 = <&cmp0_default>; + pinctrl-names = "default"; + status = "okay"; + + positive-mux-input = "IN0"; + positive-port-input = "MUX"; + negative-mux-input = "IN0"; + negative-port-input = "DAC"; + + dac-vref-source = "VIN1"; + dac-value = <128>; + dac-enable; +}; diff --git a/tests/drivers/build_all/comparator/mcux_acmp/mke15z7_mux_mux.dts b/tests/drivers/build_all/comparator/mcux_acmp/mke15z7_mux_mux.dts new file mode 100644 index 0000000000000..61e0353d5db1c --- /dev/null +++ b/tests/drivers/build_all/comparator/mcux_acmp/mke15z7_mux_mux.dts @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "mke15z7_pinctrl.dtsi" + +&cmp0 { + pinctrl-0 = <&cmp0_default>; + pinctrl-names = "default"; + status = "okay"; + + positive-mux-input = "IN0"; + negative-mux-input = "IN1"; +}; diff --git a/tests/drivers/build_all/comparator/mcux_acmp/mke15z7_pinctrl.dtsi b/tests/drivers/build_all/comparator/mcux_acmp/mke15z7_pinctrl.dtsi new file mode 100644 index 0000000000000..62bddf7b924d6 --- /dev/null +++ b/tests/drivers/build_all/comparator/mcux_acmp/mke15z7_pinctrl.dtsi @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&pinctrl { + cmp0_default: cmp0_default { + group0 { + pinmux = , + , + , + ; + + drive-strength = "high"; + }; + }; +}; diff --git a/tests/drivers/build_all/comparator/testcase.yaml b/tests/drivers/build_all/comparator/testcase.yaml index 8dbc9dfb32a39..a0578daa9ff5a 100644 --- a/tests/drivers/build_all/comparator/testcase.yaml +++ b/tests/drivers/build_all/comparator/testcase.yaml @@ -66,3 +66,25 @@ tests: - nrf54h20dk/nrf54h20/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf9280pdk/nrf9280/cpuapp + drivers.build_all.comparator.mcux_acmp.mimxrt1176_mux_dac: + extra_args: + - DTC_OVERLAY_FILE="mcux_acmp/mimxrt1176_mux_dac.dts" + platform_allow: + - mimxrt1170_evk/mimxrt1176/cm4 + - mimxrt1170_evk/mimxrt1176/cm7 + drivers.build_all.comparator.mcux_acmp.mimxrt1176_mux_mux: + extra_args: + - DTC_OVERLAY_FILE="mcux_acmp/mimxrt1176_mux_mux.dts" + platform_allow: + - mimxrt1170_evk/mimxrt1176/cm4 + - mimxrt1170_evk/mimxrt1176/cm7 + drivers.build_all.comparator.mcux_acmp.mke15z7_mux_dac: + extra_args: + - DTC_OVERLAY_FILE="mcux_acmp/mke15z7_mux_dac.dts" + platform_allow: + - frdm_ke15z + drivers.build_all.comparator.mcux_acmp.mke15z7_mux_mux: + extra_args: + - DTC_OVERLAY_FILE="mcux_acmp/mke15z7_mux_mux.dts" + platform_allow: + - frdm_ke15z From b7648f89c460641b34dfd90101bf995d584e8c7e Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Sun, 1 Sep 2024 17:35:19 +0200 Subject: [PATCH 0615/4482] drivers: comparator: add shell Add shell for comparator device drivers. Signed-off-by: Bjarki Arge Andreasen --- drivers/comparator/CMakeLists.txt | 1 + drivers/comparator/Kconfig | 1 + drivers/comparator/Kconfig.shell | 21 ++ drivers/comparator/comparator_shell.c | 279 ++++++++++++++++++++++++++ 4 files changed, 302 insertions(+) create mode 100644 drivers/comparator/Kconfig.shell create mode 100644 drivers/comparator/comparator_shell.c diff --git a/drivers/comparator/CMakeLists.txt b/drivers/comparator/CMakeLists.txt index b5fe633a333b2..f4378c76a776f 100644 --- a/drivers/comparator/CMakeLists.txt +++ b/drivers/comparator/CMakeLists.txt @@ -9,3 +9,4 @@ zephyr_library_sources_ifdef(CONFIG_USERSPACE comparator_handlers.c) zephyr_library_sources_ifdef(CONFIG_COMPARATOR_MCUX_ACMP comparator_mcux_acmp.c) zephyr_library_sources_ifdef(CONFIG_COMPARATOR_NRF_COMP comparator_nrf_comp.c) zephyr_library_sources_ifdef(CONFIG_COMPARATOR_NRF_LPCOMP comparator_nrf_lpcomp.c) +zephyr_library_sources_ifdef(CONFIG_COMPARATOR_SHELL comparator_shell.c) diff --git a/drivers/comparator/Kconfig b/drivers/comparator/Kconfig index 871ee5d9ed673..f49ff18256263 100644 --- a/drivers/comparator/Kconfig +++ b/drivers/comparator/Kconfig @@ -21,5 +21,6 @@ config COMPARATOR_INIT_PRIORITY rsource "Kconfig.mcux_acmp" rsource "Kconfig.nrf_comp" rsource "Kconfig.nrf_lpcomp" +rsource "Kconfig.shell" endif # COMPARATOR diff --git a/drivers/comparator/Kconfig.shell b/drivers/comparator/Kconfig.shell new file mode 100644 index 0000000000000..de244619be33b --- /dev/null +++ b/drivers/comparator/Kconfig.shell @@ -0,0 +1,21 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config COMPARATOR_SHELL + bool "Comparator shell" + default y + depends on SHELL + help + Comparator device driver shell. + +if COMPARATOR_SHELL + +config COMPARATOR_SHELL_AWAIT_TRIGGER_DEFAULT_TIMEOUT + int "Default timeout for await_trigger command in seconds" + default 10 + +config COMPARATOR_SHELL_AWAIT_TRIGGER_MAX_TIMEOUT + int "Max timeout for await_trigger command in seconds" + default 60 + +endif # COMPARATOR_SHELL diff --git a/drivers/comparator/comparator_shell.c b/drivers/comparator/comparator_shell.c new file mode 100644 index 0000000000000..2d74753087166 --- /dev/null +++ b/drivers/comparator/comparator_shell.c @@ -0,0 +1,279 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#include + +#define AWAIT_TRIGGER_DEFAULT_TIMEOUT \ + CONFIG_COMPARATOR_SHELL_AWAIT_TRIGGER_DEFAULT_TIMEOUT + +#define AWAIT_TRIGGER_MAX_TIMEOUT \ + CONFIG_COMPARATOR_SHELL_AWAIT_TRIGGER_MAX_TIMEOUT + +/* Mapped 1-1 to enum comparator_trigger */ +static const char *const trigger_lookup[] = { + "NONE", + "RISING_EDGE", + "FALLING_EDGE", + "BOTH_EDGES", +}; + +static K_SEM_DEFINE(triggered_sem, 0, 1); + +static int get_device_from_str(const struct shell *sh, + const char *dev_str, + const struct device **dev) +{ + *dev = device_get_binding(dev_str); + + if (*dev == NULL) { + shell_error(sh, "%s not %s", dev_str, "found"); + return -ENODEV; + } + + if (!device_is_ready(*dev)) { + shell_error(sh, "%s not %s", dev_str, "ready"); + return -ENODEV; + } + + return 0; +} + +static int cmd_get_output(const struct shell *sh, size_t argc, char **argv) +{ + int ret; + const char *dev_str; + const struct device *dev; + + ARG_UNUSED(argc); + + dev_str = argv[1]; + ret = get_device_from_str(sh, dev_str, &dev); + if (ret < 0) { + return ret; + } + + ret = comparator_get_output(dev); + if (ret < 0) { + shell_error(sh, "failed to %s %s", "get", "output"); + return -EIO; + } + + shell_print(sh, "%i", ret); + return 0; +} + +static int get_trigger_from_str(const struct shell *sh, + const char *trigger_str, + enum comparator_trigger *trigger) +{ + ARRAY_FOR_EACH(trigger_lookup, i) { + if (strcmp(trigger_lookup[i], trigger_str) == 0) { + *trigger = (enum comparator_trigger)i; + return 0; + } + } + + shell_error(sh, "%s not %s", trigger_str, "valid"); + return -EINVAL; +} + +static int cmd_set_trigger(const struct shell *sh, size_t argc, char **argv) +{ + const char *dev_str; + const char *trigger_str; + int ret; + const struct device *dev; + enum comparator_trigger trigger; + + ARG_UNUSED(argc); + + dev_str = argv[1]; + ret = get_device_from_str(sh, dev_str, &dev); + if (ret < 0) { + return ret; + } + + trigger_str = argv[2]; + ret = get_trigger_from_str(sh, trigger_str, &trigger); + if (ret < 0) { + return ret; + } + + ret = comparator_set_trigger(dev, trigger); + if (ret < 0) { + shell_error(sh, "failed to %s %s", "set", "trigger"); + return -EIO; + } + + return 0; +} + +static int get_timeout_from_str(const struct shell *sh, + const char *timeout_str, + k_timeout_t *timeout) +{ + long seconds; + char *end; + + seconds = strtol(timeout_str, &end, 10); + if ((*end != '\0') || + (seconds < 1) || + (seconds > AWAIT_TRIGGER_MAX_TIMEOUT)) { + shell_error(sh, "%s not %s", timeout_str, "valid"); + return -EINVAL; + } + + *timeout = K_SECONDS(seconds); + return 0; +} + +static void trigger_cb(const struct device *dev, void *user_data) +{ + ARG_UNUSED(dev); + ARG_UNUSED(user_data); + + k_sem_give(&triggered_sem); +} + +static int cmd_await_trigger(const struct shell *sh, size_t argc, char **argv) +{ + const char *dev_str; + const char *timeout_str; + int ret; + const struct device *dev; + k_timeout_t timeout; + + dev_str = argv[1]; + ret = get_device_from_str(sh, dev_str, &dev); + if (ret < 0) { + return ret; + } + + if (argc == 3) { + timeout_str = argv[2]; + ret = get_timeout_from_str(sh, timeout_str, &timeout); + if (ret < 0) { + return ret; + } + } else { + timeout = K_SECONDS(AWAIT_TRIGGER_DEFAULT_TIMEOUT); + } + + k_sem_reset(&triggered_sem); + + ret = comparator_set_trigger_callback(dev, trigger_cb, NULL); + if (ret < 0) { + shell_error(sh, "failed to %s %s", "set", "trigger callback"); + return -EIO; + } + + ret = k_sem_take(&triggered_sem, timeout); + if (ret == 0) { + shell_print(sh, "triggered"); + } else if (ret == -EAGAIN) { + shell_print(sh, "timed out"); + } else { + shell_error(sh, "internal error"); + } + + ret = comparator_set_trigger_callback(dev, NULL, NULL); + if (ret < 0) { + shell_error(sh, "failed to %s %s", "clear", "trigger callback"); + return -EIO; + } + + return 0; +} + +static int cmd_trigger_is_pending(const struct shell *sh, size_t argc, char **argv) +{ + int ret; + const char *dev_str; + const struct device *dev; + + ARG_UNUSED(argc); + + dev_str = argv[1]; + ret = get_device_from_str(sh, dev_str, &dev); + if (ret < 0) { + return ret; + } + + ret = comparator_trigger_is_pending(dev); + if (ret < 0) { + shell_error(sh, "failed to %s %s", "get", "trigger status"); + return -EIO; + } + + shell_print(sh, "%i", ret); + return 0; +} + +static void dsub_set_trigger_lookup_1(size_t idx, struct shell_static_entry *entry) +{ + entry->syntax = (idx < ARRAY_SIZE(trigger_lookup)) ? trigger_lookup[idx] : NULL; + entry->handler = NULL; + entry->help = NULL; + entry->subcmd = NULL; +} + +SHELL_DYNAMIC_CMD_CREATE(dsub_set_trigger_1, dsub_set_trigger_lookup_1); + +static void dsub_set_trigger_lookup_0(size_t idx, struct shell_static_entry *entry) +{ + const struct device *dev = shell_device_lookup(idx, NULL); + + entry->syntax = dev != NULL ? dev->name : NULL; + entry->handler = NULL; + entry->help = NULL; + entry->subcmd = &dsub_set_trigger_1; +} + +SHELL_DYNAMIC_CMD_CREATE(dsub_set_trigger_0, dsub_set_trigger_lookup_0); + +static void dsub_device_lookup_0(size_t idx, struct shell_static_entry *entry) +{ + const struct device *dev = shell_device_lookup(idx, NULL); + + entry->syntax = (dev != NULL) ? dev->name : NULL; + entry->handler = NULL; + entry->help = NULL; + entry->subcmd = NULL; +} + +SHELL_DYNAMIC_CMD_CREATE(dsub_device_0, dsub_device_lookup_0); + +#define GET_OUTPUT_HELP \ + ("comp get_output ") + +#define SET_TRIGGER_HELP \ + ("comp set_trigger ") + +#define AWAIT_TRIGGER_HELP \ + ("comp await_trigger [timeout] (default " \ + STRINGIFY(AWAIT_TRIGGER_DEFAULT_TIMEOUT) \ + "s, max " \ + STRINGIFY(AWAIT_TRIGGER_MAX_TIMEOUT) \ + "s)") + +#define TRIGGER_PENDING_HELP \ + ("comp trigger_is_pending ") + +SHELL_STATIC_SUBCMD_SET_CREATE( + sub_comp, + SHELL_CMD_ARG(get_output, &dsub_device_0, GET_OUTPUT_HELP, cmd_get_output, 2, 0), + SHELL_CMD_ARG(set_trigger, &dsub_set_trigger_0, SET_TRIGGER_HELP, cmd_set_trigger, 3, 0), + SHELL_CMD_ARG(await_trigger, &dsub_device_0, AWAIT_TRIGGER_HELP, cmd_await_trigger, 2, 1), + SHELL_CMD_ARG(trigger_is_pending, &dsub_device_0, TRIGGER_PENDING_HELP, + cmd_trigger_is_pending, 2, 1), + SHELL_SUBCMD_SET_END +); + +SHELL_CMD_REGISTER(comp, &sub_comp, "Comparator device commands", NULL); From 2fbe105a473bf58747cf868bfb8c3b3daf7ab089 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 6 Sep 2024 10:51:31 +0200 Subject: [PATCH 0616/4482] drivers: comparator: add fake comparator Add fake comparator driver and bindings for use with testing. Signed-off-by: Bjarki Arge Andreasen --- drivers/comparator/CMakeLists.txt | 1 + drivers/comparator/Kconfig | 1 + drivers/comparator/Kconfig.fake_comp | 8 +++ drivers/comparator/comparator_fake_comp.c | 65 +++++++++++++++++++ dts/bindings/comparator/zephyr,comp-fake.yaml | 8 +++ include/zephyr/drivers/comparator/fake_comp.h | 40 ++++++++++++ 6 files changed, 123 insertions(+) create mode 100644 drivers/comparator/Kconfig.fake_comp create mode 100644 drivers/comparator/comparator_fake_comp.c create mode 100644 dts/bindings/comparator/zephyr,comp-fake.yaml create mode 100644 include/zephyr/drivers/comparator/fake_comp.h diff --git a/drivers/comparator/CMakeLists.txt b/drivers/comparator/CMakeLists.txt index f4378c76a776f..43462d64288ac 100644 --- a/drivers/comparator/CMakeLists.txt +++ b/drivers/comparator/CMakeLists.txt @@ -6,6 +6,7 @@ zephyr_syscall_header(${ZEPHYR_BASE}/include/zephyr/drivers/comparator.h) zephyr_library() zephyr_library_sources_ifdef(CONFIG_USERSPACE comparator_handlers.c) +zephyr_library_sources_ifdef(CONFIG_COMPARATOR_FAKE_COMP comparator_fake_comp.c) zephyr_library_sources_ifdef(CONFIG_COMPARATOR_MCUX_ACMP comparator_mcux_acmp.c) zephyr_library_sources_ifdef(CONFIG_COMPARATOR_NRF_COMP comparator_nrf_comp.c) zephyr_library_sources_ifdef(CONFIG_COMPARATOR_NRF_LPCOMP comparator_nrf_lpcomp.c) diff --git a/drivers/comparator/Kconfig b/drivers/comparator/Kconfig index f49ff18256263..978adc0325173 100644 --- a/drivers/comparator/Kconfig +++ b/drivers/comparator/Kconfig @@ -18,6 +18,7 @@ config COMPARATOR_INIT_PRIORITY help Comparator device driver initialization priority. +rsource "Kconfig.fake_comp" rsource "Kconfig.mcux_acmp" rsource "Kconfig.nrf_comp" rsource "Kconfig.nrf_lpcomp" diff --git a/drivers/comparator/Kconfig.fake_comp b/drivers/comparator/Kconfig.fake_comp new file mode 100644 index 0000000000000..5fca8db187807 --- /dev/null +++ b/drivers/comparator/Kconfig.fake_comp @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config COMPARATOR_FAKE_COMP + bool "Fake comparator driver" + default y + depends on DT_HAS_ZEPHYR_FAKE_COMP_ENABLED + depends on ZTEST diff --git a/drivers/comparator/comparator_fake_comp.c b/drivers/comparator/comparator_fake_comp.c new file mode 100644 index 0000000000000..85abbad21743e --- /dev/null +++ b/drivers/comparator/comparator_fake_comp.c @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#ifdef CONFIG_ZTEST +#include +#endif + +#define DT_DRV_COMPAT zephyr_fake_comp + +DEFINE_FAKE_VALUE_FUNC(int, + comp_fake_comp_get_output, + const struct device *); + +DEFINE_FAKE_VALUE_FUNC(int, + comp_fake_comp_set_trigger, + const struct device *, + enum comparator_trigger); + +DEFINE_FAKE_VALUE_FUNC(int, + comp_fake_comp_set_trigger_callback, + const struct device *, + comparator_callback_t, + void *); + +DEFINE_FAKE_VALUE_FUNC(int, + comp_fake_comp_trigger_is_pending, + const struct device *); + +static const struct comparator_driver_api fake_comp_api = { + .get_output = comp_fake_comp_get_output, + .set_trigger = comp_fake_comp_set_trigger, + .set_trigger_callback = comp_fake_comp_set_trigger_callback, + .trigger_is_pending = comp_fake_comp_trigger_is_pending, +}; + +#ifdef CONFIG_ZTEST +static void fake_comp_reset_rule_before(const struct ztest_unit_test *test, void *fixture) +{ + ARG_UNUSED(test); + ARG_UNUSED(fixture); + + RESET_FAKE(comp_fake_comp_get_output); + RESET_FAKE(comp_fake_comp_set_trigger); + RESET_FAKE(comp_fake_comp_set_trigger_callback); + RESET_FAKE(comp_fake_comp_trigger_is_pending); +} + +ZTEST_RULE(comp_fake_comp_reset_rule, fake_comp_reset_rule_before, NULL); +#endif + +DEVICE_DT_INST_DEFINE( + 0, + NULL, + NULL, + NULL, + NULL, + POST_KERNEL, + CONFIG_COMPARATOR_INIT_PRIORITY, + &fake_comp_api +); diff --git a/dts/bindings/comparator/zephyr,comp-fake.yaml b/dts/bindings/comparator/zephyr,comp-fake.yaml new file mode 100644 index 0000000000000..ac344f4639cb7 --- /dev/null +++ b/dts/bindings/comparator/zephyr,comp-fake.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Fake comparator device used as stub or mock for testing + +compatible: "zephyr,fake-comp" + +include: base.yaml diff --git a/include/zephyr/drivers/comparator/fake_comp.h b/include/zephyr/drivers/comparator/fake_comp.h new file mode 100644 index 0000000000000..c24858c1997e1 --- /dev/null +++ b/include/zephyr/drivers/comparator/fake_comp.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_DRIVERS_COMPARATOR_FAKE_H_ +#define ZEPHYR_INCLUDE_DRIVERS_COMPARATOR_FAKE_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +DECLARE_FAKE_VALUE_FUNC(int, + comp_fake_comp_get_output, + const struct device *); + +DECLARE_FAKE_VALUE_FUNC(int, + comp_fake_comp_set_trigger, + const struct device *, + enum comparator_trigger); + +DECLARE_FAKE_VALUE_FUNC(int, + comp_fake_comp_set_trigger_callback, + const struct device *, + comparator_callback_t, + void *); + +DECLARE_FAKE_VALUE_FUNC(int, + comp_fake_comp_trigger_is_pending, + const struct device *); + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_DRIVERS_COMPARATOR_FAKE_H_ */ From 4ff9886e48a31b79da35a4fbc465cfb5735984ce Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Sun, 15 Sep 2024 18:06:37 +0200 Subject: [PATCH 0617/4482] tests: drivers: comparator: add shell test suite Add test suite for comparator device driver shell. Signed-off-by: Bjarki Arge Andreasen --- tests/drivers/comparator/shell/CMakeLists.txt | 8 + tests/drivers/comparator/shell/app.overlay | 12 + tests/drivers/comparator/shell/prj.conf | 10 + tests/drivers/comparator/shell/src/test.c | 357 ++++++++++++++++++ tests/drivers/comparator/shell/testcase.yaml | 12 + 5 files changed, 399 insertions(+) create mode 100644 tests/drivers/comparator/shell/CMakeLists.txt create mode 100644 tests/drivers/comparator/shell/app.overlay create mode 100644 tests/drivers/comparator/shell/prj.conf create mode 100644 tests/drivers/comparator/shell/src/test.c create mode 100644 tests/drivers/comparator/shell/testcase.yaml diff --git a/tests/drivers/comparator/shell/CMakeLists.txt b/tests/drivers/comparator/shell/CMakeLists.txt new file mode 100644 index 0000000000000..c2f34f71e6856 --- /dev/null +++ b/tests/drivers/comparator/shell/CMakeLists.txt @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(comparator_shell) + +target_sources(app PRIVATE src/test.c) diff --git a/tests/drivers/comparator/shell/app.overlay b/tests/drivers/comparator/shell/app.overlay new file mode 100644 index 0000000000000..3bb03b5a569e5 --- /dev/null +++ b/tests/drivers/comparator/shell/app.overlay @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/{ + fake_comp: fake_comp { + compatible = "zephyr,fake-comp"; + status = "okay"; + }; +}; diff --git a/tests/drivers/comparator/shell/prj.conf b/tests/drivers/comparator/shell/prj.conf new file mode 100644 index 0000000000000..a1eb4324cee17 --- /dev/null +++ b/tests/drivers/comparator/shell/prj.conf @@ -0,0 +1,10 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SHELL=y +CONFIG_SHELL_BACKEND_SERIAL=n +CONFIG_SHELL_VT100_COMMANDS=n +CONFIG_SHELL_BACKEND_DUMMY=y +CONFIG_COMPARATOR=y +CONFIG_COMPARATOR_SHELL=y +CONFIG_ZTEST=y diff --git a/tests/drivers/comparator/shell/src/test.c b/tests/drivers/comparator/shell/src/test.c new file mode 100644 index 0000000000000..dacefc9311a14 --- /dev/null +++ b/tests/drivers/comparator/shell/src/test.c @@ -0,0 +1,357 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include + +DEFINE_FFF_GLOBALS; + +#define FAKE_COMP_NODE DT_NODELABEL(fake_comp) +#define FAKE_COMP_NAME DEVICE_DT_NAME(FAKE_COMP_NODE) + +#define TEST_TRIGGER_DELAY K_SECONDS(1) + +#define TEST_AWAIT_TRIGGER_TIMEOUT_BELOW_MIN_CMD \ + ("comp await_trigger " FAKE_COMP_NAME " 0") + +#define TEST_AWAIT_TRIGGER_TIMEOUT_ABOVE_MAX_CMD \ + ("comp await_trigger " FAKE_COMP_NAME " " \ + STRINGIFY(CONFIG_COMPARATOR_SHELL_AWAIT_TRIGGER_MAX_TIMEOUT + 1)) + +#define TEST_AWAIT_TRIGGER_TIMEOUT_BROKEN_CMD \ + ("comp await_trigger " FAKE_COMP_NAME " d") + +static const struct shell *test_sh; +static const struct device *test_dev = DEVICE_DT_GET(FAKE_COMP_NODE); +static comparator_callback_t test_callback; +static void *test_callback_user_data; +static struct k_spinlock test_callback_spinlock; +static struct k_work_delayable test_trigger_dwork; + +static int test_get_output_stub_1(const struct device *dev) +{ + ARG_UNUSED(dev); + + return 1; +} + +static int test_get_output_stub_0(const struct device *dev) +{ + ARG_UNUSED(dev); + + return 0; +} + +static int test_get_output_stub_eio(const struct device *dev) +{ + ARG_UNUSED(dev); + + return -EIO; +} + +static int test_set_trigger_stub_ok(const struct device *dev, enum comparator_trigger trigger) +{ + ARG_UNUSED(dev); + ARG_UNUSED(trigger); + + return 0; +} + +static int test_set_trigger_stub_eio(const struct device *dev, enum comparator_trigger trigger) +{ + ARG_UNUSED(dev); + ARG_UNUSED(trigger); + + return -EIO; +} + +static int test_set_trigger_callback_mock_0(const struct device *dev, + comparator_callback_t callback, + void *user_data) +{ + ARG_UNUSED(dev); + + K_SPINLOCK(&test_callback_spinlock) { + test_callback = callback; + test_callback_user_data = user_data; + } + + return 0; +} + +static int test_set_trigger_callback_stub_0(const struct device *dev, + comparator_callback_t callback, + void *user_data) +{ + ARG_UNUSED(dev); + ARG_UNUSED(callback); + ARG_UNUSED(user_data); + + return 0; +} + +static int test_set_trigger_callback_stub_eio(const struct device *dev, + comparator_callback_t callback, + void *user_data) +{ + ARG_UNUSED(dev); + ARG_UNUSED(callback); + ARG_UNUSED(user_data); + + return -EIO; +} + +static int test_trigger_is_pending_stub_1(const struct device *dev) +{ + ARG_UNUSED(dev); + + return 1; +} + +static int test_trigger_is_pending_stub_0(const struct device *dev) +{ + ARG_UNUSED(dev); + + return 0; +} + +static int test_trigger_is_pending_stub_eio(const struct device *dev) +{ + ARG_UNUSED(dev); + + return -EIO; +} + + +static void test_trigger_handler(struct k_work *work) +{ + ARG_UNUSED(work); + + test_callback(test_dev, test_callback_user_data); +} + +static void test_schedule_trigger(void) +{ + k_work_schedule(&test_trigger_dwork, TEST_TRIGGER_DELAY); +} + +static void test_cancel_trigger(void) +{ + struct k_work_sync sync; + + k_work_cancel_delayable_sync(&test_trigger_dwork, &sync); +} + +static void *test_setup(void) +{ + k_work_init_delayable(&test_trigger_dwork, test_trigger_handler); + test_sh = shell_backend_dummy_get_ptr(); + WAIT_FOR(shell_ready(test_sh), 20000, k_msleep(1)); + zassert_true(shell_ready(test_sh), "timed out waiting for dummy shell backend"); + return NULL; +} + +static void test_after(void *f) +{ + ARG_UNUSED(f); + + test_cancel_trigger(); +} + +ZTEST(comparator_shell, test_get_output) +{ + int ret; + const char *out; + size_t out_size; + + shell_backend_dummy_clear_output(test_sh); + comp_fake_comp_get_output_fake.custom_fake = test_get_output_stub_1; + ret = shell_execute_cmd(test_sh, "comp get_output " FAKE_COMP_NAME); + zassert_ok(ret); + zassert_equal(comp_fake_comp_get_output_fake.call_count, 1); + zassert_equal(comp_fake_comp_get_output_fake.arg0_val, test_dev); + out = shell_backend_dummy_get_output(test_sh, &out_size); + zassert_str_equal(out, "\r\n1\r\n"); + + comp_fake_comp_get_output_fake.custom_fake = test_get_output_stub_0; + ret = shell_execute_cmd(test_sh, "comp get_output " FAKE_COMP_NAME); + zassert_ok(ret); + zassert_equal(comp_fake_comp_get_output_fake.call_count, 2); + zassert_equal(comp_fake_comp_get_output_fake.arg0_val, test_dev); + out = shell_backend_dummy_get_output(test_sh, &out_size); + zassert_str_equal(out, "\r\n0\r\n"); + + comp_fake_comp_get_output_fake.custom_fake = test_get_output_stub_eio; + ret = shell_execute_cmd(test_sh, "comp get_output " FAKE_COMP_NAME); + zassert_equal(ret, -EIO); + zassert_equal(comp_fake_comp_get_output_fake.call_count, 3); + zassert_equal(comp_fake_comp_get_output_fake.arg0_val, test_dev); + out = shell_backend_dummy_get_output(test_sh, &out_size); + zassert_str_equal(out, "\r\nfailed to get output\r\n"); +} + +ZTEST(comparator_shell, test_set_trigger) +{ + int ret; + const char *out; + size_t out_size; + + comp_fake_comp_set_trigger_fake.custom_fake = test_set_trigger_stub_ok; + + ret = shell_execute_cmd(test_sh, "comp set_trigger " FAKE_COMP_NAME " NONE"); + zassert_ok(ret); + zassert_equal(comp_fake_comp_set_trigger_fake.call_count, 1); + zassert_equal(comp_fake_comp_set_trigger_fake.arg0_val, test_dev); + zassert_equal(comp_fake_comp_set_trigger_fake.arg1_val, COMPARATOR_TRIGGER_NONE); + + ret = shell_execute_cmd(test_sh, "comp set_trigger " FAKE_COMP_NAME " RISING_EDGE"); + zassert_ok(ret); + zassert_equal(comp_fake_comp_set_trigger_fake.call_count, 2); + zassert_equal(comp_fake_comp_set_trigger_fake.arg0_val, test_dev); + zassert_equal(comp_fake_comp_set_trigger_fake.arg1_val, COMPARATOR_TRIGGER_RISING_EDGE); + + ret = shell_execute_cmd(test_sh, "comp set_trigger " FAKE_COMP_NAME " FALLING_EDGE"); + zassert_ok(ret); + zassert_equal(comp_fake_comp_set_trigger_fake.call_count, 3); + zassert_equal(comp_fake_comp_set_trigger_fake.arg0_val, test_dev); + zassert_equal(comp_fake_comp_set_trigger_fake.arg1_val, COMPARATOR_TRIGGER_FALLING_EDGE); + + ret = shell_execute_cmd(test_sh, "comp set_trigger " FAKE_COMP_NAME " BOTH_EDGES"); + zassert_ok(ret); + zassert_equal(comp_fake_comp_set_trigger_fake.call_count, 4); + zassert_equal(comp_fake_comp_set_trigger_fake.arg0_val, test_dev); + zassert_equal(comp_fake_comp_set_trigger_fake.arg1_val, COMPARATOR_TRIGGER_BOTH_EDGES); + + ret = shell_execute_cmd(test_sh, "comp set_trigger " FAKE_COMP_NAME " INVALID"); + zassert_equal(ret, -EINVAL); + zassert_equal(comp_fake_comp_set_trigger_fake.call_count, 4); + + comp_fake_comp_set_trigger_fake.custom_fake = test_set_trigger_stub_eio; + + shell_backend_dummy_clear_output(test_sh); + ret = shell_execute_cmd(test_sh, "comp set_trigger " FAKE_COMP_NAME " BOTH_EDGES"); + zassert_equal(ret, -EIO); + zassert_equal(comp_fake_comp_set_trigger_fake.call_count, 5); + zassert_equal(comp_fake_comp_set_trigger_fake.arg0_val, test_dev); + zassert_equal(comp_fake_comp_set_trigger_fake.arg1_val, COMPARATOR_TRIGGER_BOTH_EDGES); + out = shell_backend_dummy_get_output(test_sh, &out_size); + zassert_str_equal(out, "\r\nfailed to set trigger\r\n"); +} + +ZTEST(comparator_shell, test_await_trigger_set_callback_fail) +{ + int ret; + const char *out; + size_t out_size; + + shell_backend_dummy_clear_output(test_sh); + comp_fake_comp_set_trigger_callback_fake.custom_fake = test_set_trigger_callback_stub_eio; + ret = shell_execute_cmd(test_sh, "comp await_trigger " FAKE_COMP_NAME); + zassert_ok(0); + zassert_equal(comp_fake_comp_set_trigger_callback_fake.call_count, 1); + zassert_equal(comp_fake_comp_set_trigger_callback_fake.return_val, 0); + out = shell_backend_dummy_get_output(test_sh, &out_size); + zassert_str_equal(out, "\r\nfailed to set trigger callback\r\n"); +} + +ZTEST(comparator_shell, test_await_trigger_timeout) +{ + int ret; + const char *out; + size_t out_size; + + shell_backend_dummy_clear_output(test_sh); + comp_fake_comp_set_trigger_callback_fake.custom_fake = test_set_trigger_callback_stub_0; + ret = shell_execute_cmd(test_sh, "comp await_trigger " FAKE_COMP_NAME); + zassert_ok(0); + zassert_equal(comp_fake_comp_set_trigger_callback_fake.call_count, 2); + zassert_equal(comp_fake_comp_set_trigger_callback_fake.return_val_history[0], 0); + zassert_equal(comp_fake_comp_set_trigger_callback_fake.return_val_history[1], 0); + out = shell_backend_dummy_get_output(test_sh, &out_size); + zassert_str_equal(out, "\r\ntimed out\r\n"); +} + +ZTEST(comparator_shell, test_await_trigger_invalid_timeout_arg) +{ + int ret; + + ret = shell_execute_cmd(test_sh, TEST_AWAIT_TRIGGER_TIMEOUT_BELOW_MIN_CMD); + zassert_not_ok(ret); + zassert_equal(comp_fake_comp_set_trigger_callback_fake.call_count, 0); + + ret = shell_execute_cmd(test_sh, TEST_AWAIT_TRIGGER_TIMEOUT_ABOVE_MAX_CMD); + zassert_not_ok(ret); + zassert_equal(comp_fake_comp_set_trigger_callback_fake.call_count, 0); + + ret = shell_execute_cmd(test_sh, TEST_AWAIT_TRIGGER_TIMEOUT_BROKEN_CMD); + zassert_not_ok(ret); + zassert_equal(comp_fake_comp_set_trigger_callback_fake.call_count, 0); +} + +ZTEST(comparator_shell, test_await_trigger) +{ + int ret; + const char *out; + size_t out_size; + comparator_api_set_trigger_callback seq[2]; + + shell_backend_dummy_clear_output(test_sh); + seq[0] = test_set_trigger_callback_mock_0; + seq[1] = test_set_trigger_callback_stub_0; + comp_fake_comp_set_trigger_callback_fake.custom_fake_seq = seq; + comp_fake_comp_set_trigger_callback_fake.custom_fake_seq_len = ARRAY_SIZE(seq); + test_schedule_trigger(); + ret = shell_execute_cmd(test_sh, "comp await_trigger " FAKE_COMP_NAME); + zassert_ok(0); + zassert_equal(comp_fake_comp_set_trigger_callback_fake.call_count, 2); + zassert_equal(comp_fake_comp_set_trigger_callback_fake.arg0_history[0], test_dev); + zassert_not_equal(comp_fake_comp_set_trigger_callback_fake.arg1_history[0], NULL); + zassert_equal(comp_fake_comp_set_trigger_callback_fake.return_val_history[0], 0); + zassert_equal(comp_fake_comp_set_trigger_callback_fake.arg0_history[1], test_dev); + zassert_equal(comp_fake_comp_set_trigger_callback_fake.arg1_history[1], NULL); + zassert_equal(comp_fake_comp_set_trigger_callback_fake.return_val_history[1], 0); + out = shell_backend_dummy_get_output(test_sh, &out_size); + zassert_str_equal(out, "\r\ntriggered\r\n"); +} + +ZTEST(comparator_shell, test_trigger_is_pending) +{ + int ret; + const char *out; + size_t out_size; + + shell_backend_dummy_clear_output(test_sh); + comp_fake_comp_trigger_is_pending_fake.custom_fake = test_trigger_is_pending_stub_1; + ret = shell_execute_cmd(test_sh, "comp trigger_is_pending " FAKE_COMP_NAME); + zassert_ok(ret); + zassert_equal(comp_fake_comp_trigger_is_pending_fake.call_count, 1); + zassert_equal(comp_fake_comp_trigger_is_pending_fake.arg0_val, test_dev); + out = shell_backend_dummy_get_output(test_sh, &out_size); + zassert_str_equal(out, "\r\n1\r\n"); + + comp_fake_comp_trigger_is_pending_fake.custom_fake = test_trigger_is_pending_stub_0; + ret = shell_execute_cmd(test_sh, "comp trigger_is_pending " FAKE_COMP_NAME); + zassert_ok(ret); + zassert_equal(comp_fake_comp_trigger_is_pending_fake.call_count, 2); + zassert_equal(comp_fake_comp_trigger_is_pending_fake.arg0_val, test_dev); + out = shell_backend_dummy_get_output(test_sh, &out_size); + zassert_str_equal(out, "\r\n0\r\n"); + + comp_fake_comp_trigger_is_pending_fake.custom_fake = test_trigger_is_pending_stub_eio; + ret = shell_execute_cmd(test_sh, "comp trigger_is_pending " FAKE_COMP_NAME); + zassert_equal(ret, -EIO); + zassert_equal(comp_fake_comp_trigger_is_pending_fake.call_count, 3); + zassert_equal(comp_fake_comp_trigger_is_pending_fake.arg0_val, test_dev); + out = shell_backend_dummy_get_output(test_sh, &out_size); + zassert_str_equal(out, "\r\nfailed to get trigger status\r\n"); +} + +ZTEST_SUITE(comparator_shell, NULL, test_setup, test_after, NULL, NULL); diff --git a/tests/drivers/comparator/shell/testcase.yaml b/tests/drivers/comparator/shell/testcase.yaml new file mode 100644 index 0000000000000..9fa6249c8337f --- /dev/null +++ b/tests/drivers/comparator/shell/testcase.yaml @@ -0,0 +1,12 @@ +# Copyright (c) 2024 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +tests: + drivers.comparator.shell: + integration_platforms: + - native_sim + - native_sim/native/64 + tags: + - drivers + - comparator + - shell From 183e58b19019bd6a83c4f2bb258db7452d17bd29 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Sun, 22 Sep 2024 13:22:25 +0200 Subject: [PATCH 0618/4482] docs: hardware: peripherals: add comparator docs Add documentation for the comparator peripheral and shell. Signed-off-by: Bjarki Arge Andreasen --- doc/hardware/peripherals/comparator.rst | 69 +++++++++++++++++++++++++ doc/hardware/peripherals/index.rst | 1 + 2 files changed, 70 insertions(+) create mode 100644 doc/hardware/peripherals/comparator.rst diff --git a/doc/hardware/peripherals/comparator.rst b/doc/hardware/peripherals/comparator.rst new file mode 100644 index 0000000000000..e0e6340766171 --- /dev/null +++ b/doc/hardware/peripherals/comparator.rst @@ -0,0 +1,69 @@ +.. _comparator_api: + +Comparator +########## + +Overview +******** + +An analog comparator compares the voltages of two analog signals connected to its negative and +positive inputs. If the voltage at the positive input is higher than the negative input, the +comparator's output will be high, otherwise, it will be low. + +Comparators can typically set a trigger which triggers on output changes. This trigger can +either invoke a callback, or its status can be polled. + +Related configuration options: + +* :kconfig:option:`CONFIG_COMPARATOR` + +Configuration +************* + +Embedded comparators can typically be configured at runtime. When enabled, an initial +configuration must be provided using the devicetree. At runtime, comparators can have their +configuration updated using device driver specific APIs. The configuration will be applied +when the comparator is resumed. + +Power management +**************** + +Comparators are enabled using power management. When resumed, the comparator will actively +compare its inputs, producing an output and detecting edges. When suspended, the comparator +will be inactive. + +Comparator shell +**************** + +The comparator shell provides the ``comp`` command with a set of subcommands for the +:ref:`shell ` module. + +The ``comp`` shell command provides the following subcommands: + +* ``get_output`` See :c:func:`comparator_get_output` +* ``set_trigger`` See :c:func:`comparator_set_trigger` +* ``await_trigger`` Awaits trigger using the following flow: + * Set trigger callback using :c:func:`comparator_set_trigger_callback` + * Await callback or time out after default or optionally provided timeout + * Clear trigger callback using :c:func:`comparator_set_trigger_callback` +* ``trigger_is_pending`` See :c:func:`comparator_trigger_is_pending` + +Related configuration options: + +* :kconfig:option:`CONFIG_SHELL` +* :kconfig:option:`CONFIG_COMPARATOR_SHELL` +* :kconfig:option:`CONFIG_COMPARATOR_SHELL_AWAIT_TRIGGER_DEFAULT_TIMEOUT` +* :kconfig:option:`CONFIG_COMPARATOR_SHELL_AWAIT_TRIGGER_MAX_TIMEOUT` + +.. note:: + The power management shell can optionally be enabled alongside the comparator shell. + + Related configuration options: + + * :kconfig:option:`CONFIG_PM_DEVICE` + * :kconfig:option:`CONFIG_PM_DEVICE_SHELL` + +API Reference +************* + +.. doxygengroup:: comparator_interface diff --git a/doc/hardware/peripherals/index.rst b/doc/hardware/peripherals/index.rst index e2574e75993e4..2a7405aced2ba 100644 --- a/doc/hardware/peripherals/index.rst +++ b/doc/hardware/peripherals/index.rst @@ -18,6 +18,7 @@ Peripherals clock_control.rst can/index.rst charger.rst + comparator.rst coredump.rst counter.rst dac.rst From 43f88ca8e12596abcab2b33587c3aa8957b90235 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Sun, 22 Sep 2024 18:52:28 +0200 Subject: [PATCH 0619/4482] doc: release notes: added comparator release notes Added comparator support to release notes for release 4.0 Signed-off-by: Bjarki Arge Andreasen --- doc/releases/release-notes-4.0.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 1eeb182a42da5..e468827a5addd 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -173,6 +173,14 @@ Drivers and Sensors * Clock control +* Comparator + + * Introduced comparator device driver subsystem selected with :kconfig:option:`CONFIG_COMPARATOR` + * Introduced comparator shell commands selected with :kconfig:option:`CONFIG_COMPARATOR_SHELL` + * Added support for Nordic nRF COMP (:dtcompatible:`nordic,nrf-comp`) + * Added support for Nordic nRF LPCOMP (:dtcompatible:`nordic,nrf-lpcomp`) + * Added support for NXP Kinetis ACMP (:dtcompatible:`nxp,kinetis-acmp`) + * Counter * DAC From e40fa8914fade81b91c6ef4f1e618ca5d9adf444 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Sun, 22 Sep 2024 19:23:01 +0200 Subject: [PATCH 0620/4482] MAINTAINERS: add entry for comparator drivers Add entry for comparator drivers Signed-off-by: Bjarki Arge Andreasen --- MAINTAINERS.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index c4edda966d8d4..83a60ed81ed22 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -1150,6 +1150,25 @@ Release Notes: tests: - drivers.clock +"Drivers: Comparator": + status: maintained + maintainers: + - bjarki-andreasen + files: + - drivers/comparator/ + - dts/bindings/comparator/ + - include/zephyr/drivers/comparator.h + - include/zephyr/drivers/comparator/ + - include/zephyr/drivers/comparator/ + - include/zephyr/dt-bindings/clock/ + - tests/drivers/build_all/comparator/ + - tests/drivers/comparator/ + - doc/hardware/peripherals/comparator.rst + labels: + - "area: Comparator" + tests: + - drivers.comparator + "Drivers: Console": status: odd fixes files: From d29ef14bcf0ecb2c002d1722389b4f347ea77c25 Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Wed, 9 Oct 2024 10:44:59 +0200 Subject: [PATCH 0621/4482] include: drivers: video: Run clang-format Run clang format before making changes Signed-off-by: Phi Bang Nguyen --- include/zephyr/drivers/video.h | 114 +++++++++++---------------------- 1 file changed, 37 insertions(+), 77 deletions(-) diff --git a/include/zephyr/drivers/video.h b/include/zephyr/drivers/video.h index b148f19a4a3c1..751e09853c64e 100644 --- a/include/zephyr/drivers/video.h +++ b/include/zephyr/drivers/video.h @@ -33,7 +33,6 @@ extern "C" { #endif - /** * @struct video_format * @brief Video format structure @@ -57,7 +56,6 @@ struct video_format { uint32_t pitch; }; - /** * @struct video_format_cap * @brief Video format capability @@ -211,8 +209,7 @@ enum video_signal_result { * * See video_set_format() for argument descriptions. */ -typedef int (*video_api_set_format_t)(const struct device *dev, - enum video_endpoint_id ep, +typedef int (*video_api_set_format_t)(const struct device *dev, enum video_endpoint_id ep, struct video_format *fmt); /** @@ -221,8 +218,7 @@ typedef int (*video_api_set_format_t)(const struct device *dev, * * See video_get_format() for argument descriptions. */ -typedef int (*video_api_get_format_t)(const struct device *dev, - enum video_endpoint_id ep, +typedef int (*video_api_get_format_t)(const struct device *dev, enum video_endpoint_id ep, struct video_format *fmt); /** @@ -258,8 +254,7 @@ typedef int (*video_api_enum_frmival_t)(const struct device *dev, enum video_end * * See video_enqueue() for argument descriptions. */ -typedef int (*video_api_enqueue_t)(const struct device *dev, - enum video_endpoint_id ep, +typedef int (*video_api_enqueue_t)(const struct device *dev, enum video_endpoint_id ep, struct video_buffer *buf); /** @@ -268,10 +263,8 @@ typedef int (*video_api_enqueue_t)(const struct device *dev, * * See video_dequeue() for argument descriptions. */ -typedef int (*video_api_dequeue_t)(const struct device *dev, - enum video_endpoint_id ep, - struct video_buffer **buf, - k_timeout_t timeout); +typedef int (*video_api_dequeue_t)(const struct device *dev, enum video_endpoint_id ep, + struct video_buffer **buf, k_timeout_t timeout); /** * @typedef video_api_flush_t @@ -280,9 +273,7 @@ typedef int (*video_api_dequeue_t)(const struct device *dev, * * See video_flush() for argument descriptions. */ -typedef int (*video_api_flush_t)(const struct device *dev, - enum video_endpoint_id ep, - bool cancel); +typedef int (*video_api_flush_t)(const struct device *dev, enum video_endpoint_id ep, bool cancel); /** * @typedef video_api_stream_start_t @@ -306,9 +297,7 @@ typedef int (*video_api_stream_stop_t)(const struct device *dev); * * See video_set_ctrl() for argument descriptions. */ -typedef int (*video_api_set_ctrl_t)(const struct device *dev, - unsigned int cid, - void *value); +typedef int (*video_api_set_ctrl_t)(const struct device *dev, unsigned int cid, void *value); /** * @typedef video_api_get_ctrl_t @@ -316,9 +305,7 @@ typedef int (*video_api_set_ctrl_t)(const struct device *dev, * * See video_get_ctrl() for argument descriptions. */ -typedef int (*video_api_get_ctrl_t)(const struct device *dev, - unsigned int cid, - void *value); +typedef int (*video_api_get_ctrl_t)(const struct device *dev, unsigned int cid, void *value); /** * @typedef video_api_get_caps_t @@ -326,8 +313,7 @@ typedef int (*video_api_get_ctrl_t)(const struct device *dev, * * See video_get_caps() for argument descriptions. */ -typedef int (*video_api_get_caps_t)(const struct device *dev, - enum video_endpoint_id ep, +typedef int (*video_api_get_caps_t)(const struct device *dev, enum video_endpoint_id ep, struct video_caps *caps); /** @@ -336,8 +322,7 @@ typedef int (*video_api_get_caps_t)(const struct device *dev, * * See video_set_signal() for argument descriptions. */ -typedef int (*video_api_set_signal_t)(const struct device *dev, - enum video_endpoint_id ep, +typedef int (*video_api_set_signal_t)(const struct device *dev, enum video_endpoint_id ep, struct k_poll_signal *signal); __subsystem struct video_driver_api { @@ -373,12 +358,10 @@ __subsystem struct video_driver_api { * @retval -ENOTSUP If format is not supported. * @retval -EIO General input / output error. */ -static inline int video_set_format(const struct device *dev, - enum video_endpoint_id ep, +static inline int video_set_format(const struct device *dev, enum video_endpoint_id ep, struct video_format *fmt) { - const struct video_driver_api *api = - (const struct video_driver_api *)dev->api; + const struct video_driver_api *api = (const struct video_driver_api *)dev->api; if (api->set_format == NULL) { return -ENOSYS; @@ -398,12 +381,10 @@ static inline int video_set_format(const struct device *dev, * * @retval pointer to video format */ -static inline int video_get_format(const struct device *dev, - enum video_endpoint_id ep, +static inline int video_get_format(const struct device *dev, enum video_endpoint_id ep, struct video_format *fmt) { - const struct video_driver_api *api = - (const struct video_driver_api *)dev->api; + const struct video_driver_api *api = (const struct video_driver_api *)dev->api; if (api->get_format == NULL) { return -ENOSYS; @@ -511,12 +492,10 @@ static inline int video_enum_frmival(const struct device *dev, enum video_endpoi * @retval -EINVAL If parameters are invalid. * @retval -EIO General input / output error. */ -static inline int video_enqueue(const struct device *dev, - enum video_endpoint_id ep, +static inline int video_enqueue(const struct device *dev, enum video_endpoint_id ep, struct video_buffer *buf) { - const struct video_driver_api *api = - (const struct video_driver_api *)dev->api; + const struct video_driver_api *api = (const struct video_driver_api *)dev->api; if (api->enqueue == NULL) { return -ENOSYS; @@ -540,13 +519,10 @@ static inline int video_enqueue(const struct device *dev, * @retval -EINVAL If parameters are invalid. * @retval -EIO General input / output error. */ -static inline int video_dequeue(const struct device *dev, - enum video_endpoint_id ep, - struct video_buffer **buf, - k_timeout_t timeout) +static inline int video_dequeue(const struct device *dev, enum video_endpoint_id ep, + struct video_buffer **buf, k_timeout_t timeout) { - const struct video_driver_api *api = - (const struct video_driver_api *)dev->api; + const struct video_driver_api *api = (const struct video_driver_api *)dev->api; if (api->dequeue == NULL) { return -ENOSYS; @@ -555,7 +531,6 @@ static inline int video_dequeue(const struct device *dev, return api->dequeue(dev, ep, buf, timeout); } - /** * @brief Flush endpoint buffers. * @@ -570,12 +545,9 @@ static inline int video_dequeue(const struct device *dev, * * @retval 0 Is successful, -ERRNO code otherwise. */ -static inline int video_flush(const struct device *dev, - enum video_endpoint_id ep, - bool cancel) +static inline int video_flush(const struct device *dev, enum video_endpoint_id ep, bool cancel) { - const struct video_driver_api *api = - (const struct video_driver_api *)dev->api; + const struct video_driver_api *api = (const struct video_driver_api *)dev->api; if (api->flush == NULL) { return -ENOSYS; @@ -598,8 +570,7 @@ static inline int video_flush(const struct device *dev, */ static inline int video_stream_start(const struct device *dev) { - const struct video_driver_api *api = - (const struct video_driver_api *)dev->api; + const struct video_driver_api *api = (const struct video_driver_api *)dev->api; if (api->stream_start == NULL) { return -ENOSYS; @@ -619,8 +590,7 @@ static inline int video_stream_start(const struct device *dev) */ static inline int video_stream_stop(const struct device *dev) { - const struct video_driver_api *api = - (const struct video_driver_api *)dev->api; + const struct video_driver_api *api = (const struct video_driver_api *)dev->api; int ret; if (api->stream_stop == NULL) { @@ -642,12 +612,10 @@ static inline int video_stream_stop(const struct device *dev) * * @retval 0 Is successful, -ERRNO code otherwise. */ -static inline int video_get_caps(const struct device *dev, - enum video_endpoint_id ep, +static inline int video_get_caps(const struct device *dev, enum video_endpoint_id ep, struct video_caps *caps) { - const struct video_driver_api *api = - (const struct video_driver_api *)dev->api; + const struct video_driver_api *api = (const struct video_driver_api *)dev->api; if (api->get_caps == NULL) { return -ENOSYS; @@ -671,11 +639,9 @@ static inline int video_get_caps(const struct device *dev, * @retval -ENOTSUP If format is not supported. * @retval -EIO General input / output error. */ -static inline int video_set_ctrl(const struct device *dev, unsigned int cid, - void *value) +static inline int video_set_ctrl(const struct device *dev, unsigned int cid, void *value) { - const struct video_driver_api *api = - (const struct video_driver_api *)dev->api; + const struct video_driver_api *api = (const struct video_driver_api *)dev->api; if (api->set_ctrl == NULL) { return -ENOSYS; @@ -699,11 +665,9 @@ static inline int video_set_ctrl(const struct device *dev, unsigned int cid, * @retval -ENOTSUP If format is not supported. * @retval -EIO General input / output error. */ -static inline int video_get_ctrl(const struct device *dev, unsigned int cid, - void *value) +static inline int video_get_ctrl(const struct device *dev, unsigned int cid, void *value) { - const struct video_driver_api *api = - (const struct video_driver_api *)dev->api; + const struct video_driver_api *api = (const struct video_driver_api *)dev->api; if (api->get_ctrl == NULL) { return -ENOSYS; @@ -725,12 +689,10 @@ static inline int video_get_ctrl(const struct device *dev, unsigned int cid, * * @retval 0 Is successful, -ERRNO code otherwise. */ -static inline int video_set_signal(const struct device *dev, - enum video_endpoint_id ep, +static inline int video_set_signal(const struct device *dev, enum video_endpoint_id ep, struct k_poll_signal *signal) { - const struct video_driver_api *api = - (const struct video_driver_api *)dev->api; + const struct video_driver_api *api = (const struct video_driver_api *)dev->api; if (api->set_signal == NULL) { return -ENOSYS; @@ -765,12 +727,10 @@ struct video_buffer *video_buffer_alloc(size_t size); */ void video_buffer_release(struct video_buffer *buf); - /* fourcc - four-character-code */ -#define video_fourcc(a, b, c, d)\ +#define video_fourcc(a, b, c, d) \ ((uint32_t)(a) | ((uint32_t)(b) << 8) | ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24)) - /** * @defgroup video_pixel_formats Video pixel formats * @{ @@ -782,13 +742,13 @@ void video_buffer_release(struct video_buffer *buf); */ /** BGGR8 pixel format */ -#define VIDEO_PIX_FMT_BGGR8 video_fourcc('B', 'G', 'G', 'R') /* 8 BGBG.. GRGR.. */ +#define VIDEO_PIX_FMT_BGGR8 video_fourcc('B', 'G', 'G', 'R') /* 8 BGBG.. GRGR.. */ /** GBRG8 pixel format */ -#define VIDEO_PIX_FMT_GBRG8 video_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ +#define VIDEO_PIX_FMT_GBRG8 video_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ /** GRBG8 pixel format */ -#define VIDEO_PIX_FMT_GRBG8 video_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */ +#define VIDEO_PIX_FMT_GRBG8 video_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */ /** RGGB8 pixel format */ -#define VIDEO_PIX_FMT_RGGB8 video_fourcc('R', 'G', 'G', 'B') /* 8 RGRG.. GBGB.. */ +#define VIDEO_PIX_FMT_RGGB8 video_fourcc('R', 'G', 'G', 'B') /* 8 RGRG.. GBGB.. */ /** * @} @@ -831,7 +791,7 @@ void video_buffer_release(struct video_buffer *buf); */ /** JPEG pixel format */ -#define VIDEO_PIX_FMT_JPEG video_fourcc('J', 'P', 'E', 'G') /* 8 JPEG */ +#define VIDEO_PIX_FMT_JPEG video_fourcc('J', 'P', 'E', 'G') /* 8 JPEG */ /** * @} From 6acad9bd919f95c036dee2c0ed750a263a92b70b Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Wed, 9 Oct 2024 11:06:54 +0200 Subject: [PATCH 0622/4482] include: drivers: video: Remove unused video-controls header Remove the unnecessary video-controls header included in video.h. Drivers, applications should explicitly include it when needed. Signed-off-by: Phi Bang Nguyen --- drivers/video/gc2145.c | 1 + drivers/video/ov2640.c | 1 + drivers/video/ov5640.c | 1 + drivers/video/video_sw_generator.c | 1 + include/zephyr/drivers/video.h | 2 -- samples/drivers/video/capture_to_lvgl/src/main.c | 1 + 6 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/video/gc2145.c b/drivers/video/gc2145.c index 8fd0c8f351102..97be1955de382 100644 --- a/drivers/video/gc2145.c +++ b/drivers/video/gc2145.c @@ -9,6 +9,7 @@ #include #include +#include #include #include diff --git a/drivers/video/ov2640.c b/drivers/video/ov2640.c index 5ebbbeccaab86..3a8bdb3effdd8 100644 --- a/drivers/video/ov2640.c +++ b/drivers/video/ov2640.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/drivers/video/ov5640.c b/drivers/video/ov5640.c index f02b5b3d1dbc8..7766ae5917c68 100644 --- a/drivers/video/ov5640.c +++ b/drivers/video/ov5640.c @@ -15,6 +15,7 @@ #include #include #include +#include LOG_MODULE_REGISTER(video_ov5640, CONFIG_VIDEO_LOG_LEVEL); diff --git a/drivers/video/video_sw_generator.c b/drivers/video/video_sw_generator.c index 988811db1c325..36169b7b8eacc 100644 --- a/drivers/video/video_sw_generator.c +++ b/drivers/video/video_sw_generator.c @@ -8,6 +8,7 @@ #include #include +#include #include LOG_MODULE_REGISTER(video_sw_generator, CONFIG_VIDEO_LOG_LEVEL); diff --git a/include/zephyr/drivers/video.h b/include/zephyr/drivers/video.h index 751e09853c64e..7b083029e3734 100644 --- a/include/zephyr/drivers/video.h +++ b/include/zephyr/drivers/video.h @@ -27,8 +27,6 @@ #include -#include - #ifdef __cplusplus extern "C" { #endif diff --git a/samples/drivers/video/capture_to_lvgl/src/main.c b/samples/drivers/video/capture_to_lvgl/src/main.c index 11dfd5a39ee5d..1c50163d1afc4 100644 --- a/samples/drivers/video/capture_to_lvgl/src/main.c +++ b/samples/drivers/video/capture_to_lvgl/src/main.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL From b05e23cbf02541a9af60b6590a502d104be4de2f Mon Sep 17 00:00:00 2001 From: Jun Lin Date: Fri, 4 Oct 2024 14:54:04 +0800 Subject: [PATCH 0623/4482] dts: npcx: remove unnecessary sub-power state for npcx4 NPCX9 and former chips defines two kinds of sub-power-states to support: 1. Standard wake-up time: if the chip needs to stay in the deep sleep state more than 200 ms. 2. Instant wake-up time: if the chip needs to stay in the deep sleep state less than 200 ms. As NPCX4 can stay in the deep sleep state at more than 200 ms with the instant wake-up capability, we can define only one sub-power state. Signed-off-by: Jun Lin --- dts/arm/nuvoton/npcx/npcx.dtsi | 17 ----------------- dts/arm/nuvoton/npcx/npcx4.dtsi | 15 +++++++++++++++ dts/arm/nuvoton/npcx/npcx7.dtsi | 22 ++++++++++++++++++++++ dts/arm/nuvoton/npcx/npcx9.dtsi | 22 ++++++++++++++++++++++ 4 files changed, 59 insertions(+), 17 deletions(-) diff --git a/dts/arm/nuvoton/npcx/npcx.dtsi b/dts/arm/nuvoton/npcx/npcx.dtsi index 2136fb33e0396..125ebb6563348 100644 --- a/dts/arm/nuvoton/npcx/npcx.dtsi +++ b/dts/arm/nuvoton/npcx/npcx.dtsi @@ -26,23 +26,6 @@ device_type = "cpu"; compatible = "arm,cortex-m4f"; reg = <0>; - cpu-power-states = <&suspend_to_idle0 &suspend_to_idle1>; - }; - - power-states { - suspend_to_idle0: suspend-to-idle0 { - compatible = "zephyr,power-state"; - power-state-name = "suspend-to-idle"; - substate-id = <0>; - min-residency-us = <1000>; - }; - - suspend_to_idle1: suspend-to-idle1 { - compatible = "zephyr,power-state"; - power-state-name = "suspend-to-idle"; - substate-id = <1>; - min-residency-us = <201000>; - }; }; }; diff --git a/dts/arm/nuvoton/npcx/npcx4.dtsi b/dts/arm/nuvoton/npcx/npcx4.dtsi index 8e6f355ef428c..3c976cf28b923 100644 --- a/dts/arm/nuvoton/npcx/npcx4.dtsi +++ b/dts/arm/nuvoton/npcx/npcx4.dtsi @@ -21,6 +21,21 @@ #include "npcx.dtsi" / { + cpus { + cpu0: cpu@0 { + cpu-power-states = <&suspend_to_idle0>; + }; + + power-states { + suspend_to_idle0: suspend-to-idle0 { + compatible = "zephyr,power-state"; + power-state-name = "suspend-to-idle"; + substate-id = <0>; + min-residency-us = <1000>; + }; + }; + }; + def-io-conf-list { pinmux = <&alt0_gpio_no_spip &alt0_gpio_no_fpip diff --git a/dts/arm/nuvoton/npcx/npcx7.dtsi b/dts/arm/nuvoton/npcx/npcx7.dtsi index 6530da991fff6..5b5b033a54c8c 100644 --- a/dts/arm/nuvoton/npcx/npcx7.dtsi +++ b/dts/arm/nuvoton/npcx/npcx7.dtsi @@ -19,6 +19,28 @@ #include "npcx.dtsi" / { + cpus { + cpu0: cpu@0 { + cpu-power-states = <&suspend_to_idle0 &suspend_to_idle1>; + }; + + power-states { + suspend_to_idle0: suspend-to-idle0 { + compatible = "zephyr,power-state"; + power-state-name = "suspend-to-idle"; + substate-id = <0>; + min-residency-us = <1000>; + }; + + suspend_to_idle1: suspend-to-idle1 { + compatible = "zephyr,power-state"; + power-state-name = "suspend-to-idle"; + substate-id = <1>; + min-residency-us = <201000>; + }; + }; + }; + def-io-conf-list { pinmux = <&alt0_gpio_no_spip &alt0_gpio_no_fpip diff --git a/dts/arm/nuvoton/npcx/npcx9.dtsi b/dts/arm/nuvoton/npcx/npcx9.dtsi index 659d4e4cbd3b9..dd991f8fd5727 100644 --- a/dts/arm/nuvoton/npcx/npcx9.dtsi +++ b/dts/arm/nuvoton/npcx/npcx9.dtsi @@ -19,6 +19,28 @@ #include "npcx.dtsi" / { + cpus { + cpu0: cpu@0 { + cpu-power-states = <&suspend_to_idle0 &suspend_to_idle1>; + }; + + power-states { + suspend_to_idle0: suspend-to-idle0 { + compatible = "zephyr,power-state"; + power-state-name = "suspend-to-idle"; + substate-id = <0>; + min-residency-us = <1000>; + }; + + suspend_to_idle1: suspend-to-idle1 { + compatible = "zephyr,power-state"; + power-state-name = "suspend-to-idle"; + substate-id = <1>; + min-residency-us = <201000>; + }; + }; + }; + def-io-conf-list { pinmux = <&alt0_gpio_no_spip &alt0_gpio_no_fpip From 7455bf50d2bd570696318b6263d85d0cb4db20cd Mon Sep 17 00:00:00 2001 From: Ioannis Damigos Date: Mon, 7 Oct 2024 14:19:08 +0300 Subject: [PATCH 0624/4482] twister: Fix reported testcase execution time Testcase execution time doesn't match between twister.xml and twister.log. Testcase execution time is the sum of the previous testcases' execution time plus its own execution time in twister.xml. This patch fixes the issue above. Signed-off-by: Ioannis Damigos --- scripts/pylib/twister/twisterlib/reports.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pylib/twister/twisterlib/reports.py b/scripts/pylib/twister/twisterlib/reports.py index c22310abb5f64..c442a1dfc6c97 100644 --- a/scripts/pylib/twister/twisterlib/reports.py +++ b/scripts/pylib/twister/twisterlib/reports.py @@ -243,7 +243,7 @@ def xunit_report(self, json_file, filename, selected_platform=None, full_report= classname = f"{platform}:{name}" log = ts.get("log") fails, passes, errors, skips = self.xunit_testcase(eleTestsuite, - name, classname, ts_status, ts_status, reason, duration, runnable, + name, classname, ts_status, ts_status, reason, handler_time, runnable, (fails, passes, errors, skips), log, False) total = errors + passes + fails + skips From d274cabf839cc347931f6966086f5111ed818625 Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Tue, 1 Oct 2024 16:16:02 +0300 Subject: [PATCH 0625/4482] drivers: intc: irqstr: add reference count for IRQs Currently, shared interrupts pose a big problem because irq_disable() doesn't keep track of the number of clients using that interrupt line. As such, add a reference count mechanism which will stop the interrupt from being disabled if there's still clients using it. Signed-off-by: Laurentiu Mihalcea --- .../interrupt_controller/intc_nxp_irqsteer.c | 101 ++++++++++++++---- 1 file changed, 83 insertions(+), 18 deletions(-) diff --git a/drivers/interrupt_controller/intc_nxp_irqsteer.c b/drivers/interrupt_controller/intc_nxp_irqsteer.c index 41157f08cde04..0d1d95f3d98cb 100644 --- a/drivers/interrupt_controller/intc_nxp_irqsteer.c +++ b/drivers/interrupt_controller/intc_nxp_irqsteer.c @@ -228,9 +228,12 @@ #include #include #include +#include #include "sw_isr_common.h" +LOG_MODULE_REGISTER(nxp_irqstr); + /* used for driver binding */ #define DT_DRV_COMPAT nxp_irqsteer_intc @@ -257,6 +260,8 @@ /* utility macros */ #define UINT_TO_IRQSTEER(x) ((IRQSTEER_Type *)(x)) +#define DISPATCHER_REGMAP(disp) \ + (((const struct irqsteer_config *)disp->dev->config)->regmap_phys) struct irqsteer_config { uint32_t regmap_phys; @@ -270,6 +275,10 @@ struct irqsteer_dispatcher { uint32_t master_index; /* which interrupt line is the dispatcher tied to? */ uint32_t irq; + /* reference count for all IRQs aggregated by dispatcher */ + uint8_t irq_refcnt[CONFIG_MAX_IRQ_PER_AGGREGATOR]; + /* dispatcher lock */ + struct k_spinlock lock; }; static struct irqsteer_dispatcher dispatchers[] = { @@ -317,11 +326,71 @@ static int from_zephyr_irq(uint32_t regmap, uint32_t irq, uint32_t master_index) return idx; } +static void _irqstr_enable_disable_irq(struct irqsteer_dispatcher *disp, + uint32_t system_irq, bool enable) +{ + uint32_t regmap = DISPATCHER_REGMAP(disp); + + if (enable) { + IRQSTEER_EnableInterrupt(UINT_TO_IRQSTEER(regmap), system_irq); + } else { + IRQSTEER_DisableInterrupt(UINT_TO_IRQSTEER(regmap), system_irq); + } +} + +static void irqstr_request_irq_unlocked(struct irqsteer_dispatcher *disp, + uint32_t zephyr_irq) +{ + uint32_t system_irq = from_zephyr_irq(DISPATCHER_REGMAP(disp), + zephyr_irq, disp->master_index); + +#ifndef CONFIG_SHARED_INTERRUPTS + if (disp->irq_refcnt[zephyr_irq]) { + LOG_WRN("irq %d already requested", system_irq); + return; + } +#endif /* CONFIG_SHARED_INTERRUPTS */ + + if (disp->irq_refcnt[zephyr_irq] == UINT8_MAX) { + LOG_WRN("irq %d reference count reached limit", system_irq); + return; + } + + if (!disp->irq_refcnt[zephyr_irq]) { + _irqstr_enable_disable_irq(disp, system_irq, true); + } + + disp->irq_refcnt[zephyr_irq]++; + + LOG_DBG("requested irq %d has refcount %d", + system_irq, disp->irq_refcnt[zephyr_irq]); +} + +static void irqstr_release_irq_unlocked(struct irqsteer_dispatcher *disp, + uint32_t zephyr_irq) +{ + uint32_t system_irq = from_zephyr_irq(DISPATCHER_REGMAP(disp), + zephyr_irq, disp->master_index); + + if (!disp->irq_refcnt[zephyr_irq]) { + LOG_WRN("irq %d already released", system_irq); + return; + } + + disp->irq_refcnt[zephyr_irq]--; + + if (!disp->irq_refcnt[zephyr_irq]) { + _irqstr_enable_disable_irq(disp, system_irq, false); + } + + LOG_DBG("released irq %d has refcount %d", + system_irq, disp->irq_refcnt[zephyr_irq]); +} + void z_soc_irq_enable_disable(uint32_t irq, bool enable) { uint32_t parent_irq; - int i, system_irq, level2_irq; - const struct irqsteer_config *cfg; + int i, level2_irq; if (irq_get_level(irq) == 1) { /* LEVEL 1 interrupts are DSP direct */ @@ -342,17 +411,12 @@ void z_soc_irq_enable_disable(uint32_t irq, bool enable) continue; } - cfg = dispatchers[i].dev->config; - - system_irq = from_zephyr_irq(cfg->regmap_phys, level2_irq, - dispatchers[i].master_index); - - if (enable) { - IRQSTEER_EnableInterrupt(UINT_TO_IRQSTEER(cfg->regmap_phys), - system_irq); - } else { - IRQSTEER_DisableInterrupt(UINT_TO_IRQSTEER(cfg->regmap_phys), - system_irq); + K_SPINLOCK(&dispatchers[i].lock) { + if (enable) { + irqstr_request_irq_unlocked(&dispatchers[i], level2_irq); + } else { + irqstr_release_irq_unlocked(&dispatchers[i], level2_irq); + } } return; @@ -372,8 +436,9 @@ void z_soc_irq_disable(uint32_t irq) int z_soc_irq_is_enabled(unsigned int irq) { uint32_t parent_irq; - int i, system_irq, level2_irq; + int i; const struct irqsteer_config *cfg; + bool enabled; if (irq_get_level(irq) == 1) { /* LEVEL 1 interrupts are DSP direct */ @@ -381,7 +446,6 @@ int z_soc_irq_is_enabled(unsigned int irq) } parent_irq = irq_parent_level_2(irq); - level2_irq = irq_from_level_2(irq); /* find dispatcher responsible for this interrupt */ for (i = 0; i < ARRAY_SIZE(dispatchers); i++) { @@ -391,10 +455,11 @@ int z_soc_irq_is_enabled(unsigned int irq) cfg = dispatchers[i].dev->config; - system_irq = from_zephyr_irq(cfg->regmap_phys, level2_irq, - dispatchers[i].master_index); + K_SPINLOCK(&dispatchers[i].lock) { + enabled = dispatchers[i].irq_refcnt[irq_from_level_2(irq)]; + } - return IRQSTEER_InterruptIsEnabled(UINT_TO_IRQSTEER(cfg->regmap_phys), system_irq); + return enabled; } return false; From c7be48aae42beaa1884f0077b01abf7379620892 Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Tue, 1 Oct 2024 16:23:06 +0300 Subject: [PATCH 0626/4482] drivers: intc: irqstr: manage dispatchers dynamically Currently, all dispatcher interrupts are enabled during the driver init() function, which will cause a bus fault unless the PM domain associated with irqsteer is powered on. Since PM will be done during irq_enable()/irq_disable(), add support for dynamically enabling/disabling dispatchers. This way, the reg. space of the dispatchers will be accessed when the PM domain is powered on. Signed-off-by: Laurentiu Mihalcea --- .../interrupt_controller/intc_nxp_irqsteer.c | 75 +++++++++++++------ 1 file changed, 54 insertions(+), 21 deletions(-) diff --git a/drivers/interrupt_controller/intc_nxp_irqsteer.c b/drivers/interrupt_controller/intc_nxp_irqsteer.c index 0d1d95f3d98cb..00b2d9916fe4c 100644 --- a/drivers/interrupt_controller/intc_nxp_irqsteer.c +++ b/drivers/interrupt_controller/intc_nxp_irqsteer.c @@ -279,6 +279,8 @@ struct irqsteer_dispatcher { uint8_t irq_refcnt[CONFIG_MAX_IRQ_PER_AGGREGATOR]; /* dispatcher lock */ struct k_spinlock lock; + /* reference count for dispatcher */ + uint8_t refcnt; }; static struct irqsteer_dispatcher dispatchers[] = { @@ -326,6 +328,56 @@ static int from_zephyr_irq(uint32_t regmap, uint32_t irq, uint32_t master_index) return idx; } +static void _irqstr_disp_enable_disable(struct irqsteer_dispatcher *disp, + bool enable) +{ + uint32_t regmap = DISPATCHER_REGMAP(disp); + + if (enable) { + xtensa_irq_enable(XTENSA_IRQ_NUMBER(disp->irq)); + + IRQSTEER_EnableMasterInterrupt(UINT_TO_IRQSTEER(regmap), disp->irq); + } else { + IRQSTEER_DisableMasterInterrupt(UINT_TO_IRQSTEER(regmap), disp->irq); + + xtensa_irq_disable(XTENSA_IRQ_NUMBER(disp->irq)); + } +} + +static void _irqstr_disp_get_unlocked(struct irqsteer_dispatcher *disp) +{ + if (disp->refcnt == UINT8_MAX) { + LOG_WRN("disp for irq %d reference count reached limit", disp->irq); + return; + } + + if (!disp->refcnt) { + _irqstr_disp_enable_disable(disp, true); + } + + disp->refcnt++; + + LOG_DBG("get on disp for irq %d results in refcnt: %d", + disp->irq, disp->refcnt); +} + +static void _irqstr_disp_put_unlocked(struct irqsteer_dispatcher *disp) +{ + if (!disp->refcnt) { + LOG_WRN("disp for irq %d already put", disp->irq); + return; + } + + disp->refcnt--; + + if (!disp->refcnt) { + _irqstr_disp_enable_disable(disp, false); + } + + LOG_DBG("put on disp for irq %d results in refcnt: %d", + disp->irq, disp->refcnt); +} + static void _irqstr_enable_disable_irq(struct irqsteer_dispatcher *disp, uint32_t system_irq, bool enable) { @@ -357,6 +409,7 @@ static void irqstr_request_irq_unlocked(struct irqsteer_dispatcher *disp, } if (!disp->irq_refcnt[zephyr_irq]) { + _irqstr_disp_get_unlocked(disp); _irqstr_enable_disable_irq(disp, system_irq, true); } @@ -381,6 +434,7 @@ static void irqstr_release_irq_unlocked(struct irqsteer_dispatcher *disp, if (!disp->irq_refcnt[zephyr_irq]) { _irqstr_enable_disable_irq(disp, system_irq, false); + _irqstr_disp_put_unlocked(disp); } LOG_DBG("released irq %d has refcount %d", @@ -502,31 +556,10 @@ static void irqsteer_isr_dispatcher(const void *data) } } -static void irqsteer_enable_dispatchers(const struct device *dev) -{ - int i; - struct irqsteer_dispatcher *dispatcher; - const struct irqsteer_config *cfg; - - cfg = dev->config; - - for (i = 0; i < ARRAY_SIZE(dispatchers); i++) { - dispatcher = &dispatchers[i]; - - IRQSTEER_EnableMasterInterrupt(UINT_TO_IRQSTEER(cfg->regmap_phys), - dispatcher->irq); - - xtensa_irq_enable(XTENSA_IRQ_NUMBER(dispatcher->irq)); - } -} - static int irqsteer_init(const struct device *dev) { IRQSTEER_REGISTER_DISPATCHERS(DT_NODELABEL(irqsteer)); - /* enable all dispatchers */ - irqsteer_enable_dispatchers(dev); - return 0; } From 48b98a9284c3d1fe341c4bb150920b82f5b5b397 Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Mon, 30 Sep 2024 13:26:46 +0300 Subject: [PATCH 0627/4482] drivers: dma: dma_nxp_edma: disable IRQs when not needed IRQs are currently only enabled during channel setup and never disabled. As such, even though they're not needed (i.e: after a channel has been suspended or stopped) they remain enabled. Fix this by enabling IRQs during the channel start() operation and disabling them during the channel stop() operation. This change is required by irq chips (i.e: irqsteer) which perform PM operations during irq_enable()/irq_disable(). If interrupts are left enabled all the time that means the irq chip's PM resources might also remain enabled when not needed. Signed-off-by: Laurentiu Mihalcea --- drivers/dma/dma_nxp_edma.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/dma/dma_nxp_edma.c b/drivers/dma/dma_nxp_edma.c index db379d2eea1d4..93484bd5e7342 100644 --- a/drivers/dma/dma_nxp_edma.c +++ b/drivers/dma/dma_nxp_edma.c @@ -332,9 +332,6 @@ static int edma_config(const struct device *dev, uint32_t chan_id, EDMA_TCD_CSR_INTHALF_MASK, 0); } - /* enable channel interrupt */ - irq_enable(chan->irq); - /* dump register status - for debugging purposes */ edma_dump_channel_registers(data, chan_id); @@ -462,8 +459,11 @@ static int edma_stop(const struct device *dev, uint32_t chan_id) /* disable HW requests */ EDMA_ChannelRegUpdate(data->hal_cfg, chan_id, EDMA_TCD_CH_CSR, 0, EDMA_TCD_CH_CSR_ERQ_MASK); + out_release_channel: + irq_disable(chan->irq); + /* clear the channel MUX so that it can used by a different peripheral. * * note: because the channel is released during dma_stop() that means @@ -511,6 +511,8 @@ static int edma_start(const struct device *dev, uint32_t chan_id) LOG_DBG("starting channel %u", chan_id); + irq_enable(chan->irq); + /* enable HW requests */ EDMA_ChannelRegUpdate(data->hal_cfg, chan_id, EDMA_TCD_CH_CSR, EDMA_TCD_CH_CSR_ERQ_MASK, 0); From e8d28bfdfd15ce85baf8517b66c87f0da0c4245a Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Mon, 30 Sep 2024 13:27:39 +0300 Subject: [PATCH 0628/4482] drivers: dai: sai: disable IRQs when not needed IRQs are currently only enabled during the driver initialization function (i.e: sai_init()). As such, even though they're not needed (i.e: after a TRIGGER_STOP operation) they remain enabled. Fix this by enabling IRQs after during the TRIGGER_START operation and disabling them during the TRIGGER_STOP operation. This change is required by irq chips (i.e: irqsteer) which perform PM operations during irq_enable()/irq_disable(). If interrupts are left enabled all the time that means the irq chip's PM resources might also remain enabled. To make this change possible, the irq will have to be stored inside the SAI's configuration structure. Signed-off-by: Laurentiu Mihalcea --- drivers/dai/nxp/sai/sai.c | 8 ++++++-- drivers/dai/nxp/sai/sai.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/dai/nxp/sai/sai.c b/drivers/dai/nxp/sai/sai.c index 37c6832840a85..0e3a91f5ed9f1 100644 --- a/drivers/dai/nxp/sai/sai.c +++ b/drivers/dai/nxp/sai/sai.c @@ -620,6 +620,8 @@ static int sai_trigger_stop(const struct device *dev, SAI_TX_RX_ENABLE_DISABLE_IRQ(dir, data->regmap, kSAI_FIFOErrorInterruptEnable, false); + irq_disable(cfg->irq); + return 0; } @@ -723,6 +725,8 @@ static int sai_trigger_start(const struct device *dev, sai_tx_rx_sw_reset(data, cfg, dir); + irq_enable(cfg->irq); + /* enable error interrupt */ SAI_TX_RX_ENABLE_DISABLE_IRQ(dir, data->regmap, kSAI_FIFOErrorInterruptEnable, true); @@ -842,7 +846,7 @@ static int sai_init(const struct device *dev) data->tx_state = DAI_STATE_NOT_READY; data->rx_state = DAI_STATE_NOT_READY; - /* register ISR and enable IRQ */ + /* register ISR */ cfg->irq_config(); return 0; @@ -902,12 +906,12 @@ void irq_config_##inst(void) \ sai_isr, \ DEVICE_DT_INST_GET(inst), \ 0); \ - irq_enable(DT_INST_IRQN(inst)); \ } \ \ static struct sai_config sai_config_##inst = { \ .regmap_phys = DT_INST_REG_ADDR(inst), \ .regmap_size = DT_INST_REG_SIZE(inst), \ + .irq = DT_INST_IRQN(inst), \ .clk_data = SAI_CLOCK_DATA_DECLARE(inst), \ .rx_fifo_watermark = SAI_RX_FIFO_WATERMARK(inst), \ .tx_fifo_watermark = SAI_TX_FIFO_WATERMARK(inst), \ diff --git a/drivers/dai/nxp/sai/sai.h b/drivers/dai/nxp/sai/sai.h index 2a2ae48712daa..1abf41e68a2b3 100644 --- a/drivers/dai/nxp/sai/sai.h +++ b/drivers/dai/nxp/sai/sai.h @@ -259,6 +259,7 @@ struct sai_data { struct sai_config { uint32_t regmap_phys; uint32_t regmap_size; + uint32_t irq; struct sai_clock_data clk_data; bool mclk_is_output; /* if the tx/rx-fifo-watermark properties are not specified, it's going From fb84f4f53f34f33a90578c9e0855366814eab0b9 Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Mon, 30 Sep 2024 13:22:27 +0300 Subject: [PATCH 0629/4482] dts: bindings: power-domain: add binding for NXP's SCU-managed PDs Add DT binding for NXP's SCU-managed PDs. This binding describes exactly _one_ power domain. Signed-off-by: Laurentiu Mihalcea --- dts/bindings/power-domain/nxp,scu-pd.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 dts/bindings/power-domain/nxp,scu-pd.yaml diff --git a/dts/bindings/power-domain/nxp,scu-pd.yaml b/dts/bindings/power-domain/nxp,scu-pd.yaml new file mode 100644 index 0000000000000..7e1d085538972 --- /dev/null +++ b/dts/bindings/power-domain/nxp,scu-pd.yaml @@ -0,0 +1,17 @@ +# Copyright 2024 NXP +# SPDX-License-Identifier: Apache-2.0 + +description: NXP SCU-managed power domain + +compatible: "nxp,scu-pd" + +include: power-domain.yaml + +properties: + nxp,resource-id: + type: int + required: true + description: + Number used by the firmware running on the SCU to identify + the resource on which the PD-related operations are to be + performed. From 6b6443f11fcb6c2fc32fe27e816417448984da03 Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Mon, 30 Sep 2024 13:22:57 +0300 Subject: [PATCH 0630/4482] include: dt-bindings: power: add IMX SCU resource header Add header file containing definitions of IDs for all resources managed by NXP's SCU. Signed-off-by: Laurentiu Mihalcea --- .../zephyr/dt-bindings/power/imx_scu_rsrc.h | 558 ++++++++++++++++++ 1 file changed, 558 insertions(+) create mode 100644 include/zephyr/dt-bindings/power/imx_scu_rsrc.h diff --git a/include/zephyr/dt-bindings/power/imx_scu_rsrc.h b/include/zephyr/dt-bindings/power/imx_scu_rsrc.h new file mode 100644 index 0000000000000..dc9952ee2d7bd --- /dev/null +++ b/include/zephyr/dt-bindings/power/imx_scu_rsrc.h @@ -0,0 +1,558 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_POWER_IMX_SCU_RSRC_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_POWER_IMX_SCU_RSRC_H_ + +#define IMX_SC_R_A53 0U +#define IMX_SC_R_A53_0 1U +#define IMX_SC_R_A53_1 2U +#define IMX_SC_R_A53_2 3U +#define IMX_SC_R_A53_3 4U +#define IMX_SC_R_A72 5U +#define IMX_SC_R_A72_0 6U +#define IMX_SC_R_A72_1 7U +#define IMX_SC_R_A72_2 8U +#define IMX_SC_R_A72_3 9U +#define IMX_SC_R_CCI 10U +#define IMX_SC_R_DB 11U +#define IMX_SC_R_DRC_0 12U +#define IMX_SC_R_DRC_1 13U +#define IMX_SC_R_GIC_SMMU 14U +#define IMX_SC_R_IRQSTR_M4_0 15U +#define IMX_SC_R_IRQSTR_M4_1 16U +#define IMX_SC_R_SMMU 17U +#define IMX_SC_R_GIC 18U +#define IMX_SC_R_DC_0_BLIT0 19U +#define IMX_SC_R_DC_0_BLIT1 20U +#define IMX_SC_R_DC_0_BLIT2 21U +#define IMX_SC_R_DC_0_BLIT_OUT 22U +#define IMX_SC_R_PERF 23U +#define IMX_SC_R_USB_1_PHY 24U +#define IMX_SC_R_DC_0_WARP 25U +#define IMX_SC_R_V2X_MU_0 26U +#define IMX_SC_R_V2X_MU_1 27U +#define IMX_SC_R_DC_0_VIDEO0 28U +#define IMX_SC_R_DC_0_VIDEO1 29U +#define IMX_SC_R_DC_0_FRAC0 30U +#define IMX_SC_R_V2X_MU_2 31U +#define IMX_SC_R_DC_0 32U +#define IMX_SC_R_GPU_2_PID0 33U +#define IMX_SC_R_DC_0_PLL_0 34U +#define IMX_SC_R_DC_0_PLL_1 35U +#define IMX_SC_R_DC_1_BLIT0 36U +#define IMX_SC_R_DC_1_BLIT1 37U +#define IMX_SC_R_DC_1_BLIT2 38U +#define IMX_SC_R_DC_1_BLIT_OUT 39U +#define IMX_SC_R_V2X_MU_3 40U +#define IMX_SC_R_V2X_MU_4 41U +#define IMX_SC_R_DC_1_WARP 42U +#define IMX_SC_R_UNUSED1 43U +#define IMX_SC_R_SECVIO 44U +#define IMX_SC_R_DC_1_VIDEO0 45U +#define IMX_SC_R_DC_1_VIDEO1 46U +#define IMX_SC_R_DC_1_FRAC0 47U +#define IMX_SC_R_UNUSED13 48U +#define IMX_SC_R_DC_1 49U +#define IMX_SC_R_UNUSED14 50U +#define IMX_SC_R_DC_1_PLL_0 51U +#define IMX_SC_R_DC_1_PLL_1 52U +#define IMX_SC_R_SPI_0 53U +#define IMX_SC_R_SPI_1 54U +#define IMX_SC_R_SPI_2 55U +#define IMX_SC_R_SPI_3 56U +#define IMX_SC_R_UART_0 57U +#define IMX_SC_R_UART_1 58U +#define IMX_SC_R_UART_2 59U +#define IMX_SC_R_UART_3 60U +#define IMX_SC_R_UART_4 61U +#define IMX_SC_R_EMVSIM_0 62U +#define IMX_SC_R_EMVSIM_1 63U +#define IMX_SC_R_DMA_0_CH0 64U +#define IMX_SC_R_DMA_0_CH1 65U +#define IMX_SC_R_DMA_0_CH2 66U +#define IMX_SC_R_DMA_0_CH3 67U +#define IMX_SC_R_DMA_0_CH4 68U +#define IMX_SC_R_DMA_0_CH5 69U +#define IMX_SC_R_DMA_0_CH6 70U +#define IMX_SC_R_DMA_0_CH7 71U +#define IMX_SC_R_DMA_0_CH8 72U +#define IMX_SC_R_DMA_0_CH9 73U +#define IMX_SC_R_DMA_0_CH10 74U +#define IMX_SC_R_DMA_0_CH11 75U +#define IMX_SC_R_DMA_0_CH12 76U +#define IMX_SC_R_DMA_0_CH13 77U +#define IMX_SC_R_DMA_0_CH14 78U +#define IMX_SC_R_DMA_0_CH15 79U +#define IMX_SC_R_DMA_0_CH16 80U +#define IMX_SC_R_DMA_0_CH17 81U +#define IMX_SC_R_DMA_0_CH18 82U +#define IMX_SC_R_DMA_0_CH19 83U +#define IMX_SC_R_DMA_0_CH20 84U +#define IMX_SC_R_DMA_0_CH21 85U +#define IMX_SC_R_DMA_0_CH22 86U +#define IMX_SC_R_DMA_0_CH23 87U +#define IMX_SC_R_DMA_0_CH24 88U +#define IMX_SC_R_DMA_0_CH25 89U +#define IMX_SC_R_DMA_0_CH26 90U +#define IMX_SC_R_DMA_0_CH27 91U +#define IMX_SC_R_DMA_0_CH28 92U +#define IMX_SC_R_DMA_0_CH29 93U +#define IMX_SC_R_DMA_0_CH30 94U +#define IMX_SC_R_DMA_0_CH31 95U +#define IMX_SC_R_I2C_0 96U +#define IMX_SC_R_I2C_1 97U +#define IMX_SC_R_I2C_2 98U +#define IMX_SC_R_I2C_3 99U +#define IMX_SC_R_I2C_4 100U +#define IMX_SC_R_ADC_0 101U +#define IMX_SC_R_ADC_1 102U +#define IMX_SC_R_FTM_0 103U +#define IMX_SC_R_FTM_1 104U +#define IMX_SC_R_CAN_0 105U +#define IMX_SC_R_CAN_1 106U +#define IMX_SC_R_CAN_2 107U +#define IMX_SC_R_DMA_1_CH0 108U +#define IMX_SC_R_DMA_1_CH1 109U +#define IMX_SC_R_DMA_1_CH2 110U +#define IMX_SC_R_DMA_1_CH3 111U +#define IMX_SC_R_DMA_1_CH4 112U +#define IMX_SC_R_DMA_1_CH5 113U +#define IMX_SC_R_DMA_1_CH6 114U +#define IMX_SC_R_DMA_1_CH7 115U +#define IMX_SC_R_DMA_1_CH8 116U +#define IMX_SC_R_DMA_1_CH9 117U +#define IMX_SC_R_DMA_1_CH10 118U +#define IMX_SC_R_DMA_1_CH11 119U +#define IMX_SC_R_DMA_1_CH12 120U +#define IMX_SC_R_DMA_1_CH13 121U +#define IMX_SC_R_DMA_1_CH14 122U +#define IMX_SC_R_DMA_1_CH15 123U +#define IMX_SC_R_DMA_1_CH16 124U +#define IMX_SC_R_DMA_1_CH17 125U +#define IMX_SC_R_DMA_1_CH18 126U +#define IMX_SC_R_DMA_1_CH19 127U +#define IMX_SC_R_DMA_1_CH20 128U +#define IMX_SC_R_DMA_1_CH21 129U +#define IMX_SC_R_DMA_1_CH22 130U +#define IMX_SC_R_DMA_1_CH23 131U +#define IMX_SC_R_DMA_1_CH24 132U +#define IMX_SC_R_DMA_1_CH25 133U +#define IMX_SC_R_DMA_1_CH26 134U +#define IMX_SC_R_DMA_1_CH27 135U +#define IMX_SC_R_DMA_1_CH28 136U +#define IMX_SC_R_DMA_1_CH29 137U +#define IMX_SC_R_DMA_1_CH30 138U +#define IMX_SC_R_DMA_1_CH31 139U +#define IMX_SC_R_V2X_PID0 140U +#define IMX_SC_R_V2X_PID1 141U +#define IMX_SC_R_V2X_PID2 142U +#define IMX_SC_R_V2X_PID3 143U +#define IMX_SC_R_GPU_0_PID0 144U +#define IMX_SC_R_GPU_0_PID1 145U +#define IMX_SC_R_GPU_0_PID2 146U +#define IMX_SC_R_GPU_0_PID3 147U +#define IMX_SC_R_GPU_1_PID0 148U +#define IMX_SC_R_GPU_1_PID1 149U +#define IMX_SC_R_GPU_1_PID2 150U +#define IMX_SC_R_GPU_1_PID3 151U +#define IMX_SC_R_PCIE_A 152U +#define IMX_SC_R_SERDES_0 153U +#define IMX_SC_R_MATCH_0 154U +#define IMX_SC_R_MATCH_1 155U +#define IMX_SC_R_MATCH_2 156U +#define IMX_SC_R_MATCH_3 157U +#define IMX_SC_R_MATCH_4 158U +#define IMX_SC_R_MATCH_5 159U +#define IMX_SC_R_MATCH_6 160U +#define IMX_SC_R_MATCH_7 161U +#define IMX_SC_R_MATCH_8 162U +#define IMX_SC_R_MATCH_9 163U +#define IMX_SC_R_MATCH_10 164U +#define IMX_SC_R_MATCH_11 165U +#define IMX_SC_R_MATCH_12 166U +#define IMX_SC_R_MATCH_13 167U +#define IMX_SC_R_MATCH_14 168U +#define IMX_SC_R_PCIE_B 169U +#define IMX_SC_R_SATA_0 170U +#define IMX_SC_R_SERDES_1 171U +#define IMX_SC_R_HSIO_GPIO 172U +#define IMX_SC_R_MATCH_15 173U +#define IMX_SC_R_MATCH_16 174U +#define IMX_SC_R_MATCH_17 175U +#define IMX_SC_R_MATCH_18 176U +#define IMX_SC_R_MATCH_19 177U +#define IMX_SC_R_MATCH_20 178U +#define IMX_SC_R_MATCH_21 179U +#define IMX_SC_R_MATCH_22 180U +#define IMX_SC_R_MATCH_23 181U +#define IMX_SC_R_MATCH_24 182U +#define IMX_SC_R_MATCH_25 183U +#define IMX_SC_R_MATCH_26 184U +#define IMX_SC_R_MATCH_27 185U +#define IMX_SC_R_MATCH_28 186U +#define IMX_SC_R_LCD_0 187U +#define IMX_SC_R_LCD_0_PWM_0 188U +#define IMX_SC_R_LCD_0_I2C_0 189U +#define IMX_SC_R_LCD_0_I2C_1 190U +#define IMX_SC_R_PWM_0 191U +#define IMX_SC_R_PWM_1 192U +#define IMX_SC_R_PWM_2 193U +#define IMX_SC_R_PWM_3 194U +#define IMX_SC_R_PWM_4 195U +#define IMX_SC_R_PWM_5 196U +#define IMX_SC_R_PWM_6 197U +#define IMX_SC_R_PWM_7 198U +#define IMX_SC_R_GPIO_0 199U +#define IMX_SC_R_GPIO_1 200U +#define IMX_SC_R_GPIO_2 201U +#define IMX_SC_R_GPIO_3 202U +#define IMX_SC_R_GPIO_4 203U +#define IMX_SC_R_GPIO_5 204U +#define IMX_SC_R_GPIO_6 205U +#define IMX_SC_R_GPIO_7 206U +#define IMX_SC_R_GPT_0 207U +#define IMX_SC_R_GPT_1 208U +#define IMX_SC_R_GPT_2 209U +#define IMX_SC_R_GPT_3 210U +#define IMX_SC_R_GPT_4 211U +#define IMX_SC_R_KPP 212U +#define IMX_SC_R_MU_0A 213U +#define IMX_SC_R_MU_1A 214U +#define IMX_SC_R_MU_2A 215U +#define IMX_SC_R_MU_3A 216U +#define IMX_SC_R_MU_4A 217U +#define IMX_SC_R_MU_5A 218U +#define IMX_SC_R_MU_6A 219U +#define IMX_SC_R_MU_7A 220U +#define IMX_SC_R_MU_8A 221U +#define IMX_SC_R_MU_9A 222U +#define IMX_SC_R_MU_10A 223U +#define IMX_SC_R_MU_11A 224U +#define IMX_SC_R_MU_12A 225U +#define IMX_SC_R_MU_13A 226U +#define IMX_SC_R_MU_5B 227U +#define IMX_SC_R_MU_6B 228U +#define IMX_SC_R_MU_7B 229U +#define IMX_SC_R_MU_8B 230U +#define IMX_SC_R_MU_9B 231U +#define IMX_SC_R_MU_10B 232U +#define IMX_SC_R_MU_11B 233U +#define IMX_SC_R_MU_12B 234U +#define IMX_SC_R_MU_13B 235U +#define IMX_SC_R_ROM_0 236U +#define IMX_SC_R_FSPI_0 237U +#define IMX_SC_R_FSPI_1 238U +#define IMX_SC_R_IEE 239U +#define IMX_SC_R_IEE_R0 240U +#define IMX_SC_R_IEE_R1 241U +#define IMX_SC_R_IEE_R2 242U +#define IMX_SC_R_IEE_R3 243U +#define IMX_SC_R_IEE_R4 244U +#define IMX_SC_R_IEE_R5 245U +#define IMX_SC_R_IEE_R6 246U +#define IMX_SC_R_IEE_R7 247U +#define IMX_SC_R_SDHC_0 248U +#define IMX_SC_R_SDHC_1 249U +#define IMX_SC_R_SDHC_2 250U +#define IMX_SC_R_ENET_0 251U +#define IMX_SC_R_ENET_1 252U +#define IMX_SC_R_MLB_0 253U +#define IMX_SC_R_DMA_2_CH0 254U +#define IMX_SC_R_DMA_2_CH1 255U +#define IMX_SC_R_DMA_2_CH2 256U +#define IMX_SC_R_DMA_2_CH3 257U +#define IMX_SC_R_DMA_2_CH4 258U +#define IMX_SC_R_USB_0 259U +#define IMX_SC_R_USB_1 260U +#define IMX_SC_R_USB_0_PHY 261U +#define IMX_SC_R_USB_2 262U +#define IMX_SC_R_USB_2_PHY 263U +#define IMX_SC_R_DTCP 264U +#define IMX_SC_R_NAND 265U +#define IMX_SC_R_LVDS_0 266U +#define IMX_SC_R_LVDS_0_PWM_0 267U +#define IMX_SC_R_LVDS_0_I2C_0 268U +#define IMX_SC_R_LVDS_0_I2C_1 269U +#define IMX_SC_R_LVDS_1 270U +#define IMX_SC_R_LVDS_1_PWM_0 271U +#define IMX_SC_R_LVDS_1_I2C_0 272U +#define IMX_SC_R_LVDS_1_I2C_1 273U +#define IMX_SC_R_LVDS_2 274U +#define IMX_SC_R_LVDS_2_PWM_0 275U +#define IMX_SC_R_LVDS_2_I2C_0 276U +#define IMX_SC_R_LVDS_2_I2C_1 277U +#define IMX_SC_R_M4_0_PID0 278U +#define IMX_SC_R_M4_0_PID1 279U +#define IMX_SC_R_M4_0_PID2 280U +#define IMX_SC_R_M4_0_PID3 281U +#define IMX_SC_R_M4_0_PID4 282U +#define IMX_SC_R_M4_0_RGPIO 283U +#define IMX_SC_R_M4_0_SEMA42 284U +#define IMX_SC_R_M4_0_TPM 285U +#define IMX_SC_R_M4_0_PIT 286U +#define IMX_SC_R_M4_0_UART 287U +#define IMX_SC_R_M4_0_I2C 288U +#define IMX_SC_R_M4_0_INTMUX 289U +#define IMX_SC_R_ENET_0_A0 290U +#define IMX_SC_R_ENET_0_A1 291U +#define IMX_SC_R_M4_0_MU_0B 292U +#define IMX_SC_R_M4_0_MU_0A0 293U +#define IMX_SC_R_M4_0_MU_0A1 294U +#define IMX_SC_R_M4_0_MU_0A2 295U +#define IMX_SC_R_M4_0_MU_0A3 296U +#define IMX_SC_R_M4_0_MU_1A 297U +#define IMX_SC_R_M4_1_PID0 298U +#define IMX_SC_R_M4_1_PID1 299U +#define IMX_SC_R_M4_1_PID2 300U +#define IMX_SC_R_M4_1_PID3 301U +#define IMX_SC_R_M4_1_PID4 302U +#define IMX_SC_R_M4_1_RGPIO 303U +#define IMX_SC_R_M4_1_SEMA42 304U +#define IMX_SC_R_M4_1_TPM 305U +#define IMX_SC_R_M4_1_PIT 306U +#define IMX_SC_R_M4_1_UART 307U +#define IMX_SC_R_M4_1_I2C 308U +#define IMX_SC_R_M4_1_INTMUX 309U +#define IMX_SC_R_UNUSED17 310U +#define IMX_SC_R_UNUSED18 311U +#define IMX_SC_R_M4_1_MU_0B 312U +#define IMX_SC_R_M4_1_MU_0A0 313U +#define IMX_SC_R_M4_1_MU_0A1 314U +#define IMX_SC_R_M4_1_MU_0A2 315U +#define IMX_SC_R_M4_1_MU_0A3 316U +#define IMX_SC_R_M4_1_MU_1A 317U +#define IMX_SC_R_SAI_0 318U +#define IMX_SC_R_SAI_1 319U +#define IMX_SC_R_SAI_2 320U +#define IMX_SC_R_IRQSTR_SCU2 321U +#define IMX_SC_R_IRQSTR_DSP 322U +#define IMX_SC_R_ELCDIF_PLL 323U +#define IMX_SC_R_OCRAM 324U +#define IMX_SC_R_AUDIO_PLL_0 325U +#define IMX_SC_R_PI_0 326U +#define IMX_SC_R_PI_0_PWM_0 327U +#define IMX_SC_R_PI_0_PWM_1 328U +#define IMX_SC_R_PI_0_I2C_0 329U +#define IMX_SC_R_PI_0_PLL 330U +#define IMX_SC_R_PI_1 331U +#define IMX_SC_R_PI_1_PWM_0 332U +#define IMX_SC_R_PI_1_PWM_1 333U +#define IMX_SC_R_PI_1_I2C_0 334U +#define IMX_SC_R_PI_1_PLL 335U +#define IMX_SC_R_SC_PID0 336U +#define IMX_SC_R_SC_PID1 337U +#define IMX_SC_R_SC_PID2 338U +#define IMX_SC_R_SC_PID3 339U +#define IMX_SC_R_SC_PID4 340U +#define IMX_SC_R_SC_SEMA42 341U +#define IMX_SC_R_SC_TPM 342U +#define IMX_SC_R_SC_PIT 343U +#define IMX_SC_R_SC_UART 344U +#define IMX_SC_R_SC_I2C 345U +#define IMX_SC_R_SC_MU_0B 346U +#define IMX_SC_R_SC_MU_0A0 347U +#define IMX_SC_R_SC_MU_0A1 348U +#define IMX_SC_R_SC_MU_0A2 349U +#define IMX_SC_R_SC_MU_0A3 350U +#define IMX_SC_R_SC_MU_1A 351U +#define IMX_SC_R_SYSCNT_RD 352U +#define IMX_SC_R_SYSCNT_CMP 353U +#define IMX_SC_R_DEBUG 354U +#define IMX_SC_R_SYSTEM 355U +#define IMX_SC_R_SNVS 356U +#define IMX_SC_R_OTP 357U +#define IMX_SC_R_VPU_PID0 358U +#define IMX_SC_R_VPU_PID1 359U +#define IMX_SC_R_VPU_PID2 360U +#define IMX_SC_R_VPU_PID3 361U +#define IMX_SC_R_VPU_PID4 362U +#define IMX_SC_R_VPU_PID5 363U +#define IMX_SC_R_VPU_PID6 364U +#define IMX_SC_R_VPU_PID7 365U +#define IMX_SC_R_ENET_0_A2 366U +#define IMX_SC_R_ENET_1_A0 367U +#define IMX_SC_R_ENET_1_A1 368U +#define IMX_SC_R_ENET_1_A2 369U +#define IMX_SC_R_ENET_1_A3 370U +#define IMX_SC_R_ENET_1_A4 371U +#define IMX_SC_R_DMA_4_CH0 372U +#define IMX_SC_R_DMA_4_CH1 373U +#define IMX_SC_R_DMA_4_CH2 374U +#define IMX_SC_R_DMA_4_CH3 375U +#define IMX_SC_R_DMA_4_CH4 376U +#define IMX_SC_R_ISI_CH0 377U +#define IMX_SC_R_ISI_CH1 378U +#define IMX_SC_R_ISI_CH2 379U +#define IMX_SC_R_ISI_CH3 380U +#define IMX_SC_R_ISI_CH4 381U +#define IMX_SC_R_ISI_CH5 382U +#define IMX_SC_R_ISI_CH6 383U +#define IMX_SC_R_ISI_CH7 384U +#define IMX_SC_R_MJPEG_DEC_S0 385U +#define IMX_SC_R_MJPEG_DEC_S1 386U +#define IMX_SC_R_MJPEG_DEC_S2 387U +#define IMX_SC_R_MJPEG_DEC_S3 388U +#define IMX_SC_R_MJPEG_ENC_S0 389U +#define IMX_SC_R_MJPEG_ENC_S1 390U +#define IMX_SC_R_MJPEG_ENC_S2 391U +#define IMX_SC_R_MJPEG_ENC_S3 392U +#define IMX_SC_R_MIPI_0 393U +#define IMX_SC_R_MIPI_0_PWM_0 394U +#define IMX_SC_R_MIPI_0_I2C_0 395U +#define IMX_SC_R_MIPI_0_I2C_1 396U +#define IMX_SC_R_MIPI_1 397U +#define IMX_SC_R_MIPI_1_PWM_0 398U +#define IMX_SC_R_MIPI_1_I2C_0 399U +#define IMX_SC_R_MIPI_1_I2C_1 400U +#define IMX_SC_R_CSI_0 401U +#define IMX_SC_R_CSI_0_PWM_0 402U +#define IMX_SC_R_CSI_0_I2C_0 403U +#define IMX_SC_R_CSI_1 404U +#define IMX_SC_R_CSI_1_PWM_0 405U +#define IMX_SC_R_CSI_1_I2C_0 406U +#define IMX_SC_R_HDMI 407U +#define IMX_SC_R_HDMI_I2S 408U +#define IMX_SC_R_HDMI_I2C_0 409U +#define IMX_SC_R_HDMI_PLL_0 410U +#define IMX_SC_R_HDMI_RX 411U +#define IMX_SC_R_HDMI_RX_BYPASS 412U +#define IMX_SC_R_HDMI_RX_I2C_0 413U +#define IMX_SC_R_ASRC_0 414U +#define IMX_SC_R_ESAI_0 415U +#define IMX_SC_R_SPDIF_0 416U +#define IMX_SC_R_SPDIF_1 417U +#define IMX_SC_R_SAI_3 418U +#define IMX_SC_R_SAI_4 419U +#define IMX_SC_R_SAI_5 420U +#define IMX_SC_R_GPT_5 421U +#define IMX_SC_R_GPT_6 422U +#define IMX_SC_R_GPT_7 423U +#define IMX_SC_R_GPT_8 424U +#define IMX_SC_R_GPT_9 425U +#define IMX_SC_R_GPT_10 426U +#define IMX_SC_R_DMA_2_CH5 427U +#define IMX_SC_R_DMA_2_CH6 428U +#define IMX_SC_R_DMA_2_CH7 429U +#define IMX_SC_R_DMA_2_CH8 430U +#define IMX_SC_R_DMA_2_CH9 431U +#define IMX_SC_R_DMA_2_CH10 432U +#define IMX_SC_R_DMA_2_CH11 433U +#define IMX_SC_R_DMA_2_CH12 434U +#define IMX_SC_R_DMA_2_CH13 435U +#define IMX_SC_R_DMA_2_CH14 436U +#define IMX_SC_R_DMA_2_CH15 437U +#define IMX_SC_R_DMA_2_CH16 438U +#define IMX_SC_R_DMA_2_CH17 439U +#define IMX_SC_R_DMA_2_CH18 440U +#define IMX_SC_R_DMA_2_CH19 441U +#define IMX_SC_R_DMA_2_CH20 442U +#define IMX_SC_R_DMA_2_CH21 443U +#define IMX_SC_R_DMA_2_CH22 444U +#define IMX_SC_R_DMA_2_CH23 445U +#define IMX_SC_R_DMA_2_CH24 446U +#define IMX_SC_R_DMA_2_CH25 447U +#define IMX_SC_R_DMA_2_CH26 448U +#define IMX_SC_R_DMA_2_CH27 449U +#define IMX_SC_R_DMA_2_CH28 450U +#define IMX_SC_R_DMA_2_CH29 451U +#define IMX_SC_R_DMA_2_CH30 452U +#define IMX_SC_R_DMA_2_CH31 453U +#define IMX_SC_R_ASRC_1 454U +#define IMX_SC_R_ESAI_1 455U +#define IMX_SC_R_SAI_6 456U +#define IMX_SC_R_SAI_7 457U +#define IMX_SC_R_AMIX 458U +#define IMX_SC_R_MQS_0 459U +#define IMX_SC_R_DMA_3_CH0 460U +#define IMX_SC_R_DMA_3_CH1 461U +#define IMX_SC_R_DMA_3_CH2 462U +#define IMX_SC_R_DMA_3_CH3 463U +#define IMX_SC_R_DMA_3_CH4 464U +#define IMX_SC_R_DMA_3_CH5 465U +#define IMX_SC_R_DMA_3_CH6 466U +#define IMX_SC_R_DMA_3_CH7 467U +#define IMX_SC_R_DMA_3_CH8 468U +#define IMX_SC_R_DMA_3_CH9 469U +#define IMX_SC_R_DMA_3_CH10 470U +#define IMX_SC_R_DMA_3_CH11 471U +#define IMX_SC_R_DMA_3_CH12 472U +#define IMX_SC_R_DMA_3_CH13 473U +#define IMX_SC_R_DMA_3_CH14 474U +#define IMX_SC_R_DMA_3_CH15 475U +#define IMX_SC_R_DMA_3_CH16 476U +#define IMX_SC_R_DMA_3_CH17 477U +#define IMX_SC_R_DMA_3_CH18 478U +#define IMX_SC_R_DMA_3_CH19 479U +#define IMX_SC_R_DMA_3_CH20 480U +#define IMX_SC_R_DMA_3_CH21 481U +#define IMX_SC_R_DMA_3_CH22 482U +#define IMX_SC_R_DMA_3_CH23 483U +#define IMX_SC_R_DMA_3_CH24 484U +#define IMX_SC_R_DMA_3_CH25 485U +#define IMX_SC_R_DMA_3_CH26 486U +#define IMX_SC_R_DMA_3_CH27 487U +#define IMX_SC_R_DMA_3_CH28 488U +#define IMX_SC_R_DMA_3_CH29 489U +#define IMX_SC_R_DMA_3_CH30 490U +#define IMX_SC_R_DMA_3_CH31 491U +#define IMX_SC_R_AUDIO_PLL_1 492U +#define IMX_SC_R_AUDIO_CLK_0 493U +#define IMX_SC_R_AUDIO_CLK_1 494U +#define IMX_SC_R_MCLK_OUT_0 495U +#define IMX_SC_R_MCLK_OUT_1 496U +#define IMX_SC_R_PMIC_0 497U +#define IMX_SC_R_PMIC_1 498U +#define IMX_SC_R_SECO 499U +#define IMX_SC_R_CAAM_JR1 500U +#define IMX_SC_R_CAAM_JR2 501U +#define IMX_SC_R_CAAM_JR3 502U +#define IMX_SC_R_SECO_MU_2 503U +#define IMX_SC_R_SECO_MU_3 504U +#define IMX_SC_R_SECO_MU_4 505U +#define IMX_SC_R_HDMI_RX_PWM_0 506U +#define IMX_SC_R_A35 507U +#define IMX_SC_R_A35_0 508U +#define IMX_SC_R_A35_1 509U +#define IMX_SC_R_A35_2 510U +#define IMX_SC_R_A35_3 511U +#define IMX_SC_R_DSP 512U +#define IMX_SC_R_DSP_RAM 513U +#define IMX_SC_R_CAAM_JR1_OUT 514U +#define IMX_SC_R_CAAM_JR2_OUT 515U +#define IMX_SC_R_CAAM_JR3_OUT 516U +#define IMX_SC_R_VPU_DEC_0 517U +#define IMX_SC_R_VPU_ENC_0 518U +#define IMX_SC_R_CAAM_JR0 519U +#define IMX_SC_R_CAAM_JR0_OUT 520U +#define IMX_SC_R_PMIC_2 521U +#define IMX_SC_R_DBLOGIC 522U +#define IMX_SC_R_HDMI_PLL_1 523U +#define IMX_SC_R_BOARD_R0 524U +#define IMX_SC_R_BOARD_R1 525U +#define IMX_SC_R_BOARD_R2 526U +#define IMX_SC_R_BOARD_R3 527U +#define IMX_SC_R_BOARD_R4 528U +#define IMX_SC_R_BOARD_R5 529U +#define IMX_SC_R_BOARD_R6 530U +#define IMX_SC_R_BOARD_R7 531U +#define IMX_SC_R_MJPEG_DEC_MP 532U +#define IMX_SC_R_MJPEG_ENC_MP 533U +#define IMX_SC_R_VPU_TS_0 534U +#define IMX_SC_R_VPU_MU_0 535U +#define IMX_SC_R_VPU_MU_1 536U +#define IMX_SC_R_VPU_MU_2 537U +#define IMX_SC_R_VPU_MU_3 538U +#define IMX_SC_R_VPU_ENC_1 539U +#define IMX_SC_R_VPU 540U +#define IMX_SC_R_DMA_5_CH0 541U +#define IMX_SC_R_DMA_5_CH1 542U +#define IMX_SC_R_DMA_5_CH2 543U +#define IMX_SC_R_DMA_5_CH3 544U +#define IMX_SC_R_ATTESTATION 545U +#define IMX_SC_R_LAST 546U + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_POWER_IMX_SCU_RSRC_H_ */ From 4fba1d4642e1dc89c0616ebf6542dc886ffe872d Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Mon, 30 Sep 2024 13:23:22 +0300 Subject: [PATCH 0631/4482] drivers: power_domain: add driver for NXP's SCU-managed PDs Add driver for NXP's SCU-managed power domains. Signed-off-by: Laurentiu Mihalcea --- drivers/power_domain/CMakeLists.txt | 1 + drivers/power_domain/Kconfig | 17 ++++ drivers/power_domain/power_domain_nxp_scu.c | 88 +++++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 drivers/power_domain/power_domain_nxp_scu.c diff --git a/drivers/power_domain/CMakeLists.txt b/drivers/power_domain/CMakeLists.txt index 27b07c945f1d0..dedd7a50dffa6 100644 --- a/drivers/power_domain/CMakeLists.txt +++ b/drivers/power_domain/CMakeLists.txt @@ -6,3 +6,4 @@ zephyr_library() zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_GPIO power_domain_gpio.c) zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_GPIO_MONITOR power_domain_gpio_monitor.c) zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_INTEL_ADSP power_domain_intel_adsp.c) +zephyr_library_sources_ifdef(CONFIG_POWER_DOMAIN_NXP_SCU power_domain_nxp_scu.c) diff --git a/drivers/power_domain/Kconfig b/drivers/power_domain/Kconfig index 647d70366794d..f29057acf5c9d 100644 --- a/drivers/power_domain/Kconfig +++ b/drivers/power_domain/Kconfig @@ -73,4 +73,21 @@ config POWER_DOMAIN_GPIO_MONITOR_INIT_PRIORITY endif #POWER_DOMAIN_GPIO_MONITOR +config POWER_DOMAIN_NXP_SCU + bool "NXP SCU-managed PD driver" + default y + depends on DT_HAS_NXP_SCU_PD_ENABLED + help + Enable support for NXPs SCU-managed power domain driver. + +if POWER_DOMAIN_NXP_SCU + +config POWER_DOMAIN_NXP_SCU_INIT_PRIORITY + int "NXP SCU-managed PD driver init priority" + default 10 + help + NXP SCU-managed PD driver initialization priority. + +endif #POWER_DOMAIN_NXP_SCU + endif diff --git a/drivers/power_domain/power_domain_nxp_scu.c b/drivers/power_domain/power_domain_nxp_scu.c new file mode 100644 index 0000000000000..2ed162359fd26 --- /dev/null +++ b/drivers/power_domain/power_domain_nxp_scu.c @@ -0,0 +1,88 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include
+#include +#include + +LOG_MODULE_REGISTER(nxp_scu_pd); + +#define DT_DRV_COMPAT nxp_scu_pd + +struct scu_pd_data { + sc_ipc_t handle; + sc_rsrc_t rsrc; +}; + +static int scu_pd_pm_action(const struct device *dev, + enum pm_device_action action) +{ + int ret; + sc_pm_power_mode_t mode; + struct scu_pd_data *scu_data = dev->data; + + LOG_DBG("attempting PM action %d on rsrc %d", action, scu_data->rsrc); + + switch (action) { + case PM_DEVICE_ACTION_RESUME: + mode = SC_PM_PW_MODE_ON; + break; + case PM_DEVICE_ACTION_SUSPEND: + mode = SC_PM_PW_MODE_OFF; + break; + case PM_DEVICE_ACTION_TURN_ON: + case PM_DEVICE_ACTION_TURN_OFF: + return 0; + default: + return -ENOTSUP; + } + + ret = sc_pm_set_resource_power_mode(scu_data->handle, + scu_data->rsrc, + mode); + if (ret != SC_ERR_NONE) { + LOG_ERR("failed to set rsrc %d power mode to %d", + scu_data->rsrc, mode); + return -EIO; + } + + return 0; +} + +static int scu_pd_init(const struct device *dev) +{ + int ret; + struct scu_pd_data *scu_data = dev->data; + + ret = sc_ipc_open(&scu_data->handle, DT_REG_ADDR(DT_NODELABEL(scu_mu))); + if (ret != SC_ERR_NONE) { + return -ENODEV; + } + + return pm_device_runtime_enable(dev); +} + + +#define SCU_PD_DEVICE_DEFINE(inst) \ + \ +BUILD_ASSERT(DT_INST_PROP(inst, nxp_resource_id) < IMX_SC_R_LAST, \ + "invalid resource ID"); \ + \ +static struct scu_pd_data scu_pd_data_##inst = { \ + .rsrc = DT_INST_PROP(inst, nxp_resource_id), \ +}; \ + \ +PM_DEVICE_DT_INST_DEFINE(inst, scu_pd_pm_action); \ + \ +DEVICE_DT_INST_DEFINE(inst, scu_pd_init, PM_DEVICE_DT_INST_GET(inst), \ + &scu_pd_data_##inst, NULL, PRE_KERNEL_1, \ + CONFIG_POWER_DOMAIN_NXP_SCU_INIT_PRIORITY, \ + NULL); + +DT_INST_FOREACH_STATUS_OKAY(SCU_PD_DEVICE_DEFINE); From 202794273de680b1f18f7d7aaeb30713c09a4c32 Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Tue, 1 Oct 2024 16:40:56 +0300 Subject: [PATCH 0632/4482] drivers: intc: irqstr: add PM support Add support for PM. The strategy is as follows: 1) For level 1 interrupts: don't care, these don't require the PM domain of irqsteer to be turned on since they are, well, direct. 2) For level 2 interrupts: use the reference count of the dispatchers. Upon doing a get() on a dispatcher with its reference count set to 0, before enabling the IRQ (meaning accessing the reg. space) increment the reference count of the irqstr device (which will result in the PM domain being enabled if 0). Upon doin a put() on a dispatcher with its reference count set to 1, after disabling the IRQ (meaning accessing the reg. space) decrement the reference count of the irqstr device (which will result in the PM domain being disabled if 0). In summary, the PM domain of the device will be enabled if at least one dispatcher is in use. On the other hand, the PM domain of the device will be disabled if there's no dispatchers in use (assuming there's no other dependencies). Signed-off-by: Laurentiu Mihalcea --- .../interrupt_controller/intc_nxp_irqsteer.c | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/drivers/interrupt_controller/intc_nxp_irqsteer.c b/drivers/interrupt_controller/intc_nxp_irqsteer.c index 00b2d9916fe4c..5d291083fca68 100644 --- a/drivers/interrupt_controller/intc_nxp_irqsteer.c +++ b/drivers/interrupt_controller/intc_nxp_irqsteer.c @@ -229,6 +229,8 @@ #include #include #include +#include +#include #include "sw_isr_common.h" @@ -346,12 +348,20 @@ static void _irqstr_disp_enable_disable(struct irqsteer_dispatcher *disp, static void _irqstr_disp_get_unlocked(struct irqsteer_dispatcher *disp) { + int ret; + if (disp->refcnt == UINT8_MAX) { LOG_WRN("disp for irq %d reference count reached limit", disp->irq); return; } if (!disp->refcnt) { + ret = pm_device_runtime_get(disp->dev); + if (ret < 0) { + LOG_ERR("failed to enable PM resources: %d", ret); + return; + } + _irqstr_disp_enable_disable(disp, true); } @@ -363,6 +373,8 @@ static void _irqstr_disp_get_unlocked(struct irqsteer_dispatcher *disp) static void _irqstr_disp_put_unlocked(struct irqsteer_dispatcher *disp) { + int ret; + if (!disp->refcnt) { LOG_WRN("disp for irq %d already put", disp->irq); return; @@ -372,6 +384,12 @@ static void _irqstr_disp_put_unlocked(struct irqsteer_dispatcher *disp) if (!disp->refcnt) { _irqstr_disp_enable_disable(disp, false); + + ret = pm_device_runtime_put(disp->dev); + if (ret < 0) { + LOG_ERR("failed to disable PM resources: %d", ret); + return; + } } LOG_DBG("put on disp for irq %d results in refcnt: %d", @@ -556,11 +574,18 @@ static void irqsteer_isr_dispatcher(const void *data) } } +__maybe_unused static int irqstr_pm_action(const struct device *dev, + enum pm_device_action action) +{ + /* nothing to be done here */ + return 0; +} + static int irqsteer_init(const struct device *dev) { IRQSTEER_REGISTER_DISPATCHERS(DT_NODELABEL(irqsteer)); - return 0; + return pm_device_runtime_enable(dev); } @@ -572,9 +597,10 @@ static struct irqsteer_config irqsteer_config = { }; /* assumption: only 1 IRQ_STEER instance */ +PM_DEVICE_DT_INST_DEFINE(0, irqstr_pm_action); DEVICE_DT_INST_DEFINE(0, &irqsteer_init, - NULL, + PM_DEVICE_DT_INST_GET(0), NULL, &irqsteer_config, PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, NULL); From fdbf4d23df69f796fb73d8cfc90cf583634e3d57 Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Mon, 30 Sep 2024 13:25:49 +0300 Subject: [PATCH 0633/4482] dts: xtensa: nxp_imx8: add power domain for irqsteer Add power domain DT node for the irqsteer and a reference to it in irqsteer's DT node. Signed-off-by: Laurentiu Mihalcea --- dts/xtensa/nxp/nxp_imx8.dtsi | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dts/xtensa/nxp/nxp_imx8.dtsi b/dts/xtensa/nxp/nxp_imx8.dtsi index 9e8229e7b8e5f..fb5c6d0b1e8d5 100644 --- a/dts/xtensa/nxp/nxp_imx8.dtsi +++ b/dts/xtensa/nxp/nxp_imx8.dtsi @@ -8,6 +8,7 @@ #include #include #include +#include / { cpus { @@ -34,6 +35,7 @@ irqsteer: interrupt-controller@510a0000 { compatible = "nxp,irqsteer-intc"; reg = <0x510a0000 DT_SIZE_K(64)>; + power-domain = <&irqstr_pd>; #size-cells = <0>; #address-cells = <1>; @@ -167,6 +169,17 @@ compatible = "nxp,imx8-pinctrl"; }; }; + + power-domains { + #address-cells = <1>; + #size-cells = <0>; + + irqstr_pd: pd@0 { + compatible = "nxp,imx8qm-scu-pd", "nxp,scu-pd"; + reg = <0>; + nxp,resource-id = ; + }; + }; }; lpuart2: serial@5a080000 { From 2fcd6c0ae4f378a2437c91dd376c1d84fe73f7db Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Mon, 30 Sep 2024 13:26:28 +0300 Subject: [PATCH 0634/4482] boards: nxp: imx8{qm/qxp}_mek: enable PDs and runtime PM Enable support for device runtime PM and power domains. Signed-off-by: Laurentiu Mihalcea --- boards/nxp/imx8qm_mek/imx8qm_mek_mimx8qm6_adsp_defconfig | 3 +++ boards/nxp/imx8qxp_mek/imx8qxp_mek_mimx8qx6_adsp_defconfig | 3 +++ 2 files changed, 6 insertions(+) diff --git a/boards/nxp/imx8qm_mek/imx8qm_mek_mimx8qm6_adsp_defconfig b/boards/nxp/imx8qm_mek/imx8qm_mek_mimx8qm6_adsp_defconfig index aaf7764dfb502..c3e7dd9a6c8d7 100644 --- a/boards/nxp/imx8qm_mek/imx8qm_mek_mimx8qm6_adsp_defconfig +++ b/boards/nxp/imx8qm_mek/imx8qm_mek_mimx8qm6_adsp_defconfig @@ -1,6 +1,9 @@ # SPDX-License-Identifier: Apache-2.0 CONFIG_MAIN_STACK_SIZE=3072 +CONFIG_PM_DEVICE=y +CONFIG_PM_DEVICE_RUNTIME=y +CONFIG_POWER_DOMAIN=y # board/soc-related configurations CONFIG_LOG=y diff --git a/boards/nxp/imx8qxp_mek/imx8qxp_mek_mimx8qx6_adsp_defconfig b/boards/nxp/imx8qxp_mek/imx8qxp_mek_mimx8qx6_adsp_defconfig index aaf7764dfb502..c3e7dd9a6c8d7 100644 --- a/boards/nxp/imx8qxp_mek/imx8qxp_mek_mimx8qx6_adsp_defconfig +++ b/boards/nxp/imx8qxp_mek/imx8qxp_mek_mimx8qx6_adsp_defconfig @@ -1,6 +1,9 @@ # SPDX-License-Identifier: Apache-2.0 CONFIG_MAIN_STACK_SIZE=3072 +CONFIG_PM_DEVICE=y +CONFIG_PM_DEVICE_RUNTIME=y +CONFIG_POWER_DOMAIN=y # board/soc-related configurations CONFIG_LOG=y From 0036b8bf21c709835d6a9fcfaf2b994bd1c3ab4d Mon Sep 17 00:00:00 2001 From: Alexander Kozhinov Date: Sat, 28 Sep 2024 23:58:09 +0200 Subject: [PATCH 0635/4482] drivers: ethernet: eth_stm32_hal Drop preprocessor redefinitions Some preprocessor defines were redefined to follow stm32 hal naming conventions. People seems to be confused by redefines and use them with alternating names. This PR does not change code behaviour, but shall increase it's readability. Signed-off-by: Alexander Kozhinov --- drivers/ethernet/eth_stm32_hal.c | 54 ++++++++++++--------------- drivers/ethernet/eth_stm32_hal_priv.h | 7 +--- 2 files changed, 25 insertions(+), 36 deletions(-) diff --git a/drivers/ethernet/eth_stm32_hal.c b/drivers/ethernet/eth_stm32_hal.c index bc42515586010..046b6916fa456 100644 --- a/drivers/ethernet/eth_stm32_hal.c +++ b/drivers/ethernet/eth_stm32_hal.c @@ -73,12 +73,6 @@ static const struct device *eth_stm32_phy_dev = DEVICE_PHY_BY_NAME(0); #define IS_ETH_DMATXDESC_OWN(dma_tx_desc) (dma_tx_desc->DESC3 & \ ETH_DMATXNDESCRF_OWN) -#define ETH_RXBUFNB ETH_RX_DESC_CNT -#define ETH_TXBUFNB ETH_TX_DESC_CNT - -#define ETH_MEDIA_INTERFACE_MII HAL_ETH_MII_MODE -#define ETH_MEDIA_INTERFACE_RMII HAL_ETH_RMII_MODE - /* Only one tx_buffer is sufficient to pass only 1 dma_buffer */ #define ETH_TXBUF_DEF_NB 1U #else @@ -105,14 +99,14 @@ static const struct device *eth_stm32_phy_dev = DEVICE_PHY_BY_NAME(0); #define __eth_stm32_buf __aligned(4) #endif -static ETH_DMADescTypeDef dma_rx_desc_tab[ETH_RXBUFNB] __eth_stm32_desc; -static ETH_DMADescTypeDef dma_tx_desc_tab[ETH_TXBUFNB] __eth_stm32_desc; -static uint8_t dma_rx_buffer[ETH_RXBUFNB][ETH_STM32_RX_BUF_SIZE] __eth_stm32_buf; -static uint8_t dma_tx_buffer[ETH_TXBUFNB][ETH_STM32_TX_BUF_SIZE] __eth_stm32_buf; +static ETH_DMADescTypeDef dma_rx_desc_tab[ETH_RX_DESC_CNT] __eth_stm32_desc; +static ETH_DMADescTypeDef dma_tx_desc_tab[ETH_TX_DESC_CNT] __eth_stm32_desc; +static uint8_t dma_rx_buffer[ETH_RX_DESC_CNT][ETH_MAX_PACKET_SIZE] __eth_stm32_buf; +static uint8_t dma_tx_buffer[ETH_TX_DESC_CNT][ETH_MAX_PACKET_SIZE] __eth_stm32_buf; #if defined(CONFIG_ETH_STM32_HAL_API_V2) -BUILD_ASSERT(ETH_STM32_RX_BUF_SIZE % 4 == 0, "Rx buffer size must be a multiple of 4"); +BUILD_ASSERT(ETH_MAX_PACKET_SIZE % 4 == 0, "Rx buffer size must be a multiple of 4"); struct eth_stm32_rx_buffer_header { struct eth_stm32_rx_buffer_header *next; @@ -130,12 +124,12 @@ struct eth_stm32_tx_context { uint16_t first_tx_buffer_index; }; -static struct eth_stm32_rx_buffer_header dma_rx_buffer_header[ETH_RXBUFNB]; -static struct eth_stm32_tx_buffer_header dma_tx_buffer_header[ETH_TXBUFNB]; +static struct eth_stm32_rx_buffer_header dma_rx_buffer_header[ETH_RX_DESC_CNT]; +static struct eth_stm32_tx_buffer_header dma_tx_buffer_header[ETH_TX_DESC_CNT]; void HAL_ETH_RxAllocateCallback(uint8_t **buf) { - for (size_t i = 0; i < ETH_RXBUFNB; ++i) { + for (size_t i = 0; i < ETH_RX_DESC_CNT; ++i) { if (!dma_rx_buffer_header[i].used) { dma_rx_buffer_header[i].next = NULL; dma_rx_buffer_header[i].size = 0; @@ -147,8 +141,8 @@ void HAL_ETH_RxAllocateCallback(uint8_t **buf) *buf = NULL; } -/* Pointer to an array of ETH_STM32_RX_BUF_SIZE uint8_t's */ -typedef uint8_t (*RxBufferPtr)[ETH_STM32_RX_BUF_SIZE]; +/* Pointer to an array of ETH_MAX_PACKET_SIZE uint8_t's */ +typedef uint8_t (*RxBufferPtr)[ETH_MAX_PACKET_SIZE]; /* called by HAL_ETH_ReadData() */ void HAL_ETH_RxLinkCallback(void **pStart, void **pEnd, uint8_t *buff, uint16_t Length) @@ -159,7 +153,7 @@ void HAL_ETH_RxLinkCallback(void **pStart, void **pEnd, uint8_t *buff, uint16_t size_t index = (RxBufferPtr)buff - &dma_rx_buffer[0]; struct eth_stm32_rx_buffer_header *header = &dma_rx_buffer_header[index]; - __ASSERT_NO_MSG(index < ETH_RXBUFNB); + __ASSERT_NO_MSG(index < ETH_RX_DESC_CNT); header->size = Length; @@ -200,7 +194,7 @@ void HAL_ETH_TxFreeCallback(uint32_t *buff) static inline uint16_t allocate_tx_buffer(void) { for (;;) { - for (uint16_t index = 0; index < ETH_TXBUFNB; index++) { + for (uint16_t index = 0; index < ETH_TX_DESC_CNT; index++) { if (!dma_tx_buffer_header[index].used) { dma_tx_buffer_header[index].used = true; return index; @@ -330,7 +324,7 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt) heth = &dev_data->heth; total_len = net_pkt_get_len(pkt); - if (total_len > (ETH_STM32_TX_BUF_SIZE * ETH_TXBUFNB)) { + if (total_len > (ETH_MAX_PACKET_SIZE * ETH_TX_DESC_CNT)) { LOG_ERR("PKT too big"); return -EIO; } @@ -373,19 +367,19 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt) #if defined(CONFIG_ETH_STM32_HAL_API_V2) remaining_read = total_len; /* fill and allocate buffer until remaining data fits in one buffer */ - while (remaining_read > ETH_STM32_TX_BUF_SIZE) { - if (net_pkt_read(pkt, buf_header->tx_buff.buffer, ETH_STM32_TX_BUF_SIZE)) { + while (remaining_read > ETH_MAX_PACKET_SIZE) { + if (net_pkt_read(pkt, buf_header->tx_buff.buffer, ETH_MAX_PACKET_SIZE)) { res = -ENOBUFS; goto error; } const uint16_t next_buffer_id = allocate_tx_buffer(); - buf_header->tx_buff.len = ETH_STM32_TX_BUF_SIZE; + buf_header->tx_buff.len = ETH_MAX_PACKET_SIZE; /* append new buffer to the linked list */ buf_header->tx_buff.next = &dma_tx_buffer_header[next_buffer_id].tx_buff; /* and adjust tail pointer */ buf_header = &dma_tx_buffer_header[next_buffer_id]; - remaining_read -= ETH_STM32_TX_BUF_SIZE; + remaining_read -= ETH_MAX_PACKET_SIZE; } if (net_pkt_read(pkt, buf_header->tx_buff.buffer, remaining_read)) { res = -ENOBUFS; @@ -735,7 +729,7 @@ static struct net_pkt *eth_rx(const struct device *dev) rx_header; rx_header = rx_header->next) { const size_t index = rx_header - &dma_rx_buffer_header[0]; - __ASSERT_NO_MSG(index < ETH_RXBUFNB); + __ASSERT_NO_MSG(index < ETH_RX_DESC_CNT); if (net_pkt_write(pkt, dma_rx_buffer[index], rx_header->size)) { LOG_ERR("Failed to append RX buffer to context buffer"); net_pkt_unref(pkt); @@ -1127,7 +1121,7 @@ static int eth_initialize(const struct device *dev) defined(CONFIG_ETH_STM32_HAL_API_V2) heth->Init.TxDesc = dma_tx_desc_tab; heth->Init.RxDesc = dma_rx_desc_tab; - heth->Init.RxBuffLen = ETH_STM32_RX_BUF_SIZE; + heth->Init.RxBuffLen = ETH_MAX_PACKET_SIZE; #endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X || CONFIG_ETH_STM32_HAL_API_V2 */ hal_ret = HAL_ETH_Init(heth); @@ -1196,7 +1190,7 @@ static int eth_initialize(const struct device *dev) #if defined(CONFIG_ETH_STM32_HAL_API_V2) /* prepare tx buffer header */ - for (uint16_t i = 0; i < ETH_TXBUFNB; ++i) { + for (uint16_t i = 0; i < ETH_TX_DESC_CNT; ++i) { dma_tx_buffer_header[i].tx_buff.buffer = dma_tx_buffer[i]; } @@ -1215,9 +1209,9 @@ static int eth_initialize(const struct device *dev) hal_ret = HAL_ETH_Start_IT(heth); #else HAL_ETH_DMATxDescListInit(heth, dma_tx_desc_tab, - &dma_tx_buffer[0][0], ETH_TXBUFNB); + &dma_tx_buffer[0][0], ETH_TX_DESC_CNT); HAL_ETH_DMARxDescListInit(heth, dma_rx_desc_tab, - &dma_rx_buffer[0][0], ETH_RXBUFNB); + &dma_rx_buffer[0][0], ETH_RX_DESC_CNT); hal_ret = HAL_ETH_Start(heth); #endif /* CONFIG_ETH_STM32_HAL_API_V2 */ @@ -1505,14 +1499,14 @@ static struct eth_stm32_hal_dev_data eth0_data = { ETH_CHECKSUM_BY_HARDWARE : ETH_CHECKSUM_BY_SOFTWARE, #endif /* !CONFIG_SOC_SERIES_STM32H7X */ .MediaInterface = IS_ENABLED(CONFIG_ETH_STM32_HAL_MII) ? - ETH_MEDIA_INTERFACE_MII : ETH_MEDIA_INTERFACE_RMII, + HAL_ETH_MII_MODE : HAL_ETH_RMII_MODE, }, }, }; ETH_NET_DEVICE_DT_INST_DEFINE(0, eth_initialize, NULL, ð0_data, ð0_config, - CONFIG_ETH_INIT_PRIORITY, ð_api, ETH_STM32_HAL_MTU); + CONFIG_ETH_INIT_PRIORITY, ð_api, NET_ETH_MTU); #if defined(CONFIG_PTP_CLOCK_STM32_HAL) diff --git a/drivers/ethernet/eth_stm32_hal_priv.h b/drivers/ethernet/eth_stm32_hal_priv.h index 9502537ac5297..16be793ac62ab 100644 --- a/drivers/ethernet/eth_stm32_hal_priv.h +++ b/drivers/ethernet/eth_stm32_hal_priv.h @@ -22,12 +22,7 @@ #define ST_OUI_B1 0x80 #define ST_OUI_B2 0xE1 -#define ETH_STM32_HAL_MTU NET_ETH_MTU -#define ETH_STM32_HAL_FRAME_SIZE_MAX (ETH_STM32_HAL_MTU + 18) - -/* Definition of the Ethernet driver buffers size and count */ -#define ETH_STM32_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */ -#define ETH_STM32_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */ +#define ETH_STM32_HAL_FRAME_SIZE_MAX (NET_ETH_MTU + 18) /* Device constant configuration parameters */ struct eth_stm32_hal_dev_cfg { From fbeda5959dd82b58027c07f1ce95a58a9001626e Mon Sep 17 00:00:00 2001 From: Alexander Kozhinov Date: Sun, 29 Sep 2024 00:18:31 +0200 Subject: [PATCH 0636/4482] drivers: ethernet: eth_stm32_hal_priv.h Remove unused missleading definition. Signed-off-by: Alexander Kozhinov --- drivers/ethernet/eth_stm32_hal_priv.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/ethernet/eth_stm32_hal_priv.h b/drivers/ethernet/eth_stm32_hal_priv.h index 16be793ac62ab..d6eeb47b95bc7 100644 --- a/drivers/ethernet/eth_stm32_hal_priv.h +++ b/drivers/ethernet/eth_stm32_hal_priv.h @@ -22,8 +22,6 @@ #define ST_OUI_B1 0x80 #define ST_OUI_B2 0xE1 -#define ETH_STM32_HAL_FRAME_SIZE_MAX (NET_ETH_MTU + 18) - /* Device constant configuration parameters */ struct eth_stm32_hal_dev_cfg { void (*config_func)(void); From 8f0de8455de6dbfdf41b58dc7848fe2bef16672a Mon Sep 17 00:00:00 2001 From: Lucas Dietrich Date: Thu, 19 Sep 2024 14:29:18 +0200 Subject: [PATCH 0637/4482] drivers: crypto: Refactor encryption and decryption functions for STM32 AES This patch introduces a unified function pointer approach to handle encryption and decryption operations for the STM32 AES accelerator. - Replace separate `do_encrypt` and `do_decrypt` functions with a generic `do_aes` function, using function pointers to AES HAL functions. Signed-off-by: Lucas Dietrich --- drivers/crypto/crypto_stm32.c | 86 +++++++++++++++++++---------------- 1 file changed, 47 insertions(+), 39 deletions(-) diff --git a/drivers/crypto/crypto_stm32.c b/drivers/crypto/crypto_stm32.c index 534d14f0c24c4..061b9775e9290 100644 --- a/drivers/crypto/crypto_stm32.c +++ b/drivers/crypto/crypto_stm32.c @@ -47,6 +47,33 @@ LOG_MODULE_REGISTER(crypto_stm32); struct crypto_stm32_session crypto_stm32_sessions[CRYPTO_MAX_SESSION]; +typedef HAL_StatusTypeDef status_t; + +/** + * @brief Function pointer type for AES encryption/decryption operations. + * + * This type defines a function pointer for generic AES operations. + * + * @param hcryp Pointer to a CRYP_HandleTypeDef structure that contains + * the configuration information for the CRYP module. + * @param in_data Pointer to input data (plaintext for encryption or ciphertext for decryption). + * @param size Length of the input data in bytes. + * @param out_data Pointer to output data (ciphertext for encryption or plaintext for + * decryption). + * @param timeout Timeout duration in milliseconds. + * + * @retval status_t HAL status of the operation. + */ +typedef status_t (*hal_cryp_aes_op_func_t)(CRYP_HandleTypeDef *hcryp, uint8_t *in_data, + uint16_t size, uint8_t *out_data, uint32_t timeout); + +#define hal_ecb_encrypt_op HAL_CRYP_AESECB_Encrypt +#define hal_ecb_decrypt_op HAL_CRYP_AESECB_Decrypt +#define hal_cbc_encrypt_op HAL_CRYP_AESCBC_Encrypt +#define hal_cbc_decrypt_op HAL_CRYP_AESCBC_Decrypt +#define hal_ctr_encrypt_op HAL_CRYP_AESCTR_Encrypt +#define hal_ctr_decrypt_op HAL_CRYP_AESCTR_Decrypt + static int copy_reverse_words(uint8_t *dst_buf, int dst_len, const uint8_t *src_buf, int src_len) { @@ -65,10 +92,10 @@ static int copy_reverse_words(uint8_t *dst_buf, int dst_len, return 0; } -static int do_encrypt(struct cipher_ctx *ctx, uint8_t *in_buf, int in_len, +static int do_aes(struct cipher_ctx *ctx, hal_cryp_aes_op_func_t fn, uint8_t *in_buf, int in_len, uint8_t *out_buf) { - HAL_StatusTypeDef status; + status_t status; struct crypto_stm32_data *data = CRYPTO_STM32_DATA(ctx->device); struct crypto_stm32_session *session = CRYPTO_STM32_SESSN(ctx); @@ -82,10 +109,9 @@ static int do_encrypt(struct cipher_ctx *ctx, uint8_t *in_buf, int in_len, return -EIO; } - status = HAL_CRYP_Encrypt(&data->hcryp, (uint32_t *)in_buf, in_len, - (uint32_t *)out_buf, HAL_MAX_DELAY); + status = fn(&data->hcryp, in_buf, in_len, out_buf, HAL_MAX_DELAY); if (status != HAL_OK) { - LOG_ERR("Encryption error"); + LOG_ERR("Encryption/decryption error"); k_sem_give(&data->device_sem); return -EIO; } @@ -95,34 +121,18 @@ static int do_encrypt(struct cipher_ctx *ctx, uint8_t *in_buf, int in_len, return 0; } -static int do_decrypt(struct cipher_ctx *ctx, uint8_t *in_buf, int in_len, - uint8_t *out_buf) +static status_t hal_encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, + uint8_t *pCypherData, uint32_t Timeout) { - HAL_StatusTypeDef status; - - struct crypto_stm32_data *data = CRYPTO_STM32_DATA(ctx->device); - struct crypto_stm32_session *session = CRYPTO_STM32_SESSN(ctx); - - k_sem_take(&data->device_sem, K_FOREVER); - - status = HAL_CRYP_SetConfig(&data->hcryp, &session->config); - if (status != HAL_OK) { - LOG_ERR("Configuration error"); - k_sem_give(&data->device_sem); - return -EIO; - } - - status = HAL_CRYP_Decrypt(&data->hcryp, (uint32_t *)in_buf, in_len, - (uint32_t *)out_buf, HAL_MAX_DELAY); - if (status != HAL_OK) { - LOG_ERR("Decryption error"); - k_sem_give(&data->device_sem); - return -EIO; - } - - k_sem_give(&data->device_sem); + return HAL_CRYP_Encrypt(hcryp, (uint32_t *)pPlainData, Size, (uint32_t *)pCypherData, + Timeout); +} - return 0; +static status_t hal_decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, + uint8_t *pPlainData, uint32_t Timeout) +{ + return HAL_CRYP_Decrypt(hcryp, (uint32_t *)pCypherData, Size, (uint32_t *)pPlainData, + Timeout); } static int crypto_stm32_ecb_encrypt(struct cipher_ctx *ctx, @@ -138,7 +148,7 @@ static int crypto_stm32_ecb_encrypt(struct cipher_ctx *ctx, return -EINVAL; } - ret = do_encrypt(ctx, pkt->in_buf, pkt->in_len, pkt->out_buf); + ret = do_aes(ctx, hal_ecb_encrypt_op, pkt->in_buf, pkt->in_len, pkt->out_buf); if (ret == 0) { pkt->out_len = 16; } @@ -159,7 +169,7 @@ static int crypto_stm32_ecb_decrypt(struct cipher_ctx *ctx, return -EINVAL; } - ret = do_decrypt(ctx, pkt->in_buf, pkt->in_len, pkt->out_buf); + ret = do_aes(ctx, hal_ecb_decrypt_op, pkt->in_buf, pkt->in_len, pkt->out_buf); if (ret == 0) { pkt->out_len = 16; } @@ -186,8 +196,7 @@ static int crypto_stm32_cbc_encrypt(struct cipher_ctx *ctx, out_offset = 16; } - ret = do_encrypt(ctx, pkt->in_buf, pkt->in_len, - pkt->out_buf + out_offset); + ret = do_aes(ctx, hal_cbc_encrypt_op, pkt->in_buf, pkt->in_len, pkt->out_buf + out_offset); if (ret == 0) { pkt->out_len = pkt->in_len + out_offset; } @@ -212,8 +221,7 @@ static int crypto_stm32_cbc_decrypt(struct cipher_ctx *ctx, in_offset = 16; } - ret = do_decrypt(ctx, pkt->in_buf + in_offset, pkt->in_len, - pkt->out_buf); + ret = do_aes(ctx, hal_cbc_decrypt_op, pkt->in_buf + in_offset, pkt->in_len, pkt->out_buf); if (ret == 0) { pkt->out_len = pkt->in_len - in_offset; } @@ -236,7 +244,7 @@ static int crypto_stm32_ctr_encrypt(struct cipher_ctx *ctx, session->config.pInitVect = ctr; - ret = do_encrypt(ctx, pkt->in_buf, pkt->in_len, pkt->out_buf); + ret = do_aes(ctx, hal_ctr_encrypt_op, pkt->in_buf, pkt->in_len, pkt->out_buf); if (ret == 0) { pkt->out_len = pkt->in_len; } @@ -259,7 +267,7 @@ static int crypto_stm32_ctr_decrypt(struct cipher_ctx *ctx, session->config.pInitVect = ctr; - ret = do_decrypt(ctx, pkt->in_buf, pkt->in_len, pkt->out_buf); + ret = do_aes(ctx, hal_ctr_decrypt_op, pkt->in_buf, pkt->in_len, pkt->out_buf); if (ret == 0) { pkt->out_len = pkt->in_len; } From ad431dcc233903a007860d2e89ab43507402d571 Mon Sep 17 00:00:00 2001 From: Lucas Dietrich Date: Tue, 24 Sep 2024 22:40:56 +0200 Subject: [PATCH 0638/4482] drivers: crypto: Add support for STM32L4 AES accelerator This patch completes the addition of support for the STM32L4 AES accelerator by introducing conditional handling for different STM32 AES HAL variants. Key changes include: - Created device tree bindings `st,stm32l4-aes` for STM32L4 AES - Replaced `copy_reverse_words` with `copy_words_adjust_endianness` to handle endianness conversion for different variants. Signed-off-by: Lucas Dietrich --- drivers/crypto/crypto_stm32.c | 62 ++++++++++++++++++++----- drivers/crypto/crypto_stm32_priv.h | 8 +++- dts/bindings/crypto/st,stm32l4-aes.yaml | 8 ++++ 3 files changed, 65 insertions(+), 13 deletions(-) create mode 100644 dts/bindings/crypto/st,stm32l4-aes.yaml diff --git a/drivers/crypto/crypto_stm32.c b/drivers/crypto/crypto_stm32.c index 061b9775e9290..3d833cdebb9a2 100644 --- a/drivers/crypto/crypto_stm32.c +++ b/drivers/crypto/crypto_stm32.c @@ -67,27 +67,37 @@ typedef HAL_StatusTypeDef status_t; typedef status_t (*hal_cryp_aes_op_func_t)(CRYP_HandleTypeDef *hcryp, uint8_t *in_data, uint16_t size, uint8_t *out_data, uint32_t timeout); +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32l4_aes) #define hal_ecb_encrypt_op HAL_CRYP_AESECB_Encrypt #define hal_ecb_decrypt_op HAL_CRYP_AESECB_Decrypt #define hal_cbc_encrypt_op HAL_CRYP_AESCBC_Encrypt #define hal_cbc_decrypt_op HAL_CRYP_AESCBC_Decrypt #define hal_ctr_encrypt_op HAL_CRYP_AESCTR_Encrypt #define hal_ctr_decrypt_op HAL_CRYP_AESCTR_Decrypt +#else +#define hal_ecb_encrypt_op hal_encrypt +#define hal_ecb_decrypt_op hal_decrypt +#define hal_cbc_encrypt_op hal_encrypt +#define hal_cbc_decrypt_op hal_decrypt +#define hal_ctr_encrypt_op hal_encrypt +#define hal_ctr_decrypt_op hal_decrypt +#endif -static int copy_reverse_words(uint8_t *dst_buf, int dst_len, - const uint8_t *src_buf, int src_len) +static int copy_words_adjust_endianness(uint8_t *dst_buf, int dst_len, const uint8_t *src_buf, + int src_len) { - int i; - if ((dst_len < src_len) || ((dst_len % 4) != 0)) { LOG_ERR("Buffer length error"); return -EINVAL; } memcpy(dst_buf, src_buf, src_len); - for (i = 0; i < dst_len; i += sizeof(uint32_t)) { + +#if !DT_HAS_COMPAT_STATUS_OKAY(st_stm32l4_aes) + for (int i = 0; i < dst_len; i += sizeof(uint32_t)) { sys_mem_swap(&dst_buf[i], sizeof(uint32_t)); } +#endif return 0; } @@ -102,12 +112,19 @@ static int do_aes(struct cipher_ctx *ctx, hal_cryp_aes_op_func_t fn, uint8_t *in k_sem_take(&data->device_sem, K_FOREVER); +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32l4_aes) + /* Device is initialized from the configuration in the encryption/decryption function + * called bellow. + */ + memcpy(&data->hcryp.Init, &session->config, sizeof(session->config)); +#else status = HAL_CRYP_SetConfig(&data->hcryp, &session->config); if (status != HAL_OK) { LOG_ERR("Configuration error"); k_sem_give(&data->device_sem); return -EIO; } +#endif status = fn(&data->hcryp, in_buf, in_len, out_buf, HAL_MAX_DELAY); if (status != HAL_OK) { @@ -121,6 +138,7 @@ static int do_aes(struct cipher_ctx *ctx, hal_cryp_aes_op_func_t fn, uint8_t *in return 0; } +#if !DT_HAS_COMPAT_STATUS_OKAY(st_stm32l4_aes) static status_t hal_encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout) { @@ -134,6 +152,7 @@ static status_t hal_decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uin return HAL_CRYP_Decrypt(hcryp, (uint32_t *)pCypherData, Size, (uint32_t *)pPlainData, Timeout); } +#endif static int crypto_stm32_ecb_encrypt(struct cipher_ctx *ctx, struct cipher_pkt *pkt) @@ -186,7 +205,7 @@ static int crypto_stm32_cbc_encrypt(struct cipher_ctx *ctx, struct crypto_stm32_session *session = CRYPTO_STM32_SESSN(ctx); - (void)copy_reverse_words((uint8_t *)vec, sizeof(vec), iv, BLOCK_LEN_BYTES); + (void)copy_words_adjust_endianness((uint8_t *)vec, sizeof(vec), iv, BLOCK_LEN_BYTES); session->config.pInitVect = vec; @@ -213,7 +232,7 @@ static int crypto_stm32_cbc_decrypt(struct cipher_ctx *ctx, struct crypto_stm32_session *session = CRYPTO_STM32_SESSN(ctx); - (void)copy_reverse_words((uint8_t *)vec, sizeof(vec), iv, BLOCK_LEN_BYTES); + (void)copy_words_adjust_endianness((uint8_t *)vec, sizeof(vec), iv, BLOCK_LEN_BYTES); session->config.pInitVect = vec; @@ -238,7 +257,7 @@ static int crypto_stm32_ctr_encrypt(struct cipher_ctx *ctx, struct crypto_stm32_session *session = CRYPTO_STM32_SESSN(ctx); - if (copy_reverse_words((uint8_t *)ctr, sizeof(ctr), iv, ivlen) != 0) { + if (copy_words_adjust_endianness((uint8_t *)ctr, sizeof(ctr), iv, ivlen) != 0) { return -EIO; } @@ -261,7 +280,7 @@ static int crypto_stm32_ctr_decrypt(struct cipher_ctx *ctx, struct crypto_stm32_session *session = CRYPTO_STM32_SESSN(ctx); - if (copy_reverse_words((uint8_t *)ctr, sizeof(ctr), iv, ivlen) != 0) { + if (copy_words_adjust_endianness((uint8_t *)ctr, sizeof(ctr), iv, ivlen) != 0) { return -EIO; } @@ -305,8 +324,6 @@ static int crypto_stm32_session_setup(const struct device *dev, int ctx_idx, ret; struct crypto_stm32_session *session; - struct crypto_stm32_data *data = CRYPTO_STM32_DATA(dev); - if (ctx->flags & ~(CRYP_SUPPORT)) { LOG_ERR("Unsupported flag"); return -EINVAL; @@ -353,6 +370,9 @@ static int crypto_stm32_session_setup(const struct device *dev, session = &crypto_stm32_sessions[ctx_idx]; memset(&session->config, 0, sizeof(session->config)); +#if !DT_HAS_COMPAT_STATUS_OKAY(st_stm32l4_aes) + struct crypto_stm32_data *data = CRYPTO_STM32_DATA(dev); + if (data->hcryp.State == HAL_CRYP_STATE_RESET) { if (HAL_CRYP_Init(&data->hcryp) != HAL_OK) { LOG_ERR("Initialization error"); @@ -360,6 +380,7 @@ static int crypto_stm32_session_setup(const struct device *dev, return -EIO; } } +#endif switch (ctx->keylen) { case 16U: @@ -378,15 +399,21 @@ static int crypto_stm32_session_setup(const struct device *dev, if (op_type == CRYPTO_CIPHER_OP_ENCRYPT) { switch (mode) { case CRYPTO_CIPHER_MODE_ECB: +#if !DT_HAS_COMPAT_STATUS_OKAY(st_stm32l4_aes) session->config.Algorithm = CRYP_AES_ECB; +#endif ctx->ops.block_crypt_hndlr = crypto_stm32_ecb_encrypt; break; case CRYPTO_CIPHER_MODE_CBC: +#if !DT_HAS_COMPAT_STATUS_OKAY(st_stm32l4_aes) session->config.Algorithm = CRYP_AES_CBC; +#endif ctx->ops.cbc_crypt_hndlr = crypto_stm32_cbc_encrypt; break; case CRYPTO_CIPHER_MODE_CTR: +#if !DT_HAS_COMPAT_STATUS_OKAY(st_stm32l4_aes) session->config.Algorithm = CRYP_AES_CTR; +#endif ctx->ops.ctr_crypt_hndlr = crypto_stm32_ctr_encrypt; break; default: @@ -395,15 +422,21 @@ static int crypto_stm32_session_setup(const struct device *dev, } else { switch (mode) { case CRYPTO_CIPHER_MODE_ECB: +#if !DT_HAS_COMPAT_STATUS_OKAY(st_stm32l4_aes) session->config.Algorithm = CRYP_AES_ECB; +#endif ctx->ops.block_crypt_hndlr = crypto_stm32_ecb_decrypt; break; case CRYPTO_CIPHER_MODE_CBC: +#if !DT_HAS_COMPAT_STATUS_OKAY(st_stm32l4_aes) session->config.Algorithm = CRYP_AES_CBC; +#endif ctx->ops.cbc_crypt_hndlr = crypto_stm32_cbc_decrypt; break; case CRYPTO_CIPHER_MODE_CTR: +#if !DT_HAS_COMPAT_STATUS_OKAY(st_stm32l4_aes) session->config.Algorithm = CRYP_AES_CTR; +#endif ctx->ops.ctr_crypt_hndlr = crypto_stm32_ctr_decrypt; break; default: @@ -411,7 +444,7 @@ static int crypto_stm32_session_setup(const struct device *dev, } } - ret = copy_reverse_words((uint8_t *)session->key, CRYPTO_STM32_AES_MAX_KEY_LEN, + ret = copy_words_adjust_endianness((uint8_t *)session->key, CRYPTO_STM32_AES_MAX_KEY_LEN, ctx->key.bit_stream, ctx->keylen); if (ret != 0) { return -EIO; @@ -419,7 +452,10 @@ static int crypto_stm32_session_setup(const struct device *dev, session->config.pKey = session->key; session->config.DataType = CRYP_DATATYPE_8B; + +#if !DT_HAS_COMPAT_STATUS_OKAY(st_stm32l4_aes) session->config.DataWidthUnit = CRYP_DATAWIDTHUNIT_BYTE; +#endif ctx->drv_sessn_state = session; ctx->device = dev; @@ -448,12 +484,14 @@ static int crypto_stm32_session_free(const struct device *dev, } } +#if !DT_HAS_COMPAT_STATUS_OKAY(st_stm32l4_aes) /* Deinitialize and reset peripheral. */ if (HAL_CRYP_DeInit(&data->hcryp) != HAL_OK) { LOG_ERR("Deinitialization error"); k_sem_give(&data->session_sem); return -EIO; } +#endif (void)reset_line_toggle_dt(&cfg->reset); diff --git a/drivers/crypto/crypto_stm32_priv.h b/drivers/crypto/crypto_stm32_priv.h index ff9dade6a23c9..e74b33beb13e1 100644 --- a/drivers/crypto/crypto_stm32_priv.h +++ b/drivers/crypto/crypto_stm32_priv.h @@ -8,6 +8,12 @@ #ifndef ZEPHYR_DRIVERS_CRYPTO_CRYPTO_STM32_PRIV_H_ #define ZEPHYR_DRIVERS_CRYPTO_CRYPTO_STM32_PRIV_H_ +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32l4_aes) +#define crypt_config_t CRYP_InitTypeDef +#else +#define crypt_config_t CRYP_ConfigTypeDef +#endif + /* Maximum supported key length is 256 bits */ #define CRYPTO_STM32_AES_MAX_KEY_LEN (256 / 8) @@ -23,7 +29,7 @@ struct crypto_stm32_data { }; struct crypto_stm32_session { - CRYP_ConfigTypeDef config; + crypt_config_t config; uint32_t key[CRYPTO_STM32_AES_MAX_KEY_LEN / sizeof(uint32_t)]; bool in_use; }; diff --git a/dts/bindings/crypto/st,stm32l4-aes.yaml b/dts/bindings/crypto/st,stm32l4-aes.yaml new file mode 100644 index 0000000000000..e373530aab57f --- /dev/null +++ b/dts/bindings/crypto/st,stm32l4-aes.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2024, Lucas Dietrich +# SPDX-License-Identifier: Apache-2.0 + +description: STM32L4 AES Accelerator + +compatible: "st,stm32l4-aes" + +include: st,stm32-crypto-common.yaml From 11abb5e4fca4893139828c0f0fbe9b2f2d48c207 Mon Sep 17 00:00:00 2001 From: Lucas Dietrich Date: Tue, 24 Sep 2024 22:42:07 +0200 Subject: [PATCH 0639/4482] drivers: crypto: Fix pointer type warnings in STM32 AES driver This patch resolves compiler warnings related to mismatched pointer types between the STM32L4 and generic STM32 AES HAL by introducing CAST_VEC macro. Fix github CI warning Signed-off-by: Lucas Dietrich --- drivers/crypto/crypto_stm32.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/crypto_stm32.c b/drivers/crypto/crypto_stm32.c index 3d833cdebb9a2..bd7e05a2ddcdd 100644 --- a/drivers/crypto/crypto_stm32.c +++ b/drivers/crypto/crypto_stm32.c @@ -83,6 +83,15 @@ typedef status_t (*hal_cryp_aes_op_func_t)(CRYP_HandleTypeDef *hcryp, uint8_t *i #define hal_ctr_decrypt_op hal_decrypt #endif +/* L4 HAL driver uses uint8_t pointers for input/output data while the generic HAL driver uses + * uint32_t pointers. + */ +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32l4_aes) +#define CAST_VEC(x) (uint8_t *)(x) +#else +#define CAST_VEC(x) (uint32_t *)(x) +#endif + static int copy_words_adjust_endianness(uint8_t *dst_buf, int dst_len, const uint8_t *src_buf, int src_len) { @@ -207,7 +216,7 @@ static int crypto_stm32_cbc_encrypt(struct cipher_ctx *ctx, (void)copy_words_adjust_endianness((uint8_t *)vec, sizeof(vec), iv, BLOCK_LEN_BYTES); - session->config.pInitVect = vec; + session->config.pInitVect = CAST_VEC(vec); if ((ctx->flags & CAP_NO_IV_PREFIX) == 0U) { /* Prefix IV to ciphertext unless CAP_NO_IV_PREFIX is set. */ @@ -234,7 +243,7 @@ static int crypto_stm32_cbc_decrypt(struct cipher_ctx *ctx, (void)copy_words_adjust_endianness((uint8_t *)vec, sizeof(vec), iv, BLOCK_LEN_BYTES); - session->config.pInitVect = vec; + session->config.pInitVect = CAST_VEC(vec); if ((ctx->flags & CAP_NO_IV_PREFIX) == 0U) { in_offset = 16; @@ -261,7 +270,7 @@ static int crypto_stm32_ctr_encrypt(struct cipher_ctx *ctx, return -EIO; } - session->config.pInitVect = ctr; + session->config.pInitVect = CAST_VEC(ctr); ret = do_aes(ctx, hal_ctr_encrypt_op, pkt->in_buf, pkt->in_len, pkt->out_buf); if (ret == 0) { @@ -284,7 +293,7 @@ static int crypto_stm32_ctr_decrypt(struct cipher_ctx *ctx, return -EIO; } - session->config.pInitVect = ctr; + session->config.pInitVect = CAST_VEC(ctr); ret = do_aes(ctx, hal_ctr_decrypt_op, pkt->in_buf, pkt->in_len, pkt->out_buf); if (ret == 0) { @@ -450,7 +459,7 @@ static int crypto_stm32_session_setup(const struct device *dev, return -EIO; } - session->config.pKey = session->key; + session->config.pKey = CAST_VEC(session->key); session->config.DataType = CRYP_DATATYPE_8B; #if !DT_HAS_COMPAT_STATUS_OKAY(st_stm32l4_aes) From 1d9af414d613f32481d1d6b3fecd6f134bf6f258 Mon Sep 17 00:00:00 2001 From: Lucas Dietrich Date: Tue, 24 Sep 2024 22:53:36 +0200 Subject: [PATCH 0640/4482] dts: stm32l4: Update AES node for stm32l4 series The stm32l4 devices were previously assigned the generic STM32 AES driver, which turned out to be incompatible with the stm32l4 series. This commit updates the nodes to use the new driver specifically designed for this series. Add missing node for stm32l4a6, stm32l4q5, stm32l4s5 and stm32l486 socs. It appears stm32l4p5 and stm32l496 socs do not have the AES accelerator present, so the nodes are removed from the dts files. Signed-off-by: Lucas Dietrich --- dts/arm/st/l4/stm32l422.dtsi | 2 +- dts/arm/st/l4/stm32l462.dtsi | 2 +- dts/arm/st/l4/stm32l486.dtsi | 10 ++++++++++ dts/arm/st/l4/stm32l496.dtsi | 10 ---------- dts/arm/st/l4/stm32l4a6.dtsi | 10 ++++++++++ dts/arm/st/l4/stm32l4p5.dtsi | 10 ---------- dts/arm/st/l4/stm32l4q5.dtsi | 10 ++++++++++ dts/arm/st/l4/stm32l4s5.dtsi | 10 ++++++++++ 8 files changed, 42 insertions(+), 22 deletions(-) diff --git a/dts/arm/st/l4/stm32l422.dtsi b/dts/arm/st/l4/stm32l422.dtsi index ee534f52e8030..ce672dd412878 100644 --- a/dts/arm/st/l4/stm32l422.dtsi +++ b/dts/arm/st/l4/stm32l422.dtsi @@ -11,7 +11,7 @@ compatible = "st,stm32l422", "st,stm32l4", "simple-bus"; aes: aes@50060000 { - compatible = "st,stm32-aes"; + compatible = "st,stm32l4-aes", "st,stm32-aes"; reg = <0x50060000 0x400>; clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00010000>; resets = <&rctl STM32_RESET(AHB2, 16U)>; diff --git a/dts/arm/st/l4/stm32l462.dtsi b/dts/arm/st/l4/stm32l462.dtsi index 470f03ffbd86c..40093d76f7e22 100644 --- a/dts/arm/st/l4/stm32l462.dtsi +++ b/dts/arm/st/l4/stm32l462.dtsi @@ -11,7 +11,7 @@ compatible = "st,stm32l462", "st,stm32l4", "simple-bus"; aes: aes@50060000 { - compatible = "st,stm32-aes"; + compatible = "st,stm32l4-aes", "st,stm32-aes"; reg = <0x50060000 0x400>; clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00010000>; resets = <&rctl STM32_RESET(AHB2, 16U)>; diff --git a/dts/arm/st/l4/stm32l486.dtsi b/dts/arm/st/l4/stm32l486.dtsi index aec8e5d95d60b..2851b6a37c1c7 100644 --- a/dts/arm/st/l4/stm32l486.dtsi +++ b/dts/arm/st/l4/stm32l486.dtsi @@ -9,5 +9,15 @@ / { soc { compatible = "st,stm32l486", "st,stm32l4", "simple-bus"; + + aes: aes@50060000 { + compatible = "st,stm32l4-aes", "st,stm32-aes"; + reg = <0x50060000 0x400>; + clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00010000>; + resets = <&rctl STM32_RESET(AHB2, 16U)>; + interrupts = <79 0>; + interrupt-names = "aes"; + status = "disabled"; + }; }; }; diff --git a/dts/arm/st/l4/stm32l496.dtsi b/dts/arm/st/l4/stm32l496.dtsi index a37e56b09a54c..8416fe6a192c9 100644 --- a/dts/arm/st/l4/stm32l496.dtsi +++ b/dts/arm/st/l4/stm32l496.dtsi @@ -60,16 +60,6 @@ status = "disabled"; }; - aes: aes@50060000 { - compatible = "st,stm32-aes"; - reg = <0x50060000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00010000>; - resets = <&rctl STM32_RESET(AHB2, 16U)>; - interrupts = <79 0>; - interrupt-names = "aes"; - status = "disabled"; - }; - usbotg_fs: otgfs@50000000 { clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00001000>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; diff --git a/dts/arm/st/l4/stm32l4a6.dtsi b/dts/arm/st/l4/stm32l4a6.dtsi index f2eb4b5842261..49e9f838219e1 100644 --- a/dts/arm/st/l4/stm32l4a6.dtsi +++ b/dts/arm/st/l4/stm32l4a6.dtsi @@ -9,5 +9,15 @@ / { soc { compatible = "st,stm32l4a6", "st,stm32l4", "simple-bus"; + + aes: aes@50060000 { + compatible = "st,stm32l4-aes", "st,stm32-aes"; + reg = <0x50060000 0x400>; + clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00010000>; + resets = <&rctl STM32_RESET(AHB2, 16U)>; + interrupts = <79 0>; + interrupt-names = "aes"; + status = "disabled"; + }; }; }; diff --git a/dts/arm/st/l4/stm32l4p5.dtsi b/dts/arm/st/l4/stm32l4p5.dtsi index 5cc05ab2f553b..d8d67db5d48d2 100644 --- a/dts/arm/st/l4/stm32l4p5.dtsi +++ b/dts/arm/st/l4/stm32l4p5.dtsi @@ -294,16 +294,6 @@ status = "disabled"; }; - aes: aes@50060000 { - compatible = "st,stm32-aes"; - reg = <0x50060000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00010000>; - resets = <&rctl STM32_RESET(AHB2, 16U)>; - interrupts = <79 0>; - interrupt-names = "aes"; - status = "disabled"; - }; - usbotg_fs: otgfs@50000000 { compatible = "st,stm32-otgfs"; reg = <0x50000000 0x40000>; diff --git a/dts/arm/st/l4/stm32l4q5.dtsi b/dts/arm/st/l4/stm32l4q5.dtsi index 10eba4189d016..725a26b46a9a1 100644 --- a/dts/arm/st/l4/stm32l4q5.dtsi +++ b/dts/arm/st/l4/stm32l4q5.dtsi @@ -9,5 +9,15 @@ / { soc { compatible = "st,stm32l4q5", "st,stm32l4", "simple-bus"; + + aes: aes@50060000 { + compatible = "st,stm32l4-aes", "st,stm32-aes"; + reg = <0x50060000 0x400>; + clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00010000>; + resets = <&rctl STM32_RESET(AHB2, 16U)>; + interrupts = <79 0>; + interrupt-names = "aes"; + status = "disabled"; + }; }; }; diff --git a/dts/arm/st/l4/stm32l4s5.dtsi b/dts/arm/st/l4/stm32l4s5.dtsi index de6b5db0d05f7..623ef46fd1c14 100644 --- a/dts/arm/st/l4/stm32l4s5.dtsi +++ b/dts/arm/st/l4/stm32l4s5.dtsi @@ -9,5 +9,15 @@ / { soc { compatible = "st,stm32l4s5", "st,stm32l4", "simple-bus"; + + aes: aes@50060000 { + compatible = "st,stm32l4-aes", "st,stm32-aes"; + reg = <0x50060000 0x400>; + clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00010000>; + resets = <&rctl STM32_RESET(AHB2, 16U)>; + interrupts = <79 0>; + interrupt-names = "aes"; + status = "disabled"; + }; }; }; From d056455fce1afda41ba7313d1a2998d6bc08aaac Mon Sep 17 00:00:00 2001 From: Lucas Dietrich Date: Wed, 25 Sep 2024 20:43:56 +0200 Subject: [PATCH 0641/4482] dts: Enable AES node in nucleo_l4a6zg.dts Activate AES node in nucleo_l4a6zg.dts to enable testing of the st,stm32l4-aes driver in CI. Signed-off-by: Lucas Dietrich --- boards/st/nucleo_l4a6zg/nucleo_l4a6zg.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boards/st/nucleo_l4a6zg/nucleo_l4a6zg.dts b/boards/st/nucleo_l4a6zg/nucleo_l4a6zg.dts index 5e160d685569a..3e5a14298d9c2 100644 --- a/boards/st/nucleo_l4a6zg/nucleo_l4a6zg.dts +++ b/boards/st/nucleo_l4a6zg/nucleo_l4a6zg.dts @@ -141,3 +141,7 @@ &wwdg { status = "okay"; }; + +&aes { + status = "okay"; +}; From 6f95a5055399e1030732a76e35492cda378cd161 Mon Sep 17 00:00:00 2001 From: Curtis Malainey Date: Tue, 3 Sep 2024 15:24:18 -0700 Subject: [PATCH 0642/4482] lib: fix ubsan errors in cbvprintf_package It is undefined behaviour to shift / add offsets to a null pointer. Move to direct offset tracking to satisfy UBSAN. Simple translation of code: buf0 -> buf buf +=/++ -> offset +=/++ buf = -> buf+offset = Signed-off-by: Curtis Malainey --- lib/os/cbprintf_packaged.c | 105 +++++++++++++++++++------------------ 1 file changed, 53 insertions(+), 52 deletions(-) diff --git a/lib/os/cbprintf_packaged.c b/lib/os/cbprintf_packaged.c index 9a3b456edade3..0e6a7d14a337b 100644 --- a/lib/os/cbprintf_packaged.c +++ b/lib/os/cbprintf_packaged.c @@ -242,10 +242,10 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, #define STR_POS_MASK BIT_MASK(7) /* Buffer offset abstraction for better code clarity. */ -#define BUF_OFFSET ((uintptr_t)buf - (uintptr_t)buf0) +#define BUF_OFFSET offset - uint8_t *buf0 = packaged; /* buffer start (may be NULL) */ - uint8_t *buf = buf0; /* current buffer position */ + uint8_t *buf = packaged; /* buffer start (may be NULL) */ + size_t offset = 0; /* current buffer position */ unsigned int size; /* current argument's size */ unsigned int align; /* current argument's required alignment */ uint8_t str_ptr_pos[16]; /* string pointer positions */ @@ -294,16 +294,16 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, * * Refer to union cbprintf_package_hdr for more details. */ - buf += sizeof(*pkg_hdr); + offset += sizeof(*pkg_hdr); /* - * When buf0 is NULL we don't store anything. + * When buf is NULL we don't store anything. * Instead we count the needed space to store the data. * In this case, incoming len argument indicates the anticipated * buffer "misalignment" offset. */ - if (buf0 == NULL) { - buf += len % CBPRINTF_PACKAGE_ALIGNMENT; + if (buf == NULL) { + offset += len % CBPRINTF_PACKAGE_ALIGNMENT; /* * The space to store the data is represented by both the * buffer offset as well as the extra string data to be @@ -324,7 +324,7 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, * Otherwise we must ensure we can store at least * the pointer to the format string itself. */ - if ((buf0 != NULL) && (BUF_OFFSET + sizeof(char *)) > len) { + if ((buf != NULL) && (BUF_OFFSET + sizeof(char *)) > len) { return -ENOSPC; } @@ -355,18 +355,18 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, size = sizeof(int); /* align destination buffer location */ - buf = (void *)ROUND_UP(buf, align); + offset = ROUND_UP(offset, align); /* make sure the data fits */ - if (buf0 != NULL && BUF_OFFSET + size > len) { + if (buf != NULL && BUF_OFFSET + size > len) { return -ENOSPC; } - if (buf0 != NULL) { - *(int *)buf = arg_tag; + if (buf != NULL) { + *(int *)(buf + offset) = arg_tag; } - buf += sizeof(int); + offset += sizeof(int); if (arg_tag == CBPRINTF_PACKAGE_ARG_TYPE_END) { /* End of arguments */ @@ -430,21 +430,21 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, } /* align destination buffer location */ - buf = (void *) ROUND_UP(buf, align); - if (buf0 != NULL) { + offset = ROUND_UP(offset, align); + if (buf != NULL) { /* make sure it fits */ if ((BUF_OFFSET + size) > len) { return -ENOSPC; } if (Z_CBPRINTF_VA_STACK_LL_DBL_MEMCPY) { - memcpy(buf, (uint8_t *)&v, size); + memcpy((buf + offset), (uint8_t *)&v, size); } else if (fmt[-1] == 'L') { - *(long double *)buf = v.ld; + *(long double *)(buf + offset) = v.ld; } else { - *(double *)buf = v.d; + *(double *)(buf + offset) = v.d; } } - buf += size; + offset += size; parsing = false; continue; } @@ -577,21 +577,21 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, size = sizeof(double); } /* align destination buffer location */ - buf = (void *) ROUND_UP(buf, align); - if (buf0 != NULL) { + offset = ROUND_UP(offset, align); + if (buf != NULL) { /* make sure it fits */ if (BUF_OFFSET + size > len) { return -ENOSPC; } if (Z_CBPRINTF_VA_STACK_LL_DBL_MEMCPY) { - memcpy(buf, (uint8_t *)&v, size); + memcpy(buf + offset, (uint8_t *)&v, size); } else if (fmt[-1] == 'L') { - *(long double *)buf = v.ld; + *(long double *)(buf + offset) = v.ld; } else { - *(double *)buf = v.d; + *(double *)(buf + offset) = v.d; } } - buf += size; + offset += size; parsing = false; continue; } @@ -603,10 +603,10 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, } /* align destination buffer location */ - buf = (void *) ROUND_UP(buf, align); + offset = ROUND_UP(offset, align); /* make sure the data fits */ - if ((buf0 != NULL) && (BUF_OFFSET + size) > len) { + if ((buf != NULL) && (BUF_OFFSET + size) > len) { return -ENOSPC; } @@ -614,8 +614,8 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, if (is_str_arg) { s = va_arg(ap, char *); process_string: - if (buf0 != NULL) { - *(const char **)buf = s; + if (buf != NULL) { + *(const char **)(buf + offset) = s; } bool is_ro = (fros_cnt-- > 0) ? true : ptr_in_rodata(s); @@ -642,7 +642,7 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, return -EINVAL; } - if (buf0 != NULL) { + if (buf != NULL) { /* * Remember string pointer location. * We will append non-ro strings later. @@ -678,34 +678,34 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, s_idx++; } - buf += sizeof(char *); + offset += sizeof(char *); is_str_arg = false; } else if (size == sizeof(int)) { int v = va_arg(ap, int); - if (buf0 != NULL) { - *(int *)buf = v; + if (buf != NULL) { + *(int *)(buf + offset) = v; } - buf += sizeof(int); + offset += sizeof(int); } else if (size == sizeof(long)) { long v = va_arg(ap, long); - if (buf0 != NULL) { - *(long *)buf = v; + if (buf != NULL) { + *(long *)(buf + offset) = v; } - buf += sizeof(long); + offset += sizeof(long); } else if (size == sizeof(long long)) { long long v = va_arg(ap, long long); - if (buf0 != NULL) { + if (buf != NULL) { if (Z_CBPRINTF_VA_STACK_LL_DBL_MEMCPY) { - memcpy(buf, (uint8_t *)&v, sizeof(long long)); + memcpy(buf + offset, (uint8_t *)&v, sizeof(long long)); } else { - *(long long *)buf = v; + *(long long *)(buf + offset) = v; } } - buf += sizeof(long long); + offset += sizeof(long long); } else { __ASSERT(false, "unexpected size %u", size); return -EINVAL; @@ -727,12 +727,12 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, * If all we wanted was to count required buffer size * then we have it now. */ - if (buf0 == NULL) { + if (buf == NULL) { return BUF_OFFSET + len - CBPRINTF_PACKAGE_ALIGNMENT; } /* Clear our buffer header. We made room for it initially. */ - *(char **)buf0 = NULL; + *(char **)buf = NULL; /* Record end of argument list. */ pkg_hdr->desc.len = BUF_OFFSET / sizeof(int); @@ -767,8 +767,8 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, return -ENOSPC; } /* store the pointer position prefix */ - *buf = pos; - ++buf; + *(buf + offset) = pos; + ++offset; } } @@ -781,12 +781,13 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, if (rws_pos_en) { size = 0; - *buf++ = str_ptr_arg[i]; + *(buf + offset) = str_ptr_arg[i]; + offset++; } else { /* retrieve the string pointer */ - s = *(char **)(buf0 + str_ptr_pos[i] * sizeof(int)); + s = *(char **)(buf + str_ptr_pos[i] * sizeof(int)); /* clear the in-buffer pointer (less entropy if compressed) */ - *(char **)(buf0 + str_ptr_pos[i] * sizeof(int)) = NULL; + *(char **)(buf + str_ptr_pos[i] * sizeof(int)) = NULL; /* find the string length including terminating '\0' */ size = strlen(s) + 1; } @@ -796,11 +797,11 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, return -ENOSPC; } /* store the pointer position prefix */ - *buf = str_ptr_pos[i]; - ++buf; + *(buf + offset) = str_ptr_pos[i]; + ++offset; /* copy the string with its terminating '\0' */ - memcpy(buf, (uint8_t *)s, size); - buf += size; + memcpy(buf + offset, (uint8_t *)s, size); + offset += size; } /* From 59dbbb347d8a3c142228c670cf79361a3a607602 Mon Sep 17 00:00:00 2001 From: "Duy Phuong Hoang. Nguyen" Date: Sun, 21 Jul 2024 20:52:47 +0700 Subject: [PATCH 0643/4482] drivers: pwm: Initial support for PWM driver on RA8 Add PWM driver code support for RA8. This support is using GPT HW Signed-off-by: Duy Phuong Hoang. Nguyen --- boards/renesas/ek_ra8m1/doc/index.rst | 2 + boards/renesas/ek_ra8m1/ek_ra8m1-pinctrl.dtsi | 11 + boards/renesas/ek_ra8m1/ek_ra8m1.dts | 6 + drivers/pwm/CMakeLists.txt | 1 + drivers/pwm/Kconfig | 2 + drivers/pwm/Kconfig.renesas_ra8 | 10 + drivers/pwm/pwm_renesas_ra8.c | 570 ++++++++++++++++++ dts/arm/renesas/ra/ra8/ra8x1.dtsi | 141 +++++ dts/bindings/pwm/renesas,ra8-pwm.yaml | 34 ++ include/zephyr/dt-bindings/pwm/ra_pwm.h | 39 ++ modules/Kconfig.renesas_fsp | 5 + tests/drivers/pwm/pwm_api/src/test_pwm.c | 3 + .../pwm/pwm_loopback/boards/ek_ra8m1.overlay | 37 ++ 13 files changed, 861 insertions(+) create mode 100644 drivers/pwm/Kconfig.renesas_ra8 create mode 100644 drivers/pwm/pwm_renesas_ra8.c create mode 100644 dts/bindings/pwm/renesas,ra8-pwm.yaml create mode 100644 include/zephyr/dt-bindings/pwm/ra_pwm.h create mode 100644 tests/drivers/pwm/pwm_loopback/boards/ek_ra8m1.overlay diff --git a/boards/renesas/ek_ra8m1/doc/index.rst b/boards/renesas/ek_ra8m1/doc/index.rst index 84b168eb23eee..21897fff0bff4 100644 --- a/boards/renesas/ek_ra8m1/doc/index.rst +++ b/boards/renesas/ek_ra8m1/doc/index.rst @@ -106,6 +106,8 @@ The below features are currently supported on Zephyr OS for EK-RA8M1 board: +-----------+------------+----------------------+ | FLASH | on-chip | flash | +-----------+------------+----------------------+ +| PWM | on-chip | pwm | ++-----------+------------+----------------------+ Other hardware features are currently not supported by the port. diff --git a/boards/renesas/ek_ra8m1/ek_ra8m1-pinctrl.dtsi b/boards/renesas/ek_ra8m1/ek_ra8m1-pinctrl.dtsi index b43c4be60ab81..006a2d5f855e1 100644 --- a/boards/renesas/ek_ra8m1/ek_ra8m1-pinctrl.dtsi +++ b/boards/renesas/ek_ra8m1/ek_ra8m1-pinctrl.dtsi @@ -53,4 +53,15 @@ ; }; }; + + pwm7_default: pwm7_default { + group1 { + /* GTIOC7A */ + psels = ; + }; + group2 { + /* GTIOC7B */ + psels = ; + }; + }; }; diff --git a/boards/renesas/ek_ra8m1/ek_ra8m1.dts b/boards/renesas/ek_ra8m1/ek_ra8m1.dts index 0e3b6ec3cd514..3d0c8dba180e9 100644 --- a/boards/renesas/ek_ra8m1/ek_ra8m1.dts +++ b/boards/renesas/ek_ra8m1/ek_ra8m1.dts @@ -167,6 +167,12 @@ mikrobus_serial: &uart3 {}; &spi1 { pinctrl-0 = <&spi1_default>; +}; + +&pwm7 { + pinctrl-0 = <&pwm7_default>; + interrupts = <40 1>, <41 1>; + interrupt-names = "gtioca", "overflow"; pinctrl-names = "default"; status = "okay"; }; diff --git a/drivers/pwm/CMakeLists.txt b/drivers/pwm/CMakeLists.txt index 2d229bd6bb280..dbf59444e7e42 100644 --- a/drivers/pwm/CMakeLists.txt +++ b/drivers/pwm/CMakeLists.txt @@ -44,6 +44,7 @@ zephyr_library_sources_ifdef(CONFIG_PWM_NUMAKER pwm_numaker.c) zephyr_library_sources_ifdef(CONFIG_PWM_NXP_FLEXIO pwm_nxp_flexio.c) zephyr_library_sources_ifdef(CONFIG_PWM_NXP_S32_EMIOS pwm_nxp_s32_emios.c) zephyr_library_sources_ifdef(CONFIG_PWM_ENE_KB1200 pwm_ene_kb1200.c) +zephyr_library_sources_ifdef(CONFIG_PWM_RENESAS_RA8 pwm_renesas_ra8.c) zephyr_library_sources_ifdef(CONFIG_USERSPACE pwm_handlers.c) zephyr_library_sources_ifdef(CONFIG_PWM_CAPTURE pwm_capture.c) diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig index b99ba35dafc23..53562f238239a 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig @@ -108,4 +108,6 @@ source "drivers/pwm/Kconfig.nxp_flexio" source "drivers/pwm/Kconfig.ene" +source "drivers/pwm/Kconfig.renesas_ra8" + endif # PWM diff --git a/drivers/pwm/Kconfig.renesas_ra8 b/drivers/pwm/Kconfig.renesas_ra8 new file mode 100644 index 0000000000000..31701a132ce9e --- /dev/null +++ b/drivers/pwm/Kconfig.renesas_ra8 @@ -0,0 +1,10 @@ +# Copyright (c) 2024 Renesas Electronics Corporation +# SPDX-License-Identifier: Apache-2.0 + +config PWM_RENESAS_RA8 + bool "Renesas RA8 PWM driver" + default y + depends on DT_HAS_RENESAS_RA8_PWM_ENABLED + select USE_RA_FSP_GPT + help + Enable Renesas RA8 PWM Driver. diff --git a/drivers/pwm/pwm_renesas_ra8.c b/drivers/pwm/pwm_renesas_ra8.c new file mode 100644 index 0000000000000..cb41ae82a1eae --- /dev/null +++ b/drivers/pwm/pwm_renesas_ra8.c @@ -0,0 +1,570 @@ +/* + * Copyright (c) 2024 Renesas Electronics Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include +#include +#include +#include +#include +#include "r_gpt.h" +#include "r_gpt_cfg.h" +#include +#include + +LOG_MODULE_REGISTER(pwm_renesas_ra8, CONFIG_PWM_LOG_LEVEL); + +#define DT_DRV_COMPAT renesas_ra8_pwm + +#define MAX_PIN 2U +#define GPT_PRV_GTIO_HIGH_COMPARE_MATCH_LOW_CYCLE_END 0x6U +#define GPT_PRV_GTIO_LOW_COMPARE_MATCH_HIGH_CYCLE_END 0x9U +#define GPT_PRV_GTIOR_INITIAL_LEVEL_BIT 4 +#define GPT_PRV_GTIO_TOGGLE_COMPARE_MATCH 0x3U + +struct pwm_ra8_capture_data { + pwm_capture_callback_handler_t callback; + void *user_data; + uint64_t period; + uint64_t pulse; + bool is_pulse_capture; + bool is_busy; + uint32_t overflows; + bool continuous; +}; + +struct pwm_ra8_data { + gpt_instance_ctrl_t fsp_ctrl; + timer_cfg_t fsp_cfg; + gpt_extended_cfg_t extend_cfg; + uint16_t capture_a_event; + uint16_t overflow_event; + +#ifdef CONFIG_PWM_CAPTURE + struct pwm_ra8_capture_data capture; +#endif /* CONFIG_PWM_CAPTURE */ +}; + +struct pwm_ra8_config { + const struct device *clock_dev; + struct clock_control_ra_subsys_cfg clock_subsys; + const struct pinctrl_dev_config *pincfg; +}; + +static uint32_t pwm_ra8_gtior_calculate(gpt_pin_level_t const stop_level) +{ + /* The stop level is used as both the initial level and the stop level. */ + uint32_t gtior = R_GPT0_GTIOR_OAE_Msk | ((uint32_t)stop_level << R_GPT0_GTIOR_OADFLT_Pos) | + ((uint32_t)stop_level << GPT_PRV_GTIOR_INITIAL_LEVEL_BIT); + + uint32_t gtion = GPT_PRV_GTIO_LOW_COMPARE_MATCH_HIGH_CYCLE_END; + + /* Calculate the gtior value for PWM mode only */ + gtior |= gtion; + + return gtior; +} + +static int pwm_ra8_apply_gtior_config(gpt_instance_ctrl_t *const p_ctrl, + timer_cfg_t const *const p_cfg) +{ + gpt_extended_cfg_t *p_extend = (gpt_extended_cfg_t *)p_cfg->p_extend; + uint32_t gtior = p_extend->gtior_setting.gtior; + +#if GPT_CFG_OUTPUT_SUPPORT_ENABLE + + /* Check if custom GTIOR settings are provided. */ + if (p_extend->gtior_setting.gtior == 0) { + /* If custom GTIOR settings are not provided, calculate GTIOR. */ + if (p_extend->gtioca.output_enabled) { + uint32_t gtioca_gtior = + pwm_ra8_gtior_calculate(p_extend->gtioca.stop_level); + + gtior |= gtioca_gtior << R_GPT0_GTIOR_GTIOA_Pos; + } + + if (p_extend->gtiocb.output_enabled) { + uint32_t gtiocb_gtior = + pwm_ra8_gtior_calculate(p_extend->gtiocb.stop_level); + + gtior |= gtiocb_gtior << R_GPT0_GTIOR_GTIOB_Pos; + } + } +#endif + +#if GPT_PRV_EXTRA_FEATURES_ENABLED == GPT_CFG_OUTPUT_SUPPORT_ENABLE + gpt_extended_pwm_cfg_t const *p_pwm_cfg = p_extend->p_pwm_cfg; + + if (NULL != p_pwm_cfg) { + /* Check if custom GTIOR settings are provided. */ + if (p_extend->gtior_setting.gtior == 0) { + /* If custom GTIOR settings are not provided, set gtioca_disable_settings + * and gtiocb_disable_settings. + */ + gtior |= (uint32_t)(p_pwm_cfg->gtioca_disable_setting + << R_GPT0_GTIOR_OADF_Pos); + gtior |= (uint32_t)(p_pwm_cfg->gtiocb_disable_setting + << R_GPT0_GTIOR_OBDF_Pos); + } + } +#endif + + /* Check if custom GTIOR settings are provided. */ + if (p_extend->gtior_setting.gtior == 0) { + /* + * If custom GTIOR settings are not provided, configure the noise filter for + * the GTIOC pins. + */ + gtior |= (uint32_t)(p_extend->capture_filter_gtioca << R_GPT0_GTIOR_NFAEN_Pos); + gtior |= (uint32_t)(p_extend->capture_filter_gtiocb << R_GPT0_GTIOR_NFBEN_Pos); + } + + /* Set the I/O control register. */ + p_ctrl->p_reg->GTIOR = gtior; + + return 0; +} + +static int pwm_ra8_set_cycles(const struct device *dev, uint32_t pin, uint32_t period_cycles, + uint32_t pulse_cycles, pwm_flags_t flags) +{ + struct pwm_ra8_data *data = dev->data; + uint32_t pulse; + fsp_err_t err; + + if (pin >= MAX_PIN) { + LOG_ERR("Only valid for gtioca and gtiocb pins"); + return -EINVAL; + } + + if ((data->fsp_ctrl.variant == TIMER_VARIANT_16_BIT && period_cycles > UINT16_MAX) || + (data->fsp_ctrl.variant == TIMER_VARIANT_32_BIT && period_cycles > UINT32_MAX)) { + LOG_ERR("Out of range period cycles are not valid"); + return -EINVAL; + } + + /* gtioca and gtiocb setting */ + if (pin == GPT_IO_PIN_GTIOCA) { + data->extend_cfg.gtioca.output_enabled = true; + } else { + data->extend_cfg.gtiocb.output_enabled = true; + } + + pulse = (flags & PWM_POLARITY_INVERTED) ? period_cycles - pulse_cycles : pulse_cycles; + + /* Apply gtio output setting */ + pwm_ra8_apply_gtior_config(&data->fsp_ctrl, &data->fsp_cfg); + + /* Stop timer */ + err = R_GPT_Stop(&data->fsp_ctrl); + if (err != FSP_SUCCESS) { + return -EIO; + } + + /* Update period cycles, reflected at an overflow */ + err = R_GPT_PeriodSet(&data->fsp_ctrl, period_cycles); + if (err != FSP_SUCCESS) { + return -EIO; + } + + /* Update pulse cycles, reflected at an overflow */ + err = R_GPT_DutyCycleSet(&data->fsp_ctrl, pulse, pin); + if (err != FSP_SUCCESS) { + return -EIO; + } + + /* Start timer */ + err = R_GPT_Start(&data->fsp_ctrl); + if (err != FSP_SUCCESS) { + return -EIO; + } + + LOG_DBG("channel %u, pin %u, pulse %u, period %u, prescaler: %u.", data->fsp_cfg.channel, + pin, pulse_cycles, period_cycles, data->fsp_cfg.source_div); + + return 0; +}; + +static int pwm_ra8_get_cycles_per_sec(const struct device *dev, uint32_t pin, uint64_t *cycles) +{ + struct pwm_ra8_data *data = dev->data; + timer_info_t info; + fsp_err_t err; + + if (pin >= MAX_PIN) { + LOG_ERR("Only valid for gtioca and gtiocb pins"); + return -EINVAL; + } + + err = R_GPT_InfoGet(&data->fsp_ctrl, &info); + if (err != FSP_SUCCESS) { + return -EIO; + } + *cycles = (uint64_t)info.clock_frequency; + + return 0; +}; + +#ifdef CONFIG_PWM_CAPTURE +extern void gpt_capture_compare_a_isr(void); +extern void gpt_counter_overflow_isr(void); + +static void enable_irq(IRQn_Type const irq, uint32_t priority, void *p_context) +{ + if (irq >= 0) { + R_BSP_IrqCfgEnable(irq, priority, p_context); + } +} +static void disable_irq(IRQn_Type irq) +{ + /* Disable interrupts. */ + if (irq >= 0) { + R_BSP_IrqDisable(irq); + R_FSP_IsrContextSet(irq, NULL); + } +} + +static int pwm_ra8_configure_capture(const struct device *dev, uint32_t pin, pwm_flags_t flags, + pwm_capture_callback_handler_t cb, void *user_data) +{ + struct pwm_ra8_data *data = dev->data; + + if (pin != GPT_IO_PIN_GTIOCA) { + LOG_ERR("Feature only support for gtioca"); + return -EINVAL; + } + if (!(flags & PWM_CAPTURE_TYPE_MASK)) { + LOG_ERR("No PWWM capture type specified"); + return -EINVAL; + } + if ((flags & PWM_CAPTURE_TYPE_MASK) == PWM_CAPTURE_TYPE_BOTH) { + LOG_ERR("Cannot capture both period and pulse width"); + return -ENOTSUP; + } + if (data->capture.is_busy) { + LOG_ERR("Capture already active on this pin"); + return -EBUSY; + } + + if (flags & PWM_CAPTURE_TYPE_PERIOD) { + data->capture.is_pulse_capture = false; + + if (flags & PWM_POLARITY_INVERTED) { + data->extend_cfg.start_source = + (gpt_source_t)(GPT_SOURCE_GTIOCA_FALLING_WHILE_GTIOCB_LOW | + GPT_SOURCE_GTIOCA_FALLING_WHILE_GTIOCB_HIGH | + GPT_SOURCE_NONE); + data->extend_cfg.capture_a_source = data->extend_cfg.start_source; + + } else { + data->extend_cfg.start_source = + (gpt_source_t)(GPT_SOURCE_GTIOCA_RISING_WHILE_GTIOCB_LOW | + GPT_SOURCE_GTIOCA_RISING_WHILE_GTIOCB_HIGH | + GPT_SOURCE_NONE); + data->extend_cfg.capture_a_source = data->extend_cfg.start_source; + } + } else { + data->capture.is_pulse_capture = true; + + if (flags & PWM_POLARITY_INVERTED) { + data->extend_cfg.start_source = + (gpt_source_t)(GPT_SOURCE_GTIOCA_FALLING_WHILE_GTIOCB_LOW | + GPT_SOURCE_GTIOCA_FALLING_WHILE_GTIOCB_HIGH | + GPT_SOURCE_NONE); + + data->extend_cfg.capture_a_source = + (gpt_source_t)(GPT_SOURCE_GTIOCA_RISING_WHILE_GTIOCB_LOW | + GPT_SOURCE_GTIOCA_RISING_WHILE_GTIOCB_HIGH | + GPT_SOURCE_NONE); + } else { + data->extend_cfg.start_source = + (gpt_source_t)(GPT_SOURCE_GTIOCA_RISING_WHILE_GTIOCB_LOW | + GPT_SOURCE_GTIOCA_RISING_WHILE_GTIOCB_HIGH | + GPT_SOURCE_NONE); + + data->extend_cfg.capture_a_source = + (gpt_source_t)(GPT_SOURCE_GTIOCA_FALLING_WHILE_GTIOCB_LOW | + GPT_SOURCE_GTIOCA_FALLING_WHILE_GTIOCB_HIGH | + GPT_SOURCE_NONE); + } + } + + data->capture.callback = cb; + data->capture.user_data = user_data; + data->capture.continuous = flags & PWM_CAPTURE_MODE_CONTINUOUS; + + if (data->capture.continuous) { + data->extend_cfg.stop_source = data->extend_cfg.capture_a_source; + data->extend_cfg.clear_source = data->extend_cfg.start_source; + } else { + data->extend_cfg.stop_source = (gpt_source_t)(GPT_SOURCE_NONE); + data->extend_cfg.clear_source = (gpt_source_t)(GPT_SOURCE_NONE); + } + + return 0; +} + +static int pwm_ra8_enable_capture(const struct device *dev, uint32_t pin) +{ + struct pwm_ra8_data *data = dev->data; + fsp_err_t err; + + if (pin != GPT_IO_PIN_GTIOCA) { + LOG_ERR("Feature only support for gtioca"); + return -EINVAL; + } + + if (data->capture.is_busy) { + LOG_ERR("Capture already active on this pin"); + return -EBUSY; + } + + if (!data->capture.callback) { + LOG_ERR("PWM capture not configured"); + return -EINVAL; + } + + data->capture.is_busy = true; + + /* Enable capture source */ + err = R_GPT_Enable(&data->fsp_ctrl); + if (err != FSP_SUCCESS) { + return -EIO; + } + + /* Enable interruption */ + enable_irq(data->fsp_cfg.cycle_end_irq, data->fsp_cfg.cycle_end_irq, &data->fsp_ctrl); + enable_irq(data->extend_cfg.capture_a_irq, data->extend_cfg.capture_a_ipl, &data->fsp_ctrl); + + R_ICU->IELSR[data->fsp_cfg.cycle_end_irq] = (elc_event_t)data->overflow_event; + R_ICU->IELSR[data->extend_cfg.capture_a_irq] = (elc_event_t)data->capture_a_event; + + return 0; +} + +static int pwm_ra8_disable_capture(const struct device *dev, uint32_t pin) +{ + struct pwm_ra8_data *data = dev->data; + fsp_err_t err; + + if (pin != GPT_IO_PIN_GTIOCA) { + LOG_ERR("Feature only support for gtioca"); + return -EINVAL; + } + data->capture.is_busy = false; + + /* Disable interruption */ + disable_irq(data->fsp_cfg.cycle_end_irq); + disable_irq(data->extend_cfg.capture_a_irq); + + R_ICU->IELSR[data->fsp_cfg.cycle_end_irq] = (elc_event_t)ELC_EVENT_NONE; + R_ICU->IELSR[data->extend_cfg.capture_a_irq] = (elc_event_t)ELC_EVENT_NONE; + + /* Disable capture source */ + err = R_GPT_Disable(&data->fsp_ctrl); + if (err != FSP_SUCCESS) { + return -EIO; + } + + /* Stop timer */ + err = R_GPT_Stop(&data->fsp_ctrl); + if (err != FSP_SUCCESS) { + return -EIO; + } + + /* Clear timer */ + err = R_GPT_Reset(&data->fsp_ctrl); + if (err != FSP_SUCCESS) { + return -EIO; + } + + return 0; +} + +static void fsp_callback(timer_callback_args_t *p_args) +{ + const struct device *dev = p_args->p_context; + struct pwm_ra8_data *data = dev->data; + timer_info_t info; + + (void)R_GPT_InfoGet(&data->fsp_ctrl, &info); + + uint64_t period = info.period_counts; + + /* The maximum period is one more than the maximum 16,32-bit number, but will be reflected + * as 0 + */ + if (period == 0U) { + if (data->fsp_ctrl.variant == TIMER_VARIANT_16_BIT) { + period = UINT16_MAX + 1U; + } else { + period = UINT32_MAX + 1U; + } + } + + /* Capture event */ + if (p_args->event == TIMER_EVENT_CAPTURE_A) { + if (p_args->capture != 0U) { + if (data->capture.is_pulse_capture == true) { + data->capture.pulse = + (data->capture.overflows * period) + p_args->capture; + data->capture.callback(dev, GPT_IO_PIN_GTIOCA, 0, + data->capture.pulse, 0, + data->capture.user_data); + } else { + data->capture.period = + (data->capture.overflows * period) + p_args->capture; + data->capture.callback(dev, GPT_IO_PIN_GTIOCA, data->capture.period, + 0, 0, data->capture.user_data); + } + data->capture.overflows = 0U; + /* Disable capture in single mode */ + if (data->capture.continuous == false) { + pwm_ra8_disable_capture(dev, GPT_IO_PIN_GTIOCA); + } + } + } else if (p_args->event == TIMER_EVENT_CYCLE_END) { + data->capture.overflows++; + } else { + data->capture.callback(dev, GPT_IO_PIN_GTIOCA, 0, 0, -ECANCELED, + data->capture.user_data); + } +} + +#endif /* CONFIG_PWM_CAPTURE */ + +static const struct pwm_driver_api pwm_ra8_driver_api = { + .get_cycles_per_sec = pwm_ra8_get_cycles_per_sec, + .set_cycles = pwm_ra8_set_cycles, +#ifdef CONFIG_PWM_CAPTURE + .configure_capture = pwm_ra8_configure_capture, + .enable_capture = pwm_ra8_enable_capture, + .disable_capture = pwm_ra8_disable_capture, +#endif /* CONFIG_PWM_CAPTURE */ +}; + +static int pwm_ra8_init(const struct device *dev) +{ + struct pwm_ra8_data *data = dev->data; + const struct pwm_ra8_config *cfg = dev->config; + int err; + + if (!device_is_ready(cfg->clock_dev)) { + LOG_ERR("clock control device not ready"); + return -ENODEV; + } + + err = clock_control_on(cfg->clock_dev, (clock_control_subsys_t)&cfg->clock_subsys); + if (err < 0) { + LOG_ERR("Could not initialize clock (%d)", err); + return err; + } + + err = pinctrl_apply_state(cfg->pincfg, PINCTRL_STATE_DEFAULT); + if (err) { + LOG_ERR("Failed to configure pins for PWM (%d)", err); + return err; + } + +#if defined(CONFIG_PWM_CAPTURE) + data->fsp_cfg.p_callback = fsp_callback; + data->fsp_cfg.p_context = dev; +#endif /* defined(CONFIG_PWM_CAPTURE) */ + + data->fsp_cfg.p_extend = &data->extend_cfg; + + err = R_GPT_Open(&data->fsp_ctrl, &data->fsp_cfg); + if (err != FSP_SUCCESS) { + return -EIO; + } + + return 0; +} + +#define _ELC_EVENT_GPT_CAPTURE_COMPARE_A(channel) ELC_EVENT_GPT##channel##_CAPTURE_COMPARE_A +#define _ELC_EVENT_GPT_COUNTER_OVERFLOW(channel) ELC_EVENT_GPT##channel##_COUNTER_OVERFLOW + +#define ELC_EVENT_GPT_CAPTURE_COMPARE_A(channel) _ELC_EVENT_GPT_CAPTURE_COMPARE_A(channel) +#define ELC_EVENT_GPT_COUNTER_OVERFLOW(channel) _ELC_EVENT_GPT_COUNTER_OVERFLOW(channel) + +#ifdef CONFIG_PWM_CAPTURE +#define PWM_RA_IRQ_CONFIG_INIT(index) \ + do { \ + \ + IRQ_CONNECT(DT_INST_IRQ_BY_NAME(index, gtioca, irq), \ + DT_INST_IRQ_BY_NAME(index, gtioca, priority), \ + gpt_capture_compare_a_isr, NULL, 0); \ + IRQ_CONNECT(DT_INST_IRQ_BY_NAME(index, overflow, irq), \ + DT_INST_IRQ_BY_NAME(index, overflow, priority), \ + gpt_counter_overflow_isr, NULL, 0); \ + } while (0) + +#else +#define PWM_RA_IRQ_CONFIG_INIT(index) +#endif /* CONFIG_PWM_CAPTURE */ + +#define PWM_RA8_INIT(index) \ + PINCTRL_DT_INST_DEFINE(index); \ + static const gpt_extended_cfg_t g_timer1_extend_##index = { \ + .gtioca = \ + { \ + .output_enabled = false, \ + .stop_level = GPT_PIN_LEVEL_LOW, \ + }, \ + .gtiocb = \ + { \ + .output_enabled = false, \ + .stop_level = GPT_PIN_LEVEL_LOW, \ + }, \ + .start_source = (gpt_source_t)(GPT_SOURCE_NONE), \ + .stop_source = (gpt_source_t)(GPT_SOURCE_NONE), \ + .clear_source = (gpt_source_t)(GPT_SOURCE_NONE), \ + .count_up_source = (gpt_source_t)(GPT_SOURCE_NONE), \ + .count_down_source = (gpt_source_t)(GPT_SOURCE_NONE), \ + .capture_a_source = (gpt_source_t)(GPT_SOURCE_NONE), \ + .capture_b_source = (gpt_source_t)(GPT_SOURCE_NONE), \ + .capture_a_ipl = DT_INST_IRQ_BY_NAME(index, gtioca, priority), \ + .capture_b_ipl = BSP_IRQ_DISABLED, \ + .capture_a_irq = DT_INST_IRQ_BY_NAME(index, gtioca, irq), \ + .capture_b_irq = FSP_INVALID_VECTOR, \ + .capture_filter_gtioca = GPT_CAPTURE_FILTER_NONE, \ + .capture_filter_gtiocb = GPT_CAPTURE_FILTER_NONE, \ + .p_pwm_cfg = NULL, \ + .gtior_setting.gtior = (0x0U), \ + }; \ + static struct pwm_ra8_data pwm_ra8_data_##index = { \ + .fsp_cfg = \ + { \ + .mode = TIMER_MODE_PWM, \ + .source_div = DT_INST_PROP(index, divider), \ + .channel = DT_INST_PROP(index, channel), \ + .cycle_end_ipl = DT_INST_IRQ_BY_NAME(index, overflow, priority), \ + .cycle_end_irq = DT_INST_IRQ_BY_NAME(index, overflow, irq), \ + }, \ + .extend_cfg = g_timer1_extend_##index, \ + .capture_a_event = ELC_EVENT_GPT_CAPTURE_COMPARE_A(DT_INST_PROP(index, channel)), \ + .overflow_event = ELC_EVENT_GPT_COUNTER_OVERFLOW(DT_INST_PROP(index, channel)), \ + }; \ + static const struct pwm_ra8_config pwm_ra8_config_##index = { \ + .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(index), \ + .clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(index)), \ + .clock_subsys = { \ + .mstp = (uint32_t)DT_INST_CLOCKS_CELL_BY_IDX(index, 0, mstp), \ + .stop_bit = DT_INST_CLOCKS_CELL_BY_IDX(index, 0, stop_bit), \ + }}; \ + static int pwm_ra8_init_##index(const struct device *dev) \ + { \ + PWM_RA_IRQ_CONFIG_INIT(index); \ + int err = pwm_ra8_init(dev); \ + if (err != 0) { \ + return err; \ + } \ + return 0; \ + } \ + DEVICE_DT_INST_DEFINE(index, pwm_ra8_init_##index, NULL, &pwm_ra8_data_##index, \ + &pwm_ra8_config_##index, POST_KERNEL, CONFIG_PWM_INIT_PRIORITY, \ + &pwm_ra8_driver_api); + +DT_INST_FOREACH_STATUS_OKAY(PWM_RA8_INIT); diff --git a/dts/arm/renesas/ra/ra8/ra8x1.dtsi b/dts/arm/renesas/ra/ra8/ra8x1.dtsi index e4ac0300c59f9..20c88bb4e571d 100644 --- a/dts/arm/renesas/ra/ra8/ra8x1.dtsi +++ b/dts/arm/renesas/ra/ra8/ra8x1.dtsi @@ -9,6 +9,7 @@ #include #include #include +#include / { cpus { @@ -332,6 +333,146 @@ status = "disabled"; }; + pwm0: pwm0@40322000 { + compatible = "renesas,ra8-pwm"; + divider = ; + channel = ; + clocks = <&pclkd MSTPE 31>; + reg = <0x40322000 0x100>; + #pwm-cells = <3>; + status = "disabled"; + }; + + pwm1: pwm1@40322100 { + compatible = "renesas,ra8-pwm"; + divider = ; + channel = ; + clocks = <&pclkd MSTPE 30>; + reg = <0x40322100 0x100>; + #pwm-cells = <3>; + status = "disabled"; + }; + + pwm2: pwm2@40322200 { + compatible = "renesas,ra8-pwm"; + divider = ; + channel = ; + clocks = <&pclkd MSTPE 29>; + reg = <0x40322200 0x100>; + #pwm-cells = <3>; + status = "disabled"; + }; + + pwm3: pwm3@40322300 { + compatible = "renesas,ra8-pwm"; + divider = ; + channel = ; + clocks = <&pclkd MSTPE 28>; + reg = <0x40322300 0x100>; + #pwm-cells = <3>; + status = "disabled"; + }; + + pwm4: pwm4@40322400 { + compatible = "renesas,ra8-pwm"; + divider = ; + channel = ; + clocks = <&pclkd MSTPE 27>; + reg = <0x40322400 0x100>; + #pwm-cells = <3>; + status = "disabled"; + }; + + pwm5: pwm5@40322500 { + compatible = "renesas,ra8-pwm"; + divider = ; + channel = ; + clocks = <&pclkd MSTPE 26>; + reg = <0x40322500 0x100>; + #pwm-cells = <3>; + status = "disabled"; + }; + + pwm6: pwm6@40322600 { + compatible = "renesas,ra8-pwm"; + divider = ; + channel = ; + clocks = <&pclkd MSTPE 25>; + reg = <0x40322600 0x100>; + #pwm-cells = <3>; + status = "disabled"; + }; + + pwm7: pwm7@40322700 { + compatible = "renesas,ra8-pwm"; + divider = ; + channel = ; + clocks = <&pclkd MSTPE 24>; + reg = <0x40322700 0x100>; + #pwm-cells = <3>; + status = "disabled"; + }; + + pwm8: pwm8@40322800 { + compatible = "renesas,ra8-pwm"; + divider = ; + channel = ; + clocks = <&pclkd MSTPE 23>; + reg = <0x40322800 0x100>; + #pwm-cells = <3>; + status = "disabled"; + }; + + pwm9: pwm9@40322900 { + compatible = "renesas,ra8-pwm"; + divider = ; + channel = ; + clocks = <&pclkd MSTPE 22>; + reg = <0x40322900 0x100>; + #pwm-cells = <3>; + status = "disabled"; + }; + + pwm10: pwm10@40322a00 { + compatible = "renesas,ra8-pwm"; + divider = ; + channel = ; + clocks = <&pclkd MSTPE 21>; + reg = <0x40322a00 0x100>; + #pwm-cells = <3>; + status = "disabled"; + }; + + pwm11: pwm11@40322b00 { + compatible = "renesas,ra8-pwm"; + divider = ; + channel = ; + clocks = <&pclkd MSTPE 20>; + reg = <0x40322b00 0x100>; + #pwm-cells = <3>; + status = "disabled"; + }; + + pwm12: pwm12@40322c00 { + compatible = "renesas,ra8-pwm"; + divider = ; + channel = ; + clocks = <&pclkd MSTPE 19>; + reg = <0x40322c00 0x100>; + #pwm-cells = <3>; + status = "disabled"; + }; + + pwm13: pwm13@40322d00 { + compatible = "renesas,ra8-pwm"; + divider = ; + channel = ; + clocks = <&pclkd MSTPE 18>; + reg = <0x40322d00 0x100>; + #pwm-cells = <3>; + status = "disabled"; + }; + option_setting_ofs: option_setting_ofs@300a100 { compatible = "zephyr,memory-region"; reg = <0x0300a100 0x18>; diff --git a/dts/bindings/pwm/renesas,ra8-pwm.yaml b/dts/bindings/pwm/renesas,ra8-pwm.yaml new file mode 100644 index 0000000000000..36790afa8ada5 --- /dev/null +++ b/dts/bindings/pwm/renesas,ra8-pwm.yaml @@ -0,0 +1,34 @@ +# Copyright (c) 2024 Renesas Electronics Corporation +# SPDX-License-Identifier: Apache-2.0 + +description: Renesas RA8 Pulse Width Modulation + +compatible: "renesas,ra8-pwm" + +include: [pwm-controller.yaml, base.yaml, pinctrl-device.yaml] + +properties: + divider: + type: int + required: true + + channel: + type: int + required: true + + clocks: + required: true + + interrupts: + required: true + + interrupt-names: + required: true + + "#pwm-cells": + const: 3 + +pwm-cells: + - channel + - period + - flags diff --git a/include/zephyr/dt-bindings/pwm/ra_pwm.h b/include/zephyr/dt-bindings/pwm/ra_pwm.h new file mode 100644 index 0000000000000..e2f8a45e65c67 --- /dev/null +++ b/include/zephyr/dt-bindings/pwm/ra_pwm.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Renesas Electronics Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_PWM_RA_PWM_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_PWM_RA_PWM_H_ + +/* PWM SOURCE DIVIDER */ +#define RA_PWM_SOURCE_DIV_1 0 +#define RA_PWM_SOURCE_DIV_2 1 +#define RA_PWM_SOURCE_DIV_4 2 +#define RA_PWM_SOURCE_DIV_8 3 +#define RA_PWM_SOURCE_DIV_16 4 +#define RA_PWM_SOURCE_DIV_32 5 +#define RA_PWM_SOURCE_DIV_64 6 +#define RA_PWM_SOURCE_DIV_128 7 +#define RA_PWM_SOURCE_DIV_256 8 +#define RA_PWM_SOURCE_DIV_512 9 +#define RA_PWM_SOURCE_DIV_1024 10 + +/* PWM SOURCE DIVIDER */ +#define RA_PWM_CHANNEL_0 0 +#define RA_PWM_CHANNEL_1 1 +#define RA_PWM_CHANNEL_2 2 +#define RA_PWM_CHANNEL_3 3 +#define RA_PWM_CHANNEL_4 4 +#define RA_PWM_CHANNEL_5 5 +#define RA_PWM_CHANNEL_6 6 +#define RA_PWM_CHANNEL_7 7 +#define RA_PWM_CHANNEL_8 8 +#define RA_PWM_CHANNEL_9 9 +#define RA_PWM_CHANNEL_10 10 +#define RA_PWM_CHANNEL_11 11 +#define RA_PWM_CHANNEL_12 12 +#define RA_PWM_CHANNEL_13 13 + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_PWM_RA_PWM_H_ */ diff --git a/modules/Kconfig.renesas_fsp b/modules/Kconfig.renesas_fsp index aba5604d51b43..c56dcc2d60e06 100644 --- a/modules/Kconfig.renesas_fsp +++ b/modules/Kconfig.renesas_fsp @@ -61,4 +61,9 @@ config USE_RA_FSP_FLASH_HP help Enable RA FSP FLASH HP driver +config USE_RA_FSP_GPT + bool + help + Enable RA FSP GPT driver + endif # HAS_RENESAS_RA_FSP diff --git a/tests/drivers/pwm/pwm_api/src/test_pwm.c b/tests/drivers/pwm/pwm_api/src/test_pwm.c index 69a4dcaeacc42..839faec9b910f 100644 --- a/tests/drivers/pwm/pwm_api/src/test_pwm.c +++ b/tests/drivers/pwm/pwm_api/src/test_pwm.c @@ -53,6 +53,9 @@ #elif DT_HAS_COMPAT_STATUS_OKAY(intel_blinky_pwm) #define PWM_DEV_NODE DT_INST(0, intel_blinky_pwm) +#elif DT_HAS_COMPAT_STATUS_OKAY(renesas_ra8_pwm) +#define PWM_DEV_NODE DT_INST(0, renesas_ra8_pwm) + #else #error "Define a PWM device" #endif diff --git a/tests/drivers/pwm/pwm_loopback/boards/ek_ra8m1.overlay b/tests/drivers/pwm/pwm_loopback/boards/ek_ra8m1.overlay new file mode 100644 index 0000000000000..5cd72c8476dec --- /dev/null +++ b/tests/drivers/pwm/pwm_loopback/boards/ek_ra8m1.overlay @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +/ { + pwm_loopback_0 { + compatible = "test-pwm-loopback"; + /* first index must be a 32-Bit timer */ + pwms = <&pwm7 0 0 PWM_POLARITY_NORMAL>, + <&pwm9 0 0 PWM_POLARITY_NORMAL>; + }; +}; + +&pinctrl { + pwm9_default: pwm9_default { + group1 { + /* GTIOC9A */ + psels = ; + }; + group2 { + /* GTIOC9B */ + psels = ; + }; + }; +}; + +&pwm9 { + pinctrl-0 = <&pwm9_default>; + pinctrl-names = "default"; + interrupts = <50 1>, <51 1>; + interrupt-names = "gtioca", "overflow"; + status = "okay"; +}; From 1391355ac4d416e09131ca1b7c4afe543fceaba7 Mon Sep 17 00:00:00 2001 From: Quy Tran Date: Fri, 6 Sep 2024 04:23:30 +0000 Subject: [PATCH 0644/4482] boards: renesas: Add configurations to support pwm on MCK-RA8T1 Add support for PWM driver on MCK-RA8T1 Signed-off-by: Quy Tran --- boards/renesas/mck_ra8t1/doc/index.rst | 2 + .../renesas/mck_ra8t1/mck_ra8t1-pinctrl.dtsi | 11 ++++++ boards/renesas/mck_ra8t1/mck_ra8t1.dts | 8 ++++ .../pwm/pwm_loopback/boards/mck_ra8t1.overlay | 37 +++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 tests/drivers/pwm/pwm_loopback/boards/mck_ra8t1.overlay diff --git a/boards/renesas/mck_ra8t1/doc/index.rst b/boards/renesas/mck_ra8t1/doc/index.rst index f223004c969be..a32692eb7b18f 100644 --- a/boards/renesas/mck_ra8t1/doc/index.rst +++ b/boards/renesas/mck_ra8t1/doc/index.rst @@ -102,6 +102,8 @@ The below features are currently supported on Zephyr OS for MCB-RA8T1 board: +--------------+------------+----------------------+ | FLASH | on-chip | flash | +--------------+------------+----------------------+ +| PWM | on-chip | pwm | ++--------------+------------+----------------------+ Other hardware features are currently not supported by the port. diff --git a/boards/renesas/mck_ra8t1/mck_ra8t1-pinctrl.dtsi b/boards/renesas/mck_ra8t1/mck_ra8t1-pinctrl.dtsi index c8183975f37a6..7a044d434e956 100644 --- a/boards/renesas/mck_ra8t1/mck_ra8t1-pinctrl.dtsi +++ b/boards/renesas/mck_ra8t1/mck_ra8t1-pinctrl.dtsi @@ -25,4 +25,15 @@ ; }; }; + + pwm2_default: pwm2_default { + group1 { + /* GTIOC2A */ + psels = ; + }; + group2 { + /* GTIOC2B */ + psels = ; + }; + }; }; diff --git a/boards/renesas/mck_ra8t1/mck_ra8t1.dts b/boards/renesas/mck_ra8t1/mck_ra8t1.dts index 6cd4cf53eb82e..440e4d78241f0 100644 --- a/boards/renesas/mck_ra8t1/mck_ra8t1.dts +++ b/boards/renesas/mck_ra8t1/mck_ra8t1.dts @@ -118,3 +118,11 @@ }; }; }; + +&pwm2 { + pinctrl-0 = <&pwm2_default>; + interrupts = <40 1>, <41 1>; + interrupt-names = "gtioca", "overflow"; + pinctrl-names = "default"; + status = "okay"; +}; diff --git a/tests/drivers/pwm/pwm_loopback/boards/mck_ra8t1.overlay b/tests/drivers/pwm/pwm_loopback/boards/mck_ra8t1.overlay new file mode 100644 index 0000000000000..875e0f7736a8f --- /dev/null +++ b/tests/drivers/pwm/pwm_loopback/boards/mck_ra8t1.overlay @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +/ { + pwm_loopback_0 { + compatible = "test-pwm-loopback"; + /* first index must be a 32-Bit timer */ + pwms = <&pwm2 0 0 PWM_POLARITY_NORMAL>, + <&pwm5 0 0 PWM_POLARITY_NORMAL>; + }; +}; + +&pinctrl { + pwm5_default: pwm5_default { + group1 { + /* GTIOC5A */ + psels = ; + }; + group2 { + /* GTIOC5B */ + psels = ; + }; + }; +}; + +&pwm5 { + pinctrl-0 = <&pwm5_default>; + pinctrl-names = "default"; + interrupts = <50 1>, <51 1>; + interrupt-names = "gtioca", "overflow"; + status = "okay"; +}; From 4793e00ae803ae6b7948e4c110f7ceef11821ef5 Mon Sep 17 00:00:00 2001 From: Quy Tran Date: Fri, 6 Sep 2024 04:47:16 +0000 Subject: [PATCH 0645/4482] boards: renesas: Add configurations to support pwm on EK-RA8D1 Add support for PWM driver on EK-RA8D1 Signed-off-by: Quy Tran --- boards/renesas/ek_ra8d1/doc/index.rst | 2 + boards/renesas/ek_ra8d1/ek_ra8d1-pinctrl.dtsi | 11 ++++++ boards/renesas/ek_ra8d1/ek_ra8d1.dts | 8 ++++ .../pwm/pwm_loopback/boards/ek_ra8d1.overlay | 37 +++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 tests/drivers/pwm/pwm_loopback/boards/ek_ra8d1.overlay diff --git a/boards/renesas/ek_ra8d1/doc/index.rst b/boards/renesas/ek_ra8d1/doc/index.rst index 79a5dde2d9058..6b8f83272349f 100644 --- a/boards/renesas/ek_ra8d1/doc/index.rst +++ b/boards/renesas/ek_ra8d1/doc/index.rst @@ -104,6 +104,8 @@ The below features are currently supported on Zephyr OS for EK-RA8D1 board: +--------------+------------+------------------+ | FLASH | on-chip | flash | +--------------+------------+------------------+ +| PWM | on-chip | pwm | ++--------------+------------+------------------+ Other hardware features are currently not supported by the port. diff --git a/boards/renesas/ek_ra8d1/ek_ra8d1-pinctrl.dtsi b/boards/renesas/ek_ra8d1/ek_ra8d1-pinctrl.dtsi index 57a0e064fbadb..7dd8b9676f9a2 100644 --- a/boards/renesas/ek_ra8d1/ek_ra8d1-pinctrl.dtsi +++ b/boards/renesas/ek_ra8d1/ek_ra8d1-pinctrl.dtsi @@ -25,4 +25,15 @@ ; }; }; + + pwm7_default: pwm7_default { + group1 { + /* GTIOC7A */ + psels = ; + }; + group2 { + /* GTIOC7B */ + psels = ; + }; + }; }; diff --git a/boards/renesas/ek_ra8d1/ek_ra8d1.dts b/boards/renesas/ek_ra8d1/ek_ra8d1.dts index 4449e566c2dc2..1acd074322090 100644 --- a/boards/renesas/ek_ra8d1/ek_ra8d1.dts +++ b/boards/renesas/ek_ra8d1/ek_ra8d1.dts @@ -124,3 +124,11 @@ }; }; }; + +&pwm7 { + pinctrl-0 = <&pwm7_default>; + interrupts = <40 1>, <41 1>; + interrupt-names = "gtioca", "overflow"; + pinctrl-names = "default"; + status = "okay"; +}; diff --git a/tests/drivers/pwm/pwm_loopback/boards/ek_ra8d1.overlay b/tests/drivers/pwm/pwm_loopback/boards/ek_ra8d1.overlay new file mode 100644 index 0000000000000..6f4d6ea9660b3 --- /dev/null +++ b/tests/drivers/pwm/pwm_loopback/boards/ek_ra8d1.overlay @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +/ { + pwm_loopback_0 { + compatible = "test-pwm-loopback"; + /* first index must be a 32-Bit timer */ + pwms = <&pwm7 0 0 PWM_POLARITY_NORMAL>, + <&pwm9 0 0 PWM_POLARITY_NORMAL>; + }; +}; + +&pinctrl { + pwm9_default: pwm9_default { + group1 { + /* GTIOC9A */ + psels = ; + }; + group2 { + /* GTIOC9B */ + psels = ; + }; + }; +}; + +&pwm9 { + pinctrl-0 = <&pwm9_default>; + pinctrl-names = "default"; + interrupts = <50 1>, <51 1>; + interrupt-names = "gtioca", "overflow"; + status = "okay"; +}; From b0f6f1d33adaf1e60afdf912b8b51f93421fdfa3 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Fri, 11 Oct 2024 15:34:39 +0200 Subject: [PATCH 0646/4482] Revert "lib: fix ubsan errors in cbvprintf_package" This reverts commit 6f95a5055399e1030732a76e35492cda378cd161. Signed-off-by: Carles Cufi --- lib/os/cbprintf_packaged.c | 105 ++++++++++++++++++------------------- 1 file changed, 52 insertions(+), 53 deletions(-) diff --git a/lib/os/cbprintf_packaged.c b/lib/os/cbprintf_packaged.c index 0e6a7d14a337b..9a3b456edade3 100644 --- a/lib/os/cbprintf_packaged.c +++ b/lib/os/cbprintf_packaged.c @@ -242,10 +242,10 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, #define STR_POS_MASK BIT_MASK(7) /* Buffer offset abstraction for better code clarity. */ -#define BUF_OFFSET offset +#define BUF_OFFSET ((uintptr_t)buf - (uintptr_t)buf0) - uint8_t *buf = packaged; /* buffer start (may be NULL) */ - size_t offset = 0; /* current buffer position */ + uint8_t *buf0 = packaged; /* buffer start (may be NULL) */ + uint8_t *buf = buf0; /* current buffer position */ unsigned int size; /* current argument's size */ unsigned int align; /* current argument's required alignment */ uint8_t str_ptr_pos[16]; /* string pointer positions */ @@ -294,16 +294,16 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, * * Refer to union cbprintf_package_hdr for more details. */ - offset += sizeof(*pkg_hdr); + buf += sizeof(*pkg_hdr); /* - * When buf is NULL we don't store anything. + * When buf0 is NULL we don't store anything. * Instead we count the needed space to store the data. * In this case, incoming len argument indicates the anticipated * buffer "misalignment" offset. */ - if (buf == NULL) { - offset += len % CBPRINTF_PACKAGE_ALIGNMENT; + if (buf0 == NULL) { + buf += len % CBPRINTF_PACKAGE_ALIGNMENT; /* * The space to store the data is represented by both the * buffer offset as well as the extra string data to be @@ -324,7 +324,7 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, * Otherwise we must ensure we can store at least * the pointer to the format string itself. */ - if ((buf != NULL) && (BUF_OFFSET + sizeof(char *)) > len) { + if ((buf0 != NULL) && (BUF_OFFSET + sizeof(char *)) > len) { return -ENOSPC; } @@ -355,18 +355,18 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, size = sizeof(int); /* align destination buffer location */ - offset = ROUND_UP(offset, align); + buf = (void *)ROUND_UP(buf, align); /* make sure the data fits */ - if (buf != NULL && BUF_OFFSET + size > len) { + if (buf0 != NULL && BUF_OFFSET + size > len) { return -ENOSPC; } - if (buf != NULL) { - *(int *)(buf + offset) = arg_tag; + if (buf0 != NULL) { + *(int *)buf = arg_tag; } - offset += sizeof(int); + buf += sizeof(int); if (arg_tag == CBPRINTF_PACKAGE_ARG_TYPE_END) { /* End of arguments */ @@ -430,21 +430,21 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, } /* align destination buffer location */ - offset = ROUND_UP(offset, align); - if (buf != NULL) { + buf = (void *) ROUND_UP(buf, align); + if (buf0 != NULL) { /* make sure it fits */ if ((BUF_OFFSET + size) > len) { return -ENOSPC; } if (Z_CBPRINTF_VA_STACK_LL_DBL_MEMCPY) { - memcpy((buf + offset), (uint8_t *)&v, size); + memcpy(buf, (uint8_t *)&v, size); } else if (fmt[-1] == 'L') { - *(long double *)(buf + offset) = v.ld; + *(long double *)buf = v.ld; } else { - *(double *)(buf + offset) = v.d; + *(double *)buf = v.d; } } - offset += size; + buf += size; parsing = false; continue; } @@ -577,21 +577,21 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, size = sizeof(double); } /* align destination buffer location */ - offset = ROUND_UP(offset, align); - if (buf != NULL) { + buf = (void *) ROUND_UP(buf, align); + if (buf0 != NULL) { /* make sure it fits */ if (BUF_OFFSET + size > len) { return -ENOSPC; } if (Z_CBPRINTF_VA_STACK_LL_DBL_MEMCPY) { - memcpy(buf + offset, (uint8_t *)&v, size); + memcpy(buf, (uint8_t *)&v, size); } else if (fmt[-1] == 'L') { - *(long double *)(buf + offset) = v.ld; + *(long double *)buf = v.ld; } else { - *(double *)(buf + offset) = v.d; + *(double *)buf = v.d; } } - offset += size; + buf += size; parsing = false; continue; } @@ -603,10 +603,10 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, } /* align destination buffer location */ - offset = ROUND_UP(offset, align); + buf = (void *) ROUND_UP(buf, align); /* make sure the data fits */ - if ((buf != NULL) && (BUF_OFFSET + size) > len) { + if ((buf0 != NULL) && (BUF_OFFSET + size) > len) { return -ENOSPC; } @@ -614,8 +614,8 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, if (is_str_arg) { s = va_arg(ap, char *); process_string: - if (buf != NULL) { - *(const char **)(buf + offset) = s; + if (buf0 != NULL) { + *(const char **)buf = s; } bool is_ro = (fros_cnt-- > 0) ? true : ptr_in_rodata(s); @@ -642,7 +642,7 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, return -EINVAL; } - if (buf != NULL) { + if (buf0 != NULL) { /* * Remember string pointer location. * We will append non-ro strings later. @@ -678,34 +678,34 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, s_idx++; } - offset += sizeof(char *); + buf += sizeof(char *); is_str_arg = false; } else if (size == sizeof(int)) { int v = va_arg(ap, int); - if (buf != NULL) { - *(int *)(buf + offset) = v; + if (buf0 != NULL) { + *(int *)buf = v; } - offset += sizeof(int); + buf += sizeof(int); } else if (size == sizeof(long)) { long v = va_arg(ap, long); - if (buf != NULL) { - *(long *)(buf + offset) = v; + if (buf0 != NULL) { + *(long *)buf = v; } - offset += sizeof(long); + buf += sizeof(long); } else if (size == sizeof(long long)) { long long v = va_arg(ap, long long); - if (buf != NULL) { + if (buf0 != NULL) { if (Z_CBPRINTF_VA_STACK_LL_DBL_MEMCPY) { - memcpy(buf + offset, (uint8_t *)&v, sizeof(long long)); + memcpy(buf, (uint8_t *)&v, sizeof(long long)); } else { - *(long long *)(buf + offset) = v; + *(long long *)buf = v; } } - offset += sizeof(long long); + buf += sizeof(long long); } else { __ASSERT(false, "unexpected size %u", size); return -EINVAL; @@ -727,12 +727,12 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, * If all we wanted was to count required buffer size * then we have it now. */ - if (buf == NULL) { + if (buf0 == NULL) { return BUF_OFFSET + len - CBPRINTF_PACKAGE_ALIGNMENT; } /* Clear our buffer header. We made room for it initially. */ - *(char **)buf = NULL; + *(char **)buf0 = NULL; /* Record end of argument list. */ pkg_hdr->desc.len = BUF_OFFSET / sizeof(int); @@ -767,8 +767,8 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, return -ENOSPC; } /* store the pointer position prefix */ - *(buf + offset) = pos; - ++offset; + *buf = pos; + ++buf; } } @@ -781,13 +781,12 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, if (rws_pos_en) { size = 0; - *(buf + offset) = str_ptr_arg[i]; - offset++; + *buf++ = str_ptr_arg[i]; } else { /* retrieve the string pointer */ - s = *(char **)(buf + str_ptr_pos[i] * sizeof(int)); + s = *(char **)(buf0 + str_ptr_pos[i] * sizeof(int)); /* clear the in-buffer pointer (less entropy if compressed) */ - *(char **)(buf + str_ptr_pos[i] * sizeof(int)) = NULL; + *(char **)(buf0 + str_ptr_pos[i] * sizeof(int)) = NULL; /* find the string length including terminating '\0' */ size = strlen(s) + 1; } @@ -797,11 +796,11 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, return -ENOSPC; } /* store the pointer position prefix */ - *(buf + offset) = str_ptr_pos[i]; - ++offset; + *buf = str_ptr_pos[i]; + ++buf; /* copy the string with its terminating '\0' */ - memcpy(buf + offset, (uint8_t *)s, size); - offset += size; + memcpy(buf, (uint8_t *)s, size); + buf += size; } /* From a5ecd339d71e8ba80eee142c65cc17878cd06b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 11 Oct 2024 09:51:20 +0200 Subject: [PATCH 0647/4482] doc: boards: extensions: update code comment for consistency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Very minor fix for having consistent style in the coment Signed-off-by: Benjamin Cabé --- doc/_extensions/zephyr/domain/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/_extensions/zephyr/domain/__init__.py b/doc/_extensions/zephyr/domain/__init__.py index f9a0038a36893..52c7ed3d0e2b4 100644 --- a/doc/_extensions/zephyr/domain/__init__.py +++ b/doc/_extensions/zephyr/domain/__init__.py @@ -14,7 +14,7 @@ - ``zephyr:code-sample::`` - Defines a code sample. - ``zephyr:code-sample-category::`` - Defines a category for grouping code samples. - ``zephyr:code-sample-listing::`` - Shows a listing of code samples found in a given category. -- ``zephyr:board-catalog::`` - Show a listing of boards supported by Zephyr. +- ``zephyr:board-catalog::`` - Shows a listing of boards supported by Zephyr. Roles ----- From a1261773db88634ae586279e6fbc84a6e4eec2a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 11 Oct 2024 09:52:01 +0200 Subject: [PATCH 0648/4482] doc: boards: extensions: fix CSS rule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix a regression introduced at the last minute when cleaning up the stylesheet. The rule as it was made no sense. Signed-off-by: Benjamin Cabé --- doc/_extensions/zephyr/domain/static/css/board-catalog.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/_extensions/zephyr/domain/static/css/board-catalog.css b/doc/_extensions/zephyr/domain/static/css/board-catalog.css index 96a2b86728d32..f92c5c6faa6f3 100644 --- a/doc/_extensions/zephyr/domain/static/css/board-catalog.css +++ b/doc/_extensions/zephyr/domain/static/css/board-catalog.css @@ -28,7 +28,7 @@ box-shadow: none; } -.filter-form input:focus .filter-form select:focus { +.filter-form input:focus, .filter-form select:focus { border-color: var(--input-focus-border-color); } .select-container { From 3af51ddce1ac861fff6afc5660e87a9a2718cb7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 11 Oct 2024 09:52:55 +0200 Subject: [PATCH 0649/4482] doc: boards: extensions: fix vendor selection from URL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apply selection from the hash URL *after* having sorted the vendors alphabetically. Remove the initial call to updateBoardCount() as it is useless to have one this early. Signed-off-by: Benjamin Cabé --- doc/_extensions/zephyr/domain/static/js/board-catalog.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/_extensions/zephyr/domain/static/js/board-catalog.js b/doc/_extensions/zephyr/domain/static/js/board-catalog.js index 82103c6bb3458..614ddfa1e4087 100644 --- a/doc/_extensions/zephyr/domain/static/js/board-catalog.js +++ b/doc/_extensions/zephyr/domain/static/js/board-catalog.js @@ -39,9 +39,6 @@ function updateURL() { } document.addEventListener("DOMContentLoaded", function () { - updateBoardCount(); - populateFormFromURL(); - const form = document.querySelector(".filter-form"); // sort vendors alphabetically @@ -55,6 +52,8 @@ document.addEventListener("DOMContentLoaded", function () { vendorSelect.appendChild(option); }); + populateFormFromURL(); + form.addEventListener("submit", function (event) { event.preventDefault(); }); From 164447a3c68e902d7158f192f7014bb57f68b250 Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Thu, 10 Oct 2024 19:42:10 +0000 Subject: [PATCH 0650/4482] boards: st: stm32h745i_disco: m7: remove CAN sample-point properties Remove explicit CAN controller sample-point/sample-point-data values and instead rely on the defaults, as they change with the configured bitrate. Signed-off-by: Henrik Brix Andersen --- .../st/stm32h745i_disco/stm32h745i_disco_stm32h745xx_m7.dts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/boards/st/stm32h745i_disco/stm32h745i_disco_stm32h745xx_m7.dts b/boards/st/stm32h745i_disco/stm32h745i_disco_stm32h745xx_m7.dts index 88faefa7c2000..fbc3a388b9cc9 100644 --- a/boards/st/stm32h745i_disco/stm32h745i_disco_stm32h745xx_m7.dts +++ b/boards/st/stm32h745i_disco/stm32h745i_disco_stm32h745xx_m7.dts @@ -224,8 +224,6 @@ pinctrl-names = "default"; clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000100>, <&rcc STM32_SRC_PLL2_Q FDCAN_SEL(2)>; - sample-point = <875>; - sample-point-data = <875>; can-transceiver { max-bitrate = <5000000>; @@ -238,8 +236,6 @@ pinctrl-names = "default"; clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000100>, <&rcc STM32_SRC_PLL2_Q FDCAN_SEL(2)>; - sample-point = <875>; - sample-point-data = <875>; can-transceiver { max-bitrate = <5000000>; From 5f584052d8521b0f64afc214b7cdc82893216008 Mon Sep 17 00:00:00 2001 From: Wajdi ELMuhtadi Date: Fri, 1 Sep 2023 10:27:34 +0200 Subject: [PATCH 0651/4482] drivers: sensor: wsen_itds: remove wsen_itds driver Remove wsen_itds driver since the hal update is no longer compatible with this version. Signed-off-by: Wajdi ELMuhtadi --- drivers/sensor/wsen/CMakeLists.txt | 1 - drivers/sensor/wsen/Kconfig | 1 - drivers/sensor/wsen/wsen_itds/CMakeLists.txt | 6 - drivers/sensor/wsen/wsen_itds/Kconfig | 22 - drivers/sensor/wsen/wsen_itds/itds.c | 415 ------------------ drivers/sensor/wsen/wsen_itds/itds.h | 125 ------ drivers/sensor/wsen/wsen_itds/itds_trigger.c | 130 ------ dts/bindings/sensor/we,wsen-itds.yaml | 40 -- tests/drivers/build_all/sensor/i2c.dtsi | 8 - .../build_all/sensor/sensors_no_default.conf | 1 - 10 files changed, 749 deletions(-) delete mode 100644 drivers/sensor/wsen/wsen_itds/CMakeLists.txt delete mode 100644 drivers/sensor/wsen/wsen_itds/Kconfig delete mode 100644 drivers/sensor/wsen/wsen_itds/itds.c delete mode 100644 drivers/sensor/wsen/wsen_itds/itds.h delete mode 100644 drivers/sensor/wsen/wsen_itds/itds_trigger.c delete mode 100644 dts/bindings/sensor/we,wsen-itds.yaml diff --git a/drivers/sensor/wsen/CMakeLists.txt b/drivers/sensor/wsen/CMakeLists.txt index 6be9862503652..155ac77eeeb63 100644 --- a/drivers/sensor/wsen/CMakeLists.txt +++ b/drivers/sensor/wsen/CMakeLists.txt @@ -2,7 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 # zephyr-keep-sorted-start -add_subdirectory_ifdef(CONFIG_ITDS wsen_itds) add_subdirectory_ifdef(CONFIG_WSEN_HIDS wsen_hids) add_subdirectory_ifdef(CONFIG_WSEN_PADS wsen_pads) add_subdirectory_ifdef(CONFIG_WSEN_PDUS wsen_pdus) diff --git a/drivers/sensor/wsen/Kconfig b/drivers/sensor/wsen/Kconfig index 4e96bd5258870..664c8a31f1b76 100644 --- a/drivers/sensor/wsen/Kconfig +++ b/drivers/sensor/wsen/Kconfig @@ -3,7 +3,6 @@ # zephyr-keep-sorted-start source "drivers/sensor/wsen/wsen_hids/Kconfig" -source "drivers/sensor/wsen/wsen_itds/Kconfig" source "drivers/sensor/wsen/wsen_pads/Kconfig" source "drivers/sensor/wsen/wsen_pdus/Kconfig" source "drivers/sensor/wsen/wsen_tids/Kconfig" diff --git a/drivers/sensor/wsen/wsen_itds/CMakeLists.txt b/drivers/sensor/wsen/wsen_itds/CMakeLists.txt deleted file mode 100644 index c1466fc879b8c..0000000000000 --- a/drivers/sensor/wsen/wsen_itds/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -zephyr_library() - -zephyr_library_sources(itds.c) -zephyr_library_sources_ifdef(CONFIG_ITDS_TRIGGER itds_trigger.c) diff --git a/drivers/sensor/wsen/wsen_itds/Kconfig b/drivers/sensor/wsen/wsen_itds/Kconfig deleted file mode 100644 index 17493a4e69880..0000000000000 --- a/drivers/sensor/wsen/wsen_itds/Kconfig +++ /dev/null @@ -1,22 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# -# Copyright (c) 2020 Linumiz - -config ITDS - bool "WSEN-ITDS 3-axis accel sensor" - default y - depends on DT_HAS_WE_WSEN_ITDS_ENABLED - select I2C - help - Enable Wurth Elektronik WSEN-ITDS 3-axis acceleration sensor - provides acceleration and die temperature measurement. - -if ITDS - -config ITDS_TRIGGER - bool "Trigger mode" - help - Set to enable trigger mode using gpio interrupt, interrupts are - configured to line INT0. - -endif # ITDS diff --git a/drivers/sensor/wsen/wsen_itds/itds.c b/drivers/sensor/wsen/wsen_itds/itds.c deleted file mode 100644 index 8c2120f79b7f7..0000000000000 --- a/drivers/sensor/wsen/wsen_itds/itds.c +++ /dev/null @@ -1,415 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * Würth Elektronic WSEN-ITDS 3-axis accel sensor driver - * - * Copyright (c) 2020 Linumiz - * Author: Saravanan Sekar - */ - -#include -#include -#include -#include -#include -#include -#include "itds.h" - -#define DT_DRV_COMPAT we_wsen_itds -#define ITDS_TEMP_CONST 62500 - -LOG_MODULE_REGISTER(ITDS, CONFIG_SENSOR_LOG_LEVEL); - -static const struct itds_odr itds_odr_map[ITDS_ODR_MAX] = { - {0}, {1, 600}, {12, 500}, {25}, {50}, {100}, {200}, - {400}, {800}, {1600} -}; - -static const int16_t itds_sensitivity_scale[][ITDS_ACCL_RANGE_END] = { - {976, 1952, 3904, 7808}, - - /* high performance mode */ - {244, 488, 976, 1952} -}; - -static int itds_get_odr_for_index(const struct device *dev, - enum itds_odr_const idx, - uint16_t *freq, uint16_t *mfreq) -{ - struct itds_device_data *ddata = dev->data; - int start, end; - bool hp_mode; - - hp_mode = !!(ddata->op_mode & ITDS_OP_MODE_HIGH_PERF); - if (hp_mode) { - start = ITDS_ODR_12_5; - end = ITDS_ODR_1600; - } else { - start = ITDS_ODR_1_6; - end = ITDS_ODR_200; - } - - if (idx < start || idx > end) { - LOG_ERR("invalid odr for the operating mode"); - return -EINVAL; - } - - *freq = itds_odr_map[idx].freq; - *mfreq = itds_odr_map[idx].mfreq; - - return 0; -} - -static int itds_accl_odr_set(const struct device *dev, uint16_t freq, - uint16_t mfreq) -{ - struct itds_device_data *ddata = dev->data; - const struct itds_device_config *cfg = dev->config; - int start, end, i; - bool hp_mode; - - hp_mode = !!(ddata->op_mode & ITDS_OP_MODE_HIGH_PERF); - if (hp_mode) { - start = ITDS_ODR_12_5; - end = ITDS_ODR_1600; - } else { - start = ITDS_ODR_1_6; - end = ITDS_ODR_200; - } - - for (i = start; i <= end; i++) { - if ((freq == itds_odr_map[i].freq) && - (mfreq == itds_odr_map[i].mfreq)) { - - return i2c_reg_update_byte_dt(&cfg->i2c, - ITDS_REG_CTRL1, ITDS_MASK_ODR, i << 4); - } - } - - LOG_ERR("invalid odr, not in range"); - return -EINVAL; -} - -static int itds_accl_range_set(const struct device *dev, int32_t range) -{ - struct itds_device_data *ddata = dev->data; - const struct itds_device_config *cfg = dev->config; - int i, ret; - bool hp_mode; - - for (i = 0; i < ITDS_ACCL_RANGE_END; i++) { - if (range <= (2 << i)) { - break; - } - } - - if (i == ITDS_ACCL_RANGE_END) { - LOG_ERR("Accl out of range"); - return -EINVAL; - } - - ret = i2c_reg_update_byte_dt(&cfg->i2c, ITDS_REG_CTRL6, - ITDS_MASK_SCALE, i << 4); - if (ret) { - LOG_ERR("Accl set full scale failed %d", ret); - return ret; - } - - hp_mode = !!(ddata->op_mode & ITDS_OP_MODE_HIGH_PERF); - ddata->scale = itds_sensitivity_scale[hp_mode][i]; - - return 0; -} - -static int itds_attr_set(const struct device *dev, enum sensor_channel chan, - enum sensor_attribute attr, - const struct sensor_value *val) -{ - if (chan != SENSOR_CHAN_ACCEL_X && - chan != SENSOR_CHAN_ACCEL_Y && - chan != SENSOR_CHAN_ACCEL_Z && - chan != SENSOR_CHAN_ACCEL_XYZ) { - LOG_ERR("attr_set() not supported on this channel."); - return -ENOTSUP; - } - - switch (attr) { - case SENSOR_ATTR_FULL_SCALE: - return itds_accl_range_set(dev, sensor_ms2_to_g(val)); - - case SENSOR_ATTR_SAMPLING_FREQUENCY: - return itds_accl_odr_set(dev, val->val1, val->val2 / 1000); - - default: - LOG_ERR("Accel attribute not supported."); - return -ENOTSUP; - } -} - -static int itds_fetch_temperature(struct itds_device_data *ddata, - const struct itds_device_config *cfg) -{ - uint8_t rval; - int16_t temp_raw = 0; - int ret; - - ret = i2c_reg_read_byte_dt(&cfg->i2c, - ITDS_REG_STATUS_DETECT, &rval); - if (ret) { - return ret; - } - - if (!(rval & ITDS_EVENT_DRDY_T)) { - return -EAGAIN; - } - - ret = i2c_burst_read_dt(&cfg->i2c, ITDS_REG_TEMP_L, - (uint8_t *)&temp_raw, sizeof(uint16_t)); - if (ret) { - return ret; - } - - ddata->temperature = sys_le16_to_cpu(temp_raw); - - return 0; -} - -static int itds_fetch_accel(struct itds_device_data *ddata, - const struct itds_device_config *cfg) -{ - size_t i, ret; - uint8_t rval; - - ret = i2c_reg_read_byte_dt(&cfg->i2c, - ITDS_REG_STATUS, &rval); - if (ret) { - return ret; - } - - if (!(rval & ITDS_EVENT_DRDY)) { - return -EAGAIN; - } - - ret = i2c_burst_read_dt(&cfg->i2c, ITDS_REG_X_OUT_L, - (uint8_t *)ddata->samples, - sizeof(uint16_t) * ITDS_SAMPLE_SIZE); - if (ret) { - return ret; - } - - /* convert samples to cpu endianness */ - for (i = 0; i < ITDS_SAMPLE_SIZE; i += 2) { - int16_t *sample = (int16_t *) &ddata->samples[i]; - - *sample = sys_le16_to_cpu(*sample); - if (ddata->op_mode & ITDS_OP_MODE_NORMAL || - ddata->op_mode & ITDS_OP_MODE_HIGH_PERF) { - *sample = *sample >> 2; - } else { - *sample = *sample >> 4; - } - LOG_DBG("itds sample %d %X\n", i, *sample); - } - - return 0; -} - -static int itds_sample_fetch(const struct device *dev, - enum sensor_channel chan) -{ - struct itds_device_data *ddata = dev->data; - const struct itds_device_config *cfg = dev->config; - - switch (chan) { - case SENSOR_CHAN_ACCEL_XYZ: - case SENSOR_CHAN_ACCEL_X: - case SENSOR_CHAN_ACCEL_Y: - case SENSOR_CHAN_ACCEL_Z: - return itds_fetch_accel(ddata, cfg); - - case SENSOR_CHAN_DIE_TEMP: - return itds_fetch_temperature(ddata, cfg); - - case SENSOR_CHAN_ALL: - return itds_fetch_accel(ddata, cfg) || - itds_fetch_temperature(ddata, cfg); - - default: - return -EINVAL; - } -} - -static inline void itds_accl_channel_get(const struct device *dev, - enum sensor_channel chan, - struct sensor_value *val) -{ - int i; - struct itds_device_data *ddata = dev->data; - uint8_t ofs_start, ofs_stop; - - switch (chan) { - case SENSOR_CHAN_ACCEL_X: - ofs_start = ofs_stop = 0U; - break; - case SENSOR_CHAN_ACCEL_Y: - ofs_start = ofs_stop = 1U; - break; - case SENSOR_CHAN_ACCEL_Z: - ofs_start = ofs_stop = 2U; - break; - default: - ofs_start = 0U; ofs_stop = 2U; - break; - } - - for (i = ofs_start; i <= ofs_stop ; i++, val++) { - int64_t dval; - - /* Sensitivity is exposed in ug/LSB */ - /* Convert to m/s^2 */ - dval = (int64_t)((ddata->samples[i] * ddata->scale * SENSOR_G) / - 1000000LL); - val->val1 = (int32_t)(dval / 1000000); - val->val2 = (int32_t)(dval % 1000000); - } -} - -static int itds_temp_channel_get(const struct device *dev, - struct sensor_value *val) -{ - int32_t temp_processed; - struct itds_device_data *ddata = dev->data; - - temp_processed = (ddata->temperature >> 4) * ITDS_TEMP_CONST; - - val->val1 = ITDS_TEMP_OFFSET; - val->val2 = temp_processed; - - return 0; -} - -static int itds_channel_get(const struct device *dev, - enum sensor_channel chan, - struct sensor_value *val) -{ - switch (chan) { - case SENSOR_CHAN_ACCEL_X: - case SENSOR_CHAN_ACCEL_Y: - case SENSOR_CHAN_ACCEL_Z: - case SENSOR_CHAN_ACCEL_XYZ: - itds_accl_channel_get(dev, chan, val); - return 0; - - case SENSOR_CHAN_DIE_TEMP: - return itds_temp_channel_get(dev, val); - - default: - LOG_ERR("Channel not supported."); - return -ENOTSUP; - } - - return 0; -} - -static int itds_init(const struct device *dev) -{ - struct itds_device_data *ddata = dev->data; - const struct itds_device_config *cfg = dev->config; - int ret; - uint16_t freq, mfreq; - uint8_t rval; - - if (!device_is_ready(cfg->i2c.bus)) { - LOG_ERR("Bus device is not ready"); - return -ENODEV; - } - - ret = i2c_reg_read_byte_dt(&cfg->i2c, - ITDS_REG_DEV_ID, &rval); - if (ret) { - LOG_ERR("device init fail: %d", ret); - return ret; - } - - if (rval != ITDS_DEVICE_ID) { - LOG_ERR("device ID mismatch: %x", rval); - return -EIO; - } - - ret = i2c_reg_update_byte_dt(&cfg->i2c, ITDS_REG_CTRL2, - ITDS_MASK_BDU_INC_ADD, ITDS_MASK_BDU_INC_ADD); - if (ret) { - LOG_ERR("unable to set block data update %d", ret); - return ret; - } - - ret = i2c_reg_write_byte_dt(&cfg->i2c, ITDS_REG_WAKEUP_EVENT, 0); - if (ret) { - LOG_ERR("disable wakeup event fail %d", ret); - return ret; - } - - ret = i2c_reg_update_byte_dt(&cfg->i2c, ITDS_REG_CTRL1, - ITDS_MASK_MODE, 1 << cfg->def_op_mode); - if (ret) { - LOG_ERR("set operating mode fail %d", ret); - return ret; - } - - ddata->op_mode = 1 << cfg->def_op_mode; - - ret = itds_get_odr_for_index(dev, cfg->def_odr, &freq, &mfreq); - if (ret) { - LOG_ERR("odr not in range for operating mode %d", ret); - return ret; - } - - ret = itds_accl_odr_set(dev, freq, mfreq); - if (ret) { - LOG_ERR("odr not in range for operating mode %d", ret); - return ret; - } - -#ifdef CONFIG_ITDS_TRIGGER - ret = itds_trigger_mode_init(dev); - if (ret) { - LOG_ERR("trigger mode init failed %d", ret); - return ret; - } -#endif - return 0; -} - -static const struct sensor_driver_api itds_api = { - .attr_set = itds_attr_set, -#ifdef CONFIG_ITDS_TRIGGER - .trigger_set = itds_trigger_set, -#endif - .sample_fetch = itds_sample_fetch, - .channel_get = itds_channel_get, -}; - -#ifdef CONFIG_ITDS_TRIGGER -#define WSEN_ITDS_CFG_IRQ(inst) \ - .int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, int_gpios, { 0 }), -#else -#define WSEN_ITDS_CFG_IRQ(inst) -#endif - -#define WSEN_ITDS_INIT(idx) \ - \ -static struct itds_device_data itds_data_##idx; \ - \ -static const struct itds_device_config itds_config_##idx = { \ - .i2c = I2C_DT_SPEC_INST_GET(idx), \ - .def_odr = DT_INST_ENUM_IDX(idx, odr), \ - .def_op_mode = DT_INST_ENUM_IDX(idx, op_mode), \ - WSEN_ITDS_CFG_IRQ(idx) \ -}; \ - \ -SENSOR_DEVICE_DT_INST_DEFINE(idx, itds_init, NULL, \ - &itds_data_##idx, &itds_config_##idx, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &itds_api); \ - -DT_INST_FOREACH_STATUS_OKAY(WSEN_ITDS_INIT) diff --git a/drivers/sensor/wsen/wsen_itds/itds.h b/drivers/sensor/wsen/wsen_itds/itds.h deleted file mode 100644 index b37bed384c844..0000000000000 --- a/drivers/sensor/wsen/wsen_itds/itds.h +++ /dev/null @@ -1,125 +0,0 @@ -/* Würth Elektronic WSEN-ITDS 3-axis Accel sensor driver - * - * Copyright (c) 2020 Linumiz - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_DRIVERS_SENSOR_ITDS_H_ -#define ZEPHYR_DRIVERS_SENSOR_ITDS_H_ - -#include -#include -#include - -/* registers */ -#define ITDS_REG_TEMP_L 0x0d -#define ITDS_REG_DEV_ID 0x0f -#define ITDS_REG_CTRL1 0x20 -#define ITDS_REG_CTRL2 0x21 -#define ITDS_REG_CTRL3 0x22 -#define ITDS_REG_CTRL4 0x23 -#define ITDS_REG_CTRL5 0x24 -#define ITDS_REG_CTRL6 0x25 -#define ITDS_REG_STATUS 0x27 -#define ITDS_REG_X_OUT_L 0x28 -#define ITDS_REG_Y_OUT_L 0x2a -#define ITDS_REG_Z_OUT_L 0x2c -#define ITDS_REG_FIFO_CTRL 0x2e -#define ITDS_REG_FIFO_SAMPLES 0x2f -#define ITDS_REG_STATUS_DETECT 0x37 -#define ITDS_REG_WAKEUP_EVENT 0x38 -#define ITDS_REG_CTRL7 0x3f - -/* bitfields */ -#define ITDS_MASK_SCALE GENMASK(5, 4) -#define ITDS_MASK_BDU_INC_ADD GENMASK(3, 2) -#define ITDS_MASK_FIFOTH GENMASK(4, 0) -#define ITDS_MASK_FIFOMODE GENMASK(7, 5) -#define ITDS_MASK_MODE GENMASK(3, 0) -#define ITDS_MASK_SAMPLES_COUNT GENMASK(5, 0) -#define ITDS_MASK_ODR GENMASK(7, 4) -#define ITDS_MASK_INT_DRDY BIT(0) -#define ITDS_MASK_INT_FIFOTH BIT(1) -#define ITDS_MASK_INT_EN BIT(5) - -#define ITDS_EVENT_DRDY BIT(0) -#define ITDS_EVENT_DRDY_T BIT(6) -#define ITDS_EVENT_FIFO_TH BIT(7) -#define ITDS_FIFO_MODE_BYPASS 0 -#define ITDS_FIFO_MODE_FIFO BIT(5) -#define ITDS_DEVICE_ID 0x44 -#define ITDS_ACCL_FIFO_SIZE 32 -#define ITDS_TEMP_OFFSET 25 - -enum operation_mode { - ITDS_OP_MODE_LOW_POWER = BIT(0), - ITDS_OP_MODE_NORMAL = BIT(1), - ITDS_OP_MODE_HIGH_PERF = BIT(2), -}; - -enum itds_accel_range_const { - ITDS_ACCL_RANGE_2G, - ITDS_ACCL_RANGE_4G, - ITDS_ACCL_RANGE_8G, - ITDS_ACCL_RANGE_16G, - ITDS_ACCL_RANGE_END -}; - -enum itds_odr_const { - ITDS_ODR_0, - ITDS_ODR_1_6, - ITDS_ODR_12_5, - ITDS_ODR_25, - ITDS_ODR_50, - ITDS_ODR_100, - ITDS_ODR_200, - ITDS_ODR_400, - ITDS_ODR_800, - ITDS_ODR_1600, - ITDS_ODR_MAX -}; - -struct itds_odr { - uint16_t freq; - uint16_t mfreq; -}; - -struct itds_accel_range { - uint16_t range; - uint8_t reg_val; -}; - -struct itds_device_config { - struct i2c_dt_spec i2c; -#ifdef CONFIG_ITDS_TRIGGER - struct gpio_dt_spec int_gpio; -#endif - int def_odr; - int def_op_mode; -}; - -#define ITDS_SAMPLE_SIZE 3 -struct itds_device_data { -#ifdef CONFIG_ITDS_TRIGGER - struct gpio_callback gpio_cb; - struct k_work work; -#endif - int16_t samples[ITDS_SAMPLE_SIZE]; - int16_t temperature; - int16_t scale; - enum operation_mode op_mode; - const struct device *dev; - -#ifdef CONFIG_ITDS_TRIGGER - sensor_trigger_handler_t handler_drdy; - const struct sensor_trigger *trigger_drdy; -#endif /* CONFIG_ITDS_TRIGGER */ -}; - -int itds_trigger_mode_init(const struct device *dev); -int itds_trigger_set(const struct device *dev, - const struct sensor_trigger *trig, - sensor_trigger_handler_t handler); - -#endif /* ZEPHYR_DRIVERS_SENSOR_ITDS_H_*/ diff --git a/drivers/sensor/wsen/wsen_itds/itds_trigger.c b/drivers/sensor/wsen/wsen_itds/itds_trigger.c deleted file mode 100644 index afbf55d8b8644..0000000000000 --- a/drivers/sensor/wsen/wsen_itds/itds_trigger.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * Würth Elektronic WSEN-ITDS 3-axis accel sensor driver - * - * Copyright (c) 2020 Linumiz - * Author: Saravanan Sekar - */ - -#include -#include -#include -#include - -#include "itds.h" -LOG_MODULE_DECLARE(ITDS, CONFIG_SENSOR_LOG_LEVEL); - -static int itds_trigger_drdy_set(const struct device *dev, - enum sensor_channel chan, - const struct sensor_trigger *trig, - sensor_trigger_handler_t handler) -{ - struct itds_device_data *ddata = dev->data; - const struct itds_device_config *cfg = dev->config; - uint8_t drdy_en = 0U; - int ret; - - ddata->handler_drdy = handler; - ddata->trigger_drdy = trig; - if (ddata->handler_drdy) { - drdy_en = ITDS_MASK_INT_DRDY; - } - - ret = i2c_reg_update_byte_dt(&cfg->i2c, ITDS_REG_CTRL4, - ITDS_MASK_INT_DRDY, drdy_en); - if (ret) { - return ret; - } - - return 0; -} - -int itds_trigger_set(const struct device *dev, - const struct sensor_trigger *trig, - sensor_trigger_handler_t handler) -{ - const struct itds_device_config *cfg = dev->config; - - if (!cfg->int_gpio.port) { - return -ENOTSUP; - } - - if (trig->chan != SENSOR_CHAN_ACCEL_XYZ) { - return -ENOTSUP; - } - - switch (trig->type) { - case SENSOR_TRIG_DATA_READY: - return itds_trigger_drdy_set(dev, trig->chan, trig, handler); - - default: - return -ENOTSUP; - } -} - -static void itds_work_handler(struct k_work *work) -{ - struct itds_device_data *ddata = - CONTAINER_OF(work, struct itds_device_data, work); - const struct device *dev = (const struct device *)ddata->dev; - const struct itds_device_config *cfg = dev->config; - uint8_t status; - - if (i2c_reg_read_byte_dt(&cfg->i2c, ITDS_REG_STATUS, - &status) < 0) { - return; - } - - if (status & ITDS_EVENT_DRDY) { - if (ddata->handler_drdy) { - ddata->handler_drdy(dev, ddata->trigger_drdy); - } - } -} - -static void itds_gpio_callback(const struct device *port, - struct gpio_callback *cb, uint32_t pin) -{ - struct itds_device_data *ddata = - CONTAINER_OF(cb, struct itds_device_data, gpio_cb); - - ARG_UNUSED(port); - ARG_UNUSED(pin); - - k_work_submit(&ddata->work); -} - -int itds_trigger_mode_init(const struct device *dev) -{ - struct itds_device_data *ddata = dev->data; - const struct itds_device_config *cfg = dev->config; - - /* dts doesn't have GPIO int pin set, so we dont support - * trigger mode for this instance - */ - if (!cfg->int_gpio.port) { - return 0; - } - - if (!gpio_is_ready_dt(&cfg->int_gpio)) { - LOG_ERR("%s: device %s is not ready", dev->name, - cfg->int_gpio.port->name); - return -ENODEV; - } - - ddata->work.handler = itds_work_handler; - ddata->dev = dev; - - gpio_pin_configure_dt(&cfg->int_gpio, GPIO_INPUT); - - gpio_init_callback(&ddata->gpio_cb, itds_gpio_callback, - BIT(cfg->int_gpio.pin)); - - gpio_add_callback(cfg->int_gpio.port, &ddata->gpio_cb); - gpio_pin_interrupt_configure_dt(&cfg->int_gpio, GPIO_INT_EDGE_TO_ACTIVE); - - /* enable global interrupt */ - return i2c_reg_update_byte_dt(&cfg->i2c, ITDS_REG_CTRL7, - ITDS_MASK_INT_EN, ITDS_MASK_INT_EN); -} diff --git a/dts/bindings/sensor/we,wsen-itds.yaml b/dts/bindings/sensor/we,wsen-itds.yaml deleted file mode 100644 index 5f73ed0186786..0000000000000 --- a/dts/bindings/sensor/we,wsen-itds.yaml +++ /dev/null @@ -1,40 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# Copyright (c) 2020 Linumiz - -description: WSEN-ITDS 3-axis accel sensor - -compatible: "we,wsen-itds" - -include: [sensor-device.yaml, i2c-device.yaml] - -properties: - int-gpios: - type: phandle-array - description: | - This property specifies the connection for INT0, the driver maps - all interrupts to INT0 as default. The signal to output high when - data produced by the sensor. - - odr: - type: string - required: true - description: Output data rate in Hz - enum: - - "1.6" - - "12.5" - - "25" - - "50" - - "100" - - "200" - - "400" - - "800" - - "1600" - - op-mode: - type: string - required: true - description: Operating mode of sensor - enum: - - "low-power" - - "normal" - - "high-perf" diff --git a/tests/drivers/build_all/sensor/i2c.dtsi b/tests/drivers/build_all/sensor/i2c.dtsi index 35a8bd60f8ea2..0a0674846a191 100644 --- a/tests/drivers/build_all/sensor/i2c.dtsi +++ b/tests/drivers/build_all/sensor/i2c.dtsi @@ -522,14 +522,6 @@ test_i2c_wsen_hids: wsen_hids@4d { odr = "1"; }; -test_i2c_itds: itds@4e { - compatible = "we,wsen-itds"; - reg = <0x4e>; - int-gpios = <&test_gpio 0 0>; - odr = "800"; - op-mode = "high-perf"; -}; - test_i2c_max17055: max17055@4f { compatible = "maxim,max17055"; reg = <0x4f>; diff --git a/tests/drivers/build_all/sensor/sensors_no_default.conf b/tests/drivers/build_all/sensor/sensors_no_default.conf index a4e91529ef5b4..185e2b2fda18e 100644 --- a/tests/drivers/build_all/sensor/sensors_no_default.conf +++ b/tests/drivers/build_all/sensor/sensors_no_default.conf @@ -3,7 +3,6 @@ CONFIG_BMC150_MAGN_TRIGGER_DRDY=y CONFIG_BMM150_TRIGGER_DIRECT=y CONFIG_BMP388_TRIGGER_DIRECT=y CONFIG_INA230_TRIGGER=y -CONFIG_ITDS_TRIGGER=y CONFIG_LM77_TRIGGER=y CONFIG_LSM9DS0_GYRO_TRIGGERS=y CONFIG_LSM9DS0_GYRO_TRIGGER_DRDY=y From 449bf8019ca65ffe2b5042974b42721942b35eac Mon Sep 17 00:00:00 2001 From: Wajdi ELMuhtadi Date: Fri, 1 Sep 2023 10:30:54 +0200 Subject: [PATCH 0652/4482] drivers: sensor: wsen_hids: remove wsen_hids driver Remove wsen_hids since the hal update is no longer compatible with this version. Signed-off-by: Wajdi ELMuhtadi --- drivers/sensor/wsen/CMakeLists.txt | 1 - drivers/sensor/wsen/Kconfig | 1 - drivers/sensor/wsen/wsen_hids/CMakeLists.txt | 7 - drivers/sensor/wsen/wsen_hids/Kconfig | 55 ---- drivers/sensor/wsen/wsen_hids/wsen_hids.c | 279 ------------------ drivers/sensor/wsen/wsen_hids/wsen_hids.h | 81 ----- .../sensor/wsen/wsen_hids/wsen_hids_trigger.c | 168 ----------- dts/bindings/sensor/we,wsen-hids-common.yaml | 22 -- dts/bindings/sensor/we,wsen-hids-i2c.yaml | 9 - dts/bindings/sensor/we,wsen-hids-spi.yaml | 9 - tests/drivers/build_all/sensor/i2c.dtsi | 7 - .../sensor/sensors_trigger_global.conf | 1 - .../sensor/sensors_trigger_none.conf | 1 - .../build_all/sensor/sensors_trigger_own.conf | 1 - 14 files changed, 642 deletions(-) delete mode 100644 drivers/sensor/wsen/wsen_hids/CMakeLists.txt delete mode 100644 drivers/sensor/wsen/wsen_hids/Kconfig delete mode 100644 drivers/sensor/wsen/wsen_hids/wsen_hids.c delete mode 100644 drivers/sensor/wsen/wsen_hids/wsen_hids.h delete mode 100644 drivers/sensor/wsen/wsen_hids/wsen_hids_trigger.c delete mode 100644 dts/bindings/sensor/we,wsen-hids-common.yaml delete mode 100644 dts/bindings/sensor/we,wsen-hids-i2c.yaml delete mode 100644 dts/bindings/sensor/we,wsen-hids-spi.yaml diff --git a/drivers/sensor/wsen/CMakeLists.txt b/drivers/sensor/wsen/CMakeLists.txt index 155ac77eeeb63..e3ce57897393a 100644 --- a/drivers/sensor/wsen/CMakeLists.txt +++ b/drivers/sensor/wsen/CMakeLists.txt @@ -2,7 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 # zephyr-keep-sorted-start -add_subdirectory_ifdef(CONFIG_WSEN_HIDS wsen_hids) add_subdirectory_ifdef(CONFIG_WSEN_PADS wsen_pads) add_subdirectory_ifdef(CONFIG_WSEN_PDUS wsen_pdus) add_subdirectory_ifdef(CONFIG_WSEN_TIDS wsen_tids) diff --git a/drivers/sensor/wsen/Kconfig b/drivers/sensor/wsen/Kconfig index 664c8a31f1b76..a8b4fd6ddeb1c 100644 --- a/drivers/sensor/wsen/Kconfig +++ b/drivers/sensor/wsen/Kconfig @@ -2,7 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 # zephyr-keep-sorted-start -source "drivers/sensor/wsen/wsen_hids/Kconfig" source "drivers/sensor/wsen/wsen_pads/Kconfig" source "drivers/sensor/wsen/wsen_pdus/Kconfig" source "drivers/sensor/wsen/wsen_tids/Kconfig" diff --git a/drivers/sensor/wsen/wsen_hids/CMakeLists.txt b/drivers/sensor/wsen/wsen_hids/CMakeLists.txt deleted file mode 100644 index 8c172aed581e3..0000000000000 --- a/drivers/sensor/wsen/wsen_hids/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2022 Würth Elektronik eiSos GmbH & Co. KG -# SPDX-License-Identifier: Apache-2.0 - -zephyr_library() - -zephyr_library_sources(wsen_hids.c) -zephyr_library_sources_ifdef(CONFIG_WSEN_HIDS_TRIGGER wsen_hids_trigger.c) diff --git a/drivers/sensor/wsen/wsen_hids/Kconfig b/drivers/sensor/wsen/wsen_hids/Kconfig deleted file mode 100644 index 0e7d4f8e6d552..0000000000000 --- a/drivers/sensor/wsen/wsen_hids/Kconfig +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright (c) 2022 Würth Elektronik eiSos GmbH & Co. KG -# SPDX-License-Identifier: Apache-2.0 - -menuconfig WSEN_HIDS - bool "WSEN-HIDS humidity and temperature sensor" - default y - depends on DT_HAS_WE_WSEN_HIDS_ENABLED - select I2C if $(dt_compat_on_bus,$(DT_COMPAT_WE_WSEN_HIDS),i2c) - select SPI if $(dt_compat_on_bus,$(DT_COMPAT_WE_WSEN_HIDS),spi) - select HAS_WESENSORS - help - Enable driver for the WSEN-HIDS I2C/SPI-based humidity sensor with integrated - temperature sensor. - -if WSEN_HIDS - -choice WSEN_HIDS_TRIGGER_MODE - prompt "Trigger mode" - default WSEN_HIDS_TRIGGER_NONE - help - Specify the type of triggering to be used by the driver. - -config WSEN_HIDS_TRIGGER_NONE - bool "No trigger" - -config WSEN_HIDS_TRIGGER_GLOBAL_THREAD - bool "Use global thread" - depends on GPIO - select WSEN_HIDS_TRIGGER - -config WSEN_HIDS_TRIGGER_OWN_THREAD - bool "Use own thread" - depends on GPIO - select WSEN_HIDS_TRIGGER - -endchoice # WSEN_HIDS_TRIGGER_MODE - -config WSEN_HIDS_TRIGGER - bool - -config WSEN_HIDS_THREAD_PRIORITY - int "Thread priority" - depends on WSEN_HIDS_TRIGGER_OWN_THREAD - default 10 - help - Priority of thread used by the driver to handle interrupts. - -config WSEN_HIDS_THREAD_STACK_SIZE - int "Thread stack size" - depends on WSEN_HIDS_TRIGGER_OWN_THREAD - default 1024 - help - Stack size of thread used by the driver to handle interrupts. - -endif # WSEN_HIDS diff --git a/drivers/sensor/wsen/wsen_hids/wsen_hids.c b/drivers/sensor/wsen/wsen_hids/wsen_hids.c deleted file mode 100644 index 74c296430d4c9..0000000000000 --- a/drivers/sensor/wsen/wsen_hids/wsen_hids.c +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright (c) 2022 Würth Elektronik eiSos GmbH & Co. KG - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#define DT_DRV_COMPAT we_wsen_hids - -#include - -#include -#include -#include - -#include "wsen_hids.h" - -LOG_MODULE_REGISTER(WSEN_HIDS, CONFIG_SENSOR_LOG_LEVEL); - -/* - * List of supported output data rates (sensor_value struct, input to - * sensor_attr_set()). Index into this list is used as argument for - * HIDS_setOutputDataRate(). - */ -static const struct sensor_value hids_odr_list[] = { - {.val1 = 0, .val2 = 0}, - {.val1 = 1, .val2 = 0}, - {.val1 = 7, .val2 = 0}, - {.val1 = 12, .val2 = 5 * 100000}, -}; - -static int hids_sample_fetch(const struct device *dev, enum sensor_channel channel) -{ - struct hids_data *data = dev->data; - int16_t raw_humidity; - int16_t raw_temp; - - __ASSERT_NO_MSG(channel == SENSOR_CHAN_ALL); - - if (HIDS_getRawValues(&data->sensor_interface, &raw_humidity, &raw_temp) != WE_SUCCESS) { - LOG_ERR("Failed to %s sample.", "fetch data"); - return -EIO; - } - - if (HIDS_convertHumidity_uint16(&data->sensor_interface, raw_humidity, &data->humidity) != - WE_SUCCESS) { - LOG_ERR("Failed to %s sample.", "convert humidity"); - return -EIO; - } - - if (HIDS_convertTemperature_int16(&data->sensor_interface, raw_temp, &data->temperature) != - WE_SUCCESS) { - LOG_ERR("Failed to %s sample.", "convert temperature"); - return -EIO; - } - - return 0; -} - -static int hids_channel_get(const struct device *dev, enum sensor_channel channel, - struct sensor_value *value) -{ - struct hids_data *data = dev->data; - int32_t value_converted; - - if (channel == SENSOR_CHAN_AMBIENT_TEMP) { - value_converted = (int32_t)data->temperature; - - /* Convert temperature from 0.01 degrees Celsius to degrees Celsius */ - value->val1 = value_converted / 100; - value->val2 = (value_converted % 100) * (1000000 / 100); - } else if (channel == SENSOR_CHAN_HUMIDITY) { - value_converted = (int32_t)data->humidity; - - /* Convert humidity from 0.01 percent to percent */ - value->val1 = value_converted / 100; - value->val2 = (value_converted % 100) * (1000000 / 100); - } else { - return -ENOTSUP; - } - - return 0; -} - -/* Set output data rate. See hids_odr_list for allowed values. */ -static int hids_odr_set(const struct device *dev, const struct sensor_value *odr) -{ - struct hids_data *data = dev->data; - int odr_index; - - for (odr_index = 0; odr_index < ARRAY_SIZE(hids_odr_list); odr_index++) { - if (odr->val1 == hids_odr_list[odr_index].val1 && - odr->val2 == hids_odr_list[odr_index].val2) { - break; - } - } - - if (odr_index == ARRAY_SIZE(hids_odr_list)) { - /* ODR not allowed (was not found in hids_odr_list) */ - LOG_ERR("Bad sampling frequency %d.%d", odr->val1, odr->val2); - return -EINVAL; - } - - if (HIDS_setOutputDataRate(&data->sensor_interface, (HIDS_outputDataRate_t)odr_index) != - WE_SUCCESS) { - LOG_ERR("Failed to set output data rate"); - return -EIO; - } - - return 0; -} - -static int hids_attr_set(const struct device *dev, enum sensor_channel chan, - enum sensor_attribute attr, const struct sensor_value *val) -{ - if (chan != SENSOR_CHAN_ALL) { - LOG_WRN("attr_set() is not supported on channel %d.", chan); - return -ENOTSUP; - } - - if (attr == SENSOR_ATTR_SAMPLING_FREQUENCY) { - return hids_odr_set(dev, val); - } else { - return -ENOTSUP; - } -} - -static const struct sensor_driver_api hids_driver_api = { - .attr_set = hids_attr_set, -#if CONFIG_WSEN_HIDS_TRIGGER - .trigger_set = hids_trigger_set, -#endif - .sample_fetch = hids_sample_fetch, - .channel_get = hids_channel_get, -}; - -static int hids_init(const struct device *dev) -{ - const struct hids_config *config = dev->config; - struct hids_data *data = dev->data; - uint8_t device_id; - - /* Initialize WE sensor interface */ - WE_sensorInterfaceType_t interface_type = data->sensor_interface.interfaceType; - - HIDS_getDefaultInterface(&data->sensor_interface); - data->sensor_interface.interfaceType = interface_type; - - switch (data->sensor_interface.interfaceType) { -#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) - case WE_i2c: - data->sensor_interface.handle = (void *)&config->bus_cfg.i2c; - break; -#endif -#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) - case WE_spi: - data->sensor_interface.handle = (void *)&config->bus_cfg.spi; - break; -#endif - default: - LOG_ERR("Invalid interface type"); - return -EINVAL; - } - - /* First communication test - check device ID */ - if (HIDS_getDeviceID(&data->sensor_interface, &device_id) != WE_SUCCESS) { - LOG_ERR("Failed to read device ID."); - return -EIO; - } - - if (device_id != HIDS_DEVICE_ID_VALUE) { - LOG_ERR("Invalid device ID 0x%x.", device_id); - return -EINVAL; - } - - if (HIDS_setOutputDataRate(&data->sensor_interface, config->odr) != WE_SUCCESS) { - LOG_ERR("Failed to set output data rate."); - return -EIO; - } - - if (HIDS_enableBlockDataUpdate(&data->sensor_interface, HIDS_enable) != WE_SUCCESS) { - LOG_ERR("Failed to enable block data update."); - return -EIO; - } - - if (HIDS_setPowerMode(&data->sensor_interface, HIDS_activeMode) != WE_SUCCESS) { - LOG_ERR("Failed to set power mode."); - return -EIO; - } - - if (HIDS_readCalibrationData(&data->sensor_interface) != WE_SUCCESS) { - LOG_ERR("Failed to read calibration data."); - return -EIO; - } - -#if CONFIG_WSEN_HIDS_TRIGGER - int status = hids_init_interrupt(dev); - - if (status < 0) { - LOG_ERR("Failed to initialize data-ready interrupt."); - return status; - } -#endif - - return 0; -} - -#if DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 0 -#warning "HIDS driver enabled without any devices" -#endif - -/* - * Device creation macros - */ - -#define HIDS_DEVICE_INIT(inst) \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ - hids_init, \ - NULL, \ - &hids_data_##inst, \ - &hids_config_##inst, \ - POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ - &hids_driver_api); - -#ifdef CONFIG_WSEN_HIDS_TRIGGER -#define HIDS_CFG_IRQ(inst) .gpio_drdy = GPIO_DT_SPEC_INST_GET(inst, drdy_gpios) -#else -#define HIDS_CFG_IRQ(inst) -#endif /* CONFIG_WSEN_HIDS_TRIGGER */ - -#define HIDS_CONFIG_COMMON(inst) \ - .odr = (HIDS_outputDataRate_t)(DT_INST_ENUM_IDX(inst, odr) + 1), \ - COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, drdy_gpios), \ - (HIDS_CFG_IRQ(inst)), ()) - -/* - * Instantiation macros used when device is on SPI bus. - */ - -#define HIDS_SPI_OPERATION (SPI_WORD_SET(8) | SPI_OP_MODE_MASTER | SPI_MODE_CPOL | SPI_MODE_CPHA) - -#define HIDS_CONFIG_SPI(inst) \ - { \ - .bus_cfg = { \ - .spi = SPI_DT_SPEC_INST_GET(inst, \ - HIDS_SPI_OPERATION, \ - 0), \ - }, \ - HIDS_CONFIG_COMMON(inst) \ - } - -/* - * Instantiation macros used when device is on I2C bus. - */ - -#define HIDS_CONFIG_I2C(inst) \ - { \ - .bus_cfg = { \ - .i2c = I2C_DT_SPEC_INST_GET(inst), \ - }, \ - HIDS_CONFIG_COMMON(inst) \ - } - -/* - * Main instantiation macro. Use of COND_CODE_1() selects the right - * bus-specific macro at preprocessor time. - */ -#define HIDS_DEFINE(inst) \ - static struct hids_data hids_data_##inst = \ - COND_CODE_1(DT_INST_ON_BUS(inst, i2c), \ - ({ .sensor_interface = { .interfaceType = WE_i2c } }), ()) \ - COND_CODE_1(DT_INST_ON_BUS(inst, spi), \ - ({ .sensor_interface = { .interfaceType = WE_spi } }), ());\ - static const struct hids_config hids_config_##inst = \ - COND_CODE_1(DT_INST_ON_BUS(inst, i2c), (HIDS_CONFIG_I2C(inst)), ()) \ - COND_CODE_1(DT_INST_ON_BUS(inst, spi), (HIDS_CONFIG_SPI(inst)), ()); \ - HIDS_DEVICE_INIT(inst) - -DT_INST_FOREACH_STATUS_OKAY(HIDS_DEFINE) diff --git a/drivers/sensor/wsen/wsen_hids/wsen_hids.h b/drivers/sensor/wsen/wsen_hids/wsen_hids.h deleted file mode 100644 index a75e243bf653b..0000000000000 --- a/drivers/sensor/wsen/wsen_hids/wsen_hids.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2022 Würth Elektronik eiSos GmbH & Co. KG - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_DRIVERS_SENSOR_WSEN_HIDS_WSEN_HIDS_H_ -#define ZEPHYR_DRIVERS_SENSOR_WSEN_HIDS_WSEN_HIDS_H_ - -#include -#include - -#include - -#include "WSEN_HIDS_2523020210001.h" - -#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) -#include -#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */ - -#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) -#include -#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */ - -struct hids_data { - /* WE sensor interface configuration */ - WE_sensorInterface_t sensor_interface; - - /* Last humidity sample */ - uint16_t humidity; - - /* Last temperature sample */ - int16_t temperature; - -#ifdef CONFIG_WSEN_HIDS_TRIGGER - const struct device *dev; - struct gpio_callback data_ready_cb; - - const struct sensor_trigger *data_ready_trigger; - sensor_trigger_handler_t data_ready_handler; - -#if defined(CONFIG_WSEN_HIDS_TRIGGER_OWN_THREAD) - K_KERNEL_STACK_MEMBER(thread_stack, CONFIG_WSEN_HIDS_THREAD_STACK_SIZE); - struct k_thread thread; - struct k_sem drdy_sem; -#elif defined(CONFIG_WSEN_HIDS_TRIGGER_GLOBAL_THREAD) - struct k_work work; -#endif -#endif /* CONFIG_WSEN_HIDS_TRIGGER */ -}; - -struct hids_config { - union { -#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) - const struct i2c_dt_spec i2c; -#endif -#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) - const struct spi_dt_spec spi; -#endif - } bus_cfg; - - /* Output data rate */ - HIDS_outputDataRate_t odr; - -#ifdef CONFIG_WSEN_HIDS_TRIGGER - /* Data-ready interrupt pin */ - const struct gpio_dt_spec gpio_drdy; -#endif /* CONFIG_WSEN_HIDS_TRIGGER */ -}; - -#ifdef CONFIG_WSEN_HIDS_TRIGGER -int hids_trigger_set(const struct device *dev, const struct sensor_trigger *trig, - sensor_trigger_handler_t handler); - -int hids_init_interrupt(const struct device *dev); -#endif /* CONFIG_WSEN_HIDS_TRIGGER */ - -int hids_spi_init(const struct device *dev); -int hids_i2c_init(const struct device *dev); - -#endif /* ZEPHYR_DRIVERS_SENSOR_WSEN_HIDS_WSEN_HIDS_H_ */ diff --git a/drivers/sensor/wsen/wsen_hids/wsen_hids_trigger.c b/drivers/sensor/wsen/wsen_hids/wsen_hids_trigger.c deleted file mode 100644 index e8c9472f5cd2c..0000000000000 --- a/drivers/sensor/wsen/wsen_hids/wsen_hids_trigger.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2022 Würth Elektronik eiSos GmbH & Co. KG - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#define DT_DRV_COMPAT we_wsen_hids - -#include - -#include "wsen_hids.h" - -LOG_MODULE_DECLARE(WSEN_HIDS, CONFIG_SENSOR_LOG_LEVEL); - -static inline void hids_setup_drdy_interrupt(const struct device *dev, bool enable) -{ - const struct hids_config *cfg = dev->config; - unsigned int flags = enable ? GPIO_INT_EDGE_TO_ACTIVE : GPIO_INT_DISABLE; - - gpio_pin_interrupt_configure_dt(&cfg->gpio_drdy, flags); -} - -static inline void hids_handle_drdy_interrupt(const struct device *dev) -{ - struct hids_data *data = dev->data; - - hids_setup_drdy_interrupt(dev, false); - -#if defined(CONFIG_WSEN_HIDS_TRIGGER_OWN_THREAD) - k_sem_give(&data->drdy_sem); -#elif defined(CONFIG_WSEN_HIDS_TRIGGER_GLOBAL_THREAD) - k_work_submit(&data->work); -#endif -} - -static void hids_process_drdy_interrupt(const struct device *dev) -{ - struct hids_data *data = dev->data; - - if (data->data_ready_handler != NULL) { - data->data_ready_handler(dev, data->data_ready_trigger); - } - - if (data->data_ready_handler != NULL) { - hids_setup_drdy_interrupt(dev, true); - } -} - -int hids_trigger_set(const struct device *dev, const struct sensor_trigger *trig, - sensor_trigger_handler_t handler) -{ - struct hids_data *data = dev->data; - const struct hids_config *cfg = dev->config; - - if (trig->type != SENSOR_TRIG_DATA_READY) { - LOG_ERR("Unsupported sensor trigger"); - return -ENOTSUP; - } - - hids_setup_drdy_interrupt(dev, false); - - data->data_ready_handler = handler; - if (handler == NULL) { - return 0; - } - - data->data_ready_trigger = trig; - - hids_setup_drdy_interrupt(dev, true); - - /* - * If DRDY is active we probably won't get the rising edge, so - * invoke the callback manually. - */ - if (gpio_pin_get_dt(&cfg->gpio_drdy) > 0) { - hids_handle_drdy_interrupt(dev); - } - - return 0; -} - -static void hids_drdy_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins) -{ - struct hids_data *data = CONTAINER_OF(cb, struct hids_data, data_ready_cb); - - ARG_UNUSED(pins); - - hids_handle_drdy_interrupt(data->dev); -} - -#ifdef CONFIG_WSEN_HIDS_TRIGGER_OWN_THREAD -static void hids_thread(void *p1, void *p2, void *p3) -{ - ARG_UNUSED(p2); - ARG_UNUSED(p3); - - struct hids_data *data = p1; - - while (true) { - k_sem_take(&data->drdy_sem, K_FOREVER); - hids_process_drdy_interrupt(data->dev); - } -} -#endif /* CONFIG_WSEN_HIDS_TRIGGER_OWN_THREAD */ - -#ifdef CONFIG_WSEN_HIDS_TRIGGER_GLOBAL_THREAD -static void hids_work_cb(struct k_work *work) -{ - struct hids_data *data = CONTAINER_OF(work, struct hids_data, work); - - hids_process_drdy_interrupt(data->dev); -} -#endif /* CONFIG_WSEN_HIDS_TRIGGER_GLOBAL_THREAD */ - -int hids_init_interrupt(const struct device *dev) -{ - struct hids_data *data = dev->data; - const struct hids_config *cfg = dev->config; - int status; - - data->dev = dev; - - if (cfg->gpio_drdy.port == NULL) { - LOG_ERR("drdy-gpios is not defined in the device tree."); - return -EINVAL; - } - - if (!gpio_is_ready_dt(&cfg->gpio_drdy)) { - LOG_ERR("Device %s is not ready", cfg->gpio_drdy.port->name); - return -ENODEV; - } - - /* Setup data-ready gpio interrupt */ - status = gpio_pin_configure_dt(&cfg->gpio_drdy, GPIO_INPUT); - if (status < 0) { - LOG_ERR("Could not configure %s.%02u", cfg->gpio_drdy.port->name, - cfg->gpio_drdy.pin); - return status; - } - - gpio_init_callback(&data->data_ready_cb, hids_drdy_callback, BIT(cfg->gpio_drdy.pin)); - - status = gpio_add_callback(cfg->gpio_drdy.port, &data->data_ready_cb); - if (status < 0) { - LOG_ERR("Could not set gpio callback."); - return status; - } - - /* Enable data-ready interrupt */ - if (HIDS_enableDataReadyInterrupt(&data->sensor_interface, HIDS_enable) != WE_SUCCESS) { - LOG_ERR("Could not enable data-ready interrupt."); - return -EIO; - } - -#if defined(CONFIG_WSEN_HIDS_TRIGGER_OWN_THREAD) - k_sem_init(&data->drdy_sem, 0, K_SEM_MAX_LIMIT); - - k_thread_create(&data->thread, data->thread_stack, CONFIG_WSEN_HIDS_THREAD_STACK_SIZE, - hids_thread, data, NULL, NULL, - K_PRIO_COOP(CONFIG_WSEN_HIDS_THREAD_PRIORITY), 0, K_NO_WAIT); -#elif defined(CONFIG_WSEN_HIDS_TRIGGER_GLOBAL_THREAD) - data->work.handler = hids_work_cb; -#endif - - hids_setup_drdy_interrupt(dev, true); - - return 0; -} diff --git a/dts/bindings/sensor/we,wsen-hids-common.yaml b/dts/bindings/sensor/we,wsen-hids-common.yaml deleted file mode 100644 index be3c5906e4c09..0000000000000 --- a/dts/bindings/sensor/we,wsen-hids-common.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) 2022 Würth Elektronik eiSos GmbH & Co. KG -# SPDX-License-Identifier: Apache-2.0 - -include: sensor-device.yaml - -properties: - drdy-gpios: - type: phandle-array - description: | - Data-ready interrupt pin. - Interrupt is active high by default. - - odr: - type: string - required: true - enum: - - "1" - - "7" - - "12.5" - description: | - Sensor output data rate expressed in samples per second. - Data rates supported by the chip are "1", "7" and "12.5". diff --git a/dts/bindings/sensor/we,wsen-hids-i2c.yaml b/dts/bindings/sensor/we,wsen-hids-i2c.yaml deleted file mode 100644 index 6552fe26dc530..0000000000000 --- a/dts/bindings/sensor/we,wsen-hids-i2c.yaml +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2022 Würth Elektronik eiSos GmbH & Co. KG -# SPDX-License-Identifier: Apache-2.0 - -description: | - Würth Elektronik WSEN-HIDS humidity sensor with integrated temperature sensor (I2C bus) - -compatible: "we,wsen-hids" - -include: ["i2c-device.yaml", "we,wsen-hids-common.yaml"] diff --git a/dts/bindings/sensor/we,wsen-hids-spi.yaml b/dts/bindings/sensor/we,wsen-hids-spi.yaml deleted file mode 100644 index fcbdf9f6cf341..0000000000000 --- a/dts/bindings/sensor/we,wsen-hids-spi.yaml +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2022 Würth Elektronik eiSos GmbH & Co. KG -# SPDX-License-Identifier: Apache-2.0 - -description: | - Würth Elektronik WSEN-HIDS humidity sensor with integrated temperature sensor (SPI bus) - -compatible: "we,wsen-hids" - -include: ["spi-device.yaml", "we,wsen-hids-common.yaml"] diff --git a/tests/drivers/build_all/sensor/i2c.dtsi b/tests/drivers/build_all/sensor/i2c.dtsi index 0a0674846a191..9f5bcf2d710b1 100644 --- a/tests/drivers/build_all/sensor/i2c.dtsi +++ b/tests/drivers/build_all/sensor/i2c.dtsi @@ -515,13 +515,6 @@ test_i2c_iis2iclx: iis2iclx@4c { odr = ; }; -test_i2c_wsen_hids: wsen_hids@4d { - compatible = "we,wsen-hids"; - reg = <0x4d>; - drdy-gpios = <&test_gpio 0 0>; - odr = "1"; -}; - test_i2c_max17055: max17055@4f { compatible = "maxim,max17055"; reg = <0x4f>; diff --git a/tests/drivers/build_all/sensor/sensors_trigger_global.conf b/tests/drivers/build_all/sensor/sensors_trigger_global.conf index 48cfd9a6a4dc1..e8611bbdd9639 100644 --- a/tests/drivers/build_all/sensor/sensors_trigger_global.conf +++ b/tests/drivers/build_all/sensor/sensors_trigger_global.conf @@ -64,6 +64,5 @@ CONFIG_TMP007_TRIGGER_GLOBAL_THREAD=y CONFIG_TSL2540_TRIGGER_GLOBAL_THREAD=y CONFIG_TSL2591_TRIGGER_GLOBAL_THREAD=y CONFIG_VCNL4040_TRIGGER_GLOBAL_THREAD=y -CONFIG_WSEN_HIDS_TRIGGER_GLOBAL_THREAD=y CONFIG_WSEN_PADS_TRIGGER_GLOBAL_THREAD=y CONFIG_WSEN_TIDS_TRIGGER_GLOBAL_THREAD=y diff --git a/tests/drivers/build_all/sensor/sensors_trigger_none.conf b/tests/drivers/build_all/sensor/sensors_trigger_none.conf index 8db789f0ce344..2a0f41bf2d995 100644 --- a/tests/drivers/build_all/sensor/sensors_trigger_none.conf +++ b/tests/drivers/build_all/sensor/sensors_trigger_none.conf @@ -65,6 +65,5 @@ CONFIG_TMP007_TRIGGER_NONE=y CONFIG_TSL2540_TRIGGER_NONE=y CONFIG_TSL2591_TRIGGER_NONE=y CONFIG_VCNL4040_TRIGGER_NONE=y -CONFIG_WSEN_HIDS_TRIGGER_NONE=y CONFIG_WSEN_PADS_TRIGGER_NONE=y CONFIG_WSEN_TIDS_TRIGGER_NONE=y diff --git a/tests/drivers/build_all/sensor/sensors_trigger_own.conf b/tests/drivers/build_all/sensor/sensors_trigger_own.conf index 43b0d12a13751..6e343a5041950 100644 --- a/tests/drivers/build_all/sensor/sensors_trigger_own.conf +++ b/tests/drivers/build_all/sensor/sensors_trigger_own.conf @@ -61,6 +61,5 @@ CONFIG_TMP007_TRIGGER_OWN_THREAD=y CONFIG_TSL2540_TRIGGER_OWN_THREAD=y CONFIG_TSL2591_TRIGGER_OWN_THREAD=y CONFIG_VCNL4040_TRIGGER_OWN_THREAD=y -CONFIG_WSEN_HIDS_TRIGGER_OWN_THREAD=y CONFIG_WSEN_PADS_TRIGGER_OWN_THREAD=y CONFIG_WSEN_TIDS_TRIGGER_OWN_THREAD=y From 8c0b09ddc38b017057ed1eb3722c27454c367b4e Mon Sep 17 00:00:00 2001 From: Wajdi ELMuhtadi Date: Fri, 1 Sep 2023 11:34:04 +0200 Subject: [PATCH 0653/4482] drivers: sensor: wsen_pads: remove wsen_pads driver Remove wsen_pads since the hal update is no longer compatible with this version. Signed-off-by: Wajdi ELMuhtadi --- drivers/sensor/wsen/CMakeLists.txt | 1 - drivers/sensor/wsen/Kconfig | 1 - drivers/sensor/wsen/wsen_pads/CMakeLists.txt | 7 - drivers/sensor/wsen/wsen_pads/Kconfig | 55 ---- drivers/sensor/wsen/wsen_pads/wsen_pads.c | 273 ------------------ drivers/sensor/wsen/wsen_pads/wsen_pads.h | 82 ------ .../sensor/wsen/wsen_pads/wsen_pads_trigger.c | 183 ------------ dts/bindings/sensor/we,wsen-pads-common.yaml | 28 -- dts/bindings/sensor/we,wsen-pads-i2c.yaml | 9 - dts/bindings/sensor/we,wsen-pads-spi.yaml | 9 - tests/drivers/build_all/sensor/i2c.dtsi | 7 - .../sensor/sensors_trigger_global.conf | 1 - .../sensor/sensors_trigger_none.conf | 1 - .../build_all/sensor/sensors_trigger_own.conf | 1 - 14 files changed, 658 deletions(-) delete mode 100644 drivers/sensor/wsen/wsen_pads/CMakeLists.txt delete mode 100644 drivers/sensor/wsen/wsen_pads/Kconfig delete mode 100644 drivers/sensor/wsen/wsen_pads/wsen_pads.c delete mode 100644 drivers/sensor/wsen/wsen_pads/wsen_pads.h delete mode 100644 drivers/sensor/wsen/wsen_pads/wsen_pads_trigger.c delete mode 100644 dts/bindings/sensor/we,wsen-pads-common.yaml delete mode 100644 dts/bindings/sensor/we,wsen-pads-i2c.yaml delete mode 100644 dts/bindings/sensor/we,wsen-pads-spi.yaml diff --git a/drivers/sensor/wsen/CMakeLists.txt b/drivers/sensor/wsen/CMakeLists.txt index e3ce57897393a..af425b59742f3 100644 --- a/drivers/sensor/wsen/CMakeLists.txt +++ b/drivers/sensor/wsen/CMakeLists.txt @@ -2,7 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 # zephyr-keep-sorted-start -add_subdirectory_ifdef(CONFIG_WSEN_PADS wsen_pads) add_subdirectory_ifdef(CONFIG_WSEN_PDUS wsen_pdus) add_subdirectory_ifdef(CONFIG_WSEN_TIDS wsen_tids) # zephyr-keep-sorted-stop diff --git a/drivers/sensor/wsen/Kconfig b/drivers/sensor/wsen/Kconfig index a8b4fd6ddeb1c..f8c6091ac9927 100644 --- a/drivers/sensor/wsen/Kconfig +++ b/drivers/sensor/wsen/Kconfig @@ -2,7 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 # zephyr-keep-sorted-start -source "drivers/sensor/wsen/wsen_pads/Kconfig" source "drivers/sensor/wsen/wsen_pdus/Kconfig" source "drivers/sensor/wsen/wsen_tids/Kconfig" # zephyr-keep-sorted-stop diff --git a/drivers/sensor/wsen/wsen_pads/CMakeLists.txt b/drivers/sensor/wsen/wsen_pads/CMakeLists.txt deleted file mode 100644 index d14de10d075da..0000000000000 --- a/drivers/sensor/wsen/wsen_pads/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2023 Würth Elektronik eiSos GmbH & Co. KG -# SPDX-License-Identifier: Apache-2.0 - -zephyr_library() - -zephyr_library_sources(wsen_pads.c) -zephyr_library_sources_ifdef(CONFIG_WSEN_PADS_TRIGGER wsen_pads_trigger.c) diff --git a/drivers/sensor/wsen/wsen_pads/Kconfig b/drivers/sensor/wsen/wsen_pads/Kconfig deleted file mode 100644 index 906e471866b92..0000000000000 --- a/drivers/sensor/wsen/wsen_pads/Kconfig +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright (c) 2023 Würth Elektronik eiSos GmbH & Co. KG -# SPDX-License-Identifier: Apache-2.0 - -menuconfig WSEN_PADS - bool "WSEN-PADS absolute pressure and temperature sensor" - default y - depends on DT_HAS_WE_WSEN_PADS_ENABLED - select I2C if $(dt_compat_on_bus,$(DT_COMPAT_WE_WSEN_PADS),i2c) - select SPI if $(dt_compat_on_bus,$(DT_COMPAT_WE_WSEN_PADS),spi) - select HAS_WESENSORS - help - Enable driver for the WSEN-PADS I2C/SPI-based absolute pressure sensor with integrated - temperature sensor. - -if WSEN_PADS - -choice WSEN_PADS_TRIGGER_MODE - prompt "Trigger mode" - default WSEN_PADS_TRIGGER_NONE - help - Specify the type of triggering to be used by the driver. - -config WSEN_PADS_TRIGGER_NONE - bool "No trigger" - -config WSEN_PADS_TRIGGER_GLOBAL_THREAD - bool "Use global thread" - depends on GPIO - select WSEN_PADS_TRIGGER - -config WSEN_PADS_TRIGGER_OWN_THREAD - bool "Use own thread" - depends on GPIO - select WSEN_PADS_TRIGGER - -endchoice # WSEN_PADS_TRIGGER_MODE - -config WSEN_PADS_TRIGGER - bool - -config WSEN_PADS_THREAD_PRIORITY - int "Thread priority" - depends on WSEN_PADS_TRIGGER_OWN_THREAD - default 10 - help - Priority of thread used by the driver to handle interrupts. - -config WSEN_PADS_THREAD_STACK_SIZE - int "Thread stack size" - depends on WSEN_PADS_TRIGGER_OWN_THREAD - default 1024 - help - Stack size of thread used by the driver to handle interrupts. - -endif # WSEN_PADS diff --git a/drivers/sensor/wsen/wsen_pads/wsen_pads.c b/drivers/sensor/wsen/wsen_pads/wsen_pads.c deleted file mode 100644 index 4fd7ddb5d354c..0000000000000 --- a/drivers/sensor/wsen/wsen_pads/wsen_pads.c +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright (c) 2023 Würth Elektronik eiSos GmbH & Co. KG - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#define DT_DRV_COMPAT we_wsen_pads - -#include - -#include -#include -#include - -#include "wsen_pads.h" - -LOG_MODULE_REGISTER(WSEN_PADS, CONFIG_SENSOR_LOG_LEVEL); - -/* - * List of supported output data rates. Index into this list is used as - * argument for PADS_setOutputDataRate() - */ -static const int32_t pads_odr_list[] = { - 0, 1, 10, 25, 50, 75, 100, 200, -}; - -static int pads_sample_fetch(const struct device *dev, enum sensor_channel channel) -{ - struct pads_data *data = dev->data; - - __ASSERT_NO_MSG(channel == SENSOR_CHAN_ALL); - - if (PADS_getPressure_int(&data->sensor_interface, &data->pressure) != WE_SUCCESS) { - LOG_ERR("Failed to fetch %s sample.", "pressure"); - return -EIO; - } - - if (PADS_getTemperature_int(&data->sensor_interface, &data->temperature) != WE_SUCCESS) { - LOG_ERR("Failed to fetch %s sample.", "temperature"); - return -EIO; - } - - return 0; -} - -static int pads_channel_get(const struct device *dev, enum sensor_channel channel, - struct sensor_value *value) -{ - struct pads_data *data = dev->data; - int32_t value_converted; - - if (channel == SENSOR_CHAN_AMBIENT_TEMP) { - value_converted = (int32_t)data->temperature; - - /* Convert temperature from 0.01 degrees Celsius to degrees Celsius */ - value->val1 = value_converted / 100; - value->val2 = (value_converted % 100) * (1000000 / 100); - } else if (channel == SENSOR_CHAN_PRESS) { - value_converted = (int32_t)data->pressure; - - /* Convert pressure from Pa to kPa */ - value->val1 = value_converted / 1000; - value->val2 = (value_converted % 1000) * (1000000 / 1000); - } else { - return -ENOTSUP; - } - - return 0; -} - -/* Set output data rate. See pads_odr_list for allowed values. */ -static int pads_odr_set(const struct device *dev, const struct sensor_value *odr) -{ - struct pads_data *data = dev->data; - int odr_index; - - for (odr_index = 0; odr_index < ARRAY_SIZE(pads_odr_list); odr_index++) { - if (odr->val1 == pads_odr_list[odr_index] && odr->val2 == 0) { - break; - } - } - - if (odr_index == ARRAY_SIZE(pads_odr_list)) { - /* ODR not allowed (was not found in pads_odr_list) */ - LOG_ERR("Bad sampling frequency %d.%d", odr->val1, odr->val2); - return -EINVAL; - } - - if (PADS_setOutputDataRate(&data->sensor_interface, (PADS_outputDataRate_t)odr_index) != - WE_SUCCESS) { - LOG_ERR("Failed to set output data rate"); - return -EIO; - } - - return 0; -} - -static int pads_attr_set(const struct device *dev, enum sensor_channel chan, - enum sensor_attribute attr, const struct sensor_value *val) -{ - if (chan != SENSOR_CHAN_ALL) { - LOG_WRN("attr_set() is not supported on channel %d.", chan); - return -ENOTSUP; - } - - if (attr == SENSOR_ATTR_SAMPLING_FREQUENCY) { - return pads_odr_set(dev, val); - } else { - return -ENOTSUP; - } -} - -static const struct sensor_driver_api pads_driver_api = { - .attr_set = pads_attr_set, -#if CONFIG_WSEN_PADS_TRIGGER - .trigger_set = pads_trigger_set, -#endif - .sample_fetch = pads_sample_fetch, - .channel_get = pads_channel_get, -}; - -static int pads_init(const struct device *dev) -{ - const struct pads_config *config = dev->config; - struct pads_data *data = dev->data; - struct sensor_value odr; - int status; - uint8_t device_id; - - /* Initialize WE sensor interface */ - WE_sensorInterfaceType_t interface_type = data->sensor_interface.interfaceType; - - PADS_getDefaultInterface(&data->sensor_interface); - data->sensor_interface.interfaceType = interface_type; - - switch (data->sensor_interface.interfaceType) { -#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) - case WE_i2c: - data->sensor_interface.handle = (void *)&config->bus_cfg.i2c; - break; -#endif -#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) - case WE_spi: - data->sensor_interface.handle = (void *)&config->bus_cfg.spi; - break; -#endif - default: - LOG_ERR("Invalid interface type"); - return -EINVAL; - } - - /* First communication test - check device ID */ - if (PADS_getDeviceID(&data->sensor_interface, &device_id) != WE_SUCCESS) { - LOG_ERR("Failed to read device ID."); - return -EIO; - } - - if (device_id != PADS_DEVICE_ID_VALUE) { - LOG_ERR("Invalid device ID 0x%x.", device_id); - return -EINVAL; - } - - /* Reset sensor */ - PADS_softReset(&data->sensor_interface, PADS_enable); - - k_sleep(K_USEC(50)); - - PADS_state_t swReset; - - do { - if (PADS_getSoftResetState(&data->sensor_interface, &swReset) != WE_SUCCESS) { - LOG_ERR("Failed to get sensor reset state."); - return -EIO; - } - } while (PADS_enable == swReset); - - if (PADS_enableBlockDataUpdate(&data->sensor_interface, PADS_enable) != WE_SUCCESS) { - LOG_ERR("Failed to enable block data update."); - return -EIO; - } - -#if CONFIG_WSEN_PADS_TRIGGER - status = pads_init_interrupt(dev); - if (status < 0) { - LOG_ERR("Failed to initialize data-ready interrupt."); - return status; - } -#endif - - odr.val1 = pads_odr_list[config->odr]; - odr.val2 = 0; - status = pads_odr_set(dev, &odr); - if (status < 0) { - LOG_ERR("Failed to set output data rate."); - return status; - } - - return 0; -} - -#if DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 0 -#warning "PADS driver enabled without any devices" -#endif - -/* - * Device creation macros - */ - -#define PADS_DEVICE_INIT(inst) \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ - pads_init, \ - NULL, \ - &pads_data_##inst, \ - &pads_config_##inst, \ - POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ - &pads_driver_api); - -#ifdef CONFIG_WSEN_PADS_TRIGGER -#define PADS_CFG_IRQ(inst) .gpio_drdy = GPIO_DT_SPEC_INST_GET(inst, drdy_gpios) -#else -#define PADS_CFG_IRQ(inst) -#endif /* CONFIG_WSEN_PADS_TRIGGER */ - -#define PADS_CONFIG_COMMON(inst) \ - .odr = (PADS_outputDataRate_t)(DT_INST_ENUM_IDX(inst, odr)), \ - COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, drdy_gpios), \ - (PADS_CFG_IRQ(inst)), ()) - -/* - * Instantiation macros used when device is on SPI bus. - */ - -#define PADS_SPI_OPERATION (SPI_WORD_SET(8) | SPI_OP_MODE_MASTER | SPI_MODE_CPOL | SPI_MODE_CPHA) - -#define PADS_CONFIG_SPI(inst) \ - { \ - .bus_cfg = { \ - .spi = SPI_DT_SPEC_INST_GET(inst, \ - PADS_SPI_OPERATION, \ - 0), \ - }, \ - PADS_CONFIG_COMMON(inst) \ - } - -/* - * Instantiation macros used when device is on I2C bus. - */ - -#define PADS_CONFIG_I2C(inst) \ - { \ - .bus_cfg = { \ - .i2c = I2C_DT_SPEC_INST_GET(inst), \ - }, \ - PADS_CONFIG_COMMON(inst) \ - } - -/* - * Main instantiation macro. Use of COND_CODE_1() selects the right - * bus-specific macro at preprocessor time. - */ -#define PADS_DEFINE(inst) \ - static struct pads_data pads_data_##inst = \ - COND_CODE_1(DT_INST_ON_BUS(inst, i2c), \ - ({ .sensor_interface = { .interfaceType = WE_i2c } }), ()) \ - COND_CODE_1(DT_INST_ON_BUS(inst, spi), \ - ({ .sensor_interface = { .interfaceType = WE_spi } }), ()); \ - static const struct pads_config pads_config_##inst = \ - COND_CODE_1(DT_INST_ON_BUS(inst, i2c), (PADS_CONFIG_I2C(inst)), ()) \ - COND_CODE_1(DT_INST_ON_BUS(inst, spi), (PADS_CONFIG_SPI(inst)), ()); \ - PADS_DEVICE_INIT(inst) - -DT_INST_FOREACH_STATUS_OKAY(PADS_DEFINE) diff --git a/drivers/sensor/wsen/wsen_pads/wsen_pads.h b/drivers/sensor/wsen/wsen_pads/wsen_pads.h deleted file mode 100644 index e6d78ba81e854..0000000000000 --- a/drivers/sensor/wsen/wsen_pads/wsen_pads.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2023 Würth Elektronik eiSos GmbH & Co. KG - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_DRIVERS_SENSOR_WSEN_PADS_WSEN_PADS_H_ -#define ZEPHYR_DRIVERS_SENSOR_WSEN_PADS_WSEN_PADS_H_ - -#include -#include - -#include - -#include "WSEN_PADS_2511020213301.h" - -#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) -#include -#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */ - -#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) -#include -#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */ - -struct pads_data { - /* WE sensor interface configuration */ - WE_sensorInterface_t sensor_interface; - - /* Last pressure sample */ - int32_t pressure; - - /* Last temperature sample */ - int16_t temperature; - -#ifdef CONFIG_WSEN_PADS_TRIGGER - const struct device *dev; - - struct gpio_callback data_ready_cb; - - const struct sensor_trigger *data_ready_triggerP; - sensor_trigger_handler_t data_ready_handler; - -#if defined(CONFIG_WSEN_PADS_TRIGGER_OWN_THREAD) - K_KERNEL_STACK_MEMBER(thread_stack, CONFIG_WSEN_PADS_THREAD_STACK_SIZE); - struct k_thread thread; - struct k_sem drdy_sem; -#elif defined(CONFIG_WSEN_PADS_TRIGGER_GLOBAL_THREAD) - struct k_work work; -#endif -#endif /* CONFIG_WSEN_PADS_TRIGGER */ -}; - -struct pads_config { - union { -#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) - const struct i2c_dt_spec i2c; -#endif -#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) - const struct spi_dt_spec spi; -#endif - } bus_cfg; - - /* Output data rate */ - const PADS_outputDataRate_t odr; - -#ifdef CONFIG_WSEN_PADS_TRIGGER - /* Interrupt pin used for data-ready */ - const struct gpio_dt_spec gpio_drdy; -#endif /* CONFIG_WSEN_PADS_TRIGGER */ -}; - -#ifdef CONFIG_WSEN_PADS_TRIGGER -int pads_trigger_set(const struct device *dev, const struct sensor_trigger *trig, - sensor_trigger_handler_t handler); - -int pads_init_interrupt(const struct device *dev); -#endif /* CONFIG_WSEN_PADS_TRIGGER */ - -int pads_spi_init(const struct device *dev); -int pads_i2c_init(const struct device *dev); - -#endif /* ZEPHYR_DRIVERS_SENSOR_WSEN_PADS_WSEN_PADS_H_ */ diff --git a/drivers/sensor/wsen/wsen_pads/wsen_pads_trigger.c b/drivers/sensor/wsen/wsen_pads/wsen_pads_trigger.c deleted file mode 100644 index 6655847ec0322..0000000000000 --- a/drivers/sensor/wsen/wsen_pads/wsen_pads_trigger.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 2023 Würth Elektronik eiSos GmbH & Co. KG - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#define DT_DRV_COMPAT we_wsen_pads - -#include - -#include "wsen_pads.h" - -LOG_MODULE_DECLARE(WSEN_PADS, CONFIG_SENSOR_LOG_LEVEL); - -/* Enable/disable data-ready interrupt handling */ -static inline int pads_setup_drdy_interrupt(const struct device *dev, bool enable) -{ - const struct pads_config *cfg = dev->config; - unsigned int flags = enable ? GPIO_INT_EDGE_TO_ACTIVE : GPIO_INT_DISABLE; - - return gpio_pin_interrupt_configure_dt(&cfg->gpio_drdy, flags); -} - -/* - * Is called when a data-ready interrupt has occurred. Triggers - * asynchronous processing of the interrupt in pads_process_drdy_interrupt(). - */ -static inline void pads_handle_drdy_interrupt(const struct device *dev) -{ - struct pads_data *data = dev->data; - - /* Disable interrupt handling until the interrupt has been processed */ - pads_setup_drdy_interrupt(dev, false); - -#if defined(CONFIG_WSEN_PADS_TRIGGER_OWN_THREAD) - k_sem_give(&data->drdy_sem); -#elif defined(CONFIG_WSEN_PADS_TRIGGER_GLOBAL_THREAD) - k_work_submit(&data->work); -#endif -} - -/* Calls data-ready trigger handler (if any) */ -static void pads_process_drdy_interrupt(const struct device *dev) -{ - struct pads_data *data = dev->data; - - if (data->data_ready_handler != NULL) { - data->data_ready_handler(dev, data->data_ready_triggerP); - pads_setup_drdy_interrupt(dev, true); - } -} - -int pads_trigger_set(const struct device *dev, const struct sensor_trigger *trig, - sensor_trigger_handler_t handler) -{ - struct pads_data *data = dev->data; - const struct pads_config *cfg = dev->config; - int32_t pressure_dummy; - - if (trig->type != SENSOR_TRIG_DATA_READY) { - LOG_ERR("Unsupported sensor trigger"); - return -ENOTSUP; - } - - pads_setup_drdy_interrupt(dev, false); - - data->data_ready_handler = handler; - if (handler == NULL) { - /* Disable data-ready interrupt */ - if (PADS_enableDataReadyInterrupt(&data->sensor_interface, PADS_disable) != - WE_SUCCESS) { - LOG_ERR("Failed to disable data-ready interrupt."); - return -EIO; - } - return 0; - } - - data->data_ready_triggerP = trig; - - pads_setup_drdy_interrupt(dev, true); - - /* Read pressure to retrigger interrupt */ - if (PADS_getPressure_int(&data->sensor_interface, &pressure_dummy) != WE_SUCCESS) { - LOG_ERR("Failed to read sample"); - return -EIO; - } - - /* Enable data-ready interrupt */ - if (PADS_enableDataReadyInterrupt(&data->sensor_interface, PADS_enable) != WE_SUCCESS) { - LOG_ERR("Failed to enable data-ready interrupt."); - return -EIO; - } - - /* - * If data-ready is active we probably won't get the rising edge, so - * invoke the handler manually. - */ - if (gpio_pin_get_dt(&cfg->gpio_drdy) > 0) { - pads_handle_drdy_interrupt(dev); - } - - return 0; -} - -static void pads_drdy_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins) -{ - struct pads_data *data = CONTAINER_OF(cb, struct pads_data, data_ready_cb); - - ARG_UNUSED(pins); - - pads_handle_drdy_interrupt(data->dev); -} - -#ifdef CONFIG_WSEN_PADS_TRIGGER_OWN_THREAD -static void pads_thread(void *p1, void *p2, void *p3) -{ - ARG_UNUSED(p2); - ARG_UNUSED(p3); - - struct pads_data *data = p1; - - while (true) { - k_sem_take(&data->drdy_sem, K_FOREVER); - pads_process_drdy_interrupt(data->dev); - } -} -#endif /* CONFIG_WSEN_PADS_TRIGGER_OWN_THREAD */ - -#ifdef CONFIG_WSEN_PADS_TRIGGER_GLOBAL_THREAD -static void pads_work_cb(struct k_work *work) -{ - struct pads_data *data = CONTAINER_OF(work, struct pads_data, work); - - pads_process_drdy_interrupt(data->dev); -} -#endif /* CONFIG_WSEN_PADS_TRIGGER_GLOBAL_THREAD */ - -int pads_init_interrupt(const struct device *dev) -{ - struct pads_data *data = dev->data; - const struct pads_config *cfg = dev->config; - int status; - - data->dev = dev; - - if (cfg->gpio_drdy.port == NULL) { - LOG_ERR("drdy-gpios is not defined in the device tree."); - return -EINVAL; - } - - if (!gpio_is_ready_dt(&cfg->gpio_drdy)) { - LOG_ERR("Device %s is not ready", cfg->gpio_drdy.port->name); - return -ENODEV; - } - - /* Setup data-ready gpio interrupt */ - status = gpio_pin_configure_dt(&cfg->gpio_drdy, GPIO_INPUT); - if (status < 0) { - LOG_ERR("Failed to configure %s.%02u", cfg->gpio_drdy.port->name, - cfg->gpio_drdy.pin); - return status; - } - - gpio_init_callback(&data->data_ready_cb, pads_drdy_callback, BIT(cfg->gpio_drdy.pin)); - - status = gpio_add_callback(cfg->gpio_drdy.port, &data->data_ready_cb); - if (status < 0) { - LOG_ERR("Failed to set gpio callback."); - return status; - } - -#if defined(CONFIG_WSEN_PADS_TRIGGER_OWN_THREAD) - k_sem_init(&data->drdy_sem, 0, K_SEM_MAX_LIMIT); - - k_thread_create(&data->thread, data->thread_stack, CONFIG_WSEN_PADS_THREAD_STACK_SIZE, - pads_thread, data, NULL, NULL, - K_PRIO_COOP(CONFIG_WSEN_PADS_THREAD_PRIORITY), 0, K_NO_WAIT); -#elif defined(CONFIG_WSEN_PADS_TRIGGER_GLOBAL_THREAD) - data->work.handler = pads_work_cb; -#endif - - return pads_setup_drdy_interrupt(dev, true); -} diff --git a/dts/bindings/sensor/we,wsen-pads-common.yaml b/dts/bindings/sensor/we,wsen-pads-common.yaml deleted file mode 100644 index 31b0dedd45cd6..0000000000000 --- a/dts/bindings/sensor/we,wsen-pads-common.yaml +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (c) 2023 Würth Elektronik eiSos GmbH & Co. KG -# SPDX-License-Identifier: Apache-2.0 - -include: sensor-device.yaml - -properties: - drdy-gpios: - type: phandle-array - description: | - Data-ready interrupt pin. - Interrupt is active high by default. - - odr: - type: int - required: true - enum: - - 0 - - 1 - - 10 - - 25 - - 50 - - 75 - - 100 - - 200 - description: | - Sensor output data rate expressed in samples per second. - Data rates supported by the chip are 0 (power down), 1, - 10, 25, 50, 75, 100 and 200. diff --git a/dts/bindings/sensor/we,wsen-pads-i2c.yaml b/dts/bindings/sensor/we,wsen-pads-i2c.yaml deleted file mode 100644 index 108a2953d820a..0000000000000 --- a/dts/bindings/sensor/we,wsen-pads-i2c.yaml +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 Würth Elektronik eiSos GmbH & Co. KG -# SPDX-License-Identifier: Apache-2.0 - -description: | - Würth Elektronik WSEN-PADS absolute pressure sensor (I2C bus) - -compatible: "we,wsen-pads" - -include: ["i2c-device.yaml", "we,wsen-pads-common.yaml"] diff --git a/dts/bindings/sensor/we,wsen-pads-spi.yaml b/dts/bindings/sensor/we,wsen-pads-spi.yaml deleted file mode 100644 index e7b61f248fbb3..0000000000000 --- a/dts/bindings/sensor/we,wsen-pads-spi.yaml +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 Würth Elektronik eiSos GmbH & Co. KG -# SPDX-License-Identifier: Apache-2.0 - -description: | - Würth Elektronik WSEN-PADS absolute pressure sensor (SPI bus) - -compatible: "we,wsen-pads" - -include: ["spi-device.yaml", "we,wsen-pads-common.yaml"] diff --git a/tests/drivers/build_all/sensor/i2c.dtsi b/tests/drivers/build_all/sensor/i2c.dtsi index 9f5bcf2d710b1..47d0c721838fb 100644 --- a/tests/drivers/build_all/sensor/i2c.dtsi +++ b/tests/drivers/build_all/sensor/i2c.dtsi @@ -678,13 +678,6 @@ test_i2c_tmd2620: tmd2620@62 { wait-time-factor = <0>; }; -test_i2c_wsen_pads: wsen_pads@63 { - compatible = "we,wsen-pads"; - reg = <0x63>; - drdy-gpios = <&test_gpio 0 0>; - odr = <1>; -}; - test_i2c_s11059: s11059@64 { compatible = "hamamatsu,s11059"; reg = <0x64>; diff --git a/tests/drivers/build_all/sensor/sensors_trigger_global.conf b/tests/drivers/build_all/sensor/sensors_trigger_global.conf index e8611bbdd9639..d41945bfec02b 100644 --- a/tests/drivers/build_all/sensor/sensors_trigger_global.conf +++ b/tests/drivers/build_all/sensor/sensors_trigger_global.conf @@ -64,5 +64,4 @@ CONFIG_TMP007_TRIGGER_GLOBAL_THREAD=y CONFIG_TSL2540_TRIGGER_GLOBAL_THREAD=y CONFIG_TSL2591_TRIGGER_GLOBAL_THREAD=y CONFIG_VCNL4040_TRIGGER_GLOBAL_THREAD=y -CONFIG_WSEN_PADS_TRIGGER_GLOBAL_THREAD=y CONFIG_WSEN_TIDS_TRIGGER_GLOBAL_THREAD=y diff --git a/tests/drivers/build_all/sensor/sensors_trigger_none.conf b/tests/drivers/build_all/sensor/sensors_trigger_none.conf index 2a0f41bf2d995..c6d885dc49be5 100644 --- a/tests/drivers/build_all/sensor/sensors_trigger_none.conf +++ b/tests/drivers/build_all/sensor/sensors_trigger_none.conf @@ -65,5 +65,4 @@ CONFIG_TMP007_TRIGGER_NONE=y CONFIG_TSL2540_TRIGGER_NONE=y CONFIG_TSL2591_TRIGGER_NONE=y CONFIG_VCNL4040_TRIGGER_NONE=y -CONFIG_WSEN_PADS_TRIGGER_NONE=y CONFIG_WSEN_TIDS_TRIGGER_NONE=y diff --git a/tests/drivers/build_all/sensor/sensors_trigger_own.conf b/tests/drivers/build_all/sensor/sensors_trigger_own.conf index 6e343a5041950..f1b2f3f1b6468 100644 --- a/tests/drivers/build_all/sensor/sensors_trigger_own.conf +++ b/tests/drivers/build_all/sensor/sensors_trigger_own.conf @@ -61,5 +61,4 @@ CONFIG_TMP007_TRIGGER_OWN_THREAD=y CONFIG_TSL2540_TRIGGER_OWN_THREAD=y CONFIG_TSL2591_TRIGGER_OWN_THREAD=y CONFIG_VCNL4040_TRIGGER_OWN_THREAD=y -CONFIG_WSEN_PADS_TRIGGER_OWN_THREAD=y CONFIG_WSEN_TIDS_TRIGGER_OWN_THREAD=y From 8f684cfe9b752bbbad8d2579988955c2771a5388 Mon Sep 17 00:00:00 2001 From: Wajdi ELMuhtadi Date: Fri, 1 Sep 2023 11:35:12 +0200 Subject: [PATCH 0654/4482] drivers: sensor: wsen_pdus: remove wsen_pdus driver Remove wsen_pdus since the hal update is no longer compatible with this version. Signed-off-by: Wajdi ELMuhtadi --- drivers/sensor/wsen/CMakeLists.txt | 1 - drivers/sensor/wsen/Kconfig | 1 - drivers/sensor/wsen/wsen_pdus/CMakeLists.txt | 6 - drivers/sensor/wsen/wsen_pdus/Kconfig | 11 -- drivers/sensor/wsen/wsen_pdus/wsen_pdus.c | 111 ------------------- drivers/sensor/wsen/wsen_pdus/wsen_pdus.h | 44 -------- dts/bindings/sensor/we,wsen-pdus.yaml | 21 ---- tests/drivers/build_all/sensor/i2c.dtsi | 6 - 8 files changed, 201 deletions(-) delete mode 100644 drivers/sensor/wsen/wsen_pdus/CMakeLists.txt delete mode 100644 drivers/sensor/wsen/wsen_pdus/Kconfig delete mode 100644 drivers/sensor/wsen/wsen_pdus/wsen_pdus.c delete mode 100644 drivers/sensor/wsen/wsen_pdus/wsen_pdus.h delete mode 100644 dts/bindings/sensor/we,wsen-pdus.yaml diff --git a/drivers/sensor/wsen/CMakeLists.txt b/drivers/sensor/wsen/CMakeLists.txt index af425b59742f3..58d9868e47b93 100644 --- a/drivers/sensor/wsen/CMakeLists.txt +++ b/drivers/sensor/wsen/CMakeLists.txt @@ -2,6 +2,5 @@ # SPDX-License-Identifier: Apache-2.0 # zephyr-keep-sorted-start -add_subdirectory_ifdef(CONFIG_WSEN_PDUS wsen_pdus) add_subdirectory_ifdef(CONFIG_WSEN_TIDS wsen_tids) # zephyr-keep-sorted-stop diff --git a/drivers/sensor/wsen/Kconfig b/drivers/sensor/wsen/Kconfig index f8c6091ac9927..ac443e7311344 100644 --- a/drivers/sensor/wsen/Kconfig +++ b/drivers/sensor/wsen/Kconfig @@ -2,6 +2,5 @@ # SPDX-License-Identifier: Apache-2.0 # zephyr-keep-sorted-start -source "drivers/sensor/wsen/wsen_pdus/Kconfig" source "drivers/sensor/wsen/wsen_tids/Kconfig" # zephyr-keep-sorted-stop diff --git a/drivers/sensor/wsen/wsen_pdus/CMakeLists.txt b/drivers/sensor/wsen/wsen_pdus/CMakeLists.txt deleted file mode 100644 index ab0d66fb23a01..0000000000000 --- a/drivers/sensor/wsen/wsen_pdus/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2023 Würth Elektronik eiSos GmbH & Co. KG -# SPDX-License-Identifier: Apache-2.0 - -zephyr_library() - -zephyr_library_sources(wsen_pdus.c) diff --git a/drivers/sensor/wsen/wsen_pdus/Kconfig b/drivers/sensor/wsen/wsen_pdus/Kconfig deleted file mode 100644 index a43cbe41144aa..0000000000000 --- a/drivers/sensor/wsen/wsen_pdus/Kconfig +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2023 Würth Elektronik eiSos GmbH & Co. KG -# SPDX-License-Identifier: Apache-2.0 - -config WSEN_PDUS - bool "WSEN-PDUS differential pressure sensor" - default y - depends on DT_HAS_WE_WSEN_PDUS_ENABLED - select I2C if $(dt_compat_on_bus,$(DT_COMPAT_WE_WSEN_PDUS),i2c) - select HAS_WESENSORS - help - Enable driver for the WSEN-PDUS I2C-based differential pressure sensor. diff --git a/drivers/sensor/wsen/wsen_pdus/wsen_pdus.c b/drivers/sensor/wsen/wsen_pdus/wsen_pdus.c deleted file mode 100644 index 70e319602d048..0000000000000 --- a/drivers/sensor/wsen/wsen_pdus/wsen_pdus.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2023 Würth Elektronik eiSos GmbH & Co. KG - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#define DT_DRV_COMPAT we_wsen_pdus - -#include - -#include -#include -#include - -#include "wsen_pdus.h" - -LOG_MODULE_REGISTER(WSEN_PDUS, CONFIG_SENSOR_LOG_LEVEL); - -static int pdus_sample_fetch(const struct device *dev, enum sensor_channel chan) -{ - const struct pdus_config *const config = dev->config; - struct pdus_data *data = dev->data; - float pressure; - float temperature; - - __ASSERT_NO_MSG(chan == SENSOR_CHAN_ALL); - - if (PDUS_getPressureAndTemperature_float(&data->sensor_interface, - config->sensor_type, &pressure, - &temperature) != WE_SUCCESS) { - LOG_ERR("Failed to fetch data sample"); - return -EIO; - } - - data->pressure_k_pa = pressure; - data->temperature_deg_c = temperature; - - return 0; -} - -static int pdus_channel_get(const struct device *dev, enum sensor_channel chan, - struct sensor_value *value) -{ - struct pdus_data *data = dev->data; - - if (chan == SENSOR_CHAN_PRESS) { - value->val1 = (int32_t)data->pressure_k_pa; - value->val2 = (((int32_t)(data->pressure_k_pa * 1000)) % 1000) * 1000; - } else if (chan == SENSOR_CHAN_AMBIENT_TEMP) { - value->val1 = (int32_t)data->temperature_deg_c; - value->val2 = - (((int32_t)(data->temperature_deg_c * 1000)) % 1000) * 1000; - } else { - return -ENOTSUP; - } - - return 0; -} - -static const struct sensor_driver_api pdus_driver_api = { .sample_fetch = pdus_sample_fetch, - .channel_get = pdus_channel_get }; - -static int pdus_init(const struct device *dev) -{ - const struct pdus_config *const config = dev->config; - struct pdus_data *data = dev->data; - - /* Initialize WE sensor interface */ - PDUS_getDefaultInterface(&data->sensor_interface); - data->sensor_interface.interfaceType = WE_i2c; - - switch (data->sensor_interface.interfaceType) { -#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) - case WE_i2c: - data->sensor_interface.handle = (void *)&config->bus_cfg.i2c; - break; -#endif - default: - LOG_ERR("Invalid interface type"); - return -EINVAL; - } - - return 0; -} - -#if DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 0 -#warning "PDUS driver enabled without any devices" -#endif - -/* - * Main instantiation macro. - */ -#define PDUS_DEFINE(inst) \ - static struct pdus_data pdus_data_##inst; \ - static const struct pdus_config pdus_config_##inst = \ - { \ - .bus_cfg = { \ - .i2c = I2C_DT_SPEC_INST_GET(inst), \ - }, \ - .sensor_type = (PDUS_SensorType_t) DT_INST_ENUM_IDX(inst, sensor_type) \ - }; \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ - pdus_init, \ - NULL, \ - &pdus_data_##inst, \ - &pdus_config_##inst, \ - POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ - &pdus_driver_api); - -DT_INST_FOREACH_STATUS_OKAY(PDUS_DEFINE) diff --git a/drivers/sensor/wsen/wsen_pdus/wsen_pdus.h b/drivers/sensor/wsen/wsen_pdus/wsen_pdus.h deleted file mode 100644 index 6fb9f1f059522..0000000000000 --- a/drivers/sensor/wsen/wsen_pdus/wsen_pdus.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2023 Würth Elektronik eiSos GmbH & Co. KG - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_DRIVERS_SENSOR_WSEN_PDUS_WSEN_PDUS_H_ -#define ZEPHYR_DRIVERS_SENSOR_WSEN_PDUS_WSEN_PDUS_H_ - -#include -#include - -#include - -#include "WSEN_PDUS_25131308XXX01.h" - -#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) -#include -#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */ - -struct pdus_data { - /* WE sensor interface configuration */ - WE_sensorInterface_t sensor_interface; - - /* Last pressure sample */ - float pressure_k_pa; - - /* Last temperature sample */ - float temperature_deg_c; -}; - -struct pdus_config { - union { -#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) - const struct i2c_dt_spec i2c; -#endif - } bus_cfg; - - PDUS_SensorType_t sensor_type; -}; - -int pdus_i2c_init(const struct device *dev); - -#endif /* ZEPHYR_DRIVERS_SENSOR_WSEN_PDUS_WSEN_PDUS_H_ */ diff --git a/dts/bindings/sensor/we,wsen-pdus.yaml b/dts/bindings/sensor/we,wsen-pdus.yaml deleted file mode 100644 index 526f1fa450f3a..0000000000000 --- a/dts/bindings/sensor/we,wsen-pdus.yaml +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2023 Würth Elektronik eiSos GmbH & Co. KG -# SPDX-License-Identifier: Apache-2.0 - -description: | - Würth Elektronik WSEN-PDUS differential pressure sensor - -compatible: "we,wsen-pdus" - -include: [sensor-device.yaml, i2c-device.yaml] - -properties: - sensor-type: - type: int - required: true - enum: - - 0 # order code 2513130810001, range = -0.1 to +0.1 kPa - - 1 # order code 2513130810101, range = -1 to +1 kPa - - 2 # order code 2513130810201, range = -10 to +10 kPa - - 3 # order code 2513130810301, range = 0 to 100 kPa - - 4 # order code 2513130810401, range = -100 to +1000 kPa - description: PDUS sensor product variant (pressure measurement range). diff --git a/tests/drivers/build_all/sensor/i2c.dtsi b/tests/drivers/build_all/sensor/i2c.dtsi index 47d0c721838fb..75897dcfdbab4 100644 --- a/tests/drivers/build_all/sensor/i2c.dtsi +++ b/tests/drivers/build_all/sensor/i2c.dtsi @@ -684,12 +684,6 @@ test_i2c_s11059: s11059@64 { integration-time = <546000>; }; -test_i2c_wsen_pdus: wsen_pdus@65 { - compatible = "we,wsen-pdus"; - reg = <0x65>; - sensor-type = <3>; -}; - test_i2c_veml7700: veml7700@66 { compatible = "vishay,veml7700"; reg = <0x66>; From 9af50a7b19f11abdaa2e59f80ab9347afe517d31 Mon Sep 17 00:00:00 2001 From: Wajdi ELMuhtadi Date: Fri, 1 Sep 2023 11:35:50 +0200 Subject: [PATCH 0655/4482] drivers: sensor: wsen_tids: remove wsen_tids driver Remove wsen_tids since the hal update is no longer compatible with this version. Signed-off-by: Wajdi ELMuhtadi --- drivers/sensor/wsen/CMakeLists.txt | 1 - drivers/sensor/wsen/Kconfig | 1 - drivers/sensor/wsen/wsen_tids/CMakeLists.txt | 7 - drivers/sensor/wsen/wsen_tids/Kconfig | 53 ---- drivers/sensor/wsen/wsen_tids/wsen_tids.c | 229 ----------------- drivers/sensor/wsen/wsen_tids/wsen_tids.h | 77 ------ .../sensor/wsen/wsen_tids/wsen_tids_trigger.c | 243 ------------------ dts/bindings/sensor/we,wsen-tids.yaml | 37 --- tests/drivers/build_all/sensor/i2c.dtsi | 9 - .../sensor/sensors_trigger_global.conf | 1 - .../sensor/sensors_trigger_none.conf | 1 - .../build_all/sensor/sensors_trigger_own.conf | 1 - 12 files changed, 660 deletions(-) delete mode 100644 drivers/sensor/wsen/wsen_tids/CMakeLists.txt delete mode 100644 drivers/sensor/wsen/wsen_tids/Kconfig delete mode 100644 drivers/sensor/wsen/wsen_tids/wsen_tids.c delete mode 100644 drivers/sensor/wsen/wsen_tids/wsen_tids.h delete mode 100644 drivers/sensor/wsen/wsen_tids/wsen_tids_trigger.c delete mode 100644 dts/bindings/sensor/we,wsen-tids.yaml diff --git a/drivers/sensor/wsen/CMakeLists.txt b/drivers/sensor/wsen/CMakeLists.txt index 58d9868e47b93..eadffcbb2bfde 100644 --- a/drivers/sensor/wsen/CMakeLists.txt +++ b/drivers/sensor/wsen/CMakeLists.txt @@ -2,5 +2,4 @@ # SPDX-License-Identifier: Apache-2.0 # zephyr-keep-sorted-start -add_subdirectory_ifdef(CONFIG_WSEN_TIDS wsen_tids) # zephyr-keep-sorted-stop diff --git a/drivers/sensor/wsen/Kconfig b/drivers/sensor/wsen/Kconfig index ac443e7311344..eadffcbb2bfde 100644 --- a/drivers/sensor/wsen/Kconfig +++ b/drivers/sensor/wsen/Kconfig @@ -2,5 +2,4 @@ # SPDX-License-Identifier: Apache-2.0 # zephyr-keep-sorted-start -source "drivers/sensor/wsen/wsen_tids/Kconfig" # zephyr-keep-sorted-stop diff --git a/drivers/sensor/wsen/wsen_tids/CMakeLists.txt b/drivers/sensor/wsen/wsen_tids/CMakeLists.txt deleted file mode 100644 index 52019917bd484..0000000000000 --- a/drivers/sensor/wsen/wsen_tids/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2022 Würth Elektronik eiSos GmbH & Co. KG -# SPDX-License-Identifier: Apache-2.0 - -zephyr_library() - -zephyr_library_sources(wsen_tids.c) -zephyr_library_sources_ifdef(CONFIG_WSEN_TIDS_TRIGGER wsen_tids_trigger.c) diff --git a/drivers/sensor/wsen/wsen_tids/Kconfig b/drivers/sensor/wsen/wsen_tids/Kconfig deleted file mode 100644 index 764352fb7bcc2..0000000000000 --- a/drivers/sensor/wsen/wsen_tids/Kconfig +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (c) 2022 Würth Elektronik eiSos GmbH & Co. KG -# SPDX-License-Identifier: Apache-2.0 - -menuconfig WSEN_TIDS - bool "WSEN-TIDS temperature sensor" - default y - depends on DT_HAS_WE_WSEN_TIDS_ENABLED - select I2C if $(dt_compat_on_bus,$(DT_COMPAT_WE_WSEN_TIDS),i2c) - select HAS_WESENSORS - help - Enable driver for the WSEN-TIDS I2C-based temperature sensor. - -if WSEN_TIDS - -choice WSEN_TIDS_TRIGGER_MODE - prompt "Trigger mode" - default WSEN_TIDS_TRIGGER_NONE - help - Specify the type of triggering to be used by the driver. - -config WSEN_TIDS_TRIGGER_NONE - bool "No trigger" - -config WSEN_TIDS_TRIGGER_GLOBAL_THREAD - bool "Use global thread" - depends on GPIO - select WSEN_TIDS_TRIGGER - -config WSEN_TIDS_TRIGGER_OWN_THREAD - bool "Use own thread" - depends on GPIO - select WSEN_TIDS_TRIGGER - -endchoice # WSEN_TIDS_TRIGGER_MODE - -config WSEN_TIDS_TRIGGER - bool - -config WSEN_TIDS_THREAD_PRIORITY - int "Thread priority" - depends on WSEN_TIDS_TRIGGER_OWN_THREAD - default 10 - help - Priority of thread used by the driver to handle interrupts. - -config WSEN_TIDS_THREAD_STACK_SIZE - int "Thread stack size" - depends on WSEN_TIDS_TRIGGER_OWN_THREAD - default 1024 - help - Stack size of thread used by the driver to handle interrupts. - -endif # WSEN_TIDS diff --git a/drivers/sensor/wsen/wsen_tids/wsen_tids.c b/drivers/sensor/wsen/wsen_tids/wsen_tids.c deleted file mode 100644 index ad397706e7416..0000000000000 --- a/drivers/sensor/wsen/wsen_tids/wsen_tids.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (c) 2022 Würth Elektronik eiSos GmbH & Co. KG - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#define DT_DRV_COMPAT we_wsen_tids - -#include - -#include -#include -#include - -#include "wsen_tids.h" - -LOG_MODULE_REGISTER(WSEN_TIDS, CONFIG_SENSOR_LOG_LEVEL); - -/* - * List of supported output data rates. Index into this list is used as - * argument for TIDS_setOutputDataRate() - */ -static const int32_t tids_odr_list[] = { - 25, - 50, - 100, - 200, -}; - -static int tids_sample_fetch(const struct device *dev, enum sensor_channel chan) -{ - struct tids_data *data = dev->data; - int16_t raw_temperature; - - if ((chan != SENSOR_CHAN_ALL) && (chan != SENSOR_CHAN_AMBIENT_TEMP)) { - LOG_ERR("Fetching is not supported on channel %d.", chan); - return -EINVAL; - } - - if (TIDS_getRawTemperature(&data->sensor_interface, &raw_temperature) != WE_SUCCESS) { - LOG_ERR("Failed to fetch data sample"); - return -EIO; - } - - data->temperature = raw_temperature; - - return 0; -} - -static int tids_channel_get(const struct device *dev, enum sensor_channel chan, - struct sensor_value *val) -{ - struct tids_data *data = dev->data; - - if (chan == SENSOR_CHAN_AMBIENT_TEMP) { - /* Convert temperature from 0.01 degrees Celsius to degrees Celsius */ - val->val1 = data->temperature / 100; - val->val2 = ((int32_t)data->temperature % 100) * (1000000 / 100); - } else { - return -ENOTSUP; - } - - return 0; -} - -/* Set output data rate. See tids_odr_list for allowed values. */ -static int tids_odr_set(const struct device *dev, const struct sensor_value *odr) -{ - struct tids_data *data = dev->data; - int odr_index; - - for (odr_index = 0; odr_index < ARRAY_SIZE(tids_odr_list); odr_index++) { - if (odr->val1 == tids_odr_list[odr_index] && odr->val2 == 0) { - break; - } - } - - if (odr_index == ARRAY_SIZE(tids_odr_list)) { - /* ODR not allowed (was not found in tids_odr_list) */ - LOG_ERR("Bad sampling frequency %d.%d", odr->val1, abs(odr->val2)); - return -EINVAL; - } - - if (TIDS_setOutputDataRate(&data->sensor_interface, (TIDS_outputDataRate_t)odr_index) != - WE_SUCCESS) { - LOG_ERR("Failed to set output data rate"); - return -EIO; - } - - return 0; -} - -static int tids_attr_set(const struct device *dev, enum sensor_channel chan, - enum sensor_attribute attr, const struct sensor_value *val) -{ - if (chan != SENSOR_CHAN_ALL) { - LOG_WRN("attr_set() is not supported on channel %d.", chan); - return -ENOTSUP; - } - - switch (attr) { - case SENSOR_ATTR_SAMPLING_FREQUENCY: - return tids_odr_set(dev, val); - -#ifdef CONFIG_WSEN_TIDS_TRIGGER - case SENSOR_ATTR_LOWER_THRESH: - return tids_threshold_set(dev, val, false); - - case SENSOR_ATTR_UPPER_THRESH: - return tids_threshold_set(dev, val, true); -#endif /* CONFIG_WSEN_TIDS_TRIGGER */ - - default: - LOG_ERR("Operation not supported."); - return -ENOTSUP; - } -} - -static const struct sensor_driver_api tids_driver_api = { - .attr_set = tids_attr_set, -#if CONFIG_WSEN_TIDS_TRIGGER - .trigger_set = tids_trigger_set, -#endif - .sample_fetch = tids_sample_fetch, - .channel_get = tids_channel_get, -}; - -static int tids_init(const struct device *dev) -{ - const struct tids_config *const config = dev->config; - struct tids_data *data = dev->data; - int status; - uint8_t device_id; - struct sensor_value odr; - - /* Initialize WE sensor interface */ - TIDS_getDefaultInterface(&data->sensor_interface); - data->sensor_interface.interfaceType = WE_i2c; - data->sensor_interface.handle = (void *)&config->bus_cfg.i2c; - - /* First communication test - check device ID */ - if (TIDS_getDeviceID(&data->sensor_interface, &device_id) != WE_SUCCESS) { - LOG_ERR("Failed to read device ID."); - return -EIO; - } - - if (device_id != TIDS_DEVICE_ID_VALUE) { - LOG_ERR("Invalid device ID 0x%x.", device_id); - return -EIO; - } - - /* Reset the sensor with an arbitrary off time of 5 us */ - TIDS_softReset(&data->sensor_interface, TIDS_enable); - k_sleep(K_USEC(5)); - TIDS_softReset(&data->sensor_interface, TIDS_disable); - - odr.val1 = tids_odr_list[config->odr]; - odr.val2 = 0; - status = tids_odr_set(dev, &odr); - if (status < 0) { - LOG_ERR("Failed to set output data rate."); - return status; - } - - if (TIDS_enableBlockDataUpdate(&data->sensor_interface, TIDS_enable) != WE_SUCCESS) { - LOG_ERR("Failed to enable block data update."); - return -EIO; - } - - if (TIDS_enableContinuousMode(&data->sensor_interface, TIDS_enable) != WE_SUCCESS) { - LOG_ERR("Failed to enable continuous mode."); - return -EIO; - } - -#ifdef CONFIG_WSEN_TIDS_TRIGGER - status = tids_init_interrupt(dev); - if (status < 0) { - LOG_ERR("Failed to initialize threshold interrupt."); - return status; - } -#endif - - return 0; -} - -#if DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 0 -#warning "TIDS driver enabled without any devices" -#endif - -/* - * Device creation macros - */ - -#define TIDS_DEVICE_INIT(inst) \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ - tids_init, \ - NULL, \ - &tids_data_##inst, \ - &tids_config_##inst, \ - POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ - &tids_driver_api); - -#ifdef CONFIG_WSEN_TIDS_TRIGGER -#define TIDS_CFG_IRQ(inst) \ - .gpio_threshold = GPIO_DT_SPEC_INST_GET(inst, int_gpios), \ - .high_threshold = DT_INST_PROP(inst, temp_high_threshold), \ - .low_threshold = DT_INST_PROP(inst, temp_low_threshold) -#else -#define TIDS_CFG_IRQ(inst) -#endif /* CONFIG_WSEN_TIDS_TRIGGER */ - -/* - * Main instantiation macro. - */ -#define TIDS_DEFINE(inst) \ - static struct tids_data tids_data_##inst; \ - static const struct tids_config tids_config_##inst = \ - { \ - .bus_cfg = { \ - .i2c = I2C_DT_SPEC_INST_GET(inst), \ - }, \ - .odr = (TIDS_outputDataRate_t)(DT_INST_ENUM_IDX(inst, odr)), \ - COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, int_gpios), \ - (TIDS_CFG_IRQ(inst)), ()) \ - }; \ - TIDS_DEVICE_INIT(inst) - -DT_INST_FOREACH_STATUS_OKAY(TIDS_DEFINE) diff --git a/drivers/sensor/wsen/wsen_tids/wsen_tids.h b/drivers/sensor/wsen/wsen_tids/wsen_tids.h deleted file mode 100644 index eae6c465ca25b..0000000000000 --- a/drivers/sensor/wsen/wsen_tids/wsen_tids.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2022 Würth Elektronik eiSos GmbH & Co. KG - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_DRIVERS_SENSOR_WSEN_TIDS_WSEN_TIDS_H_ -#define ZEPHYR_DRIVERS_SENSOR_WSEN_TIDS_WSEN_TIDS_H_ - -#include -#include - -#include - -#include "WSEN_TIDS_2521020222501.h" - -#include - -struct tids_data { - /* WE sensor interface configuration */ - WE_sensorInterface_t sensor_interface; - - /* Last temperature sample */ - int16_t temperature; - -#ifdef CONFIG_WSEN_TIDS_TRIGGER - const struct device *dev; - - /* Callback for high/low limit interrupts */ - struct gpio_callback threshold_cb; - - const struct sensor_trigger *threshold_trigger; - sensor_trigger_handler_t threshold_handler; - -#if defined(CONFIG_WSEN_TIDS_TRIGGER_OWN_THREAD) - K_KERNEL_STACK_MEMBER(thread_stack, CONFIG_WSEN_TIDS_THREAD_STACK_SIZE); - struct k_thread thread; - struct k_sem threshold_sem; -#elif defined(CONFIG_WSEN_TIDS_TRIGGER_GLOBAL_THREAD) - struct k_work work; -#endif -#endif /* CONFIG_WSEN_TIDS_TRIGGER */ -}; - -struct tids_config { - union { - const struct i2c_dt_spec i2c; - } bus_cfg; - - /* Output data rate */ - const TIDS_outputDataRate_t odr; - -#ifdef CONFIG_WSEN_TIDS_TRIGGER - /* Interrupt pin used for high and low limit interrupt events */ - const struct gpio_dt_spec gpio_threshold; - - /* High temperature interrupt threshold */ - const int high_threshold; - - /* Low temperature interrupt threshold */ - const int low_threshold; -#endif -}; - -#ifdef CONFIG_WSEN_TIDS_TRIGGER -int tids_trigger_set(const struct device *dev, const struct sensor_trigger *trig, - sensor_trigger_handler_t handler); - -int tids_threshold_set(const struct device *dev, const struct sensor_value *thresh_value, - bool upper); - -int tids_init_interrupt(const struct device *dev); -#endif - -int tids_i2c_init(const struct device *dev); - -#endif /* ZEPHYR_DRIVERS_SENSOR_WSEN_TIDS_WSEN_TIDS_H_ */ diff --git a/drivers/sensor/wsen/wsen_tids/wsen_tids_trigger.c b/drivers/sensor/wsen/wsen_tids/wsen_tids_trigger.c deleted file mode 100644 index d2ed4d91fefce..0000000000000 --- a/drivers/sensor/wsen/wsen_tids/wsen_tids_trigger.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright (c) 2022 Würth Elektronik eiSos GmbH & Co. KG - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#define DT_DRV_COMPAT we_wsen_tids - -#include - -#include - -#include "wsen_tids.h" - -LOG_MODULE_DECLARE(WSEN_TIDS, CONFIG_SENSOR_LOG_LEVEL); - -#define THRESHOLD_TEMPERATURE2REGISTER_OFFSET (double)63. -#define THRESHOLD_TEMPERATURE2REGISTER_STEP (double)0.64 - -/* Enable/disable threshold interrupt handling */ -static inline void tids_setup_threshold_interrupt(const struct device *dev, bool enable) -{ - const struct tids_config *cfg = dev->config; - unsigned int flags = enable ? GPIO_INT_EDGE_TO_ACTIVE : GPIO_INT_DISABLE; - - gpio_pin_interrupt_configure_dt(&cfg->gpio_threshold, flags); -} - -/* - * Is called when a "threshold exceeded" interrupt occurred. Triggers - * asynchronous processing of the interrupt in tids_process_threshold_interrupt(). - */ -static void tids_handle_threshold_interrupt(const struct device *dev) -{ - struct tids_data *data = dev->data; - - /* Disable interrupt handling until the interrupt has been processed */ - tids_setup_threshold_interrupt(dev, false); - -#if defined(CONFIG_WSEN_TIDS_TRIGGER_OWN_THREAD) - k_sem_give(&data->threshold_sem); -#elif defined(CONFIG_WSEN_TIDS_TRIGGER_GLOBAL_THREAD) - k_work_submit(&data->work); -#endif -} - -/* - * Is called after a "threshold exceeded" interrupt occurred. - * Checks the sensor's status register for the limit exceeded flags and - * calls the trigger handler if one of the flags is set. - */ -static void tids_process_threshold_interrupt(const struct device *dev) -{ - struct tids_data *data = dev->data; - TIDS_status_t status; - - /* - * Read the sensor's status register - this also causes the interrupt pin - * to be de-asserted - */ - if (TIDS_getStatusRegister(&data->sensor_interface, &status) != WE_SUCCESS) { - LOG_ERR("Failed to read status register"); - return; - } - - if (data->threshold_handler != NULL && - (status.upperLimitExceeded != 0 || status.lowerLimitExceeded != 0)) { - data->threshold_handler(dev, data->threshold_trigger); - } - - if (data->threshold_handler != NULL) { - tids_setup_threshold_interrupt(dev, true); - } -} - -/* Enables/disables processing of the "threshold exceeded" interrupt. */ -int tids_trigger_set(const struct device *dev, const struct sensor_trigger *trig, - sensor_trigger_handler_t handler) -{ - struct tids_data *data = dev->data; - const struct tids_config *cfg = dev->config; - - if (trig->type != SENSOR_TRIG_THRESHOLD) { - LOG_ERR("Unsupported sensor trigger"); - return -ENOTSUP; - } - - tids_setup_threshold_interrupt(dev, false); - - data->threshold_handler = handler; - if (handler == NULL) { - return 0; - } - - data->threshold_trigger = trig; - - tids_setup_threshold_interrupt(dev, true); - - /* - * If threshold interrupt is active we probably won't get the rising edge, so - * invoke the callback manually. - */ - if (gpio_pin_get_dt(&cfg->gpio_threshold) > 0) { - tids_handle_threshold_interrupt(dev); - } - - return 0; -} - -static void tids_threshold_callback(const struct device *dev, struct gpio_callback *cb, - uint32_t pins) -{ - struct tids_data *data = CONTAINER_OF(cb, struct tids_data, threshold_cb); - - ARG_UNUSED(pins); - - tids_handle_threshold_interrupt(data->dev); -} - -#ifdef CONFIG_WSEN_TIDS_TRIGGER_OWN_THREAD -static void tids_thread(void *p1, void *p2, void *p3) -{ - ARG_UNUSED(p2); - ARG_UNUSED(p3); - - struct tids_data *tids = p1; - - while (true) { - k_sem_take(&tids->threshold_sem, K_FOREVER); - tids_process_threshold_interrupt(tids->dev); - } -} -#endif /* CONFIG_WSEN_TIDS_TRIGGER_OWN_THREAD */ - -#ifdef CONFIG_WSEN_TIDS_TRIGGER_GLOBAL_THREAD -static void tids_work_cb(struct k_work *work) -{ - struct tids_data *tids = CONTAINER_OF(work, struct tids_data, work); - - tids_process_threshold_interrupt(tids->dev); -} -#endif /* CONFIG_WSEN_TIDS_TRIGGER_GLOBAL_THREAD */ - -int tids_threshold_set(const struct device *dev, const struct sensor_value *thresh_value, - bool upper) -{ - struct tids_data *data = dev->data; - double thresh = (sensor_value_to_double(thresh_value) / THRESHOLD_TEMPERATURE2REGISTER_STEP) - + THRESHOLD_TEMPERATURE2REGISTER_OFFSET; - - if (thresh < 0) { - thresh = 0; - } else if (thresh > 255) { - thresh = 255; - } - - if (upper) { - if (TIDS_setTempHighLimit(&data->sensor_interface, (uint8_t)thresh) != WE_SUCCESS) { - LOG_ERR("Failed to set high temperature threshold to %d.%d (%d).", - thresh_value->val1, abs(thresh_value->val2), (uint8_t)thresh); - return -EIO; - } - } else { - if (TIDS_setTempLowLimit(&data->sensor_interface, (uint8_t)thresh) != WE_SUCCESS) { - LOG_ERR("Failed to set low temperature threshold to %d.%d (%d).", - thresh_value->val1, abs(thresh_value->val2), (uint8_t)thresh); - return -EIO; - } - } - - return 0; -} - -int tids_init_interrupt(const struct device *dev) -{ - struct tids_data *data = dev->data; - const struct tids_config *cfg = dev->config; - int status; - struct sensor_value upper_limit; - struct sensor_value lower_limit; - - if (cfg->gpio_threshold.port == NULL) { - LOG_ERR("int-gpios is not defined in the device tree."); - return -EINVAL; - } - - if (!gpio_is_ready_dt(&cfg->gpio_threshold)) { - LOG_ERR("Device %s is not ready", cfg->gpio_threshold.port->name); - return -ENODEV; - } - - data->dev = dev; - - /* Setup threshold gpio interrupt */ - status = gpio_pin_configure_dt(&cfg->gpio_threshold, GPIO_INPUT); - if (status < 0) { - LOG_ERR("Failed to configure %s.%02u", cfg->gpio_threshold.port->name, - cfg->gpio_threshold.pin); - return status; - } - - gpio_init_callback(&data->threshold_cb, tids_threshold_callback, - BIT(cfg->gpio_threshold.pin)); - - status = gpio_add_callback(cfg->gpio_threshold.port, &data->threshold_cb); - if (status < 0) { - LOG_ERR("Failed to set gpio callback."); - return status; - } - - /* - * Enable interrupt on high/low temperature (interrupt generation is enabled if at - * least one threshold is non-zero) - */ - upper_limit.val1 = cfg->high_threshold; - upper_limit.val2 = 0; - lower_limit.val1 = cfg->low_threshold; - lower_limit.val2 = 0; - - status = tids_threshold_set(dev, &upper_limit, true); - if (status < 0) { - return status; - } - - status = tids_threshold_set(dev, &lower_limit, false); - if (status < 0) { - return status; - } - -#if defined(CONFIG_WSEN_TIDS_TRIGGER_OWN_THREAD) - k_sem_init(&data->threshold_sem, 0, K_SEM_MAX_LIMIT); - - k_thread_create(&data->thread, data->thread_stack, CONFIG_WSEN_TIDS_THREAD_STACK_SIZE, - tids_thread, data, NULL, NULL, - K_PRIO_COOP(CONFIG_WSEN_TIDS_THREAD_PRIORITY), 0, K_NO_WAIT); -#elif defined(CONFIG_WSEN_TIDS_TRIGGER_GLOBAL_THREAD) - data->work.handler = tids_work_cb; -#endif - - tids_setup_threshold_interrupt(dev, true); - - return 0; -} diff --git a/dts/bindings/sensor/we,wsen-tids.yaml b/dts/bindings/sensor/we,wsen-tids.yaml deleted file mode 100644 index 202ff994597bc..0000000000000 --- a/dts/bindings/sensor/we,wsen-tids.yaml +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (c) 2022 Würth Elektronik eiSos GmbH & Co. KG -# SPDX-License-Identifier: Apache-2.0 - -description: | - Würth Elektronik WSEN-TIDS temperature sensor - -compatible: "we,wsen-tids" - -include: [sensor-device.yaml, i2c-device.yaml] - -properties: - int-gpios: - type: phandle-array - description: Threshold interrupt pin. - Interrupt is active low by default. - - odr: - type: int - required: true - enum: - - 25 - - 50 - - 100 - - 200 - description: | - Sensor output data rate expressed in samples per second. - Data rates supported by the chip are 25, 50, 100 and 200. - - temp-high-threshold: - type: int - description: | - Threshold for temperature high limit interrupt event. - - temp-low-threshold: - type: int - description: | - Threshold for temperature low limit interrupt event. diff --git a/tests/drivers/build_all/sensor/i2c.dtsi b/tests/drivers/build_all/sensor/i2c.dtsi index 75897dcfdbab4..86b7173d5d133 100644 --- a/tests/drivers/build_all/sensor/i2c.dtsi +++ b/tests/drivers/build_all/sensor/i2c.dtsi @@ -648,15 +648,6 @@ test_i2c_akm09918c: akm09918c@5f { reg = <0x5f>; }; -test_i2c_wsen_tids: wsen_tids@60 { - compatible = "we,wsen-tids"; - reg = <0x60>; - int-gpios = <&test_gpio 0 0>; - odr = <25>; - temp-high-threshold = <0>; - temp-low-threshold = <0>; -}; - test_i2c_vl53l1x: vl53l1x@61 { compatible = "st,vl53l1x"; reg = <0x61>; diff --git a/tests/drivers/build_all/sensor/sensors_trigger_global.conf b/tests/drivers/build_all/sensor/sensors_trigger_global.conf index d41945bfec02b..992b755e761e5 100644 --- a/tests/drivers/build_all/sensor/sensors_trigger_global.conf +++ b/tests/drivers/build_all/sensor/sensors_trigger_global.conf @@ -64,4 +64,3 @@ CONFIG_TMP007_TRIGGER_GLOBAL_THREAD=y CONFIG_TSL2540_TRIGGER_GLOBAL_THREAD=y CONFIG_TSL2591_TRIGGER_GLOBAL_THREAD=y CONFIG_VCNL4040_TRIGGER_GLOBAL_THREAD=y -CONFIG_WSEN_TIDS_TRIGGER_GLOBAL_THREAD=y diff --git a/tests/drivers/build_all/sensor/sensors_trigger_none.conf b/tests/drivers/build_all/sensor/sensors_trigger_none.conf index c6d885dc49be5..7d0790e57b2dd 100644 --- a/tests/drivers/build_all/sensor/sensors_trigger_none.conf +++ b/tests/drivers/build_all/sensor/sensors_trigger_none.conf @@ -65,4 +65,3 @@ CONFIG_TMP007_TRIGGER_NONE=y CONFIG_TSL2540_TRIGGER_NONE=y CONFIG_TSL2591_TRIGGER_NONE=y CONFIG_VCNL4040_TRIGGER_NONE=y -CONFIG_WSEN_TIDS_TRIGGER_NONE=y diff --git a/tests/drivers/build_all/sensor/sensors_trigger_own.conf b/tests/drivers/build_all/sensor/sensors_trigger_own.conf index f1b2f3f1b6468..ddb66f8e891a9 100644 --- a/tests/drivers/build_all/sensor/sensors_trigger_own.conf +++ b/tests/drivers/build_all/sensor/sensors_trigger_own.conf @@ -61,4 +61,3 @@ CONFIG_TMP007_TRIGGER_OWN_THREAD=y CONFIG_TSL2540_TRIGGER_OWN_THREAD=y CONFIG_TSL2591_TRIGGER_OWN_THREAD=y CONFIG_VCNL4040_TRIGGER_OWN_THREAD=y -CONFIG_WSEN_TIDS_TRIGGER_OWN_THREAD=y From 523efee132cc333fc775f731e5cf588f85e14077 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Wed, 9 Oct 2024 13:45:39 +0100 Subject: [PATCH 0656/4482] tests: build_all: input: clean up the i2c device list Make the address sequential again, drop a stray blank line. Signed-off-by: Fabio Baltieri --- tests/drivers/build_all/input/app.overlay | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/drivers/build_all/input/app.overlay b/tests/drivers/build_all/input/app.overlay index 3873a6b14ac98..e8f2e38365284 100644 --- a/tests/drivers/build_all/input/app.overlay +++ b/tests/drivers/build_all/input/app.overlay @@ -253,22 +253,21 @@ irq-gpios = <&test_gpio 0 0>; }; - pinnacle@2a { + pinnacle@8 { compatible = "cirque,pinnacle"; - reg = <0x2a>; + reg = <0x8>; data-ready-gpios = <&test_gpio 0 0>; data-mode = "relative"; primary-tap-enable; swap-xy; }; - touch_dev: ili2132a@41 { + touch_dev: ili2132a@9 { compatible = "ilitek,ili2132a"; - reg = <0x41>; + reg = <0x9>; irq-gpios = <&test_gpio 0 0>; rst-gpios = <&test_gpio 1 0>; }; - }; spi@2 { From 32e5894ab955469cc32b973f3d01d3d879a147b7 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Wed, 9 Oct 2024 11:34:09 +0200 Subject: [PATCH 0657/4482] manifest: update picolibc to avoid setting of CMAKE_BUILD_TYPE This commit updates picolibc module so that CMAKE_BUILD_TYPE is not defined by picolibc when building with Zephyr. The avoids a situation where both picolibc and Zephyr defines the optimization level, for example like: `-Os -O2`. And remove the warning: > CMake Warning at .../zephyr/CMakeLists.txt:2166 (message): > > The CMake build type was set to 'MinSizeRel', but the optimization > flag was set to '-O2'. Signed-off-by: Torsten Rasmussen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index ad8589fce212b..2c51106858597 100644 --- a/west.yml +++ b/west.yml @@ -315,7 +315,7 @@ manifest: - debug - name: picolibc path: modules/lib/picolibc - revision: 27746bbc246841852912fc3bb5b45094cd8a505a + revision: d492d5fa7c96918e37653f303028346bb0dd51a2 - name: segger revision: b011c45b585e097d95d9cf93edf4f2e01588d3cd path: modules/debug/segger From 0d5f8e352439da441dfc81ddebe3b7df8ac89518 Mon Sep 17 00:00:00 2001 From: Alexandre Bailon Date: Wed, 9 Oct 2024 09:58:09 +0200 Subject: [PATCH 0658/4482] cmake: flash: Update OPENOCD variables to work with sysbuild Defining OPENOCD and OPENOCD_DEFAULT_PATH when we are using sysbuild doesn't make any effect. This updates flash.cmake to make these variables compatible with sysbuild. Signed-off-by: Alexandre Bailon --- cmake/flash/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/flash/CMakeLists.txt b/cmake/flash/CMakeLists.txt index f948b0597519f..8fe7380695bfd 100644 --- a/cmake/flash/CMakeLists.txt +++ b/cmake/flash/CMakeLists.txt @@ -61,6 +61,8 @@ function(runners_yaml_append_config) runners_yaml_append(" uf2_file: ${uf2}") endif() + zephyr_get(OPENOCD) + zephyr_get(OPENOCD_DEFAULT_PATH) if(CMAKE_GDB OR OPENOCD OR OPENOCD_DEFAULT_PATH) runners_yaml_append(" # Host tools:") endif() From 14c896b647f782982afcb438ae3392eca4daab36 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Fri, 4 Oct 2024 11:57:18 +0200 Subject: [PATCH 0659/4482] drivers: nrf_qspi_nor: Fix build without multithreading Fix build of nrf_qspi_nor flash driver without multithreading enabled. This is required for builds like mcuboot. Signed-off-by: Joakim Andersson --- drivers/flash/nrf_qspi_nor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/flash/nrf_qspi_nor.c b/drivers/flash/nrf_qspi_nor.c index 0c4faf99dff2b..44fcc6b76293f 100644 --- a/drivers/flash/nrf_qspi_nor.c +++ b/drivers/flash/nrf_qspi_nor.c @@ -487,7 +487,9 @@ static int qspi_wait_while_writing(const struct device *dev, k_timeout_t poll_pe int rc; do { +#ifdef CONFIG_MULTITHREADING k_sleep(poll_period); +#endif rc = qspi_rdsr(dev, 1); } while ((rc >= 0) && ((rc & SPI_NOR_WIP_BIT) != 0U)); From d794d58d64ce3fc3b3c1be0f9c0129d5150ab401 Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Fri, 4 Oct 2024 11:57:18 +0200 Subject: [PATCH 0660/4482] drivers: nrf_qspi_nor: Check poll period before sleep Check that the poll period is non-zero before sleeping. Signed-off-by: Joakim Andersson --- drivers/flash/nrf_qspi_nor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/flash/nrf_qspi_nor.c b/drivers/flash/nrf_qspi_nor.c index 44fcc6b76293f..73213a1ce301f 100644 --- a/drivers/flash/nrf_qspi_nor.c +++ b/drivers/flash/nrf_qspi_nor.c @@ -488,7 +488,9 @@ static int qspi_wait_while_writing(const struct device *dev, k_timeout_t poll_pe do { #ifdef CONFIG_MULTITHREADING - k_sleep(poll_period); + if (!K_TIMEOUT_EQ(poll_period, K_NO_WAIT)) { + k_sleep(poll_period); + } #endif rc = qspi_rdsr(dev, 1); } while ((rc >= 0) From 7fa5a222a0c2ba9aede19448d4561173436f052f Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Thu, 3 Oct 2024 22:12:03 +0200 Subject: [PATCH 0661/4482] drivers: flash: Sort CMake and Kconfig files alphabetically By sorting the lines alphabetically, merge conflicts can be reduced. Signed-off-by: Reto Schneider --- drivers/flash/CMakeLists.txt | 96 ++++++++++++++++++++---------------- drivers/flash/Kconfig | 87 ++++++++++---------------------- 2 files changed, 79 insertions(+), 104 deletions(-) diff --git a/drivers/flash/CMakeLists.txt b/drivers/flash/CMakeLists.txt index 64b9c149db39f..97d9cd5505939 100644 --- a/drivers/flash/CMakeLists.txt +++ b/drivers/flash/CMakeLists.txt @@ -16,10 +16,55 @@ zephyr_syscall_header(${ZEPHYR_BASE}/include/zephyr/drivers/flash.h) zephyr_library() +# zephyr-keep-sorted-start +zephyr_library_sources_ifdef(CONFIG_FLASH_JESD216 jesd216.c) +zephyr_library_sources_ifdef(CONFIG_FLASH_PAGE_LAYOUT flash_page_layout.c) +zephyr_library_sources_ifdef(CONFIG_FLASH_SHELL flash_shell.c) +zephyr_library_sources_ifdef(CONFIG_USERSPACE flash_handlers.c) +# zephyr-keep-sorted-stop + +# zephyr-keep-sorted-start +zephyr_library_sources_ifdef(CONFIG_FLASH_AMBIQ flash_ambiq.c) +zephyr_library_sources_ifdef(CONFIG_FLASH_ANDES_QSPI flash_andes_qspi.c) +zephyr_library_sources_ifdef(CONFIG_FLASH_CAD_QSPI_NOR flash_cadence_qspi_nor.c flash_cadence_qspi_nor_ll.c) +zephyr_library_sources_ifdef(CONFIG_FLASH_CDNS_NAND flash_cadence_nand.c flash_cadence_nand_ll.c) +zephyr_library_sources_ifdef(CONFIG_FLASH_INFINEON_CAT1 flash_ifx_cat1.c) +zephyr_library_sources_ifdef(CONFIG_FLASH_MCUX_FLEXSPI_HYPERFLASH flash_mcux_flexspi_hyperflash.c) +zephyr_library_sources_ifdef(CONFIG_FLASH_MCUX_FLEXSPI_MX25UM51345G flash_mcux_flexspi_mx25um51345g.c) +zephyr_library_sources_ifdef(CONFIG_FLASH_MCUX_FLEXSPI_NOR flash_mcux_flexspi_nor.c) +zephyr_library_sources_ifdef(CONFIG_FLASH_MSPI_ATXP032 flash_mspi_atxp032.c) +zephyr_library_sources_ifdef(CONFIG_FLASH_MSPI_EMUL_DEVICE flash_mspi_emul_device.c) +zephyr_library_sources_ifdef(CONFIG_FLASH_NPCX_FIU_NOR flash_npcx_fiu_nor.c) +zephyr_library_sources_ifdef(CONFIG_FLASH_NPCX_FIU_QSPI flash_npcx_fiu_qspi.c) +zephyr_library_sources_ifdef(CONFIG_FLASH_RPI_PICO flash_rpi_pico.c) +zephyr_library_sources_ifdef(CONFIG_FLASH_STM32_OSPI flash_stm32_ospi.c) +zephyr_library_sources_ifdef(CONFIG_FLASH_STM32_QSPI flash_stm32_qspi.c) +zephyr_library_sources_ifdef(CONFIG_FLASH_STM32_XSPI flash_stm32_xspi.c) +zephyr_library_sources_ifdef(CONFIG_INFINEON_CAT1_QSPI_FLASH flash_ifx_cat1_qspi.c) +zephyr_library_sources_ifdef(CONFIG_NORDIC_QSPI_NOR nrf_qspi_nor.c) zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_CC13XX_CC26XX soc_flash_cc13xx_cc26xx.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_ESP32 flash_esp32.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_GECKO flash_gecko.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_ITE_IT8XXX2 flash_ite_it8xxx2.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_LPC soc_flash_lpc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_MCUX soc_flash_mcux.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NIOS2_QSPI soc_flash_nios2_qspi.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NRF soc_flash_nrf.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NRF_MRAM soc_flash_nrf_mram.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NRF_RRAM soc_flash_nrf_rram.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NUMAKER soc_flash_numaker.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NUMAKER_RMC soc_flash_numaker_rmc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_RV32M1 soc_flash_rv32m1.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_SAM flash_sam.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_SAM0 flash_sam0.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_SI32 flash_si32.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_SMARTBOND flash_smartbond.c) zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_TELINK_B91 soc_flash_b91.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_XMC4XXX soc_flash_xmc4xxx.c) +zephyr_library_sources_ifdef(CONFIG_SPI_FLASH_AT45 spi_flash_at45.c) zephyr_library_sources_ifdef(CONFIG_SPI_NOR spi_nor.c) -zephyr_library_sources_ifdef(CONFIG_NORDIC_QSPI_NOR nrf_qspi_nor.c) +# zephyr-keep-sorted-stop + if(CONFIG_FLASH_SIMULATOR) zephyr_library_sources(flash_simulator.c) if(CONFIG_NATIVE_LIBRARY) @@ -28,36 +73,7 @@ if(CONFIG_FLASH_SIMULATOR) zephyr_library_sources(flash_simulator_native.c) endif() endif() -zephyr_library_sources_ifdef(CONFIG_SPI_FLASH_AT45 spi_flash_at45.c) -zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_ITE_IT8XXX2 flash_ite_it8xxx2.c) -zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NRF soc_flash_nrf.c) -zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_MCUX soc_flash_mcux.c) -zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_LPC soc_flash_lpc.c) -zephyr_library_sources_ifdef(CONFIG_FLASH_PAGE_LAYOUT flash_page_layout.c) -zephyr_library_sources_ifdef(CONFIG_USERSPACE flash_handlers.c) -zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_SAM0 flash_sam0.c) -zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_SAM flash_sam.c) -zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NIOS2_QSPI soc_flash_nios2_qspi.c) -zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_GECKO flash_gecko.c) -zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_RV32M1 soc_flash_rv32m1.c) -zephyr_library_sources_ifdef(CONFIG_FLASH_NPCX_FIU_QSPI flash_npcx_fiu_qspi.c) -zephyr_library_sources_ifdef(CONFIG_FLASH_NPCX_FIU_NOR flash_npcx_fiu_nor.c) -zephyr_library_sources_ifdef(CONFIG_FLASH_STM32_QSPI flash_stm32_qspi.c) -zephyr_library_sources_ifdef(CONFIG_FLASH_STM32_OSPI flash_stm32_ospi.c) -zephyr_library_sources_ifdef(CONFIG_FLASH_STM32_XSPI flash_stm32_xspi.c) -zephyr_library_sources_ifdef(CONFIG_FLASH_MCUX_FLEXSPI_MX25UM51345G flash_mcux_flexspi_mx25um51345g.c) -zephyr_library_sources_ifdef(CONFIG_FLASH_MCUX_FLEXSPI_NOR flash_mcux_flexspi_nor.c) -zephyr_library_sources_ifdef(CONFIG_FLASH_MCUX_FLEXSPI_HYPERFLASH flash_mcux_flexspi_hyperflash.c) -zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_ESP32 flash_esp32.c) -zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_SMARTBOND flash_smartbond.c) -zephyr_library_sources_ifdef(CONFIG_FLASH_CAD_QSPI_NOR flash_cadence_qspi_nor.c flash_cadence_qspi_nor_ll.c) -zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_XMC4XXX soc_flash_xmc4xxx.c) -zephyr_library_sources_ifdef(CONFIG_FLASH_RPI_PICO flash_rpi_pico.c) -zephyr_library_sources_ifdef(CONFIG_FLASH_ANDES_QSPI flash_andes_qspi.c) -zephyr_library_sources_ifdef(CONFIG_FLASH_AMBIQ flash_ambiq.c) -zephyr_library_sources_ifdef(CONFIG_FLASH_CDNS_NAND flash_cadence_nand.c flash_cadence_nand_ll.c) -zephyr_library_sources_ifdef(CONFIG_FLASH_MSPI_EMUL_DEVICE flash_mspi_emul_device.c) -zephyr_library_sources_ifdef(CONFIG_FLASH_MSPI_ATXP032 flash_mspi_atxp032.c) + zephyr_library_include_directories_ifdef(CONFIG_MSPI ${ZEPHYR_BASE}/drivers/mspi) if(CONFIG_FLASH_MCUX_FLEXSPI_XIP) dt_chosen(chosen_flash PROPERTY "zephyr,flash") @@ -91,15 +107,17 @@ if(CONFIG_SOC_FLASH_STM32) zephyr_library_sources(flash_stm32.c) zephyr_library_sources_ifdef(CONFIG_FLASH_EX_OP_ENABLED flash_stm32_ex_op.c) +# zephyr-keep-sorted-start zephyr_library_sources_ifdef(CONFIG_DT_HAS_ST_STM32F1_FLASH_CONTROLLER_ENABLED flash_stm32f1x.c) zephyr_library_sources_ifdef(CONFIG_DT_HAS_ST_STM32F2_FLASH_CONTROLLER_ENABLED flash_stm32f2x.c) zephyr_library_sources_ifdef(CONFIG_DT_HAS_ST_STM32F4_FLASH_CONTROLLER_ENABLED flash_stm32f4x.c) zephyr_library_sources_ifdef(CONFIG_DT_HAS_ST_STM32F7_FLASH_CONTROLLER_ENABLED flash_stm32f7x.c) + zephyr_library_sources_ifdef(CONFIG_DT_HAS_ST_STM32G0_FLASH_CONTROLLER_ENABLED flash_stm32g0x.c) + zephyr_library_sources_ifdef(CONFIG_DT_HAS_ST_STM32G4_FLASH_CONTROLLER_ENABLED flash_stm32g4x.c) zephyr_library_sources_ifdef(CONFIG_DT_HAS_ST_STM32L4_FLASH_CONTROLLER_ENABLED flash_stm32l4x.c) zephyr_library_sources_ifdef(CONFIG_DT_HAS_ST_STM32L5_FLASH_CONTROLLER_ENABLED flash_stm32l5x.c) zephyr_library_sources_ifdef(CONFIG_DT_HAS_ST_STM32WB_FLASH_CONTROLLER_ENABLED flash_stm32wbx.c) - zephyr_library_sources_ifdef(CONFIG_DT_HAS_ST_STM32G0_FLASH_CONTROLLER_ENABLED flash_stm32g0x.c) - zephyr_library_sources_ifdef(CONFIG_DT_HAS_ST_STM32G4_FLASH_CONTROLLER_ENABLED flash_stm32g4x.c) +# zephyr-keep-sorted-stop endif() endif() endif() @@ -107,9 +125,11 @@ endif() if(CONFIG_SOC_FLASH_GD32) zephyr_library_sources(flash_gd32.c) +# zephyr-keep-sorted-start zephyr_library_sources_ifdef(CONFIG_GD32_NV_FLASH_V1 flash_gd32_v1.c) zephyr_library_sources_ifdef(CONFIG_GD32_NV_FLASH_V2 flash_gd32_v2.c) zephyr_library_sources_ifdef(CONFIG_GD32_NV_FLASH_V3 flash_gd32_v3.c) +# zephyr-keep-sorted-stop endif() zephyr_library_include_directories_ifdef( @@ -133,16 +153,6 @@ zephyr_library_include_directories_ifdef( ${ZEPHYR_BASE}/drivers/memc ) -zephyr_library_sources_ifdef(CONFIG_FLASH_SHELL flash_shell.c) -zephyr_library_sources_ifdef(CONFIG_FLASH_JESD216 jesd216.c) -zephyr_library_sources_ifdef(CONFIG_FLASH_INFINEON_CAT1 flash_ifx_cat1.c) -zephyr_library_sources_ifdef(CONFIG_INFINEON_CAT1_QSPI_FLASH flash_ifx_cat1_qspi.c) -zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NUMAKER soc_flash_numaker.c) -zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NRF_RRAM soc_flash_nrf_rram.c) -zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NRF_MRAM soc_flash_nrf_mram.c) -zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NUMAKER_RMC soc_flash_numaker_rmc.c) -zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_SI32 flash_si32.c) - if(CONFIG_RA_FLASH_HP) zephyr_library_sources(flash_hp_ra.c) zephyr_library_sources_ifdef(CONFIG_FLASH_EX_OP_ENABLED flash_hp_ra_ex_op.c) diff --git a/drivers/flash/Kconfig b/drivers/flash/Kconfig index 99f17d71f7af1..4ab3e9da14f91 100644 --- a/drivers/flash/Kconfig +++ b/drivers/flash/Kconfig @@ -163,81 +163,46 @@ config FLASH_INIT_PRIORITY priority is used unless the driver implementation has its own initialization priority +# zephyr-keep-sorted-start +source "drivers/flash/Kconfig.ambiq" +source "drivers/flash/Kconfig.andes" +source "drivers/flash/Kconfig.at45" source "drivers/flash/Kconfig.b91" - +source "drivers/flash/Kconfig.cadence_nand" +source "drivers/flash/Kconfig.cadence_qspi_nor" source "drivers/flash/Kconfig.cc13xx_cc26xx" - -source "drivers/flash/Kconfig.at45" - source "drivers/flash/Kconfig.esp32" - +source "drivers/flash/Kconfig.gd32" +source "drivers/flash/Kconfig.gecko" +source "drivers/flash/Kconfig.ifx_cat1" source "drivers/flash/Kconfig.it8xxx2" - -source "drivers/flash/Kconfig.nrf" - source "drivers/flash/Kconfig.lpc" - source "drivers/flash/Kconfig.mcux" - source "drivers/flash/Kconfig.mspi" - source "drivers/flash/Kconfig.nios2_qspi" - -source "drivers/flash/Kconfig.npcx_fiu" - -source "drivers/flash/Kconfig.gecko" - source "drivers/flash/Kconfig.nor" - +source "drivers/flash/Kconfig.nordic_qspi_nor" +source "drivers/flash/Kconfig.npcx_fiu" +source "drivers/flash/Kconfig.nrf" +source "drivers/flash/Kconfig.nrf_mram" +source "drivers/flash/Kconfig.nrf_rram" +source "drivers/flash/Kconfig.numaker" +source "drivers/flash/Kconfig.numaker_rmc" +source "drivers/flash/Kconfig.nxp_s32" +source "drivers/flash/Kconfig.renesas_ra" source "drivers/flash/Kconfig.rpi_pico" - -source "drivers/flash/Kconfig.stm32" - -source "drivers/flash/Kconfig.stm32_qspi" - -source "drivers/flash/Kconfig.stm32_ospi" - -source "drivers/flash/Kconfig.stm32_xspi" - -source "drivers/flash/Kconfig.sam0" - +source "drivers/flash/Kconfig.rv32m1" source "drivers/flash/Kconfig.sam" - -source "drivers/flash/Kconfig.simulator" - +source "drivers/flash/Kconfig.sam0" source "drivers/flash/Kconfig.si32" - -source "drivers/flash/Kconfig.rv32m1" - -source "drivers/flash/Kconfig.nordic_qspi_nor" - +source "drivers/flash/Kconfig.simulator" source "drivers/flash/Kconfig.smartbond" - -source "drivers/flash/Kconfig.cadence_qspi_nor" - -source "drivers/flash/Kconfig.gd32" - +source "drivers/flash/Kconfig.stm32" +source "drivers/flash/Kconfig.stm32_ospi" +source "drivers/flash/Kconfig.stm32_qspi" +source "drivers/flash/Kconfig.stm32_xspi" source "drivers/flash/Kconfig.xmc4xxx" - -source "drivers/flash/Kconfig.ifx_cat1" - -source "drivers/flash/Kconfig.cadence_nand" - -source "drivers/flash/Kconfig.numaker" - -source "drivers/flash/Kconfig.nxp_s32" - -source "drivers/flash/Kconfig.andes" - -source "drivers/flash/Kconfig.ambiq" - -source "drivers/flash/Kconfig.nrf_rram" - -source "drivers/flash/Kconfig.nrf_mram" - -source "drivers/flash/Kconfig.numaker_rmc" - -source "drivers/flash/Kconfig.renesas_ra" +# zephyr-keep-sorted-stop module = FLASH module-str = flash From 341f1f502d00087c205cfe21def20f8388565409 Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Tue, 1 Oct 2024 09:06:05 +0200 Subject: [PATCH 0662/4482] bluetooth: conn: Use a separate workqueue for connection TX notify Use a separate workqueue instead of system workqueue for connection TX notify processing. This makes Bluetooth stack more independent from the system workqueue. Signed-off-by: Marek Pieta --- subsys/bluetooth/host/Kconfig | 29 ++++++++ subsys/bluetooth/host/conn.c | 103 +++++++++++++++++--------- subsys/bluetooth/host/conn_internal.h | 2 + subsys/bluetooth/host/hci_core.c | 2 +- 4 files changed, 99 insertions(+), 37 deletions(-) diff --git a/subsys/bluetooth/host/Kconfig b/subsys/bluetooth/host/Kconfig index 05214f224b133..3124b35b3df01 100644 --- a/subsys/bluetooth/host/Kconfig +++ b/subsys/bluetooth/host/Kconfig @@ -129,6 +129,35 @@ config BT_DRIVER_RX_HIGH_PRIO int default 6 +config BT_CONN_TX_NOTIFY_WQ + bool "Use a separate workqueue for connection TX notify processing [EXPERIMENTAL]" + depends on BT_CONN_TX + select EXPERIMENTAL + help + Use a separate workqueue instead of system workqueue for + bt_conn_tx_notify processing. The option can be used to make Bluetooth + stack more independent from the system workqueue. + +if BT_CONN_TX_NOTIFY_WQ + +config BT_CONN_TX_NOTIFY_WQ_STACK_SIZE + int "Stack size of workqueue for connection TX notify processing" + default SYSTEM_WORKQUEUE_STACK_SIZE + +config BT_CONN_TX_NOTIFY_WQ_PRIO + int "Cooperative priority of workqueue for connection TX notify processing" + default 8 + +config BT_CONN_TX_NOTIFY_WQ_INIT_PRIORITY + int "Init priority of workqueue for connection TX notify processing" + default 50 + help + The connection TX notify processing workqueue is initialized during + system initialization (at POST_KERNEL level). The Kconfig option + controls the initialization priority within level. + +endif # BT_CONN_TX_NOTIFY_WQ + menu "Bluetooth Host" if BT_HCI_HOST diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index c5cee7b8464b3..742801683e3d5 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -52,6 +52,11 @@ LOG_MODULE_REGISTER(bt_conn); K_FIFO_DEFINE(free_tx); +#if defined(CONFIG_BT_CONN_TX_NOTIFY_WQ) +static struct k_work_q conn_tx_workq; +static K_KERNEL_STACK_DEFINE(conn_tx_workq_thread_stack, CONFIG_BT_CONN_TX_NOTIFY_WQ_STACK_SIZE); +#endif /* CONFIG_BT_CONN_TX_NOTIFY_WQ */ + static void tx_free(struct bt_conn_tx *tx); static void conn_tx_destroy(struct bt_conn *conn, struct bt_conn_tx *tx) @@ -254,12 +259,21 @@ static void tx_free(struct bt_conn_tx *tx) } #if defined(CONFIG_BT_CONN_TX) -static void tx_notify(struct bt_conn *conn) +static struct k_work_q *tx_notify_workqueue_get(void) { - __ASSERT_NO_MSG(k_current_get() == - k_work_queue_thread_get(&k_sys_work_q)); +#if defined(CONFIG_BT_CONN_TX_NOTIFY_WQ) + return &conn_tx_workq; +#else + return &k_sys_work_q; +#endif /* CONFIG_BT_CONN_TX_NOTIFY_WQ */ +} - LOG_DBG("conn %p", conn); +static void tx_notify_process(struct bt_conn *conn) +{ + /* TX notify processing is done only from a single thread. */ + __ASSERT_NO_MSG(k_current_get() == k_work_queue_thread_get(tx_notify_workqueue_get())); + + LOG_DBG("conn %p", (void *)conn); while (1) { struct bt_conn_tx *tx = NULL; @@ -300,7 +314,30 @@ static void tx_notify(struct bt_conn *conn) bt_tx_irq_raise(); } } -#endif /* CONFIG_BT_CONN_TX */ +#endif /* CONFIG_BT_CONN_TX */ + +void bt_conn_tx_notify(struct bt_conn *conn, bool wait_for_completion) +{ +#if defined(CONFIG_BT_CONN_TX) + /* Ensure that function is called only from a single context. */ + if (k_current_get() == k_work_queue_thread_get(tx_notify_workqueue_get())) { + tx_notify_process(conn); + } else { + struct k_work_sync sync; + int err; + + err = k_work_submit_to_queue(tx_notify_workqueue_get(), &conn->tx_complete_work); + __ASSERT(err >= 0, "couldn't submit (err %d)", err); + + if (wait_for_completion) { + (void)k_work_flush(&conn->tx_complete_work, &sync); + } + } +#else + ARG_UNUSED(conn); + ARG_UNUSED(wait_for_completion); +#endif /* CONFIG_BT_CONN_TX */ +} struct bt_conn *bt_conn_new(struct bt_conn *conns, size_t size) { @@ -439,38 +476,15 @@ static void bt_acl_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags bt_l2cap_recv(conn, buf, true); } -static void wait_for_tx_work(struct bt_conn *conn) -{ -#if defined(CONFIG_BT_CONN_TX) - LOG_DBG("conn %p", conn); - - if (IS_ENABLED(CONFIG_BT_RECV_WORKQ_SYS) || - k_current_get() == k_work_queue_thread_get(&k_sys_work_q)) { - tx_notify(conn); - } else { - struct k_work_sync sync; - int err; - - err = k_work_submit(&conn->tx_complete_work); - __ASSERT(err >= 0, "couldn't submit (err %d)", err); - - k_work_flush(&conn->tx_complete_work, &sync); - } - LOG_DBG("done"); -#else - ARG_UNUSED(conn); -#endif /* CONFIG_BT_CONN_TX */ -} - void bt_conn_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags) { /* Make sure we notify any pending TX callbacks before processing * new data for this connection. * * Always do so from the same context for sanity. In this case that will - * be the system workqueue. + * be either a dedicated Bluetooth connection TX workqueue or system workqueue. */ - wait_for_tx_work(conn); + bt_conn_tx_notify(conn, true); LOG_DBG("handle %u len %u flags %02x", conn->handle, buf->len, flags); @@ -1240,7 +1254,7 @@ void bt_conn_set_state(struct bt_conn *conn, bt_conn_state_t state) */ switch (old_state) { case BT_CONN_DISCONNECT_COMPLETE: - wait_for_tx_work(conn); + bt_conn_tx_notify(conn, true); bt_conn_reset_rx_state(conn); @@ -1631,12 +1645,9 @@ struct net_buf *bt_conn_create_pdu_timeout(struct net_buf_pool *pool, #if defined(CONFIG_BT_CONN_TX) static void tx_complete_work(struct k_work *work) { - struct bt_conn *conn = CONTAINER_OF(work, struct bt_conn, - tx_complete_work); + struct bt_conn *conn = CONTAINER_OF(work, struct bt_conn, tx_complete_work); - LOG_DBG("conn %p", conn); - - tx_notify(conn); + tx_notify_process(conn); } #endif /* CONFIG_BT_CONN_TX */ @@ -4163,3 +4174,23 @@ void bt_hci_le_df_cte_req_failed(struct net_buf *buf) #endif /* CONFIG_BT_DF_CONNECTION_CTE_REQ */ #endif /* CONFIG_BT_CONN */ + +#if defined(CONFIG_BT_CONN_TX_NOTIFY_WQ) +static int bt_conn_tx_workq_init(void) +{ + const struct k_work_queue_config cfg = { + .name = "BT CONN TX WQ", + .no_yield = false, + .essential = false, + }; + + k_work_queue_init(&conn_tx_workq); + k_work_queue_start(&conn_tx_workq, conn_tx_workq_thread_stack, + K_THREAD_STACK_SIZEOF(conn_tx_workq_thread_stack), + K_PRIO_COOP(CONFIG_BT_CONN_TX_NOTIFY_WQ_PRIO), &cfg); + + return 0; +} + +SYS_INIT(bt_conn_tx_workq_init, POST_KERNEL, CONFIG_BT_CONN_TX_NOTIFY_WQ_INIT_PRIORITY); +#endif /* CONFIG_BT_CONN_TX_NOTIFY_WQ */ diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h index a818a85fb7fe9..4d689f0087802 100644 --- a/subsys/bluetooth/host/conn_internal.h +++ b/subsys/bluetooth/host/conn_internal.h @@ -361,6 +361,8 @@ static inline void *closure_data(void *storage) return ((struct closure *)storage)->data; } +void bt_conn_tx_notify(struct bt_conn *conn, bool wait_for_completion); + void bt_conn_reset_rx_state(struct bt_conn *conn); /* Process incoming data for a connection */ diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 0f203831bf543..14b48ed0e797a 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -605,7 +605,7 @@ static void hci_num_completed_packets(struct net_buf *buf) atomic_dec(&conn->in_ll); /* TX context free + callback happens in there */ - k_work_submit(&conn->tx_complete_work); + bt_conn_tx_notify(conn, false); } bt_conn_unref(conn); From bc5f1c8186aae19885a0e48a435e8a184114ad88 Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Fri, 11 Oct 2024 10:24:49 +0200 Subject: [PATCH 0663/4482] doc: releases: Add note for CONFIG_BT_CONN_TX_NOTIFY_WQ Change adds a release note informing about the newly introduced Kconfig option for Bluetooth stack. Signed-off-by: Marek Pieta --- doc/releases/release-notes-4.0.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index e468827a5addd..b470f5c4f2c36 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -107,6 +107,9 @@ Bluetooth * Added API :c:func:`bt_gatt_get_uatt_mtu` to get current Unenhanced ATT MTU of a given connection (experimental). + * Added :kconfig:option:`CONFIG_BT_CONN_TX_NOTIFY_WQ`. + The option allows using a separate workqueue for connection TX notify processing + (:c:func:`bt_conn_tx_notify`) to make Bluetooth stack more independent from the system workqueue. * The host now disconnects from the peer upon ATT timeout. From 48a2aedb78f4c659a2a926d0f88ead77804fd41c Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Tue, 1 Oct 2024 11:57:21 +0200 Subject: [PATCH 0664/4482] soc: st: stm32h7rs serie requires specific power rails Enables the XSPIM2 rail when using GPIO bank N Enables the XSPIM1 rail when using GPIO bank O or P Enables the USBvoltage detector when using the GPIO M Signed-off-by: Francois Ramu --- soc/st/stm32/stm32h7rsx/soc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/soc/st/stm32/stm32h7rsx/soc.c b/soc/st/stm32/stm32h7rsx/soc.c index 5bf2bfe43afe4..75cf6aa62b861 100644 --- a/soc/st/stm32/stm32h7rsx/soc.c +++ b/soc/st/stm32/stm32h7rsx/soc.c @@ -68,4 +68,14 @@ void soc_early_init_hook(void) LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE1); while (LL_PWR_IsActiveFlag_VOSRDY() == 0) { } + +#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpioo), okay) || DT_NODE_HAS_STATUS(DT_NODELABEL(gpiop), okay) + LL_PWR_EnableXSPIM1(); /* Required for powering GPIO O and P */ +#endif /* gpioo || gpio p */ +#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpion), okay) + LL_PWR_EnableXSPIM2(); /* Required for powering GPIO N */ +#endif /* gpio n */ +#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpiom), okay) + LL_PWR_EnableUSBVoltageDetector(); /* Required for powering GPIO M */ +#endif /* gpiom */ } From 23496f52087c44ea06df1045d25cc4c95c24c6e8 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 28 Sep 2024 01:09:28 +0900 Subject: [PATCH 0665/4482] tests: drivers: build_all: eeprom: Add config for ti,tmp116-eeprom Add configuration to add `ti,tmp116-eeprom` to build test. Also, adding emulator build test. Signed-off-by: TOKITA Hiroshi --- tests/drivers/build_all/eeprom/app.overlay | 14 ++++++++++++++ tests/drivers/build_all/eeprom/prj.conf | 3 +++ tests/drivers/build_all/eeprom/testcase.yaml | 11 +++++++++++ 3 files changed, 28 insertions(+) diff --git a/tests/drivers/build_all/eeprom/app.overlay b/tests/drivers/build_all/eeprom/app.overlay index 117dd417b5934..9ec89f1cdbafa 100644 --- a/tests/drivers/build_all/eeprom/app.overlay +++ b/tests/drivers/build_all/eeprom/app.overlay @@ -51,6 +51,20 @@ wp-gpios = <&test_gpio 0 0>; /* read-only; */ }; + + test_i2c_tmp116: tmp116@2 { + status = "okay"; + compatible = "ti,tmp116"; + reg = <0x2>; + #address-cells = <1>; + #size-cells = <0>; + + eeprom: ti_tmp116_eeprom@0 { + compatible = "ti,tmp116-eeprom"; + reg = <0x0>; + read-only; + }; + }; }; test_spi: spi@33334444 { diff --git a/tests/drivers/build_all/eeprom/prj.conf b/tests/drivers/build_all/eeprom/prj.conf index e8ce5369aff13..86b8d76615971 100644 --- a/tests/drivers/build_all/eeprom/prj.conf +++ b/tests/drivers/build_all/eeprom/prj.conf @@ -2,3 +2,6 @@ CONFIG_TEST=y CONFIG_TEST_USERSPACE=y CONFIG_EEPROM=y CONFIG_GPIO=y +CONFIG_SENSOR=y +CONFIG_SENSOR_INIT_PRIORITY=60 +CONFIG_EEPROM_INIT_PRIORITY=70 diff --git a/tests/drivers/build_all/eeprom/testcase.yaml b/tests/drivers/build_all/eeprom/testcase.yaml index c88056822f7e9..89c085959ad80 100644 --- a/tests/drivers/build_all/eeprom/testcase.yaml +++ b/tests/drivers/build_all/eeprom/testcase.yaml @@ -11,3 +11,14 @@ tests: - gpio - i2c - spi + + drivers.eeprom.emul.build: + min_ram: 32 + platform_exclude: serpente + depends_on: + - gpio + - i2c + - spi + extra_configs: + - CONFIG_EMUL=y + - CONFIG_EEPROM_AT2X_EMUL=y From 60dc055f9e29346a746cadb09b4ed3159bc647a7 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 28 Sep 2024 00:41:01 +0900 Subject: [PATCH 0666/4482] tests: drivers: build_all: Add a build_all test for bbram The test targets the following devices at this time. - microchip,mcp7940n Signed-off-by: TOKITA Hiroshi --- tests/drivers/build_all/bbram/CMakeLists.txt | 8 +++++++ tests/drivers/build_all/bbram/app.overlay | 24 ++++++++++++++++++++ tests/drivers/build_all/bbram/i2c.dtsi | 14 ++++++++++++ tests/drivers/build_all/bbram/prj.conf | 1 + tests/drivers/build_all/bbram/src/main.c | 6 +++++ tests/drivers/build_all/bbram/testcase.yaml | 19 ++++++++++++++++ 6 files changed, 72 insertions(+) create mode 100644 tests/drivers/build_all/bbram/CMakeLists.txt create mode 100644 tests/drivers/build_all/bbram/app.overlay create mode 100644 tests/drivers/build_all/bbram/i2c.dtsi create mode 100644 tests/drivers/build_all/bbram/prj.conf create mode 100644 tests/drivers/build_all/bbram/src/main.c create mode 100644 tests/drivers/build_all/bbram/testcase.yaml diff --git a/tests/drivers/build_all/bbram/CMakeLists.txt b/tests/drivers/build_all/bbram/CMakeLists.txt new file mode 100644 index 0000000000000..3742cd1ce05c6 --- /dev/null +++ b/tests/drivers/build_all/bbram/CMakeLists.txt @@ -0,0 +1,8 @@ +# Copyright (c) 2024 TOKITA Hiroshi +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(build_all) + +target_sources(app PRIVATE src/main.c) diff --git a/tests/drivers/build_all/bbram/app.overlay b/tests/drivers/build_all/bbram/app.overlay new file mode 100644 index 0000000000000..9143fb1bdf681 --- /dev/null +++ b/tests/drivers/build_all/bbram/app.overlay @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + + #include + +/ { + test { + #address-cells = <1>; + #size-cells = <1>; + + test_i2c: i2c@11112222 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "vnd,i2c"; + reg = <0x11112222 0x1000>; + status = "okay"; + clock-frequency = ; + + #include "i2c.dtsi" + }; + }; +}; diff --git a/tests/drivers/build_all/bbram/i2c.dtsi b/tests/drivers/build_all/bbram/i2c.dtsi new file mode 100644 index 0000000000000..dbf06f7e39588 --- /dev/null +++ b/tests/drivers/build_all/bbram/i2c.dtsi @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + +/**************************************** + * PLEASE KEEP REG ADDRESSES SEQUENTIAL * + ***************************************/ + +mcp7940n@0 { + compatible = "microchip,mcp7940n"; + reg = <0x0>; + status = "okay"; +}; diff --git a/tests/drivers/build_all/bbram/prj.conf b/tests/drivers/build_all/bbram/prj.conf new file mode 100644 index 0000000000000..b32bd7ecffa8a --- /dev/null +++ b/tests/drivers/build_all/bbram/prj.conf @@ -0,0 +1 @@ +CONFIG_BBRAM=y diff --git a/tests/drivers/build_all/bbram/src/main.c b/tests/drivers/build_all/bbram/src/main.c new file mode 100644 index 0000000000000..1c25675f793cc --- /dev/null +++ b/tests/drivers/build_all/bbram/src/main.c @@ -0,0 +1,6 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + +/* It is okay if main() is not included since just checking the build. */ diff --git a/tests/drivers/build_all/bbram/testcase.yaml b/tests/drivers/build_all/bbram/testcase.yaml new file mode 100644 index 0000000000000..fcc1b477fcfd3 --- /dev/null +++ b/tests/drivers/build_all/bbram/testcase.yaml @@ -0,0 +1,19 @@ +# Copyright (c) 2024 TOKITA hiroshi +# SPDX-License-Identifier: Apache-2.0 + +common: + build_only: true + tags: + - drivers + - bbram + +tests: + drivers.bbram.build: + platform_allow: + - native_sim + + drivers.bbram.emul.build: + platform_allow: + - native_sim + extra_configs: + - CONFIG_EMUL=y From eebed141cf8a130724b74d8b8d164ce3fa89f94e Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 28 Sep 2024 01:31:13 +0900 Subject: [PATCH 0667/4482] tests: drivers: build_all: Add a build_all test for flash The test targets the following devices at this time. - atmel,at45 - jedec,spi-nor Signed-off-by: TOKITA Hiroshi --- tests/drivers/build_all/flash/CMakeLists.txt | 8 +++++ tests/drivers/build_all/flash/app.overlay | 37 ++++++++++++++++++++ tests/drivers/build_all/flash/prj.conf | 2 ++ tests/drivers/build_all/flash/spi.dtsi | 26 ++++++++++++++ tests/drivers/build_all/flash/src/main.c | 6 ++++ tests/drivers/build_all/flash/testcase.yaml | 17 +++++++++ 6 files changed, 96 insertions(+) create mode 100644 tests/drivers/build_all/flash/CMakeLists.txt create mode 100644 tests/drivers/build_all/flash/app.overlay create mode 100644 tests/drivers/build_all/flash/prj.conf create mode 100644 tests/drivers/build_all/flash/spi.dtsi create mode 100644 tests/drivers/build_all/flash/src/main.c create mode 100644 tests/drivers/build_all/flash/testcase.yaml diff --git a/tests/drivers/build_all/flash/CMakeLists.txt b/tests/drivers/build_all/flash/CMakeLists.txt new file mode 100644 index 0000000000000..3742cd1ce05c6 --- /dev/null +++ b/tests/drivers/build_all/flash/CMakeLists.txt @@ -0,0 +1,8 @@ +# Copyright (c) 2024 TOKITA Hiroshi +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(build_all) + +target_sources(app PRIVATE src/main.c) diff --git a/tests/drivers/build_all/flash/app.overlay b/tests/drivers/build_all/flash/app.overlay new file mode 100644 index 0000000000000..17bbec2f0aebe --- /dev/null +++ b/tests/drivers/build_all/flash/app.overlay @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + test { + #address-cells = <1>; + #size-cells = <1>; + + test_gpio: gpio@deadbeef { + compatible = "vnd,gpio"; + gpio-controller; + reg = <0xdeadbeef 0x1000>; + #gpio-cells = <0x2>; + status = "okay"; + }; + + test_spi: spi@33334444 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "vnd,spi"; + reg = <0x33334444 0x1000>; + status = "okay"; + clock-frequency = <2000000>; + + /* one entry for every devices at spi.dtsi */ + cs-gpios = <&test_gpio 0 0>, + <&test_gpio 0 0>, + <&test_gpio 0 0>, + <&test_gpio 0 0>, + <&test_gpio 0 0>; + + #include "spi.dtsi" + }; + }; +}; diff --git a/tests/drivers/build_all/flash/prj.conf b/tests/drivers/build_all/flash/prj.conf new file mode 100644 index 0000000000000..bb0a72808d067 --- /dev/null +++ b/tests/drivers/build_all/flash/prj.conf @@ -0,0 +1,2 @@ +CONFIG_FLASH=y +CONFIG_GPIO=y diff --git a/tests/drivers/build_all/flash/spi.dtsi b/tests/drivers/build_all/flash/spi.dtsi new file mode 100644 index 0000000000000..e2c36f8180cf8 --- /dev/null +++ b/tests/drivers/build_all/flash/spi.dtsi @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + +at45@0 { + compatible = "atmel,at45"; + reg = <0x0>; + status = "okay"; + spi-max-frequency = <5000000>; + jedec-id = [00 11 22]; + size = <1048576>; + sector-size = <1>; + sector-0a-pages = <1>; + block-size = <1>; + page-size = <1>; +}; + +spi-nor@1 { + compatible = "jedec,spi-nor"; + reg = <0x1>; + status = "okay"; + spi-max-frequency = <5000000>; + size = <1048576>; + jedec-id = [00 11 22]; +}; diff --git a/tests/drivers/build_all/flash/src/main.c b/tests/drivers/build_all/flash/src/main.c new file mode 100644 index 0000000000000..1c25675f793cc --- /dev/null +++ b/tests/drivers/build_all/flash/src/main.c @@ -0,0 +1,6 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + +/* It is okay if main() is not included since just checking the build. */ diff --git a/tests/drivers/build_all/flash/testcase.yaml b/tests/drivers/build_all/flash/testcase.yaml new file mode 100644 index 0000000000000..3aa9a679439c7 --- /dev/null +++ b/tests/drivers/build_all/flash/testcase.yaml @@ -0,0 +1,17 @@ +# Copyright (c) 2024 TOKITA hiroshi +# SPDX-License-Identifier: Apache-2.0 + +common: + build_only: true + tags: + - drivers + - flash +tests: + drivers.flash.build: + platform_allow: + - native_sim + drivers.flash.emul.build: + platform_allow: + - native_sim + extra_configs: + - CONFIG_EMUL=y From 2c95978f3bb676ed68c4a39f5398c62949c38e0e Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Thu, 10 Oct 2024 07:35:55 +0900 Subject: [PATCH 0668/4482] MAINTAINERS: Add build_all test files for bbram and flash Add build_all to `files:` entry to bbram and flash. Signed-off-by: TOKITA Hiroshi --- MAINTAINERS.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 83a60ed81ed22..123ef1f2afd7e 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -1049,6 +1049,7 @@ Release Notes: - yperess files: - tests/drivers/bbram/ + - tests/drivers/build_all/bbram/ - drivers/bbram/ - include/zephyr/drivers/bbram.h - doc/hardware/peripherals/bbram.rst @@ -1401,6 +1402,7 @@ Release Notes: - doc/hardware/peripherals/flash.rst - include/zephyr/drivers/flash/ - tests/drivers/flash_simulator/ + - tests/drivers/build_all/flash/ labels: - "area: Flash" tests: From ac2de3fa7c68d356507779d99442dd86fe68f61e Mon Sep 17 00:00:00 2001 From: Sudan Landge Date: Fri, 26 Jul 2024 14:14:22 +0100 Subject: [PATCH 0669/4482] arch: arm: cortex_a_r: Set VBAR for all cores What is changed? Secondary cores can now boot successfully on cache and non-cache coherent systems if the Zephyr image/vector table is loaded at an address other than the default address 0x0. How is it changed? 1. By calling the relocate_vector() from reset.S as part of EL1 reset initialization instead of prep_c to have VBAR set for all cores and not just for the primary core. 2. Remove dead code under CONFIG_SW_VECTOR_RELAY and CONFIG_SW_VECTOR_RELAY_CLIENT. Why do we need this change? 1. As reported in issue #76182, on Cortex_ar, VBAR is set only for the primary cores while VBAR for the secondary cores are left with default value 0. This results in Zephyr not booting on secondary cores if the vector table for secondary cores is loaded at an address other than 0x0. VBAR is set in relocate_vector() so we move it to reboot.c which is better suited to have configs related to system control block. 2. The two SW_VECTOR_RELAY configs have a direct dependency on CONFIG_CPU_CORTEX_M, which is disabled while compiling for Cortex-A and Cortex-R hence leading to a dead code. How is the change verified? Verified with fvp_baser_aemv8r/fvp_aemv8r_aarch32/smp. Signed-off-by: Sudan Landge --- arch/arm/core/cortex_a_r/prep_c.c | 52 +------------------------------ arch/arm/core/cortex_a_r/reboot.c | 51 ++++++++++++++++++++++++++++++ arch/arm/core/cortex_a_r/reset.S | 3 ++ 3 files changed, 55 insertions(+), 51 deletions(-) diff --git a/arch/arm/core/cortex_a_r/prep_c.c b/arch/arm/core/cortex_a_r/prep_c.c index 74d0855a620d8..8e068f2e3923f 100644 --- a/arch/arm/core/cortex_a_r/prep_c.c +++ b/arch/arm/core/cortex_a_r/prep_c.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2013-2014 Wind River Systems, Inc. + * Copyright 2024 Arm Limited and/or its affiliates * * SPDX-License-Identifier: Apache-2.0 */ @@ -28,24 +29,6 @@ #include #endif -#if defined(__GNUC__) -/* - * GCC can detect if memcpy is passed a NULL argument, however one of - * the cases of relocate_vector_table() it is valid to pass NULL, so we - * suppress the warning for this case. We need to do this before - * string.h is included to get the declaration of memcpy. - */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wnonnull" -#endif - -#include - -#if defined(CONFIG_SW_VECTOR_RELAY) || defined(CONFIG_SW_VECTOR_RELAY_CLIENT) -Z_GENERIC_SECTION(.vt_pointer_section) __attribute__((used)) -void *_vector_table_pointer; -#endif - #ifdef CONFIG_ARM_MPU extern void z_arm_mpu_init(void); extern void z_arm_configure_static_mpu_regions(void); @@ -53,38 +36,6 @@ extern void z_arm_configure_static_mpu_regions(void); extern int z_arm_mmu_init(void); #endif -#if defined(CONFIG_AARCH32_ARMV8_R) - -#define VECTOR_ADDRESS ((uintptr_t)_vector_start) - -static inline void relocate_vector_table(void) -{ - write_sctlr(read_sctlr() & ~HIVECS); - write_vbar(VECTOR_ADDRESS & VBAR_MASK); - barrier_isync_fence_full(); -} - -#else -#define VECTOR_ADDRESS 0 - -void __weak relocate_vector_table(void) -{ -#if defined(CONFIG_XIP) && (CONFIG_FLASH_BASE_ADDRESS != 0) || \ - !defined(CONFIG_XIP) && (CONFIG_SRAM_BASE_ADDRESS != 0) - write_sctlr(read_sctlr() & ~HIVECS); - size_t vector_size = (size_t)_vector_end - (size_t)_vector_start; - (void)memcpy(VECTOR_ADDRESS, _vector_start, vector_size); -#elif defined(CONFIG_SW_VECTOR_RELAY) || defined(CONFIG_SW_VECTOR_RELAY_CLIENT) - _vector_table_pointer = _vector_start; -#endif -} - -#if defined(__GNUC__) -#pragma GCC diagnostic pop -#endif - -#endif /* CONFIG_AARCH32_ARMV8_R */ - #if defined(CONFIG_CPU_HAS_FPU) static inline void z_arm_floating_point_init(void) @@ -155,7 +106,6 @@ void z_prep_c(void) /* Initialize tpidruro with our struct _cpu instance address */ write_tpidruro((uintptr_t)&_kernel.cpus[0]); - relocate_vector_table(); #if defined(CONFIG_CPU_HAS_FPU) z_arm_floating_point_init(); #endif diff --git a/arch/arm/core/cortex_a_r/reboot.c b/arch/arm/core/cortex_a_r/reboot.c index dac892cf51846..b5cea619f0932 100644 --- a/arch/arm/core/cortex_a_r/reboot.c +++ b/arch/arm/core/cortex_a_r/reboot.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2013-2014 Wind River Systems, Inc. + * Copyright 2024 Arm Limited and/or its affiliates * * SPDX-License-Identifier: Apache-2.0 */ @@ -12,6 +13,56 @@ #include #include #include +#include + +#if defined(CONFIG_AARCH32_ARMV8_R) + +#define VECTOR_ADDRESS ((uintptr_t)_vector_start) + +static inline void relocate_vector_table(void) +{ + write_sctlr(read_sctlr() & ~HIVECS); + write_vbar(VECTOR_ADDRESS & VBAR_MASK); + barrier_isync_fence_full(); +} + +#else + +#if defined(__GNUC__) +/* + * GCC can detect if memcpy is passed a NULL argument, however one of + * the cases of relocate_vector_table() it is valid to pass NULL, so we + * suppress the warning for this case. We need to do this before + * string.h is included to get the declaration of memcpy. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wnonnull" +#endif /* __GNUC__ */ + +#include + +#define VECTOR_ADDRESS 0 + +void __weak relocate_vector_table(void) +{ +#if defined(CONFIG_XIP) && (CONFIG_FLASH_BASE_ADDRESS != 0) || \ + !defined(CONFIG_XIP) && (CONFIG_SRAM_BASE_ADDRESS != 0) + write_sctlr(read_sctlr() & ~HIVECS); + size_t vector_size = (size_t)_vector_end - (size_t)_vector_start; + (void)memcpy(VECTOR_ADDRESS, _vector_start, vector_size); +#endif +} + +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + +#endif /* !CONFIG_AARCH32_ARMV8_R */ + +void z_arm_relocate_vector_table(void) +{ + relocate_vector_table(); +} /** * diff --git a/arch/arm/core/cortex_a_r/reset.S b/arch/arm/core/cortex_a_r/reset.S index efb04d249ec6f..591973e24e4b5 100644 --- a/arch/arm/core/cortex_a_r/reset.S +++ b/arch/arm/core/cortex_a_r/reset.S @@ -1,6 +1,7 @@ /* * Copyright (c) 2013-2014 Wind River Systems, Inc. * Copyright (c) 2019 Stephanos Ioannidis + * Copyright 2024 Arm Limited and/or its affiliates * * SPDX-License-Identifier: Apache-2.0 */ @@ -319,4 +320,6 @@ _primary_core: bl z_arm_tcm_disable_ecc #endif + bl z_arm_relocate_vector_table + bx r4 From 67f3d0b92392b7c2d27d1e209afff24e2811a7cb Mon Sep 17 00:00:00 2001 From: Sudan Landge Date: Tue, 13 Aug 2024 15:05:13 +0100 Subject: [PATCH 0670/4482] tests: kernel: smp: Test cpu affinity with custom ROM offset What is the changed? CPU affinity test for SMP cores will now cover a change in ROM offset. How is it changed? Add a new testcase section with ROM offset set to something other than the default 0. Why is it change? There is no test to cover the issue reported in #76182 and the cpu affinity test is the closest to test the issue. Adding a new testcase will makes sure there is no breaking change in the future. Signed-off-by: Sudan Landge --- tests/kernel/smp/testcase.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/kernel/smp/testcase.yaml b/tests/kernel/smp/testcase.yaml index 6138c7c262763..650ed72c2088a 100644 --- a/tests/kernel/smp/testcase.yaml +++ b/tests/kernel/smp/testcase.yaml @@ -24,3 +24,13 @@ tests: filter: (CONFIG_MP_MAX_NUM_CPUS > 1) extra_configs: - CONFIG_SCHED_CPU_MASK=y + + kernel.multiprocessing.smp.affinity.custom_rom_offset: + tags: + - kernel + - smp + ignore_faults: true + filter: (CONFIG_MP_MAX_NUM_CPUS > 1) + extra_configs: + - CONFIG_SCHED_CPU_MASK=y + - CONFIG_ROM_START_OFFSET=0x80 From 8bdd45be471bff985ba4b98698bece890be88ff4 Mon Sep 17 00:00:00 2001 From: Sudan Landge Date: Mon, 5 Aug 2024 16:11:09 +0100 Subject: [PATCH 0671/4482] arch: arm: cortex_a_r: smp: minor fix for non cache coherent cores What is changed? 1. Updated the data sync barrier to make sure the other parameters of `arm_cpu_boot_params` are updated before updating its member `mpidr` 2. Updated the MPIDR affinity level mask to account for affinity level 1 and 2 along with level 0. Why do we need this change? 1. As reported in issue #76182, on Cortex_A_R, the current code execution fails to consider the correct sequence of data sync barrier and cache maintenece for the code to work on non cache coherent cores in SMP enabled mode. The secondary cores are waiting in a loop for primary core to set `arm_cpu_boot_params.mpidr`. As soon as primary core set this, the secondary cores start reading other parameters from the `arm_cpu_boot_params` however, the existing position of DSB instruction doesn't guarantee that `arg`, `cpu_num` and other parameters of `arm_cpu_boot_params` would be updated before `mpidr` is udpated and this could lead to a unpredicatble behaviour so, we need to move the DSB instruction. 2. The affinity level mask is updated because it didn't account for level 1 to identify individual cores within a cluster and level 2 to identify different clusters within the system which can lead to an incorrect conversion between mpidr to core-id. Signed-off-by: Sudan Landge --- arch/arm/core/cortex_a_r/smp.c | 8 ++++++-- include/zephyr/arch/arm/cortex_a_r/cpu.h | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/arm/core/cortex_a_r/smp.c b/arch/arm/core/cortex_a_r/smp.c index 6579cb4addebf..df9d0a686df53 100644 --- a/arch/arm/core/cortex_a_r/smp.c +++ b/arch/arm/core/cortex_a_r/smp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Arm Limited (or its affiliates). All rights reserved. + * Copyright (c) 2023, 2024 Arm Limited (or its affiliates). * SPDX-License-Identifier: Apache-2.0 */ @@ -139,10 +139,14 @@ void arch_cpu_start(int cpu_num, k_thread_stack_t *stack, int sz, arch_cpustart_ arm_cpu_boot_params.arg = arg; arm_cpu_boot_params.cpu_num = cpu_num; + /* we need the barrier here to make sure the above changes to + * arm_cpu_boot_params are completed before we set the mpid + */ + barrier_dsync_fence_full(); + /* store mpid last as this is our synchronization point */ arm_cpu_boot_params.mpid = cpu_mpid; - barrier_dsync_fence_full(); sys_cache_data_invd_range( (void *)&arm_cpu_boot_params, sizeof(arm_cpu_boot_params)); diff --git a/include/zephyr/arch/arm/cortex_a_r/cpu.h b/include/zephyr/arch/arm/cortex_a_r/cpu.h index 13455fe6ac4ba..954633ec43be7 100644 --- a/include/zephyr/arch/arm/cortex_a_r/cpu.h +++ b/include/zephyr/arch/arm/cortex_a_r/cpu.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2018 Lexmark International, Inc. + * Copyright 2024 Arm Limited and/or its affiliates * * SPDX-License-Identifier: Apache-2.0 */ @@ -84,8 +85,8 @@ #define ICC_SRE_ELx_DIB_BIT BIT(2) #define ICC_SRE_EL3_EN_BIT BIT(3) -/* MPIDR */ -#define MPIDR_AFFLVL_MASK (0xff) +/* MPIDR mask to extract Aff0, Aff1, and Aff2 */ +#define MPIDR_AFFLVL_MASK (0xffffff) #define MPIDR_AFF0_SHIFT (0) #define MPIDR_AFF1_SHIFT (8) From d61a984bd6571d9ec6400b97f0396a3ae47a528e Mon Sep 17 00:00:00 2001 From: Guillaume Gautier Date: Fri, 27 Sep 2024 08:44:34 +0200 Subject: [PATCH 0672/4482] west.yml: update hal_stm32 to use latest version Update hal_stm32 to use the latest version. Signed-off-by: Guillaume Gautier --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 2c51106858597..376b88186860a 100644 --- a/west.yml +++ b/west.yml @@ -233,7 +233,7 @@ manifest: groups: - hal - name: hal_stm32 - revision: 1ff820533c1b1c17f1a4d7d28ab99a94a234883b + revision: 6f0e5f70cb540c487e3e3678af2e95d0937f9863 path: modules/hal/stm32 groups: - hal From 48ba84bb95b0172b76f706c7a3f4f573071f1a09 Mon Sep 17 00:00:00 2001 From: Guillaume Gautier Date: Fri, 27 Sep 2024 08:47:03 +0200 Subject: [PATCH 0673/4482] drivers: clock: stm32 common: update ahb prescaler STM32C0 have a different prescaler for SYSCLK and for HCLK. Updates the clock driver to use the appropriate prescaler for each series. Signed-off-by: Guillaume Gautier --- drivers/clock_control/clock_stm32_ll_common.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/clock_control/clock_stm32_ll_common.c b/drivers/clock_control/clock_stm32_ll_common.c index de185f026ec97..f1f8b7436fca2 100644 --- a/drivers/clock_control/clock_stm32_ll_common.c +++ b/drivers/clock_control/clock_stm32_ll_common.c @@ -24,8 +24,13 @@ #define z_hsi_divider(v) LL_RCC_HSI_DIV_ ## v #define hsi_divider(v) z_hsi_divider(v) +#if defined(LL_RCC_HCLK_DIV_1) +#define fn_ahb_prescaler(v) LL_RCC_HCLK_DIV_ ## v +#define ahb_prescaler(v) fn_ahb_prescaler(v) +#else #define fn_ahb_prescaler(v) LL_RCC_SYSCLK_DIV_ ## v #define ahb_prescaler(v) fn_ahb_prescaler(v) +#endif #define fn_apb1_prescaler(v) LL_RCC_APB1_DIV_ ## v #define apb1_prescaler(v) fn_apb1_prescaler(v) @@ -537,7 +542,7 @@ static void set_up_plls(void) */ if (LL_RCC_GetSysClkSource() == LL_RCC_SYS_CLKSOURCE_STATUS_PLL) { stm32_clock_switch_to_hsi(); - LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1); + LL_RCC_SetAHBPrescaler(ahb_prescaler(1)); } LL_RCC_PLL_Disable(); @@ -800,9 +805,9 @@ int stm32_clock_control_init(const struct device *dev) set_up_plls(); if (DT_PROP(DT_NODELABEL(rcc), undershoot_prevention) && - (STM32_CORE_PRESCALER == LL_RCC_SYSCLK_DIV_1) && + (ahb_prescaler(STM32_CORE_PRESCALER) == ahb_prescaler(1)) && (MHZ(80) < CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC)) { - LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_2); + LL_RCC_SetAHBPrescaler(ahb_prescaler(2)); } else { LL_RCC_SetAHBPrescaler(ahb_prescaler(STM32_CORE_PRESCALER)); } @@ -827,7 +832,7 @@ int stm32_clock_control_init(const struct device *dev) #endif /* STM32_SYSCLK_SRC_... */ if (DT_PROP(DT_NODELABEL(rcc), undershoot_prevention) && - (STM32_CORE_PRESCALER == LL_RCC_SYSCLK_DIV_1) && + (ahb_prescaler(STM32_CORE_PRESCALER) == ahb_prescaler(1)) && (MHZ(80) < CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC)) { LL_RCC_SetAHBPrescaler(ahb_prescaler(STM32_CORE_PRESCALER)); } From ded9e11d5941cc1a68d3c8be8317415cac387b7d Mon Sep 17 00:00:00 2001 From: Guillaume Gautier Date: Wed, 2 Oct 2024 14:30:57 +0200 Subject: [PATCH 0674/4482] drivers: dma: stm32 dmamux: fix for c0 hal update Fix the DMAMUX driver for the STM32C0 HAL update. Typedef used in function is now const. Signed-off-by: Guillaume Gautier --- drivers/dma/dmamux_stm32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/dma/dmamux_stm32.c b/drivers/dma/dmamux_stm32.c index 27e02b1c18802..43e7056dccc0c 100644 --- a/drivers/dma/dmamux_stm32.c +++ b/drivers/dma/dmamux_stm32.c @@ -70,7 +70,8 @@ uint32_t table_ll_channel[] = { LISTIFY(DT_INST_PROP(0, dma_channels), DMAMUX_CHANNEL, (,)) }; -#if !defined(CONFIG_SOC_SERIES_STM32G0X) +#if !defined(CONFIG_SOC_SERIES_STM32G0X) && \ + !defined(CONFIG_SOC_SERIES_STM32C0X) #define dmamux_channel_typedef DMAMUX_Channel_TypeDef #else #define dmamux_channel_typedef const DMAMUX_Channel_TypeDef From 85501c54149bedf2ae5799ce0676538070f1faa9 Mon Sep 17 00:00:00 2001 From: Yangbo Lu Date: Wed, 25 Sep 2024 06:37:10 +0200 Subject: [PATCH 0675/4482] include: arm: arm_mpu_v8: support memory attribute for device for Cortex-M Supported memory attribute for device for Cortex-M. Not sure why such code was conditional compile for only Cortex-R, but Cortex-M also suited. Signed-off-by: Yangbo Lu --- include/zephyr/arch/arm/mpu/arm_mpu_v8.h | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/include/zephyr/arch/arm/mpu/arm_mpu_v8.h b/include/zephyr/arch/arm/mpu/arm_mpu_v8.h index 11d4a2e754708..77deb64beed66 100644 --- a/include/zephyr/arch/arm/mpu/arm_mpu_v8.h +++ b/include/zephyr/arch/arm/mpu/arm_mpu_v8.h @@ -82,7 +82,7 @@ (((base & MPU_RBAR_BASE_Msk) + size - 1) & MPU_RLAR_LIMIT_Msk) /* Attribute flags for cache-ability */ -#if defined(CONFIG_AARCH32_ARMV8_R) + /* Memory Attributes for Device Memory * 1.Gathering (G/nG) * Determines whether multiple accesses can be merged into a single @@ -105,7 +105,6 @@ #define DEVICE_nGnRE 0x4U #define DEVICE_nGRE 0x8U #define DEVICE_GRE 0xCU -#endif /* Read/Write Allocation Configurations for Cacheable Memory */ #define R_NON_W_NON 0x0 /* Do not allocate Read/Write */ @@ -152,8 +151,6 @@ #define MPU_MAIR_INDEX_SRAM 1 #define MPU_MAIR_ATTR_SRAM_NOCACHE MPU_CACHE_ATTRIBUTES_SRAM_NOCACHE #define MPU_MAIR_INDEX_SRAM_NOCACHE 2 - -#if defined(CONFIG_AARCH32_ARMV8_R) #define MPU_MAIR_ATTR_DEVICE DEVICE_nGnRnE #define MPU_MAIR_INDEX_DEVICE 3 /* Flash region(s): Attribute-0 @@ -166,17 +163,6 @@ (MPU_MAIR_ATTR_SRAM << (MPU_MAIR_INDEX_SRAM * 8)) | \ (MPU_MAIR_ATTR_SRAM_NOCACHE << (MPU_MAIR_INDEX_SRAM_NOCACHE * 8)) | \ (MPU_MAIR_ATTR_DEVICE << (MPU_MAIR_INDEX_DEVICE * 8))) -#else -/* Flash region(s): Attribute-0 - * SRAM region(s): Attribute-1 - * SRAM no cache-able regions(s): Attribute-2 - */ -#define MPU_MAIR_ATTRS \ - (((MPU_MAIR_ATTR_FLASH << MPU_MAIR0_Attr0_Pos) & MPU_MAIR0_Attr0_Msk) | \ - ((MPU_MAIR_ATTR_SRAM << MPU_MAIR0_Attr1_Pos) & MPU_MAIR0_Attr1_Msk) | \ - ((MPU_MAIR_ATTR_SRAM_NOCACHE << MPU_MAIR0_Attr2_Pos) & \ - MPU_MAIR0_Attr2_Msk)) -#endif /* Some helper defines for common regions. * @@ -309,6 +295,13 @@ } #endif /* CONFIG_MPU_ALLOW_FLASH_WRITE */ +#define REGION_DEVICE_ATTR(base, size) \ + { \ + /* AP, XN, SH */ \ + .rbar = NOT_EXEC | P_RW_U_NA_Msk | NON_SHAREABLE_Msk, /* Cache-ability */ \ + .mair_idx = MPU_MAIR_INDEX_DEVICE, \ + .r_limit = REGION_LIMIT_ADDR(base, size), /* Region Limit */ \ + } #endif struct arm_mpu_region_attr { From 0ab86c48dd7a448e82c69a8e274de9984ac40f82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 1 Oct 2024 08:54:56 +0200 Subject: [PATCH 0676/4482] drivers: pwm: nrfx: Improve device generation macros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use NRFX_FOREACH_PRESENT macro to iterate over all PWM instances and create device only for those enabled in the devicetree. This approach removes need of changing driver code when new instance id is added. Signed-off-by: Krzysztof Chruściński --- drivers/pwm/pwm_nrfx.c | 49 +++--------------------------------------- 1 file changed, 3 insertions(+), 46 deletions(-) diff --git a/drivers/pwm/pwm_nrfx.c b/drivers/pwm/pwm_nrfx.c index f6312535c7e72..a1ee27fc70290 100644 --- a/drivers/pwm/pwm_nrfx.c +++ b/drivers/pwm/pwm_nrfx.c @@ -390,50 +390,7 @@ static int pwm_nrfx_pm_action(const struct device *dev, POST_KERNEL, CONFIG_PWM_INIT_PRIORITY, \ &pwm_nrfx_drv_api_funcs) -#ifdef CONFIG_HAS_HW_NRF_PWM0 -PWM_NRFX_DEVICE(0); -#endif - -#ifdef CONFIG_HAS_HW_NRF_PWM1 -PWM_NRFX_DEVICE(1); -#endif - -#ifdef CONFIG_HAS_HW_NRF_PWM2 -PWM_NRFX_DEVICE(2); -#endif - -#ifdef CONFIG_HAS_HW_NRF_PWM3 -PWM_NRFX_DEVICE(3); -#endif - -#ifdef CONFIG_HAS_HW_NRF_PWM20 -PWM_NRFX_DEVICE(20); -#endif - -#ifdef CONFIG_HAS_HW_NRF_PWM21 -PWM_NRFX_DEVICE(21); -#endif +#define COND_PWM_NRFX_DEVICE(unused, prefix, i, _) \ + IF_ENABLED(CONFIG_HAS_HW_NRF_PWM##prefix##i, (PWM_NRFX_DEVICE(prefix##i);)) -#ifdef CONFIG_HAS_HW_NRF_PWM22 -PWM_NRFX_DEVICE(22); -#endif - -#ifdef CONFIG_HAS_HW_NRF_PWM120 -PWM_NRFX_DEVICE(120); -#endif - -#ifdef CONFIG_HAS_HW_NRF_PWM130 -PWM_NRFX_DEVICE(130); -#endif - -#ifdef CONFIG_HAS_HW_NRF_PWM131 -PWM_NRFX_DEVICE(131); -#endif - -#ifdef CONFIG_HAS_HW_NRF_PWM132 -PWM_NRFX_DEVICE(132); -#endif - -#ifdef CONFIG_HAS_HW_NRF_PWM133 -PWM_NRFX_DEVICE(133); -#endif +NRFX_FOREACH_PRESENT(PWM, COND_PWM_NRFX_DEVICE, (), (), _) From c3a33cfd3e63a3dede31ebc4e58153a395706fb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 20 Sep 2024 10:34:13 +0200 Subject: [PATCH 0677/4482] drivers: pwm: nrfx: Disable PWM peripheral when not used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Shim was not correctly disabling PWM when it was not used. Task STOP was triggered but PWM->ENABLE remained set which caused increased current. Added interrupt and enabled event handler in the nrfx driver to allow disabling PWM on STOPPED event. Signed-off-by: Krzysztof Chruściński --- drivers/pwm/pwm_nrfx.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/pwm/pwm_nrfx.c b/drivers/pwm/pwm_nrfx.c index a1ee27fc70290..9ceb2f5330217 100644 --- a/drivers/pwm/pwm_nrfx.c +++ b/drivers/pwm/pwm_nrfx.c @@ -20,7 +20,6 @@ LOG_MODULE_REGISTER(pwm_nrfx, CONFIG_PWM_LOG_LEVEL); * to 0 or 1, hence the use of #if IS_ENABLED(). */ #if IS_ENABLED(NRFX_PWM_NRF52_ANOMALY_109_WORKAROUND_ENABLED) -#define ANOMALY_109_IRQ_CONNECT(...) IRQ_CONNECT(__VA_ARGS__) #define ANOMALY_109_EGU_IRQ_CONNECT(idx) _EGU_IRQ_CONNECT(idx) #define _EGU_IRQ_CONNECT(idx) \ extern void nrfx_egu_##idx##_irq_handler(void); \ @@ -28,7 +27,6 @@ LOG_MODULE_REGISTER(pwm_nrfx, CONFIG_PWM_LOG_LEVEL); DT_IRQ(DT_NODELABEL(egu##idx), priority), \ nrfx_isr, nrfx_egu_##idx##_irq_handler, 0) #else -#define ANOMALY_109_IRQ_CONNECT(...) #define ANOMALY_109_EGU_IRQ_CONNECT(idx) #endif @@ -63,6 +61,12 @@ static uint16_t *seq_values_ptr_get(const struct device *dev) return (uint16_t *)config->seq.values.p_raw; } +static void pwm_handler(nrfx_pwm_evt_type_t event_type, void *p_context) +{ + ARG_UNUSED(event_type); + ARG_UNUSED(p_context); +} + static bool pwm_period_check_and_set(const struct device *dev, uint32_t channel, uint32_t period_cycles) { @@ -229,7 +233,8 @@ static int pwm_nrfx_set_cycles(const struct device *dev, uint32_t channel, * until another playback is requested (new values will be * loaded then) or the PWM peripheral is stopped. */ - nrfx_pwm_simple_playback(&config->pwm, &config->seq, 1, 0); + nrfx_pwm_simple_playback(&config->pwm, &config->seq, 1, + NRFX_PWM_FLAG_NO_EVT_FINISHED); } return 0; @@ -256,6 +261,7 @@ static int pwm_nrfx_init(const struct device *dev) { const struct pwm_nrfx_config *config = dev->config; uint8_t initially_inverted = 0; + nrfx_err_t result; int ret = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); @@ -284,10 +290,7 @@ static int pwm_nrfx_init(const struct device *dev) seq_values_ptr_get(dev)[i] = PWM_NRFX_CH_VALUE(0, inverted); } - nrfx_err_t result = nrfx_pwm_init(&config->pwm, - &config->initial_config, - NULL, - NULL); + result = nrfx_pwm_init(&config->pwm, &config->initial_config, pwm_handler, dev->data); if (result != NRFX_SUCCESS) { LOG_ERR("Failed to initialize device: %s", dev->name); return -EBUSY; @@ -377,9 +380,8 @@ static int pwm_nrfx_pm_action(const struct device *dev, }; \ static int pwm_nrfx_init##idx(const struct device *dev) \ { \ - ANOMALY_109_IRQ_CONNECT( \ - DT_IRQN(PWM(idx)), DT_IRQ(PWM(idx), priority), \ - nrfx_isr, nrfx_pwm_##idx##_irq_handler, 0); \ + IRQ_CONNECT(DT_IRQN(PWM(idx)), DT_IRQ(PWM(idx), priority), \ + nrfx_isr, nrfx_pwm_##idx##_irq_handler, 0); \ return pwm_nrfx_init(dev); \ }; \ PM_DEVICE_DT_DEFINE(PWM(idx), pwm_nrfx_pm_action); \ From e11d050b23e514a408bb6428055e5f568b319d6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 20 Sep 2024 13:17:19 +0200 Subject: [PATCH 0678/4482] drivers: pwm: nrfx: Improve runtime PM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rework PM handling to use pm_device_driver_init(). Shim is not using put and get internally as there is no api that disables or stops pwm so it is hard to determine when to put the device. There are cases when PWM peripheral is stopped but PWM is still active because duty cycle is 100% or 0% and pin is driven by GPIO and not PWM. If user want to use runtime PM with PWM it is possible and getting the device will initialize internal data and putting will suspend by forcing PWM stop if used and setting pins to sleep state. However, from power consumption perspective it is enough to set 0% or 100% duty cycle on all channels. Signed-off-by: Krzysztof Chruściński --- drivers/pwm/pwm_nrfx.c | 75 +++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 45 deletions(-) diff --git a/drivers/pwm/pwm_nrfx.c b/drivers/pwm/pwm_nrfx.c index 9ceb2f5330217..420a9078c59ea 100644 --- a/drivers/pwm/pwm_nrfx.c +++ b/drivers/pwm/pwm_nrfx.c @@ -257,19 +257,12 @@ static const struct pwm_driver_api pwm_nrfx_drv_api_funcs = { .get_cycles_per_sec = pwm_nrfx_get_cycles_per_sec, }; -static int pwm_nrfx_init(const struct device *dev) +static void pwm_resume(const struct device *dev) { const struct pwm_nrfx_config *config = dev->config; uint8_t initially_inverted = 0; - nrfx_err_t result; - - int ret = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); - - ANOMALY_109_EGU_IRQ_CONNECT(NRFX_PWM_NRF52_ANOMALY_109_EGU_INSTANCE); - if (ret < 0) { - return ret; - } + (void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); for (size_t i = 0; i < NRF_PWM_CHANNEL_COUNT; i++) { uint32_t psel; @@ -289,61 +282,53 @@ static int pwm_nrfx_init(const struct device *dev) seq_values_ptr_get(dev)[i] = PWM_NRFX_CH_VALUE(0, inverted); } - - result = nrfx_pwm_init(&config->pwm, &config->initial_config, pwm_handler, dev->data); - if (result != NRFX_SUCCESS) { - LOG_ERR("Failed to initialize device: %s", dev->name); - return -EBUSY; - } - - return 0; } -#ifdef CONFIG_PM_DEVICE -static void pwm_nrfx_uninit(const struct device *dev) +static void pwm_suspend(const struct device *dev) { const struct pwm_nrfx_config *config = dev->config; - nrfx_pwm_uninit(&config->pwm); + nrfx_pwm_stop(&config->pwm, false); + while (!nrfx_pwm_stopped_check(&config->pwm)) { + } memset(dev->data, 0, sizeof(struct pwm_nrfx_data)); + (void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_SLEEP); } static int pwm_nrfx_pm_action(const struct device *dev, enum pm_device_action action) { - const struct pwm_nrfx_config *config = dev->config; - int ret = 0; + if (action == PM_DEVICE_ACTION_RESUME) { + pwm_resume(dev); + } else if (IS_ENABLED(CONFIG_PM_DEVICE) && (action == PM_DEVICE_ACTION_SUSPEND)) { + pwm_suspend(dev); + } else { + return -ENOTSUP; + } - switch (action) { - case PM_DEVICE_ACTION_RESUME: - ret = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); - if (ret < 0) { - return ret; - } - ret = pwm_nrfx_init(dev); - break; + return 0; +} - case PM_DEVICE_ACTION_SUSPEND: - pwm_nrfx_uninit(dev); +static int pwm_nrfx_init(const struct device *dev) +{ + const struct pwm_nrfx_config *config = dev->config; + nrfx_err_t err; - ret = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_SLEEP); - if (ret < 0) { - return ret; - } - break; + ANOMALY_109_EGU_IRQ_CONNECT(NRFX_PWM_NRF52_ANOMALY_109_EGU_INSTANCE); - default: - return -ENOTSUP; + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + (void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_SLEEP); } - return ret; -} -#else - -#define pwm_nrfx_pm_action NULL + err = nrfx_pwm_init(&config->pwm, &config->initial_config, pwm_handler, dev->data); + if (err != NRFX_SUCCESS) { + LOG_ERR("Failed to initialize device: %s", dev->name); + return -EBUSY; + } -#endif /* CONFIG_PM_DEVICE */ + return pm_device_driver_init(dev, pwm_nrfx_pm_action); +} #define PWM(dev_idx) DT_NODELABEL(pwm##dev_idx) #define PWM_PROP(dev_idx, prop) DT_PROP(PWM(dev_idx), prop) From 8774f15bd2fe1afb70d22ecf669f399c5e1d1ffe Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 10 Oct 2024 10:49:49 +0100 Subject: [PATCH 0679/4482] sysbuild: cmake: Add set_config_int() function Adds a function that will add an integer value to an image Signed-off-by: Jamie McCrae --- share/sysbuild/cmake/modules/sysbuild_extensions.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake index 135160f564993..b9987fb14d4c5 100644 --- a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake +++ b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake @@ -661,6 +661,10 @@ function(set_config_string image setting value) set_property(TARGET ${image} APPEND_STRING PROPERTY CONFIG "${setting}=\"${value}\"\n") endfunction() +function(set_config_int image setting value) + set_property(TARGET ${image} APPEND_STRING PROPERTY CONFIG "${setting}=${value}\n") +endfunction() + # Usage: # sysbuild_add_subdirectory( []) # From 646f116cca6ef6c145e42907797ae80b4f851684 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 24 Jul 2024 13:21:33 +0100 Subject: [PATCH 0680/4482] mcuboot: Add support for RAM load mode Adds supporting code that allows the RAM load mode of MCUboot to be used and for applications to build successfully with it. Sysbuild can be used to build images for this mode Signed-off-by: Jamie McCrae --- cmake/mcuboot.cmake | 57 ++++++++++++++++++- modules/Kconfig.mcuboot | 12 ++++ .../MAIN_image_default.cmake | 5 +- subsys/dfu/Kconfig | 1 + subsys/dfu/boot/mcuboot.c | 35 ++++++++++++ .../mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c | 30 +++++++++- .../mcumgr/grp/img_mgmt/src/img_mgmt_state.c | 3 +- .../mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c | 2 + 8 files changed, 139 insertions(+), 6 deletions(-) diff --git a/cmake/mcuboot.cmake b/cmake/mcuboot.cmake index 25fa1827f33f7..b6ab9dd503401 100644 --- a/cmake/mcuboot.cmake +++ b/cmake/mcuboot.cmake @@ -114,9 +114,21 @@ function(zephyr_mcuboot_tasks) set(imgtool_args --key "${keyfile}" ${imgtool_args}) endif() - # Use overwrite-only instead of swap upgrades. if(CONFIG_MCUBOOT_IMGTOOL_OVERWRITE_ONLY) + # Use overwrite-only instead of swap upgrades. set(imgtool_args --overwrite-only --align 1 ${imgtool_args}) + elseif(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) + # RAM load requires setting the location of where to load the image to + dt_chosen(chosen_ram PROPERTY "zephyr,sram") + dt_reg_addr(chosen_ram_address PATH ${chosen_ram}) + dt_nodelabel(slot0_partition NODELABEL "slot0_partition" REQUIRED) + dt_reg_addr(slot0_partition_address PATH ${slot0_partition}) + dt_nodelabel(slot1_partition NODELABEL "slot1_partition" REQUIRED) + dt_reg_addr(slot1_partition_address PATH ${slot1_partition}) + + set(imgtool_args --align 1 --load-addr ${chosen_ram_address} ${imgtool_args}) + set(imgtool_args_alt_slot ${imgtool_args} --hex-addr ${slot1_partition_address}) + set(imgtool_args ${imgtool_args} --hex-addr ${slot0_partition_address}) else() set(imgtool_args --align ${write_block_size} ${imgtool_args}) endif() @@ -156,6 +168,27 @@ function(zephyr_mcuboot_tasks) ${imgtool_sign} ${imgtool_args} --encrypt "${keyfile_enc}" ${output}.bin ${output}.signed.encrypted.bin) endif() + + if(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) + list(APPEND byproducts ${output}.slot1.signed.encrypted.bin) + set_property(GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND + ${imgtool_sign} ${imgtool_args_alt_slot} ${output}.bin + ${output}.slot1.signed.bin) + + if(CONFIG_MCUBOOT_GENERATE_CONFIRMED_IMAGE) + list(APPEND byproducts ${output}.slot1.signed.confirmed.bin) + set_property(GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND + ${imgtool_sign} ${imgtool_args_alt_slot} --pad --confirm ${output}.bin + ${output}.slot1.signed.confirmed.bin) + endif() + + if(NOT "${keyfile_enc}" STREQUAL "") + list(APPEND byproducts ${output}.slot1.signed.encrypted.bin) + set_property(GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND + ${imgtool_sign} ${imgtool_args_alt_slot} --encrypt "${keyfile_enc}" + ${output}.bin ${output}.slot1.signed.encrypted.bin) + endif() + endif() endif() # Set up .hex outputs. @@ -187,8 +220,28 @@ function(zephyr_mcuboot_tasks) ${imgtool_sign} ${imgtool_args} --encrypt "${keyfile_enc}" ${output}.hex ${output}.signed.encrypted.hex) endif() - endif() + if(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) + list(APPEND byproducts ${output}.slot1.signed.hex) + set_property(GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND + ${imgtool_sign} ${imgtool_args_alt_slot} ${output}.hex + ${output}.slot1.signed.hex) + + if(CONFIG_MCUBOOT_GENERATE_CONFIRMED_IMAGE) + list(APPEND byproducts ${output}.slot1.signed.confirmed.hex) + set_property(GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND + ${imgtool_sign} ${imgtool_args_alt_slot} --pad --confirm ${output}.hex + ${output}.slot1.signed.confirmed.hex) + endif() + + if(NOT "${keyfile_enc}" STREQUAL "") + list(APPEND byproducts ${output}.slot1.signed.encrypted.hex) + set_property(GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND + ${imgtool_sign} ${imgtool_args_alt_slot} --encrypt "${keyfile_enc}" + ${output}.hex ${output}.slot1.signed.encrypted.hex) + endif() + endif() + endif() set_property(GLOBAL APPEND PROPERTY extra_post_build_byproducts ${byproducts}) endfunction() diff --git a/modules/Kconfig.mcuboot b/modules/Kconfig.mcuboot index a914ff1d5a84b..2706ad6583c98 100644 --- a/modules/Kconfig.mcuboot +++ b/modules/Kconfig.mcuboot @@ -183,6 +183,18 @@ config MCUBOOT_BOOTLOADER_MODE_OVERWRITE_ONLY that the overwrite will not happen unless the version of secondary slot is higher than the version in primary slot. +config MCUBOOT_BOOTLOADER_MODE_RAM_LOAD + bool "MCUboot has been configured for RAM LOAD operation" + select MCUBOOT_BOOTLOADER_MODE_HAS_NO_DOWNGRADE + select MCUBOOT_BOOTLOADER_NO_DOWNGRADE + help + MCUboot expects slot0_partition and slot1_partition to exist in DT. In this mode, MCUboot + will select the image with the higher version number, copy it to RAM and begin execution + from there. The image must be linked to execute from RAM, the address that it is copied + to is specified using the load-addr argument when running imgtool. + This option automatically selectes MCUBOOT_BOOTLOADER_NO_DOWNGRADE as it is not possible + to swap back to older version of the application. + config MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP bool "MCUboot has been configured for DirectXIP operation" select MCUBOOT_BOOTLOADER_MODE_HAS_NO_DOWNGRADE diff --git a/share/sysbuild/image_configurations/MAIN_image_default.cmake b/share/sysbuild/image_configurations/MAIN_image_default.cmake index 601d8b616ec49..cd447a29d0cff 100644 --- a/share/sysbuild/image_configurations/MAIN_image_default.cmake +++ b/share/sysbuild/image_configurations/MAIN_image_default.cmake @@ -33,7 +33,10 @@ if(SB_CONFIG_BOOTLOADER_MCUBOOT) elseif(SB_CONFIG_MCUBOOT_MODE_DIRECT_XIP_WITH_REVERT) set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT y) elseif(SB_CONFIG_MCUBOOT_MODE_RAM_LOAD) - # Not yet supported in zephyr code + # RAM load mode requires XIP be disabled and flash size be set to 0 + set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD y) + set_config_bool(${ZCMAKE_APPLICATION} CONFIG_XIP n) + set_config_int(${ZCMAKE_APPLICATION} CONFIG_FLASH_SIZE 0) elseif(SB_CONFIG_MCUBOOT_MODE_FIRMWARE_UPDATER) set_config_bool(${ZCMAKE_APPLICATION} CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER y) endif() diff --git a/subsys/dfu/Kconfig b/subsys/dfu/Kconfig index 5977764016d36..f621457a1e7bf 100644 --- a/subsys/dfu/Kconfig +++ b/subsys/dfu/Kconfig @@ -10,6 +10,7 @@ menuconfig IMG_MANAGER bool "DFU image manager" depends on STREAM_FLASH + depends on !MCUBOOT_BOOTLOADER_MODE_RAM_LOAD || RETENTION_BOOTLOADER_INFO_OUTPUT_FUNCTION help Enable support for managing DFU image. diff --git a/subsys/dfu/boot/mcuboot.c b/subsys/dfu/boot/mcuboot.c index 20015349dbc6e..dde9f8af57912 100644 --- a/subsys/dfu/boot/mcuboot.c +++ b/subsys/dfu/boot/mcuboot.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -19,8 +20,15 @@ #include "bootutil/bootutil_public.h" #include +#if defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) +#include +#include +#endif + #include "mcuboot_priv.h" +LOG_MODULE_REGISTER(mcuboot_dfu, LOG_LEVEL_DBG); + /* * Helpers for image headers and trailers, as defined by mcuboot. */ @@ -34,8 +42,15 @@ #define BOOT_HEADER_MAGIC_V1 0x96f3b83d #define BOOT_HEADER_SIZE_V1 32 +#if defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) +/* For RAM LOAD mode, the active image must be fetched from the bootloader */ +static uint8_t boot_fetch_active_slot(void); +#define ACTIVE_SLOT_FLASH_AREA_ID boot_fetch_active_slot() +#define INVALID_SLOT_ID 255 +#else /* Get active partition. zephyr,code-partition chosen node must be defined */ #define ACTIVE_SLOT_FLASH_AREA_ID DT_FIXED_PARTITION_ID(DT_CHOSEN(zephyr_code_partition)) +#endif /* * Raw (on-flash) representation of the v1 image header. @@ -60,6 +75,26 @@ struct mcuboot_v1_raw_header { * End of strict defines */ +#if defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) +static uint8_t boot_fetch_active_slot(void) +{ + int rc; + uint8_t slot; + + rc = blinfo_lookup(BLINFO_RUNNING_SLOT, &slot, sizeof(slot)); + + if (rc <= 0) { + LOG_ERR("Failed to fetch active slot: %d", rc); + + return INVALID_SLOT_ID; + } + + LOG_DBG("Active slot: %d", slot); + + return slot; +} +#endif + static int boot_read_v1_header(uint8_t area_id, struct mcuboot_v1_raw_header *v1_raw) { diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c index 913aec15c8883..63083c96fb97d 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c @@ -35,6 +35,13 @@ #include #endif +#if defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) +#include +#include +#endif + +#if !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) + #ifndef CONFIG_FLASH_LOAD_OFFSET #error MCUmgr requires application to be built with CONFIG_FLASH_LOAD_OFFSET set \ to be able to figure out application running slot. @@ -75,6 +82,10 @@ BUILD_ASSERT(sizeof(struct image_header) == IMAGE_HEADER_SIZE, #define ACTIVE_IMAGE_IS 0 #endif +#else +#define ACTIVE_IMAGE_IS 0 +#endif + #define SLOTS_PER_IMAGE 2 LOG_MODULE_REGISTER(mcumgr_img_grp, CONFIG_MCUMGR_GRP_IMG_LOG_LEVEL); @@ -198,9 +209,23 @@ int img_mgmt_active_slot(int image) { int slot = 0; - /* Multi image does not support DirectXIP currently */ + /* Multi image does not support DirectXIP or RAM load currently */ #if CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER > 1 slot = (image << 1); +#elif defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) + /* RAM load requires querying bootloader */ + int rc; + uint8_t temp_slot; + + rc = blinfo_lookup(BLINFO_RUNNING_SLOT, &temp_slot, sizeof(temp_slot)); + + if (rc <= 0) { + LOG_ERR("Failed to fetch active slot: %d", rc); + + return 255; + } + + slot = (int)temp_slot; #else /* This covers single image, including DirectXiP */ if (FIXED_PARTITION_IS_RUNNING_APP_PARTITION(slot1_partition)) { @@ -1056,7 +1081,8 @@ static int img_mgmt_translate_error_code(uint16_t err) static const struct mgmt_handler img_mgmt_handlers[] = { [IMG_MGMT_ID_STATE] = { .mh_read = img_mgmt_state_read, -#ifdef CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP +#if defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) || \ + defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) .mh_write = NULL #else .mh_write = img_mgmt_state_write, diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c index a580d7af6c365..52b2ed76f67bf 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt_state.c @@ -324,7 +324,8 @@ img_mgmt_slot_in_use(int slot) int image = img_mgmt_slot_to_image(slot); int active_slot = img_mgmt_active_slot(image); -#if !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) +#if !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) && \ + !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) enum img_mgmt_next_boot_type type = NEXT_BOOT_TYPE_NORMAL; int nbs = img_mgmt_get_next_boot_slot(image, &type); diff --git a/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c b/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c index 131f7a698b2d6..8d58a3b8634fb 100644 --- a/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/img_mgmt/src/zephyr_img_mgmt.c @@ -570,6 +570,7 @@ int img_mgmt_upload_inspect(const struct img_mgmt_upload_req *req, (defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_WITHOUT_SCRATCH) || \ defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_SCRATCH) || \ defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_OVERWRITE_ONLY) || \ + defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) || \ defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) || \ defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT)) && \ CONFIG_MCUBOOT_UPDATE_FOOTER_SIZE > 0 @@ -645,6 +646,7 @@ int img_mgmt_upload_inspect(const struct img_mgmt_upload_req *req, (defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_WITHOUT_SCRATCH) || \ defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_SCRATCH) || \ defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_OVERWRITE_ONLY) || \ + defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) || \ defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP) || \ defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT)) && \ CONFIG_MCUBOOT_UPDATE_FOOTER_SIZE > 0 From 525f2b91530296999b2fe22f2163dd91885b096c Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 24 Jul 2024 14:10:53 +0100 Subject: [PATCH 0681/4482] samples: mgmt: mcumgr: smp_svr: Add RAM load configuration Adds configuration for booting this sample in RAM load mode on nrf52840dk Signed-off-by: Jamie McCrae --- .../boards/nrf52840dk_nrf52840_ram_load.conf | 1 + .../nrf52840dk_nrf52840_ram_load.overlay | 17 +++++++ .../mgmt/mcumgr/smp_svr/prj_ram_load.conf | 48 +++++++++++++++++++ .../subsys/mgmt/mcumgr/smp_svr/sample.yaml | 23 +++++++++ .../mcumgr/smp_svr/sysbuild/CMakeLists.txt | 9 ++++ .../smp_svr/sysbuild/mcuboot_ram_load.conf | 9 ++++ ...f52840dk_nrf52840_mcuboot_ram_load.overlay | 25 ++++++++++ .../mcumgr/smp_svr/sysbuild_ram_load.conf | 3 ++ 8 files changed, 135 insertions(+) create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf52840dk_nrf52840_ram_load.conf create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf52840dk_nrf52840_ram_load.overlay create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/prj_ram_load.conf create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/CMakeLists.txt create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/mcuboot_ram_load.conf create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/nrf52840dk_nrf52840_mcuboot_ram_load.overlay create mode 100644 samples/subsys/mgmt/mcumgr/smp_svr/sysbuild_ram_load.conf diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf52840dk_nrf52840_ram_load.conf b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf52840dk_nrf52840_ram_load.conf new file mode 100644 index 0000000000000..4c12994e097ff --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf52840dk_nrf52840_ram_load.conf @@ -0,0 +1 @@ +CONFIG_RETAINED_MEM_NRF_GPREGRET=n diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf52840dk_nrf52840_ram_load.overlay b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf52840dk_nrf52840_ram_load.overlay new file mode 100644 index 0000000000000..2b59fce7065f3 --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/boards/nrf52840dk_nrf52840_ram_load.overlay @@ -0,0 +1,17 @@ +/delete-node/ &sram0; + +#include "../sysbuild/nrf52840dk_nrf52840_mcuboot_ram_load.overlay" + +/ { + chosen { + zephyr,flash = &flash0; + /delete-property/ zephyr,code-partition; + }; + + soc { + sram0: memory@20006000 { + compatible = "mmio-sram"; + reg = <0x20006000 DT_SIZE_K(200)>; + }; + }; +}; diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/prj_ram_load.conf b/samples/subsys/mgmt/mcumgr/smp_svr/prj_ram_load.conf new file mode 100644 index 0000000000000..20f347ae18846 --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/prj_ram_load.conf @@ -0,0 +1,48 @@ +# Enable MCUmgr and dependencies. +CONFIG_NET_BUF=y +CONFIG_ZCBOR=y +CONFIG_CRC=y +CONFIG_MCUMGR=y +CONFIG_STREAM_FLASH=y +CONFIG_FLASH_MAP=y + +# Some command handlers require a large stack. +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2304 +CONFIG_MAIN_STACK_SIZE=2048 + +# Ensure an MCUboot-compatible binary is generated. +CONFIG_BOOTLOADER_MCUBOOT=y + +# Enable flash operations. +CONFIG_FLASH=y + +# Required by the `taskstat` command. +CONFIG_THREAD_MONITOR=y + +# Support for taskstat command +CONFIG_MCUMGR_GRP_OS_TASKSTAT=y + +# Enable statistics and statistic names. +CONFIG_STATS=y +CONFIG_STATS_NAMES=y + +# Enable most core commands. +CONFIG_FLASH=y +CONFIG_IMG_MANAGER=y +CONFIG_MCUMGR_GRP_IMG=y +CONFIG_MCUMGR_GRP_OS=y +CONFIG_MCUMGR_GRP_STAT=y + +# Enable logging +CONFIG_LOG=y +CONFIG_MCUBOOT_UTIL_LOG_LEVEL_WRN=y + +# Disable debug logging +CONFIG_LOG_MAX_LEVEL=3 + +# Enable retained memory and retention +CONFIG_RETAINED_MEM=y +CONFIG_RETENTION=y +CONFIG_RETAINED_MEM_ZEPHYR_RAM=y +CONFIG_RETENTION_BOOTLOADER_INFO=y +CONFIG_RETENTION_BOOTLOADER_INFO_TYPE_MCUBOOT=y diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml index 13cd6d6a2996e..47a920139677f 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml @@ -158,3 +158,26 @@ tests: - mg100 integration_platforms: - nrf52840dk/nrf52840 + sample.mcumgr.smp_svr.ram_load: + sysbuild: true + extra_args: FILE_SUFFIX="ram_load" + platform_allow: + - nrf52840dk/nrf52840 + integration_platforms: + - nrf52840dk/nrf52840 + sample.mcumgr.smp_svr.ram_load.serial: + sysbuild: true + extra_args: FILE_SUFFIX="ram_load" + EXTRA_CONF_FILE="overlay-serial.conf" + platform_allow: + - nrf52840dk/nrf52840 + integration_platforms: + - nrf52840dk/nrf52840 + sample.mcumgr.smp_svr.ram_load.serial.fs.shell: + sysbuild: true + extra_args: FILE_SUFFIX="ram_load" + EXTRA_CONF_FILE="overlay-serial.conf;overlay-fs.conf;overlay-shell.conf" + platform_allow: + - nrf52840dk/nrf52840 + integration_platforms: + - nrf52840dk/nrf52840 diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/CMakeLists.txt b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/CMakeLists.txt new file mode 100644 index 0000000000000..7eb859ef46976 --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/CMakeLists.txt @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +if("${FILE_SUFFIX}" STREQUAL "ram_load") + set(mcuboot_EXTRA_DTC_OVERLAY_FILE "${CMAKE_CURRENT_LIST_DIR}/nrf52840dk_nrf52840_mcuboot_ram_load.overlay" CACHE INTERNAL "" FORCE) +endif() + +find_package(Sysbuild REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +project(sysbuild LANGUAGES) diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/mcuboot_ram_load.conf b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/mcuboot_ram_load.conf new file mode 100644 index 0000000000000..5ca1190413516 --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/mcuboot_ram_load.conf @@ -0,0 +1,9 @@ +CONFIG_SRAM_SIZE=30 +CONFIG_RETAINED_MEM=y +CONFIG_RETENTION=y +CONFIG_RETAINED_MEM_ZEPHYR_RAM=y +CONFIG_BOOT_SHARE_DATA=y +CONFIG_BOOT_SHARE_DATA_BOOTINFO=y +CONFIG_BOOT_SHARE_BACKEND_RETENTION=y +CONFIG_FLASH=y +CONFIG_FLASH_MAP=y diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/nrf52840dk_nrf52840_mcuboot_ram_load.overlay b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/nrf52840dk_nrf52840_mcuboot_ram_load.overlay new file mode 100644 index 0000000000000..70dd92d78d614 --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild/nrf52840dk_nrf52840_mcuboot_ram_load.overlay @@ -0,0 +1,25 @@ +/ { + sram@2003F000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x2003F000 DT_SIZE_K(1)>; + zephyr,memory-region = "RetainedMem"; + status = "okay"; + + retainedmem { + compatible = "zephyr,retained-ram"; + status = "okay"; + #address-cells = <1>; + #size-cells = <1>; + + boot_info0: boot_info@0 { + compatible = "zephyr,retention"; + status = "okay"; + reg = <0x0 0x100>; + }; + }; + }; + + chosen { + zephyr,bootloader-info = &boot_info0; + }; +}; diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild_ram_load.conf b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild_ram_load.conf new file mode 100644 index 0000000000000..e1579f439bb2b --- /dev/null +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sysbuild_ram_load.conf @@ -0,0 +1,3 @@ +# Enable MCUboot bootloader support and use RAM load mode +SB_CONFIG_BOOTLOADER_MCUBOOT=y +SB_CONFIG_MCUBOOT_MODE_RAM_LOAD=y From 3406515f1235bce6e277674c1e0e4a9caf76e368 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 10 Sep 2024 08:27:29 +0100 Subject: [PATCH 0682/4482] sysbuild: images: bootloader: Add RAM load note Adds a note about MCUboot RAM requirements for this Signed-off-by: Jamie McCrae --- share/sysbuild/images/bootloader/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/share/sysbuild/images/bootloader/Kconfig b/share/sysbuild/images/bootloader/Kconfig index 21cf49a4420ed..c9622e82f63e4 100644 --- a/share/sysbuild/images/bootloader/Kconfig +++ b/share/sysbuild/images/bootloader/Kconfig @@ -102,6 +102,9 @@ config MCUBOOT_MODE_RAM_LOAD from there. The image must be linked to execute from RAM, the address that it is copied to is specified using the load-addr argument when running imgtool. + Note: RAM must be assigned to the bootloader that is not used by the application in this + mode so that the bootloader is able to function until the application has booted. + config MCUBOOT_MODE_FIRMWARE_UPDATER bool "Firmware updater" help From 4235dbfd2b44ff664de41c4127c4ebc1c1005e2b Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Fri, 12 Jul 2024 21:33:43 +1000 Subject: [PATCH 0683/4482] fs: fatfs: add missing dependency Add a missing dependency on `!FS_FATFS_READ_ONLY`` for `FS_FATFS_MKFS`. Signed-off-by: Jordan Yates --- subsys/fs/Kconfig.fatfs | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/fs/Kconfig.fatfs b/subsys/fs/Kconfig.fatfs index 245405df45782..82450a9f20ee7 100644 --- a/subsys/fs/Kconfig.fatfs +++ b/subsys/fs/Kconfig.fatfs @@ -26,6 +26,7 @@ config FS_FATFS_READ_ONLY config FS_FATFS_MKFS bool "mkfs support for FAT FS" + depends on !FS_FATFS_READ_ONLY default y if FILE_SYSTEM_MKFS help Adds code for creating disks with FAT file system. From a1d6f8081a77d4ee1b3c4760e46885426a4df184 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Thu, 11 Jul 2024 14:58:16 +1000 Subject: [PATCH 0684/4482] fs: fatfs: additional ELM FAT options Make additional ELM FAT library options configurable to the user. Signed-off-by: Jordan Yates --- modules/fatfs/zephyr_fatfs_config.h | 13 +++++++++++++ subsys/fs/Kconfig.fatfs | 24 ++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/modules/fatfs/zephyr_fatfs_config.h b/modules/fatfs/zephyr_fatfs_config.h index 2ef391f638374..396f303ac0f7f 100644 --- a/modules/fatfs/zephyr_fatfs_config.h +++ b/modules/fatfs/zephyr_fatfs_config.h @@ -89,7 +89,11 @@ #define FF_FS_TINY 1 #undef FF_FS_NORTC +#if defined(CONFIG_FS_FATFS_HAS_RTC) +#define FF_FS_NORTC 0 +#else #define FF_FS_NORTC 1 +#endif /* defined(CONFIG_FS_FATFS_HAS_RTC) */ /* Zephyr uses FF_VOLUME_STRS */ #undef FF_STR_VOLUME_ID @@ -104,6 +108,15 @@ #undef FF_VOLUMES #define FF_VOLUMES 8 +#if defined(CONFIG_FS_FATFS_EXTRA_NATIVE_API) +#undef FF_USE_LABEL +#undef FF_USE_EXPAND +#undef FF_USE_FIND +#define FF_USE_LABEL 1 +#define FF_USE_EXPAND 1 +#define FF_USE_FIND 1 +#endif /* defined(CONFIG_FS_FATFS_EXTRA_NATIVE_API) */ + /* * Options provided below have been added to ELM FAT source code to * support Zephyr specific features, and are not part of ffconf.h. diff --git a/subsys/fs/Kconfig.fatfs b/subsys/fs/Kconfig.fatfs index 82450a9f20ee7..59bf3f7aa2da4 100644 --- a/subsys/fs/Kconfig.fatfs +++ b/subsys/fs/Kconfig.fatfs @@ -89,6 +89,30 @@ config FS_FATFS_NUM_DIRS at compile-time. This affects use of fs_opendir on FAT type mounted file systems. +config FS_FATFS_HAS_RTC + bool "Timestamping support" + help + Enable file system timestamping instead of using a hardcoded date + for all operations. Requires an application supplied implementation + of `get_fattime`. Format of the uint32_t bits are as follows: + 31:25 = Year from 1980 + 24:21 = Month (1..12) + 20:16 = Day of month (1..31) + 15:11 = Hour (0..23) + 10: 5 = Minute (0..59) + 4: 0 = Seconds/2 (0..29) + +config FS_FATFS_EXTRA_NATIVE_API + bool "Additional native API functions" + help + Enable the following additional native API functions that do not have + an equivalent in the Zephyr VFS API: + * `f_getlabel` + * `f_setlabel` + * `f_expand` + * `f_findfirst` + * `f_findnext` + config FS_FATFS_LFN bool "Long filenames (LFN)" help From 8746a2aa120e85cd0a6d319a49c1476342d7cebb Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Fri, 27 Sep 2024 10:12:25 +1000 Subject: [PATCH 0685/4482] tests: fs: fat_fs_api: add timestamp integration Add an example implementation of `get_fattime` to the API tests. Also ensure that `FS_FATFS_EXTRA_NATIVE_API` compiles in a test. Signed-off-by: Jordan Yates --- tests/subsys/fs/fat_fs_api/prj.conf | 3 +++ tests/subsys/fs/fat_fs_api/prj_lfn.conf | 1 + tests/subsys/fs/fat_fs_api/src/main.c | 16 ++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/tests/subsys/fs/fat_fs_api/prj.conf b/tests/subsys/fs/fat_fs_api/prj.conf index 5e22d035728e7..c5c7bb13384fe 100644 --- a/tests/subsys/fs/fat_fs_api/prj.conf +++ b/tests/subsys/fs/fat_fs_api/prj.conf @@ -6,3 +6,6 @@ CONFIG_DISK_DRIVER_FLASH=y CONFIG_ZTEST=y CONFIG_FLASH=y CONFIG_FLASH_MAP=y + +# Demonstrate filesystem time integration +CONFIG_FS_FATFS_HAS_RTC=y diff --git a/tests/subsys/fs/fat_fs_api/prj_lfn.conf b/tests/subsys/fs/fat_fs_api/prj_lfn.conf index eaa76d5d69526..7221a278c3625 100644 --- a/tests/subsys/fs/fat_fs_api/prj_lfn.conf +++ b/tests/subsys/fs/fat_fs_api/prj_lfn.conf @@ -3,6 +3,7 @@ CONFIG_FILE_SYSTEM_MKFS=y CONFIG_LOG=y CONFIG_FAT_FILESYSTEM_ELM=y CONFIG_FS_FATFS_LFN=y +CONFIG_FS_FATFS_EXTRA_NATIVE_API=y CONFIG_DISK_DRIVER_FLASH=y CONFIG_ZTEST=y CONFIG_FLASH=y diff --git a/tests/subsys/fs/fat_fs_api/src/main.c b/tests/subsys/fs/fat_fs_api/src/main.c index 30f73aa0d8a02..1913e99047f3f 100644 --- a/tests/subsys/fs/fat_fs_api/src/main.c +++ b/tests/subsys/fs/fat_fs_api/src/main.c @@ -5,11 +5,27 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include "test_fat.h" void test_fs_open_flags(void); const char *test_fs_open_flags_file_path = FATFS_MNTP"/the_file.txt"; +/* Time integration for filesystem */ +DWORD get_fattime(void) +{ + time_t unix_time = time(NULL); + struct tm *cal; + + /* Convert to calendar time */ + cal = localtime(&unix_time); + + /* From http://elm-chan.org/fsw/ff/doc/fattime.html */ + return (DWORD)(cal->tm_year - 80) << 25 | (DWORD)(cal->tm_mon + 1) << 21 | + (DWORD)cal->tm_mday << 16 | (DWORD)cal->tm_hour << 11 | (DWORD)cal->tm_min << 5 | + (DWORD)cal->tm_sec >> 1; +} + static void *fat_fs_basic_setup(void) { fs_file_t_init(&filep); From b0936ae35331c3218ed4d51477d95b06afe53ecd Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Mon, 24 Jun 2024 16:50:42 +0200 Subject: [PATCH 0686/4482] drivers: dp: swdp_bitbang: power optimization This patch changes GPIO initialization to be in PORT_OFF state by default. Also, if no transceiver is attached to the signals, the GPIOs are configured to be disconnected to preserve power. I tested this on a prototype board where we are going to have a debugger in a low-power context. Signed-off-by: Maximilian Deubel --- drivers/dp/swdp_bitbang.c | 118 ++++++++++++++++++++++---------------- 1 file changed, 68 insertions(+), 50 deletions(-) diff --git a/drivers/dp/swdp_bitbang.c b/drivers/dp/swdp_bitbang.c index 3e0b6a2ea0e34..a1d28386209fd 100644 --- a/drivers/dp/swdp_bitbang.c +++ b/drivers/dp/swdp_bitbang.c @@ -568,107 +568,125 @@ static int sw_configure(const struct device *dev, static int sw_port_on(const struct device *dev) { const struct sw_config *config = dev->config; - - gpio_pin_set_dt(&config->clk, 1); + int ret; if (config->dnoe.port) { - gpio_pin_set_dt(&config->dnoe, 1); + ret = gpio_pin_configure_dt(&config->dnoe, GPIO_OUTPUT_ACTIVE); + if (ret) { + return ret; + } } if (config->dout.port) { - gpio_pin_set_dt(&config->dout, 1); - } else { - int ret; - - ret = gpio_pin_configure_dt(&config->dio, GPIO_OUTPUT_ACTIVE); + ret = gpio_pin_configure_dt(&config->dout, GPIO_OUTPUT_ACTIVE); if (ret) { return ret; } } - if (config->noe.port) { - gpio_pin_set_dt(&config->noe, 1); - } - if (config->reset.port) { - gpio_pin_set_dt(&config->reset, 1); - } - - return 0; -} - -static int sw_port_off(const struct device *dev) -{ - const struct sw_config *config = dev->config; - - if (config->dnoe.port) { - gpio_pin_set_dt(&config->dnoe, 0); + ret = gpio_pin_configure_dt(&config->dio, GPIO_INPUT); + if (ret) { + return ret; } - if (config->dout.port) { - gpio_pin_set_dt(&config->dout, 0); - } else { - int ret; - - ret = gpio_pin_configure_dt(&config->dio, GPIO_INPUT); + if (config->noe.port) { + ret = gpio_pin_configure_dt(&config->noe, GPIO_OUTPUT_ACTIVE); if (ret) { return ret; } } - if (config->noe.port) { - gpio_pin_set_dt(&config->noe, 0); + ret = gpio_pin_configure_dt(&config->clk, GPIO_OUTPUT_ACTIVE); + if (ret) { + return ret; } - if (config->reset.port) { - gpio_pin_set_dt(&config->reset, 1); + + ret = gpio_pin_configure_dt(&config->reset, GPIO_OUTPUT_ACTIVE); + if (ret) { + return ret; } return 0; } -static int sw_gpio_init(const struct device *dev) +static int sw_port_off(const struct device *dev) { const struct sw_config *config = dev->config; - struct sw_cfg_data *sw_data = dev->data; int ret; - ret = gpio_pin_configure_dt(&config->clk, GPIO_OUTPUT_ACTIVE); - if (ret) { - return ret; - } + /* If there is a transceiver connected to IO, pins should always be driven. */ + if (config->dnoe.port) { + ret = gpio_pin_configure_dt(&config->dnoe, GPIO_OUTPUT_INACTIVE); + if (ret) { + return ret; + } - ret = gpio_pin_configure_dt(&config->dio, GPIO_INPUT); - if (ret) { - return ret; - } + if (config->dout.port) { + ret = gpio_pin_configure_dt(&config->dout, GPIO_OUTPUT_ACTIVE); + if (ret) { + return ret; + } + } - if (config->dout.port) { - ret = gpio_pin_configure_dt(&config->dout, GPIO_OUTPUT_ACTIVE); + ret = gpio_pin_configure_dt(&config->dio, GPIO_INPUT); if (ret) { return ret; } - } + } else { + if (config->dout.port) { + ret = gpio_pin_configure_dt(&config->dout, GPIO_DISCONNECTED); + if (ret) { + return ret; + } + } - if (config->dnoe.port) { - ret = gpio_pin_configure_dt(&config->dnoe, GPIO_OUTPUT_INACTIVE); + ret = gpio_pin_configure_dt(&config->dio, GPIO_DISCONNECTED); if (ret) { return ret; } } + /* If there is a transceiver connected to CLK, pins should always be driven. */ if (config->noe.port) { ret = gpio_pin_configure_dt(&config->noe, GPIO_OUTPUT_INACTIVE); if (ret) { return ret; } + + ret = gpio_pin_configure_dt(&config->clk, GPIO_OUTPUT_ACTIVE); + if (ret) { + return ret; + } + + } else { + ret = gpio_pin_configure_dt(&config->clk, GPIO_DISCONNECTED); + if (ret) { + return ret; + } } if (config->reset.port) { - ret = gpio_pin_configure_dt(&config->reset, GPIO_OUTPUT_ACTIVE); + ret = gpio_pin_configure_dt(&config->reset, GPIO_DISCONNECTED); if (ret) { return ret; } } + return 0; +} + +static int sw_gpio_init(const struct device *dev) +{ + const struct sw_config *config = dev->config; + struct sw_cfg_data *sw_data = dev->data; + int ret; + + /* start with the port turned off */ + ret = sw_port_off(dev); + if (ret) { + return ret; + } + sw_data->turnaround = 1U; sw_data->data_phase = false; sw_data->fast_clock = false; From da87952948e8c6e61f5d5bfe6feb929559895656 Mon Sep 17 00:00:00 2001 From: Moritz Geier Date: Fri, 21 Jun 2024 14:18:38 +0200 Subject: [PATCH 0687/4482] west: runners: stm32cubeprogrammer: Fixed behaivor if programmer is in path Enabled west commands to use CubeProgrammer installed in custom directory. Signed-off-by: Moritz Geier --- scripts/west_commands/runners/stm32cubeprogrammer.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/west_commands/runners/stm32cubeprogrammer.py b/scripts/west_commands/runners/stm32cubeprogrammer.py index 43d9a19adfa1a..b57a84f31869d 100644 --- a/scripts/west_commands/runners/stm32cubeprogrammer.py +++ b/scripts/west_commands/runners/stm32cubeprogrammer.py @@ -85,6 +85,10 @@ def _get_stm32cubeprogrammer_path() -> Path: ) if platform.system() == "Windows": + cmd = shutil.which("STM32_Programmer_CLI") + if cmd is not None: + return Path(cmd) + cli = ( Path("STMicroelectronics") / "STM32Cube" From c8c25b5c52a9dee347eae34137559bdbe48e4505 Mon Sep 17 00:00:00 2001 From: Yonatan Schachter Date: Wed, 20 Dec 2023 13:47:01 +0200 Subject: [PATCH 0688/4482] bindesc: Fix placing of the descriptors end tag Prior to this fix the descriptors end tag was placed in the binary using LONG. This was wrong because the tag is of type short, and the size of the descriptor (0), should have also been placed. It so happened that on little endian machines the incorrect linker script yielded correct results, as the extra zeros added to make the value a long ended up as the correct byte sequence (FF FF 00 00). On big endian machines however, the wrong sequence is generated (00 00 FF FF). This patch correct this issue. Signed-off-by: Yonatan Schachter --- doc/services/binary_descriptors/index.rst | 4 ++-- subsys/bindesc/bindesc.ld | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/services/binary_descriptors/index.rst b/doc/services/binary_descriptors/index.rst index 9cd6f8fe2ccd8..dab7ee61b11ff 100644 --- a/doc/services/binary_descriptors/index.rst +++ b/doc/services/binary_descriptors/index.rst @@ -62,8 +62,8 @@ Putting it all together, here is what the example above would look like in memor .. code-block:: - 46 60 a4 7e 5a 3e 86 b9 02 10 0d 00 48 65 6c 6c 6f 20 77 6f 72 6c 64 21 00 00 00 00 ff ff - | magic | tag |length| H e l l o w o r l d ! | pad | end | + 46 60 a4 7e 5a 3e 86 b9 02 10 0d 00 48 65 6c 6c 6f 20 77 6f 72 6c 64 21 00 00 00 00 ff ff 00 00 + | magic | tag |length| H e l l o w o r l d ! | pad | end | Usage ***** diff --git a/subsys/bindesc/bindesc.ld b/subsys/bindesc/bindesc.ld index e07222d5f1046..f29c2f4216ccd 100644 --- a/subsys/bindesc/bindesc.ld +++ b/subsys/bindesc/bindesc.ld @@ -10,4 +10,5 @@ SQUAD(BINDESC_MAGIC); Z_LINK_ITERABLE(bindesc_entry); . = ALIGN(BINDESC_ALIGNMENT); -LONG(BINDESC_TAG_DESCRIPTORS_END) +SHORT(BINDESC_TAG_DESCRIPTORS_END); +SHORT(0); From 5da7ba55aad402dd0472b4807a1a9b144c7f8180 Mon Sep 17 00:00:00 2001 From: Yonatan Schachter Date: Wed, 20 Dec 2023 18:03:59 +0200 Subject: [PATCH 0689/4482] west: bindesc: Added get_offset command Add `west bindesc get_offset` command to print the offset of the descriptors inside the given image. Signed-off-by: Yonatan Schachter --- doc/develop/west/zephyr-cmds.rst | 4 ++++ scripts/west_commands/bindesc.py | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/doc/develop/west/zephyr-cmds.rst b/doc/develop/west/zephyr-cmds.rst index 0ff913decc994..0c665c7f64a09 100644 --- a/doc/develop/west/zephyr-cmds.rst +++ b/doc/develop/west/zephyr-cmds.rst @@ -215,3 +215,7 @@ You can dump all of the descriptors in an image using:: You can list all known standard descriptor names using:: west bindesc list + +You can print the offset of the descriptors inside the image using:: + + west bindesc get_offset diff --git a/scripts/west_commands/bindesc.py b/scripts/west_commands/bindesc.py index d5e4b0843b795..64aacded4c629 100644 --- a/scripts/west_commands/bindesc.py +++ b/scripts/west_commands/bindesc.py @@ -145,6 +145,13 @@ def do_add_parser(self, parser_adder): list_parser = subparsers.add_parser('list', help='List all known descriptors') list_parser.set_defaults(subcmd='list', big_endian=False) + get_offset_parser = subparsers.add_parser('get_offset', help='Get the offset of the descriptors') + get_offset_parser.add_argument('file', type=str, help='Executable file') + get_offset_parser.add_argument('--file-type', type=str, choices=self.EXTENSIONS, + help='File type') + get_offset_parser.add_argument('-b', '--big-endian', action='store_true', + help='Target CPU is big endian') + get_offset_parser.set_defaults(subcmd='get_offset', big_endian=False) return parser def dump(self, args): @@ -188,6 +195,15 @@ def custom_search(self, args): custom_tag = self.bindesc_gen_tag(custom_type, int(args.id, 16)) self.common_search(args, custom_tag) + def get_offset(self, args): + image = self.get_image_data(args.file) + + magic = struct.pack('>Q' if self.is_big_endian else 'Q', self.MAGIC) + index = image.find(magic) + if index == -1: + log.die('Could not find binary descriptor magic') + log.inf(f'{index} {hex(index)}') + def do_run(self, args, _): if MISSING_REQUIREMENTS: raise RuntimeError('one or more Python dependencies were missing; ' From fd68fc486cdcaa2ef9e17747b3e403bb832b261f Mon Sep 17 00:00:00 2001 From: Yonatan Schachter Date: Wed, 20 Dec 2023 18:45:01 +0200 Subject: [PATCH 0690/4482] bindesc: Add maximum data size and assertion Add a Kconfig symbol to limit the maximum size of a descriptor's data, enforced by a build assertion. Signed-off-by: Yonatan Schachter --- include/zephyr/bindesc.h | 31 +++++++++++++++++++------------ subsys/bindesc/Kconfig | 9 +++++++++ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/include/zephyr/bindesc.h b/include/zephyr/bindesc.h index da8bcb48040e4..fa7cbd5a25d8e 100644 --- a/include/zephyr/bindesc.h +++ b/include/zephyr/bindesc.h @@ -171,12 +171,15 @@ extern "C" { * @param id Unique ID of the descriptor * @param value A string value for the descriptor */ -#define BINDESC_STR_DEFINE(name, id, value) \ - __BINDESC_ENTRY_DEFINE(name) = { \ - .tag = BINDESC_TAG(STR, id), \ - .len = (uint16_t)sizeof(value), \ - .data = value, \ - } +#define BINDESC_STR_DEFINE(name, id, value) \ + __BINDESC_ENTRY_DEFINE(name) = { \ + .tag = BINDESC_TAG(STR, id), \ + .len = (uint16_t)sizeof(value), \ + .data = value, \ + }; \ + BUILD_ASSERT(sizeof(value) <= CONFIG_BINDESC_DEFINE_MAX_DATA_SIZE, \ + "Bindesc " STRINGIFY(name) " exceeded maximum size, consider reducing the" \ + " size or changing CONFIG_BINDESC_DEFINE_MAX_DATA_SIZE. ") /** * @brief Define a binary descriptor of type uint. @@ -217,12 +220,16 @@ extern "C" { * @param id Unique ID of the descriptor * @param value A uint8_t array as data for the descriptor */ -#define BINDESC_BYTES_DEFINE(name, id, value) \ - __BINDESC_ENTRY_DEFINE(name) = { \ - .tag = BINDESC_TAG(BYTES, id), \ - .len = (uint16_t)sizeof((uint8_t [])__DEBRACKET value), \ - .data = __DEBRACKET value, \ - } +#define BINDESC_BYTES_DEFINE(name, id, value) \ + __BINDESC_ENTRY_DEFINE(name) = { \ + .tag = BINDESC_TAG(BYTES, id), \ + .len = (uint16_t)sizeof((uint8_t [])__DEBRACKET value), \ + .data = __DEBRACKET value, \ + }; \ + BUILD_ASSERT(sizeof((uint8_t [])__DEBRACKET value) <= \ + CONFIG_BINDESC_DEFINE_MAX_DATA_SIZE, \ + "Bindesc " STRINGIFY(name) " exceeded maximum size, consider reducing the" \ + " size or changing CONFIG_BINDESC_DEFINE_MAX_DATA_SIZE. ") /** * @brief Get the value of a string binary descriptor diff --git a/subsys/bindesc/Kconfig b/subsys/bindesc/Kconfig index e8c158b8c84f5..0ab1460771acc 100644 --- a/subsys/bindesc/Kconfig +++ b/subsys/bindesc/Kconfig @@ -20,6 +20,15 @@ source "subsys/bindesc/Kconfig.version" source "subsys/bindesc/Kconfig.build_time" source "subsys/bindesc/Kconfig.host_info" +config BINDESC_DEFINE_MAX_DATA_SIZE + int "Bindesc max data size" + range 4 $(UINT16_MAX) + default 128 + help + Determines the maximum size of a binary descriptor's data. The theoretical + limit to this value is the maximum value of a uint16_t (65535), in practice + it's recommened to keep this value much smaller for easier handling of the data. + endif # BINDESC_DEFINE endif # BINDESC From 00800d48180be4ca9205fdf988cc90051e835a55 Mon Sep 17 00:00:00 2001 From: Yonatan Schachter Date: Wed, 20 Dec 2023 19:06:14 +0200 Subject: [PATCH 0691/4482] bindesc: Add support for reading binary descriptors This commit adds support for reading and parsing binary descriptors. It can be used for reading the descriptors of another image, or for iterating over one's own descriptors. Signed-off-by: Yonatan Schachter --- include/zephyr/bindesc.h | 189 ++++++++++++++++++++++++++- subsys/bindesc/CMakeLists.txt | 2 + subsys/bindesc/Kconfig | 42 ++++++ subsys/bindesc/bindesc_read.c | 233 ++++++++++++++++++++++++++++++++++ 4 files changed, 461 insertions(+), 5 deletions(-) create mode 100644 subsys/bindesc/bindesc_read.c diff --git a/include/zephyr/bindesc.h b/include/zephyr/bindesc.h index fa7cbd5a25d8e..aed5edf1c952c 100644 --- a/include/zephyr/bindesc.h +++ b/include/zephyr/bindesc.h @@ -23,6 +23,8 @@ extern "C" { #define BINDESC_TYPE_STR 0x1 #define BINDESC_TYPE_BYTES 0x2 #define BINDESC_TYPE_DESCRIPTORS_END 0xf +/* sizeof ignores the data as it's a flexible array */ +#define BINDESC_ENTRY_HEADER_SIZE (sizeof(struct bindesc_entry)) /** * @brief Binary Descriptor Definition @@ -131,11 +133,18 @@ extern "C" { */ #define BINDESC_TAG(type, id) ((BINDESC_TYPE_##type & 0xf) << 12 | (id & 0x0fff)) +/** + * @brief Utility macro to get the type of a bindesc tag + * + * @param tag Tag to get the type of + */ +#define BINDESC_GET_TAG_TYPE(tag) ((tag >> 12) & 0xf) + /** * @endcond */ -#if !defined(_LINKER) +#if !defined(_LINKER) || defined(__DOXYGEN__) #include @@ -278,6 +287,10 @@ extern "C" { */ #define BINDESC_GET_SIZE(name) BINDESC_NAME(name).len +/** + * @} + */ + /* * An entry of the binary descriptor header. Each descriptor is * described by one of these entries. @@ -301,6 +314,176 @@ BUILD_ASSERT(offsetof(struct bindesc_entry, tag) == 0, "Incorrect memory layout" BUILD_ASSERT(offsetof(struct bindesc_entry, len) == 2, "Incorrect memory layout"); BUILD_ASSERT(offsetof(struct bindesc_entry, data) == 4, "Incorrect memory layout"); +struct bindesc_handle { + const uint8_t *address; + enum { + BINDESC_HANDLE_TYPE_RAM, + BINDESC_HANDLE_TYPE_MEMORY_MAPPED_FLASH, + BINDESC_HANDLE_TYPE_FLASH, + } type; + size_t size_limit; +#if IS_ENABLED(CONFIG_BINDESC_READ_FLASH) + const struct device *flash_device; + uint8_t buffer[sizeof(struct bindesc_entry) + + CONFIG_BINDESC_READ_FLASH_MAX_DATA_SIZE] __aligned(BINDESC_ALIGNMENT); +#endif /* IS_ENABLED(CONFIG_BINDESC_READ_FLASH) */ +}; + +/** + * @brief Reading Binary Descriptors of other images. + * @defgroup bindesc_read Bindesc Read + * @ingroup os_services + * @{ + */ + +/** + * @brief Callback type to be called on descriptors found during a walk + * + * @param entry Current descriptor + * @param user_data The user_data given to @ref bindesc_foreach + * + * @return Any non zero value will halt the walk + */ +typedef int (*bindesc_callback_t)(const struct bindesc_entry *entry, void *user_data); + +/** + * @brief Open an image's binary descriptors for reading, from a memory mapped flash + * + * @details + * Initializes a bindesc handle for subsequent calls to bindesc API. + * Memory mapped flash is any flash that can be directly accessed by the CPU, + * without needing to use the flash API for copying the data to RAM. + * + * @param handle Bindesc handle to be given to subsequent calls + * @param offset The offset from the beginning of the flash that the bindesc magic can be found at + * + * @retval 0 On success + * @retval -ENOENT If no bindesc magic was found at the given offset + */ +int bindesc_open_memory_mapped_flash(struct bindesc_handle *handle, size_t offset); + +/** + * @brief Open an image's binary descriptors for reading, from RAM + * + * @details + * Initializes a bindesc handle for subsequent calls to bindesc API. + * It's assumed that the whole bindesc context was copied to RAM prior to calling + * this function, either by the user or by a bootloader. + * + * @note The given address must be aligned to BINDESC_ALIGNMENT + * + * @param handle Bindesc handle to be given to subsequent calls + * @param address The address that the bindesc magic can be found at + * @param max_size Maximum size of the given buffer + * + * @retval 0 On success + * @retval -ENOENT If no bindesc magic was found at the given address + * @retval -EINVAL If the given address is not aligned + */ +int bindesc_open_ram(struct bindesc_handle *handle, const uint8_t *address, size_t max_size); + +/** + * @brief Open an image's binary descriptors for reading, from flash + * + * @details + * Initializes a bindesc handle for subsequent calls to bindesc API. + * As opposed to reading bindesc from RAM or memory mapped flash, this + * backend requires reading the data from flash to an internal buffer + * using the flash API + * + * @param handle Bindesc handle to be given to subsequent calls + * @param offset The offset from the beginning of the flash that the bindesc magic can be found at + * @param flash_device Flash device to read descriptors from + * + * @retval 0 On success + * @retval -ENOENT If no bindesc magic was found at the given offset + */ +int bindesc_open_flash(struct bindesc_handle *handle, size_t offset, + const struct device *flash_device); + +/** + * @brief Walk the binary descriptors and run a user defined callback on each of them + * + * @note + * If the callback returns a non zero value, the walk stops. + * + * @param handle An initialized bindesc handle + * @param callback A user defined callback to be called on each descriptor + * @param user_data User defined data to be given to the callback + * + * @return If the walk was finished prematurely by the callback, + * return the callback's retval, zero otherwise + */ +int bindesc_foreach(struct bindesc_handle *handle, bindesc_callback_t callback, void *user_data); + +/** + * @brief Find a specific descriptor of type string + * + * @warning + * When using the flash backend, result will be invalidated by the next call to any bindesc API. + * Use the value immediately or copy it elsewhere. + * + * @param handle An initialized bindesc handle + * @param id ID to search for + * @param result Pointer to the found string + * + * @retval 0 If the descriptor was found + * @retval -ENOENT If the descriptor was not found + */ +int bindesc_find_str(struct bindesc_handle *handle, uint16_t id, const char **result); + +/** + * @brief Find a specific descriptor of type uint + * + * @warning + * When using the flash backend, result will be invalidated by the next call to any bindesc API. + * Use the value immediately or copy it elsewhere. + * + * @param handle An initialized bindesc handle + * @param id ID to search for + * @param result Pointer to the found uint + * + * @retval 0 If the descriptor was found + * @retval -ENOENT If the descriptor was not found + */ +int bindesc_find_uint(struct bindesc_handle *handle, uint16_t id, const uint32_t **result); + +/** + * @brief Find a specific descriptor of type bytes + * + * @warning + * When using the flash backend, result will be invalidated by the next call to any bindesc API. + * Use the value immediately or copy it elsewhere. + * + * @param handle An initialized bindesc handle + * @param id ID to search for + * @param result Pointer to the found bytes + * @param result_size Size of the found bytes + * + * @retval 0 If the descriptor was found + * @retval -ENOENT If the descriptor was not found + */ +int bindesc_find_bytes(struct bindesc_handle *handle, uint16_t id, const uint8_t **result, + size_t *result_size); + +/** + * @brief Get the size of an image's binary descriptors + * + * @details + * Walks the binary descriptor structure to caluculate the total size of the structure + * in bytes. This is useful, for instance, if the whole structure is to be copied to RAM. + * + * @param handle An initialized bindesc handle + * @param result Pointer to write result to + * + * @return 0 On success, negative errno otherwise + */ +int bindesc_get_size(struct bindesc_handle *handle, size_t *result); + +/** + * @} + */ + #if defined(CONFIG_BINDESC_KERNEL_VERSION_STRING) extern const struct bindesc_entry BINDESC_NAME(kernel_version_string); #endif /* defined(CONFIG_BINDESC_KERNEL_VERSION_STRING) */ @@ -411,10 +594,6 @@ extern const struct bindesc_entry BINDESC_NAME(cxx_compiler_version); #endif /* !defined(_LINKER) */ -/** - * @} - */ - #ifdef __cplusplus } #endif diff --git a/subsys/bindesc/CMakeLists.txt b/subsys/bindesc/CMakeLists.txt index c597eddd3deff..b9a5a312fbcd6 100644 --- a/subsys/bindesc/CMakeLists.txt +++ b/subsys/bindesc/CMakeLists.txt @@ -66,3 +66,5 @@ if(CONFIG_BINDESC_DEFINE_HOST_INFO) gen_str_definition(CXX_COMPILER_NAME ${CMAKE_CXX_COMPILER_ID}) gen_str_definition(CXX_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION}) endif() + +zephyr_library_sources_ifdef(CONFIG_BINDESC_READ bindesc_read.c) diff --git a/subsys/bindesc/Kconfig b/subsys/bindesc/Kconfig index 0ab1460771acc..50de5286d6b5d 100644 --- a/subsys/bindesc/Kconfig +++ b/subsys/bindesc/Kconfig @@ -31,4 +31,46 @@ config BINDESC_DEFINE_MAX_DATA_SIZE endif # BINDESC_DEFINE +config BINDESC_READ + bool "Binary Descriptors Read" + help + Enable the app to read the binary descriptors of another image + +if BINDESC_READ + +module = BINDESC_READ +module-str = Binary Descriptor read +source "subsys/logging/Kconfig.template.log_config" + +config BINDESC_READ_RAM + bool "Bindesc read from RAM" + help + Enable reading and parsing binary descriptors from RAM. + +config BINDESC_READ_MEMORY_MAPPED_FLASH + bool "Bindesc read from memory mapped flash" + help + Enable reading and parsing binary descriptors from memory mapped flash. + +config BINDESC_READ_FLASH + bool "Bindesc read from flash" + help + Enable reading and parsing binary descriptors from non memory mapped flash + (e.g. external flash). + +if BINDESC_READ_FLASH + +config BINDESC_READ_FLASH_MAX_DATA_SIZE + int "Bindesc read flash max data size" + range 4 $(UINT16_MAX) + default 128 + help + The maximum expected size of the descriptors' data. This should be set to + the value set to BINDESC_DEFINE_MAX_DATA_SIZE by the read image. + Any descriptor that exceeds this size will be ignored. + +endif # BINDESC_READ_FLASH + +endif # BINDESC_READ + endif # BINDESC diff --git a/subsys/bindesc/bindesc_read.c b/subsys/bindesc/bindesc_read.c new file mode 100644 index 0000000000000..41056396277c0 --- /dev/null +++ b/subsys/bindesc/bindesc_read.c @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2023 Yonatan Schachter + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +LOG_MODULE_REGISTER(bindesc_read, CONFIG_BINDESC_READ_LOG_LEVEL); + +struct find_user_data { + const void *result; + size_t size; + uint16_t tag; +}; + +/** + * A callback used by the bindesc_find_* functions. + */ +static int find_callback(const struct bindesc_entry *entry, void *user_data) +{ + struct find_user_data *data = (struct find_user_data *)user_data; + + if (data->tag == entry->tag) { + data->result = (const void *)&(entry->data); + data->size = entry->len; + return 1; + } + + return 0; +} + +/** + * A callback used by the bindesc_get_size function. + */ +static int get_size_callback(const struct bindesc_entry *entry, void *user_data) +{ + size_t *result = (size_t *)user_data; + + *result += WB_UP(BINDESC_ENTRY_HEADER_SIZE + entry->len); + + return 0; +} + +/** + * This helper function is used to abstract the different methods of reading + * data from the binary descriptors. + * For RAM and memory mapped flash, the implementation is very simple, as both + * are memory mapped and can simply return a pointer to the data. + * Flash is more complex because it needs to read the data from flash, and do + * error checking. + */ +static inline int get_entry(struct bindesc_handle *handle, const uint8_t *address, + const struct bindesc_entry **entry) +{ + int retval = 0; + int flash_retval; + + /* Check if reading from flash is enabled, if not, this if/else will be optimized out */ + if (IS_ENABLED(CONFIG_BINDESC_READ_FLASH) && handle->type == BINDESC_HANDLE_TYPE_FLASH) { + flash_retval = flash_read(handle->flash_device, (size_t)address, + handle->buffer, BINDESC_ENTRY_HEADER_SIZE); + if (flash_retval) { + LOG_ERR("Flash read error: %d", flash_retval); + return -EIO; + } + + /* Make sure buffer is large enough for the data */ + if (((const struct bindesc_entry *)handle->buffer)->len + BINDESC_ENTRY_HEADER_SIZE + > sizeof(handle->buffer)) { + LOG_WRN("Descriptor too large to copy, skipping"); + retval = -ENOMEM; + } else { + flash_retval = flash_read(handle->flash_device, + (size_t)address + BINDESC_ENTRY_HEADER_SIZE, + handle->buffer + BINDESC_ENTRY_HEADER_SIZE, + ((const struct bindesc_entry *)handle->buffer)->len); + if (flash_retval) { + LOG_ERR("Flash read error: %d", flash_retval); + return -EIO; + } + } + *entry = (const struct bindesc_entry *)handle->buffer; + } else { + *entry = (const struct bindesc_entry *)address; + } + + return retval; +} + +#if IS_ENABLED(CONFIG_BINDESC_READ_MEMORY_MAPPED_FLASH) +int bindesc_open_memory_mapped_flash(struct bindesc_handle *handle, size_t offset) +{ + uint8_t *address = (uint8_t *)CONFIG_FLASH_BASE_ADDRESS + offset; + + if (*(uint64_t *)address != BINDESC_MAGIC) { + LOG_ERR("Magic not found in given address"); + return -ENOENT; + } + + handle->address = address; + handle->type = BINDESC_HANDLE_TYPE_MEMORY_MAPPED_FLASH; + handle->size_limit = UINT16_MAX; + return 0; +} +#endif /* IS_ENABLED(CONFIG_BINDESC_READ_RAM) */ + +#if IS_ENABLED(CONFIG_BINDESC_READ_RAM) +int bindesc_open_ram(struct bindesc_handle *handle, const uint8_t *address, size_t max_size) +{ + if (!IS_ALIGNED(address, BINDESC_ALIGNMENT)) { + LOG_ERR("Given address is not aligned"); + return -EINVAL; + } + + if (*(uint64_t *)address != BINDESC_MAGIC) { + LOG_ERR("Magic not found in given address"); + return -ENONET; + } + + handle->address = address; + handle->type = BINDESC_HANDLE_TYPE_RAM; + handle->size_limit = max_size; + return 0; +} +#endif /* IS_ENABLED(CONFIG_BINDESC_READ_RAM) */ + +#if IS_ENABLED(CONFIG_BINDESC_READ_FLASH) +int bindesc_open_flash(struct bindesc_handle *handle, size_t offset, + const struct device *flash_device) +{ + int retval; + + retval = flash_read(flash_device, offset, handle->buffer, sizeof(BINDESC_MAGIC)); + if (retval) { + LOG_ERR("Flash read error: %d", retval); + return -EIO; + } + + if (*(uint64_t *)handle->buffer != BINDESC_MAGIC) { + LOG_ERR("Magic not found in given address"); + return -ENOENT; + } + + handle->address = (uint8_t *)offset; + handle->type = BINDESC_HANDLE_TYPE_FLASH; + handle->flash_device = flash_device; + handle->size_limit = UINT16_MAX; + return 0; +} +#endif /* IS_ENABLED(CONFIG_BINDESC_READ_FLASH) */ + +int bindesc_foreach(struct bindesc_handle *handle, bindesc_callback_t callback, void *user_data) +{ + const struct bindesc_entry *entry; + const uint8_t *address = handle->address; + int retval; + + address += sizeof(BINDESC_MAGIC); + + do { + retval = get_entry(handle, address, &entry); + if (retval == -EIO) { + return -EIO; + } + address += WB_UP(BINDESC_ENTRY_HEADER_SIZE + entry->len); + if (retval) { + continue; + } + + retval = callback(entry, user_data); + if (retval) { + return retval; + } + } while ((entry->tag != BINDESC_TAG_DESCRIPTORS_END) && + ((address - handle->address) <= handle->size_limit)); + + return 0; +} + +int bindesc_find_str(struct bindesc_handle *handle, uint16_t id, const char **result) +{ + struct find_user_data data = { + .tag = BINDESC_TAG(STR, id), + }; + + if (!bindesc_foreach(handle, find_callback, &data)) { + LOG_WRN("The requested descriptor was not found"); + return -ENOENT; + } + *result = (char *)data.result; + return 0; +} + +int bindesc_find_uint(struct bindesc_handle *handle, uint16_t id, const uint32_t **result) +{ + struct find_user_data data = { + .tag = BINDESC_TAG(UINT, id), + }; + + if (!bindesc_foreach(handle, find_callback, &data)) { + LOG_WRN("The requested descriptor was not found"); + return -ENOENT; + } + *result = (const uint32_t *)data.result; + return 0; +} + +int bindesc_find_bytes(struct bindesc_handle *handle, uint16_t id, const uint8_t **result, + size_t *result_size) +{ + struct find_user_data data = { + .tag = BINDESC_TAG(BYTES, id), + }; + + if (!bindesc_foreach(handle, find_callback, &data)) { + LOG_WRN("The requested descriptor was not found"); + return -ENOENT; + } + *result = (const uint8_t *)data.result; + *result_size = data.size; + return 0; +} + +int bindesc_get_size(struct bindesc_handle *handle, size_t *result) +{ + *result = sizeof(BINDESC_MAGIC); + + return bindesc_foreach(handle, get_size_callback, result); +} From 41e1c436e57d2a42caebea4bb15ba381dcc58c40 Mon Sep 17 00:00:00 2001 From: Yonatan Schachter Date: Wed, 20 Dec 2023 19:10:27 +0200 Subject: [PATCH 0692/4482] doc: bindesc: Add documentation for bindesc read Added documentation for reading binary descriptors. Signed-off-by: Yonatan Schachter --- doc/services/binary_descriptors/index.rst | 43 +++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/doc/services/binary_descriptors/index.rst b/doc/services/binary_descriptors/index.rst index dab7ee61b11ff..d25e5b693440e 100644 --- a/doc/services/binary_descriptors/index.rst +++ b/doc/services/binary_descriptors/index.rst @@ -113,6 +113,47 @@ name is the Kconfig name (with ``CONFIG_BINDESC_`` removed) in lower case. For e ``CONFIG_BINDESC_KERNEL_VERSION_STRING`` creates a descriptor that can be accessed using ``BINDESC_GET_STR(kernel_version_string)``. +Reading Descriptors +=================== +It's also possible to read and parse binary descriptors from an application. +This can be useful both for an image trying to read its own descriptors, and for +an image trying to read another image's descriptors. Reading can be performed through +one of three backends: + + #. RAM - assuming the descriptors have been copied to RAM (e.g. by a bootloader), they + can be read from the buffer they reside in. + + #. Memory mapped flash - If the flash where the image to be read resides in flash and is + accessible through the program's address space, it can be read directly from flash. + This option uses the least amount of RAM, but will not work if the flash is not memory mapped, + and is not recommended to read a bootloader's descriptors for security concerns. + + #. Flash - Using an internal buffer, the descriptors are read one by one using the flash API, + and given to the user while they're in the buffer. + +To enable reading descriptors, enable :kconfig:option:`CONFIG_BINDESC_READ`. The three backends are +enabled by these Kconfig symbols, respectively: :kconfig:option:`CONFIG_BINDESC_READ_RAM`, +:kconfig:option:`CONFIG_BINDESC_READ_MEMORY_MAPPED_FLASH`, and :kconfig:option:`CONFIG_BINDESC_READ_FLASH`. + +To read the descriptors, a handle to the descriptors should first be initialized: + +.. code-block:: c + + struct bindesc_handle handle; + + /* Assume buffer holds a copy of the descriptors */ + bindesc_open_ram(&handle, buffer); + +The ``bindesc_open_*`` functions are the only functions concerned with the backend used. +The rest of the API is agnostic to where the data is. After the handle has been initialized, +it can be used with the rest of the API: + +.. code-block:: c + + char *version; + bindesc_find_str(&handle, BINDESC_ID_KERNEL_VERSION_STRING, &version); + printk("Kernel version: %s\n", version); + west bindesc tool ================= ``west`` is able to parse and display binary descriptors from a given executable image. @@ -123,3 +164,5 @@ API Reference ************* .. doxygengroup:: bindesc_define + +.. doxygengroup:: bindesc_read From 31fe9645ea4d474403d3c9985204a1adb252d86d Mon Sep 17 00:00:00 2001 From: Yonatan Schachter Date: Thu, 21 Dec 2023 00:10:52 +0200 Subject: [PATCH 0693/4482] tests: Add tests for bindesc reading Added tests for bindesc reading, to test reading on multiple C/C++ standards. Only RAM and flash backends are tested, as the flash simulator can't simulate a memory mapped flash. Signed-off-by: Yonatan Schachter --- tests/subsys/bindesc/reading/CMakeLists.txt | 10 +++ tests/subsys/bindesc/reading/prj.conf | 11 +++ tests/subsys/bindesc/reading/src/main.c | 84 +++++++++++++++++++++ tests/subsys/bindesc/reading/testcase.yaml | 23 ++++++ 4 files changed, 128 insertions(+) create mode 100644 tests/subsys/bindesc/reading/CMakeLists.txt create mode 100644 tests/subsys/bindesc/reading/prj.conf create mode 100644 tests/subsys/bindesc/reading/src/main.c create mode 100644 tests/subsys/bindesc/reading/testcase.yaml diff --git a/tests/subsys/bindesc/reading/CMakeLists.txt b/tests/subsys/bindesc/reading/CMakeLists.txt new file mode 100644 index 0000000000000..4a1a0136fed03 --- /dev/null +++ b/tests/subsys/bindesc/reading/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright 2023 Yonatan Schachter +# +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(bindesc) + +target_sources(app PRIVATE src/main.c) diff --git a/tests/subsys/bindesc/reading/prj.conf b/tests/subsys/bindesc/reading/prj.conf new file mode 100644 index 0000000000000..02d7c9e49f918 --- /dev/null +++ b/tests/subsys/bindesc/reading/prj.conf @@ -0,0 +1,11 @@ +# Copyright 2023 Yonatan Schachter +# +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_ZTEST=y +CONFIG_FLASH=y + +CONFIG_BINDESC=y +CONFIG_BINDESC_READ=y +CONFIG_BINDESC_READ_FLASH=y +CONFIG_BINDESC_READ_RAM=y diff --git a/tests/subsys/bindesc/reading/src/main.c b/tests/subsys/bindesc/reading/src/main.c new file mode 100644 index 0000000000000..ca8a534c567ca --- /dev/null +++ b/tests/subsys/bindesc/reading/src/main.c @@ -0,0 +1,84 @@ +/* + * Copyright 2023 Yonatan Schachter + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#ifdef CONFIG_ARCH_POSIX +#define SOC_NV_FLASH_NODE DT_CHILD(DT_INST(0, zephyr_sim_flash), flash_0) +#else +#define SOC_NV_FLASH_NODE DT_CHILD(DT_INST(0, zephyr_sim_flash), flash_sim_0) +#endif /* CONFIG_ARCH_POSIX */ + +#if (defined(CONFIG_ARCH_POSIX) || defined(CONFIG_BOARD_QEMU_X86)) +static const struct device *const flash_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_flash_controller)); +#else +static const struct device *const flash_dev = DEVICE_DT_GET(DT_NODELABEL(sim_flash_controller)); +#endif + +#define FLASH_SIMULATOR_ERASE_UNIT DT_PROP(SOC_NV_FLASH_NODE, erase_block_size) + +static __aligned(BINDESC_ALIGNMENT) const uint8_t descriptors[] = { + 0x46, 0x60, 0xa4, 0x7e, 0x5a, 0x3e, 0x86, 0xb9, /* magic */ + 0x00, 0x18, 0x06, 0x00, /* tag: 0x1800 (app version string), length: 0x0006 */ + 0x31, 0x2e, 0x30, 0x2e, 0x30, 0x00, /* "1.0.0" */ + 0x00, 0x00, /* padding */ + 0x01, 0x1b, 0x04, 0x00, /* tag: 0x1b01 (compiler name), length: 0x0004 */ + 0x47, 0x4e, 0x55, 0x00, /* "GNU" */ + 0x02, 0x1b, 0x07, 0x00, /* tag: 0x1b02 (compiler version), length: 0x0007 */ + 0x31, 0x32, 0x2e, 0x32, 0x2e, 0x30, 0x00, /* "12.2.0" */ + 0x00, /* padding */ + 0x00, 0x19, 0x07, 0x00, /* tag: 0x1900 (kernel version string), length: 0x0007 */ + 0x33, 0x2e, 0x35, 0x2e, 0x39, 0x39, 0x00, /* "3.5.99" */ + 0x00, /* padding */ + 0xff, 0xff, 0x00, 0x00, /* tag: 0xffff (descriptors end), length: 0x0000 */ +}; + +static void *test_setup(void) +{ + flash_erase(flash_dev, 0, FLASH_SIMULATOR_ERASE_UNIT); + flash_write(flash_dev, 0, descriptors, sizeof(descriptors)); + + return NULL; +} + +static void test_bindesc_read(struct bindesc_handle *handle) +{ + const char *result; + + bindesc_find_str(handle, BINDESC_ID_KERNEL_VERSION_STRING, &result); + zassert_mem_equal("3.5.99", result, sizeof("3.5.99")); + + bindesc_find_str(handle, BINDESC_ID_APP_VERSION_STRING, &result); + zassert_mem_equal("1.0.0", result, sizeof("1.0.0")); + + bindesc_find_str(handle, BINDESC_ID_C_COMPILER_NAME, &result); + zassert_mem_equal("GNU", result, sizeof("GNU")); + + bindesc_find_str(handle, BINDESC_ID_C_COMPILER_VERSION, &result); + zassert_mem_equal("12.2.0", result, sizeof("12.2.0")); +} + +ZTEST(bindesc_read, test_bindesc_read_from_flash) +{ + struct bindesc_handle handle; + + bindesc_open_flash(&handle, 0, flash_dev); + + test_bindesc_read(&handle); +} + +ZTEST(bindesc_read, test_bindesc_read_from_ram) +{ + struct bindesc_handle handle; + + bindesc_open_ram(&handle, descriptors, sizeof(descriptors)); + + test_bindesc_read(&handle); +} + +ZTEST_SUITE(bindesc_read, NULL, test_setup, NULL, NULL, NULL); diff --git a/tests/subsys/bindesc/reading/testcase.yaml b/tests/subsys/bindesc/reading/testcase.yaml new file mode 100644 index 0000000000000..78d665eafa7f3 --- /dev/null +++ b/tests/subsys/bindesc/reading/testcase.yaml @@ -0,0 +1,23 @@ +common: + platform_allow: + - native_sim + integration_platforms: + - native_sim + tags: bindesc +tests: + bindesc.read: + platform_allow: + - native_posix + - native_sim + bindesc.read.c99: + extra_args: CSTD="c99" + bindesc.read.c11: + extra_args: CSTD="c11" + bindesc.read.c17: + extra_args: CSTD="c17" + bindesc.read.gnu99: + extra_args: CSTD="gnu99" + bindesc.read.gnu11: + extra_args: CSTD="gnu11" + bindesc.read.gnu17: + extra_args: CSTD="gnu17" From 9472f845b80c6b36c83bf8b298a5513d4a2b2901 Mon Sep 17 00:00:00 2001 From: Yonatan Schachter Date: Thu, 21 Dec 2023 01:07:24 +0200 Subject: [PATCH 0694/4482] samples: Add read_bindesc sample Added a sample to demonstrate how to read binary descriptors. Signed-off-by: Yonatan Schachter --- .../bindesc/read_bindesc/CMakeLists.txt | 8 ++ .../subsys/bindesc/read_bindesc/README.rst | 23 ++++ samples/subsys/bindesc/read_bindesc/VERSION | 5 + samples/subsys/bindesc/read_bindesc/prj.conf | 24 ++++ .../subsys/bindesc/read_bindesc/sample.yaml | 13 ++ .../subsys/bindesc/read_bindesc/src/main.c | 126 ++++++++++++++++++ 6 files changed, 199 insertions(+) create mode 100644 samples/subsys/bindesc/read_bindesc/CMakeLists.txt create mode 100644 samples/subsys/bindesc/read_bindesc/README.rst create mode 100644 samples/subsys/bindesc/read_bindesc/VERSION create mode 100644 samples/subsys/bindesc/read_bindesc/prj.conf create mode 100644 samples/subsys/bindesc/read_bindesc/sample.yaml create mode 100644 samples/subsys/bindesc/read_bindesc/src/main.c diff --git a/samples/subsys/bindesc/read_bindesc/CMakeLists.txt b/samples/subsys/bindesc/read_bindesc/CMakeLists.txt new file mode 100644 index 0000000000000..3e70363ba3129 --- /dev/null +++ b/samples/subsys/bindesc/read_bindesc/CMakeLists.txt @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(hello_bindesc) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/subsys/bindesc/read_bindesc/README.rst b/samples/subsys/bindesc/read_bindesc/README.rst new file mode 100644 index 0000000000000..f1b27e578712a --- /dev/null +++ b/samples/subsys/bindesc/read_bindesc/README.rst @@ -0,0 +1,23 @@ +.. zephyr:code-sample:: read-bindesc + :name: Binary descriptors read + :relevant-api: bindesc_read + + Define some binary descriptors and read them. + +Overview +******** + +A simple sample of :ref:`binary descriptor ` definition and reading. + +Building and Running +******************** + +Follow these steps to build the ``read_bindesc`` sample application: + +.. zephyr-app-commands:: + :zephyr-app: samples/subsys/bindesc/read_bindesc + :board: + :goals: build + :compact: + +For more details see :ref:`binary_descriptors` and :ref:`west-bindesc`. diff --git a/samples/subsys/bindesc/read_bindesc/VERSION b/samples/subsys/bindesc/read_bindesc/VERSION new file mode 100644 index 0000000000000..16a13732e3adf --- /dev/null +++ b/samples/subsys/bindesc/read_bindesc/VERSION @@ -0,0 +1,5 @@ +VERSION_MAJOR = 1 +VERSION_MINOR = 0 +PATCHLEVEL = 0 +VERSION_TWEAK = 0 +EXTRAVERSION = diff --git a/samples/subsys/bindesc/read_bindesc/prj.conf b/samples/subsys/bindesc/read_bindesc/prj.conf new file mode 100644 index 0000000000000..a2051bb785dd9 --- /dev/null +++ b/samples/subsys/bindesc/read_bindesc/prj.conf @@ -0,0 +1,24 @@ +# Enable binary descriptors +CONFIG_BINDESC=y + +# Enable definition of binary descriptors +CONFIG_BINDESC_DEFINE=y + +# Enable default version binary descriptors +CONFIG_BINDESC_DEFINE_VERSION=y +CONFIG_BINDESC_KERNEL_VERSION_STRING=y +CONFIG_BINDESC_KERNEL_VERSION_MAJOR=y + +CONFIG_BINDESC_APP_VERSION_STRING=y + +# Enable default host info binary descriptors +CONFIG_BINDESC_DEFINE_HOST_INFO=y +CONFIG_BINDESC_C_COMPILER_NAME=y +CONFIG_BINDESC_C_COMPILER_VERSION=y + +# Enable bindesc reading +CONFIG_BINDESC_READ=y +CONFIG_FLASH=y +CONFIG_BINDESC_READ_FLASH=y +CONFIG_BINDESC_READ_RAM=y +CONFIG_BINDESC_READ_MEMORY_MAPPED_FLASH=y diff --git a/samples/subsys/bindesc/read_bindesc/sample.yaml b/samples/subsys/bindesc/read_bindesc/sample.yaml new file mode 100644 index 0000000000000..d6fafc34a745b --- /dev/null +++ b/samples/subsys/bindesc/read_bindesc/sample.yaml @@ -0,0 +1,13 @@ +sample: + name: Bindesc read + +common: + build_only: true + platform_exclude: + - nucleo_c031c6 + +tests: + sample.bindesc.read_bindesc: + tags: bindesc + filter: dt_chosen_enabled("zephyr,flash-controller") and CONFIG_FLASH_HAS_DRIVER_ENABLED + and CONFIG_ARCH_SUPPORTS_ROM_START diff --git a/samples/subsys/bindesc/read_bindesc/src/main.c b/samples/subsys/bindesc/read_bindesc/src/main.c new file mode 100644 index 0000000000000..f44d314e50d54 --- /dev/null +++ b/samples/subsys/bindesc/read_bindesc/src/main.c @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2023 Yonatan Schachter + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +BINDESC_STR_DEFINE(my_string, 1, "Hello world!"); +BINDESC_UINT_DEFINE(my_int, 2, 5); +BINDESC_BYTES_DEFINE(my_bytes, 3, ({1, 2, 3, 4})); + +const struct device *flash = DEVICE_DT_GET(DT_CHOSEN(zephyr_flash_controller)); + +void dump_bytes(const uint8_t *buffer, size_t size) +{ + size_t i; + + for (i = 0; i < size; i++) { + printk("%02x ", buffer[i]); + } + printk("\n"); +} + +int dump_descriptors_callback(const struct bindesc_entry *entry, void *user_data) +{ + ARG_UNUSED(user_data); + + printk("tag: %hu len: %hu data: ", entry->tag, entry->len); + + switch (BINDESC_GET_TAG_TYPE(entry->tag)) { + case BINDESC_TYPE_UINT: + printk("%u\n", *(const uint32_t *)entry->data); + break; + case BINDESC_TYPE_STR: + printk("%s\n", (const char *)entry->data); + break; + case BINDESC_TYPE_BYTES: + dump_bytes((const uint8_t *)entry->data, entry->len); + break; + case BINDESC_TYPE_DESCRIPTORS_END: + printk("Descriptors terminator\n"); + break; + default: + printk("\n"); + break; + } + + return 0; +} + +int main(void) +{ + size_t bindesc_offset = UINT16_MAX; + const uint32_t *version_number; + struct bindesc_handle handle; + uint8_t buffer[0x100]; + const uint8_t *bytes; + const char *version; + size_t size; + int retval; + size_t i; + + /* + * In a normal application, the offset of the descriptors should be constant and known, + * usually right after the vector table. It can easily be retrieved using + * ``west bindesc get_offset path/to/zephyr.bin``. + * This sample however is intended for multiple devices, and therefore just searches for + * the descriptors in order to remain generic. + */ + for (i = 0; i < UINT16_MAX; i += sizeof(void *)) { + if (*(uint64_t *)(CONFIG_FLASH_BASE_ADDRESS + i) == BINDESC_MAGIC) { + printk("Found descriptors at 0x%x\n", i); + bindesc_offset = i; + break; + } + } + if (i == UINT16_MAX) { + printk("Descriptors not found\n"); + return 1; + } + + printk("\n##################################\n"); + printk("Reading using memory mapped flash:\n"); + printk("##################################\n"); + + bindesc_open_memory_mapped_flash(&handle, bindesc_offset); + bindesc_foreach(&handle, dump_descriptors_callback, NULL); + + bindesc_find_str(&handle, BINDESC_ID_KERNEL_VERSION_STRING, &version); + printk("Zephyr version: %s\n", version); + + bindesc_get_size(&handle, &size); + printk("Bindesc size: %u\n", size); + + printk("\n##################\n"); + printk("Reading using RAM:\n"); + printk("##################\n"); + + flash_read(flash, bindesc_offset, buffer, sizeof(buffer)); + + bindesc_open_ram(&handle, buffer, sizeof(buffer)); + + /* Search for a non-existent descriptor */ + retval = bindesc_find_str(&handle, 123, &version); + if (retval) { + printk("Descriptor not found!\n"); + } + + bindesc_find_uint(&handle, BINDESC_ID_KERNEL_VERSION_MAJOR, &version_number); + printk("Zephyr version number: %u\n", *version_number); + + printk("\n####################\n"); + printk("Reading using flash:\n"); + printk("####################\n"); + + bindesc_open_flash(&handle, bindesc_offset, flash); + + bindesc_find_bytes(&handle, 3, &bytes, &size); + printk("my_bytes: "); + dump_bytes(bytes, size); + + return 0; +} From 10d49736cffa14d3798e615e70d58b3be8ee2cfc Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 10 Oct 2024 16:08:02 +0530 Subject: [PATCH 0695/4482] boards: nordic: nrf7002dk: Remove NS variants The NS variants need crypto changes from NCS, so, remove it from upstream till their support is upstreamed. Signed-off-by: Chaitanya Tata --- boards/nordic/nrf7002dk/CMakeLists.txt | 4 +- boards/nordic/nrf7002dk/Kconfig | 6 +- boards/nordic/nrf7002dk/Kconfig.defconfig | 76 ------------------- boards/nordic/nrf7002dk/Kconfig.nrf7002dk | 4 +- boards/nordic/nrf7002dk/board.cmake | 13 +--- boards/nordic/nrf7002dk/board.yml | 4 - .../nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts | 40 ---------- .../nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml | 19 ----- ...7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig | 27 ------- .../nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts | 41 ---------- .../nrf7002dk_nrf5340_cpuapp_ns.yaml | 19 ----- .../nrf7002dk_nrf5340_cpuapp_ns_defconfig | 26 ------- 12 files changed, 4 insertions(+), 275 deletions(-) delete mode 100644 boards/nordic/nrf7002dk/Kconfig.defconfig delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml delete mode 100644 boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig diff --git a/boards/nordic/nrf7002dk/CMakeLists.txt b/boards/nordic/nrf7002dk/CMakeLists.txt index db20255712bc1..34667bb5650b4 100644 --- a/boards/nordic/nrf7002dk/CMakeLists.txt +++ b/boards/nordic/nrf7002dk/CMakeLists.txt @@ -2,9 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 if((CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP OR - CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS OR - CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 OR - CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS) AND + CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001) AND CONFIG_BOARD_ENABLE_CPUNET) zephyr_library() zephyr_library_sources(nrf5340_cpunet_reset.c) diff --git a/boards/nordic/nrf7002dk/Kconfig b/boards/nordic/nrf7002dk/Kconfig index 4bd84612e7a91..824f15fc5225c 100644 --- a/boards/nordic/nrf7002dk/Kconfig +++ b/boards/nordic/nrf7002dk/Kconfig @@ -10,9 +10,7 @@ config MBOX_NRFX_IPC default MBOX if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 config BT_HCI_IPC default y if BT @@ -60,9 +58,7 @@ config BT_ECC config DOMAIN_CPUAPP_BOARD string default "nrf7002dk/nrf5340/cpuapp" if BOARD_NRF7002DK_NRF5340_CPUAPP - default "nrf7002dk/nrf5340/cpuapp/ns" if BOARD_NRF7002DK_NRF5340_CPUAPP_NS default "nrf7002dk/nrf5340/cpuapp/nrf7001" if BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 - default "nrf7002dk/nrf5340/cpuapp/nrf7001/ns" if BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS help The board which will be used for CPUAPP domain when creating a multi image application where one or more images should be located on diff --git a/boards/nordic/nrf7002dk/Kconfig.defconfig b/boards/nordic/nrf7002dk/Kconfig.defconfig deleted file mode 100644 index a6357ae50b2a1..0000000000000 --- a/boards/nordic/nrf7002dk/Kconfig.defconfig +++ /dev/null @@ -1,76 +0,0 @@ -# nRF5340 DK nRF5340 board configuration - -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -# By default, if we build for a Non-Secure version of the board, -# force building with TF-M as the Secure Execution Environment. -config BUILD_WITH_TFM - default y if BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -if BUILD_WITH_TFM - -# By default, if we build with TF-M, instruct build system to -# flash the combined TF-M (Secure) & Zephyr (Non Secure) image -config TFM_FLASH_MERGED_BINARY - bool - default y - -endif # BUILD_WITH_TFM - -# Code Partition: -# -# For the secure version of the board the firmware is linked at the beginning -# of the flash, or into the code-partition defined in DT if it is intended to -# be loaded by MCUboot. If the secure firmware is to be combined with a non- -# secure image (TRUSTED_EXECUTION_SECURE=y), the secure FW image shall always -# be restricted to the size of its code partition. -# -# For the non-secure version of the board, the firmware -# must be linked into the code-partition (non-secure) defined in DT, regardless. -# Apply this configuration below by setting the Kconfig symbols used by -# the linker according to the information extracted from DT partitions. - -# SRAM Partition: -# -# If the secure firmware is to be combined with a non-secure image -# (TRUSTED_EXECUTION_SECURE=y), the secure FW image SRAM shall always -# be restricted to the secure image SRAM partition (sram-secure-partition). -# Otherwise (if TRUSTED_EXECUTION_SECURE is not set) the whole zephyr,sram -# may be used by the image. -# -# For the non-secure version of the board, the firmware image SRAM is -# always restricted to the allocated non-secure SRAM partition. -# -# Workaround for not being able to have commas in macro arguments -DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition -DT_CHOSEN_Z_SRAM_PARTITION := zephyr,sram-secure-partition - -if (BOARD_NRF7002DK_NRF5340_CPUAPP || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001) && \ - TRUSTED_EXECUTION_SECURE - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -config SRAM_SIZE - default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_SRAM_PARTITION),0,K) - -endif - -if BOARD_NRF7002DK_NRF5340_CPUAPP_NS || BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS - -config FLASH_LOAD_OFFSET - default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -config FLASH_LOAD_SIZE - default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION)) - -endif - -endif diff --git a/boards/nordic/nrf7002dk/Kconfig.nrf7002dk b/boards/nordic/nrf7002dk/Kconfig.nrf7002dk index 91f52ee6f08c6..61b9e818f3673 100644 --- a/boards/nordic/nrf7002dk/Kconfig.nrf7002dk +++ b/boards/nordic/nrf7002dk/Kconfig.nrf7002dk @@ -4,6 +4,4 @@ config BOARD_NRF7002DK select SOC_NRF5340_CPUNET_QKAA if BOARD_NRF7002DK_NRF5340_CPUNET select SOC_NRF5340_CPUAPP_QKAA if BOARD_NRF7002DK_NRF5340_CPUAPP || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NS || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 || \ - BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS + BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 diff --git a/boards/nordic/nrf7002dk/board.cmake b/boards/nordic/nrf7002dk/board.cmake index bea0dc92ea9c3..3832c0d20c13d 100644 --- a/boards/nordic/nrf7002dk/board.cmake +++ b/boards/nordic/nrf7002dk/board.cmake @@ -1,22 +1,11 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS OR - CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS) - set(TFM_PUBLIC_KEY_FORMAT "full") -endif() - if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP OR - CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NS OR - CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001 OR - CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001_NS) + CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001) board_runner_args(jlink "--device=nrf5340_xxaa_app" "--speed=4000") endif() -if(CONFIG_TFM_FLASH_MERGED_BINARY) - set_property(TARGET runners_yaml_props_target PROPERTY hex_file "${CMAKE_BINARY_DIR}/zephyr/tfm_merged.hex") -endif() - if(CONFIG_BOARD_NRF7002DK_NRF5340_CPUNET) board_runner_args(jlink "--device=nrf5340_xxaa_net" "--speed=4000") endif() diff --git a/boards/nordic/nrf7002dk/board.yml b/boards/nordic/nrf7002dk/board.yml index 39db5dcfa3a71..4f41341e4423a 100644 --- a/boards/nordic/nrf7002dk/board.yml +++ b/boards/nordic/nrf7002dk/board.yml @@ -5,9 +5,5 @@ board: socs: - name: nrf5340 variants: - - name: ns - cpucluster: cpuapp - name: nrf7001 cpucluster: cpuapp - variants: - - name: ns diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts deleted file mode 100644 index cbbd46dff8beb..0000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.dts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; -#include -#include "nrf5340_cpuapp_common.dtsi" - -/ { - model = "Nordic NRF5340 DK NRF5340 Application"; - compatible = "nordic,nrf5340-dk-nrf5340-cpuapp"; - - chosen { - zephyr,sram = &sram0_ns; - zephyr,flash = &flash0; - zephyr,code-partition = &slot0_ns_partition; - zephyr,entropy = &psa_rng; - zephyr,wifi = &wlan0; - }; - - psa_rng: psa-rng { - compatible = "zephyr,psa-crypto-rng"; - status = "okay"; - }; -}; - -&qspi { - nrf70: nrf7001@1 { - compatible = "nordic,nrf7001-qspi"; - status = "okay"; - reg = <1>; - qspi-frequency = <24000000>; - qspi-quad-mode; - - #include "nrf70_common.dtsi" - #include "nrf70_common_coex.dtsi" - }; -}; diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml deleted file mode 100644 index 1657596912605..0000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns.yaml +++ /dev/null @@ -1,19 +0,0 @@ -identifier: nrf7002dk/nrf5340/cpuapp/nrf7001/ns -name: NRF7002-DK-NRF7001-NRF5340-application-MCU-Non-Secure -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 192 -flash: 192 -supported: - - gpio - - i2c - - pwm - - watchdog - - usbd - - usb_device - - netif:openthread -vendor: nordic diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig deleted file mode 100644 index c536aae767dc1..0000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001_ns_defconfig +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -# Enable MPU -CONFIG_ARM_MPU=y - -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - -# Enable TrustZone-M -CONFIG_ARM_TRUSTZONE_M=y - -# This Board implies building Non-Secure firmware -CONFIG_TRUSTED_EXECUTION_NONSECURE=y - -# enable GPIO -CONFIG_GPIO=y - -# enable PINCTRL -CONFIG_PINCTRL=y - -# Enable uart driver -CONFIG_SERIAL=y - -# enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts deleted file mode 100644 index ed21938479597..0000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.dts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/dts-v1/; -#include -#include "nrf5340_cpuapp_common.dtsi" - -/ { - model = "Nordic NRF5340 DK NRF5340 Application"; - compatible = "nordic,nrf5340-dk-nrf5340-cpuapp"; - - chosen { - zephyr,sram = &sram0_ns_app; - zephyr,flash = &flash0; - zephyr,code-partition = &slot0_ns_partition; - zephyr,entropy = &psa_rng; - zephyr,wifi = &wlan0; - }; - - psa_rng: psa-rng { - compatible = "zephyr,psa-crypto-rng"; - status = "okay"; - }; -}; - -&qspi { - nrf70: nrf7002@1 { - compatible = "nordic,nrf7002-qspi"; - status = "okay"; - reg = <1>; - qspi-frequency = <24000000>; - qspi-quad-mode; - - #include "nrf70_common.dtsi" - #include "nrf70_common_coex.dtsi" - #include "nrf70_common_5g.dtsi" - }; -}; diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml deleted file mode 100644 index ea43785b45593..0000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns.yaml +++ /dev/null @@ -1,19 +0,0 @@ -identifier: nrf7002dk/nrf5340/cpuapp/ns -name: NRF7002-DK-NRF5340-application-MCU-Non-Secure -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -ram: 192 -flash: 192 -supported: - - gpio - - i2c - - pwm - - watchdog - - usbd - - usb_device - - netif:openthread -vendor: nordic diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig deleted file mode 100644 index c5b2eaadc168b..0000000000000 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_ns_defconfig +++ /dev/null @@ -1,26 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -# Enable MPU -CONFIG_ARM_MPU=y - -# Enable hardware stack protection -CONFIG_HW_STACK_PROTECTION=y - -# Enable TrustZone-M -CONFIG_ARM_TRUSTZONE_M=y - -# This Board implies building Non-Secure firmware -CONFIG_TRUSTED_EXECUTION_NONSECURE=y - -# enable GPIO -CONFIG_GPIO=y - -# enable PINCTRL -CONFIG_PINCTRL=y - -# Enable uart driver -CONFIG_SERIAL=y - -# enable console -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y From 1ec5ce05f9f84b18cb8056d01917480a6ec39e52 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Fri, 11 Oct 2024 13:11:30 -0700 Subject: [PATCH 0696/4482] dp: swdp_bitbang: fix unused variable build error The variable config in sw_port_off() is not used, and it's causing CI build error about unused variable. So remove it. Signed-off-by: Daniel Leung --- drivers/dp/swdp_bitbang.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/dp/swdp_bitbang.c b/drivers/dp/swdp_bitbang.c index a1d28386209fd..7822315ab8e12 100644 --- a/drivers/dp/swdp_bitbang.c +++ b/drivers/dp/swdp_bitbang.c @@ -677,7 +677,6 @@ static int sw_port_off(const struct device *dev) static int sw_gpio_init(const struct device *dev) { - const struct sw_config *config = dev->config; struct sw_cfg_data *sw_data = dev->data; int ret; From 1f0a15fa081149d08987cdba86c2ae59a2981342 Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Fri, 11 Oct 2024 17:02:07 -0500 Subject: [PATCH 0697/4482] drivers: sensor: Fix NXP LPCMP driver Fix Build failure due to undefined variable. Signed-off-by: Mahesh Mahadevan --- drivers/sensor/nxp/mcux_lpcmp/mcux_lpcmp.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/sensor/nxp/mcux_lpcmp/mcux_lpcmp.c b/drivers/sensor/nxp/mcux_lpcmp/mcux_lpcmp.c index 97e55a7d3c628..57e89b3a4d948 100644 --- a/drivers/sensor/nxp/mcux_lpcmp/mcux_lpcmp.c +++ b/drivers/sensor/nxp/mcux_lpcmp/mcux_lpcmp.c @@ -273,8 +273,6 @@ static int mcux_lpcmp_sample_fetch(const struct device *dev, enum sensor_channel const struct mcux_lpcmp_config *config = dev->config; struct mcux_lpcmp_data *data = dev->data; - __ASSERT_NO_MSG(val != NULL); - if (chan != SENSOR_CHAN_ALL && (int16_t)chan != SENSOR_CHAN_MCUX_LPCMP_OUTPUT) { return -ENOTSUP; } From 8b2cdd4577a3235f6db7119f0e7eb89c4012e60d Mon Sep 17 00:00:00 2001 From: Yonatan Schachter Date: Mon, 14 Oct 2024 11:19:11 +0300 Subject: [PATCH 0698/4482] bindesc.h: Include missing device.h bindesc.h did not explicitly include device.h. For some build scenarios this caused compilation warnings, failing the CI. Signed-off-by: Yonatan Schachter --- include/zephyr/bindesc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/zephyr/bindesc.h b/include/zephyr/bindesc.h index aed5edf1c952c..88e51dbf89b9f 100644 --- a/include/zephyr/bindesc.h +++ b/include/zephyr/bindesc.h @@ -147,6 +147,7 @@ extern "C" { #if !defined(_LINKER) || defined(__DOXYGEN__) #include +#include /** * @cond INTERNAL_HIDDEN From eac7e604c25ac61f733befb65feec719bc61d2f3 Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Mon, 17 Jun 2024 13:56:27 +0200 Subject: [PATCH 0699/4482] dts: bindings: video: Add common video interface binding Add common video interface binding. This binding contains the most common properties needed to configure an endpoint subnode for data exchange with other device. Signed-off-by: Phi Bang Nguyen --- dts/bindings/video/video-interfaces.yaml | 144 ++++++++++++++++++ .../dt-bindings/video/video-interfaces.h | 17 +++ 2 files changed, 161 insertions(+) create mode 100644 dts/bindings/video/video-interfaces.yaml create mode 100644 include/zephyr/dt-bindings/video/video-interfaces.h diff --git a/dts/bindings/video/video-interfaces.yaml b/dts/bindings/video/video-interfaces.yaml new file mode 100644 index 0000000000000..fb17d69462770 --- /dev/null +++ b/dts/bindings/video/video-interfaces.yaml @@ -0,0 +1,144 @@ +# Copyright 2024 NXP +# SPDX-License-Identifier: Apache-2.0 + +# Common properties for video interface endpoints. + +description: | + A video pipeline usually consists of several devices, e.g. camera sensors, video + data receivers, video data processors, etc. Data interfaces on these devices are + described by their child 'port' nodes. Configuration of a port depends on other + devices in the pipeline and is described by 'endpoint' subnodes. + + If a port can be configured to work with more than one remote device on the same + bus, an 'endpoint' child node must be provided for each of them. If more than one + port is present in a device node or there is more than one endpoint at a port, or + port node needs to be associated with a selected hardware interface, a common + scheme using '#address-cells', '#size-cells' and 'reg' properties is used. + + All 'port' nodes can be grouped under an optional 'ports' node, which allows to + specify #address-cells, #size-cells properties independently for the 'port' and + 'endpoint' nodes. For example: + + video_device { + ... + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + ... + endpoint@0 { ... }; + endpoint@1 { ... }; + }; + port@1 { ... }; + }; + }; + + Two 'endpoint' nodes must be linked with each other via their 'remote-endpoint' + phandles. However, Zephyr does not allow circular dependency, so direct phandle + references are currently not possible. A 'remote-endpoint-label' string is used + instead to be able to specify, at least, the label of the peer remote-endpoint. + For example: + + source: endpoint { + compatible = "zephyr,video-interfaces"; + remote-endpoint-label = "sink"; + }; + + sink: endpoint{ + compatible = "zephyr,video-interfaces"; + remote-endpoint-label = "source"; + }; + + This binding contains the most common properties needed to configure an endpoint + subnode for data exchange with other device. In most cases, properties at the + peer 'endpoint' node will be identical, however they might be different when + there is any signal modifications on the bus between two devices, e.g. there are + logic signal inverters on the lines. + +properties: + remote-endpoint-label: + required: true + type: string + description: | + Label of the 'remote-endpoint' subnode that interfaces with this endpoint. + This property is used as a 'work-around' to be able to declare the remote + endpoint and should be replaced by a "remote-endpoint" phandle property when + Zephyr devicetree supports circular dependency in the future. + + bus-type: + type: int + enum: + - 1 # MIPI CSI-2 C-PHY + - 2 # MIPI CSI1 + - 3 # CCP2 + - 4 # MIPI CSI-2 D-PHY + - 5 # Parallel + - 6 # BT.656 + description: | + Data bus type. + + data-shift: + type: int + description: | + On parallel data busses, if bus-width is used to specify the number of + data lines, data-shift can be used to specify which data lines are used, + e.g. "bus-width=<8>; data-shift=<2>;" means, that lines 9:2 are used. + + hsync-active: + type: int + enum: + - 0 # low + - 1 # high + description: | + Active state of the HSYNC signal + + vsync-active: + type: int + enum: + - 0 # low + - 1 # high + description: | + Active state of the VSYNC signal. + + pclk-sample: + type: int + enum: + - 0 # falling + - 1 # rising + - 2 # both + description: | + Sample data on falling, rising or both edges of the pixel clock signal. + + link-frequencies: + type: array + description: | + Allowed data bus frequencies. For MIPI CSI-2, for instance, this is the + actual frequency of the bus, not bits per clock per lane value. + +# For serial bus only + clock-lane: + type: int + description: | + Physical clock lane index. Position of an entry determines the logical + lane number, while the value of an entry indicates physical lane, e.g. for + a MIPI CSI-2 bus we could have "clock-lane = <0>;", which places the + clock lane on hardware lane 0. This property is valid for serial busses + only (e.g. MIPI CSI-2). + + data-lanes: + type: array + description: | + An array of physical data lane indexes. Position of an entry determines + the logical lane number, while the value of an entry indicates physical + lane, e.g. for 2-lane MIPI CSI-2 bus we could have "data-lanes = <1 2>;", + assuming the clock lane is on hardware lane 0. If the hardware does not + support lane reordering, monotonically incremented values shall be used + from 0 or 1 onwards, depending on whether or not there is also a clock + lane. This property is valid for serial busses only (e.g. MIPI CSI-2). + +# For parallel bus only + bus-width: + type: int + description: | + Number of data lines actively used, only valid for parallel busses. diff --git a/include/zephyr/dt-bindings/video/video-interfaces.h b/include/zephyr/dt-bindings/video/video-interfaces.h new file mode 100644 index 0000000000000..062c1b5b337a5 --- /dev/null +++ b/include/zephyr/dt-bindings/video/video-interfaces.h @@ -0,0 +1,17 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_VIDEO_INTERFACES_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_VIDEO_INTERFACES_H_ + +#define VIDEO_BUS_TYPE_CSI2_CPHY 1 +#define VIDEO_BUS_TYPE_CSI1 2 +#define VIDEO_BUS_TYPE_CCP2 3 +#define VIDEO_BUS_TYPE_CSI2_DPHY 4 +#define VIDEO_BUS_TYPE_PARALLEL 5 +#define VIDEO_BUS_TYPE_BT656 6 + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_VIDEO_INTERFACES_H_ */ From 6f766a0058426272f0c2b17e8cc020969aaa4b40 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Sat, 15 Jun 2024 08:27:12 -0400 Subject: [PATCH 0700/4482] fdtable: read, write, close: only execute methods if non-NULL Only invoke vtable methods read, write, and close if they are non-NULL. The close() vtable method is optional, so that should not return an error if zvfs_close() is called and that method is unimplemented. Otherwise, if zvfs_read() or zvfs_write() are called and the corresponding vtable method is unimplemented, fail setting errno to EIO. Signed-off-by: Chris Friedt --- lib/os/fdtable.c | 73 ++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 39 deletions(-) diff --git a/lib/os/fdtable.c b/lib/os/fdtable.c index 9594afdd8cd6c..ecf328f5922c1 100644 --- a/lib/os/fdtable.c +++ b/lib/os/fdtable.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2018 Linaro Limited + * Copyright (c) 2024 Tenstorrent AI ULC * * SPDX-License-Identifier: Apache-2.0 */ @@ -301,7 +302,7 @@ int zvfs_alloc_fd(void *obj, const struct fd_op_vtable *vtable) return fd; } -ssize_t zvfs_read(int fd, void *buf, size_t sz) +static ssize_t zvfs_rw(int fd, void *buf, size_t sz, bool is_write) { ssize_t res; @@ -310,63 +311,57 @@ ssize_t zvfs_read(int fd, void *buf, size_t sz) } (void)k_mutex_lock(&fdtable[fd].lock, K_FOREVER); - res = fdtable[fd].vtable->read_offs(fdtable[fd].obj, buf, sz, fdtable[fd].offset); - if (res > 0) { - switch (fdtable[fd].mode & ZVFS_MODE_IFMT) { - case ZVFS_MODE_IFDIR: - case ZVFS_MODE_IFBLK: - case ZVFS_MODE_IFSHM: - case ZVFS_MODE_IFREG: - fdtable[fd].offset += res; - break; - default: - break; + + if (is_write) { + if (fdtable[fd].vtable->write_offset == NULL) { + res = -1; + errno = EIO; + } else { + res = fdtable[fd].vtable->write_offset(fdtable[fd].obj, buf, sz, + fdtable[fd].offset); } + } else { + if (fdtable[fd].vtable->read == NULL) { + res = -1; + errno = EIO; + } else { + res = fdtable[fd].vtable->read_offset(fdtable[fd].obj, buf, sz, + fdtable[fd].offset); + } + } + if (res > 0) { + fdtable[fd].offset += res; } + +unlock: k_mutex_unlock(&fdtable[fd].lock); return res; } -ssize_t zvfs_write(int fd, const void *buf, size_t sz) +ssize_t zvfs_read(int fd, void *buf, size_t sz) { - ssize_t res; - - if (_check_fd(fd) < 0) { - return -1; - } - - (void)k_mutex_lock(&fdtable[fd].lock, K_FOREVER); - res = fdtable[fd].vtable->write_offs(fdtable[fd].obj, buf, sz, fdtable[fd].offset); - if (res > 0) { - switch (fdtable[fd].mode & ZVFS_MODE_IFMT) { - case ZVFS_MODE_IFDIR: - case ZVFS_MODE_IFBLK: - case ZVFS_MODE_IFSHM: - case ZVFS_MODE_IFREG: - fdtable[fd].offset += res; - break; - default: - break; - } - } - k_mutex_unlock(&fdtable[fd].lock); + return zvfs_rw(fd, buf, sz, false); +} - return res; +ssize_t zvfs_write(int fd, const void *buf, size_t sz) +{ + return zvfs_rw(fd, (void *)buf, sz, true); } int zvfs_close(int fd) { - int res; + int res = 0; if (_check_fd(fd) < 0) { return -1; } (void)k_mutex_lock(&fdtable[fd].lock, K_FOREVER); - - res = fdtable[fd].vtable->close(fdtable[fd].obj); - + if (fdtable[fd].vtable->close != NULL) { + /* close() is optional - e.g. stdinout_fd_op_vtable */ + res = fdtable[fd].vtable->close(fdtable[fd].obj); + } k_mutex_unlock(&fdtable[fd].lock); zvfs_free_fd(fd); From fe26de9606f49532f6d872947f89626480f84173 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Sat, 15 Jun 2024 08:06:16 -0400 Subject: [PATCH 0701/4482] posix: device_io: require a full libc for c89 functions The POSIX_DEVICE_IO Option Group requires a number of c89 functions mainly from stdio.h . Namely, clearerr(), fclose(), feof(), ferror(), fflush(), fetc(), fgets(), fprintf(), fputc(), fputs(), fread(), freopen(), fscanf(), fwrite(), getc(), getchar(), gets(), perror(), printf(), putc(), putchar(), puts(), scanf(), setbuf(), setvbuf(), ungetc(), vfprintf(), vfscanf(), vfprintf(), and vscanf(). Additionally, symbols stdin, stdout, and stderr should be provided. These should be provided by any conformant C library (not by the POSIX API). Signed-off-by: Chris Friedt --- lib/posix/options/Kconfig.device_io | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/posix/options/Kconfig.device_io b/lib/posix/options/Kconfig.device_io index 9cfbd453102bc..0999a4462e2d2 100644 --- a/lib/posix/options/Kconfig.device_io +++ b/lib/posix/options/Kconfig.device_io @@ -8,6 +8,7 @@ config POSIX_DEVICE_IO bool "POSIX device I/O [EXPERIMENTAL]" select FDTABLE select EXPERIMENTAL + select REQUIRES_FULL_LIBC help Select 'y' here and Zephyr will provide an implementation of the POSIX_DEVICE_IO Option Group such as FD_CLR(), FD_ISSET(), FD_SET(), FD_ZERO(), close(), fdopen(), fileno(), open(), From 5ccbaeff391c0d8901a270c545c00ac390470fff Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Sat, 15 Jun 2024 08:54:41 -0400 Subject: [PATCH 0702/4482] posix: device_io: implement pread() and pwrite() Add pread() and pwrite() implementations, which are nearly identical to read() and write() but differ in that they do not update the file-descriptor offset and instead read from a specific file offset. Signed-off-by: Chris Friedt --- lib/os/fdtable.c | 54 ++++++++++++++++++++++++++--------- lib/posix/options/device_io.c | 32 ++++++++++++++++++--- 2 files changed, 69 insertions(+), 17 deletions(-) diff --git a/lib/os/fdtable.c b/lib/os/fdtable.c index ecf328f5922c1..8af73b8bfcbbf 100644 --- a/lib/os/fdtable.c +++ b/lib/os/fdtable.c @@ -302,9 +302,21 @@ int zvfs_alloc_fd(void *obj, const struct fd_op_vtable *vtable) return fd; } -static ssize_t zvfs_rw(int fd, void *buf, size_t sz, bool is_write) +static bool supports_pread_pwrite(uint32_t mode) { + switch (mode & ZVFS_MODE_IFMT) { + case ZVFS_MODE_IFSHM: + return true; + default: + return false; + } +} + +static ssize_t zvfs_rw(int fd, void *buf, size_t sz, bool is_write, const size_t *from_offset) +{ + bool prw; ssize_t res; + const size_t *off; if (_check_fd(fd) < 0) { return -1; @@ -312,24 +324,40 @@ static ssize_t zvfs_rw(int fd, void *buf, size_t sz, bool is_write) (void)k_mutex_lock(&fdtable[fd].lock, K_FOREVER); + prw = supports_pread_pwrite(fdtable[fd].mode); + if (from_offset != NULL && !prw) { + /* + * Seekable file types should support pread() / pwrite() and per-fd offset passing. + * Otherwise, it's a bug. + */ + errno = ENOTSUP; + res = -1; + goto unlock; + } + + /* If there is no specified from_offset, then use the current offset of the fd */ + off = (from_offset == NULL) ? &fdtable[fd].offset : from_offset; + if (is_write) { - if (fdtable[fd].vtable->write_offset == NULL) { + if (fdtable[fd].vtable->write_offs == NULL) { res = -1; errno = EIO; } else { - res = fdtable[fd].vtable->write_offset(fdtable[fd].obj, buf, sz, - fdtable[fd].offset); + res = fdtable[fd].vtable->write_offs(fdtable[fd].obj, buf, sz, *off); } } else { - if (fdtable[fd].vtable->read == NULL) { + if (fdtable[fd].vtable->read_offs == NULL) { res = -1; errno = EIO; } else { - res = fdtable[fd].vtable->read_offset(fdtable[fd].obj, buf, sz, - fdtable[fd].offset); + res = fdtable[fd].vtable->read_offs(fdtable[fd].obj, buf, sz, *off); } } - if (res > 0) { + if (res > 0 && prw && from_offset == NULL) { + /* + * only update the fd offset when from_offset is not specified + * See pread() / pwrite() + */ fdtable[fd].offset += res; } @@ -339,14 +367,14 @@ static ssize_t zvfs_rw(int fd, void *buf, size_t sz, bool is_write) return res; } -ssize_t zvfs_read(int fd, void *buf, size_t sz) +ssize_t zvfs_read(int fd, void *buf, size_t sz, const size_t *from_offset) { - return zvfs_rw(fd, buf, sz, false); + return zvfs_rw(fd, buf, sz, false, from_offset); } -ssize_t zvfs_write(int fd, const void *buf, size_t sz) +ssize_t zvfs_write(int fd, const void *buf, size_t sz, const size_t *from_offset) { - return zvfs_rw(fd, (void *)buf, sz, true); + return zvfs_rw(fd, (void *)buf, sz, true, from_offset); } int zvfs_close(int fd) @@ -488,7 +516,7 @@ static ssize_t stdinout_read_vmeth(void *obj, void *buffer, size_t count) static ssize_t stdinout_write_vmeth(void *obj, const void *buffer, size_t count) { #if defined(CONFIG_BOARD_NATIVE_POSIX) - return zvfs_write(1, buffer, count); + return zvfs_write(1, buffer, count, NULL); #elif defined(CONFIG_NEWLIB_LIBC) || defined(CONFIG_ARCMWDT_LIBC) return z_impl_zephyr_write_stdout(buffer, count); #else diff --git a/lib/posix/options/device_io.c b/lib/posix/options/device_io.c index 585dc7000c2be..e2c7510d7ad87 100644 --- a/lib/posix/options/device_io.c +++ b/lib/posix/options/device_io.c @@ -15,8 +15,8 @@ /* prototypes for external, not-yet-public, functions in fdtable.c or fs.c */ int zvfs_close(int fd); int zvfs_open(const char *name, int flags); -ssize_t zvfs_read(int fd, void *buf, size_t sz); -ssize_t zvfs_write(int fd, const void *buf, size_t sz); +ssize_t zvfs_read(int fd, void *buf, size_t sz, size_t *from_offset); +ssize_t zvfs_write(int fd, const void *buf, size_t sz, size_t *from_offset); int close(int fd) { @@ -41,9 +41,33 @@ int poll(struct pollfd *fds, int nfds, int timeout) return zsock_poll(fds, nfds, timeout); } +ssize_t pread(int fd, void *buf, size_t count, off_t offset) +{ + size_t off = (size_t)offset; + + if (offset < 0) { + errno = EINVAL; + return -1; + } + + return zvfs_read(fd, buf, count, (size_t *)&off); +} + +ssize_t pwrite(int fd, void *buf, size_t count, off_t offset) +{ + size_t off = (size_t)offset; + + if (offset < 0) { + errno = EINVAL; + return -1; + } + + return zvfs_write(fd, buf, count, (size_t *)&off); +} + ssize_t read(int fd, void *buf, size_t sz) { - return zvfs_read(fd, buf, sz); + return zvfs_read(fd, buf, sz, NULL); } #ifdef CONFIG_POSIX_DEVICE_IO_ALIAS_READ FUNC_ALIAS(read, _read, ssize_t); @@ -57,7 +81,7 @@ int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struc ssize_t write(int fd, const void *buf, size_t sz) { - return zvfs_write(fd, buf, sz); + return zvfs_write(fd, buf, sz, NULL); } #ifdef CONFIG_POSIX_DEVICE_IO_ALIAS_WRITE FUNC_ALIAS(write, _write, ssize_t); From 881dc1fa7a962a85a6fe78acd772cce0598bfc8b Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Sat, 15 Jun 2024 10:42:01 -0400 Subject: [PATCH 0703/4482] net: sockets: move poll implementation to zvfs Move the implementation of zsock_poll to zvfs_poll. This allows other types of file descriptors to also make use of poll() functionality even when the network subsystem is not enabled. Additionally, it partially removes a dependency cycle between posix and networking by moving functionality into a mutual dependency. Signed-off-by: Chris Friedt --- include/zephyr/net/socket.h | 5 +- include/zephyr/net/socket_poll.h | 6 + include/zephyr/sys/fdtable.h | 15 ++ lib/os/CMakeLists.txt | 3 + lib/os/zvfs/CMakeLists.txt | 1 + lib/os/zvfs/Kconfig | 20 +- lib/os/zvfs/zvfs_poll.c | 213 +++++++++++++++++++ lib/posix/options/Kconfig.device_io | 3 +- lib/posix/options/device_io.c | 3 +- subsys/net/lib/sockets/Kconfig | 3 +- subsys/net/lib/sockets/sockets.c | 211 ------------------ subsys/tracing/ctf/tracing_ctf.h | 6 +- tests/net/lib/coap_client/src/stubs.c | 4 +- tests/net/lib/lwm2m/lwm2m_engine/prj.conf | 2 + tests/net/lib/lwm2m/lwm2m_engine/src/stubs.c | 4 +- 15 files changed, 275 insertions(+), 224 deletions(-) create mode 100644 lib/os/zvfs/zvfs_poll.c diff --git a/include/zephyr/net/socket.h b/include/zephyr/net/socket.h index d62b12719abf2..9cef421b84168 100644 --- a/include/zephyr/net/socket.h +++ b/include/zephyr/net/socket.h @@ -629,7 +629,10 @@ static inline int zsock_ioctl_wrapper(int sock, unsigned long request, ...) * it may conflict with generic POSIX ``poll()`` function). * @endrst */ -__syscall int zsock_poll(struct zsock_pollfd *fds, int nfds, int timeout); +static inline int zsock_poll(struct zsock_pollfd *fds, int nfds, int timeout) +{ + return zvfs_poll(fds, nfds, timeout); +} /** * @brief Get various socket options diff --git a/include/zephyr/net/socket_poll.h b/include/zephyr/net/socket_poll.h index 97e03804311ab..d794f103eda63 100644 --- a/include/zephyr/net/socket_poll.h +++ b/include/zephyr/net/socket_poll.h @@ -7,6 +7,8 @@ #ifndef ZEPHYR_INCLUDE_NET_SOCKET_POLL_H_ #define ZEPHYR_INCLUDE_NET_SOCKET_POLL_H_ +#include + /* Setting for pollfd to avoid circular inclusion */ /** @@ -20,6 +22,7 @@ extern "C" { #endif +#ifdef __DOXYGEN__ /** * @brief Definition of the monitored socket/file descriptor. * @@ -30,6 +33,9 @@ struct zsock_pollfd { short events; /**< Requested events */ short revents; /**< Returned events */ }; +#else +#define zsock_pollfd zvfs_pollfd +#endif #ifdef __cplusplus } diff --git a/include/zephyr/sys/fdtable.h b/include/zephyr/sys/fdtable.h index 785df8d42e0fc..5db80988b30c4 100644 --- a/include/zephyr/sys/fdtable.h +++ b/include/zephyr/sys/fdtable.h @@ -27,6 +27,13 @@ #define ZVFS_MODE_IFLNK 0120000 #define ZVFS_MODE_IFSOCK 0140000 +#define ZVFS_POLLIN BIT(0) +#define ZVFS_POLLPRI BIT(1) +#define ZVFS_POLLOUT BIT(2) +#define ZVFS_POLLERR BIT(3) +#define ZVFS_POLLHUP BIT(4) +#define ZVFS_POLLNVAL BIT(5) + #ifdef __cplusplus extern "C" { #endif @@ -192,6 +199,14 @@ static inline int zvfs_fdtable_call_ioctl(const struct fd_op_vtable *vtable, voi return res; } +struct zvfs_pollfd { + int fd; + short events; + short revents; +}; + +__syscall int zvfs_poll(struct zvfs_pollfd *fds, int nfds, int poll_timeout); + /** * Request codes for fd_op_vtable.ioctl(). * diff --git a/lib/os/CMakeLists.txt b/lib/os/CMakeLists.txt index 4ce50ad418292..80f5f16f5d791 100644 --- a/lib/os/CMakeLists.txt +++ b/lib/os/CMakeLists.txt @@ -12,6 +12,9 @@ zephyr_sources( ) zephyr_sources_ifdef(CONFIG_FDTABLE fdtable.c) +zephyr_syscall_header_ifdef(CONFIG_FDTABLE + ${ZEPHYR_BASE}/include/zephyr/sys/fdtable.h +) zephyr_sources_ifdef(CONFIG_CBPRINTF_COMPLETE cbprintf_complete.c) zephyr_sources_ifdef(CONFIG_CBPRINTF_NANO cbprintf_nano.c) diff --git a/lib/os/zvfs/CMakeLists.txt b/lib/os/zvfs/CMakeLists.txt index ca191a4d3ad7a..ef0dde4513bed 100644 --- a/lib/os/zvfs/CMakeLists.txt +++ b/lib/os/zvfs/CMakeLists.txt @@ -2,3 +2,4 @@ zephyr_library() zephyr_library_sources_ifdef(CONFIG_ZVFS_EVENTFD zvfs_eventfd.c) +zephyr_library_sources_ifdef(CONFIG_ZVFS_POLL zvfs_poll.c) diff --git a/lib/os/zvfs/Kconfig b/lib/os/zvfs/Kconfig index 7f50ff52befc2..40cba2cd9c9f4 100644 --- a/lib/os/zvfs/Kconfig +++ b/lib/os/zvfs/Kconfig @@ -16,7 +16,7 @@ if ZVFS config ZVFS_EVENTFD bool "ZVFS event file descriptor support" - select POLL + imply ZVFS_POLL help Enable support for ZVFS event file descriptors. An eventfd can be used as an event wait/notify mechanism together with POSIX calls @@ -33,4 +33,22 @@ config ZVFS_EVENTFD_MAX endif # ZVFS_EVENTFD +config ZVFS_POLL + bool "ZVFS poll" + select POLL + help + Enable support for zvfs_poll(). + +if ZVFS_POLL + +config ZVFS_POLL_MAX + int "Max number of supported zvfs_poll() entries" + default 6 if WIFI_NM_WPA_SUPPLICANT + default 4 if SHELL_BACKEND_TELNET + default 3 + help + Maximum number of entries supported for poll() call. + +endif # ZVFS_POLL + endif # ZVFS diff --git a/lib/os/zvfs/zvfs_poll.c b/lib/os/zvfs/zvfs_poll.c new file mode 100644 index 0000000000000..f91f9dd2bfee4 --- /dev/null +++ b/lib/os/zvfs/zvfs_poll.c @@ -0,0 +1,213 @@ +/* + * Copyright (c) 2017-2018 Linaro Limited + * Copyright (c) 2021 Nordic Semiconductor + * Copyright (c) 2023 Arm Limited (or its affiliates). All rights reserved. + * Copyright (c) 2024 Tenstorrent AI ULC + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS) +bool net_socket_is_tls(void *obj); +#else +#define net_socket_is_tls(obj) false +#endif + +int zvfs_poll_internal(struct zvfs_pollfd *fds, int nfds, k_timeout_t timeout) +{ + bool retry; + int ret = 0; + int i; + struct zvfs_pollfd *pfd; + struct k_poll_event poll_events[CONFIG_ZVFS_POLL_MAX]; + struct k_poll_event *pev; + struct k_poll_event *pev_end = poll_events + ARRAY_SIZE(poll_events); + const struct fd_op_vtable *vtable; + struct k_mutex *lock; + k_timepoint_t end; + bool offload = false; + const struct fd_op_vtable *offl_vtable = NULL; + void *offl_ctx = NULL; + + end = sys_timepoint_calc(timeout); + + pev = poll_events; + for (pfd = fds, i = nfds; i--; pfd++) { + void *ctx; + int result; + + /* Per POSIX, negative fd's are just ignored */ + if (pfd->fd < 0) { + continue; + } + + ctx = zvfs_get_fd_obj_and_vtable(pfd->fd, &vtable, &lock); + if (ctx == NULL) { + /* Will set POLLNVAL in return loop */ + continue; + } + + (void)k_mutex_lock(lock, K_FOREVER); + + result = zvfs_fdtable_call_ioctl(vtable, ctx, ZFD_IOCTL_POLL_PREPARE, pfd, &pev, + pev_end); + if (result == -EALREADY) { + /* If POLL_PREPARE returned with EALREADY, it means + * it already detected that some socket is ready. In + * this case, we still perform a k_poll to pick up + * as many events as possible, but without any wait. + */ + timeout = K_NO_WAIT; + end = sys_timepoint_calc(timeout); + result = 0; + } else if (result == -EXDEV) { + /* If POLL_PREPARE returned EXDEV, it means + * it detected an offloaded socket. + * If offloaded socket is used with native TLS, the TLS + * wrapper for the offloaded poll will be used. + * In case the fds array contains a mixup of offloaded + * and non-offloaded sockets, the offloaded poll handler + * shall return an error. + */ + offload = true; + if (offl_vtable == NULL || net_socket_is_tls(ctx)) { + offl_vtable = vtable; + offl_ctx = ctx; + } + + result = 0; + } + + k_mutex_unlock(lock); + + if (result < 0) { + errno = -result; + return -1; + } + } + + if (offload) { + int poll_timeout; + + if (K_TIMEOUT_EQ(timeout, K_FOREVER)) { + poll_timeout = SYS_FOREVER_MS; + } else { + poll_timeout = k_ticks_to_ms_floor32(timeout.ticks); + } + + return zvfs_fdtable_call_ioctl(offl_vtable, offl_ctx, ZFD_IOCTL_POLL_OFFLOAD, fds, + nfds, poll_timeout); + } + + timeout = sys_timepoint_timeout(end); + + do { + ret = k_poll(poll_events, pev - poll_events, timeout); + /* EAGAIN when timeout expired, EINTR when cancelled (i.e. EOF) */ + if (ret != 0 && ret != -EAGAIN && ret != -EINTR) { + errno = -ret; + return -1; + } + + retry = false; + ret = 0; + + pev = poll_events; + for (pfd = fds, i = nfds; i--; pfd++) { + void *ctx; + int result; + + pfd->revents = 0; + + if (pfd->fd < 0) { + continue; + } + + ctx = zvfs_get_fd_obj_and_vtable(pfd->fd, &vtable, &lock); + if (ctx == NULL) { + pfd->revents = ZVFS_POLLNVAL; + ret++; + continue; + } + + (void)k_mutex_lock(lock, K_FOREVER); + + result = zvfs_fdtable_call_ioctl(vtable, ctx, ZFD_IOCTL_POLL_UPDATE, pfd, + &pev); + k_mutex_unlock(lock); + + if (result == -EAGAIN) { + retry = true; + continue; + } else if (result != 0) { + errno = -result; + return -1; + } + + if (pfd->revents != 0) { + ret++; + } + } + + if (retry) { + if (ret > 0) { + break; + } + + timeout = sys_timepoint_timeout(end); + + if (K_TIMEOUT_EQ(timeout, K_NO_WAIT)) { + break; + } + } + } while (retry); + + return ret; +} + +int z_impl_zvfs_poll(struct zvfs_pollfd *fds, int nfds, int poll_timeout) +{ + k_timeout_t timeout; + + if (poll_timeout < 0) { + timeout = K_FOREVER; + } else { + timeout = K_MSEC(poll_timeout); + } + + return zvfs_poll_internal(fds, nfds, timeout); +} + +#ifdef CONFIG_USERSPACE +static inline int z_vrfy_zvfs_poll(struct zvfs_pollfd *fds, int nfds, int timeout) +{ + struct zvfs_pollfd *fds_copy; + size_t fds_size; + int ret; + + /* Copy fds array from user mode */ + if (size_mul_overflow(nfds, sizeof(struct zvfs_pollfd), &fds_size)) { + errno = EFAULT; + return -1; + } + fds_copy = k_usermode_alloc_from_copy((void *)fds, fds_size); + if (!fds_copy) { + errno = ENOMEM; + return -1; + } + + ret = z_impl_zvfs_poll(fds_copy, nfds, timeout); + + if (ret >= 0) { + k_usermode_to_copy((void *)fds, fds_copy, fds_size); + } + k_free(fds_copy); + + return ret; +} +#include +#endif diff --git a/lib/posix/options/Kconfig.device_io b/lib/posix/options/Kconfig.device_io index 0999a4462e2d2..74e408313ce38 100644 --- a/lib/posix/options/Kconfig.device_io +++ b/lib/posix/options/Kconfig.device_io @@ -6,9 +6,10 @@ menu "POSIX device I/O" config POSIX_DEVICE_IO bool "POSIX device I/O [EXPERIMENTAL]" - select FDTABLE select EXPERIMENTAL select REQUIRES_FULL_LIBC + select ZVFS + select ZVFS_POLL help Select 'y' here and Zephyr will provide an implementation of the POSIX_DEVICE_IO Option Group such as FD_CLR(), FD_ISSET(), FD_SET(), FD_ZERO(), close(), fdopen(), fileno(), open(), diff --git a/lib/posix/options/device_io.c b/lib/posix/options/device_io.c index e2c7510d7ad87..7b638c84976e7 100644 --- a/lib/posix/options/device_io.c +++ b/lib/posix/options/device_io.c @@ -37,8 +37,7 @@ FUNC_ALIAS(open, _open, int); int poll(struct pollfd *fds, int nfds, int timeout) { - /* TODO: create zvfs_poll() and dispatch to subsystems based on file type */ - return zsock_poll(fds, nfds, timeout); + return zvfs_poll(fds, nfds, timeout); } ssize_t pread(int fd, void *buf, size_t count, off_t offset) diff --git a/subsys/net/lib/sockets/Kconfig b/subsys/net/lib/sockets/Kconfig index 1fec457827063..09c436558a9da 100644 --- a/subsys/net/lib/sockets/Kconfig +++ b/subsys/net/lib/sockets/Kconfig @@ -5,7 +5,8 @@ menuconfig NET_SOCKETS bool "BSD Sockets compatible API" - select FDTABLE + select ZVFS + select ZVFS_POLL help Provide BSD Sockets like API on top of native Zephyr networking API. diff --git a/subsys/net/lib/sockets/sockets.c b/subsys/net/lib/sockets/sockets.c index be7ba5ad9678b..007606ac84f8f 100644 --- a/subsys/net/lib/sockets/sockets.c +++ b/subsys/net/lib/sockets/sockets.c @@ -821,217 +821,6 @@ static inline int z_vrfy_zsock_ioctl_impl(int sock, unsigned long request, va_li #include #endif -int zsock_poll_internal(struct zsock_pollfd *fds, int nfds, k_timeout_t timeout) -{ - bool retry; - int ret = 0; - int i; - struct zsock_pollfd *pfd; - struct k_poll_event poll_events[CONFIG_NET_SOCKETS_POLL_MAX]; - struct k_poll_event *pev; - struct k_poll_event *pev_end = poll_events + ARRAY_SIZE(poll_events); - const struct fd_op_vtable *vtable; - struct k_mutex *lock; - k_timepoint_t end; - bool offload = false; - const struct fd_op_vtable *offl_vtable = NULL; - void *offl_ctx = NULL; - - end = sys_timepoint_calc(timeout); - - pev = poll_events; - for (pfd = fds, i = nfds; i--; pfd++) { - void *ctx; - int result; - - /* Per POSIX, negative fd's are just ignored */ - if (pfd->fd < 0) { - continue; - } - - ctx = get_sock_vtable(pfd->fd, - (const struct socket_op_vtable **)&vtable, - &lock); - if (ctx == NULL) { - /* Will set POLLNVAL in return loop */ - continue; - } - - (void)k_mutex_lock(lock, K_FOREVER); - - result = zvfs_fdtable_call_ioctl(vtable, ctx, - ZFD_IOCTL_POLL_PREPARE, - pfd, &pev, pev_end); - if (result == -EALREADY) { - /* If POLL_PREPARE returned with EALREADY, it means - * it already detected that some socket is ready. In - * this case, we still perform a k_poll to pick up - * as many events as possible, but without any wait. - */ - timeout = K_NO_WAIT; - end = sys_timepoint_calc(timeout); - result = 0; - } else if (result == -EXDEV) { - /* If POLL_PREPARE returned EXDEV, it means - * it detected an offloaded socket. - * If offloaded socket is used with native TLS, the TLS - * wrapper for the offloaded poll will be used. - * In case the fds array contains a mixup of offloaded - * and non-offloaded sockets, the offloaded poll handler - * shall return an error. - */ - offload = true; - if (offl_vtable == NULL || net_socket_is_tls(ctx)) { - offl_vtable = vtable; - offl_ctx = ctx; - } - - result = 0; - } - - k_mutex_unlock(lock); - - if (result < 0) { - errno = -result; - return -1; - } - } - - if (offload) { - int poll_timeout; - - if (K_TIMEOUT_EQ(timeout, K_FOREVER)) { - poll_timeout = SYS_FOREVER_MS; - } else { - poll_timeout = k_ticks_to_ms_floor32(timeout.ticks); - } - - return zvfs_fdtable_call_ioctl(offl_vtable, offl_ctx, - ZFD_IOCTL_POLL_OFFLOAD, - fds, nfds, poll_timeout); - } - - timeout = sys_timepoint_timeout(end); - - do { - ret = k_poll(poll_events, pev - poll_events, timeout); - /* EAGAIN when timeout expired, EINTR when cancelled (i.e. EOF) */ - if (ret != 0 && ret != -EAGAIN && ret != -EINTR) { - errno = -ret; - return -1; - } - - retry = false; - ret = 0; - - pev = poll_events; - for (pfd = fds, i = nfds; i--; pfd++) { - void *ctx; - int result; - - pfd->revents = 0; - - if (pfd->fd < 0) { - continue; - } - - ctx = get_sock_vtable( - pfd->fd, - (const struct socket_op_vtable **)&vtable, - &lock); - if (ctx == NULL) { - pfd->revents = ZSOCK_POLLNVAL; - ret++; - continue; - } - - (void)k_mutex_lock(lock, K_FOREVER); - - result = zvfs_fdtable_call_ioctl(vtable, ctx, - ZFD_IOCTL_POLL_UPDATE, - pfd, &pev); - k_mutex_unlock(lock); - - if (result == -EAGAIN) { - retry = true; - continue; - } else if (result != 0) { - errno = -result; - return -1; - } - - if (pfd->revents != 0) { - ret++; - } - } - - if (retry) { - if (ret > 0) { - break; - } - - timeout = sys_timepoint_timeout(end); - - if (K_TIMEOUT_EQ(timeout, K_NO_WAIT)) { - break; - } - } - } while (retry); - - return ret; -} - -int z_impl_zsock_poll(struct zsock_pollfd *fds, int nfds, int poll_timeout) -{ - k_timeout_t timeout; - int ret; - - SYS_PORT_TRACING_OBJ_FUNC_ENTER(socket, poll, fds, nfds, poll_timeout); - - if (poll_timeout < 0) { - timeout = K_FOREVER; - } else { - timeout = K_MSEC(poll_timeout); - } - - ret = zsock_poll_internal(fds, nfds, timeout); - - SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, poll, fds, nfds, - ret < 0 ? -errno : ret); - return ret; -} - -#ifdef CONFIG_USERSPACE -static inline int z_vrfy_zsock_poll(struct zsock_pollfd *fds, - int nfds, int timeout) -{ - struct zsock_pollfd *fds_copy; - size_t fds_size; - int ret; - - /* Copy fds array from user mode */ - if (size_mul_overflow(nfds, sizeof(struct zsock_pollfd), &fds_size)) { - errno = EFAULT; - return -1; - } - fds_copy = k_usermode_alloc_from_copy((void *)fds, fds_size); - if (!fds_copy) { - errno = ENOMEM; - return -1; - } - - ret = z_impl_zsock_poll(fds_copy, nfds, timeout); - - if (ret >= 0) { - k_usermode_to_copy((void *)fds, fds_copy, fds_size); - } - k_free(fds_copy); - - return ret; -} -#include -#endif - int z_impl_zsock_inet_pton(sa_family_t family, const char *src, void *dst) { if (net_addr_pton(family, src, dst) == 0) { diff --git a/subsys/tracing/ctf/tracing_ctf.h b/subsys/tracing/ctf/tracing_ctf.h index ab87411c91196..178bd3b40138b 100644 --- a/subsys/tracing/ctf/tracing_ctf.h +++ b/subsys/tracing/ctf/tracing_ctf.h @@ -521,7 +521,7 @@ void sys_trace_k_event_init(struct k_event *event); */ struct sockaddr; struct msghdr; -struct zsock_pollfd; +struct zvfs_pollfd; void sys_trace_socket_init(int sock, int family, int type, int proto); void sys_trace_socket_close_enter(int sock); @@ -552,8 +552,8 @@ void sys_trace_socket_fcntl_enter(int sock, int cmd, int flags); void sys_trace_socket_fcntl_exit(int sock, int ret); void sys_trace_socket_ioctl_enter(int sock, int req); void sys_trace_socket_ioctl_exit(int sock, int ret); -void sys_trace_socket_poll_enter(const struct zsock_pollfd *fds, int nfds, int timeout); -void sys_trace_socket_poll_exit(const struct zsock_pollfd *fds, int nfds, int ret); +void sys_trace_socket_poll_enter(const struct zvfs_pollfd *fds, int nfds, int timeout); +void sys_trace_socket_poll_exit(const struct zvfs_pollfd *fds, int nfds, int ret); void sys_trace_socket_getsockopt_enter(int sock, int level, int optname); void sys_trace_socket_getsockopt_exit(int sock, int level, int optname, void *optval, size_t optlen, int ret); diff --git a/tests/net/lib/coap_client/src/stubs.c b/tests/net/lib/coap_client/src/stubs.c index 471cc8642bc96..ef9705daeb292 100644 --- a/tests/net/lib/coap_client/src/stubs.c +++ b/tests/net/lib/coap_client/src/stubs.c @@ -16,7 +16,7 @@ DEFINE_FAKE_VALUE_FUNC(ssize_t, z_impl_zsock_recvfrom, int, void *, size_t, int, DEFINE_FAKE_VALUE_FUNC(ssize_t, z_impl_zsock_sendto, int, void *, size_t, int, const struct sockaddr *, socklen_t); -struct zsock_pollfd { +struct zvfs_pollfd { int fd; short events; short revents; @@ -39,7 +39,7 @@ int z_impl_zsock_socket(int family, int type, int proto) return 0; } -int z_impl_zsock_poll(struct zsock_pollfd *fds, int nfds, int poll_timeout) +int z_impl_zvfs_poll(struct zvfs_pollfd *fds, int nfds, int poll_timeout) { LOG_INF("Polling, events %d", my_events); k_sleep(K_MSEC(1)); diff --git a/tests/net/lib/lwm2m/lwm2m_engine/prj.conf b/tests/net/lib/lwm2m/lwm2m_engine/prj.conf index 5d331d20c3312..4dd0a80c1f2d2 100644 --- a/tests/net/lib/lwm2m/lwm2m_engine/prj.conf +++ b/tests/net/lib/lwm2m/lwm2m_engine/prj.conf @@ -1,3 +1,5 @@ CONFIG_ZTEST=y CONFIG_ZTEST_STACK_SIZE=5120 CONFIG_MP_MAX_NUM_CPUS=1 + +CONFIG_ZVFS=y diff --git a/tests/net/lib/lwm2m/lwm2m_engine/src/stubs.c b/tests/net/lib/lwm2m/lwm2m_engine/src/stubs.c index 13b0e38e8e6e0..953d4b72f2577 100644 --- a/tests/net/lib/lwm2m/lwm2m_engine/src/stubs.c +++ b/tests/net/lib/lwm2m/lwm2m_engine/src/stubs.c @@ -54,7 +54,7 @@ sys_slist_t *lwm2m_obs_obj_path_list(void) static sys_slist_t engine_obj_inst_list = SYS_SLIST_STATIC_INIT(&engine_obj_inst_list); sys_slist_t *lwm2m_engine_obj_inst_list(void) { return &engine_obj_inst_list; } -struct zsock_pollfd { +struct zvfs_pollfd { int fd; short events; short revents; @@ -123,7 +123,7 @@ ssize_t z_impl_zsock_recvfrom(int sock, void *buf, size_t max_len, int flags, return -1; } -int z_impl_zsock_poll(struct zsock_pollfd *fds, int nfds, int poll_timeout) +int z_impl_zvfs_poll(struct zvfs_pollfd *fds, int nfds, int poll_timeout) { k_sleep(K_MSEC(1)); fds->revents = my_events; From b3d3d4fff7e4a9af9f9349c1ca179e0b28362ef7 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Fri, 26 Jul 2024 22:41:12 -0400 Subject: [PATCH 0704/4482] net: sockets: move select() implementation to zvfs Move the implementation of zsock_select() to zvfs_select(). This allows other types of file descriptors to also make use of select() functionality even when the network subsystem is not enabled. Additionally, it partially removes a dependency cycle between posix and networking by moving functionality into a mutual dependency. Signed-off-by: Chris Friedt --- include/zephyr/net/socket_select.h | 42 ++++--- include/zephyr/posix/sys/select.h | 14 ++- include/zephyr/sys/fdtable.h | 24 +++- lib/os/zvfs/CMakeLists.txt | 1 + lib/os/zvfs/Kconfig | 5 + .../os/zvfs/zvfs_select.c | 106 +++++++++--------- lib/posix/options/Kconfig.device_io | 1 + lib/posix/options/device_io.c | 24 +++- subsys/net/lib/sockets/CMakeLists.txt | 2 - subsys/net/lib/sockets/Kconfig | 1 + tests/posix/headers/prj.conf | 1 + tests/posix/headers/src/sys_select_h.c | 10 +- 12 files changed, 148 insertions(+), 83 deletions(-) rename subsys/net/lib/sockets/sockets_select.c => lib/os/zvfs/zvfs_select.c (61%) diff --git a/include/zephyr/net/socket_select.h b/include/zephyr/net/socket_select.h index 5fca2950d6a59..877bd863a6b82 100644 --- a/include/zephyr/net/socket_select.h +++ b/include/zephyr/net/socket_select.h @@ -19,17 +19,18 @@ * @{ */ +#include + #include #include +#include #ifdef __cplusplus extern "C" { #endif /** Socket file descriptor set. */ -typedef struct zsock_fd_set { - uint32_t bitset[(CONFIG_ZVFS_OPEN_MAX + 31) / 32]; -} zsock_fd_set; +typedef struct zvfs_fd_set zsock_fd_set; /** * @brief Legacy function to poll multiple sockets for events @@ -47,13 +48,16 @@ typedef struct zsock_fd_set { * it may conflict with generic POSIX ``select()`` function). * @endrst */ -__syscall int zsock_select(int nfds, zsock_fd_set *readfds, - zsock_fd_set *writefds, - zsock_fd_set *exceptfds, - struct zsock_timeval *timeout); +static inline int zsock_select(int nfds, zsock_fd_set *readfds, zsock_fd_set *writefds, + zsock_fd_set *exceptfds, struct zsock_timeval *timeout) +{ + struct timeval; + + return zvfs_select(nfds, readfds, writefds, exceptfds, (struct timeval *)timeout); +} /** Number of file descriptors which can be added to zsock_fd_set */ -#define ZSOCK_FD_SETSIZE (sizeof(((zsock_fd_set *)0)->bitset) * 8) +#define ZSOCK_FD_SETSIZE ZVFS_FD_SETSIZE /** * @brief Initialize (clear) fd_set @@ -67,7 +71,10 @@ __syscall int zsock_select(int nfds, zsock_fd_set *readfds, * if :kconfig:option:`CONFIG_POSIX_API` is defined. * @endrst */ -void ZSOCK_FD_ZERO(zsock_fd_set *set); +static inline void ZSOCK_FD_ZERO(zsock_fd_set *set) +{ + ZVFS_FD_ZERO(set); +} /** * @brief Check whether socket is a member of fd_set @@ -81,7 +88,10 @@ void ZSOCK_FD_ZERO(zsock_fd_set *set); * if :kconfig:option:`CONFIG_POSIX_API` is defined. * @endrst */ -int ZSOCK_FD_ISSET(int fd, zsock_fd_set *set); +static inline int ZSOCK_FD_ISSET(int fd, zsock_fd_set *set) +{ + return ZVFS_FD_ISSET(fd, set); +} /** * @brief Remove socket from fd_set @@ -95,7 +105,10 @@ int ZSOCK_FD_ISSET(int fd, zsock_fd_set *set); * if :kconfig:option:`CONFIG_POSIX_API` is defined. * @endrst */ -void ZSOCK_FD_CLR(int fd, zsock_fd_set *set); +static inline void ZSOCK_FD_CLR(int fd, zsock_fd_set *set) +{ + ZVFS_FD_CLR(fd, set); +} /** * @brief Add socket to fd_set @@ -109,7 +122,10 @@ void ZSOCK_FD_CLR(int fd, zsock_fd_set *set); * if :kconfig:option:`CONFIG_POSIX_API` is defined. * @endrst */ -void ZSOCK_FD_SET(int fd, zsock_fd_set *set); +static inline void ZSOCK_FD_SET(int fd, zsock_fd_set *set) +{ + ZVFS_FD_SET(fd, set); +} /** @cond INTERNAL_HIDDEN */ @@ -153,8 +169,6 @@ static inline void FD_SET(int fd, zsock_fd_set *set) } #endif -#include - /** * @} */ diff --git a/include/zephyr/posix/sys/select.h b/include/zephyr/posix/sys/select.h index fc61c018e249f..e10eeb237ee0d 100644 --- a/include/zephyr/posix/sys/select.h +++ b/include/zephyr/posix/sys/select.h @@ -13,16 +13,18 @@ extern "C" { #endif +#undef fd_set #define fd_set zsock_fd_set -#define FD_SETSIZE ZSOCK_FD_SETSIZE -#define FD_ZERO ZSOCK_FD_ZERO -#define FD_SET ZSOCK_FD_SET -#define FD_CLR ZSOCK_FD_CLR -#define FD_ISSET ZSOCK_FD_ISSET + +#define FD_SETSIZE ZVFS_FD_SETSIZE struct timeval; -int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); +int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout); +void FD_CLR(int fd, fd_set *fdset); +int FD_ISSET(int fd, fd_set *fdset); +void FD_SET(int fd, fd_set *fdset); +void FD_ZERO(fd_set *fdset); #ifdef __cplusplus } diff --git a/include/zephyr/sys/fdtable.h b/include/zephyr/sys/fdtable.h index 5db80988b30c4..ba709a68cdbef 100644 --- a/include/zephyr/sys/fdtable.h +++ b/include/zephyr/sys/fdtable.h @@ -7,9 +7,10 @@ #define ZEPHYR_INCLUDE_SYS_FDTABLE_H_ #include -#include +#include + /* FIXME: For native_posix ssize_t, off_t. */ -#include +#include #include #include @@ -207,6 +208,23 @@ struct zvfs_pollfd { __syscall int zvfs_poll(struct zvfs_pollfd *fds, int nfds, int poll_timeout); +struct zvfs_fd_set { + uint32_t bitset[(CONFIG_ZVFS_OPEN_MAX + 31) / 32]; +}; + +/** @brief Number of file descriptors which can be added @ref zvfs_fd_set */ +#define ZVFS_FD_SETSIZE (sizeof(((struct zvfs_fd_set *)0)->bitset) * 8) + +void ZVFS_FD_CLR(int fd, struct zvfs_fd_set *fdset); +int ZVFS_FD_ISSET(int fd, struct zvfs_fd_set *fdset); +void ZVFS_FD_SET(int fd, struct zvfs_fd_set *fdset); +void ZVFS_FD_ZERO(struct zvfs_fd_set *fdset); + +__syscall int zvfs_select(int nfds, struct zvfs_fd_set *ZRESTRICT readfds, + struct zvfs_fd_set *ZRESTRICT writefds, + struct zvfs_fd_set *ZRESTRICT errorfds, + const struct timeval *ZRESTRICT timeout); + /** * Request codes for fd_op_vtable.ioctl(). * @@ -236,4 +254,6 @@ enum { } #endif +#include + #endif /* ZEPHYR_INCLUDE_SYS_FDTABLE_H_ */ diff --git a/lib/os/zvfs/CMakeLists.txt b/lib/os/zvfs/CMakeLists.txt index ef0dde4513bed..d855d1005efc6 100644 --- a/lib/os/zvfs/CMakeLists.txt +++ b/lib/os/zvfs/CMakeLists.txt @@ -3,3 +3,4 @@ zephyr_library() zephyr_library_sources_ifdef(CONFIG_ZVFS_EVENTFD zvfs_eventfd.c) zephyr_library_sources_ifdef(CONFIG_ZVFS_POLL zvfs_poll.c) +zephyr_library_sources_ifdef(CONFIG_ZVFS_SELECT zvfs_select.c) diff --git a/lib/os/zvfs/Kconfig b/lib/os/zvfs/Kconfig index 40cba2cd9c9f4..df107c24c626d 100644 --- a/lib/os/zvfs/Kconfig +++ b/lib/os/zvfs/Kconfig @@ -49,6 +49,11 @@ config ZVFS_POLL_MAX help Maximum number of entries supported for poll() call. +config ZVFS_SELECT + bool "ZVFS select" + help + Enable support for zvfs_select(). + endif # ZVFS_POLL endif # ZVFS diff --git a/subsys/net/lib/sockets/sockets_select.c b/lib/os/zvfs/zvfs_select.c similarity index 61% rename from subsys/net/lib/sockets/sockets_select.c rename to lib/os/zvfs/zvfs_select.c index 49d61a2d28c65..32748fc694bb2 100644 --- a/subsys/net/lib/sockets/sockets_select.c +++ b/lib/os/zvfs/zvfs_select.c @@ -1,14 +1,16 @@ /* * Copyright (c) 2018 Linaro Limited + * Copyright (c) 2024 Tenstorrent AI ULC * * SPDX-License-Identifier: Apache-2.0 */ +#include + #include #include #include #include -#include "sockets_internal.h" /* Get size, in elements, of an array within a struct. */ #define STRUCT_MEMBER_ARRAY_SIZE(type, field) ARRAY_SIZE(((type *)0)->field) @@ -20,7 +22,9 @@ bit_mask = 1 << b_idx; \ } -void ZSOCK_FD_ZERO(zsock_fd_set *set) +int zvfs_poll_internal(struct zvfs_pollfd *fds, int nfds, k_timeout_t timeout); + +void ZVFS_FD_ZERO(struct zvfs_fd_set *set) { int i; @@ -29,11 +33,11 @@ void ZSOCK_FD_ZERO(zsock_fd_set *set) } } -int ZSOCK_FD_ISSET(int fd, zsock_fd_set *set) +int ZVFS_FD_ISSET(int fd, struct zvfs_fd_set *set) { uint32_t word_idx, bit_mask; - if (fd < 0 || fd >= ZSOCK_FD_SETSIZE) { + if (fd < 0 || fd >= ZVFS_FD_SETSIZE) { return 0; } @@ -42,11 +46,11 @@ int ZSOCK_FD_ISSET(int fd, zsock_fd_set *set) return (set->bitset[word_idx] & bit_mask) != 0U; } -void ZSOCK_FD_CLR(int fd, zsock_fd_set *set) +void ZVFS_FD_CLR(int fd, struct zvfs_fd_set *set) { uint32_t word_idx, bit_mask; - if (fd < 0 || fd >= ZSOCK_FD_SETSIZE) { + if (fd < 0 || fd >= ZVFS_FD_SETSIZE) { return; } @@ -55,11 +59,11 @@ void ZSOCK_FD_CLR(int fd, zsock_fd_set *set) set->bitset[word_idx] &= ~bit_mask; } -void ZSOCK_FD_SET(int fd, zsock_fd_set *set) +void ZVFS_FD_SET(int fd, struct zvfs_fd_set *set) { uint32_t word_idx, bit_mask; - if (fd < 0 || fd >= ZSOCK_FD_SETSIZE) { + if (fd < 0 || fd >= ZVFS_FD_SETSIZE) { return; } @@ -68,17 +72,19 @@ void ZSOCK_FD_SET(int fd, zsock_fd_set *set) set->bitset[word_idx] |= bit_mask; } -int z_impl_zsock_select(int nfds, zsock_fd_set *readfds, zsock_fd_set *writefds, - zsock_fd_set *exceptfds, struct zsock_timeval *timeout) +int z_impl_zvfs_select(int nfds, struct zvfs_fd_set *ZRESTRICT readfds, + struct zvfs_fd_set *ZRESTRICT writefds, + struct zvfs_fd_set *ZRESTRICT exceptfds, + const struct timeval *ZRESTRICT timeout) { - struct zsock_pollfd pfds[CONFIG_NET_SOCKETS_POLL_MAX]; + struct zvfs_pollfd pfds[CONFIG_ZVFS_POLL_MAX]; k_timeout_t poll_timeout; int i, res; int num_pfds = 0; int num_selects = 0; int fd_no = 0; - for (i = 0; i < STRUCT_MEMBER_ARRAY_SIZE(zsock_fd_set, bitset); i++) { + for (i = 0; i < STRUCT_MEMBER_ARRAY_SIZE(struct zvfs_fd_set, bitset); i++) { uint32_t bit_mask = 1U; uint32_t read_mask = 0U, write_mask = 0U, except_mask = 0U; uint32_t ored_mask; @@ -111,15 +117,15 @@ int z_impl_zsock_select(int nfds, zsock_fd_set *readfds, zsock_fd_set *writefds, } if (read_mask & bit_mask) { - events |= ZSOCK_POLLIN; + events |= ZVFS_POLLIN; } if (write_mask & bit_mask) { - events |= ZSOCK_POLLOUT; + events |= ZVFS_POLLOUT; } if (except_mask & bit_mask) { - events |= ZSOCK_POLLPRI; + events |= ZVFS_POLLPRI; } pfds[num_pfds].fd = fd_no; @@ -134,25 +140,24 @@ int z_impl_zsock_select(int nfds, zsock_fd_set *readfds, zsock_fd_set *writefds, if (timeout == NULL) { poll_timeout = K_FOREVER; } else { - poll_timeout = - K_USEC(timeout->tv_sec * 1000000UL + timeout->tv_usec); + poll_timeout = K_USEC(timeout->tv_sec * USEC_PER_SEC + timeout->tv_usec); } - res = zsock_poll_internal(pfds, num_pfds, poll_timeout); + res = zvfs_poll_internal(pfds, num_pfds, poll_timeout); if (res == -1) { return -1; } if (readfds != NULL) { - ZSOCK_FD_ZERO(readfds); + ZVFS_FD_ZERO(readfds); } if (writefds != NULL) { - ZSOCK_FD_ZERO(writefds); + ZVFS_FD_ZERO(writefds); } if (exceptfds != NULL) { - ZSOCK_FD_ZERO(exceptfds); + ZVFS_FD_ZERO(exceptfds); } for (i = 0; i < num_pfds && res > 0; i++) { @@ -169,21 +174,21 @@ int z_impl_zsock_select(int nfds, zsock_fd_set *readfds, zsock_fd_set *writefds, * So, unlike poll(), a single invalid fd aborts the entire * select(). */ - if (revents & ZSOCK_POLLNVAL) { + if (revents & ZVFS_POLLNVAL) { errno = EBADF; return -1; } - if (revents & ZSOCK_POLLIN) { + if (revents & ZVFS_POLLIN) { if (readfds != NULL) { - ZSOCK_FD_SET(fd, readfds); + ZVFS_FD_SET(fd, readfds); num_selects++; } } - if (revents & ZSOCK_POLLOUT) { + if (revents & ZVFS_POLLOUT) { if (writefds != NULL) { - ZSOCK_FD_SET(fd, writefds); + ZVFS_FD_SET(fd, writefds); num_selects++; } } @@ -191,14 +196,14 @@ int z_impl_zsock_select(int nfds, zsock_fd_set *readfds, zsock_fd_set *writefds, /* It's unclear if HUP/ERR belong here. At least not ignore * them. Zephyr doesn't use HUP and barely use ERR so far. */ - if (revents & (ZSOCK_POLLPRI | ZSOCK_POLLHUP | ZSOCK_POLLERR)) { + if (revents & (ZVFS_POLLPRI | ZVFS_POLLHUP | ZVFS_POLLERR)) { if (exceptfds != NULL) { - ZSOCK_FD_SET(fd, exceptfds); + ZVFS_FD_SET(fd, exceptfds); num_selects++; } if (writefds != NULL) { - ZSOCK_FD_SET(fd, writefds); + ZVFS_FD_SET(fd, writefds); num_selects++; } } @@ -210,19 +215,18 @@ int z_impl_zsock_select(int nfds, zsock_fd_set *readfds, zsock_fd_set *writefds, } #ifdef CONFIG_USERSPACE -static int z_vrfy_zsock_select(int nfds, zsock_fd_set *readfds, - zsock_fd_set *writefds, - zsock_fd_set *exceptfds, - struct zsock_timeval *timeout) +static int z_vrfy_zvfs_select(int nfds, struct zvfs_fd_set *ZRESTRICT readfds, + struct zvfs_fd_set *ZRESTRICT writefds, + struct zvfs_fd_set *ZRESTRICT exceptfds, + const struct timeval *ZRESTRICT timeout) { - zsock_fd_set *readfds_copy = NULL, *writefds_copy = NULL, - *exceptfds_copy = NULL; - struct zsock_timeval *timeval = NULL; + struct zvfs_fd_set *readfds_copy = NULL, *writefds_copy = NULL, *exceptfds_copy = NULL; + struct timeval *to = NULL; int ret = -1; if (readfds) { - readfds_copy = k_usermode_alloc_from_copy((void *)readfds, - sizeof(zsock_fd_set)); + readfds_copy = + k_usermode_alloc_from_copy((void *)readfds, sizeof(struct zvfs_fd_set)); if (!readfds_copy) { errno = ENOMEM; goto out; @@ -230,8 +234,8 @@ static int z_vrfy_zsock_select(int nfds, zsock_fd_set *readfds, } if (writefds) { - writefds_copy = k_usermode_alloc_from_copy((void *)writefds, - sizeof(zsock_fd_set)); + writefds_copy = + k_usermode_alloc_from_copy((void *)writefds, sizeof(struct zvfs_fd_set)); if (!writefds_copy) { errno = ENOMEM; goto out; @@ -239,8 +243,8 @@ static int z_vrfy_zsock_select(int nfds, zsock_fd_set *readfds, } if (exceptfds) { - exceptfds_copy = k_usermode_alloc_from_copy((void *)exceptfds, - sizeof(zsock_fd_set)); + exceptfds_copy = + k_usermode_alloc_from_copy((void *)exceptfds, sizeof(struct zvfs_fd_set)); if (!exceptfds_copy) { errno = ENOMEM; goto out; @@ -248,41 +252,39 @@ static int z_vrfy_zsock_select(int nfds, zsock_fd_set *readfds, } if (timeout) { - timeval = k_usermode_alloc_from_copy((void *)timeout, - sizeof(struct zsock_timeval)); - if (!timeval) { + to = k_usermode_alloc_from_copy((void *)timeout, sizeof(*to)); + if (!to) { errno = ENOMEM; goto out; } } - ret = z_impl_zsock_select(nfds, readfds_copy, writefds_copy, - exceptfds_copy, timeval); + ret = z_impl_zvfs_select(nfds, readfds_copy, writefds_copy, exceptfds_copy, to); if (ret >= 0) { if (readfds_copy) { k_usermode_to_copy((void *)readfds, readfds_copy, - sizeof(zsock_fd_set)); + sizeof(struct zvfs_fd_set)); } if (writefds_copy) { k_usermode_to_copy((void *)writefds, writefds_copy, - sizeof(zsock_fd_set)); + sizeof(struct zvfs_fd_set)); } if (exceptfds_copy) { k_usermode_to_copy((void *)exceptfds, exceptfds_copy, - sizeof(zsock_fd_set)); + sizeof(struct zvfs_fd_set)); } } out: - k_free(timeval); + k_free(to); k_free(readfds_copy); k_free(writefds_copy); k_free(exceptfds_copy); return ret; } -#include +#include #endif diff --git a/lib/posix/options/Kconfig.device_io b/lib/posix/options/Kconfig.device_io index 74e408313ce38..e8bae34b7bd40 100644 --- a/lib/posix/options/Kconfig.device_io +++ b/lib/posix/options/Kconfig.device_io @@ -10,6 +10,7 @@ config POSIX_DEVICE_IO select REQUIRES_FULL_LIBC select ZVFS select ZVFS_POLL + select ZVFS_SELECT help Select 'y' here and Zephyr will provide an implementation of the POSIX_DEVICE_IO Option Group such as FD_CLR(), FD_ISSET(), FD_SET(), FD_ZERO(), close(), fdopen(), fileno(), open(), diff --git a/lib/posix/options/device_io.c b/lib/posix/options/device_io.c index 7b638c84976e7..eaae1c69c79e1 100644 --- a/lib/posix/options/device_io.c +++ b/lib/posix/options/device_io.c @@ -10,7 +10,6 @@ #include #include #include -#include /* prototypes for external, not-yet-public, functions in fdtable.c or fs.c */ int zvfs_close(int fd); @@ -18,6 +17,26 @@ int zvfs_open(const char *name, int flags); ssize_t zvfs_read(int fd, void *buf, size_t sz, size_t *from_offset); ssize_t zvfs_write(int fd, const void *buf, size_t sz, size_t *from_offset); +void FD_CLR(int fd, struct zvfs_fd_set *fdset) +{ + return ZVFS_FD_CLR(fd, (struct zvfs_fd_set *)fdset); +} + +int FD_ISSET(int fd, struct zvfs_fd_set *fdset) +{ + return ZVFS_FD_ISSET(fd, (struct zvfs_fd_set *)fdset); +} + +void FD_SET(int fd, struct zvfs_fd_set *fdset) +{ + ZVFS_FD_SET(fd, (struct zvfs_fd_set *)fdset); +} + +void FD_ZERO(fd_set *fdset) +{ + ZVFS_FD_ZERO((struct zvfs_fd_set *)fdset); +} + int close(int fd) { return zvfs_close(fd); @@ -74,8 +93,7 @@ FUNC_ALIAS(read, _read, ssize_t); int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) { - /* TODO: create zvfs_select() and dispatch to subsystems based on file type */ - return zsock_select(nfds, readfds, writefds, exceptfds, (struct zsock_timeval *)timeout); + return zvfs_select(nfds, readfds, writefds, exceptfds, timeout); } ssize_t write(int fd, const void *buf, size_t sz) diff --git a/subsys/net/lib/sockets/CMakeLists.txt b/subsys/net/lib/sockets/CMakeLists.txt index 28b76df4a7af4..63710f42226bb 100644 --- a/subsys/net/lib/sockets/CMakeLists.txt +++ b/subsys/net/lib/sockets/CMakeLists.txt @@ -2,7 +2,6 @@ zephyr_syscall_header( ${ZEPHYR_BASE}/include/zephyr/net/socket.h - ${ZEPHYR_BASE}/include/zephyr/net/socket_select.h ) zephyr_library_include_directories(.) @@ -10,7 +9,6 @@ zephyr_library_include_directories(.) zephyr_library_sources( getaddrinfo.c sockets.c - sockets_select.c ) if(NOT CONFIG_NET_SOCKETS_OFFLOAD) diff --git a/subsys/net/lib/sockets/Kconfig b/subsys/net/lib/sockets/Kconfig index 09c436558a9da..47192211fb858 100644 --- a/subsys/net/lib/sockets/Kconfig +++ b/subsys/net/lib/sockets/Kconfig @@ -7,6 +7,7 @@ menuconfig NET_SOCKETS bool "BSD Sockets compatible API" select ZVFS select ZVFS_POLL + select ZVFS_SELECT help Provide BSD Sockets like API on top of native Zephyr networking API. diff --git a/tests/posix/headers/prj.conf b/tests/posix/headers/prj.conf index 374baf4cbdfa6..e5c34983aeaf2 100644 --- a/tests/posix/headers/prj.conf +++ b/tests/posix/headers/prj.conf @@ -22,3 +22,4 @@ CONFIG_POSIX_TIMERS=y CONFIG_POSIX_MESSAGE_PASSING=y CONFIG_EVENTFD=y CONFIG_POSIX_C_LIB_EXT=y +CONFIG_POSIX_DEVICE_IO=y diff --git a/tests/posix/headers/src/sys_select_h.c b/tests/posix/headers/src/sys_select_h.c index 5cca45419712d..49fd4dc8ed5f8 100644 --- a/tests/posix/headers/src/sys_select_h.c +++ b/tests/posix/headers/src/sys_select_h.c @@ -22,12 +22,14 @@ ZTEST(posix_headers, test_sys_select_h) fd_set fds = {0}; zassert_not_equal(-1, FD_SETSIZE); - FD_CLR(0, &fds); - FD_ISSET(0, &fds); - FD_SET(0, &fds); - FD_ZERO(&fds); if (IS_ENABLED(CONFIG_POSIX_DEVICE_IO)) { + + FD_CLR(0, &fds); + FD_ISSET(0, &fds); + FD_SET(0, &fds); + FD_ZERO(&fds); + /* zassert_not_null(pselect); */ /* not implemented */ zassert_not_null(select); } From 1715196cff5cdd2949356bbb694a9e484be3b5ad Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Sat, 15 Jun 2024 11:44:44 -0400 Subject: [PATCH 0705/4482] posix: device_io: implement pselect() Implement pselect() as it's required by POSIX_DEVICE_IO Signed-off-by: Chris Friedt --- include/zephyr/net/socket_select.h | 7 +++++-- include/zephyr/posix/sys/select.h | 2 ++ include/zephyr/sys/fdtable.h | 2 +- lib/os/zvfs/zvfs_select.c | 12 +++++++----- lib/posix/options/device_io.c | 13 ++++++++++++- tests/posix/headers/src/sys_select_h.c | 2 +- 6 files changed, 28 insertions(+), 10 deletions(-) diff --git a/include/zephyr/net/socket_select.h b/include/zephyr/net/socket_select.h index 877bd863a6b82..7a9b1ca200b31 100644 --- a/include/zephyr/net/socket_select.h +++ b/include/zephyr/net/socket_select.h @@ -51,9 +51,12 @@ typedef struct zvfs_fd_set zsock_fd_set; static inline int zsock_select(int nfds, zsock_fd_set *readfds, zsock_fd_set *writefds, zsock_fd_set *exceptfds, struct zsock_timeval *timeout) { - struct timeval; + struct timespec to = { + .tv_sec = (timeout == NULL) ? 0 : timeout->tv_sec, + .tv_nsec = (long)((timeout == NULL) ? 0 : timeout->tv_usec * NSEC_PER_USEC)}; - return zvfs_select(nfds, readfds, writefds, exceptfds, (struct timeval *)timeout); + return zvfs_select(nfds, readfds, writefds, exceptfds, (timeout == NULL) ? NULL : &to, + NULL); } /** Number of file descriptors which can be added to zsock_fd_set */ diff --git a/include/zephyr/posix/sys/select.h b/include/zephyr/posix/sys/select.h index e10eeb237ee0d..78d900f5316b2 100644 --- a/include/zephyr/posix/sys/select.h +++ b/include/zephyr/posix/sys/select.h @@ -20,6 +20,8 @@ extern "C" { struct timeval; +int pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, + const struct timespec *timeout, const void *sigmask); int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout); void FD_CLR(int fd, fd_set *fdset); int FD_ISSET(int fd, fd_set *fdset); diff --git a/include/zephyr/sys/fdtable.h b/include/zephyr/sys/fdtable.h index ba709a68cdbef..e9447ee618fc6 100644 --- a/include/zephyr/sys/fdtable.h +++ b/include/zephyr/sys/fdtable.h @@ -223,7 +223,7 @@ void ZVFS_FD_ZERO(struct zvfs_fd_set *fdset); __syscall int zvfs_select(int nfds, struct zvfs_fd_set *ZRESTRICT readfds, struct zvfs_fd_set *ZRESTRICT writefds, struct zvfs_fd_set *ZRESTRICT errorfds, - const struct timeval *ZRESTRICT timeout); + const struct timespec *ZRESTRICT timeout, const void *ZRESTRICT sigmask); /** * Request codes for fd_op_vtable.ioctl(). diff --git a/lib/os/zvfs/zvfs_select.c b/lib/os/zvfs/zvfs_select.c index 32748fc694bb2..d23dd52eb5562 100644 --- a/lib/os/zvfs/zvfs_select.c +++ b/lib/os/zvfs/zvfs_select.c @@ -75,7 +75,7 @@ void ZVFS_FD_SET(int fd, struct zvfs_fd_set *set) int z_impl_zvfs_select(int nfds, struct zvfs_fd_set *ZRESTRICT readfds, struct zvfs_fd_set *ZRESTRICT writefds, struct zvfs_fd_set *ZRESTRICT exceptfds, - const struct timeval *ZRESTRICT timeout) + const struct timespec *ZRESTRICT timeout, const void *ZRESTRICT sigmask) { struct zvfs_pollfd pfds[CONFIG_ZVFS_POLL_MAX]; k_timeout_t poll_timeout; @@ -140,7 +140,8 @@ int z_impl_zvfs_select(int nfds, struct zvfs_fd_set *ZRESTRICT readfds, if (timeout == NULL) { poll_timeout = K_FOREVER; } else { - poll_timeout = K_USEC(timeout->tv_sec * USEC_PER_SEC + timeout->tv_usec); + poll_timeout = + K_USEC(timeout->tv_sec * USEC_PER_SEC + timeout->tv_nsec / NSEC_PER_USEC); } res = zvfs_poll_internal(pfds, num_pfds, poll_timeout); @@ -218,10 +219,11 @@ int z_impl_zvfs_select(int nfds, struct zvfs_fd_set *ZRESTRICT readfds, static int z_vrfy_zvfs_select(int nfds, struct zvfs_fd_set *ZRESTRICT readfds, struct zvfs_fd_set *ZRESTRICT writefds, struct zvfs_fd_set *ZRESTRICT exceptfds, - const struct timeval *ZRESTRICT timeout) + const struct timespec *ZRESTRICT timeout, + const void *ZRESTRICT sigmask) { struct zvfs_fd_set *readfds_copy = NULL, *writefds_copy = NULL, *exceptfds_copy = NULL; - struct timeval *to = NULL; + struct timespec *to = NULL; int ret = -1; if (readfds) { @@ -259,7 +261,7 @@ static int z_vrfy_zvfs_select(int nfds, struct zvfs_fd_set *ZRESTRICT readfds, } } - ret = z_impl_zvfs_select(nfds, readfds_copy, writefds_copy, exceptfds_copy, to); + ret = z_impl_zvfs_select(nfds, readfds_copy, writefds_copy, exceptfds_copy, to, sigmask); if (ret >= 0) { if (readfds_copy) { diff --git a/lib/posix/options/device_io.c b/lib/posix/options/device_io.c index eaae1c69c79e1..d15b5da2a91ac 100644 --- a/lib/posix/options/device_io.c +++ b/lib/posix/options/device_io.c @@ -71,6 +71,12 @@ ssize_t pread(int fd, void *buf, size_t count, off_t offset) return zvfs_read(fd, buf, count, (size_t *)&off); } +int pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, + const struct timespec *timeout, const void *sigmask) +{ + return zvfs_select(nfds, readfds, writefds, exceptfds, timeout, sigmask); +} + ssize_t pwrite(int fd, void *buf, size_t count, off_t offset) { size_t off = (size_t)offset; @@ -93,7 +99,12 @@ FUNC_ALIAS(read, _read, ssize_t); int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) { - return zvfs_select(nfds, readfds, writefds, exceptfds, timeout); + struct timespec to = { + .tv_sec = (timeout == NULL) ? 0 : timeout->tv_sec, + .tv_nsec = (long)((timeout == NULL) ? 0 : timeout->tv_usec * NSEC_PER_USEC)}; + + return zvfs_select(nfds, readfds, writefds, exceptfds, (timeout == NULL) ? NULL : &to, + NULL); } ssize_t write(int fd, const void *buf, size_t sz) diff --git a/tests/posix/headers/src/sys_select_h.c b/tests/posix/headers/src/sys_select_h.c index 49fd4dc8ed5f8..ad1014c5b446d 100644 --- a/tests/posix/headers/src/sys_select_h.c +++ b/tests/posix/headers/src/sys_select_h.c @@ -30,7 +30,7 @@ ZTEST(posix_headers, test_sys_select_h) FD_SET(0, &fds); FD_ZERO(&fds); - /* zassert_not_null(pselect); */ /* not implemented */ + zassert_not_null(pselect); zassert_not_null(select); } } From 399458e3b43b6b62fac314ef9894506cf7545e80 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Sat, 15 Jun 2024 12:02:22 -0400 Subject: [PATCH 0706/4482] posix: device_io: implement fdopen() Implement fdopen(), as required by the POSIX_DEVICE_IO Option Group. Signed-off-by: Chris Friedt --- lib/os/fdtable.c | 12 ++++++++++++ lib/posix/options/device_io.c | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/lib/os/fdtable.c b/lib/os/fdtable.c index 8af73b8bfcbbf..42ab0ae877544 100644 --- a/lib/os/fdtable.c +++ b/lib/os/fdtable.c @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -397,6 +398,17 @@ int zvfs_close(int fd) return res; } +FILE *zvfs_fdopen(int fd, const char *mode) +{ + ARG_UNUSED(mode); + + if (_check_fd(fd) < 0) { + return NULL; + } + + return (FILE *)&fdtable[fd]; +} + int zvfs_fstat(int fd, struct stat *buf) { if (_check_fd(fd) < 0) { diff --git a/lib/posix/options/device_io.c b/lib/posix/options/device_io.c index d15b5da2a91ac..0de6293ca8469 100644 --- a/lib/posix/options/device_io.c +++ b/lib/posix/options/device_io.c @@ -5,6 +5,7 @@ */ #include +#include #include #include @@ -13,6 +14,7 @@ /* prototypes for external, not-yet-public, functions in fdtable.c or fs.c */ int zvfs_close(int fd); +FILE *zvfs_fdopen(int fd, const char *mode); int zvfs_open(const char *name, int flags); ssize_t zvfs_read(int fd, void *buf, size_t sz, size_t *from_offset); ssize_t zvfs_write(int fd, const void *buf, size_t sz, size_t *from_offset); @@ -45,6 +47,11 @@ int close(int fd) FUNC_ALIAS(close, _close, int); #endif +FILE *fdopen(int fd, const char *mode) +{ + return zvfs_fdopen(fd, mode); +} + int open(const char *name, int flags, ...) { /* FIXME: necessarily need to check for O_CREAT and unpack ... if set */ From ab8b28ed7b283f62695f0030ead9e15e1b6b5558 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Sat, 15 Jun 2024 12:05:48 -0400 Subject: [PATCH 0707/4482] posix: device_io: implement fileno() Implement fileno() as required by the POSIX_DEVICE_IO Option Group. Signed-off-by: Chris Friedt --- lib/os/fdtable.c | 10 ++++++++++ lib/posix/options/device_io.c | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/lib/os/fdtable.c b/lib/os/fdtable.c index 42ab0ae877544..5baa8412e9321 100644 --- a/lib/os/fdtable.c +++ b/lib/os/fdtable.c @@ -409,6 +409,16 @@ FILE *zvfs_fdopen(int fd, const char *mode) return (FILE *)&fdtable[fd]; } +int zvfs_fileno(FILE *file) +{ + if (!IS_ARRAY_ELEMENT(fdtable, file)) { + errno = EBADF; + return -1; + } + + return (struct fd_entry *)file - fdtable; +} + int zvfs_fstat(int fd, struct stat *buf) { if (_check_fd(fd) < 0) { diff --git a/lib/posix/options/device_io.c b/lib/posix/options/device_io.c index 0de6293ca8469..a504545ba0346 100644 --- a/lib/posix/options/device_io.c +++ b/lib/posix/options/device_io.c @@ -15,6 +15,7 @@ /* prototypes for external, not-yet-public, functions in fdtable.c or fs.c */ int zvfs_close(int fd); FILE *zvfs_fdopen(int fd, const char *mode); +int zvfs_fileno(FILE *file); int zvfs_open(const char *name, int flags); ssize_t zvfs_read(int fd, void *buf, size_t sz, size_t *from_offset); ssize_t zvfs_write(int fd, const void *buf, size_t sz, size_t *from_offset); @@ -52,6 +53,11 @@ FILE *fdopen(int fd, const char *mode) return zvfs_fdopen(fd, mode); } +int fileno(FILE *file) +{ + return zvfs_fileno(file); +} + int open(const char *name, int flags, ...) { /* FIXME: necessarily need to check for O_CREAT and unpack ... if set */ From 748252aa76d9d7ac66a247daf8171ad111b926c8 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Sat, 15 Jun 2024 12:13:56 -0400 Subject: [PATCH 0708/4482] posix: device_io: use mode argument correctly in open() Previously, we had only used the flags field and ignored mode with the open() function. Signed-off-by: Chris Friedt --- lib/posix/options/device_io.c | 23 ++++++++++----- lib/posix/options/fs.c | 38 +++++++++++++++++++------ tests/posix/fs/src/test_fs_dir.c | 2 +- tests/posix/fs/src/test_fs_file.c | 2 +- tests/posix/fs/src/test_fs_open_flags.c | 4 +-- tests/posix/fs/src/test_fs_stat.c | 2 +- 6 files changed, 50 insertions(+), 21 deletions(-) diff --git a/lib/posix/options/device_io.c b/lib/posix/options/device_io.c index a504545ba0346..6fea22d01545d 100644 --- a/lib/posix/options/device_io.c +++ b/lib/posix/options/device_io.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -16,28 +17,28 @@ int zvfs_close(int fd); FILE *zvfs_fdopen(int fd, const char *mode); int zvfs_fileno(FILE *file); -int zvfs_open(const char *name, int flags); +int zvfs_open(const char *name, int flags, int mode); ssize_t zvfs_read(int fd, void *buf, size_t sz, size_t *from_offset); ssize_t zvfs_write(int fd, const void *buf, size_t sz, size_t *from_offset); void FD_CLR(int fd, struct zvfs_fd_set *fdset) { - return ZVFS_FD_CLR(fd, (struct zvfs_fd_set *)fdset); + return ZVFS_FD_CLR(fd, fdset); } int FD_ISSET(int fd, struct zvfs_fd_set *fdset) { - return ZVFS_FD_ISSET(fd, (struct zvfs_fd_set *)fdset); + return ZVFS_FD_ISSET(fd, fdset); } void FD_SET(int fd, struct zvfs_fd_set *fdset) { - ZVFS_FD_SET(fd, (struct zvfs_fd_set *)fdset); + ZVFS_FD_SET(fd, fdset); } void FD_ZERO(fd_set *fdset) { - ZVFS_FD_ZERO((struct zvfs_fd_set *)fdset); + ZVFS_FD_ZERO(fdset); } int close(int fd) @@ -60,8 +61,16 @@ int fileno(FILE *file) int open(const char *name, int flags, ...) { - /* FIXME: necessarily need to check for O_CREAT and unpack ... if set */ - return zvfs_open(name, flags); + int mode = 0; + va_list args; + + if ((flags & O_CREAT) != 0) { + va_start(args, flags); + mode = va_arg(args, int); + va_end(args); + } + + return zvfs_open(name, flags, mode); } #ifdef CONFIG_POSIX_DEVICE_IO_ALIAS_OPEN FUNC_ALIAS(open, _open, int); diff --git a/lib/posix/options/fs.c b/lib/posix/options/fs.c index 08e01d092332e..c8221a35f955d 100644 --- a/lib/posix/options/fs.c +++ b/lib/posix/options/fs.c @@ -85,7 +85,7 @@ static int posix_mode_to_zephyr(int mf) return mode; } -int zvfs_open(const char *name, int flags) +int zvfs_open(const char *name, int flags, int mode) { int rc, fd; struct posix_fs_desc *ptr = NULL; @@ -102,24 +102,44 @@ int zvfs_open(const char *name, int flags) ptr = posix_fs_alloc_obj(false); if (ptr == NULL) { - zvfs_free_fd(fd); - errno = EMFILE; - return -1; + rc = -EMFILE; + goto out_err; } fs_file_t_init(&ptr->file); - rc = fs_open(&ptr->file, name, zmode); + if (flags & O_CREAT) { + flags &= ~O_CREAT; + + rc = fs_open(&ptr->file, name, FS_O_CREATE | (mode & O_ACCMODE)); + if (rc < 0) { + goto out_err; + } + rc = fs_close(&ptr->file); + if (rc < 0) { + goto out_err; + } + } + rc = fs_open(&ptr->file, name, zmode); if (rc < 0) { - posix_fs_free_obj(ptr); - zvfs_free_fd(fd); - errno = -rc; - return -1; + goto out_err; } zvfs_finalize_fd(fd, ptr, &fs_fd_op_vtable); + goto out; + +out_err: + if (ptr != NULL) { + posix_fs_free_obj(ptr); + } + + zvfs_free_fd(fd); + errno = -rc; + return -1; + +out: return fd; } diff --git a/tests/posix/fs/src/test_fs_dir.c b/tests/posix/fs/src/test_fs_dir.c index 9cd58525ad199..c9d967016d60b 100644 --- a/tests/posix/fs/src/test_fs_dir.c +++ b/tests/posix/fs/src/test_fs_dir.c @@ -30,7 +30,7 @@ static int test_mkdir(void) return res; } - res = open(TEST_DIR_FILE, O_CREAT | O_RDWR); + res = open(TEST_DIR_FILE, O_CREAT | O_RDWR, 0770); if (res < 0) { TC_PRINT("Failed opening file [%d]\n", res); diff --git a/tests/posix/fs/src/test_fs_file.c b/tests/posix/fs/src/test_fs_file.c index 884ce4e630a5b..ee1fcd1e058ad 100644 --- a/tests/posix/fs/src/test_fs_file.c +++ b/tests/posix/fs/src/test_fs_file.c @@ -16,7 +16,7 @@ static int test_file_open(void) { int res; - res = open(TEST_FILE, O_CREAT | O_RDWR); + res = open(TEST_FILE, O_CREAT | O_RDWR, 0660); if (res < 0) { TC_ERROR("Failed opening file: %d, errno=%d\n", res, errno); /* FIXME: restructure tests as per #46897 */ diff --git a/tests/posix/fs/src/test_fs_open_flags.c b/tests/posix/fs/src/test_fs_open_flags.c index 1187b1c3e5757..7c35145343b75 100644 --- a/tests/posix/fs/src/test_fs_open_flags.c +++ b/tests/posix/fs/src/test_fs_open_flags.c @@ -60,7 +60,7 @@ static int test_file_open_flags(void) /* 2 Create file for read only, attempt to read, attempt to write */ TC_PRINT("Open on non-existent file, flags = O_CREAT | O_WRONLY\n"); - fd = open(THE_FILE, O_CREAT | O_WRONLY); + fd = open(THE_FILE, O_CREAT | O_WRONLY, 0440); if (fd < 0) { TC_PRINT("Expected success; fd = %d, errno = %d\n", fd, errno); return TC_FAIL; @@ -236,7 +236,7 @@ static int test_file_open_flags(void) TC_PRINT("Attempt write to file opened with O_APPEND | O_RDWR\n"); /* Clean start */ unlink(THE_FILE); - fd = open(THE_FILE, O_CREAT | O_WRONLY); + fd = open(THE_FILE, O_CREAT | O_WRONLY, 0440); if (fd < 0) { TC_PRINT("Expected success, fd = %d, errno = %d\n", fd, errno); return TC_FAIL; diff --git a/tests/posix/fs/src/test_fs_stat.c b/tests/posix/fs/src/test_fs_stat.c index 469abcdca45be..9aa7db128917e 100644 --- a/tests/posix/fs/src/test_fs_stat.c +++ b/tests/posix/fs/src/test_fs_stat.c @@ -24,7 +24,7 @@ static void create_file(const char *filename, uint32_t size) { int fh; - fh = open(filename, O_CREAT | O_WRONLY); + fh = open(filename, O_CREAT | O_WRONLY, 0440); zassert(fh >= 0, "Failed creating test file"); uint8_t filling[FILL_SIZE]; From d9398cd203abe289899a83b49a9290130383ec0b Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Fri, 26 Jul 2024 22:48:34 -0400 Subject: [PATCH 0709/4482] doc: posix: mark posix device io as complete Mark the POSIX_DEVICE_IO Option Group as commplete. This Option Group is required for PSE51, PSE52, PSE53, PSE54, and most of the interesting applications involving file descriptors and sockets. Signed-off-by: Chris Friedt --- doc/services/portability/posix/aep/index.rst | 2 +- .../portability/posix/option_groups/index.rst | 58 ++++++++++--------- 2 files changed, 32 insertions(+), 28 deletions(-) diff --git a/doc/services/portability/posix/aep/index.rst b/doc/services/portability/posix/aep/index.rst index 0e7f71cdf7215..50f96b4c12338 100644 --- a/doc/services/portability/posix/aep/index.rst +++ b/doc/services/portability/posix/aep/index.rst @@ -50,7 +50,7 @@ The *Minimal Realtime System Profile* (PSE51) includes all of the :ref:`POSIX_C_LANG_JUMP `, yes, :ref:`POSIX_C_LANG_SUPPORT `, yes, - :ref:`POSIX_DEVICE_IO `,, :kconfig:option:`CONFIG_POSIX_DEVICE_IO` + :ref:`POSIX_DEVICE_IO `, yes, :kconfig:option:`CONFIG_POSIX_DEVICE_IO` :ref:`POSIX_SIGNALS `, yes, :kconfig:option:`CONFIG_POSIX_SIGNALS` :ref:`†` :ref:`POSIX_SINGLE_PROCESS `, yes, :kconfig:option:`CONFIG_POSIX_SINGLE_PROCESS` :ref:`XSI_THREADS_EXT `, yes, :kconfig:option:`CONFIG_XSI_THREADS_EXT` diff --git a/doc/services/portability/posix/option_groups/index.rst b/doc/services/portability/posix/option_groups/index.rst index 87ebec0357c15..41d9aa4872bec 100644 --- a/doc/services/portability/posix/option_groups/index.rst +++ b/doc/services/portability/posix/option_groups/index.rst @@ -121,6 +121,10 @@ POSIX_DEVICE_IO Enable this option group with :kconfig:option:`CONFIG_POSIX_DEVICE_IO`. +.. note:: + When using Newlib, Picolibc, or other C libraries conforming to the ISO C Standard, the + C89 components of the ``POSIX_DEVICE_IO`` Option Group are considered supported. + .. csv-table:: POSIX_DEVICE_IO :header: API, Supported :widths: 50,10 @@ -131,48 +135,48 @@ Enable this option group with :kconfig:option:`CONFIG_POSIX_DEVICE_IO`. FD_ZERO(),yes clearerr(),yes close(),yes - fclose(), - fdopen(), - feof(), - ferror(), - fflush(), - fgetc(), - fgets(), - fileno(), - fopen(), + fclose(),yes + fdopen(),yes + feof(),yes + ferror(),yes + fflush(),yes + fgetc(),yes + fgets(),yes + fileno(),yes + fopen(),yes fprintf(),yes fputc(),yes fputs(),yes - fread(), - freopen(), - fscanf(), + fread(),yes + freopen(),yes + fscanf(),yes fwrite(),yes - getc(), - getchar(), - gets(), + getc(),yes + getchar(),yes + gets(),yes open(),yes perror(),yes poll(),yes printf(),yes - pread(), - pselect(), + pread(),yes + pselect(),yes putc(),yes putchar(),yes puts(),yes - pwrite(), + pwrite(),yes read(),yes - scanf(), + scanf(),yes select(),yes - setbuf(), - setvbuf(), - stderr, - stdin, - stdout, - ungetc(), + setbuf(),yes + setvbuf(),yes + stderr,yes + stdin,yes + stdout,yes + ungetc(),yes vfprintf(),yes - vfscanf(), + vfscanf(),yes vprintf(),yes - vscanf(), + vscanf(),yes write(),yes .. _posix_option_group_fd_mgmt: From c152fb90f839e61111de5db9f5edc1218a694366 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Wed, 26 Jun 2024 15:13:47 -0400 Subject: [PATCH 0710/4482] posix: kconfig: remove select y from non-user-selectable help Several help prompts for non-user-selectable Kconfig options included the phrase "select 'y' here", which does not make any sense in this situation. Adjust the help sections to use more appropriate language. Signed-off-by: Chris Friedt --- lib/posix/options/Kconfig.device_io | 8 ++++---- lib/posix/options/Kconfig.fd_mgmt | 6 +++--- lib/posix/options/Kconfig.fs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/posix/options/Kconfig.device_io b/lib/posix/options/Kconfig.device_io index e8bae34b7bd40..0b30f291fd327 100644 --- a/lib/posix/options/Kconfig.device_io +++ b/lib/posix/options/Kconfig.device_io @@ -27,22 +27,22 @@ if POSIX_DEVICE_IO config POSIX_DEVICE_IO_ALIAS_CLOSE bool help - Select 'y' here and Zephyr will provide an alias for close() as _close(). + When selected via Kconfig, Zephyr will provide an alias for close() as _close(). config POSIX_DEVICE_IO_ALIAS_OPEN bool help - Select 'y' here and Zephyr will provide an alias for open() as _open(). + When selected via Kconfig, Zephyr will provide an alias for open() as _open(). config POSIX_DEVICE_IO_ALIAS_READ bool help - Select 'y' here and Zephyr will provide an alias for read() as _read(). + When selected via Kconfig, Zephyr will provide an alias for read() as _read(). config POSIX_DEVICE_IO_ALIAS_WRITE bool help - Select 'y' here and Zephyr will provide an alias for write() as _write(). + When selected via Kconfig, Zephyr will provide an alias for write() as _write(). endif # POSIX_DEVICE_IO diff --git a/lib/posix/options/Kconfig.fd_mgmt b/lib/posix/options/Kconfig.fd_mgmt index ca16539560148..329036ffbf891 100644 --- a/lib/posix/options/Kconfig.fd_mgmt +++ b/lib/posix/options/Kconfig.fd_mgmt @@ -21,16 +21,16 @@ if POSIX_FD_MGMT config POSIX_FD_MGMT_ALIAS_FCNTL bool help - Select 'y' here and Zephyr will provide an alias for fcntl() as _fcntl(). + When selected via Kconfig, Zephyr will provide an alias for fcntl() as _fcntl(). config POSIX_FD_MGMT_ALIAS_FTRUNCATE bool help - Select 'y' here and Zephyr will provide an alias for ftruncate() as _ftruncate(). + When selected via Kconfig, Zephyr will provide an alias for ftruncate() as _ftruncate(). config POSIX_FD_MGMT_ALIAS_LSEEK bool help - Select 'y' here and Zephyr will provide an alias for lseek() as _lseek(). + When selected via Kconfig, Zephyr will provide an alias for lseek() as _lseek(). endif # POSIX_FD_MGMT diff --git a/lib/posix/options/Kconfig.fs b/lib/posix/options/Kconfig.fs index 4cfcc5b4274b8..ce1acb118e0f4 100644 --- a/lib/posix/options/Kconfig.fs +++ b/lib/posix/options/Kconfig.fs @@ -15,7 +15,7 @@ if POSIX_FILE_SYSTEM config POSIX_FILE_SYSTEM_ALIAS_FSTAT bool help - Select 'y' here and Zephyr will provide an alias for fstat() as _fstat(). + When selected via Kconfig, Zephyr will provide an alias for fstat() as _fstat(). config POSIX_FILE_SYSTEM_R bool "Thread-Safe File System" From e82b2ea9242993e92f3d742fead21240506dc3f7 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Wed, 14 Aug 2024 19:27:06 -0400 Subject: [PATCH 0711/4482] fdtable: workaround posix->zephyr->posix dependency cycle Currently Zephyr depends on POSIX, which presents a dependency cycle. Newlib does not seem to like this dependency cycle so it requires that we re-declare off_t and ssize_t. We should really stop using off_t and ssize_t below the POSIX API line in Zephyr. Signed-off-by: Chris Friedt --- include/zephyr/posix/sys/select.h | 8 +++----- include/zephyr/sys/fdtable.h | 12 ++++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/include/zephyr/posix/sys/select.h b/include/zephyr/posix/sys/select.h index 78d900f5316b2..ef3e0f5674ed5 100644 --- a/include/zephyr/posix/sys/select.h +++ b/include/zephyr/posix/sys/select.h @@ -6,18 +6,16 @@ #ifndef ZEPHYR_INCLUDE_POSIX_SYS_SELECT_H_ #define ZEPHYR_INCLUDE_POSIX_SYS_SELECT_H_ -#include -#include +#include #ifdef __cplusplus extern "C" { #endif -#undef fd_set -#define fd_set zsock_fd_set - #define FD_SETSIZE ZVFS_FD_SETSIZE +typedef struct zvfs_fd_set fd_set; + struct timeval; int pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, diff --git a/include/zephyr/sys/fdtable.h b/include/zephyr/sys/fdtable.h index e9447ee618fc6..dbe134e70f6d3 100644 --- a/include/zephyr/sys/fdtable.h +++ b/include/zephyr/sys/fdtable.h @@ -39,6 +39,18 @@ extern "C" { #endif +/* FIXME: use k_off_t and k_ssize_t to avoid the POSIX->Zephyr->POSIX dependency cycle */ +#ifdef CONFIG_NEWLIB_LIBC +#ifndef _OFF_T_DECLARED +typedef __off_t off_t; +#define _OFF_T_DECLARED +#endif +#ifndef _SSIZE_T_DECLARED +typedef _ssize_t ssize_t; +#define _SSIZE_T_DECLARED +#endif +#endif + /** * File descriptor virtual method table. * Currently all operations beyond read/write/close go thru ioctl method. From c4803752a8670196665238a34ad692c79ecda1c6 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Wed, 3 Jul 2024 14:29:25 +0200 Subject: [PATCH 0712/4482] net: Deprecate CONFIG_NET_SOCKETS_POLL_MAX CONFIG_ZVFS_POLL_MAX is now used to control the maximum number of poll() entires. Thereby, CONFIG_NET_SOCKETS_POLL_MAX is redundant and shall be deprecated. Modify the defaults for NET_SOCKETS_POLL_MAX and ZVS_POLL_MAX so that the deprecation actually makes sense instead of symbol removal. In case the application still sets the old config, it will modify the ZVS_POLL_MAX default. Signed-off-by: Robert Lubos Signed-off-by: Chris Friedt --- doc/connectivity/networking/net_config_guide.rst | 2 +- doc/releases/migration-guide-4.0.rst | 3 +++ doc/services/portability/posix/kconfig/index.rst | 2 +- drivers/modem/modem_socket.c | 2 +- include/zephyr/net/dns_resolve.h | 6 +++--- lib/os/zvfs/Kconfig | 1 + samples/net/cloud/tagoio_http_post/prj.conf | 2 +- samples/net/dns_resolve/prj.conf | 2 +- samples/net/mdns_responder/prj.conf | 2 +- samples/net/sockets/coap_client/prj.conf | 2 +- samples/net/sockets/coap_server/prj.conf | 2 +- samples/net/sockets/echo_async/prj.conf | 2 +- samples/net/sockets/echo_async/src/socket_echo.c | 4 ++-- samples/net/sockets/echo_async_select/prj.conf | 2 +- .../echo_async_select/src/socket_echo_select.c | 4 ++-- samples/net/sockets/echo_client/prj.conf | 2 +- samples/net/sockets/echo_service/prj.conf | 2 +- samples/net/sockets/http_client/prj.conf | 2 +- samples/net/sockets/http_server/prj.conf | 2 +- samples/net/sockets/sntp_client/prj.conf | 2 +- samples/net/sockets/websocket_client/prj.conf | 2 +- samples/net/zperf/prj.conf | 2 +- subsys/net/lib/coap/coap_server.c | 6 +++--- subsys/net/lib/lwm2m/lwm2m_engine.c | 2 +- subsys/net/lib/shell/sockets.c | 2 +- subsys/net/lib/sockets/Kconfig | 12 +++++------- subsys/net/lib/sockets/sockets_service.c | 4 ++-- subsys/net/lib/sockets/sockets_tls.c | 2 +- subsys/net/lib/websocket/websocket.c | 2 +- tests/bsim/net/sockets/echo_test/prj.conf | 2 +- tests/net/all/prj.conf | 2 +- tests/net/lib/coap_client/CMakeLists.txt | 2 +- tests/net/lib/dns_addremove/prj.conf | 2 +- tests/net/lib/dns_resolve/prj.conf | 2 +- tests/net/lib/dns_sd/prj.conf | 2 +- tests/net/lib/http_server/core/prj.conf | 2 +- tests/net/lib/http_server/crime/prj.conf | 2 +- tests/net/lib/http_server/tls/prj.conf | 2 +- tests/net/lib/lwm2m/lwm2m_engine/CMakeLists.txt | 2 +- tests/net/lib/mdns_responder/prj.conf | 2 +- tests/net/socket/service/prj.conf | 2 +- 41 files changed, 54 insertions(+), 52 deletions(-) diff --git a/doc/connectivity/networking/net_config_guide.rst b/doc/connectivity/networking/net_config_guide.rst index 34c531ec2ad82..e2638eda4a039 100644 --- a/doc/connectivity/networking/net_config_guide.rst +++ b/doc/connectivity/networking/net_config_guide.rst @@ -83,7 +83,7 @@ Connection Options Socket Options ************** -:kconfig:option:`CONFIG_NET_SOCKETS_POLL_MAX` +:kconfig:option:`CONFIG_ZVFS_POLL_MAX` Maximum number of supported poll() entries. One needs to select proper value here depending on how many BSD sockets are polled in the system. diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index bdc3824bc2f99..1c00ac02f1188 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -474,6 +474,9 @@ Networking * The ``work_q`` parameter to ``NET_SOCKET_SERVICE_SYNC_DEFINE`` and ``NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC`` has been removed as it was always ignored. (:github:`79446`) +* Deprecated the :kconfig:option:`CONFIG_NET_SOCKETS_POLL_MAX` option in favour of + :kconfig:option:`CONFIG_ZVFS_POLL_MAX`. + Other Subsystems **************** diff --git a/doc/services/portability/posix/kconfig/index.rst b/doc/services/portability/posix/kconfig/index.rst index 7c7055326df2c..e414d508f19af 100644 --- a/doc/services/portability/posix/kconfig/index.rst +++ b/doc/services/portability/posix/kconfig/index.rst @@ -17,7 +17,7 @@ implementation of the POSIX API. * :kconfig:option:`CONFIG_MSG_SIZE_MAX` * :kconfig:option:`CONFIG_NET_SOCKETPAIR` * :kconfig:option:`CONFIG_NET_SOCKETS` -* :kconfig:option:`CONFIG_NET_SOCKETS_POLL_MAX` +* :kconfig:option:`CONFIG_ZVFS_POLL_MAX` * :kconfig:option:`CONFIG_ZVFS_OPEN_MAX` * :kconfig:option:`CONFIG_POSIX_API` * :kconfig:option:`CONFIG_POSIX_OPEN_MAX` diff --git a/drivers/modem/modem_socket.c b/drivers/modem/modem_socket.c index cc3d93c5c9b35..a30528ba899dd 100644 --- a/drivers/modem/modem_socket.c +++ b/drivers/modem/modem_socket.c @@ -269,7 +269,7 @@ int modem_socket_poll(struct modem_socket_config *cfg, struct zsock_pollfd *fds, int ret, i; uint8_t found_count = 0; - if (!cfg || nfds > CONFIG_NET_SOCKETS_POLL_MAX) { + if (!cfg || nfds > CONFIG_ZVFS_POLL_MAX) { return -EINVAL; } struct k_poll_event events[nfds]; diff --git a/include/zephyr/net/dns_resolve.h b/include/zephyr/net/dns_resolve.h index 283b2f90f8e95..fecb87664d716 100644 --- a/include/zephyr/net/dns_resolve.h +++ b/include/zephyr/net/dns_resolve.h @@ -141,9 +141,9 @@ enum dns_query_type { /** How many sockets the dispatcher is able to poll. */ #define DNS_DISPATCHER_MAX_POLL (DNS_RESOLVER_MAX_POLL + MDNS_MAX_POLL + LLMNR_MAX_POLL) -#if defined(CONFIG_NET_SOCKETS_POLL_MAX) -BUILD_ASSERT(CONFIG_NET_SOCKETS_POLL_MAX >= DNS_DISPATCHER_MAX_POLL, - "CONFIG_NET_SOCKETS_POLL_MAX must be larger than " STRINGIFY(DNS_DISPATCHER_MAX_POLL)); +#if defined(CONFIG_ZVFS_POLL_MAX) +BUILD_ASSERT(CONFIG_ZVFS_POLL_MAX >= DNS_DISPATCHER_MAX_POLL, + "CONFIG_ZVFS_POLL_MAX must be larger than " STRINGIFY(DNS_DISPATCHER_MAX_POLL)); #endif /** @brief What is the type of the socket given to DNS socket dispatcher, diff --git a/lib/os/zvfs/Kconfig b/lib/os/zvfs/Kconfig index df107c24c626d..101e2cce08640 100644 --- a/lib/os/zvfs/Kconfig +++ b/lib/os/zvfs/Kconfig @@ -43,6 +43,7 @@ if ZVFS_POLL config ZVFS_POLL_MAX int "Max number of supported zvfs_poll() entries" + default NET_SOCKETS_POLL_MAX if NET_SOCKETS_POLL_MAX > 0 default 6 if WIFI_NM_WPA_SUPPLICANT default 4 if SHELL_BACKEND_TELNET default 3 diff --git a/samples/net/cloud/tagoio_http_post/prj.conf b/samples/net/cloud/tagoio_http_post/prj.conf index 9746de5e077e3..9a4178d7f8a37 100644 --- a/samples/net/cloud/tagoio_http_post/prj.conf +++ b/samples/net/cloud/tagoio_http_post/prj.conf @@ -17,7 +17,7 @@ CONFIG_NET_SHELL=y # Sockets CONFIG_NET_SOCKETS=y -CONFIG_NET_SOCKETS_POLL_MAX=4 +CONFIG_ZVFS_POLL_MAX=4 # Network driver config CONFIG_TEST_RANDOM_GENERATOR=y diff --git a/samples/net/dns_resolve/prj.conf b/samples/net/dns_resolve/prj.conf index 399b1bce9f260..de837ae082889 100644 --- a/samples/net/dns_resolve/prj.conf +++ b/samples/net/dns_resolve/prj.conf @@ -14,7 +14,7 @@ CONFIG_NET_IPV6=y CONFIG_NET_IPV4=y CONFIG_NET_DHCPV4=n -CONFIG_NET_SOCKETS_POLL_MAX=5 +CONFIG_ZVFS_POLL_MAX=5 CONFIG_ZVFS_OPEN_MAX=5 # Enable the DNS resolver diff --git a/samples/net/mdns_responder/prj.conf b/samples/net/mdns_responder/prj.conf index c89c505c62a4e..4bc9b6b13d22c 100644 --- a/samples/net/mdns_responder/prj.conf +++ b/samples/net/mdns_responder/prj.conf @@ -8,7 +8,7 @@ CONFIG_NET_IPV4=y CONFIG_NET_IF_MAX_IPV6_COUNT=3 CONFIG_NET_IF_MAX_IPV4_COUNT=3 -CONFIG_NET_SOCKETS_POLL_MAX=7 +CONFIG_ZVFS_POLL_MAX=7 CONFIG_NET_HOSTNAME_ENABLE=y CONFIG_NET_HOSTNAME_UNIQUE=n diff --git a/samples/net/sockets/coap_client/prj.conf b/samples/net/sockets/coap_client/prj.conf index 1e9daa2e44c32..7748f1dbbfcb4 100644 --- a/samples/net/sockets/coap_client/prj.conf +++ b/samples/net/sockets/coap_client/prj.conf @@ -5,7 +5,7 @@ CONFIG_NET_IPV6=y CONFIG_NET_UDP=y CONFIG_NET_SOCKETS=y -CONFIG_NET_SOCKETS_POLL_MAX=4 +CONFIG_ZVFS_POLL_MAX=4 CONFIG_POSIX_API=y CONFIG_COAP=y diff --git a/samples/net/sockets/coap_server/prj.conf b/samples/net/sockets/coap_server/prj.conf index 94ac1abd5cf59..9fdbcb99c2035 100644 --- a/samples/net/sockets/coap_server/prj.conf +++ b/samples/net/sockets/coap_server/prj.conf @@ -6,7 +6,7 @@ CONFIG_NET_UDP=y # Socket CONFIG_NET_SOCKETS=y CONFIG_POSIX_API=y -CONFIG_NET_SOCKETS_POLL_MAX=4 +CONFIG_ZVFS_POLL_MAX=4 # CoAP CONFIG_COAP=y diff --git a/samples/net/sockets/echo_async/prj.conf b/samples/net/sockets/echo_async/prj.conf index 0de4196871001..77cc25261f865 100644 --- a/samples/net/sockets/echo_async/prj.conf +++ b/samples/net/sockets/echo_async/prj.conf @@ -8,7 +8,7 @@ CONFIG_NET_IPV4=y CONFIG_NET_IPV6=y CONFIG_NET_TCP=y CONFIG_NET_SOCKETS=y -CONFIG_NET_SOCKETS_POLL_MAX=5 +CONFIG_ZVFS_POLL_MAX=5 CONFIG_POSIX_API=y diff --git a/samples/net/sockets/echo_async/src/socket_echo.c b/samples/net/sockets/echo_async/src/socket_echo.c index b38eb62c00175..60067baf91cdf 100644 --- a/samples/net/sockets/echo_async/src/socket_echo.c +++ b/samples/net/sockets/echo_async/src/socket_echo.c @@ -35,8 +35,8 @@ #endif /* For Zephyr, keep max number of fd's in sync with max poll() capacity */ -#ifdef CONFIG_NET_SOCKETS_POLL_MAX -#define NUM_FDS CONFIG_NET_SOCKETS_POLL_MAX +#ifdef CONFIG_ZVFS_POLL_MAX +#define NUM_FDS CONFIG_ZVFS_POLL_MAX #else #define NUM_FDS 5 #endif diff --git a/samples/net/sockets/echo_async_select/prj.conf b/samples/net/sockets/echo_async_select/prj.conf index 278ef31e81842..85f4ba5a0b10f 100644 --- a/samples/net/sockets/echo_async_select/prj.conf +++ b/samples/net/sockets/echo_async_select/prj.conf @@ -9,7 +9,7 @@ CONFIG_NET_IPV4=y CONFIG_NET_IPV6=y CONFIG_NET_TCP=y CONFIG_NET_SOCKETS=y -CONFIG_NET_SOCKETS_POLL_MAX=5 +CONFIG_ZVFS_POLL_MAX=5 # Network driver config CONFIG_TEST_RANDOM_GENERATOR=y diff --git a/samples/net/sockets/echo_async_select/src/socket_echo_select.c b/samples/net/sockets/echo_async_select/src/socket_echo_select.c index 9ae3511579bd9..6ff8a6d52552b 100644 --- a/samples/net/sockets/echo_async_select/src/socket_echo_select.c +++ b/samples/net/sockets/echo_async_select/src/socket_echo_select.c @@ -36,8 +36,8 @@ #endif /* For Zephyr, keep max number of fd's in sync with max poll() capacity */ -#ifdef CONFIG_NET_SOCKETS_POLL_MAX -#define NUM_FDS CONFIG_NET_SOCKETS_POLL_MAX +#ifdef CONFIG_ZVFS_POLL_MAX +#define NUM_FDS CONFIG_ZVFS_POLL_MAX #else #define NUM_FDS 5 #endif diff --git a/samples/net/sockets/echo_client/prj.conf b/samples/net/sockets/echo_client/prj.conf index 4193099fc962a..434969a397d62 100644 --- a/samples/net/sockets/echo_client/prj.conf +++ b/samples/net/sockets/echo_client/prj.conf @@ -5,7 +5,7 @@ CONFIG_NET_TCP=y CONFIG_NET_IPV6=y CONFIG_NET_IPV4=y CONFIG_NET_SOCKETS=y -CONFIG_NET_SOCKETS_POLL_MAX=5 +CONFIG_ZVFS_POLL_MAX=5 CONFIG_NET_CONNECTION_MANAGER=y CONFIG_POSIX_API=y diff --git a/samples/net/sockets/echo_service/prj.conf b/samples/net/sockets/echo_service/prj.conf index 3b12a23837805..72cb9c21f05f1 100644 --- a/samples/net/sockets/echo_service/prj.conf +++ b/samples/net/sockets/echo_service/prj.conf @@ -13,8 +13,8 @@ CONFIG_NET_IPV4_MAPPING_TO_IPV6=y CONFIG_ZVFS_OPEN_MAX=10 CONFIG_NET_MAX_CONN=5 CONFIG_NET_SOCKETS_SERVICE=y -CONFIG_NET_SOCKETS_POLL_MAX=20 CONFIG_ZVFS_OPEN_MAX=20 +CONFIG_ZVFS_POLL_MAX=20 # Network driver config CONFIG_TEST_RANDOM_GENERATOR=y diff --git a/samples/net/sockets/http_client/prj.conf b/samples/net/sockets/http_client/prj.conf index 985406f5b5d97..6f0e8af7b6368 100644 --- a/samples/net/sockets/http_client/prj.conf +++ b/samples/net/sockets/http_client/prj.conf @@ -11,7 +11,7 @@ CONFIG_NET_SHELL=y # Sockets CONFIG_NET_SOCKETS=y -CONFIG_NET_SOCKETS_POLL_MAX=4 +CONFIG_ZVFS_POLL_MAX=4 CONFIG_POSIX_API=y # Network driver config diff --git a/samples/net/sockets/http_server/prj.conf b/samples/net/sockets/http_server/prj.conf index 67fd6a2468c8a..aa04b93f22376 100644 --- a/samples/net/sockets/http_server/prj.conf +++ b/samples/net/sockets/http_server/prj.conf @@ -9,7 +9,7 @@ CONFIG_INIT_STACKS=y CONFIG_ZVFS_OPEN_MAX=32 CONFIG_POSIX_API=y CONFIG_FDTABLE=y -CONFIG_NET_SOCKETS_POLL_MAX=32 +CONFIG_ZVFS_POLL_MAX=32 # Eventfd CONFIG_EVENTFD=y diff --git a/samples/net/sockets/sntp_client/prj.conf b/samples/net/sockets/sntp_client/prj.conf index 56c9982fc599e..12798c12cf33f 100644 --- a/samples/net/sockets/sntp_client/prj.conf +++ b/samples/net/sockets/sntp_client/prj.conf @@ -11,7 +11,7 @@ CONFIG_NET_SHELL=y # Sockets CONFIG_NET_SOCKETS=y -CONFIG_NET_SOCKETS_POLL_MAX=4 +CONFIG_ZVFS_POLL_MAX=4 # Network driver config CONFIG_TEST_RANDOM_GENERATOR=y diff --git a/samples/net/sockets/websocket_client/prj.conf b/samples/net/sockets/websocket_client/prj.conf index 7b8a237fb68e0..e6a9e794860f5 100644 --- a/samples/net/sockets/websocket_client/prj.conf +++ b/samples/net/sockets/websocket_client/prj.conf @@ -8,7 +8,7 @@ CONFIG_NET_STATISTICS=y # Sockets CONFIG_NET_SOCKETS=y -CONFIG_NET_SOCKETS_POLL_MAX=4 +CONFIG_ZVFS_POLL_MAX=4 # Network driver config CONFIG_TEST_RANDOM_GENERATOR=y diff --git a/samples/net/zperf/prj.conf b/samples/net/zperf/prj.conf index fe6499cec7f89..91d46d763f902 100644 --- a/samples/net/zperf/prj.conf +++ b/samples/net/zperf/prj.conf @@ -21,7 +21,7 @@ CONFIG_NET_MAX_CONTEXTS=5 CONFIG_NET_TC_TX_COUNT=1 CONFIG_NET_SOCKETS=y CONFIG_NET_SOCKETS_SERVICE_THREAD_PRIO=-1 -CONFIG_NET_SOCKETS_POLL_MAX=9 +CONFIG_ZVFS_POLL_MAX=9 CONFIG_ZVFS_OPEN_MAX=12 CONFIG_POSIX_API=y diff --git a/subsys/net/lib/coap/coap_server.c b/subsys/net/lib/coap/coap_server.c index b291ec8e861eb..8b7fc0168c3ad 100644 --- a/subsys/net/lib/coap/coap_server.c +++ b/subsys/net/lib/coap/coap_server.c @@ -33,9 +33,9 @@ LOG_MODULE_DECLARE(net_coap, CONFIG_COAP_LOG_LEVEL); #define MAX_OPTIONS CONFIG_COAP_SERVER_MESSAGE_OPTIONS #define MAX_PENDINGS CONFIG_COAP_SERVICE_PENDING_MESSAGES #define MAX_OBSERVERS CONFIG_COAP_SERVICE_OBSERVERS -#define MAX_POLL_FD CONFIG_NET_SOCKETS_POLL_MAX +#define MAX_POLL_FD CONFIG_ZVFS_POLL_MAX -BUILD_ASSERT(CONFIG_NET_SOCKETS_POLL_MAX > 0, "CONFIG_NET_SOCKETS_POLL_MAX can't be 0"); +BUILD_ASSERT(CONFIG_ZVFS_POLL_MAX > 0, "CONFIG_ZVFS_POLL_MAX can't be 0"); static K_MUTEX_DEFINE(lock); static int control_socks[2]; @@ -760,7 +760,7 @@ static void coap_server_thread(void *p1, void *p2, void *p3) } if (sock_nfds >= MAX_POLL_FD) { LOG_ERR("Maximum active CoAP services reached (%d), " - "increase CONFIG_NET_SOCKETS_POLL_MAX to support more.", + "increase CONFIG_ZVFS_POLL_MAX to support more.", MAX_POLL_FD); break; } diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index 833b72217f10c..be61fc46bdbd0 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -96,7 +96,7 @@ static sys_slist_t engine_service_list; static K_KERNEL_STACK_DEFINE(engine_thread_stack, CONFIG_LWM2M_ENGINE_STACK_SIZE); static struct k_thread engine_thread_data; -#define MAX_POLL_FD CONFIG_NET_SOCKETS_POLL_MAX +#define MAX_POLL_FD CONFIG_ZVFS_POLL_MAX /* Resources */ static struct zsock_pollfd sock_fds[MAX_POLL_FD]; diff --git a/subsys/net/lib/shell/sockets.c b/subsys/net/lib/shell/sockets.c index 063f4dd23b1b4..f41e17329e5e4 100644 --- a/subsys/net/lib/shell/sockets.c +++ b/subsys/net/lib/shell/sockets.c @@ -96,7 +96,7 @@ static void walk_socket_services(const struct net_socket_service_desc *svc, const struct shell *sh = data->sh; int *count = data->user_data; int len = 0; - static char pev_output[sizeof("xxx,") * CONFIG_NET_SOCKETS_POLL_MAX]; + static char pev_output[sizeof("xxx,") * CONFIG_ZVFS_POLL_MAX]; static char owner[MAX_OWNER_LEN + 1]; NET_ASSERT(svc->pev != NULL); diff --git a/subsys/net/lib/sockets/Kconfig b/subsys/net/lib/sockets/Kconfig index 47192211fb858..63b9549bf5104 100644 --- a/subsys/net/lib/sockets/Kconfig +++ b/subsys/net/lib/sockets/Kconfig @@ -48,13 +48,11 @@ config NET_SOCKETS_POSIX_NAMES with 3rd-party socket libraries. config NET_SOCKETS_POLL_MAX - int "Max number of supported poll() entries" - default 6 if WIFI_NM_WPA_SUPPLICANT - default 4 if SHELL_BACKEND_TELNET - default 3 - range 1 ZVFS_OPEN_MAX + int "Max number of supported poll() entries [DEPRECATED]" + default 0 help - Maximum number of entries supported for poll() call. + This option is deprecated. + Please use CONFIG_ZVFS_POLL_MAX instead. config NET_SOCKETS_CONNECT_TIMEOUT int "Timeout value in milliseconds to CONNECT" @@ -110,7 +108,7 @@ config NET_SOCKETS_SERVICE The socket service can monitor multiple sockets and save memory by only having one thread listening socket data. If data is received in the monitored socket, a user supplied work is called. - Note that you need to set CONFIG_NET_SOCKETS_POLL_MAX high enough + Note that you need to set CONFIG_ZVFS_POLL_MAX high enough so that enough sockets entries can be serviced. This depends on system needs as multiple services can be activated at the same time depending on network configuration. diff --git a/subsys/net/lib/sockets/sockets_service.c b/subsys/net/lib/sockets/sockets_service.c index ac367c3435839..81d6d2e331e11 100644 --- a/subsys/net/lib/sockets/sockets_service.c +++ b/subsys/net/lib/sockets/sockets_service.c @@ -29,7 +29,7 @@ STRUCT_SECTION_START_EXTERN(net_socket_service_desc); STRUCT_SECTION_END_EXTERN(net_socket_service_desc); static struct service { - struct zsock_pollfd events[CONFIG_NET_SOCKETS_POLL_MAX]; + struct zsock_pollfd events[CONFIG_ZVFS_POLL_MAX]; int count; } ctx; @@ -198,7 +198,7 @@ static void socket_service_thread(void) "%zd poll entries configured.", count + 1, ARRAY_SIZE(ctx.events)); NET_ERR("Please increase value of %s to at least %d", - "CONFIG_NET_SOCKETS_POLL_MAX", count + 1); + "CONFIG_ZVFS_POLL_MAX", count + 1); goto fail; } diff --git a/subsys/net/lib/sockets/sockets_tls.c b/subsys/net/lib/sockets/sockets_tls.c index 4d190891377f0..57120321b3a2b 100644 --- a/subsys/net/lib/sockets/sockets_tls.c +++ b/subsys/net/lib/sockets/sockets_tls.c @@ -3310,7 +3310,7 @@ static bool poll_offload_dtls_client_retry(struct tls_context *ctx, static int ztls_poll_offload(struct zsock_pollfd *fds, int nfds, int timeout) { - int fd_backup[CONFIG_NET_SOCKETS_POLL_MAX]; + int fd_backup[CONFIG_ZVFS_POLL_MAX]; const struct fd_op_vtable *vtable; void *ctx; int ret = 0; diff --git a/subsys/net/lib/websocket/websocket.c b/subsys/net/lib/websocket/websocket.c index c2dcba9eac3a0..3729cb3c9df07 100644 --- a/subsys/net/lib/websocket/websocket.c +++ b/subsys/net/lib/websocket/websocket.c @@ -458,7 +458,7 @@ static int websocket_close_vmeth(void *obj) static inline int websocket_poll_offload(struct zsock_pollfd *fds, int nfds, int timeout) { - int fd_backup[CONFIG_NET_SOCKETS_POLL_MAX]; + int fd_backup[CONFIG_ZVFS_POLL_MAX]; const struct fd_op_vtable *vtable; void *ctx; int ret = 0; diff --git a/tests/bsim/net/sockets/echo_test/prj.conf b/tests/bsim/net/sockets/echo_test/prj.conf index 259caa0deb52a..a1e13d1cf2286 100644 --- a/tests/bsim/net/sockets/echo_test/prj.conf +++ b/tests/bsim/net/sockets/echo_test/prj.conf @@ -7,7 +7,7 @@ CONFIG_NET_TCP=y CONFIG_NET_IPV6=y CONFIG_NET_IPV4=y CONFIG_NET_SOCKETS=y -CONFIG_NET_SOCKETS_POLL_MAX=4 +CONFIG_ZVFS_POLL_MAX=4 CONFIG_NET_CONNECTION_MANAGER=y CONFIG_POSIX_API=y diff --git a/tests/net/all/prj.conf b/tests/net/all/prj.conf index f4f42f781874e..fd5d1b78c648e 100644 --- a/tests/net/all/prj.conf +++ b/tests/net/all/prj.conf @@ -353,8 +353,8 @@ CONFIG_NET_SOCKETS_ENABLE_DTLS=y CONFIG_NET_SOCKETS_LOG_LEVEL_DBG=y CONFIG_NET_SOCKETS_OFFLOAD=y CONFIG_NET_SOCKETS_PACKET=y -CONFIG_NET_SOCKETS_POLL_MAX=50 CONFIG_ZVFS_OPEN_MAX=50 +CONFIG_ZVFS_POLL_MAX=50 CONFIG_NET_SOCKETS=y CONFIG_NET_SOCKETS_SOCKOPT_TLS=y CONFIG_NET_SOCKETS_TLS_MAX_CIPHERSUITES=10 diff --git a/tests/net/lib/coap_client/CMakeLists.txt b/tests/net/lib/coap_client/CMakeLists.txt index e12214fc6a902..0987064ef3b80 100644 --- a/tests/net/lib/coap_client/CMakeLists.txt +++ b/tests/net/lib/coap_client/CMakeLists.txt @@ -18,7 +18,7 @@ target_include_directories(app PRIVATE ${ZEPHYR_BASE}/include/) target_compile_definitions(app PRIVATE _POSIX_C_SOURCE=200809L) -add_compile_definitions(CONFIG_NET_SOCKETS_POLL_MAX=3) +add_compile_definitions(CONFIG_ZVFS_POLL_MAX=3) add_compile_definitions(CONFIG_COAP_CLIENT=y) add_compile_definitions(CONFIG_COAP_CLIENT_BLOCK_SIZE=256) add_compile_definitions(CONFIG_COAP_CLIENT_MESSAGE_SIZE=256) diff --git a/tests/net/lib/dns_addremove/prj.conf b/tests/net/lib/dns_addremove/prj.conf index 81c65b34f32f8..112794a03da38 100644 --- a/tests/net/lib/dns_addremove/prj.conf +++ b/tests/net/lib/dns_addremove/prj.conf @@ -17,5 +17,5 @@ CONFIG_NET_ARP=n CONFIG_PRINTK=y CONFIG_ZTEST=y CONFIG_MAIN_STACK_SIZE=2048 -CONFIG_NET_SOCKETS_POLL_MAX=5 CONFIG_ZVFS_OPEN_MAX=5 +CONFIG_ZVFS_POLL_MAX=5 diff --git a/tests/net/lib/dns_resolve/prj.conf b/tests/net/lib/dns_resolve/prj.conf index e90e185040aa7..21fafa85cdad8 100644 --- a/tests/net/lib/dns_resolve/prj.conf +++ b/tests/net/lib/dns_resolve/prj.conf @@ -29,5 +29,5 @@ CONFIG_PRINTK=y CONFIG_ZTEST=y CONFIG_MAIN_STACK_SIZE=1344 -CONFIG_NET_SOCKETS_POLL_MAX=9 CONFIG_ZVFS_OPEN_MAX=9 +CONFIG_ZVFS_POLL_MAX=9 diff --git a/tests/net/lib/dns_sd/prj.conf b/tests/net/lib/dns_sd/prj.conf index e9f24acf88a36..ab8deb9d58a0c 100644 --- a/tests/net/lib/dns_sd/prj.conf +++ b/tests/net/lib/dns_sd/prj.conf @@ -21,4 +21,4 @@ CONFIG_ZTEST_STACK_SIZE=2048 CONFIG_MAIN_STACK_SIZE=2048 CONFIG_NET_MAX_CONTEXTS=8 -CONFIG_NET_SOCKETS_POLL_MAX=4 +CONFIG_ZVFS_POLL_MAX=4 diff --git a/tests/net/lib/http_server/core/prj.conf b/tests/net/lib/http_server/core/prj.conf index c5f7b412ffa0a..dc035db727d74 100644 --- a/tests/net/lib/http_server/core/prj.conf +++ b/tests/net/lib/http_server/core/prj.conf @@ -22,7 +22,7 @@ CONFIG_NET_SOCKETS=y CONFIG_NET_LOOPBACK=y CONFIG_NET_LOOPBACK_MTU=1280 CONFIG_NET_DRIVERS=y -CONFIG_NET_SOCKETS_POLL_MAX=8 +CONFIG_ZVFS_POLL_MAX=8 CONFIG_NET_BUF_RX_COUNT=32 CONFIG_NET_BUF_TX_COUNT=32 CONFIG_NET_PKT_RX_COUNT=16 diff --git a/tests/net/lib/http_server/crime/prj.conf b/tests/net/lib/http_server/crime/prj.conf index 3ade5d7a2c71d..910b89a4c04e2 100644 --- a/tests/net/lib/http_server/crime/prj.conf +++ b/tests/net/lib/http_server/crime/prj.conf @@ -24,7 +24,7 @@ CONFIG_NET_SOCKETS=y CONFIG_NET_LOOPBACK=y CONFIG_NET_LOOPBACK_MTU=1280 CONFIG_NET_DRIVERS=y -CONFIG_NET_SOCKETS_POLL_MAX=8 +CONFIG_ZVFS_POLL_MAX=8 CONFIG_NET_BUF_RX_COUNT=32 CONFIG_NET_BUF_TX_COUNT=32 CONFIG_NET_PKT_RX_COUNT=16 diff --git a/tests/net/lib/http_server/tls/prj.conf b/tests/net/lib/http_server/tls/prj.conf index 39eb867daebec..ecc95780d1542 100644 --- a/tests/net/lib/http_server/tls/prj.conf +++ b/tests/net/lib/http_server/tls/prj.conf @@ -38,7 +38,7 @@ CONFIG_NET_BUF_RX_COUNT=32 CONFIG_NET_PKT_TX_COUNT=16 CONFIG_NET_PKT_RX_COUNT=16 CONFIG_ZVFS_OPEN_MAX=32 -CONFIG_NET_SOCKETS_POLL_MAX=32 +CONFIG_ZVFS_POLL_MAX=32 CONFIG_ZVFS_OPEN_MAX=32 CONFIG_REQUIRES_FULL_LIBC=y CONFIG_ZVFS_EVENTFD_MAX=10 diff --git a/tests/net/lib/lwm2m/lwm2m_engine/CMakeLists.txt b/tests/net/lib/lwm2m/lwm2m_engine/CMakeLists.txt index d4a60e2bb9c3b..2538d32a4cd5d 100644 --- a/tests/net/lib/lwm2m/lwm2m_engine/CMakeLists.txt +++ b/tests/net/lib/lwm2m/lwm2m_engine/CMakeLists.txt @@ -32,7 +32,7 @@ add_compile_definitions(CONFIG_LWM2M_SECURITY_INSTANCE_COUNT=1) add_compile_definitions(CONFIG_LWM2M_SECONDS_TO_UPDATE_EARLY=30) add_compile_definitions(CONFIG_LWM2M_QUEUE_MODE_UPTIME=30) add_compile_definitions(CONFIG_LWM2M_LOG_LEVEL=4) -add_compile_definitions(CONFIG_NET_SOCKETS_POLL_MAX=3) +add_compile_definitions(CONFIG_ZVFS_POLL_MAX=3) add_compile_definitions(CONFIG_LWM2M_DTLS_SUPPORT) add_compile_definitions(CONFIG_LWM2M_QUEUE_MODE_ENABLED) add_compile_definitions(CONFIG_TLS_CREDENTIALS) diff --git a/tests/net/lib/mdns_responder/prj.conf b/tests/net/lib/mdns_responder/prj.conf index 9ea509698981b..ecd170c5e510f 100644 --- a/tests/net/lib/mdns_responder/prj.conf +++ b/tests/net/lib/mdns_responder/prj.conf @@ -5,8 +5,8 @@ CONFIG_NET_DRIVERS=y CONFIG_NET_LOOPBACK=y CONFIG_NET_IPV4=y CONFIG_NET_IPV6=y -CONFIG_NET_SOCKETS_POLL_MAX=7 CONFIG_ZVFS_OPEN_MAX=7 +CONFIG_ZVFS_POLL_MAX=7 # Network driver config CONFIG_TEST_RANDOM_GENERATOR=y diff --git a/tests/net/socket/service/prj.conf b/tests/net/socket/service/prj.conf index d0664554f7fe8..151b79e85303b 100644 --- a/tests/net/socket/service/prj.conf +++ b/tests/net/socket/service/prj.conf @@ -10,7 +10,7 @@ CONFIG_NET_PKT_TX_COUNT=8 CONFIG_NET_PKT_RX_COUNT=8 CONFIG_NET_MAX_CONN=5 CONFIG_NET_SOCKETS_SERVICE=y -CONFIG_NET_SOCKETS_POLL_MAX=20 +CONFIG_ZVFS_POLL_MAX=20 # We need to set POSIX_API and use picolibc for eventfd to work CONFIG_POSIX_API=y From 4919bd421e8ff91cf78910a8b6997f06e9bb0eee Mon Sep 17 00:00:00 2001 From: Jonas Remmert Date: Tue, 8 Oct 2024 18:57:35 +0200 Subject: [PATCH 0713/4482] boards: phytec: add support for phyBOARD-Nash (imx93) Add basic support for the phyBOARD-Nash, a SBC based on the phyCORE-i.MX93. Both CPU types (Cortex-A55, Cortex-M33) are supported. Signed-off-by: Jonas Remmert --- .../phyboard_nash/Kconfig.phyboard_nash | 7 + boards/phytec/phyboard_nash/board.cmake | 8 + boards/phytec/phyboard_nash/board.yml | 6 + .../phyboard_nash/doc/img/phyboard_nash.webp | Bin 0 -> 64380 bytes boards/phytec/phyboard_nash/doc/index.rst | 178 ++++++++++++++++++ .../phyboard_nash/phyboard_nash-pinctrl.dtsi | 19 ++ .../phyboard_nash/phyboard_nash_a55.dts | 40 ++++ .../phyboard_nash/phyboard_nash_a55.yaml | 18 ++ .../phyboard_nash/phyboard_nash_a55_defconfig | 24 +++ .../phyboard_nash/phyboard_nash_m33.dts | 31 +++ .../phyboard_nash/phyboard_nash_m33.yaml | 15 ++ .../phyboard_nash/phyboard_nash_m33_defconfig | 9 + 12 files changed, 355 insertions(+) create mode 100644 boards/phytec/phyboard_nash/Kconfig.phyboard_nash create mode 100644 boards/phytec/phyboard_nash/board.cmake create mode 100644 boards/phytec/phyboard_nash/board.yml create mode 100644 boards/phytec/phyboard_nash/doc/img/phyboard_nash.webp create mode 100644 boards/phytec/phyboard_nash/doc/index.rst create mode 100644 boards/phytec/phyboard_nash/phyboard_nash-pinctrl.dtsi create mode 100644 boards/phytec/phyboard_nash/phyboard_nash_a55.dts create mode 100644 boards/phytec/phyboard_nash/phyboard_nash_a55.yaml create mode 100644 boards/phytec/phyboard_nash/phyboard_nash_a55_defconfig create mode 100644 boards/phytec/phyboard_nash/phyboard_nash_m33.dts create mode 100644 boards/phytec/phyboard_nash/phyboard_nash_m33.yaml create mode 100644 boards/phytec/phyboard_nash/phyboard_nash_m33_defconfig diff --git a/boards/phytec/phyboard_nash/Kconfig.phyboard_nash b/boards/phytec/phyboard_nash/Kconfig.phyboard_nash new file mode 100644 index 0000000000000..4640f4aaee03e --- /dev/null +++ b/boards/phytec/phyboard_nash/Kconfig.phyboard_nash @@ -0,0 +1,7 @@ +# Copyright 2024 PHYTEC Messtechnik GmbH +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_PHYBOARD_NASH + select SOC_MIMX9352_A55 if BOARD_PHYBOARD_NASH_MIMX9352_A55 + select SOC_MIMX9352_M33 if BOARD_PHYBOARD_NASH_MIMX9352_M33 + select SOC_PART_NUMBER_MIMX9352CVVXM diff --git a/boards/phytec/phyboard_nash/board.cmake b/boards/phytec/phyboard_nash/board.cmake new file mode 100644 index 0000000000000..37a788d10d847 --- /dev/null +++ b/boards/phytec/phyboard_nash/board.cmake @@ -0,0 +1,8 @@ +# Copyright (c) 2024, PHYTEC Messtechnik GmbH +# SPDX-License-Identifier: Apache-2.0 + +board_set_debugger_ifnset(jlink) +board_set_flasher_ifnset(jlink) + +board_runner_args(jlink "--device=MIMX9352_M33") +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/phytec/phyboard_nash/board.yml b/boards/phytec/phyboard_nash/board.yml new file mode 100644 index 0000000000000..3e4c15bc14d68 --- /dev/null +++ b/boards/phytec/phyboard_nash/board.yml @@ -0,0 +1,6 @@ +board: + name: phyboard_nash + full_name: phyBOARD-Nash i.MX93 + vendor: phytec + socs: + - name: mimx9352 diff --git a/boards/phytec/phyboard_nash/doc/img/phyboard_nash.webp b/boards/phytec/phyboard_nash/doc/img/phyboard_nash.webp new file mode 100644 index 0000000000000000000000000000000000000000..05d4e30c56a8f86cb4298dedcf67d49efac8b369 GIT binary patch literal 64380 zcmZU)W3VnvtS-20+qSirZQIz(+RL_W+qP}nwrv~l{mwm8^JAtuU8zc?tDa8sBk4|* zrNqUZzkq-=#Do>q6*)CwfPjFI{@Y5RK>5HxLb8gI=deIPzyL}z$$Nmim1yxTsr8n) z<8#xy^|Ig4nGena0NNfqyAtI@2xKeOdTPU>8e1}W#G9o0Pa9@~_|XxvjVS&?S&`r6 zFq_{{wU;4s!}z_ML4qsl6LMoZG)j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qaM}33-+)dYwxp;wakTm<8wRJ(uY&3~O zYSfBbhlkiCynBkr@Wi+EGUyNiG?tMGwy!B0(3vo_M;cli5E~T^0Ts&_%2-GusW1kd z{fUkq?JtkA8lJ-%fn)N4NL9Z<$sui=O_SE`#dIMC1R(L|*DvD4j}IR;Q4YTpB=hk( z3!CpbIlP(~BKM8D7A%5jm^SdWqgPJ6`IC4Y3>J{2w>Dmw86cYy&pe+T9p{;c6^`VZ zJr7v3UoUq-_|jl}ln8RDxAa1RX<*rm$e0`ceD(6oxsS#TcYLFOw?ZRw>Ml*@dZMYf zfNdJx$w*N{i@FNYBQ5g!KNlci5C#>nK4hkJsb;ux?e=?n?w6HKxx6S9K+cv@LNUINe^E5r7vpXL%lfq&I5{ zz){~P@?Q1<=wBfvECku6GPrWAliqNl@1!0}4RYSJHMz2a>iBM1mOCD6Od?7nxH^ha zk)1Hw6<`2?;bkQO8*W3A@=l2S??64lj~ACznfjNbxr-$oqKLI3P#36fOTj`{$O6)D zJ0SvmjG8Op9rJH^=30*jD?jm<%7Cf^Ss??t0`e6{`zk9mfO;zXz@BSJ6-ljB^IJPW z!s1N|{wVW79*Lb_>e|7Y?{pRw+(s%@|K}`@T3I*)_Z&xXdQkhIPs{4g!IlB5U0~9U zLH~-klGSa@f!tDaf~pd8pr#tPM&~TLs9eLgNRUYd3C^gCp)q^}&`ocfNmWZs&;b$| a1Z@K1Uk}1m8^;vcGc4Me&}kd;pa1~>VYGYz literal 0 HcmV?d00001 diff --git a/boards/phytec/phyboard_nash/doc/index.rst b/boards/phytec/phyboard_nash/doc/index.rst new file mode 100644 index 0000000000000..16c281e996297 --- /dev/null +++ b/boards/phytec/phyboard_nash/doc/index.rst @@ -0,0 +1,178 @@ +.. _phyboard_nash: + +phyBOARD-Nash i.MX93 +#################### + +Overview +******** + +The phyBOARD-Nash is based on the phyCORE-i.MX93 SoM is based on the NXP i.MX93 +SoC. It features common industrial interfaces and can be used as a reference for +development or in the final product. It is an entry-level development board, +which helps developers to get familiar with the module before investing a large +amount of resources in more specific designs. + +i.MX93 MPU is composed of one cluster of 2x Cortex-A55 cores and a single +Cortex-M33 core. Zephyr OS is ported to run on one of the Cortex-A55 core as +well as the Cortex-M33 core. + +- Memory: + + - RAM: 512 MB - 2GB LPDDR4 + - EEPROM: 4 kB - 32 kB + - eMMC: 8 GB - 256 GB + +- Interfaces: + + - Ethernet: 2x 10/100BASE-T (1x TSN Support) + - USB: 2x 2.0 Host / OTG + - Serial: 1x RS232 / RS485 Full Duplex / Half Duplex + - CAN: 1x CAN FD + - Digital I/O: via Expansion Connector + - MMX/SD/SDIO: microSD slot + - Display: LVDS(1x4 or 1x8), MIPI DSI(1x4), HDMI + - Audio: SAI + - Camera: 1x MIPI CSI-2 (phyCAM-M), 1x Parallel + - Expansion Bus: I2C, SPI, SDIO, UART, USB + +- Debug: + + - JTAG 10-pin connector + - USB-C for UART debug, 2x serial ports for A55 and M33 + + +.. image:: img/phyboard_nash.webp + :width: 720px + :align: center + :height: 405px + :alt: phyBOARD-Nash + +More information about the board can be found at the `PHYTEC website`_. + +Supported Features +================== + +The ``phyboard_nash/mimx9352/a55`` board target supports the following hardware +features: + ++-----------+------------+-------------------------------------+ +| Interface | Controller | Driver/Component | ++===========+============+=====================================+ +| GIC-v4 | on-chip | interrupt controller | ++-----------+------------+-------------------------------------+ +| ARM TIMER | on-chip | system clock | ++-----------+------------+-------------------------------------+ +| CLOCK | on-chip | clock_control | ++-----------+------------+-------------------------------------+ +| PINMUX | on-chip | pinmux | ++-----------+------------+-------------------------------------+ +| UART | on-chip | serial port | ++-----------+------------+-------------------------------------+ +| TPM | on-chip | TPM Counter | ++-----------+------------+-------------------------------------+ + +The ``phyboard_nash/mimx9352/m33`` board target supports the following hardware +features: + ++-----------+------------+-------------------------------------+ +| Interface | Controller | Driver/Component | ++===========+============+=====================================+ +| NVIC | on-chip | interrupt controller | ++-----------+------------+-------------------------------------+ +| SYSTICK | on-chip | systick | ++-----------+------------+-------------------------------------+ +| CLOCK | on-chip | clock_control | ++-----------+------------+-------------------------------------+ +| PINMUX | on-chip | pinmux | ++-----------+------------+-------------------------------------+ +| UART | on-chip | serial port | ++-----------+------------+-------------------------------------+ + +Devices +======== +System Clock +------------ + +This board configuration uses a system clock frequency of 24 MHz. Cortex-A55 +Core runs up to 1.7 GHz. Cortex-M33 Core runs up to 200MHz in which SYSTICK runs +on same frequency. + +Serial Port +----------- + +This board configuration uses a single serial communication channel with the +CPU's UART2 for A55 core and M33 core. The u-boot bootloader or Linux use the +second serial port for debug output. + +Programming and Debugging (A55) +******************************* + +Copy the compiled ``zephyr.bin`` to the ``BOOT`` partition of the SD card and +plug the SD card into the board. Power it up and stop the u-boot execution at +prompt. + +Use U-Boot to load and execute zephyr.bin on Cortex-A55 Core0: + +.. code-block:: console + + fatload mmc 1:1 0xd0000000 zephyr.bin; dcache flush; icache flush; dcache off; icache off; go 0xd0000000 + + +Use this configuration to run basic Zephyr applications and kernel tests, +for example: + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: phyboard_nash/mimx9352/a55 + :goals: build + +Use this configuration to run basic Zephyr applications, for example: + +.. code-block:: console + + *** Booting Zephyr OS build v3.7.0-848-gb4d99b124c6d *** + Hello World! phyboard_nash/mimx9352/a55 + +Programming and Debugging (M33) +******************************* + +Copy the compiled ``zephyr.bin`` to the ``BOOT`` partition of the SD card and +plug the SD card into the board. Power it up and stop the u-boot execution at +prompt. + +Use U-Boot to load and kick zephyr.bin to Cortex-M33 Core: + +.. code-block:: console + + load mmc 1:1 0x80000000 zephyr.bin;cp.b 0x80000000 0x201e0000 0x30000;bootaux 0x1ffe0000 0 + +Use this configuration to run basic Zephyr applications, for example: + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: phyboard_nash/mimx9352/m33 + :goals: build + +This will build an image with the synchronization sample app, boot it and +display the following console output: + +.. code-block:: console + + *** Booting Zephyr OS build v3.7.0-848-gb4d99b124c6d *** + Hello World! phyboard_nash/mimx9352/m33 + +Starting the M7-Core from U-Boot and Linux +========================================== + +Loading binaries and starting the M33-Core is supported from Linux via +remoteproc. Please check the `phyCORE-i.MX93 BSP Manual`_ for more information. + +References +========== + +For more information refer to the `PHYTEC website`_. + +.. _PHYTEC website: + https://www.phytec.eu/en/produkte/development-kits/phyboard-nash/ +.. _phyCORE-i.MX93 BSP Manual: + https://phytec.github.io/doc-bsp-yocto/bsp/imx9/imx93/imx93.html diff --git a/boards/phytec/phyboard_nash/phyboard_nash-pinctrl.dtsi b/boards/phytec/phyboard_nash/phyboard_nash-pinctrl.dtsi new file mode 100644 index 0000000000000..b9bfda29c04e3 --- /dev/null +++ b/boards/phytec/phyboard_nash/phyboard_nash-pinctrl.dtsi @@ -0,0 +1,19 @@ +/* + * Copyright 2024 PHYTEC Messtechnik GmbH + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&pinctrl { + uart2_default: uart2_default { + group0 { + pinmux = <&iomuxc1_uart2_rxd_lpuart_rx_lpuart2_rx>, + <&iomuxc1_uart2_txd_lpuart_tx_lpuart2_tx>; + bias-pull-up; + slew-rate = "slightly_fast"; + drive-strength = "x5"; + }; + }; +}; diff --git a/boards/phytec/phyboard_nash/phyboard_nash_a55.dts b/boards/phytec/phyboard_nash/phyboard_nash_a55.dts new file mode 100644 index 0000000000000..0c6c67ad7ac78 --- /dev/null +++ b/boards/phytec/phyboard_nash/phyboard_nash_a55.dts @@ -0,0 +1,40 @@ +/* + * Copyright 2022,2024 NXP + * Copyright 2024 PHYTEC Messtechnik GmbH + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "phyboard_nash-pinctrl.dtsi" + +/ { + model = "PHYTEC phyBOARD-Nash i.MX93"; + compatible = "phytec,phyboard_nash"; + + chosen { + zephyr,console = &lpuart2; + zephyr,shell-uart = &lpuart2; + zephyr,sram = &sram0; + }; + + cpus { + cpu@0 { + status = "disabled"; + }; + }; + + sram0: memory@d0000000 { + reg = <0xd0000000 DT_SIZE_M(1)>; + }; +}; + +&lpuart2 { + status = "okay"; + current-speed = <115200>; + /* clocks = <&ccm IMX_CCM_UART4_CLK 0x6c 24>; */ + pinctrl-0 = <&uart2_default>; + pinctrl-names = "default"; +}; diff --git a/boards/phytec/phyboard_nash/phyboard_nash_a55.yaml b/boards/phytec/phyboard_nash/phyboard_nash_a55.yaml new file mode 100644 index 0000000000000..b48692ee9e710 --- /dev/null +++ b/boards/phytec/phyboard_nash/phyboard_nash_a55.yaml @@ -0,0 +1,18 @@ +# Copyright 2024 PHYTEC Messtechnik GmbH +# SPDX-License-Identifier: Apache-2.0 + +identifier: phyboard_nash/mimx9352/a55 +name: PHYTEC phyBOARD-Nash i.MX93 A55 +type: mcu +arch: arm64 +toolchain: + - zephyr + - cross-compile +ram: 1024 +supported: + - uart +testing: + ignore_tags: + - net + - bluetooth +vendor: phytec diff --git a/boards/phytec/phyboard_nash/phyboard_nash_a55_defconfig b/boards/phytec/phyboard_nash/phyboard_nash_a55_defconfig new file mode 100644 index 0000000000000..c714bcaac772b --- /dev/null +++ b/boards/phytec/phyboard_nash/phyboard_nash_a55_defconfig @@ -0,0 +1,24 @@ +# Copyright 2024 PHYTEC Messtechnik GmbH +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_CLOCK_CONTROL=y +CONFIG_SERIAL=y +CONFIG_UART_CONSOLE=y +CONFIG_UART_INTERRUPT_DRIVEN=y +CONFIG_CONSOLE=y + +# ARM Options +CONFIG_AARCH64_IMAGE_HEADER=y +CONFIG_ARMV8_A_NS=y + +# MMU Options +CONFIG_MAX_XLAT_TABLES=64 + +# Cache Options +CONFIG_CACHE_MANAGEMENT=y +CONFIG_DCACHE_LINE_SIZE_DETECT=y +CONFIG_ICACHE_LINE_SIZE_DETECT=y + +# Zephyr Kernel Configuration +CONFIG_XIP=n +CONFIG_KERNEL_DIRECT_MAP=y diff --git a/boards/phytec/phyboard_nash/phyboard_nash_m33.dts b/boards/phytec/phyboard_nash/phyboard_nash_m33.dts new file mode 100644 index 0000000000000..e1fcbe244b014 --- /dev/null +++ b/boards/phytec/phyboard_nash/phyboard_nash_m33.dts @@ -0,0 +1,31 @@ +/* + * Copyright 2024 PHYTEC Messtechnik GmbH + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "phyboard_nash-pinctrl.dtsi" + +/ { + model = "PHYTEC phyBOARD-Nash i.MX93"; + compatible = "phytec,phyboard_nash"; + + chosen { + /* TCM */ + zephyr,flash = &itcm; + zephyr,sram = &dtcm; + + zephyr,console = &lpuart2; + zephyr,shell-uart = &lpuart2; + }; +}; + +&lpuart2 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart2_default>; + pinctrl-names = "default"; +}; diff --git a/boards/phytec/phyboard_nash/phyboard_nash_m33.yaml b/boards/phytec/phyboard_nash/phyboard_nash_m33.yaml new file mode 100644 index 0000000000000..3927ba8d1dbcb --- /dev/null +++ b/boards/phytec/phyboard_nash/phyboard_nash_m33.yaml @@ -0,0 +1,15 @@ +# Copyright 2024 PHYTEC Messtechnik GmbH +# SPDX-License-Identifier: Apache-2.0 + +identifier: phyboard_nash/mimx9352/m33 +name: PHYTEC phyBOARD Nash (i.MX93) M33 +type: mcu +arch: arm +toolchain: + - zephyr + - cross-compile +ram: 128 +flash: 128 +supported: + - uart +vendor: phytec diff --git a/boards/phytec/phyboard_nash/phyboard_nash_m33_defconfig b/boards/phytec/phyboard_nash/phyboard_nash_m33_defconfig new file mode 100644 index 0000000000000..5538854b5995a --- /dev/null +++ b/boards/phytec/phyboard_nash/phyboard_nash_m33_defconfig @@ -0,0 +1,9 @@ +# Copyright 2024 PHYTEC Messtechnik GmbH +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_CLOCK_CONTROL=y +CONFIG_SERIAL=y +CONFIG_UART_CONSOLE=y +CONFIG_UART_INTERRUPT_DRIVEN=y +CONFIG_CONSOLE=y +CONFIG_XIP=y From 8595a0cf79a0262568ee0dabda6d5c2afc20fb49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Tue, 20 Aug 2024 17:11:32 +0200 Subject: [PATCH 0714/4482] doc: requirements: Update to Sphinx RTD Theme 3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update to latest Sphinx RTD Theme version. Main benefit will be to be able to leverage Sphinx 8.0 since previous version of the theme was depending on 'sphinx < 8.0'. Signed-off-by: Benjamin Cabé --- doc/_extensions/zephyr/gh_utils.py | 2 +- doc/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/_extensions/zephyr/gh_utils.py b/doc/_extensions/zephyr/gh_utils.py index f2795e8849667..d367100812e0d 100644 --- a/doc/_extensions/zephyr/gh_utils.py +++ b/doc/_extensions/zephyr/gh_utils.py @@ -112,7 +112,7 @@ def gh_link_get_url(app: Sphinx, pagename: str, mode: str = "blob") -> Optional[ mode, app.config.gh_link_version, page_prefix, - app.env.doc2path(pagename, False), + str(app.env.doc2path(pagename, False)), ] ) diff --git a/doc/requirements.txt b/doc/requirements.txt index b979eeedf8a45..cb202de2f50a4 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,7 +1,7 @@ # DOC: used to generate docs sphinx -sphinx_rtd_theme~=2.0 +sphinx_rtd_theme~=3.0 sphinx-tabs sphinxcontrib-svg2pdfconverter pygments>=2.9 From 0ef69c881513a5058a1ed19bcb938dbcf0e2a7e4 Mon Sep 17 00:00:00 2001 From: Josuah Demangeon Date: Mon, 16 Sep 2024 17:27:36 +0200 Subject: [PATCH 0715/4482] drivers: video: fix a typo in get_ctrl API function type The "struct video_driver_api" struct field "get_ctrl" had the wrong type although this did not have any practical effect as "video_api_set_ctrl_t" and "video_api_get_ctrl_t" have the same signature. Signed-off-by: Josuah Demangeon --- include/zephyr/drivers/video.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/drivers/video.h b/include/zephyr/drivers/video.h index 7b083029e3734..fa571815ba99b 100644 --- a/include/zephyr/drivers/video.h +++ b/include/zephyr/drivers/video.h @@ -335,7 +335,7 @@ __subsystem struct video_driver_api { video_api_dequeue_t dequeue; video_api_flush_t flush; video_api_set_ctrl_t set_ctrl; - video_api_set_ctrl_t get_ctrl; + video_api_get_ctrl_t get_ctrl; video_api_set_signal_t set_signal; video_api_set_frmival_t set_frmival; video_api_get_frmival_t get_frmival; From e8bb2d64720469838d68c04fdf44d47ecfed2476 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Mon, 16 Sep 2024 11:15:35 -0500 Subject: [PATCH 0716/4482] boards: rd_rw612_bga: Remove LED node There is no LED on this board. Signed-off-by: Declan Snyder --- boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi | 9 --------- 1 file changed, 9 deletions(-) diff --git a/boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi b/boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi index 8ec27da032fc1..f33f112c50329 100644 --- a/boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi +++ b/boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi @@ -14,7 +14,6 @@ aliases { usart-0 = &flexcomm3; - led0 = &green_led; sw0 = &sw_4; i2c-0 = &flexcomm2; watchdog0 = &wwdt; @@ -32,14 +31,6 @@ zephyr,shell-uart = &flexcomm3; }; - leds { - compatible = "gpio-leds"; - green_led: led_1 { - gpios = <&hsgpio1 20 0>; - label = "User LED_GREEN"; - }; - }; - gpio_keys { compatible = "gpio-keys"; sw_4: sw_4 { From 6fa74eea365729621683e3a771b5d81718b29eb9 Mon Sep 17 00:00:00 2001 From: Christoph Seitz Date: Sat, 21 Sep 2024 21:14:20 +0200 Subject: [PATCH 0717/4482] net: ethernet: Add 2.5GBase-T and 5GBase-T phy speeds The possible link speeds of ethernet phys are extended by the 2.5G and 5G constants. Signed-off-by: Christoph Seitz --- include/zephyr/net/phy.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/zephyr/net/phy.h b/include/zephyr/net/phy.h index 1fd3193ba7f9a..0cffda13b0d44 100644 --- a/include/zephyr/net/phy.h +++ b/include/zephyr/net/phy.h @@ -42,6 +42,10 @@ enum phy_link_speed { LINK_HALF_1000BASE_T = BIT(4), /** 1000Base-T Full-Duplex */ LINK_FULL_1000BASE_T = BIT(5), + /** 2.5GBase-T Full-Duplex */ + LINK_FULL_2500BASE_T = BIT(6), + /** 5GBase-T Full-Duplex */ + LINK_FULL_5000BASE_T = BIT(7), }; /** @@ -51,7 +55,7 @@ enum phy_link_speed { * * @return True if link is full duplex, false if not. */ -#define PHY_LINK_IS_FULL_DUPLEX(x) (x & (BIT(1) | BIT(3) | BIT(5))) +#define PHY_LINK_IS_FULL_DUPLEX(x) (x & (BIT(1) | BIT(3) | BIT(5) | BIT(6) | BIT(7))) /** * @brief Check if phy link speed is 1 Gbit/sec. From 2dca6d64c7290a1122f86ed8b4328465455d0ac9 Mon Sep 17 00:00:00 2001 From: Christoph Seitz Date: Sat, 21 Sep 2024 21:17:44 +0200 Subject: [PATCH 0718/4482] net: shell: Add missing hw_cap strings. Two ethernet capabilities were missing. Added them to allow the 2.5G and 5G strings to appended. Signed-off-by: Christoph Seitz --- subsys/net/lib/shell/iface.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subsys/net/lib/shell/iface.c b/subsys/net/lib/shell/iface.c index 926da64c3bd25..6563d0134d1bd 100644 --- a/subsys/net/lib/shell/iface.c +++ b/subsys/net/lib/shell/iface.c @@ -56,6 +56,8 @@ static struct ethernet_capabilities eth_hw_caps[] = { EC(ETHERNET_HW_FILTERING, "MAC address filtering"), EC(ETHERNET_DSA_SLAVE_PORT, "DSA slave port"), EC(ETHERNET_DSA_MASTER_PORT, "DSA master port"), + EC(ETHERNET_TXTIME, "TXTIME supported"), + EC(ETHERNET_TXINJECTION_MODE, "TX-Injection supported"), }; static void print_supported_ethernet_capabilities( From 74ca0a499a32dfcb35a81e3331d74abd1d3b7a8c Mon Sep 17 00:00:00 2001 From: Christoph Seitz Date: Sat, 21 Sep 2024 21:19:09 +0200 Subject: [PATCH 0719/4482] net: ethernet: Add 2.5G and 5G hardware capabilities. Add the 2.5G and 5G link speeds as possible capabilities to ethernet drivers. Signed-off-by: Christoph Seitz --- include/zephyr/net/ethernet.h | 6 ++++++ subsys/net/lib/shell/iface.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/include/zephyr/net/ethernet.h b/include/zephyr/net/ethernet.h index 2ae5f53610266..c870525c2e9f8 100644 --- a/include/zephyr/net/ethernet.h +++ b/include/zephyr/net/ethernet.h @@ -204,6 +204,12 @@ enum ethernet_hw_caps { /** TX-Injection supported */ ETHERNET_TXINJECTION_MODE = BIT(20), + + /** 2.5 Gbits link supported */ + ETHERNET_LINK_2500BASE_T = BIT(21), + + /** 5 Gbits link supported */ + ETHERNET_LINK_5000BASE_T = BIT(22), }; /** @cond INTERNAL_HIDDEN */ diff --git a/subsys/net/lib/shell/iface.c b/subsys/net/lib/shell/iface.c index 6563d0134d1bd..7f6519d525ed7 100644 --- a/subsys/net/lib/shell/iface.c +++ b/subsys/net/lib/shell/iface.c @@ -58,6 +58,8 @@ static struct ethernet_capabilities eth_hw_caps[] = { EC(ETHERNET_DSA_MASTER_PORT, "DSA master port"), EC(ETHERNET_TXTIME, "TXTIME supported"), EC(ETHERNET_TXINJECTION_MODE, "TX-Injection supported"), + EC(ETHERNET_LINK_2500BASE_T, "2.5 Gbits"), + EC(ETHERNET_LINK_5000BASE_T, "5 Gbits"), }; static void print_supported_ethernet_capabilities( From ca829e1b776f7b70a293ebe19cf30ce41f9be719 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Fri, 20 Sep 2024 09:21:38 -0500 Subject: [PATCH 0720/4482] include: spi: Clarify data frame units and meaning Make clear in the include/ header that data frame size is the same thing as word size for the context of this API. Also, add some comments to the spi_context to make it easier for driver writers to understand how to use the functions, by noting the meaning of the dfs and len parameters to the update functions. Otherwise it takes some time to understand what they mean. Signed-off-by: Declan Snyder --- drivers/spi/spi_context.h | 8 ++++++++ include/zephyr/drivers/spi.h | 10 +++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi_context.h b/drivers/spi/spi_context.h index 1aed41173eecc..a5110f52de8c6 100644 --- a/drivers/spi/spi_context.h +++ b/drivers/spi/spi_context.h @@ -321,6 +321,10 @@ void spi_context_buffers_setup(struct spi_context *ctx, (void *)ctx->rx_buf, ctx->rx_len); } +/* + * Note: dfs is the number of bytes needed to store a data frame, + * while len is the number of data frames sent. + */ static ALWAYS_INLINE void spi_context_update_tx(struct spi_context *ctx, uint8_t dfs, uint32_t len) { @@ -361,6 +365,10 @@ bool spi_context_tx_buf_on(struct spi_context *ctx) return !!(ctx->tx_buf && ctx->tx_len); } +/* + * Note: dfs is the number of bytes needed to store a data frame, + * while len is the number of data frames received. + */ static ALWAYS_INLINE void spi_context_update_rx(struct spi_context *ctx, uint8_t dfs, uint32_t len) { diff --git a/include/zephyr/drivers/spi.h b/include/zephyr/drivers/spi.h index d344a73c562e4..3368a5312a45f 100644 --- a/include/zephyr/drivers/spi.h +++ b/include/zephyr/drivers/spi.h @@ -100,10 +100,10 @@ extern "C" { #define SPI_WORD_SIZE_SHIFT (5U) #define SPI_WORD_SIZE_MASK (0x3FU << SPI_WORD_SIZE_SHIFT) /** @endcond */ -/** Get SPI word size. */ +/** Get SPI word size (data frame size) in bits. */ #define SPI_WORD_SIZE_GET(_operation_) \ (((_operation_) & SPI_WORD_SIZE_MASK) >> SPI_WORD_SIZE_SHIFT) -/** Set SPI word size. */ +/** Set SPI word size (data frame size) in bits. */ #define SPI_WORD_SET(_word_size_) \ ((_word_size_) << SPI_WORD_SIZE_SHIFT) /** @} */ @@ -309,7 +309,7 @@ struct spi_config { * - 0: Master or slave. * - 1..3: Polarity, phase and loop mode. * - 4: LSB or MSB first. - * - 5..10: Size of a data frame in bits. + * - 5..10: Size of a data frame (word) in bits. * - 11: Full/half duplex. * - 12: Hold on the CS line if possible. * - 13: Keep resource locked for the caller. @@ -458,7 +458,7 @@ struct spi_dt_spec { struct spi_buf { /** Valid pointer to a data buffer, or NULL otherwise */ void *buf; - /** Length of the buffer @a buf. + /** Length of the buffer @a buf in bytes. * If @a buf is NULL, length which as to be sent as dummy bytes (as TX * buffer) or the length of bytes that should be skipped (as RX buffer). */ @@ -471,7 +471,7 @@ struct spi_buf { struct spi_buf_set { /** Pointer to an array of spi_buf, or NULL */ const struct spi_buf *buffers; - /** Length of the array pointed by @a buffers */ + /** Length of the array (number of buffers) pointed by @a buffers */ size_t count; }; From 9e7785f32387bd3eeca32167348ed60b56ba8c9c Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Fri, 27 Sep 2024 09:35:58 +0200 Subject: [PATCH 0721/4482] tests/bsim/bluetooth/ll/edtt: Dont use deprecated global_device_nbr Use the provided API to get it instead Signed-off-by: Alberto Escolar Piedras --- tests/bsim/bluetooth/ll/edtt/common/edtt_driver_bsim.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/bsim/bluetooth/ll/edtt/common/edtt_driver_bsim.c b/tests/bsim/bluetooth/ll/edtt/common/edtt_driver_bsim.c index f653db49b5a85..2c13f902a23a2 100644 --- a/tests/bsim/bluetooth/ll/edtt/common/edtt_driver_bsim.c +++ b/tests/bsim/bluetooth/ll/edtt/common/edtt_driver_bsim.c @@ -20,6 +20,7 @@ #include "bs_utils.h" #include "bs_oswrap.h" #include "bs_pc_base_fifo_user.h" +#include "bsim_args_runner.h" /* Recheck if something arrived from the EDTT every 5ms */ #define EDTT_IF_RECHECK_DELTA 5 /* ms */ @@ -42,8 +43,6 @@ static int edtt_autoshutdown; static int fifo[2] = { -1, -1 }; static char *fifo_path[2] = {NULL, NULL}; -extern unsigned int global_device_nbr; - static void edttd_clean_up(void); static void edptd_create_fifo_if(void); static int fifo_low_level_read(uint8_t *bufptr, int size); @@ -173,6 +172,7 @@ void set_edtt_autoshutdown(bool Mode) static void edptd_create_fifo_if(void) { int flags; + int device_nbr = bsim_args_get_global_device_nbr(); bs_trace_raw_time(9, "Bringing EDTT IF up (waiting for other side)\n"); @@ -190,10 +190,8 @@ static void edptd_create_fifo_if(void) sizeof(char)); fifo_path[TO_EDTT] = (char *)bs_calloc(pb_com_path_length + 30, sizeof(char)); - sprintf(fifo_path[TO_DEVICE], "%s/Device%i.PTTin", - pb_com_path, global_device_nbr); - sprintf(fifo_path[TO_EDTT], "%s/Device%i.PTTout", - pb_com_path, global_device_nbr); + sprintf(fifo_path[TO_DEVICE], "%s/Device%i.PTTin", pb_com_path, device_nbr); + sprintf(fifo_path[TO_EDTT], "%s/Device%i.PTTout", pb_com_path, device_nbr); if ((pb_create_fifo_if_not_there(fifo_path[TO_DEVICE]) != 0) || (pb_create_fifo_if_not_there(fifo_path[TO_EDTT]) != 0)) { From 7a57d55c769847bc3fa401c59d2b3db0e89bdfb6 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Mon, 7 Oct 2024 17:58:08 -0300 Subject: [PATCH 0722/4482] drivers: bt: airoc: fix compliance check Fix compliance check related to "symbols without children". Using regular 'config' entry. Signed-off-by: Sylvio Alves --- drivers/bluetooth/hci/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bluetooth/hci/Kconfig b/drivers/bluetooth/hci/Kconfig index aacef695ef12a..c289a1f0ba08d 100644 --- a/drivers/bluetooth/hci/Kconfig +++ b/drivers/bluetooth/hci/Kconfig @@ -188,7 +188,7 @@ config BT_STM32_IPM_RX_STACK_SIZE depends on BT_STM32_IPM default 512 -menuconfig BT_AIROC +config BT_AIROC bool "AIROC BT connectivity" default y select GPIO if BT_H4 From 6be08222c01b4a17ad29923ed7ea5f3857e6451e Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Mon, 7 Oct 2024 17:14:23 -0500 Subject: [PATCH 0723/4482] boards: frdm_mcxw71: Enable mcuboot Enable mcuboot partitions Signed-off-by: Declan Snyder --- boards/nxp/frdm_mcxw71/frdm_mcxw71.dts | 17 +++++++++++------ tests/boot/test_mcuboot/testcase.yaml | 1 + 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/boards/nxp/frdm_mcxw71/frdm_mcxw71.dts b/boards/nxp/frdm_mcxw71/frdm_mcxw71.dts index 9b1fb021f0eef..43721739b3537 100644 --- a/boards/nxp/frdm_mcxw71/frdm_mcxw71.dts +++ b/boards/nxp/frdm_mcxw71/frdm_mcxw71.dts @@ -21,7 +21,7 @@ chosen { zephyr,flash = &flash; zephyr,flash-controller = &fmu; - zephyr,code-partition = &code_partition; + zephyr,code-partition = &slot0_partition; zephyr,sram = &stcm0; zephyr,console = &lpuart1; zephyr,shell-uart = &lpuart1; @@ -65,15 +65,20 @@ #address-cells = <1>; #size-cells = <1>; - code_partition: partition@0 { - reg = <0x0 DT_SIZE_K(896)>; - label = "code"; - read-only; + boot_partition: partition@0 { + reg = <0x0 DT_SIZE_K(64)>; + }; + + slot0_partition: partition@10000 { + reg = <0x10000 DT_SIZE_K(416)>; + }; + + slot1_partition: partition@78000 { + reg = <0x78000 DT_SIZE_K(416)>; }; storage_partition: partition@e0000 { reg = <0xe0000 DT_SIZE_K(128)>; - label = "storage"; }; }; }; diff --git a/tests/boot/test_mcuboot/testcase.yaml b/tests/boot/test_mcuboot/testcase.yaml index 630e3ac6b639f..3de1f70426a92 100644 --- a/tests/boot/test_mcuboot/testcase.yaml +++ b/tests/boot/test_mcuboot/testcase.yaml @@ -44,6 +44,7 @@ tests: - nrf52840dk/nrf52840 - rd_rw612_bga - nucleo_wba55cg + - frdm_mcxw71 integration_platforms: - frdm_k64f - nrf52840dk/nrf52840 From 50919747bfda9b7537c4033f1f051e8ececdf043 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Wed, 9 Oct 2024 13:54:33 +0200 Subject: [PATCH 0724/4482] drivers: ipm: xlnx: fix AMD copyright There is nothing like AMD-Xilinx Inc. That's why use full AMD name instead. Fixes: 09e2a4e9ebdb ("drivers: ipm: add zynqmp r5f support") Co-developed-by: Mubin Sayyed Signed-off-by: Mubin Sayyed Signed-off-by: Michal Simek --- drivers/ipm/ipm_xlnx_ipi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ipm/ipm_xlnx_ipi.c b/drivers/ipm/ipm_xlnx_ipi.c index dbd9c4c0b9c26..a7a967e3d1b8b 100644 --- a/drivers/ipm/ipm_xlnx_ipi.c +++ b/drivers/ipm/ipm_xlnx_ipi.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 AMD-Xilinx Inc. + * Copyright (c) 2023 Advanced Micro Devices, Inc. * * SPDX-License-Identifier: Apache-2.0 */ From 0ed799aa148ce5ba9516ed76a299e733babd92ae Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Wed, 9 Oct 2024 17:15:09 +0200 Subject: [PATCH 0725/4482] tests: Bluetooth: Audio: Modify/add compile.sh for audio samples Instead of having one large compile.sh for all audio samples, it has been split into multiple. This makes it easier to build and run specific tests (e.g. BAP or CAP), without having to build all of them. This also makes it easier to expand later, without creating one huge compile.sh file. Signed-off-by: Emil Gydesen --- .../bap_broadcast_sink/compile.sh | 26 +++++++ .../bap_unicast_client/compile.sh | 29 ++++++++ .../bluetooth/audio_samples/cap/compile.sh | 60 +++++++++++++++ tests/bsim/bluetooth/audio_samples/compile.sh | 73 +------------------ 4 files changed, 118 insertions(+), 70 deletions(-) create mode 100755 tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/compile.sh create mode 100755 tests/bsim/bluetooth/audio_samples/bap_unicast_client/compile.sh create mode 100755 tests/bsim/bluetooth/audio_samples/cap/compile.sh diff --git a/tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/compile.sh b/tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/compile.sh new file mode 100755 index 0000000000000..8ed8895934ad1 --- /dev/null +++ b/tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/compile.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# Copyright 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +#set -x #uncomment this line for debugging +set -ue + +: "${ZEPHYR_BASE:?ZEPHYR_BASE must be set to point to the zephyr root directory}" + +source ${ZEPHYR_BASE}/tests/bsim/compile.source + +if [ "${BOARD_TS}" == "nrf5340bsim_nrf5340_cpuapp" ]; then + app=samples/bluetooth/bap_broadcast_source sysbuild=1 compile + app=tests/bsim/bluetooth/audio_samples/bap_broadcast_sink sysbuild=1 \ + conf_file=${ZEPHYR_BASE}/samples/bluetooth/bap_broadcast_sink/prj.conf \ + exe_name=bs_${BOARD_TS}_${app}_prj_conf sysbuild=1 compile +else + app=samples/bluetooth/bap_broadcast_source conf_overlay=overlay-bt_ll_sw_split.conf \ + exe_name=bs_${BOARD_TS}_${app}_prj_conf sysbuild=1 compile + app=tests/bsim/bluetooth/audio_samples/bap_broadcast_sink \ + conf_file=${ZEPHYR_BASE}/samples/bluetooth/bap_broadcast_sink/prj.conf \ + conf_overlay=${ZEPHYR_BASE}/samples/bluetooth/bap_broadcast_sink/overlay-bt_ll_sw_split.conf \ + exe_name=bs_${BOARD_TS}_${app}_prj_conf sysbuild=1 compile +fi + +wait_for_background_jobs diff --git a/tests/bsim/bluetooth/audio_samples/bap_unicast_client/compile.sh b/tests/bsim/bluetooth/audio_samples/bap_unicast_client/compile.sh new file mode 100755 index 0000000000000..413d6860cf488 --- /dev/null +++ b/tests/bsim/bluetooth/audio_samples/bap_unicast_client/compile.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# Copyright 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +#set -x #uncomment this line for debugging +set -ue + +: "${ZEPHYR_BASE:?ZEPHYR_BASE must be set to point to the zephyr root directory}" + +source ${ZEPHYR_BASE}/tests/bsim/compile.source + +if [ "${BOARD_TS}" == "nrf5340bsim_nrf5340_cpuapp" ]; then + app=samples/bluetooth/bap_unicast_server sysbuild=1 compile + app=tests/bsim/bluetooth/audio_samples/bap_unicast_client \ + sample=${ZEPHYR_BASE}/samples/bluetooth/bap_unicast_client \ + conf_file=${sample}/prj.conf \ + conf_overlay=${sample}/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf \ + exe_name=bs_${BOARD_TS}_${app}_prj_conf sysbuild=1 compile +else + app=samples/bluetooth/bap_unicast_server conf_overlay=overlay-bt_ll_sw_split.conf \ + exe_name=bs_${BOARD_TS}_${app}_prj_conf sysbuild=1 compile + app=tests/bsim/bluetooth/audio_samples/bap_unicast_client \ + sample=${ZEPHYR_BASE}/samples/bluetooth/bap_unicast_client \ + conf_file=${sample}/prj.conf \ + conf_overlay=${sample}/overlay-bt_ll_sw_split.conf \ + exe_name=bs_${BOARD_TS}_${app}_prj_conf sysbuild=1 compile +fi + +wait_for_background_jobs diff --git a/tests/bsim/bluetooth/audio_samples/cap/compile.sh b/tests/bsim/bluetooth/audio_samples/cap/compile.sh new file mode 100755 index 0000000000000..73457639187a0 --- /dev/null +++ b/tests/bsim/bluetooth/audio_samples/cap/compile.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +# Copyright 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +#set -x #uncomment this line for debugging +set -ue + +: "${ZEPHYR_BASE:?ZEPHYR_BASE must be set to point to the zephyr root directory}" + +source ${ZEPHYR_BASE}/tests/bsim/compile.source + +if [ "${BOARD_TS}" == "nrf5340bsim_nrf5340_cpuapp" ]; then + app=tests/bsim/bluetooth/audio_samples/cap/initiator \ + sample=${ZEPHYR_BASE}/samples/bluetooth/cap_initiator \ + cmake_extra_args="-DCONFIG_SAMPLE_UNICAST=n" \ + conf_file=${sample}/prj.conf \ + conf_overlay=${sample}/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf \ + exe_name=bs_${BOARD_TS}_${app}_broadcast_prj_conf sysbuild=1 compile + app=tests/bsim/bluetooth/audio_samples/cap/acceptor \ + sample=${ZEPHYR_BASE}/samples/bluetooth/cap_acceptor \ + cmake_extra_args="-DCONFIG_SAMPLE_SCAN_SELF=y -DCONFIG_SAMPLE_UNICAST=n" \ + conf_file=${sample}/prj.conf \ + conf_overlay=${sample}/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf \ + exe_name=bs_${BOARD_TS}_${app}_broadcast_prj_conf sysbuild=1 compile + app=tests/bsim/bluetooth/audio_samples/cap/initiator \ + sample=${ZEPHYR_BASE}/samples/bluetooth/cap_initiator \ + conf_file=${sample}/prj.conf \ + conf_overlay=${sample}/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf \ + exe_name=bs_${BOARD_TS}_${app}_unicast_prj_conf sysbuild=1 compile + app=tests/bsim/bluetooth/audio_samples/cap/acceptor \ + sample=${ZEPHYR_BASE}/samples/bluetooth/cap_acceptor \ + conf_file=${sample}/prj.conf \ + conf_overlay=${sample}/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf \ + exe_name=bs_${BOARD_TS}_${app}_unicast_prj_conf sysbuild=1 compile +else + app=tests/bsim/bluetooth/audio_samples/cap/initiator \ + sample=${ZEPHYR_BASE}/samples/bluetooth/cap_initiator \ + cmake_extra_args="-DCONFIG_SAMPLE_UNICAST=n" \ + conf_file=${sample}/prj.conf \ + conf_overlay=${sample}/overlay-bt_ll_sw_split.conf \ + exe_name=bs_${BOARD_TS}_${app}_broadcast_prj_conf sysbuild=1 compile + app=tests/bsim/bluetooth/audio_samples/cap/acceptor \ + sample=${ZEPHYR_BASE}/samples/bluetooth/cap_acceptor \ + cmake_extra_args="-DCONFIG_SAMPLE_SCAN_SELF=y -DCONFIG_SAMPLE_UNICAST=n" \ + conf_file=${sample}/prj.conf \ + conf_overlay=${sample}/overlay-bt_ll_sw_split.conf \ + exe_name=bs_${BOARD_TS}_${app}_broadcast_prj_conf sysbuild=1 compile + app=tests/bsim/bluetooth/audio_samples/cap/initiator \ + sample=${ZEPHYR_BASE}/samples/bluetooth/cap_initiator \ + conf_file=${sample}/prj.conf \ + conf_overlay=${sample}/overlay-bt_ll_sw_split.conf \ + exe_name=bs_${BOARD_TS}_${app}_unicast_prj_conf sysbuild=1 compile + app=tests/bsim/bluetooth/audio_samples/cap/acceptor \ + sample=${ZEPHYR_BASE}/samples/bluetooth/cap_acceptor \ + conf_file=${sample}/prj.conf \ + conf_overlay=${sample}/overlay-bt_ll_sw_split.conf \ + exe_name=bs_${BOARD_TS}_${app}_unicast_prj_conf sysbuild=1 compile +fi + +wait_for_background_jobs diff --git a/tests/bsim/bluetooth/audio_samples/compile.sh b/tests/bsim/bluetooth/audio_samples/compile.sh index 435a0b27d5f9b..cfc69b1605745 100755 --- a/tests/bsim/bluetooth/audio_samples/compile.sh +++ b/tests/bsim/bluetooth/audio_samples/compile.sh @@ -11,75 +11,8 @@ set -ue source ${ZEPHYR_BASE}/tests/bsim/compile.source -if [ "${BOARD_TS}" == "nrf5340bsim_nrf5340_cpuapp" ]; then - app=samples/bluetooth/bap_unicast_server sysbuild=1 compile - app=samples/bluetooth/bap_broadcast_source sysbuild=1 compile - app=tests/bsim/bluetooth/audio_samples/bap_unicast_client \ - sample=${ZEPHYR_BASE}/samples/bluetooth/bap_unicast_client \ - conf_file=${sample}/prj.conf \ - conf_overlay=${sample}/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf \ - exe_name=bs_${BOARD_TS}_${app}_prj_conf sysbuild=1 compile - app=tests/bsim/bluetooth/audio_samples/bap_broadcast_sink sysbuild=1 \ - conf_file=${ZEPHYR_BASE}/samples/bluetooth/bap_broadcast_sink/prj.conf \ - exe_name=bs_${BOARD_TS}_${app}_prj_conf sysbuild=1 compile - app=tests/bsim/bluetooth/audio_samples/cap/initiator \ - sample=${ZEPHYR_BASE}/samples/bluetooth/cap_initiator \ - cmake_extra_args="-DCONFIG_SAMPLE_UNICAST=n" \ - conf_file=${sample}/prj.conf \ - conf_overlay=${sample}/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf \ - exe_name=bs_${BOARD_TS}_${app}_broadcast_prj_conf sysbuild=1 compile - app=tests/bsim/bluetooth/audio_samples/cap/acceptor \ - sample=${ZEPHYR_BASE}/samples/bluetooth/cap_acceptor \ - cmake_extra_args="-DCONFIG_SAMPLE_SCAN_SELF=y -DCONFIG_SAMPLE_UNICAST=n" \ - conf_file=${sample}/prj.conf \ - conf_overlay=${sample}/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf \ - exe_name=bs_${BOARD_TS}_${app}_broadcast_prj_conf sysbuild=1 compile - app=tests/bsim/bluetooth/audio_samples/cap/initiator \ - sample=${ZEPHYR_BASE}/samples/bluetooth/cap_initiator \ - conf_file=${sample}/prj.conf \ - conf_overlay=${sample}/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf \ - exe_name=bs_${BOARD_TS}_${app}_unicast_prj_conf sysbuild=1 compile - app=tests/bsim/bluetooth/audio_samples/cap/acceptor \ - sample=${ZEPHYR_BASE}/samples/bluetooth/cap_acceptor \ - conf_file=${sample}/prj.conf \ - conf_overlay=${sample}/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf \ - exe_name=bs_${BOARD_TS}_${app}_unicast_prj_conf sysbuild=1 compile -else - app=samples/bluetooth/bap_unicast_server conf_overlay=overlay-bt_ll_sw_split.conf \ - exe_name=bs_${BOARD_TS}_${app}_prj_conf sysbuild=1 compile - app=samples/bluetooth/bap_broadcast_source conf_overlay=overlay-bt_ll_sw_split.conf \ - exe_name=bs_${BOARD_TS}_${app}_prj_conf sysbuild=1 compile - app=tests/bsim/bluetooth/audio_samples/bap_unicast_client \ - sample=${ZEPHYR_BASE}/samples/bluetooth/bap_unicast_client \ - conf_file=${sample}/prj.conf \ - conf_overlay=${sample}/overlay-bt_ll_sw_split.conf \ - exe_name=bs_${BOARD_TS}_${app}_prj_conf sysbuild=1 compile - app=tests/bsim/bluetooth/audio_samples/bap_broadcast_sink \ - conf_file=${ZEPHYR_BASE}/samples/bluetooth/bap_broadcast_sink/prj.conf \ - conf_overlay=${ZEPHYR_BASE}/samples/bluetooth/bap_broadcast_sink/overlay-bt_ll_sw_split.conf \ - exe_name=bs_${BOARD_TS}_${app}_prj_conf sysbuild=1 compile - app=tests/bsim/bluetooth/audio_samples/cap/initiator \ - sample=${ZEPHYR_BASE}/samples/bluetooth/cap_initiator \ - cmake_extra_args="-DCONFIG_SAMPLE_UNICAST=n" \ - conf_file=${sample}/prj.conf \ - conf_overlay=${sample}/overlay-bt_ll_sw_split.conf \ - exe_name=bs_${BOARD_TS}_${app}_broadcast_prj_conf sysbuild=1 compile - app=tests/bsim/bluetooth/audio_samples/cap/acceptor \ - sample=${ZEPHYR_BASE}/samples/bluetooth/cap_acceptor \ - cmake_extra_args="-DCONFIG_SAMPLE_SCAN_SELF=y -DCONFIG_SAMPLE_UNICAST=n" \ - conf_file=${sample}/prj.conf \ - conf_overlay=${sample}/overlay-bt_ll_sw_split.conf \ - exe_name=bs_${BOARD_TS}_${app}_broadcast_prj_conf sysbuild=1 compile - app=tests/bsim/bluetooth/audio_samples/cap/initiator \ - sample=${ZEPHYR_BASE}/samples/bluetooth/cap_initiator \ - conf_file=${sample}/prj.conf \ - conf_overlay=${sample}/overlay-bt_ll_sw_split.conf \ - exe_name=bs_${BOARD_TS}_${app}_unicast_prj_conf sysbuild=1 compile - app=tests/bsim/bluetooth/audio_samples/cap/acceptor \ - sample=${ZEPHYR_BASE}/samples/bluetooth/cap_acceptor \ - conf_file=${sample}/prj.conf \ - conf_overlay=${sample}/overlay-bt_ll_sw_split.conf \ - exe_name=bs_${BOARD_TS}_${app}_unicast_prj_conf sysbuild=1 compile -fi +run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/audio_samples/bap_broadcast_sink/compile.sh +run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/audio_samples/bap_unicast_client/compile.sh +run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/audio_samples/cap/compile.sh wait_for_background_jobs From edb47444b933b61d15ea87f3b5e6aa2db8e81716 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 9 Oct 2024 23:11:53 +0530 Subject: [PATCH 0726/4482] manifest: hostap: Pull fix for duplicate AP enable event The event is sent from both WPA supplicant and hostapd, but hostapd should only be sent when using hostapd to create the AP. Signed-off-by: Chaitanya Tata --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 376b88186860a..ff495c84a360d 100644 --- a/west.yml +++ b/west.yml @@ -259,7 +259,7 @@ manifest: - hal - name: hostap path: modules/lib/hostap - revision: cdc0782c6ec76d75456e637bff78004c2c6eae87 + revision: 0fd0276b5b65de4d2f7cd0552789a74d3a129441 - name: libmetal revision: a6851ba6dba8c9e87d00c42f171a822f7a29639b path: modules/hal/libmetal From e0a262b33f277faf0ed51beac009349f2452b74e Mon Sep 17 00:00:00 2001 From: Lars Knudsen Date: Wed, 9 Oct 2024 20:44:04 +0200 Subject: [PATCH 0727/4482] Bluetooth: Audio: Fix initial Broadcast source values If the Broadcast ID is initially set to 0x000000, which is valid, comparison logic on add of an actual Broadcast ID of 0x000000 fails. Likewise for SID. Moving INVALID_BROADCAST_ID define to bap.h Signed-off-by: Lars Knudsen --- include/zephyr/bluetooth/audio/bap.h | 3 +++ .../bap_broadcast_assistant/src/main.c | 7 +++---- .../bluetooth/bap_broadcast_sink/src/main.c | 3 +-- .../pbp_public_broadcast_sink/src/main.c | 7 +++---- .../tmap_bmr/src/bap_broadcast_sink.c | 5 ++--- .../bluetooth/audio/bap_broadcast_assistant.c | 2 ++ subsys/bluetooth/audio/bap_broadcast_sink.c | 7 +------ subsys/bluetooth/audio/shell/bap.c | 7 +++---- .../audio/shell/bap_broadcast_assistant.c | 18 ++++++++---------- .../tester/src/audio/btp_bap_broadcast.c | 5 ++--- .../audio/src/bap_broadcast_sink_test.c | 2 +- tests/bsim/bluetooth/audio/src/common.h | 1 - .../audio/src/pbp_public_broadcast_sink_test.c | 8 ++++---- 13 files changed, 33 insertions(+), 42 deletions(-) diff --git a/include/zephyr/bluetooth/audio/bap.h b/include/zephyr/bluetooth/audio/bap.h index f7bf96845ca35..6b21f61c8a578 100644 --- a/include/zephyr/bluetooth/audio/bap.h +++ b/include/zephyr/bluetooth/audio/bap.h @@ -41,6 +41,9 @@ extern "C" { #endif +/** An invalid Broadcast ID */ +#define BT_BAP_INVALID_BROADCAST_ID 0xFFFFFFFFU + /** * @brief Check if a BAP BASS BIS_Sync bitfield is valid * diff --git a/samples/bluetooth/bap_broadcast_assistant/src/main.c b/samples/bluetooth/bap_broadcast_assistant/src/main.c index 3a4356cdac24b..321bacf131a63 100644 --- a/samples/bluetooth/bap_broadcast_assistant/src/main.c +++ b/samples/bluetooth/bap_broadcast_assistant/src/main.c @@ -33,7 +33,6 @@ #define PA_SYNC_SKIP 5 #define PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO 20 /* Set the timeout relative to interval */ /* Broadcast IDs are 24bit, so this is out of valid range */ -#define INVALID_BROADCAST_ID 0xFFFFFFFFU static void scan_for_broadcast_sink(void); @@ -297,7 +296,7 @@ static void scan_recv_cb(const struct bt_le_scan_recv_info *info, if (scanning_for_broadcast_source) { /* Scan for and select Broadcast Source */ - sr_info.broadcast_id = INVALID_BROADCAST_ID; + sr_info.broadcast_id = BT_BAP_INVALID_BROADCAST_ID; /* We are only interested in non-connectable periodic advertisers */ if ((info->adv_props & BT_GAP_ADV_PROP_CONNECTABLE) != 0 || @@ -307,7 +306,7 @@ static void scan_recv_cb(const struct bt_le_scan_recv_info *info, bt_data_parse(ad, device_found, (void *)&sr_info); - if (sr_info.broadcast_id != INVALID_BROADCAST_ID) { + if (sr_info.broadcast_id != BT_BAP_INVALID_BROADCAST_ID) { printk("Broadcast Source Found:\n"); printk(" BT Name: %s\n", sr_info.bt_name); printk(" Broadcast Name: %s\n", sr_info.broadcast_name); @@ -545,7 +544,7 @@ static void reset(void) printk("\n\nReset...\n\n"); broadcast_sink_conn = NULL; - selected_broadcast_id = INVALID_BROADCAST_ID; + selected_broadcast_id = BT_BAP_INVALID_BROADCAST_ID; selected_sid = 0; selected_pa_interval = 0; (void)memset(&selected_addr, 0, sizeof(selected_addr)); diff --git a/samples/bluetooth/bap_broadcast_sink/src/main.c b/samples/bluetooth/bap_broadcast_sink/src/main.c index f97e562889a08..eeee228a3a52e 100644 --- a/samples/bluetooth/bap_broadcast_sink/src/main.c +++ b/samples/bluetooth/bap_broadcast_sink/src/main.c @@ -58,7 +58,6 @@ BUILD_ASSERT(IS_ENABLED(CONFIG_SCAN_SELF) || IS_ENABLED(CONFIG_SCAN_OFFLOAD), #define ADV_TIMEOUT K_FOREVER #endif /* CONFIG_SCAN_SELF */ -#define INVALID_BROADCAST_ID (BT_AUDIO_BROADCAST_ID_MAX + 1) #define PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO 5 /* Set the timeout relative to interval */ #define PA_SYNC_SKIP 5 #define NAME_LEN sizeof(CONFIG_TARGET_BROADCAST_NAME) + 1 @@ -1361,7 +1360,7 @@ static int reset(void) (void)memset(sink_broadcast_code, 0, sizeof(sink_broadcast_code)); (void)memset(&broadcaster_info, 0, sizeof(broadcaster_info)); (void)memset(&broadcaster_addr, 0, sizeof(broadcaster_addr)); - broadcaster_broadcast_id = INVALID_BROADCAST_ID; + broadcaster_broadcast_id = BT_BAP_INVALID_BROADCAST_ID; if (broadcast_sink != NULL) { err = bt_bap_broadcast_sink_delete(broadcast_sink); diff --git a/samples/bluetooth/pbp_public_broadcast_sink/src/main.c b/samples/bluetooth/pbp_public_broadcast_sink/src/main.c index 99c869bfce1fa..81a726b10e8b8 100644 --- a/samples/bluetooth/pbp_public_broadcast_sink/src/main.c +++ b/samples/bluetooth/pbp_public_broadcast_sink/src/main.c @@ -36,7 +36,6 @@ #define SEM_TIMEOUT K_SECONDS(10) #define PA_SYNC_SKIP 5 #define PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO 20 /* Set the timeout relative to interval */ -#define INVALID_BROADCAST_ID 0xFFFFFFFF static bool pbs_found; @@ -203,7 +202,7 @@ static bool scan_check_and_sync_broadcast(struct bt_data *data, void *user_data) * Continue parsing if Broadcast Audio Announcement Service * was not found. */ - if (*broadcast_id == INVALID_BROADCAST_ID) { + if (*broadcast_id == BT_BAP_INVALID_BROADCAST_ID) { return true; } } @@ -223,10 +222,10 @@ static void broadcast_scan_recv(const struct bt_le_scan_recv_info *info, return; } - broadcast_id = INVALID_BROADCAST_ID; + broadcast_id = BT_BAP_INVALID_BROADCAST_ID; bt_data_parse(ad, scan_check_and_sync_broadcast, (void *)&broadcast_id); - if ((broadcast_id != INVALID_BROADCAST_ID) && pbs_found) { + if ((broadcast_id != BT_BAP_INVALID_BROADCAST_ID) && pbs_found) { sync_broadcast_pa(info, broadcast_id); } } diff --git a/samples/bluetooth/tmap_bmr/src/bap_broadcast_sink.c b/samples/bluetooth/tmap_bmr/src/bap_broadcast_sink.c index 0145f1965f427..4ee361934a533 100644 --- a/samples/bluetooth/tmap_bmr/src/bap_broadcast_sink.c +++ b/samples/bluetooth/tmap_bmr/src/bap_broadcast_sink.c @@ -29,7 +29,6 @@ #define SEM_TIMEOUT K_SECONDS(10) #define PA_SYNC_SKIP 5 #define PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO 20 /* Set the timeout relative to interval */ -#define INVALID_BROADCAST_ID 0xFFFFFFFF static bool tmap_bms_found; @@ -209,10 +208,10 @@ static void broadcast_scan_recv(const struct bt_le_scan_recv_info *info, return; } - broadcast_id = INVALID_BROADCAST_ID; + broadcast_id = BT_BAP_INVALID_BROADCAST_ID; bt_data_parse(ad, scan_check_and_sync_broadcast, (void *)&broadcast_id); - if ((broadcast_id != INVALID_BROADCAST_ID) && tmap_bms_found) { + if ((broadcast_id != BT_BAP_INVALID_BROADCAST_ID) && tmap_bms_found) { sync_broadcast_pa(info, broadcast_id); } } diff --git a/subsys/bluetooth/audio/bap_broadcast_assistant.c b/subsys/bluetooth/audio/bap_broadcast_assistant.c index 1b2569c1daff8..70f6a5c778fed 100644 --- a/subsys/bluetooth/audio/bap_broadcast_assistant.c +++ b/subsys/bluetooth/audio/bap_broadcast_assistant.c @@ -955,6 +955,8 @@ static int broadcast_assistant_reset(struct bap_broadcast_assistant_instance *in for (int i = 0U; i < CONFIG_BT_BAP_BROADCAST_ASSISTANT_RECV_STATE_COUNT; i++) { memset(&inst->recv_states[i], 0, sizeof(inst->recv_states[i])); + inst->recv_states[i].broadcast_id = BT_BAP_INVALID_BROADCAST_ID; + inst->recv_states[i].adv_sid = BT_HCI_LE_EXT_ADV_SID_INVALID; inst->recv_states[i].past_avail = false; inst->recv_state_handles[i] = 0U; } diff --git a/subsys/bluetooth/audio/bap_broadcast_sink.c b/subsys/bluetooth/audio/bap_broadcast_sink.c index 58cb0d65d8166..aece13def247f 100644 --- a/subsys/bluetooth/audio/bap_broadcast_sink.c +++ b/subsys/bluetooth/audio/bap_broadcast_sink.c @@ -51,11 +51,6 @@ LOG_MODULE_REGISTER(bt_bap_broadcast_sink, CONFIG_BT_BAP_BROADCAST_SINK_LOG_LEVE #define PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO 20 /* Set the timeout relative to interval */ #define BROADCAST_SYNC_MIN_INDEX (BIT(1)) -/* any value above 0xFFFFFF is invalid, so we can just use 0xFFFFFFFF to denote - * invalid broadcast ID - */ -#define INVALID_BROADCAST_ID 0xFFFFFFFF - static struct bt_bap_ep broadcast_sink_eps[CONFIG_BT_BAP_BROADCAST_SNK_COUNT] [CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT]; static struct bt_bap_broadcast_sink broadcast_sinks[CONFIG_BT_BAP_BROADCAST_SNK_COUNT]; @@ -435,7 +430,7 @@ static struct bt_bap_broadcast_sink *broadcast_sink_free_get(void) if (!atomic_test_bit(broadcast_sinks[i].flags, BT_BAP_BROADCAST_SINK_FLAG_INITIALIZED)) { broadcast_sinks[i].index = i; - broadcast_sinks[i].broadcast_id = INVALID_BROADCAST_ID; + broadcast_sinks[i].broadcast_id = BT_BAP_INVALID_BROADCAST_ID; return &broadcast_sinks[i]; } diff --git a/subsys/bluetooth/audio/shell/bap.c b/subsys/bluetooth/audio/shell/bap.c index 0a05438abc30a..f39f57938937f 100644 --- a/subsys/bluetooth/audio/shell/bap.c +++ b/subsys/bluetooth/audio/shell/bap.c @@ -2345,7 +2345,6 @@ static int cmd_preset(const struct shell *sh, size_t argc, char *argv[]) #endif /* IS_BAP_INITIATOR */ #if defined(CONFIG_BT_BAP_BROADCAST_SINK) -#define INVALID_BROADCAST_ID (BT_AUDIO_BROADCAST_ID_MAX + 1) #define PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO 20 /* Set the timeout relative to interval */ #define PA_SYNC_SKIP 5 @@ -2354,14 +2353,14 @@ static struct broadcast_sink_auto_scan { uint32_t broadcast_id; struct bt_le_per_adv_sync **out_sync; } auto_scan = { - .broadcast_id = INVALID_BROADCAST_ID, + .broadcast_id = BT_BAP_INVALID_BROADCAST_ID, }; static void clear_auto_scan(void) { - if (auto_scan.broadcast_id != INVALID_BROADCAST_ID) { + if (auto_scan.broadcast_id != BT_BAP_INVALID_BROADCAST_ID) { memset(&auto_scan, 0, sizeof(auto_scan)); - auto_scan.broadcast_id = INVALID_BROADCAST_ID; + auto_scan.broadcast_id = BT_BAP_INVALID_BROADCAST_ID; } } diff --git a/subsys/bluetooth/audio/shell/bap_broadcast_assistant.c b/subsys/bluetooth/audio/shell/bap_broadcast_assistant.c index d434f1a79450c..d10b85e1ec48a 100644 --- a/subsys/bluetooth/audio/shell/bap_broadcast_assistant.c +++ b/subsys/bluetooth/audio/shell/bap_broadcast_assistant.c @@ -36,8 +36,6 @@ #include "../../host/hci_core.h" #include "audio.h" -#define INVALID_BROADCAST_ID 0xFFFFFFFFU - static uint8_t received_base[UINT8_MAX]; static size_t received_base_size; @@ -47,7 +45,7 @@ static struct bt_auto_scan { bool pa_sync; struct bt_bap_bass_subgroup subgroup; } auto_scan = { - .broadcast_id = INVALID_BROADCAST_ID, + .broadcast_id = BT_BAP_INVALID_BROADCAST_ID, }; struct bt_scan_recv_info { @@ -518,9 +516,9 @@ static void scan_recv_cb(const struct bt_le_scan_recv_info *info, struct bt_bap_broadcast_assistant_add_src_param param = { 0 }; int err; - sr_info.broadcast_id = INVALID_BROADCAST_ID; + sr_info.broadcast_id = BT_BAP_INVALID_BROADCAST_ID; - if ((auto_scan.broadcast_id == INVALID_BROADCAST_ID) && + if ((auto_scan.broadcast_id == BT_BAP_INVALID_BROADCAST_ID) && (strlen(auto_scan.broadcast_name) == 0U)) { /* no op */ return; @@ -539,7 +537,7 @@ static void scan_recv_cb(const struct bt_le_scan_recv_info *info, bt_data_parse(ad, broadcast_source_found, (void *)&sr_info); /* Verify that it is a BAP broadcaster*/ - if (sr_info.broadcast_id != INVALID_BROADCAST_ID) { + if (sr_info.broadcast_id != BT_BAP_INVALID_BROADCAST_ID) { char addr_str[BT_ADDR_LE_STR_LEN]; bool identified_broadcast = false; @@ -581,7 +579,7 @@ static void scan_recv_cb(const struct bt_le_scan_recv_info *info, } memset(&auto_scan, 0, sizeof(auto_scan)); - auto_scan.broadcast_id = INVALID_BROADCAST_ID; + auto_scan.broadcast_id = BT_BAP_INVALID_BROADCAST_ID; } } } @@ -591,7 +589,7 @@ static void scan_timeout_cb(void) shell_print(ctx_shell, "Scan timeout"); memset(&auto_scan, 0, sizeof(auto_scan)); - auto_scan.broadcast_id = INVALID_BROADCAST_ID; + auto_scan.broadcast_id = BT_BAP_INVALID_BROADCAST_ID; } static struct bt_le_scan_cb scan_callbacks = { @@ -635,7 +633,7 @@ static int cmd_bap_broadcast_assistant_add_broadcast_id(const struct shell *sh, unsigned long broadcast_id; int err = 0; - if (auto_scan.broadcast_id != INVALID_BROADCAST_ID) { + if (auto_scan.broadcast_id != BT_BAP_INVALID_BROADCAST_ID) { shell_info(sh, "Already scanning, wait for sync or timeout"); return -ENOEXEC; @@ -764,7 +762,7 @@ static int cmd_bap_broadcast_assistant_add_broadcast_name(const struct shell *sh /* Store results in the `auto_scan` struct */ utf8_lcpy(auto_scan.broadcast_name, broadcast_name, strlen(broadcast_name) + 1); - auto_scan.broadcast_id = INVALID_BROADCAST_ID; + auto_scan.broadcast_id = BT_BAP_INVALID_BROADCAST_ID; memcpy(&auto_scan.subgroup, &subgroup, sizeof(subgroup)); return 0; diff --git a/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c b/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c index 74aa70f096028..574ae5e61f93b 100644 --- a/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c +++ b/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c @@ -31,7 +31,6 @@ static struct btp_bap_broadcast_local_source local_source; static struct btp_bap_broadcast_remote_source *broadcast_source_to_sync; /* A mask for the maximum BIS we can sync to. +1 since the BIS indexes start from 1. */ static const uint32_t bis_index_mask = BIT_MASK(CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT + 1); -#define INVALID_BROADCAST_ID (BT_AUDIO_BROADCAST_ID_MAX + 1) #define PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO 20 /* Set the timeout relative to interval */ #define PA_SYNC_SKIP 5 static struct bt_bap_bass_subgroup @@ -62,7 +61,7 @@ static struct btp_bap_broadcast_remote_source *remote_broadcaster_alloc(void) for (size_t i = 0; i < ARRAY_SIZE(remote_broadcast_sources); i++) { struct btp_bap_broadcast_remote_source *broadcaster = &remote_broadcast_sources[i]; - if (broadcaster->broadcast_id == INVALID_BROADCAST_ID) { + if (broadcaster->broadcast_id == BT_BAP_INVALID_BROADCAST_ID) { return broadcaster; } } @@ -214,7 +213,7 @@ static void remote_broadcaster_free(struct btp_bap_broadcast_remote_source *broa { (void)memset(broadcaster, 0, sizeof(*broadcaster)); - broadcaster->broadcast_id = INVALID_BROADCAST_ID; + broadcaster->broadcast_id = BT_BAP_INVALID_BROADCAST_ID; for (size_t i = 0U; i < ARRAY_SIZE(broadcaster->sink_streams); i++) { broadcaster->sink_streams[i] = stream_broadcast_to_bap(&broadcaster->streams[i]); diff --git a/tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c b/tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c index bfa59aa4f1163..8c870ed2e99c8 100644 --- a/tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c @@ -762,7 +762,7 @@ static void test_broadcast_sink_create_inval(void) return; } - err = bt_bap_broadcast_sink_create(pa_sync, INVALID_BROADCAST_ID, &g_sink); + err = bt_bap_broadcast_sink_create(pa_sync, BT_BAP_INVALID_BROADCAST_ID, &g_sink); if (err == 0) { FAIL("bt_bap_broadcast_sink_create did not fail with invalid broadcast ID\n"); return; diff --git a/tests/bsim/bluetooth/audio/src/common.h b/tests/bsim/bluetooth/audio/src/common.h index b25752985733b..76020b8529d1b 100644 --- a/tests/bsim/bluetooth/audio/src/common.h +++ b/tests/bsim/bluetooth/audio/src/common.h @@ -103,7 +103,6 @@ static const uint8_t mock_iso_data[] = { #define AD_SIZE 1 -#define INVALID_BROADCAST_ID (BT_AUDIO_BROADCAST_ID_MAX + 1) #define PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO 20 /* Set the timeout relative to interval */ #define PA_SYNC_SKIP 5 diff --git a/tests/bsim/bluetooth/audio/src/pbp_public_broadcast_sink_test.c b/tests/bsim/bluetooth/audio/src/pbp_public_broadcast_sink_test.c index 625e72a1a3622..1f3eb5315c2a8 100644 --- a/tests/bsim/bluetooth/audio/src/pbp_public_broadcast_sink_test.c +++ b/tests/bsim/bluetooth/audio/src/pbp_public_broadcast_sink_test.c @@ -183,7 +183,7 @@ static int reset(void) k_sem_reset(&sem_pa_sync_lost); k_sem_reset(&sem_data_received); - broadcast_id = INVALID_BROADCAST_ID; + broadcast_id = BT_BAP_INVALID_BROADCAST_ID; bis_index_bitfield = 0U; pbs_found = false; @@ -275,7 +275,7 @@ static bool scan_check_and_sync_broadcast(struct bt_data *data, void *user_data) if (!bt_uuid_cmp(&adv_uuid.uuid, BT_UUID_BROADCAST_AUDIO)) { /* Save broadcast_id */ - if (broadcast_id == INVALID_BROADCAST_ID) { + if (broadcast_id == BT_BAP_INVALID_BROADCAST_ID) { broadcast_id = sys_get_le24(data->data + BT_UUID_SIZE_16); } @@ -292,7 +292,7 @@ static bool scan_check_and_sync_broadcast(struct bt_data *data, void *user_data) pbs_found = true; /* Continue parsing if Broadcast Audio Announcement Service was not found */ - if (broadcast_id == INVALID_BROADCAST_ID) { + if (broadcast_id == BT_BAP_INVALID_BROADCAST_ID) { return true; } @@ -316,7 +316,7 @@ static void broadcast_scan_recv(const struct bt_le_scan_recv_info *info, bt_data_parse(ad, scan_check_and_sync_broadcast, (void *)&broadcast_id); - if ((broadcast_id != INVALID_BROADCAST_ID) && pbs_found) { + if ((broadcast_id != BT_BAP_INVALID_BROADCAST_ID) && pbs_found) { sync_broadcast_pa(info); } } From 4361c96c48f30f1a39f59b268b713009a92e6d1b Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Wed, 14 Aug 2024 22:05:47 +1000 Subject: [PATCH 0728/4482] adc: current_sense_amplifier: resistance in milli-ohms Change the unit of the sense resistor in the devicetree binding from micro-ohms to milli-ohms. This is done for three reasons. Firstly, the maximum value resistor that can currently be represented is 4.2 kOhms, due to the limitation of devicetree properties to 32 bits. Secondly, storing the resistance at such a high resolution makes overflows much more likely when the desired output unit is micro-amps, not milli-amps. Finally, micro-ohms, are an unnecessarily precise unit for the purpose of these calculations, and a resolution that is not realistic to achieve. The high resistor resolution results in large divisors that reduce the resolution of outputs. Unlike resistors characterised down to the micro-ohm, devices wanting to measure micro-amps are actually realistic. Signed-off-by: Jordan Yates --- boards/google/twinkie_v2/google_twinkie_v2.dts | 4 ++-- boards/microchip/ev11l78a/ev11l78a.dts | 2 +- doc/releases/migration-guide-4.0.rst | 3 +++ drivers/sensor/current_amp/current_amp.c | 3 +++ dts/bindings/iio/afe/current-sense-amplifier.yaml | 4 ++-- include/zephyr/drivers/adc/current_sense_amplifier.h | 8 ++++---- tests/drivers/adc/adc_rescale/boards/native_sim.overlay | 2 +- tests/drivers/build_all/sensor/adc.dtsi | 2 +- 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/boards/google/twinkie_v2/google_twinkie_v2.dts b/boards/google/twinkie_v2/google_twinkie_v2.dts index 7eafd8e3612d0..08e8fbaf5d257 100644 --- a/boards/google/twinkie_v2/google_twinkie_v2.dts +++ b/boards/google/twinkie_v2/google_twinkie_v2.dts @@ -65,14 +65,14 @@ csa_vbus: vbusc { compatible = "current-sense-amplifier"; io-channels = <&adc1 17>; - sense-resistor-micro-ohms = <3000>; + sense-resistor-milli-ohms = <3>; sense-gain-mult = <100>; }; csa_cc2: vconc { compatible = "current-sense-amplifier"; io-channels = <&adc1 18>; - sense-resistor-micro-ohms = <10000>; + sense-resistor-milli-ohms = <10>; sense-gain-mult = <25>; }; diff --git a/boards/microchip/ev11l78a/ev11l78a.dts b/boards/microchip/ev11l78a/ev11l78a.dts index 02fa9f3591541..5eb279c7ac299 100644 --- a/boards/microchip/ev11l78a/ev11l78a.dts +++ b/boards/microchip/ev11l78a/ev11l78a.dts @@ -39,7 +39,7 @@ csa_i_sense: i_sense { compatible = "current-sense-amplifier"; io-channels = <&adc 5>; - sense-resistor-micro-ohms = <4000>; + sense-resistor-milli-ohms = <4>; sense-gain-mult = <100>; }; diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 1c00ac02f1188..71e88260f1cbd 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -240,6 +240,9 @@ Sensors * The existing driver for the Microchip MCP9808 temperature sensor transformed and renamed to support all JEDEC JC 42.4 compatible temperature sensors. It now uses the :dtcompatible:`jedec,jc-42.4-temp` compatible string instead to the ``microchip,mcp9808`` string. +* The :dtcompatible:`current-sense-amplifier` sense resistor is now specified in milli-ohms + (``sense-resistor-milli-ohms``) instead of micro-ohms in order to increase the maximum representable + resistor from 4.2k to 4.2M. * The ``nxp,`` prefixed properties in :dtcompatible:`nxp,kinetis-acmp` have been deprecated in favor of properties without the prefix. The sensor based driver for the :dtcompatible:`nxp,kinetis-acmp` diff --git a/drivers/sensor/current_amp/current_amp.c b/drivers/sensor/current_amp/current_amp.c index e9d5e1a09a217..6dabd98534361 100644 --- a/drivers/sensor/current_amp/current_amp.c +++ b/drivers/sensor/current_amp/current_amp.c @@ -11,6 +11,7 @@ #include #include #include +#include #include LOG_MODULE_REGISTER(current_amp, CONFIG_SENSOR_LOG_LEVEL); @@ -115,6 +116,8 @@ static int current_init(const struct device *dev) struct current_sense_amplifier_data *data = dev->data; int ret; + __ASSERT(config->sense_milli_ohms != 0, "Milli-ohms must not be 0"); + if (!adc_is_ready_dt(&config->port)) { LOG_ERR("ADC is not ready"); return -ENODEV; diff --git a/dts/bindings/iio/afe/current-sense-amplifier.yaml b/dts/bindings/iio/afe/current-sense-amplifier.yaml index 777116d0cff30..15d724a62ff0b 100644 --- a/dts/bindings/iio/afe/current-sense-amplifier.yaml +++ b/dts/bindings/iio/afe/current-sense-amplifier.yaml @@ -20,11 +20,11 @@ properties: description: | Channels available with this divider configuration. - sense-resistor-micro-ohms: + sense-resistor-milli-ohms: type: int required: true description: | - Resistance of the shunt resistor in micro-ohms + Resistance of the shunt resistor in milli-ohms. sense-gain-mult: type: int diff --git a/include/zephyr/drivers/adc/current_sense_amplifier.h b/include/zephyr/drivers/adc/current_sense_amplifier.h index 888167b1ae9d8..fd55f300faed8 100644 --- a/include/zephyr/drivers/adc/current_sense_amplifier.h +++ b/include/zephyr/drivers/adc/current_sense_amplifier.h @@ -12,7 +12,7 @@ struct current_sense_amplifier_dt_spec { const struct adc_dt_spec port; - uint32_t sense_micro_ohms; + uint32_t sense_milli_ohms; uint32_t sense_gain_mult; uint32_t sense_gain_div; struct gpio_dt_spec power_gpio; @@ -31,7 +31,7 @@ struct current_sense_amplifier_dt_spec { #define CURRENT_SENSE_AMPLIFIER_DT_SPEC_GET(node_id) \ { \ .port = ADC_DT_SPEC_GET(node_id), \ - .sense_micro_ohms = DT_PROP(node_id, sense_resistor_micro_ohms), \ + .sense_milli_ohms = DT_PROP(node_id, sense_resistor_milli_ohms), \ .sense_gain_mult = DT_PROP(node_id, sense_gain_mult), \ .sense_gain_div = DT_PROP(node_id, sense_gain_div), \ .power_gpio = GPIO_DT_SPEC_GET_OR(node_id, power_gpios, {0}), \ @@ -51,8 +51,8 @@ current_sense_amplifier_scale_dt(const struct current_sense_amplifier_dt_spec *s /* store in a temporary 64 bit variable to prevent overflow during calculation */ int64_t tmp = *v_to_i; - /* multiplies by 1,000,000 before dividing by sense resistance in micro-ohms. */ - tmp = tmp * 1000000 / spec->sense_micro_ohms * spec->sense_gain_div / spec->sense_gain_mult; + /* multiplies by 1,000 before dividing by sense resistance in milli-ohms. */ + tmp = tmp * 1000 / spec->sense_milli_ohms * spec->sense_gain_div / spec->sense_gain_mult; *v_to_i = (int32_t)tmp; } diff --git a/tests/drivers/adc/adc_rescale/boards/native_sim.overlay b/tests/drivers/adc/adc_rescale/boards/native_sim.overlay index aa146b863690d..f8df70103c98d 100644 --- a/tests/drivers/adc/adc_rescale/boards/native_sim.overlay +++ b/tests/drivers/adc/adc_rescale/boards/native_sim.overlay @@ -23,7 +23,7 @@ sensor2: csa { compatible = "current-sense-amplifier"; io-channels = <&adc0 2>; - sense-resistor-micro-ohms = <5000>; + sense-resistor-milli-ohms = <5>; sense-gain-mult = <100>; }; diff --git a/tests/drivers/build_all/sensor/adc.dtsi b/tests/drivers/build_all/sensor/adc.dtsi index 583839feff1c1..6c2c96359067d 100644 --- a/tests/drivers/build_all/sensor/adc.dtsi +++ b/tests/drivers/build_all/sensor/adc.dtsi @@ -31,7 +31,7 @@ test_current: current_amp { compatible = "current-sense-amplifier"; io-channels = <&test_adc 2>; io-channel-names = "CURRENT_AMP"; - sense-resistor-micro-ohms = <10>; + sense-resistor-milli-ohms = <1>; sense-gain-mult = <1>; sense-gain-div = <1>; }; From fec7156b03bd9534ceca65bf8327303554a42770 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Wed, 14 Aug 2024 22:21:16 +1000 Subject: [PATCH 0729/4482] adc: current_sense_amplifier: reduce valid scaling range Reduce the valid scaling range for the gain multipliers and dividers to provide more headroom on int64_t overflows in the calculations. Take advantage of this headroom to perform all multiplications before divisions. Signed-off-by: Jordan Yates --- doc/releases/migration-guide-4.0.rst | 3 +++ dts/bindings/iio/afe/current-sense-amplifier.yaml | 4 ++-- include/zephyr/drivers/adc/current_sense_amplifier.h | 10 ++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 71e88260f1cbd..6c0f35ac5d437 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -243,6 +243,9 @@ Sensors * The :dtcompatible:`current-sense-amplifier` sense resistor is now specified in milli-ohms (``sense-resistor-milli-ohms``) instead of micro-ohms in order to increase the maximum representable resistor from 4.2k to 4.2M. +* The :dtcompatible:`current-sense-amplifier` properties ``sense-gain-mult`` and ``sense-gain-div`` + are now limited to a maximum value of ``UINT16_MAX`` to enable smaller rounding errors in internal + calculations. * The ``nxp,`` prefixed properties in :dtcompatible:`nxp,kinetis-acmp` have been deprecated in favor of properties without the prefix. The sensor based driver for the :dtcompatible:`nxp,kinetis-acmp` diff --git a/dts/bindings/iio/afe/current-sense-amplifier.yaml b/dts/bindings/iio/afe/current-sense-amplifier.yaml index 15d724a62ff0b..11eda97323c5f 100644 --- a/dts/bindings/iio/afe/current-sense-amplifier.yaml +++ b/dts/bindings/iio/afe/current-sense-amplifier.yaml @@ -30,13 +30,13 @@ properties: type: int default: 1 description: | - Amplifier gain multiplier. The default is <1>. + Amplifier gain multiplier. The default is <1>. The maximum value is <65535>. sense-gain-div: type: int default: 1 description: | - Amplifier gain divider. The default is <1>. + Amplifier gain divider. The default is <1>. The maximum value is <65535>. power-gpios: type: phandle-array diff --git a/include/zephyr/drivers/adc/current_sense_amplifier.h b/include/zephyr/drivers/adc/current_sense_amplifier.h index fd55f300faed8..05c9a98d15843 100644 --- a/include/zephyr/drivers/adc/current_sense_amplifier.h +++ b/include/zephyr/drivers/adc/current_sense_amplifier.h @@ -13,8 +13,8 @@ struct current_sense_amplifier_dt_spec { const struct adc_dt_spec port; uint32_t sense_milli_ohms; - uint32_t sense_gain_mult; - uint32_t sense_gain_div; + uint16_t sense_gain_mult; + uint16_t sense_gain_div; struct gpio_dt_spec power_gpio; }; @@ -51,8 +51,10 @@ current_sense_amplifier_scale_dt(const struct current_sense_amplifier_dt_spec *s /* store in a temporary 64 bit variable to prevent overflow during calculation */ int64_t tmp = *v_to_i; - /* multiplies by 1,000 before dividing by sense resistance in milli-ohms. */ - tmp = tmp * 1000 / spec->sense_milli_ohms * spec->sense_gain_div / spec->sense_gain_mult; + /* (INT32_MAX * 1000 * UINT16_MAX) < INT64_MAX + * Therefore all multiplications can be done before divisions, preserving resolution. + */ + tmp = tmp * 1000 * spec->sense_gain_div / spec->sense_milli_ohms / spec->sense_gain_mult; *v_to_i = (int32_t)tmp; } From 609520bf3fbf5fa20a4941eb253b1eb6903e60ad Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Thu, 10 Oct 2024 13:15:32 +0530 Subject: [PATCH 0730/4482] modules: hostap: Add config options for EAP types Enabling all EAP types for enterprise mode increases memory usage in both ROM and RAM. Provide config options for each type to let solutions choose the methods based on their requirements. Signed-off-by: Ravi Dondaputi --- modules/hostap/CMakeLists.txt | 133 +++++++++++++++++++++++++++------ modules/hostap/Kconfig | 50 +++++++++++++ modules/hostap/src/supp_main.h | 30 ++++++++ 3 files changed, 191 insertions(+), 22 deletions(-) diff --git a/modules/hostap/CMakeLists.txt b/modules/hostap/CMakeLists.txt index 6b6875d9a8fc6..7369e1ba6202e 100644 --- a/modules/hostap/CMakeLists.txt +++ b/modules/hostap/CMakeLists.txt @@ -324,68 +324,157 @@ zephyr_library_compile_definitions_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_WPS ) zephyr_library_sources_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE + ${HOSTAP_SRC_BASE}/eap_common/eap_common.c +) + +zephyr_library_compile_definitions_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE + IEEE8021X_EAPOL + EAP_IKEv2 +) + +zephyr_library_sources_ifdef(CONFIG_EAP_TLS ${HOSTAP_SRC_BASE}/eap_peer/eap_tls.c ${HOSTAP_SRC_BASE}/eap_peer/eap_tls_common.c - ${HOSTAP_SRC_BASE}/eap_common/eap_common.c +) + +zephyr_library_compile_definitions_ifdef(CONFIG_EAP_TLS + EAP_TLS +) + +zephyr_library_sources_ifdef(CONFIG_EAP_TTLS + ${HOSTAP_SRC_BASE}/eap_peer/eap_ttls.c +) + +zephyr_library_compile_definitions_ifdef(CONFIG_EAP_TTLS + EAP_TTLS +) +zephyr_library_sources_ifdef(CONFIG_EAP_PEAP ${HOSTAP_SRC_BASE}/eap_peer/eap_peap.c ${HOSTAP_SRC_BASE}/eap_common/eap_peap_common.c - ${HOSTAP_SRC_BASE}/eap_peer/eap_ttls.c +) + +zephyr_library_compile_definitions_ifdef(CONFIG_EAP_PEAP + EAP_PEAP +) + +zephyr_library_sources_ifdef(CONFIG_EAP_MD5 ${HOSTAP_SRC_BASE}/eap_peer/eap_md5.c +) + +zephyr_library_compile_definitions_ifdef(CONFIG_EAP_MD5 + EAP_MD5 +) + +zephyr_library_sources_ifdef(CONFIG_EAP_MSCHAPV2 ${HOSTAP_SRC_BASE}/eap_peer/eap_mschapv2.c - ${HOSTAP_SRC_BASE}/eap_common/chap.c ${HOSTAP_SRC_BASE}/eap_peer/mschapv2.c + ${HOSTAP_SRC_BASE}/eap_common/chap.c +) + +zephyr_library_compile_definitions_ifdef(CONFIG_EAP_MSCHAPV2 + EAP_MSCHAPv2 +) + +zephyr_library_sources_ifdef(CONFIG_EAP_LEAP ${HOSTAP_SRC_BASE}/eap_peer/eap_leap.c +) +zephyr_library_compile_definitions_ifdef(CONFIG_EAP_LEAP + EAP_LEAP +) + +zephyr_library_sources_ifdef(CONFIG_EAP_PSK ${HOSTAP_SRC_BASE}/eap_peer/eap_psk.c ${HOSTAP_SRC_BASE}/eap_common/eap_psk_common.c +) - ${HOSTAP_SRC_BASE}/eap_peer/eap_fast.c - ${HOSTAP_SRC_BASE}/eap_peer/eap_fast_pac.c - ${HOSTAP_SRC_BASE}/eap_common/eap_fast_common.c +zephyr_library_compile_definitions_ifdef(CONFIG_EAP_PSK + EAP_PSK +) +zephyr_library_sources_ifdef(CONFIG_EAP_PAX ${HOSTAP_SRC_BASE}/eap_peer/eap_pax.c ${HOSTAP_SRC_BASE}/eap_common/eap_pax_common.c +) +zephyr_library_compile_definitions_ifdef(CONFIG_EAP_PAX + EAP_PAX +) + +zephyr_library_sources_ifdef(CONFIG_EAP_SAKE ${HOSTAP_SRC_BASE}/eap_peer/eap_sake.c ${HOSTAP_SRC_BASE}/eap_common/eap_sake_common.c +) +zephyr_library_compile_definitions_ifdef(CONFIG_EAP_SAKE + EAP_SAKE +) + +zephyr_library_sources_ifdef(CONFIG_EAP_GPSK ${HOSTAP_SRC_BASE}/eap_peer/eap_gpsk.c ${HOSTAP_SRC_BASE}/eap_common/eap_gpsk_common.c +) + +zephyr_library_compile_definitions_ifdef(CONFIG_EAP_GPSK + EAP_GPSK +) +zephyr_library_sources_ifdef(CONFIG_EAP_PWD ${HOSTAP_SRC_BASE}/eap_peer/eap_pwd.c ${HOSTAP_SRC_BASE}/eap_common/eap_pwd_common.c +) + +zephyr_library_compile_definitions_ifdef(CONFIG_EAP_PWD + EAP_PWD +) +zephyr_library_sources_ifdef(CONFIG_EAP_EKE ${HOSTAP_SRC_BASE}/eap_peer/eap_eke.c ${HOSTAP_SRC_BASE}/eap_common/eap_eke_common.c +) +zephyr_library_compile_definitions_ifdef(CONFIG_EAP_EKE + EAP_EKE +) + +zephyr_library_sources_ifdef(CONFIG_EAP_IKEV2 ${HOSTAP_SRC_BASE}/eap_peer/eap_ikev2.c ${HOSTAP_SRC_BASE}/eap_peer/ikev2.c ${HOSTAP_SRC_BASE}/eap_common/eap_ikev2_common.c ${HOSTAP_SRC_BASE}/eap_common/ikev2_common.c +) + +zephyr_library_compile_definitions_ifdef(CONFIG_EAP_IKEV2 + EAP_IKEV2 +) +zephyr_library_sources_ifdef(CONFIG_EAP_SIM ${HOSTAP_SRC_BASE}/eap_peer/eap_sim.c ${HOSTAP_SRC_BASE}/eap_common/eap_sim_common.c +) + +zephyr_library_compile_definitions_ifdef(CONFIG_EAP_SIM + EAP_SIM +) +zephyr_library_sources_ifdef(CONFIG_EAP_AKA ${HOSTAP_SRC_BASE}/eap_peer/eap_aka.c ) -zephyr_library_compile_definitions_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE - EAP_TLS - IEEE8021X_EAPOL - EAP_PEAP - EAP_TTLS - EAP_MD5 - EAP_MSCHAPv2 - EAP_LEAP - EAP_PSK - EAP_FAST - EAP_PAX - EAP_SAKE - EAP_GPSK - EAP_PWD - EAP_EKE - EAP_IKEv2 +zephyr_library_compile_definitions_ifdef(CONFIG_EAP_AKA + EAP_AKA +) + +# Needs TLS1.3 and SESSION_TICKETS +zephyr_library_sources_ifdef(CONFIG_EAP_FAST + ${HOSTAP_SRC_BASE}/eap_peer/eap_fast.c + ${HOSTAP_SRC_BASE}/eap_peer/eap_fast_pac.c + ${HOSTAP_SRC_BASE}/eap_common/eap_fast_common.c +) + +zephyr_library_compile_definitions_ifdef(CONFIG_EAP_FAST + EAP_FAST ) zephyr_library_compile_definitions_ifndef(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index e1417e14e0218..01574cfc60c8d 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -178,6 +178,56 @@ config WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE select MBEDTLS_PEM_CERTIFICATE_FORMAT depends on !WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE +config EAP_TLS + bool "EAP-TLS support" + +config EAP_TTLS + bool "EAP-TTLS support" + +config EAP_PEAP + bool "EAP-PEAP support" + +config EAP_MD5 + bool "EAP-MD5 support" + +config EAP_MSCHAPV2 + bool "EAP-MSCHAPv2 support" + +config EAP_LEAP + bool "EAP-LEAP support" + +config EAP_PSK + bool "EAP-PSK support" + +config EAP_PAX + bool "EAP-PAX support" + +config EAP_SAKE + bool "EAP-SAKE support" + +config EAP_GPSK + bool "EAP-GPSK support" + +config EAP_PWD + bool "EAP-PWD support" + +config EAP_EKE + bool "EAP-EKE support" + +config EAP_IKEV2 + bool "EAP-IKEv2 support" + +config EAP_SIM + bool "EAP-SIM support" + +config EAP_AKA + bool "EAP-AKA support" + +config EAP_ALL + bool "All EAP methods support" + select EAP_TLS + default y if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE + config WIFI_NM_WPA_SUPPLICANT_WPA3 bool "WPA3 support" depends on !WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE diff --git a/modules/hostap/src/supp_main.h b/modules/hostap/src/supp_main.h index 03f7461555e49..7137d28192941 100644 --- a/modules/hostap/src/supp_main.h +++ b/modules/hostap/src/supp_main.h @@ -6,6 +6,36 @@ #ifndef __SUPP_MAIN_H_ #define __SUPP_MAIN_H_ +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE +/* At least one of the EAP methods need to be enabled in enterprise mode */ +#if !defined(CONFIG_EAP_TLS) && !defined(CONFIG_EAP_TTLS) && \ + !defined(CONFIG_EAP_PEAP) && !defined(CONFIG_EAP_FAST) && \ + !defined(CONFIG_EAP_SIM) && !defined(CONFIG_EAP_AKA) && \ + !defined(CONFIG_EAP_MD5) && !defined(CONFIG_EAP_MSCHAPV2) && \ + !defined(CONFIG_EAP_PSK) && !defined(CONFIG_EAP_PAX) && \ + !defined(CONFIG_EAP_SAKE) && !defined(CONFIG_EAP_GPSK) && \ + !defined(CONFIG_EAP_PWD) && !defined(CONFIG_EAP_EKE) && \ + !defined(CONFIG_EAP_IKEV2) +#error "At least one of the following EAP methods need to be defined \ + CONFIG_EAP_TLS \ + CONFIG_EAP_TTLS \ + CONFIG_EAP_PEAP \ + CONFIG_EAP_MD5 \ + CONFIG_EAP_MSCHAPV2 \ + CONFIG_EAP_LEAP \ + CONFIG_EAP_PSK \ + CONFIG_EAP_PAX \ + CONFIG_EAP_SAKE \ + CONFIG_EAP_GPSK \ + CONFIG_EAP_PWD \ + CONFIG_EAP_EKE \ + CONFIG_EAP_IKEV2 \ + CONFIG_EAP_SIM \ + CONFIG_EAP_AKA \ + CONFIG_EAP_ALL " +#endif /* EAP METHODS */ +#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ + #if !defined(CONFIG_NET_DHCPV4) static inline void net_dhcpv4_start(struct net_if *iface) { From a131e85a940fa03352dec858368ba57fa730169d Mon Sep 17 00:00:00 2001 From: Lukasz Maciejonczyk Date: Thu, 10 Oct 2024 12:05:37 +0200 Subject: [PATCH 0731/4482] kconfig: openthread: Add OPENTHREAD_CLI_VENDOR_EXTENSION option This commit introduces a new option, OPENTHREAD_CLI_VENDOR_EXTENSION, in the Zephyr OpenThread module to map the upstream option OT_CLI_VENDOR_EXTENSION. OPENTHREAD_CLI_VENDOR_EXTENSION option specifies the path to a CMake file that defines and links the CLI vendor extension. By setting this option, it enables the addition of vendor-specific commands to the OpenThread CLI interface. Signed-off-by: Lukasz Maciejonczyk --- modules/openthread/CMakeLists.txt | 4 ++++ modules/openthread/Kconfig.features | 3 +++ 2 files changed, 7 insertions(+) diff --git a/modules/openthread/CMakeLists.txt b/modules/openthread/CMakeLists.txt index 6bf3936718ac0..977b7e5921f1e 100644 --- a/modules/openthread/CMakeLists.txt +++ b/modules/openthread/CMakeLists.txt @@ -137,6 +137,10 @@ if(CONFIG_OPENTHREAD_POWER_SUPPLY) set(OT_POWER_SUPPLY ${CONFIG_OPENTHREAD_POWER_SUPPLY} CACHE STRING "Power supply configuration" FORCE) endif() +if (CONFIG_OPENTHREAD_CLI_VENDOR_EXTENSION) + set(OT_CLI_VENDOR_EXTENSION ${CONFIG_OPENTHREAD_CLI_VENDOR_EXTENSION} CACHE STRING "Path to CMake file to define and link Openthread CLI vendor extension" FORCE) +endif() + set(BUILD_TESTING OFF CACHE BOOL "Disable openthread cmake testing targets" FORCE) # Zephyr logging options diff --git a/modules/openthread/Kconfig.features b/modules/openthread/Kconfig.features index ccdd3236d384a..f4cbfb3551a2a 100644 --- a/modules/openthread/Kconfig.features +++ b/modules/openthread/Kconfig.features @@ -389,3 +389,6 @@ config OPENTHREAD_UPTIME config OPENTHREAD_VERHOEFF_CHECKSUM bool "Verhoeff checksum" + +config OPENTHREAD_CLI_VENDOR_EXTENSION + string "Path to CMake file to define and link Openthread CLI vendor extension" From 52540d8412630edb2c64f4fcca1c1165bcce1ac3 Mon Sep 17 00:00:00 2001 From: Daniel Mangum Date: Fri, 11 Oct 2024 08:46:23 -0400 Subject: [PATCH 0732/4482] net: fix note about source address in net_context Removes extraneous word in note on net_context struct describing why the source address is not stored directly in struct. Signed-off-by: Daniel Mangum --- include/zephyr/net/net_context.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/net/net_context.h b/include/zephyr/net/net_context.h index 48536b3c4d57b..430c1164f4047 100644 --- a/include/zephyr/net/net_context.h +++ b/include/zephyr/net/net_context.h @@ -200,7 +200,7 @@ struct net_conn_handle; /** * Note that we do not store the actual source IP address in the context - * because the address is already be set in the network interface struct. + * because the address is already set in the network interface struct. * If there is no such source address there, the packet cannot be sent * anyway. This saves 12 bytes / context in IPv6. */ From 62c62da1ba817a6c566d7efaddbfd369c1be498d Mon Sep 17 00:00:00 2001 From: Lucien Zhao Date: Sat, 31 Aug 2024 23:17:35 +0800 Subject: [PATCH 0733/4482] dts: arm: nxp: rt118x: add qtmr instances update driver clock to adapt qtmr clock structure add 8 qtmr instances Signed-off-by: Lucien Zhao --- .../clock_control_mcux_ccm_rev2.c | 10 +- dts/arm/nxp/nxp_rt118x.dtsi | 216 ++++++++++++++++++ 2 files changed, 224 insertions(+), 2 deletions(-) diff --git a/drivers/clock_control/clock_control_mcux_ccm_rev2.c b/drivers/clock_control/clock_control_mcux_ccm_rev2.c index db2a4454060a6..94a634afcaba2 100644 --- a/drivers/clock_control/clock_control_mcux_ccm_rev2.c +++ b/drivers/clock_control/clock_control_mcux_ccm_rev2.c @@ -187,14 +187,20 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev, break; #endif -#ifdef CONFIG_PWM_MCUX_QTMR +#if defined(CONFIG_PWM_MCUX_QTMR) || defined(CONFIG_COUNTER_MCUX_QTMR) +#if defined(CONFIG_SOC_SERIES_IMXRT118X) + case IMX_CCM_QTMR_CLK: + clock_root = kCLOCK_Root_Bus_Aon; + break; +#else case IMX_CCM_QTMR1_CLK: case IMX_CCM_QTMR2_CLK: case IMX_CCM_QTMR3_CLK: case IMX_CCM_QTMR4_CLK: clock_root = kCLOCK_Root_Bus; break; -#endif +#endif /* CONFIG_SOC_SERIES_IMXRT118X */ +#endif /* CONFIG_PWM_MCUX_QTMR || CONFIG_COUNTER_MCUX_QTMR */ #ifdef CONFIG_MEMC_MCUX_FLEXSPI case IMX_CCM_FLEXSPI_CLK: diff --git a/dts/arm/nxp/nxp_rt118x.dtsi b/dts/arm/nxp/nxp_rt118x.dtsi index 6fd22a09be6db..e48a7d32b4efe 100644 --- a/dts/arm/nxp/nxp_rt118x.dtsi +++ b/dts/arm/nxp/nxp_rt118x.dtsi @@ -354,6 +354,222 @@ #io-channel-cells = <1>; clocks = <&ccm IMX_CCM_LPADC2_CLK 0 0>; }; + + qtmr1: qtmr@2690000 { + compatible = "nxp,imx-qtmr"; + reg = <0x2690000 0x4000>; + interrupts = <0 0>; + clocks = <&ccm IMX_CCM_QTMR_CLK 0x0 0>; + qtmr1_timer0: timer0 { + compatible = "nxp,imx-tmr"; + channel = <0>; + status = "disabled"; + }; + qtmr1_timer1: timer1 { + compatible = "nxp,imx-tmr"; + channel = <1>; + status = "disabled"; + }; + qtmr1_timer2: timer2 { + compatible = "nxp,imx-tmr"; + channel = <2>; + status = "disabled"; + }; + qtmr1_timer3: timer3 { + compatible = "nxp,imx-tmr"; + channel = <3>; + status = "disabled"; + }; + }; + + qtmr2: qtmr@26a0000 { + compatible = "nxp,imx-qtmr"; + reg = <0x26a0000 0x4000>; + interrupts = <233 0>; + clocks = <&ccm IMX_CCM_QTMR_CLK 0x0 0>; + qtmr2_timer0: timer0 { + compatible = "nxp,imx-tmr"; + channel = <0>; + status = "disabled"; + }; + qtmr2_timer1: timer1 { + compatible = "nxp,imx-tmr"; + channel = <1>; + status = "disabled"; + }; + qtmr2_timer2: timer2 { + compatible = "nxp,imx-tmr"; + channel = <2>; + status = "disabled"; + }; + qtmr2_timer3: timer3 { + compatible = "nxp,imx-tmr"; + channel = <3>; + status = "disabled"; + }; + }; + + qtmr3: qtmr@26b0000 { + compatible = "nxp,imx-qtmr"; + reg = <0x26b0000 0x4000>; + interrupts = <164 0>; + clocks = <&ccm IMX_CCM_QTMR_CLK 0x0 0>; + qtmr3_timer0: timer0 { + compatible = "nxp,imx-tmr"; + channel = <0>; + status = "disabled"; + }; + qtmr3_timer1: timer1 { + compatible = "nxp,imx-tmr"; + channel = <1>; + status = "disabled"; + }; + qtmr3_timer2: timer2 { + compatible = "nxp,imx-tmr"; + channel = <2>; + status = "disabled"; + }; + qtmr3_timer3: timer3 { + compatible = "nxp,imx-tmr"; + channel = <3>; + status = "disabled"; + }; + }; + + qtmr4: qtmr@26c0000 { + compatible = "nxp,imx-qtmr"; + reg = <0x26c0000 0x4000>; + interrupts = <151 0>; + clocks = <&ccm IMX_CCM_QTMR_CLK 0x0 0>; + qtmr4_timer0: timer0 { + compatible = "nxp,imx-tmr"; + channel = <0>; + status = "disabled"; + }; + qtmr4_timer1: timer1 { + compatible = "nxp,imx-tmr"; + channel = <1>; + status = "disabled"; + }; + qtmr4_timer2: timer2 { + compatible = "nxp,imx-tmr"; + channel = <2>; + status = "disabled"; + }; + qtmr4_timer3: timer3 { + compatible = "nxp,imx-tmr"; + channel = <3>; + status = "disabled"; + }; + }; + + qtmr5: qtmr@26d0000 { + compatible = "nxp,imx-qtmr"; + reg = <0x26d0000 0x4000>; + interrupts = <4 0>; + clocks = <&ccm IMX_CCM_QTMR_CLK 0x0 0>; + qtmr5_timer0: timer0 { + compatible = "nxp,imx-tmr"; + channel = <0>; + status = "disabled"; + }; + qtmr5_timer1: timer1 { + compatible = "nxp,imx-tmr"; + channel = <1>; + status = "disabled"; + }; + qtmr5_timer2: timer2 { + compatible = "nxp,imx-tmr"; + channel = <2>; + status = "disabled"; + }; + qtmr5_timer3: timer3 { + compatible = "nxp,imx-tmr"; + channel = <3>; + status = "disabled"; + }; + }; + + qtmr6: qtmr@26e0000 { + compatible = "nxp,imx-qtmr"; + reg = <0x26e0000 0x4000>; + interrupts = <5 0>; + clocks = <&ccm IMX_CCM_QTMR_CLK 0x0 0>; + qtmr6_timer0: timer0 { + compatible = "nxp,imx-tmr"; + channel = <0>; + status = "disabled"; + }; + qtmr6_timer1: timer1 { + compatible = "nxp,imx-tmr"; + channel = <1>; + status = "disabled"; + }; + qtmr6_timer2: timer2 { + compatible = "nxp,imx-tmr"; + channel = <2>; + status = "disabled"; + }; + qtmr6_timer3: timer3 { + compatible = "nxp,imx-tmr"; + channel = <3>; + status = "disabled"; + }; + }; + + qtmr7: qtmr@26f0000 { + compatible = "nxp,imx-qtmr"; + reg = <0x26f0000 0x4000>; + interrupts = <6 0>; + clocks = <&ccm IMX_CCM_QTMR_CLK 0x0 0>; + qtmr7_timer0: timer0 { + compatible = "nxp,imx-tmr"; + channel = <0>; + status = "disabled"; + }; + qtmr7_timer1: timer1 { + compatible = "nxp,imx-tmr"; + channel = <1>; + status = "disabled"; + }; + qtmr7_timer2: timer2 { + compatible = "nxp,imx-tmr"; + channel = <2>; + status = "disabled"; + }; + qtmr7_timer3: timer3 { + compatible = "nxp,imx-tmr"; + channel = <3>; + status = "disabled"; + }; + }; + + qtmr8: qtmr@2700000 { + compatible = "nxp,imx-qtmr"; + reg = <0x2700000 0x4000>; + interrupts = <7 0>; + clocks = <&ccm IMX_CCM_QTMR_CLK 0x0 0>; + qtmr8_timer0: timer0 { + compatible = "nxp,imx-tmr"; + channel = <0>; + status = "disabled"; + }; + qtmr8_timer1: timer1 { + compatible = "nxp,imx-tmr"; + channel = <1>; + status = "disabled"; + }; + qtmr8_timer2: timer2 { + compatible = "nxp,imx-tmr"; + channel = <2>; + status = "disabled"; + }; + qtmr8_timer3: timer3 { + compatible = "nxp,imx-tmr"; + channel = <3>; + status = "disabled"; + }; + }; }; &flexspi1 { From 4db46a333175dbb32c36028fc8d0269dbe20429d Mon Sep 17 00:00:00 2001 From: Lucien Zhao Date: Sat, 31 Aug 2024 23:19:52 +0800 Subject: [PATCH 0734/4482] tests: drivers: counter_basic_api: add qtmr1_timer0 configuration add qtmr1_timer0 configuration for counter_basic_api case Signed-off-by: Lucien Zhao --- .../boards/mimxrt1180_evk_mimxrt1189_cm33.conf | 6 ++++++ .../boards/mimxrt1180_evk_mimxrt1189_cm33.overlay | 11 +++++++++++ .../boards/mimxrt1180_evk_mimxrt1189_cm7.conf | 6 ++++++ .../boards/mimxrt1180_evk_mimxrt1189_cm7.overlay | 11 +++++++++++ 4 files changed, 34 insertions(+) create mode 100644 tests/drivers/counter/counter_basic_api/boards/mimxrt1180_evk_mimxrt1189_cm33.conf create mode 100644 tests/drivers/counter/counter_basic_api/boards/mimxrt1180_evk_mimxrt1189_cm33.overlay create mode 100644 tests/drivers/counter/counter_basic_api/boards/mimxrt1180_evk_mimxrt1189_cm7.conf create mode 100644 tests/drivers/counter/counter_basic_api/boards/mimxrt1180_evk_mimxrt1189_cm7.overlay diff --git a/tests/drivers/counter/counter_basic_api/boards/mimxrt1180_evk_mimxrt1189_cm33.conf b/tests/drivers/counter/counter_basic_api/boards/mimxrt1180_evk_mimxrt1189_cm33.conf new file mode 100644 index 0000000000000..c003559e92b26 --- /dev/null +++ b/tests/drivers/counter/counter_basic_api/boards/mimxrt1180_evk_mimxrt1189_cm33.conf @@ -0,0 +1,6 @@ +# +# Copyright 2024 NXP +# +# SPDX-License-Identifier: Apache-2.0 +# +CONFIG_COUNTER_MCUX_QTMR=y diff --git a/tests/drivers/counter/counter_basic_api/boards/mimxrt1180_evk_mimxrt1189_cm33.overlay b/tests/drivers/counter/counter_basic_api/boards/mimxrt1180_evk_mimxrt1189_cm33.overlay new file mode 100644 index 0000000000000..e494bb84055a3 --- /dev/null +++ b/tests/drivers/counter/counter_basic_api/boards/mimxrt1180_evk_mimxrt1189_cm33.overlay @@ -0,0 +1,11 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&qtmr1_timer0 { + status = "okay"; + primary_source = "kQTMR_ClockDivide_128"; + mode = "kQTMR_PriSrcRiseEdge"; +}; diff --git a/tests/drivers/counter/counter_basic_api/boards/mimxrt1180_evk_mimxrt1189_cm7.conf b/tests/drivers/counter/counter_basic_api/boards/mimxrt1180_evk_mimxrt1189_cm7.conf new file mode 100644 index 0000000000000..c003559e92b26 --- /dev/null +++ b/tests/drivers/counter/counter_basic_api/boards/mimxrt1180_evk_mimxrt1189_cm7.conf @@ -0,0 +1,6 @@ +# +# Copyright 2024 NXP +# +# SPDX-License-Identifier: Apache-2.0 +# +CONFIG_COUNTER_MCUX_QTMR=y diff --git a/tests/drivers/counter/counter_basic_api/boards/mimxrt1180_evk_mimxrt1189_cm7.overlay b/tests/drivers/counter/counter_basic_api/boards/mimxrt1180_evk_mimxrt1189_cm7.overlay new file mode 100644 index 0000000000000..e494bb84055a3 --- /dev/null +++ b/tests/drivers/counter/counter_basic_api/boards/mimxrt1180_evk_mimxrt1189_cm7.overlay @@ -0,0 +1,11 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&qtmr1_timer0 { + status = "okay"; + primary_source = "kQTMR_ClockDivide_128"; + mode = "kQTMR_PriSrcRiseEdge"; +}; From 1a89e1640c1464340dfb1d652fdf9c02130b482c Mon Sep 17 00:00:00 2001 From: Lucien Zhao Date: Thu, 10 Oct 2024 16:05:53 +0800 Subject: [PATCH 0735/4482] boards: nxp: mimxrt1180_evk: add qtmr description in doc support qtmr interface as counter function Signed-off-by: Lucien Zhao --- boards/nxp/mimxrt1180_evk/doc/index.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boards/nxp/mimxrt1180_evk/doc/index.rst b/boards/nxp/mimxrt1180_evk/doc/index.rst index a9328da410a85..5aaeb3b0a285e 100644 --- a/boards/nxp/mimxrt1180_evk/doc/index.rst +++ b/boards/nxp/mimxrt1180_evk/doc/index.rst @@ -102,6 +102,8 @@ configuration supports the following hardware features: +-----------+------------+-------------------------------------+ | GPT | on-chip | counter | +-----------+------------+-------------------------------------+ +| QTMR | on-chip | counter | ++-----------+------------+-------------------------------------+ | UART | on-chip | serial port-polling; | | | | serial port-interrupt | +-----------+------------+-------------------------------------+ From 45720f8b8c3edcee71a2c84404f107f0274f624c Mon Sep 17 00:00:00 2001 From: Michal Smola Date: Thu, 3 Oct 2024 12:55:47 +0200 Subject: [PATCH 0736/4482] boards: frdm_mcxc242: Add uart support Board frdm_mcxc242 does not have UART IP configured. Add UART configuration and pin control. Set state to disabled, as it serves as alternative to default LPUART0 or as second uart only. Add uart to supported features in yaml. Signed-off-by: Michal Smola --- boards/nxp/frdm_mcxc242/frdm_mcxc242-pinctrl.dtsi | 8 ++++++++ boards/nxp/frdm_mcxc242/frdm_mcxc242.dts | 7 +++++++ boards/nxp/frdm_mcxc242/frdm_mcxc242.yaml | 1 + 3 files changed, 16 insertions(+) diff --git a/boards/nxp/frdm_mcxc242/frdm_mcxc242-pinctrl.dtsi b/boards/nxp/frdm_mcxc242/frdm_mcxc242-pinctrl.dtsi index a9e8003bfb9bd..2e8908e954e32 100644 --- a/boards/nxp/frdm_mcxc242/frdm_mcxc242-pinctrl.dtsi +++ b/boards/nxp/frdm_mcxc242/frdm_mcxc242-pinctrl.dtsi @@ -16,6 +16,14 @@ slew-rate = "slow"; }; }; + pinmux_uart2: pinmux_uart2 { + group0 { + pinmux = , + ; + drive-strength = "low"; + slew-rate = "slow"; + }; + }; pinmux_i2c1: pinmux_i2c1 { group0 { pinmux = , diff --git a/boards/nxp/frdm_mcxc242/frdm_mcxc242.dts b/boards/nxp/frdm_mcxc242/frdm_mcxc242.dts index ea7b4e0e7ca74..3f0bb0f5956ef 100644 --- a/boards/nxp/frdm_mcxc242/frdm_mcxc242.dts +++ b/boards/nxp/frdm_mcxc242/frdm_mcxc242.dts @@ -122,6 +122,13 @@ pinctrl-names = "default"; }; +&uart2 { + status = "disabled"; + current-speed = <115200>; + pinctrl-0 = <&pinmux_uart2>; + pinctrl-names = "default"; +}; + i2c1: &i2c1 { status = "okay"; pinctrl-0 = <&pinmux_i2c1>; diff --git a/boards/nxp/frdm_mcxc242/frdm_mcxc242.yaml b/boards/nxp/frdm_mcxc242/frdm_mcxc242.yaml index 1d2d4e9562fa1..49dc9c741cb22 100644 --- a/boards/nxp/frdm_mcxc242/frdm_mcxc242.yaml +++ b/boards/nxp/frdm_mcxc242/frdm_mcxc242.yaml @@ -16,6 +16,7 @@ toolchain: - xtools supported: - gpio + - uart - i2c - pwm - adc From 1635d77c751e724dc1cdd710b23f47639dd3561b Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Fri, 11 Oct 2024 23:20:37 +0200 Subject: [PATCH 0737/4482] MAINTAINERS.yml: patch comparator drivers area The comparator drivers area contains the following incorrect area: files: - include/zephyr/dt-bindings/clock/ and contains the following duplicate area: files: - include/zephyr/drivers/comparator/ this commit removes them. Signed-off-by: Bjarki Arge Andreasen --- MAINTAINERS.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 123ef1f2afd7e..86b506c8154f3 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -1160,8 +1160,6 @@ Release Notes: - dts/bindings/comparator/ - include/zephyr/drivers/comparator.h - include/zephyr/drivers/comparator/ - - include/zephyr/drivers/comparator/ - - include/zephyr/dt-bindings/clock/ - tests/drivers/build_all/comparator/ - tests/drivers/comparator/ - doc/hardware/peripherals/comparator.rst From f4f1b1a365699f64dabf30aeb90a9263bb5f6d60 Mon Sep 17 00:00:00 2001 From: Guillaume Gautier Date: Fri, 11 Oct 2024 09:27:36 +0200 Subject: [PATCH 0738/4482] drivers: adc: stm32: fix clock check for stm32f1 STM32F1 doesn't have synchronous/asynchronous source clock choice. The recently added clock check was failing compilation for these series. This commit removes the check for F1. Signed-off-by: Guillaume Gautier --- drivers/adc/adc_stm32.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/adc/adc_stm32.c b/drivers/adc/adc_stm32.c index 6d0765c43f00a..81e44ccab2fec 100644 --- a/drivers/adc/adc_stm32.c +++ b/drivers/adc/adc_stm32.c @@ -1754,15 +1754,16 @@ static const struct adc_driver_api api_stm32_driver_api = { /* Concat prefix (1st element) and DIV value (2nd element) of st,adc-prescaler */ #if DT_HAS_COMPAT_STATUS_OKAY(st_stm32f1_adc) #define ADC_STM32_DT_PRESC(x) 0 +#define ADC_STM32_CHECK_DT_CLOCK(x) #else #define ADC_STM32_DT_PRESC(x) \ _CONCAT(ADC_STM32_CLOCK_PREFIX(x), ADC_STM32_DIV(x)) -#endif - /* Macro to check if the ADC instance clock setup is correct */ #define ADC_STM32_CHECK_DT_CLOCK(x) \ BUILD_ASSERT(IS_EQ(ADC_STM32_CLOCK(x), SYNC) || (DT_INST_NUM_CLOCKS(x) > 1), \ "ASYNC clock mode defined without ASYNC clock defined in device tree") +#endif + #if defined(CONFIG_ADC_STM32_DMA) From 01f2740015fec36b1d9b000be95fd88ebb42edf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 11 Oct 2024 08:02:47 +0200 Subject: [PATCH 0739/4482] boards: nordic: Do not enable hw-flow-control on console MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Like in all other legacy boards, hw-flow-control should not be enabled for console UART. With hw-flow-control sample stuck during printing some initial information and sample appears to be not working correctly unless com port is opened. Signed-off-by: Krzysztof Chruściński --- boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 1 - boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts | 1 - boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 1 - boards/nordic/nrf54l15dk/nrf54l15_cpuapp_common.dtsi | 1 - boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuflpr.dts | 1 - boards/nordic/nrf54l15pdk/nrf54l15_cpuapp_common.dtsi | 1 - boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuflpr.dts | 1 - boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts | 1 - boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuppr.dts | 1 - boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts | 1 - 10 files changed, 10 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 04cb9608b3a0a..0ea427c72998c 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -252,7 +252,6 @@ ipc0: &cpuapp_cpurad_ipc { pinctrl-0 = <&uart136_default>; pinctrl-1 = <&uart136_sleep>; pinctrl-names = "default", "sleep"; - hw-flow-control; }; &gpio6 { diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts index 2143823239cb9..59b53aafcb2be 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr.dts @@ -48,7 +48,6 @@ pinctrl-0 = <&uart135_default>; pinctrl-1 = <&uart135_sleep>; pinctrl-names = "default", "sleep"; - hw-flow-control; }; &uart136 { diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index 31827405f5f76..9c7d9a221eef0 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -99,7 +99,6 @@ ipc0: &cpuapp_cpurad_ipc { pinctrl-0 = <&uart135_default>; pinctrl-1 = <&uart135_sleep>; pinctrl-names = "default", "sleep"; - hw-flow-control; }; &uart136 { diff --git a/boards/nordic/nrf54l15dk/nrf54l15_cpuapp_common.dtsi b/boards/nordic/nrf54l15dk/nrf54l15_cpuapp_common.dtsi index 4292e9a15232e..191babb632f6e 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15_cpuapp_common.dtsi +++ b/boards/nordic/nrf54l15dk/nrf54l15_cpuapp_common.dtsi @@ -87,7 +87,6 @@ &uart20 { status = "okay"; - hw-flow-control; }; &gpio0 { diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuflpr.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuflpr.dts index a608941514ecb..472e3f2b8d38b 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuflpr.dts +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuflpr.dts @@ -48,7 +48,6 @@ &uart30 { status = "okay"; - hw-flow-control; }; &gpio0 { diff --git a/boards/nordic/nrf54l15pdk/nrf54l15_cpuapp_common.dtsi b/boards/nordic/nrf54l15pdk/nrf54l15_cpuapp_common.dtsi index 1327d48f5bdfa..474874d110c0a 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15_cpuapp_common.dtsi +++ b/boards/nordic/nrf54l15pdk/nrf54l15_cpuapp_common.dtsi @@ -87,7 +87,6 @@ &uart20 { status = "okay"; - hw-flow-control; }; &gpio0 { diff --git a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuflpr.dts b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuflpr.dts index 2b80a45c4e1ba..c8ed4abb79fee 100644 --- a/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuflpr.dts +++ b/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuflpr.dts @@ -48,7 +48,6 @@ &uart30 { status = "okay"; - hw-flow-control; }; &gpio0 { diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts index 66d5dc81603de..6e94a4a34346a 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts @@ -248,7 +248,6 @@ ipc0: &cpuapp_cpurad_ipc { pinctrl-0 = <&uart136_default>; pinctrl-1 = <&uart136_sleep>; pinctrl-names = "default", "sleep"; - hw-flow-control; }; &gpio6 { diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuppr.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuppr.dts index 5da976ef70d07..10942796ff3b5 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuppr.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuppr.dts @@ -49,7 +49,6 @@ pinctrl-0 = <&uart135_default>; pinctrl-1 = <&uart135_sleep>; pinctrl-names = "default", "sleep"; - hw-flow-control; }; &uart136 { diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts index 1235f53df2b0a..4a9314c47eb80 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts @@ -104,7 +104,6 @@ ipc0: &cpuapp_cpurad_ipc { pinctrl-0 = <&uart135_default>; pinctrl-1 = <&uart135_sleep>; pinctrl-names = "default", "sleep"; - hw-flow-control; }; &uart136 { From 43897a4e60deb0c61d0936b7e63a44e229bd693f Mon Sep 17 00:00:00 2001 From: Dean Sellers Date: Fri, 11 Oct 2024 10:49:20 +1000 Subject: [PATCH 0740/4482] drivers: ethernet: enc28j60: Fix carrier on race on init If there is a carrier (cable plugged in) on device initialisation there is a race between the interrupt service and the L2 init. Signed-off-by: Dean Sellers --- drivers/ethernet/eth_enc28j60.c | 16 ++++++++++++++-- drivers/ethernet/eth_enc28j60_priv.h | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/ethernet/eth_enc28j60.c b/drivers/ethernet/eth_enc28j60.c index e362435b2b172..d6e2b36919825 100644 --- a/drivers/ethernet/eth_enc28j60.c +++ b/drivers/ethernet/eth_enc28j60.c @@ -713,7 +713,14 @@ static void eth_enc28j60_rx_thread(void *p1, void *p2, void *p3) eth_enc28j60_read_phy(dev, ENC28J60_PHY_PHSTAT2, &phstat2); if (phstat2 & ENC28J60_BIT_PHSTAT2_LSTAT) { LOG_INF("%s: Link up", dev->name); - net_eth_carrier_on(context->iface); + /* We may have been interrupted before L2 init complete + * If so flag that the carrier should be set on in init + */ + if (context->iface_initialized) { + net_eth_carrier_on(context->iface); + } else { + context->iface_carrier_on_init = true; + } } else { LOG_INF("%s: Link down", dev->name); @@ -751,7 +758,12 @@ static void eth_enc28j60_iface_init(struct net_if *iface) ethernet_init(iface); - net_if_carrier_off(iface); + /* The device may have already interrupted us to flag link UP */ + if (context->iface_carrier_on_init) { + net_if_carrier_on(iface); + } else { + net_if_carrier_off(iface); + } context->iface_initialized = true; } diff --git a/drivers/ethernet/eth_enc28j60_priv.h b/drivers/ethernet/eth_enc28j60_priv.h index 5e66990f5e140..f47efd601c230 100644 --- a/drivers/ethernet/eth_enc28j60_priv.h +++ b/drivers/ethernet/eth_enc28j60_priv.h @@ -240,6 +240,7 @@ struct eth_enc28j60_runtime { struct k_sem tx_rx_sem; struct k_sem int_sem; bool iface_initialized : 1; + bool iface_carrier_on_init : 1; }; #endif /*_ENC28J60_*/ From 89b73368766fa937ce56f17cf18e63cf64d77900 Mon Sep 17 00:00:00 2001 From: Nick Ward Date: Fri, 11 Oct 2024 11:07:39 +1100 Subject: [PATCH 0741/4482] net: openthread: make receive sensitivity configurable OpenThread route cost calculations are dependent on this being accurate for the hardware design. Signed-off-by: Nick Ward --- modules/openthread/Kconfig.thread | 7 +++++++ modules/openthread/platform/radio.c | 4 +--- tests/subsys/openthread/radio_stub.c | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/openthread/Kconfig.thread b/modules/openthread/Kconfig.thread index 22f11d5c606dd..8578ae7272956 100644 --- a/modules/openthread/Kconfig.thread +++ b/modules/openthread/Kconfig.thread @@ -175,6 +175,13 @@ config OPENTHREAD_MAC_STAY_AWAKE_BETWEEN_FRAGMENTS help This optimization is done at the expense of power consumption on SED/SSED devices. +config OPENTHREAD_DEFAULT_RX_SENSITIVITY + int "OpenThread default RX sensitivity in dBm" + range $(INT8_MIN) $(INT8_MAX) + default -100 + help + Set the default receive sensitivity [dBm] in radio driver. + config OPENTHREAD_DEFAULT_TX_POWER int "OpenThread default tx power in dBm" range -40 20 if NRF_802154_RADIO_DRIVER diff --git a/modules/openthread/platform/radio.c b/modules/openthread/platform/radio.c index 7e2943e734f80..3dc6a4bcc8f0d 100644 --- a/modules/openthread/platform/radio.c +++ b/modules/openthread/platform/radio.c @@ -69,8 +69,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME, CONFIG_OPENTHREAD_L2_LOG_LEVEL); */ #define PHR_DURATION_US 32U -#define DEFAULT_SENSITIVITY -100 - enum pending_events { PENDING_EVENT_FRAME_TO_SEND, /* There is a tx frame to send */ PENDING_EVENT_FRAME_RECEIVED, /* Radio has received new frame */ @@ -1173,7 +1171,7 @@ int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance) { ARG_UNUSED(aInstance); - return DEFAULT_SENSITIVITY; + return CONFIG_OPENTHREAD_DEFAULT_RX_SENSITIVITY; } otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower) diff --git a/tests/subsys/openthread/radio_stub.c b/tests/subsys/openthread/radio_stub.c index 79d61d5dbd050..eca072730cb2e 100644 --- a/tests/subsys/openthread/radio_stub.c +++ b/tests/subsys/openthread/radio_stub.c @@ -20,6 +20,7 @@ #define OT_WORKER_PRIORITY K_PRIO_COOP(CONFIG_OPENTHREAD_THREAD_PRIORITY) #define CONFIG_NET_L2_OPENTHREAD 1 #define CONFIG_OPENTHREAD_RADIO_WORKQUEUE_STACK_SIZE 512 +#define CONFIG_OPENTHREAD_DEFAULT_RX_SENSITIVITY -100 #define CONFIG_OPENTHREAD_DEFAULT_TX_POWER 0 /* file itself */ From cc415bc1398034bfb5980ce8f526e391f5cd8cc8 Mon Sep 17 00:00:00 2001 From: Peter Mitsis Date: Wed, 9 Oct 2024 15:36:48 -0700 Subject: [PATCH 0742/4482] kernel: Apply 'unlikely' attribute Applies the 'unlikely' attribute to various kernel objects that use z_unpend_first_thread() to optimize for the non-blocking path. This boosts the thread_metric synchronization benchmark numbers on the frdm_k64f board by about 10%. Signed-off-by: Peter Mitsis --- kernel/condvar.c | 2 +- kernel/mem_slab.c | 2 +- kernel/msg_q.c | 4 ++-- kernel/mutex.c | 2 +- kernel/queue.c | 2 +- kernel/sched.c | 2 +- kernel/sem.c | 4 ++-- kernel/stack.c | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/kernel/condvar.c b/kernel/condvar.c index b8d0df95341fc..615a6b30f15a7 100644 --- a/kernel/condvar.c +++ b/kernel/condvar.c @@ -49,7 +49,7 @@ int z_impl_k_condvar_signal(struct k_condvar *condvar) struct k_thread *thread = z_unpend_first_thread(&condvar->wait_q); - if (thread != NULL) { + if (unlikely(thread != NULL)) { SYS_PORT_TRACING_OBJ_FUNC_BLOCKING(k_condvar, signal, condvar, K_FOREVER); arch_thread_return_value_set(thread, 0); diff --git a/kernel/mem_slab.c b/kernel/mem_slab.c index 86aebe3834474..80710d063d915 100644 --- a/kernel/mem_slab.c +++ b/kernel/mem_slab.c @@ -275,7 +275,7 @@ void k_mem_slab_free(struct k_mem_slab *slab, void *mem) if ((slab->free_list == NULL) && IS_ENABLED(CONFIG_MULTITHREADING)) { struct k_thread *pending_thread = z_unpend_first_thread(&slab->wait_q); - if (pending_thread != NULL) { + if (unlikely(pending_thread != NULL)) { SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_mem_slab, free, slab); z_thread_return_value_set_with_data(pending_thread, 0, mem); diff --git a/kernel/msg_q.c b/kernel/msg_q.c index 0c461095c6b0d..9adfd9ae34f29 100644 --- a/kernel/msg_q.c +++ b/kernel/msg_q.c @@ -136,7 +136,7 @@ int z_impl_k_msgq_put(struct k_msgq *msgq, const void *data, k_timeout_t timeout if (msgq->used_msgs < msgq->max_msgs) { /* message queue isn't full */ pending_thread = z_unpend_first_thread(&msgq->wait_q); - if (pending_thread != NULL) { + if (unlikely(pending_thread != NULL)) { SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_msgq, put, msgq, timeout, 0); /* give message to waiting thread */ @@ -236,7 +236,7 @@ int z_impl_k_msgq_get(struct k_msgq *msgq, void *data, k_timeout_t timeout) /* handle first thread waiting to write (if any) */ pending_thread = z_unpend_first_thread(&msgq->wait_q); - if (pending_thread != NULL) { + if (unlikely(pending_thread != NULL)) { SYS_PORT_TRACING_OBJ_FUNC_BLOCKING(k_msgq, get, msgq, timeout); /* add thread's message to queue */ diff --git a/kernel/mutex.c b/kernel/mutex.c index d60b08c4e81ba..ce76e5a2af545 100644 --- a/kernel/mutex.c +++ b/kernel/mutex.c @@ -261,7 +261,7 @@ int z_impl_k_mutex_unlock(struct k_mutex *mutex) LOG_DBG("new owner of mutex %p: %p (prio: %d)", mutex, new_owner, new_owner ? new_owner->base.prio : -1000); - if (new_owner != NULL) { + if (unlikely(new_owner != NULL)) { /* * new owner is already of higher or equal prio than first * waiter since the wait queue is priority-based: no need to diff --git a/kernel/queue.c b/kernel/queue.c index a3c99d69e4062..4b00deeb1e757 100644 --- a/kernel/queue.c +++ b/kernel/queue.c @@ -133,7 +133,7 @@ static int32_t queue_insert(struct k_queue *queue, void *prev, void *data, } first_pending_thread = z_unpend_first_thread(&queue->wait_q); - if (first_pending_thread != NULL) { + if (unlikely(first_pending_thread != NULL)) { SYS_PORT_TRACING_OBJ_FUNC_BLOCKING(k_queue, queue_insert, queue, alloc, K_FOREVER); prepare_thread_to_run(first_pending_thread, data); diff --git a/kernel/sched.c b/kernel/sched.c index 291a231ad0353..f55b2f8a13b51 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -718,7 +718,7 @@ struct k_thread *z_unpend_first_thread(_wait_q_t *wait_q) K_SPINLOCK(&_sched_spinlock) { thread = _priq_wait_best(&wait_q->waitq); - if (thread != NULL) { + if (unlikely(thread != NULL)) { unpend_thread_no_timeout(thread); (void)z_abort_thread_timeout(thread); } diff --git a/kernel/sem.c b/kernel/sem.c index f2ae7a6cf78cb..58d8a86f1e979 100644 --- a/kernel/sem.c +++ b/kernel/sem.c @@ -103,7 +103,7 @@ void z_impl_k_sem_give(struct k_sem *sem) thread = z_unpend_first_thread(&sem->wait_q); - if (thread != NULL) { + if (unlikely(thread != NULL)) { arch_thread_return_value_set(thread, 0); z_ready_thread(thread); } else { @@ -111,7 +111,7 @@ void z_impl_k_sem_give(struct k_sem *sem) resched = handle_poll_events(sem); } - if (resched) { + if (unlikely(resched)) { z_reschedule(&lock, key); } else { k_spin_unlock(&lock, key); diff --git a/kernel/stack.c b/kernel/stack.c index e637cc3ba663b..5add38b9c2318 100644 --- a/kernel/stack.c +++ b/kernel/stack.c @@ -113,7 +113,7 @@ int z_impl_k_stack_push(struct k_stack *stack, stack_data_t data) first_pending_thread = z_unpend_first_thread(&stack->wait_q); - if (first_pending_thread != NULL) { + if (unlikely(first_pending_thread != NULL)) { z_thread_return_value_set_with_data(first_pending_thread, 0, (void *)data); From 8b859cea2d75ace9b3f5dd149041bf93b823d89e Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Thu, 10 Oct 2024 20:57:05 +0000 Subject: [PATCH 0743/4482] west: promote config_get*() functions from sign.py to the base class These two functions have stood the test of the time and they have absolutely nothing specific to sign.py This has the benefit of transitioning away from west's global and deprecated logging interface (https://github.com/zephyrproject-rtos/west/issues/149) and this deprecation is what prompted this commit: see #79240. Signed-off-by: Marc Herbert --- scripts/west_commands/sign.py | 23 +++------------------- scripts/west_commands/zephyr_ext_common.py | 14 +++++++++++++ 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/scripts/west_commands/sign.py b/scripts/west_commands/sign.py index 5efbfa5e73139..0b71e9b708b85 100644 --- a/scripts/west_commands/sign.py +++ b/scripts/west_commands/sign.py @@ -9,7 +9,6 @@ import pickle import platform import shutil -import shlex import subprocess import sys @@ -80,22 +79,6 @@ https://docs.zephyrproject.org/latest/develop/west/sign.html ''' - -def config_get_words(west_config, section_key, fallback=None): - unparsed = west_config.get(section_key) - log.dbg(f'west config {section_key}={unparsed}') - return fallback if unparsed is None else shlex.split(unparsed) - - -def config_get(west_config, section_key, fallback=None): - words = config_get_words(west_config, section_key) - if words is None: - return fallback - if len(words) != 1: - log.die(f'Single word expected for: {section_key}={words}. Use quotes?') - return words[0] - - class ToggleAction(argparse.Action): def __call__(self, parser, args, ignored, option): @@ -179,7 +162,7 @@ def do_run(self, args, ignored): build_conf = BuildConfiguration(build_dir) if not args.tool: - args.tool = config_get(self.config, 'sign.tool') + args.tool = self.config_get('sign.tool') # Decide on output formats. formats = [] @@ -507,7 +490,7 @@ def sign(self, command, build_dir, build_conf, formats): tool_path = ( args.tool_path if args.tool_path else - config_get(command.config, 'rimage.path', None) + self.command.config_get('rimage.path', None) ) err_prefix = '--tool-path' if args.tool_path else 'west config' @@ -572,7 +555,7 @@ def sign(self, command, build_dir, build_conf, formats): components = [ ] if bootloader is None else [ bootloader ] components += [ kernel ] - sign_config_extra_args = config_get_words(command.config, 'rimage.extra-args', []) + sign_config_extra_args = self.command.config_get_words('rimage.extra-args', []) if '-k' not in sign_config_extra_args + args.tool_args: # rimage requires a key argument even when it does not sign diff --git a/scripts/west_commands/zephyr_ext_common.py b/scripts/west_commands/zephyr_ext_common.py index 8403bab44a33d..d2d31a620d1b3 100644 --- a/scripts/west_commands/zephyr_ext_common.py +++ b/scripts/west_commands/zephyr_ext_common.py @@ -9,6 +9,7 @@ commands which specifically execute runners.''' import os +import shlex from pathlib import Path from west import log @@ -45,3 +46,16 @@ def check_force(self, cond, msg): if not (cond or self.args.force): log.err(msg) log.die('refusing to proceed without --force due to above error') + + def config_get_words(self, section_key, fallback=None): + unparsed = self.config.get(section_key) + self.dbg(f'west config {section_key}={unparsed}') + return fallback if unparsed is None else shlex.split(unparsed) + + def config_get(self, section_key, fallback=None): + words = self.config_get_words(section_key) + if words is None: + return fallback + if len(words) != 1: + self.die(f'Single word expected for: {section_key}={words}. Use quotes?') + return words[0] From 730b2f7c6957d528c17da94119430b6c283b2901 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 10 Oct 2024 22:05:21 +0200 Subject: [PATCH 0744/4482] Bluetooth: Tester: Force initial conn param to 30ms Modify the GAP connect to use 30ms. The default parameters typically ended up with 50ms which is OK in most cases, but for ISO related test cases, using an ACL interval that is a multiple of the ISO SDU interval (7.5/10ms) generally provides better stability. 30ms is the lowest multiple of both 7.5 and 10ms, and was thus chosen. Signed-off-by: Emil Gydesen --- tests/bluetooth/tester/src/btp_gap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/bluetooth/tester/src/btp_gap.c b/tests/bluetooth/tester/src/btp_gap.c index f8ed6aa583c61..d4cfa91ca6848 100644 --- a/tests/bluetooth/tester/src/btp_gap.c +++ b/tests/bluetooth/tester/src/btp_gap.c @@ -6,6 +6,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include #include #include @@ -987,14 +988,15 @@ static uint8_t stop_discovery(const void *cmd, uint16_t cmd_len, static uint8_t connect(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len) { + const struct bt_le_conn_param *conn_param = + BT_LE_CONN_PARAM(BT_GAP_INIT_CONN_INT_MIN, BT_GAP_INIT_CONN_INT_MIN, 0, 400); const struct btp_gap_connect_cmd *cp = cmd; int err; if (!bt_addr_le_eq(&cp->address, BT_ADDR_LE_ANY)) { struct bt_conn *conn; - err = bt_conn_le_create(&cp->address, BT_CONN_LE_CREATE_CONN, - BT_LE_CONN_PARAM_DEFAULT, &conn); + err = bt_conn_le_create(&cp->address, BT_CONN_LE_CREATE_CONN, conn_param, &conn); if (err) { LOG_ERR("Failed to create connection (%d)", err); return BTP_STATUS_FAILED; @@ -1002,8 +1004,7 @@ static uint8_t connect(const void *cmd, uint16_t cmd_len, bt_conn_unref(conn); } else { - err = bt_conn_le_create_auto(BT_CONN_LE_CREATE_CONN, - BT_LE_CONN_PARAM_DEFAULT); + err = bt_conn_le_create_auto(BT_CONN_LE_CREATE_CONN, conn_param); if (err) { LOG_ERR("Failed to create auto connection (%d)", err); return BTP_STATUS_FAILED; From 601b98cd24026472535f37e6ff9edfefee439541 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 11 Oct 2024 01:31:20 +0530 Subject: [PATCH 0745/4482] boards: nrf7002dk: remove redundant cpunet initialization code Extending commit 4a1834cef7d("boards: nrf53: remove redundant cpunet initialization code") to nRF7002DK for CPUNET reset handling. Signed-off-by: Chaitanya Tata --- boards/nordic/nrf7002dk/CMakeLists.txt | 9 --- boards/nordic/nrf7002dk/Kconfig | 17 ------ .../nordic/nrf7002dk/nrf5340_cpunet_reset.c | 59 ------------------- 3 files changed, 85 deletions(-) delete mode 100644 boards/nordic/nrf7002dk/CMakeLists.txt delete mode 100644 boards/nordic/nrf7002dk/nrf5340_cpunet_reset.c diff --git a/boards/nordic/nrf7002dk/CMakeLists.txt b/boards/nordic/nrf7002dk/CMakeLists.txt deleted file mode 100644 index 34667bb5650b4..0000000000000 --- a/boards/nordic/nrf7002dk/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if((CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP OR - CONFIG_BOARD_NRF7002DK_NRF5340_CPUAPP_NRF7001) AND - CONFIG_BOARD_ENABLE_CPUNET) - zephyr_library() - zephyr_library_sources(nrf5340_cpunet_reset.c) -endif() diff --git a/boards/nordic/nrf7002dk/Kconfig b/boards/nordic/nrf7002dk/Kconfig index 824f15fc5225c..4297ddb4c16e9 100644 --- a/boards/nordic/nrf7002dk/Kconfig +++ b/boards/nordic/nrf7002dk/Kconfig @@ -19,26 +19,9 @@ config HEAP_MEM_POOL_ADD_SIZE_BOARD int default 4096 if BT_HCI_IPC -config BOARD_ENABLE_CPUNET - bool "nRF53 Network MCU" - select SOC_NRF_GPIO_FORWARDER_FOR_NRF5340 if \ - $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_GPIO_FORWARDER)) - help - This option enables releasing the Network 'force off' signal, which - as a consequence will power up the Network MCU during system boot. - Additionally, the option allocates GPIO pins that will be used by UARTE - of the Network MCU. - Note: GPIO pin allocation can only be configured by the secure Application - MCU firmware, so when this option is used with the non-secure version of - the board, the application needs to take into consideration, that the - secure firmware image must already have configured GPIO allocation for the - Network MCU. - default y if (BT || NRF_802154_SER_HOST) - config DOMAIN_CPUNET_BOARD string default "nrf7002dk/nrf5340/cpunet" - depends on BOARD_ENABLE_CPUNET help The board which will be used for CPUNET domain when creating a multi image application where one or more images should be located on diff --git a/boards/nordic/nrf7002dk/nrf5340_cpunet_reset.c b/boards/nordic/nrf7002dk/nrf5340_cpunet_reset.c deleted file mode 100644 index b86b571db4b7a..0000000000000 --- a/boards/nordic/nrf7002dk/nrf5340_cpunet_reset.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -#include -#include - -LOG_MODULE_REGISTER(nrf7002dk_nrf5340_cpuapp, CONFIG_LOG_DEFAULT_LEVEL); - -#if defined(CONFIG_BT_CTLR_DEBUG_PINS_CPUAPP) -#include <../subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/debug.h> -#endif - -static void remoteproc_mgr_config(void) -{ -#if defined(CONFIG_BT_CTLR_DEBUG_PINS_CPUAPP) && \ - (!defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(CONFIG_BUILD_WITH_TFM)) - /* Route Bluetooth Controller Debug Pins */ - DEBUG_SETUP(); -#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(CONFIG_BUILD_WITH_TFM) */ - -#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) - /* Retain nRF5340 Network MCU in Secure domain (bus - * accesses by Network MCU will have Secure attribute set). - */ - NRF_SPU->EXTDOMAIN[0].PERM = BIT(4); -#endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */ -} - -static int remoteproc_mgr_boot(void) -{ - - /* Secure domain may configure permissions for the Network MCU. */ - remoteproc_mgr_config(); - -#if !defined(CONFIG_TRUSTED_EXECUTION_SECURE) - /* - * Building Zephyr with CONFIG_TRUSTED_EXECUTION_SECURE=y implies - * building also a Non-Secure image. The Non-Secure image will, in - * this case do the remainder of actions to properly configure and - * boot the Network MCU. - */ - - /* Release the Network MCU, 'Release force off signal' */ - nrf_reset_network_force_off(NRF_RESET, false); - - LOG_DBG("Network MCU released."); -#endif /* !CONFIG_TRUSTED_EXECUTION_SECURE */ - - return 0; -} - -SYS_INIT(remoteproc_mgr_boot, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); From ca1b2b865e93ac1f43c1e8573b7c1d29b663eb8e Mon Sep 17 00:00:00 2001 From: Tahsin Mutlugun Date: Thu, 10 Oct 2024 15:47:48 +0300 Subject: [PATCH 0746/4482] manifest: Update hal_adi to fix build errors for MAX32672 Some deprecated inclusions in max32672.h are causing compilation warnings, which are interpreted as errors by build tests. Grab relevant fixes from hal_adi. Signed-off-by: Tahsin Mutlugun --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index ff495c84a360d..8479528d12af8 100644 --- a/west.yml +++ b/west.yml @@ -137,7 +137,7 @@ manifest: groups: - fs - name: hal_adi - revision: de5dadb5322c5da9647363a0d081aa002d4b796f + revision: a3eecfde1c76d38312b94fd346c7ba9fe2661992 path: modules/hal/adi groups: - hal From a5558380330f1a00d454b9bbf25001df905e7b55 Mon Sep 17 00:00:00 2001 From: Marcin Szymczyk Date: Thu, 10 Oct 2024 13:37:18 +0200 Subject: [PATCH 0747/4482] drivers: mbox: nrf_vevif_task_rx: align to direct IRQs Allow using direct IRQs (which are obligatory when buiding with `CONFIG_GEN_SW_ISR_TABLE=n`). Signed-off-by: Marcin Szymczyk --- drivers/mbox/mbox_nrf_vevif_task_rx.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/mbox/mbox_nrf_vevif_task_rx.c b/drivers/mbox/mbox_nrf_vevif_task_rx.c index 8a4d81e0e6eff..a489d4d371775 100644 --- a/drivers/mbox/mbox_nrf_vevif_task_rx.c +++ b/drivers/mbox/mbox_nrf_vevif_task_rx.c @@ -116,9 +116,25 @@ static const struct mbox_driver_api vevif_task_rx_driver_api = { .set_enabled = vevif_task_rx_set_enabled, }; +#if defined(CONFIG_GEN_SW_ISR_TABLE) #define VEVIF_IRQ_CONNECT(idx, _) \ IRQ_CONNECT(DT_INST_IRQ_BY_IDX(0, idx, irq), DT_INST_IRQ_BY_IDX(0, idx, priority), \ vevif_task_rx_isr, &vevif_irqs[idx], 0) +#else + +#define VEVIF_IRQ_FUN(idx, _) \ +ISR_DIRECT_DECLARE(vevif_task_##idx##_rx_isr) \ +{ \ + vevif_task_rx_isr(&vevif_irqs[idx]); \ + return 1; \ +} + +LISTIFY(DT_NUM_IRQS(DT_DRV_INST(0)), VEVIF_IRQ_FUN, ()) + +#define VEVIF_IRQ_CONNECT(idx, _) \ + IRQ_DIRECT_CONNECT(DT_INST_IRQ_BY_IDX(0, idx, irq), DT_INST_IRQ_BY_IDX(0, idx, priority), \ + vevif_task_##idx##_rx_isr, 0) +#endif static int vevif_task_rx_init(const struct device *dev) { From 5f59b35b42cd0cb6f6df8d91e4607278ee0b34b7 Mon Sep 17 00:00:00 2001 From: Erik Sandgren Date: Thu, 10 Oct 2024 08:24:18 +0200 Subject: [PATCH 0748/4482] Bluetooth: Host: Fix issue where uninitialized value was used This change makes sure that when a call to `bt_id_set_scan_own_addr` is sucessful, i.e., the return value is 0, the `own_addr_type` will be set by the `bt_id_set_scan_own_addr`. Not setting the `own_addr_type` in a successful call to `bt_id_set_scan_own_addr` causes, for example, the `start_le_scan_ext` method in `scan.c` to use an uninitialized `own_addr_type`. Eventually this results in an unexpected failure further down in `start_le_scan_ext`, when sending HCI command to controller with an uninitialized `own_addr_type`. Signed-off-by: Erik Sandgren --- subsys/bluetooth/host/id.c | 13 +++++++------ .../src/test_suite_invalid_inputs.c | 3 --- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index f98636096bc20..223d0802406a4 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -1785,6 +1785,13 @@ int bt_id_set_scan_own_addr(bool active_scan, uint8_t *own_addr_type) } if (IS_ENABLED(CONFIG_BT_PRIVACY)) { + + if (BT_FEAT_LE_PRIVACY(bt_dev.le.features)) { + *own_addr_type = BT_HCI_OWN_ADDR_RPA_OR_RANDOM; + } else { + *own_addr_type = BT_ADDR_LE_RANDOM; + } + err = bt_id_set_private_addr(BT_ID_DEFAULT); if (err == -EACCES && (atomic_test_bit(bt_dev.flags, BT_DEV_SCANNING) || atomic_test_bit(bt_dev.flags, BT_DEV_INITIATING))) { @@ -1794,12 +1801,6 @@ int bt_id_set_scan_own_addr(bool active_scan, uint8_t *own_addr_type) } else if (err) { return err; } - - if (BT_FEAT_LE_PRIVACY(bt_dev.le.features)) { - *own_addr_type = BT_HCI_OWN_ADDR_RPA_OR_RANDOM; - } else { - *own_addr_type = BT_ADDR_LE_RANDOM; - } } else { *own_addr_type = bt_dev.id_addr[0].type; diff --git a/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/test_suite_invalid_inputs.c b/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/test_suite_invalid_inputs.c index 4a31b946f46e2..367cf3296a333 100644 --- a/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/test_suite_invalid_inputs.c +++ b/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/test_suite_invalid_inputs.c @@ -110,7 +110,6 @@ ZTEST(bt_id_set_scan_own_addr_invalid_inputs, test_set_random_address_fails) * Expected behaviour: * - bt_id_set_scan_own_addr() fails and returns the same error code returned by * bt_id_set_private_addr() - * - Address type reference isn't set */ ZTEST(bt_id_set_scan_own_addr_invalid_inputs, test_bt_id_set_private_addr_fails_privacy_enabled) { @@ -131,6 +130,4 @@ ZTEST(bt_id_set_scan_own_addr_invalid_inputs, test_bt_id_set_private_addr_fails_ #endif zassert_true(err < 0, "Unexpected error code '%d' was returned", err); - zassert_true(own_addr_type == BT_ADDR_LE_ANONYMOUS, - "Address type reference was unexpectedly modified"); } From 32aa1d634ed9992505ea551b567cdb2e65d418b9 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 9 Oct 2024 15:16:53 +0300 Subject: [PATCH 0749/4482] wifi: Refactor wifi-shell to allow external subcommands Rework the wifi-shell code so that external subcommands can be bolted into it easily. This means that the commands should be created using SHELL_SUBCMD_ADD(). Place the various subcommands in alphabetical order to find them more easily. Split long lines in order to pass CI checks. Signed-off-by: Jukka Rissanen --- subsys/net/l2/wifi/wifi_shell.c | 322 +++++++++++++++++++------------- 1 file changed, 187 insertions(+), 135 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 6c3e3e7e262f4..a257f49bb1453 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -2748,6 +2748,11 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, SHELL_SUBCMD_SET_END ); +SHELL_SUBCMD_ADD((wifi), ap, &wifi_cmd_ap, + "Access Point mode commands.", + NULL, + 0, 0); + SHELL_STATIC_SUBCMD_SET_CREATE(wifi_twt_ops, SHELL_CMD_ARG(quick_setup, NULL, " Start a TWT flow with defaults:\n" " .\n", @@ -2773,6 +2778,11 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_twt_ops, SHELL_SUBCMD_SET_END ); +SHELL_SUBCMD_ADD((wifi), twt, &wifi_twt_ops, + "Manage TWT flows.", + NULL, + 0, 0); + #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP SHELL_STATIC_SUBCMD_SET_CREATE( wifi_cmd_dpp, @@ -2850,17 +2860,43 @@ SHELL_STATIC_SUBCMD_SET_CREATE( cmd_wifi_dpp_reconfig, 2, 0), SHELL_SUBCMD_SET_END ); + +SHELL_SUBCMD_ADD((wifi), dpp, &wifi_cmd_dpp, + "DPP actions.", + NULL, + 0, 0); #endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */ -SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, - SHELL_CMD_ARG(version, NULL, "Print Wi-Fi Driver and Firmware versions\n", - cmd_wifi_version, - 1, 0), - SHELL_CMD(ap, &wifi_cmd_ap, "Access Point mode commands.\n", NULL), - SHELL_CMD_ARG(connect, NULL, +SHELL_SUBCMD_SET_CREATE(wifi_commands, (wifi)); + +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_WNM +SHELL_SUBCMD_ADD((wifi), 11v_btm_query, &wifi_commands, + ".\n", + cmd_wifi_btm_query, + 2, 0); +#endif + +SHELL_SUBCMD_ADD((wifi), channel, &wifi_commands, + "wifi channel setting\n" + "This command is used to set the channel when\n" + "monitor or TX-Injection mode is enabled\n" + "Currently 20 MHz is only supported and no BW parameter is provided\n" + "[-i, --if-index ] : Interface index\n" + "[-c, --channel ] : Set a specific channel number to the lower layer\n" + "[-g, --get] : Get current set channel number from the lower layer\n" + "[-h, --help] : Help\n" + "Usage: Get operation example for interface index 1\n" + "wifi channel -g -i1\n" + "Set operation example for interface index 1 (setting channel 5)\n" + "wifi -i1 -c5.\n", + cmd_wifi_channel, + 2, 4); + +SHELL_SUBCMD_ADD((wifi), connect, &wifi_commands, "Connect to a Wi-Fi AP\n" "<-s --ssid \"\">: SSID.\n" - "[-c --channel]: Channel that needs to be scanned for connection. 0:any channel.\n" + "[-c --channel]: Channel that needs to be scanned for connection. " + "0:any channel.\n" "[-b, --band] 0: any band (2:2.4GHz, 5:5GHz, 6:6GHz]\n" "[-p, --psk]: Passphrase (valid only for secure SSIDs)\n" "[-k, --key-mgmt]: Key Management type (valid only for secure SSIDs)\n" @@ -2874,134 +2910,150 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands, "[-K, --key-passwd]: Private key passwd for enterprise mode.\n" "[-h, --help]: Print out the help for the connect command.\n", cmd_wifi_connect, - 2, 13), - SHELL_CMD_ARG(disconnect, NULL, "Disconnect from the Wi-Fi AP.\n", - cmd_wifi_disconnect, - 1, 0), - SHELL_CMD_ARG(ps, NULL, "Configure or display Wi-Fi power save state.\n" - "[on/off]\n", - cmd_wifi_ps, - 1, 1), - SHELL_CMD_ARG(ps_mode, - NULL, - ".\n", - cmd_wifi_ps_mode, - 2, 0), - SHELL_CMD_ARG(scan, NULL, - "Scan for Wi-Fi APs\n" - "[-t, --type ] : Preferred mode of scan. The actual mode of scan can depend on factors such as the Wi-Fi chip implementation, regulatory domain restrictions. Default type is active\n" - "[-b, --bands ] : Bands to be scanned where 2: 2.4 GHz, 5: 5 GHz, 6: 6 GHz\n" - "[-a, --dwell_time_active ] : Active scan dwell time (in ms) on a channel. Range 5 ms to 1000 ms\n" - "[-p, --dwell_time_passive ] : Passive scan dwell time (in ms) on a channel. Range 10 ms to 1000 ms\n" - "[-s, --ssid] : SSID to scan for. Can be provided multiple times\n" - "[-m, --max_bss ] : Maximum BSSes to scan for. Range 1 - 65535\n" - "[-c, --chans ] : Channels to be scanned. The channels must be specified in the form band1:chan1,chan2_band2:chan3,..etc. band1, band2 must be valid band values and chan1, chan2, chan3 must be specified as a list of comma separated values where each value is either a single channel or a channel range specified as chan_start-chan_end. Each band channel set has to be separated by a _. For example, a valid channel specification can be 2:1,6_5:36 or 2:1,6-11,14_5:36,163-177,52. Care should be taken to ensure that configured channels don't exceed CONFIG_WIFI_MGMT_SCAN_CHAN_MAX_MANUAL\n" - "[-h, --help] : Print out the help for the scan command.\n", - cmd_wifi_scan, - 1, 8), - SHELL_CMD_ARG(statistics, NULL, "Wi-Fi interface statistics.\n" - "[reset] : Reset Wi-Fi interface statistics\n" - "[help] : Print out the help for the statistics command.", - cmd_wifi_stats, - 1, 1), - SHELL_CMD_ARG(status, NULL, "Status of the Wi-Fi interface.\n", cmd_wifi_status, 1, 0), - SHELL_CMD(twt, &wifi_twt_ops, "Manage TWT flows.\n", NULL), - SHELL_CMD_ARG(reg_domain, NULL, - "Set or Get Wi-Fi regulatory domain\n" - "[ISO/IEC 3166-1 alpha2]: Regulatory domain\n" - "[-f]: Force to use this regulatory hint over any other regulatory hints\n" - "Note: This may cause regulatory compliance issues, use it at your own risk.\n", - cmd_wifi_reg_domain, - 1, 2), - SHELL_CMD_ARG(mode, NULL, "mode operational setting\n" - "This command may be used to set the Wi-Fi device into a specific mode of operation\n" - "[-i, --if-index ] : Interface index\n" - "[-s, --sta] : Station mode\n" - "[-m, --monitor] : Monitor mode\n" - "[-a, --ap] : AP mode\n" - "[-k, --softap] : Softap mode\n" - "[-h, --help] : Help\n" - "[-g, --get] : Get current mode for a specific interface index\n" - "Usage: Get operation example for interface index 1\n" - "wifi mode -g -i1\n" - "Set operation example for interface index 1 - set station+promiscuous\n" - "wifi mode -i1 -sp.\n", - cmd_wifi_mode, - 1, 9), - SHELL_CMD_ARG(packet_filter, NULL, "mode filter setting\n" - "This command is used to set packet filter setting when\n" - "monitor, TX-Injection and promiscuous mode is enabled\n" - "The different packet filter modes are control, management, data and enable all filters\n" - "[-i, --if-index ] : Interface index\n" - "[-a, --all] : Enable all packet filter modes\n" - "[-m, --mgmt] : Enable management packets to allowed up the stack\n" - "[-c, --ctrl] : Enable control packets to be allowed up the stack\n" - "[-d, --data] : Enable Data packets to be allowed up the stack\n" - "[-g, --get] : Get current filter settings for a specific interface index\n" - "[-b, --capture-len ] : Capture length buffer size for each packet to be captured\n" - "[-h, --help] : Help\n" - "Usage: Get operation example for interface index 1\n" - "wifi packet_filter -g -i1\n" - "Set operation example for interface index 1 - set data+management frame filter\n" - "wifi packet_filter -i1 -md.\n", - cmd_wifi_packet_filter, - 2, 8), - SHELL_CMD_ARG(channel, NULL, "wifi channel setting\n" - "This command is used to set the channel when\n" - "monitor or TX-Injection mode is enabled\n" - "Currently 20 MHz is only supported and no BW parameter is provided\n" - "[-i, --if-index ] : Interface index\n" - "[-c, --channel ] : Set a specific channel number to the lower layer\n" - "[-g, --get] : Get current set channel number from the lower layer\n" - "[-h, --help] : Help\n" - "Usage: Get operation example for interface index 1\n" - "wifi channel -g -i1\n" - "Set operation example for interface index 1 (setting channel 5)\n" - "wifi -i1 -c5.\n", - cmd_wifi_channel, - 2, 4), -#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_WNM - SHELL_CMD_ARG(11v_btm_query, - NULL, - ".\n", - cmd_wifi_btm_query, - 2, 0), -#endif - SHELL_CMD_ARG(wps_pbc, NULL, - "Start a WPS PBC connection.\n", - cmd_wifi_wps_pbc, 1, 0), - SHELL_CMD_ARG(wps_pin, NULL, - "Set and get WPS pin.\n" - "[pin] Only applicable for set.\n", - cmd_wifi_wps_pin, 1, 1), - SHELL_CMD_ARG(ps_timeout, - NULL, - " - PS inactivity timer(in ms).\n", - cmd_wifi_ps_timeout, - 2, 0), - SHELL_CMD_ARG(ps_listen_interval, - NULL, - " - Listen interval in the range of <0-65535>.\n", - cmd_wifi_listen_interval, - 2, 0), - SHELL_CMD_ARG(ps_wakeup_mode, - NULL, - ".\n", - cmd_wifi_ps_wakeup_mode, - 2, 0), - SHELL_CMD_ARG(rts_threshold, - NULL, - ".\n", - cmd_wifi_set_rts_threshold, - 1, 1), -#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP - SHELL_CMD(dpp, &wifi_cmd_dpp, "DPP actions\n", NULL), -#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */ - SHELL_CMD_ARG(pmksa_flush, NULL, - "Flush PMKSA cache entries.\n", - cmd_wifi_pmksa_flush, 1, 0), - SHELL_SUBCMD_SET_END -); + 2, 13); + +SHELL_SUBCMD_ADD((wifi), disconnect, &wifi_commands, + "Disconnect from the Wi-Fi AP.\n", + cmd_wifi_disconnect, + 1, 0); + +SHELL_SUBCMD_ADD((wifi), mode, &wifi_commands, + "mode operational setting\n" + "This command may be used to set the Wi-Fi device into a specific " + "mode of operation\n" + "[-i, --if-index ] : Interface index\n" + "[-s, --sta] : Station mode\n" + "[-m, --monitor] : Monitor mode\n" + "[-a, --ap] : AP mode\n" + "[-k, --softap] : Softap mode\n" + "[-h, --help] : Help\n" + "[-g, --get] : Get current mode for a specific interface index\n" + "Usage: Get operation example for interface index 1\n" + "wifi mode -g -i1\n" + "Set operation example for interface index 1 - set station+promiscuous\n" + "wifi mode -i1 -sp.\n", + cmd_wifi_mode, + 1, 9); + +SHELL_SUBCMD_ADD((wifi), packet_filter, &wifi_commands, + "mode filter setting\n" + "This command is used to set packet filter setting when\n" + "monitor, TX-Injection and promiscuous mode is enabled\n" + "The different packet filter modes are control, management, " + "data and enable all filters\n" + "[-i, --if-index ] : Interface index\n" + "[-a, --all] : Enable all packet filter modes\n" + "[-m, --mgmt] : Enable management packets to allowed up the stack\n" + "[-c, --ctrl] : Enable control packets to be allowed up the stack\n" + "[-d, --data] : Enable Data packets to be allowed up the stack\n" + "[-g, --get] : Get current filter settings for a specific interface index\n" + "[-b, --capture-len ] : Capture length buffer size for each packet " + "to be captured\n" + "[-h, --help] : Help\n" + "Usage: Get operation example for interface index 1\n" + "wifi packet_filter -g -i1\n" + "Set operation example for interface index 1 - set data+management frame filter\n" + "wifi packet_filter -i1 -md.\n", + cmd_wifi_packet_filter, + 2, 8); + +SHELL_SUBCMD_ADD((wifi), pmksa_flush, &wifi_commands, + "Flush PMKSA cache entries.\n", + cmd_wifi_pmksa_flush, + 1, 0); + +SHELL_SUBCMD_ADD((wifi), ps, &wifi_commands, + "Configure or display Wi-Fi power save state.\n[on/off]\n", + cmd_wifi_ps, + 1, 1); + +SHELL_SUBCMD_ADD((wifi), ps_listen_interval, &wifi_commands, + " - Listen interval in the range of <0-65535>.\n", + cmd_wifi_listen_interval, + 2, 0); + +SHELL_SUBCMD_ADD((wifi), ps_mode, &wifi_commands, + ".\n", + cmd_wifi_ps_mode, + 2, 0); + +SHELL_SUBCMD_ADD((wifi), ps_timeout, &wifi_commands, + " - PS inactivity timer(in ms).\n", + cmd_wifi_ps_timeout, + 2, 0); + +SHELL_SUBCMD_ADD((wifi), ps_wakeup_mode, &wifi_commands, + ".\n", + cmd_wifi_ps_wakeup_mode, + 2, 0); + +SHELL_SUBCMD_ADD((wifi), reg_domain, &wifi_commands, + "Set or Get Wi-Fi regulatory domain\n" + "[ISO/IEC 3166-1 alpha2]: Regulatory domain\n" + "[-f]: Force to use this regulatory hint over any other regulatory hints\n" + "Note: This may cause regulatory compliance issues, use it at your own risk.\n", + cmd_wifi_reg_domain, + 1, 2); + +SHELL_SUBCMD_ADD((wifi), rts_threshold, &wifi_commands, + ".\n", + cmd_wifi_set_rts_threshold, + 1, 1); + +SHELL_SUBCMD_ADD((wifi), scan, &wifi_commands, + "Scan for Wi-Fi APs\n" + "[-t, --type ] : Preferred mode of scan. " + "The actual mode of scan can depend on factors such as the Wi-Fi chip " + "implementation, regulatory domain restrictions. Default type is active\n" + "[-b, --bands ] : " + "Bands to be scanned where 2: 2.4 GHz, 5: 5 GHz, 6: 6 GHz\n" + "[-a, --dwell_time_active ] : " + "Active scan dwell time (in ms) on a channel. Range 5 ms to 1000 ms\n" + "[-p, --dwell_time_passive ] : " + "Passive scan dwell time (in ms) on a channel. Range 10 ms to 1000 ms\n" + "[-s, --ssid] : SSID to scan for. Can be provided multiple times\n" + "[-m, --max_bss ] : Maximum BSSes to scan for. Range 1 - 65535\n" + "[-c, --chans ] : " + "Channels to be scanned. The channels must be specified in the form " + "band1:chan1,chan2_band2:chan3,..etc. band1, band2 must be valid band " + "values and chan1, chan2, chan3 must be specified as a list of comma " + "separated values where each value is either a single channel or a " + "channel range specified as chan_start-chan_end. Each band channel " + "set has to be separated by a _. For example, a valid channel " + "specification can be 2:1,6_5:36 or 2:1,6-11,14_5:36,163-177,52. " + "Care should be taken to ensure that configured channels don't exceed " + "CONFIG_WIFI_MGMT_SCAN_CHAN_MAX_MANUAL\n" + "[-h, --help] : Print out the help for the scan command.\n", + cmd_wifi_scan, + 1, 8); + +SHELL_SUBCMD_ADD((wifi), statistics, &wifi_commands, + "Wi-Fi interface statistics.\n" + "[reset] : Reset Wi-Fi interface statistics\n" + "[help] : Print out the help for the statistics command.", + cmd_wifi_stats, + 1, 1); + +SHELL_SUBCMD_ADD((wifi), status, &wifi_commands, + "Status of the Wi-Fi interface.\n", + cmd_wifi_status, + 1, 0); + +SHELL_SUBCMD_ADD((wifi), version, &wifi_commands, + "Print Wi-Fi Driver and Firmware versions\n", + cmd_wifi_version, + 1, 0); + +SHELL_SUBCMD_ADD((wifi), wps_pbc, &wifi_commands, + "Start a WPS PBC connection.\n", + cmd_wifi_wps_pbc, + 1, 0); + +SHELL_SUBCMD_ADD((wifi), wps_pin, &wifi_commands, + "Set and get WPS pin.\n" + "[pin] Only applicable for set.\n", + cmd_wifi_wps_pin, + 1, 1); SHELL_CMD_REGISTER(wifi, &wifi_commands, "Wi-Fi commands", NULL); From 8105f70d7a0504ce88132a3247fb204b6caa2226 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 9 Oct 2024 15:28:01 +0300 Subject: [PATCH 0750/4482] wifi: shell: Add missing newlines when printing error The parse_number() did not print newline after error or warning message. Signed-off-by: Jukka Rissanen --- subsys/net/l2/wifi/wifi_shell.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index a257f49bb1453..c808b0eac65d8 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -125,16 +125,16 @@ static bool parse_number(const struct shell *sh, long *param, char *str, } if (*endptr != '\0') { - PR_ERROR("Invalid number: %s", str_tmp); + PR_ERROR("Invalid number: %s\n", str_tmp); return false; } if ((num) < (min) || (num) > (max)) { if (pname) { - PR_WARNING("%s value out of range: %s, (%ld-%ld)", + PR_WARNING("%s value out of range: %s, (%ld-%ld)\n", pname, str_tmp, min, max); } else { - PR_WARNING("Value out of range: %s, (%ld-%ld)", + PR_WARNING("Value out of range: %s, (%ld-%ld)\n", str_tmp, min, max); } return false; From c6aa9e3803f10ac44152df604089495f37037094 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 9 Oct 2024 15:32:58 +0300 Subject: [PATCH 0751/4482] wifi: shell: btm_query: Fix invalid pointer cast The 11v_btm_query shell command was calling parse_number() using a pointer to uint8_t. This will cause memory overwrite and possible crash. Convert to use long temporary value to avoid this. Fix also the output prints in case of an error. Signed-off-by: Jukka Rissanen --- subsys/net/l2/wifi/wifi_shell.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index c808b0eac65d8..a20756cc6e292 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1671,16 +1671,19 @@ static int cmd_wifi_btm_query(const struct shell *sh, size_t argc, char *argv[]) { struct net_if *iface = net_if_get_first_wifi(); uint8_t query_reason = 0; + long tmp = 0; context.sh = sh; - if (!parse_number(sh, (long *)&query_reason, argv[1], NULL, + if (!parse_number(sh, &tmp, argv[1], NULL, WIFI_BTM_QUERY_REASON_UNSPECIFIED, WIFI_BTM_QUERY_REASON_LEAVING_ESS)) { return -EINVAL; } + query_reason = tmp; + if (net_mgmt(NET_REQUEST_WIFI_BTM_QUERY, iface, &query_reason, sizeof(query_reason))) { - PR_WARNING("Setting BTM query Reason failed..Reason :%d\n", query_reason); + PR_WARNING("Setting BTM query Reason failed. Reason : %d\n", query_reason); return -ENOEXEC; } From feb0241536886726a28b4377237873f771ad57ed Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 8 Oct 2024 14:28:04 -0500 Subject: [PATCH 0752/4482] soc: nxp: lpc55xxx: fix dependencies for SOC_FLASH_MCUX SOC_FLASH_MCUX has additional dependencies for LPC55xxx CPUs, due to the fact that the flash should be disabled when executing in nonsecure mode. Since the merge of HWMv2, this dependency has been set incorrectly at the SOC level, resulting in the IAP flash driver being enabled when targeting CPU1, which is incorrect. Fix the Kconfig dependency to resolve this issue. Fixes #79576 Signed-off-by: Daniel DeGrasse --- soc/nxp/lpc/lpc55xxx/Kconfig.defconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soc/nxp/lpc/lpc55xxx/Kconfig.defconfig b/soc/nxp/lpc/lpc55xxx/Kconfig.defconfig index 0decc5addf4cb..be1eceaca5704 100644 --- a/soc/nxp/lpc/lpc55xxx/Kconfig.defconfig +++ b/soc/nxp/lpc/lpc55xxx/Kconfig.defconfig @@ -53,7 +53,7 @@ config CAN_MCUX_MCAN endif # SOC_LPC55S16 -if SOC_LPC55S69 +if SOC_LPC55S69_CPU0 config SOC_FLASH_MCUX default y @@ -63,7 +63,7 @@ config SOC_FLASH_MCUX config I2S_MCUX_FLEXCOMM select INIT_PLL0 -endif # SOC_LPC55S69 +endif # SOC_LPC55S69_CPU0 if SOC_LPC55S69_CPU1 From 2ab104625edcdfb05482566725fe1e7cc7c0548c Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Fri, 4 Oct 2024 11:48:21 -0500 Subject: [PATCH 0753/4482] drivers: mdio_nxp_enet: Don't disable IRQ No real need to be enabling and disabling IRQs, this logic has been reported to be causing spurious interrupts and strange behavior, we can just enable the interrupt and switch to interrupt based logic one time and keep the interrupt enabled at that point. Also, fix a W1C bug where |= was used instead of = to clear a flag. Signed-off-by: Declan Snyder --- drivers/mdio/mdio_nxp_enet.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/mdio/mdio_nxp_enet.c b/drivers/mdio/mdio_nxp_enet.c index a506d83a93939..05a67acd90afb 100644 --- a/drivers/mdio/mdio_nxp_enet.c +++ b/drivers/mdio/mdio_nxp_enet.c @@ -41,17 +41,13 @@ struct nxp_enet_mdio_data { static int nxp_enet_mdio_wait_xfer(const struct device *dev) { struct nxp_enet_mdio_data *data = dev->data; - ENET_Type *base = data->base; /* This function will not make sense from IRQ context */ if (k_is_in_isr()) { return -EWOULDBLOCK; } - if (data->interrupt_up) { - /* Enable the interrupt */ - base->EIMR |= ENET_EIMR_MII_MASK; - } else { + if (!data->interrupt_up) { /* If the interrupt is not available to use yet, just busy wait */ k_busy_wait(CONFIG_MDIO_NXP_ENET_TIMEOUT); k_sem_give(&data->mdio_sem); @@ -77,7 +73,7 @@ static int nxp_enet_mdio_read(const struct device *dev, * Clear the bit (W1C) that indicates MDIO transfer is ready to * prepare to wait for it to be set once this read is done */ - data->base->EIR |= ENET_EIR_MII_MASK; + data->base->EIR = ENET_EIR_MII_MASK; /* * Write MDIO frame to MII management register which will @@ -105,7 +101,7 @@ static int nxp_enet_mdio_read(const struct device *dev, *read_data = (data->base->MMFR & ENET_MMFR_DATA_MASK) >> ENET_MMFR_DATA_SHIFT; /* Clear the same bit as before because the event has been handled */ - data->base->EIR |= ENET_EIR_MII_MASK; + data->base->EIR = ENET_EIR_MII_MASK; /* This MDIO interaction is finished */ (void)k_mutex_unlock(&data->mdio_mutex); @@ -127,7 +123,7 @@ static int nxp_enet_mdio_write(const struct device *dev, * Clear the bit (W1C) that indicates MDIO transfer is ready to * prepare to wait for it to be set once this write is done */ - data->base->EIR |= ENET_EIR_MII_MASK; + data->base->EIR = ENET_EIR_MII_MASK; /* * Write MDIO frame to MII management register which will @@ -153,7 +149,7 @@ static int nxp_enet_mdio_write(const struct device *dev, } /* Clear the same bit as before because the event has been handled */ - data->base->EIR |= ENET_EIR_MII_MASK; + data->base->EIR = ENET_EIR_MII_MASK; /* This MDIO interaction is finished */ (void)k_mutex_unlock(&data->mdio_mutex); @@ -170,13 +166,9 @@ static void nxp_enet_mdio_isr_cb(const struct device *dev) { struct nxp_enet_mdio_data *data = dev->data; - data->base->EIR |= ENET_EIR_MII_MASK; + data->base->EIR = ENET_EIR_MII_MASK; - /* Signal that operation finished */ k_sem_give(&data->mdio_sem); - - /* Disable the interrupt */ - data->base->EIMR &= ~ENET_EIMR_MII_MASK; } static void nxp_enet_mdio_post_module_reset_init(const struct device *dev) @@ -212,7 +204,9 @@ void nxp_enet_mdio_callback(const struct device *dev, nxp_enet_mdio_isr_cb(dev); break; case NXP_ENET_INTERRUPT_ENABLED: + /* IRQ was enabled in NVIC, now enable in enet */ data->interrupt_up = true; + data->base->EIMR |= ENET_EIMR_MII_MASK; break; default: break; From 6adfd4ba892fa3c87f6d0d4e662f481c3febf16e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 4 Oct 2024 07:25:06 +0200 Subject: [PATCH 0754/4482] logging: Minor cleanup in logging helper macros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change logging level definitions to just numbers instead of numbers with unsigned indicator (e.g. 1 instead of 1U). Levels from Kconfig comes as just numbers and often levels are used for IS_ENABLED-type of macros where values are concatenated into tokens and it actually makes the difference if value is 1 or 1U. It allows minor cleanup in the internal macros. Signed-off-by: Krzysztof Chruściński --- include/zephyr/logging/log_core.h | 33 +++++++++++-------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/include/zephyr/logging/log_core.h b/include/zephyr/logging/log_core.h index b6599cec2a384..bf135b02993d0 100644 --- a/include/zephyr/logging/log_core.h +++ b/include/zephyr/logging/log_core.h @@ -16,19 +16,19 @@ /* This header file keeps all macros and functions needed for creating logging * messages (macros like @ref LOG_ERR). */ -#define LOG_LEVEL_NONE 0U -#define LOG_LEVEL_ERR 1U -#define LOG_LEVEL_WRN 2U -#define LOG_LEVEL_INF 3U -#define LOG_LEVEL_DBG 4U +#define LOG_LEVEL_NONE 0 +#define LOG_LEVEL_ERR 1 +#define LOG_LEVEL_WRN 2 +#define LOG_LEVEL_INF 3 +#define LOG_LEVEL_DBG 4 #ifdef __cplusplus extern "C" { #endif #ifndef CONFIG_LOG -#define CONFIG_LOG_DEFAULT_LEVEL 0U -#define CONFIG_LOG_MAX_LEVEL 0U +#define CONFIG_LOG_DEFAULT_LEVEL 0 +#define CONFIG_LOG_MAX_LEVEL 0 #endif /* Id of local domain. */ @@ -54,15 +54,10 @@ extern "C" { __COND_CODE(_LOG_XXXX##_level, (_level), (_default)) #define _LOG_XXXX0 _LOG_YYYY, -#define _LOG_XXXX0U _LOG_YYYY, #define _LOG_XXXX1 _LOG_YYYY, -#define _LOG_XXXX1U _LOG_YYYY, #define _LOG_XXXX2 _LOG_YYYY, -#define _LOG_XXXX2U _LOG_YYYY, #define _LOG_XXXX3 _LOG_YYYY, -#define _LOG_XXXX3U _LOG_YYYY, #define _LOG_XXXX4 _LOG_YYYY, -#define _LOG_XXXX4U _LOG_YYYY, /** * @brief Macro for conditional code generation if provided log level allows. @@ -85,13 +80,9 @@ extern "C" { __COND_CODE(_LOG_ZZZZ##_eval_level, _iftrue, _iffalse) #define _LOG_ZZZZ1 _LOG_YYYY, -#define _LOG_ZZZZ1U _LOG_YYYY, #define _LOG_ZZZZ2 _LOG_YYYY, -#define _LOG_ZZZZ2U _LOG_YYYY, #define _LOG_ZZZZ3 _LOG_YYYY, -#define _LOG_ZZZZ3U _LOG_YYYY, #define _LOG_ZZZZ4 _LOG_YYYY, -#define _LOG_ZZZZ4U _LOG_YYYY, /** * @@ -101,11 +92,11 @@ extern "C" { log_const_source_id(__log_current_const_data) : 0U) /* Set of defines that are set to 1 if function name prefix is enabled for given level. */ -#define Z_LOG_FUNC_PREFIX_0U 0 -#define Z_LOG_FUNC_PREFIX_1U COND_CODE_1(CONFIG_LOG_FUNC_NAME_PREFIX_ERR, (1), (0)) -#define Z_LOG_FUNC_PREFIX_2U COND_CODE_1(CONFIG_LOG_FUNC_NAME_PREFIX_WRN, (1), (0)) -#define Z_LOG_FUNC_PREFIX_3U COND_CODE_1(CONFIG_LOG_FUNC_NAME_PREFIX_INF, (1), (0)) -#define Z_LOG_FUNC_PREFIX_4U COND_CODE_1(CONFIG_LOG_FUNC_NAME_PREFIX_DBG, (1), (0)) +#define Z_LOG_FUNC_PREFIX_0 0 +#define Z_LOG_FUNC_PREFIX_1 COND_CODE_1(CONFIG_LOG_FUNC_NAME_PREFIX_ERR, (1), (0)) +#define Z_LOG_FUNC_PREFIX_2 COND_CODE_1(CONFIG_LOG_FUNC_NAME_PREFIX_WRN, (1), (0)) +#define Z_LOG_FUNC_PREFIX_3 COND_CODE_1(CONFIG_LOG_FUNC_NAME_PREFIX_INF, (1), (0)) +#define Z_LOG_FUNC_PREFIX_4 COND_CODE_1(CONFIG_LOG_FUNC_NAME_PREFIX_DBG, (1), (0)) /** * @brief Macro for optional injection of function name as first argument of From 835dd0b83e7d272d91724f1e745b353578a85da1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 4 Oct 2024 12:39:34 +0200 Subject: [PATCH 0755/4482] logging: Refactor filtering macros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Create a macro that encapsulates all filtering and use it in standard and hexdump macros. Signed-off-by: Krzysztof Chruściński --- include/zephyr/logging/log_core.h | 232 ++++++++++++++++-------------- 1 file changed, 122 insertions(+), 110 deletions(-) diff --git a/include/zephyr/logging/log_core.h b/include/zephyr/logging/log_core.h index bf135b02993d0..64cd2a6c9e573 100644 --- a/include/zephyr/logging/log_core.h +++ b/include/zephyr/logging/log_core.h @@ -134,6 +134,15 @@ extern "C" { #define Z_LOG_LEVEL_CHECK(_level, _check_level, _default_level) \ ((_level) <= Z_LOG_RESOLVED_LEVEL(_check_level, _default_level)) +/** @brief Compile time level checking. + * + * This check is resolved at compile time and logging message is removed if check fails. + * + * @param _level Log level. + * + * @retval true Message shall be compiled in. + * @retval false Message shall removed during the compilation. + */ #define Z_LOG_CONST_LEVEL_CHECK(_level) \ (IS_ENABLED(CONFIG_LOG) && \ (Z_LOG_LEVEL_CHECK(_level, CONFIG_LOG_OVERRIDE_LEVEL, LOG_LEVEL_NONE) \ @@ -144,6 +153,63 @@ extern "C" { ) \ )) +/** @brief Static level checking for instance logging. + * + * This check applies only to instance logging and only if runtime filtering + * is disabled. It is performed in runtime but because level comes from the + * structure which is constant it is not exact runtime filtering because it + * cannot be changed in runtime. + * + * @param _level Log level. + * @param _inst 1 is source is the instance of a module. + * @param _source Data associated with the instance. + * + * @retval true Continue with log message creation. + * @retval false Drop that message. + */ +#define Z_LOG_STATIC_INST_LEVEL_CHECK(_level, _inst, _source) \ + (IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) || !_inst || \ + (_level <= ((const struct log_source_const_data *)_source)->level)) + +/** @brief Dynamic level checking. + * + * It uses the level from the dynamic structure. + * + * @param _level Log level. + * @param _source Data associated with the source. + * + * @retval true Continue with log message creation. + * @retval false Drop that message. + */ +#define Z_LOG_DYNAMIC_LEVEL_CHECK(_level, _source) \ + (!IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) || k_is_user_context() || \ + ((_level) <= Z_LOG_RUNTIME_FILTER(((struct log_source_dynamic_data *)_source)->filters))) + +/** @brief Check if message shall be created. + * + * Aggregate all checks into a single one. + * + * @param _level Log level. + * @param _inst 1 is source is the instance of a module. + * @param _source Data associated with the source. + * + * @retval true Continue with log message creation. + * @retval false Drop that message. + */ +#define Z_LOG_LEVEL_ALL_CHECK(_level, _inst, _source) \ + (Z_LOG_CONST_LEVEL_CHECK(_level) && \ + Z_LOG_STATIC_INST_LEVEL_CHECK(_level, _inst, _source) && \ + Z_LOG_DYNAMIC_LEVEL_CHECK(_level, _source)) + +/** @brief Get current module data that is used for source id retrieving. + * + * If runtime filtering is used then pointer to dynamic data is returned and else constant + * data is used. + */ +#define Z_LOG_CURRENT_DATA() \ + COND_CODE_1(CONFIG_LOG_RUNTIME_FILTERING, \ + (__log_current_dynamic_data), (__log_current_const_data)) + /*****************************************************************************/ /****************** Definitions used by minimal logging *********************/ /*****************************************************************************/ @@ -217,68 +283,41 @@ static inline char z_log_minimal_level_to_char(int level) * @param _level Log message severity level. * * @param _inst Set to 1 for instance specific log message. 0 otherwise. - * - * @param _source Pointer to static source descriptor object. NULL when runtime filtering - * is enabled. - * - * @param _dsource Pointer to dynamic source descriptor. NULL when runtime filtering - * is disabled. + * @param _source Pointer to a structure associated with the module or instance. + * If it is a module then it is used only when runtime filtering is + * enabled. If it is instance then it is used in both cases. * * @param ... String with arguments. */ -#define Z_LOG2(_level, _inst, _source, _dsource, ...) do { \ - if (!Z_LOG_CONST_LEVEL_CHECK(_level)) { \ - break; \ - } \ - if (IS_ENABLED(CONFIG_LOG_MODE_MINIMAL)) { \ - Z_LOG_TO_PRINTK(_level, __VA_ARGS__); \ - break; \ - } \ - /* For instance logging check instance specific static level */ \ - if (_inst != 0 && !IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING)) { \ - if (_level > ((struct log_source_const_data *)_source)->level) { \ - break; \ - } \ - } \ - \ - bool is_user_context = k_is_user_context(); \ - if (IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) && \ - !is_user_context && _level > Z_LOG_RUNTIME_FILTER((_dsource)->filters)) { \ - break; \ - } \ - int _mode; \ - void *_src = IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) ? \ - (void *)(_dsource) : (void *)(_source); \ - bool string_ok; \ - LOG_POINTERS_VALIDATE(string_ok, __VA_ARGS__); \ - if (!string_ok) { \ - LOG_STRING_WARNING(_mode, _src, __VA_ARGS__); \ - break; \ - } \ - Z_LOG_MSG_CREATE(UTIL_NOT(IS_ENABLED(CONFIG_USERSPACE)), _mode, \ - Z_LOG_LOCAL_DOMAIN_ID, _src, _level, NULL,\ - 0, __VA_ARGS__); \ - (void)_mode; \ - if (false) { \ - /* Arguments checker present but never evaluated.*/ \ - /* Placed here to ensure that __VA_ARGS__ are*/ \ - /* evaluated once when log is enabled.*/ \ - z_log_printf_arg_checker(__VA_ARGS__); \ - } \ -} while (false) +#define Z_LOG2(_level, _inst, _source, ...) \ + do { \ + if (!Z_LOG_LEVEL_ALL_CHECK(_level, _inst, _source)) { \ + break; \ + } \ + if (IS_ENABLED(CONFIG_LOG_MODE_MINIMAL)) { \ + Z_LOG_TO_PRINTK(_level, __VA_ARGS__); \ + break; \ + } \ + int _mode; \ + bool string_ok; \ + LOG_POINTERS_VALIDATE(string_ok, __VA_ARGS__); \ + if (!string_ok) { \ + LOG_STRING_WARNING(_mode, _source, __VA_ARGS__); \ + break; \ + } \ + Z_LOG_MSG_CREATE(UTIL_NOT(IS_ENABLED(CONFIG_USERSPACE)), _mode, \ + Z_LOG_LOCAL_DOMAIN_ID, _source, _level, NULL, 0, __VA_ARGS__); \ + (void)_mode; \ + if (false) { \ + /* Arguments checker present but never evaluated.*/ \ + /* Placed here to ensure that __VA_ARGS__ are*/ \ + /* evaluated once when log is enabled.*/ \ + z_log_printf_arg_checker(__VA_ARGS__); \ + } \ + } while (false) -#define Z_LOG(_level, ...) \ - Z_LOG2(_level, 0, __log_current_const_data, __log_current_dynamic_data, __VA_ARGS__) - -#define Z_LOG_INSTANCE(_level, _inst, ...) do { \ - (void)_inst; \ - Z_LOG2(_level, 1, \ - COND_CODE_1(CONFIG_LOG_RUNTIME_FILTERING, (NULL), (Z_LOG_INST(_inst))), \ - (struct log_source_dynamic_data *)COND_CODE_1( \ - CONFIG_LOG_RUNTIME_FILTERING, \ - (Z_LOG_INST(_inst)), (NULL)), \ - __VA_ARGS__); \ -} while (0) +#define Z_LOG(_level, ...) Z_LOG2(_level, 0, Z_LOG_CURRENT_DATA(), __VA_ARGS__) +#define Z_LOG_INSTANCE(_level, _inst, ...) Z_LOG2(_level, 1, Z_LOG_INST(_inst), __VA_ARGS__) /*****************************************************************************/ /****************** Macros for hexdump logging *******************************/ @@ -293,11 +332,9 @@ static inline char z_log_minimal_level_to_char(int level) * * @param _inst Set to 1 for instance specific log message. 0 otherwise. * - * @param _source Pointer to static source descriptor object. NULL when runtime filtering - * is enabled. - * - * @param _dsource Pointer to dynamic source descriptor. NULL when runtime filtering - * is disabled. + * @param _source Pointer to a structure associated with the module or instance. + * If it is a module then it is used only when runtime filtering is + * enabled. If it is instance then it is used in both cases. * * @param _data Hexdump data; * @@ -305,56 +342,31 @@ static inline char z_log_minimal_level_to_char(int level) * * @param ... String. */ -#define Z_LOG_HEXDUMP2(_level, _inst, _source, _dsource, _data, _len, ...) do { \ - const char *_str = GET_ARG_N(1, __VA_ARGS__); \ - if (!Z_LOG_CONST_LEVEL_CHECK(_level)) { \ - break; \ - } \ - /* For instance logging check instance specific static level */ \ - if (_inst && !IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING)) { \ - if (_level > ((struct log_source_const_data *)_source)->level) { \ - break; \ - } \ - } \ - bool is_user_context = k_is_user_context(); \ - uint32_t filters = IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) ? \ - (_dsource)->filters : 0;\ - \ - if (IS_ENABLED(CONFIG_LOG_MODE_MINIMAL)) { \ - Z_LOG_TO_PRINTK(_level, "%s", _str); \ - z_log_minimal_hexdump_print((_level), \ - (const char *)(_data), (_len));\ - break; \ - } \ - if (IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) && \ - !is_user_context && (_level) > Z_LOG_RUNTIME_FILTER(filters)) { \ - break; \ - } \ - int mode; \ - void *_src = IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING) ? \ - (void *)(_dsource) : (void *)(_source); \ - Z_LOG_MSG_CREATE(UTIL_NOT(IS_ENABLED(CONFIG_USERSPACE)), mode, \ - Z_LOG_LOCAL_DOMAIN_ID, _src, _level, \ - _data, _len, \ - COND_CODE_0(NUM_VA_ARGS_LESS_1(_, ##__VA_ARGS__), \ +#define Z_LOG_HEXDUMP2(_level, _inst, _source, _data, _len, ...) \ + do { \ + if (!Z_LOG_LEVEL_ALL_CHECK(_level, _inst, _source)) { \ + break; \ + } \ + const char *_str = GET_ARG_N(1, __VA_ARGS__); \ + if (IS_ENABLED(CONFIG_LOG_MODE_MINIMAL)) { \ + Z_LOG_TO_PRINTK(_level, "%s", _str); \ + z_log_minimal_hexdump_print((_level), (const char *)(_data), (_len)); \ + break; \ + } \ + int mode; \ + Z_LOG_MSG_CREATE(UTIL_NOT(IS_ENABLED(CONFIG_USERSPACE)), mode, \ + Z_LOG_LOCAL_DOMAIN_ID, _source, _level, _data, _len, \ + COND_CODE_0(NUM_VA_ARGS_LESS_1(_, ##__VA_ARGS__), \ (), \ (COND_CODE_0(NUM_VA_ARGS_LESS_1(__VA_ARGS__), \ - ("%s", __VA_ARGS__), (__VA_ARGS__)))));\ -} while (false) + ("%s", __VA_ARGS__), (__VA_ARGS__))))); \ + } while (false) + +#define Z_LOG_HEXDUMP(_level, _data, _length, ...) \ + Z_LOG_HEXDUMP2(_level, 0, Z_LOG_CURRENT_DATA(), _data, _length, __VA_ARGS__) -#define Z_LOG_HEXDUMP(_level, _data, _length, ...) \ - Z_LOG_HEXDUMP2(_level, 0, \ - __log_current_const_data, \ - __log_current_dynamic_data, \ - _data, _length, __VA_ARGS__) - -#define Z_LOG_HEXDUMP_INSTANCE(_level, _inst, _data, _length, _str) \ - Z_LOG_HEXDUMP2(_level, 1, \ - COND_CODE_1(CONFIG_LOG_RUNTIME_FILTERING, (NULL), (Z_LOG_INST(_inst))), \ - (struct log_source_dynamic_data *)COND_CODE_1( \ - CONFIG_LOG_RUNTIME_FILTERING, \ - (Z_LOG_INST(_inst)), (NULL)), \ - _data, _length, _str) +#define Z_LOG_HEXDUMP_INSTANCE(_level, _inst, _data, _length, ...) \ + Z_LOG_HEXDUMP2(_level, 1, Z_LOG_INST(_inst), _data, _length, __VA_ARGS__) /*****************************************************************************/ /****************** Filtering macros *****************************************/ From c759068c40cc382c0311a0d63c3034ef1727514b Mon Sep 17 00:00:00 2001 From: Hake Huang Date: Wed, 25 Sep 2024 10:51:22 +0000 Subject: [PATCH 0756/4482] twister: runner: add extra_args supporting platform and soc like extra_confs, add extr_args filterable by soc:: or platfrom:: simulation:: which will only apply to given platform or arch Signed-off-by: Hake Huang --- scripts/pylib/twister/twisterlib/runner.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index b0a6777edbdff..1768933d66d60 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -1182,8 +1182,26 @@ def cmake_assemble_args(extra_args, handler, extra_conf_files, extra_overlay_con return args_expanded def cmake(self, filter_stages=[]): + args = [] + for va in self.testsuite.extra_args.copy(): + cond_args = va.split(":") + if cond_args[0] == "arch" and len(cond_args) == 3: + if self.instance.platform.arch == cond_args[1]: + args.append(cond_args[2]) + elif cond_args[0] == "platform" and len(cond_args) == 3: + if self.instance.platform.name == cond_args[1]: + args.append(cond_args[2]) + elif cond_args[0] == "simulation" and len(cond_args) == 3: + if self.instance.platform.simulation == cond_args[1]: + args.append(cond_args[2]) + else: + if cond_args[0] in ["arch", "platform", "simulation"]: + logger.warning(f"Unexpected extra_args: {va}") + args.append(va) + + args = self.cmake_assemble_args( - self.testsuite.extra_args.copy(), # extra_args from YAML + args, self.instance.handler, self.testsuite.extra_conf_files, self.testsuite.extra_overlay_confs, From c05e4802fb718ae4f95d50fd9ccaa6ebaaa8f379 Mon Sep 17 00:00:00 2001 From: Hake Huang Date: Thu, 26 Sep 2024 04:50:39 +0000 Subject: [PATCH 0757/4482] document: twister: update documents for extra_args now extra_args can support domain settings, add in doc. Signed-off-by: Hake Huang --- doc/develop/test/twister.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/doc/develop/test/twister.rst b/doc/develop/test/twister.rst index f0c5bbf76721d..3999e6c96014c 100644 --- a/doc/develop/test/twister.rst +++ b/doc/develop/test/twister.rst @@ -341,6 +341,23 @@ extra_args: Extra arguments to pass to build tool when building or running the test scenario. + Using namespacing, it is possible to apply extra_args only to some + hardware. Currently architectures/platforms/simulation are supported: + + .. code-block:: yaml + + common: + tags: drivers adc + tests: + test: + depends_on: adc + test_async: + extra_args: + - arch:x86:CONFIG_ADC_ASYNC=y + - platform:qemu_x86:CONFIG_DEBUG=y + - platform:mimxrt1060_evk:SHIELD=rk043fn66hs_ctg + - simulation:qemu:CONFIG_MPU=y + extra_configs: Extra configuration options to be merged with a main prj.conf when building or running the test scenario. For example: From 33fe360bfc4670e814b25b05ed7f6b959d2c1647 Mon Sep 17 00:00:00 2001 From: Hake Huang Date: Tue, 1 Oct 2024 12:25:04 +0000 Subject: [PATCH 0758/4482] tests: twister: runner add runner test add test for platform in extra_args Signed-off-by: Hake Huang --- scripts/tests/twister/test_runner.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index 9fc4a8fa2699d..2ec3ffd0c4b08 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -2097,11 +2097,13 @@ def test_projectbuilder_cmake(): instance_mock = mock.Mock() instance_mock.handler = 'dummy handler' instance_mock.build_dir = os.path.join('build', 'dir') + instance_mock.platform.name = 'frdm_k64f' env_mock = mock.Mock() pb = ProjectBuilder(instance_mock, env_mock, mocked_jobserver) pb.build_dir = 'build_dir' - pb.testsuite.extra_args = ['some', 'args'] + pb.testsuite.platform = instance_mock.platform + pb.testsuite.extra_args = ['some', 'platform:frdm_k64f:args'] pb.testsuite.extra_conf_files = ['some', 'files1'] pb.testsuite.extra_overlay_confs = ['some', 'files2'] pb.testsuite.extra_dtc_overlay_files = ['some', 'files3'] @@ -2114,7 +2116,7 @@ def test_projectbuilder_cmake(): assert res == cmake_res_mock pb.cmake_assemble_args.assert_called_once_with( - pb.testsuite.extra_args, + ['some', 'args'], pb.instance.handler, pb.testsuite.extra_conf_files, pb.testsuite.extra_overlay_confs, From e933c7eaee6fd2f433772a0b8f90f01c85efa200 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Mon, 30 Sep 2024 11:46:55 +0200 Subject: [PATCH 0759/4482] boards: nordic: nrf7002dk: re-enable external flash by default The external flash (mx25r64) was accidentally disabled during testing. The node should be enabled by default like its spi. This commit removes the status = "disabled"; Signed-off-by: Bjarki Arge Andreasen --- boards/nordic/nrf7002dk/nrf5340_cpuapp_common.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/boards/nordic/nrf7002dk/nrf5340_cpuapp_common.dtsi b/boards/nordic/nrf7002dk/nrf5340_cpuapp_common.dtsi index ce11dbcb61dfe..cff6e54fd5d7d 100644 --- a/boards/nordic/nrf7002dk/nrf5340_cpuapp_common.dtsi +++ b/boards/nordic/nrf7002dk/nrf5340_cpuapp_common.dtsi @@ -173,7 +173,6 @@ arduino_i2c: &i2c1 { cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; mx25r64: mx25r6435f@0 { compatible = "jedec,spi-nor"; - status = "disabled"; reg = <0>; spi-max-frequency = <33000000>; jedec-id = [c2 28 17]; From 8a104729c471333de9bcffe3db624ef185cdc7ee Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Wed, 25 Sep 2024 16:23:06 -0500 Subject: [PATCH 0760/4482] soc: nxp: mcxw71: Add LPI2C node and clocking Add LPI2C node and default clocking in soc.c Signed-off-by: Declan Snyder --- dts/arm/nxp/nxp_mcxw71.dtsi | 22 ++++++++++++++++++++++ soc/nxp/mcx/mcxw/soc.c | 8 ++++++++ 2 files changed, 30 insertions(+) diff --git a/dts/arm/nxp/nxp_mcxw71.dtsi b/dts/arm/nxp/nxp_mcxw71.dtsi index 0ca30b04a0be2..d5a684d08e41a 100644 --- a/dts/arm/nxp/nxp_mcxw71.dtsi +++ b/dts/arm/nxp/nxp_mcxw71.dtsi @@ -170,6 +170,28 @@ status = "disabled"; }; + lpi2c0: i2c@33000 { + compatible = "nxp,imx-lpi2c"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x33000 0x200>; + interrupts = <39 0>; + clocks = <&scg SCG_K4_FIRC_CLK 0xe0>; + status = "disabled"; + }; + + lpi2c1: i2c@34000 { + compatible = "nxp,imx-lpi2c"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x34000 0x200>; + interrupts = <40 0>; + clocks = <&scg SCG_K4_FIRC_CLK 0xe4>; + status = "disabled"; + }; + gpiod: gpio@46000{ compatible = "nxp,kinetis-gpio"; status = "disabled"; diff --git a/soc/nxp/mcx/mcxw/soc.c b/soc/nxp/mcx/mcxw/soc.c index 9251af68f8ba3..18d9e4c5f2b11 100644 --- a/soc/nxp/mcx/mcxw/soc.c +++ b/soc/nxp/mcx/mcxw/soc.c @@ -136,6 +136,14 @@ static ALWAYS_INLINE void clock_init(void) if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(tpm1), nxp_kinetis_tpm, okay)) { CLOCK_EnableClock(kCLOCK_Tpm1); } + + if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(lpi2c0), nxp_imx_lpi2c, okay)) { + CLOCK_EnableClock(kCLOCK_Lpi2c0); + } + + if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(lpi2c1), nxp_imx_lpi2c, okay)) { + CLOCK_EnableClock(kCLOCK_Lpi2c1); + } } static void vbat_init(void) From 3be548b139c3d15c5b79a7699ab534a2db9a525a Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Wed, 25 Sep 2024 16:23:43 -0500 Subject: [PATCH 0761/4482] boards: frdm_mcxw71: Enable LPI2C1 Enable LPI2C1 on the frdm_mcxw71 board which is connected to a FXLS8964AF sensor (no driver for the sensor yet). Signed-off-by: Declan Snyder --- boards/nxp/frdm_mcxw71/doc/index.rst | 2 ++ boards/nxp/frdm_mcxw71/frdm_mcxw71-pinctrl.dtsi | 10 ++++++++++ boards/nxp/frdm_mcxw71/frdm_mcxw71.dts | 6 ++++++ boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml | 1 + 4 files changed, 19 insertions(+) diff --git a/boards/nxp/frdm_mcxw71/doc/index.rst b/boards/nxp/frdm_mcxw71/doc/index.rst index d9f3fb5647132..728f615cc8f8a 100644 --- a/boards/nxp/frdm_mcxw71/doc/index.rst +++ b/boards/nxp/frdm_mcxw71/doc/index.rst @@ -55,6 +55,8 @@ The ``frdm_mcxw71`` board target in Zephyr currently supports the following feat | LPUART | on-chip | serial port-polling; | | | | serial port-interrupt | +-----------+------------+-------------------------------------+ +| LPI2C | on-chip | i2c | ++-----------+------------+-------------------------------------+ | FMU | on-chip | flash | +-----------+------------+-------------------------------------+ | TPM | on-chip | pwm | diff --git a/boards/nxp/frdm_mcxw71/frdm_mcxw71-pinctrl.dtsi b/boards/nxp/frdm_mcxw71/frdm_mcxw71-pinctrl.dtsi index e40a6e6c9141f..d70a50f2fbd88 100644 --- a/boards/nxp/frdm_mcxw71/frdm_mcxw71-pinctrl.dtsi +++ b/boards/nxp/frdm_mcxw71/frdm_mcxw71-pinctrl.dtsi @@ -23,4 +23,14 @@ slew-rate = "fast"; }; }; + + pinmux_lpi2c1: pinmux_lpi2c1 { + group0 { + pinmux = , + ; + drive-strength = "low"; + slew-rate = "fast"; + drive-open-drain; + }; + }; }; diff --git a/boards/nxp/frdm_mcxw71/frdm_mcxw71.dts b/boards/nxp/frdm_mcxw71/frdm_mcxw71.dts index 43721739b3537..ae515418a9310 100644 --- a/boards/nxp/frdm_mcxw71/frdm_mcxw71.dts +++ b/boards/nxp/frdm_mcxw71/frdm_mcxw71.dts @@ -59,6 +59,12 @@ pinctrl-names = "default"; }; +&lpi2c1 { + status = "okay"; + pinctrl-0 = <&pinmux_lpi2c1>; + pinctrl-names = "default"; +}; + &flash { partitions { compatible = "fixed-partitions"; diff --git a/boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml b/boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml index 5ecd9fb9d8a9f..b329eb269c071 100644 --- a/boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml +++ b/boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml @@ -16,3 +16,4 @@ supported: - watchdog - pinctrl - flash + - i2c From 0e9b9b0cf3044834d6dfe3c4f8356a70725c1f72 Mon Sep 17 00:00:00 2001 From: Adrian Warecki Date: Wed, 18 Sep 2024 09:03:18 +0200 Subject: [PATCH 0762/4482] ace: mm: tlb: Ignore unmappig error in driver initalization The sys_mm_drv_unmap_region_initial function is responsible for unmapping all unused virtual memory during tlb driver initialization. Most addresses will not have a mapped page. Ignore the error code indicating unmapped memory that will occur when trying to unmap. Signed-off-by: Adrian Warecki --- drivers/mm/mm_drv_intel_adsp_mtl_tlb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c b/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c index 5b0bc5e576be0..244f10846f621 100644 --- a/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c +++ b/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c @@ -478,7 +478,11 @@ static int sys_mm_drv_unmap_region_initial(void *virt_in, size_t size) int ret2 = sys_mm_drv_unmap_page_wflush(va, false); - if (ret2 != 0) { + /* -EFAULT means that this page is not mapped. + * This is not an error since we want to unmap all virtual memory without knowing + * which pages are mapped. + */ + if (ret2 != 0 && ret2 != -EFAULT) { __ASSERT(false, "cannot unmap %p\n", va); ret = ret2; From 256ab0c9191c2c8ab11fb30697f5da1a6962a1ba Mon Sep 17 00:00:00 2001 From: Adrian Warecki Date: Tue, 10 Sep 2024 13:37:08 +0200 Subject: [PATCH 0763/4482] ace: mm: tlb: Check tlb translation enabled before flushing cache Before unmapping a memory page, the cache is flushed. If the given memory page is not mapped, this operation ends with a cpu exception on the ptl platform. Add check if tlb translation is active before flushing. Signed-off-by: Adrian Warecki --- drivers/mm/mm_drv_intel_adsp_mtl_tlb.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c b/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c index 244f10846f621..67210505cb9c2 100644 --- a/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c +++ b/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c @@ -338,6 +338,7 @@ static int sys_mm_drv_unmap_page_wflush(void *virt, bool flush_data) k_spinlock_key_t key; uint32_t entry_idx, bank_idx; uint16_t *tlb_entries = UINT_TO_POINTER(TLB_BASE); + uint16_t entry; uintptr_t pa; int ret = 0; @@ -359,6 +360,17 @@ static int sys_mm_drv_unmap_page_wflush(void *virt, bool flush_data) key = k_spin_lock(&tlb_lock); + entry_idx = get_tlb_entry_idx(va); + entry = tlb_entries[entry_idx]; + + /* Check if the translation is enabled in the TLB entry. + * Attempt to flush the cache of an inactive address will result in a cpu exception. + */ + if (!(entry & TLB_ENABLE_BIT)) { + ret = -EFAULT; + goto out_unlock; + } + /* * Flush the cache to make sure the backing physical page * has the latest data. @@ -371,8 +383,7 @@ static int sys_mm_drv_unmap_page_wflush(void *virt, bool flush_data) #endif } - entry_idx = get_tlb_entry_idx(va); - pa = tlb_entry_to_pa(tlb_entries[entry_idx]); + pa = tlb_entry_to_pa(entry); /* Restore default entry settings with cleared the enable bit. */ tlb_entries[entry_idx] = 0; @@ -395,6 +406,7 @@ static int sys_mm_drv_unmap_page_wflush(void *virt, bool flush_data) } } +out_unlock: k_spin_unlock(&tlb_lock, key); out: From 0ce32c963e278166565bb565a9e0931645edb30e Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Tue, 17 Sep 2024 12:55:52 +0900 Subject: [PATCH 0764/4482] tests: drivers: build_all: lora: Add devices build tests Add build tests for the following devices. - semtech,sx1262 - semtech,sx1272 - reyax,rylrxxx Signed-off-by: TOKITA Hiroshi --- tests/drivers/build_all/lora/prj.conf | 2 + tests/drivers/build_all/lora/sx1262.overlay | 44 +++++++++++++++++ tests/drivers/build_all/lora/sx1272.overlay | 47 +++++++++++++++++++ tests/drivers/build_all/lora/testcase.yaml | 25 ++++++++++ .../build_all/lora/uart_devices.overlay | 32 +++++++++++++ 5 files changed, 150 insertions(+) create mode 100644 tests/drivers/build_all/lora/sx1262.overlay create mode 100644 tests/drivers/build_all/lora/sx1272.overlay create mode 100644 tests/drivers/build_all/lora/uart_devices.overlay diff --git a/tests/drivers/build_all/lora/prj.conf b/tests/drivers/build_all/lora/prj.conf index e1faee53e19d2..615529cc79d80 100644 --- a/tests/drivers/build_all/lora/prj.conf +++ b/tests/drivers/build_all/lora/prj.conf @@ -1 +1,3 @@ CONFIG_TEST=y +CONFIG_GPIO=y +CONFIG_LORA=y diff --git a/tests/drivers/build_all/lora/sx1262.overlay b/tests/drivers/build_all/lora/sx1262.overlay new file mode 100644 index 0000000000000..9809e95c33ec0 --- /dev/null +++ b/tests/drivers/build_all/lora/sx1262.overlay @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + test { + #address-cells = <1>; + #size-cells = <1>; + + test_gpio: gpio@deadbeef { + compatible = "vnd,gpio"; + gpio-controller; + reg = <0xdeadbeef 0x1000>; + #gpio-cells = <0x2>; + status = "okay"; + }; + + test_spi: spi@33334444 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "vnd,spi"; + reg = <0x33334444 0x1000>; + status = "okay"; + + cs-gpios = <&test_gpio 0 0>, + <&test_gpio 0 0>, + <&test_gpio 0 0>; + + test_semtech_sx1262: sx1262@0 { + compatible = "semtech,sx1262"; + status = "okay"; + reg = <0>; + spi-max-frequency = <16000000>; + reset-gpios = <&test_gpio 0 0>; + busy-gpios = <&test_gpio 9 0>; + antenna-enable-gpios = <&test_gpio 0 0>; + dio1-gpios = <&test_gpio 11 0>; + dio2-tx-enable; + tcxo-power-startup-delay-ms = <5>; + }; + }; + }; +}; diff --git a/tests/drivers/build_all/lora/sx1272.overlay b/tests/drivers/build_all/lora/sx1272.overlay new file mode 100644 index 0000000000000..0222be3c142ca --- /dev/null +++ b/tests/drivers/build_all/lora/sx1272.overlay @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + test { + #address-cells = <1>; + #size-cells = <1>; + + test_gpio: gpio@deadbeef { + compatible = "vnd,gpio"; + gpio-controller; + reg = <0xdeadbeef 0x1000>; + #gpio-cells = <0x2>; + status = "okay"; + }; + + test_spi: spi@33334444 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "vnd,spi"; + reg = <0x33334444 0x1000>; + status = "okay"; + + cs-gpios = <&test_gpio 0 0>, + <&test_gpio 0 0>, + <&test_gpio 0 0>; + + test_semtech_sx1272: sx1272@1 { + compatible = "semtech,sx1272"; + status = "okay"; + reg = <0x1>; + spi-max-frequency = <3000000>; + + reset-gpios = <&test_gpio 0 0>; + + dio-gpios = <&test_gpio 0 0>, + <&test_gpio 0 0>, + <&test_gpio 0 0>, + <&test_gpio 0 0>; + + power-amplifier-output = "rfo"; + }; + }; + }; +}; diff --git a/tests/drivers/build_all/lora/testcase.yaml b/tests/drivers/build_all/lora/testcase.yaml index c6c4656e69c6d..57f04cbdc5ca6 100644 --- a/tests/drivers/build_all/lora/testcase.yaml +++ b/tests/drivers/build_all/lora/testcase.yaml @@ -2,3 +2,28 @@ tests: sample.driver.lora.rylr.send: extra_args: SHIELD=reyax_lora platform_allow: cy8ckit_062s4 + sample.driver.lora.build.uart: + build_only: true + extra_args: DTC_OVERLAY_FILE="uart_devices.overlay" + extra_configs: + - CONFIG_SERIAL=y + - CONFIG_UART_INTERRUPT_DRIVEN=y + platform_allow: + - native_sim + - native_sim/native/64 + sample.driver.lora.build.sx1262: + build_only: true + extra_args: DTC_OVERLAY_FILE="sx1262.overlay" + extra_configs: + - CONFIG_SPI=y + platform_allow: + - native_sim + - native_sim/native/64 + sample.driver.lora.build.sx1272: + build_only: true + extra_args: DTC_OVERLAY_FILE="sx1272.overlay" + extra_configs: + - CONFIG_SPI=y + platform_allow: + - native_sim + - native_sim/native/64 diff --git a/tests/drivers/build_all/lora/uart_devices.overlay b/tests/drivers/build_all/lora/uart_devices.overlay new file mode 100644 index 0000000000000..25a514bc6d995 --- /dev/null +++ b/tests/drivers/build_all/lora/uart_devices.overlay @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + test { + #address-cells = <1>; + #size-cells = <1>; + + test_gpio: gpio@deadbeef { + compatible = "vnd,gpio"; + gpio-controller; + reg = <0xdeadbeef 0x1000>; + #gpio-cells = <0x2>; + status = "okay"; + }; + + test_uart: uart@55556666 { + compatible = "vnd,serial"; + reg = <0x55556666 0x1000>; + status = "okay"; + + current-speed = <115200>; + test_reyax_rylrxxxx: reyax_rylrxxxx { + compatible = "reyax,rylrxxx"; + status = "okay"; + reset-gpios = <&test_gpio 0 0>; + }; + }; + }; +}; From 1d4c29ab297a6e1a35c76bd5a59ff123a4cb7390 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Fri, 27 Sep 2024 20:04:28 +0900 Subject: [PATCH 0765/4482] drivers: lora: rylrxxx: Fix missing `default y` in LORA_RYLRXXX The `default y`, which is coupled with `depends on DT_HAS_REYAX_RYLRXXX_ENABLED` to link the settings with DeviceTree, which was missing, so I added it. Signed-off-by: TOKITA Hiroshi --- drivers/lora/Kconfig.rylrxxx | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/lora/Kconfig.rylrxxx b/drivers/lora/Kconfig.rylrxxx index 8daf137338d37..dd0e35723210e 100644 --- a/drivers/lora/Kconfig.rylrxxx +++ b/drivers/lora/Kconfig.rylrxxx @@ -6,6 +6,7 @@ config LORA_RYLRXXX bool "Reyax LYLR driver" + default y depends on DT_HAS_REYAX_RYLRXXX_ENABLED select MODEM_MODULES select MODEM_CHAT From 042a40d0e31968dddd76be1282d23617a0b9d325 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Fri, 27 Sep 2024 20:05:10 +0900 Subject: [PATCH 0766/4482] drivers: lora: rylrxxx: Add stdio.h to resolve function prototypes The source code uses functions from stdio.h, such as `sprintf()`, but they are not explicitly included so that we will add it. Signed-off-by: TOKITA Hiroshi --- drivers/lora/rylrxxx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/lora/rylrxxx.c b/drivers/lora/rylrxxx.c index 33fd352027313..d89f14ce012c4 100644 --- a/drivers/lora/rylrxxx.c +++ b/drivers/lora/rylrxxx.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #define DT_DRV_COMPAT reyax_rylrxxx From 6ea04441f932ceb1375acf1dcd661356b6c26e22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20Kr=C3=A4mer?= Date: Fri, 13 Sep 2024 22:08:04 +0200 Subject: [PATCH 0767/4482] drivers: ethernet: Add DP83825 phy driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Includes dt binding Signed-off-by: Bernhard Krämer --- drivers/ethernet/phy/CMakeLists.txt | 1 + drivers/ethernet/phy/Kconfig | 9 + drivers/ethernet/phy/phy_ti_dp83825.c | 602 ++++++++++++++++++++++++++ dts/bindings/ethernet/ti,dp83825.yaml | 23 + 4 files changed, 635 insertions(+) create mode 100644 drivers/ethernet/phy/phy_ti_dp83825.c create mode 100644 dts/bindings/ethernet/ti,dp83825.yaml diff --git a/drivers/ethernet/phy/CMakeLists.txt b/drivers/ethernet/phy/CMakeLists.txt index a6bef065784b5..d94a0c9e7fb67 100644 --- a/drivers/ethernet/phy/CMakeLists.txt +++ b/drivers/ethernet/phy/CMakeLists.txt @@ -4,5 +4,6 @@ zephyr_library_sources_ifdef(CONFIG_PHY_GENERIC_MII phy_mii.c) zephyr_library_sources_ifdef(CONFIG_PHY_ADIN2111 phy_adin2111.c) zephyr_library_sources_ifdef(CONFIG_PHY_TJA1103 phy_tja1103.c) zephyr_library_sources_ifdef(CONFIG_PHY_MICROCHIP_KSZ8081 phy_microchip_ksz8081.c) +zephyr_library_sources_ifdef(CONFIG_PHY_TI_DP83825 phy_ti_dp83825.c) zephyr_library_sources_ifdef(CONFIG_PHY_REALTEK_RTL8211F phy_realtek_rtl8211f.c) zephyr_library_sources_ifdef(CONFIG_PHY_QUALCOMM_AR8031 phy_qualcomm_ar8031.c) diff --git a/drivers/ethernet/phy/Kconfig b/drivers/ethernet/phy/Kconfig index 31659272e2fc3..554616fd0e366 100644 --- a/drivers/ethernet/phy/Kconfig +++ b/drivers/ethernet/phy/Kconfig @@ -49,6 +49,15 @@ config PHY_MICROCHIP_KSZ8081 help Enable Microchip KSZ8081 Ethernet PHY Driver +config PHY_TI_DP83825 + bool "TI DP83825 PHY Driver" + default y + depends on DT_HAS_TI_DP83825_ENABLED + depends on MDIO + depends on GPIO + help + Enable TI DP83825 Ethernet PHY Driver + config PHY_REALTEK_RTL8211F bool "Realtek RTL8211F PHY Driver" default y diff --git a/drivers/ethernet/phy/phy_ti_dp83825.c b/drivers/ethernet/phy/phy_ti_dp83825.c new file mode 100644 index 0000000000000..3f700ac4ec2f4 --- /dev/null +++ b/drivers/ethernet/phy/phy_ti_dp83825.c @@ -0,0 +1,602 @@ +/* + * Copyright 2024 Bernhard Kraemer + * + * Inspiration from phy_realtek_rtl8211f.c, which is: + * Copyright 2023-2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT ti_dp83825 + +#include +#include +#include +#include +#include +#include +#include + +#define LOG_MODULE_NAME phy_ti_dp83825 +#define LOG_LEVEL CONFIG_PHY_LOG_LEVEL +#include +LOG_MODULE_REGISTER(LOG_MODULE_NAME); + +#define PHY_TI_DP83825_PHYSCR_REG 0x11 +#define PHY_TI_DP83825_PHYSCR_REG_IE BIT(1) +#define PHY_TI_DP83825_PHYSCR_REG_IOE BIT(0) + +#define PHY_TI_DP83825_MISR_REG 0x12 +#define PHY_TI_DP83825_MISR_REG_LSCE BIT(5) + +#define PHY_TI_DP83825_RCSR_REG 0x17 +#define PHY_TI_DP83825_RCSR_REF_CLK_SEL BIT(7) + +#define PHY_TI_DP83825_POR_DELAY 50 + +enum dp83825_interface { + DP83825_RMII, + DP83825_RMII_25MHZ +}; + +struct ti_dp83825_config { + uint8_t addr; + const struct device *mdio_dev; + enum dp83825_interface phy_iface; +#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(reset_gpios) + const struct gpio_dt_spec reset_gpio; +#endif +#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) + const struct gpio_dt_spec interrupt_gpio; +#endif +}; + +struct ti_dp83825_data { + const struct device *dev; + struct phy_link_state state; + phy_callback_t cb; +#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) + struct gpio_callback gpio_callback; +#endif + void *cb_data; + struct k_mutex mutex; + struct k_work_delayable phy_monitor_work; +}; + +static int phy_ti_dp83825_read(const struct device *dev, uint16_t reg_addr, uint32_t *data) +{ + const struct ti_dp83825_config *config = dev->config; + int ret; + + /* Make sure excessive bits 16-31 are reset */ + *data = 0U; + + ret = mdio_read(config->mdio_dev, config->addr, reg_addr, (uint16_t *)data); + if (ret) { + return ret; + } + + return 0; +} + +static int phy_ti_dp83825_write(const struct device *dev, uint16_t reg_addr, uint32_t data) +{ + const struct ti_dp83825_config *config = dev->config; + int ret; + + ret = mdio_write(config->mdio_dev, config->addr, reg_addr, (uint16_t)data); + if (ret) { + return ret; + } + + return 0; +} + +#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) +static int phy_ti_dp83825_clear_interrupt(struct ti_dp83825_data *data) +{ + const struct device *dev = data->dev; + const struct ti_dp83825_config *config = dev->config; + uint32_t reg_val; + int ret; + + /* Lock mutex */ + ret = k_mutex_lock(&data->mutex, K_FOREVER); + if (ret) { + LOG_ERR("PHY mutex lock error"); + return ret; + } + + /* Read/clear PHY interrupt status register */ + ret = phy_ti_dp83825_read(dev, PHY_TI_DP83825_MISR_REG, ®_val); + if (ret) { + LOG_ERR("Error reading phy (%d) interrupt status register", config->addr); + } + + /* Unlock mutex */ + (void)k_mutex_unlock(&data->mutex); + + return ret; +} + +static void phy_ti_dp83825_interrupt_handler(const struct device *port, struct gpio_callback *cb, + gpio_port_pins_t pins) +{ + struct ti_dp83825_data *data = CONTAINER_OF(cb, struct ti_dp83825_data, gpio_callback); + int ret; + + ret = k_work_reschedule(&data->phy_monitor_work, K_NO_WAIT); + if (ret < 0) { + LOG_ERR("Failed to schedule phy_monitor_work from ISR"); + } +} +#endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) */ + +static int phy_ti_dp83825_autonegotiate(const struct device *dev) +{ + const struct ti_dp83825_config *config = dev->config; + int ret; + uint32_t bmcr = 0; + + /* Read control register to write back with autonegotiation bit */ + ret = phy_ti_dp83825_read(dev, MII_BMCR, &bmcr); + if (ret) { + LOG_ERR("Error reading phy (%d) basic control register", config->addr); + return ret; + } + + /* (re)start autonegotiation */ + LOG_DBG("PHY (%d) is entering autonegotiation sequence", config->addr); + bmcr |= MII_BMCR_AUTONEG_ENABLE | MII_BMCR_AUTONEG_RESTART; + bmcr &= ~MII_BMCR_ISOLATE; + + ret = phy_ti_dp83825_write(dev, MII_BMCR, bmcr); + if (ret) { + LOG_ERR("Error writing phy (%d) basic control register", config->addr); + return ret; + } + + return 0; +} + +static int phy_ti_dp83825_get_link(const struct device *dev, struct phy_link_state *state) +{ + const struct ti_dp83825_config *config = dev->config; + struct ti_dp83825_data *data = dev->data; + int ret; + uint32_t bmsr = 0; + uint32_t anar = 0; + uint32_t anlpar = 0; + uint32_t mutual_capabilities; + struct phy_link_state old_state = data->state; + + /* Lock mutex */ + ret = k_mutex_lock(&data->mutex, K_FOREVER); + if (ret) { + LOG_ERR("PHY mutex lock error"); + return ret; + } + + /* Read link state */ + ret = phy_ti_dp83825_read(dev, MII_BMSR, &bmsr); + if (ret) { + LOG_ERR("Error reading phy (%d) basic status register", config->addr); + k_mutex_unlock(&data->mutex); + return ret; + } + state->is_up = bmsr & MII_BMSR_LINK_STATUS; + + if (!state->is_up) { + k_mutex_unlock(&data->mutex); + goto result; + } + + /* Read currently configured advertising options */ + ret = phy_ti_dp83825_read(dev, MII_ANAR, &anar); + if (ret) { + LOG_ERR("Error reading phy (%d) advertising register", config->addr); + k_mutex_unlock(&data->mutex); + return ret; + } + + /* Read link partner capability */ + ret = phy_ti_dp83825_read(dev, MII_ANLPAR, &anlpar); + if (ret) { + LOG_ERR("Error reading phy (%d) link partner register", config->addr); + k_mutex_unlock(&data->mutex); + return ret; + } + + /* Unlock mutex */ + k_mutex_unlock(&data->mutex); + + mutual_capabilities = anar & anlpar; + + if (mutual_capabilities & MII_ADVERTISE_100_FULL) { + state->speed = LINK_FULL_100BASE_T; + } else if (mutual_capabilities & MII_ADVERTISE_100_HALF) { + state->speed = LINK_HALF_100BASE_T; + } else if (mutual_capabilities & MII_ADVERTISE_10_FULL) { + state->speed = LINK_FULL_10BASE_T; + } else if (mutual_capabilities & MII_ADVERTISE_10_HALF) { + state->speed = LINK_HALF_10BASE_T; + } else { + return -EIO; + } + +result: + if (memcmp(&old_state, state, sizeof(struct phy_link_state)) != 0) { + LOG_DBG("PHY %d is %s", config->addr, state->is_up ? "up" : "down"); + if (state->is_up) { + LOG_INF("PHY (%d) Link speed %s Mb, %s duplex\n", config->addr, + (PHY_LINK_IS_SPEED_100M(state->speed) ? "100" : "10"), + PHY_LINK_IS_FULL_DUPLEX(state->speed) ? "full" : "half"); + } + } + + return ret; +} + +/* + * Configuration set statically (DT) that should never change + * This function is needed in case the PHY is reset then the next call + * to configure the phy will ensure this configuration will be redone + */ +static int phy_ti_dp83825_static_cfg(const struct device *dev) +{ + const struct ti_dp83825_config *config = dev->config; +#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) + struct ti_dp83825_data *data = dev->data; +#endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) */ + uint32_t reg_val = 0; + int ret = 0; + + /* Select correct reference clock mode depending on interface setup */ + ret = phy_ti_dp83825_read(dev, PHY_TI_DP83825_RCSR_REG, (uint32_t *)®_val); + if (ret) { + return ret; + } + + if (config->phy_iface == DP83825_RMII) { + reg_val |= PHY_TI_DP83825_RCSR_REF_CLK_SEL; + } else { + reg_val &= ~PHY_TI_DP83825_RCSR_REF_CLK_SEL; + } + + ret = phy_ti_dp83825_write(dev, PHY_TI_DP83825_RCSR_REG, (uint32_t)reg_val); + if (ret) { + return ret; + } + +#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) + /* Read PHYSCR register to write back */ + ret = phy_ti_dp83825_read(dev, PHY_TI_DP83825_PHYSCR_REG, ®_val); + if (ret) { + return ret; + } + + /* Config INTR/PWRDN pin as Interrupt output, enable event interrupts */ + reg_val |= PHY_TI_DP83825_PHYSCR_REG_IOE | PHY_TI_DP83825_PHYSCR_REG_IE; + + /* Write settings to physcr register */ + ret = phy_ti_dp83825_write(dev, PHY_TI_DP83825_PHYSCR_REG, reg_val); + if (ret) { + return ret; + } + + /* Clear interrupt */ + ret = phy_ti_dp83825_clear_interrupt(data); + if (ret) { + return ret; + } + + /* Read MISR register to write back */ + ret = phy_ti_dp83825_read(dev, PHY_TI_DP83825_MISR_REG, ®_val); + if (ret) { + return ret; + } + + /* Enable link state changed interrupt*/ + reg_val |= PHY_TI_DP83825_MISR_REG_LSCE; + + /* Write settings to misr register */ + ret = phy_ti_dp83825_write(dev, PHY_TI_DP83825_MISR_REG, reg_val); +#endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) */ + + return ret; +} + +static int phy_ti_dp83825_reset(const struct device *dev) +{ + const struct ti_dp83825_config *config = dev->config; + struct ti_dp83825_data *data = dev->data; + int ret; + + /* Lock mutex */ + ret = k_mutex_lock(&data->mutex, K_FOREVER); + if (ret) { + LOG_ERR("PHY mutex lock error"); + return ret; + } + +#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(reset_gpios) + if (!config->reset_gpio.port) { + goto skip_reset_gpio; + } + + /* Start reset (logically ACTIVE, physically LOW) */ + ret = gpio_pin_set_dt(&config->reset_gpio, 1); + if (ret) { + goto done; + } + + /* Reset pulse (minimum specified width is T1=25us) */ + k_busy_wait(USEC_PER_MSEC * 1); + + /* Reset over (logically INACTIVE, physically HIGH) */ + ret = gpio_pin_set_dt(&config->reset_gpio, 0); + + /* POR release time (minimum specified is T4=50ms) */ + k_busy_wait(USEC_PER_MSEC * PHY_TI_DP83825_POR_DELAY); + + goto done; +skip_reset_gpio: +#endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(reset_gpios) */ + ret = phy_ti_dp83825_write(dev, MII_BMCR, MII_BMCR_RESET); + if (ret) { + goto done; + } + /* POR release time (minimum specified is T4=50ms) */ + k_busy_wait(USEC_PER_MSEC * PHY_TI_DP83825_POR_DELAY); + +done: + /* Unlock mutex */ + k_mutex_unlock(&data->mutex); + + LOG_DBG("PHY (%d) reset completed", config->addr); + + return ret; +} + +static int phy_ti_dp83825_cfg_link(const struct device *dev, enum phy_link_speed speeds) +{ + const struct ti_dp83825_config *config = dev->config; + struct ti_dp83825_data *data = dev->data; + int ret; + uint32_t anar; + + /* Lock mutex */ + ret = k_mutex_lock(&data->mutex, K_FOREVER); + if (ret) { + LOG_ERR("PHY mutex lock error"); + goto done; + } + + /* We are going to reconfigure the phy, don't need to monitor until done */ +#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) + if (!config->interrupt_gpio.port) { + k_work_cancel_delayable(&data->phy_monitor_work); + } +#else + k_work_cancel_delayable(&data->phy_monitor_work); +#endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) */ + + /* Reset PHY */ + ret = phy_ti_dp83825_reset(dev); + if (ret) { + goto done; + } + + /* DT configurations */ + ret = phy_ti_dp83825_static_cfg(dev); + if (ret) { + goto done; + } + + /* Read ANAR register to write back */ + ret = phy_ti_dp83825_read(dev, MII_ANAR, &anar); + if (ret) { + LOG_ERR("Error reading phy (%d) advertising register", config->addr); + goto done; + } + + /* Setup advertising register */ + if (speeds & LINK_FULL_100BASE_T) { + anar |= MII_ADVERTISE_100_FULL; + } else { + anar &= ~MII_ADVERTISE_100_FULL; + } + + if (speeds & LINK_HALF_100BASE_T) { + anar |= MII_ADVERTISE_100_HALF; + } else { + anar &= ~MII_ADVERTISE_100_HALF; + } + + if (speeds & LINK_FULL_10BASE_T) { + anar |= MII_ADVERTISE_10_FULL; + } else { + anar &= ~MII_ADVERTISE_10_FULL; + } + + if (speeds & LINK_HALF_10BASE_T) { + anar |= MII_ADVERTISE_10_HALF; + } else { + anar &= ~MII_ADVERTISE_10_HALF; + } + + /* Write capabilities to advertising register */ + ret = phy_ti_dp83825_write(dev, MII_ANAR, anar); + if (ret) { + LOG_ERR("Error writing phy (%d) advertising register", config->addr); + goto done; + } + + /* (re)do autonegotiation */ + ret = phy_ti_dp83825_autonegotiate(dev); + if (ret && (ret != -ENETDOWN)) { + LOG_ERR("Error in autonegotiation"); + goto done; + } + +done: + /* Unlock mutex */ + k_mutex_unlock(&data->mutex); + + /* Start monitoring */ +#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) + if (!config->interrupt_gpio.port) { + k_work_reschedule(&data->phy_monitor_work, K_MSEC(CONFIG_PHY_MONITOR_PERIOD)); + } +#else + k_work_reschedule(&data->phy_monitor_work, K_MSEC(CONFIG_PHY_MONITOR_PERIOD)); +#endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) */ + + return ret; +} + +static int phy_ti_dp83825_link_cb_set(const struct device *dev, phy_callback_t cb, void *user_data) +{ + struct ti_dp83825_data *data = dev->data; + + data->cb = cb; + data->cb_data = user_data; + + phy_ti_dp83825_get_link(dev, &data->state); + + data->cb(dev, &data->state, data->cb_data); + + return 0; +} + +static void phy_ti_dp83825_monitor_work_handler(struct k_work *work) +{ + struct k_work_delayable *dwork = k_work_delayable_from_work(work); + struct ti_dp83825_data *data = + CONTAINER_OF(dwork, struct ti_dp83825_data, phy_monitor_work); + const struct device *dev = data->dev; +#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) + const struct ti_dp83825_config *config = dev->config; +#endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) */ + struct phy_link_state state = {}; + int ret; + +#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) + if (config->interrupt_gpio.port) { + ret = phy_ti_dp83825_clear_interrupt(data); + if (ret) { + return; + } + } +#endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) */ + + ret = phy_ti_dp83825_get_link(dev, &state); + + if (ret == 0 && memcmp(&state, &data->state, sizeof(struct phy_link_state)) != 0) { + memcpy(&data->state, &state, sizeof(struct phy_link_state)); + if (data->cb) { + data->cb(dev, &data->state, data->cb_data); + } + } + +#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) + if (!config->interrupt_gpio.port) { + k_work_reschedule(&data->phy_monitor_work, K_MSEC(CONFIG_PHY_MONITOR_PERIOD)); + } +#else + k_work_reschedule(&data->phy_monitor_work, K_MSEC(CONFIG_PHY_MONITOR_PERIOD)); +#endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) */ +} + +static int phy_ti_dp83825_init(const struct device *dev) +{ + const struct ti_dp83825_config *config = dev->config; + struct ti_dp83825_data *data = dev->data; + int ret; + + data->dev = dev; + + ret = k_mutex_init(&data->mutex); + if (ret) { + return ret; + } + + mdio_bus_enable(config->mdio_dev); + +#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(reset_gpios) + if (config->reset_gpio.port) { + ret = gpio_pin_configure_dt(&config->reset_gpio, GPIO_OUTPUT_INACTIVE); + if (ret) { + return ret; + } + } +#endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(reset_gpios) */ + + k_work_init_delayable(&data->phy_monitor_work, phy_ti_dp83825_monitor_work_handler); + +#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) + if (!config->interrupt_gpio.port) { + phy_ti_dp83825_monitor_work_handler(&data->phy_monitor_work.work); + goto skip_int_gpio; + } + + /* Configure interrupt pin */ + ret = gpio_pin_configure_dt(&config->interrupt_gpio, GPIO_INPUT); + if (ret) { + return ret; + } + + gpio_init_callback(&data->gpio_callback, phy_ti_dp83825_interrupt_handler, + BIT(config->interrupt_gpio.pin)); + ret = gpio_add_callback_dt(&config->interrupt_gpio, &data->gpio_callback); + if (ret) { + return ret; + } + + ret = gpio_pin_interrupt_configure_dt(&config->interrupt_gpio, GPIO_INT_EDGE_TO_ACTIVE); + if (ret) { + return ret; + } + +skip_int_gpio: +#else + phy_ti_dp83825_monitor_work_handler(&data->phy_monitor_work.work); +#endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) */ + + return 0; +} + +static const struct ethphy_driver_api ti_dp83825_phy_api = { + .get_link = phy_ti_dp83825_get_link, + .cfg_link = phy_ti_dp83825_cfg_link, + .link_cb_set = phy_ti_dp83825_link_cb_set, + .read = phy_ti_dp83825_read, + .write = phy_ti_dp83825_write, +}; + +#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(reset_gpios) +#define RESET_GPIO(n) .reset_gpio = GPIO_DT_SPEC_INST_GET_OR(n, reset_gpios, {0}), +#else +#define RESET_GPIO(n) +#endif /* reset gpio */ + +#if DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) +#define INTERRUPT_GPIO(n) .interrupt_gpio = GPIO_DT_SPEC_INST_GET_OR(n, int_gpios, {0}), +#else +#define INTERRUPT_GPIO(n) +#endif /* interrupt gpio */ + +#define TI_DP83825_INIT(n) \ + static const struct ti_dp83825_config ti_dp83825_##n##_config = { \ + .addr = DT_INST_REG_ADDR(n), \ + .mdio_dev = DEVICE_DT_GET(DT_INST_PARENT(n)), \ + .phy_iface = DT_INST_ENUM_IDX(n, ti_interface_type), \ + RESET_GPIO(n) INTERRUPT_GPIO(n)}; \ + \ + static struct ti_dp83825_data ti_dp83825_##n##_data; \ + \ + DEVICE_DT_INST_DEFINE(n, &phy_ti_dp83825_init, NULL, &ti_dp83825_##n##_data, \ + &ti_dp83825_##n##_config, POST_KERNEL, CONFIG_PHY_INIT_PRIORITY, \ + &ti_dp83825_phy_api); + +DT_INST_FOREACH_STATUS_OKAY(TI_DP83825_INIT) diff --git a/dts/bindings/ethernet/ti,dp83825.yaml b/dts/bindings/ethernet/ti,dp83825.yaml new file mode 100644 index 0000000000000..4846f31f08eac --- /dev/null +++ b/dts/bindings/ethernet/ti,dp83825.yaml @@ -0,0 +1,23 @@ +# Copyright 2023-2024 NXP +# SPDX-License-Identifier: Apache-2.0 + +description: TI DP83825 Ethernet PHY device + +compatible: "ti,dp83825" + +include: ethernet-phy.yaml + +properties: + reset-gpios: + type: phandle-array + description: GPIO connected to PHY reset signal pin. Reset is active low. + int-gpios: + type: phandle-array + description: GPIO for interrupt signal indicating PHY state change. + ti,interface-type: + type: string + required: true + description: Which type of phy connection the phy is set up for + enum: + - "rmii" + - "rmii-25MHz" From b4a35d9b102027b6be0f1be40a17a7954b5d6686 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20Kr=C3=A4mer?= Date: Fri, 13 Sep 2024 22:10:14 +0200 Subject: [PATCH 0768/4482] boards: teensy4: Update config for ethernet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Updates teensy board configs for use with new `eth_nxp_enet.c` driver - Remove ethernet configs from teensy40 (4.0 has no ethernet phy) - Adds a device entry to include `tests/drivers/build_all/ethernet/` Signed-off-by: Bernhard Krämer --- boards/pjrc/teensy4/Kconfig.defconfig | 8 ++++ boards/pjrc/teensy4/teensy4-pinctrl.dtsi | 48 ++++++++++++------------ boards/pjrc/teensy4/teensy40.dts | 18 +-------- boards/pjrc/teensy4/teensy41.dts | 23 ++++++++++++ boards/pjrc/teensy4/teensy41.yaml | 1 + 5 files changed, 57 insertions(+), 41 deletions(-) diff --git a/boards/pjrc/teensy4/Kconfig.defconfig b/boards/pjrc/teensy4/Kconfig.defconfig index 4bdd626e94a62..2af9d12ef9f09 100644 --- a/boards/pjrc/teensy4/Kconfig.defconfig +++ b/boards/pjrc/teensy4/Kconfig.defconfig @@ -13,4 +13,12 @@ config BUILD_OUTPUT_HEX config DISK_DRIVER_SDMMC default y if DISK_DRIVERS +if NETWORKING + +config NET_L2_ETHERNET + default n if BOARD_TEENSY40 + default y if BOARD_TEENSY41 + +endif # NETWORKING + endif # BOARD_TEENSY40 || BOARD_TEENSY41 diff --git a/boards/pjrc/teensy4/teensy4-pinctrl.dtsi b/boards/pjrc/teensy4/teensy4-pinctrl.dtsi index 430020f5098f3..c12573cb6b38e 100644 --- a/boards/pjrc/teensy4/teensy4-pinctrl.dtsi +++ b/boards/pjrc/teensy4/teensy4-pinctrl.dtsi @@ -1,5 +1,6 @@ /* * Copyright (c) 2022, NXP + * Copyright (c) 2024, Bernhard Kraemer * SPDX-License-Identifier: Apache-2.0 * * Note: File generated by gen_board_pinctrl.py @@ -12,41 +13,40 @@ /* Mode Straps configuration DP83825 */ pinmux_enet: pinmux_enet { group0 { + pinmux = <&iomuxc_gpio_b1_10_enet_ref_clk>; + bias-disable; + drive-strength = "r0-6"; + slew-rate = "slow"; + nxp,speed = "100-mhz"; + input-enable; + }; + group1 { pinmux = <&iomuxc_gpio_b1_04_enet_rx_data0>, + <&iomuxc_gpio_b1_05_enet_rx_data1>, <&iomuxc_gpio_b1_06_enet_rx_en>, + <&iomuxc_gpio_b1_07_enet_tx_data0>, + <&iomuxc_gpio_b1_08_enet_tx_data1>, + <&iomuxc_gpio_b1_09_enet_tx_en>, <&iomuxc_gpio_b1_11_enet_rx_er>; drive-strength = "r0-5"; - bias-pull-down; - bias-pull-down-value = "100k"; - slew-rate = "fast"; - nxp,speed = "200-mhz"; - }; - group1 { - pinmux = <&iomuxc_gpio_b1_05_enet_rx_data1>; - drive-strength = "r0-5"; bias-pull-up; - bias-pull-up-value = "22k"; + bias-pull-up-value = "100k"; slew-rate = "fast"; nxp,speed = "200-mhz"; }; - group2 { - pinmux = <&iomuxc_gpio_b1_07_enet_tx_data0>, - <&iomuxc_gpio_b1_08_enet_tx_data1>, - <&iomuxc_gpio_b1_09_enet_tx_en>, - <&iomuxc_gpio_b1_14_enet_mdc>, + }; + + pinmux_enet_mdio: pinmux_enet_mdio { + group0 { + pinmux = <&iomuxc_gpio_b1_14_enet_mdc>, <&iomuxc_gpio_b1_15_enet_mdio>, <&iomuxc_gpio_b0_15_gpio2_io15>, <&iomuxc_gpio_b0_14_gpio2_io14>; - drive-strength = "r0-6"; - slew-rate = "slow"; - nxp,speed = "100-mhz"; - }; - group3 { - pinmux = <&iomuxc_gpio_b1_10_enet_ref_clk>; - drive-strength = "r0-6"; - slew-rate = "slow"; - nxp,speed = "100-mhz"; - input-enable; + drive-strength = "r0-5"; + bias-pull-up; + bias-pull-up-value = "100k"; + slew-rate = "fast"; + nxp,speed = "200-mhz"; }; }; diff --git a/boards/pjrc/teensy4/teensy40.dts b/boards/pjrc/teensy4/teensy40.dts index 63775c3d1c618..ddbefe8d8c9d6 100644 --- a/boards/pjrc/teensy4/teensy40.dts +++ b/boards/pjrc/teensy4/teensy40.dts @@ -70,24 +70,8 @@ zephyr_udc0: &usb1 { status = "okay"; }; -/* Pinmux settings */ -&enet_mac { - pinctrl-0 = <&pinmux_enet>; - pinctrl-names = "default"; - zephyr,random-mac-address; - phy-connection-type = "rmii"; - phy-handle = <&phy>; -}; - -&enet_mdio { +&edma0 { status = "okay"; - pinctrl-0 = <&pinmux_enet>; - pinctrl-names = "default"; - phy: phy@0 { - compatible = "ethernet-phy"; - reg = <0>; - status = "okay"; - }; }; &flexcan1 { diff --git a/boards/pjrc/teensy4/teensy41.dts b/boards/pjrc/teensy4/teensy41.dts index e113183c66f52..c742bcc8009f1 100644 --- a/boards/pjrc/teensy4/teensy41.dts +++ b/boards/pjrc/teensy4/teensy41.dts @@ -34,6 +34,29 @@ }; }; +&enet_mac { + status = "okay"; + pinctrl-0 = <&pinmux_enet>; + pinctrl-names = "default"; + nxp,unique-mac; + phy-connection-type = "rmii"; + phy-handle = <&phy>; +}; + +&enet_mdio { + status = "okay"; + pinctrl-0 = <&pinmux_enet_mdio>; + pinctrl-names = "default"; + phy: phy@0 { + status = "okay"; + compatible = "ti,dp83825"; + reg = <0>; + reset-gpios = <&gpio2 14 GPIO_ACTIVE_LOW>; + int-gpios = <&gpio2 15 GPIO_ACTIVE_LOW>; + ti,interface-type = "rmii"; + }; +}; + &lpspi3 { status = "okay"; }; diff --git a/boards/pjrc/teensy4/teensy41.yaml b/boards/pjrc/teensy4/teensy41.yaml index b2ad1e303ca70..18f320a2df614 100644 --- a/boards/pjrc/teensy4/teensy41.yaml +++ b/boards/pjrc/teensy4/teensy41.yaml @@ -19,6 +19,7 @@ supported: - gpio - sdhc - usb_device + - netif:eth testing: ignore_tags: - net From 221199e15b85a070b3d81709eee3d533c9f99967 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Wed, 11 Sep 2024 15:42:53 +0100 Subject: [PATCH 0769/4482] runners: jlink: add support for J-Link tunnels This adds support for J-Link tunnels, which run on top of an IP network and therefore uses the -IP option. J-Link tunnels are identified by a tunnel: prefix instead of a bare IP address. This change checks for the presence of such a prefix, and choses the -IP transport option if the tunnel prefix is found. This has been tested with J-Link Remote Server v7.98g and the SEGGER tunnel option. Signed-off-by: Adam Dunkels --- scripts/west_commands/runners/jlink.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/west_commands/runners/jlink.py b/scripts/west_commands/runners/jlink.py index af4a0fe8787e7..ce50049034923 100644 --- a/scripts/west_commands/runners/jlink.py +++ b/scripts/west_commands/runners/jlink.py @@ -36,6 +36,9 @@ def is_ip(ip): return False return True +def is_tunnel(tunnel): + return tunnel.startswith("tunnel:") + class ToggleAction(argparse.Action): def __call__(self, parser, args, ignored, option): @@ -247,7 +250,7 @@ def do_run(self, command, **kwargs): server_cmd = ([self.gdbserver] + ['-select', - ('ip' if is_ip(self.dev_id) else 'usb') + + ('ip' if (is_ip(self.dev_id) or is_tunnel(self.dev_id)) else 'usb') + (f'={self.dev_id}' if self.dev_id else ''), '-port', str(self.gdb_port), '-if', self.iface, @@ -404,7 +407,7 @@ def flash(self, **kwargs): loader_details = "?" + self.loader cmd = ([self.commander] + - (['-IP', f'{self.dev_id}'] if is_ip(self.dev_id) else (['-USB', f'{self.dev_id}'] if self.dev_id else [])) + + (['-IP', f'{self.dev_id}'] if (is_ip(self.dev_id) or is_tunnel(self.dev_id)) else (['-USB', f'{self.dev_id}'] if self.dev_id else [])) + (['-nogui', '1'] if self.supports_nogui else []) + ['-if', self.iface, '-speed', self.speed, From 7461f3781eccf0620ed2d494a18097d2c3d3de8a Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Wed, 31 Jul 2024 10:21:13 +0200 Subject: [PATCH 0770/4482] Bluetooth: CCID: Rename ccid_get_value to alloc_value alloc_value is more correct as it does allocate a new value, rather than just returning/getting a value. Signed-off-by: Emil Gydesen --- subsys/bluetooth/audio/ccid.c | 2 +- subsys/bluetooth/audio/ccid_internal.h | 2 +- subsys/bluetooth/audio/mpl.c | 2 +- subsys/bluetooth/audio/tbs.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/audio/ccid.c b/subsys/bluetooth/audio/ccid.c index 60991a54a8b75..ebbc47acf0dc9 100644 --- a/subsys/bluetooth/audio/ccid.c +++ b/subsys/bluetooth/audio/ccid.c @@ -17,7 +17,7 @@ #include "ccid_internal.h" -uint8_t bt_ccid_get_value(void) +uint8_t bt_ccid_alloc_value(void) { static uint8_t ccid_value; diff --git a/subsys/bluetooth/audio/ccid_internal.h b/subsys/bluetooth/audio/ccid_internal.h index b67331f00a3f7..d57a4aed09a84 100644 --- a/subsys/bluetooth/audio/ccid_internal.h +++ b/subsys/bluetooth/audio/ccid_internal.h @@ -22,7 +22,7 @@ * * @return uint8_t A content control ID value. */ -uint8_t bt_ccid_get_value(void); +uint8_t bt_ccid_alloc_value(void); /** * @brief Get the GATT attribute of a CCID value diff --git a/subsys/bluetooth/audio/mpl.c b/subsys/bluetooth/audio/mpl.c index c6a7897cbc9ee..764724e1789dd 100644 --- a/subsys/bluetooth/audio/mpl.c +++ b/subsys/bluetooth/audio/mpl.c @@ -2353,7 +2353,7 @@ int media_proxy_pl_init(void) #endif /* CONFIG_BT_MCS */ /* Get a Content Control ID */ - media_player.content_ctrl_id = bt_ccid_get_value(); + media_player.content_ctrl_id = bt_ccid_alloc_value(); #ifdef CONFIG_BT_MPL_OBJECTS /* Initialize the object content buffer */ diff --git a/subsys/bluetooth/audio/tbs.c b/subsys/bluetooth/audio/tbs.c index a978ab212dfc8..d3b4635699791 100644 --- a/subsys/bluetooth/audio/tbs.c +++ b/subsys/bluetooth/audio/tbs.c @@ -1515,7 +1515,7 @@ static int tbs_inst_init_and_register(struct tbs_inst *inst, struct bt_gatt_serv LOG_DBG("inst %p index 0x%02x", inst, inst_index(inst)); - inst->ccid = bt_ccid_get_value(); + inst->ccid = bt_ccid_alloc_value(); (void)utf8_lcpy(inst->provider_name, param->provider_name, sizeof(inst->provider_name)); (void)utf8_lcpy(inst->uci, param->uci, sizeof(inst->uci)); (void)utf8_lcpy(inst->uri_scheme_list, param->uri_schemes_supported, From 5f1a5738093021eeb113bbe1e84beb300218b6fe Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Wed, 31 Jul 2024 10:46:08 +0200 Subject: [PATCH 0771/4482] Bluetooth: CCID: Improved CCID allocation Rather than throwing an assert, it will now do a better check for already-allocated CCIDs and return an error instead. Signed-off-by: Emil Gydesen --- subsys/bluetooth/audio/ccid.c | 41 ++++++++++++++++---------- subsys/bluetooth/audio/ccid_internal.h | 14 +++++---- subsys/bluetooth/audio/mpl.c | 13 +++++--- subsys/bluetooth/audio/tbs.c | 18 +++++++---- 4 files changed, 54 insertions(+), 32 deletions(-) diff --git a/subsys/bluetooth/audio/ccid.c b/subsys/bluetooth/audio/ccid.c index ebbc47acf0dc9..7b437bd3bdb32 100644 --- a/subsys/bluetooth/audio/ccid.c +++ b/subsys/bluetooth/audio/ccid.c @@ -2,10 +2,11 @@ /* * Copyright (c) 2020 Bose Corporation - * Copyright (c) 2021 Nordic Semiconductor ASA + * Copyright (c) 2021-2024 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ +#include #include #include #include @@ -17,21 +18,6 @@ #include "ccid_internal.h" -uint8_t bt_ccid_alloc_value(void) -{ - static uint8_t ccid_value; - - /* By spec, the CCID can take all values up to and including 0xFF. - * But since this is a value we provide, we do not have to use all of - * them. 254 CCID values on a device should be plenty, the last one - * can be used to prevent wraparound. - */ - __ASSERT(ccid_value != UINT8_MAX, - "Cannot allocate any more control control IDs"); - - return ccid_value++; -} - struct ccid_search_param { const struct bt_gatt_attr *attr; uint8_t ccid; @@ -69,3 +55,26 @@ const struct bt_gatt_attr *bt_ccid_find_attr(uint8_t ccid) return search_param.attr; } + +int bt_ccid_alloc_value(void) +{ + static uint8_t next_ccid_value; + const uint8_t tmp = next_ccid_value; + + /* Verify that the CCID is unused and increment until we reach an unused value or until we + * reach our starting point + * This is not a perfect check as there may be services that are not registered that have + * allocated a CCID. + * Implementing a perfect solution would require a alloc and free API where we need to + * keep track of all allocated CCIDs, which requires additional memory for something that's + * very unlikely to be an issue. + */ + while (bt_ccid_find_attr(next_ccid_value) != NULL) { + next_ccid_value++; + if (tmp == next_ccid_value) { + return -ENOMEM; + } + } + + return next_ccid_value++; +} diff --git a/subsys/bluetooth/audio/ccid_internal.h b/subsys/bluetooth/audio/ccid_internal.h index d57a4aed09a84..d989d7bd6f33a 100644 --- a/subsys/bluetooth/audio/ccid_internal.h +++ b/subsys/bluetooth/audio/ccid_internal.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2020 Bose Corporation - * Copyright (c) 2021 Nordic Semiconductor ASA + * Copyright (c) 2021-2024 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ @@ -15,14 +15,16 @@ #include /** - * @brief Gets a free CCID value. + * @brief Allocates a CCID value. * - * The maximum number of CCID values that can retrieved on the device is 0xFE, - * one less than per the GSS specification. + * This should always be called right before registering a GATT service that contains a + * @ref BT_UUID_CCID characteristic. Allocating a CCID without registering the characteristic + * may (in very rare cases) result in duplicated CCIDs on the device. * - * @return uint8_t A content control ID value. + * @retval ccid 8-bit unsigned CCID value on success + * @retval -ENOMEM if no more CCIDs can be allocated */ -uint8_t bt_ccid_alloc_value(void); +int bt_ccid_alloc_value(void); /** * @brief Get the GATT attribute of a CCID value diff --git a/subsys/bluetooth/audio/mpl.c b/subsys/bluetooth/audio/mpl.c index 764724e1789dd..b657fe5beffce 100644 --- a/subsys/bluetooth/audio/mpl.c +++ b/subsys/bluetooth/audio/mpl.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -29,7 +30,6 @@ #include #include -#include "ccid_internal.h" #include "media_proxy_internal.h" #include "mcs_internal.h" #include "mpl_internal.h" @@ -2318,6 +2318,14 @@ int media_proxy_pl_init(void) return -EALREADY; } + /* Get a Content Control ID */ + ret = bt_ccid_alloc_value(); + if (ret < 0) { + LOG_DBG("Could not allocate CCID: %d", ret); + return ret; + } + media_player.content_ctrl_id = (uint8_t)ret; + /* Set up the media control service */ /* TODO: Fix initialization - who initializes what * https://github.com/zephyrproject-rtos/zephyr/issues/42965 @@ -2352,9 +2360,6 @@ int media_proxy_pl_init(void) LOG_WRN("MCS not configured"); #endif /* CONFIG_BT_MCS */ - /* Get a Content Control ID */ - media_player.content_ctrl_id = bt_ccid_alloc_value(); - #ifdef CONFIG_BT_MPL_OBJECTS /* Initialize the object content buffer */ net_buf_simple_init(obj.content, 0); diff --git a/subsys/bluetooth/audio/tbs.c b/subsys/bluetooth/audio/tbs.c index d3b4635699791..e828f887edb00 100644 --- a/subsys/bluetooth/audio/tbs.c +++ b/subsys/bluetooth/audio/tbs.c @@ -1511,11 +1511,17 @@ static void signal_interval_timeout(struct k_work *work) static int tbs_inst_init_and_register(struct tbs_inst *inst, struct bt_gatt_service *svc, const struct bt_tbs_register_param *param) { - int err; + int ret; LOG_DBG("inst %p index 0x%02x", inst, inst_index(inst)); - inst->ccid = bt_ccid_alloc_value(); + ret = bt_ccid_alloc_value(); + if (ret < 0) { + LOG_DBG("Could not allocate CCID: %d", ret); + return ret; + } + + inst->ccid = (uint8_t)ret; (void)utf8_lcpy(inst->provider_name, param->provider_name, sizeof(inst->provider_name)); (void)utf8_lcpy(inst->uci, param->uci, sizeof(inst->uci)); (void)utf8_lcpy(inst->uri_scheme_list, param->uri_schemes_supported, @@ -1528,12 +1534,12 @@ static int tbs_inst_init_and_register(struct tbs_inst *inst, struct bt_gatt_serv k_work_init_delayable(&inst->reporting_interval_work, signal_interval_timeout); - err = bt_gatt_service_register(svc); - if (err != 0) { - LOG_DBG("Could not register %sTBS: %d", param->gtbs ? "G" : "", err); + ret = bt_gatt_service_register(svc); + if (ret != 0) { + LOG_DBG("Could not register %sTBS: %d", param->gtbs ? "G" : "", ret); memset(inst, 0, sizeof(*inst)); - return err; + return ret; } return inst_index(inst); From 203bcf3774991ff3c705ff6437bff8e3a6d7315e Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Wed, 31 Jul 2024 10:54:29 +0200 Subject: [PATCH 0772/4482] Bluetooth: CCID: Make the CCID API public Move the CCID header to the include directory to make it public. This also compiles the ccid.c file whenver CONFIG_BT_CONN is enabled, rather than having an additional Kconfig for it, since the API is now public and may be used by other than our internal services. Signed-off-by: Emil Gydesen --- include/zephyr/bluetooth/audio/ccid.h | 74 ++++++++++++++++++++++++++ subsys/bluetooth/audio/CMakeLists.txt | 4 +- subsys/bluetooth/audio/Kconfig | 6 --- subsys/bluetooth/audio/Kconfig.mcs | 1 - subsys/bluetooth/audio/Kconfig.mpl | 1 - subsys/bluetooth/audio/Kconfig.tbs | 1 - subsys/bluetooth/audio/cap_initiator.c | 7 +-- subsys/bluetooth/audio/ccid.c | 3 +- subsys/bluetooth/audio/ccid_internal.h | 41 -------------- subsys/bluetooth/audio/tbs.c | 2 +- 10 files changed, 83 insertions(+), 57 deletions(-) create mode 100644 include/zephyr/bluetooth/audio/ccid.h delete mode 100644 subsys/bluetooth/audio/ccid_internal.h diff --git a/include/zephyr/bluetooth/audio/ccid.h b/include/zephyr/bluetooth/audio/ccid.h new file mode 100644 index 0000000000000..9340ab87174ea --- /dev/null +++ b/include/zephyr/bluetooth/audio/ccid.h @@ -0,0 +1,74 @@ +/** + * @file + * @brief Header for Bluetooth Audio Content Control Identifier. + * + * Copyright (c) 2020 Bose Corporation + * Copyright (c) 2021-2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_CCID_H_ +#define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_CCID_H_ + +/** + * @brief Bluetooth Content Control Identifier (CCID) + * @defgroup bt_ccid Bluetooth Content Control Identifier + * + * @since 3.7 + * @version 0.8.0 + * + * @ingroup bluetooth + * @{ + * + * The Content Control Identifier (CCID) API manages CCIDs for @ref BT_UUID_CCID characteristics. + */ + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Minimum CCID value */ +#define BT_CCID_MIN 0 +/** Maximum CCID value */ +#define BT_CCID_MAX 255 + +/** + * @brief Allocates a CCID value. + * + * This should always be called right before registering a GATT service that contains a + * @ref BT_UUID_CCID characteristic. Allocating a CCID without registering the characteristic + * may (in very rare cases) result in duplicated CCIDs on the device. + * + * Requires that @kconfig{CONFIG_BT_CONN} is enabled. + * + * @retval ccid 8-bit unsigned CCID value on success + * @retval -ENOMEM No more CCIDs can be allocated + */ +int bt_ccid_alloc_value(void); + +/** + * @brief Get the GATT attribute of a CCID value + * + * Searches the current GATT database for a CCID characteristic that has the supplied CCID value. + * + * Requires that @kconfig{CONFIG_BT_CONN} is enabled. + * + * @param ccid The CCID to search for + * + * @retval NULL None was found + * @retval attr Pointer to a GATT attribute + */ +const struct bt_gatt_attr *bt_ccid_find_attr(uint8_t ccid); + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_CCID_H_ */ diff --git a/subsys/bluetooth/audio/CMakeLists.txt b/subsys/bluetooth/audio/CMakeLists.txt index 72388ed3c5d68..ef6fc16640b22 100644 --- a/subsys/bluetooth/audio/CMakeLists.txt +++ b/subsys/bluetooth/audio/CMakeLists.txt @@ -24,7 +24,9 @@ if (CONFIG_BT_MICP_MIC_DEV) endif() zephyr_library_sources_ifdef(CONFIG_BT_MICP_MIC_CTLR micp_mic_ctlr.c) -zephyr_library_sources_ifdef(CONFIG_BT_CCID ccid.c) +# When CONFIG_BT_AUDIO and CONFIG_BT_CONN is enabled we pull in ccid. It is based on CONFIG_BT_CONN +# as CCID depends on GATT, and GATT is enabled when CONFIG_BT_CONN=y. +zephyr_library_sources_ifdef(CONFIG_BT_CONN ccid.c) zephyr_library_link_libraries(subsys__bluetooth) diff --git a/subsys/bluetooth/audio/Kconfig b/subsys/bluetooth/audio/Kconfig index ea85a3d71b67f..aed0ecbe56fc7 100644 --- a/subsys/bluetooth/audio/Kconfig +++ b/subsys/bluetooth/audio/Kconfig @@ -39,12 +39,6 @@ config BT_AUDIO_NOTIFY_RETRY_DELAY retry to send notification that failed due to lack of TX buffers available. -config BT_CCID - bool - help - This hidden option is enabled when any of the content control - features are enabled. - rsource "Kconfig.bap" rsource "Kconfig.vocs" rsource "Kconfig.aics" diff --git a/subsys/bluetooth/audio/Kconfig.mcs b/subsys/bluetooth/audio/Kconfig.mcs index b7ebca32e618a..cbc6ce052bc94 100644 --- a/subsys/bluetooth/audio/Kconfig.mcs +++ b/subsys/bluetooth/audio/Kconfig.mcs @@ -12,7 +12,6 @@ config BT_MCS bool "Media Control Service Support" depends on MCTL_LOCAL_PLAYER_REMOTE_CONTROL depends on UTF8 - select BT_CCID select BT_GATT_DYNAMIC_DB help This option enables support for the Media Control Service. diff --git a/subsys/bluetooth/audio/Kconfig.mpl b/subsys/bluetooth/audio/Kconfig.mpl index a173000c4e1d1..4cf84f99059a2 100644 --- a/subsys/bluetooth/audio/Kconfig.mpl +++ b/subsys/bluetooth/audio/Kconfig.mpl @@ -8,7 +8,6 @@ config BT_MPL bool "Support for media player" - select BT_CCID help Enables support for media player Note that the provided media player is a sample that only provides a diff --git a/subsys/bluetooth/audio/Kconfig.tbs b/subsys/bluetooth/audio/Kconfig.tbs index 54275efa97023..f405ac6909625 100644 --- a/subsys/bluetooth/audio/Kconfig.tbs +++ b/subsys/bluetooth/audio/Kconfig.tbs @@ -12,7 +12,6 @@ if BT_AUDIO config BT_TBS bool "Telephone Bearer Service Support" - select BT_CCID select BT_GATT_DYNAMIC_DB depends on UTF8 help diff --git a/subsys/bluetooth/audio/cap_initiator.c b/subsys/bluetooth/audio/cap_initiator.c index 23295848b1435..d6e83a6557da0 100644 --- a/subsys/bluetooth/audio/cap_initiator.c +++ b/subsys/bluetooth/audio/cap_initiator.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -30,7 +31,6 @@ #include "bap_endpoint.h" #include "cap_internal.h" -#include "ccid_internal.h" #include "csip_internal.h" LOG_MODULE_REGISTER(bt_cap_initiator, CONFIG_BT_CAP_INITIATOR_LOG_LEVEL); @@ -91,13 +91,14 @@ static bool data_func_cb(struct bt_data *data, void *user_data) } metadata_param->stream_context_found = true; - } else if (IS_ENABLED(CONFIG_BT_CCID) && data->type == BT_AUDIO_METADATA_TYPE_CCID_LIST) { + } else if (IS_ENABLED(CONFIG_BT_CONN) && data->type == BT_AUDIO_METADATA_TYPE_CCID_LIST) { /* If the application supplies a CCID list, we verify that the CCIDs exist on our * device + * This is guarded by CONFIG_BT_CONN as without that we do not have a GATT DB to + * check. */ for (uint8_t i = 0U; i < data->data_len; i++) { const uint8_t ccid = data->data[i]; - if (bt_ccid_find_attr(ccid) == NULL) { LOG_DBG("Unknown characteristic for CCID 0x%02X", ccid); metadata_param->valid = false; diff --git a/subsys/bluetooth/audio/ccid.c b/subsys/bluetooth/audio/ccid.c index 7b437bd3bdb32..dc552060d8059 100644 --- a/subsys/bluetooth/audio/ccid.c +++ b/subsys/bluetooth/audio/ccid.c @@ -12,12 +12,11 @@ #include #include +#include #include #include #include -#include "ccid_internal.h" - struct ccid_search_param { const struct bt_gatt_attr *attr; uint8_t ccid; diff --git a/subsys/bluetooth/audio/ccid_internal.h b/subsys/bluetooth/audio/ccid_internal.h deleted file mode 100644 index d989d7bd6f33a..0000000000000 --- a/subsys/bluetooth/audio/ccid_internal.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Bluetooth Audio Content Control Identifier */ - -/* - * Copyright (c) 2020 Bose Corporation - * Copyright (c) 2021-2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_INCLUDE_BLUETOOTH_CCID_H_ -#define ZEPHYR_INCLUDE_BLUETOOTH_CCID_H_ - -#include - -#include - -/** - * @brief Allocates a CCID value. - * - * This should always be called right before registering a GATT service that contains a - * @ref BT_UUID_CCID characteristic. Allocating a CCID without registering the characteristic - * may (in very rare cases) result in duplicated CCIDs on the device. - * - * @retval ccid 8-bit unsigned CCID value on success - * @retval -ENOMEM if no more CCIDs can be allocated - */ -int bt_ccid_alloc_value(void); - -/** - * @brief Get the GATT attribute of a CCID value - * - * Searches the current GATT database for a CCID characteristic that has the supplied CCID value. - * - * @param ccid The CCID the search for - * - * @retval NULL if none was found - * @retval A pointer to a GATT attribute if found - */ -const struct bt_gatt_attr *bt_ccid_find_attr(uint8_t ccid); - -#endif /* ZEPHYR_INCLUDE_BLUETOOTH_CCID_H_ */ diff --git a/subsys/bluetooth/audio/tbs.c b/subsys/bluetooth/audio/tbs.c index e828f887edb00..fb94678375fa2 100644 --- a/subsys/bluetooth/audio/tbs.c +++ b/subsys/bluetooth/audio/tbs.c @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -33,7 +34,6 @@ #include "audio_internal.h" #include "tbs_internal.h" -#include "ccid_internal.h" LOG_MODULE_REGISTER(bt_tbs, CONFIG_BT_TBS_LOG_LEVEL); From cd5a9f62bba6985d0d05a16edea6d5626a197aad Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 1 Aug 2024 09:44:10 +0200 Subject: [PATCH 0773/4482] tests: Bluetooth: CCID: Add unit testing of CCID Add unit tests of the CCID functions. To support these new tests, the GATT mocks need to support dynamic GATT DB so we can add and remove a service that contains CCIDs. Signed-off-by: Emil Gydesen --- .../audio/cap_commander/CMakeLists.txt | 4 +- .../audio/cap_initiator/uut/CMakeLists.txt | 1 + tests/bluetooth/audio/ccid/CMakeLists.txt | 17 ++++ tests/bluetooth/audio/ccid/prj.conf | 10 ++ tests/bluetooth/audio/ccid/src/main.c | 96 +++++++++++++++++++ tests/bluetooth/audio/ccid/testcase.yaml | 7 ++ tests/bluetooth/audio/ccid/uut/CMakeLists.txt | 17 ++++ tests/bluetooth/audio/mocks/CMakeLists.txt | 3 + tests/bluetooth/audio/mocks/src/gatt.c | 17 ++-- 9 files changed, 161 insertions(+), 11 deletions(-) create mode 100644 tests/bluetooth/audio/ccid/CMakeLists.txt create mode 100644 tests/bluetooth/audio/ccid/prj.conf create mode 100644 tests/bluetooth/audio/ccid/src/main.c create mode 100644 tests/bluetooth/audio/ccid/testcase.yaml create mode 100644 tests/bluetooth/audio/ccid/uut/CMakeLists.txt diff --git a/tests/bluetooth/audio/cap_commander/CMakeLists.txt b/tests/bluetooth/audio/cap_commander/CMakeLists.txt index 1823159a7bfab..ebda30a7c7a2c 100644 --- a/tests/bluetooth/audio/cap_commander/CMakeLists.txt +++ b/tests/bluetooth/audio/cap_commander/CMakeLists.txt @@ -14,9 +14,7 @@ target_include_directories(testbinary PRIVATE include) target_sources(testbinary PRIVATE - ${ZEPHYR_BASE}/subsys/bluetooth/host/uuid.c - ${ZEPHYR_BASE}/subsys/bluetooth/common/addr.c - src/main.c + src/main.c src/test_common.c src/test_vcp.c src/test_micp.c diff --git a/tests/bluetooth/audio/cap_initiator/uut/CMakeLists.txt b/tests/bluetooth/audio/cap_initiator/uut/CMakeLists.txt index a24d6cfccce4e..ebd97dc155b86 100644 --- a/tests/bluetooth/audio/cap_initiator/uut/CMakeLists.txt +++ b/tests/bluetooth/audio/cap_initiator/uut/CMakeLists.txt @@ -13,6 +13,7 @@ add_library(uut STATIC ${ZEPHYR_BASE}/subsys/bluetooth/audio/cap_initiator.c ${ZEPHYR_BASE}/subsys/bluetooth/audio/cap_common.c ${ZEPHYR_BASE}/subsys/bluetooth/audio/cap_stream.c + ${ZEPHYR_BASE}/subsys/bluetooth/audio/ccid.c ${ZEPHYR_BASE}/subsys/bluetooth/common/bt_str.c ${ZEPHYR_BASE}/subsys/bluetooth/host/uuid.c ${ZEPHYR_BASE}/subsys/logging/log_minimal.c diff --git a/tests/bluetooth/audio/ccid/CMakeLists.txt b/tests/bluetooth/audio/ccid/CMakeLists.txt new file mode 100644 index 0000000000000..c304cddfb885c --- /dev/null +++ b/tests/bluetooth/audio/ccid/CMakeLists.txt @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +project(bluetooth_ccid) +find_package(Zephyr COMPONENTS unittest HINTS $ENV{ZEPHYR_BASE}) + +add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/audio/ccid/uut uut) + +target_link_libraries(testbinary PRIVATE uut) + +target_include_directories(testbinary PRIVATE include) + +target_sources(testbinary + PRIVATE + src/main.c +) diff --git a/tests/bluetooth/audio/ccid/prj.conf b/tests/bluetooth/audio/ccid/prj.conf new file mode 100644 index 0000000000000..165ddccf9041e --- /dev/null +++ b/tests/bluetooth/audio/ccid/prj.conf @@ -0,0 +1,10 @@ +CONFIG_ZTEST=y + +CONFIG_BT=y +CONFIG_BT_GATT_DYNAMIC_DB=y +CONFIG_BT_AUDIO=y + +CONFIG_ASSERT=y +CONFIG_ASSERT_LEVEL=2 +CONFIG_ASSERT_VERBOSE=y +CONFIG_ASSERT_ON_ERRORS=y diff --git a/tests/bluetooth/audio/ccid/src/main.c b/tests/bluetooth/audio/ccid/src/main.c new file mode 100644 index 0000000000000..63a95a5dd7d43 --- /dev/null +++ b/tests/bluetooth/audio/ccid/src/main.c @@ -0,0 +1,96 @@ +/* main.c - Application main entry point */ + +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +DEFINE_FFF_GLOBALS; + +ZTEST_SUITE(audio_ccid_test_suite, NULL, NULL, NULL, NULL, NULL); + +#define MAX_CCID_CNT 256 + +static ZTEST(audio_ccid_test_suite, test_bt_ccid_alloc_value) +{ + const int ret = bt_ccid_alloc_value(); + + zassert_true(ret >= 0 && ret <= UINT8_MAX, "Unexpected return value %d", ret); +} + +static ZTEST(audio_ccid_test_suite, test_bt_ccid_alloc_value_more_than_max) +{ + /* Verify that we can allocate more than max CCID if they are not registered */ + for (uint16_t i = 0U; i < MAX_CCID_CNT * 2; i++) { + const int ret = bt_ccid_alloc_value(); + + zassert_true(ret >= 0 && ret <= UINT8_MAX, "Unexpected return value %d", ret); + } +} + +static ssize_t read_ccid(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, + uint16_t len, uint16_t offset) +{ + const unsigned int ccid = POINTER_TO_UINT(attr->user_data); + const uint8_t ccid_u8 = (uint8_t)ccid; + + zassert_true(ccid <= BT_CCID_MAX); + + return bt_gatt_attr_read(conn, attr, buf, len, offset, &ccid_u8, sizeof(ccid_u8)); +} + +#define CCID_DEFINE(_n, ...) \ + BT_GATT_CHARACTERISTIC(BT_UUID_CCID, BT_GATT_CHRC_READ, BT_GATT_PERM_READ, read_ccid, \ + NULL, UINT_TO_POINTER(_n)) + +/* BT_GATT_PRIMARY_SERVICE only works in the global scope */ +static struct bt_gatt_attr test_attrs[] = { + BT_GATT_PRIMARY_SERVICE(BT_UUID_TBS), + LISTIFY(MAX_CCID_CNT, CCID_DEFINE, (,)), +}; + +static ZTEST(audio_ccid_test_suite, test_bt_ccid_alloc_value_all_allocated) +{ + struct bt_gatt_service test_svc = BT_GATT_SERVICE(test_attrs); + int ret; + + zassert_ok(bt_gatt_service_register(&test_svc)); + + /* Verify that CCID allocation fails if we have 255 characterstics with it */ + ret = bt_ccid_alloc_value(); + + zassert_ok(bt_gatt_service_unregister(&test_svc)); + + zassert_equal(ret, -ENOMEM, "Unexpected return value %d", ret); +} + +static ZTEST(audio_ccid_test_suite, test_bt_ccid_find_attr) +{ + struct bt_gatt_service test_svc = BT_GATT_SERVICE(test_attrs); + + /* Service not registered, shall fail */ + zassert_is_null(bt_ccid_find_attr(0)); + + zassert_ok(bt_gatt_service_register(&test_svc)); + + /* Service registered, shall not fail */ + zassert_not_null(bt_ccid_find_attr(0)); + + zassert_ok(bt_gatt_service_unregister(&test_svc)); +} diff --git a/tests/bluetooth/audio/ccid/testcase.yaml b/tests/bluetooth/audio/ccid/testcase.yaml new file mode 100644 index 0000000000000..b40f79c52116b --- /dev/null +++ b/tests/bluetooth/audio/ccid/testcase.yaml @@ -0,0 +1,7 @@ +common: + tags: + - bluetooth + - bluetooth_audio +tests: + bluetooth.audio.ccid.test: + type: unit diff --git a/tests/bluetooth/audio/ccid/uut/CMakeLists.txt b/tests/bluetooth/audio/ccid/uut/CMakeLists.txt new file mode 100644 index 0000000000000..727d5fa4a79b7 --- /dev/null +++ b/tests/bluetooth/audio/ccid/uut/CMakeLists.txt @@ -0,0 +1,17 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# +# CMakeLists.txt file for creating of uut library. +# + +add_library(uut STATIC + ${ZEPHYR_BASE}/subsys/bluetooth/audio/ccid.c +) + +add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/audio/mocks mocks) + +target_link_libraries(uut PUBLIC test_interface mocks) + +target_compile_options(uut PRIVATE -std=c11 -include ztest.h) diff --git a/tests/bluetooth/audio/mocks/CMakeLists.txt b/tests/bluetooth/audio/mocks/CMakeLists.txt index 4f12849fc2e82..b335b8a77dc6e 100644 --- a/tests/bluetooth/audio/mocks/CMakeLists.txt +++ b/tests/bluetooth/audio/mocks/CMakeLists.txt @@ -1,6 +1,7 @@ # # Copyright (c) 2023 Codecoup # Coperight (c) 2024 Demant A/S +# Copyright (c) 2024 Nordic Semiconductor ASA # # SPDX-License-Identifier: Apache-2.0 # @@ -30,8 +31,10 @@ target_include_directories(mocks PUBLIC ) target_sources(testbinary PRIVATE + ${ZEPHYR_BASE}/subsys/bluetooth/common/addr.c ${ZEPHYR_BASE}/subsys/bluetooth/common/bt_str.c ${ZEPHYR_BASE}/subsys/bluetooth/host/uuid.c + ${ZEPHYR_BASE}/subsys/logging/log_minimal.c ${ZEPHYR_BASE}/include/zephyr/kernel.h ) diff --git a/tests/bluetooth/audio/mocks/src/gatt.c b/tests/bluetooth/audio/mocks/src/gatt.c index a158b13d176d2..4138ef597567d 100644 --- a/tests/bluetooth/audio/mocks/src/gatt.c +++ b/tests/bluetooth/audio/mocks/src/gatt.c @@ -9,18 +9,21 @@ #include #include #include - #include + +#include +#include #include -#include -#include #include -#include #include #include +#include #include -#include -#include +#include +#include +#include +#include +#include #include "gatt.h" #include "conn.h" @@ -246,8 +249,6 @@ static void foreach_attr_type_dyndb(uint16_t start_handle, uint16_t end_handle, size_t i; struct bt_gatt_service *svc; - LOG_DBG("foreach_attr_type_dyndb"); - SYS_SLIST_FOR_EACH_CONTAINER(&db, svc, node) { struct bt_gatt_service *next; From 9fe959857a1c64e8efa1214f8881e6381164bd8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Czaplewski?= Date: Mon, 24 Jun 2024 18:12:57 +0200 Subject: [PATCH 0774/4482] drivers: sensor: tmp1075: Add tmp1075 sensor driver and sample MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TI tmp1075 driver implemented based on tmp108 driver. The driver initializes the sensor based on the DTS. Added tmp1075 example overlay file to thermometer sample. All you need to do to use the sensor is to connect the I2C and optionally interrupt line. To see default DTS configuration option inspect `ti,tmp1075.yaml` bindings file and sensor spec. Signed-off-by: Paweł Czaplewski --- drivers/sensor/ti/CMakeLists.txt | 1 + drivers/sensor/ti/Kconfig | 1 + drivers/sensor/ti/tmp1075/CMakeLists.txt | 5 + drivers/sensor/ti/tmp1075/Kconfig | 24 ++ drivers/sensor/ti/tmp1075/tmp1075.c | 254 ++++++++++++++++++ drivers/sensor/ti/tmp1075/tmp1075.h | 75 ++++++ drivers/sensor/ti/tmp1075/tmp1075_trigger.c | 54 ++++ dts/bindings/sensor/ti,tmp1075.yaml | 51 ++++ .../thermometer/boards/nucleo_h7a3zi_q.conf | 3 + .../boards/nucleo_h7a3zi_q.overlay | 33 +++ tests/drivers/build_all/sensor/i2c.dtsi | 11 + 11 files changed, 512 insertions(+) create mode 100644 drivers/sensor/ti/tmp1075/CMakeLists.txt create mode 100644 drivers/sensor/ti/tmp1075/Kconfig create mode 100644 drivers/sensor/ti/tmp1075/tmp1075.c create mode 100644 drivers/sensor/ti/tmp1075/tmp1075.h create mode 100644 drivers/sensor/ti/tmp1075/tmp1075_trigger.c create mode 100644 dts/bindings/sensor/ti,tmp1075.yaml create mode 100644 samples/sensor/thermometer/boards/nucleo_h7a3zi_q.conf create mode 100644 samples/sensor/thermometer/boards/nucleo_h7a3zi_q.overlay diff --git a/drivers/sensor/ti/CMakeLists.txt b/drivers/sensor/ti/CMakeLists.txt index 3ea219ad0bcb3..452d0e8e37a4f 100644 --- a/drivers/sensor/ti/CMakeLists.txt +++ b/drivers/sensor/ti/CMakeLists.txt @@ -15,6 +15,7 @@ add_subdirectory_ifdef(CONFIG_TI_HDC20XX ti_hdc20xx) add_subdirectory_ifdef(CONFIG_TMAG5170 tmag5170) add_subdirectory_ifdef(CONFIG_TMAG5273 tmag5273) add_subdirectory_ifdef(CONFIG_TMP007 tmp007) +add_subdirectory_ifdef(CONFIG_TMP1075 tmp1075) add_subdirectory_ifdef(CONFIG_TMP108 tmp108) add_subdirectory_ifdef(CONFIG_TMP112 tmp112) add_subdirectory_ifdef(CONFIG_TMP114 tmp114) diff --git a/drivers/sensor/ti/Kconfig b/drivers/sensor/ti/Kconfig index 00f6de6a94a46..f0655981a4c36 100644 --- a/drivers/sensor/ti/Kconfig +++ b/drivers/sensor/ti/Kconfig @@ -15,6 +15,7 @@ source "drivers/sensor/ti/ti_hdc20xx/Kconfig" source "drivers/sensor/ti/tmag5170/Kconfig" source "drivers/sensor/ti/tmag5273/Kconfig" source "drivers/sensor/ti/tmp007/Kconfig" +source "drivers/sensor/ti/tmp1075/Kconfig" source "drivers/sensor/ti/tmp108/Kconfig" source "drivers/sensor/ti/tmp112/Kconfig" source "drivers/sensor/ti/tmp114/Kconfig" diff --git a/drivers/sensor/ti/tmp1075/CMakeLists.txt b/drivers/sensor/ti/tmp1075/CMakeLists.txt new file mode 100644 index 0000000000000..c0538471f88f7 --- /dev/null +++ b/drivers/sensor/ti/tmp1075/CMakeLists.txt @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library() + +zephyr_library_sources(tmp1075.c tmp1075_trigger.c) diff --git a/drivers/sensor/ti/tmp1075/Kconfig b/drivers/sensor/ti/tmp1075/Kconfig new file mode 100644 index 0000000000000..d8b2e9b7d8d1c --- /dev/null +++ b/drivers/sensor/ti/tmp1075/Kconfig @@ -0,0 +1,24 @@ +# Copyright (c) 2024 Arrow Electronics. +# SPDX-License-Identifier: Apache-2.0 + +# TMP1075 temperature sensor configuration options + +menuconfig TMP1075 + bool "TMP1075 Temperature Sensor" + default y + depends on DT_HAS_TI_TMP1075_ENABLED + select I2C + + help + Enable the driver for Texas Instruments TMP1075 High-Accuracy Digital + Temperature Sensors. + +if TMP1075 + +config TMP1075_ALERT_INTERRUPTS + bool "Allow interrupts to service over and under temp alerts" + help + This will set up interrupts to service under and over temp alerts + see TMP1075 spec sheet for more information on how these work. + +endif # TMP1075 diff --git a/drivers/sensor/ti/tmp1075/tmp1075.c b/drivers/sensor/ti/tmp1075/tmp1075.c new file mode 100644 index 0000000000000..a3c7db54ac732 --- /dev/null +++ b/drivers/sensor/ti/tmp1075/tmp1075.c @@ -0,0 +1,254 @@ +/* + * Copyright (c) 2024 Arrow Electronics. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT ti_tmp1075 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tmp1075.h" + +LOG_MODULE_REGISTER(TMP1075, CONFIG_SENSOR_LOG_LEVEL); + +#define I2C_REG_ADDR_SIZE 1 +#define I2C_REG_SENSOR_SIZE sizeof(uint16_t) +#define I2C_BUFFER_SIZE I2C_REG_ADDR_SIZE + I2C_REG_SENSOR_SIZE + +#define I2C_REG_ADDR_OFFSET 0 +#define I2C_WRITE_DATA_OFFSET 1 + +static int tmp1075_reg_read(const struct tmp1075_config *cfg, uint8_t reg, uint16_t *val) +{ + if (i2c_burst_read_dt(&cfg->bus, reg, (uint8_t *)val, sizeof(*val)) < 0) { + return -EIO; + } + *val = sys_be16_to_cpu(*val); + return 0; +} + +static int tmp1075_reg_write(const struct tmp1075_config *cfg, uint8_t reg, uint16_t val) +{ + uint8_t buf[I2C_REG_ADDR_SIZE + I2C_REG_SENSOR_SIZE]; + + buf[I2C_REG_ADDR_OFFSET] = reg; + sys_put_be16(val, &buf[I2C_WRITE_DATA_OFFSET]); + + return i2c_write_dt(&cfg->bus, buf, sizeof(buf)); +} + +#if CONFIG_TMP1075_ALERT_INTERRUPTS +static int set_threshold_attribute(const struct device *dev, uint8_t reg, int16_t value, + const char *error_msg) +{ + if (tmp1075_reg_write(dev->config, reg, value) < 0) { + LOG_ERR("Failed to set %s attribute!", error_msg); + return -EIO; + } + return 0; +} +#endif + +static int tmp1075_attr_set(const struct device *dev, enum sensor_channel chan, + enum sensor_attribute attr, const struct sensor_value *val) +{ + if (chan != SENSOR_CHAN_AMBIENT_TEMP) { + return -ENOTSUP; + } + + switch (attr) { +#if CONFIG_TMP1075_ALERT_INTERRUPTS + case SENSOR_ATTR_LOWER_THRESH: + return set_threshold_attribute(dev, TMP1075_REG_TLOW, val->val1 << 8, + "SENSOR_ATTR_LOWER_THRESH"); + + case SENSOR_ATTR_UPPER_THRESH: + return set_threshold_attribute(dev, TMP1075_REG_THIGH, val->val1 << 8, + "SENSOR_ATTR_UPPER_THRESH"); +#endif + + default: + return -ENOTSUP; + } +} + +#if CONFIG_TMP1075_ALERT_INTERRUPTS +static int get_threshold_attribute(const struct device *dev, uint8_t reg, struct sensor_value *val, + const char *error_msg) +{ + uint16_t value; + + if (tmp1075_reg_read(dev->config, reg, &value) < 0) { + LOG_ERR("Failed to get %s attribute!", error_msg); + return -EIO; + } + val->val1 = value >> 8; + return 0; +} +#endif + +static int tmp1075_attr_get(const struct device *dev, enum sensor_channel chan, + enum sensor_attribute attr, struct sensor_value *val) +{ + if (chan != SENSOR_CHAN_AMBIENT_TEMP) { + return -ENOTSUP; + } + + switch (attr) { +#if CONFIG_TMP1075_ALERT_INTERRUPTS + case SENSOR_ATTR_LOWER_THRESH: + return get_threshold_attribute(dev, TMP1075_REG_TLOW, val, + "SENSOR_ATTR_LOWER_THRESH"); + + case SENSOR_ATTR_UPPER_THRESH: + return get_threshold_attribute(dev, TMP1075_REG_THIGH, val, + "SENSOR_ATTR_UPPER_THRESH"); +#endif + + default: + return -ENOTSUP; + } +} + +static int tmp1075_sample_fetch(const struct device *dev, enum sensor_channel chan) +{ + struct tmp1075_data *drv_data = dev->data; + const struct tmp1075_config *cfg = dev->config; + uint16_t val; + + __ASSERT_NO_MSG(chan == SENSOR_CHAN_ALL || chan == SENSOR_CHAN_AMBIENT_TEMP); + + if (tmp1075_reg_read(cfg, TMP1075_REG_TEMPERATURE, &val) < 0) { + return -EIO; + } + drv_data->sample = arithmetic_shift_right((int16_t)val, TMP1075_DATA_NORMAL_SHIFT); + return 0; +} + +static int tmp1075_channel_get(const struct device *dev, enum sensor_channel chan, + struct sensor_value *val) +{ + struct tmp1075_data *drv_data = dev->data; + int32_t uval; + + if (chan != SENSOR_CHAN_AMBIENT_TEMP) { + return -ENOTSUP; + } + + uval = (int32_t)drv_data->sample * TMP1075_TEMP_SCALE; + val->val1 = uval / uCELSIUS_IN_CELSIUS; + val->val2 = uval % uCELSIUS_IN_CELSIUS; + + return 0; +} + +static const struct sensor_driver_api tmp1075_driver_api = { + .attr_set = tmp1075_attr_set, + .attr_get = tmp1075_attr_get, + .sample_fetch = tmp1075_sample_fetch, + .channel_get = tmp1075_channel_get, +#ifdef CONFIG_TMP1075_ALERT_INTERRUPTS + .trigger_set = tmp1075_trigger_set, +#endif +}; + +#ifdef CONFIG_TMP1075_ALERT_INTERRUPTS +static int setup_interrupts(const struct device *dev) +{ + struct tmp1075_data *drv_data = dev->data; + const struct tmp1075_config *config = dev->config; + const struct gpio_dt_spec *alert_gpio = &config->alert_gpio; + int result; + + if (!gpio_is_ready_dt(alert_gpio)) { + LOG_ERR("tmp1075: gpio controller %s not ready", alert_gpio->port->name); + return -ENODEV; + } + + result = gpio_pin_configure_dt(alert_gpio, GPIO_INPUT); + + if (result < 0) { + return result; + } + + gpio_init_callback(&drv_data->temp_alert_gpio_cb, tmp1075_trigger_handle_alert, + BIT(alert_gpio->pin)); + + result = gpio_add_callback(alert_gpio->port, &drv_data->temp_alert_gpio_cb); + + if (result < 0) { + return result; + } + + result = gpio_pin_interrupt_configure_dt(alert_gpio, GPIO_INT_EDGE_BOTH); + + if (result < 0) { + return result; + } + + return 0; +} +#endif + +static int tmp1075_init(const struct device *dev) +{ + const struct tmp1075_config *cfg = dev->config; + struct tmp1075_data *data = dev->data; + + if (!i2c_is_ready_dt(&cfg->bus)) { + LOG_ERR("I2C dev %s not ready", cfg->bus.bus->name); + return -EINVAL; + } +#ifdef CONFIG_TMP1075_ALERT_INTERRUPTS + int result = setup_interrupts(dev); + + if (result < 0) { + LOG_ERR("Couldn't setup interrupts"); + return -EIO; + } +#endif + data->tmp1075_dev = dev; + + uint16_t config_reg = 0; + + TMP1075_SET_ONE_SHOT_CONVERSION(config_reg, cfg->one_shot); + TMP1075_SET_CONVERSION_RATE(config_reg, cfg->cr); + TMP1075_SET_CONSECUTIVE_FAULT_MEASUREMENTS(config_reg, cfg->cf); + TMP1075_SET_ALERT_PIN_POLARITY(config_reg, cfg->alert_pol); + TMP1075_SET_ALERT_PIN_FUNCTION(config_reg, cfg->interrupt_mode); + TMP1075_SET_SHUTDOWN_MODE(config_reg, cfg->shutdown_mode); + + int rc = tmp1075_reg_write(dev->config, TMP1075_REG_CONFIG, config_reg); + + if (rc == 0) { + data->config_reg = config_reg; + } + return rc; +} + +#define TMP1075_INST(inst) \ + static struct tmp1075_data tmp1075_data_##inst; \ + static const struct tmp1075_config tmp1075_config_##inst = { \ + .cr = DT_INST_ENUM_IDX(inst, conversion_rate), \ + .cf = DT_INST_ENUM_IDX(inst, consecutive_fault_measurements), \ + .alert_pol = DT_INST_PROP(inst, alert_pin_active_high), \ + .interrupt_mode = DT_INST_PROP(inst, interrupt_mode), \ + .shutdown_mode = DT_INST_PROP(inst, shutdown_mode), \ + .bus = I2C_DT_SPEC_INST_GET(inst), \ + .alert_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, alert_gpios, {0}), \ + }; \ + SENSOR_DEVICE_DT_INST_DEFINE(inst, tmp1075_init, NULL, &tmp1075_data_##inst, \ + \ + &tmp1075_config_##inst, POST_KERNEL, \ + CONFIG_SENSOR_INIT_PRIORITY, &tmp1075_driver_api); + +DT_INST_FOREACH_STATUS_OKAY(TMP1075_INST) diff --git a/drivers/sensor/ti/tmp1075/tmp1075.h b/drivers/sensor/ti/tmp1075/tmp1075.h new file mode 100644 index 0000000000000..930df9390ba42 --- /dev/null +++ b/drivers/sensor/ti/tmp1075/tmp1075.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2024 Arrow Electronics. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_DRIVERS_SENSOR_TMP1075_TMP1075_H_ +#define ZEPHYR_DRIVERS_SENSOR_TMP1075_TMP1075_H_ + +#include +#include +#include +#include + +/* Extended resolution is not supported on TMP1075 */ +#define TMP1075_DATA_NORMAL_SHIFT 4 +#define uCELSIUS_IN_CELSIUS 1000000 + +#define TMP1075_REG_TEMPERATURE 0x00 +#define TMP1075_REG_CONFIG 0x01 +#define TMP1075_REG_TLOW 0x02 +#define TMP1075_REG_THIGH 0x03 + +/* Scale in micro degrees Celsius -> 0.0625°C per ADC bit resolution */ +#define TMP1075_TEMP_SCALE 62500 + +/* Macro to set or clear the TMP1075_OS (One-shot conversion mode) bit based on a boolean value */ +#define TMP1075_SET_ONE_SHOT_CONVERSION(reg, enable) \ + ((reg) = ((reg) & ~(1 << 15)) | ((enable) << 15)) + +/* Macro to set the TMP1075_R (Conversion rate) bits */ +#define TMP1075_SET_CONVERSION_RATE(reg, rate) ((reg) |= ((rate) << 13)) + +/* Macro to set the TMP1075_F (Consecutive fault measurements) bits */ +#define TMP1075_SET_CONSECUTIVE_FAULT_MEASUREMENTS(reg, faults) ((reg) |= ((faults) << 11)) + +/* Macro to set or clear the TMP1075_POL (Polarity of output pin) bit based on a boolean value */ +#define TMP1075_SET_ALERT_PIN_POLARITY(reg, activeHigh) \ + ((reg) = ((reg) & ~(1 << 10)) | ((activeHigh) << 10)) + +/* Macro to set or clear the TMP1075_TM (ALERT pin function) bit based on a boolean value */ +#define TMP1075_SET_ALERT_PIN_FUNCTION(reg, interruptMode) \ + ((reg) = ((reg) & ~(1 << 9)) | ((interruptMode) << 9)) + +/* Macro to set or clear the TMP1075_SD (Shutdown mode) bit based on a boolean value */ +#define TMP1075_SET_SHUTDOWN_MODE(reg, shutdown) ((reg) = ((reg) & ~(1 << 8)) | ((shutdown) << 8)) + +struct tmp1075_data { + const struct device *tmp1075_dev; + int16_t sample; + uint16_t config_reg; + const struct sensor_trigger *temp_alert_trigger; + sensor_trigger_handler_t temp_alert_handler; + struct gpio_callback temp_alert_gpio_cb; + bool over_threshold; +}; + +struct tmp1075_config { + const struct i2c_dt_spec bus; + const struct gpio_dt_spec alert_gpio; + uint8_t cr; + uint8_t cf; + bool alert_pol: 1; + bool one_shot: 1; + bool interrupt_mode: 1; + bool shutdown_mode: 1; +}; + +int tmp1075_trigger_set(const struct device *dev, const struct sensor_trigger *trig, + sensor_trigger_handler_t handler); + +void tmp1075_trigger_handle_alert(const struct device *port, struct gpio_callback *cb, + gpio_port_pins_t pins); + +#endif diff --git a/drivers/sensor/ti/tmp1075/tmp1075_trigger.c b/drivers/sensor/ti/tmp1075/tmp1075_trigger.c new file mode 100644 index 0000000000000..838ccf9474b3a --- /dev/null +++ b/drivers/sensor/ti/tmp1075/tmp1075_trigger.c @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2024 Arrow Electronics. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#include "tmp1075.h" + +LOG_MODULE_DECLARE(TMP1075, CONFIG_SENSOR_LOG_LEVEL); + +/* + * @brief GPIO alert line interrupt callback + * @param gpio - not used + * @param cb - callback structure for interrupt handler + * @param pins - not used + */ +void tmp1075_trigger_handle_alert(const struct device *gpio, struct gpio_callback *cb, + gpio_port_pins_t pins) +{ + struct tmp1075_data *drv_data = CONTAINER_OF(cb, struct tmp1075_data, temp_alert_gpio_cb); + /* Successful read, call set callbacks */ + if (drv_data->temp_alert_handler) { + drv_data->temp_alert_handler(drv_data->tmp1075_dev, drv_data->temp_alert_trigger); + } +} + +/* + * @brief callback implementation for setting the custom trigger handler in the userspace + * @param dev - sensor device struct pointer + * @param trig - trigger struct pointer to be set up + * @param handler - pointer to custom callback handler which the user would like to use + * @return 0 if ok - -ENOTSUP in case of err + */ +int tmp1075_trigger_set(const struct device *dev, const struct sensor_trigger *trig, + sensor_trigger_handler_t handler) +{ + if (!device_is_ready(dev)) { + return -ENODEV; + } + + struct tmp1075_data *drv_data = dev->data; + + if (trig->type == SENSOR_TRIG_THRESHOLD) { + drv_data->temp_alert_handler = handler; + drv_data->temp_alert_trigger = trig; + return 0; + } + + return -ENOTSUP; +} diff --git a/dts/bindings/sensor/ti,tmp1075.yaml b/dts/bindings/sensor/ti,tmp1075.yaml new file mode 100644 index 0000000000000..b6009112ef738 --- /dev/null +++ b/dts/bindings/sensor/ti,tmp1075.yaml @@ -0,0 +1,51 @@ +# Copyright (c) 2024 Arrow Electronics. +# SPDX-License-Identifier: Apache-2.0 + +description: | + TMP1075 Digital Temperature Sensor. See more info at + https://www.ti.com/product/TMP1075 + +compatible: "ti,tmp1075" + +include: [sensor-device.yaml, i2c-device.yaml] + +properties: + conversion-rate: + description: Conversion rate in us. + type: int + enum: + - 27500 # 27.5ms + - 55000 # 55ms + - 110000 # 110ms + - 220000 # 220ms + alert-gpios: + type: phandle-array + description: | + Identifies the ALERT signal, which is active-low open drain when + produced by the sensor. + one-shot-conversion: + description: One-shot conversion mode. + type: boolean + consecutive-fault-measurements: + description: Number of consecutive measured faults that will trigger the alert. + type: int + enum: + - 1 + - 2 + - 3 + - 4 + alert-pin-active-high: + description: Polarity of the alert pin. + type: boolean + interrupt-mode: + description: Selects the function of the ALERT pin. + type: boolean + shutdown-mode: + description: Sets the device in shutdown mode to conserve power. + type: boolean + lower-threshold: + description: Lower threshold for alert interrupt. Expressed in degrees C. + type: int + upper-threshold: + description: Upper threshold for alert interrupt. Expressed in degrees C. + type: int diff --git a/samples/sensor/thermometer/boards/nucleo_h7a3zi_q.conf b/samples/sensor/thermometer/boards/nucleo_h7a3zi_q.conf new file mode 100644 index 0000000000000..a40caf2f45352 --- /dev/null +++ b/samples/sensor/thermometer/boards/nucleo_h7a3zi_q.conf @@ -0,0 +1,3 @@ +# Enable trigger support +CONFIG_TMP1075_ALERT_INTERRUPTS=y +CONFIG_I2C_STM32_INTERRUPT=n diff --git a/samples/sensor/thermometer/boards/nucleo_h7a3zi_q.overlay b/samples/sensor/thermometer/boards/nucleo_h7a3zi_q.overlay new file mode 100644 index 0000000000000..8b6875d342e8a --- /dev/null +++ b/samples/sensor/thermometer/boards/nucleo_h7a3zi_q.overlay @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Arrow Electronics. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + aliases { + ambient-temp0 = &tmp1075_temperature; + }; +}; + +/* + * Note - TMP1075 is not present on the Nucleo h7a3zi_q eval board, and must be + * wired to i2c1 externally. + */ +&i2c1 { + pinctrl-0 = <&i2c1_sda_pb7 &i2c1_scl_pb6>; + pinctrl-names = "default"; + compatible = "st,stm32-i2c-v2"; + status = "okay"; + tmp1075_temperature: tmp1075@48 { + compatible = "ti,tmp1075"; + friendly-name = "texas_temperature_tmp1075"; + reg = <0x48>; + alert-gpios = <&gpiob 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + conversion-rate = <220000>; + lower-threshold = <27>; + upper-threshold = <28>; + consecutive-fault-measurements = <4>; + interrupt-mode; + }; +}; diff --git a/tests/drivers/build_all/sensor/i2c.dtsi b/tests/drivers/build_all/sensor/i2c.dtsi index 86b7173d5d133..ee477c0d2e02e 100644 --- a/tests/drivers/build_all/sensor/i2c.dtsi +++ b/tests/drivers/build_all/sensor/i2c.dtsi @@ -1076,3 +1076,14 @@ test_i2c_mmc56x3: mmc56x3@92 { magn-odr = <0>; auto-self-reset; }; + +test_i2c_tmp1075: tmp1075@91 { + compatible = "ti,tmp1075"; + reg = <0x91>; + alert-gpios = <&test_gpio 0 0>; + conversion-rate = <220000>; + lower-threshold = <27>; + upper-threshold = <28>; + consecutive-fault-measurements = <4>; + interrupt-mode; +}; From 217fdf9d24f6662b920b0dde2e8bf2edff6cd77d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Czaplewski?= Date: Fri, 27 Sep 2024 11:39:08 +0200 Subject: [PATCH 0775/4482] tests: drivers: i2c: fix I2C registers configuration in i2c.dtsi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed incorrect I2C register definitions in the test file tests/drivers/build_all/sensor/i2c.dtsi. Signed-off-by: Paweł Czaplewski --- tests/drivers/build_all/sensor/i2c.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/drivers/build_all/sensor/i2c.dtsi b/tests/drivers/build_all/sensor/i2c.dtsi index ee477c0d2e02e..4d222494da256 100644 --- a/tests/drivers/build_all/sensor/i2c.dtsi +++ b/tests/drivers/build_all/sensor/i2c.dtsi @@ -1070,16 +1070,16 @@ test_i2c_apds9253: apds9253@96 { resolution = ; }; -test_i2c_mmc56x3: mmc56x3@92 { +test_i2c_mmc56x3: mmc56x3@97 { compatible = "memsic,mmc56x3"; - reg = <0x92>; + reg = <0x97>; magn-odr = <0>; auto-self-reset; }; -test_i2c_tmp1075: tmp1075@91 { +test_i2c_tmp1075: tmp1075@98 { compatible = "ti,tmp1075"; - reg = <0x91>; + reg = <0x98>; alert-gpios = <&test_gpio 0 0>; conversion-rate = <220000>; lower-threshold = <27>; From f46e5342c41c56da1d41e9f1d5e4d5dfaf7d2768 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 4 Oct 2024 11:54:22 -0500 Subject: [PATCH 0776/4482] drivers: video: add min_line_count and max_line_count to video_caps Add min and max line count to the video_caps structure- these fields can be used by applications to determine the size of video buffer they need to allocate for a video endpoint The min and max line count fields are designed to enable supporting endpoints that may produce or consume partial frames within each video buffer, and may support arbitrarily sized video buffers. Signed-off-by: Daniel DeGrasse --- include/zephyr/drivers/video.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/zephyr/drivers/video.h b/include/zephyr/drivers/video.h index fa571815ba99b..b37f77a637179 100644 --- a/include/zephyr/drivers/video.h +++ b/include/zephyr/drivers/video.h @@ -31,6 +31,12 @@ extern "C" { #endif +/* + * Flag used by @ref video_caps structure to indicate endpoint operates on + * buffers the size of the video frame + */ +#define LINE_COUNT_HEIGHT (-1) + /** * @struct video_format * @brief Video format structure @@ -90,6 +96,22 @@ struct video_caps { * the stream. */ uint8_t min_vbuf_count; + /** Denotes minimum line count of a video buffer that this endpoint + * can fill or process. Each line is expected to consume the number + * of bytes the selected video format's pitch uses, so the video + * buffer must be at least `pitch` * `min_line_count` bytes. + * `LINE_COUNT_HEIGHT` is a special value, indicating the endpoint + * only supports video buffers with at least enough bytes to store + * a full video frame + */ + int16_t min_line_count; + /** + * Denotes maximum line count of a video buffer that this endpoint + * can fill or process. Similar constraints to `min_line_count`, + * but `LINE_COUNT_HEIGHT` indicates that the endpoint will never + * fill or process more than a full video frame in one video buffer. + */ + int16_t max_line_count; }; /** From ec6ffc8b33a7711f43cf9162ca5ab1690fdc2e1c Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 4 Oct 2024 11:57:37 -0500 Subject: [PATCH 0777/4482] drivers: video: update video drivers to handle min/max line count Update existing video drivers to handle the min/max line count field within the video_caps structure. All drivers work with full frames currently, so use the special LINE_COUNT_HEIGHT value to indicate this. Signed-off-by: Daniel DeGrasse --- drivers/video/video_esp32_dvp.c | 3 +++ drivers/video/video_mcux_csi.c | 2 ++ drivers/video/video_stm32_dcmi.c | 3 +++ drivers/video/video_sw_generator.c | 3 +++ 4 files changed, 11 insertions(+) diff --git a/drivers/video/video_esp32_dvp.c b/drivers/video/video_esp32_dvp.c index d11a209fed211..3b2866982a405 100644 --- a/drivers/video/video_esp32_dvp.c +++ b/drivers/video/video_esp32_dvp.c @@ -234,6 +234,9 @@ static int video_esp32_get_caps(const struct device *dev, enum video_endpoint_id return -EINVAL; } + /* ESP32 produces full frames */ + caps->min_line_count = caps->max_line_count = LINE_COUNT_HEIGHT; + /* Forward the message to the source device */ return video_get_caps(config->source_dev, ep, caps); } diff --git a/drivers/video/video_mcux_csi.c b/drivers/video/video_mcux_csi.c index 65e65f27a1457..cb566674a6e27 100644 --- a/drivers/video/video_mcux_csi.c +++ b/drivers/video/video_mcux_csi.c @@ -393,6 +393,8 @@ static int video_mcux_csi_get_caps(const struct device *dev, enum video_endpoint /* NXP MCUX CSI request at least 2 buffer before starting */ caps->min_vbuf_count = 2; + /* CSI only operates on buffers of full frame size */ + caps->min_line_count = caps->max_line_count = LINE_COUNT_HEIGHT; /* no source dev */ return err; diff --git a/drivers/video/video_stm32_dcmi.c b/drivers/video/video_stm32_dcmi.c index 41f1c039aa0fc..c8c849f3b9b82 100644 --- a/drivers/video/video_stm32_dcmi.c +++ b/drivers/video/video_stm32_dcmi.c @@ -356,6 +356,9 @@ static int video_stm32_dcmi_get_caps(const struct device *dev, return -EINVAL; } + /* DCMI produces full frames */ + caps->min_line_count = caps->max_line_count = LINE_COUNT_HEIGHT; + /* Forward the message to the sensor device */ ret = video_get_caps(config->sensor_dev, ep, caps); diff --git a/drivers/video/video_sw_generator.c b/drivers/video/video_sw_generator.c index 36169b7b8eacc..e4ca3ac75b479 100644 --- a/drivers/video/video_sw_generator.c +++ b/drivers/video/video_sw_generator.c @@ -237,6 +237,9 @@ static int video_sw_generator_get_caps(const struct device *dev, enum video_endp caps->format_caps = fmts; caps->min_vbuf_count = 0; + /* SW generator produces full frames */ + caps->min_line_count = caps->max_line_count = LINE_COUNT_HEIGHT; + return 0; } From 2fb259833ffc95bf826bcdb0a068f05a180661f5 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 4 Oct 2024 12:03:30 -0500 Subject: [PATCH 0778/4482] samples: drivers: video: update video samples for min/max line count Update video samples to use min/max line count capabilities when allocating video buffers. Signed-off-by: Daniel DeGrasse --- samples/drivers/video/capture/src/main.c | 6 +++++- samples/drivers/video/capture_to_lvgl/src/main.c | 4 ++++ samples/drivers/video/tcpserversink/src/main.c | 12 ++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/samples/drivers/video/capture/src/main.c b/samples/drivers/video/capture/src/main.c index d2d64b84dd408..979727af2820e 100644 --- a/samples/drivers/video/capture/src/main.c +++ b/samples/drivers/video/capture/src/main.c @@ -182,7 +182,11 @@ int main(void) #endif /* Size to allocate for each buffer */ - bsize = fmt.pitch * fmt.height; + if (caps.min_line_count == LINE_COUNT_HEIGHT) { + bsize = fmt.pitch * fmt.height; + } else { + bsize = fmt.pitch * caps.min_line_count; + } /* Alloc video buffers and enqueue for capture */ for (i = 0; i < ARRAY_SIZE(buffers); i++) { diff --git a/samples/drivers/video/capture_to_lvgl/src/main.c b/samples/drivers/video/capture_to_lvgl/src/main.c index 1c50163d1afc4..0d0a07e0d553c 100644 --- a/samples/drivers/video/capture_to_lvgl/src/main.c +++ b/samples/drivers/video/capture_to_lvgl/src/main.c @@ -88,6 +88,10 @@ int main(void) (char)(fmt.pixelformat >> 16), (char)(fmt.pixelformat >> 24), fmt.width, fmt.height, fmt.pitch); + if (caps.min_line_count != LINE_COUNT_HEIGHT) { + LOG_ERR("Partial framebuffers not supported by this sample"); + return 0; + } /* Size to allocate for each buffer */ bsize = fmt.pitch * fmt.height; diff --git a/samples/drivers/video/tcpserversink/src/main.c b/samples/drivers/video/tcpserversink/src/main.c index 90946be44bd88..9918654519885 100644 --- a/samples/drivers/video/tcpserversink/src/main.c +++ b/samples/drivers/video/tcpserversink/src/main.c @@ -41,6 +41,7 @@ int main(void) struct video_buffer *buffers[2], *vbuf; int i, ret, sock, client; struct video_format fmt; + struct video_caps caps; #if DT_HAS_CHOSEN(zephyr_camera) const struct device *const video = DEVICE_DT_GET(DT_CHOSEN(zephyr_camera)); @@ -81,6 +82,12 @@ int main(void) return 0; } + /* Get capabilities */ + if (video_get_caps(video, VIDEO_EP_OUT, &caps)) { + LOG_ERR("Unable to retrieve video capabilities"); + return 0; + } + /* Get default/native format */ if (video_get_format(video, VIDEO_EP_OUT, &fmt)) { LOG_ERR("Unable to retrieve video format"); @@ -91,6 +98,11 @@ int main(void) (char)(fmt.pixelformat >> 8), (char)(fmt.pixelformat >> 16), (char)(fmt.pixelformat >> 24), fmt.width, fmt.height); + if (caps.min_line_count != LINE_COUNT_HEIGHT) { + LOG_ERR("Partial framebuffers not supported by this sample"); + return 0; + } + /* Alloc Buffers */ for (i = 0; i < ARRAY_SIZE(buffers); i++) { buffers[i] = video_buffer_alloc(fmt.pitch * fmt.height); From 04a007f9fe9239e520cd46bef71743713963345c Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 4 Oct 2024 12:04:22 -0500 Subject: [PATCH 0779/4482] drivers: video: add line_offset field to video_buffer structure Add line_offset field to the video_buffer structure. This field indicates the offset (in horizontal lines) within a frame that a video buffer starts at. This is useful for video devices that produce or consume video buffers that constitute a partial frame. Signed-off-by: Daniel DeGrasse --- include/zephyr/drivers/video.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/zephyr/drivers/video.h b/include/zephyr/drivers/video.h index b37f77a637179..b90707383166a 100644 --- a/include/zephyr/drivers/video.h +++ b/include/zephyr/drivers/video.h @@ -134,6 +134,12 @@ struct video_buffer { * endpoints. */ uint32_t timestamp; + /** Line offset within frame this buffer represents, from the + * beginning of the frame. This offset is given in pixels, + * so `line_offset` * `pitch` provides offset from the start of + * the frame in bytes. + */ + uint16_t line_offset; }; /** From 561198ac754a2579d5cbd6f44e89894eeebd60e4 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 4 Oct 2024 12:05:38 -0500 Subject: [PATCH 0780/4482] drivers: video: handle line_offset field Since all video drivers in tree use a full frame, their video buffers will always start at a line_offset of 0 within the frame. Signed-off-by: Daniel DeGrasse --- drivers/video/video_esp32_dvp.c | 1 + drivers/video/video_mcux_csi.c | 1 + drivers/video/video_stm32_dcmi.c | 1 + drivers/video/video_sw_generator.c | 1 + 4 files changed, 4 insertions(+) diff --git a/drivers/video/video_esp32_dvp.c b/drivers/video/video_esp32_dvp.c index 3b2866982a405..d0c247ba6c720 100644 --- a/drivers/video/video_esp32_dvp.c +++ b/drivers/video/video_esp32_dvp.c @@ -287,6 +287,7 @@ static int video_esp32_enqueue(const struct device *dev, enum video_endpoint_id } vbuf->bytesused = data->video_format.pitch * data->video_format.height; + vbuf->line_offset = 0; k_fifo_put(&data->fifo_in, vbuf); diff --git a/drivers/video/video_mcux_csi.c b/drivers/video/video_mcux_csi.c index cb566674a6e27..c6a82accdb40b 100644 --- a/drivers/video/video_mcux_csi.c +++ b/drivers/video/video_mcux_csi.c @@ -293,6 +293,7 @@ static int video_mcux_csi_enqueue(const struct device *dev, enum video_endpoint_ to_read = data->csi_config.linePitch_Bytes * data->csi_config.height; vbuf->bytesused = to_read; + vbuf->line_offset = 0; ret = CSI_TransferSubmitEmptyBuffer(config->base, &data->csi_handle, (uint32_t)vbuf->buffer); diff --git a/drivers/video/video_stm32_dcmi.c b/drivers/video/video_stm32_dcmi.c index c8c849f3b9b82..135f38d238dac 100644 --- a/drivers/video/video_stm32_dcmi.c +++ b/drivers/video/video_stm32_dcmi.c @@ -320,6 +320,7 @@ static int video_stm32_dcmi_enqueue(const struct device *dev, } vbuf->bytesused = buffer_size; + vbuf->line_offset = 0; k_fifo_put(&data->fifo_in, vbuf); diff --git a/drivers/video/video_sw_generator.c b/drivers/video/video_sw_generator.c index e4ca3ac75b479..845834d5a844c 100644 --- a/drivers/video/video_sw_generator.c +++ b/drivers/video/video_sw_generator.c @@ -145,6 +145,7 @@ static void __fill_buffer_colorbar(struct video_sw_generator_data *data, struct vbuf->timestamp = k_uptime_get_32(); vbuf->bytesused = i; + vbuf->line_offset = 0; } static void __buffer_work(struct k_work *work) From 97943295e5f829adc261866a2f1cfe2e60cc3e42 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 4 Oct 2024 12:19:39 -0500 Subject: [PATCH 0781/4482] samples: drivers: video: handle line_offset field Handle line_offset field within video capture sample. Other samples do not support partial framebuffers and therefore can ignore this field. Signed-off-by: Daniel DeGrasse --- samples/drivers/video/capture/src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/drivers/video/capture/src/main.c b/samples/drivers/video/capture/src/main.c index 979727af2820e..311049284498a 100644 --- a/samples/drivers/video/capture/src/main.c +++ b/samples/drivers/video/capture/src/main.c @@ -62,9 +62,9 @@ static inline void video_display_frame(const struct device *const display_dev, buf_desc.buf_size = vbuf->bytesused; buf_desc.width = fmt.width; buf_desc.pitch = buf_desc.width; - buf_desc.height = fmt.height; + buf_desc.height = vbuf->bytesused / fmt.pitch; - display_write(display_dev, 0, 0, &buf_desc, vbuf->buffer); + display_write(display_dev, 0, vbuf->line_offset, &buf_desc, vbuf->buffer); } #endif From 126306981dbe957f3be57f8781e53c220483fee1 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Wed, 15 May 2024 22:10:40 +0000 Subject: [PATCH 0782/4482] drivers: dma: dma_mcux_smartdma: update interface to support custom FW The SMARTDMA is a programmable DMA engine, and supports custom firmware in order to run complex DMA operations. Update the driver to increase the flexibility users have when configuring the SMARTDMA with custom firmware, and remove the RT500 display firmware specific definitions and functionality from the driver. This display setup is now handled from the MIPI DSI driver, since the firmware used for this case is specific to the MIPI DSI IP. This change also requires an update to the RT500 devicetree, as the register definition for the SMARTDMA has changed, so the base address must as well. Signed-off-by: Daniel DeGrasse --- drivers/dma/dma_mcux_smartdma.c | 106 ++---------------- drivers/mipi_dsi/dsi_mcux_2l.c | 26 +++-- dts/arm/nxp/nxp_rt5xx_common.dtsi | 2 +- .../zephyr/drivers/dma/dma_mcux_smartdma.h | 30 ----- 4 files changed, 28 insertions(+), 136 deletions(-) diff --git a/drivers/dma/dma_mcux_smartdma.c b/drivers/dma/dma_mcux_smartdma.c index 9899797ae53f1..86663dd02e8b7 100644 --- a/drivers/dma/dma_mcux_smartdma.c +++ b/drivers/dma/dma_mcux_smartdma.c @@ -19,30 +19,14 @@ LOG_MODULE_REGISTER(dma_mcux_smartdma, CONFIG_DMA_LOG_LEVEL); -/* SMARTDMA peripheral registers, taken from MCUX driver implementation*/ -struct smartdma_periph { - volatile uint32_t BOOT; - volatile uint32_t CTRL; - volatile uint32_t PC; - volatile uint32_t SP; - volatile uint32_t BREAK_ADDR; - volatile uint32_t BREAK_VECT; - volatile uint32_t EMER_VECT; - volatile uint32_t EMER_SEL; - volatile uint32_t ARM2SMARTDMA; - volatile uint32_t SMARTDMA2ARM; - volatile uint32_t PENDTRAP; -}; - struct dma_mcux_smartdma_config { - struct smartdma_periph *base; + SMARTDMA_Type *base; void (*irq_config_func)(const struct device *dev); void (**smartdma_progs)(void); }; struct dma_mcux_smartdma_data { - uint32_t smartdma_stack[32]; /* Stack for SMARTDMA */ /* Installed DMA callback and user data */ dma_callback_t callback; void *user_data; @@ -53,22 +37,13 @@ struct dma_mcux_smartdma_data { /* These bits are set when the SMARTDMA boots, cleared to reset it */ #define SMARTDMA_BOOT 0x11 -static inline bool dma_mcux_smartdma_prog_is_mipi(uint32_t prog) -{ - return ((prog == kSMARTDMA_MIPI_RGB565_DMA) || - (prog == kSMARTDMA_MIPI_RGB888_DMA) || - (prog == kSMARTDMA_MIPI_RGB565_R180_DMA) || - (prog == kSMARTDMA_MIPI_RGB888_R180_DMA)); -} - /* Configure a channel */ static int dma_mcux_smartdma_configure(const struct device *dev, uint32_t channel, struct dma_config *config) { const struct dma_mcux_smartdma_config *dev_config = dev->config; struct dma_mcux_smartdma_data *data = dev->data; - uint32_t prog_idx; - bool swap_pixels = false; + uint32_t prog_idx = config->dma_slot; /* SMARTDMA does not have channels */ ARG_UNUSED(channel); @@ -79,68 +54,11 @@ static int dma_mcux_smartdma_configure(const struct device *dev, /* Reset smartDMA */ SMARTDMA_Reset(); - /* - * The dma_slot parameter is used to determine which SMARTDMA program - * to run. First, convert the Zephyr define to a HAL enum. - */ - switch (config->dma_slot) { - case DMA_SMARTDMA_MIPI_RGB565_DMA: - prog_idx = kSMARTDMA_MIPI_RGB565_DMA; - break; - case DMA_SMARTDMA_MIPI_RGB888_DMA: - prog_idx = kSMARTDMA_MIPI_RGB888_DMA; - break; - case DMA_SMARTDMA_MIPI_RGB565_180: - prog_idx = kSMARTDMA_MIPI_RGB565_R180_DMA; - break; - case DMA_SMARTDMA_MIPI_RGB888_180: - prog_idx = kSMARTDMA_MIPI_RGB888_R180_DMA; - break; - case DMA_SMARTDMA_MIPI_RGB565_DMA_SWAP: - swap_pixels = true; - prog_idx = kSMARTDMA_MIPI_RGB565_DMA; - break; - case DMA_SMARTDMA_MIPI_RGB888_DMA_SWAP: - swap_pixels = true; - prog_idx = kSMARTDMA_MIPI_RGB888_DMA; - break; - case DMA_SMARTDMA_MIPI_RGB565_180_SWAP: - swap_pixels = true; - prog_idx = kSMARTDMA_MIPI_RGB565_R180_DMA; - break; - case DMA_SMARTDMA_MIPI_RGB888_180_SWAP: - swap_pixels = true; - prog_idx = kSMARTDMA_MIPI_RGB888_R180_DMA; - break; - default: - prog_idx = config->dma_slot; - break; - } - - if (dma_mcux_smartdma_prog_is_mipi(prog_idx)) { - smartdma_dsi_param_t param = {.disablePixelByteSwap = (swap_pixels == false)}; - - if (config->block_count != 1) { - return -ENOTSUP; - } - /* Setup SMARTDMA */ - param.p_buffer = (uint8_t *)config->head_block->source_address; - param.buffersize = config->head_block->block_size; - param.smartdma_stack = data->smartdma_stack; - /* Save configuration to SMARTDMA */ - dev_config->base->ARM2SMARTDMA = (uint32_t)(¶m); - } else { - /* For other cases, we simply pass the entire DMA config - * struct to the SMARTDMA. The user's application could either - * populate this structure with data, or choose to write - * different configuration data to the SMARTDMA in their - * application - */ - dev_config->base->ARM2SMARTDMA = ((uint32_t)config); - } + /* Write the head block pointer directly to SMARTDMA */ + dev_config->base->ARM2EZH = (uint32_t)config->head_block; /* Save program */ - dev_config->base->BOOT = (uint32_t)dev_config->smartdma_progs[prog_idx]; - LOG_DBG("Boot address set to 0x%X", dev_config->base->BOOT); + dev_config->base->BOOTADR = (uint32_t)dev_config->smartdma_progs[prog_idx]; + LOG_DBG("Boot address set to 0x%X", dev_config->base->BOOTADR); return 0; } @@ -175,15 +93,7 @@ static int dma_mcux_smartdma_stop(const struct device *dev, uint32_t channel) static int dma_mcux_smartdma_init(const struct device *dev) { const struct dma_mcux_smartdma_config *config = dev->config; - /* - * Initialize the SMARTDMA with firmware. The default firmware - * from MCUX SDK is a display firmware, which has functions - * implemented above in the dma configuration function. The - * user can install another firmware using `dma_smartdma_install_fw` - */ - SMARTDMA_Init((uint32_t)config->smartdma_progs, - s_smartdmaDisplayFirmware, - SMARTDMA_DISPLAY_FIRMWARE_SIZE); + SMARTDMA_InitWithoutFirmware(); config->irq_config_func(dev); return 0; @@ -236,7 +146,7 @@ static const struct dma_driver_api dma_mcux_smartdma_api = { } \ \ static const struct dma_mcux_smartdma_config smartdma_##n##_config = { \ - .base = (struct smartdma_periph *)DT_INST_REG_ADDR(n), \ + .base = (SMARTDMA_Type *)DT_INST_REG_ADDR(n), \ .smartdma_progs = (void (**)(void))DT_INST_PROP(n, program_mem),\ .irq_config_func = dma_mcux_smartdma_config_func_##n, \ }; \ diff --git a/drivers/mipi_dsi/dsi_mcux_2l.c b/drivers/mipi_dsi/dsi_mcux_2l.c index 53201cd123fb5..9ca8a60ca99a6 100644 --- a/drivers/mipi_dsi/dsi_mcux_2l.c +++ b/drivers/mipi_dsi/dsi_mcux_2l.c @@ -19,6 +19,9 @@ #include #include #include +#ifdef CONFIG_MIPI_DSI_MCUX_2L_SMARTDMA +#include +#endif #include @@ -47,6 +50,8 @@ struct mcux_mipi_dsi_data { dsi_handle_t mipi_handle; struct k_sem transfer_sem; #ifdef CONFIG_MIPI_DSI_MCUX_2L_SMARTDMA + smartdma_dsi_param_t smartdma_params __aligned(4); + uint32_t smartdma_stack[32]; uint8_t dma_slot; #endif }; @@ -94,7 +99,6 @@ static int dsi_mcux_tx_color(const struct device *dev, uint8_t channel, const struct mcux_mipi_dsi_config *config = dev->config; struct mcux_mipi_dsi_data *data = dev->data; struct dma_config dma_cfg = {0}; - struct dma_block_config block = {0}; int ret; if (channel != 0) { @@ -102,12 +106,12 @@ static int dsi_mcux_tx_color(const struct device *dev, uint8_t channel, } /* Configure smartDMA device, and run transfer */ - block.source_address = (uint32_t)msg->tx_buf; - block.block_size = msg->tx_len; + data->smartdma_params.p_buffer = msg->tx_buf; + data->smartdma_params.buffersize = msg->tx_len; dma_cfg.dma_callback = dsi_mcux_dma_cb; dma_cfg.user_data = (struct device *)dev; - dma_cfg.head_block = █ + dma_cfg.head_block = (struct dma_block_config *)&data->smartdma_params; dma_cfg.block_count = 1; dma_cfg.dma_slot = data->dma_slot; dma_cfg.channel_direction = MEMORY_TO_PERIPHERAL; @@ -250,13 +254,15 @@ static int dsi_mcux_attach(const struct device *dev, switch (mdev->pixfmt) { case MIPI_DSI_PIXFMT_RGB888: - data->dma_slot = DMA_SMARTDMA_MIPI_RGB888_DMA; + data->dma_slot = kSMARTDMA_MIPI_RGB888_DMA; + data->smartdma_params.disablePixelByteSwap = true; break; case MIPI_DSI_PIXFMT_RGB565: + data->dma_slot = kSMARTDMA_MIPI_RGB565_DMA; if (IS_ENABLED(CONFIG_MIPI_DSI_MCUX_2L_SWAP16)) { - data->dma_slot = DMA_SMARTDMA_MIPI_RGB565_DMA_SWAP; + data->smartdma_params.disablePixelByteSwap = false; } else { - data->dma_slot = DMA_SMARTDMA_MIPI_RGB565_DMA; + data->smartdma_params.disablePixelByteSwap = true; } break; default: @@ -264,6 +270,12 @@ static int dsi_mcux_attach(const struct device *dev, mdev->pixfmt); return -ENODEV; } + + data->smartdma_params.smartdma_stack = data->smartdma_stack; + + dma_smartdma_install_fw(config->smart_dma, + (uint8_t *)s_smartdmaDisplayFirmware, + s_smartdmaDisplayFirmwareSize); #else struct mcux_mipi_dsi_data *data = dev->data; diff --git a/dts/arm/nxp/nxp_rt5xx_common.dtsi b/dts/arm/nxp/nxp_rt5xx_common.dtsi index 79f1aec091ca8..8467b231cc9e7 100644 --- a/dts/arm/nxp/nxp_rt5xx_common.dtsi +++ b/dts/arm/nxp/nxp_rt5xx_common.dtsi @@ -587,7 +587,7 @@ smartdma: dma@27020 { compatible = "nxp,smartdma"; - reg = <0x27020 0x1000>; + reg = <0x27000 0x1000>; program-mem = <0x24100000>; interrupts = <73 0>; status = "disabled"; diff --git a/include/zephyr/drivers/dma/dma_mcux_smartdma.h b/include/zephyr/drivers/dma/dma_mcux_smartdma.h index 0e09d348d8fe3..5171a5491ce64 100644 --- a/include/zephyr/drivers/dma/dma_mcux_smartdma.h +++ b/include/zephyr/drivers/dma/dma_mcux_smartdma.h @@ -7,34 +7,6 @@ #ifndef ZEPHYR_INCLUDE_DRIVERS_DMA_MCUX_SMARTDMA_H_ #define ZEPHYR_INCLUDE_DRIVERS_DMA_MCUX_SMARTDMA_H_ -/* Write RGB565 data to MIPI DSI via DMA. */ -#define DMA_SMARTDMA_MIPI_RGB565_DMA 0 -/* Write RGB888 data to MIPI DSI via DMA */ -#define DMA_SMARTDMA_MIPI_RGB888_DMA 1 -/* Write RGB565 data to MIPI DSI via DMA. Rotate output data by 180 degrees */ -#define DMA_SMARTDMA_MIPI_RGB565_180 2 -/* Write RGB888 data to MIPI DSI via DMA. Rotate output data by 180 degrees */ -#define DMA_SMARTDMA_MIPI_RGB888_180 3 - -/* Write RGB565 data to MIPI DSI via DMA. Swap data endianness, so that - * little endian RGB565 data will be written big endian style. - */ -#define DMA_SMARTDMA_MIPI_RGB565_DMA_SWAP 4 -/* Write RGB888 data to MIPI DSI via DMA. Swap data endianness, so that - * little endian RGB888 data will be written big endian style. - */ -#define DMA_SMARTDMA_MIPI_RGB888_DMA_SWAP 5 -/* Write RGB565 data to MIPI DSI via DMA. Rotate output data by 180 degrees, - * and swap data endianness - */ -#define DMA_SMARTDMA_MIPI_RGB565_180_SWAP 6 -/* Write RGB888 data to MIPI DSI via DMA. Rotate output data by 180 degrees, - * and swap data endianness - */ -#define DMA_SMARTDMA_MIPI_RGB888_180_SWAP 7 - - - /** * @brief install SMARTDMA firmware * @@ -48,6 +20,4 @@ void dma_smartdma_install_fw(const struct device *dev, uint8_t *firmware, uint32_t len); -#define GD32_DMA_FEATURES_FIFO_THRESHOLD(threshold) (threshold & 0x3) - #endif /* ZEPHYR_INCLUDE_DRIVERS_DMA_MCUX_SMARTDMA_H_ */ From f386cc26fa8d191337c97051f2539e6484c9c1d4 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 8 Oct 2024 20:45:02 +0000 Subject: [PATCH 0783/4482] drivers: video: ov7670: improve resolution init code Improve resolution init code for OV7670 driver, to properly program the full set of registers needed to realize a given output resolution. The settings for these registers are based on those used in the MCUX SDK driver, which are derived from the resolution register settings given in the OV7670 programming guide, with a different configuration for the CLKSRC and DBLV registers used for the input clock. Signed-off-by: Daniel DeGrasse --- drivers/video/ov7670.c | 146 +++++++++++++++++++++++++++++++++-------- 1 file changed, 118 insertions(+), 28 deletions(-) diff --git a/drivers/video/ov7670.c b/drivers/video/ov7670.c index 5d71f0670770b..0369fdf8e1a64 100644 --- a/drivers/video/ov7670.c +++ b/drivers/video/ov7670.c @@ -33,6 +33,63 @@ struct ov7670_data { struct video_format fmt; }; +struct ov7670_resolution_cfg { + uint8_t com7; + uint8_t com3; + uint8_t com14; + uint8_t scaling_xsc; + uint8_t scaling_ysc; + uint8_t dcwctr; + uint8_t pclk_div; + uint8_t pclk_delay; +}; + +/* Resolution settings for camera, based on those present in MCUX SDK */ +const struct ov7670_resolution_cfg OV7670_RESOLUTION_QCIF = { + .com7 = 0x2c, + .com3 = 0x00, + .com14 = 0x11, + .scaling_xsc = 0x3a, + .scaling_ysc = 0x35, + .dcwctr = 0x11, + .pclk_div = 0xf1, + .pclk_delay = 0x52 +}; + +const struct ov7670_resolution_cfg OV7670_RESOLUTION_QVGA = { + .com7 = 0x14, + .com3 = 0x04, + .com14 = 0x19, + .scaling_xsc = 0x3a, + .scaling_ysc = 0x35, + .dcwctr = 0x11, + .pclk_div = 0xf1, + .pclk_delay = 0x02 +}; + +const struct ov7670_resolution_cfg OV7670_RESOLUTION_CIF = { + .com7 = 0x24, + .com3 = 0x08, + .com14 = 0x11, + .scaling_xsc = 0x3a, + .scaling_ysc = 0x35, + .dcwctr = 0x11, + .pclk_div = 0xf1, + .pclk_delay = 0x02 +}; + +const struct ov7670_resolution_cfg OV7670_RESOLUTION_VGA = { + .com7 = 0x04, + .com3 = 0x00, + .com14 = 0x00, + .scaling_xsc = 0x3a, + .scaling_ysc = 0x35, + .dcwctr = 0x11, + .pclk_div = 0xf0, + .pclk_delay = 0x02 +}; + + /* OV7670 registers */ #define OV7670_PID 0x0A #define OV7670_COM7 0x12 @@ -142,7 +199,10 @@ static const struct video_format_cap fmts[] = { OV7670_VIDEO_FORMAT_CAP(640, 480, VIDEO_PIX_FMT_YUYV), /* VGA */ {0}}; -/* This initialization table is based on the MCUX SDK driver for the OV7670 */ +/* + * This initialization table is based on the MCUX SDK driver for the OV7670. + * Note that this table assumes the camera is fed a 6MHz XCLK signal + */ static const struct ov7670_reg ov7670_init_regtbl[] = { {OV7670_MVFP, 0x20}, /* MVFP: Mirror/VFlip,Normal image */ @@ -154,29 +214,18 @@ static const struct ov7670_reg ov7670_init_regtbl[] = { {OV7670_BRIGHT, 0x2f}, /* Internal clock pre-scalar,F(internal clock) = F(input clock)/(Bit[5:0]+1) */ - {OV7670_CLKRC, 0x81}, /* Clock Div, Input/(n+1), bit6 set to 1 to disable divider */ - - /* SCALING_PCLK_DIV, */ - {OV7670_SCALING_PCLK_DIV, 0x00}, /* 0: Enable clock divider,010: Divided by 4 */ - /* Common Control 14,Bit[4]: DCW and scaling PCLK enable,Bit[3]: Manual scaling */ - {OV7670_COM14, 0x00}, + {OV7670_CLKRC, 0x80}, /* Clock Div, Input/(n+1), bit6 set to 1 to disable divider */ /* DBLV,Bit[7:6]: PLL control */ - /* 0:Bypass PLL.,40: Input clock x4 , 80: Input clock x6 ,C0: Input clock x8 */ - {OV7670_DBLV, 0x40}, - - /* test pattern, useful in some case */ - {OV7670_SCALING_XSC, 0x0}, - {OV7670_SCALING_YSC, 0}, + /* 0:Bypass PLL, 40: Input clock x4 , 80: Input clock x6 ,C0: Input clock x8 */ + {OV7670_DBLV, 0x00}, /* Output Drive Capability */ {OV7670_COM2, 0x00}, /* Common Control 2, Output Drive Capability: 1x */ - {OV7670_SCALING_PCLK_DELAY, 0x02}, {OV7670_BD50MAX, 0x05}, {OV7670_BD60MAX, 0x07}, {OV7670_HAECC7, 0x94}, - {OV7670_COM3, 0x00}, {OV7670_COM4, 0x00}, {OV7670_COM6, 0x4b}, {OV7670_COM11, 0x9F}, /* Night mode */ @@ -216,9 +265,6 @@ static const struct ov7670_reg ov7670_init_regtbl[] = { {OV7670_HREF, 0x80}, /* HREF */ {OV7670_VREF, 0x0a}, /* VREF */ - /* DCW Control, */ - {OV7670_SCALING_DCWCTR, 0x11}, - /* AGC/AEC - Automatic Gain Control/Automatic exposure Control */ {OV7670_GAIN, 0x00}, /* AGC */ {OV7670_AECHH, 0x3F}, /* Exposure Value */ @@ -307,7 +353,8 @@ static int ov7670_set_fmt(const struct device *dev, enum video_endpoint_id ep, { const struct ov7670_config *config = dev->config; struct ov7670_data *data = dev->data; - uint8_t com7 = 0U; + const struct ov7670_resolution_cfg *resolution; + int ret; uint8_t i = 0U; if (fmt->pixelformat != VIDEO_PIX_FMT_RGB565 && fmt->pixelformat != VIDEO_PIX_FMT_YUYV) { @@ -322,10 +369,6 @@ static int ov7670_set_fmt(const struct device *dev, enum video_endpoint_id ep, memcpy(&data->fmt, fmt, sizeof(data->fmt)); - if (fmt->pixelformat == VIDEO_PIX_FMT_RGB565) { - com7 |= 0x4; - } - /* Set output resolution */ while (fmts[i].pixelformat) { if (fmts[i].width_min == fmt->width && fmts[i].height_min == fmt->height && @@ -333,22 +376,60 @@ static int ov7670_set_fmt(const struct device *dev, enum video_endpoint_id ep, /* Set output format */ switch (fmts[i].width_min) { case 176: /* QCIF */ - com7 |= BIT(3); + resolution = &OV7670_RESOLUTION_QCIF; break; case 320: /* QVGA */ - com7 |= BIT(4); + resolution = &OV7670_RESOLUTION_QVGA; break; case 352: /* CIF */ - com7 |= BIT(5); + resolution = &OV7670_RESOLUTION_CIF; break; default: /* VGA */ + resolution = &OV7670_RESOLUTION_VGA; break; } - /* Program COM7 to set format */ - return i2c_reg_write_byte_dt(&config->bus, OV7670_COM7, com7); + /* Program resolution bytes settings */ + ret = i2c_reg_write_byte_dt(&config->bus, OV7670_COM7, + resolution->com7); + if (ret < 0) { + return ret; + } + ret = i2c_reg_write_byte_dt(&config->bus, OV7670_COM3, + resolution->com3); + if (ret < 0) { + return ret; + } + ret = i2c_reg_write_byte_dt(&config->bus, OV7670_COM14, + resolution->com14); + if (ret < 0) { + return ret; + } + ret = i2c_reg_write_byte_dt(&config->bus, OV7670_SCALING_XSC, + resolution->scaling_xsc); + if (ret < 0) { + return ret; + } + ret = i2c_reg_write_byte_dt(&config->bus, OV7670_SCALING_YSC, + resolution->scaling_ysc); + if (ret < 0) { + return ret; + } + ret = i2c_reg_write_byte_dt(&config->bus, OV7670_SCALING_DCWCTR, + resolution->dcwctr); + if (ret < 0) { + return ret; + } + ret = i2c_reg_write_byte_dt(&config->bus, OV7670_SCALING_PCLK_DIV, + resolution->pclk_div); + if (ret < 0) { + return ret; + } + return i2c_reg_write_byte_dt(&config->bus, OV7670_SCALING_PCLK_DELAY, + resolution->pclk_delay); } i++; } + LOG_ERR("Unsupported format"); return -ENOTSUP; } @@ -435,6 +516,15 @@ static int ov7670_init(const struct device *dev) return -ENODEV; } + /* Reset camera registers */ + ret = i2c_reg_write_byte_dt(&config->bus, OV7670_COM7, 0x80); + if (ret < 0) { + LOG_ERR("Could not reset camera: %d", ret); + return ret; + } + /* Delay after reset */ + k_msleep(5); + /* Set default camera format (QVGA, YUYV) */ fmt.pixelformat = VIDEO_PIX_FMT_YUYV; fmt.width = 640; From d2df15a0e911502fa2a7b0de0d20ac21703a7e6b Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Wed, 15 May 2024 22:21:49 +0000 Subject: [PATCH 0784/4482] drivers: video: video_mcux_smartdma: add SMARTDMA video driver Add SMARTDMA video driver. This driver uses the SMARTDMA engine as a parallel camera interface, which can read QVGA frames from a camera device. Due to SRAM constraints, the video driver divides the camera stream into multiple horizontal video buffers as it streams them back to an application. Signed-off-by: Daniel DeGrasse --- drivers/video/CMakeLists.txt | 1 + drivers/video/Kconfig | 2 + drivers/video/Kconfig.mcux_sdma | 10 + drivers/video/video_mcux_smartdma.c | 391 +++++++++++++++++++++ dts/bindings/video/nxp,video-smartdma.yaml | 29 ++ 5 files changed, 433 insertions(+) create mode 100644 drivers/video/Kconfig.mcux_sdma create mode 100644 drivers/video/video_mcux_smartdma.c create mode 100644 dts/bindings/video/nxp,video-smartdma.yaml diff --git a/drivers/video/CMakeLists.txt b/drivers/video/CMakeLists.txt index 5da14958d125d..e678071bdeca8 100644 --- a/drivers/video/CMakeLists.txt +++ b/drivers/video/CMakeLists.txt @@ -15,3 +15,4 @@ zephyr_library_sources_ifdef(CONFIG_VIDEO_STM32_DCMI video_stm32_dcmi.c) zephyr_library_sources_ifdef(CONFIG_VIDEO_OV5640 ov5640.c) zephyr_library_sources_ifdef(CONFIG_VIDEO_OV7670 ov7670.c) zephyr_library_sources_ifdef(CONFIG_VIDEO_ESP32 video_esp32_dvp.c) +zephyr_library_sources_ifdef(CONFIG_VIDEO_MCUX_SDMA video_mcux_smartdma.c) diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index c7693ec0e0a35..6ff70bbcfca8d 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -72,4 +72,6 @@ source "drivers/video/Kconfig.ov7670" source "drivers/video/Kconfig.gc2145" +source "drivers/video/Kconfig.mcux_sdma" + endif # VIDEO diff --git a/drivers/video/Kconfig.mcux_sdma b/drivers/video/Kconfig.mcux_sdma new file mode 100644 index 0000000000000..240e2ee3a4814 --- /dev/null +++ b/drivers/video/Kconfig.mcux_sdma @@ -0,0 +1,10 @@ +# NXP MCUX SDMA driver configuration options + +# Copyright 2024 NXP +# SPDX-License-Identifier: Apache-2.0 + +config VIDEO_MCUX_SDMA + bool "NXP MCUX Video SMARTDMA driver" + default y + select DMA + depends on DT_HAS_NXP_VIDEO_SMARTDMA_ENABLED diff --git a/drivers/video/video_mcux_smartdma.c b/drivers/video/video_mcux_smartdma.c new file mode 100644 index 0000000000000..860ce1476b7eb --- /dev/null +++ b/drivers/video/video_mcux_smartdma.c @@ -0,0 +1,391 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT nxp_video_smartdma + +#include +#include + +#include +#include +#include +#include + +#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL +#include +LOG_MODULE_REGISTER(nxp_video_sdma); + +struct nxp_video_sdma_config { + const struct device *dma_dev; + const struct device *sensor_dev; + const struct pinctrl_dev_config *pincfg; + uint8_t vsync_pin; + uint8_t hsync_pin; + uint8_t pclk_pin; +}; + +/* Firmware reads 30 lines of data per video buffer */ +#define SDMA_LINE_COUNT 30 +/* Firmware only supports 320x240 */ +#define SDMA_VBUF_HEIGHT 240 +#define SDMA_VBUF_WIDTH 320 + +struct nxp_video_sdma_data { + /* Must be aligned on 4 byte boundary, as lower 2 bits of ARM2SDMA register + * are used to enable interrupts + */ + smartdma_camera_param_t params __aligned(4); + uint32_t smartdma_stack[64] __aligned(32); + struct k_fifo fifo_in; + struct k_fifo fifo_out; + struct k_sem stream_empty; /* Signals stream has run out of buffers */ + bool stream_starved; + bool buf_reload_flag; + struct video_buffer *active_buf; + struct video_buffer *queued_buf; + const struct nxp_video_sdma_config *config; + uint32_t frame_idx; +}; + +/* Executed in interrupt context */ +static void nxp_video_sdma_callback(const struct device *dev, void *user_data, + uint32_t channel, int status) +{ + struct nxp_video_sdma_data *data = user_data; + + if (status < 0) { + LOG_ERR("Transfer failed: %d, stopping DMA", status); + dma_stop(data->config->dma_dev, 0); + return; + } + /* + * SmartDMA engine streams 15 lines of RGB565 data, then interrupts the + * system. The engine will reload the framebuffer pointer after sending + * the first interrupt, and before sending the second interrupt. + * + * Based on this, we alternate between reloading the framebuffer + * pointer and queueing a completed frame every other interrupt + */ + if (data->buf_reload_flag) { + /* Save old framebuffer, we will dequeue it next interrupt */ + data->active_buf = data->queued_buf; + /* Load new framebuffer */ + data->queued_buf = k_fifo_get(&data->fifo_in, K_NO_WAIT); + if (data->queued_buf == NULL) { + data->stream_starved = true; + } else { + data->params.p_buffer_ping_pong = (uint32_t *)data->queued_buf->buffer; + } + } else { + if (data->stream_starved) { + /* Signal any waiting threads */ + k_sem_give(&data->stream_empty); + } + data->active_buf->line_offset = (data->frame_idx / 2) * SDMA_LINE_COUNT; + data->active_buf->timestamp = k_uptime_get_32(); + k_fifo_put(&data->fifo_out, data->active_buf); + + } + /* Toggle buffer reload flag*/ + data->buf_reload_flag = !data->buf_reload_flag; +} + +static int nxp_video_sdma_stream_start(const struct device *dev) +{ + const struct nxp_video_sdma_config *config = dev->config; + struct nxp_video_sdma_data *data = dev->data; + struct dma_config sdma_config = {0}; + int ret; + + /* Setup dma configuration for SmartDMA */ + sdma_config.dma_slot = kSMARTDMA_CameraDiv16FrameQVGA; + sdma_config.dma_callback = nxp_video_sdma_callback; + sdma_config.user_data = data; + /* Setting bit 1 here enables the SmartDMA to interrupt ARM core + * when writing to SMARTDMA2ARM register + */ + sdma_config.head_block = (struct dma_block_config *)(((uint32_t)&data->params) | 0x2); + + /* Setup parameters for SmartDMA engine */ + data->params.smartdma_stack = data->smartdma_stack; + /* SmartDMA continuously streams data once started. If user + * has not provided a framebuffer, we can't start DMA. + */ + data->queued_buf = k_fifo_get(&data->fifo_in, K_NO_WAIT); + if (data->queued_buf == NULL) { + return -EIO; + } + data->params.p_buffer_ping_pong = (uint32_t *)data->queued_buf->buffer; + /* The firmware writes the index of the frame slice + * (from 0-15) into this buffer + */ + data->params.p_stripe_index = &data->frame_idx; + + /* Start DMA engine */ + ret = dma_config(config->dma_dev, 0, &sdma_config); + if (ret < 0) { + return ret; + } + /* Reset stream state variables */ + k_sem_reset(&data->stream_empty); + data->buf_reload_flag = true; + data->stream_starved = false; + + ret = dma_start(config->dma_dev, 0); + if (ret < 0) { + return ret; + } + + return 0; +} + +static int nxp_video_sdma_stream_stop(const struct device *dev) +{ + const struct nxp_video_sdma_config *config = dev->config; + + /* Stop DMA engine */ + return dma_stop(config->dma_dev, 0); +} + +static int nxp_video_sdma_enqueue(const struct device *dev, + enum video_endpoint_id ep, + struct video_buffer *vbuf) +{ + struct nxp_video_sdma_data *data = dev->data; + + if (ep != VIDEO_EP_OUT) { + return -EINVAL; + } + + /* SmartDMA will read 30 lines of RGB565 video data into framebuffer */ + vbuf->bytesused = SDMA_VBUF_WIDTH * SDMA_LINE_COUNT * sizeof(uint16_t); + if (vbuf->size < vbuf->bytesused) { + return -EINVAL; + } + + /* Put buffer into FIFO */ + k_fifo_put(&data->fifo_in, vbuf); + if (data->stream_starved) { + /* Kick SmartDMA off */ + nxp_video_sdma_stream_start(dev); + } + return 0; +} + +static int nxp_video_sdma_dequeue(const struct device *dev, + enum video_endpoint_id ep, + struct video_buffer **vbuf, + k_timeout_t timeout) +{ + struct nxp_video_sdma_data *data = dev->data; + + if (ep != VIDEO_EP_OUT) { + return -EINVAL; + } + + *vbuf = k_fifo_get(&data->fifo_out, timeout); + if (*vbuf == NULL) { + return -EAGAIN; + } + + return 0; +} + +static int nxp_video_sdma_flush(const struct device *dev, + enum video_endpoint_id ep, + bool cancel) +{ + const struct nxp_video_sdma_config *config = dev->config; + struct nxp_video_sdma_data *data = dev->data; + struct video_buf *vbuf; + + if (!cancel) { + /* Wait for DMA to signal it is empty */ + k_sem_take(&data->stream_empty, K_FOREVER); + } else { + /* Stop DMA engine */ + dma_stop(config->dma_dev, 0); + /* Forward all buffers in fifo_in to fifo_out */ + while ((vbuf = k_fifo_get(&data->fifo_in, K_NO_WAIT))) { + k_fifo_put(&data->fifo_out, vbuf); + } + } + return 0; +} + +/* SDMA only supports 320x240 RGB565 */ +static const struct video_format_cap fmts[] = { + { + .pixelformat = VIDEO_PIX_FMT_RGB565, + .width_min = SDMA_VBUF_WIDTH, + .width_max = SDMA_VBUF_WIDTH, + .height_min = SDMA_VBUF_HEIGHT, + .height_max = SDMA_VBUF_HEIGHT, + .width_step = 0, + .height_step = 0, + }, + { 0 }, +}; + +static int nxp_video_sdma_set_format(const struct device *dev, + enum video_endpoint_id ep, + struct video_format *fmt) +{ + const struct nxp_video_sdma_config *config = dev->config; + + if (fmt == NULL || ep != VIDEO_EP_OUT) { + return -EINVAL; + } + + if (!device_is_ready(config->sensor_dev)) { + LOG_ERR("Sensor device not ready"); + return -ENODEV; + } + + if ((fmt->pixelformat != fmts[0].pixelformat) || + (fmt->width != fmts[0].width_min) || + (fmt->height != fmts[0].height_min) || + (fmt->pitch != fmts[0].width_min * 2)) { + LOG_ERR("Unsupported format"); + return -ENOTSUP; + } + + /* Forward format to sensor device */ + return video_set_format(config->sensor_dev, ep, fmt); +} + +static int nxp_video_sdma_get_format(const struct device *dev, + enum video_endpoint_id ep, + struct video_format *fmt) +{ + const struct nxp_video_sdma_config *config = dev->config; + int ret; + + if (fmt == NULL || ep != VIDEO_EP_OUT) { + return -EINVAL; + } + + if (!device_is_ready(config->sensor_dev)) { + LOG_ERR("Sensor device not ready"); + return -ENODEV; + } + + /* + * Check sensor format. If it is not RGB565 320x240 + * reconfigure the sensor, + * as this is the only format supported. + */ + ret = video_get_format(config->sensor_dev, VIDEO_EP_OUT, fmt); + if (ret < 0) { + return ret; + } + + /* Verify that format is RGB565 */ + if ((fmt->pixelformat != fmts[0].pixelformat) || + (fmt->width != fmts[0].width_min) || + (fmt->height != fmts[0].height_min) || + (fmt->pitch != fmts[0].width_min * 2)) { + /* Update format of sensor */ + fmt->pixelformat = fmts[0].pixelformat; + fmt->width = fmts[0].width_min; + fmt->height = fmts[0].height_min; + fmt->pitch = fmts[0].width_min * 2; + ret = video_set_format(config->sensor_dev, VIDEO_EP_OUT, fmt); + if (ret < 0) { + LOG_ERR("Sensor device does not support RGB565"); + return ret; + } + } + + return 0; +} + +static int nxp_video_sdma_get_caps(const struct device *dev, + enum video_endpoint_id ep, + struct video_caps *caps) +{ + if (ep != VIDEO_EP_OUT) { + return -EINVAL; + } + + /* SmartDMA needs at least two buffers allocated before starting */ + caps->min_vbuf_count = 2; + /* Firmware reads 30 lines per queued vbuf */ + caps->min_line_count = caps->max_line_count = SDMA_LINE_COUNT; + caps->format_caps = fmts; + return 0; +} + +static int nxp_video_sdma_init(const struct device *dev) +{ + const struct nxp_video_sdma_config *config = dev->config; + struct nxp_video_sdma_data *data = dev->data; + int ret; + + if (!device_is_ready(config->dma_dev)) { + LOG_ERR("SmartDMA not ready"); + return -ENODEV; + } + + INPUTMUX_Init(INPUTMUX0); + /* Attach Camera VSYNC, HSYNC, and PCLK as inputs 0, 1, and 2 of the SmartDMA */ + INPUTMUX_AttachSignal(INPUTMUX0, 0, + config->vsync_pin + (SMARTDMAARCHB_INMUX0 << PMUX_SHIFT)); + INPUTMUX_AttachSignal(INPUTMUX0, 1, + config->hsync_pin + (SMARTDMAARCHB_INMUX0 << PMUX_SHIFT)); + INPUTMUX_AttachSignal(INPUTMUX0, 2, + config->pclk_pin + (SMARTDMAARCHB_INMUX0 << PMUX_SHIFT)); + /* Turnoff clock to inputmux to save power. Clock is only needed to make changes */ + INPUTMUX_Deinit(INPUTMUX0); + + k_fifo_init(&data->fifo_in); + k_fifo_init(&data->fifo_out); + /* Given to when the DMA engine runs out of buffers */ + k_sem_init(&data->stream_empty, 0, 1); + + /* Install camera firmware used by SmartDMA */ + dma_smartdma_install_fw(config->dma_dev, (uint8_t *)s_smartdmaCameraFirmware, + s_smartdmaCameraFirmwareSize); + ret = pinctrl_apply_state(config->pincfg, PINCTRL_STATE_DEFAULT); + if (ret < 0) { + return ret; + } + + return 0; +} + +static const struct video_driver_api nxp_video_sdma_api = { + .get_format = nxp_video_sdma_get_format, + .set_format = nxp_video_sdma_set_format, + .get_caps = nxp_video_sdma_get_caps, + .stream_start = nxp_video_sdma_stream_start, + .stream_stop = nxp_video_sdma_stream_stop, + .enqueue = nxp_video_sdma_enqueue, + .dequeue = nxp_video_sdma_dequeue, + .flush = nxp_video_sdma_flush +}; + +#define NXP_VIDEO_SDMA_INIT(inst) \ + PINCTRL_DT_INST_DEFINE(inst); \ + const struct nxp_video_sdma_config sdma_config_##inst = { \ + .dma_dev = DEVICE_DT_GET(DT_INST_PARENT(inst)), \ + .sensor_dev = DEVICE_DT_GET(DT_INST_PHANDLE(inst, sensor)), \ + .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ + .vsync_pin = DT_INST_PROP(inst, vsync_pin), \ + .hsync_pin = DT_INST_PROP(inst, hsync_pin), \ + .pclk_pin = DT_INST_PROP(inst, pclk_pin), \ + }; \ + struct nxp_video_sdma_data sdma_data_##inst = { \ + .config = &sdma_config_##inst, \ + }; \ + \ + DEVICE_DT_INST_DEFINE(inst, nxp_video_sdma_init, NULL, \ + &sdma_data_##inst, &sdma_config_##inst, \ + POST_KERNEL, \ + CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ + &nxp_video_sdma_api); + +DT_INST_FOREACH_STATUS_OKAY(NXP_VIDEO_SDMA_INIT) diff --git a/dts/bindings/video/nxp,video-smartdma.yaml b/dts/bindings/video/nxp,video-smartdma.yaml new file mode 100644 index 0000000000000..5312f2b3bc377 --- /dev/null +++ b/dts/bindings/video/nxp,video-smartdma.yaml @@ -0,0 +1,29 @@ +# Copyright 2024 NXP +# SPDX-License-Identifier: Apache-2.0 + +description: NXP SmartDMA Video Driver + +compatible: "nxp,video-smartdma" + +include: [base.yaml, pinctrl-device.yaml] + +properties: + sensor: + required: true + type: phandle + description: phandle of connected sensor device + vsync-pin: + required: true + type: int + description: | + GPIO0 pin index to use for VSYNC input. Only pins 0-15 may be used. + hsync-pin: + required: true + type: int + description: | + GPIO0 pin index to use for HSYNC input. Only pins 0-15 may be used. + pclk-pin: + required: true + type: int + description: | + GPIO0 pin index to use for PCLK input. Only pins 0-15 may be used. From df448b6fbb0ba62607a046b54bf5c509fdbeabc2 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Wed, 15 May 2024 22:26:58 +0000 Subject: [PATCH 0785/4482] dts: arm: nxp: nxp_mcxn94x: add definition for SMARTDMA device Add definition for SMARTDMA device to the MCXN94x devicetree. Signed-off-by: Daniel DeGrasse --- dts/arm/nxp/nxp_mcxn94x_common.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dts/arm/nxp/nxp_mcxn94x_common.dtsi b/dts/arm/nxp/nxp_mcxn94x_common.dtsi index bb33a8f6081b3..ea7be0f303e36 100644 --- a/dts/arm/nxp/nxp_mcxn94x_common.dtsi +++ b/dts/arm/nxp/nxp_mcxn94x_common.dtsi @@ -788,6 +788,15 @@ prescale = <0>; }; + smartdma: smartdma@33000 { + compatible = "nxp,smartdma"; + reg = <0x33000 0x1000>; + status = "disabled"; + interrupts = <53 0>; + program-mem = <0x4000000>; + #dma-cells = <0>; + }; + usdhc0: usdhc@109000 { compatible = "nxp,imx-usdhc"; reg = <0x109000 0x1000>; From 7c3f0f6a34bafe37a9465aff8a5f8fdd4e687957 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Wed, 15 May 2024 22:29:38 +0000 Subject: [PATCH 0786/4482] boards: nxp: frdm_mcn947: add support for LPI2C7 Add support for LPI2C7. This peripheral is used for interfacing with cameras connected to the J9 header. Signed-off-by: Daniel DeGrasse --- boards/nxp/frdm_mcxn947/board.c | 5 +++++ boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi | 12 ++++++++++++ boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi | 6 ++++++ .../nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi | 8 ++++++++ 4 files changed, 31 insertions(+) diff --git a/boards/nxp/frdm_mcxn947/board.c b/boards/nxp/frdm_mcxn947/board.c index db21a4ae19478..b9f6894812a50 100644 --- a/boards/nxp/frdm_mcxn947/board.c +++ b/boards/nxp/frdm_mcxn947/board.c @@ -161,6 +161,11 @@ static int frdm_mcxn947_init(void) CLOCK_AttachClk(kFRO12M_to_FLEXCOMM4); #endif +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm7)) + CLOCK_SetClkDiv(kCLOCK_DivFlexcom7Clk, 1u); + CLOCK_AttachClk(kFRO12M_to_FLEXCOMM7); +#endif + #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(os_timer)) CLOCK_AttachClk(kCLK_1M_to_OSTIMER); #endif diff --git a/boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi b/boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi index 68a1fa17301ff..dfac9b6c50b6f 100644 --- a/boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi +++ b/boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi @@ -31,6 +31,18 @@ }; }; + pinmux_flexcomm7_lpi2c: pimux_flexcomm7_lpi2c { + group0 { + pinmux = , + ; + slew-rate = "fast"; + drive-strength = "low"; + input-enable; + bias-pull-up; + drive-open-drain; + }; + }; + pinmux_flexcomm2_lpuart: pinmux_flexcomm2_lpuart { group0 { pinmux = , diff --git a/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi b/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi index 3745e29ede7d2..9611aa35c5eb4 100644 --- a/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi +++ b/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi @@ -91,6 +91,12 @@ nxp_8080_touch_panel_i2c: &flexcomm2_lpi2c2 { pinctrl-names = "default"; }; +&flexcomm7_lpi2c7 { + pinctrl-0 = <&pinmux_flexcomm7_lpi2c>; + pinctrl-names = "default"; + clock-frequency = ; +}; + /* * MCXN947 board uses OS timer as the kernel timer * In case we need to switch to SYSTICK timer, then diff --git a/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi b/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi index d571d35384fbd..5a536de828083 100644 --- a/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi +++ b/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi @@ -113,6 +113,14 @@ status = "okay"; }; +&flexcomm7 { + status = "okay"; +}; + +&flexcomm7_lpi2c7 { + status = "okay"; +}; + &flexspi { status = "okay"; }; From a79574f9dc9a457445a16511c53e2615bca14e24 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Wed, 15 May 2024 22:31:05 +0000 Subject: [PATCH 0787/4482] boards: nxp: frdm_mcnx947: add support for SMARTDMA camera engine Add support for SMARTDMA camera engine, and a OV7670 parallel camera definition for the frdm_mcnx947 board. This support has been tested with the video capture sample. Signed-off-by: Daniel DeGrasse --- boards/nxp/frdm_mcxn947/board.c | 13 ++++++++++ .../frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi | 25 +++++++++++++++++++ boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi | 22 ++++++++++++++++ 3 files changed, 60 insertions(+) diff --git a/boards/nxp/frdm_mcxn947/board.c b/boards/nxp/frdm_mcxn947/board.c index b9f6894812a50..eb3d6c5ab4ce7 100644 --- a/boards/nxp/frdm_mcxn947/board.c +++ b/boards/nxp/frdm_mcxn947/board.c @@ -265,6 +265,19 @@ static int frdm_mcxn947_init(void) enable_cache64(); #endif +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(smartdma)) + CLOCK_EnableClock(kCLOCK_Smartdma); + RESET_PeripheralReset(kSMART_DMA_RST_SHIFT_RSTn); +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(video_sdma)) + /* Drive CLKOUT from main clock, divided by 25 to yield 6MHz clock + * The camera will use this clock signal to generate + * PCLK, HSYNC, and VSYNC + */ + CLOCK_AttachClk(kMAIN_CLK_to_CLKOUT); + CLOCK_SetClkDiv(kCLOCK_DivClkOut, 25U); +#endif +#endif + #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(vref)) CLOCK_EnableClock(kCLOCK_Vref); SPC_EnableActiveModeAnalogModules(SPC0, kSPC_controlVref); diff --git a/boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi b/boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi index dfac9b6c50b6f..b868f07891985 100644 --- a/boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi +++ b/boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi @@ -141,6 +141,31 @@ }; }; + pinmux_smartdma_camera: pinmux_smartdma_camera { + group0 { + /* + * SmartDMA pinmux is not defined by SOC header, so + * we encode it manually + */ + pinmux = , + , + , + , + , + , + , + , + , + , + , + , + ; + drive-strength = "low"; + slew-rate = "fast"; + input-enable; + }; + }; + pinmux_usdhc0: pinmux_usdhc0 { group0 { pinmux = , diff --git a/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi b/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi index 9611aa35c5eb4..bf4c633a7ac74 100644 --- a/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi +++ b/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi @@ -95,6 +95,28 @@ nxp_8080_touch_panel_i2c: &flexcomm2_lpi2c2 { pinctrl-0 = <&pinmux_flexcomm7_lpi2c>; pinctrl-names = "default"; clock-frequency = ; + ov7670: ov7670@21 { + compatible = "ovti,ov7670"; + reset-gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>; + pwdn-gpios = <&gpio1 18 GPIO_ACTIVE_HIGH>; + reg = <0x21>; + }; +}; + +/* SmartDMA is used for video driver on this board */ +&smartdma { + status = "okay"; + program-mem = <0x4000000>; + video_sdma: video-sdma { + status = "okay"; + compatible = "nxp,video-smartdma"; + pinctrl-0 = <&pinmux_smartdma_camera>; + pinctrl-names = "default"; + sensor = <&ov7670>; + vsync-pin = <4>; + hsync-pin = <11>; + pclk-pin = <5>; + }; }; /* From 22cb79d2213a829813b80ee58598a8974aa3613a Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Wed, 15 May 2024 22:32:09 +0000 Subject: [PATCH 0788/4482] samples: video: capture: add support for SMARTDMA Add support for using the SMARTDMA engine on the FRDM-MCXN947 board with the video capture sample. Signed-off-by: Daniel DeGrasse --- .../video/capture/boards/frdm_mcxn947_cpu0.conf | 5 +++++ .../video/capture/boards/frdm_mcxn947_cpu0.overlay | 11 +++++++++++ 2 files changed, 16 insertions(+) create mode 100644 samples/drivers/video/capture/boards/frdm_mcxn947_cpu0.conf create mode 100644 samples/drivers/video/capture/boards/frdm_mcxn947_cpu0.overlay diff --git a/samples/drivers/video/capture/boards/frdm_mcxn947_cpu0.conf b/samples/drivers/video/capture/boards/frdm_mcxn947_cpu0.conf new file mode 100644 index 0000000000000..4a604bc267ef2 --- /dev/null +++ b/samples/drivers/video/capture/boards/frdm_mcxn947_cpu0.conf @@ -0,0 +1,5 @@ +CONFIG_VIDEO_BUFFER_POOL_SZ_MAX=40000 +CONFIG_VIDEO_BUFFER_POOL_NUM_MAX=2 +# Workaround for issue where SDMA driver needs to start before camera, so that +# clock output will be generated for camera device +CONFIG_CHECK_INIT_PRIORITIES=n diff --git a/samples/drivers/video/capture/boards/frdm_mcxn947_cpu0.overlay b/samples/drivers/video/capture/boards/frdm_mcxn947_cpu0.overlay new file mode 100644 index 0000000000000..db18ee736c4ff --- /dev/null +++ b/samples/drivers/video/capture/boards/frdm_mcxn947_cpu0.overlay @@ -0,0 +1,11 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/{ + chosen { + zephyr,camera = &video_sdma; + }; +}; From 20cce995dacf6ed1bc5e17a325fec0e42447b784 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 4 Oct 2024 16:22:31 -0500 Subject: [PATCH 0789/4482] samples: drivers: video: capture: don't apply format unless needed Do not apply format setting unless needed. Also, correct the check for the RGB565 format setting- the zephyr display API treats RGB565 and BGR565 as big endian, so the format needed here is BGR565. Signed-off-by: Daniel DeGrasse --- samples/drivers/video/capture/src/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/samples/drivers/video/capture/src/main.c b/samples/drivers/video/capture/src/main.c index 311049284498a..aafa70d29a263 100644 --- a/samples/drivers/video/capture/src/main.c +++ b/samples/drivers/video/capture/src/main.c @@ -36,10 +36,14 @@ static inline int display_setup(const struct device *const display_dev, const ui /* Set display pixel format to match the one in use by the camera */ switch (pixfmt) { case VIDEO_PIX_FMT_RGB565: - ret = display_set_pixel_format(display_dev, PIXEL_FORMAT_RGB_565); + if (capabilities.current_pixel_format != PIXEL_FORMAT_BGR_565) { + ret = display_set_pixel_format(display_dev, PIXEL_FORMAT_BGR_565); + } break; case VIDEO_PIX_FMT_XRGB32: - ret = display_set_pixel_format(display_dev, PIXEL_FORMAT_ARGB_8888); + if (capabilities.current_pixel_format != PIXEL_FORMAT_ARGB_8888) { + ret = display_set_pixel_format(display_dev, PIXEL_FORMAT_ARGB_8888); + } break; default: return -ENOTSUP; From 7408004531dc2f7c20879fed7ccaa207ba3ca10c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 13 Sep 2024 14:04:47 +0300 Subject: [PATCH 0790/4482] logging: backend: Add websocket backend Allow logging output to websocket console. Requires that websocket shell backend and websocket HTTP server support is also enabled. Signed-off-by: Jukka Rissanen --- subsys/logging/backends/CMakeLists.txt | 5 + subsys/logging/backends/Kconfig | 1 + subsys/logging/backends/Kconfig.ws | 44 +++++ subsys/logging/backends/log_backend_ws.c | 227 +++++++++++++++++++++++ 4 files changed, 277 insertions(+) create mode 100644 subsys/logging/backends/Kconfig.ws create mode 100644 subsys/logging/backends/log_backend_ws.c diff --git a/subsys/logging/backends/CMakeLists.txt b/subsys/logging/backends/CMakeLists.txt index 7ab40c8cb3064..d7090e7c5f780 100644 --- a/subsys/logging/backends/CMakeLists.txt +++ b/subsys/logging/backends/CMakeLists.txt @@ -35,6 +35,11 @@ zephyr_sources_ifdef( log_backend_net.c ) +zephyr_sources_ifdef( + CONFIG_LOG_BACKEND_WS + log_backend_ws.c +) + zephyr_sources_ifdef( CONFIG_LOG_BACKEND_RTT log_backend_rtt.c diff --git a/subsys/logging/backends/Kconfig b/subsys/logging/backends/Kconfig index 960aeb20c2a13..0368f369b08d8 100644 --- a/subsys/logging/backends/Kconfig +++ b/subsys/logging/backends/Kconfig @@ -10,6 +10,7 @@ rsource "Kconfig.efi_console" rsource "Kconfig.fs" rsource "Kconfig.native_posix" rsource "Kconfig.net" +rsource "Kconfig.ws" rsource "Kconfig.rtt" rsource "Kconfig.spinel" rsource "Kconfig.swo" diff --git a/subsys/logging/backends/Kconfig.ws b/subsys/logging/backends/Kconfig.ws new file mode 100644 index 0000000000000..497cacac74b83 --- /dev/null +++ b/subsys/logging/backends/Kconfig.ws @@ -0,0 +1,44 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config LOG_BACKEND_WS + bool "Websocket backend" + depends on WEBSOCKET_CONSOLE + select LOG_OUTPUT + default y + help + Send console messages to websocket console. + +if LOG_BACKEND_WS + +config LOG_BACKEND_WS_MAX_BUF_SIZE + int "Max message size" + range 64 1500 + default 512 + help + Maximum size of the output string that is sent via websocket. + +config LOG_BACKEND_WS_TX_RETRY_CNT + int "Number of TX retries" + default 2 + help + Number of TX retries before dropping the full line of data. + +config LOG_BACKEND_WS_TX_RETRY_DELAY_MS + int "Delay between TX retries in milliseconds" + default 50 + help + Sleep period between TX retry attempts. + +config LOG_BACKEND_WS_AUTOSTART + bool "Automatically start websocket backend" + default y if NET_CONFIG_NEED_IPV4 || NET_CONFIG_NEED_IPV6 + help + When enabled automatically start the websocket backend on + application start. + +backend = WS +backend-str = websocket +source "subsys/logging/Kconfig.template.log_format_config" + +endif # LOG_BACKEND_WS diff --git a/subsys/logging/backends/log_backend_ws.c b/subsys/logging/backends/log_backend_ws.c new file mode 100644 index 0000000000000..03dc995d48d17 --- /dev/null +++ b/subsys/logging/backends/log_backend_ws.c @@ -0,0 +1,227 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +LOG_MODULE_REGISTER(log_backend_ws, CONFIG_LOG_DEFAULT_LEVEL); + +#include +#include +#include +#include +#include +#include +#include + +/* Set this to 1 if you want to see what is being sent to server */ +#define DEBUG_PRINTING 0 + +#define DBG(fmt, ...) IF_ENABLED(DEBUG_PRINTING, (printk(fmt, ##__VA_ARGS__))) + +static bool ws_init_done; +static bool panic_mode; +static uint32_t log_format_current = CONFIG_LOG_BACKEND_WS_OUTPUT_DEFAULT; +static uint8_t output_buf[CONFIG_LOG_BACKEND_WS_MAX_BUF_SIZE]; +static size_t pos; + +static struct log_backend_ws_ctx { + int sock; +} ctx = { + .sock = -1, +}; + +static void wait(void) +{ + k_msleep(CONFIG_LOG_BACKEND_WS_TX_RETRY_DELAY_MS); +} + +static int ws_send_all(int sock, const char *output, size_t len) +{ + int ret; + + while (len > 0) { + ret = zsock_send(sock, output, len, ZSOCK_MSG_DONTWAIT); + if ((ret < 0) && (errno == EAGAIN)) { + return -EAGAIN; + } + + if (ret < 0) { + ret = -errno; + return ret; + } + + output += ret; + len -= ret; + } + + return 0; +} + +static int ws_console_out(struct log_backend_ws_ctx *ctx, int c) +{ + static int max_cnt = CONFIG_LOG_BACKEND_WS_TX_RETRY_CNT; + bool printnow = false; + unsigned int cnt = 0; + int ret; + + if (pos >= (sizeof(output_buf) - 1)) { + printnow = true; + } else { + if ((c != '\n') && (c != '\r')) { + output_buf[pos++] = c; + } else { + printnow = true; + } + } + + if (printnow) { + while (ctx->sock >= 0 && cnt < max_cnt) { + ret = ws_send_all(ctx->sock, output_buf, pos); + if (ret < 0) { + if (ret == -EAGAIN) { + wait(); + cnt++; + continue; + } + } + + break; + } + + if (ctx->sock >= 0 && ret == 0) { + /* We could send data */ + pos = 0; + } else { + /* If the line is full and we cannot send, then + * ignore the output data in buffer. + */ + if (pos >= (sizeof(output_buf) - 1)) { + pos = 0; + } + } + } + + return cnt; +} + +static int line_out(uint8_t *data, size_t length, void *output_ctx) +{ + struct log_backend_ws_ctx *ctx = (struct log_backend_ws_ctx *)output_ctx; + int ret = -ENOMEM; + + if (ctx == NULL || ctx->sock == -1) { + return length; + } + + for (int i = 0; i < length; i++) { + ret = ws_console_out(ctx, data[i]); + if (ret < 0) { + goto fail; + } + } + + length = ret; + + DBG(data); +fail: + return length; +} + +LOG_OUTPUT_DEFINE(log_output_ws, line_out, output_buf, sizeof(output_buf)); + +static int do_ws_init(struct log_backend_ws_ctx *ctx) +{ + log_output_ctx_set(&log_output_ws, ctx); + + return 0; +} + +static void process(const struct log_backend *const backend, + union log_msg_generic *msg) +{ + uint32_t flags = LOG_OUTPUT_FLAG_FORMAT_SYSLOG | + LOG_OUTPUT_FLAG_TIMESTAMP | + LOG_OUTPUT_FLAG_THREAD; + log_format_func_t log_output_func; + + if (panic_mode) { + return; + } + + if (!ws_init_done && do_ws_init(&ctx) == 0) { + ws_init_done = true; + } + + log_output_func = log_format_func_t_get(log_format_current); + + log_output_func(&log_output_ws, &msg->log, flags); +} + +static int format_set(const struct log_backend *const backend, uint32_t log_type) +{ + log_format_current = log_type; + return 0; +} + +void log_backend_ws_start(void) +{ + const struct log_backend *backend = log_backend_ws_get(); + + if (!log_backend_is_active(backend)) { + log_backend_activate(backend, backend->cb->ctx); + } +} + +int log_backend_ws_register(int fd) +{ + struct log_backend_ws_ctx *ctx = log_output_ws.control_block->ctx; + + ctx->sock = fd; + + return 0; +} + +int log_backend_ws_unregister(int fd) +{ + struct log_backend_ws_ctx *ctx = log_output_ws.control_block->ctx; + + if (ctx->sock != fd) { + DBG("Websocket sock mismatch (%d vs %d)", ctx->sock, fd); + } + + ctx->sock = -1; + + return 0; +} + +static void init_ws(struct log_backend const *const backend) +{ + ARG_UNUSED(backend); + + log_backend_deactivate(log_backend_ws_get()); +} + +static void panic(struct log_backend const *const backend) +{ + panic_mode = true; +} + +const struct log_backend_api log_backend_ws_api = { + .panic = panic, + .init = init_ws, + .process = process, + .format_set = format_set, +}; + +/* Note that the backend can be activated only after we have networking + * subsystem ready so we must not start it immediately. + */ +LOG_BACKEND_DEFINE(log_backend_ws, log_backend_ws_api, + IS_ENABLED(CONFIG_LOG_BACKEND_WS_AUTOSTART)); + +const struct log_backend *log_backend_ws_get(void) +{ + return &log_backend_ws; +} From 7510e2d94074f662c9ff2e99cfda41e5a65a3cc7 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 3 May 2024 16:33:26 +0300 Subject: [PATCH 0791/4482] shell: backend: Create a websocket transport backend This creates a websocket based shell backend that is used to implement a websocket console that can be connected using a browser. Signed-off-by: Jukka Rissanen --- include/zephyr/shell/shell_websocket.h | 151 +++++++++ subsys/net/lib/http/Kconfig | 6 + subsys/net/lib/http/http_server_ws.c | 2 +- subsys/net/lib/websocket/Kconfig | 1 + subsys/shell/backends/CMakeLists.txt | 5 + subsys/shell/backends/Kconfig.backends | 119 +++++++ subsys/shell/backends/shell_websocket.c | 404 ++++++++++++++++++++++++ 7 files changed, 687 insertions(+), 1 deletion(-) create mode 100644 include/zephyr/shell/shell_websocket.h create mode 100644 subsys/shell/backends/shell_websocket.c diff --git a/include/zephyr/shell/shell_websocket.h b/include/zephyr/shell/shell_websocket.h new file mode 100644 index 0000000000000..8eacd964dbf3b --- /dev/null +++ b/include/zephyr/shell/shell_websocket.h @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef SHELL_WEBSOCKET_H__ +#define SHELL_WEBSOCKET_H__ + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define SHELL_WEBSOCKET_SERVICE_COUNT CONFIG_SHELL_WEBSOCKET_BACKEND_COUNT + +/** Line buffer structure. */ +struct shell_websocket_line_buf { + /** Line buffer. */ + char buf[CONFIG_SHELL_WEBSOCKET_LINE_BUF_SIZE]; + + /** Current line length. */ + uint16_t len; +}; + +/** WEBSOCKET-based shell transport. */ +struct shell_websocket { + /** Handler function registered by shell. */ + shell_transport_handler_t shell_handler; + + /** Context registered by shell. */ + void *shell_context; + + /** Buffer for outgoing line. */ + struct shell_websocket_line_buf line_out; + + /** Array for sockets used by the websocket service. */ + struct zsock_pollfd fds[1]; + + /** Input buffer. */ + uint8_t rx_buf[CONFIG_SHELL_CMD_BUFF_SIZE]; + + /** Number of data bytes within the input buffer. */ + size_t rx_len; + + /** Mutex protecting the input buffer access. */ + struct k_mutex rx_lock; + + /** The delayed work is used to send non-lf terminated output that has + * been around for "too long". This will prove to be useful + * to send the shell prompt for instance. + */ + struct k_work_delayable send_work; + struct k_work_sync work_sync; + + /** If set, no output is sent to the WEBSOCKET client. */ + bool output_lock; +}; + +extern const struct shell_transport_api shell_websocket_transport_api; +extern int shell_websocket_setup(int ws_socket, void *user_data); +extern int shell_websocket_enable(const struct shell *sh); + +#define GET_WS_NAME(_service) ws_ctx_##_service +#define GET_WS_SHELL_NAME(_name) shell_websocket_##_name +#define GET_WS_TRANSPORT_NAME(_service) transport_shell_ws_##_service +#define GET_WS_DETAIL_NAME(_service) ws_res_detail_##_service + +#define SHELL_WEBSOCKET_DEFINE(_service) \ + static struct shell_websocket GET_WS_NAME(_service); \ + static struct shell_transport GET_WS_TRANSPORT_NAME(_service) = { \ + .api = &shell_websocket_transport_api, \ + .ctx = &GET_WS_NAME(_service), \ + } + +#define SHELL_WS_PORT_NAME(_service) http_service_##_service +#define SHELL_WS_BUF_NAME(_service) ws_recv_buffer_##_service +#define SHELL_WS_TEMP_RECV_BUF_SIZE 256 + +#define DEFINE_WEBSOCKET_HTTP_SERVICE(_service) \ + uint8_t SHELL_WS_BUF_NAME(_service)[SHELL_WS_TEMP_RECV_BUF_SIZE]; \ + struct http_resource_detail_websocket \ + GET_WS_DETAIL_NAME(_service) = { \ + .common = { \ + .type = HTTP_RESOURCE_TYPE_WEBSOCKET, \ + \ + /* We need HTTP/1.1 GET method for upgrading */ \ + .bitmask_of_supported_http_methods = BIT(HTTP_GET), \ + }, \ + .cb = shell_websocket_setup, \ + .data_buffer = SHELL_WS_BUF_NAME(_service), \ + .data_buffer_len = sizeof(SHELL_WS_BUF_NAME(_service)), \ + .user_data = &GET_WS_NAME(_service), \ + }; \ + HTTP_RESOURCE_DEFINE(ws_resource_##_service, _service, \ + "/" CONFIG_SHELL_WEBSOCKET_ENDPOINT_URL, \ + &GET_WS_DETAIL_NAME(_service)) + +#define DEFINE_WEBSOCKET_SERVICE(_service) \ + SHELL_WEBSOCKET_DEFINE(_service); \ + SHELL_DEFINE(shell_websocket_##_service, \ + CONFIG_SHELL_WEBSOCKET_PROMPT, \ + &GET_WS_TRANSPORT_NAME(_service), \ + CONFIG_SHELL_WEBSOCKET_LOG_MESSAGE_QUEUE_SIZE, \ + CONFIG_SHELL_WEBSOCKET_LOG_MESSAGE_QUEUE_TIMEOUT, \ + SHELL_FLAG_OLF_CRLF); \ + DEFINE_WEBSOCKET_HTTP_SERVICE(_service) + +#if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS) +/* Use a secure connection only for Websocket. */ +#define WEBSOCKET_CONSOLE_DEFINE(_service, _sec_tag_list, _sec_tag_list_size) \ + static uint16_t SHELL_WS_PORT_NAME(_service) = \ + CONFIG_SHELL_WEBSOCKET_PORT; \ + HTTPS_SERVICE_DEFINE(_service, \ + CONFIG_SHELL_WEBSOCKET_IP_ADDR, \ + &SHELL_WS_PORT_NAME(_service), \ + SHELL_WEBSOCKET_SERVICE_COUNT, \ + SHELL_WEBSOCKET_SERVICE_COUNT, \ + NULL, \ + _sec_tag_list, \ + _sec_tag_list_size); \ + DEFINE_WEBSOCKET_SERVICE(_service); \ + + +#else /* CONFIG_NET_SOCKETS_SOCKOPT_TLS */ +/* TLS not possible so define only normal HTTP service */ +#define WEBSOCKET_CONSOLE_DEFINE(_service, _sec_tag_list, _sec_tag_list_size) \ + static uint16_t SHELL_WS_PORT_NAME(_service) = \ + CONFIG_SHELL_WEBSOCKET_PORT; \ + HTTP_SERVICE_DEFINE(_service, \ + CONFIG_SHELL_WEBSOCKET_IP_ADDR, \ + &SHELL_WS_PORT_NAME(_service), \ + SHELL_WEBSOCKET_SERVICE_COUNT, \ + SHELL_WEBSOCKET_SERVICE_COUNT, \ + NULL); \ + DEFINE_WEBSOCKET_SERVICE(_service) + +#endif /* CONFIG_NET_SOCKETS_SOCKOPT_TLS */ + +#define WEBSOCKET_CONSOLE_ENABLE(_service) \ + (void)shell_websocket_enable(&GET_WS_SHELL_NAME(_service)) + +#ifdef __cplusplus +} +#endif + +#endif /* SHELL_WEBSOCKET_H__ */ diff --git a/subsys/net/lib/http/Kconfig b/subsys/net/lib/http/Kconfig index 35546273a3798..98d8f72f0ded7 100644 --- a/subsys/net/lib/http/Kconfig +++ b/subsys/net/lib/http/Kconfig @@ -179,6 +179,12 @@ config HTTP_SERVER_RESTART_DELAY allow any existing connections to finalize to avoid binding errors during initialization. +config WEBSOCKET_CONSOLE + bool + default y if HTTP_SERVER_WEBSOCKET && SHELL_BACKEND_WEBSOCKET + help + Hidden option that is enabled only when all the necessary options + needed by websocket console are set. endif # Hidden option to avoid having multiple individual options that are ORed together diff --git a/subsys/net/lib/http/http_server_ws.c b/subsys/net/lib/http/http_server_ws.c index 593a73526d7af..4cf1a7d1a6c98 100644 --- a/subsys/net/lib/http/http_server_ws.c +++ b/subsys/net/lib/http/http_server_ws.c @@ -110,7 +110,7 @@ int handle_http1_to_websocket_upgrade(struct http_client_ctx *client) ret = ws_detail->cb(ws_sock, ws_detail->user_data); if (ret < 0) { NET_DBG("WS connection failed (%d)", ret); - zsock_close(ws_sock); + websocket_unregister(ws_sock); goto error; } } diff --git a/subsys/net/lib/websocket/Kconfig b/subsys/net/lib/websocket/Kconfig index c3aa3470f4421..457cbc0c42b5d 100644 --- a/subsys/net/lib/websocket/Kconfig +++ b/subsys/net/lib/websocket/Kconfig @@ -24,6 +24,7 @@ if WEBSOCKET_CLIENT config WEBSOCKET_MAX_CONTEXTS int "Max number of websockets to allocate" + default SHELL_WEBSOCKET_BACKEND_COUNT if SHELL_BACKEND_WEBSOCKET default 1 help How many Websockets can be created in the system. diff --git a/subsys/shell/backends/CMakeLists.txt b/subsys/shell/backends/CMakeLists.txt index 42867effc3bdf..ba90e6cbb47ef 100644 --- a/subsys/shell/backends/CMakeLists.txt +++ b/subsys/shell/backends/CMakeLists.txt @@ -25,6 +25,11 @@ zephyr_sources_ifdef( shell_mqtt.c ) +zephyr_sources_ifdef( + CONFIG_SHELL_BACKEND_WEBSOCKET + shell_websocket.c +) + zephyr_sources_ifdef( CONFIG_SHELL_BACKEND_RPMSG shell_rpmsg.c diff --git a/subsys/shell/backends/Kconfig.backends b/subsys/shell/backends/Kconfig.backends index 4524d03b9a408..4dc4f02dabcb3 100644 --- a/subsys/shell/backends/Kconfig.backends +++ b/subsys/shell/backends/Kconfig.backends @@ -572,6 +572,125 @@ source "subsys/logging/Kconfig.template.log_config" endif # SHELL_TELNET_BACKEND +config SHELL_BACKEND_WEBSOCKET + bool "Websocket backend." + depends on HTTP_SERVER_WEBSOCKET + depends on NET_NATIVE_IP + select NET_SOCKETS_SERVICE + select NET_SOCKETS + help + Enable Websocket backend. + +if SHELL_BACKEND_WEBSOCKET + +config SHELL_WEBSOCKET_BACKEND_COUNT + int "How many Webconsole sessions are supported" + default 2 + range 1 8 + help + Each connection consumes memory so select the value according to your + needs. Also note that each console session needs unique HTTP endpoint + configured. + Note that if you have only one HTTP endpoint for the websocket console, + setting the this value to 2, allows latter console session to kick out + the previous one. If set this value to 1, then the latter connecting + webconsole session will fail. If you have multiple HTTP endpoints, then + This value should be increased accordingly. + +config SHELL_WEBSOCKET_PROMPT + string "Displayed prompt name" + default "" + help + Displayed prompt name for Websocket backend. If prompt is set, the shell will + send two newlines during initialization. + +config SHELL_WEBSOCKET_ENDPOINT_URL + string "Websocket endpoint URL" + default "console" + help + What is the HTTP endpoint URL where the client should connect to. + +config SHELL_WEBSOCKET_IP_ADDR + string "Websocket IP listen address" + default "" + help + This option is used to configure on which IP address and network interface + the HTTP server is listening. If left empty, then all network interfaces are + listened. + +config SHELL_WEBSOCKET_PORT + int "Websocket port number" + default 443 if NET_SOCKETS_SOCKOPT_TLS + default 80 + help + This option is used to configure on which port websocket is going + to be bound. + +config SHELL_WEBSOCKET_LINE_BUF_SIZE + int "Websocket line buffer size" + default 100 + help + This option can be used to modify the size of the buffer storing + shell output line, prior to sending it through the network. + Of course an output line can be longer than such size, it just + means sending it will start as soon as it reaches this size. + It really depends on what type of output is expected. + A lot of short lines: better reduce this value. On the contrary, + raise it. + +config SHELL_WEBSOCKET_SEND_TIMEOUT + int "Websocket line send timeout" + default 100 + help + This option can be used to modify the duration of the timer that kick + in when a line buffer is not empty but did not yet meet the line feed. + +module = SHELL_WEBSOCKET +default-timeout = 100 +source "subsys/shell/Kconfig.template.shell_log_queue_timeout" + +default-size = 512 +source "subsys/shell/Kconfig.template.shell_log_queue_size" + +choice + prompt "Initial log level limit" + default SHELL_WEBSOCKET_INIT_LOG_LEVEL_DEFAULT + +config SHELL_WEBSOCKET_INIT_LOG_LEVEL_DEFAULT + bool "System limit (LOG_MAX_LEVEL)" + +config SHELL_WEBSOCKET_INIT_LOG_LEVEL_DBG + bool "Debug" + +config SHELL_WEBSOCKET_INIT_LOG_LEVEL_INF + bool "Info" + +config SHELL_WEBSOCKET_INIT_LOG_LEVEL_WRN + bool "Warning" + +config SHELL_WEBSOCKET_INIT_LOG_LEVEL_ERR + bool "Error" + +config SHELL_WEBSOCKET_INIT_LOG_LEVEL_NONE + bool "None" + +endchoice + +config SHELL_WEBSOCKET_INIT_LOG_LEVEL + int + default 0 if SHELL_WEBSOCKET_INIT_LOG_LEVEL_NONE + default 1 if SHELL_WEBSOCKET_INIT_LOG_LEVEL_ERR + default 2 if SHELL_WEBSOCKET_INIT_LOG_LEVEL_WRN + default 3 if SHELL_WEBSOCKET_INIT_LOG_LEVEL_INF + default 4 if SHELL_WEBSOCKET_INIT_LOG_LEVEL_DBG + default 5 if SHELL_WEBSOCKET_INIT_LOG_LEVEL_DEFAULT + +module = SHELL_WEBSOCKET +module-str = Websocket shell backend +source "subsys/logging/Kconfig.template.log_config" + +endif # SHELL_WEBSOCKET_BACKEND + config SHELL_BACKEND_DUMMY bool "Dummy backend." help diff --git a/subsys/shell/backends/shell_websocket.c b/subsys/shell/backends/shell_websocket.c new file mode 100644 index 0000000000000..27188020e87f5 --- /dev/null +++ b/subsys/shell/backends/shell_websocket.c @@ -0,0 +1,404 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +LOG_MODULE_REGISTER(shell_websocket, CONFIG_SHELL_WEBSOCKET_INIT_LOG_LEVEL); + +#define WEBSOCKET_LINE_SIZE CONFIG_SHELL_WEBSOCKET_LINE_BUF_SIZE +#define WEBSOCKET_TIMEOUT CONFIG_SHELL_WEBSOCKET_SEND_TIMEOUT + +#define WEBSOCKET_MIN_COMMAND_LEN 2 +#define WEBSOCKET_WILL_DO_COMMAND_LEN 3 + +static void ws_server_cb(struct k_work *work); + +NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(websocket_server, NULL, ws_server_cb, + SHELL_WEBSOCKET_SERVICE_COUNT); + +static void ws_end_client_connection(struct shell_websocket *ws) +{ + int ret; + + LOG_DBG("Closing connection to #%d", ws->fds[0].fd); + + (void)log_backend_ws_unregister(ws->fds[0].fd); + + (void)websocket_unregister(ws->fds[0].fd); + + ws->fds[0].fd = -1; + ws->output_lock = false; + + k_work_cancel_delayable_sync(&ws->send_work, &ws->work_sync); + + ret = net_socket_service_register(&websocket_server, ws->fds, + ARRAY_SIZE(ws->fds), NULL); + if (ret < 0) { + LOG_ERR("Failed to re-register socket service (%d)", ret); + } +} + +static int ws_send(struct shell_websocket *ws, bool block) +{ + int ret; + uint8_t *msg = ws->line_out.buf; + uint16_t len = ws->line_out.len; + + if (ws->line_out.len == 0) { + return 0; + } + + if (ws->fds[0].fd < 0) { + return -ENOTCONN; + } + + while (len > 0) { + ret = zsock_send(ws->fds[0].fd, msg, len, + block ? 0 : ZSOCK_MSG_DONTWAIT); + if (!block && (ret < 0) && (errno == EAGAIN)) { + /* Not all data was sent - move the remaining data and + * update length. + */ + memmove(ws->line_out.buf, msg, len); + ws->line_out.len = len; + return -EAGAIN; + } + + if (ret < 0) { + ret = -errno; + LOG_ERR("Failed to send %d, shutting down", -ret); + ws_end_client_connection(ws); + return ret; + } + + msg += ret; + len -= ret; + } + + /* We reinitialize the line buffer */ + ws->line_out.len = 0; + + return 0; +} + +static void ws_send_prematurely(struct k_work *work) +{ + struct k_work_delayable *dwork = k_work_delayable_from_work(work); + struct shell_websocket *ws = CONTAINER_OF(dwork, + struct shell_websocket, + send_work); + int ret; + + /* Use non-blocking send to prevent system workqueue blocking. */ + ret = ws_send(ws, false); + if (ret == -EAGAIN) { + /* Not all data was sent, reschedule the work. */ + k_work_reschedule(&ws->send_work, K_MSEC(WEBSOCKET_TIMEOUT)); + } +} + +static void ws_recv(struct shell_websocket *ws, struct zsock_pollfd *pollfd) +{ + size_t len, buf_left; + uint8_t *buf; + int ret; + + k_mutex_lock(&ws->rx_lock, K_FOREVER); + + buf_left = sizeof(ws->rx_buf) - ws->rx_len; + if (buf_left == 0) { + /* No space left to read TCP stream, try again later. */ + k_mutex_unlock(&ws->rx_lock); + k_msleep(10); + return; + } + + buf = ws->rx_buf + ws->rx_len; + + ret = zsock_recv(pollfd->fd, buf, buf_left, 0); + if (ret < 0) { + LOG_DBG("Websocket client error %d", ret); + goto error; + } else if (ret == 0) { + LOG_DBG("Websocket client closed connection"); + goto error; + } + + len = ret; + + if (len == 0) { + k_mutex_unlock(&ws->rx_lock); + return; + } + + ws->rx_len += len; + + k_mutex_unlock(&ws->rx_lock); + + ws->shell_handler(SHELL_TRANSPORT_EVT_RX_RDY, ws->shell_context); + + return; + +error: + k_mutex_unlock(&ws->rx_lock); + ws_end_client_connection(ws); +} + +static void ws_server_cb(struct k_work *work) +{ + struct net_socket_service_event *evt = + CONTAINER_OF(work, struct net_socket_service_event, work); + socklen_t optlen = sizeof(int); + struct shell_websocket *ws; + int sock_error; + + ws = (struct shell_websocket *)evt->user_data; + + if ((evt->event.revents & ZSOCK_POLLERR) || + (evt->event.revents & ZSOCK_POLLNVAL)) { + (void)zsock_getsockopt(evt->event.fd, SOL_SOCKET, + SO_ERROR, &sock_error, &optlen); + LOG_ERR("Websocket socket %d error (%d)", evt->event.fd, sock_error); + + if (evt->event.fd == ws->fds[0].fd) { + return ws_end_client_connection(ws); + } + + return; + } + + if (!(evt->event.revents & ZSOCK_POLLIN)) { + return; + } + + if (evt->event.fd == ws->fds[0].fd) { + return ws_recv(ws, &ws->fds[0]); + } +} + +static int shell_ws_init(struct shell_websocket *ctx, int ws_socket) +{ + int ret; + + if (ws_socket < 0) { + LOG_ERR("Invalid socket %d", ws_socket); + return -EBADF; + } + + if (ctx->fds[0].fd >= 0) { + /* There is already a websocket connection to this shell, + * kick the previous connection out. + */ + ws_end_client_connection(ctx); + } + + ctx->fds[0].fd = ws_socket; + ctx->fds[0].events = ZSOCK_POLLIN; + + ret = net_socket_service_register(&websocket_server, ctx->fds, + ARRAY_SIZE(ctx->fds), ctx); + if (ret < 0) { + LOG_ERR("Failed to register socket service, %d", ret); + goto error; + } + + log_backend_ws_register(ws_socket); + + return 0; + +error: + if (ctx->fds[0].fd >= 0) { + (void)zsock_close(ctx->fds[0].fd); + ctx->fds[0].fd = -1; + } + + return ret; +} + +/* Shell API */ + +static int init(const struct shell_transport *transport, + const void *config, + shell_transport_handler_t evt_handler, + void *context) +{ + struct shell_websocket *ws; + + ws = (struct shell_websocket *)transport->ctx; + + memset(ws, 0, sizeof(struct shell_websocket)); + for (int i = 0; i < ARRAY_SIZE(ws->fds); i++) { + ws->fds[i].fd = -1; + } + + ws->shell_handler = evt_handler; + ws->shell_context = context; + + k_work_init_delayable(&ws->send_work, ws_send_prematurely); + k_mutex_init(&ws->rx_lock); + + return 0; +} + +static int uninit(const struct shell_transport *transport) +{ + ARG_UNUSED(transport); + + return 0; +} + +static int enable(const struct shell_transport *transport, bool blocking) +{ + ARG_UNUSED(transport); + ARG_UNUSED(blocking); + + return 0; +} + +static int sh_write(const struct shell_transport *transport, + const void *data, size_t length, size_t *cnt) +{ + struct shell_websocket_line_buf *lb; + struct shell_websocket *ws; + uint32_t timeout; + bool was_running; + size_t copy_len; + int ret; + + ws = (struct shell_websocket *)transport->ctx; + + if (ws->fds[0].fd < 0 || ws->output_lock) { + *cnt = length; + return 0; + } + + *cnt = 0; + lb = &ws->line_out; + + /* Stop the transmission timer, so it does not interrupt the operation. + */ + timeout = k_ticks_to_ms_ceil32(k_work_delayable_remaining_get(&ws->send_work)); + was_running = k_work_cancel_delayable_sync(&ws->send_work, &ws->work_sync); + + do { + if (lb->len + length - *cnt > WEBSOCKET_LINE_SIZE) { + copy_len = WEBSOCKET_LINE_SIZE - lb->len; + } else { + copy_len = length - *cnt; + } + + memcpy(lb->buf + lb->len, (uint8_t *)data + *cnt, copy_len); + lb->len += copy_len; + + /* Send the data immediately if the buffer is full or line feed + * is recognized. + */ + if (lb->buf[lb->len - 1] == '\n' || lb->len == WEBSOCKET_LINE_SIZE) { + ret = ws_send(ws, true); + if (ret != 0) { + *cnt = length; + return ret; + } + } + + *cnt += copy_len; + } while (*cnt < length); + + if (lb->len > 0) { + /* Check if the timer was already running, initialize otherwise. + */ + timeout = was_running ? timeout : WEBSOCKET_TIMEOUT; + + k_work_reschedule(&ws->send_work, K_MSEC(timeout)); + } + + ws->shell_handler(SHELL_TRANSPORT_EVT_TX_RDY, ws->shell_context); + + return 0; +} + +static int sh_read(const struct shell_transport *transport, + void *data, size_t length, size_t *cnt) +{ + struct shell_websocket *ws; + size_t read_len; + + ws = (struct shell_websocket *)transport->ctx; + + if (ws->fds[0].fd < 0) { + goto no_data; + } + + k_mutex_lock(&ws->rx_lock, K_FOREVER); + + if (ws->rx_len == 0) { + k_mutex_unlock(&ws->rx_lock); + goto no_data; + } + + read_len = ws->rx_len; + if (read_len > length) { + read_len = length; + } + + memcpy(data, ws->rx_buf, read_len); + *cnt = read_len; + + ws->rx_len -= read_len; + if (ws->rx_len > 0) { + memmove(ws->rx_buf, ws->rx_buf + read_len, ws->rx_len); + } + + k_mutex_unlock(&ws->rx_lock); + + return 0; + +no_data: + *cnt = 0; + return 0; +} + +const struct shell_transport_api shell_websocket_transport_api = { + .init = init, + .uninit = uninit, + .enable = enable, + .write = sh_write, + .read = sh_read +}; + +int shell_websocket_setup(int ws_socket, void *user_data) +{ + struct shell_websocket *ws = user_data; + + return shell_ws_init(ws, ws_socket); +} + +int shell_websocket_enable(const struct shell *sh) +{ + bool log_backend = CONFIG_SHELL_WEBSOCKET_INIT_LOG_LEVEL > 0; + uint32_t level = (CONFIG_SHELL_WEBSOCKET_INIT_LOG_LEVEL > LOG_LEVEL_DBG) ? + CONFIG_LOG_MAX_LEVEL : CONFIG_SHELL_WEBSOCKET_INIT_LOG_LEVEL; + static const struct shell_backend_config_flags cfg_flags = + SHELL_DEFAULT_BACKEND_CONFIG_FLAGS; + int ret; + + ret = shell_init(sh, NULL, cfg_flags, log_backend, level); + if (ret < 0) { + LOG_DBG("Cannot init websocket shell %p", sh); + } + + return ret; +} From c409d106ac64f242a209711c385d370ffa7c6aef Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 8 May 2024 14:22:09 +0300 Subject: [PATCH 0792/4482] samples: net: echo-server: Add websocket console support Add enablers that can be used to setup websocket console for this sample. Signed-off-by: Jukka Rissanen --- .../net/sockets/echo_server/CMakeLists.txt | 18 +++ samples/net/sockets/echo_server/Kconfig | 17 +++ .../echo_server/overlay-ws-console.conf | 12 ++ samples/net/sockets/echo_server/src/common.h | 9 ++ .../net/sockets/echo_server/src/echo-server.c | 2 +- .../src/ws_console/favicon-16x16.png | Bin 0 -> 305 bytes .../echo_server/src/ws_console/index.html | 139 ++++++++++++++++++ .../src/ws_console/sections-rom.ld | 4 + .../echo_server/src/ws_console/style.css | 60 ++++++++ .../sockets/echo_server/src/ws_console/ws.c | 104 +++++++++++++ 10 files changed, 364 insertions(+), 1 deletion(-) create mode 100644 samples/net/sockets/echo_server/overlay-ws-console.conf create mode 100644 samples/net/sockets/echo_server/src/ws_console/favicon-16x16.png create mode 100644 samples/net/sockets/echo_server/src/ws_console/index.html create mode 100644 samples/net/sockets/echo_server/src/ws_console/sections-rom.ld create mode 100644 samples/net/sockets/echo_server/src/ws_console/style.css create mode 100644 samples/net/sockets/echo_server/src/ws_console/ws.c diff --git a/samples/net/sockets/echo_server/CMakeLists.txt b/samples/net/sockets/echo_server/CMakeLists.txt index 8e01b63e70c5f..9dcb9ad5d917a 100644 --- a/samples/net/sockets/echo_server/CMakeLists.txt +++ b/samples/net/sockets/echo_server/CMakeLists.txt @@ -42,3 +42,21 @@ foreach(inc_file ${gen_dir}/${inc_file}.inc ) endforeach() + +if(CONFIG_NET_SAMPLE_WEBSOCKET_CONSOLE) + zephyr_linker_sources(SECTIONS src/ws_console/sections-rom.ld) + target_sources(app PRIVATE src/ws_console/ws.c) + generate_inc_file_for_target(app src/ws_console/index.html ${gen_dir}/index.html.gz.inc --gzip) + generate_inc_file_for_target(app src/ws_console/style.css ${gen_dir}/style.css.gz.inc --gzip) + generate_inc_file_for_target(app src/ws_console/favicon-16x16.png ${gen_dir}/favicon-16x16.png.gz.inc --gzip) +endif() +if(CONFIG_NET_SAMPLE_HTTPS_SERVICE) + zephyr_linker_section_ifdef(CONFIG_NET_SAMPLE_WEBSOCKET_CONSOLE NAME + http_resource_desc_wss_console_service + KVMA RAM_REGION GROUP RODATA_REGION + SUBALIGN Z_LINK_ITERABLE_SUBALIGN) +endif() +zephyr_linker_section_ifdef(CONFIG_NET_SAMPLE_WEBSOCKET_CONSOLE NAME + http_resource_desc_ws_console_service + KVMA RAM_REGION GROUP RODATA_REGION + SUBALIGN Z_LINK_ITERABLE_SUBALIGN) diff --git a/samples/net/sockets/echo_server/Kconfig b/samples/net/sockets/echo_server/Kconfig index b17c64d38cd97..69ba4801e34cf 100644 --- a/samples/net/sockets/echo_server/Kconfig +++ b/samples/net/sockets/echo_server/Kconfig @@ -87,4 +87,21 @@ config NET_SAMPLE_CERTS_WITH_SC Enable this flag, if you are interested to run this application with signed certificates and keys. +config NET_SAMPLE_WEBSOCKET_CONSOLE + bool "Websocket console support" + default y if WEBSOCKET_CONSOLE + help + Enable this flag, if you are interested to enable websocket console. + You can use the overlay-ws-console.conf to set websocket options. + +config NET_SAMPLE_HTTPS_SERVICE + bool "Enable HTTPS service for the Webconsole" + default y if NET_SAMPLE_WEBSOCKET_CONSOLE + depends on NET_SOCKETS_SOCKOPT_TLS || TLS_CREDENTIALS + +config NET_SAMPLE_HTTPS_SERVER_SERVICE_PORT + int "Port number for HTTPS service" + default 443 + depends on NET_SAMPLE_HTTPS_SERVICE + source "Kconfig.zephyr" diff --git a/samples/net/sockets/echo_server/overlay-ws-console.conf b/samples/net/sockets/echo_server/overlay-ws-console.conf new file mode 100644 index 0000000000000..84bbed81d4f86 --- /dev/null +++ b/samples/net/sockets/echo_server/overlay-ws-console.conf @@ -0,0 +1,12 @@ +CONFIG_SHELL_BACKEND_WEBSOCKET=y +CONFIG_LOG_BACKEND_WS=y +CONFIG_HTTP_SERVER_WEBSOCKET=y +CONFIG_HTTP_SERVER=y +CONFIG_EVENTFD=y +CONFIG_POSIX_API=y +CONFIG_FDTABLE=y +CONFIG_NET_SOCKETS_POLL_MAX=32 +CONFIG_NET_MAX_CONN=32 +CONFIG_NET_SOCKETS_TLS_MAX_CONTEXTS=32 +CONFIG_ZVFS_EVENTFD_MAX=10 +CONFIG_ZVFS_OPEN_MAX=32 diff --git a/samples/net/sockets/echo_server/src/common.h b/samples/net/sockets/echo_server/src/common.h index 37f2189e8dcdf..9d5f6b845c38c 100644 --- a/samples/net/sockets/echo_server/src/common.h +++ b/samples/net/sockets/echo_server/src/common.h @@ -82,6 +82,15 @@ static inline int init_vlan(void) } #endif /* CONFIG_NET_VLAN */ +#if defined(CONFIG_NET_SAMPLE_WEBSOCKET_CONSOLE) +int init_ws(void); +#else +static inline int init_ws(void) +{ + return 0; +} +#endif /* CONFIG_NET_SAMPLE_WEBSOCKET_CONSOLE */ + #if defined(CONFIG_NET_L2_IPIP) int init_tunnel(void); bool is_tunnel(struct net_if *iface); diff --git a/samples/net/sockets/echo_server/src/echo-server.c b/samples/net/sockets/echo_server/src/echo-server.c index 612567002f8b9..d7a80da856469 100644 --- a/samples/net/sockets/echo_server/src/echo-server.c +++ b/samples/net/sockets/echo_server/src/echo-server.c @@ -196,7 +196,7 @@ static void init_app(void) init_vlan(); init_tunnel(); - + init_ws(); init_usb(); } diff --git a/samples/net/sockets/echo_server/src/ws_console/favicon-16x16.png b/samples/net/sockets/echo_server/src/ws_console/favicon-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..e7f9b52ac8bb45fd00653c8351da71fc252f22b0 GIT binary patch literal 305 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9Ea{HEjtmSN`?>!lvI6-E$sR$z z3=CCj3=9n|3=F@3LJcn%7)lKo7+xhXFj&oCU=S~uvn$XBD8U)v6XFV_8P2Hw|Nr0O z%2XC0n=#4T-GwQQyCwz5VK4FYb!C6S%FCmmdi!#2GEhj>)5S4_<9c#}1FMcglc zsji`Mh=GNbv9XnbrM7{Am4QL+bRUp&5E^pxQ!>*kackf?_2nl}1B0ilpUXO@geCxd C{7feR literal 0 HcmV?d00001 diff --git a/samples/net/sockets/echo_server/src/ws_console/index.html b/samples/net/sockets/echo_server/src/ws_console/index.html new file mode 100644 index 0000000000000..add412e3b4c96 --- /dev/null +++ b/samples/net/sockets/echo_server/src/ws_console/index.html @@ -0,0 +1,139 @@ + + + + + + + Zephyr WS Console + + + + + +
+
+
+

+
+
+
+
+
+ + + + + +
+ + + + + +
+
+
+ + diff --git a/samples/net/sockets/echo_server/src/ws_console/sections-rom.ld b/samples/net/sockets/echo_server/src/ws_console/sections-rom.ld new file mode 100644 index 0000000000000..301721307c473 --- /dev/null +++ b/samples/net/sockets/echo_server/src/ws_console/sections-rom.ld @@ -0,0 +1,4 @@ +#include + +ITERABLE_SECTION_ROM(http_resource_desc_wss_console_service, Z_LINK_ITERABLE_SUBALIGN) +ITERABLE_SECTION_ROM(http_resource_desc_ws_console_service, Z_LINK_ITERABLE_SUBALIGN) diff --git a/samples/net/sockets/echo_server/src/ws_console/style.css b/samples/net/sockets/echo_server/src/ws_console/style.css new file mode 100644 index 0000000000000..63305eacd5e22 --- /dev/null +++ b/samples/net/sockets/echo_server/src/ws_console/style.css @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +body { + background-color: black; + color: white; +} + +table, th, td { + border: 1px solid black; + border-collapse: collapse; +} + +th, td { + padding: 5px; +} + +th { + text-align: left; +} + +div.container { +} + +div.textcontainer { + font-family: monospace !important; + font-size: 150%; +} + +div.zconsole { + white-space: pre-wrap !important; + scroll-behavior: auto; + border: 1px solid gray; + padding: 5px; + width: 95%; + height: 70%; + overflow: auto; +} + +div.output { + scroll-behavior: auto; + border: 1px solid gray; + padding: 5px; + margin-top: 20px; + width: 95%; + height: 10%; + overflow: auto; +} + +div.inputbar { + margin-top: 5px; + width: 100%; +} + +.zconsole em { + color: red; +} diff --git a/samples/net/sockets/echo_server/src/ws_console/ws.c b/samples/net/sockets/echo_server/src/ws_console/ws.c new file mode 100644 index 0000000000000..8a2b898f7b905 --- /dev/null +++ b/samples/net/sockets/echo_server/src/ws_console/ws.c @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +LOG_MODULE_DECLARE(net_echo_server_sample, LOG_LEVEL_DBG); + +#include +#include +#include + +static const char index_html_gz[] = { +#include "index.html.gz.inc" +}; + +struct http_resource_detail_static index_html_gz_resource_detail = { + .common = { + .type = HTTP_RESOURCE_TYPE_STATIC, + .bitmask_of_supported_http_methods = BIT(HTTP_GET), + .content_encoding = "gzip", + }, + .static_data = index_html_gz, + .static_data_len = sizeof(index_html_gz), +}; + +static const char style_css_gz[] = { +#include "style.css.gz.inc" +}; + +struct http_resource_detail_static style_css_gz_resource_detail = { + .common = { + .type = HTTP_RESOURCE_TYPE_STATIC, + .bitmask_of_supported_http_methods = BIT(HTTP_GET), + .content_encoding = "gzip", + }, + .static_data = style_css_gz, + .static_data_len = sizeof(style_css_gz), +}; + +static const char favicon_16x16_png_gz[] = { +#include "favicon-16x16.png.gz.inc" +}; + +struct http_resource_detail_static favicon_16x16_png_gz_resource_detail = { + .common = { + .type = HTTP_RESOURCE_TYPE_STATIC, + .bitmask_of_supported_http_methods = BIT(HTTP_GET), + .content_encoding = "gzip", + }, + .static_data = favicon_16x16_png_gz, + .static_data_len = sizeof(favicon_16x16_png_gz), +}; + +#if defined(CONFIG_NET_SAMPLE_HTTPS_SERVICE) +#include +#include "../certificate.h" + +static const sec_tag_t sec_tag_list_verify_none[] = { + SERVER_CERTIFICATE_TAG, +#if defined(CONFIG_MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) + PSK_TAG, +#endif + }; + +#define SEC_TAG_LIST sec_tag_list_verify_none +#define SEC_TAG_LIST_LEN sizeof(sec_tag_list_verify_none) +#else +#define SEC_TAG_LIST NULL +#define SEC_TAG_LIST_LEN 0 +#endif /* CONFIG_NET_SAMPLE_HTTPS_SERVICE */ + +WEBSOCKET_CONSOLE_DEFINE(ws_console_service, SEC_TAG_LIST, + SEC_TAG_LIST_LEN); + +HTTP_RESOURCE_DEFINE(root_resource, ws_console_service, "/", + &index_html_gz_resource_detail); + +HTTP_RESOURCE_DEFINE(index_html_gz_resource, ws_console_service, "/index.html", + &index_html_gz_resource_detail); + +HTTP_RESOURCE_DEFINE(style_css_gz_resource, ws_console_service, "/style.css", + &style_css_gz_resource_detail); + +HTTP_RESOURCE_DEFINE(favicon_16x16_png_gz_resource, ws_console_service, + "/favicon-16x16.png", + &favicon_16x16_png_gz_resource_detail); + +int init_ws(void) +{ + int ret; + + WEBSOCKET_CONSOLE_ENABLE(ws_console_service); + + ret = http_server_start(); + if (ret < 0) { + LOG_DBG("Cannot start websocket console (%d)", ret); + } else { + LOG_DBG("Starting websocket console"); + } + + return 0; +} From 365e9d63d038973b262ef156f0f383eb965d9f35 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Fri, 3 May 2024 10:07:30 +0200 Subject: [PATCH 0793/4482] dts: bindings: Update Nordic owned memory bindings This concerns both `nordic,owned-memory` and `nordic,owned-partitions`. Introduce a property named `nordic,access`, which is meant to replace the `owner-id` and `perm-*` properties. It allows for describing how multiple domains should access a single memory region, possibly with different permissions per owner, but without having to create more than one DT node for this purpose. This change is also motivated by updated memory protection requirements on the nRF54H20, which mandate that a given memory region must only be reserved by one domain, even if multiple domains can have access to it. This restriction is now described in the binding itself. Signed-off-by: Grzegorz Swiderski --- dts/bindings/mtd/nordic,owned-partitions.yaml | 6 +- .../reserved-memory/nordic,owned-memory.yaml | 74 +++++++++++++++++-- dts/common/nordic/nrf54h20.dtsi | 1 + dts/common/nordic/nrf9280.dtsi | 1 + .../reserved-memory/nordic-owned-memory.h | 53 +++++++++++++ 5 files changed, 125 insertions(+), 10 deletions(-) create mode 100644 include/zephyr/dt-bindings/reserved-memory/nordic-owned-memory.h diff --git a/dts/bindings/mtd/nordic,owned-partitions.yaml b/dts/bindings/mtd/nordic,owned-partitions.yaml index bf42c13346ae8..6dd300ecb981e 100644 --- a/dts/bindings/mtd/nordic,owned-partitions.yaml +++ b/dts/bindings/mtd/nordic,owned-partitions.yaml @@ -24,8 +24,7 @@ description: | rx-partitions { compatible = "nordic,owned-partitions"; - perm-read; - perm-execute; + nordic,access = ; #address-cells = <1>; #size-cells = <1>; @@ -37,8 +36,7 @@ description: | rw-partitions { compatible = "nordic,owned-partitions"; - perm-read; - perm-write; + nordic,access = ; #address-cells = <1>; #size-cells = <1>; diff --git a/dts/bindings/reserved-memory/nordic,owned-memory.yaml b/dts/bindings/reserved-memory/nordic,owned-memory.yaml index 9b13c965ac824..69f3e4f9f7b34 100644 --- a/dts/bindings/reserved-memory/nordic,owned-memory.yaml +++ b/dts/bindings/reserved-memory/nordic,owned-memory.yaml @@ -8,17 +8,64 @@ description: | will be recorded in the UICR of the compiled domain. Memory ownership and access is then configured for the domain at boot time, based on the UICR. + Example: + + reserved-memory { + memory@2fc00000 { + compatible = "nordic,owned-memory"; + reg = <0x2fc00000 0x1000>; + status = "okay"; + nordic,access = , + ; + }; + }; + + A single local domain can request a memory region to be reserved on behalf of + multiple access owners. A single memory region shall be reserved by at most + one domain, by setting status "okay" on the associated node. For example, if + the region defined above is enabled by Application on behalf of Radiocore, + then the Radiocore's devicetree must set status "disabled" on that node. + + Each of the different owners may have a different set of permissions granted, + as also shown above. + + Note: one domain can also reserve memory for another domain and not itself. + Whichever domain has status "okay" set on the node does not need to be listed + as one of the access owners. + compatible: "nordic,owned-memory" -include: base.yaml +include: [base.yaml, "zephyr,memory-common.yaml"] properties: reg: required: true + nordic,access: + type: array + description: | + Array of (owner-id, permission-flags) pairs, where: + + - Owner ID represents the domain that will have access to this memory. + Valid values can be found in dts/common/nordic/.dtsi, + where they are defined as NRF_OWNER_ID_* + + - Permissions are encoded as a 32-bit bitfield, using the flags found in + include/zephyr/dt-bindings/reserved-memory/nordic-owned-memory.h, + where they are defined as NRF_PERM_* + + The same file defines all possible permission flag combinations. + For example, one can use: + + + as a shorthand for: + + owner-id: type: int + deprecated: true description: | + Deprecated, applies only if 'nordic,access' is not defined. Owner ID of the domain that will own this memory region. If not defined, the ownership will default to the domain being compiled. @@ -27,20 +74,35 @@ properties: perm-read: type: boolean - description: Owner has read access to the region. + deprecated: true + description: | + Deprecated, applies only if 'nordic,access' is not defined. + Owner has read access to the region. perm-write: type: boolean - description: Owner has write access to the region. + deprecated: true + description: | + Deprecated, applies only if 'nordic,access' is not defined. + Owner has write access to the region. perm-execute: type: boolean - description: Owner can execute code from the region. + deprecated: true + description: | + Deprecated, applies only if 'nordic,access' is not defined. + Owner can execute code from the region. perm-secure: type: boolean - description: Owner has secure-only access to the region. + deprecated: true + description: | + Deprecated, applies only if 'nordic,access' is not defined. + Owner has secure-only access to the region. non-secure-callable: type: boolean - description: Memory region is used for non-secure-callable code. + deprecated: true + description: | + Deprecated, applies only if 'nordic,access' is not defined. + Memory region is used for non-secure-callable code. diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index a3d8b55510b34..936fbff89926e 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -11,6 +11,7 @@ #include #include #include +#include /delete-node/ &sw_pwm; diff --git a/dts/common/nordic/nrf9280.dtsi b/dts/common/nordic/nrf9280.dtsi index 187495a4fe0d5..3fe01c81ca50d 100644 --- a/dts/common/nordic/nrf9280.dtsi +++ b/dts/common/nordic/nrf9280.dtsi @@ -10,6 +10,7 @@ #include #include #include +#include /delete-node/ &sw_pwm; diff --git a/include/zephyr/dt-bindings/reserved-memory/nordic-owned-memory.h b/include/zephyr/dt-bindings/reserved-memory/nordic-owned-memory.h new file mode 100644 index 0000000000000..90f4337937257 --- /dev/null +++ b/include/zephyr/dt-bindings/reserved-memory/nordic-owned-memory.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_RESERVED_MEMORY_NORDIC_OWNED_MEMORY_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_RESERVED_MEMORY_NORDIC_OWNED_MEMORY_H_ + +#include + +/** + * @name Basic memory permission flags. + * @{ + */ + +/** Readable. */ +#define NRF_PERM_R BIT(0) +/** Writable. */ +#define NRF_PERM_W BIT(1) +/** Executable. */ +#define NRF_PERM_X BIT(2) +/** Secure-only. */ +#define NRF_PERM_S BIT(3) +/** Non-secure-callable. */ +#define NRF_PERM_NSC BIT(4) + +/** + * @} + */ + +/** + * @name Memory permission flag combinations. + * @note NRF_PERM_NSC overrides all other flags, so it is not included here. + * @{ + */ + +#define NRF_PERM_RW (NRF_PERM_R | NRF_PERM_W) +#define NRF_PERM_RX (NRF_PERM_R | NRF_PERM_X) +#define NRF_PERM_RS (NRF_PERM_R | NRF_PERM_S) +#define NRF_PERM_WX (NRF_PERM_W | NRF_PERM_X) +#define NRF_PERM_WS (NRF_PERM_W | NRF_PERM_S) +#define NRF_PERM_XS (NRF_PERM_X | NRF_PERM_S) +#define NRF_PERM_RWX (NRF_PERM_R | NRF_PERM_W | NRF_PERM_X) +#define NRF_PERM_RWS (NRF_PERM_R | NRF_PERM_W | NRF_PERM_S) +#define NRF_PERM_RXS (NRF_PERM_R | NRF_PERM_X | NRF_PERM_S) +#define NRF_PERM_WXS (NRF_PERM_W | NRF_PERM_X | NRF_PERM_S) +#define NRF_PERM_RWXS (NRF_PERM_R | NRF_PERM_W | NRF_PERM_X | NRF_PERM_S) + +/** + * @} + */ + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_RESERVED_MEMORY_NORDIC_OWNED_MEMORY_H_ */ From 13b1cfa5ec82971ba1cd1d5c650bf985d8b25221 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Fri, 3 May 2024 10:07:30 +0200 Subject: [PATCH 0794/4482] boards: nordic: Align with updated Nordic owned memory bindings Apply the following changes to `nrf54h20dk` and `nrf9280pdk`: * Convert `perm-*` properties to the newly introduced `nordic,access`, both in board files and tests. * Redefine shared regions to specify multiple access owners per node, and ensure that each such region is reserved by one domain at a time. `cpuapp_cpurad_ram0x_region` is only enabled by Radiocore, while `cpuapp_cpucell_ram0x_region` is only enabled by Application core. * Divide `shared_ram3x_region` so that each sub-region is owned by a different domain. Their addresses must be rounded down to fit the current UICR format. Signed-off-by: Grzegorz Swiderski --- .../nrf54h20dk_nrf54h20-memory_map.dtsi | 59 ++++++--------- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts | 8 --- .../nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts | 4 -- .../nrf9280pdk_nrf9280-memory_map.dtsi | 72 +++++-------------- .../nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts | 14 +--- .../nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts | 4 -- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 2 +- .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 5 -- .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 5 -- 9 files changed, 40 insertions(+), 133 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi index f001678cb1fbc..e26afaaa63702 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi @@ -11,9 +11,7 @@ compatible = "nordic,owned-memory"; reg = <0x2f010000 DT_SIZE_K(260)>; status = "disabled"; - perm-read; - perm-write; - perm-secure; + nordic,access = ; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x2f010000 0x41000>; @@ -35,9 +33,7 @@ compatible = "nordic,owned-memory"; reg = <0x2f051000 DT_SIZE_K(4)>; status = "disabled"; - perm-read; - perm-write; - perm-secure; + nordic,access = ; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x2f051000 0x1000>; @@ -55,9 +51,7 @@ compatible = "nordic,owned-memory"; reg = <0x2f0be000 DT_SIZE_K(4)>; status = "disabled"; - perm-read; - perm-write; - perm-secure; + nordic,access = ; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x2f0be000 0x1000>; @@ -72,8 +66,8 @@ compatible = "nordic,owned-memory"; reg = <0x2f0bf000 DT_SIZE_K(4)>; status = "disabled"; - perm-read; - perm-write; + nordic,access = , + ; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x2f0bf000 0x1000>; @@ -111,16 +105,15 @@ }; /* - * NOTE: perm-execute is not required as FLPR has a direct - * bridge with RAM21, bypassing MPC. + * NOTE: FLPR has a direct bridge with RAM21 that bypasses MPC. + * This means that when this region is marked as non-executable, + * only FLPR can execute code from it. */ ram21_region: memory@2f890000 { compatible = "nordic,owned-memory"; status = "disabled"; reg = <0x2f890000 DT_SIZE_K(64)>; - perm-read; - perm-write; - perm-secure; + nordic,access = ; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x2f890000 0x10000>; @@ -151,9 +144,7 @@ compatible = "nordic,owned-memory"; reg = <0x2fc00000 DT_SIZE_K(64)>; status = "disabled"; - perm-read; - perm-write; - perm-execute; + nordic,access = ; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x2fc00000 0x10000>; @@ -172,29 +163,27 @@ }; shared_ram3x_region: memory@2fc12000 { - compatible = "nordic,owned-memory"; reg = <0x2fc12000 DT_SIZE_K(8)>; - status = "disabled"; - perm-read; - perm-write; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x2fc12000 0x2000>; - cpuapp_dma_region: memory@e80 { - compatible = "zephyr,memory-region"; - reg = <0xe80 DT_SIZE_K(3)>; + cpuapp_dma_region: memory@0 { + compatible = "nordic,owned-memory", "zephyr,memory-region"; + reg = <0x0 DT_SIZE_K(4)>; status = "disabled"; #memory-region-cells = <0>; + nordic,access = ; zephyr,memory-region = "DMA_RAM3x_APP"; zephyr,memory-attr = <( DT_MEM_DMA )>; }; - cpurad_dma_region: memory@1a80 { - compatible = "zephyr,memory-region"; - reg = <0x1a80 0x480>; + cpurad_dma_region: memory@1000 { + compatible = "nordic,owned-memory", "zephyr,memory-region"; + reg = <0x1000 DT_SIZE_K(1)>; status = "disabled"; #memory-region-cells = <0>; + nordic,access = ; zephyr,memory-region = "DMA_RAM3x_RAD"; zephyr,memory-attr = <( DT_MEM_DMA )>; }; @@ -206,9 +195,7 @@ cpurad_rx_partitions: cpurad-rx-partitions { compatible = "nordic,owned-partitions", "fixed-partitions"; status = "disabled"; - perm-read; - perm-execute; - perm-secure; + nordic,access = ; #address-cells = <1>; #size-cells = <1>; @@ -220,9 +207,7 @@ cpuapp_rx_partitions: cpuapp-rx-partitions { compatible = "nordic,owned-partitions", "fixed-partitions"; status = "disabled"; - perm-read; - perm-execute; - perm-secure; + nordic,access = ; #address-cells = <1>; #size-cells = <1>; @@ -242,9 +227,7 @@ cpuapp_rw_partitions: cpuapp-rw-partitions { compatible = "nordic,owned-partitions", "fixed-partitions"; status = "disabled"; - perm-read; - perm-write; - perm-secure; + nordic,access = ; #address-cells = <1>; #size-cells = <1>; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts index 0ea427c72998c..9325b63a7a1d7 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts @@ -116,14 +116,6 @@ status = "okay"; }; -&cpuapp_cpurad_ram0x_region { - status = "okay"; -}; - -&shared_ram3x_region { - status = "okay"; -}; - &ram21_region { status = "okay"; }; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts index 9c7d9a221eef0..cb8fb9e1a0260 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad.dts @@ -34,10 +34,6 @@ }; }; -&shared_ram3x_region { - status = "okay"; -}; - &cpuapp_cpurad_ram0x_region { status = "okay"; }; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map.dtsi b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map.dtsi index 78e3be8825ffb..957fde6121203 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map.dtsi +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map.dtsi @@ -15,9 +15,7 @@ compatible = "nordic,owned-memory"; reg = <0x2f011000 DT_SIZE_K(4)>; status = "disabled"; - perm-read; - perm-write; - perm-secure; + nordic,access = ; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x2f011000 0x1000>; @@ -35,9 +33,7 @@ compatible = "nordic,owned-memory"; reg = <0x2f012000 DT_SIZE_K(516)>; status = "disabled"; - perm-read; - perm-write; - perm-secure; + nordic,access = ; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x2f012000 0x81000>; @@ -59,8 +55,8 @@ compatible = "nordic,owned-memory"; reg = <0x2f0cf000 DT_SIZE_K(4)>; status = "disabled"; - perm-read; - perm-write; + nordic,access = , + ; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x2f0cf000 0x1000>; @@ -75,8 +71,11 @@ }; cpuapp_cpucell_ram0x_region: memory@2f0d0000 { + compatible = "nordic,owned-memory"; reg = <0x2f0d0000 DT_SIZE_K(36)>; status = "disabled"; + nordic,access = , + ; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x2f0d0000 0x9000>; @@ -99,31 +98,6 @@ }; }; - /* Shared memory ownership. - * TODO: - * remove these two after https://github.com/zephyrproject-rtos/zephyr/pull/72273 - * and let cpuapp_cpucell_ram0x_region use the `access` binding to describe - * the shared memory ownership. - */ - - cpuapp_cpucell_ipc_shm: memory@2 { - compatible = "nordic,owned-memory"; - reg = <0x2f0d0000 DT_SIZE_K(36)>; - owner-id = <2>; - perm-read; - perm-write; - status = "disabled"; - }; - - cpucell_cpuapp_ipc_shm: memory@4 { - compatible = "nordic,owned-memory"; - reg = <0x2f0d0000 DT_SIZE_K(36)>; - owner-id = <4>; - perm-read; - perm-write; - status = "disabled"; - }; - shared_ram20_region: memory@2f88f000 { reg = <0x2f88f000 DT_SIZE_K(4)>; #address-cells = <1>; @@ -151,9 +125,7 @@ compatible = "nordic,owned-memory"; status = "disabled"; reg = <0x2f890000 DT_SIZE_K(32)>; - perm-read; - perm-write; - perm-secure; + nordic,access = ; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x2f890000 0x8000>; @@ -172,9 +144,7 @@ compatible = "nordic,owned-memory"; reg = <0x2fc00000 DT_SIZE_K(24)>; status = "disabled"; - perm-read; - perm-write; - perm-execute; + nordic,access = ; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x2fc00000 0x6000>; @@ -193,29 +163,27 @@ }; shared_ram3x_region: memory@2fc06000 { - compatible = "nordic,owned-memory"; reg = <0x2fc06000 DT_SIZE_K(8)>; - status = "disabled"; - perm-read; - perm-write; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x2fc06000 0x4000>; cpuapp_dma_region: memory@0 { - compatible = "zephyr,memory-region"; + compatible = "nordic,owned-memory", "zephyr,memory-region"; reg = <0x0 DT_SIZE_K(4)>; status = "disabled"; #memory-region-cells = <0>; + nordic,access = ; zephyr,memory-region = "DMA_RAM3x_APP"; zephyr,memory-attr = <( DT_MEM_DMA )>; }; cpurad_dma_region: memory@1000 { - compatible = "zephyr,memory-region"; - reg = <0x1000 0x80>; + compatible = "nordic,owned-memory", "zephyr,memory-region"; + reg = <0x1000 DT_SIZE_K(1)>; status = "disabled"; #memory-region-cells = <0>; + nordic,access = ; zephyr,memory-region = "DMA_RAM3x_RAD"; zephyr,memory-attr = <( DT_MEM_DMA )>; }; @@ -227,9 +195,7 @@ cpurad_rx_partitions: cpurad-rx-partitions { compatible = "nordic,owned-partitions", "fixed-partitions"; status = "disabled"; - perm-read; - perm-execute; - perm-secure; + nordic,access = ; #address-cells = <1>; #size-cells = <1>; @@ -241,9 +207,7 @@ cpuapp_rx_partitions: cpuapp-rx-partitions { compatible = "nordic,owned-partitions", "fixed-partitions"; status = "disabled"; - perm-read; - perm-execute; - perm-secure; + nordic,access = ; #address-cells = <1>; #size-cells = <1>; @@ -259,9 +223,7 @@ cpuapp_rw_partitions: cpuapp-rw-partitions { compatible = "nordic,owned-partitions", "fixed-partitions"; status = "disabled"; - perm-read; - perm-write; - perm-secure; + nordic,access = ; #address-cells = <1>; #size-cells = <1>; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts index 6e94a4a34346a..a380ac7473aad 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpuapp.dts @@ -114,19 +114,7 @@ status = "okay"; }; -&cpuapp_cpurad_ram0x_region { - status = "okay"; -}; - -&cpuapp_cpucell_ipc_shm { - status = "okay"; -}; - -&cpucell_cpuapp_ipc_shm { - status = "okay"; -}; - -&shared_ram3x_region { +&cpuapp_cpucell_ram0x_region { status = "okay"; }; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts index 4a9314c47eb80..f9bfae0989727 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280_cpurad.dts @@ -35,10 +35,6 @@ }; }; -&shared_ram3x_region { - status = "okay"; -}; - &cpuapp_cpurad_ram0x_region { status = "okay"; }; diff --git a/tests/arch/common/ramfunc/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/arch/common/ramfunc/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 2deb675600908..ad84324a3e940 100644 --- a/tests/arch/common/ramfunc/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/arch/common/ramfunc/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -4,5 +4,5 @@ */ &cpuapp_ram0x_region { - perm-execute; + nordic,access = ; }; diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_cpurad.overlay index 73ec4c1dc081a..84edfb2b6f1f6 100644 --- a/tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_cpurad.overlay +++ b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -5,11 +5,6 @@ */ #include "nrf54h20dk_nrf54h20_common.dtsi" -/* Increase dma region to fit dmm heap. */ -&cpurad_dma_region { - reg = <0x1e80 0x100>; -}; - &spi130 { memory-regions = <&cpurad_dma_region>; }; diff --git a/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54h20dk_nrf54h20_cpurad.overlay index 2bde29c9fc51e..0ded983c2af88 100644 --- a/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54h20dk_nrf54h20_cpurad.overlay +++ b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -2,11 +2,6 @@ #include "nrf54h20dk_nrf54h20_common.dtsi" -&cpurad_dma_region { - /* Default space is not enough. */ - reg = <0x1e80 0x100>; -}; - &dut { memory-regions = <&cpurad_dma_region>; }; From 85b03949e43c0578c814030f125c41450e798b85 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Tue, 8 Oct 2024 13:54:54 +0200 Subject: [PATCH 0795/4482] boards: nordic: Flatten shared_ramxx_region nodes Update the default memory maps for `nrf54h20dk` and `nrf9280pdk` to remove the `shared_ram20_region` and `shared_ram3x_region` nodes, because their child nodes no longer need to be grouped together: * IPC buffers in RAM20 are statically allocated. * DMA buffers in RAM3x have separate access owners. Signed-off-by: Grzegorz Swiderski --- .../nrf54h20dk_nrf54h20-memory_map.dtsi | 70 ++++++++----------- .../nrf9280pdk_nrf9280-memory_map.dtsi | 70 ++++++++----------- ...rf54h20dk_nrf54h20_cpuppr_launcher.overlay | 4 -- 3 files changed, 56 insertions(+), 88 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi index e26afaaa63702..2b2473f92b5fe 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-memory_map.dtsi @@ -81,27 +81,20 @@ }; }; - shared_ram20_region: memory@2f88f000 { - reg = <0x2f88f000 DT_SIZE_K(4)>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f88f000 0x1000>; - - cpuapp_cpusys_ipc_shm: memory@ce0 { - reg = <0xce0 0x80>; - }; + cpuapp_cpusys_ipc_shm: memory@2f88fce0 { + reg = <0x2f88fce0 0x80>; + }; - cpusys_cpuapp_ipc_shm: memory@d60 { - reg = <0xd60 0x80>; - }; + cpusys_cpuapp_ipc_shm: memory@2f88fd60 { + reg = <0x2f88fd60 0x80>; + }; - cpurad_cpusys_ipc_shm: memory@e00 { - reg = <0xe00 0x80>; - }; + cpurad_cpusys_ipc_shm: memory@2f88fe00 { + reg = <0x2f88fe00 0x80>; + }; - cpusys_cpurad_ipc_shm: memory@e80 { - reg = <0xe80 0x80>; - }; + cpusys_cpurad_ipc_shm: memory@2f88fe80 { + reg = <0x2f88fe80 0x80>; }; /* @@ -162,31 +155,24 @@ }; }; - shared_ram3x_region: memory@2fc12000 { - reg = <0x2fc12000 DT_SIZE_K(8)>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2fc12000 0x2000>; - - cpuapp_dma_region: memory@0 { - compatible = "nordic,owned-memory", "zephyr,memory-region"; - reg = <0x0 DT_SIZE_K(4)>; - status = "disabled"; - #memory-region-cells = <0>; - nordic,access = ; - zephyr,memory-region = "DMA_RAM3x_APP"; - zephyr,memory-attr = <( DT_MEM_DMA )>; - }; + cpuapp_dma_region: memory@2fc12000 { + compatible = "nordic,owned-memory", "zephyr,memory-region"; + reg = <0x2fc12000 DT_SIZE_K(4)>; + status = "disabled"; + #memory-region-cells = <0>; + nordic,access = ; + zephyr,memory-region = "DMA_RAM3x_APP"; + zephyr,memory-attr = <( DT_MEM_DMA )>; + }; - cpurad_dma_region: memory@1000 { - compatible = "nordic,owned-memory", "zephyr,memory-region"; - reg = <0x1000 DT_SIZE_K(1)>; - status = "disabled"; - #memory-region-cells = <0>; - nordic,access = ; - zephyr,memory-region = "DMA_RAM3x_RAD"; - zephyr,memory-attr = <( DT_MEM_DMA )>; - }; + cpurad_dma_region: memory@2fc13000 { + compatible = "nordic,owned-memory", "zephyr,memory-region"; + reg = <0x2fc13000 DT_SIZE_K(1)>; + status = "disabled"; + #memory-region-cells = <0>; + nordic,access = ; + zephyr,memory-region = "DMA_RAM3x_RAD"; + zephyr,memory-attr = <( DT_MEM_DMA )>; }; }; }; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map.dtsi b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map.dtsi index 957fde6121203..0127998509e80 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map.dtsi +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-memory_map.dtsi @@ -98,27 +98,20 @@ }; }; - shared_ram20_region: memory@2f88f000 { - reg = <0x2f88f000 DT_SIZE_K(4)>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2f88f000 0x1000>; - - cpuapp_cpusys_ipc_shm: memory@ce0 { - reg = <0xce0 0x80>; - }; + cpuapp_cpusys_ipc_shm: memory@2f88fce0 { + reg = <0x2f88fce0 0x80>; + }; - cpusys_cpuapp_ipc_shm: memory@d60 { - reg = <0xd60 0x80>; - }; + cpusys_cpuapp_ipc_shm: memory@2f88fd60 { + reg = <0x2f88fd60 0x80>; + }; - cpurad_cpusys_ipc_shm: memory@e00 { - reg = <0xe00 0x80>; - }; + cpurad_cpusys_ipc_shm: memory@2f88fe00 { + reg = <0x2f88fe00 0x80>; + }; - cpusys_cpurad_ipc_shm: memory@e80 { - reg = <0xe80 0x80>; - }; + cpusys_cpurad_ipc_shm: memory@2f88fe80 { + reg = <0x2f88fe80 0x80>; }; ram21_region: memory@2f890000 { @@ -162,31 +155,24 @@ }; }; - shared_ram3x_region: memory@2fc06000 { - reg = <0x2fc06000 DT_SIZE_K(8)>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x2fc06000 0x4000>; - - cpuapp_dma_region: memory@0 { - compatible = "nordic,owned-memory", "zephyr,memory-region"; - reg = <0x0 DT_SIZE_K(4)>; - status = "disabled"; - #memory-region-cells = <0>; - nordic,access = ; - zephyr,memory-region = "DMA_RAM3x_APP"; - zephyr,memory-attr = <( DT_MEM_DMA )>; - }; + cpuapp_dma_region: memory@2fc06000 { + compatible = "nordic,owned-memory", "zephyr,memory-region"; + reg = <0x2fc06000 DT_SIZE_K(4)>; + status = "disabled"; + #memory-region-cells = <0>; + nordic,access = ; + zephyr,memory-region = "DMA_RAM3x_APP"; + zephyr,memory-attr = <( DT_MEM_DMA )>; + }; - cpurad_dma_region: memory@1000 { - compatible = "nordic,owned-memory", "zephyr,memory-region"; - reg = <0x1000 DT_SIZE_K(1)>; - status = "disabled"; - #memory-region-cells = <0>; - nordic,access = ; - zephyr,memory-region = "DMA_RAM3x_RAD"; - zephyr,memory-attr = <( DT_MEM_DMA )>; - }; + cpurad_dma_region: memory@2fc07000 { + compatible = "nordic,owned-memory", "zephyr,memory-region"; + reg = <0x2fc07000 DT_SIZE_K(1)>; + status = "disabled"; + #memory-region-cells = <0>; + nordic,access = ; + zephyr,memory-region = "DMA_RAM3x_RAD"; + zephyr,memory-attr = <( DT_MEM_DMA )>; }; }; }; diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpuppr_launcher.overlay b/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpuppr_launcher.overlay index 6e30d17315519..facf592d94ca6 100644 --- a/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpuppr_launcher.overlay +++ b/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpuppr_launcher.overlay @@ -14,10 +14,6 @@ interrupt-parent = <&cpuppr_clic>; }; -&shared_ram3x_region { - status = "okay"; -}; - &gpio0 { status = "reserved"; }; From 8b02bc9392dbf1980c70c8b680777b9cf3edce0b Mon Sep 17 00:00:00 2001 From: Joel Hirsbrunner Date: Fri, 4 Oct 2024 21:29:37 +0200 Subject: [PATCH 0796/4482] Devicetree: Devicetree Bindings: Support enums for array like dt props It is currently impossible to use enum with any array like type (i.e. string-array and array, these are the only ones that make sense) in the devicetree and dt-bindings. However, there is no such remark in the dt-bindings section of the docs. Since this is a feature that comes in very handy and is implemented fairly easily, I adjusted the scripts for this. It is now possible to do something like this. ```yaml compatible = "enums" properties: array-enum: type: string-array enum: - bar - foo - baz - zoo ``` ```dts / { enums { compatible = "enums"; array-enum = "foo", "bar"; }; }; ``` Signed-off-by: Joel Hirsbrunner --- scripts/dts/gen_defines.py | 105 +++++++++++------- .../src/devicetree/edtlib.py | 44 ++++---- 2 files changed, 89 insertions(+), 60 deletions(-) diff --git a/scripts/dts/gen_defines.py b/scripts/dts/gen_defines.py index 9c0e1c550f76b..3a8fa7aaedd55 100755 --- a/scripts/dts/gen_defines.py +++ b/scripts/dts/gen_defines.py @@ -588,12 +588,7 @@ def write_vanilla_props(node: edtlib.Node) -> None: macro2val[macro] = val if prop.spec.type == 'string': - # DT_N__P__IDX__STRING_UNQUOTED - macro2val[macro + "_STRING_UNQUOTED"] = escape_unquoted(prop.val) - # DT_N__P__IDX__STRING_TOKEN - macro2val[macro + "_STRING_TOKEN"] = prop.val_as_token - # DT_N__P__IDX__STRING_UPPER_TOKEN - macro2val[macro + "_STRING_UPPER_TOKEN"] = prop.val_as_token.upper() + macro2val.update(string_macros(macro, prop.val)) # DT_N__P__IDX_0: # DT_N__P__IDX_0_EXISTS: # Allows treating the string like a degenerate case of a @@ -601,45 +596,13 @@ def write_vanilla_props(node: edtlib.Node) -> None: macro2val[macro + "_IDX_0"] = quote_str(prop.val) macro2val[macro + "_IDX_0_EXISTS"] = 1 - if prop.enum_index is not None: - # DT_N__P__ENUM_IDX - macro2val[macro + "_ENUM_IDX"] = prop.enum_index - spec = prop.spec - - if spec.enum_tokenizable: - as_token = prop.val_as_token - - # DT_N__P__ENUM_VAL__EXISTS 1 - macro2val[macro + f"_ENUM_VAL_{as_token}_EXISTS"] = 1 - # DT_N__P__ENUM_TOKEN - macro2val[macro + "_ENUM_TOKEN"] = as_token - - if spec.enum_upper_tokenizable: - # DT_N__P__ENUM_UPPER_TOKEN - macro2val[macro + "_ENUM_UPPER_TOKEN"] = as_token.upper() - else: - # DT_N__P__ENUM_VAL__EXISTS 1 - macro2val[macro + f"_ENUM_VAL_{prop.val}_EXISTS"] = 1 + if prop.enum_indices is not None: + macro2val.update(enum_macros(prop, macro)) if "phandle" in prop.type: macro2val.update(phandle_macros(prop, macro)) elif "array" in prop.type: - for i, subval in enumerate(prop.val): - # DT_N__P__IDX_ - # DT_N__P__IDX__EXISTS - - if isinstance(subval, str): - macro2val[macro + f"_IDX_{i}"] = quote_str(subval) - subval_as_token = edtlib.str_as_token(subval) - # DT_N__P__IDX__STRING_UNQUOTED - macro2val[macro + f"_IDX_{i}_STRING_UNQUOTED"] = escape_unquoted(subval) - # DT_N__P__IDX__STRING_TOKEN - macro2val[macro + f"_IDX_{i}_STRING_TOKEN"] = subval_as_token - # DT_N__P__IDX__STRING_UPPER_TOKEN - macro2val[macro + f"_IDX_{i}_STRING_UPPER_TOKEN"] = subval_as_token.upper() - else: - macro2val[macro + f"_IDX_{i}"] = subval - macro2val[macro + f"_IDX_{i}_EXISTS"] = 1 + macro2val.update(array_macros(prop, macro)) plen = prop_len(prop) if plen is not None: @@ -681,6 +644,66 @@ def write_vanilla_props(node: edtlib.Node) -> None: out_comment("(No generic property macros)") +def string_macros(macro: str, val: str): + # Returns a dict of macros for a string 'val'. + # The 'macro' argument is the N__P_... part. + + as_token = edtlib.str_as_token(val) + return { + # DT_N__P__IDX__STRING_UNQUOTED + f"{macro}_STRING_UNQUOTED": escape_unquoted(val), + # DT_N__P__IDX__STRING_TOKEN + f"{macro}_STRING_TOKEN": as_token, + # DT_N__P__IDX__STRING_UPPER_TOKEN + f"{macro}_STRING_UPPER_TOKEN": as_token.upper()} + + +def enum_macros(prop: edtlib.Property, macro: str): + # Returns a dict of macros for property 'prop' with a defined enum in their dt-binding. + # The 'macro' argument is the N__P_ part. + + spec = prop.spec + # DT_N__P__IDX__ENUM_IDX + ret = {f"{macro}_IDX_{i}_ENUM_IDX": index for i, index in enumerate(prop.enum_indices)} + val = prop.val_as_tokens if spec.enum_tokenizable else (prop.val if isinstance(prop.val, list) else [prop.val]) + + for i, subval in enumerate(val): + # DT_N__P__IDX__EXISTS + ret[macro + f"_IDX_{i}_EXISTS"] = 1 + # DT_N__P__IDX__ENUM_VAL__EXISTS 1 + ret[macro + f"_IDX_{i}_ENUM_VAL_{subval}_EXISTS"] = 1 + if not spec.enum_tokenizable: + continue + + # DT_N__P__IDX__ENUM_TOKEN + ret[macro + f"_IDX_{i}_ENUM_TOKEN"] = subval + if spec.enum_upper_tokenizable: + # DT_N__P__IDX__ENUM_UPPER_TOKEN + ret[macro + f"_IDX_{i}_ENUM_UPPER_TOKEN"] = subval.upper() + + return ret + + +def array_macros(prop: edtlib.Property, macro: str): + # Returns a dict of macros for array property 'prop'. + # The 'macro' argument is the N__P_ part. + + ret = {} + for i, subval in enumerate(prop.val): + # DT_N__P__IDX__EXISTS + ret[macro + f"_IDX_{i}_EXISTS"] = 1 + + # DT_N__P__IDX_ + if isinstance(subval, str): + ret[macro + f"_IDX_{i}"] = quote_str(subval) + # DT_N__P__IDX__STRING_... + ret.update(string_macros(macro + f"_IDX_{i}", subval)) + else: + ret[macro + f"_IDX_{i}"] = subval + + return ret + + def write_dep_info(node: edtlib.Node) -> None: # Write dependency-related information about the node. diff --git a/scripts/dts/python-devicetree/src/devicetree/edtlib.py b/scripts/dts/python-devicetree/src/devicetree/edtlib.py index 26c1488950049..099f3672addc1 100644 --- a/scripts/dts/python-devicetree/src/devicetree/edtlib.py +++ b/scripts/dts/python-devicetree/src/devicetree/edtlib.py @@ -601,10 +601,11 @@ class PropertySpec: True if enum is not None and all the values in it are tokenizable; False otherwise. - A property must have string type and an "enum:" in its binding to be - tokenizable. Additionally, the "enum:" values must be unique after - converting all non-alphanumeric characters to underscores (so "foo bar" - and "foo_bar" in the same "enum:" would not be tokenizable). + A property must have string or string-array type and an "enum:" in its + binding to be tokenizable. Additionally, the "enum:" values must be + unique after converting all non-alphanumeric characters to underscores + (so "foo bar" and "foo_bar" in the same "enum:" would not be + tokenizable). enum_upper_tokenizable: Like 'enum_tokenizable', with the additional restriction that the @@ -659,7 +660,7 @@ def enum(self) -> Optional[list]: def enum_tokenizable(self) -> bool: "See the class docstring" if not hasattr(self, '_enum_tokenizable'): - if self.type != 'string' or self.enum is None: + if self.type not in {'string', 'string-array'} or self.enum is None: self._enum_tokenizable = False else: # Saving _as_tokens here lets us reuse it in @@ -764,14 +765,14 @@ class Property: type: Convenience for spec.type. - val_as_token: - The value of the property as a token, i.e. with non-alphanumeric + val_as_tokens: + The value of the property as a list of tokens, i.e. with non-alphanumeric characters replaced with underscores. This is only safe to access if 'spec.enum_tokenizable' returns True. - enum_index: - The index of 'val' in 'spec.enum' (which comes from the 'enum:' list - in the binding), or None if spec.enum is None. + enum_indices: + A list of indices of 'val' in 'spec.enum' (which comes from the 'enum:' + list in the binding), or None if spec.enum is None. """ spec: PropertySpec @@ -794,16 +795,20 @@ def type(self) -> str: return self.spec.type @property - def val_as_token(self) -> str: + def val_as_tokens(self) -> List[str]: "See the class docstring" - assert isinstance(self.val, str) - return str_as_token(self.val) + ret = [] + for subval in self.val if isinstance(self.val, list) else [self.val]: + assert isinstance(subval, str) + ret.append(str_as_token(subval)) + return ret @property - def enum_index(self) -> Optional[int]: + def enum_indices(self) -> Optional[List[int]]: "See the class docstring" enum = self.spec.enum - return enum.index(self.val) if enum else None + val = self.val if isinstance(self.val, list) else [self.val] + return [enum.index(subval) for subval in val] if enum else None @dataclass @@ -1519,10 +1524,11 @@ def _init_prop(self, prop_spec: PropertySpec, return enum = prop_spec.enum - if enum and val not in enum: - _err(f"value of property '{name}' on {self.path} in " - f"{self.edt.dts_path} ({val!r}) is not in 'enum' list in " - f"{self.binding_path} ({enum!r})") + for subval in val if isinstance(val, list) else [val]: + if enum and subval not in enum: + _err(f"value of property '{name}' on {self.path} in " + f"{self.edt.dts_path} ({subval!r}) is not in 'enum' list in " + f"{self.binding_path} ({enum!r})") const = prop_spec.const if const is not None and val != const: From 7454cb984b8e73458b820a52d32678da01e5679e Mon Sep 17 00:00:00 2001 From: Joel Hirsbrunner Date: Fri, 4 Oct 2024 21:32:53 +0200 Subject: [PATCH 0797/4482] Devicetree: Devicetree Bindings: Adjust python tests Adjust existing tests to support the changes and add new tests to test the newly added feature. Signed-off-by: Joel Hirsbrunner --- .../tests/test-bindings/enums.yaml | 15 +++++++++++ scripts/dts/python-devicetree/tests/test.dts | 2 ++ .../python-devicetree/tests/test_edtlib.py | 27 ++++++++++++++----- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/scripts/dts/python-devicetree/tests/test-bindings/enums.yaml b/scripts/dts/python-devicetree/tests/test-bindings/enums.yaml index f36b89b26eb2e..964cae1d4b7f4 100644 --- a/scripts/dts/python-devicetree/tests/test-bindings/enums.yaml +++ b/scripts/dts/python-devicetree/tests/test-bindings/enums.yaml @@ -32,5 +32,20 @@ properties: - whitespace is ok - 123 is ok + array-enum: + type: array + enum: + - 0 + - 10 + - 20 + - 30 + - 40 + + string-array-enum: # tokenizable string-array + type: string-array + enum: + - bar + - foo + no-enum: type: string diff --git a/scripts/dts/python-devicetree/tests/test.dts b/scripts/dts/python-devicetree/tests/test.dts index 213d5d45dfeea..bc54fd049d593 100644 --- a/scripts/dts/python-devicetree/tests/test.dts +++ b/scripts/dts/python-devicetree/tests/test.dts @@ -432,6 +432,8 @@ string-enum = "foo_bar"; tokenizable-enum = "123 is ok"; tokenizable-lower-enum = "bar"; + array-enum = <0 40 40 10>; + string-array-enum = "foo", "bar"; no-enum = "baz"; }; diff --git a/scripts/dts/python-devicetree/tests/test_edtlib.py b/scripts/dts/python-devicetree/tests/test_edtlib.py index a81aa929370a0..d02bfd7fc6ddf 100644 --- a/scripts/dts/python-devicetree/tests/test_edtlib.py +++ b/scripts/dts/python-devicetree/tests/test_edtlib.py @@ -572,31 +572,44 @@ def test_prop_enums(): string_enum = props['string-enum'] tokenizable_enum = props['tokenizable-enum'] tokenizable_lower_enum = props['tokenizable-lower-enum'] + array_enum = props['array-enum'] + string_array_enum = props['string-array-enum'] no_enum = props['no-enum'] assert int_enum.val == 1 - assert int_enum.enum_index == 0 + assert int_enum.enum_indices[0] == 0 assert not int_enum.spec.enum_tokenizable assert not int_enum.spec.enum_upper_tokenizable assert string_enum.val == 'foo_bar' - assert string_enum.enum_index == 1 + assert string_enum.enum_indices[0] == 1 assert not string_enum.spec.enum_tokenizable assert not string_enum.spec.enum_upper_tokenizable assert tokenizable_enum.val == '123 is ok' - assert tokenizable_enum.val_as_token == '123_is_ok' - assert tokenizable_enum.enum_index == 2 + assert tokenizable_enum.val_as_tokens[0] == '123_is_ok' + assert tokenizable_enum.enum_indices[0] == 2 assert tokenizable_enum.spec.enum_tokenizable assert tokenizable_enum.spec.enum_upper_tokenizable assert tokenizable_lower_enum.val == 'bar' - assert tokenizable_lower_enum.val_as_token == 'bar' - assert tokenizable_lower_enum.enum_index == 0 + assert tokenizable_lower_enum.val_as_tokens[0] == 'bar' + assert tokenizable_lower_enum.enum_indices[0] == 0 assert tokenizable_lower_enum.spec.enum_tokenizable assert not tokenizable_lower_enum.spec.enum_upper_tokenizable - assert no_enum.enum_index is None + assert array_enum.val == [0, 40, 40, 10] + assert array_enum.enum_indices == [0, 4, 4, 1] + assert not array_enum.spec.enum_tokenizable + assert not array_enum.spec.enum_upper_tokenizable + + assert string_array_enum.val == ["foo", "bar"] + assert string_array_enum.val_as_tokens == ["foo", "bar"] + assert string_array_enum.enum_indices == [1, 0] + assert string_array_enum.spec.enum_tokenizable + assert string_array_enum.spec.enum_upper_tokenizable + + assert no_enum.enum_indices is None assert not no_enum.spec.enum_tokenizable assert not no_enum.spec.enum_upper_tokenizable From ae747c4fa1f8666ca0a6b2acd93846947f3cc957 Mon Sep 17 00:00:00 2001 From: Joel Hirsbrunner Date: Fri, 4 Oct 2024 21:34:49 +0200 Subject: [PATCH 0798/4482] Devicetree: Devicetree Bindings: Add new APIs The existing APIs for enums were rewritten to support the changes. Additional macros were added to now also support getting specific indices from the array / string-array. The macros can be evoked the same way like before, since nothing changed for the interface. Therefore, these changes are backward compatible. Signed-off-by: Joel Hirsbrunner --- include/zephyr/devicetree.h | 128 +++++++++++++++++++++++++++++------- 1 file changed, 104 insertions(+), 24 deletions(-) diff --git a/include/zephyr/devicetree.h b/include/zephyr/devicetree.h index 38a87238432b4..aba28c0ab6325 100644 --- a/include/zephyr/devicetree.h +++ b/include/zephyr/devicetree.h @@ -29,7 +29,7 @@ * @brief devicetree.h API * @defgroup devicetree Devicetree * @since 2.2 - * @version 1.1.0 + * @version 1.2.0 * @{ * @} */ @@ -913,75 +913,122 @@ (DT_PROP(node_id, prop)), (default_value)) /** - * @brief Get a property value's index into its enumeration values + * @brief Get a property array value's index into its enumeration values * * The return values start at zero. * * Example devicetree fragment: * * @code{.dts} - * usb1: usb@12340000 { - * maximum-speed = "full-speed"; - * }; - * usb2: usb@12341000 { - * maximum-speed = "super-speed"; + * some_node: some-node { + * compat = "vend,enum-string-array"; + * foos = + * <&phandle val1>, + * <&phandle val2>, + * <&phandle val3>; + * foo-names = "default", "option3", "option1"; * }; * @endcode * * Example bindings fragment: * * @code{.yaml} - * properties: - * maximum-speed: - * type: string - * enum: - * - "low-speed" - * - "full-speed" - * - "high-speed" - * - "super-speed" + * compatible: vend,enum-string-array + * properties: + * foos: + * type: phandle-array + * description: | + * Explanation about what this phandle-array exactly is for. + * + * foo-names: + * type: string-array + * description: | + * Some explanation about the available options + * default: explain default + * option1: explain option1 + * option2: explain option2 + * option3: explain option3 + * enum: + * - default + * - option1 + * - option2 + * - option3 * @endcode * * Example usage: * * @code{.c} - * DT_ENUM_IDX(DT_NODELABEL(usb1), maximum_speed) // 1 - * DT_ENUM_IDX(DT_NODELABEL(usb2), maximum_speed) // 3 + * DT_ENUM_IDX_BY_IDX(DT_NODELABEL(some_node), foo_names, 0) // 0 + * DT_ENUM_IDX_BY_IDX(DT_NODELABEL(some_node), foo_names, 2) // 1 * @endcode * * @param node_id node identifier * @param prop lowercase-and-underscores property name + * @param idx the index to get * @return zero-based index of the property's value in its enum: list */ -#define DT_ENUM_IDX(node_id, prop) DT_CAT4(node_id, _P_, prop, _ENUM_IDX) +#define DT_ENUM_IDX_BY_IDX(node_id, prop, idx) \ + DT_CAT6(node_id, _P_, prop, _IDX_, idx, _ENUM_IDX) /** - * @brief Like DT_ENUM_IDX(), but with a fallback to a default enum index + * @brief Equivalent to @ref DT_ENUM_IDX_BY_IDX(node_id, prop, 0). + * @param node_id node identifier + * @param prop lowercase-and-underscores property name + * @return zero-based index of the property's value in its enum: list + */ +#define DT_ENUM_IDX(node_id, prop) DT_ENUM_IDX_BY_IDX(node_id, prop, 0) + +/** + * @brief Like DT_ENUM_IDX_BY_IDX(), but with a fallback to a default enum index * * If the value exists, this expands to its zero based index value thanks to - * DT_ENUM_IDX(node_id, prop). + * DT_ENUM_IDX_BY_IDX(node_id, prop, idx). * * Otherwise, this expands to provided default index enum value. * * @param node_id node identifier * @param prop lowercase-and-underscores property name + * @param idx the index to get + * @param default_idx_value a fallback index value to expand to + * @return zero-based index of the property's value in its enum if present, + * default_idx_value otherwise + */ +#define DT_ENUM_IDX_BY_IDX_OR(node_id, prop, idx, default_idx_value) \ + COND_CODE_1(DT_PROP_HAS_IDX(node_id, prop, idx), \ + (DT_ENUM_IDX_BY_IDX(node_id, prop, idx)), (default_idx_value)) + +/** + * @brief Equivalent to DT_ENUM_IDX_BY_IDX_OR(node_id, prop, 0, default_idx_value). + * @param node_id node identifier + * @param prop lowercase-and-underscores property name * @param default_idx_value a fallback index value to expand to * @return zero-based index of the property's value in its enum if present, * default_idx_value otherwise */ #define DT_ENUM_IDX_OR(node_id, prop, default_idx_value) \ - COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \ - (DT_ENUM_IDX(node_id, prop)), (default_idx_value)) + DT_ENUM_IDX_BY_IDX_OR(node_id, prop, 0, default_idx_value) /** - * @brief Does a node enumeration property have a given value? + * @brief Does a node enumeration property array have a given value? * * @param node_id node identifier * @param prop lowercase-and-underscores property name + * @param idx the index to get + * @param value lowercase-and-underscores enumeration value + * @return 1 if the node property has the value @a value, 0 otherwise. + */ +#define DT_ENUM_HAS_VALUE_BY_IDX(node_id, prop, idx, value) \ + IS_ENABLED(DT_CAT8(node_id, _P_, prop, _IDX_, idx, _ENUM_VAL_, value, _EXISTS)) + +/** + * @brief Equivalent to DT_ENUM_HAS_VALUE_BY_IDX(node_id, prop, 0, value). + * @param node_id node identifier + * @param prop lowercase-and-underscores property name * @param value lowercase-and-underscores enumeration value * @return 1 if the node property has the value @a value, 0 otherwise. */ #define DT_ENUM_HAS_VALUE(node_id, prop, value) \ - IS_ENABLED(DT_CAT6(node_id, _P_, prop, _ENUM_VAL_, value, _EXISTS)) + DT_ENUM_HAS_VALUE_BY_IDX(node_id, prop, 0, value) /** * @brief Get a string property's value as a token. @@ -3964,6 +4011,16 @@ #define DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP_VARGS(inst, fn, sep, ...) \ DT_FOREACH_CHILD_STATUS_OKAY_SEP_VARGS(DT_DRV_INST(inst), fn, sep, __VA_ARGS__) +/** + * @brief Get a `DT_DRV_COMPAT` property array value's index into its enumeration values + * @param inst instance number + * @param prop lowercase-and-underscores property name + * @param idx the index to get + * @return zero-based index of the property's value in its enum: list + */ +#define DT_INST_ENUM_IDX_BY_IDX(inst, prop, idx) \ + DT_ENUM_IDX_BY_IDX(DT_DRV_INST(inst), prop, idx) + /** * @brief Get a `DT_DRV_COMPAT` value's index into its enumeration values * @param inst instance number @@ -3973,6 +4030,18 @@ #define DT_INST_ENUM_IDX(inst, prop) \ DT_ENUM_IDX(DT_DRV_INST(inst), prop) +/** + * @brief Like DT_INST_ENUM_IDX_BY_IDX(), but with a fallback to a default enum index + * @param inst instance number + * @param prop lowercase-and-underscores property name + * @param idx the index to get + * @param default_idx_value a fallback index value to expand to + * @return zero-based index of the property's value in its enum if present, + * default_idx_value otherwise + */ +#define DT_INST_ENUM_IDX_BY_IDX_OR(inst, prop, idx, default_idx_value) \ + DT_ENUM_IDX_BY_IDX_OR(DT_DRV_INST(inst), prop, idx, default_idx_value) + /** * @brief Like DT_INST_ENUM_IDX(), but with a fallback to a default enum index * @param inst instance number @@ -3984,6 +4053,17 @@ #define DT_INST_ENUM_IDX_OR(inst, prop, default_idx_value) \ DT_ENUM_IDX_OR(DT_DRV_INST(inst), prop, default_idx_value) +/** + * @brief Does a `DT_DRV_COMPAT` enumeration property have a given value by index? + * @param inst instance number + * @param prop lowercase-and-underscores property name + * @param idx the index to get + * @param value lowercase-and-underscores enumeration value + * @return zero-based index of the property's value in its enum + */ +#define DT_INST_ENUM_HAS_VALUE_BY_IDX(inst, prop, idx, value) \ + DT_ENUM_HAS_VALUE_BY_IDX(DT_DRV_INST(inst), prop, idx, value) + /** * @brief Does a `DT_DRV_COMPAT` enumeration property have a given value? * From 405c6718ed1eb077aba9136a8b86793632fd9531 Mon Sep 17 00:00:00 2001 From: Joel Hirsbrunner Date: Fri, 4 Oct 2024 21:43:28 +0200 Subject: [PATCH 0799/4482] Devicetree: Devicetree Bindings: Add tests for new DT_ENUM_ macros Test the new c-macros for dt enums. The new macros are already used in the existing macros. As an example, DT_ENUM_IDX(node_id, prop) uses DT_ENUM_IDX_BY_IDX(node_id, prop, 0) to get its result. However, this is insufficient for testing the complete functionality of these macros. Therefore, additional tests are added to make sure they work appropriately for other indices besides 0. Signed-off-by: Joel Hirsbrunner --- .../test/vnd,enum-int-array-holder.yaml | 21 ++++++ .../test/vnd,enum-string-array-holder.yaml | 17 +++++ tests/lib/devicetree/api/app.overlay | 10 +++ tests/lib/devicetree/api/src/main.c | 70 +++++++++++++++++++ 4 files changed, 118 insertions(+) create mode 100644 dts/bindings/test/vnd,enum-int-array-holder.yaml create mode 100644 dts/bindings/test/vnd,enum-string-array-holder.yaml diff --git a/dts/bindings/test/vnd,enum-int-array-holder.yaml b/dts/bindings/test/vnd,enum-int-array-holder.yaml new file mode 100644 index 0000000000000..f147a0c70aa05 --- /dev/null +++ b/dts/bindings/test/vnd,enum-int-array-holder.yaml @@ -0,0 +1,21 @@ +# Copyright (c) 2020 Linaro Limited +# SPDX-License-Identifier: Apache-2.0 + +description: Test enum property container + +compatible: "vnd,enum-int-array-holder" + +include: [base.yaml] + +properties: + val: + type: array + enum: + - 7 + - 6 + - 5 + - 4 + - 3 + - 2 + - 1 + - 0 diff --git a/dts/bindings/test/vnd,enum-string-array-holder.yaml b/dts/bindings/test/vnd,enum-string-array-holder.yaml new file mode 100644 index 0000000000000..b90ce8e4e67b4 --- /dev/null +++ b/dts/bindings/test/vnd,enum-string-array-holder.yaml @@ -0,0 +1,17 @@ +# Copyright (c) 2020 Linaro Limited +# SPDX-License-Identifier: Apache-2.0 + +description: Test enum property container + +compatible: "vnd,enum-string-array-holder" + +include: [base.yaml] + +properties: + val: + type: string-array + enum: + - foo + - bar + - baz + - zoo diff --git a/tests/lib/devicetree/api/app.overlay b/tests/lib/devicetree/api/app.overlay index 0694c98239060..359f17066a2d7 100644 --- a/tests/lib/devicetree/api/app.overlay +++ b/tests/lib/devicetree/api/app.overlay @@ -114,6 +114,16 @@ compatible = "vnd,enum-required-false-holder-inst"; }; + test_enum_string_array: enum-8 { + compatible = "vnd,enum-string-array-holder"; + val = "foo", "zoo", "foo"; + }; + + test_enum_int_array: enum-9 { + compatible = "vnd,enum-int-array-holder"; + val = <4 3 4 0>; + }; + /* * disabled/reserved should be the only nodes with their * compatible in the tree. diff --git a/tests/lib/devicetree/api/src/main.c b/tests/lib/devicetree/api/src/main.c index 12724bfca9121..d4dd12cf733be 100644 --- a/tests/lib/devicetree/api/src/main.c +++ b/tests/lib/devicetree/api/src/main.c @@ -2010,6 +2010,41 @@ ZTEST(devicetree_api, test_enums) zassert_true(DT_ENUM_HAS_VALUE(DT_NODELABEL(test_enum_int_default_0), val, 5), ""); zassert_false(DT_ENUM_HAS_VALUE(DT_NODELABEL(test_enum_int_default_0), val, 6), ""); zassert_false(DT_ENUM_HAS_VALUE(DT_NODELABEL(test_enum_int_default_0), val, 7), ""); + + /* DT_ENUM_IDX_BY_IDX and DT_ENUM_HAS_VALUE_BY_IDX on string-array enum */ + zassert_equal(DT_ENUM_IDX_BY_IDX(DT_NODELABEL(test_enum_string_array), val, 0), 0); + zassert_equal(DT_ENUM_IDX_BY_IDX(DT_NODELABEL(test_enum_string_array), val, 1), 3); + zassert_equal(DT_ENUM_IDX_BY_IDX(DT_NODELABEL(test_enum_string_array), val, 2), 0); + zassert_true(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_string_array), val, 0, foo)); + zassert_false(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_string_array), val, 0, bar)); + zassert_false(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_string_array), val, 0, baz)); + zassert_false(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_string_array), val, 0, zoo)); + zassert_true(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_string_array), val, 1, zoo)); + zassert_false(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_string_array), val, 1, foo)); + zassert_false(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_string_array), val, 1, bar)); + zassert_false(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_string_array), val, 1, baz)); + zassert_true(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_string_array), val, 2, foo)); + zassert_false(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_string_array), val, 2, baz)); + zassert_false(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_string_array), val, 2, bar)); + zassert_false(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_string_array), val, 2, zoo)); + + /* DT_ENUM_IDX_BY_IDX and DT_ENUM_HAS_VALUE_BY_IDX on int-array enum */ + zassert_equal(DT_ENUM_IDX_BY_IDX(DT_NODELABEL(test_enum_int_array), val, 0), 3); + zassert_equal(DT_ENUM_IDX_BY_IDX(DT_NODELABEL(test_enum_int_array), val, 1), 4); + zassert_equal(DT_ENUM_IDX_BY_IDX(DT_NODELABEL(test_enum_int_array), val, 2), 3); + zassert_equal(DT_ENUM_IDX_BY_IDX(DT_NODELABEL(test_enum_int_array), val, 3), 7); + zassert_true(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_int_array), val, 0, 4)); + zassert_false(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_int_array), val, 0, 5)); + zassert_false(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_int_array), val, 0, 6)); + zassert_true(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_int_array), val, 1, 3)); + zassert_false(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_int_array), val, 1, 0)); + zassert_false(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_int_array), val, 1, 1)); + zassert_true(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_int_array), val, 2, 4)); + zassert_false(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_int_array), val, 2, 3)); + zassert_false(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_int_array), val, 2, 7)); + zassert_true(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_int_array), val, 3, 0)); + zassert_false(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_int_array), val, 3, 2)); + zassert_false(DT_ENUM_HAS_VALUE_BY_IDX(DT_NODELABEL(test_enum_int_array), val, 3, 1)); } #undef TO_MY_ENUM #undef TO_MY_ENUM_2 @@ -2028,6 +2063,18 @@ ZTEST(devicetree_api, test_enums_required_false) zassert_equal(DT_ENUM_IDX_OR(DT_NODELABEL(test_enum_int_default_1), val, 4), 4, ""); + /* DT_ENUM_IDX_OR on string-array value */ + zassert_equal(DT_ENUM_IDX_BY_IDX_OR(DT_NODELABEL(test_enum_string_array), val, 0, 2), + 0, ""); + zassert_equal(DT_ENUM_IDX_BY_IDX_OR(DT_NODELABEL(test_enum_string_array), val, 5, 2), + 2, ""); + /* DT_ENUM_IDX_OR on int-array value */ + zassert_equal(DT_ENUM_IDX_BY_IDX_OR(DT_NODELABEL(test_enum_int_array), + val, 0, 7), + 3, ""); + zassert_equal(DT_ENUM_IDX_BY_IDX_OR(DT_NODELABEL(test_enum_int_array), + val, 4, 7), + 7, ""); } ZTEST(devicetree_api, test_inst_enums) @@ -2046,6 +2093,29 @@ ZTEST(devicetree_api, test_inst_enums) zassert_false(DT_INST_ENUM_HAS_VALUE(0, val, zero), ""); zassert_false(DT_INST_ENUM_HAS_VALUE(0, val, one), ""); zassert_false(DT_INST_ENUM_HAS_VALUE(0, val, two), ""); + + /* Also add tests for these: + * DT_INST_ENUM_IDX_BY_IDX + * DT_INST_ENUM_IDX_BY_IDX_OR + * DT_INST_ENUM_HAS_VALUE_BY_IDX + */ +#undef DT_DRV_COMPAT +#define DT_DRV_COMPAT vnd_enum_string_array_holder + zassert_equal(DT_INST_ENUM_IDX_BY_IDX(0, val, 0), 0, ""); + zassert_equal(DT_INST_ENUM_IDX_BY_IDX(0, val, 1), 3, ""); + zassert_true(DT_INST_ENUM_HAS_VALUE_BY_IDX(0, val, 0, foo), ""); + zassert_false(DT_INST_ENUM_HAS_VALUE_BY_IDX(0, val, 0, zoo), ""); + zassert_true(DT_INST_ENUM_HAS_VALUE_BY_IDX(0, val, 1, zoo), ""); + zassert_false(DT_INST_ENUM_HAS_VALUE_BY_IDX(0, val, 2, baz), ""); + zassert_equal(DT_INST_ENUM_IDX_BY_IDX_OR(0, val, 0, 10), 0, ""); + zassert_equal(DT_INST_ENUM_IDX_BY_IDX_OR(0, val, 4, 10), 10, ""); + +#undef DT_DRV_COMPAT +#define DT_DRV_COMPAT vnd_enum_int_array_holder + zassert_equal(DT_INST_ENUM_IDX_BY_IDX(0, val, 0), 3, ""); + zassert_equal(DT_INST_ENUM_IDX_BY_IDX(0, val, 3), 7, ""); + zassert_equal(DT_INST_ENUM_IDX_BY_IDX_OR(0, val, 1, 10), 4, ""); + zassert_equal(DT_INST_ENUM_IDX_BY_IDX_OR(0, val, 123654, 10), 10, ""); } #undef DT_DRV_COMPAT From bda38f033ab52d2711a676783905987251452394 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Mon, 14 Oct 2024 14:07:55 -0700 Subject: [PATCH 0800/4482] tests: mem_map: fix memory exhaustion test on qemu_x86_tiny The test_k_mem_map_unmap test requires some free physical pages to work correctly. On qemu_x86_tiny, the physical memory is artificially limited to test demand paging, which is 320KB as of writing of this commit message. We also reserve 128KB of physical memory as swapping area. And we do pin quite lot of text and data (relatively speaking) in memory. There is not much memory left for the test. So lower the amount of reserved memory for paging to leave some pages for the test. Signed-off-by: Daniel Leung --- .../kernel/mem_protect/mem_map/boards/qemu_x86_tiny.conf | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/kernel/mem_protect/mem_map/boards/qemu_x86_tiny.conf diff --git a/tests/kernel/mem_protect/mem_map/boards/qemu_x86_tiny.conf b/tests/kernel/mem_protect/mem_map/boards/qemu_x86_tiny.conf new file mode 100644 index 0000000000000..6b28332f9ac87 --- /dev/null +++ b/tests/kernel/mem_protect/mem_map/boards/qemu_x86_tiny.conf @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 + +# Adjust this so that test_k_mem_map_unmap memory exhaustion +# test can run without failure, as we may run of free pages +# when there are changes in code and data size. +CONFIG_DEMAND_PAGING_PAGE_FRAMES_RESERVE=30 From 9105b1937ee2bd49538ba491a70b4d6f1c4cd829 Mon Sep 17 00:00:00 2001 From: Rodrigo Peixoto Date: Fri, 11 Oct 2024 05:01:15 -0300 Subject: [PATCH 0801/4482] tests: zbus: fix ci by excluding m2gl025_miv board The `m2gl025_miv` is breaking the ci during the zbus integration tests. To solve that in a meanwhile, this commit excludes the board from the zbus integration tests. Signed-off-by: Rodrigo Peixoto --- tests/subsys/zbus/integration/testcase.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/subsys/zbus/integration/testcase.yaml b/tests/subsys/zbus/integration/testcase.yaml index 242edbc6e779f..8e04f4d318cf8 100644 --- a/tests/subsys/zbus/integration/testcase.yaml +++ b/tests/subsys/zbus/integration/testcase.yaml @@ -1,6 +1,7 @@ tests: message_bus.zbus.module_interaction_no_error: platform_exclude: + - m2gl025_miv - qemu_cortex_a9 - hifive_unleashed - fvp_base_revc_2xaemv8a//smp/ns From 6300e1bc253531b992c868424543cde112189915 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Wed, 18 Sep 2024 13:56:06 +0200 Subject: [PATCH 0802/4482] soc: nordic: nrf54l: remove normal voltage mode Normal voltage mode is no longer supported by MDK 8.67.0. Signed-off-by: Nikodem Kastelik --- soc/nordic/nrf54l/Kconfig | 3 --- soc/nordic/nrf54l/soc.c | 4 ---- 2 files changed, 7 deletions(-) diff --git a/soc/nordic/nrf54l/Kconfig b/soc/nordic/nrf54l/Kconfig index eeb12fbfab04d..0ad48f7c9c1f6 100644 --- a/soc/nordic/nrf54l/Kconfig +++ b/soc/nordic/nrf54l/Kconfig @@ -79,9 +79,6 @@ config SOC_NRF_FORCE_CONSTLAT of base resources on while in sleep. The advantage of having a constant and predictable latency will be at the cost of having increased power consumption. -config SOC_NRF54L_NORMAL_VOLTAGE_MODE - bool "NRF54L Normal Voltage Mode." - if NRF_GRTC_TIMER config ELV_GRTC_LFXO_ALLOWED diff --git a/soc/nordic/nrf54l/soc.c b/soc/nordic/nrf54l/soc.c index b1e8667a9f1f9..f70675517b8ea 100644 --- a/soc/nordic/nrf54l/soc.c +++ b/soc/nordic/nrf54l/soc.c @@ -156,10 +156,6 @@ static int nordicsemi_nrf54l_init(void) nrf_regulators_vreg_enable_set(NRF_REGULATORS, NRF_REGULATORS_VREG_MAIN, true); #endif - if (IS_ENABLED(CONFIG_SOC_NRF54L_NORMAL_VOLTAGE_MODE)) { - nrf_regulators_vreg_enable_set(NRF_REGULATORS, NRF_REGULATORS_VREG_MEDIUM, false); - } - #if defined(CONFIG_ELV_GRTC_LFXO_ALLOWED) nrf_regulators_elv_mode_allow_set(NRF_REGULATORS, NRF_REGULATORS_ELV_ELVGRTCLFXO_MASK); #endif /* CONFIG_ELV_GRTC_LFXO_ALLOWED */ From a285b8a7b8c02605dfd4ef247612333860b2280e Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Fri, 11 Oct 2024 11:36:30 +0000 Subject: [PATCH 0803/4482] boards: nxp: frdm_k64f: use SW2 instead of SW3 for MCUboot Use SW2 instead of SW3 for entering MCUboot serial recovery/USB DFU mode. Holding SW3 during reset results in a NMI, causing the boot process to halt. Signed-off-by: Henrik Brix Andersen --- boards/nxp/frdm_k64f/frdm_k64f.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/nxp/frdm_k64f/frdm_k64f.dts b/boards/nxp/frdm_k64f/frdm_k64f.dts index 24800e36fe908..8e91aa8cfb99d 100644 --- a/boards/nxp/frdm_k64f/frdm_k64f.dts +++ b/boards/nxp/frdm_k64f/frdm_k64f.dts @@ -18,7 +18,7 @@ sw1 = &user_button_2; magn0 = &fxos8700; accel0 = &fxos8700; - mcuboot-button0 = &user_button_3; + mcuboot-button0 = &user_button_2; }; chosen { From 45a79d32080491eba8de72c67622cbe12b72158c Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Fri, 11 Oct 2024 12:35:29 +0200 Subject: [PATCH 0804/4482] tests: net: conn_mgr_monitor: Improve test reliability under heavy load conn_mgr_tests were occasionally failing when executed under heavy load. The reason for this are short timeout values used when waiting for events - if executed under heavy load, the even might not be delivered on time. An obvious solution would be to simply increase the timeout, however when testing it turned out the actual timeout value would need to be pretty high to ensure tests reliability. Therefore, to avoid unnecessary increase of the overall test execution time to protect against rare edge cases, rework the event waiting mechanism to use semaphore instead. The test cases will now specify the events they're waiting for, and the event handlers will feed the semaphore if all expected events have been delivered. This allows the increase the maximum timeout when waiting for events, w/o affecting too much the test execution time under normal conditions. Signed-off-by: Robert Lubos --- tests/net/conn_mgr_monitor/src/main.c | 146 +++++++++++++++++++------- 1 file changed, 109 insertions(+), 37 deletions(-) diff --git a/tests/net/conn_mgr_monitor/src/main.c b/tests/net/conn_mgr_monitor/src/main.c index 4b15510f3e489..522a9d50b9219 100644 --- a/tests/net/conn_mgr_monitor/src/main.c +++ b/tests/net/conn_mgr_monitor/src/main.c @@ -24,7 +24,8 @@ #include /* Time to wait for NET_MGMT events to finish firing */ -#define EVENT_WAIT_TIME K_MSEC(10) +#define EVENT_WAIT_TIME_SHORT K_MSEC(10) +#define EVENT_WAIT_TIME K_MSEC(200) /* Time to wait for IPv6 DAD-gated events to finish. @@ -36,6 +37,15 @@ #define DAD_WAIT_TIME EVENT_WAIT_TIME #endif +#define TEST_EXPECT_L4_CONNECTED BIT(NET_EVENT_L4_CMD_CONNECTED) +#define TEST_EXPECT_L4_DISCONNECTED BIT(NET_EVENT_L4_CMD_DISCONNECTED) +#define TEST_EXPECT_L4_IPV6_CONNECTED BIT(NET_EVENT_L4_CMD_IPV6_CONNECTED) +#define TEST_EXPECT_L4_IPV6_DISCONNECTED BIT(NET_EVENT_L4_CMD_IPV6_DISCONNECTED) +#define TEST_EXPECT_L4_IPV4_CONNECTED BIT(NET_EVENT_L4_CMD_IPV4_CONNECTED) +#define TEST_EXPECT_L4_IPV4_DISCONNECTED BIT(NET_EVENT_L4_CMD_IPV4_DISCONNECTED) + +#define TEST_EXPECT_CLEAR(event) (global_stats.expected_events &= ~event) + /* IP addresses -- Two of each are needed because address sharing will cause address removal to * fail silently (Address is only removed from one iface). */ @@ -73,7 +83,9 @@ static void reset_test_iface(struct net_if *iface) } /* Thread-safe test statistics */ -K_MUTEX_DEFINE(stats_mutex); +static K_MUTEX_DEFINE(stats_mutex); +static K_SEM_DEFINE(event_sem, 0, 1); + static struct test_stats { /** IPv4 connectivity event counters */ int event_count_ipv4; /* any */ @@ -100,6 +112,7 @@ static struct test_stats { struct net_if *conn_iface_ipv4; struct net_if *conn_iface_ipv6; + uint32_t expected_events; } global_stats; static void reset_stats(void) @@ -124,6 +137,8 @@ static void reset_stats(void) global_stats.dconn_iface_ipv6 = NULL; global_stats.conn_iface_ipv6 = NULL; + global_stats.expected_events = 0; + k_mutex_unlock(&stats_mutex); } @@ -153,14 +168,20 @@ void l4_handler(struct net_mgmt_event_callback *cb, uint32_t event, struct net_i global_stats.conn_count_gen += 1; global_stats.event_count_gen += 1; global_stats.conn_iface_gen = iface; + TEST_EXPECT_CLEAR(TEST_EXPECT_L4_CONNECTED); k_mutex_unlock(&stats_mutex); } else if (event == NET_EVENT_L4_DISCONNECTED) { k_mutex_lock(&stats_mutex, K_FOREVER); global_stats.dconn_count_gen += 1; global_stats.event_count_gen += 1; global_stats.dconn_iface_gen = iface; + TEST_EXPECT_CLEAR(TEST_EXPECT_L4_DISCONNECTED); k_mutex_unlock(&stats_mutex); } + + if (global_stats.expected_events == 0) { + k_sem_give(&event_sem); + } } struct net_mgmt_event_callback conn_callback; @@ -172,26 +193,47 @@ void conn_handler(struct net_mgmt_event_callback *cb, uint32_t event, struct net global_stats.conn_count_ipv6 += 1; global_stats.event_count_ipv6 += 1; global_stats.conn_iface_ipv6 = iface; + TEST_EXPECT_CLEAR(TEST_EXPECT_L4_IPV6_CONNECTED); k_mutex_unlock(&stats_mutex); } else if (event == NET_EVENT_L4_IPV6_DISCONNECTED) { k_mutex_lock(&stats_mutex, K_FOREVER); global_stats.dconn_count_ipv6 += 1; global_stats.event_count_ipv6 += 1; global_stats.dconn_iface_ipv6 = iface; + TEST_EXPECT_CLEAR(TEST_EXPECT_L4_IPV6_DISCONNECTED); k_mutex_unlock(&stats_mutex); } else if (event == NET_EVENT_L4_IPV4_CONNECTED) { k_mutex_lock(&stats_mutex, K_FOREVER); global_stats.conn_count_ipv4 += 1; global_stats.event_count_ipv4 += 1; global_stats.conn_iface_ipv4 = iface; + TEST_EXPECT_CLEAR(TEST_EXPECT_L4_IPV4_CONNECTED); k_mutex_unlock(&stats_mutex); } else if (event == NET_EVENT_L4_IPV4_DISCONNECTED) { k_mutex_lock(&stats_mutex, K_FOREVER); global_stats.dconn_count_ipv4 += 1; global_stats.event_count_ipv4 += 1; global_stats.dconn_iface_ipv4 = iface; + TEST_EXPECT_CLEAR(TEST_EXPECT_L4_IPV4_DISCONNECTED); k_mutex_unlock(&stats_mutex); } + + if (global_stats.expected_events == 0) { + k_sem_give(&event_sem); + } +} + +static void wait_for_events(uint32_t event_mask, k_timeout_t timeout) +{ + k_mutex_lock(&stats_mutex, K_FOREVER); + k_sem_reset(&event_sem); + global_stats.expected_events = event_mask; + k_mutex_unlock(&stats_mutex); + + (void)k_sem_take(&event_sem, timeout); + + /* Add small extra sleep to give any unexpected events to show up. */ + k_sleep(EVENT_WAIT_TIME_SHORT); } /* Test suite shared functions & routines */ @@ -223,7 +265,7 @@ static void conn_mgr_before(void *data) reset_test_iface(if_conn_b); /* Allow any triggered events to shake out */ - k_sleep(EVENT_WAIT_TIME); + k_sleep(K_MSEC(50)); reset_stats(); } @@ -248,7 +290,7 @@ static void cycle_ready_ifaces(struct net_if *ifa, struct net_if *ifb) net_if_ipv4_addr_add(ifb, &test_ipv4_b, NET_ADDR_MANUAL, 0); /* Expect no events */ - k_sleep(EVENT_WAIT_TIME); + k_sleep(EVENT_WAIT_TIME_SHORT); stats = get_reset_stats(); zassert_equal(stats.event_count_gen, 0, "No events should be fired if connectivity availability did not change."); @@ -257,7 +299,7 @@ static void cycle_ready_ifaces(struct net_if *ifa, struct net_if *ifb) zassert_equal(net_if_up(ifa), 0, "net_if_up should succeed for ifa."); /* Expect connectivity gained */ - k_sleep(EVENT_WAIT_TIME); + wait_for_events(TEST_EXPECT_L4_CONNECTED, EVENT_WAIT_TIME); stats = get_reset_stats(); zassert_equal(stats.conn_count_gen, 1, "NET_EVENT_L4_CONNECTED should be fired when connectivity is gained."); @@ -269,7 +311,7 @@ static void cycle_ready_ifaces(struct net_if *ifa, struct net_if *ifb) zassert_equal(net_if_up(ifb), 0, "net_if_up should succeed for ifb."); /* Expect no events */ - k_sleep(EVENT_WAIT_TIME); + k_sleep(EVENT_WAIT_TIME_SHORT); stats = get_reset_stats(); zassert_equal(stats.event_count_gen, 0, "No events should be fired if connectivity availability did not change."); @@ -278,7 +320,7 @@ static void cycle_ready_ifaces(struct net_if *ifa, struct net_if *ifb) zassert_equal(net_if_down(ifa), 0, "net_if_down should succeed for ifa."); /* Expect no events */ - k_sleep(EVENT_WAIT_TIME); + k_sleep(EVENT_WAIT_TIME_SHORT); stats = get_reset_stats(); zassert_equal(stats.event_count_gen, 0, "No events should be fired if connectivity availability did not change."); @@ -287,7 +329,7 @@ static void cycle_ready_ifaces(struct net_if *ifa, struct net_if *ifb) zassert_equal(net_if_down(ifb), 0, "net_if_down should succeed for ifb."); /* Expect connectivity loss */ - k_sleep(EVENT_WAIT_TIME); + wait_for_events(TEST_EXPECT_L4_DISCONNECTED, EVENT_WAIT_TIME); stats = get_reset_stats(); zassert_equal(stats.dconn_count_gen, 1, "NET_EVENT_L4_DISCONNECTED should be fired when connectivity is lost."); @@ -343,7 +385,7 @@ static void cycle_ignored_iface(struct net_if *ifa, struct net_if *ifb) zassert_equal(net_if_down(ifb), 0, "net_if_down should succeed for ifb."); /* Expect no events */ - k_sleep(EVENT_WAIT_TIME); + k_sleep(EVENT_WAIT_TIME_SHORT); stats = get_reset_stats(); zassert_equal(stats.event_count_gen, 0, "No events should be fired if connectivity availability did not change."); @@ -356,7 +398,10 @@ static void cycle_ignored_iface(struct net_if *ifa, struct net_if *ifb) zassert_equal(net_if_up(ifa), 0, "net_if_up should succeed for ifa."); /* Expect connectivity gained */ - k_sleep(DAD_WAIT_TIME); + wait_for_events(TEST_EXPECT_L4_CONNECTED | + TEST_EXPECT_L4_IPV4_CONNECTED | + TEST_EXPECT_L4_IPV6_CONNECTED, + EVENT_WAIT_TIME); stats = get_reset_stats(); zassert_equal(stats.conn_count_gen, 1, "NET_EVENT_L4_CONNECTED should be fired when connectivity is gained."); @@ -391,7 +436,7 @@ static void cycle_ignored_iface(struct net_if *ifa, struct net_if *ifb) zassert_equal(net_if_down(ifb), 0, "net_if_down should succeed for ifb."); /* Expect no events */ - k_sleep(EVENT_WAIT_TIME); + k_sleep(EVENT_WAIT_TIME_SHORT); stats = get_reset_stats(); zassert_equal(stats.event_count_gen, 0, "No events should be fired if connectivity availability did not change."); @@ -404,7 +449,10 @@ static void cycle_ignored_iface(struct net_if *ifa, struct net_if *ifb) zassert_equal(net_if_down(ifa), 0, "net_if_down should succeed for ifa."); /* Expect connectivity lost */ - k_sleep(EVENT_WAIT_TIME); + wait_for_events(TEST_EXPECT_L4_DISCONNECTED | + TEST_EXPECT_L4_IPV4_DISCONNECTED | + TEST_EXPECT_L4_IPV6_DISCONNECTED, + EVENT_WAIT_TIME); stats = get_reset_stats(); zassert_equal(stats.dconn_count_gen, 1, "NET_EVENT_L4_DISCONNECTED should be fired when connectivity is lost."); @@ -442,7 +490,10 @@ static void cycle_ignored_iface(struct net_if *ifa, struct net_if *ifb) zassert_equal(net_if_up(ifa), 0, "net_if_up should succeed for ifa."); /* Expect connectivity gained */ - k_sleep(DAD_WAIT_TIME); + wait_for_events(TEST_EXPECT_L4_CONNECTED | + TEST_EXPECT_L4_IPV4_CONNECTED | + TEST_EXPECT_L4_IPV6_CONNECTED, + EVENT_WAIT_TIME); stats = get_reset_stats(); zassert_equal(stats.conn_count_gen, 1, "NET_EVENT_L4_CONNECTED should be fired when connectivity is gained."); @@ -464,7 +515,7 @@ static void cycle_ignored_iface(struct net_if *ifa, struct net_if *ifb) zassert_equal(net_if_down(ifb), 0, "net_if_down should succeed for ifb."); /* Expect no events */ - k_sleep(EVENT_WAIT_TIME); + k_sleep(EVENT_WAIT_TIME_SHORT); stats = get_reset_stats(); zassert_equal(stats.event_count_gen, 0, "No events should be fired if connectivity availability did not change."); @@ -491,7 +542,10 @@ static void cycle_ignored_iface(struct net_if *ifa, struct net_if *ifb) zassert_equal(net_if_down(ifa), 0, "net_if_down should succeed for ifa."); /* Expect connectivity lost */ - k_sleep(EVENT_WAIT_TIME); + wait_for_events(TEST_EXPECT_L4_DISCONNECTED | + TEST_EXPECT_L4_IPV4_DISCONNECTED | + TEST_EXPECT_L4_IPV6_DISCONNECTED, + EVENT_WAIT_TIME); stats = get_reset_stats(); zassert_equal(stats.dconn_count_gen, 1, "NET_EVENT_L4_DISCONNECTED should be fired when connectivity is lost."); @@ -513,7 +567,7 @@ static void cycle_ignored_iface(struct net_if *ifa, struct net_if *ifb) zassert_equal(net_if_down(ifb), 0, "net_if_down should succeed for ifb."); /* Expect no events */ - k_sleep(EVENT_WAIT_TIME); + k_sleep(EVENT_WAIT_TIME_SHORT); stats = get_reset_stats(); zassert_equal(stats.event_count_gen, 0, "No events should be fired if connectivity availability did not change."); @@ -568,7 +622,7 @@ static void cycle_iface_states(struct net_if *iface, enum ip_order ifa_ipm) zassert_equal(net_if_up(iface), 0, "net_if_up should succeed."); /* Verify that no events have been fired yet */ - k_sleep(EVENT_WAIT_TIME); + k_sleep(EVENT_WAIT_TIME_SHORT); stats = get_reset_stats(); zassert_equal(stats.event_count_gen, 0, "No events should be fired if connectivity availability did not change."); @@ -580,7 +634,9 @@ static void cycle_iface_states(struct net_if *iface, enum ip_order ifa_ipm) net_if_ipv4_addr_add(iface, &test_ipv4_a, NET_ADDR_MANUAL, 0); /* Verify correct events */ - k_sleep(EVENT_WAIT_TIME); + wait_for_events(TEST_EXPECT_L4_CONNECTED | + TEST_EXPECT_L4_IPV4_CONNECTED, + EVENT_WAIT_TIME); stats = get_reset_stats(); zassert_equal(stats.conn_count_gen, 1, "NET_EVENT_L4_CONNECTED should be fired when connectivity is gained."); @@ -600,10 +656,9 @@ static void cycle_iface_states(struct net_if *iface, enum ip_order ifa_ipm) /* Add IPv6 */ net_if_ipv6_addr_add(iface, &test_ipv6_a, NET_ADDR_MANUAL, 0); - k_sleep(DAD_WAIT_TIME); /* Verify only IPv6 events */ - k_sleep(EVENT_WAIT_TIME); + wait_for_events(TEST_EXPECT_L4_IPV6_CONNECTED, EVENT_WAIT_TIME); stats = get_reset_stats(); zassert_equal(stats.event_count_gen, 0, "No events should be fired if connectivity availability did not change."); @@ -621,10 +676,11 @@ static void cycle_iface_states(struct net_if *iface, enum ip_order ifa_ipm) case IPV6_FIRST: /* Add IPv6 */ net_if_ipv6_addr_add(iface, &test_ipv6_a, NET_ADDR_MANUAL, 0); - k_sleep(DAD_WAIT_TIME); /* Verify correct events */ - k_sleep(EVENT_WAIT_TIME); + wait_for_events(TEST_EXPECT_L4_CONNECTED | + TEST_EXPECT_L4_IPV6_CONNECTED, + EVENT_WAIT_TIME); stats = get_reset_stats(); zassert_equal(stats.conn_count_gen, 1, "NET_EVENT_L4_CONNECTED should be fired when connectivity is gained."); @@ -645,7 +701,7 @@ static void cycle_iface_states(struct net_if *iface, enum ip_order ifa_ipm) net_if_ipv4_addr_add(iface, &test_ipv4_a, NET_ADDR_MANUAL, 0); /* Verify only IPv4 events */ - k_sleep(EVENT_WAIT_TIME); + wait_for_events(TEST_EXPECT_L4_IPV4_CONNECTED, EVENT_WAIT_TIME); stats = get_reset_stats(); zassert_equal(stats.event_count_gen, 0, "No events should be fired if connectivity availability did not change."); @@ -669,7 +725,7 @@ static void cycle_iface_states(struct net_if *iface, enum ip_order ifa_ipm) "IPv4 removal should succeed."); /* Verify only IPv4 events */ - k_sleep(EVENT_WAIT_TIME); + wait_for_events(TEST_EXPECT_L4_IPV4_DISCONNECTED, EVENT_WAIT_TIME); stats = get_reset_stats(); zassert_equal(stats.event_count_gen, 0, "No events should be fired if connectivity availability did not change."); @@ -688,7 +744,9 @@ static void cycle_iface_states(struct net_if *iface, enum ip_order ifa_ipm) "IPv6 removal should succeed."); /* Verify correct events */ - k_sleep(EVENT_WAIT_TIME); + wait_for_events(TEST_EXPECT_L4_DISCONNECTED | + TEST_EXPECT_L4_IPV6_DISCONNECTED, + EVENT_WAIT_TIME); stats = get_reset_stats(); zassert_equal(stats.dconn_count_gen, 1, "NET_EVENT_L4_DISCONNECTED should be fired when connectivity is lost."); @@ -714,7 +772,7 @@ static void cycle_iface_states(struct net_if *iface, enum ip_order ifa_ipm) "IPv6 removal should succeed."); /* Verify only IPv6 events */ - k_sleep(EVENT_WAIT_TIME); + wait_for_events(TEST_EXPECT_L4_IPV6_DISCONNECTED, EVENT_WAIT_TIME); stats = get_reset_stats(); zassert_equal(stats.event_count_gen, 0, "No events should be fired if connectivity availability did not change."); @@ -733,7 +791,9 @@ static void cycle_iface_states(struct net_if *iface, enum ip_order ifa_ipm) "IPv4 removal should succeed."); /* Verify correct events */ - k_sleep(EVENT_WAIT_TIME); + wait_for_events(TEST_EXPECT_L4_DISCONNECTED | + TEST_EXPECT_L4_IPV4_DISCONNECTED, + EVENT_WAIT_TIME); stats = get_reset_stats(); zassert_equal(stats.dconn_count_gen, 1, "NET_EVENT_L4_DISCONNECTED should be fired when connectivity is lost."); @@ -760,7 +820,7 @@ static void cycle_iface_states(struct net_if *iface, enum ip_order ifa_ipm) zassert_equal(net_if_down(iface), 0, "net_if_down should succeed."); /* Verify there are no events fired */ - k_sleep(EVENT_WAIT_TIME); + k_sleep(EVENT_WAIT_TIME_SHORT); stats = get_reset_stats(); zassert_equal(stats.event_count_gen, 0, "No events should be fired if connectivity availability did not change."); @@ -788,7 +848,7 @@ static void cycle_iface_states(struct net_if *iface, enum ip_order ifa_ipm) } /* Verify that no events are fired */ - k_sleep(EVENT_WAIT_TIME); + k_sleep(EVENT_WAIT_TIME_SHORT); stats = get_reset_stats(); zassert_equal(stats.event_count_gen, 0, "No events should be fired if connectivity availability did not change."); @@ -803,7 +863,10 @@ static void cycle_iface_states(struct net_if *iface, enum ip_order ifa_ipm) zassert_equal(net_if_up(iface), 0, "net_if_up should succeed."); /* Verify events are fired */ - k_sleep(DAD_WAIT_TIME); + wait_for_events(TEST_EXPECT_L4_CONNECTED | + TEST_EXPECT_L4_IPV4_CONNECTED | + TEST_EXPECT_L4_IPV6_CONNECTED, + EVENT_WAIT_TIME); stats = get_reset_stats(); zassert_equal(stats.conn_count_gen, 1, "NET_EVENT_L4_CONNECTED should be fired when connectivity is gained."); @@ -831,7 +894,10 @@ static void cycle_iface_states(struct net_if *iface, enum ip_order ifa_ipm) zassert_equal(net_if_down(iface), 0, "net_if_down should succeed."); /* Verify events are fired */ - k_sleep(EVENT_WAIT_TIME); + wait_for_events(TEST_EXPECT_L4_DISCONNECTED | + TEST_EXPECT_L4_IPV4_DISCONNECTED | + TEST_EXPECT_L4_IPV6_DISCONNECTED, + EVENT_WAIT_TIME); stats = get_reset_stats(); zassert_equal(stats.dconn_count_gen, 1, "NET_EVENT_L4_DISCONNECTED should be fired when connectivity is lost."); @@ -874,7 +940,7 @@ static void cycle_iface_states(struct net_if *iface, enum ip_order ifa_ipm) } /* Verify no events fired */ - k_sleep(EVENT_WAIT_TIME); + k_sleep(EVENT_WAIT_TIME_SHORT); stats = get_reset_stats(); zassert_equal(stats.event_count_gen, 0, "No events should be fired if connectivity availability did not change."); @@ -964,13 +1030,13 @@ ZTEST(conn_mgr_monitor, test_DAD) net_if_ipv6_addr_add(if_simp_a, &test_ipv6_a, NET_ADDR_MANUAL, 0); /* After a delay too short for DAD, ensure no events */ - k_sleep(EVENT_WAIT_TIME); + k_sleep(EVENT_WAIT_TIME_SHORT); stats = get_reset_stats(); zassert_equal(stats.event_count_gen, 0, "No events should be fired before DAD success."); /* After a delay long enough for DAD, ensure connectivity acquired */ - k_sleep(DAD_WAIT_TIME); + wait_for_events(TEST_EXPECT_L4_CONNECTED, EVENT_WAIT_TIME); stats = get_reset_stats(); zassert_equal(stats.conn_count_gen, 1, "NET_EVENT_L4_CONNECTED should be fired after DAD success."); @@ -1003,7 +1069,10 @@ ZTEST(conn_mgr_monitor, test_ignore_while_ready) conn_mgr_watch_iface(if_simp_a); /* Ensure connectivity gained */ - k_sleep(EVENT_WAIT_TIME); + wait_for_events(TEST_EXPECT_L4_CONNECTED | + TEST_EXPECT_L4_IPV4_CONNECTED | + TEST_EXPECT_L4_IPV6_CONNECTED, + EVENT_WAIT_TIME); stats = get_reset_stats(); zassert_equal(stats.conn_count_gen, 1, "NET_EVENT_L4_CONNECTED should be fired when online iface is watched."); @@ -1026,7 +1095,10 @@ ZTEST(conn_mgr_monitor, test_ignore_while_ready) conn_mgr_ignore_iface(if_simp_a); /* Ensure connectivity lost */ - k_sleep(EVENT_WAIT_TIME); + wait_for_events(TEST_EXPECT_L4_DISCONNECTED | + TEST_EXPECT_L4_IPV4_DISCONNECTED | + TEST_EXPECT_L4_IPV6_DISCONNECTED, + EVENT_WAIT_TIME); stats = get_reset_stats(); zassert_equal(stats.dconn_count_gen, 1, "NET_EVENT_L4_DISCONNECTED should be fired when online iface is ignored."); @@ -1048,7 +1120,7 @@ ZTEST(conn_mgr_monitor, test_ignore_while_ready) zassert_equal(net_if_down(if_simp_a), 0, "net_if_down should succeed for if_simp_a."); /* Ensure no events */ - k_sleep(EVENT_WAIT_TIME); + k_sleep(EVENT_WAIT_TIME_SHORT); stats = get_reset_stats(); zassert_equal(stats.event_count_gen, 0, "No events should be fired if disconnecting iface is ignored."); From d66d3170cf3ed792ed4ab9d987530ec9abc70633 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Fri, 11 Oct 2024 12:03:29 +0200 Subject: [PATCH 0805/4482] ci: github: Run CI for python 3.13 Python 3.13 has been released, add it to the CI matrix for python workflows. Signed-off-by: Pieter De Gendt --- .github/workflows/devicetree_checks.yml | 2 +- .github/workflows/pylib_tests.yml | 2 +- .github/workflows/scripts_tests.yml | 2 +- .github/workflows/twister_tests.yml | 2 +- .github/workflows/twister_tests_blackbox.yml | 2 +- .github/workflows/west_cmds.yml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/devicetree_checks.yml b/.github/workflows/devicetree_checks.yml index 060a5d9597381..558e41c4bc1f1 100644 --- a/.github/workflows/devicetree_checks.yml +++ b/.github/workflows/devicetree_checks.yml @@ -26,7 +26,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ['3.10', '3.11', '3.12'] + python-version: ['3.10', '3.11', '3.12', '3.13'] os: [ubuntu-22.04, macos-14, windows-2022] steps: - name: checkout diff --git a/.github/workflows/pylib_tests.yml b/.github/workflows/pylib_tests.yml index 8827acebdb493..2beb6c16956fe 100644 --- a/.github/workflows/pylib_tests.yml +++ b/.github/workflows/pylib_tests.yml @@ -25,7 +25,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ['3.10', '3.11', '3.12'] + python-version: ['3.10', '3.11', '3.12', '3.13'] os: [ubuntu-22.04] steps: - name: checkout diff --git a/.github/workflows/scripts_tests.yml b/.github/workflows/scripts_tests.yml index 20d116bcff59e..183f3eb474be0 100644 --- a/.github/workflows/scripts_tests.yml +++ b/.github/workflows/scripts_tests.yml @@ -25,7 +25,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ['3.10', '3.11', '3.12'] + python-version: ['3.10', '3.11', '3.12', '3.13'] os: [ubuntu-20.04] steps: - name: checkout diff --git a/.github/workflows/twister_tests.yml b/.github/workflows/twister_tests.yml index fa6737badb81e..bcd2abac556eb 100644 --- a/.github/workflows/twister_tests.yml +++ b/.github/workflows/twister_tests.yml @@ -32,7 +32,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ['3.10', '3.11', '3.12'] + python-version: ['3.10', '3.11', '3.12', '3.13'] os: [ubuntu-22.04] steps: - name: checkout diff --git a/.github/workflows/twister_tests_blackbox.yml b/.github/workflows/twister_tests_blackbox.yml index 8845c7eddd4be..76e8c842a6365 100644 --- a/.github/workflows/twister_tests_blackbox.yml +++ b/.github/workflows/twister_tests_blackbox.yml @@ -21,7 +21,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ['3.10', '3.11', '3.12'] + python-version: ['3.10', '3.11', '3.12', '3.13'] os: [ubuntu-22.04] container: image: ghcr.io/zephyrproject-rtos/ci:v0.26.13 diff --git a/.github/workflows/west_cmds.yml b/.github/workflows/west_cmds.yml index d910bf15a294f..73d942cadfe3d 100644 --- a/.github/workflows/west_cmds.yml +++ b/.github/workflows/west_cmds.yml @@ -29,7 +29,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ['3.10', '3.11', '3.12'] + python-version: ['3.10', '3.11', '3.12', '3.13'] os: [ubuntu-22.04, macos-14, windows-2022] steps: - name: checkout From 7fa962589f712d3931334b5d219285e3bff47584 Mon Sep 17 00:00:00 2001 From: Tim Lin Date: Fri, 11 Oct 2024 11:39:11 +0800 Subject: [PATCH 0806/4482] ITE: it8xxx2: Remove CONFIG_PINCTRL from soc defconfig file The driver Kconfig determines whether pinctrl is enabled instead of soc defconfig. Signed-off-by: Tim Lin --- drivers/adc/Kconfig.it8xxx2 | 1 + drivers/i2c/Kconfig.it8xxx2 | 2 ++ drivers/input/Kconfig.it8xxx2 | 1 + drivers/peci/Kconfig.it8xxx2 | 1 + drivers/pwm/Kconfig.it8xxx2 | 1 + drivers/sensor/ite/ite_tach_it8xxx2/Kconfig | 1 + drivers/serial/Kconfig.it8xxx2 | 1 + drivers/usb/device/Kconfig | 1 + drivers/usb/udc/Kconfig.it82xx2 | 1 + soc/ite/ec/it8xxx2/Kconfig.defconfig.series | 3 --- subsys/mgmt/ec_host_cmd/backends/Kconfig | 1 + 11 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/adc/Kconfig.it8xxx2 b/drivers/adc/Kconfig.it8xxx2 index 1d91e71c8ea9a..9b7e9ca48e7af 100644 --- a/drivers/adc/Kconfig.it8xxx2 +++ b/drivers/adc/Kconfig.it8xxx2 @@ -7,6 +7,7 @@ config ADC_ITE_IT8XXX2 bool "ITE IT8XXX2 ADC driver" default y depends on DT_HAS_ITE_IT8XXX2_ADC_ENABLED + select PINCTRL help This option enables the ADC driver for IT8XXX2 family of processors. diff --git a/drivers/i2c/Kconfig.it8xxx2 b/drivers/i2c/Kconfig.it8xxx2 index b0b3164b62d56..71e6b0ded52c2 100644 --- a/drivers/i2c/Kconfig.it8xxx2 +++ b/drivers/i2c/Kconfig.it8xxx2 @@ -5,6 +5,7 @@ config I2C_ITE_IT8XXX2 bool "ITE IT8XXX2 I2C driver" default y depends on DT_HAS_ITE_IT8XXX2_I2C_ENABLED + select PINCTRL help Enable I2C support on it8xxx2_evb. Supported Speeds: 100kHz, 400kHz and 1MHz. @@ -30,6 +31,7 @@ config I2C_ITE_ENHANCE bool "ITE IT8XXX2 I2C enhance driver" default y depends on DT_HAS_ITE_ENHANCE_I2C_ENABLED + select PINCTRL help This option can enable the enhance I2C of IT8XXX2 and support three channels. diff --git a/drivers/input/Kconfig.it8xxx2 b/drivers/input/Kconfig.it8xxx2 index 0c59b3425342f..f377ef9bee541 100644 --- a/drivers/input/Kconfig.it8xxx2 +++ b/drivers/input/Kconfig.it8xxx2 @@ -6,5 +6,6 @@ config INPUT_ITE_IT8XXX2_KBD default y depends on DT_HAS_ITE_IT8XXX2_KBD_ENABLED select INPUT_KBD_MATRIX + select PINCTRL help This option enables the ITE keyboard scan driver. diff --git a/drivers/peci/Kconfig.it8xxx2 b/drivers/peci/Kconfig.it8xxx2 index 8f8a72f9fe277..41bde0c1f3eda 100644 --- a/drivers/peci/Kconfig.it8xxx2 +++ b/drivers/peci/Kconfig.it8xxx2 @@ -8,5 +8,6 @@ config PECI_ITE_IT8XXX2 default y depends on DT_HAS_ITE_IT8XXX2_PECI_ENABLED select PECI_INTERRUPT_DRIVEN + select PINCTRL help Enable the ITE IT8XXX2 PECI IO driver. diff --git a/drivers/pwm/Kconfig.it8xxx2 b/drivers/pwm/Kconfig.it8xxx2 index 8f8019f5d23e3..dd3417022fe7a 100644 --- a/drivers/pwm/Kconfig.it8xxx2 +++ b/drivers/pwm/Kconfig.it8xxx2 @@ -7,6 +7,7 @@ config PWM_ITE_IT8XXX2 bool "ITE IT8XXX2 embedded controller (EC) PWM driver" default y depends on DT_HAS_ITE_IT8XXX2_PWM_ENABLED + select PINCTRL help Enable PWM driver for it8xxx2_evb. Supports three 16-bit prescalers each with 8-bit cycle timer, and diff --git a/drivers/sensor/ite/ite_tach_it8xxx2/Kconfig b/drivers/sensor/ite/ite_tach_it8xxx2/Kconfig index 7ad09d5645e9d..83af5d39eb9e3 100644 --- a/drivers/sensor/ite/ite_tach_it8xxx2/Kconfig +++ b/drivers/sensor/ite/ite_tach_it8xxx2/Kconfig @@ -8,6 +8,7 @@ config TACH_IT8XXX2 default y depends on DT_HAS_ITE_IT8XXX2_TACH_ENABLED depends on SOC_IT8XXX2 + select PINCTRL help Enable the ITE it8xxx2 tachometer sensor, it8xxx2 supports two 16-bit tachometer sensor, each sensor has two diff --git a/drivers/serial/Kconfig.it8xxx2 b/drivers/serial/Kconfig.it8xxx2 index 0af4d83e7bbbc..c8c12b035893c 100644 --- a/drivers/serial/Kconfig.it8xxx2 +++ b/drivers/serial/Kconfig.it8xxx2 @@ -6,6 +6,7 @@ config UART_ITE_IT8XXX2 default y select UART_NS16550_ITE_HIGH_SPEED_BAUDRATE depends on DT_HAS_ITE_IT8XXX2_UART_ENABLED + select PINCTRL help IT8XXX2 uses shared ns16550.c driver which does not provide a power management callback, so create driver diff --git a/drivers/usb/device/Kconfig b/drivers/usb/device/Kconfig index 5c38d8bfd3210..0d771dabcb6ad 100644 --- a/drivers/usb/device/Kconfig +++ b/drivers/usb/device/Kconfig @@ -193,6 +193,7 @@ config USB_DC_IT82XX2 bool "ITE IT82XX2 USB Device Controller Driver" default y depends on DT_HAS_ITE_IT82XX2_USB_ENABLED + select PINCTRL help ITE IT82XX2 USB Device Controller Driver diff --git a/drivers/usb/udc/Kconfig.it82xx2 b/drivers/usb/udc/Kconfig.it82xx2 index 649b2531d10db..eebda60f03f0e 100644 --- a/drivers/usb/udc/Kconfig.it82xx2 +++ b/drivers/usb/udc/Kconfig.it82xx2 @@ -5,6 +5,7 @@ config UDC_IT82XX2 bool "IT82XX2 USB device controller driver" default y depends on DT_HAS_ITE_IT82XX2_USB_ENABLED + select PINCTRL help IT82xx2 USB device controller driver. diff --git a/soc/ite/ec/it8xxx2/Kconfig.defconfig.series b/soc/ite/ec/it8xxx2/Kconfig.defconfig.series index 2b0f8549efc62..22140af14df15 100644 --- a/soc/ite/ec/it8xxx2/Kconfig.defconfig.series +++ b/soc/ite/ec/it8xxx2/Kconfig.defconfig.series @@ -30,9 +30,6 @@ config IT8XXX2_PLL_SEQUENCE_PRIORITY config VCMP_IT8XXX2_INIT_PRIORITY default 91 if VCMP_IT8XXX2_WORKQUEUE -config PINCTRL - default y - config NUM_IRQS default 185 diff --git a/subsys/mgmt/ec_host_cmd/backends/Kconfig b/subsys/mgmt/ec_host_cmd/backends/Kconfig index 56b59ebdbde51..bc3dbed16bdc3 100644 --- a/subsys/mgmt/ec_host_cmd/backends/Kconfig +++ b/subsys/mgmt/ec_host_cmd/backends/Kconfig @@ -62,6 +62,7 @@ config EC_HOST_CMD_BACKEND_SHI_NPCX config EC_HOST_CMD_BACKEND_SHI_ITE bool "SHI by ITE" depends on DT_HAS_ITE_IT8XXX2_SHI_ENABLED + select PINCTRL help This option enables the driver for SHI backend in the ITE IT8xxx2 chips family. From 4a3807789dee69e1ca7a2e36c3fd394af62c5c7c Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Fri, 11 Oct 2024 10:19:23 +0200 Subject: [PATCH 0807/4482] bluetooth: tester: Enable support for writable appearance This was affecting GAP/GAT/BV-06-C qualification test. Signed-off-by: Szymon Janc --- tests/bluetooth/tester/prj.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/bluetooth/tester/prj.conf b/tests/bluetooth/tester/prj.conf index ba5a40d078b1d..5b1a271653ce3 100644 --- a/tests/bluetooth/tester/prj.conf +++ b/tests/bluetooth/tester/prj.conf @@ -20,6 +20,8 @@ CONFIG_BT_DEVICE_NAME="Tester" CONFIG_BT_DEVICE_NAME_MAX=32 CONFIG_BT_DEVICE_NAME_DYNAMIC=y CONFIG_BT_DEVICE_NAME_GATT_WRITABLE=y +CONFIG_BT_DEVICE_APPEARANCE_DYNAMIC=y +CONFIG_BT_DEVICE_APPEARANCE_GATT_WRITABLE=y CONFIG_BT_EATT=y CONFIG_BT_L2CAP_ECRED=y CONFIG_BT_EATT_MAX=5 From 4f18d64b30940e8ebcd00a5f5e986861ddc73145 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Thu, 10 Oct 2024 01:40:14 +0200 Subject: [PATCH 0808/4482] drivers: stepper: api: introduce stepper_set_event_callback function - Refactor stepper_signal_result to stepper_event. - Introduce stepper_set_event_callback function - Deprecate k_poll_signal Signed-off-by: Jilay Pandya --- drivers/stepper/Kconfig | 23 ------- include/zephyr/drivers/stepper.h | 112 +++++++++++++++++++------------ 2 files changed, 70 insertions(+), 65 deletions(-) diff --git a/drivers/stepper/Kconfig b/drivers/stepper/Kconfig index f382265b518dd..bdfb63cfd6315 100644 --- a/drivers/stepper/Kconfig +++ b/drivers/stepper/Kconfig @@ -24,29 +24,6 @@ config STEPPER_SHELL help Enable stepper shell for testing. -config STEPPER_SHELL_ASYNC - bool "Asynchronous stepper shell" - depends on STEPPER_SHELL - select POLL - help - If enabled, the shell will run in asynchronous mode, spawning a thread - that polls the completion of stepper motor moves and prints a message - when all steps are completed. - -config STEPPER_SHELL_THREAD_STACK_SIZE - int "Stepper shell thread stack size" - default 1024 - depends on STEPPER_SHELL_ASYNC - help - The stack size for the stepper shell thread when asynchronous mode is enabled. - -config STEPPER_SHELL_THREAD_PRIORITY - int "Stepper shell thread priority" - default 7 - depends on STEPPER_SHELL_ASYNC - help - The priority for the stepper shell thread when asynchronous mode is enabled. - comment "Stepper Drivers" rsource "adi_tmc/Kconfig" diff --git a/include/zephyr/drivers/stepper.h b/include/zephyr/drivers/stepper.h index 958d21216a843..5ce2c835745af 100644 --- a/include/zephyr/drivers/stepper.h +++ b/include/zephyr/drivers/stepper.h @@ -33,9 +33,9 @@ extern "C" { /** * @brief Stepper Motor micro step resolution options */ -enum micro_step_resolution { +enum stepper_micro_step_resolution { /** Full step resolution */ - STEPPER_FULL_STEP = 1, + STEPPER_MICRO_STEP_1 = 1, /** 2 micro steps per full step */ STEPPER_MICRO_STEP_2 = 2, /** 4 micro steps per full step */ @@ -58,10 +58,10 @@ enum micro_step_resolution { * @brief Stepper Motor direction options */ enum stepper_direction { - /** Positive direction */ - STEPPER_DIRECTION_POSITIVE = 0, /** Negative direction */ - STEPPER_DIRECTION_NEGATIVE, + STEPPER_DIRECTION_NEGATIVE = 0, + /** Positive direction */ + STEPPER_DIRECTION_POSITIVE = 1, }; /** @@ -69,22 +69,25 @@ enum stepper_direction { */ enum stepper_run_mode { /** Hold Mode */ - STEPPER_HOLD_MODE = 0, + STEPPER_RUN_MODE_HOLD = 0, /** Position Mode*/ - STEPPER_POSITION_MODE, + STEPPER_RUN_MODE_POSITION = 1, /** Velocity Mode */ - STEPPER_VELOCITY_MODE, + STEPPER_RUN_MODE_VELOCITY = 2, }; /** - * @brief Stepper Motor signal results + * @brief Stepper Events */ -enum stepper_signal_result { +enum stepper_event { /** Steps set using move or set_target_position have been executed */ - STEPPER_SIGNAL_STEPS_COMPLETED = 0, - STEPPER_SIGNAL_SENSORLESS_STALL_DETECTED = 1, - STEPPER_SIGNAL_LEFT_END_STOP_DETECTED = 2, - STEPPER_SIGNAL_RIGHT_END_STOP_DETECTED = 3, + STEPPER_EVENT_STEPS_COMPLETED = 0, + /** Stall detected */ + STEPPER_EVENT_STALL_DETECTED = 1, + /** Left end switch status changes to pressed */ + STEPPER_EVENT_LEFT_END_STOP_DETECTED = 2, + /** Right end switch status changes to pressed */ + STEPPER_EVENT_RIGHT_END_STOP_DETECTED = 3, }; /** @@ -106,8 +109,7 @@ typedef int (*stepper_enable_t)(const struct device *dev, const bool enable); * * @see stepper_move() for details. */ -typedef int (*stepper_move_t)(const struct device *dev, const int32_t micro_steps, - struct k_poll_signal *async); +typedef int (*stepper_move_t)(const struct device *dev, const int32_t micro_steps); /** * @brief Set the max velocity in micro_steps per seconds. @@ -123,7 +125,7 @@ typedef int (*stepper_set_max_velocity_t)(const struct device *dev, * @see stepper_set_micro_step_res() for details. */ typedef int (*stepper_set_micro_step_res_t)(const struct device *dev, - const enum micro_step_resolution resolution); + const enum stepper_micro_step_resolution resolution); /** * @brief Get the micro-step resolution @@ -131,7 +133,7 @@ typedef int (*stepper_set_micro_step_res_t)(const struct device *dev, * @see stepper_get_micro_step_res() for details. */ typedef int (*stepper_get_micro_step_res_t)(const struct device *dev, - enum micro_step_resolution *resolution); + enum stepper_micro_step_resolution *resolution); /** * @brief Set the actual a.k.a reference position of the stepper * @@ -151,8 +153,7 @@ typedef int (*stepper_get_actual_position_t)(const struct device *dev, int32_t * * * @see stepper_set_target_position() for details. */ -typedef int (*stepper_set_target_position_t)(const struct device *dev, const int32_t value, - struct k_poll_signal *async); +typedef int (*stepper_set_target_position_t)(const struct device *dev, const int32_t value); /** * @brief Is the target position fo the stepper reached @@ -170,6 +171,19 @@ typedef int (*stepper_enable_constant_velocity_mode_t)(const struct device *dev, const enum stepper_direction direction, const uint32_t value); +/** + * @brief Callback function for stepper events + */ +typedef void (*stepper_event_callback_t)(const struct device *dev, const enum stepper_event event); + +/** + * @brief Set the callback function to be called when a stepper event occurs + * + * @see stepper_set_callback() for details. + */ +typedef int (*stepper_set_event_callback_t)(const struct device *dev, + stepper_event_callback_t callback, void *user_data); + /** * @brief Stepper Motor Controller API */ @@ -184,6 +198,7 @@ __subsystem struct stepper_driver_api { stepper_set_target_position_t set_target_position; stepper_is_moving_t is_moving; stepper_enable_constant_velocity_mode_t enable_constant_velocity_mode; + stepper_set_event_callback_t set_event_callback; }; /** @@ -213,23 +228,17 @@ static inline int z_impl_stepper_enable(const struct device *dev, const bool ena * * @param dev pointer to the stepper motor controller instance * @param micro_steps target micro_steps to be moved from the current position - * @param async Pointer to a valid and ready to be signaled struct - * k_poll_signal. (Note: if NULL this function will not notify - * the end of the transaction, and whether it went successfully - * or not). * * @retval -EIO General input / output error * @retval 0 Success */ -__syscall int stepper_move(const struct device *dev, int32_t micro_steps, - struct k_poll_signal *async); +__syscall int stepper_move(const struct device *dev, int32_t micro_steps); -static inline int z_impl_stepper_move(const struct device *dev, const int32_t micro_steps, - struct k_poll_signal *async) +static inline int z_impl_stepper_move(const struct device *dev, const int32_t micro_steps) { const struct stepper_driver_api *api = (const struct stepper_driver_api *)dev->api; - return api->move(dev, micro_steps, async); + return api->move(dev, micro_steps); } /** @@ -270,10 +279,10 @@ static inline int z_impl_stepper_set_max_velocity(const struct device *dev, * @retval 0 Success */ __syscall int stepper_set_micro_step_res(const struct device *dev, - enum micro_step_resolution resolution); + enum stepper_micro_step_resolution resolution); static inline int z_impl_stepper_set_micro_step_res(const struct device *dev, - enum micro_step_resolution resolution) + enum stepper_micro_step_resolution resolution) { const struct stepper_driver_api *api = (const struct stepper_driver_api *)dev->api; @@ -294,10 +303,10 @@ static inline int z_impl_stepper_set_micro_step_res(const struct device *dev, * @retval 0 Success */ __syscall int stepper_get_micro_step_res(const struct device *dev, - enum micro_step_resolution *resolution); + enum stepper_micro_step_resolution *resolution); static inline int z_impl_stepper_get_micro_step_res(const struct device *dev, - enum micro_step_resolution *resolution) + enum stepper_micro_step_resolution *resolution) { const struct stepper_driver_api *api = (const struct stepper_driver_api *)dev->api; @@ -356,27 +365,21 @@ static inline int z_impl_stepper_get_actual_position(const struct device *dev, i * * @param dev pointer to the stepper motor controller instance * @param value target position to set in micro_steps - * @param async Pointer to a valid and ready to be signaled struct - * k_poll_signal. If changing the target position - * triggers stepper movement, this can be used to await - * the end of the transaction. (Note: can be left NULL) * * @retval -EIO General input / output error * @retval -ENOSYS If not implemented by device driver * @retval 0 Success */ -__syscall int stepper_set_target_position(const struct device *dev, int32_t value, - struct k_poll_signal *async); +__syscall int stepper_set_target_position(const struct device *dev, int32_t value); -static inline int z_impl_stepper_set_target_position(const struct device *dev, const int32_t value, - struct k_poll_signal *async) +static inline int z_impl_stepper_set_target_position(const struct device *dev, const int32_t value) { const struct stepper_driver_api *api = (const struct stepper_driver_api *)dev->api; if (api->set_target_position == NULL) { return -ENOSYS; } - return api->set_target_position(dev, value, async); + return api->set_target_position(dev, value); } /** @@ -434,6 +437,31 @@ static inline int z_impl_stepper_enable_constant_velocity_mode( return api->enable_constant_velocity_mode(dev, direction, value); } +/** + * @brief Set the callback function to be called when a stepper event occurs + * + * @param dev pointer to the stepper motor controller instance + * @param callback Callback function to be called when a stepper event occurs + * passing NULL will disable the callback + * @param user_data User data to be passed to the callback function + * + * @retval -ENOSYS If not implemented by device driver + * @retval 0 Success + */ +__syscall int stepper_set_callback(const struct device *dev, stepper_event_callback_t callback, + void *user_data); + +static inline int z_impl_stepper_set_callback(const struct device *dev, + stepper_event_callback_t callback, void *user_data) +{ + const struct stepper_driver_api *api = (const struct stepper_driver_api *)dev->api; + + if (api->set_event_callback == NULL) { + return -ENOSYS; + } + return api->set_event_callback(dev, callback, user_data); +} + /** * @} */ From ecada895da2fef1cf1a825014b77ff52d464c441 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Thu, 10 Oct 2024 09:29:03 +0200 Subject: [PATCH 0809/4482] drivers: stepper: update drivers as per the api changes This commit deprecates passing of async signal in functions such as move and set_target_position. As per the new API, the async signal has to be set via set_async_signal. If RAMPSTAT_POLL is activated then enable_constant_velocity_mode would be able to raise signals like END_STOP_DETECTED & SENSORLESS_STALL_DETECTED. This commit also adjusts shell script in order to test these signals. Signed-off-by: Jilay Pandya --- drivers/stepper/Kconfig.gpio | 1 - drivers/stepper/adi_tmc/Kconfig | 1 - .../adi_tmc/adi_tmc5041_stepper_controller.c | 85 ++++++----- drivers/stepper/fake_stepper_controller.c | 20 +-- drivers/stepper/gpio_stepper_controller.c | 55 ++++---- drivers/stepper/stepper_shell.c | 132 ++++++------------ include/zephyr/drivers/stepper/stepper_fake.h | 14 +- 7 files changed, 132 insertions(+), 176 deletions(-) diff --git a/drivers/stepper/Kconfig.gpio b/drivers/stepper/Kconfig.gpio index 7908843a6018c..eae1f8d1ca46a 100644 --- a/drivers/stepper/Kconfig.gpio +++ b/drivers/stepper/Kconfig.gpio @@ -6,7 +6,6 @@ menu "GPIO stepper driver" config GPIO_STEPPER bool "Activate driver for gpio stepper control" depends on DT_HAS_GPIO_STEPPERS_ENABLED - select POLL default y help GPIO Stepper driver for stepper motor control with darlington arrays or dual H-bridge. diff --git a/drivers/stepper/adi_tmc/Kconfig b/drivers/stepper/adi_tmc/Kconfig index b787b6e1af396..7a88ec598fe17 100644 --- a/drivers/stepper/adi_tmc/Kconfig +++ b/drivers/stepper/adi_tmc/Kconfig @@ -37,7 +37,6 @@ config STEPPER_ADI_TMC5041 config STEPPER_ADI_TMC5041_RAMPSTAT_POLL bool "TMC5041 poll ramp status" depends on STEPPER_ADI_TMC5041 - select POLL default y help When enabled, the ramp status will be polled on TMC5041, to check for events: diff --git a/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c b/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c index 8c7b05492a80a..2967fe4dfc962 100644 --- a/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c +++ b/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c @@ -5,7 +5,7 @@ #define DT_DRV_COMPAT adi_tmc5041 -#include "stdlib.h" +#include #include #include @@ -35,7 +35,8 @@ struct tmc5041_stepper_data { #endif /* device pointer required to access config in k_work */ const struct device *stepper; - struct k_poll_signal *async_signal; + stepper_event_callback_t callback; + void *event_cb_user_data; }; struct tmc5041_stepper_config { @@ -103,18 +104,14 @@ static void calculate_velocity_from_hz_to_fclk(const struct device *dev, const u velocity_hz, *velocity_fclk); } -static void set_async_signal(const struct device *dev, struct k_poll_signal *async) +static int tmc5041_stepper_set_event_callback(const struct device *dev, + stepper_event_callback_t callback, void *user_data) { struct tmc5041_stepper_data *data = dev->data; - if (!async) { - return; - } - - if (data->async_signal) { - k_poll_signal_reset(data->async_signal); - } - data->async_signal = async; + data->callback = callback; + data->event_cb_user_data = user_data; + return 0; } static int stallguard_enable(const struct device *dev, const bool enable) @@ -180,19 +177,15 @@ static void stallguard_work_handler(struct k_work *work) #ifdef CONFIG_STEPPER_ADI_TMC5041_RAMPSTAT_POLL -static void emit_signal(struct k_poll_signal *async_signal, const enum stepper_signal_result signal) +static void execute_callback(const struct device *dev, const enum stepper_event event) { - int err; + struct tmc5041_stepper_data *data = dev->data; - if (!async_signal) { - LOG_WRN("Async signal is NULL"); + if (!data->callback) { + LOG_WRN_ONCE("No callback registered"); return; } - - err = k_poll_signal_raise(async_signal, signal); - if (err != 0) { - LOG_ERR("Failed to raise signal %d error %d", signal, err); - } + data->callback(dev, event); } static void rampstat_work_handler(struct k_work *work) @@ -237,26 +230,25 @@ static void rampstat_work_handler(struct k_work *work) case TMC5041_STOP_LEFT_EVENT: LOG_DBG("RAMPSTAT %s:Left end-stop detected", stepper_data->stepper->name); - emit_signal(stepper_data->async_signal, - STEPPER_SIGNAL_LEFT_END_STOP_DETECTED); + execute_callback(stepper_data->stepper, + STEPPER_EVENT_LEFT_END_STOP_DETECTED); break; case TMC5041_STOP_RIGHT_EVENT: LOG_DBG("RAMPSTAT %s:Right end-stop detected", stepper_data->stepper->name); - emit_signal(stepper_data->async_signal, - STEPPER_SIGNAL_RIGHT_END_STOP_DETECTED); + execute_callback(stepper_data->stepper, + STEPPER_EVENT_RIGHT_END_STOP_DETECTED); break; case TMC5041_POS_REACHED_EVENT: LOG_DBG("RAMPSTAT %s:Position reached", stepper_data->stepper->name); - emit_signal(stepper_data->async_signal, STEPPER_SIGNAL_STEPS_COMPLETED); + execute_callback(stepper_data->stepper, STEPPER_EVENT_STEPS_COMPLETED); break; case TMC5041_STOP_SG_EVENT: LOG_DBG("RAMPSTAT %s:Stall detected", stepper_data->stepper->name); stallguard_enable(stepper_data->stepper, false); - emit_signal(stepper_data->async_signal, - STEPPER_SIGNAL_SENSORLESS_STALL_DETECTED); + execute_callback(stepper_data->stepper, STEPPER_EVENT_STALL_DETECTED); break; default: LOG_ERR("Illegal ramp stat bit field"); @@ -314,15 +306,12 @@ static int tmc5041_stepper_is_moving(const struct device *dev, bool *is_moving) return 0; } -static int tmc5041_stepper_move(const struct device *dev, const int32_t steps, - struct k_poll_signal *async) +static int tmc5041_stepper_move(const struct device *dev, const int32_t steps) { const struct tmc5041_stepper_config *config = dev->config; struct tmc5041_stepper_data *data = dev->data; int err; - set_async_signal(dev, async); - if (config->is_sg_enabled) { err = stallguard_enable(dev, false); if (err != 0) { @@ -355,8 +344,11 @@ static int tmc5041_stepper_move(const struct device *dev, const int32_t steps, K_MSEC(config->sg_velocity_check_interval_ms)); } #ifdef CONFIG_STEPPER_ADI_TMC5041_RAMPSTAT_POLL - k_work_reschedule(&data->rampstat_callback_dwork, - K_MSEC(CONFIG_STEPPER_ADI_TMC5041_RAMPSTAT_POLL_INTERVAL_IN_MSEC)); + if (data->callback) { + k_work_reschedule( + &data->rampstat_callback_dwork, + K_MSEC(CONFIG_STEPPER_ADI_TMC5041_RAMPSTAT_POLL_INTERVAL_IN_MSEC)); + } #endif return 0; } @@ -377,7 +369,7 @@ static int tmc5041_stepper_set_max_velocity(const struct device *dev, uint32_t v } static int tmc5041_stepper_set_micro_step_res(const struct device *dev, - enum micro_step_resolution res) + enum stepper_micro_step_resolution res) { const struct tmc5041_stepper_config *config = dev->config; uint32_t reg_value; @@ -403,7 +395,7 @@ static int tmc5041_stepper_set_micro_step_res(const struct device *dev, } static int tmc5041_stepper_get_micro_step_res(const struct device *dev, - enum micro_step_resolution *res) + enum stepper_micro_step_resolution *res) { const struct tmc5041_stepper_config *config = dev->config; uint32_t reg_value; @@ -452,16 +444,13 @@ static int tmc5041_stepper_get_actual_position(const struct device *dev, int32_t return 0; } -static int tmc5041_stepper_set_target_position(const struct device *dev, const int32_t position, - struct k_poll_signal *async) +static int tmc5041_stepper_set_target_position(const struct device *dev, const int32_t position) { LOG_DBG("Stepper motor controller %s set target position to %d", dev->name, position); const struct tmc5041_stepper_config *config = dev->config; struct tmc5041_stepper_data *data = dev->data; int err; - set_async_signal(dev, async); - if (config->is_sg_enabled) { stallguard_enable(dev, false); } @@ -478,8 +467,11 @@ static int tmc5041_stepper_set_target_position(const struct device *dev, const i K_MSEC(config->sg_velocity_check_interval_ms)); } #ifdef CONFIG_STEPPER_ADI_TMC5041_RAMPSTAT_POLL - k_work_reschedule(&data->rampstat_callback_dwork, - K_MSEC(CONFIG_STEPPER_ADI_TMC5041_RAMPSTAT_POLL_INTERVAL_IN_MSEC)); + if (data->callback) { + k_work_reschedule( + &data->rampstat_callback_dwork, + K_MSEC(CONFIG_STEPPER_ADI_TMC5041_RAMPSTAT_POLL_INTERVAL_IN_MSEC)); + } #endif return 0; } @@ -533,6 +525,13 @@ static int tmc5041_stepper_enable_constant_velocity_mode(const struct device *de k_work_reschedule(&data->stallguard_dwork, K_MSEC(config->sg_velocity_check_interval_ms)); } +#ifdef CONFIG_STEPPER_ADI_TMC5041_RAMPSTAT_POLL + if (data->callback) { + k_work_reschedule( + &data->rampstat_callback_dwork, + K_MSEC(CONFIG_STEPPER_ADI_TMC5041_RAMPSTAT_POLL_INTERVAL_IN_MSEC)); + } +#endif return 0; } @@ -730,7 +729,7 @@ static int tmc5041_stepper_init(const struct device *dev) .get_actual_position = tmc5041_stepper_get_actual_position, \ .set_target_position = tmc5041_stepper_set_target_position, \ .enable_constant_velocity_mode = tmc5041_stepper_enable_constant_velocity_mode, \ - }; + .set_event_callback = tmc5041_stepper_set_event_callback, }; #define TMC5041_STEPPER_DEFINE(child) \ DEVICE_DT_DEFINE(child, tmc5041_stepper_init, NULL, &tmc5041_stepper_data_##child, \ @@ -744,7 +743,7 @@ static int tmc5041_stepper_init(const struct device *dev) static struct tmc5041_data tmc5041_data_##inst; \ static const struct tmc5041_config tmc5041_config_##inst = { \ .gconf = ( \ - (DT_INST_PROP(inst, poscmp_enable) << TMC5041_GCONF_POSCMP_ENABLE_SHIFT) |\ + (DT_INST_PROP(inst, poscmp_enable) << TMC5041_GCONF_POSCMP_ENABLE_SHIFT) | \ (DT_INST_PROP(inst, test_mode) << TMC5041_GCONF_TEST_MODE_SHIFT) | \ DT_INST_FOREACH_CHILD(inst, TMC5041_SHAFT_CONFIG) \ (DT_INST_PROP(inst, lock_gconf) << TMC5041_LOCK_GCONF_SHIFT)), \ diff --git a/drivers/stepper/fake_stepper_controller.c b/drivers/stepper/fake_stepper_controller.c index 8c0f2a3ff2d76..b469cf67a2d12 100644 --- a/drivers/stepper/fake_stepper_controller.c +++ b/drivers/stepper/fake_stepper_controller.c @@ -15,7 +15,7 @@ #define DT_DRV_COMPAT zephyr_fake_stepper struct fake_stepper_data { - enum micro_step_resolution micro_step_res; + enum stepper_micro_step_resolution micro_step_res; int32_t actual_position; }; @@ -23,29 +23,30 @@ DEFINE_FAKE_VALUE_FUNC(int, fake_stepper_enable, const struct device *, const bo DEFINE_FAKE_VALUE_FUNC(int, fake_stepper_is_moving, const struct device *, bool *); -DEFINE_FAKE_VALUE_FUNC(int, fake_stepper_move, const struct device *, const int32_t, - struct k_poll_signal *); +DEFINE_FAKE_VALUE_FUNC(int, fake_stepper_move, const struct device *, const int32_t); DEFINE_FAKE_VALUE_FUNC(int, fake_stepper_set_max_velocity, const struct device *, const uint32_t); DEFINE_FAKE_VALUE_FUNC(int, fake_stepper_set_micro_step_res, const struct device *, - const enum micro_step_resolution); + const enum stepper_micro_step_resolution); DEFINE_FAKE_VALUE_FUNC(int, fake_stepper_get_micro_step_res, const struct device *, - enum micro_step_resolution *); + enum stepper_micro_step_resolution *); DEFINE_FAKE_VALUE_FUNC(int, fake_stepper_set_actual_position, const struct device *, const int32_t); DEFINE_FAKE_VALUE_FUNC(int, fake_stepper_get_actual_position, const struct device *, int32_t *); -DEFINE_FAKE_VALUE_FUNC(int, fake_stepper_set_target_position, const struct device *, const int32_t, - struct k_poll_signal *); +DEFINE_FAKE_VALUE_FUNC(int, fake_stepper_set_target_position, const struct device *, const int32_t); DEFINE_FAKE_VALUE_FUNC(int, fake_stepper_enable_constant_velocity_mode, const struct device *, const enum stepper_direction, const uint32_t); +DEFINE_FAKE_VALUE_FUNC(int, fake_stepper_set_event_callback, const struct device *, + stepper_event_callback_t, void *); + static int fake_stepper_set_micro_step_res_delegate(const struct device *dev, - const enum micro_step_resolution res) + const enum stepper_micro_step_resolution res) { struct fake_stepper_data *data = dev->data; @@ -55,7 +56,7 @@ static int fake_stepper_set_micro_step_res_delegate(const struct device *dev, } static int fake_stepper_get_micro_step_res_delegate(const struct device *dev, - enum micro_step_resolution *res) + enum stepper_micro_step_resolution *res) { struct fake_stepper_data *data = dev->data; @@ -134,6 +135,7 @@ static const struct stepper_driver_api fake_stepper_driver_api = { .get_actual_position = fake_stepper_get_actual_position, .set_target_position = fake_stepper_set_target_position, .enable_constant_velocity_mode = fake_stepper_enable_constant_velocity_mode, + .set_event_callback = fake_stepper_set_event_callback, }; #define FAKE_STEPPER_INIT(inst) \ diff --git a/drivers/stepper/gpio_stepper_controller.c b/drivers/stepper/gpio_stepper_controller.c index c88f945506e88..a26f9c0a8a788 100644 --- a/drivers/stepper/gpio_stepper_controller.c +++ b/drivers/stepper/gpio_stepper_controller.c @@ -34,10 +34,11 @@ struct gpio_stepper_data { uint8_t step_gap; uint8_t coil_charge; struct k_work_delayable stepper_dwork; - struct k_poll_signal *async_signal; + stepper_event_callback_t callback; int32_t actual_position; uint32_t delay_in_us; int32_t step_count; + void *event_cb_user_data; }; static int stepper_motor_set_coil_charge(const struct device *dev) @@ -79,10 +80,11 @@ static void update_remaining_steps(struct gpio_stepper_data *data) data->step_count++; (void)k_work_reschedule(&data->stepper_dwork, K_USEC(data->delay_in_us)); } else { - if (data->async_signal) { - (void)k_poll_signal_raise(data->async_signal, - STEPPER_SIGNAL_STEPS_COMPLETED); + if (!data->callback) { + LOG_WRN_ONCE("No callback set"); + return; } + data->callback(data->dev, STEPPER_EVENT_STEPS_COMPLETED); } } @@ -125,10 +127,10 @@ static void stepper_work_step_handler(struct k_work *work) K_SPINLOCK(&data->lock) { switch (data->run_mode) { - case STEPPER_POSITION_MODE: + case STEPPER_RUN_MODE_POSITION: position_mode_task(data->dev); break; - case STEPPER_VELOCITY_MODE: + case STEPPER_RUN_MODE_VELOCITY: velocity_mode_task(data->dev); break; default: @@ -138,8 +140,7 @@ static void stepper_work_step_handler(struct k_work *work) } } -static int gpio_stepper_move(const struct device *dev, int32_t micro_steps, - struct k_poll_signal *async) +static int gpio_stepper_move(const struct device *dev, int32_t micro_steps) { struct gpio_stepper_data *data = dev->data; @@ -148,11 +149,7 @@ static int gpio_stepper_move(const struct device *dev, int32_t micro_steps, return -EINVAL; } K_SPINLOCK(&data->lock) { - if (data->async_signal) { - k_poll_signal_reset(data->async_signal); - } - data->async_signal = async; - data->run_mode = STEPPER_POSITION_MODE; + data->run_mode = STEPPER_RUN_MODE_POSITION; data->step_count = micro_steps; update_direction_from_step_count(data); (void)k_work_reschedule(&data->stepper_dwork, K_NO_WAIT); @@ -180,8 +177,7 @@ static int gpio_stepper_get_actual_position(const struct device *dev, int32_t *p return 0; } -static int gpio_stepper_set_target_position(const struct device *dev, int32_t position, - struct k_poll_signal *async) +static int gpio_stepper_set_target_position(const struct device *dev, int32_t position) { struct gpio_stepper_data *data = dev->data; @@ -190,11 +186,7 @@ static int gpio_stepper_set_target_position(const struct device *dev, int32_t po return -EINVAL; } K_SPINLOCK(&data->lock) { - if (data->async_signal) { - k_poll_signal_reset(data->async_signal); - } - data->async_signal = async; - data->run_mode = STEPPER_POSITION_MODE; + data->run_mode = STEPPER_RUN_MODE_POSITION; data->step_count = position - data->actual_position; update_direction_from_step_count(data); (void)k_work_reschedule(&data->stepper_dwork, K_NO_WAIT); @@ -239,7 +231,7 @@ static int gpio_stepper_enable_constant_velocity_mode(const struct device *dev, struct gpio_stepper_data *data = dev->data; K_SPINLOCK(&data->lock) { - data->run_mode = STEPPER_VELOCITY_MODE; + data->run_mode = STEPPER_RUN_MODE_VELOCITY; data->direction = direction; if (value != 0) { data->delay_in_us = USEC_PER_SEC / value; @@ -252,13 +244,13 @@ static int gpio_stepper_enable_constant_velocity_mode(const struct device *dev, } static int gpio_stepper_set_micro_step_res(const struct device *dev, - enum micro_step_resolution micro_step_res) + enum stepper_micro_step_resolution micro_step_res) { struct gpio_stepper_data *data = dev->data; K_SPINLOCK(&data->lock) { switch (micro_step_res) { - case STEPPER_FULL_STEP: + case STEPPER_MICRO_STEP_1: case STEPPER_MICRO_STEP_2: data->step_gap = MAX_MICRO_STEP_RES >> (micro_step_res - 1); break; @@ -271,13 +263,25 @@ static int gpio_stepper_set_micro_step_res(const struct device *dev, } static int gpio_stepper_get_micro_step_res(const struct device *dev, - enum micro_step_resolution *micro_step_res) + enum stepper_micro_step_resolution *micro_step_res) { struct gpio_stepper_data *data = dev->data; *micro_step_res = MAX_MICRO_STEP_RES >> (data->step_gap - 1); return 0; } +static int gpio_stepper_set_event_callback(const struct device *dev, + stepper_event_callback_t callback, void *user_data) +{ + struct gpio_stepper_data *data = dev->data; + + K_SPINLOCK(&data->lock) { + data->callback = callback; + } + data->event_cb_user_data = user_data; + return 0; +} + static int gpio_stepper_enable(const struct device *dev, bool enable) { struct gpio_stepper_data *data = dev->data; @@ -335,7 +339,8 @@ static int gpio_stepper_motor_controller_init(const struct device *dev) .set_max_velocity = gpio_stepper_set_max_velocity, \ .enable_constant_velocity_mode = gpio_stepper_enable_constant_velocity_mode, \ .set_micro_step_res = gpio_stepper_set_micro_step_res, \ - .get_micro_step_res = gpio_stepper_get_micro_step_res}; + .get_micro_step_res = gpio_stepper_get_micro_step_res, \ + .set_event_callback = gpio_stepper_set_event_callback, }; #define GPIO_STEPPER_DEVICE_DEFINE(child) \ DEVICE_DT_DEFINE(child, gpio_stepper_motor_controller_init, NULL, \ diff --git a/drivers/stepper/stepper_shell.c b/drivers/stepper/stepper_shell.c index f761a26f8314d..05c5bd83c33f9 100644 --- a/drivers/stepper/stepper_shell.c +++ b/drivers/stepper/stepper_shell.c @@ -8,7 +8,6 @@ #include #include #include -#include #include LOG_MODULE_REGISTER(stepper_shell, CONFIG_STEPPER_LOG_LEVEL); @@ -21,7 +20,7 @@ enum { struct stepper_microstep_map { const char *name; - enum micro_step_resolution microstep; + enum stepper_micro_step_resolution microstep; }; struct stepper_direction_map { @@ -41,18 +40,26 @@ struct stepper_direction_map { .microstep = _microstep, \ } -#ifdef CONFIG_STEPPER_SHELL_ASYNC - -static struct k_poll_signal stepper_signal; -static struct k_poll_event stepper_poll_event = - K_POLL_EVENT_INITIALIZER(K_POLL_TYPE_SIGNAL, K_POLL_MODE_NOTIFY_ONLY, &stepper_signal); - -static bool poll_thread_started; -K_THREAD_STACK_DEFINE(poll_thread_stack, CONFIG_STEPPER_SHELL_THREAD_STACK_SIZE); -static struct k_thread poll_thread; -static int start_polling(const struct shell *sh); - -#endif /* CONFIG_STEPPER_SHELL_ASYNC */ +static void print_callback(const struct device *dev, const enum stepper_event event) +{ + switch (event) { + case STEPPER_EVENT_STEPS_COMPLETED: + LOG_INF("%s: Steps completed.", dev->name); + break; + case STEPPER_EVENT_STALL_DETECTED: + LOG_INF("%s: Stall detected.", dev->name); + break; + case STEPPER_EVENT_LEFT_END_STOP_DETECTED: + LOG_INF("%s: Left limit switch pressed.", dev->name); + break; + case STEPPER_EVENT_RIGHT_END_STOP_DETECTED: + LOG_INF("%s: Right limit switch pressed.", dev->name); + break; + default: + LOG_INF("%s: Unknown signal received.", dev->name); + break; + } +} static const struct stepper_direction_map stepper_direction_map[] = { STEPPER_DIRECTION_MAP_ENTRY("positive", STEPPER_DIRECTION_POSITIVE), @@ -60,7 +67,7 @@ static const struct stepper_direction_map stepper_direction_map[] = { }; static const struct stepper_microstep_map stepper_microstep_map[] = { - STEPPER_MICROSTEP_MAP("1", STEPPER_FULL_STEP), + STEPPER_MICROSTEP_MAP("1", STEPPER_MICRO_STEP_1), STEPPER_MICROSTEP_MAP("2", STEPPER_MICRO_STEP_2), STEPPER_MICROSTEP_MAP("4", STEPPER_MICRO_STEP_4), STEPPER_MICROSTEP_MAP("8", STEPPER_MICRO_STEP_8), @@ -181,8 +188,7 @@ static int cmd_stepper_move(const struct shell *sh, size_t argc, char **argv) { const struct device *dev; int err = 0; - struct k_poll_signal *poll_signal = - COND_CODE_1(CONFIG_STEPPER_SHELL_ASYNC, (&stepper_signal), (NULL)); + int32_t micro_steps = shell_strtol(argv[ARG_IDX_PARAM], 10, &err); if (err < 0) { @@ -194,11 +200,12 @@ static int cmd_stepper_move(const struct shell *sh, size_t argc, char **argv) return err; } -#ifdef CONFIG_STEPPER_SHELL_ASYNC - start_polling(sh); -#endif /* CONFIG_STEPPER_SHELL_ASYNC */ + err = stepper_set_callback(dev, print_callback, NULL); + if (err != 0) { + shell_error(sh, "Failed to set callback: %d", err); + } - err = stepper_move(dev, micro_steps, poll_signal); + err = stepper_move(dev, micro_steps); if (err) { shell_error(sh, "Error: %d", err); } @@ -232,7 +239,7 @@ static int cmd_stepper_set_max_velocity(const struct shell *sh, size_t argc, cha static int cmd_stepper_set_micro_step_res(const struct shell *sh, size_t argc, char **argv) { const struct device *dev; - enum micro_step_resolution resolution; + enum stepper_micro_step_resolution resolution; int err = -EINVAL; for (int i = 0; i < ARRAY_SIZE(stepper_microstep_map); i++) { @@ -264,7 +271,7 @@ static int cmd_stepper_get_micro_step_res(const struct shell *sh, size_t argc, c { const struct device *dev; int err; - enum micro_step_resolution micro_step_res; + enum stepper_micro_step_resolution micro_step_res; err = parse_device_arg(sh, argv, &dev); if (err < 0) { @@ -335,19 +342,17 @@ static int cmd_stepper_set_target_position(const struct shell *sh, size_t argc, return err; } - struct k_poll_signal *poll_signal = - COND_CODE_1(CONFIG_STEPPER_SHELL_ASYNC, (&stepper_signal), (NULL)); - err = parse_device_arg(sh, argv, &dev); if (err < 0) { return err; } -#ifdef CONFIG_STEPPER_SHELL_ASYNC - start_polling(sh); -#endif /* CONFIG_STEPPER_SHELL_ASYNC */ + err = stepper_set_callback(dev, print_callback, NULL); + if (err != 0) { + shell_error(sh, "Failed to set callback: %d", err); + } - err = stepper_set_target_position(dev, position, poll_signal); + err = stepper_set_target_position(dev, position); if (err) { shell_error(sh, "Error: %d", err); } @@ -385,6 +390,11 @@ static int cmd_stepper_enable_constant_velocity_mode(const struct shell *sh, siz return err; } + err = stepper_set_callback(dev, print_callback, NULL); + if (err != 0) { + shell_error(sh, "Failed to set callback: %d", err); + } + err = stepper_enable_constant_velocity_mode(dev, direction, velocity); if (err) { shell_error(sh, "Error: %d", err); @@ -400,7 +410,7 @@ static int cmd_stepper_info(const struct shell *sh, size_t argc, char **argv) int err; bool is_moving; int32_t actual_position; - enum micro_step_resolution micro_step_res; + enum stepper_micro_step_resolution micro_step_res; err = parse_device_arg(sh, argv, &dev); if (err < 0) { @@ -434,66 +444,6 @@ static int cmd_stepper_info(const struct shell *sh, size_t argc, char **argv) return 0; } -#ifdef CONFIG_STEPPER_SHELL_ASYNC - -static void stepper_poll_thread(void *p1, void *p2, void *p3) -{ - ARG_UNUSED(p2); - ARG_UNUSED(p3); - const struct shell *sh = p1; - - while (1) { - k_poll(&stepper_poll_event, 1, K_FOREVER); - - switch (stepper_poll_event.signal->result) { - case STEPPER_SIGNAL_STEPS_COMPLETED: - shell_fprintf_info(sh, "Stepper: All steps completed.\n"); - break; - case STEPPER_SIGNAL_SENSORLESS_STALL_DETECTED: - shell_fprintf_info(sh, "Stepper: Sensorless stall detected.\n"); - break; - case STEPPER_SIGNAL_LEFT_END_STOP_DETECTED: - shell_fprintf_info(sh, "Stepper: Left limit switch pressed.\n"); - break; - case STEPPER_SIGNAL_RIGHT_END_STOP_DETECTED: - shell_fprintf_normal(sh, "Stepper: Right limit switch pressed.\n"); - break; - default: - shell_fprintf_error(sh, "Stepper: Unknown signal received.\n"); - break; - } - - k_poll_signal_reset(&stepper_signal); - - } -} - -static int start_polling(const struct shell *sh) -{ - k_tid_t tid; - - if (poll_thread_started) { - return 0; - } - - k_poll_signal_init(&stepper_signal); - tid = k_thread_create(&poll_thread, poll_thread_stack, - K_KERNEL_STACK_SIZEOF(poll_thread_stack), stepper_poll_thread, - (void *)sh, NULL, NULL, CONFIG_STEPPER_SHELL_THREAD_PRIORITY, 0, - K_NO_WAIT); - if (!tid) { - shell_error(sh, "Cannot start poll thread"); - return -ENOEXEC; - } - - k_thread_name_set(tid, "stepper_shell"); - k_thread_start(tid); - poll_thread_started = true; - return 0; -} - -#endif /* CONFIG_STEPPER_SHELL_ASYNC */ - SHELL_STATIC_SUBCMD_SET_CREATE( stepper_cmds, SHELL_CMD_ARG(enable, &dsub_pos_stepper_motor_name, " ", cmd_stepper_enable, diff --git a/include/zephyr/drivers/stepper/stepper_fake.h b/include/zephyr/drivers/stepper/stepper_fake.h index d329d6ee38850..52e18f71d9563 100644 --- a/include/zephyr/drivers/stepper/stepper_fake.h +++ b/include/zephyr/drivers/stepper/stepper_fake.h @@ -16,30 +16,32 @@ extern "C" { DECLARE_FAKE_VALUE_FUNC(int, fake_stepper_enable, const struct device *, const bool); -DECLARE_FAKE_VALUE_FUNC(int, fake_stepper_move, const struct device *, const int32_t, - struct k_poll_signal *); +DECLARE_FAKE_VALUE_FUNC(int, fake_stepper_move, const struct device *, const int32_t); DECLARE_FAKE_VALUE_FUNC(int, fake_stepper_set_max_velocity, const struct device *, const uint32_t); DECLARE_FAKE_VALUE_FUNC(int, fake_stepper_set_micro_step_res, const struct device *, - const enum micro_step_resolution); + const enum stepper_micro_step_resolution); DECLARE_FAKE_VALUE_FUNC(int, fake_stepper_get_micro_step_res, const struct device *, - enum micro_step_resolution *); + enum stepper_micro_step_resolution *); DECLARE_FAKE_VALUE_FUNC(int, fake_stepper_set_actual_position, const struct device *, const int32_t); DECLARE_FAKE_VALUE_FUNC(int, fake_stepper_get_actual_position, const struct device *, int32_t *); -DECLARE_FAKE_VALUE_FUNC(int, fake_stepper_set_target_position, const struct device *, const int32_t, - struct k_poll_signal *); +DECLARE_FAKE_VALUE_FUNC(int, fake_stepper_set_target_position, const struct device *, + const int32_t); DECLARE_FAKE_VALUE_FUNC(int, fake_stepper_is_moving, const struct device *, bool *); DECLARE_FAKE_VALUE_FUNC(int, fake_stepper_enable_constant_velocity_mode, const struct device *, const enum stepper_direction, const uint32_t); +DECLARE_FAKE_VALUE_FUNC(int, fake_stepper_set_event_callback, const struct device *, + stepper_event_callback_t, void *); + #ifdef __cplusplus } #endif From abf5520a199c13c75da22ce78e0f6732320d3236 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Thu, 10 Oct 2024 19:43:52 +0200 Subject: [PATCH 0810/4482] test: drivers: stepper: adjust tests as per the new api This commit adjusts the tests as per the updated stepper api. Signed-off-by: Jilay Pandya --- tests/drivers/stepper/shell/src/main.c | 12 ----- tests/drivers/stepper/shell/testcase.yaml | 2 - tests/drivers/stepper/stepper_api/prj.conf | 1 + tests/drivers/stepper/stepper_api/src/main.c | 46 +++++++++++++++----- 4 files changed, 36 insertions(+), 25 deletions(-) diff --git a/tests/drivers/stepper/shell/src/main.c b/tests/drivers/stepper/shell/src/main.c index c83595a43f617..1f7cb72ff9c1f 100644 --- a/tests/drivers/stepper/shell/src/main.c +++ b/tests/drivers/stepper/shell/src/main.c @@ -62,11 +62,6 @@ ZTEST(stepper_shell, test_stepper_move) ASSERT_STEPPER_FUNC_CALLED(fake_stepper_move_fake, err); zassert_equal(fake_stepper_move_fake.arg1_val, 1000, "wrong microsteps value"); -#ifdef CONFIG_STEPPER_SHELL_ASYNC - zassert_not_null(fake_stepper_move_fake.arg2_val, "async poll signal not be null"); -#else - zassert_is_null(fake_stepper_move_fake.arg2_val, "async poll signal is null"); -#endif /* CONFIG_STEPPER_SHELL_ASYNC */ } ZTEST(stepper_shell, test_stepper_set_max_velocity) @@ -130,13 +125,6 @@ ZTEST(stepper_shell, test_stepper_set_target_position) ASSERT_STEPPER_FUNC_CALLED(fake_stepper_set_target_position_fake, err); zassert_equal(fake_stepper_set_target_position_fake.arg1_val, 200, "wrong target position value"); -#ifdef CONFIG_STEPPER_SHELL_ASYNC - zassert_not_null(fake_stepper_set_target_position_fake.arg2_val, - "async poll signal not be null"); -#else - zassert_is_null(fake_stepper_set_target_position_fake.arg2_val, - "async poll signal is null"); -#endif /* CONFIG_STEPPER_SHELL_ASYNC */ } ZTEST(stepper_shell, test_stepper_enable_constant_velocity_mode) diff --git a/tests/drivers/stepper/shell/testcase.yaml b/tests/drivers/stepper/shell/testcase.yaml index b3a3193ee7ba1..6b27b6b94772e 100644 --- a/tests/drivers/stepper/shell/testcase.yaml +++ b/tests/drivers/stepper/shell/testcase.yaml @@ -13,5 +13,3 @@ tests: integration_platforms: - native_sim - native_sim/native/64 - extra_configs: - - CONFIG_STEPPER_SHELL_ASYNC=y diff --git a/tests/drivers/stepper/stepper_api/prj.conf b/tests/drivers/stepper/stepper_api/prj.conf index c8dfc194d9280..fc4240bf03703 100644 --- a/tests/drivers/stepper/stepper_api/prj.conf +++ b/tests/drivers/stepper/stepper_api/prj.conf @@ -7,3 +7,4 @@ CONFIG_TEST_USERSPACE=y CONFIG_LOG=y CONFIG_STEPPER_LOG_LEVEL_DBG=y CONFIG_STEPPER=y +CONFIG_POLL=y diff --git a/tests/drivers/stepper/stepper_api/src/main.c b/tests/drivers/stepper/stepper_api/src/main.c index a228b25c7dc47..b9daa13cff657 100644 --- a/tests/drivers/stepper/stepper_api/src/main.c +++ b/tests/drivers/stepper/stepper_api/src/main.c @@ -9,19 +9,42 @@ struct stepper_fixture { const struct device *dev; - struct k_poll_signal signal; - struct k_poll_event event; + stepper_event_callback_t callback; }; +struct k_poll_signal stepper_signal; +struct k_poll_event stepper_event; + +static void stepper_print_event_callback(const struct device *dev, enum stepper_event event) +{ + switch (event) { + case STEPPER_EVENT_STEPS_COMPLETED: + k_poll_signal_raise(&stepper_signal, STEPPER_EVENT_STEPS_COMPLETED); + break; + case STEPPER_EVENT_LEFT_END_STOP_DETECTED: + k_poll_signal_raise(&stepper_signal, STEPPER_EVENT_LEFT_END_STOP_DETECTED); + break; + case STEPPER_EVENT_RIGHT_END_STOP_DETECTED: + k_poll_signal_raise(&stepper_signal, STEPPER_EVENT_RIGHT_END_STOP_DETECTED); + break; + case STEPPER_EVENT_STALL_DETECTED: + k_poll_signal_raise(&stepper_signal, STEPPER_EVENT_STALL_DETECTED); + break; + default: + break; + } +} + static void *stepper_setup(void) { static struct stepper_fixture fixture = { .dev = DEVICE_DT_GET(DT_NODELABEL(motor_1)), + .callback = stepper_print_event_callback, }; - k_poll_signal_init(&fixture.signal); - k_poll_event_init(&fixture.event, K_POLL_TYPE_SIGNAL, K_POLL_MODE_NOTIFY_ONLY, - &fixture.signal); + k_poll_signal_init(&stepper_signal); + k_poll_event_init(&stepper_event, K_POLL_TYPE_SIGNAL, K_POLL_MODE_NOTIFY_ONLY, + &stepper_signal); zassert_not_null(fixture.dev); return &fixture; @@ -31,7 +54,7 @@ static void stepper_before(void *f) { struct stepper_fixture *fixture = f; (void)stepper_set_actual_position(fixture->dev, 0); - k_poll_signal_reset(&fixture->signal); + k_poll_signal_reset(&stepper_signal); } ZTEST_SUITE(stepper, NULL, stepper_setup, stepper_before, NULL, NULL); @@ -39,7 +62,7 @@ ZTEST_SUITE(stepper, NULL, stepper_setup, stepper_before, NULL, NULL); ZTEST_F(stepper, test_micro_step_res) { (void)stepper_set_micro_step_res(fixture->dev, 2); - enum micro_step_resolution res; + enum stepper_micro_step_resolution res; (void)stepper_get_micro_step_res(fixture->dev, &res); zassert_equal(res, 2, "Micro step resolution not set correctly"); } @@ -57,14 +80,15 @@ ZTEST_F(stepper, test_target_position) int32_t pos = 100u; (void)stepper_set_max_velocity(fixture->dev, 100u); - (void)stepper_set_target_position(fixture->dev, pos, &fixture->signal); - (void)k_poll(&fixture->event, 1, K_SECONDS(5)); + (void)stepper_set_callback(fixture->dev, fixture->callback, NULL); + (void)stepper_set_target_position(fixture->dev, pos); + (void)k_poll(&stepper_event, 1, K_SECONDS(5)); unsigned int signaled; int result; - k_poll_signal_check(&fixture->signal, &signaled, &result); + k_poll_signal_check(&stepper_signal, &signaled, &result); zassert_equal(signaled, 1, "Signal not set"); - zassert_equal(result, STEPPER_SIGNAL_STEPS_COMPLETED, "Signal not set"); + zassert_equal(result, STEPPER_EVENT_STEPS_COMPLETED, "Signal not set"); (void)stepper_get_actual_position(fixture->dev, &pos); zassert_equal(pos, 100u, "Target position should be %d but is %d", 100u, pos); } From cfd7f633d285162939a294f7f67d9afad983f042 Mon Sep 17 00:00:00 2001 From: Alexander Svensen Date: Mon, 7 Oct 2024 15:17:10 +0200 Subject: [PATCH 0811/4482] samples: Bluetooth: Audio: Find device regardless of name type - Fixes bug where the sample would only look at the first name type and skip the rest. Signed-off-by: Alexander Svensen --- .../bluetooth/bap_broadcast_sink/src/main.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/samples/bluetooth/bap_broadcast_sink/src/main.c b/samples/bluetooth/bap_broadcast_sink/src/main.c index eeee228a3a52e..44e9999c14246 100644 --- a/samples/bluetooth/bap_broadcast_sink/src/main.c +++ b/samples/bluetooth/bap_broadcast_sink/src/main.c @@ -1193,14 +1193,21 @@ static bool is_substring(const char *substr, const char *str) static bool data_cb(struct bt_data *data, void *user_data) { - char *name = user_data; + bool *device_found = user_data; + char name[NAME_LEN] = {0}; switch (data->type) { case BT_DATA_NAME_SHORTENED: case BT_DATA_NAME_COMPLETE: case BT_DATA_BROADCAST_NAME: memcpy(name, data->data, MIN(data->data_len, NAME_LEN - 1)); - return false; + + if (is_substring(CONFIG_TARGET_BROADCAST_NAME, name)) { + /* Device found */ + *device_found = true; + return false; + } + return true; default: return true; } @@ -1216,12 +1223,13 @@ static void broadcast_scan_recv(const struct bt_le_scan_recv_info *info, struct * our own broadcast name filter. */ if (req_recv_state == NULL && strlen(CONFIG_TARGET_BROADCAST_NAME) > 0U) { + bool device_found = false; struct net_buf_simple buf_copy; - char name[NAME_LEN] = {0}; net_buf_simple_clone(ad, &buf_copy); - bt_data_parse(&buf_copy, data_cb, name); - if (!(is_substring(CONFIG_TARGET_BROADCAST_NAME, name))) { + bt_data_parse(&buf_copy, data_cb, &device_found); + + if (!device_found) { return; } } From 39b904d9cc6cb40013a8a5ff75cd8053eeed8889 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 19 Sep 2024 17:13:35 +0530 Subject: [PATCH 0812/4482] modules: hostap: Add separate config for EAP-FAST EAP-FAST has extra requirements (TLS 1.3, session tickets etc) and is seldom used, so, remove it from Enterprise list and add a separate Kconfig option. This solves the build error when Enterprise mode is enabled. Signed-off-by: Chaitanya Tata --- modules/hostap/CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/hostap/CMakeLists.txt b/modules/hostap/CMakeLists.txt index 7369e1ba6202e..7512152eb1496 100644 --- a/modules/hostap/CMakeLists.txt +++ b/modules/hostap/CMakeLists.txt @@ -477,6 +477,17 @@ zephyr_library_compile_definitions_ifdef(CONFIG_EAP_FAST EAP_FAST ) +# Needs TLS1.3 and SESSION_TICKETS +zephyr_library_sources_ifdef(CONFIG_EAP_FAST + ${HOSTAP_SRC_BASE}/eap_peer/eap_fast.c + ${HOSTAP_SRC_BASE}/eap_peer/eap_fast_pac.c + ${HOSTAP_SRC_BASE}/eap_common/eap_fast_common.c +) + +zephyr_library_compile_definitions_ifdef(CONFIG_EAP_FAST + EAP_FAST +) + zephyr_library_compile_definitions_ifndef(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE CONFIG_NO_CONFIG_BLOBS ) From d107b04c9d708035779de23eb397da1bd69a85dc Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 19 Sep 2024 17:15:29 +0530 Subject: [PATCH 0813/4482] samples: wifi: Add overlays for Enterprise mode This overlay has all necessary configuration needed for Enterprise mode. Two variants are given, once with fixed size network buffers and other with variable size network buffers (still experimental). Signed-off-by: Chaitanya Tata --- samples/net/wifi/overlay-enterprise-variable-bufs.conf | 9 +++++++++ samples/net/wifi/overlay-enterprise.conf | 10 ++++++++++ 2 files changed, 19 insertions(+) create mode 100644 samples/net/wifi/overlay-enterprise-variable-bufs.conf create mode 100644 samples/net/wifi/overlay-enterprise.conf diff --git a/samples/net/wifi/overlay-enterprise-variable-bufs.conf b/samples/net/wifi/overlay-enterprise-variable-bufs.conf new file mode 100644 index 0000000000000..627d77a924785 --- /dev/null +++ b/samples/net/wifi/overlay-enterprise-variable-bufs.conf @@ -0,0 +1,9 @@ +CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE=y +# EAP frames are ~1100 bytes, so, for efficiency, we set the data size to 1100 +CONFIG_NET_BUF_DATA_SIZE=1100 +# Use variable data size to reduce memory usage for small data packets +CONFIG_NET_BUF_VARIABLE_DATA_SIZE=y +# For TLS and X.509 processing MbedTLS needs large heap size and using separate heap +# for MbedTLS gives us more control over the heap size. +CONFIG_MBEDTLS_ENABLE_HEAP=y +CONFIG_MBEDTLS_HEAP_SIZE=55000 diff --git a/samples/net/wifi/overlay-enterprise.conf b/samples/net/wifi/overlay-enterprise.conf new file mode 100644 index 0000000000000..3441628281129 --- /dev/null +++ b/samples/net/wifi/overlay-enterprise.conf @@ -0,0 +1,10 @@ +CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE=y +# EAP frames are ~1100 bytes, so, need higher packet counts as default packet size is 128 +CONFIG_NET_PKT_TX_COUNT=36 +CONFIG_NET_PKT_RX_COUNT=36 +CONFIG_NET_BUF_TX_COUNT=72 +CONFIG_NET_BUF_RX_COUNT=36 +# For TLS and X.509 processing MbedTLS needs large heap size and using separate heap +# for MbedTLS gives us more control over the heap size. +CONFIG_MBEDTLS_ENABLE_HEAP=y +CONFIG_MBEDTLS_HEAP_SIZE=55000 From 6cac9540ec44b44f551dbdca758f613bdd9571b7 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 19 Sep 2024 17:16:23 +0530 Subject: [PATCH 0814/4482] doc: wifi: Update enumeration for EAP-TLS EAP-TLS enumeration is now changed due to recent SAE additions. Signed-off-by: Chaitanya Tata --- doc/connectivity/networking/api/wifi.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/connectivity/networking/api/wifi.rst b/doc/connectivity/networking/api/wifi.rst index 7803a4560559d..f1bc744a831c5 100644 --- a/doc/connectivity/networking/api/wifi.rst +++ b/doc/connectivity/networking/api/wifi.rst @@ -44,7 +44,7 @@ To initiate Wi-Fi connection, the following command can be used: .. code-block:: console - uart:~$ wifi connect -s -k 5 -a anon -K whatever + uart:~$ wifi connect -s -k 7 -a anon -K whatever Server certificate is also provided in the same directory for testing purposes. Any AAA server can be used for testing purposes, for example, ``FreeRADIUS`` or ``hostapd``. From 48916d66e7d35022525e7e05e7b0b7d99a104809 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 20 Sep 2024 00:16:50 +0530 Subject: [PATCH 0815/4482] modules: hostap: Fix checks for Enterprise security Enterprise security doesn't have either SAE or PSK, so, using a blanker else throws a false warning. Fix the checks to proper handler enterprise mode. Signed-off-by: Chaitanya Tata --- modules/hostap/src/supp_api.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index 67a0234b221a2..c97f8f19819bb 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -511,17 +511,7 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s, } if (params->security != WIFI_SECURITY_TYPE_NONE) { - if (params->sae_password) { - if ((params->sae_password_length < WIFI_PSK_MIN_LEN) || - (params->sae_password_length > WIFI_SAE_PSWD_MAX_LEN)) { - wpa_printf(MSG_ERROR, - "Passphrase should be in range (%d-%d) characters", - WIFI_PSK_MIN_LEN, WIFI_SAE_PSWD_MAX_LEN); - goto out; - } - strncpy(sae_null_terminated, params->sae_password, WIFI_SAE_PSWD_MAX_LEN); - sae_null_terminated[params->sae_password_length] = '\0'; - } else { + if (params->psk) { if ((params->psk_length < WIFI_PSK_MIN_LEN) || (params->psk_length > WIFI_PSK_MAX_LEN)) { wpa_printf(MSG_ERROR, @@ -553,6 +543,16 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s, params->security == WIFI_SECURITY_TYPE_SAE_H2E || params->security == WIFI_SECURITY_TYPE_SAE_AUTO) { if (params->sae_password) { + if ((params->sae_password_length < WIFI_PSK_MIN_LEN) || + (params->sae_password_length > WIFI_SAE_PSWD_MAX_LEN)) { + wpa_printf(MSG_ERROR, + "Passphrase should be in range (%d-%d) characters", + WIFI_PSK_MIN_LEN, WIFI_SAE_PSWD_MAX_LEN); + goto out; + } + strncpy(sae_null_terminated, params->sae_password, + WIFI_SAE_PSWD_MAX_LEN); + sae_null_terminated[params->sae_password_length] = '\0'; if (!wpa_cli_cmd_v("set_network %d sae_password \"%s\"", resp.network_id, sae_null_terminated)) { goto out; From 4c5a72f9e0ecd03f8e1c4e93aa9cf3f58fb79616 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 20 Sep 2024 00:17:52 +0530 Subject: [PATCH 0816/4482] net: wifi: Fix PEM certificate parsing errors MbedTLS specifically checks for null-terminator, else it skips PEM format processing and tries to parse it as DER causing parsing failures. Signed-off-by: Chaitanya Tata --- subsys/net/l2/wifi/wifi_shell.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index a20756cc6e292..0c2fbe982c31b 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -32,14 +32,17 @@ LOG_MODULE_REGISTER(net_wifi_shell, LOG_LEVEL_INF); #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE static const char ca_cert_test[] = { #include + '\0' }; static const char client_cert_test[] = { #include + '\0' }; static const char client_key_test[] = { #include + '\0' }; #endif From b6430705572b53b712168255e934418c8b6f7b19 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Sun, 6 Oct 2024 15:05:34 +0530 Subject: [PATCH 0817/4482] doc: wifi: Update build command for Enterprise mode Now, Enterprise mode has a separate overlay. Signed-off-by: Chaitanya Tata --- doc/connectivity/networking/api/wifi.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/connectivity/networking/api/wifi.rst b/doc/connectivity/networking/api/wifi.rst index f1bc744a831c5..84c407cd4a893 100644 --- a/doc/connectivity/networking/api/wifi.rst +++ b/doc/connectivity/networking/api/wifi.rst @@ -38,7 +38,15 @@ module. $ cp client.pem samples/net/wifi/test_certs/ $ cp client-key.pem samples/net/wifi/test_certs/ $ cp ca.pem samples/net/wifi/test_certs/ - $ west build -p -b samples/net/wifi + $ west build -p -b samples/net/wifi -- -DEXTRA_CONF_FILE=overlay-enterprise.conf + +For using variable size network buffer, the following overlay file can be used: + +.. code-block:: bash + + $ west build -p -b samples/net/wifi -- -DEXTRA_CONF_FILE=overlay-enterprise-variable-bufs.conf + + To initiate Wi-Fi connection, the following command can be used: From 840f13f13aaa2d9ff9e599cb39f7e8306c873ff3 Mon Sep 17 00:00:00 2001 From: Alexandru Lastur Date: Mon, 16 Sep 2024 19:09:46 +0300 Subject: [PATCH 0818/4482] sample: open_amp_rsc_table: Add support for imx8mp_evk M7 core This enables openamp_rsc_table sample for imx8mp_evk on M7 core Signed-off-by: Alexandru Lastur --- .../boards/imx8mp_evk_mimx8ml8_m7.conf | 9 +++++++ .../boards/imx8mp_evk_mimx8ml8_m7.overlay | 24 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 samples/subsys/ipc/openamp_rsc_table/boards/imx8mp_evk_mimx8ml8_m7.conf create mode 100644 samples/subsys/ipc/openamp_rsc_table/boards/imx8mp_evk_mimx8ml8_m7.overlay diff --git a/samples/subsys/ipc/openamp_rsc_table/boards/imx8mp_evk_mimx8ml8_m7.conf b/samples/subsys/ipc/openamp_rsc_table/boards/imx8mp_evk_mimx8ml8_m7.conf new file mode 100644 index 0000000000000..d902b3fb68f8f --- /dev/null +++ b/samples/subsys/ipc/openamp_rsc_table/boards/imx8mp_evk_mimx8ml8_m7.conf @@ -0,0 +1,9 @@ +CONFIG_LOG_PRINTK=n +CONFIG_IPM_IMX_MAX_DATA_SIZE_16=n +CONFIG_IPM_IMX_MAX_DATA_SIZE_4=y +CONFIG_OPENAMP_WITH_DCACHE=y +CONFIG_IPM_IMX_FW_READY_REPLY=y +CONFIG_LOG=y +CONFIG_LOG_BACKEND_UART=y +CONFIG_LOG_DEFAULT_LEVEL=0 +CONFIG_LOG_MODE_MINIMAL=y diff --git a/samples/subsys/ipc/openamp_rsc_table/boards/imx8mp_evk_mimx8ml8_m7.overlay b/samples/subsys/ipc/openamp_rsc_table/boards/imx8mp_evk_mimx8ml8_m7.overlay new file mode 100644 index 0000000000000..d746a8436bc97 --- /dev/null +++ b/samples/subsys/ipc/openamp_rsc_table/boards/imx8mp_evk_mimx8ml8_m7.overlay @@ -0,0 +1,24 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + /* + * shared memory reserved for the inter-processor communication + */ + zephyr,ipc_shm = &shram; + zephyr,ipc = &mailbox0; + }; + + shram: memory@55000000 { + compatible = "mmio-sram"; + reg = <0x55000000 0x500000>; + }; +}; + +&mailbox0 { + status = "okay"; +}; From ec2dd19d458652f3c32c9b1618902540b3619f42 Mon Sep 17 00:00:00 2001 From: Alexandru Lastur Date: Mon, 16 Sep 2024 19:33:20 +0300 Subject: [PATCH 0819/4482] samples: openamp_rsc_table: Add the option to use predefined vring ID Currently, Zephyr is always sending back notifications to AP (e.g Linux in our case) on channel 0. But this currently doesn't work if Linux uses other channel id for communication. So, add option to use predefined vring ID that can accomodate Linux used ID. Signed-off-by: Alexandru Lastur --- lib/open-amp/Kconfig | 16 ++++++++++++++++ lib/open-amp/resource_table.h | 4 ++-- .../boards/imx8mp_evk_mimx8ml8_m7.conf | 2 ++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/open-amp/Kconfig b/lib/open-amp/Kconfig index c37ee967fce3b..1ad554cd90b80 100644 --- a/lib/open-amp/Kconfig +++ b/lib/open-amp/Kconfig @@ -18,3 +18,19 @@ config OPENAMP_RSC_TABLE_NUM_RPMSG_BUFF help This option specifies the number of buffer used in a Vring for interprocessor communication + +config OPENAMP_RSC_TABLE_IPM_RX_ID + int "IPM RX channel ID" + default 0 + depends on OPENAMP_RSC_TABLE + help + This option specifies the IPM RX channel ID used in a VRING + for interprocessor communication + +config OPENAMP_RSC_TABLE_IPM_TX_ID + int "IPM TX channel ID" + default 1 + depends on OPENAMP_RSC_TABLE + help + This option specifies the IPM TX channel ID used in a VRING + for interprocessor communication diff --git a/lib/open-amp/resource_table.h b/lib/open-amp/resource_table.h index dc577fafa7edc..a39154e3f8d26 100644 --- a/lib/open-amp/resource_table.h +++ b/lib/open-amp/resource_table.h @@ -17,8 +17,8 @@ extern "C" { #if (CONFIG_OPENAMP_RSC_TABLE_NUM_RPMSG_BUFF > 0) #define VDEV_ID 0xFF -#define VRING0_ID 0 /* (master to remote) fixed to 0 for Linux compatibility */ -#define VRING1_ID 1 /* (remote to master) fixed to 1 for Linux compatibility */ +#define VRING0_ID CONFIG_OPENAMP_RSC_TABLE_IPM_RX_ID /* (host to remote) */ +#define VRING1_ID CONFIG_OPENAMP_RSC_TABLE_IPM_TX_ID /* (remote to host) */ #define VRING_COUNT 2 #define RPMSG_IPU_C0_FEATURES 1 diff --git a/samples/subsys/ipc/openamp_rsc_table/boards/imx8mp_evk_mimx8ml8_m7.conf b/samples/subsys/ipc/openamp_rsc_table/boards/imx8mp_evk_mimx8ml8_m7.conf index d902b3fb68f8f..1e875453ba65f 100644 --- a/samples/subsys/ipc/openamp_rsc_table/boards/imx8mp_evk_mimx8ml8_m7.conf +++ b/samples/subsys/ipc/openamp_rsc_table/boards/imx8mp_evk_mimx8ml8_m7.conf @@ -7,3 +7,5 @@ CONFIG_LOG=y CONFIG_LOG_BACKEND_UART=y CONFIG_LOG_DEFAULT_LEVEL=0 CONFIG_LOG_MODE_MINIMAL=y +CONFIG_OPENAMP_RSC_TABLE_IPM_RX_ID=1 +CONFIG_OPENAMP_RSC_TABLE_IPM_TX_ID=0 From 03959a20f7834ffe50a51df2b2e45ef87d1b610b Mon Sep 17 00:00:00 2001 From: Klaus Nagel Date: Tue, 17 Sep 2024 07:41:47 +0200 Subject: [PATCH 0820/4482] boards: st: nucleo_g431kb: add support for nucleo g431kb Add support for the nucleo g431kb Board. Signed-off-by: Klaus Nagel --- boards/st/nucleo_g431kb/Kconfig.nucleo_g431kb | 5 + boards/st/nucleo_g431kb/board.cmake | 10 + boards/st/nucleo_g431kb/board.yml | 6 + .../nucleo_g431kb/doc/img/nucleo_g431kb.webp | Bin 0 -> 16538 bytes boards/st/nucleo_g431kb/doc/index.rst | 189 ++++++++++++++++++ boards/st/nucleo_g431kb/nucleo_g431kb.dts | 117 +++++++++++ boards/st/nucleo_g431kb/nucleo_g431kb.yaml | 16 ++ .../st/nucleo_g431kb/nucleo_g431kb_defconfig | 18 ++ boards/st/nucleo_g431kb/support/openocd.cfg | 7 + 9 files changed, 368 insertions(+) create mode 100644 boards/st/nucleo_g431kb/Kconfig.nucleo_g431kb create mode 100644 boards/st/nucleo_g431kb/board.cmake create mode 100644 boards/st/nucleo_g431kb/board.yml create mode 100644 boards/st/nucleo_g431kb/doc/img/nucleo_g431kb.webp create mode 100644 boards/st/nucleo_g431kb/doc/index.rst create mode 100644 boards/st/nucleo_g431kb/nucleo_g431kb.dts create mode 100644 boards/st/nucleo_g431kb/nucleo_g431kb.yaml create mode 100644 boards/st/nucleo_g431kb/nucleo_g431kb_defconfig create mode 100644 boards/st/nucleo_g431kb/support/openocd.cfg diff --git a/boards/st/nucleo_g431kb/Kconfig.nucleo_g431kb b/boards/st/nucleo_g431kb/Kconfig.nucleo_g431kb new file mode 100644 index 0000000000000..79f5335fbbdb6 --- /dev/null +++ b/boards/st/nucleo_g431kb/Kconfig.nucleo_g431kb @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Klaus Nagel +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_NUCLEO_G431KB + select SOC_STM32G431XX diff --git a/boards/st/nucleo_g431kb/board.cmake b/boards/st/nucleo_g431kb/board.cmake new file mode 100644 index 0000000000000..00ab7c45ccfe5 --- /dev/null +++ b/boards/st/nucleo_g431kb/board.cmake @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 + +# keep first +board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw") +board_runner_args(pyocd "--target=stm32g431kbtx") + +# keep first +include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake) +include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) +include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/st/nucleo_g431kb/board.yml b/boards/st/nucleo_g431kb/board.yml new file mode 100644 index 0000000000000..759a5ca95e0da --- /dev/null +++ b/boards/st/nucleo_g431kb/board.yml @@ -0,0 +1,6 @@ +board: + name: nucleo_g431kb + full_name: Nucleo G431KB + vendor: st + socs: + - name: stm32g431xx diff --git a/boards/st/nucleo_g431kb/doc/img/nucleo_g431kb.webp b/boards/st/nucleo_g431kb/doc/img/nucleo_g431kb.webp new file mode 100644 index 0000000000000000000000000000000000000000..1d7a7f6b83886fceb8aca882fb77f281908c327a GIT binary patch literal 16538 zcmV(rK<>X%Nk&GJKmY(&MM6+kP&golKmY)+;{crjDzN~<0X~&Lm`EuoCZ{pB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K4G{6JNvVT=cTIVssczh0f_*1{}t$@S!7_4X&~M2O3~PfSZGf& zXCf&&!%OqwJ5aXFnIH$m1kQjGF-(!k#9I zGov?NFLb0-MWOm#v+Dr>gRIe0fms literal 0 HcmV?d00001 diff --git a/boards/st/nucleo_g431kb/doc/index.rst b/boards/st/nucleo_g431kb/doc/index.rst new file mode 100644 index 0000000000000..27311760458b7 --- /dev/null +++ b/boards/st/nucleo_g431kb/doc/index.rst @@ -0,0 +1,189 @@ +.. _nucleo_g431kb_board: + +ST Nucleo G431KB +################ + +Overview +******** + +The Nucleo G431KB board features an ARM Cortex-M4 based STM32G431KB MCU +with a wide range of connectivity support and configurations. +Here are some highlights of the Nucleo G431KB board: + +- STM32 microcontroller in LQFP32 package +- Arduino Nano V3 connectivity +- On-board ST-LINK/V3E debugger/programmer +- Flexible board power supply: + + - USB VBUS or external source(3.3 V, 5 V, 7 - 12 V) + - Power management access point + +- Three LEDs: USB communication (LD1), power LED (LD3), user LED (LD2) +- One push-button for RESET + +.. image:: img/nucleo_g431kb.webp + :align: center + :alt: Nucleo G431kB + +More information about the board can be found at the `Nucleo G431KB website`_. + +- Development support: serial wire debug (SWD), JTAG, Embedded Trace Macrocell. + +More information about STM32G431KB can be found here: + +- `STM32G431KB on www.st.com`_ +- `STM32G4 reference manual`_ + +Supported Features +================== + +The Zephyr ``nucleo_g431kb`` board target supports the following hardware features: + ++-----------+------------+-------------------------------------+ +| Interface | Controller | Driver/Component | ++===========+============+=====================================+ +| NVIC | on-chip | nested vector interrupt controller | ++-----------+------------+-------------------------------------+ +| UART | on-chip | serial port-polling; | +| | | serial port-interrupt | ++-----------+------------+-------------------------------------+ +| PINMUX | on-chip | pinmux | ++-----------+------------+-------------------------------------+ +| GPIO | on-chip | gpio | ++-----------+------------+-------------------------------------+ +| PWM | on-chip | pwm | ++-----------+------------+-------------------------------------+ +| I2C | on-chip | i2c | ++-----------+------------+-------------------------------------+ + +Other hardware features are not yet supported on this Zephyr port. + +The default configuration can be found in the defconfig file: +:zephyr_file:`boards/st/nucleo_g431kb/nucleo_g431kb_defconfig` + + +Connections and IOs +=================== + +Nucleo G431KB Board has 6 GPIO controllers. These controllers are responsible for pin muxing, +input/output, pull-up, etc. + +For more details please refer to `STM32G4 Nucleo-32 board User Manual`_. + +Default Zephyr Peripheral Mapping: +---------------------------------- + +.. rst-class:: rst-columns + +- LPUART_1_TX : PA2 +- LPUART_1_RX : PA3 +- LD2 : PB8 +- PWM_4_CH_3 : PB8 +- I2C_2_SCL : PA9 +- I2C_2_SDA : PA8 + +System Clock +------------ + +The Nucleo G431KB System Clock could be driven by internal or external oscillator, +as well as main PLL clock. By default the external oscillator is not connected to the board. Therefore only the internal +High Speed oscillator is supported. By default System clock is driven by PLL clock at 170 MHz, +the PLL is driven by the 16 MHz high speed internal oscillator. + +Serial Port +----------- + +Nucleo G431KB board has 1 U(S)ARTs and one LPUART. The Zephyr console output is assigned to LPUART1. +Default settings are 115200 8N1. + +Please note that LPUART1 baudrate is limited to 9600 if the MCU is clocked by LSE (32.768 kHz) in +low power mode. + +Programming and Debugging +************************* + +Nucleo G431KB Board includes an ST-Link/V3 embedded debug tool interface. + +Applications for the ``nucleo_g431kb`` board target can be built and +flashed in the usual way (see :ref:`build_an_application` and +:ref:`application_run` for more details). + +Flashing +======== + +The board is configured to be flashed using west `STM32CubeProgrammer`_ runner, +so its :ref:`installation ` is required. + +Alternatively, OpenOCD, or pyOCD can also be used to flash the board using +the ``--runner`` (or ``-r``) option: + +.. code-block:: console + + $ west flash --runner openocd + $ west flash --runner pyocd + +To enable support of the STM32G431KB SoC in pyOCD, its pack has to be installed first: + +.. code-block:: console + + $ pyocd pack --update + $ pyocd pack --install stm32g431kb + +Flashing an application to Nucleo G431KB +---------------------------------------- + +Connect the Nucleo G431KB to your host computer using the USB port, +then run a serial host program to connect with your Nucleo board. + +.. code-block:: console + + $ minicom -D /dev/ttyACM0 + +Now build and flash an application. Here is an example for +:zephyr:code-sample:`hello_world`. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: nucleo_g431kb + :goals: build flash + +You should see the following message on the console: + +.. code-block:: console + + $ Hello World! nucleo_g431kb/stm32g431xx + +Debugging +========= + +You can debug an application in the usual way. Here is an example for the +:zephyr:code-sample:`hello_world` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: nucleo_g431kb + :maybe-skip-config: + :goals: debug + +References +********** + +.. target-notes:: + +.. _Nucleo G431KB website: + https://www.st.com/en/evaluation-tools/nucleo-g431kb.html + +.. _STM32G4 Nucleo-32 board User Manual: + https://www.st.com/resource/en/user_manual/um2397-stm32g4-nucleo32-board-mb1430-stmicroelectronics.pdf + +.. _STM32g431kb Nucleo-32 board schematic: + https://www.st.com/resource/en/schematic_pack/mb1430-g431kbt6-a02_schematic_internal.pdf + +.. _STM32G431KB on www.st.com: + https://www.st.com/en/microcontrollers-microprocessors/stm32g431kb.html + +.. _STM32G4 reference manual: + https://www.st.com/resource/en/reference_manual/rm0440-stm32g4-series-advanced-armbased-32bit-mcus-stmicroelectronics.pdf + +.. _STM32CubeProgrammer: + https://www.st.com/en/development-tools/stm32cubeprog.html diff --git a/boards/st/nucleo_g431kb/nucleo_g431kb.dts b/boards/st/nucleo_g431kb/nucleo_g431kb.dts new file mode 100644 index 0000000000000..b3d1adaa077d3 --- /dev/null +++ b/boards/st/nucleo_g431kb/nucleo_g431kb.dts @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2024 Klaus Nagel, + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include + +/ { + model = "STMicroelectronics STM32G431KB-NUCLEO board"; + compatible = "st,stm32g431kb-nucleo"; + + chosen { + zephyr,console = &lpuart1; + zephyr,shell-uart = &lpuart1; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + }; + + leds: leds { + compatible = "gpio-leds"; + green_led: led_0 { + gpios = <&gpiob 8 GPIO_ACTIVE_HIGH>; + label = "User LD2"; + }; + + }; + + pwmleds { + compatible = "pwm-leds"; + + green_pwm_led: green_pwm_led { + pwms = <&pwm4 3 PWM_MSEC(20) PWM_POLARITY_NORMAL>; + }; + }; + + + aliases { + led0 = &green_led; + pwm-led0 = &green_pwm_led; + watchdog0 = &iwdg; + }; +}; + +&clk_hsi { + status = "okay"; +}; + +&clk_lsi { + status = "okay"; +}; + +stm32_lp_tick_source: &lptim1 { + clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>, + <&rcc STM32_SRC_LSI LPTIM1_SEL(3)>; + status = "okay"; +}; + +/* Adjust the pll for a SYSTEM Clock of 170MHz */ +&pll { + div-m = <4>; + mul-n = <85>; + div-p = <7>; + div-q = <2>; + div-r = <2>; + clocks = <&clk_hsi>; + status = "okay"; +}; + +&rcc { + clocks = <&pll>; + clock-frequency = ; + ahb-prescaler = <1>; + apb1-prescaler = <1>; + apb2-prescaler = <1>; +}; + +&lpuart1 { + pinctrl-0 = <&lpuart1_tx_pa2 &lpuart1_rx_pa3>; + pinctrl-names = "default"; + current-speed = <115200>; + status = "okay"; +}; + +&timers4 { + st,prescaler = <10000>; + status = "okay"; + + pwm4: pwm { + status = "okay"; + pinctrl-0 = <&tim4_ch3_pb8>; + pinctrl-names = "default"; + }; +}; + +&i2c2 { + pinctrl-0 = <&i2c2_scl_pa9 &i2c2_sda_pa8>; + pinctrl-names = "default"; + status = "okay"; +}; + +&flash0 { + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* Set 4Kb of storage at the end of the 128Kb of flash */ + storage_partition: partition@1f000 { + label = "storage"; + reg = <0x0001f000 DT_SIZE_K(4)>; + }; + }; +}; diff --git a/boards/st/nucleo_g431kb/nucleo_g431kb.yaml b/boards/st/nucleo_g431kb/nucleo_g431kb.yaml new file mode 100644 index 0000000000000..eb396a45f570c --- /dev/null +++ b/boards/st/nucleo_g431kb/nucleo_g431kb.yaml @@ -0,0 +1,16 @@ +identifier: nucleo_g431kb +name: ST Nucleo G431KB +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +ram: 32 +flash: 128 +supported: + - gpio + - pwm + - counter + - i2c +vendor: st diff --git a/boards/st/nucleo_g431kb/nucleo_g431kb_defconfig b/boards/st/nucleo_g431kb/nucleo_g431kb_defconfig new file mode 100644 index 0000000000000..e12697ed812c5 --- /dev/null +++ b/boards/st/nucleo_g431kb/nucleo_g431kb_defconfig @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: Apache-2.0 + +# Serial drivers +CONFIG_SERIAL=y +CONFIG_UART_INTERRUPT_DRIVEN=y + +# enable GPIO +CONFIG_GPIO=y + +# Console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable HW stack protection +CONFIG_HW_STACK_PROTECTION=y diff --git a/boards/st/nucleo_g431kb/support/openocd.cfg b/boards/st/nucleo_g431kb/support/openocd.cfg new file mode 100644 index 0000000000000..d936f7d353423 --- /dev/null +++ b/boards/st/nucleo_g431kb/support/openocd.cfg @@ -0,0 +1,7 @@ +source [find interface/stlink.cfg] + +transport select hla_swd + +source [find target/stm32g4x.cfg] + +reset_config srst_only From fb010719ed5a1682bc946dd2153ef964b87ff2cc Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Tue, 15 Oct 2024 13:34:09 +0200 Subject: [PATCH 0821/4482] manifest: Update nRF hw models to latest Update the HW models module to: eeed2591d38e5e9bf89658df67555f2777249fc0 eeed259 RADIO: Do not warn about TASK_RSSISTART during RXIDLE 565220e 54L15.mk: Fix flipper hal target name bb8c6fd Makefile: Let's install libraries by default 6dbb843 RADIO: Implement immediate RSSI measurement when needed 3a5d567 RADIO: Allow triggering TASK_RSSISTART from register writes Signed-off-by: Alberto Escolar Piedras --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 8479528d12af8..f735aa4bc8bdb 100644 --- a/west.yml +++ b/west.yml @@ -300,7 +300,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: bf8e45bd1f870e49cc15392e045c28d54ea12285 + revision: eeed2591d38e5e9bf89658df67555f2777249fc0 path: modules/bsim_hw_models/nrf_hw_models - name: open-amp revision: b735edbc739ad59156eb55bb8ce2583d74537719 From 52efa3bb9b8a4204acad587d8ef7bc92ed277b20 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Thu, 10 Oct 2024 23:58:20 +0300 Subject: [PATCH 0822/4482] soc: intel_adsp: tools: fix ace15 ROM status check in cavstool.py Fix definition for ROM status register for ACE1.5. The value should be same as ACE2.0 and only different for ACE3.0. Fixes: 6ad9b6ccabeb ("soc: intel_adsp: tools: add intel_adsp_ace30 support to cavstool.py") Signed-off-by: Kai Vehmanen --- soc/intel/intel_adsp/tools/cavstool.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soc/intel/intel_adsp/tools/cavstool.py b/soc/intel/intel_adsp/tools/cavstool.py index b28cd2d5cbd0f..aa59f4fdc80c0 100755 --- a/soc/intel/intel_adsp/tools/cavstool.py +++ b/soc/intel/intel_adsp/tools/cavstool.py @@ -274,8 +274,8 @@ def map_regs(log_only): dsp = Regs(bar4_mem) if adsp_is_ace(): dsp.HFDSSCS = 0x1000 - dsp.HFPWRCTL = 0x1d18 if ace20 else 0x1d20 - dsp.HFPWRSTS = 0x1d1c if ace20 else 0x1d24 + dsp.HFPWRCTL = 0x1d18 if ace15 or ace20 else 0x1d20 + dsp.HFPWRSTS = 0x1d1c if ace15 or ace20 else 0x1d24 dsp.DSP2CXCTL_PRIMARY = 0x178d04 dsp.HFIPCXTDR = 0x73200 dsp.HFIPCXTDA = 0x73204 From 29798f0ebddbef829132dd66af56c955ed0d694e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 11 Oct 2024 13:18:41 +0200 Subject: [PATCH 0823/4482] doc: extensions: boards: add labels to search form fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add proper labels to the form fields for better UX/accessibility Updated the placeholder for the "board name" field to be more informative. Signed-off-by: Benjamin Cabé --- .../domain/static/css/board-catalog.css | 18 ++++- .../domain/templates/board-catalog.html | 65 +++++++++++-------- 2 files changed, 55 insertions(+), 28 deletions(-) diff --git a/doc/_extensions/zephyr/domain/static/css/board-catalog.css b/doc/_extensions/zephyr/domain/static/css/board-catalog.css index f92c5c6faa6f3..04056a1ad8499 100644 --- a/doc/_extensions/zephyr/domain/static/css/board-catalog.css +++ b/doc/_extensions/zephyr/domain/static/css/board-catalog.css @@ -21,7 +21,6 @@ font-size: 14px; border-radius: 50px; padding: 10px 18px; - flex: 1 1 200px; background-color: var(--input-background-color); color: var(--body-color); transition: all 0.3s ease; @@ -31,8 +30,23 @@ .filter-form input:focus, .filter-form select:focus { border-color: var(--input-focus-border-color); } -.select-container { + +.form-group { flex: 1 1 200px; + display: grid; + grid-template-rows: auto 1fr; + margin-bottom: 10px; +} + +.filter-form .form-group label { + color: var(--body-color); + font-size: 10px; + text-transform: uppercase; + padding-left: 18px; + margin-bottom: 5px; +} + +.select-container { position: relative; } diff --git a/doc/_extensions/zephyr/domain/templates/board-catalog.html b/doc/_extensions/zephyr/domain/templates/board-catalog.html index cac5a7093f2c9..40d9cb15cec40 100644 --- a/doc/_extensions/zephyr/domain/templates/board-catalog.html +++ b/doc/_extensions/zephyr/domain/templates/board-catalog.html @@ -4,34 +4,47 @@ #}
- -
- + +
+ +
-
- + +
+ +
+ +
+ +
+ +
+ +
+
+
From d5bcfc764c154a19ce306b055641a34899f5bc74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 11 Oct 2024 13:21:56 +0200 Subject: [PATCH 0824/4482] doc: extensions: boards: suppress extra blank lines in Jinja templates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ensure Jinja templates don't have extra blank lines in the output by using the {% -%} syntax to suppress them. This is not incredibly important but this helps keeps the HTML output more readable. Signed-off-by: Benjamin Cabé --- .../zephyr/domain/templates/board-card.html | 12 ++++++------ .../zephyr/domain/templates/board-catalog.html | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/_extensions/zephyr/domain/templates/board-card.html b/doc/_extensions/zephyr/domain/templates/board-card.html index c2a829bb8dbe6..d04ef9d8503b3 100644 --- a/doc/_extensions/zephyr/domain/templates/board-card.html +++ b/doc/_extensions/zephyr/domain/templates/board-card.html @@ -5,22 +5,22 @@
{{ catalog.vendors[board.vendor] }}
- {% if board.image %} + {% if board.image -%} A picture of the {{ board.name }} board - {% else %} + {% else -%}
- {% endif %} + {% endif -%}
{{ board.full_name }}
{{ board.archs | join(", ") }}
diff --git a/doc/_extensions/zephyr/domain/templates/board-catalog.html b/doc/_extensions/zephyr/domain/templates/board-catalog.html index 40d9cb15cec40..00db1b09db388 100644 --- a/doc/_extensions/zephyr/domain/templates/board-catalog.html +++ b/doc/_extensions/zephyr/domain/templates/board-catalog.html @@ -38,7 +38,7 @@ {# Only show those vendors that have actual boards in the catalog. Note: as sorting per vendor name is not feasible in Jinja, the option list is sorted in the JavaScript code later #} - {% for vendor in (catalog.boards | items | map(attribute='1.vendor') | unique ) %} + {% for vendor in (catalog.boards | items | map(attribute='1.vendor') | unique ) -%} {% endfor %} @@ -67,7 +67,7 @@
- {% for board_name, board in catalog.boards | items | sort(attribute='1.full_name') %} + {% for board_name, board in catalog.boards | items | sort(attribute='1.full_name') -%} {% include "board-card.html" %} {% endfor %}
From 3ca52a058041c0383957758b8ebb3593cc74f287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Tue, 8 Oct 2024 13:23:33 +0200 Subject: [PATCH 0825/4482] dt-bindings: usb: uac2: Add Feature Unit bindings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add initial Feature Unit bindings allowing user to place the Feature Unit inside UAC2 instance description. Currently the bindings facilitate only specifying which controls are available on the Primary channel 0 and on each Logical channel. The number of Logical channels has to be derived from data-source property. Signed-off-by: Tomasz Moń --- .../usb/uac2/zephyr,uac2-feature-unit.yaml | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 dts/bindings/usb/uac2/zephyr,uac2-feature-unit.yaml diff --git a/dts/bindings/usb/uac2/zephyr,uac2-feature-unit.yaml b/dts/bindings/usb/uac2/zephyr,uac2-feature-unit.yaml new file mode 100644 index 0000000000000..9a79a65630f64 --- /dev/null +++ b/dts/bindings/usb/uac2/zephyr,uac2-feature-unit.yaml @@ -0,0 +1,134 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: USB Audio Class 2 Feature Unit entity + +compatible: "zephyr,uac2-feature-unit" + +# string-array properties start with Primary channel 0 and follow with Logical +# channel(s). The "not-present" value is allowed to facilitate having controls +# that are not present on the Primary channel, but only present at the Logical +# channel(s). + +properties: + data-source: + type: phandle + description: Unit or Terminal to which this Feature Unit is connected + + mute-control: + type: string-array + description: Mute Control capabilities + enum: + - "read-only" + - "host-programmable" + - "not-present" + + volume-control: + type: string-array + description: Volume Control capabilities + enum: + - "read-only" + - "host-programmable" + - "not-present" + + bass-control: + type: string-array + description: Bass Control capabilities + enum: + - "read-only" + - "host-programmable" + - "not-present" + + mid-control: + type: string-array + description: Mid Control capabilities + enum: + - "read-only" + - "host-programmable" + - "not-present" + + treble-control: + type: string-array + description: Treble Control capabilities + enum: + - "read-only" + - "host-programmable" + - "not-present" + + graphic-equalizer-control: + type: string-array + description: Graphic Equalizer capabilities + enum: + - "read-only" + - "host-programmable" + - "not-present" + + automatic-gain-control: + type: string-array + description: Automatic Gain Control capabilities + enum: + - "read-only" + - "host-programmable" + - "not-present" + + delay-control: + type: string-array + description: Delay Control capabilities + enum: + - "read-only" + - "host-programmable" + - "not-present" + + bass-boost-control: + type: string-array + description: Bass Boost Control capabilities + enum: + - "read-only" + - "host-programmable" + - "not-present" + + loundness-control: + type: string-array + description: Loundness Control capabilities + enum: + - "read-only" + - "host-programmable" + - "not-present" + + input-gain-control: + type: string-array + description: Input Gain Control capabilities + enum: + - "read-only" + - "host-programmable" + - "not-present" + + input-gain-pad-control: + type: string-array + description: Input Gain Pad Control capabilities + enum: + - "read-only" + - "host-programmable" + - "not-present" + + phase-inverter-control: + type: string-array + description: Phase Inverter Control capabilities + enum: + - "read-only" + - "host-programmable" + - "not-present" + + underflow-control: + type: string-array + description: Underflow Control capabilities + enum: + - "read-only" + - "not-present" + + overflow-control: + type: string-array + description: Overflow Control capabilities + enum: + - "read-only" + - "not-present" From 1dde8e255046075f0bd31fbf27b379a558f2b219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Wed, 9 Oct 2024 11:08:01 +0200 Subject: [PATCH 0826/4482] usb: device_next: uac2: Generate Feature Unit descriptor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rework NUM_SPATIAL_LOCATIONS() to evaluate to integer literal to allow using it with LISTIFY() macro. This is necessary because Feature Unit do not operate on channel clusters but rather on logical channels. Track back Output Terminal channel cluster to appropriate entity. This is necessary because Feature Unit does not repeat the channel cluster information. Signed-off-by: Tomasz Moń --- .../usb/device_next/class/usbd_uac2_macros.h | 139 ++++++++++++++++-- 1 file changed, 130 insertions(+), 9 deletions(-) diff --git a/subsys/usb/device_next/class/usbd_uac2_macros.h b/subsys/usb/device_next/class/usbd_uac2_macros.h index 2fbfea86d9d25..a31278d9cf8ac 100644 --- a/subsys/usb/device_next/class/usbd_uac2_macros.h +++ b/subsys/usb/device_next/class/usbd_uac2_macros.h @@ -108,6 +108,9 @@ #define EXT_FORMAT_TYPE_II 130 #define EXT_FORMAT_TYPE_III 131 +/* Convert 0 to empty and everything else to itself */ +#define EMPTY_ON_ZERO(value) COND_CODE_0(value, (), (value)) + /* Automatically assign Entity IDs based on entities order in devicetree */ #define ENTITY_ID(e) UTIL_INC(DT_NODE_CHILD_IDX(e)) @@ -168,12 +171,26 @@ * control is present but read-only and 0b11 when control can be programmed by * host. Value 0b10 is not allowed by the specification. */ -#define CONTROL_BITS(entity, control_name, bitshift) \ +#define CONTROL_NOT_PRESENT 0x0 +#define CONTROL_READ_ONLY 0x1 +#define CONTROL_HOST_PROGRAMMABLE 0x3 + +#define CONTROL_TOKEN(entity, control_name) \ COND_CODE_1(DT_NODE_HAS_PROP(entity, control_name), \ - (COND_CODE_0(DT_ENUM_IDX(entity, control_name), \ - ((0x1 << bitshift)) /* read-only */, \ - ((0x3 << bitshift)) /* host-programmable */)), \ - ((0x0 << bitshift)) /* control not present */) + (DT_STRING_UPPER_TOKEN(entity, control_name)), \ + (NOT_PRESENT)) + +#define CONTROL_BITS(entity, control_name, bitshift) \ + (UTIL_CAT(CONTROL_, CONTROL_TOKEN(entity, control_name)) << bitshift) + +#define CONTROL_TOKEN_BY_IDX(entity, control_name, idx) \ + COND_CODE_1(DT_PROP_HAS_IDX(entity, control_name, idx), \ + (DT_STRING_UPPER_TOKEN_BY_IDX(entity, control_name, idx)), \ + (NOT_PRESENT)) + +#define CONTROL_BITS_BY_IDX(entity, control_name, idx, bitshift) \ + (UTIL_CAT(CONTROL_, CONTROL_TOKEN_BY_IDX(entity, control_name, idx)) \ + << bitshift) #define CLOCK_SOURCE_CONTROLS(entity) \ CONTROL_BITS(entity, frequency_control, 0) | \ @@ -194,6 +211,23 @@ CONTROL_BITS(entity, underflow_control, 6) | \ CONTROL_BITS(entity, overflow_control, 8) +#define FEATURE_UNIT_CHANNEL_CONTROLS(entity, ch) \ + CONTROL_BITS_BY_IDX(entity, mute_control, ch, 0) | \ + CONTROL_BITS_BY_IDX(entity, volume_control, ch, 2) | \ + CONTROL_BITS_BY_IDX(entity, bass_control, ch, 4) | \ + CONTROL_BITS_BY_IDX(entity, mid_control, ch, 6) | \ + CONTROL_BITS_BY_IDX(entity, treble_control, ch, 8) | \ + CONTROL_BITS_BY_IDX(entity, graphic_equalizer_control, ch, 10) | \ + CONTROL_BITS_BY_IDX(entity, automatic_gain_control, ch, 12) | \ + CONTROL_BITS_BY_IDX(entity, delay_control, ch, 14) | \ + CONTROL_BITS_BY_IDX(entity, bass_boost_control, ch, 16) | \ + CONTROL_BITS_BY_IDX(entity, loudness_control, ch, 18) | \ + CONTROL_BITS_BY_IDX(entity, input_gain_control, ch, 20) | \ + CONTROL_BITS_BY_IDX(entity, input_gain_pad_control, ch, 22) | \ + CONTROL_BITS_BY_IDX(entity, phase_inverter_control, ch, 24) | \ + CONTROL_BITS_BY_IDX(entity, underflow_control, ch, 26) | \ + CONTROL_BITS_BY_IDX(entity, overflow_control, ch, 28) + #define AUDIO_STREAMING_DATA_ENDPOINT_CONTROLS(node) \ CONTROL_BITS(node, pitch_control, 0) | \ CONTROL_BITS(node, data_overrun_control, 2) | \ @@ -233,10 +267,24 @@ #define SPATIAL_LOCATIONS_U32(entity) \ (FOR_EACH_IDX(ARRAY_BIT, (|), SPATIAL_LOCATIONS_ARRAY(entity))) -#define NUM_SPATIAL_LOCATIONS(entity) \ - (FOR_EACH(IDENTITY, (+), SPATIAL_LOCATIONS_ARRAY(entity))) +#define NUM_SPATIAL_LOCATIONS(entity) \ + NUM_VA_ARGS(LIST_DROP_EMPTY( \ + FOR_EACH(EMPTY_ON_ZERO, (,), SPATIAL_LOCATIONS_ARRAY(entity)) \ + )) #define SPATIAL_LOCATIONS(entity) U32_LE(SPATIAL_LOCATIONS_U32(entity)) +#define FEATURE_UNIT_NUM_CHANNELS(entity) \ + NUM_SPATIAL_LOCATIONS(DT_PHANDLE_BY_IDX(entity, data_source, 0)) + +#define FEATURE_UNIT_CONTROLS_BY_IDX(i, entity) \ + U32_LE(FEATURE_UNIT_CHANNEL_CONTROLS(entity, i)) + +#define FEATURE_UNIT_CONTROLS_ARRAYS(entity) \ + LISTIFY(UTIL_INC(FEATURE_UNIT_NUM_CHANNELS(entity)), \ + FEATURE_UNIT_CONTROLS_BY_IDX, (,), entity) + +#define FEATURE_UNIT_DESCRIPTOR_LENGTH(entity) \ + (6 + (FEATURE_UNIT_NUM_CHANNELS(entity) + 1) * 4) /* 4.7.2.1 Clock Source Descriptor */ #define CLOCK_SOURCE_DESCRIPTOR(entity) \ @@ -277,6 +325,16 @@ U16_LE(OUTPUT_TERMINAL_CONTROLS(entity)), /* bmControls */ \ 0x00, /* iTerminal */ +/* 4.7.2.8 Feature Unit Descriptor */ +#define FEATURE_UNIT_DESCRIPTOR(entity) \ + FEATURE_UNIT_DESCRIPTOR_LENGTH(entity), /* bLength */ \ + CS_INTERFACE, /* bDescriptorType */ \ + AC_DESCRIPTOR_FEATURE_UNIT, /* bDescriptorSubtype */\ + ENTITY_ID(entity), /* bUnitID */ \ + CONNECTED_ENTITY_ID(entity, data_source), /* bSourceID */ \ + FEATURE_UNIT_CONTROLS_ARRAYS(entity), /* bmaControls 0..ch */ \ + 0x00, /* iFeature */ + #define ENTITY_HEADER(entity) \ IF_ENABLED(DT_NODE_HAS_COMPAT(entity, zephyr_uac2_clock_source), ( \ CLOCK_SOURCE_DESCRIPTOR(entity) \ @@ -286,6 +344,9 @@ )) \ IF_ENABLED(DT_NODE_HAS_COMPAT(entity, zephyr_uac2_output_terminal), ( \ OUTPUT_TERMINAL_DESCRIPTOR(entity) \ + )) \ + IF_ENABLED(DT_NODE_HAS_COMPAT(entity, zephyr_uac2_feature_unit), ( \ + FEATURE_UNIT_DESCRIPTOR(entity) \ )) #define ENTITY_HEADER_ARRAYS(entity) \ @@ -318,6 +379,23 @@ (FORMAT_TYPE_I), (FORMAT_TYPE_IV)) #define AUDIO_STREAMING_FORMATS(node) U32_LE(0x00000001) +#define FEATURE_UNIT_CHANNEL_CLUSTER(node) \ + IF_ENABLED(DT_NODE_HAS_COMPAT(DT_PROP(node, data_source), \ + zephyr_uac2_input_terminal), ( \ + DT_PROP(node, data_source) \ + )) + +/* Track back Output Terminal data source to entity that has channel cluster */ +#define OUTPUT_TERMINAL_CHANNEL_CLUSTER(node) \ + IF_ENABLED(DT_NODE_HAS_COMPAT(DT_PROP(node, data_source), \ + zephyr_uac2_input_terminal), ( \ + DT_PROP(node, data_source) \ + )) \ + IF_ENABLED(DT_NODE_HAS_COMPAT(DT_PROP(node, data_source), \ + zephyr_uac2_feature_unit), ( \ + FEATURE_UNIT_CHANNEL_CLUSTER(DT_PROP(node, data_source))\ + )) + /* If AudioStreaming is linked to input terminal, obtain the channel cluster * configuration from the linked terminal. Otherwise (it has to be connected * to output terminal) obtain the channel cluster configuration from data source @@ -329,8 +407,8 @@ DT_PROP(node, linked_terminal) \ )) \ IF_ENABLED(DT_NODE_HAS_COMPAT(DT_PROP(node, linked_terminal), \ - zephyr_uac2_output_terminal), ( \ - DT_PROP(DT_PROP(node, linked_terminal), data_source) \ + zephyr_uac2_output_terminal), (OUTPUT_TERMINAL_CHANNEL_CLUSTER( \ + DT_PROP(node, linked_terminal)) \ )) #define AUDIO_STREAMING_NUM_SPATIAL_LOCATIONS(node) \ @@ -928,6 +1006,42 @@ DT_NODE_HAS_COMPAT(DT_PROP(entity, assoc_terminal), \ zephyr_uac2_input_terminal)) +#define VALIDATE_OUTPUT_TERMINAL_DATA_SOURCE(entity) \ + UTIL_OR(DT_NODE_HAS_COMPAT(DT_PROP(entity, data_source), \ + zephyr_uac2_input_terminal), \ + DT_NODE_HAS_COMPAT(DT_PROP(entity, data_source), \ + zephyr_uac2_feature_unit)) + +#define VALIDATE_FEATURE_UNIT_DATA_SOURCE(entity) \ + DT_NODE_HAS_COMPAT(DT_PROP(entity, data_source), \ + zephyr_uac2_input_terminal) + +#define BUILD_ASSERT_FEATURE_UNIT_CONTROL(fu, control) \ + BUILD_ASSERT(UTIL_OR(UTIL_NOT(DT_NODE_HAS_PROP(fu, control)), \ + DT_PROP_LEN(fu, control) <= 1 + FEATURE_UNIT_NUM_CHANNELS(fu)), \ + "Feature Unit " DT_NODE_PATH(fu) " has " \ + STRINGIFY(FEATURE_UNIT_NUM_CHANNELS(fu)) " logical channel(s) " \ + "but its property " #control " has " \ + STRINGIFY(DT_PROP_LEN(fu, control)) " values" \ + ); + +#define BUILD_ASSERT_FEATURE_UNIT_CONTROLS_LENGTH(entity) \ + BUILD_ASSERT_FEATURE_UNIT_CONTROL(entity, mute_control) \ + BUILD_ASSERT_FEATURE_UNIT_CONTROL(entity, volume_control) \ + BUILD_ASSERT_FEATURE_UNIT_CONTROL(entity, bass_control) \ + BUILD_ASSERT_FEATURE_UNIT_CONTROL(entity, mid_control) \ + BUILD_ASSERT_FEATURE_UNIT_CONTROL(entity, treble_control) \ + BUILD_ASSERT_FEATURE_UNIT_CONTROL(entity, graphic_equalizer_control) \ + BUILD_ASSERT_FEATURE_UNIT_CONTROL(entity, automatic_gain_control) \ + BUILD_ASSERT_FEATURE_UNIT_CONTROL(entity, delay_control) \ + BUILD_ASSERT_FEATURE_UNIT_CONTROL(entity, bass_boost_control) \ + BUILD_ASSERT_FEATURE_UNIT_CONTROL(entity, loudness_control) \ + BUILD_ASSERT_FEATURE_UNIT_CONTROL(entity, input_gain_control) \ + BUILD_ASSERT_FEATURE_UNIT_CONTROL(entity, input_gain_pad_control) \ + BUILD_ASSERT_FEATURE_UNIT_CONTROL(entity, phase_inverter_control) \ + BUILD_ASSERT_FEATURE_UNIT_CONTROL(entity, underflow_control) \ + BUILD_ASSERT_FEATURE_UNIT_CONTROL(entity, overflow_control) + #define NEEDS_SUBSLOT_SIZE_AND_BIT_RESOLUTION(node) UTIL_OR( \ UTIL_OR(IS_EQ(AUDIO_STREAMING_FORMAT_TYPE(node), FORMAT_TYPE_I), \ IS_EQ(AUDIO_STREAMING_FORMAT_TYPE(node), FORMAT_TYPE_III)), \ @@ -973,6 +1087,13 @@ IF_ENABLED(DT_NODE_HAS_COMPAT(node, zephyr_uac2_output_terminal), ( \ BUILD_ASSERT(VALIDATE_OUTPUT_TERMINAL_ASSOCIATION(node), \ "Terminals associations must be Input<->Output"); \ + BUILD_ASSERT(VALIDATE_OUTPUT_TERMINAL_DATA_SOURCE(node), \ + "Unsupported Output Terminal data source"); \ + )) \ + IF_ENABLED(DT_NODE_HAS_COMPAT(node, zephyr_uac2_feature_unit), ( \ + BUILD_ASSERT(VALIDATE_FEATURE_UNIT_DATA_SOURCE(node), \ + "Unsupported Feature Unit data source"); \ + BUILD_ASSERT_FEATURE_UNIT_CONTROLS_LENGTH(node); \ )) \ IF_ENABLED(DT_NODE_HAS_COMPAT(node, zephyr_uac2_audio_streaming), ( \ BUILD_ASSERT(VALIDATE_LINKED_TERMINAL(node), \ From 7c7383cabf6019b7e85348b8cf5b30bc5bff27f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Tue, 8 Oct 2024 15:05:24 +0200 Subject: [PATCH 0827/4482] tests: usb: uac2: Test Feature Unit descriptor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Insert Feature Units in between: * USB Streaming Input Terminal and Headphones Output Terminal * Microphone Input Terminal and USB Streaming Output Terminal The Feature Units have Mute control only on the Primary channel 0. The headphones Feature Unit also has Automatic Gain control on all channels while microphone Feature Unit has Automatic Gain control only on the Logichal channel 1. Signed-off-by: Tomasz Moń --- tests/subsys/usb/uac2/app.overlay | 23 +++++++++++-- tests/subsys/usb/uac2/src/uac2_desc.c | 49 ++++++++++++++++++++++----- 2 files changed, 61 insertions(+), 11 deletions(-) diff --git a/tests/subsys/usb/uac2/app.overlay b/tests/subsys/usb/uac2/app.overlay index 7b7585209a905..52db720a29ca5 100644 --- a/tests/subsys/usb/uac2/app.overlay +++ b/tests/subsys/usb/uac2/app.overlay @@ -29,9 +29,19 @@ front-right; }; + out_feature_unit: out_feature_unit { + compatible = "zephyr,uac2-feature-unit"; + data-source = <&out_terminal>; + mute-control = "host-programmable"; + automatic-gain-control = + "host-programmable" /* Primary */, + "host-programmable" /* Channel 1 */, + "host-programmable" /* Channel 2 */; + }; + headphones_output: headphones { compatible = "zephyr,uac2-output-terminal"; - data-source = <&out_terminal>; + data-source = <&out_feature_unit>; clock-source = <&uac_aclk>; terminal-type = ; assoc-terminal = <&mic_input>; @@ -50,9 +60,18 @@ front-left; }; + in_feature_unit: in_feature_unit { + compatible = "zephyr,uac2-feature-unit"; + data-source = <&mic_input>; + mute-control = "host-programmable"; + automatic-gain-control = + "not-present" /* Primary */, + "host-programmable" /* Channel 1 */; + }; + in_terminal: in_terminal { compatible = "zephyr,uac2-output-terminal"; - data-source = <&mic_input>; + data-source = <&in_feature_unit>; clock-source = <&uac_aclk>; terminal-type = ; }; diff --git a/tests/subsys/usb/uac2/src/uac2_desc.c b/tests/subsys/usb/uac2/src/uac2_desc.c index 77474649c4cf2..c0c76efabbaac 100644 --- a/tests/subsys/usb/uac2/src/uac2_desc.c +++ b/tests/subsys/usb/uac2/src/uac2_desc.c @@ -18,7 +18,7 @@ static const uint8_t reference_ac_interface_descriptor[] = { 0x01, /* bDescriptorSubtype = HEADER */ 0x00, 0x02, /* bcdADC = 02.00 */ 0x04, /* bCategory = HEADSET */ - 0x4b, 0x00, /* wTotalLength = 0x4b = 75 */ + 0x6b, 0x00, /* wTotalLength = 0x6b = 107 */ 0x00, /* bmControls = Latency Control not present */ }; @@ -50,15 +50,28 @@ static const uint8_t reference_ac_hp_input_terminal_descriptor[] = { 0x00, /* iTerminal = 0 (no string descriptor) */ }; +static const uint8_t reference_ac_hp_feature_unit_descriptor[] = { + /* 4.7.2.8 Feature Unit Descriptor */ + 0x12, /* bLength = 18 */ + 0x24, /* bDescriptorType = CS_INTERFACE */ + 0x06, /* bDescriptorSubtype = FEATURE_UNIT */ + 0x03, /* bUnitID = 3 */ + 0x02, /* bSourceID = 2 (streaming input) */ + 0x03, 0x30, 0x00, 0x00, /* bmaControls(0): Mute and Auto Gain */ + 0x00, 0x30, 0x00, 0x00, /* bmaControls(1): Auto Gain */ + 0x00, 0x30, 0x00, 0x00, /* bmaControls(2): Auto Gain */ + 0x00, /* iFeature = 0 (no string descriptor)*/ +}; + static const uint8_t reference_ac_hp_output_terminal_descriptor[] = { /* 4.7.2.5 Output Terminal Descriptor */ 0x0c, /* bLength = 12 */ 0x24, /* bDescriptorType = CS_INTERFACE */ 0x03, /* bDescriptorSubtype = OUTPUT_TERMINAL */ - 0x03, /* bTerminalID = 3 */ + 0x04, /* bTerminalID = 4 */ 0x02, 0x04, /* wTerminalType = 0x0402 (Headset) */ - 0x04, /* bAssocTerminal = 4 (headset input) */ - 0x02, /* bSourceID = 2 (streaming input) */ + 0x05, /* bAssocTerminal = 5 (headset input) */ + 0x03, /* bSourceID = 3 (headphones feature unit) */ 0x01, /* bCSourceID = 1 (main clock) */ 0x00, 0x00, /* bmControls = none present */ 0x00, /* iTerminal = 0 (no string descriptor) */ @@ -69,9 +82,9 @@ static const uint8_t reference_ac_mic_input_terminal_descriptor[] = { 0x11, /* bLength = 17 */ 0x24, /* bDescriptorType = CS_INTERFACE */ 0x02, /* bDescriptorSubtype = INPUT_TERMINAL */ - 0x04, /* bTerminalID = 4 */ + 0x05, /* bTerminalID = 5 */ 0x02, 0x04, /* wTerminalType = 0x0402 (Headset) */ - 0x03, /* bAssocTerminal = 3 (headset output) */ + 0x04, /* bAssocTerminal = 4 (headset output) */ 0x01, /* bCSourceID = 1 (main clock) */ 0x01, /* bNrChannels = 1 */ 0x01, 0x00, 0x00, 0x00, /* bmChannelConfig = Front Left */ @@ -80,15 +93,27 @@ static const uint8_t reference_ac_mic_input_terminal_descriptor[] = { 0x00, /* iTerminal = 0 (no string descriptor) */ }; +static const uint8_t reference_ac_mic_feature_unit_descriptor[] = { + /* 4.7.2.8 Feature Unit Descriptor */ + 0x0e, /* bLength = 14 */ + 0x24, /* bDescriptorType = CS_INTERFACE */ + 0x06, /* bDescriptorSubtype = FEATURE_UNIT */ + 0x06, /* bUnitID = 6 */ + 0x05, /* bSourceID = 5 (headset input) */ + 0x03, 0x00, 0x00, 0x00, /* bmaControls(0): Mute */ + 0x00, 0x30, 0x00, 0x00, /* bmaControls(1): Auto Gain */ + 0x00, /* iFeature = 0 (no string descriptor)*/ +}; + static const uint8_t reference_ac_mic_output_terminal_descriptor[] = { /* 4.7.2.5 Output Terminal Descriptor */ 0x0c, /* bLength = 12 */ 0x24, /* bDescriptorType = CS_INTERFACE */ 0x03, /* bDescriptorSubtype = OUTPUT_TERMINAL */ - 0x05, /* bTerminalID = 5 */ + 0x07, /* bTerminalID = 7 */ 0x01, 0x01, /* wTerminalType = 0x0101 (USB streaming) */ 0x00, /* bAssocTerminal = 0 (not associated) */ - 0x04, /* bSourceID = 4 (headset input) */ + 0x06, /* bSourceID = 6 (mic feature unit) */ 0x01, /* bCSourceID = 1 (main clock) */ 0x00, 0x00, /* bmControls = none present */ 0x00, /* iTerminal = 0 (no string descriptor) */ @@ -100,7 +125,7 @@ static const uint8_t reference_as_in_cs_general_descriptor[] = { 0x10, /* bLength = 16 */ 0x24, /* bDescriptorType = CS_INTERFACE */ 0x01, /* bDescriptorSubtype = AS_GENERAL */ - 0x05, /* bTerminalLink = 5 (USB streaming output) */ + 0x07, /* bTerminalLink = 7 (USB streaming output) */ 0x00, /* bmControls = non present */ 0x01, /* bFormatType = 1 */ 0x01, 0x00, 0x00, 0x00, /* bmFormats = PCM */ @@ -308,12 +333,18 @@ static void test_uac2_descriptors(const struct usb_desc_header **descriptors, zassert_mem_equal(reference_ac_hp_input_terminal_descriptor, *ptr, ARRAY_SIZE(reference_ac_hp_input_terminal_descriptor)); ptr++; + zassert_mem_equal(reference_ac_hp_feature_unit_descriptor, *ptr, + ARRAY_SIZE(reference_ac_hp_feature_unit_descriptor)); + ptr++; zassert_mem_equal(reference_ac_hp_output_terminal_descriptor, *ptr, ARRAY_SIZE(reference_ac_hp_output_terminal_descriptor)); ptr++; zassert_mem_equal(reference_ac_mic_input_terminal_descriptor, *ptr, ARRAY_SIZE(reference_ac_mic_input_terminal_descriptor)); ptr++; + zassert_mem_equal(reference_ac_mic_feature_unit_descriptor, *ptr, + ARRAY_SIZE(reference_ac_mic_feature_unit_descriptor)); + ptr++; zassert_mem_equal(reference_ac_mic_output_terminal_descriptor, *ptr, ARRAY_SIZE(reference_ac_mic_output_terminal_descriptor)); ptr++; From 6ec8a53c9bc65899bd944d8631bea2eaee06bab0 Mon Sep 17 00:00:00 2001 From: Stoyan Bogdanov Date: Tue, 8 Oct 2024 23:00:09 +0300 Subject: [PATCH 0828/4482] tests: drivers: build_all: gpio: Correct max14906 and max14916 compat Replace wrong compatibility strings for max14906 and max14916. Fix wrong addressees for max14906 and max14916. Signed-off-by: Stoyan Bogdanov --- tests/drivers/build_all/gpio/app.overlay | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/drivers/build_all/gpio/app.overlay b/tests/drivers/build_all/gpio/app.overlay index e023736fe339a..c834f27621f45 100644 --- a/tests/drivers/build_all/gpio/app.overlay +++ b/tests/drivers/build_all/gpio/app.overlay @@ -443,8 +443,8 @@ #gpio-cells = <2>; }; - test_spi_max14906: max14906@5 { - compatible = "adi,max1906-gpio"; + test_spi_max14906: max14906@6 { + compatible = "adi,max14906-gpio"; status = "okay"; reg = <0x06>; spi-max-frequency = <0>; @@ -463,8 +463,8 @@ en-gpios = <&test_gpio 0 0>; }; - test_spi_max14916: max14916@6 { - compatible = "adi,max1916-gpio"; + test_spi_max14916: max14916@7 { + compatible = "adi,max14916-gpio"; status = "okay"; reg = <0x07>; spi-max-frequency = <0>; From 7f9be548970627306b8bdb65202a1c0f5754d9d2 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 9 Oct 2024 23:16:38 +0530 Subject: [PATCH 0829/4482] Revert "drivers: nrfwifi: Fix rebuilding when FW blobs are changes" This reverts commit e2e96acebfef43fe619d315587592b8885a1187e. This will be properly fixes by adding a target for nRF70.bin and removing INCBIN approach. Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/CMakeLists.txt | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/drivers/wifi/nrfwifi/CMakeLists.txt b/drivers/wifi/nrfwifi/CMakeLists.txt index 60c406d343958..3c912419a9cce 100644 --- a/drivers/wifi/nrfwifi/CMakeLists.txt +++ b/drivers/wifi/nrfwifi/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 # -zephyr_library_named(nrfwifi) +zephyr_library() set(OS_AGNOSTIC_BASE ${ZEPHYR_HAL_NORDIC_MODULE_DIR}/drivers/nrf_wifi) set(FW_BINS_BASE ${ZEPHYR_HAL_NORDIC_MODULE_DIR}/zephyr/blobs/wifi_fw_bins) @@ -169,22 +169,6 @@ else() zephyr_compile_definitions( -DCONFIG_NRF_WIFI_FW_BIN=${NRF70_PATCH} ) - - # Rebuild fw_load.c whenever the firmware binary changes - # a bit crude way to do it, but it works - add_custom_command( - OUTPUT ${CMAKE_SOURCE_DIR}/src/fw_load.c - COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_SOURCE_DIR}/src/fw_load.c - DEPENDS ${NRF70_PATCH} - COMMENT "Checking firmware blobs ${NRF70_PATCH}" - ) - - add_custom_target( - check_firmware_blobs ALL - DEPENDS ${CMAKE_SOURCE_DIR}/src/fw_load.c - ) - - add_dependencies(nrfwifi check_firmware_blobs) endif() From b40cb4c46c093c20aba59034b385786e871560fd Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 9 Oct 2024 23:52:44 +0530 Subject: [PATCH 0830/4482] drivers: nrfwifi: Use Zephyr tooling to load nRF70 FW file Instead of relying on INCBIN macros which do not properly add dependencies, e.g., modifying FW file doesn't trigger rebuild. Use the Zephyr cmake tooling to load the FW patch file as a header. This also improves memory report where the patch target is clearly visible instead of a hidden section. Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/CMakeLists.txt | 11 +++++-- drivers/wifi/nrfwifi/src/fw_load.c | 49 +++-------------------------- 2 files changed, 12 insertions(+), 48 deletions(-) diff --git a/drivers/wifi/nrfwifi/CMakeLists.txt b/drivers/wifi/nrfwifi/CMakeLists.txt index 3c912419a9cce..c3b0efef82bbf 100644 --- a/drivers/wifi/nrfwifi/CMakeLists.txt +++ b/drivers/wifi/nrfwifi/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 # -zephyr_library() +zephyr_library_named(nrfwifi) set(OS_AGNOSTIC_BASE ${ZEPHYR_HAL_NORDIC_MODULE_DIR}/drivers/nrf_wifi) set(FW_BINS_BASE ${ZEPHYR_HAL_NORDIC_MODULE_DIR}/zephyr/blobs/wifi_fw_bins) @@ -166,8 +166,13 @@ else() ------------------------------------------------------------------------") endif() - zephyr_compile_definitions( - -DCONFIG_NRF_WIFI_FW_BIN=${NRF70_PATCH} + set(gen_inc_dir ${ZEPHYR_BINARY_DIR}/misc/generated) + zephyr_include_directories(${gen_inc_dir}) + set(gen_dir ${gen_inc_dir}/nrf70_fw_patch) + generate_inc_file_for_target( + nrfwifi + ${NRF70_PATCH} + ${gen_dir}/nrf70.bin.inc ) endif() diff --git a/drivers/wifi/nrfwifi/src/fw_load.c b/drivers/wifi/nrfwifi/src/fw_load.c index 6bf4c85193ffc..9204d295d309a 100644 --- a/drivers/wifi/nrfwifi/src/fw_load.c +++ b/drivers/wifi/nrfwifi/src/fw_load.c @@ -17,57 +17,16 @@ LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL); #include - -/* INCBIN macro Taken from https://gist.github.com/mmozeiko/ed9655cf50341553d282 */ -#define STR2(x) #x -#define STR(x) STR2(x) - -#ifdef __APPLE__ -#define USTR(x) "_" STR(x) -#else -#define USTR(x) STR(x) -#endif - -#ifdef _WIN32 -#define INCBIN_SECTION ".rdata, \"dr\"" -#elif defined __APPLE__ -#define INCBIN_SECTION "__TEXT,__const" -#else -#define INCBIN_SECTION ".rodata.*" -#endif - -/* this aligns start address to 16 and terminates byte array with explicit 0 - * which is not really needed, feel free to change it to whatever you want/need - */ -#define INCBIN(prefix, name, file) \ - __asm__(".section " INCBIN_SECTION "\n" \ - ".global " USTR(prefix) "_" STR(name) "_start\n" \ - ".balign 16\n" \ - USTR(prefix) "_" STR(name) "_start:\n" \ - ".incbin \"" file "\"\n" \ - \ - ".global " STR(prefix) "_" STR(name) "_end\n" \ - ".balign 1\n" \ - USTR(prefix) "_" STR(name) "_end:\n" \ - ".byte 0\n" \ - ); \ - extern __aligned(16) const char prefix ## _ ## name ## _start[]; \ - extern const char prefix ## _ ## name ## _end[]; - -INCBIN(_bin, nrf70_fw, STR(CONFIG_NRF_WIFI_FW_BIN)); +static const char fw_patch[] = { + #include +}; enum nrf_wifi_status nrf_wifi_fw_load(void *rpu_ctx) { enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; struct nrf_wifi_fmac_fw_info fw_info = { 0 }; - uint8_t *fw_start; - uint8_t *fw_end; - - fw_start = (uint8_t *)_bin_nrf70_fw_start; - fw_end = (uint8_t *)_bin_nrf70_fw_end; - status = nrf_wifi_fmac_fw_parse(rpu_ctx, fw_start, fw_end - fw_start, - &fw_info); + status = nrf_wifi_fmac_fw_parse(rpu_ctx, fw_patch, sizeof(fw_patch), &fw_info); if (status != NRF_WIFI_STATUS_SUCCESS) { LOG_ERR("%s: nrf_wifi_fmac_fw_parse failed", __func__); return status; From f4e07d15d61c0d4b6101037f76f8481c1eee47de Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Sun, 6 Oct 2024 16:00:32 -0400 Subject: [PATCH 0831/4482] sys: util: define bits per byte, nibble, and nibbles per byte Collect some common bit-widths redefined in various locations and put them under sys/util.h . Signed-off-by: Chris Friedt --- drivers/clock_control/clock_control_litex.h | 4 ++-- drivers/fpga/fpga_ice40.c | 13 +------------ include/zephyr/sys/util.h | 9 +++++++++ subsys/shell/modules/devmem_service.c | 5 +---- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/drivers/clock_control/clock_control_litex.h b/drivers/clock_control/clock_control_litex.h index 8a1b25de40071..1263705989ef2 100644 --- a/drivers/clock_control/clock_control_litex.h +++ b/drivers/clock_control/clock_control_litex.h @@ -7,11 +7,11 @@ #ifndef LITEX_MMCM_H #define LITEX_MMCM_H +#include #include /* Common values */ -#define PICOS_IN_SEC 1000000000000 -#define BITS_PER_BYTE 8 +#define PICOS_IN_SEC 1000000000000 /* MMCM specific numbers */ #define CLKOUT_MAX 7 diff --git a/drivers/fpga/fpga_ice40.c b/drivers/fpga/fpga_ice40.c index eabda03db5528..9a5d6aa87aa46 100644 --- a/drivers/fpga/fpga_ice40.c +++ b/drivers/fpga/fpga_ice40.c @@ -19,6 +19,7 @@ #include #include #include +#include /* * Note: When loading a bitstream, the iCE40 has a 'quirk' in that the CS @@ -50,18 +51,6 @@ #define FPGA_ICE40_LOAD_MODE_SPI 0 #define FPGA_ICE40_LOAD_MODE_GPIO 1 -#ifndef BITS_PER_NIBBLE -#define BITS_PER_NIBBLE 4 -#endif - -#ifndef BITS_PER_BYTE -#define BITS_PER_BYTE 8 -#endif - -#ifndef NIBBLES_PER_BYTE -#define NIBBLES_PER_BYTE (BITS_PER_BYTE / BITS_PER_NIBBLE) -#endif - /* * Values in Hz, intentionally to be comparable with the spi-max-frequency * property from DT bindings in spi-device.yaml. diff --git a/include/zephyr/sys/util.h b/include/zephyr/sys/util.h index 6fba21dc16ac6..c0c69b3143341 100644 --- a/include/zephyr/sys/util.h +++ b/include/zephyr/sys/util.h @@ -57,6 +57,15 @@ extern "C" { # error Missing required predefined macros for BITS_PER_LONG calculation #endif +/** Number of bits in a byte. */ +#define BITS_PER_BYTE (__CHAR_BIT__) + +/** Number of bits in a nibble. */ +#define BITS_PER_NIBBLE (__CHAR_BIT__ / 2) + +/** Number of nibbles in a byte. */ +#define NIBBLES_PER_BYTE (BITS_PER_BYTE / BITS_PER_NIBBLE) + /** Number of bits in a long int. */ #define BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__) diff --git a/subsys/shell/modules/devmem_service.c b/subsys/shell/modules/devmem_service.c index e1ebaee7ef374..c2c37215d3a36 100644 --- a/subsys/shell/modules/devmem_service.c +++ b/subsys/shell/modules/devmem_service.c @@ -18,6 +18,7 @@ #include #include #include +#include #ifndef CONFIG_NATIVE_LIBC extern void getopt_init(void); @@ -39,10 +40,6 @@ static bool littleendian; #define CHAR_CAN 0x18 #define CHAR_DC1 0x11 -#ifndef BITS_PER_BYTE -#define BITS_PER_BYTE 8 -#endif - static int memory_dump(const struct shell *sh, mem_addr_t phys_addr, size_t size, uint8_t width) { uint32_t value; From 8ee66a151e38178a206e699c23470760e23328b7 Mon Sep 17 00:00:00 2001 From: Romain Pelletant Date: Fri, 27 Sep 2024 14:33:50 +0200 Subject: [PATCH 0832/4482] drivers: i2c: i2c_gecko: add exclusive access - Add exclusive and atomic access to resource Fixes #79110 Signed-off-by: Romain Pelletant --- drivers/i2c/i2c_gecko.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/i2c/i2c_gecko.c b/drivers/i2c/i2c_gecko.c index 838e42d038857..e2d44f3989c40 100644 --- a/drivers/i2c/i2c_gecko.c +++ b/drivers/i2c/i2c_gecko.c @@ -37,6 +37,7 @@ struct i2c_gecko_config { struct i2c_gecko_data { struct k_sem device_sync_sem; + struct k_sem bus_lock; uint32_t dev_config; #if defined(CONFIG_I2C_TARGET) struct i2c_target_config *target_cfg; @@ -68,6 +69,8 @@ static int i2c_gecko_configure(const struct device *dev, uint32_t dev_config_raw return -EINVAL; } + k_sem_take(&data->bus_lock, K_FOREVER); + data->dev_config = dev_config_raw; i2cInit.freq = baudrate; @@ -77,6 +80,8 @@ static int i2c_gecko_configure(const struct device *dev, uint32_t dev_config_raw I2C_Init(base, &i2cInit); + k_sem_give(&data->bus_lock); + return 0; } @@ -93,6 +98,8 @@ static int i2c_gecko_transfer(const struct device *dev, struct i2c_msg *msgs, ui return 0; } + k_sem_take(&data->bus_lock, K_FOREVER); + seq.addr = addr << 1; do { @@ -137,6 +144,8 @@ static int i2c_gecko_transfer(const struct device *dev, struct i2c_msg *msgs, ui } while (num_msgs); finish: + k_sem_give(&data->bus_lock); + if (ret != i2cTransferDone) { ret = -EIO; } @@ -145,10 +154,16 @@ static int i2c_gecko_transfer(const struct device *dev, struct i2c_msg *msgs, ui static int i2c_gecko_init(const struct device *dev) { + struct i2c_gecko_data *data = dev->data; const struct i2c_gecko_config *config = dev->config; uint32_t bitrate_cfg; int error; + /* Initialize mutex to guarantee that each transaction + * is atomic and has exclusive access to the I2C bus + */ + k_sem_init(&data->bus_lock, 1, 1); + CMU_ClockEnable(config->clock, true); error = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); From b773306a56927b764c85695c446fe1ee1c65b6fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 18 Sep 2024 12:33:42 +0200 Subject: [PATCH 0833/4482] drivers: sensor: nordic: qdec: Add runtime PM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add runtime PM to the driver. Signed-off-by: Krzysztof Chruściński --- drivers/sensor/nordic/qdec_nrfx/qdec_nrfx.c | 87 +++++++++------------ 1 file changed, 35 insertions(+), 52 deletions(-) diff --git a/drivers/sensor/nordic/qdec_nrfx/qdec_nrfx.c b/drivers/sensor/nordic/qdec_nrfx/qdec_nrfx.c index dc70c27d41724..e7f014de0d080 100644 --- a/drivers/sensor/nordic/qdec_nrfx/qdec_nrfx.c +++ b/drivers/sensor/nordic/qdec_nrfx/qdec_nrfx.c @@ -192,81 +192,64 @@ static const struct sensor_driver_api qdec_nrfx_driver_api = { .trigger_set = qdec_nrfx_trigger_set, }; -#ifdef CONFIG_PM_DEVICE -static int qdec_nrfx_pm_action(const struct device *dev, - enum pm_device_action action) +static void qdec_pm_suspend(const struct device *dev) { const struct qdec_nrfx_config *config = dev->config; - int ret = 0; + nrfx_qdec_disable(&config->qdec); + qdec_nrfx_gpio_ctrl(dev, false); + + (void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_SLEEP); +} + +static void qdec_pm_resume(const struct device *dev) +{ + const struct qdec_nrfx_config *config = dev->config; + + (void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); + qdec_nrfx_gpio_ctrl(dev, true); + nrfx_qdec_enable(&config->qdec); +} + +static int qdec_nrfx_pm_action(const struct device *dev, enum pm_device_action action) +{ switch (action) { case PM_DEVICE_ACTION_RESUME: - ret = pinctrl_apply_state(config->pcfg, - PINCTRL_STATE_DEFAULT); - if (ret < 0) { - return ret; - } - qdec_nrfx_gpio_ctrl(dev, true); - nrfx_qdec_enable(&config->qdec); - break; - - case PM_DEVICE_ACTION_TURN_OFF: - /* device must be uninitialized */ - nrfx_qdec_uninit(&config->qdec); - ret = pinctrl_apply_state(config->pcfg, - PINCTRL_STATE_SLEEP); - if (ret < 0) { - return ret; - } + qdec_pm_resume(dev); break; case PM_DEVICE_ACTION_SUSPEND: - /* device must be suspended */ - nrfx_qdec_disable(&config->qdec); - qdec_nrfx_gpio_ctrl(dev, false); - ret = pinctrl_apply_state(config->pcfg, - PINCTRL_STATE_SLEEP); - if (ret < 0) { - return ret; + if (IS_ENABLED(CONFIG_PM_DEVICE)) { + qdec_pm_suspend(dev); } break; default: return -ENOTSUP; + break; } - return ret; + return 0; } -#endif /* CONFIG_PM_DEVICE */ static int qdec_nrfx_init(const struct device *dev) { - const struct qdec_nrfx_config *dev_config = dev->config; - - dev_config->irq_connect(); + const struct qdec_nrfx_config *config = dev->config; + nrfx_err_t nerr; - int err = pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_DEFAULT); + config->irq_connect(); - if (err < 0) { - return err; + nerr = nrfx_qdec_init(&config->qdec, &config->config, qdec_nrfx_event_handler, (void *)dev); + if (nerr != NRFX_SUCCESS) { + return (nerr == NRFX_ERROR_INVALID_STATE) ? -EBUSY : -EFAULT; } - nrfx_err_t nerr = nrfx_qdec_init(&dev_config->qdec, - &dev_config->config, - qdec_nrfx_event_handler, - (void *)dev); - - if (nerr == NRFX_ERROR_INVALID_STATE) { - LOG_ERR("qdec already in use"); - return -EBUSY; - } else if (nerr != NRFX_SUCCESS) { - LOG_ERR("failed to initialize qdec"); - return -EFAULT; + /* End up in suspend state. */ + qdec_nrfx_gpio_ctrl(dev, false); + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + (void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_SLEEP); } - qdec_nrfx_gpio_ctrl(dev, true); - nrfx_qdec_enable(&dev_config->qdec); - - return 0; + return pm_device_driver_init(dev, qdec_nrfx_pm_action); } #define QDEC(idx) DT_NODELABEL(qdec##idx) @@ -301,7 +284,7 @@ static int qdec_nrfx_init(const struct device *dev) .enable_pin = DT_PROP_OR(QDEC(idx), enable_pin, NRF_QDEC_PIN_NOT_CONNECTED), \ .steps = QDEC_PROP(idx, steps), \ }; \ - PM_DEVICE_DT_DEFINE(QDEC(idx), qdec_nrfx_pm_action); \ + PM_DEVICE_DT_DEFINE(QDEC(idx), qdec_nrfx_pm_action, PM_DEVICE_ISR_SAFE); \ SENSOR_DEVICE_DT_DEFINE(QDEC(idx), \ qdec_nrfx_init, \ PM_DEVICE_DT_GET(QDEC(idx)), \ From 7fc73619b4320b484ef4be2c2486d3c7d8de4f43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 18 Sep 2024 15:42:44 +0200 Subject: [PATCH 0834/4482] tests: boards: nrf: qdec: Add common configuration for nrf54l MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add common overlay for nrf54l15pdk targets. Signed-off-by: Krzysztof Chruściński --- .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 39 +---------------- .../nrf54l15dk_nrf54l15_cpuflpr.overlay | 39 +---------------- .../boards/nrf54l15pdk_nrf54l15_common.dtsi | 43 +++++++++++++++++++ 3 files changed, 45 insertions(+), 76 deletions(-) create mode 100644 tests/boards/nrf/qdec/boards/nrf54l15pdk_nrf54l15_common.dtsi diff --git a/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index 538106b38b1a5..63276a9365613 100644 --- a/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -3,41 +3,4 @@ * SPDX-License-Identifier: Apache-2.0 */ -/ { - aliases { - qdec0 = &qdec20; - qenca = &phase_a; - qencb = &phase_b; - }; - - encoder-emulate { - compatible = "gpio-leds"; - phase_a: phase_a { - gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; - }; - phase_b: phase_b { - gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&pinctrl { - qdec_pinctrl: qdec_pinctrl { - group1 { - psels = , - ; - }; - }; -}; - -&gpio1 { - status = "okay"; -}; - -&qdec20 { - status = "okay"; - pinctrl-0 = <&qdec_pinctrl>; - pinctrl-names = "default"; - steps = <127>; - led-pre = <500>; -}; +#include "nrf54l15pdk_nrf54l15_common.dtsi" diff --git a/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay b/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay index 538106b38b1a5..63276a9365613 100644 --- a/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay +++ b/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay @@ -3,41 +3,4 @@ * SPDX-License-Identifier: Apache-2.0 */ -/ { - aliases { - qdec0 = &qdec20; - qenca = &phase_a; - qencb = &phase_b; - }; - - encoder-emulate { - compatible = "gpio-leds"; - phase_a: phase_a { - gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; - }; - phase_b: phase_b { - gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; - }; - }; -}; - -&pinctrl { - qdec_pinctrl: qdec_pinctrl { - group1 { - psels = , - ; - }; - }; -}; - -&gpio1 { - status = "okay"; -}; - -&qdec20 { - status = "okay"; - pinctrl-0 = <&qdec_pinctrl>; - pinctrl-names = "default"; - steps = <127>; - led-pre = <500>; -}; +#include "nrf54l15pdk_nrf54l15_common.dtsi" diff --git a/tests/boards/nrf/qdec/boards/nrf54l15pdk_nrf54l15_common.dtsi b/tests/boards/nrf/qdec/boards/nrf54l15pdk_nrf54l15_common.dtsi new file mode 100644 index 0000000000000..538106b38b1a5 --- /dev/null +++ b/tests/boards/nrf/qdec/boards/nrf54l15pdk_nrf54l15_common.dtsi @@ -0,0 +1,43 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + aliases { + qdec0 = &qdec20; + qenca = &phase_a; + qencb = &phase_b; + }; + + encoder-emulate { + compatible = "gpio-leds"; + phase_a: phase_a { + gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; + }; + phase_b: phase_b { + gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&pinctrl { + qdec_pinctrl: qdec_pinctrl { + group1 { + psels = , + ; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&qdec20 { + status = "okay"; + pinctrl-0 = <&qdec_pinctrl>; + pinctrl-names = "default"; + steps = <127>; + led-pre = <500>; +}; From 5371effda8ff2bfc1a8e219a33c4de32ae45143d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 18 Sep 2024 15:53:28 +0200 Subject: [PATCH 0835/4482] tests: boards: nrf: qdec: Add device runtime PM configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add configuration to the test which is using runtime PM on qdec. Signed-off-by: Krzysztof Chruściński --- .../qdec/boards/nrf52840dk_nrf52840.overlay | 17 ++++- .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 17 ++++- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 17 ++++- .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 5 ++ .../nrf54l15dk_nrf54l15_cpuflpr.overlay | 5 ++ .../boards/nrf54l15pdk_nrf54l15_common.dtsi | 12 ++- tests/boards/nrf/qdec/src/main.c | 76 +++++++++++++++++++ tests/boards/nrf/qdec/testcase.yaml | 40 ++++++---- 8 files changed, 170 insertions(+), 19 deletions(-) diff --git a/tests/boards/nrf/qdec/boards/nrf52840dk_nrf52840.overlay b/tests/boards/nrf/qdec/boards/nrf52840dk_nrf52840.overlay index 4f8ea8ad31b76..f227fb95c3827 100644 --- a/tests/boards/nrf/qdec/boards/nrf52840dk_nrf52840.overlay +++ b/tests/boards/nrf/qdec/boards/nrf52840dk_nrf52840.overlay @@ -31,12 +31,27 @@ ; /* Arduino D2 */ }; }; + + qdec_sleep_pinctrl: qdec_sleep_pinctrl { + group1 { + psels = , /* Ardiuno D0 */ + ; /* Arduino D2 */ + low-power-enable; + }; + }; }; &qdec0 { status = "okay"; pinctrl-0 = <&qdec_pinctrl>; - pinctrl-names = "default"; + pinctrl-1 = <&qdec_sleep_pinctrl>; + pinctrl-names = "default", "sleep"; steps = < 127 >; led-pre = < 500 >; + zephyr,pm-device-runtime-auto; +}; + +/* To prevent enabling console receiver. */ +&uart0 { + disable-rx; }; diff --git a/tests/boards/nrf/qdec/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/boards/nrf/qdec/boards/nrf5340dk_nrf5340_cpuapp.overlay index 7f4a13f360209..ed6a5587f5b37 100644 --- a/tests/boards/nrf/qdec/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/tests/boards/nrf/qdec/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -30,12 +30,27 @@ ; /* Arduino A2 */ }; }; + + qdec_sleep_pinctrl: qdec_sleep_pinctrl { + group1 { + psels = , + ; + low-power-enable; + }; + }; }; &qdec1 { status = "okay"; pinctrl-0 = <&qdec_pinctrl>; - pinctrl-names = "default"; + pinctrl-1 = <&qdec_sleep_pinctrl>; + pinctrl-names = "default", "sleep"; steps = < 127 >; led-pre = < 500 >; + zephyr,pm-device-runtime-auto; +}; + +/* To prevent enabling console receiver. */ +&uart0 { + disable-rx; }; diff --git a/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 6b0db6ad6a8b9..0e552906a001f 100644 --- a/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -28,6 +28,14 @@ ; }; }; + + qdec_sleep_pinctrl: qdec_sleep_pinctrl { + group1 { + psels = , + ; + low-power-enable; + }; + }; }; &gpio1 { @@ -41,7 +49,14 @@ &qdec130 { status = "okay"; pinctrl-0 = <&qdec_pinctrl>; - pinctrl-names = "default"; + pinctrl-1 = <&qdec_sleep_pinctrl>; + pinctrl-names = "default", "sleep"; steps = <127>; led-pre = <500>; + zephyr,pm-device-runtime-auto; +}; + +/* To prevent enabling console receiver. */ +&uart136 { + disable-rx; }; diff --git a/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index 63276a9365613..dc39be6deb3e4 100644 --- a/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -4,3 +4,8 @@ */ #include "nrf54l15pdk_nrf54l15_common.dtsi" + +/* To prevent enabling console receiver. */ +&uart20 { + disable-rx; +}; diff --git a/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay b/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay index 63276a9365613..059222c801be2 100644 --- a/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay +++ b/tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay @@ -4,3 +4,8 @@ */ #include "nrf54l15pdk_nrf54l15_common.dtsi" + +/* To prevent enabling console receiver. */ +&uart30 { + disable-rx; +}; diff --git a/tests/boards/nrf/qdec/boards/nrf54l15pdk_nrf54l15_common.dtsi b/tests/boards/nrf/qdec/boards/nrf54l15pdk_nrf54l15_common.dtsi index 538106b38b1a5..3fa426569b8b2 100644 --- a/tests/boards/nrf/qdec/boards/nrf54l15pdk_nrf54l15_common.dtsi +++ b/tests/boards/nrf/qdec/boards/nrf54l15pdk_nrf54l15_common.dtsi @@ -28,6 +28,14 @@ ; }; }; + + qdec_sleep_pinctrl: qdec_sleep_pinctrl { + group1 { + psels = , + ; + low-power-enable; + }; + }; }; &gpio1 { @@ -37,7 +45,9 @@ &qdec20 { status = "okay"; pinctrl-0 = <&qdec_pinctrl>; - pinctrl-names = "default"; + pinctrl-1 = <&qdec_sleep_pinctrl>; + pinctrl-names = "default", "sleep"; steps = <127>; led-pre = <500>; + zephyr,pm-device-runtime-auto; }; diff --git a/tests/boards/nrf/qdec/src/main.c b/tests/boards/nrf/qdec/src/main.c index cccd92c3293ae..2ad847796e87a 100644 --- a/tests/boards/nrf/qdec/src/main.c +++ b/tests/boards/nrf/qdec/src/main.c @@ -9,6 +9,7 @@ #include #include #include +#include static K_SEM_DEFINE(sem, 0, 1); static const struct gpio_dt_spec phase_a = GPIO_DT_SPEC_GET(DT_ALIAS(qenca), gpios); @@ -144,6 +145,10 @@ ZTEST(qdec_sensor, test_sensor_trigger_set_and_disable) { int rc; + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_get(qdec_dev); + } + qdec_trigger.type = SENSOR_TRIG_DATA_READY; qdec_trigger.chan = SENSOR_CHAN_ALL; rc = sensor_trigger_set(qdec_dev, &qdec_trigger, qdec_trigger_handler); @@ -162,10 +167,18 @@ ZTEST(qdec_sensor, test_sensor_trigger_set_and_disable) /* emulation not working, but there maybe old trigger, ignore */ rc = k_sem_take(&sem, K_MSEC(200)); + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_put(qdec_dev); + } + /* there should be no triggers now*/ rc = k_sem_take(&sem, K_MSEC(200)); zassert_true(rc == -EAGAIN, "qdec handler should not be triggered (%d)", rc); + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_get(qdec_dev); + } + /* register empty trigger - disable trigger */ rc = sensor_trigger_set(qdec_dev, &qdec_trigger, NULL); zassert_true(rc == 0, "sensor_trigger_set failed: %d", rc); @@ -175,6 +188,10 @@ ZTEST(qdec_sensor, test_sensor_trigger_set_and_disable) /* emulation working, but handler not set, thus should not be called */ rc = k_sem_take(&sem, K_MSEC(200)); zassert_true(rc == -EAGAIN, "qdec handler should not be triggered (%d)", rc); + + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_put(qdec_dev); + } } /** @@ -188,6 +205,10 @@ ZTEST(qdec_sensor, test_sensor_trigger_set) int rc; struct sensor_value val = {0}; + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_get(qdec_dev); + } + qdec_trigger.type = SENSOR_TRIG_DATA_READY; qdec_trigger.chan = SENSOR_CHAN_ROTATION; rc = sensor_trigger_set(qdec_dev, &qdec_trigger, qdec_trigger_handler); @@ -209,6 +230,10 @@ ZTEST(qdec_sensor, test_sensor_trigger_set) TC_PRINT("QDEC reading: %d\n", val.val1); zassert_true(val.val1 != 0, "No readings from QDEC"); + + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_put(qdec_dev); + } } /** @@ -221,6 +246,10 @@ ZTEST(qdec_sensor, test_sensor_trigger_set_negative) { int rc; + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_get(qdec_dev); + } + rc = sensor_trigger_set(qdec_dev, &qdec_trigger, qdec_trigger_handler); zassume_true(rc != -ENOSYS, "sensor_trigger_set not supported"); @@ -235,6 +264,10 @@ ZTEST(qdec_sensor, test_sensor_trigger_set_negative) rc = sensor_trigger_set(qdec_dev, &qdec_trigger, qdec_trigger_handler); zassume_true(rc < 0, "sensor_trigger_set should fail due to invalid channel"); + + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_put(qdec_dev); + } } /** @@ -245,11 +278,19 @@ ZTEST(qdec_sensor, test_sensor_trigger_set_negative) */ ZTEST(qdec_sensor, test_qdec_readings) { + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_get(qdec_dev); + } + qenc_emulate_verify_reading(10, 100, true, false); qenc_emulate_verify_reading(2, 500, true, false); qenc_emulate_verify_reading(10, 200, false, false); qenc_emulate_verify_reading(1, 1000, false, true); qenc_emulate_verify_reading(1, 1000, true, true); + + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_put(qdec_dev); + } } /** @@ -263,9 +304,16 @@ ZTEST(qdec_sensor, test_sensor_channel_get_empty) int rc; struct sensor_value val = {0}; + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_get(qdec_dev); + } + rc = sensor_sample_fetch(qdec_dev); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); + /* wait for potential new readings */ + k_msleep(100); + /* get readings but ignore them, as they may include reading from time * when emulation was still working (i.e. during previous test) */ @@ -283,6 +331,10 @@ ZTEST(qdec_sensor, test_sensor_channel_get_empty) zassert_true(rc == 0, "Failed to get sample (%d)", rc); zassert_true(val.val1 == 0, "Expected no readings but got: %d", val.val1); zassert_true(val.val2 == 0, "Expected no readings but got: %d", val.val2); + + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_put(qdec_dev); + } } /** @@ -297,6 +349,10 @@ ZTEST(qdec_sensor, test_sensor_channel_get) struct sensor_value val_first = {0}; struct sensor_value val_second = {0}; + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_get(qdec_dev); + } + qenc_emulate_start(K_MSEC(10), true); /* wait for some readings*/ @@ -328,6 +384,10 @@ ZTEST(qdec_sensor, test_sensor_channel_get) "Expected the same readings: %d vs %d", val_first.val2, val_second.val2); + + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_put(qdec_dev); + } } /** @@ -341,6 +401,10 @@ ZTEST(qdec_sensor, test_sensor_channel_get_negative) int rc; struct sensor_value val = {0}; + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_get(qdec_dev); + } + qenc_emulate_start(K_MSEC(10), true); /* wait for some readings*/ @@ -353,6 +417,10 @@ ZTEST(qdec_sensor, test_sensor_channel_get_negative) zassert_true(rc < 0, "Should failed to get sample (%d)", rc); zassert_true(val.val1 == 0, "Some readings from QDEC: %d", val.val1); zassert_true(val.val2 == 0, "Some readings from QDEC: %d", val.val2); + + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_put(qdec_dev); + } } /** @@ -365,6 +433,10 @@ ZTEST(qdec_sensor, test_sensor_sample_fetch) { int rc; + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_get(qdec_dev); + } + rc = sensor_sample_fetch(qdec_dev); zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); @@ -373,6 +445,10 @@ ZTEST(qdec_sensor, test_sensor_sample_fetch) rc = sensor_sample_fetch_chan(qdec_dev, SENSOR_CHAN_MAX); zassert_true(rc < 0, "Should fail to fetch sample from invalid channel (%d)", rc); + + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_put(qdec_dev); + } } static void *setup(void) diff --git a/tests/boards/nrf/qdec/testcase.yaml b/tests/boards/nrf/qdec/testcase.yaml index 4bc634412db98..26cfd9901a50d 100644 --- a/tests/boards/nrf/qdec/testcase.yaml +++ b/tests/boards/nrf/qdec/testcase.yaml @@ -1,21 +1,31 @@ +common: + platform_allow: + - nrf52840dk/nrf52840 + - nrf5340dk/nrf5340/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l15/cpuflpr + - nrf54h20dk/nrf54h20/cpuapp + integration_platforms: + - nrf52840dk/nrf52840 + - nrf5340dk/nrf5340/cpuapp + - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15dk/nrf54l15/cpuflpr + - nrf54h20dk/nrf54h20/cpuapp + harness: ztest + harness_config: + fixture: gpio_loopback tests: drivers.sensor.qdec: tags: - drivers - sensors - qdec - platform_allow: - - nrf52840dk/nrf52840 - - nrf5340dk/nrf5340/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l15/cpuflpr - - nrf54h20dk/nrf54h20/cpuapp - integration_platforms: - - nrf52840dk/nrf52840 - - nrf5340dk/nrf5340/cpuapp - - nrf54l15dk/nrf54l15/cpuapp - - nrf54l15dk/nrf54l15/cpuflpr - - nrf54h20dk/nrf54h20/cpuapp - harness: ztest - harness_config: - fixture: gpio_loopback + drivers.sensor.qdec.pm_runtime: + tags: + - drivers + - sensors + - qdec + - pm + extra_configs: + - CONFIG_PM_DEVICE=y + - CONFIG_PM_DEVICE_RUNTIME=y From 5c3cc3730a20a073bf1252c427c01591a9a6a359 Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Mon, 9 Sep 2024 17:07:09 +0530 Subject: [PATCH 0836/4482] drivers: nrfwifi: Create separate offloaded raw tx mode Create separate offloaded raw tx mode which will work as stand-alone compile-time mode. Signed-off-by: Kapil Bhatt --- drivers/wifi/nrfwifi/CMakeLists.txt | 11 +++++++++-- drivers/wifi/nrfwifi/Kconfig.nrfwifi | 5 ++++- drivers/wifi/nrfwifi/inc/fmac_main.h | 6 +++++- drivers/wifi/nrfwifi/src/wifi_util.c | 8 ++++---- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/drivers/wifi/nrfwifi/CMakeLists.txt b/drivers/wifi/nrfwifi/CMakeLists.txt index c3b0efef82bbf..f28977d2c32d0 100644 --- a/drivers/wifi/nrfwifi/CMakeLists.txt +++ b/drivers/wifi/nrfwifi/CMakeLists.txt @@ -30,7 +30,7 @@ zephyr_include_directories_ifdef(CONFIG_NRF70_RADIO_TEST ) zephyr_include_directories_ifndef(CONFIG_NRF70_RADIO_TEST - ${OS_AGNOSTIC_BASE}/fw_if/umac_if/inc/default + {OS_AGNOSTIC_BASE}/fw_if/umac_if/inc/default ) zephyr_library_sources_ifdef(CONFIG_NRF70_SR_COEX @@ -57,12 +57,15 @@ zephyr_library_sources( src/shim.c src/work.c src/timer.c - src/fmac_main.c src/qspi/src/device.c src/qspi/src/rpu_hw_if.c src/qspi/src/ficr_prog.c ) +zephyr_library_sources_ifndef(CONFIG_NRF70_OFFLOADED_RAW_TX + src/fmac_main.c +) + zephyr_library_sources_ifdef(CONFIG_NRF_WIFI_PATCHES_BUILTIN src/fw_load.c ) @@ -231,6 +234,10 @@ zephyr_compile_definitions_ifdef(CONFIG_NRF70_RADIO_TEST -DNRF70_RADIO_TEST ) +zephyr_compile_definitions_ifdef(CONFIG_NRF70_OFFLOADED_RAW_TX + -DNRF70_OFFLOADED_RAW_TX +) + zephyr_compile_definitions_ifdef(CONFIG_NRF70_TCP_IP_CHECKSUM_OFFLOAD -DNRF70_TCP_IP_CHECKSUM_OFFLOAD ) diff --git a/drivers/wifi/nrfwifi/Kconfig.nrfwifi b/drivers/wifi/nrfwifi/Kconfig.nrfwifi index d86049eb6f022..8f70990aff193 100644 --- a/drivers/wifi/nrfwifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrfwifi/Kconfig.nrfwifi @@ -69,6 +69,9 @@ config NRF70_SCAN_ONLY config NRF70_RADIO_TEST bool "Radio test mode of the nRF70 driver" +config NRF70_OFFLOADED_RAW_TX + bool "Offloaded raw Tx mode of the nRF70 driver" + config NRF70_SYSTEM_WITH_RAW_MODES bool "nRF70 system mode with raw modes" depends on WIFI_NRF7002 || WIFI_NRF7001 @@ -83,7 +86,7 @@ config NRF70_SYSTEM_MODE_COMMON default y if NRF70_SYSTEM_MODE || NRF70_SYSTEM_WITH_RAW_MODES config NET_L2_ETHERNET - default y if !NRF70_RADIO_TEST + default y if (!NRF70_RADIO_TEST && !NRF70_OFFLOADED_RAW_TX) config HEAP_MEM_POOL_ADD_SIZE_NRF70 # Use a maximum that works for typical usecases and boards, each sample/app can override diff --git a/drivers/wifi/nrfwifi/inc/fmac_main.h b/drivers/wifi/nrfwifi/inc/fmac_main.h index 92bc2ac28f84a..c11d32c487aee 100644 --- a/drivers/wifi/nrfwifi/inc/fmac_main.h +++ b/drivers/wifi/nrfwifi/inc/fmac_main.h @@ -34,6 +34,7 @@ #define NRF70_DRIVER_VERSION "1."KERNEL_VERSION_STRING +#ifndef CONFIG_NRF70_OFFLOADED_RAW_TX #ifndef CONFIG_NRF70_RADIO_TEST struct nrf_wifi_vif_ctx_zep { const struct device *zep_dev_ctx; @@ -119,6 +120,7 @@ struct nrf_wifi_drv_priv_zep { extern struct nrf_wifi_drv_priv_zep rpu_drv_priv_zep; void nrf_wifi_scan_timeout_work(struct k_work *work); + void configure_tx_pwr_settings(struct nrf_wifi_tx_pwr_ctrl_params *tx_pwr_ctrl_params, struct nrf_wifi_tx_pwr_ceil_params *tx_pwr_ceil_params); void configure_board_dep_params(struct nrf_wifi_board_params *board_params); @@ -126,6 +128,7 @@ void set_tx_pwr_ceil_default(struct nrf_wifi_tx_pwr_ceil_params *pwr_ceil_params const char *nrf_wifi_get_drv_version(void); enum nrf_wifi_status nrf_wifi_fmac_dev_add_zep(struct nrf_wifi_drv_priv_zep *drv_priv_zep); enum nrf_wifi_status nrf_wifi_fmac_dev_rem_zep(struct nrf_wifi_drv_priv_zep *drv_priv_zep); +#endif /* !CONFIG_NRF_WIFI_BUILD_ONLY_MODE */ #ifdef CONFIG_NRF_WIFI_BUILD_ONLY_MODE inline enum nrf_wifi_status nrf_wifi_fw_load(void *rpu_ctx) { @@ -136,9 +139,10 @@ inline enum nrf_wifi_status nrf_wifi_fw_load(void *rpu_ctx) #else enum nrf_wifi_status nrf_wifi_fw_load(void *rpu_ctx); #endif /* CONFIG_NRF_WIFI_BUILD_ONLY_MODE */ +#ifndef CONFIG_NRF70_OFFLOADED_RAW_TX struct nrf_wifi_vif_ctx_zep *nrf_wifi_get_vif_ctx(struct net_if *iface); void nrf_wifi_rpu_recovery_cb(void *vif_ctx, void *event_data, unsigned int event_len); - +#endif /* !CONFIG_NRF_WIFI_BUILD_ONLY_MODE */ #endif /* __ZEPHYR_FMAC_MAIN_H__ */ diff --git a/drivers/wifi/nrfwifi/src/wifi_util.c b/drivers/wifi/nrfwifi/src/wifi_util.c index 43c527a4b7d7f..c5e2a8dedfa03 100644 --- a/drivers/wifi/nrfwifi/src/wifi_util.c +++ b/drivers/wifi/nrfwifi/src/wifi_util.c @@ -435,7 +435,7 @@ static int nrf_wifi_util_show_vers(const struct shell *sh, return status; } -#ifndef CONFIG_NRF70_RADIO_TEST +#if !defined(CONFIG_NRF70_RADIO_TEST) && !defined(CONFIG_NRF70_OFFLOADED_RAW_TX) static int nrf_wifi_util_dump_rpu_stats(const struct shell *sh, size_t argc, const char *argv[]) @@ -849,7 +849,7 @@ static int nrf_wifi_util_dump_rpu_stats(const struct shell *sh, return 0; } -#endif /* CONFIG_NRF70_RADIO_TEST */ +#endif /* !CONFIG_NRF70_RADIO_TEST && !CONFIG_NRF70_OFFLOADED_RAW_TX */ #ifdef CONFIG_NRF_WIFI_RPU_RECOVERY static int nrf_wifi_util_trigger_rpu_recovery(const struct shell *sh, @@ -964,7 +964,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE( nrf_wifi_util_show_vers, 1, 0), -#ifndef CONFIG_NRF70_RADIO_TEST +#if !defined(CONFIG_NRF70_RADIO_TEST) && !defined(CONFIG_NRF70_OFFLOADED_RAW_TX) SHELL_CMD_ARG(rpu_stats, NULL, "Display RPU stats " @@ -972,7 +972,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE( nrf_wifi_util_dump_rpu_stats, 1, 1), -#endif /* CONFIG_NRF70_RADIO_TEST */ +#endif /* !CONFIG_NRF70_RADIO_TEST && !CONFIG_NRF70_OFFLOADED_RAW_TX*/ #ifdef CONFIG_NRF_WIFI_RPU_RECOVERY SHELL_CMD_ARG(rpu_recovery_test, NULL, From 56a5ac5189ae4293b80e4bca433e7d820f09fdf0 Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Mon, 14 Oct 2024 14:13:47 +0530 Subject: [PATCH 0837/4482] manifest: update hal_nordic revision for offloaded raw tx mode Updated hal_nordic revision contains changes for offloaded raw tx mode. Signed-off-by: Kapil Bhatt --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index f735aa4bc8bdb..933a18aa09135 100644 --- a/west.yml +++ b/west.yml @@ -188,7 +188,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 4a3ba8eaca8f5255f550db7bc54dc3e23212da64 + revision: d5c70305b2389641b0a166d0714775a1b13319a2 path: modules/hal/nordic groups: - hal From 28b74947e07822d52187458b5a79a18782269e53 Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Fri, 27 Sep 2024 18:08:29 +0530 Subject: [PATCH 0838/4482] wifi: Add wrapper APIs for offloaded raw TX feature Add wrapper APIs for the offloaded raw TX feature supported by nRF70 devices. Signed-off-by: Kapil Bhatt --- drivers/wifi/nrfwifi/CMakeLists.txt | 21 +- .../wifi/nrfwifi/off_raw_tx/inc/off_raw_tx.h | 28 + .../nrfwifi/off_raw_tx/src/off_raw_tx_api.c | 482 ++++++++++++++++++ .../wifi/nrfwifi/off_raw_tx/off_raw_tx_api.h | 260 ++++++++++ 4 files changed, 788 insertions(+), 3 deletions(-) create mode 100644 drivers/wifi/nrfwifi/off_raw_tx/inc/off_raw_tx.h create mode 100644 drivers/wifi/nrfwifi/off_raw_tx/src/off_raw_tx_api.c create mode 100644 include/zephyr/drivers/wifi/nrfwifi/off_raw_tx/off_raw_tx_api.h diff --git a/drivers/wifi/nrfwifi/CMakeLists.txt b/drivers/wifi/nrfwifi/CMakeLists.txt index f28977d2c32d0..6f549b815c1ea 100644 --- a/drivers/wifi/nrfwifi/CMakeLists.txt +++ b/drivers/wifi/nrfwifi/CMakeLists.txt @@ -29,10 +29,15 @@ zephyr_include_directories_ifdef(CONFIG_NRF70_RADIO_TEST ${OS_AGNOSTIC_BASE}/fw_if/umac_if/inc/radio_test ) -zephyr_include_directories_ifndef(CONFIG_NRF70_RADIO_TEST - {OS_AGNOSTIC_BASE}/fw_if/umac_if/inc/default +zephyr_include_directories_ifdef(CONFIG_NRF70_OFFLOADED_RAW_TX + ${OS_AGNOSTIC_BASE}/fw_if/umac_if/inc/offload_raw_tx + off_raw_tx/inc ) +if(NOT CONFIG_NRF70_RADIO_TEST AND NOT CONFIG_NRF70_OFFLOADED_RAW_TX) + zephyr_include_directories(${OS_AGNOSTIC_BASE}/fw_if/umac_if/inc/default) +endif() + zephyr_library_sources_ifdef(CONFIG_NRF70_SR_COEX src/coex.c ) @@ -70,13 +75,15 @@ zephyr_library_sources_ifdef(CONFIG_NRF_WIFI_PATCHES_BUILTIN src/fw_load.c ) -zephyr_library_sources_ifndef(CONFIG_NRF70_RADIO_TEST +if(NOT CONFIG_NRF70_RADIO_TEST AND NOT CONFIG_NRF70_OFFLOADED_RAW_TX) + zephyr_library_sources( ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/rx.c ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/fmac_vif.c ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/fmac_util.c src/net_if.c ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/default/fmac_api.c ) +endif() zephyr_library_sources_ifdef(CONFIG_NET_L2_WIFI_MGMT src/wifi_mgmt_scan.c @@ -91,6 +98,12 @@ zephyr_library_sources_ifdef(CONFIG_NRF70_RADIO_TEST ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/fmac_util.c ) +zephyr_library_sources_ifdef(CONFIG_NRF70_OFFLOADED_RAW_TX + ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/offload_raw_tx/fmac_api.c + ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/fmac_util.c + off_raw_tx/src/off_raw_tx_api.c +) + zephyr_library_sources_ifdef(CONFIG_NRF70_DATA_TX ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/tx.c ${OS_AGNOSTIC_BASE}/fw_if/umac_if/src/fmac_peer.c @@ -155,6 +168,8 @@ else() set(NRF70_PATCH ${FW_BINS_BASE}/scan_only/nrf70.bin) elseif (CONFIG_NRF70_SYSTEM_WITH_RAW_MODES) set(NRF70_PATCH ${FW_BINS_BASE}/system_with_raw/nrf70.bin) + elseif(CONFIG_NRF70_OFFLOADED_RAW_TX) + set(NRF70_PATCH ${FW_BINS_BASE}/offloaded_raw_tx/nrf70.bin) else() # Error message(FATAL_ERROR "Unsupported nRF70 patch configuration") diff --git a/drivers/wifi/nrfwifi/off_raw_tx/inc/off_raw_tx.h b/drivers/wifi/nrfwifi/off_raw_tx/inc/off_raw_tx.h new file mode 100644 index 0000000000000..1cb6e25846213 --- /dev/null +++ b/drivers/wifi/nrfwifi/off_raw_tx/inc/off_raw_tx.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @brief File containing internal structures for the offloaded raw TX feature in the driver. + */ + +#include "fmac_structs_common.h" +#include "osal_api.h" + +struct nrf_wifi_ctx_zep { + void *drv_priv_zep; + void *rpu_ctx; + uint8_t mac_addr[6]; +}; + + +struct nrf_wifi_off_raw_tx_drv_priv { + struct nrf_wifi_fmac_priv *fmac_priv; + /* TODO: Replace with a linked list to handle unlimited RPUs */ + struct nrf_wifi_ctx_zep rpu_ctx_zep; + struct k_spinlock lock; +}; + +enum nrf_wifi_status nrf_wifi_fw_load(void *rpu_ctx); diff --git a/drivers/wifi/nrfwifi/off_raw_tx/src/off_raw_tx_api.c b/drivers/wifi/nrfwifi/off_raw_tx/src/off_raw_tx_api.c new file mode 100644 index 0000000000000..3b1dd0bb093fa --- /dev/null +++ b/drivers/wifi/nrfwifi/off_raw_tx/src/off_raw_tx_api.c @@ -0,0 +1,482 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @brief File containing API definitions for the Offloaded raw TX feature. + */ + +#include +#include +#include +#include +#include +#include +#include + +#define DT_DRV_COMPAT nordic_wlan +LOG_MODULE_DECLARE(wifi_nrf, CONFIG_WIFI_NRF70_LOG_LEVEL); + +struct nrf_wifi_off_raw_tx_drv_priv off_raw_tx_drv_priv; +extern const struct nrf_wifi_osal_ops nrf_wifi_os_zep_ops; + +static const int valid_data_rates[] = { 1, 2, 55, 11, 6, 9, 12, 18, 24, 36, 48, 54, + 0, 1, 2, 3, 4, 5, 6, 7, -1 }; + +/* DTS uses 1dBm as the unit for TX power, while the RPU uses 0.25dBm */ +#define MAX_TX_PWR(label) DT_PROP(DT_NODELABEL(nrf70), label) * 4 +static void configure_tx_pwr_settings(struct nrf_wifi_tx_pwr_ctrl_params *ctrl_params, + struct nrf_wifi_tx_pwr_ceil_params *ceil_params) +{ + ctrl_params->ant_gain_2g = CONFIG_NRF70_ANT_GAIN_2G; + ctrl_params->ant_gain_5g_band1 = CONFIG_NRF70_ANT_GAIN_5G_BAND1; + ctrl_params->ant_gain_5g_band2 = CONFIG_NRF70_ANT_GAIN_5G_BAND2; + ctrl_params->ant_gain_5g_band3 = CONFIG_NRF70_ANT_GAIN_5G_BAND3; + ctrl_params->band_edge_2g_lo_dss = CONFIG_NRF70_BAND_2G_LOWER_EDGE_BACKOFF_DSSS; + ctrl_params->band_edge_2g_lo_ht = CONFIG_NRF70_BAND_2G_LOWER_EDGE_BACKOFF_HT; + ctrl_params->band_edge_2g_lo_he = CONFIG_NRF70_BAND_2G_LOWER_EDGE_BACKOFF_HE; + ctrl_params->band_edge_2g_hi_dsss = CONFIG_NRF70_BAND_2G_UPPER_EDGE_BACKOFF_DSSS; + ctrl_params->band_edge_2g_hi_ht = CONFIG_NRF70_BAND_2G_UPPER_EDGE_BACKOFF_HT; + ctrl_params->band_edge_2g_hi_he = CONFIG_NRF70_BAND_2G_UPPER_EDGE_BACKOFF_HE; + ctrl_params->band_edge_5g_unii_1_lo_ht = + CONFIG_NRF70_BAND_UNII_1_LOWER_EDGE_BACKOFF_HT; + ctrl_params->band_edge_5g_unii_1_lo_he = + CONFIG_NRF70_BAND_UNII_1_LOWER_EDGE_BACKOFF_HE; + ctrl_params->band_edge_5g_unii_1_hi_ht = + CONFIG_NRF70_BAND_UNII_1_UPPER_EDGE_BACKOFF_HT; + ctrl_params->band_edge_5g_unii_1_hi_he = + CONFIG_NRF70_BAND_UNII_1_UPPER_EDGE_BACKOFF_HE; + ctrl_params->band_edge_5g_unii_2a_lo_ht = + CONFIG_NRF70_BAND_UNII_2A_LOWER_EDGE_BACKOFF_HT; + ctrl_params->band_edge_5g_unii_2a_lo_he = + CONFIG_NRF70_BAND_UNII_2A_LOWER_EDGE_BACKOFF_HE; + ctrl_params->band_edge_5g_unii_2a_hi_ht = + CONFIG_NRF70_BAND_UNII_2A_UPPER_EDGE_BACKOFF_HT; + ctrl_params->band_edge_5g_unii_2a_hi_he = + CONFIG_NRF70_BAND_UNII_2A_UPPER_EDGE_BACKOFF_HE; + ctrl_params->band_edge_5g_unii_2c_lo_ht = + CONFIG_NRF70_BAND_UNII_2C_LOWER_EDGE_BACKOFF_HT; + ctrl_params->band_edge_5g_unii_2c_lo_he = + CONFIG_NRF70_BAND_UNII_2C_LOWER_EDGE_BACKOFF_HE; + ctrl_params->band_edge_5g_unii_2c_hi_ht = + CONFIG_NRF70_BAND_UNII_2C_UPPER_EDGE_BACKOFF_HT; + ctrl_params->band_edge_5g_unii_2c_hi_he = + CONFIG_NRF70_BAND_UNII_2C_UPPER_EDGE_BACKOFF_HE; + ctrl_params->band_edge_5g_unii_3_lo_ht = + CONFIG_NRF70_BAND_UNII_3_LOWER_EDGE_BACKOFF_HT; + ctrl_params->band_edge_5g_unii_3_lo_he = + CONFIG_NRF70_BAND_UNII_3_LOWER_EDGE_BACKOFF_HE; + ctrl_params->band_edge_5g_unii_3_hi_ht = + CONFIG_NRF70_BAND_UNII_3_UPPER_EDGE_BACKOFF_HT; + ctrl_params->band_edge_5g_unii_3_hi_he = + CONFIG_NRF70_BAND_UNII_3_UPPER_EDGE_BACKOFF_HE; + ctrl_params->band_edge_5g_unii_4_lo_ht = + CONFIG_NRF70_BAND_UNII_4_LOWER_EDGE_BACKOFF_HT; + ctrl_params->band_edge_5g_unii_4_lo_he = + CONFIG_NRF70_BAND_UNII_4_LOWER_EDGE_BACKOFF_HE; + ctrl_params->band_edge_5g_unii_4_hi_ht = + CONFIG_NRF70_BAND_UNII_4_UPPER_EDGE_BACKOFF_HT; + ctrl_params->band_edge_5g_unii_4_hi_he = + CONFIG_NRF70_BAND_UNII_4_UPPER_EDGE_BACKOFF_HE; + ceil_params->max_pwr_2g_dsss = MAX_TX_PWR(wifi_max_tx_pwr_2g_dsss); + ceil_params->max_pwr_2g_mcs7 = MAX_TX_PWR(wifi_max_tx_pwr_2g_mcs7); + ceil_params->max_pwr_2g_mcs0 = MAX_TX_PWR(wifi_max_tx_pwr_2g_mcs0); +#ifndef CONFIG_NRF70_2_4G_ONLY + ceil_params->max_pwr_5g_low_mcs7 = MAX_TX_PWR(wifi_max_tx_pwr_5g_low_mcs7); + ceil_params->max_pwr_5g_mid_mcs7 = MAX_TX_PWR(wifi_max_tx_pwr_5g_mid_mcs7); + ceil_params->max_pwr_5g_high_mcs7 = MAX_TX_PWR(wifi_max_tx_pwr_5g_high_mcs7); + ceil_params->max_pwr_5g_low_mcs0 = MAX_TX_PWR(wifi_max_tx_pwr_5g_low_mcs0); + ceil_params->max_pwr_5g_mid_mcs0 = MAX_TX_PWR(wifi_max_tx_pwr_5g_mid_mcs0); + ceil_params->max_pwr_5g_high_mcs0 = MAX_TX_PWR(wifi_max_tx_pwr_5g_high_mcs0); +#endif /* CONFIG_NRF70_2_4G_ONLY */ +} + +static void configure_board_dep_params(struct nrf_wifi_board_params *board_params) +{ + board_params->pcb_loss_2g = CONFIG_NRF70_PCB_LOSS_2G; +#ifndef CONFIG_NRF70_2_4G_ONLY + board_params->pcb_loss_5g_band1 = CONFIG_NRF70_PCB_LOSS_5G_BAND1; + board_params->pcb_loss_5g_band2 = CONFIG_NRF70_PCB_LOSS_5G_BAND2; + board_params->pcb_loss_5g_band3 = CONFIG_NRF70_PCB_LOSS_5G_BAND3; +#endif /* CONFIG_NRF70_2_4G_ONLY */ +} + +#ifdef CONFIG_WIFI_FIXED_MAC_ADDRESS_ENABLED +static int bytes_from_str(uint8_t *buf, int buf_len, const char *src) +{ + size_t i; + size_t src_len = strlen(src); + char *endptr; + + for (i = 0U; i < src_len; i++) { + if (!isxdigit((unsigned char)src[i]) && + src[i] != ':') { + return -EINVAL; + } + } + + (void)memset(buf, 0, buf_len); + + for (i = 0U; i < (size_t)buf_len; i++) { + buf[i] = (uint8_t)strtol(src, &endptr, 16); + src = ++endptr; + } + + return 0; +} +#endif /* CONFIG_WIFI_FIXED_MAC_ADDRESS_ENABLED */ + +int nrf70_off_raw_tx_init(uint8_t *mac_addr) +{ + enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; + struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; + void *rpu_ctx = NULL; + struct nrf_wifi_tx_pwr_ctrl_params ctrl_params; + struct nrf_wifi_tx_pwr_ceil_params ceil_params; + struct nrf_wifi_board_params board_params; + unsigned int fw_ver = 0; + k_spinlock_key_t key; + + /* The OSAL layer needs to be initialized before any other initialization + * so that other layers (like FW IF,HW IF etc) have access to OS ops + */ + nrf_wifi_osal_init(&nrf_wifi_os_zep_ops); + + key = k_spin_lock(&off_raw_tx_drv_priv.lock); + + off_raw_tx_drv_priv.fmac_priv = nrf_wifi_fmac_off_raw_tx_init(); + + if (off_raw_tx_drv_priv.fmac_priv == NULL) { + LOG_ERR("%s: Failed to initialize nRF70 driver", + __func__); + goto err; + } + + rpu_ctx_zep = &off_raw_tx_drv_priv.rpu_ctx_zep; + + rpu_ctx_zep->drv_priv_zep = &off_raw_tx_drv_priv; + + rpu_ctx = nrf_wifi_fmac_dev_add(off_raw_tx_drv_priv.fmac_priv, + rpu_ctx_zep); + if (!rpu_ctx) { + LOG_ERR("%s: Failed to add nRF70 device", __func__); + rpu_ctx_zep = NULL; + goto err; + } + + rpu_ctx_zep->rpu_ctx = rpu_ctx; + + status = nrf_wifi_fw_load(rpu_ctx); + if (status != NRF_WIFI_STATUS_SUCCESS) { + LOG_ERR("%s: Failed to load the nRF70 firmware patch", __func__); + goto err; + } + + status = nrf_wifi_fmac_ver_get(rpu_ctx, + &fw_ver); + if (status != NRF_WIFI_STATUS_SUCCESS) { + LOG_ERR("%s: Failed to read the nRF70 firmware version", __func__); + goto err; + } + + LOG_DBG("nRF70 firmware (v%d.%d.%d.%d) booted successfully", + NRF_WIFI_UMAC_VER(fw_ver), + NRF_WIFI_UMAC_VER_MAJ(fw_ver), + NRF_WIFI_UMAC_VER_MIN(fw_ver), + NRF_WIFI_UMAC_VER_EXTRA(fw_ver)); + + memset(&ctrl_params, 0, sizeof(ctrl_params)); + memset(&ceil_params, 0, sizeof(ceil_params)); + + configure_tx_pwr_settings(&ctrl_params, + &ceil_params); + + memset(&board_params, 0, sizeof(board_params)); + + configure_board_dep_params(&board_params); + + status = nrf_wifi_fmac_off_raw_tx_dev_init(rpu_ctx_zep->rpu_ctx, +#ifdef CONFIG_NRF_WIFI_LOW_POWER + HW_SLEEP_ENABLE, +#endif /* CONFIG_NRF_WIFI_LOW_POWER */ + NRF_WIFI_DEF_PHY_CALIB, + CONFIG_NRF_WIFI_OP_BAND, + IS_ENABLED(CONFIG_NRF_WIFI_BEAMFORMING), + &ctrl_params, + &ceil_params, + &board_params); + if (status != NRF_WIFI_STATUS_SUCCESS) { + LOG_ERR("%s: nRF70 firmware initialization failed", __func__); + goto err; + } + + if (mac_addr) { + memcpy(rpu_ctx_zep->mac_addr, mac_addr, 6); + } else { +#ifdef CONFIG_WIFI_FIXED_MAC_ADDRESS_ENABLED + int ret = -1; + + ret = bytes_from_str(rpu_ctx_zep->mac_addr, + 6, + CONFIG_WIFI_FIXED_MAC_ADDRESS); + if (ret < 0) { + LOG_ERR("%s: Failed to parse MAC address: %s", + __func__, + CONFIG_WIFI_FIXED_MAC_ADDRESS); + goto err; + } +#elif CONFIG_WIFI_OTP_MAC_ADDRESS + status = nrf_wifi_fmac_otp_mac_addr_get(off_raw_tx_drv_priv.rpu_ctx_zep.rpu_ctx, + 0, + rpu_ctx_zep->mac_addr); + if (status != NRF_WIFI_STATUS_SUCCESS) { + LOG_ERR("%s: Fetching of MAC address from OTP failed", + __func__); + goto err; + } +#endif /* CONFIG_WIFI_FIXED_MAC_ADDRESS_ENABLED */ + + if (!nrf_wifi_utils_is_mac_addr_valid(rpu_ctx_zep->mac_addr)) { + LOG_ERR("%s: Invalid MAC address: %02X:%02X:%02X:%02X:%02X:%02X", + __func__, + rpu_ctx_zep->mac_addr[0], + rpu_ctx_zep->mac_addr[1], + rpu_ctx_zep->mac_addr[2], + rpu_ctx_zep->mac_addr[3], + rpu_ctx_zep->mac_addr[4], + rpu_ctx_zep->mac_addr[5]); + goto err; + } + } + + k_spin_unlock(&off_raw_tx_drv_priv.lock, key); + + return 0; +err: + if (rpu_ctx) { + nrf_wifi_fmac_off_raw_tx_dev_rem(rpu_ctx); + rpu_ctx_zep->rpu_ctx = NULL; + } + + k_spin_unlock(&off_raw_tx_drv_priv.lock, key); + nrf70_off_raw_tx_deinit(); + return -1; +} + + +void nrf70_off_raw_tx_deinit(void) +{ + k_spinlock_key_t key; + + key = k_spin_lock(&off_raw_tx_drv_priv.lock); + + if (!off_raw_tx_drv_priv.fmac_priv) { + k_spin_unlock(&off_raw_tx_drv_priv.lock, key); + return; + } + + nrf_wifi_fmac_off_raw_tx_deinit(off_raw_tx_drv_priv.fmac_priv); + nrf_wifi_osal_deinit(); + + k_spin_unlock(&off_raw_tx_drv_priv.lock, key); +} + +static bool validate_rate(enum nrf_wifi_off_raw_tx_tput_mode tput_mode, + enum nrf_wifi_off_raw_tx_rate rate) +{ + if (tput_mode == TPUT_MODE_LEGACY) { + if (rate > RATE_54M) { + return false; + } + } else { + if (rate <= RATE_54M) { + return false; + } + } + + return true; +} + +int nrf70_off_raw_tx_conf_update(struct nrf_wifi_off_raw_tx_conf *conf) +{ + int ret = -1; + enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; + struct nrf_wifi_offload_ctrl_params *off_ctrl_params = NULL; + struct nrf_wifi_offload_tx_ctrl *off_tx_params = NULL; + struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL; + k_spinlock_key_t key; + + if (!conf) { + LOG_ERR("%s: Config params is NULL", __func__); + goto out; + } + + off_ctrl_params = nrf_wifi_osal_mem_zalloc(sizeof(*off_ctrl_params)); + if (!off_ctrl_params) { + LOG_ERR("%s: Failed to allocate memory for off_ctrl_params", __func__); + goto out; + } + + key = k_spin_lock(&off_raw_tx_drv_priv.lock); + + fmac_dev_ctx = off_raw_tx_drv_priv.rpu_ctx_zep.rpu_ctx; + + if (!fmac_dev_ctx) { + LOG_ERR("%s: FMAC device context is NULL", __func__); + goto out; + } + + off_tx_params = nrf_wifi_osal_mem_zalloc(sizeof(*off_tx_params)); + if (!off_tx_params) { + LOG_ERR("%s Failed to allocate memory for off_tx_params: ", __func__); + goto out; + } + + if (!validate_rate(conf->tput_mode, conf->rate)) { + LOG_ERR("%s Invalid rate. Throughput mode: %d, rate: %d\n", __func__, + conf->tput_mode, conf->rate); + goto out; + } + + off_ctrl_params->channel_no = conf->chan; + off_ctrl_params->period_in_us = conf->period_us; + off_ctrl_params->tx_pwr = conf->tx_pwr; + off_tx_params->he_gi_type = conf->he_gi; + off_tx_params->he_ltf = conf->he_ltf; + off_tx_params->pkt_ram_ptr = RPU_MEM_PKT_BASE; + off_tx_params->pkt_length = conf->pkt_len; + off_tx_params->rate_flags = conf->tput_mode; + off_tx_params->rate = valid_data_rates[conf->rate]; + off_tx_params->rate_preamble_type = conf->short_preamble; + off_tx_params->rate_retries = conf->num_retries; + + status = hal_rpu_mem_write(fmac_dev_ctx->hal_dev_ctx, + RPU_MEM_PKT_BASE, + conf->pkt, + conf->pkt_len); + if (status != NRF_WIFI_STATUS_SUCCESS) { + LOG_ERR("%s: hal_rpu_mem_write failed", __func__); + goto out; + } + + status = nrf_wifi_fmac_off_raw_tx_conf(fmac_dev_ctx, + off_ctrl_params, + off_tx_params); + if (status != NRF_WIFI_STATUS_SUCCESS) { + LOG_ERR("%s: nRF70 offloaded raw TX configuration failed", + __func__); + goto out; + } + + ret = 0; +out: + nrf_wifi_osal_mem_free(off_ctrl_params); + nrf_wifi_osal_mem_free(off_tx_params); + k_spin_unlock(&off_raw_tx_drv_priv.lock, key); + return ret; +} + + +int nrf70_off_raw_tx_start(struct nrf_wifi_off_raw_tx_conf *conf) +{ + int ret = -1; + enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; + k_spinlock_key_t key; + + status = nrf70_off_raw_tx_conf_update(conf); + if (status != NRF_WIFI_STATUS_SUCCESS) { + LOG_ERR("%s: nRF70 offloaded raw TX configuration failed", + __func__); + goto out; + } + + key = k_spin_lock(&off_raw_tx_drv_priv.lock); + if (!off_raw_tx_drv_priv.rpu_ctx_zep.rpu_ctx) { + LOG_ERR("%s: FMAC device context is NULL", __func__); + goto out; + } + + status = nrf_wifi_fmac_off_raw_tx_start(off_raw_tx_drv_priv.rpu_ctx_zep.rpu_ctx); + if (status != NRF_WIFI_STATUS_SUCCESS) { + LOG_ERR("%s: nRF70 offloaded raw TX start failed", + __func__); + goto out; + } + + ret = 0; +out: + k_spin_unlock(&off_raw_tx_drv_priv.lock, key); + return ret; +} + + +int nrf70_off_raw_tx_stop(void) +{ + int ret = -1; + enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; + k_spinlock_key_t key; + + key = k_spin_lock(&off_raw_tx_drv_priv.lock); + + if (!off_raw_tx_drv_priv.rpu_ctx_zep.rpu_ctx) { + LOG_ERR("%s: FMAC device context is NULL", __func__); + goto out; + } + + status = nrf_wifi_fmac_off_raw_tx_stop(off_raw_tx_drv_priv.rpu_ctx_zep.rpu_ctx); + if (status != NRF_WIFI_STATUS_SUCCESS) { + LOG_ERR("%s: nRF70 offloaded raw TX stop failed", + __func__); + goto out; + } + + ret = 0; +out: + k_spin_unlock(&off_raw_tx_drv_priv.lock, key); + return ret; +} + + +int nrf70_off_raw_tx_mac_addr_get(uint8_t *mac_addr) +{ + if (!mac_addr) { + LOG_ERR("%s: Invalid param", __func__); + return -EINVAL; + } + + memcpy(mac_addr, off_raw_tx_drv_priv.rpu_ctx_zep.mac_addr, 6); + return 0; +} + +int nrf70_off_raw_tx_stats(struct nrf_wifi_off_raw_tx_stats *off_raw_tx_stats) +{ + int ret = -1; + enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; + struct rpu_op_stats stats; + k_spinlock_key_t key; + + memset(&stats, 0, sizeof(struct rpu_op_stats)); + + key = k_spin_lock(&off_raw_tx_drv_priv.lock); + + if (!off_raw_tx_drv_priv.rpu_ctx_zep.rpu_ctx) { + LOG_ERR("%s: FMAC device context is NULL", __func__); + goto out; + } + + status = nrf_wifi_fmac_stats_get(off_raw_tx_drv_priv.rpu_ctx_zep.rpu_ctx, 0, &stats); + if (status != NRF_WIFI_STATUS_SUCCESS) { + LOG_ERR("%s: nRF70 offloaded raw TX stats failed", + __func__); + goto out; + } + + off_raw_tx_stats->off_raw_tx_pkt_sent = stats.fw.offloaded_raw_tx.offload_raw_tx_cnt; + + ret = 0; +out: + k_spin_unlock(&off_raw_tx_drv_priv.lock, key); + return ret; +} diff --git a/include/zephyr/drivers/wifi/nrfwifi/off_raw_tx/off_raw_tx_api.h b/include/zephyr/drivers/wifi/nrfwifi/off_raw_tx/off_raw_tx_api.h new file mode 100644 index 0000000000000..b8ff50cd390db --- /dev/null +++ b/include/zephyr/drivers/wifi/nrfwifi/off_raw_tx/off_raw_tx_api.h @@ -0,0 +1,260 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ +/** @file + * + * @addtogroup nrf70_off_raw_tx_api nRF70 Offloaded raw TX API + * @{ + * + * @brief File containing API's for the Offloaded raw TX feature. + */ + +#ifndef INCLUDE_ZEPHYR_DRIVERS_OFF_RAW_TX_API_H_ +#define INCLUDE_ZEPHYR_DRIVERS_OFF_RAW_TX_API_H_ + +#include +#include +#include "osal_api.h" + +/* Minimum frame size for raw packet transmission */ +#define NRF_WIFI_OFF_RAW_TX_FRAME_SIZE_MIN 26 +/* Maximum frame size for raw packet transmission */ +#define NRF_WIFI_OFF_RAW_TX_FRAME_SIZE_MAX 600 + +/** + * @brief- Transmission rates + * Rate to be used for transmitting a packet. + */ +enum nrf_wifi_off_raw_tx_rate { + /** 1 Mbps */ + RATE_1M, + /** 2 Mbps */ + RATE_2M, + /** 5.5 Mbps */ + RATE_5_5M, + /** 11 Mbps */ + RATE_11M, + /** 6 Mbps */ + RATE_6M, + /** 9 Mbps */ + RATE_9M, + /** 12 Mbps */ + RATE_12M, + /** 18 Mbps */ + RATE_18M, + /** 24 Mbps */ + RATE_24M, + /** 36 Mbps */ + RATE_36M, + /** 48 Mbps */ + RATE_48M, + /** 54 Mbps */ + RATE_54M, + /** MCS 0 */ + RATE_MCS0, + /** MCS 1 */ + RATE_MCS1, + /** MCS 2 */ + RATE_MCS2, + /** MCS 3 */ + RATE_MCS3, + /** MCS 4 */ + RATE_MCS4, + /** MCS 5 */ + RATE_MCS5, + /** MCS 6 */ + RATE_MCS6, + /** MCS 7 */ + RATE_MCS7, + /** Invalid rate */ + RATE_MAX +}; + + +/** + * @brief- HE guard interval value + * Value of the guard interval to be used between symbols when transmitting using HE. + */ +enum nrf_wifi_off_raw_tx_he_gi { + /** 800 ns */ + HE_GI_800NS, + /** 1600 ns */ + HE_GI_1600NS, + /** 3200 ns */ + HE_GI_3200NS, + /** Invalid value */ + HE_GI_MAX +}; + + +/** + * @brief- HE long training field duration + * Value of the long training field duration to be used when transmitting using HE. + */ +enum nrf_wifi_off_raw_tx_he_ltf { + /** 3.2us */ + HE_LTF_3200NS, + /** 6.4us */ + HE_LTF_6400NS, + /** 12.8us */ + HE_LTF_12800NS, + /** Invalid value */ + HE_LTF_MAX +}; + +/** + * @brief- Throughput mode + * Throughput mode to be used for transmitting the packet. + */ +enum nrf_wifi_off_raw_tx_tput_mode { + /** Legacy mode */ + TPUT_MODE_LEGACY, + /** High Throughput mode (11n) */ + TPUT_MODE_HT, + /** Very high throughput mode (11ac) */ + TPUT_MODE_VHT, + /** HE SU mode */ + TPUT_MODE_HE_SU, + /** HE ER SU mode */ + TPUT_MODE_HE_ER_SU, + /** HE TB mode */ + TPUT_MODE_HE_TB, + /** Highest throughput mode currently defined */ + TPUT_MODE_MAX +}; + +/** + * @brief This structure defines the Offloaded raw tx debug statistics. + * + */ +struct nrf_wifi_off_raw_tx_stats { + /** Number of packets sent */ + unsigned int off_raw_tx_pkt_sent; +}; + +/** + * @brief- Configuration parameters for offloaded raw TX + * Parameters which can be used to configure the offloaded raw TX operation. + */ +struct nrf_wifi_off_raw_tx_conf { + /** Time interval (in microseconds) between transmissions */ + unsigned int period_us; + /** Transmit power in dBm (0 to 20) */ + unsigned int tx_pwr; + /** Channel number on which to transmit */ + unsigned int chan; + /** Set to TRUE to use short preamble for FALSE to disable short preamble */ + bool short_preamble; + /* Number of times a packet should be retried at each possible rate */ + unsigned int num_retries; + /** Throughput mode for packet transmittion. Refer &enum nrf_wifi_off_raw_tx_tput_mode */ + enum nrf_wifi_off_raw_tx_tput_mode tput_mode; + /* Rate at which packet needs to be transmitted. Refer &enum nrf_wifi_off_raw_tx_rate */ + enum nrf_wifi_off_raw_tx_rate rate; + /** HE GI. Refer &enum nrf_wifi_off_raw_tx_he_gi */ + enum nrf_wifi_off_raw_tx_he_gi he_gi; + /** HE GI. Refer &enum nrf_wifi_off_raw_tx_he_ltf */ + enum nrf_wifi_off_raw_tx_he_ltf he_ltf; + /* Pointer to packet to be transmitted */ + void *pkt; + /** Packet length of the frame to be transmitted, (min 26 bytes and max 600 bytes) */ + unsigned int pkt_len; +}; + + +/** + * @brief Initialize the nRF70 for operating in the offloaded raw TX mode. + * @param mac_addr MAC address to be used for the nRF70 device. + * + * This function is initializes the nRF70 device for offloaded raw TX mode by: + * - Powering it up, + * - Downloading a firmware patch (if any). + * - Initializing the firmware to accept further commands + * + * The mac_addr parameter is used to set the MAC address of the nRF70 device. + * This address can be used to override the MAC addresses programmed in the OTP and + * the value configured (if any) in CONFIG_WIFI_FIXED_MAC_ADDRESS. + * The priority order in which the MAC address values for the nRF70 device are used is: + * - If mac_addr is provided, the MAC address is set to the value provided. + * - If CONFIG_WIFI_FIXED_MAC_ADDRESS is enabled, the MAC address uses the Kconfig value. + * - If none of the above are provided, the MAC address is set to the value programmed in the OTP. + * + * @retval 0 If the operation was successful. + * @retval -1 If the operation failed. + */ +int nrf70_off_raw_tx_init(uint8_t *mac_addr); + +/** + * @brief Initialize the nRF70 for operating in the offloaded raw TX mode. + * + * This function is deinitializes the nRF70 device. + * + */ +void nrf70_off_raw_tx_deinit(void); + +/** + * @brief Update the configured offloaded raw TX parameters. + * @param conf Configuration parameters to be updated for the offloaded raw TX operation. + * + * This function is used to update configured parameters for offloaded raw TX operation. + * This function should be used to when the parameters need to be updated during an ongoing + * raw TX operation without having to stop it. + * + * @retval 0 If the operation was successful. + * @retval -1 If the operation failed. + */ +int nrf70_off_raw_tx_conf_update(struct nrf_wifi_off_raw_tx_conf *conf); + +/** + * @brief Start the offloaded raw TX. + * @param conf Configuration parameters necessary for the offloaded raw TX operation. + * + * This function is used to start offloaded raw TX operation. When this function is invoked + * the nRF70 device will start transmitting frames as per the configuration specified by @p conf. + * + * @retval 0 If the operation was successful. + * @retval -1 If the operation failed. + */ +int nrf70_off_raw_tx_start(struct nrf_wifi_off_raw_tx_conf *conf); + +/** + * @brief Stop the offloaded raw TX. + * + * This function is used to stop offloaded raw TX operation. When this function is invoked + * the nRF70 device will stop transmitting frames. + * + * @retval 0 If the operation was successful. + * @retval -1 If the operation failed. + */ +int nrf70_off_raw_tx_stop(void); + +/** + * @brief Get the MAC address of the nRF70 device. + * @param mac_addr Buffer to store the MAC address. + * + * This function is used to get the MAC address of the nRF70 device. + * The MAC address is stored in the buffer pointed by mac_addr. + * The MAC address is expected to be a 6 byte value. + * + * @retval 0 If the operation was successful. + * @retval -1 If the operation failed. + */ +int nrf70_off_raw_tx_mac_addr_get(uint8_t *mac_addr); + +/** + * @brief Get statistics of the offloaded raw TX. + * @param off_raw_tx_stats Statistics of the offloaded raw TX operation. + * + * This function is used to get statistics of offloaded raw TX operation. When this function + * is invoked the nRF70 device will show statistics. + * + * @retval 0 If the operation was successful. + * @retval -1 If the operation failed. + */ +int nrf70_off_raw_tx_stats(struct nrf_wifi_off_raw_tx_stats *off_raw_tx_stats); +/** + * @} + */ +#endif /* INCLUDE_ZEPHYR_DRIVERS_OFF_RAW_TX_API_H_ */ From 1637443dc0174122d5cbdd9d30e1a4a510e4acad Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Mon, 26 Aug 2024 20:30:26 +1000 Subject: [PATCH 0839/4482] sensor: current_amp: request calibration Request calibration on ADC samples to improve the accuracy of the ADC outputs and therefore the final measured current. Signed-off-by: Jordan Yates --- drivers/sensor/current_amp/current_amp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/sensor/current_amp/current_amp.c b/drivers/sensor/current_amp/current_amp.c index 6dabd98534361..f5d37fc70553a 100644 --- a/drivers/sensor/current_amp/current_amp.c +++ b/drivers/sensor/current_amp/current_amp.c @@ -152,6 +152,7 @@ static int current_init(const struct device *dev) data->sequence.buffer = &data->raw; data->sequence.buffer_size = sizeof(data->raw); + data->sequence.calibrate = true; return 0; } From dd7cfbc92e65e03eca04f36275940d3252d56038 Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Wed, 26 Jun 2024 16:39:35 +0200 Subject: [PATCH 0840/4482] test: drivers: pwm: add fast PWM Add fast PWM instance for nRF54H20 device. Signed-off-by: Adam Kondraciuk --- .../nrf54h20dk_nrf54h20_cpuapp_fast.overlay | 21 +++++++++++++++++++ tests/drivers/pwm/pwm_api/testcase.yaml | 4 ++++ 2 files changed, 25 insertions(+) create mode 100644 tests/drivers/pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay diff --git a/tests/drivers/pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay b/tests/drivers/pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay new file mode 100644 index 0000000000000..c4e2cb8c38bf4 --- /dev/null +++ b/tests/drivers/pwm/pwm_api/boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay @@ -0,0 +1,21 @@ +&pinctrl { + pwm_default: pwm_default { + group1 { + psels = ; + }; + }; + pwm_sleep: pwm_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; +}; + +&pwm120 { + status = "okay"; + pinctrl-0 = <&pwm_default>; + pinctrl-1 = <&pwm_sleep>; + pinctrl-names = "default", "sleep"; + memory-regions = <&dma_fast_region>; +}; diff --git a/tests/drivers/pwm/pwm_api/testcase.yaml b/tests/drivers/pwm/pwm_api/testcase.yaml index c9f3ac62e3950..b30458cc970eb 100644 --- a/tests/drivers/pwm/pwm_api/testcase.yaml +++ b/tests/drivers/pwm/pwm_api/testcase.yaml @@ -21,3 +21,7 @@ tests: or dt_alias_exists("pwm-3")) and CONFIG_DT_HAS_NXP_FLEXIO_ENABLED and CONFIG_DT_HAS_NXP_FLEXIO_PWM_ENABLED depends_on: pwm + drivers.pwm.pwm_fast: + extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay" + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp From f31439991d3838d974d443d4dd2d222ff9aaab8a Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Fri, 11 Oct 2024 14:35:04 +1000 Subject: [PATCH 0841/4482] modules: tfm: interface: handle ISR context Don't attempt to take a mutex if operating from inside an ISR. The only expected use-case where this should occur is when attempting to reboot via `tfm_platform_system_reset` from an exception handler. Fixes #79687. Signed-off-by: Jordan Yates --- modules/trusted-firmware-m/interface/interface.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/trusted-firmware-m/interface/interface.c b/modules/trusted-firmware-m/interface/interface.c index d949a9dc027af..abff7efdc72f5 100644 --- a/modules/trusted-firmware-m/interface/interface.c +++ b/modules/trusted-firmware-m/interface/interface.c @@ -28,11 +28,11 @@ int32_t tfm_ns_interface_dispatch(veneer_fn fn, uint32_t arg0, uint32_t arg1, uint32_t arg2, uint32_t arg3) { - int32_t result; - bool is_pre_kernel = k_is_pre_kernel(); + bool isr_mode = k_is_in_isr() || k_is_pre_kernel(); int tfm_ns_saved_prio; + int32_t result; - if (!is_pre_kernel) { + if (!isr_mode) { /* TF-M request protected by NS lock */ if (k_mutex_lock(&tfm_mutex, K_FOREVER) != 0) { return (int32_t)PSA_ERROR_GENERIC_ERROR; @@ -61,7 +61,7 @@ int32_t tfm_ns_interface_dispatch(veneer_fn fn, z_arm_restore_fp_context(&context_buffer); - if (!is_pre_kernel) { + if (!isr_mode) { #if !defined(CONFIG_ARM_NONSECURE_PREEMPTIBLE_SECURE_CALLS) /* Restore thread priority, to allow the thread to be preempted. */ k_thread_priority_set(k_current_get(), tfm_ns_saved_prio); From d2bad69d932db9dd8b40c3c19bc1e5e8335acef0 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Fri, 11 Oct 2024 13:04:05 -0500 Subject: [PATCH 0842/4482] MAINTAINERS: eth phy api and eth api to eth group Add ethernet phy header to ethernet group Add ethernet.h to ethernet group Add net/mdio.h to mdio group Signed-off-by: Declan Snyder --- MAINTAINERS.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 86b506c8154f3..0a6dc35b2b942 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -1380,6 +1380,8 @@ Release Notes: - dts/bindings/ethernet/ - tests/drivers/ethernet/ - include/zephyr/drivers/ethernet/ + - include/zephyr/net/phy.h + - include/zephyr/net/ethernet.h labels: - "area: Ethernet" tests: @@ -1631,6 +1633,7 @@ Release Notes: - doc/hardware/peripherals/mdio.rst - drivers/mdio/ - include/zephyr/drivers/mdio.h + - include/zephyr/net/mdio.h - tests/drivers/build_all/mdio/ - dts/bindings/mdio/ labels: From 23f3cb197724642eabccc69d34bf95875275119f Mon Sep 17 00:00:00 2001 From: Sreeram Tatapudi Date: Fri, 6 Sep 2024 11:49:41 -0700 Subject: [PATCH 0843/4482] samples: subsys: fs: littlefs: add overlay files for CYW20829 Use littlefs to store logs to flash memory Signed-off-by: Sreeram Tatapudi --- .../fs/littlefs/boards/cyw920829m2evk_02.overlay | 15 +++++++++++++++ .../boards/cyw920829m2evk_02.overlay | 15 +++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 samples/subsys/fs/littlefs/boards/cyw920829m2evk_02.overlay create mode 100644 tests/subsys/logging/log_backend_fs/boards/cyw920829m2evk_02.overlay diff --git a/samples/subsys/fs/littlefs/boards/cyw920829m2evk_02.overlay b/samples/subsys/fs/littlefs/boards/cyw920829m2evk_02.overlay new file mode 100644 index 0000000000000..6aa7e6e3a11b8 --- /dev/null +++ b/samples/subsys/fs/littlefs/boards/cyw920829m2evk_02.overlay @@ -0,0 +1,15 @@ +/ { + fstab { + compatible = "zephyr,fstab"; + lfs1: lfs1 { + compatible = "zephyr,fstab,littlefs"; + mount-point = "/lfs1"; + partition = <&storage_partition>; + read-size = <16>; + prog-size = <16>; + cache-size = <64>; + lookahead-size = <32>; + block-cycles = <512>; + }; + }; +}; diff --git a/tests/subsys/logging/log_backend_fs/boards/cyw920829m2evk_02.overlay b/tests/subsys/logging/log_backend_fs/boards/cyw920829m2evk_02.overlay new file mode 100644 index 0000000000000..6aa7e6e3a11b8 --- /dev/null +++ b/tests/subsys/logging/log_backend_fs/boards/cyw920829m2evk_02.overlay @@ -0,0 +1,15 @@ +/ { + fstab { + compatible = "zephyr,fstab"; + lfs1: lfs1 { + compatible = "zephyr,fstab,littlefs"; + mount-point = "/lfs1"; + partition = <&storage_partition>; + read-size = <16>; + prog-size = <16>; + cache-size = <64>; + lookahead-size = <32>; + block-cycles = <512>; + }; + }; +}; From 4f4c7b90a419b4ddfd9fb258fd1015b4eeded01f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Thu, 10 Oct 2024 14:42:58 +0200 Subject: [PATCH 0844/4482] doc: boards: align main board image name with board name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As per board porting guidelines, the board image should be named after the board. This commit implements the changes for boards found to be non-compliant. Signed-off-by: Benjamin Cabé --- .../img/{icarus-som-dk.jpg => icarus_som_dk.jpg} | Bin ...-diagram.jpg => icarus_som_dk_block_diagram.jpg} | Bin boards/actinius/icarus_som_dk/doc/index.rst | 4 ++-- ...i60f225-board-top.jpg => titanium_ti60_f225.jpg} | Bin boards/efinix/titanium_ti60_f225/doc/index.rst | 2 +- ...kit-v1.2-overview.jpg => esp32_ethernet_kit.jpg} | Bin boards/espressif/esp32_ethernet_kit/doc/index.rst | 2 +- ...kit-v4.1-layout-front.jpg => esp_wrover_kit.jpg} | Bin boards/espressif/esp_wrover_kit/doc/index.rst | 2 +- .../img/{cv_soc_board.jpg => cyclonev_socdk.jpg} | Bin .../intel/socfpga_std/cyclonev_socdk/doc/index.rst | 2 +- .../doc/{ek-ra4m2-board.webp => ek_ra4m2.webp} | Bin boards/renesas/ek_ra4m2/doc/index.rst | 2 +- .../doc/{ek-ra6m3-board.webp => ek_ra6m3.webp} | Bin boards/renesas/ek_ra6m3/doc/index.rst | 2 +- .../doc/{ek-ra8m1-board.jpg => ek_ra8m1.jpg} | Bin boards/renesas/ek_ra8m1/doc/index.rst | 2 +- .../doc/{fpb-ra6e1-board.webp => fpb_ra6e1.webp} | Bin boards/renesas/fpb_ra6e1/doc/index.rst | 2 +- 19 files changed, 10 insertions(+), 10 deletions(-) rename boards/actinius/icarus_som_dk/doc/img/{icarus-som-dk.jpg => icarus_som_dk.jpg} (100%) rename boards/actinius/icarus_som_dk/doc/img/{icarus-som-dk-block-diagram.jpg => icarus_som_dk_block_diagram.jpg} (100%) rename boards/efinix/titanium_ti60_f225/doc/img/{ti60f225-board-top.jpg => titanium_ti60_f225.jpg} (100%) rename boards/espressif/esp32_ethernet_kit/doc/img/{esp32-ethernet-kit-v1.2-overview.jpg => esp32_ethernet_kit.jpg} (100%) rename boards/espressif/esp_wrover_kit/doc/img/{esp-wrover-kit-v4.1-layout-front.jpg => esp_wrover_kit.jpg} (100%) rename boards/intel/socfpga_std/cyclonev_socdk/doc/img/{cv_soc_board.jpg => cyclonev_socdk.jpg} (100%) rename boards/renesas/ek_ra4m2/doc/{ek-ra4m2-board.webp => ek_ra4m2.webp} (100%) rename boards/renesas/ek_ra6m3/doc/{ek-ra6m3-board.webp => ek_ra6m3.webp} (100%) rename boards/renesas/ek_ra8m1/doc/{ek-ra8m1-board.jpg => ek_ra8m1.jpg} (100%) rename boards/renesas/fpb_ra6e1/doc/{fpb-ra6e1-board.webp => fpb_ra6e1.webp} (100%) diff --git a/boards/actinius/icarus_som_dk/doc/img/icarus-som-dk.jpg b/boards/actinius/icarus_som_dk/doc/img/icarus_som_dk.jpg similarity index 100% rename from boards/actinius/icarus_som_dk/doc/img/icarus-som-dk.jpg rename to boards/actinius/icarus_som_dk/doc/img/icarus_som_dk.jpg diff --git a/boards/actinius/icarus_som_dk/doc/img/icarus-som-dk-block-diagram.jpg b/boards/actinius/icarus_som_dk/doc/img/icarus_som_dk_block_diagram.jpg similarity index 100% rename from boards/actinius/icarus_som_dk/doc/img/icarus-som-dk-block-diagram.jpg rename to boards/actinius/icarus_som_dk/doc/img/icarus_som_dk_block_diagram.jpg diff --git a/boards/actinius/icarus_som_dk/doc/index.rst b/boards/actinius/icarus_som_dk/doc/index.rst index c0d0a94033958..7f9291489a50c 100644 --- a/boards/actinius/icarus_som_dk/doc/index.rst +++ b/boards/actinius/icarus_som_dk/doc/index.rst @@ -6,7 +6,7 @@ Actinius Icarus SoM DK Overview ******** -.. figure:: img/icarus-som-dk.jpg +.. figure:: img/icarus_som_dk.jpg :width: 450px :align: center :alt: Icarus SoM DK @@ -42,7 +42,7 @@ following devices (provided directly by Nordic): * :abbr:`WDT (Watchdog Timer)` * :abbr:`IDAU (Implementation Defined Attribution Unit)` -.. figure:: img/icarus-som-dk-block-diagram.jpg +.. figure:: img/icarus_som_dk_block_diagram.jpg :width: 450px :align: center :alt: Icarus SoM DK Block Diagram diff --git a/boards/efinix/titanium_ti60_f225/doc/img/ti60f225-board-top.jpg b/boards/efinix/titanium_ti60_f225/doc/img/titanium_ti60_f225.jpg similarity index 100% rename from boards/efinix/titanium_ti60_f225/doc/img/ti60f225-board-top.jpg rename to boards/efinix/titanium_ti60_f225/doc/img/titanium_ti60_f225.jpg diff --git a/boards/efinix/titanium_ti60_f225/doc/index.rst b/boards/efinix/titanium_ti60_f225/doc/index.rst index 1b6430e9309f3..40338736308ed 100644 --- a/boards/efinix/titanium_ti60_f225/doc/index.rst +++ b/boards/efinix/titanium_ti60_f225/doc/index.rst @@ -11,7 +11,7 @@ high performance with the lowest possible power on a small physical size. In add which is a user-configurable RISC-V SoC based on the VexRiscv core with configurable feature set and extension. Using the Efinity IP Manager, you can configure the SoC to include only the peripherals that you require. -.. figure:: img/ti60f225-board-top.jpg +.. figure:: img/titanium_ti60_f225.jpg :align: center :alt: titanium_ti60_f225_board diff --git a/boards/espressif/esp32_ethernet_kit/doc/img/esp32-ethernet-kit-v1.2-overview.jpg b/boards/espressif/esp32_ethernet_kit/doc/img/esp32_ethernet_kit.jpg similarity index 100% rename from boards/espressif/esp32_ethernet_kit/doc/img/esp32-ethernet-kit-v1.2-overview.jpg rename to boards/espressif/esp32_ethernet_kit/doc/img/esp32_ethernet_kit.jpg diff --git a/boards/espressif/esp32_ethernet_kit/doc/index.rst b/boards/espressif/esp32_ethernet_kit/doc/index.rst index 4437e479bdf37..37144964421ee 100644 --- a/boards/espressif/esp32_ethernet_kit/doc/index.rst +++ b/boards/espressif/esp32_ethernet_kit/doc/index.rst @@ -13,7 +13,7 @@ over Ethernet (PoE). .. _get-started-esp32-ethernet-kit-v1.2-overview: -.. figure:: img/esp32-ethernet-kit-v1.2-overview.jpg +.. figure:: img/esp32_ethernet_kit.jpg :align: center :alt: ESP32-Ethernet-Kit V1.2 :figclass: align-center diff --git a/boards/espressif/esp_wrover_kit/doc/img/esp-wrover-kit-v4.1-layout-front.jpg b/boards/espressif/esp_wrover_kit/doc/img/esp_wrover_kit.jpg similarity index 100% rename from boards/espressif/esp_wrover_kit/doc/img/esp-wrover-kit-v4.1-layout-front.jpg rename to boards/espressif/esp_wrover_kit/doc/img/esp_wrover_kit.jpg diff --git a/boards/espressif/esp_wrover_kit/doc/index.rst b/boards/espressif/esp_wrover_kit/doc/index.rst index 0bef9a9ce4dfa..0a92c4f16791a 100644 --- a/boards/espressif/esp_wrover_kit/doc/index.rst +++ b/boards/espressif/esp_wrover_kit/doc/index.rst @@ -43,7 +43,7 @@ Functional Description The following two figures and the table below describe the key components, interfaces, and controls of the ESP-WROVER-KIT board. -.. figure:: img/esp-wrover-kit-v4.1-layout-front.jpg +.. figure:: img/esp_wrover_kit.jpg :align: center :alt: esp wrover front diff --git a/boards/intel/socfpga_std/cyclonev_socdk/doc/img/cv_soc_board.jpg b/boards/intel/socfpga_std/cyclonev_socdk/doc/img/cyclonev_socdk.jpg similarity index 100% rename from boards/intel/socfpga_std/cyclonev_socdk/doc/img/cv_soc_board.jpg rename to boards/intel/socfpga_std/cyclonev_socdk/doc/img/cyclonev_socdk.jpg diff --git a/boards/intel/socfpga_std/cyclonev_socdk/doc/index.rst b/boards/intel/socfpga_std/cyclonev_socdk/doc/index.rst index 6183491690c52..7e6a426238aca 100644 --- a/boards/intel/socfpga_std/cyclonev_socdk/doc/index.rst +++ b/boards/intel/socfpga_std/cyclonev_socdk/doc/index.rst @@ -10,7 +10,7 @@ Overview The Zephyr kernel is supported on the Intel® Cyclone® V SoC Development Kit, using its Hard Processor System (HPS) CPU. -.. figure:: img/cv_soc_board.jpg +.. figure:: img/cyclonev_socdk.jpg :align: center :alt: Intel's Cyclone® V SoC FPGA DevKit diff --git a/boards/renesas/ek_ra4m2/doc/ek-ra4m2-board.webp b/boards/renesas/ek_ra4m2/doc/ek_ra4m2.webp similarity index 100% rename from boards/renesas/ek_ra4m2/doc/ek-ra4m2-board.webp rename to boards/renesas/ek_ra4m2/doc/ek_ra4m2.webp diff --git a/boards/renesas/ek_ra4m2/doc/index.rst b/boards/renesas/ek_ra4m2/doc/index.rst index 833768d6d16f7..b65a79f600335 100644 --- a/boards/renesas/ek_ra4m2/doc/index.rst +++ b/boards/renesas/ek_ra4m2/doc/index.rst @@ -61,7 +61,7 @@ available internal to the RA MCU **Special Feature Access** - 32 MB (256 Mb) External Quad-SPI Flash -.. figure:: ek-ra4m2-board.webp +.. figure:: ek_ra4m2.webp :align: center :alt: RA4M2 Evaluation Kit diff --git a/boards/renesas/ek_ra6m3/doc/ek-ra6m3-board.webp b/boards/renesas/ek_ra6m3/doc/ek_ra6m3.webp similarity index 100% rename from boards/renesas/ek_ra6m3/doc/ek-ra6m3-board.webp rename to boards/renesas/ek_ra6m3/doc/ek_ra6m3.webp diff --git a/boards/renesas/ek_ra6m3/doc/index.rst b/boards/renesas/ek_ra6m3/doc/index.rst index bb468d9d1f52f..fd9f529f98cd8 100644 --- a/boards/renesas/ek_ra6m3/doc/index.rst +++ b/boards/renesas/ek_ra6m3/doc/index.rst @@ -59,7 +59,7 @@ The key features of the EK-RA6M3 board are categorized in three groups as follow - USB High Speed Host and Device (micro-AB connector) - 32 Mb (256 Mb) External Quad-SPI Flash -.. figure:: ek-ra6m3-board.webp +.. figure:: ek_ra6m3.webp :align: center :alt: RA6M3 Evaluation Kit diff --git a/boards/renesas/ek_ra8m1/doc/ek-ra8m1-board.jpg b/boards/renesas/ek_ra8m1/doc/ek_ra8m1.jpg similarity index 100% rename from boards/renesas/ek_ra8m1/doc/ek-ra8m1-board.jpg rename to boards/renesas/ek_ra8m1/doc/ek_ra8m1.jpg diff --git a/boards/renesas/ek_ra8m1/doc/index.rst b/boards/renesas/ek_ra8m1/doc/index.rst index 21897fff0bff4..ea658a0b120c0 100644 --- a/boards/renesas/ek_ra8m1/doc/index.rst +++ b/boards/renesas/ek_ra8m1/doc/index.rst @@ -61,7 +61,7 @@ The key features of the EK-RA8M1 board are categorized in three groups as follow - 512 Mb (64 MB) External Octo-SPI Flash (present in the MCU Native Pin Access area of the EK-RA8M1 board) - CAN FD (3-pin header) -.. figure:: ek-ra8m1-board.jpg +.. figure:: ek_ra8m1.jpg :align: center :alt: RA8M1 Evaluation Kit diff --git a/boards/renesas/fpb_ra6e1/doc/fpb-ra6e1-board.webp b/boards/renesas/fpb_ra6e1/doc/fpb_ra6e1.webp similarity index 100% rename from boards/renesas/fpb_ra6e1/doc/fpb-ra6e1-board.webp rename to boards/renesas/fpb_ra6e1/doc/fpb_ra6e1.webp diff --git a/boards/renesas/fpb_ra6e1/doc/index.rst b/boards/renesas/fpb_ra6e1/doc/index.rst index 17332f0c5e296..482d24ff06207 100644 --- a/boards/renesas/fpb_ra6e1/doc/index.rst +++ b/boards/renesas/fpb_ra6e1/doc/index.rst @@ -46,7 +46,7 @@ The key features of the FPB-RA6E1 board are categorized in three groups as follo - MCU boot configuration jumper -.. figure:: fpb-ra6e1-board.webp +.. figure:: fpb_ra6e1.webp :align: center :alt: RA6E1 Evaluation Kit From f7e130f9824ada465153e6a19432362595db9ac2 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Tue, 15 Oct 2024 12:14:26 +0200 Subject: [PATCH 0845/4482] scripts: ci: check_compliance: Order list alphabetically Print the compliance checks alphabetically by default. Signed-off-by: Pieter De Gendt --- scripts/ci/check_compliance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 1a45e32a7411d..038370ae3c4f3 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1717,7 +1717,7 @@ def _main(args): logger.info(f'Running tests on commit range {COMMIT_RANGE}') if args.list: - for testcase in inheritors(ComplianceTest): + for testcase in sorted(inheritors(ComplianceTest), key=lambda x: x.name): print(testcase.name) return 0 From c70a619a2fdb5db997a8bcc8c6d7a49ebe168163 Mon Sep 17 00:00:00 2001 From: Peter Mitsis Date: Fri, 11 Oct 2024 11:40:47 -0700 Subject: [PATCH 0846/4482] kernel: Remove unused z_ready_thread_locked() Removing the routine z_ready_thread_locked() as it is not used anywhere. It was a leftover artefact from development that previously escaped cleanup. Signed-off-by: Peter Mitsis --- kernel/include/ksched.h | 1 - kernel/sched.c | 7 ------- 2 files changed, 8 deletions(-) diff --git a/kernel/include/ksched.h b/kernel/include/ksched.h index e82d1d116387f..b832fda333c7f 100644 --- a/kernel/include/ksched.h +++ b/kernel/include/ksched.h @@ -60,7 +60,6 @@ void z_reset_time_slice(struct k_thread *curr); void z_sched_ipi(void); void z_sched_start(struct k_thread *thread); void z_ready_thread(struct k_thread *thread); -void z_ready_thread_locked(struct k_thread *thread); void z_requeue_current(struct k_thread *curr); struct k_thread *z_swap_next_thread(void); void z_thread_abort(struct k_thread *thread); diff --git a/kernel/sched.c b/kernel/sched.c index f55b2f8a13b51..f8d734f4cb5cb 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -389,13 +389,6 @@ static void ready_thread(struct k_thread *thread) } } -void z_ready_thread_locked(struct k_thread *thread) -{ - if (thread_active_elsewhere(thread) == NULL) { - ready_thread(thread); - } -} - void z_ready_thread(struct k_thread *thread) { K_SPINLOCK(&_sched_spinlock) { From cc07117bca0684b6ce2ab2c9c8a7e85d1df724f7 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Fri, 11 Oct 2024 10:15:11 -0700 Subject: [PATCH 0847/4482] cmake: xcc: do not use -fno-printf-return-value XCC does not recognize -fno-printf-return-value as compiler flag. So skip it. Signed-off-by: Daniel Leung --- cmake/compiler/xcc/compiler_flags.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/compiler/xcc/compiler_flags.cmake b/cmake/compiler/xcc/compiler_flags.cmake index 28f76d5d80962..4528b6a7421b9 100644 --- a/cmake/compiler/xcc/compiler_flags.cmake +++ b/cmake/compiler/xcc/compiler_flags.cmake @@ -15,3 +15,6 @@ set_compiler_property(PROPERTY no_position_independent "") # Remove after testing that -Wshadow works set_compiler_property(PROPERTY warning_shadow_variables) + +# xcc does not recognize -fno-printf-return-value +set_compiler_property(PROPERTY no_printf_return_value) From 2dee8a473310541b5e51fb18de5df2a233cc1187 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Fri, 11 Oct 2024 10:16:04 -0700 Subject: [PATCH 0848/4482] cmake: xcc: use xt-ld linker cmake code Shuffling of ld/lld on C library linking cmake code causes issue with XCC as the HAL library is not being included in linking. So make XCC to use xt-ld linker cmake code such that the HAL library is included. Signed-off-by: Daniel Leung --- cmake/toolchain/xcc/generic.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/toolchain/xcc/generic.cmake b/cmake/toolchain/xcc/generic.cmake index 02a9063bf5f43..daf00acc16c01 100644 --- a/cmake/toolchain/xcc/generic.cmake +++ b/cmake/toolchain/xcc/generic.cmake @@ -6,6 +6,7 @@ set(COMPILER xcc) set(OPTIMIZE_FOR_DEBUG_FLAG "-O0") set(CC xcc) set(C++ xc++) +set(LINKER xt-ld) list(APPEND TOOLCHAIN_C_FLAGS -imacros${ZEPHYR_BASE}/include/zephyr/toolchain/xcc_missing_defs.h From ac98d0e3507dfe26b3fc1b0df17b5d4ad288351e Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Fri, 11 Oct 2024 13:24:24 -0700 Subject: [PATCH 0849/4482] cmake: xcc: remove TOOLCHAIN_LIBS Following the footstep of GCC/Clang cmake code to remove TOOLCHAIN_LIBS, xcc also has it removed and utilizes something similar to c_library to link the HAL library. Signed-off-by: Daniel Leung --- cmake/compiler/xcc/target.cmake | 6 ------ cmake/linker/xt-ld/linker_libraries.cmake | 3 ++- cmake/linker/xt-ld/target.cmake | 1 - 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/cmake/compiler/xcc/target.cmake b/cmake/compiler/xcc/target.cmake index a23c9d5bde68c..db965e715a839 100644 --- a/cmake/compiler/xcc/target.cmake +++ b/cmake/compiler/xcc/target.cmake @@ -40,12 +40,6 @@ foreach(file_name include/stddef.h include-fixed/limits.h) list(APPEND NOSTDINC ${_OUTPUT}) endforeach() -list(APPEND TOOLCHAIN_LIBS - gcc - hal - ) - - # For CMake to be able to test if a compiler flag is supported by the # toolchain we need to give CMake the necessary flags to compile and # link a dummy C file. diff --git a/cmake/linker/xt-ld/linker_libraries.cmake b/cmake/linker/xt-ld/linker_libraries.cmake index 64c185c74b42c..f4fedfc4f0d46 100644 --- a/cmake/linker/xt-ld/linker_libraries.cmake +++ b/cmake/linker/xt-ld/linker_libraries.cmake @@ -5,4 +5,5 @@ set_linker_property(NO_CREATE PROPERTY c_library "-lc") set_linker_property(NO_CREATE PROPERTY rt_library "-lgcc") set_linker_property(NO_CREATE PROPERTY c++_library "-lstdc++") -set_linker_property(PROPERTY link_order_library "c;rt") +set_linker_property(NO_CREATE PROPERTY hal_library "-lhal") +set_linker_property(PROPERTY link_order_library "c;rt;hal") diff --git a/cmake/linker/xt-ld/target.cmake b/cmake/linker/xt-ld/target.cmake index 3546881cc718e..9a6b76cda621e 100644 --- a/cmake/linker/xt-ld/target.cmake +++ b/cmake/linker/xt-ld/target.cmake @@ -130,7 +130,6 @@ function(toolchain_ld_link_elf) ${NO_WHOLE_ARCHIVE_LIBS} $ -L${PROJECT_BINARY_DIR} - ${TOOLCHAIN_LIBS} ${TOOLCHAIN_LD_LINK_ELF_DEPENDENCIES} ) From c5a126cedb2f96239662352ae1662424d261c53e Mon Sep 17 00:00:00 2001 From: Burak Gorduk Date: Tue, 15 Oct 2024 10:38:29 +0100 Subject: [PATCH 0850/4482] bluetooth: host: LE CS subevent result reassembly Adds HCI support for LE CS subevent result continue event and the reassembly logic for the partial results. When subevent results are completed or the subevent is aborted, the user callback is invoked with a buffer pointing to the HCI event buffer, so no copy is done. When subevent results are incomplete, then a reassembly buffer is allocated from a fixed sized pool. This buffer is used for the reassembling of the subevent result containing all of the step data, which is then passed to the user via the callback. kconfigs have been added to set the size and the count of the reassembly buffer. Signed-off-by: Burak Gorduk --- include/zephyr/bluetooth/conn.h | 20 +- include/zephyr/bluetooth/hci_types.h | 20 ++ subsys/bluetooth/Kconfig | 20 ++ subsys/bluetooth/host/cs.c | 415 ++++++++++++++++++++++++--- subsys/bluetooth/host/hci_core.c | 4 + subsys/bluetooth/host/hci_core.h | 1 + 6 files changed, 446 insertions(+), 34 deletions(-) diff --git a/include/zephyr/bluetooth/conn.h b/include/zephyr/bluetooth/conn.h index 8aed8d99f5639..8a97be8001f7e 100644 --- a/include/zephyr/bluetooth/conn.h +++ b/include/zephyr/bluetooth/conn.h @@ -548,7 +548,6 @@ enum bt_conn_le_cs_procedure_done_status { /** Subevent done status */ enum bt_conn_le_cs_subevent_done_status { BT_CONN_LE_CS_SUBEVENT_COMPLETE = BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_COMPLETE, - BT_CONN_LE_CS_SUBEVENT_INCOMPLETE = BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_PARTIAL, BT_CONN_LE_CS_SUBEVENT_ABORTED = BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_ABORTED, }; @@ -618,7 +617,19 @@ struct bt_conn_le_cs_subevent_result { int8_t reference_power_level; /** Procedure status. */ enum bt_conn_le_cs_procedure_done_status procedure_done_status; - /** Subevent status. */ + /** Subevent status + * + * For aborted subevents, this will be set to @ref BT_CONN_LE_CS_SUBEVENT_ABORTED + * and abort_step will contain the step number on which the subevent was aborted. + * Consider the following example: + * + * subevent_done_status = @ref BT_CONN_LE_CS_SUBEVENT_ABORTED + * num_steps_reported = 160 + * abort_step = 100 + * + * this would mean that steps from 0 to 99 are complete and steps from 100 to 159 + * are aborted. + */ enum bt_conn_le_cs_subevent_done_status subevent_done_status; /** Abort reason. * @@ -640,6 +651,11 @@ struct bt_conn_le_cs_subevent_result { /** Number of CS steps in the subevent. */ uint8_t num_steps_reported; + /** Step number, on which the subevent was aborted + * if subevent_done_status is @ref BT_CONN_LE_CS_SUBEVENT_COMPLETE + * then abort_step will be unused and set to 255 + */ + uint8_t abort_step; } header; struct net_buf_simple *step_data_buf; }; diff --git a/include/zephyr/bluetooth/hci_types.h b/include/zephyr/bluetooth/hci_types.h index 131b81134c1ce..cc3ea00afd18c 100644 --- a/include/zephyr/bluetooth/hci_types.h +++ b/include/zephyr/bluetooth/hci_types.h @@ -3636,6 +3636,25 @@ struct bt_hci_evt_le_cs_subevent_result { uint8_t steps[]; } __packed; +#define BT_HCI_EVT_LE_CS_SUBEVENT_RESULT_CONTINUE 0x32 + +struct bt_hci_evt_le_cs_subevent_result_continue { + uint16_t conn_handle; + uint8_t config_id; + uint8_t procedure_done_status; + uint8_t subevent_done_status; +#ifdef CONFIG_LITTLE_ENDIAN + uint8_t procedure_abort_reason: 4; + uint8_t subevent_abort_reason: 4; +#else + uint8_t subevent_abort_reason: 4; + uint8_t procedure_abort_reason: 4; +#endif /* CONFIG_LITTLE_ENDIAN */ + uint8_t num_antenna_paths; + uint8_t num_steps_reported; + uint8_t steps[]; +} __packed; + #define BT_HCI_EVT_LE_CS_TEST_END_COMPLETE 0x33 struct bt_hci_evt_le_cs_test_end_complete { uint8_t status; @@ -3734,6 +3753,7 @@ struct bt_hci_evt_le_cs_test_end_complete { #define BT_EVT_MASK_LE_CS_READ_REMOTE_FAE_TABLE_COMPLETE BT_EVT_BIT(44) #define BT_EVT_MASK_LE_CS_CONFIG_COMPLETE BT_EVT_BIT(46) #define BT_EVT_MASK_LE_CS_SUBEVENT_RESULT BT_EVT_BIT(48) +#define BT_EVT_MASK_LE_CS_SUBEVENT_RESULT_CONTINUE BT_EVT_BIT(49) #define BT_EVT_MASK_LE_CS_TEST_END_COMPLETE BT_EVT_BIT(50) /** HCI Error Codes, BT Core Spec v5.4 [Vol 1, Part F]. */ diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index b86de460e384b..d5560d6d5d0ea 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -203,6 +203,26 @@ config BT_CHANNEL_SOUNDING_TEST help Enable support for Channel Sounding test mode. +config BT_CHANNEL_SOUNDING_REASSEMBLY_BUFFER_SIZE + int "Subevent result reassembly buffer size" + depends on BT_CHANNEL_SOUNDING + range 239 5600 + default 5600 + help + When the results for a CS subevent cannot fit into a single HCI event, + it will be split up into multiple events and consequently, reassembled into a + full CS subevent. This config sets the size of the reassembly buffer. + +config BT_CHANNEL_SOUNDING_REASSEMBLY_BUFFER_CNT + int "Subevent result reassembly buffer count" + depends on BT_CHANNEL_SOUNDING + range 1 BT_MAX_CONN + default 1 + help + Controls the number of the reassembly buffers for CS subevent + results. Each running CS procedure is allocated one buffer and the + number of concurrent CS procedures is limited by this value. + endif # BT_CONN rsource "Kconfig.iso" diff --git a/subsys/bluetooth/host/cs.c b/subsys/bluetooth/host/cs.c index 75d5f21cf2c61..5a09c01726188 100644 --- a/subsys/bluetooth/host/cs.c +++ b/subsys/bluetooth/host/cs.c @@ -22,6 +22,224 @@ LOG_MODULE_REGISTER(bt_cs); static struct bt_le_cs_test_cb cs_test_callbacks; #endif +struct reassembly_buf_meta_data { + uint16_t conn_handle; +}; + +static void clear_on_disconnect(struct bt_conn *conn, uint8_t reason); + +NET_BUF_POOL_FIXED_DEFINE(reassembly_buf_pool, CONFIG_BT_CHANNEL_SOUNDING_REASSEMBLY_BUFFER_CNT, + CONFIG_BT_CHANNEL_SOUNDING_REASSEMBLY_BUFFER_SIZE, + sizeof(struct reassembly_buf_meta_data), NULL); + +static sys_slist_t reassembly_bufs = SYS_SLIST_STATIC_INIT(&reassembly_bufs); + +struct bt_conn_le_cs_subevent_result reassembled_result; + +BT_CONN_CB_DEFINE(cs_conn_callbacks) = { + .disconnected = clear_on_disconnect, +}; + +/** @brief Allocates new reassembly buffer identified by the connection handle + * + * @param conn_handle Connection handle + * @return struct net_buf* Reassembly buffer, NULL if allocation fails + */ +static struct net_buf *alloc_reassembly_buf(uint16_t conn_handle) +{ + struct net_buf *buf = net_buf_alloc(&reassembly_buf_pool, K_NO_WAIT); + + if (!buf) { + LOG_ERR("Failed to allocate new reassembly buffer"); + return NULL; + } + + struct reassembly_buf_meta_data *buf_meta_data = + (struct reassembly_buf_meta_data *)buf->user_data; + + buf_meta_data->conn_handle = conn_handle; + net_buf_slist_put(&reassembly_bufs, buf); + + LOG_DBG("Allocated new reassembly buffer for conn handle %d", conn_handle); + return buf; +} + +/** @brief Frees a reassembly buffer + * + * @note Takes the ownership of the pointer and sets it to NULL + * + * @param buf Double pointer to reassembly buffer + */ +static void free_reassembly_buf(struct net_buf **buf) +{ + if (!buf) { + LOG_ERR("NULL double pointer was passed when attempting to free reassembly buffer"); + return; + } + + if (!(*buf)) { + LOG_WRN("Attempted double free on reassembly buffer"); + return; + } + + struct reassembly_buf_meta_data *buf_meta_data = + (struct reassembly_buf_meta_data *)((*buf)->user_data); + + LOG_DBG("De-allocating reassembly buffer for conn handle %d", buf_meta_data->conn_handle); + if (!sys_slist_find_and_remove(&reassembly_bufs, &(*buf)->node)) { + LOG_WRN("The buffer was not in the list"); + } + + net_buf_unref(*buf); + *buf = NULL; +} + +/** @brief Gets the reassembly buffer identified by the connection handle + * + * @param conn_handle Connection handle + * @param allocate Allocates a new reassembly buffer if it's not allocated already + * @return struct net_buf* Reassembly buffer, NULL if it doesn't exist or failed when allocating new + */ +static struct net_buf *get_reassembly_buf(uint16_t conn_handle, bool allocate) +{ + sys_snode_t *node; + + SYS_SLIST_FOR_EACH_NODE(&reassembly_bufs, node) { + struct net_buf *buf = CONTAINER_OF(node, struct net_buf, node); + struct reassembly_buf_meta_data *buf_meta_data = + (struct reassembly_buf_meta_data *)(buf->user_data); + + if (buf_meta_data->conn_handle == conn_handle) { + return buf; + } + } + + return allocate ? alloc_reassembly_buf(conn_handle) : NULL; +} + +/** @brief Adds step data to a reassembly buffer + * + * @param reassembly_buf Reassembly buffer + * @param data Step data + * @param data_len Step data length + * @return true if successful, false if there is insufficient space + */ +static bool add_reassembly_data(struct net_buf *reassembly_buf, const uint8_t *data, + uint16_t data_len) +{ + if (data_len > net_buf_tailroom(reassembly_buf)) { + LOG_ERR("Not enough reassembly buffer space for subevent result"); + return false; + } + + net_buf_add_mem(reassembly_buf, data, data_len); + return true; +} + +/** @brief Initializes a reassembly buffer from partial step data + * + * @note Upon first call, this function also registers the disconnection callback + * to ensure any dangling reassembly buffer is freed + * + * @param conn_handle Connection handle + * @param steps Step data + * @param step_data_len Step data length + * @return struct net_buf* Pointer to reassembly buffer, NULL if fails to allocate or insert data + */ +static struct net_buf *start_reassembly(uint16_t conn_handle, const uint8_t *steps, + uint16_t step_data_len) +{ + struct net_buf *reassembly_buf = get_reassembly_buf(conn_handle, true); + + if (!reassembly_buf) { + LOG_ERR("No buffer allocated for the result reassembly"); + return NULL; + } + + if (reassembly_buf->len) { + LOG_WRN("Over-written incomplete CS subevent results"); + } + + net_buf_reset(reassembly_buf); + + bool success = add_reassembly_data(reassembly_buf, steps, step_data_len); + + return success ? reassembly_buf : NULL; +} + +/** @brief Adds more step data to reassembly buffer identified by the connection handle + * + * @param conn_handle Connection handle + * @param steps Step data + * @param step_data_len Step data length + * @return struct net_buf* Pointer to reassembly buffer, NULL if fails to insert data + */ +static struct net_buf *continue_reassembly(uint16_t conn_handle, const uint8_t *steps, + uint16_t step_data_len) +{ + struct net_buf *reassembly_buf = get_reassembly_buf(conn_handle, false); + + if (!reassembly_buf) { + LOG_ERR("No reassembly buffer was allocated for this CS procedure, possibly due to " + "an out-of-order subevent result continue event"); + return NULL; + } + + if (!reassembly_buf->len) { + LOG_WRN("Discarded out-of-order partial CS subevent results"); + return NULL; + } + + if (!step_data_len) { + return reassembly_buf; + } + + bool success = add_reassembly_data(reassembly_buf, steps, step_data_len); + + return success ? reassembly_buf : NULL; +} + +/** + * @brief Disconnect callback to clear any dangling reassembly buffer + * + * @param conn Connection + * @param reason Reason + */ +static void clear_on_disconnect(struct bt_conn *conn, uint8_t reason) +{ + struct net_buf *buf = get_reassembly_buf(conn->handle, false); + + if (buf) { + free_reassembly_buf(&buf); + } +} + +/** @brief Invokes user callback for new subevent results + * + * @param conn Connection context, NULL for CS Test subevent results + * @param p_result Pointer to subevent results + */ +static void invoke_subevent_result_callback(struct bt_conn *conn, + struct bt_conn_le_cs_subevent_result *p_result) +{ +#if defined(CONFIG_BT_CHANNEL_SOUNDING_TEST) + if (!conn) { + cs_test_callbacks.le_cs_test_subevent_data_available(p_result); + } else +#endif /* CONFIG_BT_CHANNEL_SOUNDING_TEST */ + { + notify_cs_subevent_result(conn, p_result); + } +} + +/** @brief Resets reassembly results + * + */ +static void reset_reassembly_results(void) +{ + memset(&reassembled_result, 0, sizeof(struct bt_conn_le_cs_subevent_result)); +} + void bt_le_cs_set_valid_chmap_bits(uint8_t channel_map[10]) { memset(channel_map, 0xFF, 10); @@ -360,7 +578,9 @@ void bt_hci_le_cs_subevent_result(struct net_buf *buf) struct bt_conn *conn = NULL; struct bt_hci_evt_le_cs_subevent_result *evt; struct bt_conn_le_cs_subevent_result result; + struct bt_conn_le_cs_subevent_result *p_result = &result; struct net_buf_simple step_data_buf; + struct net_buf *reassembly_buf = NULL; if (buf->len < sizeof(*evt)) { LOG_ERR("Unexpected end of buffer"); @@ -368,14 +588,10 @@ void bt_hci_le_cs_subevent_result(struct net_buf *buf) } evt = net_buf_pull_mem(buf, sizeof(*evt)); - - if (evt->subevent_done_status == BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_PARTIAL) { - LOG_WRN("Discarded incomplete CS subevent results."); - return; - } + uint16_t conn_handle = sys_le16_to_cpu(evt->conn_handle); #if defined(CONFIG_BT_CHANNEL_SOUNDING_TEST) - if (sys_le16_to_cpu(evt->conn_handle) == BT_HCI_LE_CS_TEST_CONN_HANDLE) { + if (conn_handle == BT_HCI_LE_CS_TEST_CONN_HANDLE) { if (!cs_test_callbacks.le_cs_test_subevent_data_available) { LOG_WRN("No callback registered. Discarded subevent results from CS Test."); return; @@ -383,49 +599,177 @@ void bt_hci_le_cs_subevent_result(struct net_buf *buf) } else #endif /* CONFIG_BT_CHANNEL_SOUNDING_TEST */ { - conn = bt_conn_lookup_handle(sys_le16_to_cpu(evt->conn_handle), BT_CONN_TYPE_LE); + conn = bt_conn_lookup_handle(conn_handle, BT_CONN_TYPE_LE); if (!conn) { LOG_ERR("Unknown connection handle when processing subevent results"); return; } } - result.header.procedure_counter = sys_le16_to_cpu(evt->procedure_counter); - result.header.frequency_compensation = sys_le16_to_cpu(evt->frequency_compensation); - result.header.procedure_done_status = evt->procedure_done_status; - result.header.subevent_done_status = evt->subevent_done_status; - result.header.procedure_abort_reason = evt->procedure_abort_reason; - result.header.subevent_abort_reason = evt->subevent_abort_reason; - result.header.reference_power_level = evt->reference_power_level; - result.header.num_antenna_paths = evt->num_antenna_paths; - result.header.num_steps_reported = evt->num_steps_reported; - - if (evt->num_steps_reported) { - net_buf_simple_init_with_data(&step_data_buf, - evt->steps, - buf->len); - result.step_data_buf = &step_data_buf; + if (evt->subevent_done_status != BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_PARTIAL) { + p_result->step_data_buf = NULL; + if (evt->num_steps_reported) { + net_buf_simple_init_with_data(&step_data_buf, evt->steps, buf->len); + p_result->step_data_buf = &step_data_buf; + } } else { - result.step_data_buf = NULL; + if (evt->procedure_done_status != BT_HCI_LE_CS_PROCEDURE_DONE_STATUS_PARTIAL) { + LOG_WRN("Procedure status is inconsistent with subevent status. Discarding " + "subevent results"); + goto abort; + } + + if (!evt->num_steps_reported) { + LOG_WRN("Discarding partial results without step data"); + goto abort; + } + + reassembly_buf = start_reassembly(conn_handle, evt->steps, buf->len); + if (!reassembly_buf) { + goto abort; + } + + p_result = &reassembled_result; + p_result->step_data_buf = (struct net_buf_simple *)&reassembly_buf->data; + } + + p_result->header.procedure_counter = sys_le16_to_cpu(evt->procedure_counter); + p_result->header.frequency_compensation = sys_le16_to_cpu(evt->frequency_compensation); + p_result->header.procedure_done_status = evt->procedure_done_status; + p_result->header.subevent_done_status = evt->subevent_done_status; + p_result->header.procedure_abort_reason = evt->procedure_abort_reason; + p_result->header.subevent_abort_reason = evt->subevent_abort_reason; + p_result->header.reference_power_level = evt->reference_power_level; + p_result->header.num_antenna_paths = evt->num_antenna_paths; + p_result->header.num_steps_reported = evt->num_steps_reported; + p_result->header.abort_step = + evt->subevent_done_status == BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_ABORTED ? 0 : 255; + + p_result->header.config_id = 0; + p_result->header.start_acl_conn_event = 0; + if (conn) { + p_result->header.config_id = evt->config_id; + p_result->header.start_acl_conn_event = + sys_le16_to_cpu(evt->start_acl_conn_event_counter); } -#if defined(CONFIG_BT_CHANNEL_SOUNDING_TEST) - if (sys_le16_to_cpu(evt->conn_handle) == BT_HCI_LE_CS_TEST_CONN_HANDLE) { - result.header.config_id = 0; - result.header.start_acl_conn_event = 0; + if (evt->subevent_done_status != BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_PARTIAL) { + invoke_subevent_result_callback(conn, p_result); + } + + if (evt->procedure_done_status != BT_CONN_LE_CS_PROCEDURE_INCOMPLETE) { + /* We can now clear the any reassembly buffer allocated for this procedure, + * to avoid code duplication, we're using the abort label to do so + */ + goto abort; + } - cs_test_callbacks.le_cs_test_subevent_data_available(&result); + if (conn) { + bt_conn_unref(conn); + conn = NULL; + } + + return; + +abort: + if (conn) { + bt_conn_unref(conn); + conn = NULL; + } + + reassembly_buf = get_reassembly_buf(conn_handle, false); + if (reassembly_buf) { + free_reassembly_buf(&reassembly_buf); + } +} + +void bt_hci_le_cs_subevent_result_continue(struct net_buf *buf) +{ + struct bt_conn *conn = NULL; + struct bt_hci_evt_le_cs_subevent_result_continue *evt; + struct net_buf *reassembly_buf = NULL; + uint16_t conn_handle; + if (buf->len < sizeof(*evt)) { + LOG_ERR("Unexpected end of buffer"); + return; + } + + evt = net_buf_pull_mem(buf, sizeof(*evt)); + conn_handle = sys_le16_to_cpu(evt->conn_handle); + +#if defined(CONFIG_BT_CHANNEL_SOUNDING_TEST) + if (conn_handle == BT_HCI_LE_CS_TEST_CONN_HANDLE) { + if (!cs_test_callbacks.le_cs_test_subevent_data_available) { + LOG_WRN("No callback registered. Discarded subevent results from CS Test."); + return; + } } else #endif /* CONFIG_BT_CHANNEL_SOUNDING_TEST */ { - result.header.config_id = evt->config_id; - result.header.start_acl_conn_event = - sys_le16_to_cpu(evt->start_acl_conn_event_counter); + conn = bt_conn_lookup_handle(conn_handle, BT_CONN_TYPE_LE); + if (!conn) { + LOG_ERR("Unknown connection handle when processing subevent results"); + return; + } + } + + uint16_t step_data_len = evt->num_steps_reported ? buf->len : 0; + + reassembly_buf = continue_reassembly(conn_handle, evt->steps, step_data_len); + if (!reassembly_buf) { + goto abort; + } - notify_cs_subevent_result(conn, &result); + reassembled_result.header.procedure_done_status = evt->procedure_done_status; + reassembled_result.header.subevent_done_status = evt->subevent_done_status; + reassembled_result.header.procedure_abort_reason = evt->procedure_abort_reason; + reassembled_result.header.subevent_abort_reason = evt->subevent_abort_reason; + if (evt->num_antenna_paths != reassembled_result.header.num_antenna_paths) { + LOG_WRN("Received inconsistent number of antenna paths from the controller: %d, " + "previous number was: %d", + evt->num_antenna_paths, reassembled_result.header.num_antenna_paths); + } + + if (evt->subevent_done_status == BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_ABORTED && + reassembled_result.header.num_steps_reported < reassembled_result.header.abort_step) { + reassembled_result.header.abort_step = reassembled_result.header.num_steps_reported; + } + + reassembled_result.header.num_steps_reported += evt->num_steps_reported; + + if (evt->subevent_done_status != BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_PARTIAL) { + invoke_subevent_result_callback(conn, &reassembled_result); + net_buf_reset(reassembly_buf); + reset_reassembly_results(); + } + + if (evt->procedure_done_status != BT_HCI_LE_CS_PROCEDURE_DONE_STATUS_PARTIAL) { + if (evt->subevent_done_status == BT_HCI_LE_CS_SUBEVENT_DONE_STATUS_PARTIAL) { + LOG_WRN("Procedure status is inconsistent with subevent status. Discarding " + "subevent results"); + goto abort; + } + + free_reassembly_buf(&reassembly_buf); + } + + if (conn) { + bt_conn_unref(conn); + conn = NULL; + } + + return; + +abort: + if (conn) { bt_conn_unref(conn); + conn = NULL; + } + + if (reassembly_buf) { + free_reassembly_buf(&reassembly_buf); } } @@ -561,6 +905,13 @@ void bt_hci_le_cs_test_end_complete(struct net_buf *buf) return; } + struct net_buf *reassembly_buf = get_reassembly_buf(BT_HCI_LE_CS_TEST_CONN_HANDLE, false); + + if (reassembly_buf) { + LOG_WRN("De-allocating a dangling reassembly buffer"); + free_reassembly_buf(&reassembly_buf); + } + if (cs_test_callbacks.le_cs_test_end_complete) { cs_test_callbacks.le_cs_test_end_complete(); } diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 14b48ed0e797a..bb476dd328dd2 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -2833,6 +2833,9 @@ static const struct event_handler meta_events[] = { EVENT_HANDLER(BT_HCI_EVT_LE_CS_SUBEVENT_RESULT, bt_hci_le_cs_subevent_result, sizeof(struct bt_hci_evt_le_cs_subevent_result)), + EVENT_HANDLER(BT_HCI_EVT_LE_CS_SUBEVENT_RESULT_CONTINUE, + bt_hci_le_cs_subevent_result_continue, + sizeof(struct bt_hci_evt_le_cs_subevent_result_continue)), #if defined(CONFIG_BT_CHANNEL_SOUNDING_TEST) EVENT_HANDLER(BT_HCI_EVT_LE_CS_TEST_END_COMPLETE, bt_hci_le_cs_test_end_complete, @@ -3416,6 +3419,7 @@ static int le_set_event_mask(void) mask |= BT_EVT_MASK_LE_CS_READ_REMOTE_FAE_TABLE_COMPLETE; mask |= BT_EVT_MASK_LE_CS_CONFIG_COMPLETE; mask |= BT_EVT_MASK_LE_CS_SUBEVENT_RESULT; + mask |= BT_EVT_MASK_LE_CS_SUBEVENT_RESULT_CONTINUE; mask |= BT_EVT_MASK_LE_CS_TEST_END_COMPLETE; } diff --git a/subsys/bluetooth/host/hci_core.h b/subsys/bluetooth/host/hci_core.h index 27387c9c53fd2..458576e74f781 100644 --- a/subsys/bluetooth/host/hci_core.h +++ b/subsys/bluetooth/host/hci_core.h @@ -543,6 +543,7 @@ void bt_hci_le_cs_read_remote_supported_capabilities_complete(struct net_buf *bu void bt_hci_le_cs_read_remote_fae_table_complete(struct net_buf *buf); void bt_hci_le_cs_config_complete_event(struct net_buf *buf); void bt_hci_le_cs_subevent_result(struct net_buf *buf); +void bt_hci_le_cs_subevent_result_continue(struct net_buf *buf); void bt_hci_le_cs_test_end_complete(struct net_buf *buf); /* Adv HCI event handlers */ From bfe3c4353c7945fdedbdd99698eb228da6897749 Mon Sep 17 00:00:00 2001 From: Burak Gorduk Date: Tue, 15 Oct 2024 10:41:47 +0100 Subject: [PATCH 0851/4482] bluetooth: host Accommodate platform endianness for CS types Modifies the CS bitfields that are used for accessing HCI event data to take platform endiannes into consideration. Signed-off-by: Burak Gorduk --- include/zephyr/bluetooth/hci_types.h | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/include/zephyr/bluetooth/hci_types.h b/include/zephyr/bluetooth/hci_types.h index cc3ea00afd18c..a620097acafbe 100644 --- a/include/zephyr/bluetooth/hci_types.h +++ b/include/zephyr/bluetooth/hci_types.h @@ -3524,8 +3524,13 @@ struct bt_hci_evt_le_cs_config_complete { #define BT_HCI_EVT_LE_CS_SUBEVENT_RESULT 0x31 /** Subevent result step data format: Mode 0 Initiator */ struct bt_hci_le_cs_step_data_mode_0_initiator { +#ifdef CONFIG_LITTLE_ENDIAN uint8_t packet_quality_aa_check: 4; uint8_t packet_quality_bit_errors: 4; +#else + uint8_t packet_quality_bit_errors: 4; + uint8_t packet_quality_aa_check: 4; +#endif /* CONFIG_LITTLE_ENDIAN */ uint8_t packet_rssi; uint8_t packet_antenna; uint16_t measured_freq_offset; @@ -3533,16 +3538,26 @@ struct bt_hci_le_cs_step_data_mode_0_initiator { /** Subevent result step data format: Mode 0 Reflector */ struct bt_hci_le_cs_step_data_mode_0_reflector { +#ifdef CONFIG_LITTLE_ENDIAN uint8_t packet_quality_aa_check: 4; uint8_t packet_quality_bit_errors: 4; +#else + uint8_t packet_quality_bit_errors: 4; + uint8_t packet_quality_aa_check: 4; +#endif /* CONFIG_LITTLE_ENDIAN */ uint8_t packet_rssi; uint8_t packet_antenna; } __packed; /** Subevent result step data format: Mode 1 */ struct bt_hci_le_cs_step_data_mode_1 { +#ifdef CONFIG_LITTLE_ENDIAN uint8_t packet_quality_aa_check: 4; uint8_t packet_quality_bit_errors: 4; +#else + uint8_t packet_quality_bit_errors: 4; + uint8_t packet_quality_aa_check: 4; +#endif /* CONFIG_LITTLE_ENDIAN */ uint8_t packet_nadm; uint8_t packet_rssi; union { @@ -3554,8 +3569,13 @@ struct bt_hci_le_cs_step_data_mode_1 { /** Subevent result step data format: Mode 1 with sounding sequence RTT support */ struct bt_hci_le_cs_step_data_mode_1_ss_rtt { +#ifdef CONFIG_LITTLE_ENDIAN uint8_t packet_quality_aa_check: 4; uint8_t packet_quality_bit_errors: 4; +#else + uint8_t packet_quality_bit_errors: 4; + uint8_t packet_quality_aa_check: 4; +#endif /* CONFIG_LITTLE_ENDIAN */ uint8_t packet_nadm; uint8_t packet_rssi; union { @@ -3571,8 +3591,13 @@ struct bt_hci_le_cs_step_data_mode_1_ss_rtt { /** Format for per-antenna path step data in modes 2 and 3 */ struct bt_hci_le_cs_step_data_tone_info { uint8_t phase_correction_term[3]; +#ifdef CONFIG_LITTLE_ENDIAN uint8_t quality_indicator: 4; uint8_t extension_indicator: 4; +#else + uint8_t extension_indicator: 4; + uint8_t quality_indicator: 4; +#endif /* CONFIG_LITTLE_ENDIAN */ } __packed; /** Subevent result step data format: Mode 2 */ @@ -3583,8 +3608,13 @@ struct bt_hci_le_cs_step_data_mode_2 { /** Subevent result step data format: Mode 3 */ struct bt_hci_le_cs_step_data_mode_3 { +#ifdef CONFIG_LITTLE_ENDIAN uint8_t packet_quality_aa_check: 4; uint8_t packet_quality_bit_errors: 4; +#else + uint8_t packet_quality_bit_errors: 4; + uint8_t packet_quality_aa_check: 4; +#endif /* CONFIG_LITTLE_ENDIAN */ uint8_t packet_nadm; uint8_t packet_rssi; union { @@ -3598,8 +3628,13 @@ struct bt_hci_le_cs_step_data_mode_3 { /** Subevent result step data format: Mode 3 with sounding sequence RTT support */ struct bt_hci_le_cs_step_data_mode_3_ss_rtt { +#ifdef CONFIG_LITTLE_ENDIAN uint8_t packet_quality_aa_check: 4; uint8_t packet_quality_bit_errors: 4; +#else + uint8_t packet_quality_bit_errors: 4; + uint8_t packet_quality_aa_check: 4; +#endif /* CONFIG_LITTLE_ENDIAN */ uint8_t packet_nadm; uint8_t packet_rssi; union { @@ -3629,8 +3664,13 @@ struct bt_hci_evt_le_cs_subevent_result { uint8_t reference_power_level; uint8_t procedure_done_status; uint8_t subevent_done_status; +#ifdef CONFIG_LITTLE_ENDIAN uint8_t procedure_abort_reason: 4; uint8_t subevent_abort_reason: 4; +#else + uint8_t subevent_abort_reason: 4; + uint8_t procedure_abort_reason: 4; +#endif /* CONFIG_LITTLE_ENDIAN */ uint8_t num_antenna_paths; uint8_t num_steps_reported; uint8_t steps[]; From fb1ffff7d31016a5bb0c6b3b60ee9c444c48bde4 Mon Sep 17 00:00:00 2001 From: Hake Huang Date: Wed, 2 Oct 2024 12:26:15 +0000 Subject: [PATCH 0852/4482] driver: uart: uart_mcux_lpuart fix issues in async api 1. optimized the logic for buffer usage in async api 2. skip timeout flush when the remaining counts is 0, as this will trigger dma_callback to process. 3. remove scatter mode, as we are not using this mode 4. trigger after dma_reload. Signed-off-by: Hake Huang --- drivers/serial/uart_mcux_lpuart.c | 62 ++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/drivers/serial/uart_mcux_lpuart.c b/drivers/serial/uart_mcux_lpuart.c index 233457af2c65c..a4c775c5b4e49 100644 --- a/drivers/serial/uart_mcux_lpuart.c +++ b/drivers/serial/uart_mcux_lpuart.c @@ -515,10 +515,11 @@ static void mcux_lpuart_async_rx_flush(const struct device *dev) const size_t rx_rcv_len = data->async.rx_dma_params.buf_len - status.pending_length; - if (rx_rcv_len > data->async.rx_dma_params.counter) { + if (rx_rcv_len > data->async.rx_dma_params.counter && status.pending_length) { data->async.rx_dma_params.counter = rx_rcv_len; async_evt_rx_rdy(dev); } + LPUART_ClearStatusFlags(config->base, kLPUART_RxOverrunFlag); } else { LOG_ERR("Error getting DMA status"); } @@ -584,7 +585,7 @@ static void prepare_rx_dma_block_config(const struct device *dev) head_block_config->dest_address = (uint32_t)rx_dma_params->buf; head_block_config->source_address = LPUART_GetDataRegisterAddress(lpuart); head_block_config->block_size = rx_dma_params->buf_len; - head_block_config->dest_scatter_en = true; + head_block_config->dest_scatter_en = false; } static int configure_and_start_rx_dma( @@ -615,20 +616,38 @@ static int uart_mcux_lpuart_dma_replace_rx_buffer(const struct device *dev) struct mcux_lpuart_data *data = (struct mcux_lpuart_data *)dev->data; const struct mcux_lpuart_config *config = dev->config; LPUART_Type *lpuart = config->base; + struct mcux_lpuart_rx_dma_params *rx_dma_params = &data->async.rx_dma_params; LOG_DBG("Replacing RX buffer, new length: %d", data->async.next_rx_buffer_len); + /* There must be a buffer to replace this one with */ assert(data->async.next_rx_buffer != NULL); assert(data->async.next_rx_buffer_len != 0U); - const int success = dma_reload(config->rx_dma_config.dma_dev, - config->rx_dma_config.dma_channel, - LPUART_GetDataRegisterAddress(lpuart), - (uint32_t)data->async.next_rx_buffer, - data->async.next_rx_buffer_len); + rx_dma_params->buf = data->async.next_rx_buffer; + rx_dma_params->buf_len = data->async.next_rx_buffer_len; + rx_dma_params->offset = 0; + rx_dma_params->counter = 0; + data->async.next_rx_buffer = NULL; + data->async.next_rx_buffer_len = 0U; + + const int success = + dma_reload(config->rx_dma_config.dma_dev, config->rx_dma_config.dma_channel, + LPUART_GetDataRegisterAddress(lpuart), (uint32_t)rx_dma_params->buf, + rx_dma_params->buf_len); if (success != 0) { LOG_ERR("Error %d reloading DMA with next RX buffer", success); } + /* Request next buffer */ + async_evt_rx_buf_request(dev); + + int ret = dma_start(config->rx_dma_config.dma_dev, config->rx_dma_config.dma_channel); + + if (ret < 0) { + LOG_ERR("Failed to start DMA(Rx) Ch %d(%d)", config->rx_dma_config.dma_channel, + ret); + } + return success; } @@ -673,16 +692,9 @@ static void dma_callback(const struct device *dma_dev, void *callback_arg, uint3 async_evt_rx_rdy(dev); async_evt_rx_buf_release(dev); - rx_dma_params->buf = data->async.next_rx_buffer; - rx_dma_params->buf_len = data->async.next_rx_buffer_len; - data->async.next_rx_buffer = NULL; - data->async.next_rx_buffer_len = 0U; - - /* A new buffer was available (and already loaded into the DMA engine) */ - if (rx_dma_params->buf != NULL && - rx_dma_params->buf_len > 0) { + if (data->async.next_rx_buffer != NULL && data->async.next_rx_buffer_len > 0) { /* Request the next buffer */ - async_evt_rx_buf_request(dev); + uart_mcux_lpuart_dma_replace_rx_buffer(dev); } else { /* Buffer full without valid next buffer, disable RX DMA */ LOG_INF("Disabled RX DMA, no valid next buffer "); @@ -832,6 +844,8 @@ static int mcux_lpuart_rx_enable(const struct device *dev, uint8_t *buf, const s rx_dma_params->timeout_us = timeout_us; rx_dma_params->buf = buf; rx_dma_params->buf_len = len; + data->async.next_rx_buffer = NULL; + data->async.next_rx_buffer_len = 0U; LPUART_EnableInterrupts(config->base, kLPUART_IdleLineInterruptEnable); prepare_rx_dma_block_config(dev); @@ -841,10 +855,9 @@ static int mcux_lpuart_rx_enable(const struct device *dev, uint8_t *buf, const s async_evt_rx_buf_request(dev); /* Clear these status flags as they can prevent the UART device from receiving data */ - LPUART_ClearStatusFlags(config->base, kLPUART_RxOverrunFlag | - kLPUART_ParityErrorFlag | - kLPUART_FramingErrorFlag | - kLPUART_NoiseErrorFlag); + LPUART_ClearStatusFlags(config->base, kLPUART_RxOverrunFlag | kLPUART_ParityErrorFlag | + kLPUART_FramingErrorFlag | + kLPUART_NoiseErrorFlag); LPUART_EnableRx(lpuart, true); irq_unlock(key); return ret; @@ -853,13 +866,14 @@ static int mcux_lpuart_rx_enable(const struct device *dev, uint8_t *buf, const s static int mcux_lpuart_rx_buf_rsp(const struct device *dev, uint8_t *buf, size_t len) { struct mcux_lpuart_data *data = dev->data; + unsigned int key; + key = irq_lock(); assert(data->async.next_rx_buffer == NULL); assert(data->async.next_rx_buffer_len == 0); data->async.next_rx_buffer = buf; data->async.next_rx_buffer_len = len; - uart_mcux_lpuart_dma_replace_rx_buffer(dev); - + irq_unlock(key); return 0; } @@ -921,6 +935,10 @@ static inline void mcux_lpuart_async_isr(struct mcux_lpuart_data *data, data->async.rx_dma_params.timeout_us); LPUART_ClearStatusFlags(config->base, kLPUART_IdleLineFlag); } + + if (status & kLPUART_RxOverrunFlag) { + LPUART_ClearStatusFlags(config->base, kLPUART_RxOverrunFlag); + } } #endif From 193bfabd3f0d82c751bbfb6a3e70c216d9e52fac Mon Sep 17 00:00:00 2001 From: Hake Huang Date: Wed, 2 Oct 2024 12:28:53 +0000 Subject: [PATCH 0853/4482] tests: uart_async_api: update test for dma usage 1. ensure the two dma buffers all aligned with 32 bits 2. clean the rx_data_idx at test begin Signed-off-by: Hake Huang --- .../uart/uart_async_api/src/test_uart_async.c | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/drivers/uart/uart_async_api/src/test_uart_async.c b/tests/drivers/uart/uart_async_api/src/test_uart_async.c index 15b4b6fba41a9..660bd843323fc 100644 --- a/tests/drivers/uart/uart_async_api/src/test_uart_async.c +++ b/tests/drivers/uart/uart_async_api/src/test_uart_async.c @@ -324,10 +324,15 @@ ZTEST_USER(uart_async_multi_rx, test_multiple_rx_enable) } #if NOCACHE_MEM -static __aligned(32) uint8_t chained_read_buf[2][8] __used __NOCACHE; +/* To ensure 32-bit alignment of the buffer array, + * the two arrays are defined instead using an array of arrays + */ +static __aligned(32) uint8_t chained_read_buf_0[8] __used __NOCACHE; +static __aligned(32) uint8_t chained_read_buf_1[8] __used __NOCACHE; static __aligned(32) uint8_t chained_cpy_buf[10] __used __NOCACHE; #else -ZTEST_BMEM uint8_t chained_read_buf[2][8]; +ZTEST_BMEM uint8_t chained_read_buf_0[8]; +ZTEST_BMEM uint8_t chained_read_buf_1[8]; ZTEST_BMEM uint8_t chained_cpy_buf[10]; #endif /* NOCACHE_MEM */ ZTEST_BMEM volatile uint8_t rx_data_idx; @@ -335,6 +340,8 @@ ZTEST_BMEM uint8_t rx_buf_idx; ZTEST_BMEM uint8_t *read_ptr; +static uint8_t *chained_read_buf[2] = {chained_read_buf_0, chained_read_buf_1}; + static void test_chained_read_callback(const struct device *dev, struct uart_event *evt, void *user_data) { @@ -352,9 +359,8 @@ static void test_chained_read_callback(const struct device *dev, rx_data_idx += evt->data.rx.len; break; case UART_RX_BUF_REQUEST: - err = uart_rx_buf_rsp(dev, - chained_read_buf[rx_buf_idx], - sizeof(chained_read_buf[0])); + err = uart_rx_buf_rsp(dev, chained_read_buf[rx_buf_idx], + sizeof(chained_read_buf_0)); zassert_equal(err, 0); rx_buf_idx = !rx_buf_idx ? 1 : 0; break; @@ -387,11 +393,10 @@ ZTEST_USER(uart_async_chain_read, test_chained_read) uint32_t rx_timeout_ms = 50; int err; - err = uart_rx_enable(uart_dev, - chained_read_buf[rx_buf_idx++], - sizeof(chained_read_buf[0]), + err = uart_rx_enable(uart_dev, chained_read_buf[rx_buf_idx++], sizeof(chained_read_buf_0), rx_timeout_ms * USEC_PER_MSEC); zassert_equal(err, 0); + rx_data_idx = 0; for (int i = 0; i < iter; i++) { zassert_not_equal(k_sem_take(&rx_disabled, K_MSEC(10)), @@ -406,7 +411,7 @@ ZTEST_USER(uart_async_chain_read, test_chained_read) "Unexpected amount of data received %d exp:%d", rx_data_idx, sizeof(tx_buf)); zassert_equal(memcmp(tx_buf, chained_cpy_buf, sizeof(tx_buf)), 0, - "Buffers not equal"); + "Buffers not equal exp %s, real %s", tx_buf, chained_cpy_buf); rx_data_idx = 0; } uart_rx_disable(uart_dev); From 0c54a3f8c7b4770820d3c2cfc02add29cc42f525 Mon Sep 17 00:00:00 2001 From: Gaofeng Zhang Date: Sun, 29 Sep 2024 14:24:22 +0800 Subject: [PATCH 0854/4482] hostapd: add ap status in l2 wifi add ap status in l2 wifi Signed-off-by: Gaofeng Zhang --- include/zephyr/net/wifi_mgmt.h | 12 ++++ modules/hostap/src/supp_api.c | 80 ++++++++++++++++++++- modules/hostap/src/supp_api.h | 9 +++ modules/hostap/src/supp_main.c | 1 + subsys/net/l2/wifi/wifi_mgmt.c | 2 + subsys/net/l2/wifi/wifi_shell.c | 120 +++++++++++++++++++++++--------- 6 files changed, 188 insertions(+), 36 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 5323b0d5a5c9e..0b45bdaef7ec3 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -1072,6 +1072,18 @@ struct wifi_wps_config_params { char pin[WIFI_WPS_PIN_MAX_LEN + 1]; }; +/** Wi-Fi AP status + */ +enum wifi_hostapd_iface_state { + WIFI_HAPD_IFACE_UNINITIALIZED, + WIFI_HAPD_IFACE_DISABLED, + WIFI_HAPD_IFACE_COUNTRY_UPDATE, + WIFI_HAPD_IFACE_ACS, + WIFI_HAPD_IFACE_HT_SCAN, + WIFI_HAPD_IFACE_DFS, + WIFI_HAPD_IFACE_ENABLED +}; + #include /** Scan result callback diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index c97f8f19819bb..a75c7e5afb53d 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -378,6 +378,8 @@ static inline enum wifi_security_type wpas_key_mgmt_to_zephyr(int key_mgmt, int return WIFI_SECURITY_TYPE_PSK_SHA256; case WPA_KEY_MGMT_SAE: return WIFI_SECURITY_TYPE_SAE; + case WPA_KEY_MGMT_SAE | WPA_KEY_MGMT_PSK: + return WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL; default: return WIFI_SECURITY_TYPE_UNKNOWN; } @@ -1570,7 +1572,7 @@ int hapd_config_network(struct hostapd_iface *iface, if (!hostapd_cli_cmd_v("set wpa 0")) { goto out; } - iface->bss[0]->conf->wpa_key_mgmt = 0; + iface->bss[0]->conf->wpa_key_mgmt = WPA_KEY_MGMT_NONE; } if (!hostapd_cli_cmd_v("set ieee80211w %d", params->mfp)) { @@ -1632,6 +1634,80 @@ int supplicant_ap_config_params(const struct device *dev, struct wifi_ap_config_ } #endif +int supplicant_ap_status(const struct device *dev, struct wifi_iface_status *status) +{ + int ret = 0; + struct hostapd_iface *iface; + struct hostapd_config *conf; + struct hostapd_data *hapd; + struct hostapd_bss_config *bss; + struct hostapd_ssid *ssid; + struct hostapd_hw_modes *hw_mode; + int proto; /* Wi-Fi secure protocol */ + int key_mgmt; /* Wi-Fi key management */ + + k_mutex_lock(&wpa_supplicant_mutex, K_FOREVER); + + iface = get_hostapd_handle(dev); + if (!iface) { + ret = -1; + wpa_printf(MSG_ERROR, "Interface %s not found", dev->name); + goto out; + } + + conf = iface->conf; + if (!conf) { + ret = -1; + wpa_printf(MSG_ERROR, "Conf %s not found", dev->name); + goto out; + } + + bss = conf->bss[0]; + if (!bss) { + ret = -1; + wpa_printf(MSG_ERROR, "Bss_conf %s not found", dev->name); + goto out; + } + + hapd = iface->bss[0]; + if (!hapd) { + ret = -1; + wpa_printf(MSG_ERROR, "Bss %s not found", dev->name); + goto out; + } + + status->state = iface->state; + ssid = &bss->ssid; + + os_memcpy(status->bssid, hapd->own_addr, WIFI_MAC_ADDR_LEN); + status->iface_mode = WPAS_MODE_AP; + status->band = wpas_band_to_zephyr(wpas_freq_to_band(iface->freq)); + key_mgmt = bss->wpa_key_mgmt; + proto = bss->wpa; + status->security = wpas_key_mgmt_to_zephyr(key_mgmt, proto); + status->mfp = bss->ieee80211w; + status->channel = conf->channel; + os_memcpy(status->ssid, ssid->ssid, ssid->ssid_len); + + status->dtim_period = bss->dtim_period; + status->beacon_interval = conf->beacon_int; + + hw_mode = iface->current_mode; + + status->link_mode = conf->ieee80211ax ? WIFI_6 + : conf->ieee80211ac ? WIFI_5 + : conf->ieee80211n ? WIFI_4 + : hw_mode->mode == HOSTAPD_MODE_IEEE80211G ? WIFI_3 + : hw_mode->mode == HOSTAPD_MODE_IEEE80211A ? WIFI_2 + : hw_mode->mode == HOSTAPD_MODE_IEEE80211B ? WIFI_1 + : WIFI_0; + status->twt_capable = (hw_mode->he_capab[IEEE80211_MODE_AP].mac_cap[0] & 0x04); + +out: + k_mutex_unlock(&wpa_supplicant_mutex); + return ret; +} + int supplicant_ap_enable(const struct device *dev, struct wifi_connect_req_params *params) { @@ -1711,7 +1787,7 @@ int supplicant_ap_enable(const struct device *dev, goto out; } - /* No need to check for existing network to join for SoftAP*/ + /* No need to check for existing network to join for SoftAP */ wpa_s->conf->ap_scan = 2; /* Set BSS parameter max_num_sta to default configured value */ wpa_s->conf->max_num_sta = CONFIG_WIFI_MGMT_AP_MAX_NUM_STA; diff --git a/modules/hostap/src/supp_api.h b/modules/hostap/src/supp_api.h index fb1bc2ead7133..4b64222653cb5 100644 --- a/modules/hostap/src/supp_api.h +++ b/modules/hostap/src/supp_api.h @@ -250,6 +250,15 @@ static inline int hapd_state(const struct device *dev, int *state) } #endif +/** + * @brief Get Wi-Fi SAP status + * + * @param dev Wi-Fi device + * @param status SAP status + * @return 0 for OK; -1 for ERROR + */ +int supplicant_ap_status(const struct device *dev, struct wifi_iface_status *status); + /** * @brief Set Wi-Fi AP configuration * diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index 380c32dfc16fe..b47b322e2aa3a 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -99,6 +99,7 @@ static const struct wifi_mgmt_ops mgmt_ap_ops = { .ap_disable = supplicant_ap_disable, .ap_sta_disconnect = supplicant_ap_sta_disconnect, .ap_bandwidth = supplicant_ap_bandwidth, + .iface_status = supplicant_ap_status, #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP .dpp_dispatch = hapd_dpp_dispatch, #endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */ diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 4ec8eb1a0d9cc..577d19ed3a42e 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -41,6 +41,8 @@ const char *wifi_security_txt(enum wifi_security_type security) return "WAPI"; case WIFI_SECURITY_TYPE_EAP_TLS: return "EAP"; + case WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL: + return "WPA/WPA2/WPA3 PSK"; case WIFI_SECURITY_TYPE_UNKNOWN: default: return "UNKNOWN"; diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 0c2fbe982c31b..48d0dc835ccd1 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -953,6 +953,65 @@ static int cmd_wifi_status(const struct shell *sh, size_t argc, char *argv[]) return 0; } +static int cmd_wifi_ap_status(const struct shell *sh, size_t argc, char *argv[]) +{ + struct net_if *iface = net_if_get_wifi_sap(); + struct wifi_iface_status status = {0}; + uint8_t mac_string_buf[sizeof("xx:xx:xx:xx:xx:xx")]; + + context.sh = sh; + + if (net_mgmt(NET_REQUEST_WIFI_IFACE_STATUS, iface, &status, + sizeof(struct wifi_iface_status))) { + PR_WARNING("Status request failed\n"); + + return -ENOEXEC; + } + + switch (status.state) { + case WIFI_HAPD_IFACE_UNINITIALIZED: + PR("State: %s\n", "HAPD_IFACE_UNINITIALIZED"); + return 0; + case WIFI_HAPD_IFACE_DISABLED: + PR("State: %s\n", "HAPD_IFACE_DISABLED"); + return 0; + case WIFI_HAPD_IFACE_COUNTRY_UPDATE: + PR("State: %s\n", "HAPD_IFACE_DISABLED"); + return 0; + case WIFI_HAPD_IFACE_ACS: + PR("State: %s\n", "HAPD_IFACE_DISABLED"); + return 0; + case WIFI_HAPD_IFACE_HT_SCAN: + PR("State: %s\n", "HAPD_IFACE_DISABLED"); + return 0; + case WIFI_HAPD_IFACE_DFS: + PR("State: %s\n", "HAPD_IFACE_DISABLED"); + break; + case WIFI_HAPD_IFACE_ENABLED: + break; + default: + return 0; + } + + PR("Interface Mode: %s\n", wifi_mode_txt(status.iface_mode)); + PR("Link Mode: %s\n", wifi_link_mode_txt(status.link_mode)); + PR("SSID: %.32s\n", status.ssid); + PR("BSSID: %s\n", net_sprint_ll_addr_buf(status.bssid, WIFI_MAC_ADDR_LEN, mac_string_buf, + sizeof(mac_string_buf))); + PR("Band: %s\n", wifi_band_txt(status.band)); + PR("Channel: %d\n", status.channel); + PR("Security: %s\n", wifi_security_txt(status.security)); + PR("MFP: %s\n", wifi_mfp_txt(status.mfp)); + if (status.iface_mode == WIFI_MODE_INFRA) { + PR("RSSI: %d\n", status.rssi); + } + PR("Beacon Interval: %d\n", status.beacon_interval); + PR("DTIM: %d\n", status.dtim_period); + PR("TWT: %s\n", status.twt_capable ? "Supported" : "Not supported"); + + return 0; +} + #if defined(CONFIG_NET_STATISTICS_WIFI) && \ defined(CONFIG_NET_STATISTICS_USER_API) static void print_wifi_stats(struct net_if *iface, struct net_stats_wifi *data, @@ -2716,43 +2775,36 @@ static int cmd_wifi_pmksa_flush(const struct shell *sh, size_t argc, char *argv[ return 0; } -SHELL_STATIC_SUBCMD_SET_CREATE(wifi_cmd_ap, - SHELL_CMD_ARG(disable, NULL, - "Disable Access Point mode.\n", - cmd_wifi_ap_disable, - 1, 0), +SHELL_STATIC_SUBCMD_SET_CREATE( + wifi_cmd_ap, + SHELL_CMD_ARG(disable, NULL, "Disable Access Point mode.\n", cmd_wifi_ap_disable, 1, 0), SHELL_CMD_ARG(enable, NULL, - "-s --ssid=\n" - "-c --channel=\n" - "-p --passphrase= (valid only for secure SSIDs)\n" - "-k --key-mgmt= (valid only for secure SSIDs)\n" - "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP-TLS, 6:WEP\n" - "7: WPA-PSK, 11: DPP\n" - "-w --ieee-80211w= (optional: needs security type to be specified)\n" - "0:Disable, 1:Optional, 2:Required\n" - "-b --band= (2 -2.6GHz, 5 - 5Ghz, 6 - 6GHz)\n" - "-m --bssid=\n" - "-h --help (prints help)", - cmd_wifi_ap_enable, - 2, 13), - SHELL_CMD_ARG(stations, NULL, - "List stations connected to the AP", - cmd_wifi_ap_stations, - 1, 0), + "-s --ssid=\n" + "-c --channel=\n" + "-p --passphrase= (valid only for secure SSIDs)\n" + "-k --key-mgmt= (valid only for secure SSIDs)\n" + "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP-TLS, 6:WEP\n" + "7: WPA-PSK, 11: DPP\n" + "-w --ieee-80211w= (optional: needs security type to be specified)\n" + "0:Disable, 1:Optional, 2:Required\n" + "-b --band= (2 -2.6GHz, 5 - 5Ghz, 6 - 6GHz)\n" + "-m --bssid=\n" + "-h --help (prints help)", + cmd_wifi_ap_enable, 2, 13), + SHELL_CMD_ARG(stations, NULL, "List stations connected to the AP", cmd_wifi_ap_stations, 1, + 0), SHELL_CMD_ARG(disconnect, NULL, - "Disconnect a station from the AP\n" - "\n", - cmd_wifi_ap_sta_disconnect, - 2, 0), + "Disconnect a station from the AP\n" + "\n", + cmd_wifi_ap_sta_disconnect, 2, 0), SHELL_CMD_ARG(config, NULL, - "Configure AP parameters.\n" - "-i --max_inactivity=
+
+ + +
+ +
+ + +
+ +
+ + +
+
@@ -52,7 +67,7 @@ id="reset-filters" class="btn btn-info btn-disabled fa fa-times" tabindex="0" - onclick="document.querySelector('.filter-form').reset(); filterBoards(); updateURL();"> + onclick="resetForm()"> Reset Filters
@@ -82,11 +82,11 @@
- {% for board_name, board in catalog.boards | items | sort(attribute='1.full_name') -%} + {% for board_name, board in boards | items | sort(attribute='1.full_name') -%} {% include "board-card.html" %} {% endfor %}
From ecb7c875dd12bdde94683a80a4153689ba55f26c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Thu, 17 Oct 2024 15:00:08 +0200 Subject: [PATCH 1247/4482] doc: boards: extensions: introduce zephyr:board role and directive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A new zephyr:board:: Sphinx directive allows to flag a documentation page as being the documentation for a specific board, allowing to auto-populate some of the contents, ex. by adding a board overview a la Wikipedia, and later things like supported HW features, etc. A corresponding :zephyr:board: role allows to link to a board doc page. Signed-off-by: Benjamin Cabé --- doc/_extensions/zephyr/domain/__init__.py | 132 +++++++++++++++++++- doc/_static/css/custom.css | 55 +++++++- doc/contribute/documentation/guidelines.rst | 17 +++ doc/templates/board.tmpl | 18 ++- 4 files changed, 208 insertions(+), 14 deletions(-) diff --git a/doc/_extensions/zephyr/domain/__init__.py b/doc/_extensions/zephyr/domain/__init__.py index 8f45b45a616e6..4814e3cc59173 100644 --- a/doc/_extensions/zephyr/domain/__init__.py +++ b/doc/_extensions/zephyr/domain/__init__.py @@ -15,12 +15,14 @@ - ``zephyr:code-sample-category::`` - Defines a category for grouping code samples. - ``zephyr:code-sample-listing::`` - Shows a listing of code samples found in a given category. - ``zephyr:board-catalog::`` - Shows a listing of boards supported by Zephyr. +- ``zephyr:board::`` - Flags a document as being the documentation page for a board. Roles ----- - ``:zephyr:code-sample:`` - References a code sample. - ``:zephyr:code-sample-category:`` - References a code sample category. +- ``:zephyr:board:`` - References a board. """ @@ -85,6 +87,10 @@ class CodeSampleListingNode(nodes.Element): pass +class BoardNode(nodes.Element): + pass + + class ConvertCodeSampleNode(SphinxTransform): default_priority = 100 @@ -213,6 +219,65 @@ def convert_node(self, node): node.replace_self(node.children[0]) +class ConvertBoardNode(SphinxTransform): + default_priority = 100 + + def apply(self): + matcher = NodeMatcher(BoardNode) + for node in self.document.traverse(matcher): + self.convert_node(node) + + def convert_node(self, node): + parent = node.parent + siblings_to_move = [] + if parent is not None: + index = parent.index(node) + siblings_to_move = parent.children[index + 1 :] + + new_section = nodes.section(ids=[node["id"]]) + new_section += nodes.title(text=node["full_name"]) + + # create a sidebar with all the board details + sidebar = nodes.sidebar(classes=["board-overview"]) + new_section += sidebar + sidebar += nodes.title(text="Board Overview") + + if node["image"] is not None: + figure = nodes.figure() + # set a scale of 100% to indicate we want a link to the full-size image + figure += nodes.image(uri=f"/{node['image']}", scale=100) + figure += nodes.caption(text=node["full_name"]) + sidebar += figure + + field_list = nodes.field_list() + sidebar += field_list + + details = [ + ("Vendor", node["vendor"]), + ("Architecture", ", ".join(node["archs"])), + ("SoC", ", ".join(node["socs"])), + ] + + for property_name, value in details: + field = nodes.field() + field_name = nodes.field_name(text=property_name) + field_body = nodes.field_body() + field_body += nodes.paragraph(text=value) + field += field_name + field += field_body + field_list += field + + # Move the sibling nodes under the new section + new_section.extend(siblings_to_move) + + # Replace the custom node with the new section + node.replace_self(new_section) + + # Remove the moved siblings from their original parent + for sibling in siblings_to_move: + parent.remove(sibling) + + class CodeSampleCategoriesTocPatching(SphinxPostTransform): default_priority = 5 # needs to run *before* ReferencesResolver @@ -569,6 +634,45 @@ def run(self): return [code_sample_listing_node] +class BoardDirective(SphinxDirective): + has_content = False + required_arguments = 1 + optional_arguments = 0 + + def run(self): + # board_name is passed as the directive argument + board_name = self.arguments[0] + + boards = self.env.domaindata["zephyr"]["boards"] + vendors = self.env.domaindata["zephyr"]["vendors"] + + if board_name not in boards: + logger.warning( + f"Board {board_name} does not seem to be a valid board name.", + location=(self.env.docname, self.lineno), + ) + return [] + elif "docname" in boards[board_name]: + logger.warning( + f"Board {board_name} is already documented in {boards[board_name]['docname']}.", + location=(self.env.docname, self.lineno), + ) + return [] + else: + board = boards[board_name] + # flag board in the domain data as now having a documentation page so that it can be + # cross-referenced etc. + board["docname"] = self.env.docname + + board_node = BoardNode(id=board_name) + board_node["full_name"] = board["full_name"] + board_node["vendor"] = vendors.get(board["vendor"], board["vendor"]) + board_node["archs"] = board["archs"] + board_node["socs"] = board["socs"] + board_node["image"] = board["image"] + return [board_node] + + class BoardCatalogDirective(SphinxDirective): has_content = False required_arguments = 0 @@ -602,6 +706,7 @@ class ZephyrDomain(Domain): roles = { "code-sample": XRefRole(innernodeclass=nodes.inline, warn_dangling=True), "code-sample-category": XRefRole(innernodeclass=nodes.inline, warn_dangling=True), + "board": XRefRole(innernodeclass=nodes.inline, warn_dangling=True), } directives = { @@ -609,11 +714,13 @@ class ZephyrDomain(Domain): "code-sample-listing": CodeSampleListingDirective, "code-sample-category": CodeSampleCategoryDirective, "board-catalog": BoardCatalogDirective, + "board": BoardDirective, } object_types: Dict[str, ObjType] = { "code-sample": ObjType("code sample", "code-sample"), "code-sample-category": ObjType("code sample category", "code-sample-category"), + "board": ObjType("board", "board"), } initial_data: Dict[str, Any] = { @@ -647,6 +754,12 @@ def merge_domaindata(self, docnames: List[str], otherdata: Dict) -> None: self.data["code-samples"].update(otherdata["code-samples"]) self.data["code-samples-categories"].update(otherdata["code-samples-categories"]) + # self.data["boards"] contains all the boards right from builder-inited time, but it still # potentially needs merging since a board's docname property is set by BoardDirective to + # indicate the board is documented in a specific document. + for board_name, board in otherdata["boards"].items(): + if "docname" in board: + self.data["boards"][board_name]["docname"] = board["docname"] + # merge category trees by adding all the categories found in the "other" tree that to # self tree other_tree = otherdata["code-samples-categories-tree"] @@ -689,6 +802,18 @@ def get_objects(self): 1, ) + for _, board in self.data["boards"].items(): + # only boards that do have a documentation page are to be considered as valid objects + if "docname" in board: + yield ( + board["name"], + board["full_name"], + "board", + board["docname"], + board["name"], + 1, + ) + # used by Sphinx Immaterial theme def get_object_synopses(self) -> Iterator[Tuple[Tuple[str, str], str]]: for _, code_sample in self.data["code-samples"].items(): @@ -702,18 +827,20 @@ def resolve_xref(self, env, fromdocname, builder, type, target, node, contnode): elem = self.data["code-samples"].get(target) elif type == "code-sample-category": elem = self.data["code-samples-categories"].get(target) + elif type == "board": + elem = self.data["boards"].get(target) else: return if elem: if not node.get("refexplicit"): - contnode = [nodes.Text(elem["name"])] + contnode = [nodes.Text(elem["name"] if type != "board" else elem["full_name"])] return make_refnode( builder, fromdocname, elem["docname"], - elem["id"], + elem["id"] if type != "board" else elem["name"], contnode, elem["description"].astext() if type == "code-sample" else None, ) @@ -821,6 +948,7 @@ def setup(app): app.add_transform(ConvertCodeSampleNode) app.add_transform(ConvertCodeSampleCategoryNode) + app.add_transform(ConvertBoardNode) app.add_post_transform(ProcessCodeSampleListingNode) app.add_post_transform(CodeSampleCategoriesTocPatching) diff --git a/doc/_static/css/custom.css b/doc/_static/css/custom.css index eccda8f7f632b..3713d09ea0870 100644 --- a/doc/_static/css/custom.css +++ b/doc/_static/css/custom.css @@ -1110,4 +1110,57 @@ li>a.code-sample-link.reference.internal { li>a.code-sample-link.reference.internal.current { text-decoration: underline; -} \ No newline at end of file +} + +/* Board overview "card" on board documentation pages */ +.sidebar.board-overview { + border-radius: 12px; + padding: 0px; + background: var(--admonition-note-background-color); + color: var(--admonition-note-title-color); + border-color: var(--admonition-note-title-background-color); +} + +@media screen and (max-width: 480px) { + .sidebar.board-overview { + float: none; + margin-left: 0; + } +} + +.sidebar.board-overview .sidebar-title { + font-family: var(--header-font-family); + background: var(--admonition-note-title-background-color); + color: var(--admonition-note-title-color); + border-radius: 12px 12px 0px 0px; + margin: 0px; + text-align: center; +} + +.sidebar.board-overview * { + color: var(--admonition-note-color); +} + +.sidebar.board-overview figure { + padding: 1rem; + margin-bottom: -1rem; +} + +.sidebar.board-overview figure img { + height: auto !important; +} + +.sidebar.board-overview figure figcaption p { + margin-bottom: 0px; +} + +.sidebar.board-overview dl.field-list { + align-items: center; + margin-top: 12px !important; + margin-bottom: 12px !important; + grid-template-columns: auto 1fr !important; +} + +.sidebar.board-overview dl.field-list > dt { + background: transparent !important; +} diff --git a/doc/contribute/documentation/guidelines.rst b/doc/contribute/documentation/guidelines.rst index 6012d3230ea8c..3c5471b2e3d06 100644 --- a/doc/contribute/documentation/guidelines.rst +++ b/doc/contribute/documentation/guidelines.rst @@ -1184,6 +1184,23 @@ Code samples Boards ====== +.. rst:directive:: .. zephyr:board:: name + + This directive is used at the beginning of a document to indicate it is the main documentation + page for a board whose name is given as the directive argument. + + For example:: + + .. zephyr:board:: wio_terminal + + The metadata for the board is read from various config files and used to automatically populate + some sections of the board documentation. A board documentation page that uses this directive + can be linked to using the :rst:role:`zephyr:board` role. + +.. rst:role:: zephyr:board + + This role is used to reference a board documented using :rst:dir:`zephyr:board`. + .. rst:directive:: .. zephyr:board-catalog:: This directive is used to generate a catalog of Zephyr-supported boards that can be used to diff --git a/doc/templates/board.tmpl b/doc/templates/board.tmpl index 3650699aac515..96201094eed29 100644 --- a/doc/templates/board.tmpl +++ b/doc/templates/board.tmpl @@ -1,20 +1,16 @@ -.. _boardname_linkname: +.. zephyr:board:: board_name -[Board Name] -############# +.. To ensure the board documentation page displays correctly, it is highly + recommended to include a picture alongside the documentation page. + + The picture should be named after the board (e.g., "board_name.webp") + and preferably be in webp format. Alternatively, png or jpg formats + are also accepted. Overview ******** [A short description about the board, its main features and availability] - -.. figure:: board_name.png - :width: 800px - :align: center - :alt: Board Name - - Board Name (Credit: ) - Hardware ******** [General Hardware information] From b58b8964d3d3a3833d04786113da38f76d53953f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Sat, 19 Oct 2024 11:04:40 +0200 Subject: [PATCH 1248/4482] boards: seeed: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Seeed Studio boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- .../seeed/lora_e5_dev_board/doc/lora_e5_dev_board.rst | 9 +-------- boards/seeed/lora_e5_mini/doc/index.rst | 9 +-------- boards/seeed/seeeduino_xiao/doc/index.rst | 9 +-------- boards/seeed/wio_terminal/doc/index.rst | 10 +--------- boards/seeed/xiao_ble/doc/index.rst | 9 +-------- boards/seeed/xiao_esp32c3/doc/index.rst | 11 +---------- boards/seeed/xiao_esp32s3/doc/index.rst | 11 +---------- boards/seeed/xiao_rp2040/doc/index.rst | 11 +---------- doc/contribute/documentation/guidelines.rst | 8 ++++++++ doc/releases/release-notes-3.7.rst | 2 +- samples/subsys/display/lvgl/README.rst | 2 +- 11 files changed, 18 insertions(+), 73 deletions(-) diff --git a/boards/seeed/lora_e5_dev_board/doc/lora_e5_dev_board.rst b/boards/seeed/lora_e5_dev_board/doc/lora_e5_dev_board.rst index ca23421073480..9c2071abd4fb9 100644 --- a/boards/seeed/lora_e5_dev_board/doc/lora_e5_dev_board.rst +++ b/boards/seeed/lora_e5_dev_board/doc/lora_e5_dev_board.rst @@ -1,7 +1,4 @@ -.. _lora_e5_dev_board: - -Seeed Studio LoRa-E5 Dev Board -############################## +.. zephyr:board:: lora_e5_dev_board Overview ******** @@ -13,10 +10,6 @@ The LoRa-E5-HF STM32WLE5JC Module supports multiple LPWAN protocols on the All GPIOs of the LoRa-E5 Module are laid out supporting various data protocols and interfaces including RS-485 and Grove. -.. image:: img/lora_e5_dev_board.jpg - :align: center - :alt: LoRa-E5 Dev board - Hardware ******** diff --git a/boards/seeed/lora_e5_mini/doc/index.rst b/boards/seeed/lora_e5_mini/doc/index.rst index 78227fcb62bfe..05e94cdaf3ae1 100644 --- a/boards/seeed/lora_e5_mini/doc/index.rst +++ b/boards/seeed/lora_e5_mini/doc/index.rst @@ -1,7 +1,4 @@ -.. _lora_e5_mini: - -Seeed Studio LoRa-E5 mini -######################### +.. zephyr:board:: lora_e5_mini Overview ******** @@ -10,10 +7,6 @@ LoRa-E5 mini is a compacted-sized development board suitable for the rapid testing and building of small-sized LoRa device, exposing all capabilities of Seeed Studio LoRa-E5 STM32WLE5JC module. -.. image:: img/lora_e5_mini.jpg - :align: center - :alt: LoRa-E5 mini - Hardware ******** diff --git a/boards/seeed/seeeduino_xiao/doc/index.rst b/boards/seeed/seeeduino_xiao/doc/index.rst index 48003fdb63c4f..7dc905e39b3b7 100644 --- a/boards/seeed/seeeduino_xiao/doc/index.rst +++ b/boards/seeed/seeeduino_xiao/doc/index.rst @@ -1,7 +1,4 @@ -.. _seeeduino_xiao: - -Seeeduino XIAO -############## +.. zephyr:board:: seeeduino_xiao Overview ******** @@ -10,10 +7,6 @@ The Seeeduino XIAO is a tiny (20 mm x 17.5 mm) ARM development board with onboard LEDs, USB port, and range of I/O broken out onto 14 pins. -.. image:: img/seeeduino_xiao.jpg - :align: center - :alt: Seeeduino XIAO - Hardware ******** diff --git a/boards/seeed/wio_terminal/doc/index.rst b/boards/seeed/wio_terminal/doc/index.rst index f640f11b44591..736d3cb6984c9 100644 --- a/boards/seeed/wio_terminal/doc/index.rst +++ b/boards/seeed/wio_terminal/doc/index.rst @@ -1,7 +1,4 @@ -.. _wio_terminal: - -Wio Terminal -############ +.. zephyr:board:: wio_terminal Overview ******** @@ -11,11 +8,6 @@ wireless connectivity (2.4G/5G dual-band Wi-Fi and BLE 5.0), LCD display, USB C port, FPC connector, microSD card slot, Raspberry Pi compatible 40-pins header and 2 Grove connectors. -.. image:: img/wio_terminal.png - :width: 500px - :align: center - :alt: Seeed Studio Wio Terminal - Hardware ******** diff --git a/boards/seeed/xiao_ble/doc/index.rst b/boards/seeed/xiao_ble/doc/index.rst index c33d786e02415..831eb872a9da0 100644 --- a/boards/seeed/xiao_ble/doc/index.rst +++ b/boards/seeed/xiao_ble/doc/index.rst @@ -1,7 +1,4 @@ -.. _xiao_ble: - -XIAO BLE (Sense) -################ +.. zephyr:board:: xiao_ble Overview ******** @@ -10,10 +7,6 @@ The Seeed XIAO BLE (Sense) is a tiny (21 mm x 17.5 mm) Nordic Semiconductor nRF52840 ARM Cortex-M4F development board with onboard LEDs, USB port, QSPI flash, battery charger, and range of I/O broken out into 14 pins. -.. figure:: img/xiao_ble.jpg - :align: center - :alt: XIAO BLE - Hardware ******** diff --git a/boards/seeed/xiao_esp32c3/doc/index.rst b/boards/seeed/xiao_esp32c3/doc/index.rst index 48ce9ddae0d63..fa9811661a4bd 100644 --- a/boards/seeed/xiao_esp32c3/doc/index.rst +++ b/boards/seeed/xiao_esp32c3/doc/index.rst @@ -1,7 +1,4 @@ -.. _xiao_esp32c3: - -XIAO ESP32C3 -############ +.. zephyr:board:: xiao_esp32c3 Overview ******** @@ -11,12 +8,6 @@ Espressif ESP32-C3 WiFi/Bluetooth dual-mode chip. For more details see the `Seeed Studio XIAO ESP32C3`_ wiki page. -.. figure:: img/xiao_esp32c.jpg - :align: center - :alt: XIAO ESP32C3 - - XIAO ESP32C3 - Hardware ******** diff --git a/boards/seeed/xiao_esp32s3/doc/index.rst b/boards/seeed/xiao_esp32s3/doc/index.rst index 4c029bd5d645e..60aef4a2e7d0e 100644 --- a/boards/seeed/xiao_esp32s3/doc/index.rst +++ b/boards/seeed/xiao_esp32s3/doc/index.rst @@ -1,7 +1,4 @@ -.. _xiao_esp32s3: - -XIAO ESP32S3 -############ +.. zephyr:board:: xiao_esp32s3 Overview ******** @@ -11,12 +8,6 @@ Espressif ESP32-S3 WiFi/Bluetooth dual-mode chip. For more details see the `Seeed Studio XIAO ESP32S3`_ wiki page. -.. figure:: img/xiao_esp32s3.jpg - :align: center - :alt: XIAO ESP32S3 - - XIAO ESP32S3 - Hardware ******** diff --git a/boards/seeed/xiao_rp2040/doc/index.rst b/boards/seeed/xiao_rp2040/doc/index.rst index 7206e9be07f58..0cf39c014c7fe 100644 --- a/boards/seeed/xiao_rp2040/doc/index.rst +++ b/boards/seeed/xiao_rp2040/doc/index.rst @@ -1,7 +1,4 @@ -.. _xiao_rp2040: - -XIAO RP2040 -########### +.. zephyr:board:: xiao_rp2040 Overview ******** @@ -13,12 +10,6 @@ to be flashed without any adapter, in a drag-and-drop manner. For more details see the `Seeed Studio XIAO RP2040`_ wiki page. -.. figure:: img/xiao_rp2040.webp - :align: center - :alt: XIAO RP2040 - - XIAO RP2040 - Hardware ******** diff --git a/doc/contribute/documentation/guidelines.rst b/doc/contribute/documentation/guidelines.rst index 3c5471b2e3d06..96dda3660e2e1 100644 --- a/doc/contribute/documentation/guidelines.rst +++ b/doc/contribute/documentation/guidelines.rst @@ -1201,6 +1201,14 @@ Boards This role is used to reference a board documented using :rst:dir:`zephyr:board`. + For example:: + + Check out :zephyr:board:`wio_terminal` for more information. + + Will render as: + + Check out :zephyr:board:`wio_terminal` for more information. + .. rst:directive:: .. zephyr:board-catalog:: This directive is used to generate a catalog of Zephyr-supported boards that can be used to diff --git a/doc/releases/release-notes-3.7.rst b/doc/releases/release-notes-3.7.rst index 00dd3af9682d2..8519e0a250acf 100644 --- a/doc/releases/release-notes-3.7.rst +++ b/doc/releases/release-notes-3.7.rst @@ -410,7 +410,7 @@ Boards & SoC Support * Added support for :ref:`Ambiq Apollo3 Blue board `: ``apollo3_evb``. * Added support for :ref:`Ambiq Apollo3 Blue Plus board `: ``apollo3p_evb``. * Added support for :ref:`Raspberry Pi 5 board `: ``rpi_5``. - * Added support for :ref:`Seeed Studio XIAO RP2040 board `: ``xiao_rp2040``. + * Added support for :zephyr:board:`Seeed Studio XIAO RP2040 board `: ``xiao_rp2040``. * Added support for :ref:`Mikroe RA4M1 Clicker board `: ``mikroe_clicker_ra4m1``. * Added support for :ref:`Arduino UNO R4 WiFi board `: ``arduino_uno_r4_wifi``. * Added support for :ref:`Renesas EK-RA8M1 board `: ``ek_ra8m1``. diff --git a/samples/subsys/display/lvgl/README.rst b/samples/subsys/display/lvgl/README.rst index 259413c4ac30b..7858e09409cc8 100644 --- a/samples/subsys/display/lvgl/README.rst +++ b/samples/subsys/display/lvgl/README.rst @@ -41,7 +41,7 @@ for corresponding connectors, for example: - :ref:`adafruit_2_8_tft_touch_v2` and :ref:`nrf52840dk_nrf52840` - :ref:`buydisplay_2_8_tft_touch_arduino` and :ref:`nrf52840dk_nrf52840` - :ref:`ssd1306_128_shield` and :ref:`frdm_k64f` -- :ref:`seeed_xiao_round_display` and :ref:`xiao_ble` +- :ref:`seeed_xiao_round_display` and :zephyr:board:`xiao_ble` or a board with an integrated display: From bb24c83d706bce0274c2d6cdc3bd472ca2906c9d Mon Sep 17 00:00:00 2001 From: Brandon Allen Date: Thu, 17 Oct 2024 12:35:09 -0400 Subject: [PATCH 1249/4482] net: lib: lwm2m: lwm2m_rw_senml_cbor: only assign time on get_s64() success Currently GCC complains that temp64 may be used uninitialized in this function. Adds a check to ensure time is valid before assignining and fixes GCC warning. Signed-off-by: Brandon Allen --- subsys/net/lib/lwm2m/lwm2m_rw_senml_cbor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/subsys/net/lib/lwm2m/lwm2m_rw_senml_cbor.c b/subsys/net/lib/lwm2m/lwm2m_rw_senml_cbor.c index c371840b1130c..2429c60864f10 100644 --- a/subsys/net/lib/lwm2m/lwm2m_rw_senml_cbor.c +++ b/subsys/net/lib/lwm2m/lwm2m_rw_senml_cbor.c @@ -601,7 +601,9 @@ static int get_time(struct lwm2m_input_context *in, time_t *value) int ret; ret = get_s64(in, &temp64); - *value = (time_t)temp64; + if (ret == 0) { + *value = (time_t)temp64; + } return ret; } From 41580bdc07513a2597ba1c6ca084f2c30cc3e2a0 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Thu, 17 Oct 2024 11:43:43 -0500 Subject: [PATCH 1250/4482] drivers: i2s_mcux_sai: Clang format Clang format to fix strange formatting, shortens the line count by 100 Signed-off-by: Declan Snyder --- drivers/i2s/i2s_mcux_sai.c | 507 +++++++++++++++---------------------- 1 file changed, 201 insertions(+), 306 deletions(-) diff --git a/drivers/i2s/i2s_mcux_sai.c b/drivers/i2s/i2s_mcux_sai.c index bb1354b9b3755..5ec1ff739c16f 100644 --- a/drivers/i2s/i2s_mcux_sai.c +++ b/drivers/i2s/i2s_mcux_sai.c @@ -26,20 +26,20 @@ #include "i2s_mcux_sai.h" #define LOG_DOMAIN dev_i2s_mcux -#define LOG_LEVEL CONFIG_I2S_LOG_LEVEL +#define LOG_LEVEL CONFIG_I2S_LOG_LEVEL #include #include LOG_MODULE_REGISTER(LOG_DOMAIN); -#define DT_DRV_COMPAT nxp_mcux_i2s -#define NUM_DMA_BLOCKS_RX_PREP 3 -#define MAX_TX_DMA_BLOCKS CONFIG_DMA_TCD_QUEUE_SIZE +#define DT_DRV_COMPAT nxp_mcux_i2s +#define NUM_DMA_BLOCKS_RX_PREP 3 +#define MAX_TX_DMA_BLOCKS CONFIG_DMA_TCD_QUEUE_SIZE #if (NUM_DMA_BLOCKS_RX_PREP >= CONFIG_DMA_TCD_QUEUE_SIZE) - #error NUM_DMA_BLOCKS_RX_PREP must be < CONFIG_DMA_TCD_QUEUE_SIZE +#error NUM_DMA_BLOCKS_RX_PREP must be < CONFIG_DMA_TCD_QUEUE_SIZE #endif #if defined(CONFIG_DMA_MCUX_EDMA) && (NUM_DMA_BLOCKS_RX_PREP < 3) - #error eDMA avoids TCD coherency issue if NUM_DMA_BLOCKS_RX_PREP >= 3 +#error eDMA avoids TCD coherency issue if NUM_DMA_BLOCKS_RX_PREP >= 3 #endif /* @@ -110,14 +110,11 @@ struct i2s_dev_data { void *rx_out_msgs[CONFIG_I2S_RX_BLOCK_COUNT]; }; -static void i2s_dma_tx_callback(const struct device *, void *, - uint32_t, int); +static void i2s_dma_tx_callback(const struct device *, void *, uint32_t, int); static void i2s_tx_stream_disable(const struct device *, bool drop); -static void i2s_rx_stream_disable(const struct device *, - bool in_drop, bool out_drop); +static void i2s_rx_stream_disable(const struct device *, bool in_drop, bool out_drop); -static inline void i2s_purge_stream_buffers(struct stream *strm, - struct k_mem_slab *mem_slab, +static inline void i2s_purge_stream_buffers(struct stream *strm, struct k_mem_slab *mem_slab, bool in_drop, bool out_drop) { void *buffer; @@ -145,8 +142,7 @@ static void i2s_tx_stream_disable(const struct device *dev, bool drop) LOG_DBG("Stopping DMA channel %u for TX stream", strm->dma_channel); /* Disable FIFO DMA request */ - SAI_TxEnableDMA(dev_cfg->base, kSAI_FIFORequestDMAEnable, - false); + SAI_TxEnableDMA(dev_cfg->base, kSAI_FIFORequestDMAEnable, false); dma_stop(dev_dma, strm->dma_channel); @@ -163,20 +159,17 @@ static void i2s_tx_stream_disable(const struct device *dev, bool drop) /* If Tx is disabled, reset the FIFO pointer, clear error flags */ if ((dev_cfg->base->TCSR & I2S_TCSR_TE_MASK) == 0UL) { - dev_cfg->base->TCSR |= - (I2S_TCSR_FR_MASK | I2S_TCSR_SR_MASK); + dev_cfg->base->TCSR |= (I2S_TCSR_FR_MASK | I2S_TCSR_SR_MASK); dev_cfg->base->TCSR &= ~I2S_TCSR_SR_MASK; } /* purge buffers queued in the stream */ if (drop) { - i2s_purge_stream_buffers(strm, dev_data->tx.cfg.mem_slab, - true, true); + i2s_purge_stream_buffers(strm, dev_data->tx.cfg.mem_slab, true, true); } } -static void i2s_rx_stream_disable(const struct device *dev, - bool in_drop, bool out_drop) +static void i2s_rx_stream_disable(const struct device *dev, bool in_drop, bool out_drop) { struct i2s_dev_data *dev_data = dev->data; struct stream *strm = &dev_data->rx; @@ -190,8 +183,7 @@ static void i2s_rx_stream_disable(const struct device *dev, dev_cfg->base->RCR3 &= ~I2S_RCR3_RCE_MASK; /* Disable DMA enable bit */ - SAI_RxEnableDMA(dev_cfg->base, kSAI_FIFORequestDMAEnable, - false); + SAI_RxEnableDMA(dev_cfg->base, kSAI_FIFORequestDMAEnable, false); /* Disable Rx */ SAI_RxEnable(dev_cfg->base, false); @@ -206,13 +198,11 @@ static void i2s_rx_stream_disable(const struct device *dev, /* purge buffers queued in the stream */ if (in_drop || out_drop) { - i2s_purge_stream_buffers(strm, dev_data->rx.cfg.mem_slab, - in_drop, out_drop); + i2s_purge_stream_buffers(strm, dev_data->rx.cfg.mem_slab, in_drop, out_drop); } } -static int i2s_tx_reload_multiple_dma_blocks(const struct device *dev, - uint8_t *blocks_queued) +static int i2s_tx_reload_multiple_dma_blocks(const struct device *dev, uint8_t *blocks_queued) { struct i2s_dev_data *dev_data = dev->data; const struct i2s_mcux_config *dev_cfg = dev->config; @@ -237,10 +227,8 @@ static int i2s_tx_reload_multiple_dma_blocks(const struct device *dev, } /* reload the DMA */ - ret = dma_reload(dev_data->dev_dma, strm->dma_channel, - (uint32_t)buffer, - (uint32_t)&base->TDR[strm->start_channel], - strm->cfg.block_size); + ret = dma_reload(dev_data->dev_dma, strm->dma_channel, (uint32_t)buffer, + (uint32_t)&base->TDR[strm->start_channel], strm->cfg.block_size); if (ret != 0) { LOG_ERR("dma_reload() failed with error 0x%x", ret); break; @@ -248,11 +236,9 @@ static int i2s_tx_reload_multiple_dma_blocks(const struct device *dev, (strm->free_tx_dma_blocks)--; - ret = k_msgq_put(&strm->out_queue, - &buffer, K_NO_WAIT); + ret = k_msgq_put(&strm->out_queue, &buffer, K_NO_WAIT); if (ret != 0) { - LOG_ERR("buffer %p -> out %p err %d", - buffer, &strm->out_queue, ret); + LOG_ERR("buffer %p -> out %p err %d", buffer, &strm->out_queue, ret); break; } @@ -264,8 +250,8 @@ static int i2s_tx_reload_multiple_dma_blocks(const struct device *dev, } /* This function is executed in the interrupt context */ -static void i2s_dma_tx_callback(const struct device *dma_dev, - void *arg, uint32_t channel, int status) +static void i2s_dma_tx_callback(const struct device *dma_dev, void *arg, uint32_t channel, + int status) { const struct device *dev = (struct device *)arg; struct i2s_dev_data *dev_data = dev->data; @@ -287,8 +273,7 @@ static void i2s_dma_tx_callback(const struct device *dma_dev, if (strm->free_tx_dma_blocks > MAX_TX_DMA_BLOCKS) { strm->state = I2S_STATE_ERROR; - LOG_ERR("free_tx_dma_blocks exceeded maximum, now %d", - strm->free_tx_dma_blocks); + LOG_ERR("free_tx_dma_blocks exceeded maximum, now %d", strm->free_tx_dma_blocks); goto disabled_exit_no_drop; } @@ -316,8 +301,7 @@ static void i2s_dma_tx_callback(const struct device *dma_dev, } dma_start(dev_data->dev_dma, strm->dma_channel); - if (blocks_queued || - (strm->free_tx_dma_blocks < MAX_TX_DMA_BLOCKS)) { + if (blocks_queued || (strm->free_tx_dma_blocks < MAX_TX_DMA_BLOCKS)) { goto enabled_exit; } else { /* all DMA blocks are free but no blocks were queued */ @@ -349,8 +333,8 @@ static void i2s_dma_tx_callback(const struct device *dma_dev, return; } -static void i2s_dma_rx_callback(const struct device *dma_dev, - void *arg, uint32_t channel, int status) +static void i2s_dma_rx_callback(const struct device *dma_dev, void *arg, uint32_t channel, + int status) { struct device *dev = (struct device *)arg; const struct i2s_mcux_config *dev_cfg = dev->config; @@ -372,50 +356,40 @@ static void i2s_dma_rx_callback(const struct device *dma_dev, /* put buffer to output queue */ ret = k_msgq_put(&strm->out_queue, &buffer, K_NO_WAIT); if (ret != 0) { - LOG_ERR("buffer %p -> out_queue %p err %d", - buffer, - &strm->out_queue, ret); + LOG_ERR("buffer %p -> out_queue %p err %d", buffer, &strm->out_queue, ret); i2s_rx_stream_disable(dev, false, false); strm->state = I2S_STATE_ERROR; return; } if (strm->state == I2S_STATE_RUNNING) { /* allocate new buffer for next audio frame */ - ret = k_mem_slab_alloc(strm->cfg.mem_slab, - &buffer, K_NO_WAIT); + ret = k_mem_slab_alloc(strm->cfg.mem_slab, &buffer, K_NO_WAIT); if (ret != 0) { - LOG_ERR("buffer alloc from slab %p err %d", - strm->cfg.mem_slab, ret); + LOG_ERR("buffer alloc from slab %p err %d", strm->cfg.mem_slab, + ret); i2s_rx_stream_disable(dev, false, false); strm->state = I2S_STATE_ERROR; } else { uint32_t data_path = strm->start_channel; - ret = dma_reload(dev_data->dev_dma, - strm->dma_channel, - (uint32_t)&base->RDR[data_path], - (uint32_t)buffer, + ret = dma_reload(dev_data->dev_dma, strm->dma_channel, + (uint32_t)&base->RDR[data_path], (uint32_t)buffer, strm->cfg.block_size); if (ret != 0) { - LOG_ERR("dma_reload() failed with error 0x%x", - ret); - i2s_rx_stream_disable(dev, - false, false); + LOG_ERR("dma_reload() failed with error 0x%x", ret); + i2s_rx_stream_disable(dev, false, false); strm->state = I2S_STATE_ERROR; return; } /* put buffer in input queue */ - ret = k_msgq_put(&strm->in_queue, - &buffer, K_NO_WAIT); + ret = k_msgq_put(&strm->in_queue, &buffer, K_NO_WAIT); if (ret != 0) { - LOG_ERR("%p -> in_queue %p err %d", - buffer, &strm->in_queue, + LOG_ERR("%p -> in_queue %p err %d", buffer, &strm->in_queue, ret); } - dma_start(dev_data->dev_dma, - strm->dma_channel); + dma_start(dev_data->dev_dma, strm->dma_channel); } } else { i2s_rx_stream_disable(dev, true, false); @@ -434,15 +408,13 @@ static void enable_mclk_direction(const struct device *dev, bool dir) const struct i2s_mcux_config *dev_cfg = dev->config; uint32_t offset = dev_cfg->mclk_pin_offset; uint32_t mask = dev_cfg->mclk_pin_mask; - uint32_t *gpr = (uint32_t *) - (DT_REG_ADDR(DT_NODELABEL(iomuxcgpr)) + offset); + uint32_t *gpr = (uint32_t *)(DT_REG_ADDR(DT_NODELABEL(iomuxcgpr)) + offset); if (dir) { *gpr |= mask; } else { *gpr &= ~mask; } - } static void get_mclk_rate(const struct device *dev, uint32_t *mclk) @@ -478,9 +450,7 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir, (dev_data->tx.state != I2S_STATE_READY) && (dev_data->rx.state != I2S_STATE_NOT_READY) && (dev_data->rx.state != I2S_STATE_READY)) { - LOG_ERR("invalid state tx(%u) rx(%u)", - dev_data->tx.state, - dev_data->rx.state); + LOG_ERR("invalid state tx(%u) rx(%u)", dev_data->tx.state, dev_data->rx.state); if (dir == I2S_DIR_TX) { dev_data->tx.state = I2S_STATE_NOT_READY; } else { @@ -490,8 +460,7 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir, } if (i2s_cfg->frame_clk_freq == 0U) { - LOG_ERR("Invalid frame_clk_freq %u", - i2s_cfg->frame_clk_freq); + LOG_ERR("Invalid frame_clk_freq %u", i2s_cfg->frame_clk_freq); if (dir == I2S_DIR_TX) { dev_data->tx.state = I2S_STATE_NOT_READY; } else { @@ -500,8 +469,7 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir, return 0; } - if (word_size_bits < SAI_WORD_SIZE_BITS_MIN || - word_size_bits > SAI_WORD_SIZE_BITS_MAX) { + if (word_size_bits < SAI_WORD_SIZE_BITS_MIN || word_size_bits > SAI_WORD_SIZE_BITS_MAX) { LOG_ERR("Unsupported I2S word size %u", word_size_bits); if (dir == I2S_DIR_TX) { dev_data->tx.state = I2S_STATE_NOT_READY; @@ -511,8 +479,7 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir, return -EINVAL; } - if (num_words < SAI_WORD_PER_FRAME_MIN || - num_words > SAI_WORD_PER_FRAME_MAX) { + if (num_words < SAI_WORD_PER_FRAME_MIN || num_words > SAI_WORD_PER_FRAME_MAX) { LOG_ERR("Unsupported words length %u", num_words); if (dir == I2S_DIR_TX) { dev_data->tx.state = I2S_STATE_NOT_READY; @@ -550,14 +517,12 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir, config.bitClock.bclkInputDelay = false; /* frame sync default configurations */ -#if defined(FSL_FEATURE_SAI_HAS_ON_DEMAND_MODE) && \ - FSL_FEATURE_SAI_HAS_ON_DEMAND_MODE +#if defined(FSL_FEATURE_SAI_HAS_ON_DEMAND_MODE) && FSL_FEATURE_SAI_HAS_ON_DEMAND_MODE config.frameSync.frameSyncGenerateOnDemand = false; #endif /* serial data default configurations */ -#if defined(FSL_FEATURE_SAI_HAS_CHANNEL_MODE) && \ - FSL_FEATURE_SAI_HAS_CHANNEL_MODE +#if defined(FSL_FEATURE_SAI_HAS_CHANNEL_MODE) && FSL_FEATURE_SAI_HAS_CHANNEL_MODE config.serialData.dataMode = kSAI_DataPinStateOutputZero; #endif @@ -566,18 +531,14 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir, /* format */ switch (i2s_cfg->format & I2S_FMT_DATA_FORMAT_MASK) { case I2S_FMT_DATA_FORMAT_I2S: - SAI_GetClassicI2SConfig(&config, word_size_bits, - kSAI_Stereo, - dev_cfg->tx_channel); + SAI_GetClassicI2SConfig(&config, word_size_bits, kSAI_Stereo, dev_cfg->tx_channel); break; case I2S_FMT_DATA_FORMAT_LEFT_JUSTIFIED: - SAI_GetLeftJustifiedConfig(&config, word_size_bits, - kSAI_Stereo, + SAI_GetLeftJustifiedConfig(&config, word_size_bits, kSAI_Stereo, dev_cfg->tx_channel); break; case I2S_FMT_DATA_FORMAT_PCM_SHORT: - SAI_GetDSPConfig(&config, kSAI_FrameSyncLenOneBitClk, - word_size_bits, kSAI_Stereo, + SAI_GetDSPConfig(&config, kSAI_FrameSyncLenOneBitClk, word_size_bits, kSAI_Stereo, dev_cfg->tx_channel); /* We need to set the data word count manually, since the HAL * function does not @@ -587,8 +548,7 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir, config.bitClock.bclkPolarity = kSAI_SampleOnFallingEdge; break; case I2S_FMT_DATA_FORMAT_PCM_LONG: - SAI_GetTDMConfig(&config, kSAI_FrameSyncLenPerWordWidth, - word_size_bits, num_words, + SAI_GetTDMConfig(&config, kSAI_FrameSyncLenPerWordWidth, word_size_bits, num_words, dev_cfg->tx_channel); config.bitClock.bclkPolarity = kSAI_SampleOnFallingEdge; break; @@ -623,13 +583,11 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir, if (i2s_cfg->options & I2S_OPT_BIT_CLK_SLAVE) { config.masterSlave = kSAI_Slave; } else { - config.masterSlave = - kSAI_Bclk_Master_FrameSync_Slave; + config.masterSlave = kSAI_Bclk_Master_FrameSync_Slave; } } else { if (i2s_cfg->options & I2S_OPT_BIT_CLK_SLAVE) { - config.masterSlave = - kSAI_Bclk_Slave_FrameSync_Master; + config.masterSlave = kSAI_Bclk_Slave_FrameSync_Master; } else { config.masterSlave = kSAI_Master; } @@ -644,66 +602,57 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir, case I2S_FMT_CLK_NF_IB: /* Swap bclk polarity */ config.bitClock.bclkPolarity = - (config.bitClock.bclkPolarity == kSAI_SampleOnFallingEdge) ? - kSAI_SampleOnRisingEdge : - kSAI_SampleOnFallingEdge; + (config.bitClock.bclkPolarity == kSAI_SampleOnFallingEdge) + ? kSAI_SampleOnRisingEdge + : kSAI_SampleOnFallingEdge; break; case I2S_FMT_CLK_IF_NB: /* Swap frame sync polarity */ config.frameSync.frameSyncPolarity = - (config.frameSync.frameSyncPolarity == kSAI_PolarityActiveHigh) ? - kSAI_PolarityActiveLow : - kSAI_PolarityActiveHigh; + (config.frameSync.frameSyncPolarity == kSAI_PolarityActiveHigh) + ? kSAI_PolarityActiveLow + : kSAI_PolarityActiveHigh; break; case I2S_FMT_CLK_IF_IB: /* Swap frame sync and bclk polarity */ config.frameSync.frameSyncPolarity = - (config.frameSync.frameSyncPolarity == kSAI_PolarityActiveHigh) ? - kSAI_PolarityActiveLow : - kSAI_PolarityActiveHigh; + (config.frameSync.frameSyncPolarity == kSAI_PolarityActiveHigh) + ? kSAI_PolarityActiveLow + : kSAI_PolarityActiveHigh; config.bitClock.bclkPolarity = - (config.bitClock.bclkPolarity == kSAI_SampleOnFallingEdge) ? - kSAI_SampleOnRisingEdge : - kSAI_SampleOnFallingEdge; + (config.bitClock.bclkPolarity == kSAI_SampleOnFallingEdge) + ? kSAI_SampleOnRisingEdge + : kSAI_SampleOnFallingEdge; break; } /* PCM short format always requires that WS be one BCLK cycle */ - if ((i2s_cfg->format & I2S_FMT_DATA_FORMAT_MASK) != - I2S_FMT_DATA_FORMAT_PCM_SHORT) { + if ((i2s_cfg->format & I2S_FMT_DATA_FORMAT_MASK) != I2S_FMT_DATA_FORMAT_PCM_SHORT) { config.frameSync.frameSyncWidth = (uint8_t)word_size_bits; } if (dir == I2S_DIR_TX) { memcpy(&dev_data->tx.cfg, i2s_cfg, sizeof(struct i2s_config)); - LOG_DBG("tx slab free_list = 0x%x", - (uint32_t)i2s_cfg->mem_slab->free_list); - LOG_DBG("tx slab num_blocks = %d", - (uint32_t)i2s_cfg->mem_slab->info.num_blocks); - LOG_DBG("tx slab block_size = %d", - (uint32_t)i2s_cfg->mem_slab->info.block_size); - LOG_DBG("tx slab buffer = 0x%x", - (uint32_t)i2s_cfg->mem_slab->buffer); + LOG_DBG("tx slab free_list = 0x%x", (uint32_t)i2s_cfg->mem_slab->free_list); + LOG_DBG("tx slab num_blocks = %d", (uint32_t)i2s_cfg->mem_slab->info.num_blocks); + LOG_DBG("tx slab block_size = %d", (uint32_t)i2s_cfg->mem_slab->info.block_size); + LOG_DBG("tx slab buffer = 0x%x", (uint32_t)i2s_cfg->mem_slab->buffer); /* set bit clock divider */ SAI_TxSetConfig(base, &config); dev_data->tx.start_channel = config.startChannel; /* Disable the channel FIFO */ base->TCR3 &= ~I2S_TCR3_TCE_MASK; - SAI_TxSetBitClockRate(base, mclk, - i2s_cfg->frame_clk_freq, - word_size_bits, + SAI_TxSetBitClockRate(base, mclk, i2s_cfg->frame_clk_freq, word_size_bits, i2s_cfg->channels); LOG_DBG("tx start_channel = %d", dev_data->tx.start_channel); /*set up dma settings*/ dev_data->tx.dma_cfg.source_data_size = word_size_bits / 8; dev_data->tx.dma_cfg.dest_data_size = word_size_bits / 8; - dev_data->tx.dma_cfg.source_burst_length = - i2s_cfg->word_size / 8; - dev_data->tx.dma_cfg.dest_burst_length = - i2s_cfg->word_size / 8; + dev_data->tx.dma_cfg.source_burst_length = i2s_cfg->word_size / 8; + dev_data->tx.dma_cfg.dest_burst_length = i2s_cfg->word_size / 8; dev_data->tx.dma_cfg.user_data = (void *)dev; dev_data->tx.state = I2S_STATE_READY; } else { @@ -711,30 +660,22 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir, config.fifo.fifoWatermark = 0; memcpy(&dev_data->rx.cfg, i2s_cfg, sizeof(struct i2s_config)); - LOG_DBG("rx slab free_list = 0x%x", - (uint32_t)i2s_cfg->mem_slab->free_list); - LOG_DBG("rx slab num_blocks = %d", - (uint32_t)i2s_cfg->mem_slab->info.num_blocks); - LOG_DBG("rx slab block_size = %d", - (uint32_t)i2s_cfg->mem_slab->info.block_size); - LOG_DBG("rx slab buffer = 0x%x", - (uint32_t)i2s_cfg->mem_slab->buffer); + LOG_DBG("rx slab free_list = 0x%x", (uint32_t)i2s_cfg->mem_slab->free_list); + LOG_DBG("rx slab num_blocks = %d", (uint32_t)i2s_cfg->mem_slab->info.num_blocks); + LOG_DBG("rx slab block_size = %d", (uint32_t)i2s_cfg->mem_slab->info.block_size); + LOG_DBG("rx slab buffer = 0x%x", (uint32_t)i2s_cfg->mem_slab->buffer); /* set bit clock divider */ SAI_RxSetConfig(base, &config); dev_data->rx.start_channel = config.startChannel; - SAI_RxSetBitClockRate(base, mclk, - i2s_cfg->frame_clk_freq, - word_size_bits, + SAI_RxSetBitClockRate(base, mclk, i2s_cfg->frame_clk_freq, word_size_bits, i2s_cfg->channels); LOG_DBG("rx start_channel = %d", dev_data->rx.start_channel); /*set up dma settings*/ dev_data->rx.dma_cfg.source_data_size = word_size_bits / 8; dev_data->rx.dma_cfg.dest_data_size = word_size_bits / 8; - dev_data->rx.dma_cfg.source_burst_length = - i2s_cfg->word_size / 8; - dev_data->rx.dma_cfg.dest_burst_length = - i2s_cfg->word_size / 8; + dev_data->rx.dma_cfg.source_burst_length = i2s_cfg->word_size / 8; + dev_data->rx.dma_cfg.dest_burst_length = i2s_cfg->word_size / 8; dev_data->rx.dma_cfg.user_data = (void *)dev; dev_data->rx.state = I2S_STATE_READY; } @@ -742,8 +683,7 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir, return 0; } -const struct i2s_config *i2s_mcux_config_get(const struct device *dev, - enum i2s_dir dir) +const struct i2s_config *i2s_mcux_config_get(const struct device *dev, enum i2s_dir dir) { struct i2s_dev_data *dev_data = dev->data; @@ -793,7 +733,6 @@ static int i2s_tx_stream_start(const struct device *dev) strm->dma_cfg.head_block = &strm->dma_block; strm->dma_cfg.user_data = (void *)dev; - (strm->free_tx_dma_blocks)--; dma_config(dev_dma, strm->dma_channel, &strm->dma_cfg); @@ -852,8 +791,7 @@ static int i2s_rx_stream_start(const struct device *dev) } /* allocate 1st receive buffer from SLAB */ - ret = k_mem_slab_alloc(strm->cfg.mem_slab, &buffer, - K_NO_WAIT); + ret = k_mem_slab_alloc(strm->cfg.mem_slab, &buffer, K_NO_WAIT); if (ret != 0) { LOG_DBG("buffer alloc from mem_slab failed (%d)", ret); return ret; @@ -889,15 +827,13 @@ static int i2s_rx_stream_start(const struct device *dev) for (int i = 0; i < NUM_DMA_BLOCKS_RX_PREP - 1; i++) { /* allocate receive buffer from SLAB */ - ret = k_mem_slab_alloc(strm->cfg.mem_slab, &buffer, - K_NO_WAIT); + ret = k_mem_slab_alloc(strm->cfg.mem_slab, &buffer, K_NO_WAIT); if (ret != 0) { LOG_ERR("buffer alloc from mem_slab failed (%d)", ret); return ret; } - ret = dma_reload(dev_dma, strm->dma_channel, - (uint32_t)&base->RDR[data_path], + ret = dma_reload(dev_dma, strm->dma_channel, (uint32_t)&base->RDR[data_path], (uint32_t)buffer, blk_cfg->block_size); if (ret != 0) { LOG_ERR("dma_reload() failed with error 0x%x", ret); @@ -907,8 +843,7 @@ static int i2s_rx_stream_start(const struct device *dev) /* put buffer in input queue */ ret = k_msgq_put(&strm->in_queue, &buffer, K_NO_WAIT); if (ret != 0) { - LOG_ERR("failed to put buffer in input queue, ret2 %d", - ret); + LOG_ERR("failed to put buffer in input queue, ret2 %d", ret); return ret; } } @@ -916,8 +851,7 @@ static int i2s_rx_stream_start(const struct device *dev) LOG_DBG("Starting DMA Ch%u", strm->dma_channel); ret = dma_start(dev_dma, strm->dma_channel); if (ret < 0) { - LOG_ERR("Failed to start DMA Ch%d (%d)", strm->dma_channel, - ret); + LOG_ERR("Failed to start DMA Ch%d (%d)", strm->dma_channel, ret); return ret; } @@ -933,8 +867,7 @@ static int i2s_rx_stream_start(const struct device *dev) return 0; } -static int i2s_mcux_trigger(const struct device *dev, enum i2s_dir dir, - enum i2s_trigger_cmd cmd) +static int i2s_mcux_trigger(const struct device *dev, enum i2s_dir dir, enum i2s_trigger_cmd cmd) { struct i2s_dev_data *dev_data = dev->data; struct stream *strm; @@ -951,8 +884,7 @@ static int i2s_mcux_trigger(const struct device *dev, enum i2s_dir dir, switch (cmd) { case I2S_TRIGGER_START: if (strm->state != I2S_STATE_READY) { - LOG_ERR("START trigger: invalid state %u", - strm->state); + LOG_ERR("START trigger: invalid state %u", strm->state); ret = -EIO; break; } @@ -975,8 +907,7 @@ static int i2s_mcux_trigger(const struct device *dev, enum i2s_dir dir, case I2S_TRIGGER_DROP: if (strm->state == I2S_STATE_NOT_READY) { - LOG_ERR("DROP trigger: invalid state %d", - strm->state); + LOG_ERR("DROP trigger: invalid state %d", strm->state); ret = -EIO; break; } @@ -1002,8 +933,7 @@ static int i2s_mcux_trigger(const struct device *dev, enum i2s_dir dir, case I2S_TRIGGER_DRAIN: if (strm->state != I2S_STATE_RUNNING) { - LOG_ERR("DRAIN/STOP trigger: invalid state %d", - strm->state); + LOG_ERR("DRAIN/STOP trigger: invalid state %d", strm->state); ret = -EIO; break; } @@ -1013,8 +943,7 @@ static int i2s_mcux_trigger(const struct device *dev, enum i2s_dir dir, case I2S_TRIGGER_PREPARE: if (strm->state != I2S_STATE_ERROR) { - LOG_ERR("PREPARE trigger: invalid state %d", - strm->state); + LOG_ERR("PREPARE trigger: invalid state %d", strm->state); ret = -EIO; break; } @@ -1035,8 +964,7 @@ static int i2s_mcux_trigger(const struct device *dev, enum i2s_dir dir, return ret; } -static int i2s_mcux_read(const struct device *dev, void **mem_block, - size_t *size) +static int i2s_mcux_read(const struct device *dev, void **mem_block, size_t *size) { struct i2s_dev_data *dev_data = dev->data; struct stream *strm = &dev_data->rx; @@ -1049,8 +977,7 @@ static int i2s_mcux_read(const struct device *dev, void **mem_block, return -EIO; } - status = k_msgq_get(&strm->out_queue, &buffer, - SYS_TIMEOUT_MS(strm->cfg.timeout)); + status = k_msgq_get(&strm->out_queue, &buffer, SYS_TIMEOUT_MS(strm->cfg.timeout)); if (status != 0) { if (strm->state == I2S_STATE_ERROR) { ret = -EIO; @@ -1066,22 +993,19 @@ static int i2s_mcux_read(const struct device *dev, void **mem_block, return 0; } -static int i2s_mcux_write(const struct device *dev, void *mem_block, - size_t size) +static int i2s_mcux_write(const struct device *dev, void *mem_block, size_t size) { struct i2s_dev_data *dev_data = dev->data; struct stream *strm = &dev_data->tx; int ret; LOG_DBG("i2s_mcux_write"); - if (strm->state != I2S_STATE_RUNNING && - strm->state != I2S_STATE_READY) { + if (strm->state != I2S_STATE_RUNNING && strm->state != I2S_STATE_READY) { LOG_ERR("invalid state (%d)", strm->state); return -EIO; } - ret = k_msgq_put(&strm->in_queue, &mem_block, - SYS_TIMEOUT_MS(strm->cfg.timeout)); + ret = k_msgq_put(&strm->in_queue, &mem_block, SYS_TIMEOUT_MS(strm->cfg.timeout)); if (ret) { LOG_DBG("k_msgq_put returned code %d", ret); return ret; @@ -1144,27 +1068,27 @@ static void audio_clock_settings(const struct device *dev) { clock_audio_pll_config_t audioPllConfig; const struct i2s_mcux_config *dev_cfg = dev->config; - uint32_t clock_name = (uint32_t) dev_cfg->clk_sub_sys; + uint32_t clock_name = (uint32_t)dev_cfg->clk_sub_sys; /*Clock setting for SAI*/ - imxrt_audio_codec_pll_init(clock_name, dev_cfg->clk_src, - dev_cfg->clk_pre_div, dev_cfg->clk_src_div); - - #ifdef CONFIG_SOC_SERIES_IMXRT11XX - audioPllConfig.loopDivider = dev_cfg->pll_lp; - audioPllConfig.postDivider = dev_cfg->pll_pd; - audioPllConfig.numerator = dev_cfg->pll_num; - audioPllConfig.denominator = dev_cfg->pll_den; - audioPllConfig.ssEnable = false; - #elif defined CONFIG_SOC_SERIES_IMXRT10XX - audioPllConfig.src = dev_cfg->pll_src; - audioPllConfig.loopDivider = dev_cfg->pll_lp; - audioPllConfig.postDivider = dev_cfg->pll_pd; - audioPllConfig.numerator = dev_cfg->pll_num; - audioPllConfig.denominator = dev_cfg->pll_den; - #else - #error Initialize SOC Series-specific clock_audio_pll_config_t - #endif /* CONFIG_SOC_SERIES */ + imxrt_audio_codec_pll_init(clock_name, dev_cfg->clk_src, dev_cfg->clk_pre_div, + dev_cfg->clk_src_div); + +#ifdef CONFIG_SOC_SERIES_IMXRT11XX + audioPllConfig.loopDivider = dev_cfg->pll_lp; + audioPllConfig.postDivider = dev_cfg->pll_pd; + audioPllConfig.numerator = dev_cfg->pll_num; + audioPllConfig.denominator = dev_cfg->pll_den; + audioPllConfig.ssEnable = false; +#elif defined CONFIG_SOC_SERIES_IMXRT10XX + audioPllConfig.src = dev_cfg->pll_src; + audioPllConfig.loopDivider = dev_cfg->pll_lp; + audioPllConfig.postDivider = dev_cfg->pll_pd; + audioPllConfig.numerator = dev_cfg->pll_num; + audioPllConfig.denominator = dev_cfg->pll_den; +#else +#error Initialize SOC Series-specific clock_audio_pll_config_t +#endif /* CONFIG_SOC_SERIES */ CLOCK_InitAudioPll(&audioPllConfig); } @@ -1183,14 +1107,14 @@ static int i2s_mcux_initialize(const struct device *dev) } /* Initialize the buffer queues */ - k_msgq_init(&dev_data->tx.in_queue, (char *)dev_data->tx_in_msgs, - sizeof(void *), CONFIG_I2S_TX_BLOCK_COUNT); - k_msgq_init(&dev_data->rx.in_queue, (char *)dev_data->rx_in_msgs, - sizeof(void *), CONFIG_I2S_RX_BLOCK_COUNT); - k_msgq_init(&dev_data->tx.out_queue, (char *)dev_data->tx_out_msgs, - sizeof(void *), CONFIG_I2S_TX_BLOCK_COUNT); - k_msgq_init(&dev_data->rx.out_queue, (char *)dev_data->rx_out_msgs, - sizeof(void *), CONFIG_I2S_RX_BLOCK_COUNT); + k_msgq_init(&dev_data->tx.in_queue, (char *)dev_data->tx_in_msgs, sizeof(void *), + CONFIG_I2S_TX_BLOCK_COUNT); + k_msgq_init(&dev_data->rx.in_queue, (char *)dev_data->rx_in_msgs, sizeof(void *), + CONFIG_I2S_RX_BLOCK_COUNT); + k_msgq_init(&dev_data->tx.out_queue, (char *)dev_data->tx_out_msgs, sizeof(void *), + CONFIG_I2S_TX_BLOCK_COUNT); + k_msgq_init(&dev_data->rx.out_queue, (char *)dev_data->rx_out_msgs, sizeof(void *), + CONFIG_I2S_RX_BLOCK_COUNT); /* register ISR */ dev_cfg->irq_connect(dev); @@ -1209,14 +1133,12 @@ static int i2s_mcux_initialize(const struct device *dev) dev_data->tx.state = I2S_STATE_NOT_READY; dev_data->rx.state = I2S_STATE_NOT_READY; -#if (defined(FSL_FEATURE_SAI_HAS_MCR) && (FSL_FEATURE_SAI_HAS_MCR)) || \ - (defined(FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER) && \ - (FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER)) +#if (defined(FSL_FEATURE_SAI_HAS_MCR) && (FSL_FEATURE_SAI_HAS_MCR)) || \ + (defined(FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER) && (FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER)) sai_master_clock_t mclkConfig = { #if defined(FSL_FEATURE_SAI_HAS_MCR) && (FSL_FEATURE_SAI_HAS_MCR) .mclkOutputEnable = true, -#if !(defined(FSL_FEATURE_SAI_HAS_NO_MCR_MICS) && \ - (FSL_FEATURE_SAI_HAS_NO_MCR_MICS)) +#if !(defined(FSL_FEATURE_SAI_HAS_NO_MCR_MICS) && (FSL_FEATURE_SAI_HAS_NO_MCR_MICS)) .mclkSource = kSAI_MclkSourceSysclk, #endif #endif @@ -1225,11 +1147,9 @@ static int i2s_mcux_initialize(const struct device *dev) get_mclk_rate(dev, &mclk); /* master clock configurations */ -#if (defined(FSL_FEATURE_SAI_HAS_MCR) && (FSL_FEATURE_SAI_HAS_MCR)) || \ - (defined(FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER) && \ - (FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER)) -#if defined(FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER) && \ - (FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER) +#if (defined(FSL_FEATURE_SAI_HAS_MCR) && (FSL_FEATURE_SAI_HAS_MCR)) || \ + (defined(FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER) && (FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER)) +#if defined(FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER) && (FSL_FEATURE_SAI_HAS_MCLKDIV_REGISTER) mclkConfig.mclkHz = mclk; mclkConfig.mclkSourceClkHz = mclk; #endif @@ -1249,106 +1169,81 @@ static const struct i2s_driver_api i2s_mcux_driver_api = { .trigger = i2s_mcux_trigger, }; -#define I2S_MCUX_INIT(i2s_id) \ - static void i2s_irq_connect_##i2s_id(const struct device *dev); \ - \ - PINCTRL_DT_INST_DEFINE(i2s_id); \ - \ - static const struct i2s_mcux_config i2s_##i2s_id##_config = { \ - .base = (I2S_Type *)DT_INST_REG_ADDR(i2s_id), \ - .clk_src = DT_INST_PROP(i2s_id, clock_mux), \ - .clk_pre_div = DT_INST_PROP(i2s_id, pre_div), \ - .clk_src_div = DT_INST_PROP(i2s_id, podf), \ - .pll_src = \ - DT_PHA_BY_NAME(DT_DRV_INST(i2s_id), \ - pll_clocks, src, value), \ - .pll_lp = \ - DT_PHA_BY_NAME(DT_DRV_INST(i2s_id), \ - pll_clocks, lp, value), \ - .pll_pd = \ - DT_PHA_BY_NAME(DT_DRV_INST(i2s_id), \ - pll_clocks, pd, value), \ - .pll_num = \ - DT_PHA_BY_NAME(DT_DRV_INST(i2s_id), \ - pll_clocks, num, value), \ - .pll_den = \ - DT_PHA_BY_NAME(DT_DRV_INST(i2s_id), \ - pll_clocks, den, value), \ - .mclk_pin_mask = \ - DT_PHA_BY_IDX(DT_DRV_INST(i2s_id), \ - pinmuxes, 0, function), \ - .mclk_pin_offset = \ - DT_PHA_BY_IDX(DT_DRV_INST(i2s_id), \ - pinmuxes, 0, pin), \ - .clk_sub_sys = (clock_control_subsys_t) \ - DT_INST_CLOCKS_CELL_BY_IDX(i2s_id, 0, name), \ - .ccm_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(i2s_id)), \ - .irq_connect = i2s_irq_connect_##i2s_id, \ - .pinctrl = PINCTRL_DT_INST_DEV_CONFIG_GET(i2s_id), \ - .tx_sync_mode = \ - DT_INST_PROP(i2s_id, nxp_tx_sync_mode), \ - .rx_sync_mode = \ - DT_INST_PROP(i2s_id, nxp_rx_sync_mode), \ - .tx_channel = DT_INST_PROP(i2s_id, nxp_tx_channel), \ - }; \ - \ - static struct i2s_dev_data i2s_##i2s_id##_data = { \ - .dev_dma = DEVICE_DT_GET( \ - DT_INST_DMAS_CTLR_BY_NAME(i2s_id, rx)), \ - .tx = { \ - .dma_channel = \ - DT_INST_PROP(i2s_id, nxp_tx_dma_channel), \ - .dma_cfg = { \ - .source_burst_length = \ - CONFIG_I2S_EDMA_BURST_SIZE, \ - .dest_burst_length = \ - CONFIG_I2S_EDMA_BURST_SIZE, \ - .dma_callback = i2s_dma_tx_callback, \ - .complete_callback_en = 1, \ - .error_callback_dis = 1, \ - .block_count = 1, \ - .head_block = \ - &i2s_##i2s_id##_data.tx.dma_block, \ - .channel_direction = MEMORY_TO_PERIPHERAL, \ - .dma_slot = \ - DT_INST_DMAS_CELL_BY_NAME(i2s_id, \ - tx, source), \ - }, \ - }, \ - .rx = { \ - .dma_channel = \ - DT_INST_PROP(i2s_id, nxp_rx_dma_channel), \ - .dma_cfg = { \ - .source_burst_length = \ - CONFIG_I2S_EDMA_BURST_SIZE, \ - .dest_burst_length = \ - CONFIG_I2S_EDMA_BURST_SIZE, \ - .dma_callback = i2s_dma_rx_callback, \ - .complete_callback_en = 1, \ - .error_callback_dis = 1, \ - .block_count = 1, \ - .head_block = \ - &i2s_##i2s_id##_data.rx.dma_block, \ - .channel_direction = PERIPHERAL_TO_MEMORY, \ - .dma_slot = \ - DT_INST_DMAS_CELL_BY_NAME(i2s_id, \ - rx, source), \ - }, \ - }, \ - }; \ - \ - DEVICE_DT_INST_DEFINE(i2s_id, &i2s_mcux_initialize, NULL, \ - &i2s_##i2s_id##_data, &i2s_##i2s_id##_config, \ - POST_KERNEL, \ - CONFIG_I2S_INIT_PRIORITY, &i2s_mcux_driver_api); \ - \ - static void i2s_irq_connect_##i2s_id(const struct device *dev) \ - { \ - IRQ_CONNECT(DT_INST_IRQ_BY_IDX(i2s_id, 0, irq), \ - DT_INST_IRQ_BY_IDX(i2s_id, 0, priority), \ - i2s_mcux_isr, \ - DEVICE_DT_INST_GET(i2s_id), 0); \ - irq_enable(DT_INST_IRQN(i2s_id)); \ +#define I2S_MCUX_INIT(i2s_id) \ + static void i2s_irq_connect_##i2s_id(const struct device *dev); \ + \ + PINCTRL_DT_INST_DEFINE(i2s_id); \ + \ + static const struct i2s_mcux_config i2s_##i2s_id##_config = { \ + .base = (I2S_Type *)DT_INST_REG_ADDR(i2s_id), \ + .clk_src = DT_INST_PROP(i2s_id, clock_mux), \ + .clk_pre_div = DT_INST_PROP(i2s_id, pre_div), \ + .clk_src_div = DT_INST_PROP(i2s_id, podf), \ + .pll_src = DT_PHA_BY_NAME(DT_DRV_INST(i2s_id), pll_clocks, src, value), \ + .pll_lp = DT_PHA_BY_NAME(DT_DRV_INST(i2s_id), pll_clocks, lp, value), \ + .pll_pd = DT_PHA_BY_NAME(DT_DRV_INST(i2s_id), pll_clocks, pd, value), \ + .pll_num = DT_PHA_BY_NAME(DT_DRV_INST(i2s_id), pll_clocks, num, value), \ + .pll_den = DT_PHA_BY_NAME(DT_DRV_INST(i2s_id), pll_clocks, den, value), \ + .mclk_pin_mask = DT_PHA_BY_IDX(DT_DRV_INST(i2s_id), pinmuxes, 0, function), \ + .mclk_pin_offset = DT_PHA_BY_IDX(DT_DRV_INST(i2s_id), pinmuxes, 0, pin), \ + .clk_sub_sys = \ + (clock_control_subsys_t)DT_INST_CLOCKS_CELL_BY_IDX(i2s_id, 0, name), \ + .ccm_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(i2s_id)), \ + .irq_connect = i2s_irq_connect_##i2s_id, \ + .pinctrl = PINCTRL_DT_INST_DEV_CONFIG_GET(i2s_id), \ + .tx_sync_mode = DT_INST_PROP(i2s_id, nxp_tx_sync_mode), \ + .rx_sync_mode = DT_INST_PROP(i2s_id, nxp_rx_sync_mode), \ + .tx_channel = DT_INST_PROP(i2s_id, nxp_tx_channel), \ + }; \ + \ + static struct i2s_dev_data i2s_##i2s_id##_data = { \ + .dev_dma = DEVICE_DT_GET(DT_INST_DMAS_CTLR_BY_NAME(i2s_id, rx)), \ + .tx = \ + { \ + .dma_channel = DT_INST_PROP(i2s_id, nxp_tx_dma_channel), \ + .dma_cfg = \ + { \ + .source_burst_length = CONFIG_I2S_EDMA_BURST_SIZE, \ + .dest_burst_length = CONFIG_I2S_EDMA_BURST_SIZE, \ + .dma_callback = i2s_dma_tx_callback, \ + .complete_callback_en = 1, \ + .error_callback_dis = 1, \ + .block_count = 1, \ + .head_block = &i2s_##i2s_id##_data.tx.dma_block, \ + .channel_direction = MEMORY_TO_PERIPHERAL, \ + .dma_slot = DT_INST_DMAS_CELL_BY_NAME(i2s_id, tx, \ + source), \ + }, \ + }, \ + .rx = \ + { \ + .dma_channel = DT_INST_PROP(i2s_id, nxp_rx_dma_channel), \ + .dma_cfg = \ + { \ + .source_burst_length = CONFIG_I2S_EDMA_BURST_SIZE, \ + .dest_burst_length = CONFIG_I2S_EDMA_BURST_SIZE, \ + .dma_callback = i2s_dma_rx_callback, \ + .complete_callback_en = 1, \ + .error_callback_dis = 1, \ + .block_count = 1, \ + .head_block = &i2s_##i2s_id##_data.rx.dma_block, \ + .channel_direction = PERIPHERAL_TO_MEMORY, \ + .dma_slot = DT_INST_DMAS_CELL_BY_NAME(i2s_id, rx, \ + source), \ + }, \ + }, \ + }; \ + \ + DEVICE_DT_INST_DEFINE(i2s_id, &i2s_mcux_initialize, NULL, &i2s_##i2s_id##_data, \ + &i2s_##i2s_id##_config, POST_KERNEL, CONFIG_I2S_INIT_PRIORITY, \ + &i2s_mcux_driver_api); \ + \ + static void i2s_irq_connect_##i2s_id(const struct device *dev) \ + { \ + IRQ_CONNECT(DT_INST_IRQ_BY_IDX(i2s_id, 0, irq), \ + DT_INST_IRQ_BY_IDX(i2s_id, 0, priority), i2s_mcux_isr, \ + DEVICE_DT_INST_GET(i2s_id), 0); \ + irq_enable(DT_INST_IRQN(i2s_id)); \ } DT_INST_FOREACH_STATUS_OKAY(I2S_MCUX_INIT) From a1cd2d6c83fee446cdd4a8801d7e3577d6b73c9c Mon Sep 17 00:00:00 2001 From: Hao Luo Date: Tue, 15 Oct 2024 15:49:54 +0800 Subject: [PATCH 1251/4482] drivers: pm: add pm_policy_state_lock for drivers Added pm_policy_state_lock to prevent memory power off during data transfer Signed-off-by: Hao Luo --- drivers/i2c/i2c_ambiq.c | 46 +++++++++++++++++++++++++-------------- drivers/spi/spi_ambiq.c | 48 ++++++++++++++++++++++++++--------------- west.yml | 2 +- 3 files changed, 62 insertions(+), 34 deletions(-) diff --git a/drivers/i2c/i2c_ambiq.c b/drivers/i2c/i2c_ambiq.c index b3ff0ac10e356..99e08004a75d8 100644 --- a/drivers/i2c/i2c_ambiq.c +++ b/drivers/i2c/i2c_ambiq.c @@ -47,8 +47,35 @@ struct i2c_ambiq_data { void *callback_data; int inst_idx; uint32_t transfer_status; + bool pm_policy_state_on; }; +static void i2c_ambiq_pm_policy_state_lock_get(const struct device *dev) +{ + if (IS_ENABLED(CONFIG_PM)) { + struct i2c_ambiq_data *data = dev->data; + + if (!data->pm_policy_state_on) { + data->pm_policy_state_on = true; + pm_policy_state_lock_get(PM_STATE_SUSPEND_TO_RAM, PM_ALL_SUBSTATES); + pm_device_runtime_get(dev); + } + } +} + +static void i2c_ambiq_pm_policy_state_lock_put(const struct device *dev) +{ + if (IS_ENABLED(CONFIG_PM)) { + struct i2c_ambiq_data *data = dev->data; + + if (data->pm_policy_state_on) { + data->pm_policy_state_on = false; + pm_device_runtime_put(dev); + pm_policy_state_lock_put(PM_STATE_SUSPEND_TO_RAM, PM_ALL_SUBSTATES); + } + } +} + #ifdef CONFIG_I2C_AMBIQ_DMA static __aligned(32) struct { __aligned(32) uint32_t buf[CONFIG_I2C_DMA_TCB_BUFFER_SIZE]; @@ -183,17 +210,13 @@ static int i2c_ambiq_transfer(const struct device *dev, struct i2c_msg *msgs, ui uint16_t addr) { struct i2c_ambiq_data *data = dev->data; - int pm_ret, ret = 0; + int ret = 0; if (!num_msgs) { return 0; } - pm_ret = pm_device_runtime_get(dev); - - if (pm_ret < 0) { - LOG_ERR("pm_device_runtime_get failed: %d", pm_ret); - } + i2c_ambiq_pm_policy_state_lock_get(dev); /* Send out messages */ k_sem_take(&data->bus_sem, K_FOREVER); @@ -213,16 +236,7 @@ static int i2c_ambiq_transfer(const struct device *dev, struct i2c_msg *msgs, ui k_sem_give(&data->bus_sem); - /* Use async put to avoid useless device suspension/resumption - * when doing consecutive transmission. - */ - if (!pm_ret) { - pm_ret = pm_device_runtime_put_async(dev, K_MSEC(2)); - - if (pm_ret < 0) { - LOG_ERR("pm_device_runtime_put failed: %d", pm_ret); - } - } + i2c_ambiq_pm_policy_state_lock_put(dev); return ret; } diff --git a/drivers/spi/spi_ambiq.c b/drivers/spi/spi_ambiq.c index 536a9f2198845..c95c3875dc5f2 100644 --- a/drivers/spi/spi_ambiq.c +++ b/drivers/spi/spi_ambiq.c @@ -42,6 +42,7 @@ struct spi_ambiq_data { void *iom_handler; int inst_idx; bool cont; + bool pm_policy_state_on; }; typedef void (*spi_context_update_trx)(struct spi_context *ctx, uint8_t dfs, uint32_t len); @@ -50,6 +51,32 @@ typedef void (*spi_context_update_trx)(struct spi_context *ctx, uint8_t dfs, uin #define SPI_CS_INDEX 3 +static void spi_ambiq_pm_policy_state_lock_get(const struct device *dev) +{ + if (IS_ENABLED(CONFIG_PM)) { + struct spi_ambiq_data *data = dev->data; + + if (!data->pm_policy_state_on) { + data->pm_policy_state_on = true; + pm_policy_state_lock_get(PM_STATE_SUSPEND_TO_RAM, PM_ALL_SUBSTATES); + pm_device_runtime_get(dev); + } + } +} + +static void spi_ambiq_pm_policy_state_lock_put(const struct device *dev) +{ + if (IS_ENABLED(CONFIG_PM)) { + struct spi_ambiq_data *data = dev->data; + + if (data->pm_policy_state_on) { + data->pm_policy_state_on = false; + pm_device_runtime_put(dev); + pm_policy_state_lock_put(PM_STATE_SUSPEND_TO_RAM, PM_ALL_SUBSTATES); + } + } +} + #ifdef CONFIG_SPI_AMBIQ_DMA static __aligned(32) struct { __aligned(32) uint32_t buf[CONFIG_SPI_DMA_TCB_BUFFER_SIZE]; @@ -349,15 +376,11 @@ static int spi_ambiq_transceive(const struct device *dev, const struct spi_confi return 0; } - pm_ret = pm_device_runtime_get(dev); - - if (pm_ret < 0) { - LOG_ERR("pm_device_runtime_get failed: %d", pm_ret); - } - /* context setup */ spi_context_lock(&data->ctx, false, NULL, NULL, config); + spi_ambiq_pm_policy_state_lock_get(dev); + ret = spi_config(dev, config); if (ret) { @@ -370,18 +393,9 @@ static int spi_ambiq_transceive(const struct device *dev, const struct spi_confi ret = spi_ambiq_xfer(dev, config); xfer_end: - spi_context_release(&data->ctx, ret); - - /* Use async put to avoid useless device suspension/resumption - * when doing consecutive transmission. - */ - if (!pm_ret) { - pm_ret = pm_device_runtime_put_async(dev, K_MSEC(2)); + spi_ambiq_pm_policy_state_lock_put(dev); - if (pm_ret < 0) { - LOG_ERR("pm_device_runtime_put failed: %d", pm_ret); - } - } + spi_context_release(&data->ctx, ret); return ret; } diff --git a/west.yml b/west.yml index df9ee84c2f092..f1146918cd9eb 100644 --- a/west.yml +++ b/west.yml @@ -147,7 +147,7 @@ manifest: groups: - hal - name: hal_ambiq - revision: df4a9863f87cf75dc0b4a8e47483c87363d0e8f0 + revision: d3092f9b82874a1791baa3ac41c3795d108fbbdb path: modules/hal/ambiq groups: - hal From b758e205b2a7026a47fcc92b285abe93179ea175 Mon Sep 17 00:00:00 2001 From: Dmitrii Golovanov Date: Mon, 21 Oct 2024 17:56:20 +0200 Subject: [PATCH 1252/4482] ci: footprint: Fix shopt not found Use bash explicitly to have shopt available. Signed-off-by: Dmitrii Golovanov --- .github/workflows/footprint-tracking.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/footprint-tracking.yml b/.github/workflows/footprint-tracking.yml index 3868f6f154554..bcdc0371e7471 100644 --- a/.github/workflows/footprint-tracking.yml +++ b/.github/workflows/footprint-tracking.yml @@ -95,6 +95,7 @@ jobs: aws s3 sync --quiet footprint_data/ s3://testing.zephyrproject.org/footprint_data/ - name: Transform Footprint data to Twister JSON reports + shell: bash run: | shopt -s globstar export ZEPHYR_BASE=${PWD} From f6d305a529e5363af697a7ebc8a3dba6c34f7595 Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Thu, 5 Sep 2024 12:02:01 +0200 Subject: [PATCH 1253/4482] net: lib: add wifi_credentials library MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upstream NCS's library for storing Wi-Fi credentials. This library allows storage of Wi-Fi credentials using different backends. Either the Zephyr settings subsystem or the PSA secure backend can be used. For testing purposes, credentials can be defined statically. Signed-off-by: Ravi Dondaputi Signed-off-by: Kapil Bhatt Signed-off-by: Gregers Gram Rygg Signed-off-by: Kaja Koren Signed-off-by: Simen S. Røstad Signed-off-by: Maximilian Deubel --- include/zephyr/net/wifi_credentials.h | 218 ++++++++++ samples/net/wifi/sample.yaml | 8 +- subsys/net/lib/CMakeLists.txt | 1 + subsys/net/lib/Kconfig | 2 + .../net/lib/wifi_credentials/CMakeLists.txt | 36 ++ subsys/net/lib/wifi_credentials/Kconfig | 109 +++++ .../lib/wifi_credentials/wifi_credentials.c | 409 ++++++++++++++++++ .../wifi_credentials_backend_none.c | 39 ++ .../wifi_credentials_backend_psa.c | 97 +++++ .../wifi_credentials_backend_settings.c | 166 +++++++ .../wifi_credentials_internal.h | 60 +++ .../wifi_credentials/wifi_credentials_shell.c | 313 ++++++++++++++ 12 files changed, 1457 insertions(+), 1 deletion(-) create mode 100644 include/zephyr/net/wifi_credentials.h create mode 100644 subsys/net/lib/wifi_credentials/CMakeLists.txt create mode 100644 subsys/net/lib/wifi_credentials/Kconfig create mode 100644 subsys/net/lib/wifi_credentials/wifi_credentials.c create mode 100644 subsys/net/lib/wifi_credentials/wifi_credentials_backend_none.c create mode 100644 subsys/net/lib/wifi_credentials/wifi_credentials_backend_psa.c create mode 100644 subsys/net/lib/wifi_credentials/wifi_credentials_backend_settings.c create mode 100644 subsys/net/lib/wifi_credentials/wifi_credentials_internal.h create mode 100644 subsys/net/lib/wifi_credentials/wifi_credentials_shell.c diff --git a/include/zephyr/net/wifi_credentials.h b/include/zephyr/net/wifi_credentials.h new file mode 100644 index 0000000000000..0241930e97d39 --- /dev/null +++ b/include/zephyr/net/wifi_credentials.h @@ -0,0 +1,218 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef WIFI_CREDENTIALS_H__ +#define WIFI_CREDENTIALS_H__ + +#include +#include +#include + +/** + * @defgroup wifi_credentials Wi-Fi credentials library + * @ingroup networking + * @since 4.0 + * @version 0.1.0 + * @{ + * @brief Library that provides a way to store and load Wi-Fi credentials. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* this entry contains a BSSID */ +#define WIFI_CREDENTIALS_FLAG_BSSID BIT(0) +/* this entry is to be preferred over others */ +#define WIFI_CREDENTIALS_FLAG_FAVORITE BIT(1) +/* this entry can use the 2.4 GHz band */ +#define WIFI_CREDENTIALS_FLAG_2_4GHz BIT(2) +/* this entry can use the 5 GHz band */ +#define WIFI_CREDENTIALS_FLAG_5GHz BIT(3) +/* this entry requires management frame protection */ +#define WIFI_CREDENTIALS_FLAG_MFP_REQUIRED BIT(4) +/* this entry disables management frame protection */ +#define WIFI_CREDENTIALS_FLAG_MFP_DISABLED BIT(5) + +#define WIFI_CREDENTIALS_MAX_PASSWORD_LEN \ + MAX(WIFI_PSK_MAX_LEN, CONFIG_WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH) + +/** + * @brief Wi-Fi credentials entry header + * @note Every settings entry starts with this header. + * Depending on the `type` field, the header can be casted to a larger type. + * In addition to SSID (usually a string) and BSSID (a MAC address), + * a `flags` field can be used to control some detail settings. + * + */ +struct wifi_credentials_header { + enum wifi_security_type type; /**< Wi-Fi security type */ + char ssid[WIFI_SSID_MAX_LEN]; /**< SSID (Service Set Identifier) */ + size_t ssid_len; /**< Length of the SSID */ + uint32_t flags; /**< Flags for controlling detail settings */ + uint32_t timeout; /**< Timeout for connecting to the network */ + uint8_t bssid[WIFI_MAC_ADDR_LEN]; /**< BSSID (Basic Service Set Identifier) */ + uint8_t channel; /**< Channel on which the network operates */ +}; + +/** + * @brief Wi-Fi Personal credentials entry + * @note Contains only the header and a password. + * For PSK security, passwords can be up to `WIFI_PSK_MAX_LEN` bytes long + * including NULL termination. For SAE security it can range up to + * `CONFIG_WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH`. + * + */ +struct wifi_credentials_personal { + struct wifi_credentials_header header; /**< Header */ + char password[WIFI_CREDENTIALS_MAX_PASSWORD_LEN]; /**< Password/PSK */ + size_t password_len; /**< Length of the password */ +}; + +/** + * @brief Wi-Fi Enterprise credentials entry + * @note This functionality is not yet implemented. + */ +struct wifi_credentials_enterprise { + struct wifi_credentials_header header; /**< Header */ + size_t identity_len; /**< Length of the identity */ + size_t anonymous_identity_len; /**< Length of the anonymous identity */ + size_t password_len; /**< Length of the password */ + size_t ca_cert_len; /**< Length of the CA certificate */ + size_t client_cert_len; /**< Length of the client certificate */ + size_t private_key_len; /**< Length of the private key */ + size_t private_key_pw_len; /**< Length of the private key password */ +}; + +/** + * @brief Get credentials for given SSID. + * + * @param[in] ssid SSID to look for + * @param[in] ssid_len length of SSID + * @param[out] type Wi-Fi security type + * @param[out] bssid_buf buffer to store BSSID if it was fixed + * @param[in] bssid_buf_len length of bssid_buf + * @param[out] password_buf buffer to store password + * @param[in] password_buf_len length of password_buf + * @param[out] password_len length of password + * @param[out] flags flags + * @param[out] channel channel + * @param[out] timeout timeout + * + * @return 0 Success. + * @return -ENOENT No network with this SSID was found. + * @return -EINVAL A required buffer was NULL or invalid SSID length. + * @return -EPROTO The network with this SSID is not a personal network. + */ +int wifi_credentials_get_by_ssid_personal(const char *ssid, size_t ssid_len, + enum wifi_security_type *type, uint8_t *bssid_buf, + size_t bssid_buf_len, char *password_buf, + size_t password_buf_len, size_t *password_len, + uint32_t *flags, uint8_t *channel, uint32_t *timeout); + +/** + * @brief Set credentials for given SSID. + * + * @param[in] ssid SSID to look for + * @param[in] ssid_len length of SSID + * @param[in] type Wi-Fi security type + * @param[in] bssid BSSID (may be NULL) + * @param[in] bssid_len length of BSSID buffer (either 0 or WIFI_MAC_ADDR_LEN) + * @param[in] password password + * @param[in] password_len length of password + * @param[in] flags flags + * @param[in] channel Channel + * @param[in] timeout Timeout + * + * @return 0 Success. Credentials are stored in persistent storage. + * @return -EINVAL A required buffer was NULL or security type is not supported. + * @return -ENOTSUP Security type is not supported. + * @return -ENOBUFS All slots are already taken. + */ +int wifi_credentials_set_personal(const char *ssid, size_t ssid_len, enum wifi_security_type type, + const uint8_t *bssid, size_t bssid_len, const char *password, + size_t password_len, uint32_t flags, uint8_t channel, + uint32_t timeout); + +/** + * @brief Get credentials for given SSID by struct. + * + * @param[in] ssid SSID to look for + * @param[in] ssid_len length of SSID + * @param[out] buf credentials Pointer to struct where credentials are stored + * + * @return 0 Success. + * @return -ENOENT No network with this SSID was found. + * @return -EINVAL A required buffer was NULL or too small. + * @return -EPROTO The network with this SSID is not a personal network. + */ +int wifi_credentials_get_by_ssid_personal_struct(const char *ssid, size_t ssid_len, + struct wifi_credentials_personal *buf); + +/** + * @brief Set credentials for given SSID by struct. + * + * @param[in] creds credentials Pointer to struct from which credentials are loaded + * + * @return 0 Success. + * @return -ENOENT No network with this SSID was found. + * @return -EINVAL A required buffer was NULL or incorrect size. + * @return -ENOBUFS All slots are already taken. + */ +int wifi_credentials_set_personal_struct(const struct wifi_credentials_personal *creds); + +/** + * @brief Delete credentials for given SSID. + * + * @param[in] ssid SSID to look for + * @param[in] ssid_len length of SSID + * + * @return -ENOENT if No network with this SSID was found. + * @return 0 on success, otherwise a negative error code + */ +int wifi_credentials_delete_by_ssid(const char *ssid, size_t ssid_len); + +/** + * @brief Check if credentials storage is empty. + * + * @return true if credential storage is empty, otherwise false + */ +bool wifi_credentials_is_empty(void); + +/** + * @brief Deletes all stored Wi-Fi credentials. + * + * This function deletes all Wi-Fi credentials that have been stored in the system. + * It is typically used when you want to clear all saved networks. + * + * @return 0 on successful, otherwise a negative error code + */ +int wifi_credentials_delete_all(void); + +/** + * @brief Callback type for wifi_credentials_for_each_ssid. + * @param[in] cb_arg arguments for the callback function. Appropriate cb_arg is + * transferred by wifi_credentials_for_each_ssid. + * @param[in] ssid SSID + * @param[in] ssid_len length of SSID + */ +typedef void (*wifi_credentials_ssid_cb)(void *cb_arg, const char *ssid, size_t ssid_len); + +/** + * @brief Call callback for each registered SSID. + * + * @param cb callback + * @param cb_arg argument for callback function + */ +void wifi_credentials_for_each_ssid(wifi_credentials_ssid_cb cb, void *cb_arg); + +#ifdef __cplusplus +} +#endif + +/** @} */ + +#endif /* WIFI_CREDENTIALS_H__ */ diff --git a/samples/net/wifi/sample.yaml b/samples/net/wifi/sample.yaml index 828e4b4c8967d..34aea9386d262 100644 --- a/samples/net/wifi/sample.yaml +++ b/samples/net/wifi/sample.yaml @@ -42,7 +42,13 @@ tests: integration_platforms: - frdm_k64f sample.net.wifi.nrf70dk: - extra_args: CONFIG_NRF_WIFI_BUILD_ONLY_MODE=y + extra_args: + - CONFIG_NRF_WIFI_BUILD_ONLY_MODE=y + - CONFIG_WIFI_CREDENTIALS=y + - CONFIG_FLASH=y + - CONFIG_FLASH_MAP=y + - CONFIG_NVS=y + - CONFIG_SETTINGS=y platform_allow: - nrf7002dk/nrf5340/cpuapp - nrf7002dk/nrf5340/cpuapp/nrf7001 diff --git a/subsys/net/lib/CMakeLists.txt b/subsys/net/lib/CMakeLists.txt index 6dbd0048ae5c1..ee23de2ab027d 100644 --- a/subsys/net/lib/CMakeLists.txt +++ b/subsys/net/lib/CMakeLists.txt @@ -18,6 +18,7 @@ add_subdirectory_ifdef(CONFIG_NET_SHELL shell) add_subdirectory_ifdef(CONFIG_NET_TRICKLE trickle) add_subdirectory_ifdef(CONFIG_NET_DHCPV6 dhcpv6) add_subdirectory_ifdef(CONFIG_PROMETHEUS prometheus) +add_subdirectory_ifdef(CONFIG_WIFI_CREDENTIALS wifi_credentials) if (CONFIG_NET_DHCPV4 OR CONFIG_NET_DHCPV4_SERVER) add_subdirectory(dhcpv4) diff --git a/subsys/net/lib/Kconfig b/subsys/net/lib/Kconfig index aa770cc6722ba..ab7aa98373d0a 100644 --- a/subsys/net/lib/Kconfig +++ b/subsys/net/lib/Kconfig @@ -51,4 +51,6 @@ source "subsys/net/lib/zperf/Kconfig" source "subsys/net/lib/prometheus/Kconfig" +source "subsys/net/lib/wifi_credentials/Kconfig" + endmenu diff --git a/subsys/net/lib/wifi_credentials/CMakeLists.txt b/subsys/net/lib/wifi_credentials/CMakeLists.txt new file mode 100644 index 0000000000000..bb8222bd818e1 --- /dev/null +++ b/subsys/net/lib/wifi_credentials/CMakeLists.txt @@ -0,0 +1,36 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +zephyr_library_named(wifi_credentials) +zephyr_library_sources(wifi_credentials.c) + +if (CONFIG_WIFI_CREDENTIALS_BACKEND_PSA) +zephyr_library_include_directories( + $/api_ns/interface/include +) +endif() + +zephyr_library_sources_ifdef( + CONFIG_WIFI_CREDENTIALS_BACKEND_SETTINGS + wifi_credentials_backend_settings.c) + +zephyr_library_sources_ifdef( + CONFIG_WIFI_CREDENTIALS_BACKEND_PSA + wifi_credentials_backend_psa.c) + +zephyr_library_sources_ifdef( + CONFIG_WIFI_CREDENTIALS_BACKEND_NONE + wifi_credentials_backend_none.c) + +zephyr_library_sources_ifdef( + CONFIG_WIFI_CREDENTIALS_SHELL + wifi_credentials_shell.c) + +if(WIFI_CREDENTIALS_STATIC_SSID) + message(WARNING + "Static Wi-Fi configuration is used, please remove before deployment!" + ) +endif() diff --git a/subsys/net/lib/wifi_credentials/Kconfig b/subsys/net/lib/wifi_credentials/Kconfig new file mode 100644 index 0000000000000..452392a82ce33 --- /dev/null +++ b/subsys/net/lib/wifi_credentials/Kconfig @@ -0,0 +1,109 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +menuconfig WIFI_CREDENTIALS + bool "WIFI credentials management" + select EXPERIMENTAL + help + Enable WiFi credentials management subsystem. + +if WIFI_CREDENTIALS + +module = WIFI_CREDENTIALS +module-str = wifi_credentials +source "subsys/logging/Kconfig.template.log_config" + +choice WIFI_CREDENTIALS_BACKEND + prompt "WiFi credentials backend" + default WIFI_CREDENTIALS_BACKEND_PSA if BUILD_WITH_TFM + default WIFI_CREDENTIALS_BACKEND_SETTINGS + default WIFI_CREDENTIALS_BACKEND_NONE if WIFI_CREDENTIALS_STATIC + help + Selects whether to use PSA Protected Storage or the Zephyr settings subsystem + for credentials storage. + +config WIFI_CREDENTIALS_BACKEND_SETTINGS + bool "Zephyr Settings" + depends on SETTINGS + depends on !SETTINGS_NONE + +config WIFI_CREDENTIALS_BACKEND_PSA + bool "PSA Protected Storage" + depends on BUILD_WITH_TFM + +config WIFI_CREDENTIALS_BACKEND_NONE + bool "No credentials storage" + depends on WIFI_CREDENTIALS_STATIC + +endchoice + +config WIFI_CREDENTIALS_MAX_ENTRIES + int "Number of supported WiFi credentials" + default 2 + help + This detemines how many different WiFi networks can be configured at a time. + +config WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH + int "Max. length of SAE password" + default 128 + help + There is no official limit on SAE password length, + but for example Linux 6.0 has a hardcoded limit of 128 bytes. + +config WIFI_CREDENTIALS_SHELL + bool "Shell commands to manage Wi-Fi credentials" + default y + depends on SHELL + depends on !WIFI_CREDENTIALS_BACKEND_NONE + +endif # WIFI_CREDENTIALS + +if WIFI_CREDENTIALS_BACKEND_PSA + +config WIFI_CREDENTIALS_BACKEND_PSA_OFFSET + int "PSA_KEY_ID range offset" + default 0 + help + The PSA specification mandates to set key identifiers for keys + with persistent lifetime. The users of the PSA API are responsible (WIFI credentials + management is user of PSA API) to provide correct and unique identifiers. + +endif # WIFI_CREDENTIALS_BACKEND_PSA + +config WIFI_CREDENTIALS_STATIC + bool "Static Wi-Fi network configuration" + +if WIFI_CREDENTIALS_STATIC + +config WIFI_CREDENTIALS_STATIC_SSID + string "SSID of statically configured WiFi network" + +config WIFI_CREDENTIALS_STATIC_PASSWORD + string "Password of statically configured Wi-Fi network" + default "" + +choice WIFI_CREDENTIALS_STATIC_TYPE + prompt "Static Wi-Fi network security type" + default WIFI_CREDENTIALS_STATIC_TYPE_PSK + +config WIFI_CREDENTIALS_STATIC_TYPE_OPEN + bool "OPEN" + +config WIFI_CREDENTIALS_STATIC_TYPE_PSK + bool "WPA2-PSK" + +config WIFI_CREDENTIALS_STATIC_TYPE_PSK_SHA256 + bool "WPA2-PSK-SHA256" + +config WIFI_CREDENTIALS_STATIC_TYPE_SAE + bool "SAE" + +config WIFI_CREDENTIALS_STATIC_TYPE_WPA_PSK + bool "WPA-PSK" + +endchoice + +endif diff --git a/subsys/net/lib/wifi_credentials/wifi_credentials.c b/subsys/net/lib/wifi_credentials/wifi_credentials.c new file mode 100644 index 0000000000000..acc31767b8938 --- /dev/null +++ b/subsys/net/lib/wifi_credentials/wifi_credentials.c @@ -0,0 +1,409 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include + +#include "wifi_credentials_internal.h" + +LOG_MODULE_REGISTER(wifi_credentials, CONFIG_WIFI_CREDENTIALS_LOG_LEVEL); + +static K_MUTEX_DEFINE(wifi_credentials_mutex); + +/* SSID cache: maps SSIDs to their storage indices */ +static char ssid_cache[CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES][WIFI_SSID_MAX_LEN]; +static size_t ssid_cache_lengths[CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES]; + +/** + * @brief Finds index of given SSID if it exists. + * + * @param ssid SSID to look for (buffer of WIFI_SSID_MAX_LEN length) + * @return index if entry is found, -1 otherwise + */ +static inline ssize_t lookup_idx(const uint8_t *ssid, size_t ssid_len) +{ + for (size_t i = 0; i < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES; ++i) { + if (ssid_len != ssid_cache_lengths[i]) { + continue; + } + + if (strncmp(ssid, ssid_cache[i], ssid_len) == 0) { + return i; + } + } + + return -1; +} + +/** + * @brief Determine whether an index is currently used for storing network credentials. + * + * @param idx credential index + * @return true if index is used, false otherwise + */ +static inline bool is_entry_used(size_t idx) +{ + return ssid_cache_lengths[idx] != 0; +} + +/** + * @brief Finds unused index to store new entry at. + * + * @return index if empty slot is found, -1 otherwise + */ +static inline ssize_t lookup_unused_idx(void) +{ + for (size_t i = 0; i < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES; ++i) { + if (!is_entry_used(i)) { + return i; + } + } + + return -1; +} + +static int init(void) +{ + + int ret; + + k_mutex_lock(&wifi_credentials_mutex, K_FOREVER); + + ret = wifi_credentials_backend_init(); + if (ret) { + LOG_ERR("Initializing WiFi credentials storage backend failed, err: %d", ret); + } + + k_mutex_unlock(&wifi_credentials_mutex); + + return 0; +} + +void wifi_credentials_cache_ssid(size_t idx, const struct wifi_credentials_header *buf) +{ + memcpy(ssid_cache[idx], buf->ssid, buf->ssid_len); + ssid_cache_lengths[idx] = buf->ssid_len; +} + +/** + * @brief Clear entry in SSID cache. + * + * @param idx credential index + */ +void wifi_credentials_uncache_ssid(size_t idx) +{ + ssid_cache_lengths[idx] = 0; +} + +int wifi_credentials_get_by_ssid_personal_struct(const char *ssid, size_t ssid_len, + struct wifi_credentials_personal *buf) +{ + int ret; + + if (ssid == NULL || ssid_len > WIFI_SSID_MAX_LEN || ssid_len == 0) { + LOG_ERR("Cannot retrieve WiFi credentials, SSID has invalid format"); + return -EINVAL; + } + + if (buf == NULL) { + LOG_ERR("Cannot retrieve WiFi credentials, " + "destination struct pointer cannot be NULL"); + return -EINVAL; + } + + k_mutex_lock(&wifi_credentials_mutex, K_FOREVER); + + ssize_t idx = lookup_idx(ssid, ssid_len); + + if (idx == -1) { + LOG_DBG("Cannot retrieve WiFi credentials, no entry found for the provided SSID"); + ret = -ENOENT; + goto exit; + } + + ret = wifi_credentials_load_entry(idx, buf, sizeof(struct wifi_credentials_personal)); + + if (ret) { + LOG_ERR("Failed to load WiFi credentials at index %d, err: %d", idx, ret); + goto exit; + } + + if (buf->header.type != WIFI_SECURITY_TYPE_NONE && + buf->header.type != WIFI_SECURITY_TYPE_PSK && + buf->header.type != WIFI_SECURITY_TYPE_PSK_SHA256 && + buf->header.type != WIFI_SECURITY_TYPE_SAE && + buf->header.type != WIFI_SECURITY_TYPE_WPA_PSK) { + LOG_ERR("Requested WiFi credentials entry is corrupted"); + ret = -EPROTO; + goto exit; + } + +exit: + k_mutex_unlock(&wifi_credentials_mutex); + + return ret; +} + +int wifi_credentials_set_personal_struct(const struct wifi_credentials_personal *creds) +{ + int ret; + + if (creds->header.ssid_len > WIFI_SSID_MAX_LEN || creds->header.ssid_len == 0) { + LOG_ERR("Cannot set WiFi credentials, SSID has invalid format"); + return -EINVAL; + } + + if (creds == NULL) { + LOG_ERR("Cannot set WiFi credentials, provided struct pointer cannot be NULL"); + return -EINVAL; + } + + k_mutex_lock(&wifi_credentials_mutex, K_FOREVER); + + ssize_t idx = lookup_idx(creds->header.ssid, creds->header.ssid_len); + + if (idx == -1) { + idx = lookup_unused_idx(); + if (idx == -1) { + LOG_ERR("Cannot store WiFi credentials, no space left"); + ret = -ENOBUFS; + goto exit; + } + } + + ret = wifi_credentials_store_entry(idx, creds, sizeof(struct wifi_credentials_personal)); + + if (ret) { + LOG_ERR("Failed to store WiFi credentials at index %d, err: %d", idx, ret); + goto exit; + } + + wifi_credentials_cache_ssid(idx, &creds->header); + +exit: + k_mutex_unlock(&wifi_credentials_mutex); + + return ret; +} + +int wifi_credentials_set_personal(const char *ssid, size_t ssid_len, enum wifi_security_type type, + const uint8_t *bssid, size_t bssid_len, const char *password, + size_t password_len, uint32_t flags, uint8_t channel, + uint32_t timeout) +{ + int ret = 0; + uint8_t buf[ENTRY_MAX_LEN] = {0}; + + if (ssid == NULL || ssid_len > WIFI_SSID_MAX_LEN || ssid_len == 0) { + LOG_ERR("Cannot set WiFi credentials, SSID has invalid format"); + return -EINVAL; + } + + if (flags & WIFI_CREDENTIALS_FLAG_BSSID && + (bssid_len != WIFI_MAC_ADDR_LEN || bssid == NULL)) { + LOG_ERR("Cannot set WiFi credentials, " + "provided flags indicated BSSID, but no BSSID provided"); + return -EINVAL; + } + + if ((type != WIFI_SECURITY_TYPE_NONE && (password_len == 0 || password == NULL)) || + (password_len > WIFI_CREDENTIALS_MAX_PASSWORD_LEN)) { + LOG_ERR("Cannot set WiFi credentials, password not provided or invalid"); + return -EINVAL; + } + + /* pack entry */ + struct wifi_credentials_header *header = (struct wifi_credentials_header *)buf; + + header->type = type; + memcpy(header->ssid, ssid, ssid_len); + header->ssid_len = ssid_len; + header->flags = flags; + header->channel = channel; + header->timeout = timeout; + + if (flags & WIFI_CREDENTIALS_FLAG_BSSID) { + memcpy(header->bssid, bssid, WIFI_MAC_ADDR_LEN); + } + + switch (type) { + case WIFI_SECURITY_TYPE_NONE: + break; + case WIFI_SECURITY_TYPE_PSK: + case WIFI_SECURITY_TYPE_PSK_SHA256: + case WIFI_SECURITY_TYPE_WPA_PSK: + case WIFI_SECURITY_TYPE_SAE: { + struct wifi_credentials_personal *header_personal = + (struct wifi_credentials_personal *)buf; + + memcpy(header_personal->password, password, password_len); + header_personal->password_len = password_len; + break; + } + default: + LOG_ERR("Cannot set WiFi credentials, " + "provided security type %d is unsupported", + type); + return -ENOTSUP; + } + + /* store entry */ + ret = wifi_credentials_set_personal_struct((struct wifi_credentials_personal *)buf); + + return ret; +} + +int wifi_credentials_get_by_ssid_personal(const char *ssid, size_t ssid_len, + enum wifi_security_type *type, uint8_t *bssid_buf, + size_t bssid_buf_len, char *password_buf, + size_t password_buf_len, size_t *password_len, + uint32_t *flags, uint8_t *channel, uint32_t *timeout) +{ + int ret = 0; + uint8_t buf[ENTRY_MAX_LEN] = {0}; + + if (ssid == NULL || ssid_len > WIFI_SSID_MAX_LEN || ssid_len == 0) { + LOG_ERR("Cannot retrieve WiFi credentials, SSID has invalid format"); + return -EINVAL; + } + + if (bssid_buf_len != WIFI_MAC_ADDR_LEN || bssid_buf == NULL) { + LOG_ERR("BSSID buffer needs to be provided"); + return -EINVAL; + } + + if (password_buf == NULL || password_buf_len > WIFI_CREDENTIALS_MAX_PASSWORD_LEN || + password_buf_len == 0) { + LOG_ERR("WiFi password buffer needs to be provided"); + return -EINVAL; + } + + /* load entry */ + ret = wifi_credentials_get_by_ssid_personal_struct(ssid, ssid_len, + (struct wifi_credentials_personal *)buf); + if (ret) { + return ret; + } + + /* unpack entry*/ + struct wifi_credentials_header *header = (struct wifi_credentials_header *)buf; + + *type = header->type; + *flags = header->flags; + *channel = header->channel; + *timeout = header->timeout; + + if (header->flags & WIFI_CREDENTIALS_FLAG_BSSID) { + memcpy(bssid_buf, header->bssid, WIFI_MAC_ADDR_LEN); + } + + switch (header->type) { + case WIFI_SECURITY_TYPE_NONE: + break; + case WIFI_SECURITY_TYPE_PSK: + case WIFI_SECURITY_TYPE_PSK_SHA256: + case WIFI_SECURITY_TYPE_WPA_PSK: + case WIFI_SECURITY_TYPE_SAE: { + struct wifi_credentials_personal *header_personal = + (struct wifi_credentials_personal *)buf; + + memcpy(password_buf, header_personal->password, header_personal->password_len); + *password_len = header_personal->password_len; + break; + } + default: + LOG_ERR("Cannot get WiFi credentials, " + "the requested credentials have invalid WIFI_SECURITY_TYPE"); + ret = -EPROTO; + } + return ret; +} + +int wifi_credentials_delete_by_ssid(const char *ssid, size_t ssid_len) +{ + int ret = 0; + + if (ssid == NULL || ssid_len > WIFI_SSID_MAX_LEN || ssid_len == 0) { + LOG_ERR("Cannot delete WiFi credentials, SSID has invalid format"); + return -EINVAL; + } + + k_mutex_lock(&wifi_credentials_mutex, K_FOREVER); + ssize_t idx = lookup_idx(ssid, ssid_len); + + if (idx == -1) { + LOG_DBG("WiFi credentials entry was not found"); + goto exit; + } + + ret = wifi_credentials_delete_entry(idx); + + if (ret) { + LOG_ERR("Failed to delete WiFi credentials index %d, err: %d", idx, ret); + goto exit; + } + + wifi_credentials_uncache_ssid(idx); + +exit: + k_mutex_unlock(&wifi_credentials_mutex); + return ret; +} + +void wifi_credentials_for_each_ssid(wifi_credentials_ssid_cb cb, void *cb_arg) +{ + k_mutex_lock(&wifi_credentials_mutex, K_FOREVER); + + for (size_t i = 0; i < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES; ++i) { + if (is_entry_used(i)) { + cb(cb_arg, ssid_cache[i], ssid_cache_lengths[i]); + } + } + + k_mutex_unlock(&wifi_credentials_mutex); +} + +bool wifi_credentials_is_empty(void) +{ + k_mutex_lock(&wifi_credentials_mutex, K_FOREVER); + + for (size_t i = 0; i < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES; ++i) { + if (is_entry_used(i)) { + k_mutex_unlock(&wifi_credentials_mutex); + return false; + } + } + + k_mutex_unlock(&wifi_credentials_mutex); + return true; +} + +int wifi_credentials_delete_all(void) +{ + int ret = 0; + + k_mutex_lock(&wifi_credentials_mutex, K_FOREVER); + for (size_t i = 0; i < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES; ++i) { + if (is_entry_used(i)) { + ret = wifi_credentials_delete_entry(i); + if (ret) { + LOG_ERR("Failed to delete WiFi credentials index %d, err: %d", i, + ret); + break; + } + + wifi_credentials_uncache_ssid(i); + } + } + + k_mutex_unlock(&wifi_credentials_mutex); + return ret; +} + +SYS_INIT(init, POST_KERNEL, CONFIG_APPLICATION_INIT_PRIORITY); diff --git a/subsys/net/lib/wifi_credentials/wifi_credentials_backend_none.c b/subsys/net/lib/wifi_credentials/wifi_credentials_backend_none.c new file mode 100644 index 0000000000000..6146b8d286859 --- /dev/null +++ b/subsys/net/lib/wifi_credentials/wifi_credentials_backend_none.c @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include "wifi_credentials_internal.h" + +int wifi_credentials_store_entry(size_t idx, const void *buf, size_t buf_len) +{ + ARG_UNUSED(idx); + ARG_UNUSED(buf); + ARG_UNUSED(buf_len); + + return 0; +} + +int wifi_credentials_delete_entry(size_t idx) +{ + ARG_UNUSED(idx); + + return 0; +} + +int wifi_credentials_load_entry(size_t idx, void *buf, size_t buf_len) +{ + ARG_UNUSED(idx); + ARG_UNUSED(buf); + ARG_UNUSED(buf_len); + + return 0; +} + +int wifi_credentials_backend_init(void) +{ + return 0; +} diff --git a/subsys/net/lib/wifi_credentials/wifi_credentials_backend_psa.c b/subsys/net/lib/wifi_credentials/wifi_credentials_backend_psa.c new file mode 100644 index 0000000000000..bf82ee725775b --- /dev/null +++ b/subsys/net/lib/wifi_credentials/wifi_credentials_backend_psa.c @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include "psa/crypto.h" + +#include "wifi_credentials_internal.h" + +LOG_MODULE_REGISTER(wifi_credentials_backend, CONFIG_WIFI_CREDENTIALS_LOG_LEVEL); + +#define WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN \ + (PSA_KEY_ID_USER_MIN + CONFIG_WIFI_CREDENTIALS_BACKEND_PSA_OFFSET) + +BUILD_ASSERT((WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN + CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES) <= + PSA_KEY_ID_USER_MAX, + "WIFI credentials management PSA key id range exceeds PSA_KEY_ID_USER_MAX."); + +int wifi_credentials_backend_init(void) +{ + psa_status_t ret; + uint8_t buf[ENTRY_MAX_LEN]; + + for (size_t i = 0; i < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES; ++i) { + size_t length_read = 0; + size_t key_id = i + WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN; + + ret = psa_export_key(key_id, buf, ARRAY_SIZE(buf), &length_read); + if (ret == PSA_SUCCESS && length_read == ENTRY_MAX_LEN) { + wifi_credentials_cache_ssid(i, (struct wifi_credentials_header *)buf); + } else if (ret != PSA_ERROR_INVALID_HANDLE) { + LOG_ERR("psa_export_key failed, err: %d", ret); + return -EFAULT; + } + } + + return 0; +} + +int wifi_credentials_store_entry(size_t idx, const void *buf, size_t buf_len) +{ + psa_status_t ret; + psa_key_attributes_t key_attributes = {0}; + psa_key_id_t key_id; + + psa_set_key_id(&key_attributes, idx + WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN); + psa_set_key_usage_flags(&key_attributes, PSA_KEY_USAGE_EXPORT); + psa_set_key_lifetime(&key_attributes, PSA_KEY_LIFETIME_PERSISTENT); + psa_set_key_algorithm(&key_attributes, PSA_ALG_NONE); + psa_set_key_type(&key_attributes, PSA_KEY_TYPE_RAW_DATA); + psa_set_key_bits(&key_attributes, buf_len * 8); + + ret = psa_import_key(&key_attributes, buf, buf_len, &key_id); + if (ret == PSA_ERROR_ALREADY_EXISTS) { + LOG_ERR("psa_import_key failed, duplicate key: %d", ret); + return -EEXIST; + } else if (ret != PSA_SUCCESS) { + LOG_ERR("psa_import_key failed, err: %d", ret); + return -EFAULT; + } + + return 0; +} + +int wifi_credentials_delete_entry(size_t idx) +{ + psa_status_t ret = psa_destroy_key(idx + WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN); + + if (ret != PSA_SUCCESS) { + LOG_ERR("psa_destroy_key failed, err: %d", ret); + return -EFAULT; + } + + return 0; +} + +int wifi_credentials_load_entry(size_t idx, void *buf, size_t buf_len) +{ + size_t length_read = 0; + size_t key_id = idx + WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN; + psa_status_t ret; + + ret = psa_export_key(key_id, buf, buf_len, &length_read); + if (ret != PSA_SUCCESS) { + LOG_ERR("psa_export_key failed, err: %d", ret); + return -EFAULT; + } + + if (buf_len != length_read) { + return -EIO; + } + + return 0; +} diff --git a/subsys/net/lib/wifi_credentials/wifi_credentials_backend_settings.c b/subsys/net/lib/wifi_credentials/wifi_credentials_backend_settings.c new file mode 100644 index 0000000000000..f8b3b6bdf7a4d --- /dev/null +++ b/subsys/net/lib/wifi_credentials/wifi_credentials_backend_settings.c @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +#include "wifi_credentials_internal.h" + +LOG_MODULE_REGISTER(wifi_credentials_backend, CONFIG_WIFI_CREDENTIALS_LOG_LEVEL); + +BUILD_ASSERT(ENTRY_MAX_LEN <= SETTINGS_MAX_VAL_LEN); + +#define WIFI_CREDENTIALS_SBE_BASE_KEY "wifi_cred" +#define WIFI_CREDENTIALS_SBE_KEY_SIZE \ + sizeof(WIFI_CREDENTIALS_SBE_BASE_KEY "/" STRINGIFY(CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES)) +#define WIFI_CREDENTIALS_SBE_KEY_FMT WIFI_CREDENTIALS_SBE_BASE_KEY "/%d" + +/* Type of the callback argument used in the function below. */ +struct zephyr_settings_backend_load_cb_arg { + uint8_t *buf; + size_t buf_len; + size_t idx; + bool found; +}; + +/* This callback function is used to retrieve credentials on demand. */ +static int zephyr_settings_backend_load_val_cb(const char *key, size_t len, + settings_read_cb read_cb, void *cb_arg, void *param) +{ + struct zephyr_settings_backend_load_cb_arg *arg = param; + int idx = atoi(key); + + if (arg->idx != idx) { + LOG_DBG("Skipping index [%s]", key); + return 0; + } + + if (len != arg->buf_len) { + LOG_ERR("Settings error: invalid settings length"); + return -EINVAL; + } + + size_t length_read = read_cb(cb_arg, arg->buf, arg->buf_len); + + /* value validation */ + if (length_read < len) { + LOG_ERR("Settings error: entry incomplete"); + return -ENODATA; + } + + arg->found = true; + + return 0; +} + +/* This callback function is used to initialize the SSID cache. */ +static int zephyr_settings_backend_load_key_cb(const char *key, size_t len, + settings_read_cb read_cb, void *cb_arg, void *param) +{ + ARG_UNUSED(param); + + /* key validation */ + if (!key) { + LOG_ERR("Settings error: no key"); + return -EINVAL; + } + + int idx = atoi(key); + + if ((idx == 0 && strcmp(key, "0") != 0) || idx >= CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES) { + LOG_ERR("Settings error: index too large"); + return -EINVAL; + } + + if (len < sizeof(struct wifi_credentials_header)) { + LOG_ERR("Settings error: invalid settings length"); + return -EINVAL; + } + + uint8_t buf[ENTRY_MAX_LEN]; + size_t length_read = read_cb(cb_arg, buf, ARRAY_SIZE(buf)); + + /* value validation */ + if (length_read < len) { + LOG_ERR("Settings error: entry incomplete"); + return -ENODATA; + } + + wifi_credentials_cache_ssid(idx, (struct wifi_credentials_header *)buf); + return 0; +} + +int wifi_credentials_backend_init(void) +{ + int ret = settings_subsys_init(); + + if (ret) { + LOG_ERR("Initializing settings subsystem failed: %d", ret); + return ret; + } + + ret = settings_load_subtree_direct(WIFI_CREDENTIALS_SBE_BASE_KEY, + zephyr_settings_backend_load_key_cb, NULL); + + return ret; +} + +int wifi_credentials_store_entry(size_t idx, const void *buf, size_t buf_len) +{ + char settings_name_buf[WIFI_CREDENTIALS_SBE_KEY_SIZE] = {0}; + + int ret = snprintk(settings_name_buf, ARRAY_SIZE(settings_name_buf), + WIFI_CREDENTIALS_SBE_KEY_FMT, idx); + + if (ret < 0 || ret == ARRAY_SIZE(settings_name_buf)) { + LOG_ERR("WiFi credentials settings key could not be generated, idx: %d", idx); + return -EFAULT; + } + + return settings_save_one(settings_name_buf, buf, buf_len); +} + +int wifi_credentials_delete_entry(size_t idx) +{ + char settings_name_buf[WIFI_CREDENTIALS_SBE_KEY_SIZE] = {0}; + + int ret = snprintk(settings_name_buf, ARRAY_SIZE(settings_name_buf), + WIFI_CREDENTIALS_SBE_KEY_FMT, idx); + + if (ret < 0 || ret == ARRAY_SIZE(settings_name_buf)) { + LOG_ERR("WiFi credentials settings key could not be generated, idx: %d", idx); + return -EFAULT; + } + + return settings_delete(settings_name_buf); +} + +int wifi_credentials_load_entry(size_t idx, void *buf, size_t buf_len) +{ + struct zephyr_settings_backend_load_cb_arg arg = { + .buf = buf, + .buf_len = buf_len, + .idx = idx, + .found = false, + }; + int ret; + + /* Browse through the settings entries with custom callback to load the whole entry. */ + ret = settings_load_subtree_direct(WIFI_CREDENTIALS_SBE_BASE_KEY, + zephyr_settings_backend_load_val_cb, &arg); + + if (ret) { + return ret; + } + + if (!arg.found) { + return -ENOENT; + } + + return 0; +} diff --git a/subsys/net/lib/wifi_credentials/wifi_credentials_internal.h b/subsys/net/lib/wifi_credentials/wifi_credentials_internal.h new file mode 100644 index 0000000000000..42f2d0201519c --- /dev/null +++ b/subsys/net/lib/wifi_credentials/wifi_credentials_internal.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#define ENTRY_MAX_LEN sizeof(struct wifi_credentials_personal) + +/** + * @brief Write entry to SSID cache. + * + * @param idx credential index + * @param buf encoded settings entry + * @param buf_len length of buf + */ +void wifi_credentials_cache_ssid(size_t idx, const struct wifi_credentials_header *buf); + +/** + * @brief Clear entry in SSID cache. + * + * @param idx credential index + */ +void wifi_credentials_uncache_ssid(size_t idx); + +/** + * @brief Stores settings entry in flash. + * + * @param idx credential index + * @param buf encoded settings entry + * @param buf_len length of buf + * @return 0 on success, otherwise a negative error code + */ +int wifi_credentials_store_entry(size_t idx, const void *buf, size_t buf_len); + +/** + * @brief Deletes settings entry from flash. + * + * @param idx credential index + * @return 0 on success, otherwise a negative error code + */ +int wifi_credentials_delete_entry(size_t idx); + +/** + * @brief Loads settings entry from flash. + * + * @param idx credential index + * @param buf encoded settings entry + * @param buf_len length of buf + * @return 0 on success, otherwise a negative error code + */ +int wifi_credentials_load_entry(size_t idx, void *buf, size_t buf_len); + +/** + * @brief Initialize backend. + * @note Is called by the library on system startup. + * + */ +int wifi_credentials_backend_init(void); diff --git a/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c b/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c new file mode 100644 index 0000000000000..e1a3b6ab7ea21 --- /dev/null +++ b/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c @@ -0,0 +1,313 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#undef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 200809L /* For strnlen() */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#define MACSTR "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx" + +static void print_network_info(void *cb_arg, const char *ssid, size_t ssid_len) +{ + int ret = 0; + struct wifi_credentials_personal creds = {0}; + const struct shell *sh = (const struct shell *)cb_arg; + + ret = wifi_credentials_get_by_ssid_personal_struct(ssid, ssid_len, &creds); + if (ret) { + shell_error(sh, + "An error occurred when trying to load credentials for network \"%.*s\"" + ". err: %d", + ssid_len, ssid, ret); + return; + } + + shell_fprintf(sh, SHELL_VT100_COLOR_DEFAULT, + " network ssid: \"%.*s\", ssid_len: %d, type: %s", ssid_len, ssid, ssid_len, + wifi_security_txt(creds.header.type)); + + if (creds.header.type == WIFI_SECURITY_TYPE_PSK || + creds.header.type == WIFI_SECURITY_TYPE_PSK_SHA256 || + creds.header.type == WIFI_SECURITY_TYPE_SAE || + creds.header.type == WIFI_SECURITY_TYPE_WPA_PSK) { + shell_fprintf(sh, SHELL_VT100_COLOR_DEFAULT, + ", password: \"%.*s\", password_len: %d", creds.password_len, + creds.password, creds.password_len); + } + + if (creds.header.flags & WIFI_CREDENTIALS_FLAG_BSSID) { + shell_fprintf(sh, SHELL_VT100_COLOR_DEFAULT, ", bssid: " MACSTR, + creds.header.bssid[0], creds.header.bssid[1], creds.header.bssid[2], + creds.header.bssid[3], creds.header.bssid[4], creds.header.bssid[5]); + } + + if (creds.header.flags & WIFI_CREDENTIALS_FLAG_2_4GHz) { + shell_fprintf(sh, SHELL_VT100_COLOR_DEFAULT, ", band: 2.4GHz"); + } + + if (creds.header.flags & WIFI_CREDENTIALS_FLAG_5GHz) { + shell_fprintf(sh, SHELL_VT100_COLOR_DEFAULT, ", band: 5GHz"); + } + + if (creds.header.channel) { + shell_fprintf(sh, SHELL_VT100_COLOR_DEFAULT, ", channel: %d", + creds.header.channel); + } + + if (creds.header.flags & WIFI_CREDENTIALS_FLAG_FAVORITE) { + shell_fprintf(sh, SHELL_VT100_COLOR_DEFAULT, ", favorite"); + } + + if (creds.header.flags & WIFI_CREDENTIALS_FLAG_MFP_REQUIRED) { + shell_fprintf(sh, SHELL_VT100_COLOR_DEFAULT, ", MFP_REQUIRED"); + } else if (creds.header.flags & WIFI_CREDENTIALS_FLAG_MFP_DISABLED) { + shell_fprintf(sh, SHELL_VT100_COLOR_DEFAULT, ", MFP_DISABLED"); + } else { + shell_fprintf(sh, SHELL_VT100_COLOR_DEFAULT, ", MFP_OPTIONAL"); + } + + if (creds.header.timeout) { + shell_fprintf(sh, SHELL_VT100_COLOR_DEFAULT, ", timeout: %d", + creds.header.timeout); + } + + shell_fprintf(sh, SHELL_VT100_COLOR_DEFAULT, "\n"); +} + +static enum wifi_security_type parse_sec_type(const char *s) +{ + if (strcmp("OPEN", s) == 0) { + return WIFI_SECURITY_TYPE_NONE; + } + + if (strcmp("WPA2-PSK", s) == 0) { + return WIFI_SECURITY_TYPE_PSK; + } + + if (strcmp("WPA2-PSK-SHA256", s) == 0) { + return WIFI_SECURITY_TYPE_PSK_SHA256; + } + + if (strcmp("WPA3-SAE", s) == 0) { + return WIFI_SECURITY_TYPE_SAE; + } + + if (strcmp("WPA-PSK", s) == 0) { + return WIFI_SECURITY_TYPE_WPA_PSK; + } + + return WIFI_SECURITY_TYPE_UNKNOWN; +} + +static enum wifi_frequency_bands parse_band(const char *s) +{ + if (strcmp("2.4GHz", s) == 0) { + return WIFI_FREQ_BAND_2_4_GHZ; + } + + if (strcmp("5GHz", s) == 0) { + return WIFI_FREQ_BAND_5_GHZ; + } + + if (strcmp("6GHz", s) == 0) { + return WIFI_FREQ_BAND_6_GHZ; + } + + return WIFI_FREQ_BAND_UNKNOWN; +} + +static int cmd_add_network(const struct shell *sh, size_t argc, char *argv[]) +{ + int ret; + + if (argc < 3) { + goto help; + } + + if (strnlen(argv[1], WIFI_SSID_MAX_LEN + 1) > WIFI_SSID_MAX_LEN) { + shell_error(sh, "SSID too long"); + goto help; + } + + struct wifi_credentials_personal creds = { + .header.ssid_len = strlen(argv[1]), + .header.type = parse_sec_type(argv[2]), + }; + + memcpy(creds.header.ssid, argv[1], creds.header.ssid_len); + + if (creds.header.type == WIFI_SECURITY_TYPE_UNKNOWN) { + shell_error(sh, "Cannot parse security type"); + goto help; + } + + size_t arg_idx = 3; + + if (creds.header.type == WIFI_SECURITY_TYPE_PSK || + creds.header.type == WIFI_SECURITY_TYPE_PSK_SHA256 || + creds.header.type == WIFI_SECURITY_TYPE_SAE || + creds.header.type == WIFI_SECURITY_TYPE_WPA_PSK) { + /* parse passphrase */ + if (argc < 4) { + shell_error(sh, "Missing password"); + goto help; + } + creds.password_len = strlen(argv[3]); + if (creds.password_len < WIFI_PSK_MIN_LEN) { + shell_error(sh, "Passphrase should be minimum %d characters", + WIFI_PSK_MIN_LEN); + goto help; + } + if ((creds.password_len > CONFIG_WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH && + creds.header.type == WIFI_SECURITY_TYPE_SAE) || + (creds.password_len > WIFI_PSK_MAX_LEN && + creds.header.type != WIFI_SECURITY_TYPE_SAE)) { + shell_error(sh, "Password is too long for this security type"); + goto help; + } + memcpy(creds.password, argv[3], creds.password_len); + ++arg_idx; + } + + if (arg_idx < argc) { + /* look for bssid */ + ret = sscanf(argv[arg_idx], MACSTR, &creds.header.bssid[0], &creds.header.bssid[1], + &creds.header.bssid[2], &creds.header.bssid[3], &creds.header.bssid[4], + &creds.header.bssid[5]); + if (ret == 6) { + creds.header.flags |= WIFI_CREDENTIALS_FLAG_BSSID; + ++arg_idx; + } + } + + if (arg_idx < argc) { + /* look for band */ + enum wifi_frequency_bands band = parse_band(argv[arg_idx]); + + if (band == WIFI_FREQ_BAND_2_4_GHZ) { + creds.header.flags |= WIFI_CREDENTIALS_FLAG_2_4GHz; + ++arg_idx; + } + if (band == WIFI_FREQ_BAND_5_GHZ) { + creds.header.flags |= WIFI_CREDENTIALS_FLAG_5GHz; + ++arg_idx; + } + } + + if (arg_idx < argc) { + /* look for channel */ + char *end; + + creds.header.channel = strtol(argv[arg_idx], &end, 10); + if (*end == '\0') { + ++arg_idx; + } + } + + if (arg_idx < argc) { + /* look for favorite flag */ + if (strncmp("favorite", argv[arg_idx], strlen("favorite")) == 0) { + creds.header.flags |= WIFI_CREDENTIALS_FLAG_FAVORITE; + ++arg_idx; + } + } + + if (arg_idx < argc) { + /* look for mfp_disabled flag */ + if (strncmp("mfp_disabled", argv[arg_idx], strlen("mfp_disabled")) == 0) { + creds.header.flags |= WIFI_CREDENTIALS_FLAG_MFP_DISABLED; + ++arg_idx; + } else if (strncmp("mfp_required", argv[arg_idx], strlen("mfp_required")) == 0) { + creds.header.flags |= WIFI_CREDENTIALS_FLAG_MFP_REQUIRED; + ++arg_idx; + } + } + + if (arg_idx < argc) { + /* look for timeout */ + char *end; + + creds.header.timeout = strtol(argv[arg_idx], &end, 10); + if (*end == '\0') { + ++arg_idx; + } + } + + if (arg_idx != argc) { + for (size_t i = arg_idx; i < argc; ++i) { + shell_warn(sh, "Unparsed arg: [%s]", argv[i]); + } + } + + return wifi_credentials_set_personal_struct(&creds); +help: + shell_print(sh, "Usage: wifi_cred add \"network name\"" + " {OPEN, WPA2-PSK, WPA2-PSK-SHA256, WPA3-SAE, WPA-PSK}" + " [psk/password]" + " [bssid]" + " [{2.4GHz, 5GHz}]" + " [channel]" + " [favorite]" + " [mfp_disabled|mfp_required]" + " [timeout]"); + return -EINVAL; +} + +static int cmd_delete_network(const struct shell *sh, size_t argc, char *argv[]) +{ + if (argc != 2) { + shell_print(sh, "Usage: wifi_cred delete \"network name\""); + return -EINVAL; + } + + if (strnlen(argv[1], WIFI_SSID_MAX_LEN + 1) > WIFI_SSID_MAX_LEN) { + shell_error(sh, "SSID too long"); + return -EINVAL; + } + + shell_print(sh, "\tDeleting network ssid: \"%s\", ssid_len: %d", argv[1], + strlen(argv[1])); + return wifi_credentials_delete_by_ssid(argv[1], strlen(argv[1])); +} + +static int cmd_list_networks(const struct shell *sh, size_t argc, char *argv[]) +{ + wifi_credentials_for_each_ssid(print_network_info, (void *)sh); + return 0; +} + +SHELL_STATIC_SUBCMD_SET_CREATE(sub_wifi_cred, + SHELL_CMD_ARG(add, NULL, + "Add network to storage.\n", + cmd_add_network, 0, 0), + SHELL_CMD_ARG(delete, NULL, + "Delete network from storage.\n", + cmd_delete_network, + 0, 0), + SHELL_CMD_ARG(list, NULL, + "List stored networks.\n", + cmd_list_networks, + 0, 0), + SHELL_SUBCMD_SET_END +); + +SHELL_SUBCMD_ADD((wifi), cred, &sub_wifi_cred, + "Wifi credentials management.\n", + NULL, + 0, 0); From e7ce0f5dab66fe8588673ce75f3f36a3fdf72c35 Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Thu, 5 Sep 2024 15:12:47 +0200 Subject: [PATCH 1254/4482] net: lib: wifi_credentials: add connect-stored feature This patch adds a feature to directly connect to stored Wi-Fi credentials without having to compose the NET_MGMT commands yourself. Signed-off-by: Maximilian Deubel --- include/zephyr/net/wifi_mgmt.h | 12 +- subsys/net/l2/wifi/wifi_mgmt.c | 240 +++++++++++++++++- subsys/net/lib/wifi_credentials/Kconfig | 14 + .../wifi_credentials/wifi_credentials_shell.c | 51 +++- 4 files changed, 301 insertions(+), 16 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index c67cab30a0e0e..ddfdfa05309fd 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -1,6 +1,7 @@ /* * Copyright (c) 2017 Intel Corporation. * Copyright 2024 NXP + * Copyright (c) 2024 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ @@ -108,9 +109,13 @@ enum net_request_wifi_cmd { NET_REQUEST_WIFI_CMD_RTS_THRESHOLD_CONFIG, /** WPS config */ NET_REQUEST_WIFI_CMD_WPS_CONFIG, +#ifdef CONFIG_WIFI_CREDENTIALS_CONNECT_STORED + /** Connect to APs stored using wifi_credentials library. */ + NET_REQUEST_WIFI_CMD_CONNECT_STORED, +#endif /** @cond INTERNAL_HIDDEN */ NET_REQUEST_WIFI_CMD_MAX -/** @endcond */ + /** @endcond */ }; /** Request a Wi-Fi scan */ @@ -257,6 +262,11 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_RTS_THRESHOLD_CONFIG); #define NET_REQUEST_WIFI_WPS_CONFIG (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_WPS_CONFIG) NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_WPS_CONFIG); +#ifdef CONFIG_WIFI_CREDENTIALS_CONNECT_STORED +#define NET_REQUEST_WIFI_CONNECT_STORED (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_CONNECT_STORED) + +NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_CONNECT_STORED); +#endif /** @brief Wi-Fi management events */ enum net_event_wifi_cmd { diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 5974cde6a1a2c..a1a84f9dcbbf2 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -5,12 +5,15 @@ * SPDX-License-Identifier: Apache-2.0 */ +#undef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 200809L /* For strnlen() */ + #include LOG_MODULE_REGISTER(net_wifi_mgmt, CONFIG_NET_L2_WIFI_MGMT_LOG_LEVEL); #include #include - +#include #include #include #include @@ -1009,3 +1012,238 @@ void wifi_mgmt_raise_ap_sta_disconnected_event(struct net_if *iface, iface, sta_info, sizeof(struct wifi_ap_sta_info)); } + +#ifdef CONFIG_WIFI_CREDENTIALS_CONNECT_STORED + +#include + +#if defined(CONFIG_WIFI_CREDENTIALS_STATIC) +BUILD_ASSERT(sizeof(CONFIG_WIFI_CREDENTIALS_STATIC_SSID) != 1, + "CONFIG_WIFI_CREDENTIALS_STATIC_SSID required"); +#endif /* defined(CONFIG_WIFI_CREDENTIALS_STATIC) */ + +static int __stored_creds_to_params(struct wifi_credentials_personal *creds, + struct wifi_connect_req_params *params) +{ + char *ssid = NULL; + char *psk = NULL; + int ret; + + /* SSID */ + ssid = (char *)k_malloc(creds->header.ssid_len + 1); + if (!ssid) { + LOG_ERR("Failed to allocate memory for SSID\n"); + ret = -ENOMEM; + goto err_out; + } + + memset(ssid, 0, creds->header.ssid_len + 1); + ret = snprintf(ssid, creds->header.ssid_len + 1, "%s", creds->header.ssid); + if (ret > creds->header.ssid_len) { + LOG_ERR("SSID string truncated\n"); + ret = -EINVAL; + goto err_out; + } + + params->ssid = ssid; + params->ssid_length = creds->header.ssid_len; + + /* PSK (optional) */ + if (creds->password_len > 0) { + psk = (char *)k_malloc(creds->password_len + 1); + if (!psk) { + LOG_ERR("Failed to allocate memory for PSK\n"); + ret = -ENOMEM; + goto err_out; + } + + memset(psk, 0, creds->password_len + 1); + ret = snprintf(psk, creds->password_len + 1, "%s", creds->password); + if (ret > creds->password_len) { + LOG_ERR("PSK string truncated\n"); + ret = -EINVAL; + goto err_out; + } + + params->psk = psk; + params->psk_length = creds->password_len; + } + + /* Defaults */ + params->security = creds->header.type; + + /* If channel is set to 0 we default to ANY. 0 is not a valid Wi-Fi channel. */ + params->channel = (creds->header.channel != 0) ? creds->header.channel : WIFI_CHANNEL_ANY; + params->timeout = (creds->header.timeout != 0) + ? creds->header.timeout + : CONFIG_WIFI_CREDENTIALS_CONNECT_STORED_CONNECTION_TIMEOUT; + + /* Security type (optional) */ + if (creds->header.type > WIFI_SECURITY_TYPE_MAX) { + params->security = WIFI_SECURITY_TYPE_NONE; + } + + if (creds->header.flags & WIFI_CREDENTIALS_FLAG_2_4GHz) { + params->band = WIFI_FREQ_BAND_2_4_GHZ; + } else if (creds->header.flags & WIFI_CREDENTIALS_FLAG_5GHz) { + params->band = WIFI_FREQ_BAND_5_GHZ; + } else { + params->band = WIFI_FREQ_BAND_UNKNOWN; + } + + /* MFP setting (default: optional) */ + if (creds->header.flags & WIFI_CREDENTIALS_FLAG_MFP_DISABLED) { + params->mfp = WIFI_MFP_DISABLE; + } else if (creds->header.flags & WIFI_CREDENTIALS_FLAG_MFP_REQUIRED) { + params->mfp = WIFI_MFP_REQUIRED; + } else { + params->mfp = WIFI_MFP_OPTIONAL; + } + + return 0; +err_out: + if (ssid) { + k_free(ssid); + ssid = NULL; + } + + if (psk) { + k_free(psk); + psk = NULL; + } + + return ret; +} + +static inline const char *wpa_supp_security_txt(enum wifi_security_type security) +{ + switch (security) { + case WIFI_SECURITY_TYPE_NONE: + return "NONE"; + case WIFI_SECURITY_TYPE_PSK: + return "WPA-PSK"; + case WIFI_SECURITY_TYPE_PSK_SHA256: + return "WPA-PSK-SHA256"; + case WIFI_SECURITY_TYPE_SAE: + return "SAE"; + case WIFI_SECURITY_TYPE_UNKNOWN: + default: + return "UNKNOWN"; + } +} + +static int add_network_from_credentials_struct_personal(struct wifi_credentials_personal *creds, + struct net_if *iface) +{ + int ret = 0; + struct wifi_connect_req_params cnx_params = {0}; + + if (__stored_creds_to_params(creds, &cnx_params)) { + ret = -ENOEXEC; + goto out; + } + + if (net_mgmt(NET_REQUEST_WIFI_CONNECT, iface, &cnx_params, + sizeof(struct wifi_connect_req_params))) { + LOG_ERR("Connection request failed\n"); + + return -ENOEXEC; + } + + LOG_INF("Connection requested"); + +out: + if (cnx_params.psk) { + k_free((void *)cnx_params.psk); + } + + if (cnx_params.ssid) { + k_free((void *)cnx_params.ssid); + } + + return ret; +} + +static void add_stored_network(void *cb_arg, const char *ssid, size_t ssid_len) +{ + int ret = 0; + struct wifi_credentials_personal creds; + + /* load stored data */ + ret = wifi_credentials_get_by_ssid_personal_struct(ssid, ssid_len, &creds); + + if (ret) { + LOG_ERR("Loading WiFi credentials failed for SSID [%.*s], len: %d, err: %d", + ssid_len, ssid, ssid_len, ret); + return; + } + + add_network_from_credentials_struct_personal(&creds, (struct net_if *)cb_arg); +} + +static int add_static_network_config(struct net_if *iface) +{ +#if defined(CONFIG_WIFI_CREDENTIALS_STATIC) + + struct wifi_credentials_personal creds = { + .header = { + .ssid_len = strlen(CONFIG_WIFI_CREDENTIALS_STATIC_SSID), + }, + .password_len = strlen(CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD), + }; + + int ret = wifi_credentials_get_by_ssid_personal_struct( + CONFIG_WIFI_CREDENTIALS_STATIC_SSID, strlen(CONFIG_WIFI_CREDENTIALS_STATIC_SSID), + &creds); + + if (!ret) { + LOG_WRN("Statically configured WiFi network was overridden by storage."); + return 0; + } + +#if defined(CONFIG_WIFI_CREDENTIALS_STATIC_TYPE_OPEN) + creds.header.type = WIFI_SECURITY_TYPE_NONE; +#elif defined(CONFIG_WIFI_CREDENTIALS_STATIC_TYPE_PSK) + creds.header.type = WIFI_SECURITY_TYPE_PSK; +#elif defined(CONFIG_WIFI_CREDENTIALS_STATIC_TYPE_PSK_SHA256) + creds.header.type = WIFI_SECURITY_TYPE_PSK_SHA256; +#elif defined(CONFIG_WIFI_CREDENTIALS_STATIC_TYPE_SAE) + creds.header.type = WIFI_SECURITY_TYPE_SAE; +#elif defined(CONFIG_WIFI_CREDENTIALS_STATIC_TYPE_WPA_PSK) + creds.header.type = WIFI_SECURITY_TYPE_WPA_PSK; +#else +#error "invalid CONFIG_WIFI_CREDENTIALS_STATIC_TYPE" +#endif + + memcpy(creds.header.ssid, CONFIG_WIFI_CREDENTIALS_STATIC_SSID, + strlen(CONFIG_WIFI_CREDENTIALS_STATIC_SSID)); + memcpy(creds.password, CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD, + strlen(CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD)); + + LOG_DBG("Adding statically configured WiFi network [%s] to internal list.", + creds.header.ssid); + + return add_network_from_credentials_struct_personal(&creds, iface); +#else + return 0; +#endif /* defined(CONFIG_WIFI_CREDENTIALS_STATIC) */ +} + +static int connect_stored_command(uint32_t mgmt_request, struct net_if *iface, void *data, + size_t len) +{ + int ret = 0; + + ret = add_static_network_config(iface); + if (ret) { + return ret; + } + + wifi_credentials_for_each_ssid(add_stored_network, iface); + + return ret; +}; + +NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_CONNECT_STORED, connect_stored_command); + +#endif /* CONFIG_WIFI_CREDENTIALS_CONNECT_STORED */ diff --git a/subsys/net/lib/wifi_credentials/Kconfig b/subsys/net/lib/wifi_credentials/Kconfig index 452392a82ce33..3cfe87c29f28a 100644 --- a/subsys/net/lib/wifi_credentials/Kconfig +++ b/subsys/net/lib/wifi_credentials/Kconfig @@ -59,6 +59,20 @@ config WIFI_CREDENTIALS_SHELL depends on SHELL depends on !WIFI_CREDENTIALS_BACKEND_NONE +config WIFI_CREDENTIALS_CONNECT_STORED + bool "Add command to connect to stored networks directly." + default y + +if WIFI_CREDENTIALS_CONNECT_STORED + +config WIFI_CREDENTIALS_CONNECT_STORED_CONNECTION_TIMEOUT + int "Connection timeout" + default 30 + help + Wait period before falling back to the next entry in the list of stored SSIDs. + +endif # WIFI_CREDENTIALS_CONNECT_STORED + endif # WIFI_CREDENTIALS if WIFI_CREDENTIALS_BACKEND_PSA diff --git a/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c b/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c index e1a3b6ab7ea21..33731315f368d 100644 --- a/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c +++ b/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c @@ -66,8 +66,7 @@ static void print_network_info(void *cb_arg, const char *ssid, size_t ssid_len) } if (creds.header.channel) { - shell_fprintf(sh, SHELL_VT100_COLOR_DEFAULT, ", channel: %d", - creds.header.channel); + shell_fprintf(sh, SHELL_VT100_COLOR_DEFAULT, ", channel: %d", creds.header.channel); } if (creds.header.flags & WIFI_CREDENTIALS_FLAG_FAVORITE) { @@ -83,8 +82,7 @@ static void print_network_info(void *cb_arg, const char *ssid, size_t ssid_len) } if (creds.header.timeout) { - shell_fprintf(sh, SHELL_VT100_COLOR_DEFAULT, ", timeout: %d", - creds.header.timeout); + shell_fprintf(sh, SHELL_VT100_COLOR_DEFAULT, ", timeout: %d", creds.header.timeout); } shell_fprintf(sh, SHELL_VT100_COLOR_DEFAULT, "\n"); @@ -258,14 +256,14 @@ static int cmd_add_network(const struct shell *sh, size_t argc, char *argv[]) return wifi_credentials_set_personal_struct(&creds); help: shell_print(sh, "Usage: wifi_cred add \"network name\"" - " {OPEN, WPA2-PSK, WPA2-PSK-SHA256, WPA3-SAE, WPA-PSK}" - " [psk/password]" - " [bssid]" - " [{2.4GHz, 5GHz}]" - " [channel]" - " [favorite]" - " [mfp_disabled|mfp_required]" - " [timeout]"); + " {OPEN, WPA2-PSK, WPA2-PSK-SHA256, WPA3-SAE, WPA-PSK}" + " [psk/password]" + " [bssid]" + " [{2.4GHz, 5GHz}]" + " [channel]" + " [favorite]" + " [mfp_disabled|mfp_required]" + " [timeout]"); return -EINVAL; } @@ -281,8 +279,7 @@ static int cmd_delete_network(const struct shell *sh, size_t argc, char *argv[]) return -EINVAL; } - shell_print(sh, "\tDeleting network ssid: \"%s\", ssid_len: %d", argv[1], - strlen(argv[1])); + shell_print(sh, "\tDeleting network ssid: \"%s\", ssid_len: %d", argv[1], strlen(argv[1])); return wifi_credentials_delete_by_ssid(argv[1], strlen(argv[1])); } @@ -292,6 +289,24 @@ static int cmd_list_networks(const struct shell *sh, size_t argc, char *argv[]) return 0; } +#if CONFIG_WIFI_CREDENTIALS_CONNECT_STORED + +static int cmd_auto_connect(const struct shell *sh, size_t argc, char *argv[]) +{ + struct net_if *iface = net_if_get_first_by_type(&NET_L2_GET_NAME(ETHERNET)); + int rc = net_mgmt(NET_REQUEST_WIFI_CONNECT_STORED, iface, NULL, 0); + + if (rc) { + shell_error(sh, + "An error occurred when trying to auto-connect to a network. err: %d", + rc); + } + + return 0; +} + +#endif /* CONFIG_WIFI_CREDENTIALS_CONNECT_STORED */ + SHELL_STATIC_SUBCMD_SET_CREATE(sub_wifi_cred, SHELL_CMD_ARG(add, NULL, "Add network to storage.\n", @@ -304,6 +319,14 @@ SHELL_STATIC_SUBCMD_SET_CREATE(sub_wifi_cred, "List stored networks.\n", cmd_list_networks, 0, 0), + +#if CONFIG_WIFI_CREDENTIALS_CONNECT_STORED + SHELL_CMD_ARG(auto_connect, NULL, + "Connect to any stored network.\n", + cmd_auto_connect, + 0, 0), +#endif /* CONFIG_WIFI_CREDENTIALS_CONNECT_STORED */ + SHELL_SUBCMD_SET_END ); From a441492c7d3ec23873e9553930d07bb42548651d Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Fri, 6 Sep 2024 14:56:19 +0200 Subject: [PATCH 1255/4482] tests: net: lib: wifi_credentials: add tests This patch adds tests for the wifi_credentials library. Both the main functions and the backend implementations are tested. Signed-off-by: Maximilian Deubel --- tests/net/lib/wifi_credentials/CMakeLists.txt | 28 ++ tests/net/lib/wifi_credentials/prj.conf | 8 + tests/net/lib/wifi_credentials/src/main.c | 354 ++++++++++++++++++ tests/net/lib/wifi_credentials/testcase.yaml | 6 + .../CMakeLists.txt | 36 ++ .../lib/wifi_credentials_backend_psa/prj.conf | 8 + .../wifi_credentials_backend_psa/src/main.c | 224 +++++++++++ .../src/normalized_crypto.h | 44 +++ .../testcase.yaml | 6 + .../CMakeLists.txt | 28 ++ .../prj.conf | 8 + .../src/main.c | 234 ++++++++++++ .../testcase.yaml | 6 + 13 files changed, 990 insertions(+) create mode 100644 tests/net/lib/wifi_credentials/CMakeLists.txt create mode 100644 tests/net/lib/wifi_credentials/prj.conf create mode 100644 tests/net/lib/wifi_credentials/src/main.c create mode 100644 tests/net/lib/wifi_credentials/testcase.yaml create mode 100644 tests/net/lib/wifi_credentials_backend_psa/CMakeLists.txt create mode 100644 tests/net/lib/wifi_credentials_backend_psa/prj.conf create mode 100644 tests/net/lib/wifi_credentials_backend_psa/src/main.c create mode 100644 tests/net/lib/wifi_credentials_backend_psa/src/normalized_crypto.h create mode 100644 tests/net/lib/wifi_credentials_backend_psa/testcase.yaml create mode 100644 tests/net/lib/wifi_credentials_backend_settings/CMakeLists.txt create mode 100644 tests/net/lib/wifi_credentials_backend_settings/prj.conf create mode 100644 tests/net/lib/wifi_credentials_backend_settings/src/main.c create mode 100644 tests/net/lib/wifi_credentials_backend_settings/testcase.yaml diff --git a/tests/net/lib/wifi_credentials/CMakeLists.txt b/tests/net/lib/wifi_credentials/CMakeLists.txt new file mode 100644 index 0000000000000..42204c5fc2b95 --- /dev/null +++ b/tests/net/lib/wifi_credentials/CMakeLists.txt @@ -0,0 +1,28 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(wifi_credentials_test) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +target_sources(app + PRIVATE + ${ZEPHYR_BASE}/subsys/net/lib/wifi_credentials/wifi_credentials.c +) + +zephyr_include_directories(${ZEPHYR_BASE}/subsys/testsuite/include) +zephyr_include_directories(${ZEPHYR_BASE}/subsys/net/lib/wifi_credentials/) + +target_compile_options(app + PRIVATE + -DCONFIG_WIFI_CREDENTIALS_MAX_ENTRIES=2 + -DCONFIG_WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH=128 + -DCONFIG_WIFI_CREDENTIALS_LOG_LEVEL=4 +) diff --git a/tests/net/lib/wifi_credentials/prj.conf b/tests/net/lib/wifi_credentials/prj.conf new file mode 100644 index 0000000000000..6c474ef277725 --- /dev/null +++ b/tests/net/lib/wifi_credentials/prj.conf @@ -0,0 +1,8 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +CONFIG_ZTEST=y +CONFIG_LOG=y diff --git a/tests/net/lib/wifi_credentials/src/main.c b/tests/net/lib/wifi_credentials/src/main.c new file mode 100644 index 0000000000000..07586184e32bc --- /dev/null +++ b/tests/net/lib/wifi_credentials/src/main.c @@ -0,0 +1,354 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include + +#include + +#include + +#include "wifi_credentials_internal.h" + +DEFINE_FFF_GLOBALS; + +FAKE_VALUE_FUNC(int, wifi_credentials_store_entry, size_t, const void *, size_t) +FAKE_VALUE_FUNC(int, wifi_credentials_load_entry, size_t, void *, size_t) +FAKE_VALUE_FUNC(int, wifi_credentials_delete_entry, size_t) +FAKE_VALUE_FUNC(int, wifi_credentials_backend_init) + +uint8_t fake_settings_buf[CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES][ENTRY_MAX_LEN]; + +int custom_wifi_credentials_store_entry(size_t idx, const void *buf, size_t buf_len) +{ + zassert_true(idx < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES, "Index out of bounds"); + memcpy(fake_settings_buf[idx], buf, MIN(ENTRY_MAX_LEN, buf_len)); + return 0; +} + +int custom_wifi_credentials_load_entry(size_t idx, void *buf, size_t buf_len) +{ + zassert_true(idx < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES, "Index out of bounds"); + memcpy(buf, fake_settings_buf[idx], MIN(ENTRY_MAX_LEN, buf_len)); + return 0; +} + +#define SSID1 "test1" +#define PSK1 "super secret" +#define SECURITY1 WIFI_SECURITY_TYPE_PSK +#define BSSID1 "abcdef" +#define FLAGS1 WIFI_CREDENTIALS_FLAG_BSSID +#define CHANNEL1 1 + +#define SSID2 "test2" +#define SECURITY2 WIFI_SECURITY_TYPE_NONE +#define FLAGS2 0 +#define CHANNEL2 2 + +#define SSID3 "test3" +#define PSK3 "extremely secret" +#define SECURITY3 WIFI_SECURITY_TYPE_SAE +#define FLAGS3 0 +#define CHANNEL3 3 + +#define SSID4 "\0what's\0null\0termination\0anyway" +#define PSK4 PSK1 +#define SECURITY4 SECURITY1 +#define BSSID4 BSSID1 +#define FLAGS4 FLAGS1 +#define CHANNEL4 4 + +static void wifi_credentials_setup(void *unused) +{ + RESET_FAKE(wifi_credentials_store_entry); + RESET_FAKE(wifi_credentials_load_entry); + RESET_FAKE(wifi_credentials_delete_entry); + wifi_credentials_store_entry_fake.custom_fake = custom_wifi_credentials_store_entry; + wifi_credentials_load_entry_fake.custom_fake = custom_wifi_credentials_load_entry; +} + +static void wifi_credentials_teardown(void *unused) +{ + wifi_credentials_delete_by_ssid(SSID1, ARRAY_SIZE(SSID1)); + wifi_credentials_delete_by_ssid(SSID2, ARRAY_SIZE(SSID2)); + wifi_credentials_delete_by_ssid(SSID3, ARRAY_SIZE(SSID3)); + wifi_credentials_delete_by_ssid(SSID4, ARRAY_SIZE(SSID4)); + wifi_credentials_delete_by_ssid("", 0); +} + +/* Verify that attempting to retrieve a non-existent credentials entry raises -ENOENT. */ +ZTEST(wifi_credentials, test_get_non_existing) +{ + int err; + enum wifi_security_type security = -1; + uint8_t bssid_buf[WIFI_MAC_ADDR_LEN] = ""; + char psk_buf[WIFI_CREDENTIALS_MAX_PASSWORD_LEN] = ""; + size_t psk_len = 0; + uint32_t flags = 0; + uint8_t channel = 0; + uint32_t timeout = 0; + + err = wifi_credentials_get_by_ssid_personal( + SSID1, sizeof(SSID1), &security, bssid_buf, ARRAY_SIZE(bssid_buf), psk_buf, + ARRAY_SIZE(psk_buf), &psk_len, &flags, &channel, &timeout); + zassert_equal(err, -ENOENT, "Expected -ENOENT, got %d", err); +} + +/* Verify that we can successfully set/get a network without a specified BSSID. */ +ZTEST(wifi_credentials, test_single_no_bssid) +{ + int err; + + /* set network credentials without BSSID */ + err = wifi_credentials_set_personal(SSID1, sizeof(SSID1), SECURITY1, NULL, 0, PSK1, + sizeof(PSK1), 0, 0, 0); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); + + enum wifi_security_type security = -1; + uint8_t bssid_buf[WIFI_MAC_ADDR_LEN] = ""; + char psk_buf[WIFI_CREDENTIALS_MAX_PASSWORD_LEN] = ""; + size_t psk_len = 0; + uint32_t flags = 0; + uint8_t channel = 0; + uint32_t timeout = 0; + + /* retrieve network credentials without BSSID */ + err = wifi_credentials_get_by_ssid_personal( + SSID1, sizeof(SSID1), &security, bssid_buf, ARRAY_SIZE(bssid_buf), psk_buf, + ARRAY_SIZE(psk_buf), &psk_len, &flags, &channel, &timeout); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); + zassert_equal(strncmp(PSK1, psk_buf, ARRAY_SIZE(psk_buf)), 0, "PSK mismatch"); + zassert_equal(flags, 0, "Flags mismatch"); + zassert_equal(channel, 0, "Channel mismatch"); + zassert_equal(security, SECURITY1, "Security type mismatch"); + + err = wifi_credentials_delete_by_ssid(SSID1, sizeof(SSID1)); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); +} + +/* Verify that we can successfully set/get a network with a fixed BSSID. */ +ZTEST(wifi_credentials, test_single_with_bssid) +{ + int err; + + /* set network credentials with BSSID */ + err = wifi_credentials_set_personal(SSID1, sizeof(SSID1), SECURITY1, BSSID1, 6, PSK1, + sizeof(PSK1), FLAGS1, CHANNEL1, 0); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); + + enum wifi_security_type security = -1; + uint8_t bssid_buf[WIFI_MAC_ADDR_LEN] = ""; + char psk_buf[WIFI_CREDENTIALS_MAX_PASSWORD_LEN] = ""; + size_t psk_len = 0; + uint32_t flags = 0; + uint8_t channel = 0; + uint32_t timeout = 0; + + /* retrieve network credentials with BSSID */ + err = wifi_credentials_get_by_ssid_personal( + SSID1, sizeof(SSID1), &security, bssid_buf, ARRAY_SIZE(bssid_buf), psk_buf, + ARRAY_SIZE(psk_buf), &psk_len, &flags, &channel, &timeout); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); + zassert_equal(strncmp(PSK1, psk_buf, ARRAY_SIZE(psk_buf)), 0, "PSK mismatch"); + zassert_equal(psk_len, sizeof(PSK1), "PSK length mismatch"); + zassert_equal(strncmp(BSSID1, bssid_buf, ARRAY_SIZE(bssid_buf)), 0, "BSSID mismatch"); + zassert_equal(flags, WIFI_CREDENTIALS_FLAG_BSSID, "Flags mismatch"); + zassert_equal(channel, CHANNEL1, "Channel mismatch"); + zassert_equal(security, SECURITY1, "Security type mismatch"); + + err = wifi_credentials_delete_by_ssid(SSID1, sizeof(SSID1)); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); +} + +/* Verify that we can successfully set/get an open network. */ +ZTEST(wifi_credentials, test_single_without_psk) +{ + int err; + + /* set network credentials without PSK/BSSID */ + err = wifi_credentials_set_personal(SSID2, sizeof(SSID2), SECURITY2, NULL, 6, NULL, 0, + FLAGS2, CHANNEL2, 0); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); + + enum wifi_security_type security = -1; + uint8_t bssid_buf[WIFI_MAC_ADDR_LEN] = ""; + char psk_buf[WIFI_CREDENTIALS_MAX_PASSWORD_LEN] = ""; + size_t psk_len = 0; + uint32_t flags = 0; + uint8_t channel = 0; + uint32_t timeout = 0; + + /* retrieve network credentials without PSK/BSSID */ + err = wifi_credentials_get_by_ssid_personal( + SSID2, sizeof(SSID2), &security, bssid_buf, ARRAY_SIZE(bssid_buf), psk_buf, + ARRAY_SIZE(psk_buf), &psk_len, &flags, &channel, &timeout); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); + zassert_equal(psk_len, 0, "PSK length mismatch"); + zassert_equal(flags, 0, "Flags mismatch"); + zassert_equal(channel, CHANNEL2, "Channel mismatch"); + + err = wifi_credentials_delete_by_ssid(SSID2, sizeof(SSID2)); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); +} + +/* Verify that we can set/get a network that is only identified by a BSSID. */ +ZTEST(wifi_credentials, test_single_without_ssid) +{ + int err; + + err = wifi_credentials_set_personal("", 0, SECURITY1, BSSID1, 6, PSK1, sizeof(PSK1), FLAGS1, + CHANNEL1, 0); + zassert_equal(err, -EINVAL, "Expected -EINVAL, got %d", err); + + enum wifi_security_type security = -1; + uint8_t bssid_buf[WIFI_MAC_ADDR_LEN] = ""; + char psk_buf[WIFI_CREDENTIALS_MAX_PASSWORD_LEN] = ""; + size_t psk_len = 0; + uint32_t flags = 0; + uint8_t channel = 0; + uint32_t timeout = 0; + + err = wifi_credentials_get_by_ssid_personal( + "", 0, &security, bssid_buf, ARRAY_SIZE(bssid_buf), psk_buf, ARRAY_SIZE(psk_buf), + &psk_len, &flags, &channel, &timeout); + zassert_equal(err, -EINVAL, "Expected -EINVAL, got %d", err); + + err = wifi_credentials_delete_by_ssid("", 0); + zassert_equal(err, -EINVAL, "Expected -EINVAL, got %d", err); +} + +/* Verify that we can handle SSIDs that contain NULL characters. */ +ZTEST(wifi_credentials, test_single_garbled_ssid) +{ + int err; + + err = wifi_credentials_set_personal(SSID4, sizeof(SSID4), SECURITY4, BSSID4, 6, PSK4, + sizeof(PSK4), FLAGS4, CHANNEL4, 0); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); + + enum wifi_security_type security = -1; + uint8_t bssid_buf[WIFI_MAC_ADDR_LEN] = ""; + char psk_buf[WIFI_CREDENTIALS_MAX_PASSWORD_LEN] = ""; + size_t psk_len = 0; + uint32_t flags = 0; + uint8_t channel = 0; + uint32_t timeout = 0; + + err = wifi_credentials_get_by_ssid_personal( + SSID4, sizeof(SSID4), &security, bssid_buf, ARRAY_SIZE(bssid_buf), psk_buf, + ARRAY_SIZE(psk_buf), &psk_len, &flags, &channel, &timeout); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); + zassert_equal(strncmp(PSK4, psk_buf, ARRAY_SIZE(psk_buf)), 0, "PSK mismatch"); + zassert_equal(psk_len, sizeof(PSK4), "PSK length mismatch"); + zassert_equal(strncmp(BSSID4, bssid_buf, ARRAY_SIZE(bssid_buf)), 0, "BSSID mismatch"); + zassert_equal(security, SECURITY4, "Security type mismatch"); + zassert_equal(flags, FLAGS4, "Flags mismatch"); + zassert_equal(channel, CHANNEL4, "Channel mismatch"); + + err = wifi_credentials_delete_by_ssid(SSID4, sizeof(SSID4)); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); +} + +/* Helper function for test_set_storage_limit, making sure that the SSID cache is correct. */ +void verify_ssid_cache_cb(void *cb_arg, const char *ssid, size_t ssid_len) +{ + static int call_count; + static const char *const ssids[] = {SSID3, SSID2}; + + zassert_equal(strncmp(ssids[call_count++], ssid, ssid_len), 0, "SSID cache mismatch"); + zassert_is_null(cb_arg, "Callback argument is not NULL"); +} + +/* Verify that wifi_credentials behaves correctly when the storage limit is reached. */ +ZTEST(wifi_credentials, test_storage_limit) +{ + int err; + + /* Set two networks */ + err = wifi_credentials_set_personal(SSID1, sizeof(SSID1), SECURITY1, BSSID1, 6, PSK1, + sizeof(PSK1), FLAGS1, CHANNEL1, 0); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); + + err = wifi_credentials_set_personal(SSID2, sizeof(SSID2), SECURITY2, NULL, 6, NULL, 0, + FLAGS2, CHANNEL2, 0); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); + + enum wifi_security_type security = -1; + uint8_t bssid_buf[WIFI_MAC_ADDR_LEN] = ""; + char psk_buf[WIFI_CREDENTIALS_MAX_PASSWORD_LEN] = ""; + size_t psk_len = 0; + uint32_t flags = 0; + uint8_t channel = 0; + uint32_t timeout = 0; + + /* Get two networks */ + err = wifi_credentials_get_by_ssid_personal( + SSID1, sizeof(SSID1), &security, bssid_buf, ARRAY_SIZE(bssid_buf), psk_buf, + ARRAY_SIZE(psk_buf), &psk_len, &flags, &channel, &timeout); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); + zassert_equal(strncmp(PSK1, psk_buf, ARRAY_SIZE(psk_buf)), 0, "PSK mismatch"); + zassert_equal(psk_len, sizeof(PSK1), "PSK length mismatch"); + zassert_equal(strncmp(BSSID1, bssid_buf, ARRAY_SIZE(bssid_buf)), 0, "BSSID mismatch"); + zassert_equal(security, SECURITY1, "Security type mismatch"); + zassert_equal(flags, FLAGS1, "Flags mismatch"); + zassert_equal(channel, CHANNEL1, "Channel mismatch"); + + err = wifi_credentials_get_by_ssid_personal( + SSID2, sizeof(SSID2), &security, bssid_buf, ARRAY_SIZE(bssid_buf), psk_buf, + ARRAY_SIZE(psk_buf), &psk_len, &flags, &channel, &timeout); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); + zassert_equal(security, SECURITY2, "Security type mismatch"); + zassert_equal(flags, FLAGS2, "Flags mismatch"); + zassert_equal(channel, CHANNEL2, "Channel mismatch"); + + /* Set third network */ + err = wifi_credentials_set_personal(SSID3, sizeof(SSID3), SECURITY3, NULL, 6, PSK3, + sizeof(PSK3), FLAGS3, CHANNEL3, 0); + zassert_equal(err, -ENOBUFS, "Expected -ENOBUFS, got %d", err); + + /* Not enough space? Delete the first one. */ + wifi_credentials_delete_by_ssid(SSID1, ARRAY_SIZE(SSID1)); + err = wifi_credentials_set_personal(SSID3, sizeof(SSID3), SECURITY3, NULL, 6, PSK3, + sizeof(PSK3), FLAGS3, CHANNEL3, 0); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); + + err = wifi_credentials_get_by_ssid_personal( + SSID3, sizeof(SSID3), &security, bssid_buf, ARRAY_SIZE(bssid_buf), psk_buf, + ARRAY_SIZE(psk_buf), &psk_len, &flags, &channel, &timeout); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); + zassert_equal(security, SECURITY3, "Security type mismatch"); + zassert_equal(psk_len, sizeof(PSK3), "PSK length mismatch"); + zassert_equal(strncmp(PSK3, psk_buf, ARRAY_SIZE(psk_buf)), 0, "PSK mismatch"); + zassert_equal(flags, FLAGS3, "Flags mismatch"); + zassert_equal(channel, CHANNEL3, "Channel mismatch"); + + wifi_credentials_for_each_ssid(verify_ssid_cache_cb, NULL); +} + +/* Verify that all entries are deleted. */ +ZTEST(wifi_credentials, test_delete_all_entries) +{ + /* Set two networks */ + int err = wifi_credentials_set_personal(SSID1, sizeof(SSID1), SECURITY1, BSSID1, 6, PSK1, + sizeof(PSK1), FLAGS1, CHANNEL1, 0); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); + + err = wifi_credentials_set_personal(SSID2, sizeof(SSID2), SECURITY2, NULL, 6, NULL, 0, + FLAGS2, CHANNEL2, 0); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); + + /* Delete all networks */ + err = wifi_credentials_delete_all(); + zassert_equal(err, EXIT_SUCCESS, "Expected EXIT_SUCCESS, got %d", err); + + /* Verify that the storage is empty */ + zassert_true(wifi_credentials_is_empty(), "Storage is not empty"); +} + +ZTEST_SUITE(wifi_credentials, NULL, NULL, wifi_credentials_setup, wifi_credentials_teardown, NULL); diff --git a/tests/net/lib/wifi_credentials/testcase.yaml b/tests/net/lib/wifi_credentials/testcase.yaml new file mode 100644 index 0000000000000..04dfc84af35b2 --- /dev/null +++ b/tests/net/lib/wifi_credentials/testcase.yaml @@ -0,0 +1,6 @@ +tests: + net.wifi_credentials: + tags: + - net + integration_platforms: + - native_sim diff --git a/tests/net/lib/wifi_credentials_backend_psa/CMakeLists.txt b/tests/net/lib/wifi_credentials_backend_psa/CMakeLists.txt new file mode 100644 index 0000000000000..6ff95328fff17 --- /dev/null +++ b/tests/net/lib/wifi_credentials_backend_psa/CMakeLists.txt @@ -0,0 +1,36 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(wifi_credentials_test) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +target_sources(app + PRIVATE + ${ZEPHYR_BASE}/subsys/net/lib/wifi_credentials/wifi_credentials_backend_psa.c +) + +zephyr_include_directories(${ZEPHYR_BASE}/subsys/testsuite/include) +zephyr_include_directories(${ZEPHYR_BASE}/subsys/net/lib/wifi_credentials/) +zephyr_include_directories(${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/interface/include/) +zephyr_include_directories(${ZEPHYR_BASE}/../modules/crypto/mbedtls/include/) + +target_compile_options(app + PRIVATE + -DCONFIG_WIFI_CREDENTIALS_MAX_ENTRIES=2 + -DCONFIG_WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH=128 + -DCONFIG_WIFI_CREDENTIALS_LOG_LEVEL=4 + -DCONFIG_WIFI_CREDENTIALS_BACKEND_PSA_OFFSET=5 +) + +set_property( + SOURCE ${ZEPHYR_BASE}/subsys/net/lib/wifi_credentials/wifi_credentials_backend_psa.c + PROPERTY COMPILE_FLAGS "-include ${CMAKE_CURRENT_SOURCE_DIR}/src/normalized_crypto.h" +) diff --git a/tests/net/lib/wifi_credentials_backend_psa/prj.conf b/tests/net/lib/wifi_credentials_backend_psa/prj.conf new file mode 100644 index 0000000000000..5ab70cd012644 --- /dev/null +++ b/tests/net/lib/wifi_credentials_backend_psa/prj.conf @@ -0,0 +1,8 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +CONFIG_ZTEST=y +CONFIG_LOG=y diff --git a/tests/net/lib/wifi_credentials_backend_psa/src/main.c b/tests/net/lib/wifi_credentials_backend_psa/src/main.c new file mode 100644 index 0000000000000..f0b2b6804ab06 --- /dev/null +++ b/tests/net/lib/wifi_credentials_backend_psa/src/main.c @@ -0,0 +1,224 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "wifi_credentials_internal.h" +#include "psa/crypto_types.h" +#include "psa/crypto_values.h" + +#define SSID1 "test1" +#define PSK1 "super secret" +#define SECURITY1 WIFI_SECURITY_TYPE_PSK +#define BSSID1 "abcdef" +#define FLAGS1 WIFI_CREDENTIALS_FLAG_BSSID + +#define SSID2 "test2" +#define PSK2 NULL +#define SECURITY2 WIFI_SECURITY_TYPE_NONE +#define BSSID2 NULL +#define FLAGS2 0 + +#define WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN \ + (PSA_KEY_ID_USER_MIN + CONFIG_WIFI_CREDENTIALS_BACKEND_PSA_OFFSET) + +DEFINE_FFF_GLOBALS; + +K_MUTEX_DEFINE(wifi_credentials_mutex); + +FAKE_VOID_FUNC(wifi_credentials_cache_ssid, size_t, const struct wifi_credentials_header *); +FAKE_VALUE_FUNC(psa_status_t, psa_export_key, mbedtls_svc_key_id_t, uint8_t *, size_t, size_t *); +FAKE_VALUE_FUNC(psa_status_t, psa_import_key, psa_key_attributes_t *, uint8_t *, size_t, + mbedtls_svc_key_id_t *); +FAKE_VALUE_FUNC(psa_status_t, psa_destroy_key, mbedtls_svc_key_id_t); +FAKE_VOID_FUNC(psa_set_key_id, psa_key_attributes_t *, uint32_t); +FAKE_VOID_FUNC(psa_set_key_usage_flags, psa_key_attributes_t *, psa_key_usage_t); +FAKE_VOID_FUNC(psa_set_key_lifetime, psa_key_attributes_t *, psa_key_lifetime_t); +FAKE_VOID_FUNC(psa_set_key_algorithm, psa_key_attributes_t *, psa_algorithm_t); +FAKE_VOID_FUNC(psa_set_key_type, psa_key_attributes_t *, psa_key_type_t); +FAKE_VOID_FUNC(psa_set_key_bits, psa_key_attributes_t *, size_t); + +static const struct wifi_credentials_personal example1 = { + .header = { + .ssid = SSID1, + .ssid_len = strlen(SSID1), + .type = SECURITY1, + .bssid = BSSID1, + .flags = FLAGS1, + }, + .password = PSK1, + .password_len = strlen(PSK1), +}; + +static const struct wifi_credentials_personal example2 = { + .header = { + .ssid = SSID2, + .ssid_len = strlen(SSID2), + .type = SECURITY2, + .flags = FLAGS2, + }, +}; + +static size_t idx; + +psa_status_t custom_psa_export_key(mbedtls_svc_key_id_t key, uint8_t *data, size_t data_size, + size_t *data_length) +{ + /* confirm that we read the requested amount of data */ + *data_length = data_size; + return PSA_SUCCESS; +} + +static void custom_psa_set_key_id(psa_key_attributes_t *attributes, mbedtls_svc_key_id_t key) +{ + zassert_equal(idx + WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN, key, "Key ID mismatch"); +} + +void custom_psa_set_key_bits(psa_key_attributes_t *attributes, size_t bits) +{ + zassert_equal(sizeof(struct wifi_credentials_personal) * 8, bits, "Key bits mismatch"); +} + +void custom_psa_set_key_type(psa_key_attributes_t *attributes, psa_key_type_t type) +{ + zassert_equal(PSA_KEY_TYPE_RAW_DATA, type, "Key type mismatch"); +} + +void custom_psa_set_key_algorithm(psa_key_attributes_t *attributes, psa_algorithm_t alg) +{ + zassert_equal(PSA_ALG_NONE, alg, "Key algorithm mismatch"); +} + +void custom_psa_set_key_lifetime(psa_key_attributes_t *attributes, psa_key_lifetime_t lifetime) +{ + zassert_equal(PSA_KEY_LIFETIME_PERSISTENT, lifetime, "Key lifetime mismatch"); +} + +void custom_psa_set_key_usage_flags(psa_key_attributes_t *attributes, psa_key_usage_t usage_flags) +{ + zassert_equal(PSA_KEY_USAGE_EXPORT, usage_flags, "Key usage flags mismatch"); +} + +static void wifi_credentials_backend_psa_setup(void *_unused) +{ + RESET_FAKE(wifi_credentials_cache_ssid); + RESET_FAKE(psa_export_key); + RESET_FAKE(psa_import_key); + RESET_FAKE(psa_destroy_key); + psa_export_key_fake.custom_fake = custom_psa_export_key; + psa_set_key_id_fake.custom_fake = custom_psa_set_key_id; + psa_set_key_usage_flags_fake.custom_fake = custom_psa_set_key_usage_flags; + psa_set_key_lifetime_fake.custom_fake = custom_psa_set_key_lifetime; + psa_set_key_algorithm_fake.custom_fake = custom_psa_set_key_algorithm; + psa_set_key_type_fake.custom_fake = custom_psa_set_key_type; + psa_set_key_bits_fake.custom_fake = custom_psa_set_key_bits; + idx = 0; +} + +ZTEST(wifi_credentials_backend_psa, test_init) +{ + int ret; + + ret = wifi_credentials_backend_init(); + + zassert_equal(0, ret, "Initialization failed"); + zassert_equal(psa_export_key_fake.call_count, CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES, + "Export key call count mismatch"); + zassert_equal(wifi_credentials_cache_ssid_fake.call_count, + CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES, "Cache SSID call count mismatch"); +} + +ZTEST(wifi_credentials_backend_psa, test_add) +{ + int ret = wifi_credentials_store_entry(idx, &example1, + sizeof(struct wifi_credentials_personal)); + + zassert_equal(0, ret, "Store entry failed"); + zassert_equal_ptr(psa_import_key_fake.arg1_val, &example1, "Import key arg1 mismatch"); + zassert_equal(psa_import_key_fake.arg2_val, sizeof(struct wifi_credentials_personal), + "Import key arg2 mismatch"); + + idx++; + + ret = wifi_credentials_store_entry(idx, &example2, + sizeof(struct wifi_credentials_personal)); + + zassert_equal(0, ret, "Store entry failed"); + zassert_equal_ptr(psa_import_key_fake.arg1_val, &example2, "Import key arg1 mismatch"); + zassert_equal(psa_import_key_fake.arg2_val, sizeof(struct wifi_credentials_personal), + "Import key arg2 mismatch"); + + zassert_equal(psa_import_key_fake.call_count, 2, "Import key call count mismatch"); + zassert_equal(psa_set_key_id_fake.call_count, 2, "Set key ID call count mismatch"); + zassert_equal(psa_set_key_usage_flags_fake.call_count, 2, + "Set key usage flags call count mismatch"); + zassert_equal(psa_set_key_lifetime_fake.call_count, 2, + "Set key lifetime call count mismatch"); + zassert_equal(psa_set_key_algorithm_fake.call_count, 2, + "Set key algorithm call count mismatch"); + zassert_equal(psa_set_key_type_fake.call_count, 2, "Set key type call count mismatch"); + zassert_equal(psa_set_key_bits_fake.call_count, 2, "Set key bits call count mismatch"); +} + +ZTEST(wifi_credentials_backend_psa, test_get) +{ + int ret; + psa_key_id_t key_id = idx + WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN; + uint8_t buf[ENTRY_MAX_LEN]; + + ret = wifi_credentials_load_entry(idx, buf, ARRAY_SIZE(buf)); + + zassert_equal(0, ret, "Load entry failed"); + zassert_equal(psa_export_key_fake.arg0_val, key_id, "Export key arg0 mismatch"); + zassert_equal_ptr(psa_export_key_fake.arg1_val, buf, "Export key arg1 mismatch"); + zassert_equal(psa_export_key_fake.arg2_val, ARRAY_SIZE(buf), "Export key arg2 mismatch"); + + idx++; + key_id = idx + WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN; + + ret = wifi_credentials_load_entry(idx, buf, ARRAY_SIZE(buf)); + + zassert_equal(0, ret, "Load entry failed"); + zassert_equal(psa_export_key_fake.arg0_val, key_id, "Export key arg0 mismatch"); + zassert_equal_ptr(psa_export_key_fake.arg1_val, buf, "Export key arg1 mismatch"); + zassert_equal(psa_export_key_fake.arg2_val, ARRAY_SIZE(buf), "Export key arg2 mismatch"); + + zassert_equal(psa_export_key_fake.call_count, 2, "Export key call count mismatch"); +} + +ZTEST(wifi_credentials_backend_psa, test_delete) +{ + int ret; + + ret = wifi_credentials_delete_entry(idx); + + zassert_equal(0, ret, "Delete entry failed"); + zassert_equal(psa_destroy_key_fake.arg0_val, WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN, + "Destroy key arg0 mismatch"); + + idx++; + + ret = wifi_credentials_delete_entry(1); + + zassert_equal(0, ret, "Delete entry failed"); + zassert_equal(psa_destroy_key_fake.arg0_val, + idx + WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN, + "Destroy key arg0 mismatch"); + + zassert_equal(psa_destroy_key_fake.call_count, 2, "Destroy key call count mismatch"); +} + +ZTEST_SUITE(wifi_credentials_backend_psa, NULL, NULL, wifi_credentials_backend_psa_setup, NULL, + NULL); diff --git a/tests/net/lib/wifi_credentials_backend_psa/src/normalized_crypto.h b/tests/net/lib/wifi_credentials_backend_psa/src/normalized_crypto.h new file mode 100644 index 0000000000000..b5e5e1ed7b8a3 --- /dev/null +++ b/tests/net/lib/wifi_credentials_backend_psa/src/normalized_crypto.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef PSA_CRYPTO_H +#define PSA_CRYPTO_H + +#include "zephyr/types.h" +#include "psa/crypto_types.h" +#include "psa/crypto_values.h" + +struct psa_client_key_attributes_s { + uint16_t type; + uint16_t bits; + uint32_t lifetime; + psa_key_id_t id; + uint32_t usage; + uint32_t alg; +}; + +struct psa_key_attributes_s { + struct psa_client_key_attributes_s client; +}; + +typedef struct psa_key_attributes_s psa_key_attributes_t; + +psa_status_t psa_import_key(const psa_key_attributes_t *attributes, const uint8_t *data, + size_t data_length, mbedtls_svc_key_id_t *key); + +psa_status_t psa_export_key(mbedtls_svc_key_id_t key, uint8_t *data, size_t data_size, + size_t *data_length); + +psa_status_t psa_destroy_key(mbedtls_svc_key_id_t key); +void psa_set_key_id(psa_key_attributes_t *attributes, mbedtls_svc_key_id_t key); +void psa_set_key_bits(psa_key_attributes_t *attributes, size_t bits); +void psa_set_key_type(psa_key_attributes_t *attributes, psa_key_type_t type); +void psa_set_key_algorithm(psa_key_attributes_t *attributes, psa_algorithm_t alg); +void psa_set_key_lifetime(psa_key_attributes_t *attributes, psa_key_lifetime_t lifetime); +psa_status_t psa_destroy_key(mbedtls_svc_key_id_t key); +void psa_set_key_usage_flags(psa_key_attributes_t *attributes, psa_key_usage_t usage_flags); + +#endif diff --git a/tests/net/lib/wifi_credentials_backend_psa/testcase.yaml b/tests/net/lib/wifi_credentials_backend_psa/testcase.yaml new file mode 100644 index 0000000000000..2ec5ff4b1d9e8 --- /dev/null +++ b/tests/net/lib/wifi_credentials_backend_psa/testcase.yaml @@ -0,0 +1,6 @@ +tests: + net.wifi_credentials_backend_psa: + tags: + - net + integration_platforms: + - native_sim diff --git a/tests/net/lib/wifi_credentials_backend_settings/CMakeLists.txt b/tests/net/lib/wifi_credentials_backend_settings/CMakeLists.txt new file mode 100644 index 0000000000000..a9f2dfc734a3b --- /dev/null +++ b/tests/net/lib/wifi_credentials_backend_settings/CMakeLists.txt @@ -0,0 +1,28 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(wifi_credentials_test) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +target_sources(app + PRIVATE + ${ZEPHYR_BASE}/subsys/net/lib/wifi_credentials/wifi_credentials_backend_settings.c +) + +zephyr_include_directories(${ZEPHYR_BASE}/subsys/testsuite/include) +zephyr_include_directories(${ZEPHYR_BASE}/subsys/net/lib/wifi_credentials/) + +target_compile_options(app + PRIVATE + -DCONFIG_WIFI_CREDENTIALS_MAX_ENTRIES=2 + -DCONFIG_WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH=128 + -DCONFIG_WIFI_CREDENTIALS_LOG_LEVEL=4 +) diff --git a/tests/net/lib/wifi_credentials_backend_settings/prj.conf b/tests/net/lib/wifi_credentials_backend_settings/prj.conf new file mode 100644 index 0000000000000..5ab70cd012644 --- /dev/null +++ b/tests/net/lib/wifi_credentials_backend_settings/prj.conf @@ -0,0 +1,8 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +CONFIG_ZTEST=y +CONFIG_LOG=y diff --git a/tests/net/lib/wifi_credentials_backend_settings/src/main.c b/tests/net/lib/wifi_credentials_backend_settings/src/main.c new file mode 100644 index 0000000000000..edba29ebd1e80 --- /dev/null +++ b/tests/net/lib/wifi_credentials_backend_settings/src/main.c @@ -0,0 +1,234 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "wifi_credentials_internal.h" + +#define MAX_KEY_LEN 16 + +#define SSID1 "test1" +#define PSK1 "super secret" +#define SECURITY1 WIFI_SECURITY_TYPE_PSK +#define BSSID1 "abcdef" +#define FLAGS1 WIFI_CREDENTIALS_FLAG_BSSID + +#define SSID2 "test2" +#define PSK2 NULL +#define SECURITY2 WIFI_SECURITY_TYPE_NONE +#define BSSID2 NULL +#define FLAGS2 0 + +DEFINE_FFF_GLOBALS; + +K_MUTEX_DEFINE(wifi_credentials_mutex); + +FAKE_VALUE_FUNC(int, settings_subsys_init); +FAKE_VALUE_FUNC(int, settings_save_one, const char *, const void *, size_t); +FAKE_VALUE_FUNC(int, settings_delete, const char *); +FAKE_VALUE_FUNC(int, settings_load_subtree_direct, const char *, settings_load_direct_cb, void *); +FAKE_VOID_FUNC(wifi_credentials_cache_ssid, size_t, const struct wifi_credentials_header *); + +static uint8_t fake_settings_buf[CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES][ENTRY_MAX_LEN]; +static char fake_settings_buf_keys[CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES][MAX_KEY_LEN]; +static size_t fake_settings_buf_lens[CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES]; + +typedef int (*settings_set_cb)(const char *key, size_t len, settings_read_cb read_cb, void *cb_arg); + +static const struct wifi_credentials_personal example1 = { + .header = { + .ssid = SSID1, + .ssid_len = strlen(SSID1), + .type = SECURITY1, + .bssid = BSSID1, + .flags = FLAGS1, + }, + .password = PSK1, + .password_len = strlen(PSK1), +}; + +static const struct wifi_credentials_personal example2 = { + .header = { + .ssid = SSID2, + .ssid_len = strlen(SSID2), + .type = SECURITY2, + .flags = FLAGS2, + }, +}; + +/** + * @brief load content of given settings index to given buffer + * + * @param cb_arg size_t *idx + * @param data destination + * @param len length + * @return ssize_t MIN(length, length_available) + */ +ssize_t custom_settings_read_cb(void *cb_arg, void *data, size_t len) +{ + size_t *idx = cb_arg; + + zassert_true(len <= ENTRY_MAX_LEN, "Length exceeds ENTRY_MAX_LEN"); + memcpy(data, fake_settings_buf[*idx], len); + return len; +} + +static int custom_settings_save_one(const char *name, const void *value, size_t val_len) +{ + zassert_true(strlen(name) < MAX_KEY_LEN, "Name length exceeds MAX_KEY_LEN"); + zassert_true(val_len <= ENTRY_MAX_LEN, "Value length exceeds ENTRY_MAX_LEN"); + + for (size_t i = 0; i < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES; ++i) { + if (strlen(fake_settings_buf_keys[i]) == 0 || + strcmp(name, fake_settings_buf_keys[i]) == 0) { + strcpy(fake_settings_buf_keys[i], name); + memcpy(fake_settings_buf[i], value, val_len); + fake_settings_buf_lens[i] = val_len; + return 0; + } + } + return -ENOBUFS; +} + +static int custom_settings_delete(const char *name) +{ + zassert_true(strlen(name) < MAX_KEY_LEN, "Name length exceeds MAX_KEY_LEN"); + for (size_t i = 0; i < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES; ++i) { + if (strcmp(name, fake_settings_buf_keys[i]) == 0) { + memset(fake_settings_buf_keys[i], 0, MAX_KEY_LEN); + memset(fake_settings_buf[i], 0, ENTRY_MAX_LEN); + fake_settings_buf_lens[i] = 0; + return 0; + } + } + return -ENOENT; +} + +static int custom_settings_load_subtree_direct(const char *subtree, settings_load_direct_cb cb, + void *param) +{ + size_t subtree_len = strlen(subtree); + + zassert_true(subtree_len < MAX_KEY_LEN, "Subtree length exceeds MAX_KEY_LEN"); + + for (size_t i = 0; i < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES; ++i) { + if (strncmp(subtree, fake_settings_buf_keys[i], subtree_len) == 0) { + const char *key = fake_settings_buf_keys[i] + subtree_len + 1; + + cb(key, fake_settings_buf_lens[i], custom_settings_read_cb, &i, param); + } + } + return 0; +} + +static void custom_wifi_credentials_cache_ssid(size_t idx, + const struct wifi_credentials_header *buf) +{ + char name[16] = ""; + + snprintk(name, ARRAY_SIZE(name), "wifi_cred/%d", idx); + for (size_t i = 0; i < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES; ++i) { + if (strcmp(name, fake_settings_buf_keys[i]) == 0) { + zassert_equal(memcmp(buf, &fake_settings_buf[i], + sizeof(struct wifi_credentials_header)), + 0, "Buffer mismatch"); + return; + } + } + zassert_true(false, "SSID not found in cache"); +} + +static void wifi_credentials_backend_settings_setup(void *_unused) +{ + RESET_FAKE(settings_save_one); + RESET_FAKE(settings_delete); + RESET_FAKE(settings_load_subtree_direct); + RESET_FAKE(wifi_credentials_cache_ssid); + settings_save_one_fake.custom_fake = custom_settings_save_one; + settings_delete_fake.custom_fake = custom_settings_delete; + settings_load_subtree_direct_fake.custom_fake = custom_settings_load_subtree_direct; + wifi_credentials_cache_ssid_fake.custom_fake = custom_wifi_credentials_cache_ssid; + memset(fake_settings_buf_lens, 0, ARRAY_SIZE(fake_settings_buf_lens) * sizeof(size_t)); + memset(fake_settings_buf_keys, 0, CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES * MAX_KEY_LEN); + memset(fake_settings_buf, 0, CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES * ENTRY_MAX_LEN); +} + +ZTEST(wifi_credentials_backend_settings, test_init) +{ + int ret; + + ret = wifi_credentials_store_entry(0, &example1, sizeof(struct wifi_credentials_personal)); + zassert_equal(ret, 0, "Failed to store entry 0"); + ret = wifi_credentials_store_entry(1, &example2, sizeof(struct wifi_credentials_personal)); + zassert_equal(ret, 0, "Failed to store entry 1"); + + ret = wifi_credentials_backend_init(); + + zassert_equal(ret, 0, "Backend init failed"); + zassert_equal(settings_subsys_init_fake.call_count, 1, + "settings_subsys_init call count mismatch"); + zassert_equal(wifi_credentials_cache_ssid_fake.call_count, 2, + "wifi_credentials_cache_ssid call count mismatch"); + zassert_equal(wifi_credentials_cache_ssid_fake.arg0_history[0], 0, + "First cache SSID index mismatch"); + zassert_equal(wifi_credentials_cache_ssid_fake.arg0_history[1], 1, + "Second cache SSID index mismatch"); +} + +ZTEST(wifi_credentials_backend_settings, test_add) +{ + int ret = wifi_credentials_store_entry(0, "abc", 3); + + zassert_equal(ret, 0, "Failed to add entry"); + zassert_equal(settings_save_one_fake.call_count, 1, + "settings_save_one call count mismatch"); + zassert_equal(strcmp(fake_settings_buf_keys[0], "wifi_cred/0"), 0, "Key mismatch"); + zassert_equal(strcmp(fake_settings_buf[0], "abc"), 0, "Value mismatch"); + zassert_equal(fake_settings_buf_lens[0], 3, "Length mismatch"); +} + +ZTEST(wifi_credentials_backend_settings, test_get) +{ + int ret; + + ret = wifi_credentials_store_entry(0, &example1, sizeof(struct wifi_credentials_personal)); + zassert_equal(ret, 0, "Failed to store entry 0"); + ret = wifi_credentials_store_entry(1, &example2, sizeof(struct wifi_credentials_personal)); + zassert_equal(ret, 0, "Failed to store entry 1"); + + char buf[ENTRY_MAX_LEN] = {0}; + + ret = wifi_credentials_load_entry(0, buf, ARRAY_SIZE(buf)); + zassert_equal(ret, 0, "Failed to load entry 0"); + zassert_equal(memcmp(&example1, buf, ARRAY_SIZE(buf)), 0, "Entry 0 data mismatch"); + ret = wifi_credentials_load_entry(1, buf, ARRAY_SIZE(buf)); + zassert_equal(ret, 0, "Failed to load entry 1"); + zassert_equal(memcmp(&example2, buf, ARRAY_SIZE(buf)), 0, "Entry 1 data mismatch"); +} + +ZTEST(wifi_credentials_backend_settings, test_delete) +{ + int ret; + + ret = wifi_credentials_store_entry(0, "abc", 3); + zassert_equal(ret, 0, "Failed to store entry"); + + ret = wifi_credentials_delete_entry(0); + zassert_equal(ret, 0, "Failed to delete entry"); + zassert_equal(settings_delete_fake.call_count, 1, "settings_delete call count mismatch"); +} + +ZTEST_SUITE(wifi_credentials_backend_settings, NULL, NULL, wifi_credentials_backend_settings_setup, + NULL, NULL); diff --git a/tests/net/lib/wifi_credentials_backend_settings/testcase.yaml b/tests/net/lib/wifi_credentials_backend_settings/testcase.yaml new file mode 100644 index 0000000000000..2673831ed53ca --- /dev/null +++ b/tests/net/lib/wifi_credentials_backend_settings/testcase.yaml @@ -0,0 +1,6 @@ +tests: + net.wifi_credentials_backend_settings: + tags: + - net + integration_platforms: + - native_sim From 6e653a96f7903fc932575b37f449ceaf4e94c3e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 18 Oct 2024 13:04:35 +0200 Subject: [PATCH 1256/4482] tests: boards: nrf: qdec: Fix failing drivers.sensor.qdec.pm_runtime MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test was failing because after re-enabling QDEC there is an interrupt REPORTRDY coming after some time. Test had k_msleep(100) added to accomodate for that but it was added after sensor_sample_fetch and should be added before so that sample with data from REPORTRDY event is fetched so that next read is empty as expected. Signed-off-by: Krzysztof Chruściński --- tests/boards/nrf/qdec/src/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/boards/nrf/qdec/src/main.c b/tests/boards/nrf/qdec/src/main.c index 2ad847796e87a..d87feb22f42f1 100644 --- a/tests/boards/nrf/qdec/src/main.c +++ b/tests/boards/nrf/qdec/src/main.c @@ -308,12 +308,12 @@ ZTEST(qdec_sensor, test_sensor_channel_get_empty) pm_device_runtime_get(qdec_dev); } - rc = sensor_sample_fetch(qdec_dev); - zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); - /* wait for potential new readings */ k_msleep(100); + rc = sensor_sample_fetch(qdec_dev); + zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); + /* get readings but ignore them, as they may include reading from time * when emulation was still working (i.e. during previous test) */ From 9b00bf4359419fb36737e306079d4c9cd33ae40a Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Mon, 21 Oct 2024 13:22:48 +0200 Subject: [PATCH 1257/4482] snippets: rtt-console: enable console Enable CONFIG_CONSOLE in the Segger RTT console snippet as this is a dependency for CONFIG_RTT_CONSOLE. Signed-off-by: Henrik Brix Andersen --- snippets/rtt-console/rtt-console.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/snippets/rtt-console/rtt-console.conf b/snippets/rtt-console/rtt-console.conf index 3453f62ca38ea..f05db56d94aa6 100644 --- a/snippets/rtt-console/rtt-console.conf +++ b/snippets/rtt-console/rtt-console.conf @@ -1,3 +1,4 @@ CONFIG_USE_SEGGER_RTT=y +CONFIG_CONSOLE=y CONFIG_RTT_CONSOLE=y CONFIG_UART_CONSOLE=n From ad719014901303a0b89200ea7c80672dd7d75805 Mon Sep 17 00:00:00 2001 From: Sudan Landge Date: Fri, 11 Oct 2024 14:30:46 +0100 Subject: [PATCH 1258/4482] arm64: linker: fix: broken tests for fvp_aemv8r_aarch64 What is changed? Twister tests and sample applications can now run successfully again for `fvp_aemv8r_aarch64`. `__kernal_ram_start` is also modified for cortex_m and cortex_a_r to be consistent with aarch64 linker script and avoid such issue in the future. How is it changed? Modified linker script to make sure that `__kernal_ram_start` to `__kernal_ram_end` includes both, bss and data, sections as before. Why do we need this change? Twister tests and sample applications failed for `fvp_aemv8r_aarch64` and it was found that commit #87f68b4dfed14eb08132fe9798fb209f1bed64f2 moved the bss section but missed moving the __kernal_ram_start to the data section which resulted in a crash. The change is tested with FVP_BaseR_AEMv8R version: 11.27.19. Signed-off-by: Sudan Landge --- include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld | 2 +- include/zephyr/arch/arm/cortex_m/scripts/linker.ld | 4 ++-- include/zephyr/arch/arm64/scripts/linker.ld | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld b/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld index 239ab62129371..32fd57ca15b28 100644 --- a/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld @@ -293,6 +293,7 @@ SECTIONS _app_smem_rom_start = LOADADDR(_APP_SMEM_SECTION_NAME); #endif /* CONFIG_USERSPACE */ + __kernel_ram_start = .; SECTION_DATA_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD), BSS_ALIGN) { /* @@ -301,7 +302,6 @@ SECTIONS */ . = ALIGN(4); __bss_start = .; - __kernel_ram_start = .; *(.bss) *(".bss.*") diff --git a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld index 9e123b120de7c..706182612a5c1 100644 --- a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld @@ -289,6 +289,7 @@ SECTIONS _app_smem_size = _app_smem_end - _app_smem_start; _app_smem_rom_start = LOADADDR(_APP_SMEM_SECTION_NAME); + __kernel_ram_start = .; SECTION_DATA_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD),) { /* @@ -297,7 +298,6 @@ SECTIONS */ . = ALIGN(4); __bss_start = .; - __kernel_ram_start = .; *(.bss) *(".bss.*") @@ -358,6 +358,7 @@ SECTIONS __data_region_end = .; #ifndef CONFIG_USERSPACE + __kernel_ram_start = .; SECTION_DATA_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD),) { /* @@ -366,7 +367,6 @@ SECTIONS */ . = ALIGN(4); __bss_start = .; - __kernel_ram_start = .; *(.bss) *(".bss.*") diff --git a/include/zephyr/arch/arm64/scripts/linker.ld b/include/zephyr/arch/arm64/scripts/linker.ld index 648ebba569060..d5a4e25abaad5 100644 --- a/include/zephyr/arch/arm64/scripts/linker.ld +++ b/include/zephyr/arch/arm64/scripts/linker.ld @@ -241,6 +241,7 @@ SECTIONS _app_smem_rom_start = LOADADDR(_APP_SMEM_SECTION_NAME); #endif /* CONFIG_USERSPACE */ + __kernel_ram_start = .; __data_region_start = .; SECTION_DATA_PROLOGUE(_DATA_SECTION_NAME,,) @@ -273,7 +274,6 @@ SECTIONS { . = ALIGN(8); __bss_start = .; - __kernel_ram_start = .; *(.bss) *(".bss.*") From e0fe1e4621523f02aee582c61f7d5d0a22d14316 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 18 Oct 2024 12:13:08 -0500 Subject: [PATCH 1259/4482] samples: drivers: display: consolidate testcase.yaml Consolidate the testcase.yaml definition for the display sample where possible to use a single testcase for all shields. This won't work for all testcases, but helps avoid the pattern where a new testcase using "platform-allow" is added for every shield/board combination that needs to be run with this sample. Signed-off-by: Daniel DeGrasse --- samples/drivers/display/sample.yaml | 159 +++++----------------------- 1 file changed, 27 insertions(+), 132 deletions(-) diff --git a/samples/drivers/display/sample.yaml b/samples/drivers/display/sample.yaml index 33d72e11c740b..4a13203f27959 100644 --- a/samples/drivers/display/sample.yaml +++ b/samples/drivers/display/sample.yaml @@ -2,115 +2,12 @@ sample: description: Sample application for displays name: display_sample tests: - sample.display.shield.adafruit_2_8_tft_touch_v2: - depends_on: - - arduino_gpio - - arduino_i2c - - arduino_spi - platform_exclude: - - reel_board - - reel_board@2 - - ubx_evkannab1/nrf52832 - - stm32f769i_disco - - pan1781_evb - - pan1782_evb - - mimxrt1010_evk - extra_args: SHIELD=adafruit_2_8_tft_touch_v2 - tags: - - display - - shield - harness: console - harness_config: - fixture: fixture_display - sample.display.shield.ssd1306_128x32: - platform_allow: nrf52840dk/nrf52840 - extra_args: SHIELD=ssd1306_128x32 - tags: - - display - - shield - harness: console - harness_config: - fixture: fixture_display - sample.display.shield.ssd1306_128x64: - platform_allow: nrf52840dk/nrf52840 - extra_args: SHIELD=ssd1306_128x64 - tags: - - display - - shield - harness: console - harness_config: - fixture: fixture_display - sample.display.shield.waveshare_epaper_gdeh0213b1: - platform_allow: nrf52840dk/nrf52840 - extra_args: SHIELD=waveshare_epaper_gdeh0213b1 - harness: console - harness_config: - fixture: fixture_display - sample.display.shield.waveshare_epaper_gdew042t2: - platform_allow: nrf52840dk/nrf52840 - extra_args: SHIELD=waveshare_epaper_gdew042t2 - harness: console - harness_config: - fixture: fixture_display - sample.display.st7789v_tl019fqv01: - platform_allow: nrf52dk/nrf52832 - extra_args: SHIELD=st7789v_tl019fqv01 - tags: - - display - - shield - harness: console - harness_config: - fixture: fixture_display - sample.display.st7789v_waveshare_240x240: - platform_allow: nrf52dk/nrf52832 - extra_args: SHIELD=st7789v_waveshare_240x240 - tags: - - display - - shield - harness: console - harness_config: - fixture: fixture_display - sample.display.ls013b7dh03: - platform_allow: nrf52dk/nrf52832 - extra_args: SHIELD=ls013b7dh03 - tags: - - display - - shield - harness: console - harness_config: - fixture: fixture_display - sample.display.st7735r_ada_160x128: - platform_allow: nrf52dk/nrf52832 - extra_args: SHIELD=st7735r_ada_160x128 - tags: - - display - - shield - harness: console - harness_config: - fixture: fixture_display - sample.display.mcux_dcnano_lcdif: - platform_allow: mimxrt595_evk/mimxrt595s/cm33 - tags: display - harness: console - extra_args: SHIELD=rk055hdmipi4m - harness_config: - fixture: fixture_display sample.display.sdl: build_only: true platform_allow: - native_posix/native/64 - native_sim/native/64 tags: display - sample.display.mipi_dbi: - platform_allow: - - da1469x_dk_pro - extra_args: DTC_OVERLAY_FILE="da1469x_dk_pro_mipi_dbi.overlay" - tags: - - display - - mipi_dbi - harness: console - harness_config: - fixture: fixture_display sample.display.dummy: platform_allow: - native_posix @@ -121,25 +18,6 @@ tests: - CONFIG_SDL_DISPLAY=n - CONFIG_TEST=y tags: display - sample.display.max7219: - platform_allow: nrf52840dk/nrf52840 - extra_args: SHIELD=max7219_8x8 - tags: - - display - - shield - harness: console - harness_config: - fixture: fixture_display - sample.display.st_b_lcd40_dsi1_mb1166: - filter: dt_compat_enabled("orisetech,otm8009a") - platform_allow: stm32h747i_disco/stm32h747xx/m7 - extra_args: SHIELD=st_b_lcd40_dsi1_mb1166 - tags: - - display - - shield - harness: console - harness_config: - fixture: fixture_display sample.display.g1120b0mipi: platform_allow: mimxrt595_evk/mimxrt595s/cm33 tags: display @@ -169,7 +47,7 @@ tests: harness: console harness_config: fixture: fixture_display - sample.display.rk043fn66hs_ctg: + sample.display.rk043fn02h_ct: platform_allow: - mimxrt1064_evk - mimxrt1060_evk @@ -177,17 +55,34 @@ tests: - mimxrt1040_evk tags: display harness: console - extra_args: SHIELD=rk043fn66hs_ctg + extra_args: SHIELD=rk043fn02h_ct harness_config: fixture: fixture_display - sample.display.rk043fn02h_ct: - platform_allow: - - mimxrt1064_evk - - mimxrt1060_evk - - mimxrt1050_evk - - mimxrt1040_evk - tags: display + sample.display.shield: + # This test case is intended to verify support for shields on boards + # known to support them. It is not intended to cover all combinations + # of boards and shields, but rather serve as a method to test each + # display shield within Zephyr + filter: dt_chosen_enabled("zephyr,display") harness: console - extra_args: SHIELD=rk043fn02h_ct harness_config: fixture: fixture_display + extra_args: + - platform:lpcxpresso55s69/lpc55s69/cpu0:SHIELD=adafruit_2_8_tft_touch_v2 + - platform:nrf52840dk/nrf52840:SHIELD=ssd1306_128x32 + - platform:frdm_k64f:SHIELD=ssd1306_128x64 + - platform:mimxrt685_evk/mimxrt685/cm33:SHIELD=waveshare_epaper_gdeh0213b1 + - platform:nucleo_l433rc_p:SHIELD=waveshare_epaper_gdew042t2 + - platform:nrf52dk/nrf52832:SHIELD=st7789v_tl019fqv01 + - platform:lpcxpresso54114/lpc54114/m4:SHIELD=st7789v_waveshare_240x240 + - platform:frdm_k22f:SHIELD=ls013b7dh03 + - platform:nrf52833dk/nrf52833:SHIELD=st7735r_ada_160x128 + - platform:mimxrt1170_evk@B/mimxrt1176/cm7:SHIELD=rk055hdmipi4m + - platform:da1469x_dk_pro:DTC_OVERLAY_FILE=da1469x_dk_pro_mipi_dbi.overlay + - platform:nrf52840dk/nrf52840:SHIELD=max7219_8x8 + - platform:stm32h747i_disco/stm32h747xx/m7:SHIELD=st_b_lcd40_dsi1_mb1166 + - platform:mimxrt1064_evk:SHIELD=rk043fn66hs_ctg + - platform:mimxrt1060_evk:SHIELD=rk043fn66hs_ctg + - platform:mimxrt1050_evk:SHIELD=rk043fn66hs_ctg + - platform:mimxrt1040_evk:SHIELD=rk043fn66hs_ctg + - platform:frdm_mcxn947/mcxn947/cpu0:SHIELD=lcd_par_s035_8080 From 87f85e4296ddb2cefabc94aa0385e4b3c33177a7 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Thu, 10 Oct 2024 00:44:07 +0200 Subject: [PATCH 1260/4482] doc: stepper: update stepper documentation This commit adds documentation about stepper api along with some minor cleanups Signed-off-by: Jilay Pandya --- doc/hardware/peripherals/stepper.rst | 65 +++++++++++++++---- dts/bindings/stepper/adi/adi,tmc5041.yaml | 55 +++++++++++++++- include/zephyr/drivers/stepper.h | 4 +- .../zephyr/drivers/stepper/stepper_trinamic.h | 1 + 4 files changed, 110 insertions(+), 15 deletions(-) diff --git a/doc/hardware/peripherals/stepper.rst b/doc/hardware/peripherals/stepper.rst index 9a74299cc7da9..e689de3dac2f2 100644 --- a/doc/hardware/peripherals/stepper.rst +++ b/doc/hardware/peripherals/stepper.rst @@ -1,24 +1,65 @@ .. _stepper_api: -Stepper API -########### +Steppers +######## -Overview -******** +The stepper driver API provides a set of functions for controlling and configuring stepper drivers. -The Stepper API provides a set of functions for controlling and configuring stepper motors. -It supports a variety of operations, including enabling/disabling the controller, setting the -target position of the motor and thereby setting the motor in motion, setting/getting the actual -position of the motor and so on. +Configure Stepper Driver +======================== -Configuration Options -********************* +- Configure **micro-stepping resolution** using :c:func:`stepper_set_micro_step_res` + and :c:func:`stepper_get_micro_step_res`. +- Configure **actual position a.k.a step count** in microsteps using :c:func:`stepper_set_actual_position` + and :c:func:`stepper_get_actual_position`. +- Set **max velocity** in micro-steps per second using :c:func:`stepper_set_max_velocity` +- **Enable** the stepper driver using :c:func:`stepper_enable`. -Related configuration options: +Control Stepper +=============== -* :kconfig:option:`CONFIG_STEPPER_INIT_PRIORITY` +- **Move by** +/- micro-steps also known as **relative movement** using :c:func:`stepper_move`. +- **Move to** a specific position also known as **absolute movement** + using :c:func:`stepper_set_target_position`. +- Run continuously with a **constant velocity** in a specific direction until + a stop is detected using :c:func:`stepper_enable_constant_velocity_mode`. +- Check if the stepper is **moving** using :c:func:`stepper_is_moving`. + +Device Tree +=========== + +In the context of stepper controllers device tree provides the initial hardware +configuration for stepper drivers on a per device level. Each device must specify +a device tree binding in Zephyr, and ideally, a set of hardware configuration options +for things such as current settings, ramp parameters and furthermore. These can then +be used in a boards devicetree to configure a stepper driver to its initial state. + +See examples in: + +- :dtcompatible:`adi,tmc5041` + +Discord +======= + +Zephyr has a `stepper discord`_ channel for stepper related discussions, which +is open to all. + +.. _stepper-api-reference: API Reference ************* +A common set of functions which should be implemented by all stepper drivers. + .. doxygengroup:: stepper_interface + +Stepper controller specific APIs +******************************** + +Trinamic +======== + +.. doxygengroup:: trinamic_stepper_interface + +.. _stepper discord: + https://discord.com/channels/720317445772017664/1278263869982375946 diff --git a/dts/bindings/stepper/adi/adi,tmc5041.yaml b/dts/bindings/stepper/adi/adi,tmc5041.yaml index 882a18284ddd5..c944cb9bca633 100644 --- a/dts/bindings/stepper/adi/adi,tmc5041.yaml +++ b/dts/bindings/stepper/adi/adi,tmc5041.yaml @@ -1,7 +1,60 @@ # SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG # SPDX-License-Identifier: Apache-2.0 -description: Analog Devices TMC5041 Stepper Motor Controller +description: | + Analog Devices TMC5041 Stepper Motor Controller + + Example: + + #include + + &spi0 { + /* SPI bus options here, not shown */ + + /* Dual controller/driver for up to two 2-phase bipolar stepper motors */ + tmc5041: tmc5041@0 { + compatible = "adi,tmc5041"; + reg = <0>; + spi-max-frequency = ; /* Maximum SPI bus frequency */ + + #address-cells = <1>; + #size-cells = <0>; + + poscmp_enable; test_mode; lock_gconf; /* ADI TMC Global configuration flags */ + clock-frequency = ; /* Internal/External Clock frequency */ + + motor: motor@0 { + status = "okay"; + reg = <0>; + + /* common stepper controller settings */ + invert-direction; + micro-step-res = <256>; + + /* ADI TMC stallguard settings specific to TMC5041 */ + activate-stallguard2; + stallguard-velocity-check-interval-ms=<100>; + stallguard2-threshold=<9>; + stallguard-threshold-velocity=<500000>; + + /* ADI TMC ramp generator as well as current settings */ + vstart = <10>; + a1 = <20>; + v1 = <30>; + d1 = <40>; + vmax = <50>; + amax = <60>; + dmax = <70>; + tzerowait = <80>; + vhigh = <90>; + vcoolthrs = <100>; + ihold = <1>; + irun = <2>; + iholddelay = <3>; + }; + }; + }; + compatible: "adi,tmc5041" diff --git a/include/zephyr/drivers/stepper.h b/include/zephyr/drivers/stepper.h index 5ce2c835745af..cf584a0114fa9 100644 --- a/include/zephyr/drivers/stepper.h +++ b/include/zephyr/drivers/stepper.h @@ -14,8 +14,8 @@ #define ZEPHYR_INCLUDE_DRIVERS_STEPPER_H_ /** - * @brief Stepper Motor Controller Interface - * @defgroup stepper_interface Stepper Motor Controller Interface + * @brief Stepper Controller Interface + * @defgroup stepper_interface Stepper Controller Interface * @ingroup io_interfaces * @{ */ diff --git a/include/zephyr/drivers/stepper/stepper_trinamic.h b/include/zephyr/drivers/stepper/stepper_trinamic.h index e9c16491b331d..d36707c14b0b0 100644 --- a/include/zephyr/drivers/stepper/stepper_trinamic.h +++ b/include/zephyr/drivers/stepper/stepper_trinamic.h @@ -58,6 +58,7 @@ extern "C" { #define TMC_RAMP_IHOLDDELAY_MAX GENMASK(3, 0) #define TMC_RAMP_IHOLDDELAY_MIN 0 #define TMC_RAMP_VACTUAL_SHIFT 22 + /** * @brief Trinamic Stepper Ramp Generator data */ From bb0891431b44b7228e39e87538c033e595da7eb5 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Fri, 11 Oct 2024 01:08:20 +0200 Subject: [PATCH 1261/4482] doc: release notes: added stepper release notes Added stepper controller support to release notes for release 4.0 Signed-off-by: Jilay Pandya --- doc/releases/release-notes-4.0.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index a6655191571c2..e79f8dfd68be4 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -300,6 +300,17 @@ Drivers and Sensors * SPI +* Steppers + + * Introduced stepper controller device driver subsystem selected with + :kconfig:option:`CONFIG_STEPPER` + * Introduced stepper shell commands for controlling and configuring + stepper motors with :kconfig:option:`CONFIG_STEPPER_SHELL` + * Added support for ADI TMC5041 (:dtcompatible:`adi,tmc5041`) + * Added support for gpio-stepper-controller (:dtcompatible:`gpio-stepper-controller`) + * Added stepper api test-suite + * Added stepper shell test-suite + * USB * Video From 93a0a3a9ca89021124bc6c23770298ff0c233251 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Fri, 18 Oct 2024 10:38:35 -0500 Subject: [PATCH 1262/4482] MAINTAINERS: Devicetree: Match common bindings In addition to matching zephyr, prefixed bindings, match common bindings (assuming that common bindings are those that do not have any prefix) Signed-off-by: Declan Snyder --- MAINTAINERS.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 46e51d38ae13c..5764d0f1f632e 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -881,6 +881,7 @@ Devicetree: - galak files-regex: - dts/bindings/.*zephyr.* + - dts/bindings/[^,]+$ files: - scripts/dts/ - dts/common/ From f7ef64df28dc71e89eb0a80a5174c76bc8461330 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 18 Oct 2024 20:55:29 +0530 Subject: [PATCH 1263/4482] drivers: nrfwifi: Allow scan-only for all platforms Though nRF7000 is a special Scan only chipset, scan only can work with any nRF70 platforms, no need for this enforcement and we can keep things flexible. Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/Kconfig.nrfwifi | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/wifi/nrfwifi/Kconfig.nrfwifi b/drivers/wifi/nrfwifi/Kconfig.nrfwifi index b409261b6145a..3a84f4ea716cd 100644 --- a/drivers/wifi/nrfwifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrfwifi/Kconfig.nrfwifi @@ -62,7 +62,6 @@ config NRF70_SYSTEM_MODE config NRF70_SCAN_ONLY bool "nRF70 scan only mode" - depends on WIFI_NRF7000 help Select this option to enable scan only mode of the nRF70 driver From 67be3a166bd594ad835a91fc5e1e3b27be409026 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 3 Jul 2024 15:51:43 +0300 Subject: [PATCH 1264/4482] net: pkt: Collect net_pkt allocation statistics If CONFIG_NET_PKT_ALLOC_STATS is enabled, then "net mem" command can show net_pkt allocation statistics like succeed / failed allocation counts, average sizes and allocation time. Signed-off-by: Jukka Rissanen --- include/zephyr/net/net_pkt.h | 29 ++++- subsys/net/ip/CMakeLists.txt | 6 + subsys/net/ip/Kconfig | 9 ++ .../net/ip/iterables_net_pkt_alloc_stats.ld | 9 ++ subsys/net/ip/net_pkt.c | 115 ++++++++++++++++-- 5 files changed, 157 insertions(+), 11 deletions(-) create mode 100644 subsys/net/ip/iterables_net_pkt_alloc_stats.ld diff --git a/include/zephyr/net/net_pkt.h b/include/zephyr/net/net_pkt.h index b8998266aed2d..7693f9a79734b 100644 --- a/include/zephyr/net/net_pkt.h +++ b/include/zephyr/net/net_pkt.h @@ -50,6 +50,28 @@ struct net_context; /** @cond INTERNAL_HIDDEN */ +#if defined(CONFIG_NET_PKT_ALLOC_STATS) +struct net_pkt_alloc_stats { + uint64_t alloc_sum; + uint64_t time_sum; + uint32_t count; +}; + +struct net_pkt_alloc_stats_slab { + struct net_pkt_alloc_stats ok; + struct net_pkt_alloc_stats fail; + struct k_mem_slab *slab; +}; + +#define NET_PKT_ALLOC_STATS_DEFINE(alloc_name, slab_name) \ + STRUCT_SECTION_ITERABLE(net_pkt_alloc_stats_slab, alloc_name) = { \ + .slab = &slab_name, \ + } + +#else +#define NET_PKT_ALLOC_STATS_DEFINE(name, slab) +#endif /* CONFIG_NET_PKT_ALLOC_STATS */ + /* buffer cursor used in net_pkt */ struct net_pkt_cursor { /** Current net_buf pointer by the cursor */ @@ -145,6 +167,10 @@ struct net_pkt { }; #endif /* CONFIG_NET_PKT_RXTIME_STATS || CONFIG_NET_PKT_TXTIME_STATS */ +#if defined(CONFIG_NET_PKT_ALLOC_STATS) + struct net_pkt_alloc_stats_slab *alloc_stats; +#endif /* CONFIG_NET_PKT_ALLOC_STATS */ + /** Reference counter */ atomic_t atomic_ref; @@ -1452,7 +1478,8 @@ static inline void net_pkt_set_remote_address(struct net_pkt *pkt, * @param count Number of net_pkt in this slab. */ #define NET_PKT_SLAB_DEFINE(name, count) \ - K_MEM_SLAB_DEFINE(name, sizeof(struct net_pkt), count, 4) + K_MEM_SLAB_DEFINE(name, sizeof(struct net_pkt), count, 4); \ + NET_PKT_ALLOC_STATS_DEFINE(pkt_alloc_stats_##name, name) /** @cond INTERNAL_HIDDEN */ diff --git a/subsys/net/ip/CMakeLists.txt b/subsys/net/ip/CMakeLists.txt index 0189d748f6a77..23d433930b1f7 100644 --- a/subsys/net/ip/CMakeLists.txt +++ b/subsys/net/ip/CMakeLists.txt @@ -59,6 +59,12 @@ if(CONFIG_NET_TCP_ISN_RFC6528 OR CONFIG_NET_IPV6_PE) endif() endif() +if(CONFIG_NET_PKT_ALLOC_STATS) + zephyr_linker_sources(DATA_SECTIONS iterables_net_pkt_alloc_stats.ld) + zephyr_iterable_section(NAME net_pkt_alloc_stats_slab GROUP DATA_REGION + ${XIP_ALIGN_WITH_INPUT} SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) +endif() + # To get private includes like net_shell.h zephyr_library_include_directories(. ${ZEPHYR_BASE}/subsys/net/lib) diff --git a/subsys/net/ip/Kconfig b/subsys/net/ip/Kconfig index 392ed8547d006..b61e2dd74c3cc 100644 --- a/subsys/net/ip/Kconfig +++ b/subsys/net/ip/Kconfig @@ -1011,6 +1011,15 @@ config NET_PKT_TXTIME_STATS_DETAIL The extra statistics can be seen in net-shell using "net stats" command. +config NET_PKT_ALLOC_STATS + bool "Get net_pkt allocation statistics" + help + Collect net_pkt allocation statistics, like number of allocations, + average allocation size, average allocation time in usec, for both + succeeded and failed allocations. + The extra statistics can be seen in net-shell using "net mem" + command. + config NET_PROMISCUOUS_MODE bool "Promiscuous mode support" select NET_MGMT diff --git a/subsys/net/ip/iterables_net_pkt_alloc_stats.ld b/subsys/net/ip/iterables_net_pkt_alloc_stats.ld new file mode 100644 index 0000000000000..a6064c202ecd5 --- /dev/null +++ b/subsys/net/ip/iterables_net_pkt_alloc_stats.ld @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +ITERABLE_SECTION_RAM(net_pkt_alloc_stats_slab, Z_LINK_ITERABLE_SUBALIGN) diff --git a/subsys/net/ip/net_pkt.c b/subsys/net/ip/net_pkt.c index a5d776ad8ed1e..aa679c7bbc5aa 100644 --- a/subsys/net/ip/net_pkt.c +++ b/subsys/net/ip/net_pkt.c @@ -128,8 +128,8 @@ BUILD_ASSERT(CONFIG_NET_BUF_DATA_SIZE >= 96); #error "Minimum value for CONFIG_NET_BUF_TX_COUNT is 1" #endif -K_MEM_SLAB_DEFINE(rx_pkts, sizeof(struct net_pkt), CONFIG_NET_PKT_RX_COUNT, 4); -K_MEM_SLAB_DEFINE(tx_pkts, sizeof(struct net_pkt), CONFIG_NET_PKT_TX_COUNT, 4); +NET_PKT_SLAB_DEFINE(rx_pkts, CONFIG_NET_PKT_RX_COUNT); +NET_PKT_SLAB_DEFINE(tx_pkts, CONFIG_NET_PKT_TX_COUNT); #if defined(CONFIG_NET_BUF_FIXED_DATA_SIZE) @@ -866,17 +866,79 @@ void net_pkt_print(void) /* New allocator and API starts here */ +#if defined(CONFIG_NET_PKT_ALLOC_STATS) +static struct net_pkt_alloc_stats_slab *find_alloc_stats(struct k_mem_slab *slab) +{ + STRUCT_SECTION_FOREACH(net_pkt_alloc_stats_slab, tmp) { + if (tmp->slab == slab) { + return tmp; + } + } + + NET_ASSERT("slab not found"); + + /* This will force a crash which is intended in this case as the + * slab should always have a valid value. + */ + return NULL; +} + +#define NET_PKT_ALLOC_STATS_UPDATE(pkt, alloc_size, start) ({ \ + if (pkt->alloc_stats == NULL) { \ + pkt->alloc_stats = find_alloc_stats(pkt->slab); \ + } \ + pkt->alloc_stats->ok.count++; \ + if (pkt->alloc_stats->ok.count == 0) { \ + pkt->alloc_stats->ok.alloc_sum = 0ULL; \ + pkt->alloc_stats->ok.time_sum = 0ULL; \ + } else { \ + pkt->alloc_stats->ok.alloc_sum += (uint64_t)alloc_size; \ + pkt->alloc_stats->ok.time_sum += (uint64_t)(k_cycle_get_32() - start); \ + } \ + \ + pkt->alloc_stats->ok.count; \ +}) + +#define NET_PKT_ALLOC_STATS_FAIL(pkt, alloc_size, start) ({ \ + if (pkt->alloc_stats == NULL) { \ + pkt->alloc_stats = find_alloc_stats(pkt->slab); \ + } \ + pkt->alloc_stats->fail.count++; \ + if (pkt->alloc_stats->fail.count == 0) { \ + pkt->alloc_stats->fail.alloc_sum = 0ULL; \ + pkt->alloc_stats->fail.time_sum = 0ULL; \ + } else { \ + pkt->alloc_stats->fail.alloc_sum += (uint64_t)alloc_size;\ + pkt->alloc_stats->fail.time_sum += (uint64_t)(k_cycle_get_32() - start); \ + } \ + \ + pkt->alloc_stats->fail.count; \ +}) +#else +#define NET_PKT_ALLOC_STATS_UPDATE(pkt, alloc_size, start) ({ 0; }) +#define NET_PKT_ALLOC_STATS_FAIL(pkt, alloc_size, start) ({ 0; }) +#endif /* CONFIG_NET_PKT_ALLOC_STATS */ + #if defined(CONFIG_NET_BUF_FIXED_DATA_SIZE) #if NET_LOG_LEVEL >= LOG_LEVEL_DBG -static struct net_buf *pkt_alloc_buffer(struct net_buf_pool *pool, +static struct net_buf *pkt_alloc_buffer(struct net_pkt *pkt, + struct net_buf_pool *pool, size_t size, k_timeout_t timeout, const char *caller, int line) #else -static struct net_buf *pkt_alloc_buffer(struct net_buf_pool *pool, +static struct net_buf *pkt_alloc_buffer(struct net_pkt *pkt, + struct net_buf_pool *pool, size_t size, k_timeout_t timeout) #endif { +#if defined(CONFIG_NET_PKT_ALLOC_STATS) + uint32_t start_time = k_cycle_get_32(); + size_t total_size = size; +#else + ARG_UNUSED(pkt); +#endif + k_timepoint_t end = sys_timepoint_calc(timeout); struct net_buf *first = NULL; struct net_buf *current = NULL; @@ -915,28 +977,49 @@ static struct net_buf *pkt_alloc_buffer(struct net_buf_pool *pool, #endif } while (size); +#if defined(CONFIG_NET_PKT_ALLOC_STATS) + if (NET_PKT_ALLOC_STATS_UPDATE(pkt, total_size, start_time) == 0) { + NET_DBG("pkt %p %s stats rollover", pkt, "ok"); + } +#endif + return first; error: if (first) { net_buf_unref(first); } +#if defined(CONFIG_NET_PKT_ALLOC_STATS) + if (NET_PKT_ALLOC_STATS_FAIL(pkt, total_size, start_time) == 0) { + NET_DBG("pkt %p %s stats rollover", pkt, "fail"); + } +#endif + return NULL; } #else /* !CONFIG_NET_BUF_FIXED_DATA_SIZE */ #if NET_LOG_LEVEL >= LOG_LEVEL_DBG -static struct net_buf *pkt_alloc_buffer(struct net_buf_pool *pool, +static struct net_buf *pkt_alloc_buffer(struct net_pkt *pkt, + struct net_buf_pool *pool, size_t size, k_timeout_t timeout, const char *caller, int line) #else -static struct net_buf *pkt_alloc_buffer(struct net_buf_pool *pool, +static struct net_buf *pkt_alloc_buffer(struct net_pkt *pkt, + struct net_buf_pool *pool, size_t size, k_timeout_t timeout) #endif { struct net_buf *buf; +#if defined(CONFIG_NET_PKT_ALLOC_STATS) + uint32_t start_time = k_cycle_get_32(); + size_t total_size = size; +#else + ARG_UNUSED(pkt); +#endif + buf = net_buf_alloc_len(pool, size, timeout); #if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG @@ -949,6 +1032,18 @@ static struct net_buf *pkt_alloc_buffer(struct net_buf_pool *pool, buf, buf->ref, caller, line); #endif +#if defined(CONFIG_NET_PKT_ALLOC_STATS) + if (buf) { + if (NET_PKT_ALLOC_STATS_UPDATE(pkt, total_size, start_time) == 0) { + NET_DBG("pkt %p %s stats rollover", pkt, "ok"); + } + } else { + if (NET_PKT_ALLOC_STATS_FAIL(pkt, total_size, start_time) == 0) { + NET_DBG("pkt %p %s stats rollover", pkt, "fail"); + } + } +#endif /* CONFIG_NET_PKT_ALLOC_STATS */ + return buf; } @@ -1188,9 +1283,9 @@ int net_pkt_alloc_buffer(struct net_pkt *pkt, } #if NET_LOG_LEVEL >= LOG_LEVEL_DBG - buf = pkt_alloc_buffer(pool, alloc_len, timeout, caller, line); + buf = pkt_alloc_buffer(pkt, pool, alloc_len, timeout, caller, line); #else - buf = pkt_alloc_buffer(pool, alloc_len, timeout); + buf = pkt_alloc_buffer(pkt, pool, alloc_len, timeout); #endif if (!buf) { @@ -1240,9 +1335,9 @@ int net_pkt_alloc_buffer_raw(struct net_pkt *pkt, size_t size, } #if NET_LOG_LEVEL >= LOG_LEVEL_DBG - buf = pkt_alloc_buffer(pool, size, timeout, caller, line); + buf = pkt_alloc_buffer(pkt, pool, size, timeout, caller, line); #else - buf = pkt_alloc_buffer(pool, size, timeout); + buf = pkt_alloc_buffer(pkt, pool, size, timeout); #endif if (!buf) { From d3fbc366eaa843a3fd7d1b72d6c8f9c224d22296 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 18 Oct 2024 17:41:45 +0300 Subject: [PATCH 1265/4482] net: shell: mem: Add net_pkt allocation statistics printout The "net mem" command can show extra information for net_pkt allocations. Signed-off-by: Jukka Rissanen --- subsys/net/lib/shell/mem.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/subsys/net/lib/shell/mem.c b/subsys/net/lib/shell/mem.c index 7bbe0b5e21402..400f1be8baac2 100644 --- a/subsys/net/lib/shell/mem.c +++ b/subsys/net/lib/shell/mem.c @@ -153,6 +153,28 @@ static int cmd_net_mem(const struct shell *sh, size_t argc, char *argv[]) PR("No external memory pools found.\n"); } } + +#if defined(CONFIG_NET_PKT_ALLOC_STATS) + PR("\n"); + PR("Slab\t\tStatus\tAllocs\tAvg size\tAvg time (usec)\n"); + + STRUCT_SECTION_FOREACH(net_pkt_alloc_stats_slab, stats) { + if (stats->ok.count) { + PR("%p\tOK \t%u\t%llu\t\t%llu\n", stats->slab, stats->ok.count, + stats->ok.alloc_sum / (uint64_t)stats->ok.count, + k_cyc_to_us_ceil64(stats->ok.time_sum / + (uint64_t)stats->ok.count)); + } + + if (stats->fail.count) { + PR("%p\tFAIL\t%u\t%llu\t\t%llu\n", stats->slab, stats->fail.count, + stats->fail.alloc_sum / (uint64_t)stats->fail.count, + k_cyc_to_us_ceil64(stats->fail.time_sum / + (uint64_t)stats->fail.count)); + } + } +#endif /* CONFIG_NET_PKT_ALLOC_STATS */ + #else PR_INFO("Set %s to enable %s support.\n", "CONFIG_NET_OFFLOAD or CONFIG_NET_NATIVE", "memory usage"); From 12dadf7a2435447aed1ad582c53830c88b385a30 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 21 Oct 2024 08:51:29 +0300 Subject: [PATCH 1266/4482] tests: net: pkt: Add build test for allocation statistics Make sure we build test the allocation statistics. Signed-off-by: Jukka Rissanen --- tests/net/net_pkt/testcase.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/net/net_pkt/testcase.yaml b/tests/net/net_pkt/testcase.yaml index 3a673c00d82d1..3dfcd26bf5924 100644 --- a/tests/net/net_pkt/testcase.yaml +++ b/tests/net/net_pkt/testcase.yaml @@ -13,3 +13,6 @@ tests: extra_configs: - CONFIG_NET_BUF_FIXED_DATA_SIZE=y - CONFIG_NET_BUF_DATA_SIZE=512 + net.packet.allocation_stats: + extra_configs: + - CONFIG_NET_PKT_ALLOC_STATS=y From 7c809b99450c28d599ee62aacdbf43f9050f27e7 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 18 Oct 2024 10:02:10 +0200 Subject: [PATCH 1267/4482] serial: xilinx: uartlite: switch to `DT_INST_IRQN_BY_IDX` Use DT_*IRQN helper to get the IRQ number on systems with multi-level interrupt configuration instead of IRQ number on particular interrupt controller. Signed-off-by: Michal Simek --- drivers/serial/uart_xlnx_uartlite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/serial/uart_xlnx_uartlite.c b/drivers/serial/uart_xlnx_uartlite.c index a5a27198d2ad1..1a4b045649468 100644 --- a/drivers/serial/uart_xlnx_uartlite.c +++ b/drivers/serial/uart_xlnx_uartlite.c @@ -377,7 +377,7 @@ static const struct uart_driver_api xlnx_uartlite_driver_api = { #ifdef CONFIG_UART_INTERRUPT_DRIVEN #define XLNX_UARTLITE_IRQ_INIT(n, i) \ do { \ - IRQ_CONNECT(DT_INST_IRQ_BY_IDX(n, i, irq), \ + IRQ_CONNECT(DT_INST_IRQN_BY_IDX(n, i), \ DT_INST_IRQ_BY_IDX(n, i, priority), \ xlnx_uartlite_isr, \ DEVICE_DT_INST_GET(n), 0); \ From afb7d961d21c161cf66f85418c1f9992a1586fdd Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Fri, 18 Oct 2024 13:44:41 +0200 Subject: [PATCH 1268/4482] tests: Bluetooth: tester: Add nRF5340 ADK as platform Add support for building and running the BT tester on the nrf5340_audio_dk. This is copying the configuration used for the nRF5340 DK. Signed-off-by: Emil Gydesen --- .../nrf5340_audio_dk_nrf5340_cpuapp.conf | 25 +++++++++++++++++++ .../nrf5340_audio_dk_nrf5340_cpuapp.overlay | 14 +++++++++++ tests/bluetooth/tester/testcase.yaml | 1 + 3 files changed, 40 insertions(+) create mode 100644 tests/bluetooth/tester/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf create mode 100644 tests/bluetooth/tester/boards/nrf5340_audio_dk_nrf5340_cpuapp.overlay diff --git a/tests/bluetooth/tester/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf b/tests/bluetooth/tester/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf new file mode 100644 index 0000000000000..6f723ffa16015 --- /dev/null +++ b/tests/bluetooth/tester/boards/nrf5340_audio_dk_nrf5340_cpuapp.conf @@ -0,0 +1,25 @@ +# CONFIG_TEST enforces minimal logging, which we don't want +CONFIG_TEST=n + +CONFIG_ASSERT=y +# Enable the option below to measure stack usage +#CONFIG_INIT_STACKS=y +CONFIG_THREAD_NAME=y +CONFIG_HW_STACK_PROTECTION=y + +CONFIG_LOG=y +CONFIG_LOG_BUFFER_SIZE=4096 +CONFIG_RTT_CONSOLE=y +CONFIG_LOG_BACKEND_RTT=y +CONFIG_LOG_BACKEND_RTT_MODE_DROP=y +CONFIG_USE_SEGGER_RTT=y +CONFIG_SEGGER_RTT_BUFFER_SIZE_UP=4096 +CONFIG_LOG_BACKEND_SHOW_COLOR=n +CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=1024 + +CONFIG_LOG_DEFAULT_LEVEL=3 +CONFIG_BTTESTER_LOG_LEVEL_DBG=y + +CONFIG_UART_INTERRUPT_DRIVEN=y + +CONFIG_BT_TINYCRYPT_ECC=y diff --git a/tests/bluetooth/tester/boards/nrf5340_audio_dk_nrf5340_cpuapp.overlay b/tests/bluetooth/tester/boards/nrf5340_audio_dk_nrf5340_cpuapp.overlay new file mode 100644 index 0000000000000..12d45e2d0f294 --- /dev/null +++ b/tests/bluetooth/tester/boards/nrf5340_audio_dk_nrf5340_cpuapp.overlay @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +/ { + chosen { + zephyr,uart-pipe = &uart0; + }; +}; + +&uart0 { + compatible = "nordic,nrf-uarte"; + current-speed = <115200>; + status = "okay"; + hw-flow-control; +}; diff --git a/tests/bluetooth/tester/testcase.yaml b/tests/bluetooth/tester/testcase.yaml index 5af4a957fae87..80d96ef028763 100644 --- a/tests/bluetooth/tester/testcase.yaml +++ b/tests/bluetooth/tester/testcase.yaml @@ -22,6 +22,7 @@ tests: - qemu_x86 - native_sim - nrf5340dk/nrf5340/cpuapp + - nrf5340_audio_dk/nrf5340/cpuapp extra_args: OVERLAY_CONFIG="overlay-le-audio.conf" tags: bluetooth harness: bluetooth From d1678a51dee342875c6c696732facda95d89e9dc Mon Sep 17 00:00:00 2001 From: Mert Vatansever Date: Fri, 22 Sep 2023 17:11:43 +0300 Subject: [PATCH 1269/4482] drivers: flash: Add MAX32xxx flash driver Support flash read, write, erase features. Signed-off-by: Mert Vatansever Signed-off-by: Sadik Ozer --- drivers/flash/CMakeLists.txt | 1 + drivers/flash/Kconfig | 1 + drivers/flash/Kconfig.max32 | 12 +++ drivers/flash/flash_max32.c | 177 +++++++++++++++++++++++++++++++++++ 4 files changed, 191 insertions(+) create mode 100644 drivers/flash/Kconfig.max32 create mode 100644 drivers/flash/flash_max32.c diff --git a/drivers/flash/CMakeLists.txt b/drivers/flash/CMakeLists.txt index 97d9cd5505939..4bc76b2d5165f 100644 --- a/drivers/flash/CMakeLists.txt +++ b/drivers/flash/CMakeLists.txt @@ -47,6 +47,7 @@ zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_ESP32 flash_esp32.c) zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_GECKO flash_gecko.c) zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_ITE_IT8XXX2 flash_ite_it8xxx2.c) zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_LPC soc_flash_lpc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_MAX32 flash_max32.c) zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_MCUX soc_flash_mcux.c) zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NIOS2_QSPI soc_flash_nios2_qspi.c) zephyr_library_sources_ifdef(CONFIG_SOC_FLASH_NRF soc_flash_nrf.c) diff --git a/drivers/flash/Kconfig b/drivers/flash/Kconfig index 4ab3e9da14f91..bc9f6e69d7e35 100644 --- a/drivers/flash/Kconfig +++ b/drivers/flash/Kconfig @@ -177,6 +177,7 @@ source "drivers/flash/Kconfig.gecko" source "drivers/flash/Kconfig.ifx_cat1" source "drivers/flash/Kconfig.it8xxx2" source "drivers/flash/Kconfig.lpc" +source "drivers/flash/Kconfig.max32" source "drivers/flash/Kconfig.mcux" source "drivers/flash/Kconfig.mspi" source "drivers/flash/Kconfig.nios2_qspi" diff --git a/drivers/flash/Kconfig.max32 b/drivers/flash/Kconfig.max32 new file mode 100644 index 0000000000000..fd7cb0a859147 --- /dev/null +++ b/drivers/flash/Kconfig.max32 @@ -0,0 +1,12 @@ +# Copyright (c) 2023 Analog Devices, Inc. +# SPDX-License-Identifier: Apache-2.0 + +config SOC_FLASH_MAX32 + bool "ADI MAX32 flash driver" + default y + depends on DT_HAS_ADI_MAX32_FLASH_CONTROLLER_ENABLED + select FLASH_HAS_DRIVER_ENABLED + select FLASH_HAS_EXPLICIT_ERASE + select FLASH_HAS_PAGE_LAYOUT + help + Enable MAX32 internal flash driver. diff --git a/drivers/flash/flash_max32.c b/drivers/flash/flash_max32.c new file mode 100644 index 0000000000000..9e75f0557a22e --- /dev/null +++ b/drivers/flash/flash_max32.c @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2023-2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT adi_max32_flash_controller + +#include +#include +#include +#include + +#include "flc.h" + +struct max32_flash_dev_config { + uint32_t flash_base; + uint32_t flash_erase_blk_sz; + struct flash_parameters parameters; +#if CONFIG_FLASH_PAGE_LAYOUT + struct flash_pages_layout pages_layouts; +#endif /* CONFIG_FLASH_PAGE_LAYOUT */ +}; + +struct max32_flash_dev_data { +#ifdef CONFIG_MULTITHREADING + struct k_sem sem; +#endif +}; + +#ifdef CONFIG_MULTITHREADING +static inline void max32_sem_take(const struct device *dev) +{ + struct max32_flash_dev_data *data = dev->data; + + k_sem_take(&data->sem, K_FOREVER); +} + +static inline void max32_sem_give(const struct device *dev) +{ + struct max32_flash_dev_data *data = dev->data; + + k_sem_give(&data->sem); +} +#else + +#define max32_sem_take(dev) +#define max32_sem_give(dev) + +#endif /* CONFIG_MULTITHREADING */ + +static int api_read(const struct device *dev, off_t address, void *buffer, size_t length) +{ + const struct max32_flash_dev_config *const cfg = dev->config; + + address += cfg->flash_base; + MXC_FLC_Read(address, buffer, length); + return 0; +} + +static int api_write(const struct device *dev, off_t address, const void *buffer, size_t length) +{ + const struct max32_flash_dev_config *const cfg = dev->config; + int ret = 0; + + max32_sem_take(dev); + + address += cfg->flash_base; + ret = MXC_FLC_Write(address, length, (uint32_t *)buffer); + + max32_sem_give(dev); + + return ret != 0 ? -EIO : 0; +} + +static int api_erase(const struct device *dev, off_t start, size_t len) +{ + const struct max32_flash_dev_config *const cfg = dev->config; + uint32_t page_size = cfg->flash_erase_blk_sz; + uint32_t addr = (start + cfg->flash_base); + int ret = 0; + + max32_sem_take(dev); + + while (len) { + ret = MXC_FLC_PageErase(addr); + if (ret) { + break; + } + + addr += page_size; + if (len > page_size) { + len -= page_size; + } else { + len = 0; + } + } + + max32_sem_give(dev); + + return ret != 0 ? -EIO : 0; +} + +#if CONFIG_FLASH_PAGE_LAYOUT +static void api_page_layout(const struct device *dev, const struct flash_pages_layout **layout, + size_t *layout_size) +{ + const struct max32_flash_dev_config *const cfg = dev->config; + + *layout = &cfg->pages_layouts; + *layout_size = 1; +} +#endif /* CONFIG_FLASH_PAGE_LAYOUT */ + +static const struct flash_parameters *api_get_parameters(const struct device *dev) +{ + const struct max32_flash_dev_config *const cfg = dev->config; + + return &cfg->parameters; +} + +static int flash_max32_init(const struct device *dev) +{ + int ret = MXC_FLC_Init(); + +#ifdef CONFIG_MULTITHREADING + struct max32_flash_dev_data *data = dev->data; + + /* Mutex for flash controller */ + k_sem_init(&data->sem, 1, 1); +#endif + return ret != 0 ? -EIO : 0; +} + +static const struct flash_driver_api flash_max32_driver_api = { + .read = api_read, + .write = api_write, + .erase = api_erase, + .get_parameters = api_get_parameters, +#ifdef CONFIG_FLASH_PAGE_LAYOUT + .page_layout = api_page_layout, +#endif +}; + +#if CONFIG_FLASH_PAGE_LAYOUT +#define FLASH_MAX32_CONFIG_PAGE_LAYOUT(n) \ + .pages_layouts = { \ + .pages_count = DT_INST_FOREACH_CHILD(n, GET_FLASH_SIZE) / \ + DT_INST_FOREACH_CHILD(n, GET_ERASE_BLOCK_SIZE), \ + .pages_size = DT_INST_FOREACH_CHILD(n, GET_ERASE_BLOCK_SIZE), \ + }, +#else +#define FLASH_MAX32_CONFIG_PAGE_LAYOUT(n) +#endif + +#define GET_WRITE_BLOCK_SIZE(n) DT_PROP(n, write_block_size) +#define GET_ERASE_BLOCK_SIZE(n) DT_PROP(n, erase_block_size) +#define GET_FLASH_BASE(n) DT_REG_ADDR(n) +#define GET_FLASH_SIZE(n) DT_REG_SIZE(n) + +#define DEFINE_FLASH_MAX32(_num) \ + static const struct max32_flash_dev_config max32_flash_dev_cfg_##_num = { \ + .flash_base = DT_INST_FOREACH_CHILD(_num, GET_FLASH_BASE), \ + .flash_erase_blk_sz = DT_INST_FOREACH_CHILD(_num, GET_ERASE_BLOCK_SIZE), \ + .parameters = \ + { \ + .write_block_size = \ + DT_INST_FOREACH_CHILD(_num, GET_WRITE_BLOCK_SIZE), \ + .erase_value = 0xFF, \ + }, \ + FLASH_MAX32_CONFIG_PAGE_LAYOUT(_num)}; \ + static struct max32_flash_dev_data max32_flash_dev_data_##_num; \ + DEVICE_DT_INST_DEFINE(_num, flash_max32_init, NULL, &max32_flash_dev_data_##_num, \ + &max32_flash_dev_cfg_##_num, POST_KERNEL, \ + CONFIG_FLASH_INIT_PRIORITY, &flash_max32_driver_api); + +DT_INST_FOREACH_STATUS_OKAY(DEFINE_FLASH_MAX32) From 321f735f9f9765eec2e92e10faf03441affe5481 Mon Sep 17 00:00:00 2001 From: Mert Vatansever Date: Fri, 22 Sep 2023 08:33:04 +0300 Subject: [PATCH 1270/4482] dts: arm: adi: Add binding file for MAX32xxx flash driver This commit adds flash controller driver binding file. Signed-off-by: Mert Vatansever --- dts/arm/adi/max32/max32xxx.dtsi | 2 +- .../flash_controller/adi,max32-flash-controller.yaml | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 dts/bindings/flash_controller/adi,max32-flash-controller.yaml diff --git a/dts/arm/adi/max32/max32xxx.dtsi b/dts/arm/adi/max32/max32xxx.dtsi index 838d786e1ed42..781e4bab5301a 100644 --- a/dts/arm/adi/max32/max32xxx.dtsi +++ b/dts/arm/adi/max32/max32xxx.dtsi @@ -80,7 +80,7 @@ }; flc0: flash_controller@40029000 { - compatible = "flash-controller"; + compatible = "adi,max32-flash-controller"; reg = <0x40029000 0x400>; #address-cells = <1>; diff --git a/dts/bindings/flash_controller/adi,max32-flash-controller.yaml b/dts/bindings/flash_controller/adi,max32-flash-controller.yaml new file mode 100644 index 0000000000000..7c31bfdd008cc --- /dev/null +++ b/dts/bindings/flash_controller/adi,max32-flash-controller.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2023 Analog Devices, Inc. +# SPDX-License-Identifier: Apache-2.0 + +description: MAX32XXX flash controller + +compatible: "adi,max32-flash-controller" + +include: flash-controller.yaml From 2f035613992230c7fcefe4c4911d3fb940ec724c Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Thu, 17 Oct 2024 15:32:41 +0300 Subject: [PATCH 1271/4482] soc: adi: Extract max32 flashprog section to a dedicated linker script Extracts the max32 flashprog linker section to a dedicated linker script that is conditionally included only when the flash driver is enabled. This prepares max32 soc family to set SOC_LINKER_SCRIPT directly to the common arm cortex-m linker script. Signed-off-by: Maureen Helm --- soc/adi/max32/CMakeLists.txt | 2 ++ soc/adi/max32/flash.ld | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 soc/adi/max32/flash.ld diff --git a/soc/adi/max32/CMakeLists.txt b/soc/adi/max32/CMakeLists.txt index 9941c670e8bc5..9761cdcf0b33c 100644 --- a/soc/adi/max32/CMakeLists.txt +++ b/soc/adi/max32/CMakeLists.txt @@ -5,4 +5,6 @@ zephyr_include_directories(${ZEPHYR_BASE}/drivers) zephyr_include_directories(common) zephyr_sources(soc.c) +zephyr_linker_sources_ifdef(CONFIG_SOC_FLASH_MAX32 SECTIONS flash.ld) + set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") diff --git a/soc/adi/max32/flash.ld b/soc/adi/max32/flash.ld new file mode 100644 index 0000000000000..2014e209ea740 --- /dev/null +++ b/soc/adi/max32/flash.ld @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2023 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +SECTION_DATA_PROLOGUE(.flashprog,, SUBALIGN(4)) +{ + KEEP(*(.flashprog*)) /* Flash program */ +} From f58a1993bd4bf492bd96182fdd17e1b6cdd3bb52 Mon Sep 17 00:00:00 2001 From: Mert Vatansever Date: Thu, 17 Oct 2024 11:35:55 +0300 Subject: [PATCH 1272/4482] boards: arm: adi: Add flash in MAX32xxx boards driver list Add flash in 'index.rst' and '.yaml' file of MAX32xxx boards. Signed-off-by: Mert Vatansever --- boards/adi/max32655evkit/doc/index.rst | 2 ++ boards/adi/max32655evkit/max32655evkit_max32655_m4.yaml | 1 + boards/adi/max32655fthr/doc/index.rst | 2 ++ boards/adi/max32655fthr/max32655fthr_max32655_m4.yaml | 1 + boards/adi/max32662evkit/doc/index.rst | 2 ++ boards/adi/max32662evkit/max32662evkit.yaml | 1 + boards/adi/max32666evkit/doc/index.rst | 2 ++ boards/adi/max32666evkit/max32666evkit_max32666_cpu0.yaml | 1 + boards/adi/max32666fthr/doc/index.rst | 2 ++ boards/adi/max32666fthr/max32666fthr_max32666_cpu0.yaml | 1 + boards/adi/max32670evkit/doc/index.rst | 2 ++ boards/adi/max32670evkit/max32670evkit.yaml | 1 + boards/adi/max32672evkit/doc/index.rst | 2 ++ boards/adi/max32672evkit/max32672evkit.yaml | 1 + boards/adi/max32672fthr/doc/index.rst | 2 ++ boards/adi/max32672fthr/max32672fthr.yaml | 1 + boards/adi/max32675evkit/doc/index.rst | 2 ++ boards/adi/max32675evkit/max32675evkit.yaml | 1 + boards/adi/max32680evkit/doc/index.rst | 2 ++ boards/adi/max32680evkit/max32680evkit_max32680_m4.yaml | 1 + boards/adi/max32690evkit/doc/index.rst | 2 ++ boards/adi/max32690evkit/max32690evkit_max32690_m4.yaml | 1 + boards/adi/max32690fthr/doc/index.rst | 2 ++ boards/adi/max32690fthr/max32690fthr_max32690_m4.yaml | 1 + 24 files changed, 36 insertions(+) diff --git a/boards/adi/max32655evkit/doc/index.rst b/boards/adi/max32655evkit/doc/index.rst index 8bd89afbdc268..b0eeb67689add 100644 --- a/boards/adi/max32655evkit/doc/index.rst +++ b/boards/adi/max32655evkit/doc/index.rst @@ -105,6 +105,8 @@ Below are the interfaces supported by Zephyr on MAX32655EVKIT. +-----------+------------+-------------------------------------+ | W1 | on-chip | one wire master | +-----------+------------+-------------------------------------+ +| Flash | on-chip | flash | ++-----------+------------+-------------------------------------+ Connections and IOs =================== diff --git a/boards/adi/max32655evkit/max32655evkit_max32655_m4.yaml b/boards/adi/max32655evkit/max32655evkit_max32655_m4.yaml index 61353390ff635..b65bda513bb9a 100644 --- a/boards/adi/max32655evkit/max32655evkit_max32655_m4.yaml +++ b/boards/adi/max32655evkit/max32655evkit_max32655_m4.yaml @@ -19,5 +19,6 @@ supported: - counter - pwm - w1 + - flash ram: 128 flash: 512 diff --git a/boards/adi/max32655fthr/doc/index.rst b/boards/adi/max32655fthr/doc/index.rst index bcee883611289..c58fb62855f33 100644 --- a/boards/adi/max32655fthr/doc/index.rst +++ b/boards/adi/max32655fthr/doc/index.rst @@ -116,6 +116,8 @@ Below are the interfaces supported by Zephyr on MAX32655FTHR. +-----------+------------+-------------------------------------+ | PWM | on-chip | pwm | +-----------+------------+-------------------------------------+ +| Flash | on-chip | flash | ++-----------+------------+-------------------------------------+ Push Buttons ************ diff --git a/boards/adi/max32655fthr/max32655fthr_max32655_m4.yaml b/boards/adi/max32655fthr/max32655fthr_max32655_m4.yaml index dcf188d252d9c..080662f2bea33 100644 --- a/boards/adi/max32655fthr/max32655fthr_max32655_m4.yaml +++ b/boards/adi/max32655fthr/max32655fthr_max32655_m4.yaml @@ -18,5 +18,6 @@ supported: - adc - counter - pwm + - flash ram: 128 flash: 512 diff --git a/boards/adi/max32662evkit/doc/index.rst b/boards/adi/max32662evkit/doc/index.rst index 8e74a7e729611..b474f3ca49216 100644 --- a/boards/adi/max32662evkit/doc/index.rst +++ b/boards/adi/max32662evkit/doc/index.rst @@ -113,6 +113,8 @@ Below interfaces are supported by Zephyr on MAX32662EVKIT. +-----------+------------+-------------------------------------+ | PWM | on-chip | pwm | +-----------+------------+-------------------------------------+ +| Flash | on-chip | flash | ++-----------+------------+-------------------------------------+ Connections and IOs =================== diff --git a/boards/adi/max32662evkit/max32662evkit.yaml b/boards/adi/max32662evkit/max32662evkit.yaml index 2ac28d4fe1dc2..df3a6da24bb6b 100644 --- a/boards/adi/max32662evkit/max32662evkit.yaml +++ b/boards/adi/max32662evkit/max32662evkit.yaml @@ -18,5 +18,6 @@ supported: - adc - counter - pwm + - flash ram: 80 flash: 256 diff --git a/boards/adi/max32666evkit/doc/index.rst b/boards/adi/max32666evkit/doc/index.rst index 9e6ad17f7a865..0a824fbee4263 100644 --- a/boards/adi/max32666evkit/doc/index.rst +++ b/boards/adi/max32666evkit/doc/index.rst @@ -126,6 +126,8 @@ Below interfaces are supported by Zephyr on MAX32666EVKIT. +-----------+------------+-------------------------------------+ | W1 | on-chip | one wire master | +-----------+------------+-------------------------------------+ +| Flash | on-chip | flash | ++-----------+------------+-------------------------------------+ Connections and IOs diff --git a/boards/adi/max32666evkit/max32666evkit_max32666_cpu0.yaml b/boards/adi/max32666evkit/max32666evkit_max32666_cpu0.yaml index 5944a71e98c55..782b21a273ed7 100644 --- a/boards/adi/max32666evkit/max32666evkit_max32666_cpu0.yaml +++ b/boards/adi/max32666evkit/max32666evkit_max32666_cpu0.yaml @@ -18,5 +18,6 @@ supported: - counter - pwm - w1 + - flash ram: 560 flash: 1024 diff --git a/boards/adi/max32666fthr/doc/index.rst b/boards/adi/max32666fthr/doc/index.rst index 750885fc1479c..76ee9a6288eec 100644 --- a/boards/adi/max32666fthr/doc/index.rst +++ b/boards/adi/max32666fthr/doc/index.rst @@ -127,6 +127,8 @@ Below interfaces are supported by Zephyr on MAX32666FTHR. +-----------+------------+-------------------------------------+ | W1 | on-chip | one wire master | +-----------+------------+-------------------------------------+ +| Flash | on-chip | flash | ++-----------+------------+-------------------------------------+ Connections and IOs =================== diff --git a/boards/adi/max32666fthr/max32666fthr_max32666_cpu0.yaml b/boards/adi/max32666fthr/max32666fthr_max32666_cpu0.yaml index 950ced729d0a7..8c674288dc51a 100644 --- a/boards/adi/max32666fthr/max32666fthr_max32666_cpu0.yaml +++ b/boards/adi/max32666fthr/max32666fthr_max32666_cpu0.yaml @@ -19,5 +19,6 @@ supported: - counter - pwm - w1 + - flash ram: 560 flash: 1024 diff --git a/boards/adi/max32670evkit/doc/index.rst b/boards/adi/max32670evkit/doc/index.rst index df3fbccde6c64..063094b620693 100644 --- a/boards/adi/max32670evkit/doc/index.rst +++ b/boards/adi/max32670evkit/doc/index.rst @@ -120,6 +120,8 @@ Below interfaces are supported by Zephyr on MAX32670EVKIT. +-----------+------------+-------------------------------------+ | PWM | on-chip | pwm | +-----------+------------+-------------------------------------+ +| Flash | on-chip | flash | ++-----------+------------+-------------------------------------+ Connections and IOs =================== diff --git a/boards/adi/max32670evkit/max32670evkit.yaml b/boards/adi/max32670evkit/max32670evkit.yaml index 24ffb1c6e6a9c..4541501514868 100644 --- a/boards/adi/max32670evkit/max32670evkit.yaml +++ b/boards/adi/max32670evkit/max32670evkit.yaml @@ -17,5 +17,6 @@ supported: - spi - counter - pwm + - flash ram: 160 flash: 384 diff --git a/boards/adi/max32672evkit/doc/index.rst b/boards/adi/max32672evkit/doc/index.rst index 17111faa05222..26d1967cfef9f 100644 --- a/boards/adi/max32672evkit/doc/index.rst +++ b/boards/adi/max32672evkit/doc/index.rst @@ -115,6 +115,8 @@ Below interfaces are supported by Zephyr on MAX32672EVKIT. +-----------+------------+-------------------------------------+ | PWM | on-chip | pwm | +-----------+------------+-------------------------------------+ +| Flash | on-chip | flash | ++-----------+------------+-------------------------------------+ Connections and IOs diff --git a/boards/adi/max32672evkit/max32672evkit.yaml b/boards/adi/max32672evkit/max32672evkit.yaml index b09c803c1083c..2ba0a764b1e29 100644 --- a/boards/adi/max32672evkit/max32672evkit.yaml +++ b/boards/adi/max32672evkit/max32672evkit.yaml @@ -18,5 +18,6 @@ supported: - adc - counter - pwm + - flash ram: 200 flash: 1024 diff --git a/boards/adi/max32672fthr/doc/index.rst b/boards/adi/max32672fthr/doc/index.rst index 6fc9d4d0137b8..5e6004de00d18 100644 --- a/boards/adi/max32672fthr/doc/index.rst +++ b/boards/adi/max32672fthr/doc/index.rst @@ -117,6 +117,8 @@ Below interfaces are supported by Zephyr on MAX32672FTHR. +-----------+------------+-------------------------------------+ | PWM | on-chip | pwm | +-----------+------------+-------------------------------------+ +| Flash | on-chip | flash | ++-----------+------------+-------------------------------------+ Connections and IOs diff --git a/boards/adi/max32672fthr/max32672fthr.yaml b/boards/adi/max32672fthr/max32672fthr.yaml index 277e795331d93..29560ebbe6610 100644 --- a/boards/adi/max32672fthr/max32672fthr.yaml +++ b/boards/adi/max32672fthr/max32672fthr.yaml @@ -18,5 +18,6 @@ supported: - adc - counter - pwm + - flash ram: 200 flash: 1024 diff --git a/boards/adi/max32675evkit/doc/index.rst b/boards/adi/max32675evkit/doc/index.rst index b3faf32478d99..f1eb98a0c7ab0 100644 --- a/boards/adi/max32675evkit/doc/index.rst +++ b/boards/adi/max32675evkit/doc/index.rst @@ -100,6 +100,8 @@ Below interfaces are supported by Zephyr on MAX32675EVKIT. +-----------+------------+-------------------------------------+ | PWM | on-chip | pwm | +-----------+------------+-------------------------------------+ +| Flash | on-chip | flash | ++-----------+------------+-------------------------------------+ Connections and IOs =================== diff --git a/boards/adi/max32675evkit/max32675evkit.yaml b/boards/adi/max32675evkit/max32675evkit.yaml index 39f67d8127aa7..023a35465f3ea 100644 --- a/boards/adi/max32675evkit/max32675evkit.yaml +++ b/boards/adi/max32675evkit/max32675evkit.yaml @@ -15,5 +15,6 @@ supported: - trng - spi - pwm + - flash ram: 160 flash: 384 diff --git a/boards/adi/max32680evkit/doc/index.rst b/boards/adi/max32680evkit/doc/index.rst index 15a948087c129..a006091435673 100644 --- a/boards/adi/max32680evkit/doc/index.rst +++ b/boards/adi/max32680evkit/doc/index.rst @@ -126,6 +126,8 @@ Below interfaces are supported by Zephyr on MAX32680EVKIT. +-----------+------------+-------------------------------------+ | W1 | on-chip | one wire master | +-----------+------------+-------------------------------------+ +| Flash | on-chip | flash | ++-----------+------------+-------------------------------------+ Connections and IOs =================== diff --git a/boards/adi/max32680evkit/max32680evkit_max32680_m4.yaml b/boards/adi/max32680evkit/max32680evkit_max32680_m4.yaml index 1891ffe68b4c4..1fc90758f49e9 100644 --- a/boards/adi/max32680evkit/max32680evkit_max32680_m4.yaml +++ b/boards/adi/max32680evkit/max32680evkit_max32680_m4.yaml @@ -18,5 +18,6 @@ supported: - adc - counter - w1 + - flash ram: 128 flash: 512 diff --git a/boards/adi/max32690evkit/doc/index.rst b/boards/adi/max32690evkit/doc/index.rst index 111845dc2c28c..8d2ffba10ae12 100644 --- a/boards/adi/max32690evkit/doc/index.rst +++ b/boards/adi/max32690evkit/doc/index.rst @@ -127,6 +127,8 @@ Below interfaces are supported by Zephyr on MAX32690EVKIT. +-----------+------------+-------------------------------------+ | W1 | on-chip | one wire master | +-----------+------------+-------------------------------------+ +| Flash | on-chip | flash | ++-----------+------------+-------------------------------------+ Connections and IOs diff --git a/boards/adi/max32690evkit/max32690evkit_max32690_m4.yaml b/boards/adi/max32690evkit/max32690evkit_max32690_m4.yaml index db50bd7340cf3..4c9d188777e83 100644 --- a/boards/adi/max32690evkit/max32690evkit_max32690_m4.yaml +++ b/boards/adi/max32690evkit/max32690evkit_max32690_m4.yaml @@ -19,5 +19,6 @@ supported: - counter - pwm - w1 + - flash ram: 1024 flash: 3072 diff --git a/boards/adi/max32690fthr/doc/index.rst b/boards/adi/max32690fthr/doc/index.rst index 228dc624f2270..8a8b3b45beb4d 100644 --- a/boards/adi/max32690fthr/doc/index.rst +++ b/boards/adi/max32690fthr/doc/index.rst @@ -85,6 +85,8 @@ Below interfaces are supported by Zephyr on MAX32690FTHR. +-----------+------------+-------------------------------------+ | SPI | on-chip | spi | +-----------+------------+-------------------------------------+ +| Flash | on-chip | flash | ++-----------+------------+-------------------------------------+ Programming and Debugging ************************* diff --git a/boards/adi/max32690fthr/max32690fthr_max32690_m4.yaml b/boards/adi/max32690fthr/max32690fthr_max32690_m4.yaml index bbf1af6853ff0..d81738ee74244 100644 --- a/boards/adi/max32690fthr/max32690fthr_max32690_m4.yaml +++ b/boards/adi/max32690fthr/max32690fthr_max32690_m4.yaml @@ -15,5 +15,6 @@ supported: - feather_serial - feather_i2c - feather_spi + - flash ram: 1024 flash: 3072 From 539a7a18d65f0b2e09762c299fcc6c587518452e Mon Sep 17 00:00:00 2001 From: Sadik Ozer Date: Tue, 14 Nov 2023 18:16:29 +0300 Subject: [PATCH 1273/4482] tests: drivers: flash: Add MAX32655 boards overlay file Enable flash test for MAX32655 boards. Signed-off-by: Sadik Ozer --- .../boards/max32655evkit_max32655_m4.overlay | 23 +++++++++++++++++++ .../boards/max32655fthr_max32655_m4.overlay | 23 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tests/drivers/flash/common/boards/max32655evkit_max32655_m4.overlay create mode 100644 tests/drivers/flash/common/boards/max32655fthr_max32655_m4.overlay diff --git a/tests/drivers/flash/common/boards/max32655evkit_max32655_m4.overlay b/tests/drivers/flash/common/boards/max32655evkit_max32655_m4.overlay new file mode 100644 index 0000000000000..9f957f022268b --- /dev/null +++ b/tests/drivers/flash/common/boards/max32655evkit_max32655_m4.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + code_partition: partition@0 { + reg = <0x0 DT_SIZE_K(384)>; + read-only; + }; + + storage_partition: partition@60000 { + label = "storage"; + reg = <0x60000 DT_SIZE_K(128)>; + }; + }; +}; diff --git a/tests/drivers/flash/common/boards/max32655fthr_max32655_m4.overlay b/tests/drivers/flash/common/boards/max32655fthr_max32655_m4.overlay new file mode 100644 index 0000000000000..9f957f022268b --- /dev/null +++ b/tests/drivers/flash/common/boards/max32655fthr_max32655_m4.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + code_partition: partition@0 { + reg = <0x0 DT_SIZE_K(384)>; + read-only; + }; + + storage_partition: partition@60000 { + label = "storage"; + reg = <0x60000 DT_SIZE_K(128)>; + }; + }; +}; From b2b8957d804719b70a16f86231f766642226cd38 Mon Sep 17 00:00:00 2001 From: Furkan Akkiz Date: Mon, 15 Jan 2024 13:10:32 +0300 Subject: [PATCH 1274/4482] tests: drivers: flash: Add MAX32662EVKIT board overlay file Enable flash driver test for MAX32662EVKIT board. Signed-off-by: Furkan Akkiz --- .../flash/common/boards/max32662evkit.overlay | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/drivers/flash/common/boards/max32662evkit.overlay diff --git a/tests/drivers/flash/common/boards/max32662evkit.overlay b/tests/drivers/flash/common/boards/max32662evkit.overlay new file mode 100644 index 0000000000000..01d2c6b0bfdac --- /dev/null +++ b/tests/drivers/flash/common/boards/max32662evkit.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + code_partition: partition@0 { + reg = <0x0 DT_SIZE_K(192)>; + read-only; + }; + + storage_partition: partition@30000 { + label = "storage"; + reg = <0x30000 DT_SIZE_K(64)>; + }; + }; +}; From 198518df5b9f25e4a8a1881778f75d0301c851c5 Mon Sep 17 00:00:00 2001 From: Furkan Akkiz Date: Wed, 10 Jan 2024 18:38:03 +0300 Subject: [PATCH 1275/4482] tests: drivers: flash: Add MAX32666 boards overlay file Enable flash driver test for MAX32666 boards. Signed-off-by: Furkan Akkiz --- .../max32666evkit_max32666_cpu0.overlay | 23 +++++++++++++++++++ .../boards/max32666fthr_max32666_cpu0.overlay | 23 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tests/drivers/flash/common/boards/max32666evkit_max32666_cpu0.overlay create mode 100644 tests/drivers/flash/common/boards/max32666fthr_max32666_cpu0.overlay diff --git a/tests/drivers/flash/common/boards/max32666evkit_max32666_cpu0.overlay b/tests/drivers/flash/common/boards/max32666evkit_max32666_cpu0.overlay new file mode 100644 index 0000000000000..f29875c4f04c4 --- /dev/null +++ b/tests/drivers/flash/common/boards/max32666evkit_max32666_cpu0.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + code_partition: partition@0 { + reg = <0x0 DT_SIZE_K(512)>; + read-only; + }; + + storage_partition: partition@80000 { + label = "storage"; + reg = <0x80000 DT_SIZE_K(512)>; + }; + }; +}; diff --git a/tests/drivers/flash/common/boards/max32666fthr_max32666_cpu0.overlay b/tests/drivers/flash/common/boards/max32666fthr_max32666_cpu0.overlay new file mode 100644 index 0000000000000..f29875c4f04c4 --- /dev/null +++ b/tests/drivers/flash/common/boards/max32666fthr_max32666_cpu0.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + code_partition: partition@0 { + reg = <0x0 DT_SIZE_K(512)>; + read-only; + }; + + storage_partition: partition@80000 { + label = "storage"; + reg = <0x80000 DT_SIZE_K(512)>; + }; + }; +}; From 931d89e6b889fddf786bbd91cd24ef932129729a Mon Sep 17 00:00:00 2001 From: Sadik Ozer Date: Mon, 8 Jan 2024 21:42:37 +0300 Subject: [PATCH 1276/4482] tests: drivers: flash: Add MAX32670EVKIT board overlay file Enable flash driver test for MAX32670EVKIT board. Signed-off-by: Sadik Ozer --- .../flash/common/boards/max32670evkit.overlay | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/drivers/flash/common/boards/max32670evkit.overlay diff --git a/tests/drivers/flash/common/boards/max32670evkit.overlay b/tests/drivers/flash/common/boards/max32670evkit.overlay new file mode 100644 index 0000000000000..e22ab31610aaf --- /dev/null +++ b/tests/drivers/flash/common/boards/max32670evkit.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + code_partition: partition@0 { + reg = <0x0 DT_SIZE_K(256)>; + read-only; + }; + + storage_partition: partition@20000 { + label = "storage"; + reg = <0x20000 DT_SIZE_K(128)>; + }; + }; +}; From ccd84905adcf5a8903ed93efaceb764e0fd82c32 Mon Sep 17 00:00:00 2001 From: Sadik Ozer Date: Wed, 10 Jan 2024 17:25:53 +0300 Subject: [PATCH 1277/4482] tests: drivers: flash: Add MAX32672 boards overlay file Enable flash driver test for MAX32672 boards. Signed-off-by: Sadik Ozer --- .../flash/common/boards/max32672evkit.overlay | 23 +++++++++++++++++++ .../flash/common/boards/max32672fthr.overlay | 23 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tests/drivers/flash/common/boards/max32672evkit.overlay create mode 100644 tests/drivers/flash/common/boards/max32672fthr.overlay diff --git a/tests/drivers/flash/common/boards/max32672evkit.overlay b/tests/drivers/flash/common/boards/max32672evkit.overlay new file mode 100644 index 0000000000000..e22ab31610aaf --- /dev/null +++ b/tests/drivers/flash/common/boards/max32672evkit.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + code_partition: partition@0 { + reg = <0x0 DT_SIZE_K(256)>; + read-only; + }; + + storage_partition: partition@20000 { + label = "storage"; + reg = <0x20000 DT_SIZE_K(128)>; + }; + }; +}; diff --git a/tests/drivers/flash/common/boards/max32672fthr.overlay b/tests/drivers/flash/common/boards/max32672fthr.overlay new file mode 100644 index 0000000000000..e22ab31610aaf --- /dev/null +++ b/tests/drivers/flash/common/boards/max32672fthr.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + code_partition: partition@0 { + reg = <0x0 DT_SIZE_K(256)>; + read-only; + }; + + storage_partition: partition@20000 { + label = "storage"; + reg = <0x20000 DT_SIZE_K(128)>; + }; + }; +}; From 5aae75548c3fa534c497d1b2d4bcb39c850ed6cd Mon Sep 17 00:00:00 2001 From: Sadik Ozer Date: Mon, 15 Jan 2024 17:48:53 +0300 Subject: [PATCH 1278/4482] tests: drivers: flash: Add MAX32675EVKIT board overlay file Enable flash driver test for MAX32675EVKIT board. Signed-off-by: Sadik Ozer --- .../flash/common/boards/max32675evkit.overlay | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/drivers/flash/common/boards/max32675evkit.overlay diff --git a/tests/drivers/flash/common/boards/max32675evkit.overlay b/tests/drivers/flash/common/boards/max32675evkit.overlay new file mode 100644 index 0000000000000..967c67228f170 --- /dev/null +++ b/tests/drivers/flash/common/boards/max32675evkit.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + code_partition: partition@0 { + reg = <0x0 DT_SIZE_K(256)>; + read-only; + }; + + storage_partition: partition@40000 { + label = "storage"; + reg = <0x40000 DT_SIZE_K(128)>; + }; + }; +}; From ab49ba41d42d5a39f8eebd3382d7a7d4a9a9bdc3 Mon Sep 17 00:00:00 2001 From: Tahsin Mutlugun Date: Wed, 24 Jan 2024 12:03:52 +0300 Subject: [PATCH 1279/4482] tests: drivers: flash: Add MAX32680EVKIT board overlay file Enable flash driver tests for MAX32680EVKIT board. Signed-off-by: Tahsin Mutlugun --- .../boards/max32680evkit_max32680_m4.overlay | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/drivers/flash/common/boards/max32680evkit_max32680_m4.overlay diff --git a/tests/drivers/flash/common/boards/max32680evkit_max32680_m4.overlay b/tests/drivers/flash/common/boards/max32680evkit_max32680_m4.overlay new file mode 100644 index 0000000000000..9f957f022268b --- /dev/null +++ b/tests/drivers/flash/common/boards/max32680evkit_max32680_m4.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + code_partition: partition@0 { + reg = <0x0 DT_SIZE_K(384)>; + read-only; + }; + + storage_partition: partition@60000 { + label = "storage"; + reg = <0x60000 DT_SIZE_K(128)>; + }; + }; +}; From d8753a119dd5d3b11fcc366e108d26b0ce422f0d Mon Sep 17 00:00:00 2001 From: Sadik Ozer Date: Thu, 7 Dec 2023 13:47:10 +0300 Subject: [PATCH 1280/4482] tests: drivers: flash: Add MAX32690 boards overlay file Enable flash driver test for MAX32690 boards. Signed-off-by: Mert Vatansever Signed-off-by: Sadik Ozer --- .../boards/max32690evkit_max32690_m4.overlay | 23 +++++++++++++++++++ .../boards/max32690fthr_max32690_m4.overlay | 23 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tests/drivers/flash/common/boards/max32690evkit_max32690_m4.overlay create mode 100644 tests/drivers/flash/common/boards/max32690fthr_max32690_m4.overlay diff --git a/tests/drivers/flash/common/boards/max32690evkit_max32690_m4.overlay b/tests/drivers/flash/common/boards/max32690evkit_max32690_m4.overlay new file mode 100644 index 0000000000000..977fc5ec6249e --- /dev/null +++ b/tests/drivers/flash/common/boards/max32690evkit_max32690_m4.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + code_partition: partition@0 { + reg = <0x0 DT_SIZE_M(2)>; + read-only; + }; + + storage_partition: partition@200000 { + label = "storage"; + reg = <0x200000 DT_SIZE_K(1)>; + }; + }; +}; diff --git a/tests/drivers/flash/common/boards/max32690fthr_max32690_m4.overlay b/tests/drivers/flash/common/boards/max32690fthr_max32690_m4.overlay new file mode 100644 index 0000000000000..977fc5ec6249e --- /dev/null +++ b/tests/drivers/flash/common/boards/max32690fthr_max32690_m4.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + code_partition: partition@0 { + reg = <0x0 DT_SIZE_M(2)>; + read-only; + }; + + storage_partition: partition@200000 { + label = "storage"; + reg = <0x200000 DT_SIZE_K(1)>; + }; + }; +}; From bb7626220c433f4e7058cdf4c72a1d0817c9b2f3 Mon Sep 17 00:00:00 2001 From: Neil Chen Date: Tue, 22 Oct 2024 11:11:09 +0800 Subject: [PATCH 1281/4482] dts: arm/nxp: Add Flexcan nodes to NXP MCXN23x dtsi file Add Flexcan nodes to NXP MCXN23x dtsi file Signed-off-by: Neil Chen --- dts/arm/nxp/nxp_mcxn23x_common.dtsi | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/dts/arm/nxp/nxp_mcxn23x_common.dtsi b/dts/arm/nxp/nxp_mcxn23x_common.dtsi index b5d2e8af447d1..7a8c9ff34b126 100644 --- a/dts/arm/nxp/nxp_mcxn23x_common.dtsi +++ b/dts/arm/nxp/nxp_mcxn23x_common.dtsi @@ -737,6 +737,26 @@ status = "disabled"; #io-channel-cells = <2>; }; + + flexcan0: can@d4000 { + compatible = "nxp,flexcan"; + reg = <0xd4000 0x4000>; + interrupts = <62 0>; + interrupt-names = "common"; + clocks = <&syscon MCUX_FLEXCAN0_CLK>; + clk-source = <0>; + status = "disabled"; + }; + + flexcan1: can@d8000 { + compatible = "nxp,flexcan"; + reg = <0xd8000 0x4000>; + interrupts = <63 0>; + interrupt-names = "common"; + clocks = <&syscon MCUX_FLEXCAN1_CLK>; + clk-source = <0>; + status = "disabled"; + }; }; &systick { From 61336cf6fa2cde99045d5f45bd4d0444dbec0e63 Mon Sep 17 00:00:00 2001 From: Neil Chen Date: Tue, 22 Oct 2024 11:13:27 +0800 Subject: [PATCH 1282/4482] boards: nxp/frdm_mcxn236: Support Flexcan for NXP frdm_mcxn236 board Support Flexcan for NXP frdm_mcxn236 board Signed-off-by: Neil Chen --- boards/nxp/frdm_mcxn236/board.c | 26 +++++++++++++++++++ boards/nxp/frdm_mcxn236/doc/index.rst | 2 ++ .../frdm_mcxn236/frdm_mcxn236-pinctrl.dtsi | 10 +++++++ boards/nxp/frdm_mcxn236/frdm_mcxn236.dts | 5 ++++ boards/nxp/frdm_mcxn236/frdm_mcxn236.dtsi | 5 ++++ boards/nxp/frdm_mcxn236/frdm_mcxn236.yaml | 1 + 6 files changed, 49 insertions(+) diff --git a/boards/nxp/frdm_mcxn236/board.c b/boards/nxp/frdm_mcxn236/board.c index 87decdd43353e..56e21aa3e5e73 100644 --- a/boards/nxp/frdm_mcxn236/board.c +++ b/boards/nxp/frdm_mcxn236/board.c @@ -88,6 +88,27 @@ static int frdm_mcxn236_init(void) /* Set AHBCLKDIV divider to value 1 */ CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U); + CLOCK_SetupExtClocking(BOARD_XTAL0_CLK_HZ); + +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcan1)) + /* Set up PLL1 for 80 MHz FlexCAN clock */ + const pll_setup_t pll1Setup = { + .pllctrl = SCG_SPLLCTRL_SOURCE(1U) | SCG_SPLLCTRL_SELI(27U) | + SCG_SPLLCTRL_SELP(13U), + .pllndiv = SCG_SPLLNDIV_NDIV(3U), + .pllpdiv = SCG_SPLLPDIV_PDIV(1U), + .pllmdiv = SCG_SPLLMDIV_MDIV(10U), + .pllRate = 80000000U + }; + + /* Configure PLL1 to the desired values */ + CLOCK_SetPLL1Freq(&pll1Setup); + /* PLL1 Monitor is disabled */ + CLOCK_SetPll1MonitorMode(kSCG_Pll1MonitorDisable); + /* Set PLL1 CLK0 divider to value 1 */ + CLOCK_SetClkDiv(kCLOCK_DivPLL1Clk0, 1U); +#endif + #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcomm1)) CLOCK_SetClkDiv(kCLOCK_DivFlexcom1Clk, 1u); CLOCK_AttachClk(kFRO12M_to_FLEXCOMM1); @@ -170,6 +191,11 @@ static int frdm_mcxn236_init(void) CLOCK_AttachClk(kPLL0_to_CTIMER4); #endif +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexcan1)) + CLOCK_SetClkDiv(kCLOCK_DivFlexcan1Clk, 1U); + CLOCK_AttachClk(kPLL1_CLK0_to_FLEXCAN1); +#endif + #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(vref)) CLOCK_EnableClock(kCLOCK_Vref); SPC_EnableActiveModeAnalogModules(SPC0, kSPC_controlVref); diff --git a/boards/nxp/frdm_mcxn236/doc/index.rst b/boards/nxp/frdm_mcxn236/doc/index.rst index 71174a22f0d15..515cf4d8f98f8 100644 --- a/boards/nxp/frdm_mcxn236/doc/index.rst +++ b/boards/nxp/frdm_mcxn236/doc/index.rst @@ -74,6 +74,8 @@ The FRDM-MCXN236 board configuration supports the following hardware features: +-----------+------------+-------------------------------------+ | LPCMP | on-chip | sensor(comparator) | +-----------+------------+-------------------------------------+ +| FLEXCAN | on-chip | CAN | ++-----------+------------+-------------------------------------+ Targets available ================== diff --git a/boards/nxp/frdm_mcxn236/frdm_mcxn236-pinctrl.dtsi b/boards/nxp/frdm_mcxn236/frdm_mcxn236-pinctrl.dtsi index 3412fa0a7fe89..129d6e28ce751 100644 --- a/boards/nxp/frdm_mcxn236/frdm_mcxn236-pinctrl.dtsi +++ b/boards/nxp/frdm_mcxn236/frdm_mcxn236-pinctrl.dtsi @@ -109,4 +109,14 @@ bias-pull-up; }; }; + + pinmux_flexcan1: pinmux_flexcan1 { + group0 { + pinmux = , + ; + slew-rate = "fast"; + drive-strength = "low"; + input-enable; + }; + }; }; diff --git a/boards/nxp/frdm_mcxn236/frdm_mcxn236.dts b/boards/nxp/frdm_mcxn236/frdm_mcxn236.dts index 436ebb665dfc3..e954472b3bfb0 100644 --- a/boards/nxp/frdm_mcxn236/frdm_mcxn236.dts +++ b/boards/nxp/frdm_mcxn236/frdm_mcxn236.dts @@ -21,6 +21,7 @@ zephyr,uart-mcumgr = &flexcomm4_lpuart4; zephyr,console = &flexcomm4_lpuart4; zephyr,shell-uart = &flexcomm4_lpuart4; + zephyr,canbus = &flexcan1; }; aliases{ @@ -110,6 +111,10 @@ status = "okay"; }; +&flexcan1 { + status = "okay"; +}; + &ctimer0 { status = "okay"; }; diff --git a/boards/nxp/frdm_mcxn236/frdm_mcxn236.dtsi b/boards/nxp/frdm_mcxn236/frdm_mcxn236.dtsi index ad139480fea8a..8840c69753621 100644 --- a/boards/nxp/frdm_mcxn236/frdm_mcxn236.dtsi +++ b/boards/nxp/frdm_mcxn236/frdm_mcxn236.dtsi @@ -128,3 +128,8 @@ pinctrl-0 = <&pinmux_lpcmp0>; pinctrl-names = "default"; }; + +&flexcan1 { + pinctrl-0 = <&pinmux_flexcan1>; + pinctrl-names = "default"; +}; diff --git a/boards/nxp/frdm_mcxn236/frdm_mcxn236.yaml b/boards/nxp/frdm_mcxn236/frdm_mcxn236.yaml index d01d9a447b57b..b996f3e4b4387 100644 --- a/boards/nxp/frdm_mcxn236/frdm_mcxn236.yaml +++ b/boards/nxp/frdm_mcxn236/frdm_mcxn236.yaml @@ -15,6 +15,7 @@ toolchain: - gnuarmemb - xtools supported: + - can - dma - gpio - spi From 98110e294694eb3a45b673696ac724ed0f6b9d90 Mon Sep 17 00:00:00 2001 From: Neil Chen Date: Mon, 21 Oct 2024 10:28:36 +0800 Subject: [PATCH 1283/4482] tests: drivers: can: timing: enable full timing test on frdm_mcxn236 Enable the full range of CAN timing tests on the NXP FRDM-MCXN236 board. Signed-off-by: Neil Chen --- tests/drivers/can/timing/boards/frdm_mcxn236.conf | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/drivers/can/timing/boards/frdm_mcxn236.conf diff --git a/tests/drivers/can/timing/boards/frdm_mcxn236.conf b/tests/drivers/can/timing/boards/frdm_mcxn236.conf new file mode 100644 index 0000000000000..7b071f3a54f51 --- /dev/null +++ b/tests/drivers/can/timing/boards/frdm_mcxn236.conf @@ -0,0 +1 @@ +CONFIG_TEST_ALL_BITRATES=y From 0b11b39461958c25be6855e139124a8a4352e88a Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Thu, 17 Oct 2024 19:01:23 +0530 Subject: [PATCH 1284/4482] drivers: wifi: Add Kconfig option for passive scan Add kconfig option for forced passive scan, It will use for only scan only mode. Signed-off-by: Kapil Bhatt --- drivers/wifi/nrfwifi/Kconfig.nrfwifi | 7 +++++++ drivers/wifi/nrfwifi/src/wifi_mgmt_scan.c | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/drivers/wifi/nrfwifi/Kconfig.nrfwifi b/drivers/wifi/nrfwifi/Kconfig.nrfwifi index 3a84f4ea716cd..41bd04afc1238 100644 --- a/drivers/wifi/nrfwifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrfwifi/Kconfig.nrfwifi @@ -814,4 +814,11 @@ config NRF_WIFI_PS_INT_PS whether to stay in PS (for lower amount of buffered data) or exit PS (for higher amount of buffered data). endchoice + +config NRF70_PASSIVE_SCAN_ONLY + bool "Forced Passive scan" + depends on NRF70_SCAN_ONLY + help + Enable this configuration to force passive scan on all channels. + This will override application specified scan type. endif # WIFI_NRF70 diff --git a/drivers/wifi/nrfwifi/src/wifi_mgmt_scan.c b/drivers/wifi/nrfwifi/src/wifi_mgmt_scan.c index c5c6f18804ec3..e30f572aeb326 100644 --- a/drivers/wifi/nrfwifi/src/wifi_mgmt_scan.c +++ b/drivers/wifi/nrfwifi/src/wifi_mgmt_scan.c @@ -206,6 +206,10 @@ int nrf_wifi_disp_scan_zep(const struct device *dev, struct wifi_scan_params *pa vif_ctx_zep->scan_res_cnt = 0; +#ifdef CONFIG_NRF70_PASSIVE_SCAN_ONLY + scan_info->scan_params.passive_scan = 1; +#endif /* CONFIG_NRF70_PASSIVE_SCAN_ONLY */ + status = nrf_wifi_fmac_scan(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx, scan_info); if (status != NRF_WIFI_STATUS_SUCCESS) { From ff70e2f4c44d3e2cfbe2d03b846c2ee570086905 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Wed, 16 Oct 2024 14:50:56 +0200 Subject: [PATCH 1285/4482] modules: hal_nordic: Integrate nrf-regtool 7.0.0 This new version introduces a new sub-command `uicr-compile`, which will generate `uicr.hex` based on a new binary format required by an upcoming release of Secure Domain Firmware (SDFW) closer to production. Since this is a breaking change, and SDFW is not finalized yet, we need to support two nrf-regtool versions for a short time, and use different CLI invocations based on which version is installed. Hence, the minimum required version is unchanged. Additionally, retire CONFIG_NRF_REGTOOL_EXTRA_GENERATE_ARGS. There will be no use for it moving forward. Signed-off-by: Grzegorz Swiderski --- modules/hal_nordic/Kconfig.nrf_regtool | 7 --- .../nrf-regtool/nrf-regtoolConfig.cmake | 52 ++++++++++++------- .../nrf-regtoolConfigVersion.cmake | 1 + 3 files changed, 34 insertions(+), 26 deletions(-) diff --git a/modules/hal_nordic/Kconfig.nrf_regtool b/modules/hal_nordic/Kconfig.nrf_regtool index 791971452fe90..396ec2050a052 100644 --- a/modules/hal_nordic/Kconfig.nrf_regtool +++ b/modules/hal_nordic/Kconfig.nrf_regtool @@ -26,11 +26,4 @@ config NRF_REGTOOL_VERBOSITY 3. Print even more details, which are typically only useful for nrf-regtool developers. -config NRF_REGTOOL_EXTRA_GENERATE_ARGS - string "Extra arguments to 'nrf-regtool generate'" - help - List of additional arguments to every nrf-regtool invocation used for - generating hex files. Example value: "--fill all --fill-byte 0xff". - Run "nrf-regtool generate -h" to see all of the available options. - endmenu diff --git a/modules/hal_nordic/nrf-regtool/nrf-regtoolConfig.cmake b/modules/hal_nordic/nrf-regtool/nrf-regtoolConfig.cmake index 0ff0a8ba6ddcd..6bcaa453cce3c 100644 --- a/modules/hal_nordic/nrf-regtool/nrf-regtoolConfig.cmake +++ b/modules/hal_nordic/nrf-regtool/nrf-regtoolConfig.cmake @@ -1,16 +1,26 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -function(nrf_regtool_generate_hex_from_dts peripheral) - string(TOLOWER "${peripheral}.hex" generated_hex_name) - string(TOLOWER "${peripheral}_merged.hex" merged_hex_name) +function(nrf_regtool_generate_uicr generated_hex_file) + string(REPEAT "-v;" ${CONFIG_NRF_REGTOOL_VERBOSITY} verbosity) + execute_process( + COMMAND + ${CMAKE_COMMAND} -E env PYTHONPATH=${ZEPHYR_BASE}/scripts/dts/python-devicetree/src + ${NRF_REGTOOL} ${verbosity} uicr-compile + --edt-pickle-file ${EDT_PICKLE} + --product-name ${CONFIG_SOC} + --output-file ${generated_hex_file} + WORKING_DIRECTORY ${APPLICATION_SOURCE_DIR} + COMMAND_ERROR_IS_FATAL ANY + ) + message(STATUS "Generated UICR hex file: ${generated_hex_file}") +endfunction() +function(nrf_regtool_generate_peripheral peripheral generated_hex_file) # Prepare common argument sub-lists. string(REPEAT "-v;" ${CONFIG_NRF_REGTOOL_VERBOSITY} verbosity) list(TRANSFORM CACHED_DTS_ROOT_BINDINGS PREPEND "--bindings-dir;" OUTPUT_VARIABLE bindings_dirs) - separate_arguments(extra_args UNIX_COMMAND "${CONFIG_NRF_REGTOOL_EXTRA_GENERATE_ARGS}") - set(generated_hex_file ${PROJECT_BINARY_DIR}/${generated_hex_name}) execute_process( COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${ZEPHYR_BASE}/scripts/dts/python-devicetree/src @@ -25,25 +35,29 @@ function(nrf_regtool_generate_hex_from_dts peripheral) COMMAND_ERROR_IS_FATAL ANY ) message(STATUS "Generated ${peripheral} hex file: ${generated_hex_file}") - - set(merged_hex_file ${PROJECT_BINARY_DIR}/${merged_hex_name}) - set_property(GLOBAL APPEND PROPERTY extra_post_build_commands - COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/build/mergehex.py - -o ${merged_hex_file} - ${generated_hex_file} - ${PROJECT_BINARY_DIR}/${KERNEL_HEX_NAME} - ) - set_property(TARGET runners_yaml_props_target PROPERTY hex_file ${merged_hex_file}) endfunction() +get_property(version GLOBAL PROPERTY nrf_regtool_version) foreach(component IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS) - string(REGEX MATCH "(^.*):(.*$)" match ${component}) - set(operation "${CMAKE_MATCH_1}") - set(peripheral "${CMAKE_MATCH_2}") + if(component STREQUAL "GENERATE:UICR") + set(generated_hex_file ${PROJECT_BINARY_DIR}/uicr.hex) + if(version VERSION_GREATER_EQUAL 7.0.0) + nrf_regtool_generate_uicr(${generated_hex_file}) + else() + nrf_regtool_generate_peripheral(UICR ${generated_hex_file}) + endif() + + # UICR must be flashed together with the Zephyr binary. + set(merged_hex_file ${PROJECT_BINARY_DIR}/uicr_merged.hex) + set_property(GLOBAL APPEND PROPERTY extra_post_build_commands + COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/build/mergehex.py + -o ${merged_hex_file} + ${generated_hex_file} + ${PROJECT_BINARY_DIR}/${KERNEL_HEX_NAME} + ) + set_property(TARGET runners_yaml_props_target PROPERTY hex_file ${merged_hex_file}) - if(operation STREQUAL "GENERATE") - nrf_regtool_generate_hex_from_dts(${peripheral}) else() message(FATAL_ERROR "Unrecognized package component: \"${component}\"") endif() diff --git a/modules/hal_nordic/nrf-regtool/nrf-regtoolConfigVersion.cmake b/modules/hal_nordic/nrf-regtool/nrf-regtoolConfigVersion.cmake index e147d1b053261..81345c1ae50b2 100644 --- a/modules/hal_nordic/nrf-regtool/nrf-regtoolConfigVersion.cmake +++ b/modules/hal_nordic/nrf-regtool/nrf-regtoolConfigVersion.cmake @@ -22,6 +22,7 @@ if(NRF_REGTOOL) "Found nrf-regtool (found suitable version \"${PACKAGE_VERSION}\", " "minimum required is \"${PACKAGE_FIND_VERSION}\")" ) + set_property(GLOBAL PROPERTY nrf_regtool_version ${PACKAGE_VERSION}) return() endif() endif() From 871b558524fad58a33d4b631a35881d764a0ecb6 Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Tue, 15 Oct 2024 22:54:30 +0900 Subject: [PATCH 1286/4482] tests: thrift: Remove 'newlib' from test identifiers The Thrift module tests were under the "newlib" namespace, presumably because newlib was the default at the time of their introduction. Since newlib is no longer the default libc and Thrift is not being tested against multiple C libraries, this removes the libc type from the Thrift test identifiers. Signed-off-by: Stephanos Ioannidis --- tests/modules/thrift/ThriftTest/testcase.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/modules/thrift/ThriftTest/testcase.yaml b/tests/modules/thrift/ThriftTest/testcase.yaml index 820714408cb6b..1eec40e9670d8 100644 --- a/tests/modules/thrift/ThriftTest/testcase.yaml +++ b/tests/modules/thrift/ThriftTest/testcase.yaml @@ -15,9 +15,9 @@ common: - qemu_riscv64 - qemu_x86_64 tests: - thrift.ThriftTest.newlib.binaryProtocol: {} - thrift.ThriftTest.newlib.compactProtocol: + thrift.ThriftTest.binaryProtocol: {} + thrift.ThriftTest.compactProtocol: extra_configs: - CONFIG_THRIFT_COMPACT_PROTOCOL=y - thrift.ThriftTest.newlib.tlsTransport: + thrift.ThriftTest.tlsTransport: extra_args: EXTRA_CONF_FILE="overlay-tls.conf" From 97a2f3075727cf8bd4f13b7b804bf2de982bc831 Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Tue, 15 Oct 2024 23:46:19 +0900 Subject: [PATCH 1287/4482] thrift: Define module-wide _POSIX_C_SOURCE feature test macro The Thrift library makes use of POSIX C functions such as ctime_r(), which are not part of the ISO C standard. This commit adds a Thrift module-wide `_POSIX_C_SOURCE` feature test macro definition in order to ensure that the required POSIX C functions are available when compiling the Thrift library. Note that this was not caught earlier because Newlib and older versions of Picolibc did not properly fence off some POSIX functions behind the feature test macros. Signed-off-by: Stephanos Ioannidis --- modules/thrift/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/thrift/CMakeLists.txt b/modules/thrift/CMakeLists.txt index 02c22f2369f42..9e8408cb646a5 100644 --- a/modules/thrift/CMakeLists.txt +++ b/modules/thrift/CMakeLists.txt @@ -39,4 +39,7 @@ zephyr_library_sources_ifdef(CONFIG_THRIFT_SSL_SOCKET # needed because std::iterator was deprecated with -std=c++17 zephyr_library_compile_options(-Wno-deprecated-declarations) +# needed for ctime_r +zephyr_library_compile_definitions(_POSIX_C_SOURCE=200809L) + endif(CONFIG_THRIFT) From 8b107ab5f17e9631036a798e60877379b8174720 Mon Sep 17 00:00:00 2001 From: Hao Luo Date: Tue, 15 Oct 2024 12:00:44 +0800 Subject: [PATCH 1288/4482] drivers: i2c: add bus recovery Added bus recovery support for ambiq i2c Signed-off-by: Hao Luo --- boards/ambiq/apollo3_evb/apollo3_evb.dts | 2 + boards/ambiq/apollo3p_evb/apollo3p_evb.dts | 2 + .../apollo4p_blue_kxr_evb.dts | 2 + boards/ambiq/apollo4p_evb/apollo4p_evb.dts | 2 + drivers/gpio/gpio_ambiq.c | 25 ++++- drivers/i2c/Kconfig.ambiq | 6 ++ drivers/i2c/i2c_ambiq.c | 101 +++++++++++++++++- dts/bindings/i2c/ambiq,i2c.yaml | 12 +++ 8 files changed, 149 insertions(+), 3 deletions(-) diff --git a/boards/ambiq/apollo3_evb/apollo3_evb.dts b/boards/ambiq/apollo3_evb/apollo3_evb.dts index a47b97f169602..dc8a110b9c0f5 100644 --- a/boards/ambiq/apollo3_evb/apollo3_evb.dts +++ b/boards/ambiq/apollo3_evb/apollo3_evb.dts @@ -116,6 +116,8 @@ pinctrl-0 = <&i2c3_default>; pinctrl-names = "default"; clock-frequency = ; + scl-gpios = <&gpio32_63 10 (GPIO_OPEN_DRAIN | GPIO_PULL_UP)>; + sda-gpios = <&gpio32_63 11 (GPIO_OPEN_DRAIN | GPIO_PULL_UP)>; status = "okay"; }; diff --git a/boards/ambiq/apollo3p_evb/apollo3p_evb.dts b/boards/ambiq/apollo3p_evb/apollo3p_evb.dts index 75d61cbf2a336..ed463af3d6e49 100644 --- a/boards/ambiq/apollo3p_evb/apollo3p_evb.dts +++ b/boards/ambiq/apollo3p_evb/apollo3p_evb.dts @@ -116,6 +116,8 @@ pinctrl-0 = <&i2c3_default>; pinctrl-names = "default"; clock-frequency = ; + scl-gpios = <&gpio32_63 10 (GPIO_OPEN_DRAIN | GPIO_PULL_UP)>; + sda-gpios = <&gpio32_63 11 (GPIO_OPEN_DRAIN | GPIO_PULL_UP)>; status = "okay"; }; diff --git a/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts b/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts index 6a246a1f12ea8..b1ac04f91ce89 100644 --- a/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts +++ b/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts @@ -76,6 +76,8 @@ pinctrl-0 = <&i2c0_default>; pinctrl-names = "default"; clock-frequency = ; + scl-gpios = <&gpio0_31 5 (GPIO_OPEN_DRAIN | GPIO_PULL_UP)>; + sda-gpios = <&gpio0_31 6 (GPIO_OPEN_DRAIN | GPIO_PULL_UP)>; status = "okay"; }; diff --git a/boards/ambiq/apollo4p_evb/apollo4p_evb.dts b/boards/ambiq/apollo4p_evb/apollo4p_evb.dts index c678604f35881..43769da5ad341 100644 --- a/boards/ambiq/apollo4p_evb/apollo4p_evb.dts +++ b/boards/ambiq/apollo4p_evb/apollo4p_evb.dts @@ -88,6 +88,8 @@ compatible = "ambiq,adc"; pinctrl-0 = <&i2c0_default>; pinctrl-names = "default"; clock-frequency = ; + scl-gpios = <&gpio0_31 5 (GPIO_OPEN_DRAIN | GPIO_PULL_UP)>; + sda-gpios = <&gpio0_31 6 (GPIO_OPEN_DRAIN | GPIO_PULL_UP)>; status = "okay"; }; diff --git a/drivers/gpio/gpio_ambiq.c b/drivers/gpio/gpio_ambiq.c index 69f1d4faf302f..7b1ec551e8f68 100644 --- a/drivers/gpio/gpio_ambiq.c +++ b/drivers/gpio/gpio_ambiq.c @@ -55,6 +55,11 @@ static int ambiq_gpio_pin_configure(const struct device *dev, gpio_pin_t pin, gp if (flags & GPIO_SINGLE_ENDED) { if (flags & GPIO_LINE_OPEN_DRAIN) { pincfg.eGPOutcfg = AM_HAL_GPIO_PIN_OUTCFG_OPENDRAIN; + if (flags & GPIO_PULL_UP) { + pincfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_1_5K; + } else if (flags & GPIO_PULL_DOWN) { + pincfg.ePullup = AM_HAL_GPIO_PIN_PULLDOWN; + } } } else { pincfg.eGPOutcfg = AM_HAL_GPIO_PIN_OUTCFG_PUSHPULL; @@ -89,6 +94,11 @@ static int ambiq_gpio_pin_configure(const struct device *dev, gpio_pin_t pin, gp if (flags & GPIO_SINGLE_ENDED) { if (flags & GPIO_LINE_OPEN_DRAIN) { pincfg.GP.cfg_b.eGPOutCfg = AM_HAL_GPIO_PIN_OUTCFG_OPENDRAIN; + if (flags & GPIO_PULL_UP) { + pincfg.GP.cfg_b.ePullup = AM_HAL_GPIO_PIN_PULLUP_50K; + } else if (flags & GPIO_PULL_DOWN) { + pincfg.GP.cfg_b.ePullup = AM_HAL_GPIO_PIN_PULLDOWN_50K; + } } } else { pincfg.GP.cfg_b.eGPOutCfg = AM_HAL_GPIO_PIN_OUTCFG_PUSHPULL; @@ -260,12 +270,23 @@ static int ambiq_gpio_port_get_direction(const struct device *dev, gpio_port_pin static int ambiq_gpio_port_get_raw(const struct device *dev, gpio_port_value_t *value) { const struct ambiq_gpio_config *const dev_cfg = dev->config; + am_hal_gpio_pincfg_t pincfg; + uint32_t pin_offset; #if defined(CONFIG_SOC_SERIES_APOLLO3X) - *value = (*AM_HAL_GPIO_RDn(dev_cfg->offset)); + pin_offset = dev_cfg->offset; + am_hal_gpio_pinconfig_get(pin_offset, &pincfg); + if (pincfg.eGPInput == AM_HAL_GPIO_PIN_INPUT_ENABLE) { #else - *value = (*AM_HAL_GPIO_RDn(dev_cfg->offset >> 2)); + pin_offset = dev_cfg->offset >> 2; + am_hal_gpio_pinconfig_get(pin_offset, &pincfg); + if (pincfg.GP.cfg_b.eGPInput == AM_HAL_GPIO_PIN_INPUT_ENABLE) { #endif + *value = (*AM_HAL_GPIO_RDn(pin_offset)); + } else { + *value = (*AM_HAL_GPIO_WTn(pin_offset)); + } + return 0; } diff --git a/drivers/i2c/Kconfig.ambiq b/drivers/i2c/Kconfig.ambiq index ca925a89fbd01..727573310e773 100644 --- a/drivers/i2c/Kconfig.ambiq +++ b/drivers/i2c/Kconfig.ambiq @@ -27,4 +27,10 @@ config I2C_DMA_TCB_BUFFER_SIZE help DMA Transfer Control Buffer size in words +config I2C_AMBIQ_BUS_RECOVERY + bool "Bus recovery support" + select I2C_BITBANG + help + Enable AMBIQ driver bus recovery support via GPIO bitbanging. + endif # I2C_AMBIQ diff --git a/drivers/i2c/i2c_ambiq.c b/drivers/i2c/i2c_ambiq.c index 99e08004a75d8..69492b5a60861 100644 --- a/drivers/i2c/i2c_ambiq.c +++ b/drivers/i2c/i2c_ambiq.c @@ -15,6 +15,11 @@ #include +#ifdef CONFIG_I2C_AMBIQ_BUS_RECOVERY +#include +#include "i2c_bitbang.h" +#endif /* CONFIG_I2C_AMBIQ_BUS_RECOVERY */ + #include #include @@ -28,6 +33,10 @@ typedef int (*ambiq_i2c_pwr_func_t)(void); #include "i2c-priv.h" struct i2c_ambiq_config { +#ifdef CONFIG_I2C_AMBIQ_BUS_RECOVERY + struct gpio_dt_spec scl; + struct gpio_dt_spec sda; +#endif /* CONFIG_I2C_AMBIQ_BUS_RECOVERY */ uint32_t base; int size; uint32_t bitrate; @@ -241,6 +250,90 @@ static int i2c_ambiq_transfer(const struct device *dev, struct i2c_msg *msgs, ui return ret; } +#if CONFIG_I2C_AMBIQ_BUS_RECOVERY +static void i2c_ambiq_bitbang_set_scl(void *io_context, int state) +{ + const struct i2c_ambiq_config *config = io_context; + + gpio_pin_set_dt(&config->scl, state); +} + +static void i2c_ambiq_bitbang_set_sda(void *io_context, int state) +{ + const struct i2c_ambiq_config *config = io_context; + + gpio_pin_set_dt(&config->sda, state); +} + +static int i2c_ambiq_bitbang_get_sda(void *io_context) +{ + const struct i2c_ambiq_config *config = io_context; + + return gpio_pin_get_dt(&config->sda) == 0 ? 0 : 1; +} + +static int i2c_ambiq_recover_bus(const struct device *dev) +{ + const struct i2c_ambiq_config *config = dev->config; + struct i2c_ambiq_data *data = dev->data; + struct i2c_bitbang bitbang_ctx; + struct i2c_bitbang_io bitbang_io = { + .set_scl = i2c_ambiq_bitbang_set_scl, + .set_sda = i2c_ambiq_bitbang_set_sda, + .get_sda = i2c_ambiq_bitbang_get_sda, + }; + uint32_t bitrate_cfg; + int error = 0; + + LOG_ERR("attempting to recover bus"); + + if (!gpio_is_ready_dt(&config->scl)) { + LOG_ERR("SCL GPIO device not ready"); + return -EIO; + } + + if (!gpio_is_ready_dt(&config->sda)) { + LOG_ERR("SDA GPIO device not ready"); + return -EIO; + } + + k_sem_take(&data->bus_sem, K_FOREVER); + + error = gpio_pin_configure_dt(&config->scl, GPIO_OUTPUT_HIGH); + if (error != 0) { + LOG_ERR("failed to configure SCL GPIO (err %d)", error); + goto restore; + } + + error = gpio_pin_configure_dt(&config->sda, GPIO_OUTPUT_HIGH); + if (error != 0) { + LOG_ERR("failed to configure SDA GPIO (err %d)", error); + goto restore; + } + + i2c_bitbang_init(&bitbang_ctx, &bitbang_io, (void *)config); + + bitrate_cfg = i2c_map_dt_bitrate(config->bitrate) | I2C_MODE_CONTROLLER; + error = i2c_bitbang_configure(&bitbang_ctx, bitrate_cfg); + if (error != 0) { + LOG_ERR("failed to configure I2C bitbang (err %d)", error); + goto restore; + } + + error = i2c_bitbang_recover_bus(&bitbang_ctx); + if (error != 0) { + LOG_ERR("failed to recover bus (err %d)", error); + } + +restore: + (void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); + + k_sem_give(&data->bus_sem); + + return error; +} +#endif /* CONFIG_I2C_AMBIQ_BUS_RECOVERY */ + static int i2c_ambiq_init(const struct device *dev) { struct i2c_ambiq_data *data = dev->data; @@ -291,6 +384,9 @@ static int i2c_ambiq_init(const struct device *dev) static const struct i2c_driver_api i2c_ambiq_driver_api = { .configure = i2c_ambiq_configure, .transfer = i2c_ambiq_transfer, +#if CONFIG_I2C_AMBIQ_BUS_RECOVERY + .recover_bus = i2c_ambiq_recover_bus, +#endif /* CONFIG_I2C_AMBIQ_BUS_RECOVERY */ #ifdef CONFIG_I2C_RTIO .iodev_submit = i2c_iodev_submit_fallback, #endif @@ -351,7 +447,10 @@ static int i2c_ambiq_pm_action(const struct device *dev, enum pm_device_action a .bitrate = DT_INST_PROP(n, clock_frequency), \ .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ .irq_config_func = i2c_irq_config_func_##n, \ - .pwr_func = pwr_on_ambiq_i2c_##n}; \ + .pwr_func = pwr_on_ambiq_i2c_##n, \ + IF_ENABLED(CONFIG_I2C_AMBIQ_BUS_RECOVERY, \ + (.scl = GPIO_DT_SPEC_INST_GET_OR(n, scl_gpios, {0}),\ + .sda = GPIO_DT_SPEC_INST_GET_OR(n, sda_gpios, {0}),)) }; \ PM_DEVICE_DT_INST_DEFINE(n, i2c_ambiq_pm_action); \ I2C_DEVICE_DT_INST_DEFINE(n, i2c_ambiq_init, PM_DEVICE_DT_INST_GET(n), &i2c_ambiq_data##n, \ &i2c_ambiq_config##n, POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ diff --git a/dts/bindings/i2c/ambiq,i2c.yaml b/dts/bindings/i2c/ambiq,i2c.yaml index 456c9dd610667..7d7a87617dcd6 100644 --- a/dts/bindings/i2c/ambiq,i2c.yaml +++ b/dts/bindings/i2c/ambiq,i2c.yaml @@ -16,3 +16,15 @@ properties: ambiq,pwrcfg: required: true + + scl-gpios: + type: phandle-array + description: | + GPIO to which the I2C SCL signal is routed. This is only needed for I2C bus recovery + support. + + sda-gpios: + type: phandle-array + description: | + GPIO to which the I2C SDA signal is routed. This is only needed for I2C bus recovery + support. From adeeb10f4f64f4aac15f0796a89550c1421efcb6 Mon Sep 17 00:00:00 2001 From: Yves Vandervennet Date: Wed, 9 Oct 2024 13:56:22 -0500 Subject: [PATCH 1289/4482] board: mimxrt1170_evk: fix linkserver support to debug RAM images - add ITCM definitions (for LinkServer) in board.cmake - update of soc.c to support RAM images (stack pointer) - doc update Change applies to both versions of the MIMXRT1170 EVK Signed-off-by: Yves Vandervennet --- boards/nxp/mimxrt1170_evk/board.cmake | 5 ++++- boards/nxp/mimxrt1170_evk/doc/index.rst | 5 ----- soc/nxp/imxrt/imxrt11xx/soc.c | 16 +++++++++++++++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/boards/nxp/mimxrt1170_evk/board.cmake b/boards/nxp/mimxrt1170_evk/board.cmake index d1438e4a7b174..8781a87cdd65a 100644 --- a/boards/nxp/mimxrt1170_evk/board.cmake +++ b/boards/nxp/mimxrt1170_evk/board.cmake @@ -7,6 +7,9 @@ if(CONFIG_SOC_MIMXRT1176_CM7 OR CONFIG_SECOND_CORE_MCUX) board_runner_args(pyocd "--target=mimxrt1170_cm7") board_runner_args(jlink "--device=MIMXRT1176xxxA_M7" "--reset-after-load") + # ITCM is not defined in RT1170's LinkServer device file + board_runner_args(linkserver "--override=/device/memory/-=\{\"location\":\"0x00000000\",\ + \"size\":\"0x00040000\",\"type\":\"RAM\"\}") if(${BOARD_REVISION} STREQUAL "A") board_runner_args(linkserver "--device=MIMXRT1176xxxxx:MIMXRT1170-EVK") @@ -27,6 +30,6 @@ elseif(CONFIG_SOC_MIMXRT1176_CM4) board_runner_args(linkserver "--core=cm4") endif() +include(${ZEPHYR_BASE}/boards/common/linkserver.board.cmake) include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) -include(${ZEPHYR_BASE}/boards/common/linkserver.board.cmake) diff --git a/boards/nxp/mimxrt1170_evk/doc/index.rst b/boards/nxp/mimxrt1170_evk/doc/index.rst index 472d2e177f581..4ea519aea858d 100644 --- a/boards/nxp/mimxrt1170_evk/doc/index.rst +++ b/boards/nxp/mimxrt1170_evk/doc/index.rst @@ -362,11 +362,6 @@ EVK. See `Using J-Link with MIMXRT1170-EVKB`_ or Using LinkServer ---------------- -Known limitations with LinkServer and these boards include: -- ``west flash`` will not write images to non-flash locations. The flash -command only works when all data in the image is written to flash memory -regions. - Install the :ref:`linkserver-debug-host-tools` and make sure they are in your search path. LinkServer works with the default CMSIS-DAP firmware included in the on-board debugger. diff --git a/soc/nxp/imxrt/imxrt11xx/soc.c b/soc/nxp/imxrt/imxrt11xx/soc.c index 02e35c2d105e9..7f1fca10c651b 100644 --- a/soc/nxp/imxrt/imxrt11xx/soc.c +++ b/soc/nxp/imxrt/imxrt11xx/soc.c @@ -729,8 +729,22 @@ static int imxrt_init(void) return 0; } +/* + * Stack pointer is not set at this point in the early init, but we call C + * functions from the SOC reset. + * Set a stack pointer so that C functions will work correctly + */ + #ifdef CONFIG_SOC_RESET_HOOK -void soc_reset_hook(void) +__asm__ ( + ".global soc_reset_hook\n" + "soc_reset_hook:\n" + "ldr r0, =z_main_stack+"STRINGIFY(CONFIG_MAIN_STACK_SIZE)";\n" + "msr msp, r0;\n" + "b _soc_reset_hook;\n" +); + +void __used _soc_reset_hook(void) { SystemInit(); From 0a54922ba79761c713ed6ee40a5344ed55aa7a2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 11 Oct 2024 15:48:59 +0200 Subject: [PATCH 1290/4482] lib: cbprintf: fix ubsan errors in cbvprintf_package (take 2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First approach had to be reverted because it did not pass tests. Take 2 attempts to use uintptr_t instead of a pointer and cast it to the expected pointer when necessary. Signed-off-by: Krzysztof Chruściński --- lib/os/cbprintf_packaged.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/os/cbprintf_packaged.c b/lib/os/cbprintf_packaged.c index 9a3b456edade3..9696016d31d6f 100644 --- a/lib/os/cbprintf_packaged.c +++ b/lib/os/cbprintf_packaged.c @@ -242,10 +242,10 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, #define STR_POS_MASK BIT_MASK(7) /* Buffer offset abstraction for better code clarity. */ -#define BUF_OFFSET ((uintptr_t)buf - (uintptr_t)buf0) +#define BUF_OFFSET (buf - (uintptr_t)buf0) uint8_t *buf0 = packaged; /* buffer start (may be NULL) */ - uint8_t *buf = buf0; /* current buffer position */ + uintptr_t buf = (uintptr_t)buf0; /* current buffer position */ unsigned int size; /* current argument's size */ unsigned int align; /* current argument's required alignment */ uint8_t str_ptr_pos[16]; /* string pointer positions */ @@ -355,7 +355,7 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, size = sizeof(int); /* align destination buffer location */ - buf = (void *)ROUND_UP(buf, align); + buf = ROUND_UP(buf, align); /* make sure the data fits */ if (buf0 != NULL && BUF_OFFSET + size > len) { @@ -430,14 +430,14 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, } /* align destination buffer location */ - buf = (void *) ROUND_UP(buf, align); + buf = ROUND_UP(buf, align); if (buf0 != NULL) { /* make sure it fits */ if ((BUF_OFFSET + size) > len) { return -ENOSPC; } if (Z_CBPRINTF_VA_STACK_LL_DBL_MEMCPY) { - memcpy(buf, (uint8_t *)&v, size); + memcpy((void *)buf, (uint8_t *)&v, size); } else if (fmt[-1] == 'L') { *(long double *)buf = v.ld; } else { @@ -577,14 +577,14 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, size = sizeof(double); } /* align destination buffer location */ - buf = (void *) ROUND_UP(buf, align); + buf = ROUND_UP(buf, align); if (buf0 != NULL) { /* make sure it fits */ if (BUF_OFFSET + size > len) { return -ENOSPC; } if (Z_CBPRINTF_VA_STACK_LL_DBL_MEMCPY) { - memcpy(buf, (uint8_t *)&v, size); + memcpy((void *)buf, (uint8_t *)&v, size); } else if (fmt[-1] == 'L') { *(long double *)buf = v.ld; } else { @@ -603,7 +603,7 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, } /* align destination buffer location */ - buf = (void *) ROUND_UP(buf, align); + buf = ROUND_UP(buf, align); /* make sure the data fits */ if ((buf0 != NULL) && (BUF_OFFSET + size) > len) { @@ -700,7 +700,7 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, if (buf0 != NULL) { if (Z_CBPRINTF_VA_STACK_LL_DBL_MEMCPY) { - memcpy(buf, (uint8_t *)&v, sizeof(long long)); + memcpy((void *)buf, (uint8_t *)&v, sizeof(long long)); } else { *(long long *)buf = v; } @@ -767,7 +767,7 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, return -ENOSPC; } /* store the pointer position prefix */ - *buf = pos; + *(uint8_t *)buf = pos; ++buf; } } @@ -781,7 +781,8 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, if (rws_pos_en) { size = 0; - *buf++ = str_ptr_arg[i]; + *(uint8_t *)buf = str_ptr_arg[i]; + ++buf; } else { /* retrieve the string pointer */ s = *(char **)(buf0 + str_ptr_pos[i] * sizeof(int)); @@ -796,10 +797,10 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags, return -ENOSPC; } /* store the pointer position prefix */ - *buf = str_ptr_pos[i]; + *(uint8_t *)buf = str_ptr_pos[i]; ++buf; /* copy the string with its terminating '\0' */ - memcpy(buf, (uint8_t *)s, size); + memcpy((void *)buf, (uint8_t *)s, size); buf += size; } From 51e0130a743e784c5e863bd1d8f2cbc7f548a904 Mon Sep 17 00:00:00 2001 From: Piotr Koziar Date: Tue, 8 Oct 2024 13:45:34 +0200 Subject: [PATCH 1291/4482] ipc: icmsg: increase stack size of RX work queue thread Increases default size of stack used by work queue RX thread from 1024 to 1280 to avoid memory issues. After adding the buffer with the default size of 128 that is allocated on the thread's stack (see #77552), there is too little stack left during heavy stress. Signed-off-by: Piotr Koziar --- subsys/ipc/ipc_service/lib/Kconfig.icmsg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/ipc/ipc_service/lib/Kconfig.icmsg b/subsys/ipc/ipc_service/lib/Kconfig.icmsg index 93427404dca4a..bc15d9a599934 100644 --- a/subsys/ipc/ipc_service/lib/Kconfig.icmsg +++ b/subsys/ipc/ipc_service/lib/Kconfig.icmsg @@ -51,7 +51,7 @@ if IPC_SERVICE_BACKEND_ICMSG_WQ_ENABLE config IPC_SERVICE_BACKEND_ICMSG_WQ_STACK_SIZE int "Size of RX work queue stack" - default 1024 + default 1280 help Size of stack used by work queue RX thread. This work queue is created to prevent notifying service users about received data From c3fd40d59cd9f24fe0a0883d7dfad047d6c2b18a Mon Sep 17 00:00:00 2001 From: Abderrahmane Jarmouni Date: Fri, 4 Oct 2024 18:40:56 +0200 Subject: [PATCH 1292/4482] boards: st: stm32h750b-dk: enable usart1 Enable USART1 that can be used with external periphs via Arduino pins. LPUART1 can also be used on the same pins. Tested with tests/drivers/uart_elementary Signed-off-by: Abderrahmane Jarmouni --- boards/st/stm32h750b_dk/arduino_r3_connector.dtsi | 2 ++ boards/st/stm32h750b_dk/doc/index.rst | 1 + boards/st/stm32h750b_dk/stm32h750b_dk.dts | 10 ++++++++++ 3 files changed, 13 insertions(+) diff --git a/boards/st/stm32h750b_dk/arduino_r3_connector.dtsi b/boards/st/stm32h750b_dk/arduino_r3_connector.dtsi index d5b1e5204594a..40ed77d4adfa6 100644 --- a/boards/st/stm32h750b_dk/arduino_r3_connector.dtsi +++ b/boards/st/stm32h750b_dk/arduino_r3_connector.dtsi @@ -34,3 +34,5 @@ <21 0 &gpiod 12 0>; /* D15 */ }; }; + +arduino_serial: &usart1 {}; diff --git a/boards/st/stm32h750b_dk/doc/index.rst b/boards/st/stm32h750b_dk/doc/index.rst index a2b09e45fd726..351276599af90 100644 --- a/boards/st/stm32h750b_dk/doc/index.rst +++ b/boards/st/stm32h750b_dk/doc/index.rst @@ -84,6 +84,7 @@ Default Zephyr Peripheral Mapping: - UART_3 TX/RX : PB10/PB11 (ST-Link Virtual Port Com) - LD1 : PJ2 - LD2 : PI13 +- USART1 TX/RX : PB6/PB7 (Arduino D1/D0) System Clock ============ diff --git a/boards/st/stm32h750b_dk/stm32h750b_dk.dts b/boards/st/stm32h750b_dk/stm32h750b_dk.dts index 14a6fe1fef1c3..711a2ba7eee40 100644 --- a/boards/st/stm32h750b_dk/stm32h750b_dk.dts +++ b/boards/st/stm32h750b_dk/stm32h750b_dk.dts @@ -243,3 +243,13 @@ st,adc-prescaler = <4>; status = "okay"; }; + +/* Arduino Header pins: Tx:D1, Rx:D0 */ +/* LPUART1 can also be used with this pins */ +&usart1 { + dma-names = "tx", "rx"; + pinctrl-0 = <&usart1_tx_pb6 &usart1_rx_pb7>; + pinctrl-names = "default"; + current-speed = <115200>; + status = "okay"; +}; From 60462266e317b6fec000533bdf8e111d9bd6d574 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 21 Oct 2024 14:30:11 +0300 Subject: [PATCH 1293/4482] modules: hal_silabs: Move CMake and Kconfig to the main tree Move the CMakeLists.txt and Kconfig files from the hal_silabs tree under modules/hal_silabs in the main tree. This also includes all Zephyr shim code from the hal_silabs tree. Signed-off-by: Johan Hedberg --- MAINTAINERS.yml | 2 +- modules/Kconfig | 1 - modules/hal_silabs/CMakeLists.txt | 4 + .../{Kconfig.silabs => hal_silabs/Kconfig} | 0 modules/hal_silabs/gecko/CMakeLists.txt | 114 ++++++++++ modules/hal_silabs/si32/CMakeLists.txt | 13 ++ .../hal_silabs/simplicity_sdk/CMakeLists.txt | 205 ++++++++++++++++++ .../src/sl_memory_manager_shim.c | 31 +++ west.yml | 2 +- 9 files changed, 369 insertions(+), 3 deletions(-) create mode 100644 modules/hal_silabs/CMakeLists.txt rename modules/{Kconfig.silabs => hal_silabs/Kconfig} (100%) create mode 100644 modules/hal_silabs/gecko/CMakeLists.txt create mode 100644 modules/hal_silabs/si32/CMakeLists.txt create mode 100644 modules/hal_silabs/simplicity_sdk/CMakeLists.txt create mode 100644 modules/hal_silabs/simplicity_sdk/src/sl_memory_manager_shim.c diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 5764d0f1f632e..9ff972e9376cf 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -4815,7 +4815,7 @@ West: - mnkp - rettichschnidi files: - - modules/Kconfig.silabs + - modules/hal_silabs/ labels: - "platform: Silabs" diff --git a/modules/Kconfig b/modules/Kconfig index 21ccad7ff2f70..7e0e2b2872d10 100644 --- a/modules/Kconfig +++ b/modules/Kconfig @@ -30,7 +30,6 @@ source "modules/Kconfig.picolibc" source "modules/Kconfig.nxp_s32" source "modules/Kconfig.renesas_fsp" source "modules/Kconfig.rust" -source "modules/Kconfig.silabs" source "modules/Kconfig.simplelink" source "modules/Kconfig.sof" source "modules/Kconfig.stm32" diff --git a/modules/hal_silabs/CMakeLists.txt b/modules/hal_silabs/CMakeLists.txt new file mode 100644 index 0000000000000..62d7ed54a157a --- /dev/null +++ b/modules/hal_silabs/CMakeLists.txt @@ -0,0 +1,4 @@ +add_subdirectory_ifdef(CONFIG_SOC_FAMILY_SILABS_S0 gecko) +add_subdirectory_ifdef(CONFIG_SOC_FAMILY_SILABS_S1 gecko) +add_subdirectory_ifdef(CONFIG_SOC_FAMILY_SILABS_S2 simplicity_sdk) +add_subdirectory_ifdef(CONFIG_HAS_SILABS_SI32 si32) diff --git a/modules/Kconfig.silabs b/modules/hal_silabs/Kconfig similarity index 100% rename from modules/Kconfig.silabs rename to modules/hal_silabs/Kconfig diff --git a/modules/hal_silabs/gecko/CMakeLists.txt b/modules/hal_silabs/gecko/CMakeLists.txt new file mode 100644 index 0000000000000..acf8ead687d8a --- /dev/null +++ b/modules/hal_silabs/gecko/CMakeLists.txt @@ -0,0 +1,114 @@ +# Makefile - Gecko SDK +# +# Copyright (c) 2017, Christian Taedcke +# Copyright (c) 2021, Safran Passenger Innovations Germany GmbH +# Copyright (c) 2022, Antmicro +# +# SPDX-License-Identifier: Apache-2.0 +# + +set(EMLIB_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/gecko/emlib) +set(COMMON_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/gecko/common) +set(DEVICE_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/gecko/Device) +set(RADIO_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/gecko/platform/radio) +set(BLOBS_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR/zephyr/blobs}) + +# Translate the SoC name and part number into the gecko device and cpu name +# respectively. +string(TOUPPER ${CONFIG_SOC_SERIES} SILABS_GECKO_DEVICE) + +# Get SoC series number, i.e. translate e.g. efr32bg22 -> 22 +string(SUBSTRING ${CONFIG_SOC_SERIES} 7 2 GECKO_SERIES_NUMBER) + +set(SILABS_GECKO_PART_NUMBER ${CONFIG_SOC_PART_NUMBER}) + +function(add_prebuilt_library lib_name prebuilt_path) + add_library(${lib_name} STATIC IMPORTED GLOBAL) + set_target_properties(${lib_name} PROPERTIES + IMPORTED_LOCATION ${BLOBS_DIR}/${prebuilt_path} + ) + zephyr_link_libraries(${lib_name}) +endfunction() + +if(${CONFIG_SOC_GECKO_HAS_RADIO}) + if(${CONFIG_SOC_FAMILY_SILABS_S1}) + zephyr_include_directories( + ${RADIO_DIR}/rail_lib/plugin/pa-conversions/efr32xg1x/config + ${RADIO_DIR}/rail_lib/chip/efr32/efr32xg1x + ) + endif() + + zephyr_include_directories( + ${RADIO_DIR}/rail_lib/common + ${RADIO_DIR}/rail_lib/plugin/pa-conversions + ) + + if(CONFIG_SOC_GECKO_USE_RAIL) + # rail + zephyr_library_sources(${RADIO_DIR}/rail_lib/plugin/pa-conversions/pa_conversions_efr32.c) + zephyr_library_sources(${RADIO_DIR}/rail_lib/plugin/pa-conversions/pa_curves_efr32.c) + + # prebuilt libs + add_prebuilt_library(librail platform/radio/rail_lib/autogen/librail_release/librail_efr32xg${GECKO_SERIES_NUMBER}_gcc_release.a) + + if(CONFIG_SOC_GECKO_CUSTOM_RADIO_PHY) + zephyr_include_directories( + ${RADIO_DIR}/rail_lib/plugin/rail_util_init/config/proprietary + ${RADIO_DIR}/rail_lib/plugin/rail_util_callbacks + ${RADIO_DIR}/rail_lib/plugin/rail_util_callbacks/config + ${RADIO_DIR}/rail_lib/plugin/rail_util_protocol + ${RADIO_DIR}/rail_lib/plugin/rail_util_protocol/config/efr32xg${GECKO_SERIES_NUMBER}/ + ${RADIO_DIR}/rail_lib/protocol/ble + ${RADIO_DIR}/rail_lib/protocol/ieee802154 + ${RADIO_DIR}/rail_lib/protocol/zwave + ) + zephyr_library_sources(${RADIO_DIR}/rail_lib/plugin/rail_util_protocol/sl_rail_util_protocol.c) + endif() + + endif() +endif() + +zephyr_include_directories( + ${DEVICE_DIR}/SiliconLabs/${SILABS_GECKO_DEVICE}/Include + ${COMMON_DIR}/inc + ${EMLIB_DIR}/inc + ${BOARD_DIR} +) + +# The gecko SDK uses the cpu name to include the matching device header. +# See Device/SiliconLabs/$(SILABS_GECKO_DEVICE)/Include/em_device.h for an example. +zephyr_compile_definitions( + ${SILABS_GECKO_PART_NUMBER} +) + +zephyr_library_sources( ${EMLIB_DIR}/src/em_system.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_ADC ${EMLIB_DIR}/src/em_adc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_BURTC ${EMLIB_DIR}/src/em_burtc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CMU ${EMLIB_DIR}/src/em_cmu.c) + +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CORE ${EMLIB_DIR}/src/em_core.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CRYOTIMER ${EMLIB_DIR}/src/em_cryotimer.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_EMU ${EMLIB_DIR}/src/em_emu.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_GPIO ${EMLIB_DIR}/src/em_gpio.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_I2C ${EMLIB_DIR}/src/em_i2c.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_LETIMER ${EMLIB_DIR}/src/em_letimer.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_LEUART ${EMLIB_DIR}/src/em_leuart.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_MSC ${EMLIB_DIR}/src/em_msc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_PRS ${EMLIB_DIR}/src/em_prs.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_RMU ${EMLIB_DIR}/src/em_rmu.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_RTC ${EMLIB_DIR}/src/em_rtc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_RTCC ${EMLIB_DIR}/src/em_rtcc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_TIMER ${EMLIB_DIR}/src/em_timer.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_USART ${EMLIB_DIR}/src/em_usart.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_WDOG ${EMLIB_DIR}/src/em_wdog.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32WG ${DEVICE_DIR}/SiliconLabs/EFM32WG/Source/system_efm32wg.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFR32BG13P ${DEVICE_DIR}/SiliconLabs/EFR32BG13P/Source/system_efr32bg13p.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFR32FG1P ${DEVICE_DIR}/SiliconLabs/EFR32FG1P/Source/system_efr32fg1p.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFR32FG13P ${DEVICE_DIR}/SiliconLabs/EFR32FG13P/Source/system_efr32fg13p.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32HG ${DEVICE_DIR}/SiliconLabs/EFM32HG/Source/system_efm32hg.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFR32MG12P ${DEVICE_DIR}/SiliconLabs/EFR32MG12P/Source/system_efr32mg12p.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32PG12B ${DEVICE_DIR}/SiliconLabs/EFM32PG12B/Source/system_efm32pg12b.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32GG11B ${DEVICE_DIR}/SiliconLabs/EFM32GG11B/Source/system_efm32gg11b.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32GG12B ${DEVICE_DIR}/SiliconLabs/EFM32GG12B/Source/system_efm32gg12b.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32JG12B ${DEVICE_DIR}/SiliconLabs/EFM32JG12B/Source/system_efm32jg12b.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32PG1B ${DEVICE_DIR}/SiliconLabs/EFM32PG1B/Source/system_efm32pg1b.c) diff --git a/modules/hal_silabs/si32/CMakeLists.txt b/modules/hal_silabs/si32/CMakeLists.txt new file mode 100644 index 0000000000000..e0ad957b6733e --- /dev/null +++ b/modules/hal_silabs/si32/CMakeLists.txt @@ -0,0 +1,13 @@ +set(SI32_HAL_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/si32/si32Hal) + +zephyr_include_directories( + ${SI32_HAL_DIR}/sim3u1xx + ${SI32_HAL_DIR}/SI32_Modules +) + +if(CONFIG_SOC_SERIES_SIM3U) + zephyr_library_sources(${SI32_HAL_DIR}/sim3u1xx/SI32_PBCFG_A_Type.c) + zephyr_library_sources_ifdef(CONFIG_DMA ${SI32_HAL_DIR}/sim3u1xx/SI32_DMAXBAR_A_Type.c) + zephyr_library_sources_ifdef(CONFIG_DMA ${SI32_HAL_DIR}/SI32_Modules/SI32_DMADESC_A_Type.c) + zephyr_library_sources_ifdef(CONFIG_SPI ${SI32_HAL_DIR}/SI32_Modules/SI32_SPI_A_Type.c) +endif() diff --git a/modules/hal_silabs/simplicity_sdk/CMakeLists.txt b/modules/hal_silabs/simplicity_sdk/CMakeLists.txt new file mode 100644 index 0000000000000..842d5383e8324 --- /dev/null +++ b/modules/hal_silabs/simplicity_sdk/CMakeLists.txt @@ -0,0 +1,205 @@ +# CMake integration for Simplicity SDK +# +# Copyright (c) 2017, Christian Taedcke +# Copyright (c) 2021, Safran Passenger Innovations Germany GmbH +# Copyright (c) 2022, Antmicro +# Copyright (c) 2024, Silicon Laboratories Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +set(EMLIB_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/simplicity_sdk/platform/emlib) +set(COMMON_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/simplicity_sdk/platform/common) +set(DEVICE_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/simplicity_sdk/platform/Device) +set(RADIO_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/simplicity_sdk/platform/radio) +set(SECURITY_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/simplicity_sdk/platform/security) +set(SERVICE_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/simplicity_sdk/platform/service) +set(PERIPHERAL_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/simplicity_sdk/platform/peripheral) +set(BLUETOOTH_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/simplicity_sdk/protocol/bluetooth) +set(BLOBS_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/zephyr/blobs/simplicity_sdk) + +# Translate the SoC name and part number into the gecko device and cpu name +# respectively. +string(TOUPPER ${CONFIG_SOC_SERIES} SILABS_DEVICE_FAMILY) + +# Get SoC series number, i.e. translate e.g. efr32bg22 -> 22 +string(SUBSTRING ${CONFIG_SOC_SERIES} 7 2 SILABS_DEVICE_FAMILY_NUMBER) + +set(SILABS_DEVICE_PART_NUMBER ${CONFIG_SOC_PART_NUMBER}) + +function(add_prebuilt_library lib_name prebuilt_path) + add_library(${lib_name} STATIC IMPORTED GLOBAL) + set_target_properties(${lib_name} PROPERTIES + IMPORTED_LOCATION ${BLOBS_DIR}/${prebuilt_path} + ) + zephyr_link_libraries(${lib_name}) +endfunction() + +if(CONFIG_SOC_GECKO_HAS_RADIO) + zephyr_include_directories_ifdef(CONFIG_SOC_FAMILY_SILABS_S2 + ${RADIO_DIR}/rail_lib/plugin/pa-conversions/efr32xg${SILABS_DEVICE_FAMILY_NUMBER}/config + ${RADIO_DIR}/rail_lib/chip/efr32/efr32xg2x + ) + + zephyr_include_directories( + ${RADIO_DIR}/rail_lib/common + ${RADIO_DIR}/rail_lib/plugin/pa-conversions + ${BLUETOOTH_DIR}/bgstack/ll/inc + ) + + # sl_protocol_crypto + zephyr_library_sources_ifdef(CONFIG_BT_SILABS_HCI + ${SECURITY_DIR}/sl_component/sl_protocol_crypto/src/sli_radioaes_management.c + ${SECURITY_DIR}/sl_component/sl_protocol_crypto/src/sli_protocol_crypto_radioaes.c + ) + + if(CONFIG_BT_SILABS_HCI) + # prebuilt libs + add_prebuilt_library(liblinklayer protocol/bluetooth/bgstack/ll/lib/libbluetooth_controller_efr32xg${SILABS_DEVICE_FAMILY_NUMBER}_gcc_release.a) + add_prebuilt_library(libbgcommon protocol/bluetooth/bgcommon/lib/build/gcc/cortex-m33/bgcommon/release/libbgcommon.a) + + # link mbedTLS + if(CONFIG_MBEDTLS) + zephyr_link_libraries(mbedTLS) + endif() + endif() + + if(CONFIG_SOC_GECKO_USE_RAIL) + # rail + zephyr_library_sources(${RADIO_DIR}/rail_lib/plugin/pa-conversions/pa_curves_efr32.c) + zephyr_library_sources(${RADIO_DIR}/rail_lib/plugin/pa-conversions/pa_conversions_efr32.c) + + # prebuilt libs + add_prebuilt_library(librail platform/radio/rail_lib/autogen/librail_release/librail_efr32xg${SILABS_DEVICE_FAMILY_NUMBER}_gcc_release.a) + + zephyr_include_directories_ifdef(CONFIG_SOC_GECKO_CUSTOM_RADIO_PHY + ${RADIO_DIR}/rail_lib/protocol/ble + ${RADIO_DIR}/rail_lib/protocol/ieee802154 + ${RADIO_DIR}/rail_lib/protocol/zwave + ${RADIO_DIR}/rail_lib/protocol/sidewalk + ${RADIO_DIR}/rail_lib/plugin/rail_util_protocol + ${RADIO_DIR}/rail_lib/plugin/rail_util_protocol/config/efr32xg${SILABS_DEVICE_FAMILY_NUMBER} + ) + zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CUSTOM_RADIO_PHY + ${RADIO_DIR}/rail_lib/plugin/rail_util_protocol/sl_rail_util_protocol.c + ) + endif() +endif() + +zephyr_include_directories( + ${DEVICE_DIR}/SiliconLabs/${SILABS_DEVICE_FAMILY}/Include + ${COMMON_DIR}/config + ${COMMON_DIR}/inc + ${EMLIB_DIR}/inc + ${PERIPHERAL_DIR}/inc + ${SERVICE_DIR}/device_init/config/s2 + ${SERVICE_DIR}/device_init/config/s2/sdid${CONFIG_SOC_GECKO_SDID} + ${SERVICE_DIR}/clock_manager/inc + ${SERVICE_DIR}/device_init/inc + ${SERVICE_DIR}/device_manager/inc + ${SERVICE_DIR}/hfxo_manager/config + ${SERVICE_DIR}/hfxo_manager/inc + ${SERVICE_DIR}/hfxo_manager/src + ${SERVICE_DIR}/memory_manager/inc + ${SERVICE_DIR}/memory_manager/profiler/inc + ${SERVICE_DIR}/power_manager/config + ${SERVICE_DIR}/power_manager/inc + ${SERVICE_DIR}/power_manager/src + ${SERVICE_DIR}/sleeptimer/config + ${SERVICE_DIR}/sleeptimer/inc + ${SERVICE_DIR}/sleeptimer/src + ${SECURITY_DIR}/sl_component/sl_protocol_crypto/src + ${BOARD_DIR} +) + +zephyr_compile_definitions( + ${SILABS_DEVICE_PART_NUMBER} +) + +zephyr_compile_definitions_ifdef(CONFIG_SOC_GECKO_DEV_INIT + SL_CATALOG_POWER_MANAGER_PRESENT + SL_CATALOG_HFXO_MANAGER_PRESENT +) + +zephyr_compile_options( + -mcmse # Cortex-M Security Extensions are needed for startup code +) + +zephyr_library_sources( + ${DEVICE_DIR}/SiliconLabs/${SILABS_DEVICE_FAMILY}/Source/system_${CONFIG_SOC_SERIES}.c + ${EMLIB_DIR}/src/em_system.c + ${SERVICE_DIR}/clock_manager/src/sl_clock_manager.c + ${SERVICE_DIR}/clock_manager/src/sl_clock_manager_hal_s2.c + ${SERVICE_DIR}/device_manager/devices/sl_device_peripheral_hal_efr32xg${SILABS_DEVICE_FAMILY_NUMBER}.c + ${SERVICE_DIR}/device_manager/gpios/sl_device_gpio_common.c + ${SERVICE_DIR}/device_manager/src/sl_device_clock.c + ${SERVICE_DIR}/device_manager/src/sl_device_gpio.c + ${SERVICE_DIR}/device_manager/src/sl_device_peripheral.c +) + +if(NOT SILABS_DEVICE_FAMILY_NUMBER EQUAL "21") + zephyr_library_sources( + ${SERVICE_DIR}/device_manager/clocks/sl_device_clock_efr32xg${SILABS_DEVICE_FAMILY_NUMBER}.c + ) +endif() + +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_IADC ${EMLIB_DIR}/src/em_iadc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_BURTC ${EMLIB_DIR}/src/em_burtc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CMU ${EMLIB_DIR}/src/em_cmu.c) + +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_DEV_INIT + ${SERVICE_DIR}/device_init/src/sl_device_init_dcdc_s2.c + ${SERVICE_DIR}/device_init/src/sl_device_init_dpll_s2.c + ${SERVICE_DIR}/device_init/src/sl_device_init_hfrco.c + ${SERVICE_DIR}/device_init/src/sl_device_init_hfxo_s2.c + ${SERVICE_DIR}/device_init/src/sl_device_init_nvic.c + ${SERVICE_DIR}/power_manager/src/sl_power_manager.c + ${SERVICE_DIR}/power_manager/src/sl_power_manager_hal_s2.c + ${SERVICE_DIR}/hfxo_manager/src/sl_hfxo_manager.c + ${SERVICE_DIR}/hfxo_manager/src/sl_hfxo_manager_hal_s2.c + ${SERVICE_DIR}/memory_manager/profiler/src/sli_memory_profiler_stubs.c +) + +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_DEV_INIT ${COMMON_DIR}/src/sl_slist.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CORE + ${EMLIB_DIR}/src/em_core.c + ${COMMON_DIR}/src/sl_core_cortexm.c +) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CRYOTIMER ${EMLIB_DIR}/src/em_cryotimer.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_EMU ${EMLIB_DIR}/src/em_emu.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_GPIO ${EMLIB_DIR}/src/em_gpio.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_I2C ${EMLIB_DIR}/src/em_i2c.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_LETIMER ${EMLIB_DIR}/src/em_letimer.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_LEUART ${EMLIB_DIR}/src/em_leuart.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_MSC ${EMLIB_DIR}/src/em_msc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_PRS ${EMLIB_DIR}/src/em_prs.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_RMU ${EMLIB_DIR}/src/em_rmu.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_RTC ${EMLIB_DIR}/src/em_rtc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_RTCC ${EMLIB_DIR}/src/em_rtcc.c) +zephyr_library_sources_ifdef(CONFIG_COUNTER_GECKO_STIMER + ${PERIPHERAL_DIR}/src/sl_hal_sysrtc.c + ${SERVICE_DIR}/sleeptimer/src/sl_sleeptimer_hal_rtcc.c + ${SERVICE_DIR}/sleeptimer/src/sl_sleeptimer_hal_sysrtc.c + ${SERVICE_DIR}/sleeptimer/src/sl_sleeptimer.c +) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_EUSART ${EMLIB_DIR}/src/em_eusart.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_TIMER ${EMLIB_DIR}/src/em_timer.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_USART ${EMLIB_DIR}/src/em_usart.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_WDOG ${EMLIB_DIR}/src/em_wdog.c) + +zephyr_include_directories_ifdef(CONFIG_SOC_GECKO_SE + ${SECURITY_DIR}/sl_component/se_manager/src + ${SECURITY_DIR}/sl_component/se_manager/inc +) + +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_SE + ${EMLIB_DIR}/src/em_se.c + ${SECURITY_DIR}/sl_component/se_manager/src/sl_se_manager.c + ${SECURITY_DIR}/sl_component/se_manager/src/sl_se_manager_util.c + ${SECURITY_DIR}/sl_component/se_manager/src/sli_se_manager_mailbox.c +) + +zephyr_library_sources_ifdef(CONFIG_ENTROPY_GECKO_SE + ${SECURITY_DIR}/sl_component/se_manager/src/sl_se_manager_entropy.c +) + +zephyr_library_sources(src/sl_memory_manager_shim.c) diff --git a/modules/hal_silabs/simplicity_sdk/src/sl_memory_manager_shim.c b/modules/hal_silabs/simplicity_sdk/src/sl_memory_manager_shim.c new file mode 100644 index 0000000000000..d08ccd61d3df5 --- /dev/null +++ b/modules/hal_silabs/simplicity_sdk/src/sl_memory_manager_shim.c @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024 Silicon Laboratories Inc. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Shim basic sl_* allocation functions to libc malloc, which again + * will get redirected to the Zephyr sys_heap. + */ + +#include "sl_memory_manager.h" +#include + +void *sl_malloc(size_t size) +{ + return malloc(size); +} + +void sl_free(void *ptr) +{ + free(ptr); +} + +void *sl_calloc(size_t item_count, size_t size) +{ + return calloc(item_count, size); +} + +void *sl_realloc(void *ptr, size_t size) +{ + return realloc(ptr, size); +} diff --git a/west.yml b/west.yml index f1146918cd9eb..626c14ab507ec 100644 --- a/west.yml +++ b/west.yml @@ -223,7 +223,7 @@ manifest: groups: - hal - name: hal_silabs - revision: d07d744a933bada3a87377dc46241960f620011f + revision: 5c7a7834a6df7882518a2da127f950d80987dfcb path: modules/hal/silabs groups: - hal From 3d0909ed18cf3d43da28a53f881d5a4d2abada9a Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Wed, 2 Oct 2024 21:13:46 +0200 Subject: [PATCH 1294/4482] soc: silabs: Initialize DCDC from device tree The DC-DC converter was unconditionally initialized with default settings on Series 2. Add device tree binding and nodes, and guard call to init function. Map DT options to config header from HAL. Signed-off-by: Aksel Skauge Mellbye --- boards/silabs/dev_kits/sltb010a/sltb010a.dts | 7 +++ .../dev_kits/xg24_dk2601b/xg24_dk2601b.dts | 8 +++ .../dev_kits/xg27_dk2602a/xg27_dk2602a.dts | 7 +++ .../xg24_rb4187c/xg24_rb4187c.dts | 8 +++ .../sparkfun_thing_plus_matter_mgm240p.dts | 8 +++ dts/arm/silabs/efr32bg22.dtsi | 4 ++ dts/arm/silabs/efr32bg27.dtsi | 4 ++ dts/arm/silabs/efr32bg2x.dtsi | 6 ++ dts/arm/silabs/efr32mg24.dtsi | 7 +++ .../regulator/silabs,series2-dcdc.yaml | 63 +++++++++++++++++++ .../dt-bindings/regulator/silabs_dcdc.h | 27 ++++++++ .../hal_silabs/simplicity_sdk/CMakeLists.txt | 7 ++- .../config/sl_device_init_dcdc_config.h | 35 +++++++++++ soc/silabs/CMakeLists.txt | 1 + soc/silabs/common/soc.c | 4 +- soc/silabs/silabs_s2/CMakeLists.txt | 2 + 16 files changed, 196 insertions(+), 2 deletions(-) create mode 100644 dts/bindings/regulator/silabs,series2-dcdc.yaml create mode 100644 include/zephyr/dt-bindings/regulator/silabs_dcdc.h create mode 100644 modules/hal_silabs/simplicity_sdk/config/sl_device_init_dcdc_config.h create mode 100644 soc/silabs/silabs_s2/CMakeLists.txt diff --git a/boards/silabs/dev_kits/sltb010a/sltb010a.dts b/boards/silabs/dev_kits/sltb010a/sltb010a.dts index 3f352ea6008f1..b0d0e16a4f01b 100644 --- a/boards/silabs/dev_kits/sltb010a/sltb010a.dts +++ b/boards/silabs/dev_kits/sltb010a/sltb010a.dts @@ -8,6 +8,7 @@ #include #include #include "thunderboard.dtsi" +#include / { /* These aliases are provided for compatibility with samples */ @@ -27,6 +28,12 @@ }; }; +&dcdc { + status = "okay"; + regulator-boot-on; + regulator-initial-mode = ; +}; + &flash0 { partitions { /* Reserve 48 KiB for the bootloader */ diff --git a/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b.dts b/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b.dts index ac03b32ff37e5..2b6a5a3607903 100644 --- a/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b.dts +++ b/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b.dts @@ -8,6 +8,7 @@ #include #include #include +#include / { model = "Silicon Labs BRD2601B (xG24 Dev Kit)"; @@ -132,6 +133,13 @@ status = "okay"; }; +&dcdc { + status = "okay"; + regulator-boot-on; + regulator-initial-mode = ; + silabs,pfmx-peak-current-milliamp = <120>; +}; + &flash0 { partitions { compatible = "fixed-partitions"; diff --git a/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a.dts b/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a.dts index 6dba2bfa6485d..aa1da7f157f93 100644 --- a/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a.dts +++ b/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a.dts @@ -8,6 +8,7 @@ #include #include #include "thunderboard.dtsi" +#include / { model = "Silicon Labs xG27-DK2602A Dev Kit"; @@ -31,6 +32,12 @@ }; }; +&dcdc { + status = "okay"; + regulator-boot-on; + regulator-initial-mode = ; +}; + &flash0 { partitions { /* Reserve 48 KiB for the bootloader */ diff --git a/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts b/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts index 21a487e758fd5..b5caabdbf3163 100644 --- a/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts +++ b/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts @@ -7,6 +7,7 @@ /dts-v1/; #include #include +#include #include "xg24_rb4187c-pinctrl.dtsi" / { @@ -117,6 +118,13 @@ status = "okay"; }; +&dcdc { + status = "okay"; + regulator-boot-on; + regulator-initial-mode = ; + silabs,pfmx-peak-current-milliamp = <100>; +}; + &flash0 { partitions { compatible = "fixed-partitions"; diff --git a/boards/sparkfun/thing_plus_matter_mgm240p/sparkfun_thing_plus_matter_mgm240p.dts b/boards/sparkfun/thing_plus_matter_mgm240p/sparkfun_thing_plus_matter_mgm240p.dts index 4f12a4868157d..d137aab6ed3f0 100644 --- a/boards/sparkfun/thing_plus_matter_mgm240p/sparkfun_thing_plus_matter_mgm240p.dts +++ b/boards/sparkfun/thing_plus_matter_mgm240p/sparkfun_thing_plus_matter_mgm240p.dts @@ -9,6 +9,7 @@ #include #include "sparkfun_thing_plus_matter_mgm240p-pinctrl.dtsi" #include +#include / { model = "Sparkfun MGM240P (Sparkfun Thing Plus Matter)"; @@ -101,6 +102,13 @@ status = "okay"; }; +&dcdc { + status = "okay"; + regulator-boot-on; + regulator-initial-mode = ; + silabs,pfmx-peak-current-milliamp = <50>; +}; + &flash0 { partitions { compatible = "fixed-partitions"; diff --git a/dts/arm/silabs/efr32bg22.dtsi b/dts/arm/silabs/efr32bg22.dtsi index bcf918a9164f6..03a7c788396ce 100644 --- a/dts/arm/silabs/efr32bg22.dtsi +++ b/dts/arm/silabs/efr32bg22.dtsi @@ -59,3 +59,7 @@ interrupts = <12 0>; clocks = <&cmu CLOCK_RTCC CLOCK_BRANCH_RTCCCLK>; }; + +&dcdc { + interrupts = <61 0>; +}; diff --git a/dts/arm/silabs/efr32bg27.dtsi b/dts/arm/silabs/efr32bg27.dtsi index 448761f3a5021..654168ce52c5a 100644 --- a/dts/arm/silabs/efr32bg27.dtsi +++ b/dts/arm/silabs/efr32bg27.dtsi @@ -64,3 +64,7 @@ interrupts = <54 0>; clocks = <&cmu CLOCK_IADC0 CLOCK_BRANCH_IADCCLK>; }; + +&dcdc { + interrupts = <8 0>; +}; diff --git a/dts/arm/silabs/efr32bg2x.dtsi b/dts/arm/silabs/efr32bg2x.dtsi index ca42d7c0888c2..c65077e0b296f 100644 --- a/dts/arm/silabs/efr32bg2x.dtsi +++ b/dts/arm/silabs/efr32bg2x.dtsi @@ -231,6 +231,12 @@ status = "disabled"; #io-channel-cells = <1>; }; + + dcdc: dcdc@50094000 { + compatible = "silabs,series2-dcdc"; + reg = <0x50094000 0x4000>; + status = "disabled"; + }; }; bt_hci_silabs: bt_hci_silabs { diff --git a/dts/arm/silabs/efr32mg24.dtsi b/dts/arm/silabs/efr32mg24.dtsi index c12421bc60212..c583012cd8d18 100644 --- a/dts/arm/silabs/efr32mg24.dtsi +++ b/dts/arm/silabs/efr32mg24.dtsi @@ -248,6 +248,13 @@ status = "disabled"; #io-channel-cells = <1>; }; + + dcdc: dcdc@50094000 { + compatible = "silabs,series2-dcdc"; + reg = <0x50094000 0x4000>; + interrupts = <53 0>; + status = "disabled"; + }; }; diff --git a/dts/bindings/regulator/silabs,series2-dcdc.yaml b/dts/bindings/regulator/silabs,series2-dcdc.yaml new file mode 100644 index 0000000000000..1099e99c698a1 --- /dev/null +++ b/dts/bindings/regulator/silabs,series2-dcdc.yaml @@ -0,0 +1,63 @@ +# Copyright (c) 2024 Silicon Laboratories Inc. +# SPDX-License-Identifier: Apache-2.0 + +description: | + Silicon Labs Series 2 DC-DC converter. + + Include the bindings header file to get + access to relevant symbols for configuration. + + The following standard properties are supported: + + `regulator-boot-on` + Enable DC-DC converter at boot. If not set, the DC-DC converter is powered off. + `regulator-allow-bypass` + Enable bypass mode. If combined with `regulator-boot-on`, the DC-DC converter + is initialized to bypass mode. + `regulator-initial-mode` + DCDC operating mode. One of `SILABS_DCDC_MODE_BUCK` or `SILABS_DCDC_MODE_BOOST`. + `regulator-init-microvolt` + Output voltage for boost mode. Not used in buck mode. + +compatible: "silabs,series2-dcdc" + +include: + - name: base.yaml + - name: regulator.yaml + property-allowlist: + - regulator-boot-on + - regulator-allow-bypass + - regulator-initial-mode + - regulator-init-microvolt + +properties: + reg: + required: true + + regulator-initial-mode: + enum: [0, 1] + + regulator-init-microvolt: + enum: + - 1800000 + - 1900000 + - 2000000 + - 2100000 + - 2200000 + - 2300000 + - 2400000 + + silabs,pfmx-peak-current-milliamp: + type: int + description: Peak current draw in PFMX mode (CCM, continuous conduction mode). + enum: + - 50 + - 65 + - 73 + - 80 + - 86 + - 93 + - 100 + - 106 + - 113 + - 120 diff --git a/include/zephyr/dt-bindings/regulator/silabs_dcdc.h b/include/zephyr/dt-bindings/regulator/silabs_dcdc.h new file mode 100644 index 0000000000000..f2547346bc3f6 --- /dev/null +++ b/include/zephyr/dt-bindings/regulator/silabs_dcdc.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2024 Silicon Laboratories Inc. + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_REGULATOR_SILABS_DCDC_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_REGULATOR_SILABS_DCDC_H_ + +/** + * @defgroup regulator_silabs_dcdc Silabs DCDC devicetree helpers. + * @ingroup regulator_interface + * @{ + */ + +/** + * @name Silabs DCDC modes + * @{ + */ +/** Buck mode */ +#define SILABS_DCDC_MODE_BUCK 0 +/** Boost mode */ +#define SILABS_DCDC_MODE_BOOST 1 +/** @} */ + +/** @} */ + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_REGULATOR_SILABS_DCDC_H_ */ diff --git a/modules/hal_silabs/simplicity_sdk/CMakeLists.txt b/modules/hal_silabs/simplicity_sdk/CMakeLists.txt index 842d5383e8324..f329683e2b098 100644 --- a/modules/hal_silabs/simplicity_sdk/CMakeLists.txt +++ b/modules/hal_silabs/simplicity_sdk/CMakeLists.txt @@ -86,6 +86,7 @@ if(CONFIG_SOC_GECKO_HAS_RADIO) endif() zephyr_include_directories( + config ${DEVICE_DIR}/SiliconLabs/${SILABS_DEVICE_FAMILY}/Include ${COMMON_DIR}/config ${COMMON_DIR}/inc @@ -146,8 +147,12 @@ zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_IADC ${EMLIB_DIR}/src/em_i zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_BURTC ${EMLIB_DIR}/src/em_burtc.c) zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CMU ${EMLIB_DIR}/src/em_cmu.c) -zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_DEV_INIT +if(CONFIG_SOC_GECKO_DEV_INIT) +zephyr_library_sources_ifdef(CONFIG_DT_HAS_SILABS_SERIES2_DCDC_ENABLED ${SERVICE_DIR}/device_init/src/sl_device_init_dcdc_s2.c +) +endif() +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_DEV_INIT ${SERVICE_DIR}/device_init/src/sl_device_init_dpll_s2.c ${SERVICE_DIR}/device_init/src/sl_device_init_hfrco.c ${SERVICE_DIR}/device_init/src/sl_device_init_hfxo_s2.c diff --git a/modules/hal_silabs/simplicity_sdk/config/sl_device_init_dcdc_config.h b/modules/hal_silabs/simplicity_sdk/config/sl_device_init_dcdc_config.h new file mode 100644 index 0000000000000..1c7eb06a9d0d1 --- /dev/null +++ b/modules/hal_silabs/simplicity_sdk/config/sl_device_init_dcdc_config.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Silicon Laboratories Inc. + * + * SPDX-License-Identifier: Apache-2.0 + * + * This configuration header is used by the HAL driver device_init_dcdc from hal_silabs, + * invoked through the soc_early_init hook. DeviceTree options are converted to config macros + * expected by the HAL driver. + */ + +#ifndef SL_DEVICE_INIT_DCDC_CONFIG_H +#define SL_DEVICE_INIT_DCDC_CONFIG_H + +#include + +#if DT_HAS_COMPAT_STATUS_OKAY(silabs_series2_dcdc) + +#define DCDC_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(silabs_series2_dcdc) + +#define SL_DEVICE_INIT_DCDC_ENABLE DT_PROP(DCDC_NODE, regulator_boot_on) +#define SL_DEVICE_INIT_DCDC_BYPASS DT_PROP(DCDC_NODE, regulator_allow_bypass) + +#define SL_DEVICE_INIT_DCDC_TYPE DT_PROP_OR(DCDC_NODE, regulator_initial_mode, 0) + +#define SL_DEVICE_INIT_DCDC_BOOST_OUTPUT DT_ENUM_IDX(DCDC_NODE, regulator_init_microvolt) + +#define SL_DEVICE_INIT_DCDC_PFMX_IPKVAL_OVERRIDE \ + DT_NODE_HAS_PROP(DCDC_NODE, silabs_pfmx_peak_current_milliamp) + +#define SL_DEVICE_INIT_DCDC_PFMX_IPKVAL \ + (DT_ENUM_IDX(DCDC_NODE, silabs_pfmx_peak_current_milliamp) + 3) + +#endif /* DT_HAS_COMPAT_STATUS_OKAY */ + +#endif /* SL_DEVICE_INIT_DCDC_CONFIG_H */ diff --git a/soc/silabs/CMakeLists.txt b/soc/silabs/CMakeLists.txt index 53c5acb87d2ea..d173ecfec669c 100644 --- a/soc/silabs/CMakeLists.txt +++ b/soc/silabs/CMakeLists.txt @@ -4,4 +4,5 @@ add_subdirectory(common) zephyr_include_directories(${SOC_FAMILY}/${SOC_SERIES}) +add_subdirectory_ifdef(CONFIG_SOC_FAMILY_SILABS_S2 silabs_s2) add_subdirectory_ifdef(CONFIG_SOC_SERIES_SIM3U silabs_sim3/sim3u) diff --git a/soc/silabs/common/soc.c b/soc/silabs/common/soc.c index d406e615a913c..8453f1f9fcaf7 100644 --- a/soc/silabs/common/soc.c +++ b/soc/silabs/common/soc.c @@ -214,7 +214,9 @@ void soc_early_init_hook(void) #endif #ifdef CONFIG_SOC_GECKO_DEV_INIT - sl_device_init_dcdc(); + if (DT_HAS_COMPAT_STATUS_OKAY(silabs_series2_dcdc)) { + sl_device_init_dcdc(); + } sl_device_init_hfxo(); sl_device_init_dpll(); diff --git a/soc/silabs/silabs_s2/CMakeLists.txt b/soc/silabs/silabs_s2/CMakeLists.txt new file mode 100644 index 0000000000000..5b11abea25e04 --- /dev/null +++ b/soc/silabs/silabs_s2/CMakeLists.txt @@ -0,0 +1,2 @@ +# Copyright (c) 2024 Silicon Laboratories Inc. +# SPDX-License-Identifier: Apache-2.0 From fff250c21d8b89729eaaeab2f4125c3a5031bf20 Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Wed, 9 Oct 2024 13:48:06 +0200 Subject: [PATCH 1295/4482] soc: silabs: Introduce family specific defconfig Defconfig was only available at the vendor and series level, make it possible to have family specific definitions too. Signed-off-by: Aksel Skauge Mellbye --- soc/silabs/Kconfig.defconfig | 2 +- soc/silabs/silabs_s0/Kconfig.defconfig | 4 ++++ soc/silabs/silabs_s1/Kconfig.defconfig | 4 ++++ soc/silabs/silabs_s2/Kconfig.defconfig | 4 ++++ soc/silabs/silabs_sim3/Kconfig.defconfig | 4 ++++ 5 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 soc/silabs/silabs_s0/Kconfig.defconfig create mode 100644 soc/silabs/silabs_s1/Kconfig.defconfig create mode 100644 soc/silabs/silabs_s2/Kconfig.defconfig create mode 100644 soc/silabs/silabs_sim3/Kconfig.defconfig diff --git a/soc/silabs/Kconfig.defconfig b/soc/silabs/Kconfig.defconfig index c4c0f859b9a9b..5c55a394c687c 100644 --- a/soc/silabs/Kconfig.defconfig +++ b/soc/silabs/Kconfig.defconfig @@ -1,7 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2017 Christian Taedcke -rsource "*/*/Kconfig.defconfig" +rsource "*/Kconfig.defconfig" if SOC_FAMILY_SILABS_S0 || SOC_FAMILY_SILABS_S1 || SOC_FAMILY_SILABS_S2 diff --git a/soc/silabs/silabs_s0/Kconfig.defconfig b/soc/silabs/silabs_s0/Kconfig.defconfig new file mode 100644 index 0000000000000..45c44c5b74539 --- /dev/null +++ b/soc/silabs/silabs_s0/Kconfig.defconfig @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Silicon Laboratories Inc. +# SPDX-License-Identifier: Apache-2.0 + +rsource "*/Kconfig.defconfig" diff --git a/soc/silabs/silabs_s1/Kconfig.defconfig b/soc/silabs/silabs_s1/Kconfig.defconfig new file mode 100644 index 0000000000000..45c44c5b74539 --- /dev/null +++ b/soc/silabs/silabs_s1/Kconfig.defconfig @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Silicon Laboratories Inc. +# SPDX-License-Identifier: Apache-2.0 + +rsource "*/Kconfig.defconfig" diff --git a/soc/silabs/silabs_s2/Kconfig.defconfig b/soc/silabs/silabs_s2/Kconfig.defconfig new file mode 100644 index 0000000000000..45c44c5b74539 --- /dev/null +++ b/soc/silabs/silabs_s2/Kconfig.defconfig @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Silicon Laboratories Inc. +# SPDX-License-Identifier: Apache-2.0 + +rsource "*/Kconfig.defconfig" diff --git a/soc/silabs/silabs_sim3/Kconfig.defconfig b/soc/silabs/silabs_sim3/Kconfig.defconfig new file mode 100644 index 0000000000000..45c44c5b74539 --- /dev/null +++ b/soc/silabs/silabs_sim3/Kconfig.defconfig @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Silicon Laboratories Inc. +# SPDX-License-Identifier: Apache-2.0 + +rsource "*/Kconfig.defconfig" From 046766573daf5c3e1f4595e630f09f24f16f3c7c Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Wed, 9 Oct 2024 14:18:09 +0200 Subject: [PATCH 1296/4482] soc: silabs: Derive SYS_CLOCK_HW_CYCLES_PER_SEC from DT On Series 2, set the SYS_CLOCK_HW_CYCLES_PER_SEC Kconfig option from DeviceTree, rather than separately configuring it in board-level defconfig. Signed-off-by: Aksel Skauge Mellbye --- boards/silabs/dev_kits/sltb010a/sltb010a_defconfig | 4 ---- .../silabs/dev_kits/xg24_dk2601b/xg24_dk2601b_defconfig | 1 - .../silabs/dev_kits/xg27_dk2602a/xg27_dk2602a_defconfig | 4 ---- .../silabs/radio_boards/slwrb4180a/slwrb4180a_defconfig | 1 - boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts | 2 +- .../radio_boards/xg24_rb4187c/xg24_rb4187c_defconfig | 1 - soc/silabs/silabs_s2/Kconfig.defconfig | 8 ++++++++ 7 files changed, 9 insertions(+), 12 deletions(-) diff --git a/boards/silabs/dev_kits/sltb010a/sltb010a_defconfig b/boards/silabs/dev_kits/sltb010a/sltb010a_defconfig index 50a14221ec99e..1b801c67bf81e 100644 --- a/boards/silabs/dev_kits/sltb010a/sltb010a_defconfig +++ b/boards/silabs/dev_kits/sltb010a/sltb010a_defconfig @@ -10,10 +10,6 @@ CONFIG_SOC_GECKO_EMU_DCDC_MODE_ON=y CONFIG_HW_STACK_PROTECTION=y CONFIG_PINCTRL=y -# Used if SysTick is enabled, ignored for BURTC -# (BURTC uses TIMER_READS_ITS_FREQUENCY_AT_RUNTIME) -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=76800000 - # Use BURTC as system clock source CONFIG_GECKO_BURTC_TIMER=y CONFIG_CMU_BURTCCLK_LFXO=y diff --git a/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b_defconfig b/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b_defconfig index caadb4bb35b1e..c1fa5ece8551b 100644 --- a/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b_defconfig +++ b/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b_defconfig @@ -7,7 +7,6 @@ CONFIG_UART_CONSOLE=y CONFIG_SERIAL=y CONFIG_CORTEX_M_SYSTICK=y CONFIG_GPIO=y -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=76800000 CONFIG_CMU_HFCLK_HFXO=y CONFIG_CMU_HFCLK_LFXO=y CONFIG_HW_STACK_PROTECTION=y diff --git a/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a_defconfig b/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a_defconfig index 50a14221ec99e..1b801c67bf81e 100644 --- a/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a_defconfig +++ b/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a_defconfig @@ -10,10 +10,6 @@ CONFIG_SOC_GECKO_EMU_DCDC_MODE_ON=y CONFIG_HW_STACK_PROTECTION=y CONFIG_PINCTRL=y -# Used if SysTick is enabled, ignored for BURTC -# (BURTC uses TIMER_READS_ITS_FREQUENCY_AT_RUNTIME) -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=76800000 - # Use BURTC as system clock source CONFIG_GECKO_BURTC_TIMER=y CONFIG_CMU_BURTCCLK_LFXO=y diff --git a/boards/silabs/radio_boards/slwrb4180a/slwrb4180a_defconfig b/boards/silabs/radio_boards/slwrb4180a/slwrb4180a_defconfig index 053f12a36f4f2..df0f15bdee659 100644 --- a/boards/silabs/radio_boards/slwrb4180a/slwrb4180a_defconfig +++ b/boards/silabs/radio_boards/slwrb4180a/slwrb4180a_defconfig @@ -5,6 +5,5 @@ CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y CONFIG_SERIAL=y CONFIG_GPIO=y -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=38400000 CONFIG_CMU_HFCLK_HFXO=y CONFIG_PINCTRL=y diff --git a/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts b/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts index b5caabdbf3163..8f733f406e5e8 100644 --- a/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts +++ b/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts @@ -61,7 +61,7 @@ }; &cpu0 { - clock-frequency = <39000000>; + clock-frequency = <78000000>; }; &pstate_em3 { diff --git a/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c_defconfig b/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c_defconfig index 7e41ebc6a13c0..c8415198cbc17 100644 --- a/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c_defconfig +++ b/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c_defconfig @@ -5,7 +5,6 @@ CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y CONFIG_SERIAL=y CONFIG_GPIO=y -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=78000000 CONFIG_SOC_GECKO_EMU_DCDC=y CONFIG_SOC_GECKO_EMU_DCDC_MODE_ON=y CONFIG_PINCTRL=y diff --git a/soc/silabs/silabs_s2/Kconfig.defconfig b/soc/silabs/silabs_s2/Kconfig.defconfig index 45c44c5b74539..733c7c4df618a 100644 --- a/soc/silabs/silabs_s2/Kconfig.defconfig +++ b/soc/silabs/silabs_s2/Kconfig.defconfig @@ -2,3 +2,11 @@ # SPDX-License-Identifier: Apache-2.0 rsource "*/Kconfig.defconfig" + +if SOC_FAMILY_SILABS_S2 + +config SYS_CLOCK_HW_CYCLES_PER_SEC + default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency) if CORTEX_M_SYSTICK + default 32768 + +endif From 25e998fc04950dc908d687d5e596144766adea14 Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Wed, 2 Oct 2024 21:25:14 +0200 Subject: [PATCH 1297/4482] soc: silabs: Enable device init on EFR32MG21 Switch EFR32MG21 to use the device init HAL. This makes the init sequence the same as the rest of Series 2. Signed-off-by: Aksel Skauge Mellbye --- boards/silabs/radio_boards/slwrb4180a/slwrb4180a.dts | 2 +- .../radio_boards/slwrb4180a/slwrb4180a_defconfig | 1 - dts/arm/silabs/efr32mg21.dtsi | 12 +++++++++++- soc/silabs/silabs_s2/efr32mg21/Kconfig | 1 + soc/silabs/silabs_s2/efr32mg21/Kconfig.defconfig | 4 ++++ 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/boards/silabs/radio_boards/slwrb4180a/slwrb4180a.dts b/boards/silabs/radio_boards/slwrb4180a/slwrb4180a.dts index 9d7615047839a..c115fcf21b627 100644 --- a/boards/silabs/radio_boards/slwrb4180a/slwrb4180a.dts +++ b/boards/silabs/radio_boards/slwrb4180a/slwrb4180a.dts @@ -61,7 +61,7 @@ }; &cpu0 { - clock-frequency = <38400000>; + clock-frequency = <76800000>; }; &usart0 { diff --git a/boards/silabs/radio_boards/slwrb4180a/slwrb4180a_defconfig b/boards/silabs/radio_boards/slwrb4180a/slwrb4180a_defconfig index df0f15bdee659..6559f1ffd2120 100644 --- a/boards/silabs/radio_boards/slwrb4180a/slwrb4180a_defconfig +++ b/boards/silabs/radio_boards/slwrb4180a/slwrb4180a_defconfig @@ -5,5 +5,4 @@ CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y CONFIG_SERIAL=y CONFIG_GPIO=y -CONFIG_CMU_HFCLK_HFXO=y CONFIG_PINCTRL=y diff --git a/dts/arm/silabs/efr32mg21.dtsi b/dts/arm/silabs/efr32mg21.dtsi index fa6a47f6d8d04..ea274bc89fecd 100644 --- a/dts/arm/silabs/efr32mg21.dtsi +++ b/dts/arm/silabs/efr32mg21.dtsi @@ -9,6 +9,7 @@ #include #include #include +#include #include "gpio_gecko.h" / { @@ -50,6 +51,15 @@ #clock-cells = <2>; }; + clk_hfxo: clk-hfxo@5000c000 { + #clock-cells = <0>; + compatible = "silabs,hfxo"; + reg = <0x5000c000 0x4000>; + clock-frequency = ; + ctune = <140>; + precision = <50>; + }; + msc: flash-controller@50030000 { compatible = "silabs,gecko-flash-controller"; reg = <0x50030000 0x31a4>; @@ -118,7 +128,7 @@ }; rtcc0: rtcc@58000000 { - compatible = "silabs,gecko-rtcc"; + compatible = "silabs,gecko-stimer"; reg = <0x58000000 0x400>; interrupts = <10 0>; clock-frequency = <32768>; diff --git a/soc/silabs/silabs_s2/efr32mg21/Kconfig b/soc/silabs/silabs_s2/efr32mg21/Kconfig index aa3eeefc4c080..0e34a386b14e8 100644 --- a/soc/silabs/silabs_s2/efr32mg21/Kconfig +++ b/soc/silabs/silabs_s2/efr32mg21/Kconfig @@ -15,6 +15,7 @@ config SOC_SERIES_EFR32MG21 select SOC_GECKO_CMU select SOC_GECKO_EMU select SOC_GECKO_GPIO + select SOC_GECKO_DEV_INIT select SOC_GECKO_SE select HAS_PM diff --git a/soc/silabs/silabs_s2/efr32mg21/Kconfig.defconfig b/soc/silabs/silabs_s2/efr32mg21/Kconfig.defconfig index ede0fd2d1c0d3..f7b286bd73baf 100644 --- a/soc/silabs/silabs_s2/efr32mg21/Kconfig.defconfig +++ b/soc/silabs/silabs_s2/efr32mg21/Kconfig.defconfig @@ -8,6 +8,10 @@ config NUM_IRQS # must be >= the highest interrupt number used default 61 +config PM + select COUNTER + select UART_INTERRUPT_DRIVEN + config GPIO_GECKO default y depends on GPIO || LOG_BACKEND_SWO From 634976f535063cce79b4514f56e55da296b05453 Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Wed, 2 Oct 2024 22:20:50 +0200 Subject: [PATCH 1298/4482] dts: silabs: Add clock bindings and clock tree Introduce bindings for Series 2 oscillators: HFRCODPLL, HFRCOEM23, LFRCO and LFXO. Add clock tree representation in devicetree `clocks` node. Signed-off-by: Aksel Skauge Mellbye --- boards/silabs/dev_kits/sltb010a/sltb010a.dts | 38 ++++ .../dev_kits/xg24_dk2601b/xg24_dk2601b.dts | 42 +++++ .../dev_kits/xg27_dk2602a/xg27_dk2602a.dts | 38 ++++ .../radio_boards/slwrb4180a/slwrb4180a.dts | 42 +++++ .../xg24_rb4187c/xg24_rb4187c.dts | 42 +++++ .../sparkfun_thing_plus_matter_mgm240p.dts | 16 ++ dts/arm/silabs/efr32bg22.dtsi | 19 ++ dts/arm/silabs/efr32bg27.dtsi | 29 +++ dts/arm/silabs/efr32bg2x.dtsi | 132 ++++++++++++- dts/arm/silabs/efr32mg21.dtsi | 131 ++++++++++++- dts/arm/silabs/efr32mg24.dtsi | 176 +++++++++++++++++- dts/bindings/clock/silabs,hfxo.yaml | 8 + .../clock/silabs,series2-hfrcodpll.yaml | 37 ++++ .../clock/silabs,series2-hfrcoem23.yaml | 20 ++ dts/bindings/clock/silabs,series2-lfrco.yaml | 13 ++ dts/bindings/clock/silabs,series2-lfxo.yaml | 29 +++ 16 files changed, 801 insertions(+), 11 deletions(-) create mode 100644 dts/bindings/clock/silabs,series2-hfrcodpll.yaml create mode 100644 dts/bindings/clock/silabs,series2-hfrcoem23.yaml create mode 100644 dts/bindings/clock/silabs,series2-lfrco.yaml create mode 100644 dts/bindings/clock/silabs,series2-lfxo.yaml diff --git a/boards/silabs/dev_kits/sltb010a/sltb010a.dts b/boards/silabs/dev_kits/sltb010a/sltb010a.dts index b0d0e16a4f01b..b3b77a96a05c9 100644 --- a/boards/silabs/dev_kits/sltb010a/sltb010a.dts +++ b/boards/silabs/dev_kits/sltb010a/sltb010a.dts @@ -28,6 +28,44 @@ }; }; +&hfxo { + status = "okay"; + ctune = <120>; + precision = <50>; +}; + +&lfxo { + status = "okay"; + ctune = <37>; + precision = <50>; +}; + +&hfrcodpll { + clock-frequency = ; + clocks = <&hfxo>; + dpll-n = <3839>; + dpll-m = <1919>; + dpll-edge = "fall"; + dpll-lock = "phase"; + dpll-autorecover; +}; + +&em23grpaclk { + clocks = <&lfxo>; +}; + +&em4grpaclk { + clocks = <&lfxo>; +}; + +&rtccclk { + clocks = <&lfxo>; +}; + +&wdog0clk { + clocks = <&lfxo>; +}; + &dcdc { status = "okay"; regulator-boot-on; diff --git a/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b.dts b/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b.dts index 2b6a5a3607903..5c6e5934b3042 100644 --- a/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b.dts +++ b/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b.dts @@ -74,6 +74,48 @@ clock-frequency = <78000000>; }; +&hfxo { + status = "okay"; + ctune = <140>; + precision = <50>; +}; + +&lfxo { + status = "okay"; + ctune = <63>; + precision = <50>; +}; + +&hfrcodpll { + clock-frequency = ; + clocks = <&hfxo>; + dpll-n = <3839>; + dpll-m = <1919>; + dpll-edge = "fall"; + dpll-lock = "phase"; + dpll-autorecover; +}; + +&em23grpaclk { + clocks = <&lfxo>; +}; + +&em4grpaclk { + clocks = <&lfxo>; +}; + +&sysrtcclk { + clocks = <&lfxo>; +}; + +&wdog0clk { + clocks = <&lfxo>; +}; + +&wdog1clk { + clocks = <&lfxo>; +}; + &usart0 { current-speed = <115200>; pinctrl-0 = <&usart0_default>; diff --git a/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a.dts b/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a.dts index aa1da7f157f93..81342b36d8cf0 100644 --- a/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a.dts +++ b/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a.dts @@ -32,6 +32,44 @@ }; }; +&hfxo { + status = "okay"; + ctune = <140>; + precision = <50>; +}; + +&lfxo { + status = "okay"; + ctune = <63>; + precision = <50>; +}; + +&hfrcodpll { + clock-frequency = ; + clocks = <&hfxo>; + dpll-n = <3839>; + dpll-m = <1919>; + dpll-edge = "fall"; + dpll-lock = "phase"; + dpll-autorecover; +}; + +&em23grpaclk { + clocks = <&lfxo>; +}; + +&em4grpaclk { + clocks = <&lfxo>; +}; + +&rtccclk { + clocks = <&lfxo>; +}; + +&wdog0clk { + clocks = <&lfxo>; +}; + &dcdc { status = "okay"; regulator-boot-on; diff --git a/boards/silabs/radio_boards/slwrb4180a/slwrb4180a.dts b/boards/silabs/radio_boards/slwrb4180a/slwrb4180a.dts index c115fcf21b627..01027ae6700f4 100644 --- a/boards/silabs/radio_boards/slwrb4180a/slwrb4180a.dts +++ b/boards/silabs/radio_boards/slwrb4180a/slwrb4180a.dts @@ -64,6 +64,48 @@ clock-frequency = <76800000>; }; +&hfxo { + status = "okay"; + ctune = <129>; + precision = <50>; +}; + +&lfxo { + status = "okay"; + ctune = <79>; + precision = <50>; +}; + +&hfrcodpll { + clock-frequency = ; + clocks = <&hfxo>; + dpll-n = <3839>; + dpll-m = <1919>; + dpll-edge = "fall"; + dpll-lock = "phase"; + dpll-autorecover; +}; + +&em23grpaclk { + clocks = <&lfxo>; +}; + +&em4grpaclk { + clocks = <&lfxo>; +}; + +&rtccclk { + clocks = <&lfxo>; +}; + +&wdog0clk { + clocks = <&lfxo>; +}; + +&wdog1clk { + clocks = <&lfxo>; +}; + &usart0 { current-speed = <115200>; pinctrl-0 = <&usart0_default>; diff --git a/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts b/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts index 8f733f406e5e8..3d3c5064b0b7f 100644 --- a/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts +++ b/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts @@ -68,6 +68,48 @@ status = "disabled"; }; +&hfxo { + status = "okay"; + ctune = <95>; + precision = <50>; +}; + +&lfxo { + status = "okay"; + ctune = <44>; + precision = <50>; +}; + +&hfrcodpll { + clock-frequency = ; + clocks = <&hfxo>; + dpll-n = <3839>; + dpll-m = <1919>; + dpll-edge = "fall"; + dpll-lock = "phase"; + dpll-autorecover; +}; + +&em23grpaclk { + clocks = <&lfxo>; +}; + +&em4grpaclk { + clocks = <&lfxo>; +}; + +&sysrtcclk { + clocks = <&lfxo>; +}; + +&wdog0clk { + clocks = <&lfxo>; +}; + +&wdog1clk { + clocks = <&lfxo>; +}; + &usart0 { current-speed = <115200>; pinctrl-0 = <&usart0_default>; diff --git a/boards/sparkfun/thing_plus_matter_mgm240p/sparkfun_thing_plus_matter_mgm240p.dts b/boards/sparkfun/thing_plus_matter_mgm240p/sparkfun_thing_plus_matter_mgm240p.dts index d137aab6ed3f0..b518ef2542d9c 100644 --- a/boards/sparkfun/thing_plus_matter_mgm240p/sparkfun_thing_plus_matter_mgm240p.dts +++ b/boards/sparkfun/thing_plus_matter_mgm240p/sparkfun_thing_plus_matter_mgm240p.dts @@ -49,6 +49,22 @@ clock-frequency = <78000000>; }; +&hfxo { + status = "okay"; + ctune = <140>; + precision = <50>; +}; + +&hfrcodpll { + clock-frequency = ; + clocks = <&hfxo>; + dpll-n = <3839>; + dpll-m = <1919>; + dpll-edge = "fall"; + dpll-lock = "phase"; + dpll-autorecover; +}; + &usart0 { current-speed = <115200>; pinctrl-0 = <&usart0_default>; diff --git a/dts/arm/silabs/efr32bg22.dtsi b/dts/arm/silabs/efr32bg22.dtsi index 03a7c788396ce..56fd80195ba45 100644 --- a/dts/arm/silabs/efr32bg22.dtsi +++ b/dts/arm/silabs/efr32bg22.dtsi @@ -8,6 +8,25 @@ #include #include +/ { + clocks { + euart0clk: euart0clk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&em01grpaclk>; + }; + }; + + soc { + clkin0: clkin0@5003c454 { + #clock-cells = <0>; + compatible = "fixed-clock"; + reg = <0x5003c454 0x4>; + clock-frequency = ; + }; + }; +}; + &cmu { interrupts = <46 0>; }; diff --git a/dts/arm/silabs/efr32bg27.dtsi b/dts/arm/silabs/efr32bg27.dtsi index 654168ce52c5a..f78542809ac40 100644 --- a/dts/arm/silabs/efr32bg27.dtsi +++ b/dts/arm/silabs/efr32bg27.dtsi @@ -8,6 +8,35 @@ #include #include +/ { + clocks { + hfxort: hfxort { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&hfxo>; + }; + hfrcodpllrt: hfrcodpllrt { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&hfrcodpll>; + }; + eusart0clk: eusart0clk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&em01grpaclk>; + }; + }; + + soc { + clkin0: clkin0@5003c460 { + #clock-cells = <0>; + compatible = "fixed-clock"; + reg = <0x5003c460 0x4>; + clock-frequency = ; + }; + }; +}; + &cmu { interrupts = <52 0>; }; diff --git a/dts/arm/silabs/efr32bg2x.dtsi b/dts/arm/silabs/efr32bg2x.dtsi index c65077e0b296f..24bb3939d1c12 100644 --- a/dts/arm/silabs/efr32bg2x.dtsi +++ b/dts/arm/silabs/efr32bg2x.dtsi @@ -18,12 +18,85 @@ }; clocks { - clk_hfxo: clk-hfxo { + sysclk: sysclk { #clock-cells = <0>; - compatible = "silabs,hfxo"; - clock-frequency = ; - ctune = <120>; - precision = <50>; + compatible = "fixed-factor-clock"; + clocks = <&hfrcodpll>; + }; + hclk: hclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&sysclk>; + /* Divisors 1, 2, 4, 8, 16 allowed */ + clock-div = <1>; + }; + pclk: pclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&hclk>; + /* Divisors 1, 2 allowed */ + clock-div = <2>; + }; + lspclk: lspclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&pclk>; + /* Fixed divisor of 2 */ + clock-div = <2>; + }; + hclkdiv1024: hclkdiv1024 { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&hclk>; + /* Fixed divisor of 1024 */ + clock-div = <1024>; + }; + traceclk: traceclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&sysclk>; + /* Divisors 1, 2, 3, 4 allowed */ + clock-div = <1>; + }; + em01grpaclk: em01grpaclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&hfrcodpll>; + }; + em01grpbclk: em01grpbclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&hfrcodpll>; + }; + iadcclk: iadcclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&em01grpaclk>; + }; + em23grpaclk: em23grpaclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&lfrco>; + }; + em4grpaclk: em4grpaclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&lfrco>; + }; + rtccclk: rtccclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&lfrco>; + }; + wdog0clk: wdog0clk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&lfrco>; + }; + systickclk: systickclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&hclk>; }; }; @@ -101,6 +174,55 @@ #clock-cells = <2>; }; + fsrco: fsrco@50018000 { + #clock-cells = <0>; + compatible = "fixed-clock"; + reg = <0x50018000 0x4000>; + clock-frequency = ; + }; + + clk_hfxo: hfxo: hfxo@5000c000 { + #clock-cells = <0>; + compatible = "silabs,hfxo"; + reg = <0x5000c000 0x4000>; + clock-frequency = ; + ctune = <140>; + precision = <50>; + status = "disabled"; + }; + + lfxo: lfxo@50020000 { + #clock-cells = <0>; + compatible = "silabs,series2-lfxo"; + reg = <0x50020000 0x4000>; + clock-frequency = <32768>; + ctune = <63>; + precision = <50>; + timeout = <4096>; + status = "disabled"; + }; + + hfrcodpll: hfrcodpll@50010000 { + #clock-cells = <0>; + compatible = "silabs,series2-hfrcodpll"; + reg = <0x50010000 0x4000>; + clock-frequency = ; + }; + + lfrco: lfrco@50024000 { + #clock-cells = <0>; + compatible = "silabs,series2-lfrco"; + reg = <0x50024000 0x4000>; + clock-frequency = <32768>; + }; + + ulfrco: ulfrco@50028000 { + #clock-cells = <0>; + compatible = "fixed-clock"; + reg = <0x50028000 0x4000>; + clock-frequency = <1000>; + }; + msc: flash-controller@50030000 { compatible = "silabs,gecko-flash-controller"; reg = <0x50030000 0xC69>; diff --git a/dts/arm/silabs/efr32mg21.dtsi b/dts/arm/silabs/efr32mg21.dtsi index ea274bc89fecd..8b8cc794a2ad3 100644 --- a/dts/arm/silabs/efr32mg21.dtsi +++ b/dts/arm/silabs/efr32mg21.dtsi @@ -18,6 +18,82 @@ zephyr,flash-controller = &msc; }; + clocks { + sysclk: sysclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&hfrcodpll>; + }; + hclk: hclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&sysclk>; + /* Divider 1, 2, or 4 */ + clock-div = <1>; + }; + pclk: pclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&hclk>; + /* Divider 1 or 2 */ + clock-div = <2>; + }; + lspclk: lspclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&pclk>; + /* Divider 1 or 2 */ + clock-div = <2>; + }; + hclkdiv1024: hclkdiv1024 { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&hclk>; + /* Fixed divider of 1024 */ + clock-div = <1024>; + }; + traceclk: traceclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&hclk>; + }; + em01grpaclk: em01grpaclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&hfrcodpll>; + }; + iadcclk: iadcclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&em01grpaclk>; + }; + em23grpaclk: em23grpaclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&lfrco>; + }; + em4grpaclk: em4grpaclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&lfrco>; + }; + rtccclk: rtccclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&lfrco>; + }; + wdog0clk: wdog0clk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&lfrco>; + }; + wdog1clk: wdog1clk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&lfrco>; + }; + }; + cpus { #address-cells = <1>; #size-cells = <0>; @@ -51,7 +127,14 @@ #clock-cells = <2>; }; - clk_hfxo: clk-hfxo@5000c000 { + fsrco: fsrco@50018000 { + #clock-cells = <0>; + compatible = "fixed-clock"; + reg = <0x50018000 0x4000>; + clock-frequency = ; + }; + + clk_hfxo: hfxo: hfxo@5000c000 { #clock-cells = <0>; compatible = "silabs,hfxo"; reg = <0x5000c000 0x4000>; @@ -60,6 +143,52 @@ precision = <50>; }; + lfxo: lfxo@50020000 { + #clock-cells = <0>; + compatible = "silabs,series2-lfxo"; + reg = <0x50020000 0x4000>; + clock-frequency = <32768>; + ctune = <63>; + precision = <50>; + timeout = <4096>; + status = "disabled"; + }; + + hfrcodpll: hfrcodpll@50010000 { + #clock-cells = <0>; + compatible = "silabs,series2-hfrcodpll"; + reg = <0x50010000 0x4000>; + clock-frequency = ; + }; + + hfrcoem23: hfrcoem23@5a014000 { + #clock-cells = <0>; + compatible = "silabs,series2-hfrcoem23"; + reg = <0x5a014000 0x4000>; + clock-frequency = ; + }; + + lfrco: lfrco@50024000 { + #clock-cells = <0>; + compatible = "silabs,series2-lfrco"; + reg = <0x50024000 0x4000>; + clock-frequency = <32768>; + }; + + ulfrco: ulfrco@50028000 { + #clock-cells = <0>; + compatible = "fixed-clock"; + reg = <0x50028000 0x4000>; + clock-frequency = <1000>; + }; + + clkin0: clkin0@5003c46c { + #clock-cells = <0>; + compatible = "fixed-clock"; + reg = <0x5003c46c 0x4>; + clock-frequency = ; + }; + msc: flash-controller@50030000 { compatible = "silabs,gecko-flash-controller"; reg = <0x50030000 0x31a4>; diff --git a/dts/arm/silabs/efr32mg24.dtsi b/dts/arm/silabs/efr32mg24.dtsi index c583012cd8d18..5af760a85604e 100644 --- a/dts/arm/silabs/efr32mg24.dtsi +++ b/dts/arm/silabs/efr32mg24.dtsi @@ -20,12 +20,115 @@ }; clocks { - clk_hfxo: clk-hfxo { + hfxort: hfxort { #clock-cells = <0>; - compatible = "silabs,hfxo"; - clock-frequency = ; - ctune = <140>; - precision = <50>; + compatible = "fixed-factor-clock"; + clocks = <&hfxo>; + }; + hfrcodpllrt: hfrcodpllrt { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&hfrcodpll>; + }; + sysclk: sysclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&hfrcodpll>; + }; + hclk: hclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&sysclk>; + /* Divider 1, 2, 4, 8, or 16 */ + clock-div = <1>; + }; + pclk: pclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&hclk>; + /* Divider 1 or 2 */ + clock-div = <2>; + }; + lspclk: lspclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&pclk>; + /* Fixed divider of 2 */ + clock-div = <2>; + }; + hclkdiv1024: hclkdiv1024 { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&hclk>; + /* Fixed divider of 1024 */ + clock-div = <1024>; + }; + traceclk: traceclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&sysclk>; + /* Divider 1, 2, 3 or 4 */ + clock-div = <1>; + }; + em01grpaclk: em01grpaclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&hfrcodpll>; + }; + em01grpcclk: em01grpcclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&hfrcodpll>; + }; + iadcclk: iadcclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&em01grpaclk>; + }; + em23grpaclk: em23grpaclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&lfrco>; + }; + em4grpaclk: em4grpaclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&lfrco>; + }; + sysrtcclk: sysrtcclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&lfrco>; + }; + wdog0clk: wdog0clk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&lfrco>; + }; + wdog1clk: wdog1clk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&lfrco>; + }; + pcnt0clk: pcnt0clk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&em23grpaclk>; + }; + eusart0clk: eusart0clk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&em01grpcclk>; + }; + systickclk: systickclk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&hclk>; + }; + vdac0clk: vdac0clk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&em01grpaclk>; }; }; @@ -94,6 +197,69 @@ #clock-cells = <2>; }; + fsrco: fsrco@50018000 { + #clock-cells = <0>; + compatible = "fixed-clock"; + reg = <0x50018000 0x4000>; + clock-frequency = ; + }; + + clk_hfxo: hfxo: hfxo@5a004000 { + #clock-cells = <0>; + compatible = "silabs,hfxo"; + reg = <0x5a004000 0x4000>; + clock-frequency = ; + ctune = <140>; + precision = <50>; + status = "disabled"; + }; + + lfxo: lfxo@50020000 { + #clock-cells = <0>; + compatible = "silabs,series2-lfxo"; + reg = <0x50020000 0x4000>; + clock-frequency = <32768>; + ctune = <63>; + precision = <50>; + timeout = <4096>; + status = "disabled"; + }; + + hfrcodpll: hfrcodpll@50010000 { + #clock-cells = <0>; + compatible = "silabs,series2-hfrcodpll"; + reg = <0x50010000 0x4000>; + clock-frequency = ; + }; + + hfrcoem23: hfrcoem23@5a000000 { + #clock-cells = <0>; + compatible = "silabs,series2-hfrcoem23"; + reg = <0x5a000000 0x4000>; + clock-frequency = ; + }; + + lfrco: lfrco@50024000 { + #clock-cells = <0>; + compatible = "silabs,series2-lfrco"; + reg = <0x50024000 0x4000>; + clock-frequency = <32768>; + }; + + ulfrco: ulfrco@50028000 { + #clock-cells = <0>; + compatible = "fixed-clock"; + reg = <0x50028000 0x4000>; + clock-frequency = <1000>; + }; + + clkin0: clkin0@5003c46c { + #clock-cells = <0>; + compatible = "fixed-clock"; + reg = <0x5003c46c 0x4>; + clock-frequency = ; + }; + msc: flash-controller@50030000 { compatible = "silabs,gecko-flash-controller"; reg = <0x50030000 0x3148>; diff --git a/dts/bindings/clock/silabs,hfxo.yaml b/dts/bindings/clock/silabs,hfxo.yaml index a5d0fdeff9515..922d3db49cca5 100644 --- a/dts/bindings/clock/silabs,hfxo.yaml +++ b/dts/bindings/clock/silabs,hfxo.yaml @@ -11,3 +11,11 @@ properties: type: int required: true description: Precision configuration + mode: + type: string + description: | + Mode of operation. Defaults to "xtal", expecting a crystal oscillator on XI and XO + pins. May be set to "extclk" or "extclkpkdet" to use an external sinusoidal clock + on the XI pin with or without use of peak detector. + default: "xtal" + enum: ["xtal", "extclk", "extclkpkdet"] diff --git a/dts/bindings/clock/silabs,series2-hfrcodpll.yaml b/dts/bindings/clock/silabs,series2-hfrcodpll.yaml new file mode 100644 index 0000000000000..9cf66315a0879 --- /dev/null +++ b/dts/bindings/clock/silabs,series2-hfrcodpll.yaml @@ -0,0 +1,37 @@ +compatible: "silabs,series2-hfrcodpll" + +description: | + Silicon Labs HFRCODPLL peripheral (high-frequency RC oscillator with digital phase-locked loop). + Can be used as a free-running RC oscillator or with PLL lock to the crystal oscillators HFXO + or LFXO. To enable PLL, set the `clocks` property to the source crystal oscillator, and set + the `dpll-*` options to desired values. + + In PLL mode, `clock-frequency` represents the target PLL frequency. + In free-running mode, `clock-frequency` represents the HFRCO band to use. + +include: fixed-clock.yaml + +properties: + dpll-n: + type: int + description: Numerator used in f_out = f_ref * (n+1) / (m+1) + dpll-m: + type: int + description: Denominator used in f_out = f_ref * (n+1) / (m+1) + dpll-edge: + type: string + description: Which edge of the reference is detected + enum: ["fall", "rise"] + dpll-lock: + type: string + description: | + PLL lock mode. + freq: Frequency-lock loop mode + phase: Phase-lock loop mode + enum: ["freq", "phase"] + dpll-autorecover: + type: boolean + description: Automatically re-lock if the PLL loses the lock + dpll-dither: + type: boolean + description: Enable dither function diff --git a/dts/bindings/clock/silabs,series2-hfrcoem23.yaml b/dts/bindings/clock/silabs,series2-hfrcoem23.yaml new file mode 100644 index 0000000000000..1b44b0358af36 --- /dev/null +++ b/dts/bindings/clock/silabs,series2-hfrcoem23.yaml @@ -0,0 +1,20 @@ +compatible: "silabs,series2-hfrcoem23" + +include: fixed-clock.yaml + +description: | + Silicon Labs HFRCOEM23 peripheral (high-frequency RC oscillator with energy mode 2 and 3 + capability). `clock-frequency` represents the HFRCO band to use. + +properties: + clock-frequency: + enum: + - 1000000 + - 2000000 + - 4000000 + - 13000000 + - 16000000 + - 19000000 + - 26000000 + - 32000000 + - 40000000 diff --git a/dts/bindings/clock/silabs,series2-lfrco.yaml b/dts/bindings/clock/silabs,series2-lfrco.yaml new file mode 100644 index 0000000000000..cba77bc2a6f34 --- /dev/null +++ b/dts/bindings/clock/silabs,series2-lfrco.yaml @@ -0,0 +1,13 @@ +compatible: "silabs,series2-lfrco" + +description: | + Silicon Labs LFRCO peripheral (low-frequency RC oscillator). + +include: fixed-clock.yaml + +properties: + precision-mode: + type: boolean + description: | + Enable precision mode. In precision mode, the LFRCO is + periodically recalibrated against the HFXO. diff --git a/dts/bindings/clock/silabs,series2-lfxo.yaml b/dts/bindings/clock/silabs,series2-lfxo.yaml new file mode 100644 index 0000000000000..5fcbe21541c64 --- /dev/null +++ b/dts/bindings/clock/silabs,series2-lfxo.yaml @@ -0,0 +1,29 @@ +compatible: "silabs,series2-lfxo" + +description: | + Silicon Labs LFXO peripheral (low-frequency crystal oscillator). + +include: fixed-clock.yaml + +properties: + ctune: + type: int + required: true + description: Load capacitance configuration + precision: + type: int + required: true + description: Precision configuration + timeout: + type: int + required: true + description: Startup timeout delay (cycles) + enum: [2, 256, 1024, 2048, 4096, 8192, 16384, 32768] + mode: + type: string + description: | + Mode of operation. Defaults to "xtal", expecting a 32768 Hz crystal oscillator on XI and XO + pins. May be set to "bufextclk" to use an external sinusoidal clock or "digextclk" to use + an external CMOS clock on the XI pin. + default: "xtal" + enum: ["xtal", "bufextclk", "digextclk"] From 955aca6c09ee2766e887f6a4e24a1f9d450eda6b Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Wed, 2 Oct 2024 22:30:28 +0200 Subject: [PATCH 1299/4482] soc: silabs: Initialize clock manager HAL from DT Swap from the deprecated device_init_* functions to clock manager for clock tree configuration. Populate config headers using device tree representation of clock tree and oscillator config. Signed-off-by: Aksel Skauge Mellbye --- .../hal_silabs/simplicity_sdk/CMakeLists.txt | 8 +- .../sl_clock_manager_oscillator_config.h | 78 ++++ .../config/sl_clock_manager_tree_config.h | 429 ++++++++++++++++++ .../common/sl_device_init_hfxo_config.h | 17 - soc/silabs/common/soc.c | 6 +- 5 files changed, 511 insertions(+), 27 deletions(-) create mode 100644 modules/hal_silabs/simplicity_sdk/config/sl_clock_manager_oscillator_config.h create mode 100644 modules/hal_silabs/simplicity_sdk/config/sl_clock_manager_tree_config.h delete mode 100644 soc/silabs/common/sl_device_init_hfxo_config.h diff --git a/modules/hal_silabs/simplicity_sdk/CMakeLists.txt b/modules/hal_silabs/simplicity_sdk/CMakeLists.txt index f329683e2b098..100156f107018 100644 --- a/modules/hal_silabs/simplicity_sdk/CMakeLists.txt +++ b/modules/hal_silabs/simplicity_sdk/CMakeLists.txt @@ -92,8 +92,6 @@ zephyr_include_directories( ${COMMON_DIR}/inc ${EMLIB_DIR}/inc ${PERIPHERAL_DIR}/inc - ${SERVICE_DIR}/device_init/config/s2 - ${SERVICE_DIR}/device_init/config/s2/sdid${CONFIG_SOC_GECKO_SDID} ${SERVICE_DIR}/clock_manager/inc ${SERVICE_DIR}/device_init/inc ${SERVICE_DIR}/device_manager/inc @@ -130,6 +128,8 @@ zephyr_library_sources( ${EMLIB_DIR}/src/em_system.c ${SERVICE_DIR}/clock_manager/src/sl_clock_manager.c ${SERVICE_DIR}/clock_manager/src/sl_clock_manager_hal_s2.c + ${SERVICE_DIR}/clock_manager/src/sl_clock_manager_init.c + ${SERVICE_DIR}/clock_manager/src/sl_clock_manager_init_hal_s2.c ${SERVICE_DIR}/device_manager/devices/sl_device_peripheral_hal_efr32xg${SILABS_DEVICE_FAMILY_NUMBER}.c ${SERVICE_DIR}/device_manager/gpios/sl_device_gpio_common.c ${SERVICE_DIR}/device_manager/src/sl_device_clock.c @@ -153,10 +153,6 @@ zephyr_library_sources_ifdef(CONFIG_DT_HAS_SILABS_SERIES2_DCDC_ENABLED ) endif() zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_DEV_INIT - ${SERVICE_DIR}/device_init/src/sl_device_init_dpll_s2.c - ${SERVICE_DIR}/device_init/src/sl_device_init_hfrco.c - ${SERVICE_DIR}/device_init/src/sl_device_init_hfxo_s2.c - ${SERVICE_DIR}/device_init/src/sl_device_init_nvic.c ${SERVICE_DIR}/power_manager/src/sl_power_manager.c ${SERVICE_DIR}/power_manager/src/sl_power_manager_hal_s2.c ${SERVICE_DIR}/hfxo_manager/src/sl_hfxo_manager.c diff --git a/modules/hal_silabs/simplicity_sdk/config/sl_clock_manager_oscillator_config.h b/modules/hal_silabs/simplicity_sdk/config/sl_clock_manager_oscillator_config.h new file mode 100644 index 0000000000000..c0e5193a8824a --- /dev/null +++ b/modules/hal_silabs/simplicity_sdk/config/sl_clock_manager_oscillator_config.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2024 Silicon Laboratories Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef SL_CLOCK_MANAGER_OSCILLATOR_CONFIG_H +#define SL_CLOCK_MANAGER_OSCILLATOR_CONFIG_H + +#include + +#include + +/* HFXO */ +#define SL_CLOCK_MANAGER_HFXO_EN DT_NODE_HAS_STATUS(DT_NODELABEL(hfxo), okay) +#define SL_CLOCK_MANAGER_HFXO_MODE DT_ENUM_IDX(DT_NODELABEL(hfxo), mode) +#define SL_CLOCK_MANAGER_HFXO_FREQ DT_PROP(DT_NODELABEL(hfxo), clock_frequency) +#define SL_CLOCK_MANAGER_HFXO_CTUNE DT_PROP(DT_NODELABEL(hfxo), ctune) +#define SL_CLOCK_MANAGER_HFXO_PRECISION DT_PROP(DT_NODELABEL(hfxo), precision) +#define SL_CLOCK_MANAGER_HFXO_CRYSTAL_SHARING_EN 0 + +/* LFXO */ +#define SL_CLOCK_MANAGER_LFXO_EN DT_NODE_HAS_STATUS(DT_NODELABEL(lfxo), okay) +#define SL_CLOCK_MANAGER_LFXO_MODE (DT_ENUM_IDX(DT_NODELABEL(lfxo), mode) << _LFXO_CFG_MODE_SHIFT) + +#define SL_CLOCK_MANAGER_LFXO_CTUNE DT_PROP(DT_NODELABEL(lfxo), ctune) +#define SL_CLOCK_MANAGER_LFXO_PRECISION DT_PROP(DT_NODELABEL(lfxo), precision) +#define SL_CLOCK_MANAGER_LFXO_TIMEOUT \ + (DT_ENUM_IDX(DT_NODELABEL(lfxo), timeout) << _LFXO_CFG_TIMEOUT_SHIFT) + +/* HFRCODPLL */ +#define SL_CLOCK_MANAGER_HFRCO_BAND \ + (DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 1500000 ? 1000000U \ + : DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 3000000 ? 2000000U \ + : DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 5500000 ? 4000000U \ + : DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 10000000 ? 7000000U \ + : DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 14500000 ? 13000000U \ + : DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 17500000 ? 16000000U \ + : DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 23000000 ? 19000000U \ + : DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 29000000 ? 26000000U \ + : DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 35000000 ? 32000000U \ + : DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 44000000 ? 38000000U \ + : DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 52000000 ? 48000000U \ + : DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 60000000 ? 56000000U \ + : DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 72000000 ? 64000000U \ + : DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) < 90000000 ? 80000000U \ + : 100000000U) +#define SL_CLOCK_MANAGER_HFRCO_DPLL_EN DT_NUM_CLOCKS(DT_NODELABEL(hfrcodpll)) +#define SL_CLOCK_MANAGER_DPLL_FREQ DT_PROP(DT_NODELABEL(hfrcodpll), clock_frequency) +#define SL_CLOCK_MANAGER_DPLL_N DT_PROP(DT_NODELABEL(hfrcodpll), dpll_n) +#define SL_CLOCK_MANAGER_DPLL_M DT_PROP(DT_NODELABEL(hfrcodpll), dpll_m) +#define SL_CLOCK_MANAGER_DPLL_REFCLK \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(hfrcodpll)), DT_NODELABEL(hfxo)) \ + ? CMU_DPLLREFCLKCTRL_CLKSEL_HFXO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(hfrcodpll)), DT_NODELABEL(lfxo)) \ + ? CMU_DPLLREFCLKCTRL_CLKSEL_LFXO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(hfrcodpll)), DT_NODELABEL(clkin0)) \ + ? CMU_DPLLREFCLKCTRL_CLKSEL_CLKIN0 \ + : CMU_DPLLREFCLKCTRL_CLKSEL_DISABLED) +#define SL_CLOCK_MANAGER_DPLL_EDGE DT_ENUM_IDX(DT_NODELABEL(hfrcodpll), dpll_edge) +#define SL_CLOCK_MANAGER_DPLL_LOCKMODE DT_ENUM_IDX(DT_NODELABEL(hfrcodpll), dpll_lock) +#define SL_CLOCK_MANAGER_DPLL_AUTORECOVER DT_PROP(DT_NODELABEL(hfrcodpll), dpll_autorecover) +#define SL_CLOCK_MANAGER_DPLL_DITHER DT_PROP(DT_NODELABEL(hfrcodpll), dpll_dither) + +/* HFRCOEM23 */ +#if DT_NODE_EXISTS(DT_NODELABEL(hfrcoem23)) +#define SL_CLOCK_MANAGER_HFRCOEM23_BAND DT_PROP(DT_NODELABEL(hfrcoem23), clock_frequency) +#endif + +/* LFRCO */ +#if DT_NODE_EXISTS(DT_NODELABEL(lfrco)) +#define SL_CLOCK_MANAGER_LFRCO_PRECISION DT_PROP(DT_NODELABEL(lfrco), precision_mode) +#endif + +/* CLKIN0 */ +#define SL_CLOCK_MANAGER_CLKIN0_FREQ DT_PROP(DT_NODELABEL(clkin0), clock_frequency) + +#endif /* SL_CLOCK_MANAGER_OSCILLATOR_CONFIG_H */ diff --git a/modules/hal_silabs/simplicity_sdk/config/sl_clock_manager_tree_config.h b/modules/hal_silabs/simplicity_sdk/config/sl_clock_manager_tree_config.h new file mode 100644 index 0000000000000..051835c836f64 --- /dev/null +++ b/modules/hal_silabs/simplicity_sdk/config/sl_clock_manager_tree_config.h @@ -0,0 +1,429 @@ +/* + * Copyright (c) 2024 Silicon Laboratories Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef SL_CLOCK_MANAGER_TREE_CONFIG_H +#define SL_CLOCK_MANAGER_TREE_CONFIG_H + +#include + +#include + +/* Internal macros that must be defined to make parameter validation in the HAL pass, + * but are unused since Zephyr derives all clock tree configuration from DeviceTree + */ +#define SL_CLOCK_MANAGER_DEFAULT_HF_CLOCK_SOURCE 0xFF +#define SL_CLOCK_MANAGER_DEFAULT_HF_CLOCK_SOURCE_HFRCODPLL 0xFF +#define SL_CLOCK_MANAGER_DEFAULT_LF_CLOCK_SOURCE 0xFC +#define SL_CLOCK_MANAGER_DEFAULT_LF_CLOCK_SOURCE_LFRCO 0xFC + +#define SL_CLOCK_MANAGER_INVALID 0xFF + +/* SYSCLK */ +#define SL_CLOCK_MANAGER_SYSCLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(sysclk)), DT_NODELABEL(fsrco)) \ + ? CMU_SYSCLKCTRL_CLKSEL_FSRCO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(sysclk)), DT_NODELABEL(hfrcodpll)) \ + ? CMU_SYSCLKCTRL_CLKSEL_HFRCODPLL \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(sysclk)), DT_NODELABEL(hfxo)) \ + ? CMU_SYSCLKCTRL_CLKSEL_HFXO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(sysclk)), DT_NODELABEL(clkin0)) \ + ? CMU_SYSCLKCTRL_CLKSEL_CLKIN0 \ + : SL_CLOCK_MANAGER_INVALID) + +#if SL_CLOCK_MANAGER_SYSCLK_SOURCE == SL_CLOCK_MANAGER_INVALID +#error "Invalid clock source selection for SYSCLK" +#endif + +#define SL_CLOCK_MANAGER_HCLK_DIVIDER \ + CONCAT(CMU_SYSCLKCTRL_HCLKPRESC_DIV, DT_PROP(DT_NODELABEL(hclk), clock_div)) + +#define SL_CLOCK_MANAGER_PCLK_DIVIDER \ + CONCAT(CMU_SYSCLKCTRL_PCLKPRESC_DIV, DT_PROP(DT_NODELABEL(pclk), clock_div)) + +/* TRACECLK */ +#if defined(_CMU_TRACECLKCTRL_CLKSEL_MASK) +#if DT_NUM_CLOCKS(DT_NODELABEL(traceclk)) == 0 +#define SL_CLOCK_MANAGER_TRACECLK_SOURCE CMU_TRACECLKCTRL_CLKSEL_DISABLE +#else +#if defined(CMU_TRACECLKCTRL_CLKSEL_SYSCLK) +/* TRACECLK can be clocked from SYSCLK */ +#define SL_CLOCK_MANAGER_TRACECLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(traceclk)), DT_NODELABEL(sysclk)) \ + ? CMU_TRACECLKCTRL_CLKSEL_SYSCLK \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(traceclk)), DT_NODELABEL(hfrcodpllrt)) \ + ? CMU_TRACECLKCTRL_CLKSEL_HFRCODPLLRT \ + : COND_CODE_1(DT_NODE_EXISTS(DT_NODELABEL(hfrcoem23)), ( \ + DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(traceclk)), \ + DT_NODELABEL(hfrcoem23)) \ + ? CMU_TRACECLKCTRL_CLKSEL_HFRCOEM23 \ + : SL_CLOCK_MANAGER_INVALID), (SL_CLOCK_MANAGER_INVALID))) + +#else +/* TRACECLK can be clocked from HCLK */ +#define SL_CLOCK_MANAGER_TRACECLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(traceclk)), DT_NODELABEL(hclk)) \ + ? CMU_TRACECLKCTRL_CLKSEL_HCLK \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(traceclk)), DT_NODELABEL(hfrcoem23)) \ + ? CMU_TRACECLKCTRL_CLKSEL_HFRCOEM23 \ + : SL_CLOCK_MANAGER_INVALID) +#endif /* defined(CMU_TRACECLKCTRL_CLKSEL_SYSCLK) */ +#if SL_CLOCK_MANAGER_TRACECLK_SOURCE == SL_CLOCK_MANAGER_INVALID +#error "Invalid clock source selection for TRACECLK" +#endif +#endif /* DT_NUM_CLOCKS(traceclk) */ +#endif /* defined(_CMU_TRACECLKCTRL_CLKSEL_MASK) */ + +#if DT_NODE_HAS_PROP(DT_NODELABEL(traceclk), clock_div) +#define SL_CLOCK_MANAGER_TRACECLK_DIVIDER \ + CONCAT(CMU_TRACECLKCTRL_PRESC_DIV, DT_PROP(DT_NODELABEL(traceclk), clock_div)) +#endif + +/* EM01GRPACLK */ +#define SL_CLOCK_MANAGER_EM01GRPACLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em01grpaclk)), DT_NODELABEL(hfrcodpll)) \ + ? CMU_EM01GRPACLKCTRL_CLKSEL_HFRCODPLL \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em01grpaclk)), DT_NODELABEL(hfxo)) \ + ? CMU_EM01GRPACLKCTRL_CLKSEL_HFXO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em01grpaclk)), DT_NODELABEL(fsrco)) \ + ? CMU_EM01GRPACLKCTRL_CLKSEL_FSRCO \ + : COND_CODE_1(DT_NODE_EXISTS(DT_NODELABEL(hfrcoem23)), ( \ + DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em01grpaclk)), \ + DT_NODELABEL(hfrcoem23)) \ + ? CMU_EM01GRPACLKCTRL_CLKSEL_HFRCOEM23 \ + : COND_CODE_1(DT_NODE_EXISTS(DT_NODELABEL(hfrcodpllrt)), ( \ + DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em01grpaclk)), \ + DT_NODELABEL(hfrcodpllrt)) \ + ? CMU_EM01GRPACLKCTRL_CLKSEL_HFRCODPLLRT \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em01grpaclk)), \ + DT_NODELABEL(hfxort)) \ + ? CMU_EM01GRPACLKCTRL_CLKSEL_HFXORT \ + : SL_CLOCK_MANAGER_INVALID), (SL_CLOCK_MANAGER_INVALID))), \ + (SL_CLOCK_MANAGER_INVALID))) + +#if SL_CLOCK_MANAGER_EM01GRPACLK_SOURCE == SL_CLOCK_MANAGER_INVALID +#error "Invalid clock source selection for EM01GRPACLK" +#endif + +/* EM01GRPBCLK */ +#if DT_NODE_EXISTS(DT_NODELABEL(em01grpbclk)) +#define SL_CLOCK_MANAGER_EM01GRPBCLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em01grpbclk)), DT_NODELABEL(hfrcodpll)) \ + ? CMU_EM01GRPBCLKCTRL_CLKSEL_HFRCODPLL \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em01grpbclk)), DT_NODELABEL(hfxo)) \ + ? CMU_EM01GRPBCLKCTRL_CLKSEL_HFXO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em01grpbclk)), DT_NODELABEL(fsrco)) \ + ? CMU_EM01GRPBCLKCTRL_CLKSEL_FSRCO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em01grpbclk)), DT_NODELABEL(clkin0)) \ + ? CMU_EM01GRPBCLKCTRL_CLKSEL_CLKIN0 \ + : COND_CODE_1(DT_NODE_EXISTS(DT_NODELABEL(hfrcodpllrt)), ( \ + DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em01grpbclk)), \ + DT_NODELABEL(hfrcodpllrt)) \ + ? CMU_EM01GRPBCLKCTRL_CLKSEL_HFRCODPLLRT \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em01grpbclk)), \ + DT_NODELABEL(hfxort)) \ + ? CMU_EM01GRPBCLKCTRL_CLKSEL_HFXORT \ + : SL_CLOCK_MANAGER_INVALID), (SL_CLOCK_MANAGER_INVALID))) + +#if SL_CLOCK_MANAGER_EM01GRPBCLK_SOURCE == SL_CLOCK_MANAGER_INVALID +#error "Invalid clock source selection for EM01GRPBCLK" +#endif +#endif /* DT_NODE_EXISTS(em01grpbclk)*/ + +/* EM01GRPCCLK */ +#if DT_NODE_EXISTS(DT_NODELABEL(em01grpcclk)) +#define SL_CLOCK_MANAGER_EM01GRPCCLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em01grpcclk)), DT_NODELABEL(hfrcodpll)) \ + ? CMU_EM01GRPCCLKCTRL_CLKSEL_HFRCODPLL \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em01grpcclk)), DT_NODELABEL(hfxo)) \ + ? CMU_EM01GRPCCLKCTRL_CLKSEL_HFXO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em01grpcclk)), DT_NODELABEL(fsrco)) \ + ? CMU_EM01GRPCCLKCTRL_CLKSEL_FSRCO \ + : COND_CODE_1(DT_NODE_EXISTS(DT_NODELABEL(hfrcoem23)), ( \ + DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em01grpcclk)), \ + DT_NODELABEL(hfrcodpllrt)) \ + ? CMU_EM01GRPACLKCTRL_CLKSEL_HFRCODPLLRT \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em01grpcclk)), \ + DT_NODELABEL(hfxort)) \ + ? CMU_EM01GRPACLKCTRL_CLKSEL_HFXORT \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em01grpcclk)), \ + DT_NODELABEL(hfrcoem23)) \ + ? CMU_EM01GRPCCLKCTRL_CLKSEL_HFRCOEM23 \ + : SL_CLOCK_MANAGER_INVALID), (SL_CLOCK_MANAGER_INVALID))) + +#if SL_CLOCK_MANAGER_EM01GRPCCLK_SOURCE == SL_CLOCK_MANAGER_INVALID +#error "Invalid clock source selection for EM01GRPCCLK" +#endif +#endif /* DT_NODE_EXISTS(em01grpcclk)*/ + +/* IADCCLK */ +#if DT_NODE_EXISTS(DT_NODELABEL(iadcclk)) +#define SL_CLOCK_MANAGER_IADCCLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(iadcclk)), DT_NODELABEL(em01grpaclk)) \ + ? CMU_IADCCLKCTRL_CLKSEL_EM01GRPACLK \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(iadcclk)), DT_NODELABEL(fsrco)) \ + ? CMU_IADCCLKCTRL_CLKSEL_FSRCO \ + : COND_CODE_1(DT_NODE_EXISTS(DT_NODELABEL(hfrcoem23)), ( \ + DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(iadcclk)), \ + DT_NODELABEL(hfrcoem23)) \ + ? CMU_IADCCLKCTRL_CLKSEL_HFRCOEM23 \ + : SL_CLOCK_MANAGER_INVALID), (SL_CLOCK_MANAGER_INVALID))) + +#if SL_CLOCK_MANAGER_IADCCLK_SOURCE == SL_CLOCK_MANAGER_INVALID +#error "Invalid clock source selection for IADCCLK" +#endif +#endif /* DT_NODE_EXISTS(iadcclk) */ + +/* LESENSEHFCLK */ +#if DT_NODE_EXISTS(DT_NODELABEL(lesensehfclk)) +#define SL_CLOCK_MANAGER_LESENSEHFCLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(lesensehfclk)), DT_NODELABEL(hfrcoem23)) \ + ? CMU_LESENSEHFCLKCTRL_CLKSEL_HFRCOEM23 \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(lesensehfclk)), DT_NODELABEL(fsrco)) \ + ? CMU_LESENSEHFCLKCTRL_CLKSEL_FSRCO \ + : SL_CLOCK_MANAGER_INVALID) + +#if SL_CLOCK_MANAGER_LESENSEHFCLK_SOURCE == SL_CLOCK_MANAGER_INVALID +#error "Invalid clock source selection for LESENSEHFCLK" +#endif +#endif /* DT_NODE_EXISTS(lesensehfclk) */ + +/* EM23GRPACLK */ +#define SL_CLOCK_MANAGER_EM23GRPACLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em23grpaclk)), DT_NODELABEL(lfrco)) \ + ? CMU_EM23GRPACLKCTRL_CLKSEL_LFRCO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em23grpaclk)), DT_NODELABEL(lfxo)) \ + ? CMU_EM23GRPACLKCTRL_CLKSEL_LFXO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em23grpaclk)), DT_NODELABEL(ulfrco)) \ + ? CMU_EM23GRPACLKCTRL_CLKSEL_ULFRCO \ + : SL_CLOCK_MANAGER_INVALID) + +#if SL_CLOCK_MANAGER_EM23GRPACLK_SOURCE == SL_CLOCK_MANAGER_INVALID +#error "Invalid clock source selection for EM23GRPACLK" +#endif + +/* EM4GRPACLK */ +#define SL_CLOCK_MANAGER_EM4GRPACLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em4grpaclk)), DT_NODELABEL(lfrco)) \ + ? CMU_EM4GRPACLKCTRL_CLKSEL_LFRCO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em4grpaclk)), DT_NODELABEL(lfxo)) \ + ? CMU_EM4GRPACLKCTRL_CLKSEL_LFXO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(em4grpaclk)), DT_NODELABEL(ulfrco)) \ + ? CMU_EM4GRPACLKCTRL_CLKSEL_ULFRCO \ + : SL_CLOCK_MANAGER_INVALID) + +#if SL_CLOCK_MANAGER_EM4GRPACLK_SOURCE == SL_CLOCK_MANAGER_INVALID +#error "Invalid clock source selection for EM4GRPACLK" +#endif + +/* RTCCCLK */ +#if DT_NODE_EXISTS(DT_NODELABEL(rtccclk)) +#define SL_CLOCK_MANAGER_RTCCCLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(rtccclk)), DT_NODELABEL(lfrco)) \ + ? CMU_RTCCCLKCTRL_CLKSEL_LFRCO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(rtccclk)), DT_NODELABEL(lfxo)) \ + ? CMU_RTCCCLKCTRL_CLKSEL_LFXO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(rtccclk)), DT_NODELABEL(ulfrco)) \ + ? CMU_RTCCCLKCTRL_CLKSEL_ULFRCO \ + : SL_CLOCK_MANAGER_INVALID) + +#if SL_CLOCK_MANAGER_RTCCCLK_SOURCE == SL_CLOCK_MANAGER_INVALID +#error "Invalid clock source selection for RTCCCLK" +#endif +#endif /* DT_NODE_EXISTS(rtccclk) */ + +/* SYSRTCCLK */ +#if DT_NODE_EXISTS(DT_NODELABEL(sysrtcclk)) +#define SL_CLOCK_MANAGER_SYSRTCCLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(sysrtcclk)), DT_NODELABEL(lfrco)) \ + ? CMU_SYSRTC0CLKCTRL_CLKSEL_LFRCO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(sysrtcclk)), DT_NODELABEL(lfxo)) \ + ? CMU_SYSRTC0CLKCTRL_CLKSEL_LFXO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(sysrtcclk)), DT_NODELABEL(ulfrco)) \ + ? CMU_SYSRTC0CLKCTRL_CLKSEL_ULFRCO \ + : SL_CLOCK_MANAGER_INVALID) + +#if SL_CLOCK_MANAGER_SYSRTCCLK_SOURCE == SL_CLOCK_MANAGER_INVALID +#error "Invalid clock source selection for SYSRTCCLK" +#endif +#endif /* DT_NODE_EXISTS(sysrtcclk) */ + +/* WDOG0CLK */ +#define SL_CLOCK_MANAGER_WDOG0CLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(wdog0clk)), DT_NODELABEL(lfrco)) \ + ? CMU_WDOG0CLKCTRL_CLKSEL_LFRCO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(wdog0clk)), DT_NODELABEL(lfxo)) \ + ? CMU_WDOG0CLKCTRL_CLKSEL_LFXO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(wdog0clk)), DT_NODELABEL(ulfrco)) \ + ? CMU_WDOG0CLKCTRL_CLKSEL_ULFRCO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(wdog0clk)), DT_NODELABEL(hclkdiv1024)) \ + ? CMU_WDOG0CLKCTRL_CLKSEL_HCLKDIV1024 \ + : SL_CLOCK_MANAGER_INVALID) + +#if SL_CLOCK_MANAGER_WDOG0CLK_SOURCE == SL_CLOCK_MANAGER_INVALID +#error "Invalid clock source selection for WDOG0CLK" +#endif + +/* WDOG1CLK */ +#if DT_NODE_EXISTS(DT_NODELABEL(wdog1clk)) +#define SL_CLOCK_MANAGER_WDOG1CLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(wdog1clk)), DT_NODELABEL(lfrco)) \ + ? CMU_WDOG1CLKCTRL_CLKSEL_LFRCO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(wdog1clk)), DT_NODELABEL(lfxo)) \ + ? CMU_WDOG1CLKCTRL_CLKSEL_LFXO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(wdog1clk)), DT_NODELABEL(ulfrco)) \ + ? CMU_WDOG1CLKCTRL_CLKSEL_ULFRCO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(wdog1clk)), DT_NODELABEL(hclkdiv1024)) \ + ? CMU_WDOG1CLKCTRL_CLKSEL_HCLKDIV1024 \ + : SL_CLOCK_MANAGER_INVALID) + +#if SL_CLOCK_MANAGER_WDOG1CLK_SOURCE == SL_CLOCK_MANAGER_INVALID +#error "Invalid clock source selection for WDOG1CLK" +#endif +#endif /* DT_NODE_EXISTS(wdog1clk) */ + +/* LCDCLK */ +#if DT_NODE_EXISTS(DT_NODELABEL(lcdclk)) +#define SL_CLOCK_MANAGER_LCDCLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(lcdclk)), DT_NODELABEL(lfrco)) \ + ? CMU_LCDCLKCTRL_CLKSEL_LFRCO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(lcdclk)), DT_NODELABEL(lfxo)) \ + ? CMU_LCDCLKCTRL_CLKSEL_LFXO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(lcdclk)), DT_NODELABEL(ulfrco)) \ + ? CMU_LCDCLKCTRL_CLKSEL_ULFRCO \ + : SL_CLOCK_MANAGER_INVALID) + +#if SL_CLOCK_MANAGER_LCDCLK_SOURCE == SL_CLOCK_MANAGER_INVALID +#error "Invalid clock source selection for LCDCLK" +#endif +#endif /* DT_NODE_EXISTS(lcdclk) */ + +/* PCNT0CLK */ +/* FIXME: allow clock selection from S0 pin */ +#if DT_NODE_EXISTS(DT_NODELABEL(pcnt0clk)) +#if DT_NUM_CLOCKS(DT_NODELABEL(pcnt0clk)) == 0 +#define SL_CLOCK_MANAGER_PCNT0CLK_SOURCE CMU_PCNT0CLKCTRL_CLKSEL_DISABLED +#else +#define SL_CLOCK_MANAGER_PCNT0CLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(pcnt0clk)), DT_NODELABEL(em23grpaclk)) \ + ? CMU_PCNT0CLKCTRL_CLKSEL_EM23GRPACLK \ + : SL_CLOCK_MANAGER_INVALID) + +#if SL_CLOCK_MANAGER_PCNT0CLK_SOURCE == SL_CLOCK_MANAGER_INVALID +#error "Invalid clock source selection for PCNT0CLK" +#endif +#endif /* DT_NUM_CLOCKS(pcnt0clk) */ +#endif /* DT_NODE_EXISTS(pcnt0clk) */ + +/* EUART0CLK */ +#if DT_NODE_EXISTS(DT_NODELABEL(euart0clk)) +#if DT_NUM_CLOCKS(DT_NODELABEL(euart0clk)) == 0 +#define SL_CLOCK_MANAGER_EUART0CLK_SOURCE CMU_EUART0CLKCTRL_CLKSEL_DISABLED +#else +#define SL_CLOCK_MANAGER_EUART0CLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(euart0clk)), DT_NODELABEL(em01grpaclk)) \ + ? CMU_EUART0CLKCTRL_CLKSEL_EM01GRPACLK \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(euart0clk)), DT_NODELABEL(em23grpaclk)) \ + ? CMU_EUART0CLKCTRL_CLKSEL_EM23GRPACLK \ + : SL_CLOCK_MANAGER_INVALID) + +#if SL_CLOCK_MANAGER_EUART0CLK_SOURCE == SL_CLOCK_MANAGER_INVALID +#error "Invalid clock source selection for EUART0CLK" +#endif +#endif /* DT_NUM_CLOCKS(euart0clk) */ +#endif /* DT_NODE_EXISTS(euart0clk) */ + +/* EUSART0CLK */ +#if DT_NODE_EXISTS(DT_NODELABEL(eusart0clk)) +#if DT_NUM_CLOCKS(DT_NODELABEL(eusart0clk)) == 0 +#define SL_CLOCK_MANAGER_EUSART0CLK_SOURCE CMU_EUSART0CLKCTRL_CLKSEL_DISABLED +#else +#if DT_NODE_EXISTS(DT_NODELABEL(em01grpbclk)) +/* If EM01GRPB clock exists, EUSART0 is in EM01GRPA or EM23GRPA */ +#define SL_CLOCK_MANAGER_EUSART0CLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(eusart0clk)), DT_NODELABEL(em01grpaclk)) \ + ? CMU_EUSART0CLKCTRL_CLKSEL_EM01GRPACLK \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(eusart0clk)), DT_NODELABEL(em23grpaclk)) \ + ? CMU_EUSART0CLKCTRL_CLKSEL_EM23GRPACLK \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(eusart0clk)), DT_NODELABEL(fsrco)) \ + ? CMU_EUSART0CLKCTRL_CLKSEL_FSRCO \ + : SL_CLOCK_MANAGER_INVALID) +#else +/* Otherwise, EUSART0 is in EM01GRPC or directly connected to oscillators */ +#define SL_CLOCK_MANAGER_EUSART0CLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(eusart0clk)), DT_NODELABEL(em01grpcclk)) \ + ? CMU_EUSART0CLKCTRL_CLKSEL_EM01GRPCCLK \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(eusart0clk)), DT_NODELABEL(hfrcoem23)) \ + ? CMU_EUSART0CLKCTRL_CLKSEL_HFRCOEM23 \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(eusart0clk)), DT_NODELABEL(lfrco)) \ + ? CMU_EUSART0CLKCTRL_CLKSEL_LFRCO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(eusart0clk)), DT_NODELABEL(lfxo)) \ + ? CMU_EUSART0CLKCTRL_CLKSEL_LFXO \ + : SL_CLOCK_MANAGER_INVALID) +#endif /* DT_NODE_EXISTS(em01grpbclk) */ +#if SL_CLOCK_MANAGER_EUSART0CLK_SOURCE == SL_CLOCK_MANAGER_INVALID +#error "Invalid clock source selection for EUSART0CLK" +#endif +#endif /* DT_NUM_CLOCKS(eusart0clk) */ +#endif /* DT_NODE_EXISTS(eusart0clk) */ + +/* SYSTICKCLK */ +#if DT_NODE_EXISTS(DT_NODELABEL(systickclk)) +#define SL_CLOCK_MANAGER_SYSTICKCLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(systickclk)), DT_NODELABEL(hclk)) ? 0 \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(systickclk)), DT_NODELABEL(em23grpaclk)) \ + ? 1 \ + : SL_CLOCK_MANAGER_INVALID) + +#if SL_CLOCK_MANAGER_SYSTICKCLK_SOURCE == SL_CLOCK_MANAGER_INVALID +#error "Invalid clock source selection for SYSTICKCLK" +#endif +#endif /* DT_NODE_EXISTS(systickclk) */ + +/* VDAC0CLK */ +#if DT_NODE_EXISTS(DT_NODELABEL(vdac0clk)) +#if DT_NUM_CLOCKS(DT_NODELABEL(vdac0clk)) == 0 +#define SL_CLOCK_MANAGER_VDAC0CLK_SOURCE CMU_VDAC0CLKCTRL_CLKSEL_DISABLED +#else +#define SL_CLOCK_MANAGER_VDAC0CLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(vdac0clk)), DT_NODELABEL(em01grpaclk)) \ + ? CMU_VDAC0CLKCTRL_CLKSEL_EM01GRPACLK \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(vdac0clk)), DT_NODELABEL(em23grpaclk)) \ + ? CMU_VDAC0CLKCTRL_CLKSEL_EM23GRPACLK \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(vdac0clk)), DT_NODELABEL(fsrco)) \ + ? CMU_VDAC0CLKCTRL_CLKSEL_FSRCO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(vdac0clk)), DT_NODELABEL(hfrcoem23)) \ + ? CMU_VDAC0CLKCTRL_CLKSEL_HFRCOEM23 \ + : SL_CLOCK_MANAGER_INVALID) + +#if SL_CLOCK_MANAGER_VDAC0CLK_SOURCE == SL_CLOCK_MANAGER_INVALID +#error "Invalid clock source selection for VDAC0CLK" +#endif +#endif /* DT_NUM_CLOCKS(vdac0clk) */ +#endif /* DT_NODE_EXISTS(vdac0clk) */ + +/* VDAC1CLK */ +#if DT_NODE_EXISTS(DT_NODELABEL(vdac1clk)) +#if DT_NUM_CLOCKS(DT_NODELABEL(vdac1clk)) == 0 +#define SL_CLOCK_MANAGER_VDAC1CLK_SOURCE CMU_VDAC1CLKCTRL_CLKSEL_DISABLED +#else +#define SL_CLOCK_MANAGER_VDAC1CLK_SOURCE \ + (DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(vdac1clk)), DT_NODELABEL(em01grpaclk)) \ + ? CMU_VDAC1CLKCTRL_CLKSEL_EM01GRPACLK \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(vdac1clk)), DT_NODELABEL(em23grpaclk)) \ + ? CMU_VDAC1CLKCTRL_CLKSEL_EM23GRPACLK \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(vdac1clk)), DT_NODELABEL(fsrco)) \ + ? CMU_VDAC1CLKCTRL_CLKSEL_FSRCO \ + : DT_SAME_NODE(DT_CLOCKS_CTLR(DT_NODELABEL(vdac1clk)), DT_NODELABEL(hfrcoem23)) \ + ? CMU_VDAC1CLKCTRL_CLKSEL_HFRCOEM23 \ + : SL_CLOCK_MANAGER_INVALID) + +#if SL_CLOCK_MANAGER_VDAC1CLK_SOURCE == SL_CLOCK_MANAGER_INVALID +#error "Invalid clock source selection for VDAC1CLK" +#endif +#endif /* DT_NUM_CLOCKS(vdac1clk) */ +#endif /* DT_NODE_EXISTS(vdac1clk) */ + +#endif /* SL_CLOCK_MANAGER_TREE_CONFIG_H */ diff --git a/soc/silabs/common/sl_device_init_hfxo_config.h b/soc/silabs/common/sl_device_init_hfxo_config.h deleted file mode 100644 index 14a59b29612da..0000000000000 --- a/soc/silabs/common/sl_device_init_hfxo_config.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2023 Antmicro - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef SL_DEVICE_INIT_HFXO_CONFIG_H -#define SL_DEVICE_INIT_HFXO_CONFIG_H - -#include - -#define SL_DEVICE_INIT_HFXO_MODE cmuHfxoOscMode_Crystal -#define SL_DEVICE_INIT_HFXO_FREQ DT_PROP(DT_NODELABEL(clk_hfxo), clock_frequency) -#define SL_DEVICE_INIT_HFXO_CTUNE DT_PROP(DT_NODELABEL(clk_hfxo), ctune) -#define SL_DEVICE_INIT_HFXO_PRECISION DT_PROP(DT_NODELABEL(clk_hfxo), precision) - -#endif /* SL_DEVICE_INIT_HFXO_CONFIG_H */ diff --git a/soc/silabs/common/soc.c b/soc/silabs/common/soc.c index 8453f1f9fcaf7..f853820573f3d 100644 --- a/soc/silabs/common/soc.c +++ b/soc/silabs/common/soc.c @@ -21,8 +21,7 @@ #ifdef CONFIG_SOC_GECKO_DEV_INIT #include -#include -#include +#include #ifdef CONFIG_PM #include @@ -217,8 +216,7 @@ void soc_early_init_hook(void) if (DT_HAS_COMPAT_STATUS_OKAY(silabs_series2_dcdc)) { sl_device_init_dcdc(); } - sl_device_init_hfxo(); - sl_device_init_dpll(); + sl_clock_manager_init(); #ifdef CONFIG_PM sl_power_manager_init(); From c6c3e194d9b52c1abb3ea8772bbbe2ffae321be9 Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Wed, 2 Oct 2024 22:37:29 +0200 Subject: [PATCH 1300/4482] boards: silabs: Remove clock configuration Clock setup is now done by the clock manager based on device tree configuration. Signed-off-by: Aksel Skauge Mellbye --- boards/silabs/dev_kits/sltb010a/board.c | 30 -------------- boards/silabs/dev_kits/xg24_dk2601b/board.c | 36 ----------------- .../xg24_dk2601b/xg24_dk2601b_defconfig | 2 - boards/silabs/dev_kits/xg27_dk2602a/board.c | 30 -------------- .../thing_plus_matter_mgm240p/board.c | 39 ------------------- ...arkfun_thing_plus_matter_mgm240p_defconfig | 2 - 6 files changed, 139 deletions(-) diff --git a/boards/silabs/dev_kits/sltb010a/board.c b/boards/silabs/dev_kits/sltb010a/board.c index 7572f0fad3905..ac43052e3628e 100644 --- a/boards/silabs/dev_kits/sltb010a/board.c +++ b/boards/silabs/dev_kits/sltb010a/board.c @@ -8,22 +8,12 @@ #include #include -#ifdef CONFIG_SOC_GECKO_DEV_INIT -#include "em_cmu.h" -#endif - - LOG_MODULE_REGISTER(thunderboard, CONFIG_BOARD_SLTB010A_LOG_LEVEL); -static int thunderboard_init_clocks(void); - static int thunderboard_init(void) { int ret; -#ifdef CONFIG_SOC_GECKO_DEV_INIT - thunderboard_init_clocks(); -#endif static struct gpio_dt_spec wake_up_gpio_dev = GPIO_DT_SPEC_GET(DT_NODELABEL(wake_up_trigger), gpios); @@ -40,25 +30,5 @@ static int thunderboard_init(void) return 0; } -#ifdef CONFIG_SOC_GECKO_DEV_INIT -static int thunderboard_init_clocks(void) -{ - CMU_ClockSelectSet(cmuClock_SYSCLK, cmuSelect_HFRCODPLL); -#if defined(_CMU_EM01GRPACLKCTRL_MASK) - CMU_ClockSelectSet(cmuClock_EM01GRPACLK, cmuSelect_HFRCODPLL); -#endif -#if defined(_CMU_EM01GRPBCLKCTRL_MASK) - CMU_ClockSelectSet(cmuClock_EM01GRPBCLK, cmuSelect_HFRCODPLL); -#endif - CMU_ClockSelectSet(cmuClock_EM23GRPACLK, cmuSelect_LFRCO); -#if defined(RTCC_PRESENT) - CMU_ClockSelectSet(cmuClock_RTCC, cmuSelect_LFRCO); -#endif - CMU_ClockSelectSet(cmuClock_WDOG0, cmuSelect_LFRCO); - - return 0; -} -#endif - /* needs to be done after GPIO driver init */ SYS_INIT(thunderboard_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); diff --git a/boards/silabs/dev_kits/xg24_dk2601b/board.c b/boards/silabs/dev_kits/xg24_dk2601b/board.c index 601b759b6cad3..52c2e02e44a37 100644 --- a/boards/silabs/dev_kits/xg24_dk2601b/board.c +++ b/boards/silabs/dev_kits/xg24_dk2601b/board.c @@ -9,21 +9,12 @@ #include #include -#ifdef CONFIG_SOC_GECKO_DEV_INIT -#include "em_cmu.h" -#endif - LOG_MODULE_REGISTER(efr32xg24_dk2601b, CONFIG_BOARD_EFR32MG24_LOG_LEVEL); -static int efr32xg24_dk2601b_init_clocks(void); - static int efr32xg24_dk2601b_init(void) { int ret; -#ifdef CONFIG_SOC_GECKO_DEV_INIT - efr32xg24_dk2601b_init_clocks(); -#endif static struct gpio_dt_spec wake_up_gpio_dev = GPIO_DT_SPEC_GET(DT_NODELABEL(wake_up_trigger), gpios); @@ -40,32 +31,5 @@ static int efr32xg24_dk2601b_init(void) return 0; } -#ifdef CONFIG_SOC_GECKO_DEV_INIT -static int efr32xg24_dk2601b_init_clocks(void) -{ - CMU_ClockSelectSet(cmuClock_SYSCLK, cmuSelect_HFRCODPLL); -#if defined(_CMU_EM01GRPACLKCTRL_MASK) - CMU_ClockSelectSet(cmuClock_EM01GRPACLK, cmuSelect_HFRCODPLL); -#endif -#if defined(_CMU_EM01GRPBCLKCTRL_MASK) - CMU_ClockSelectSet(cmuClock_EM01GRPBCLK, cmuSelect_HFRCODPLL); -#endif - CMU_ClockSelectSet(cmuClock_EM23GRPACLK, cmuSelect_LFRCO); - CMU_ClockSelectSet(cmuClock_EM4GRPACLK, cmuSelect_LFRCO); -#if defined(RTCC_PRESENT) - CMU_ClockSelectSet(cmuClock_RTCC, cmuSelect_LFRCO); -#endif -#if defined(SYSRTC_PRESENT) - CMU_ClockSelectSet(cmuClock_SYSRTC, cmuSelect_LFRCO); -#endif - CMU_ClockSelectSet(cmuClock_WDOG0, cmuSelect_LFRCO); -#if WDOG_COUNT > 1 - CMU_ClockSelectSet(cmuClock_WDOG1, cmuSelect_LFRCO); -#endif - - return 0; -} -#endif - /* needs to be done after GPIO driver init */ SYS_INIT(efr32xg24_dk2601b_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); diff --git a/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b_defconfig b/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b_defconfig index c1fa5ece8551b..b7dbc036d0c1d 100644 --- a/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b_defconfig +++ b/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b_defconfig @@ -7,8 +7,6 @@ CONFIG_UART_CONSOLE=y CONFIG_SERIAL=y CONFIG_CORTEX_M_SYSTICK=y CONFIG_GPIO=y -CONFIG_CMU_HFCLK_HFXO=y -CONFIG_CMU_HFCLK_LFXO=y CONFIG_HW_STACK_PROTECTION=y CONFIG_PINCTRL=y CONFIG_REGULATOR=y diff --git a/boards/silabs/dev_kits/xg27_dk2602a/board.c b/boards/silabs/dev_kits/xg27_dk2602a/board.c index f26befcf50896..7c466f6ee74ca 100644 --- a/boards/silabs/dev_kits/xg27_dk2602a/board.c +++ b/boards/silabs/dev_kits/xg27_dk2602a/board.c @@ -8,22 +8,12 @@ #include #include -#ifdef CONFIG_SOC_GECKO_DEV_INIT -#include "em_cmu.h" -#endif - - LOG_MODULE_REGISTER(dev_kit, CONFIG_BOARD_XG27_DK2602A_LOG_LEVEL); -static int dev_kit_init_clocks(void); - static int dev_kit_init(void) { int ret; -#ifdef CONFIG_SOC_GECKO_DEV_INIT - dev_kit_init_clocks(); -#endif static struct gpio_dt_spec wake_up_gpio_dev = GPIO_DT_SPEC_GET(DT_NODELABEL(wake_up_trigger), gpios); @@ -40,25 +30,5 @@ static int dev_kit_init(void) return 0; } -#ifdef CONFIG_SOC_GECKO_DEV_INIT -static int dev_kit_init_clocks(void) -{ - CMU_ClockSelectSet(cmuClock_SYSCLK, cmuSelect_HFRCODPLL); -#if defined(_CMU_EM01GRPACLKCTRL_MASK) - CMU_ClockSelectSet(cmuClock_EM01GRPACLK, cmuSelect_HFRCODPLL); -#endif -#if defined(_CMU_EM01GRPBCLKCTRL_MASK) - CMU_ClockSelectSet(cmuClock_EM01GRPBCLK, cmuSelect_HFRCODPLL); -#endif - CMU_ClockSelectSet(cmuClock_EM23GRPACLK, cmuSelect_LFRCO); -#if defined(RTCC_PRESENT) - CMU_ClockSelectSet(cmuClock_RTCC, cmuSelect_LFRCO); -#endif - CMU_ClockSelectSet(cmuClock_WDOG0, cmuSelect_LFRCO); - - return 0; -} -#endif - /* needs to be done after GPIO driver init */ SYS_INIT(dev_kit_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); diff --git a/boards/sparkfun/thing_plus_matter_mgm240p/board.c b/boards/sparkfun/thing_plus_matter_mgm240p/board.c index 36735f35276cb..beb2b540294f3 100644 --- a/boards/sparkfun/thing_plus_matter_mgm240p/board.c +++ b/boards/sparkfun/thing_plus_matter_mgm240p/board.c @@ -10,22 +10,13 @@ #include #include -#ifdef CONFIG_SOC_GECKO_DEV_INIT -#include "em_cmu.h" -#endif - LOG_MODULE_REGISTER(sparkfun_thing_plus_mgm240p, CONFIG_BOARD_SPARKFUN_THING_PLUS_MATTER_MGM240P_LOG_LEVEL); -static int sparkfun_thing_plus_mgm240p_init_clocks(void); - static int sparkfun_thing_plus_mgm240p_init(void) { int ret; -#ifdef CONFIG_SOC_GECKO_DEV_INIT - sparkfun_thing_plus_mgm240p_init_clocks(); -#endif static struct gpio_dt_spec wake_up_gpio_dev = GPIO_DT_SPEC_GET(DT_NODELABEL(wake_up_trigger), gpios); @@ -42,35 +33,5 @@ static int sparkfun_thing_plus_mgm240p_init(void) return 0; } -#ifdef CONFIG_SOC_GECKO_DEV_INIT -static int sparkfun_thing_plus_mgm240p_init_clocks(void) -{ - CMU_ClockSelectSet(cmuClock_SYSCLK, cmuSelect_HFRCODPLL); -#if defined(_CMU_EM01GRPACLKCTRL_MASK) - CMU_ClockSelectSet(cmuClock_EM01GRPACLK, cmuSelect_HFRCODPLL); -#endif -#if defined(_CMU_EM01GRPBCLKCTRL_MASK) - CMU_ClockSelectSet(cmuClock_EM01GRPBCLK, cmuSelect_HFRCODPLL); -#endif -#if defined(_CMU_EM01GRPCCLKCTRL_MASK) - CMU_ClockSelectSet(cmuClock_EM01GRPCCLK, cmuSelect_HFRCODPLL); -#endif - CMU_ClockSelectSet(cmuClock_EM23GRPACLK, cmuSelect_LFRCO); - CMU_ClockSelectSet(cmuClock_EM4GRPACLK, cmuSelect_LFRCO); -#if defined(RTCC_PRESENT) - CMU_ClockSelectSet(cmuClock_RTCC, cmuSelect_LFRCO); -#endif -#if defined(SYSRTC_PRESENT) - CMU_ClockSelectSet(cmuClock_SYSRTC, cmuSelect_LFRCO); -#endif - CMU_ClockSelectSet(cmuClock_WDOG0, cmuSelect_LFRCO); -#if WDOG_COUNT > 1 - CMU_ClockSelectSet(cmuClock_WDOG1, cmuSelect_LFRCO); -#endif - - return 0; -} -#endif - /* needs to be done after GPIO driver init */ SYS_INIT(sparkfun_thing_plus_mgm240p_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); diff --git a/boards/sparkfun/thing_plus_matter_mgm240p/sparkfun_thing_plus_matter_mgm240p_defconfig b/boards/sparkfun/thing_plus_matter_mgm240p/sparkfun_thing_plus_matter_mgm240p_defconfig index 6ab4ff4cdaa73..85bdf41ea99ad 100644 --- a/boards/sparkfun/thing_plus_matter_mgm240p/sparkfun_thing_plus_matter_mgm240p_defconfig +++ b/boards/sparkfun/thing_plus_matter_mgm240p/sparkfun_thing_plus_matter_mgm240p_defconfig @@ -9,10 +9,8 @@ CONFIG_SERIAL=y CONFIG_CORTEX_M_SYSTICK=y CONFIG_GPIO=y CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=76800000 -CONFIG_CMU_HFCLK_HFXO=y CONFIG_SOC_GECKO_EMU_DCDC=y CONFIG_SOC_GECKO_EMU_DCDC_MODE_ON=y -CONFIG_CMU_HFCLK_LFXO=y CONFIG_HW_STACK_PROTECTION=y CONFIG_PINCTRL=y CONFIG_REGULATOR=y From cfccd1102683d676ab290cf483baaac2130ff435 Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Wed, 2 Oct 2024 22:39:06 +0200 Subject: [PATCH 1301/4482] drivers: timer: gecko: Remove clock configuration Clock setup is now done by the clock manager based on device tree configuration. Signed-off-by: Aksel Skauge Mellbye --- .../dev_kits/sltb010a/sltb010a_defconfig | 1 - .../xg27_dk2602a/xg27_dk2602a_defconfig | 1 - .../xg24_rb4187c/xg24_rb4187c_defconfig | 1 - drivers/timer/gecko_burtc_timer.c | 11 ------- soc/silabs/Kconfig | 31 ------------------- 5 files changed, 45 deletions(-) diff --git a/boards/silabs/dev_kits/sltb010a/sltb010a_defconfig b/boards/silabs/dev_kits/sltb010a/sltb010a_defconfig index 1b801c67bf81e..ecee74de4cc86 100644 --- a/boards/silabs/dev_kits/sltb010a/sltb010a_defconfig +++ b/boards/silabs/dev_kits/sltb010a/sltb010a_defconfig @@ -12,5 +12,4 @@ CONFIG_PINCTRL=y # Use BURTC as system clock source CONFIG_GECKO_BURTC_TIMER=y -CONFIG_CMU_BURTCCLK_LFXO=y CONFIG_SYS_CLOCK_TICKS_PER_SEC=1024 diff --git a/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a_defconfig b/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a_defconfig index 1b801c67bf81e..ecee74de4cc86 100644 --- a/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a_defconfig +++ b/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a_defconfig @@ -12,5 +12,4 @@ CONFIG_PINCTRL=y # Use BURTC as system clock source CONFIG_GECKO_BURTC_TIMER=y -CONFIG_CMU_BURTCCLK_LFXO=y CONFIG_SYS_CLOCK_TICKS_PER_SEC=1024 diff --git a/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c_defconfig b/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c_defconfig index c8415198cbc17..b437d477f1045 100644 --- a/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c_defconfig +++ b/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c_defconfig @@ -11,5 +11,4 @@ CONFIG_PINCTRL=y # Use BURTC as system clock source CONFIG_GECKO_BURTC_TIMER=y -CONFIG_CMU_BURTCCLK_LFXO=y CONFIG_SYS_CLOCK_TICKS_PER_SEC=1024 diff --git a/drivers/timer/gecko_burtc_timer.c b/drivers/timer/gecko_burtc_timer.c index 110efa5f928e3..cd004f223fd85 100644 --- a/drivers/timer/gecko_burtc_timer.c +++ b/drivers/timer/gecko_burtc_timer.c @@ -189,17 +189,6 @@ static int burtc_init(void) /* Enable clock for BURTC CSRs on APB */ CMU_ClockEnable(cmuClock_BURTC, true); - /* Configure BURTC LF clocksource according to Kconfig */ -#if defined(CONFIG_CMU_BURTCCLK_LFXO) - CMU_ClockSelectSet(cmuClock_BURTC, cmuSelect_LFXO); -#elif defined(CONFIG_CMU_BURTCCLK_LFRCO) - CMU_ClockSelectSet(cmuClock_BURTC, cmuSelect_LFRCO); -#elif defined(CONFIG_CMU_BURTCCLK_ULFRCO) - CMU_ClockSelectSet(cmuClock_BURTC, cmuSelect_ULFRCO); -#else -#error "Unsupported BURTC clock specified" -#endif - /* Calculate timing constants and init BURTC */ hw_clock_freq = CMU_ClockFreqGet(cmuClock_BURTC); z_clock_hw_cycles_per_sec = hw_clock_freq; diff --git a/soc/silabs/Kconfig b/soc/silabs/Kconfig index 82cae9d7e3a27..a9c9fde9da417 100644 --- a/soc/silabs/Kconfig +++ b/soc/silabs/Kconfig @@ -222,37 +222,6 @@ config CMU_HFCLK_HFRCO endchoice - -choice - prompt "BURTC Clock Selection" - depends on SOC_GECKO_BURTC - default CMU_BURTCCLK_LFRCO - -config CMU_BURTCCLK_LFXO - bool "LFXO - external low frequency crystal oscillator" - select CMU_NEED_LFXO - help - Set this option to use LFXO - the external low freqency crystal oscillator - as BURTC clock. - Frequency is set by external crystal, typically 32.768 kHz. - -config CMU_BURTCCLK_LFRCO - bool "LFRCO - internal low frequency RC oscillator" - help - Set this option to use LFRCO - the internal low freqency RC oscillator - as BURTC clock. - Frequency is approximately 32.768 kHz. - -config CMU_BURTCCLK_ULFRCO - bool "ULFRCO - internal ultra low frequency RC oscillator" - help - Set this option to use ULFRCO - the external low freqency crystal oscillator - as BURTC clock. - Frequency is approximately 1 kHz. - -endchoice - - config CMU_HFXO_FREQ int "External high frequency oscillator frequency" help From a11f0e6d8d66d52f0f1fd557feb543e7308f30e6 Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Thu, 3 Oct 2024 19:10:59 +0200 Subject: [PATCH 1302/4482] soc: silabs: Separate Series 2 soc.c Series 2 always uses the device init HAL, while Series 0/1 never do. Create a separate soc.c for Series 2 to make both versions easier to read. Signed-off-by: Aksel Skauge Mellbye --- soc/silabs/common/CMakeLists.txt | 2 +- soc/silabs/common/soc.c | 25 ------------------- soc/silabs/silabs_s2/CMakeLists.txt | 2 ++ soc/silabs/silabs_s2/soc.c | 37 +++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 26 deletions(-) create mode 100644 soc/silabs/silabs_s2/soc.c diff --git a/soc/silabs/common/CMakeLists.txt b/soc/silabs/common/CMakeLists.txt index 7d1ed73666741..e19ac55906181 100644 --- a/soc/silabs/common/CMakeLists.txt +++ b/soc/silabs/common/CMakeLists.txt @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 -if(CONFIG_SOC_FAMILY_SILABS_S0 OR CONFIG_SOC_FAMILY_SILABS_S1 OR CONFIG_SOC_FAMILY_SILABS_S2) +if(CONFIG_SOC_FAMILY_SILABS_S0 OR CONFIG_SOC_FAMILY_SILABS_S1) zephyr_sources(soc.c) endif() diff --git a/soc/silabs/common/soc.c b/soc/silabs/common/soc.c index f853820573f3d..5dfaafdc8776e 100644 --- a/soc/silabs/common/soc.c +++ b/soc/silabs/common/soc.c @@ -19,17 +19,6 @@ #include #include -#ifdef CONFIG_SOC_GECKO_DEV_INIT -#include -#include - -#ifdef CONFIG_PM -#include -#include -#endif - -#endif - LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); #ifdef CONFIG_CMU_HFCLK_HFXO @@ -212,19 +201,6 @@ void soc_early_init_hook(void) init_lfxo(); #endif -#ifdef CONFIG_SOC_GECKO_DEV_INIT - if (DT_HAS_COMPAT_STATUS_OKAY(silabs_series2_dcdc)) { - sl_device_init_dcdc(); - } - sl_clock_manager_init(); - -#ifdef CONFIG_PM - sl_power_manager_init(); - sl_hfxo_manager_init(); -#endif - -#else /* !CONFIG_SOC_GECKO_DEV_INIT */ - #ifdef CONFIG_SOC_GECKO_EMU_DCDC dcdc_init(); #endif @@ -236,5 +212,4 @@ void soc_early_init_hook(void) /* Configure SWO debug output */ swo_init(); #endif -#endif /* !CONFIG_SOC_GECKO_DEV_INIT */ } diff --git a/soc/silabs/silabs_s2/CMakeLists.txt b/soc/silabs/silabs_s2/CMakeLists.txt index 5b11abea25e04..f170c44fd1838 100644 --- a/soc/silabs/silabs_s2/CMakeLists.txt +++ b/soc/silabs/silabs_s2/CMakeLists.txt @@ -1,2 +1,4 @@ # Copyright (c) 2024 Silicon Laboratories Inc. # SPDX-License-Identifier: Apache-2.0 + +zephyr_sources(soc.c) diff --git a/soc/silabs/silabs_s2/soc.c b/soc/silabs/silabs_s2/soc.c new file mode 100644 index 0000000000000..7d503aa27add0 --- /dev/null +++ b/soc/silabs/silabs_s2/soc.c @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Silicon Laboratories Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file + * @brief SoC initialization for Silicon Labs Series 2 products + */ + +#include +#include + +#include +#include +#include +#include +#include + +LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); + +void soc_early_init_hook(void) +{ + /* Handle chip errata */ + CHIP_Init(); + + if (DT_HAS_COMPAT_STATUS_OKAY(silabs_series2_dcdc)) { + sl_device_init_dcdc(); + } + sl_clock_manager_init(); + + if (IS_ENABLED(CONFIG_PM)) { + sl_power_manager_init(); + sl_hfxo_manager_init(); + } +} From 62d7db4d4d5251447d6e895907197df2f7b04dac Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Mon, 20 May 2024 16:17:02 -0400 Subject: [PATCH 1303/4482] drivers: timer: mec5: Driver using Microchip RTOS timer as kernel tick Timer driver using Microchip 32KHz based RTOS timer as the kernel timer tick. The driver uses one of the 32-bit basic timers to support the kernel's k_busy_wait API which is passed a wait count in 1 us units. The 32-bit basic timer is selected by using device tree chosen rtimer-busy-wait-timer set to the handle of the desired 32-bit basic timer. If this driver is disabled, the build system will select the ARM Cortex-M4 SysTick as the kernel timer tick driver. The user should specify RTOS timer as kernel tick by adding the compatible properity and setting the status property to "okay" at the board or application level device tree. The driver implements two internal API's for use by the SoC PM. These two API's allow the SoC PM layer to disable the timer used for k_busy_wait so the PLL can be disabled in deep sleep. We used a custom API so we can disable this timer in the deep sleep path when we know k_busy_wait will not be called by other drivers or applications. Signed-off-by: Scott Worley --- drivers/timer/CMakeLists.txt | 1 + drivers/timer/Kconfig | 1 + drivers/timer/Kconfig.mec5 | 17 + drivers/timer/mchp_mec5_ktimer.c | 405 ++++++++++++++++++ dts/bindings/timer/microchip,mec5-ktimer.yaml | 29 ++ 5 files changed, 453 insertions(+) create mode 100644 drivers/timer/Kconfig.mec5 create mode 100644 drivers/timer/mchp_mec5_ktimer.c create mode 100644 dts/bindings/timer/microchip,mec5-ktimer.yaml diff --git a/drivers/timer/CMakeLists.txt b/drivers/timer/CMakeLists.txt index 56eea917d59f5..653bff66a9868 100644 --- a/drivers/timer/CMakeLists.txt +++ b/drivers/timer/CMakeLists.txt @@ -18,6 +18,7 @@ zephyr_library_sources_ifdef(CONFIG_HPET_TIMER hpet.c) zephyr_library_sources_ifdef(CONFIG_ITE_IT8XXX2_TIMER ite_it8xxx2_timer.c) zephyr_library_sources_ifdef(CONFIG_LEON_GPTIMER leon_gptimer.c) zephyr_library_sources_ifdef(CONFIG_LITEX_TIMER litex_timer.c) +zephyr_library_sources_ifdef(CONFIG_MCHP_MEC5_KTIMER mchp_mec5_ktimer.c) zephyr_library_sources_ifdef(CONFIG_MCHP_XEC_RTOS_TIMER mchp_xec_rtos_timer.c) zephyr_library_sources_ifdef(CONFIG_MCUX_LPTMR_TIMER mcux_lptmr_timer.c) zephyr_library_sources_ifdef(CONFIG_MCUX_OS_TIMER mcux_os_timer.c) diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig index e0fbfa4b1af27..8309fded78127 100644 --- a/drivers/timer/Kconfig +++ b/drivers/timer/Kconfig @@ -80,6 +80,7 @@ source "drivers/timer/Kconfig.mchp_xec_rtos" source "drivers/timer/Kconfig.mcux_gpt" source "drivers/timer/Kconfig.mcux_lptmr" source "drivers/timer/Kconfig.mcux_os" +source "drivers/timer/Kconfig.mec5" source "drivers/timer/Kconfig.mips_cp0" source "drivers/timer/Kconfig.native_posix" source "drivers/timer/Kconfig.npcx_itim" diff --git a/drivers/timer/Kconfig.mec5 b/drivers/timer/Kconfig.mec5 new file mode 100644 index 0000000000000..ccc466d2f3b01 --- /dev/null +++ b/drivers/timer/Kconfig.mec5 @@ -0,0 +1,17 @@ +# Copyright (c) 2024 Microchip Technology Inc. +# SPDX-License-Identifier: Apache-2.0 + +config MCHP_MEC5_KTIMER + bool "Microchip MEC5 HAL kernel timer" + default y + depends on DT_HAS_MICROCHIP_MEC5_KTIMER_ENABLED + select TICKLESS_CAPABLE + select SYSTEM_TIMER_HAS_DISABLE_SUPPORT + select ARCH_HAS_CUSTOM_BUSY_WAIT + help + This module implements a kernel timer device driver for the + Microchip MEC5 SoC. It makes use of two hardware timers. + The 32-bit 32 KHz based RTOS timer which is operational in + full power and deep sleep. Basic timer 5 is a 48 MHz based + 32-bit down counter with frequency divider used for the + custom busy wait kernel API. diff --git a/drivers/timer/mchp_mec5_ktimer.c b/drivers/timer/mchp_mec5_ktimer.c new file mode 100644 index 0000000000000..704141892a611 --- /dev/null +++ b/drivers/timer/mchp_mec5_ktimer.c @@ -0,0 +1,405 @@ +/* + * Copyright (c) 2024 Microchip Technology Incorporated + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT microchip_mec5_ktimer + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +BUILD_ASSERT(!IS_ENABLED(CONFIG_SMP), "MCHP MEC5 ktimer doesn't support SMP"); +BUILD_ASSERT(CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC == 32768, + "MCHP MEC5 ktimer HW frequency is fixed at 32768"); + +#ifndef CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT +BUILD_ASSERT(0, "MCHP MEC5 ktimer requires ARCH_HAS_CUSTOM_BUSY_WAIT"); +#endif + +#ifdef CONFIG_SOC_MEC_DEBUG_AND_TRACING +#define RTIMER_START_VAL MEC_RTIMER_START_EXT_HALT +#else +#define RTIMER_START_VAL MEC_RTIMER_START +#endif + +/* + * Overview: + * + * This driver enables the Microchip XEC 32KHz based RTOS timer as the Zephyr + * system timer. It supports both legacy ("tickful") mode as well as + * TICKLESS_KERNEL. The XEC RTOS timer is a down counter with a fixed + * frequency of 32768 Hz. The driver is based upon the Intel local APIC + * timer driver. + * Configuration: + * + * CONFIG_MCHP_XEC_RTOS_TIMER=y + * + * CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC= must be set to 32768. + * + * To reduce truncation errors from accumulating due to conversion + * to/from time, ticks, and HW cycles set ticks per second equal to + * the frequency. With tickless kernel mode enabled the kernel will not + * program a periodic timer at this fast rate. + * CONFIG_SYS_CLOCK_TICKS_PER_SEC=32768 + */ + +#define CYCLES_PER_TICK (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC / CONFIG_SYS_CLOCK_TICKS_PER_SEC) + +/* Mask off bits[31:28] of 32-bit count */ +#define RTIMER_MAX 0x0fffffffu +#define RTIMER_COUNT_MASK 0x0fffffffu +#define RTIMER_STOPPED 0xf0000000u + +/* Adjust cycle count programmed into timer for HW restart latency */ +#define RTIMER_ADJUST_LIMIT 2 +#define RTIMER_ADJUST_CYCLES 1 + +/* max number of ticks we can load into the timer in one shot */ +#define MAX_TICKS (RTIMER_MAX / CYCLES_PER_TICK) + +#define RTIMER_NODE_ID DT_INST(0, DT_DRV_COMPAT) +#define RTIMER_NVIC_NO DT_INST_IRQN(0) +#define RTIMER_NVIC_PRIO DT_INST_IRQ(0, priority) + +static struct mec_rtmr_regs *const rtimer = (struct mec_rtmr_regs *)DT_INST_REG_ADDR(0); + +#ifdef CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT +#define BTIMER_NODE_ID DT_CHOSEN(rtimer_busy_wait_timer) +#define MEC5_BTIMER_FDIV (MEC5_BTIMER_MAX_FREQ_HZ / 1000000u) + +static struct mec_btmr_regs *const btimer = (struct mec_btmr_regs *)DT_REG_ADDR(BTIMER_NODE_ID); +#endif + +/* + * The spinlock protects all access to the RTIMER registers, as well as + * 'total_cycles', 'last_announcement', and 'cached_icr'. + * + * One important invariant that must be observed: `total_cycles` + `cached_icr` + * is always an integral multiple of CYCLE_PER_TICK; this is, timer interrupts + * are only ever scheduled to occur at tick boundaries. + */ + +static struct k_spinlock lock; +static uint32_t total_cycles; +static uint32_t cached_icr = CYCLES_PER_TICK; + +/* + * Read the RTOS timer counter handling the case where the timer + * has been reloaded within 1 32KHz clock of reading its count register. + * The RTOS timer hardware must synchronize the write to its control register + * on the AHB clock domain with the 32KHz clock domain of its internal logic. + * This synchronization can take from nearly 0 time up to 1 32KHz clock as it + * depends upon which 48MHz AHB clock with a 32KHz period the register write + * was on. We detect the timer is in the load state by checking the read-only + * count register and the START bit in the control register. If count register + * is 0 and the START bit is set then the timer has been started and is in the + * process of moving the preload register value into the count register. + */ +static inline uint32_t rtimer_count(void) +{ + uint32_t ccr = mec_hal_rtimer_count(rtimer); + + if ((ccr == 0) && mec_hal_rtimer_is_started(rtimer)) { + ccr = cached_icr; + } + + return ccr; +} + +#ifdef CONFIG_TICKLESS_KERNEL + +static uint32_t last_announcement; /* last time we called sys_clock_announce() */ + +/* + * Request a timeout n Zephyr ticks in the future from now. + * Requested number of ticks in the future of n <= 1 means the kernel wants + * the tick announced as soon as possible, ideally no more than one tick + * in the future. + * + * Per comment below we don't clear RTMR pending interrupt. + * RTMR counter register is read-only and is loaded from the preload + * register by a 0->1 transition of the control register start bit. + * Writing a new value to preload only takes effect once the count + * register reaches 0. + */ +void sys_clock_set_timeout(int32_t n, bool idle) +{ + ARG_UNUSED(idle); + + uint32_t ccr, temp; + int full_ticks; /* number of complete ticks we'll wait */ + uint32_t full_cycles; /* full_ticks represented as cycles */ + uint32_t partial_cycles; /* number of cycles to first tick boundary */ + + if (idle && (n == K_TICKS_FOREVER)) { + /* + * We are not in a locked section. Are writes to two + * global objects safe from pre-emption? + */ + mec_hal_rtimer_stop(rtimer); + cached_icr = RTIMER_STOPPED; + return; + } + + if (n < 1) { + full_ticks = 0; + } else if ((n == K_TICKS_FOREVER) || (n > MAX_TICKS)) { + full_ticks = MAX_TICKS - 1; + } else { + full_ticks = n - 1; + } + + full_cycles = full_ticks * CYCLES_PER_TICK; + + k_spinlock_key_t key = k_spin_lock(&lock); + + ccr = rtimer_count(); + + /* turn off to clear any pending interrupt status */ + mec_hal_rtimer_stop(rtimer); + mec_hal_rtimer_status_clear_all(rtimer); + NVIC_ClearPendingIRQ(RTIMER_NVIC_NO); + + temp = total_cycles; + temp += (cached_icr - ccr); + temp &= RTIMER_COUNT_MASK; + total_cycles = temp; + + partial_cycles = CYCLES_PER_TICK - (total_cycles % CYCLES_PER_TICK); + cached_icr = full_cycles + partial_cycles; + /* adjust for up to one 32KHz cycle startup time */ + temp = cached_icr; + if (temp > RTIMER_ADJUST_LIMIT) { + temp -= RTIMER_ADJUST_CYCLES; + } + + mec_hal_rtimer_stop_and_load(rtimer, temp, RTIMER_START_VAL); + + k_spin_unlock(&lock, key); +} + +/* + * Return the number of Zephyr ticks elapsed from last call to + * sys_clock_announce in the ISR. The caller casts uint32_t to int32_t. + * We must make sure bit[31] is 0 in the return value. + */ +uint32_t sys_clock_elapsed(void) +{ + uint32_t ccr; + uint32_t ticks; + int32_t elapsed; + + k_spinlock_key_t key = k_spin_lock(&lock); + + ccr = rtimer_count(); + + /* It may not look efficient but the compiler does a good job */ + elapsed = (int32_t)total_cycles - (int32_t)last_announcement; + if (elapsed < 0) { + elapsed = -1 * elapsed; + } + ticks = (uint32_t)elapsed; + ticks += cached_icr - ccr; + ticks /= CYCLES_PER_TICK; + ticks &= RTIMER_COUNT_MASK; + + k_spin_unlock(&lock, key); + + return ticks; +} + +static void mec5_ktimer_isr(const void *arg) +{ + ARG_UNUSED(arg); + + uint32_t cycles; + int32_t ticks; + + k_spinlock_key_t key = k_spin_lock(&lock); + + mec_hal_rtimer_status_clear_all(rtimer); + + /* Restart the timer as early as possible to minimize drift... */ + mec_hal_rtimer_stop_and_load(rtimer, MAX_TICKS * CYCLES_PER_TICK, RTIMER_START_VAL); + + cycles = cached_icr; + cached_icr = MAX_TICKS * CYCLES_PER_TICK; + + total_cycles += cycles; + total_cycles &= RTIMER_COUNT_MASK; + + /* handle wrap by using (power of 2) - 1 mask */ + ticks = total_cycles - last_announcement; + ticks &= RTIMER_COUNT_MASK; + ticks /= CYCLES_PER_TICK; + + last_announcement = total_cycles; + + k_spin_unlock(&lock, key); + sys_clock_announce(ticks); +} + +#else +/* Non-tickless kernel build. */ +static void mec5_ktimer_isr(const void *arg) +{ + ARG_UNUSED(arg); + + k_spinlock_key_t key = k_spin_lock(&lock); + + mec_hal_rtimer_status_clear_all(rtimer); + + /* Restart the timer as early as possible to minimize drift... */ + mec_hal_rtimer_stop_and_load(rtimer, cached_icr, RTIMER_START_VAL); + + uint32_t temp = total_cycles + CYCLES_PER_TICK; + + total_cycles = temp & RTIMER_COUNT_MASK; + k_spin_unlock(&lock, key); + + sys_clock_announce(1); +} + +uint32_t sys_clock_elapsed(void) +{ + return 0U; +} +#endif /* CONFIG_TICKLESS_KERNEL */ + +/* + * Warning RTOS timer resolution is 30.5 us. + * This is called by two code paths: + * 1. Kernel call to k_cycle_get_32() -> arch_k_cycle_get_32() -> here. + * The kernel is casting return to (int) and using it uncasted in math + * expressions with int types. Expression result is stored in an int. + * 2. If CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT is not defined then + * z_impl_k_busy_wait calls here. This code path uses the value as uint32_t. + * + */ +uint32_t sys_clock_cycle_get_32(void) +{ + uint32_t ret; + uint32_t ccr; + + k_spinlock_key_t key = k_spin_lock(&lock); + + ccr = rtimer_count(); + ret = (total_cycles + (cached_icr - ccr)) & RTIMER_COUNT_MASK; + + k_spin_unlock(&lock, key); + + return ret; +} + +void sys_clock_idle_exit(void) +{ + if (cached_icr == RTIMER_STOPPED) { + cached_icr = CYCLES_PER_TICK; + mec_hal_rtimer_stop_and_load(rtimer, cached_icr, RTIMER_START_VAL); + } +} + +void sys_clock_disable(void) +{ + mec_hal_rtimer_stop(rtimer); +} + +#ifdef CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT +/* Custom kernel busy wait API implementation using a 48MHz based + * 32-bit basic timer divided down to 1 MHz. Basic timer configured + * for count up, auto-reload, and no interrupt mode. + */ +void arch_busy_wait(uint32_t usec_to_wait) +{ + if (usec_to_wait == 0) { + return; + } + + uint32_t start = mec_hal_btimer_count(btimer); + + for (;;) { + uint32_t curr = mec_hal_btimer_count(btimer); + + if ((curr - start) >= usec_to_wait) { + break; + } + } +} + +/* k_busy_wait parameter is the number of microseconds to wait. + * Configure basic timer for 1 MHz (1 us tick) operation. + */ +static int config_custom_busy_wait(void) +{ + uint32_t bflags = + (BIT(MEC5_BTIMER_CFG_FLAG_START_POS) | BIT(MEC5_BTIMER_CFG_FLAG_AUTO_RELOAD_POS) | + BIT(MEC5_BTIMER_CFG_FLAG_COUNT_UP_POS)); + uint32_t count = 0; + + mec_hal_btimer_init(btimer, MEC5_BTIMER_FDIV, count, bflags); + + return 0; +} + +void soc_ktimer_pm_entry(bool is_deep_sleep) +{ + if (is_deep_sleep) { + mec_hal_btimer_disable(btimer); + } +} + +void soc_ktimer_pm_exit(bool is_deep_sleep) +{ + if (is_deep_sleep) { + mec_hal_btimer_enable(btimer); + } +} +#else +void soc_ktimer_pm_entry(void) +{ +} +void soc_ktimer_pm_exit(void) +{ +} +#endif /* CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT */ + +static int sys_clock_driver_init(void) +{ + uint32_t rtmr_cfg = BIT(MEC_RTMR_CFG_EN_POS) | BIT(MEC_RTMR_CFG_IEN_POS); + + if (IS_ENABLED(CONFIG_SOC_MEC_DEBUG_AND_TRACING)) { + rtmr_cfg |= BIT(MEC_RTMR_CFG_DBG_HALT_POS); + } + +#ifdef CONFIG_TICKLESS_KERNEL + cached_icr = MAX_TICKS; +#endif + + mec_hal_rtimer_init(rtimer, rtmr_cfg, cached_icr); + + IRQ_CONNECT(RTIMER_NVIC_NO, RTIMER_NVIC_PRIO, mec5_ktimer_isr, 0, 0); + irq_enable(RTIMER_NVIC_NO); + +#ifdef CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT + config_custom_busy_wait(); +#endif + + mec_hal_rtimer_start(rtimer); + while (!mec_hal_rtimer_is_counting(rtimer)) { + ; + } + + return 0; +} + +SYS_INIT(sys_clock_driver_init, PRE_KERNEL_2, CONFIG_SYSTEM_CLOCK_INIT_PRIORITY); diff --git a/dts/bindings/timer/microchip,mec5-ktimer.yaml b/dts/bindings/timer/microchip,mec5-ktimer.yaml new file mode 100644 index 0000000000000..d498650a09e70 --- /dev/null +++ b/dts/bindings/timer/microchip,mec5-ktimer.yaml @@ -0,0 +1,29 @@ +# Copyright (c) 2019 Microchip Technology Inc. +# SPDX-License-Identifier: Apache-2.0 + +description: | + Microchip MEC5 kernel timer implemented by combining + the 32kHz 32-bit RTOS timer with 32-bit basic timer 5. + +compatible: "microchip,mec5-ktimer" + +include: base.yaml + +properties: + reg: + required: true + + interrupts: + required: true + + clock-frequency: + type: int + required: true + const: 32768 + description: RTOS timer runs at fixed 32 KHz. + + max-value: + type: int + required: true + const: 0xffffffff + description: RTOS timer counter maximum value. From d557ee36d59e0e303031087876e93c891673bc4f Mon Sep 17 00:00:00 2001 From: Luis Ubieda Date: Mon, 30 Sep 2024 14:17:52 -0400 Subject: [PATCH 1304/4482] sensor: tree-wide: Enforce dependency of int-gpios with Trigger feature We need int-gpios defined to use trigger functionality. Enforced with the Kconfig parameter. Signed-off-by: Luis Ubieda --- drivers/sensor/adi/adt7310/Kconfig | 4 ++++ drivers/sensor/adi/adt7420/Kconfig | 2 ++ drivers/sensor/adi/adxl362/Kconfig | 2 ++ drivers/sensor/adi/adxl367/Kconfig | 2 ++ drivers/sensor/adi/adxl372/Kconfig | 2 ++ drivers/sensor/amg88xx/Kconfig | 2 ++ drivers/sensor/ams/ccs811/Kconfig | 2 ++ drivers/sensor/ams/tmd2620/Kconfig | 1 + drivers/sensor/ams/tsl2540/Kconfig | 2 ++ drivers/sensor/ams/tsl2591/Kconfig | 2 ++ drivers/sensor/apds9960/Kconfig | 1 + drivers/sensor/bosch/bma280/Kconfig | 2 ++ drivers/sensor/bosch/bmc150_magn/Kconfig | 1 + drivers/sensor/bosch/bmg160/Kconfig | 4 ++++ drivers/sensor/bosch/bmi08x/Kconfig | 4 ++++ drivers/sensor/bosch/bmi160/Kconfig | 4 ++++ drivers/sensor/bosch/bmi270/Kconfig | 2 ++ drivers/sensor/bosch/bmm150/Kconfig | 6 ++++++ drivers/sensor/bosch/bmp388/Kconfig | 6 ++++++ drivers/sensor/ens160/Kconfig | 2 ++ drivers/sensor/grow_r502a/Kconfig | 1 + drivers/sensor/honeywell/hmc5883l/Kconfig | 2 ++ drivers/sensor/jedec/jc42/Kconfig | 2 ++ drivers/sensor/lm77/Kconfig | 2 ++ drivers/sensor/memsic/mc3419/Kconfig | 2 ++ drivers/sensor/microchip/tcn75a/Kconfig | 4 ++++ drivers/sensor/nxp/fxas21002/Kconfig | 3 +++ drivers/sensor/nxp/fxls8974/Kconfig | 3 +++ drivers/sensor/nxp/fxos8700/Kconfig | 3 +++ drivers/sensor/renesas/isl29035/Kconfig | 2 ++ drivers/sensor/sensirion/sht3xd/Kconfig | 2 ++ drivers/sensor/st/hts221/Kconfig | 2 ++ drivers/sensor/st/iis2dh/Kconfig | 2 ++ drivers/sensor/st/iis2dlpc/Kconfig | 2 ++ drivers/sensor/st/iis2iclx/Kconfig | 2 ++ drivers/sensor/st/iis2mdc/Kconfig | 2 ++ drivers/sensor/st/iis3dhhc/Kconfig | 2 ++ drivers/sensor/st/ism330dhcx/Kconfig | 2 ++ drivers/sensor/st/lis2dh/Kconfig | 2 ++ drivers/sensor/st/lis2ds12/Kconfig | 2 ++ drivers/sensor/st/lis2dw12/Kconfig | 2 ++ drivers/sensor/st/lis2mdl/Kconfig | 2 ++ drivers/sensor/st/lis3mdl/Kconfig | 2 ++ drivers/sensor/st/lps22hh/Kconfig | 2 ++ drivers/sensor/st/lps2xdf/Kconfig | 2 ++ drivers/sensor/st/lsm6dsl/Kconfig | 2 ++ drivers/sensor/st/lsm6dso/Kconfig | 1 + drivers/sensor/st/lsm6dso16is/Kconfig | 2 ++ drivers/sensor/st/lsm6dsv16x/Kconfig | 4 ++++ drivers/sensor/st/lsm9ds0_gyro/Kconfig | 1 + drivers/sensor/st/stts751/Kconfig | 2 ++ drivers/sensor/sx9500/Kconfig | 2 ++ drivers/sensor/tdk/icm42605/Kconfig | 1 + drivers/sensor/tdk/icm42670/Kconfig | 2 ++ drivers/sensor/tdk/icm42688/Kconfig | 4 ++++ drivers/sensor/tdk/mpu6050/Kconfig | 2 ++ drivers/sensor/tdk/mpu9250/Kconfig | 2 ++ drivers/sensor/ti/bq274xx/Kconfig | 4 ++++ drivers/sensor/ti/fdc2x1x/Kconfig | 2 ++ drivers/sensor/ti/ina23x/Kconfig | 2 ++ drivers/sensor/ti/tmag5170/Kconfig | 3 +++ drivers/sensor/ti/tmp007/Kconfig | 2 ++ drivers/sensor/vishay/vcnl4040/Kconfig | 2 ++ 63 files changed, 147 insertions(+) diff --git a/drivers/sensor/adi/adt7310/Kconfig b/drivers/sensor/adi/adt7310/Kconfig index 6913e03c6ac24..1c2ae4cb720f5 100644 --- a/drivers/sensor/adi/adt7310/Kconfig +++ b/drivers/sensor/adi/adt7310/Kconfig @@ -29,12 +29,16 @@ config ADT7310_TRIGGER_NONE config ADT7310_TRIGGER_GLOBAL_THREAD bool "Use global thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ADI_ADT7310),int-gpios) select ADT7310_TRIGGER help Use a global thread for the interrupt handler. config ADT7310_TRIGGER_OWN_THREAD bool "Use own thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ADI_ADT7310),int-gpios) select ADT7310_TRIGGER help Use a separate thread for the interrupt handler. diff --git a/drivers/sensor/adi/adt7420/Kconfig b/drivers/sensor/adi/adt7420/Kconfig index f8dd4add45760..aabc8e8e54f9b 100644 --- a/drivers/sensor/adi/adt7420/Kconfig +++ b/drivers/sensor/adi/adt7420/Kconfig @@ -43,11 +43,13 @@ config ADT7420_TRIGGER_NONE config ADT7420_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ADI_ADT7420),int-gpios) select ADT7420_TRIGGER config ADT7420_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ADI_ADT7420),int-gpios) select ADT7420_TRIGGER endchoice diff --git a/drivers/sensor/adi/adxl362/Kconfig b/drivers/sensor/adi/adxl362/Kconfig index 549ee49fb3727..e834fd1addb0e 100644 --- a/drivers/sensor/adi/adxl362/Kconfig +++ b/drivers/sensor/adi/adxl362/Kconfig @@ -71,11 +71,13 @@ config ADXL362_TRIGGER_NONE config ADXL362_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ADI_ADXL362),int1-gpios) select ADXL362_TRIGGER config ADXL362_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ADI_ADXL362),int1-gpios) select ADXL362_TRIGGER endchoice diff --git a/drivers/sensor/adi/adxl367/Kconfig b/drivers/sensor/adi/adxl367/Kconfig index 5b1100f00cc01..f088854e0a224 100644 --- a/drivers/sensor/adi/adxl367/Kconfig +++ b/drivers/sensor/adi/adxl367/Kconfig @@ -104,11 +104,13 @@ config ADXL367_TRIGGER_NONE config ADXL367_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ADI_ADXL367),int1-gpios) select ADXL367_TRIGGER config ADXL367_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ADI_ADXL367),int1-gpios) select ADXL367_TRIGGER endchoice diff --git a/drivers/sensor/adi/adxl372/Kconfig b/drivers/sensor/adi/adxl372/Kconfig index bcbf69d7d4354..6f6b111d2c451 100644 --- a/drivers/sensor/adi/adxl372/Kconfig +++ b/drivers/sensor/adi/adxl372/Kconfig @@ -95,11 +95,13 @@ config ADXL372_TRIGGER_NONE config ADXL372_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ADI_ADXL372),int1-gpios) select ADXL372_TRIGGER config ADXL372_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ADI_ADXL372),int1-gpios) select ADXL372_TRIGGER endchoice diff --git a/drivers/sensor/amg88xx/Kconfig b/drivers/sensor/amg88xx/Kconfig index 0b5ce00b6591b..13497035dfcdc 100644 --- a/drivers/sensor/amg88xx/Kconfig +++ b/drivers/sensor/amg88xx/Kconfig @@ -25,11 +25,13 @@ config AMG88XX_TRIGGER_NONE config AMG88XX_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_PANASONIC_AMG88XX),int-gpios) select AMG88XX_TRIGGER config AMG88XX_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_PANASONIC_AMG88XX),int-gpios) select AMG88XX_TRIGGER endchoice diff --git a/drivers/sensor/ams/ccs811/Kconfig b/drivers/sensor/ams/ccs811/Kconfig index 5a660805fa2e6..f5965330239f1 100644 --- a/drivers/sensor/ams/ccs811/Kconfig +++ b/drivers/sensor/ams/ccs811/Kconfig @@ -53,11 +53,13 @@ config CCS811_TRIGGER_NONE config CCS811_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_AMS_CCS811),irq-gpios) select CCS811_TRIGGER config CCS811_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_AMS_CCS811),irq-gpios) select CCS811_TRIGGER endchoice diff --git a/drivers/sensor/ams/tmd2620/Kconfig b/drivers/sensor/ams/tmd2620/Kconfig index 95685199e8201..2a9885403dc3f 100644 --- a/drivers/sensor/ams/tmd2620/Kconfig +++ b/drivers/sensor/ams/tmd2620/Kconfig @@ -23,6 +23,7 @@ config TMD2620_TRIGGER_NONE config TMD2620_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_AMS_TMD2620),int-gpios) select TMD2620_TRIGGER endchoice # Trigger Mode diff --git a/drivers/sensor/ams/tsl2540/Kconfig b/drivers/sensor/ams/tsl2540/Kconfig index b4d3e1ec51064..697e407d07f29 100644 --- a/drivers/sensor/ams/tsl2540/Kconfig +++ b/drivers/sensor/ams/tsl2540/Kconfig @@ -28,11 +28,13 @@ config TSL2540_TRIGGER_NONE config TSL2540_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_AMS_TSL2540),int-gpios) select TSL2540_TRIGGER config TSL2540_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_AMS_TSL2540),int-gpios) select TSL2540_TRIGGER endchoice diff --git a/drivers/sensor/ams/tsl2591/Kconfig b/drivers/sensor/ams/tsl2591/Kconfig index 4718f577e1222..49445f96b73fd 100644 --- a/drivers/sensor/ams/tsl2591/Kconfig +++ b/drivers/sensor/ams/tsl2591/Kconfig @@ -37,11 +37,13 @@ config TSL2591_TRIGGER_NONE config TSL2591_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_AMS_TSL2591),int-gpios) select TSL2591_TRIGGER config TSL2591_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_AMS_TSL2591),int-gpios) select TSL2591_TRIGGER endchoice diff --git a/drivers/sensor/apds9960/Kconfig b/drivers/sensor/apds9960/Kconfig index 9007137a18354..7c7c6d36aedbe 100644 --- a/drivers/sensor/apds9960/Kconfig +++ b/drivers/sensor/apds9960/Kconfig @@ -24,6 +24,7 @@ config APDS9960_TRIGGER_NONE config APDS9960_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_AVAGO_APDS9960),int-gpios) select APDS9960_TRIGGER endchoice diff --git a/drivers/sensor/bosch/bma280/Kconfig b/drivers/sensor/bosch/bma280/Kconfig index 5e76c4063b00f..05136186e8627 100644 --- a/drivers/sensor/bosch/bma280/Kconfig +++ b/drivers/sensor/bosch/bma280/Kconfig @@ -26,11 +26,13 @@ config BMA280_TRIGGER_NONE config BMA280_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_BOSCH_BMA280),int1-gpios) select BMA280_TRIGGER config BMA280_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_BOSCH_BMA280),int1-gpios) select BMA280_TRIGGER endchoice diff --git a/drivers/sensor/bosch/bmc150_magn/Kconfig b/drivers/sensor/bosch/bmc150_magn/Kconfig index 872386772947b..3752ce40a05ed 100644 --- a/drivers/sensor/bosch/bmc150_magn/Kconfig +++ b/drivers/sensor/bosch/bmc150_magn/Kconfig @@ -56,6 +56,7 @@ endmenu config BMC150_MAGN_TRIGGER bool "Triggers" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_BOSCH_BMC150_MAGN),drdy-gpios) help Enable triggers for BMC150 magnetometer diff --git a/drivers/sensor/bosch/bmg160/Kconfig b/drivers/sensor/bosch/bmg160/Kconfig index 108d2021e7060..bb28fe8475ec4 100644 --- a/drivers/sensor/bosch/bmg160/Kconfig +++ b/drivers/sensor/bosch/bmg160/Kconfig @@ -39,10 +39,14 @@ config BMG160_TRIGGER_NONE config BMG160_TRIGGER_GLOBAL_THREAD bool "Use global thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_BOSCH_BMG160),int-gpios) select BMG160_TRIGGER config BMG160_TRIGGER_OWN_THREAD bool "Use own thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_BOSCH_BMG160),int-gpios) select BMG160_TRIGGER endchoice diff --git a/drivers/sensor/bosch/bmi08x/Kconfig b/drivers/sensor/bosch/bmi08x/Kconfig index dad1abb289679..cbe40bf5c26e5 100644 --- a/drivers/sensor/bosch/bmi08x/Kconfig +++ b/drivers/sensor/bosch/bmi08x/Kconfig @@ -28,10 +28,14 @@ config BMI08X_ACCEL_TRIGGER_NONE config BMI08X_ACCEL_TRIGGER_GLOBAL_THREAD bool "Use global thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_BOSCH_BMI08X_ACCEL),int-gpios) select BMI08X_ACCEL_TRIGGER config BMI08X_ACCEL_TRIGGER_OWN_THREAD bool "Use own thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_BOSCH_BMI08X_ACCEL),int-gpios) select BMI08X_ACCEL_TRIGGER endchoice diff --git a/drivers/sensor/bosch/bmi160/Kconfig b/drivers/sensor/bosch/bmi160/Kconfig index 064a0644e2b3f..9c4e3f55be39b 100644 --- a/drivers/sensor/bosch/bmi160/Kconfig +++ b/drivers/sensor/bosch/bmi160/Kconfig @@ -26,10 +26,14 @@ config BMI160_TRIGGER_NONE config BMI160_TRIGGER_GLOBAL_THREAD bool "Use global thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_BOSCH_BMI160),int-gpios) select BMI160_TRIGGER config BMI160_TRIGGER_OWN_THREAD bool "Use own thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_BOSCH_BMI160),int-gpios) select BMI160_TRIGGER endchoice diff --git a/drivers/sensor/bosch/bmi270/Kconfig b/drivers/sensor/bosch/bmi270/Kconfig index 89ea6fd4503a1..b75d69e619160 100644 --- a/drivers/sensor/bosch/bmi270/Kconfig +++ b/drivers/sensor/bosch/bmi270/Kconfig @@ -36,11 +36,13 @@ config BMI270_TRIGGER_NONE config BMI270_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_BOSCH_BMI270),irq-gpios) select BMI270_TRIGGER config BMI270_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_BOSCH_BMI270),irq-gpios) select BMI270_TRIGGER endchoice diff --git a/drivers/sensor/bosch/bmm150/Kconfig b/drivers/sensor/bosch/bmm150/Kconfig index 93f652eb2b37f..75311c1585c41 100644 --- a/drivers/sensor/bosch/bmm150/Kconfig +++ b/drivers/sensor/bosch/bmm150/Kconfig @@ -44,14 +44,20 @@ config BMM150_TRIGGER_NONE config BMM150_TRIGGER_GLOBAL_THREAD bool "Use global thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_BOSCH_BMM150),drdy-gpios) select BMM150_TRIGGER config BMM150_TRIGGER_OWN_THREAD bool "Use own thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_BOSCH_BMM150),drdy-gpios) select BMM150_TRIGGER config BMM150_TRIGGER_DIRECT bool "Use IRQ handler" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_BOSCH_BMM150),drdy-gpios) select BMM150_TRIGGER endchoice diff --git a/drivers/sensor/bosch/bmp388/Kconfig b/drivers/sensor/bosch/bmp388/Kconfig index c506c8a5b61a4..8143882c80085 100644 --- a/drivers/sensor/bosch/bmp388/Kconfig +++ b/drivers/sensor/bosch/bmp388/Kconfig @@ -25,14 +25,20 @@ config BMP388_TRIGGER_NONE config BMP388_TRIGGER_GLOBAL_THREAD bool "Use global thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_BOSCH_BMP388),int-gpios) select BMP388_TRIGGER config BMP388_TRIGGER_OWN_THREAD bool "Use own thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_BOSCH_BMP388),int-gpios) select BMP388_TRIGGER config BMP388_TRIGGER_DIRECT bool "Use IRQ handler" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_BOSCH_BMP388),int-gpios) select BMP388_TRIGGER endchoice diff --git a/drivers/sensor/ens160/Kconfig b/drivers/sensor/ens160/Kconfig index adeb76eb6d5a8..cb34be94706be 100644 --- a/drivers/sensor/ens160/Kconfig +++ b/drivers/sensor/ens160/Kconfig @@ -24,11 +24,13 @@ config ENS160_TRIGGER_NONE config ENS160_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_SCIOSENSE_ENS160),int-gpios) select ENS160_TRIGGER config ENS160_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_SCIOSENSE_ENS160),int-gpios) select ENS160_TRIGGER endchoice # Trigger Mode diff --git a/drivers/sensor/grow_r502a/Kconfig b/drivers/sensor/grow_r502a/Kconfig index 35297b90b655f..0a3da98db3b9a 100644 --- a/drivers/sensor/grow_r502a/Kconfig +++ b/drivers/sensor/grow_r502a/Kconfig @@ -39,6 +39,7 @@ config GROW_R502A_TRIGGER_GLOBAL_THREAD config GROW_R502A_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_HZGROW_R502A),int-gpios) select GROW_R502A_TRIGGER endchoice diff --git a/drivers/sensor/honeywell/hmc5883l/Kconfig b/drivers/sensor/honeywell/hmc5883l/Kconfig index 3218336bb8c8b..2dfcb57fa1426 100644 --- a/drivers/sensor/honeywell/hmc5883l/Kconfig +++ b/drivers/sensor/honeywell/hmc5883l/Kconfig @@ -23,11 +23,13 @@ config HMC5883L_TRIGGER_NONE config HMC5883L_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_HONEYWELL_HMC5883L),int-gpios) select HMC5883L_TRIGGER config HMC5883L_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_HONEYWELL_HMC5883L),int-gpios) select HMC5883L_TRIGGER endchoice diff --git a/drivers/sensor/jedec/jc42/Kconfig b/drivers/sensor/jedec/jc42/Kconfig index 1e6d08d6349cf..9d133a8fb7505 100644 --- a/drivers/sensor/jedec/jc42/Kconfig +++ b/drivers/sensor/jedec/jc42/Kconfig @@ -23,11 +23,13 @@ config JC42_TRIGGER_NONE config JC42_TRIGGER_GLOBAL_THREAD depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_JEDEC_JC_42_4_TEMP),int-gpios) select JC42_TRIGGER bool "Use global thread" config JC42_TRIGGER_OWN_THREAD depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_JEDEC_JC_42_4_TEMP),int-gpios) select JC42_TRIGGER bool "Use own thread" diff --git a/drivers/sensor/lm77/Kconfig b/drivers/sensor/lm77/Kconfig index 554fe00cdc32f..ca8668b048523 100644 --- a/drivers/sensor/lm77/Kconfig +++ b/drivers/sensor/lm77/Kconfig @@ -16,6 +16,8 @@ menuconfig LM77 config LM77_TRIGGER bool "Trigger support" depends on LM77 + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_LM77),int-gpios) default y help Enable trigger support for the LM77 digital temperature sensor. diff --git a/drivers/sensor/memsic/mc3419/Kconfig b/drivers/sensor/memsic/mc3419/Kconfig index a076e9d82482b..a2759e6270b1f 100644 --- a/drivers/sensor/memsic/mc3419/Kconfig +++ b/drivers/sensor/memsic/mc3419/Kconfig @@ -14,6 +14,8 @@ if MC3419 config MC3419_TRIGGER bool "Trigger mode" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_MEMSIC_MC3419),int-gpios) choice MC3419_TRIGGER_MODE prompt "Trigger mode" diff --git a/drivers/sensor/microchip/tcn75a/Kconfig b/drivers/sensor/microchip/tcn75a/Kconfig index 7a7c37572be4e..7080f89dfc5c9 100644 --- a/drivers/sensor/microchip/tcn75a/Kconfig +++ b/drivers/sensor/microchip/tcn75a/Kconfig @@ -20,10 +20,14 @@ config TCN75A_TRIGGER_NONE config TCN75A_TRIGGER_OWN_THREAD bool "Use own thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_MICROCHIP_TCN75A),alert-gpios) select TCN75A_TRIGGER config TCN75A_TRIGGER_GLOBAL_THREAD bool "Use global thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_MICROCHIP_TCN75A),alert-gpios) select TCN75A_TRIGGER endchoice diff --git a/drivers/sensor/nxp/fxas21002/Kconfig b/drivers/sensor/nxp/fxas21002/Kconfig index 2bc0c847e359b..b92daee2af2d8 100644 --- a/drivers/sensor/nxp/fxas21002/Kconfig +++ b/drivers/sensor/nxp/fxas21002/Kconfig @@ -58,6 +58,9 @@ config FXAS21002_TRIGGER_NONE config FXAS21002_TRIGGER_GLOBAL_THREAD bool "Use global thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_NXP_FXAS21002),int1-gpios) ||\ + $(dt_compat_any_has_prop,$(DT_COMPAT_NXP_FXAS21002),int2-gpios) select FXAS21002_TRIGGER config FXAS21002_TRIGGER_OWN_THREAD diff --git a/drivers/sensor/nxp/fxls8974/Kconfig b/drivers/sensor/nxp/fxls8974/Kconfig index d50fe8787a64c..331626636f4b6 100644 --- a/drivers/sensor/nxp/fxls8974/Kconfig +++ b/drivers/sensor/nxp/fxls8974/Kconfig @@ -23,6 +23,9 @@ config FXLS8974_TRIGGER_NONE config FXLS8974_TRIGGER_GLOBAL_THREAD bool "Use global thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_NXP_FXLS8974),int1-gpios) || \ + $(dt_compat_any_has_prop,$(DT_COMPAT_NXP_FXLS8974),int2-gpios) select FXLS8974_TRIGGER config FXLS8974_TRIGGER_OWN_THREAD diff --git a/drivers/sensor/nxp/fxos8700/Kconfig b/drivers/sensor/nxp/fxos8700/Kconfig index 0920fba1c6051..eda510ff789bf 100644 --- a/drivers/sensor/nxp/fxos8700/Kconfig +++ b/drivers/sensor/nxp/fxos8700/Kconfig @@ -49,6 +49,9 @@ config FXOS8700_TRIGGER_NONE config FXOS8700_TRIGGER_GLOBAL_THREAD bool "Use global thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_NXP_FXOS8700),int1-gpios) ||\ + $(dt_compat_any_has_prop,$(DT_COMPAT_NXP_FXOS8700),int2-gpios) select FXOS8700_TRIGGER config FXOS8700_TRIGGER_OWN_THREAD diff --git a/drivers/sensor/renesas/isl29035/Kconfig b/drivers/sensor/renesas/isl29035/Kconfig index 36ff481302b14..e6f10678c01b9 100644 --- a/drivers/sensor/renesas/isl29035/Kconfig +++ b/drivers/sensor/renesas/isl29035/Kconfig @@ -94,11 +94,13 @@ config ISL29035_TRIGGER_NONE config ISL29035_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ISIL_ISL29035),int-gpios) select ISL29035_TRIGGER config ISL29035_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ISIL_ISL29035),int-gpios) select ISL29035_TRIGGER endchoice diff --git a/drivers/sensor/sensirion/sht3xd/Kconfig b/drivers/sensor/sensirion/sht3xd/Kconfig index b19af19557877..db8cef80fd178 100644 --- a/drivers/sensor/sensirion/sht3xd/Kconfig +++ b/drivers/sensor/sensirion/sht3xd/Kconfig @@ -26,11 +26,13 @@ config SHT3XD_TRIGGER_NONE config SHT3XD_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_SENSIRION_SHT3XD),alert-gpios) select SHT3XD_TRIGGER config SHT3XD_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_SENSIRION_SHT3XD),alert-gpios) select SHT3XD_TRIGGER endchoice diff --git a/drivers/sensor/st/hts221/Kconfig b/drivers/sensor/st/hts221/Kconfig index bb2ce7d848ac7..f34aa186dfa1a 100644 --- a/drivers/sensor/st/hts221/Kconfig +++ b/drivers/sensor/st/hts221/Kconfig @@ -27,11 +27,13 @@ config HTS221_TRIGGER_NONE config HTS221_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_HTS221),drdy-gpios) select HTS221_TRIGGER config HTS221_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_HTS221),drdy-gpios) select HTS221_TRIGGER endchoice # HTS221_TRIGGER_MODE diff --git a/drivers/sensor/st/iis2dh/Kconfig b/drivers/sensor/st/iis2dh/Kconfig index 8e072265b0dbd..9bc12bd3f883c 100644 --- a/drivers/sensor/st/iis2dh/Kconfig +++ b/drivers/sensor/st/iis2dh/Kconfig @@ -28,11 +28,13 @@ config IIS2DH_TRIGGER_NONE config IIS2DH_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_IIS2DH),drdy-gpios) select IIS2DH_TRIGGER config IIS2DH_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_IIS2DH),drdy-gpios) select IIS2DH_TRIGGER endchoice diff --git a/drivers/sensor/st/iis2dlpc/Kconfig b/drivers/sensor/st/iis2dlpc/Kconfig index 2a7daeb4cc6aa..239913285287c 100644 --- a/drivers/sensor/st/iis2dlpc/Kconfig +++ b/drivers/sensor/st/iis2dlpc/Kconfig @@ -28,11 +28,13 @@ config IIS2DLPC_TRIGGER_NONE config IIS2DLPC_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_IIS2DLPC),drdy-gpios) select IIS2DLPC_TRIGGER config IIS2DLPC_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_IIS2DLPC),drdy-gpios) select IIS2DLPC_TRIGGER endchoice diff --git a/drivers/sensor/st/iis2iclx/Kconfig b/drivers/sensor/st/iis2iclx/Kconfig index 8266a60b2f919..18061e79cca2d 100644 --- a/drivers/sensor/st/iis2iclx/Kconfig +++ b/drivers/sensor/st/iis2iclx/Kconfig @@ -29,11 +29,13 @@ config IIS2ICLX_TRIGGER_NONE config IIS2ICLX_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_IIS2ICLX),drdy-gpios) select IIS2ICLX_TRIGGER config IIS2ICLX_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_IIS2ICLX),drdy-gpios) select IIS2ICLX_TRIGGER endchoice diff --git a/drivers/sensor/st/iis2mdc/Kconfig b/drivers/sensor/st/iis2mdc/Kconfig index 1f4817a0a6997..813764e26c76b 100644 --- a/drivers/sensor/st/iis2mdc/Kconfig +++ b/drivers/sensor/st/iis2mdc/Kconfig @@ -27,11 +27,13 @@ config IIS2MDC_TRIGGER_NONE config IIS2MDC_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_IIS2MDC),drdy-gpios) select IIS2MDC_TRIGGER config IIS2MDC_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_IIS2MDC),drdy-gpios) select IIS2MDC_TRIGGER endchoice # IIS2MDC_TRIGGER_MODE diff --git a/drivers/sensor/st/iis3dhhc/Kconfig b/drivers/sensor/st/iis3dhhc/Kconfig index f48e35d81f696..85f9c4d5b99a1 100644 --- a/drivers/sensor/st/iis3dhhc/Kconfig +++ b/drivers/sensor/st/iis3dhhc/Kconfig @@ -28,11 +28,13 @@ config IIS3DHHC_TRIGGER_NONE config IIS3DHHC_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_IIS3DHHC),irq-gpios) select IIS3DHHC_TRIGGER config IIS3DHHC_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_IIS3DHHC),irq-gpios) select IIS3DHHC_TRIGGER endchoice # IIS3DHHC_TRIGGER_MODE diff --git a/drivers/sensor/st/ism330dhcx/Kconfig b/drivers/sensor/st/ism330dhcx/Kconfig index f5a6b7d891b74..2951f39435092 100644 --- a/drivers/sensor/st/ism330dhcx/Kconfig +++ b/drivers/sensor/st/ism330dhcx/Kconfig @@ -29,11 +29,13 @@ config ISM330DHCX_TRIGGER_NONE config ISM330DHCX_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_ISM330DHCX),drdy-gpios) select ISM330DHCX_TRIGGER config ISM330DHCX_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_ISM330DHCX),drdy-gpios) select ISM330DHCX_TRIGGER endchoice diff --git a/drivers/sensor/st/lis2dh/Kconfig b/drivers/sensor/st/lis2dh/Kconfig index 893c701fa41c5..dbc963d1141f9 100644 --- a/drivers/sensor/st/lis2dh/Kconfig +++ b/drivers/sensor/st/lis2dh/Kconfig @@ -26,11 +26,13 @@ config LIS2DH_TRIGGER_NONE config LIS2DH_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LIS2DH),irq-gpios) select LIS2DH_TRIGGER config LIS2DH_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LIS2DH),irq-gpios) select LIS2DH_TRIGGER endchoice diff --git a/drivers/sensor/st/lis2ds12/Kconfig b/drivers/sensor/st/lis2ds12/Kconfig index cc8331bdf5edd..c944afeb887cf 100644 --- a/drivers/sensor/st/lis2ds12/Kconfig +++ b/drivers/sensor/st/lis2ds12/Kconfig @@ -28,11 +28,13 @@ config LIS2DS12_TRIGGER_NONE config LIS2DS12_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LIS2DS12),irq-gpios) select LIS2DS12_TRIGGER config LIS2DS12_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LIS2DS12),irq-gpios) select LIS2DS12_TRIGGER endchoice diff --git a/drivers/sensor/st/lis2dw12/Kconfig b/drivers/sensor/st/lis2dw12/Kconfig index d2ccde49fed0c..5197b7c9e9690 100644 --- a/drivers/sensor/st/lis2dw12/Kconfig +++ b/drivers/sensor/st/lis2dw12/Kconfig @@ -28,11 +28,13 @@ config LIS2DW12_TRIGGER_NONE config LIS2DW12_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LIS2DW12),irq-gpios) select LIS2DW12_TRIGGER config LIS2DW12_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LIS2DW12),irq-gpios) select LIS2DW12_TRIGGER endchoice diff --git a/drivers/sensor/st/lis2mdl/Kconfig b/drivers/sensor/st/lis2mdl/Kconfig index 637b883b26e2f..6fb8b9ac4280f 100644 --- a/drivers/sensor/st/lis2mdl/Kconfig +++ b/drivers/sensor/st/lis2mdl/Kconfig @@ -27,11 +27,13 @@ config LIS2MDL_TRIGGER_NONE config LIS2MDL_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LIS2MDL),irq-gpios) select LIS2MDL_TRIGGER config LIS2MDL_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LIS2MDL),irq-gpios) select LIS2MDL_TRIGGER endchoice # LIS2MDL_TRIGGER_MODE diff --git a/drivers/sensor/st/lis3mdl/Kconfig b/drivers/sensor/st/lis3mdl/Kconfig index e7f504b33bca5..0d6a7c122833a 100644 --- a/drivers/sensor/st/lis3mdl/Kconfig +++ b/drivers/sensor/st/lis3mdl/Kconfig @@ -23,11 +23,13 @@ config LIS3MDL_TRIGGER_NONE config LIS3MDL_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LIS3MDL_MAGN),irq-gpios) select LIS3MDL_TRIGGER config LIS3MDL_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LIS3MDL_MAGN),irq-gpios) select LIS3MDL_TRIGGER endchoice # LIS3MDL_TRIGGER_MODE diff --git a/drivers/sensor/st/lps22hh/Kconfig b/drivers/sensor/st/lps22hh/Kconfig index 2fa57a6c48582..07b8f8ceec520 100644 --- a/drivers/sensor/st/lps22hh/Kconfig +++ b/drivers/sensor/st/lps22hh/Kconfig @@ -31,11 +31,13 @@ config LPS22HH_TRIGGER_NONE config LPS22HH_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LPS22HH),drdy-gpios) select LPS22HH_TRIGGER config LPS22HH_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LPS22HH),drdy-gpios) select LPS22HH_TRIGGER endchoice # LPS22HH_TRIGGER_MODE diff --git a/drivers/sensor/st/lps2xdf/Kconfig b/drivers/sensor/st/lps2xdf/Kconfig index 754f8c3b4511f..e00e788497a5c 100644 --- a/drivers/sensor/st/lps2xdf/Kconfig +++ b/drivers/sensor/st/lps2xdf/Kconfig @@ -35,6 +35,8 @@ config LPS2XDF_TRIGGER_NONE config LPS2XDF_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LPS22DF),drdy-gpios) ||\ + $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LPS28DFW),drdy-gpios) select LPS2XDF_TRIGGER config LPS2XDF_TRIGGER_OWN_THREAD diff --git a/drivers/sensor/st/lsm6dsl/Kconfig b/drivers/sensor/st/lsm6dsl/Kconfig index c21937cf9226f..8b7dbf5e92d9a 100644 --- a/drivers/sensor/st/lsm6dsl/Kconfig +++ b/drivers/sensor/st/lsm6dsl/Kconfig @@ -27,11 +27,13 @@ config LSM6DSL_TRIGGER_NONE config LSM6DSL_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LSM6DSL),irq-gpios) select LSM6DSL_TRIGGER config LSM6DSL_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LSM6DSL),irq-gpios) select LSM6DSL_TRIGGER endchoice diff --git a/drivers/sensor/st/lsm6dso/Kconfig b/drivers/sensor/st/lsm6dso/Kconfig index 272deb6be950b..aa0f189033034 100644 --- a/drivers/sensor/st/lsm6dso/Kconfig +++ b/drivers/sensor/st/lsm6dso/Kconfig @@ -29,6 +29,7 @@ config LSM6DSO_TRIGGER_NONE config LSM6DSO_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LSM6DSO),irq-gpios) select LSM6DSO_TRIGGER config LSM6DSO_TRIGGER_OWN_THREAD diff --git a/drivers/sensor/st/lsm6dso16is/Kconfig b/drivers/sensor/st/lsm6dso16is/Kconfig index 7994d6a782f6c..74d90671e6adb 100644 --- a/drivers/sensor/st/lsm6dso16is/Kconfig +++ b/drivers/sensor/st/lsm6dso16is/Kconfig @@ -29,11 +29,13 @@ config LSM6DSO16IS_TRIGGER_NONE config LSM6DSO16IS_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LSM6DSO16IS),irq-gpios) select LSM6DSO16IS_TRIGGER config LSM6DSO16IS_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LSM6DSO16IS),irq-gpios) select LSM6DSO16IS_TRIGGER endchoice diff --git a/drivers/sensor/st/lsm6dsv16x/Kconfig b/drivers/sensor/st/lsm6dsv16x/Kconfig index 79463a0f4e8ec..d4f4ec6ffeb92 100644 --- a/drivers/sensor/st/lsm6dsv16x/Kconfig +++ b/drivers/sensor/st/lsm6dsv16x/Kconfig @@ -29,11 +29,15 @@ config LSM6DSV16X_TRIGGER_NONE config LSM6DSV16X_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LSM6DSV16X),int1-gpios) ||\ + $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LSM6DSV16X),int2-gpios) select LSM6DSV16X_TRIGGER config LSM6DSV16X_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LSM6DSV16X),int1-gpios) ||\ + $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LSM6DSV16X),int2-gpios) select LSM6DSV16X_TRIGGER endchoice diff --git a/drivers/sensor/st/lsm9ds0_gyro/Kconfig b/drivers/sensor/st/lsm9ds0_gyro/Kconfig index 46d2d931ab795..4bf78dbe15922 100644 --- a/drivers/sensor/st/lsm9ds0_gyro/Kconfig +++ b/drivers/sensor/st/lsm9ds0_gyro/Kconfig @@ -67,6 +67,7 @@ endmenu config LSM9DS0_GYRO_TRIGGERS bool "Triggers" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_LSM9DS0_GYRO),irq-gpios) config LSM9DS0_GYRO_THREAD_STACK_SIZE int "Thread stack size" diff --git a/drivers/sensor/st/stts751/Kconfig b/drivers/sensor/st/stts751/Kconfig index d4bb8eeb7001c..b424c09ee6fc7 100644 --- a/drivers/sensor/st/stts751/Kconfig +++ b/drivers/sensor/st/stts751/Kconfig @@ -28,11 +28,13 @@ config STTS751_TRIGGER_NONE config STTS751_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_STTS751),drdy-gpios) select STTS751_TRIGGER config STTS751_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_ST_STTS751),drdy-gpios) select STTS751_TRIGGER endchoice # STTS751_TRIGGER_MODE diff --git a/drivers/sensor/sx9500/Kconfig b/drivers/sensor/sx9500/Kconfig index 2e1363a58e026..ad300f841e0dd 100644 --- a/drivers/sensor/sx9500/Kconfig +++ b/drivers/sensor/sx9500/Kconfig @@ -29,11 +29,13 @@ config SX9500_TRIGGER_NONE config SX9500_TRIGGER_GLOBAL_THREAD depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_SEMTECH_SX9500),int-gpios) select SX9500_TRIGGER bool "Use global thread" config SX9500_TRIGGER_OWN_THREAD depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_SEMTECH_SX9500),int-gpios) select SX9500_TRIGGER bool "Use own thread" diff --git a/drivers/sensor/tdk/icm42605/Kconfig b/drivers/sensor/tdk/icm42605/Kconfig index 961967de8c561..1c2c7ad5d5af5 100644 --- a/drivers/sensor/tdk/icm42605/Kconfig +++ b/drivers/sensor/tdk/icm42605/Kconfig @@ -25,6 +25,7 @@ config ICM42605_TRIGGER_NONE config ICM42605_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_INVENSENSE_ICM42605),int-gpios) select ICM42605_TRIGGER endchoice diff --git a/drivers/sensor/tdk/icm42670/Kconfig b/drivers/sensor/tdk/icm42670/Kconfig index 40c2b4f01a092..bd16320c472da 100644 --- a/drivers/sensor/tdk/icm42670/Kconfig +++ b/drivers/sensor/tdk/icm42670/Kconfig @@ -28,11 +28,13 @@ config ICM42670_TRIGGER_NONE config ICM42670_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_INVENSENSE_ICM42670),int-gpios) select ICM42670_TRIGGER config ICM42670_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_INVENSENSE_ICM42670),int-gpios) select ICM42670_TRIGGER endchoice diff --git a/drivers/sensor/tdk/icm42688/Kconfig b/drivers/sensor/tdk/icm42688/Kconfig index 413b199c1eabc..975c8e1825f6b 100644 --- a/drivers/sensor/tdk/icm42688/Kconfig +++ b/drivers/sensor/tdk/icm42688/Kconfig @@ -44,10 +44,14 @@ config ICM42688_TRIGGER_NONE config ICM42688_TRIGGER_GLOBAL_THREAD bool "Use global thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_INVENSENSE_ICM42688),int-gpios) select ICM42688_TRIGGER config ICM42688_TRIGGER_OWN_THREAD bool "Use own thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_INVENSENSE_ICM42688),int-gpios) select ICM42688_TRIGGER endchoice diff --git a/drivers/sensor/tdk/mpu6050/Kconfig b/drivers/sensor/tdk/mpu6050/Kconfig index 8fc3aec67ecfd..de42afe611faa 100644 --- a/drivers/sensor/tdk/mpu6050/Kconfig +++ b/drivers/sensor/tdk/mpu6050/Kconfig @@ -25,11 +25,13 @@ config MPU6050_TRIGGER_NONE config MPU6050_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_INVENSENSE_MPU6050),int-gpios) select MPU6050_TRIGGER config MPU6050_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_INVENSENSE_MPU6050),int-gpios) select MPU6050_TRIGGER endchoice diff --git a/drivers/sensor/tdk/mpu9250/Kconfig b/drivers/sensor/tdk/mpu9250/Kconfig index a7cf942bed1b2..96285f1d53887 100644 --- a/drivers/sensor/tdk/mpu9250/Kconfig +++ b/drivers/sensor/tdk/mpu9250/Kconfig @@ -25,11 +25,13 @@ config MPU9250_TRIGGER_NONE config MPU9250_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_INVENSENSE_MPU9250),irq-gpios) select MPU9250_TRIGGER config MPU9250_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_INVENSENSE_MPU9250),irq-gpios) select MPU9250_TRIGGER endchoice diff --git a/drivers/sensor/ti/bq274xx/Kconfig b/drivers/sensor/ti/bq274xx/Kconfig index f718be36bcc1a..c63afb7196aa3 100644 --- a/drivers/sensor/ti/bq274xx/Kconfig +++ b/drivers/sensor/ti/bq274xx/Kconfig @@ -33,10 +33,14 @@ config BQ274XX_TRIGGER_NONE config BQ274XX_TRIGGER_GLOBAL_THREAD bool "Use global thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_TI_BQ274XX),int-gpios) select BQ274XX_TRIGGER config BQ274XX_TRIGGER_OWN_THREAD bool "Use own thread" + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_TI_BQ274XX),int-gpios) select BQ274XX_TRIGGER endchoice # BQ274XX_TRIGGER_MODE diff --git a/drivers/sensor/ti/fdc2x1x/Kconfig b/drivers/sensor/ti/fdc2x1x/Kconfig index 2d6ac596bf324..03d0e113c57db 100644 --- a/drivers/sensor/ti/fdc2x1x/Kconfig +++ b/drivers/sensor/ti/fdc2x1x/Kconfig @@ -26,11 +26,13 @@ config FDC2X1X_TRIGGER_NONE config FDC2X1X_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_TI_FDC2X1X),intb-gpios) select FDC2X1X_TRIGGER config FDC2X1X_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_TI_FDC2X1X),intb-gpios) select FDC2X1X_TRIGGER endchoice diff --git a/drivers/sensor/ti/ina23x/Kconfig b/drivers/sensor/ti/ina23x/Kconfig index 178d7076c81c2..f062da4e2906f 100644 --- a/drivers/sensor/ti/ina23x/Kconfig +++ b/drivers/sensor/ti/ina23x/Kconfig @@ -43,6 +43,8 @@ config INA237_VSHUNT config INA230_TRIGGER bool "INA230 trigger mode" depends on INA230 + depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_TI_INA230),alert-gpios) help Set to enable trigger mode using gpio interrupt, where interrupts are configured to line ALERT PIN. diff --git a/drivers/sensor/ti/tmag5170/Kconfig b/drivers/sensor/ti/tmag5170/Kconfig index 592b238244892..51b8792cf52dd 100644 --- a/drivers/sensor/ti/tmag5170/Kconfig +++ b/drivers/sensor/ti/tmag5170/Kconfig @@ -24,16 +24,19 @@ config TMAG5170_TRIGGER_NONE config TMAG5170_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_TI_TMAG5170),int-gpios) select TMAG5170_TRIGGER config TMAG5170_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_TI_TMAG5170),int-gpios) select TMAG5170_TRIGGER config TMAG5170_TRIGGER_DIRECT bool "Process trigger within interrupt context" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_TI_TMAG5170),int-gpios) select TMAG5170_TRIGGER endchoice diff --git a/drivers/sensor/ti/tmp007/Kconfig b/drivers/sensor/ti/tmp007/Kconfig index 0588215692e50..cc76422eff9cb 100644 --- a/drivers/sensor/ti/tmp007/Kconfig +++ b/drivers/sensor/ti/tmp007/Kconfig @@ -25,11 +25,13 @@ config TMP007_TRIGGER_NONE config TMP007_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_TI_TMP007),int-gpios) select TMP007_TRIGGER config TMP007_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_TI_TMP007),int-gpios) select TMP007_TRIGGER endchoice diff --git a/drivers/sensor/vishay/vcnl4040/Kconfig b/drivers/sensor/vishay/vcnl4040/Kconfig index a4e6be8d715bf..bbae4b27a70e3 100644 --- a/drivers/sensor/vishay/vcnl4040/Kconfig +++ b/drivers/sensor/vishay/vcnl4040/Kconfig @@ -33,11 +33,13 @@ config VCNL4040_TRIGGER_NONE config VCNL4040_TRIGGER_GLOBAL_THREAD bool "Use global thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_VISHAY_VCNL4040),int-gpios) select VCNL4040_TRIGGER config VCNL4040_TRIGGER_OWN_THREAD bool "Use own thread" depends on GPIO + depends on $(dt_compat_any_has_prop,$(DT_COMPAT_VISHAY_VCNL4040),int-gpios) select VCNL4040_TRIGGER endchoice From 9e455294386820fc3678725040acccde8b4acd46 Mon Sep 17 00:00:00 2001 From: Luis Ubieda Date: Mon, 30 Sep 2024 17:15:36 -0400 Subject: [PATCH 1305/4482] tests: build_all: sensor: Add int-gpios to ICM42688 Required to use trigger modes. Signed-off-by: Luis Ubieda --- tests/drivers/build_all/sensor/spi.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/drivers/build_all/sensor/spi.dtsi b/tests/drivers/build_all/sensor/spi.dtsi index 40b861a5f4fae..a3dd43713e4c1 100644 --- a/tests/drivers/build_all/sensor/spi.dtsi +++ b/tests/drivers/build_all/sensor/spi.dtsi @@ -199,6 +199,7 @@ test_spi_icm426888: icm42688@1a { compatible = "invensense,icm42688"; reg = <0x1a>; spi-max-frequency = <24000000>; + int-gpios = <&test_gpio 0 0>; }; test_spi_max31855: max31855@1b { From ca822d4e4b4541d519b158006723d38c1c0d03ab Mon Sep 17 00:00:00 2001 From: Luis Ubieda Date: Mon, 30 Sep 2024 17:28:09 -0400 Subject: [PATCH 1306/4482] sensor: lm77: Add LM77 config as a subset of the main symbol Following pattern used in other Kconfigs. This also addresses the CI failure on previous run. Signed-off-by: Luis Ubieda --- drivers/sensor/lm77/Kconfig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/sensor/lm77/Kconfig b/drivers/sensor/lm77/Kconfig index ca8668b048523..96ac369dc833a 100644 --- a/drivers/sensor/lm77/Kconfig +++ b/drivers/sensor/lm77/Kconfig @@ -3,7 +3,7 @@ # Copyright (c) 2021 Vestas Wind Systems A/S # SPDX-License-Identifier: Apache-2.0 -menuconfig LM77 +config LM77 bool "LM77 Temperature Sensor" default y depends on DT_HAS_LM77_ENABLED @@ -13,9 +13,10 @@ menuconfig LM77 Enable driver for the LM77 digital temperature sensor with 2-wire interface. +if LM77 + config LM77_TRIGGER bool "Trigger support" - depends on LM77 depends on GPIO depends on $(dt_compat_any_has_prop,$(DT_COMPAT_LM77),int-gpios) default y @@ -41,3 +42,4 @@ config LM77_TRIGGER_THREAD_PRIO Priority level for the internal trigger workqueue thread. endif # LM77_TRIGGER +endif # LM77 From 0575c1a9760ec2585d4967e3102552820ffc8d81 Mon Sep 17 00:00:00 2001 From: Jerzy Kasenberg Date: Fri, 27 Sep 2024 14:57:11 +0200 Subject: [PATCH 1307/4482] drivers: dma: smartbond: Fix power policy handling Function dma_smartbond_set_channel_status() used incorrect condition to release state lock. In initialization function dma_smartbond_init() function dma_smartbond_set_channel_status() was called for each DMA channel and tried to release lock that was never taken. Signed-off-by: Jerzy Kasenberg --- drivers/dma/dma_smartbond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/dma_smartbond.c b/drivers/dma/dma_smartbond.c index c7ab72dfe34e2..a360933dd862b 100644 --- a/drivers/dma/dma_smartbond.c +++ b/drivers/dma/dma_smartbond.c @@ -230,7 +230,7 @@ static void dma_smartbond_set_channel_status(const struct device *dev, DMA->DMA_CLEAR_INT_REG |= BIT(channel); /* DMA interrupts should be disabled only if all channels are disabled. */ - if (!dma_smartbond_is_dma_active()) { + if (!dma_smartbond_is_dma_active() && irq_is_enabled(SMARTBOND_IRQN)) { irq_disable(SMARTBOND_IRQN); /* Allow entering sleep once all DMA channels are inactive */ dma_smartbond_pm_policy_state_lock_put(); From d5a008dd3b70e92882d7c9f71a5987fdd0df0e23 Mon Sep 17 00:00:00 2001 From: Jerzy Kasenberg Date: Fri, 27 Sep 2024 13:11:08 +0200 Subject: [PATCH 1308/4482] drivers: usb: udc: add Smartbond UDC driver Code adds Smartbond UDC driver to be used with USB next stack. Signed-off-by: Jerzy Kasenberg --- drivers/usb/udc/CMakeLists.txt | 1 + drivers/usb/udc/Kconfig | 1 + drivers/usb/udc/Kconfig.smartbond | 10 + drivers/usb/udc/udc_smartbond.c | 1780 ++++++++++++++++++ dts/arm/renesas/smartbond/da1469x.dtsi | 2 + dts/bindings/usb/renesas,smartbond-usbd.yaml | 2 +- 6 files changed, 1795 insertions(+), 1 deletion(-) create mode 100644 drivers/usb/udc/Kconfig.smartbond create mode 100644 drivers/usb/udc/udc_smartbond.c diff --git a/drivers/usb/udc/CMakeLists.txt b/drivers/usb/udc/CMakeLists.txt index afadbe8786c92..488269af99a0a 100644 --- a/drivers/usb/udc/CMakeLists.txt +++ b/drivers/usb/udc/CMakeLists.txt @@ -11,6 +11,7 @@ zephyr_library_sources_ifdef(CONFIG_UDC_NRF udc_nrf.c) zephyr_library_sources_ifdef(CONFIG_UDC_KINETIS udc_kinetis.c) zephyr_library_sources_ifdef(CONFIG_UDC_SKELETON udc_skeleton.c) zephyr_library_sources_ifdef(CONFIG_UDC_VIRTUAL udc_virtual.c) +zephyr_library_sources_ifdef(CONFIG_UDC_SMARTBOND udc_smartbond.c) zephyr_library_sources_ifdef(CONFIG_UDC_STM32 udc_stm32.c) zephyr_library_sources_ifdef(CONFIG_UDC_IT82XX2 udc_it82xx2.c) zephyr_library_sources_ifdef(CONFIG_UDC_NXP_EHCI udc_mcux_ehci.c) diff --git a/drivers/usb/udc/Kconfig b/drivers/usb/udc/Kconfig index 4c96fccf71abe..39fcf3e4c950b 100644 --- a/drivers/usb/udc/Kconfig +++ b/drivers/usb/udc/Kconfig @@ -59,6 +59,7 @@ source "drivers/usb/udc/Kconfig.nrf" source "drivers/usb/udc/Kconfig.kinetis" source "drivers/usb/udc/Kconfig.skeleton" source "drivers/usb/udc/Kconfig.virtual" +source "drivers/usb/udc/Kconfig.smartbond" source "drivers/usb/udc/Kconfig.stm32" source "drivers/usb/udc/Kconfig.it82xx2" source "drivers/usb/udc/Kconfig.mcux" diff --git a/drivers/usb/udc/Kconfig.smartbond b/drivers/usb/udc/Kconfig.smartbond new file mode 100644 index 0000000000000..3e7d530d057d0 --- /dev/null +++ b/drivers/usb/udc/Kconfig.smartbond @@ -0,0 +1,10 @@ +# Copyright (c) 2024 Renesas Electronics Corporation +# SPDX-License-Identifier: Apache-2.0 + +config UDC_SMARTBOND + bool "Smartbond USB device controller driver" + default y + depends on DT_HAS_RENESAS_SMARTBOND_USBD_ENABLED + select DMA + help + Smartbond USB device controller driver. diff --git a/drivers/usb/udc/udc_smartbond.c b/drivers/usb/udc/udc_smartbond.c new file mode 100644 index 0000000000000..3a214e1b60f29 --- /dev/null +++ b/drivers/usb/udc/udc_smartbond.c @@ -0,0 +1,1780 @@ +/* + * Copyright (c) 2024 Renesas Electronics Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * Driver for the Smartbond USB device controller. + */ + +#include + +#include "udc_common.h" + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +LOG_MODULE_REGISTER(udc_smartbond, CONFIG_UDC_DRIVER_LOG_LEVEL); + +/* Size of hardware RX and TX FIFO. */ +#define EP0_FIFO_SIZE 8 +#define EP_FIFO_SIZE 64 + +/* + * DA146xx register fields and bit mask are very long. Filed masks repeat register names. + * Those convenience macros are a way to reduce complexity of register modification lines. + */ +#define GET_BIT(val, field) (val & field##_Msk) >> field##_Pos +#define REG_GET_BIT(reg, field) (USB->reg & USB_##reg##_##field##_Msk) +#define REG_SET_BIT(reg, field) (USB->reg |= USB_##reg##_##field##_Msk) +#define REG_CLR_BIT(reg, field) (USB->reg &= ~USB_##reg##_##field##_Msk) +#define REG_SET_VAL(reg, field, val) \ + (USB->reg = (USB->reg & ~USB_##reg##_##field##_Msk) | (val << USB_##reg##_##field##_Pos)) + +struct usb_smartbond_dma_config { + int tx_chan; + int rx_chan; + uint8_t tx_slot_mux; + uint8_t rx_slot_mux; + const struct device *tx_dev; + const struct device *rx_dev; +}; + +struct udc_smartbond_config { + IRQn_Type udc_irq; + IRQn_Type vbus_irq; + uint8_t fifo_read_threshold; + uint8_t num_of_eps; + uint16_t dma_min_transfer_size; + struct usb_smartbond_dma_config dma_cfg; +}; + +/* Node functional states */ +#define NFSR_NODE_RESET 0 +#define NFSR_NODE_RESUME 1 +#define NFSR_NODE_OPERATIONAL 2 +#define NFSR_NODE_SUSPEND 3 +/* + * Those two following states are added to allow going out of sleep mode + * using frame interrupt. On remove wakeup RESUME state must be kept for + * at least 1ms. It is accomplished by using FRAME interrupt that goes + * through those two fake states before entering OPERATIONAL state. + */ +#define NFSR_NODE_WAKING (0x10 | (NFSR_NODE_RESUME)) +#define NFSR_NODE_WAKING2 (0x20 | (NFSR_NODE_RESUME)) + +struct smartbond_ep_reg_set { + volatile uint32_t epc_in; + volatile uint32_t txd; + volatile uint32_t txs; + volatile uint32_t txc; + volatile uint32_t epc_out; + volatile uint32_t rxd; + volatile uint32_t rxs; + volatile uint32_t rxc; +}; + +struct smartbond_ep_state { + struct udc_ep_config config; + struct smartbond_ep_reg_set *regs; + struct net_buf *buf; + /** Packet size sent or received so far. It is used to modify transferred field + * after ACK is received or when filling ISO endpoint with size larger then + * FIFO size. + */ + uint16_t last_packet_size; + uint8_t iso: 1; /** ISO endpoint */ +}; + +struct usb_smartbond_dma_data { + struct dma_config tx_cfg; + struct dma_config rx_cfg; + struct dma_block_config tx_block_cfg; + struct dma_block_config rx_block_cfg; +}; + +struct usb_smartbond_data { + struct udc_data udc_data; + struct usb_smartbond_dma_data dma_data; + const struct device *dev; + struct k_work ep0_setup_work; + struct k_work ep0_tx_work; + struct k_work ep0_rx_work; + uint8_t setup_buffer[8]; + bool vbus_present; + bool attached; + atomic_t clk_requested; + uint8_t nfsr; + struct smartbond_ep_state ep_state[2][4]; + atomic_ptr_t dma_ep[2]; /** DMA used by channel */ +}; + +#define EP0_OUT_STATE(data) (&data->ep_state[0][0]) +#define EP0_IN_STATE(data) (&data->ep_state[1][0]) + +static int usb_smartbond_dma_config(struct usb_smartbond_data *data) +{ + const struct udc_smartbond_config *config = data->dev->config; + const struct usb_smartbond_dma_config *dma_cfg = &config->dma_cfg; + struct dma_config *tx = &data->dma_data.tx_cfg; + struct dma_config *rx = &data->dma_data.rx_cfg; + struct dma_block_config *tx_block = &data->dma_data.tx_block_cfg; + struct dma_block_config *rx_block = &data->dma_data.rx_block_cfg; + + if (dma_request_channel(dma_cfg->rx_dev, (void *)&dma_cfg->rx_chan) < 0) { + LOG_ERR("RX DMA channel is already occupied"); + return -EIO; + } + + if (dma_request_channel(dma_cfg->tx_dev, (void *)&dma_cfg->tx_chan) < 0) { + LOG_ERR("TX DMA channel is already occupied"); + return -EIO; + } + + tx->channel_direction = MEMORY_TO_PERIPHERAL; + tx->dma_callback = NULL; + tx->user_data = NULL; + tx->block_count = 1; + tx->head_block = tx_block; + + tx->error_callback_dis = 1; + /* DMA callback is not used */ + tx->complete_callback_en = 1; + + tx->dma_slot = dma_cfg->tx_slot_mux; + tx->channel_priority = 7; + + /* Burst mode is not using when DREQ is one */ + tx->source_burst_length = 1; + tx->dest_burst_length = 1; + /* USB is byte-oriented protocol */ + tx->source_data_size = 1; + tx->dest_data_size = 1; + + /* Do not change */ + tx_block->dest_addr_adj = 0x2; + /* Incremental */ + tx_block->source_addr_adj = 0x0; + + /* Should reflect TX buffer */ + tx_block->source_address = 0; + /* Should reflect USB TX FIFO. Temporarily assign an SRAM location. */ + tx_block->dest_address = MCU_SYSRAM_M_BASE; + /* Should reflect total bytes to be transmitted */ + tx_block->block_size = 0; + + rx->channel_direction = PERIPHERAL_TO_MEMORY; + rx->dma_callback = NULL; + rx->user_data = NULL; + rx->block_count = 1; + rx->head_block = rx_block; + + rx->error_callback_dis = 1; + /* DMA callback is not used */ + rx->complete_callback_en = 1; + + rx->dma_slot = dma_cfg->rx_slot_mux; + rx->channel_priority = 2; + + /* Burst mode is not using when DREQ is one */ + rx->source_burst_length = 1; + rx->dest_burst_length = 1; + /* USB is byte-oriented protocol */ + rx->source_data_size = 1; + rx->dest_data_size = 1; + + /* Do not change */ + rx_block->source_addr_adj = 0x2; + /* Incremental */ + rx_block->dest_addr_adj = 0x0; + + /* Should reflect USB RX FIFO */ + rx_block->source_address = 0; + /* Should reflect RX buffer. Temporarily assign an SRAM location. */ + rx_block->dest_address = MCU_SYSRAM_M_BASE; + /* Should reflect total bytes to be received */ + rx_block->block_size = 0; + + if (dma_config(dma_cfg->rx_dev, dma_cfg->rx_chan, rx) < 0) { + LOG_ERR("RX DMA configuration failed"); + return -EINVAL; + } + + if (dma_config(dma_cfg->tx_dev, dma_cfg->tx_chan, tx) < 0) { + LOG_ERR("TX DMA configuration failed"); + return -EINVAL; + } + + return 0; +} + +static void usb_smartbond_dma_deconfig(struct usb_smartbond_data *data) +{ + const struct udc_smartbond_config *config = data->dev->config; + const struct usb_smartbond_dma_config *dma_cfg = &config->dma_cfg; + + dma_stop(dma_cfg->tx_dev, dma_cfg->tx_chan); + dma_stop(dma_cfg->rx_dev, dma_cfg->rx_chan); + + dma_release_channel(dma_cfg->tx_dev, dma_cfg->tx_chan); + dma_release_channel(dma_cfg->rx_dev, dma_cfg->rx_chan); +} + +static struct smartbond_ep_state *usb_dc_get_ep_state(struct usb_smartbond_data *data, uint8_t ep) +{ + const struct udc_smartbond_config *config = data->dev->config; + + uint8_t ep_idx = USB_EP_GET_IDX(ep); + uint8_t ep_dir = USB_EP_GET_DIR(ep) ? 1 : 0; + + return (ep_idx < config->num_of_eps) ? &data->ep_state[ep_dir][ep_idx] : NULL; +} + +static struct smartbond_ep_state *usb_dc_get_ep_out_state(struct usb_smartbond_data *data, + uint8_t ep_idx) +{ + const struct udc_smartbond_config *config = data->dev->config; + + return ep_idx < config->num_of_eps ? &data->ep_state[0][ep_idx] : NULL; +} + +static struct smartbond_ep_state *usb_dc_get_ep_in_state(struct usb_smartbond_data *data, + uint8_t ep_idx) +{ + const struct udc_smartbond_config *config = data->dev->config; + + return ep_idx < config->num_of_eps ? &data->ep_state[1][ep_idx] : NULL; +} + +static void set_nfsr(struct usb_smartbond_data *data, uint8_t val) +{ + data->nfsr = val; + /* + * Write only lower 2 bits to register, higher bits are used + * to count down till OPERATIONAL state can be entered when + * remote wakeup activated. + */ + USB->USB_NFSR_REG = val & 3; +} + +static void fill_tx_fifo(struct smartbond_ep_state *ep_state) +{ + int remaining; + const uint8_t *src; + struct smartbond_ep_reg_set *regs = ep_state->regs; + struct net_buf *buf = ep_state->buf; + const struct udc_ep_config *const ep_cfg = &ep_state->config; + const uint16_t mps = udc_mps_ep_size(ep_cfg); + const uint8_t ep_idx = USB_EP_GET_IDX(ep_cfg->addr); + + src = buf->data; + remaining = buf->len; + if (remaining > mps - ep_state->last_packet_size) { + remaining = mps - ep_state->last_packet_size; + } + + /* + * Loop checks TCOUNT all the time since this value is saturated to 31 + * and can't be read just once before. + */ + while ((regs->txs & USB_USB_TXS1_REG_USB_TCOUNT_Msk) > 0 && remaining > 0) { + regs->txd = *src++; + ep_state->last_packet_size++; + remaining--; + } + + /* + * Setup FIFO level warning in case whole packet could not be placed + * in FIFO at once. This case only applies to ISO endpoints with packet + * size grater then 64. All other packets will fit in corresponding + * FIFO and there is no need for enabling FIFO level interrupt. + */ + if (ep_idx == 0 || ep_cfg->mps <= EP_FIFO_SIZE) { + return; + } + + if (remaining > 0) { + /* + * Max packet size is set to value greater then FIFO. + * Enable fifo level warning to handle larger packets. + */ + regs->txc |= (3 << USB_USB_TXC1_REG_USB_TFWL_Pos); + USB->USB_FWMSK_REG |= BIT(ep_idx - 1 + USB_USB_FWMSK_REG_USB_M_TXWARN31_Pos); + } else { + regs->txc &= ~USB_USB_TXC1_REG_USB_TFWL_Msk; + USB->USB_FWMSK_REG &= ~(BIT(ep_idx - 1 + USB_USB_FWMSK_REG_USB_M_TXWARN31_Pos)); + /* Whole packet already in fifo, no need to + * refill it later. Mark last. + */ + regs->txc |= USB_USB_TXC1_REG_USB_LAST_Msk; + } +} + +static bool try_allocate_dma(struct usb_smartbond_data *data, struct smartbond_ep_state *ep_state) +{ + struct udc_ep_config *const ep_cfg = &ep_state->config; + const uint8_t ep = ep_cfg->addr; + uint8_t ep_idx = USB_EP_GET_IDX(ep); + uint8_t dir_ix = USB_EP_DIR_IS_OUT(ep) ? 0 : 1; + + if (atomic_ptr_cas(&data->dma_ep[dir_ix], NULL, ep_state)) { + if (dir_ix == 0) { + USB->USB_DMA_CTRL_REG = + (USB->USB_DMA_CTRL_REG & ~USB_USB_DMA_CTRL_REG_USB_DMA_RX_Msk) | + ((ep_idx - 1) << USB_USB_DMA_CTRL_REG_USB_DMA_RX_Pos); + } else { + USB->USB_DMA_CTRL_REG = + (USB->USB_DMA_CTRL_REG & ~USB_USB_DMA_CTRL_REG_USB_DMA_TX_Msk) | + ((ep_idx - 1) << USB_USB_DMA_CTRL_REG_USB_DMA_TX_Pos); + } + USB->USB_DMA_CTRL_REG |= USB_USB_DMA_CTRL_REG_USB_DMA_EN_Msk; + return true; + } else { + return false; + } +} + +static void start_rx_dma(const struct usb_smartbond_dma_config *dma_cfg, uintptr_t src, + uintptr_t dst, uint16_t size) +{ + if (dma_reload(dma_cfg->rx_dev, dma_cfg->rx_chan, src, dst, size) < 0) { + LOG_ERR("Failed to reload RX DMA"); + } else { + dma_start(dma_cfg->rx_dev, dma_cfg->rx_chan); + } +} + +static void start_rx_packet(struct usb_smartbond_data *data, struct smartbond_ep_state *ep_state) +{ + struct udc_ep_config *const ep_cfg = &ep_state->config; + const struct udc_smartbond_config *config = data->dev->config; + const uint8_t ep = ep_cfg->addr; + struct smartbond_ep_reg_set *regs = ep_state->regs; + struct net_buf *buf = ep_state->buf; + uint8_t ep_idx = USB_EP_GET_IDX(ep); + const uint16_t mps = udc_mps_ep_size(ep_cfg); + uint8_t rxc = regs->rxc | USB_USB_RXC1_REG_USB_RX_EN_Msk; + + LOG_DBG("Start rx ep 0x%02x", ep); + + ep_state->last_packet_size = 0; + + if (mps > config->dma_min_transfer_size) { + if (try_allocate_dma(data, ep_state)) { + start_rx_dma(&config->dma_cfg, (uintptr_t)®s->rxd, + (uintptr_t)net_buf_tail(buf), mps); + } else if (mps > EP_FIFO_SIZE) { + /* + * Other endpoint is using DMA in that direction, + * fall back to interrupts. + * For endpoint size greater than FIFO size, + * enable FIFO level warning interrupt when FIFO + * has less than 17 bytes free. + */ + rxc |= USB_USB_RXC1_REG_USB_RFWL_Msk; + USB->USB_FWMSK_REG |= + BIT(ep_idx - 1 + USB_USB_FWMSK_REG_USB_M_RXWARN31_Pos); + } + } else if (ep_idx != 0) { + /* If max_packet_size would fit in FIFO no need + * for FIFO level warning interrupt. + */ + rxc &= ~USB_USB_RXC1_REG_USB_RFWL_Msk; + USB->USB_FWMSK_REG &= ~(BIT(ep_idx - 1 + USB_USB_FWMSK_REG_USB_M_RXWARN31_Pos)); + } + + regs->rxc = rxc; +} + +static void start_tx_dma(const struct usb_smartbond_dma_config *dma_cfg, uintptr_t src, + uintptr_t dst, uint16_t size) +{ + if (dma_reload(dma_cfg->tx_dev, dma_cfg->tx_chan, src, dst, size) < 0) { + LOG_ERR("Failed to reload TX DMA"); + } else { + dma_start(dma_cfg->tx_dev, dma_cfg->tx_chan); + } +} + +static void start_tx_packet(struct usb_smartbond_data *data, struct smartbond_ep_state *ep_state) +{ + const struct udc_smartbond_config *config = data->dev->config; + struct smartbond_ep_reg_set *regs = ep_state->regs; + struct udc_ep_config *const ep_cfg = &ep_state->config; + struct net_buf *buf = ep_state->buf; + const uint8_t ep = ep_cfg->addr; + uint16_t remaining = buf->len; + const uint16_t mps = udc_mps_ep_size(ep_cfg); + uint16_t size = MIN(remaining, mps); + uint8_t txc; + + LOG_DBG("ep 0x%02x %d/%d", ep, size, remaining); + + ep_state->last_packet_size = 0; + + regs->txc = USB_USB_TXC1_REG_USB_FLUSH_Msk; + + txc = USB_USB_TXC1_REG_USB_TX_EN_Msk | USB_USB_TXC1_REG_USB_LAST_Msk; + if (ep_cfg->stat.data1) { + txc |= USB_USB_TXC1_REG_USB_TOGGLE_TX_Msk; + } + + if (ep != USB_CONTROL_EP_IN && size > config->dma_min_transfer_size && + (uint32_t)(buf->data) >= CONFIG_SRAM_BASE_ADDRESS && try_allocate_dma(data, ep_state)) { + start_tx_dma(&config->dma_cfg, (uintptr_t)buf->data, (uintptr_t)®s->txd, size); + } else { + fill_tx_fifo(ep_state); + } + + regs->txc = txc; + if (ep == USB_CONTROL_EP_IN) { + (void)USB->USB_EP0_NAK_REG; + /* + * While driver expects upper layer to send data to the host, + * code should detect EP0 NAK event that could mean that + * host already sent ZLP without waiting for all requested + * data. + */ + REG_SET_BIT(USB_MAMSK_REG, USB_M_EP0_NAK); + } +} + +static uint16_t read_rx_fifo(struct smartbond_ep_state *ep_state, uint8_t *dst, + uint16_t bytes_in_fifo) +{ + struct smartbond_ep_reg_set *regs = ep_state->regs; + struct udc_ep_config *const ep_cfg = &ep_state->config; + const uint16_t mps = udc_mps_ep_size(ep_cfg); + uint16_t remaining = mps - ep_state->last_packet_size; + uint16_t receive_this_time = bytes_in_fifo; + + if (remaining < bytes_in_fifo) { + receive_this_time = remaining; + } + + for (int i = 0; i < receive_this_time; ++i) { + dst[i] = regs->rxd; + } + + ep_state->last_packet_size += receive_this_time; + + return bytes_in_fifo - receive_this_time; +} + +static void handle_ep0_rx(struct usb_smartbond_data *data) +{ + int fifo_bytes; + uint32_t rxs0 = USB->USB_RXS0_REG; + struct smartbond_ep_state *ep0_out_state = EP0_OUT_STATE(data); + struct udc_ep_config *ep0_out_config = &ep0_out_state->config; + struct smartbond_ep_state *ep0_in_state; + struct udc_ep_config *ep0_in_config; + struct net_buf *buf = ep0_out_state->buf; + + fifo_bytes = GET_BIT(rxs0, USB_USB_RXS0_REG_USB_RCOUNT); + + if (rxs0 & USB_USB_RXS0_REG_USB_SETUP_Msk) { + ep0_in_state = EP0_IN_STATE(data); + ep0_in_config = &ep0_in_state->config; + ep0_out_state->last_packet_size = 0; + read_rx_fifo(ep0_out_state, data->setup_buffer, EP0_FIFO_SIZE); + + ep0_out_config->stat.halted = 0; + ep0_out_config->stat.data1 = 1; + ep0_in_config->stat.halted = 0; + ep0_in_config->stat.data1 = 1; + REG_SET_BIT(USB_TXC0_REG, USB_TOGGLE_TX0); + REG_CLR_BIT(USB_EPC0_REG, USB_STALL); + LOG_HEXDUMP_DBG(data->setup_buffer, 8, "setup"); + REG_CLR_BIT(USB_MAMSK_REG, USB_M_EP0_NAK); + REG_CLR_BIT(USB_RXC0_REG, USB_RX_EN); + (void)USB->USB_EP0_NAK_REG; + k_work_submit_to_queue(udc_get_work_q(), &data->ep0_setup_work); + } else { + (void)USB->USB_EP0_NAK_REG; + if (GET_BIT(rxs0, USB_USB_RXS0_REG_USB_TOGGLE_RX0) != ep0_out_config->stat.data1) { + /* Toggle bit does not match discard packet */ + REG_SET_BIT(USB_RXC0_REG, USB_FLUSH); + ep0_out_state->last_packet_size = 0; + LOG_WRN("Packet with incorrect data1 bit rejected"); + } else { + read_rx_fifo(ep0_out_state, + net_buf_tail(buf) + ep0_out_state->last_packet_size, + fifo_bytes); + if (rxs0 & USB_USB_RXS0_REG_USB_RX_LAST_Msk) { + ep0_out_config->stat.data1 ^= 1; + net_buf_add(ep0_out_state->buf, ep0_out_state->last_packet_size); + if (ep0_out_state->last_packet_size < EP0_FIFO_SIZE || + ep0_out_state->buf->len == 0) { + k_work_submit_to_queue(udc_get_work_q(), + &data->ep0_rx_work); + } else { + start_rx_packet(data, ep0_out_state); + } + } + } + } +} + +static void udc_smartbond_ep_abort(const struct device *dev, struct udc_ep_config *const ep_cfg) +{ + struct smartbond_ep_state *ep_state = (struct smartbond_ep_state *)(ep_cfg); + struct usb_smartbond_data *data = udc_get_private(dev); + const struct udc_smartbond_config *config = data->dev->config; + + /* Stop DMA if it used by this endpoint */ + if (data->dma_ep[0] == ep_state) { + dma_stop(config->dma_cfg.rx_dev, config->dma_cfg.rx_chan); + data->dma_ep[0] = NULL; + } else if (data->dma_ep[1] == ep_state) { + dma_stop(config->dma_cfg.tx_dev, config->dma_cfg.tx_chan); + data->dma_ep[1] = NULL; + } + /* Flush FIFO */ + if (USB_EP_DIR_IS_OUT(ep_cfg->addr)) { + ep_state->regs->rxc |= USB_USB_RXC0_REG_USB_FLUSH_Msk; + ep_state->regs->rxc &= ~USB_USB_RXC0_REG_USB_FLUSH_Msk; + } else { + ep_state->regs->txc |= USB_USB_TXC0_REG_USB_FLUSH_Msk; + ep_state->regs->txc &= ~USB_USB_TXC0_REG_USB_FLUSH_Msk; + } +} + +static int udc_smartbond_ep_tx(const struct device *dev, uint8_t ep) +{ + struct usb_smartbond_data *data = dev->data; + struct smartbond_ep_state *ep_state = usb_dc_get_ep_in_state(data, USB_EP_GET_IDX(ep)); + struct net_buf *buf; + + if (udc_ep_is_busy(dev, ep) || + (ep_state->regs->epc_in & USB_USB_EPC1_REG_USB_STALL_Msk) != 0) { + return 0; + } + + buf = udc_buf_peek(dev, ep); + LOG_DBG("TX ep 0x%02x len %u", ep, buf ? buf->len : -1); + + if (buf) { + ep_state->buf = buf; + ep_state->last_packet_size = 0; + + start_tx_packet(data, ep_state); + + udc_ep_set_busy(dev, ep, true); + } + + return 0; +} + +static int udc_smartbond_ep_rx(const struct device *dev, uint8_t ep) +{ + struct usb_smartbond_data *data = dev->data; + struct smartbond_ep_state *ep_state = usb_dc_get_ep_out_state(data, USB_EP_GET_IDX(ep)); + struct net_buf *buf; + + if (udc_ep_is_busy(dev, ep)) { + return 0; + } + + buf = udc_buf_peek(dev, ep); + + if (buf) { + LOG_DBG("RX ep 0x%02x len %u", ep, buf->size); + + ep_state->last_packet_size = 0; + ep_state->buf = buf; + + start_rx_packet(data, ep_state); + + udc_ep_set_busy(dev, ep, true); + } + + return 0; +} + +static int udc_smartbond_ep_enqueue(const struct device *dev, struct udc_ep_config *const ep_cfg, + struct net_buf *buf) +{ + unsigned int lock_key; + const uint8_t ep = ep_cfg->addr; + int ret; + + LOG_DBG("ep 0x%02x enqueue %p", ep, buf); + udc_buf_put(ep_cfg, buf); + + if (ep_cfg->stat.halted) { + /* + * It is fine to enqueue a transfer for a halted endpoint, + * you need to make sure that transfers are re-triggered when + * the halt is cleared. + */ + LOG_DBG("ep 0x%02x halted", ep); + return 0; + } + + lock_key = irq_lock(); + + if (USB_EP_DIR_IS_IN(ep)) { + ret = udc_smartbond_ep_tx(dev, ep); + } else { + ret = udc_smartbond_ep_rx(dev, ep); + } + + irq_unlock(lock_key); + + return ret; +} + +static int udc_smartbond_ep_dequeue(const struct device *dev, struct udc_ep_config *const ep_cfg) +{ + const uint8_t ep = ep_cfg->addr; + unsigned int lock_key; + struct net_buf *buf; + + LOG_INF("ep 0x%02x dequeue all", ep); + + lock_key = irq_lock(); + + udc_smartbond_ep_abort(dev, ep_cfg); + + buf = udc_buf_get_all(dev, ep); + if (buf) { + udc_submit_ep_event(dev, buf, -ECONNABORTED); + } + + udc_ep_set_busy(dev, ep, false); + + irq_unlock(lock_key); + + return 0; +} + +int udc_smartbond_ep_enable(const struct device *dev, struct udc_ep_config *const ep_cfg) +{ + const uint8_t ep = ep_cfg->addr; + struct smartbond_ep_state *ep_state; + bool iso = (ep_cfg->attributes & USB_EP_TRANSFER_TYPE_MASK) == USB_EP_TYPE_ISO; + uint8_t ep_idx = USB_EP_GET_IDX(ep); + + ARG_UNUSED(dev); + + LOG_INF("Enable ep 0x%02x", ep); + + ep_state = (struct smartbond_ep_state *)(ep_cfg); + if (USB_EP_DIR_IS_IN(ep)) { + ep_state->regs->txc &= ~USB_USB_TXC0_REG_USB_IGN_IN_Msk; + if (ep != USB_CONTROL_EP_IN) { + ep_state->regs->epc_in |= USB_USB_EPC1_REG_USB_EP_EN_Msk | + USB_EP_GET_IDX(ep) | + (iso ? USB_USB_EPC2_REG_USB_ISO_Msk : 0); + USB->USB_TXMSK_REG |= 0x11 << (ep_idx - 1); + REG_SET_BIT(USB_MAMSK_REG, USB_M_TX_EV); + } + } else { + ep_state->regs->rxc &= ~USB_USB_RXC0_REG_USB_IGN_OUT_Msk; + if (ep == USB_CONTROL_EP_OUT) { + ep_state->regs->rxc &= ~USB_USB_RXC0_REG_USB_IGN_SETUP_Msk; + } else { + ep_state->regs->epc_out = USB_USB_EPC2_REG_USB_EP_EN_Msk | + USB_EP_GET_IDX(ep) | + (iso ? USB_USB_EPC2_REG_USB_ISO_Msk : 0); + USB->USB_RXMSK_REG |= 0x11 << (ep_idx - 1); + REG_SET_BIT(USB_MAMSK_REG, USB_M_RX_EV); + } + } + + return 0; +} + +static int udc_smartbond_ep_disable(const struct device *dev, struct udc_ep_config *const ep_cfg) +{ + struct usb_smartbond_data *data = udc_get_private(dev); + const uint8_t ep = ep_cfg->addr; + struct smartbond_ep_state *ep_state; + + LOG_INF("Disable ep 0x%02x", ep); + + ep_state = usb_dc_get_ep_state(data, ep); + if (USB_EP_DIR_IS_IN(ep)) { + ep_state->regs->txc = + USB_USB_TXC0_REG_USB_IGN_IN_Msk | USB_USB_TXC0_REG_USB_FLUSH_Msk; + } else { + ep_state->regs->rxc = + USB_USB_RXC0_REG_USB_IGN_SETUP_Msk | USB_USB_RXC0_REG_USB_IGN_OUT_Msk; + } + + return 0; +} + +static int udc_smartbond_ep_set_halt(const struct device *dev, struct udc_ep_config *const ep_cfg) +{ + struct smartbond_ep_state *ep_state = (struct smartbond_ep_state *)(ep_cfg); + struct net_buf *buf; + const uint8_t ep = ep_cfg->addr; + + LOG_DBG("Set halt ep 0x%02x", ep); + + ep_cfg->stat.halted = 1; + if (ep_cfg->addr == USB_CONTROL_EP_IN) { + /* Stall in DATA IN phase, drop status OUT packet */ + if (udc_ctrl_stage_is_data_in(dev)) { + buf = udc_buf_get(dev, USB_CONTROL_EP_OUT); + if (buf) { + net_buf_unref(buf); + } + } + USB->USB_RXC0_REG = USB_USB_RXC0_REG_USB_FLUSH_Msk; + USB->USB_EPC0_REG |= USB_USB_EPC0_REG_USB_STALL_Msk; + USB->USB_TXC0_REG |= USB_USB_TXC0_REG_USB_TX_EN_Msk; + } else if (ep == USB_CONTROL_EP_OUT) { + ep_state->regs->rxc |= USB_USB_RXC0_REG_USB_RX_EN_Msk; + ep_state->regs->epc_in |= USB_USB_EPC0_REG_USB_STALL_Msk; + } else if (USB_EP_DIR_IS_OUT(ep)) { + ep_state->regs->epc_out = USB_USB_EPC1_REG_USB_STALL_Msk; + ep_state->regs->rxc = USB_USB_RXC1_REG_USB_RX_EN_Msk; + } else { + ep_state->regs->epc_in |= USB_USB_EPC1_REG_USB_STALL_Msk; + ep_state->regs->txc = + USB_USB_TXC1_REG_USB_TX_EN_Msk | USB_USB_TXC1_REG_USB_LAST_Msk; + } + + return 0; +} + +static int udc_smartbond_ep_clear_halt(const struct device *dev, struct udc_ep_config *const ep_cfg) +{ + const uint8_t ep = ep_cfg->addr; + struct smartbond_ep_state *ep_state = (struct smartbond_ep_state *)(ep_cfg); + + LOG_DBG("Clear halt ep 0x%02x", ep); + + ep_cfg->stat.data1 = 0; + ep_cfg->stat.halted = 0; + + if (ep == USB_CONTROL_EP_OUT || ep == USB_CONTROL_EP_IN) { + REG_CLR_BIT(USB_MAMSK_REG, USB_M_EP0_NAK); + } + + if (USB_EP_DIR_IS_OUT(ep)) { + ep_state->regs->epc_out &= ~USB_USB_EPC1_REG_USB_STALL_Msk; + udc_smartbond_ep_rx(dev, ep); + } else { + ep_state->regs->epc_in &= ~USB_USB_EPC1_REG_USB_STALL_Msk; + udc_smartbond_ep_tx(dev, ep); + } + + return 0; +} + +static int udc_smartbond_set_address(const struct device *dev, const uint8_t addr) +{ + ARG_UNUSED(dev); + + LOG_DBG("Set new address %u for %p", addr, dev); + + USB->USB_FAR_REG = (addr & USB_USB_FAR_REG_USB_AD_Msk) | USB_USB_FAR_REG_USB_AD_EN_Msk; + + return 0; +} + +static int udc_smartbond_host_wakeup(const struct device *dev) +{ + struct usb_smartbond_data *data = udc_get_private(dev); + + LOG_DBG("Remote wakeup from %p", dev); + + if (data->nfsr == NFSR_NODE_SUSPEND) { + /* + * Enter fake state that will use FRAME interrupt to wait before + * going operational. + */ + set_nfsr(data, NFSR_NODE_WAKING); + USB->USB_MAMSK_REG |= USB_USB_MAMSK_REG_USB_M_FRAME_Msk; + } + + return 0; +} + +static enum udc_bus_speed udc_smartbond_device_speed(const struct device *dev) +{ + ARG_UNUSED(dev); + + return UDC_BUS_SPEED_FS; +} + +static int udc_smartbond_shutdown(const struct device *dev) +{ + if (udc_ep_disable_internal(dev, USB_CONTROL_EP_OUT)) { + LOG_ERR("Failed to disable control endpoint"); + return -EIO; + } + + if (udc_ep_disable_internal(dev, USB_CONTROL_EP_IN)) { + LOG_ERR("Failed to disable control endpoint"); + return -EIO; + } + + return 0; +} + +static uint32_t check_reset_end(struct usb_smartbond_data *data, uint32_t alt_ev) +{ + if (data->nfsr == NFSR_NODE_RESET) { + if (GET_BIT(alt_ev, USB_USB_ALTEV_REG_USB_RESET)) { + /* + * Could be still in reset, but since USB_M_RESET is + * disabled it can be also old reset state that was not + * cleared yet. + * If (after reading USB_ALTEV_REG register again) + * bit is cleared reset state just ended. + * Keep non-reset bits combined from two previous + * ALTEV reads and one from the next line. + */ + alt_ev = (alt_ev & ~USB_USB_ALTEV_REG_USB_RESET_Msk) | USB->USB_ALTEV_REG; + } + + if (GET_BIT(alt_ev, USB_USB_ALTEV_REG_USB_RESET) == 0) { + USB->USB_ALTMSK_REG = + USB_USB_ALTMSK_REG_USB_M_RESET_Msk | USB_USB_ALTEV_REG_USB_SD3_Msk; + if (data->ep_state[0][0].buf != NULL) { + USB->USB_MAMSK_REG |= USB_USB_MAMSK_REG_USB_M_EP0_RX_Msk; + } + LOG_DBG("Set operational %02x", USB->USB_MAMSK_REG); + set_nfsr(data, NFSR_NODE_OPERATIONAL); + } + } + return alt_ev; +} + +void handle_ep0_tx(struct usb_smartbond_data *data) +{ + uint32_t txs0; + struct smartbond_ep_state *ep0_in_state = EP0_IN_STATE(data); + const uint8_t ep = USB_CONTROL_EP_IN; + struct smartbond_ep_reg_set *regs = ep0_in_state->regs; + struct udc_ep_config *ep0_in_config = &ep0_in_state->config; + struct net_buf *buf = ep0_in_state->buf; + bool start_next_packet = true; + + txs0 = regs->txs; + + LOG_DBG("%02x %02x", ep, txs0); + + if (GET_BIT(txs0, USB_USB_TXS0_REG_USB_TX_DONE)) { + /* ACK received */ + if (GET_BIT(txs0, USB_USB_TXS0_REG_USB_ACK_STAT)) { + net_buf_pull(buf, ep0_in_state->last_packet_size); + ep0_in_state->last_packet_size = 0; + ep0_in_config->stat.data1 ^= 1; + REG_SET_VAL(USB_TXC0_REG, USB_TOGGLE_TX0, ep0_in_config->stat.data1); + + /* + * Packet was sent to host but host already sent OUT packet + * that was NAK'ed. It means that no more data is needed. + */ + if (USB->USB_EP0_NAK_REG & USB_USB_EP0_NAK_REG_USB_EP0_OUTNAK_Msk) { + net_buf_pull(buf, buf->len); + udc_ep_buf_clear_zlp(buf); + } + if (buf->len == 0) { + /* When everything was sent there is not need to fill new packet */ + start_next_packet = false; + /* Send ZLP if protocol needs it */ + if (udc_ep_buf_has_zlp(buf)) { + udc_ep_buf_clear_zlp(buf); + /* Enable transmitter without putting anything in FIFO */ + USB->USB_TXC0_REG |= USB_USB_TXC0_REG_USB_TX_EN_Msk; + } else { + REG_CLR_BIT(USB_MAMSK_REG, USB_M_EP0_NAK); + k_work_submit_to_queue(udc_get_work_q(), + &data->ep0_tx_work); + } + } + } else { + /* Start from the beginning */ + ep0_in_state->last_packet_size = 0; + } + if (start_next_packet) { + start_tx_packet(data, ep0_in_state); + } + } +} + +static void handle_epx_rx_ev(struct usb_smartbond_data *data, uint8_t ep_idx) +{ + uint32_t rxs; + int fifo_bytes; + struct smartbond_ep_state *ep_state = usb_dc_get_ep_out_state(data, ep_idx); + const struct udc_smartbond_config *config = data->dev->config; + struct smartbond_ep_reg_set *regs = ep_state->regs; + struct udc_ep_config *const ep_cfg = &ep_state->config; + struct net_buf *buf = ep_state->buf; + + do { + rxs = regs->rxs; + + if (GET_BIT(rxs, USB_USB_RXS1_REG_USB_RX_ERR)) { + regs->rxc |= USB_USB_RXC1_REG_USB_FLUSH_Msk; + ep_state->last_packet_size = 0; + if (data->dma_ep[0] == ep_state) { + /* Stop DMA */ + dma_stop(config->dma_cfg.rx_dev, config->dma_cfg.rx_chan); + /* Restart DMA since packet was dropped, + * all parameters should still work. + */ + dma_start(config->dma_cfg.rx_dev, config->dma_cfg.rx_chan); + } + break; + } + + if (data->dma_ep[0] == ep_state) { + struct dma_status rx_dma_status; + + dma_get_status(config->dma_cfg.rx_dev, config->dma_cfg.rx_chan, + &rx_dma_status); + /* + * Disable DMA and update last_packet_size + * with what DMA reported. + */ + dma_stop(config->dma_cfg.rx_dev, config->dma_cfg.rx_chan); + ep_state->last_packet_size = rx_dma_status.total_copied; + + /* + * When DMA did not finished (packet was smaller then MPS), + * dma_idx holds exact number of bytes transmitted. When DMA + * finished value in dma_idx is one less then actual number of + * transmitted bytes. + */ + if (ep_state->last_packet_size == + (rx_dma_status.total_copied + rx_dma_status.pending_length)) { + ep_state->last_packet_size++; + } + /* Release DMA to use by other endpoints. */ + data->dma_ep[0] = NULL; + } + fifo_bytes = GET_BIT(rxs, USB_USB_RXS1_REG_USB_RXCOUNT); + /* + * FIFO maybe empty if DMA read it before or + * it's final iteration and function already read all + * that was to read. + */ + if (fifo_bytes > 0) { + fifo_bytes = read_rx_fifo(ep_state, + net_buf_tail(buf) + ep_state->last_packet_size, + fifo_bytes); + } + + if (GET_BIT(rxs, USB_USB_RXS1_REG_USB_RX_LAST)) { + if (!ep_state->iso && + GET_BIT(rxs, USB_USB_RXS1_REG_USB_TOGGLE_RX) != ep_cfg->stat.data1) { + /* Toggle bit does not match discard packet */ + regs->rxc |= USB_USB_RXC1_REG_USB_FLUSH_Msk; + ep_state->last_packet_size = 0; + LOG_WRN("Packet with incorrect data1 field rejected"); + /* Re-enable reception */ + start_rx_packet(data, ep_state); + } else { + ep_cfg->stat.data1 ^= 1; + REG_SET_VAL(USB_TXC0_REG, USB_TOGGLE_TX0, ep_cfg->stat.data1); + net_buf_add(buf, ep_state->last_packet_size); + + if (net_buf_tailroom(buf) == 0 || + ep_state->last_packet_size < udc_mps_ep_size(ep_cfg) || + ep_state->iso) { + buf = udc_buf_get(data->dev, ep_cfg->addr); + if (unlikely(buf == NULL)) { + LOG_ERR("ep 0x%02x queue is empty", ep_cfg->addr); + break; + } + ep_cfg->stat.busy = 0; + udc_submit_ep_event(data->dev, buf, 0); + break; + } + start_rx_packet(data, ep_state); + } + } + } while (fifo_bytes > config->fifo_read_threshold); +} + +static void handle_rx_ev(struct usb_smartbond_data *data) +{ + if (USB->USB_RXEV_REG & BIT(0)) { + handle_epx_rx_ev(data, 1); + } + + if (USB->USB_RXEV_REG & BIT(1)) { + handle_epx_rx_ev(data, 2); + } + + if (USB->USB_RXEV_REG & BIT(2)) { + handle_epx_rx_ev(data, 3); + } +} + +static void handle_epx_tx_ev(struct usb_smartbond_data *data, struct smartbond_ep_state *ep_state) +{ + uint32_t txs; + const struct udc_smartbond_config *config = data->dev->config; + struct smartbond_ep_reg_set *regs = ep_state->regs; + struct udc_ep_config *const ep_cfg = &ep_state->config; + struct net_buf *buf = ep_state->buf; + const uint8_t ep = ep_cfg->addr; + + txs = regs->txs; + + if (GET_BIT(txs, USB_USB_TXS1_REG_USB_TX_DONE)) { + if (data->dma_ep[1] == ep_state) { + struct dma_status tx_dma_status; + + dma_get_status(config->dma_cfg.tx_dev, config->dma_cfg.tx_chan, + &tx_dma_status); + /* + * Disable DMA and update last_packet_size with what + * DMA reported. + */ + dma_stop(config->dma_cfg.tx_dev, config->dma_cfg.tx_chan); + ep_state->last_packet_size = tx_dma_status.total_copied + 1; + /* Release DMA to used by other endpoints. */ + data->dma_ep[1] = NULL; + } + + if (GET_BIT(txs, USB_USB_TXS1_REG_USB_ACK_STAT)) { + /* ACK received, update transfer state and DATA0/1 bit */ + net_buf_pull(buf, ep_state->last_packet_size); + ep_state->last_packet_size = 0; + ep_cfg->stat.data1 ^= 1; + REG_SET_VAL(USB_TXC0_REG, USB_TOGGLE_TX0, ep_cfg->stat.data1); + + if (buf->len == 0) { + if (udc_ep_buf_has_zlp(buf)) { + udc_ep_buf_clear_zlp(buf); + /* Enable transmitter without putting anything in FIFO */ + regs->txc |= USB_USB_TXC1_REG_USB_TX_EN_Msk | + USB_USB_TXC1_REG_USB_LAST_Msk; + } else { + udc_ep_set_busy(data->dev, ep, false); + buf = udc_buf_get(data->dev, ep); + + udc_submit_ep_event(data->dev, buf, 0); + udc_smartbond_ep_tx(data->dev, ep); + } + return; + } + } else if (regs->epc_in & USB_USB_EPC1_REG_USB_STALL_Msk) { + /* + * TX_DONE also indicates that STALL packet was just sent, + * there is no point to put anything into transmit FIFO. + * It could result in empty packet being scheduled. + */ + return; + } + } + + if (txs & USB_USB_TXS1_REG_USB_TX_URUN_Msk) { + LOG_DBG("EP 0x%02x FIFO under-run\n", ep); + } + /* Start next or repeated packet. */ + start_tx_packet(data, ep_state); +} + +static void handle_tx_ev(struct usb_smartbond_data *data) +{ + if (USB->USB_TXEV_REG & BIT(0)) { + handle_epx_tx_ev(data, usb_dc_get_ep_in_state(data, 1)); + } + if (USB->USB_TXEV_REG & BIT(1)) { + handle_epx_tx_ev(data, usb_dc_get_ep_in_state(data, 2)); + } + if (USB->USB_TXEV_REG & BIT(2)) { + handle_epx_tx_ev(data, usb_dc_get_ep_in_state(data, 3)); + } +} + +static void handle_epx_tx_warn_ev(struct usb_smartbond_data *data, uint8_t ep_idx) +{ + fill_tx_fifo(usb_dc_get_ep_in_state(data, ep_idx)); +} + +static void handle_fifo_warning(struct usb_smartbond_data *data) +{ + uint32_t fifo_warning = USB->USB_FWEV_REG; + + if (fifo_warning & BIT(0)) { + handle_epx_tx_warn_ev(data, 1); + } + + if (fifo_warning & BIT(1)) { + handle_epx_tx_warn_ev(data, 2); + } + + if (fifo_warning & BIT(2)) { + handle_epx_tx_warn_ev(data, 3); + } + + if (fifo_warning & BIT(4)) { + handle_epx_rx_ev(data, 1); + } + + if (fifo_warning & BIT(5)) { + handle_epx_rx_ev(data, 2); + } + + if (fifo_warning & BIT(6)) { + handle_epx_rx_ev(data, 3); + } +} + +static void handle_ep0_nak(struct usb_smartbond_data *data) +{ + uint32_t ep0_nak = USB->USB_EP0_NAK_REG; + + if (REG_GET_BIT(USB_EPC0_REG, USB_STALL)) { + if (GET_BIT(ep0_nak, USB_USB_EP0_NAK_REG_USB_EP0_INNAK)) { + /* + * EP0 is stalled and NAK was sent, it means that + * RX is enabled. Disable RX for now. + */ + REG_CLR_BIT(USB_RXC0_REG, USB_RX_EN); + REG_SET_BIT(USB_TXC0_REG, USB_TX_EN); + } + + if (GET_BIT(ep0_nak, USB_USB_EP0_NAK_REG_USB_EP0_OUTNAK)) { + REG_SET_BIT(USB_RXC0_REG, USB_RX_EN); + } + } else { + REG_CLR_BIT(USB_MAMSK_REG, USB_M_EP0_NAK); + if (REG_GET_BIT(USB_RXC0_REG, USB_RX_EN) == 0 && + GET_BIT(ep0_nak, USB_USB_EP0_NAK_REG_USB_EP0_OUTNAK)) { + (void)USB->USB_EP0_NAK_REG; + k_work_submit_to_queue(udc_get_work_q(), &data->ep0_tx_work); + } + } +} + +static void empty_ep0_queues(const struct device *dev) +{ + struct net_buf *buf; + + buf = udc_buf_get_all(dev, USB_CONTROL_EP_OUT); + if (buf) { + net_buf_unref(buf); + } + buf = udc_buf_get_all(dev, USB_CONTROL_EP_IN); + if (buf) { + net_buf_unref(buf); + } +} + +static void handle_bus_reset(struct usb_smartbond_data *data) +{ + const struct udc_smartbond_config *config = data->dev->config; + uint32_t alt_ev; + + USB->USB_NFSR_REG = 0; + USB->USB_FAR_REG = 0x80; + USB->USB_ALTMSK_REG = 0; + USB->USB_NFSR_REG = NFSR_NODE_RESET; + USB->USB_TXMSK_REG = 0; + USB->USB_RXMSK_REG = 0; + set_nfsr(data, NFSR_NODE_RESET); + + for (int i = 0; i < config->num_of_eps; ++i) { + data->ep_state[1][i].buf = NULL; + data->ep_state[1][i].config.stat.busy = 0; + } + + LOG_INF("send USB_DC_RESET"); + udc_submit_event(data->dev, UDC_EVT_RESET, 0); + USB->USB_DMA_CTRL_REG = 0; + + USB->USB_MAMSK_REG = USB_USB_MAMSK_REG_USB_M_INTR_Msk | USB_USB_MAMSK_REG_USB_M_FRAME_Msk | + USB_USB_MAMSK_REG_USB_M_WARN_Msk | USB_USB_MAMSK_REG_USB_M_ALT_Msk | + USB_USB_MAMSK_REG_USB_M_EP0_RX_Msk | + USB_USB_MAMSK_REG_USB_M_EP0_TX_Msk; + USB->USB_ALTMSK_REG = USB_USB_ALTMSK_REG_USB_M_RESUME_Msk; + alt_ev = USB->USB_ALTEV_REG; + check_reset_end(data, alt_ev); + empty_ep0_queues(data->dev); +} + +static void usb_clock_on(struct usb_smartbond_data *data) +{ + if (atomic_cas(&data->clk_requested, 0, 1)) { + clock_control_on(DEVICE_DT_GET(DT_NODELABEL(osc)), + (clock_control_subsys_rate_t)SMARTBOND_CLK_USB); + } +} + +static void usb_clock_off(struct usb_smartbond_data *data) +{ + if (atomic_cas(&data->clk_requested, 1, 0)) { + clock_control_off(DEVICE_DT_GET(DT_NODELABEL(osc)), + (clock_control_subsys_rate_t)SMARTBOND_CLK_USB); + } +} + +static void handle_alt_ev(struct usb_smartbond_data *data) +{ + const struct udc_smartbond_config *config = data->dev->config; + struct smartbond_ep_state *ep_state; + uint32_t alt_ev = USB->USB_ALTEV_REG; + + if (USB->USB_NFSR_REG == NFSR_NODE_SUSPEND) { + usb_clock_on(data); + } + alt_ev = check_reset_end(data, alt_ev); + if (GET_BIT(alt_ev, USB_USB_ALTEV_REG_USB_RESET) && data->nfsr != NFSR_NODE_RESET) { + handle_bus_reset(data); + } else if (GET_BIT(alt_ev, USB_USB_ALTEV_REG_USB_RESUME)) { + if (USB->USB_NFSR_REG == NFSR_NODE_SUSPEND) { + set_nfsr(data, NFSR_NODE_OPERATIONAL); + if (data->ep_state[0][0].buf != NULL) { + USB->USB_MAMSK_REG |= USB_USB_MAMSK_REG_USB_M_EP0_RX_Msk; + } + USB->USB_ALTMSK_REG = USB_USB_ALTMSK_REG_USB_M_RESET_Msk | + USB_USB_ALTMSK_REG_USB_M_SD3_Msk; + /* Re-enable reception of endpoint with pending transfer */ + for (int ep_idx = 1; ep_idx < config->num_of_eps; ++ep_idx) { + ep_state = usb_dc_get_ep_out_state(data, ep_idx); + if (!ep_state->config.stat.halted) { + start_rx_packet(data, ep_state); + } + } + udc_submit_event(data->dev, UDC_EVT_RESUME, 0); + } + } else if (GET_BIT(alt_ev, USB_USB_ALTEV_REG_USB_SD3)) { + set_nfsr(data, NFSR_NODE_SUSPEND); + USB->USB_ALTMSK_REG = + USB_USB_ALTMSK_REG_USB_M_RESET_Msk | USB_USB_ALTMSK_REG_USB_M_RESUME_Msk; + usb_clock_off(data); + udc_submit_event(data->dev, UDC_EVT_SUSPEND, 0); + } +} + +static void udc_smartbond_isr(const struct device *dev) +{ + struct usb_smartbond_data *data = udc_get_private(dev); + uint32_t int_status = USB->USB_MAEV_REG & USB->USB_MAMSK_REG; + + if (GET_BIT(int_status, USB_USB_MAEV_REG_USB_WARN)) { + handle_fifo_warning(data); + } + + if (GET_BIT(int_status, USB_USB_MAEV_REG_USB_CH_EV)) { + /* For now just clear interrupt */ + (void)USB->USB_CHARGER_STAT_REG; + } + + if (GET_BIT(int_status, USB_USB_MAEV_REG_USB_EP0_TX)) { + handle_ep0_tx(data); + } + + if (GET_BIT(int_status, USB_USB_MAEV_REG_USB_EP0_RX)) { + handle_ep0_rx(data); + } + + if (GET_BIT(int_status, USB_USB_MAEV_REG_USB_EP0_NAK)) { + handle_ep0_nak(data); + } + + if (GET_BIT(int_status, USB_USB_MAEV_REG_USB_RX_EV)) { + handle_rx_ev(data); + } + + if (GET_BIT(int_status, USB_USB_MAEV_REG_USB_NAK)) { + (void)USB->USB_NAKEV_REG; + } + + if (GET_BIT(int_status, USB_USB_MAEV_REG_USB_FRAME)) { + if (data->nfsr == NFSR_NODE_RESET) { + /* + * During reset FRAME interrupt is enabled to periodically + * check when reset state ends. + * FRAME interrupt is generated every 1ms without host sending + * actual SOF. + */ + check_reset_end(data, USB_USB_ALTEV_REG_USB_RESET_Msk); + } else if (data->nfsr == NFSR_NODE_WAKING) { + /* No need to call set_nfsr, just set state */ + data->nfsr = NFSR_NODE_WAKING2; + } else if (data->nfsr == NFSR_NODE_WAKING2) { + /* No need to call set_nfsr, just set state */ + data->nfsr = NFSR_NODE_RESUME; + LOG_DBG("data->nfsr = NFSR_NODE_RESUME %02x", USB->USB_MAMSK_REG); + } else if (data->nfsr == NFSR_NODE_RESUME) { + set_nfsr(data, NFSR_NODE_OPERATIONAL); + if (data->ep_state[0][0].buf != NULL) { + USB->USB_MAMSK_REG |= USB_USB_MAMSK_REG_USB_M_EP0_RX_Msk; + } + LOG_DBG("Set operational %02x", USB->USB_MAMSK_REG); + } else { + USB->USB_MAMSK_REG &= ~USB_USB_MAMSK_REG_USB_M_FRAME_Msk; + } + } + + if (GET_BIT(int_status, USB_USB_MAEV_REG_USB_TX_EV)) { + handle_tx_ev(data); + } + + if (GET_BIT(int_status, USB_USB_MAEV_REG_USB_ALT)) { + handle_alt_ev(data); + } +} + +/** + * USB functionality can be disabled from HOST and DEVICE side. + * Host side is indicated by VBUS line. + * Device side is decided by pair of calls udc_enable()/udc_disable(), + * USB will only work when application calls udc_enable() and VBUS is present. + * When both conditions are not met USB clock (PLL) is released, and peripheral + * remain in reset state. + */ +static void usb_change_state(struct usb_smartbond_data *data, bool attached, bool vbus_present) +{ + if (data->attached == attached && data->vbus_present == vbus_present) { + return; + } + + if (vbus_present != data->vbus_present && attached) { + udc_submit_event(data->dev, + vbus_present ? UDC_EVT_VBUS_READY : UDC_EVT_VBUS_REMOVED, 0); + } + if (attached && vbus_present) { + data->attached = true; + data->vbus_present = true; + /* + * Prevent transition to standby, this greatly reduces + * IRQ response time + */ + pm_policy_state_lock_get(PM_STATE_STANDBY, PM_ALL_SUBSTATES); + usb_smartbond_dma_config(data); + usb_clock_on(data); + USB->USB_MCTRL_REG = USB_USB_MCTRL_REG_USBEN_Msk; + USB->USB_NFSR_REG = 0; + USB->USB_FAR_REG = 0x80; + USB->USB_TXMSK_REG = 0; + USB->USB_RXMSK_REG = 0; + + USB->USB_MAMSK_REG = USB_USB_MAMSK_REG_USB_M_INTR_Msk | + USB_USB_MAMSK_REG_USB_M_ALT_Msk | + USB_USB_MAMSK_REG_USB_M_WARN_Msk; + USB->USB_ALTMSK_REG = + USB_USB_ALTMSK_REG_USB_M_RESET_Msk | USB_USB_ALTEV_REG_USB_SD3_Msk; + + USB->USB_MCTRL_REG = USB_USB_MCTRL_REG_USBEN_Msk | USB_USB_MCTRL_REG_USB_NAT_Msk; + } else if (data->attached && data->vbus_present) { + /* + * USB was previously in use now either VBUS is gone or application + * requested detach, put it down + */ + data->attached = attached; + data->vbus_present = vbus_present; + /* + * It's imperative that USB_NAT bit-field is updated with the + * USBEN bit-field being set. As such, zeroing the control + * register at once will result in leaving the USB transceivers + * in a floating state. Such an action, will induce incorrect + * behavior for subsequent charger detection operations and given + * that the device does not enter the sleep state (thus powering off + * PD_SYS and resetting the controller along with its transceivers). + */ + REG_CLR_BIT(USB_MCTRL_REG, USB_NAT); + USB->USB_MCTRL_REG = 0; + usb_clock_off(data); + usb_smartbond_dma_deconfig(data); + /* Allow standby USB not in use or not connected */ + pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES); + } else { + /* USB still not activated, keep track of what's on and off */ + data->attached = attached; + data->vbus_present = vbus_present; + } +} + +static void usb_dc_smartbond_vbus_isr(struct usb_smartbond_data *data) +{ + LOG_DBG("VBUS_ISR"); + + CRG_TOP->VBUS_IRQ_CLEAR_REG = 1; + usb_change_state(data, data->attached, + (CRG_TOP->ANA_STATUS_REG & CRG_TOP_ANA_STATUS_REG_VBUS_AVAILABLE_Msk) != + 0); +} + +static int usb_dc_smartbond_alloc_status_out(const struct device *dev) +{ + + struct udc_ep_config *const ep_cfg = udc_get_ep_cfg(dev, USB_CONTROL_EP_OUT); + struct net_buf *buf; + + buf = udc_ctrl_alloc(dev, USB_CONTROL_EP_OUT, 0); + if (buf == NULL) { + return -ENOMEM; + } + + k_fifo_put(&ep_cfg->fifo, buf); + + return 0; +} + +static int usbd_ctrl_feed_dout(const struct device *dev, const size_t length) +{ + struct usb_smartbond_data *data = udc_get_private(dev); + struct smartbond_ep_state *ep_state = EP0_OUT_STATE(data); + struct udc_ep_config *const ep_cfg = &ep_state->config; + struct net_buf *buf; + + buf = udc_ctrl_alloc(dev, USB_CONTROL_EP_OUT, length); + if (buf == NULL) { + return -ENOMEM; + } + + k_fifo_put(&ep_cfg->fifo, buf); + ep_state->buf = buf; + start_rx_packet(data, ep_state); + + return 0; +} + +static void handle_ep0_rx_work(struct k_work *item) +{ + struct usb_smartbond_data *data = + CONTAINER_OF(item, struct usb_smartbond_data, ep0_rx_work); + const uint8_t ep = USB_CONTROL_EP_OUT; + struct net_buf *buf; + const struct device *dev = data->dev; + unsigned int lock_key; + + /* + * Lock needed here because busy is a bit field and access + * may result in wrong state of data1 field + */ + lock_key = irq_lock(); + + udc_ep_set_busy(dev, ep, false); + buf = udc_buf_get(dev, ep); + + irq_unlock(lock_key); + if (unlikely(buf == NULL)) { + LOG_ERR("ep 0x%02x queue is empty", ep); + return; + } + /* Update packet size */ + if (udc_ctrl_stage_is_status_out(dev)) { + udc_ctrl_update_stage(dev, buf); + udc_ctrl_submit_status(dev, buf); + } else { + udc_ctrl_update_stage(dev, buf); + } + + if (udc_ctrl_stage_is_status_in(dev)) { + udc_ctrl_submit_s_out_status(dev, buf); + } +} + +static void handle_ep0_tx_work(struct k_work *item) +{ + struct usb_smartbond_data *data = + CONTAINER_OF(item, struct usb_smartbond_data, ep0_tx_work); + struct net_buf *buf; + const struct device *dev = data->dev; + const uint8_t ep = USB_CONTROL_EP_IN; + unsigned int lock_key; + + buf = udc_buf_peek(dev, ep); + __ASSERT(buf == EP0_IN_STATE(data)->buf, "TX work without buffer %p %p", buf, + EP0_IN_STATE(data)->buf); + + /* + * Lock needed here because busy is a bit field and access + * may result in wrong state of data1 filed + */ + lock_key = irq_lock(); + + udc_ep_set_busy(dev, ep, false); + + /* Remove buffer from queue */ + buf = udc_buf_get(dev, ep); + + irq_unlock(lock_key); + + __ASSERT(buf == EP0_IN_STATE(data)->buf, "Internal error"); + + /* For control endpoint get ready for ACK stage + * from host. + */ + if (udc_ctrl_stage_is_status_in(dev) || udc_ctrl_stage_is_no_data(dev)) { + /* Status stage finished, notify upper layer */ + udc_ctrl_submit_status(dev, buf); + } + + /* Update to next stage of control transfer */ + udc_ctrl_update_stage(dev, buf); + + if (udc_ctrl_stage_is_status_out(dev)) { + /* + * Flush TX FIFO in case host already send status OUT packet + * and is not interested in reading from IN endpoint + */ + USB->USB_TXC0_REG = USB_USB_TXC0_REG_USB_FLUSH_Msk; + /* Enable reception of status OUT packet */ + REG_SET_BIT(USB_RXC0_REG, USB_RX_EN); + /* + * IN transfer finished, release buffer, + */ + net_buf_unref(buf); + } +} + +static void handle_ep0_setup_work(struct k_work *item) +{ + struct usb_smartbond_data *data = + CONTAINER_OF(item, struct usb_smartbond_data, ep0_setup_work); + struct net_buf *buf; + int err; + const struct device *dev = data->dev; + struct smartbond_ep_state *ep0_out_state; + + buf = udc_ctrl_alloc(dev, USB_CONTROL_EP_OUT, sizeof(struct usb_setup_packet)); + if (buf == NULL) { + LOG_ERR("Failed to allocate for setup"); + return; + } + + udc_ep_buf_set_setup(buf); + net_buf_add_mem(buf, data->setup_buffer, 8); + ep0_out_state = EP0_OUT_STATE(data); + ep0_out_state->last_packet_size = 0; + ep0_out_state->buf = NULL; + udc_ctrl_update_stage(dev, buf); + + if (udc_ctrl_stage_is_data_out(dev)) { + /* Allocate and feed buffer for data OUT stage */ + LOG_DBG("s:%p|feed for -out-", buf); + err = usbd_ctrl_feed_dout(dev, udc_data_stage_length(buf)); + if (err == -ENOMEM) { + err = udc_submit_ep_event(dev, buf, err); + } + } else if (udc_ctrl_stage_is_data_in(dev)) { + /* Allocate buffer for Status OUT state */ + err = usb_dc_smartbond_alloc_status_out(dev); + if (err == -ENOMEM) { + err = udc_submit_ep_event(dev, buf, err); + } else { + err = udc_ctrl_submit_s_in_status(dev); + if (err == -ENOMEM) { + err = udc_submit_ep_event(dev, buf, err); + } + } + } else { + err = udc_ctrl_submit_s_status(dev); + } +} + +static int udc_smartbond_enable(const struct device *dev) +{ + struct usb_smartbond_data *data = udc_get_private(dev); + const struct udc_smartbond_config *config = dev->config; + + LOG_DBG("Enable UDC"); + + usb_change_state(data, true, data->vbus_present); + + if (udc_ep_enable_internal(dev, USB_CONTROL_EP_OUT, USB_EP_TYPE_CONTROL, 8, 0)) { + LOG_ERR("Failed to enable control endpoint"); + return -EIO; + } + + if (udc_ep_enable_internal(dev, USB_CONTROL_EP_IN, USB_EP_TYPE_CONTROL, 8, 0)) { + LOG_ERR("Failed to enable control endpoint"); + return -EIO; + } + + irq_enable(config->udc_irq); + + return 0; +} + +static int udc_smartbond_disable(const struct device *dev) +{ + struct usb_smartbond_data *data = udc_get_private(dev); + const struct udc_smartbond_config *config = dev->config; + + LOG_DBG("Disable UDC"); + + usb_change_state(data, false, data->vbus_present); + + irq_disable(config->udc_irq); + + return 0; +} + +/* + * Prepare and configure most of the parts, if the controller has a way + * of detecting VBUS activity it should be enabled here. + * Only udc_smartbond_enable() makes device visible to the host. + */ +static int udc_smartbond_init(const struct device *dev) +{ + struct usb_smartbond_data *data = udc_get_private(dev); + struct udc_data *udc_data = &data->udc_data; + const struct udc_smartbond_config *config = dev->config; + struct smartbond_ep_reg_set *reg_set = (struct smartbond_ep_reg_set *)&(USB->USB_EPC0_REG); + const uint16_t mps = 1023; + int err; + + data->dev = dev; + + k_mutex_init(&udc_data->mutex); + k_work_init(&data->ep0_setup_work, handle_ep0_setup_work); + k_work_init(&data->ep0_rx_work, handle_ep0_rx_work); + k_work_init(&data->ep0_tx_work, handle_ep0_tx_work); + + udc_data->caps.rwup = true; + udc_data->caps.mps0 = UDC_MPS0_8; + + for (int i = 0; i < config->num_of_eps; i++) { + data->ep_state[0][i].config.caps.out = 1; + if (i == 0) { + data->ep_state[0][i].config.caps.control = 1; + data->ep_state[0][i].config.caps.mps = 8; + } else { + data->ep_state[0][i].config.caps.bulk = 1; + data->ep_state[0][i].config.caps.interrupt = 1; + data->ep_state[0][i].config.caps.iso = 1; + data->ep_state[0][i].config.caps.mps = mps; + } + data->ep_state[0][i].config.addr = USB_EP_DIR_OUT | i; + err = udc_register_ep(dev, &data->ep_state[0][i].config); + if (err != 0) { + LOG_ERR("Failed to register endpoint"); + return err; + } + data->ep_state[0][i].regs = reg_set + i; + } + + for (int i = 0; i < config->num_of_eps; i++) { + data->ep_state[1][i].config.caps.in = 1; + if (i == 0) { + data->ep_state[1][i].config.caps.control = 1; + data->ep_state[1][i].config.caps.mps = 8; + } else { + data->ep_state[1][i].config.caps.bulk = 1; + data->ep_state[1][i].config.caps.interrupt = 1; + data->ep_state[1][i].config.caps.iso = 1; + data->ep_state[1][i].config.caps.mps = mps; + } + + data->ep_state[1][i].config.addr = USB_EP_DIR_IN | i; + err = udc_register_ep(dev, &data->ep_state[1][i].config); + if (err != 0) { + LOG_ERR("Failed to register endpoint"); + return err; + } + data->ep_state[1][i].regs = reg_set + i; + } + + CRG_TOP->VBUS_IRQ_CLEAR_REG = 1; + /* Both connect and disconnect needs to be handled */ + CRG_TOP->VBUS_IRQ_MASK_REG = CRG_TOP_VBUS_IRQ_MASK_REG_VBUS_IRQ_EN_FALL_Msk | + CRG_TOP_VBUS_IRQ_MASK_REG_VBUS_IRQ_EN_RISE_Msk; + NVIC_SetPendingIRQ(config->vbus_irq); + irq_enable(config->vbus_irq); + + return 0; +} + +static int udc_smartbond_lock(const struct device *dev) +{ + return udc_lock_internal(dev, K_FOREVER); +} + +static int udc_smartbond_unlock(const struct device *dev) +{ + return udc_unlock_internal(dev); +} + +static const struct udc_api udc_smartbond_api = { + .lock = udc_smartbond_lock, + .unlock = udc_smartbond_unlock, + .device_speed = udc_smartbond_device_speed, + .init = udc_smartbond_init, + .enable = udc_smartbond_enable, + .disable = udc_smartbond_disable, + .shutdown = udc_smartbond_shutdown, + .set_address = udc_smartbond_set_address, + .host_wakeup = udc_smartbond_host_wakeup, + .ep_enable = udc_smartbond_ep_enable, + .ep_disable = udc_smartbond_ep_disable, + .ep_set_halt = udc_smartbond_ep_set_halt, + .ep_clear_halt = udc_smartbond_ep_clear_halt, + .ep_enqueue = udc_smartbond_ep_enqueue, + .ep_dequeue = udc_smartbond_ep_dequeue, +}; + +#define DT_DRV_COMPAT renesas_smartbond_usbd + +#define UDC_IRQ(inst) DT_INST_IRQ_BY_IDX(inst, 0, irq) +#define UDC_IRQ_PRI(inst) DT_INST_IRQ_BY_IDX(inst, 0, priority) +#define VBUS_IRQ(inst) DT_INST_IRQ_BY_IDX(inst, 1, irq) +#define VBUS_IRQ_PRI(inst) DT_INST_IRQ_BY_IDX(inst, 1, priority) + +/* + * Minimal transfer size needed to use DMA. For short transfers + * it may be simpler to just fill hardware FIFO with data instead + * of programming DMA registers. + */ +#define DMA_MIN_TRANSFER_SIZE(inst) DT_INST_PROP(inst, dma_min_transfer_size) +#define FIFO_READ_THRESHOLD(inst) DT_INST_PROP(inst, fifo_read_threshold) + +#define UDC_SMARTBOND_DEVICE_DEFINE(n) \ + \ + static const struct udc_smartbond_config udc_smartbond_cfg_##n = { \ + .udc_irq = UDC_IRQ(n), \ + .vbus_irq = VBUS_IRQ(n), \ + .dma_min_transfer_size = DMA_MIN_TRANSFER_SIZE(n), \ + .fifo_read_threshold = FIFO_READ_THRESHOLD(n), \ + .fifo_read_threshold = FIFO_READ_THRESHOLD(n), \ + .num_of_eps = DT_INST_PROP(n, num_bidir_endpoints), \ + .dma_cfg = { \ + .tx_chan = DT_INST_DMAS_CELL_BY_NAME(n, tx, channel), \ + .tx_slot_mux = DT_INST_DMAS_CELL_BY_NAME(n, tx, config), \ + .tx_dev = DEVICE_DT_GET(DT_INST_DMAS_CTLR_BY_NAME(n, tx)), \ + .rx_chan = DT_INST_DMAS_CELL_BY_NAME(n, rx, channel), \ + .rx_slot_mux = DT_INST_DMAS_CELL_BY_NAME(n, rx, config), \ + .rx_dev = DEVICE_DT_GET(DT_INST_DMAS_CTLR_BY_NAME(n, rx)), \ + }, \ + }; \ + \ + static struct usb_smartbond_data udc_data_##n = { \ + .udc_data = { \ + .mutex = Z_MUTEX_INITIALIZER(udc_data_##n.udc_data.mutex), \ + .priv = &udc_data_##n, \ + }, \ + }; \ + \ + static int udc_smartbond_driver_preinit_##n(const struct device *dev) \ + { \ + IRQ_CONNECT(VBUS_IRQ(n), VBUS_IRQ_PRI(n), usb_dc_smartbond_vbus_isr, \ + &udc_data_##n, 0); \ + IRQ_CONNECT(UDC_IRQ(n), UDC_IRQ_PRI(n), udc_smartbond_isr, DEVICE_DT_INST_GET(n), \ + 0); \ + return 0; \ + } \ + \ + DEVICE_DT_INST_DEFINE(n, udc_smartbond_driver_preinit_##n, NULL, &udc_data_##n, \ + &udc_smartbond_cfg_##n, POST_KERNEL, \ + CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &udc_smartbond_api); + +DT_INST_FOREACH_STATUS_OKAY(UDC_SMARTBOND_DEVICE_DEFINE) diff --git a/dts/arm/renesas/smartbond/da1469x.dtsi b/dts/arm/renesas/smartbond/da1469x.dtsi index 6c561ea5745b7..92be5e4026f14 100644 --- a/dts/arm/renesas/smartbond/da1469x.dtsi +++ b/dts/arm/renesas/smartbond/da1469x.dtsi @@ -379,6 +379,8 @@ fifo-read-threshold = <4>; ep-out-buf-size = <8 64 64 64>; interrupts = <15 0>, <21 0>; + maximum-speed = "full-speed"; + num-bidir-endpoints = <4>; status = "disabled"; }; diff --git a/dts/bindings/usb/renesas,smartbond-usbd.yaml b/dts/bindings/usb/renesas,smartbond-usbd.yaml index a930f31c33afc..6e867fca03184 100644 --- a/dts/bindings/usb/renesas,smartbond-usbd.yaml +++ b/dts/bindings/usb/renesas,smartbond-usbd.yaml @@ -5,7 +5,7 @@ description: Renesas SmartBond USB device controller compatible: "renesas,smartbond-usbd" -include: usb-controller.yaml +include: usb-ep.yaml properties: dma-min-transfer-size: From 70364e8d466981fc5c6f27fac84abd61a3a72711 Mon Sep 17 00:00:00 2001 From: Jerzy Kasenberg Date: Thu, 3 Oct 2024 15:03:21 +0200 Subject: [PATCH 1309/4482] boards: renesas: Smartbond: Add test supported feature usbd Marks boards da1469x_dk_pro and da14695_dk_usb as supporting new usb driver support Signed-off-by: Jerzy Kasenberg --- boards/renesas/da14695_dk_usb/da14695_dk_usb.yaml | 1 + boards/renesas/da1469x_dk_pro/da1469x_dk_pro.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/boards/renesas/da14695_dk_usb/da14695_dk_usb.yaml b/boards/renesas/da14695_dk_usb/da14695_dk_usb.yaml index a98404244d496..b85aee119b6cf 100644 --- a/boards/renesas/da14695_dk_usb/da14695_dk_usb.yaml +++ b/boards/renesas/da14695_dk_usb/da14695_dk_usb.yaml @@ -14,3 +14,4 @@ supported: - i2c - spi - usb_device + - usbd diff --git a/boards/renesas/da1469x_dk_pro/da1469x_dk_pro.yaml b/boards/renesas/da1469x_dk_pro/da1469x_dk_pro.yaml index 942bfe3e07e5f..1d988ecbf57ff 100644 --- a/boards/renesas/da1469x_dk_pro/da1469x_dk_pro.yaml +++ b/boards/renesas/da1469x_dk_pro/da1469x_dk_pro.yaml @@ -22,4 +22,5 @@ supported: - mipi_dbi - display - memc + - usbd vendor: renesas From 96a17e2a0ff6f8539c69b12d2416e6f3fd7766d2 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sun, 22 Sep 2024 07:22:17 +0900 Subject: [PATCH 1310/4482] drivers: ethernet: Add dummy driver for vnd,ethernet Add dummy driver for "vnd,ethernet" to use in build_all tests. Signed-off-by: TOKITA Hiroshi --- drivers/ethernet/CMakeLists.txt | 3 +- drivers/ethernet/Kconfig | 1 + drivers/ethernet/Kconfig.test | 6 ++ drivers/ethernet/eth_test.c | 134 ++++++++++++++++++++++++++++ dts/bindings/test/vnd,ethernet.yaml | 8 ++ 5 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 drivers/ethernet/Kconfig.test create mode 100644 drivers/ethernet/eth_test.c create mode 100644 dts/bindings/test/vnd,ethernet.yaml diff --git a/drivers/ethernet/CMakeLists.txt b/drivers/ethernet/CMakeLists.txt index 40bb9d8da45a9..545187a6b2cf1 100644 --- a/drivers/ethernet/CMakeLists.txt +++ b/drivers/ethernet/CMakeLists.txt @@ -39,7 +39,8 @@ zephyr_library_sources_ifdef(CONFIG_ETH_SMSC91X eth_smsc91x.c) zephyr_library_sources_ifdef(CONFIG_ETH_IVSHMEM eth_ivshmem.c eth_ivshmem_queue.c) zephyr_library_sources_ifdef(CONFIG_ETH_ADIN2111 eth_adin2111.c) zephyr_library_sources_ifdef(CONFIG_ETH_LAN865X eth_lan865x.c oa_tc6.c) -zephyr_library_sources_ifdef(CONFIG_ETH_XMC4XXX eth_xmc4xxx.c) +zephyr_library_sources_ifdef(CONFIG_ETH_XMC4XXX eth_xmc4xxx.c) +zephyr_library_sources_ifdef(CONFIG_ETH_TEST eth_test.c) if(CONFIG_ETH_NXP_S32_NETC) zephyr_library_sources(eth_nxp_s32_netc.c) diff --git a/drivers/ethernet/Kconfig b/drivers/ethernet/Kconfig index ea9029eec509b..178733bd24792 100644 --- a/drivers/ethernet/Kconfig +++ b/drivers/ethernet/Kconfig @@ -74,6 +74,7 @@ source "drivers/ethernet/Kconfig.adin2111" source "drivers/ethernet/Kconfig.numaker" source "drivers/ethernet/Kconfig.lan865x" source "drivers/ethernet/Kconfig.xmc4xxx" +source "drivers/ethernet/Kconfig.test" source "drivers/ethernet/eth_nxp_enet_qos/Kconfig" diff --git a/drivers/ethernet/Kconfig.test b/drivers/ethernet/Kconfig.test new file mode 100644 index 0000000000000..4c06d9ef54a51 --- /dev/null +++ b/drivers/ethernet/Kconfig.test @@ -0,0 +1,6 @@ +# Copyright (c) 2024 TOKITA Hiroshi +# SPDX-License-Identifier: Apache-2.0 + +config ETH_TEST + def_bool DT_HAS_VND_ETHERNET_ENABLED + depends on DT_HAS_VND_ETHERNET_ENABLED diff --git a/drivers/ethernet/eth_test.c b/drivers/ethernet/eth_test.c new file mode 100644 index 0000000000000..56ae2e287f7dc --- /dev/null +++ b/drivers/ethernet/eth_test.c @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * This is not a real ethenet driver. It is used to instantiate struct + * devices for the "vnd,ethernet" devicetree compatible used in test code. + */ + +#include + +#define DT_DRV_COMPAT vnd_ethernet + +#if defined(CONFIG_NET_STATISTICS_ETHERNET) +struct net_stats_eth *vnd_ethernet_get_stats(const struct device *dev); +{ + ARG_UNUSED(dev); + + return NULL; +} + +#endif +int vnd_ethernet_start(const struct device *dev) +{ + ARG_UNUSED(dev); + + return -ENOTSUP; +} + +int vnd_ethernet_stop(const struct device *dev) +{ + ARG_UNUSED(dev); + + return -ENOTSUP; +} + +enum ethernet_hw_caps vnd_ethernet_get_capabilities(const struct device *dev) +{ + ARG_UNUSED(dev); + + return 0; +} + +int vnd_ethernet_set_config(const struct device *dev, enum ethernet_config_type type, + const struct ethernet_config *config) +{ + ARG_UNUSED(dev); + ARG_UNUSED(type); + ARG_UNUSED(config); + + return -ENOTSUP; +} + +int vnd_ethernet_get_config(const struct device *dev, enum ethernet_config_type type, + struct ethernet_config *config) +{ + ARG_UNUSED(dev); + ARG_UNUSED(type); + ARG_UNUSED(config); + + return -ENOTSUP; +} + +#if defined(CONFIG_NET_VLAN) +int vnd_ethernet_vlan_setup(const struct device *dev, struct net_if *iface, uint16_t tag, + bool enable) +{ + ARG_UNUSED(dev); + ARG_UNUSED(iface); + ARG_UNUSED(tag); + ARG_UNUSED(enable); + + return -ENOTSUP; +} + +#endif /* CONFIG_NET_VLAN */ + +#if defined(CONFIG_PTP_CLOCK) +const struct device *vnd_ethernet_get_ptp_clock(const struct device *dev) +{ + ARG_UNUSED(dev); + + return NULL; +} + +#endif /* CONFIG_PTP_CLOCK */ +const struct device *vnd_ethernet_get_phy(const struct device *dev) +{ + ARG_UNUSED(dev); + + return NULL; +} + +int vnd_ethernet_send(const struct device *dev, struct net_pkt *pkt) +{ + ARG_UNUSED(dev); + ARG_UNUSED(pkt); + + return -ENOTSUP; +} + +void vnd_ethernet_init(struct net_if *iface) +{ + ARG_UNUSED(iface); +} + +struct ethernet_api vnd_ethernet_api = { + .iface_api.init = vnd_ethernet_init, +#if defined(CONFIG_NET_STATISTICS_ETHERNET) + .get_stats = vnd_ethernet_get_stats, +#endif + .start = vnd_ethernet_start, + .stop = vnd_ethernet_stop, + .get_capabilities = vnd_ethernet_get_capabilities, + .set_config = vnd_ethernet_set_config, + .get_config = vnd_ethernet_get_config, +#if defined(CONFIG_NET_VLAN) + .vlan_setup = vnd_ethernet_vlan_setup, +#endif /* CONFIG_NET_VLAN */ + +#if defined(CONFIG_PTP_CLOCK) + .get_ptp_clock = vnd_ethernet_get_ptp_clock, +#endif /* CONFIG_PTP_CLOCK */ + .get_phy = vnd_ethernet_get_phy, + .send = vnd_ethernet_send, +}; + +#define VND_ETHERNET_INIT(n) \ + DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, NULL, POST_KERNEL, CONFIG_ETH_INIT_PRIORITY, \ + &vnd_ethernet_api); + +DT_INST_FOREACH_STATUS_OKAY(VND_ETHERNET_INIT) diff --git a/dts/bindings/test/vnd,ethernet.yaml b/dts/bindings/test/vnd,ethernet.yaml new file mode 100644 index 0000000000000..a9714eac14e76 --- /dev/null +++ b/dts/bindings/test/vnd,ethernet.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2024 TOKITA Hiroshi +# SPDX-License-Identifier: Apache-2.0 + +description: Test Ethernet node + +compatible: "vnd,ethernet" + +include: ethernet-controller.yaml From e78811bcd6d028437112ba24e237e1ac58094345 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Tue, 17 Sep 2024 10:00:23 +0900 Subject: [PATCH 1311/4482] tests: drivers: build_all: ethernet: Add devices build tests Add build tests for following devices. - microchip,ksz8081 - realtek,rtl8211f - nxp,tja1103 - microchip,lan865x Signed-off-by: TOKITA Hiroshi --- tests/drivers/build_all/ethernet/app.overlay | 55 +++++++++++++++++++ tests/drivers/build_all/ethernet/prj.conf | 1 + .../build_all/ethernet/spi_devices.overlay | 17 ++++++ .../drivers/build_all/ethernet/testcase.yaml | 1 + 4 files changed, 74 insertions(+) create mode 100644 tests/drivers/build_all/ethernet/app.overlay diff --git a/tests/drivers/build_all/ethernet/app.overlay b/tests/drivers/build_all/ethernet/app.overlay new file mode 100644 index 0000000000000..98c3b89b2ac43 --- /dev/null +++ b/tests/drivers/build_all/ethernet/app.overlay @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + test { + #address-cells = <1>; + #size-cells = <1>; + + test_gpio: gpio@deadbeef { + compatible = "vnd,gpio"; + gpio-controller; + reg = <0xdeadbeef 0x1000>; + #gpio-cells = <0x2>; + status = "okay"; + }; + + test_ethernet: ethernet { + compatible = "vnd,ethernet"; + + test_mdio: mdio { + compatible = "zephyr,mdio-gpio"; + mdc-gpios = <&test_gpio 0 0>; + mdio-gpios = <&test_gpio 0 0>; + + #address-cells = <1>; + #size-cells = <0>; + + ethernet-phy@0 { + reg = <0x0>; + compatible = "realtek,rtl8211f"; + status = "okay"; + }; + + ethernet-phy@1 { + reg = <0x1>; + compatible = "nxp,tja1103"; + status = "okay"; + int-gpios = <&test_gpio 0 0>; + master-slave = "slave"; + }; + + ethernet-phy@2 { + reg = <0x2>; + compatible = "microchip,ksz8081"; + status = "okay"; + reset-gpios = <&test_gpio 0 0>; + int-gpios = <&test_gpio 0 0>; + microchip,interface-type = "rmii"; + }; + }; + }; + }; +}; diff --git a/tests/drivers/build_all/ethernet/prj.conf b/tests/drivers/build_all/ethernet/prj.conf index 938aa284a4321..65c7588e390ac 100644 --- a/tests/drivers/build_all/ethernet/prj.conf +++ b/tests/drivers/build_all/ethernet/prj.conf @@ -18,6 +18,7 @@ CONFIG_NET_PKT_BUF_TX_DATA_POOL_SIZE=4096 CONFIG_NET_L2_ETHERNET=n CONFIG_GPIO=y +CONFIG_MDIO=y CONFIG_SPI_INIT_PRIORITY=50 CONFIG_ETH_INIT_PRIORITY=50 diff --git a/tests/drivers/build_all/ethernet/spi_devices.overlay b/tests/drivers/build_all/ethernet/spi_devices.overlay index a80c949e03613..3d1285b3c0ed6 100644 --- a/tests/drivers/build_all/ethernet/spi_devices.overlay +++ b/tests/drivers/build_all/ethernet/spi_devices.overlay @@ -36,6 +36,7 @@ <&test_gpio 0 0>, <&test_gpio 0 0>, <&test_gpio 0 0>, + <&test_gpio 0 0>, <&test_gpio 0 0>; test_spi_enc28j60: enc28j60@0 { @@ -120,6 +121,22 @@ }; }; }; + + test_spi_lan865x: lan865x@5 { + compatible = "microchip,lan865x"; + reg = <0x5>; + spi-max-frequency = <0>; + int-gpios = <&test_gpio 0 0>; + rst-gpios = <&test_gpio 0 0>; + + plca-node-id = <0>; + plca-node-count = <1>; + plca-burst-count = <1>; + plca-burst-timer = <1>; + plca-to-timer = <1>; + + local-mac-address = [00 00 00 01 02 03]; + }; }; }; }; diff --git a/tests/drivers/build_all/ethernet/testcase.yaml b/tests/drivers/build_all/ethernet/testcase.yaml index 623e1cb00ee5c..f4b66e3c9a94a 100644 --- a/tests/drivers/build_all/ethernet/testcase.yaml +++ b/tests/drivers/build_all/ethernet/testcase.yaml @@ -12,6 +12,7 @@ tests: extra_args: DTC_OVERLAY_FILE="spi_devices.overlay" extra_configs: - CONFIG_SPI=y + - CONFIG_NET_L2_ETHERNET=y platform_allow: - native_sim - native_sim/native/64 From 15ec1f201610df725d5c42f616ee0712b58b6022 Mon Sep 17 00:00:00 2001 From: Dimitrije Lilic Date: Thu, 12 Sep 2024 15:44:22 +0200 Subject: [PATCH 1312/4482] driver: spi: MAX32 add RTIO support plus refactor Implements the SPIO RTIO API. Refactors internal transcive fucntios to work with both existing SPI API and RTIO functions. When SPI_RTIO is enabled the spi_transcieve call translates the request into an RTIO transaction placed in the queue that device will execute. Include the latest refacor changes of RTIO. Signed-off-by: Dimitrije Lilic --- drivers/spi/Kconfig.max32 | 24 +++++ drivers/spi/spi_max32.c | 181 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 198 insertions(+), 7 deletions(-) diff --git a/drivers/spi/Kconfig.max32 b/drivers/spi/Kconfig.max32 index 0f9e4082862f0..13584e984d9ae 100644 --- a/drivers/spi/Kconfig.max32 +++ b/drivers/spi/Kconfig.max32 @@ -23,4 +23,28 @@ config SPI_MAX32_DMA help Enable DMA support for MAX32 MCU SPI driver. +config SPI_MAX32_RTIO + bool "MAX32 SPI RTIO Support" + default y if SPI_RTIO + depends on !SPI_ASYNC + select SPI_MAX32_INTERRUPT + +if SPI_MAX32_RTIO +config SPI_MAX32_RTIO_SQ_SIZE + int "Number of available submission queue entries" + default 8 # Sensible default that covers most common spi transactions + help + When RTIO is used with SPI, each driver holds a context with which blocking + API calls use to perform SPI transactions. This queue needs to be as deep + as the longest set of spi_buf_sets used, where normal SPI operations are + used (equal length buffers). It may need to be slightly deeper where the + spi buffer sets for transmit/receive are not always matched equally in + length as these are transformed into normal transceives. + +config SPI_MAX32_RTIO_CQ_SIZE + int "Number of available completion queue entries" + default 8 # Sensible default that covers most common spi transactions + +endif # SPI_MAX32_RTIO + endif # SPI_MAX32 diff --git a/drivers/spi/spi_max32.c b/drivers/spi/spi_max32.c index d0238c260ff7a..efa1024761e4a 100644 --- a/drivers/spi/spi_max32.c +++ b/drivers/spi/spi_max32.c @@ -17,6 +17,10 @@ #include #include #include +#include +#include +#include +#include #include @@ -51,12 +55,18 @@ struct max32_spi_data { const struct device *dev; mxc_spi_req_t req; uint8_t dummy[2]; + #ifdef CONFIG_SPI_MAX32_DMA volatile uint8_t dma_stat; #endif /* CONFIG_SPI_MAX32_DMA */ + #ifdef CONFIG_SPI_ASYNC struct k_work async_work; #endif /* CONFIG_SPI_ASYNC */ + +#ifdef CONFIG_SPI_RTIO + struct spi_rtio *rtio_ctx; +#endif }; #ifdef CONFIG_SPI_MAX32_DMA @@ -234,6 +244,10 @@ static int spi_max32_transceive(const struct device *dev) const struct max32_spi_config *cfg = dev->config; struct max32_spi_data *data = dev->data; struct spi_context *ctx = &data->ctx; +#ifdef CONFIG_SPI_RTIO + struct spi_rtio *rtio_ctx = data->rtio_ctx; + struct rtio_sqe *sqe = &rtio_ctx->txn_curr->sqe; +#endif uint32_t len; uint8_t dfs_shift; @@ -242,12 +256,48 @@ static int spi_max32_transceive(const struct device *dev) dfs_shift = spi_max32_get_dfs_shift(ctx); len = spi_context_max_continuous_chunk(ctx); + +#ifdef CONFIG_SPI_RTIO + switch (sqe->op) { + case RTIO_OP_RX: + len = sqe->rx.buf_len; + data->req.rxData = sqe->rx.buf; + data->req.rxLen = sqe->rx.buf_len; + data->req.txData = NULL; + data->req.txLen = len >> dfs_shift; + break; + case RTIO_OP_TX: + len = sqe->tx.buf_len; + data->req.rxLen = 0; + data->req.rxData = data->dummy; + data->req.txData = (uint8_t *)sqe->tx.buf; + data->req.txLen = len >> dfs_shift; + break; + case RTIO_OP_TINY_TX: + len = sqe->tiny_tx.buf_len; + data->req.txData = (uint8_t *)sqe->tiny_tx.buf; + data->req.rxData = data->dummy; + data->req.txLen = len >> dfs_shift; + data->req.rxLen = 0; + break; + case RTIO_OP_TXRX: + len = sqe->txrx.buf_len; + data->req.txData = (uint8_t *)sqe->txrx.tx_buf; + data->req.rxData = sqe->txrx.rx_buf; + data->req.txLen = len >> dfs_shift; + data->req.rxLen = len >> dfs_shift; + break; + default: + break; + } +#else data->req.txLen = len >> dfs_shift; data->req.txData = (uint8_t *)ctx->tx_buf; data->req.rxLen = len >> dfs_shift; data->req.rxData = ctx->rx_buf; data->req.rxData = ctx->rx_buf; + data->req.rxLen = len >> dfs_shift; if (!data->req.rxData) { /* Pass a dummy buffer to HAL if receive buffer is NULL, otherwise @@ -256,6 +306,7 @@ static int spi_max32_transceive(const struct device *dev) data->req.rxData = data->dummy; data->req.rxLen = 0; } +#endif data->req.spi = cfg->regs; data->req.ssIdx = ctx->config->slave; data->req.ssDeassert = 0; @@ -296,10 +347,12 @@ static int transceive(const struct device *dev, const struct spi_config *config, bool async, spi_callback_t cb, void *userdata) { int ret = 0; - const struct max32_spi_config *cfg = dev->config; struct max32_spi_data *data = dev->data; struct spi_context *ctx = &data->ctx; +#ifndef CONFIG_SPI_RTIO + const struct max32_spi_config *cfg = dev->config; bool hw_cs_ctrl = true; +#endif #ifndef CONFIG_SPI_MAX32_INTERRUPT if (async) { @@ -309,6 +362,7 @@ static int transceive(const struct device *dev, const struct spi_config *config, spi_context_lock(ctx, async, cb, userdata, config); +#ifndef CONFIG_SPI_RTIO ret = spi_configure(dev, config); if (ret != 0) { spi_context_release(ctx, ret); @@ -363,9 +417,12 @@ static int transceive(const struct device *dev, const struct spi_config *config, cfg->regs->ctrl0 |= MXC_F_SPI_CTRL0_EN; } } +#else + struct spi_rtio *rtio_ctx = data->rtio_ctx; + ret = spi_rtio_transceive(rtio_ctx, config, tx_bufs, rx_bufs); +#endif spi_context_release(ctx, ret); - return ret; } @@ -565,6 +622,99 @@ static int transceive_dma(const struct device *dev, const struct spi_config *con } #endif /* CONFIG_SPI_MAX32_DMA */ +#ifdef CONFIG_SPI_RTIO +static void spi_max32_iodev_complete(const struct device *dev, int status); + +static void spi_max32_iodev_start(const struct device *dev) +{ + struct max32_spi_data *data = dev->data; + struct spi_rtio *rtio_ctx = data->rtio_ctx; + struct rtio_sqe *sqe = &rtio_ctx->txn_curr->sqe; + int ret = 0; + + switch (sqe->op) { + case RTIO_OP_RX: + case RTIO_OP_TX: + case RTIO_OP_TINY_TX: + case RTIO_OP_TXRX: + ret = spi_max32_transceive(dev); + break; + default: + spi_max32_iodev_complete(dev, -EINVAL); + break; + } + if (ret != 0) { + spi_max32_iodev_complete(dev, -EIO); + } +} + +static inline void spi_max32_iodev_prepare_start(const struct device *dev) +{ + struct max32_spi_data *data = dev->data; + struct spi_rtio *rtio_ctx = data->rtio_ctx; + struct spi_dt_spec *spi_dt_spec = rtio_ctx->txn_curr->sqe.iodev->data; + struct spi_config *spi_config = &spi_dt_spec->config; + struct max32_spi_config *cfg = (struct max32_spi_config *)dev->config; + int ret; + bool hw_cs_ctrl = true; + + ret = spi_configure(dev, spi_config); + __ASSERT(!ret, "%d", ret); + + /* Check if CS GPIO exists */ + if (spi_cs_is_gpio(spi_config)) { + hw_cs_ctrl = false; + } + MXC_SPI_HWSSControl(cfg->regs, hw_cs_ctrl); + + /* Assert the CS line if HW control disabled */ + if (!hw_cs_ctrl) { + spi_context_cs_control(&data->ctx, true); + } else { + cfg->regs->ctrl0 = (cfg->regs->ctrl0 & ~MXC_F_SPI_CTRL0_START) | + MXC_F_SPI_CTRL0_SS_CTRL; + }; +} + +static void spi_max32_iodev_complete(const struct device *dev, int status) +{ + struct max32_spi_data *data = dev->data; + struct spi_rtio *rtio_ctx = data->rtio_ctx; + + if (!status && rtio_ctx->txn_curr->sqe.flags & RTIO_SQE_TRANSACTION) { + rtio_ctx->txn_curr = rtio_txn_next(rtio_ctx->txn_curr); + spi_max32_iodev_start(dev); + } else { + struct max32_spi_config *cfg = (struct max32_spi_config *)dev->config; + bool hw_cs_ctrl = true; + + if (!hw_cs_ctrl) { + spi_context_cs_control(&data->ctx, false); + } else { + cfg->regs->ctrl0 &= ~(MXC_F_SPI_CTRL0_START | MXC_F_SPI_CTRL0_SS_CTRL | + MXC_F_SPI_CTRL0_EN); + cfg->regs->ctrl0 |= MXC_F_SPI_CTRL0_EN; + } + + if (spi_rtio_complete(rtio_ctx, status)) { + spi_max32_iodev_prepare_start(dev); + spi_max32_iodev_start(dev); + } + } +} + +static void api_iodev_submit(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe) +{ + struct max32_spi_data *data = dev->data; + struct spi_rtio *rtio_ctx = data->rtio_ctx; + + if (spi_rtio_submit(rtio_ctx, iodev_sqe)) { + spi_max32_iodev_prepare_start(dev); + spi_max32_iodev_start(dev); + } +} +#endif + static int api_transceive(const struct device *dev, const struct spi_config *config, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs) { @@ -596,6 +746,13 @@ static void spi_max32_callback(mxc_spi_req_t *req, int error) const struct device *dev = data->dev; uint32_t len; +#ifdef CONFIG_SPI_RTIO + struct spi_rtio *rtio_ctx = data->rtio_ctx; + + if (rtio_ctx->txn_head != NULL) { + spi_max32_iodev_complete(data->dev, 0); + } +#endif len = spi_context_max_continuous_chunk(ctx); spi_context_update_tx(ctx, 1, len); spi_context_update_rx(ctx, 1, len); @@ -685,12 +842,12 @@ static int api_release(const struct device *dev, const struct spi_config *config { struct max32_spi_data *data = dev->data; +#ifndef CONFIG_SPI_RTIO if (!spi_context_configured(&data->ctx, config)) { return -EINVAL; } - +#endif spi_context_unlock_unconditionally(&data->ctx); - return 0; } @@ -724,6 +881,10 @@ static int spi_max32_init(const struct device *dev) data->dev = dev; +#ifdef CONFIG_SPI_RTIO + spi_rtio_init(data->rtio_ctx, dev); +#endif + #ifdef CONFIG_SPI_MAX32_INTERRUPT cfg->irq_config_func(dev); #ifdef CONFIG_SPI_ASYNC @@ -743,8 +904,8 @@ static const struct spi_driver_api spi_max32_api = { .transceive_async = api_transceive_async, #endif /* CONFIG_SPI_ASYNC */ #ifdef CONFIG_SPI_RTIO - .iodev_submit = spi_rtio_iodev_default_submit, -#endif + .iodev_submit = api_iodev_submit, +#endif /* CONFIG_SPI_RTIO */ .release = api_release, }; @@ -784,9 +945,14 @@ static const struct spi_driver_api spi_max32_api = { #define MAX32_SPI_DMA_INIT(n) #endif +#define DEFINE_SPI_MAX32_RTIO(_num) SPI_RTIO_DEFINE(max32_spi_rtio_##_num, \ + CONFIG_SPI_MAX32_RTIO_SQ_SIZE, \ + CONFIG_SPI_MAX32_RTIO_CQ_SIZE) + #define DEFINE_SPI_MAX32(_num) \ PINCTRL_DT_INST_DEFINE(_num); \ SPI_MAX32_IRQ_CONFIG_FUNC(_num) \ + COND_CODE_1(CONFIG_SPI_RTIO, (DEFINE_SPI_MAX32_RTIO(_num)), ()); \ static const struct max32_spi_config max32_spi_config_##_num = { \ .regs = (mxc_spi_regs_t *)DT_INST_REG_ADDR(_num), \ .pctrl = PINCTRL_DT_INST_DEV_CONFIG_GET(_num), \ @@ -797,7 +963,8 @@ static const struct spi_driver_api spi_max32_api = { static struct max32_spi_data max32_spi_data_##_num = { \ SPI_CONTEXT_INIT_LOCK(max32_spi_data_##_num, ctx), \ SPI_CONTEXT_INIT_SYNC(max32_spi_data_##_num, ctx), \ - SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(_num), ctx)}; \ + SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(_num), ctx) \ + IF_ENABLED(CONFIG_SPI_RTIO, (.rtio_ctx = &max32_spi_rtio_##_num))}; \ DEVICE_DT_INST_DEFINE(_num, spi_max32_init, NULL, &max32_spi_data_##_num, \ &max32_spi_config_##_num, PRE_KERNEL_2, CONFIG_SPI_INIT_PRIORITY, \ &spi_max32_api); From 2507752d7f065f2b93a322bef5ccb8779bfcce4a Mon Sep 17 00:00:00 2001 From: Dimitrije Lilic Date: Thu, 12 Sep 2024 15:55:17 +0200 Subject: [PATCH 1313/4482] tests: drivers: spi: spi_loopback: Support RTIO tests for APARD32690 Add overlay for APARD32690 board and add a new test case to test RTIO functionalities of SPI MAX32 driver. Signed-off-by: Dimitrije Lilic --- .../boards/apard32690_max32690_m4.overlay | 19 +++++++++++++++++++ .../spi_loopback/overlay-max32-spi-rtio.conf | 7 +++++++ tests/drivers/spi/spi_loopback/testcase.yaml | 6 ++++++ 3 files changed, 32 insertions(+) create mode 100644 tests/drivers/spi/spi_loopback/boards/apard32690_max32690_m4.overlay create mode 100644 tests/drivers/spi/spi_loopback/overlay-max32-spi-rtio.conf diff --git a/tests/drivers/spi/spi_loopback/boards/apard32690_max32690_m4.overlay b/tests/drivers/spi/spi_loopback/boards/apard32690_max32690_m4.overlay new file mode 100644 index 0000000000000..0a3dbc158db31 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/apard32690_max32690_m4.overlay @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +arduino_spi: &spi1 { + status = "okay"; + slow@0 { + compatible = "test-spi-loopback-slow"; + reg = <0>; + spi-max-frequency = <128000>; + }; + fast@0 { + compatible = "test-spi-loopback-fast"; + reg = <0>; + spi-max-frequency = <500000>; + }; +}; diff --git a/tests/drivers/spi/spi_loopback/overlay-max32-spi-rtio.conf b/tests/drivers/spi/spi_loopback/overlay-max32-spi-rtio.conf new file mode 100644 index 0000000000000..dcf44166a3b7a --- /dev/null +++ b/tests/drivers/spi/spi_loopback/overlay-max32-spi-rtio.conf @@ -0,0 +1,7 @@ +# +# Copyright (c) 2024 Analog Devices, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +CONFIG_SPI_RTIO=y +CONFIG_SPI_ASYNC=n diff --git a/tests/drivers/spi/spi_loopback/testcase.yaml b/tests/drivers/spi/spi_loopback/testcase.yaml index 3087e65c640d2..5ed122bfd0196 100644 --- a/tests/drivers/spi/spi_loopback/testcase.yaml +++ b/tests/drivers/spi/spi_loopback/testcase.yaml @@ -210,3 +210,9 @@ tests: platform_allow: - s32z2xxdc2/s32z270/rtu0 - s32z2xxdc2/s32z270/rtu1 + drivers.spi.max32_spi_rtio.loopback: + extra_args: + - OVERLAY_CONFIG="overlay-max32-spi-rtio.conf" + filter: CONFIG_SOC_FAMILY_MAX32 + platform_allow: + - apard32690/max32690/m4 From 80e99dcb46f13e1f761feadd37a1f4884ba42003 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Mon, 29 Jul 2024 16:39:49 +1000 Subject: [PATCH 1314/4482] gnss: API for retrieving PPS timestamp Add an API function for retrieving the timestamp of the latest PPS timepulse at the highest resolution we have available, the kernel tick count. Signed-off-by: Jordan Yates --- include/zephyr/drivers/gnss.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/include/zephyr/drivers/gnss.h b/include/zephyr/drivers/gnss.h index 2596e4f7fa215..c5d2b9174cc48 100644 --- a/include/zephyr/drivers/gnss.h +++ b/include/zephyr/drivers/gnss.h @@ -21,6 +21,7 @@ * @{ */ +#include #include #include #include @@ -100,6 +101,9 @@ typedef int (*gnss_get_enabled_systems_t)(const struct device *dev, gnss_systems /** API for getting enabled systems */ typedef int (*gnss_get_supported_systems_t)(const struct device *dev, gnss_systems_t *systems); +/** API for getting timestamp of last PPS pulse */ +typedef int (*gnss_get_latest_timepulse_t)(const struct device *dev, k_ticks_t *timestamp); + /** GNSS fix status */ enum gnss_fix_status { /** No GNSS fix acquired */ @@ -167,6 +171,7 @@ __subsystem struct gnss_driver_api { gnss_set_enabled_systems_t set_enabled_systems; gnss_get_enabled_systems_t get_enabled_systems; gnss_get_supported_systems_t get_supported_systems; + gnss_get_latest_timepulse_t get_latest_timepulse; }; /** GNSS data structure */ @@ -380,6 +385,33 @@ static inline int z_impl_gnss_get_supported_systems(const struct device *dev, return api->get_supported_systems(dev, systems); } +/** + * @brief Get the timestamp of the latest PPS timepulse + * + * @note The timestamp is considered valid when the timepulse pin is actively toggling. + * + * @param dev Device instance + * @param timestamp Kernel tick count at the time of the PPS pulse + * + * @retval 0 if successful + * @retval -ENOSYS if driver does not support API + * @retval -ENOTSUP if driver does not have PPS pin connected + * @retval -EAGAIN if PPS pulse is not considered valid + */ +__syscall int gnss_get_latest_timepulse(const struct device *dev, k_ticks_t *timestamp); + +static inline int z_impl_gnss_get_latest_timepulse(const struct device *dev, + k_ticks_t *timestamp) +{ + const struct gnss_driver_api *api = (const struct gnss_driver_api *)dev->api; + + if (api->get_latest_timepulse == NULL) { + return -ENOSYS; + } + + return api->get_latest_timepulse(dev, timestamp); +} + /** * @brief Register a callback structure for GNSS data published * From 69b73ebb0ab9b85fd2f219fa6ca1e135ba58ac88 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Tue, 30 Jul 2024 11:06:50 +1000 Subject: [PATCH 1315/4482] samples: gnss: add timepulse support Output the timestamp of the PPS timepulse when printing the fix information, if the driver support the timepulse and it has started toggling. Signed-off-by: Jordan Yates --- samples/drivers/gnss/src/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/samples/drivers/gnss/src/main.c b/samples/drivers/gnss/src/main.c index 06eacb2843dbc..703595ab0e11d 100644 --- a/samples/drivers/gnss/src/main.c +++ b/samples/drivers/gnss/src/main.c @@ -15,8 +15,16 @@ LOG_MODULE_REGISTER(gnss_sample, CONFIG_GNSS_LOG_LEVEL); static void gnss_data_cb(const struct device *dev, const struct gnss_data *data) { + uint64_t timepulse_ns; + k_ticks_t timepulse; + if (data->info.fix_status != GNSS_FIX_STATUS_NO_FIX) { - printf("Got a fix!\n"); + if (gnss_get_latest_timepulse(dev, &timepulse) == 0) { + timepulse_ns = k_ticks_to_ns_near64(timepulse); + printf("Got a fix @ %lld ns\n", timepulse_ns); + } else { + printf("Got a fix!\n"); + } } } GNSS_DATA_CALLBACK_DEFINE(GNSS_MODEM, gnss_data_cb); From 3d7852418640031e43bbe9acd767264775769f67 Mon Sep 17 00:00:00 2001 From: Dmitrii Golovanov Date: Tue, 22 Oct 2024 16:42:21 +0200 Subject: [PATCH 1316/4482] ci: footprint: Fix missing globstar Add missing globstar wildcard option. Set bash as default shell for the workflow. Signed-off-by: Dmitrii Golovanov --- .github/workflows/footprint-tracking.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/footprint-tracking.yml b/.github/workflows/footprint-tracking.yml index bcdc0371e7471..dc3d9974952e1 100644 --- a/.github/workflows/footprint-tracking.yml +++ b/.github/workflows/footprint-tracking.yml @@ -28,6 +28,9 @@ jobs: container: image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.26.14.20240823 options: '--entrypoint /bin/bash' + defaults: + run: + shell: bash strategy: fail-fast: false env: @@ -95,7 +98,6 @@ jobs: aws s3 sync --quiet footprint_data/ s3://testing.zephyrproject.org/footprint_data/ - name: Transform Footprint data to Twister JSON reports - shell: bash run: | shopt -s globstar export ZEPHYR_BASE=${PWD} @@ -110,6 +112,7 @@ jobs: ELASTICSEARCH_SERVER: "https://elasticsearch.zephyrproject.io:443" ELASTICSEARCH_INDEX: ${{ vars.FOOTPRINT_TRACKING_INDEX }} run: | + shopt -s globstar pip3 install -U elasticsearch run_date=`date --iso-8601=minutes` python3 ./scripts/ci/upload_test_results_es.py -r ${run_date} \ From 4c77129995857adbc8959d7ca3d1becd85a3e781 Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Fri, 18 Oct 2024 17:01:36 -0500 Subject: [PATCH 1317/4482] boards: shields: Add EVAL-ADXL362-ARDZ accelerometer shield Adds a new shield definition for the Analog Devices EVAL-ADXL362-ARDZ accelerometer shield. This shield provides support for an ADI ADXL362 3-axis accelerometer over an Arduino SPI connector. Signed-off-by: Maureen Helm --- .../shields/eval_adxl362_ardz/Kconfig.shield | 5 ++ .../boards/apard32690_max32690_m4.overlay | 11 ++++ .../shields/eval_adxl362_ardz/doc/index.rst | 52 +++++++++++++++++++ .../eval_adxl362_ardz.overlay | 17 ++++++ 4 files changed, 85 insertions(+) create mode 100644 boards/shields/eval_adxl362_ardz/Kconfig.shield create mode 100644 boards/shields/eval_adxl362_ardz/boards/apard32690_max32690_m4.overlay create mode 100644 boards/shields/eval_adxl362_ardz/doc/index.rst create mode 100644 boards/shields/eval_adxl362_ardz/eval_adxl362_ardz.overlay diff --git a/boards/shields/eval_adxl362_ardz/Kconfig.shield b/boards/shields/eval_adxl362_ardz/Kconfig.shield new file mode 100644 index 0000000000000..031c345841e07 --- /dev/null +++ b/boards/shields/eval_adxl362_ardz/Kconfig.shield @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Analog Devices, Inc. +# SPDX-License-Identifier: Apache-2.0 + +config SHIELD_EVAL_ADXL362_ARDZ + def_bool $(shields_list_contains,eval_adxl362_ardz) diff --git a/boards/shields/eval_adxl362_ardz/boards/apard32690_max32690_m4.overlay b/boards/shields/eval_adxl362_ardz/boards/apard32690_max32690_m4.overlay new file mode 100644 index 0000000000000..384cb5ecb6d97 --- /dev/null +++ b/boards/shields/eval_adxl362_ardz/boards/apard32690_max32690_m4.overlay @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + aliases { + accel0 = &adxl362_eval_adxl362_ardz; + }; +}; diff --git a/boards/shields/eval_adxl362_ardz/doc/index.rst b/boards/shields/eval_adxl362_ardz/doc/index.rst new file mode 100644 index 0000000000000..68c7d479690a9 --- /dev/null +++ b/boards/shields/eval_adxl362_ardz/doc/index.rst @@ -0,0 +1,52 @@ +.. eval_adxl362_ardz: + +EVAL-ADXL362-ARDZ +################# + +Overview +******** + +The EVAL-ADXL362-ARDZ is a 3-axis digital accelerometer Arduino shield powered +by the Analog Devices ADXL362. + +Programming +*********** + +Set ``--shield eval_adxl362_ardz`` when you invoke ``west build``. For example: + +.. zephyr-app-commands:: + :zephyr-app: samples/sensor/sensor_shell + :board: apard32690/max32690/m4 + :shield: eval_adxl362_ardz + :goals: build + +Requirements +************ + +This shield can only be used with a board which provides a configuration for +Arduino connectors and defines node aliases for SPI and GPIO interfaces (see +:ref:`shields` for more details). + +References +********** + +- `EVAL-ADXL362-ARDZ product page`_ +- `EVAL-ADXL362-ARDZ user guide`_ +- `EVAL-ADXL362-ARDZ schematic`_ +- `ADXL362 product page`_ +- `ADXL362 data sheet`_ + +.. _EVAL-ADXL362-ARDZ product page: + https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/eval-adxl362-ardz.html + +.. _EVAL-ADXL362-ARDZ user guide: + https://wiki.analog.com/resources/eval/user-guides/eval-adicup360/hardware/adxl362 + +.. _EVAL-ADXL362-ARDZ schematic: + https://www.analog.com/media/en/reference-design-documentation/design-integration-files/eval-adxl362-ardz-designsupport.zip + +.. _ADXL362 product page: + https://www.analog.com/en/products/adxl362.html + +.. _ADXL362 data sheet: + https://www.analog.com/media/en/technical-documentation/data-sheets/adxl362.pdf diff --git a/boards/shields/eval_adxl362_ardz/eval_adxl362_ardz.overlay b/boards/shields/eval_adxl362_ardz/eval_adxl362_ardz.overlay new file mode 100644 index 0000000000000..d5b63252656d5 --- /dev/null +++ b/boards/shields/eval_adxl362_ardz/eval_adxl362_ardz.overlay @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&arduino_spi { + status = "okay"; + + adxl362_eval_adxl362_ardz: adxl362@0 { + compatible = "adi,adxl362"; + reg = <0x0>; + spi-max-frequency = ; + int1-gpios = <&arduino_header 8 GPIO_ACTIVE_HIGH>; + status = "okay"; + }; +}; From fe9bfe533561246c6b507d1c7f071dd5310e8ae4 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Fri, 18 Oct 2024 18:32:15 +0000 Subject: [PATCH 1318/4482] doc: sign: minor rimage update following imgtool removal Fixes commit 1df078158fc7 ("doc: build: Add signing page") that removed the `imgtool` section from the `sign.rst` page. rimage configuration was designed in a very different way from imgtool configuration. The rimage doc section was following the imgtool doc section and constrating the two approaches. Now that the previous imgtool doc section has just been removed, some words like "different" and "instead" don't make sense anymore. Drop them. Signed-off-by: Marc Herbert --- doc/develop/west/sign.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/develop/west/sign.rst b/doc/develop/west/sign.rst index 9b17bf025bb10..21eeac87e5307 100644 --- a/doc/develop/west/sign.rst +++ b/doc/develop/west/sign.rst @@ -12,8 +12,8 @@ the image together. Run ``west sign -h`` for command line help. rimage ****** -rimage configuration uses a different approach that does not rely on Kconfig or CMake -but on :ref:`west config` instead, similar to +rimage configuration uses an approach that does not rely on Kconfig or CMake +but on :ref:`west config`, similar to :ref:`west-building-cmake-config`. Signing involves a number of "wrapper" scripts stacked on top of each other: ``west @@ -31,8 +31,8 @@ build logs can be unreliable: it may produce different results because of subtle environment differences. Last and worst: new signing feature and options are impossible to use until more boilerplate code has been added in each layer. -To avoid these issues, ``rimage`` parameters can bet set in ``west config`` -instead. Here's a ``workspace/.west/config`` example: +To avoid these issues, ``rimage`` parameters can bet set in ``west config``. +Here's a ``workspace/.west/config`` example: .. code-block:: ini From 6d083cac7ecb2248c3538cf7806a393eb614c337 Mon Sep 17 00:00:00 2001 From: Evgeniy Paltsev Date: Fri, 18 Oct 2024 17:44:18 +0100 Subject: [PATCH 1319/4482] Revert "arch: arc: replace ARC_EARLY_SOC_INIT with PLATFORM_RESET_HOOK" The commit introduced regression for hsdk4xd platform. The hsdk4xd SoC setup from soc_early_asm_init_percpu need to be done in early code before any C code execution. The current approach has multiple issues - we call function (which can be easily implemented in C for this or other SoC) from the place where we haven't setup stack pointer (so we can't use stack) - which is very error-prone - we never return back from soc_reset_hook on hsdk4xd platform So let's just revert it for now. If any other ARC SoC need to use soc_reset_hook - than it can be implemented properly. This reverts commit 8c32a82e47f5d1a2871ec99b0c8b61eb789f9fcb. Signed-off-by: Eugeniy Paltsev Signed-off-by: Evgeniy Paltsev --- arch/arc/Kconfig | 4 +--- arch/arc/core/reset.S | 9 ++++----- soc/snps/hsdk4xd/CMakeLists.txt | 1 - soc/snps/hsdk4xd/Kconfig.defconfig | 2 +- soc/snps/hsdk4xd/soc_ctrl.S | 14 -------------- soc/snps/hsdk4xd/soc_ctrl.h | 17 +++++++++++++++++ 6 files changed, 23 insertions(+), 24 deletions(-) delete mode 100644 soc/snps/hsdk4xd/soc_ctrl.S create mode 100644 soc/snps/hsdk4xd/soc_ctrl.h diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index e324c4064ab81..3f5ef8543b49e 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig @@ -383,9 +383,7 @@ config ARC_EXCEPTION_STACK_SIZE endmenu config ARC_EARLY_SOC_INIT - bool "Make early stage SoC-specific initialization [DEPRECATED]" - select SOC_RESET_HOOK - select DEPRECATED + bool "Make early stage SoC-specific initialization" help Call SoC per-core setup code on early stage initialization (before C runtime initialization). Setup code is called in form of diff --git a/arch/arc/core/reset.S b/arch/arc/core/reset.S index 63fa6438ce448..a2b038d387ee2 100644 --- a/arch/arc/core/reset.S +++ b/arch/arc/core/reset.S @@ -16,9 +16,8 @@ #include #include #include - -#if defined(CONFIG_SOC_RESET_HOOK) -GTEXT(soc_reset_hook) +#ifdef CONFIG_ARC_EARLY_SOC_INIT + #include #endif GDATA(z_interrupt_stacks) @@ -113,8 +112,8 @@ done_icache_invalidate: done_dcache_invalidate: -#ifdef CONFIG_SOC_RESET_HOOK - bl soc_reset_hook +#ifdef CONFIG_ARC_EARLY_SOC_INIT + soc_early_asm_init_percpu #endif _dsp_extension_probe diff --git a/soc/snps/hsdk4xd/CMakeLists.txt b/soc/snps/hsdk4xd/CMakeLists.txt index d29cb7e2e50ef..e1765fe113639 100644 --- a/soc/snps/hsdk4xd/CMakeLists.txt +++ b/soc/snps/hsdk4xd/CMakeLists.txt @@ -16,6 +16,5 @@ else() endif() zephyr_include_directories(.) -zephyr_library_sources_ifdef(CONFIG_SOC_RESET_HOOK soc_ctrl.S) set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld CACHE INTERNAL "") diff --git a/soc/snps/hsdk4xd/Kconfig.defconfig b/soc/snps/hsdk4xd/Kconfig.defconfig index 4adafa9b04331..a47f25d09d019 100644 --- a/soc/snps/hsdk4xd/Kconfig.defconfig +++ b/soc/snps/hsdk4xd/Kconfig.defconfig @@ -44,7 +44,7 @@ config UART_NS16550_ACCESS_WORD_ONLY config ARC_HAS_ACCL_REGS default y -config SOC_RESET_HOOK +config ARC_EARLY_SOC_INIT default y config ARC_HAS_STACK_CHECKING diff --git a/soc/snps/hsdk4xd/soc_ctrl.S b/soc/snps/hsdk4xd/soc_ctrl.S deleted file mode 100644 index 0973b16656482..0000000000000 --- a/soc/snps/hsdk4xd/soc_ctrl.S +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2023 Synopsys, Inc. All rights reserved. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -GTEXT(soc_reset_hook) -SECTION_FUNC(TEXT, soc_reset_hook) - mov r0, 1 /* disable LPB for HS4XD */ - sr r0, [_ARC_V2_LPB_CTRL] diff --git a/soc/snps/hsdk4xd/soc_ctrl.h b/soc/snps/hsdk4xd/soc_ctrl.h new file mode 100644 index 0000000000000..93d50d3eb2073 --- /dev/null +++ b/soc/snps/hsdk4xd/soc_ctrl.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2023 Synopsys, Inc. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef _ARC_HSDK4XD_SOC_CTRL_H_ +#define _ARC_HSDK4XD_SOC_CTRL_H_ + +#ifdef _ASMLANGUAGE +.macro soc_early_asm_init_percpu + mov r0, 1 /* disable LPB for HS4XD */ + sr r0, [_ARC_V2_LPB_CTRL] +.endm +#endif /* _ASMLANGUAGE */ + +#endif /* _ARC_HSDK4XD_SOC_CTRL_H_ */ From 35401fd7a948fe861341f9dfd1bfa8726c5be544 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 18 Oct 2024 09:26:08 +0200 Subject: [PATCH 1320/4482] MAINTAINERS: add myself to collaborators list Add myself to collaborators list for Xilinx/AMD platforms and also cover missing files and folders. Signed-off-by: Michal Simek --- MAINTAINERS.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 9ff972e9376cf..f22c80a45df36 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -4075,8 +4075,12 @@ Xilinx Platforms: collaborators: - henrikbrixandersen - ibirnbaum + - michalsimek files: + - boards/amd/ + - drivers/*/*xilinx* - drivers/*/*xlnx* + - drivers/*/*zynq* - dts/*/xilinx/ - dts/bindings/*/*xlnx* - include/zephyr/*/*/*xlnx* From 86ed9811c401b9e81296ac11057b597baa23dc6e Mon Sep 17 00:00:00 2001 From: Dimitrije Lilic Date: Thu, 17 Oct 2024 16:23:53 +0200 Subject: [PATCH 1321/4482] drivers: sensor: adxl345: Updated ADXL345 drv RTIO stream & Trigger func Updated ADXL345 driver with RTIO stream functionality. Added Trigger intterupt functionality. RTIO stream is using FIFO threshold.Together with RTIO stream, RTIO async read is also implemented. Signed-off-by: Dimitrije Lilic --- drivers/sensor/adi/adxl345/CMakeLists.txt | 3 + drivers/sensor/adi/adxl345/Kconfig | 48 +++ drivers/sensor/adi/adxl345/adxl345.c | 303 ++++++++++++++- drivers/sensor/adi/adxl345/adxl345.h | 193 +++++++++- drivers/sensor/adi/adxl345/adxl345_decoder.c | 212 +++++++++++ drivers/sensor/adi/adxl345/adxl345_rtio.c | 60 +++ drivers/sensor/adi/adxl345/adxl345_stream.c | 369 +++++++++++++++++++ drivers/sensor/adi/adxl345/adxl345_trigger.c | 179 +++++++++ dts/bindings/sensor/adi,adxl345-common.yaml | 31 ++ dts/bindings/sensor/adi,adxl345-spi.yaml | 2 +- 10 files changed, 1385 insertions(+), 15 deletions(-) create mode 100644 drivers/sensor/adi/adxl345/adxl345_decoder.c create mode 100644 drivers/sensor/adi/adxl345/adxl345_rtio.c create mode 100644 drivers/sensor/adi/adxl345/adxl345_stream.c create mode 100644 drivers/sensor/adi/adxl345/adxl345_trigger.c create mode 100644 dts/bindings/sensor/adi,adxl345-common.yaml diff --git a/drivers/sensor/adi/adxl345/CMakeLists.txt b/drivers/sensor/adi/adxl345/CMakeLists.txt index 70047bd5b3d3c..e1d3a523ecf74 100644 --- a/drivers/sensor/adi/adxl345/CMakeLists.txt +++ b/drivers/sensor/adi/adxl345/CMakeLists.txt @@ -6,3 +6,6 @@ zephyr_library() zephyr_library_sources(adxl345.c) +zephyr_library_sources_ifdef(CONFIG_ADXL345_TRIGGER adxl345_trigger.c) +zephyr_library_sources_ifdef(CONFIG_SENSOR_ASYNC_API adxl345_rtio.c adxl345_decoder.c) +zephyr_library_sources_ifdef(CONFIG_ADXL345_STREAM adxl345_stream.c adxl345_decoder.c) diff --git a/drivers/sensor/adi/adxl345/Kconfig b/drivers/sensor/adi/adxl345/Kconfig index 210164269b77d..9463eb0c51cc4 100644 --- a/drivers/sensor/adi/adxl345/Kconfig +++ b/drivers/sensor/adi/adxl345/Kconfig @@ -9,5 +9,53 @@ config ADXL345 depends on DT_HAS_ADI_ADXL345_ENABLED select I2C if $(dt_compat_on_bus,$(DT_COMPAT_ADI_ADXL345),i2c) select SPI if $(dt_compat_on_bus,$(DT_COMPAT_ADI_ADXL345),spi) + select RTIO_WORKQ if SENSOR_ASYNC_API help Enable driver for ADXL345 Three-Axis Digital Accelerometer. + +choice ADXL345_TRIGGER_MODE + prompt "Trigger mode" + default ADXL345_TRIGGER_NONE + help + Specify the type of triggering used by the driver. + +config ADXL345_TRIGGER_NONE + bool "No trigger" + +config ADXL345_TRIGGER_GLOBAL_THREAD + bool "Use global thread" + depends on GPIO + select ADXL345_TRIGGER + +config ADXL345_TRIGGER_OWN_THREAD + bool "Use own thread" + depends on GPIO + select ADXL345_TRIGGER + +endchoice + +config ADXL345_STREAM + bool "Use FIFO to stream data" + select ADXL345_TRIGGER + default y + depends on SPI_RTIO + depends on SENSOR_ASYNC_API + help + Use this configuration option to enable streaming sensor data via RTIO. + +config ADXL345_TRIGGER + bool + +config ADXL345_THREAD_PRIORITY + int "Thread priority" + depends on ADXL345_TRIGGER_OWN_THREAD && ADXL345_TRIGGER + default 10 + help + Priority of thread used by the driver to handle interrupts. + +config ADXL345_THREAD_STACK_SIZE + int "Thread stack size" + depends on ADXL345_TRIGGER_OWN_THREAD && ADXL345_TRIGGER + default 1024 + help + Stack size of thread used by the driver to handle interrupts. diff --git a/drivers/sensor/adi/adxl345/adxl345.c b/drivers/sensor/adi/adxl345/adxl345.c index 6a538f6ff3123..33c4d2a3a3268 100644 --- a/drivers/sensor/adi/adxl345/adxl345.c +++ b/drivers/sensor/adi/adxl345/adxl345.c @@ -42,7 +42,7 @@ static bool adxl345_bus_is_ready_spi(const union adxl345_bus *bus) return spi_is_ready_dt(&bus->spi); } -static int adxl345_reg_access_spi(const struct device *dev, uint8_t cmd, uint8_t reg_addr, +int adxl345_reg_access_spi(const struct device *dev, uint8_t cmd, uint8_t reg_addr, uint8_t *data, size_t length) { const struct adxl345_dev_config *cfg = dev->config; @@ -53,17 +53,20 @@ static int adxl345_reg_access_spi(const struct device *dev, uint8_t cmd, uint8_t .buffers = buf, .count = 2, }; + int ret; if (cmd == ADXL345_READ_CMD) { tx.count = 1; - return spi_transceive_dt(&cfg->bus.spi, &tx, &rx); + ret = spi_transceive_dt(&cfg->bus.spi, &tx, &rx); + return ret; } else { - return spi_write_dt(&cfg->bus.spi, &tx); + ret = spi_write_dt(&cfg->bus.spi, &tx); + return ret; } } #endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */ -static inline int adxl345_reg_access(const struct device *dev, uint8_t cmd, uint8_t addr, +int adxl345_reg_access(const struct device *dev, uint8_t cmd, uint8_t addr, uint8_t *data, size_t len) { const struct adxl345_dev_config *cfg = dev->config; @@ -71,31 +74,50 @@ static inline int adxl345_reg_access(const struct device *dev, uint8_t cmd, uint return cfg->reg_access(dev, cmd, addr, data, len); } -static inline int adxl345_reg_write(const struct device *dev, uint8_t addr, uint8_t *data, +int adxl345_reg_write(const struct device *dev, uint8_t addr, uint8_t *data, uint8_t len) { return adxl345_reg_access(dev, ADXL345_WRITE_CMD, addr, data, len); } -static inline int adxl345_reg_read(const struct device *dev, uint8_t addr, uint8_t *data, +int adxl345_reg_read(const struct device *dev, uint8_t addr, uint8_t *data, uint8_t len) { return adxl345_reg_access(dev, ADXL345_READ_CMD, addr, data, len); } -static inline int adxl345_reg_write_byte(const struct device *dev, uint8_t addr, uint8_t val) +int adxl345_reg_write_byte(const struct device *dev, uint8_t addr, uint8_t val) { return adxl345_reg_write(dev, addr, &val, 1); } -static inline int adxl345_reg_read_byte(const struct device *dev, uint8_t addr, uint8_t *buf) +int adxl345_reg_read_byte(const struct device *dev, uint8_t addr, uint8_t *buf) { return adxl345_reg_read(dev, addr, buf, 1); } +int adxl345_reg_write_mask(const struct device *dev, + uint8_t reg_addr, + uint8_t mask, + uint8_t data) +{ + int ret; + uint8_t tmp; + + ret = adxl345_reg_read_byte(dev, reg_addr, &tmp); + if (ret) { + return ret; + } + + tmp &= ~mask; + tmp |= data; + + return adxl345_reg_write_byte(dev, reg_addr, tmp); +} + static inline bool adxl345_bus_is_ready(const struct device *dev) { const struct adxl345_dev_config *cfg = dev->config; @@ -103,11 +125,168 @@ static inline bool adxl345_bus_is_ready(const struct device *dev) return cfg->bus_is_ready(&cfg->bus); } -static int adxl345_read_sample(const struct device *dev, +int adxl345_get_status(const struct device *dev, + uint8_t *status1, + uint16_t *fifo_entries) +{ + uint8_t buf[2], length = 1U; + int ret; + + ret = adxl345_reg_read(dev, ADXL345_INT_SOURCE, buf, length); + + *status1 = buf[0]; + ret = adxl345_reg_read(dev, ADXL345_FIFO_STATUS_REG, buf+1, length); + if (fifo_entries) { + *fifo_entries = buf[1] & 0x3F; + } + + return ret; +} + +/** + * Configure the operating parameters for the FIFO. + * @param dev - The device structure. + * @param mode - FIFO Mode. Specifies FIFO operating mode. + * Accepted values: ADXL345_FIFO_BYPASSED + * ADXL345_FIFO_STREAMED + * ADXL345_FIFO_TRIGGERED + * ADXL345_FIFO_OLD_SAVED + * @param trigger - FIFO trigger. Links trigger event to appropriate INT. + * Accepted values: ADXL345_INT1 + * ADXL345_INT2 + * @param fifo_samples - FIFO Samples. Watermark number of FIFO samples that + * triggers a FIFO_FULL condition when reached. + * Values range from 0 to 32. + + * @return 0 in case of success, negative error code otherwise. + */ +int adxl345_configure_fifo(const struct device *dev, + enum adxl345_fifo_mode mode, + enum adxl345_fifo_trigger trigger, + uint16_t fifo_samples) +{ + struct adxl345_dev_data *data = dev->data; + uint8_t fifo_config; + int ret; + + if (fifo_samples > 32) { + return -EINVAL; + } + + fifo_config = (ADXL345_FIFO_CTL_TRIGGER_MODE(trigger) | + ADXL345_FIFO_CTL_MODE_MODE(mode) | + ADXL345_FIFO_CTL_SAMPLES_MODE(fifo_samples)); + + ret = adxl345_reg_write_byte(dev, ADXL345_FIFO_CTL_REG, fifo_config); + if (ret) { + return ret; + } + + data->fifo_config.fifo_trigger = trigger; + data->fifo_config.fifo_mode = mode; + data->fifo_config.fifo_samples = fifo_samples; + + return 0; +} + +/** + * Set the mode of operation. + * @param dev - The device structure. + * @param op_mode - Mode of operation. + * Accepted values: ADXL345_STANDBY + * ADXL345_MEASURE + * @return 0 in case of success, negative error code otherwise. + */ +int adxl345_set_op_mode(const struct device *dev, enum adxl345_op_mode op_mode) +{ + return adxl345_reg_write_mask(dev, ADXL345_POWER_CTL_REG, + ADXL345_POWER_CTL_MEASURE_MSK, + ADXL345_POWER_CTL_MEASURE_MODE(op_mode)); +} + +/** + * Set Output data rate. + * @param dev - The device structure. + * @param odr - Output data rate. + * Accepted values: ADXL345_ODR_12HZ + * ADXL345_ODR_25HZ + * ADXL345_ODR_50HZ + * ADXL345_ODR_100HZ + * ADXL345_ODR_200HZ + * ADXL345_ODR_400HZ + * @return 0 in case of success, negative error code otherwise. + */ +static int adxl345_set_odr(const struct device *dev, enum adxl345_odr odr) +{ + return adxl345_reg_write_mask(dev, ADXL345_RATE_REG, + ADXL345_ODR_MSK, + ADXL345_ODR_MODE(odr)); +} + +static int adxl345_attr_set_odr(const struct device *dev, + enum sensor_channel chan, + enum sensor_attribute attr, + const struct sensor_value *val) +{ + enum adxl345_odr odr; + struct adxl345_dev_config *cfg = (struct adxl345_dev_config *)dev->config; + + switch (val->val1) { + case 12: + odr = ADXL345_ODR_12HZ; + break; + case 25: + odr = ADXL345_ODR_25HZ; + break; + case 50: + odr = ADXL345_ODR_50HZ; + break; + case 100: + odr = ADXL345_ODR_100HZ; + break; + case 200: + odr = ADXL345_ODR_200HZ; + break; + case 400: + odr = ADXL345_ODR_400HZ; + break; + default: + return -EINVAL; + } + + int ret = adxl345_set_odr(dev, odr); + + if (ret == 0) { + cfg->odr = odr; + } + + return ret; +} + +static int adxl345_attr_set(const struct device *dev, + enum sensor_channel chan, + enum sensor_attribute attr, + const struct sensor_value *val) +{ + switch (attr) { + case SENSOR_ATTR_SAMPLING_FREQUENCY: + return adxl345_attr_set_odr(dev, chan, attr, val); + default: + return -ENOTSUP; + } +} + +int adxl345_read_sample(const struct device *dev, struct adxl345_sample *sample) { int16_t raw_x, raw_y, raw_z; - uint8_t axis_data[6]; + uint8_t axis_data[6], status1; + + if (!IS_ENABLED(CONFIG_ADXL345_TRIGGER)) { + do { + adxl345_get_status(dev, &status1, NULL); + } while (!(ADXL345_STATUS_DATA_RDY(status1))); + } int rc = adxl345_reg_read(dev, ADXL345_X_AXIS_DATA_0_REG, axis_data, 6); @@ -127,7 +306,7 @@ static int adxl345_read_sample(const struct device *dev, return 0; } -static void adxl345_accel_convert(struct sensor_value *val, int16_t sample) +void adxl345_accel_convert(struct sensor_value *val, int16_t sample) { if (sample & BIT(9)) { sample |= ADXL345_COMPLEMENT; @@ -205,14 +384,60 @@ static int adxl345_channel_get(const struct device *dev, } static const struct sensor_driver_api adxl345_api_funcs = { + .attr_set = adxl345_attr_set, .sample_fetch = adxl345_sample_fetch, .channel_get = adxl345_channel_get, +#ifdef CONFIG_ADXL345_TRIGGER + .trigger_set = adxl345_trigger_set, +#endif +#ifdef CONFIG_SENSOR_ASYNC_API + .submit = adxl345_submit, + .get_decoder = adxl345_get_decoder, +#endif }; +#ifdef CONFIG_ADXL345_TRIGGER +/** + * Configure the INT1 and INT2 interrupt pins. + * @param dev - The device structure. + * @param int1 - INT1 interrupt pins. + * @return 0 in case of success, negative error code otherwise. + */ +static int adxl345_interrupt_config(const struct device *dev, + uint8_t int1) +{ + int ret; + const struct adxl345_dev_config *cfg = dev->config; + + ret = adxl345_reg_write_byte(dev, ADXL345_INT_MAP, int1); + if (ret) { + return ret; + } + + ret = adxl345_reg_write_byte(dev, ADXL345_INT_ENABLE, int1); + if (ret) { + return ret; + } + + uint8_t samples; + + ret = adxl345_reg_read_byte(dev, ADXL345_INT_MAP, &samples); + ret = adxl345_reg_read_byte(dev, ADXL345_INT_ENABLE, &samples); +#ifdef CONFIG_ADXL345_TRIGGER + gpio_pin_interrupt_configure_dt(&cfg->interrupt, + GPIO_INT_EDGE_TO_ACTIVE); +#endif + return 0; +} +#endif + static int adxl345_init(const struct device *dev) { int rc; struct adxl345_dev_data *data = dev->data; +#ifdef CONFIG_ADXL345_TRIGGER + const struct adxl345_dev_config *cfg = dev->config; +#endif uint8_t dev_id; data->sample_number = 0; @@ -246,15 +471,61 @@ static int adxl345_init(const struct device *dev) return -EIO; } +#ifdef CONFIG_ADXL345_TRIGGER + rc = adxl345_configure_fifo(dev, ADXL345_FIFO_STREAMED, + ADXL345_INT2, + SAMPLE_NUM); + if (rc) { + return rc; + } +#endif + rc = adxl345_reg_write_byte(dev, ADXL345_POWER_CTL_REG, ADXL345_ENABLE_MEASURE_BIT); if (rc < 0) { LOG_ERR("Enable measure bit failed\n"); return -EIO; } +#ifdef CONFIG_ADXL345_TRIGGER + rc = adxl345_init_interrupt(dev); + if (rc < 0) { + LOG_ERR("Failed to initialize interrupt!"); + return -EIO; + } + + rc = adxl345_set_odr(dev, cfg->odr); + if (rc) { + return rc; + } + rc = adxl345_interrupt_config(dev, ADXL345_INT_MAP_WATERMARK_MSK); + if (rc) { + return rc; + } +#endif return 0; } +#ifdef CONFIG_ADXL345_TRIGGER +#define ADXL345_CFG_IRQ(inst) \ + .interrupt = GPIO_DT_SPEC_INST_GET(inst, int2_gpios), +#else +#define ADXL345_CFG_IRQ(inst) +#endif /* CONFIG_ADXL345_TRIGGER */ + +#define ADXL345_RTIO_DEFINE(inst) \ + SPI_DT_IODEV_DEFINE(adxl345_iodev_##inst, DT_DRV_INST(inst), \ + SPI_WORD_SET(8) | SPI_TRANSFER_MSB | \ + SPI_MODE_CPOL | SPI_MODE_CPHA, 0U); \ + RTIO_DEFINE(adxl345_rtio_ctx_##inst, 64, 64); + +#define ADXL345_CONFIG(inst) \ + .odr = DT_INST_PROP(inst, odr), \ + .fifo_config.fifo_mode = ADXL345_FIFO_STREAMED, \ + .fifo_config.fifo_trigger = ADXL345_INT2, \ + .fifo_config.fifo_samples = SAMPLE_NUM, \ + .op_mode = TRUE, \ + .odr = ADXL345_RATE_25HZ, \ + #define ADXL345_CONFIG_SPI(inst) \ { \ .bus = {.spi = SPI_DT_SPEC_INST_GET(inst, \ @@ -265,6 +536,9 @@ static int adxl345_init(const struct device *dev) 0)}, \ .bus_is_ready = adxl345_bus_is_ready_spi, \ .reg_access = adxl345_reg_access_spi, \ + ADXL345_CONFIG(inst) \ + COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, int2_gpios), \ + (ADXL345_CFG_IRQ(inst)), ()) \ } #define ADXL345_CONFIG_I2C(inst) \ @@ -275,8 +549,11 @@ static int adxl345_init(const struct device *dev) } #define ADXL345_DEFINE(inst) \ - static struct adxl345_dev_data adxl345_data_##inst; \ - \ + IF_ENABLED(CONFIG_ADXL345_STREAM, (ADXL345_RTIO_DEFINE(inst))); \ + static struct adxl345_dev_data adxl345_data_##inst = { \ + IF_ENABLED(CONFIG_ADXL345_STREAM, (.rtio_ctx = &adxl345_rtio_ctx_##inst, \ + .iodev = &adxl345_iodev_##inst,)) \ + }; \ static const struct adxl345_dev_config adxl345_config_##inst = \ COND_CODE_1(DT_INST_ON_BUS(inst, spi), (ADXL345_CONFIG_SPI(inst)), \ (ADXL345_CONFIG_I2C(inst))); \ diff --git a/drivers/sensor/adi/adxl345/adxl345.h b/drivers/sensor/adi/adxl345/adxl345.h index 35412ac7c8be7..efa284ae0b63e 100644 --- a/drivers/sensor/adi/adxl345/adxl345.h +++ b/drivers/sensor/adi/adxl345/adxl345.h @@ -7,9 +7,19 @@ #ifndef ZEPHYR_DRIVERS_SENSOR_ADX345_ADX345_H_ #define ZEPHYR_DRIVERS_SENSOR_ADX345_ADX345_H_ +#include #include #include #include +#include +#include + +#ifdef CONFIG_ADXL345_STREAM +#include +#endif /* CONFIG_ADXL345_STREAM */ + +#define DT_DRV_COMPAT adi_adxl345 + #if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) #include #endif @@ -23,6 +33,12 @@ #define ADXL345_READ_CMD 0x80 #define ADXL345_MULTIBYTE_FLAG 0x40 +#define ADXL345_REG_READ(x) ((x & 0xFF) | ADXL345_READ_CMD) + +#define SAMPLE_SIZE 6 +#define SAMPLE_MASK 0x3F +#define SAMPLE_NUM 0x1F + /* Registers */ #define ADXL345_DEVICE_ID_REG 0x00 #define ADXL345_RATE_REG 0x2c @@ -46,15 +62,138 @@ #define ADXL345_MAX_FIFO_SIZE 32 +#define ADXL345_INT_ENABLE 0x2Eu +#define ADXL345_INT_MAP 0x2Fu +#define ADXL345_INT_SOURCE 0x30u + +/* ADXL345_STATUS_1 */ +#define ADXL345_STATUS_DOUBLE_TAP(x) (((x) >> 5) & 0x1) +#define ADXL345_STATUS_SINGLE_TAP(x) (((x) >> 6) & 0x1) +#define ADXL345_STATUS_DATA_RDY(x) (((x) >> 7) & 0x1) + +/* ADXL345_INT_MAP */ +#define ADXL345_INT_MAP_OVERRUN_MSK BIT(0) +#define ADXL345_INT_MAP_OVERRUN_MODE(x) (((x) & 0x1) << 0) +#define ADXL345_INT_MAP_WATERMARK_MSK BIT(1) +#define ADXL345_INT_MAP_WATERMARK_MODE(x) (((x) & 0x1) << 1) +#define ADXL345_INT_MAP_FREE_FALL_MSK BIT(2) +#define ADXL345_INT_MAP_FREE_FALL_MODE(x) (((x) & 0x1) << 2) +#define ADXL345_INT_MAP_INACT_MSK BIT(3) +#define ADXL345_INT_MAP_INACT_MODE(x) (((x) & 0x1) << 3) +#define ADXL345_INT_MAP_ACT_MSK BIT(4) +#define ADXL345_INT_MAP_ACT_MODE(x) (((x) & 0x1) << 4) +#define ADXL345_INT_MAP_DOUBLE_TAP_MSK BIT(5) +#define ADXL345_INT_MAP_DOUBLE_TAP_MODE(x) (((x) & 0x1) << 5) +#define ADXL345_INT_MAP_SINGLE_TAP_MSK BIT(6) +#define ADXL345_INT_MAP_SINGLE_TAP_MODE(x) (((x) & 0x1) << 6) +#define ADXL345_INT_MAP_DATA_RDY_MSK BIT(7) +#define ADXL345_INT_MAP_DATA_RDY_MODE(x) (((x) & 0x1) << 7) + +/* POWER_CTL */ +#define ADXL345_POWER_CTL_WAKEUP_4HZ BIT(0) +#define ADXL345_POWER_CTL_WAKEUP_4HZ_MODE(x) (((x) & 0x1) << 0) +#define ADXL345_POWER_CTL_WAKEUP_2HZ BIT(1) +#define ADXL345_POWER_CTL_WAKEUP_2HZ_MODE(x) (((x) & 0x1) << 1) +#define ADXL345_POWER_CTL_SLEEP BIT(2) +#define ADXL345_POWER_CTL_SLEEP_MODE(x) (((x) & 0x1) << 2) +#define ADXL345_POWER_CTL_MEASURE_MSK GENMASK(3, 3) +#define ADXL345_POWER_CTL_MEASURE_MODE(x) (((x) & 0x1) << 3) +#define ADXL345_POWER_CTL_STANDBY_MODE(x) (((x) & 0x0) << 3) + +/* ADXL345_FIFO_CTL */ +#define ADXL345_FIFO_CTL_MODE_MSK GENMASK(7, 6) +#define ADXL345_FIFO_CTL_MODE_MODE(x) (((x) & 0x3) << 6) +#define ADXL345_FIFO_CTL_TRIGGER_MSK BIT(5) +#define ADXL345_FIFO_CTL_TRIGGER_MODE(x) (((x) & 0x1) << 5) +#define ADXL345_FIFO_CTL_SAMPLES_MSK BIT(0) +#define ADXL345_FIFO_CTL_SAMPLES_MODE(x) ((x) & 0x1F) + +#define ADXL345_ODR_MSK GENMASK(3, 0) +#define ADXL345_ODR_MODE(x) ((x) & 0xF) + +enum adxl345_odr { + ADXL345_ODR_12HZ = 0x7, + ADXL345_ODR_25HZ, + ADXL345_ODR_50HZ, + ADXL345_ODR_100HZ, + ADXL345_ODR_200HZ, + ADXL345_ODR_400HZ +}; + +enum adxl345_fifo_trigger { + ADXL345_INT1, + ADXL345_INT2 +}; + +enum adxl345_fifo_mode { + ADXL345_FIFO_BYPASSED, + ADXL345_FIFO_OLD_SAVED, + ADXL345_FIFO_STREAMED, + ADXL345_FIFO_TRIGGERED +}; + +struct adxl345_fifo_config { + enum adxl345_fifo_mode fifo_mode; + enum adxl345_fifo_trigger fifo_trigger; + uint16_t fifo_samples; +}; + +enum adxl345_op_mode { + ADXL345_STANDBY, + ADXL345_MEASURE +}; + struct adxl345_dev_data { unsigned int sample_number; - int16_t bufx[ADXL345_MAX_FIFO_SIZE]; int16_t bufy[ADXL345_MAX_FIFO_SIZE]; int16_t bufz[ADXL345_MAX_FIFO_SIZE]; + struct adxl345_fifo_config fifo_config; +#ifdef CONFIG_ADXL345_TRIGGER + struct gpio_callback gpio_cb; + + sensor_trigger_handler_t th_handler; + const struct sensor_trigger *th_trigger; + sensor_trigger_handler_t drdy_handler; + const struct sensor_trigger *drdy_trigger; + const struct device *dev; + +#if defined(CONFIG_ADXL345_TRIGGER_OWN_THREAD) + K_KERNEL_STACK_MEMBER(thread_stack, CONFIG_ADXL345_THREAD_STACK_SIZE); + struct k_sem gpio_sem; + struct k_thread thread; +#elif defined(CONFIG_ADXL345_TRIGGER_GLOBAL_THREAD) + struct k_work work; +#endif +#endif /* CONFIG_ADXL345_TRIGGER */ +#ifdef CONFIG_ADXL345_STREAM + struct rtio_iodev_sqe *sqe; + struct rtio *rtio_ctx; + struct rtio_iodev *iodev; + uint8_t status1; + uint8_t fifo_ent[1]; + uint64_t timestamp; + struct rtio *r_cb; + uint8_t fifo_watermark_irq; + uint8_t fifo_samples; + uint16_t fifo_total_bytes; +#endif /* CONFIG_ADXL345_STREAM */ }; +struct adxl345_fifo_data { + uint8_t is_fifo: 1; + uint8_t sample_set_size: 4; + uint8_t int_status; + uint16_t accel_odr: 4; + uint16_t fifo_byte_count: 12; + uint64_t timestamp; +} __attribute__((__packed__)); + struct adxl345_sample { +#ifdef CONFIG_ADXL345_STREAM + uint8_t is_fifo: 1; + uint8_t res: 7; +#endif /* CONFIG_ADXL345_STREAM */ int16_t x; int16_t y; int16_t z; @@ -77,6 +216,58 @@ struct adxl345_dev_config { const union adxl345_bus bus; adxl345_bus_is_ready_fn bus_is_ready; adxl345_reg_access_fn reg_access; + enum adxl345_odr odr; + bool op_mode; + struct adxl345_fifo_config fifo_config; +#ifdef CONFIG_ADXL345_TRIGGER + struct gpio_dt_spec interrupt; +#endif }; +void adxl345_submit_stream(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe); +void adxl345_stream_irq_handler(const struct device *dev); + +#ifdef CONFIG_ADXL345_TRIGGER +int adxl345_get_status(const struct device *dev, + uint8_t *status, uint16_t *fifo_entries); + +int adxl345_trigger_set(const struct device *dev, + const struct sensor_trigger *trig, + sensor_trigger_handler_t handler); + +int adxl345_init_interrupt(const struct device *dev); + +#endif /* CONFIG_ADXL345_TRIGGER */ + +int adxl345_reg_write_mask(const struct device *dev, + uint8_t reg_addr, + uint8_t mask, + uint8_t data); + +int adxl345_reg_access(const struct device *dev, uint8_t cmd, uint8_t addr, + uint8_t *data, size_t len); + +int adxl345_reg_write(const struct device *dev, uint8_t addr, uint8_t *data, + uint8_t len); + +int adxl345_reg_read(const struct device *dev, uint8_t addr, uint8_t *data, + uint8_t len); + +int adxl345_reg_write_byte(const struct device *dev, uint8_t addr, uint8_t val); + +int adxl345_reg_read_byte(const struct device *dev, uint8_t addr, uint8_t *buf); + +int adxl345_set_op_mode(const struct device *dev, enum adxl345_op_mode op_mode); +#ifdef CONFIG_SENSOR_ASYNC_API +int adxl345_read_sample(const struct device *dev, struct adxl345_sample *sample); +void adxl345_submit(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe); +int adxl345_get_decoder(const struct device *dev, const struct sensor_decoder_api **decoder); +void adxl345_accel_convert(struct sensor_value *val, int16_t sample); +#endif /* CONFIG_SENSOR_ASYNC_API */ + +#ifdef CONFIG_ADXL345_STREAM +int adxl345_configure_fifo(const struct device *dev, enum adxl345_fifo_mode mode, + enum adxl345_fifo_trigger trigger, uint16_t fifo_samples); +size_t adxl345_get_packet_size(const struct adxl345_dev_config *cfg); +#endif /* CONFIG_ADXL345_STREAM */ #endif /* ZEPHYR_DRIVERS_SENSOR_ADX345_ADX345_H_ */ diff --git a/drivers/sensor/adi/adxl345/adxl345_decoder.c b/drivers/sensor/adi/adxl345/adxl345_decoder.c new file mode 100644 index 0000000000000..ce8323628fd31 --- /dev/null +++ b/drivers/sensor/adi/adxl345/adxl345_decoder.c @@ -0,0 +1,212 @@ +/* + * Copyright (c) 2024 Analog Devices Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "adxl345.h" + +#ifdef CONFIG_ADXL345_STREAM + +#define SENSOR_SCALING_FACTOR (SENSOR_G / (16 * 1000 / 100)) + +static const uint32_t accel_period_ns[] = { + [ADXL345_ODR_12HZ] = UINT32_C(1000000000) / 12, + [ADXL345_ODR_25HZ] = UINT32_C(1000000000) / 25, + [ADXL345_ODR_50HZ] = UINT32_C(1000000000) / 50, + [ADXL345_ODR_100HZ] = UINT32_C(1000000000) / 100, + [ADXL345_ODR_200HZ] = UINT32_C(1000000000) / 200, + [ADXL345_ODR_400HZ] = UINT32_C(1000000000) / 400, +}; + +static inline void adxl345_accel_convert_q31(q31_t *out, uint16_t sample) +{ + if (sample & BIT(9)) { + sample |= ADXL345_COMPLEMENT; + } + int32_t micro_ms2 = ((sample * SENSOR_G) / 32); + *out = CLAMP((((int64_t)micro_ms2) + (micro_ms2 % 1000000)), INT32_MIN, INT32_MAX); +} + +static int adxl345_decode_stream(const uint8_t *buffer, struct sensor_chan_spec chan_spec, + uint32_t *fit, uint16_t max_count, void *data_out) +{ + const struct adxl345_fifo_data *enc_data = (const struct adxl345_fifo_data *)buffer; + const uint8_t *buffer_end = + buffer + sizeof(struct adxl345_fifo_data) + enc_data->fifo_byte_count; + int count = 0; + uint8_t sample_num = 0; + + if ((uintptr_t)buffer_end <= *fit || chan_spec.chan_idx != 0) { + return 0; + } + + struct sensor_three_axis_data *data = (struct sensor_three_axis_data *)data_out; + + memset(data, 0, sizeof(struct sensor_three_axis_data)); + data->header.base_timestamp_ns = enc_data->timestamp; + data->header.reading_count = 1; + + buffer += sizeof(struct adxl345_fifo_data); + + uint8_t sample_set_size = enc_data->sample_set_size; + uint64_t period_ns = accel_period_ns[enc_data->accel_odr]; + + /* Calculate which sample is decoded. */ + if ((uint8_t *)*fit >= buffer) { + sample_num = ((uint8_t *)*fit - buffer) / sample_set_size; + } + + while (count < max_count && buffer < buffer_end) { + const uint8_t *sample_end = buffer; + + sample_end += sample_set_size; + + if ((uintptr_t)buffer < *fit) { + /* This frame was already decoded, move on to the next frame */ + buffer = sample_end; + continue; + } + + switch (chan_spec.chan_type) { + case SENSOR_CHAN_ACCEL_XYZ: + data->readings[count].timestamp_delta = sample_num * period_ns; + uint8_t buff_offset = 0; + + adxl345_accel_convert_q31(&data->readings[count].x, *(int16_t *)buffer); + buff_offset = 2; + adxl345_accel_convert_q31(&data->readings[count].y, + *(int16_t *)(buffer + buff_offset)); + buff_offset += 2; + adxl345_accel_convert_q31(&data->readings[count].z, + *(int16_t *)(buffer + buff_offset)); + break; + default: + return -ENOTSUP; + } + buffer = sample_end; + *fit = (uintptr_t)sample_end; + count++; + } + return count; +} + +#endif /* CONFIG_ADXL345_STREAM */ + +static int adxl345_decoder_get_frame_count(const uint8_t *buffer, struct sensor_chan_spec chan_spec, + uint16_t *frame_count) +{ + int32_t ret = -ENOTSUP; + + if (chan_spec.chan_idx != 0) { + return ret; + } + +#ifdef CONFIG_ADXL345_STREAM + const struct adxl345_fifo_data *data = (const struct adxl345_fifo_data *)buffer; + + if (!data->is_fifo) { +#endif /* CONFIG_ADXL345_STREAM */ + switch (chan_spec.chan_type) { + case SENSOR_CHAN_ACCEL_X: + case SENSOR_CHAN_ACCEL_Y: + case SENSOR_CHAN_ACCEL_Z: + case SENSOR_CHAN_ACCEL_XYZ: + *frame_count = 1; + ret = 0; + break; + + default: + break; + } +#ifdef CONFIG_ADXL345_STREAM + } else { + if (data->fifo_byte_count == 0) { + *frame_count = 0; + ret = 0; + } else { + switch (chan_spec.chan_type) { + case SENSOR_CHAN_ACCEL_XYZ: + *frame_count = + data->fifo_byte_count / data->sample_set_size; + ret = 0; + break; + + default: + break; + } + } + } +#endif /* CONFIG_ADXL345_STREAM */ + + return ret; +} + +static int adxl345_decode_sample(const struct adxl345_sample *data, + struct sensor_chan_spec chan_spec, uint32_t *fit, + uint16_t max_count, void *data_out) +{ + struct sensor_value *out = (struct sensor_value *)data_out; + + if (*fit > 0) { + return -ENOTSUP; + } + + switch (chan_spec.chan_type) { + case SENSOR_CHAN_ACCEL_XYZ: + adxl345_accel_convert(out++, data->x); + adxl345_accel_convert(out++, data->y); + adxl345_accel_convert(out, data->z); + break; + default: + return -ENOTSUP; + } + + *fit = 1; + + return 0; +} + +static int adxl345_decoder_decode(const uint8_t *buffer, struct sensor_chan_spec chan_spec, + uint32_t *fit, uint16_t max_count, void *data_out) +{ + const struct adxl345_sample *data = (const struct adxl345_sample *)buffer; + +#ifdef CONFIG_ADXL345_STREAM + if (data->is_fifo) { + return adxl345_decode_stream(buffer, chan_spec, fit, max_count, data_out); + } +#endif /* CONFIG_ADXL345_STREAM */ + + return adxl345_decode_sample(data, chan_spec, fit, max_count, data_out); +} + +static bool adxl345_decoder_has_trigger(const uint8_t *buffer, enum sensor_trigger_type trigger) +{ + const struct adxl345_fifo_data *data = (const struct adxl345_fifo_data *)buffer; + + if (!data->is_fifo) { + return false; + } + + switch (trigger) { + case SENSOR_TRIG_FIFO_WATERMARK: + return FIELD_GET(ADXL345_INT_MAP_WATERMARK_MSK, data->int_status); + default: + return false; + } +} + +SENSOR_DECODER_API_DT_DEFINE() = { + .get_frame_count = adxl345_decoder_get_frame_count, + .decode = adxl345_decoder_decode, + .has_trigger = adxl345_decoder_has_trigger, +}; + +int adxl345_get_decoder(const struct device *dev, const struct sensor_decoder_api **decoder) +{ + ARG_UNUSED(dev); + *decoder = &SENSOR_DECODER_NAME(); + + return 0; +} diff --git a/drivers/sensor/adi/adxl345/adxl345_rtio.c b/drivers/sensor/adi/adxl345/adxl345_rtio.c new file mode 100644 index 0000000000000..c8f0d682a067f --- /dev/null +++ b/drivers/sensor/adi/adxl345/adxl345_rtio.c @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2024 Analog Devices Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#include "adxl345.h" + +LOG_MODULE_DECLARE(ADXL345, CONFIG_SENSOR_LOG_LEVEL); + +static void adxl345_submit_fetch(struct rtio_iodev_sqe *iodev_sqe) +{ + const struct sensor_read_config *cfg = + (const struct sensor_read_config *) iodev_sqe->sqe.iodev->data; + const struct device *dev = cfg->sensor; + int rc; + uint32_t min_buffer_len = sizeof(struct adxl345_dev_data); + uint8_t *buffer; + uint32_t buffer_len; + + rc = rtio_sqe_rx_buf(iodev_sqe, min_buffer_len, min_buffer_len, &buffer, &buffer_len); + if (rc != 0) { + LOG_ERR("Failed to get a read buffer of size %u bytes", min_buffer_len); + rtio_iodev_sqe_err(iodev_sqe, rc); + return; + } + + struct adxl345_sample *data = (struct adxl345_sample *)buffer; + + rc = adxl345_read_sample(dev, data); + if (rc != 0) { + LOG_ERR("Failed to fetch samples"); + rtio_iodev_sqe_err(iodev_sqe, rc); + return; + } + + rtio_iodev_sqe_ok(iodev_sqe, 0); +} + +void adxl345_submit(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe) +{ + const struct sensor_read_config *cfg = + (const struct sensor_read_config *) iodev_sqe->sqe.iodev->data; + + if (!cfg->is_streaming) { + struct rtio_work_req *req = rtio_work_req_alloc(); + + __ASSERT_NO_MSG(req); + + rtio_work_req_submit(req, iodev_sqe, adxl345_submit_fetch); + } else if (IS_ENABLED(CONFIG_ADXL345_STREAM)) { + adxl345_submit_stream(dev, iodev_sqe); + } else { + rtio_iodev_sqe_err(iodev_sqe, -ENOTSUP); + } +} diff --git a/drivers/sensor/adi/adxl345/adxl345_stream.c b/drivers/sensor/adi/adxl345/adxl345_stream.c new file mode 100644 index 0000000000000..a8aeb539041ae --- /dev/null +++ b/drivers/sensor/adi/adxl345/adxl345_stream.c @@ -0,0 +1,369 @@ +/* + * Copyright (c) 2024 Analog Devices Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include "adxl345.h" + +LOG_MODULE_DECLARE(ADXL345, CONFIG_SENSOR_LOG_LEVEL); + +void adxl345_submit_stream(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe) +{ + const struct sensor_read_config *cfg = + (const struct sensor_read_config *) iodev_sqe->sqe.iodev->data; + struct adxl345_dev_data *data = (struct adxl345_dev_data *)dev->data; + const struct adxl345_dev_config *cfg_345 = dev->config; + uint8_t int_value = (uint8_t)~ADXL345_INT_MAP_WATERMARK_MSK; + uint8_t fifo_watermark_irq = 0; + int rc = gpio_pin_interrupt_configure_dt(&cfg_345->interrupt, + GPIO_INT_DISABLE); + + if (rc < 0) { + return; + } + + for (size_t i = 0; i < cfg->count; i++) { + if (cfg->triggers[i].trigger == SENSOR_TRIG_FIFO_WATERMARK) { + int_value = ADXL345_INT_MAP_WATERMARK_MSK; + fifo_watermark_irq = 1; + } + } + uint8_t status; + if (fifo_watermark_irq != data->fifo_watermark_irq) { + data->fifo_watermark_irq = fifo_watermark_irq; + rc = adxl345_reg_write_mask(dev, ADXL345_INT_MAP, ADXL345_INT_MAP_WATERMARK_MSK, + int_value); + if (rc < 0) { + return; + } + + /* Flush the FIFO by disabling it. Save current mode for after the reset. */ + enum adxl345_fifo_mode current_fifo_mode = data->fifo_config.fifo_mode; + + if (current_fifo_mode == ADXL345_FIFO_BYPASSED) { + current_fifo_mode = ADXL345_FIFO_STREAMED; + } + adxl345_configure_fifo(dev, ADXL345_FIFO_BYPASSED, data->fifo_config.fifo_trigger, + data->fifo_config.fifo_samples); + adxl345_configure_fifo(dev, current_fifo_mode, data->fifo_config.fifo_trigger, + data->fifo_config.fifo_samples); + rc = adxl345_reg_read_byte(dev, ADXL345_FIFO_STATUS_REG, &status); + } + + rc = gpio_pin_interrupt_configure_dt(&cfg_345->interrupt, + GPIO_INT_EDGE_TO_ACTIVE); + if (rc < 0) { + return; + } + data->sqe = iodev_sqe; +} + +static void adxl345_irq_en_cb(struct rtio *r, const struct rtio_sqe *sqr, void *arg) +{ + const struct device *dev = (const struct device *)arg; + const struct adxl345_dev_config *cfg = dev->config; + + gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_EDGE_TO_ACTIVE); +} + +static void adxl345_fifo_flush_rtio(const struct device *dev) +{ + struct adxl345_dev_data *data = dev->data; + uint8_t fifo_config; + + fifo_config = (ADXL345_FIFO_CTL_TRIGGER_MODE(data->fifo_config.fifo_trigger) | + ADXL345_FIFO_CTL_MODE_MODE(ADXL345_FIFO_BYPASSED) | + ADXL345_FIFO_CTL_SAMPLES_MODE(data->fifo_config.fifo_samples)); + + struct rtio_sqe *write_fifo_addr = rtio_sqe_acquire(data->rtio_ctx); + const uint8_t reg_addr_w2[2] = {ADXL345_FIFO_CTL_REG, fifo_config}; + + rtio_sqe_prep_tiny_write(write_fifo_addr, data->iodev, RTIO_PRIO_NORM, reg_addr_w2, + 2, NULL); + + fifo_config = (ADXL345_FIFO_CTL_TRIGGER_MODE(data->fifo_config.fifo_trigger) | + ADXL345_FIFO_CTL_MODE_MODE(data->fifo_config.fifo_mode) | + ADXL345_FIFO_CTL_SAMPLES_MODE(data->fifo_config.fifo_samples)); + + write_fifo_addr = rtio_sqe_acquire(data->rtio_ctx); + const uint8_t reg_addr_w3[2] = {ADXL345_FIFO_CTL_REG, fifo_config}; + + rtio_sqe_prep_tiny_write(write_fifo_addr, data->iodev, RTIO_PRIO_NORM, reg_addr_w3, + 2, NULL); + write_fifo_addr->flags |= RTIO_SQE_CHAINED; + + struct rtio_sqe *complete_op = rtio_sqe_acquire(data->rtio_ctx); + + rtio_sqe_prep_callback(complete_op, adxl345_irq_en_cb, (void *)dev, NULL); + rtio_submit(data->rtio_ctx, 0); +} + +static void adxl345_fifo_read_cb(struct rtio *rtio_ctx, const struct rtio_sqe *sqe, void *arg) +{ + const struct device *dev = (const struct device *)arg; + struct adxl345_dev_data *data = (struct adxl345_dev_data *) dev->data; + const struct adxl345_dev_config *cfg = (const struct adxl345_dev_config *) dev->config; + struct rtio_iodev_sqe *iodev_sqe = sqe->userdata; + + if (data->fifo_samples == 0) { + data->fifo_total_bytes = 0; + rtio_iodev_sqe_ok(iodev_sqe, 0); + gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_EDGE_TO_ACTIVE); + } + +} + +static void adxl345_process_fifo_samples_cb(struct rtio *r, const struct rtio_sqe *sqr, void *arg) +{ + const struct device *dev = (const struct device *)arg; + struct adxl345_dev_data *data = (struct adxl345_dev_data *) dev->data; + const struct adxl345_dev_config *cfg = (const struct adxl345_dev_config *) dev->config; + struct rtio_iodev_sqe *current_sqe = data->sqe; + uint16_t fifo_samples = (data->fifo_ent[0]) & SAMPLE_MASK; + size_t sample_set_size = SAMPLE_SIZE; + uint16_t fifo_bytes = fifo_samples * SAMPLE_SIZE; + + data->sqe = NULL; + + /* Not inherently an underrun/overrun as we may have a buffer to fill next time */ + if (current_sqe == NULL) { + LOG_ERR("No pending SQE"); + gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_EDGE_TO_ACTIVE); + return; + } + + const size_t min_read_size = sizeof(struct adxl345_fifo_data) + sample_set_size; + const size_t ideal_read_size = sizeof(struct adxl345_fifo_data) + fifo_bytes; + + uint8_t *buf; + uint32_t buf_len; + + if (rtio_sqe_rx_buf(current_sqe, min_read_size, ideal_read_size, &buf, &buf_len) != 0) { + LOG_ERR("Failed to get buffer"); + rtio_iodev_sqe_err(current_sqe, -ENOMEM); + gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_EDGE_TO_ACTIVE); + return; + } + LOG_DBG("Requesting buffer [%u, %u] got %u", (unsigned int)min_read_size, + (unsigned int)ideal_read_size, buf_len); + + /* Read FIFO and call back to rtio with rtio_sqe completion */ + struct adxl345_fifo_data *hdr = (struct adxl345_fifo_data *) buf; + + hdr->is_fifo = 1; + hdr->timestamp = data->timestamp; + hdr->int_status = data->status1; + hdr->accel_odr = cfg->odr; + hdr->sample_set_size = sample_set_size; + + uint32_t buf_avail = buf_len; + + buf_avail -= sizeof(*hdr); + + uint32_t read_len = MIN(fifo_bytes, buf_avail); + + if (buf_avail < fifo_bytes) { + uint32_t pkts = read_len / sample_set_size; + + read_len = pkts * sample_set_size; + } + + ((struct adxl345_fifo_data *)buf)->fifo_byte_count = read_len; + + uint8_t *read_buf = buf + sizeof(*hdr); + + /* Flush completions */ + struct rtio_cqe *cqe; + int res = 0; + + do { + cqe = rtio_cqe_consume(data->rtio_ctx); + if (cqe != NULL) { + if ((cqe->result < 0 && res == 0)) { + LOG_ERR("Bus error: %d", cqe->result); + res = cqe->result; + } + rtio_cqe_release(data->rtio_ctx, cqe); + } + } while (cqe != NULL); + + /* Bail/cancel attempt to read sensor on any error */ + if (res != 0) { + rtio_iodev_sqe_err(current_sqe, res); + return; + } + + + data->fifo_samples = fifo_samples; + for (size_t i = 0; i < fifo_samples; i++) { + struct rtio_sqe *write_fifo_addr = rtio_sqe_acquire(data->rtio_ctx); + struct rtio_sqe *read_fifo_data = rtio_sqe_acquire(data->rtio_ctx); + + data->fifo_samples--; + const uint8_t reg_addr = ADXL345_REG_READ(ADXL345_X_AXIS_DATA_0_REG) + | ADXL345_MULTIBYTE_FLAG; + + rtio_sqe_prep_tiny_write(write_fifo_addr, data->iodev, RTIO_PRIO_NORM, ®_addr, + 1, NULL); + write_fifo_addr->flags = RTIO_SQE_TRANSACTION; + rtio_sqe_prep_read(read_fifo_data, data->iodev, RTIO_PRIO_NORM, + read_buf + data->fifo_total_bytes, + SAMPLE_SIZE, current_sqe); + data->fifo_total_bytes += SAMPLE_SIZE; + if (i == fifo_samples-1) { + struct rtio_sqe *complete_op = rtio_sqe_acquire(data->rtio_ctx); + + read_fifo_data->flags = RTIO_SQE_CHAINED; + rtio_sqe_prep_callback(complete_op, adxl345_fifo_read_cb, (void *)dev, + current_sqe); + } + rtio_submit(data->rtio_ctx, 0); + ARG_UNUSED(rtio_cqe_consume(data->rtio_ctx)); + } +} + +static void adxl345_process_status1_cb(struct rtio *r, const struct rtio_sqe *sqr, void *arg) +{ + const struct device *dev = (const struct device *)arg; + struct adxl345_dev_data *data = (struct adxl345_dev_data *) dev->data; + const struct adxl345_dev_config *cfg = (const struct adxl345_dev_config *) dev->config; + struct rtio_iodev_sqe *current_sqe = data->sqe; + struct sensor_read_config *read_config; + uint8_t status1 = data->status1; + + if (data->sqe == NULL) { + return; + } + + read_config = (struct sensor_read_config *)data->sqe->sqe.iodev->data; + + if (read_config == NULL) { + return; + } + + if (read_config->is_streaming == false) { + return; + } + + gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_DISABLE); + + struct sensor_stream_trigger *fifo_wmark_cfg = NULL; + + for (int i = 0; i < read_config->count; ++i) { + if (read_config->triggers[i].trigger == SENSOR_TRIG_FIFO_WATERMARK) { + fifo_wmark_cfg = &read_config->triggers[i]; + continue; + } + } + + bool fifo_full_irq = false; + + if ((fifo_wmark_cfg != NULL) + && FIELD_GET(ADXL345_INT_MAP_WATERMARK_MSK, status1)) { + fifo_full_irq = true; + } + + if (!fifo_full_irq) { + gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_EDGE_TO_ACTIVE); + return; + } + + /* Flush completions */ + struct rtio_cqe *cqe; + int res = 0; + + do { + cqe = rtio_cqe_consume(data->rtio_ctx); + if (cqe != NULL) { + if ((cqe->result < 0) && (res == 0)) { + LOG_ERR("Bus error: %d", cqe->result); + res = cqe->result; + } + rtio_cqe_release(data->rtio_ctx, cqe); + } + } while (cqe != NULL); + + /* Bail/cancel attempt to read sensor on any error */ + if (res != 0) { + rtio_iodev_sqe_err(current_sqe, res); + return; + } + + enum sensor_stream_data_opt data_opt; + + if (fifo_wmark_cfg != NULL) { + data_opt = fifo_wmark_cfg->opt; + } + + if (data_opt == SENSOR_STREAM_DATA_NOP || data_opt == SENSOR_STREAM_DATA_DROP) { + uint8_t *buf; + uint32_t buf_len; + + /* Clear streaming_sqe since we're done with the call */ + data->sqe = NULL; + if (rtio_sqe_rx_buf(current_sqe, sizeof(struct adxl345_fifo_data), + sizeof(struct adxl345_fifo_data), &buf, &buf_len) != 0) { + rtio_iodev_sqe_err(current_sqe, -ENOMEM); + gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_EDGE_TO_ACTIVE); + return; + } + + struct adxl345_fifo_data *rx_data = (struct adxl345_fifo_data *)buf; + + memset(buf, 0, buf_len); + rx_data->is_fifo = 1; + rx_data->timestamp = data->timestamp; + rx_data->int_status = status1; + rx_data->fifo_byte_count = 0; + rtio_iodev_sqe_ok(current_sqe, 0); + + if (data_opt == SENSOR_STREAM_DATA_DROP) { + /* Flush the FIFO by disabling it. Save current mode for after the reset. */ + adxl345_fifo_flush_rtio(dev); + } + + gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_EDGE_TO_ACTIVE); + return; + } + + struct rtio_sqe *write_fifo_addr = rtio_sqe_acquire(data->rtio_ctx); + struct rtio_sqe *read_fifo_data = rtio_sqe_acquire(data->rtio_ctx); + struct rtio_sqe *complete_op = rtio_sqe_acquire(data->rtio_ctx); + const uint8_t reg_addr = ADXL345_REG_READ(ADXL345_FIFO_STATUS_REG); + + rtio_sqe_prep_tiny_write(write_fifo_addr, data->iodev, RTIO_PRIO_NORM, ®_addr, 1, NULL); + write_fifo_addr->flags = RTIO_SQE_TRANSACTION; + rtio_sqe_prep_read(read_fifo_data, data->iodev, RTIO_PRIO_NORM, data->fifo_ent, 1, + current_sqe); + read_fifo_data->flags = RTIO_SQE_CHAINED; + rtio_sqe_prep_callback(complete_op, adxl345_process_fifo_samples_cb, (void *)dev, + current_sqe); + + rtio_submit(data->rtio_ctx, 0); +} + +void adxl345_stream_irq_handler(const struct device *dev) +{ + struct adxl345_dev_data *data = (struct adxl345_dev_data *) dev->data; + + if (data->sqe == NULL) { + return; + } + data->timestamp = k_ticks_to_ns_floor64(k_uptime_ticks()); + struct rtio_sqe *write_status_addr = rtio_sqe_acquire(data->rtio_ctx); + struct rtio_sqe *read_status_reg = rtio_sqe_acquire(data->rtio_ctx); + struct rtio_sqe *check_status_reg = rtio_sqe_acquire(data->rtio_ctx); + uint8_t reg = ADXL345_REG_READ(ADXL345_INT_SOURCE); + + rtio_sqe_prep_tiny_write(write_status_addr, data->iodev, RTIO_PRIO_NORM, ®, 1, NULL); + write_status_addr->flags = RTIO_SQE_TRANSACTION; + rtio_sqe_prep_read(read_status_reg, data->iodev, RTIO_PRIO_NORM, &data->status1, 1, NULL); + read_status_reg->flags = RTIO_SQE_CHAINED; + + rtio_sqe_prep_callback(check_status_reg, adxl345_process_status1_cb, (void *)dev, NULL); + rtio_submit(data->rtio_ctx, 0); +} diff --git a/drivers/sensor/adi/adxl345/adxl345_trigger.c b/drivers/sensor/adi/adxl345/adxl345_trigger.c new file mode 100644 index 0000000000000..7c29523436b74 --- /dev/null +++ b/drivers/sensor/adi/adxl345/adxl345_trigger.c @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2018 Analog Devices Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT adi_adxl345 + +#include +#include +#include +#include +#include +#include "adxl345.h" + +#include +LOG_MODULE_DECLARE(ADXL345, CONFIG_SENSOR_LOG_LEVEL); + +#if defined(CONFIG_ADXL345_TRIGGER_OWN_THREAD) || defined(CONFIG_ADXL345_TRIGGER_GLOBAL_THREAD) +static void adxl345_thread_cb(const struct device *dev) +{ + const struct adxl345_dev_config *cfg = dev->config; + struct adxl345_dev_data *drv_data = dev->data; + uint8_t status1; + int ret; + + /* Clear the status */ + if (adxl345_get_status(dev, &status1, NULL) < 0) { + return; + } + + if ((drv_data->drdy_handler != NULL) && + ADXL345_STATUS_DATA_RDY(status1)) { + drv_data->drdy_handler(dev, drv_data->drdy_trigger); + } + + ret = gpio_pin_interrupt_configure_dt(&cfg->interrupt, + GPIO_INT_EDGE_TO_ACTIVE); + __ASSERT(ret == 0, "Interrupt configuration failed"); +} +#endif + +static void adxl345_gpio_callback(const struct device *dev, + struct gpio_callback *cb, uint32_t pins) +{ + struct adxl345_dev_data *drv_data = + CONTAINER_OF(cb, struct adxl345_dev_data, gpio_cb); + const struct adxl345_dev_config *cfg = drv_data->dev->config; + + gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_DISABLE); + + if (IS_ENABLED(CONFIG_ADXL345_STREAM)) { + adxl345_stream_irq_handler(drv_data->dev); + } + +#if defined(CONFIG_ADXL345_TRIGGER_OWN_THREAD) + k_sem_give(&drv_data->gpio_sem); +#elif defined(CONFIG_ADXL345_TRIGGER_GLOBAL_THREAD) + k_work_submit(&drv_data->work); +#endif +} + +#if defined(CONFIG_ADXL345_TRIGGER_OWN_THREAD) +static void adxl345_thread(void *p1, void *p2, void *p3) +{ + ARG_UNUSED(p2); + ARG_UNUSED(p3); + + struct adxl345_dev_data *drv_data = p1; + + while (true) { + k_sem_take(&drv_data->gpio_sem, K_FOREVER); + adxl345_thread_cb(drv_data->dev); + } +} + +#elif defined(CONFIG_ADXL345_TRIGGER_GLOBAL_THREAD) +static void adxl345_work_cb(struct k_work *work) +{ + struct adxl345_dev_data *drv_data = + CONTAINER_OF(work, struct adxl345_dev_data, work); + + adxl345_thread_cb(drv_data->dev); +} +#endif + +int adxl345_trigger_set(const struct device *dev, + const struct sensor_trigger *trig, + sensor_trigger_handler_t handler) +{ + const struct adxl345_dev_config *cfg = dev->config; + struct adxl345_dev_data *drv_data = dev->data; + uint8_t int_mask, int_en, status1; + int ret; + + ret = gpio_pin_interrupt_configure_dt(&cfg->interrupt, + GPIO_INT_DISABLE); + if (ret < 0) { + return ret; + } + + switch (trig->type) { + case SENSOR_TRIG_DATA_READY: + drv_data->drdy_handler = handler; + drv_data->drdy_trigger = trig; + int_mask = ADXL345_INT_MAP_DATA_RDY_MSK; + break; + default: + LOG_ERR("Unsupported sensor trigger"); + return -ENOTSUP; + } + + if (handler) { + int_en = int_mask; + } else { + int_en = 0U; + } + + ret = adxl345_reg_write_mask(dev, ADXL345_INT_MAP, int_mask, int_en); + if (ret < 0) { + return ret; + } + /* Clear status */ + ret = adxl345_get_status(dev, &status1, NULL); + if (ret < 0) { + return ret; + } + + ret = gpio_pin_interrupt_configure_dt(&cfg->interrupt, + GPIO_INT_EDGE_TO_ACTIVE); + if (ret < 0) { + return ret; + } + + return 0; +} + +int adxl345_init_interrupt(const struct device *dev) +{ + const struct adxl345_dev_config *cfg = dev->config; + struct adxl345_dev_data *drv_data = dev->data; + int ret; + + if (!gpio_is_ready_dt(&cfg->interrupt)) { + LOG_ERR("GPIO port %s not ready", cfg->interrupt.port->name); + return -EINVAL; + } + + ret = gpio_pin_configure_dt(&cfg->interrupt, GPIO_INPUT); + if (ret < 0) { + return ret; + } + + gpio_init_callback(&drv_data->gpio_cb, + adxl345_gpio_callback, + BIT(cfg->interrupt.pin)); + + ret = gpio_add_callback(cfg->interrupt.port, &drv_data->gpio_cb); + if (ret < 0) { + LOG_ERR("Failed to set gpio callback!"); + return ret; + } + + drv_data->dev = dev; + +#if defined(CONFIG_ADXL345_TRIGGER_OWN_THREAD) + k_sem_init(&drv_data->gpio_sem, 0, K_SEM_MAX_LIMIT); + + k_thread_create(&drv_data->thread, drv_data->thread_stack, + CONFIG_ADXL345_THREAD_STACK_SIZE, + adxl345_thread, drv_data, + NULL, NULL, K_PRIO_COOP(CONFIG_ADXL345_THREAD_PRIORITY), + 0, K_NO_WAIT); +#elif defined(CONFIG_ADXL345_TRIGGER_GLOBAL_THREAD) + drv_data->work.handler = adxl345_work_cb; +#endif + + return 0; +} diff --git a/dts/bindings/sensor/adi,adxl345-common.yaml b/dts/bindings/sensor/adi,adxl345-common.yaml new file mode 100644 index 0000000000000..6a3f301e2a778 --- /dev/null +++ b/dts/bindings/sensor/adi,adxl345-common.yaml @@ -0,0 +1,31 @@ +# Copyright (c) 2022 Analog Devices Inc. +# SPDX-License-Identifier: Apache-2.0 + +include: sensor-device.yaml + +properties: + odr: + type: int + default: 0 + description: | + Accelerometer sampling frequency (ODR). Default is power on reset value. + 0 # 12.5Hz + 1 # 25Hz + 2 # 50Hz + 3 # 100Hz + 4 # 200Hz + 5 # 400Hz + enum: + - 0 + - 1 + - 2 + - 3 + - 4 + - 5 + + int2-gpios: + type: phandle-array + description: | + The INT2 signal defaults to active high as produced by the + sensor. The property value should ensure the flags properly + describe the signal that is presented to the driver. diff --git a/dts/bindings/sensor/adi,adxl345-spi.yaml b/dts/bindings/sensor/adi,adxl345-spi.yaml index 98ca17898d08d..2ee75a6a0f9f0 100644 --- a/dts/bindings/sensor/adi,adxl345-spi.yaml +++ b/dts/bindings/sensor/adi,adxl345-spi.yaml @@ -5,4 +5,4 @@ description: ADXL345 3-axis accelerometer with SPI connection compatible: "adi,adxl345" -include: [sensor-device.yaml, spi-device.yaml] +include: ["spi-device.yaml", "adi,adxl345-common.yaml"] From fab01c0c44ed3b9748546c07743a59b9842803a4 Mon Sep 17 00:00:00 2001 From: Tom Burdick Date: Tue, 15 Oct 2024 16:07:12 -0500 Subject: [PATCH 1322/4482] i2c: Drop TXRX from default RTIO handler TXRX is meant specifically to handle a full duplex bus like SPI, I2C is half duplex meaning only read or write can be performed at once. Drop TXRX as a supported operation code for the default I2C submission path. Signed-off-by: Tom Burdick --- drivers/i2c/i2c_rtio_default.c | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/drivers/i2c/i2c_rtio_default.c b/drivers/i2c/i2c_rtio_default.c index c7f94ac9bd254..048b5b42d79a5 100644 --- a/drivers/i2c/i2c_rtio_default.c +++ b/drivers/i2c/i2c_rtio_default.c @@ -60,27 +60,6 @@ static int i2c_iodev_submit_tiny_tx(struct rtio_iodev_sqe *iodev_sqe, struct i2c return 0; } -static int i2c_iodev_submit_txrx(struct rtio_iodev_sqe *iodev_sqe, struct i2c_msg msgs[2], - uint8_t *num_msgs) -{ - __ASSERT_NO_MSG(iodev_sqe->sqe.op == RTIO_OP_TXRX); - - msgs[0].buf = (uint8_t *)iodev_sqe->sqe.txrx.tx_buf; - msgs[0].len = iodev_sqe->sqe.txrx.buf_len; - msgs[0].flags = - ((iodev_sqe->sqe.iodev_flags & RTIO_IODEV_I2C_10_BITS) ? I2C_MSG_ADDR_10_BITS : 0) | - I2C_MSG_WRITE; - msgs[1].buf = iodev_sqe->sqe.txrx.rx_buf; - msgs[1].len = iodev_sqe->sqe.txrx.buf_len; - msgs[1].flags = - ((iodev_sqe->sqe.iodev_flags & RTIO_IODEV_I2C_STOP) ? I2C_MSG_STOP : 0) | - ((iodev_sqe->sqe.iodev_flags & RTIO_IODEV_I2C_RESTART) ? I2C_MSG_RESTART : 0) | - ((iodev_sqe->sqe.iodev_flags & RTIO_IODEV_I2C_10_BITS) ? I2C_MSG_ADDR_10_BITS : 0) | - I2C_MSG_READ; - *num_msgs = 2; - return 0; -} - void i2c_iodev_submit_work_handler(struct rtio_iodev_sqe *iodev_sqe) { const struct i2c_dt_spec *dt_spec = (const struct i2c_dt_spec *)iodev_sqe->sqe.iodev->data; @@ -105,9 +84,6 @@ void i2c_iodev_submit_work_handler(struct rtio_iodev_sqe *iodev_sqe) case RTIO_OP_TINY_TX: rc = i2c_iodev_submit_tiny_tx(transaction_current, msgs, &num_msgs); break; - case RTIO_OP_TXRX: - rc = i2c_iodev_submit_txrx(transaction_current, msgs, &num_msgs); - break; default: LOG_ERR("Invalid op code %d for submission %p", transaction_current->sqe.op, (void *)&transaction_current->sqe); From 24762115d40fd5d2727d7091fd247227a44cb959 Mon Sep 17 00:00:00 2001 From: Tom Burdick Date: Fri, 18 Oct 2024 09:55:25 -0500 Subject: [PATCH 1323/4482] i2c: Fix default RTIO handler transactions Transactions from RTIO should result in single calls to i2c_transfer. This corrects the default handler to first count the number of submissions in the transaction, allocate on the stack, and then copy over each submission to an equivalent i2c_msg. It also cleans up the helper functions to be infallible, taking only the submission and msg to copy to. Signed-off-by: Tom Burdick --- drivers/i2c/Kconfig | 14 ++++ drivers/i2c/i2c_rtio_default.c | 116 +++++++++++++++++++++------------ 2 files changed, 87 insertions(+), 43 deletions(-) diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index 3651b4b09ee71..86e7165bf080c 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig @@ -97,6 +97,20 @@ config I2C_RTIO_CQ_SIZE is going to be 4 given the device address, register address, and a value to be read or written. +config I2C_RTIO_FALLBACK_MSGS + int "Number of available i2c_msg structs for the default handler to use" + default 4 + help + When RTIO is used with a driver that does not yet implement the submit API + natively the submissions are converted back to struct i2c_msg values that + are given to i2c_transfer. This requires some number of msgs be available to convert + the submissions into on the stack. MISRA rules dictate we must know this in + advance. + + In all likelihood 4 is going to work for everyone, but in case you do end up with + an issue where you are using RTIO, your driver does not implement submit natively, + and get an error relating to not enough i2c msgs this is the Kconfig to manipulate. + endif # I2C_RTIO diff --git a/drivers/i2c/i2c_rtio_default.c b/drivers/i2c/i2c_rtio_default.c index 048b5b42d79a5..db278393343d2 100644 --- a/drivers/i2c/i2c_rtio_default.c +++ b/drivers/i2c/i2c_rtio_default.c @@ -12,97 +12,127 @@ #include LOG_MODULE_DECLARE(i2c_rtio, CONFIG_I2C_LOG_LEVEL); -static int i2c_iodev_submit_rx(struct rtio_iodev_sqe *iodev_sqe, struct i2c_msg msgs[2], - uint8_t *num_msgs) +static inline void i2c_msg_from_rx(const struct rtio_iodev_sqe *iodev_sqe, struct i2c_msg *msg) { __ASSERT_NO_MSG(iodev_sqe->sqe.op == RTIO_OP_RX); - msgs[0].buf = iodev_sqe->sqe.rx.buf; - msgs[0].len = iodev_sqe->sqe.rx.buf_len; - msgs[0].flags = + msg->buf = iodev_sqe->sqe.rx.buf; + msg->len = iodev_sqe->sqe.rx.buf_len; + msg->flags = ((iodev_sqe->sqe.iodev_flags & RTIO_IODEV_I2C_STOP) ? I2C_MSG_STOP : 0) | ((iodev_sqe->sqe.iodev_flags & RTIO_IODEV_I2C_RESTART) ? I2C_MSG_RESTART : 0) | ((iodev_sqe->sqe.iodev_flags & RTIO_IODEV_I2C_10_BITS) ? I2C_MSG_ADDR_10_BITS : 0) | I2C_MSG_READ; - *num_msgs = 1; - return 0; } -static int i2c_iodev_submit_tx(struct rtio_iodev_sqe *iodev_sqe, struct i2c_msg msgs[2], - uint8_t *num_msgs) +static inline void i2c_msg_from_tx(const struct rtio_iodev_sqe *iodev_sqe, struct i2c_msg *msg) { __ASSERT_NO_MSG(iodev_sqe->sqe.op == RTIO_OP_TX); - msgs[0].buf = (uint8_t *)iodev_sqe->sqe.tx.buf; - msgs[0].len = iodev_sqe->sqe.tx.buf_len; - msgs[0].flags = + msg->buf = (uint8_t *)iodev_sqe->sqe.tx.buf; + msg->len = iodev_sqe->sqe.tx.buf_len; + msg->flags = ((iodev_sqe->sqe.iodev_flags & RTIO_IODEV_I2C_STOP) ? I2C_MSG_STOP : 0) | ((iodev_sqe->sqe.iodev_flags & RTIO_IODEV_I2C_RESTART) ? I2C_MSG_RESTART : 0) | ((iodev_sqe->sqe.iodev_flags & RTIO_IODEV_I2C_10_BITS) ? I2C_MSG_ADDR_10_BITS : 0) | I2C_MSG_WRITE; - *num_msgs = 1; - return 0; } -static int i2c_iodev_submit_tiny_tx(struct rtio_iodev_sqe *iodev_sqe, struct i2c_msg msgs[2], - uint8_t *num_msgs) +static inline void i2c_msg_from_tiny_tx(const struct rtio_iodev_sqe *iodev_sqe, struct i2c_msg *msg) { __ASSERT_NO_MSG(iodev_sqe->sqe.op == RTIO_OP_TINY_TX); - msgs[0].buf = (uint8_t *)iodev_sqe->sqe.tiny_tx.buf; - msgs[0].len = iodev_sqe->sqe.tiny_tx.buf_len; - msgs[0].flags = + msg->buf = (uint8_t *)iodev_sqe->sqe.tiny_tx.buf; + msg->len = iodev_sqe->sqe.tiny_tx.buf_len; + msg->flags = ((iodev_sqe->sqe.iodev_flags & RTIO_IODEV_I2C_STOP) ? I2C_MSG_STOP : 0) | ((iodev_sqe->sqe.iodev_flags & RTIO_IODEV_I2C_RESTART) ? I2C_MSG_RESTART : 0) | ((iodev_sqe->sqe.iodev_flags & RTIO_IODEV_I2C_10_BITS) ? I2C_MSG_ADDR_10_BITS : 0) | I2C_MSG_WRITE; - *num_msgs = 1; - return 0; } -void i2c_iodev_submit_work_handler(struct rtio_iodev_sqe *iodev_sqe) +void i2c_iodev_submit_work_handler(struct rtio_iodev_sqe *txn_first) { - const struct i2c_dt_spec *dt_spec = (const struct i2c_dt_spec *)iodev_sqe->sqe.iodev->data; + const struct i2c_dt_spec *dt_spec = (const struct i2c_dt_spec *)txn_first->sqe.iodev->data; const struct device *dev = dt_spec->bus; - LOG_DBG("Sync RTIO work item for: %p", (void *)iodev_sqe); - - struct rtio_iodev_sqe *transaction_current = iodev_sqe; - struct i2c_msg msgs[2]; - uint8_t num_msgs; + LOG_DBG("Sync RTIO work item for: %p", (void *)txn_first); + uint32_t num_msgs = 0; int rc = 0; + struct rtio_iodev_sqe *txn_last = txn_first; + /* We allocate the i2c_msg's on the stack, to do so + * the count of messages needs to be determined to + * ensure we don't go over the statically sized array. + */ do { - /* Convert the iodev_sqe back to an i2c_msg */ - switch (transaction_current->sqe.op) { + switch (txn_last->sqe.op) { + case RTIO_OP_RX: + case RTIO_OP_TX: + case RTIO_OP_TINY_TX: + num_msgs++; + break; + default: + LOG_ERR("Invalid op code %d for submission %p", txn_last->sqe.op, + (void *)&txn_last->sqe); + rc = -EIO; + break; + } + txn_last = rtio_txn_next(txn_last); + } while (rc == 0 && txn_last != NULL); + + if (rc != 0) { + rtio_iodev_sqe_err(txn_first, rc); + return; + } + + /* Allocate msgs on the stack, MISRA doesn't like VLAs so we need a statically + * sized array here. It's pretty unlikely we have more than 4 i2c messages + * in a transaction as we typically would only have 2, one to write a + * register address, and another to read/write the register into an array + */ + if (num_msgs > CONFIG_I2C_RTIO_FALLBACK_MSGS) { + LOG_ERR("At most CONFIG_I2C_RTIO_FALLBACK_MSGS" + " submissions in a transaction are" + " allowed in the default handler"); + rtio_iodev_sqe_err(txn_first, -ENOMEM); + return; + } + struct i2c_msg msgs[CONFIG_I2C_RTIO_FALLBACK_MSGS]; + + rc = 0; + txn_last = txn_first; + + /* Copy the transaction into the stack allocated msgs */ + for (int i = 0; i < num_msgs; i++) { + switch (txn_last->sqe.op) { case RTIO_OP_RX: - rc = i2c_iodev_submit_rx(transaction_current, msgs, &num_msgs); + i2c_msg_from_rx(txn_last, &msgs[i]); break; case RTIO_OP_TX: - rc = i2c_iodev_submit_tx(transaction_current, msgs, &num_msgs); + i2c_msg_from_tx(txn_last, &msgs[i]); break; case RTIO_OP_TINY_TX: - rc = i2c_iodev_submit_tiny_tx(transaction_current, msgs, &num_msgs); + i2c_msg_from_tiny_tx(txn_last, &msgs[i]); break; default: - LOG_ERR("Invalid op code %d for submission %p", transaction_current->sqe.op, - (void *)&transaction_current->sqe); rc = -EIO; break; } - if (rc == 0) { - __ASSERT_NO_MSG(num_msgs > 0); + txn_last = rtio_txn_next(txn_last); + } - rc = i2c_transfer(dev, msgs, num_msgs, dt_spec->addr); - transaction_current = rtio_txn_next(transaction_current); - } - } while (rc == 0 && transaction_current != NULL); + if (rc == 0) { + __ASSERT_NO_MSG(num_msgs > 0); + + rc = i2c_transfer(dev, msgs, num_msgs, dt_spec->addr); + } if (rc != 0) { - rtio_iodev_sqe_err(iodev_sqe, rc); + rtio_iodev_sqe_err(txn_first, rc); } else { - rtio_iodev_sqe_ok(iodev_sqe, 0); + rtio_iodev_sqe_ok(txn_first, 0); } } From 5bd0912c76ef26668269c87d41d2c1923fcbb46f Mon Sep 17 00:00:00 2001 From: Tom Burdick Date: Tue, 22 Oct 2024 09:12:00 -0500 Subject: [PATCH 1324/4482] i2c: Drop transceive test, fix transfer call count Transactions should result in a single transfer call not multiple transfer calls. Transceive isn't supported by i2c and so the TXRX op isn't validated for success anymore. Signed-off-by: Tom Burdick --- tests/subsys/rtio/rtio_i2c/src/main.cpp | 38 +------------------------ 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/tests/subsys/rtio/rtio_i2c/src/main.cpp b/tests/subsys/rtio/rtio_i2c/src/main.cpp index 7ffeae0feb183..e58412ad9ca67 100644 --- a/tests/subsys/rtio/rtio_i2c/src/main.cpp +++ b/tests/subsys/rtio/rtio_i2c/src/main.cpp @@ -117,42 +117,6 @@ ZTEST(rtio_i2c, test_fallback_submit_tiny_tx) rtio_cqe_release(&test_rtio_ctx, cqe); } -ZTEST(rtio_i2c, test_fallback_submit_txrx) -{ - uint8_t tx_data[] = {0x01, 0x02, 0x03}; - uint8_t rx_data[ARRAY_SIZE(tx_data)] = {0}; - struct rtio_sqe *sqe = rtio_sqe_acquire(&test_rtio_ctx); - - blocking_emul_i2c_transfer_fake.custom_fake = - [&tx_data](const struct emul *, struct i2c_msg *msgs, int msg_count, int) { - zassert_equal(2, msg_count); - // First message should be a 'tx' - zassert_equal(ARRAY_SIZE(tx_data), msgs[0].len); - zassert_mem_equal(tx_data, msgs[0].buf, msgs[0].len); - zassert_equal(I2C_MSG_WRITE, msgs[0].flags); - // Second message should be an 'rx' - zassert_equal(ARRAY_SIZE(tx_data), msgs[1].len); - zassert_equal(I2C_MSG_READ | I2C_MSG_STOP, msgs[1].flags); - for (uint8_t i = 0; i < msgs[1].len; ++i) { - msgs[1].buf[i] = msgs[0].buf[i]; - } - return 0; - }; - - zassert_not_null(sqe); - rtio_sqe_prep_transceive(sqe, &blocking_emul_iodev, RTIO_PRIO_NORM, tx_data, rx_data, - ARRAY_SIZE(tx_data), NULL); - zassert_ok(rtio_submit(&test_rtio_ctx, 1)); - zassert_equal(1, blocking_emul_i2c_transfer_fake.call_count); - - struct rtio_cqe *cqe = rtio_cqe_consume_block(&test_rtio_ctx); - - zassert_ok(cqe->result); - zassert_mem_equal(tx_data, rx_data, ARRAY_SIZE(tx_data)); - - rtio_cqe_release(&test_rtio_ctx, cqe); -} - ZTEST(rtio_i2c, test_fallback_submit_rx) { uint8_t expected_buffer[] = {0x00, 0x01, 0x02}; @@ -237,7 +201,7 @@ ZTEST(rtio_i2c, test_fallback_transaction) phase1->flags |= RTIO_SQE_TRANSACTION; zassert_ok(rtio_submit(&test_rtio_ctx, 2)); - zassert_equal(2, blocking_emul_i2c_transfer_fake.call_count); + zassert_equal(1, blocking_emul_i2c_transfer_fake.call_count); struct rtio_cqe *cqe; From 5b4e4cfb04d1d1c95692a78516e62f1f3591d24b Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 15 Oct 2024 17:20:58 +0000 Subject: [PATCH 1325/4482] drivers: memc_mcux_flexspi: remove addr adjustment based on ADDRSHIFT The ADDRSHIFT bit simply left shifts the address written to IPCR0[SFAR], (or the address used for AHB access), by 5 bits before sending it to the attached memory. This bit does not have an effect on the base address used to access the flash/psram device. Signed-off-by: Daniel DeGrasse --- drivers/memc/memc_mcux_flexspi.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/memc/memc_mcux_flexspi.c b/drivers/memc/memc_mcux_flexspi.c index c3ad20aab4b2d..f81e677085cd5 100644 --- a/drivers/memc/memc_mcux_flexspi.c +++ b/drivers/memc/memc_mcux_flexspi.c @@ -265,14 +265,6 @@ void *memc_flexspi_get_ahb_address(const struct device *dev, offset += data->size[i]; } -#if defined(FSL_FEATURE_FLEXSPI_SUPPORT_ADDRESS_SHIFT) && \ - (FSL_FEATURE_FLEXSPI_SUPPORT_ADDRESS_SHIFT) - if (data->base->FLSHCR0[port] & FLEXSPI_FLSHCR0_ADDRSHIFT_MASK) { - /* Address shift is set, add 0x1000_0000 to AHB address */ - offset += 0x10000000; - } -#endif - return data->ahb_base + offset; } From df18121526c313f6628061ff694fbba6e9edda05 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 15 Oct 2024 19:25:27 +0000 Subject: [PATCH 1326/4482] drivers: memc_mcux_flexspi_is66wvq8m4: make addressShift unconditional is66wvq8m4 PSRAM always requires the address to be left shifted by 5 bits, regardless of which FLEXSPI port it is on. Fix the addressShift assignment to be unconditional Signed-off-by: Daniel DeGrasse --- drivers/memc/memc_mcux_flexspi_is66wvq8m4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/memc/memc_mcux_flexspi_is66wvq8m4.c b/drivers/memc/memc_mcux_flexspi_is66wvq8m4.c index 7ce698b3dd650..1a964b1454f1e 100644 --- a/drivers/memc/memc_mcux_flexspi_is66wvq8m4.c +++ b/drivers/memc/memc_mcux_flexspi_is66wvq8m4.c @@ -201,7 +201,7 @@ static int memc_flexspi_is66wvq8m4_init(const struct device *dev) .flexspiRootClk = DT_INST_PROP(n, spi_max_frequency), \ .isSck2Enabled = false, \ .flashSize = DT_INST_PROP(n, size) / 8 / KB(1), \ - .addressShift = DT_INST_REG_ADDR(n) != 0, \ + .addressShift = true, \ .CSIntervalUnit = \ CS_INTERVAL_UNIT( \ DT_INST_PROP(n, cs_interval_unit)), \ From e8d9dec1417ddb04e06b6c3cb4ae0cd4c5dcd12e Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 15 Oct 2024 17:12:50 +0000 Subject: [PATCH 1327/4482] drivers: memc: memc_mcux_flexspi: allow setting ahb alignment boundary Some instances of the FLEXSPI IP permit limiting AHB bus access so that no memory access requests will straddle a page boundary. Add a property to manage this setting. Signed-off-by: Daniel DeGrasse --- drivers/memc/memc_mcux_flexspi.c | 8 ++++++++ dts/bindings/spi/nxp,imx-flexspi.yaml | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/drivers/memc/memc_mcux_flexspi.c b/drivers/memc/memc_mcux_flexspi.c index f81e677085cd5..f62b418f7ad8e 100644 --- a/drivers/memc/memc_mcux_flexspi.c +++ b/drivers/memc/memc_mcux_flexspi.c @@ -53,6 +53,7 @@ struct memc_flexspi_data { bool ahb_cacheable; bool ahb_prefetch; bool ahb_read_addr_opt; + uint8_t ahb_boundary; bool combination_mode; bool sck_differential_clock; flexspi_read_sample_clock_t rx_sample_clock; @@ -342,6 +343,12 @@ FSL_FEATURE_FLEXSPI_SUPPORT_SEPERATE_RXCLKSRC_PORTB FLEXSPI_Init(data->base, &flexspi_config); +#if defined(FLEXSPI_AHBCR_ALIGNMENT_MASK) + /* Configure AHB alignment boundary */ + data->base->AHBCR = (data->base->AHBCR & ~FLEXSPI_AHBCR_ALIGNMENT_MASK) | + FLEXSPI_AHBCR_ALIGNMENT(data->ahb_boundary); +#endif + if (memc_flexspi_is_running_xip(dev)) { /* Restore flash sizes */ for (i = 0; i < kFLEXSPI_PortCount; i++) { @@ -414,6 +421,7 @@ static int memc_flexspi_pm_action(const struct device *dev, enum pm_device_actio .ahb_cacheable = DT_INST_PROP(n, ahb_cacheable), \ .ahb_prefetch = DT_INST_PROP(n, ahb_prefetch), \ .ahb_read_addr_opt = DT_INST_PROP(n, ahb_read_addr_opt),\ + .ahb_boundary = DT_INST_ENUM_IDX(n, ahb_boundary), \ .combination_mode = DT_INST_PROP(n, combination_mode), \ .sck_differential_clock = DT_INST_PROP(n, sck_differential_clock), \ .rx_sample_clock = DT_INST_PROP(n, rx_clock_source), \ diff --git a/dts/bindings/spi/nxp,imx-flexspi.yaml b/dts/bindings/spi/nxp,imx-flexspi.yaml index 8a266a8a91dd3..cedf484ba7a5a 100644 --- a/dts/bindings/spi/nxp,imx-flexspi.yaml +++ b/dts/bindings/spi/nxp,imx-flexspi.yaml @@ -86,6 +86,18 @@ properties: master_id: AHBRXBUFxCRx[MSTRID] buf_size: AHBRXBUFxCRx[BUFSZ] + ahb-boundary: + type: string + default: "no-boundary" + enum: + - "no-boundary" + - "1024" + - "512" + - "256" + description: | + Sets the AHB read/write boundary. Only supported by some versions of + the FLEXSPI IP. When set, all memory accesses that cross an address + boundary of the specified size will be divided into smaller sub accesses. child-binding: description: NXP FlexSPI port From cc1266ad6a2f73dec72e37c737e7db707265d7f6 Mon Sep 17 00:00:00 2001 From: David Missael Maciel Date: Tue, 15 Oct 2024 16:58:46 +0000 Subject: [PATCH 1328/4482] drivers: memc: add memc_mcux_flexspi_aps6404l driver Add driver for aps6404l PSRAM, using FlexSPI MEMC driver interface. Signed-off-by: David Missael Maciel --- drivers/memc/CMakeLists.txt | 1 + drivers/memc/Kconfig.mcux | 6 + drivers/memc/memc_mcux_flexspi_aps6404l.c | 268 ++++++++++++++++++ .../mtd/nxp,imx-flexspi-aps6404l.yaml | 8 + 4 files changed, 283 insertions(+) create mode 100644 drivers/memc/memc_mcux_flexspi_aps6404l.c create mode 100644 dts/bindings/mtd/nxp,imx-flexspi-aps6404l.yaml diff --git a/drivers/memc/CMakeLists.txt b/drivers/memc/CMakeLists.txt index c45825d68cafc..5cfb571c34233 100644 --- a/drivers/memc/CMakeLists.txt +++ b/drivers/memc/CMakeLists.txt @@ -11,6 +11,7 @@ zephyr_library_sources_ifdef(CONFIG_MEMC_MCUX_FLEXSPI memc_mcux_flexspi.c) zephyr_library_sources_ifdef(CONFIG_MEMC_MCUX_FLEXSPI_W956A8MBYA memc_mcux_flexspi_w956a8mbya.c) zephyr_library_sources_ifdef(CONFIG_MEMC_MCUX_FLEXSPI_S27KS0641 memc_mcux_flexspi_s27ks0641.c) zephyr_library_sources_ifdef(CONFIG_MEMC_MCUX_FLEXSPI_APS6408L memc_mcux_flexspi_aps6408l.c) +zephyr_library_sources_ifdef(CONFIG_MEMC_MCUX_FLEXSPI_APS6404L memc_mcux_flexspi_aps6404l.c) zephyr_library_sources_ifdef(CONFIG_MEMC_MCUX_FLEXSPI_IS66WVQ8M4 memc_mcux_flexspi_is66wvq8m4.c) zephyr_library_sources_ifdef(CONFIG_MEMC_NXP_FLEXRAM memc_nxp_flexram.c) diff --git a/drivers/memc/Kconfig.mcux b/drivers/memc/Kconfig.mcux index 7d231808ea375..23aac7e3fa72a 100644 --- a/drivers/memc/Kconfig.mcux +++ b/drivers/memc/Kconfig.mcux @@ -30,6 +30,12 @@ config MEMC_MCUX_FLEXSPI_IS66WVQ8M4 depends on DT_HAS_NXP_IMX_FLEXSPI_IS66WVQ8M4_ENABLED select MEMC_MCUX_FLEXSPI +config MEMC_MCUX_FLEXSPI_APS6404L + bool "MCUX FlexSPI AP Memory APS6404L pSRAM driver" + default y + depends on DT_HAS_NXP_IMX_FLEXSPI_APS6404L_ENABLED + select MEMC_MCUX_FLEXSPI + config MEMC_MCUX_FLEXSPI_INIT_PRIORITY int "MCUX FLEXSPI MEMC driver initialization priority" default MEMC_INIT_PRIORITY diff --git a/drivers/memc/memc_mcux_flexspi_aps6404l.c b/drivers/memc/memc_mcux_flexspi_aps6404l.c new file mode 100644 index 0000000000000..cbf7182112df9 --- /dev/null +++ b/drivers/memc/memc_mcux_flexspi_aps6404l.c @@ -0,0 +1,268 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + + /* + * Based on memc_mcux_flexspi_s27ks0641, which is: Copyright 2021 Basalte bv + */ + + #define DT_DRV_COMPAT nxp_imx_flexspi_aps6404l + + #include + #include + #include + + #include "memc_mcux_flexspi.h" + + +/* + * NOTE: If CONFIG_FLASH_MCUX_FLEXSPI_XIP is selected, Any external functions + * called while interacting with the flexspi MUST be relocated to SRAM or ITCM + * at runtime, so that the chip does not access the flexspi to read program + * instructions while it is being written to + */ +#if defined(CONFIG_FLASH_MCUX_FLEXSPI_XIP) && (CONFIG_MEMC_LOG_LEVEL > 0) +#warning "Enabling memc driver logging and XIP mode simultaneously can cause \ + read-while-write hazards. This configuration is not recommended." +#endif + +LOG_MODULE_REGISTER(memc_flexspi_aps6404l, CONFIG_MEMC_LOG_LEVEL); + +#define APM_VENDOR_ID 0xD + +enum { + READ_DATA = 0, + WRITE_DATA, + RESET_EN, + RESET, + READ_ID +}; + +struct memc_flexspi_aps6404l_config { + flexspi_port_t port; + flexspi_device_config_t config; +}; + +/* Device variables used in critical sections should be in this structure */ +struct memc_flexspi_aps6404l_data { + const struct device *controller; +}; + + +static const uint32_t memc_flexspi_aps6404l_lut[][4] = { + /* Read Data (Sync read, linear burst) */ + [READ_DATA] = { + FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0xEB, + kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_4PAD, 0x18), + FLEXSPI_LUT_SEQ(kFLEXSPI_Command_DUMMY_SDR, kFLEXSPI_4PAD, + 0x06, kFLEXSPI_Command_READ_SDR, kFLEXSPI_4PAD, 0x04), + }, + /* Write Data (Sync write, linear burst) */ + [WRITE_DATA] = { + FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x38, + kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_4PAD, 0x18), + FLEXSPI_LUT_SEQ(kFLEXSPI_Command_WRITE_SDR, kFLEXSPI_4PAD, + 0x00, kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0x00), + }, + + [RESET_EN] = { + FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x66, + kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0x00), + }, + /* Reset (Global reset) */ + [RESET] = { + FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x99, + kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0x00), + }, + + [READ_ID] = { + FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x9F, + kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_1PAD, 0x18), + FLEXSPI_LUT_SEQ(kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x08, + kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0), + }, +}; + + +static int memc_flexspi_aps6404l_get_vendor_id(const struct device *dev, + uint8_t *vendor_id) +{ + const struct memc_flexspi_aps6404l_config *config = dev->config; + struct memc_flexspi_aps6404l_data *data = dev->data; + uint32_t buffer = 0; + int ret; + + flexspi_transfer_t transfer = { + .deviceAddress = 0x0, + .port = config->port, + .cmdType = kFLEXSPI_Read, + .SeqNumber = 1, + .seqIndex = READ_ID, + .data = &buffer, + .dataSize = 1, + }; + + ret = memc_flexspi_transfer(data->controller, &transfer); + *vendor_id = buffer & 0x1f; + + return ret; +} + +static int memc_flexspi_aps6404l_reset_enable(const struct device *dev) +{ + const struct memc_flexspi_aps6404l_config *config = dev->config; + struct memc_flexspi_aps6404l_data *data = dev->data; + int ret; + + flexspi_transfer_t transfer = { + .deviceAddress = 0x0, + .port = config->port, + .cmdType = kFLEXSPI_Command, + .SeqNumber = 1, + .seqIndex = RESET_EN, + .data = NULL, + .dataSize = 0, + }; + + LOG_DBG("Enabling reset ram"); + ret = memc_flexspi_transfer(data->controller, &transfer); + if (ret < 0) { + return ret; + } + /* We need to delay 5 ms to allow APS6404L pSRAM to reinitialize */ + k_msleep(5); + + return ret; +} + + +static int memc_flexspi_aps6404l_reset(const struct device *dev) +{ + const struct memc_flexspi_aps6404l_config *config = dev->config; + struct memc_flexspi_aps6404l_data *data = dev->data; + int ret; + + flexspi_transfer_t transfer = { + .deviceAddress = 0x0, + .port = config->port, + .cmdType = kFLEXSPI_Command, + .SeqNumber = 1, + .seqIndex = RESET, + .data = NULL, + .dataSize = 0, + }; + + LOG_DBG("Resetting ram"); + ret = memc_flexspi_transfer(data->controller, &transfer); + if (ret < 0) { + return ret; + } + /* We need to delay 5 ms to allow APS6404L pSRAM to reinitialize */ + k_msleep(5); + + return ret; +} + +static int memc_flexspi_aps6404l_init(const struct device *dev) +{ + const struct memc_flexspi_aps6404l_config *config = dev->config; + struct memc_flexspi_aps6404l_data *data = dev->data; + uint8_t vendor_id; + + if (!device_is_ready(data->controller)) { + LOG_ERR("Controller device not ready"); + return -ENODEV; + } + + if (memc_flexspi_set_device_config(data->controller, &config->config, + (const uint32_t *) memc_flexspi_aps6404l_lut, + sizeof(memc_flexspi_aps6404l_lut) / MEMC_FLEXSPI_CMD_SIZE, + config->port)) { + LOG_ERR("Could not set device configuration"); + return -EINVAL; + } + + memc_flexspi_reset(data->controller); + + if (memc_flexspi_aps6404l_reset_enable(dev)) { + LOG_ERR("Could not enable reset pSRAM"); + return -EIO; + } + + if (memc_flexspi_aps6404l_reset(dev)) { + LOG_ERR("Could not reset pSRAM"); + return -EIO; + } + + if (memc_flexspi_aps6404l_get_vendor_id(dev, &vendor_id)) { + LOG_ERR("Could not read vendor id"); + return -EIO; + } + LOG_DBG("Vendor id: 0x%0x", vendor_id); + if (vendor_id != APM_VENDOR_ID) { + LOG_WRN("Vendor ID does not match expected value of 0x%0x", + APM_VENDOR_ID); + } + + return 0; +} + +#define CONCAT3(x, y, z) x ## y ## z + +#define CS_INTERVAL_UNIT(unit) \ + CONCAT3(kFLEXSPI_CsIntervalUnit, unit, SckCycle) + +#define AHB_WRITE_WAIT_UNIT(unit) \ + CONCAT3(kFLEXSPI_AhbWriteWaitUnit, unit, AhbCycle) + +#define MEMC_FLEXSPI_DEVICE_CONFIG(n) \ + { \ + .flexspiRootClk = DT_INST_PROP(n, spi_max_frequency), \ + .isSck2Enabled = false, \ + .flashSize = DT_INST_PROP(n, size) / 8 / KB(1), \ + .addressShift = false, \ + .CSIntervalUnit = \ + CS_INTERVAL_UNIT( \ + DT_INST_PROP(n, cs_interval_unit)), \ + .CSInterval = DT_INST_PROP(n, cs_interval), \ + .CSHoldTime = DT_INST_PROP(n, cs_hold_time), \ + .CSSetupTime = DT_INST_PROP(n, cs_setup_time), \ + .dataValidTime = DT_INST_PROP(n, data_valid_time), \ + .columnspace = DT_INST_PROP(n, column_space), \ + .enableWordAddress = DT_INST_PROP(n, word_addressable), \ + .AWRSeqIndex = WRITE_DATA, \ + .AWRSeqNumber = 1, \ + .ARDSeqIndex = READ_DATA, \ + .ARDSeqNumber = 1, \ + .AHBWriteWaitUnit = \ + AHB_WRITE_WAIT_UNIT( \ + DT_INST_PROP(n, ahb_write_wait_unit)), \ + .AHBWriteWaitInterval = \ + DT_INST_PROP(n, ahb_write_wait_interval), \ + .enableWriteMask = false, \ + } \ + +#define MEMC_FLEXSPI_APS6404L(n) \ + static const struct memc_flexspi_aps6404l_config \ + memc_flexspi_aps6404l_config_##n = { \ + .port = DT_INST_REG_ADDR(n), \ + .config = MEMC_FLEXSPI_DEVICE_CONFIG(n), \ + }; \ + \ + static struct memc_flexspi_aps6404l_data \ + memc_flexspi_aps6404l_data_##n = { \ + .controller = DEVICE_DT_GET(DT_INST_BUS(n)), \ + }; \ + \ + DEVICE_DT_INST_DEFINE(n, \ + memc_flexspi_aps6404l_init, \ + NULL, \ + &memc_flexspi_aps6404l_data_##n, \ + &memc_flexspi_aps6404l_config_##n, \ + POST_KERNEL, \ + CONFIG_MEMC_INIT_PRIORITY, \ + NULL); + +DT_INST_FOREACH_STATUS_OKAY(MEMC_FLEXSPI_APS6404L) diff --git a/dts/bindings/mtd/nxp,imx-flexspi-aps6404l.yaml b/dts/bindings/mtd/nxp,imx-flexspi-aps6404l.yaml new file mode 100644 index 0000000000000..1f38a7288be82 --- /dev/null +++ b/dts/bindings/mtd/nxp,imx-flexspi-aps6404l.yaml @@ -0,0 +1,8 @@ +# Copyright 2022 NXP +# SPDX-License-Identifier: Apache-2.0 + +description: AP Memory APS6404L pSRAM on NXP FlexSPI bus + +compatible: "nxp,imx-flexspi-aps6404l" + +include: nxp,imx-flexspi-device.yaml From 05acc88f98feb4b0c82fd49893840669a23b5c58 Mon Sep 17 00:00:00 2001 From: David Missael Maciel Date: Tue, 15 Oct 2024 17:00:02 +0000 Subject: [PATCH 1329/4482] boards: nxp: frdm_rw612: add aps6404l PSRAM Add entry for aps6404l PSRAM on frdm_rw612 board Signed-off-by: David Missael Maciel --- boards/nxp/frdm_rw612/frdm_rw612.dts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/boards/nxp/frdm_rw612/frdm_rw612.dts b/boards/nxp/frdm_rw612/frdm_rw612.dts index 03c8adc32875c..e3868f95f77e4 100644 --- a/boards/nxp/frdm_rw612/frdm_rw612.dts +++ b/boards/nxp/frdm_rw612/frdm_rw612.dts @@ -56,6 +56,13 @@ &flexspi { status = "okay"; + ahb-bufferable; + ahb-prefetch; + ahb-cacheable; + ahb-read-addr-opt; + ahb-boundary = "1024"; + rx-clock-source = <1>; + rx-clock-source-b = <1>; /* Winbond external flash */ w25q512jvfiq: w25q512jvfiq@0 { compatible = "nxp,imx-flexspi-nor"; @@ -66,6 +73,25 @@ write-block-size = <1>; spi-max-frequency = <133000000>; }; + aps6404l: aps6404l@2 { + compatible = "nxp,imx-flexspi-aps6404l"; + /* APS6404L is 8MB, 64MBit pSRAM */ + size = ; + reg = <2>; + spi-max-frequency = <109000000>; + /* PSRAM cannot be enabled while board is in default XIP + * configuration, as it will conflict with flash chip. + */ + status = "disabled"; + cs-interval-unit = <1>; + cs-interval = <2>; + cs-hold-time = <3>; + cs-setup-time = <3>; + data-valid-time = <6>; + column-space = <0>; + ahb-write-wait-unit = <2>; + ahb-write-wait-interval = <0>; + }; }; &hci { From cddf01d5a0014e8af4fce5fc92ecc85fa158ac42 Mon Sep 17 00:00:00 2001 From: David Missael Maciel Date: Tue, 15 Oct 2024 17:00:29 +0000 Subject: [PATCH 1330/4482] samples: drivers: memc: enable support for FRDM_RW612 Enable support for FRDM_RW612 with memc driver sample, using attached aps6404l PSRAM. Signed-off-by: David Missael Maciel --- samples/drivers/memc/boards/frdm_rw612.conf | 22 ++++++++ .../drivers/memc/boards/frdm_rw612.overlay | 51 +++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 samples/drivers/memc/boards/frdm_rw612.conf create mode 100644 samples/drivers/memc/boards/frdm_rw612.overlay diff --git a/samples/drivers/memc/boards/frdm_rw612.conf b/samples/drivers/memc/boards/frdm_rw612.conf new file mode 100644 index 0000000000000..c2db760062608 --- /dev/null +++ b/samples/drivers/memc/boards/frdm_rw612.conf @@ -0,0 +1,22 @@ +# Copyright 2024 NXP +# SPDX-License-Identifier: Apache-2.0 + +# In order to safely access the PSRAM on port B of the RW FlexSPI peripheral, +# the QSPI flash on port A must be configured by the application. Otherwise, +# the PSRAM configuration will overwrite the LUT entries for the QSPI flash, +# and the application will no longer be able to XIP from the flash. +# To make sure the QSPI flash is configured, enable flash drivers. +CONFIG_FLASH=y + +# Initialization priorities are critical here. The FlexSPI MEMC driver must +# initialize first. Then, the QSPI flash driver must initialize to program +# the LUT table for port A. Finally, the PSRAM driver can initialize and +# program the LUT table for port B +CONFIG_MEMC_MCUX_FLEXSPI_INIT_PRIORITY=0 +CONFIG_FLASH_INIT_PRIORITY=50 +CONFIG_MEMC_INIT_PRIORITY=60 + +# This board has the PSRAM attached to the same FLEXSPI device as the flash +# chip used for XIP, so we must explicitly enable the FLEXSPI MEMC driver +# to reconfigure the flash device it is executing from +CONFIG_MEMC_MCUX_FLEXSPI_INIT_XIP=y diff --git a/samples/drivers/memc/boards/frdm_rw612.overlay b/samples/drivers/memc/boards/frdm_rw612.overlay new file mode 100644 index 0000000000000..88b2498e592fa --- /dev/null +++ b/samples/drivers/memc/boards/frdm_rw612.overlay @@ -0,0 +1,51 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + aliases { + sram-ext = &aps6404l; + }; +}; + +&w25q512jvfiq { + /* + * Lower max FlexSPI frequency to 109MHz, as the PSRAM does not support + * higher frequencies at 3.3V + */ + spi-max-frequency = <109000000>; +}; + +&aps6404l { + status = "okay"; +}; + +&pinctrl { + pinmux_flexspi_safe: pinmux-flexspi-safe { + group0 { + pinmux = ; + slew-rate = "normal"; + }; + + group1 { + pinmux = ; + slew-rate = "normal"; + bias-pull-down; + }; + }; +}; + +/* Override pin control state to use one that only changes the PSRAM pin + * configuration + */ +&flexspi { + pinctrl-0 = <&pinmux_flexspi_safe>; + pinctrl-names = "default"; +}; From f81c1de1302328dd3799bf291d1c88759dabd5de Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Thu, 3 Oct 2024 22:31:39 +0200 Subject: [PATCH 1331/4482] drivers: serial: Sort CMake and Kconfig files alphabetically By sorting the lines alphabetically, merge conflicts can be reduced. Signed-off-by: Reto Schneider --- drivers/serial/CMakeLists.txt | 125 +++++++++++++------------ drivers/serial/Kconfig | 167 +++++++++++----------------------- 2 files changed, 117 insertions(+), 175 deletions(-) diff --git a/drivers/serial/CMakeLists.txt b/drivers/serial/CMakeLists.txt index f264370f9a87f..6dabc0e8e3e38 100644 --- a/drivers/serial/CMakeLists.txt +++ b/drivers/serial/CMakeLists.txt @@ -3,83 +3,94 @@ zephyr_syscall_header(${ZEPHYR_BASE}/include/zephyr/drivers/uart.h) zephyr_library() -zephyr_library_sources_ifdef(CONFIG_UART_ALTERA_JTAG uart_altera_jtag.c) + +# zephyr-keep-sorted-start +zephyr_library_sources_ifdef(CONFIG_SERIAL_TEST serial_test.c) +zephyr_library_sources_ifdef(CONFIG_UART_ASYNC_RX_HELPER uart_async_rx.c) +zephyr_library_sources_ifdef(CONFIG_UART_ASYNC_TO_INT_DRIVEN_API uart_async_to_irq.c) +zephyr_library_sources_ifdef(CONFIG_USB_CDC_ACM ${ZEPHYR_BASE}/misc/empty_file.c) +# zephyr-keep-sorted-stop + +# zephyr-keep-sorted-start +zephyr_library_sources_ifdef(CONFIG_LEUART_GECKO leuart_gecko.c) +zephyr_library_sources_ifdef(CONFIG_SERIAL_ESP32_USB serial_esp32_usb.c) zephyr_library_sources_ifdef(CONFIG_UART_ALTERA uart_altera.c) -zephyr_library_sources_ifdef(CONFIG_UART_TELINK_B91 uart_b91.c) -zephyr_library_sources_ifdef(CONFIG_UART_IMX uart_imx.c) -zephyr_library_sources_ifdef(CONFIG_UART_ITE_IT8XXX2 uart_ite_it8xxx2.c) +zephyr_library_sources_ifdef(CONFIG_UART_ALTERA_JTAG uart_altera_jtag.c) +zephyr_library_sources_ifdef(CONFIG_UART_APBUART uart_apbuart.c) +zephyr_library_sources_ifdef(CONFIG_UART_BCM2711_MU uart_bcm2711.c) +zephyr_library_sources_ifdef(CONFIG_UART_BT uart_bt.c) zephyr_library_sources_ifdef(CONFIG_UART_CC13XX_CC26XX uart_cc13xx_cc26xx.c) zephyr_library_sources_ifdef(CONFIG_UART_CC32XX uart_cc32xx.c) +zephyr_library_sources_ifdef(CONFIG_UART_CDNS uart_cdns.c) zephyr_library_sources_ifdef(CONFIG_UART_CMSDK_APB uart_cmsdk_apb.c) +zephyr_library_sources_ifdef(CONFIG_UART_EFINIX_SAPPIHIRE uart_efinix_sapphire.c) +zephyr_library_sources_ifdef(CONFIG_UART_EMUL uart_emul.c) +zephyr_library_sources_ifdef(CONFIG_UART_ENE_KB1200 uart_ene_kb1200.c) zephyr_library_sources_ifdef(CONFIG_UART_ESP32 uart_esp32.c) -zephyr_library_sources_ifdef(CONFIG_SERIAL_ESP32_USB serial_esp32_usb.c) -zephyr_library_sources_ifdef(CONFIG_UART_SIFIVE uart_sifive.c) zephyr_library_sources_ifdef(CONFIG_UART_GECKO uart_gecko.c) -zephyr_library_sources_ifdef(CONFIG_LEUART_GECKO leuart_gecko.c) +zephyr_library_sources_ifdef(CONFIG_UART_HOSTLINK uart_hostlink.c) +zephyr_library_sources_ifdef(CONFIG_UART_IMX uart_imx.c) +zephyr_library_sources_ifdef(CONFIG_UART_INFINEON_CAT1 uart_ifx_cat1.c) +zephyr_library_sources_ifdef(CONFIG_UART_INTEL_LW uart_intel_lw.c) +zephyr_library_sources_ifdef(CONFIG_UART_ITE_IT8XXX2 uart_ite_it8xxx2.c) +zephyr_library_sources_ifdef(CONFIG_UART_LITEX uart_litex.c) zephyr_library_sources_ifdef(CONFIG_UART_LPC11U6X uart_lpc11u6x.c) +zephyr_library_sources_ifdef(CONFIG_UART_MAX32 uart_max32.c) zephyr_library_sources_ifdef(CONFIG_UART_MCUX uart_mcux.c) zephyr_library_sources_ifdef(CONFIG_UART_MCUX_FLEXCOMM uart_mcux_flexcomm.c) zephyr_library_sources_ifdef(CONFIG_UART_MCUX_IUART uart_mcux_iuart.c) -zephyr_library_sources_ifdef(CONFIG_UART_MCUX_LPUART uart_mcux_lpuart.c) zephyr_library_sources_ifdef(CONFIG_UART_MCUX_LPSCI uart_mcux_lpsci.c) +zephyr_library_sources_ifdef(CONFIG_UART_MCUX_LPUART uart_mcux_lpuart.c) zephyr_library_sources_ifdef(CONFIG_UART_MIV uart_miv.c) zephyr_library_sources_ifdef(CONFIG_UART_MSP432P4XX uart_msp432p4xx.c) -zephyr_library_sources_ifdef(CONFIG_UART_NS16550 uart_ns16550.c) +zephyr_library_sources_ifdef(CONFIG_UART_NEORV32 uart_neorv32.c) +zephyr_library_sources_ifdef(CONFIG_UART_NPCX uart_npcx.c) zephyr_library_sources_ifdef(CONFIG_UART_NRFX_UART uart_nrfx_uart.c) -if (CONFIG_UART_NRFX_UARTE) - if (CONFIG_UART_NRFX_UARTE_LEGACY_SHIM) - zephyr_library_sources(uart_nrfx_uarte.c) - else() - zephyr_library_sources(uart_nrfx_uarte2.c) - endif() -endif() +zephyr_library_sources_ifdef(CONFIG_UART_NS16550 uart_ns16550.c) +zephyr_library_sources_ifdef(CONFIG_UART_NUMAKER uart_numaker.c) zephyr_library_sources_ifdef(CONFIG_UART_NUMICRO uart_numicro.c) -zephyr_library_sources_ifdef(CONFIG_UART_SAM uart_sam.c) -zephyr_library_sources_ifdef(CONFIG_USART_SAM usart_sam.c) -zephyr_library_sources_ifdef(CONFIG_UART_STELLARIS uart_stellaris.c) -zephyr_library_sources_ifdef(CONFIG_UART_STM32 uart_stm32.c) -zephyr_library_sources_ifdef(CONFIG_UART_SAM0 uart_sam0.c) -zephyr_library_sources_ifdef(CONFIG_UART_PSOC6 uart_psoc6.c) +zephyr_library_sources_ifdef(CONFIG_UART_NXP_S32_LINFLEXD uart_nxp_s32_linflexd.c) +zephyr_library_sources_ifdef(CONFIG_UART_OPENTITAN uart_opentitan.c) +zephyr_library_sources_ifdef(CONFIG_UART_PIPE uart_pipe.c) zephyr_library_sources_ifdef(CONFIG_UART_PL011 uart_pl011.c) +zephyr_library_sources_ifdef(CONFIG_UART_PSOC6 uart_psoc6.c) zephyr_library_sources_ifdef(CONFIG_UART_QUICKLOGIC_USBSERIALPORT_S3B uart_ql_usbserialport_s3b.c) -zephyr_library_sources_ifdef(CONFIG_UART_RV32M1_LPUART uart_rv32m1_lpuart.c) +zephyr_library_sources_ifdef(CONFIG_UART_RA8_SCI_B uart_renesas_ra8_sci_b.c) +zephyr_library_sources_ifdef(CONFIG_UART_RCAR uart_rcar.c) +zephyr_library_sources_ifdef(CONFIG_UART_RENESAS_RA uart_renesas_ra.c) zephyr_library_sources_ifdef(CONFIG_UART_RPI_PICO_PIO uart_rpi_pico_pio.c) -zephyr_library_sources_ifdef(CONFIG_UART_LITEX uart_litex.c) zephyr_library_sources_ifdef(CONFIG_UART_RTT_DRIVER uart_rtt.c) +zephyr_library_sources_ifdef(CONFIG_UART_RV32M1_LPUART uart_rv32m1_lpuart.c) +zephyr_library_sources_ifdef(CONFIG_UART_RZT2M uart_rzt2m.c) +zephyr_library_sources_ifdef(CONFIG_UART_SAM uart_sam.c) +zephyr_library_sources_ifdef(CONFIG_UART_SAM0 uart_sam0.c) +zephyr_library_sources_ifdef(CONFIG_UART_SCI_RA uart_renesas_ra_sci.c) +zephyr_library_sources_ifdef(CONFIG_UART_SEDI uart_sedi.c) +zephyr_library_sources_ifdef(CONFIG_UART_SI32_USART uart_si32_usart.c) +zephyr_library_sources_ifdef(CONFIG_UART_SIFIVE uart_sifive.c) +zephyr_library_sources_ifdef(CONFIG_UART_SMARTBOND uart_smartbond.c) +zephyr_library_sources_ifdef(CONFIG_UART_STELLARIS uart_stellaris.c) +zephyr_library_sources_ifdef(CONFIG_UART_STM32 uart_stm32.c) +zephyr_library_sources_ifdef(CONFIG_UART_SY1XX uart_sy1xx.c) +zephyr_library_sources_ifdef(CONFIG_UART_TELINK_B91 uart_b91.c) +zephyr_library_sources_ifdef(CONFIG_UART_XEC uart_mchp_xec.c) +zephyr_library_sources_ifdef(CONFIG_UART_XEN_HVC uart_hvc_xen.c) +zephyr_library_sources_ifdef(CONFIG_UART_XEN_HVC_CONSOLEIO uart_hvc_xen_consoleio.c) zephyr_library_sources_ifdef(CONFIG_UART_XLNX_PS uart_xlnx_ps.c) zephyr_library_sources_ifdef(CONFIG_UART_XLNX_UARTLITE uart_xlnx_uartlite.c) zephyr_library_sources_ifdef(CONFIG_UART_XMC4XXX uart_xmc4xxx.c) -zephyr_library_sources_ifdef(CONFIG_UART_NPCX uart_npcx.c) -zephyr_library_sources_ifdef(CONFIG_UART_APBUART uart_apbuart.c) -zephyr_library_sources_ifdef(CONFIG_USB_CDC_ACM ${ZEPHYR_BASE}/misc/empty_file.c) -zephyr_library_sources_ifdef(CONFIG_UART_RCAR uart_rcar.c) -zephyr_library_sources_ifdef(CONFIG_UART_XEC uart_mchp_xec.c) -zephyr_library_sources_ifdef(CONFIG_UART_NEORV32 uart_neorv32.c) zephyr_library_sources_ifdef(CONFIG_USART_GD32 usart_gd32.c) -zephyr_library_sources_ifdef(CONFIG_UART_XEN_HVC uart_hvc_xen.c) -zephyr_library_sources_ifdef(CONFIG_UART_XEN_HVC_CONSOLEIO uart_hvc_xen_consoleio.c) -zephyr_library_sources_ifdef(CONFIG_UART_INFINEON_CAT1 uart_ifx_cat1.c) -zephyr_library_sources_ifdef(CONFIG_UART_PIPE uart_pipe.c) -zephyr_library_sources_ifdef(CONFIG_UART_SMARTBOND uart_smartbond.c) -zephyr_library_sources_ifdef(CONFIG_UART_NXP_S32_LINFLEXD uart_nxp_s32_linflexd.c) -zephyr_library_sources_ifdef(CONFIG_UART_CDNS uart_cdns.c) -zephyr_library_sources_ifdef(CONFIG_UART_OPENTITAN uart_opentitan.c) -zephyr_library_sources_ifdef(CONFIG_UART_HOSTLINK uart_hostlink.c) -zephyr_library_sources_ifdef(CONFIG_UART_EMUL uart_emul.c) -zephyr_library_sources_ifdef(CONFIG_UART_NUMAKER uart_numaker.c) -zephyr_library_sources_ifdef(CONFIG_UART_EFINIX_SAPPIHIRE uart_efinix_sapphire.c) -zephyr_library_sources_ifdef(CONFIG_UART_SEDI uart_sedi.c) -zephyr_library_sources_ifdef(CONFIG_UART_MAX32 uart_max32.c) -zephyr_library_sources_ifdef(CONFIG_UART_BCM2711_MU uart_bcm2711.c) -zephyr_library_sources_ifdef(CONFIG_UART_INTEL_LW uart_intel_lw.c) -zephyr_library_sources_ifdef(CONFIG_UART_RENESAS_RA uart_renesas_ra.c) -zephyr_library_sources_ifdef(CONFIG_UART_ENE_KB1200 uart_ene_kb1200.c) -zephyr_library_sources_ifdef(CONFIG_UART_RZT2M uart_rzt2m.c) -zephyr_library_sources_ifdef(CONFIG_UART_RA8_SCI_B uart_renesas_ra8_sci_b.c) -zephyr_library_sources_ifdef(CONFIG_UART_SI32_USART uart_si32_usart.c) -zephyr_library_sources_ifdef(CONFIG_USERSPACE uart_handlers.c) -zephyr_library_sources_ifdef(CONFIG_UART_SCI_RA uart_renesas_ra_sci.c) -zephyr_library_sources_ifdef(CONFIG_UART_SY1XX uart_sy1xx.c) +zephyr_library_sources_ifdef(CONFIG_USART_SAM usart_sam.c) +zephyr_library_sources_ifdef(CONFIG_USERSPACE uart_handlers.c) +# zephyr-keep-sorted-stop + +if (CONFIG_UART_NRFX_UARTE) + if (CONFIG_UART_NRFX_UARTE_LEGACY_SHIM) + zephyr_library_sources(uart_nrfx_uarte.c) + else() + zephyr_library_sources(uart_nrfx_uarte2.c) + endif() +endif() if(CONFIG_UART_NATIVE_POSIX) zephyr_library_compile_definitions(NO_POSIX_CHEATS) @@ -100,9 +111,3 @@ if(CONFIG_UART_NATIVE_TTY) target_sources(native_simulator INTERFACE uart_native_tty_bottom.c) endif() endif() - -zephyr_library_sources_ifdef(CONFIG_UART_BT uart_bt.c) - -zephyr_library_sources_ifdef(CONFIG_SERIAL_TEST serial_test.c) -zephyr_library_sources_ifdef(CONFIG_UART_ASYNC_RX_HELPER uart_async_rx.c) -zephyr_library_sources_ifdef(CONFIG_UART_ASYNC_TO_INT_DRIVEN_API uart_async_to_irq.c) diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 673e38671f223..a8b20fe2877b4 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -150,137 +150,74 @@ config UART_ASYNC_TO_INT_DRIVEN_RX_TIMEOUT comment "Serial Drivers" +# zephyr-keep-sorted-start +rsource "Kconfig.altera" +rsource "Kconfig.altera_jtag" +rsource "Kconfig.apbuart" rsource "Kconfig.b91" - -rsource "Kconfig.ns16550" - +rsource "Kconfig.bcm2711" +rsource "Kconfig.bt" +rsource "Kconfig.cc13xx_cc26xx" +rsource "Kconfig.cc32xx" +rsource "Kconfig.cdns" +rsource "Kconfig.cmsdk_apb" +rsource "Kconfig.efinix_sapphire" +rsource "Kconfig.emul" +rsource "Kconfig.ene" +rsource "Kconfig.esp32" +rsource "Kconfig.gd32" +rsource "Kconfig.gecko" +rsource "Kconfig.hostlink" +rsource "Kconfig.ifx_cat1" +rsource "Kconfig.imx" +rsource "Kconfig.intel_lw" +rsource "Kconfig.it8xxx2" +rsource "Kconfig.leuart_gecko" +rsource "Kconfig.litex" +rsource "Kconfig.lpc11u6x" +rsource "Kconfig.max32" rsource "Kconfig.mcux" - rsource "Kconfig.mcux_flexcomm" - rsource "Kconfig.mcux_iuart" - rsource "Kconfig.mcux_lpsci" - rsource "Kconfig.mcux_lpuart" - rsource "Kconfig.miv" - -rsource "Kconfig.imx" - -rsource "Kconfig.it8xxx2" - -rsource "Kconfig.stellaris" - +rsource "Kconfig.msp432p4xx" rsource "Kconfig.native_posix" - -rsource "Kconfig.usart_sam" - -rsource "Kconfig.uart_sam" - -rsource "Kconfig.stm32" - +rsource "Kconfig.native_tty" +rsource "Kconfig.neorv32" +rsource "Kconfig.npcx" rsource "Kconfig.nrfx" - -rsource "Kconfig.altera_jtag" - -rsource "Kconfig.cc13xx_cc26xx" - -rsource "Kconfig.cc32xx" - -rsource "Kconfig.cmsdk_apb" - -rsource "Kconfig.sifive" - -rsource "Kconfig.esp32" - -rsource "Kconfig.gecko" - -rsource "Kconfig.leuart_gecko" - -rsource "Kconfig.msp432p4xx" - +rsource "Kconfig.ns16550" +rsource "Kconfig.numaker" rsource "Kconfig.numicro" - -rsource "Kconfig.sam0" - -rsource "Kconfig.psoc6" - +rsource "Kconfig.nxp_s32" +rsource "Kconfig.opentitan" rsource "Kconfig.pl011" - +rsource "Kconfig.psoc6" rsource "Kconfig.ql_usbserialport_s3b" - -rsource "Kconfig.rv32m1_lpuart" - -rsource "Kconfig.rpi_pico" - -rsource "Kconfig.litex" - -rsource "Kconfig.rtt" - -rsource "Kconfig.bt" - -rsource "Kconfig.xlnx" - -rsource "Kconfig.xmc4xxx" - -rsource "Kconfig.lpc11u6x" - -rsource "Kconfig.npcx" - -rsource "Kconfig.apbuart" - rsource "Kconfig.rcar" - -rsource "Kconfig.xec" - -rsource "Kconfig.gd32" - -rsource "Kconfig.test" - -rsource "Kconfig.neorv32" - -rsource "Kconfig.xen" - -rsource "Kconfig.ifx_cat1" - -rsource "Kconfig.smartbond" - -rsource "Kconfig.nxp_s32" - -rsource "Kconfig.cdns" - -rsource "Kconfig.opentitan" - -rsource "Kconfig.altera" - -rsource "Kconfig.hostlink" - -rsource "Kconfig.emul" - -rsource "Kconfig.native_tty" - -rsource "Kconfig.numaker" - -rsource "Kconfig.efinix_sapphire" - -rsource "Kconfig.sedi" - -rsource "Kconfig.max32" - -rsource "Kconfig.bcm2711" - -rsource "Kconfig.intel_lw" - rsource "Kconfig.renesas_ra" - -rsource "Kconfig.ene" - -rsource "Kconfig.rzt2m" - rsource "Kconfig.renesas_ra8" - +rsource "Kconfig.rpi_pico" +rsource "Kconfig.rtt" +rsource "Kconfig.rv32m1_lpuart" +rsource "Kconfig.rzt2m" +rsource "Kconfig.sam0" +rsource "Kconfig.sedi" +rsource "Kconfig.sifive" +rsource "Kconfig.smartbond" +rsource "Kconfig.stellaris" +rsource "Kconfig.stm32" rsource "Kconfig.sy1xx" +rsource "Kconfig.test" +rsource "Kconfig.uart_sam" +rsource "Kconfig.usart_sam" +rsource "Kconfig.xec" +rsource "Kconfig.xen" +rsource "Kconfig.xlnx" +rsource "Kconfig.xmc4xxx" +# zephyr-keep-sorted-stop source "drivers/serial/Kconfig.si32" From 9356999229ab9f94aba70b8e84f344d907000b21 Mon Sep 17 00:00:00 2001 From: Bartlomiej Buczek Date: Fri, 27 Sep 2024 10:37:53 +0200 Subject: [PATCH 1332/4482] samples: boards: nordic: system_off: Add GRTC wakeup Extend system_off sample to use GRTC timer as a wake up source. Signed-off-by: Bartlomiej Buczek --- samples/boards/nordic/system_off/Kconfig | 5 +++++ samples/boards/nordic/system_off/sample.yaml | 6 ++++++ samples/boards/nordic/system_off/src/main.c | 15 +++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/samples/boards/nordic/system_off/Kconfig b/samples/boards/nordic/system_off/Kconfig index 5d26d75ecdfb8..910a64f6fbe07 100644 --- a/samples/boards/nordic/system_off/Kconfig +++ b/samples/boards/nordic/system_off/Kconfig @@ -21,4 +21,9 @@ config APP_USE_RETAINED_MEM endchoice +config GRTC_WAKEUP_ENABLE + bool "Use GRTC to wake up device from system off" + help + Switch wake up source from pressing sw0 button to GRTC + source "Kconfig.zephyr" diff --git a/samples/boards/nordic/system_off/sample.yaml b/samples/boards/nordic/system_off/sample.yaml index 0503867b191cb..ab6a12aeb16de 100644 --- a/samples/boards/nordic/system_off/sample.yaml +++ b/samples/boards/nordic/system_off/sample.yaml @@ -29,3 +29,9 @@ tests: extra_configs: - CONFIG_APP_USE_RETAINED_MEM=y - CONFIG_RETAINED_MEM=y + sample.boards.nrf.system_off.grtc_wakeup: + build_only: true + platform_allow: + - nrf54l15dk/nrf54l15/cpuapp + extra_configs: + - CONFIG_GRTC_WAKEUP_ENABLE=y diff --git a/samples/boards/nordic/system_off/src/main.c b/samples/boards/nordic/system_off/src/main.c index 6e1683c4cd67f..c10dda31fc9cd 100644 --- a/samples/boards/nordic/system_off/src/main.c +++ b/samples/boards/nordic/system_off/src/main.c @@ -16,7 +16,12 @@ #include #include +#if defined(CONFIG_GRTC_WAKEUP_ENABLE) +#include +#define DEEP_SLEEP_TIME_S 2 +#else static const struct gpio_dt_spec sw0 = GPIO_DT_SPEC_GET(DT_ALIAS(sw0), gpios); +#endif int main(void) { @@ -45,6 +50,15 @@ int main(void) printf("Retained data not supported\n"); } +#if defined(CONFIG_GRTC_WAKEUP_ENABLE) + int err = z_nrf_grtc_wakeup_prepare(DEEP_SLEEP_TIME_S * USEC_PER_SEC); + + if (err < 0) { + printk("Unable to prepare GRTC as a wake up source (err = %d).\n", err); + } else { + printk("Entering system off; wait %u seconds to restart\n", DEEP_SLEEP_TIME_S); + } +#else /* configure sw0 as input, interrupt as level active to allow wake-up */ rc = gpio_pin_configure_dt(&sw0, GPIO_INPUT); if (rc < 0) { @@ -59,6 +73,7 @@ int main(void) } printf("Entering system off; press sw0 to restart\n"); +#endif rc = pm_device_action_run(cons, PM_DEVICE_ACTION_SUSPEND); if (rc < 0) { From cfe64f7f1c92a2fb28dfad9271c34e0cbab2985c Mon Sep 17 00:00:00 2001 From: Vladislav Pejic Date: Tue, 24 Sep 2024 14:48:40 +0200 Subject: [PATCH 1333/4482] drivers: sensor: adxl372: Updated driver with RTIO stream functionality Updated ADXL372 driver with RTIO stream functionality. RTIO stream is using both FIFO threshold and FIFO full triggers. Together with RTIO stream, RTIO async read is also implemented. Signed-off-by: Vladislav Pejic --- drivers/sensor/adi/adxl372/CMakeLists.txt | 2 + drivers/sensor/adi/adxl372/Kconfig | 10 + drivers/sensor/adi/adxl372/adxl372.c | 94 +++- drivers/sensor/adi/adxl372/adxl372.h | 53 +++ drivers/sensor/adi/adxl372/adxl372_decoder.c | 303 +++++++++++++ drivers/sensor/adi/adxl372/adxl372_rtio.c | 62 +++ drivers/sensor/adi/adxl372/adxl372_stream.c | 445 +++++++++++++++++++ drivers/sensor/adi/adxl372/adxl372_trigger.c | 9 +- 8 files changed, 957 insertions(+), 21 deletions(-) create mode 100644 drivers/sensor/adi/adxl372/adxl372_decoder.c create mode 100644 drivers/sensor/adi/adxl372/adxl372_rtio.c create mode 100644 drivers/sensor/adi/adxl372/adxl372_stream.c diff --git a/drivers/sensor/adi/adxl372/CMakeLists.txt b/drivers/sensor/adi/adxl372/CMakeLists.txt index 9d68febd6f1a7..4a6436602a8a5 100644 --- a/drivers/sensor/adi/adxl372/CMakeLists.txt +++ b/drivers/sensor/adi/adxl372/CMakeLists.txt @@ -9,3 +9,5 @@ zephyr_library_sources(adxl372.c) zephyr_library_sources(adxl372_spi.c) zephyr_library_sources(adxl372_i2c.c) zephyr_library_sources_ifdef(CONFIG_ADXL372_TRIGGER adxl372_trigger.c) +zephyr_library_sources_ifdef(CONFIG_SENSOR_ASYNC_API adxl372_rtio.c adxl372_decoder.c) +zephyr_library_sources_ifdef(CONFIG_ADXL372_STREAM adxl372_stream.c adxl372_decoder.c) diff --git a/drivers/sensor/adi/adxl372/Kconfig b/drivers/sensor/adi/adxl372/Kconfig index 6f6b111d2c451..fe33aaa440d07 100644 --- a/drivers/sensor/adi/adxl372/Kconfig +++ b/drivers/sensor/adi/adxl372/Kconfig @@ -9,6 +9,7 @@ menuconfig ADXL372 depends on DT_HAS_ADI_ADXL372_ENABLED select I2C if $(dt_compat_on_bus,$(DT_COMPAT_ADI_ADXL372),i2c) select SPI if $(dt_compat_on_bus,$(DT_COMPAT_ADI_ADXL372),spi) + select RTIO_WORKQ if SENSOR_ASYNC_API help Enable driver for ADXL372 Three-Axis Digital Accelerometers. @@ -106,6 +107,15 @@ config ADXL372_TRIGGER_OWN_THREAD endchoice +config ADXL372_STREAM + bool "Use FIFO to stream data" + select ADXL372_TRIGGER + default y + depends on SPI_RTIO + depends on SENSOR_ASYNC_API + help + Use this configuration option to enable streaming sensor data via RTIO. + config ADXL372_TRIGGER bool diff --git a/drivers/sensor/adi/adxl372/adxl372.c b/drivers/sensor/adi/adxl372/adxl372.c index 8eef0160839c8..8eb1ea643994c 100644 --- a/drivers/sensor/adi/adxl372/adxl372.c +++ b/drivers/sensor/adi/adxl372/adxl372.c @@ -87,14 +87,22 @@ static int adxl372_set_activity_threshold_xyz(const struct device *dev, * ADXL372_FULL_BW_MEASUREMENT * @return 0 in case of success, negative error code otherwise. */ -static int adxl372_set_op_mode(const struct device *dev, - enum adxl372_op_mode op_mode) +int adxl372_set_op_mode(const struct device *dev, enum adxl372_op_mode op_mode) { struct adxl372_data *data = dev->data; - return data->hw_tf->write_reg_mask(dev, ADXL372_POWER_CTL, + int ret = data->hw_tf->write_reg_mask(dev, ADXL372_POWER_CTL, ADXL372_POWER_CTL_MODE_MSK, ADXL372_POWER_CTL_MODE(op_mode)); + +#ifdef CONFIG_ADXL372_STREAM + if (ret == 0) { + data->pwr_reg &= ~ADXL372_POWER_CTL_MODE_MSK; + data->pwr_reg |= ADXL372_POWER_CTL_MODE(op_mode); + } +#endif /* CONFIG_ADXL372_STREAM */ + + return ret; } /** @@ -145,6 +153,11 @@ static int adxl372_set_bandwidth(const struct device *dev, return ret; } +#ifdef CONFIG_ADXL372_STREAM + data->pwr_reg &= ~ADXL372_POWER_CTL_LPF_DIS_MSK; + data->pwr_reg |= mask; +#endif /* CONFIG_ADXL372_STREAM */ + return data->hw_tf->write_reg_mask(dev, ADXL372_MEASURE, ADXL372_MEASURE_BANDWIDTH_MSK, ADXL372_MEASURE_BANDWIDTH_MODE(bw)); @@ -181,6 +194,11 @@ static int adxl372_set_hpf_corner(const struct device *dev, return ret; } +#ifdef CONFIG_ADXL372_STREAM + data->pwr_reg &= ~ADXL372_POWER_CTL_HPF_DIS_MSK; + data->pwr_reg |= mask; +#endif /* CONFIG_ADXL372_STREAM */ + return data->hw_tf->write_reg(dev, ADXL372_HPF, ADXL372_HPF_CORNER(c)); } @@ -237,9 +255,18 @@ static int adxl372_set_instant_on_th(const struct device *dev, { struct adxl372_data *data = dev->data; - return data->hw_tf->write_reg_mask(dev, ADXL372_POWER_CTL, + int ret = data->hw_tf->write_reg_mask(dev, ADXL372_POWER_CTL, ADXL372_POWER_CTL_INSTANT_ON_TH_MSK, ADXL372_POWER_CTL_INSTANT_ON_TH_MODE(mode)); + +#ifdef CONFIG_ADXL372_STREAM + if (ret == 0) { + data->pwr_reg &= ~ADXL372_POWER_CTL_INSTANT_ON_TH_MSK; + data->pwr_reg |= ADXL372_POWER_CTL_INSTANT_ON_TH_MODE(mode); + } +#endif /* CONFIG_ADXL372_STREAM */ + + return ret; } /** @@ -313,9 +340,18 @@ static int adxl372_set_filter_settle(const struct device *dev, { struct adxl372_data *data = dev->data; - return data->hw_tf->write_reg_mask(dev, ADXL372_POWER_CTL, + int ret = data->hw_tf->write_reg_mask(dev, ADXL372_POWER_CTL, ADXL372_POWER_CTL_FIL_SETTLE_MSK, ADXL372_POWER_CTL_FIL_SETTLE_MODE(mode)); + +#ifdef CONFIG_ADXL372_STREAM + if (ret == 0) { + data->pwr_reg &= ~ADXL372_POWER_CTL_FIL_SETTLE_MSK; + data->pwr_reg |= ADXL372_POWER_CTL_FIL_SETTLE_MODE(mode); + } +#endif /* CONFIG_ADXL372_STREAM */ + + return ret; } /** @@ -432,13 +468,10 @@ static int adxl372_reset(const struct device *dev) * @param fifo_samples - FIFO Samples. Watermark number of FIFO samples that * triggers a FIFO_FULL condition when reached. * Values range from 0 to 512. - * @return 0 in case of success, negative error code otherwise. */ -static int adxl372_configure_fifo(const struct device *dev, - enum adxl372_fifo_mode mode, - enum adxl372_fifo_format format, - uint16_t fifo_samples) +int adxl372_configure_fifo(const struct device *dev, enum adxl372_fifo_mode mode, + enum adxl372_fifo_format format, uint16_t fifo_samples) { struct adxl372_data *data = dev->data; uint8_t fifo_config; @@ -485,8 +518,8 @@ static int adxl372_configure_fifo(const struct device *dev, * where (x, y, z) acceleration data will be stored. * @return 0 in case of success, negative error code otherwise. */ -static int adxl372_get_accel_data(const struct device *dev, bool maxpeak, - struct adxl372_xyz_accel_data *accel_data) +int adxl372_get_accel_data(const struct device *dev, bool maxpeak, + struct adxl372_xyz_accel_data *accel_data) { struct adxl372_data *data = dev->data; uint8_t buf[6]; @@ -501,7 +534,9 @@ static int adxl372_get_accel_data(const struct device *dev, bool maxpeak, ret = data->hw_tf->read_reg_multiple(dev, maxpeak ? ADXL372_X_MAXPEAK_H : ADXL372_X_DATA_H, buf, 6); - +#ifdef CONFIG_ADXL372_STREAM + accel_data->is_fifo = 0; +#endif /* CONFIG_ADXL372_STREAM */ accel_data->x = (buf[0] << 8) | (buf[1] & 0xF0); accel_data->y = (buf[2] << 8) | (buf[3] & 0xF0); accel_data->z = (buf[4] << 8) | (buf[5] & 0xF0); @@ -515,6 +550,7 @@ static int adxl372_attr_set_odr(const struct device *dev, const struct sensor_value *val) { enum adxl372_odr odr; + struct adxl372_dev_config *cfg = (struct adxl372_dev_config *)dev->config; switch (val->val1) { case 400: @@ -536,7 +572,13 @@ static int adxl372_attr_set_odr(const struct device *dev, return -EINVAL; } - return adxl372_set_odr(dev, odr); + int ret = adxl372_set_odr(dev, odr); + + if (ret == 0) { + cfg->odr = odr; + } + + return ret; } static int adxl372_attr_set_thresh(const struct device *dev, @@ -610,7 +652,7 @@ static int adxl372_sample_fetch(const struct device *dev, &data->sample); } -static void adxl372_accel_convert(struct sensor_value *val, int16_t value) +void adxl372_accel_convert(struct sensor_value *val, int16_t value) { /* * Sensor resolution is 100mg/LSB, 12-bit value needs to be right @@ -651,12 +693,16 @@ static int adxl372_channel_get(const struct device *dev, } static const struct sensor_driver_api adxl372_api_funcs = { - .attr_set = adxl372_attr_set, + .attr_set = adxl372_attr_set, .sample_fetch = adxl372_sample_fetch, - .channel_get = adxl372_channel_get, + .channel_get = adxl372_channel_get, #ifdef CONFIG_ADXL372_TRIGGER .trigger_set = adxl372_trigger_set, #endif +#ifdef CONFIG_SENSOR_ASYNC_API + .submit = adxl372_submit, + .get_decoder = adxl372_get_decoder, +#endif /* CONFIG_SENSOR_ASYNC_API */ }; @@ -822,6 +868,11 @@ static int adxl372_init(const struct device *dev) /* * Instantiation macros used when a device is on a SPI bus. */ +#define ADXL372_SPI_CFG SPI_WORD_SET(8) | SPI_TRANSFER_MSB + +#define ADXL372_RTIO_DEFINE(inst) \ + SPI_DT_IODEV_DEFINE(adxl372_iodev_##inst, DT_DRV_INST(inst), ADXL372_SPI_CFG, 0U); \ + RTIO_DEFINE(adxl372_rtio_ctx_##inst, 16, 16); #ifdef CONFIG_ADXL372_TRIGGER #define ADXL372_CFG_IRQ(inst) \ @@ -857,15 +908,18 @@ static int adxl372_init(const struct device *dev) #define ADXL372_CONFIG_SPI(inst) \ { \ .bus_init = adxl372_spi_init, \ - .spi = SPI_DT_SPEC_INST_GET(inst, SPI_WORD_SET(8) | \ - SPI_TRANSFER_MSB, 0), \ + .spi = SPI_DT_SPEC_INST_GET(inst, ADXL372_SPI_CFG, 0), \ ADXL372_CONFIG(inst) \ COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, int1_gpios), \ (ADXL372_CFG_IRQ(inst)), ()) \ } #define ADXL372_DEFINE_SPI(inst) \ - static struct adxl372_data adxl372_data_##inst; \ + IF_ENABLED(CONFIG_ADXL372_STREAM, (ADXL372_RTIO_DEFINE(inst))); \ + static struct adxl372_data adxl372_data_##inst = { \ + IF_ENABLED(CONFIG_ADXL372_STREAM, (.rtio_ctx = &adxl372_rtio_ctx_##inst, \ + .iodev = &adxl372_iodev_##inst,)) \ + }; \ static const struct adxl372_dev_config adxl372_config_##inst = \ ADXL372_CONFIG_SPI(inst); \ ADXL372_DEVICE_INIT(inst) diff --git a/drivers/sensor/adi/adxl372/adxl372.h b/drivers/sensor/adi/adxl372/adxl372.h index 13b4d93454b05..a3f93cebb3268 100644 --- a/drivers/sensor/adi/adxl372/adxl372.h +++ b/drivers/sensor/adi/adxl372/adxl372.h @@ -14,6 +14,12 @@ #include #include +#ifdef CONFIG_ADXL372_STREAM +#include +#endif /* CONFIG_ADXL372_STREAM */ + +#define DT_DRV_COMPAT adi_adxl372 + #if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) #include #endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */ @@ -281,6 +287,10 @@ struct adxl372_activity_threshold { }; struct adxl372_xyz_accel_data { +#ifdef CONFIG_ADXL372_STREAM + uint8_t is_fifo: 1; + uint8_t res: 7; +#endif /* CONFIG_ADXL372_STREAM */ int16_t x; int16_t y; int16_t z; @@ -319,6 +329,16 @@ struct adxl372_data { struct k_work work; #endif #endif /* CONFIG_ADXL372_TRIGGER */ +#ifdef CONFIG_ADXL372_STREAM + struct rtio_iodev_sqe *sqe; + struct rtio *rtio_ctx; + struct rtio_iodev *iodev; + uint8_t status1; + uint8_t fifo_ent[2]; + uint64_t timestamp; + uint8_t fifo_full_irq; + uint8_t pwr_reg; +#endif /* CONFIG_ADXL372_STREAM */ }; struct adxl372_dev_config { @@ -358,9 +378,27 @@ struct adxl372_dev_config { uint8_t int2_config; }; +struct adxl372_fifo_data { + uint8_t is_fifo: 1; + uint8_t sample_set_size: 4; + uint8_t has_x: 1; + uint8_t has_y: 1; + uint8_t has_z: 1; + uint8_t int_status; + uint16_t accel_odr: 4; + uint16_t fifo_byte_count: 12; + uint64_t timestamp; +} __attribute__((__packed__)); + +BUILD_ASSERT(sizeof(struct adxl372_fifo_data) % 4 == 0, + "adxl372_fifo_data struct should be word aligned"); + int adxl372_spi_init(const struct device *dev); int adxl372_i2c_init(const struct device *dev); +void adxl372_submit_stream(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe); +void adxl372_stream_irq_handler(const struct device *dev); + #ifdef CONFIG_ADXL372_TRIGGER int adxl372_get_status(const struct device *dev, uint8_t *status1, uint8_t *status2, uint16_t *fifo_entries); @@ -372,4 +410,19 @@ int adxl372_trigger_set(const struct device *dev, int adxl372_init_interrupt(const struct device *dev); #endif /* CONFIG_ADXL372_TRIGGER */ +#ifdef CONFIG_SENSOR_ASYNC_API +int adxl372_get_accel_data(const struct device *dev, bool maxpeak, + struct adxl372_xyz_accel_data *accel_data); +void adxl372_submit(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe); +int adxl372_get_decoder(const struct device *dev, const struct sensor_decoder_api **decoder); +void adxl372_accel_convert(struct sensor_value *val, int16_t sample); +#endif /* CONFIG_SENSOR_ASYNC_API */ + +#ifdef CONFIG_ADXL372_STREAM +int adxl372_configure_fifo(const struct device *dev, enum adxl372_fifo_mode mode, + enum adxl372_fifo_format format, uint16_t fifo_samples); +size_t adxl372_get_packet_size(const struct adxl372_dev_config *cfg); +int adxl372_set_op_mode(const struct device *dev, enum adxl372_op_mode op_mode); +#endif /* CONFIG_ADXL372_STREAM */ + #endif /* ZEPHYR_DRIVERS_SENSOR_ADXL372_ADXL372_H_ */ diff --git a/drivers/sensor/adi/adxl372/adxl372_decoder.c b/drivers/sensor/adi/adxl372/adxl372_decoder.c new file mode 100644 index 0000000000000..db3dc866c0c80 --- /dev/null +++ b/drivers/sensor/adi/adxl372/adxl372_decoder.c @@ -0,0 +1,303 @@ +/* + * Copyright (c) 2024 Analog Devices Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "adxl372.h" + +#ifdef CONFIG_ADXL372_STREAM + +/* + * Sensor resolution is 100mg/LSB, 12-bit value needs to be right + * shifted by 4 or divided by 16. Overall this results in a scale of 160 + */ +#define SENSOR_SCALING_FACTOR (SENSOR_G / (16 * 1000 / 100)) +#define ADXL372_COMPLEMENT 0xf000 + +static const uint32_t accel_period_ns[] = { + [ADXL372_ODR_400HZ] = UINT32_C(1000000000) / 400, + [ADXL372_ODR_800HZ] = UINT32_C(1000000000) / 800, + [ADXL372_ODR_1600HZ] = UINT32_C(1000000000) / 1600, + [ADXL372_ODR_3200HZ] = UINT32_C(1000000000) / 3200, + [ADXL372_ODR_6400HZ] = UINT32_C(1000000000) / 6400, +}; + +static inline void adxl372_accel_convert_q31(q31_t *out, const uint8_t *buff) +{ + int16_t data_in = ((int16_t)*buff << 4) | (((int16_t)*(buff + 1) & 0xF0) >> 4); + + if (data_in & BIT(11)) { + data_in |= ADXL372_COMPLEMENT; + } + + int64_t micro_ms2 = data_in * SENSOR_SCALING_FACTOR; + + *out = CLAMP((micro_ms2 + (micro_ms2 % 1000000)), INT32_MIN, INT32_MAX); +} + +static int adxl372_decode_stream(const uint8_t *buffer, struct sensor_chan_spec chan_spec, + uint32_t *fit, uint16_t max_count, void *data_out) +{ + const struct adxl372_fifo_data *enc_data = (const struct adxl372_fifo_data *)buffer; + const uint8_t *buffer_end = + buffer + sizeof(struct adxl372_fifo_data) + enc_data->fifo_byte_count; + int count = 0; + uint8_t sample_num = 0; + + if ((uintptr_t)buffer_end <= *fit || chan_spec.chan_idx != 0) { + return 0; + } + + struct sensor_three_axis_data *data = (struct sensor_three_axis_data *)data_out; + + memset(data, 0, sizeof(struct sensor_three_axis_data)); + data->header.base_timestamp_ns = enc_data->timestamp; + data->header.reading_count = 1; + + buffer += sizeof(struct adxl372_fifo_data); + + uint8_t sample_set_size = enc_data->sample_set_size; + uint64_t period_ns = accel_period_ns[enc_data->accel_odr]; + + /* Calculate which sample is decoded. */ + if ((uint8_t *)*fit >= buffer) { + sample_num = ((uint8_t *)*fit - buffer) / sample_set_size; + } + + while (count < max_count && buffer < buffer_end) { + const uint8_t *sample_end = buffer; + + sample_end += sample_set_size; + + if ((uintptr_t)buffer < *fit) { + /* This frame was already decoded, move on to the next frame */ + buffer = sample_end; + continue; + } + + switch (chan_spec.chan_type) { + case SENSOR_CHAN_ACCEL_X: + if (enc_data->has_x) { + data->readings[count].timestamp_delta = sample_num * period_ns; + adxl372_accel_convert_q31(&data->readings[count].x, buffer); + } + break; + case SENSOR_CHAN_ACCEL_Y: + if (enc_data->has_y) { + uint8_t buff_offset = 0; + + /* If packet has X channel, then Y channel has offset. */ + if (enc_data->has_x) { + buff_offset = 2; + } + data->readings[count].timestamp_delta = sample_num * period_ns; + adxl372_accel_convert_q31(&data->readings[count].y, + (buffer + buff_offset)); + } + break; + case SENSOR_CHAN_ACCEL_Z: + if (enc_data->has_z) { + uint8_t buff_offset = 0; + + /* If packet has X channel and/or Y channel, + * then Z channel has offset. + */ + if (enc_data->has_x) { + buff_offset = 2; + } + + if (enc_data->has_y) { + buff_offset += 2; + } + data->readings[count].timestamp_delta = sample_num * period_ns; + adxl372_accel_convert_q31(&data->readings[count].z, + (buffer + buff_offset)); + } + break; + case SENSOR_CHAN_ACCEL_XYZ: + data->readings[count].timestamp_delta = sample_num * period_ns; + uint8_t buff_offset = 0; + + if (enc_data->has_x) { + adxl372_accel_convert_q31(&data->readings[count].x, buffer); + buff_offset = 2; + } + + if (enc_data->has_y) { + adxl372_accel_convert_q31(&data->readings[count].y, + (buffer + buff_offset)); + + buff_offset += 2; + } + + if (enc_data->has_z) { + adxl372_accel_convert_q31(&data->readings[count].z, + (buffer + buff_offset)); + } + break; + default: + return -ENOTSUP; + } + + buffer = sample_end; + *fit = (uintptr_t)sample_end; + count++; + } + return count; +} + +#endif /* CONFIG_ADXL372_STREAM */ + +static int adxl372_decoder_get_frame_count(const uint8_t *buffer, struct sensor_chan_spec chan_spec, + uint16_t *frame_count) +{ + int32_t ret = -ENOTSUP; + + if (chan_spec.chan_idx != 0) { + return ret; + } + +#ifdef CONFIG_ADXL372_STREAM + const struct adxl372_fifo_data *data = (const struct adxl372_fifo_data *)buffer; + + if (!data->is_fifo) { +#endif /* CONFIG_ADXL372_STREAM */ + switch (chan_spec.chan_type) { + case SENSOR_CHAN_ACCEL_X: + case SENSOR_CHAN_ACCEL_Y: + case SENSOR_CHAN_ACCEL_Z: + case SENSOR_CHAN_ACCEL_XYZ: + *frame_count = 1; + ret = 0; + break; + + default: + break; + } +#ifdef CONFIG_ADXL372_STREAM + } else { + if (data->fifo_byte_count == 0) { + *frame_count = 0; + ret = 0; + } else { + switch (chan_spec.chan_type) { + case SENSOR_CHAN_ACCEL_X: + if (data->has_x) { + *frame_count = + data->fifo_byte_count / data->sample_set_size; + ret = 0; + } + break; + case SENSOR_CHAN_ACCEL_Y: + if (data->has_y) { + *frame_count = + data->fifo_byte_count / data->sample_set_size; + ret = 0; + } + break; + case SENSOR_CHAN_ACCEL_Z: + if (data->has_z) { + *frame_count = + data->fifo_byte_count / data->sample_set_size; + ret = 0; + } + break; + case SENSOR_CHAN_ACCEL_XYZ: + if (data->has_x || data->has_y || data->has_z) { + *frame_count = + data->fifo_byte_count / data->sample_set_size; + ret = 0; + } + break; + + default: + break; + } + } + } +#endif /* CONFIG_ADXL372_STREAM */ + + return ret; +} + +static int adxl372_decode_sample(const struct adxl372_xyz_accel_data *data, + struct sensor_chan_spec chan_spec, uint32_t *fit, + uint16_t max_count, void *data_out) +{ + struct sensor_value *out = (struct sensor_value *)data_out; + + if (*fit > 0) { + return -ENOTSUP; + } + + switch (chan_spec.chan_type) { + case SENSOR_CHAN_ACCEL_X: + adxl372_accel_convert(out, data->x); + break; + case SENSOR_CHAN_ACCEL_Y: + adxl372_accel_convert(out, data->y); + break; + case SENSOR_CHAN_ACCEL_Z: + adxl372_accel_convert(out, data->z); + break; + case SENSOR_CHAN_ACCEL_XYZ: + adxl372_accel_convert(out++, data->x); + adxl372_accel_convert(out++, data->y); + adxl372_accel_convert(out, data->z); + break; + default: + return -ENOTSUP; + } + + *fit = 1; + + return 0; +} + +static int adxl372_decoder_decode(const uint8_t *buffer, struct sensor_chan_spec chan_spec, + uint32_t *fit, uint16_t max_count, void *data_out) +{ + const struct adxl372_xyz_accel_data *data = (const struct adxl372_xyz_accel_data *)buffer; + +#ifdef CONFIG_ADXL372_STREAM + if (data->is_fifo) { + return adxl372_decode_stream(buffer, chan_spec, fit, max_count, data_out); + } +#endif /* CONFIG_ADXL372_STREAM */ + + return adxl372_decode_sample(data, chan_spec, fit, max_count, data_out); +} + +static bool adxl372_decoder_has_trigger(const uint8_t *buffer, enum sensor_trigger_type trigger) +{ + const struct adxl372_fifo_data *data = (const struct adxl372_fifo_data *)buffer; + + if (!data->is_fifo) { + return false; + } + + switch (trigger) { + case SENSOR_TRIG_DATA_READY: + return FIELD_GET(ADXL372_INT1_MAP_DATA_RDY_MSK, data->int_status); + case SENSOR_TRIG_FIFO_WATERMARK: + case SENSOR_TRIG_FIFO_FULL: + return FIELD_GET(ADXL372_INT1_MAP_FIFO_FULL_MSK, data->int_status); + default: + return false; + } +} + +SENSOR_DECODER_API_DT_DEFINE() = { + .get_frame_count = adxl372_decoder_get_frame_count, + .decode = adxl372_decoder_decode, + .has_trigger = adxl372_decoder_has_trigger, +}; + +int adxl372_get_decoder(const struct device *dev, const struct sensor_decoder_api **decoder) +{ + ARG_UNUSED(dev); + *decoder = &SENSOR_DECODER_NAME(); + + return 0; +} diff --git a/drivers/sensor/adi/adxl372/adxl372_rtio.c b/drivers/sensor/adi/adxl372/adxl372_rtio.c new file mode 100644 index 0000000000000..699ec34277721 --- /dev/null +++ b/drivers/sensor/adi/adxl372/adxl372_rtio.c @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2024 Analog Devices Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#include "adxl372.h" + +LOG_MODULE_DECLARE(ADXL372, CONFIG_SENSOR_LOG_LEVEL); + +static void adxl372_submit_fetch(struct rtio_iodev_sqe *iodev_sqe) +{ + const struct sensor_read_config *cfg = + (const struct sensor_read_config *)iodev_sqe->sqe.iodev->data; + const struct device *dev = cfg->sensor; + int rc; + uint32_t min_buffer_len = sizeof(struct adxl372_xyz_accel_data); + uint8_t *buffer; + uint32_t buffer_len; + + const struct adxl372_dev_config *cfg_372 = (const struct adxl372_dev_config *)dev->config; + + rc = rtio_sqe_rx_buf(iodev_sqe, min_buffer_len, min_buffer_len, &buffer, &buffer_len); + if (rc != 0) { + LOG_ERR("Failed to get a read buffer of size %u bytes", min_buffer_len); + rtio_iodev_sqe_err(iodev_sqe, rc); + return; + } + + struct adxl372_xyz_accel_data *data = (struct adxl372_xyz_accel_data *)buffer; + + rc = adxl372_get_accel_data(dev, cfg_372->max_peak_detect_mode, data); + if (rc != 0) { + LOG_ERR("Failed to fetch samples"); + rtio_iodev_sqe_err(iodev_sqe, rc); + return; + } + + rtio_iodev_sqe_ok(iodev_sqe, 0); +} + +void adxl372_submit(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe) +{ + const struct sensor_read_config *cfg = + (const struct sensor_read_config *)iodev_sqe->sqe.iodev->data; + + if (!cfg->is_streaming) { + struct rtio_work_req *req = rtio_work_req_alloc(); + + __ASSERT_NO_MSG(req); + + rtio_work_req_submit(req, iodev_sqe, adxl372_submit_fetch); + } else if (IS_ENABLED(CONFIG_ADXL372_STREAM)) { + adxl372_submit_stream(dev, iodev_sqe); + } else { + rtio_iodev_sqe_err(iodev_sqe, -ENOTSUP); + } +} diff --git a/drivers/sensor/adi/adxl372/adxl372_stream.c b/drivers/sensor/adi/adxl372/adxl372_stream.c new file mode 100644 index 0000000000000..a4dda2f2ce80b --- /dev/null +++ b/drivers/sensor/adi/adxl372/adxl372_stream.c @@ -0,0 +1,445 @@ +/* + * Copyright (c) 2024 Analog Devices Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include "adxl372.h" + +LOG_MODULE_DECLARE(ADXL372, CONFIG_SENSOR_LOG_LEVEL); + +static void adxl372_irq_en_cb(struct rtio *r, const struct rtio_sqe *sqr, void *arg) +{ + const struct device *dev = (const struct device *)arg; + const struct adxl372_dev_config *cfg = dev->config; + + gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_EDGE_TO_ACTIVE); +} + +static void adxl372_fifo_flush_rtio(const struct device *dev) +{ + struct adxl372_data *data = dev->data; + uint8_t pow_reg = data->pwr_reg; + const struct adxl372_dev_config *cfg = dev->config; + uint8_t fifo_config; + + pow_reg &= ~ADXL372_POWER_CTL_MODE_MSK; + pow_reg |= ADXL372_POWER_CTL_MODE(ADXL372_STANDBY); + + struct rtio_sqe *sqe = rtio_sqe_acquire(data->rtio_ctx); + const uint8_t reg_addr_w[2] = {ADXL372_REG_WRITE(ADXL372_POWER_CTL), pow_reg}; + + rtio_sqe_prep_tiny_write(sqe, data->iodev, RTIO_PRIO_NORM, reg_addr_w, 2, NULL); + + fifo_config = (ADXL372_FIFO_CTL_FORMAT_MODE(data->fifo_config.fifo_format) | + ADXL372_FIFO_CTL_MODE_MODE(ADXL372_FIFO_BYPASSED) | + ADXL372_FIFO_CTL_SAMPLES_MODE(data->fifo_config.fifo_samples)); + + sqe = rtio_sqe_acquire(data->rtio_ctx); + const uint8_t reg_addr_w2[2] = {ADXL372_REG_WRITE(ADXL372_FIFO_CTL), fifo_config}; + + rtio_sqe_prep_tiny_write(sqe, data->iodev, RTIO_PRIO_NORM, reg_addr_w2, 2, NULL); + + fifo_config = (ADXL372_FIFO_CTL_FORMAT_MODE(data->fifo_config.fifo_format) | + ADXL372_FIFO_CTL_MODE_MODE(data->fifo_config.fifo_mode) | + ADXL372_FIFO_CTL_SAMPLES_MODE(data->fifo_config.fifo_samples)); + + sqe = rtio_sqe_acquire(data->rtio_ctx); + const uint8_t reg_addr_w3[2] = {ADXL372_REG_WRITE(ADXL372_FIFO_CTL), fifo_config}; + + rtio_sqe_prep_tiny_write(sqe, data->iodev, RTIO_PRIO_NORM, reg_addr_w3, 2, NULL); + + pow_reg = data->pwr_reg; + + pow_reg &= ~ADXL372_POWER_CTL_MODE_MSK; + pow_reg |= ADXL372_POWER_CTL_MODE(cfg->op_mode); + + sqe = rtio_sqe_acquire(data->rtio_ctx); + struct rtio_sqe *complete_op = rtio_sqe_acquire(data->rtio_ctx); + const uint8_t reg_addr_w4[2] = {ADXL372_REG_WRITE(ADXL372_POWER_CTL), pow_reg}; + + rtio_sqe_prep_tiny_write(sqe, data->iodev, RTIO_PRIO_NORM, reg_addr_w4, 2, NULL); + sqe->flags |= RTIO_SQE_CHAINED; + rtio_sqe_prep_callback(complete_op, adxl372_irq_en_cb, (void *)dev, NULL); + rtio_submit(data->rtio_ctx, 0); +} + +void adxl372_submit_stream(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe) +{ + const struct sensor_read_config *cfg = + (const struct sensor_read_config *)iodev_sqe->sqe.iodev->data; + struct adxl372_data *data = (struct adxl372_data *)dev->data; + const struct adxl372_dev_config *cfg_372 = dev->config; + uint8_t int_value = (uint8_t)~ADXL372_INT1_MAP_FIFO_FULL_MSK; + uint8_t fifo_full_irq = 0; + + int rc = gpio_pin_interrupt_configure_dt(&cfg_372->interrupt, GPIO_INT_DISABLE); + + if (rc < 0) { + return; + } + + for (size_t i = 0; i < cfg->count; i++) { + if ((cfg->triggers[i].trigger == SENSOR_TRIG_FIFO_WATERMARK) || + (cfg->triggers[i].trigger == SENSOR_TRIG_FIFO_FULL)) { + int_value = ADXL372_INT1_MAP_FIFO_FULL_MSK; + fifo_full_irq = 1; + } + } + + if (fifo_full_irq != data->fifo_full_irq) { + data->fifo_full_irq = fifo_full_irq; + + rc = data->hw_tf->write_reg_mask(dev, ADXL372_INT1_MAP, + ADXL372_INT1_MAP_FIFO_FULL_MSK, int_value); + if (rc < 0) { + return; + } + + /* Flush the FIFO by disabling it. Save current mode for after the reset. */ + enum adxl372_fifo_mode current_fifo_mode = data->fifo_config.fifo_mode; + + adxl372_configure_fifo(dev, ADXL372_FIFO_BYPASSED, data->fifo_config.fifo_format, + data->fifo_config.fifo_samples); + + if (current_fifo_mode == ADXL372_FIFO_BYPASSED) { + current_fifo_mode = ADXL372_FIFO_STREAMED; + } + + adxl372_configure_fifo(dev, current_fifo_mode, data->fifo_config.fifo_format, + data->fifo_config.fifo_samples); + + adxl372_set_op_mode(dev, cfg_372->op_mode); + } + + rc = gpio_pin_interrupt_configure_dt(&cfg_372->interrupt, GPIO_INT_EDGE_TO_ACTIVE); + if (rc < 0) { + return; + } + + data->sqe = iodev_sqe; +} + +static void adxl372_fifo_read_cb(struct rtio *rtio_ctx, const struct rtio_sqe *sqe, void *arg) +{ + const struct device *dev = (const struct device *)arg; + const struct adxl372_dev_config *cfg = (const struct adxl372_dev_config *)dev->config; + struct rtio_iodev_sqe *iodev_sqe = sqe->userdata; + + rtio_iodev_sqe_ok(iodev_sqe, 0); + + gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_EDGE_TO_ACTIVE); +} + +size_t adxl372_get_packet_size(const struct adxl372_dev_config *cfg) +{ + /* If one sample contains XYZ values. */ + size_t packet_size; + + switch (cfg->fifo_config.fifo_format) { + case ADXL372_X_FIFO: + case ADXL372_Y_FIFO: + case ADXL372_Z_FIFO: + packet_size = 2; + break; + + case ADXL372_XY_FIFO: + case ADXL372_XZ_FIFO: + case ADXL372_YZ_FIFO: + packet_size = 4; + break; + + default: + packet_size = 6; + break; + } + + return packet_size; +} + +static void adxl372_process_fifo_samples_cb(struct rtio *r, const struct rtio_sqe *sqr, void *arg) +{ + const struct device *dev = (const struct device *)arg; + struct adxl372_data *data = (struct adxl372_data *)dev->data; + const struct adxl372_dev_config *cfg = (const struct adxl372_dev_config *)dev->config; + struct rtio_iodev_sqe *current_sqe = data->sqe; + uint16_t fifo_samples = (((data->fifo_ent[0] & 0x3) << 8) | data->fifo_ent[1]); + size_t sample_set_size = adxl372_get_packet_size(cfg); + + /* At least one sample set must remain in FIFO to encure that data + * is not overwritten and stored out of order. + */ + if (fifo_samples > sample_set_size / 2) { + fifo_samples -= sample_set_size / 2; + } else { + LOG_ERR("fifo sample count error %d\n", fifo_samples); + gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_EDGE_TO_ACTIVE); + return; + } + + uint16_t fifo_bytes = fifo_samples * 2 /*sample size*/; + + data->sqe = NULL; + + /* Not inherently an underrun/overrun as we may have a buffer to fill next time */ + if (current_sqe == NULL) { + LOG_ERR("No pending SQE"); + gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_EDGE_TO_ACTIVE); + return; + } + + const size_t min_read_size = sizeof(struct adxl372_fifo_data) + sample_set_size; + const size_t ideal_read_size = sizeof(struct adxl372_fifo_data) + fifo_bytes; + + uint8_t *buf; + uint32_t buf_len; + + if (rtio_sqe_rx_buf(current_sqe, min_read_size, ideal_read_size, &buf, &buf_len) != 0) { + LOG_ERR("Failed to get buffer"); + rtio_iodev_sqe_err(current_sqe, -ENOMEM); + gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_EDGE_TO_ACTIVE); + return; + } + + LOG_DBG("Requesting buffer [%u, %u] got %u", (unsigned int)min_read_size, + (unsigned int)ideal_read_size, buf_len); + + /* Read FIFO and call back to rtio with rtio_sqe completion */ + struct adxl372_fifo_data *hdr = (struct adxl372_fifo_data *)buf; + + hdr->is_fifo = 1; + hdr->timestamp = data->timestamp; + hdr->int_status = data->status1; + hdr->accel_odr = cfg->odr; + hdr->sample_set_size = sample_set_size; + + if ((cfg->fifo_config.fifo_format == ADXL372_X_FIFO) || + (cfg->fifo_config.fifo_format == ADXL372_XY_FIFO) || + (cfg->fifo_config.fifo_format == ADXL372_XZ_FIFO) || + (cfg->fifo_config.fifo_format == ADXL372_XYZ_FIFO)) { + hdr->has_x = 1; + } + + if ((cfg->fifo_config.fifo_format == ADXL372_Y_FIFO) || + (cfg->fifo_config.fifo_format == ADXL372_XY_FIFO) || + (cfg->fifo_config.fifo_format == ADXL372_YZ_FIFO) || + (cfg->fifo_config.fifo_format == ADXL372_XYZ_FIFO)) { + hdr->has_y = 1; + } + + if ((cfg->fifo_config.fifo_format == ADXL372_Z_FIFO) || + (cfg->fifo_config.fifo_format == ADXL372_XZ_FIFO) || + (cfg->fifo_config.fifo_format == ADXL372_YZ_FIFO) || + (cfg->fifo_config.fifo_format == ADXL372_XYZ_FIFO)) { + hdr->has_z = 1; + } + + uint32_t buf_avail = buf_len; + + buf_avail -= sizeof(*hdr); + + uint32_t read_len = MIN(fifo_bytes, buf_avail); + uint32_t pkts = read_len / sample_set_size; + + read_len = pkts * sample_set_size; + + ((struct adxl372_fifo_data *)buf)->fifo_byte_count = read_len; + + __ASSERT_NO_MSG(read_len % pkt_size == 0); + + uint8_t *read_buf = buf + sizeof(*hdr); + + /* Flush completions */ + struct rtio_cqe *cqe; + int res = 0; + + do { + cqe = rtio_cqe_consume(data->rtio_ctx); + if (cqe != NULL) { + if ((cqe->result < 0 && res == 0)) { + LOG_ERR("Bus error: %d", cqe->result); + res = cqe->result; + } + rtio_cqe_release(data->rtio_ctx, cqe); + } + } while (cqe != NULL); + + /* Bail/cancel attempt to read sensor on any error */ + if (res != 0) { + rtio_iodev_sqe_err(current_sqe, res); + return; + } + + /* Setup new rtio chain to read the fifo data and report then check the + * result + */ + struct rtio_sqe *write_fifo_addr = rtio_sqe_acquire(data->rtio_ctx); + struct rtio_sqe *read_fifo_data = rtio_sqe_acquire(data->rtio_ctx); + struct rtio_sqe *complete_op = rtio_sqe_acquire(data->rtio_ctx); + const uint8_t reg_addr = ADXL372_REG_READ(ADXL372_FIFO_DATA); + + rtio_sqe_prep_tiny_write(write_fifo_addr, data->iodev, RTIO_PRIO_NORM, ®_addr, 1, NULL); + write_fifo_addr->flags = RTIO_SQE_TRANSACTION; + rtio_sqe_prep_read(read_fifo_data, data->iodev, RTIO_PRIO_NORM, read_buf, read_len, + current_sqe); + read_fifo_data->flags = RTIO_SQE_CHAINED; + rtio_sqe_prep_callback(complete_op, adxl372_fifo_read_cb, (void *)dev, current_sqe); + + rtio_submit(data->rtio_ctx, 0); +} + +static void adxl372_process_status1_cb(struct rtio *r, const struct rtio_sqe *sqr, void *arg) +{ + const struct device *dev = (const struct device *)arg; + struct adxl372_data *data = (struct adxl372_data *)dev->data; + const struct adxl372_dev_config *cfg = (const struct adxl372_dev_config *)dev->config; + struct rtio_iodev_sqe *current_sqe = data->sqe; + struct sensor_read_config *read_config; + uint8_t status1 = data->status1; + + if (data->sqe == NULL) { + return; + } + + read_config = (struct sensor_read_config *)data->sqe->sqe.iodev->data; + + if (read_config == NULL) { + return; + } + + if (read_config->is_streaming == false) { + return; + } + + gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_DISABLE); + + struct sensor_stream_trigger *fifo_wmark_cfg = NULL; + struct sensor_stream_trigger *fifo_full_cfg = NULL; + + for (int i = 0; i < read_config->count; ++i) { + if (read_config->triggers[i].trigger == SENSOR_TRIG_FIFO_WATERMARK) { + fifo_wmark_cfg = &read_config->triggers[i]; + continue; + } + + if (read_config->triggers[i].trigger == SENSOR_TRIG_FIFO_FULL) { + fifo_full_cfg = &read_config->triggers[i]; + continue; + } + } + + bool fifo_full_irq = false; + + if ((fifo_wmark_cfg != NULL) && (fifo_full_cfg != NULL) && + FIELD_GET(ADXL372_INT1_MAP_FIFO_FULL_MSK, status1)) { + fifo_full_irq = true; + } + + if (!fifo_full_irq) { + gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_EDGE_TO_ACTIVE); + return; + } + + struct rtio_cqe *cqe; + int res = 0; + + do { + cqe = rtio_cqe_consume(data->rtio_ctx); + if (cqe != NULL) { + if ((cqe->result < 0) && (res == 0)) { + LOG_ERR("Bus error: %d", cqe->result); + res = cqe->result; + } + rtio_cqe_release(data->rtio_ctx, cqe); + } + } while (cqe != NULL); + + /* Bail/cancel attempt to read sensor on any error */ + if (res != 0) { + rtio_iodev_sqe_err(current_sqe, res); + return; + } + + enum sensor_stream_data_opt data_opt; + + if ((fifo_wmark_cfg != NULL) && (fifo_full_cfg == NULL)) { + data_opt = fifo_wmark_cfg->opt; + } else if ((fifo_wmark_cfg == NULL) && (fifo_full_cfg != NULL)) { + data_opt = fifo_full_cfg->opt; + } else { + data_opt = MIN(fifo_wmark_cfg->opt, fifo_full_cfg->opt); + } + + if (data_opt == SENSOR_STREAM_DATA_NOP || data_opt == SENSOR_STREAM_DATA_DROP) { + uint8_t *buf; + uint32_t buf_len; + + /* Clear streaming_sqe since we're done with the call */ + data->sqe = NULL; + if (rtio_sqe_rx_buf(current_sqe, sizeof(struct adxl372_fifo_data), + sizeof(struct adxl372_fifo_data), &buf, &buf_len) != 0) { + rtio_iodev_sqe_err(current_sqe, -ENOMEM); + gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_EDGE_TO_ACTIVE); + return; + } + + struct adxl372_fifo_data *rx_data = (struct adxl372_fifo_data *)buf; + + memset(buf, 0, buf_len); + rx_data->is_fifo = 1; + rx_data->timestamp = data->timestamp; + rx_data->int_status = status1; + rx_data->fifo_byte_count = 0; + rtio_iodev_sqe_ok(current_sqe, 0); + + if (data_opt == SENSOR_STREAM_DATA_DROP) { + /* Flush the FIFO by disabling it. Save current mode for after the reset. */ + adxl372_fifo_flush_rtio(dev); + return; + } + + gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_EDGE_TO_ACTIVE); + return; + } + + struct rtio_sqe *write_fifo_addr = rtio_sqe_acquire(data->rtio_ctx); + struct rtio_sqe *read_fifo_data = rtio_sqe_acquire(data->rtio_ctx); + struct rtio_sqe *complete_op = rtio_sqe_acquire(data->rtio_ctx); + const uint8_t reg_addr = ADXL372_REG_READ(ADXL372_FIFO_ENTRIES_2); + + rtio_sqe_prep_tiny_write(write_fifo_addr, data->iodev, RTIO_PRIO_NORM, ®_addr, 1, NULL); + write_fifo_addr->flags = RTIO_SQE_TRANSACTION; + rtio_sqe_prep_read(read_fifo_data, data->iodev, RTIO_PRIO_NORM, data->fifo_ent, 2, + current_sqe); + read_fifo_data->flags = RTIO_SQE_CHAINED; + rtio_sqe_prep_callback(complete_op, adxl372_process_fifo_samples_cb, (void *)dev, + current_sqe); + + rtio_submit(data->rtio_ctx, 0); +} + +void adxl372_stream_irq_handler(const struct device *dev) +{ + struct adxl372_data *data = (struct adxl372_data *)dev->data; + + if (data->sqe == NULL) { + return; + } + + data->timestamp = k_ticks_to_ns_floor64(k_uptime_ticks()); + + struct rtio_sqe *write_status_addr = rtio_sqe_acquire(data->rtio_ctx); + struct rtio_sqe *read_status_reg = rtio_sqe_acquire(data->rtio_ctx); + struct rtio_sqe *check_status_reg = rtio_sqe_acquire(data->rtio_ctx); + uint8_t reg = ADXL372_REG_READ(ADXL372_STATUS_1); + + rtio_sqe_prep_tiny_write(write_status_addr, data->iodev, RTIO_PRIO_NORM, ®, 1, NULL); + write_status_addr->flags = RTIO_SQE_TRANSACTION; + rtio_sqe_prep_read(read_status_reg, data->iodev, RTIO_PRIO_NORM, &data->status1, 1, NULL); + read_status_reg->flags = RTIO_SQE_CHAINED; + rtio_sqe_prep_callback(check_status_reg, adxl372_process_status1_cb, (void *)dev, NULL); + rtio_submit(data->rtio_ctx, 0); +} diff --git a/drivers/sensor/adi/adxl372/adxl372_trigger.c b/drivers/sensor/adi/adxl372/adxl372_trigger.c index 2d9cca6cfd869..b5a8e9272fb29 100644 --- a/drivers/sensor/adi/adxl372/adxl372_trigger.c +++ b/drivers/sensor/adi/adxl372/adxl372_trigger.c @@ -16,6 +16,7 @@ #include LOG_MODULE_DECLARE(ADXL372, CONFIG_SENSOR_LOG_LEVEL); +#if defined(CONFIG_ADXL372_TRIGGER_OWN_THREAD) || defined(CONFIG_ADXL372_TRIGGER_GLOBAL_THREAD) static void adxl372_thread_cb(const struct device *dev) { const struct adxl372_dev_config *cfg = dev->config; @@ -49,8 +50,10 @@ static void adxl372_thread_cb(const struct device *dev) ret = gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_EDGE_TO_ACTIVE); + __ASSERT(ret == 0, "Interrupt configuration failed"); } +#endif /* CONFIG_ADXL372_TRIGGER_OWN_THREAD || CONFIG_ADXL372_TRIGGER_GLOBAL_THREAD */ static void adxl372_gpio_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins) @@ -61,6 +64,10 @@ static void adxl372_gpio_callback(const struct device *dev, gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_DISABLE); + if (IS_ENABLED(CONFIG_ADXL372_STREAM)) { + adxl372_stream_irq_handler(drv_data->dev); + } + #if defined(CONFIG_ADXL372_TRIGGER_OWN_THREAD) k_sem_give(&drv_data->gpio_sem); #elif defined(CONFIG_ADXL372_TRIGGER_GLOBAL_THREAD) @@ -160,7 +167,7 @@ int adxl372_init_interrupt(const struct device *dev) return -EINVAL; } - ret = gpio_pin_configure_dt(&cfg->interrupt, GPIO_INPUT); + ret = gpio_pin_configure_dt(&cfg->interrupt, GPIO_INPUT | GPIO_PUSH_PULL); if (ret < 0) { return ret; } From 1fdf6e64fb358768625bf56d7cfabf364856d93e Mon Sep 17 00:00:00 2001 From: Luis Ubieda Date: Sat, 17 Aug 2024 12:58:41 -0400 Subject: [PATCH 1334/4482] spi: sam: Refactor driver to use SPI RTIO common APIs - Following similar approach followed on spi_mcux_lpspi driver. - Enabling DMA by default when SPI RTIO is selected to favor non-blocking transfers. Signed-off-by: Luis Ubieda --- drivers/spi/Kconfig.sam | 1 + drivers/spi/spi_sam.c | 147 +++++++++++++++------------------------- 2 files changed, 56 insertions(+), 92 deletions(-) diff --git a/drivers/spi/Kconfig.sam b/drivers/spi/Kconfig.sam index 1a7e0b5916bed..78ff7c54265eb 100644 --- a/drivers/spi/Kconfig.sam +++ b/drivers/spi/Kconfig.sam @@ -15,6 +15,7 @@ config SPI_SAM if SPI_SAM config SPI_SAM_DMA bool "SPI SAM DMA Support" + default y if SPI_RTIO select DMA help Enable using DMA with SPI for SPI instances that enable dma channels in diff --git a/drivers/spi/spi_sam.c b/drivers/spi/spi_sam.c index e8fd42375ab08..94120906de5b6 100644 --- a/drivers/spi/spi_sam.c +++ b/drivers/spi/spi_sam.c @@ -53,12 +53,7 @@ struct spi_sam_data { struct k_spinlock lock; #ifdef CONFIG_SPI_RTIO - struct rtio *r; /* context for thread calls */ - struct mpsc io_q; - struct rtio_iodev iodev; - struct rtio_iodev_sqe *txn_head; - struct rtio_iodev_sqe *txn_curr; - struct spi_dt_spec dt_spec; + struct spi_rtio *rtio_ctx; #endif #ifdef CONFIG_SPI_SAM_DMA @@ -305,7 +300,9 @@ static void dma_callback(const struct device *dma_dev, void *user_data, struct spi_sam_data *drv_data = dev->data; #ifdef CONFIG_SPI_RTIO - if (drv_data->txn_head != NULL) { + struct spi_rtio *rtio_ctx = drv_data->rtio_ctx; + + if (rtio_ctx->txn_head != NULL) { spi_sam_iodev_complete(dev, status); return; } @@ -324,7 +321,8 @@ static int spi_sam_dma_txrx(const struct device *dev, const struct spi_sam_config *drv_cfg = dev->config; struct spi_sam_data *drv_data = dev->data; #ifdef CONFIG_SPI_RTIO - bool blocking = drv_data->txn_head == NULL; + struct spi_rtio *rtio_ctx = drv_data->rtio_ctx; + bool blocking = rtio_ctx->txn_head == NULL; #else bool blocking = true; #endif @@ -447,10 +445,12 @@ static inline int spi_sam_rx(const struct device *dev, #ifdef CONFIG_SPI_SAM_DMA const struct spi_sam_config *cfg = dev->config; - if (rx_buf_len < SAM_SPI_DMA_THRESHOLD || cfg->dma_dev == NULL) { + if ((rx_buf_len < SAM_SPI_DMA_THRESHOLD || cfg->dma_dev == NULL) && + !IS_ENABLED(CONFIG_SPI_RTIO)) { key = spi_spin_lock(dev); spi_sam_fast_rx(regs, rx_buf, rx_buf_len); } else { + /* RTIO Transfers should always fall here */ return spi_sam_dma_txrx(dev, regs, NULL, rx_buf, rx_buf_len); } #else @@ -473,10 +473,12 @@ static inline int spi_sam_tx(const struct device *dev, #ifdef CONFIG_SPI_SAM_DMA const struct spi_sam_config *cfg = dev->config; - if (tx_buf_len < SAM_SPI_DMA_THRESHOLD || cfg->dma_dev == NULL) { + if ((tx_buf_len < SAM_SPI_DMA_THRESHOLD || cfg->dma_dev == NULL) && + !IS_ENABLED(CONFIG_SPI_RTIO)) { key = spi_spin_lock(dev); spi_sam_fast_tx(regs, tx_buf, tx_buf_len); } else { + /* RTIO Transfers should always fall here */ return spi_sam_dma_txrx(dev, regs, tx_buf, NULL, tx_buf_len); } #else @@ -500,10 +502,12 @@ static inline int spi_sam_txrx(const struct device *dev, #ifdef CONFIG_SPI_SAM_DMA const struct spi_sam_config *cfg = dev->config; - if (buf_len < SAM_SPI_DMA_THRESHOLD || cfg->dma_dev == NULL) { + if ((buf_len < SAM_SPI_DMA_THRESHOLD || cfg->dma_dev == NULL) && + !IS_ENABLED(CONFIG_SPI_RTIO)) { key = spi_spin_lock(dev); spi_sam_fast_txrx(regs, tx_buf, rx_buf, buf_len); } else { + /* RTIO Transfers should always fall here */ return spi_sam_dma_txrx(dev, regs, tx_buf, rx_buf, buf_len); } #else @@ -647,13 +651,13 @@ static bool spi_sam_is_regular(const struct spi_buf_set *tx_bufs, #else static void spi_sam_iodev_complete(const struct device *dev, int status); -static void spi_sam_iodev_next(const struct device *dev, bool completion); static void spi_sam_iodev_start(const struct device *dev) { const struct spi_sam_config *cfg = dev->config; struct spi_sam_data *data = dev->data; - struct rtio_sqe *sqe = &data->txn_curr->sqe; + struct spi_rtio *rtio_ctx = data->rtio_ctx; + struct rtio_sqe *sqe = &rtio_ctx->txn_curr->sqe; int ret = 0; switch (sqe->op) { @@ -672,65 +676,48 @@ static void spi_sam_iodev_start(const struct device *dev) break; default: LOG_ERR("Invalid op code %d for submission %p\n", sqe->op, (void *)sqe); - struct rtio_iodev_sqe *txn_head = data->txn_head; - - spi_sam_iodev_next(dev, true); - rtio_iodev_sqe_err(txn_head, -EINVAL); - ret = 0; + spi_sam_iodev_complete(dev, -EINVAL); + return; } - if (ret == 0) { - spi_sam_iodev_complete(dev, 0); + + /** Completion of the RTIO transfer should come through the DMA + * callback when successful, otherwise complete it here as an error. + */ + if (ret != 0 && ret != -EWOULDBLOCK) { + spi_sam_iodev_complete(dev, ret); } } -static void spi_sam_iodev_next(const struct device *dev, bool completion) +static inline void spi_sam_iodev_prepare_start(const struct device *dev) { struct spi_sam_data *data = dev->data; + struct spi_rtio *rtio_ctx = data->rtio_ctx; + struct spi_dt_spec *spi_dt_spec = rtio_ctx->txn_curr->sqe.iodev->data; + struct spi_config *spi_config = &spi_dt_spec->config; + int err; - k_spinlock_key_t key = spi_spin_lock(dev); - - if (!completion && data->txn_curr != NULL) { - spi_spin_unlock(dev, key); - return; - } - - struct mpsc_node *next = mpsc_pop(&data->io_q); - - if (next != NULL) { - struct rtio_iodev_sqe *next_sqe = CONTAINER_OF(next, struct rtio_iodev_sqe, q); - - data->txn_head = next_sqe; - data->txn_curr = next_sqe; - } else { - data->txn_head = NULL; - data->txn_curr = NULL; - } - - spi_spin_unlock(dev, key); - - if (data->txn_curr != NULL) { - struct spi_dt_spec *spi_dt_spec = data->txn_curr->sqe.iodev->data; - struct spi_config *spi_cfg = &spi_dt_spec->config; + err = spi_sam_configure(dev, spi_config); + __ASSERT(!err, "%d", err); - spi_sam_configure(dev, spi_cfg); - spi_context_cs_control(&data->ctx, true); - spi_sam_iodev_start(dev); - } + spi_context_cs_control(&data->ctx, true); } static void spi_sam_iodev_complete(const struct device *dev, int status) { struct spi_sam_data *data = dev->data; + struct spi_rtio *rtio_ctx = data->rtio_ctx; - if (data->txn_curr->sqe.flags & RTIO_SQE_TRANSACTION) { - data->txn_curr = rtio_txn_next(data->txn_curr); + if (!status && rtio_ctx->txn_curr->sqe.flags & RTIO_SQE_TRANSACTION) { + rtio_ctx->txn_curr = rtio_txn_next(rtio_ctx->txn_curr); spi_sam_iodev_start(dev); } else { - struct rtio_iodev_sqe *txn_head = data->txn_head; - + /** De-assert CS-line to space from next transaction */ spi_context_cs_control(&data->ctx, false); - spi_sam_iodev_next(dev, true); - rtio_iodev_sqe_ok(txn_head, status); + + if (spi_rtio_complete(rtio_ctx, status)) { + spi_sam_iodev_prepare_start(dev); + spi_sam_iodev_start(dev); + } } } @@ -738,9 +725,12 @@ static void spi_sam_iodev_submit(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe) { struct spi_sam_data *data = dev->data; + struct spi_rtio *rtio_ctx = data->rtio_ctx; - mpsc_push(&data->io_q, &iodev_sqe->q); - spi_sam_iodev_next(dev, false); + if (spi_rtio_submit(rtio_ctx, iodev_sqe)) { + spi_sam_iodev_prepare_start(dev); + spi_sam_iodev_start(dev); + } } #endif @@ -755,34 +745,9 @@ static int spi_sam_transceive(const struct device *dev, spi_context_lock(&data->ctx, false, NULL, NULL, config); #if CONFIG_SPI_RTIO - struct rtio_sqe *sqe; - struct rtio_cqe *cqe; + struct spi_rtio *rtio_ctx = data->rtio_ctx; - struct spi_dt_spec *dt_spec = &data->dt_spec; - - dt_spec->config = *config; - - int ret = spi_rtio_copy(data->r, &data->iodev, tx_bufs, rx_bufs, &sqe); - - if (ret < 0) { - err = ret; - goto done; - } - - /* Submit request and wait */ - rtio_submit(data->r, ret); - - while (ret > 0) { - cqe = rtio_cqe_consume(data->r); - - if (cqe->result < 0) { - err = cqe->result; - } - - rtio_cqe_release(data->r, cqe); - - ret--; - } + err = spi_rtio_transceive(rtio_ctx, config, tx_bufs, rx_bufs); #else const struct spi_sam_config *cfg = dev->config; @@ -804,8 +769,8 @@ static int spi_sam_transceive(const struct device *dev, } spi_context_cs_control(&data->ctx, false); -#endif done: +#endif spi_context_release(&data->ctx, err); return err; } @@ -866,10 +831,7 @@ static int spi_sam_init(const struct device *dev) #endif #ifdef CONFIG_SPI_RTIO - data->dt_spec.bus = dev; - data->iodev.api = &spi_iodev_api; - data->iodev.data = &data->dt_spec; - mpsc_init(&data->io_q); + spi_rtio_init(data->rtio_ctx, dev); #endif spi_context_unlock_unconditionally(&data->ctx); @@ -914,8 +876,9 @@ static const struct spi_driver_api spi_sam_driver_api = { COND_CODE_1(SPI_SAM_USE_DMA(n), (SPI_DMA_INIT(n)), ()) \ } -#define SPI_SAM_RTIO_DEFINE(n) RTIO_DEFINE(spi_sam_rtio_##n, CONFIG_SPI_SAM_RTIO_SQ_SIZE, \ - CONFIG_SPI_SAM_RTIO_SQ_SIZE) +#define SPI_SAM_RTIO_DEFINE(n) SPI_RTIO_DEFINE(spi_sam_rtio_##n, \ + CONFIG_SPI_SAM_RTIO_SQ_SIZE, \ + CONFIG_SPI_SAM_RTIO_SQ_SIZE) #define SPI_SAM_DEVICE_INIT(n) \ PINCTRL_DT_INST_DEFINE(n); \ @@ -925,7 +888,7 @@ static const struct spi_driver_api spi_sam_driver_api = { SPI_CONTEXT_INIT_LOCK(spi_sam_dev_data_##n, ctx), \ SPI_CONTEXT_INIT_SYNC(spi_sam_dev_data_##n, ctx), \ SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(n), ctx) \ - IF_ENABLED(CONFIG_SPI_RTIO, (.r = &spi_sam_rtio_##n)) \ + IF_ENABLED(CONFIG_SPI_RTIO, (.rtio_ctx = &spi_sam_rtio_##n)) \ }; \ DEVICE_DT_INST_DEFINE(n, &spi_sam_init, NULL, \ &spi_sam_dev_data_##n, \ From 85d42bc7f1ccdb430b5bc1f69d037397262105bd Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 27 Sep 2024 07:19:10 -0400 Subject: [PATCH 1335/4482] board: mimxrt1060: fix revisions and add to board.yml configure revisions in board.yml file. Signed-off-by: Anas Nashif --- boards/nxp/mimxrt1060_evk/board.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/boards/nxp/mimxrt1060_evk/board.yml b/boards/nxp/mimxrt1060_evk/board.yml index c3787a5385ef1..8039cf65e4234 100644 --- a/boards/nxp/mimxrt1060_evk/board.yml +++ b/boards/nxp/mimxrt1060_evk/board.yml @@ -2,10 +2,14 @@ boards: - name: mimxrt1060_evk full_name: MIMXRT1060-EVK vendor: nxp - socs: - - name: mimxrt1062 revision: format: "custom" + default: "qspi" + revisions: + - name: "qspi" + - name: "hyperflash" + socs: + - name: mimxrt1062 - name: mimxrt1060_evkb full_name: MIMXRT1060-EVKB vendor: nxp From ea03011d1c58baaa5758a6a9f96a6e4ac501fff1 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 19 Sep 2024 10:57:44 -0400 Subject: [PATCH 1336/4482] tests: zbus: use full target name Do not use shortcuts... Signed-off-by: Anas Nashif --- tests/subsys/zbus/integration/testcase.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/subsys/zbus/integration/testcase.yaml b/tests/subsys/zbus/integration/testcase.yaml index 8e04f4d318cf8..e856b41667207 100644 --- a/tests/subsys/zbus/integration/testcase.yaml +++ b/tests/subsys/zbus/integration/testcase.yaml @@ -4,7 +4,7 @@ tests: - m2gl025_miv - qemu_cortex_a9 - hifive_unleashed - - fvp_base_revc_2xaemv8a//smp/ns + - fvp_base_revc_2xaemv8a/fvp_base_revc_2xaemv8a/smp/ns tags: zbus integration_platforms: - native_sim From 8c67423849674fcbbc4ef995750bbef509bf8441 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 27 Sep 2024 07:19:44 -0400 Subject: [PATCH 1337/4482] tests: use full name for fvp_base_revc_2xaemv8a//smp/ns no shortcuts allowed in test files Signed-off-by: Anas Nashif --- tests/subsys/zbus/dyn_channel/testcase.yaml | 2 +- tests/subsys/zbus/hlp_priority_boost/testcase.yaml | 2 +- tests/subsys/zbus/unittests/testcase.yaml | 4 ++-- tests/subsys/zbus/user_data/testcase.yaml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/subsys/zbus/dyn_channel/testcase.yaml b/tests/subsys/zbus/dyn_channel/testcase.yaml index 96bd746beaaf2..3b8cd0b4b5ee4 100644 --- a/tests/subsys/zbus/dyn_channel/testcase.yaml +++ b/tests/subsys/zbus/dyn_channel/testcase.yaml @@ -1,6 +1,6 @@ tests: message_bus.zbus.dyn_channel.static_and_dynamic_channels: - platform_exclude: fvp_base_revc_2xaemv8a//smp/ns + platform_exclude: fvp_base_revc_2xaemv8a/fvp_base_revc_2xaemv8a/smp/ns tags: zbus integration_platforms: - native_sim diff --git a/tests/subsys/zbus/hlp_priority_boost/testcase.yaml b/tests/subsys/zbus/hlp_priority_boost/testcase.yaml index 1196b60b19e00..4b06750635146 100644 --- a/tests/subsys/zbus/hlp_priority_boost/testcase.yaml +++ b/tests/subsys/zbus/hlp_priority_boost/testcase.yaml @@ -1,7 +1,7 @@ tests: message_bus.zbus.hlp_priority_boost: platform_exclude: - - fvp_base_revc_2xaemv8a//smp/ns + - fvp_base_revc_2xaemv8a/fvp_base_revc_2xaemv8a/smp/ns # All Intel Audio DSP platforms have non-coherent cache # between CPUs. So the zbus_channel struct data goes # out-of-sync between CPUs with multiple producer and diff --git a/tests/subsys/zbus/unittests/testcase.yaml b/tests/subsys/zbus/unittests/testcase.yaml index f5df833faf77b..21350d3eccbf8 100644 --- a/tests/subsys/zbus/unittests/testcase.yaml +++ b/tests/subsys/zbus/unittests/testcase.yaml @@ -1,6 +1,6 @@ tests: message_bus.zbus.general_unittests: - platform_exclude: fvp_base_revc_2xaemv8a//smp/ns + platform_exclude: fvp_base_revc_2xaemv8a/fvp_base_revc_2xaemv8a/smp/ns tags: zbus integration_platforms: - native_sim @@ -13,7 +13,7 @@ tests: extra_configs: - CONFIG_CMAKE_LINKER_GENERATOR=y message_bus.zbus.general_unittests_without_priority_boost: - platform_exclude: fvp_base_revc_2xaemv8a//smp/ns + platform_exclude: fvp_base_revc_2xaemv8a/fvp_base_revc_2xaemv8a/smp/ns tags: zbus integration_platforms: - native_sim diff --git a/tests/subsys/zbus/user_data/testcase.yaml b/tests/subsys/zbus/user_data/testcase.yaml index e8f6e936b9be2..f2d357e6bc6c0 100644 --- a/tests/subsys/zbus/user_data/testcase.yaml +++ b/tests/subsys/zbus/user_data/testcase.yaml @@ -1,6 +1,6 @@ tests: message_bus.zbus.user_data.channel_user_data: - platform_exclude: fvp_base_revc_2xaemv8a//smp/ns + platform_exclude: fvp_base_revc_2xaemv8a/fvp_base_revc_2xaemv8a/smp/ns tags: zbus integration_platforms: - native_sim From f1bf24e4dde20ecd2c4630bf7104ba1938daccaf Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 15 Aug 2024 10:05:52 -0400 Subject: [PATCH 1338/4482] boards: other: stm32_min_dev: use one twister.yaml Use twister.yaml and fix revisions in board.yml. Signed-off-by: Anas Nashif --- boards/others/stm32_min_dev/board.yml | 4 ++++ .../others/stm32_min_dev/stm32_min_dev_black.yaml | 15 --------------- .../{stm32_min_dev_blue.yaml => twister.yaml} | 2 -- 3 files changed, 4 insertions(+), 17 deletions(-) delete mode 100644 boards/others/stm32_min_dev/stm32_min_dev_black.yaml rename boards/others/stm32_min_dev/{stm32_min_dev_blue.yaml => twister.yaml} (62%) diff --git a/boards/others/stm32_min_dev/board.yml b/boards/others/stm32_min_dev/board.yml index 3ac7dfb895835..5b28a16fe380c 100644 --- a/boards/others/stm32_min_dev/board.yml +++ b/boards/others/stm32_min_dev/board.yml @@ -4,5 +4,9 @@ board: vendor: others revision: format: custom + default: "blue" + revisions: + - name: "blue" + - name: "black" socs: - name: stm32f103xb diff --git a/boards/others/stm32_min_dev/stm32_min_dev_black.yaml b/boards/others/stm32_min_dev/stm32_min_dev_black.yaml deleted file mode 100644 index 543b58db8375e..0000000000000 --- a/boards/others/stm32_min_dev/stm32_min_dev_black.yaml +++ /dev/null @@ -1,15 +0,0 @@ -identifier: stm32_min_dev@black -name: STM32 Minimum Development Board (black) -type: mcu -arch: arm -toolchain: - - zephyr - - gnuarmemb - - xtools -ram: 20 -supported: - - i2c - - pwm - - spi - - adc - - gpio diff --git a/boards/others/stm32_min_dev/stm32_min_dev_blue.yaml b/boards/others/stm32_min_dev/twister.yaml similarity index 62% rename from boards/others/stm32_min_dev/stm32_min_dev_blue.yaml rename to boards/others/stm32_min_dev/twister.yaml index 3a7f4ad73082c..bcb30a9fdd0f0 100644 --- a/boards/others/stm32_min_dev/stm32_min_dev_blue.yaml +++ b/boards/others/stm32_min_dev/twister.yaml @@ -1,5 +1,3 @@ -identifier: stm32_min_dev@blue -name: STM32 Minimum Development Board (blue) type: mcu arch: arm toolchain: From dfc7860ab1f947e37ed09b1860ad5ea90cefb8ef Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 9 Aug 2024 17:17:40 -0400 Subject: [PATCH 1339/4482] twister: rework board handling We now use hwmv2 to list boards instead of relying on twister specific config files. One yaml files (twister.yaml for now) will have all the data needed for all possible targets and variations of a board reusing most of the data where possible and variations can override the top level data. Twister keeps track of 'aliases' of boards and identifies that for example native_sim is the same as native_sim/native, so either names will be possible in both test yaml files or on the command line, however, the reporting will always use the full name, so no there is no confusion about what is being tested/built. Signed-off-by: Anas Nashif --- ...xaemv8a_fvp_base_revc_2xaemv8a_smp_ns.yaml | 2 +- .../pylib/twister/twisterlib/config_parser.py | 4 +- scripts/pylib/twister/twisterlib/platform.py | 75 ++++-- .../pylib/twister/twisterlib/testinstance.py | 19 +- scripts/pylib/twister/twisterlib/testplan.py | 248 +++++++++++------- .../pylib/twister/twisterlib/twister_main.py | 2 +- scripts/schemas/twister/platform-schema.yaml | 207 ++++++++------- tests/arch/arm64/arm64_smc_call/testcase.yaml | 2 +- 8 files changed, 324 insertions(+), 235 deletions(-) diff --git a/boards/arm/fvp_base_revc_2xaemv8a/fvp_base_revc_2xaemv8a_fvp_base_revc_2xaemv8a_smp_ns.yaml b/boards/arm/fvp_base_revc_2xaemv8a/fvp_base_revc_2xaemv8a_fvp_base_revc_2xaemv8a_smp_ns.yaml index e64ed9f8e7cd4..f7ef5f7e24af3 100644 --- a/boards/arm/fvp_base_revc_2xaemv8a/fvp_base_revc_2xaemv8a_fvp_base_revc_2xaemv8a_smp_ns.yaml +++ b/boards/arm/fvp_base_revc_2xaemv8a/fvp_base_revc_2xaemv8a_fvp_base_revc_2xaemv8a_smp_ns.yaml @@ -1,7 +1,7 @@ # Copyright (c) 2022 Arm Limited (or its affiliates). All rights reserved. # SPDX-License-Identifier: Apache-2.0 -identifier: fvp_base_revc_2xaemv8a//smp/ns +identifier: fvp_base_revc_2xaemv8a/fvp_base_revc_2xaemv8a/smp/ns name: FVP Emulation FVP_Base_RevC-2xAEMvA (SMP) arch: arm64 type: sim diff --git a/scripts/pylib/twister/twisterlib/config_parser.py b/scripts/pylib/twister/twisterlib/config_parser.py index 10a31613459e2..c777059ad86ec 100644 --- a/scripts/pylib/twister/twisterlib/config_parser.py +++ b/scripts/pylib/twister/twisterlib/config_parser.py @@ -93,12 +93,14 @@ def __init__(self, filename, schema): self.common = {} def load(self): - self.data = scl.yaml_load_verify(self.filename, self.schema) + data = scl.yaml_load_verify(self.filename, self.schema) + self.data = data if 'tests' in self.data: self.scenarios = self.data['tests'] if 'common' in self.data: self.common = self.data['common'] + return data def _cast_value(self, value, typestr): if isinstance(value, str): diff --git a/scripts/pylib/twister/twisterlib/platform.py b/scripts/pylib/twister/twisterlib/platform.py index 6429907928f96..03281ed3b2f36 100644 --- a/scripts/pylib/twister/twisterlib/platform.py +++ b/scripts/pylib/twister/twisterlib/platform.py @@ -6,8 +6,11 @@ import os import scl -from twisterlib.config_parser import TwisterConfigParser from twisterlib.environment import ZEPHYR_BASE +import logging + +logger = logging.getLogger('twister') +logger.setLevel(logging.DEBUG) class Platform: """Class representing metadata for a particular platform @@ -23,6 +26,7 @@ def __init__(self): """ self.name = "" + self.aliases = [] self.normalized_name = "" # if sysbuild to be used by default on a given platform self.sysbuild = False @@ -38,7 +42,7 @@ def __init__(self): self.flash = 512 self.supported = set() - self.arch = "" + self.arch = None self.vendor = "" self.tier = -1 self.type = "na" @@ -50,41 +54,58 @@ def __init__(self): self.filter_data = dict() self.uart = "" self.resc = "" + self.qualifier = None + + def load(self, board, target, aliases, data): + """Load the platform data from the board data and target data + board: the board object as per the zephyr build system + target: the target name of the board as per the zephyr build system + aliases: list of aliases for the target + data: the data from the twister.yaml file for the target + """ + self.name = target + self.aliases = aliases + + # Get data for various targets and use the main board data as a + # defauly. Individual variant information will replace the default data + # provded in the main twister configuration for this board. + variants = data.get("variants", {}) + variant_data = {} + for alias in aliases: + variant_data = variants.get(alias, {}) + if variant_data: + break - def load(self, platform_file): - scp = TwisterConfigParser(platform_file, self.platform_schema) - scp.load() - data = scp.data - - self.name = data['identifier'] self.normalized_name = self.name.replace("/", "_") - self.sysbuild = data.get("sysbuild", False) - self.twister = data.get("twister", True) + self.sysbuild = variant_data.get("sysbuild", data.get("sysbuild", self.sysbuild)) + self.twister = variant_data.get("twister", data.get("twister", self.twister)) + # if no RAM size is specified by the board, take a default of 128K - self.ram = data.get("ram", 128) - testing = data.get("testing", {}) - self.timeout_multiplier = testing.get("timeout_multiplier", 1.0) - self.ignore_tags = testing.get("ignore_tags", []) - self.only_tags = testing.get("only_tags", []) - self.default = testing.get("default", False) + self.ram = variant_data.get("ram", data.get("ram", self.ram)) + # if no flash size is specified by the board, take a default of 512K + self.flash = variant_data.get("flash", data.get("flash", self.flash)) + + testing = variant_data.get("testing", data.get("testing", {})) + self.timeout_multiplier = testing.get("timeout_multiplier", self.timeout_multiplier) + self.ignore_tags = testing.get("ignore_tags", self.ignore_tags) + self.only_tags = testing.get("only_tags", self.only_tags) + self.default = testing.get("default", self.default) self.binaries = testing.get("binaries", []) renode = testing.get("renode", {}) self.uart = renode.get("uart", "") self.resc = renode.get("resc", "") - # if no flash size is specified by the board, take a default of 512K - self.flash = data.get("flash", 512) self.supported = set() - for supp_feature in data.get("supported", []): + for supp_feature in variant_data.get("supported", data.get("supported", [])): for item in supp_feature.split(":"): self.supported.add(item) - self.arch = data['arch'] - self.vendor = data.get('vendor', '') - self.tier = data.get("tier", -1) - self.type = data.get('type', "na") - self.simulation = data.get('simulation', "na") - self.simulation_exec = data.get('simulation_exec') - self.supported_toolchains = data.get("toolchain", []) + self.arch = variant_data.get('arch', data.get('arch', self.arch)) + self.vendor = board.vendor + self.tier = variant_data.get("tier", data.get("tier", self.tier)) + self.type = variant_data.get('type', data.get('type', self.type)) + self.simulation = variant_data.get('simulation', data.get('simulation', self.simulation)) + self.simulation_exec = variant_data.get('simulation_exec', data.get('simulation_exec', self.simulation_exec)) + self.supported_toolchains = variant_data.get("toolchain", data.get("toolchain", [])) if self.supported_toolchains is None: self.supported_toolchains = [] @@ -111,7 +132,7 @@ def load(self, platform_file): if toolchain not in self.supported_toolchains: self.supported_toolchains.append(toolchain) - self.env = data.get("env", []) + self.env = variant_data.get("env", data.get("env", [])) self.env_satisfied = True for env in self.env: if not os.environ.get(env, None): diff --git a/scripts/pylib/twister/twisterlib/testinstance.py b/scripts/pylib/twister/twisterlib/testinstance.py index 16586a7a20e15..64ca808a314f6 100644 --- a/scripts/pylib/twister/twisterlib/testinstance.py +++ b/scripts/pylib/twister/twisterlib/testinstance.py @@ -241,7 +241,14 @@ def setup_handler(self, env: TwisterEnv): self.handler = handler # Global testsuite parameters - def check_runnable(self, enable_slow=False, filter='buildable', fixtures=[], hardware_map=None): + def check_runnable(self, + options, + hardware_map=None): + + enable_slow = options.enable_slow + filter = options.filter + fixtures = options.fixture + device_testing = options.device_testing if os.name == 'nt': # running on simulators is currently supported only for QEMU on Windows @@ -264,8 +271,7 @@ def check_runnable(self, enable_slow=False, filter='buildable', fixtures=[], har target_ready = bool(self.testsuite.type == "unit" or \ self.platform.type == "native" or \ (self.platform.simulation in SUPPORTED_SIMS and \ - self.platform.simulation not in self.testsuite.simulation_exclude) or \ - filter == 'runnable') + self.platform.simulation not in self.testsuite.simulation_exclude) or device_testing) # check if test is runnable in pytest if self.testsuite.harness == 'pytest': @@ -317,9 +323,10 @@ def create_overlay(self, platform, enable_asan=False, enable_ubsan=False, enable content = "\n".join(new_config_list) if enable_coverage: - if platform.name in coverage_platform: - content = content + "\nCONFIG_COVERAGE=y" - content = content + "\nCONFIG_COVERAGE_DUMP=y" + for cp in coverage_platform: + if cp in platform.aliases: + content = content + "\nCONFIG_COVERAGE=y" + content = content + "\nCONFIG_COVERAGE_DUMP=y" if enable_asan: if platform.type == "native": diff --git a/scripts/pylib/twister/twisterlib/testplan.py b/scripts/pylib/twister/twisterlib/testplan.py index 360040490de54..8731522c21ece 100755 --- a/scripts/pylib/twister/twisterlib/testplan.py +++ b/scripts/pylib/twister/twisterlib/testplan.py @@ -182,6 +182,7 @@ def discover(self): if self.options.test: self.run_individual_testsuite = self.options.test + self.add_configurations() num = self.add_testsuites(testsuite_filter=self.run_individual_testsuite) if num == 0: raise TwisterRuntimeError("No test cases found at the specified location...") @@ -192,9 +193,7 @@ def discover(self): self.scenarios.append(ts.id) self.report_duplicates() - self.parse_configuration(config_file=self.env.test_config) - self.add_configurations() if self.load_errors: raise TwisterRuntimeError("Errors while loading configurations") @@ -398,8 +397,13 @@ def info(what): sys.stdout.write(what + "\n") sys.stdout.flush() + def find_twister_data(self, board_data_list, board_aliases): + """Find the twister data for a board in the list of board data based on the aliases""" + for board_data in board_data_list: + if board_data.get('identifier') in board_aliases: + return board_data + def add_configurations(self): - board_dirs = set() # Create a list of board roots as defined by the build system in general # Note, internally in twister a board root includes the `boards` folder # but in Zephyr build system, the board root is without the `boards` in folder path. @@ -407,82 +411,91 @@ def add_configurations(self): lb_args = Namespace(arch_roots=self.env.arch_roots, soc_roots=self.env.soc_roots, board_roots=board_roots, board=None, board_dir=None) - v1_boards = list_boards.find_boards(lb_args) - v2_dirs = list_boards.find_v2_board_dirs(lb_args) - for b in v1_boards: - board_dirs.add(b.dir) - board_dirs.update(v2_dirs) - logger.debug("Reading platform configuration files under %s..." % self.env.board_roots) - + known_boards = list_boards.find_v2_boards(lb_args) + bdirs = {} platform_config = self.test_config.get('platforms', {}) - for folder in board_dirs: - for file in glob.glob(os.path.join(folder, "*.yaml")): - # If the user set a platform filter, we can, if no other option would increase - # the allowed platform pool, save on time by not loading YAMLs of any boards - # that do not start with the required names. - if self.options.platform and \ - not self.options.all and \ - not self.options.integration and \ - not any([ - os.path.basename(file).startswith( - re.split('[/@]', p)[0] - ) for p in self.options.platform - ]): - continue - try: - platform = Platform() - platform.load(file) - if platform.name in [p.name for p in self.platforms]: - logger.error(f"Duplicate platform {platform.name} in {file}") - raise Exception(f"Duplicate platform identifier {platform.name} found") - if not platform.twister: + # helper function to initialize and add platforms + def init_and_add_platforms(data, board, target, qualifier, aliases): + platform = Platform() + if not new_config_found: + data = self.find_twister_data(bdirs[board.dir], aliases) + if not data: + return + platform.load(board, target, aliases, data) + platform.qualifier = qualifier + if platform.name in [p.name for p in self.platforms]: + logger.error(f"Duplicate platform {platform.name} in {board.dir}") + raise Exception(f"Duplicate platform identifier {platform.name} found") + if not platform.twister: + return + logger.debug(f"Adding platform {platform.name} with aliases {platform.aliases}") + self.platforms.append(platform) + + for board in known_boards: + new_config_found = False + # don't load the same board data twice + if not bdirs.get(board.dir): + datas = [] + for file in glob.glob(os.path.join(board.dir, "*.yaml")): + if os.path.basename(file) == "twister.yaml": + continue + try: + scp = TwisterConfigParser(file, Platform.platform_schema) + sdata = scp.load() + datas.append(sdata) + except Exception as e: + logger.error(f"Error loading {file}: {e!r}") + self.load_errors += 1 continue + bdirs[board.dir] = datas + data = {} + if os.path.exists(board.dir / 'twister.yaml'): + try: + scp = TwisterConfigParser(board.dir / 'twister.yaml', Platform.platform_schema) + data = scp.load() + except Exception as e: + logger.error(f"Error loading {board.dir / 'twister.yaml'}: {e!r}") + self.load_errors += 1 + continue + new_config_found = True - self.platforms.append(platform) - if not platform_config.get('override_default_platforms', False): - if platform.default: - self.default_platforms.append(platform.name) - else: - if platform.name in platform_config.get('default_platforms', []): - logger.debug(f"adding {platform.name} to default platforms") - self.default_platforms.append(platform.name) - - # support board@revision - # if there is already an existed _.yaml, then use it to - # load platform directly, otherwise, iterate the directory to - # get all valid board revision based on each _.conf. - if '@' not in platform.name: - tmp_dir = os.listdir(os.path.dirname(file)) - for item in tmp_dir: - # Need to make sure the revision matches - # the permitted patterns as described in - # cmake/modules/extensions.cmake. - revision_patterns = ["[A-Z]", - "[0-9]+", - "(0|[1-9][0-9]*)(_[0-9]+){0,2}"] - - for pattern in revision_patterns: - result = re.match(f"{platform.name}_(?P{pattern})\\.conf", item) - if result: - revision = result.group("revision") - yaml_file = f"{platform.name}_{revision}.yaml" - if yaml_file not in tmp_dir: - platform_revision = copy.deepcopy(platform) - revision = revision.replace("_", ".") - platform_revision.name = f"{platform.name}@{revision}" - platform_revision.normalized_name = platform_revision.name.replace("/", "_") - platform_revision.default = False - self.platforms.append(platform_revision) - break + for qual in list_boards.board_v2_qualifiers(board): - except RuntimeError as e: - logger.error("E: %s: can't load: %s" % (file, e)) - self.load_errors += 1 + if board.revisions: + for rev in board.revisions: + target = f"{board.name}@{rev.name}/{qual}" + aliases = [target] + target_no_rev = f"{board.name}/{qual}" + if rev.name == board.revision_default: + aliases.append(target_no_rev) + if '/' not in qual and len(board.socs) == 1: + if rev.name == board.revision_default: + aliases.append(f"{board.name}") + aliases.append(f"{board.name}@{rev.name}") + + init_and_add_platforms(data, board, target, qual, aliases) + else: + target = f"{board.name}/{qual}" + aliases = [target] + if '/' not in qual and len(board.socs) == 1: + aliases.append(board.name) + init_and_add_platforms(data, board, target, qual, aliases) - self.platform_names = [p.name for p in self.platforms] + for platform in self.platforms: + if not platform_config.get('override_default_platforms', False): + if platform.default: + self.default_platforms.append(platform.name) + #logger.debug(f"adding {platform.name} to default platforms") + continue + for pp in platform_config.get('default_platforms', []): + if pp in platform.aliases: + logger.debug(f"adding {platform.name} to default platforms (override mode)") + self.default_platforms.append(platform.name) + + self.platform_names = [a for p in self.platforms for a in p.aliases] def get_all_tests(self): testcases = [] @@ -550,6 +563,30 @@ def add_testsuites(self, testsuite_filter=[]): for name in parsed_data.scenarios.keys(): suite_dict = parsed_data.get_scenario(name) suite = TestSuite(root, suite_path, name, data=suite_dict, detailed_test_id=self.options.detailed_test_id) + + # convert to fully qualified names + _integration = [] + _platform_allow = [] + _platform_exclude = [] + for _ip in suite.integration_platforms: + if _ip in self.platform_names: + _integration.append(self.get_platform(_ip).name) + else: + logger.error(f"Platform {_ip} not found in the list of platforms") + suite.integration_platforms = _integration + for _pe in suite.platform_exclude: + if _pe in self.platform_names: + _platform_exclude.append(self.get_platform(_pe).name) + else: + logger.error(f"Platform {_pe} not found in the list of platforms") + suite.platform_exclude = _platform_exclude + for _pa in suite.platform_allow: + if _pa in self.platform_names: + _platform_allow.append(self.get_platform(_pa).name) + else: + logger.error(f"Platform {_pa} not found in the list of platforms") + suite.platform_allow = _platform_allow + if suite.harness in ['ztest', 'test']: if subcases is None: # scan it only once per testsuite @@ -575,7 +612,7 @@ def __str__(self): def get_platform(self, name): selected_platform = None for platform in self.platforms: - if platform.name == name: + if name in platform.aliases: selected_platform = platform break return selected_platform @@ -608,13 +645,10 @@ def load_from_file(self, file, filter_platform=[]): instance.run_id = ts.get("run_id") if self.options.device_testing: - tfilter = 'runnable' - else: - tfilter = 'buildable' + self.options.filter = 'runnable' + instance.run = instance.check_runnable( - self.options.enable_slow, - tfilter, - self.options.fixture, + self.options, self.hwm ) @@ -660,14 +694,24 @@ def load_from_file(self, file, filter_platform=[]): if tc.get('log'): case.output = tc.get('log') - - instance.create_overlay(platform, self.options.enable_asan, self.options.enable_ubsan, self.options.enable_coverage, self.options.coverage_platform) + instance.create_overlay(platform, + self.options.enable_asan, + self.options.enable_ubsan, + self.options.enable_coverage, + self.options.coverage_platform + ) instance_list.append(instance) self.add_instances(instance_list) except FileNotFoundError as e: logger.error(f"{e}") return 1 + def check_platform(self, platform, platform_list): + for p in platform_list: + if p in platform.aliases: + return True + return False + def apply_filters(self, **kwargs): toolchain = self.env.toolchain @@ -709,8 +753,16 @@ def apply_filters(self, **kwargs): elif vendor_filter: vendor_platforms = True + _platforms = [] if platform_filter: + logger.debug(f"Checking platform filter: {platform_filter}") + # find in aliases and rename self.verify_platforms_existence(platform_filter, f"platform_filter") + for pf in platform_filter: + logger.debug(f"Checking platform in filter: {pf}") + if pf in self.platform_names: + _platforms.append(self.get_platform(pf).name) + platform_filter = _platforms platforms = list(filter(lambda p: p.name in platform_filter, self.platforms)) elif emu_filter: platforms = list(filter(lambda p: p.simulation != 'na', self.platforms)) @@ -776,19 +828,12 @@ def apply_filters(self, **kwargs): instance_list = [] for plat in platform_scope: instance = TestInstance(ts, plat, self.env.outdir) - if runnable: - tfilter = 'runnable' - else: - tfilter = 'buildable' - instance.run = instance.check_runnable( - self.options.enable_slow, - tfilter, - self.options.fixture, + self.options, self.hwm ) - if not force_platform and plat.name in exclude_platform: + if not force_platform and self.check_platform(plat,exclude_platform): instance.add_filter("Platform is excluded on command line.", Filters.CMD_LINE) if (plat.arch == "unit") != (ts.type == "unit"): @@ -961,13 +1006,13 @@ def apply_filters(self, **kwargs): keyed_test = keyed_tests.get(test_keys) if keyed_test is not None: plat_key = {key_field: getattr(keyed_test['plat'], key_field) for key_field in key_fields} - instance.add_filter(f"Already covered for key {tuple(key)} by platform {keyed_test['plat'].name} having key {plat_key}", Filters.PLATFORM_KEY) + instance.add_filter(f"Already covered for key {key} by platform {keyed_test['plat'].name} having key {plat_key}", Filters.PLATFORM_KEY) else: - # do not add a platform to keyed tests if previously filtered + # do not add a platform to keyed tests if previously + # filtered + if not instance.filters: keyed_tests[test_keys] = {'plat': plat, 'ts': ts} - else: - instance.add_filter(f"Excluded platform missing key fields demanded by test {key_fields}", Filters.PLATFORM) # if nothing stopped us until now, it means this configuration # needs to be added. @@ -981,11 +1026,11 @@ def apply_filters(self, **kwargs): # take all default platforms if default_platforms and not ts.build_on_all and not integration: if ts.platform_allow: - a = set(self.default_platforms) - b = set(ts.platform_allow) - c = a.intersection(b) - if c: - aa = list(filter(lambda ts: ts.platform.name in c, instance_list)) + _default_p = set(self.default_platforms) + _platform_allow = set(ts.platform_allow) + _intersection = _default_p.intersection(_platform_allow) + if _intersection: + aa = list(filter(lambda _scenario: _scenario.platform.name in _intersection, instance_list)) self.add_instances(aa) else: self.add_instances(instance_list) @@ -1011,7 +1056,11 @@ def apply_filters(self, **kwargs): self.add_instances(instance_list) for _, case in self.instances.items(): - case.create_overlay(case.platform, self.options.enable_asan, self.options.enable_ubsan, self.options.enable_coverage, self.options.coverage_platform) + case.create_overlay(case.platform, + self.options.enable_asan, + self.options.enable_ubsan, + self.options.enable_coverage, + self.options.coverage_platform) self.selected_platforms = set(p.platform.name for p in self.instances.values()) @@ -1105,3 +1154,4 @@ def change_skip_to_error_if_integration(options, instance): return instance.status = TwisterStatus.ERROR instance.reason += " but is one of the integration platforms" + logger.debug(f"Changing status of {instance.name} to ERROR because it is an integration platform") diff --git a/scripts/pylib/twister/twisterlib/twister_main.py b/scripts/pylib/twister/twisterlib/twister_main.py index 55398be8cc011..f5ee03b808aed 100644 --- a/scripts/pylib/twister/twisterlib/twister_main.py +++ b/scripts/pylib/twister/twisterlib/twister_main.py @@ -139,7 +139,7 @@ def main(options: argparse.Namespace, default_options: argparse.Namespace): for i in tplan.instances.values(): if i.status == TwisterStatus.FILTER: - if options.platform and i.platform.name not in options.platform: + if options.platform and not tplan.check_platform(i.platform, options.platform): continue logger.debug( "{:<25} {:<50} {}SKIPPED{}: {}".format( diff --git a/scripts/schemas/twister/platform-schema.yaml b/scripts/schemas/twister/platform-schema.yaml index c651f83c3e364..a8771404b0267 100644 --- a/scripts/schemas/twister/platform-schema.yaml +++ b/scripts/schemas/twister/platform-schema.yaml @@ -9,103 +9,112 @@ # The original spec comes from Zephyr's twister script # -type: map -mapping: - "identifier": - type: str - "maintainers": - type: seq - seq: - - type: str - "name": - type: str - "type": - type: str - enum: ["mcu", "qemu", "sim", "unit", "native"] - "simulation": - type: str - enum: - [ - "qemu", - "simics", - "xt-sim", - "renode", - "nsim", - "mdb-nsim", - "tsim", - "armfvp", - "native", - "custom", - ] - "simulation_exec": - type: str - "arch": - type: str - enum: - [ - # architectures - "arc", - "arm", - "arm64", - "mips", - "nios2", - "posix", - "riscv", - "sparc", - "x86", - "xtensa", +schema;platform-schema: + type: map + mapping: + "variants": + type: map + matching-rule: "any" + mapping: + regex;(([a-zA-Z0-9_]+)): + include: platform-schema + "identifier": + type: str + "maintainers": + type: seq + seq: + - type: str + "name": + type: str + "type": + type: str + enum: ["mcu", "qemu", "sim", "unit", "native"] + "simulation": + type: str + enum: + [ + "qemu", + "simics", + "xt-sim", + "renode", + "nsim", + "mdb-nsim", + "tsim", + "armfvp", + "native", + "custom", + ] + "simulation_exec": + type: str + "arch": + type: str + enum: + [ + # architectures + "arc", + "arm", + "arm64", + "mips", + "nios2", + "posix", + "riscv", + "sparc", + "x86", + "xtensa", - # unit testing - "unit", - ] - "vendor": - type: str - "tier": - type: int - "toolchain": - type: seq - seq: - - type: str - "sysbuild": - type: bool - "env": - type: seq - seq: - - type: str - "ram": - type: int - "flash": - type: int - "twister": - type: bool - "supported": - type: seq - seq: - - type: str - "testing": - type: map - mapping: - "timeout_multiplier": - type: number - required: false - "default": - type: bool - "binaries": - type: seq - seq: - - type: str - "only_tags": - type: seq - seq: - - type: str - "ignore_tags": - type: seq - seq: - - type: str - "renode": - type: map - mapping: - "uart": - type: str - "resc": - type: str + # unit testing + "unit", + ] + "vendor": + type: str + "tier": + type: int + "toolchain": + type: seq + seq: + - type: str + "sysbuild": + type: bool + "env": + type: seq + seq: + - type: str + "ram": + type: int + "flash": + type: int + "twister": + type: bool + "supported": + type: seq + seq: + - type: str + "testing": + type: map + mapping: + "timeout_multiplier": + type: number + required: false + "default": + type: bool + "binaries": + type: seq + seq: + - type: str + "only_tags": + type: seq + seq: + - type: str + "ignore_tags": + type: seq + seq: + - type: str + "renode": + type: map + mapping: + "uart": + type: str + "resc": + type: str + +include: platform-schema diff --git a/tests/arch/arm64/arm64_smc_call/testcase.yaml b/tests/arch/arm64/arm64_smc_call/testcase.yaml index 763192878e67b..eb424fe1a5237 100644 --- a/tests/arch/arm64/arm64_smc_call/testcase.yaml +++ b/tests/arch/arm64/arm64_smc_call/testcase.yaml @@ -1,6 +1,6 @@ tests: arch.arm64.smc_call.smc: - platform_allow: fvp_base_revc_2xaemv8a//smp/ns + platform_allow: fvp_base_revc_2xaemv8a/fvp_base_revc_2xaemv8a/smp/ns tags: - arm - smc From 1f913f5fe3249b847751770e584aa552e197ecbd Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 16 Aug 2024 09:26:34 -0400 Subject: [PATCH 1340/4482] boards: intel_adsp: use one twister.yaml Use one single twister configuration file. Signed-off-by: Anas Nashif --- boards/intel/adsp/intel_adsp_ace15_mtpm.yaml | 15 -------- .../intel/adsp/intel_adsp_ace15_mtpm_sim.yaml | 14 -------- boards/intel/adsp/intel_adsp_ace20_lnl.yaml | 16 --------- .../intel/adsp/intel_adsp_ace20_lnl_sim.yaml | 13 ------- boards/intel/adsp/intel_adsp_ace30_ptl.yaml | 10 ------ .../intel/adsp/intel_adsp_ace30_ptl_sim.yaml | 12 ------- boards/intel/adsp/intel_adsp_cavs25.yaml | 15 -------- boards/intel/adsp/intel_adsp_cavs25_tgph.yaml | 14 -------- boards/intel/adsp/twister.yaml | 36 +++++++++++++++++++ 9 files changed, 36 insertions(+), 109 deletions(-) delete mode 100644 boards/intel/adsp/intel_adsp_ace15_mtpm.yaml delete mode 100644 boards/intel/adsp/intel_adsp_ace15_mtpm_sim.yaml delete mode 100644 boards/intel/adsp/intel_adsp_ace20_lnl.yaml delete mode 100644 boards/intel/adsp/intel_adsp_ace20_lnl_sim.yaml delete mode 100644 boards/intel/adsp/intel_adsp_ace30_ptl.yaml delete mode 100644 boards/intel/adsp/intel_adsp_ace30_ptl_sim.yaml delete mode 100644 boards/intel/adsp/intel_adsp_cavs25.yaml delete mode 100644 boards/intel/adsp/intel_adsp_cavs25_tgph.yaml create mode 100644 boards/intel/adsp/twister.yaml diff --git a/boards/intel/adsp/intel_adsp_ace15_mtpm.yaml b/boards/intel/adsp/intel_adsp_ace15_mtpm.yaml deleted file mode 100644 index 3449cda35f7bf..0000000000000 --- a/boards/intel/adsp/intel_adsp_ace15_mtpm.yaml +++ /dev/null @@ -1,15 +0,0 @@ -identifier: intel_adsp/ace15_mtpm -name: ACE 1.5 MTL M Audio DSP -type: mcu -arch: xtensa -toolchain: - - zephyr - - xcc - - xt-clang -supported: - - dma -testing: - ignore_tags: - - net - - bluetooth -vendor: intel diff --git a/boards/intel/adsp/intel_adsp_ace15_mtpm_sim.yaml b/boards/intel/adsp/intel_adsp_ace15_mtpm_sim.yaml deleted file mode 100644 index 418849ec8a444..0000000000000 --- a/boards/intel/adsp/intel_adsp_ace15_mtpm_sim.yaml +++ /dev/null @@ -1,14 +0,0 @@ -identifier: intel_adsp/ace15_mtpm/sim -name: ACE 1.5 Meteor Lake M Audio DSP -type: sim -simulation: custom -arch: xtensa -toolchain: - - xcc - - zephyr - - xt-clang -testing: - timeout_multiplier: 4 - ignore_tags: - - net - - bluetooth diff --git a/boards/intel/adsp/intel_adsp_ace20_lnl.yaml b/boards/intel/adsp/intel_adsp_ace20_lnl.yaml deleted file mode 100644 index 47a025636544e..0000000000000 --- a/boards/intel/adsp/intel_adsp_ace20_lnl.yaml +++ /dev/null @@ -1,16 +0,0 @@ -identifier: intel_adsp/ace20_lnl -name: ACE 2.0 LNL Audio DSP -type: mcu -arch: xtensa -toolchain: - - xcc - - xt-clang - - zephyr -supported: - - dma -testing: - ignore_tags: - - net - - bluetooth - - mcumgr -vendor: intel diff --git a/boards/intel/adsp/intel_adsp_ace20_lnl_sim.yaml b/boards/intel/adsp/intel_adsp_ace20_lnl_sim.yaml deleted file mode 100644 index cde563043dae7..0000000000000 --- a/boards/intel/adsp/intel_adsp_ace20_lnl_sim.yaml +++ /dev/null @@ -1,13 +0,0 @@ -identifier: intel_adsp/ace20_lnl/sim -name: ACE 2.0 Lunar Lake Audio DSP -type: sim -simulation: custom -arch: xtensa -toolchain: - - xcc - - xt-clang -testing: - timeout_multiplier: 6 - ignore_tags: - - net - - bluetooth diff --git a/boards/intel/adsp/intel_adsp_ace30_ptl.yaml b/boards/intel/adsp/intel_adsp_ace30_ptl.yaml deleted file mode 100644 index 061ac9cd74204..0000000000000 --- a/boards/intel/adsp/intel_adsp_ace30_ptl.yaml +++ /dev/null @@ -1,10 +0,0 @@ -identifier: intel_adsp/ace30/ptl -name: ACE 3.0 Panther Lake Audio DSP -type: mcu -arch: xtensa -toolchain: - - xt-clang -testing: - ignore_tags: - - net - - bluetooth diff --git a/boards/intel/adsp/intel_adsp_ace30_ptl_sim.yaml b/boards/intel/adsp/intel_adsp_ace30_ptl_sim.yaml deleted file mode 100644 index 42b07e49ee32d..0000000000000 --- a/boards/intel/adsp/intel_adsp_ace30_ptl_sim.yaml +++ /dev/null @@ -1,12 +0,0 @@ -identifier: intel_adsp/ace30/ptl/sim -name: ACE 3.0 Panther Lake Audio DSP -type: sim -simulation: custom -arch: xtensa -toolchain: - - xt-clang -testing: - timeout_multiplier: 8 - ignore_tags: - - net - - bluetooth diff --git a/boards/intel/adsp/intel_adsp_cavs25.yaml b/boards/intel/adsp/intel_adsp_cavs25.yaml deleted file mode 100644 index 79982b426e7dd..0000000000000 --- a/boards/intel/adsp/intel_adsp_cavs25.yaml +++ /dev/null @@ -1,15 +0,0 @@ -identifier: intel_adsp/cavs25 -name: cAVS 2.5 Audio DSP (converged Audio Voice and Speech) -type: mcu -arch: xtensa -toolchain: - - xcc - - zephyr -supported: - - dma - - dai -testing: - ignore_tags: - - net - - bluetooth -vendor: intel diff --git a/boards/intel/adsp/intel_adsp_cavs25_tgph.yaml b/boards/intel/adsp/intel_adsp_cavs25_tgph.yaml deleted file mode 100644 index db3d32fad8fac..0000000000000 --- a/boards/intel/adsp/intel_adsp_cavs25_tgph.yaml +++ /dev/null @@ -1,14 +0,0 @@ -identifier: intel_adsp/cavs25/tgph -name: cAVS 2.5 Audio DSP for Tiger Lake H PCH (Converged Audio Voice and Speech) -type: mcu -arch: xtensa -toolchain: - - xcc - - zephyr -supported: - - dma -testing: - ignore_tags: - - net - - bluetooth -vendor: intel diff --git a/boards/intel/adsp/twister.yaml b/boards/intel/adsp/twister.yaml new file mode 100644 index 0000000000000..94b6f58c53dc1 --- /dev/null +++ b/boards/intel/adsp/twister.yaml @@ -0,0 +1,36 @@ +type: mcu +arch: xtensa +toolchain: + - zephyr + - xcc + - xt-clang +supported: + - dma +testing: + ignore_tags: + - net + - bluetooth + - mcumgr +variants: + intel_adsp/ace30/ptl: + toolchain: + - xt-clang + intel_adsp/ace30: + twister: false + intel_adsp/ace30/ptl/sim: + toolchain: + - xt-clang + intel_adsp/cavs25: + toolchain: + - xcc + - zephyr + supported: + - dma + - dai + intel_adsp/cavs25/tgph: + toolchain: + - xcc + - zephyr + supported: + - dma + - dai From 1c3b47e9efdbda6d5871531cfa93b9a5c5f2fb60 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Sat, 14 Sep 2024 08:02:17 -0400 Subject: [PATCH 1341/4482] twister: test udpates for new board handling Updated tests for new board handling. Signed-off-by: Anas Nashif --- .../tests/test_d/snippets/dummy/snippet.yml | 2 +- scripts/tests/twister/test_platform.py | 5 +- scripts/tests/twister/test_runner.py | 1 + scripts/tests/twister/test_testinstance.py | 45 ++++--- scripts/tests/twister/test_testplan.py | 115 +++++++++++------- scripts/tests/twister_blackbox/test_addon.py | 2 +- scripts/tests/twister_blackbox/test_config.py | 3 +- .../boards/others/dummy_board/board.yml | 2 +- .../others/dummy_board/dummy_board.yaml | 2 +- .../test_data/twister-quarantine-list.yml | 4 +- scripts/tests/twister_blackbox/test_filter.py | 30 +++-- .../tests/twister_blackbox/test_outfile.py | 8 +- scripts/tests/twister_blackbox/test_output.py | 2 +- .../tests/twister_blackbox/test_platform.py | 6 +- .../tests/twister_blackbox/test_printouts.py | 2 +- .../tests/twister_blackbox/test_quarantine.py | 8 +- scripts/tests/twister_blackbox/test_report.py | 40 +++--- scripts/tests/twister_blackbox/test_runner.py | 12 +- .../tests/twister_blackbox/test_testplan.py | 6 +- 19 files changed, 173 insertions(+), 122 deletions(-) diff --git a/scripts/tests/twister/test_data/testsuites/tests/test_d/snippets/dummy/snippet.yml b/scripts/tests/twister/test_data/testsuites/tests/test_d/snippets/dummy/snippet.yml index 05c65f733fdb1..1f5269963d575 100644 --- a/scripts/tests/twister/test_data/testsuites/tests/test_d/snippets/dummy/snippet.yml +++ b/scripts/tests/twister/test_data/testsuites/tests/test_d/snippets/dummy/snippet.yml @@ -1,5 +1,5 @@ name: dummy boards: - demo_board_2: + demo_board_2/unit_testing: append: EXTRA_CONF_FILE: dummy.conf diff --git a/scripts/tests/twister/test_platform.py b/scripts/tests/twister/test_platform.py index 4da0bb4133ffa..69b6d88422691 100644 --- a/scripts/tests/twister/test_platform.py +++ b/scripts/tests/twister/test_platform.py @@ -104,12 +104,15 @@ ), ] +# This test is disabled because the Platform loading was changed significantly. +# The test should be updated to reflect the new implementation. + @pytest.mark.parametrize( 'platform_text, expected_data, expected_repr', TESTDATA_1, ids=['almost empty specification', 'full specification'] ) -def test_platform_load(platform_text, expected_data, expected_repr): +def xtest_platform_load(platform_text, expected_data, expected_repr): platform = Platform() with mock.patch('builtins.open', mock.mock_open(read_data=platform_text)): diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index d2d0143d18904..1aecba6dbfc37 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -2051,6 +2051,7 @@ def test_projectbuilder_report_out( assert all([log in trim_actual_log for log in expected_logs]) + print(trim_actual_log) if expected_out: out, err = capfd.readouterr() sys.stdout.write(out) diff --git a/scripts/tests/twister/test_testinstance.py b/scripts/tests/twister/test_testinstance.py index d6cc2d95ec8b2..59ea56a207eef 100644 --- a/scripts/tests/twister/test_testinstance.py +++ b/scripts/tests/twister/test_testinstance.py @@ -68,32 +68,40 @@ def test_check_build_or_run( testsuite.slow = slow testinstance = TestInstance(testsuite, platform, class_testplan.env.outdir) - run = testinstance.check_runnable(slow, device_testing, fixture) + env = mock.Mock( + options=mock.Mock( + device_testing=False, + enable_slow=slow, + fixtures=fixture, + filter="" + ) + ) + run = testinstance.check_runnable(env.options) _, r = expected assert run == r with mock.patch('os.name', 'nt'): # path to QEMU binary is not in QEMU_BIN_PATH environment variable - run = testinstance.check_runnable() + run = testinstance.check_runnable(env.options) assert not run # mock path to QEMU binary in QEMU_BIN_PATH environment variable with mock.patch('os.environ', {'QEMU_BIN_PATH': ''}): - run = testinstance.check_runnable() + run = testinstance.check_runnable(env.options) _, r = expected assert run == r TESTDATA_PART_2 = [ - (True, True, True, ["demo_board_2"], "native", + (True, True, True, ["demo_board_2/unit_testing"], "native", None, '\nCONFIG_COVERAGE=y\nCONFIG_COVERAGE_DUMP=y\nCONFIG_ASAN=y\nCONFIG_UBSAN=y'), - (True, False, True, ["demo_board_2"], "native", + (True, False, True, ["demo_board_2/unit_testing"], "native", None, '\nCONFIG_COVERAGE=y\nCONFIG_COVERAGE_DUMP=y\nCONFIG_ASAN=y'), - (False, False, True, ["demo_board_2"], 'native', + (False, False, True, ["demo_board_2/unit_testing"], 'native', None, '\nCONFIG_COVERAGE=y\nCONFIG_COVERAGE_DUMP=y'), - (True, False, True, ["demo_board_2"], 'mcu', + (True, False, True, ["demo_board_2/unit_testing"], 'mcu', None, '\nCONFIG_COVERAGE=y\nCONFIG_COVERAGE_DUMP=y'), - (False, False, False, ["demo_board_2"], 'native', None, ''), + (False, False, False, ["demo_board_2/unit_testing"], 'native', None, ''), (False, False, True, ['demo_board_1'], 'native', None, ''), (True, False, False, ["demo_board_2"], 'native', None, '\nCONFIG_ASAN=y'), (False, True, False, ["demo_board_2"], 'native', None, '\nCONFIG_UBSAN=y'), @@ -104,7 +112,7 @@ def test_check_build_or_run( (False, False, False, ["demo_board_2"], 'native', ["arch:arm:CONFIG_LOG=y"], ''), (False, False, False, ["demo_board_2"], 'native', - ["platform:demo_board_2:CONFIG_LOG=y"], 'CONFIG_LOG=y'), + ["platform:demo_board_2/unit_testing:CONFIG_LOG=y"], 'CONFIG_LOG=y'), (False, False, False, ["demo_board_2"], 'native', ["platform:demo_board_1:CONFIG_LOG=y"], ''), ] @@ -216,15 +224,14 @@ def test_testinstance_init(all_testsuites_dict, class_testplan, platforms_list, testsuite = class_testplan.testsuites.get(testsuite_path) testsuite.detailed_test_id = detailed_test_id class_testplan.platforms = platforms_list - print(class_testplan.platforms) - platform = class_testplan.get_platform("demo_board_2") + platform = class_testplan.get_platform("demo_board_2/unit_testing") testinstance = TestInstance(testsuite, platform, class_testplan.env.outdir) if detailed_test_id: - assert testinstance.build_dir == os.path.join(class_testplan.env.outdir, platform.name, testsuite_path) + assert testinstance.build_dir == os.path.join(class_testplan.env.outdir, platform.normalized_name, testsuite_path) else: - assert testinstance.build_dir == os.path.join(class_testplan.env.outdir, platform.name, testsuite.source_dir_rel, testsuite.name) + assert testinstance.build_dir == os.path.join(class_testplan.env.outdir, platform.normalized_name, testsuite.source_dir_rel, testsuite.name) @pytest.mark.parametrize('testinstance', [{'testsuite_kind': 'sample'}], indirect=True) @@ -350,7 +357,7 @@ def test_testinstance_dunders(all_testsuites_dict, class_testplan, platforms_lis assert not testinstance < testinstance_copy assert not testinstance_copy < testinstance - assert testinstance.__repr__() == f'' + assert testinstance.__repr__() == f'' @pytest.mark.parametrize('testinstance', [{'testsuite_kind': 'tests'}], indirect=True) @@ -545,9 +552,17 @@ def test_testinstance_check_runnable( testinstance.testsuite.slow = testsuite_slow testinstance.testsuite.harness = testsuite_harness + env = mock.Mock( + options=mock.Mock( + device_testing=False, + enable_slow=enable_slow, + fixtures=fixtures, + filter=filter + ) + ) with mock.patch('os.name', os_name), \ mock.patch('shutil.which', return_value=exec_exists): - res = testinstance.check_runnable(enable_slow, filter, fixtures, hardware_map) + res = testinstance.check_runnable(env.options, hardware_map) assert res == expected diff --git a/scripts/tests/twister/test_testplan.py b/scripts/tests/twister/test_testplan.py index fe9c6b99f38b0..7241633626f83 100644 --- a/scripts/tests/twister/test_testplan.py +++ b/scripts/tests/twister/test_testplan.py @@ -63,7 +63,8 @@ def test_add_configurations_short(test_data, class_env, board_root_dir): plan.parse_configuration(config_file=class_env.test_config) if board_root_dir == "board_config": plan.add_configurations() - assert sorted(plan.default_platforms) == sorted(['demo_board_1', 'demo_board_3']) + print(sorted(plan.default_platforms)) + assert sorted(plan.default_platforms) == sorted(['demo_board_1/unit_testing', 'demo_board_3/unit_testing']) elif board_root_dir == "board_config_file_not_exist": plan.add_configurations() assert sorted(plan.default_platforms) != sorted(['demo_board_1']) @@ -95,11 +96,11 @@ def test_get_platforms_short(class_testplan, platforms_list): plan.platforms = platforms_list platform = plan.get_platform("demo_board_1") assert isinstance(platform, Platform) - assert platform.name == "demo_board_1" + assert platform.name == "demo_board_1/unit_testing" TESTDATA_PART1 = [ ("toolchain_allow", ['gcc'], None, None, "Not in testsuite toolchain allow list"), - ("platform_allow", ['demo_board_1'], None, None, "Not in testsuite platform allow list"), + ("platform_allow", ['demo_board_1/unit_testing'], None, None, "Not in testsuite platform allow list"), ("toolchain_exclude", ['zephyr'], None, None, "In test case toolchain exclude"), ("platform_exclude", ['demo_board_2'], None, None, "In test case platform exclude"), ("arch_exclude", ['x86'], None, None, "In test case arch exclude"), @@ -174,12 +175,12 @@ def test_apply_filters_part1(class_testplan, all_testsuites_dict, platforms_list elif plat_attribute == "supported_toolchains": plan.apply_filters(force_toolchain=False, exclude_platform=['demo_board_1'], - platform=['demo_board_2']) + platform=['demo_board_2/unit_testing']) elif tc_attribute is None and plat_attribute is None: plan.apply_filters() else: plan.apply_filters(exclude_platform=['demo_board_1'], - platform=['demo_board_2']) + platform=['demo_board_2/unit_testing']) filtered_instances = list(filter(lambda item: item.status == TwisterStatus.FILTER, plan.instances.values())) for d in filtered_instances: @@ -277,11 +278,11 @@ def test_add_instances_short(tmp_path, class_env, all_testsuites_dict, platforms } QUARANTINE_WITH_REGEXP = { - 'demo_board_2/scripts/tests/twister/test_data/testsuites/tests/test_a/test_a.check_2' : 'a2 and c2 on x86', - 'demo_board_1/scripts/tests/twister/test_data/testsuites/tests/test_d/test_d.check_1' : 'all test_d', - 'demo_board_3/scripts/tests/twister/test_data/testsuites/tests/test_d/test_d.check_1' : 'all test_d', - 'demo_board_2/scripts/tests/twister/test_data/testsuites/tests/test_d/test_d.check_1' : 'all test_d', - 'demo_board_2/scripts/tests/twister/test_data/testsuites/tests/test_c/test_c.check_2' : 'a2 and c2 on x86' + 'demo_board_2/unit_testing/scripts/tests/twister/test_data/testsuites/tests/test_a/test_a.check_2' : 'a2 and c2 on x86', + 'demo_board_1/unit_testing/scripts/tests/twister/test_data/testsuites/tests/test_d/test_d.check_1' : 'all test_d', + 'demo_board_3/unit_testing/scripts/tests/twister/test_data/testsuites/tests/test_d/test_d.check_1' : 'all test_d', + 'demo_board_2/unit_testing/scripts/tests/twister/test_data/testsuites/tests/test_d/test_d.check_1' : 'all test_d', + 'demo_board_2/unit_testing/scripts/tests/twister/test_data/testsuites/tests/test_c/test_c.check_2' : 'a2 and c2 on x86' } QUARANTINE_PLATFORM = { @@ -335,7 +336,6 @@ def test_quarantine_short(class_testplan, platforms_list, test_data, class_testplan.quarantine = Quarantine(quarantine_list) class_testplan.options.quarantine_verify = quarantine_verify class_testplan.apply_filters() - for testname, instance in class_testplan.instances.items(): if quarantine_verify: if testname in expected_val: @@ -380,11 +380,10 @@ def test_required_snippets_short( 'testsuites', 'tests', testpath) testsuite = class_testplan.testsuites.get(testpath) plan.platforms = platforms_list + print(platforms_list) plan.platform_names = [p.name for p in platforms_list] plan.testsuites = {testpath: testsuite} - print(plan.testsuites) - for _, testcase in plan.testsuites.items(): testcase.exclude_platform = [] testcase.required_snippets = required_snippets @@ -739,6 +738,18 @@ def test_testplan_load( testplan.platforms[9].name = 'lt-p2' testplan.platforms[10].name = 'lt-p3' testplan.platforms[11].name = 'lt-p4' + testplan.platforms[0].aliases = ['t-p1'] + testplan.platforms[1].aliases = ['t-p2'] + testplan.platforms[2].aliases = ['t-p3'] + testplan.platforms[3].aliases = ['t-p4'] + testplan.platforms[4].aliases = ['ts-p1'] + testplan.platforms[5].aliases = ['ts-p2'] + testplan.platforms[6].aliases = ['ts-p3'] + testplan.platforms[7].aliases = ['ts-p4'] + testplan.platforms[8].aliases = ['lt-p1'] + testplan.platforms[9].aliases = ['lt-p2'] + testplan.platforms[10].aliases = ['lt-p3'] + testplan.platforms[11].aliases = ['lt-p4'] testplan.platforms[0].normalized_name = 't-p1' testplan.platforms[1].normalized_name = 't-p2' testplan.platforms[2].normalized_name = 't-p3' @@ -1071,26 +1082,24 @@ def test_testplan_info(capfd): TESTDATA_8 = [ - (False, False, ['p1e2', 'p2', 'p3', 'p3@B'], ['p2']), - (False, True, None, None), - (True, False, ['p1e2', 'p2', 'p3', 'p3@B'], ['p3']), + (False, ['p1e2/unit_testing', 'p2/unit_testing', 'p3/unit_testing'], ['p2/unit_testing', 'p3/unit_testing']), + (True, ['p1e2/unit_testing', 'p2/unit_testing', 'p3/unit_testing'], ['p3/unit_testing']), ] @pytest.mark.parametrize( - 'override_default_platforms, create_duplicate, expected_platform_names, expected_defaults', + 'override_default_platforms, expected_platform_names, expected_defaults', TESTDATA_8, - ids=['no override defaults', 'create duplicate', 'override defaults'] + ids=['no override defaults', 'override defaults'] ) def test_testplan_add_configurations( tmp_path, override_default_platforms, - create_duplicate, expected_platform_names, expected_defaults ): # tmp_path # └ boards <- board root - # ├ x86 + # ├ zephyr # │ ├ p1 # │ | ├ p1e1.yaml # │ | └ p1e2.yaml @@ -1102,24 +1111,43 @@ def test_testplan_add_configurations( # └ p3 # ├ p3.yaml # └ p3_B.conf + tmp_soc_root_dir = tmp_path / 'soc' + tmp_soc_root_dir.mkdir() + + tmp_vend1_dir = tmp_soc_root_dir / 'zephyr' + tmp_vend1_dir.mkdir() + + tmp_soc1_dir = tmp_vend1_dir / 's1' + tmp_soc1_dir.mkdir() + + soc1_yaml = """\ +family: + - name: zephyr + series: + - name: zephyr_testing + socs: + - name: unit_testing +""" + soc1_yamlfile = tmp_soc1_dir / 'soc.yml' + soc1_yamlfile.write_text(soc1_yaml) tmp_board_root_dir = tmp_path / 'boards' tmp_board_root_dir.mkdir() - tmp_arch1_dir = tmp_board_root_dir / 'x86' - tmp_arch1_dir.mkdir() + tmp_vend1_dir = tmp_board_root_dir / 'zephyr' + tmp_vend1_dir.mkdir() - tmp_p1_dir = tmp_arch1_dir / 'p1' + tmp_p1_dir = tmp_vend1_dir / 'p1' tmp_p1_dir.mkdir() p1e1_bs_yaml = """\ boards: - - name: ple1 + - name: p1e1 vendor: zephyr socs: - name: unit_testing - - name: ple2 + - name: p1e2 vendor: zephyr socs: - name: unit_testing @@ -1132,7 +1160,7 @@ def test_testplan_add_configurations( name: Platform 1 Edition 1 type: native arch: x86 -vendor: vendor1 +vendor: zephyr toolchain: - zephyr twister: False @@ -1145,14 +1173,14 @@ def test_testplan_add_configurations( name: Platform 1 Edition 2 type: native arch: x86 -vendor: vendor1 +vendor: zephyr toolchain: - zephyr """ p1e2_yamlfile = tmp_p1_dir / 'p1e2.yaml' p1e2_yamlfile.write_text(p1e2_yaml) - tmp_p2_dir = tmp_arch1_dir / 'p2' + tmp_p2_dir = tmp_vend1_dir / 'p2' tmp_p2_dir.mkdir() p2_bs_yaml = """\ @@ -1171,7 +1199,7 @@ def test_testplan_add_configurations( p2_yamlfile.write_text(p2_bs_yaml) p2_yaml = """\ -identifier: p2 +identifier: p2/unit_testing name: Platform 2 type: sim arch: x86 @@ -1184,9 +1212,6 @@ def test_testplan_add_configurations( p2_yamlfile = tmp_p2_dir / 'p2.yaml' p2_yamlfile.write_text(p2_yaml) - if create_duplicate: - p2_yamlfile = tmp_p2_dir / 'p2-1.yaml' - p2_yamlfile.write_text(p2_yaml) p2_2_yaml = """\ testing: @@ -1202,15 +1227,14 @@ def test_testplan_add_configurations( p2_2_yamlfile = tmp_p2_dir / 'p2-2.yaml' p2_2_yamlfile.write_text(p2_2_yaml) - tmp_arch2_dir = tmp_board_root_dir / 'arm' - tmp_arch2_dir.mkdir() + tmp_vend2_dir = tmp_board_root_dir / 'arm' + tmp_vend2_dir.mkdir() - tmp_p3_dir = tmp_arch2_dir / 'p3' + tmp_p3_dir = tmp_vend2_dir / 'p3' tmp_p3_dir.mkdir() p3_bs_yaml = """\ boards: - - name: p3 vendor: zephyr socs: @@ -1227,11 +1251,11 @@ def test_testplan_add_configurations( vendor: vendor3 toolchain: - zephyr +testing: + default: True """ p3_yamlfile = tmp_p3_dir / 'p3.yaml' p3_yamlfile.write_text(p3_yaml) - p3_yamlfile = tmp_p3_dir / 'p3_B.conf' - p3_yamlfile.write_text('') env = mock.Mock(board_roots=[tmp_board_root_dir],soc_roots=[tmp_path], arch_roots=[tmp_path]) @@ -1244,13 +1268,18 @@ def test_testplan_add_configurations( } } - with pytest.raises(Exception) if create_duplicate else nullcontext(): - testplan.add_configurations() + + testplan.add_configurations() if expected_defaults is not None: + print(expected_defaults) + print(testplan.default_platforms) assert sorted(expected_defaults) == sorted(testplan.default_platforms) if expected_platform_names is not None: - assert sorted(expected_platform_names) == sorted(testplan.platform_names) + print(expected_platform_names) + print(testplan.platform_names) + platform_names = [p.name for p in testplan.platforms] + assert sorted(expected_platform_names) == sorted(platform_names) def test_testplan_get_all_tests(): @@ -1404,8 +1433,10 @@ def test_testplan_get_platform(name, expect_found): testplan = TestPlan(env=mock.Mock()) p1 = mock.Mock() p1.name = 'some platform' + p1.aliases = [p1.name] p2 = mock.Mock() p2.name = 'a platform' + p2.aliases = [p2.name] testplan.platforms = [p1, p2] res = testplan.get_platform(name) @@ -1639,7 +1670,7 @@ def get_platform(name): assert expected_instances[n]['testcases'][str(t)]['duration'] == t.duration assert expected_instances[n]['testcases'][str(t)]['output'] == t.output - check_runnable_mock.assert_called_with(mock.ANY, expected_tfilter, mock.ANY, mock.ANY) + check_runnable_mock.assert_called_with(mock.ANY, mock.ANY) expected_logs = [ 'loading TestSuite 1...', diff --git a/scripts/tests/twister_blackbox/test_addon.py b/scripts/tests/twister_blackbox/test_addon.py index 27cb73a4c69da..ecd34501b73cb 100644 --- a/scripts/tests/twister_blackbox/test_addon.py +++ b/scripts/tests/twister_blackbox/test_addon.py @@ -106,7 +106,7 @@ def test_enable_lsan(self, out_path, lsan_flags, expected_exit_value): def test_enable_asan(self, capfd, out_path, asan_flags, expected_exit_value, expect_asan): test_platforms = ['native_sim'] test_path = os.path.join(TEST_DATA, 'tests', 'san', 'asan') - args = ['-i', '--outdir', out_path, '-T', test_path] + \ + args = ['-i', '-W', '--outdir', out_path, '-T', test_path] + \ asan_flags + \ [] + \ [val for pair in zip( diff --git a/scripts/tests/twister_blackbox/test_config.py b/scripts/tests/twister_blackbox/test_config.py index 98119f6d5e822..c05d18cdaa780 100644 --- a/scripts/tests/twister_blackbox/test_config.py +++ b/scripts/tests/twister_blackbox/test_config.py @@ -79,9 +79,10 @@ def test_level(self, out_path, level, expected_tests): with mock.patch.object(sys, 'argv', [sys.argv[0]] + args), \ pytest.raises(SystemExit) as sys_exit: self.loader.exec_module(self.twister_module) - + import pprint with open(os.path.join(out_path, 'testplan.json')) as f: j = json.load(f) + pprint.pprint(j) filtered_j = [ (ts['platform'], ts['name'], tc['identifier']) \ for ts in j['testsuites'] \ diff --git a/scripts/tests/twister_blackbox/test_data/boards/others/dummy_board/board.yml b/scripts/tests/twister_blackbox/test_data/boards/others/dummy_board/board.yml index fb3335ab0d584..a139d44b95fc3 100644 --- a/scripts/tests/twister_blackbox/test_data/boards/others/dummy_board/board.yml +++ b/scripts/tests/twister_blackbox/test_data/boards/others/dummy_board/board.yml @@ -2,4 +2,4 @@ board: name: dummy vendor: others socs: - - name: dummy_soc + - name: unit_testing diff --git a/scripts/tests/twister_blackbox/test_data/boards/others/dummy_board/dummy_board.yaml b/scripts/tests/twister_blackbox/test_data/boards/others/dummy_board/dummy_board.yaml index 2138eac274303..323dd66339b4c 100644 --- a/scripts/tests/twister_blackbox/test_data/boards/others/dummy_board/dummy_board.yaml +++ b/scripts/tests/twister_blackbox/test_data/boards/others/dummy_board/dummy_board.yaml @@ -1,4 +1,4 @@ name: dummy_board vendor: others arch: unit -identifier: dummy_board/dummy_soc +identifier: dummy/unit_testing diff --git a/scripts/tests/twister_blackbox/test_data/twister-quarantine-list.yml b/scripts/tests/twister_blackbox/test_data/twister-quarantine-list.yml index c957f55ddefcf..dc2ed72bed69d 100644 --- a/scripts/tests/twister_blackbox/test_data/twister-quarantine-list.yml +++ b/scripts/tests/twister_blackbox/test_data/twister-quarantine-list.yml @@ -4,13 +4,13 @@ test all platforms - platforms: - - intel_adl_crb + - intel_adl_crb/alder_lake comment: > test intel_adl_crb - scenarios: - dummy.agnostic.group1.subgroup2 platforms: - - qemu_x86_64 + - qemu_x86_64/atom comment: > test qemu_x86_64 diff --git a/scripts/tests/twister_blackbox/test_filter.py b/scripts/tests/twister_blackbox/test_filter.py index 3991c0c938b94..90ea95e643075 100644 --- a/scripts/tests/twister_blackbox/test_filter.py +++ b/scripts/tests/twister_blackbox/test_filter.py @@ -23,50 +23,47 @@ class TestFilter: ( 'x86', [ - r'(it8xxx2_evb).*?(SKIPPED: Command line testsuite arch filter)', - r'(DEBUG\s+- adding qemu_x86)', + r'(it8xxx2_evb/it81302bx).*?(SKIPPED: Command line testsuite arch filter)', ], ), ( 'arm', [ - r'(it8xxx2_evb).*?(SKIPPED: Command line testsuite arch filter)', - r'(qemu_x86).*?(SKIPPED: Command line testsuite arch filter)', - r'(hsdk).*?(SKIPPED: Command line testsuite arch filter)', + r'(it8xxx2_evb/it81302bx).*?(SKIPPED: Command line testsuite arch filter)', + r'(qemu_x86/atom).*?(SKIPPED: Command line testsuite arch filter)', + r'(hsdk/arc_hsdk).*?(SKIPPED: Command line testsuite arch filter)', ] ), ( 'riscv', [ - r'(qemu_x86).*?(SKIPPED: Command line testsuite arch filter)', - r'(hsdk).*?(SKIPPED: Command line testsuite arch filter)', - r'(DEBUG\s+- adding it8xxx2_evb)' - ] + r'(qemu_x86/atom).*?(SKIPPED: Command line testsuite arch filter)', + r'(hsdk/arc_hsdk).*?(SKIPPED: Command line testsuite arch filter)', ] ) ] TESTDATA_2 = [ ( 'nxp', [ - r'(it8xxx2_evb).*?(SKIPPED: Not a selected vendor platform)', - r'(hsdk).*?(SKIPPED: Not a selected vendor platform)', + r'(it8xxx2_evb/it81302bx).*?(SKIPPED: Not a selected vendor platform)', + r'(hsdk/arc_hsdk).*?(SKIPPED: Not a selected vendor platform)', r'(qemu_x86).*?(SKIPPED: Not a selected vendor platform)', ], ), ( 'intel', [ - r'(it8xxx2_evb).*?(SKIPPED: Not a selected vendor platform)', - r'(qemu_x86).*?(SKIPPED: Not a selected vendor platform)', + r'(it8xxx2_evb/it81302bx).*?(SKIPPED: Not a selected vendor platform)', + r'(qemu_x86/atom).*?(SKIPPED: Not a selected vendor platform)', r'(DEBUG\s+- adding intel_adl_crb)' ] ), ( 'ite', [ - r'(qemu_x86).*?(SKIPPED: Not a selected vendor platform)', - r'(intel_adl_crb).*?(SKIPPED: Not a selected vendor platform)', - r'(hsdk).*?(SKIPPED: Not a selected vendor platform)', + r'(qemu_x86/atom).*?(SKIPPED: Not a selected vendor platform)', + r'(intel_adl_crb/alder_lake).*?(SKIPPED: Not a selected vendor platform)', + r'(hsdk/arc_hsdk).*?(SKIPPED: Not a selected vendor platform)', r'(DEBUG\s+- adding it8xxx2_evb)' ] ) @@ -208,6 +205,7 @@ def test_arch(self, capfd, out_path, arch, expected): assert str(sys_exit.value) == '0' for line in expected: + print(err) assert re.search(line, err) @pytest.mark.parametrize( diff --git a/scripts/tests/twister_blackbox/test_outfile.py b/scripts/tests/twister_blackbox/test_outfile.py index 6fedd630bed80..e2b0ac92a974d 100644 --- a/scripts/tests/twister_blackbox/test_outfile.py +++ b/scripts/tests/twister_blackbox/test_outfile.py @@ -96,7 +96,7 @@ def test_runtime_artifact_cleanup(self, out_path): assert str(sys_exit.value) == '0' relpath = os.path.relpath(path, ZEPHYR_BASE) - sample_path = os.path.join(out_path, 'qemu_x86', relpath, 'sample.basic.helloworld') + sample_path = os.path.join(out_path, 'qemu_x86_atom', relpath, 'sample.basic.helloworld') listdir = os.listdir(sample_path) zephyr_listdir = os.listdir(os.path.join(sample_path, 'zephyr')) @@ -121,7 +121,7 @@ def test_short_build_path(self, out_path): ) for val in pair] relative_test_path = os.path.relpath(path, ZEPHYR_BASE) - test_result_path = os.path.join(out_path, 'qemu_x86', + test_result_path = os.path.join(out_path, 'qemu_x86_atom', relative_test_path, 'dummy.agnostic.group2') with mock.patch.object(sys, 'argv', [sys.argv[0]] + args), \ @@ -133,7 +133,7 @@ def test_short_build_path(self, out_path): with open(os.path.join(out_path, 'twister.log')) as f: twister_log = f.read() - pattern_running = r'Running\s+cmake\s+on\s+(?P[\\\/].*)\s+for\s+qemu_x86\s*\n' + pattern_running = r'Running\s+cmake\s+on\s+(?P[\\\/].*)\s+for\s+qemu_x86/atom\s*\n' res_running = re.search(pattern_running, twister_log) assert res_running @@ -180,7 +180,7 @@ def test_prep_artifacts_for_testing(self, out_path): test_platforms = ['qemu_x86', 'intel_adl_crb'] path = os.path.join(TEST_DATA, 'samples', 'hello_world') relative_test_path = os.path.relpath(path, ZEPHYR_BASE) - zephyr_out_path = os.path.join(out_path, 'qemu_x86', relative_test_path, + zephyr_out_path = os.path.join(out_path, 'qemu_x86_atom', relative_test_path, 'sample.basic.helloworld', 'zephyr') args = ['-i', '--outdir', out_path, '-T', path] + \ ['--prep-artifacts-for-testing'] + \ diff --git a/scripts/tests/twister_blackbox/test_output.py b/scripts/tests/twister_blackbox/test_output.py index 5dc4a541191ef..def3703e85f60 100644 --- a/scripts/tests/twister_blackbox/test_output.py +++ b/scripts/tests/twister_blackbox/test_output.py @@ -91,7 +91,7 @@ def test_inline_logs(self, out_path): assert str(sys_exit.value) == '1' rel_path = os.path.relpath(path, ZEPHYR_BASE) - build_path = os.path.join(out_path, 'qemu_x86', rel_path, 'always_fail.dummy', 'build.log') + build_path = os.path.join(out_path, 'qemu_x86_atom', rel_path, 'always_fail.dummy', 'build.log') with open(build_path) as f: build_log = f.read() diff --git a/scripts/tests/twister_blackbox/test_platform.py b/scripts/tests/twister_blackbox/test_platform.py index b4c7071cb6c87..d9d3b145b6c19 100644 --- a/scripts/tests/twister_blackbox/test_platform.py +++ b/scripts/tests/twister_blackbox/test_platform.py @@ -81,7 +81,7 @@ def teardown_class(cls): ids=['dummy in additional board root', 'no additional board root, crash'] ) def test_board_root(self, out_path, board_root, expected_returncode): - test_platforms = ['qemu_x86', 'dummy_board/dummy_soc'] + test_platforms = ['qemu_x86', 'dummy/unit_testing'] board_root_path = os.path.join(TEST_DATA, 'boards') path = os.path.join(TEST_DATA, 'tests', 'dummy') args = ['-i', '--outdir', out_path, '-T', path, '-y'] + \ @@ -98,7 +98,7 @@ def test_board_root(self, out_path, board_root, expected_returncode): # but we need to differentiate crashes. with open(os.path.join(out_path, 'twister.log')) as f: log = f.read() - error_regex = r'ERROR.*platform_filter\s+-\s+unrecognized\s+platform\s+-\s+dummy_board/dummy_soc$' + error_regex = r'ERROR.*platform_filter\s+-\s+unrecognized\s+platform\s+-\s+dummy/unit_testing$' board_error = re.search(error_regex, log) assert board_error if not board_root else not board_error @@ -148,7 +148,7 @@ def test_platform(self, out_path): assert str(sys_exit.value) == '0' - assert all([platform == 'qemu_x86' for platform, _, _ in filtered_j]) + assert all([platform == 'qemu_x86/atom' for platform, _, _ in filtered_j]) @pytest.mark.parametrize( 'test_path, test_platforms', diff --git a/scripts/tests/twister_blackbox/test_printouts.py b/scripts/tests/twister_blackbox/test_printouts.py index ab64e17f85cda..3f65549b8ea9c 100644 --- a/scripts/tests/twister_blackbox/test_printouts.py +++ b/scripts/tests/twister_blackbox/test_printouts.py @@ -291,7 +291,7 @@ def test_size(self, capfd, out_path): capfd.readouterr() p = os.path.relpath(path, ZEPHYR_BASE) - prev_path = os.path.join(out_path, 'qemu_x86', p, + prev_path = os.path.join(out_path, 'qemu_x86_atom', p, 'sample.basic.helloworld', 'zephyr', 'zephyr.elf') args = ['--size', prev_path] diff --git a/scripts/tests/twister_blackbox/test_quarantine.py b/scripts/tests/twister_blackbox/test_quarantine.py index ad1c981bda7d2..404e0be2b07e2 100644 --- a/scripts/tests/twister_blackbox/test_quarantine.py +++ b/scripts/tests/twister_blackbox/test_quarantine.py @@ -89,9 +89,9 @@ def test_quarantine_list(self, capfd, out_path, test_path, test_platforms, quara sys.stdout.write(out) sys.stderr.write(err) - frdm_match = re.search('agnostic/group2/dummy.agnostic.group2 SKIPPED: Quarantine: test ' + board1_match1 = re.search('agnostic/group2/dummy.agnostic.group2 SKIPPED: Quarantine: test ' 'intel_adl_crb', err) - frdm_match2 = re.search( + board1_match2 = re.search( 'agnostic/group1/subgroup2/dummy.agnostic.group1.subgroup2 SKIPPED: Quarantine: test ' 'intel_adl_crb', err) @@ -112,8 +112,8 @@ def test_quarantine_list(self, capfd, out_path, test_path, test_platforms, quara 'all platforms', err) - assert frdm_match and frdm_match2, 'platform quarantine not work properly' - assert qemu_64_match, 'platform quarantine on scenario not work properly' + assert board1_match1 and board1_match2, 'platform quarantine not working properly' + assert qemu_64_match, 'platform quarantine on scenario not working properly' assert all_platforms_match and all_platforms_match2 and all_platforms_match3, 'scenario ' \ 'quarantine' \ ' not work ' \ diff --git a/scripts/tests/twister_blackbox/test_report.py b/scripts/tests/twister_blackbox/test_report.py index 523472c9e4341..2db1006bc5aa9 100644 --- a/scripts/tests/twister_blackbox/test_report.py +++ b/scripts/tests/twister_blackbox/test_report.py @@ -28,9 +28,9 @@ class TestReport: TESTDATA_1 = [ ( os.path.join(TEST_DATA, 'tests', 'dummy', 'agnostic'), - ['qemu_x86', 'mps2/an385'], + ['qemu_x86/atom', 'mps2/an385'], [ - 'qemu_x86.xml', 'mps2_an385.xml', + 'qemu_x86_atom.xml', 'mps2_an385.xml', 'testplan.json', 'twister.json', 'twister.log', 'twister_report.xml', 'twister_suite_report.xml', 'twister.xml' @@ -40,9 +40,9 @@ class TestReport: TESTDATA_2 = [ ( os.path.join(TEST_DATA, 'tests', 'dummy', 'agnostic'), - ['qemu_x86', 'mps2/an385'], + ['qemu_x86/atom', 'mps2/an385'], [ - 'mps2_an385_TEST.xml', 'qemu_x86_TEST.xml', + 'mps2_an385_TEST.xml', 'qemu_x86_atom_TEST.xml', 'twister_TEST.json', 'twister_TEST_report.xml', 'twister_TEST_suite_report.xml', 'twister_TEST.xml' ] @@ -51,7 +51,7 @@ class TestReport: TESTDATA_3 = [ ( os.path.join(TEST_DATA, 'tests', 'dummy', 'agnostic'), - ['qemu_x86', 'mps2/an385'], + ['qemu_x86/atom', 'mps2/an385'], ['--report-name', 'abcd'], [ 'abcd.json', 'abcd_report.xml', @@ -60,20 +60,20 @@ class TestReport: ), ( os.path.join(TEST_DATA, 'tests', 'dummy', 'agnostic'), - ['qemu_x86', 'mps2/an385'], + ['qemu_x86/atom', 'mps2/an385'], ['--report-name', '1234', '--platform-reports'], [ - 'mps2_an385.xml', 'qemu_x86.xml', + 'mps2_an385.xml', 'qemu_x86_atom.xml', '1234.json', '1234_report.xml', '1234_suite_report.xml', '1234.xml' ] ), ( os.path.join(TEST_DATA, 'tests', 'dummy', 'agnostic'), - ['qemu_x86', 'mps2/an385'], + ['qemu_x86/atom', 'mps2/an385'], ['--report-name', 'Final', '--platform-reports', '--report-suffix=Test'], [ - 'mps2_an385_Test.xml', 'qemu_x86_Test.xml', + 'mps2_an385_Test.xml', 'qemu_x86_atom_Test.xml', 'Final_Test.json', 'Final_Test_report.xml', 'Final_Test_suite_report.xml', 'Final_Test.xml' ] @@ -82,7 +82,7 @@ class TestReport: TESTDATA_4 = [ ( os.path.join(TEST_DATA, 'tests', 'dummy', 'agnostic'), - ['qemu_x86'], + ['qemu_x86/atom'], [ 'twister.json', 'twister_report.xml', 'twister_suite_report.xml', 'twister.xml' @@ -93,7 +93,7 @@ class TestReport: TESTDATA_5 = [ ( os.path.join(TEST_DATA, 'tests', 'dummy', 'agnostic'), - ['qemu_x86'], + ['qemu_x86/atom'], [ 'testplan.json', 'twister.log', 'twister.json', 'twister_report.xml', @@ -105,17 +105,17 @@ class TestReport: TESTDATA_6 = [ ( os.path.join(TEST_DATA, 'tests', 'dummy', 'agnostic'), - ['qemu_x86'], + ['qemu_x86/atom'], "TEST_LOG_FILE.log" ), ] TESTDATA_7 = [ ( os.path.join(TEST_DATA, 'tests', 'one_fail_two_error_one_pass'), - ['qemu_x86'], - [r'one_fail_two_error_one_pass.agnostic.group1.subgroup2 on qemu_x86 FAILED \(.*\)', - r'one_fail_two_error_one_pass.agnostic.group1.subgroup3 on qemu_x86 ERROR \(Build failure\)', - r'one_fail_two_error_one_pass.agnostic.group1.subgroup4 on qemu_x86 ERROR \(Build failure\)'], + ['qemu_x86/atom'], + [r'one_fail_two_error_one_pass.agnostic.group1.subgroup2 on qemu_x86/atom FAILED \(.*\)', + r'one_fail_two_error_one_pass.agnostic.group1.subgroup3 on qemu_x86/atom ERROR \(Build failure\)', + r'one_fail_two_error_one_pass.agnostic.group1.subgroup4 on qemu_x86/atom ERROR \(Build failure\)'], ) ] @@ -306,7 +306,7 @@ def test_outdir(self, capfd, test_path, test_platforms, file_name, dir_name): assert os.path.exists(path), 'file not found {f_name}' for f_platform in test_platforms: - platform_path = os.path.join(twister_path, f_platform) + platform_path = os.path.join(twister_path, f_platform.replace("/", "_")) assert os.path.exists(platform_path), f'file not found {f_platform}' assert str(sys_exit.value) == '0' @@ -350,18 +350,18 @@ def test_log_file(self, capfd, test_path, test_platforms, out_path, file_name): ( os.path.join(TEST_DATA, 'tests', 'dummy'), ['--detailed-skipped-report'], - {'qemu_x86': 5, 'intel_adl_crb': 1} + {'qemu_x86/atom': 5, 'intel_adl_crb/alder_lake': 1} ), ( os.path.join(TEST_DATA, 'tests', 'dummy'), ['--detailed-skipped-report', '--report-filtered'], - {'qemu_x86': 6, 'intel_adl_crb': 6} + {'qemu_x86/atom': 6, 'intel_adl_crb/alder_lake': 6} ), ], ids=['dummy tests', 'dummy tests with filtered'] ) def test_detailed_skipped_report(self, out_path, test_path, flags, expected_testcase_counts): - test_platforms = ['qemu_x86', 'intel_adl_crb'] + test_platforms = ['qemu_x86/atom', 'intel_adl_crb/alder_lake'] args = ['-i', '--outdir', out_path, '-T', test_path] + \ flags + \ [val for pair in zip( diff --git a/scripts/tests/twister_blackbox/test_runner.py b/scripts/tests/twister_blackbox/test_runner.py index 8fbed427d7391..e414e24fe25aa 100644 --- a/scripts/tests/twister_blackbox/test_runner.py +++ b/scripts/tests/twister_blackbox/test_runner.py @@ -43,7 +43,7 @@ class TestRunner: TESTDATA_2 = [ ( os.path.join(TEST_DATA, 'tests', 'dummy', 'agnostic'), - ['qemu_x86', 'qemu_x86_64', 'intel_adl_crb'], + ['qemu_x86/atom', 'qemu_x86_64/atom', 'intel_adl_crb/alder_lake'], { 'selected_test_scenarios': 3, 'selected_test_instances': 6, @@ -126,7 +126,7 @@ class TestRunner: TESTDATA_9 = [ ( os.path.join(TEST_DATA, 'tests', 'dummy'), - ['qemu_x86'], + ['qemu_x86/atom'], ['device'], ['dummy.agnostic.group2 SKIPPED: Command line testsuite tag filter', 'dummy.agnostic.group1.subgroup2 SKIPPED: Command line testsuite tag filter', @@ -136,7 +136,7 @@ class TestRunner: ), ( os.path.join(TEST_DATA, 'tests', 'dummy'), - ['qemu_x86'], + ['qemu_x86/atom'], ['subgrouped'], ['dummy.agnostic.group2 SKIPPED: Command line testsuite tag filter', r'1 of 4 test configurations passed \(50.00%\), 1 built \(not run\), 0 failed, 0 errored, 2 skipped' @@ -144,7 +144,7 @@ class TestRunner: ), ( os.path.join(TEST_DATA, 'tests', 'dummy'), - ['qemu_x86'], + ['qemu_x86/atom'], ['agnostic', 'device'], [r'2 of 4 test configurations passed \(66.67%\), 1 built \(not run\), 0 failed, 0 errored, 1 skipped'] ), @@ -152,7 +152,7 @@ class TestRunner: TESTDATA_10 = [ ( os.path.join(TEST_DATA, 'tests', 'one_fail_one_pass'), - ['qemu_x86'], + ['qemu_x86/atom'], { 'selected_test_instances': 2, 'skipped_configurations': 0, @@ -629,7 +629,7 @@ def test_only_failed(self, capfd, out_path, test_path, test_platforms, expected) assert re.search( - r'one_fail_one_pass.agnostic.group1.subgroup2 on qemu_x86 failed \(.*\)', err) + r'one_fail_one_pass.agnostic.group1.subgroup2 on qemu_x86/atom failed \(.*\)', err) pass_search = re.search(pass_regex, err, re.MULTILINE) diff --git a/scripts/tests/twister_blackbox/test_testplan.py b/scripts/tests/twister_blackbox/test_testplan.py index afada68906c52..915653a33e15e 100644 --- a/scripts/tests/twister_blackbox/test_testplan.py +++ b/scripts/tests/twister_blackbox/test_testplan.py @@ -31,7 +31,7 @@ class TestTestPlan: ] TESTDATA_2 = [ ('buildable', 6), - ('runnable', 5), + ('runnable', 4), ] TESTDATA_3 = [ (True, 1), @@ -101,14 +101,16 @@ def test_filter(self, out_path, filter, expected_count): self.loader.exec_module(self.twister_module) assert str(exc.value) == '0' - + import pprint with open(os.path.join(out_path, 'testplan.json')) as f: j = json.load(f) + pprint.pprint(j) filtered_j = [ (ts['platform'], ts['name'], tc['identifier']) \ for ts in j['testsuites'] \ for tc in ts['testcases'] if 'reason' not in tc ] + pprint.pprint(filtered_j) assert expected_count == len(filtered_j) From a93095626b3d7fe546d07fa4da517e7620683c9a Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Wed, 16 Oct 2024 12:07:17 +0900 Subject: [PATCH 1342/4482] tests: benchmarks: wait_queues: Increase test timeout to 120s This commit increases the test timeout for the wait queue benchmark tests to 120 seconds because these tests frequently hit the default timeout of 60 seconds during execution. Signed-off-by: Stephanos Ioannidis --- tests/benchmarks/wait_queues/testcase.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/benchmarks/wait_queues/testcase.yaml b/tests/benchmarks/wait_queues/testcase.yaml index a6fd1440b73ca..50fd4251fb66b 100644 --- a/tests/benchmarks/wait_queues/testcase.yaml +++ b/tests/benchmarks/wait_queues/testcase.yaml @@ -5,6 +5,7 @@ common: integration_platforms: - qemu_x86 - qemu_cortex_a53 + timeout: 120 harness: console harness_config: type: one_line From 974c7d4229aa750f3aa1de287c01bf7fc3c9dcdb Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Tue, 22 Oct 2024 11:11:15 +0900 Subject: [PATCH 1343/4482] ci: Switch to CI image v0.27.3 This commit updates the CI workflows to use the CI image v0.27.3, which includes Zephyr SDK 0.17.0. Signed-off-by: Stephanos Ioannidis --- .github/workflows/bsim-tests.yaml | 2 +- .github/workflows/clang.yaml | 2 +- .github/workflows/codecov.yaml | 2 +- .github/workflows/errno.yml | 2 +- .github/workflows/footprint-tracking.yml | 2 +- .github/workflows/twister.yaml | 4 ++-- .github/workflows/twister_tests_blackbox.yml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/bsim-tests.yaml b/.github/workflows/bsim-tests.yaml index 2654e8d4e442f..47c6aa86c275c 100644 --- a/.github/workflows/bsim-tests.yaml +++ b/.github/workflows/bsim-tests.yaml @@ -37,7 +37,7 @@ jobs: runs-on: group: zephyr-runner-v2-linux-x64-4xlarge container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.26.14.20240823 + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.3.20241022 options: '--entrypoint /bin/bash' env: ZEPHYR_TOOLCHAIN_VARIANT: zephyr diff --git a/.github/workflows/clang.yaml b/.github/workflows/clang.yaml index ac1c26f552fd4..8e1d51ca05e84 100644 --- a/.github/workflows/clang.yaml +++ b/.github/workflows/clang.yaml @@ -12,7 +12,7 @@ jobs: runs-on: group: zephyr-runner-v2-linux-x64-4xlarge container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.26.14.20240823 + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.3.20241022 options: '--entrypoint /bin/bash' strategy: fail-fast: false diff --git a/.github/workflows/codecov.yaml b/.github/workflows/codecov.yaml index aa81056cdfd37..834ec8505e376 100644 --- a/.github/workflows/codecov.yaml +++ b/.github/workflows/codecov.yaml @@ -14,7 +14,7 @@ jobs: runs-on: group: zephyr-runner-v2-linux-x64-4xlarge container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.26.14.20240823 + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.3.20241022 options: '--entrypoint /bin/bash' strategy: fail-fast: false diff --git a/.github/workflows/errno.yml b/.github/workflows/errno.yml index b1f7e6f4e6250..c70368ade305f 100644 --- a/.github/workflows/errno.yml +++ b/.github/workflows/errno.yml @@ -10,7 +10,7 @@ jobs: check-errno: runs-on: ubuntu-22.04 container: - image: ghcr.io/zephyrproject-rtos/ci:v0.26.13 + image: ghcr.io/zephyrproject-rtos/ci:v0.27.3 steps: - name: Apply container owner mismatch workaround diff --git a/.github/workflows/footprint-tracking.yml b/.github/workflows/footprint-tracking.yml index dc3d9974952e1..91b19462379cd 100644 --- a/.github/workflows/footprint-tracking.yml +++ b/.github/workflows/footprint-tracking.yml @@ -26,7 +26,7 @@ jobs: group: zephyr-runner-v2-linux-x64-4xlarge if: github.repository_owner == 'zephyrproject-rtos' container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.26.14.20240823 + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.3.20241022 options: '--entrypoint /bin/bash' defaults: run: diff --git a/.github/workflows/twister.yaml b/.github/workflows/twister.yaml index b0b8701adf18c..8f940ce11c625 100644 --- a/.github/workflows/twister.yaml +++ b/.github/workflows/twister.yaml @@ -25,7 +25,7 @@ jobs: runs-on: group: zephyr-runner-v2-linux-x64-4xlarge container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.26.14.20240823 + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.3.20241022 options: '--entrypoint /bin/bash' outputs: subset: ${{ steps.output-services.outputs.subset }} @@ -130,7 +130,7 @@ jobs: needs: twister-build-prep if: needs.twister-build-prep.outputs.size != 0 container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.26.14.20240823 + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.3.20241022 options: '--entrypoint /bin/bash' strategy: fail-fast: false diff --git a/.github/workflows/twister_tests_blackbox.yml b/.github/workflows/twister_tests_blackbox.yml index 76e8c842a6365..0e36630d0928c 100644 --- a/.github/workflows/twister_tests_blackbox.yml +++ b/.github/workflows/twister_tests_blackbox.yml @@ -24,7 +24,7 @@ jobs: python-version: ['3.10', '3.11', '3.12', '3.13'] os: [ubuntu-22.04] container: - image: ghcr.io/zephyrproject-rtos/ci:v0.26.13 + image: ghcr.io/zephyrproject-rtos/ci:v0.27.3 steps: - name: Apply Container Owner Mismatch Workaround From 6b928de90c3d1d7251407860247b1351a3ca7fba Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Tue, 22 Oct 2024 11:11:56 +0900 Subject: [PATCH 1344/4482] SDK_VERSION: Use Zephyr SDK 0.17.0 This commit updates ZEPHYR_SDK to point to the Zephyr SDK 0.17.0 release. Signed-off-by: Stephanos Ioannidis --- SDK_VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SDK_VERSION b/SDK_VERSION index 74aaa3f38cfe8..c5523bd09b187 100644 --- a/SDK_VERSION +++ b/SDK_VERSION @@ -1 +1 @@ -0.16.8 +0.17.0 From 52d98498bc1786f1ab9fee672e81a44e8e7d16a0 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 22 Oct 2024 13:06:40 -0500 Subject: [PATCH 1345/4482] drivers: input: gt911: always set INT pin during probe Even in cases where the alt-addr is set, we can still use the INT pin during probe. Some boards require this, as if a reset GPIO is not defined the INT pin may still need to be toggled in order to initialize the GT911 IC correctly. Signed-off-by: Daniel DeGrasse --- drivers/input/input_gt911.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/input/input_gt911.c b/drivers/input/input_gt911.c index 722d89bf2977d..3b021032cf73e 100644 --- a/drivers/input/input_gt911.c +++ b/drivers/input/input_gt911.c @@ -272,19 +272,19 @@ static int gt911_init(const struct device *dev) } } - if (config->alt_addr == 0x0) { - /* - * We need to configure the int-pin to 0, in order to enter the - * AddressMode0. Keeping the INT pin low during the reset sequence - * should result in the device selecting an I2C address of 0x5D. - * Note we skip this step if an alternate I2C address is set, - * and fall through to probing for the actual address. - */ - r = gpio_pin_configure_dt(&config->int_gpio, GPIO_OUTPUT_INACTIVE); - if (r < 0) { - LOG_ERR("Could not configure int GPIO pin"); - return r; - } + /* + * We need to configure the int-pin to 0, in order to enter the + * AddressMode0. Keeping the INT pin low during the reset sequence + * should result in the device selecting an I2C address of 0x5D. + * Note that if an alternate I2C address is set, we will probe + * for the alternate address if 0x5D does not work. This is useful + * for boards that do not route the INT pin, or only permit it + * to be used as an input + */ + r = gpio_pin_configure_dt(&config->int_gpio, GPIO_OUTPUT_INACTIVE); + if (r < 0) { + LOG_ERR("Could not configure int GPIO pin"); + return r; } /* Delay at least 10 ms after power on before we configure gt911 */ k_sleep(K_MSEC(20)); From e8a2832beb31de975b966c0938af01c469ebb92c Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Thu, 17 Oct 2024 15:21:09 +0000 Subject: [PATCH 1346/4482] drivers: flash: flash_mcux_flexspi_nor: store probe lut in .data Move the LUT used for probing to be stored in .data, instead of on the stack. This reduces stack usage during probe by 192 bytes, which avoids stack overflows that were occurring on some platforms. Signed-off-by: Daniel DeGrasse --- drivers/flash/flash_mcux_flexspi_nor.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/flash/flash_mcux_flexspi_nor.c b/drivers/flash/flash_mcux_flexspi_nor.c index 175e75554f24a..d971e0b243bf1 100644 --- a/drivers/flash/flash_mcux_flexspi_nor.c +++ b/drivers/flash/flash_mcux_flexspi_nor.c @@ -79,6 +79,12 @@ struct flash_flexspi_nor_data { struct flash_parameters flash_parameters; }; +/* + * FLEXSPI LUT buffer used during configuration. Stored in .data to avoid + * using too much stack + */ +static uint32_t flexspi_probe_lut[FLEXSPI_INSTR_END][MEMC_FLEXSPI_CMD_PER_SEQ] = {0}; + /* Initial LUT table */ static const uint32_t flash_flexspi_nor_base_lut[][MEMC_FLEXSPI_CMD_PER_SEQ] = { /* 1S-1S-1S flash read command, should be compatible with all SPI nor flashes */ @@ -924,7 +930,6 @@ static int flash_flexspi_nor_check_jedec(struct flash_flexspi_nor_data *data, /* Probe parameters from flash SFDP header, and use them to configure the FlexSPI */ static int flash_flexspi_nor_probe(struct flash_flexspi_nor_data *data) { - uint32_t flexspi_lut[FLEXSPI_INSTR_END][MEMC_FLEXSPI_CMD_PER_SEQ] = {0}; /* JESD216B defines up to 23 basic flash parameters */ uint32_t param_buf[23]; /* Space to store SFDP header and first parameter header */ @@ -959,10 +964,11 @@ static int flash_flexspi_nor_probe(struct flash_flexspi_nor_data *data) } /* Setup initial LUT table and FlexSPI configuration */ - memcpy(flexspi_lut, flash_flexspi_nor_base_lut, sizeof(flash_flexspi_nor_base_lut)); + memcpy(flexspi_probe_lut, flash_flexspi_nor_base_lut, + sizeof(flash_flexspi_nor_base_lut)); ret = memc_flexspi_set_device_config(&data->controller, &config, - (uint32_t *)flexspi_lut, + (uint32_t *)flexspi_probe_lut, FLEXSPI_INSTR_END * MEMC_FLEXSPI_CMD_PER_SEQ, data->port); if (ret < 0) { @@ -972,7 +978,7 @@ static int flash_flexspi_nor_probe(struct flash_flexspi_nor_data *data) /* First, check if the JEDEC ID of this flash has explicit support * in this driver */ - ret = flash_flexspi_nor_check_jedec(data, flexspi_lut); + ret = flash_flexspi_nor_check_jedec(data, flexspi_probe_lut); if (ret == 0) { /* Flash was supported, SFDP probe not needed */ goto _program_lut; @@ -1007,7 +1013,8 @@ static int flash_flexspi_nor_probe(struct flash_flexspi_nor_data *data) } /* Configure flash */ - ret = flash_flexspi_nor_config_flash(data, header, bfp, flexspi_lut); + ret = flash_flexspi_nor_config_flash(data, header, bfp, + flexspi_probe_lut); if (ret < 0) { goto _exit; } @@ -1018,7 +1025,7 @@ static int flash_flexspi_nor_probe(struct flash_flexspi_nor_data *data) * from devicetree and the configured LUT */ ret = memc_flexspi_set_device_config(&data->controller, &data->config, - (uint32_t *)flexspi_lut, + (uint32_t *)flexspi_probe_lut, FLEXSPI_INSTR_PROG_END * MEMC_FLEXSPI_CMD_PER_SEQ, data->port); if (ret < 0) { From 966b4339ee98bb72fd738cabb3c2c2078cf803a8 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Thu, 17 Oct 2024 15:25:52 +0000 Subject: [PATCH 1347/4482] drivers: flash: flash_mcux_flexspi_nor: fix quad enable sequence Writing the quad enable bit on flash chips typically requires a write enable instruction be issued before writing the non-volatile status register, and the flash may remain busy briefly after programming this bit. Add code to send the WREN instruction, and to wait for the flash to finish programming after writing the status register. Signed-off-by: Daniel DeGrasse --- drivers/flash/flash_mcux_flexspi_nor.c | 53 ++++++++++++++++---------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/drivers/flash/flash_mcux_flexspi_nor.c b/drivers/flash/flash_mcux_flexspi_nor.c index d971e0b243bf1..48f2dbbf6fbc7 100644 --- a/drivers/flash/flash_mcux_flexspi_nor.c +++ b/drivers/flash/flash_mcux_flexspi_nor.c @@ -591,11 +591,22 @@ static int flash_flexspi_nor_quad_enable(struct flash_flexspi_nor_data *data, if (ret < 0) { return ret; } + /* Enable write */ + ret = flash_flexspi_nor_write_enable(data); + if (ret < 0) { + return ret; + } buffer |= bit; transfer.dataSize = wr_size; transfer.seqIndex = SCRATCH_CMD2; transfer.cmdType = kFLEXSPI_Write; - return memc_flexspi_transfer(&data->controller, &transfer); + ret = memc_flexspi_transfer(&data->controller, &transfer); + if (ret < 0) { + return ret; + } + + /* Wait for QE bit to complete programming */ + return flash_flexspi_nor_wait_bus_busy(data); } /* @@ -721,6 +732,26 @@ static int flash_flexspi_nor_config_flash(struct flash_flexspi_nor_data *data, uint8_t mode_cmd; int ret; + /* Read DW14 to determine the polling method we should use while programming */ + ret = jesd216_bfp_decode_dw14(&header->phdr[0], bfp, &dw14); + if (ret < 0) { + /* Default to legacy polling mode */ + dw14.poll_options = 0x0; + } + if (dw14.poll_options & BIT(1)) { + /* Read instruction used for polling is 0x70 */ + data->legacy_poll = false; + flexspi_lut[READ_STATUS_REG][0] = FLEXSPI_LUT_SEQ( + kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x70, + kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x01); + } else { + /* Read instruction used for polling is 0x05 */ + data->legacy_poll = true; + flexspi_lut[READ_STATUS_REG][0] = FLEXSPI_LUT_SEQ( + kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, SPI_NOR_CMD_RDSR, + kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x01); + } + addr_width = jesd216_bfp_addrbytes(bfp) == JESD216_SFDP_BFP_DW1_ADDRBYTES_VAL_4B ? 32 : 24; @@ -824,26 +855,6 @@ static int flash_flexspi_nor_config_flash(struct flash_flexspi_nor_data *data, } /* Default to 111 mode if no support exists, leave READ/WRITE untouched */ - /* Now, read DW14 to determine the polling method we should use while programming */ - ret = jesd216_bfp_decode_dw14(&header->phdr[0], bfp, &dw14); - if (ret < 0) { - /* Default to legacy polling mode */ - dw14.poll_options = 0x0; - } - if (dw14.poll_options & BIT(1)) { - /* Read instruction used for polling is 0x70 */ - data->legacy_poll = false; - flexspi_lut[READ_STATUS_REG][0] = FLEXSPI_LUT_SEQ( - kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x70, - kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x01); - } else { - /* Read instruction used for polling is 0x05 */ - data->legacy_poll = true; - flexspi_lut[READ_STATUS_REG][0] = FLEXSPI_LUT_SEQ( - kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, SPI_NOR_CMD_RDSR, - kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x01); - } - return 0; } From c410b020b524e9ccfed9847822f5787e4570e49e Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Wed, 16 Oct 2024 16:22:19 -0500 Subject: [PATCH 1348/4482] drivers: flash: flash_mcux_flexspi: fix support for QE method 5 Quad enable method 5 reads status register 2 (one byte), but then writes to 2 bytes to the status registers, so we need to shift the output buffer in order to manage this correctly. Signed-off-by: Daniel DeGrasse --- drivers/flash/flash_mcux_flexspi_nor.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/flash/flash_mcux_flexspi_nor.c b/drivers/flash/flash_mcux_flexspi_nor.c index 48f2dbbf6fbc7..7e08e30bb2a73 100644 --- a/drivers/flash/flash_mcux_flexspi_nor.c +++ b/drivers/flash/flash_mcux_flexspi_nor.c @@ -596,6 +596,10 @@ static int flash_flexspi_nor_quad_enable(struct flash_flexspi_nor_data *data, if (ret < 0) { return ret; } + if (qer == JESD216_DW15_QER_VAL_S2B1v5) { + /* Left shift buffer by a byte */ + buffer = buffer << 8; + } buffer |= bit; transfer.dataSize = wr_size; transfer.seqIndex = SCRATCH_CMD2; From 7ca996234fae1c7a0a2bbbb40f4d65a845d499bd Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Thu, 17 Oct 2024 15:23:52 +0000 Subject: [PATCH 1349/4482] drivers: flash: flash_mcux_flexspi_nor: fix IS25WP flash support Some NXP boards program the read parameters bits (P[6:3]) within the IS25WP flash device during init, which will result in JESD216 probe commands failing (as the number of dummy cycles will be incorrect). Add handling to force these volatile bits to their default value to the flexspi flash driver. Signed-off-by: Daniel DeGrasse --- drivers/flash/flash_mcux_flexspi_nor.c | 56 ++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/drivers/flash/flash_mcux_flexspi_nor.c b/drivers/flash/flash_mcux_flexspi_nor.c index 7e08e30bb2a73..c92761d4bc5af 100644 --- a/drivers/flash/flash_mcux_flexspi_nor.c +++ b/drivers/flash/flash_mcux_flexspi_nor.c @@ -893,6 +893,43 @@ static int flash_flexspi_nor_sfdp_read(const struct device *dev, #endif +/* Helper to configure IS25 flash, by clearing read param bits */ +static int flash_flexspi_nor_is25_clear_read_param(struct flash_flexspi_nor_data *data, + uint32_t (*flexspi_lut)[MEMC_FLEXSPI_CMD_PER_SEQ], + uint32_t *read_params) +{ + int ret; + /* Install Set Read Parameters (Volatile) command */ + flexspi_transfer_t transfer = { + .deviceAddress = 0, + .port = data->port, + .seqIndex = SCRATCH_CMD, + .SeqNumber = 1, + .data = read_params, + .dataSize = 1, + .cmdType = kFLEXSPI_Write, + }; + flexspi_device_config_t config = { + .flexspiRootClk = MHZ(50), + .flashSize = FLEXSPI_FLSHCR0_FLSHSZ_MASK, /* Max flash size */ + .ARDSeqNumber = 1, + .ARDSeqIndex = READ, + }; + + flexspi_lut[SCRATCH_CMD][0] = FLEXSPI_LUT_SEQ( + kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0xC0, + kFLEXSPI_Command_WRITE_SDR, kFLEXSPI_1PAD, 0x1); + ret = memc_flexspi_set_device_config(&data->controller, + &config, + (uint32_t *)flexspi_lut, + FLEXSPI_INSTR_END * MEMC_FLEXSPI_CMD_PER_SEQ, + data->port); + if (ret < 0) { + return ret; + } + return memc_flexspi_transfer(&data->controller, &transfer); +} + /* Checks JEDEC ID of flash. If supported, installs custom LUT table */ static int flash_flexspi_nor_check_jedec(struct flash_flexspi_nor_data *data, uint32_t (*flexspi_lut)[MEMC_FLEXSPI_CMD_PER_SEQ]) @@ -907,6 +944,25 @@ static int flash_flexspi_nor_check_jedec(struct flash_flexspi_nor_data *data, /* Switch on manufacturer and vendor ID */ switch (vendor_id & 0xFFFF) { + case 0x709d: + /* + * IS25WP flash. We can support this flash with the JEDEC probe, + * but we need to insure P[6:3] are at the default value + */ + /* Install Set Read Parameters (Volatile) command */ + uint32_t read_params = 0; + ret = flash_flexspi_nor_is25_clear_read_param(data, flexspi_lut, &read_params); + if (ret < 0) { + while (1) { + /* + * Spin here, this flash won't configure correctly. + * We can't print a warning, as we are unlikely to + * be able to XIP at this point. + */ + } + } + /* Still return an error- we want the JEDEC configuration to run */ + return -ENOTSUP; case 0x25C2: /* MX25 flash, use 4 byte read/write */ flexspi_lut[READ][0] = FLEXSPI_LUT_SEQ( From 43b07894c36e50152c62c5280aff61b88aad054a Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Thu, 17 Oct 2024 15:31:48 +0000 Subject: [PATCH 1350/4482] boards: fix max frequency for IS25WP flash chips IS25WP flash chips support 133MHz only when P[6:3] is programmed, which will not occur during the SFDP probe sequence used in the FlexSPI nor driver. With the default P[6:3] value, the best frequency supported for read instruction 0xEB is 104MHz, so set this for all boards using this flash chip with the FlexSPI nor driver. Signed-off-by: Daniel DeGrasse --- boards/madmachine/mm_feather/mm_feather.dts | 2 +- boards/madmachine/mm_swiftio/mm_swiftio.dts | 2 +- boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts | 2 +- .../nxp/mimxrt1050_evk/mimxrt1050_evk_mimxrt1052_qspi.overlay | 2 +- .../nxp/mimxrt1060_evk/mimxrt1060_evk_mimxrt1062_qspi.overlay | 2 +- boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts | 2 +- boards/nxp/mimxrt1160_evk/mimxrt1160_evk.dtsi | 2 +- boards/nxp/mimxrt1170_evk/mimxrt1170_evk.dtsi | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/boards/madmachine/mm_feather/mm_feather.dts b/boards/madmachine/mm_feather/mm_feather.dts index 58aaac234bdeb..0b655edd1c292 100644 --- a/boards/madmachine/mm_feather/mm_feather.dts +++ b/boards/madmachine/mm_feather/mm_feather.dts @@ -61,7 +61,7 @@ compatible = "nxp,imx-flexspi-nor"; size = <67108864>; reg = <0>; - spi-max-frequency = <133000000>; + spi-max-frequency = <104000000>; status = "okay"; jedec-id = [9d 70 17]; }; diff --git a/boards/madmachine/mm_swiftio/mm_swiftio.dts b/boards/madmachine/mm_swiftio/mm_swiftio.dts index e4212cd8294c6..0ad825814d3d3 100644 --- a/boards/madmachine/mm_swiftio/mm_swiftio.dts +++ b/boards/madmachine/mm_swiftio/mm_swiftio.dts @@ -61,7 +61,7 @@ compatible = "nxp,imx-flexspi-nor"; size = <67108864>; reg = <0>; - spi-max-frequency = <133000000>; + spi-max-frequency = <104000000>; status = "okay"; jedec-id = [9d 70 17]; }; diff --git a/boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts b/boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts index fca8e6447a79f..64d99c5a8dd96 100644 --- a/boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts +++ b/boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts @@ -99,7 +99,7 @@ arduino_serial: &lpuart2 { compatible = "nxp,imx-flexspi-nor"; size = <67108864>; reg = <0>; - spi-max-frequency = <133000000>; + spi-max-frequency = <104000000>; status = "okay"; jedec-id = [9d 70 17]; erase-block-size = <4096>; diff --git a/boards/nxp/mimxrt1050_evk/mimxrt1050_evk_mimxrt1052_qspi.overlay b/boards/nxp/mimxrt1050_evk/mimxrt1050_evk_mimxrt1052_qspi.overlay index d18cda45c6025..4930433268aac 100644 --- a/boards/nxp/mimxrt1050_evk/mimxrt1050_evk_mimxrt1052_qspi.overlay +++ b/boards/nxp/mimxrt1050_evk/mimxrt1050_evk_mimxrt1052_qspi.overlay @@ -22,7 +22,7 @@ compatible = "nxp,imx-flexspi-nor"; size = <67108864>; reg = <0>; - spi-max-frequency = <133000000>; + spi-max-frequency = <104000000>; status = "okay"; jedec-id = [9d 70 17]; erase-block-size = <4096>; diff --git a/boards/nxp/mimxrt1060_evk/mimxrt1060_evk_mimxrt1062_qspi.overlay b/boards/nxp/mimxrt1060_evk/mimxrt1060_evk_mimxrt1062_qspi.overlay index 8a0abae2fb3ba..c76c2b020c68f 100644 --- a/boards/nxp/mimxrt1060_evk/mimxrt1060_evk_mimxrt1062_qspi.overlay +++ b/boards/nxp/mimxrt1060_evk/mimxrt1060_evk_mimxrt1062_qspi.overlay @@ -24,7 +24,7 @@ compatible = "nxp,imx-flexspi-nor"; size = <67108864>; reg = <0>; - spi-max-frequency = <133000000>; + spi-max-frequency = <104000000>; status = "okay"; jedec-id = [9d 70 17]; erase-block-size = <4096>; diff --git a/boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts b/boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts index f0ab1739079a2..1a3d76ce75341 100644 --- a/boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts +++ b/boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts @@ -164,7 +164,7 @@ nxp_parallel_i2c: &lpi2c1 {}; compatible = "nxp,imx-flexspi-nor"; size = <67108864>; reg = <0>; - spi-max-frequency = <133000000>; + spi-max-frequency = <104000000>; status = "okay"; jedec-id = [9d 70 17]; diff --git a/boards/nxp/mimxrt1160_evk/mimxrt1160_evk.dtsi b/boards/nxp/mimxrt1160_evk/mimxrt1160_evk.dtsi index 8f6c8b24787b9..575c605c2754b 100644 --- a/boards/nxp/mimxrt1160_evk/mimxrt1160_evk.dtsi +++ b/boards/nxp/mimxrt1160_evk/mimxrt1160_evk.dtsi @@ -95,7 +95,7 @@ compatible = "nxp,imx-flexspi-nor"; size = ; reg = <0>; - spi-max-frequency = <133000000>; + spi-max-frequency = <104000000>; status = "okay"; jedec-id = [9d 70 17]; erase-block-size = <4096>; diff --git a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk.dtsi b/boards/nxp/mimxrt1170_evk/mimxrt1170_evk.dtsi index bcc68761fb615..91286ab6fb3ae 100644 --- a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk.dtsi +++ b/boards/nxp/mimxrt1170_evk/mimxrt1170_evk.dtsi @@ -222,7 +222,7 @@ compatible = "nxp,imx-flexspi-nor"; size = ; reg = <0>; - spi-max-frequency = <133000000>; + spi-max-frequency = <104000000>; status = "okay"; jedec-id = [9d 70 17]; erase-block-size = <4096>; From e8e43b60eb6bb8efe1fdd191425be9eaa27c8389 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Thu, 17 Oct 2024 14:40:16 -0500 Subject: [PATCH 1351/4482] drivers: flash: flash_mcux_flexspi_nor: add IS25LP support IS25LP flash chips have a similar P[6:3] register to the IS25WP series, and need the same workaround. Signed-off-by: Daniel DeGrasse --- drivers/flash/flash_mcux_flexspi_nor.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/flash/flash_mcux_flexspi_nor.c b/drivers/flash/flash_mcux_flexspi_nor.c index c92761d4bc5af..4617b61ee4449 100644 --- a/drivers/flash/flash_mcux_flexspi_nor.c +++ b/drivers/flash/flash_mcux_flexspi_nor.c @@ -936,6 +936,7 @@ static int flash_flexspi_nor_check_jedec(struct flash_flexspi_nor_data *data, { int ret; uint32_t vendor_id; + uint32_t read_params; ret = flash_flexspi_nor_read_id_helper(data, (uint8_t *)&vendor_id); if (ret < 0) { @@ -944,13 +945,26 @@ static int flash_flexspi_nor_check_jedec(struct flash_flexspi_nor_data *data, /* Switch on manufacturer and vendor ID */ switch (vendor_id & 0xFFFF) { + case 0x609d: /* IS25LP flash, needs P[4:3] cleared with same method as IS25WP */ + read_params = 0xE0U; + ret = flash_flexspi_nor_is25_clear_read_param(data, flexspi_lut, &read_params); + if (ret < 0) { + while (1) { + /* + * Spin here, this flash won't configure correctly. + * We can't print a warning, as we are unlikely to + * be able to XIP at this point. + */ + } + } + /* Still return an error- we want the JEDEC configuration to run */ + return -ENOTSUP; case 0x709d: /* * IS25WP flash. We can support this flash with the JEDEC probe, * but we need to insure P[6:3] are at the default value */ - /* Install Set Read Parameters (Volatile) command */ - uint32_t read_params = 0; + read_params = 0; ret = flash_flexspi_nor_is25_clear_read_param(data, flexspi_lut, &read_params); if (ret < 0) { while (1) { From 497aa66b007657ffebe01485963e9413456efa7c Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Thu, 17 Oct 2024 14:41:14 -0500 Subject: [PATCH 1352/4482] boards: nxp: mimxrt1020_evk: correct flash chip name RT1020 EVK uses a IS25LP flash chip, not IS25WP. Signed-off-by: Daniel DeGrasse --- boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts b/boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts index 64d99c5a8dd96..955f363c8a44d 100644 --- a/boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts +++ b/boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts @@ -22,8 +22,8 @@ }; chosen { - zephyr,flash-controller = &is25wp064; - zephyr,flash = &is25wp064; + zephyr,flash-controller = &is25lp064; + zephyr,flash = &is25lp064; zephyr,code-partition = &slot0_partition; zephyr,uart-mcumgr = &lpuart1; zephyr,sram = &sdram0; @@ -95,7 +95,7 @@ arduino_serial: &lpuart2 { &flexspi { status = "okay"; reg = <0x402a8000 0x4000>, <0x60000000 DT_SIZE_M(8)>; - is25wp064: is25wp064@0 { + is25lp064: is25lp064@0 { compatible = "nxp,imx-flexspi-nor"; size = <67108864>; reg = <0>; From fdae4d2e4fe397c454837b07d4758854d28e96e5 Mon Sep 17 00:00:00 2001 From: James Roy Date: Sun, 20 Oct 2024 15:54:32 +0800 Subject: [PATCH 1353/4482] include: zephyr: dsp: Inconsistent macro names changed Fix incorrect header file pre-macro names in include/zephyr/dsp. Signed-off-by: James Roy --- include/zephyr/dsp/basicmath.h | 6 +++--- include/zephyr/dsp/basicmath_f16.h | 6 +++--- include/zephyr/dsp/dsp.h | 6 +++--- include/zephyr/dsp/print_format.h | 6 +++--- include/zephyr/dsp/types.h | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/zephyr/dsp/basicmath.h b/include/zephyr/dsp/basicmath.h index 0c85ca62103ed..173731d0ca32f 100644 --- a/include/zephyr/dsp/basicmath.h +++ b/include/zephyr/dsp/basicmath.h @@ -8,8 +8,8 @@ * @brief Public APIs for DSP basicmath */ -#ifndef INCLUDE_ZEPHYR_DSP_BASICMATH_H_ -#define INCLUDE_ZEPHYR_DSP_BASICMATH_H_ +#ifndef ZEPHYR_INCLUDE_DSP_BASICMATH_H_ +#define ZEPHYR_INCLUDE_DSP_BASICMATH_H_ #include @@ -929,4 +929,4 @@ DSP_FUNC_SCOPE void zdsp_clip_q7(const DSP_DATA q7_t *src, DSP_DATA q7_t *dst, q #include #endif /* CONFIG_FP16 */ -#endif /* INCLUDE_ZEPHYR_DSP_BASICMATH_H_ */ +#endif /* ZEPHYR_INCLUDE_DSP_BASICMATH_H_ */ diff --git a/include/zephyr/dsp/basicmath_f16.h b/include/zephyr/dsp/basicmath_f16.h index 23239e9a65980..84401da9615b7 100644 --- a/include/zephyr/dsp/basicmath_f16.h +++ b/include/zephyr/dsp/basicmath_f16.h @@ -8,8 +8,8 @@ * @brief Public APIs for DSP basicmath for 16 bit floating point */ -#ifndef INCLUDE_ZEPHYR_DSP_BASICMATH_F16_H_ -#define INCLUDE_ZEPHYR_DSP_BASICMATH_F16_H_ +#ifndef ZEPHYR_INCLUDE_DSP_BASICMATH_F16_H_ +#define ZEPHYR_INCLUDE_DSP_BASICMATH_F16_H_ #ifndef CONFIG_FP16 #error "Cannot use float16 DSP functionality without CONFIG_FP16 enabled" @@ -121,4 +121,4 @@ DSP_FUNC_SCOPE void zdsp_clip_f16(const float16_t *src, float16_t *dst, float16_ } #endif -#endif /* INCLUDE_ZEPHYR_DSP_BASICMATH_F16_H_ */ +#endif /* ZEPHYR_INCLUDE_DSP_BASICMATH_F16_H_ */ diff --git a/include/zephyr/dsp/dsp.h b/include/zephyr/dsp/dsp.h index beef08fb184dd..1ffa211192a4c 100644 --- a/include/zephyr/dsp/dsp.h +++ b/include/zephyr/dsp/dsp.h @@ -8,8 +8,8 @@ * @brief Public APIs for Digital Signal Processing (DSP) math. */ -#ifndef INCLUDE_ZEPHYR_DSP_DSP_H_ -#define INCLUDE_ZEPHYR_DSP_DSP_H_ +#ifndef ZEPHYR_INCLUDE_DSP_DSP_H_ +#define ZEPHYR_INCLUDE_DSP_DSP_H_ #ifdef CONFIG_DSP_BACKEND_HAS_STATIC #define DSP_FUNC_SCOPE static @@ -44,4 +44,4 @@ #include "zdsp_backend.h" -#endif /* INCLUDE_ZEPHYR_DSP_DSP_H_ */ +#endif /* ZEPHYR_INCLUDE_DSP_DSP_H_ */ diff --git a/include/zephyr/dsp/print_format.h b/include/zephyr/dsp/print_format.h index dd7d7128f7ad1..014aebeee1585 100644 --- a/include/zephyr/dsp/print_format.h +++ b/include/zephyr/dsp/print_format.h @@ -2,8 +2,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_ZEPHYR_DSP_PRINT_FORMAT_H -#define ZEPHYR_INCLUDE_ZEPHYR_DSP_PRINT_FORMAT_H +#ifndef ZEPHYR_INCLUDE_DSP_PRINT_FORMAT_H_ +#define ZEPHYR_INCLUDE_DSP_PRINT_FORMAT_H_ #include #include @@ -63,4 +63,4 @@ static inline int64_t ___PRIq_arg_shift(int64_t q, int shift) * @} */ -#endif /* ZEPHYR_INCLUDE_ZEPHYR_DSP_PRINT_FORMAT_H */ +#endif /* ZEPHYR_INCLUDE_DSP_PRINT_FORMAT_H_ */ diff --git a/include/zephyr/dsp/types.h b/include/zephyr/dsp/types.h index 52ce2ab20372c..2ee02fb082ae6 100644 --- a/include/zephyr/dsp/types.h +++ b/include/zephyr/dsp/types.h @@ -2,8 +2,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef INCLUDE_ZEPHYR_DSP_TYPES_H_ -#define INCLUDE_ZEPHYR_DSP_TYPES_H_ +#ifndef ZEPHYR_INCLUDE_DSP_TYPES_H_ +#define ZEPHYR_INCLUDE_DSP_TYPES_H_ #include @@ -68,4 +68,4 @@ typedef double float64_t; * @} */ -#endif /* INCLUDE_ZEPHYR_DSP_TYPES_H_ */ +#endif /* ZEPHYR_INCLUDE_DSP_TYPES_H_ */ From 271aeaf5f986bbd656d77a44fe28e25ee7cf0520 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Sat, 19 Oct 2024 14:53:00 +0200 Subject: [PATCH 1354/4482] tests: drivers: stepper: stepper_api: test cb user_data This commit does the following: 1. tests set_callback and user_data 2. fixes the api as well as the drivers by passing user_data back to the set callback Signed-off-by: Jilay Pandya --- drivers/stepper/adi_tmc/CMakeLists.txt | 2 ++ .../adi_tmc/adi_tmc5041_stepper_controller.c | 2 +- drivers/stepper/gpio_stepper_controller.c | 6 +++--- drivers/stepper/stepper_shell.c | 17 ++++++++++------- include/zephyr/drivers/stepper.h | 3 ++- tests/drivers/stepper/stepper_api/src/main.c | 14 +++++++++++--- 6 files changed, 29 insertions(+), 15 deletions(-) diff --git a/drivers/stepper/adi_tmc/CMakeLists.txt b/drivers/stepper/adi_tmc/CMakeLists.txt index a972c9b54dca6..a261deef90802 100644 --- a/drivers/stepper/adi_tmc/CMakeLists.txt +++ b/drivers/stepper/adi_tmc/CMakeLists.txt @@ -2,5 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 zephyr_library() +zephyr_library_property(ALLOW_EMPTY TRUE) + zephyr_library_sources_ifdef(CONFIG_STEPPER_ADI_TMC_SPI adi_tmc_spi.c) zephyr_library_sources_ifdef(CONFIG_STEPPER_ADI_TMC5041 adi_tmc5041_stepper_controller.c) diff --git a/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c b/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c index 2967fe4dfc962..bd9857b95cf1a 100644 --- a/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c +++ b/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c @@ -185,7 +185,7 @@ static void execute_callback(const struct device *dev, const enum stepper_event LOG_WRN_ONCE("No callback registered"); return; } - data->callback(dev, event); + data->callback(dev, event, data->event_cb_user_data); } static void rampstat_work_handler(struct k_work *work) diff --git a/drivers/stepper/gpio_stepper_controller.c b/drivers/stepper/gpio_stepper_controller.c index a26f9c0a8a788..fc68d551295d7 100644 --- a/drivers/stepper/gpio_stepper_controller.c +++ b/drivers/stepper/gpio_stepper_controller.c @@ -9,9 +9,9 @@ #include #include #include -#include #include +#include LOG_MODULE_REGISTER(gpio_stepper_motor_controller, CONFIG_STEPPER_LOG_LEVEL); #define MAX_MICRO_STEP_RES STEPPER_MICRO_STEP_2 @@ -34,10 +34,10 @@ struct gpio_stepper_data { uint8_t step_gap; uint8_t coil_charge; struct k_work_delayable stepper_dwork; - stepper_event_callback_t callback; int32_t actual_position; uint32_t delay_in_us; int32_t step_count; + stepper_event_callback_t callback; void *event_cb_user_data; }; @@ -84,7 +84,7 @@ static void update_remaining_steps(struct gpio_stepper_data *data) LOG_WRN_ONCE("No callback set"); return; } - data->callback(data->dev, STEPPER_EVENT_STEPS_COMPLETED); + data->callback(data->dev, STEPPER_EVENT_STEPS_COMPLETED, data->event_cb_user_data); } } diff --git a/drivers/stepper/stepper_shell.c b/drivers/stepper/stepper_shell.c index 05c5bd83c33f9..3f9d0523294ee 100644 --- a/drivers/stepper/stepper_shell.c +++ b/drivers/stepper/stepper_shell.c @@ -40,23 +40,26 @@ struct stepper_direction_map { .microstep = _microstep, \ } -static void print_callback(const struct device *dev, const enum stepper_event event) +static void print_callback(const struct device *dev, const enum stepper_event event, + void *user_data) { + const struct shell *sh = user_data; + switch (event) { case STEPPER_EVENT_STEPS_COMPLETED: - LOG_INF("%s: Steps completed.", dev->name); + shell_info(sh, "%s: Steps completed.", dev->name); break; case STEPPER_EVENT_STALL_DETECTED: - LOG_INF("%s: Stall detected.", dev->name); + shell_info(sh, "%s: Stall detected.", dev->name); break; case STEPPER_EVENT_LEFT_END_STOP_DETECTED: - LOG_INF("%s: Left limit switch pressed.", dev->name); + shell_info(sh, "%s: Left limit switch pressed.", dev->name); break; case STEPPER_EVENT_RIGHT_END_STOP_DETECTED: - LOG_INF("%s: Right limit switch pressed.", dev->name); + shell_info(sh, "%s: Right limit switch pressed.", dev->name); break; default: - LOG_INF("%s: Unknown signal received.", dev->name); + shell_info(sh, "%s: Unknown signal received.", dev->name); break; } } @@ -200,7 +203,7 @@ static int cmd_stepper_move(const struct shell *sh, size_t argc, char **argv) return err; } - err = stepper_set_callback(dev, print_callback, NULL); + err = stepper_set_callback(dev, print_callback, (void *)sh); if (err != 0) { shell_error(sh, "Failed to set callback: %d", err); } diff --git a/include/zephyr/drivers/stepper.h b/include/zephyr/drivers/stepper.h index cf584a0114fa9..39171513aa8bd 100644 --- a/include/zephyr/drivers/stepper.h +++ b/include/zephyr/drivers/stepper.h @@ -174,7 +174,8 @@ typedef int (*stepper_enable_constant_velocity_mode_t)(const struct device *dev, /** * @brief Callback function for stepper events */ -typedef void (*stepper_event_callback_t)(const struct device *dev, const enum stepper_event event); +typedef void (*stepper_event_callback_t)(const struct device *dev, const enum stepper_event event, + void *user_data); /** * @brief Set the callback function to be called when a stepper event occurs diff --git a/tests/drivers/stepper/stepper_api/src/main.c b/tests/drivers/stepper/stepper_api/src/main.c index b9daa13cff657..8aaf468c0e137 100644 --- a/tests/drivers/stepper/stepper_api/src/main.c +++ b/tests/drivers/stepper/stepper_api/src/main.c @@ -14,9 +14,12 @@ struct stepper_fixture { struct k_poll_signal stepper_signal; struct k_poll_event stepper_event; +void *user_data_received; -static void stepper_print_event_callback(const struct device *dev, enum stepper_event event) +static void stepper_print_event_callback(const struct device *dev, enum stepper_event event, + void *user_data) { + user_data_received = user_data; switch (event) { case STEPPER_EVENT_STEPS_COMPLETED: k_poll_signal_raise(&stepper_signal, STEPPER_EVENT_STEPS_COMPLETED); @@ -45,7 +48,7 @@ static void *stepper_setup(void) k_poll_signal_init(&stepper_signal); k_poll_event_init(&stepper_event, K_POLL_TYPE_SIGNAL, K_POLL_MODE_NOTIFY_ONLY, &stepper_signal); - + user_data_received = NULL; zassert_not_null(fixture.dev); return &fixture; } @@ -80,8 +83,12 @@ ZTEST_F(stepper, test_target_position) int32_t pos = 100u; (void)stepper_set_max_velocity(fixture->dev, 100u); - (void)stepper_set_callback(fixture->dev, fixture->callback, NULL); + + /* Pass the function name as user data */ + (void)stepper_set_callback(fixture->dev, fixture->callback, &fixture); + (void)stepper_set_target_position(fixture->dev, pos); + (void)k_poll(&stepper_event, 1, K_SECONDS(5)); unsigned int signaled; int result; @@ -91,4 +98,5 @@ ZTEST_F(stepper, test_target_position) zassert_equal(result, STEPPER_EVENT_STEPS_COMPLETED, "Signal not set"); (void)stepper_get_actual_position(fixture->dev, &pos); zassert_equal(pos, 100u, "Target position should be %d but is %d", 100u, pos); + zassert_equal(user_data_received, &fixture, "User data not received"); } From edaf94ec37c8ed0d9ff8d81159c3c714491676e8 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Sat, 19 Oct 2024 16:36:17 +0700 Subject: [PATCH 1355/4482] net: shell: ping: correct argument count for net `ping` command Since `` is a mandatory argument, the (_mand, _opt) values should be adjusted to 2 and 12, respectively. Note that `_mand` includes the number of mandatory arguments, including the command name (`ping` itself). Signed-off-by: Pisit Sawangvonganan --- subsys/net/lib/shell/ping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/shell/ping.c b/subsys/net/lib/shell/ping.c index 0af4dc41246f6..af7203ad9d33f 100644 --- a/subsys/net/lib/shell/ping.c +++ b/subsys/net/lib/shell/ping.c @@ -497,4 +497,4 @@ SHELL_STATIC_SUBCMD_SET_CREATE(net_cmd_ping, SHELL_SUBCMD_ADD((net), ping, &net_cmd_ping, "Ping a network host.", - cmd_net_ping, 1, 13); + cmd_net_ping, 2, 12); From 17e62bc24bc68de44e72763c812d0523aa2a7c13 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Sat, 19 Oct 2024 16:44:57 +0700 Subject: [PATCH 1356/4482] net: shell: ping: streamline `parse_arg` function by using `shell_strtol` Switch from using direct `strtol` calls to `shell_strtol`. This change leverages the extensive error handling provided by `shell_strtol`. Signed-off-by: Pisit Sawangvonganan --- subsys/net/lib/shell/ping.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/subsys/net/lib/shell/ping.c b/subsys/net/lib/shell/ping.c index af7203ad9d33f..410a5aef41471 100644 --- a/subsys/net/lib/shell/ping.c +++ b/subsys/net/lib/shell/ping.c @@ -199,9 +199,10 @@ static int handle_ipv4_echo_reply(struct net_icmp_ctx *ctx, static int parse_arg(size_t *i, size_t argc, char *argv[]) { - int res = -1; + int res; + int err; + int base; const char *str = argv[*i] + 2; - char *endptr; if (*str == 0) { if (*i + 1 >= argc) { @@ -212,14 +213,15 @@ static int parse_arg(size_t *i, size_t argc, char *argv[]) str = argv[*i]; } - errno = 0; if (strncmp(str, "0x", 2) == 0) { - res = strtol(str, &endptr, 16); + base = 16; } else { - res = strtol(str, &endptr, 10); + base = 10; } - if (errno || (endptr == str)) { + err = 0; + res = shell_strtol(str, base, &err); + if (err != 0) { return -1; } From c9a1db6e7e405764333eb9eee2b00ad043ce116e Mon Sep 17 00:00:00 2001 From: Swift Tian Date: Sat, 19 Oct 2024 13:29:47 +0800 Subject: [PATCH 1357/4482] tests: mspi: fix incorrect DT macro used in api test DT macro should be used is DT_ENUM* for enum type bindings Signed-off-by: Swift Tian --- tests/drivers/mspi/api/src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/drivers/mspi/api/src/main.c b/tests/drivers/mspi/api/src/main.c index d6b632f29c10a..9f48e898f3804 100644 --- a/tests/drivers/mspi/api/src/main.c +++ b/tests/drivers/mspi/api/src/main.c @@ -31,8 +31,8 @@ static struct gpio_dt_spec ce_gpios[] = MSPI_CE_GPIOS_DT_SPEC_GET(MSPI_BUS_NODE) #if TEST_MSPI_REINIT struct mspi_cfg hardware_cfg = { .channel_num = 0, - .op_mode = DT_PROP_OR(MSPI_BUS_NODE, op_mode, MSPI_OP_MODE_CONTROLLER), - .duplex = DT_PROP_OR(MSPI_BUS_NODE, duplex, MSPI_HALF_DUPLEX), + .op_mode = DT_ENUM_IDX_OR(MSPI_BUS_NODE, op_mode, MSPI_OP_MODE_CONTROLLER), + .duplex = DT_ENUM_IDX_OR(MSPI_BUS_NODE, duplex, MSPI_HALF_DUPLEX), .dqs_support = DT_PROP_OR(MSPI_BUS_NODE, dqs_support, false), .ce_group = ce_gpios, .num_ce_gpios = ARRAY_SIZE(ce_gpios), From 744338f6ea432117aa0eb14417cf33d1355eda5d Mon Sep 17 00:00:00 2001 From: Swift Tian Date: Sat, 19 Oct 2024 13:33:33 +0800 Subject: [PATCH 1358/4482] drivers: mspi: fix incorrect DT macro used in controller emulator DT_INST* should be used in MSPI_CONFIG or device tree value capture will fail sliently and fall back to defaults. Signed-off-by: Swift Tian --- drivers/mspi/mspi_emul.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mspi/mspi_emul.c b/drivers/mspi/mspi_emul.c index 99f0f0f3d4dfe..57b28bfc06f56 100644 --- a/drivers/mspi/mspi_emul.c +++ b/drivers/mspi/mspi_emul.c @@ -860,8 +860,8 @@ static struct emul_mspi_driver_api emul_mspi_driver_api = { #define MSPI_CONFIG(n) \ { \ .channel_num = EMUL_MSPI_INST_ID, \ - .op_mode = DT_ENUM_IDX_OR(n, op_mode, MSPI_OP_MODE_CONTROLLER), \ - .duplex = DT_ENUM_IDX_OR(n, duplex, MSPI_HALF_DUPLEX), \ + .op_mode = DT_INST_ENUM_IDX_OR(n, op_mode, MSPI_OP_MODE_CONTROLLER),\ + .duplex = DT_INST_ENUM_IDX_OR(n, duplex, MSPI_HALF_DUPLEX), \ .max_freq = DT_INST_PROP(n, clock_frequency), \ .dqs_support = DT_INST_PROP_OR(n, dqs_support, false), \ .sw_multi_periph = DT_INST_PROP(n, software_multiperipheral), \ From 5cbd1f6c39002410a814700cb75dcce189bb5295 Mon Sep 17 00:00:00 2001 From: Vincent van der Locht Date: Mon, 7 Oct 2024 11:23:35 +0200 Subject: [PATCH 1359/4482] usb: device_next: cdc_acm: Prevent polling for buffer in TX In case the host doesn't pull the new data from the endpoint, the work task would schedule itself again delayed (at the max. priority). When there is no terminal program or active application reading the endpoint this results in a constant polling of the endpoint burning up to 5% of the CPU cycles. By using a atomic flag for tx busy, the polling is solved and changed into a postponed execution of the next work task which saves up to 5% of CPU cycles and allows a better real-time behavior for other tasks. Secondly, if the TX interrupt is disabled but there is still data in the TX FIFO (ring buffer), the implementation will continue to trigger subsequent TX work and attempt to flush the data to the host. Signed-off-by: Vincent van der Locht --- subsys/usb/device_next/class/usbd_cdc_acm.c | 24 ++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/subsys/usb/device_next/class/usbd_cdc_acm.c b/subsys/usb/device_next/class/usbd_cdc_acm.c index a380630458942..15fa82ad9eb1b 100644 --- a/subsys/usb/device_next/class/usbd_cdc_acm.c +++ b/subsys/usb/device_next/class/usbd_cdc_acm.c @@ -49,6 +49,7 @@ UDC_BUF_POOL_DEFINE(cdc_acm_ep_pool, #define CDC_ACM_IRQ_RX_ENABLED 2 #define CDC_ACM_IRQ_TX_ENABLED 3 #define CDC_ACM_RX_FIFO_BUSY 4 +#define CDC_ACM_TX_FIFO_BUSY 5 static struct k_work_q cdc_acm_work_q; static K_KERNEL_STACK_DEFINE(cdc_acm_stack, @@ -228,6 +229,10 @@ static int usbd_cdc_acm_request(struct usbd_class_data *const c_data, atomic_clear_bit(&data->state, CDC_ACM_RX_FIFO_BUSY); } + if (bi->ep == cdc_acm_get_bulk_in(c_data)) { + atomic_clear_bit(&data->state, CDC_ACM_TX_FIFO_BUSY); + } + goto ep_request_error; } @@ -250,6 +255,14 @@ static int usbd_cdc_acm_request(struct usbd_class_data *const c_data, if (data->cb) { cdc_acm_work_submit(&data->irq_cb_work); } + + atomic_clear_bit(&data->state, CDC_ACM_TX_FIFO_BUSY); + + if (!ring_buf_is_empty(data->tx_fifo.rb)) { + /* Queue pending TX data on IN endpoint */ + cdc_acm_work_schedule(&data->tx_fifo_work, K_NO_WAIT); + } + } if (bi->ep == cdc_acm_get_int_in(c_data)) { @@ -548,8 +561,14 @@ static void cdc_acm_tx_fifo_handler(struct k_work *work) return; } + if (atomic_test_and_set_bit(&data->state, CDC_ACM_TX_FIFO_BUSY)) { + LOG_DBG("TX transfer already in progress"); + return; + } + buf = cdc_acm_buf_alloc(cdc_acm_get_bulk_in(c_data)); if (buf == NULL) { + atomic_clear_bit(&data->state, CDC_ACM_TX_FIFO_BUSY); cdc_acm_work_schedule(&data->tx_fifo_work, K_MSEC(1)); return; } @@ -561,6 +580,7 @@ static void cdc_acm_tx_fifo_handler(struct k_work *work) if (ret) { LOG_ERR("Failed to enqueue"); net_buf_unref(buf); + atomic_clear_bit(&data->state, CDC_ACM_TX_FIFO_BUSY); } } @@ -828,7 +848,9 @@ static void cdc_acm_irq_cb_handler(struct k_work *work) if (data->tx_fifo.altered) { LOG_DBG("tx fifo altered, submit work"); - cdc_acm_work_schedule(&data->tx_fifo_work, K_NO_WAIT); + if (!atomic_test_bit(&data->state, CDC_ACM_TX_FIFO_BUSY)) { + cdc_acm_work_schedule(&data->tx_fifo_work, K_NO_WAIT); + } } if (atomic_test_bit(&data->state, CDC_ACM_IRQ_RX_ENABLED) && From 39917ae5e6423fe74edce399b927ddff38670817 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 22 Oct 2024 22:39:28 -0400 Subject: [PATCH 1360/4482] tests: ztest: fix board name Use full board name in cmake file. Signed-off-by: Anas Nashif --- tests/ztest/zexpect/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ztest/zexpect/CMakeLists.txt b/tests/ztest/zexpect/CMakeLists.txt index f3f613f1ae0b5..0b2813f48b23d 100644 --- a/tests/ztest/zexpect/CMakeLists.txt +++ b/tests/ztest/zexpect/CMakeLists.txt @@ -1,7 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 cmake_minimum_required(VERSION 3.20.0) -if(BOARD STREQUAL unit_testing) +if(BOARD STREQUAL unit_testing/unit_testing) find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(base) From b9ec4e5396876188a32242ffa2c037015dbbffa1 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 23 Oct 2024 10:01:13 +0200 Subject: [PATCH 1361/4482] tests: ztest base: fix board name Use full board name in cmake file. Akin to the fix done in #80270 https://github.com/zephyrproject-rtos/zephyr/pull/80270/ following the changes from https://github.com/zephyrproject-rtos/zephyr/pull/77250/ In which twister now uses the full board name when calling cmake. Signed-off-by: Alberto Escolar Piedras --- tests/ztest/base/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ztest/base/CMakeLists.txt b/tests/ztest/base/CMakeLists.txt index a05ac990abb34..5cbbcb1089416 100644 --- a/tests/ztest/base/CMakeLists.txt +++ b/tests/ztest/base/CMakeLists.txt @@ -1,7 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 cmake_minimum_required(VERSION 3.20.0) -if(BOARD STREQUAL unit_testing) +if(BOARD STREQUAL unit_testing/unit_testing) find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(base) From b1610b847d2cda5bd196ca0dfa95ea6bbae53740 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 23 Oct 2024 10:04:52 +0200 Subject: [PATCH 1362/4482] tests fff_fake_contexts: fix board name Use full board name in cmake file. Akin to the fix done in zephyrproject-rtos#80270 zephyrproject-rtos#80270 following the changes from zephyrproject-rtos#77250 In which twister now uses the full board name when calling cmake. Signed-off-by: Alberto Escolar Piedras --- tests/subsys/testsuite/fff_fake_contexts/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/subsys/testsuite/fff_fake_contexts/CMakeLists.txt b/tests/subsys/testsuite/fff_fake_contexts/CMakeLists.txt index 3f71a78ed0338..d4cf1a06bf650 100644 --- a/tests/subsys/testsuite/fff_fake_contexts/CMakeLists.txt +++ b/tests/subsys/testsuite/fff_fake_contexts/CMakeLists.txt @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 cmake_minimum_required(VERSION 3.20.0) -if(BOARD STREQUAL unit_testing) +if(BOARD STREQUAL unit_testing/unit_testing) find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE}) set(target testbinary) else() From 05531647ee5624d1fe6bde16338115548622cc30 Mon Sep 17 00:00:00 2001 From: Hao Luo Date: Wed, 23 Oct 2024 14:33:23 +0800 Subject: [PATCH 1363/4482] drivers: spi: remove unused variables Removed unused variables to get rid of warning Signed-off-by: Hao Luo --- drivers/spi/spi_ambiq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/spi/spi_ambiq.c b/drivers/spi/spi_ambiq.c index c95c3875dc5f2..c36fc0391e7a5 100644 --- a/drivers/spi/spi_ambiq.c +++ b/drivers/spi/spi_ambiq.c @@ -49,8 +49,6 @@ typedef void (*spi_context_update_trx)(struct spi_context *ctx, uint8_t dfs, uin #define SPI_WORD_SIZE 8 -#define SPI_CS_INDEX 3 - static void spi_ambiq_pm_policy_state_lock_get(const struct device *dev) { if (IS_ENABLED(CONFIG_PM)) { @@ -370,7 +368,7 @@ static int spi_ambiq_transceive(const struct device *dev, const struct spi_confi const struct spi_buf_set *rx_bufs) { struct spi_ambiq_data *data = dev->data; - int pm_ret, ret = 0; + int ret = 0; if (!tx_bufs && !rx_bufs) { return 0; From 963db42af729ae1cf8e28bb5f089eceae1c95edf Mon Sep 17 00:00:00 2001 From: Prashanth S Date: Wed, 31 May 2023 11:53:22 +0530 Subject: [PATCH 1364/4482] soc: ti_k3: Add TI J721E SoC R5 Add initial SoC support for the TI J721E SoC series Cortex-R5 core. TRM for J721e https://www.ti.com/lit/zip/spruil1 File: spruil1c.pdf Signed-off-by: Prashanth S Signed-off-by: Andrew Davis --- dts/arm/ti/j721e_main_r5.dtsi | 85 +++++++++++++++++++ .../dt-bindings/pinctrl/ti-k3-pinctrl.h | 5 ++ soc/ti/k3/am6x/CMakeLists.txt | 11 +++ soc/ti/k3/am6x/Kconfig | 11 +++ soc/ti/k3/am6x/Kconfig.defconfig | 8 ++ soc/ti/k3/am6x/Kconfig.soc | 11 +++ soc/ti/k3/am6x/r5/linker.ld | 17 ++++ soc/ti/k3/am6x/r5/soc.c | 49 +++++++++++ soc/ti/k3/am6x/r5/soc.h | 12 +++ soc/ti/k3/soc.yml | 3 + 10 files changed, 212 insertions(+) create mode 100644 dts/arm/ti/j721e_main_r5.dtsi create mode 100644 soc/ti/k3/am6x/r5/linker.ld create mode 100644 soc/ti/k3/am6x/r5/soc.c create mode 100644 soc/ti/k3/am6x/r5/soc.h diff --git a/dts/arm/ti/j721e_main_r5.dtsi b/dts/arm/ti/j721e_main_r5.dtsi new file mode 100644 index 0000000000000..7b8f72ba5aed1 --- /dev/null +++ b/dts/arm/ti/j721e_main_r5.dtsi @@ -0,0 +1,85 @@ +/* Copyright (C) 2023 BeagleBoard.org Foundation + * Copyright (C) 2023 S Prashanth + * Copyright (c) 2024 Texas Instruments Incorporated + * Andrew Davis + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +/ { + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-r5"; + reg = <0>; + }; + }; + + atcm: memory@0 { + device_type = "memory"; + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x00000000 DT_SIZE_K(32)>; + zephyr,memory-region = "ATCM"; + }; + + btcm: memory@41010000 { + device_type = "memory"; + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x41010000 DT_SIZE_K(32)>; + zephyr,memory-region = "BTCM"; + }; + + vim: interrupt-controller@ff80000 { + #address-cells = <1>; + compatible = "ti,vim"; + reg = <0x0ff80000 0x2800>; + interrupt-controller; + #interrupt-cells = <4>; /* {IRQ/FIQ, IRQ_NUM, IRQ_TYPE, IRQ_PRIO} */ + status = "okay"; + }; + + pinctrl: pinctrl@11c000 { + compatible = "ti,k3-pinctrl"; + reg = <0x0011c000 0x2b4>; + status = "okay"; + }; + + uart1: uart@2810000 { + compatible = "ns16550"; + reg = <0x02810000 0x100>; + clock-frequency = <48000000>; + interrupts = <0 159 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>; + interrupt-parent = <&vim>; + reg-shift = <2>; + status = "disabled"; + }; + + uart2: uart@2820000 { + compatible = "ns16550"; + reg = <0x02820000 0x100>; + clock-frequency = <48000000>; + interrupts = <0 160 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>; + interrupt-parent = <&vim>; + reg-shift = <2>; + status = "disabled"; + }; + + systick_timer: timer@24c0000 { + compatible = "ti,am654-timer"; + reg = <0x24c0000 0x70>; + interrupts = <0 168 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>; + interrupt-parent = <&vim>; + status = "disabled"; + }; +}; diff --git a/include/zephyr/dt-bindings/pinctrl/ti-k3-pinctrl.h b/include/zephyr/dt-bindings/pinctrl/ti-k3-pinctrl.h index b50e784625db5..a830187b492fa 100644 --- a/include/zephyr/dt-bindings/pinctrl/ti-k3-pinctrl.h +++ b/include/zephyr/dt-bindings/pinctrl/ti-k3-pinctrl.h @@ -39,6 +39,11 @@ #define MUX_MODE_7 7 #define MUX_MODE_8 8 #define MUX_MODE_9 9 +#define MUX_MODE_10 10 +#define MUX_MODE_11 11 +#define MUX_MODE_12 12 +#define MUX_MODE_13 13 +#define MUX_MODE_14 14 #define K3_PINMUX(offset, value, mux_mode) (((offset) & 0x1fff)) ((value) | (mux_mode)) diff --git a/soc/ti/k3/am6x/CMakeLists.txt b/soc/ti/k3/am6x/CMakeLists.txt index 993d8d8d95b6a..d5e88b78e25a9 100644 --- a/soc/ti/k3/am6x/CMakeLists.txt +++ b/soc/ti/k3/am6x/CMakeLists.txt @@ -18,4 +18,15 @@ elseif(CONFIG_SOC_SERIES_AM6X_M4) endif() set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/m4/linker.ld CACHE INTERNAL "") +elseif(CONFIG_SOC_SERIES_AM6X_R5) + zephyr_sources(r5/soc.c) + + zephyr_include_directories(r5) + + if(CONFIG_OPENAMP_RSC_TABLE) + zephyr_linker_section(NAME .resource_table GROUP ROM_REGION NOINPUT) + zephyr_linker_section_configure(SECTION .resource_table KEEP INPUT ".resource_table*") + endif() + + set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/r5/linker.ld CACHE INTERNAL "") endif() diff --git a/soc/ti/k3/am6x/Kconfig b/soc/ti/k3/am6x/Kconfig index 76fd90d457d16..a28996cc30589 100644 --- a/soc/ti/k3/am6x/Kconfig +++ b/soc/ti/k3/am6x/Kconfig @@ -19,7 +19,18 @@ config SOC_SERIES_AM6X_M4 select MM_TI_RAT select SOC_EARLY_INIT_HOOK +config SOC_SERIES_AM6X_R5 + select ARM + select CPU_CORTEX_R5 + select CPU_HAS_ARM_MPU + select ARM_CUSTOM_INTERRUPT_CONTROLLER + select VIM + select TI_DM_TIMER + select OPENAMP_RSC_TABLE + select UART_NS16550_ACCESS_WORD_ONLY if UART_NS16550 + config SOC_PART_NUMBER default "AM6234" if SOC_AM6234_A53 default "AM6234" if SOC_AM6234_M4 default "AM6442" if SOC_AM6442_M4 + default "J721e" if SOC_J721E_MAIN_R5F0_0 diff --git a/soc/ti/k3/am6x/Kconfig.defconfig b/soc/ti/k3/am6x/Kconfig.defconfig index 2d9794413e4a4..9555905beecde 100644 --- a/soc/ti/k3/am6x/Kconfig.defconfig +++ b/soc/ti/k3/am6x/Kconfig.defconfig @@ -3,6 +3,9 @@ if SOC_SERIES_AM6X +config KERNEL_ENTRY + default "_vector_table" + # Workaround for not being able to have commas in macro arguments DT_CHOSEN_Z_FLASH := zephyr,flash @@ -16,11 +19,13 @@ config NUM_IRQS int default 64 if SOC_SERIES_AM6X_M4 default 280 if SOC_SERIES_AM6X_A53 + default 512 if SOC_SERIES_AM6X_R5 config SYS_CLOCK_HW_CYCLES_PER_SEC int default 400000000 if SOC_SERIES_AM6X_M4 default 200000000 if SOC_SERIES_AM6X_A53 + default 19200000 if SOC_SERIES_AM6X_R5 config PINCTRL default y @@ -32,6 +37,7 @@ config UART_NS16550 config UART_NS16550_TI_K3 default y if SOC_SERIES_AM6X_M4 + default y if SOC_SERIES_AM6X_R5 choice UART_NS16550_VARIANT default UART_NS16550_VARIANT_NS16750 @@ -41,8 +47,10 @@ endif # SERIAL config BUILD_OUTPUT_BIN default n if SOC_SERIES_AM6X_M4 + default n if SOC_SERIES_AM6X_R5 config BUILD_NO_GAP_FILL default y if SOC_SERIES_AM6X_M4 + default y if SOC_SERIES_AM6X_R5 endif # SOC_SERIES_AM6X diff --git a/soc/ti/k3/am6x/Kconfig.soc b/soc/ti/k3/am6x/Kconfig.soc index df9805f92d4c7..2f76accd255f9 100644 --- a/soc/ti/k3/am6x/Kconfig.soc +++ b/soc/ti/k3/am6x/Kconfig.soc @@ -17,6 +17,12 @@ config SOC_SERIES_AM6X_M4 help Enable support for AM62X M4 Series. +config SOC_SERIES_AM6X_R5 + bool + select SOC_SERIES_AM6X + help + Enable support for AM6X R5 Series. + config SOC_AM6234_A53 bool select SOC_SERIES_AM6X_A53 @@ -29,9 +35,14 @@ config SOC_AM6442_M4 bool select SOC_SERIES_AM6X_M4 +config SOC_J721E_MAIN_R5F0_0 + bool + select SOC_SERIES_AM6X_R5 + config SOC_SERIES default "am6x" if SOC_SERIES_AM6X config SOC default "am6234" if SOC_AM6234_M4 || SOC_AM6234_A53 default "am6442" if SOC_AM6442_M4 + default "j721e" if SOC_J721E_MAIN_R5F0_0 diff --git a/soc/ti/k3/am6x/r5/linker.ld b/soc/ti/k3/am6x/r5/linker.ld new file mode 100644 index 0000000000000..79e941b6ddeb3 --- /dev/null +++ b/soc/ti/k3/am6x/r5/linker.ld @@ -0,0 +1,17 @@ +/* Copyright (C) 2023 BeagleBoard.org Foundation + * Copyright (C) 2023 S Prashanth + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +SECTIONS +{ +#ifdef CONFIG_OPENAMP_RSC_TABLE + SECTION_PROLOGUE(.resource_table,, SUBALIGN(4)) + { + KEEP(*(.resource_table*)) + } GROUP_LINK_IN(RSC_TABLE) +#endif +} diff --git a/soc/ti/k3/am6x/r5/soc.c b/soc/ti/k3/am6x/r5/soc.c new file mode 100644 index 0000000000000..8190f43353fc1 --- /dev/null +++ b/soc/ti/k3/am6x/r5/soc.c @@ -0,0 +1,49 @@ +/* Copyright (C) 2023 BeagleBoard.org Foundation + * Copyright (C) 2023 S Prashanth + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include "soc.h" + +unsigned int z_soc_irq_get_active(void) +{ + return z_vim_irq_get_active(); +} + +void z_soc_irq_eoi(unsigned int irq) +{ + z_vim_irq_eoi(irq); +} + +void z_soc_irq_init(void) +{ + z_vim_irq_init(); +} + +void z_soc_irq_priority_set(unsigned int irq, unsigned int prio, uint32_t flags) +{ + /* Configure interrupt type and priority */ + z_vim_irq_priority_set(irq, prio, flags); +} + +void z_soc_irq_enable(unsigned int irq) +{ + /* Enable interrupt */ + z_vim_irq_enable(irq); +} + +void z_soc_irq_disable(unsigned int irq) +{ + /* Disable interrupt */ + z_vim_irq_disable(irq); +} + +int z_soc_irq_is_enabled(unsigned int irq) +{ + /* Check if interrupt is enabled */ + return z_vim_irq_is_enabled(irq); +} diff --git a/soc/ti/k3/am6x/r5/soc.h b/soc/ti/k3/am6x/r5/soc.h new file mode 100644 index 0000000000000..beb51f2d0ab5f --- /dev/null +++ b/soc/ti/k3/am6x/r5/soc.h @@ -0,0 +1,12 @@ +/* Copyright (C) 2023 BeagleBoard.org Foundation + * Copyright (C) 2023 S Prashanth + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef _TI_K3_J721E_R5_SOC_H_ +#define _TI_K3_J721E_R5_SOC_H_ + +#include + +#endif /* _TI_K3_J721E_R5_SOC_H_ */ diff --git a/soc/ti/k3/soc.yml b/soc/ti/k3/soc.yml index 3065ab13d4266..b8832d4f6b4ce 100644 --- a/soc/ti/k3/soc.yml +++ b/soc/ti/k3/soc.yml @@ -10,3 +10,6 @@ family: - name: am6442 cpuclusters: - name: m4 + - name: j721e + cpuclusters: + - name: main_r5f0_0 From ee67369b78c3b7e70453a2d7b72faa89cb523f16 Mon Sep 17 00:00:00 2001 From: Prashanth S Date: Wed, 31 May 2023 12:42:50 +0530 Subject: [PATCH 1365/4482] boards: beaglebone_ai64: Add BeagleBone AI-64 Add initial BeagleBone AI-64 support. BeagleBone AI-64: https://www.beagleboard.org/boards/beaglebone-ai-64 Signed-off-by: Prashanth S Signed-off-by: Andrew Davis --- .../beaglebone_ai64/Kconfig.beaglebone_ai64 | 7 + ...lebone_ai64_j721e_main_r5f0_0-pinctrl.dtsi | 21 +++ .../beaglebone_ai64_j721e_main_r5f0_0.dts | 57 ++++++++ .../beaglebone_ai64_j721e_main_r5f0_0.yaml | 17 +++ ...eaglebone_ai64_j721e_main_r5f0_0_defconfig | 15 ++ boards/beagle/beaglebone_ai64/board.yml | 5 + .../beaglebone_ai64/doc/assets/bbai_64.webp | Bin 0 -> 63888 bytes boards/beagle/beaglebone_ai64/doc/index.rst | 129 ++++++++++++++++++ 8 files changed, 251 insertions(+) create mode 100644 boards/beagle/beaglebone_ai64/Kconfig.beaglebone_ai64 create mode 100644 boards/beagle/beaglebone_ai64/beaglebone_ai64_j721e_main_r5f0_0-pinctrl.dtsi create mode 100644 boards/beagle/beaglebone_ai64/beaglebone_ai64_j721e_main_r5f0_0.dts create mode 100644 boards/beagle/beaglebone_ai64/beaglebone_ai64_j721e_main_r5f0_0.yaml create mode 100644 boards/beagle/beaglebone_ai64/beaglebone_ai64_j721e_main_r5f0_0_defconfig create mode 100644 boards/beagle/beaglebone_ai64/board.yml create mode 100644 boards/beagle/beaglebone_ai64/doc/assets/bbai_64.webp create mode 100644 boards/beagle/beaglebone_ai64/doc/index.rst diff --git a/boards/beagle/beaglebone_ai64/Kconfig.beaglebone_ai64 b/boards/beagle/beaglebone_ai64/Kconfig.beaglebone_ai64 new file mode 100644 index 0000000000000..08b2561528dd6 --- /dev/null +++ b/boards/beagle/beaglebone_ai64/Kconfig.beaglebone_ai64 @@ -0,0 +1,7 @@ +# Copyright (C) 2023 BeagleBoard.org Foundation +# Copyright (C) 2023 S Prashanth +# +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_BEAGLEBONE_AI64 + select SOC_J721E_MAIN_R5F0_0 if BOARD_BEAGLEBONE_AI64_J721E_MAIN_R5F0_0 diff --git a/boards/beagle/beaglebone_ai64/beaglebone_ai64_j721e_main_r5f0_0-pinctrl.dtsi b/boards/beagle/beaglebone_ai64/beaglebone_ai64_j721e_main_r5f0_0-pinctrl.dtsi new file mode 100644 index 0000000000000..dfc744b72e4a1 --- /dev/null +++ b/boards/beagle/beaglebone_ai64/beaglebone_ai64_j721e_main_r5f0_0-pinctrl.dtsi @@ -0,0 +1,21 @@ +/* Copyright (C) 2023 BeagleBoard.org Foundation + * Copyright (C) 2023 S Prashanth + * Copyright (c) 2024 Texas Instruments Incorporated + * Andrew Davis + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&pinctrl { + uart2_tx_default: uart2_tx_default { + /* 0x1c is address of padconfig register of p8.34 and 14 is mux mode */ + pinmux = ; + }; + + uart2_rx_default: uart2_rx_default { + /* 0x14 is address of padconfig register of p8.22 and 14 is mux mode */ + pinmux = ; + }; +}; diff --git a/boards/beagle/beaglebone_ai64/beaglebone_ai64_j721e_main_r5f0_0.dts b/boards/beagle/beaglebone_ai64/beaglebone_ai64_j721e_main_r5f0_0.dts new file mode 100644 index 0000000000000..8c4c8f0e8e4c9 --- /dev/null +++ b/boards/beagle/beaglebone_ai64/beaglebone_ai64_j721e_main_r5f0_0.dts @@ -0,0 +1,57 @@ +/* Copyright (C) 2023 BeagleBoard.org Foundation + * Copyright (C) 2023 S Prashanth + * Copyright (c) 2024 Texas Instruments Incorporated + * Andrew Davis + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "beaglebone_ai64_j721e_main_r5f0_0-pinctrl.dtsi" +#include + +/ { + model = "BeagleBoard.org BeagleBone AI-64"; + compatible = "beagle,beaglebone-ai64"; + + chosen { + zephyr,sram = &atcm; + zephyr,console = &uart2; + }; + + cpus { + cpu@0 { + status = "okay"; + }; + }; + + ddr0: memory@a2000000 { + compatible = "mmio-sram"; + reg = <0xa2000000 DT_SIZE_M(1)>; + }; + + rsc_table: memory@a2100000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0xa2100000 DT_SIZE_M(1)>; + zephyr,memory-region = "RSC_TABLE"; + }; + + ddr1: memory@a2200000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0xa2200000 DT_SIZE_M(14)>; + zephyr,memory-region = "DRAM"; + }; +}; + +&uart2 { + status = "okay"; + pinctrl-0 = <&uart2_tx_default &uart2_rx_default>; + pinctrl-names = "default"; + current-speed = <115200>; +}; + +&systick_timer { + status = "okay"; +}; diff --git a/boards/beagle/beaglebone_ai64/beaglebone_ai64_j721e_main_r5f0_0.yaml b/boards/beagle/beaglebone_ai64/beaglebone_ai64_j721e_main_r5f0_0.yaml new file mode 100644 index 0000000000000..0adaeddf82f47 --- /dev/null +++ b/boards/beagle/beaglebone_ai64/beaglebone_ai64_j721e_main_r5f0_0.yaml @@ -0,0 +1,17 @@ +# Copyright (C) 2023 BeagleBoard.org Foundation +# Copyright (C) 2023 S Prashanth +# +# SPDX-License-Identifier: Apache-2.0 + +identifier: beaglebone_ai64/j721e/main_r5f0_0 +name: BeagleBone-AI64 R5 +type: mcu +arch: arm +ram: 32 +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - uart +vendor: beagle diff --git a/boards/beagle/beaglebone_ai64/beaglebone_ai64_j721e_main_r5f0_0_defconfig b/boards/beagle/beaglebone_ai64/beaglebone_ai64_j721e_main_r5f0_0_defconfig new file mode 100644 index 0000000000000..244755fe3c965 --- /dev/null +++ b/boards/beagle/beaglebone_ai64/beaglebone_ai64_j721e_main_r5f0_0_defconfig @@ -0,0 +1,15 @@ +# Copyright (C) 2023 BeagleBoard.org Foundation +# Copyright (C) 2023 S Prashanth +# +# SPDX-License-Identifier: Apache-2.0 + +# Zephyr Kernel Configuration +CONFIG_XIP=n + +# Serial Driver +CONFIG_SERIAL=y +CONFIG_UART_INTERRUPT_DRIVEN=y + +# Enable Console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y diff --git a/boards/beagle/beaglebone_ai64/board.yml b/boards/beagle/beaglebone_ai64/board.yml new file mode 100644 index 0000000000000..f16d9a2d2487b --- /dev/null +++ b/boards/beagle/beaglebone_ai64/board.yml @@ -0,0 +1,5 @@ +board: + name: beaglebone_ai64 + vendor: beagle + socs: + - name: j721e diff --git a/boards/beagle/beaglebone_ai64/doc/assets/bbai_64.webp b/boards/beagle/beaglebone_ai64/doc/assets/bbai_64.webp new file mode 100644 index 0000000000000000000000000000000000000000..f513626e0e2731550bee45c537ebeff566ff13eb GIT binary patch literal 63888 zcm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;wv@Bjb+005F*(m~)S#9wIL zrn2I_iAmD}>C&{KtSZRLDM|9?6n@*}N*&xL^>Im$v&Y_8N=7Lr;Cy~|YUFg=9Jw*J zbR42KU1cB|S5iZZ$?{&G{1Q5za$)>s4x|qfP||LrY51H#e6RUxzE7H{sfn9fJxE9g6Y77{yC9+@bVNzuYyyDK44nM zNBMi{8WPOi_=0GTSG02YH3ioC2=6^q^ODhR3;#e%#jEF2$`(5q|sQP@=8@7)6Yh%0=`I{=I}L4wp65&uvmlNf7IPa zY>jfTY>B9exTExB{w-@>ItkI!__Ll`hY8M!w$r_@nza5r7IFvVUuwo0BnkHRJabVB zYbc)`vMb|Q$Cfh9Q?|h{mVnOR17rPknS>2GDw zqB!KM11E*>lequ@00000BZZG(Par|Saot+V_e5DyoGPu}6wrs2)*b{WX^g7Cr#Dfn z{0RcUfSrkv<}k-bulqWeSWtCprMMME^w%r!1o5jzMjd^ZYwN1~E3hs6WNb4T&|aTT zvxL%A2N+?(6RZm5u3dV^(n;~*>cc;zSml(5?TBpH#3+Y$2iud-y!9iaox?NRFMg+m zy(NpudV@}9PE`h?LVvtE!HnQYRS>S20TNg_fgBt{skx>Qow~hyQW#bLr5TPHy0#;8 f*#G`Jf`aWu3LvyZGpwEI4ec*gifBte00000i12qF literal 0 HcmV?d00001 diff --git a/boards/beagle/beaglebone_ai64/doc/index.rst b/boards/beagle/beaglebone_ai64/doc/index.rst new file mode 100644 index 0000000000000..b5c69a818f305 --- /dev/null +++ b/boards/beagle/beaglebone_ai64/doc/index.rst @@ -0,0 +1,129 @@ +.. _beaglebone_ai64: + +BeagleBone AI-64 +################ + +Overview +******** + +BeagleBone AI-64 is a computational platform powered by TI J721E SoC, which is +targeted for automotive applications. + +.. figure:: assets/bbai_64.webp + :align: center + :width: 600px + :alt: BeagleBoard.org BeagleBone AI-64 + +Hardware +******** + +BeagleBone AI-64 is powered by TI J721E SoC, which has three domains (MAIN, +MCU, WKUP). This document gives overview of Zephyr running on Cortex R5's +in the MAIN domain. + +L1 Memory System +---------------- + +* 16 KB instruction cache. +* 16 KB data cache. +* 64 KB TCM. + +Region Address Translation +-------------------------- + +The RAT module performs a region based address translation. It translates a +32-bit input address into a 48-bit output address. Any input transaction that +starts inside of a programmed region will have its address translated, if the +region is enabled. + +VIM Interrupt Controller +------------------------ + +The VIM aggregates device interrupts and sends them to the R5F CPU(s). The VIM +module supports 512 interrupt inputs per R5F core. Each interrupt can be either +a level or a pulse (both active-high). The VIM has two interrupt outputs per core +IRQ and FIQ. + +Supported Features +****************** + +The board configuration supports, + ++-----------+------------+-----------------------+ +| Interface | Controller | Driver/Component | ++===========+============+=======================+ +| UART | on-chip | serial port-polling | +| | | serial port-interrupt | ++-----------+------------+-----------------------+ + +Other hardwares features are currently not supported. + +Running Zephyr +************** + +The J721E does not have a separate flash for the R5 cores. Because of this +the A72 core has to load the program for the R5 cores to the right memory +address, set the PC and start the processor. +This can be done from Linux on the A72 core via remoteproc. + +By default the R5's Memory Protection Unit (MPU) only allows for execution of +instructions in the ATCM/BTCM. There is also a couple regions of DRAM memory +carved out for each R5 by Linux. These can be used for IPC (DDR0) and for +data (DDR1). DDR1 can also be used for executable regions after programming +the MPU. + +This is the memory mapping from A72 to the memory usable by the R5. Note that +the R5 cores always see their local ATCM at address 0x00000000 and their BTCM +at address 0x41010000. The ATCM/BTCM locations are fixed in hardware, but the +DDR regions are by convention. If you would like to use different DRAM +locations or sizes, you must also update for the same on the A72 software. +(For Linux as the A72 host, this would be changed in Device Tree). + ++------------+--------------+--------------+--------------+--------------+--------+ +| Region | R5FSS0 Core0 | R5FSS0 Core1 | R5FSS1 Core0 | R5FSS1 Core1 | Size | ++============+==============+==============+==============+==============+========+ +| ATCM | 0x05c00000 | 0x05d00000 | 0x05e00000 | 0x05f00000 | 32KB | ++------------+--------------+--------------+--------------+--------------+--------+ +| BTCM | 0x05c10000 | 0x05d10000 | 0x05e10000 | 0x05f00000 | 32KB | ++------------+--------------+--------------+--------------+--------------+--------+ +| DDR0 | 0xA2000000 | 0xA3000000 | 0xA4000000 | 0xA5000000 | 1MB | ++------------+--------------+--------------+--------------+--------------+--------+ +| DDR1 | 0xA2100000 | 0xA3000000 | 0xA4100000 | 0xA5000000 | 15MB | ++------------+--------------+--------------+--------------+--------------+--------+ + +Steps to build and run an image +------------------------------- + +Here is an example for the :zephyr:code-sample:`hello_world` application +targeting one of the Cortex R5F on BeagleBone AI-64: + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: beaglebone_ai64/j721e/main_r5f0_0 + :goals: build + +To load the image: + +| Copy Zephyr image to the /lib/firmware/ directory. +| ``cp build/zephyr/zephyr.elf /lib/firmware/`` +| +| Ensure the core is not running. +| ``echo stop > /dev/remoteproc/j7-main-r5f0_0/state`` +| +| Configuring the image name to the remoteproc module. +| ``echo zephyr.elf > /dev/remoteproc/j7-main-r5f0_0/firmware`` +| +| Once the image name is configured, send the start command. +| ``echo start > /dev/remoteproc/j7-main-r5f0_0/state`` + +Console +------- + +Zephyr on BeagleBone AI-64 J721E Cortex R5 uses UART 2 (Rx p8.22, Tx p8.34) +as console. + +References +********** + +* `BeagleBone AI-64 Homepage `_ +* `J721E TRM `_ From 9d0da02fbd386ec002b5becf0535a69f31488e62 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Thu, 10 Oct 2024 10:25:32 -0500 Subject: [PATCH 1366/4482] soc: ti: k3: Select PINCTRL in UART driver not Kconfig.defconfig The default configuration for PINCTRL should not be set with the other default configurations in .defconfig, instead select a default value as part of defining the UART driver. Signed-off-by: Andrew Davis --- boards/ti/sk_am62/sk_am62_am6234_m4_defconfig | 3 --- drivers/serial/Kconfig.ns16550 | 1 + soc/ti/k3/am6x/Kconfig.defconfig | 3 --- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/boards/ti/sk_am62/sk_am62_am6234_m4_defconfig b/boards/ti/sk_am62/sk_am62_am6234_m4_defconfig index 8ed54c6554e03..329040d31bdf2 100644 --- a/boards/ti/sk_am62/sk_am62_am6234_m4_defconfig +++ b/boards/ti/sk_am62/sk_am62_am6234_m4_defconfig @@ -11,9 +11,6 @@ CONFIG_CORTEX_M_SYSTICK=y # Zephyr Kernel Configuration CONFIG_XIP=n -# Enable Pinctrl -CONFIG_PINCTRL=y - # Serial Driver CONFIG_SERIAL=y diff --git a/drivers/serial/Kconfig.ns16550 b/drivers/serial/Kconfig.ns16550 index d919de2f1b6c8..fb7bcebe098ae 100644 --- a/drivers/serial/Kconfig.ns16550 +++ b/drivers/serial/Kconfig.ns16550 @@ -69,6 +69,7 @@ config UART_NS16550_ACCESS_WORD_ONLY config UART_NS16550_TI_K3 bool "Add support for NS16550 variant specific to TI K3 SoCs" + select PINCTRL help Enabling this configuration allows the users to use the UART port in Texas Instruments K3 SoCs by enabling a vendor specific extended register diff --git a/soc/ti/k3/am6x/Kconfig.defconfig b/soc/ti/k3/am6x/Kconfig.defconfig index 9555905beecde..3183487e2e375 100644 --- a/soc/ti/k3/am6x/Kconfig.defconfig +++ b/soc/ti/k3/am6x/Kconfig.defconfig @@ -27,9 +27,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC default 200000000 if SOC_SERIES_AM6X_A53 default 19200000 if SOC_SERIES_AM6X_R5 -config PINCTRL - default y - if SERIAL config UART_NS16550 From 5965ffea86475ddef6eb579ff316d31b3e165f6b Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Tue, 24 Sep 2024 14:11:18 +0200 Subject: [PATCH 1367/4482] Bluetooth: BAP: Dont discover ASE CP if ASE not found Added a check in unicast_client_ase_discover_cb that if no ASE was discovered, then it would stop the discovery there instead of attempting to call unicast_client_ase_cp_discover to discover the control point which would not be useful to use anyhow. This terminates the discovery earlier in case of the remote side not supporting the audio direction we are discovering. Signed-off-by: Emil Gydesen --- subsys/bluetooth/audio/bap_unicast_client.c | 50 ++++++++++++++++----- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/subsys/bluetooth/audio/bap_unicast_client.c b/subsys/bluetooth/audio/bap_unicast_client.c index 4107a79c5542d..91f7850efb293 100644 --- a/subsys/bluetooth/audio/bap_unicast_client.c +++ b/subsys/bluetooth/audio/bap_unicast_client.c @@ -66,6 +66,7 @@ BUILD_ASSERT(CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT == 0 || LOG_MODULE_REGISTER(bt_bap_unicast_client, CONFIG_BT_BAP_UNICAST_CLIENT_LOG_LEVEL); #define PAC_DIR_UNUSED(dir) ((dir) != BT_AUDIO_DIR_SINK && (dir) != BT_AUDIO_DIR_SOURCE) +#define BAP_HANDLE_UNUSED 0x0000U struct bt_bap_unicast_client_ep { uint16_t handle; uint16_t cp_handle; @@ -1521,7 +1522,7 @@ static uint8_t unicast_client_cp_notify(struct bt_conn *conn, if (!data) { LOG_DBG("Unsubscribed"); - params->value_handle = 0x0000; + params->value_handle = BAP_HANDLE_UNUSED; return BT_GATT_ITER_STOP; } @@ -1760,7 +1761,7 @@ static uint8_t unicast_client_ep_notify(struct bt_conn *conn, if (!data) { LOG_DBG("Unsubscribed"); - params->value_handle = 0x0000; + params->value_handle = BAP_HANDLE_UNUSED; return BT_GATT_ITER_STOP; } @@ -2231,8 +2232,8 @@ static void unicast_client_reset(struct bt_bap_ep *ep, uint8_t reason) (void)k_work_cancel_delayable(&client_ep->ase_read_work); (void)memset(ep, 0, sizeof(*ep)); - client_ep->cp_handle = 0U; - client_ep->handle = 0U; + client_ep->cp_handle = BAP_HANDLE_UNUSED; + client_ep->handle = BAP_HANDLE_UNUSED; (void)memset(&client_ep->discover, 0, sizeof(client_ep->discover)); client_ep->release_requested = false; client_ep->cp_ntf_pending = false; @@ -3694,6 +3695,27 @@ static uint8_t unicast_client_ase_read_func(struct bt_conn *conn, uint8_t err, return BT_GATT_ITER_STOP; } +static bool any_ases_found(const struct unicast_client *client) +{ + /* We always allocate ases from 0 to X, so to verify if any sink or source ASEs have been + * found we can just check the first index + */ +#if CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT > 0 + if (client->dir == BT_AUDIO_DIR_SINK && client->snks[0].handle == BAP_HANDLE_UNUSED) { + LOG_DBG("No sink ASEs found"); + return false; + } +#endif /* CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT > 0 */ +#if CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT > 0 + if (client->dir == BT_AUDIO_DIR_SOURCE && client->srcs[0].handle == BAP_HANDLE_UNUSED) { + LOG_DBG("No source ASEs found"); + return false; + } +#endif /* CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT > 0 */ + + return true; +} + static uint8_t unicast_client_ase_discover_cb(struct bt_conn *conn, const struct bt_gatt_attr *attr, struct bt_gatt_discover_params *discover) @@ -3703,12 +3725,18 @@ static uint8_t unicast_client_ase_discover_cb(struct bt_conn *conn, uint16_t value_handle; int err; + client = &uni_cli_insts[bt_conn_index(conn)]; + if (attr == NULL) { - err = unicast_client_ase_cp_discover(conn); - if (err != 0) { - LOG_ERR("Unable to discover ASE Control Point"); + if (!any_ases_found(client)) { + unicast_client_discover_complete(conn, BT_ATT_ERR_ATTRIBUTE_NOT_FOUND); + } else { + err = unicast_client_ase_cp_discover(conn); + if (err != 0) { + LOG_ERR("Unable to discover ASE Control Point"); - unicast_client_discover_complete(conn, err); + unicast_client_discover_complete(conn, err); + } } return BT_GATT_ITER_STOP; @@ -3718,8 +3746,6 @@ static uint8_t unicast_client_ase_discover_cb(struct bt_conn *conn, value_handle = chrc->value_handle; memset(discover, 0, sizeof(*discover)); - client = &uni_cli_insts[bt_conn_index(conn)]; - LOG_DBG("conn %p attr %p handle 0x%04x dir %s", conn, attr, value_handle, bt_audio_dir_str(client->dir)); @@ -3814,7 +3840,7 @@ static uint8_t unicast_client_pacs_avail_ctx_notify_cb(struct bt_conn *conn, if (!data) { LOG_DBG("Unsubscribed"); - params->value_handle = 0x0000; + params->value_handle = BAP_HANDLE_UNUSED; return BT_GATT_ITER_STOP; } @@ -3990,7 +4016,7 @@ static uint8_t unicast_client_pacs_location_notify_cb(struct bt_conn *conn, if (!data) { LOG_DBG("Unsubscribed"); - params->value_handle = 0x0000; + params->value_handle = BAP_HANDLE_UNUSED; return BT_GATT_ITER_STOP; } From 52bd2ff9a6ca160aef22fb60b649eb874523502c Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Thu, 10 Oct 2024 23:11:22 +0300 Subject: [PATCH 1368/4482] soc: intel_adsp: tools: continue cavstool.py legacy cleanup Clean up code documentation to drop references to platforms no longer supported in the code. Continues the cleanup started in commit 086e4f84ed33544592ccf8968b38aef4efd4a3eb ("intel_adsp: cavstool: Remove legacy code"). Signed-off-by: Kai Vehmanen --- soc/intel/intel_adsp/tools/cavstool.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/soc/intel/intel_adsp/tools/cavstool.py b/soc/intel/intel_adsp/tools/cavstool.py index aa59f4fdc80c0..a575ec6b3bb89 100755 --- a/soc/intel/intel_adsp/tools/cavstool.py +++ b/soc/intel/intel_adsp/tools/cavstool.py @@ -289,10 +289,10 @@ def map_regs(log_only): else: dsp.ADSPCS = 0x00004 dsp.HIPCTDR = 0x000c0 - dsp.HIPCTDA = 0x000c4 # 1.8+ only + dsp.HIPCTDA = 0x000c4 dsp.HIPCTDD = 0x000c8 dsp.HIPCIDR = 0x000d0 - dsp.HIPCIDA = 0x000d4 # 1.8+ only + dsp.HIPCIDA = 0x000d4 dsp.HIPCIDD = 0x000d8 dsp.ROM_STATUS = WINDOW_BASE # Start of first SRAM window dsp.SRAM_FW_STATUS = WINDOW_BASE @@ -443,10 +443,7 @@ def load_firmware(fw_file): hda.SPBFCTL |= (1 << hda_ostream_id) hda.SD_SPIB = len(fw_bytes) - # Start DSP. Host needs to provide power to all cores on 1.5 - # (which also starts them) and 1.8 (merely gates power, DSP also - # has to set PWRCTL). On 2.5 where the DSP has full control, - # and only core 0 is set. + # Start DSP. Only start up core 0, reset is managed by DSP. log.info(f"Starting DSP, ADSPCS = 0x{dsp.ADSPCS:x}") dsp.ADSPCS = mask(SPA) while (dsp.ADSPCS & mask(CPA)) == 0: pass @@ -469,8 +466,7 @@ def load_firmware(fw_file): # Send the DSP an IPC message to tell the device how to boot. # Note: with cAVS 1.8+ the ROM receives the stream argument as an # index within the array of output streams (and we always use the - # first one by construction). But with 1.5 it's the HDA index, - # and depends on the number of input streams on the device. + # first one by construction). stream_idx = 0 ipcval = ( (1 << 31) # BUSY bit | (0x01 << 24) # type = PURGE_FW @@ -576,8 +572,7 @@ def load_firmware_ace(fw_file): # Send the DSP an IPC message to tell the device how to boot. # Note: with cAVS 1.8+ the ROM receives the stream argument as an # index within the array of output streams (and we always use the - # first one by construction). But with 1.5 it's the HDA index, - # and depends on the number of input streams on the device. + # first one by construction). stream_idx = 0 ipcval = ( (1 << 31) # BUSY bit | (0x01 << 24) # type = PURGE_FW @@ -909,7 +904,7 @@ def ipc_command(data, ext_data): return if adsp_is_ace(): - dsp.HFIPCXTDR = 1<<31 # Ack local interrupt, also signals DONE on v1.5 + dsp.HFIPCXTDR = 1<<31 # Ack local interrupt if done: dsp.HFIPCXTDA = ~(1<<31) & dsp.HFIPCXTDA # Signal done if send_msg: @@ -917,7 +912,7 @@ def ipc_command(data, ext_data): dsp.HFIPCXIDDY = ext_data dsp.HFIPCXIDR = (1<<31) | ext_data else: - dsp.HIPCTDR = 1<<31 # Ack local interrupt, also signals DONE on v1.5 + dsp.HIPCTDR = 1<<31 # Ack local interrupt if done: dsp.HIPCTDA = 1<<31 # Signal done if send_msg: From 8795a17fa210f32d3362e0d00bbd85371b697400 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Thu, 10 Oct 2024 23:13:59 +0300 Subject: [PATCH 1369/4482] soc: intel_adsp: tools: reword cavstool.py startup log message The "Detected cAVS 1.8+ hardware" message is misleading as it implies some version of Intel cAVS hardware has been found, while in fact this script supports also other types of hardware, including Intel ACE. Signed-off-by: Kai Vehmanen --- soc/intel/intel_adsp/tools/cavstool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/intel/intel_adsp/tools/cavstool.py b/soc/intel/intel_adsp/tools/cavstool.py index a575ec6b3bb89..97124314dbc4a 100755 --- a/soc/intel/intel_adsp/tools/cavstool.py +++ b/soc/intel/intel_adsp/tools/cavstool.py @@ -944,7 +944,7 @@ async def main(): log.error(e) sys.exit(1) - log.info(f"Detected cAVS 1.8+ hardware") + log.info(f"Detected a supported cAVS/ACE hardware version") if args.log_only: wait_fw_entered(dsp, timeout_s=None) From 2c79024b2f71ee3e637802dc91370f2232ac7255 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Fri, 11 Oct 2024 18:32:09 +0300 Subject: [PATCH 1370/4482] soc: intel_adsp: tools: cavstool.py: add PCI DIDs for Intel Arrow Lake Add PCI device IDs for two Intel Arrow Lake variants. Signed-off-by: Kai Vehmanen --- soc/intel/intel_adsp/tools/cavstool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/intel/intel_adsp/tools/cavstool.py b/soc/intel/intel_adsp/tools/cavstool.py index 97124314dbc4a..6f99e0ec475f3 100755 --- a/soc/intel/intel_adsp/tools/cavstool.py +++ b/soc/intel/intel_adsp/tools/cavstool.py @@ -218,7 +218,7 @@ def map_regs(log_only): global cavs25, ace15, ace20, ace30 did = int(open(f"{pcidir}/device").read().rstrip(), 16) cavs25 = did in [ 0xa0c8, 0x43c8, 0x4b55, 0x4b58, 0x7ad0, 0x51c8 ] - ace15 = did in [ 0x7e28 ] + ace15 = did in [ 0x7728, 0x7f50, 0x7e28 ] ace20 = did in [ 0xa828 ] ace30 = did in [ 0xe428 ] From 7ad012d3bbd13913a82b00ff3b89e09c29265a3a Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Fri, 11 Oct 2024 18:37:50 +0300 Subject: [PATCH 1371/4482] soc: intel_adsp: tools: sort cAVS2.5 PCI DIDs in cavstool.py Numerically sort the PCI DIDs for cAVS2.5 hardware. This follows the convention in e.g. Linux and coreboot and eases maintainance. No functional change. Signed-off-by: Kai Vehmanen --- soc/intel/intel_adsp/tools/cavstool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/intel/intel_adsp/tools/cavstool.py b/soc/intel/intel_adsp/tools/cavstool.py index 6f99e0ec475f3..051d9ae0bc5b2 100755 --- a/soc/intel/intel_adsp/tools/cavstool.py +++ b/soc/intel/intel_adsp/tools/cavstool.py @@ -217,7 +217,7 @@ def map_regs(log_only): # Platform/quirk detection. ID lists cribbed from the SOF kernel driver global cavs25, ace15, ace20, ace30 did = int(open(f"{pcidir}/device").read().rstrip(), 16) - cavs25 = did in [ 0xa0c8, 0x43c8, 0x4b55, 0x4b58, 0x7ad0, 0x51c8 ] + cavs25 = did in [ 0x43c8, 0x4b55, 0x4b58, 0x51c8, 0x7ad0, 0xa0c8 ] ace15 = did in [ 0x7728, 0x7f50, 0x7e28 ] ace20 = did in [ 0xa828 ] ace30 = did in [ 0xe428 ] From 475878428c11efa3152eb32bfc60efac5431b71a Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Fri, 11 Oct 2024 18:43:58 +0300 Subject: [PATCH 1372/4482] soc: intel_adsp: tools: cavstool.py: add RPL and ADL-N support Add PCI device IDs for common Intel Raptor Lake variants and Alder Lake N. These all have cAVS2.5 audio DSP. Signed-off-by: Kai Vehmanen --- soc/intel/intel_adsp/tools/cavstool.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/soc/intel/intel_adsp/tools/cavstool.py b/soc/intel/intel_adsp/tools/cavstool.py index 051d9ae0bc5b2..8f2f55e6c5708 100755 --- a/soc/intel/intel_adsp/tools/cavstool.py +++ b/soc/intel/intel_adsp/tools/cavstool.py @@ -217,7 +217,8 @@ def map_regs(log_only): # Platform/quirk detection. ID lists cribbed from the SOF kernel driver global cavs25, ace15, ace20, ace30 did = int(open(f"{pcidir}/device").read().rstrip(), 16) - cavs25 = did in [ 0x43c8, 0x4b55, 0x4b58, 0x51c8, 0x7ad0, 0xa0c8 ] + cavs25 = did in [ 0x43c8, 0x4b55, 0x4b58, 0x51c8, 0x51ca, 0x51cb, 0x51ce, 0x51cf, 0x54c8, + 0x7ad0, 0xa0c8 ] ace15 = did in [ 0x7728, 0x7f50, 0x7e28 ] ace20 = did in [ 0xa828 ] ace30 = did in [ 0xe428 ] From 4fdcd229f297168eaabee69793a502cfdd187418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Fri, 18 Oct 2024 10:11:45 +0200 Subject: [PATCH 1373/4482] net: sockets: remove reference to async socket service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit remove reference to async socket service Signed-off-by: Fin Maaß --- subsys/net/lib/sockets/Kconfig | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/subsys/net/lib/sockets/Kconfig b/subsys/net/lib/sockets/Kconfig index 63b9549bf5104..b46a871467c71 100644 --- a/subsys/net/lib/sockets/Kconfig +++ b/subsys/net/lib/sockets/Kconfig @@ -119,20 +119,13 @@ config NET_SOCKETS_SERVICE_THREAD_PRIO depends on NET_SOCKETS_SERVICE help Set the priority of the socket service dispatcher thread. This handler - polls the sockets and either places the triggered socket to work queue - for asynchronous handlers, or calls the user supplied callback directly - for synchronous handlers. - The value should be selected carefully because if this thread priority - is too high, the work queue handlers might not be able to run if using - asynchronous handlers that are called via a work queue. + polls the sockets and calls the user supplied callback directly. Note that >= 0 value means preemptive thread priority, the lowest value is NUM_PREEMPT_PRIORITIES. Highest preemptive thread priority is 0. Lowest cooperative thread priority is -1. Highest cooperative thread priority is -NUM_COOP_PRIORITIES. - Make sure the priority is lower than workqueue priority so that - we never block the workqueue handler. config NET_SOCKETS_SERVICE_STACK_SIZE int "Stack size for the thread handling socket services" From 75d2a4dfcf955f7b7c270844fdbfb7fd8ac1c761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Fri, 18 Oct 2024 10:14:16 +0200 Subject: [PATCH 1374/4482] lib: shell: net: sockets: service: don't show type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit as the async type got removed, there is only one type left, so no need to show that. Signed-off-by: Fin Maaß --- subsys/net/lib/shell/sockets.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/subsys/net/lib/shell/sockets.c b/subsys/net/lib/shell/sockets.c index f41e17329e5e4..f92a8b74ebde3 100644 --- a/subsys/net/lib/shell/sockets.c +++ b/subsys/net/lib/shell/sockets.c @@ -123,10 +123,7 @@ static void walk_socket_services(const struct net_socket_service_desc *svc, snprintk(owner, sizeof(owner), ""); #endif - PR("%32s %-6s %-5d %s\n", - owner, - svc->pev->work.handler == NULL ? "SYNC" : "ASYNC", - svc->pev_len, pev_output); + PR("%32s %-5d %s\n", owner, svc->pev_len, pev_output); (*count)++; } @@ -183,8 +180,7 @@ static int cmd_net_sockets(const struct shell *sh, size_t argc, char *argv[]) svc_user_data.user_data = &svc_count; PR("Services:\n"); - PR("%32s %-6s %-5s %s\n", - "Owner", "Mode", "Count", "FDs"); + PR("%32s %-5s %s\n", "Owner", "Count", "FDs"); PR("\n"); net_socket_service_foreach(walk_socket_services, (void *)&svc_user_data); From 1f23e769c090a64170e87b651f23cd1d6441e134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Fri, 18 Oct 2024 10:20:59 +0200 Subject: [PATCH 1375/4482] net: sockets: socket_service: optimize code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit optimize code for the net socket service. Signed-off-by: Fin Maaß --- include/zephyr/net/socket_service.h | 2 -- subsys/net/lib/sockets/sockets_service.c | 10 ++++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/include/zephyr/net/socket_service.h b/include/zephyr/net/socket_service.h index bc96a7f9dd659..e63703f5d1e25 100644 --- a/include/zephyr/net/socket_service.h +++ b/include/zephyr/net/socket_service.h @@ -81,8 +81,6 @@ struct net_socket_service_desc { #define __z_net_socket_svc_get_idx(_svc_id) __z_net_socket_service_idx_##_svc_id #define __z_net_socket_svc_get_owner __FILE__ ":" STRINGIFY(__LINE__) -extern void net_socket_service_callback(struct k_work *work); - #if CONFIG_NET_SOCKETS_LOG_LEVEL >= LOG_LEVEL_DBG #define NET_SOCKET_SERVICE_OWNER .owner = __z_net_socket_svc_get_owner, #else diff --git a/subsys/net/lib/sockets/sockets_service.c b/subsys/net/lib/sockets/sockets_service.c index 81d6d2e331e11..e767bacaf9cbf 100644 --- a/subsys/net/lib/sockets/sockets_service.c +++ b/subsys/net/lib/sockets/sockets_service.c @@ -119,10 +119,8 @@ static struct net_socket_service_desc *find_svc_and_event( * round will not notice it and call the callback again while we are * servicing the callback. */ -void net_socket_service_callback(struct k_work *work) +void net_socket_service_callback(struct net_socket_service_event *pev) { - struct net_socket_service_event *pev = - CONTAINER_OF(work, struct net_socket_service_event, work); struct net_socket_service_desc *svc = pev->svc; struct net_socket_service_event ev = *pev; @@ -136,7 +134,7 @@ void net_socket_service_callback(struct k_work *work) } } -static int call_work(struct zsock_pollfd *pev, struct k_work *work) +static int call_work(struct zsock_pollfd *pev, struct net_socket_service_event *event) { int ret = 0; @@ -146,7 +144,7 @@ static int call_work(struct zsock_pollfd *pev, struct k_work *work) pev->fd = -1; /* Synchronous call */ - net_socket_service_callback(work); + net_socket_service_callback(event); return ret; @@ -169,7 +167,7 @@ static int trigger_work(struct zsock_pollfd *pev) */ event->event = *pev; - return call_work(pev, &event->work); + return call_work(pev, event); } static void socket_service_thread(void) From 03a5f417d12d1cb7bfac3c9981b9f460758e79d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Fri, 18 Oct 2024 10:44:01 +0200 Subject: [PATCH 1376/4482] net: sockets: socket_service: remove k_work related code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit remove k_work related code and change the argument of the callback to `struct net_socket_service_event`. Signed-off-by: Fin Maaß --- include/zephyr/net/socket_service.h | 14 +++++++++++--- samples/net/sockets/echo_service/src/main.c | 8 ++------ subsys/net/lib/dhcpv4/dhcpv4_server.c | 4 +--- subsys/net/lib/dns/dispatcher.c | 4 +--- subsys/net/lib/dns/llmnr_responder.c | 6 ++---- subsys/net/lib/dns/mdns_responder.c | 2 +- subsys/net/lib/dns/resolve.c | 2 +- subsys/net/lib/sockets/sockets_service.c | 2 +- subsys/net/lib/zperf/zperf_tcp_receiver.c | 6 ++---- subsys/net/lib/zperf/zperf_udp_receiver.c | 6 ++---- subsys/shell/backends/shell_telnet.c | 6 ++---- subsys/shell/backends/shell_websocket.c | 6 ++---- tests/net/socket/service/src/main.c | 10 ++-------- 13 files changed, 30 insertions(+), 46 deletions(-) diff --git a/include/zephyr/net/socket_service.h b/include/zephyr/net/socket_service.h index e63703f5d1e25..4b6aaf23bbbd2 100644 --- a/include/zephyr/net/socket_service.h +++ b/include/zephyr/net/socket_service.h @@ -32,15 +32,23 @@ extern "C" { #endif +struct net_socket_service_event; + +/** @brief The signature for a net socket service handler function. + * + * The function will be invoked by the socket service. + * + * @param pev the socket service event that provided the handler. + */ +typedef void (*net_socket_service_handler_t)(struct net_socket_service_event *pev); + /** * This struct contains information which socket triggered * calls to the callback function. */ struct net_socket_service_event { - /** k_work that is done when there is desired activity in file descriptor. */ - struct k_work work; /** Callback to be called for desired socket activity */ - k_work_handler_t callback; + net_socket_service_handler_t callback; /** Socket information that triggered this event. */ struct zsock_pollfd event; /** User data */ diff --git a/samples/net/sockets/echo_service/src/main.c b/samples/net/sockets/echo_service/src/main.c index 2b44c899e58c6..d1728049f2176 100644 --- a/samples/net/sockets/echo_service/src/main.c +++ b/samples/net/sockets/echo_service/src/main.c @@ -34,10 +34,8 @@ static struct pollfd sockfd_tcp[1] = { static void receive_data(bool is_udp, struct net_socket_service_event *pev, char *buf, size_t buflen); -static void tcp_service_handler(struct k_work *work) +static void tcp_service_handler(struct net_socket_service_event *pev) { - struct net_socket_service_event *pev = - CONTAINER_OF(work, struct net_socket_service_event, work); static char buf[1500]; /* Note that in this application we receive / send data from @@ -48,10 +46,8 @@ static void tcp_service_handler(struct k_work *work) receive_data(false, pev, buf, sizeof(buf)); } -static void udp_service_handler(struct k_work *work) +static void udp_service_handler(struct net_socket_service_event *pev) { - struct net_socket_service_event *pev = - CONTAINER_OF(work, struct net_socket_service_event, work); static char buf[1500]; receive_data(true, pev, buf, sizeof(buf)); diff --git a/subsys/net/lib/dhcpv4/dhcpv4_server.c b/subsys/net/lib/dhcpv4/dhcpv4_server.c index 8aca61963df33..d56bf83f33b41 100644 --- a/subsys/net/lib/dhcpv4/dhcpv4_server.c +++ b/subsys/net/lib/dhcpv4/dhcpv4_server.c @@ -1489,10 +1489,8 @@ static void dhcpv4_process_data(struct dhcpv4_server_ctx *ctx, uint8_t *data, k_mutex_unlock(&server_lock); } -static void dhcpv4_server_cb(struct k_work *work) +static void dhcpv4_server_cb(struct net_socket_service_event *evt) { - struct net_socket_service_event *evt = - CONTAINER_OF(work, struct net_socket_service_event, work); struct dhcpv4_server_ctx *ctx = NULL; uint8_t recv_buf[NET_IPV4_MTU]; int ret; diff --git a/subsys/net/lib/dns/dispatcher.c b/subsys/net/lib/dns/dispatcher.c index eecdf81ff5321..6b81dbc37b096 100644 --- a/subsys/net/lib/dns/dispatcher.c +++ b/subsys/net/lib/dns/dispatcher.c @@ -184,10 +184,8 @@ static int recv_data(struct net_socket_service_event *pev) return ret; } -void dns_dispatcher_svc_handler(struct k_work *work) +void dns_dispatcher_svc_handler(struct net_socket_service_event *pev) { - struct net_socket_service_event *pev = - CONTAINER_OF(work, struct net_socket_service_event, work); int ret; ret = recv_data(pev); diff --git a/subsys/net/lib/dns/llmnr_responder.c b/subsys/net/lib/dns/llmnr_responder.c index d41429f9d31dd..bf330e2437457 100644 --- a/subsys/net/lib/dns/llmnr_responder.c +++ b/subsys/net/lib/dns/llmnr_responder.c @@ -67,7 +67,7 @@ static struct net_mgmt_event_callback mgmt_cb; /* Socket polling for each server connection */ static struct zsock_pollfd fds[LLMNR_MAX_POLL]; -static void svc_handler(struct k_work *work); +static void svc_handler(struct net_socket_service_event *pev); NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(svc_llmnr, svc_handler, LLMNR_MAX_POLL); NET_BUF_POOL_DEFINE(llmnr_msg_pool, DNS_RESOLVER_BUF_CTR, @@ -564,10 +564,8 @@ static int recv_data(struct net_socket_service_event *pev) return ret; } -static void svc_handler(struct k_work *work) +static void svc_handler(struct net_socket_service_event *pev) { - struct net_socket_service_event *pev = - CONTAINER_OF(work, struct net_socket_service_event, work); int ret; ret = recv_data(pev); diff --git a/subsys/net/lib/dns/mdns_responder.c b/subsys/net/lib/dns/mdns_responder.c index 8c41c125f25ab..335543b61db20 100644 --- a/subsys/net/lib/dns/mdns_responder.c +++ b/subsys/net/lib/dns/mdns_responder.c @@ -49,7 +49,7 @@ LOG_MODULE_REGISTER(net_mdns_responder, CONFIG_MDNS_RESPONDER_LOG_LEVEL); #pragma GCC diagnostic ignored "-Wstringop-overread" #endif -extern void dns_dispatcher_svc_handler(struct k_work *work); +extern void dns_dispatcher_svc_handler(struct net_socket_service_event *pev); #define MDNS_LISTEN_PORT 5353 diff --git a/subsys/net/lib/dns/resolve.c b/subsys/net/lib/dns/resolve.c index 33514ecf553f6..21377cb0fa617 100644 --- a/subsys/net/lib/dns/resolve.c +++ b/subsys/net/lib/dns/resolve.c @@ -34,7 +34,7 @@ LOG_MODULE_REGISTER(net_dns_resolve, CONFIG_DNS_RESOLVER_LOG_LEVEL); #define DNS_SERVER_COUNT CONFIG_DNS_RESOLVER_MAX_SERVERS #define SERVER_COUNT (DNS_SERVER_COUNT + DNS_MAX_MCAST_SERVERS) -extern void dns_dispatcher_svc_handler(struct k_work *work); +extern void dns_dispatcher_svc_handler(struct net_socket_service_event *pev); NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(resolve_svc, dns_dispatcher_svc_handler, DNS_RESOLVER_MAX_POLL); diff --git a/subsys/net/lib/sockets/sockets_service.c b/subsys/net/lib/sockets/sockets_service.c index e767bacaf9cbf..827c78bc10b73 100644 --- a/subsys/net/lib/sockets/sockets_service.c +++ b/subsys/net/lib/sockets/sockets_service.c @@ -124,7 +124,7 @@ void net_socket_service_callback(struct net_socket_service_event *pev) struct net_socket_service_desc *svc = pev->svc; struct net_socket_service_event ev = *pev; - ev.callback(&ev.work); + ev.callback(&ev); /* Copy back the socket fd to the global array because we marked * it as -1 when triggering the work. diff --git a/subsys/net/lib/zperf/zperf_tcp_receiver.c b/subsys/net/lib/zperf/zperf_tcp_receiver.c index b4e63ac2da13e..3d7504313852d 100644 --- a/subsys/net/lib/zperf/zperf_tcp_receiver.c +++ b/subsys/net/lib/zperf/zperf_tcp_receiver.c @@ -39,7 +39,7 @@ static struct sockaddr tcp_server_addr; static struct zsock_pollfd fds[SOCK_ID_MAX]; static struct sockaddr sock_addr[SOCK_ID_MAX]; -static void tcp_svc_handler(struct k_work *work); +static void tcp_svc_handler(struct net_socket_service_event *pev); NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(svc_tcp, tcp_svc_handler, SOCK_ID_MAX); @@ -231,10 +231,8 @@ static int tcp_recv_data(struct net_socket_service_event *pev) return ret; } -static void tcp_svc_handler(struct k_work *work) +static void tcp_svc_handler(struct net_socket_service_event *pev) { - struct net_socket_service_event *pev = - CONTAINER_OF(work, struct net_socket_service_event, work); int ret; ret = tcp_recv_data(pev); diff --git a/subsys/net/lib/zperf/zperf_udp_receiver.c b/subsys/net/lib/zperf/zperf_udp_receiver.c index 085cbf6ac288e..c29fb022f255d 100644 --- a/subsys/net/lib/zperf/zperf_udp_receiver.c +++ b/subsys/net/lib/zperf/zperf_udp_receiver.c @@ -46,7 +46,7 @@ static struct sockaddr udp_server_addr; struct zsock_pollfd fds[SOCK_ID_MAX] = { 0 }; -static void udp_svc_handler(struct k_work *work); +static void udp_svc_handler(struct net_socket_service_event *pev); NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(svc_udp, udp_svc_handler, SOCK_ID_MAX); @@ -364,10 +364,8 @@ static int udp_recv_data(struct net_socket_service_event *pev) return ret; } -static void udp_svc_handler(struct k_work *work) +static void udp_svc_handler(struct net_socket_service_event *pev) { - struct net_socket_service_event *pev = - CONTAINER_OF(work, struct net_socket_service_event, work); int ret; ret = udp_recv_data(pev); diff --git a/subsys/shell/backends/shell_telnet.c b/subsys/shell/backends/shell_telnet.c index 862c7d80ac8be..d05570f6d0627 100644 --- a/subsys/shell/backends/shell_telnet.c +++ b/subsys/shell/backends/shell_telnet.c @@ -39,7 +39,7 @@ struct shell_telnet *sh_telnet; /* Basic TELNET implementation. */ -static void telnet_server_cb(struct k_work *work); +static void telnet_server_cb(struct net_socket_service_event *evt); static int telnet_init(struct shell_telnet *ctx); NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(telnet_server, telnet_server_cb, @@ -462,10 +462,8 @@ static void telnet_accept(struct zsock_pollfd *pollfd) } } -static void telnet_server_cb(struct k_work *work) +static void telnet_server_cb(struct net_socket_service_event *evt) { - struct net_socket_service_event *evt = - CONTAINER_OF(work, struct net_socket_service_event, work); int sock_error; socklen_t optlen = sizeof(int); diff --git a/subsys/shell/backends/shell_websocket.c b/subsys/shell/backends/shell_websocket.c index 27188020e87f5..28ff070483232 100644 --- a/subsys/shell/backends/shell_websocket.c +++ b/subsys/shell/backends/shell_websocket.c @@ -24,7 +24,7 @@ LOG_MODULE_REGISTER(shell_websocket, CONFIG_SHELL_WEBSOCKET_INIT_LOG_LEVEL); #define WEBSOCKET_MIN_COMMAND_LEN 2 #define WEBSOCKET_WILL_DO_COMMAND_LEN 3 -static void ws_server_cb(struct k_work *work); +static void ws_server_cb(struct net_socket_service_event *evt); NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(websocket_server, NULL, ws_server_cb, SHELL_WEBSOCKET_SERVICE_COUNT); @@ -157,10 +157,8 @@ static void ws_recv(struct shell_websocket *ws, struct zsock_pollfd *pollfd) ws_end_client_connection(ws); } -static void ws_server_cb(struct k_work *work) +static void ws_server_cb(struct net_socket_service_event *evt) { - struct net_socket_service_event *evt = - CONTAINER_OF(work, struct net_socket_service_event, work); socklen_t optlen = sizeof(int); struct shell_websocket *ws; int sock_error; diff --git a/tests/net/socket/service/src/main.c b/tests/net/socket/service/src/main.c index dc476cf92a585..4e90d71cb8934 100644 --- a/tests/net/socket/service/src/main.c +++ b/tests/net/socket/service/src/main.c @@ -31,21 +31,15 @@ K_SEM_DEFINE(wait_data, 0, UINT_MAX); K_SEM_DEFINE(wait_data_tcp, 0, UINT_MAX); #define WAIT_TIME 500 -static void server_handler(struct k_work *work) +static void server_handler(struct net_socket_service_event *pev) { - struct net_socket_service_event *pev = - CONTAINER_OF(work, struct net_socket_service_event, work); - ARG_UNUSED(pev); k_sem_give(&wait_data); } -static void tcp_server_handler(struct k_work *work) +static void tcp_server_handler(struct net_socket_service_event *pev) { - struct net_socket_service_event *pev = - CONTAINER_OF(work, struct net_socket_service_event, work); - ARG_UNUSED(pev); k_sem_give(&wait_data_tcp); From 74266e5c5aa55228f51228cab4bbd4fc6807fdb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Fri, 18 Oct 2024 10:55:32 +0200 Subject: [PATCH 1377/4482] doc: migration-guide: mention change of socket service callback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mention change of callback function for the socket service. Signed-off-by: Fin Maaß --- doc/releases/migration-guide-4.0.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index e41ae6e3ffe9b..e68dfb40271ac 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -502,6 +502,10 @@ Networking * The ``work_q`` parameter to ``NET_SOCKET_SERVICE_SYNC_DEFINE`` and ``NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC`` has been removed as it was always ignored. (:github:`79446`) +* The callback function for the socket service has changed. The + ``struct k_work *work`` parameter has been replaced with a pointer to the + ``struct net_socket_service_event *pev`` parameter. (:github:`80041`) + * Deprecated the :kconfig:option:`CONFIG_NET_SOCKETS_POLL_MAX` option in favour of :kconfig:option:`CONFIG_ZVFS_POLL_MAX`. From 1708837e7b7c053bd10234f90260a89a296bec19 Mon Sep 17 00:00:00 2001 From: Appana Durga Kedareswara rao Date: Wed, 25 Sep 2024 10:53:01 +0530 Subject: [PATCH 1378/4482] runners: add support for xsdb (Xilinx System Debugger) Add support for xsdb(Xilinx System Debugger) used with AMD's FPGA and SOC platforms, it is a user-friendly, interactive, and scriptable command line interface, by design choice it's expected that platforms to have xsdb scripts present inside their platform code. xsdb runner has bitstream and fsbl optional arguments, bitstream is needed for fpga targets and fsbl is needed for SOC targets, added support for both options. Signed-off-by: Appana Durga Kedareswara rao --- scripts/west_commands/runners/__init__.py | 1 + scripts/west_commands/runners/xsdb.py | 56 +++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 scripts/west_commands/runners/xsdb.py diff --git a/scripts/west_commands/runners/__init__.py b/scripts/west_commands/runners/__init__.py index f79ba2f0eeada..a4fbe843782e9 100644 --- a/scripts/west_commands/runners/__init__.py +++ b/scripts/west_commands/runners/__init__.py @@ -60,6 +60,7 @@ def _import_runner_module(runner_name): 'teensy', 'trace32', 'uf2', + 'xsdb', 'xtensa', # zephyr-keep-sorted-stop ] diff --git a/scripts/west_commands/runners/xsdb.py b/scripts/west_commands/runners/xsdb.py new file mode 100644 index 0000000000000..a20d5884a4554 --- /dev/null +++ b/scripts/west_commands/runners/xsdb.py @@ -0,0 +1,56 @@ +# Copyright (c) 2024 Advanced Micro Devices, Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +"""Runner for flashing with xsdb CLI, the official programming + utility from AMD platforms. +""" +import argparse +import os +from runners.core import ZephyrBinaryRunner, RunnerCaps, RunnerConfig + +class XSDBBinaryRunner(ZephyrBinaryRunner): + def __init__(self, cfg: RunnerConfig, config=None, bitstream=None, + fsbl=None): + super(XSDBBinaryRunner, self).__init__(cfg) + self.elf_file = cfg.elf_file + if not config: + cfgfile_path = os.path.join(cfg.board_dir, 'support') + default = os.path.join(cfgfile_path, 'xsdb.cfg') + if os.path.exists(default): + config = default + self.xsdb_cfg_file = config + self.bitstream = bitstream + self.fsbl = fsbl + + @classmethod + def name(cls): + return 'xsdb' + + @classmethod + def capabilities(cls): + return RunnerCaps(flash_addr=True) + + @classmethod + def do_add_parser(cls, parser): + parser.add_argument('--config', help='if given, override default config file') + parser.add_argument('--bitstream', help='path to the bitstream file') + parser.add_argument('--fsbl', help='path to the fsbl elf file') + + @classmethod + def do_create( + cls, cfg: RunnerConfig, args: argparse.Namespace + ) -> "XSDBBinaryRunner": + return XSDBBinaryRunner(cfg, config=args.config, + bitstream=args.bitstream, fsbl=args.fsbl) + + def do_run(self, command, **kwargs): + if self.bitstream and self.fsbl: + cmd = ['xsdb', self.xsdb_cfg_file, self.elf_file, self.bitstream, self.fsbl] + elif self.bitstream: + cmd = ['xsdb', self.xsdb_cfg_file, self.elf_file, self.bitstream] + elif self.fsbl: + cmd = ['xsdb', self.xsdb_cfg_file, self.elf_file, self.fsbl] + else: + cmd = ['xsdb', self.xsdb_cfg_file] + self.check_call(cmd) From 99a998a161741793acff3daa9afebaf884737554 Mon Sep 17 00:00:00 2001 From: Appana Durga Kedareswara rao Date: Sat, 19 Oct 2024 16:01:04 +0530 Subject: [PATCH 1379/4482] scripts: west_commands: tests: add pytest for xsdb runner Add pytest case for xsdb runner. Signed-off-by: Appana Durga Kedareswara rao --- scripts/west_commands/tests/test_imports.py | 1 + scripts/west_commands/tests/test_xsdb.py | 85 +++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 scripts/west_commands/tests/test_xsdb.py diff --git a/scripts/west_commands/tests/test_imports.py b/scripts/west_commands/tests/test_imports.py index d6afd20dffdf0..95d2c374a59fc 100644 --- a/scripts/west_commands/tests/test_imports.py +++ b/scripts/west_commands/tests/test_imports.py @@ -50,6 +50,7 @@ def test_runner_imports(): 'teensy', 'trace32', 'uf2', + 'xsdb', 'xtensa', # zephyr-keep-sorted-stop )) diff --git a/scripts/west_commands/tests/test_xsdb.py b/scripts/west_commands/tests/test_xsdb.py new file mode 100644 index 0000000000000..d64055b52917c --- /dev/null +++ b/scripts/west_commands/tests/test_xsdb.py @@ -0,0 +1,85 @@ +# Copyright (c) 2024 Advanced Micro Devices, Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +import argparse +from unittest.mock import patch, call +import pytest +from runners.xsdb import XSDBBinaryRunner +from conftest import RC_KERNEL_ELF + +TEST_CASES = [ + { + "config": None, + "bitstream": None, + "fsbl": None, + "expected_cmd": ["xsdb", "default_cfg_path"], + }, + { + "config": "custom_cfg_path", + "bitstream": None, + "fsbl": None, + "expected_cmd": ["xsdb", "custom_cfg_path"], + }, + { + "config": None, + "bitstream": "bitstream_path", + "fsbl": None, + "expected_cmd": ["xsdb", "default_cfg_path", RC_KERNEL_ELF, "bitstream_path"], + }, + { + "config": None, + "bitstream": None, + "fsbl": "fsbl_path", + "expected_cmd": ["xsdb", "default_cfg_path", RC_KERNEL_ELF, "fsbl_path"], + }, + { + "config": None, + "bitstream": "bitstream_path", + "fsbl": "fsbl_path", + "expected_cmd": ["xsdb", "default_cfg_path", RC_KERNEL_ELF, "bitstream_path", "fsbl_path"], + }, +] + +@pytest.mark.parametrize("tc", TEST_CASES) +@patch("runners.xsdb.os.path.exists", return_value=True) +@patch("runners.xsdb.XSDBBinaryRunner.check_call") +def test_xsdbbinaryrunner_init(check_call, path_exists, tc, runner_config): + '''Test actions using a runner created by constructor.''' + # Mock the default config path + with patch("runners.xsdb.os.path.join", return_value="default_cfg_path"): + runner = XSDBBinaryRunner( + cfg=runner_config, + config=tc["config"], + bitstream=tc["bitstream"], + fsbl=tc["fsbl"], + ) + + runner.do_run("flash") + + assert check_call.call_args_list == [call(tc["expected_cmd"])] + +@pytest.mark.parametrize("tc", TEST_CASES) +@patch("runners.xsdb.os.path.exists", return_value=True) +@patch("runners.xsdb.XSDBBinaryRunner.check_call") +def test_xsdbbinaryrunner_create(check_call, path_exists, tc, runner_config): + '''Test actions using a runner created from action line parameters.''' + args = [] + if tc["config"]: + args.extend(["--config", tc["config"]]) + if tc["bitstream"]: + args.extend(["--bitstream", tc["bitstream"]]) + if tc["fsbl"]: + args.extend(["--fsbl", tc["fsbl"]]) + + parser = argparse.ArgumentParser(allow_abbrev=False) + XSDBBinaryRunner.add_parser(parser) + arg_namespace = parser.parse_args(args) + + # Mock the default config path + with patch("runners.xsdb.os.path.join", return_value="default_cfg_path"): + runner = XSDBBinaryRunner.create(runner_config, arg_namespace) + + runner.do_run("flash") + + assert check_call.call_args_list == [call(tc["expected_cmd"])] From f087f528f80e49636be581e3ef5711f0fc89bbda Mon Sep 17 00:00:00 2001 From: Appana Durga Kedareswara rao Date: Fri, 18 Oct 2024 14:14:52 +0530 Subject: [PATCH 1380/4482] boards: amd: kv260_r5: update the board cmake to use xsdb runner Update the board cmake to use xsdb runner, If users would like to use default xsdb.cfg then need to pass the fsbl.elf binary via --fsbl option when using west flash or twister commands. Usage: 1) west flash --runner xsdb --elf-file kv260_r5/zephyr/zephyr.elf --fsbl /fsbl.elf 2) ./scripts/twister -p kv260_r5 --west-runner xsdb --device-testing --device-serial /dev/ttyUSB0 --west-flash="--fsbl=/fsbl.elf" Signed-off-by: Appana Durga Kedareswara rao --- boards/amd/kv260_r5/board.cmake | 1 + boards/amd/kv260_r5/support/xsdb.cfg | 24 ++++++++++++++++++++++++ boards/common/xsdb.board.cmake | 6 ++++++ 3 files changed, 31 insertions(+) create mode 100644 boards/amd/kv260_r5/support/xsdb.cfg create mode 100644 boards/common/xsdb.board.cmake diff --git a/boards/amd/kv260_r5/board.cmake b/boards/amd/kv260_r5/board.cmake index 029cda7417cbb..1b0954064849b 100644 --- a/boards/amd/kv260_r5/board.cmake +++ b/boards/amd/kv260_r5/board.cmake @@ -1,3 +1,4 @@ # Copyright (c) 2022 Linaro. # # SPDX-License-Identifier: Apache-2.0 +include(${ZEPHYR_BASE}/boards/common/xsdb.board.cmake) diff --git a/boards/amd/kv260_r5/support/xsdb.cfg b/boards/amd/kv260_r5/support/xsdb.cfg new file mode 100644 index 0000000000000..2976c9e763f12 --- /dev/null +++ b/boards/amd/kv260_r5/support/xsdb.cfg @@ -0,0 +1,24 @@ +# Copyright (c) 2024 Advanced Micro Devices, Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +proc load_image args { + set elf_file [lindex $args 0] + set fsblelf_file [lindex $args 1] + connect -url 127.0.0.1:3121 + after 2000 + targets -set -nocase -filter {name =~ "*R5*#0"} + rst -proc + dow $fsblelf_file + after 1000 + con + after 1000 + stop + targets -set -nocase -filter {name =~ "*R5*#0"} + after 2000 + dow $elf_file + con + exit +} + +load_image {*}$argv diff --git a/boards/common/xsdb.board.cmake b/boards/common/xsdb.board.cmake new file mode 100644 index 0000000000000..2d95922a9c646 --- /dev/null +++ b/boards/common/xsdb.board.cmake @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Advanced Micro Devices, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +board_set_debugger_ifnset(xsdb) +board_set_flasher_ifnset(xsdb) +board_finalize_runner_args(xsdb) From dbc8eaa5359bb23c00cebf92dc049ddbc312bd02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 18 Oct 2024 13:22:07 +0200 Subject: [PATCH 1381/4482] tests: drivers: can: api: Add negative test for can_add_rx_filter() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check that error is reported when CAN filter is added without callback function. Signed-off-by: Sebastian Głąb --- tests/drivers/can/api/src/classic.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/drivers/can/api/src/classic.c b/tests/drivers/can/api/src/classic.c index b762137f8cd27..c3e85015a658b 100644 --- a/tests/drivers/can/api/src/classic.c +++ b/tests/drivers/can/api/src/classic.c @@ -615,6 +615,19 @@ ZTEST(can_classic, test_add_filter) can_remove_rx_filter(can_dev, filter_id); } +/** + * @brief Test adding filter without callback. + */ +ZTEST(can_classic, test_add_filter_without_callback) +{ + int err; + + Z_TEST_SKIP_IFNDEF(CONFIG_RUNTIME_ERROR_CHECKS); + + err = can_add_rx_filter(can_dev, NULL, NULL, &test_std_filter_1); + zassert_equal(err, -EINVAL, "added filter with NULL callback"); +} + /** * @brief Test adding an invalid CAN RX filter. * From 13fbac86eb41702e9071552feea1d8f5f446dcbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 18 Oct 2024 13:36:34 +0200 Subject: [PATCH 1382/4482] tests: drivers: can: api: Add negative test for can_set_bitrate() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is negative test for too high bitrate. Add test that checks too low bitrate. Signed-off-by: Sebastian Głąb --- tests/drivers/can/api/src/classic.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/drivers/can/api/src/classic.c b/tests/drivers/can/api/src/classic.c index c3e85015a658b..cf852487aa962 100644 --- a/tests/drivers/can/api/src/classic.c +++ b/tests/drivers/can/api/src/classic.c @@ -486,6 +486,31 @@ ZTEST_USER(can_classic, test_bitrate_limits) zassert_true(min <= max, "min bitrate must be lower or equal to max bitrate"); } +/** + * @brief Test setting a too low bitrate. + */ +ZTEST_USER(can_classic, test_set_bitrate_too_low) +{ + uint32_t min = can_get_bitrate_min(can_dev); + int err; + + if (min == 0) { + ztest_test_skip(); + } + + err = can_stop(can_dev); + zassert_equal(err, 0, "failed to stop CAN controller (err %d)", err); + + err = can_set_bitrate(can_dev, min - 1); + zassert_equal(err, -ENOTSUP, "too low bitrate accepted"); + + err = can_set_bitrate(can_dev, CONFIG_CAN_DEFAULT_BITRATE); + zassert_equal(err, 0, "failed to restore default bitrate"); + + err = can_start(can_dev); + zassert_equal(err, 0, "failed to start CAN controller (err %d)", err); +} + /** * @brief Test setting a too high bitrate. */ From 2616720ee2a0c45732f6debba5581d9a8da0fffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 18 Oct 2024 13:49:05 +0200 Subject: [PATCH 1383/4482] tests: drivers: can: api: Add negative test for can_set_bitrate_data() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is negative test for too high data bitrate. Add test that checks too low data bitrate. Signed-off-by: Sebastian Głąb --- tests/drivers/can/api/src/canfd.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/drivers/can/api/src/canfd.c b/tests/drivers/can/api/src/canfd.c index 80703655d1fb9..38f7cc7346dc4 100644 --- a/tests/drivers/can/api/src/canfd.c +++ b/tests/drivers/can/api/src/canfd.c @@ -395,6 +395,31 @@ ZTEST_USER(canfd, test_set_timing_data_min) zassert_equal(err, 0, "failed to start CAN controller (err %d)", err); } +/** + * @brief Test setting a too low data phase bitrate. + */ +ZTEST_USER(canfd, test_set_bitrate_data_too_low) +{ + uint32_t min = can_get_bitrate_min(can_dev); + int err; + + if (min == 0) { + ztest_test_skip(); + } + + err = can_stop(can_dev); + zassert_equal(err, 0, "failed to stop CAN controller (err %d)", err); + + err = can_set_bitrate_data(can_dev, min - 1); + zassert_equal(err, -ENOTSUP, "too low data phase bitrate accepted"); + + err = can_set_bitrate_data(can_dev, CONFIG_CAN_DEFAULT_BITRATE_DATA); + zassert_equal(err, 0, "failed to restore default data bitrate"); + + err = can_start(can_dev); + zassert_equal(err, 0, "failed to start CAN controller (err %d)", err); +} + /** * @brief Test setting a too high data phase bitrate. */ From 8023a58c2a463cfcda1ffeaf41b0ea853bba0178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Fri, 18 Oct 2024 14:29:59 +0200 Subject: [PATCH 1384/4482] tests: drivers: can: api: Add negative test for can_send() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check error codes when sending invalid frames: - too big data payload; - wrong set of flags. Signed-off-by: Sebastian Głąb --- tests/drivers/can/api/src/canfd.c | 39 +++++++++++++++++++++++++++++ tests/drivers/can/api/src/classic.c | 27 ++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/tests/drivers/can/api/src/canfd.c b/tests/drivers/can/api/src/canfd.c index 38f7cc7346dc4..50e5d43add844 100644 --- a/tests/drivers/can/api/src/canfd.c +++ b/tests/drivers/can/api/src/canfd.c @@ -238,6 +238,45 @@ ZTEST(canfd, test_canfd_get_capabilities) "CAN FD loopback mode not supported"); } +/** + * @brief Test sending CAN FD frame with too big payload. + */ +ZTEST(canfd, test_send_fd_dlc_out_of_range) +{ + struct can_frame frame = { + .flags = CAN_FRAME_FDF | CAN_FRAME_BRS, + .id = TEST_CAN_STD_ID_1, + .dlc = CANFD_MAX_DLC + 1U, + }; + int err; + + Z_TEST_SKIP_IFNDEF(CONFIG_RUNTIME_ERROR_CHECKS); + + err = can_send(can_dev, &frame, TEST_SEND_TIMEOUT, NULL, NULL); + zassert_equal(err, -EINVAL, "wrong error on sending invalid frame (err %d)", err); +} + +/** + * @brief Test error when CAN FD Error State Indicator (ESI) is send without FD format flag (FDF). + * + * CAN FD Error State Indicator (ESI) indicates that the transmitting node is + * in error-passive state. Only valid in combination with CAN_FRAME_FDF. + */ +ZTEST(canfd, test_send_fd_incorrect_esi) +{ + struct can_frame frame = { + .flags = CAN_FRAME_ESI, + .id = TEST_CAN_STD_ID_1, + .dlc = 0, + }; + int err; + + Z_TEST_SKIP_IFNDEF(CONFIG_RUNTIME_ERROR_CHECKS); + + err = can_send(can_dev, &frame, TEST_SEND_TIMEOUT, NULL, NULL); + zassert_equal(err, -ENOTSUP, "wrong error on sending invalid frame (err %d)", err); +} + /** * @brief Test send/receive with standard (11-bit) CAN IDs and classic CAN frames. */ diff --git a/tests/drivers/can/api/src/classic.c b/tests/drivers/can/api/src/classic.c index cf852487aa962..9192d6612bc67 100644 --- a/tests/drivers/can/api/src/classic.c +++ b/tests/drivers/can/api/src/classic.c @@ -856,6 +856,33 @@ ZTEST(can_classic, test_send_ext_id_out_of_range) send_invalid_frame(can_dev, &frame); } +/** + * @brief Test sending standard (11-bit ID) CAN frame with too big payload. + */ +ZTEST(can_classic, test_send_std_id_dlc_of_range) +{ + struct can_frame frame = { + .id = TEST_CAN_STD_ID_1, + .dlc = CAN_MAX_DLC + 1U, + }; + + send_invalid_frame(can_dev, &frame); +} + +/** + * @brief Test sending extended (29-bit ID) CAN frame with too big payload. + */ +ZTEST(can_classic, test_send_ext_id_dlc_of_range) +{ + struct can_frame frame = { + .flags = CAN_FRAME_IDE, + .id = TEST_CAN_EXT_ID_1, + .dlc = CAN_MAX_DLC + 1U, + }; + + send_invalid_frame(can_dev, &frame); +} + /** * @brief Test send/receive with standard (11-bit) CAN IDs. */ From 1c180767529fdd6d8fbb73212103f3106aeebb22 Mon Sep 17 00:00:00 2001 From: Harry Jiang Date: Sat, 19 Oct 2024 23:56:44 +0800 Subject: [PATCH 1385/4482] boards: weact: mini_stm32h743: Fix flash size and partition size Ensured flash size and partition size are specified in bytes as required by the STM32 QSPI NOR driver. Signed-off-by: Harry Jiang --- boards/weact/mini_stm32h743/mini_stm32h743.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/boards/weact/mini_stm32h743/mini_stm32h743.dts b/boards/weact/mini_stm32h743/mini_stm32h743.dts index 9968b82d7d7b4..5ee5dea2076db 100644 --- a/boards/weact/mini_stm32h743/mini_stm32h743.dts +++ b/boards/weact/mini_stm32h743/mini_stm32h743.dts @@ -148,7 +148,7 @@ zephyr_udc0: &usbotg_fs { w25q64_qspi: qspi-nor-flash@90000000 { compatible = "st,stm32-qspi-nor"; - reg = <0x90000000 DT_SIZE_M(64)>; /* 64 Mbits */ + reg = <0x90000000 DT_SIZE_M(8)>; /* 64 Mbits */ qspi-max-frequency = <40000000>; status = "okay"; spi-bus-width = <4>; @@ -159,7 +159,7 @@ zephyr_udc0: &usbotg_fs { #address-cells = <1>; #size-cells = <1>; slot0_partition: partition@0 { - reg = <0x00000000 DT_SIZE_M(64)>; + reg = <0x00000000 DT_SIZE_M(8)>; }; }; }; @@ -186,7 +186,7 @@ zephyr_udc0: &usbotg_fs { #size-cells = <1>; storage_partition: partition@0 { label = "storage"; - reg = <0x00000000 DT_SIZE_M(64)>; + reg = <0x00000000 DT_SIZE_M(8)>; }; }; }; From 76f514e5f5247dcdc39c800a690e04169f3ee1a4 Mon Sep 17 00:00:00 2001 From: Jiafei Pan Date: Mon, 21 Oct 2024 12:14:51 +0800 Subject: [PATCH 1386/4482] boards: nxp mpu: update supported features and fix ram size Updated imx8mm/n/p and imx93 Cortex-A Core supported features in board yaml file, and also fixed ram size for the board. Signed-off-by: Jiafei Pan --- boards/nxp/imx8mm_evk/imx8mm_evk_mimx8mm6_a53.yaml | 6 ++++-- boards/nxp/imx8mm_evk/imx8mm_evk_mimx8mm6_a53_smp.yaml | 5 +++-- boards/nxp/imx8mn_evk/imx8mn_evk_mimx8mn6_a53.yaml | 4 +++- boards/nxp/imx8mn_evk/imx8mn_evk_mimx8mn6_a53_smp.yaml | 3 ++- boards/nxp/imx8mp_evk/imx8mp_evk_mimx8ml8_a53.yaml | 6 ++++-- boards/nxp/imx8mp_evk/imx8mp_evk_mimx8ml8_a53_smp.yaml | 5 +++-- boards/nxp/imx93_evk/imx93_evk_mimx9352_a55.yaml | 2 +- 7 files changed, 20 insertions(+), 11 deletions(-) diff --git a/boards/nxp/imx8mm_evk/imx8mm_evk_mimx8mm6_a53.yaml b/boards/nxp/imx8mm_evk/imx8mm_evk_mimx8mm6_a53.yaml index 1ab75987c3814..4132df2e1f6fd 100644 --- a/boards/nxp/imx8mm_evk/imx8mm_evk_mimx8mm6_a53.yaml +++ b/boards/nxp/imx8mm_evk/imx8mm_evk_mimx8mm6_a53.yaml @@ -11,9 +11,11 @@ arch: arm64 toolchain: - zephyr - cross-compile -ram: 128 +ram: 1024 +supported: + - uart + - net testing: ignore_tags: - - net - bluetooth vendor: nxp diff --git a/boards/nxp/imx8mm_evk/imx8mm_evk_mimx8mm6_a53_smp.yaml b/boards/nxp/imx8mm_evk/imx8mm_evk_mimx8mm6_a53_smp.yaml index 1ff3cd7af4522..75c85be9542f4 100644 --- a/boards/nxp/imx8mm_evk/imx8mm_evk_mimx8mm6_a53_smp.yaml +++ b/boards/nxp/imx8mm_evk/imx8mm_evk_mimx8mm6_a53_smp.yaml @@ -11,11 +11,12 @@ arch: arm64 toolchain: - zephyr - cross-compile -ram: 128 +ram: 1024 supported: - smp + - uart + - net testing: ignore_tags: - - net - bluetooth vendor: nxp diff --git a/boards/nxp/imx8mn_evk/imx8mn_evk_mimx8mn6_a53.yaml b/boards/nxp/imx8mn_evk/imx8mn_evk_mimx8mn6_a53.yaml index b75fb589d21b5..a4a5dd0b50a6c 100644 --- a/boards/nxp/imx8mn_evk/imx8mn_evk_mimx8mn6_a53.yaml +++ b/boards/nxp/imx8mn_evk/imx8mn_evk_mimx8mn6_a53.yaml @@ -12,8 +12,10 @@ toolchain: - zephyr - cross-compile ram: 1024 +supported: + - uart + - net testing: ignore_tags: - - net - bluetooth vendor: nxp diff --git a/boards/nxp/imx8mn_evk/imx8mn_evk_mimx8mn6_a53_smp.yaml b/boards/nxp/imx8mn_evk/imx8mn_evk_mimx8mn6_a53_smp.yaml index d82cced07a9bc..38390d6df283f 100644 --- a/boards/nxp/imx8mn_evk/imx8mn_evk_mimx8mn6_a53_smp.yaml +++ b/boards/nxp/imx8mn_evk/imx8mn_evk_mimx8mn6_a53_smp.yaml @@ -14,8 +14,9 @@ toolchain: ram: 1024 supported: - smp + - uart + - net testing: ignore_tags: - - net - bluetooth vendor: nxp diff --git a/boards/nxp/imx8mp_evk/imx8mp_evk_mimx8ml8_a53.yaml b/boards/nxp/imx8mp_evk/imx8mp_evk_mimx8ml8_a53.yaml index f1c632d829878..dff021eab7e95 100644 --- a/boards/nxp/imx8mp_evk/imx8mp_evk_mimx8ml8_a53.yaml +++ b/boards/nxp/imx8mp_evk/imx8mp_evk_mimx8ml8_a53.yaml @@ -11,9 +11,11 @@ arch: arm64 toolchain: - zephyr - cross-compile -ram: 128 +ram: 1024 +supported: + - uart + - net testing: ignore_tags: - - net - bluetooth vendor: nxp diff --git a/boards/nxp/imx8mp_evk/imx8mp_evk_mimx8ml8_a53_smp.yaml b/boards/nxp/imx8mp_evk/imx8mp_evk_mimx8ml8_a53_smp.yaml index c1b905052351d..fcf5ace4a9b65 100644 --- a/boards/nxp/imx8mp_evk/imx8mp_evk_mimx8ml8_a53_smp.yaml +++ b/boards/nxp/imx8mp_evk/imx8mp_evk_mimx8ml8_a53_smp.yaml @@ -11,11 +11,12 @@ arch: arm64 toolchain: - zephyr - cross-compile -ram: 128 +ram: 1024 supported: - smp + - uart + - net testing: ignore_tags: - - net - bluetooth vendor: nxp diff --git a/boards/nxp/imx93_evk/imx93_evk_mimx9352_a55.yaml b/boards/nxp/imx93_evk/imx93_evk_mimx9352_a55.yaml index 89cc546d7b3a0..feeb48fe80577 100644 --- a/boards/nxp/imx93_evk/imx93_evk_mimx9352_a55.yaml +++ b/boards/nxp/imx93_evk/imx93_evk_mimx9352_a55.yaml @@ -18,8 +18,8 @@ supported: - i2c - spi - can + - net testing: ignore_tags: - - net - bluetooth vendor: nxp From e7db0f8aff81436ff07f557a5ca8e2daa1789188 Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Mon, 21 Oct 2024 10:48:42 +0200 Subject: [PATCH 1387/4482] drivers: can: clarify the meaning of minimum/maximum supported bitrates Clarify the meaning of of minimum/maximum supported bitrates in the CAN controller driver API. Signed-off-by: Henrik Brix Andersen --- include/zephyr/drivers/can.h | 37 ++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/include/zephyr/drivers/can.h b/include/zephyr/drivers/can.h index bea1715c27e0e..82dbf4160cf40 100644 --- a/include/zephyr/drivers/can.h +++ b/include/zephyr/drivers/can.h @@ -835,8 +835,16 @@ static inline int z_impl_can_get_core_clock(const struct device *dev, uint32_t * * * Get the minimum supported bitrate for the CAN controller/transceiver combination. * + * @note The minimum bitrate represents limitations of the CAN controller/transceiver + * combination. Whether the CAN controller can achieve this bitrate depends on the CAN core clock + * rate and the minimum CAN timing limits. + * + * @see can_get_core_clock() + * @see can_get_timing_min() + * @see can_get_timing_data_min() + * * @param dev Pointer to the device structure for the driver instance. - * @return Minimum supported bitrate in bits/s + * @return Minimum supported bitrate in bits/s. A value of 0 means the lower limit is unspecified. */ __syscall uint32_t can_get_bitrate_min(const struct device *dev); @@ -854,8 +862,17 @@ static inline uint32_t z_impl_can_get_bitrate_min(const struct device *dev) * * @deprecated Use @a can_get_bitrate_min() instead. * + * @note The minimum bitrate represents limitations of the CAN controller/transceiver + * combination. Whether the CAN controller can achieve this bitrate depends on the CAN core clock + * rate and the minimum CAN timing limits. + * + * @see can_get_core_clock() + * @see can_get_timing_min() + * @see can_get_timing_data_min() + * * @param dev Pointer to the device structure for the driver instance. - * @param[out] min_bitrate Minimum supported bitrate in bits/s + * @param[out] min_bitrate Minimum supported bitrate in bits/s. A value of 0 means the lower limit + * is unspecified. * * @retval -EIO General input/output error. * @retval -ENOSYS If this function is not implemented by the driver. @@ -872,6 +889,14 @@ __deprecated static inline int can_get_min_bitrate(const struct device *dev, uin * * Get the maximum supported bitrate for the CAN controller/transceiver combination. * + * @note The maximum bitrate represents limitations of the CAN controller/transceiver + * combination. Whether the CAN controller can achieve this bitrate depends on the CAN core clock + * rate and the maximum CAN timing limits. + * + * @see can_get_core_clock() + * @see can_get_timing_max() + * @see can_get_timing_data_max() + * * @param dev Pointer to the device structure for the driver instance. * @return Maximum supported bitrate in bits/s */ @@ -891,6 +916,14 @@ static inline uint32_t z_impl_can_get_bitrate_max(const struct device *dev) * * @deprecated Use @a can_get_bitrate_max() instead. * + * @note The maximum bitrate represents limitations of the CAN controller/transceiver + * combination. Whether the CAN controller can achieve this bitrate depends on the CAN core clock + * rate and the maximum CAN timing limits. + * + * @see can_get_core_clock() + * @see can_get_timing_max() + * @see can_get_timing_data_max() + * * @param dev Pointer to the device structure for the driver instance. * @param[out] max_bitrate Maximum supported bitrate in bits/s * From 7161a7a06ab58ce2338c51974813e270dcd5b7d9 Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Fri, 18 Oct 2024 16:56:41 +0530 Subject: [PATCH 1388/4482] drivers: wifi: Add changes for regulatory domain Add changes for offloaded raw tx regulatory domain. Signed-off-by: Kapil Bhatt --- drivers/wifi/nrfwifi/off_raw_tx/src/off_raw_tx_api.c | 5 +++-- drivers/wifi/nrfwifi/src/fmac_main.c | 6 ++++-- .../zephyr/drivers/wifi/nrfwifi/off_raw_tx/off_raw_tx_api.h | 6 ++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/wifi/nrfwifi/off_raw_tx/src/off_raw_tx_api.c b/drivers/wifi/nrfwifi/off_raw_tx/src/off_raw_tx_api.c index 3b1dd0bb093fa..520814865d68b 100644 --- a/drivers/wifi/nrfwifi/off_raw_tx/src/off_raw_tx_api.c +++ b/drivers/wifi/nrfwifi/off_raw_tx/src/off_raw_tx_api.c @@ -128,7 +128,7 @@ static int bytes_from_str(uint8_t *buf, int buf_len, const char *src) } #endif /* CONFIG_WIFI_FIXED_MAC_ADDRESS_ENABLED */ -int nrf70_off_raw_tx_init(uint8_t *mac_addr) +int nrf70_off_raw_tx_init(uint8_t *mac_addr, unsigned char *country_code) { enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; @@ -206,7 +206,8 @@ int nrf70_off_raw_tx_init(uint8_t *mac_addr) IS_ENABLED(CONFIG_NRF_WIFI_BEAMFORMING), &ctrl_params, &ceil_params, - &board_params); + &board_params, + country_code); if (status != NRF_WIFI_STATUS_SUCCESS) { LOG_ERR("%s: nRF70 firmware initialization failed", __func__); goto err; diff --git a/drivers/wifi/nrfwifi/src/fmac_main.c b/drivers/wifi/nrfwifi/src/fmac_main.c index 82ea0f99267b6..f2f7ba4134071 100644 --- a/drivers/wifi/nrfwifi/src/fmac_main.c +++ b/drivers/wifi/nrfwifi/src/fmac_main.c @@ -644,7 +644,8 @@ enum nrf_wifi_status nrf_wifi_fmac_dev_add_zep(struct nrf_wifi_drv_priv_zep *drv IS_ENABLED(CONFIG_NRF_WIFI_BEAMFORMING), &tx_pwr_ctrl_params, &tx_pwr_ceil_params, - &board_params); + &board_params, + STRINGIFY(CONFIG_NRF70_REG_DOMAIN)); #else status = nrf_wifi_fmac_dev_init(rpu_ctx_zep->rpu_ctx, #ifdef CONFIG_NRF_WIFI_LOW_POWER @@ -655,7 +656,8 @@ enum nrf_wifi_status nrf_wifi_fmac_dev_add_zep(struct nrf_wifi_drv_priv_zep *drv IS_ENABLED(CONFIG_NRF_WIFI_BEAMFORMING), &tx_pwr_ctrl_params, &tx_pwr_ceil_params, - &board_params); + &board_params, + STRINGIFY(CONFIG_NRF70_REG_DOMAIN)); #endif /* CONFIG_NRF70_RADIO_TEST */ diff --git a/include/zephyr/drivers/wifi/nrfwifi/off_raw_tx/off_raw_tx_api.h b/include/zephyr/drivers/wifi/nrfwifi/off_raw_tx/off_raw_tx_api.h index b8ff50cd390db..b14ae39488d94 100644 --- a/include/zephyr/drivers/wifi/nrfwifi/off_raw_tx/off_raw_tx_api.h +++ b/include/zephyr/drivers/wifi/nrfwifi/off_raw_tx/off_raw_tx_api.h @@ -22,7 +22,8 @@ #define NRF_WIFI_OFF_RAW_TX_FRAME_SIZE_MIN 26 /* Maximum frame size for raw packet transmission */ #define NRF_WIFI_OFF_RAW_TX_FRAME_SIZE_MAX 600 - +/* Maximum length of country code*/ +#define NRF_WIFI_COUNTRY_CODE_LEN 2 /** * @brief- Transmission rates * Rate to be used for transmitting a packet. @@ -167,6 +168,7 @@ struct nrf_wifi_off_raw_tx_conf { /** * @brief Initialize the nRF70 for operating in the offloaded raw TX mode. * @param mac_addr MAC address to be used for the nRF70 device. + * @param country_code Country code to be set for regularity domain. * * This function is initializes the nRF70 device for offloaded raw TX mode by: * - Powering it up, @@ -184,7 +186,7 @@ struct nrf_wifi_off_raw_tx_conf { * @retval 0 If the operation was successful. * @retval -1 If the operation failed. */ -int nrf70_off_raw_tx_init(uint8_t *mac_addr); +int nrf70_off_raw_tx_init(uint8_t *mac_addr, unsigned char *country_code); /** * @brief Initialize the nRF70 for operating in the offloaded raw TX mode. From b8c18f55447e3781299242e3af83e949a0e67bc1 Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Tue, 22 Oct 2024 13:00:50 +0530 Subject: [PATCH 1389/4482] manifest: update hal_nordic revision for regularity domain Update update hal_nordic revision for regularity domain changes. Set regularity domain in umac command init. Signed-off-by: Kapil Bhatt --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 626c14ab507ec..b9e8f888222f8 100644 --- a/west.yml +++ b/west.yml @@ -188,7 +188,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 5f1210074cb8bb7ec66317af294596a97ac48815 + revision: 957d1a803d0663330e870af2985503ba0cdbb152 path: modules/hal/nordic groups: - hal From c9b71045f8d647031bf7ddc76dcb7386f7fa3e35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 16:31:12 +0200 Subject: [PATCH 1390/4482] doc: extensions: boards: Better handle unknown/other vendors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Boards under a folder that doesn't directly match a vendor prefix incorrectly end up being categorized as "zephyr" since that's the only prefix that is eventually found when navigating up the folder hierarchy. This commits treats boards in the "others" and "native" folders as special cases and associates them to an "Unknown/Other" category. Signed-off-by: Benjamin Cabé --- doc/_scripts/gen_boards_catalog.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/_scripts/gen_boards_catalog.py b/doc/_scripts/gen_boards_catalog.py index 42e8c06860613..859f37c9eceb4 100644 --- a/doc/_scripts/gen_boards_catalog.py +++ b/doc/_scripts/gen_boards_catalog.py @@ -80,9 +80,13 @@ def get_catalog(): for board in boards: # We could use board.vendor but it is often incorrect. Instead, deduce vendor from - # containing folder + # containing folder. There are a few exceptions, like the "native" and "others" folders + # which we know are not actual vendors so treat them as such. for folder in board.dir.parents: - if vnd_lookup.vnd2vendor.get(folder.name): + if folder.name in ["native", "others"]: + vendor = "others" + break + elif vnd_lookup.vnd2vendor.get(folder.name): vendor = folder.name break @@ -118,4 +122,8 @@ def get_catalog(): series = soc.series or "" socs_hierarchy.setdefault(family, {}).setdefault(series, []).append(soc.name) - return {"boards": board_catalog, "vendors": vnd_lookup.vnd2vendor, "socs": socs_hierarchy} + return { + "boards": board_catalog, + "vendors": {**vnd_lookup.vnd2vendor, "others": "Other/Unknown"}, + "socs": socs_hierarchy, + } From 393ecf4426c7b9dfce8ff4007ae14aff055f416d Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 21 Oct 2024 17:07:13 +0300 Subject: [PATCH 1391/4482] drivers: bluetooth: Rename Silabs HCI driver Rename the Silabs HCI driver to hci_silabs_efr32.c to better indicate what hardware it supports. Also rename the associated devicetree binding and Kconfig options to be consistent with the new driver name. Signed-off-by: Johan Hedberg --- MAINTAINERS.yml | 2 +- drivers/bluetooth/hci/CMakeLists.txt | 4 ++-- drivers/bluetooth/hci/Kconfig | 8 ++++---- drivers/bluetooth/hci/{slz_hci.c => hci_silabs_efr32.c} | 6 +++--- dts/arm/silabs/efr32bg2x.dtsi | 2 +- dts/arm/silabs/efr32mg.dtsi | 2 +- dts/arm/silabs/efr32mg24.dtsi | 2 +- dts/arm/silabs/efr32xg13p.dtsi | 2 +- .../{silabs,bt-hci.yaml => silabs,bt-hci-efr32.yaml} | 4 ++-- modules/hal_silabs/simplicity_sdk/CMakeLists.txt | 4 ++-- 10 files changed, 18 insertions(+), 18 deletions(-) rename drivers/bluetooth/hci/{slz_hci.c => hci_silabs_efr32.c} (97%) rename dts/bindings/bluetooth/{silabs,bt-hci.yaml => silabs,bt-hci-efr32.yaml} (76%) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index f22c80a45df36..e9c2ff76f3410 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -3532,7 +3532,7 @@ Silabs Platforms: - dts/arm/silabs/ - dts/bindings/*/silabs* - drivers/*/*gecko* - - drivers/bluetooth/hci/slz_hci* + - drivers/bluetooth/hci/hci_silabs_* - drivers/*/*silabs* labels: - "platform: Silabs" diff --git a/drivers/bluetooth/hci/CMakeLists.txt b/drivers/bluetooth/hci/CMakeLists.txt index 9ed95462671a2..91daa9d9cb7a4 100644 --- a/drivers/bluetooth/hci/CMakeLists.txt +++ b/drivers/bluetooth/hci/CMakeLists.txt @@ -36,8 +36,8 @@ if(CONFIG_DT_HAS_ST_HCI_STM32WBA_ENABLED) zephyr_blobs_verify(MODULE hal_stm32 REQUIRED) endif() zephyr_library_sources_ifdef(CONFIG_BT_USERCHAN userchan.c) -zephyr_library_sources_ifdef(CONFIG_BT_SILABS_HCI slz_hci.c) -if(CONFIG_DT_HAS_SILABS_BT_HCI_ENABLED) +zephyr_library_sources_ifdef(CONFIG_BT_SILABS_EFR32 hci_silabs_efr32.c) +if(CONFIG_DT_HAS_SILABS_BT_HCI_EFR32_ENABLED) zephyr_blobs_verify(MODULE hal_silabs REQUIRED) endif() zephyr_library_sources_ifdef(CONFIG_BT_PSOC6_BLESS hci_ifx_psoc6_bless.c) diff --git a/drivers/bluetooth/hci/Kconfig b/drivers/bluetooth/hci/Kconfig index 2a0852ca4d79a..32ad3b7258453 100644 --- a/drivers/bluetooth/hci/Kconfig +++ b/drivers/bluetooth/hci/Kconfig @@ -77,10 +77,10 @@ config BT_STM32WBA help ST STM32WBA HCI Bluetooth interface -config BT_SILABS_HCI +config BT_SILABS_EFR32 bool default y - depends on DT_HAS_SILABS_BT_HCI_ENABLED + depends on DT_HAS_SILABS_BT_HCI_EFR32_ENABLED depends on ZEPHYR_HAL_SILABS_MODULE_BLOBS depends on !PM || SOC_GECKO_PM_BACKEND_PMGR select SOC_GECKO_USE_RAIL @@ -260,9 +260,9 @@ config BT_DRV_RX_STACK_SIZE help Stack size for the HCI driver's RX thread. -config BT_SILABS_HCI_BUFFER_MEMORY +config BT_SILABS_EFR32_BUFFER_MEMORY int "Silicon Labs Bluetooth Library memory buffer size" - depends on BT_SILABS_HCI + depends on BT_SILABS_EFR32 default 6144 help Select the size of allocated memory buffer for the Silicon Labs diff --git a/drivers/bluetooth/hci/slz_hci.c b/drivers/bluetooth/hci/hci_silabs_efr32.c similarity index 97% rename from drivers/bluetooth/hci/slz_hci.c rename to drivers/bluetooth/hci/hci_silabs_efr32.c index 1c86e71bd014d..e90552c2521c0 100644 --- a/drivers/bluetooth/hci/slz_hci.c +++ b/drivers/bluetooth/hci/hci_silabs_efr32.c @@ -13,9 +13,9 @@ #define LOG_LEVEL CONFIG_BT_HCI_DRIVER_LOG_LEVEL #include -LOG_MODULE_REGISTER(bt_hci_driver_slz); +LOG_MODULE_REGISTER(bt_hci_driver_efr32); -#define DT_DRV_COMPAT silabs_bt_hci +#define DT_DRV_COMPAT silabs_bt_hci_efr32 struct hci_data { bt_hci_recv_t recv; @@ -24,7 +24,7 @@ struct hci_data { #define SL_BT_CONFIG_ACCEPT_LIST_SIZE 1 #define SL_BT_CONFIG_MAX_CONNECTIONS 1 #define SL_BT_CONFIG_USER_ADVERTISERS 1 -#define SL_BT_CONTROLLER_BUFFER_MEMORY CONFIG_BT_SILABS_HCI_BUFFER_MEMORY +#define SL_BT_CONTROLLER_BUFFER_MEMORY CONFIG_BT_SILABS_EFR32_BUFFER_MEMORY #define SL_BT_CONTROLLER_LE_BUFFER_SIZE_MAX CONFIG_BT_BUF_ACL_TX_COUNT #define SL_BT_CONTROLLER_COMPLETED_PACKETS_THRESHOLD 1 #define SL_BT_CONTROLLER_COMPLETED_PACKETS_EVENTS_TIMEOUT 3 diff --git a/dts/arm/silabs/efr32bg2x.dtsi b/dts/arm/silabs/efr32bg2x.dtsi index 24bb3939d1c12..6a3fb5e36fdb6 100644 --- a/dts/arm/silabs/efr32bg2x.dtsi +++ b/dts/arm/silabs/efr32bg2x.dtsi @@ -362,7 +362,7 @@ }; bt_hci_silabs: bt_hci_silabs { - compatible = "silabs,bt-hci"; + compatible = "silabs,bt-hci-efr32"; status = "disabled"; }; }; diff --git a/dts/arm/silabs/efr32mg.dtsi b/dts/arm/silabs/efr32mg.dtsi index a7926f6710f6b..cdfecf723987b 100644 --- a/dts/arm/silabs/efr32mg.dtsi +++ b/dts/arm/silabs/efr32mg.dtsi @@ -235,7 +235,7 @@ }; bt_hci_silabs: bt_hci_silabs { - compatible = "silabs,bt-hci"; + compatible = "silabs,bt-hci-efr32"; status = "disabled"; }; diff --git a/dts/arm/silabs/efr32mg24.dtsi b/dts/arm/silabs/efr32mg24.dtsi index 5af760a85604e..2eeb2eb8c8601 100644 --- a/dts/arm/silabs/efr32mg24.dtsi +++ b/dts/arm/silabs/efr32mg24.dtsi @@ -425,7 +425,7 @@ bt_hci_silabs: bt_hci_silabs { - compatible = "silabs,bt-hci"; + compatible = "silabs,bt-hci-efr32"; status = "disabled"; }; }; diff --git a/dts/arm/silabs/efr32xg13p.dtsi b/dts/arm/silabs/efr32xg13p.dtsi index 3444eb6e391f4..22c325e093b97 100644 --- a/dts/arm/silabs/efr32xg13p.dtsi +++ b/dts/arm/silabs/efr32xg13p.dtsi @@ -182,7 +182,7 @@ }; bt_hci_silabs: bt_hci_silabs { - compatible = "silabs,bt-hci"; + compatible = "silabs,bt-hci-efr32"; status = "disabled"; }; diff --git a/dts/bindings/bluetooth/silabs,bt-hci.yaml b/dts/bindings/bluetooth/silabs,bt-hci-efr32.yaml similarity index 76% rename from dts/bindings/bluetooth/silabs,bt-hci.yaml rename to dts/bindings/bluetooth/silabs,bt-hci-efr32.yaml index d14f2d549685f..407394e29a397 100644 --- a/dts/bindings/bluetooth/silabs,bt-hci.yaml +++ b/dts/bindings/bluetooth/silabs,bt-hci-efr32.yaml @@ -1,12 +1,12 @@ description: Bluetooth HCI on Silabs boards -compatible: "silabs,bt-hci" +compatible: "silabs,bt-hci-efr32" include: bt-hci.yaml properties: bt-hci-name: - default: "sl:bt" + default: "efr32" bt-hci-bus: default: "virtual" bt-hci-quirks: diff --git a/modules/hal_silabs/simplicity_sdk/CMakeLists.txt b/modules/hal_silabs/simplicity_sdk/CMakeLists.txt index 100156f107018..e270d75ad17e1 100644 --- a/modules/hal_silabs/simplicity_sdk/CMakeLists.txt +++ b/modules/hal_silabs/simplicity_sdk/CMakeLists.txt @@ -47,12 +47,12 @@ if(CONFIG_SOC_GECKO_HAS_RADIO) ) # sl_protocol_crypto - zephyr_library_sources_ifdef(CONFIG_BT_SILABS_HCI + zephyr_library_sources_ifdef(CONFIG_BT_SILABS_EFR32 ${SECURITY_DIR}/sl_component/sl_protocol_crypto/src/sli_radioaes_management.c ${SECURITY_DIR}/sl_component/sl_protocol_crypto/src/sli_protocol_crypto_radioaes.c ) - if(CONFIG_BT_SILABS_HCI) + if(CONFIG_BT_SILABS_EFR32) # prebuilt libs add_prebuilt_library(liblinklayer protocol/bluetooth/bgstack/ll/lib/libbluetooth_controller_efr32xg${SILABS_DEVICE_FAMILY_NUMBER}_gcc_release.a) add_prebuilt_library(libbgcommon protocol/bluetooth/bgcommon/lib/build/gcc/cortex-m33/bgcommon/release/libbgcommon.a) From aefda52e42b599592dcfbcbd359aa8dd6e908994 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 21 Oct 2024 13:15:22 +0100 Subject: [PATCH 1392/4482] west.yml: MCUboot synchronization from upstream Update Zephyr fork of MCUboot to revision: 33de65cebaf78b306501a4195dc0ce4008315e1a Brings following Zephyr relevant fixes: - 33de65c scipts: imgtool: bugfix #2096 Signed-off-by: Jamie McCrae --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index b9e8f888222f8..c602543c11119 100644 --- a/west.yml +++ b/west.yml @@ -285,7 +285,7 @@ manifest: groups: - crypto - name: mcuboot - revision: b9d69dd2a2d6df32da6608d549138288bb7d7aa5 + revision: 33de65cebaf78b306501a4195dc0ce4008315e1a path: bootloader/mcuboot groups: - bootloader From 94a6b8257206c2dc02828f2ca4c27e6dfdd33ef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Mon, 21 Oct 2024 10:54:34 +0200 Subject: [PATCH 1393/4482] drivers: udc_dwc2: Handle IN events before OUT events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DWC2 otg OUT transfers are being used for SETUP DATA0, OUT Data Stage packets and OUT Status Stage ZLP. On High-Speed it is possible for IN Data Stage, OUT Status Stage ZLP and subsequent SETUP DATA0 to happen in very quick succession, making all the three events appear at the same time to the handler thread. The handler thread is picking up next endpoint to handle based on the least significant bit set. When OUT endpoints were on bits 0-15 and IN endpoints were on bits 16-31, the least significant bit policy favored OUT endpoints over IN endpoints. This caused problems in Completer mode (but suprisingly not in Buffer DMA mode) that lead to incorrect control transfer handling. The choice between least significant bit first or most significant bit first is arbitrary. Switching from least to most significant bit first would have resolved the issue. It would also favor higher numbered endpoints over lower numbered endpoints. Swap the order of endpoints in bitmaps to have IN on bits 0-15 and OUT on bits 16-31 to keep handling lower numbered endpoints first and resolve the control transfer handling in Completer mode. Signed-off-by: Tomasz Moń --- drivers/usb/udc/udc_dwc2.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 917910ad26d6d..00e4a370bacc1 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -99,9 +99,9 @@ struct udc_dwc2_data { struct k_thread thread_data; /* Main events the driver thread waits for */ struct k_event drv_evt; - /* Transfer triggers (OUT on bits 0-15, IN on bits 16-31) */ + /* Transfer triggers (IN on bits 0-15, OUT on bits 16-31) */ struct k_event xfer_new; - /* Finished transactions (OUT on bits 0-15, IN on bits 16-31) */ + /* Finished transactions (IN on bits 0-15, OUT on bits 16-31) */ struct k_event xfer_finished; struct dwc2_reg_backup backup; uint32_t ghwcfg1; @@ -1554,9 +1554,9 @@ static int udc_dwc2_ep_clear_halt(const struct device *dev, uint32_t ep_bit; if (USB_EP_DIR_IS_IN(cfg->addr)) { - ep_bit = BIT(16 + USB_EP_GET_IDX(cfg->addr)); - } else { ep_bit = BIT(USB_EP_GET_IDX(cfg->addr)); + } else { + ep_bit = BIT(16 + USB_EP_GET_IDX(cfg->addr)); } k_event_post(&priv->xfer_new, ep_bit); @@ -1579,9 +1579,9 @@ static int udc_dwc2_ep_enqueue(const struct device *dev, uint32_t ep_bit; if (USB_EP_DIR_IS_IN(cfg->addr)) { - ep_bit = BIT(16 + USB_EP_GET_IDX(cfg->addr)); - } else { ep_bit = BIT(USB_EP_GET_IDX(cfg->addr)); + } else { + ep_bit = BIT(16 + USB_EP_GET_IDX(cfg->addr)); } k_event_post(&priv->xfer_new, ep_bit); @@ -2346,7 +2346,7 @@ static inline void dwc2_handle_in_xfercompl(const struct device *dev, return; } - k_event_post(&priv->xfer_finished, BIT(16 + ep_idx)); + k_event_post(&priv->xfer_finished, BIT(ep_idx)); k_event_post(&priv->drv_evt, BIT(DWC2_DRV_EVT_EP_FINISHED)); } @@ -2452,7 +2452,7 @@ static inline void dwc2_handle_out_xfercompl(const struct device *dev, net_buf_tailroom(buf)) { dwc2_prep_rx(dev, buf, ep_cfg); } else { - k_event_post(&priv->xfer_finished, BIT(ep_idx)); + k_event_post(&priv->xfer_finished, BIT(16 + ep_idx)); k_event_post(&priv->drv_evt, BIT(DWC2_DRV_EVT_EP_FINISHED)); } } @@ -2803,9 +2803,9 @@ static uint8_t pull_next_ep_from_bitmap(uint32_t *bitmap) *bitmap &= ~BIT(bit); if (bit >= 16) { - return USB_EP_DIR_IN | (bit - 16); + return USB_EP_DIR_OUT | (bit - 16); } else { - return USB_EP_DIR_OUT | bit; + return USB_EP_DIR_IN | bit; } } From b95cb4e137c6486efeef1f65dc73bbffc5e4fe4a Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Sat, 19 Oct 2024 13:32:32 -0500 Subject: [PATCH 1394/4482] snippets: Add SystemView RTT tracing snippet Adds a new snippet to enable tracing with SEGGER SystemView and RTT. Signed-off-by: Maureen Helm --- snippets/rtt-tracing/README.rst | 20 ++++++++++++++++++++ snippets/rtt-tracing/rtt-tracing.conf | 12 ++++++++++++ snippets/rtt-tracing/snippet.yml | 6 ++++++ 3 files changed, 38 insertions(+) create mode 100644 snippets/rtt-tracing/README.rst create mode 100644 snippets/rtt-tracing/rtt-tracing.conf create mode 100644 snippets/rtt-tracing/snippet.yml diff --git a/snippets/rtt-tracing/README.rst b/snippets/rtt-tracing/README.rst new file mode 100644 index 0000000000000..f41f1a2c55be9 --- /dev/null +++ b/snippets/rtt-tracing/README.rst @@ -0,0 +1,20 @@ +.. _snippet-rtt-tracing: + +SystemView RTT Tracing Snippet (rtt-tracing) +############################################ + +.. code-block:: console + + west build -S rtt-tracing [...] + +Overview +******** + +This snippet enables SEGGER SystemView RTT support with the tracing subsystem. + +Requirements +************ + +Hardware support for: + +- :kconfig:option:`CONFIG_HAS_SEGGER_RTT` diff --git a/snippets/rtt-tracing/rtt-tracing.conf b/snippets/rtt-tracing/rtt-tracing.conf new file mode 100644 index 0000000000000..0f00c54da8155 --- /dev/null +++ b/snippets/rtt-tracing/rtt-tracing.conf @@ -0,0 +1,12 @@ +# Copyright (c) 2024 Analog Devices, Inc. +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_USE_SEGGER_RTT=y + +CONFIG_DEBUG_OPTIMIZATIONS=n +CONFIG_DEBUG_THREAD_INFO=y + +CONFIG_TRACING=y +CONFIG_SEGGER_SYSTEMVIEW=y +CONFIG_SEGGER_SYSTEMVIEW_BOOT_ENABLE=n +CONFIG_SEGGER_SYSVIEW_POST_MORTEM_MODE=n diff --git a/snippets/rtt-tracing/snippet.yml b/snippets/rtt-tracing/snippet.yml new file mode 100644 index 0000000000000..9a4f6b498dbd4 --- /dev/null +++ b/snippets/rtt-tracing/snippet.yml @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Analog Devices, Inc. +# SPDX-License-Identifier: Apache-2.0 + +name: rtt-tracing +append: + EXTRA_CONF_FILE: rtt-tracing.conf From 36d8131e07e363b98659fb54f67f23dbfdba2c67 Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Sat, 19 Oct 2024 13:49:29 -0500 Subject: [PATCH 1395/4482] samples: tracing: Use SystemView RTT tracing snippet Refactors the SystemView sample configuration to use the rtt-tracing snippet. Signed-off-by: Maureen Helm --- samples/subsys/tracing/README.rst | 14 ++++++++++++++ samples/subsys/tracing/prj_sysview.conf | 5 ----- samples/subsys/tracing/sample.yaml | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) delete mode 100644 samples/subsys/tracing/prj_sysview.conf diff --git a/samples/subsys/tracing/README.rst b/samples/subsys/tracing/README.rst index c7ee095a90c43..702eabb784f87 100644 --- a/samples/subsys/tracing/README.rst +++ b/samples/subsys/tracing/README.rst @@ -113,3 +113,17 @@ Build a USER-tracing image with: :compact: After the application has run for a while, check the trace output file. + +Usage for SEGGER SystemView RTT +******************************* + +Build a SystemView-tracing image with the :ref:`snippet-rtt-tracing`: + +.. zephyr-app-commands:: + :zephyr-app: samples/subsys/tracing + :board: frdm_k64f + :snippets: rtt-tracing + :goals: build + :compact: + +After the application has run for a while, check the trace output file. diff --git a/samples/subsys/tracing/prj_sysview.conf b/samples/subsys/tracing/prj_sysview.conf deleted file mode 100644 index 968ddb6a1e910..0000000000000 --- a/samples/subsys/tracing/prj_sysview.conf +++ /dev/null @@ -1,5 +0,0 @@ -CONFIG_TRACING=y -CONFIG_SEGGER_SYSTEMVIEW=y -CONFIG_IDLE_STACK_SIZE=2048 -CONFIG_SEGGER_SYSTEMVIEW_BOOT_ENABLE=n -CONFIG_SEGGER_SYSVIEW_POST_MORTEM_MODE=n diff --git a/samples/subsys/tracing/sample.yaml b/samples/subsys/tracing/sample.yaml index dd53b444a7477..e7104292b2dcf 100644 --- a/samples/subsys/tracing/sample.yaml +++ b/samples/subsys/tracing/sample.yaml @@ -28,7 +28,7 @@ tests: - mimxrt1064_evk integration_platforms: - nrf52840dk/nrf52840 - extra_args: CONF_FILE="prj_sysview.conf" + extra_args: SNIPPET="rtt-tracing" sample.tracing.osawareness.openocd: arch_exclude: - posix From dc9e0cbedb96de1240f10318af10aae65b4c4b8a Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Mon, 21 Oct 2024 16:39:20 -0500 Subject: [PATCH 1396/4482] doc: tracing: Use SystemView RTT tracing snippet Refactors the SystemView tracing documentation to use the rtt-tracing snippet. Signed-off-by: Maureen Helm --- doc/services/tracing/index.rst | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/doc/services/tracing/index.rst b/doc/services/tracing/index.rst index 6fb56dd5be442..45ee08c14328b 100644 --- a/doc/services/tracing/index.rst +++ b/doc/services/tracing/index.rst @@ -372,24 +372,20 @@ relies on RTT as a transport. Newer versions of SystemView support other transports, for example UART or using snapshot mode (both still not supported in Zephyr). -To enable tracing support with `SEGGER SystemView`_ add the configuration option -:kconfig:option:`CONFIG_SEGGER_SYSTEMVIEW` to your project configuration file and set -it to *y*. For example, this can be added to the -:zephyr:code-sample:`synchronization` sample to visualize fast switching between threads. +To enable tracing support with `SEGGER SystemView`_ add the +:ref:`snippet-rtt-tracing` to your build command: + + .. zephyr-app-commands:: + :zephyr-app: samples/synchronization + :board: + :snippets: rtt-tracing + :goals: build + :compact: + SystemView can also be used for post-mortem tracing, which can be enabled with :kconfig:option:`CONFIG_SEGGER_SYSVIEW_POST_MORTEM_MODE`. In this mode, a debugger can be attached after the system has crashed using ``west attach`` after which the -latest data from the internal RAM buffer can be loaded into SystemView:: - - CONFIG_STDOUT_CONSOLE=y - # enable to use thread names - CONFIG_THREAD_NAME=y - CONFIG_SEGGER_SYSTEMVIEW=y - CONFIG_USE_SEGGER_RTT=y - CONFIG_TRACING=y - # enable for post-mortem tracing - CONFIG_SEGGER_SYSVIEW_POST_MORTEM_MODE=n - +latest data from the internal RAM buffer can be loaded into SystemView. .. figure:: segger_systemview.png :align: center From 19955f6478a2b0d540512c816e534cc2ddff6974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Fri, 18 Oct 2024 13:43:37 +0200 Subject: [PATCH 1397/4482] drivers: udc_dwc2: Reduce TxFIFO0 allocation size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DWC2 peripherals can have TxFIFO sizes configured to any value between 16 and 32768. The value configured during synthesis is the maximum value the software can program. Designs that give full flexibility configure the TxFIFO sizes to value equal to total SPRAM size. Currently DWC2 driver does not have prior knowledge about the endpoints used within available configurations and has to come up with TxFIFO0 value up front. The original approach was to use MAX(16, max allowed). locations. Because DWC2 peripheral cannot have TxFIFO0 with size lower than 16 locations, always the max allowed was used. This logic prevented any IN endpoint other than EP0 on designs that have TxFIFO0 size set to total SPRAM size. Change the logic to MIN(2 * 16, max allowed) to have sufficient memory available on flexible designs and allow simultaneous operation if possible (i.e. when maximum TxFIFO0 size is at least 32). Signed-off-by: Tomasz Moń --- drivers/usb/udc/udc_dwc2.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 00e4a370bacc1..7e716201d3c2a 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -54,8 +54,11 @@ enum dwc2_drv_event_type { */ #define UDC_DWC2_GRXFSIZ_HS_DEFAULT (13 + 1 + 774) -/* TX FIFO0 depth in 32-bit words (used by control IN endpoint) */ -#define UDC_DWC2_FIFO0_DEPTH 16U +/* TX FIFO0 depth in 32-bit words (used by control IN endpoint) + * Try 2 * bMaxPacketSize0 to allow simultaneous operation with a fallback to + * whatever is available when 2 * bMaxPacketSize0 is not possible. + */ +#define UDC_DWC2_FIFO0_DEPTH (2 * 16U) /* Get Data FIFO access register */ #define UDC_DWC2_EP_FIFO(base, idx) ((mem_addr_t)base + 0x1000 * (idx + 1)) @@ -1184,7 +1187,7 @@ static int dwc2_set_dedicated_fifo(const struct device *dev, dwc2_get_txfaddr(dev, ep_idx - 2); } else { txfaddr = priv->rxfifo_depth + - MAX(UDC_DWC2_FIFO0_DEPTH, priv->max_txfifo_depth[0]); + MIN(UDC_DWC2_FIFO0_DEPTH, priv->max_txfifo_depth[0]); } /* Make sure to not set TxFIFO greater than hardware allows */ @@ -1939,7 +1942,7 @@ static int udc_dwc2_init_controller(const struct device *dev) sys_write32(usb_dwc2_set_grxfsiz(priv->rxfifo_depth), grxfsiz_reg); /* Set TxFIFO 0 depth */ - val = MAX(UDC_DWC2_FIFO0_DEPTH, priv->max_txfifo_depth[0]); + val = MIN(UDC_DWC2_FIFO0_DEPTH, priv->max_txfifo_depth[0]); gnptxfsiz = usb_dwc2_set_gnptxfsiz_nptxfdep(val) | usb_dwc2_set_gnptxfsiz_nptxfstaddr(priv->rxfifo_depth); From 50c47b01754d3b7121959db3c9c122055cbb6493 Mon Sep 17 00:00:00 2001 From: Johan Stridkvist Date: Fri, 18 Oct 2024 08:41:14 +0200 Subject: [PATCH 1398/4482] samples: Bluetooth: hci_ipc: Fix issue using icbmsg in bsim Add call to Z_SPIN_DELAY() to avoid issue in bsim where time does not progress in loop causing other threads to starve. Signed-off-by: Johan Stridkvist --- samples/bluetooth/hci_ipc/src/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/samples/bluetooth/hci_ipc/src/main.c b/samples/bluetooth/hci_ipc/src/main.c index f0f71ca384f00..4de71c85e3457 100644 --- a/samples/bluetooth/hci_ipc/src/main.c +++ b/samples/bluetooth/hci_ipc/src/main.c @@ -271,6 +271,14 @@ static void hci_ipc_send(struct net_buf *buf, bool is_fatal_err) if (is_fatal_err) { LOG_ERR("IPC service send error: %d", ret); } else { + /* In the POSIX ARCH, code takes zero simulated time to execute, + * so busy wait loops become infinite loops, unless we + * force the loop to take a bit of time. + * + * This delay allows the IPC consumer to execute, thus making + * it possible to send more data over IPC afterwards. + */ + Z_SPIN_DELAY(500); k_yield(); } } From 58d503268573d465b6f8f456190930e06eef594f Mon Sep 17 00:00:00 2001 From: Babak Arisian Date: Tue, 6 Aug 2024 11:14:13 +0200 Subject: [PATCH 1399/4482] Bluetooth: Audio: add create_sink_by_name for the broadcast sink shell Add create_sink_by_name command that scans for broadcast sources with BT_DATA_BROADCAST_NAME matching the name given to the shell command. Fixes #70837 Signed-off-by: Babak Arisian --- .../bluetooth/api/audio/shell/bap.rst | 54 ++++++ subsys/bluetooth/audio/shell/bap.c | 164 +++++++++++++----- 2 files changed, 178 insertions(+), 40 deletions(-) diff --git a/doc/connectivity/bluetooth/api/audio/shell/bap.rst b/doc/connectivity/bluetooth/api/audio/shell/bap.rst index 2efbb4e61d14d..ce60e3d07629b 100644 --- a/doc/connectivity/bluetooth/api/audio/shell/bap.rst +++ b/doc/connectivity/bluetooth/api/audio/shell/bap.rst @@ -23,6 +23,7 @@ Commands stop_broadcast : delete_broadcast : create_broadcast_sink : 0x + create_sink_by_name : sync_broadcast : 0x [[[0x] 0x] ...] [bcode || bcode_str ] @@ -217,6 +218,59 @@ ID before syncing to the BIG. Sink 0x20019110 is ready to sync without encryption uart:~$ bap sync_broadcast 0x01 + +Scan for and establish a broadcast sink stream by broadcast name +---------------------------------------------------------------- + +The command :code:`bap create_sink_by_name` will start scanning and sync to the periodic +advertising with the provided broadcast name before syncing to the BIG. + +.. code-block:: console + + uart:~$ bap init + uart:~$ bap create_sink_by_name "Test Broadcast" + Starting scanning for broadcast_name + Found matched broadcast name 'Test Broadcast' with address 03:47:95:75:C0:08 (random) + Found broadcaster with ID 0xEF6716 and addr 03:47:95:75:C0:08 (random) and sid 0x00 + Attempting to PA sync to the broadcaster + PA synced to broadcast with broadcast ID 0xEF6716 + Attempting to create the sink + Received BASE from sink 0x20019080: + Presentation delay: 40000 + Subgroup count: 1 + Subgroup 0x20024182: + Codec Format: 0x06 + Company ID : 0x0000 + Vendor ID : 0x0000 + codec cfg id 0x06 cid 0x0000 vid 0x0000 count 16 + Codec specific configuration: + Sampling frequency: 16000 Hz (3) + Frame duration: 10000 us (1) + Channel allocation: + Front left (0x00000001) + Front right (0x00000002) + Octets per codec frame: 40 + Codec specific metadata: + Streaming audio contexts: + Unspecified (0x0001) + BIS index: 0x01 + codec cfg id 0x06 cid 0x0000 vid 0x0000 count 6 + Codec specific configuration: + Channel allocation: + Front left (0x00000001) + Codec specific metadata: + None + BIS index: 0x02 + codec cfg id 0x06 cid 0x0000 vid 0x0000 count 6 + Codec specific configuration: + Channel allocation: + Front right (0x00000002) + Codec specific metadata: + None + Possible indexes: 0x01 0x02 + Sink 0x20019110 is ready to sync without encryption + uart:~$ bap sync_broadcast 0x01 + Syncing to encrypted broadcast ------------------------------ diff --git a/subsys/bluetooth/audio/shell/bap.c b/subsys/bluetooth/audio/shell/bap.c index f39f57938937f..6850761321933 100644 --- a/subsys/bluetooth/audio/shell/bap.c +++ b/subsys/bluetooth/audio/shell/bap.c @@ -2348,20 +2348,25 @@ static int cmd_preset(const struct shell *sh, size_t argc, char *argv[]) #define PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO 20 /* Set the timeout relative to interval */ #define PA_SYNC_SKIP 5 +struct bt_broadcast_info { + uint32_t broadcast_id; + char broadcast_name[BT_AUDIO_BROADCAST_NAME_LEN_MAX + 1]; +}; + static struct broadcast_sink_auto_scan { struct broadcast_sink *broadcast_sink; - uint32_t broadcast_id; + struct bt_broadcast_info broadcast_info; struct bt_le_per_adv_sync **out_sync; } auto_scan = { - .broadcast_id = BT_BAP_INVALID_BROADCAST_ID, + .broadcast_info = { + .broadcast_id = BT_BAP_INVALID_BROADCAST_ID, + }, }; static void clear_auto_scan(void) { - if (auto_scan.broadcast_id != BT_BAP_INVALID_BROADCAST_ID) { - memset(&auto_scan, 0, sizeof(auto_scan)); - auto_scan.broadcast_id = BT_BAP_INVALID_BROADCAST_ID; - } + memset(&auto_scan, 0, sizeof(auto_scan)); + auto_scan.broadcast_info.broadcast_id = BT_BAP_INVALID_BROADCAST_ID; } static uint16_t interval_to_sync_timeout(uint16_t interval) @@ -2381,41 +2386,86 @@ static uint16_t interval_to_sync_timeout(uint16_t interval) static bool scan_check_and_sync_broadcast(struct bt_data *data, void *user_data) { - const struct bt_le_scan_recv_info *info = user_data; - char le_addr[BT_ADDR_LE_STR_LEN]; + struct bt_broadcast_info *sr_info = (struct bt_broadcast_info *)user_data; struct bt_uuid_16 adv_uuid; - uint32_t broadcast_id; - if (data->type != BT_DATA_SVC_DATA16) { + switch (data->type) { + case BT_DATA_SVC_DATA16: + if (data->data_len < BT_UUID_SIZE_16 + BT_AUDIO_BROADCAST_ID_SIZE) { + return true; + } + + if (!bt_uuid_create(&adv_uuid.uuid, data->data, BT_UUID_SIZE_16)) { + return true; + } + + if (bt_uuid_cmp(&adv_uuid.uuid, BT_UUID_BROADCAST_AUDIO) != 0) { + return true; + } + + sr_info->broadcast_id = sys_get_le24(data->data + BT_UUID_SIZE_16); return true; - } + case BT_DATA_BROADCAST_NAME: + if (!IN_RANGE(data->data_len, BT_AUDIO_BROADCAST_NAME_LEN_MIN, + BT_AUDIO_BROADCAST_NAME_LEN_MAX)) { + return false; + } - if (data->data_len < BT_UUID_SIZE_16 + BT_AUDIO_BROADCAST_ID_SIZE) { + memcpy(sr_info->broadcast_name, data->data, data->data_len); + sr_info->broadcast_name[data->data_len] = '\0'; + return true; + default: return true; } +} - if (!bt_uuid_create(&adv_uuid.uuid, data->data, BT_UUID_SIZE_16)) { - return true; +static void broadcast_scan_recv(const struct bt_le_scan_recv_info *info, struct net_buf_simple *ad) +{ + struct bt_broadcast_info sr_info = {0}; + char addr_str[BT_ADDR_LE_STR_LEN]; + bool identified_broadcast = false; + + sr_info.broadcast_id = BT_BAP_INVALID_BROADCAST_ID; + + if ((auto_scan.broadcast_info.broadcast_id == BT_BAP_INVALID_BROADCAST_ID) && + (strlen(auto_scan.broadcast_info.broadcast_name) == 0U)) { + /* no op */ + return; } - if (bt_uuid_cmp(&adv_uuid.uuid, BT_UUID_BROADCAST_AUDIO)) { - return true; + if (!passes_scan_filter(info, ad)) { + return; } - broadcast_id = sys_get_le24(data->data + BT_UUID_SIZE_16); + bt_data_parse(ad, scan_check_and_sync_broadcast, (void *)&sr_info); - bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr)); + /* Verify that it is a BAP broadcaster*/ + if (sr_info.broadcast_id == BT_BAP_INVALID_BROADCAST_ID) { + return; + } - shell_print(ctx_shell, - "Found broadcaster with ID 0x%06X and addr %s and sid 0x%02X (looking for " - "0x%06X)", - broadcast_id, le_addr, info->sid, auto_scan.broadcast_id); + bt_addr_le_to_str(info->addr, addr_str, sizeof(addr_str)); + + if (sr_info.broadcast_id == auto_scan.broadcast_info.broadcast_id) { + identified_broadcast = true; + } else if ((strlen(auto_scan.broadcast_info.broadcast_name) != 0U) && + is_substring(auto_scan.broadcast_info.broadcast_name, sr_info.broadcast_name)) { + auto_scan.broadcast_info.broadcast_id = sr_info.broadcast_id; + identified_broadcast = true; - if (auto_scan.broadcast_id == broadcast_id && auto_scan.broadcast_sink != NULL && - auto_scan.broadcast_sink->pa_sync == NULL) { + shell_print(ctx_shell, "Found matched broadcast name '%s' with address %s", + sr_info.broadcast_name, addr_str); + } + + if (identified_broadcast && (auto_scan.broadcast_sink != NULL) && + (auto_scan.broadcast_sink->pa_sync == NULL)) { struct bt_le_per_adv_sync_param create_params = {0}; int err; + shell_print(ctx_shell, + "Found broadcaster with ID 0x%06X and addr %s and sid 0x%02X ", + sr_info.broadcast_id, addr_str, info->sid); + err = bt_le_scan_stop(); if (err != 0) { shell_error(ctx_shell, "Could not stop scan: %d", err); @@ -2435,16 +2485,6 @@ static bool scan_check_and_sync_broadcast(struct bt_data *data, void *user_data) auto_scan.broadcast_sink->pa_sync = *auto_scan.out_sync; } } - - /* Stop parsing */ - return false; -} - -static void broadcast_scan_recv(const struct bt_le_scan_recv_info *info, struct net_buf_simple *ad) -{ - if (passes_scan_filter(info, ad)) { - bt_data_parse(ad, scan_check_and_sync_broadcast, (void *)info); - } } static void base_recv(struct bt_bap_broadcast_sink *sink, const struct bt_bap_base *base, @@ -2480,13 +2520,14 @@ static void bap_pa_sync_synced_cb(struct bt_le_per_adv_sync *sync, if (auto_scan.broadcast_sink != NULL && auto_scan.out_sync != NULL && sync == *auto_scan.out_sync) { shell_print(ctx_shell, "PA synced to broadcast with broadcast ID 0x%06x", - auto_scan.broadcast_id); + auto_scan.broadcast_info.broadcast_id); if (auto_scan.broadcast_sink->bap_sink == NULL) { shell_print(ctx_shell, "Attempting to create the sink"); int err; - err = bt_bap_broadcast_sink_create(sync, auto_scan.broadcast_id, + err = bt_bap_broadcast_sink_create(sync, + auto_scan.broadcast_info.broadcast_id, &auto_scan.broadcast_sink->bap_sink); if (err != 0) { shell_error(ctx_shell, "Could not create broadcast sink: %d", err); @@ -3408,7 +3449,7 @@ static int cmd_create_broadcast_sink(const struct shell *sh, size_t argc, char * if (per_adv_sync == NULL) { const struct bt_le_scan_param param = { - .type = BT_LE_SCAN_TYPE_ACTIVE, + .type = BT_LE_SCAN_TYPE_PASSIVE, .options = BT_LE_SCAN_OPT_NONE, .interval = BT_GAP_SCAN_FAST_INTERVAL, .window = BT_GAP_SCAN_FAST_WINDOW, @@ -3425,7 +3466,7 @@ static int cmd_create_broadcast_sink(const struct shell *sh, size_t argc, char * } auto_scan.broadcast_sink = &default_broadcast_sink; - auto_scan.broadcast_id = broadcast_id; + auto_scan.broadcast_info.broadcast_id = broadcast_id; auto_scan.out_sync = &per_adv_syncs[selected_per_adv_sync]; } else { shell_print(sh, "Creating broadcast sink with broadcast ID 0x%06X", @@ -3444,6 +3485,46 @@ static int cmd_create_broadcast_sink(const struct shell *sh, size_t argc, char * return 0; } +static int cmd_create_sink_by_name(const struct shell *sh, size_t argc, char *argv[]) +{ + const struct bt_le_scan_param param = { + .type = BT_LE_SCAN_TYPE_PASSIVE, + .options = BT_LE_SCAN_OPT_NONE, + .interval = BT_GAP_SCAN_FAST_INTERVAL, + .window = BT_GAP_SCAN_FAST_WINDOW, + .timeout = 1000, /* 10ms units -> 10 second timeout */ + }; + char *broadcast_name; + int err = 0; + + broadcast_name = argv[1]; + if (!IN_RANGE(strlen(broadcast_name), BT_AUDIO_BROADCAST_NAME_LEN_MIN, + BT_AUDIO_BROADCAST_NAME_LEN_MAX)) { + shell_error(sh, "Broadcast name should be minimum %d and maximum %d characters", + BT_AUDIO_BROADCAST_NAME_LEN_MIN, BT_AUDIO_BROADCAST_NAME_LEN_MAX); + + return -ENOEXEC; + } + + shell_print(sh, "Starting scanning for broadcast_name"); + + err = bt_le_scan_start(¶m, NULL); + if (err) { + shell_print(sh, "Fail to start scanning: %d", err); + + return -ENOEXEC; + } + + memcpy(auto_scan.broadcast_info.broadcast_name, broadcast_name, strlen(broadcast_name)); + auto_scan.broadcast_info.broadcast_name[strlen(broadcast_name)] = '\0'; + + auto_scan.broadcast_info.broadcast_id = BT_BAP_INVALID_BROADCAST_ID; + auto_scan.broadcast_sink = &default_broadcast_sink; + auto_scan.out_sync = &per_adv_syncs[selected_per_adv_sync]; + + return 0; +} + static int cmd_sync_broadcast(const struct shell *sh, size_t argc, char *argv[]) { struct bt_bap_stream *streams[ARRAY_SIZE(broadcast_sink_streams)]; @@ -4048,8 +4129,9 @@ static int cmd_print_ase_info(const struct shell *sh, size_t argc, char *argv[]) "[bcast_flag]" HELP_SEP "[extended ]" HELP_SEP "[vendor ]]" SHELL_STATIC_SUBCMD_SET_CREATE( - bap_cmds, SHELL_CMD_ARG(init, NULL, NULL, cmd_init, 1, - IS_ENABLED(CONFIG_BT_BAP_UNICAST_SERVER) ? 2 : 0), + bap_cmds, + SHELL_CMD_ARG(init, NULL, NULL, cmd_init, 1, + IS_ENABLED(CONFIG_BT_BAP_UNICAST_SERVER) ? 2 : 0), #if defined(CONFIG_BT_BAP_BROADCAST_SOURCE) SHELL_CMD_ARG(select_broadcast, NULL, "", cmd_select_broadcast_source, 2, 0), SHELL_CMD_ARG(create_broadcast, NULL, "[preset ] [enc ]", @@ -4061,6 +4143,8 @@ SHELL_STATIC_SUBCMD_SET_CREATE( #if defined(CONFIG_BT_BAP_BROADCAST_SINK) SHELL_CMD_ARG(create_broadcast_sink, NULL, "0x", cmd_create_broadcast_sink, 2, 0), + SHELL_CMD_ARG(create_sink_by_name, NULL, "", + cmd_create_sink_by_name, 2, 0), SHELL_CMD_ARG(sync_broadcast, NULL, "0x [[[0x] 0x] ...] " "[bcode || bcode_str ]", From ece5581433f45a05fba03272ff4bb5691a4d0a51 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 17 Oct 2024 09:59:43 +0100 Subject: [PATCH 1400/4482] boards: rpi: Fix selection of symbol Fixes selection of a symbol that was done in a defconfig file, when actually it should be done in a Kconfig file as a dependency for the board Signed-off-by: Jamie McCrae --- boards/adafruit/kb2040/Kconfig | 5 +++++ boards/adafruit/kb2040/Kconfig.defconfig | 3 --- boards/adafruit/qt_py_rp2040/Kconfig | 5 +++++ boards/adafruit/qt_py_rp2040/Kconfig.defconfig | 3 --- boards/raspberrypi/rpi_pico/Kconfig | 5 +++++ boards/raspberrypi/rpi_pico/Kconfig.defconfig | 3 --- boards/seeed/xiao_rp2040/Kconfig | 5 +++++ boards/seeed/xiao_rp2040/Kconfig.defconfig | 3 --- boards/sparkfun/pro_micro_rp2040/Kconfig | 5 +++++ boards/sparkfun/pro_micro_rp2040/Kconfig.defconfig | 3 --- boards/wiznet/w5500_evb_pico/Kconfig | 6 ++++++ boards/wiznet/w5500_evb_pico/Kconfig.defconfig | 3 --- 12 files changed, 31 insertions(+), 18 deletions(-) create mode 100644 boards/adafruit/kb2040/Kconfig create mode 100644 boards/adafruit/qt_py_rp2040/Kconfig create mode 100644 boards/raspberrypi/rpi_pico/Kconfig create mode 100644 boards/seeed/xiao_rp2040/Kconfig create mode 100644 boards/sparkfun/pro_micro_rp2040/Kconfig create mode 100644 boards/wiznet/w5500_evb_pico/Kconfig diff --git a/boards/adafruit/kb2040/Kconfig b/boards/adafruit/kb2040/Kconfig new file mode 100644 index 0000000000000..b17df8fa389d9 --- /dev/null +++ b/boards/adafruit/kb2040/Kconfig @@ -0,0 +1,5 @@ +# Copyright (c) 2022 Peter Johanson +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_ADAFRUIT_KB2040 + select RP2_FLASH_W25Q080 diff --git a/boards/adafruit/kb2040/Kconfig.defconfig b/boards/adafruit/kb2040/Kconfig.defconfig index e17682abac05a..7cf4aec08f0f6 100644 --- a/boards/adafruit/kb2040/Kconfig.defconfig +++ b/boards/adafruit/kb2040/Kconfig.defconfig @@ -3,9 +3,6 @@ if BOARD_ADAFRUIT_KB2040 -config RP2_FLASH_W25Q080 - default y - if I2C_DW config I2C_DW_CLOCK_SPEED diff --git a/boards/adafruit/qt_py_rp2040/Kconfig b/boards/adafruit/qt_py_rp2040/Kconfig new file mode 100644 index 0000000000000..88483e605c8bf --- /dev/null +++ b/boards/adafruit/qt_py_rp2040/Kconfig @@ -0,0 +1,5 @@ +# Copyright (c) 2022 Peter Johanson +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_ADAFRUIT_QT_PY_RP2040 + select RP2_FLASH_W25Q080 diff --git a/boards/adafruit/qt_py_rp2040/Kconfig.defconfig b/boards/adafruit/qt_py_rp2040/Kconfig.defconfig index 22d40318634b6..09706fc65fd24 100644 --- a/boards/adafruit/qt_py_rp2040/Kconfig.defconfig +++ b/boards/adafruit/qt_py_rp2040/Kconfig.defconfig @@ -3,9 +3,6 @@ if BOARD_ADAFRUIT_QT_PY_RP2040 -config RP2_FLASH_W25Q080 - default y - if I2C_DW config I2C_DW_CLOCK_SPEED diff --git a/boards/raspberrypi/rpi_pico/Kconfig b/boards/raspberrypi/rpi_pico/Kconfig new file mode 100644 index 0000000000000..475fe09d2a7af --- /dev/null +++ b/boards/raspberrypi/rpi_pico/Kconfig @@ -0,0 +1,5 @@ +# Copyright (c) 2021 Yonatan Schachter +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_RPI_PICO + select RP2_FLASH_W25Q080 diff --git a/boards/raspberrypi/rpi_pico/Kconfig.defconfig b/boards/raspberrypi/rpi_pico/Kconfig.defconfig index 1b4c3175a5187..d3a7429fedb45 100644 --- a/boards/raspberrypi/rpi_pico/Kconfig.defconfig +++ b/boards/raspberrypi/rpi_pico/Kconfig.defconfig @@ -3,9 +3,6 @@ if BOARD_RPI_PICO -config RP2_FLASH_W25Q080 - default y - if I2C_DW config I2C_DW_CLOCK_SPEED diff --git a/boards/seeed/xiao_rp2040/Kconfig b/boards/seeed/xiao_rp2040/Kconfig new file mode 100644 index 0000000000000..8afc66f408fbf --- /dev/null +++ b/boards/seeed/xiao_rp2040/Kconfig @@ -0,0 +1,5 @@ +# Copyright (c) 2023 Seeed Studio inc. +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_XIAO_RP2040 + select RP2_FLASH_W25Q080 diff --git a/boards/seeed/xiao_rp2040/Kconfig.defconfig b/boards/seeed/xiao_rp2040/Kconfig.defconfig index e2af832cdcaec..bc729ed2b362b 100644 --- a/boards/seeed/xiao_rp2040/Kconfig.defconfig +++ b/boards/seeed/xiao_rp2040/Kconfig.defconfig @@ -3,9 +3,6 @@ if BOARD_XIAO_RP2040 -config RP2_FLASH_W25Q080 - default y - if I2C_DW config I2C_DW_CLOCK_SPEED diff --git a/boards/sparkfun/pro_micro_rp2040/Kconfig b/boards/sparkfun/pro_micro_rp2040/Kconfig new file mode 100644 index 0000000000000..0810580795395 --- /dev/null +++ b/boards/sparkfun/pro_micro_rp2040/Kconfig @@ -0,0 +1,5 @@ +# Copyright (c) 2021 Pete Johanson +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_SPARKFUN_PRO_MICRO_RP2040 + select RP2_FLASH_W25Q080 diff --git a/boards/sparkfun/pro_micro_rp2040/Kconfig.defconfig b/boards/sparkfun/pro_micro_rp2040/Kconfig.defconfig index 57aecafff006d..89f13a15cd536 100644 --- a/boards/sparkfun/pro_micro_rp2040/Kconfig.defconfig +++ b/boards/sparkfun/pro_micro_rp2040/Kconfig.defconfig @@ -3,9 +3,6 @@ if BOARD_SPARKFUN_PRO_MICRO_RP2040 -config RP2_FLASH_W25Q080 - default y - if I2C_DW config I2C_DW_CLOCK_SPEED diff --git a/boards/wiznet/w5500_evb_pico/Kconfig b/boards/wiznet/w5500_evb_pico/Kconfig new file mode 100644 index 0000000000000..0c91d9e23ae6e --- /dev/null +++ b/boards/wiznet/w5500_evb_pico/Kconfig @@ -0,0 +1,6 @@ +# Copyright (c) 2021 Yonatan Schachter +# Copyright (c) 2023 Ian Wakely +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_W5500_EVB_PICO + select RP2_FLASH_W25Q080 diff --git a/boards/wiznet/w5500_evb_pico/Kconfig.defconfig b/boards/wiznet/w5500_evb_pico/Kconfig.defconfig index a159b56f52ab2..016942be74fcf 100644 --- a/boards/wiznet/w5500_evb_pico/Kconfig.defconfig +++ b/boards/wiznet/w5500_evb_pico/Kconfig.defconfig @@ -4,9 +4,6 @@ if BOARD_W5500_EVB_PICO -config RP2_FLASH_W25Q080 - default y - if NETWORKING config NET_L2_ETHERNET From 19252bdc3db032cd9ff8a54d8a6ece397b3563eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Laso=C5=84czyk?= Date: Wed, 16 Oct 2024 15:47:08 +0200 Subject: [PATCH 1401/4482] tests: drivers: i2s: Add overlay to support nRF54L15 DK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlay to support nRF54L15 DK. Signed-off-by: Karol Lasończyk --- .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 30 +++++++++++++++++++ .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 30 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 tests/drivers/i2s/i2s_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/i2s/i2s_speed/boards/nrf54l15dk_nrf54l15_cpuapp.overlay diff --git a/tests/drivers/i2s/i2s_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/i2s/i2s_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay new file mode 100644 index 0000000000000..8b82825a0f280 --- /dev/null +++ b/tests/drivers/i2s/i2s_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* i2s-node0 is the transmitter/receiver */ + +/ { + aliases { + i2s-node0 = &i2s20; + }; +}; + +&pinctrl { + i2s20_default_alt: i2s20_default_alt { + group1 { + psels = , + , + , + ; + }; + }; +}; + +&i2s20 { + status = "okay"; + pinctrl-0 = <&i2s20_default_alt>; + pinctrl-names = "default"; +}; diff --git a/tests/drivers/i2s/i2s_speed/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/i2s/i2s_speed/boards/nrf54l15dk_nrf54l15_cpuapp.overlay new file mode 100644 index 0000000000000..8b82825a0f280 --- /dev/null +++ b/tests/drivers/i2s/i2s_speed/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* i2s-node0 is the transmitter/receiver */ + +/ { + aliases { + i2s-node0 = &i2s20; + }; +}; + +&pinctrl { + i2s20_default_alt: i2s20_default_alt { + group1 { + psels = , + , + , + ; + }; + }; +}; + +&i2s20 { + status = "okay"; + pinctrl-0 = <&i2s20_default_alt>; + pinctrl-names = "default"; +}; From 8fab391d3fb03e80c8fe6485c7b1639b30e643f5 Mon Sep 17 00:00:00 2001 From: Armando Visconti Date: Fri, 11 Oct 2024 15:24:46 +0200 Subject: [PATCH 1402/4482] drivers/sensor: lps2xdf: (Fix) move API inside CONFIG_LPS2XDF_TRIGGER Move api_lps2xdf_handle_interrupt() API inside the CONFIG_LPS2XDF_TRIGGER ifdef, because it should be defined only in that case. Signed-off-by: Armando Visconti --- drivers/sensor/st/lps2xdf/lps2xdf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/sensor/st/lps2xdf/lps2xdf.h b/drivers/sensor/st/lps2xdf/lps2xdf.h index 10a38a5a133d6..fab350f93558c 100644 --- a/drivers/sensor/st/lps2xdf/lps2xdf.h +++ b/drivers/sensor/st/lps2xdf/lps2xdf.h @@ -40,8 +40,8 @@ typedef int32_t (*api_lps2xdf_mode_set_odr_raw)(const struct device *dev, uint8_t odr); typedef int32_t (*api_lps2xdf_sample_fetch)(const struct device *dev, enum sensor_channel chan); -typedef void (*api_lps2xdf_handle_interrupt)(const struct device *dev); #ifdef CONFIG_LPS2XDF_TRIGGER +typedef void (*api_lps2xdf_handle_interrupt)(const struct device *dev); typedef int (*api_lps2xdf_trigger_set)(const struct device *dev, const struct sensor_trigger *trig, sensor_trigger_handler_t handler); @@ -50,8 +50,8 @@ typedef int (*api_lps2xdf_trigger_set)(const struct device *dev, struct lps2xdf_chip_api { api_lps2xdf_mode_set_odr_raw mode_set_odr_raw; api_lps2xdf_sample_fetch sample_fetch; - api_lps2xdf_handle_interrupt handle_interrupt; #ifdef CONFIG_LPS2XDF_TRIGGER + api_lps2xdf_handle_interrupt handle_interrupt; api_lps2xdf_trigger_set trigger_set; #endif }; From 71bb3f7ade29503118959f4e72e9f444c4846782 Mon Sep 17 00:00:00 2001 From: Armando Visconti Date: Fri, 11 Oct 2024 16:17:20 +0200 Subject: [PATCH 1403/4482] drivers/sensor: lps2xdf: add API to configure interrupt Add a generic lps2xdf_config_int() API to configure device interrupt mode, and implement the specific routines for lps22df and lps28dfw. Signed-off-by: Armando Visconti --- drivers/sensor/st/lps2xdf/lps22df.c | 21 ++++++++++- drivers/sensor/st/lps2xdf/lps28dfw.c | 23 ++++++++++-- drivers/sensor/st/lps2xdf/lps2xdf.h | 4 +++ drivers/sensor/st/lps2xdf/lps2xdf_trigger.c | 39 +++++++-------------- 4 files changed, 57 insertions(+), 30 deletions(-) diff --git a/drivers/sensor/st/lps2xdf/lps22df.c b/drivers/sensor/st/lps2xdf/lps22df.c index ff5537cf37c02..d18536984c486 100644 --- a/drivers/sensor/st/lps2xdf/lps22df.c +++ b/drivers/sensor/st/lps2xdf/lps22df.c @@ -43,11 +43,29 @@ static int lps22df_sample_fetch(const struct device *dev, enum sensor_channel ch return 0; } +#ifdef CONFIG_LPS2XDF_TRIGGER +/** + * lps22df_config_interrupt - config the interrupt mode + */ +static int lps22df_config_interrupt(const struct device *dev) +{ + const struct lps2xdf_config *const cfg = dev->config; + stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx; + lps22df_int_mode_t mode; + + if (lps22df_interrupt_mode_get(ctx, &mode) < 0) { + return -EIO; + } + + mode.drdy_latched = ~cfg->drdy_pulsed; + + return lps22df_interrupt_mode_set(ctx, &mode); +} + /** * lps22df_handle_interrupt - handle the drdy event * read data and call handler if registered any */ -#ifdef CONFIG_LPS2XDF_TRIGGER static void lps22df_handle_interrupt(const struct device *dev) { int ret; @@ -138,6 +156,7 @@ const struct lps2xdf_chip_api st_lps22df_chip_api = { .mode_set_odr_raw = lps22df_mode_set_odr_raw, .sample_fetch = lps22df_sample_fetch, #if CONFIG_LPS2XDF_TRIGGER + .config_interrupt = lps22df_config_interrupt, .handle_interrupt = lps22df_handle_interrupt, .trigger_set = lps22df_trigger_set, #endif diff --git a/drivers/sensor/st/lps2xdf/lps28dfw.c b/drivers/sensor/st/lps2xdf/lps28dfw.c index 40ea39bb571c9..22715d6ff602f 100644 --- a/drivers/sensor/st/lps2xdf/lps28dfw.c +++ b/drivers/sensor/st/lps2xdf/lps28dfw.c @@ -47,11 +47,29 @@ static int lps28dfw_sample_fetch(const struct device *dev, enum sensor_channel c return 0; } +#ifdef CONFIG_LPS2XDF_TRIGGER +/** + * lps28dfw_config_interrupt - config the interrupt mode + */ +static int lps28dfw_config_interrupt(const struct device *dev) +{ + const struct lps2xdf_config *const cfg = dev->config; + stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx; + lps28dfw_int_mode_t mode; + + if (lps28dfw_interrupt_mode_get(ctx, &mode) < 0) { + return -EIO; + } + + mode.drdy_latched = ~cfg->drdy_pulsed; + + return lps28dfw_interrupt_mode_set(ctx, &mode); +} + /** * lps28dfw_handle_interrupt - handle the drdy event * read data and call handler if registered any */ -#ifdef CONFIG_LPS2XDF_TRIGGER static void lps28dfw_handle_interrupt(const struct device *dev) { int ret; @@ -105,7 +123,7 @@ static int lps28dfw_enable_int(const struct device *dev, int enable) } /** - * lps22df_trigger_set - link external trigger to event data ready + * lps28dfw_trigger_set - link external trigger to event data ready */ static int lps28dfw_trigger_set(const struct device *dev, const struct sensor_trigger *trig, @@ -145,6 +163,7 @@ const struct lps2xdf_chip_api st_lps28dfw_chip_api = { .mode_set_odr_raw = lps28dfw_mode_set_odr_raw, .sample_fetch = lps28dfw_sample_fetch, #if CONFIG_LPS2XDF_TRIGGER + .config_interrupt = lps28dfw_config_interrupt, .handle_interrupt = lps28dfw_handle_interrupt, .trigger_set = lps28dfw_trigger_set, #endif diff --git a/drivers/sensor/st/lps2xdf/lps2xdf.h b/drivers/sensor/st/lps2xdf/lps2xdf.h index fab350f93558c..aebbf13ba6295 100644 --- a/drivers/sensor/st/lps2xdf/lps2xdf.h +++ b/drivers/sensor/st/lps2xdf/lps2xdf.h @@ -41,6 +41,7 @@ typedef int32_t (*api_lps2xdf_mode_set_odr_raw)(const struct device *dev, uint8_t odr); typedef int32_t (*api_lps2xdf_sample_fetch)(const struct device *dev, enum sensor_channel chan); #ifdef CONFIG_LPS2XDF_TRIGGER +typedef int (*api_lps2xdf_config_interrupt)(const struct device *dev); typedef void (*api_lps2xdf_handle_interrupt)(const struct device *dev); typedef int (*api_lps2xdf_trigger_set)(const struct device *dev, const struct sensor_trigger *trig, @@ -51,6 +52,7 @@ struct lps2xdf_chip_api { api_lps2xdf_mode_set_odr_raw mode_set_odr_raw; api_lps2xdf_sample_fetch sample_fetch; #ifdef CONFIG_LPS2XDF_TRIGGER + api_lps2xdf_config_interrupt config_interrupt; api_lps2xdf_handle_interrupt handle_interrupt; api_lps2xdf_trigger_set trigger_set; #endif @@ -126,6 +128,8 @@ struct lps2xdf_data { }; #ifdef CONFIG_LPS2XDF_TRIGGER +int lps2xdf_config_int(const struct device *dev); + int lps2xdf_trigger_set(const struct device *dev, const struct sensor_trigger *trig, sensor_trigger_handler_t handler); diff --git a/drivers/sensor/st/lps2xdf/lps2xdf_trigger.c b/drivers/sensor/st/lps2xdf/lps2xdf_trigger.c index b196e1f40c2d1..de51ba14e6ef4 100644 --- a/drivers/sensor/st/lps2xdf/lps2xdf_trigger.c +++ b/drivers/sensor/st/lps2xdf/lps2xdf_trigger.c @@ -27,6 +27,14 @@ LOG_MODULE_DECLARE(LPS2XDF, CONFIG_SENSOR_LOG_LEVEL); +int lps2xdf_config_int(const struct device *dev) +{ + const struct lps2xdf_config *const cfg = dev->config; + const struct lps2xdf_chip_api *chip_api = cfg->chip_api; + + return chip_api->config_interrupt(dev); +} + int lps2xdf_trigger_set(const struct device *dev, const struct sensor_trigger *trig, sensor_trigger_handler_t handler) @@ -111,7 +119,6 @@ int lps2xdf_init_interrupt(const struct device *dev, enum sensor_variant variant { struct lps2xdf_data *lps2xdf = dev->data; const struct lps2xdf_config *cfg = dev->config; - stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx; int ret; /* setup data ready gpio interrupt */ @@ -164,32 +171,10 @@ int lps2xdf_init_interrupt(const struct device *dev, enum sensor_variant variant LOG_DBG("drdy_pulsed is %d", (int)cfg->drdy_pulsed); /* enable drdy in pulsed/latched mode */ - if (variant == DEVICE_VARIANT_LPS22DF) { -#if DT_HAS_COMPAT_STATUS_OKAY(st_lps22df) - lps22df_int_mode_t mode; - - if (lps22df_interrupt_mode_get(ctx, &mode) < 0) { - return -EIO; - } - mode.drdy_latched = ~cfg->drdy_pulsed; - if (lps22df_interrupt_mode_set(ctx, &mode) < 0) { - return -EIO; - } -#endif - } else if (variant == DEVICE_VARIANT_LPS28DFW) { -#if DT_HAS_COMPAT_STATUS_OKAY(st_lps28dfw) - lps28dfw_int_mode_t mode; - - if (lps28dfw_interrupt_mode_get(ctx, &mode) < 0) { - return -EIO; - } - mode.drdy_latched = ~cfg->drdy_pulsed; - if (lps28dfw_interrupt_mode_set(ctx, &mode) < 0) { - return -EIO; - } -#endif - } else { - return -ENOTSUP; + ret = lps2xdf_config_int(dev); + if (ret < 0) { + LOG_ERR("Could not configure interrupt mode"); + return ret; } #if (DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(st_lps22df, i3c) ||\ From 4c3606a3bf26900150e901e8f3c48266087d3b7c Mon Sep 17 00:00:00 2001 From: Armando Visconti Date: Fri, 11 Oct 2024 16:52:36 +0200 Subject: [PATCH 1404/4482] drivers/sensor: lps2xdf: Fix typo in Kconfig Change I2C into I3C as it is a typo. Signed-off-by: Armando Visconti --- drivers/sensor/st/lps2xdf/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/sensor/st/lps2xdf/Kconfig b/drivers/sensor/st/lps2xdf/Kconfig index e00e788497a5c..94d70cc2fadb2 100644 --- a/drivers/sensor/st/lps2xdf/Kconfig +++ b/drivers/sensor/st/lps2xdf/Kconfig @@ -11,7 +11,7 @@ menuconfig LPS2XDF depends on ZEPHYR_HAL_ST_MODULE select I2C if $(dt_compat_on_bus,$(DT_COMPAT_ST_LPS22DF),i2c) ||\ $(dt_compat_on_bus,$(DT_COMPAT_ST_LPS28DFW),i2c) - select I2C if $(dt_compat_on_bus,$(DT_COMPAT_ST_LPS22DF),i3c) ||\ + select I3C if $(dt_compat_on_bus,$(DT_COMPAT_ST_LPS22DF),i3c) ||\ $(dt_compat_on_bus,$(DT_COMPAT_ST_LPS28DFW),i3c) select SPI if $(dt_compat_on_bus,$(DT_COMPAT_ST_LPS22DF),spi) select HAS_STMEMSC From 5be36eef47c006a4238400df79d6b667cc809b58 Mon Sep 17 00:00:00 2001 From: Armando Visconti Date: Fri, 11 Oct 2024 18:13:25 +0200 Subject: [PATCH 1405/4482] drivers/sensor: lps2xdf: add ilps22qs support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ILPS22QS is an ultra-compact piezoresistive absolute pressure sensor which functions as a digital output barometer, supporting dual full-scale up to user- selectable 4060 hPa. The device delivers ultra-low pressure noise with very low power consumption and operates over an extended temperature range from -40 °C to +105 °C. (https://www.st.com/en/mems-and-sensors/ilps22qs.html) Signed-off-by: Armando Visconti --- drivers/sensor/st/lps2xdf/CMakeLists.txt | 1 + drivers/sensor/st/lps2xdf/Kconfig | 9 +- drivers/sensor/st/lps2xdf/ilps22qs.c | 175 ++++++++++++++++++++ drivers/sensor/st/lps2xdf/ilps22qs.h | 23 +++ drivers/sensor/st/lps2xdf/lps2xdf.c | 11 +- drivers/sensor/st/lps2xdf/lps2xdf.h | 17 +- dts/bindings/sensor/st,ilps22qs-common.yaml | 83 ++++++++++ dts/bindings/sensor/st,ilps22qs-i2c.yaml | 10 ++ dts/bindings/sensor/st,ilps22qs-i3c.yaml | 10 ++ dts/bindings/sensor/st,ilps22qs-spi.yaml | 10 ++ include/zephyr/dt-bindings/sensor/lps2xdf.h | 4 + tests/drivers/build_all/sensor/app.overlay | 3 +- tests/drivers/build_all/sensor/i2c.dtsi | 18 +- tests/drivers/build_all/sensor/i3c.dtsi | 6 + tests/drivers/build_all/sensor/spi.dtsi | 7 + 15 files changed, 374 insertions(+), 13 deletions(-) create mode 100644 drivers/sensor/st/lps2xdf/ilps22qs.c create mode 100644 drivers/sensor/st/lps2xdf/ilps22qs.h create mode 100644 dts/bindings/sensor/st,ilps22qs-common.yaml create mode 100644 dts/bindings/sensor/st,ilps22qs-i2c.yaml create mode 100644 dts/bindings/sensor/st,ilps22qs-i3c.yaml create mode 100644 dts/bindings/sensor/st,ilps22qs-spi.yaml diff --git a/drivers/sensor/st/lps2xdf/CMakeLists.txt b/drivers/sensor/st/lps2xdf/CMakeLists.txt index 24a1b5844a8ee..40fb08371a406 100644 --- a/drivers/sensor/st/lps2xdf/CMakeLists.txt +++ b/drivers/sensor/st/lps2xdf/CMakeLists.txt @@ -8,6 +8,7 @@ zephyr_library() zephyr_library_sources(lps2xdf.c) +zephyr_library_sources_ifdef(CONFIG_DT_HAS_ST_ILPS22QS_ENABLED ilps22qs.c ) zephyr_library_sources_ifdef(CONFIG_DT_HAS_ST_LPS22DF_ENABLED lps22df.c ) zephyr_library_sources_ifdef(CONFIG_DT_HAS_ST_LPS28DFW_ENABLED lps28dfw.c ) zephyr_library_sources_ifdef(CONFIG_LPS2XDF_TRIGGER lps2xdf_trigger.c) diff --git a/drivers/sensor/st/lps2xdf/Kconfig b/drivers/sensor/st/lps2xdf/Kconfig index 94d70cc2fadb2..02eec8cc2c636 100644 --- a/drivers/sensor/st/lps2xdf/Kconfig +++ b/drivers/sensor/st/lps2xdf/Kconfig @@ -7,14 +7,19 @@ menuconfig LPS2XDF bool "LPS2xDF pressure and temperature" default y - depends on DT_HAS_ST_LPS22DF_ENABLED || DT_HAS_ST_LPS28DFW_ENABLED + depends on DT_HAS_ST_LPS22DF_ENABLED || DT_HAS_ST_LPS28DFW_ENABLED ||\ + DT_HAS_ST_ILPS22QS_ENABLED depends on ZEPHYR_HAL_ST_MODULE select I2C if $(dt_compat_on_bus,$(DT_COMPAT_ST_LPS22DF),i2c) ||\ + $(dt_compat_on_bus,$(DT_COMPAT_ST_ILPS22QS),i2c) ||\ $(dt_compat_on_bus,$(DT_COMPAT_ST_LPS28DFW),i2c) select I3C if $(dt_compat_on_bus,$(DT_COMPAT_ST_LPS22DF),i3c) ||\ + $(dt_compat_on_bus,$(DT_COMPAT_ST_ILPS22QS),i3c) ||\ $(dt_compat_on_bus,$(DT_COMPAT_ST_LPS28DFW),i3c) - select SPI if $(dt_compat_on_bus,$(DT_COMPAT_ST_LPS22DF),spi) + select SPI if $(dt_compat_on_bus,$(DT_COMPAT_ST_LPS22DF),spi) ||\ + $(dt_compat_on_bus,$(DT_COMPAT_ST_ILPS22QS),spi) select HAS_STMEMSC + select USE_STDC_ILPS22QS if DT_HAS_ST_ILPS22QS_ENABLED select USE_STDC_LPS22DF if DT_HAS_ST_LPS22DF_ENABLED select USE_STDC_LPS28DFW if DT_HAS_ST_LPS28DFW_ENABLED help diff --git a/drivers/sensor/st/lps2xdf/ilps22qs.c b/drivers/sensor/st/lps2xdf/ilps22qs.c new file mode 100644 index 0000000000000..e320ea941302c --- /dev/null +++ b/drivers/sensor/st/lps2xdf/ilps22qs.c @@ -0,0 +1,175 @@ +/* ST Microelectronics ILPS22QS pressure and temperature sensor + * + * Copyright (c) 2023-2024 STMicroelectronics + * Copyright (c) 2023 PHYTEC Messtechnik GmbH + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "lps2xdf.h" +#include "ilps22qs.h" +#include + +LOG_MODULE_DECLARE(LPS2XDF, CONFIG_SENSOR_LOG_LEVEL); + +static inline int ilps22qs_mode_set_odr_raw(const struct device *dev, uint8_t odr) +{ + const struct lps2xdf_config *const cfg = dev->config; + stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx; + ilps22qs_md_t md = { 0 }; + + md.odr = odr; + md.avg = cfg->avg; + md.lpf = cfg->lpf; + md.fs = cfg->fs; + + return ilps22qs_mode_set(ctx, &md); +} + +static int ilps22qs_sample_fetch(const struct device *dev, enum sensor_channel chan) +{ + struct lps2xdf_data *data = dev->data; + const struct lps2xdf_config *const cfg = dev->config; + stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx; + ilps22qs_data_t raw_data; + ilps22qs_md_t md = { 0 }; + + md.fs = cfg->fs; + + if (ilps22qs_data_get(ctx, &md, &raw_data) < 0) { + LOG_DBG("Failed to read sample"); + return -EIO; + } + + data->sample_press = raw_data.pressure.raw; + data->sample_temp = raw_data.heat.raw; + + return 0; +} + +#ifdef CONFIG_LPS2XDF_TRIGGER +/** + * ilps22qs_config_interrupt - not supported + */ +static int ilps22qs_config_interrupt(const struct device *dev) +{ + return -ENOTSUP; +} + +/** + * ilps22qs_handle_interrupt - not supported + */ +static void ilps22qs_handle_interrupt(const struct device *dev) +{ +} + +/** + * ilps22qs_trigger_set - not supported + */ +static int ilps22qs_trigger_set(const struct device *dev, + const struct sensor_trigger *trig, + sensor_trigger_handler_t handler) +{ + return -ENOTSUP; +} +#endif /* CONFIG_LPS2XDF_TRIGGER */ + +const struct lps2xdf_chip_api st_ilps22qs_chip_api = { + .mode_set_odr_raw = ilps22qs_mode_set_odr_raw, + .sample_fetch = ilps22qs_sample_fetch, +#if CONFIG_LPS2XDF_TRIGGER + .config_interrupt = ilps22qs_config_interrupt, + .handle_interrupt = ilps22qs_handle_interrupt, + .trigger_set = ilps22qs_trigger_set, +#endif +}; + +int st_ilps22qs_init(const struct device *dev) +{ + const struct lps2xdf_config *const cfg = dev->config; + stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx; + ilps22qs_id_t id; + ilps22qs_stat_t status; + uint8_t tries = 10; + int ret; + +#if DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(st_ilps22qs, i3c) + if (cfg->i3c.bus != NULL) { + struct lps2xdf_data *data = dev->data; + /* + * Need to grab the pointer to the I3C device descriptor + * before we can talk to the sensor. + */ + data->i3c_dev = i3c_device_find(cfg->i3c.bus, &cfg->i3c.dev_id); + if (data->i3c_dev == NULL) { + LOG_ERR("Cannot find I3C device descriptor"); + return -ENODEV; + } + } +#endif + + if (ilps22qs_id_get(ctx, &id) < 0) { + LOG_ERR("%s: Not able to read dev id", dev->name); + return -EIO; + } + + if (id.whoami != ILPS22QS_ID) { + LOG_ERR("%s: Invalid chip ID 0x%02x", dev->name, id.whoami); + return -EIO; + } + + LOG_DBG("%s: chip id 0x%x", dev->name, id.whoami); + + /* Restore default configuration */ + if (ilps22qs_init_set(ctx, ILPS22QS_RESET) < 0) { + LOG_ERR("%s: Not able to reset device", dev->name); + return -EIO; + } + + do { + if (!--tries) { + LOG_DBG("sw reset timed out"); + return -ETIMEDOUT; + } + k_usleep(LPS2XDF_SWRESET_WAIT_TIME_US); + + if (ilps22qs_status_get(ctx, &status) < 0) { + return -EIO; + } + } while (status.sw_reset); + + /* Set bdu and if_inc recommended for driver usage */ + if (ilps22qs_init_set(ctx, ILPS22QS_DRV_RDY) < 0) { + LOG_ERR("%s: Not able to set device to ready state", dev->name); + return -EIO; + } + + if (ON_I3C_BUS(cfg)) { + ilps22qs_bus_mode_t bus_mode; + + /* Select bus interface */ + ilps22qs_bus_mode_get(ctx, &bus_mode); + bus_mode.filter = ILPS22QS_AUTO; + bus_mode.interface = ILPS22QS_SEL_BY_HW; + ilps22qs_bus_mode_set(ctx, &bus_mode); + } + + /* set sensor default odr */ + LOG_DBG("%s: odr: %d", dev->name, cfg->odr); + ret = ilps22qs_mode_set_odr_raw(dev, cfg->odr); + if (ret < 0) { + LOG_ERR("%s: Failed to set odr %d", dev->name, cfg->odr); + return ret; + } + +#ifdef CONFIG_LPS2XDF_TRIGGER + if (cfg->trig_enabled) { + if (lps2xdf_init_interrupt(dev, DEVICE_VARIANT_ILPS22QS) < 0) { + LOG_ERR("Failed to initialize interrupt."); + return -EIO; + } + } +#endif + + return 0; +} diff --git a/drivers/sensor/st/lps2xdf/ilps22qs.h b/drivers/sensor/st/lps2xdf/ilps22qs.h new file mode 100644 index 0000000000000..eb2488eeb5746 --- /dev/null +++ b/drivers/sensor/st/lps2xdf/ilps22qs.h @@ -0,0 +1,23 @@ +/* ST Microelectronics ILPS22QS pressure and temperature sensor + * + * Copyright (c) 2023-2024 STMicroelectronics + * Copyright (c) 2023 PHYTEC Messtechnik GmbH + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include "ilps22qs_reg.h" + +#include + +#ifndef ZEPHYR_DRIVERS_SENSOR_ILPS22QS_ILPS22QS_H_ +#define ZEPHYR_DRIVERS_SENSOR_ILPS22QS_ILPS22QS_H_ + +extern const struct lps2xdf_chip_api st_ilps22qs_chip_api; + +int st_ilps22qs_init(const struct device *dev); + +#endif /* ZEPHYR_DRIVERS_SENSOR_ILPS22QS_H_ */ diff --git a/drivers/sensor/st/lps2xdf/lps2xdf.c b/drivers/sensor/st/lps2xdf/lps2xdf.c index 2196c265ffc23..0fb7ce87bf828 100644 --- a/drivers/sensor/st/lps2xdf/lps2xdf.c +++ b/drivers/sensor/st/lps2xdf/lps2xdf.c @@ -6,6 +6,7 @@ * SPDX-License-Identifier: Apache-2.0 * * Datasheet: + * https://www.st.com/resource/en/datasheet/ilps22qs.pdf * https://www.st.com/resource/en/datasheet/lps22df.pdf * https://www.st.com/resource/en/datasheet/lps28df.pdf */ @@ -20,6 +21,10 @@ #include "lps2xdf.h" +#if DT_HAS_COMPAT_STATUS_OKAY(st_ilps22qs) +#include "ilps22qs.h" +#endif + #if DT_HAS_COMPAT_STATUS_OKAY(st_lps22df) #include "lps22df.h" #endif @@ -159,7 +164,7 @@ static const struct sensor_driver_api lps2xdf_driver_api = { .lpf = DT_INST_PROP(inst, lpf), \ .avg = DT_INST_PROP(inst, avg), \ .chip_api = &name##_chip_api, \ - IF_ENABLED(DT_INST_NODE_HAS_COMPAT(inst, st_lps28dfw), \ + IF_ENABLED(DT_INST_NODE_HAS_PROP(inst, fs), \ (.fs = DT_INST_PROP(inst, fs),)) \ IF_ENABLED(DT_INST_NODE_HAS_PROP(inst, drdy_gpios), \ (LPS2XDF_CFG_IRQ(inst))) @@ -214,6 +219,10 @@ static const struct sensor_driver_api lps2xdf_driver_api = { &lps2xdf_config_##name##_##inst, POST_KERNEL, \ CONFIG_SENSOR_INIT_PRIORITY, &lps2xdf_driver_api); +#define DT_DRV_COMPAT st_ilps22qs +DT_INST_FOREACH_STATUS_OKAY_VARGS(LPS2XDF_DEFINE, DT_DRV_COMPAT) +#undef DT_DRV_COMPAT + #define DT_DRV_COMPAT st_lps22df DT_INST_FOREACH_STATUS_OKAY_VARGS(LPS2XDF_DEFINE, DT_DRV_COMPAT) #undef DT_DRV_COMPAT diff --git a/drivers/sensor/st/lps2xdf/lps2xdf.h b/drivers/sensor/st/lps2xdf/lps2xdf.h index aebbf13ba6295..34137d0af00f5 100644 --- a/drivers/sensor/st/lps2xdf/lps2xdf.h +++ b/drivers/sensor/st/lps2xdf/lps2xdf.h @@ -4,10 +4,6 @@ * Copyright (c) 2023 PHYTEC Messtechnik GmbH * * SPDX-License-Identifier: Apache-2.0 - * - * Datasheets: - * https://www.st.com/resource/en/datasheet/lps22df.pdf - * https://www.st.com/resource/en/datasheet/lps28dfw.pdf */ #ifndef ZEPHYR_DRIVERS_SENSOR_LPS2XDF_LPS2XDF_H_ @@ -16,6 +12,10 @@ #include #include +#if DT_HAS_COMPAT_STATUS_OKAY(st_ilps22qs) +#include "ilps22qs_reg.h" +#endif + #if DT_HAS_COMPAT_STATUS_OKAY(st_lps28dfw) #include "lps28dfw_reg.h" #endif @@ -32,6 +32,7 @@ #define LPS2XDF_SWRESET_WAIT_TIME_US 50 #if (DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(st_lps22df, i3c) || \ + DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(st_ilps22qs, i3c) || \ DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(st_lps28dfw, i3c)) #define ON_I3C_BUS(cfg) (cfg->i3c.bus != NULL) #else @@ -62,6 +63,7 @@ struct lps2xdf_chip_api { enum sensor_variant { DEVICE_VARIANT_LPS22DF = 0, DEVICE_VARIANT_LPS28DFW = 1, + DEVICE_VARIANT_ILPS22QS = 2, }; @@ -69,13 +71,16 @@ struct lps2xdf_config { stmdev_ctx_t ctx; union { #if (DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(st_lps22df, i2c) || \ + DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(st_ilps22qs, i2c) || \ DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(st_lps28dfw, i2c)) const struct i2c_dt_spec i2c; #endif -#if DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(st_lps22df, spi) +#if (DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(st_lps22df, spi) ||\ + DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(st_ilps22qs, spi)) const struct spi_dt_spec spi; #endif #if (DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(st_lps22df, i3c) || \ + DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(st_ilps22qs, i3c) || \ DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(st_lps28dfw, i3c)) struct i3c_device_desc **i3c; #endif @@ -91,6 +96,7 @@ struct lps2xdf_config { #endif #if (DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(st_lps22df, i3c) || \ + DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(st_ilps22qs, i3c) || \ DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(st_lps28dfw, i3c)) struct { const struct device *bus; @@ -122,6 +128,7 @@ struct lps2xdf_data { #endif /* CONFIG_LPS2XDF_TRIGGER */ #if (DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(st_lps22df, i3c) || \ + DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(st_ilps22qs, i3c) || \ DT_HAS_COMPAT_ON_BUS_STATUS_OKAY(st_lps28dfw, i3c)) struct i3c_device_desc *i3c_dev; #endif diff --git a/dts/bindings/sensor/st,ilps22qs-common.yaml b/dts/bindings/sensor/st,ilps22qs-common.yaml new file mode 100644 index 0000000000000..78f9687c26304 --- /dev/null +++ b/dts/bindings/sensor/st,ilps22qs-common.yaml @@ -0,0 +1,83 @@ +# Copyright (c) 2023-2024 STMicroelectronics +# Copyright (c) 2023 PHYTEC Messtechnik GmbH +# SPDX-License-Identifier: Apache-2.0 + +description: | + When setting the odr, lpf, avg properties in a .dts or .dtsi file + you may include ilps22qs.h and use the macros defined there. + + Example: + #include + + ilps22qs@5d { + ... + + odr = ; + lpf = ; + avg = ; + }; + +include: sensor-device.yaml + +properties: + odr: + type: int + default: 0 + description: | + Specify the output data rate expressed in samples per second (Hz). + The default is the power-on reset value. + + - 0 # LPS2xDF_DT_ODR_POWER_DOWN + - 1 # LPS2xDF_DT_ODR_1HZ + - 2 # LPS2xDF_DT_ODR_4HZ + - 3 # LPS2xDF_DT_ODR_10HZ + - 4 # LPS2xDF_DT_ODR_25HZ + - 5 # LPS2xDF_DT_ODR_50HZ + - 6 # LPS2xDF_DT_ODR_75HZ + - 7 # LPS2xDF_DT_ODR_100HZ + - 8 # LPS2xDF_DT_ODR_200HZ + + enum: [0, 1, 2, 3, 4, 5, 6, 7, 8] + + lpf: + type: int + default: 0 + description: | + Specify the low pass filter value to be applied to pressure data. + The default is the power-on reset value. + + - 0 # LPS2xDF_DT_LP_FILTER_OFF + - 1 # LPS2xDF_DT_LP_FILTER_ODR_4 + - 3 # LPS2xDF_DT_LP_FILTER_ODR_9 + + enum: [0, 1, 3] + + avg: + type: int + default: 0 + description: | + Specify the average filter value (i.e. number of samples) to be applied + to pressure and temperature data. + The default is the power-on reset value. + + - 0 # LPS2xDF_DT_AVG_4_SAMPLES + - 1 # LPS2xDF_DT_AVG_8_SAMPLES + - 2 # LPS2xDF_DT_AVG_16_SAMPLES + - 3 # LPS2xDF_DT_AVG_32_SAMPLES + - 4 # LPS2xDF_DT_AVG_64_SAMPLES + - 5 # LPS2xDF_DT_AVG_128_SAMPLES + - 6 # LPS2xDF_DT_AVG_256_SAMPLES + - 7 # LPS2xDF_DT_AVG_512_SAMPLES + + enum: [0, 1, 2, 3, 4, 5, 6, 7] + + fs: + type: int + default: 0 + description: | + Specify the full-scale mode. + The default is the power-on reset value. + + - 0 # ILPS22QS_DT_FS_MODE_1_1260 + - 1 # ILPS22QS_DT_FS_MODE_2_4060 + enum: [0, 1] diff --git a/dts/bindings/sensor/st,ilps22qs-i2c.yaml b/dts/bindings/sensor/st,ilps22qs-i2c.yaml new file mode 100644 index 0000000000000..b8c9a7929c4f2 --- /dev/null +++ b/dts/bindings/sensor/st,ilps22qs-i2c.yaml @@ -0,0 +1,10 @@ +# Copyright (c) 2024 STMicroelectronics +# SPDX-License-Identifier: Apache-2.0 + +description: | + STMicroelectronics LPS22DF pressure and temperature sensor connected to I2C + bus + +compatible: "st,ilps22qs" + +include: ["i2c-device.yaml", "st,ilps22qs-common.yaml"] diff --git a/dts/bindings/sensor/st,ilps22qs-i3c.yaml b/dts/bindings/sensor/st,ilps22qs-i3c.yaml new file mode 100644 index 0000000000000..89a807d6ae128 --- /dev/null +++ b/dts/bindings/sensor/st,ilps22qs-i3c.yaml @@ -0,0 +1,10 @@ +# Copyright (c) 2024 STMicroelectronics +# SPDX-License-Identifier: Apache-2.0 + +description: | + STMicroelectronics LPS22DF pressure and temperature sensor connected to I3C + bus + +compatible: "st,ilps22qs" + +include: ["i3c-device.yaml", "st,ilps22qs-common.yaml"] diff --git a/dts/bindings/sensor/st,ilps22qs-spi.yaml b/dts/bindings/sensor/st,ilps22qs-spi.yaml new file mode 100644 index 0000000000000..1b937101dbbaa --- /dev/null +++ b/dts/bindings/sensor/st,ilps22qs-spi.yaml @@ -0,0 +1,10 @@ +# Copyright (c) 2024 STMicroelectronics +# SPDX-License-Identifier: Apache-2.0 + +description: | + STMicroelectronics LPS22DF pressure and temperature sensor connected to SPI + bus + +compatible: "st,ilps22qs" + +include: ["spi-device.yaml", "st,ilps22qs-common.yaml"] diff --git a/include/zephyr/dt-bindings/sensor/lps2xdf.h b/include/zephyr/dt-bindings/sensor/lps2xdf.h index bcbb831bae57c..b1dffa818a010 100644 --- a/include/zephyr/dt-bindings/sensor/lps2xdf.h +++ b/include/zephyr/dt-bindings/sensor/lps2xdf.h @@ -37,4 +37,8 @@ #define LPS28DFW_DT_FS_MODE_1_1260 0 #define LPS28DFW_DT_FS_MODE_2_4060 1 +/* Full Scale Pressure Mode */ +#define ILPS22QS_DT_FS_MODE_1_1260 0 +#define ILPS22QS_DT_FS_MODE_2_4060 1 + #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_ST_LPS22DF_H_ */ diff --git a/tests/drivers/build_all/sensor/app.overlay b/tests/drivers/build_all/sensor/app.overlay index 6d558b4c7f42d..d4e195a8c812a 100644 --- a/tests/drivers/build_all/sensor/app.overlay +++ b/tests/drivers/build_all/sensor/app.overlay @@ -146,7 +146,8 @@ <&test_gpio 0 0>, <&test_gpio 0 0>, <&test_gpio 0 0>, - <&test_gpio 0 0>; /* 0x2f */ + <&test_gpio 0 0>, + <&test_gpio 0 0>; /* 0x30 */ #include "spi.dtsi" }; diff --git a/tests/drivers/build_all/sensor/i2c.dtsi b/tests/drivers/build_all/sensor/i2c.dtsi index cb59ee4ecd31f..9a21c61a698a7 100644 --- a/tests/drivers/build_all/sensor/i2c.dtsi +++ b/tests/drivers/build_all/sensor/i2c.dtsi @@ -1101,17 +1101,27 @@ test_i2c_bmp390: bmp390@99 { iir-filter = <3>; }; -apds_9306: apds9306@92 { +apds_9306: apds9306@9a { compatible = "avago,apds9306"; - reg = <0x92>; + reg = <0x9a>; status = "okay"; gain = <1>; resolution = <13>; frequency = <2000>; }; -test_i2c_wsen_hids_2525020210002: wsen_hids_2525020210002@99 { +test_i2c_wsen_hids_2525020210002: wsen_hids_2525020210002@9b { compatible = "we,wsen-hids-2525020210002"; - reg = <0x99>; + reg = <0x9b>; precision = "high"; }; + +test_i2c_ilps22qs: ilps22qs@9c { + compatible = "st,ilps22qs"; + reg = <0x9c>; + status = "okay"; + odr = ; + lpf = ; + avg = ; + fs = ; +}; diff --git a/tests/drivers/build_all/sensor/i3c.dtsi b/tests/drivers/build_all/sensor/i3c.dtsi index d90c72bc1543a..caf72488c1605 100644 --- a/tests/drivers/build_all/sensor/i3c.dtsi +++ b/tests/drivers/build_all/sensor/i3c.dtsi @@ -30,3 +30,9 @@ test_i3c_lps28dfw: lps28dfw@300000803E0000003 { assigned-address = <0x3>; drdy-gpios = <&test_gpio 0 0>; }; + +test_i3c_ilps22qs: ilps22qs@400000803E0000004 { + compatible = "st,ilps22qs"; + reg = <0x3 0x00000803 0xE0000004>; + assigned-address = <0x4>; +}; diff --git a/tests/drivers/build_all/sensor/spi.dtsi b/tests/drivers/build_all/sensor/spi.dtsi index a3dd43713e4c1..b03e5c028dbda 100644 --- a/tests/drivers/build_all/sensor/spi.dtsi +++ b/tests/drivers/build_all/sensor/spi.dtsi @@ -392,3 +392,10 @@ test_spi_bmp390: bmp390@2f { osr-temp = <1>; iir-filter = <3>; }; + +test_spi_ilps22qs: ilps22qs@30 { + compatible = "st,ilps22qs"; + reg = <0x30>; + spi-max-frequency = <0>; + status = "okay"; +}; From f43816279ca9ddf2c8dfe8643f94aae8804cc7d9 Mon Sep 17 00:00:00 2001 From: Armando Visconti Date: Mon, 14 Oct 2024 15:14:21 +0200 Subject: [PATCH 1406/4482] boards: st: steval_stwinbx1: add ilps22qs support Add support to ILPS22QS barometer. Signed-off-by: Armando Visconti --- boards/st/steval_stwinbx1/steval_stwinbx1.dts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/boards/st/steval_stwinbx1/steval_stwinbx1.dts b/boards/st/steval_stwinbx1/steval_stwinbx1.dts index 040452e91b00e..1ca613ff12d23 100644 --- a/boards/st/steval_stwinbx1/steval_stwinbx1.dts +++ b/boards/st/steval_stwinbx1/steval_stwinbx1.dts @@ -218,6 +218,12 @@ stm32_lp_tick_source: &lptim1 { drdy-gpios = <&gpiof 9 GPIO_ACTIVE_HIGH>; status = "okay"; }; + + ilps22qs@5c { + compatible = "st,ilps22qs"; + reg = <0x5c>; + status = "okay"; + }; }; &timers5 { From 00c119776bc3be9711aeb16b83ad76661cb944ed Mon Sep 17 00:00:00 2001 From: Armando Visconti Date: Mon, 14 Oct 2024 15:17:35 +0200 Subject: [PATCH 1407/4482] sample: board: STWIN.box: add ilps22qs sensor data stream Add ilps22qs data streaming. Signed-off-by: Armando Visconti --- .../st/steval_stwinbx1/sensors/README.rst | 3 ++ .../st/steval_stwinbx1/sensors/src/main.c | 37 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/samples/boards/st/steval_stwinbx1/sensors/README.rst b/samples/boards/st/steval_stwinbx1/sensors/README.rst index bf3f1d91a4802..9f276fd066c58 100644 --- a/samples/boards/st/steval_stwinbx1/sensors/README.rst +++ b/samples/boards/st/steval_stwinbx1/sensors/README.rst @@ -17,6 +17,7 @@ sensors: - ISM330DHCX: IMU, 3D accelerometer and 3D gyroscope with Machine Learning Core and Finite State Machine - IIS2DLPC: high-performance ultra-low-power 3-axis accelerometer for industrial applications - IIS2ICLX: high-accuracy, high-resolution, low-power, 2-axis digital inclinometer with Machine Learning Core +- ILPS22QS: ultra-compact piezoresistive absolute pressure sensor Requirements ************ @@ -70,6 +71,8 @@ The sample code outputs sensors data on the STWIN.box console. ISM330DHCX: Accel (m.s-2): x: 0.000, y: 5.704, z: 7.982 ISM330DHCX: Gyro (dps): x: 0.026, y: -0.006, z: -0.008 IIS2ICLX: Accel (m.s-2): x: -0.157, y: 5.699 + ILPS22QS: Temperature: 26.4 C + ILPS22QS: Pressure: 100.539 kpa 1:: iis2dlpc trig 2021 1:: iis2mdc trig 993 1:: ism330dhcx acc trig 4447 diff --git a/samples/boards/st/steval_stwinbx1/sensors/src/main.c b/samples/boards/st/steval_stwinbx1/sensors/src/main.c index 5e4131eff6da7..eda5982b96fb1 100644 --- a/samples/boards/st/steval_stwinbx1/sensors/src/main.c +++ b/samples/boards/st/steval_stwinbx1/sensors/src/main.c @@ -238,6 +238,21 @@ static void ism330dhcx_config(const struct device *ism330dhcx) #endif } +static void ilps22qs_config(const struct device *ilps22qs) +{ + struct sensor_value odr_attr; + + /* set ILPS22QS sampling frequency to 50 Hz */ + odr_attr.val1 = 50; + odr_attr.val2 = 0; + + if (sensor_attr_set(ilps22qs, SENSOR_CHAN_ALL, + SENSOR_ATTR_SAMPLING_FREQUENCY, &odr_attr) < 0) { + printk("Cannot set sampling frequency for ILPS22QS\n"); + return; + } +} + static int led_pattern_out(void) { const struct gpio_dt_spec led0_gpio = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios); @@ -295,6 +310,7 @@ int main(void) const struct device *const ism330dhcx = DEVICE_DT_GET_ONE(st_ism330dhcx); const struct device *const iis2dlpc = DEVICE_DT_GET_ONE(st_iis2dlpc); const struct device *const iis2iclx = DEVICE_DT_GET_ONE(st_iis2iclx); + const struct device *const ilps22qs = DEVICE_DT_GET_ONE(st_ilps22qs); if (!device_is_ready(stts22h)) { printk("%s: device not ready.\n", stts22h->name); @@ -316,12 +332,17 @@ int main(void) printk("%s: device not ready.\n", iis2iclx->name); return 0; } + if (!device_is_ready(ilps22qs)) { + printk("%s: device not ready.\n", ilps22qs->name); + return 0; + } stts22h_config(stts22h); iis2mdc_config(iis2mdc); ism330dhcx_config(ism330dhcx); iis2dlpc_config(iis2dlpc); iis2iclx_config(iis2iclx); + ilps22qs_config(ilps22qs); while (1) { struct sensor_value stts22h_temp; @@ -331,6 +352,7 @@ int main(void) struct sensor_value ism330dhcx_accel[3]; struct sensor_value ism330dhcx_gyro[3]; struct sensor_value iis2iclx_accel[2]; + struct sensor_value ilps22qs_press, ilps22qs_temp; #ifndef CONFIG_STTS22H_TRIGGER if (sensor_sample_fetch(stts22h) < 0) { @@ -363,6 +385,11 @@ int main(void) } #endif + if (sensor_sample_fetch(ilps22qs) < 0) { + printf("ILPS22QS Sensor sample update error\n"); + return 0; + } + sensor_channel_get(stts22h, SENSOR_CHAN_AMBIENT_TEMP, &stts22h_temp); sensor_channel_get(iis2dlpc, SENSOR_CHAN_ACCEL_XYZ, iis2dlpc_accel); sensor_channel_get(iis2mdc, SENSOR_CHAN_MAGN_XYZ, iis2mdc_magn); @@ -370,6 +397,8 @@ int main(void) sensor_channel_get(ism330dhcx, SENSOR_CHAN_ACCEL_XYZ, ism330dhcx_accel); sensor_channel_get(ism330dhcx, SENSOR_CHAN_GYRO_XYZ, ism330dhcx_gyro); sensor_channel_get(iis2iclx, SENSOR_CHAN_ACCEL_XYZ, iis2iclx_accel); + sensor_channel_get(ilps22qs, SENSOR_CHAN_AMBIENT_TEMP, &ilps22qs_temp); + sensor_channel_get(ilps22qs, SENSOR_CHAN_PRESS, &ilps22qs_press); /* Display sensor data */ @@ -413,6 +442,14 @@ int main(void) sensor_value_to_double(&iis2iclx_accel[0]), sensor_value_to_double(&iis2iclx_accel[1])); + /* temperature */ + printf("ILPS22QS: Temperature: %.1f C\n", + sensor_value_to_double(&ilps22qs_temp)); + + /* pressure */ + printf("ILPS22QS: Pressure: %.3f kpa\n", + sensor_value_to_double(&ilps22qs_press)); + #ifdef CONFIG_STTS22H_TRIGGER printk("%d:: stts22h trig %d\n", cnt, stts22h_trig_cnt); #endif From 9e1b3bbb6579f6bef27c4e558db4ff3ca0e435e1 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 11 Oct 2024 11:18:05 +0100 Subject: [PATCH 1408/4482] sysbuild: images: bootloader: kconfig: Limit encryption Limits selecting the encryption option to MCUboot operating modes that support it Signed-off-by: Jamie McCrae --- share/sysbuild/images/bootloader/Kconfig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/share/sysbuild/images/bootloader/Kconfig b/share/sysbuild/images/bootloader/Kconfig index c9622e82f63e4..81b17b5a6e1bd 100644 --- a/share/sysbuild/images/bootloader/Kconfig +++ b/share/sysbuild/images/bootloader/Kconfig @@ -148,9 +148,13 @@ config BOOT_SIGNATURE_KEY_FILE help Absolute path to signing key file to use with MCUBoot. +config SUPPORT_BOOT_ENCRYPTION + bool + depends on !BOOT_SIGNATURE_TYPE_NONE && !MCUBOOT_MODE_DIRECT_XIP && !MCUBOOT_MODE_DIRECT_XIP_WITH_REVERT && !MCUBOOT_MODE_FIRMWARE_UPDATER + config BOOT_ENCRYPTION bool "Encrypted image support" - depends on !BOOT_SIGNATURE_TYPE_NONE + depends on SUPPORT_BOOT_ENCRYPTION help Support encrypted images. From da99144891e424f3a57141366ebabf444db12924 Mon Sep 17 00:00:00 2001 From: Jimmy Zheng Date: Mon, 30 Sep 2024 15:39:31 +0800 Subject: [PATCH 1409/4482] soc: andestech: linker.ld: fix incorrect padding of rom_mpu_padding The rom_mpu_padding section is incorrect NAPOT padding for the address of __rodata_region_end when ROM_BASE is not 0x0, because __rom_region_start is set to the offset of rom_start section. Fixed this by use "__rom_region_start = ABSOLUTE(.);" to keep both __rodata_region_end and __rom_region_start are absolute address. Signed-off-by: Jimmy Zheng --- soc/andestech/ae350/linker.ld | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/andestech/ae350/linker.ld b/soc/andestech/ae350/linker.ld index ff8da59aebc41..4c94c7052123d 100644 --- a/soc/andestech/ae350/linker.ld +++ b/soc/andestech/ae350/linker.ld @@ -116,7 +116,7 @@ SECTIONS { . = ALIGN(16); MPU_ALIGN(__rom_region_size); - __rom_region_start = .; + __rom_region_start = ABSOLUTE(.); /* Located in generated directory. This file is populated by calling * zephyr_linker_sources(ROM_START ...). */ From 6d6c87b9fe6be0b2137e27a7a4bd94187eac5215 Mon Sep 17 00:00:00 2001 From: Jimmy Zheng Date: Mon, 30 Sep 2024 15:49:58 +0800 Subject: [PATCH 1410/4482] dts: riscv: andes: rename plic-sw node to interrupt controller The plic-sw is the same hardware as the plic interrupt contoller and should be used with intc_plic driver instead of separate mbox driver. Renamed plic-sw node from "mbox: mbox-controller@e6400000" to "plic_sw: interrupt-controller@e6400000". Signed-off-by: Jimmy Zheng --- dts/riscv/andes/andes_v5_ae350.dtsi | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/dts/riscv/andes/andes_v5_ae350.dtsi b/dts/riscv/andes/andes_v5_ae350.dtsi index c69a92581adf3..1090dc5417e2d 100644 --- a/dts/riscv/andes/andes_v5_ae350.dtsi +++ b/dts/riscv/andes/andes_v5_ae350.dtsi @@ -179,12 +179,20 @@ &cpu6_intc 11 &cpu7_intc 11>; }; - mbox: mbox-controller@e6400000 { - compatible = "andestech,plic-sw"; - reg = <0xe6400000 0x00400000>; - #mbox-cells = <1>; - channel-max = <30>; - status = "okay"; + plic_sw: interrupt-controller@e6400000 { + compatible = "sifive,plic-1.0.0", "andestech,nceplic100"; + #address-cells = <1>; + #interrupt-cells = <2>; + interrupt-controller; + reg = <0xe6400000 0x04000000>; + riscv,max-priority = <255>; + riscv,ndev = <1023>; + interrupts-extended = <&cpu0_intc 3 &cpu1_intc 3 + &cpu2_intc 3 &cpu3_intc 3 + &cpu4_intc 3 &cpu5_intc 3 + &cpu6_intc 3 &cpu7_intc 3>; + + #size-cells = <0>; }; mtimer: timer@e6000000 { From f4fe84e112b7a3a584eb1ab6c66d462f17e6c967 Mon Sep 17 00:00:00 2001 From: Jimmy Zheng Date: Mon, 7 Oct 2024 13:57:01 +0800 Subject: [PATCH 1411/4482] soc: andestech: ae350: support 2 PLIC instances (PLIC, PLIC-SW) Andes AE350 integrates 2 PLICs in the platfrom, one for external interrupt and another for IPI. Adusted Kconfig for total IRQ numbers and support 2 aggregators in the 2nd level interrupt controller. Signed-off-by: Jimmy Zheng --- soc/andestech/ae350/Kconfig.defconfig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/soc/andestech/ae350/Kconfig.defconfig b/soc/andestech/ae350/Kconfig.defconfig index b760c38d64dda..49d6af78c9122 100644 --- a/soc/andestech/ae350/Kconfig.defconfig +++ b/soc/andestech/ae350/Kconfig.defconfig @@ -30,11 +30,17 @@ config 2ND_LVL_ISR_TBL_OFFSET config 2ND_LVL_INTR_00_OFFSET default 11 +config 2ND_LVL_INTR_01_OFFSET + default 3 + config MAX_IRQ_PER_AGGREGATOR default 52 +config NUM_2ND_LEVEL_AGGREGATORS + default 2 + config NUM_IRQS - default 64 + default 116 choice CACHE_TYPE default EXTERNAL_CACHE From 6caf803a41ec7844ccf4815014ed1e9cc17e371e Mon Sep 17 00:00:00 2001 From: Jimmy Zheng Date: Mon, 30 Sep 2024 16:00:01 +0800 Subject: [PATCH 1412/4482] dts: bindings: mbox: rename plic-sw to mbox-plic-sw Renamed andestech,plic-sw to andestech,mbox-plic-sw because the mbox node is based on the PLIC interrupt controller node instead using the plic hardware directly. Signed-off-by: Jimmy Zheng --- .../adp_xc7k_ae350/adp_xc7k_ae350.dts | 4 ++++ ...ic-sw.yaml => andestech,mbox-plic-sw.yaml} | 11 +++-------- dts/riscv/andes/andes_v5_ae350.dtsi | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 8 deletions(-) rename dts/bindings/mbox/{andestech,plic-sw.yaml => andestech,mbox-plic-sw.yaml} (54%) diff --git a/boards/andestech/adp_xc7k_ae350/adp_xc7k_ae350.dts b/boards/andestech/adp_xc7k_ae350/adp_xc7k_ae350.dts index 58c916130571a..09763df9fffb3 100644 --- a/boards/andestech/adp_xc7k_ae350/adp_xc7k_ae350.dts +++ b/boards/andestech/adp_xc7k_ae350/adp_xc7k_ae350.dts @@ -215,3 +215,7 @@ &dma0 { status = "okay"; }; + +&mbox { + status = "okay"; +}; diff --git a/dts/bindings/mbox/andestech,plic-sw.yaml b/dts/bindings/mbox/andestech,mbox-plic-sw.yaml similarity index 54% rename from dts/bindings/mbox/andestech,plic-sw.yaml rename to dts/bindings/mbox/andestech,mbox-plic-sw.yaml index f054d8c206b68..3aa45bfd3b643 100644 --- a/dts/bindings/mbox/andestech,plic-sw.yaml +++ b/dts/bindings/mbox/andestech,mbox-plic-sw.yaml @@ -5,20 +5,15 @@ # description: | - This is a representation of AndesTech PLIC-SW node + This is a representation of AndesTech MBOX PLIC-SW node -compatible: "andestech,plic-sw" +compatible: "andestech,mbox-plic-sw" include: [base.yaml, mailbox-controller.yaml] properties: - reg: + interrupts: required: true - channel-max: - type: int - required: true - description: Supported channels max - mbox-cells: - channel diff --git a/dts/riscv/andes/andes_v5_ae350.dtsi b/dts/riscv/andes/andes_v5_ae350.dtsi index 1090dc5417e2d..a4edbb613c083 100644 --- a/dts/riscv/andes/andes_v5_ae350.dtsi +++ b/dts/riscv/andes/andes_v5_ae350.dtsi @@ -193,6 +193,25 @@ &cpu6_intc 3 &cpu7_intc 3>; #size-cells = <0>; + mbox: mbox-controller@0 { + compatible = "andestech,mbox-plic-sw"; + #mbox-cells = <1>; + reg = <0>; + interrupts = <9 1>, <10 1>, <11 1>, <12 1>, + <13 1>, <14 1>, <15 1>, <16 1>, + <17 1>, <18 1>, <19 1>, <20 1>, + <21 1>, <22 1>, <23 1>, <24 1>, + <25 1>, <26 1>, <27 1>, <28 1>, + <29 1>, <30 1>, <31 1>; + interrupt-names = "mbox_9", "mbox_10", "mbox_11", "mbox_12", + "mbox_13", "mbox_14", "mbox_15", "mbox_16", + "mbox_17", "mbox_18", "mbox_19", "mbox_20", + "mbox_21", "mbox_22", "mbox_23", "mbox_24", + "mbox_25", "mbox_26", "mbox_27", "mbox_28", + "mbox_29", "mbox_30", "mbox_31"; + interrupt-parent = <&plic_sw>; + status = "disabled"; + }; }; mtimer: timer@e6000000 { From 6658b9c02c32ccb9aad6c27add135a00011fbb80 Mon Sep 17 00:00:00 2001 From: Jimmy Zheng Date: Mon, 7 Oct 2024 13:57:32 +0800 Subject: [PATCH 1413/4482] drivers: mbox: rework andes mbox plic to leverage intc_plic driver Andes MBOX PLIC-SW use the same hardware as intc_plic driver. Reworked mbox_andes_plic_sw implementation to leverage the intc_plic driver. Signed-off-by: Jimmy Zheng --- drivers/mbox/Kconfig.andes | 7 +- drivers/mbox/mbox_andes_plic_sw.c | 239 +++++++++++------------------- 2 files changed, 92 insertions(+), 154 deletions(-) diff --git a/drivers/mbox/Kconfig.andes b/drivers/mbox/Kconfig.andes index 6412e9fb6928e..33f323e639ca9 100644 --- a/drivers/mbox/Kconfig.andes +++ b/drivers/mbox/Kconfig.andes @@ -8,7 +8,8 @@ config MBOX_ANDES_PLIC_SW bool "MBOX Andes PLIC-SW driver" default y - depends on DT_HAS_ANDESTECH_PLIC_SW_ENABLED + depends on DT_HAS_ANDESTECH_MBOX_PLIC_SW_ENABLED + depends on PLIC_SUPPORTS_SOFT_INTERRUPT + select DYNAMIC_INTERRUPTS help - Enable driver for the Andes IPM mailbox controller. - Says n if not sure. + Enable the driver for the Andes PLIC-SW based MBOX controller. diff --git a/drivers/mbox/mbox_andes_plic_sw.c b/drivers/mbox/mbox_andes_plic_sw.c index 379ba9b627dd0..b297200233180 100644 --- a/drivers/mbox/mbox_andes_plic_sw.c +++ b/drivers/mbox/mbox_andes_plic_sw.c @@ -8,215 +8,152 @@ #define LOG_LEVEL CONFIG_MBOX_LOG_LEVEL #include -#include #include +#include LOG_MODULE_REGISTER(mbox_andes_plic_sw); -#define DT_DRV_COMPAT andestech_plic_sw - -#define IRQ_REG(n) (n >> 5) -#define PLIC_BASE(dev) \ - ((const struct mbox_andes_conf * const)(dev)->config)->base - -#define REG_PRIORITY(dev, irq) \ - (PLIC_BASE(dev) + 0x0 + (irq << 2)) -#define REG_PENDING(dev, irq) \ - (PLIC_BASE(dev) + 0x1000 + (IRQ_REG(irq) << 2)) -#define REG_ENABLE(dev, hart, irq) \ - (PLIC_BASE(dev) + 0x2000 + (hart << 7) + IRQ_REG(irq)) -#define REG_CLAIM(dev, hart) \ - (PLIC_BASE(dev) + 0x200004 + (hart << 12)) - -#define IPI_NUM DT_INST_PROP(0, channel_max) - -static struct mbox_andes_data { - mbox_callback_t cb[IPI_NUM]; - void *user_data[IPI_NUM]; - uint32_t enabled_channel[CONFIG_MP_MAX_NUM_CPUS]; -#ifdef CONFIG_SCHED_IPI_SUPPORTED - uint32_t reg_cb_channel; - uint32_t ipi_channel; -#endif -} andes_mbox_data; - -static struct mbox_andes_conf { - uint32_t base; - uint32_t channel_max; -} andes_mbox_conf = { - .base = DT_INST_REG_ADDR(0), - .channel_max = IPI_NUM, -}; - -static struct k_spinlock mbox_syn; - -static void plic_sw_irq_set_pending(const struct device *dev, uint32_t irq) -{ - uint32_t pend; - k_spinlock_key_t key = k_spin_lock(&mbox_syn); +#define DT_DRV_COMPAT andestech_mbox_plic_sw - pend = sys_read32(REG_PENDING(dev, irq)); - pend |= BIT(irq); - sys_write32(pend, REG_PENDING(dev, irq)); +struct mbox_plic_data { + mbox_callback_t *cb; + void **user_data; + struct k_spinlock lock; +}; - k_spin_unlock(&mbox_syn, key); -} +struct mbox_plic_conf { + uint32_t channel_max; + const uint32_t *irq_sources; +}; static inline bool is_channel_valid(const struct device *dev, uint32_t ch) { - const struct mbox_andes_conf *conf = dev->config; + const struct mbox_plic_conf *conf = dev->config; - return (ch <= conf->channel_max); + return (ch <= conf->channel_max) && conf->irq_sources[ch]; } -static int mbox_andes_send(const struct device *dev, uint32_t ch, - const struct mbox_msg *msg) +static int mbox_plic_send(const struct device *dev, uint32_t ch, const struct mbox_msg *msg) { + const struct mbox_plic_conf *conf = dev->config; + if (msg) { - LOG_WRN("Sending data not supported"); + LOG_WRN("Transfer mode is not supported"); } if (!is_channel_valid(dev, ch)) { return -EINVAL; } - /* Send IPI by triggering the pending register of PLIC SW. */ - plic_sw_irq_set_pending(dev, ch + 1); + /* Send the MBOX signal by setting the Pending bit register in the PLIC. */ + riscv_plic_irq_set_pending(conf->irq_sources[ch]); return 0; } -static int mbox_andes_register_callback(const struct device *dev, uint32_t ch, - mbox_callback_t cb, void *user_data) +static int mbox_plic_register_callback(const struct device *dev, uint32_t ch, mbox_callback_t cb, + void *user_data) { - struct mbox_andes_data *data = dev->data; - const struct mbox_andes_conf *conf = dev->config; - int ret = 0; + struct mbox_plic_data *data = dev->data; - k_spinlock_key_t key = k_spin_lock(&mbox_syn); - - if (ch > conf->channel_max) { - ret = -EINVAL; - goto out; + if (!is_channel_valid(dev, ch)) { + return -EINVAL; } -#ifdef CONFIG_SCHED_IPI_SUPPORTED - if (ch & data->ipi_channel & data->reg_cb_channel) { - ret = -EALREADY; - goto out; - } + k_spinlock_key_t key = k_spin_lock(&data->lock); - data->reg_cb_channel |= BIT(ch); -#endif data->cb[ch] = cb; data->user_data[ch] = user_data; -out: - k_spin_unlock(&mbox_syn, key); + k_spin_unlock(&data->lock, key); return 0; } -static int mbox_andes_mtu_get(const struct device *dev) +static int mbox_plic_mtu_get(const struct device *dev) { - /* We only support signalling */ - return 0; + /* MBOX PLIC only support signalling mode */ + return -ENOTSUP; } -static uint32_t mbox_andes_max_channels_get(const struct device *dev) +static uint32_t mbox_plic_max_channels_get(const struct device *dev) { - const struct mbox_andes_conf *conf = dev->config; + const struct mbox_plic_conf *conf = dev->config; return conf->channel_max; } -static int mbox_andes_set_enabled(const struct device *dev, uint32_t ch, - bool enable) +static int mbox_plic_set_enabled(const struct device *dev, uint32_t ch, bool enable) { - uint32_t en, is_enabled_ch, hartid, cpu_id, irq; - struct mbox_andes_data *data = dev->data; - int ret = 0; - - k_spinlock_key_t key = k_spin_lock(&mbox_syn); + struct mbox_plic_data *data = dev->data; + const struct mbox_plic_conf *conf = dev->config; if (!is_channel_valid(dev, ch)) { - ret = -EINVAL; - goto out; - } - - irq = ch + 1; - hartid = arch_proc_id(); - cpu_id = _current_cpu->id; - - is_enabled_ch = data->enabled_channel[cpu_id] & BIT(ch); - - if ((!enable && !is_enabled_ch) || (enable && is_enabled_ch)) { - ret = -EALREADY; - goto out; + return -EINVAL; } if (enable && !(data->cb[ch])) { LOG_WRN("Enabling channel without a registered callback\n"); } - en = sys_read32(REG_ENABLE(dev, hartid, irq)); - if (enable) { - data->enabled_channel[cpu_id] |= BIT(ch); - sys_write32(1, REG_PRIORITY(dev, irq)); - en |= BIT(irq); + riscv_plic_irq_enable(conf->irq_sources[ch]); } else { - data->enabled_channel[cpu_id] &= ~BIT(ch); - en &= ~BIT(irq); - } - - sys_write32(en, REG_ENABLE(dev, hartid, irq)); -out: - k_spin_unlock(&mbox_syn, key); - - return ret; -} - -static void andes_plic_sw_irq_handler(const struct device *dev) -{ - struct mbox_andes_data *data = dev->data; - uint32_t irq, ch, hartid; - - hartid = arch_proc_id(); - - /* PLIC claim: Get the SW IRQ number generating the interrupt. */ - irq = sys_read32(REG_CLAIM(dev, hartid)); - ch = irq - 1; - - if (irq) { - sys_write32(irq, REG_CLAIM(dev, hartid)); - - if (data->cb[ch]) { - /* Only one MAILBOX, id is unused and set to 0 */ - data->cb[ch](dev, ch, data->user_data[ch], NULL); - } + riscv_plic_irq_disable(conf->irq_sources[ch]); } -} -static int mbox_andes_init(const struct device *dev) -{ - /* Setup IRQ handler for PLIC SW driver */ - IRQ_CONNECT(RISCV_IRQ_MSOFT, 1, - andes_plic_sw_irq_handler, DEVICE_DT_INST_GET(0), 0); - -#ifndef CONFIG_SMP - irq_enable(RISCV_IRQ_MSOFT); -#endif return 0; } -static const struct mbox_driver_api mbox_andes_driver_api = { - .send = mbox_andes_send, - .register_callback = mbox_andes_register_callback, - .mtu_get = mbox_andes_mtu_get, - .max_channels_get = mbox_andes_max_channels_get, - .set_enabled = mbox_andes_set_enabled, +static const struct mbox_driver_api mbox_plic_driver_api = { + .send = mbox_plic_send, + .register_callback = mbox_plic_register_callback, + .mtu_get = mbox_plic_mtu_get, + .max_channels_get = mbox_plic_max_channels_get, + .set_enabled = mbox_plic_set_enabled, }; -DEVICE_DT_INST_DEFINE(0, mbox_andes_init, NULL, &andes_mbox_data, - &andes_mbox_conf, PRE_KERNEL_1, CONFIG_MBOX_INIT_PRIORITY, - &mbox_andes_driver_api); +#define MBOX_PLIC_ISR_FUNCTION_IDX(node, prop, idx, n) \ + static void mbox_plic_irq_handler##n##_##idx(const struct device *dev) \ + { \ + struct mbox_plic_data *data = dev->data; \ + const uint32_t irq = DT_IRQ_BY_IDX(node, idx, irq); \ + if (data->cb[irq]) { \ + data->cb[irq](dev, irq, data->user_data[irq], NULL); \ + } \ + } +#define MBOX_PLIC_ISR_FUNCTION(n) \ + DT_INST_FOREACH_PROP_ELEM_SEP_VARGS(n, interrupt_names, MBOX_PLIC_ISR_FUNCTION_IDX, (), n) +#define MBOX_PLIC_IRQ_CONNECT_IDX(node, prop, idx, n) \ + IRQ_CONNECT(DT_IRQN_BY_IDX(node, idx), 1, mbox_plic_irq_handler##n##_##idx, \ + DEVICE_DT_INST_GET(n), 0) +#define MBOX_PLIC_IRQ_CONNECT(n) \ + DT_INST_FOREACH_PROP_ELEM_SEP_VARGS(n, interrupt_names, MBOX_PLIC_IRQ_CONNECT_IDX, (;), n) +#define MBOX_PLIC_INIT_FUNCTION(n) \ + static int mbox_plic_init##n(const struct device *dev) \ + { \ + MBOX_PLIC_IRQ_CONNECT(n); \ + return 0; \ + } +#define MBOX_PLIC_IRQ_SOURCE_IDX(node, prop, idx) \ + [DT_IRQ_BY_IDX(node, idx, irq)] = DT_IRQN_BY_IDX(node, idx) +#define MBOX_PLIC_IRQ_SOURCE(n) \ + static const unsigned int irq_sources##n[] = {DT_INST_FOREACH_PROP_ELEM_SEP( \ + n, interrupt_names, MBOX_PLIC_IRQ_SOURCE_IDX, (,))}; +#define MBOX_PLIC_DEVICE_INIT(n) \ + MBOX_PLIC_ISR_FUNCTION(n) \ + MBOX_PLIC_INIT_FUNCTION(n) \ + MBOX_PLIC_IRQ_SOURCE(n) \ + static mbox_callback_t mbox_callback##n[ARRAY_SIZE(irq_sources##n)]; \ + static void *user_data##n[ARRAY_SIZE(irq_sources##n)]; \ + static struct mbox_plic_data mbox_plic_data##n = { \ + .cb = mbox_callback##n, \ + .user_data = user_data##n, \ + }; \ + static const struct mbox_plic_conf mbox_plic_conf##n = { \ + .channel_max = ARRAY_SIZE(irq_sources##n), \ + .irq_sources = irq_sources##n, \ + }; \ + DEVICE_DT_INST_DEFINE(n, &mbox_plic_init##n, NULL, &mbox_plic_data##n, &mbox_plic_conf##n, \ + PRE_KERNEL_2, CONFIG_MBOX_INIT_PRIORITY, &mbox_plic_driver_api); + +DT_INST_FOREACH_STATUS_OKAY(MBOX_PLIC_DEVICE_INIT) From 6a3550e1069df4f223ebf43f4eb77ce4d839c3c6 Mon Sep 17 00:00:00 2001 From: Jimmy Zheng Date: Tue, 1 Oct 2024 14:02:36 +0800 Subject: [PATCH 1414/4482] samples: drivers: mbox: fix adp_xc7k/ae350 configuration and overlay This commit fixes the following issues for adp_xc7k/ae350 1. Incorrect copyright due to copy-paste error 2. Separate RAM region for the host and remote clusters 3. Allocate hart 0 for host and hart 1 for remote cluster 4. Use mbox channel 9, 10 for the sample, leaving channel/irq source 1 ~ 8 for ae350 8-core IPI Signed-off-by: Jimmy Zheng --- .../drivers/mbox/boards/adp_xc7k_ae350.conf | 1 + .../mbox/boards/adp_xc7k_ae350.overlay | 21 ++++++------------- .../mbox/remote/boards/adp_xc7k_ae350.conf | 2 ++ .../mbox/remote/boards/adp_xc7k_ae350.overlay | 13 +++++++++--- 4 files changed, 19 insertions(+), 18 deletions(-) create mode 100644 samples/drivers/mbox/remote/boards/adp_xc7k_ae350.conf diff --git a/samples/drivers/mbox/boards/adp_xc7k_ae350.conf b/samples/drivers/mbox/boards/adp_xc7k_ae350.conf index bdeaed5e88537..a0e60ddb911ef 100644 --- a/samples/drivers/mbox/boards/adp_xc7k_ae350.conf +++ b/samples/drivers/mbox/boards/adp_xc7k_ae350.conf @@ -1 +1,2 @@ CONFIG_RV_BOOT_HART=0 +CONFIG_MP_MAX_NUM_CPUS=1 diff --git a/samples/drivers/mbox/boards/adp_xc7k_ae350.overlay b/samples/drivers/mbox/boards/adp_xc7k_ae350.overlay index b79fd18246d2b..a68f0f4f2ff99 100644 --- a/samples/drivers/mbox/boards/adp_xc7k_ae350.overlay +++ b/samples/drivers/mbox/boards/adp_xc7k_ae350.overlay @@ -1,25 +1,16 @@ /* - * Copyright (c) 2019 Linaro Limited - * + * Copyright (c) 2022 Andes Technology Corporation. * SPDX-License-Identifier: Apache-2.0 */ / { - chosen { - /* - * shared memory reserved for the inter-processor communication - */ - zephyr,sram = &sram; - }; - - sram: memory@0 { - compatible = "mmio-sram"; - reg = <0x00000000 0x10000000 >; - }; - mbox-consumer { compatible = "vnd,mbox-consumer"; - mboxes = <&mbox 1>, <&mbox 0>; + mboxes = <&mbox 9>, <&mbox 10>; mbox-names = "tx", "rx"; }; }; + +&dram { + reg = <0x00000000 0x10000000>; +}; diff --git a/samples/drivers/mbox/remote/boards/adp_xc7k_ae350.conf b/samples/drivers/mbox/remote/boards/adp_xc7k_ae350.conf new file mode 100644 index 0000000000000..7a16a4210bf24 --- /dev/null +++ b/samples/drivers/mbox/remote/boards/adp_xc7k_ae350.conf @@ -0,0 +1,2 @@ +CONFIG_RV_BOOT_HART=1 +CONFIG_MP_MAX_NUM_CPUS=1 diff --git a/samples/drivers/mbox/remote/boards/adp_xc7k_ae350.overlay b/samples/drivers/mbox/remote/boards/adp_xc7k_ae350.overlay index 736ea3f3f6d75..7976e62b0be5b 100644 --- a/samples/drivers/mbox/remote/boards/adp_xc7k_ae350.overlay +++ b/samples/drivers/mbox/remote/boards/adp_xc7k_ae350.overlay @@ -1,13 +1,20 @@ /* - * Copyright (c) 2019 Linaro Limited - * + * Copyright (c) 2022 Andes Technology Corporation. * SPDX-License-Identifier: Apache-2.0 */ / { mbox-consumer { compatible = "vnd,mbox-consumer"; - mboxes = <&mbox 0>, <&mbox 1>; + mboxes = <&mbox 10>, <&mbox 9>; mbox-names = "tx", "rx"; }; }; + +&cpu0 { + status = "disabled"; +}; + +&dram { + reg = <0x10000000 0x10000000>; +}; From da2e8c3c9618a6948b54009288a646a905410a48 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 10 Oct 2024 11:15:29 +0200 Subject: [PATCH 1415/4482] Bluetooth: Add and use missing own_addr_type defines The own_addr_type used for various HCI commands sometimes had a BT_HCI_OWN_ADDR_* type value or a BT_ADDR_* type value. Those are 2 different value spaces, and if the public address types would ever change, it would start have incorrect behavior. Signed-off-by: Emil Gydesen --- include/zephyr/bluetooth/hci_types.h | 3 ++- subsys/bluetooth/controller/ll_sw/ull_adv.c | 10 ++++----- .../bluetooth/controller/ll_sw/ull_central.c | 4 ++-- .../bluetooth/controller/ll_sw/ull_filter.c | 4 ++-- subsys/bluetooth/controller/ll_sw/ull_scan.c | 5 ++--- subsys/bluetooth/host/id.c | 21 +++++++++++-------- .../host/id/bt_id_set_adv_own_addr/src/main.c | 9 ++++---- .../bt_id_set_create_conn_own_addr/src/main.c | 15 ++++++------- .../id/bt_id_set_scan_own_addr/src/main.c | 15 ++++++------- .../host/att/pipeline/tester/src/main.c | 3 ++- .../host/att/sequential/tester/src/main.c | 3 ++- .../host/l2cap/reassembly/peer/src/peer.c | 3 ++- .../host/l2cap/split/tester/src/main.c | 3 ++- .../host/misc/disconnect/tester/src/main.c | 3 ++- .../misc/hfc_multilink/tester/src/tester.c | 3 ++- tests/bsim/bluetooth/ll/advx/src/main.c | 5 +++-- 16 files changed, 61 insertions(+), 48 deletions(-) diff --git a/include/zephyr/bluetooth/hci_types.h b/include/zephyr/bluetooth/hci_types.h index 6f2ae07289a42..d33abf30302de 100644 --- a/include/zephyr/bluetooth/hci_types.h +++ b/include/zephyr/bluetooth/hci_types.h @@ -33,7 +33,8 @@ extern "C" { #define BT_HCI_H4_EVT 0x04 /* HCI Event packet */ #define BT_HCI_H4_ISO 0x05 /* HCI ISO Data packet */ -/* Special own address types for LL privacy (used in adv & scan parameters) */ +#define BT_HCI_OWN_ADDR_PUBLIC 0x00 +#define BT_HCI_OWN_ADDR_RANDOM 0x01 #define BT_HCI_OWN_ADDR_RPA_OR_PUBLIC 0x02 #define BT_HCI_OWN_ADDR_RPA_OR_RANDOM 0x03 #define BT_HCI_OWN_ADDR_RPA_MASK 0x02 diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv.c b/subsys/bluetooth/controller/ll_sw/ull_adv.c index e9fb8e47a6b99..19712c8b8a08e 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv.c @@ -455,8 +455,8 @@ uint8_t ll_adv_params_set(uint16_t interval, uint8_t adv_type, #if defined(CONFIG_BT_CTLR_PRIVACY) adv->own_addr_type = own_addr_type; - if (adv->own_addr_type == BT_ADDR_LE_PUBLIC_ID || - adv->own_addr_type == BT_ADDR_LE_RANDOM_ID) { + if (adv->own_addr_type == BT_HCI_OWN_ADDR_RPA_OR_PUBLIC || + adv->own_addr_type == BT_HCI_OWN_ADDR_RPA_OR_RANDOM) { adv->peer_addr_type = direct_addr_type; memcpy(&adv->peer_addr, direct_addr, BDADDR_SIZE); } @@ -927,8 +927,8 @@ uint8_t ll_adv_enable(uint8_t enable) /* Prepare filter accept list and optionally resolving list */ ull_filter_adv_update(lll->filter_policy); - if (adv->own_addr_type == BT_ADDR_LE_PUBLIC_ID || - adv->own_addr_type == BT_ADDR_LE_RANDOM_ID) { + if (adv->own_addr_type == BT_HCI_OWN_ADDR_RPA_OR_PUBLIC || + adv->own_addr_type == BT_HCI_OWN_ADDR_RPA_OR_RANDOM) { /* Look up the resolving list */ lll->rl_idx = ull_filter_rl_find(adv->peer_addr_type, adv->peer_addr, NULL); @@ -3132,7 +3132,7 @@ static void init_set(struct ll_adv_set *adv) { adv->interval = BT_LE_ADV_INTERVAL_DEFAULT; #if defined(CONFIG_BT_CTLR_PRIVACY) - adv->own_addr_type = BT_ADDR_LE_PUBLIC; + adv->own_addr_type = BT_HCI_OWN_ADDR_RPA_OR_PUBLIC; #endif /* CONFIG_BT_CTLR_PRIVACY */ adv->lll.chan_map = BT_LE_ADV_CHAN_MAP_ALL; adv->lll.filter_policy = BT_LE_ADV_FP_NO_FILTER; diff --git a/subsys/bluetooth/controller/ll_sw/ull_central.c b/subsys/bluetooth/controller/ll_sw/ull_central.c index 397c0d0b5f9da..105507b0466e5 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_central.c +++ b/subsys/bluetooth/controller/ll_sw/ull_central.c @@ -380,8 +380,8 @@ uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window, NULL); } - if (own_addr_type == BT_ADDR_LE_PUBLIC_ID || - own_addr_type == BT_ADDR_LE_RANDOM_ID) { + if (own_addr_type == BT_HCI_OWN_ADDR_RPA_OR_PUBLIC || + own_addr_type == BT_HCI_OWN_ADDR_RPA_OR_RANDOM) { /* Generate RPAs if required */ ull_filter_rpa_update(false); diff --git a/subsys/bluetooth/controller/ll_sw/ull_filter.c b/subsys/bluetooth/controller/ll_sw/ull_filter.c index 5d6e68238aed1..3bf2bef05670b 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_filter.c +++ b/subsys/bluetooth/controller/ll_sw/ull_filter.c @@ -1153,8 +1153,8 @@ static void rpa_adv_refresh(struct ll_adv_set *adv) uint8_t sec_idx; #endif /* CONFIG_BT_CTLR_ADV_EXT */ - if (adv->own_addr_type != BT_ADDR_LE_PUBLIC_ID && - adv->own_addr_type != BT_ADDR_LE_RANDOM_ID) { + if (adv->own_addr_type != BT_HCI_OWN_ADDR_RPA_OR_PUBLIC && + adv->own_addr_type != BT_HCI_OWN_ADDR_RPA_OR_RANDOM) { return; } diff --git a/subsys/bluetooth/controller/ll_sw/ull_scan.c b/subsys/bluetooth/controller/ll_sw/ull_scan.c index 0757dcac1df1d..f15a00a04e6db 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_scan.c +++ b/subsys/bluetooth/controller/ll_sw/ull_scan.c @@ -247,9 +247,8 @@ uint8_t ll_scan_enable(uint8_t enable) lll->rl_idx = FILTER_IDX_NONE; lll->rpa_gen = 0; - if ((lll->type & 0x1) && - (own_addr_type == BT_ADDR_LE_PUBLIC_ID || - own_addr_type == BT_ADDR_LE_RANDOM_ID)) { + if ((lll->type & 0x1) && (own_addr_type == BT_HCI_OWN_ADDR_RPA_OR_PUBLIC || + own_addr_type == BT_HCI_OWN_ADDR_RPA_OR_RANDOM)) { /* Generate RPAs if required */ ull_filter_rpa_update(false); lll->rpa_gen = 1; diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index 223d0802406a4..f95ca6acc105b 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -1,12 +1,14 @@ /* - * Copyright (c) 2017-2021 Nordic Semiconductor ASA + * Copyright (c) 2017-2024 Nordic Semiconductor ASA * Copyright (c) 2015-2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #include +#include +#include #include #include #include @@ -30,6 +32,7 @@ #include "settings.h" #include +#include #include "common/bt_str.h" @@ -1733,7 +1736,7 @@ int bt_id_set_create_conn_own_addr(bool use_filter, uint8_t *own_addr_type) if (BT_FEAT_LE_PRIVACY(bt_dev.le.features)) { *own_addr_type = BT_HCI_OWN_ADDR_RPA_OR_RANDOM; } else { - *own_addr_type = BT_ADDR_LE_RANDOM; + *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; } } else { const bt_addr_le_t *addr = &bt_dev.id_addr[BT_ID_DEFAULT]; @@ -1789,7 +1792,7 @@ int bt_id_set_scan_own_addr(bool active_scan, uint8_t *own_addr_type) if (BT_FEAT_LE_PRIVACY(bt_dev.le.features)) { *own_addr_type = BT_HCI_OWN_ADDR_RPA_OR_RANDOM; } else { - *own_addr_type = BT_ADDR_LE_RANDOM; + *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; } err = bt_id_set_private_addr(BT_ID_DEFAULT); @@ -1820,9 +1823,9 @@ int bt_id_set_scan_own_addr(bool active_scan, uint8_t *own_addr_type) err); } - *own_addr_type = BT_ADDR_LE_RANDOM; + *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; } else if (IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY) && - *own_addr_type == BT_ADDR_LE_RANDOM) { + *own_addr_type == BT_HCI_OWN_ADDR_RANDOM) { /* If scanning with Identity Address we must set the * random identity address for both active and passive * scanner in order to receive adv reports that are @@ -1866,7 +1869,7 @@ int bt_id_set_adv_own_addr(struct bt_le_ext_adv *adv, uint32_t options, if (err) { return err; } - *own_addr_type = BT_ADDR_LE_RANDOM; + *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; return 0; } @@ -1887,7 +1890,7 @@ int bt_id_set_adv_own_addr(struct bt_le_ext_adv *adv, uint32_t options, if (dir_adv && (options & BT_LE_ADV_OPT_DIR_ADDR_RPA)) { *own_addr_type = BT_HCI_OWN_ADDR_RPA_OR_RANDOM; } else { - *own_addr_type = BT_ADDR_LE_RANDOM; + *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; } } else { /* @@ -1934,7 +1937,7 @@ int bt_id_set_adv_own_addr(struct bt_le_ext_adv *adv, uint32_t options, } #endif /* defined(CONFIG_BT_OBSERVER) */ err = bt_id_set_adv_private_addr(adv); - *own_addr_type = BT_ADDR_LE_RANDOM; + *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; #if defined(CONFIG_BT_OBSERVER) if (scan_enabled) { @@ -1943,7 +1946,7 @@ int bt_id_set_adv_own_addr(struct bt_le_ext_adv *adv, uint32_t options, #endif /* defined(CONFIG_BT_OBSERVER) */ } else { err = bt_id_set_adv_private_addr(adv); - *own_addr_type = BT_ADDR_LE_RANDOM; + *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; } if (err) { diff --git a/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/main.c b/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/main.c index c6da5720ca4a4..29c500e9840cc 100644 --- a/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/main.c +++ b/tests/bluetooth/host/id/bt_id_set_adv_own_addr/src/main.c @@ -10,6 +10,7 @@ #include "testing_common_defs.h" #include +#include #include #include @@ -62,7 +63,7 @@ ZTEST(bt_id_set_adv_own_addr, test_bt_id_set_adv_private_addr_succeeds_adv_conne err = bt_id_set_adv_own_addr(&adv, options, dir_adv_test_lut[i], &own_addr_type); zassert_ok(err, "Unexpected error code '%d' was returned", err); - zassert_true(own_addr_type == BT_ADDR_LE_RANDOM, + zassert_true(own_addr_type == BT_HCI_OWN_ADDR_RANDOM, "Address type reference was incorrectly set"); } @@ -114,7 +115,7 @@ ZTEST(bt_id_set_adv_own_addr, test_bt_id_set_adv_random_addr_succeeds_adv_connec err = bt_id_set_adv_own_addr(&adv, options, dir_adv_test_lut[i], &own_addr_type); zassert_ok(err, "Unexpected error code '%d' was returned", err); - zassert_true(own_addr_type == BT_ADDR_LE_RANDOM, + zassert_true(own_addr_type == BT_HCI_OWN_ADDR_RANDOM, "Address type reference was incorrectly set"); } @@ -168,7 +169,7 @@ ZTEST(bt_id_set_adv_own_addr, test_bt_id_set_adv_random_addr_succeeds_not_connec err = bt_id_set_adv_own_addr(&adv, options, dir_adv_test_lut[i], &own_addr_type); zassert_ok(err, "Unexpected error code '%d' was returned", err); - zassert_true(own_addr_type == BT_ADDR_LE_RANDOM, + zassert_true(own_addr_type == BT_HCI_OWN_ADDR_RANDOM, "Address type reference was incorrectly set"); } } @@ -206,7 +207,7 @@ ZTEST(bt_id_set_adv_own_addr, test_bt_id_set_adv_private_addr_succeeds_not_conne err = bt_id_set_adv_own_addr(&adv, options, dir_adv_test_lut[i], &own_addr_type); zassert_ok(err, "Unexpected error code '%d' was returned", err); - zassert_true(own_addr_type == BT_ADDR_LE_RANDOM, + zassert_true(own_addr_type == BT_HCI_OWN_ADDR_RANDOM, "Address type reference was incorrectly set"); } } diff --git a/tests/bluetooth/host/id/bt_id_set_create_conn_own_addr/src/main.c b/tests/bluetooth/host/id/bt_id_set_create_conn_own_addr/src/main.c index bdb41ced31870..b9e60a71c65a4 100644 --- a/tests/bluetooth/host/id/bt_id_set_create_conn_own_addr/src/main.c +++ b/tests/bluetooth/host/id/bt_id_set_create_conn_own_addr/src/main.c @@ -9,6 +9,7 @@ #include "testing_common_defs.h" #include +#include #include #include @@ -54,17 +55,17 @@ ZTEST(bt_id_set_create_conn_own_addr, test_setting_conn_own_public_address_no_pr err = bt_id_set_create_conn_own_addr(false, &own_addr_type); zassert_ok(err, "Unexpected error code '%d' was returned", err); - zassert_true(own_addr_type == BT_ADDR_LE_PUBLIC, + zassert_true(own_addr_type == BT_HCI_OWN_ADDR_PUBLIC, "Address type reference was incorrectly set"); } /* * Test setting connection own address while 'CONFIG_BT_PRIVACY' isn't enabled. - * If the default identity has an RPA address of type 'BT_ADDR_LE_RANDOM', set_random_address() - * is called and address type reference is updated upon success. + * If the default identity has an RPA address of type 'BT_HCI_OWN_ADDR_RANDOM', + * set_random_address() is called and address type reference is updated upon success. * * Constraints: - * - Default identity has an address with the type 'BT_ADDR_LE_RANDOM' + * - Default identity has an address with the type 'BT_HCI_OWN_ADDR_RANDOM' * - 'CONFIG_BT_PRIVACY' isn't enabled * - set_random_address() succeeds and returns 0 * @@ -87,7 +88,7 @@ ZTEST(bt_id_set_create_conn_own_addr, test_setting_conn_own_rpa_address_no_priva err = bt_id_set_create_conn_own_addr(false, &own_addr_type); zassert_ok(err, "Unexpected error code '%d' was returned", err); - zassert_true(own_addr_type == BT_ADDR_LE_RANDOM, + zassert_true(own_addr_type == BT_HCI_OWN_ADDR_RANDOM, "Address type reference was incorrectly set"); } @@ -104,7 +105,7 @@ ZTEST(bt_id_set_create_conn_own_addr, test_setting_conn_own_rpa_address_no_priva * * Expected behaviour: * - bt_id_set_create_conn_own_addr() returns 0 - * - Address type reference is updated with the value 'BT_ADDR_LE_RANDOM' + * - Address type reference is updated with the value 'BT_HCI_OWN_ADDR_RANDOM' */ ZTEST(bt_id_set_create_conn_own_addr, test_setting_conn_own_address_privacy_enabled) { @@ -119,7 +120,7 @@ ZTEST(bt_id_set_create_conn_own_addr, test_setting_conn_own_address_privacy_enab err = bt_id_set_create_conn_own_addr(true, &own_addr_type); zassert_ok(err, "Unexpected error code '%d' was returned", err); - zassert_true(own_addr_type == BT_ADDR_LE_RANDOM, + zassert_true(own_addr_type == BT_HCI_OWN_ADDR_RANDOM, "Address type reference was incorrectly set"); } diff --git a/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/main.c b/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/main.c index 4b34f38f94cd0..c39411897cd9d 100644 --- a/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/main.c +++ b/tests/bluetooth/host/id/bt_id_set_scan_own_addr/src/main.c @@ -10,6 +10,7 @@ #include "testing_common_defs.h" #include +#include #include #include @@ -70,18 +71,18 @@ ZTEST(bt_id_set_scan_own_addr, test_set_nrpa_scan_address_no_privacy) err = bt_id_set_scan_own_addr(false, &own_addr_type); zassert_ok(err, "Unexpected error code '%d' was returned", err); - zassert_true(own_addr_type == BT_ADDR_LE_RANDOM, + zassert_true(own_addr_type == BT_HCI_OWN_ADDR_RANDOM, "Address type reference was incorrectly set"); } /* * Test setting scan own address while 'CONFIG_BT_PRIVACY' isn't enabled. * If 'CONFIG_BT_SCAN_WITH_IDENTITY' is enabled and the default identity has an RPA address of type - * 'BT_ADDR_LE_RANDOM', set_random_address() is called and address type reference is updated upon - * success. + * 'BT_HCI_OWN_ADDR_RANDOM', set_random_address() is called and address type reference is updated + * upon success. * * Constraints: - * - Default identity has an address with the type 'BT_ADDR_LE_RANDOM' + * - Default identity has an address with the type 'BT_HCI_OWN_ADDR_RANDOM' * - 'CONFIG_BT_PRIVACY' isn't enabled * - 'CONFIG_BT_SCAN_WITH_IDENTITY' is enabled * - set_random_address() succeeds and returns 0 @@ -106,7 +107,7 @@ ZTEST(bt_id_set_scan_own_addr, test_setting_scan_own_rpa_address_no_privacy) err = bt_id_set_scan_own_addr(false, &own_addr_type); zassert_ok(err, "Unexpected error code '%d' was returned", err); - zassert_true(own_addr_type == BT_ADDR_LE_RANDOM, + zassert_true(own_addr_type == BT_HCI_OWN_ADDR_RANDOM, "Address type reference was incorrectly set"); } @@ -123,7 +124,7 @@ ZTEST(bt_id_set_scan_own_addr, test_setting_scan_own_rpa_address_no_privacy) * * Expected behaviour: * - bt_id_set_scan_own_addr() returns 0 - * - Address type reference is updated with the value 'BT_ADDR_LE_RANDOM' + * - Address type reference is updated with the value 'BT_HCI_OWN_ADDR_RANDOM' */ ZTEST(bt_id_set_scan_own_addr, test_setting_scan_own_address_privacy_enabled) { @@ -138,7 +139,7 @@ ZTEST(bt_id_set_scan_own_addr, test_setting_scan_own_address_privacy_enabled) err = bt_id_set_scan_own_addr(true, &own_addr_type); zassert_ok(err, "Unexpected error code '%d' was returned", err); - zassert_true(own_addr_type == BT_ADDR_LE_RANDOM, + zassert_true(own_addr_type == BT_HCI_OWN_ADDR_RANDOM, "Address type reference was incorrectly set"); } diff --git a/tests/bsim/bluetooth/host/att/pipeline/tester/src/main.c b/tests/bsim/bluetooth/host/att/pipeline/tester/src/main.c index c9af0b4a4617c..dcc20abcfbd43 100644 --- a/tests/bsim/bluetooth/host/att/pipeline/tester/src/main.c +++ b/tests/bsim/bluetooth/host/att/pipeline/tester/src/main.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "common/bt_str.h" @@ -483,7 +484,7 @@ void start_adv(void) set_param.channel_map = 0x07; set_param.filter_policy = BT_LE_ADV_FP_NO_FILTER; set_param.type = BT_HCI_ADV_IND; - set_param.own_addr_type = 0x01; /* random */ + set_param.own_addr_type = BT_HCI_OWN_ADDR_RANDOM; /* configure */ buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); diff --git a/tests/bsim/bluetooth/host/att/sequential/tester/src/main.c b/tests/bsim/bluetooth/host/att/sequential/tester/src/main.c index 5062417f70dc5..511323dacb3db 100644 --- a/tests/bsim/bluetooth/host/att/sequential/tester/src/main.c +++ b/tests/bsim/bluetooth/host/att/sequential/tester/src/main.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "common/bt_str.h" @@ -459,7 +460,7 @@ void start_adv(void) set_param.channel_map = 0x07; set_param.filter_policy = BT_LE_ADV_FP_NO_FILTER; set_param.type = BT_HCI_ADV_IND; - set_param.own_addr_type = 0x01; /* random */ + set_param.own_addr_type = BT_HCI_OWN_ADDR_RANDOM; /* configure */ buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); diff --git a/tests/bsim/bluetooth/host/l2cap/reassembly/peer/src/peer.c b/tests/bsim/bluetooth/host/l2cap/reassembly/peer/src/peer.c index 3af2f872a5e00..b17246bb8b0f9 100644 --- a/tests/bsim/bluetooth/host/l2cap/reassembly/peer/src/peer.c +++ b/tests/bsim/bluetooth/host/l2cap/reassembly/peer/src/peer.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "common/bt_str.h" @@ -402,7 +403,7 @@ static void start_adv(uint16_t interval, const char *name, size_t name_len) set_param.channel_map = 0x07; set_param.filter_policy = BT_LE_ADV_FP_NO_FILTER; set_param.type = BT_HCI_ADV_IND; - set_param.own_addr_type = 0x01; /* random */ + set_param.own_addr_type = BT_HCI_OWN_ADDR_RANDOM; buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); __ASSERT_NO_MSG(buf); diff --git a/tests/bsim/bluetooth/host/l2cap/split/tester/src/main.c b/tests/bsim/bluetooth/host/l2cap/split/tester/src/main.c index ba4f23bd050d5..8e5d6522548c7 100644 --- a/tests/bsim/bluetooth/host/l2cap/split/tester/src/main.c +++ b/tests/bsim/bluetooth/host/l2cap/split/tester/src/main.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "common/bt_str.h" @@ -438,7 +439,7 @@ void start_adv(uint16_t interval) set_param.channel_map = 0x07; set_param.filter_policy = BT_LE_ADV_FP_NO_FILTER; set_param.type = BT_HCI_ADV_IND; - set_param.own_addr_type = 0x01; /* random */ + set_param.own_addr_type = BT_HCI_OWN_ADDR_RANDOM; buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); __ASSERT_NO_MSG(buf); diff --git a/tests/bsim/bluetooth/host/misc/disconnect/tester/src/main.c b/tests/bsim/bluetooth/host/misc/disconnect/tester/src/main.c index fba4eeacf8ac6..6f5dff3bafec4 100644 --- a/tests/bsim/bluetooth/host/misc/disconnect/tester/src/main.c +++ b/tests/bsim/bluetooth/host/misc/disconnect/tester/src/main.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "common/bt_str.h" @@ -437,7 +438,7 @@ void start_adv(void) set_param.channel_map = 0x07; set_param.filter_policy = BT_LE_ADV_FP_NO_FILTER; set_param.type = BT_HCI_ADV_IND; - set_param.own_addr_type = 0x01; /* random */ + set_param.own_addr_type = BT_HCI_OWN_ADDR_RANDOM; /* configure */ buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); diff --git a/tests/bsim/bluetooth/host/misc/hfc_multilink/tester/src/tester.c b/tests/bsim/bluetooth/host/misc/hfc_multilink/tester/src/tester.c index 866899d7a3867..b5054cfdc3f00 100644 --- a/tests/bsim/bluetooth/host/misc/hfc_multilink/tester/src/tester.c +++ b/tests/bsim/bluetooth/host/misc/hfc_multilink/tester/src/tester.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include "common/bt_str.h" @@ -467,7 +468,7 @@ static void start_adv(uint16_t interval, const char *name, size_t name_len) set_param.channel_map = 0x07; set_param.filter_policy = BT_LE_ADV_FP_NO_FILTER; set_param.type = BT_HCI_ADV_IND; - set_param.own_addr_type = 0x01; /* random */ + set_param.own_addr_type = BT_HCI_OWN_ADDR_RANDOM; buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_PARAM, sizeof(set_param)); __ASSERT_NO_MSG(buf); diff --git a/tests/bsim/bluetooth/ll/advx/src/main.c b/tests/bsim/bluetooth/ll/advx/src/main.c index a98a55270477a..cd9f0a4cd503b 100644 --- a/tests/bsim/bluetooth/ll/advx/src/main.c +++ b/tests/bsim/bluetooth/ll/advx/src/main.c @@ -14,6 +14,7 @@ #include #include +#include #include "ll.h" @@ -28,8 +29,8 @@ #define EVT_PROP_TXP BIT(6) #define ADV_INTERVAL 0x20 /* 20 ms advertising interval */ #define ADV_WAIT_MS 10 /* 10 ms wait loop */ -#define OWN_ADDR_TYPE BT_ADDR_LE_RANDOM_ID -#define PEER_ADDR_TYPE BT_ADDR_LE_RANDOM_ID +#define OWN_ADDR_TYPE BT_HCI_OWN_ADDR_RANDOM +#define PEER_ADDR_TYPE BT_HCI_OWN_ADDR_RANDOM #define PEER_ADDR peer_addr #define ADV_CHAN_MAP 0x07 #define FILTER_POLICY 0x00 From 25c993e5b74562137c2951db01c8a8d200e98d3d Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Mon, 14 Oct 2024 14:35:52 +0200 Subject: [PATCH 1416/4482] Bluetooth: Host: Remove implicit conversions of own_addr_type Remove implicit conversions and assignment to the own_addr_type variables. Signed-off-by: Emil Gydesen --- subsys/bluetooth/host/id.c | 56 +++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index f95ca6acc105b..4e1313c5d2ce5 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -32,6 +32,7 @@ #include "settings.h" #include +#include #include #include "common/bt_str.h" @@ -1750,9 +1751,14 @@ int bt_id_set_create_conn_own_addr(bool use_filter, uint8_t *own_addr_type) if (err) { return err; } - } - *own_addr_type = addr->type; + *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; + } else { + /* If address type is not random, it's public. If it's public then we assume + * it's the Controller's public address. + */ + *own_addr_type = BT_HCI_OWN_ADDR_PUBLIC; + } } return 0; @@ -1805,8 +1811,6 @@ int bt_id_set_scan_own_addr(bool active_scan, uint8_t *own_addr_type) return err; } } else { - *own_addr_type = bt_dev.id_addr[0].type; - /* Use NRPA unless identity has been explicitly requested * (through Kconfig). * Use same RPA as legacy advertiser if advertising. @@ -1824,19 +1828,22 @@ int bt_id_set_scan_own_addr(bool active_scan, uint8_t *own_addr_type) } *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; - } else if (IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY) && - *own_addr_type == BT_HCI_OWN_ADDR_RANDOM) { - /* If scanning with Identity Address we must set the - * random identity address for both active and passive - * scanner in order to receive adv reports that are - * directed towards this identity. - */ - err = set_random_address(&bt_dev.id_addr[0].a); - if (err) { - return err; + } else if (IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY)) { + if (bt_dev.id_addr[BT_ID_DEFAULT].type == BT_ADDR_LE_RANDOM) { + /* If scanning with Identity Address we must set the + * random identity address for both active and passive + * scanner in order to receive adv reports that are + * directed towards this identity. + */ + err = set_random_address(&bt_dev.id_addr[BT_ID_DEFAULT].a); + if (err) { + return err; + } + + *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; + } else if (bt_dev.id_addr[BT_ID_DEFAULT].type == BT_ADDR_LE_PUBLIC) { + *own_addr_type = BT_HCI_OWN_ADDR_PUBLIC; } - } else { - LOG_DBG("Not changing the address"); } } @@ -1904,9 +1911,11 @@ int bt_id_set_adv_own_addr(struct bt_le_ext_adv *adv, uint32_t options, if (err) { return err; } - } - *own_addr_type = id_addr->type; + *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; + } else if (id_addr->type == BT_ADDR_LE_PUBLIC) { + *own_addr_type = BT_HCI_OWN_ADDR_PUBLIC; + } if (dir_adv && (options & BT_LE_ADV_OPT_DIR_ADDR_RPA)) { *own_addr_type |= BT_HCI_OWN_ADDR_RPA_MASK; @@ -1916,9 +1925,18 @@ int bt_id_set_adv_own_addr(struct bt_le_ext_adv *adv, uint32_t options, if (options & BT_LE_ADV_OPT_USE_IDENTITY) { if (id_addr->type == BT_ADDR_LE_RANDOM) { err = bt_id_set_adv_random_addr(adv, &id_addr->a); + if (err) { + return err; + } + + *own_addr_type = BT_HCI_OWN_ADDR_RANDOM; + } else if (id_addr->type == BT_ADDR_LE_PUBLIC) { + *own_addr_type = BT_HCI_OWN_ADDR_PUBLIC; } - *own_addr_type = id_addr->type; + if (options & BT_LE_ADV_OPT_DIR_ADDR_RPA) { + *own_addr_type |= BT_HCI_OWN_ADDR_RPA_MASK; + } } else if (!(IS_ENABLED(CONFIG_BT_EXT_ADV) && BT_DEV_FEAT_LE_EXT_ADV(bt_dev.le.features))) { /* In case advertising set random address is not From b6f7eac00af78ceaaa3c56512ba7ea9f49a7e4a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 8 Oct 2024 10:52:56 +0200 Subject: [PATCH 1417/4482] logging: Fix LOG_IMMEDIATE_CLEAN_OUTPUT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There was a kconfig option used in v1 logging to get clean output in the immediate mode. It was lost during the transition to v2 but Kconfig remained. Adding spin_lock to log processing to ensure that log messages are not interleaved in the output in the immediate mode. Signed-off-by: Krzysztof Chruściński --- subsys/logging/log_core.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/subsys/logging/log_core.c b/subsys/logging/log_core.c index 841677257dc31..494aabcba9c0b 100644 --- a/subsys/logging/log_core.c +++ b/subsys/logging/log_core.c @@ -114,6 +114,7 @@ static log_timestamp_t proc_latency; static log_timestamp_t prev_timestamp; static atomic_t unordered_cnt; static uint64_t last_failure_report; +static struct k_spinlock process_lock; static STRUCT_SECTION_ITERABLE(log_msg_ptr, log_msg_ptr); static STRUCT_SECTION_ITERABLE_ALTERNATE(log_mpsc_pbuf, mpsc_pbuf_buffer, log_buffer); @@ -163,7 +164,6 @@ static void z_log_msg_post_finalize(void) atomic_val_t cnt = atomic_inc(&buffered_cnt); if (panic_mode) { - static struct k_spinlock process_lock; k_spinlock_key_t key = k_spin_lock(&process_lock); (void)log_process(); @@ -664,8 +664,18 @@ static void msg_commit(struct mpsc_pbuf_buffer *buffer, struct log_msg *msg) union log_msg_generic *m = (union log_msg_generic *)msg; if (IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE)) { + k_spinlock_key_t key; + + if (IS_ENABLED(CONFIG_LOG_IMMEDIATE_CLEAN_OUTPUT)) { + key = k_spin_lock(&process_lock); + } + msg_process(m); + if (IS_ENABLED(CONFIG_LOG_IMMEDIATE_CLEAN_OUTPUT)) { + k_spin_unlock(&process_lock, key); + } + return; } From 7f820d59c0591884b2589f4a524aaf7314d9ad83 Mon Sep 17 00:00:00 2001 From: Babak Arisian Date: Thu, 3 Oct 2024 09:49:46 +0200 Subject: [PATCH 1418/4482] Bluetooth: Audio: Update SCAN_DELEGATOR dependency to GATT_DYNAMIC_DB Changed dependency of the BT_BAP_SCAN_DELEGATOR to GATT_DYNAMIC_DB from 'select' to 'depends on' and solved all loop dependencies caused by this change. Fixes #79108 Signed-off-by: Babak Arisian --- samples/bluetooth/bap_broadcast_sink/prj.conf | 2 ++ samples/bluetooth/bap_unicast_server/prj.conf | 2 ++ samples/bluetooth/cap_acceptor/Kconfig | 2 ++ samples/bluetooth/cap_acceptor/prj.conf | 1 + samples/bluetooth/cap_initiator/prj.conf | 2 ++ samples/bluetooth/hap_ha/binaural.conf | 1 + samples/bluetooth/hap_ha/prj.conf | 2 ++ .../hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf | 1 + .../hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf | 2 ++ .../hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf | 2 ++ .../bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf | 2 ++ .../hci_uart_3wire/overlay-all-bt_ll_sw_split.conf | 2 ++ samples/bluetooth/iso_central/prj.conf | 1 + samples/bluetooth/iso_connected_benchmark/prj.conf | 2 ++ samples/bluetooth/iso_peripheral/prj.conf | 1 + samples/bluetooth/iso_receive/prj.conf | 1 + samples/bluetooth/pbp_public_broadcast_sink/prj.conf | 2 ++ samples/bluetooth/tmap_bmr/prj.conf | 1 + samples/bluetooth/tmap_peripheral/duo.conf | 1 + samples/bluetooth/tmap_peripheral/prj.conf | 1 + subsys/bluetooth/Kconfig.iso | 6 +++--- subsys/bluetooth/audio/Kconfig.aics | 2 +- subsys/bluetooth/audio/Kconfig.bap | 10 +++++----- subsys/bluetooth/audio/Kconfig.cap | 2 +- subsys/bluetooth/audio/Kconfig.has | 2 +- subsys/bluetooth/audio/Kconfig.mcs | 2 +- subsys/bluetooth/audio/Kconfig.micp | 2 +- subsys/bluetooth/audio/Kconfig.tbs | 2 +- subsys/bluetooth/audio/Kconfig.vcp | 2 +- tests/bluetooth/audio/ascs/prj.conf | 2 ++ tests/bluetooth/audio/bap_base/prj.conf | 2 ++ tests/bluetooth/audio/cap_commander/prj.conf | 2 ++ tests/bluetooth/audio/codec/prj.conf | 2 ++ tests/bluetooth/shell/audio.conf | 2 ++ tests/bluetooth/tester/overlay-le-audio.conf | 3 +++ tests/bsim/bluetooth/audio/prj.conf | 2 ++ tests/bsim/bluetooth/host/iso/bis/prj.conf | 1 + tests/bsim/bluetooth/host/iso/cis/prj.conf | 2 ++ tests/bsim/bluetooth/ll/cis/prj.conf | 2 ++ .../nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf | 2 ++ 40 files changed, 68 insertions(+), 15 deletions(-) diff --git a/samples/bluetooth/bap_broadcast_sink/prj.conf b/samples/bluetooth/bap_broadcast_sink/prj.conf index 728c2a9f2cdcc..c8a1dd228fa4e 100644 --- a/samples/bluetooth/bap_broadcast_sink/prj.conf +++ b/samples/bluetooth/bap_broadcast_sink/prj.conf @@ -4,6 +4,8 @@ CONFIG_BT_AUDIO=y CONFIG_BT_SMP=y CONFIG_BT_PAC_SNK=y CONFIG_BT_PERIPHERAL=y +CONFIG_BT_OBSERVER=y +CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_BAP_BROADCAST_SINK=y CONFIG_BT_BAP_SCAN_DELEGATOR=y CONFIG_BT_ISO_MAX_CHAN=2 diff --git a/samples/bluetooth/bap_unicast_server/prj.conf b/samples/bluetooth/bap_unicast_server/prj.conf index 38e3bb48b37a6..bc8bb687dab3f 100644 --- a/samples/bluetooth/bap_unicast_server/prj.conf +++ b/samples/bluetooth/bap_unicast_server/prj.conf @@ -4,6 +4,8 @@ CONFIG_BT_SMP=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_ISO_PERIPHERAL=y CONFIG_BT_AUDIO=y +CONFIG_BT_GATT_CACHING=y +CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_BAP_UNICAST_SERVER=y CONFIG_BT_ASCS=y CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT=2 diff --git a/samples/bluetooth/cap_acceptor/Kconfig b/samples/bluetooth/cap_acceptor/Kconfig index 4a3a4b3117533..c9a34b2e311f3 100644 --- a/samples/bluetooth/cap_acceptor/Kconfig +++ b/samples/bluetooth/cap_acceptor/Kconfig @@ -7,6 +7,7 @@ config SAMPLE_UNICAST bool "Whether or not to search for CAP acceptors for unicast audio" default y select BT_BAP_UNICAST_SERVER + select BT_GATT_CACHING select BT_ISO_PERIPHERAL select BT_ASCS select BT_PAC_SNK @@ -23,6 +24,7 @@ config SAMPLE_BROADCAST default y if !SAMPLE_UNICAST select BT_ISO_SYNC_RECEIVER select BT_BAP_SCAN_DELEGATOR + select BT_OBSERVER select BT_BAP_BROADCAST_SINK select BT_PAC_SNK select BT_PAC_SNK_LOC diff --git a/samples/bluetooth/cap_acceptor/prj.conf b/samples/bluetooth/cap_acceptor/prj.conf index fb4a13850cec5..15882dbd8460b 100644 --- a/samples/bluetooth/cap_acceptor/prj.conf +++ b/samples/bluetooth/cap_acceptor/prj.conf @@ -1,6 +1,7 @@ CONFIG_BT=y CONFIG_LOG=y CONFIG_BT_PERIPHERAL=y +CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_GATT_CLIENT=y CONFIG_BT_EXT_ADV=y CONFIG_BT_DEVICE_NAME="CAP Acceptor" diff --git a/samples/bluetooth/cap_initiator/prj.conf b/samples/bluetooth/cap_initiator/prj.conf index 019b54c275760..c1182a5f2be16 100644 --- a/samples/bluetooth/cap_initiator/prj.conf +++ b/samples/bluetooth/cap_initiator/prj.conf @@ -18,6 +18,8 @@ CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT=2 CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT=2 CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT=2 +CONFIG_BT_BAP_BROADCAST_SOURCE=y + # Broadcast sources values if enabled by CONFIG_SAMPLE_BROADCAST CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT=2 CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT=1 diff --git a/samples/bluetooth/hap_ha/binaural.conf b/samples/bluetooth/hap_ha/binaural.conf index 040966fb86510..6230c5afb8d5e 100644 --- a/samples/bluetooth/hap_ha/binaural.conf +++ b/samples/bluetooth/hap_ha/binaural.conf @@ -1,3 +1,4 @@ CONFIG_BT_CSIP_SET_MEMBER=y CONFIG_HAP_HA_HEARING_AID_BINAURAL=y CONFIG_BT_CAP_ACCEPTOR_SET_MEMBER=y +CONFIG_BT_GATT_DYNAMIC_DB=y diff --git a/samples/bluetooth/hap_ha/prj.conf b/samples/bluetooth/hap_ha/prj.conf index 222da719c760f..ad0c2d8c3a810 100644 --- a/samples/bluetooth/hap_ha/prj.conf +++ b/samples/bluetooth/hap_ha/prj.conf @@ -2,6 +2,8 @@ CONFIG_BT=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_ISO_PERIPHERAL=y CONFIG_BT_PRIVACY=y +CONFIG_BT_GATT_CACHING=y +CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_SMP=y CONFIG_BT_SMP_SC_PAIR_ONLY=y diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf index 27f7b9b80ea20..0e4a20602b520 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf @@ -9,6 +9,7 @@ CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y +CONFIG_BT_OBSERVER=y CONFIG_BT_HCI_RAW=y CONFIG_BT_MAX_CONN=2 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf index 040e1db6b4f17..af142bf7dc6aa 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf @@ -25,6 +25,8 @@ CONFIG_BT_BUF_CMD_TX_SIZE=255 # Host features CONFIG_BT_EXT_ADV=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=y CONFIG_BT_PER_ADV=n CONFIG_BT_PER_ADV_SYNC=n diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf index c8cad930a3380..62a0225b58019 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf @@ -13,6 +13,8 @@ CONFIG_ISR_TABLES_LOCAL_DECLARATION=y CONFIG_LTO=y CONFIG_BT=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=y CONFIG_BT_HCI_RAW=y CONFIG_BT_MAX_CONN=3 diff --git a/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf b/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf index 8d6dbdd87b016..3b2a93aba043a 100644 --- a/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf @@ -10,6 +10,8 @@ CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=y CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_PER_ADV_SYNC_MAX=2 +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=y # Broadcast and Connected ISO CONFIG_BT_ISO_BROADCASTER=y diff --git a/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf b/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf index 75542eff6705e..35ac7c6525bcd 100644 --- a/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf @@ -10,6 +10,8 @@ CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=y CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_PER_ADV_SYNC_MAX=2 +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=y # Broadcast and Connected ISO CONFIG_BT_ISO_BROADCASTER=y diff --git a/samples/bluetooth/iso_central/prj.conf b/samples/bluetooth/iso_central/prj.conf index 81264161a5c42..2134768f0a787 100644 --- a/samples/bluetooth/iso_central/prj.conf +++ b/samples/bluetooth/iso_central/prj.conf @@ -1,3 +1,4 @@ CONFIG_BT=y CONFIG_LOG=y +CONFIG_BT_CENTRAL=y CONFIG_BT_ISO_CENTRAL=y diff --git a/samples/bluetooth/iso_connected_benchmark/prj.conf b/samples/bluetooth/iso_connected_benchmark/prj.conf index 76fabb0fa730b..09781083adbc5 100644 --- a/samples/bluetooth/iso_connected_benchmark/prj.conf +++ b/samples/bluetooth/iso_connected_benchmark/prj.conf @@ -3,6 +3,8 @@ CONFIG_CONSOLE_GETCHAR=y CONFIG_BT_DEVICE_NAME="ISO Connected Throughput" CONFIG_BT=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=y CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_ISO_PERIPHERAL=y CONFIG_BT_ISO_MAX_CHAN=2 diff --git a/samples/bluetooth/iso_peripheral/prj.conf b/samples/bluetooth/iso_peripheral/prj.conf index a605030ca01c6..6d91fe7e0d018 100644 --- a/samples/bluetooth/iso_peripheral/prj.conf +++ b/samples/bluetooth/iso_peripheral/prj.conf @@ -1,4 +1,5 @@ CONFIG_BT=y +CONFIG_BT_PERIPHERAL=y CONFIG_LOG=y CONFIG_BT_DEVICE_NAME="Zephyr ISO server" CONFIG_BT_ISO_PERIPHERAL=y diff --git a/samples/bluetooth/iso_receive/prj.conf b/samples/bluetooth/iso_receive/prj.conf index 093695a543962..9cd340b968e78 100644 --- a/samples/bluetooth/iso_receive/prj.conf +++ b/samples/bluetooth/iso_receive/prj.conf @@ -1,4 +1,5 @@ CONFIG_BT=y +CONFIG_BT_OBSERVER=y CONFIG_BT_ISO_SYNC_RECEIVER=y CONFIG_LOG=y CONFIG_BT_DEVICE_NAME="Test ISO Receive" diff --git a/samples/bluetooth/pbp_public_broadcast_sink/prj.conf b/samples/bluetooth/pbp_public_broadcast_sink/prj.conf index 0feae717a7777..002c41ed92d36 100644 --- a/samples/bluetooth/pbp_public_broadcast_sink/prj.conf +++ b/samples/bluetooth/pbp_public_broadcast_sink/prj.conf @@ -2,6 +2,8 @@ CONFIG_BT=y CONFIG_LOG=y CONFIG_BT_PAC_SNK=y CONFIG_BT_PERIPHERAL=y +CONFIG_BT_OBSERVER=y +CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_AUDIO=y CONFIG_UTF8=y diff --git a/samples/bluetooth/tmap_bmr/prj.conf b/samples/bluetooth/tmap_bmr/prj.conf index 7c3ea5b037299..2a87e242cb422 100644 --- a/samples/bluetooth/tmap_bmr/prj.conf +++ b/samples/bluetooth/tmap_bmr/prj.conf @@ -3,6 +3,7 @@ CONFIG_LOG=y CONFIG_BT_PAC_SNK=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_PRIVACY=y +CONFIG_BT_OBSERVER=y CONFIG_BT_AUDIO=y CONFIG_UTF8=y diff --git a/samples/bluetooth/tmap_peripheral/duo.conf b/samples/bluetooth/tmap_peripheral/duo.conf index 82403ced504c5..dcd43288853f1 100644 --- a/samples/bluetooth/tmap_peripheral/duo.conf +++ b/samples/bluetooth/tmap_peripheral/duo.conf @@ -1,3 +1,4 @@ CONFIG_BT_CSIP_SET_MEMBER=y CONFIG_TMAP_PERIPHERAL_DUO=y CONFIG_BT_CAP_ACCEPTOR_SET_MEMBER=y +CONFIG_BT_GATT_DYNAMIC_DB=y diff --git a/samples/bluetooth/tmap_peripheral/prj.conf b/samples/bluetooth/tmap_peripheral/prj.conf index 69e721a3c9c77..8c1d6210b2802 100644 --- a/samples/bluetooth/tmap_peripheral/prj.conf +++ b/samples/bluetooth/tmap_peripheral/prj.conf @@ -46,6 +46,7 @@ CONFIG_BT_TBS_CLIENT_TERMINATE_CALL=y CONFIG_BT_TBS_CLIENT_BEARER_URI_SCHEMES_SUPPORTED_LIST=y # Generic config +CONFIG_BT_GATT_CACHING=y CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_GATT_CLIENT=y CONFIG_BT_EXT_ADV=y diff --git a/subsys/bluetooth/Kconfig.iso b/subsys/bluetooth/Kconfig.iso index 9fbb0a1b78fee..714ed0c1d97b5 100644 --- a/subsys/bluetooth/Kconfig.iso +++ b/subsys/bluetooth/Kconfig.iso @@ -27,7 +27,7 @@ config BT_ISO_UNICAST config BT_ISO_PERIPHERAL bool "Bluetooth Isochronous Channel Unicast Peripheral Support" depends on !BT_CTLR || BT_CTLR_PERIPHERAL_ISO_SUPPORT - select BT_PERIPHERAL + depends on BT_PERIPHERAL select BT_ISO_UNICAST help This option enables support for Bluetooth Unicast @@ -36,7 +36,7 @@ config BT_ISO_PERIPHERAL config BT_ISO_CENTRAL bool "Bluetooth Isochronous Channel Unicast Central Support" depends on !BT_CTLR || BT_CTLR_CENTRAL_ISO_SUPPORT - select BT_CENTRAL + depends on BT_CENTRAL select BT_ISO_UNICAST help This option enables support for Bluetooth Broadcast @@ -60,9 +60,9 @@ config BT_ISO_BROADCASTER config BT_ISO_SYNC_RECEIVER bool "Bluetooth Isochronous Synchronized Receiver Support" depends on !BT_CTLR || BT_CTLR_SYNC_ISO_SUPPORT + depends on BT_OBSERVER select BT_ISO_BROADCAST select BT_ISO_RX - select BT_OBSERVER select BT_PER_ADV_SYNC help This option enables support for the Bluetooth Isochronous diff --git a/subsys/bluetooth/audio/Kconfig.aics b/subsys/bluetooth/audio/Kconfig.aics index b39c4027e81c0..bcc6c2fafdbaf 100644 --- a/subsys/bluetooth/audio/Kconfig.aics +++ b/subsys/bluetooth/audio/Kconfig.aics @@ -19,7 +19,7 @@ config BT_AICS_MAX_INSTANCE_COUNT config BT_AICS bool # hidden default y if BT_AICS_MAX_INSTANCE_COUNT > 0 - select BT_GATT_DYNAMIC_DB + depends on BT_GATT_DYNAMIC_DB help This hidden option enables support for Audio Input Control Service. diff --git a/subsys/bluetooth/audio/Kconfig.bap b/subsys/bluetooth/audio/Kconfig.bap index 37b2f12bd78b3..e589e8608cb93 100644 --- a/subsys/bluetooth/audio/Kconfig.bap +++ b/subsys/bluetooth/audio/Kconfig.bap @@ -12,8 +12,8 @@ config BT_BAP_UNICAST config BT_BAP_UNICAST_SERVER bool "Bluetooth Unicast Audio Server Support" select BT_BAP_UNICAST - select BT_GATT_DYNAMIC_DB - select BT_GATT_CACHING + depends on BT_GATT_DYNAMIC_DB + depends on BT_GATT_CACHING depends on BT_PERIPHERAL depends on BT_ISO_PERIPHERAL depends on BT_ASCS @@ -207,11 +207,11 @@ endif # BT_BAP_BROADCAST_SINK config BT_BAP_SCAN_DELEGATOR bool "Basic Audio Profile Scan Delegator role support" - select BT_OBSERVER select BT_EXT_ADV select BT_PER_ADV_SYNC select BT_ISO_SYNC_RECEIVER - select BT_GATT_DYNAMIC_DB + depends on BT_OBSERVER + depends on BT_GATT_DYNAMIC_DB depends on BT_BONDABLE help This option enables support for the Scan Delegator role and the @@ -241,13 +241,13 @@ endif # BT_BAP_SCAN_DELEGATOR config BT_BAP_BROADCAST_ASSISTANT bool "Basic Audio Profile Broadcast Assistant role support" - select BT_OBSERVER select BT_EXT_ADV select BT_PER_ADV_SYNC select BT_ISO_SYNC_RECEIVER select BT_GATT_CLIENT select BT_GATT_AUTO_DISCOVER_CCC select BT_GATT_AUTO_UPDATE_MTU + depends on BT_OBSERVER depends on BT_BONDABLE help This option enables support for the Broadcast Assistant role. diff --git a/subsys/bluetooth/audio/Kconfig.cap b/subsys/bluetooth/audio/Kconfig.cap index 5ba8a9bf2f035..d87f109f2b222 100644 --- a/subsys/bluetooth/audio/Kconfig.cap +++ b/subsys/bluetooth/audio/Kconfig.cap @@ -20,7 +20,7 @@ config BT_CAP_ACCEPTOR_SET_MEMBER bool "Common Audio Profile Acceptor Role Set Member support" depends on BT_CAP_ACCEPTOR depends on BT_CSIP_SET_MEMBER - select BT_GATT_DYNAMIC_DB + depends on BT_GATT_DYNAMIC_DB help Enabling this will allow a CAP acceptor to be a set member. Enabling this will require a manual register of the CAS service. diff --git a/subsys/bluetooth/audio/Kconfig.has b/subsys/bluetooth/audio/Kconfig.has index 16e80d3558431..576f98fdcf6b5 100644 --- a/subsys/bluetooth/audio/Kconfig.has +++ b/subsys/bluetooth/audio/Kconfig.has @@ -7,7 +7,7 @@ menuconfig BT_HAS bool "Hearing Access Service support" select UTF8 - select BT_GATT_DYNAMIC_DB + depends on BT_GATT_DYNAMIC_DB depends on BT_BAP_UNICAST_SERVER help This option enables support for Hearing Access Service. diff --git a/subsys/bluetooth/audio/Kconfig.mcs b/subsys/bluetooth/audio/Kconfig.mcs index cbc6ce052bc94..4814140bf08d3 100644 --- a/subsys/bluetooth/audio/Kconfig.mcs +++ b/subsys/bluetooth/audio/Kconfig.mcs @@ -12,7 +12,7 @@ config BT_MCS bool "Media Control Service Support" depends on MCTL_LOCAL_PLAYER_REMOTE_CONTROL depends on UTF8 - select BT_GATT_DYNAMIC_DB + depends on BT_GATT_DYNAMIC_DB help This option enables support for the Media Control Service. diff --git a/subsys/bluetooth/audio/Kconfig.micp b/subsys/bluetooth/audio/Kconfig.micp index 2d982d199e107..16399381b7cfc 100644 --- a/subsys/bluetooth/audio/Kconfig.micp +++ b/subsys/bluetooth/audio/Kconfig.micp @@ -10,7 +10,7 @@ config BT_MICP_MIC_DEV bool "Microphone Control Profile Microphone Device Support" - select BT_GATT_DYNAMIC_DB + depends on BT_GATT_DYNAMIC_DB depends on BT_BONDABLE help This option enables support for Microphone Control Profile diff --git a/subsys/bluetooth/audio/Kconfig.tbs b/subsys/bluetooth/audio/Kconfig.tbs index f405ac6909625..7c42b74c36353 100644 --- a/subsys/bluetooth/audio/Kconfig.tbs +++ b/subsys/bluetooth/audio/Kconfig.tbs @@ -12,7 +12,7 @@ if BT_AUDIO config BT_TBS bool "Telephone Bearer Service Support" - select BT_GATT_DYNAMIC_DB + depends on BT_GATT_DYNAMIC_DB depends on UTF8 help This option enables support for Telephone Bearer Service. By default this only diff --git a/subsys/bluetooth/audio/Kconfig.vcp b/subsys/bluetooth/audio/Kconfig.vcp index 084f1397d0c37..d75d1943f6da0 100644 --- a/subsys/bluetooth/audio/Kconfig.vcp +++ b/subsys/bluetooth/audio/Kconfig.vcp @@ -10,7 +10,7 @@ config BT_VCP_VOL_REND bool "Volume Control Profile Volume Renderer Support" - select BT_GATT_DYNAMIC_DB + depends on BT_GATT_DYNAMIC_DB help This option enables support for Volume Control Profile Volume Renderer role and the Volume Control Service. diff --git a/tests/bluetooth/audio/ascs/prj.conf b/tests/bluetooth/audio/ascs/prj.conf index 18b09f5a32915..83cedefe0e594 100644 --- a/tests/bluetooth/audio/ascs/prj.conf +++ b/tests/bluetooth/audio/ascs/prj.conf @@ -6,6 +6,8 @@ CONFIG_BT_MAX_CONN=1 CONFIG_BT_PERIPHERAL=y CONFIG_BT_ISO_PERIPHERAL=y CONFIG_BT_ISO_MAX_CHAN=1 +CONFIG_BT_GATT_CACHING=y +CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_AUDIO=y CONFIG_BT_ASCS=y CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT=2 diff --git a/tests/bluetooth/audio/bap_base/prj.conf b/tests/bluetooth/audio/bap_base/prj.conf index 8d51961ad5722..95192bfe8c1df 100644 --- a/tests/bluetooth/audio/bap_base/prj.conf +++ b/tests/bluetooth/audio/bap_base/prj.conf @@ -4,6 +4,8 @@ CONFIG_BT=y CONFIG_BT_SMP=y CONFIG_BT_AUDIO=y CONFIG_BT_PERIPHERAL=y +CONFIG_BT_OBSERVER=y +CONFIG_BT_GATT_DYNAMIC_DB=y # Need to enable one broadcast role to enable CONFIG_BT_BAP_BASE CONFIG_BT_BAP_SCAN_DELEGATOR=y diff --git a/tests/bluetooth/audio/cap_commander/prj.conf b/tests/bluetooth/audio/cap_commander/prj.conf index 7ff7ee5b23d2a..840926e23922a 100644 --- a/tests/bluetooth/audio/cap_commander/prj.conf +++ b/tests/bluetooth/audio/cap_commander/prj.conf @@ -4,6 +4,8 @@ CONFIG_BT=y CONFIG_BT_SMP=y CONFIG_BT_CENTRAL=y CONFIG_BT_MAX_CONN=2 +CONFIG_BT_OBSERVER=y +CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_AUDIO=y # Requirements for CAP commander diff --git a/tests/bluetooth/audio/codec/prj.conf b/tests/bluetooth/audio/codec/prj.conf index 0b32d8a3a977d..ec00ae96a30fd 100644 --- a/tests/bluetooth/audio/codec/prj.conf +++ b/tests/bluetooth/audio/codec/prj.conf @@ -5,6 +5,8 @@ CONFIG_BT_SMP=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_ISO_PERIPHERAL=y CONFIG_BT_AUDIO=y +CONFIG_BT_GATT_CACHING=y +CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_BAP_UNICAST_SERVER=y CONFIG_BT_ASCS=y diff --git a/tests/bluetooth/shell/audio.conf b/tests/bluetooth/shell/audio.conf index 2a2ff06dd4e6d..049c6b766fed8 100644 --- a/tests/bluetooth/shell/audio.conf +++ b/tests/bluetooth/shell/audio.conf @@ -13,6 +13,8 @@ CONFIG_BT_CENTRAL=y CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_PRIVACY=y +CONFIG_BT_GATT_CACHING=y +CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_L2CAP_ECRED=y CONFIG_BT_SIGNING=y CONFIG_BT_FIXED_PASSKEY=y diff --git a/tests/bluetooth/tester/overlay-le-audio.conf b/tests/bluetooth/tester/overlay-le-audio.conf index b8890b94c5ef0..acbde1ea0d753 100644 --- a/tests/bluetooth/tester/overlay-le-audio.conf +++ b/tests/bluetooth/tester/overlay-le-audio.conf @@ -1,5 +1,8 @@ CONFIG_BT_AUDIO=y CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=y +CONFIG_BT_GATT_CACHING=y +CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_ISO_PERIPHERAL=y CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_EXT_ADV=y diff --git a/tests/bsim/bluetooth/audio/prj.conf b/tests/bsim/bluetooth/audio/prj.conf index fd8f7117c4edb..87e99c270a9ae 100644 --- a/tests/bsim/bluetooth/audio/prj.conf +++ b/tests/bsim/bluetooth/audio/prj.conf @@ -13,6 +13,8 @@ CONFIG_BT_ATT_PREPARE_COUNT=5 CONFIG_BT_MAX_CONN=3 CONFIG_BT_MAX_PAIRED=3 CONFIG_BT_EXT_ADV_MAX_ADV_SET=3 +CONFIG_BT_OBSERVER=y +CONFIG_BT_GATT_CACHING=y CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_SMP=y CONFIG_BT_L2CAP_TX_MTU=128 diff --git a/tests/bsim/bluetooth/host/iso/bis/prj.conf b/tests/bsim/bluetooth/host/iso/bis/prj.conf index e1e57deda07de..15eed7dd67617 100644 --- a/tests/bsim/bluetooth/host/iso/bis/prj.conf +++ b/tests/bsim/bluetooth/host/iso/bis/prj.conf @@ -4,6 +4,7 @@ CONFIG_ASSERT=y CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=y CONFIG_BT_PER_ADV_SYNC=y +CONFIG_BT_OBSERVER=y CONFIG_BT_DEVICE_NAME="BIS test" diff --git a/tests/bsim/bluetooth/host/iso/cis/prj.conf b/tests/bsim/bluetooth/host/iso/cis/prj.conf index 8637b14f0045f..bfdeab2c4e835 100644 --- a/tests/bsim/bluetooth/host/iso/cis/prj.conf +++ b/tests/bsim/bluetooth/host/iso/cis/prj.conf @@ -1,4 +1,6 @@ CONFIG_BT=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=y CONFIG_LOG=y CONFIG_ASSERT=y CONFIG_BT_SMP=y diff --git a/tests/bsim/bluetooth/ll/cis/prj.conf b/tests/bsim/bluetooth/ll/cis/prj.conf index c124cbd223eb9..ebc9296a650be 100644 --- a/tests/bsim/bluetooth/ll/cis/prj.conf +++ b/tests/bsim/bluetooth/ll/cis/prj.conf @@ -1,6 +1,8 @@ CONFIG_TEST_CONNECT_ACL_FIRST=n CONFIG_BT=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=y CONFIG_BT_EXT_ADV=y CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_ISO_PERIPHERAL=y diff --git a/tests/bsim/bluetooth/ll/cis/sysbuild/hci_ipc/nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf b/tests/bsim/bluetooth/ll/cis/sysbuild/hci_ipc/nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf index 5119ac0d3eddb..4e63ffb683631 100644 --- a/tests/bsim/bluetooth/ll/cis/sysbuild/hci_ipc/nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf +++ b/tests/bsim/bluetooth/ll/cis/sysbuild/hci_ipc/nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf @@ -10,6 +10,8 @@ CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_CBPRINTF_REDUCED_INTEGRAL=y CONFIG_BT=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=y CONFIG_BT_HCI_RAW=y CONFIG_BT_MAX_CONN=4 From 756f5f940ccb06db38fd14d738fcc98efe96d0c7 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 26 Sep 2024 17:31:06 +0200 Subject: [PATCH 1419/4482] Bluetooth: BAP: Disallow bt_bap_stream_stop when CIS is not connected When the CIS for a BAP stream is not connected, we cannot truly be in the disabling state (the only state the stop operation can be performed by the unicast client). The reason for this is that if the CIS is disconnected, then the ASCS server shall transition to the QoS Configured state regardless of whether it has received a receiver stop ready command from the unicast client. Signed-off-by: Emil Gydesen --- include/zephyr/bluetooth/audio/bap.h | 10 ++++++ subsys/bluetooth/audio/bap_unicast_client.c | 35 ++++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/include/zephyr/bluetooth/audio/bap.h b/include/zephyr/bluetooth/audio/bap.h index 6b21f61c8a578..c9c8d4fdf439c 100644 --- a/include/zephyr/bluetooth/audio/bap.h +++ b/include/zephyr/bluetooth/audio/bap.h @@ -1090,6 +1090,16 @@ int bt_bap_stream_start(struct bt_bap_stream *stream); * * @param stream Stream object * + * @retval 0 Success + * @retval -EINVAL The @p stream does not have an endpoint or a connection, of the stream's + * connection's role is not @p BT_HCI_ROLE_CENTRAL + * @retval -EBADMSG The state of the @p stream endpoint is not @ref BT_BAP_EP_STATE_DISABLING + * @retval -EALREADY The CIS state of the @p is not in a connected state, and thus is already + * stopping + * @retval -EBUSY The @p stream is busy with another operation + * @retval -ENOTCONN The @p stream ACL connection is not connected + * @retval -ENOMEM No memory to send request + * @retval -ENOEXEC The request was rejected by GATT * @return 0 in case of success or negative value in case of error. */ int bt_bap_stream_stop(struct bt_bap_stream *stream); diff --git a/subsys/bluetooth/audio/bap_unicast_client.c b/subsys/bluetooth/audio/bap_unicast_client.c index 91f7850efb293..280a2ff02226d 100644 --- a/subsys/bluetooth/audio/bap_unicast_client.c +++ b/subsys/bluetooth/audio/bap_unicast_client.c @@ -3482,6 +3482,7 @@ int bt_bap_unicast_client_disable(struct bt_bap_stream *stream) int bt_bap_unicast_client_stop(struct bt_bap_stream *stream) { struct bt_bap_ep *ep = stream->ep; + enum bt_iso_state iso_state; struct net_buf_simple *buf; struct bt_ascs_start_op *req; int err; @@ -3494,6 +3495,27 @@ int bt_bap_unicast_client_stop(struct bt_bap_stream *stream) return -ENOTCONN; } + /* ASCS_v1.0 3.2 ASE state machine transitions + * + * If the server detects link loss of a CIS for an ASE in the Streaming state or the + * Disabling state, the server shall immediately transition that ASE to the QoS Configured + * state. + * + * This effectively means that if an ASE no longer has a connected CIS, the server shall + * bring it to the QoS Configured state. That means that we, as a unicast client, should not + * attempt to stop it + */ + if (ep->iso == NULL) { + LOG_DBG("Stream endpoint does not have a CIS, server will stop the ASE"); + return -EALREADY; + } + + iso_state = ep->iso->chan.state; + if (iso_state != BT_ISO_STATE_CONNECTED && iso_state != BT_ISO_STATE_CONNECTING) { + LOG_DBG("Stream endpoint CIS is not connected, server will stop the ASE"); + return -EALREADY; + } + buf = bt_bap_unicast_client_ep_create_pdu(stream->conn, BT_ASCS_STOP_OP); if (buf == NULL) { LOG_DBG("Could not create PDU"); @@ -3513,7 +3535,18 @@ int bt_bap_unicast_client_stop(struct bt_bap_stream *stream) } req->num_ases++; - return bt_bap_unicast_client_ep_send(stream->conn, ep, buf); + err = bt_bap_unicast_client_ep_send(stream->conn, ep, buf); + if (err != 0) { + /* Return expected error directly */ + if (err == -ENOTCONN || err == -ENOMEM) { + return err; + } + + LOG_DBG("bt_bap_unicast_client_ep_send failed with unexpected error %d", + err); + + return -ENOEXEC; + } } return 0; From 2dc1113a9487b6bd1ef64f9ef47be0b99238658a Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Tue, 24 Sep 2024 18:13:13 +0200 Subject: [PATCH 1420/4482] Bluetooth: CAP: Add support for handling ASE errors If we get an error/rejection from the CAP acceptor when performing the Unicast Audio Start or Stop procedure then we need to abort the procedure and let the application determine what the next step is. This change triggered a corner case when connecting to multiple CAP acceptors as the CAP initiatior. This was also fixed as part of this. Signed-off-by: Emil Gydesen --- subsys/bluetooth/audio/cap_initiator.c | 228 ++++++++++++++---- subsys/bluetooth/audio/cap_internal.h | 3 + subsys/bluetooth/audio/cap_stream.c | 33 +++ tests/bluetooth/audio/cap_initiator/prj.conf | 3 +- .../cap_initiator/uut/bap_unicast_client.c | 75 ++++++ .../bluetooth/audio/src/cap_acceptor_test.c | 28 +-- .../audio/src/cap_initiator_unicast_test.c | 79 +++++- .../test_scripts/cap_unicast_ase_error.sh | 28 +++ 8 files changed, 410 insertions(+), 67 deletions(-) create mode 100755 tests/bsim/bluetooth/audio/test_scripts/cap_unicast_ase_error.sh diff --git a/subsys/bluetooth/audio/cap_initiator.c b/subsys/bluetooth/audio/cap_initiator.c index d6e83a6557da0..486d173ff4665 100644 --- a/subsys/bluetooth/audio/cap_initiator.c +++ b/subsys/bluetooth/audio/cap_initiator.c @@ -353,6 +353,10 @@ static enum bt_bap_ep_state stream_get_state(const struct bt_bap_stream *bap_str struct bt_bap_ep_info ep_info; int err; + if (bap_stream->ep == NULL) { + return BT_BAP_EP_STATE_IDLE; + } + err = bt_bap_ep_get_info(bap_stream->ep, &ep_info); if (err != 0) { LOG_DBG("Failed to get endpoint info %p: %d", bap_stream, err); @@ -391,24 +395,48 @@ static bool stream_is_dir(const struct bt_bap_stream *bap_stream, enum bt_audio_ return ep_info.dir == dir; } -static bool iso_is_in_state(const struct bt_cap_stream *cap_stream, enum bt_iso_state state) +static enum bt_iso_state bap_stream_get_iso_state(const struct bt_bap_stream *bap_stream) { - const struct bt_bap_stream *bap_stream = &cap_stream->bap_stream; struct bt_bap_ep_info ep_info; int err; + if (bap_stream->ep == NULL) { + return BT_ISO_STATE_DISCONNECTED; + } + err = bt_bap_ep_get_info(bap_stream->ep, &ep_info); if (err != 0) { LOG_DBG("Failed to get endpoint info %p: %d", bap_stream, err); - return false; + return BT_ISO_STATE_DISCONNECTED; } if (ep_info.iso_chan == NULL) { - return state == BT_ISO_STATE_DISCONNECTED; + return BT_ISO_STATE_DISCONNECTED; + } + + return ep_info.iso_chan->state; +} + +static bool iso_is_in_state(const struct bt_cap_stream *cap_stream, enum bt_iso_state state) +{ + const struct bt_bap_stream *bap_stream = &cap_stream->bap_stream; + + return bap_stream_get_iso_state(bap_stream) == state; +} + +static void set_cap_stream_in_progress(struct bt_cap_stream *cap_stream, bool value) +{ + struct bt_cap_common_proc *active_proc = bt_cap_common_get_active_proc(); + + for (size_t i = 0U; i < active_proc->proc_cnt; i++) { + if (cap_stream == active_proc->proc_param.initiator[i].stream) { + active_proc->proc_param.initiator[i].in_progress = value; + return; + } } - return state == ep_info.iso_chan->state; + __ASSERT(false, "CAP stream %p not in active_proc", cap_stream); } /** @@ -441,7 +469,7 @@ static void update_proc_done_cnt(struct bt_cap_common_proc *active_proc) * the states to determine how far we are. */ for (size_t i = 0U; i < active_proc->proc_cnt; i++) { - const struct bt_cap_initiator_proc_param *proc_param; + struct bt_cap_initiator_proc_param *proc_param; struct bt_cap_stream *cap_stream; struct bt_bap_stream *bap_stream; enum bt_bap_ep_state state; @@ -502,7 +530,7 @@ static void update_proc_done_cnt(struct bt_cap_common_proc *active_proc) * the states to determine how far we are. */ for (size_t i = 0U; i < active_proc->proc_cnt; i++) { - const struct bt_cap_initiator_proc_param *proc_param; + struct bt_cap_initiator_proc_param *proc_param; struct bt_cap_stream *cap_stream; struct bt_bap_stream *bap_stream; enum bt_bap_ep_state state; @@ -540,7 +568,7 @@ static void update_proc_done_cnt(struct bt_cap_common_proc *active_proc) /* For metadata we cannot check the states for all streams, as it does not trigger a * state change */ - const struct bt_cap_initiator_proc_param *proc_param; + struct bt_cap_initiator_proc_param *proc_param; struct bt_cap_stream *cap_stream; struct bt_bap_stream *bap_stream; enum bt_bap_ep_state state; @@ -589,6 +617,11 @@ get_next_proc_param(struct bt_cap_common_proc *active_proc) enum bt_bap_ep_state state; proc_param = &active_proc->proc_param.initiator[i]; + + if (proc_param->in_progress) { + continue; + } + cap_stream = proc_param->stream; bap_stream = &cap_stream->bap_stream; state = stream_get_state(bap_stream); @@ -814,6 +847,43 @@ static void cap_initiator_unicast_audio_proc_complete(void) } } +void bt_cap_initiator_cp_cb(struct bt_cap_stream *cap_stream, enum bt_bap_ascs_rsp_code rsp_code, + enum bt_bap_ascs_reason reason) +{ + if (!bt_cap_common_stream_in_active_proc(cap_stream)) { + /* State change happened outside of a procedure; ignore */ + return; + } + + LOG_DBG("cap_stream %p", cap_stream); + + set_cap_stream_in_progress(cap_stream, false); + + if (rsp_code != BT_BAP_ASCS_RSP_CODE_SUCCESS) { + struct bt_cap_common_proc *active_proc = bt_cap_common_get_active_proc(); + + /* In the case that the control point write is rejected, we will not get a ASE state + * change notification. This is considered an error that shall abort the current + * procedure. + */ + active_proc->proc_done_cnt++; + + LOG_DBG("Control point operation on stream %p failed with %d and reason %d", + cap_stream, rsp_code, reason); + + /* Unexpected callback - Abort */ + bt_cap_common_abort_proc(cap_stream->bap_stream.conn, -EBADMSG); + + if (bt_cap_common_proc_is_aborted()) { + if (bt_cap_common_proc_all_handled()) { + cap_initiator_unicast_audio_proc_complete(); + } + + return; + } + } +} + static int cap_initiator_unicast_audio_configure( const struct bt_cap_unicast_audio_start_param *param) { @@ -869,6 +939,7 @@ static int cap_initiator_unicast_audio_configure( conn = proc_param->start.conn; ep = proc_param->start.ep; active_proc->proc_initiated_cnt++; + proc_param->in_progress = true; /* Since BAP operations may require a write long or a read long on the notification, * we cannot assume that we can do multiple streams at once, thus do it one at a time. @@ -971,6 +1042,7 @@ void bt_cap_initiator_codec_configured(struct bt_cap_stream *cap_stream) codec_cfg = proc_param->start.codec_cfg; next_bap_stream = &next_cap_stream->bap_stream; active_proc->proc_initiated_cnt++; + proc_param->in_progress = true; err = bt_bap_stream_config(conn, next_bap_stream, ep, codec_cfg); if (err != 0) { @@ -1038,7 +1110,16 @@ void bt_cap_initiator_codec_configured(struct bt_cap_stream *cap_stream) break; } - active_proc->proc_initiated_cnt++; + for (size_t j = 0U; j < active_proc->proc_cnt; j++) { + proc_param = &active_proc->proc_param.initiator[j]; + if (proc_param->stream->bap_stream.conn == conns[i]) { + active_proc->proc_initiated_cnt++; + proc_param->in_progress = false; + break; + } + } + + proc_param->in_progress = true; err = bt_bap_stream_qos(conns[i], unicast_group); if (err != 0) { @@ -1115,6 +1196,7 @@ void bt_cap_initiator_qos_configured(struct bt_cap_stream *cap_stream) next_cap_stream = proc_param->stream; bap_stream = &next_cap_stream->bap_stream; active_proc->proc_initiated_cnt++; + proc_param->in_progress = true; err = bt_bap_stream_enable(bap_stream, bap_stream->codec_cfg->meta, bap_stream->codec_cfg->meta_len); @@ -1136,6 +1218,7 @@ void bt_cap_initiator_qos_configured(struct bt_cap_stream *cap_stream) next_cap_stream = proc_param->stream; next_bap_stream = &next_cap_stream->bap_stream; active_proc->proc_initiated_cnt++; + proc_param->in_progress = true; err = bt_bap_stream_release(next_bap_stream); if (err != 0) { @@ -1189,6 +1272,7 @@ void bt_cap_initiator_enabled(struct bt_cap_stream *cap_stream) next_bap_stream = &next_cap_stream->bap_stream; active_proc->proc_initiated_cnt++; + proc_param->in_progress = true; err = bt_bap_stream_enable(next_bap_stream, next_bap_stream->codec_cfg->meta, next_bap_stream->codec_cfg->meta_len); @@ -1213,6 +1297,7 @@ void bt_cap_initiator_enabled(struct bt_cap_stream *cap_stream) } bap_stream = &proc_param->stream->bap_stream; + proc_param->in_progress = true; err = bt_bap_stream_connect(bap_stream); if (err == -EALREADY) { @@ -1220,6 +1305,7 @@ void bt_cap_initiator_enabled(struct bt_cap_stream *cap_stream) * NOTE: It's important that we do not do any additional functionality after * calling this */ + proc_param->in_progress = false; bt_cap_initiator_connected(proc_param->stream); } else if (err != 0) { LOG_DBG("Failed to connect stream %p: %d", proc_param->stream, err); @@ -1247,6 +1333,8 @@ void bt_cap_initiator_connected(struct bt_cap_stream *cap_stream) LOG_DBG("cap_stream %p", cap_stream); + set_cap_stream_in_progress(cap_stream, false); + if (!bt_cap_common_subproc_is_type(BT_CAP_COMMON_SUBPROC_TYPE_CONNECT)) { /* Unexpected callback - Abort */ bt_cap_common_abort_proc(cap_stream->bap_stream.conn, -EBADMSG); @@ -1277,21 +1365,26 @@ void bt_cap_initiator_connected(struct bt_cap_stream *cap_stream) struct bt_bap_stream *next_bap_stream; proc_param = get_next_proc_param(active_proc); - __ASSERT(proc_param != NULL, "proc is not done, but could not get next proc_param"); - next_cap_stream = proc_param->stream; - next_bap_stream = &next_cap_stream->bap_stream; + if (proc_param != NULL) { + next_cap_stream = proc_param->stream; + next_bap_stream = &next_cap_stream->bap_stream; - active_proc->proc_initiated_cnt++; + active_proc->proc_initiated_cnt++; + proc_param->in_progress = true; - err = bt_bap_stream_connect(next_bap_stream); - if (err == 0 || err == -EALREADY) { - /* Pending connected - wait for connected callback */ - } else if (err != 0) { - LOG_DBG("Failed to connect stream %p: %d", next_cap_stream, err); + err = bt_bap_stream_connect(next_bap_stream); + if (err == 0 || err == -EALREADY) { + if (err == -EALREADY) { + proc_param->in_progress = false; + } + /* Pending connected - wait for connected callback */ + } else if (err != 0) { + LOG_DBG("Failed to connect stream %p: %d", next_cap_stream, err); - bt_cap_common_abort_proc(next_bap_stream->conn, err); - cap_initiator_unicast_audio_proc_complete(); - } + bt_cap_common_abort_proc(next_bap_stream->conn, err); + cap_initiator_unicast_audio_proc_complete(); + } + } /* else pending connection - wait for connected callback */ return; } @@ -1312,6 +1405,8 @@ void bt_cap_initiator_connected(struct bt_cap_stream *cap_stream) bap_stream = &proc_param->stream->bap_stream; if (stream_is_dir(bap_stream, BT_AUDIO_DIR_SOURCE)) { + proc_param->in_progress = true; + err = bt_bap_stream_start(bap_stream); if (err != 0) { LOG_DBG("Failed to start stream %p: %d", proc_param->stream, err); @@ -1336,8 +1431,12 @@ void bt_cap_initiator_started(struct bt_cap_stream *cap_stream) } /* Streams may go into the streaming state while we are connecting or starting them */ - if (!bt_cap_common_subproc_is_type(BT_CAP_COMMON_SUBPROC_TYPE_START) && - !bt_cap_common_subproc_is_type(BT_CAP_COMMON_SUBPROC_TYPE_CONNECT)) { + if (bt_cap_common_subproc_is_type(BT_CAP_COMMON_SUBPROC_TYPE_CONNECT)) { + /* If we are still connecting the streams, we terminate early as to not perform any + * start operations until all streams are connected + */ + return; + } else if (!bt_cap_common_subproc_is_type(BT_CAP_COMMON_SUBPROC_TYPE_START)) { /* Unexpected callback - Abort */ bt_cap_common_abort_proc(cap_stream->bap_stream.conn, -EBADMSG); } else { @@ -1353,25 +1452,29 @@ void bt_cap_initiator_started(struct bt_cap_stream *cap_stream) struct bt_bap_stream *next_bap_stream; proc_param = get_next_proc_param(active_proc); - __ASSERT(proc_param != NULL, "proc is not done, but could not get next proc_param"); - next_cap_stream = proc_param->stream; - next_bap_stream = &next_cap_stream->bap_stream; + if (proc_param != NULL) { + next_cap_stream = proc_param->stream; + next_bap_stream = &next_cap_stream->bap_stream; - if (stream_is_dir(next_bap_stream, BT_AUDIO_DIR_SOURCE)) { - int err; + if (stream_is_dir(next_bap_stream, BT_AUDIO_DIR_SOURCE)) { + int err; - err = bt_bap_stream_start(next_bap_stream); - if (err != 0) { - LOG_DBG("Failed to start stream %p: %d", next_cap_stream, err); + proc_param->in_progress = true; - /* End and mark procedure as aborted. - * If we have sent any requests over air, we will abort - * once all sent requests has completed - */ - bt_cap_common_abort_proc(next_bap_stream->conn, err); - cap_initiator_unicast_audio_proc_complete(); + err = bt_bap_stream_start(next_bap_stream); + if (err != 0) { + LOG_DBG("Failed to start stream %p: %d", next_cap_stream, + err); + + /* End and mark procedure as aborted. + * If we have sent any requests over air, we will abort + * once all sent requests has completed + */ + bt_cap_common_abort_proc(next_bap_stream->conn, err); + cap_initiator_unicast_audio_proc_complete(); - return; + return; + } } } /* else await notifications from server */ @@ -1521,6 +1624,7 @@ int bt_cap_initiator_unicast_audio_update(const struct bt_cap_unicast_audio_upda meta_len = proc_param->meta_update.meta_len; meta = proc_param->meta_update.meta; active_proc->proc_initiated_cnt++; + proc_param->in_progress = true; err = bt_bap_stream_metadata(bap_stream, meta, meta_len); if (err != 0) { @@ -1588,6 +1692,7 @@ void bt_cap_initiator_metadata_updated(struct bt_cap_stream *cap_stream) next_cap_stream = proc_param->stream; bap_stream = &next_cap_stream->bap_stream; active_proc->proc_initiated_cnt++; + proc_param->in_progress = true; err = bt_bap_stream_metadata(bap_stream, meta, meta_len); if (err != 0) { @@ -1636,10 +1741,21 @@ static bool can_disable_stream(const struct bt_bap_stream *bap_stream) static bool can_stop_stream(const struct bt_bap_stream *bap_stream) { + enum bt_iso_state iso_state; + if (bap_stream->conn == NULL) { return false; } + if (stream_is_dir(bap_stream, BT_AUDIO_DIR_SINK)) { + return false; + } + + iso_state = bap_stream_get_iso_state(bap_stream); + if (iso_state != BT_ISO_STATE_CONNECTED && iso_state != BT_ISO_STATE_CONNECTING) { + return false; + } + return stream_is_in_state(bap_stream, BT_BAP_EP_STATE_DISABLING); } @@ -1794,6 +1910,7 @@ int bt_cap_initiator_unicast_audio_stop(const struct bt_cap_unicast_audio_stop_p "proc is not started, but could not get next proc_param"); bap_stream = &proc_param->stream->bap_stream; active_proc->proc_initiated_cnt++; + proc_param->in_progress = true; err = bt_bap_stream_disable(bap_stream); if (err != 0) { @@ -1812,6 +1929,7 @@ int bt_cap_initiator_unicast_audio_stop(const struct bt_cap_unicast_audio_stop_p "proc is not started, but could not get next proc_param"); bap_stream = &proc_param->stream->bap_stream; active_proc->proc_initiated_cnt++; + proc_param->in_progress = true; err = bt_bap_stream_stop(bap_stream); if (err != 0) { @@ -1830,6 +1948,7 @@ int bt_cap_initiator_unicast_audio_stop(const struct bt_cap_unicast_audio_stop_p "proc is not started, but could not get next proc_param"); bap_stream = &proc_param->stream->bap_stream; active_proc->proc_initiated_cnt++; + proc_param->in_progress = true; err = bt_bap_stream_release(bap_stream); if (err != 0) { @@ -1880,6 +1999,7 @@ void bt_cap_initiator_disabled(struct bt_cap_stream *cap_stream) next_cap_stream = proc_param->stream; next_bap_stream = &next_cap_stream->bap_stream; active_proc->proc_initiated_cnt++; + proc_param->in_progress = true; err = bt_bap_stream_disable(next_bap_stream); if (err != 0) { @@ -1909,14 +2029,17 @@ void bt_cap_initiator_disabled(struct bt_cap_stream *cap_stream) next_cap_stream = proc_param->stream; next_bap_stream = &next_cap_stream->bap_stream; active_proc->proc_initiated_cnt++; + proc_param->in_progress = true; err = bt_bap_stream_stop(next_bap_stream); - if (err != 0) { + if (err != 0 && err != -EALREADY) { LOG_DBG("Failed to stop stream %p: %d", next_cap_stream, err); bt_cap_common_abort_proc(next_bap_stream->conn, err); cap_initiator_unicast_audio_proc_complete(); - } + } else if (err == -EALREADY) { + proc_param->in_progress = false; + } /* else wait for server notification*/ } } @@ -1961,19 +2084,23 @@ void bt_cap_initiator_stopped(struct bt_cap_stream *cap_stream) int err; proc_param = get_next_proc_param(active_proc); - __ASSERT(proc_param != NULL, "proc is not done, but could not get next proc_param"); - next_cap_stream = proc_param->stream; - next_bap_stream = &next_cap_stream->bap_stream; + if (proc_param != NULL) { + next_cap_stream = proc_param->stream; + next_bap_stream = &next_cap_stream->bap_stream; - active_proc->proc_initiated_cnt++; + active_proc->proc_initiated_cnt++; + proc_param->in_progress = true; - err = bt_bap_stream_stop(next_bap_stream); - if (err != 0) { - LOG_DBG("Failed to stop stream %p: %d", next_cap_stream, err); + err = bt_bap_stream_stop(next_bap_stream); + if (err != 0 && err != -EALREADY) { + LOG_DBG("Failed to stop stream %p: %d", next_cap_stream, err); - bt_cap_common_abort_proc(next_bap_stream->conn, err); - cap_initiator_unicast_audio_proc_complete(); - } + bt_cap_common_abort_proc(next_bap_stream->conn, err); + cap_initiator_unicast_audio_proc_complete(); + } else if (err == -EALREADY) { + proc_param->in_progress = false; + } + } /* else await notification from server */ } else { /* We are done stopping streams now - We mark the next subproc. If * get_next_proc_param returns a NULL value it means that we are complete done. If @@ -2040,6 +2167,7 @@ void bt_cap_initiator_released(struct bt_cap_stream *cap_stream) next_cap_stream = proc_param->stream; next_bap_stream = &next_cap_stream->bap_stream; active_proc->proc_initiated_cnt++; + proc_param->in_progress = true; err = bt_bap_stream_release(next_bap_stream); if (err != 0) { diff --git a/subsys/bluetooth/audio/cap_internal.h b/subsys/bluetooth/audio/cap_internal.h index c063f8c834166..7d8d530628d43 100644 --- a/subsys/bluetooth/audio/cap_internal.h +++ b/subsys/bluetooth/audio/cap_internal.h @@ -34,6 +34,8 @@ void bt_cap_initiator_disabled(struct bt_cap_stream *cap_stream); void bt_cap_initiator_stopped(struct bt_cap_stream *cap_stream); void bt_cap_initiator_released(struct bt_cap_stream *cap_stream); void bt_cap_stream_ops_register_bap(struct bt_cap_stream *cap_stream); +void bt_cap_initiator_cp_cb(struct bt_cap_stream *cap_stream, enum bt_bap_ascs_rsp_code rsp_code, + enum bt_bap_ascs_reason reason); enum bt_cap_common_proc_state { BT_CAP_COMMON_PROC_STATE_ACTIVE, @@ -88,6 +90,7 @@ struct bt_cap_initiator_proc_param { bool release; } stop; }; + bool in_progress; }; #if defined(CONFIG_BT_BAP_BROADCAST_ASSISTANT) diff --git a/subsys/bluetooth/audio/cap_stream.c b/subsys/bluetooth/audio/cap_stream.c index 821366d78c6fb..7c8cbe83184db 100644 --- a/subsys/bluetooth/audio/cap_stream.c +++ b/subsys/bluetooth/audio/cap_stream.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -280,9 +281,41 @@ static struct bt_bap_stream_ops bap_stream_ops = { .disconnected = cap_stream_disconnected_cb, }; +static void unicast_client_cp_cb(struct bt_bap_stream *bap_stream, + enum bt_bap_ascs_rsp_code rsp_code, enum bt_bap_ascs_reason reason) +{ + if (IS_ENABLED(CONFIG_BT_CAP_INITIATOR) && IS_ENABLED(CONFIG_BT_BAP_UNICAST_CLIENT) && + stream_is_central(bap_stream)) { + struct bt_cap_stream *cap_stream = + CONTAINER_OF(bap_stream, struct bt_cap_stream, bap_stream); + + bt_cap_initiator_cp_cb(cap_stream, rsp_code, reason); + } +} + void bt_cap_stream_ops_register_bap(struct bt_cap_stream *cap_stream) { bt_bap_stream_cb_register(&cap_stream->bap_stream, &bap_stream_ops); + + if (IS_ENABLED(CONFIG_BT_CAP_INITIATOR) && IS_ENABLED(CONFIG_BT_BAP_UNICAST_CLIENT)) { + /* The CAP initiator can use the same callback for all of these as the result is the + * same: Abort current procedure + */ + static struct bt_bap_unicast_client_cb unicast_client_cb = { + .config = unicast_client_cp_cb, + .qos = unicast_client_cp_cb, + .enable = unicast_client_cp_cb, + .start = unicast_client_cp_cb, + .stop = unicast_client_cp_cb, + .disable = unicast_client_cp_cb, + .metadata = unicast_client_cp_cb, + .release = unicast_client_cp_cb, + }; + int err; + + err = bt_bap_unicast_client_register_cb(&unicast_client_cb); + __ASSERT_NO_MSG(err == 0 || err == -EEXIST); + } } void bt_cap_stream_ops_register(struct bt_cap_stream *stream, diff --git a/tests/bluetooth/audio/cap_initiator/prj.conf b/tests/bluetooth/audio/cap_initiator/prj.conf index 33283b79045a1..52b330d86aea8 100644 --- a/tests/bluetooth/audio/cap_initiator/prj.conf +++ b/tests/bluetooth/audio/cap_initiator/prj.conf @@ -12,7 +12,6 @@ CONFIG_BT_BAP_UNICAST_CLIENT=y CONFIG_BT_CSIP_SET_COORDINATOR=y CONFIG_BT_CAP_INITIATOR=y -CONFIG_BT_CAP_INITIATOR_LOG_LEVEL_DBG=y # Support setting up a sink and source stream on 2 acceptors CONFIG_BT_MAX_CONN=2 @@ -26,3 +25,5 @@ CONFIG_ASSERT_LEVEL=2 CONFIG_ASSERT_VERBOSE=y CONFIG_BT_BAP_STREAM_LOG_LEVEL_DBG=y +CONFIG_BT_CAP_COMMON_LOG_LEVEL_DBG=y +CONFIG_BT_CAP_INITIATOR_LOG_LEVEL_DBG=y diff --git a/tests/bluetooth/audio/cap_initiator/uut/bap_unicast_client.c b/tests/bluetooth/audio/cap_initiator/uut/bap_unicast_client.c index 739e2ead1c198..649d431b764a3 100644 --- a/tests/bluetooth/audio/cap_initiator/uut/bap_unicast_client.c +++ b/tests/bluetooth/audio/cap_initiator/uut/bap_unicast_client.c @@ -12,14 +12,18 @@ #include #include +#include #include #include #include #include #include "bap_endpoint.h" +#include "bap_iso.h" #include "ztest_assert.h" +static struct bt_bap_unicast_client_cb *unicast_client_cb; + bool bt_bap_ep_is_unicast_client(const struct bt_bap_ep *ep) { return false; @@ -40,6 +44,11 @@ int bt_bap_unicast_client_config(struct bt_bap_stream *stream, return -EINVAL; } + if (unicast_client_cb != NULL && unicast_client_cb->config != NULL) { + unicast_client_cb->config(stream, BT_BAP_ASCS_RSP_CODE_SUCCESS, + BT_BAP_ASCS_REASON_NONE); + } + stream->ep->status.state = BT_BAP_EP_STATE_CODEC_CONFIGURED; if (stream->ops != NULL && stream->ops->configured != NULL) { @@ -73,6 +82,11 @@ int bt_bap_unicast_client_qos(struct bt_conn *conn, struct bt_bap_unicast_group SYS_SLIST_FOR_EACH_CONTAINER(&group->streams, stream, _node) { if (stream->conn == conn) { + if (unicast_client_cb != NULL && unicast_client_cb->qos != NULL) { + unicast_client_cb->qos(stream, BT_BAP_ASCS_RSP_CODE_SUCCESS, + BT_BAP_ASCS_REASON_NONE); + } + stream->ep->status.state = BT_BAP_EP_STATE_QOS_CONFIGURED; if (stream->ops != NULL && stream->ops->qos_set != NULL) { @@ -98,6 +112,11 @@ int bt_bap_unicast_client_enable(struct bt_bap_stream *stream, const uint8_t met return -EINVAL; } + if (unicast_client_cb != NULL && unicast_client_cb->enable != NULL) { + unicast_client_cb->enable(stream, BT_BAP_ASCS_RSP_CODE_SUCCESS, + BT_BAP_ASCS_REASON_NONE); + } + stream->ep->status.state = BT_BAP_EP_STATE_ENABLING; if (stream->ops != NULL && stream->ops->enabled != NULL) { @@ -122,6 +141,11 @@ int bt_bap_unicast_client_metadata(struct bt_bap_stream *stream, const uint8_t m return -EINVAL; } + if (unicast_client_cb != NULL && unicast_client_cb->metadata != NULL) { + unicast_client_cb->metadata(stream, BT_BAP_ASCS_RSP_CODE_SUCCESS, + BT_BAP_ASCS_REASON_NONE); + } + if (stream->ops != NULL && stream->ops->metadata_updated != NULL) { stream->ops->metadata_updated(stream); } @@ -173,6 +197,11 @@ int bt_bap_unicast_client_start(struct bt_bap_stream *stream) return -EINVAL; } + if (unicast_client_cb != NULL && unicast_client_cb->start != NULL) { + unicast_client_cb->start(stream, BT_BAP_ASCS_RSP_CODE_SUCCESS, + BT_BAP_ASCS_REASON_NONE); + } + stream->ep->status.state = BT_BAP_EP_STATE_STREAMING; if (stream->ops != NULL && stream->ops->started != NULL) { @@ -203,6 +232,11 @@ int bt_bap_unicast_client_disable(struct bt_bap_stream *stream) * when leaving the streaming state in a non-release manner */ + if (unicast_client_cb != NULL && unicast_client_cb->disable != NULL) { + unicast_client_cb->disable(stream, BT_BAP_ASCS_RSP_CODE_SUCCESS, + BT_BAP_ASCS_REASON_NONE); + } + /* Disabled sink ASEs go directly to the QoS configured state */ if (stream->ep->dir == BT_AUDIO_DIR_SINK) { stream->ep->status.state = BT_BAP_EP_STATE_QOS_CONFIGURED; @@ -245,6 +279,11 @@ int bt_bap_unicast_client_stop(struct bt_bap_stream *stream) return -EINVAL; } + if (unicast_client_cb != NULL && unicast_client_cb->stop != NULL) { + unicast_client_cb->stop(stream, BT_BAP_ASCS_RSP_CODE_SUCCESS, + BT_BAP_ASCS_REASON_NONE); + } + stream->ep->status.state = BT_BAP_EP_STATE_QOS_CONFIGURED; if (stream->ops != NULL && stream->ops->stopped != NULL) { @@ -255,6 +294,30 @@ int bt_bap_unicast_client_stop(struct bt_bap_stream *stream) stream->ops->qos_set(stream); } + /* If the stream can be disconnected, BAP will disconnect the stream once it reaches the + * QoS Configured state. We simulator that behavior here, and if the stream is disconnected, + * then the Unicast Server will set any paired stream to the QoS Configured state + * autonomously as well. + */ + if (bt_bap_stream_can_disconnect(stream)) { + struct bt_bap_ep *pair_ep = bt_bap_iso_get_paired_ep(stream->ep); + + if (pair_ep != NULL && pair_ep->stream != NULL) { + struct bt_bap_stream *pair_stream = pair_ep->stream; + + pair_stream->ep->status.state = BT_BAP_EP_STATE_QOS_CONFIGURED; + + if (pair_stream->ops != NULL && pair_stream->ops->stopped != NULL) { + pair_stream->ops->stopped(pair_stream, + BT_HCI_ERR_LOCALHOST_TERM_CONN); + } + + if (pair_stream->ops != NULL && pair_stream->ops->qos_set != NULL) { + pair_stream->ops->qos_set(pair_stream); + } + } + } + return 0; } @@ -277,6 +340,11 @@ int bt_bap_unicast_client_release(struct bt_bap_stream *stream) return -EINVAL; } + if (unicast_client_cb != NULL && unicast_client_cb->release != NULL) { + unicast_client_cb->release(stream, BT_BAP_ASCS_RSP_CODE_SUCCESS, + BT_BAP_ASCS_REASON_NONE); + } + stream->ep->status.state = BT_BAP_EP_STATE_IDLE; bt_bap_stream_reset(stream); @@ -286,3 +354,10 @@ int bt_bap_unicast_client_release(struct bt_bap_stream *stream) return 0; } + +int bt_bap_unicast_client_register_cb(struct bt_bap_unicast_client_cb *cb) +{ + unicast_client_cb = cb; + + return 0; +} diff --git a/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c b/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c index cc7a2d4be02ff..430f1268f413d 100644 --- a/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c @@ -503,12 +503,25 @@ static int unicast_server_qos(struct bt_bap_stream *stream, const struct bt_bap_ return 0; } +static bool ascs_data_func_cb(struct bt_data *data, void *user_data) +{ + struct bt_bap_ascs_rsp *rsp = (struct bt_bap_ascs_rsp *)user_data; + + if (!BT_AUDIO_METADATA_TYPE_IS_KNOWN(data->type)) { + printk("Invalid metadata type %u or length %u\n", data->type, data->data_len); + *rsp = BT_BAP_ASCS_RSP(BT_BAP_ASCS_RSP_CODE_METADATA_REJECTED, data->type); + return false; + } + + return true; +} + static int unicast_server_enable(struct bt_bap_stream *stream, const uint8_t meta[], size_t meta_len, struct bt_bap_ascs_rsp *rsp) { printk("Enable: stream %p meta_len %zu\n", stream, meta_len); - return 0; + return bt_audio_data_parse(meta, meta_len, ascs_data_func_cb, rsp); } static int unicast_server_start(struct bt_bap_stream *stream, struct bt_bap_ascs_rsp *rsp) @@ -518,19 +531,6 @@ static int unicast_server_start(struct bt_bap_stream *stream, struct bt_bap_ascs return 0; } -static bool ascs_data_func_cb(struct bt_data *data, void *user_data) -{ - struct bt_bap_ascs_rsp *rsp = (struct bt_bap_ascs_rsp *)user_data; - - if (!BT_AUDIO_METADATA_TYPE_IS_KNOWN(data->type)) { - printk("Invalid metadata type %u or length %u\n", data->type, data->data_len); - *rsp = BT_BAP_ASCS_RSP(BT_BAP_ASCS_RSP_CODE_METADATA_REJECTED, data->type); - return false; - } - - return true; -} - static int unicast_server_metadata(struct bt_bap_stream *stream, const uint8_t meta[], size_t meta_len, struct bt_bap_ascs_rsp *rsp) { diff --git a/tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c b/tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c index 315732c5e0648..bd98e6a5c0928 100644 --- a/tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c @@ -85,6 +85,7 @@ CREATE_FLAG(flag_discovered); CREATE_FLAG(flag_codec_found); CREATE_FLAG(flag_endpoint_found); CREATE_FLAG(flag_started); +CREATE_FLAG(flag_start_failed); CREATE_FLAG(flag_start_timeout); CREATE_FLAG(flag_updated); CREATE_FLAG(flag_stopped); @@ -237,7 +238,8 @@ static void unicast_start_complete_cb(int err, struct bt_conn *conn) if (err == -ECANCELED) { SET_FLAG(flag_start_timeout); } else if (err != 0) { - FAIL("Failed to start (failing conn %p): %d", conn, err); + printk("Failed to start (failing conn %p): %d\n", conn, err); + SET_FLAG(flag_start_failed); } else { SET_FLAG(flag_started); } @@ -694,6 +696,7 @@ static void unicast_audio_stop(struct bt_bap_unicast_group *unicast_group) /* Stop without release first to verify that we enter the QoS Configured state */ UNSET_FLAG(flag_stopped); + printk("Stopping without relasing\n"); err = bt_cap_initiator_unicast_audio_stop(¶m); if (err != 0) { @@ -714,6 +717,7 @@ static void unicast_audio_stop(struct bt_bap_unicast_group *unicast_group) /* Stop with release first to verify that we enter the idle state */ UNSET_FLAG(flag_stopped); param.release = true; + printk("Relasing\n"); err = bt_cap_initiator_unicast_audio_stop(¶m); if (err != 0) { @@ -791,9 +795,12 @@ static void test_main_cap_initiator_unicast(void) discover_source(default_conn); for (size_t i = 0U; i < iterations; i++) { + printk("\nRunning iteration i=%zu\n\n", i); unicast_group_create(&unicast_group); for (size_t j = 0U; j < iterations; j++) { + printk("\nRunning iteration j=%zu\n\n", i); + unicast_audio_start(unicast_group, true); unicast_audio_update(); @@ -843,7 +850,7 @@ static void test_main_cap_initiator_unicast_inval(void) static void test_cap_initiator_unicast_timeout(void) { struct bt_bap_unicast_group *unicast_group; - const k_timeout_t timeout = K_SECONDS(1); + const k_timeout_t timeout = K_SECONDS(10); const size_t iterations = 2; init(); @@ -860,6 +867,7 @@ static void test_cap_initiator_unicast_timeout(void) unicast_group_create(&unicast_group); for (size_t j = 0U; j < iterations; j++) { + printk("\nRunning iteration #%zu\n\n", j); unicast_audio_start(unicast_group, false); k_sleep(timeout); @@ -880,6 +888,67 @@ static void test_cap_initiator_unicast_timeout(void) PASS("CAP initiator unicast timeout passed\n"); } +static void set_invalid_metadata_type(uint8_t type) +{ + const uint8_t val = 0xFF; + int err; + + err = bt_audio_codec_cfg_meta_set_val(&unicast_preset_16_2_1.codec_cfg, type, &val, + sizeof(val)); + if (err < 0) { + FAIL("Failed to set invalid metadata type: %d\n", err); + return; + } +} + +static void unset_invalid_metadata_type(uint8_t type) +{ + int err; + + err = bt_audio_codec_cfg_meta_unset_val(&unicast_preset_16_2_1.codec_cfg, type); + if (err < 0) { + FAIL("Failed to unset invalid metadata type: %d\n", err); + return; + } +} + +static void test_cap_initiator_unicast_ase_error(void) +{ + struct bt_bap_unicast_group *unicast_group; + const uint8_t inval_type = 0xFD; + + init(); + + scan_and_connect(); + + WAIT_FOR_FLAG(flag_mtu_exchanged); + + discover_cas(default_conn); + discover_sink(default_conn); + discover_source(default_conn); + + unicast_group_create(&unicast_group); + + set_invalid_metadata_type(inval_type); + + /* With invalid metadata type, start should fail */ + unicast_audio_start(unicast_group, false); + WAIT_FOR_FLAG(flag_start_failed); + + /* Remove invalid type and retry */ + unset_invalid_metadata_type(inval_type); + + /* Without invalid metadata type, start should pass */ + unicast_audio_start(unicast_group, true); + + unicast_audio_stop(unicast_group); + + unicast_group_delete(unicast_group); + unicast_group = NULL; + + PASS("CAP initiator unicast ASE error passed\n"); +} + static const struct named_lc3_preset *cap_get_named_preset(const char *preset_arg) { for (size_t i = 0U; i < ARRAY_SIZE(lc3_unicast_presets); i++) { @@ -1563,6 +1632,12 @@ static const struct bst_test_instance test_cap_initiator_unicast[] = { .test_tick_f = test_tick, .test_main_f = test_cap_initiator_unicast_timeout, }, + { + .test_id = "cap_initiator_unicast_ase_error", + .test_pre_init_f = test_init, + .test_tick_f = test_tick, + .test_main_f = test_cap_initiator_unicast_ase_error, + }, { .test_id = "cap_initiator_unicast_inval", .test_pre_init_f = test_init, diff --git a/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_ase_error.sh b/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_ase_error.sh new file mode 100755 index 0000000000000..b6faaddfd6e03 --- /dev/null +++ b/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_ase_error.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 + +SIMULATION_ID="cap_unicast_ase_error" +VERBOSITY_LEVEL=2 + +source ${ZEPHYR_BASE}/tests/bsim/sh_common.source + +cd ${BSIM_OUT_PATH}/bin + +printf "\n\n======== Running CAP unicast ASE error test =========\n\n" + +Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_audio_prj_conf \ + -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=0 -testid=cap_initiator_unicast_ase_error \ + -RealEncryption=1 -rs=46 -D=2 + +Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_audio_prj_conf \ + -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=1 -testid=cap_acceptor_unicast \ + -RealEncryption=1 -rs=23 -D=2 + +# Simulation time should be larger than the WAIT_TIME in common.h +Execute ./bs_2G4_phy_v1 -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} \ + -D=2 -sim_length=60e6 $@ + +wait_for_background_jobs From 39fcf0218142bd0ae792d3fdb6d6afede5f649e0 Mon Sep 17 00:00:00 2001 From: Lucas Mathias Balling Date: Fri, 4 Oct 2024 13:01:29 +0200 Subject: [PATCH 1421/4482] Bluetooth: Controller: Implement Periodic Sync Procedure Adding PDU flow for Periodic Sync Indication Signed-off-by: Lucas Mathias Balling --- subsys/bluetooth/controller/CMakeLists.txt | 8 +- .../bluetooth/controller/Kconfig.ll_sw_split | 4 +- subsys/bluetooth/controller/include/ll_feat.h | 16 +- subsys/bluetooth/controller/ll_sw/lll_sync.h | 6 +- subsys/bluetooth/controller/ll_sw/pdu.h | 21 + subsys/bluetooth/controller/ll_sw/ull_llcp.c | 230 +++++++ subsys/bluetooth/controller/ll_sw/ull_llcp.h | 22 + .../bluetooth/controller/ll_sw/ull_llcp_cc.c | 8 - .../controller/ll_sw/ull_llcp_common.c | 12 + .../controller/ll_sw/ull_llcp_features.h | 5 + .../controller/ll_sw/ull_llcp_internal.h | 44 ++ .../controller/ll_sw/ull_llcp_local.c | 10 + .../controller/ll_sw/ull_llcp_past.c | 569 ++++++++++++++++++ .../bluetooth/controller/ll_sw/ull_llcp_pdu.c | 79 +++ .../bluetooth/controller/ll_sw/ull_llcp_phy.c | 5 +- .../controller/ll_sw/ull_llcp_remote.c | 14 + 16 files changed, 1038 insertions(+), 15 deletions(-) create mode 100644 subsys/bluetooth/controller/ll_sw/ull_llcp_past.c diff --git a/subsys/bluetooth/controller/CMakeLists.txt b/subsys/bluetooth/controller/CMakeLists.txt index c9dae548f794b..d5a990b52a05c 100644 --- a/subsys/bluetooth/controller/CMakeLists.txt +++ b/subsys/bluetooth/controller/CMakeLists.txt @@ -98,7 +98,13 @@ if(CONFIG_BT_CONN) ll_sw/ull_llcp_chmu.c ll_sw/ull_llcp_remote.c ) - zephyr_library_sources_ifdef( + if (CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER OR + CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) + zephyr_library_sources( + ll_sw/ull_llcp_past.c + ) + endif() + zephyr_library_sources_ifdef( CONFIG_BT_PERIPHERAL ll_sw/ull_peripheral.c ) diff --git a/subsys/bluetooth/controller/Kconfig.ll_sw_split b/subsys/bluetooth/controller/Kconfig.ll_sw_split index 9c326b35cf6f4..1970b4cd03676 100644 --- a/subsys/bluetooth/controller/Kconfig.ll_sw_split +++ b/subsys/bluetooth/controller/Kconfig.ll_sw_split @@ -48,6 +48,8 @@ config BT_LLL_VENDOR_NORDIC select BT_CTLR_CHAN_SEL_2_SUPPORT select BT_CTLR_MIN_USED_CHAN_SUPPORT select BT_CTLR_SCA_UPDATE_SUPPORT + select BT_CTLR_SYNC_TRANSFER_RECEIVER_SUPPORT + select BT_CTLR_SYNC_TRANSFER_SENDER_SUPPORT select BT_CTLR_DTM_HCI_SUPPORT select BT_CTLR_CONN_RSSI_SUPPORT @@ -61,7 +63,7 @@ config BT_LLL_VENDOR_NORDIC (BT_OBSERVER && BT_CTLR_ADV_EXT) select BT_TICKER_START_REMAINDER if BT_CTLR_CENTRAL_ISO select BT_TICKER_REMAINDER_GET if BT_BROADCASTER && BT_CTLR_ADV_EXT - select BT_TICKER_LAZY_GET if BT_CTLR_ADV_PERIODIC || BT_CTLR_CENTRAL_ISO + select BT_TICKER_LAZY_GET if BT_CTLR_ADV_PERIODIC || BT_CTLR_CENTRAL_ISO || BT_CTLR_SYNC_TRANSFER_SENDER select BT_TICKER_PREFER_START_BEFORE_STOP if BT_TICKER_SLOT_AGNOSTIC diff --git a/subsys/bluetooth/controller/include/ll_feat.h b/subsys/bluetooth/controller/include/ll_feat.h index 15e4eacd966d8..946441720769f 100644 --- a/subsys/bluetooth/controller/include/ll_feat.h +++ b/subsys/bluetooth/controller/include/ll_feat.h @@ -177,6 +177,18 @@ #define LL_FEAT_BIT_SCA_UPDATE 0 #endif /* !CONFIG_BT_CTLR_SCA_UPDATE */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) +#define LL_FEAT_BIT_SYNC_TRANSFER_SENDER BIT64(BT_LE_FEAT_BIT_PAST_SEND) +#else /* !CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ +#define LL_FEAT_BIT_SYNC_TRANSFER_SENDER 0 +#endif /* !CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ + +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) +#define LL_FEAT_BIT_SYNC_TRANSFER_RECEIVER BIT64(BT_LE_FEAT_BIT_PAST_RECV) +#else /* !CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ +#define LL_FEAT_BIT_SYNC_TRANSFER_RECEIVER 0 +#endif /* !CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ + #if defined(CONFIG_BT_CTLR_CENTRAL_ISO) #define LL_FEAT_BIT_CIS_CENTRAL BIT64(BT_LE_FEAT_BIT_CIS_CENTRAL) #else /* !CONFIG_BT_CTLR_CENTRAL_ISO */ @@ -282,7 +294,9 @@ LL_FEAT_BIT_CIS_PERIPHERAL | \ LL_FEAT_BIT_ISO_BROADCASTER | \ LL_FEAT_BIT_SYNC_RECEIVER | \ - LL_FEAT_BIT_PERIODIC_ADI_SUPPORT) + LL_FEAT_BIT_PERIODIC_ADI_SUPPORT | \ + LL_FEAT_BIT_SYNC_TRANSFER_RECEIVER | \ + LL_FEAT_BIT_SYNC_TRANSFER_SENDER) /* Connected Isochronous Stream (Host Support) bit is controlled by host */ #if defined(CONFIG_BT_CTLR_CONN_ISO) diff --git a/subsys/bluetooth/controller/ll_sw/lll_sync.h b/subsys/bluetooth/controller/ll_sw/lll_sync.h index 595c85396f097..0bce7bd2260ff 100644 --- a/subsys/bluetooth/controller/ll_sw/lll_sync.h +++ b/subsys/bluetooth/controller/ll_sw/lll_sync.h @@ -29,9 +29,11 @@ struct lll_sync { uint8_t is_aux_sched:1; uint8_t forced:1; -#if defined(CONFIG_BT_CTLR_SYNC_ISO) +#if defined(CONFIG_BT_CTLR_SYNC_ISO) || \ + defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) || \ + defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) uint8_t sca:3; -#endif /* CONFIG_BT_CTLR_SYNC_ISO */ +#endif /* CONFIG_BT_CTLR_SYNC_ISO || CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER/SENDER */ #if defined(CONFIG_BT_CTLR_SCAN_AUX_SYNC_RESERVE_MIN) /* Counter used by LLL abort of event when in unreserved time space to diff --git a/subsys/bluetooth/controller/ll_sw/pdu.h b/subsys/bluetooth/controller/ll_sw/pdu.h index 18ae111d8ae27..9457511977357 100644 --- a/subsys/bluetooth/controller/ll_sw/pdu.h +++ b/subsys/bluetooth/controller/ll_sw/pdu.h @@ -614,6 +614,7 @@ enum pdu_data_llctrl_type { PDU_DATA_LLCTRL_TYPE_MIN_USED_CHAN_IND = 0x19, PDU_DATA_LLCTRL_TYPE_CTE_REQ = 0x1A, PDU_DATA_LLCTRL_TYPE_CTE_RSP = 0x1B, + PDU_DATA_LLCTRL_TYPE_PERIODIC_SYNC_IND = 0x1C, PDU_DATA_LLCTRL_TYPE_CLOCK_ACCURACY_REQ = 0x1D, PDU_DATA_LLCTRL_TYPE_CLOCK_ACCURACY_RSP = 0x1E, PDU_DATA_LLCTRL_TYPE_CIS_REQ = 0x1F, @@ -888,6 +889,25 @@ struct pdu_data_llctrl_cis_terminate_ind { uint8_t error_code; } __packed; +struct pdu_data_llctrl_periodic_sync_ind { + uint16_t id; + struct pdu_adv_sync_info sync_info; + uint16_t conn_event_count; + uint16_t last_pa_event_counter; +#ifdef CONFIG_LITTLE_ENDIAN + uint8_t sid:4; + uint8_t addr_type:1; + uint8_t sca:3; +#else + uint8_t sca:3; + uint8_t addr_type:1; + uint8_t sid:4; +#endif /* CONFIG_LITTLE_ENDIAN */ + uint8_t phy; + uint8_t adv_addr[6]; + uint16_t sync_conn_event_count; +} __packed; + struct pdu_data_llctrl { uint8_t opcode; union { @@ -925,6 +945,7 @@ struct pdu_data_llctrl { struct pdu_data_llctrl_cis_rsp cis_rsp; struct pdu_data_llctrl_cis_ind cis_ind; struct pdu_data_llctrl_cis_terminate_ind cis_terminate_ind; + struct pdu_data_llctrl_periodic_sync_ind periodic_sync_ind; } __packed; } __packed; diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp.c b/subsys/bluetooth/controller/ll_sw/ull_llcp.c index d194e2c75c76f..1540f043cb301 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp.c @@ -18,6 +18,7 @@ #include "util/mem.h" #include "util/memq.h" #include "util/dbuf.h" +#include "util/mayfly.h" #include "pdu_df.h" #include "lll/pdu_vendor.h" @@ -32,11 +33,21 @@ #include "lll/lll_df_types.h" #include "lll_conn.h" #include "lll_conn_iso.h" +#include "lll_sync.h" +#include "lll_sync_iso.h" +#include "lll_scan.h" +#include "lll/lll_adv_types.h" +#include "lll_adv.h" +#include "lll/lll_adv_pdu.h" #include "ull_tx_queue.h" #include "isoal.h" #include "ull_iso_types.h" +#include "ull_sync_types.h" +#include "ull_scan_types.h" +#include "ull_adv_types.h" +#include "ull_adv_internal.h" #include "ull_conn_iso_types.h" #include "ull_conn_iso_internal.h" #include "ull_central_iso_internal.h" @@ -48,6 +59,9 @@ #include "ull_llcp_features.h" #include "ull_llcp_internal.h" #include "ull_peripheral_internal.h" +#include "ull_sync_internal.h" + +#include "ull_filter.h" #include #include "hal/debug.h" @@ -56,6 +70,7 @@ #define PROC_CTX_BUF_SIZE WB_UP(sizeof(struct proc_ctx)) #define TX_CTRL_BUF_SIZE WB_UP(offsetof(struct node_tx, pdu) + LLCTRL_PDU_SIZE) #define NTF_BUF_SIZE WB_UP(offsetof(struct node_rx_pdu, pdu) + LLCTRL_PDU_SIZE) +#define OFFSET_BASE_MAX_VALUE 0x1FFF /* LLCP Allocations */ #if defined(LLCP_TX_CTRL_BUF_QUEUE_ENABLE) @@ -1019,6 +1034,114 @@ uint8_t ull_cp_conn_update(struct ll_conn *conn, uint16_t interval_min, uint16_t return BT_HCI_ERR_SUCCESS; } +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) +uint8_t ull_cp_periodic_sync(struct ll_conn *conn, struct ll_sync_set *sync, + struct ll_adv_sync_set *adv_sync, uint16_t service_data) +{ + struct pdu_adv_sync_info *si; + struct proc_ctx *ctx; + uint8_t *access_addr; + const uint8_t *adva; + uint16_t interval; + uint8_t *chan_map; + uint8_t *crc_init; + uint8_t addr_type; + uint8_t si_sca; + uint8_t sid; + uint8_t phy; + + /* Exactly one of the sync and adv_sync pointers should be non-null */ + LL_ASSERT((!adv_sync && sync) || (adv_sync && !sync)); + + if (!feature_peer_periodic_sync_recv(conn)) { + return BT_HCI_ERR_UNSUPP_REMOTE_FEATURE; + } + + ctx = llcp_create_local_procedure(PROC_PERIODIC_SYNC); + if (!ctx) { + return BT_HCI_ERR_CMD_DISALLOWED; + } + + if (sync) { + chan_map = sync->lll.chm[sync->lll.chm_first].data_chan_map; + si_sca = sync->lll.sca; + access_addr = sync->lll.access_addr; + crc_init = sync->lll.crc_init; + sid = sync->sid; + phy = sync->lll.phy; + interval = sync->interval; + + addr_type = sync->peer_id_addr_type; + if (sync->peer_addr_resolved) { + uint8_t rl_idx; + + /* peer_id_addr contains the identity address; Get the peers RPA */ + + rl_idx = ull_filter_rl_find(addr_type, sync->peer_id_addr, NULL); + + /* A resolved address must be present in the resolve list */ + LL_ASSERT(rl_idx < ll_rl_size_get()); + + /* Generate RPAs if required */ + ull_filter_rpa_update(false); + + /* Note: Since we need the peers RPA, use tgta_get */ + adva = ull_filter_tgta_get(rl_idx); + } else { + adva = sync->peer_id_addr; + } + } else { + struct ll_adv_set *adv; + struct pdu_adv *adv_pdu; + + chan_map = adv_sync->lll.chm[adv_sync->lll.chm_first].data_chan_map; + si_sca = lll_clock_sca_local_get(); + access_addr = adv_sync->lll.access_addr; + crc_init = adv_sync->lll.crc_init; + phy = adv_sync->lll.adv->phy_s; + interval = adv_sync->interval; + + adv = HDR_LLL2ULL(adv_sync->lll.adv); + sid = adv->sid; + + /* Pull AdvA from pdu */ + adv_pdu = lll_adv_sync_data_curr_get(&adv_sync->lll); + addr_type = adv_pdu->tx_addr; + /* Note: AdvA is mandatory for AUX_SYNC_IND and at the start of the ext. header */ + adva = adv_pdu->adv_ext_ind.ext_hdr.data; + } + + /* Store parameters in corresponding procedure context */ + ctx->data.periodic_sync.sync_handle = sync ? ull_sync_handle_get(sync) : + BT_HCI_SYNC_HANDLE_INVALID; + ctx->data.periodic_sync.adv_handle = adv_sync ? ull_adv_sync_handle_get(adv_sync) : + BT_HCI_ADV_HANDLE_INVALID; + ctx->data.periodic_sync.id = service_data; + ctx->data.periodic_sync.sca = lll_clock_sca_local_get(); + + si = &ctx->data.periodic_sync.sync_info; + si->interval = sys_cpu_to_le16(interval); + (void)memcpy(si->sca_chm, chan_map, sizeof(ctx->data.periodic_sync.sync_info.sca_chm)); + si->sca_chm[PDU_SYNC_INFO_SCA_CHM_SCA_BYTE_OFFSET] &= ~PDU_SYNC_INFO_SCA_CHM_SCA_BIT_MASK; + si->sca_chm[PDU_SYNC_INFO_SCA_CHM_SCA_BYTE_OFFSET] |= ((si_sca << + PDU_SYNC_INFO_SCA_CHM_SCA_BIT_POS) & + PDU_SYNC_INFO_SCA_CHM_SCA_BIT_MASK); + (void)memcpy(si->aa, access_addr, sizeof(si->aa)); + (void)memcpy(si->crc_init, crc_init, sizeof(si->crc_init)); + + ctx->data.periodic_sync.addr_type = addr_type; + (void)memcpy(ctx->data.periodic_sync.adv_addr, adva, BDADDR_SIZE); + ctx->data.periodic_sync.sid = sid; + ctx->data.periodic_sync.phy = phy; + + /* All timing sensitive parameters will be determined and filled when Tx PDU is enqueued. */ + + llcp_lr_enqueue(conn, ctx); + + return BT_HCI_ERR_SUCCESS; +} +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ + #if defined(CONFIG_BT_CTLR_DATA_LENGTH) uint8_t ull_cp_remote_dle_pending(struct ll_conn *conn) { @@ -1169,6 +1292,7 @@ void ull_cp_cte_req_set_disable(struct ll_conn *conn) } #endif /* CONFIG_BT_CTLR_DF_CONN_CTE_REQ */ +#if defined(CONFIG_BT_CTLR_CENTRAL_ISO) void ull_cp_cc_offset_calc_reply(struct ll_conn *conn, uint32_t cis_offset_min, uint32_t cis_offset_max) { @@ -1182,6 +1306,7 @@ void ull_cp_cc_offset_calc_reply(struct ll_conn *conn, uint32_t cis_offset_min, llcp_lp_cc_offset_calc_reply(conn, ctx); } } +#endif /* CONFIG_BT_CTLR_CENTRAL_ISO */ #if defined(CONFIG_BT_PERIPHERAL) && defined(CONFIG_BT_CTLR_PERIPHERAL_ISO) bool ull_cp_cc_awaiting_reply(struct ll_conn *conn) @@ -1322,6 +1447,93 @@ bool ull_lp_cc_is_enqueued(struct ll_conn *conn) } #endif /* defined(CONFIG_BT_CENTRAL) && defined(CONFIG_BT_CTLR_CENTRAL_ISO) */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) +void ull_lp_past_offset_get_calc_params(struct ll_conn *conn, + uint8_t *adv_sync_handle, uint16_t *sync_handle) +{ + const struct proc_ctx *ctx; + + ctx = llcp_lr_peek_proc(conn, PROC_PERIODIC_SYNC); + + if (ctx) { + *adv_sync_handle = ctx->data.periodic_sync.adv_handle; + *sync_handle = ctx->data.periodic_sync.sync_handle; + } else { + *adv_sync_handle = BT_HCI_ADV_HANDLE_INVALID; + *sync_handle = BT_HCI_SYNC_HANDLE_INVALID; + } +} + +void ull_lp_past_offset_calc_reply(struct ll_conn *conn, uint32_t offset_us, + uint16_t pa_event_counter, uint16_t last_pa_event_counter) +{ + struct proc_ctx *ctx; + uint16_t conn_event_offset = 0; + + ctx = llcp_lr_peek_proc(conn, PROC_PERIODIC_SYNC); + + if (ctx) { + /* Check if the offset_us will fit within the sync_info offset fields */ + uint32_t max_offset = OFFS_ADJUST_US + OFFSET_BASE_MAX_VALUE * OFFS_UNIT_300_US; + + if (offset_us > max_offset) { + /* The offset_us is larger than what the sync_info offset fields can hold, + * therefore it needs to be compensated with a change in the + * connection event count - conn_event_count + */ + uint32_t conn_interval_us = conn->lll.interval * CONN_INT_UNIT_US; + + conn_event_offset = DIV_ROUND_UP(offset_us - max_offset, conn_interval_us); + + /* Update offset_us */ + offset_us = offset_us - (conn_event_offset * conn_interval_us); + + ctx->data.periodic_sync.conn_event_count = ull_conn_event_counter(conn) + + conn_event_offset; + } + + llcp_pdu_fill_sync_info_offset(&ctx->data.periodic_sync.sync_info, offset_us); +#if defined(CONFIG_BT_PERIPHERAL) + /* Save the result for later use */ + ctx->data.periodic_sync.offset_us = offset_us; +#endif /* CONFIG_BT_PERIPHERAL */ + + ctx->data.periodic_sync.sync_conn_event_count = ull_conn_event_counter(conn); + ctx->data.periodic_sync.conn_event_count = ull_conn_event_counter(conn) + + conn_event_offset; + + ctx->data.periodic_sync.sync_info.evt_cntr = pa_event_counter; + + ctx->data.periodic_sync.last_pa_event_counter = last_pa_event_counter; + + llcp_lp_past_offset_calc_reply(conn, ctx); + } +} + +void ull_lp_past_conn_evt_done(struct ll_conn *conn, struct node_rx_event_done *done) +{ + struct proc_ctx *ctx; + + ctx = llcp_lr_peek_proc(conn, PROC_PERIODIC_SYNC); + if (ctx) { +#if defined(CONFIG_BT_PERIPHERAL) + if (conn->lll.role == BT_HCI_ROLE_PERIPHERAL && done->extra.trx_cnt) { + uint32_t start_to_actual_us; + + start_to_actual_us = isoal_get_wrapped_time_us( + done->extra.drift.start_to_address_actual_us, + (-done->extra.drift.preamble_to_addr_us)); + + ctx->data.periodic_sync.conn_start_to_actual_us = start_to_actual_us; + } +#endif /* CONFIG_BT_PERIPHERAL */ + + ctx->data.periodic_sync.conn_evt_trx = done->extra.trx_cnt; + llcp_lp_past_conn_evt_done(conn, ctx); + } +} +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ + static bool pdu_is_expected(struct pdu_data *pdu, struct proc_ctx *ctx) { return (ctx->rx_opcode == pdu->llctrl.opcode || ctx->rx_greedy); @@ -1543,6 +1755,13 @@ static bool pdu_validate_clock_accuracy_rsp(struct pdu_data *pdu) return VALIDATE_PDU_LEN(pdu, clock_accuracy_rsp); } +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) +static bool pdu_validate_periodic_sync_ind(struct pdu_data *pdu) +{ + return VALIDATE_PDU_LEN(pdu, periodic_sync_ind); +} +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ + typedef bool (*pdu_param_validate_t)(struct pdu_data *pdu); struct pdu_validate { @@ -1615,6 +1834,9 @@ static const struct pdu_validate pdu_validate[] = { [PDU_DATA_LLCTRL_TYPE_CLOCK_ACCURACY_REQ] = { pdu_validate_clock_accuracy_req }, #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ [PDU_DATA_LLCTRL_TYPE_CLOCK_ACCURACY_RSP] = { pdu_validate_clock_accuracy_rsp }, +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) + [PDU_DATA_LLCTRL_TYPE_PERIODIC_SYNC_IND] = { pdu_validate_periodic_sync_ind }, +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ }; static bool pdu_is_valid(struct pdu_data *pdu) @@ -1840,3 +2062,11 @@ struct proc_ctx *llcp_create_procedure(enum llcp_proc proc) return create_procedure(proc, &mem_local_ctx); } #endif + +bool phy_valid(uint8_t phy) +{ + /* This is equivalent to: + * exactly one bit set, and no bit set is rfu's + */ + return (phy == PHY_1M || phy == PHY_2M || phy == PHY_CODED); +} diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp.h b/subsys/bluetooth/controller/ll_sw/ull_llcp.h index d9b32dd5a992a..675b0119759ac 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp.h +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp.h @@ -274,3 +274,25 @@ void ull_cp_cte_rsp_enable(struct ll_conn *conn, bool enable, uint8_t max_cte_le */ uint8_t ull_cp_req_peer_sca(struct ll_conn *conn); #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ + +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) +struct ll_adv_sync_set; +struct ll_sync_set; + +/** + * @brief Initiate a Periodic Advertising Sync Transfer Procedure. + */ +uint8_t ull_cp_periodic_sync(struct ll_conn *conn, struct ll_sync_set *sync, + struct ll_adv_sync_set *adv_sync, uint16_t service_data); + +void ull_lp_past_offset_get_calc_params(struct ll_conn *conn, + uint8_t *adv_sync_handle, uint16_t *sync_handle); +void ull_lp_past_offset_calc_reply(struct ll_conn *conn, uint32_t offset_us, + uint16_t pa_event_counter, uint16_t last_pa_event_counter); +void ull_lp_past_conn_evt_done(struct ll_conn *conn, struct node_rx_event_done *done); +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ + +/** + * @brief Validation of PHY, checking if exactly one bit set, and no bit set is rfu's + */ +bool phy_valid(uint8_t phy); diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_cc.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_cc.c index a0f9b057a1064..92e66dd8e35f1 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_cc.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_cc.c @@ -299,14 +299,6 @@ static void rp_cc_state_idle(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t } } -static inline bool phy_valid(uint8_t phy) -{ - /* This is equivalent to: - * exactly one bit set, and no bit set is rfu's - */ - return (phy == PHY_1M || phy == PHY_2M || phy == PHY_CODED); -} - static uint8_t rp_cc_check_phy(struct ll_conn *conn, struct proc_ctx *ctx, struct pdu_data *pdu) { diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_common.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_common.c index 2931b116542a5..b0e28e124bdc1 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_common.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_common.c @@ -18,6 +18,7 @@ #include "util/mem.h" #include "util/memq.h" #include "util/dbuf.h" +#include "util/mayfly.h" #include "pdu_df.h" #include "lll/pdu_vendor.h" @@ -31,12 +32,22 @@ #include "lll/lll_df_types.h" #include "lll_conn.h" #include "lll_conn_iso.h" +#include "lll_sync.h" +#include "lll_sync_iso.h" +#include "lll_scan.h" +#include "lll/lll_adv_types.h" +#include "lll_adv.h" +#include "lll/lll_adv_pdu.h" #include "ull_tx_queue.h" #include "isoal.h" #include "ull_iso_types.h" #include "ull_conn_iso_types.h" +#include "ull_sync_types.h" +#include "ull_scan_types.h" +#include "ull_adv_types.h" +#include "ull_adv_internal.h" #include "ull_iso_internal.h" #include "ull_conn_iso_internal.h" #include "ull_peripheral_iso_internal.h" @@ -46,6 +57,7 @@ #include "ull_llcp.h" #include "ull_conn_internal.h" #include "ull_internal.h" +#include "ull_sync_internal.h" #include "ull_llcp_features.h" #include "ull_llcp_internal.h" diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_features.h b/subsys/bluetooth/controller/ll_sw/ull_llcp_features.h index 75d92d5524ef7..c06d4978f2c65 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_features.h +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_features.h @@ -184,6 +184,11 @@ static inline bool feature_iso_peripheral(struct ll_conn *conn) return LL_FEAT_BIT_CIS_PERIPHERAL != 0; } +static inline bool feature_peer_periodic_sync_recv(struct ll_conn *conn) +{ + return (conn->llcp.fex.features_peer & BIT64(BT_LE_FEAT_BIT_PAST_RECV)) != 0; +} + /* * The following features are not yet defined in KConfig and do * not have a bitfield defined in ll_feat.h diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_internal.h b/subsys/bluetooth/controller/ll_sw/ull_llcp_internal.h index 5744f9c57232e..446d78aeadb73 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_internal.h +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_internal.h @@ -29,6 +29,7 @@ enum llcp_proc { PROC_CIS_CREATE, PROC_CIS_TERMINATE, PROC_SCA_UPDATE, + PROC_PERIODIC_SYNC, /* A helper enum entry, to use in pause procedure context */ PROC_NONE = 0x0, }; @@ -317,6 +318,31 @@ struct proc_ctx { uint8_t error_code; } sca_update; #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ + +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) || defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) + struct { + struct pdu_adv_sync_info sync_info; +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) && defined(CONFIG_BT_PERIPHERAL) + uint32_t conn_start_to_actual_us; + uint32_t offset_us; +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER && CONFIG_BT_PERIPHERAL */ + uint16_t id; + uint16_t sync_conn_event_count; + uint16_t sync_handle; + uint16_t conn_event_count; + uint16_t last_pa_event_counter; + uint8_t adv_handle; + uint8_t adv_addr[6]; + uint8_t sid; + uint8_t addr_type:1; + uint8_t addr_resolved:1; + uint8_t sca; + uint8_t phy; +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) + uint8_t conn_evt_trx; +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ + } periodic_sync; +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER || CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ } data; struct { @@ -768,6 +794,24 @@ void llcp_pdu_encode_cis_req(struct proc_ctx *ctx, struct pdu_data *pdu); void llcp_pdu_encode_cis_ind(struct proc_ctx *ctx, struct pdu_data *pdu); void llcp_pdu_decode_cis_rsp(struct proc_ctx *ctx, struct pdu_data *pdu); + +/* + * Periodic Advertising Sync Transfers Procedure Helper + */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) +void llcp_pdu_fill_sync_info_offset(struct pdu_adv_sync_info *si, uint32_t offset_us); +void llcp_pdu_encode_periodic_sync_ind(struct proc_ctx *ctx, struct pdu_data *pdu); +void llcp_lp_past_run(struct ll_conn *conn, struct proc_ctx *ctx, void *param); +void llcp_lp_past_tx_ack(struct ll_conn *conn, struct proc_ctx *ctx, struct node_tx *tx); +void llcp_lp_past_conn_evt_done(struct ll_conn *conn, struct proc_ctx *ctx); +void llcp_lp_past_offset_calc_reply(struct ll_conn *conn, struct proc_ctx *ctx); +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) +void llcp_pdu_decode_periodic_sync_ind(struct proc_ctx *ctx, struct pdu_data *pdu); +void llcp_rp_past_run(struct ll_conn *conn, struct proc_ctx *ctx, void *param); +void llcp_rp_past_rx(struct ll_conn *conn, struct proc_ctx *ctx, struct node_rx_pdu *rx); +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ + #ifdef ZTEST_UNITTEST bool llcp_lr_is_disconnected(struct ll_conn *conn); bool llcp_lr_is_idle(struct ll_conn *conn); diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_local.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_local.c index 6307b50e3326d..8c97bcdfb5f7d 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_local.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_local.c @@ -364,6 +364,11 @@ void llcp_lr_tx_ack(struct ll_conn *conn, struct proc_ctx *ctx, struct node_tx * llcp_lp_comm_tx_ack(conn, ctx, tx); break; #endif /* defined(CONFIG_BT_CTLR_CENTRAL_ISO) || defined(CONFIG_BT_CTLR_PERIPHERAL_ISO) */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) + case PROC_PERIODIC_SYNC: + llcp_lp_past_tx_ack(conn, ctx, tx); + break; +#endif /* defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) */ default: break; /* Ignore tx_ack */ @@ -463,6 +468,11 @@ static void lr_act_run(struct ll_conn *conn) llcp_lp_comm_run(conn, ctx, NULL); break; #endif /* CONFIG_BT_CTLR_DF_CONN_CTE_REQ */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) + case PROC_PERIODIC_SYNC: + llcp_lp_past_run(conn, ctx, NULL); + break; +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ default: /* Unknown procedure */ LL_ASSERT(0); diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_past.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_past.c new file mode 100644 index 0000000000000..a1d3887d115ec --- /dev/null +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_past.c @@ -0,0 +1,569 @@ +/* + * Copyright (c) 2024 Demant A/S + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include + +#include "hal/ccm.h" +#include "hal/debug.h" + +#include "util/memq.h" +#include "util/util.h" + +#include "pdu_df.h" +#include "lll/pdu_vendor.h" +#include "pdu.h" +#include "lll.h" +#include "lll_conn.h" +#include "lll_filter.h" +#include "ull_tx_queue.h" +#include "ull_conn_types.h" +#include "ull_llcp_internal.h" +#include "isoal.h" +#include "ull_iso_types.h" +#include "lll_conn_iso.h" +#include "ull_conn_iso_types.h" +#include "lll_sync.h" +#include "lll_sync_iso.h" +#include "ull_sync_types.h" +#include "lll_scan.h" +#include "ull_scan_types.h" +#include "ull_llcp.h" +#include "ull_internal.h" +#include "ull_conn_internal.h" +#include "ull_sync_internal.h" + +#include "ll_settings.h" +#include "ll_feat.h" +#include "ull_llcp_features.h" + + +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) +/* LLCP Remote Procedure FSM states */ +enum { + RP_PAST_STATE_IDLE, + RP_PAST_STATE_WAIT_RX, + RP_PAST_STATE_WAIT_NEXT_EVT, +#if defined(CONFIG_BT_CTLR_SW_DEFERRED_PRIVACY) + RP_PAST_STATE_WAIT_RESOLVE_INTERFACE_AVAIL, + RP_PAST_STATE_WAIT_RESOLVE_COMPLETE, +#endif /* CONFIG_BT_CTLR_SW_DEFERRED_PRIVACY */ +}; + +/* LLCP Remote Procedure PAST (receiver) FSM events */ +enum { + /* Procedure run */ + RP_PAST_EVT_RUN, + + /* IND received */ + RP_PAST_EVT_RX, + + /* RPA resolve completed */ + RP_PAST_EVT_RESOLVED, +}; + +#if defined(CONFIG_BT_CTLR_SW_DEFERRED_PRIVACY) +/* Active connection for RPA resolve */ +static struct ll_conn *rp_past_resolve_conn; +#endif /* CONFIG_BT_CTLR_SW_DEFERRED_PRIVACY */ + +static uint8_t rp_check_phy(struct ll_conn *conn, struct proc_ctx *ctx, + struct pdu_data *pdu) +{ + if (!phy_valid(pdu->llctrl.periodic_sync_ind.phy)) { + /* zero, more than one or any rfu bit selected in either phy */ + return BT_HCI_ERR_UNSUPP_FEATURE_PARAM_VAL; + } + +#if defined(CONFIG_BT_CTLR_PHY) + const uint8_t phy = pdu->llctrl.periodic_sync_ind.phy; + + if (((phy & PHY_2M) && !IS_ENABLED(CONFIG_BT_CTLR_PHY_2M)) || + ((phy & PHY_CODED) && !IS_ENABLED(CONFIG_BT_CTLR_PHY_CODED))) { + /* Unsupported phy selected */ + return BT_HCI_ERR_UNSUPP_FEATURE_PARAM_VAL; + } +#endif /* CONFIG_BT_CTLR_PHY */ + + return BT_HCI_ERR_SUCCESS; +} + +static void rp_past_complete(struct ll_conn *conn, struct proc_ctx *ctx) +{ + llcp_rr_complete(conn); + ctx->state = RP_PAST_STATE_IDLE; +} + +static void rp_past_st_idle(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param) +{ + switch (evt) { + case RP_PAST_EVT_RUN: + ctx->state = RP_PAST_STATE_WAIT_RX; + break; + default: + /* Ignore other evts */ + break; + } +} + +#if defined(CONFIG_BT_CTLR_SW_DEFERRED_PRIVACY) +static void rp_past_resolve_cb(void *param) +{ + uint8_t rl_idx = (uint8_t)(uint32_t)param; + struct ll_conn *conn = rp_past_resolve_conn; + struct proc_ctx *ctx; + uint8_t id_addr_type; + + /* Release resolving interface */ + rp_past_resolve_conn = NULL; + + ctx = llcp_rr_peek(conn); + if (!ctx) { + /* No context - possibly due to connection termination or + * other cause of procedure completion. + */ + return; + } + + if (ctx->state != RP_PAST_STATE_WAIT_RESOLVE_COMPLETE) { + /* Wrong state - possibly due to connection termination or + * other cause of procedure completion. + */ + return; + } + + /* If resolve failed then just continue in next event using the RPA */ + if (rl_idx != FILTER_IDX_NONE) { + const bt_addr_t *id_addr; + + id_addr = ull_filter_lll_id_addr_get(rl_idx, &id_addr_type); + if (id_addr) { + memcpy(&ctx->data.periodic_sync.adv_addr, &id_addr->val, sizeof(bt_addr_t)); + + ctx->data.periodic_sync.addr_type = id_addr_type; + ctx->data.periodic_sync.addr_resolved = 1U; + } + } + + /* Let sync creation continue in next event */ + ctx->state = RP_PAST_STATE_WAIT_NEXT_EVT; +} + +static bool rp_past_addr_resolve(struct ll_conn *conn, struct proc_ctx *ctx) +{ + bt_addr_t adv_addr; + + if (rp_past_resolve_conn) { + /* Resolve interface busy */ + return false; + } + + (void)memcpy(&adv_addr.val, ctx->data.periodic_sync.adv_addr, sizeof(bt_addr_t)); + rp_past_resolve_conn = conn; + + if (ull_filter_deferred_resolve(&adv_addr, rp_past_resolve_cb)) { + /* Resolve initiated - wait for callback */ + return true; + } + + /* Resolve interface busy (in ull_filter) */ + rp_past_resolve_conn = NULL; + return false; +} + +static void rp_past_st_wait_resolve_if(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, + void *param) +{ + switch (evt) { + case RP_PAST_EVT_RUN: + if (rp_past_addr_resolve(conn, ctx)) { + ctx->state = RP_PAST_STATE_WAIT_RESOLVE_COMPLETE; + } + break; + default: + /* Ignore other evts */ + break; + } +} +#endif /* CONFIG_BT_CTLR_SW_DEFERRED_PRIVACY */ + +static void rp_past_st_wait_rx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, + void *param) +{ + struct pdu_data *pdu = (struct pdu_data *)param; + + switch (evt) { + case RP_PAST_EVT_RX: + llcp_pdu_decode_periodic_sync_ind(ctx, pdu); + + /* Check PHY */ + if (rp_check_phy(conn, ctx, pdu) != BT_HCI_ERR_SUCCESS) { + /* Invalid PHY - ignore and silently complete */ + rp_past_complete(conn, ctx); + return; + } + + ctx->data.periodic_sync.addr_resolved = 0U; + + if (ctx->data.periodic_sync.addr_type == BT_ADDR_LE_RANDOM) { + /* TODO: For efficiency, check if address resolve is needed */ +#if defined(CONFIG_BT_CTLR_SW_DEFERRED_PRIVACY) + if (ull_filter_lll_rl_enabled()) { + if (rp_past_addr_resolve(conn, ctx)) { + ctx->state = RP_PAST_STATE_WAIT_RESOLVE_COMPLETE; + return; + } + ctx->state = RP_PAST_STATE_WAIT_RESOLVE_INTERFACE_AVAIL; + return; + } +#else + /* TODO: Not implemented - use RPA */ +#endif /* CONFIG_BT_CTLR_SW_DEFERRED_PRIVACY */ + } + + if (IS_ENABLED(CONFIG_BT_PERIPHERAL)) { + /* If sync_conn_event_count is this connection event, + * we have to wait for drift correction for this event to be applied - + * continue processing in the next conn event + */ + if (conn->lll.role == BT_HCI_ROLE_PERIPHERAL && + ctx->data.periodic_sync.sync_conn_event_count == + ull_conn_event_counter(conn)) { + ctx->state = RP_PAST_STATE_WAIT_NEXT_EVT; + return; + } + } + + /* Hand over to ULL */ + ull_sync_transfer_received(conn, + ctx->data.periodic_sync.id, + &ctx->data.periodic_sync.sync_info, + ctx->data.periodic_sync.conn_event_count, + ctx->data.periodic_sync.last_pa_event_counter, + ctx->data.periodic_sync.sid, + ctx->data.periodic_sync.addr_type, + ctx->data.periodic_sync.sca, + ctx->data.periodic_sync.phy, + ctx->data.periodic_sync.adv_addr, + ctx->data.periodic_sync.sync_conn_event_count, + ctx->data.periodic_sync.addr_resolved); + rp_past_complete(conn, ctx); + break; + default: + /* Ignore other evts */ + break; + } +} + +static void rp_past_st_wait_next_evt(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, + void *param) +{ + switch (evt) { + case RP_PAST_EVT_RUN: +#if defined(CONFIG_BT_PERIPHERAL) + /* If sync_conn_event_count is this connection event, + * we have to wait for drift correction for this event to be applied - + * continue processing in the next conn event + */ + if (conn->lll.role == BT_HCI_ROLE_PERIPHERAL && + ctx->data.periodic_sync.sync_conn_event_count == ull_conn_event_counter(conn)) { + return; + } +#endif /* CONFIG_BT_PERIPHERAL */ + + /* Hand over to ULL */ + ull_sync_transfer_received(conn, + ctx->data.periodic_sync.id, + &ctx->data.periodic_sync.sync_info, + ctx->data.periodic_sync.conn_event_count, + ctx->data.periodic_sync.last_pa_event_counter, + ctx->data.periodic_sync.sid, + ctx->data.periodic_sync.addr_type, + ctx->data.periodic_sync.sca, + ctx->data.periodic_sync.phy, + ctx->data.periodic_sync.adv_addr, + ctx->data.periodic_sync.sync_conn_event_count, + ctx->data.periodic_sync.addr_resolved); + rp_past_complete(conn, ctx); + break; + default: + /* Ignore other evts */ + break; + } +} + +static void rp_past_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, + void *param) +{ + switch (ctx->state) { + case RP_PAST_STATE_IDLE: + rp_past_st_idle(conn, ctx, evt, param); + break; + case RP_PAST_STATE_WAIT_RX: + rp_past_st_wait_rx(conn, ctx, evt, param); + break; + case RP_PAST_STATE_WAIT_NEXT_EVT: + rp_past_st_wait_next_evt(conn, ctx, evt, param); + break; +#if defined(CONFIG_BT_CTLR_SW_DEFERRED_PRIVACY) + case RP_PAST_STATE_WAIT_RESOLVE_INTERFACE_AVAIL: + rp_past_st_wait_resolve_if(conn, ctx, evt, param); + break; + case RP_PAST_STATE_WAIT_RESOLVE_COMPLETE: + /* Waiting for callback - do nothing */ + break; +#endif /* CONFIG_BT_CTLR_SW_DEFERRED_PRIVACY */ + default: + /* Unknown state */ + LL_ASSERT(0); + break; + } +} + +void llcp_rp_past_rx(struct ll_conn *conn, struct proc_ctx *ctx, struct node_rx_pdu *rx) +{ + rp_past_execute_fsm(conn, ctx, RP_PAST_EVT_RX, rx->pdu); +} + +void llcp_rp_past_run(struct ll_conn *conn, struct proc_ctx *ctx, void *param) +{ + rp_past_execute_fsm(conn, ctx, RP_PAST_EVT_RUN, param); +} + +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ + +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) +/* LLCP Local Procedure FSM states */ +enum { + LP_PAST_STATE_IDLE, + LP_PAST_STATE_WAIT_TX_REQ, + LP_PAST_STATE_WAIT_OFFSET_CALC, + LP_PAST_STATE_WAIT_TX_ACK, + LP_PAST_STATE_WAIT_EVT_DONE, +}; + +/* LLCP Local Procedure PAST (sender) FSM events */ +enum { + /* Procedure run */ + LP_PAST_EVT_RUN, + + /* Offset calculation reply received */ + LP_PAST_EVT_OFFSET_CALC_REPLY, + + /* RX received in connection event */ + LP_PAST_EVT_RX_RECEIVED, + + /* RX not received in connection event */ + LP_PAST_EVT_NO_RX_RECEIVED, + + /* Ack received */ + LP_PAST_EVT_ACK, +}; + +static void lp_past_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, + void *param); + +static void lp_past_complete(struct ll_conn *conn, struct proc_ctx *ctx) +{ + llcp_lr_complete(conn); + ctx->state = LP_PAST_STATE_IDLE; +} + +static void lp_past_tx(struct ll_conn *conn, struct proc_ctx *ctx) +{ + struct node_tx *tx; + struct pdu_data *pdu; + + if (IS_ENABLED(CONFIG_BT_PERIPHERAL)) { + if (conn->lll.role == BT_HCI_ROLE_PERIPHERAL) { + uint32_t offset_us; + + /* Correct offset can be calculated now that we know the event start time */ + offset_us = ctx->data.periodic_sync.offset_us - + ctx->data.periodic_sync.conn_start_to_actual_us; + + llcp_pdu_fill_sync_info_offset(&ctx->data.periodic_sync.sync_info, + offset_us); + } + } + + /* Allocate tx node */ + tx = llcp_tx_alloc(conn, ctx); + LL_ASSERT(tx); + + pdu = (struct pdu_data *)tx->pdu; + + /* Encode LL Control PDU */ + llcp_pdu_encode_periodic_sync_ind(ctx, pdu); + + /* Enqueue LL Control PDU towards LLL */ + llcp_tx_enqueue(conn, tx); + + /* Wait for TX Ack */ + ctx->state = LP_PAST_STATE_WAIT_TX_ACK; + ctx->node_ref.tx_ack = tx; +} + +void llcp_lp_past_offset_calc_reply(struct ll_conn *conn, struct proc_ctx *ctx) +{ + lp_past_execute_fsm(conn, ctx, LP_PAST_EVT_OFFSET_CALC_REPLY, NULL); +} + +static void lp_past_offset_calc_req(struct ll_conn *conn, struct proc_ctx *ctx, + uint8_t evt, void *param) +{ + if (llcp_lr_ispaused(conn) || !llcp_tx_alloc_peek(conn, ctx)) { + ctx->state = LP_PAST_STATE_WAIT_TX_REQ; + } else { + /* Call ULL and wait for reply */ + ctx->state = LP_PAST_STATE_WAIT_OFFSET_CALC; + ull_conn_past_sender_offset_request(conn); + } +} + +static void lp_past_st_wait_tx_req(struct ll_conn *conn, struct proc_ctx *ctx, + uint8_t evt, void *param) +{ + switch (evt) { + case LP_PAST_EVT_RUN: + lp_past_offset_calc_req(conn, ctx, evt, param); + break; + default: + /* Ignore other evts */ + break; + } +} + +static void lp_past_st_wait_offset_calc(struct ll_conn *conn, struct proc_ctx *ctx, + uint8_t evt, void *param) +{ + switch (evt) { + case LP_PAST_EVT_OFFSET_CALC_REPLY: + if (ull_ref_get(&conn->ull)) { + /* Connection event still ongoing, wait for done */ + ctx->state = LP_PAST_STATE_WAIT_EVT_DONE; + } else if (ctx->data.periodic_sync.conn_evt_trx) { + /* Connection event done with successful rx from peer */ + lp_past_tx(conn, ctx); + } else { + /* Reset state and try again in next connection event */ + ctx->state = LP_PAST_STATE_WAIT_TX_REQ; + } + break; + default: + /* Ignore other evts */ + break; + } +} + +void llcp_lp_past_tx_ack(struct ll_conn *conn, struct proc_ctx *ctx, struct node_tx *tx) +{ + lp_past_execute_fsm(conn, ctx, LP_PAST_EVT_ACK, tx->pdu); +} + +void llcp_lp_past_conn_evt_done(struct ll_conn *conn, struct proc_ctx *ctx) +{ + if (ctx->data.periodic_sync.conn_evt_trx != 0) { + lp_past_execute_fsm(conn, ctx, LP_PAST_EVT_RX_RECEIVED, NULL); + } else { + lp_past_execute_fsm(conn, ctx, LP_PAST_EVT_NO_RX_RECEIVED, NULL); + } +} + +static void lp_past_state_wait_evt_done(struct ll_conn *conn, struct proc_ctx *ctx, + uint8_t evt, void *param) +{ + /* Offset calculation has to be done in a connection event where a packet + * was received from the peer. + * From Core Spec v5.4, Vol 6, Part B, Section 2.4.2.27: + * syncConnEventCount shall be set to the connection event counter for the + * connection event that the sending device used in determining the contents + * of this PDU. This shall be a connection event where the sending device + * received a packet from the device it will send the LL_PERIODIC_SYNC_- + * IND PDU to and, if the sending device is the Peripheral on the piconet con- + * taining those two devices, it used the received packet to synchronize its + * anchor point + */ + switch (evt) { + case LP_PAST_EVT_RX_RECEIVED: + lp_past_tx(conn, ctx); + break; + case LP_PAST_EVT_NO_RX_RECEIVED: + /* Try again in next connection event */ + ctx->state = LP_PAST_STATE_WAIT_TX_REQ; + break; + } +} + +static void lp_past_st_idle(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, void *param) +{ + switch (evt) { + case LP_PAST_EVT_RUN: + /* In case feature exchange completed after past was enqueued + * peer PAST receiver support should be confirmed + */ + if (feature_peer_periodic_sync_recv(conn)) { + lp_past_offset_calc_req(conn, ctx, evt, param); + } else { + /* Peer doesn't support PAST Receiver; HCI gives us no way to + * indicate this to the host so just silently complete the procedure + */ + lp_past_complete(conn, ctx); + } + break; + default: + /* Ignore other evts */ + break; + } +} + +static void lp_past_st_wait_tx_ack(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, + void *param) +{ + switch (evt) { + case LP_PAST_EVT_ACK: + /* Received Ack - All done now */ + lp_past_complete(conn, ctx); + break; + default: + /* Ignore other evts */ + break; + } +} + +static void lp_past_execute_fsm(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt, + void *param) +{ + switch (ctx->state) { + case LP_PAST_STATE_IDLE: + lp_past_st_idle(conn, ctx, evt, param); + break; + case LP_PAST_STATE_WAIT_TX_REQ: + lp_past_st_wait_tx_req(conn, ctx, evt, param); + break; + case LP_PAST_STATE_WAIT_OFFSET_CALC: + lp_past_st_wait_offset_calc(conn, ctx, evt, param); + break; + case LP_PAST_STATE_WAIT_TX_ACK: + lp_past_st_wait_tx_ack(conn, ctx, evt, param); + break; + case LP_PAST_STATE_WAIT_EVT_DONE: + lp_past_state_wait_evt_done(conn, ctx, evt, param); + break; + default: + /* Unknown state */ + LL_ASSERT(0); + break; + } +} + +void llcp_lp_past_run(struct ll_conn *conn, struct proc_ctx *ctx, void *param) +{ + lp_past_execute_fsm(conn, ctx, LP_PAST_EVT_RUN, param); +} +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_pdu.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_pdu.c index d91914ff39252..240f2ccfab736 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_pdu.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_pdu.c @@ -40,6 +40,12 @@ #include "ull_conn_iso_types.h" #include "ull_conn_iso_internal.h" +#include "lll/lll_adv_types.h" +#include "lll_adv.h" +#include "ull_adv_types.h" +#include "lll_sync.h" +#include "lll_sync_iso.h" +#include "ull_sync_types.h" #include "ull_conn_types.h" #include "ull_llcp.h" #include "ull_llcp_internal.h" @@ -986,3 +992,76 @@ void llcp_pdu_decode_clock_accuracy_rsp(struct proc_ctx *ctx, struct pdu_data *p ctx->data.sca_update.sca = p->sca; } #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ + +/* + * Periodic Adv Sync Transfer Procedure Helpers + */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) +void llcp_pdu_fill_sync_info_offset(struct pdu_adv_sync_info *si, uint32_t offset_us) +{ + uint8_t offset_adjust = 0U; + uint8_t offset_units = 0U; + + if (offset_us >= OFFS_ADJUST_US) { + offset_us -= OFFS_ADJUST_US; + offset_adjust = 1U; + } + + offset_us = offset_us / OFFS_UNIT_30_US; + if (!!(offset_us >> OFFS_UNIT_BITS)) { + offset_us = offset_us / (OFFS_UNIT_300_US / OFFS_UNIT_30_US); + offset_units = OFFS_UNIT_VALUE_300_US; + } + + /* Fill in the offset */ + PDU_ADV_SYNC_INFO_OFFS_SET(si, offset_us, offset_units, offset_adjust); +} + +void llcp_pdu_encode_periodic_sync_ind(struct proc_ctx *ctx, struct pdu_data *pdu) +{ + struct pdu_data_llctrl_periodic_sync_ind *p = &pdu->llctrl.periodic_sync_ind; + + pdu->ll_id = PDU_DATA_LLID_CTRL; + pdu->len = PDU_DATA_LLCTRL_LEN(periodic_sync_ind); + pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_PERIODIC_SYNC_IND; + + p->id = sys_cpu_to_le16(ctx->data.periodic_sync.id); + + memcpy(&p->sync_info, &ctx->data.periodic_sync.sync_info, sizeof(struct pdu_adv_sync_info)); + + p->sync_info.evt_cntr = sys_cpu_to_le16(ctx->data.periodic_sync.sync_info.evt_cntr); + + p->conn_event_count = sys_cpu_to_le16(ctx->data.periodic_sync.conn_event_count); + p->last_pa_event_counter = sys_cpu_to_le16(ctx->data.periodic_sync.last_pa_event_counter); + p->sid = ctx->data.periodic_sync.sid; + p->addr_type = ctx->data.periodic_sync.addr_type; + p->sca = ctx->data.periodic_sync.sca; + p->phy = ctx->data.periodic_sync.phy; + + memcpy(&p->adv_addr, &ctx->data.periodic_sync.adv_addr, sizeof(bt_addr_t)); + + p->sync_conn_event_count = sys_cpu_to_le16(ctx->data.periodic_sync.sync_conn_event_count); +} +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ + +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) +void llcp_pdu_decode_periodic_sync_ind(struct proc_ctx *ctx, struct pdu_data *pdu) +{ + struct pdu_data_llctrl_periodic_sync_ind *p = &pdu->llctrl.periodic_sync_ind; + + ctx->data.periodic_sync.id = sys_le16_to_cpu(p->id); + + memcpy(&ctx->data.periodic_sync.sync_info, &p->sync_info, sizeof(struct pdu_adv_sync_info)); + + ctx->data.periodic_sync.conn_event_count = sys_le16_to_cpu(p->conn_event_count); + ctx->data.periodic_sync.last_pa_event_counter = sys_le16_to_cpu(p->last_pa_event_counter); + ctx->data.periodic_sync.sid = p->sid; + ctx->data.periodic_sync.addr_type = p->addr_type; + ctx->data.periodic_sync.sca = p->sca; + ctx->data.periodic_sync.phy = p->phy; + + memcpy(&ctx->data.periodic_sync.adv_addr, &p->adv_addr, sizeof(bt_addr_t)); + + ctx->data.periodic_sync.sync_conn_event_count = sys_le16_to_cpu(p->sync_conn_event_count); +} +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_phy.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_phy.c index 006938d9b2fc2..bee1b48ae1b2b 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_phy.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_phy.c @@ -190,7 +190,7 @@ static void pu_reset_timing_restrict(struct ll_conn *conn) } #if defined(CONFIG_BT_PERIPHERAL) -static inline bool phy_valid(uint8_t phy) +static inline bool phy_validation_check_phy_ind(uint8_t phy) { /* This is equivalent to: * maximum one bit set, and no bit set is rfu's @@ -203,7 +203,8 @@ static uint8_t pu_check_update_ind(struct ll_conn *conn, struct proc_ctx *ctx) uint8_t ret = 0; /* Check if either phy selected is invalid */ - if (!phy_valid(ctx->data.pu.c_to_p_phy) || !phy_valid(ctx->data.pu.p_to_c_phy)) { + if (!phy_validation_check_phy_ind(ctx->data.pu.c_to_p_phy) || + !phy_validation_check_phy_ind(ctx->data.pu.p_to_c_phy)) { /* more than one or any rfu bit selected in either phy */ ctx->data.pu.error = BT_HCI_ERR_UNSUPP_FEATURE_PARAM_VAL; ret = 1; diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_remote.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_remote.c index 94351132ddc64..185cad7911d1b 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_remote.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_remote.c @@ -95,6 +95,7 @@ static bool proc_with_instant(struct proc_ctx *ctx) case PROC_CIS_TERMINATE: case PROC_CIS_CREATE: case PROC_SCA_UPDATE: + case PROC_PERIODIC_SYNC: return 0U; case PROC_PHY_UPDATE: case PROC_CONN_UPDATE: @@ -311,6 +312,11 @@ void llcp_rr_rx(struct ll_conn *conn, struct proc_ctx *ctx, memq_link_t *link, llcp_rp_comm_rx(conn, ctx, rx); break; #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) + case PROC_PERIODIC_SYNC: + llcp_rp_past_rx(conn, ctx, rx); + break; +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ default: /* Unknown procedure */ LL_ASSERT(0); @@ -446,6 +452,11 @@ static void rr_act_run(struct ll_conn *conn) llcp_rp_comm_run(conn, ctx, NULL); break; #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) + case PROC_PERIODIC_SYNC: + llcp_rp_past_run(conn, ctx, NULL); + break; +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ default: /* Unknown procedure */ LL_ASSERT(0); @@ -896,6 +907,9 @@ static const struct proc_role new_proc_lut[] = { #if defined(CONFIG_BT_CTLR_SCA_UPDATE) [PDU_DATA_LLCTRL_TYPE_CLOCK_ACCURACY_REQ] = { PROC_SCA_UPDATE, ACCEPT_ROLE_BOTH }, #endif /* CONFIG_BT_CTLR_SCA_UPDATE */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) + [PDU_DATA_LLCTRL_TYPE_PERIODIC_SYNC_IND] = { PROC_PERIODIC_SYNC, ACCEPT_ROLE_BOTH }, +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ }; void llcp_rr_new(struct ll_conn *conn, memq_link_t *link, struct node_rx_pdu *rx, bool valid_pdu) From c7ffce3eb236642887cc93b22942356dfac702a6 Mon Sep 17 00:00:00 2001 From: Lucas Mathias Balling Date: Fri, 4 Oct 2024 13:22:40 +0200 Subject: [PATCH 1422/4482] tests: Bluetooth: LLCP unittests for Periodic Sync Procedure Added LLCP PDU Periodic Sync Indication unittests Signed-off-by: Lucas Mathias Balling --- .../controller/common/include/helper_pdu.h | 6 + .../controller/common/src/helper_pdu.c | 70 ++ .../controller/common/src/helper_util.c | 4 + .../ctrl_isoal/src/isoal_test_common.c | 21 + .../ctrl_periodic_sync/CMakeLists.txt | 16 + .../controller/ctrl_periodic_sync/Kconfig | 31 + .../controller/ctrl_periodic_sync/prj.conf | 43 ++ .../controller/ctrl_periodic_sync/src/main.c | 656 ++++++++++++++++++ .../ctrl_periodic_sync/testcase.yaml | 8 + .../controller/mock_ctrl/CMakeLists.txt | 4 + .../mock_ctrl/include/hal/ticker_vendor_hal.h | 27 + .../mock_ctrl/include/lll/lll_adv_pdu.h | 6 + .../controller/mock_ctrl/src/isoal.c | 13 + .../controller/mock_ctrl/src/mayfly.c | 3 +- .../controller/mock_ctrl/src/ticker.c | 15 + .../bluetooth/controller/mock_ctrl/src/ull.c | 12 + .../controller/mock_ctrl/src/ull_adv_sync.c | 29 + .../controller/mock_ctrl/src/ull_filter.c | 46 ++ .../controller/mock_ctrl/src/ull_sync.c | 59 ++ tests/bluetooth/controller/uut/CMakeLists.txt | 6 + 20 files changed, 1074 insertions(+), 1 deletion(-) create mode 100644 tests/bluetooth/controller/ctrl_periodic_sync/CMakeLists.txt create mode 100644 tests/bluetooth/controller/ctrl_periodic_sync/Kconfig create mode 100644 tests/bluetooth/controller/ctrl_periodic_sync/prj.conf create mode 100644 tests/bluetooth/controller/ctrl_periodic_sync/src/main.c create mode 100644 tests/bluetooth/controller/ctrl_periodic_sync/testcase.yaml create mode 100644 tests/bluetooth/controller/mock_ctrl/src/isoal.c create mode 100644 tests/bluetooth/controller/mock_ctrl/src/ull_adv_sync.c create mode 100644 tests/bluetooth/controller/mock_ctrl/src/ull_filter.c create mode 100644 tests/bluetooth/controller/mock_ctrl/src/ull_sync.c diff --git a/tests/bluetooth/controller/common/include/helper_pdu.h b/tests/bluetooth/controller/common/include/helper_pdu.h index a43912cb2b70c..1f9c80cafdc72 100644 --- a/tests/bluetooth/controller/common/include/helper_pdu.h +++ b/tests/bluetooth/controller/common/include/helper_pdu.h @@ -62,6 +62,8 @@ void helper_pdu_encode_cis_terminate_ind(struct pdu_data *pdu, void *param); void helper_pdu_encode_sca_req(struct pdu_data *pdu, void *param); void helper_pdu_encode_sca_rsp(struct pdu_data *pdu, void *param); +void helper_pdu_encode_periodic_sync_ind(struct pdu_data *pdu, void *param); + void helper_pdu_verify_ping_req(const char *file, uint32_t line, struct pdu_data *pdu, void *param); void helper_pdu_verify_ping_rsp(const char *file, uint32_t line, struct pdu_data *pdu, void *param); @@ -155,6 +157,9 @@ void helper_pdu_verify_cis_terminate_ind(const char *file, uint32_t line, struct void helper_pdu_verify_sca_req(const char *file, uint32_t line, struct pdu_data *pdu, void *param); void helper_pdu_verify_sca_rsp(const char *file, uint32_t line, struct pdu_data *pdu, void *param); +void helper_pdu_verify_periodic_sync_ind(const char *file, uint32_t line, struct pdu_data *pdu, + void *param); + void helper_node_verify_peer_sca_update(const char *file, uint32_t line, struct node_rx_pdu *rx, void *param); @@ -193,6 +198,7 @@ enum helper_pdu_opcode { LL_CIS_RSP, LL_CIS_IND, LL_CIS_TERMINATE_IND, + LL_PERIODIC_SYNC_IND, LL_ZERO, }; diff --git a/tests/bluetooth/controller/common/src/helper_pdu.c b/tests/bluetooth/controller/common/src/helper_pdu.c index 7419de8fbce40..315178dc2ba0c 100644 --- a/tests/bluetooth/controller/common/src/helper_pdu.c +++ b/tests/bluetooth/controller/common/src/helper_pdu.c @@ -504,6 +504,33 @@ void helper_pdu_encode_sca_rsp(struct pdu_data *pdu, void *param) pdu->llctrl.clock_accuracy_rsp.sca = p->sca; } +void helper_pdu_encode_periodic_sync_ind(struct pdu_data *pdu, void *param) +{ + struct pdu_data_llctrl_periodic_sync_ind *p = param; + + pdu->ll_id = PDU_DATA_LLID_CTRL; + pdu->len = offsetof(struct pdu_data_llctrl, periodic_sync_ind) + + sizeof(struct pdu_data_llctrl_periodic_sync_ind); + pdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_PERIODIC_SYNC_IND; + + pdu->llctrl.periodic_sync_ind.id = sys_cpu_to_le16(p->id); + + memcpy(&pdu->llctrl.periodic_sync_ind.sync_info, &p->sync_info, + sizeof(struct pdu_adv_sync_info)); + + pdu->llctrl.periodic_sync_ind.conn_event_count = sys_cpu_to_le16(p->conn_event_count); + pdu->llctrl.periodic_sync_ind.last_pa_event_counter = + sys_cpu_to_le16(p->last_pa_event_counter); + pdu->llctrl.periodic_sync_ind.sid = p->sid; + pdu->llctrl.periodic_sync_ind.addr_type = p->addr_type; + pdu->llctrl.periodic_sync_ind.sca = p->sca; + pdu->llctrl.periodic_sync_ind.phy = p->phy; + + memcpy(pdu->llctrl.periodic_sync_ind.adv_addr, p->adv_addr, sizeof(p->adv_addr)); + + pdu->llctrl.periodic_sync_ind.sync_conn_event_count = p->sync_conn_event_count; +} + void helper_pdu_verify_version_ind(const char *file, uint32_t line, struct pdu_data *pdu, void *param) { @@ -1253,3 +1280,46 @@ void helper_pdu_verify_sca_rsp(const char *file, uint32_t line, struct pdu_data zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_CLOCK_ACCURACY_RSP, "Not a LL_CLOCK_ACCURACY_RSP.\nCalled at %s:%d\n", file, line); } + +void helper_pdu_verify_periodic_sync_ind(const char *file, uint32_t line, struct pdu_data *pdu, + void *param) +{ + struct pdu_data_llctrl_periodic_sync_ind *p = param; + + zassert_equal(pdu->ll_id, PDU_DATA_LLID_CTRL, "Not a Control PDU.\nCalled at %s:%d\n", file, + line); + zassert_equal(pdu->llctrl.opcode, PDU_DATA_LLCTRL_TYPE_PERIODIC_SYNC_IND, + "Not a LL_PERIODIC_SYNC_IND.\nCalled at %s:%d\n", file, line); + + zassert_equal(pdu->llctrl.periodic_sync_ind.id, p->id, + "id mismatch.\nCalled at %s:%d\n", file, line); + + zassert_equal(pdu->llctrl.periodic_sync_ind.conn_event_count, p->conn_event_count, + "conn_event_count mismatch.\nCalled at %s:%d\n", file, line); + + zassert_equal(pdu->llctrl.periodic_sync_ind.last_pa_event_counter, p->last_pa_event_counter, + "last_pa_event_counter mismatch.\nCalled at %s:%d\n", file, line); + + zassert_equal(pdu->llctrl.periodic_sync_ind.sid, p->sid, + "sid mismatch.\nCalled at %s:%d\n", file, line); + + zassert_equal(pdu->llctrl.periodic_sync_ind.addr_type, p->addr_type, + "addr_type mismatch.\nCalled at %s:%d\n", file, line); + + zassert_equal(pdu->llctrl.periodic_sync_ind.sca, p->sca, + "sca mismatch.\nCalled at %s:%d\n", file, line); + + zassert_equal(pdu->llctrl.periodic_sync_ind.phy, p->phy, + "phy mismatch.\nCalled at %s:%d\n", file, line); + + zassert_equal(pdu->llctrl.periodic_sync_ind.sync_conn_event_count, p->sync_conn_event_count, + "sync_conn_event_count mismatch.\nCalled at %s:%d\n", file, line); + + zassert_mem_equal(&pdu->llctrl.periodic_sync_ind.sync_info, &p->sync_info, + sizeof(struct pdu_adv_sync_info), + "sync_info mismatch.\nCalled at %s:%d\n", file, line); + + zassert_mem_equal(pdu->llctrl.periodic_sync_ind.adv_addr, p->adv_addr, + sizeof(p->adv_addr), + "adv_addr mismatch.\nCalled at %s:%d\n", file, line); +} diff --git a/tests/bluetooth/controller/common/src/helper_util.c b/tests/bluetooth/controller/common/src/helper_util.c index 6d05630558daf..5aeca45c90c8f 100644 --- a/tests/bluetooth/controller/common/src/helper_util.c +++ b/tests/bluetooth/controller/common/src/helper_util.c @@ -96,6 +96,7 @@ helper_pdu_encode_func_t *const helper_pdu_encode[] = { [LL_CIS_RSP] = helper_pdu_encode_cis_rsp, [LL_CIS_IND] = helper_pdu_encode_cis_ind, [LL_CIS_TERMINATE_IND] = helper_pdu_encode_cis_terminate_ind, + [LL_PERIODIC_SYNC_IND] = helper_pdu_encode_periodic_sync_ind, [LL_ZERO] = helper_pdu_encode_zero, }; @@ -134,6 +135,7 @@ helper_pdu_verify_func_t *const helper_pdu_verify[] = { [LL_CIS_RSP] = helper_pdu_verify_cis_rsp, [LL_CIS_IND] = helper_pdu_verify_cis_ind, [LL_CIS_TERMINATE_IND] = helper_pdu_verify_cis_terminate_ind, + [LL_PERIODIC_SYNC_IND] = helper_pdu_verify_periodic_sync_ind, }; helper_pdu_ntf_verify_func_t *const helper_pdu_ntf_verify[] = { @@ -170,6 +172,7 @@ helper_pdu_ntf_verify_func_t *const helper_pdu_ntf_verify[] = { [LL_CIS_RSP] = NULL, [LL_CIS_IND] = NULL, [LL_CIS_TERMINATE_IND] = NULL, + [LL_PERIODIC_SYNC_IND] = NULL, }; helper_node_encode_func_t *const helper_node_encode[] = { @@ -203,6 +206,7 @@ helper_node_encode_func_t *const helper_node_encode[] = { [LL_CIS_RSP] = NULL, [LL_CIS_IND] = NULL, [LL_CIS_TERMINATE_IND] = NULL, + [LL_PERIODIC_SYNC_IND] = NULL, }; helper_node_verify_func_t *const helper_node_verify[] = { diff --git a/tests/bluetooth/controller/ctrl_isoal/src/isoal_test_common.c b/tests/bluetooth/controller/ctrl_isoal/src/isoal_test_common.c index 32536201a3a01..ad7c744722b21 100644 --- a/tests/bluetooth/controller/ctrl_isoal/src/isoal_test_common.c +++ b/tests/bluetooth/controller/ctrl_isoal/src/isoal_test_common.c @@ -20,6 +20,11 @@ #include #include +#include "hal/cpu.h" +#include "hal/ccm.h" +#include "hal/cntr.h" +#include "hal/ticker.h" + #include "util/memq.h" #include "pdu_df.h" @@ -35,6 +40,8 @@ #include "isoal_test_common.h" #include "isoal_test_debug.h" +#define ULL_TIME_WRAPPING_POINT_US (HAL_TICKER_TICKS_TO_US_64BIT(HAL_TICKER_CNTR_MASK)) +#define ULL_TIME_SPAN_FULL_US (ULL_TIME_WRAPPING_POINT_US + 1) /** * Intializes a RX PDU buffer @@ -270,3 +277,17 @@ void init_test_data_buffer(uint8_t *buf, uint16_t size) buf[i] = (uint8_t)(i & 0x00FF); } } + +/** + * @brief Wraps given time within the range of 0 to ULL_TIME_WRAPPING_POINT_US + * @param time_now Current time value + * @param time_diff Time difference (signed) + * @return Wrapped time after difference + */ +uint32_t ull_get_wrapped_time_us(uint32_t time_now_us, int32_t time_diff_us) +{ + uint32_t result = ((uint64_t)time_now_us + ULL_TIME_SPAN_FULL_US + time_diff_us) % + ((uint64_t)ULL_TIME_SPAN_FULL_US); + + return result; +} diff --git a/tests/bluetooth/controller/ctrl_periodic_sync/CMakeLists.txt b/tests/bluetooth/controller/ctrl_periodic_sync/CMakeLists.txt new file mode 100644 index 0000000000000..3711f99428628 --- /dev/null +++ b/tests/bluetooth/controller/ctrl_periodic_sync/CMakeLists.txt @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +project(bluetooth_ull_llcp_periodic_sync) +find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/controller/common common) +add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/controller/uut uut) + +target_link_libraries(testbinary PRIVATE uut common) + +target_sources(testbinary + PRIVATE + src/main.c +) diff --git a/tests/bluetooth/controller/ctrl_periodic_sync/Kconfig b/tests/bluetooth/controller/ctrl_periodic_sync/Kconfig new file mode 100644 index 0000000000000..656446cacf39f --- /dev/null +++ b/tests/bluetooth/controller/ctrl_periodic_sync/Kconfig @@ -0,0 +1,31 @@ +# Copyright (c) 2022 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +# some of the control procedures in the BT LL depend on +# the following configs been set + +config SOC_COMPATIBLE_NRF + default y + +config BT_CTLR_DATA_LEN_UPDATE_SUPPORT + default y + +config BT_CTLR_PHY_UPDATE_SUPPORT + default y + +config BT_CTLR_PHY_CODED_SUPPORT + default y + +config BT_CTLR_PHY_2M_SUPPORT + default y + +config ENTROPY_NRF_FORCE_ALT + default n + +config ENTROPY_NRF5_RNG + default n + +source "tests/bluetooth/controller/common/Kconfig" + +# Include Zephyr's Kconfig +source "Kconfig" diff --git a/tests/bluetooth/controller/ctrl_periodic_sync/prj.conf b/tests/bluetooth/controller/ctrl_periodic_sync/prj.conf new file mode 100644 index 0000000000000..91c4ef94c2fa9 --- /dev/null +++ b/tests/bluetooth/controller/ctrl_periodic_sync/prj.conf @@ -0,0 +1,43 @@ +CONFIG_ZTEST=y + +CONFIG_ASSERT=y +CONFIG_ASSERT_LEVEL=2 +CONFIG_ASSERT_VERBOSE=y + +CONFIG_BT=y +CONFIG_BT_HCI=y +CONFIG_BT_CTLR=y +CONFIG_BT_CTLR_PRIVACY=y +CONFIG_BT_LL_SW_SPLIT=y + +CONFIG_BT_LLL_VENDOR_NORDIC=y + +CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=y + +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_BUF_ACL_RX_SIZE=251 +CONFIG_BT_DATA_LEN_UPDATE=y +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 + +CONFIG_BT_ASSERT=y +CONFIG_BT_CTLR_ASSERT_HANDLER=y + +CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG=y +CONFIG_BT_CTLR_SCA_UPDATE=y +CONFIG_BT_SCA_UPDATE=y + +CONFIG_BT_PER_ADV=y +CONFIG_BT_PER_ADV_SYNC=y +CONFIG_BT_EXT_ADV=y +CONFIG_BT_CTLR_ADV_PERIODIC=y +CONFIG_BT_CTLR_ADV_PERIODIC_ADI_SUPPORT=n +CONFIG_BT_CTLR_ADV_EXT=y +CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER=y +CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER=y +CONFIG_BT_PER_ADV_SYNC_MAX=2 +CONFIG_BT_CTLR_RL_SIZE=8 + +CONFIG_BT_PHY_UPDATE=y +CONFIG_BT_CTLR_PHY_2M=y +CONFIG_BT_CTLR_PHY_CODED=y diff --git a/tests/bluetooth/controller/ctrl_periodic_sync/src/main.c b/tests/bluetooth/controller/ctrl_periodic_sync/src/main.c new file mode 100644 index 0000000000000..2be31106cfdc7 --- /dev/null +++ b/tests/bluetooth/controller/ctrl_periodic_sync/src/main.c @@ -0,0 +1,656 @@ +/* + * Copyright (c) 2024 Demant + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +DEFINE_FFF_GLOBALS; + +#include +#include +#include +#include +#include "hal/ccm.h" + +#include "util/util.h" +#include "util/mem.h" +#include "util/memq.h" +#include "util/mayfly.h" +#include "util/dbuf.h" + +#include "pdu_df.h" +#include "lll/pdu_vendor.h" +#include "pdu.h" +#include "ll.h" +#include "ll_settings.h" +#include "ll_feat.h" + +#include "lll.h" +#include "lll/lll_df_types.h" +#include "lll_conn.h" +#include "lll_conn_iso.h" +#include "lll/lll_adv_types.h" +#include "lll_adv.h" +#include "lll/lll_adv_pdu.h" +#include "lll_chan.h" +#include "lll_scan.h" +#include "lll_sync.h" +#include "lll_sync_iso.h" + +#include "ull_adv_types.h" +#include "ull_scan_types.h" +#include "ull_sync_types.h" + +#include "ull_tx_queue.h" + +#include "isoal.h" +#include "ull_iso_types.h" +#include "ull_conn_iso_types.h" + +#include "ull_conn_types.h" +#include "ull_llcp.h" +#include "ull_llcp_internal.h" +#include "ull_sync_internal.h" +#include "ull_internal.h" + +#include "helper_pdu.h" +#include "helper_util.h" + +static struct ll_conn conn; +static struct ll_sync_set *sync; +static struct ll_adv_sync_set *adv_sync; + +static void periodic_sync_setup(void *data) +{ + test_setup(&conn); +} + +/* Custom fakes for this test suite */ + +/* uint32_t mayfly_enqueue(uint8_t caller_id, uint8_t callee_id, + * uint8_t chain, struct mayfly *m); + */ +FAKE_VALUE_FUNC(uint32_t, mayfly_enqueue, uint8_t, uint8_t, uint8_t, struct mayfly *); + +uint32_t mayfly_enqueue_custom_fake(uint8_t caller_id, uint8_t callee_id, + uint8_t chain, struct mayfly *m) +{ + /* Only proceed if it is the right mayfly enqueue used for getting the offset */ + if (m->param == &conn && chain == 1U) { + /* Mock that mayfly has run and ull_lp_past_offset_calc_reply() + * is called with the found past offset + */ + ull_lp_past_offset_calc_reply(&conn, 0, 0, 0); + } + + return 0; +} + +/* void ull_sync_transfer_received(struct ll_conn *conn, uint16_t service_data, + * struct pdu_adv_sync_info *si, uint16_t conn_event_count, + * uint16_t last_pa_event_counter, uint8_t sid, + * uint8_t addr_type, uint8_t sca, uint8_t phy, + * uint8_t *adv_addr, uint16_t sync_conn_event_count, + * uint8_t addr_resolved); + */ +FAKE_VOID_FUNC(ull_sync_transfer_received, struct ll_conn *, uint16_t, + struct pdu_adv_sync_info *, + uint16_t, + uint16_t, + uint8_t, + uint8_t, + uint8_t, + uint8_t, + uint8_t *, + uint16_t, + uint8_t); + +void ull_sync_transfer_received_custom_fake(struct ll_conn *conn, uint16_t service_data, + struct pdu_adv_sync_info *si, uint16_t conn_event_count, + uint16_t last_pa_event_counter, uint8_t sid, + uint8_t addr_type, uint8_t sca, uint8_t phy, + uint8_t *adv_addr, uint16_t sync_conn_event_count, + uint8_t addr_resolved) +{ +} +/* +-----+ +-------+ +-----+ + * | UT | | LL_A | | LT | + * +-----+ +-------+ +-----+ + * | | | + * | Start | | + * | Periodic Adv. Sync Transfer| | + * | Proc. | | + * |--------------------------->| | + * | | | + * | | LL_PERIODIC_SYNC_IND| + * | |------------------> | + * | | 'll_ack'| + * | | | + * |Periodic Adv. Sync Transfer | | + * | Proc. Complete | | + * |<---------------------------| | + * | | | + */ +ZTEST(periodic_sync_transfer, test_periodic_sync_transfer_loc) +{ + uint8_t err; + struct node_tx *tx; + struct proc_ctx *ctx; + uint16_t service_data = 0; + + adv_sync = NULL; + sync = ull_sync_is_enabled_get(0); + + struct pdu_data_llctrl_periodic_sync_ind local_periodic_sync_ind = { + .id = 0x00, + .conn_event_count = 0x00, + .last_pa_event_counter = 0x00, + .sid = 0x00, + .addr_type = 0x00, + .sca = 0x00, + .phy = 0x00, + .adv_addr = { 0, 0, 0, 0, 0, 0}, + .sync_conn_event_count = 0 + }; + + /* Reset and setup mayfly_enqueue_custom_fake */ + RESET_FAKE(mayfly_enqueue); + mayfly_enqueue_fake .custom_fake = mayfly_enqueue_custom_fake; + + /* Initialise sync_info */ + memset(&local_periodic_sync_ind.sync_info, 0, sizeof(struct pdu_adv_sync_info)); + + /* Role */ + test_set_role(&conn, BT_HCI_ROLE_CENTRAL); + + /* Connect */ + ull_cp_state_set(&conn, ULL_CP_CONNECTED); + conn.llcp.fex.features_peer |= BIT64(BT_LE_FEAT_BIT_PAST_RECV); + + /* Initiate a Periodic Adv. Sync Transfer Procedure */ + err = ull_cp_periodic_sync(&conn, sync, adv_sync, service_data); + zassert_equal(err, BT_HCI_ERR_SUCCESS); + + /* Connection event done with successful rx from peer */ + ctx = llcp_lr_peek_proc(&conn, PROC_PERIODIC_SYNC); + if (ctx) { + ctx->data.periodic_sync.conn_start_to_actual_us = 0; + ctx->data.periodic_sync.conn_evt_trx = 1; + llcp_lp_past_conn_evt_done(&conn, ctx); + } + + /* Prepare */ + event_prepare(&conn); + + /* Tx Queue should have one LL Control PDU */ + lt_rx(LL_PERIODIC_SYNC_IND, &conn, &tx, &local_periodic_sync_ind); + lt_rx_q_is_empty(&conn); + + /* TX Ack */ + event_tx_ack(&conn, tx); + + /* Done */ + event_done(&conn); + + /* Release tx node */ + ull_cp_release_tx(&conn, tx); + + /* There should be no host notifications */ + ut_rx_q_is_empty(); + + zassert_equal(llcp_ctx_buffers_free(), test_ctx_buffers_cnt(), + "Free CTX buffers %d and ctx_buffers_cnt is %d", llcp_ctx_buffers_free(), + test_ctx_buffers_cnt()); +} + +ZTEST(periodic_sync_transfer, test_periodic_sync_transfer_loc_2) +{ + uint8_t err; + uint16_t service_data = 0; + + sync = ull_sync_is_enabled_get(0); + adv_sync = NULL; + + ull_cp_init(); + ull_tx_q_init(&conn.tx_q); + ull_llcp_init(&conn); + conn.llcp.fex.features_peer |= BIT64(BT_LE_FEAT_BIT_PAST_RECV); + + err = ull_cp_periodic_sync(&conn, sync, adv_sync, service_data); + + for (int i = 0U; i < CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM; i++) { + zassert_equal(err, BT_HCI_ERR_SUCCESS); + err = ull_cp_periodic_sync(&conn, sync, adv_sync, service_data); + } + + zassert_not_equal(err, BT_HCI_ERR_SUCCESS, NULL); + + zassert_equal(llcp_ctx_buffers_free(), + test_ctx_buffers_cnt() - CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM, + "Free CTX buffers %d", llcp_ctx_buffers_free()); +} + +/* +-----+ +-------+ +-----+ + * | UT | | LL_A | | LT | + * +-----+ +-------+ +-----+ + * | | | + * | | LL_PERIODIC_SYNC_IND | + * | |<----------------------- | + * | | | + * | | | + * | | | + * | | | + */ +ZTEST(periodic_sync_transfer, test_periodic_sync_transfer_rem) +{ + struct pdu_data_llctrl_periodic_sync_ind remote_periodic_sync_ind = { + .id = 0x01, + .conn_event_count = 0x00, + .last_pa_event_counter = 0x00, + .sid = 0x00, + .addr_type = 0x01, + .sca = 0x00, + .phy = 0x01, + .adv_addr = { 0, 0, 0, 0, 0, 0}, + .sync_conn_event_count = 0 + }; + + /* Reset and setup fake functions */ + RESET_FAKE(ull_sync_transfer_received); + ull_sync_transfer_received_fake.custom_fake = ull_sync_transfer_received_custom_fake; + + RESET_FAKE(mayfly_enqueue); + mayfly_enqueue_fake .custom_fake = mayfly_enqueue_custom_fake; + + /* Initialise sync_info */ + memset(&remote_periodic_sync_ind.sync_info, 0, sizeof(struct pdu_adv_sync_info)); + + /* Role */ + test_set_role(&conn, BT_HCI_ROLE_CENTRAL); + + /* Connect */ + ull_cp_state_set(&conn, ULL_CP_CONNECTED); + conn.llcp.fex.features_peer |= BIT64(BT_LE_FEAT_BIT_PAST_RECV); + + /* Prepare */ + event_prepare(&conn); + + /* Rx */ + lt_tx(LL_PERIODIC_SYNC_IND, &conn, &remote_periodic_sync_ind); + + /* Done */ + event_done(&conn); + + /* Prepare */ + event_prepare(&conn); + + /* Tx Queue should have one LL Control PDU */ + lt_rx_q_is_empty(&conn); + + /* Done */ + event_done(&conn); + + /* There should not be a host notifications */ + ut_rx_q_is_empty(); + + zassert_equal(llcp_ctx_buffers_free(), test_ctx_buffers_cnt(), + "Free CTX buffers %d and ctx_buffers_cnt is %d", llcp_ctx_buffers_free(), + test_ctx_buffers_cnt()); + + + /* Verify that ull_sync_transfer_received was called, + * hence the phy invalidation mechanism works + */ + zassert_equal(ull_sync_transfer_received_fake.call_count, 1, + "ull_sync_transfer_received_fake.call_count is %d and expected: %d", + ull_sync_transfer_received_fake.call_count, 1); +} + +/* +-----+ +-------+ +-----+ + * | UT | | LL_A | | LT | + * +-----+ +-------+ +-----+ + * | | | + * | | LL_PERIODIC_SYNC_IND | + * | |<------------------------| + * | | | + * | | | + * | | | + * | | | + * | Start | | + * | Periodic Adv. Sync Transfer| | + * | Proc. | | + * |--------------------------->| | + * | | | + * | | | + * | | LL_PERIODIC_SYNC_IND | + * | |------------------------>| + * | | 'll_ack'| + * |Periodic Adv. Sync Transfer | | + * | Proc. Complete | | + * |<---------------------------| | + * | | | + */ +ZTEST(periodic_sync_transfer, test_periodic_sync_transfer_rem_2) +{ + uint8_t err; + struct node_tx *tx; + uint16_t service_data = 0; + struct proc_ctx *ctx; + + sync = ull_sync_is_enabled_get(0); + adv_sync = NULL; + + struct pdu_data_llctrl_periodic_sync_ind local_periodic_sync_ind = { + .id = 0x00, + .conn_event_count = 0x01, + .last_pa_event_counter = 0x00, + .sid = 0x00, + .addr_type = 0x00, + .sca = 0x00, + .phy = 0x00, + .adv_addr = { 0, 0, 0, 0, 0, 0}, + .sync_conn_event_count = 0x01 + }; + + struct pdu_data_llctrl_periodic_sync_ind remote_periodic_sync_ind = { + .id = 0x01, + .conn_event_count = 0x00, + .last_pa_event_counter = 0x00, + .sid = 0x00, + .addr_type = 0x01, + .sca = 0x00, + .phy = 0x01, + .adv_addr = { 0, 0, 0, 0, 0, 0}, + .sync_conn_event_count = 0 + }; + + /* Reset and setup fake functions */ + RESET_FAKE(ull_sync_transfer_received); + ull_sync_transfer_received_fake.custom_fake = ull_sync_transfer_received_custom_fake; + + RESET_FAKE(mayfly_enqueue); + mayfly_enqueue_fake .custom_fake = mayfly_enqueue_custom_fake; + + /* Initialise sync_info */ + memset(&local_periodic_sync_ind.sync_info, 0, sizeof(struct pdu_adv_sync_info)); + memset(&remote_periodic_sync_ind.sync_info, 0, sizeof(struct pdu_adv_sync_info)); + + /* Role */ + test_set_role(&conn, BT_HCI_ROLE_CENTRAL); + + /* Connect */ + ull_cp_state_set(&conn, ULL_CP_CONNECTED); + conn.llcp.fex.features_peer |= BIT64(BT_LE_FEAT_BIT_PAST_RECV); + + /* Prepare */ + event_prepare(&conn); + + /* Rx */ + lt_tx(LL_PERIODIC_SYNC_IND, &conn, &remote_periodic_sync_ind); + + /* Done */ + event_done(&conn); + + /* Initiate a Periodic Adv. Sync Transfer Procedure */ + err = ull_cp_periodic_sync(&conn, sync, adv_sync, service_data); + zassert_equal(err, BT_HCI_ERR_SUCCESS); + + /* Connection event done with successful rx from peer */ + ctx = llcp_lr_peek_proc(&conn, PROC_PERIODIC_SYNC); + if (ctx) { + ctx->data.periodic_sync.conn_start_to_actual_us = 0; + ctx->data.periodic_sync.conn_evt_trx = 1; + llcp_lp_past_conn_evt_done(&conn, ctx); + } + + /* Prepare */ + event_prepare(&conn); + + /* Tx Queue should have one LL Control PDU */ + lt_rx(LL_PERIODIC_SYNC_IND, &conn, &tx, &local_periodic_sync_ind); + lt_rx_q_is_empty(&conn); + + /* TX Ack */ + event_tx_ack(&conn, tx); + + /* Done */ + event_done(&conn); + + /* Release tx node */ + ull_cp_release_tx(&conn, tx); + + /* There should be no host notifications */ + ut_rx_q_is_empty(); + + zassert_equal(llcp_ctx_buffers_free(), test_ctx_buffers_cnt(), + "Free CTX buffers %d and ctx_buffers_cnt is %d", llcp_ctx_buffers_free(), + test_ctx_buffers_cnt()); + + /* Verify that ull_sync_transfer_received was called, + * hence the phy invalidation mechanism works + */ + zassert_equal(ull_sync_transfer_received_fake.call_count, 1, + "ull_sync_transfer_received_fake.call_count is %d and expected: %d", + ull_sync_transfer_received_fake.call_count, 1); +} + +/* +-----+ +-------+ +-----+ + * | UT | | LL_A | | LT | + * +-----+ +-------+ +-----+ + * | | | + * | Start | | + * | Periodic Adv. Sync Transfer| | + * | Proc. | | + * |--------------------------->| | + * | | | + * | | LL_PERIODIC_SYNC_IND| + * | |------------------> | + * | | 'll_ack'| + * | | | + * | | | + * | | | + * |Periodic Adv. Sync Transfer | | + * |Proc. Complete | | + * |<---------------------------| | + * | Start | | + * | Periodic Adv. Sync Transfer| | + * | Proc. | | + * |--------------------------->| | + * | | | + * | | | + * | | LL_PERIODIC_SYNC_IND| + * | |------------------> | + * |Periodic Adv. Sync Transfer | 'll_ack'| + * | Proc. Complete | | + * |<---------------------------| | + * | | | + */ +ZTEST(periodic_sync_transfer, test_periodic_sync_transfer_loc_twice) +{ + uint8_t err; + struct node_tx *tx; + uint16_t service_data = 0; + struct proc_ctx *ctx; + + sync = ull_sync_is_enabled_get(0); + adv_sync = NULL; + + struct pdu_data_llctrl_periodic_sync_ind local_periodic_sync_ind = { + .id = 0x00, + .conn_event_count = 0x00, + .last_pa_event_counter = 0x00, + .sid = 0x00, + .addr_type = 0x00, + .sca = 0x00, + .phy = 0x00, + .adv_addr = { 0, 0, 0, 0, 0, 0}, + .sync_conn_event_count = 0 + }; + + /* Reset and setup mayfly_enqueue_custom_fake */ + RESET_FAKE(mayfly_enqueue); + mayfly_enqueue_fake .custom_fake = mayfly_enqueue_custom_fake; + + /* Initialise sync_info */ + memset(&local_periodic_sync_ind.sync_info, 0, sizeof(struct pdu_adv_sync_info)); + + /* Role */ + test_set_role(&conn, BT_HCI_ROLE_CENTRAL); + + /* Connect */ + ull_cp_state_set(&conn, ULL_CP_CONNECTED); + conn.llcp.fex.features_peer |= BIT64(BT_LE_FEAT_BIT_PAST_RECV); + + /* Initiate a periodic_sync Procedure */ + err = ull_cp_periodic_sync(&conn, sync, adv_sync, service_data); + zassert_equal(err, BT_HCI_ERR_SUCCESS); + + /* Connection event done with successful rx from peer */ + ctx = llcp_lr_peek_proc(&conn, PROC_PERIODIC_SYNC); + if (ctx) { + ctx->data.periodic_sync.conn_start_to_actual_us = 0; + ctx->data.periodic_sync.conn_evt_trx = 1; + llcp_lp_past_conn_evt_done(&conn, ctx); + } + + /* Initiate a periodic_sync Procedure */ + err = ull_cp_periodic_sync(&conn, sync, adv_sync, service_data); + zassert_equal(err, BT_HCI_ERR_SUCCESS); + + /* Prepare */ + event_prepare(&conn); + + /* Tx Queue should have one LL Control PDU */ + lt_rx(LL_PERIODIC_SYNC_IND, &conn, &tx, &local_periodic_sync_ind); + lt_rx_q_is_empty(&conn); + + /* TX Ack */ + event_tx_ack(&conn, tx); + + /* Done */ + event_done(&conn); + + /* Increase connection event count */ + local_periodic_sync_ind.conn_event_count++; + local_periodic_sync_ind.sync_conn_event_count++; + + /* There should be no host notifications */ + ut_rx_q_is_empty(); + + /* Connection event done with successful rx from peer */ + ctx = llcp_lr_peek_proc(&conn, PROC_PERIODIC_SYNC); + if (ctx) { + ctx->data.periodic_sync.conn_start_to_actual_us = 0; + ctx->data.periodic_sync.conn_evt_trx = 1; + llcp_lp_past_conn_evt_done(&conn, ctx); + } + + /* Prepare */ + event_prepare(&conn); + + /* Tx Queue should have one LL Control PDU */ + lt_rx(LL_PERIODIC_SYNC_IND, &conn, &tx, &local_periodic_sync_ind); + lt_rx_q_is_empty(&conn); + + /* TX Ack */ + event_tx_ack(&conn, tx); + + /* Done */ + event_done(&conn); + + /* Release tx node */ + ull_cp_release_tx(&conn, tx); + + /* There should be no host notifications */ + ut_rx_q_is_empty(); + + /* Second attempt to run the periodic_sync completes immediately in idle state. + * The context is released just after that. + */ + zassert_equal(llcp_ctx_buffers_free(), test_ctx_buffers_cnt(), + "Free CTX buffers %d and ctx_buffers_cnt is %d", llcp_ctx_buffers_free(), + test_ctx_buffers_cnt()); +} + +/* + * +-----+ +-------+ +-----+ + * | UT | | LL_A | | LT | + * +-----+ +-------+ +-----+ + * | | | + * | | LL_PERIODIC_SYNC_IND | + * | | (Invalid PHY) | + * | |<----------------------- | + * | | | + * | | | + * | | | + * | | | + */ +ZTEST(periodic_sync_transfer, test_periodic_sync_transfer_invalid_phy) +{ + struct pdu_data_llctrl_periodic_sync_ind remote_periodic_sync_ind = { + .id = 0x01, + .conn_event_count = 0x00, + .last_pa_event_counter = 0x00, + .sid = 0x00, + .addr_type = 0x01, + .sca = 0x00, + .phy = 0x03, + .adv_addr = { 0, 0, 0, 0, 0, 0}, + .sync_conn_event_count = 0 + }; + + /* Reset and setup ull_sync_transfer_received fake */ + RESET_FAKE(ull_sync_transfer_received); + ull_sync_transfer_received_fake.custom_fake = ull_sync_transfer_received_custom_fake; + + RESET_FAKE(mayfly_enqueue); + mayfly_enqueue_fake .custom_fake = mayfly_enqueue_custom_fake; + + /* Initialise sync_info */ + memset(&remote_periodic_sync_ind.sync_info, 0, sizeof(struct pdu_adv_sync_info)); + + /* Role */ + test_set_role(&conn, BT_HCI_ROLE_CENTRAL); + + /* Connect */ + ull_cp_state_set(&conn, ULL_CP_CONNECTED); + conn.llcp.fex.features_peer |= BIT64(BT_LE_FEAT_BIT_PAST_RECV); + + /* Prepare */ + event_prepare(&conn); + + /* Rx */ + lt_tx(LL_PERIODIC_SYNC_IND, &conn, &remote_periodic_sync_ind); + + /* Done */ + event_done(&conn); + + /* Prepare */ + event_prepare(&conn); + + /* Tx Queue should have one LL Control PDU */ + lt_rx_q_is_empty(&conn); + + /* Done */ + event_done(&conn); + + /* There should not be a host notifications */ + ut_rx_q_is_empty(); + + zassert_equal(llcp_ctx_buffers_free(), test_ctx_buffers_cnt(), + "Free CTX buffers %d and ctx_buffers_cnt is %d", llcp_ctx_buffers_free(), + test_ctx_buffers_cnt()); + + /* Verify that ull_sync_transfer_received was not called, + * hence the phy invalidation mechanism works + */ + zassert_equal(ull_sync_transfer_received_fake.call_count, 0, + "ull_sync_transfer_received_fake.call_count is %d and expected: %d", + ull_sync_transfer_received_fake.call_count, 0); +} + +ZTEST_SUITE(periodic_sync_transfer, NULL, NULL, periodic_sync_setup, NULL, NULL); diff --git a/tests/bluetooth/controller/ctrl_periodic_sync/testcase.yaml b/tests/bluetooth/controller/ctrl_periodic_sync/testcase.yaml new file mode 100644 index 0000000000000..e82df79b5bfbb --- /dev/null +++ b/tests/bluetooth/controller/ctrl_periodic_sync/testcase.yaml @@ -0,0 +1,8 @@ +common: + tags: + - bluetooth + - bt_periodic_sync + - bt_ull_llcp +tests: + bluetooth.controller.ctrl_periodic_sync.test: + type: unit diff --git a/tests/bluetooth/controller/mock_ctrl/CMakeLists.txt b/tests/bluetooth/controller/mock_ctrl/CMakeLists.txt index 2e83b3d15d5f1..ccac7b9184af9 100644 --- a/tests/bluetooth/controller/mock_ctrl/CMakeLists.txt +++ b/tests/bluetooth/controller/mock_ctrl/CMakeLists.txt @@ -16,12 +16,16 @@ add_library(mocks STATIC src/assert.c src/util.c src/ticker.c + src/isoal.c src/ull.c src/ull_conn_iso.c src/ull_peripheral.c src/ull_peripheral_iso.c src/ull_central.c src/ull_scan.c + src/ull_sync.c + src/ull_adv_sync.c + src/ull_filter.c src/lll_clock.c ) diff --git a/tests/bluetooth/controller/mock_ctrl/include/hal/ticker_vendor_hal.h b/tests/bluetooth/controller/mock_ctrl/include/hal/ticker_vendor_hal.h index 503cd54aa9911..01713e3919d50 100644 --- a/tests/bluetooth/controller/mock_ctrl/include/hal/ticker_vendor_hal.h +++ b/tests/bluetooth/controller/mock_ctrl/include/hal/ticker_vendor_hal.h @@ -68,3 +68,30 @@ /* Macro defining the margin for positioning re-scheduled nodes */ #define HAL_TICKER_RESCHEDULE_MARGIN \ HAL_TICKER_US_TO_TICKS(150) + +/* Remove ticks and return positive remainder value in microseconds */ +static inline void hal_ticker_remove_jitter(uint32_t *ticks, + uint32_t *remainder) +{ + /* Is remainder less than 1 us */ + if ((*remainder & BIT(31)) || !(*remainder / HAL_TICKER_PSEC_PER_USEC)) { + *ticks -= 1U; + *remainder += HAL_TICKER_CNTR_CLK_UNIT_FSEC / HAL_TICKER_FSEC_PER_PSEC; + } + + /* pico seconds to micro seconds unit */ + *remainder /= HAL_TICKER_PSEC_PER_USEC; +} + +/* Add ticks and return positive remainder value in microseconds */ +static inline void hal_ticker_add_jitter(uint32_t *ticks, uint32_t *remainder) +{ + /* Is remainder less than 1 us */ + if ((*remainder & BIT(31)) || !(*remainder / HAL_TICKER_PSEC_PER_USEC)) { + *ticks += 1U; + *remainder += HAL_TICKER_CNTR_CLK_UNIT_FSEC / HAL_TICKER_FSEC_PER_PSEC; + } + + /* pico seconds to micro seconds unit */ + *remainder /= HAL_TICKER_PSEC_PER_USEC; +} diff --git a/tests/bluetooth/controller/mock_ctrl/include/lll/lll_adv_pdu.h b/tests/bluetooth/controller/mock_ctrl/include/lll/lll_adv_pdu.h index 5fe9872e5addb..b94a51c296061 100644 --- a/tests/bluetooth/controller/mock_ctrl/include/lll/lll_adv_pdu.h +++ b/tests/bluetooth/controller/mock_ctrl/include/lll/lll_adv_pdu.h @@ -113,5 +113,11 @@ static inline struct pdu_adv *lll_adv_sync_data_peek(struct lll_adv_sync *lll, v return (void *)lll->data.pdu[last]; } + +static inline struct pdu_adv *lll_adv_sync_data_curr_get(struct lll_adv_sync *lll) +{ + return (void *)lll->data.pdu[lll->data.first]; +} + #endif /* CONFIG_BT_CTLR_ADV_PERIODIC */ #endif /* CONFIG_BT_CTLR_ADV_EXT */ diff --git a/tests/bluetooth/controller/mock_ctrl/src/isoal.c b/tests/bluetooth/controller/mock_ctrl/src/isoal.c new file mode 100644 index 0000000000000..62b391babbe87 --- /dev/null +++ b/tests/bluetooth/controller/mock_ctrl/src/isoal.c @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2024 Demant A/S + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +uint32_t isoal_get_wrapped_time_us(uint32_t time_now_us, int32_t time_diff_us) +{ + return time_now_us; +} diff --git a/tests/bluetooth/controller/mock_ctrl/src/mayfly.c b/tests/bluetooth/controller/mock_ctrl/src/mayfly.c index cffb0b7a7205d..ddc58419fef20 100644 --- a/tests/bluetooth/controller/mock_ctrl/src/mayfly.c +++ b/tests/bluetooth/controller/mock_ctrl/src/mayfly.c @@ -25,7 +25,8 @@ uint32_t mayfly_is_enabled(uint8_t caller_id, uint8_t callee_id) return 0; } -uint32_t mayfly_enqueue(uint8_t caller_id, uint8_t callee_id, uint8_t chain, struct mayfly *m) +__weak uint32_t mayfly_enqueue(uint8_t caller_id, uint8_t callee_id, + uint8_t chain, struct mayfly *m) { return 0; } diff --git a/tests/bluetooth/controller/mock_ctrl/src/ticker.c b/tests/bluetooth/controller/mock_ctrl/src/ticker.c index 06518dcd6c672..2d5381eeeb17e 100644 --- a/tests/bluetooth/controller/mock_ctrl/src/ticker.c +++ b/tests/bluetooth/controller/mock_ctrl/src/ticker.c @@ -32,3 +32,18 @@ uint8_t ticker_stop(uint8_t instance_index, uint8_t user_id, uint8_t ticker_id, { return TICKER_STATUS_SUCCESS; } + +void ticker_job_sched(uint8_t instance_index, uint8_t user_id) +{ +} + +uint8_t ticker_next_slot_get_ext(uint8_t instance_index, uint8_t user_id, + uint8_t *ticker_id, uint32_t *ticks_current, + uint32_t *ticks_to_expire, + uint32_t *remainder, uint16_t *lazy, + ticker_op_match_func fp_match_op_func, + void *match_op_context, + ticker_op_func fp_op_func, void *op_context) +{ + return TICKER_STATUS_SUCCESS; +} diff --git a/tests/bluetooth/controller/mock_ctrl/src/ull.c b/tests/bluetooth/controller/mock_ctrl/src/ull.c index 2b9c671181365..4a070aabe0ff1 100644 --- a/tests/bluetooth/controller/mock_ctrl/src/ull.c +++ b/tests/bluetooth/controller/mock_ctrl/src/ull.c @@ -384,3 +384,15 @@ static inline void rx_alloc(uint8_t max) ll_rx_link_inc_quota(-1); } } + +#if defined(CONFIG_BT_CTLR_ISO) || \ + defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) || \ + defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) +uint32_t ull_get_wrapped_time_us(uint32_t time_now_us, int32_t time_diff_us) +{ + return 0; +} +#endif /* CONFIG_BT_CTLR_ISO || + * CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER || + * CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER + */ diff --git a/tests/bluetooth/controller/mock_ctrl/src/ull_adv_sync.c b/tests/bluetooth/controller/mock_ctrl/src/ull_adv_sync.c new file mode 100644 index 0000000000000..135c8b70c7ad2 --- /dev/null +++ b/tests/bluetooth/controller/mock_ctrl/src/ull_adv_sync.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2024 Demant A/S + * + * SPDX-License-Identifier: Apache-2.0 + */ + + +#include +#include + +#include + +#include "util/mem.h" +#include "util/memq.h" +#include "pdu_df.h" +#include "lll/pdu_vendor.h" +#include "pdu.h" + +#include "lll.h" + +struct ll_adv_sync_set *ull_adv_sync_get(uint8_t handle) +{ + return NULL; +} + +uint16_t ull_adv_sync_handle_get(const struct ll_adv_sync_set *sync) +{ + return 0; +} diff --git a/tests/bluetooth/controller/mock_ctrl/src/ull_filter.c b/tests/bluetooth/controller/mock_ctrl/src/ull_filter.c new file mode 100644 index 0000000000000..b45dbd5985b8b --- /dev/null +++ b/tests/bluetooth/controller/mock_ctrl/src/ull_filter.c @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * Copyright (c) 2016 Vinayak Kariappa Chettimada + * + * SPDX-License-Identifier: Apache-2.0 + */ + + +#include +#include + +#include + +#include "util/mem.h" +#include "util/memq.h" +#include "pdu_df.h" +#include "lll/pdu_vendor.h" +#include "pdu.h" + +#include "lll.h" +#include "lll_filter.h" + +static uint8_t bt_addr[BDADDR_SIZE] = { 0, 0, 0, 0, 0, 0}; + +#define BT_CTLR_RL_SIZE 8 + +uint8_t ll_rl_size_get(void) +{ + return BT_CTLR_RL_SIZE; +} + +uint8_t ull_filter_rl_find(uint8_t id_addr_type, uint8_t const *const id_addr, + uint8_t *const free_idx) +{ + return FILTER_IDX_NONE; +} + +void ull_filter_rpa_update(bool timeout) +{ + +} + +const uint8_t *ull_filter_tgta_get(uint8_t rl_idx) +{ + return bt_addr; +} diff --git a/tests/bluetooth/controller/mock_ctrl/src/ull_sync.c b/tests/bluetooth/controller/mock_ctrl/src/ull_sync.c new file mode 100644 index 0000000000000..dabbeb0286e4b --- /dev/null +++ b/tests/bluetooth/controller/mock_ctrl/src/ull_sync.c @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2016 Nordic Semiconductor ASA + * Copyright (c) 2016 Vinayak Kariappa Chettimada + * + * SPDX-License-Identifier: Apache-2.0 + */ + + +#include +#include +#include + +#include "hal/cpu.h" +#include "hal/ccm.h" + +#include "util/util.h" +#include "util/mem.h" +#include "util/memq.h" +#include "pdu_df.h" +#include "lll/pdu_vendor.h" +#include "pdu.h" + +#include "lll.h" +#include "lll/lll_adv_types.h" +#include "lll_adv.h" +#include "ull_adv_types.h" +#include "lll_sync.h" +#include "lll_sync_iso.h" +#include "ull_sync_types.h" + +#define BT_PER_ADV_SYNC_MAX 1 + +static struct ll_sync_set ll_sync[BT_PER_ADV_SYNC_MAX]; + +struct ll_sync_set *ull_sync_set_get(uint16_t handle) +{ + if (handle >= BT_PER_ADV_SYNC_MAX) { + return NULL; + } + + return &ll_sync[handle]; +} + +struct ll_sync_set *ull_sync_is_enabled_get(uint16_t handle) +{ + struct ll_sync_set *sync; + + sync = ull_sync_set_get(handle); + if (!sync) { + return NULL; + } + + return sync; +} + +uint16_t ull_sync_handle_get(struct ll_sync_set *sync) +{ + return 0; +} diff --git a/tests/bluetooth/controller/uut/CMakeLists.txt b/tests/bluetooth/controller/uut/CMakeLists.txt index 0f976a0a5dad5..41173f1b67db9 100644 --- a/tests/bluetooth/controller/uut/CMakeLists.txt +++ b/tests/bluetooth/controller/uut/CMakeLists.txt @@ -34,6 +34,12 @@ if (CONFIG_BT_CTLR_LE_ENC) ) endif() +if (CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER OR CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) + target_sources(uut PRIVATE + ${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/ull_llcp_past.c + ) +endif() + add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/controller/mock_ctrl mocks) From cb0e3a76462b96d36373e32545bb0b3ff845ab75 Mon Sep 17 00:00:00 2001 From: Lucas Mathias Balling Date: Fri, 4 Oct 2024 13:30:20 +0200 Subject: [PATCH 1423/4482] Bluetooth: Controller: Implement PAST support in ULL Implement PAST support in ULL and fixed test after changed dependencies in ull_sync_internal.c Signed-off-by: Lucas Mathias Balling --- subsys/bluetooth/controller/hci/hci.c | 222 +++++- subsys/bluetooth/controller/include/ll.h | 6 + subsys/bluetooth/controller/ll_sw/isoal.c | 8 +- subsys/bluetooth/controller/ll_sw/lll.h | 1 + .../bluetooth/controller/ll_sw/lll_filter.h | 1 + .../controller/ll_sw/nordic/lll/lll_adv_pdu.h | 5 + subsys/bluetooth/controller/ll_sw/ull.c | 60 +- .../bluetooth/controller/ll_sw/ull_adv_sync.c | 59 ++ .../bluetooth/controller/ll_sw/ull_central.c | 7 +- subsys/bluetooth/controller/ll_sw/ull_conn.c | 186 ++++- .../controller/ll_sw/ull_conn_internal.h | 7 + .../controller/ll_sw/ull_conn_types.h | 13 + .../bluetooth/controller/ll_sw/ull_filter.c | 14 + .../bluetooth/controller/ll_sw/ull_internal.h | 4 + subsys/bluetooth/controller/ll_sw/ull_llcp.c | 2 +- .../controller/ll_sw/ull_peripheral.c | 7 +- .../bluetooth/controller/ll_sw/ull_scan_aux.c | 20 +- .../controller/ll_sw/ull_scan_types.h | 5 - subsys/bluetooth/controller/ll_sw/ull_sync.c | 736 ++++++++++++++---- .../controller/ll_sw/ull_sync_internal.h | 18 +- .../bluetooth/controller/ll_sw/ull_sync_iso.c | 8 + .../controller/ll_sw/ull_sync_types.h | 18 +- .../df/connectionless_cte_rx/src/common.c | 4 + 23 files changed, 1204 insertions(+), 207 deletions(-) diff --git a/subsys/bluetooth/controller/hci/hci.c b/subsys/bluetooth/controller/hci/hci.c index 9217a0804d146..8fffa01a3feaf 100644 --- a/subsys/bluetooth/controller/hci/hci.c +++ b/subsys/bluetooth/controller/hci/hci.c @@ -1036,6 +1036,19 @@ static void read_supported_commands(struct net_buf *buf, struct net_buf **evt) #endif /* CONFIG_BT_CTLR_DF */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) + /* LE Periodic Advertising Sync Transfer */ + rp->commands[40] |= BIT(6); + /* LE Periodic Advertising Set Info Transfer */ + rp->commands[40] |= BIT(7); +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) + /* LE Set Periodic Advertising Sync Transfer Parameters */ + rp->commands[41] |= BIT(0); + /* LE Set Default Periodic Advertising Sync Transfer Parameters */ + rp->commands[41] |= BIT(1); +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ + #if defined(CONFIG_BT_HCI_RAW) && defined(CONFIG_BT_TINYCRYPT_ECC) bt_hci_ecc_supported_commands(rp->commands); #endif /* CONFIG_BT_HCI_RAW && CONFIG_BT_TINYCRYPT_ECC */ @@ -4081,6 +4094,110 @@ static void le_read_pal_size(struct net_buf *buf, struct net_buf **evt) #endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */ #endif /* CONFIG_BT_OBSERVER */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) +static void le_per_adv_sync_transfer(struct net_buf *buf, struct net_buf **evt) +{ + struct bt_hci_cp_le_per_adv_sync_transfer *cmd = (void *)buf->data; + struct bt_hci_rp_le_per_adv_sync_transfer *rp; + uint16_t conn_handle, conn_handle_le16; + uint16_t service_data; + uint16_t sync_handle; + uint8_t status; + + conn_handle_le16 = cmd->conn_handle; + + conn_handle = sys_le16_to_cpu(cmd->conn_handle); + service_data = sys_le16_to_cpu(cmd->service_data); + sync_handle = sys_le16_to_cpu(cmd->sync_handle); + + status = ll_sync_transfer(conn_handle, service_data, sync_handle); + + rp = hci_cmd_complete(evt, sizeof(*rp)); + rp->conn_handle = conn_handle_le16; + rp->status = status; +} + +static void le_per_adv_set_info_transfer(struct net_buf *buf, struct net_buf **evt) +{ + struct bt_hci_cp_le_per_adv_set_info_transfer *cmd = (void *)buf->data; + struct bt_hci_rp_le_per_adv_set_info_transfer *rp; + uint16_t conn_handle, conn_handle_le16; + uint16_t service_data; + uint8_t adv_handle; + uint8_t status; + + conn_handle_le16 = cmd->conn_handle; + + conn_handle = sys_le16_to_cpu(cmd->conn_handle); + service_data = sys_le16_to_cpu(cmd->service_data); + adv_handle = cmd->adv_handle; + + status = ll_adv_sync_set_info_transfer(conn_handle, service_data, adv_handle); + + rp = hci_cmd_complete(evt, sizeof(*rp)); + rp->conn_handle = conn_handle_le16; + rp->status = status; +} +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ + +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) +static void le_past_param(struct net_buf *buf, struct net_buf **evt) +{ + struct bt_hci_cp_le_past_param *cmd = (void *)buf->data; + struct bt_hci_rp_le_past_param *rp; + uint16_t conn_handle_le16; + uint16_t conn_handle; + uint16_t timeout; + uint8_t cte_type; + uint8_t status; + uint16_t skip; + uint8_t mode; + + if (adv_cmds_ext_check(evt)) { + return; + } + + conn_handle_le16 = cmd->conn_handle; + + conn_handle = sys_le16_to_cpu(cmd->conn_handle); + mode = cmd->mode; + skip = sys_le16_to_cpu(cmd->skip); + timeout = sys_le16_to_cpu(cmd->timeout); + cte_type = cmd->cte_type; + + status = ll_past_param(conn_handle, mode, skip, timeout, cte_type); + + rp = hci_cmd_complete(evt, sizeof(*rp)); + rp->conn_handle = conn_handle_le16; + rp->status = status; +} + +static void le_default_past_param(struct net_buf *buf, struct net_buf **evt) +{ + struct bt_hci_cp_le_default_past_param *cmd = (void *)buf->data; + struct bt_hci_rp_le_default_past_param *rp; + uint16_t timeout; + uint8_t cte_type; + uint8_t status; + uint16_t skip; + uint8_t mode; + + if (adv_cmds_ext_check(evt)) { + return; + } + + mode = cmd->mode; + skip = sys_le16_to_cpu(cmd->skip); + timeout = sys_le16_to_cpu(cmd->timeout); + cte_type = cmd->cte_type; + + status = ll_default_past_param(mode, skip, timeout, cte_type); + + rp = hci_cmd_complete(evt, sizeof(*rp)); + rp->status = status; +} +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ + #if defined(CONFIG_BT_CENTRAL) static void le_ext_create_connection(struct net_buf *buf, struct net_buf **evt) { @@ -4297,6 +4414,51 @@ static void le_cis_established(struct pdu_data *pdu_data, } #endif /* CONFIG_BT_CTLR_CONN_ISO */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) +static void le_per_adv_sync_transfer_received(struct pdu_data *pdu_data_rx, + struct node_rx_pdu *node_rx, struct net_buf *buf) +{ + struct bt_hci_evt_le_past_received *sep; + struct node_rx_past_received *se; + struct ll_sync_set *sync; + void *node; + + if (!(event_mask & BT_EVT_MASK_LE_META_EVENT) || + !(le_event_mask & BT_EVT_MASK_LE_PAST_RECEIVED)) { + return; + } + + sep = meta_evt(buf, BT_HCI_EVT_LE_PAST_RECEIVED, sizeof(*sep)); + + /* Check for pdu field being aligned before accessing PAST received + * event. + */ + node = pdu_data_rx; + LL_ASSERT(IS_PTR_ALIGNED(node, struct node_rx_past_received)); + + se = node; + sep->status = se->rx_sync.status; + + sync = node_rx->rx_ftr.param; + + /* Resolved address, if private, has been populated in ULL */ + sep->addr.type = sync->peer_id_addr_type; + if (sync->peer_addr_resolved) { + /* Mark it as identity address from RPA (0x02, 0x03) */ + MARK_AS_IDENTITY_ADDR(sep->addr.type); + } + (void)memcpy(sep->addr.a.val, sync->peer_id_addr, BDADDR_SIZE); + + sep->adv_sid = sync->sid; + sep->phy = find_lsb_set(se->rx_sync.phy); + sep->interval = sys_cpu_to_le16(se->rx_sync.interval); + sep->clock_accuracy = se->rx_sync.sca; + sep->conn_handle = sys_cpu_to_le16(se->conn_handle); + sep->service_data = sys_cpu_to_le16(se->service_data); + sep->sync_handle = sys_cpu_to_le16(node_rx->hdr.handle); +} +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ + static int controller_cmd_handle(uint16_t ocf, struct net_buf *cmd, struct net_buf **evt, void **node_rx) { @@ -4671,6 +4833,26 @@ static int controller_cmd_handle(uint16_t ocf, struct net_buf *cmd, #endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */ #endif /* CONFIG_BT_OBSERVER */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) + case BT_OCF(BT_HCI_OP_LE_PER_ADV_SYNC_TRANSFER): + le_per_adv_sync_transfer(cmd, evt); + break; + + case BT_OCF(BT_HCI_OP_LE_PER_ADV_SET_INFO_TRANSFER): + le_per_adv_set_info_transfer(cmd, evt); + break; +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ + +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) + case BT_OCF(BT_HCI_OP_LE_PAST_PARAM): + le_past_param(cmd, evt); + break; + + case BT_OCF(BT_HCI_OP_LE_DEFAULT_PAST_PARAM): + le_default_past_param(cmd, evt); + break; +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ + #if defined(CONFIG_BT_CONN) #if defined(CONFIG_BT_CENTRAL) case BT_OCF(BT_HCI_OP_LE_EXT_CREATE_CONN): @@ -6306,7 +6488,7 @@ static inline void le_dir_adv_report(struct pdu_adv *adv, struct net_buf *buf, ll_rl_id_addr_get(rl_idx, &dir_info->addr.type, &dir_info->addr.a.val[0]); /* Mark it as identity address from RPA (0x02, 0x03) */ - dir_info->addr.type += 2U; + MARK_AS_IDENTITY_ADDR(dir_info->addr.type); } else { #else if (1) { @@ -6466,7 +6648,7 @@ static void le_advertising_report(struct pdu_data *pdu_data, ll_rl_id_addr_get(rl_idx, &adv_info->addr.type, &adv_info->addr.a.val[0]); /* Mark it as identity address from RPA (0x02, 0x03) */ - adv_info->addr.type += 2U; + MARK_AS_IDENTITY_ADDR(adv_info->addr.type); } else { #else if (1) { @@ -6571,7 +6753,7 @@ static void le_ext_adv_legacy_report(struct pdu_data *pdu_data, ll_rl_id_addr_get(rl_idx, &adv_info->addr.type, &adv_info->addr.a.val[0]); /* Mark it as identity address from RPA (0x02, 0x03) */ - adv_info->addr.type += 2U; + MARK_AS_IDENTITY_ADDR(adv_info->addr.type); } else #endif /* CONFIG_BT_CTLR_PRIVACY */ { @@ -6763,7 +6945,7 @@ static void ext_adv_info_fill(uint8_t evt_type, uint8_t phy, uint8_t sec_phy, ll_rl_id_addr_get(rl_idx, &adv_info->addr.type, adv_info->addr.a.val); /* Mark it as identity address from RPA (0x02, 0x03) */ - adv_info->addr.type += 2U; + MARK_AS_IDENTITY_ADDR(adv_info->addr.type); #else /* !CONFIG_BT_CTLR_PRIVACY */ ARG_UNUSED(rl_idx); #endif /* !CONFIG_BT_CTLR_PRIVACY */ @@ -7438,7 +7620,7 @@ static void le_per_adv_sync_established(struct pdu_data *pdu_data, struct net_buf *buf) { struct bt_hci_evt_le_per_adv_sync_established *sep; - struct ll_scan_set *scan; + struct ll_sync_set *sync; struct node_rx_sync *se; void *node; @@ -7463,13 +7645,11 @@ static void le_per_adv_sync_established(struct pdu_data *pdu_data, return; } - scan = node_rx->rx_ftr.param; + sync = node_rx->rx_ftr.param; #if (CONFIG_BT_CTLR_DUP_FILTER_LEN > 0) && \ defined(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT) - dup_periodic_adv_reset(scan->periodic.adv_addr_type, - scan->periodic.adv_addr, - scan->periodic.sid); + dup_periodic_adv_reset(sync->peer_id_addr_type, sync->peer_id_addr, sync->sid); #endif /* CONFIG_BT_CTLR_DUP_FILTER_LEN > 0 && * CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT */ @@ -7477,10 +7657,14 @@ static void le_per_adv_sync_established(struct pdu_data *pdu_data, sep->handle = sys_cpu_to_le16(node_rx->hdr.handle); /* Resolved address, if private, has been populated in ULL */ - sep->adv_addr.type = scan->periodic.adv_addr_type; - (void)memcpy(sep->adv_addr.a.val, scan->periodic.adv_addr, BDADDR_SIZE); + sep->adv_addr.type = sync->peer_id_addr_type; + if (sync->peer_addr_resolved) { + /* Mark it as identity address from RPA (0x02, 0x03) */ + MARK_AS_IDENTITY_ADDR(sep->adv_addr.type); + } + (void)memcpy(sep->adv_addr.a.val, sync->peer_id_addr, BDADDR_SIZE); - sep->sid = scan->periodic.sid; + sep->sid = sync->sid; sep->phy = find_lsb_set(se->phy); sep->interval = sys_cpu_to_le16(se->interval); sep->clock_accuracy = se->sca; @@ -8077,7 +8261,7 @@ static void le_scan_req_received(struct pdu_data *pdu_data, ll_rl_id_addr_get(rl_idx, &sep->addr.type, &sep->addr.a.val[0]); /* Mark it as identity address from RPA (0x02, 0x03) */ - sep->addr.type += 2U; + MARK_AS_IDENTITY_ADDR(sep->addr.type); } else { #else if (1) { @@ -8117,7 +8301,7 @@ static void le_vs_scan_req_received(struct pdu_data *pdu, ll_rl_id_addr_get(rl_idx, &sep->addr.type, &sep->addr.a.val[0]); /* Mark it as identity address from RPA (0x02, 0x03) */ - sep->addr.type += 2U; + MARK_AS_IDENTITY_ADDR(sep->addr.type); } else { #else if (1) { @@ -8465,6 +8649,12 @@ static void encode_control(struct node_rx_pdu *node_rx, le_per_adv_sync_lost(pdu_data, node_rx, buf); break; +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) + case NODE_RX_TYPE_SYNC_TRANSFER_RECEIVED: + le_per_adv_sync_transfer_received(pdu_data, node_rx, buf); + return; +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ + #if defined(CONFIG_BT_CTLR_DF_SCAN_CTE_RX) case NODE_RX_TYPE_SYNC_IQ_SAMPLE_REPORT: #if defined(CONFIG_BT_CTLR_DF_VS_CL_IQ_REPORT_16_BITS_IQ_SAMPLES) @@ -9009,6 +9199,10 @@ uint8_t hci_get_class(struct node_rx_pdu *node_rx) case NODE_RX_TYPE_SYNC_REPORT: case NODE_RX_TYPE_SYNC_LOST: +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) + case NODE_RX_TYPE_SYNC_TRANSFER_RECEIVED: +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ + #if defined(CONFIG_BT_CTLR_DF_SCAN_CTE_RX) case NODE_RX_TYPE_SYNC_IQ_SAMPLE_REPORT: #endif /* CONFIG_BT_CTLR_DF_SCAN_CTE_RX */ diff --git a/subsys/bluetooth/controller/include/ll.h b/subsys/bluetooth/controller/include/ll.h index 464fcc94cf9f8..482a585e96212 100644 --- a/subsys/bluetooth/controller/include/ll.h +++ b/subsys/bluetooth/controller/include/ll.h @@ -135,6 +135,12 @@ uint8_t ll_sync_create(uint8_t options, uint8_t sid, uint8_t adv_addr_type, uint8_t ll_sync_create_cancel(void **rx); uint8_t ll_sync_terminate(uint16_t handle); uint8_t ll_sync_recv_enable(uint16_t handle, uint8_t enable); +uint8_t ll_sync_transfer(uint16_t conn_handle, uint16_t service_data, uint16_t sync_handle); +uint8_t ll_adv_sync_set_info_transfer(uint16_t conn_handle, uint16_t service_data, + uint8_t adv_handle); +uint8_t ll_past_param(uint16_t conn_handle, uint8_t mode, uint16_t skip, uint16_t timeout, + uint8_t cte_type); +uint8_t ll_default_past_param(uint8_t mode, uint16_t skip, uint16_t timeout, uint8_t cte_type); uint8_t ll_big_sync_create(uint8_t big_handle, uint16_t sync_handle, uint8_t encryption, uint8_t *bcode, uint8_t mse, uint16_t sync_timeout, uint8_t num_bis, diff --git a/subsys/bluetooth/controller/ll_sw/isoal.c b/subsys/bluetooth/controller/ll_sw/isoal.c index d0c5b1a75d32c..0d8c31f0538a4 100644 --- a/subsys/bluetooth/controller/ll_sw/isoal.c +++ b/subsys/bluetooth/controller/ll_sw/isoal.c @@ -33,6 +33,7 @@ #include "lll_iso_tx.h" #include "isoal.h" #include "ull_iso_types.h" +#include "ull_internal.h" #include @@ -134,12 +135,7 @@ isoal_status_t isoal_reset(void) */ uint32_t isoal_get_wrapped_time_us(uint32_t time_now_us, int32_t time_diff_us) { - LL_ASSERT(time_now_us <= ISOAL_TIME_WRAPPING_POINT_US); - - uint32_t result = ((uint64_t)time_now_us + ISOAL_TIME_SPAN_FULL_US + time_diff_us) % - ((uint64_t)ISOAL_TIME_SPAN_FULL_US); - - return result; + return ull_get_wrapped_time_us(time_now_us, time_diff_us); } /** diff --git a/subsys/bluetooth/controller/ll_sw/lll.h b/subsys/bluetooth/controller/ll_sw/lll.h index 4cecde96f8ebb..9a002e4852d36 100644 --- a/subsys/bluetooth/controller/ll_sw/lll.h +++ b/subsys/bluetooth/controller/ll_sw/lll.h @@ -319,6 +319,7 @@ enum node_rx_type { NODE_RX_TYPE_DTM_IQ_SAMPLE_REPORT, NODE_RX_TYPE_IQ_SAMPLE_REPORT_ULL_RELEASE, NODE_RX_TYPE_IQ_SAMPLE_REPORT_LLL_RELEASE, + NODE_RX_TYPE_SYNC_TRANSFER_RECEIVED, /* Signals retention (ie non-release) of rx node */ NODE_RX_TYPE_RETAIN, diff --git a/subsys/bluetooth/controller/ll_sw/lll_filter.h b/subsys/bluetooth/controller/ll_sw/lll_filter.h index e319d6251eb7a..efa07687f339a 100644 --- a/subsys/bluetooth/controller/ll_sw/lll_filter.h +++ b/subsys/bluetooth/controller/ll_sw/lll_filter.h @@ -100,6 +100,7 @@ extern uint8_t ull_filter_lll_fal_match(struct lll_filter const *const filter, uint8_t *devmatch_id); extern bool ull_filter_lll_lrpa_used(uint8_t rl_idx); extern bt_addr_t *ull_filter_lll_lrpa_get(uint8_t rl_idx); +extern bt_addr_t *ull_filter_lll_id_addr_get(uint8_t rl_idx, uint8_t *id_addr_type); extern uint8_t *ull_filter_lll_irks_get(uint8_t *count); extern uint8_t ull_filter_lll_rl_idx(bool fal, uint8_t devmatch_id); extern uint8_t ull_filter_lll_rl_irk_idx(uint8_t irkmatch_id); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_pdu.h b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_pdu.h index 5d36fd0598e01..5f2af58fc6a2e 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_pdu.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv_pdu.h @@ -195,6 +195,11 @@ lll_adv_sync_data_latest_peek(const struct lll_adv_sync *const lll) return lll_adv_pdu_latest_peek(&lll->data); } +static inline struct pdu_adv *lll_adv_sync_data_curr_get(struct lll_adv_sync *lll) +{ + return (void *)lll->data.pdu[lll->data.first]; +} + #if defined(CONFIG_BT_CTLR_ADV_EXT_PDU_EXTRA_DATA_MEMORY) static inline void *lll_adv_sync_extra_data_peek(struct lll_adv_sync *lll) { diff --git a/subsys/bluetooth/controller/ll_sw/ull.c b/subsys/bluetooth/controller/ll_sw/ull.c index 5cf20090a00a7..8b31ce846ab67 100644 --- a/subsys/bluetooth/controller/ll_sw/ull.c +++ b/subsys/bluetooth/controller/ll_sw/ull.c @@ -506,6 +506,16 @@ static struct { static MEMQ_DECLARE(ull_rx); static MEMQ_DECLARE(ll_rx); +#if defined(CONFIG_BT_CTLR_ISO) || \ + defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) || \ + defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) +#define ULL_TIME_WRAPPING_POINT_US (HAL_TICKER_TICKS_TO_US_64BIT(HAL_TICKER_CNTR_MASK)) +#define ULL_TIME_SPAN_FULL_US (ULL_TIME_WRAPPING_POINT_US + 1) +#endif /* CONFIG_BT_CTLR_ISO || + * CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER || + * CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER + */ + #if defined(CONFIG_BT_CONN) static MFIFO_DEFINE(ll_pdu_rx_free, sizeof(void *), LL_PDU_RX_CNT); @@ -1267,6 +1277,10 @@ void ll_rx_dequeue(void) /* fall through */ case NODE_RX_TYPE_SYNC: case NODE_RX_TYPE_SYNC_LOST: +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) + /* fall through */ + case NODE_RX_TYPE_SYNC_TRANSFER_RECEIVED: +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ #if defined(CONFIG_BT_CTLR_SYNC_ISO) /* fall through */ case NODE_RX_TYPE_SYNC_ISO: @@ -1544,6 +1558,9 @@ void ll_rx_mem_release(void **node_rx) break; #if defined(CONFIG_BT_CTLR_SYNC_PERIODIC) +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) + case NODE_RX_TYPE_SYNC_TRANSFER_RECEIVED: +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ case NODE_RX_TYPE_SYNC: { struct node_rx_sync *se = @@ -1558,21 +1575,15 @@ void ll_rx_mem_release(void **node_rx) (status == BT_HCI_ERR_UNSUPP_REMOTE_FEATURE) || (status == BT_HCI_ERR_CONN_FAIL_TO_ESTAB)) { struct ll_sync_set *sync; - struct ll_scan_set *scan; - /* pick the scan context before node_rx + /* pick the sync context before node_rx * release. */ - scan = (void *)rx_free->rx_ftr.param; + sync = (void *)rx_free->rx_ftr.param; ll_rx_release(rx_free); - /* pick the sync context before scan context - * is cleanup of sync context association. - */ - sync = scan->periodic.sync; - - ull_sync_setup_reset(scan); + ull_sync_setup_reset(sync); if (status != BT_HCI_ERR_SUCCESS) { memq_link_t *link_sync_lost; @@ -2812,6 +2823,14 @@ static inline void rx_demux_rx(memq_link_t *link, struct node_rx_hdr *rx) ull_sync_established_report(link, (struct node_rx_pdu *)rx); } break; +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) + case NODE_RX_TYPE_SYNC_TRANSFER_RECEIVED: + { + (void)memq_dequeue(memq_ull_rx.tail, &memq_ull_rx.head, NULL); + ll_rx_put_sched(link, rx); + } + break; +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ #endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */ #endif /* CONFIG_BT_CTLR_ADV_EXT */ #endif /* CONFIG_BT_OBSERVER */ @@ -3114,3 +3133,26 @@ void *ull_rxfifo_release(uint8_t s, uint8_t n, uint8_t f, uint8_t *l, uint8_t *m return rx; } + +#if defined(CONFIG_BT_CTLR_ISO) || \ + defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) || \ + defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) +/** + * @brief Wraps given time within the range of 0 to ULL_TIME_WRAPPING_POINT_US + * @param time_now Current time value + * @param time_diff Time difference (signed) + * @return Wrapped time after difference + */ +uint32_t ull_get_wrapped_time_us(uint32_t time_now_us, int32_t time_diff_us) +{ + LL_ASSERT(time_now_us <= ULL_TIME_WRAPPING_POINT_US); + + uint32_t result = ((uint64_t)time_now_us + ULL_TIME_SPAN_FULL_US + time_diff_us) % + ((uint64_t)ULL_TIME_SPAN_FULL_US); + + return result; +} +#endif /* CONFIG_BT_CTLR_ISO || + * CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER || + * CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER + */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv_sync.c b/subsys/bluetooth/controller/ll_sw/ull_adv_sync.c index c19ec42b64527..fb111a02f8b3a 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv_sync.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv_sync.c @@ -43,6 +43,14 @@ #include "ull_sched_internal.h" #include "ull_adv_internal.h" +#include "ull_conn_internal.h" + +#include "isoal.h" +#include "ull_iso_types.h" +#include "lll_conn_iso.h" +#include "ull_conn_iso_types.h" +#include "ull_llcp.h" + #include "ll.h" #include "hal/debug.h" @@ -621,6 +629,51 @@ uint8_t ll_adv_sync_enable(uint8_t handle, uint8_t enable) return 0; } +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) +/* @brief Link Layer interface function corresponding to HCI LE Periodic + * Advertising Set Info Transfer command. + * + * @param[in] conn_handle Connection_Handle identifying the connected device + * Range: 0x0000 to 0x0EFF. + * @param[in] service_data Service_Data value provided by the Host for use by the + * Host of the peer device. + * @param[in] adv_handle Advertising_Handle identifying the advertising + * set. Range: 0x00 to 0xEF. + * + * @return HCI error codes as documented in Bluetooth Core Specification v5.4. + */ +uint8_t ll_adv_sync_set_info_transfer(uint16_t conn_handle, uint16_t service_data, + uint8_t adv_handle) +{ + struct ll_adv_sync_set *sync; + struct ll_adv_set *adv; + struct ll_conn *conn; + + conn = ll_connected_get(conn_handle); + if (!conn) { + return BT_HCI_ERR_UNKNOWN_CONN_ID; + } + + /* Verify that adv_handle is valid and periodic advertising is enabled */ + adv = ull_adv_is_created_get(adv_handle); + if (!adv) { + return BT_HCI_ERR_UNKNOWN_ADV_IDENTIFIER; + } + + if (!adv->lll.sync) { + return BT_HCI_ERR_CMD_DISALLOWED; + } + + sync = HDR_LLL2ULL(adv->lll.sync); + if (!sync->is_enabled) { + return BT_HCI_ERR_CMD_DISALLOWED; + } + + /* Call llcp to start LLCP_PERIODIC_SYNC_IND */ + return ull_cp_periodic_sync(conn, NULL, sync, service_data); +} +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ + int ull_adv_sync_init(void) { int err; @@ -945,8 +998,10 @@ void ull_adv_sync_pdu_init(struct pdu_adv *pdu, uint8_t ext_hdr_flags, { struct pdu_adv_com_ext_adv *com_hdr; struct pdu_adv_ext_hdr *ext_hdr; +#if defined(CONFIG_BT_CTLR_ADV_SYNC_PDU_BACK2BACK) struct pdu_adv_aux_ptr *aux_ptr; uint32_t cte_len_us; +#endif uint8_t *dptr; uint8_t len; @@ -971,6 +1026,7 @@ void ull_adv_sync_pdu_init(struct pdu_adv *pdu, uint8_t ext_hdr_flags, #endif /* CONFIG_BT_CTLR_ADV_PERIODIC_ADI_SUPPORT */ ULL_ADV_PDU_HDR_FIELD_SYNC_INFO))); +#if defined(CONFIG_BT_CTLR_ADV_SYNC_PDU_BACK2BACK) if (IS_ENABLED(CONFIG_BT_CTLR_DF_ADV_CTE_TX) && (ext_hdr_flags & ULL_ADV_PDU_HDR_FIELD_CTE_INFO)) { (void)memcpy(dptr, cte_info, sizeof(*cte_info)); @@ -979,15 +1035,18 @@ void ull_adv_sync_pdu_init(struct pdu_adv *pdu, uint8_t ext_hdr_flags, } else { cte_len_us = 0U; } +#endif /* CONFIG_BT_CTLR_ADV_SYNC_PDU_BACK2BACK */ if (IS_ENABLED(CONFIG_BT_CTLR_ADV_PERIODIC_ADI_SUPPORT) && (ext_hdr_flags & ULL_ADV_PDU_HDR_FIELD_ADI)) { dptr += sizeof(struct pdu_adv_adi); } +#if defined(CONFIG_BT_CTLR_ADV_SYNC_PDU_BACK2BACK) if (IS_ENABLED(CONFIG_BT_CTLR_ADV_SYNC_PDU_LINK) && (ext_hdr_flags & ULL_ADV_PDU_HDR_FIELD_AUX_PTR)) { aux_ptr = (void *)dptr; dptr += sizeof(struct pdu_adv_aux_ptr); } +#endif /* CONFIG_BT_CTLR_ADV_SYNC_PDU_BACK2BACK */ if (ext_hdr_flags & ULL_ADV_PDU_HDR_FIELD_TX_POWER) { dptr += sizeof(uint8_t); } diff --git a/subsys/bluetooth/controller/ll_sw/ull_central.c b/subsys/bluetooth/controller/ll_sw/ull_central.c index 105507b0466e5..d5414be527634 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_central.c +++ b/subsys/bluetooth/controller/ll_sw/ull_central.c @@ -722,7 +722,7 @@ void ull_central_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr, ll_rl_id_addr_get(rl_idx, &cc->peer_addr_type, &cc->peer_addr[0]); /* Mark it as identity address from RPA (0x02, 0x03) */ - cc->peer_addr_type += 2; + MARK_AS_IDENTITY_ADDR(cc->peer_addr_type); /* Store peer RPA */ memcpy(&cc->peer_rpa[0], &peer_addr[0], BDADDR_SIZE); @@ -749,6 +749,11 @@ void ull_central_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr, /* Set LLCP as connection-wise connected */ ull_cp_state_set(conn, ULL_CP_CONNECTED); +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) + /* Set default PAST parameters */ + conn->past = ull_conn_default_past_param_get(); +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ + #if defined(CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL) lll->tx_pwr_lvl = RADIO_TXP_DEFAULT; #endif /* CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn.c b/subsys/bluetooth/controller/ll_sw/ull_conn.c index 1af9bacea20c7..7335473556d63 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn.c +++ b/subsys/bluetooth/controller/ll_sw/ull_conn.c @@ -57,7 +57,16 @@ #include "ull_iso_internal.h" #include "ull_conn_iso_internal.h" #include "ull_peripheral_iso_internal.h" - +#include "lll/lll_adv_types.h" +#include "lll_adv.h" +#include "ull_adv_types.h" +#include "ull_adv_internal.h" +#include "lll_sync.h" +#include "lll_sync_iso.h" +#include "ull_sync_types.h" +#include "lll_scan.h" +#include "ull_scan_types.h" +#include "ull_sync_internal.h" #include "ll.h" #include "ll_feat.h" @@ -147,6 +156,10 @@ static uint8_t default_phy_tx; static uint8_t default_phy_rx; #endif /* CONFIG_BT_CTLR_PHY */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) +static struct past_params default_past_params; +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ + static struct ll_conn conn_pool[CONFIG_BT_MAX_CONN]; static void *conn_free; @@ -795,6 +808,22 @@ uint8_t ull_conn_default_phy_rx_get(void) } #endif /* CONFIG_BT_CTLR_PHY */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) +void ull_conn_default_past_param_set(uint8_t mode, uint16_t skip, uint16_t timeout, + uint8_t cte_type) +{ + default_past_params.mode = mode; + default_past_params.skip = skip; + default_past_params.timeout = timeout; + default_past_params.cte_type = cte_type; +} + +struct past_params ull_conn_default_past_param_get(void) +{ + return default_past_params; +} +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ + #if defined(CONFIG_BT_CTLR_CHECK_SAME_PEER_CONN) bool ull_conn_peer_connected(uint8_t const own_id_addr_type, uint8_t const *const own_id_addr, @@ -958,6 +987,10 @@ void ull_conn_done(struct node_rx_event_done *done) ull_cp_tx_ntf(conn); +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) + ull_lp_past_conn_evt_done(conn, done); +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ + #if defined(CONFIG_BT_CTLR_LE_ENC) /* Check authenticated payload expiry or MIC failure */ switch (done->extra.mic_state) { @@ -1625,6 +1658,10 @@ static int init_reset(void) #endif /* CONFIG_BT_CTLR_PHY_CODED */ #endif /* CONFIG_BT_CTLR_PHY */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) + memset(&default_past_params, 0, sizeof(struct past_params)); +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ + return 0; } @@ -2563,6 +2600,153 @@ void ull_conn_default_tx_time_set(uint16_t tx_time) } #endif /* CONFIG_BT_CTLR_DATA_LENGTH */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) +static bool ticker_op_id_match_func(uint8_t ticker_id, uint32_t ticks_slot, + uint32_t ticks_to_expire, void *op_context) +{ + ARG_UNUSED(ticks_slot); + ARG_UNUSED(ticks_to_expire); + + uint8_t match_id = *(uint8_t *)op_context; + + return ticker_id == match_id; +} + +static void ticker_get_offset_op_cb(uint32_t status, void *param) +{ + *((uint32_t volatile *)param) = status; +} + +static uint32_t get_ticker_offset(uint8_t ticker_id, uint16_t *lazy) +{ + uint32_t volatile ret_cb; + uint32_t ticks_to_expire; + uint32_t ticks_current; + uint32_t sync_remainder_us; + uint32_t remainder; + uint32_t start_us; + uint32_t ret; + uint8_t id; + + id = TICKER_NULL; + ticks_to_expire = 0U; + ticks_current = 0U; + + ret_cb = TICKER_STATUS_BUSY; + + ret = ticker_next_slot_get_ext(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_LOW, + &id, &ticks_current, &ticks_to_expire, &remainder, + lazy, ticker_op_id_match_func, &ticker_id, + ticker_get_offset_op_cb, (void *)&ret_cb); + + if (ret == TICKER_STATUS_BUSY) { + while (ret_cb == TICKER_STATUS_BUSY) { + ticker_job_sched(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_LOW); + } + } + + LL_ASSERT(ret_cb == TICKER_STATUS_SUCCESS); + + /* Reduced a tick for negative remainder and return positive remainder + * value. + */ + hal_ticker_remove_jitter(&ticks_to_expire, &remainder); + sync_remainder_us = remainder; + + /* Add a tick for negative remainder and return positive remainder + * value. + */ + hal_ticker_add_jitter(&ticks_to_expire, &remainder); + start_us = remainder; + + return ull_get_wrapped_time_us(HAL_TICKER_TICKS_TO_US(ticks_to_expire), + (sync_remainder_us - start_us)); +} + +static void mfy_past_sender_offset_get(void *param) +{ + uint16_t last_pa_event_counter; + uint32_t ticker_offset_us; + uint16_t pa_event_counter; + uint8_t adv_sync_handle; + uint16_t sync_handle; + struct ll_conn *conn; + uint16_t lazy; + + conn = param; + + /* Get handle to look for */ + ull_lp_past_offset_get_calc_params(conn, &adv_sync_handle, &sync_handle); + + if (adv_sync_handle == BT_HCI_ADV_HANDLE_INVALID && + sync_handle == BT_HCI_SYNC_HANDLE_INVALID) { + /* Procedure must have been aborted, do nothing */ + return; + } + + if (adv_sync_handle != BT_HCI_ADV_HANDLE_INVALID) { + const struct ll_adv_sync_set *adv_sync = ull_adv_sync_get(adv_sync_handle); + + LL_ASSERT(adv_sync); + + ticker_offset_us = get_ticker_offset(TICKER_ID_ADV_SYNC_BASE + adv_sync_handle, + &lazy); + + pa_event_counter = adv_sync->lll.event_counter; + last_pa_event_counter = pa_event_counter - 1; + } else { + const struct ll_sync_set *sync = ull_sync_is_enabled_get(sync_handle); + uint32_t interval_us = sync->interval * PERIODIC_INT_UNIT_US; + uint32_t window_widening_event_us; + + LL_ASSERT(sync); + + ticker_offset_us = get_ticker_offset(TICKER_ID_SCAN_SYNC_BASE + sync_handle, + &lazy); + + if (lazy && ticker_offset_us > interval_us) { + + /* Figure out how many events we have actually skipped */ + lazy = lazy - (ticker_offset_us / interval_us); + + /* Correct offset to point to next event */ + ticker_offset_us = ticker_offset_us % interval_us; + } + + /* Calculate window widening for next event */ + window_widening_event_us = sync->lll.window_widening_event_us + + sync->lll.window_widening_periodic_us * (lazy + 1U); + + /* Correct for window widening */ + ticker_offset_us += window_widening_event_us; + + pa_event_counter = sync->lll.event_counter + lazy; + + last_pa_event_counter = pa_event_counter - 1 - lazy; + + /* Handle unsuccessful events */ + if (sync->timeout_expire) { + last_pa_event_counter -= sync->timeout_reload - sync->timeout_expire; + } + } + + ull_lp_past_offset_calc_reply(conn, ticker_offset_us, pa_event_counter, + last_pa_event_counter); +} + +void ull_conn_past_sender_offset_request(struct ll_conn *conn) +{ + static memq_link_t link; + static struct mayfly mfy = {0, 0, &link, NULL, mfy_past_sender_offset_get}; + uint32_t ret; + + mfy.param = conn; + ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1, + &mfy); + LL_ASSERT(!ret); +} +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ + uint8_t ull_conn_lll_phy_active(struct ll_conn *conn, uint8_t phys) { #if defined(CONFIG_BT_CTLR_PHY) diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn_internal.h b/subsys/bluetooth/controller/ll_sw/ull_conn_internal.h index 69b18bde3fe6f..dad6d5e29e0e1 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn_internal.h +++ b/subsys/bluetooth/controller/ll_sw/ull_conn_internal.h @@ -17,6 +17,9 @@ uint16_t ull_conn_default_tx_octets_get(void); uint16_t ull_conn_default_tx_time_get(void); uint8_t ull_conn_default_phy_tx_get(void); uint8_t ull_conn_default_phy_rx_get(void); +void ull_conn_default_past_param_set(uint8_t mode, uint16_t skip, uint16_t timeout, + uint8_t cte_type); +struct past_params ull_conn_default_past_param_get(void); bool ull_conn_peer_connected(uint8_t const own_id_addr_type, uint8_t const *const own_id_addr, uint8_t const peer_id_addr_type, @@ -77,6 +80,10 @@ static inline void cpr_active_reset(void) } #endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) +void ull_conn_past_sender_offset_request(struct ll_conn *conn); +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ + uint16_t ull_conn_event_counter(struct ll_conn *conn); void ull_conn_update_parameters(struct ll_conn *conn, uint8_t is_cu_proc, diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn_types.h b/subsys/bluetooth/controller/ll_sw/ull_conn_types.h index ac466b73dc622..4b77c22b49991 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn_types.h +++ b/subsys/bluetooth/controller/ll_sw/ull_conn_types.h @@ -154,10 +154,23 @@ struct llcp_struct { }; /* struct llcp_struct */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) +struct past_params { + uint8_t mode; + uint8_t cte_type; + uint16_t skip; + uint16_t timeout; +}; /* struct past_params */ +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ + struct ll_conn { struct ull_hdr ull; struct lll_conn lll; +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) + struct past_params past; +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ + struct ull_tx_q tx_q; struct llcp_struct llcp; diff --git a/subsys/bluetooth/controller/ll_sw/ull_filter.c b/subsys/bluetooth/controller/ll_sw/ull_filter.c index 3bf2bef05670b..a0419010a2c6e 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_filter.c +++ b/subsys/bluetooth/controller/ll_sw/ull_filter.c @@ -859,6 +859,20 @@ bt_addr_t *ull_filter_lll_lrpa_get(uint8_t rl_idx) return rl[rl_idx].local_rpa; } +bt_addr_t *ull_filter_lll_id_addr_get(uint8_t rl_idx, uint8_t *id_addr_type) +{ + struct lll_resolve_list *rl_entry; + + if (rl_idx >= ARRAY_SIZE(rl)) { + return NULL; + } + + rl_entry = &rl[rl_idx]; + *id_addr_type = rl_entry->id_addr_type; + + return &rl_entry->id_addr; +} + uint8_t *ull_filter_lll_irks_get(uint8_t *count) { *count = peer_irk_count; diff --git a/subsys/bluetooth/controller/ll_sw/ull_internal.h b/subsys/bluetooth/controller/ll_sw/ull_internal.h index e2cdaa4181403..8218d1da61bd0 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_internal.h +++ b/subsys/bluetooth/controller/ll_sw/ull_internal.h @@ -45,6 +45,9 @@ extern bool ull_handle_cpr_anchor_point_move(struct ll_conn *conn, uint16_t *off /* Macro to convert time in us to periodic advertising interval units */ #define RADIO_SYNC_EVENTS(x, y) ((uint16_t)DIV_ROUND_UP(x, y)) +/* Macro to mark address type as identity address from RPA (0x02, 0x03) */ +#define MARK_AS_IDENTITY_ADDR(addr_type) ((addr_type) += 2U) + static inline uint8_t ull_ref_get(struct ull_hdr *hdr) { return hdr->ref; @@ -170,3 +173,4 @@ void ull_rxfifo_alloc(uint8_t s, uint8_t n, uint8_t f, uint8_t *l, uint8_t *m, void *mem_free, void *link_free, uint8_t max); void *ull_rxfifo_release(uint8_t s, uint8_t n, uint8_t f, uint8_t *l, uint8_t *m, memq_link_t *link, struct node_rx_hdr *rx); +uint32_t ull_get_wrapped_time_us(uint32_t time_now_us, int32_t time_diff_us); diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp.c b/subsys/bluetooth/controller/ll_sw/ull_llcp.c index 1540f043cb301..14754090934fc 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp.c @@ -1520,7 +1520,7 @@ void ull_lp_past_conn_evt_done(struct ll_conn *conn, struct node_rx_event_done * if (conn->lll.role == BT_HCI_ROLE_PERIPHERAL && done->extra.trx_cnt) { uint32_t start_to_actual_us; - start_to_actual_us = isoal_get_wrapped_time_us( + start_to_actual_us = ull_get_wrapped_time_us( done->extra.drift.start_to_address_actual_us, (-done->extra.drift.preamble_to_addr_us)); diff --git a/subsys/bluetooth/controller/ll_sw/ull_peripheral.c b/subsys/bluetooth/controller/ll_sw/ull_peripheral.c index cb2eda865927b..0aa64d1afd36e 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_peripheral.c +++ b/subsys/bluetooth/controller/ll_sw/ull_peripheral.c @@ -109,7 +109,7 @@ void ull_periph_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr, /* Get identity address */ ll_rl_id_addr_get(rl_idx, &peer_addr_type, peer_id_addr); /* Mark it as identity address from RPA (0x02, 0x03) */ - peer_addr_type += 2; + MARK_AS_IDENTITY_ADDR(peer_addr_type); } else { #else /* CONFIG_BT_CTLR_PRIVACY */ if (1) { @@ -144,6 +144,11 @@ void ull_periph_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr, sizeof(conn->own_id_addr)); #endif /* CONFIG_BT_CTLR_CHECK_SAME_PEER_CONN */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) + /* Set default PAST parameters */ + conn->past = ull_conn_default_past_param_get(); +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ + memcpy(&lll->crc_init[0], &pdu_adv->connect_ind.crc_init[0], 3); memcpy(&lll->access_addr[0], &pdu_adv->connect_ind.access_addr[0], 4); memcpy(&lll->data_chan_map[0], &pdu_adv->connect_ind.chan_map[0], diff --git a/subsys/bluetooth/controller/ll_sw/ull_scan_aux.c b/subsys/bluetooth/controller/ll_sw/ull_scan_aux.c index 93a826506cddb..ee84bba6e53b5 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_scan_aux.c +++ b/subsys/bluetooth/controller/ll_sw/ull_scan_aux.c @@ -5,6 +5,7 @@ */ #include +#include #include #include "util/mem.h" @@ -28,14 +29,27 @@ #include "lll_scan_aux.h" #include "lll/lll_df_types.h" #include "lll_conn.h" +#include "lll_conn_iso.h" #include "lll_sync.h" #include "lll_sync_iso.h" +#include "lll/lll_adv_types.h" +#include "lll_adv.h" +#include "lll/lll_adv_pdu.h" +#include "ll_sw/ull_tx_queue.h" + +#include "isoal.h" #include "ull_scan_types.h" +#include "ull_conn_types.h" +#include "ull_iso_types.h" +#include "ull_conn_iso_types.h" #include "ull_sync_types.h" +#include "ull_adv_types.h" +#include "ull_adv_internal.h" #include "ull_internal.h" #include "ull_scan_internal.h" +#include "ull_conn_internal.h" #include "ull_sync_internal.h" #include "ull_sync_iso_internal.h" #include "ull_df_internal.h" @@ -377,10 +391,10 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) if (sync && (scan->periodic.state != LL_SYNC_STATE_CREATED)) { /* Check address and update internal state */ #if defined(CONFIG_BT_CTLR_PRIVACY) - ull_sync_setup_addr_check(scan, pdu->tx_addr, ptr, + ull_sync_setup_addr_check(sync, scan, pdu->tx_addr, ptr, ftr->rl_idx); #else /* !CONFIG_BT_CTLR_PRIVACY */ - ull_sync_setup_addr_check(scan, pdu->tx_addr, ptr, 0U); + ull_sync_setup_addr_check(sync, scan, pdu->tx_addr, ptr, 0U); #endif /* !CONFIG_BT_CTLR_PRIVACY */ } @@ -420,7 +434,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) * Periodic Advertiser List or with the explicitly supplied. */ if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) && aux && sync && adi && - ull_sync_setup_sid_match(scan, PDU_ADV_ADI_SID_GET(adi))) { + ull_sync_setup_sid_match(sync, scan, PDU_ADV_ADI_SID_GET(adi))) { ull_sync_setup(scan, aux, rx, si); } } diff --git a/subsys/bluetooth/controller/ll_sw/ull_scan_types.h b/subsys/bluetooth/controller/ll_sw/ull_scan_types.h index 41c2bbd4628dc..ab91448f34cf3 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_scan_types.h +++ b/subsys/bluetooth/controller/ll_sw/ull_scan_types.h @@ -22,15 +22,10 @@ struct ll_scan_set { #if defined(CONFIG_BT_CTLR_SYNC_PERIODIC) struct { - uint8_t sid; - - uint8_t adv_addr_type:2; uint8_t filter_policy:1; uint8_t cancelled:1; uint8_t state:2; - uint8_t adv_addr[BDADDR_SIZE]; - /* Non-Null when creating sync, reset in ISR context on * synchronisation state and checked in Thread context when * cancelling sync create, hence the volatile keyword. diff --git a/subsys/bluetooth/controller/ll_sw/ull_sync.c b/subsys/bluetooth/controller/ll_sw/ull_sync.c index 900e35cecd657..e151f9b8f4703 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sync.c +++ b/subsys/bluetooth/controller/ll_sw/ull_sync.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include #include #include @@ -27,25 +28,41 @@ #include "pdu.h" #include "lll.h" +#include "lll/lll_adv_types.h" +#include "lll_adv.h" +#include "lll/lll_adv_pdu.h" #include "lll_clock.h" #include "lll/lll_vendor.h" #include "lll_chan.h" #include "lll_scan.h" #include "lll/lll_df_types.h" #include "lll_conn.h" +#include "lll_conn_iso.h" #include "lll_sync.h" #include "lll_sync_iso.h" +#include "isoal.h" + +#include "ull_tx_queue.h" + #include "ull_filter.h" +#include "ull_iso_types.h" #include "ull_scan_types.h" #include "ull_sync_types.h" +#include "ull_conn_types.h" +#include "ull_adv_types.h" +#include "ull_conn_iso_types.h" #include "ull_internal.h" +#include "ull_adv_internal.h" #include "ull_scan_internal.h" #include "ull_sync_internal.h" +#include "ull_conn_internal.h" +#include "ull_conn_iso_internal.h" #include "ull_df_types.h" #include "ull_df_internal.h" +#include "ull_llcp.h" #include "ll.h" #include @@ -59,6 +76,8 @@ */ MEM_FREE_MEMBER_ACCESS_BUILD_ASSERT(struct ll_sync_set, timeout_reload); +static struct ll_sync_set *ull_sync_create(uint8_t sid, uint16_t timeout, uint16_t skip, + uint8_t cte_type, uint8_t rx_enable, uint8_t nodups); static int init_reset(void); static inline struct ll_sync_set *sync_acquire(void); static void sync_ticker_cleanup(struct ll_sync_set *sync, ticker_op_func stop_op_cb); @@ -98,12 +117,10 @@ uint8_t ll_sync_create(uint8_t options, uint8_t sid, uint8_t adv_addr_type, uint16_t sync_timeout, uint8_t sync_cte_type) { struct ll_scan_set *scan_coded; - memq_link_t *link_sync_estab; - memq_link_t *link_sync_lost; - struct node_rx_pdu *node_rx; - struct lll_sync *lll_sync; struct ll_scan_set *scan; struct ll_sync_set *sync; + uint8_t rx_enable; + uint8_t nodups; scan = ull_scan_set_get(SCAN_HANDLE_1M); if (!scan || scan->periodic.sync) { @@ -125,32 +142,11 @@ uint8_t ll_sync_create(uint8_t options, uint8_t sid, uint8_t adv_addr_type, } #endif /* CONFIG_BT_CTLR_CHECK_SAME_PEER_SYNC */ - link_sync_estab = ll_rx_link_alloc(); - if (!link_sync_estab) { - return BT_HCI_ERR_MEM_CAPACITY_EXCEEDED; - } - - link_sync_lost = ll_rx_link_alloc(); - if (!link_sync_lost) { - ll_rx_link_release(link_sync_estab); + rx_enable = !(options & BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_REPORTS_DISABLED); + nodups = (options & BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_FILTER_DUPLICATE) ? 1U : 0U; - return BT_HCI_ERR_MEM_CAPACITY_EXCEEDED; - } - - node_rx = ll_rx_alloc(); - if (!node_rx) { - ll_rx_link_release(link_sync_lost); - ll_rx_link_release(link_sync_estab); - - return BT_HCI_ERR_MEM_CAPACITY_EXCEEDED; - } - - sync = sync_acquire(); + sync = ull_sync_create(sid, sync_timeout, skip, sync_cte_type, rx_enable, nodups); if (!sync) { - ll_rx_release(node_rx); - ll_rx_link_release(link_sync_lost); - ll_rx_link_release(link_sync_estab); - return BT_HCI_ERR_MEM_CAPACITY_EXCEEDED; } @@ -166,55 +162,10 @@ uint8_t ll_sync_create(uint8_t options, uint8_t sid, uint8_t adv_addr_type, } if (!scan->periodic.filter_policy) { - scan->periodic.sid = sid; - scan->periodic.adv_addr_type = adv_addr_type; - (void)memcpy(scan->periodic.adv_addr, adv_addr, BDADDR_SIZE); - - if (IS_ENABLED(CONFIG_BT_CTLR_PHY_CODED)) { - scan_coded->periodic.sid = scan->periodic.sid; - scan_coded->periodic.adv_addr_type = - scan->periodic.adv_addr_type; - (void)memcpy(scan_coded->periodic.adv_addr, - scan->periodic.adv_addr, BDADDR_SIZE); - } + sync->peer_id_addr_type = adv_addr_type; + (void)memcpy(sync->peer_id_addr, adv_addr, BDADDR_SIZE); } - /* Initialize sync context */ - node_rx->hdr.link = link_sync_estab; - sync->node_rx_lost.rx.hdr.link = link_sync_lost; - - /* Make sure that the node_rx_sync_establ hasn't got anything assigned. It is used to - * mark when sync establishment is in progress. - */ - LL_ASSERT(!sync->node_rx_sync_estab); - sync->node_rx_sync_estab = node_rx; - - /* Reporting initially enabled/disabled */ - sync->rx_enable = - !(options & BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_REPORTS_DISABLED); - -#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT) - sync->nodups = (options & - BT_HCI_LE_PER_ADV_CREATE_SYNC_FP_FILTER_DUPLICATE) ? - 1U : 0U; -#endif - sync->skip = skip; - sync->is_stop = 0U; - -#if defined(CONFIG_BT_CTLR_SYNC_ISO) - sync->enc = 0U; -#endif /* CONFIG_BT_CTLR_SYNC_ISO */ - - /* NOTE: Use timeout not zero to represent sync context used for sync - * create. - */ - sync->timeout = sync_timeout; - - /* NOTE: Use timeout_reload not zero to represent sync established. */ - sync->timeout_reload = 0U; - sync->timeout_expire = 0U; - -#if defined(CONFIG_BT_CTLR_CHECK_SAME_PEER_SYNC) /* Remember the peer address when periodic advertiser list is not * used. * NOTE: Peer address will be filled/overwritten with correct identity @@ -226,42 +177,11 @@ uint8_t ll_sync_create(uint8_t options, uint8_t sid, uint8_t adv_addr_type, sizeof(sync->peer_id_addr)); } - /* Remember the SID */ - sync->sid = sid; -#endif /* CONFIG_BT_CTLR_CHECK_SAME_PEER_SYNC */ - -#if defined(CONFIG_BT_CTLR_SYNC_ISO) - /* Reset Broadcast Isochronous Group Sync Establishment */ - sync->iso.sync_iso = NULL; -#endif /* CONFIG_BT_CTLR_SYNC_ISO */ - - /* Initialize sync LLL context */ - lll_sync = &sync->lll; - lll_sync->lll_aux = NULL; - lll_sync->is_rx_enabled = sync->rx_enable; - lll_sync->skip_prepare = 0U; - lll_sync->skip_event = 0U; - lll_sync->window_widening_prepare_us = 0U; - lll_sync->window_widening_event_us = 0U; #if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING) - lll_sync->cte_type = sync_cte_type; - lll_sync->filter_policy = scan->periodic.filter_policy; + /* Set filter policy in lll_sync */ + sync->lll.filter_policy = scan->periodic.filter_policy; #endif /* CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING */ -#if defined(CONFIG_BT_CTLR_DF_SCAN_CTE_RX) - ull_df_sync_cfg_init(&lll_sync->df_cfg); - LL_ASSERT(!lll_sync->node_cte_incomplete); -#endif /* CONFIG_BT_CTLR_DF_SCAN_CTE_RX */ - - /* Initialise ULL and LLL headers */ - ull_hdr_init(&sync->ull); - lll_hdr_init(lll_sync, sync); - -#if defined(CONFIG_BT_CTLR_SCAN_AUX_SYNC_RESERVE_MIN) - /* Initialise LLL abort count */ - lll_sync->abort_count = 0U; -#endif /* CONFIG_BT_CTLR_SCAN_AUX_SYNC_RESERVE_MIN */ - /* Enable scanner to create sync */ scan->periodic.sync = sync; @@ -279,6 +199,243 @@ uint8_t ll_sync_create(uint8_t options, uint8_t sid, uint8_t adv_addr_type, return 0; } +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) +void ull_sync_setup_from_sync_transfer(struct ll_conn *conn, uint16_t service_data, + struct ll_sync_set *sync, struct pdu_adv_sync_info *si, + int16_t conn_evt_offset, uint16_t last_pa_event_counter, + uint16_t sync_conn_event_count, uint8_t sender_sca) +{ + struct node_rx_past_received *se_past; + uint32_t ticks_slot_overhead; + uint32_t ticks_slot_offset; + uint32_t conn_interval_us; + uint32_t sync_offset_us; + uint32_t ready_delay_us; + struct node_rx_pdu *rx; + uint8_t *data_chan_map; + struct lll_sync *lll; + uint32_t interval_us; + uint32_t slot_us; + uint32_t ticks_anchor; + uint8_t chm_last; + uint32_t ret; + uint16_t interval; + uint16_t sync_handle; + uint8_t sca; + + lll = &sync->lll; + + /* Copy channel map from sca_chm field in sync_info structure, and + * clear the SCA bits. + */ + chm_last = lll->chm_first; + lll->chm_last = chm_last; + data_chan_map = lll->chm[chm_last].data_chan_map; + (void)memcpy(data_chan_map, si->sca_chm, + sizeof(lll->chm[chm_last].data_chan_map)); + data_chan_map[PDU_SYNC_INFO_SCA_CHM_SCA_BYTE_OFFSET] &= + ~PDU_SYNC_INFO_SCA_CHM_SCA_BIT_MASK; + lll->chm[chm_last].data_chan_count = + util_ones_count_get(data_chan_map, + sizeof(lll->chm[chm_last].data_chan_map)); + if (lll->chm[chm_last].data_chan_count < CHM_USED_COUNT_MIN) { + /* Ignore sync setup, invalid available channel count */ + return; + } + + memcpy(lll->access_addr, si->aa, sizeof(lll->access_addr)); + lll->data_chan_id = lll_chan_id(lll->access_addr); + memcpy(lll->crc_init, si->crc_init, sizeof(lll->crc_init)); + lll->event_counter = sys_le16_to_cpu(si->evt_cntr); + + interval = sys_le16_to_cpu(si->interval); + interval_us = interval * PERIODIC_INT_UNIT_US; + + /* Convert fromm 10ms units to interval units */ + if (sync->timeout != 0 && interval_us != 0) { + sync->timeout_reload = RADIO_SYNC_EVENTS((sync->timeout * 10U * + USEC_PER_MSEC), interval_us); + } + + /* Adjust Skip value so that there is minimum of 6 events that can be + * listened to before Sync_Timeout occurs. + * The adjustment of the skip value is controller implementation + * specific and not specified by the Bluetooth Core Specification v5.3. + * The Controller `may` use the Skip value, and the implementation here + * covers a case where Skip value could lead to less events being + * listened to until Sync_Timeout. Listening to more consecutive events + * before Sync_Timeout increases probability of retaining the Periodic + * Synchronization. + */ + if (sync->timeout_reload > CONN_ESTAB_COUNTDOWN) { + uint16_t skip_max = sync->timeout_reload - CONN_ESTAB_COUNTDOWN; + + if (sync->skip > skip_max) { + sync->skip = skip_max; + } + } + + sync->sync_expire = CONN_ESTAB_COUNTDOWN; + + /* Extract the SCA value from the sca_chm field of the sync_info + * structure. + */ + sca = (si->sca_chm[PDU_SYNC_INFO_SCA_CHM_SCA_BYTE_OFFSET] & + PDU_SYNC_INFO_SCA_CHM_SCA_BIT_MASK) >> + PDU_SYNC_INFO_SCA_CHM_SCA_BIT_POS; + + lll->sca = sca; + + lll->window_widening_periodic_us = + DIV_ROUND_UP(((lll_clock_ppm_local_get() + + lll_clock_ppm_get(sca)) * + interval_us), USEC_PER_SEC); + lll->window_widening_max_us = (interval_us >> 1) - EVENT_IFS_US; + if (PDU_ADV_SYNC_INFO_OFFS_UNITS_GET(si)) { + lll->window_size_event_us = OFFS_UNIT_300_US; + } else { + lll->window_size_event_us = OFFS_UNIT_30_US; + } + +#if defined(CONFIG_BT_CTLR_DF_SCAN_CTE_RX) + lll->node_cte_incomplete = NULL; +#endif /* CONFIG_BT_CTLR_DF_SCAN_CTE_RX */ + + /* Prepare Periodic Advertising Sync Transfer Received event (dispatched later) */ + sync_handle = ull_sync_handle_get(sync); + rx = (void *)sync->node_rx_sync_estab; + rx->hdr.type = NODE_RX_TYPE_SYNC_TRANSFER_RECEIVED; + rx->hdr.handle = sync_handle; + rx->rx_ftr.param = sync; + + /* Create node_rx and assign values */ + se_past = (void *)rx->pdu; + se_past->rx_sync.status = BT_HCI_ERR_SUCCESS; + se_past->rx_sync.interval = interval; + se_past->rx_sync.phy = sync->lll.phy; + se_past->rx_sync.sca = sca; + se_past->conn_handle = ll_conn_handle_get(conn); + se_past->service_data = service_data; + + conn_interval_us = conn->lll.interval * CONN_INT_UNIT_US; + + /* Calculate offset and schedule sync radio events */ + ready_delay_us = lll_radio_rx_ready_delay_get(lll->phy, PHY_FLAGS_S8); + + sync_offset_us = PDU_ADV_SYNC_INFO_OFFSET_GET(si) * lll->window_size_event_us; + /* offs_adjust may be 1 only if sync setup by LL_PERIODIC_SYNC_IND */ + sync_offset_us += (PDU_ADV_SYNC_INFO_OFFS_ADJUST_GET(si) ? OFFS_ADJUST_US : 0U); + sync_offset_us -= EVENT_TICKER_RES_MARGIN_US; + sync_offset_us -= EVENT_JITTER_US; + sync_offset_us -= ready_delay_us; + + if (conn_evt_offset) { + int64_t conn_offset_us = (int64_t)conn_evt_offset * conn_interval_us; + + if ((int64_t)sync_offset_us + conn_offset_us < 0) { + uint32_t total_offset_us = abs((int64_t)sync_offset_us + conn_offset_us); + uint32_t sync_intervals = DIV_ROUND_UP(total_offset_us, interval_us); + + lll->event_counter += sync_intervals; + sync_offset_us = (sync_intervals * interval_us) - total_offset_us; + } else { + sync_offset_us += conn_offset_us; + } + } + + /* Calculate initial window widening - see Core Spec vol 6, part B, 5.1.13.1 */ + { + uint16_t event_delta; + uint32_t drift_us; + uint64_t da; + uint64_t db; + uint64_t d; + + const uint32_t local_sca_ppm = lll_clock_ppm_local_get(); + + event_delta = lll->event_counter - last_pa_event_counter; + + da = (uint64_t)(local_sca_ppm + lll_clock_ppm_get(sca)) * interval_us; + da = DIV_ROUND_UP(da * (uint64_t)event_delta, USEC_PER_SEC); + + db = (uint64_t)(local_sca_ppm + lll_clock_ppm_get(sender_sca)) * conn_interval_us; + db = DIV_ROUND_UP(db * (uint64_t)(ull_conn_event_counter(conn) - + sync_conn_event_count), USEC_PER_SEC); + + d = DIV_ROUND_UP((da + db) * (USEC_PER_SEC + local_sca_ppm + + lll_clock_ppm_get(sca) + + lll_clock_ppm_get(sender_sca)), USEC_PER_SEC); + + /* Limit drift compenstion to the maximum window widening */ + drift_us = MIN((uint32_t)d, lll->window_widening_max_us); + + /* Apply total drift to initial window size */ + lll->window_size_event_us += drift_us; + + /* Adjust offset if less than the drift compensation */ + while (sync_offset_us < drift_us) { + sync_offset_us += interval_us; + lll->event_counter++; + } + + sync_offset_us -= drift_us; + } + + interval_us -= lll->window_widening_periodic_us; + + /* Calculate event time reservation */ + slot_us = PDU_AC_MAX_US(PDU_AC_EXT_PAYLOAD_RX_SIZE, lll->phy); + slot_us += ready_delay_us; + + /* Add implementation defined radio event overheads */ + if (IS_ENABLED(CONFIG_BT_CTLR_EVENT_OVERHEAD_RESERVE_MAX)) { + slot_us += EVENT_OVERHEAD_START_US + EVENT_OVERHEAD_END_US; + } + + /* TODO: active_to_start feature port */ + sync->ull.ticks_active_to_start = 0U; + sync->ull.ticks_prepare_to_start = + HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_XTAL_US); + sync->ull.ticks_preempt_to_start = + HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_PREEMPT_MIN_US); + sync->ull.ticks_slot = HAL_TICKER_US_TO_TICKS_CEIL(slot_us); + + ticks_slot_offset = MAX(sync->ull.ticks_active_to_start, + sync->ull.ticks_prepare_to_start); + if (IS_ENABLED(CONFIG_BT_CTLR_LOW_LAT)) { + ticks_slot_overhead = ticks_slot_offset; + } else { + ticks_slot_overhead = 0U; + } + ticks_slot_offset += HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_START_US); + + sync->lll_sync_prepare = lll_sync_create_prepare; + + ticks_anchor = conn->llcp.prep.ticks_at_expire; + +#if defined(CONFIG_BT_PERIPHERAL) + if (conn->lll.role == BT_HCI_ROLE_PERIPHERAL) { + /* Compensate for window widening */ + ticks_anchor += HAL_TICKER_US_TO_TICKS(conn->lll.periph.window_widening_event_us); + } +#endif /* CONFIG_BT_PERIPHERAL */ + + ret = ticker_start(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, + (TICKER_ID_SCAN_SYNC_BASE + sync_handle), + ticks_anchor, + HAL_TICKER_US_TO_TICKS(sync_offset_us), + HAL_TICKER_US_TO_TICKS(interval_us), + HAL_TICKER_REMAINDER(interval_us), + TICKER_NULL_LAZY, + (sync->ull.ticks_slot + ticks_slot_overhead), + ticker_cb, sync, + ticker_start_op_cb, (void *)__LINE__); + LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || + (ret == TICKER_STATUS_BUSY)); +} +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ + + uint8_t ll_sync_create_cancel(void **rx) { struct ll_scan_set *scan_coded; @@ -353,7 +510,7 @@ uint8_t ll_sync_create_cancel(void **rx) /* It is safe to remove association with scanner as cancelled flag is * set, sync is_stop flag was set and sync has not been established. */ - ull_sync_setup_reset(scan); + ull_sync_setup_reset(sync); /* Mark the sync context as sync create cancelled */ if (IS_ENABLED(CONFIG_BT_CTLR_CHECK_SAME_PEER_SYNC)) { @@ -431,6 +588,22 @@ uint8_t ll_sync_terminate(uint16_t handle) LL_ASSERT(!aux->parent); } +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) + /* Clean up node_rx_sync_estab if still present */ + if (sync->node_rx_sync_estab) { + memq_link_t *link_sync_estab; + struct node_rx_pdu *node_rx; + + node_rx = (void *)sync->node_rx_sync_estab; + link_sync_estab = node_rx->hdr.link; + + ll_rx_link_release(link_sync_estab); + ll_rx_release(node_rx); + + sync->node_rx_sync_estab = NULL; + } +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ + link_sync_lost = sync->node_rx_lost.rx.hdr.link; ll_rx_link_release(link_sync_lost); @@ -474,6 +647,111 @@ uint8_t ll_sync_recv_enable(uint16_t handle, uint8_t enable) return 0; } +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) +/* @brief Link Layer interface function corresponding to HCI LE Set Periodic + * Advertising Sync Transfer command. + * + * @param[in] conn_handle Connection_Handle identifying the connected device + * Range: 0x0000 to 0x0EFF. + * @param[in] service_data Service_Data value provided by the Host for use by the + * Host of the peer device. + * @param[in] sync_handle Sync_Handle identifying the periodic advertising + * train. Range: 0x0000 to 0x0EFF. + * + * @return HCI error codes as documented in Bluetooth Core Specification v5.4. + */ +uint8_t ll_sync_transfer(uint16_t conn_handle, uint16_t service_data, uint16_t sync_handle) +{ + struct ll_sync_set *sync; + struct ll_conn *conn; + + conn = ll_connected_get(conn_handle); + if (!conn) { + return BT_HCI_ERR_UNKNOWN_CONN_ID; + } + + /* Verify that sync_handle is valid */ + sync = ull_sync_is_enabled_get(sync_handle); + if (!sync) { + return BT_HCI_ERR_UNKNOWN_ADV_IDENTIFIER; + } + + /* Call llcp to start LLCP_PERIODIC_SYNC_IND */ + return ull_cp_periodic_sync(conn, sync, NULL, service_data); +} +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ + +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) +/* @brief Link Layer interface function corresponding to HCI LE Set Periodic + * Advertising Sync Transfer Parameters command. + * + * @param[in] conn_handle Connection_Handle identifying the connected device + * Range: 0x0000 to 0x0EFF. + * @param[in] mode Mode specifies the action to be taken when a periodic advertising + * synchronization is received. + * @param[in] skip Skip specifying the number of consectutive periodic advertising + * packets that the receiver may skip after successfully reciving a + * periodic advertising packet. Range: 0x0000 to 0x01F3. + * @param[in] timeout Sync_timeout specifying the maximum permitted time between + * successful receives. Range: 0x000A to 0x4000. + * @param[in] cte_type CTE_Type specifying whether to only synchronize to periodic + * advertising with certain types of Constant Tone Extension. + * + * @return HCI error codes as documented in Bluetooth Core Specification v5.4. + */ +uint8_t ll_past_param(uint16_t conn_handle, uint8_t mode, uint16_t skip, uint16_t timeout, + uint8_t cte_type) +{ + struct ll_conn *conn; + + conn = ll_connected_get(conn_handle); + if (!conn) { + return BT_HCI_ERR_UNKNOWN_CONN_ID; + } + + if (mode == BT_HCI_LE_PAST_MODE_SYNC_FILTER_DUPLICATES && + !IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT)) { + return BT_HCI_ERR_UNSUPP_FEATURE_PARAM_VAL; + } + + /* Set PAST Param for connection instance */ + conn->past.mode = mode; + conn->past.skip = skip; + conn->past.timeout = timeout; + conn->past.cte_type = cte_type; + + return 0; +} + +/* @brief Link Layer interface function corresponding to HCI LE Set Default Periodic + * Advertising Sync Transfer Parameters command. + * + * @param[in] mode Mode specifies the action to be taken when a periodic advertising + * synchronization is received. + * @param[in] skip Skip specifying the number of consectutive periodic advertising + * packets that the receiver may skip after successfully reciving a + * periodic advertising packet. Range: 0x0000 to 0x01F3. + * @param[in] timeout Sync_timeout specifying the maximum permitted time between + * successful receives. Range: 0x000A to 0x4000. + * @param[in] cte_type CTE_Type specifying whether to only synchronize to periodic + * advertising with certain types of Constant Tone Extension. + * + * @return HCI error codes as documented in Bluetooth Core Specification v5.4. + */ +uint8_t ll_default_past_param(uint8_t mode, uint16_t skip, uint16_t timeout, uint8_t cte_type) +{ + if (mode == BT_HCI_LE_PAST_MODE_SYNC_FILTER_DUPLICATES && + !IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT)) { + return BT_HCI_ERR_UNSUPP_FEATURE_PARAM_VAL; + } + + /* Set default past param */ + ull_conn_default_past_param_set(mode, skip, timeout, cte_type); + + return 0; +} +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ + int ull_sync_init(void) { int err; @@ -594,8 +872,8 @@ void ull_sync_release(struct ll_sync_set *sync) mem_release(sync, &sync_free); } -void ull_sync_setup_addr_check(struct ll_scan_set *scan, uint8_t addr_type, - uint8_t *addr, uint8_t rl_idx) +void ull_sync_setup_addr_check(struct ll_sync_set *sync, struct ll_scan_set *scan, + uint8_t addr_type, uint8_t *addr, uint8_t rl_idx) { /* Check if Periodic Advertiser list to be used */ if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC_ADV_LIST) && @@ -605,8 +883,8 @@ void ull_sync_setup_addr_check(struct ll_scan_set *scan, uint8_t addr_type, /* Remember the address, to check with * SID in Sync Info */ - scan->periodic.adv_addr_type = addr_type; - (void)memcpy(scan->periodic.adv_addr, addr, + sync->peer_id_addr_type = addr_type; + (void)memcpy(sync->peer_id_addr, addr, BDADDR_SIZE); /* Address matched */ @@ -615,22 +893,22 @@ void ull_sync_setup_addr_check(struct ll_scan_set *scan, uint8_t addr_type, /* Check in Resolving List */ } else if (IS_ENABLED(CONFIG_BT_CTLR_PRIVACY) && ull_filter_ull_pal_listed(rl_idx, &addr_type, - scan->periodic.adv_addr)) { + sync->peer_id_addr)) { /* Remember the address, to check with the * SID in Sync Info */ - scan->periodic.adv_addr_type = addr_type; + sync->peer_id_addr_type = addr_type; - /* Mark it as identity address from RPA (0x02, 0x03) */ - scan->periodic.adv_addr_type += 2U; + /* Mark it as identity address from RPA */ + sync->peer_addr_resolved = 1U; /* Address matched */ scan->periodic.state = LL_SYNC_STATE_ADDR_MATCH; } /* Check with explicitly supplied address */ - } else if ((addr_type == scan->periodic.adv_addr_type) && - !memcmp(addr, scan->periodic.adv_addr, BDADDR_SIZE)) { + } else if ((addr_type == sync->peer_id_addr_type) && + !memcmp(addr, sync->peer_id_addr, BDADDR_SIZE)) { /* Address matched */ scan->periodic.state = LL_SYNC_STATE_ADDR_MATCH; @@ -638,10 +916,10 @@ void ull_sync_setup_addr_check(struct ll_scan_set *scan, uint8_t addr_type, } else if (IS_ENABLED(CONFIG_BT_CTLR_PRIVACY) && (rl_idx < ll_rl_size_get())) { ll_rl_id_addr_get(rl_idx, &addr_type, addr); - if ((addr_type == scan->periodic.adv_addr_type) && - !memcmp(addr, scan->periodic.adv_addr, BDADDR_SIZE)) { - /* Mark it as identity address from RPA (0x02, 0x03) */ - scan->periodic.adv_addr_type += 2U; + if ((addr_type == sync->peer_id_addr_type) && + !memcmp(addr, sync->peer_id_addr, BDADDR_SIZE)) { + /* Mark it as identity address from RPA */ + sync->peer_addr_resolved = 1U; /* Identity address matched */ scan->periodic.state = LL_SYNC_STATE_ADDR_MATCH; @@ -649,15 +927,15 @@ void ull_sync_setup_addr_check(struct ll_scan_set *scan, uint8_t addr_type, } } -bool ull_sync_setup_sid_match(struct ll_scan_set *scan, uint8_t sid) +bool ull_sync_setup_sid_match(struct ll_sync_set *sync, struct ll_scan_set *scan, uint8_t sid) { return (scan->periodic.state == LL_SYNC_STATE_ADDR_MATCH) && ((IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC_ADV_LIST) && scan->periodic.filter_policy && - ull_filter_ull_pal_match(scan->periodic.adv_addr_type, - scan->periodic.adv_addr, sid)) || + ull_filter_ull_pal_match(sync->peer_id_addr_type, + sync->peer_id_addr, sid)) || (!scan->periodic.filter_policy && - (sid == scan->periodic.sid))); + (sid == sync->sid))); } void ull_sync_setup(struct ll_scan_set *scan, struct ll_scan_aux_set *aux, @@ -705,18 +983,6 @@ void ull_sync_setup(struct ll_scan_set *scan, struct ll_scan_aux_set *aux, return; } -#if defined(CONFIG_BT_CTLR_CHECK_SAME_PEER_SYNC) || \ - defined(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT) - /* Remember the peer address. - * NOTE: Peer identity address is copied here when privacy is enable. - */ - sync->peer_id_addr_type = scan->periodic.adv_addr_type & 0x01; - (void)memcpy(sync->peer_id_addr, scan->periodic.adv_addr, - sizeof(sync->peer_id_addr)); -#endif /* CONFIG_BT_CTLR_CHECK_SAME_PEER_SYNC || - * CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT - */ - memcpy(lll->access_addr, si->aa, sizeof(lll->access_addr)); lll->data_chan_id = lll_chan_id(lll->access_addr); memcpy(lll->crc_init, si->crc_init, sizeof(lll->crc_init)); @@ -727,7 +993,12 @@ void ull_sync_setup(struct ll_scan_set *scan, struct ll_scan_aux_set *aux, interval = sys_le16_to_cpu(si->interval); interval_us = interval * PERIODIC_INT_UNIT_US; - /* Convert from 10ms units to interval units */ +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) + /* Save Periodic Advertisement Interval */ + sync->interval = interval; +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ + + /* Convert fromm 10ms units to interval units */ sync->timeout_reload = RADIO_SYNC_EVENTS((sync->timeout * 10U * USEC_PER_MSEC), interval_us); @@ -803,7 +1074,7 @@ void ull_sync_setup(struct ll_scan_set *scan, struct ll_scan_aux_set *aux, rx = (void *)sync->node_rx_sync_estab; rx->hdr.type = NODE_RX_TYPE_SYNC; rx->hdr.handle = sync_handle; - rx->rx_ftr.param = scan; + rx->rx_ftr.param = sync; se = (void *)rx->pdu; se->interval = interval; se->phy = lll->phy; @@ -813,7 +1084,7 @@ void ull_sync_setup(struct ll_scan_set *scan, struct ll_scan_aux_set *aux, ftr = &node_rx->rx_ftr; pdu = (void *)((struct node_rx_pdu *)node_rx)->pdu; - ready_delay_us = lll_radio_rx_ready_delay_get(lll->phy, 1); + ready_delay_us = lll_radio_rx_ready_delay_get(lll->phy, PHY_FLAGS_S8); sync_offset_us = ftr->radio_end_us; sync_offset_us += PDU_ADV_SYNC_INFO_OFFSET_GET(si) * @@ -885,9 +1156,13 @@ void ull_sync_setup(struct ll_scan_set *scan, struct ll_scan_aux_set *aux, (ret == TICKER_STATUS_BUSY)); } -void ull_sync_setup_reset(struct ll_scan_set *scan) +void ull_sync_setup_reset(struct ll_sync_set *sync) { + struct ll_scan_set *scan; + /* Remove the sync context from being associated with scan contexts */ + scan = ull_scan_set_get(SCAN_HANDLE_1M); + scan->periodic.sync = NULL; #if defined(CONFIG_BT_CTLR_FILTER_ACCEPT_LIST) @@ -895,14 +1170,7 @@ void ull_sync_setup_reset(struct ll_scan_set *scan) #endif /* CONFIG_BT_CTLR_FILTER_ACCEPT_LIST */ if (IS_ENABLED(CONFIG_BT_CTLR_PHY_CODED)) { - struct ll_scan_set *scan_1m; - - scan_1m = ull_scan_set_get(SCAN_HANDLE_1M); - if (scan == scan_1m) { - scan = ull_scan_set_get(SCAN_HANDLE_PHY_CODED); - } else { - scan = scan_1m; - } + scan = ull_scan_set_get(SCAN_HANDLE_PHY_CODED); scan->periodic.sync = NULL; @@ -965,8 +1233,7 @@ void ull_sync_established_report(memq_link_t *link, struct node_rx_pdu *rx) #endif /* !CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING */ /* Prepare and dispatch sync notification */ - rx_establ = sync->node_rx_sync_estab; - rx_establ->hdr.type = NODE_RX_TYPE_SYNC; + rx_establ = (void *)sync->node_rx_sync_estab; rx_establ->hdr.handle = ull_sync_handle_get(sync); se = (void *)rx_establ->pdu; /* Clear the node to mark the sync establish as being completed. @@ -1297,6 +1564,110 @@ static inline struct ll_sync_set *sync_acquire(void) return mem_acquire(&sync_free); } +static struct ll_sync_set *ull_sync_create(uint8_t sid, uint16_t timeout, uint16_t skip, + uint8_t cte_type, uint8_t rx_enable, uint8_t nodups) +{ + memq_link_t *link_sync_estab; + memq_link_t *link_sync_lost; + struct node_rx_pdu *node_rx; + struct lll_sync *lll; + struct ll_sync_set *sync; + + link_sync_estab = ll_rx_link_alloc(); + if (!link_sync_estab) { + return NULL; + } + + link_sync_lost = ll_rx_link_alloc(); + if (!link_sync_lost) { + ll_rx_link_release(link_sync_estab); + + return NULL; + } + + node_rx = ll_rx_alloc(); + if (!node_rx) { + ll_rx_link_release(link_sync_lost); + ll_rx_link_release(link_sync_estab); + + return NULL; + } + + sync = sync_acquire(); + if (!sync) { + ll_rx_release(node_rx); + ll_rx_link_release(link_sync_lost); + ll_rx_link_release(link_sync_estab); + + return NULL; + } + + sync->peer_addr_resolved = 0U; + + /* Initialize sync context */ + node_rx->hdr.link = link_sync_estab; + sync->node_rx_lost.rx.hdr.link = link_sync_lost; + + /* Make sure that the node_rx_sync_establ hasn't got anything assigned. It is used to + * mark when sync establishment is in progress. + */ + LL_ASSERT(!sync->node_rx_sync_estab); + sync->node_rx_sync_estab = node_rx; + + /* Reporting initially enabled/disabled */ + sync->rx_enable = rx_enable; + +#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT) + sync->nodups = nodups; +#endif + sync->skip = skip; + sync->is_stop = 0U; + +#if defined(CONFIG_BT_CTLR_SYNC_ISO) + sync->enc = 0U; +#endif /* CONFIG_BT_CTLR_SYNC_ISO */ + + /* NOTE: Use timeout not zero to represent sync context used for sync + * create. + */ + sync->timeout = timeout; + + /* NOTE: Use timeout_reload not zero to represent sync established. */ + sync->timeout_reload = 0U; + sync->timeout_expire = 0U; + + /* Remember the SID */ + sync->sid = sid; + +#if defined(CONFIG_BT_CTLR_SYNC_ISO) + /* Reset Broadcast Isochronous Group Sync Establishment */ + sync->iso.sync_iso = NULL; +#endif /* CONFIG_BT_CTLR_SYNC_ISO */ + + /* Initialize sync LLL context */ + lll = &sync->lll; + lll->lll_aux = NULL; + lll->is_rx_enabled = sync->rx_enable; + lll->skip_prepare = 0U; + lll->skip_event = 0U; + lll->window_widening_prepare_us = 0U; + lll->window_widening_event_us = 0U; +#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING) + lll->cte_type = cte_type; +#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING */ + +#if defined(CONFIG_BT_CTLR_DF_SCAN_CTE_RX) + ull_df_sync_cfg_init(&lll->df_cfg); + LL_ASSERT(!lll->node_cte_incomplete); +#endif /* CONFIG_BT_CTLR_DF_SCAN_CTE_RX */ + + /* Initialise ULL and LLL headers */ + ull_hdr_init(&sync->ull); + lll_hdr_init(lll, sync); + + return sync; +} + static void sync_ticker_cleanup(struct ll_sync_set *sync, ticker_op_func stop_op_cb) { uint16_t sync_handle = ull_sync_handle_get(sync); @@ -1388,7 +1759,6 @@ static void sync_expire(void *param) /* Generate Periodic advertising sync failed to establish */ rx = (void *)sync->node_rx_sync_estab; - rx->hdr.type = NODE_RX_TYPE_SYNC; rx->hdr.handle = LLL_HANDLE_INVALID; /* Clear the node to mark the sync establish as being completed. @@ -1535,3 +1905,61 @@ static struct pdu_cte_info *pdu_cte_info_get(struct pdu_adv *pdu) return (struct pdu_cte_info *)hdr->data; } #endif /* CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING && !CONFIG_BT_CTLR_CTEINLINE_SUPPORT */ + +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) +void ull_sync_transfer_received(struct ll_conn *conn, uint16_t service_data, + struct pdu_adv_sync_info *si, uint16_t conn_event_count, + uint16_t last_pa_event_counter, uint8_t sid, + uint8_t addr_type, uint8_t sca, uint8_t phy, + uint8_t *adv_addr, uint16_t sync_conn_event_count, + uint8_t addr_resolved) +{ + struct ll_sync_set *sync; + uint16_t conn_evt_current; + uint8_t rx_enable; + uint8_t nodups; + + if (conn->past.mode == BT_HCI_LE_PAST_MODE_NO_SYNC) { + /* Ignore LL_PERIODIC_SYNC_IND - see Bluetooth Core Specification v5.4 + * Vol 6, Part E, Section 7.8.91 + */ + return; + } + +#if defined(CONFIG_BT_CTLR_CHECK_SAME_PEER_SYNC) + /* Do not sync twice to the same peer and same SID */ + if (peer_sid_sync_exists(addr_type, adv_addr, sid)) { + return; + } +#endif /* CONFIG_BT_CTLR_CHECK_SAME_PEER_SYNC */ + + nodups = (conn->past.mode == BT_HCI_LE_PAST_MODE_SYNC_FILTER_DUPLICATES) ? 1U : 0U; + rx_enable = (conn->past.mode == BT_HCI_LE_PAST_MODE_NO_REPORTS) ? 0U : 1U; + + sync = ull_sync_create(sid, conn->past.timeout, conn->past.skip, conn->past.cte_type, + rx_enable, nodups); + if (!sync) { + return; + } + +#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING) + /* Reset filter policy in lll_sync */ + sync->lll.filter_policy = 0U; +#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING */ + + sync->peer_id_addr_type = addr_type; + sync->peer_addr_resolved = addr_resolved; + memcpy(sync->peer_id_addr, adv_addr, BDADDR_SIZE); + sync->lll.phy = phy; + + conn_evt_current = ull_conn_event_counter(conn); + + /* LLCP should have ensured this holds */ + LL_ASSERT(sync_conn_event_count != conn_evt_current); + + ull_sync_setup_from_sync_transfer(conn, service_data, sync, si, + conn_event_count - conn_evt_current, + last_pa_event_counter, sync_conn_event_count, + sca); +} +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_sync_internal.h b/subsys/bluetooth/controller/ll_sw/ull_sync_internal.h index dacc48ccdc7a9..a9d19c2e5466f 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sync_internal.h +++ b/subsys/bluetooth/controller/ll_sw/ull_sync_internal.h @@ -9,15 +9,25 @@ int ull_sync_reset(void); uint16_t ull_sync_handle_get(struct ll_sync_set *sync); struct ll_sync_set *ull_sync_is_enabled_get(uint16_t handle); void ull_sync_release(struct ll_sync_set *sync); -void ull_sync_setup_addr_check(struct ll_scan_set *scan, uint8_t addr_type, - uint8_t *addr, uint8_t rl_idx); -bool ull_sync_setup_sid_match(struct ll_scan_set *scan, uint8_t sid); +void ull_sync_setup_addr_check(struct ll_sync_set *sync, struct ll_scan_set *scan, + uint8_t addr_type, uint8_t *addr, uint8_t rl_idx); +bool ull_sync_setup_sid_match(struct ll_sync_set *sync, struct ll_scan_set *scan, uint8_t sid); +void ull_sync_create_from_sync_transfer(uint16_t conn_handle, uint16_t service_data, + struct ll_sync_set *sync, + struct pdu_adv_sync_info *si, + uint32_t conn_offset_us); void ull_sync_setup(struct ll_scan_set *scan, struct ll_scan_aux_set *aux, struct node_rx_pdu *node_rx, struct pdu_adv_sync_info *si); -void ull_sync_setup_reset(struct ll_scan_set *scan); +void ull_sync_setup_reset(struct ll_sync_set *sync); void ull_sync_established_report(memq_link_t *link, struct node_rx_pdu *rx); void ull_sync_done(struct node_rx_event_done *done); void ull_sync_chm_update(uint8_t sync_handle, uint8_t *acad, uint8_t acad_len); int ull_sync_slot_update(struct ll_sync_set *sync, uint32_t slot_plus_us, uint32_t slot_minus_us); struct ll_sync_set *ull_sync_is_valid_get(struct ll_sync_set *sync); +void ull_sync_transfer_received(struct ll_conn *conn, uint16_t service_data, + struct pdu_adv_sync_info *si, uint16_t conn_event_count, + uint16_t last_pa_event_counter, uint8_t sid, + uint8_t addr_type, uint8_t sca, uint8_t phy, + uint8_t *adv_addr, uint16_t sync_conn_event_count, + uint8_t addr_resolved); diff --git a/subsys/bluetooth/controller/ll_sw/ull_sync_iso.c b/subsys/bluetooth/controller/ll_sw/ull_sync_iso.c index 5371c4bf9f84b..fbe29c258afe5 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sync_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_sync_iso.c @@ -31,18 +31,26 @@ #include "lll/lll_df_types.h" #include "lll_sync.h" #include "lll_sync_iso.h" +#include "lll_conn.h" +#include "lll_conn_iso.h" #include "isoal.h" +#include "ull_tx_queue.h" + #include "ull_scan_types.h" #include "ull_sync_types.h" #include "ull_iso_types.h" +#include "ull_conn_types.h" +#include "ull_conn_iso_types.h" #include "ull_internal.h" #include "ull_scan_internal.h" #include "ull_sync_internal.h" #include "ull_iso_internal.h" #include "ull_sync_iso_internal.h" +#include "ull_conn_internal.h" +#include "ull_conn_iso_internal.h" #include "ll.h" diff --git a/subsys/bluetooth/controller/ll_sw/ull_sync_types.h b/subsys/bluetooth/controller/ll_sw/ull_sync_types.h index 5a9c8786f7a6b..d816abb217cbe 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sync_types.h +++ b/subsys/bluetooth/controller/ll_sw/ull_sync_types.h @@ -32,13 +32,9 @@ struct ll_sync_set { */ void (*lll_sync_prepare)(void *param); -#if defined(CONFIG_BT_CTLR_CHECK_SAME_PEER_SYNC) || \ - defined(CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT) uint8_t peer_id_addr[BDADDR_SIZE]; uint8_t peer_id_addr_type:1; -#endif /* CONFIG_BT_CTLR_CHECK_SAME_PEER_SYNC || - * CONFIG_BT_CTLR_SYNC_PERIODIC_ADI_SUPPORT - */ + uint8_t peer_addr_resolved:1; uint8_t rx_enable:1; @@ -62,9 +58,7 @@ struct ll_sync_set { uint8_t num_bis : 5; #endif /* CONFIG_BT_CTLR_SYNC_ISO */ -#if defined(CONFIG_BT_CTLR_CHECK_SAME_PEER_SYNC) uint8_t sid; -#endif /* CONFIG_BT_CTLR_CHECK_SAME_PEER_SYNC */ /* node rx type with memory aligned storage for sync lost reason. * HCI will reference the value using the pdu member of @@ -94,8 +88,10 @@ struct ll_sync_set { #endif /* CONFIG_BT_CTLR_SYNC_ISO */ uint16_t data_len; +#if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) + uint16_t interval; +#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ }; - struct node_rx_sync { uint8_t status; uint8_t phy; @@ -103,6 +99,12 @@ struct node_rx_sync { uint8_t sca; }; +struct node_rx_past_received { + struct node_rx_sync rx_sync; + uint16_t conn_handle; + uint16_t service_data; +}; + #if defined(CONFIG_BT_CTLR_SYNC_ISO) struct ll_sync_iso_set { struct ull_hdr ull; diff --git a/tests/bluetooth/df/connectionless_cte_rx/src/common.c b/tests/bluetooth/df/connectionless_cte_rx/src/common.c index cce56f1b8b6c3..ffa59f409d17f 100644 --- a/tests/bluetooth/df/connectionless_cte_rx/src/common.c +++ b/tests/bluetooth/df/connectionless_cte_rx/src/common.c @@ -23,8 +23,12 @@ #include #include #include +#include +#include #include #include +#include +#include #include #include From 533a75dff4f2317461939edd36f63e3f691d29d9 Mon Sep 17 00:00:00 2001 From: Lucas Mathias Balling Date: Fri, 4 Oct 2024 13:32:36 +0200 Subject: [PATCH 1424/4482] tests: Bluetooth: bsim tests for Periodic Sync Transfer Implemented: * Central sync to broadcaster, connects to peripheral and transfers sync. Peripheral Syncs to PA * Broadcaster acting Central connects to peripheral and transfers sync. Peripheral sync to PA * Moved previous bis tests to test_bis.c and new PAST tests was added in test_past.c Signed-off-by: Lucas Mathias Balling --- tests/bsim/bluetooth/ll/bis/CMakeLists.txt | 12 +- tests/bsim/bluetooth/ll/bis/prj_past.conf | 33 + tests/bsim/bluetooth/ll/bis/src/main.c | 1238 +---------------- tests/bsim/bluetooth/ll/bis/src/test_bis.c | 1230 ++++++++++++++++ tests/bsim/bluetooth/ll/bis/src/test_past.c | 788 +++++++++++ tests/bsim/bluetooth/ll/bis/testcase.yaml | 11 + .../bluetooth/ll/bis/tests_scripts/past.sh | 29 + .../tests_scripts/past_default_past_params.sh | 30 + .../past_send_from_broadcaster.sh | 24 + tests/bsim/bluetooth/ll/compile.sh | 1 + 10 files changed, 2167 insertions(+), 1229 deletions(-) create mode 100644 tests/bsim/bluetooth/ll/bis/prj_past.conf create mode 100644 tests/bsim/bluetooth/ll/bis/src/test_bis.c create mode 100644 tests/bsim/bluetooth/ll/bis/src/test_past.c create mode 100755 tests/bsim/bluetooth/ll/bis/tests_scripts/past.sh create mode 100755 tests/bsim/bluetooth/ll/bis/tests_scripts/past_default_past_params.sh create mode 100755 tests/bsim/bluetooth/ll/bis/tests_scripts/past_send_from_broadcaster.sh diff --git a/tests/bsim/bluetooth/ll/bis/CMakeLists.txt b/tests/bsim/bluetooth/ll/bis/CMakeLists.txt index ba93504b31829..a450e19c78cd3 100644 --- a/tests/bsim/bluetooth/ll/bis/CMakeLists.txt +++ b/tests/bsim/bluetooth/ll/bis/CMakeLists.txt @@ -5,7 +5,17 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) project(bsim_test_bis) -target_sources(app PRIVATE src/main.c) +if(CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER) +target_sources(app PRIVATE + src/main.c + src/test_past.c +) +else() +target_sources(app PRIVATE + src/main.c + src/test_bis.c +) +endif() zephyr_include_directories( ${ZEPHYR_BASE} diff --git a/tests/bsim/bluetooth/ll/bis/prj_past.conf b/tests/bsim/bluetooth/ll/bis/prj_past.conf new file mode 100644 index 0000000000000..589e965ff3808 --- /dev/null +++ b/tests/bsim/bluetooth/ll/bis/prj_past.conf @@ -0,0 +1,33 @@ +CONFIG_BT=y +CONFIG_BT_DEVICE_NAME="PAST" +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_CENTRAL=y +CONFIG_BT_EXT_ADV=y +CONFIG_BT_PER_ADV=y +CONFIG_BT_PER_ADV_SYNC=y +CONFIG_BT_CTLR_ADV_EXT=y + +CONFIG_BT_CTLR_TEST=y + +CONFIG_BT_ATT_PREPARE_COUNT=2 +CONFIG_BT_GATT_CLIENT=y +CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y +CONFIG_BT_DEVICE_NAME="bsim_test_split" +CONFIG_BT_L2CAP_TX_BUF_COUNT=6 + +CONFIG_BT_CTLR_PRIVACY=y + +# Periodic Advertising Sync Transfer Send/Receive functionality +CONFIG_BT_PER_ADV_SYNC_TRANSFER_RECEIVER=y +CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER=y + +# Increase buffer size to get whole LLCP message sent in one +CONFIG_BT_BUF_CMD_TX_SIZE=255 +CONFIG_BT_BUF_EVT_RX_SIZE=255 +CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE=255 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_BUF_ACL_RX_SIZE=251 + +CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 + +CONFIG_BT_BROADCASTER=y diff --git a/tests/bsim/bluetooth/ll/bis/src/main.c b/tests/bsim/bluetooth/ll/bis/src/main.c index 1c8f72cd72b62..a6a0b2fb89fc8 100644 --- a/tests/bsim/bluetooth/ll/bis/src/main.c +++ b/tests/bsim/bluetooth/ll/bis/src/main.c @@ -1,1241 +1,23 @@ -/* main.c - Application main entry point */ - /* - * Copyright (c) 2020 Nordic Semiconductor ASA + * Copyright (c) 2018 Oticon A/S * * SPDX-License-Identifier: Apache-2.0 */ -#include - -#include -#include -#include - -#include -#include -#include - -#include "subsys/bluetooth/host/hci_core.h" -#include "subsys/bluetooth/controller/include/ll.h" -#include "subsys/bluetooth/controller/util/memq.h" -#include "subsys/bluetooth/controller/ll_sw/lll.h" - -/* For VS data path */ -#include "subsys/bluetooth/controller/ll_sw/isoal.h" -#include "subsys/bluetooth/controller/ll_sw/ull_iso_types.h" - -#include "bs_types.h" -#include "bs_tracing.h" -#include "time_machine.h" #include "bstests.h" -#define FAIL(...) \ - do { \ - bst_result = Failed; \ - bs_trace_error_time_line(__VA_ARGS__); \ - } while (0) - -#define PASS(...) \ - do { \ - bst_result = Passed; \ - bs_trace_info_time(1, __VA_ARGS__); \ - } while (0) - -extern enum bst_result_t bst_result; - -static uint8_t mfg_data1[] = { 0xff, 0xff, 0x01, 0x02, 0x03, 0x04 }; -static uint8_t mfg_data2[] = { 0xff, 0xff, 0x05 }; - -static const struct bt_data per_ad_data1[] = { - BT_DATA(BT_DATA_MANUFACTURER_DATA, mfg_data1, 6), -}; - -static const struct bt_data per_ad_data2[] = { - BT_DATA(BT_DATA_MANUFACTURER_DATA, mfg_data2, 3), -}; - -static uint8_t chan_map[] = { 0x1F, 0XF1, 0x1F, 0xF1, 0x1F }; - -static bool volatile is_iso_connected; -static uint8_t volatile is_iso_disconnected; -static bool volatile deleting_pa_sync; - -#if !defined(CONFIG_TEST_LL_INTERFACE) -static void iso_connected(struct bt_iso_chan *chan); -static void iso_disconnected(struct bt_iso_chan *chan, uint8_t reason); -static void iso_recv(struct bt_iso_chan *chan, - const struct bt_iso_recv_info *info, struct net_buf *buf); - -static struct bt_iso_chan_ops iso_ops = { - .connected = iso_connected, - .disconnected = iso_disconnected, - .recv = iso_recv, -}; - -static struct bt_iso_chan_path iso_path_rx = { - .pid = BT_HCI_DATAPATH_ID_HCI -}; - -static struct bt_iso_chan_qos bis_iso_qos; -static struct bt_iso_chan_io_qos iso_tx_qos; -static struct bt_iso_chan_io_qos iso_rx_qos = { - .path = &iso_path_rx -}; - -static struct bt_iso_chan bis_iso_chan = { - .ops = &iso_ops, - .qos = &bis_iso_qos, -}; - -#define BIS_ISO_CHAN_COUNT 1 -static struct bt_iso_chan *bis_channels[BIS_ISO_CHAN_COUNT] = { &bis_iso_chan }; -static uint16_t seq_num; - -NET_BUF_POOL_FIXED_DEFINE(bis_tx_pool, BIS_ISO_CHAN_COUNT, - BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), - CONFIG_BT_CONN_TX_USER_DATA_SIZE, NULL); - -#if defined(CONFIG_BT_CTLR_ISO_VENDOR_DATA_PATH) -static uint8_t test_rx_buffer[CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX]; -static bool is_iso_vs_emitted; - -static isoal_status_t test_sink_sdu_alloc(const struct isoal_sink *sink_ctx, - const struct isoal_pdu_rx *valid_pdu, - struct isoal_sdu_buffer *sdu_buffer) -{ - sdu_buffer->dbuf = test_rx_buffer; - sdu_buffer->size = sizeof(test_rx_buffer); - - return ISOAL_STATUS_OK; -} - - -static isoal_status_t test_sink_sdu_emit(const struct isoal_sink *sink_ctx, - const struct isoal_emitted_sdu_frag *sdu_frag, - const struct isoal_emitted_sdu *sdu) -{ - printk("Vendor sink SDU fragment size %u / %u, seq_num %u, ts %u\n", - sdu_frag->sdu_frag_size, sdu->total_sdu_size, sdu_frag->sdu.sn, - sdu_frag->sdu.timestamp); - is_iso_vs_emitted = true; - - return ISOAL_STATUS_OK; -} - -static isoal_status_t test_sink_sdu_write(void *dbuf, - const size_t sdu_written, - const uint8_t *pdu_payload, - const size_t consume_len) -{ - memcpy((uint8_t *)dbuf + sdu_written, pdu_payload, consume_len); - - return ISOAL_STATUS_OK; -} - - -bool ll_data_path_sink_create(uint16_t handle, struct ll_iso_datapath *datapath, - isoal_sink_sdu_alloc_cb *sdu_alloc, - isoal_sink_sdu_emit_cb *sdu_emit, - isoal_sink_sdu_write_cb *sdu_write) -{ - ARG_UNUSED(handle); - ARG_UNUSED(datapath); - - *sdu_alloc = test_sink_sdu_alloc; - *sdu_emit = test_sink_sdu_emit; - *sdu_write = test_sink_sdu_write; - - printk("VS data path sink created\n"); - return true; -} -#endif /* CONFIG_BT_CTLR_ISO_VENDOR_DATA_PATH */ - -#define BUF_ALLOC_TIMEOUT_MS (30) /* milliseconds */ -NET_BUF_POOL_FIXED_DEFINE(tx_pool, CONFIG_BT_ISO_TX_BUF_COUNT, - BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), - CONFIG_BT_CONN_TX_USER_DATA_SIZE, NULL); - -static struct k_work_delayable iso_send_work; - -BUILD_ASSERT(sizeof(seq_num) <= CONFIG_BT_ISO_TX_MTU); - -static void iso_send(struct k_work *work) -{ - static uint8_t iso_data[CONFIG_BT_ISO_TX_MTU]; - static bool data_initialized; - struct net_buf *buf; - size_t iso_data_len; - int ret; - - if (!data_initialized) { - data_initialized = true; - - for (size_t i = 0; i < ARRAY_SIZE(iso_data); i++) { - iso_data[i] = (uint8_t)i; - } - } - - buf = net_buf_alloc(&tx_pool, K_MSEC(BUF_ALLOC_TIMEOUT_MS)); - if (!buf) { - FAIL("Data buffer allocate timeout on channel\n"); - return; - } - - net_buf_reserve(buf, BT_ISO_CHAN_SEND_RESERVE); - sys_put_le16(seq_num, iso_data); - iso_data_len = MAX(sizeof(seq_num), ((seq_num % CONFIG_BT_ISO_TX_MTU) + 1)); - net_buf_add_mem(buf, iso_data, iso_data_len); - - bs_trace_info_time(4, "ISO send: seq_num %u\n", seq_num); - ret = bt_iso_chan_send(&bis_iso_chan, buf, seq_num++); - if (ret < 0) { - FAIL("Unable to broadcast data on channel (%d)\n", ret); - net_buf_unref(buf); - return; - } - - k_work_schedule(&iso_send_work, K_USEC(9970)); -} -#endif /* !CONFIG_TEST_LL_INTERFACE */ - -static void setup_ext_adv(struct bt_le_ext_adv **adv) -{ - int err; - - printk("Create advertising set..."); - err = bt_le_ext_adv_create(BT_LE_EXT_ADV_NCONN, NULL, adv); - if (err) { - FAIL("Failed to create advertising set (err %d)\n", err); - return; - } - printk("success.\n"); - - printk("Setting Periodic Advertising parameters..."); - err = bt_le_per_adv_set_param(*adv, BT_LE_PER_ADV_DEFAULT); - if (err) { - FAIL("Failed to set periodic advertising parameters (err %d)\n", - err); - return; - } - printk("success.\n"); - - printk("Enable Periodic Advertising..."); - err = bt_le_per_adv_start(*adv); - if (err) { - FAIL("Failed to enable periodic advertising (err %d)\n", err); - return; - } - printk("success.\n"); - - printk("Start extended advertising..."); - err = bt_le_ext_adv_start(*adv, BT_LE_EXT_ADV_START_DEFAULT); - if (err) { - printk("Failed to start extended advertising (err %d)\n", err); - return; - } - printk("success.\n"); -} - -static void teardown_ext_adv(struct bt_le_ext_adv *adv) -{ - int err; - - printk("Stop Periodic Advertising..."); - err = bt_le_per_adv_stop(adv); - if (err) { - FAIL("Failed to stop periodic advertising (err %d)\n", err); - return; - } - printk("success.\n"); - - printk("Stop Extended Advertising..."); - err = bt_le_ext_adv_stop(adv); - if (err) { - FAIL("Failed to stop extended advertising (err %d)\n", err); - return; - } - printk("success.\n"); - - printk("Deleting Extended Advertising..."); - err = bt_le_ext_adv_delete(adv); - if (err) { - FAIL("Failed to delete extended advertising (err %d)\n", err); - return; - } - printk("success.\n"); -} - -#if defined(CONFIG_TEST_LL_INTERFACE) -static void create_ll_big(uint8_t big_handle, struct bt_le_ext_adv *adv) -{ - uint16_t max_sdu = CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX; - uint8_t bcode[BT_ISO_BROADCAST_CODE_SIZE] = { 0 }; - uint32_t sdu_interval = 10000; /* us */ - uint16_t max_latency = 10; /* ms */ - uint8_t encryption = 0; - uint8_t bis_count = 1; /* TODO: Add support for multiple BIS per BIG */ - uint8_t phy = BIT(1); - uint8_t packing = 0; - uint8_t framing = 0; - uint8_t adv_handle; - uint8_t rtn = 0; - int err; - - printk("Creating LL BIG..."); - /* Assume that index == handle */ - adv_handle = bt_le_ext_adv_get_index(adv); - - err = ll_big_create(big_handle, adv_handle, bis_count, sdu_interval, - max_sdu, max_latency, rtn, phy, packing, framing, - encryption, bcode); - if (err) { - FAIL("Could not create BIG: %d\n", err); - return; - } - printk("success.\n"); -} - -static void terminate_ll_big(uint8_t big_handle) -{ - int err; - - printk("Terminating LL BIG..."); - err = ll_big_terminate(big_handle, BT_HCI_ERR_LOCALHOST_TERM_CONN); - if (err) { - FAIL("Could not terminate BIG: %d\n", err); - return; - } - printk("success.\n"); -} - -#else /* !CONFIG_TEST_LL_INTERFACE */ -static void create_big(struct bt_le_ext_adv *adv, struct bt_iso_big **big) -{ - struct bt_iso_big_create_param big_create_param = { 0 }; - int err; - - printk("Creating BIG...\n"); - big_create_param.bis_channels = bis_channels; - big_create_param.num_bis = BIS_ISO_CHAN_COUNT; - big_create_param.encryption = false; - big_create_param.interval = 10000; /* us */ - big_create_param.latency = 10; /* milliseconds */ - big_create_param.packing = 0; /* 0 - sequential; 1 - interleaved */ - big_create_param.framing = 0; /* 0 - unframed; 1 - framed */ - iso_tx_qos.sdu = CONFIG_BT_ISO_TX_MTU; /* bytes */ - iso_tx_qos.rtn = 2; - iso_tx_qos.phy = BT_GAP_LE_PHY_2M; - bis_iso_qos.tx = &iso_tx_qos; - bis_iso_qos.rx = NULL; - err = bt_iso_big_create(adv, &big_create_param, big); - if (err) { - FAIL("Could not create BIG: %d\n", err); - return; - } - printk("success.\n"); - - printk("Wait for ISO connected callback..."); - while (!is_iso_connected) { - k_sleep(K_MSEC(100)); - } - printk("ISO connected\n"); -} - -static void terminate_big(struct bt_iso_big *big) -{ - int err; - - printk("Terminating BIG...\n"); - err = bt_iso_big_terminate(big); - if (err) { - FAIL("Could not terminate BIG: %d\n", err); - return; - } - printk("success.\n"); - - printk("Wait for ISO disconnected callback..."); - while (is_iso_disconnected == 0U) { - k_sleep(K_MSEC(100)); - } - printk("ISO disconnected\n"); -} -#endif /* !CONFIG_TEST_LL_INTERFACE */ - -#if defined(CONFIG_BT_ISO_TEST_PARAMS) -static void create_advanced_big(struct bt_le_ext_adv *adv, struct bt_iso_big **big) -{ - struct bt_iso_big_create_param big_create_param; - int err; - - printk("Creating BIG...\n"); - big_create_param.bis_channels = bis_channels; - big_create_param.num_bis = BIS_ISO_CHAN_COUNT; - big_create_param.encryption = false; - big_create_param.interval = 10000; /* us */ - big_create_param.packing = 0; /* 0 - sequential; 1 - interleaved */ - big_create_param.framing = 0; /* 0 - unframed; 1 - framed */ - big_create_param.irc = BT_ISO_IRC_MIN; - big_create_param.pto = BT_ISO_PTO_MIN; - big_create_param.iso_interval = big_create_param.interval / 1250U; /* N * 10 ms */ - - iso_tx_qos.sdu = 502; /* bytes */ - iso_tx_qos.phy = BT_GAP_LE_PHY_2M; - iso_tx_qos.max_pdu = BT_ISO_PDU_MAX; - iso_tx_qos.burst_number = BT_ISO_BN_MIN; - - bis_iso_qos.tx = &iso_tx_qos; - bis_iso_qos.rx = NULL; - bis_iso_qos.num_subevents = BT_ISO_NSE_MIN; - - err = bt_iso_big_create(adv, &big_create_param, big); - if (err) { - FAIL("Could not create BIG: %d\n", err); - return; - } - printk("success.\n"); - - printk("Wait for ISO connected callback..."); - while (!is_iso_connected) { - k_sleep(K_MSEC(100)); - } - printk("ISO connected\n"); -} -#endif /* CONFIG_BT_ISO_TEST_PARAMS */ - -static void test_iso_main(void) -{ - struct bt_le_ext_adv *adv; - int err; - - printk("\n*ISO broadcast test*\n"); - - printk("Bluetooth initializing..."); - err = bt_enable(NULL); - if (err) { - FAIL("Could not init BT: %d\n", err); - return; - } - printk("success.\n"); - - setup_ext_adv(&adv); - -#if defined(CONFIG_TEST_LL_INTERFACE) - uint8_t big_handle = 0; - - create_ll_big(big_handle, adv); - -#else /* !CONFIG_TEST_LL_INTERFACE */ - struct bt_iso_big *big; - - create_big(adv, &big); - - k_work_init_delayable(&iso_send_work, iso_send); - k_work_schedule(&iso_send_work, K_NO_WAIT); -#endif /* !CONFIG_TEST_LL_INTERFACE */ - - k_sleep(K_MSEC(5000)); - - printk("Update periodic advertising data 1..."); - err = bt_le_per_adv_set_data(adv, per_ad_data1, - ARRAY_SIZE(per_ad_data1)); - if (err) { - FAIL("Failed to update periodic advertising data 1 (%d).\n", - err); - } - printk("success.\n"); - - k_sleep(K_MSEC(2500)); - - printk("Periodic Advertising and ISO Channel Map Update..."); - err = bt_le_set_chan_map(chan_map); - if (err) { - FAIL("Channel Map Update failed.\n"); - } - printk("success.\n"); - - k_sleep(K_MSEC(2500)); - - printk("Update periodic advertising data 2..."); - err = bt_le_per_adv_set_data(adv, per_ad_data2, - ARRAY_SIZE(per_ad_data2)); - if (err) { - FAIL("Failed to update periodic advertising data 2 (%d).\n", - err); - } - printk("success.\n"); - - k_sleep(K_MSEC(5000)); - -#if defined(CONFIG_TEST_LL_INTERFACE) - terminate_ll_big(big_handle); - -#else /* !CONFIG_TEST_LL_INTERFACE */ - k_work_cancel_delayable(&iso_send_work); - - terminate_big(big); - big = NULL; - -#if defined(CONFIG_BT_ISO_TEST_PARAMS) - /* Quick check to just verify that creating a BIG using advanced/test - * parameters work - */ - create_advanced_big(adv, &big); - - terminate_big(big); - big = NULL; -#endif /* CONFIG_BT_ISO_TEST_PARAMS */ -#endif /* !CONFIG_TEST_LL_INTERFACE */ - - k_sleep(K_MSEC(10000)); - - teardown_ext_adv(adv); - adv = NULL; - - PASS("ISO tests Passed\n"); - - return; -} - -static const char *phy2str(uint8_t phy) -{ - switch (phy) { - case 0: return "No packets"; - case BT_GAP_LE_PHY_1M: return "LE 1M"; - case BT_GAP_LE_PHY_2M: return "LE 2M"; - case BT_GAP_LE_PHY_CODED: return "LE Coded"; - default: return "Unknown"; - } -} - -#if !defined(CONFIG_TEST_LL_INTERFACE) -/** Print data as d_0 d_1 d_2 ... d_(n-2) d_(n-1) d_(n) to show the 3 first and 3 last octets - * - * Examples: - * 01 - * 0102 - * 010203 - * 01020304 - * 0102030405 - * 010203040506 - * 010203...050607 - * 010203...060708 - * etc. - */ -static void iso_print_data(uint8_t *data, size_t data_len) -{ - /* Maximum number of octets from each end of the data */ - const uint8_t max_octets = 3; - char data_str[35]; - size_t str_len; - - str_len = bin2hex(data, MIN(max_octets, data_len), data_str, sizeof(data_str)); - if (data_len > max_octets) { - if (data_len > (max_octets * 2)) { - static const char dots[] = "..."; - - strcat(&data_str[str_len], dots); - str_len += strlen(dots); - } - - str_len += bin2hex(data + (data_len - MIN(max_octets, data_len - max_octets)), - MIN(max_octets, data_len - max_octets), - data_str + str_len, - sizeof(data_str) - str_len); - } - - printk("\t %s\n", data_str); -} - -#define SEQ_NUM_MAX 1000U -static uint16_t expected_seq_num[CONFIG_BT_ISO_MAX_CHAN]; - -static void iso_recv(struct bt_iso_chan *chan, - const struct bt_iso_recv_info *info, struct net_buf *buf) -{ - uint16_t seq_num; - uint8_t index; - - index = bt_conn_index(chan->iso); - - printk("Incoming data channel %p (%u) flags 0x%x seq_num %u ts %u len %u:\n", - chan, index, info->flags, info->seq_num, info->ts, buf->len); - iso_print_data(buf->data, buf->len); - - seq_num = sys_get_le16(buf->data); - if (info->flags & BT_ISO_FLAGS_VALID) { - if (seq_num != expected_seq_num[index]) { - if (expected_seq_num[index]) { - FAIL("ISO data miss match, expected %u actual %u\n", - expected_seq_num[index], seq_num); - } - expected_seq_num[index] = seq_num; - } - - expected_seq_num[index]++; - - } else if (expected_seq_num[index] && - expected_seq_num[index] < SEQ_NUM_MAX) { - FAIL("%s: Invalid ISO data after valid ISO data reception.\n" - "Expected %u\n", __func__, expected_seq_num[index]); - } -} - -static void iso_connected(struct bt_iso_chan *chan) -{ - printk("ISO Channel %p connected\n", chan); - - seq_num = 0U; - is_iso_connected = true; -} - -static void iso_disconnected(struct bt_iso_chan *chan, uint8_t reason) -{ - printk("ISO Channel %p disconnected with reason 0x%02x\n", chan, reason); - - is_iso_disconnected = reason; -} -#endif /* !CONFIG_TEST_LL_INTERFACE */ - -static bool volatile is_sync; - -static void pa_sync_cb(struct bt_le_per_adv_sync *sync, - struct bt_le_per_adv_sync_synced_info *info) -{ - char le_addr[BT_ADDR_LE_STR_LEN]; - - bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr)); - - printk("PER_ADV_SYNC[%u]: [DEVICE]: %s synced, " - "Interval 0x%04x (%u ms), PHY %s\n", - bt_le_per_adv_sync_get_index(sync), le_addr, - info->interval, info->interval * 5 / 4, phy2str(info->phy)); - - is_sync = true; -} - -static void pa_terminated_cb(struct bt_le_per_adv_sync *sync, - const struct bt_le_per_adv_sync_term_info *info) -{ - char le_addr[BT_ADDR_LE_STR_LEN]; - - bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr)); - - printk("PER_ADV_SYNC[%u]: [DEVICE]: %s sync terminated\n", - bt_le_per_adv_sync_get_index(sync), le_addr); - - if (!deleting_pa_sync) { - FAIL("PA terminated unexpectedly\n"); - } else { - deleting_pa_sync = false; - } -} - -static bool volatile is_sync_recv; - -static void pa_recv_cb(struct bt_le_per_adv_sync *sync, - const struct bt_le_per_adv_sync_recv_info *info, - struct net_buf_simple *buf) -{ - char le_addr[BT_ADDR_LE_STR_LEN]; - - bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr)); - - printk("PER_ADV_SYNC[%u]: [DEVICE]: %s, tx_power %i, " - "RSSI %i, CTE %u, data length %u\n", - bt_le_per_adv_sync_get_index(sync), le_addr, info->tx_power, - info->rssi, info->cte_type, buf->len); - - is_sync_recv = true; -} - -static void -pa_state_changed_cb(struct bt_le_per_adv_sync *sync, - const struct bt_le_per_adv_sync_state_info *info) -{ - printk("PER_ADV_SYNC[%u]: state changed, receive %s.\n", - bt_le_per_adv_sync_get_index(sync), - info->recv_enabled ? "enabled" : "disabled"); -} - -static bool volatile is_big_info; - -static void pa_biginfo_cb(struct bt_le_per_adv_sync *sync, - const struct bt_iso_biginfo *biginfo) -{ - char le_addr[BT_ADDR_LE_STR_LEN]; - - bt_addr_le_to_str(biginfo->addr, le_addr, sizeof(le_addr)); - printk("BIG INFO[%u]: [DEVICE]: %s, sid 0x%02x, " - "num_bis %u, nse %u, interval 0x%04x (%u ms), " - "bn %u, pto %u, irc %u, max_pdu %u, " - "sdu_interval %u us, max_sdu %u, phy %s, " - "%s framing, %sencrypted\n", - bt_le_per_adv_sync_get_index(sync), le_addr, biginfo->sid, - biginfo->num_bis, biginfo->sub_evt_count, - biginfo->iso_interval, - (biginfo->iso_interval * 5 / 4), - biginfo->burst_number, biginfo->offset, - biginfo->rep_count, biginfo->max_pdu, biginfo->sdu_interval, - biginfo->max_sdu, phy2str(biginfo->phy), - biginfo->framing ? "with" : "without", - biginfo->encryption ? "" : "not "); - - if (!is_big_info) { - is_big_info = true; - } -} - -static struct bt_le_per_adv_sync_cb sync_cb = { - .synced = pa_sync_cb, - .term = pa_terminated_cb, - .recv = pa_recv_cb, - .state_changed = pa_state_changed_cb, - .biginfo = pa_biginfo_cb, -}; - -#define NAME_LEN 30 - -static bool data_cb(struct bt_data *data, void *user_data) -{ - char *name = user_data; - - switch (data->type) { - case BT_DATA_NAME_SHORTENED: - case BT_DATA_NAME_COMPLETE: - memcpy(name, data->data, MIN(data->data_len, NAME_LEN - 1)); - return false; - default: - return true; - } -} - -static bool volatile is_periodic; -static bt_addr_le_t per_addr; -static uint8_t per_sid; - -static void scan_recv(const struct bt_le_scan_recv_info *info, - struct net_buf_simple *buf) -{ - char le_addr[BT_ADDR_LE_STR_LEN]; - char name[NAME_LEN]; - - (void)memset(name, 0, sizeof(name)); - - bt_data_parse(buf, data_cb, name); - - bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr)); - printk("[DEVICE]: %s, AD evt type %u, Tx Pwr: %i, RSSI %i %s " - "C:%u S:%u D:%u SR:%u E:%u Prim: %s, Secn: %s, " - "Interval: 0x%04x (%u ms), SID: %u\n", - le_addr, info->adv_type, info->tx_power, info->rssi, name, - (info->adv_props & BT_GAP_ADV_PROP_CONNECTABLE) != 0, - (info->adv_props & BT_GAP_ADV_PROP_SCANNABLE) != 0, - (info->adv_props & BT_GAP_ADV_PROP_DIRECTED) != 0, - (info->adv_props & BT_GAP_ADV_PROP_SCAN_RESPONSE) != 0, - (info->adv_props & BT_GAP_ADV_PROP_EXT_ADV) != 0, - phy2str(info->primary_phy), phy2str(info->secondary_phy), - info->interval, info->interval * 5 / 4, info->sid); - - if (info->interval) { - if (!is_periodic) { - is_periodic = true; - per_sid = info->sid; - bt_addr_le_copy(&per_addr, info->addr); - } - } -} - -static struct bt_le_scan_cb scan_callbacks = { - .recv = scan_recv, -}; - -static void test_iso_recv_main(void) -{ - struct bt_le_scan_param scan_param = { - .type = BT_LE_SCAN_TYPE_ACTIVE, - .options = BT_LE_SCAN_OPT_NONE, - .interval = 0x0004, - .window = 0x0004, - }; - struct bt_le_per_adv_sync_param sync_create_param; - struct bt_le_per_adv_sync *sync = NULL; - int err; - - printk("\n*ISO broadcast test*\n"); - - printk("Bluetooth initializing..."); - err = bt_enable(NULL); - if (err) { - FAIL("Could not init BT: %d\n", err); - return; - } - printk("success.\n"); - - printk("Scan callbacks register..."); - bt_le_scan_cb_register(&scan_callbacks); - printk("success.\n"); - - printk("Periodic Advertising callbacks register..."); - bt_le_per_adv_sync_cb_register(&sync_cb); - printk("Success.\n"); - - printk("Start scanning..."); - is_periodic = false; - err = bt_le_scan_start(&scan_param, NULL); - if (err) { - FAIL("Could not start scan: %d\n", err); - return; - } - printk("success.\n"); - - while (!is_periodic) { - k_sleep(K_MSEC(100)); - } - printk("Periodic Advertising found (SID: %u)\n", per_sid); - - printk("Creating Periodic Advertising Sync..."); - is_sync = false; - bt_addr_le_copy(&sync_create_param.addr, &per_addr); - sync_create_param.options = - BT_LE_PER_ADV_SYNC_OPT_REPORTING_INITIALLY_DISABLED; - sync_create_param.sid = per_sid; - sync_create_param.skip = 0; - sync_create_param.timeout = 0xa; - err = bt_le_per_adv_sync_create(&sync_create_param, &sync); - if (err) { - FAIL("Could not create sync: %d\n", err); - return; - } - printk("success.\n"); - - /* TODO: Enable when advertiser is added */ - printk("Waiting for sync..."); - while (!is_sync) { - k_sleep(K_MSEC(100)); - } - - printk("Stop scanning..."); - err = bt_le_scan_stop(); - if (err) { - FAIL("Could not stop scan: %d\n", err); - return; - } - printk("success.\n"); - - printk("Wait for BIG Info Advertising Report..."); - is_big_info = false; - while (!is_big_info) { - k_sleep(K_MSEC(100)); - } - printk("success.\n"); - -#if defined(CONFIG_TEST_LL_INTERFACE) - uint8_t bcode[BT_ISO_BROADCAST_CODE_SIZE] = { 0 }; - uint16_t sync_timeout = 10; - uint8_t bis[1] = { 0x01, }; - uint8_t big_handle = 0; - uint8_t encryption = 0; - uint8_t mse = 0; - - printk("Creating BIG Sync..."); - err = ll_big_sync_create(big_handle, sync->handle, encryption, bcode, - mse, sync_timeout, ARRAY_SIZE(bis), bis); - if (err) { - FAIL("Could not create BIG sync: %d\n", err); - return; - } - printk("success.\n"); - - k_sleep(K_MSEC(5000)); - - printk("Terminating BIG Sync..."); - struct node_rx_pdu *node_rx = NULL; - err = ll_big_sync_terminate(big_handle, (void **)&node_rx); - if (err) { - FAIL("Could not terminate BIG sync: %d\n", err); - return; - } - printk("success.\n"); - - if (node_rx) { - FAIL("Generated Node Rx for synchronized BIG.\n"); - } - - k_sleep(K_MSEC(5000)); - - printk("Creating BIG Sync after terminate..."); - err = ll_big_sync_create(big_handle, sync->handle, encryption, bcode, - mse, sync_timeout, ARRAY_SIZE(bis), bis); - if (err) { - FAIL("Could not create BIG sync: %d\n", err); - return; - } - printk("success.\n"); - - printk("Terminating BIG Sync..."); - node_rx = NULL; - err = ll_big_sync_terminate(big_handle, (void **)&node_rx); - if (err) { - FAIL("Could not terminate BIG sync: %d\n", err); - return; - } - printk("success.\n"); - - if (node_rx) { - node_rx->hdr.next = NULL; - ll_rx_mem_release((void **)&node_rx); - } - - printk("Deleting Periodic Advertising Sync..."); - deleting_pa_sync = true; - err = bt_le_per_adv_sync_delete(sync); - if (err) { - FAIL("Failed to delete periodic advertising sync (err %d)\n", - err); - return; - } - printk("success.\n"); - -#else /* !CONFIG_TEST_LL_INTERFACE */ - struct bt_iso_big_sync_param big_param = { 0, }; - struct bt_iso_big *big; - - printk("ISO BIG create sync..."); - is_iso_connected = false; - bis_iso_qos.tx = NULL; - bis_iso_qos.rx = &iso_rx_qos; - big_param.bis_channels = bis_channels; - big_param.num_bis = BIS_ISO_CHAN_COUNT; - big_param.bis_bitfield = BT_ISO_BIS_INDEX_BIT(1); /* BIS 1 selected */ - big_param.mse = 1; - big_param.sync_timeout = 100; /* 1000 ms */ - big_param.encryption = false; - iso_path_rx.pid = BT_HCI_DATAPATH_ID_HCI; - memset(big_param.bcode, 0, sizeof(big_param.bcode)); - err = bt_iso_big_sync(sync, &big_param, &big); - if (err) { - FAIL("Could not create BIG sync: %d\n", err); - return; - } - printk("success.\n"); - - printk("Wait for ISO connected callback..."); - while (!is_iso_connected) { - k_sleep(K_MSEC(100)); - } - - printk("ISO terminate BIG..."); - is_iso_disconnected = 0U; - err = bt_iso_big_terminate(big); - if (err) { - FAIL("Could not terminate BIG sync: %d\n", err); - return; - } - printk("success.\n"); - - printk("Waiting for ISO disconnected callback...\n"); - while (!is_iso_disconnected) { - k_sleep(K_MSEC(100)); - } - printk("disconnected.\n"); - - if (is_iso_disconnected != BT_HCI_ERR_LOCALHOST_TERM_CONN) { - FAIL("Local Host Terminate Failed.\n"); - } - - printk("ISO BIG create sync (test remote disconnect)..."); - is_iso_connected = false; - is_iso_disconnected = 0U; - memset(expected_seq_num, 0U, sizeof(expected_seq_num)); - err = bt_iso_big_sync(sync, &big_param, &big); - if (err) { - FAIL("Could not create BIG sync: %d\n", err); - return; - } - printk("success.\n"); - - printk("Wait for ISO connected callback..."); - while (!is_iso_connected) { - k_sleep(K_MSEC(100)); - } - printk("connected.\n"); - - printk("Waiting for ISO disconnected callback...\n"); - while (!is_iso_disconnected) { - k_sleep(K_MSEC(100)); - } - printk("disconnected.\n"); - - if (is_iso_disconnected != BT_HCI_ERR_REMOTE_USER_TERM_CONN) { - FAIL("Remote Host Terminate Failed.\n"); - } - - printk("Periodic sync receive enable...\n"); - err = bt_le_per_adv_sync_recv_enable(sync); - if (err) { - printk("failed (err %d)\n", err); - return; - } - printk("receive enabled.\n"); - - uint8_t check_countdown = 3; - - printk("Waiting for remote BIG terminate by checking for missing " - "%u BIG Info report...\n", check_countdown); - do { - is_sync_recv = false; - is_big_info = false; - while (!is_sync_recv) { - k_sleep(K_MSEC(100)); - } - - k_sleep(K_MSEC(100)); - - if (!is_big_info) { - if (!--check_countdown) { - break; - } - } - } while (1); - printk("success.\n"); - - printk("Deleting Periodic Advertising Sync..."); - deleting_pa_sync = true; - err = bt_le_per_adv_sync_delete(sync); - if (err) { - FAIL("Failed to delete periodic advertising sync (err %d)\n", - err); - return; - } - printk("success.\n"); - - for (int chan = 0; chan < CONFIG_BT_ISO_MAX_CHAN; chan++) { - if (expected_seq_num[chan] < SEQ_NUM_MAX) { - FAIL("ISO Data reception incomplete %u (%u).\n", - expected_seq_num[chan], SEQ_NUM_MAX); - return; - } - } -#endif /* !CONFIG_TEST_LL_INTERFACE */ - - PASS("ISO recv test Passed\n"); - - return; -} - -#if defined(CONFIG_BT_CTLR_ISO_VENDOR_DATA_PATH) -static void test_iso_recv_vs_dp_main(void) -{ - struct bt_le_scan_param scan_param = { - .type = BT_LE_SCAN_TYPE_ACTIVE, - .options = BT_LE_SCAN_OPT_NONE, - .interval = 0x0004, - .window = 0x0004, - }; - struct bt_le_per_adv_sync_param sync_create_param; - struct bt_le_per_adv_sync *sync = NULL; - int err; - - printk("Bluetooth initializing... "); - err = bt_enable(NULL); - if (err) { - FAIL("Could not init BT: %d\n", err); - return; - } - printk("success.\n"); - - printk("Scan callbacks register... "); - bt_le_scan_cb_register(&scan_callbacks); - printk("success.\n"); - - printk("Periodic Advertising callbacks register... "); - bt_le_per_adv_sync_cb_register(&sync_cb); - printk("success.\n"); - - printk("Configure vendor data path... "); - err = bt_configure_data_path(BT_HCI_DATAPATH_DIR_CTLR_TO_HOST, - BT_HCI_DATAPATH_ID_VS, 0U, NULL); - if (err) { - FAIL("Failed (err %d)\n", err); - return; - } - - printk("success.\n"); - printk("Start scanning... "); - is_periodic = false; - err = bt_le_scan_start(&scan_param, NULL); - if (err) { - FAIL("Could not start scan: %d\n", err); - return; - } - printk("success.\n"); - - while (!is_periodic) { - k_sleep(K_MSEC(100)); - } - printk("Periodic Advertising found (SID: %u)\n", per_sid); - - printk("Creating Periodic Advertising Sync... "); - is_sync = false; - - bt_addr_le_copy(&sync_create_param.addr, &per_addr); - sync_create_param.options = - BT_LE_PER_ADV_SYNC_OPT_REPORTING_INITIALLY_DISABLED; - sync_create_param.sid = per_sid; - sync_create_param.skip = 0; - sync_create_param.timeout = 0xa; - - err = bt_le_per_adv_sync_create(&sync_create_param, &sync); - if (err) { - FAIL("Could not create sync: %d\n", err); - return; - } - printk("success.\n"); - - /* TODO: Enable when advertiser is added */ - printk("Waiting for sync...\n"); - while (!is_sync) { - k_sleep(K_MSEC(100)); - } - printk("success.\n"); - - printk("Stop scanning... "); - err = bt_le_scan_stop(); - if (err) { - FAIL("Could not stop scan: %d\n", err); - return; - } - printk("success.\n"); - - printk("Wait for BIG Info Advertising Report...\n"); - is_big_info = false; - while (!is_big_info) { - k_sleep(K_MSEC(100)); - } - printk("success.\n"); - - struct bt_iso_big_sync_param big_param = { 0, }; - struct bt_iso_big *big; - - printk("ISO BIG create sync... "); - is_iso_connected = false; - bis_iso_qos.tx = NULL; - bis_iso_qos.rx = &iso_rx_qos; - big_param.bis_channels = bis_channels; - big_param.num_bis = BIS_ISO_CHAN_COUNT; - big_param.bis_bitfield = BT_ISO_BIS_INDEX_BIT(1); /* BIS 1 selected */ - big_param.mse = 1; - big_param.sync_timeout = 100; /* 1000 ms */ - big_param.encryption = false; - memset(big_param.bcode, 0, sizeof(big_param.bcode)); - - is_iso_connected = false; - is_iso_disconnected = 0U; - is_iso_vs_emitted = false; - iso_path_rx.pid = BT_HCI_DATAPATH_ID_VS; - - err = bt_iso_big_sync(sync, &big_param, &big); - if (err) { - FAIL("Could not create BIG sync: %d\n", err); - return; - } - printk("success.\n"); - - printk("Wait for ISO connected callback... "); - while (!is_iso_connected) { - k_sleep(K_MSEC(100)); - } - - /* Allow some SDUs to be received */ - k_sleep(K_MSEC(100)); - - printk("ISO terminate BIG... "); - is_iso_disconnected = 0U; - err = bt_iso_big_terminate(big); - if (err) { - FAIL("Could not terminate BIG sync: %d\n", err); - return; - } - printk("success.\n"); - - printk("Waiting for ISO disconnected callback...\n"); - while (!is_iso_disconnected) { - k_sleep(K_MSEC(100)); - } - printk("disconnected.\n"); - - if (is_iso_disconnected != BT_HCI_ERR_LOCALHOST_TERM_CONN) { - FAIL("Local Host Terminate Failed.\n"); - } - - if (!is_iso_vs_emitted) { - FAIL("Emitting of VS SDUs failed.\n"); - } - - printk("success.\n"); - - printk("Deleting Periodic Advertising Sync... "); - deleting_pa_sync = true; - err = bt_le_per_adv_sync_delete(sync); - if (err) { - FAIL("Failed to delete periodic advertising sync (err %d)\n", - err); - return; - } - printk("success.\n"); - - PASS("ISO recv VS test Passed\n"); -} -#endif /* CONFIG_BT_CTLR_ISO_VENDOR_DATA_PATH */ - -static void test_iso_init(void) -{ - bst_ticker_set_next_tick_absolute(60e6); - bst_result = In_progress; -} - -static void test_iso_tick(bs_time_t HW_device_time) -{ - if (bst_result != Passed) { - FAIL("test failed (not passed after seconds)\n"); - } -} - -static const struct bst_test_instance test_def[] = { - { - .test_id = "broadcast", - .test_descr = "ISO broadcast", - .test_pre_init_f = test_iso_init, - .test_tick_f = test_iso_tick, - .test_main_f = test_iso_main - }, - { - .test_id = "receive", - .test_descr = "ISO receive", - .test_pre_init_f = test_iso_init, - .test_tick_f = test_iso_tick, - .test_main_f = test_iso_recv_main - }, -#if defined(CONFIG_BT_CTLR_ISO_VENDOR_DATA_PATH) - { - .test_id = "receive_vs_dp", - .test_descr = "ISO receive VS", - .test_pre_init_f = test_iso_init, - .test_tick_f = test_iso_tick, - .test_main_f = test_iso_recv_vs_dp_main - }, -#endif /* CONFIG_BT_CTLR_ISO_VENDOR_DATA_PATH */ - BSTEST_END_MARKER -}; - -struct bst_test_list *test_iso_install(struct bst_test_list *tests) -{ - return bst_add_tests(tests, test_def); -} +#ifdef CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER +extern struct bst_test_list *test_past_install(struct bst_test_list *tests); +#else +extern struct bst_test_list *test_iso_install(struct bst_test_list *tests); +#endif /* CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER */ bst_test_install_t test_installers[] = { +#ifdef CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER + test_past_install, +#else test_iso_install, +#endif /* CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER */ NULL }; diff --git a/tests/bsim/bluetooth/ll/bis/src/test_bis.c b/tests/bsim/bluetooth/ll/bis/src/test_bis.c new file mode 100644 index 0000000000000..3b2b1a001c25c --- /dev/null +++ b/tests/bsim/bluetooth/ll/bis/src/test_bis.c @@ -0,0 +1,1230 @@ +/* + * Copyright (c) 2020 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include +#include + +#include +#include +#include + +#include "subsys/bluetooth/host/hci_core.h" +#include "subsys/bluetooth/controller/include/ll.h" +#include "subsys/bluetooth/controller/util/memq.h" +#include "subsys/bluetooth/controller/ll_sw/lll.h" + +/* For VS data path */ +#include "subsys/bluetooth/controller/ll_sw/isoal.h" +#include "subsys/bluetooth/controller/ll_sw/ull_iso_types.h" + +#include "bs_types.h" +#include "bs_tracing.h" +#include "time_machine.h" +#include "bstests.h" + +#define FAIL(...) \ + do { \ + bst_result = Failed; \ + bs_trace_error_time_line(__VA_ARGS__); \ + } while (0) + +#define PASS(...) \ + do { \ + bst_result = Passed; \ + bs_trace_info_time(1, __VA_ARGS__); \ + } while (0) + +extern enum bst_result_t bst_result; + +static uint8_t mfg_data1[] = { 0xff, 0xff, 0x01, 0x02, 0x03, 0x04 }; +static uint8_t mfg_data2[] = { 0xff, 0xff, 0x05 }; + +static const struct bt_data per_ad_data1[] = { + BT_DATA(BT_DATA_MANUFACTURER_DATA, mfg_data1, 6), +}; + +static const struct bt_data per_ad_data2[] = { + BT_DATA(BT_DATA_MANUFACTURER_DATA, mfg_data2, 3), +}; + +static uint8_t chan_map[] = { 0x1F, 0XF1, 0x1F, 0xF1, 0x1F }; + +static bool volatile is_iso_connected; +static uint8_t volatile is_iso_disconnected; +static bool volatile deleting_pa_sync; + +#if !defined(CONFIG_TEST_LL_INTERFACE) +static void iso_connected(struct bt_iso_chan *chan); +static void iso_disconnected(struct bt_iso_chan *chan, uint8_t reason); +static void iso_recv(struct bt_iso_chan *chan, + const struct bt_iso_recv_info *info, struct net_buf *buf); + +static struct bt_iso_chan_ops iso_ops = { + .connected = iso_connected, + .disconnected = iso_disconnected, + .recv = iso_recv, +}; + +static struct bt_iso_chan_path iso_path_rx = { + .pid = BT_HCI_DATAPATH_ID_HCI +}; + +static struct bt_iso_chan_qos bis_iso_qos; +static struct bt_iso_chan_io_qos iso_tx_qos; +static struct bt_iso_chan_io_qos iso_rx_qos = { + .path = &iso_path_rx +}; + +static struct bt_iso_chan bis_iso_chan = { + .ops = &iso_ops, + .qos = &bis_iso_qos, +}; + +#define BIS_ISO_CHAN_COUNT 1 +static struct bt_iso_chan *bis_channels[BIS_ISO_CHAN_COUNT] = { &bis_iso_chan }; +static uint16_t seq_num; + +NET_BUF_POOL_FIXED_DEFINE(bis_tx_pool, BIS_ISO_CHAN_COUNT, + BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), + CONFIG_BT_CONN_TX_USER_DATA_SIZE, NULL); + +#if defined(CONFIG_BT_CTLR_ISO_VENDOR_DATA_PATH) +static uint8_t test_rx_buffer[CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX]; +static bool is_iso_vs_emitted; + +static isoal_status_t test_sink_sdu_alloc(const struct isoal_sink *sink_ctx, + const struct isoal_pdu_rx *valid_pdu, + struct isoal_sdu_buffer *sdu_buffer) +{ + sdu_buffer->dbuf = test_rx_buffer; + sdu_buffer->size = sizeof(test_rx_buffer); + + return ISOAL_STATUS_OK; +} + + +static isoal_status_t test_sink_sdu_emit(const struct isoal_sink *sink_ctx, + const struct isoal_emitted_sdu_frag *sdu_frag, + const struct isoal_emitted_sdu *sdu) +{ + printk("Vendor sink SDU fragment size %u / %u, seq_num %u, ts %u\n", + sdu_frag->sdu_frag_size, sdu->total_sdu_size, sdu_frag->sdu.sn, + sdu_frag->sdu.timestamp); + is_iso_vs_emitted = true; + + return ISOAL_STATUS_OK; +} + +static isoal_status_t test_sink_sdu_write(void *dbuf, + const size_t sdu_written, + const uint8_t *pdu_payload, + const size_t consume_len) +{ + memcpy((uint8_t *)dbuf + sdu_written, pdu_payload, consume_len); + + return ISOAL_STATUS_OK; +} + + +bool ll_data_path_sink_create(uint16_t handle, struct ll_iso_datapath *datapath, + isoal_sink_sdu_alloc_cb *sdu_alloc, + isoal_sink_sdu_emit_cb *sdu_emit, + isoal_sink_sdu_write_cb *sdu_write) +{ + ARG_UNUSED(handle); + ARG_UNUSED(datapath); + + *sdu_alloc = test_sink_sdu_alloc; + *sdu_emit = test_sink_sdu_emit; + *sdu_write = test_sink_sdu_write; + + printk("VS data path sink created\n"); + return true; +} +#endif /* CONFIG_BT_CTLR_ISO_VENDOR_DATA_PATH */ + +#define BUF_ALLOC_TIMEOUT_MS (30) /* milliseconds */ +NET_BUF_POOL_FIXED_DEFINE(tx_pool, CONFIG_BT_ISO_TX_BUF_COUNT, + BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), + CONFIG_BT_CONN_TX_USER_DATA_SIZE, NULL); + +static struct k_work_delayable iso_send_work; + +BUILD_ASSERT(sizeof(seq_num) <= CONFIG_BT_ISO_TX_MTU); + +static void iso_send(struct k_work *work) +{ + static uint8_t iso_data[CONFIG_BT_ISO_TX_MTU]; + static bool data_initialized; + struct net_buf *buf; + size_t iso_data_len; + int ret; + + if (!data_initialized) { + data_initialized = true; + + for (size_t i = 0; i < ARRAY_SIZE(iso_data); i++) { + iso_data[i] = (uint8_t)i; + } + } + + buf = net_buf_alloc(&tx_pool, K_MSEC(BUF_ALLOC_TIMEOUT_MS)); + if (!buf) { + FAIL("Data buffer allocate timeout on channel\n"); + return; + } + + net_buf_reserve(buf, BT_ISO_CHAN_SEND_RESERVE); + sys_put_le16(seq_num, iso_data); + iso_data_len = MAX(sizeof(seq_num), ((seq_num % CONFIG_BT_ISO_TX_MTU) + 1)); + net_buf_add_mem(buf, iso_data, iso_data_len); + + bs_trace_info_time(4, "ISO send: seq_num %u\n", seq_num); + ret = bt_iso_chan_send(&bis_iso_chan, buf, seq_num++); + if (ret < 0) { + FAIL("Unable to broadcast data on channel (%d)\n", ret); + net_buf_unref(buf); + return; + } + + k_work_schedule(&iso_send_work, K_USEC(9970)); +} +#endif /* !CONFIG_TEST_LL_INTERFACE */ + +static void setup_ext_adv(struct bt_le_ext_adv **adv) +{ + int err; + + printk("Create advertising set..."); + err = bt_le_ext_adv_create(BT_LE_EXT_ADV_NCONN, NULL, adv); + if (err) { + FAIL("Failed to create advertising set (err %d)\n", err); + return; + } + printk("success.\n"); + + printk("Setting Periodic Advertising parameters..."); + err = bt_le_per_adv_set_param(*adv, BT_LE_PER_ADV_DEFAULT); + if (err) { + FAIL("Failed to set periodic advertising parameters (err %d)\n", + err); + return; + } + printk("success.\n"); + + printk("Enable Periodic Advertising..."); + err = bt_le_per_adv_start(*adv); + if (err) { + FAIL("Failed to enable periodic advertising (err %d)\n", err); + return; + } + printk("success.\n"); + + printk("Start extended advertising..."); + err = bt_le_ext_adv_start(*adv, BT_LE_EXT_ADV_START_DEFAULT); + if (err) { + printk("Failed to start extended advertising (err %d)\n", err); + return; + } + printk("success.\n"); +} + +static void teardown_ext_adv(struct bt_le_ext_adv *adv) +{ + int err; + + printk("Stop Periodic Advertising..."); + err = bt_le_per_adv_stop(adv); + if (err) { + FAIL("Failed to stop periodic advertising (err %d)\n", err); + return; + } + printk("success.\n"); + + printk("Stop Extended Advertising..."); + err = bt_le_ext_adv_stop(adv); + if (err) { + FAIL("Failed to stop extended advertising (err %d)\n", err); + return; + } + printk("success.\n"); + + printk("Deleting Extended Advertising..."); + err = bt_le_ext_adv_delete(adv); + if (err) { + FAIL("Failed to delete extended advertising (err %d)\n", err); + return; + } + printk("success.\n"); +} + +#if defined(CONFIG_TEST_LL_INTERFACE) +static void create_ll_big(uint8_t big_handle, struct bt_le_ext_adv *adv) +{ + uint16_t max_sdu = CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX; + uint8_t bcode[BT_ISO_BROADCAST_CODE_SIZE] = { 0 }; + uint32_t sdu_interval = 10000; /* us */ + uint16_t max_latency = 10; /* ms */ + uint8_t encryption = 0; + uint8_t bis_count = 1; /* TODO: Add support for multiple BIS per BIG */ + uint8_t phy = BIT(1); + uint8_t packing = 0; + uint8_t framing = 0; + uint8_t adv_handle; + uint8_t rtn = 0; + int err; + + printk("Creating LL BIG..."); + /* Assume that index == handle */ + adv_handle = bt_le_ext_adv_get_index(adv); + + err = ll_big_create(big_handle, adv_handle, bis_count, sdu_interval, + max_sdu, max_latency, rtn, phy, packing, framing, + encryption, bcode); + if (err) { + FAIL("Could not create BIG: %d\n", err); + return; + } + printk("success.\n"); +} + +static void terminate_ll_big(uint8_t big_handle) +{ + int err; + + printk("Terminating LL BIG..."); + err = ll_big_terminate(big_handle, BT_HCI_ERR_LOCALHOST_TERM_CONN); + if (err) { + FAIL("Could not terminate BIG: %d\n", err); + return; + } + printk("success.\n"); +} + +#else /* !CONFIG_TEST_LL_INTERFACE */ +static void create_big(struct bt_le_ext_adv *adv, struct bt_iso_big **big) +{ + struct bt_iso_big_create_param big_create_param = { 0 }; + int err; + + printk("Creating BIG...\n"); + big_create_param.bis_channels = bis_channels; + big_create_param.num_bis = BIS_ISO_CHAN_COUNT; + big_create_param.encryption = false; + big_create_param.interval = 10000; /* us */ + big_create_param.latency = 10; /* milliseconds */ + big_create_param.packing = 0; /* 0 - sequential; 1 - interleaved */ + big_create_param.framing = 0; /* 0 - unframed; 1 - framed */ + iso_tx_qos.sdu = CONFIG_BT_ISO_TX_MTU; /* bytes */ + iso_tx_qos.rtn = 2; + iso_tx_qos.phy = BT_GAP_LE_PHY_2M; + bis_iso_qos.tx = &iso_tx_qos; + bis_iso_qos.rx = NULL; + err = bt_iso_big_create(adv, &big_create_param, big); + if (err) { + FAIL("Could not create BIG: %d\n", err); + return; + } + printk("success.\n"); + + printk("Wait for ISO connected callback..."); + while (!is_iso_connected) { + k_sleep(K_MSEC(100)); + } + printk("ISO connected\n"); +} + +static void terminate_big(struct bt_iso_big *big) +{ + int err; + + printk("Terminating BIG...\n"); + err = bt_iso_big_terminate(big); + if (err) { + FAIL("Could not terminate BIG: %d\n", err); + return; + } + printk("success.\n"); + + printk("Wait for ISO disconnected callback..."); + while (is_iso_disconnected == 0U) { + k_sleep(K_MSEC(100)); + } + printk("ISO disconnected\n"); +} +#endif /* !CONFIG_TEST_LL_INTERFACE */ + +#if defined(CONFIG_BT_ISO_TEST_PARAMS) +static void create_advanced_big(struct bt_le_ext_adv *adv, struct bt_iso_big **big) +{ + struct bt_iso_big_create_param big_create_param; + int err; + + printk("Creating BIG...\n"); + big_create_param.bis_channels = bis_channels; + big_create_param.num_bis = BIS_ISO_CHAN_COUNT; + big_create_param.encryption = false; + big_create_param.interval = 10000; /* us */ + big_create_param.packing = 0; /* 0 - sequential; 1 - interleaved */ + big_create_param.framing = 0; /* 0 - unframed; 1 - framed */ + big_create_param.irc = BT_ISO_IRC_MIN; + big_create_param.pto = BT_ISO_PTO_MIN; + big_create_param.iso_interval = big_create_param.interval / 1250U; /* N * 10 ms */ + + iso_tx_qos.sdu = 502; /* bytes */ + iso_tx_qos.phy = BT_GAP_LE_PHY_2M; + iso_tx_qos.max_pdu = BT_ISO_PDU_MAX; + iso_tx_qos.burst_number = BT_ISO_BN_MIN; + + bis_iso_qos.tx = &iso_tx_qos; + bis_iso_qos.rx = NULL; + bis_iso_qos.num_subevents = BT_ISO_NSE_MIN; + + err = bt_iso_big_create(adv, &big_create_param, big); + if (err) { + FAIL("Could not create BIG: %d\n", err); + return; + } + printk("success.\n"); + + printk("Wait for ISO connected callback..."); + while (!is_iso_connected) { + k_sleep(K_MSEC(100)); + } + printk("ISO connected\n"); +} +#endif /* CONFIG_BT_ISO_TEST_PARAMS */ + +static void test_iso_main(void) +{ + struct bt_le_ext_adv *adv; + int err; + + printk("\n*ISO broadcast test*\n"); + + printk("Bluetooth initializing..."); + err = bt_enable(NULL); + if (err) { + FAIL("Could not init BT: %d\n", err); + return; + } + printk("success.\n"); + + setup_ext_adv(&adv); + +#if defined(CONFIG_TEST_LL_INTERFACE) + uint8_t big_handle = 0; + + create_ll_big(big_handle, adv); + +#else /* !CONFIG_TEST_LL_INTERFACE */ + struct bt_iso_big *big; + + create_big(adv, &big); + + k_work_init_delayable(&iso_send_work, iso_send); + k_work_schedule(&iso_send_work, K_NO_WAIT); +#endif /* !CONFIG_TEST_LL_INTERFACE */ + + k_sleep(K_MSEC(5000)); + + printk("Update periodic advertising data 1..."); + err = bt_le_per_adv_set_data(adv, per_ad_data1, + ARRAY_SIZE(per_ad_data1)); + if (err) { + FAIL("Failed to update periodic advertising data 1 (%d).\n", + err); + } + printk("success.\n"); + + k_sleep(K_MSEC(2500)); + + printk("Periodic Advertising and ISO Channel Map Update..."); + err = bt_le_set_chan_map(chan_map); + if (err) { + FAIL("Channel Map Update failed.\n"); + } + printk("success.\n"); + + k_sleep(K_MSEC(2500)); + + printk("Update periodic advertising data 2..."); + err = bt_le_per_adv_set_data(adv, per_ad_data2, + ARRAY_SIZE(per_ad_data2)); + if (err) { + FAIL("Failed to update periodic advertising data 2 (%d).\n", + err); + } + printk("success.\n"); + + k_sleep(K_MSEC(5000)); + +#if defined(CONFIG_TEST_LL_INTERFACE) + terminate_ll_big(big_handle); + +#else /* !CONFIG_TEST_LL_INTERFACE */ + k_work_cancel_delayable(&iso_send_work); + + terminate_big(big); + big = NULL; + +#if defined(CONFIG_BT_ISO_TEST_PARAMS) + /* Quick check to just verify that creating a BIG using advanced/test + * parameters work + */ + create_advanced_big(adv, &big); + + terminate_big(big); + big = NULL; +#endif /* CONFIG_BT_ISO_TEST_PARAMS */ +#endif /* !CONFIG_TEST_LL_INTERFACE */ + + k_sleep(K_MSEC(10000)); + + teardown_ext_adv(adv); + adv = NULL; + + PASS("ISO tests Passed\n"); +} + +static const char *phy2str(uint8_t phy) +{ + switch (phy) { + case 0: return "No packets"; + case BT_GAP_LE_PHY_1M: return "LE 1M"; + case BT_GAP_LE_PHY_2M: return "LE 2M"; + case BT_GAP_LE_PHY_CODED: return "LE Coded"; + default: return "Unknown"; + } +} + +#if !defined(CONFIG_TEST_LL_INTERFACE) +/** Print data as d_0 d_1 d_2 ... d_(n-2) d_(n-1) d_(n) to show the 3 first and 3 last octets + * + * Examples: + * 01 + * 0102 + * 010203 + * 01020304 + * 0102030405 + * 010203040506 + * 010203...050607 + * 010203...060708 + * etc. + */ +static void iso_print_data(uint8_t *data, size_t data_len) +{ + /* Maximum number of octets from each end of the data */ + const uint8_t max_octets = 3; + char data_str[35]; + size_t str_len; + + str_len = bin2hex(data, MIN(max_octets, data_len), data_str, sizeof(data_str)); + if (data_len > max_octets) { + if (data_len > (max_octets * 2)) { + static const char dots[] = "..."; + + strcat(&data_str[str_len], dots); + str_len += strlen(dots); + } + + str_len += bin2hex(data + (data_len - MIN(max_octets, data_len - max_octets)), + MIN(max_octets, data_len - max_octets), + data_str + str_len, + sizeof(data_str) - str_len); + } + + printk("\t %s\n", data_str); +} + +#define SEQ_NUM_MAX 1000U +static uint16_t expected_seq_num[CONFIG_BT_ISO_MAX_CHAN]; + +static void iso_recv(struct bt_iso_chan *chan, + const struct bt_iso_recv_info *info, struct net_buf *buf) +{ + uint16_t seq_num; + uint8_t index; + + index = bt_conn_index(chan->iso); + + printk("Incoming data channel %p (%u) flags 0x%x seq_num %u ts %u len %u:\n", + chan, index, info->flags, info->seq_num, info->ts, buf->len); + iso_print_data(buf->data, buf->len); + + seq_num = sys_get_le16(buf->data); + if (info->flags & BT_ISO_FLAGS_VALID) { + if (seq_num != expected_seq_num[index]) { + if (expected_seq_num[index]) { + FAIL("ISO data miss match, expected %u actual %u\n", + expected_seq_num[index], seq_num); + } + expected_seq_num[index] = seq_num; + } + + expected_seq_num[index]++; + + } else if (expected_seq_num[index] && + expected_seq_num[index] < SEQ_NUM_MAX) { + FAIL("%s: Invalid ISO data after valid ISO data reception.\n" + "Expected %u\n", __func__, expected_seq_num[index]); + } +} + +static void iso_connected(struct bt_iso_chan *chan) +{ + printk("ISO Channel %p connected\n", chan); + + seq_num = 0U; + is_iso_connected = true; +} + +static void iso_disconnected(struct bt_iso_chan *chan, uint8_t reason) +{ + printk("ISO Channel %p disconnected with reason 0x%02x\n", chan, reason); + + is_iso_disconnected = reason; +} +#endif /* !CONFIG_TEST_LL_INTERFACE */ + +static bool volatile is_sync; + +static void pa_sync_cb(struct bt_le_per_adv_sync *sync, + struct bt_le_per_adv_sync_synced_info *info) +{ + char le_addr[BT_ADDR_LE_STR_LEN]; + + bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr)); + + printk("PER_ADV_SYNC[%u]: [DEVICE]: %s synced, " + "Interval 0x%04x (%u ms), PHY %s\n", + bt_le_per_adv_sync_get_index(sync), le_addr, + info->interval, info->interval * 5 / 4, phy2str(info->phy)); + + is_sync = true; +} + +static void pa_terminated_cb(struct bt_le_per_adv_sync *sync, + const struct bt_le_per_adv_sync_term_info *info) +{ + char le_addr[BT_ADDR_LE_STR_LEN]; + + bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr)); + + printk("PER_ADV_SYNC[%u]: [DEVICE]: %s sync terminated\n", + bt_le_per_adv_sync_get_index(sync), le_addr); + + if (!deleting_pa_sync) { + FAIL("PA terminated unexpectedly\n"); + } else { + deleting_pa_sync = false; + } +} + +static bool volatile is_sync_recv; + +static void pa_recv_cb(struct bt_le_per_adv_sync *sync, + const struct bt_le_per_adv_sync_recv_info *info, + struct net_buf_simple *buf) +{ + char le_addr[BT_ADDR_LE_STR_LEN]; + + bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr)); + + printk("PER_ADV_SYNC[%u]: [DEVICE]: %s, tx_power %i, " + "RSSI %i, CTE %u, data length %u\n", + bt_le_per_adv_sync_get_index(sync), le_addr, info->tx_power, + info->rssi, info->cte_type, buf->len); + + is_sync_recv = true; +} + +static void +pa_state_changed_cb(struct bt_le_per_adv_sync *sync, + const struct bt_le_per_adv_sync_state_info *info) +{ + printk("PER_ADV_SYNC[%u]: state changed, receive %s.\n", + bt_le_per_adv_sync_get_index(sync), + info->recv_enabled ? "enabled" : "disabled"); +} + +static bool volatile is_big_info; + +static void pa_biginfo_cb(struct bt_le_per_adv_sync *sync, + const struct bt_iso_biginfo *biginfo) +{ + char le_addr[BT_ADDR_LE_STR_LEN]; + + bt_addr_le_to_str(biginfo->addr, le_addr, sizeof(le_addr)); + printk("BIG INFO[%u]: [DEVICE]: %s, sid 0x%02x, " + "num_bis %u, nse %u, interval 0x%04x (%u ms), " + "bn %u, pto %u, irc %u, max_pdu %u, " + "sdu_interval %u us, max_sdu %u, phy %s, " + "%s framing, %sencrypted\n", + bt_le_per_adv_sync_get_index(sync), le_addr, biginfo->sid, + biginfo->num_bis, biginfo->sub_evt_count, + biginfo->iso_interval, + (biginfo->iso_interval * 5 / 4), + biginfo->burst_number, biginfo->offset, + biginfo->rep_count, biginfo->max_pdu, biginfo->sdu_interval, + biginfo->max_sdu, phy2str(biginfo->phy), + biginfo->framing ? "with" : "without", + biginfo->encryption ? "" : "not "); + + if (!is_big_info) { + is_big_info = true; + } +} + +static struct bt_le_per_adv_sync_cb sync_cb = { + .synced = pa_sync_cb, + .term = pa_terminated_cb, + .recv = pa_recv_cb, + .state_changed = pa_state_changed_cb, + .biginfo = pa_biginfo_cb, +}; + +#define NAME_LEN 30 + +static bool data_cb(struct bt_data *data, void *user_data) +{ + char *name = user_data; + + switch (data->type) { + case BT_DATA_NAME_SHORTENED: + case BT_DATA_NAME_COMPLETE: + memcpy(name, data->data, MIN(data->data_len, NAME_LEN - 1)); + return false; + default: + return true; + } +} + +static bool volatile is_periodic; +static bt_addr_le_t per_addr; +static uint8_t per_sid; + +static void scan_recv(const struct bt_le_scan_recv_info *info, + struct net_buf_simple *buf) +{ + char le_addr[BT_ADDR_LE_STR_LEN]; + char name[NAME_LEN]; + + (void)memset(name, 0, sizeof(name)); + + bt_data_parse(buf, data_cb, name); + + bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr)); + printk("[DEVICE]: %s, AD evt type %u, Tx Pwr: %i, RSSI %i %s " + "C:%u S:%u D:%u SR:%u E:%u Prim: %s, Secn: %s, " + "Interval: 0x%04x (%u ms), SID: %u\n", + le_addr, info->adv_type, info->tx_power, info->rssi, name, + (info->adv_props & BT_GAP_ADV_PROP_CONNECTABLE) != 0, + (info->adv_props & BT_GAP_ADV_PROP_SCANNABLE) != 0, + (info->adv_props & BT_GAP_ADV_PROP_DIRECTED) != 0, + (info->adv_props & BT_GAP_ADV_PROP_SCAN_RESPONSE) != 0, + (info->adv_props & BT_GAP_ADV_PROP_EXT_ADV) != 0, + phy2str(info->primary_phy), phy2str(info->secondary_phy), + info->interval, info->interval * 5 / 4, info->sid); + + if (info->interval) { + if (!is_periodic) { + is_periodic = true; + per_sid = info->sid; + bt_addr_le_copy(&per_addr, info->addr); + } + } +} + +static struct bt_le_scan_cb scan_callbacks = { + .recv = scan_recv, +}; + +static void test_iso_recv_main(void) +{ + struct bt_le_scan_param scan_param = { + .type = BT_LE_SCAN_TYPE_ACTIVE, + .options = BT_LE_SCAN_OPT_NONE, + .interval = 0x0004, + .window = 0x0004, + }; + struct bt_le_per_adv_sync_param sync_create_param; + struct bt_le_per_adv_sync *sync = NULL; + int err; + + printk("\n*ISO broadcast test*\n"); + + printk("Bluetooth initializing..."); + err = bt_enable(NULL); + if (err) { + FAIL("Could not init BT: %d\n", err); + return; + } + printk("success.\n"); + + printk("Scan callbacks register..."); + bt_le_scan_cb_register(&scan_callbacks); + printk("success.\n"); + + printk("Periodic Advertising callbacks register..."); + bt_le_per_adv_sync_cb_register(&sync_cb); + printk("Success.\n"); + + printk("Start scanning..."); + is_periodic = false; + err = bt_le_scan_start(&scan_param, NULL); + if (err) { + FAIL("Could not start scan: %d\n", err); + return; + } + printk("success.\n"); + + while (!is_periodic) { + k_sleep(K_MSEC(100)); + } + printk("Periodic Advertising found (SID: %u)\n", per_sid); + + printk("Creating Periodic Advertising Sync..."); + is_sync = false; + bt_addr_le_copy(&sync_create_param.addr, &per_addr); + sync_create_param.options = + BT_LE_PER_ADV_SYNC_OPT_REPORTING_INITIALLY_DISABLED; + sync_create_param.sid = per_sid; + sync_create_param.skip = 0; + sync_create_param.timeout = 0xa; + err = bt_le_per_adv_sync_create(&sync_create_param, &sync); + if (err) { + FAIL("Could not create sync: %d\n", err); + return; + } + printk("success.\n"); + + /* TODO: Enable when advertiser is added */ + printk("Waiting for sync..."); + while (!is_sync) { + k_sleep(K_MSEC(100)); + } + + printk("Stop scanning..."); + err = bt_le_scan_stop(); + if (err) { + FAIL("Could not stop scan: %d\n", err); + return; + } + printk("success.\n"); + + printk("Wait for BIG Info Advertising Report..."); + is_big_info = false; + while (!is_big_info) { + k_sleep(K_MSEC(100)); + } + printk("success.\n"); + +#if defined(CONFIG_TEST_LL_INTERFACE) + uint8_t bcode[BT_ISO_BROADCAST_CODE_SIZE] = { 0 }; + uint16_t sync_timeout = 10; + uint8_t bis[1] = { 0x01, }; + uint8_t big_handle = 0; + uint8_t encryption = 0; + uint8_t mse = 0; + + printk("Creating BIG Sync..."); + err = ll_big_sync_create(big_handle, sync->handle, encryption, bcode, + mse, sync_timeout, ARRAY_SIZE(bis), bis); + if (err) { + FAIL("Could not create BIG sync: %d\n", err); + return; + } + printk("success.\n"); + + k_sleep(K_MSEC(5000)); + + printk("Terminating BIG Sync..."); + struct node_rx_pdu *node_rx = NULL; + + err = ll_big_sync_terminate(big_handle, (void **)&node_rx); + if (err) { + FAIL("Could not terminate BIG sync: %d\n", err); + return; + } + printk("success.\n"); + + if (node_rx) { + FAIL("Generated Node Rx for synchronized BIG.\n"); + } + + k_sleep(K_MSEC(5000)); + + printk("Creating BIG Sync after terminate..."); + err = ll_big_sync_create(big_handle, sync->handle, encryption, bcode, + mse, sync_timeout, ARRAY_SIZE(bis), bis); + if (err) { + FAIL("Could not create BIG sync: %d\n", err); + return; + } + printk("success.\n"); + + printk("Terminating BIG Sync..."); + node_rx = NULL; + err = ll_big_sync_terminate(big_handle, (void **)&node_rx); + if (err) { + FAIL("Could not terminate BIG sync: %d\n", err); + return; + } + printk("success.\n"); + + if (node_rx) { + node_rx->hdr.next = NULL; + ll_rx_mem_release((void **)&node_rx); + } + + printk("Deleting Periodic Advertising Sync..."); + deleting_pa_sync = true; + err = bt_le_per_adv_sync_delete(sync); + if (err) { + FAIL("Failed to delete periodic advertising sync (err %d)\n", + err); + return; + } + printk("success.\n"); + +#else /* !CONFIG_TEST_LL_INTERFACE */ + struct bt_iso_big_sync_param big_param = { 0, }; + struct bt_iso_big *big; + + printk("ISO BIG create sync..."); + is_iso_connected = false; + bis_iso_qos.tx = NULL; + bis_iso_qos.rx = &iso_rx_qos; + big_param.bis_channels = bis_channels; + big_param.num_bis = BIS_ISO_CHAN_COUNT; + big_param.bis_bitfield = BT_ISO_BIS_INDEX_BIT(1); /* BIS 1 selected */ + big_param.mse = 1; + big_param.sync_timeout = 100; /* 1000 ms */ + big_param.encryption = false; + iso_path_rx.pid = BT_HCI_DATAPATH_ID_HCI; + memset(big_param.bcode, 0, sizeof(big_param.bcode)); + err = bt_iso_big_sync(sync, &big_param, &big); + if (err) { + FAIL("Could not create BIG sync: %d\n", err); + return; + } + printk("success.\n"); + + printk("Wait for ISO connected callback..."); + while (!is_iso_connected) { + k_sleep(K_MSEC(100)); + } + + printk("ISO terminate BIG..."); + is_iso_disconnected = 0U; + err = bt_iso_big_terminate(big); + if (err) { + FAIL("Could not terminate BIG sync: %d\n", err); + return; + } + printk("success.\n"); + + printk("Waiting for ISO disconnected callback...\n"); + while (!is_iso_disconnected) { + k_sleep(K_MSEC(100)); + } + printk("disconnected.\n"); + + if (is_iso_disconnected != BT_HCI_ERR_LOCALHOST_TERM_CONN) { + FAIL("Local Host Terminate Failed.\n"); + } + + printk("ISO BIG create sync (test remote disconnect)..."); + is_iso_connected = false; + is_iso_disconnected = 0U; + memset(expected_seq_num, 0U, sizeof(expected_seq_num)); + err = bt_iso_big_sync(sync, &big_param, &big); + if (err) { + FAIL("Could not create BIG sync: %d\n", err); + return; + } + printk("success.\n"); + + printk("Wait for ISO connected callback..."); + while (!is_iso_connected) { + k_sleep(K_MSEC(100)); + } + printk("connected.\n"); + + printk("Waiting for ISO disconnected callback...\n"); + while (!is_iso_disconnected) { + k_sleep(K_MSEC(100)); + } + printk("disconnected.\n"); + + if (is_iso_disconnected != BT_HCI_ERR_REMOTE_USER_TERM_CONN) { + FAIL("Remote Host Terminate Failed.\n"); + } + + printk("Periodic sync receive enable...\n"); + err = bt_le_per_adv_sync_recv_enable(sync); + if (err) { + printk("failed (err %d)\n", err); + return; + } + printk("receive enabled.\n"); + + uint8_t check_countdown = 3; + + printk("Waiting for remote BIG terminate by checking for missing " + "%u BIG Info report...\n", check_countdown); + do { + is_sync_recv = false; + is_big_info = false; + while (!is_sync_recv) { + k_sleep(K_MSEC(100)); + } + + k_sleep(K_MSEC(100)); + + if (!is_big_info) { + if (!--check_countdown) { + break; + } + } + } while (1); + printk("success.\n"); + + printk("Deleting Periodic Advertising Sync..."); + deleting_pa_sync = true; + err = bt_le_per_adv_sync_delete(sync); + if (err) { + FAIL("Failed to delete periodic advertising sync (err %d)\n", + err); + return; + } + printk("success.\n"); + + for (int chan = 0; chan < CONFIG_BT_ISO_MAX_CHAN; chan++) { + if (expected_seq_num[chan] < SEQ_NUM_MAX) { + FAIL("ISO Data reception incomplete %u (%u).\n", + expected_seq_num[chan], SEQ_NUM_MAX); + return; + } + } +#endif /* !CONFIG_TEST_LL_INTERFACE */ + + PASS("ISO recv test Passed\n"); +} + +#if defined(CONFIG_BT_CTLR_ISO_VENDOR_DATA_PATH) +static void test_iso_recv_vs_dp_main(void) +{ + struct bt_le_scan_param scan_param = { + .type = BT_LE_SCAN_TYPE_ACTIVE, + .options = BT_LE_SCAN_OPT_NONE, + .interval = 0x0004, + .window = 0x0004, + }; + struct bt_le_per_adv_sync_param sync_create_param; + struct bt_le_per_adv_sync *sync = NULL; + int err; + + printk("Bluetooth initializing... "); + err = bt_enable(NULL); + if (err) { + FAIL("Could not init BT: %d\n", err); + return; + } + printk("success.\n"); + + printk("Scan callbacks register... "); + bt_le_scan_cb_register(&scan_callbacks); + printk("success.\n"); + + printk("Periodic Advertising callbacks register... "); + bt_le_per_adv_sync_cb_register(&sync_cb); + printk("success.\n"); + + printk("Configure vendor data path... "); + err = bt_configure_data_path(BT_HCI_DATAPATH_DIR_CTLR_TO_HOST, + BT_HCI_DATAPATH_ID_VS, 0U, NULL); + if (err) { + FAIL("Failed (err %d)\n", err); + return; + } + + printk("success.\n"); + printk("Start scanning... "); + is_periodic = false; + err = bt_le_scan_start(&scan_param, NULL); + if (err) { + FAIL("Could not start scan: %d\n", err); + return; + } + printk("success.\n"); + + while (!is_periodic) { + k_sleep(K_MSEC(100)); + } + printk("Periodic Advertising found (SID: %u)\n", per_sid); + + printk("Creating Periodic Advertising Sync... "); + is_sync = false; + + bt_addr_le_copy(&sync_create_param.addr, &per_addr); + sync_create_param.options = + BT_LE_PER_ADV_SYNC_OPT_REPORTING_INITIALLY_DISABLED; + sync_create_param.sid = per_sid; + sync_create_param.skip = 0; + sync_create_param.timeout = 0xa; + + err = bt_le_per_adv_sync_create(&sync_create_param, &sync); + if (err) { + FAIL("Could not create sync: %d\n", err); + return; + } + printk("success.\n"); + + /* TODO: Enable when advertiser is added */ + printk("Waiting for sync...\n"); + while (!is_sync) { + k_sleep(K_MSEC(100)); + } + printk("success.\n"); + + printk("Stop scanning... "); + err = bt_le_scan_stop(); + if (err) { + FAIL("Could not stop scan: %d\n", err); + return; + } + printk("success.\n"); + + printk("Wait for BIG Info Advertising Report...\n"); + is_big_info = false; + while (!is_big_info) { + k_sleep(K_MSEC(100)); + } + printk("success.\n"); + + struct bt_iso_big_sync_param big_param = { 0, }; + struct bt_iso_big *big; + + printk("ISO BIG create sync... "); + is_iso_connected = false; + bis_iso_qos.tx = NULL; + bis_iso_qos.rx = &iso_rx_qos; + big_param.bis_channels = bis_channels; + big_param.num_bis = BIS_ISO_CHAN_COUNT; + big_param.bis_bitfield = BT_ISO_BIS_INDEX_BIT(1); /* BIS 1 selected */ + big_param.mse = 1; + big_param.sync_timeout = 100; /* 1000 ms */ + big_param.encryption = false; + memset(big_param.bcode, 0, sizeof(big_param.bcode)); + + is_iso_connected = false; + is_iso_disconnected = 0U; + is_iso_vs_emitted = false; + iso_path_rx.pid = BT_HCI_DATAPATH_ID_VS; + + err = bt_iso_big_sync(sync, &big_param, &big); + if (err) { + FAIL("Could not create BIG sync: %d\n", err); + return; + } + printk("success.\n"); + + printk("Wait for ISO connected callback... "); + while (!is_iso_connected) { + k_sleep(K_MSEC(100)); + } + + /* Allow some SDUs to be received */ + k_sleep(K_MSEC(100)); + + printk("ISO terminate BIG... "); + is_iso_disconnected = 0U; + err = bt_iso_big_terminate(big); + if (err) { + FAIL("Could not terminate BIG sync: %d\n", err); + return; + } + printk("success.\n"); + + printk("Waiting for ISO disconnected callback...\n"); + while (!is_iso_disconnected) { + k_sleep(K_MSEC(100)); + } + printk("disconnected.\n"); + + if (is_iso_disconnected != BT_HCI_ERR_LOCALHOST_TERM_CONN) { + FAIL("Local Host Terminate Failed.\n"); + } + + if (!is_iso_vs_emitted) { + FAIL("Emitting of VS SDUs failed.\n"); + } + + printk("success.\n"); + + printk("Deleting Periodic Advertising Sync... "); + deleting_pa_sync = true; + err = bt_le_per_adv_sync_delete(sync); + if (err) { + FAIL("Failed to delete periodic advertising sync (err %d)\n", + err); + return; + } + printk("success.\n"); + + PASS("ISO recv VS test Passed\n"); +} +#endif /* CONFIG_BT_CTLR_ISO_VENDOR_DATA_PATH */ + +static void test_iso_init(void) +{ + bst_ticker_set_next_tick_absolute(60e6); + bst_result = In_progress; +} + +static void test_iso_tick(bs_time_t HW_device_time) +{ + if (bst_result != Passed) { + FAIL("test failed (not passed after seconds)\n"); + } +} + +static const struct bst_test_instance test_def[] = { + { + .test_id = "broadcast", + .test_descr = "ISO broadcast", + .test_pre_init_f = test_iso_init, + .test_tick_f = test_iso_tick, + .test_main_f = test_iso_main + }, + { + .test_id = "receive", + .test_descr = "ISO receive", + .test_pre_init_f = test_iso_init, + .test_tick_f = test_iso_tick, + .test_main_f = test_iso_recv_main + }, +#if defined(CONFIG_BT_CTLR_ISO_VENDOR_DATA_PATH) + { + .test_id = "receive_vs_dp", + .test_descr = "ISO receive VS", + .test_pre_init_f = test_iso_init, + .test_tick_f = test_iso_tick, + .test_main_f = test_iso_recv_vs_dp_main + }, +#endif /* CONFIG_BT_CTLR_ISO_VENDOR_DATA_PATH */ + BSTEST_END_MARKER +}; + +struct bst_test_list *test_iso_install(struct bst_test_list *tests) +{ + return bst_add_tests(tests, test_def); +} diff --git a/tests/bsim/bluetooth/ll/bis/src/test_past.c b/tests/bsim/bluetooth/ll/bis/src/test_past.c new file mode 100644 index 0000000000000..9103bdceddc71 --- /dev/null +++ b/tests/bsim/bluetooth/ll/bis/src/test_past.c @@ -0,0 +1,788 @@ +/* + * Copyright (c) 2024 Demant A/S + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "subsys/bluetooth/host/hci_core.h" +#include "subsys/bluetooth/controller/include/ll.h" +#include "subsys/bluetooth/controller/util/memq.h" +#include "subsys/bluetooth/controller/ll_sw/lll.h" + +#include "bs_types.h" +#include "bs_tracing.h" +#include "time_machine.h" +#include "bstests.h" + +static struct bt_conn *default_conn; + +extern enum bst_result_t bst_result; + +#define FAIL(...) \ + do { \ + bst_result = Failed; \ + bs_trace_error_time_line(__VA_ARGS__); \ + } while (0) + +#define PASS(...) \ + do { \ + bst_result = Passed; \ + bs_trace_info_time(1, __VA_ARGS__); \ + } while (0) + +extern enum bst_result_t bst_result; + +static K_SEM_DEFINE(sem_is_sync, 0, 1); +static K_SEM_DEFINE(sem_is_conn, 0, 1); + +/* Set timeout to 20s */ +#define K_SEM_TIMEOUT K_MSEC(20000) + +struct bt_le_per_adv_sync *default_sync; + +static void connected(struct bt_conn *conn, uint8_t conn_err) +{ + char addr[BT_ADDR_LE_STR_LEN]; + + bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); + + if (conn_err) { + FAIL("Failed to connect to %s (%u)\n", addr, conn_err); + return; + } + printk("Connected: %s\n", addr); + + k_sem_give(&sem_is_conn); +} + +static bool eir_found(struct bt_data *data, void *user_data) +{ + bt_addr_le_t *addr = user_data; + int i; + + printk("[AD]: %u data_len %u\n", data->type, data->data_len); + + switch (data->type) { + case BT_DATA_UUID16_SOME: + case BT_DATA_UUID16_ALL: + if (data->data_len % sizeof(uint16_t) != 0U) { + FAIL("AD malformed\n"); + return true; + } + + for (i = 0; i < data->data_len; i += sizeof(uint16_t)) { + const struct bt_uuid *uuid; + struct bt_le_conn_param *param; + uint16_t u16; + int err; + + memcpy(&u16, &data->data[i], sizeof(u16)); + uuid = BT_UUID_DECLARE_16(sys_le16_to_cpu(u16)); + if (bt_uuid_cmp(uuid, BT_UUID_HRS)) { + continue; + } + + err = bt_le_scan_stop(); + if (err) { + FAIL("Stop LE scan failed (err %d)\n", err); + continue; + } + + param = BT_LE_CONN_PARAM_DEFAULT; + err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, + param, &default_conn); + if (err) { + printk("Create conn failed (err %d)\n", err); + } + + return false; + } + } + + return true; +} + +static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, + struct net_buf_simple *ad) +{ + char dev[BT_ADDR_LE_STR_LEN]; + + bt_addr_le_to_str(addr, dev, sizeof(dev)); + printk("[DEVICE]: %s, AD evt type %u, AD data len %u, RSSI %i\n", + dev, type, ad->len, rssi); + + /* We're only interested in connectable events */ + if (type == BT_GAP_ADV_TYPE_ADV_IND || + type == BT_GAP_ADV_TYPE_ADV_DIRECT_IND) { + bt_data_parse(ad, eir_found, (void *)addr); + } +} + +static void disconnected(struct bt_conn *conn, uint8_t reason) +{ + char addr[BT_ADDR_LE_STR_LEN]; + + bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); + + printk("Disconnected: %s (reason 0x%02x)\n", addr, reason); + + if (default_conn != conn) { + return; + } + + bt_conn_unref(default_conn); + default_conn = NULL; +} + +static struct bt_conn_cb conn_callbacks = { + .connected = connected, + .disconnected = disconnected, +}; + + +static void setup_ext_adv(struct bt_le_ext_adv **adv) +{ + int err; + + printk("Create advertising set..."); + err = bt_le_ext_adv_create(BT_LE_EXT_ADV_NCONN, NULL, adv); + if (err) { + FAIL("Failed to create advertising set (err %d)\n", err); + return; + } + printk("success.\n"); + + printk("Setting Periodic Advertising parameters..."); + err = bt_le_per_adv_set_param(*adv, BT_LE_PER_ADV_DEFAULT); + if (err) { + FAIL("Failed to set periodic advertising parameters (err %d)\n", + err); + return; + } + printk("success.\n"); + + printk("Enable Periodic Advertising..."); + err = bt_le_per_adv_start(*adv); + if (err) { + FAIL("Failed to enable periodic advertising (err %d)\n", err); + return; + } + printk("success.\n"); + + printk("Start extended advertising..."); + err = bt_le_ext_adv_start(*adv, BT_LE_EXT_ADV_START_DEFAULT); + if (err) { + printk("Failed to start extended advertising (err %d)\n", err); + return; + } + printk("success.\n"); +} + +static void teardown_ext_adv(struct bt_le_ext_adv *adv) +{ + int err; + + printk("Stop Periodic Advertising..."); + err = bt_le_per_adv_stop(adv); + if (err) { + FAIL("Failed to stop periodic advertising (err %d)\n", err); + return; + } + printk("success.\n"); + + printk("Stop Extended Advertising..."); + err = bt_le_ext_adv_stop(adv); + if (err) { + FAIL("Failed to stop extended advertising (err %d)\n", err); + return; + } + printk("success.\n"); + + printk("Deleting Extended Advertising..."); + err = bt_le_ext_adv_delete(adv); + if (err) { + FAIL("Failed to delete extended advertising (err %d)\n", err); + return; + } + printk("success.\n"); +} + +static const char *phy2str(uint8_t phy) +{ + switch (phy) { + case 0: return "No packets"; + case BT_GAP_LE_PHY_1M: return "LE 1M"; + case BT_GAP_LE_PHY_2M: return "LE 2M"; + case BT_GAP_LE_PHY_CODED: return "LE Coded"; + default: return "Unknown"; + } +} + +static void pa_sync_cb(struct bt_le_per_adv_sync *sync, + struct bt_le_per_adv_sync_synced_info *info) +{ + char le_addr[BT_ADDR_LE_STR_LEN]; + + default_sync = sync; + + bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr)); + + printk("PER_ADV_SYNC[%u]: [DEVICE]: %s synced, " + "Interval 0x%04x (%u ms), PHY %s\n", + bt_le_per_adv_sync_get_index(sync), le_addr, + info->interval, info->interval * 5 / 4, phy2str(info->phy)); + + k_sem_give(&sem_is_sync); + + printk("Stop scanning\n"); + bt_le_scan_stop(); + printk("success.\n"); +} + +static void pa_terminated_cb(struct bt_le_per_adv_sync *sync, + const struct bt_le_per_adv_sync_term_info *info) +{ + char le_addr[BT_ADDR_LE_STR_LEN]; + + bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr)); + + printk("PER_ADV_SYNC[%u]: [DEVICE]: %s sync terminated\n", + bt_le_per_adv_sync_get_index(sync), le_addr); +} + +static void +pa_state_changed_cb(struct bt_le_per_adv_sync *sync, + const struct bt_le_per_adv_sync_state_info *info) +{ + printk("PER_ADV_SYNC[%u]: state changed, receive %s.\n", + bt_le_per_adv_sync_get_index(sync), + info->recv_enabled ? "enabled" : "disabled"); +} + + +static struct bt_le_per_adv_sync_cb sync_cb = { + .synced = pa_sync_cb, + .term = pa_terminated_cb, + .state_changed = pa_state_changed_cb, +}; + +static const struct bt_data ad[] = { + BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)), + BT_DATA_BYTES(BT_DATA_UUID16_ALL, + BT_UUID_16_ENCODE(BT_UUID_HRS_VAL), + BT_UUID_16_ENCODE(BT_UUID_BAS_VAL), + BT_UUID_16_ENCODE(BT_UUID_CTS_VAL)), +}; + +static void bt_ready(void) +{ + int err; + + printk("Peripheral Bluetooth initialized\n"); + + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), NULL, 0); + if (err) { + FAIL("Advertising failed to start (err %d)\n", err); + return; + } + + printk("Advertising successfully started\n"); +} + +#define NAME_LEN 30 + +static bool data_cb(struct bt_data *data, void *user_data) +{ + char *name = user_data; + + switch (data->type) { + case BT_DATA_NAME_SHORTENED: + case BT_DATA_NAME_COMPLETE: + memcpy(name, data->data, MIN(data->data_len, NAME_LEN - 1)); + return false; + default: + return true; + } +} + +static bool volatile is_periodic; +static bt_addr_le_t per_addr; +static uint8_t per_sid; + +static void scan_recv(const struct bt_le_scan_recv_info *info, + struct net_buf_simple *buf) +{ + char le_addr[BT_ADDR_LE_STR_LEN]; + char name[NAME_LEN]; + + (void)memset(name, 0, sizeof(name)); + + bt_data_parse(buf, data_cb, name); + + bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr)); + printk("[DEVICE]: %s, AD evt type %u, Tx Pwr: %i, RSSI %i %s " + "C:%u S:%u D:%u SR:%u E:%u Prim: %s, Secn: %s, " + "Interval: 0x%04x (%u ms), SID: %u\n", + le_addr, info->adv_type, info->tx_power, info->rssi, name, + (info->adv_props & BT_GAP_ADV_PROP_CONNECTABLE) != 0, + (info->adv_props & BT_GAP_ADV_PROP_SCANNABLE) != 0, + (info->adv_props & BT_GAP_ADV_PROP_DIRECTED) != 0, + (info->adv_props & BT_GAP_ADV_PROP_SCAN_RESPONSE) != 0, + (info->adv_props & BT_GAP_ADV_PROP_EXT_ADV) != 0, + phy2str(info->primary_phy), phy2str(info->secondary_phy), + info->interval, info->interval * 5 / 4, info->sid); + + if (info->interval) { + if (!is_periodic) { + is_periodic = true; + per_sid = info->sid; + bt_addr_le_copy(&per_addr, info->addr); + } + } +} + +static struct bt_le_scan_cb scan_callbacks = { + .recv = scan_recv, +}; + +static void test_broadcast_main(void) +{ + struct bt_le_ext_adv *adv; + int err; + + printk("\n*PA Broadcaster*\n"); + + printk("Bluetooth initializing..."); + err = bt_enable(NULL); + if (err) { + FAIL("Could not init BT: %d\n", err); + return; + } + printk("success.\n"); + + setup_ext_adv(&adv); + + k_sleep(K_MSEC(40000)); + + teardown_ext_adv(adv); + adv = NULL; + + PASS("Broadcast PA Passed\n"); +} + +static void test_broadcast_past_sender_main(void) +{ + struct bt_le_ext_adv *adv; + int err; + + printk("\n*Broadcaster*\n"); + + printk("Connection callbacks register...\n"); + bt_conn_cb_register(&conn_callbacks); + printk("Success.\n"); + + printk("Bluetooth initializing..."); + err = bt_enable(NULL); + if (err) { + FAIL("Could not init BT: %d\n", err); + return; + } + printk("success.\n"); + + printk("Scanning for peripheral\n"); + err = bt_le_scan_start(BT_LE_SCAN_ACTIVE, device_found); + if (err) { + FAIL("Scanning failed to start (err %d)\n", err); + return; + } + printk("success.\n"); + + printk("Waiting for connection...\n"); + err = k_sem_take(&sem_is_conn, K_SEM_TIMEOUT); + if (err) { + FAIL("Failed to connect (err %d)\n", err); + return; + } + printk("success.\n"); + + setup_ext_adv(&adv); + + k_sleep(K_MSEC(500)); + + printk("Connection established and broadcasting - sending PAST\n"); + err = bt_le_per_adv_set_info_transfer(adv, default_conn, 0); + if (err != 0) { + FAIL("Could not transfer periodic adv sync: %d", err); + return; + } + printk("success.\n"); + + printk("Wait 20s for PAST to be send\n"); + k_sleep(K_SEM_TIMEOUT); + + printk("Disconnect before actually passing\n"); + err = bt_conn_disconnect(default_conn, + BT_HCI_ERR_REMOTE_USER_TERM_CONN); + if (err) { + FAIL("Disconnection failed (err %d)\n", err); + return; + } + printk("success.\n"); + + teardown_ext_adv(adv); + adv = NULL; + + PASS("Broadcast PA Passed\n"); +} + +static void test_past_send_main(void) +{ + struct bt_le_scan_param scan_param = { + .type = BT_LE_SCAN_TYPE_ACTIVE, + .options = BT_LE_SCAN_OPT_NONE, + .interval = 0x0004, + .window = 0x0004, + }; + struct bt_le_per_adv_sync_param sync_create_param; + struct bt_le_per_adv_sync *sync = NULL; + uint16_t service_data = 0; + int err; + + printk("\n*Send PAST test*\n"); + + printk("Connection callbacks register...\n"); + bt_conn_cb_register(&conn_callbacks); + printk("Success.\n"); + + printk("Bluetooth initializing...\n"); + err = bt_enable(NULL); + if (err) { + FAIL("Could not init BT: %d\n", err); + return; + } + printk("success.\n"); + + printk("Scan callbacks register...\n"); + bt_le_scan_cb_register(&scan_callbacks); + printk("success.\n"); + + printk("Periodic Advertising callbacks register...\n"); + bt_le_per_adv_sync_cb_register(&sync_cb); + printk("Success.\n"); + + printk("Start scanning...\n"); + is_periodic = false; + err = bt_le_scan_start(&scan_param, NULL); + if (err) { + FAIL("Could not start scan: %d\n", err); + return; + } + printk("success.\n"); + + while (!is_periodic) { + k_sleep(K_MSEC(100)); + } + printk("Periodic Advertising found (SID: %u)\n", per_sid); + + printk("Creating Periodic Advertising Sync...\n"); + bt_addr_le_copy(&sync_create_param.addr, &per_addr); + sync_create_param.options = + BT_LE_PER_ADV_SYNC_OPT_REPORTING_INITIALLY_DISABLED; + sync_create_param.sid = per_sid; + sync_create_param.skip = 0; + sync_create_param.timeout = 0xa; + + err = bt_le_per_adv_sync_create(&sync_create_param, &sync); + if (err) { + FAIL("Could not create sync: %d\n", err); + return; + } + printk("success.\n"); + + printk("Waiting for sync...\n"); + err = k_sem_take(&sem_is_sync, K_SEM_TIMEOUT); + if (err) { + FAIL("failed (err %d)\n", err); + return; + } + printk("success.\n"); + + + printk("Scanning for peripheral\n"); + err = bt_le_scan_start(BT_LE_SCAN_ACTIVE, device_found); + if (err) { + FAIL("Scanning failed to start (err %d)\n", err); + return; + } + printk("success.\n"); + + printk("Waiting for connection...\n"); + err = k_sem_take(&sem_is_conn, K_SEM_TIMEOUT); + if (err) { + FAIL("Failed to connect (err %d)\n", err); + return; + } + printk("success.\n"); + + k_sleep(K_MSEC(1000)); + + printk("Connection established - sending PAST\n"); + err = bt_le_per_adv_sync_transfer(sync, default_conn, service_data); + if (err != 0) { + FAIL("Could not transfer periodic adv sync: %d", err); + return; + } + printk("success.\n"); + + printk("Wait 20s for PAST to be send\n"); + k_sleep(K_SEM_TIMEOUT); + + printk("Disconnect before actually passing\n"); + err = bt_conn_disconnect(default_conn, + BT_HCI_ERR_REMOTE_USER_TERM_CONN); + if (err) { + FAIL("Disconnection failed (err %d)\n", err); + return; + } + printk("success.\n"); + + printk("Deleting Periodic Advertising Sync...\n"); + err = bt_le_per_adv_sync_delete(sync); + if (err) { + FAIL("Failed to delete periodic advertising sync (err %d)\n", + err); + return; + } + printk("success.\n"); + + PASS("PAST send test Passed\n"); +} + +static void test_past_recv_main(void) +{ + struct bt_le_per_adv_sync_transfer_param past_param; + int err; + + printk("\n*Receive PAST Test*\n"); + + printk("Connection callbacks register...\n"); + bt_conn_cb_register(&conn_callbacks); + printk("Success.\n"); + + printk("Bluetooth initializing...\n"); + err = bt_enable(NULL); + if (err) { + FAIL("Could not init BT: %d\n", err); + return; + } + printk("success.\n"); + + printk("Scan callbacks register...\n"); + bt_le_scan_cb_register(&scan_callbacks); + printk("success.\n"); + + printk("Periodic Advertising callbacks register...\n"); + bt_le_per_adv_sync_cb_register(&sync_cb); + printk("Success.\n"); + + printk("Set default PAST Params.\n"); + past_param.skip = 1; + past_param.timeout = 1000; /* 10 seconds */ + past_param.options = BT_LE_PER_ADV_SYNC_TRANSFER_OPT_FILTER_DUPLICATES; + + err = bt_le_per_adv_sync_transfer_subscribe(NULL, &past_param); + if (err) { + FAIL("Failed to set default past parameters(err %d)\n", + err); + return; + } + printk("success.\n"); + + bt_ready(); + + printk("Waiting for connection...\n"); + err = k_sem_take(&sem_is_conn, K_SEM_TIMEOUT); + if (err) { + FAIL("Failed to connect (err %d)\n", err); + return; + } + printk("success.\n"); + + printk("Set PAST parameters for connection...\n"); + err = bt_le_per_adv_sync_transfer_subscribe(default_conn, &past_param); + if (err) { + FAIL("Failed to set default past parameters(err %d)\n", + err); + return; + } + printk("success.\n"); + + printk("Wait 20s for Periodic advertisement sync to be established\n"); + err = k_sem_take(&sem_is_sync, K_SEM_TIMEOUT); + if (err) { + FAIL("failed (err %d)\n", err); + return; + } + printk("success.\n"); + + printk("Deleting Periodic Advertising Sync..."); + err = bt_le_per_adv_sync_delete(default_sync); + if (err) { + FAIL("Failed to delete periodic advertising sync (err %d)\n", + err); + return; + } + printk("success.\n"); + + PASS("PAST recv test Passed\n"); +} + +static void test_past_recv_main_default_param(void) +{ + struct bt_le_per_adv_sync_transfer_param past_param; + int err; + + printk("\n*Receive PAST Test*\n"); + + printk("Connection callbacks register...\n"); + bt_conn_cb_register(&conn_callbacks); + printk("Success.\n"); + + printk("Bluetooth initializing...\n"); + err = bt_enable(NULL); + if (err) { + FAIL("Could not init BT: %d\n", err); + return; + } + printk("success.\n"); + + printk("Scan callbacks register...\n"); + bt_le_scan_cb_register(&scan_callbacks); + printk("success.\n"); + + printk("Periodic Advertising callbacks register...\n"); + bt_le_per_adv_sync_cb_register(&sync_cb); + printk("Success.\n"); + + printk("Set default PAST Params.\n"); + past_param.skip = 1; + past_param.timeout = 1000; /* 10 seconds */ + past_param.options = BT_LE_PER_ADV_SYNC_TRANSFER_OPT_FILTER_DUPLICATES; + + err = bt_le_per_adv_sync_transfer_subscribe(NULL, &past_param); + if (err) { + FAIL("Failed to set default past parameters(err %d)\n", + err); + return; + } + printk("success.\n"); + + bt_ready(); + + printk("Waiting for connection...\n"); + err = k_sem_take(&sem_is_conn, K_SEM_TIMEOUT); + if (err) { + FAIL("Failed to connect (err %d)\n", err); + return; + } + printk("success.\n"); + + printk("Wait 20s for Periodic advertisement sync to be established\n"); + err = k_sem_take(&sem_is_sync, K_SEM_TIMEOUT); + if (err) { + FAIL("failed (err %d)\n", err); + return; + } + printk("success.\n"); + + printk("Deleting Periodic Advertising Sync..."); + err = bt_le_per_adv_sync_delete(default_sync); + if (err) { + FAIL("Failed to delete periodic advertising sync (err %d)\n", + err); + return; + } + printk("success.\n"); + + PASS("PAST recv test Passed\n"); +} + +static void test_past_init(void) +{ + bst_ticker_set_next_tick_absolute(60e6); + bst_result = In_progress; +} + +static void test_past_tick(bs_time_t HW_device_time) +{ + if (bst_result != Passed) { + FAIL("test failed (not passed after seconds)\n"); + } +} + +static const struct bst_test_instance test_def[] = { + { + .test_id = "broadcast_pa", + .test_descr = "Periodic Advertisement broadcaster", + .test_pre_init_f = test_past_init, + .test_tick_f = test_past_tick, + .test_main_f = test_broadcast_main + }, + { + .test_id = "receive_past", + .test_descr = "Peripheral device, waiting for connection " + "and then waits for receiving PAST, then syncs to PA", + .test_pre_init_f = test_past_init, + .test_tick_f = test_past_tick, + .test_main_f = test_past_recv_main + }, + { + .test_id = "receive_past_default_param", + .test_descr = "Peripheral device, waiting for connection " + "and then waits for receiving PAST with the default PAST parameter set," + " then syncs to PA", + .test_pre_init_f = test_past_init, + .test_tick_f = test_past_tick, + .test_main_f = test_past_recv_main_default_param + }, + { + .test_id = "send_past", + .test_descr = "Central that syncs to PA from broadcaster," + "connects to peripheral and sends PAST", + .test_pre_init_f = test_past_init, + .test_tick_f = test_past_tick, + .test_main_f = test_past_send_main + }, + { + .test_id = "broadcast_past_sender", + .test_descr = "PA broadcaster, connects and sends PAST to peripheral", + .test_pre_init_f = test_past_init, + .test_tick_f = test_past_tick, + .test_main_f = test_broadcast_past_sender_main + }, + BSTEST_END_MARKER +}; + +struct bst_test_list *test_past_install(struct bst_test_list *tests) +{ + return bst_add_tests(tests, test_def); +} diff --git a/tests/bsim/bluetooth/ll/bis/testcase.yaml b/tests/bsim/bluetooth/ll/bis/testcase.yaml index c13d68f3fb790..2b75f6b2c28bc 100644 --- a/tests/bsim/bluetooth/ll/bis/testcase.yaml +++ b/tests/bsim/bluetooth/ll/bis/testcase.yaml @@ -40,3 +40,14 @@ tests: harness: bsim harness_config: bsim_exe_name: tests_bsim_bluetooth_ll_bis_prj_vs_dp_conf + bluetooth.ll.bis_past: + extra_args: CONF_FILE=prj_past.conf + platform_allow: + - nrf52_bsim + - nrf5340bsim/nrf5340/cpunet + integration_platforms: + - nrf52_bsim + - nrf5340bsim/nrf5340/cpunet + harness: bsim + harness_config: + bsim_exe_name: tests_bsim_bluetooth_ll_bis_prj_past_conf diff --git a/tests/bsim/bluetooth/ll/bis/tests_scripts/past.sh b/tests/bsim/bluetooth/ll/bis/tests_scripts/past.sh new file mode 100755 index 0000000000000..3a94f0668e9a6 --- /dev/null +++ b/tests/bsim/bluetooth/ll/bis/tests_scripts/past.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# Copyright (c) 2024 Demant A/S +# SPDX-License-Identifier: Apache-2.0 + +source ${ZEPHYR_BASE}/tests/bsim/sh_common.source + +# Basic PAST Test: Broadcaster is broadcasting Periodic Advertisements (PA). +# A central device syncronizes to the PA after it is synced, +# it will connect to the peripheral device. +# After connection is established the Central send a Periodic Sync Transfer (PAST) +# to the peripheral, which then synchronizes to the PA. +simulation_id="past_basic" +verbosity_level=2 + +cd ${BSIM_OUT_PATH}/bin + +Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_bis_prj_past_conf \ + -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=receive_past + +Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_bis_prj_past_conf \ + -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=broadcast_pa + +Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_bis_prj_past_conf \ + -v=${verbosity_level} -s=${simulation_id} -d=2 -testid=send_past + +Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ + -D=3 -sim_length=60e6 $@ + +wait_for_background_jobs diff --git a/tests/bsim/bluetooth/ll/bis/tests_scripts/past_default_past_params.sh b/tests/bsim/bluetooth/ll/bis/tests_scripts/past_default_past_params.sh new file mode 100755 index 0000000000000..1f425572e0898 --- /dev/null +++ b/tests/bsim/bluetooth/ll/bis/tests_scripts/past_default_past_params.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# Copyright (c) 2024 Demant A/S +# SPDX-License-Identifier: Apache-2.0 + +source ${ZEPHYR_BASE}/tests/bsim/sh_common.source + +# Basic PAST Test: Broadcaster is broadcasting Periodic Advertisements (PA). +# A central device syncronizes to the PA after it is synced, +# it will connect to the peripheral device. +# The Peripheral will subcribe to PAST using the default PAST Params +# After connection is established the Central send a Periodic Sync Transfer (PAST) +# to the peripheral, which then synchronizes to the PA. +simulation_id="past_basic_default_params" +verbosity_level=2 + +cd ${BSIM_OUT_PATH}/bin + +Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_bis_prj_past_conf \ + -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=receive_past_default_param + +Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_bis_prj_past_conf \ + -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=broadcast_pa + +Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_bis_prj_past_conf \ + -v=${verbosity_level} -s=${simulation_id} -d=2 -testid=send_past + +Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ + -D=3 -sim_length=60e6 $@ + +wait_for_background_jobs diff --git a/tests/bsim/bluetooth/ll/bis/tests_scripts/past_send_from_broadcaster.sh b/tests/bsim/bluetooth/ll/bis/tests_scripts/past_send_from_broadcaster.sh new file mode 100755 index 0000000000000..8bf001d2be14e --- /dev/null +++ b/tests/bsim/bluetooth/ll/bis/tests_scripts/past_send_from_broadcaster.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# Copyright (c) 2024 Demant A/S +# SPDX-License-Identifier: Apache-2.0 + +source ${ZEPHYR_BASE}/tests/bsim/sh_common.source + +# Basic PAST Test: Broadcaster connects to peripheral, after connection is established +# and it is Periodic Advertising (PA), the broadcaster send a Periodic Sync Transfer (PAST) +# to the peripheral, which then synchronizes to the PA. +simulation_id="past_send_from_broadcaster" +verbosity_level=2 + +cd ${BSIM_OUT_PATH}/bin + +Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_bis_prj_past_conf \ + -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=receive_past + +Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_bis_prj_past_conf \ + -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=broadcast_past_sender + +Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ + -D=2 -sim_length=60e6 $@ + +wait_for_background_jobs diff --git a/tests/bsim/bluetooth/ll/compile.sh b/tests/bsim/bluetooth/ll/compile.sh index c27c55a004774..bdb385c65108a 100755 --- a/tests/bsim/bluetooth/ll/compile.sh +++ b/tests/bsim/bluetooth/ll/compile.sh @@ -25,6 +25,7 @@ app=tests/bsim/bluetooth/ll/bis compile app=tests/bsim/bluetooth/ll/bis conf_overlay=overlay-ll_interface.conf compile app=tests/bsim/bluetooth/ll/bis conf_overlay=overlay-ticker_expire_info.conf compile app=tests/bsim/bluetooth/ll/bis conf_file=prj_vs_dp.conf compile +app=tests/bsim/bluetooth/ll/bis conf_file=prj_past.conf compile app=tests/bsim/bluetooth/ll/edtt/hci_test_app \ conf_file=prj_dut_llcp.conf compile From 01872642f4592f76bd865e7c0c3e8a1d77fcda71 Mon Sep 17 00:00:00 2001 From: Lucas Mathias Balling Date: Fri, 4 Oct 2024 13:34:42 +0200 Subject: [PATCH 1425/4482] Bluetooth: Audio: Fix PAST support for bap_scan_delegator Fixed PAST support for bap_scan_delegator Signed-off-by: Lucas Mathias Balling --- subsys/bluetooth/audio/bap_scan_delegator.c | 7 +++++++ .../audio/src/bap_scan_delegator_test.c | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/subsys/bluetooth/audio/bap_scan_delegator.c b/subsys/bluetooth/audio/bap_scan_delegator.c index 39ecf17062edc..a68f6b4316327 100644 --- a/subsys/bluetooth/audio/bap_scan_delegator.c +++ b/subsys/bluetooth/audio/bap_scan_delegator.c @@ -822,6 +822,7 @@ static int scan_delegator_mod_src(struct bt_conn *conn, */ if (pa_sync != BT_BAP_BASS_PA_REQ_NO_SYNC && state->pa_sync_state != BT_BAP_PA_STATE_SYNCED) { + const uint8_t pa_sync_state = state->pa_sync_state; const int err = pa_sync_request(conn, state, pa_sync, pa_interval); @@ -834,6 +835,12 @@ static int scan_delegator_mod_src(struct bt_conn *conn, err); return BT_GATT_ERR(BT_ATT_ERR_WRITE_REQ_REJECTED); + } else if (pa_sync_state != state->pa_sync_state) { + /* Temporary work around if the state is changed when pa_sync_request is + * called. See https://github.com/zephyrproject-rtos/zephyr/issues/79308 for + * more information about this issue. + */ + state_changed = true; } } else if (pa_sync == BT_BAP_BASS_PA_REQ_NO_SYNC && (state->pa_sync_state == BT_BAP_PA_STATE_INFO_REQ || diff --git a/tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c b/tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c index 6d34ee21a4a1a..10a41acb6546e 100644 --- a/tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c @@ -138,6 +138,7 @@ static int pa_sync_past(struct bt_conn *conn, struct bt_le_per_adv_sync_transfer_param param = { 0 }; int err; + param.options = BT_LE_PER_ADV_SYNC_TRANSFER_OPT_FILTER_DUPLICATES; param.skip = PA_SYNC_SKIP; param.timeout = interval_to_sync_timeout(pa_interval); @@ -267,6 +268,13 @@ static int pa_sync_req_cb(struct bt_conn *conn, if (past_avail) { err = pa_sync_past(conn, state, pa_interval); + if (err == 0) { + err = bt_bap_scan_delegator_set_pa_state(state->recv_state->src_id, + BT_BAP_PA_STATE_INFO_REQ); + if (err != 0) { + printk("Failed to set INFO_REQ state: %d", err); + } + } } else { err = pa_sync_no_past(state, pa_interval); } @@ -358,6 +366,14 @@ static void pa_synced_cb(struct bt_le_per_adv_sync *sync, printk("PA %p synced\n", sync); + if (info->conn) { /* if from PAST */ + for (size_t i = 0U; i < ARRAY_SIZE(sync_states); i++) { + if (!sync_states[i].pa_sync) { + sync_states[i].pa_sync = sync; + } + } + } + state = sync_state_get_by_pa(sync); if (state == NULL) { FAIL("Could not get sync state from PA sync %p\n", sync); From cd543887f41af8fcf504dded51f2346b605731d5 Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Wed, 18 Sep 2024 08:20:04 +0000 Subject: [PATCH 1426/4482] ci: build samples/cpp/hello_world as part of the multiplatform test Build the C++ version of the Hello, World sample as part of the multiplatform (build) test in CI. Signed-off-by: Henrik Brix Andersen --- .github/workflows/hello_world_multiplatform.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/hello_world_multiplatform.yaml b/.github/workflows/hello_world_multiplatform.yaml index 3543fb3fd540f..605cc2a903b69 100644 --- a/.github/workflows/hello_world_multiplatform.yaml +++ b/.github/workflows/hello_world_multiplatform.yaml @@ -69,7 +69,7 @@ jobs: elif [ "${{ runner.os }}" = "Windows" ]; then EXTRA_TWISTER_FLAGS="-P native_sim --short-build-path -O/tmp/twister-out" fi - ./scripts/twister --force-color --inline-logs -T samples/hello_world -v $EXTRA_TWISTER_FLAGS + ./scripts/twister --force-color --inline-logs -T samples/hello_world -T samples/cpp/hello_world -v $EXTRA_TWISTER_FLAGS - name: Upload artifacts if: failure() @@ -78,3 +78,4 @@ jobs: if-no-files-found: ignore path: zephyr/twister-out/*/samples/hello_world/sample.basic.helloworld/build.log + zephyr/twister-out/*/samples/cpp/hello_world/sample.cpp.helloworld/build.log From 60002865c7c84b1c606cab9ed5093582ff5c0321 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 28 Sep 2024 11:37:37 +0900 Subject: [PATCH 1427/4482] tests: drivers: build_all: Add a build_all test for crypto The test targets the following devices at this time. - atmel,ataes132a Signed-off-by: TOKITA Hiroshi --- tests/drivers/build_all/crypto/CMakeLists.txt | 8 +++++++ tests/drivers/build_all/crypto/app.overlay | 24 +++++++++++++++++++ tests/drivers/build_all/crypto/i2c.dtsi | 14 +++++++++++ tests/drivers/build_all/crypto/prj.conf | 2 ++ tests/drivers/build_all/crypto/src/main.c | 9 +++++++ tests/drivers/build_all/crypto/testcase.yaml | 11 +++++++++ 6 files changed, 68 insertions(+) create mode 100644 tests/drivers/build_all/crypto/CMakeLists.txt create mode 100644 tests/drivers/build_all/crypto/app.overlay create mode 100644 tests/drivers/build_all/crypto/i2c.dtsi create mode 100644 tests/drivers/build_all/crypto/prj.conf create mode 100644 tests/drivers/build_all/crypto/src/main.c create mode 100644 tests/drivers/build_all/crypto/testcase.yaml diff --git a/tests/drivers/build_all/crypto/CMakeLists.txt b/tests/drivers/build_all/crypto/CMakeLists.txt new file mode 100644 index 0000000000000..3742cd1ce05c6 --- /dev/null +++ b/tests/drivers/build_all/crypto/CMakeLists.txt @@ -0,0 +1,8 @@ +# Copyright (c) 2024 TOKITA Hiroshi +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(build_all) + +target_sources(app PRIVATE src/main.c) diff --git a/tests/drivers/build_all/crypto/app.overlay b/tests/drivers/build_all/crypto/app.overlay new file mode 100644 index 0000000000000..9143fb1bdf681 --- /dev/null +++ b/tests/drivers/build_all/crypto/app.overlay @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + + #include + +/ { + test { + #address-cells = <1>; + #size-cells = <1>; + + test_i2c: i2c@11112222 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "vnd,i2c"; + reg = <0x11112222 0x1000>; + status = "okay"; + clock-frequency = ; + + #include "i2c.dtsi" + }; + }; +}; diff --git a/tests/drivers/build_all/crypto/i2c.dtsi b/tests/drivers/build_all/crypto/i2c.dtsi new file mode 100644 index 0000000000000..14ae11fb2c723 --- /dev/null +++ b/tests/drivers/build_all/crypto/i2c.dtsi @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + +/**************************************** + * PLEASE KEEP REG ADDRESSES SEQUENTIAL * + ***************************************/ + +ataes132a@0 { + compatible = "atmel,ataes132a"; + reg = <0x0>; + status = "okay"; +}; diff --git a/tests/drivers/build_all/crypto/prj.conf b/tests/drivers/build_all/crypto/prj.conf new file mode 100644 index 0000000000000..fd4fd53504715 --- /dev/null +++ b/tests/drivers/build_all/crypto/prj.conf @@ -0,0 +1,2 @@ +CONFIG_CRYPTO=y +CONFIG_I2C=y diff --git a/tests/drivers/build_all/crypto/src/main.c b/tests/drivers/build_all/crypto/src/main.c new file mode 100644 index 0000000000000..175b9065f6778 --- /dev/null +++ b/tests/drivers/build_all/crypto/src/main.c @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + +int main(void) +{ + return 0; +} diff --git a/tests/drivers/build_all/crypto/testcase.yaml b/tests/drivers/build_all/crypto/testcase.yaml new file mode 100644 index 0000000000000..c54086663781e --- /dev/null +++ b/tests/drivers/build_all/crypto/testcase.yaml @@ -0,0 +1,11 @@ +# Copyright (c) 2024 TOKITA hiroshi +# SPDX-License-Identifier: Apache-2.0 + +tests: + drivers.crypto.build: + tags: + - drivers + - crypto + build_only: true + platform_allow: + - native_sim From 317405c01d188d436788683f0c3f31c1a201ec6a Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 28 Sep 2024 11:59:26 +0900 Subject: [PATCH 1428/4482] tests: drivers: build_all: Add a build_all test for disk The test targets the following devices at this time. - zephyr,sdmmc-disk - zephyr,mmc-disk Signed-off-by: TOKITA Hiroshi --- tests/drivers/build_all/disk/CMakeLists.txt | 8 +++++ tests/drivers/build_all/disk/app.overlay | 37 +++++++++++++++++++++ tests/drivers/build_all/disk/prj.conf | 2 ++ tests/drivers/build_all/disk/spi.dtsi | 21 ++++++++++++ tests/drivers/build_all/disk/src/main.c | 9 +++++ tests/drivers/build_all/disk/testcase.yaml | 12 +++++++ 6 files changed, 89 insertions(+) create mode 100644 tests/drivers/build_all/disk/CMakeLists.txt create mode 100644 tests/drivers/build_all/disk/app.overlay create mode 100644 tests/drivers/build_all/disk/prj.conf create mode 100644 tests/drivers/build_all/disk/spi.dtsi create mode 100644 tests/drivers/build_all/disk/src/main.c create mode 100644 tests/drivers/build_all/disk/testcase.yaml diff --git a/tests/drivers/build_all/disk/CMakeLists.txt b/tests/drivers/build_all/disk/CMakeLists.txt new file mode 100644 index 0000000000000..3742cd1ce05c6 --- /dev/null +++ b/tests/drivers/build_all/disk/CMakeLists.txt @@ -0,0 +1,8 @@ +# Copyright (c) 2024 TOKITA Hiroshi +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(build_all) + +target_sources(app PRIVATE src/main.c) diff --git a/tests/drivers/build_all/disk/app.overlay b/tests/drivers/build_all/disk/app.overlay new file mode 100644 index 0000000000000..17bbec2f0aebe --- /dev/null +++ b/tests/drivers/build_all/disk/app.overlay @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + test { + #address-cells = <1>; + #size-cells = <1>; + + test_gpio: gpio@deadbeef { + compatible = "vnd,gpio"; + gpio-controller; + reg = <0xdeadbeef 0x1000>; + #gpio-cells = <0x2>; + status = "okay"; + }; + + test_spi: spi@33334444 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "vnd,spi"; + reg = <0x33334444 0x1000>; + status = "okay"; + clock-frequency = <2000000>; + + /* one entry for every devices at spi.dtsi */ + cs-gpios = <&test_gpio 0 0>, + <&test_gpio 0 0>, + <&test_gpio 0 0>, + <&test_gpio 0 0>, + <&test_gpio 0 0>; + + #include "spi.dtsi" + }; + }; +}; diff --git a/tests/drivers/build_all/disk/prj.conf b/tests/drivers/build_all/disk/prj.conf new file mode 100644 index 0000000000000..a2789b406067a --- /dev/null +++ b/tests/drivers/build_all/disk/prj.conf @@ -0,0 +1,2 @@ +CONFIG_DISK_ACCESS=y +CONFIG_GPIO=y diff --git a/tests/drivers/build_all/disk/spi.dtsi b/tests/drivers/build_all/disk/spi.dtsi new file mode 100644 index 0000000000000..72014996abd89 --- /dev/null +++ b/tests/drivers/build_all/disk/spi.dtsi @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + +sdhc@0 { + compatible = "zephyr,sdhc-spi-slot"; + reg = <0>; + status = "okay"; + spi-max-frequency = <24000000>; + + sdmmc { + compatible = "zephyr,sdmmc-disk"; + status = "okay"; + }; + + mmc { + compatible = "zephyr,mmc-disk"; + status = "okay"; + }; +}; diff --git a/tests/drivers/build_all/disk/src/main.c b/tests/drivers/build_all/disk/src/main.c new file mode 100644 index 0000000000000..175b9065f6778 --- /dev/null +++ b/tests/drivers/build_all/disk/src/main.c @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + +int main(void) +{ + return 0; +} diff --git a/tests/drivers/build_all/disk/testcase.yaml b/tests/drivers/build_all/disk/testcase.yaml new file mode 100644 index 0000000000000..d7718823189fc --- /dev/null +++ b/tests/drivers/build_all/disk/testcase.yaml @@ -0,0 +1,12 @@ +# Copyright (c) 2024 TOKITA hiroshi +# SPDX-License-Identifier: Apache-2.0 + +tests: + drivers.disk.build: + tags: + - drivers + - disk + build_only: true + platform_allow: + - native_sim + - native_sim/native/64 From 06eaf05bc8f00f1dee47e084f6d8c4ac5b00533e Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Tue, 17 Sep 2024 22:12:19 +0900 Subject: [PATCH 1429/4482] tests: drivers: build_all: w1: Add i2c-devices build test Add build tests for following devices. - maxim,ds2482-800 - maxim,ds2484 - maxim,ds2485 Signed-off-by: TOKITA Hiroshi --- tests/drivers/build_all/w1/app.overlay | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/drivers/build_all/w1/app.overlay b/tests/drivers/build_all/w1/app.overlay index aa11ce6c168a9..fe022c514610d 100644 --- a/tests/drivers/build_all/w1/app.overlay +++ b/tests/drivers/build_all/w1/app.overlay @@ -27,5 +27,41 @@ compatible = "zephyr,w1-gpio"; gpios = <&test_gpio 0 0>; }; + + test_i2c: i2c@11112222 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "vnd,i2c"; + reg = <0x11112222 0x1000>; + status = "okay"; + clock-frequency = <100000>; + + test_i2c_ds2482_800: ds2482-800@0 { + compatible = "maxim,ds2482-800"; + reg = <0x0>; + + #address-cells = <1>; + #size-cells = <0>; + + w1_0: ch@0 { + compatible = "maxim,ds2482-800-channel"; + reg = <0>; + }; + }; + + test_i2c_ds2484: ds2484@1 { + compatible = "maxim,ds2484"; + reg = <0x1>; + }; + + test_i2c_ds2485: ds2485@2 { + compatible = "maxim,ds2485"; + reg = <0x2>; + + switching-threshold = "low"; + active-pull-threshold = "low"; + weak-pullup = "1000"; + }; + }; }; }; From 0845fbda7f42cf97db53f78878074b83573f8ef5 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Fri, 27 Sep 2024 10:44:35 +0900 Subject: [PATCH 1430/4482] tests: drivers: build_all: w1: Add `zephyr,w1-serial` to build test Add configuration for `zephyr,w1-serial` to enable build test Signed-off-by: TOKITA Hiroshi --- tests/drivers/build_all/w1/app.overlay | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/drivers/build_all/w1/app.overlay b/tests/drivers/build_all/w1/app.overlay index fe022c514610d..c68ceb1b83369 100644 --- a/tests/drivers/build_all/w1/app.overlay +++ b/tests/drivers/build_all/w1/app.overlay @@ -28,6 +28,19 @@ gpios = <&test_gpio 0 0>; }; + test_uart: uart@55556666 { + compatible = "vnd,serial"; + reg = <0x55556666 0x1000>; + status = "okay"; + + #address-cells = <1>; + #size-cells = <0>; + + test_uart_w1_serial: w1_serial { + compatible = "zephyr,w1-serial"; + }; + }; + test_i2c: i2c@11112222 { #address-cells = <1>; #size-cells = <0>; From 67db7fb2325b034db6366ba60d4a8e51c76c562e Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Thu, 10 Oct 2024 07:46:37 +0900 Subject: [PATCH 1431/4482] MAINTAINERS: Add build_all test files for crypto, disk and w1 Add build_all to `files:` entry to crypto, disk and w1. Signed-off-by: TOKITA Hiroshi --- MAINTAINERS.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index e9c2ff76f3410..214cf9b78aa1a 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -916,6 +916,7 @@ Disk: - subsys/sd/ - tests/subsys/sd/ - tests/drivers/disk/ + - tests/drivers/build_all/disk/ - include/zephyr/sd/ - dts/bindings/sd/ - dts/bindings/mmc/ @@ -1223,6 +1224,7 @@ Release Notes: - samples/drivers/crypto/ - tests/crypto/ - doc/services/crypto/ + - tests/drivers/build_all/crypto/ labels: - "area: Crypto / RNG" tests: @@ -2128,6 +2130,7 @@ Release Notes: - include/zephyr/drivers/w1.h - include/zephyr/drivers/sensor/w1_sensor.h - tests/drivers/w1/ + - tests/drivers/build_all/w1/ - samples/drivers/w1/ labels: - "area: W1" From fb6c4427b8343bebc6fd6f5737bea74dfa2e3368 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Fri, 2 Aug 2024 15:41:05 +0200 Subject: [PATCH 1432/4482] Bluetooth: Audio: Add helpers for broadcast name Added helper functions to set and get broadcast name for codec capabilities and codec configs. Signed-off-by: Emil Gydesen --- doc/releases/release-notes-4.0.rst | 8 +++ include/zephyr/bluetooth/audio/audio.h | 66 +++++++++++++++++- subsys/bluetooth/audio/codec.c | 97 ++++++++++++++++++++++++++ tests/bluetooth/audio/codec/src/main.c | 78 +++++++++++++++++++++ 4 files changed, 247 insertions(+), 2 deletions(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index e79f8dfd68be4..0fcc7db7ead27 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -113,6 +113,14 @@ Bluetooth * :c:func:`bt_audio_codec_cap_meta_get_assisted_listening_stream` * :c:func:`bt_audio_codec_cap_meta_set_assisted_listening_stream` + * Added APIs for getting and setting the broadcast name in codec capabilities + and codec configuration: + + * :c:func:`bt_audio_codec_cfg_meta_get_broadcast_name` + * :c:func:`bt_audio_codec_cfg_meta_set_broadcast_name` + * :c:func:`bt_audio_codec_cap_meta_get_broadcast_name` + * :c:func:`bt_audio_codec_cap_meta_set_broadcast_name` + * Host * Added API :c:func:`bt_gatt_get_uatt_mtu` to get current Unenhanced ATT MTU of a given diff --git a/include/zephyr/bluetooth/audio/audio.h b/include/zephyr/bluetooth/audio/audio.h index 03660dfb53b21..1d052e3828398 100644 --- a/include/zephyr/bluetooth/audio/audio.h +++ b/include/zephyr/bluetooth/audio/audio.h @@ -496,11 +496,14 @@ enum bt_audio_metadata_type { */ BT_AUDIO_METADATA_TYPE_ASSISTED_LISTENING_STREAM = 0x0A, + /** UTF-8 encoded Broadcast name */ + BT_AUDIO_METADATA_TYPE_BROADCAST_NAME = 0x0B, + /** Extended metadata */ - BT_AUDIO_METADATA_TYPE_EXTENDED = 0xFE, + BT_AUDIO_METADATA_TYPE_EXTENDED = 0xFE, /** Vendor specific metadata */ - BT_AUDIO_METADATA_TYPE_VENDOR = 0xFF, + BT_AUDIO_METADATA_TYPE_VENDOR = 0xFF, }; /** @@ -1367,6 +1370,36 @@ int bt_audio_codec_cfg_meta_get_assisted_listening_stream( int bt_audio_codec_cfg_meta_set_assisted_listening_stream( struct bt_audio_codec_cfg *codec_cfg, enum bt_audio_assisted_listening_stream val); +/** + * @brief Extract broadcast name + * + * See @ref BT_AUDIO_METADATA_TYPE_BROADCAST_NAME for more information about this value. + * + * @param[in] codec_cfg The codec data to search in. + * @param[out] broadcast_name Pointer to the UTF-8 formatted broadcast name. + * + * @retval length The length of the @p broadcast_name (may be 0) + * @retval -EINVAL if arguments are invalid + * @retval -ENODATA if not found + */ +int bt_audio_codec_cfg_meta_get_broadcast_name(const struct bt_audio_codec_cfg *codec_cfg, + const uint8_t **broadcast_name); + +/** + * @brief Set the broadcast name of a codec configuration metadata. + * + * @param codec_cfg The codec configuration to set data for. + * @param broadcast_name The broadcast name to set. + * @param broadcast_name_len The length of @p broadcast_name. + * + * @retval length The data_len of @p codec_cfg on success + * @retval -EINVAL if arguments are invalid + * @retval -ENOMEM if the new value could not set or added due to memory + */ +int bt_audio_codec_cfg_meta_set_broadcast_name(struct bt_audio_codec_cfg *codec_cfg, + const uint8_t *broadcast_name, + size_t broadcast_name_len); + /** * @brief Extract extended metadata * @@ -1938,6 +1971,35 @@ int bt_audio_codec_cap_meta_get_assisted_listening_stream( int bt_audio_codec_cap_meta_set_assisted_listening_stream( struct bt_audio_codec_cap *codec_cap, enum bt_audio_assisted_listening_stream val); +/** + * @brief Extract broadcast name + * + * See @ref BT_AUDIO_METADATA_TYPE_BROADCAST_NAME for more information about this value. + * + * @param[in] codec_cap The codec data to search in. + * @param[out] broadcast_name Pointer to the UTF-8 formatted broadcast name. + * + * @retval length The length of the @p broadcast_name (may be 0) + * @retval -EINVAL if arguments are invalid + * @retval -ENODATA if not found + */ +int bt_audio_codec_cap_meta_get_broadcast_name(const struct bt_audio_codec_cap *codec_cap, + const uint8_t **broadcast_name); + +/** + * @brief Set the broadcast name of a codec capability metadata. + * + * @param codec_cap The codec capability to set data for. + * @param broadcast_name The broadcast name to set. + * @param broadcast_name_len The length of @p broadcast_name. + * + * @retval length The data_len of @p codec_cap on success + * @retval -EINVAL if arguments are invalid + * @retval -ENOMEM if the new value could not set or added due to memory + */ +int bt_audio_codec_cap_meta_set_broadcast_name(struct bt_audio_codec_cap *codec_cap, + const uint8_t *broadcast_name, + size_t broadcast_name_len); /** * @brief Extract extended metadata * diff --git a/subsys/bluetooth/audio/codec.c b/subsys/bluetooth/audio/codec.c index 98135af9f8754..f07c4dc3a6171 100644 --- a/subsys/bluetooth/audio/codec.c +++ b/subsys/bluetooth/audio/codec.c @@ -1102,6 +1102,49 @@ static int codec_meta_set_assisted_listening_stream(uint8_t meta[], size_t meta_ sizeof(val_u8)); } +static int codec_meta_get_broadcast_name(const uint8_t meta[], size_t meta_len, + const uint8_t **broadcast_name) +{ + const uint8_t *data; + int ret; + + CHECKIF(meta == NULL) { + LOG_DBG("meta is NULL"); + return -EINVAL; + } + + CHECKIF(broadcast_name == NULL) { + LOG_DBG("broadcast_name is NULL"); + return -EINVAL; + } + + ret = codec_meta_get_val(meta, meta_len, BT_AUDIO_METADATA_TYPE_BROADCAST_NAME, &data); + if (data == NULL) { + return -ENODATA; + } + + *broadcast_name = data; + + return ret; +} + +static int codec_meta_set_broadcast_name(uint8_t meta[], size_t meta_len, size_t meta_size, + const uint8_t *broadcast_name, size_t broadcast_name_len) +{ + CHECKIF(meta == NULL) { + LOG_DBG("meta is NULL"); + return -EINVAL; + } + + CHECKIF(broadcast_name == NULL) { + LOG_DBG("broadcast_name is NULL"); + return -EINVAL; + } + + return codec_meta_set_val(meta, meta_len, meta_size, BT_AUDIO_METADATA_TYPE_BROADCAST_NAME, + broadcast_name, broadcast_name_len); +} + static int codec_meta_get_extended(const uint8_t meta[], size_t meta_len, const uint8_t **extended_meta) { @@ -1547,6 +1590,33 @@ int bt_audio_codec_cfg_meta_set_vendor(struct bt_audio_codec_cfg *codec_cfg, return ret; } + +int bt_audio_codec_cfg_meta_get_broadcast_name(const struct bt_audio_codec_cfg *codec_cfg, + const uint8_t **broadcast_name) +{ + CHECKIF(codec_cfg == NULL) { + LOG_DBG("codec_cfg is NULL"); + return -EINVAL; + } + + return codec_meta_get_broadcast_name(codec_cfg->meta, codec_cfg->meta_len, broadcast_name); +} + +int bt_audio_codec_cfg_meta_set_broadcast_name(struct bt_audio_codec_cfg *codec_cfg, + const uint8_t *broadcast_name, + size_t broadcast_name_len) +{ + int ret; + + ret = codec_meta_set_broadcast_name(codec_cfg->meta, codec_cfg->meta_len, + ARRAY_SIZE(codec_cfg->meta), broadcast_name, + broadcast_name_len); + if (ret >= 0) { + codec_cfg->meta_len = ret; + } + + return ret; +} #endif /* CONFIG_BT_AUDIO_CODEC_CFG_MAX_METADATA_SIZE > 0 */ #if CONFIG_BT_AUDIO_CODEC_CAP_MAX_METADATA_SIZE > 0 @@ -1900,6 +1970,33 @@ int bt_audio_codec_cap_meta_set_vendor(struct bt_audio_codec_cap *codec_cap, return ret; } + +int bt_audio_codec_cap_meta_get_broadcast_name(const struct bt_audio_codec_cap *codec_cap, + const uint8_t **broadcast_name) +{ + CHECKIF(codec_cap == NULL) { + LOG_DBG("codec_cap is NULL"); + return -EINVAL; + } + + return codec_meta_get_broadcast_name(codec_cap->meta, codec_cap->meta_len, broadcast_name); +} + +int bt_audio_codec_cap_meta_set_broadcast_name(struct bt_audio_codec_cap *codec_cap, + const uint8_t *broadcast_name, + size_t broadcast_name_len) +{ + int ret; + + ret = codec_meta_set_broadcast_name(codec_cap->meta, codec_cap->meta_len, + ARRAY_SIZE(codec_cap->meta), broadcast_name, + broadcast_name_len); + if (ret >= 0) { + codec_cap->meta_len = ret; + } + + return ret; +} #endif /* CONFIG_BT_AUDIO_CODEC_CAP_MAX_METADATA_SIZE > 0 */ #endif /* CONFIG_BT_AUDIO_CODEC_CFG_MAX_METADATA_SIZE > 0 || \ * CONFIG_BT_AUDIO_CODEC_CAP_MAX_METADATA_SIZE > 0 \ diff --git a/tests/bluetooth/audio/codec/src/main.c b/tests/bluetooth/audio/codec/src/main.c index 88a5d25230197..a3a189e86ca28 100644 --- a/tests/bluetooth/audio/codec/src/main.c +++ b/tests/bluetooth/audio/codec/src/main.c @@ -959,6 +959,45 @@ ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_meta_set_assisted_listenin zassert_equal(ret, 0x00, "Unexpected return value %d", ret); } +ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_meta_get_broadcast_name) +{ + const uint8_t expected_data[] = {'m', 'y', ' ', 'b', 'c', 'a', 's', 't'}; + const struct bt_audio_codec_cfg codec_cfg = + BT_AUDIO_CODEC_CFG(BT_HCI_CODING_FORMAT_LC3, 0x0000, 0x0000, {}, + {BT_AUDIO_CODEC_DATA(BT_AUDIO_METADATA_TYPE_BROADCAST_NAME, 'm', + 'y', ' ', 'b', 'c', 'a', 's', 't')}); + const uint8_t *broadcast_name; + int ret; + + ret = bt_audio_codec_cfg_meta_get_broadcast_name(&codec_cfg, &broadcast_name); + zassert_equal(ret, ARRAY_SIZE(expected_data), "Unexpected return value %d", ret); + zassert_mem_equal(expected_data, broadcast_name, ARRAY_SIZE(expected_data)); +} + +ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_meta_set_broadcast_name) +{ + const uint8_t expected_data[] = {'m', 'y', ' ', 'b', 'c', 'a', 's', 't'}; + const uint8_t new_expected_data[] = {'n', 'e', 'w', ' ', 'b', 'c', 'a', 's', 't'}; + struct bt_audio_codec_cfg codec_cfg = + BT_AUDIO_CODEC_CFG(BT_HCI_CODING_FORMAT_LC3, 0x0000, 0x0000, {}, + {BT_AUDIO_CODEC_DATA(BT_AUDIO_METADATA_TYPE_BROADCAST_NAME, 'm', + 'y', ' ', 'b', 'c', 'a', 's', 't')}); + const uint8_t *broadcast_name; + int ret; + + ret = bt_audio_codec_cfg_meta_get_broadcast_name(&codec_cfg, &broadcast_name); + zassert_equal(ret, ARRAY_SIZE(expected_data), "Unexpected return value %d", ret); + zassert_mem_equal(expected_data, broadcast_name, ARRAY_SIZE(expected_data)); + + ret = bt_audio_codec_cfg_meta_set_broadcast_name(&codec_cfg, new_expected_data, + ARRAY_SIZE(new_expected_data)); + zassert_true(ret > 0, "Unexpected return value %d", ret); + + ret = bt_audio_codec_cfg_meta_get_broadcast_name(&codec_cfg, &broadcast_name); + zassert_equal(ret, ARRAY_SIZE(new_expected_data), "Unexpected return value %d", ret); + zassert_mem_equal(new_expected_data, broadcast_name, ARRAY_SIZE(new_expected_data)); +} + ZTEST(audio_codec_test_suite, test_bt_audio_codec_cfg_meta_get_extended) { const uint8_t expected_data[] = {0x00, 0x01, 0x02, 0x03}; @@ -1873,6 +1912,45 @@ ZTEST(audio_codec_test_suite, test_bt_audio_codec_cap_meta_set_assisted_listenin zassert_equal(ret, 0x00, "Unexpected return value %d", ret); } +ZTEST(audio_codec_test_suite, test_bt_audio_codec_cap_meta_get_broadcast_name) +{ + const uint8_t expected_data[] = {'m', 'y', ' ', 'b', 'c', 'a', 's', 't'}; + const struct bt_audio_codec_cap codec_cap = + BT_AUDIO_CODEC_CAP(BT_HCI_CODING_FORMAT_LC3, 0x0000, 0x0000, {}, + {BT_AUDIO_CODEC_DATA(BT_AUDIO_METADATA_TYPE_BROADCAST_NAME, 'm', + 'y', ' ', 'b', 'c', 'a', 's', 't')}); + const uint8_t *broadcast_name; + int ret; + + ret = bt_audio_codec_cap_meta_get_broadcast_name(&codec_cap, &broadcast_name); + zassert_equal(ret, ARRAY_SIZE(expected_data), "Unexpected return value %d", ret); + zassert_mem_equal(expected_data, broadcast_name, ARRAY_SIZE(expected_data)); +} + +ZTEST(audio_codec_test_suite, test_bt_audio_codec_cap_meta_set_broadcast_name) +{ + const uint8_t expected_data[] = {'m', 'y', ' ', 'b', 'c', 'a', 's', 't'}; + const uint8_t new_expected_data[] = {'n', 'e', 'w', ' ', 'b', 'c', 'a', 's', 't'}; + struct bt_audio_codec_cap codec_cap = + BT_AUDIO_CODEC_CAP(BT_HCI_CODING_FORMAT_LC3, 0x0000, 0x0000, {}, + {BT_AUDIO_CODEC_DATA(BT_AUDIO_METADATA_TYPE_BROADCAST_NAME, 'm', + 'y', ' ', 'b', 'c', 'a', 's', 't')}); + const uint8_t *broadcast_name; + int ret; + + ret = bt_audio_codec_cap_meta_get_broadcast_name(&codec_cap, &broadcast_name); + zassert_equal(ret, ARRAY_SIZE(expected_data), "Unexpected return value %d", ret); + zassert_mem_equal(expected_data, broadcast_name, ARRAY_SIZE(expected_data)); + + ret = bt_audio_codec_cap_meta_set_broadcast_name(&codec_cap, new_expected_data, + ARRAY_SIZE(new_expected_data)); + zassert_true(ret > 0, "Unexpected return value %d", ret); + + ret = bt_audio_codec_cap_meta_get_broadcast_name(&codec_cap, &broadcast_name); + zassert_equal(ret, ARRAY_SIZE(new_expected_data), "Unexpected return value %d", ret); + zassert_mem_equal(new_expected_data, broadcast_name, ARRAY_SIZE(new_expected_data)); +} + ZTEST(audio_codec_test_suite, test_bt_audio_codec_cap_meta_get_extended) { const uint8_t expected_data[] = {0x00, 0x01, 0x02, 0x03}; From 5c5f3b0b5109103cf01abc990b5da0e429545533 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 17 Oct 2024 10:40:35 +0300 Subject: [PATCH 1433/4482] hostap: Remove extra IEEE8021X_EAPOL as it was mentioned twice The CONFIG_IEEE8021X_EAPOL was in the Kconfig file twice so remove the extra entry. Signed-off-by: Jukka Rissanen --- modules/hostap/Kconfig | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 09a43d7d07e33..5ed4fb8c559fb 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -439,9 +439,6 @@ config EAP_EKE config EAP_IKEv2 bool -config IEEE8021X_EAPOL - bool - config CRYPTO_INTERNAL bool From 18275f84d7d42ace2e15b07b34717ed3324d2c1d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 17 Oct 2024 10:41:54 +0300 Subject: [PATCH 1434/4482] hostap: Fix hostapd AP compilation error The supplicant_ap_status() is only available if CONFIG_WIFI_NM_HOSTAPD_AP is enabled. Signed-off-by: Jukka Rissanen --- modules/hostap/src/supp_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index 24561086f384f..fd6449e98a9a0 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -1847,7 +1847,6 @@ int supplicant_ap_config_params(const struct device *dev, struct wifi_ap_config_ return ret; } -#endif int supplicant_ap_status(const struct device *dev, struct wifi_iface_status *status) { @@ -1922,6 +1921,7 @@ int supplicant_ap_status(const struct device *dev, struct wifi_iface_status *sta k_mutex_unlock(&wpa_supplicant_mutex); return ret; } +#endif /* CONFIG_WIFI_NM_HOSTAPD_AP */ int supplicant_ap_enable(const struct device *dev, struct wifi_connect_req_params *params) From 0edb64db5f47a4b4a5df957621087b4005b0d9f5 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 17 Oct 2024 11:00:20 +0300 Subject: [PATCH 1435/4482] hostap: Add ip-addr.c compilation to the build The functions in ip-addr.c are needed in more places than just for hostapd so add it unconditionally to the build. Signed-off-by: Jukka Rissanen --- modules/hostap/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hostap/CMakeLists.txt b/modules/hostap/CMakeLists.txt index 8a89329b10c83..69ff4c4fe1d50 100644 --- a/modules/hostap/CMakeLists.txt +++ b/modules/hostap/CMakeLists.txt @@ -206,6 +206,7 @@ zephyr_library_sources_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_AP ${HOSTAP_SRC_BASE}/ap/mbo_ap.c ${HOSTAP_SRC_BASE}/ap/ctrl_iface_ap.c ${HOSTAP_SRC_BASE}/utils/crc32.c + ${HOSTAP_SRC_BASE}/utils/ip_addr.c ) zephyr_library_compile_definitions_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_AP @@ -226,7 +227,6 @@ zephyr_include_directories_ifdef(CONFIG_WIFI_NM_HOSTAPD_AP zephyr_library_sources_ifdef(CONFIG_WIFI_NM_HOSTAPD_AP ${HOSTAP_SRC_BASE}/ap/acs.c - ${HOSTAP_SRC_BASE}/utils/ip_addr.c ${WIFI_NM_HOSTAPD_BASE}/config_file.c ${WIFI_NM_HOSTAPD_BASE}/ctrl_iface.c ${WIFI_NM_HOSTAPD_BASE}/ctrl_iface_zephyr.c From 6827ec0d93d9bc6dd727ee61ca1941314db5f89b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 17 Oct 2024 11:14:15 +0300 Subject: [PATCH 1436/4482] hostap: P2P needs EAPOL to select it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The P2P support needs EAPOL support in order to avoid a compilation error about missing eap field in wpa_ssid struct. modules/lib/hostap/wpa_supplicant/wpa_supplicant.c:5102:65: error: ‘struct wpa_ssid’ has no member named ‘eap’ 5102 | eap_is_wps_pin_enrollee(&wpa_s->current_ssid->eap)) { Signed-off-by: Jukka Rissanen --- modules/hostap/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 5ed4fb8c559fb..1a82af8233dc6 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -247,6 +247,7 @@ config WIFI_NM_WPA_SUPPLICANT_P2P bool "P2P mode support" select WIFI_NM_WPA_SUPPLICANT_AP select WIFI_NM_WPA_SUPPLICANT_WPS + select WIFI_NM_WPA_SUPPLICANT_EAPOL config WIFI_NM_WPA_SUPPLICANT_EAPOL bool "EAPoL supplicant" From 33bc6f05c8f21325fd5eca9d3c3ceda7ecc16949 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 17 Oct 2024 11:19:58 +0300 Subject: [PATCH 1437/4482] hostap: Fix compilation error when enterprise support is enabled The code was missing ")" when checking crypto support. Signed-off-by: Jukka Rissanen --- modules/hostap/src/supp_main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hostap/src/supp_main.h b/modules/hostap/src/supp_main.h index e80ced0343184..b28869c2bd3bb 100644 --- a/modules/hostap/src/supp_main.h +++ b/modules/hostap/src/supp_main.h @@ -15,7 +15,7 @@ !defined(CONFIG_EAP_PSK) && !defined(CONFIG_EAP_PAX) && \ !defined(CONFIG_EAP_SAKE) && !defined(CONFIG_EAP_GPSK) && \ !defined(CONFIG_EAP_PWD) && !defined(CONFIG_EAP_EKE) && \ - !defined(CONFIG_EAP_IKEV2 && !defined(CONFIG_EAP_GTC) + !defined(CONFIG_EAP_IKEV2) && !defined(CONFIG_EAP_GTC) #error "At least one of the following EAP methods need to be defined \ CONFIG_EAP_TLS \ CONFIG_EAP_TTLS \ From e9ec7a23a32c4a6ba4ba487a95f9cd588aaea893 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 17 Oct 2024 16:10:39 +0300 Subject: [PATCH 1438/4482] hostap: Enterprise mode needs sha1-internal.c Without this there is an error modules/lib/hostap/src/crypto/fips_prf_internal.c:47: \ undefined reference to `SHA1Transform' Signed-off-by: Jukka Rissanen --- modules/hostap/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/hostap/CMakeLists.txt b/modules/hostap/CMakeLists.txt index 69ff4c4fe1d50..b6f55f694d6e4 100644 --- a/modules/hostap/CMakeLists.txt +++ b/modules/hostap/CMakeLists.txt @@ -609,6 +609,7 @@ zephyr_library_sources_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE ${HOSTAP_SRC_BASE}/crypto/ms_funcs.c ${HOSTAP_SRC_BASE}/crypto/aes-eax.c ${HOSTAP_SRC_BASE}/crypto/md4-internal.c + ${HOSTAP_SRC_BASE}/crypto/sha1-internal.c ${HOSTAP_SRC_BASE}/crypto/fips_prf_internal.c ${HOSTAP_SRC_BASE}/crypto/milenage.c ) From 980a352d395785225475e92b1c1c0edfc795a75e Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 17 Oct 2024 16:13:27 +0300 Subject: [PATCH 1439/4482] hostap: Fix crypto=none compilation If CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE is enabled, there are lot of missing functions reported during linking. Add missing C files to the compilation to fix this. Signed-off-by: Jukka Rissanen --- modules/hostap/CMakeLists.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/modules/hostap/CMakeLists.txt b/modules/hostap/CMakeLists.txt index b6f55f694d6e4..e1bd8c6c232bc 100644 --- a/modules/hostap/CMakeLists.txt +++ b/modules/hostap/CMakeLists.txt @@ -243,6 +243,27 @@ zephyr_library_compile_definitions_ifdef(CONFIG_WIFI_NM_HOSTAPD_AP zephyr_library_sources_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE ${HOSTAP_SRC_BASE}/crypto/crypto_none.c ${HOSTAP_SRC_BASE}/crypto/tls_none.c + + # FIXME: why do we need these when crypto is not selected? + ${HOSTAP_SRC_BASE}/crypto/aes-wrap.c + ${HOSTAP_SRC_BASE}/crypto/aes-internal.c + ${HOSTAP_SRC_BASE}/crypto/aes-internal-enc.c + ${HOSTAP_SRC_BASE}/crypto/aes-omac1.c + ${HOSTAP_SRC_BASE}/crypto/md5.c + ${HOSTAP_SRC_BASE}/crypto/md5-internal.c + ${HOSTAP_SRC_BASE}/crypto/sha1.c + ${HOSTAP_SRC_BASE}/crypto/sha1-internal.c + ${HOSTAP_SRC_BASE}/crypto/sha1-pbkdf2.c + ${HOSTAP_SRC_BASE}/crypto/sha1-prf.c + ${HOSTAP_SRC_BASE}/crypto/sha256.c + ${HOSTAP_SRC_BASE}/crypto/sha256-internal.c + ${HOSTAP_SRC_BASE}/crypto/sha256-prf.c + ${HOSTAP_SRC_BASE}/crypto/sha384.c + ${HOSTAP_SRC_BASE}/crypto/sha384-internal.c + ${HOSTAP_SRC_BASE}/crypto/sha384-prf.c + ${HOSTAP_SRC_BASE}/crypto/sha512.c + ${HOSTAP_SRC_BASE}/crypto/sha512-internal.c + ${HOSTAP_SRC_BASE}/crypto/rc4.c ) zephyr_library_compile_definitions_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE From 6ac4e9c3b7270c8eefd547a46d5de85edf5e2806 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 18 Oct 2024 09:42:00 +0300 Subject: [PATCH 1440/4482] hostap: Remove not found hostapd functions Both the supplicant_set_btwt() and supplicant_ap_bandwidth() are not found in Zephyr sources so remove them. Signed-off-by: Jukka Rissanen --- modules/hostap/src/supp_main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index b47b322e2aa3a..826e15e9d8d3d 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -94,11 +94,9 @@ DEFINE_WIFI_NM_INSTANCE(wifi_supplicant, &mgmt_ops); #ifdef CONFIG_WIFI_NM_HOSTAPD_AP static const struct wifi_mgmt_ops mgmt_ap_ops = { - .set_btwt = supplicant_set_btwt, .ap_enable = supplicant_ap_enable, .ap_disable = supplicant_ap_disable, .ap_sta_disconnect = supplicant_ap_sta_disconnect, - .ap_bandwidth = supplicant_ap_bandwidth, .iface_status = supplicant_ap_status, #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP .dpp_dispatch = hapd_dpp_dispatch, From c9b8365f6db9dc5a7ed071143b84be280f5fa236 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 18 Oct 2024 09:43:53 +0300 Subject: [PATCH 1441/4482] hostap: Add needed include files to fix compilation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "enum wpa_msg_type" was not found by default so add needed include files to get the definitions. modules/hostap/src/supp_main.h:61:57: warning: ‘enum wpa_msg_type’ declared inside parameter list will not be visible outside of this definition or declaration 61 | void wpa_supplicant_msg_send(void *ctx, int level, enum wpa_msg_type type, const char *txt, Signed-off-by: Jukka Rissanen --- modules/hostap/src/supp_main.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/hostap/src/supp_main.h b/modules/hostap/src/supp_main.h index b28869c2bd3bb..981bdf6695851 100644 --- a/modules/hostap/src/supp_main.h +++ b/modules/hostap/src/supp_main.h @@ -52,12 +52,17 @@ static inline void net_dhcpv4_stop(struct net_if *iface) struct wpa_global *zephyr_get_default_supplicant_context(void); struct wpa_supplicant *zephyr_get_handle_by_ifname(const char *ifname); + #ifdef CONFIG_WIFI_NM_HOSTAPD_AP +#include "common.h" +#include "wpa_debug_zephyr.h" + struct hostapd_iface *zephyr_get_hapd_handle_by_ifname(const char *ifname); void wpa_supplicant_msg_send(void *ctx, int level, enum wpa_msg_type type, const char *txt, size_t len); void hostapd_msg_send(void *ctx, int level, enum wpa_msg_type type, const char *buf, size_t len); #endif + struct wpa_supplicant_event_msg { #ifdef CONFIG_WIFI_NM_HOSTAPD_AP int hostapd; From ec21dab31a741180a8978f2cadf21c999527f68a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 18 Oct 2024 13:42:44 +0300 Subject: [PATCH 1442/4482] hostap: Avoid warning of different enum mapping Even if the enum contains the same values, the values might change if the wpa_supplicant sources change or Zephyr values change. In order to avoid weird errors later and prevent the following warning, add a conversion functions for the enums. modules/hostap/src/supp_api.c:1172:23: warning: implicit conversion from enumeration type 'enum mfp_options' to different enumeration type 'enum wifi_mfp_options' [-Wenum-conversion] status->mfp = ssid->ieee80211w; /* Same mapping */ modules/hostap/src/supp_api.c:1190:30: warning: implicit conversion from enumeration type 'enum wpas_mode' to different enumeration type 'enum wifi_iface_mode' [-Wenum-conversion] status->iface_mode = ssid->mode; Signed-off-by: Jukka Rissanen --- modules/hostap/src/supp_api.c | 47 ++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index fd6449e98a9a0..52772b4becfc6 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -1116,6 +1116,45 @@ int supplicant_disconnect(const struct device *dev) return wpas_disconnect_network(dev, WPAS_MODE_INFRA); } +static enum wifi_mfp_options get_mfp(enum mfp_options supp_mfp_option) +{ + switch (supp_mfp_option) { + case NO_MGMT_FRAME_PROTECTION: + return WIFI_MFP_DISABLE; + case MGMT_FRAME_PROTECTION_OPTIONAL: + return WIFI_MFP_OPTIONAL; + case MGMT_FRAME_PROTECTION_REQUIRED: + return WIFI_MFP_REQUIRED; + default: + wpa_printf(MSG_ERROR, "Invalid mfp mapping %d", supp_mfp_option); + break; + } + + return WIFI_MFP_DISABLE; +} + +static enum wifi_iface_mode get_iface_mode(enum wpas_mode supp_mode) +{ + switch (supp_mode) { + case WPAS_MODE_INFRA: + return WIFI_MODE_INFRA; + case WPAS_MODE_IBSS: + return WIFI_MODE_IBSS; + case WPAS_MODE_AP: + return WIFI_MODE_AP; + case WPAS_MODE_P2P_GO: + return WIFI_MODE_P2P_GO; + case WPAS_MODE_P2P_GROUP_FORMATION: + return WIFI_MODE_P2P_GROUP_FORMATION; + case WPAS_MODE_MESH: + return WIFI_MODE_MESH; + default: + break; + } + + return WIFI_MODE_UNKNOWN; +} + int supplicant_status(const struct device *dev, struct wifi_iface_status *status) { struct net_if *iface = net_if_lookup_by_dev(dev); @@ -1169,7 +1208,7 @@ int supplicant_status(const struct device *dev, struct wifi_iface_status *status os_memcpy(status->bssid, wpa_s->bssid, WIFI_MAC_ADDR_LEN); status->band = wpas_band_to_zephyr(wpas_freq_to_band(wpa_s->assoc_freq)); status->security = wpas_key_mgmt_to_zephyr(key_mgmt, proto); - status->mfp = ssid->ieee80211w; /* Same mapping */ + status->mfp = get_mfp(ssid->ieee80211w); ieee80211_freq_to_chan(wpa_s->assoc_freq, &channel); status->channel = channel; @@ -1187,7 +1226,7 @@ int supplicant_status(const struct device *dev, struct wifi_iface_status *status os_memcpy(status->ssid, _ssid, ssid_len); status->ssid_len = ssid_len; - status->iface_mode = ssid->mode; + status->iface_mode = get_iface_mode(ssid->mode); if (wpa_s->connection_set == 1) { status->link_mode = wpa_s->connection_he ? WIFI_6 : @@ -1894,12 +1933,12 @@ int supplicant_ap_status(const struct device *dev, struct wifi_iface_status *sta ssid = &bss->ssid; os_memcpy(status->bssid, hapd->own_addr, WIFI_MAC_ADDR_LEN); - status->iface_mode = WPAS_MODE_AP; + status->iface_mode = WIFI_MODE_AP; status->band = wpas_band_to_zephyr(wpas_freq_to_band(iface->freq)); key_mgmt = bss->wpa_key_mgmt; proto = bss->wpa; status->security = wpas_key_mgmt_to_zephyr(key_mgmt, proto); - status->mfp = bss->ieee80211w; + status->mfp = get_mfp(bss->ieee80211w); status->channel = conf->channel; os_memcpy(status->ssid, ssid->ssid, ssid->ssid_len); From 3f8828d8279edfb6ea6c5f298b6e3e854579ae24 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 17 Oct 2024 11:23:10 +0300 Subject: [PATCH 1443/4482] tests: net: wifi: Add build test for various config combinations Try to compile test wifi with various configuration combinations. This is trying to catch simple compilation issues in the PRs. Signed-off-by: Jukka Rissanen --- tests/net/wifi/configs/CMakeLists.txt | 8 ++++ tests/net/wifi/configs/prj.conf | 33 ++++++++++++++ tests/net/wifi/configs/src/main.c | 10 ++++ tests/net/wifi/configs/testcase.yaml | 66 +++++++++++++++++++++++++++ 4 files changed, 117 insertions(+) create mode 100644 tests/net/wifi/configs/CMakeLists.txt create mode 100644 tests/net/wifi/configs/prj.conf create mode 100644 tests/net/wifi/configs/src/main.c create mode 100644 tests/net/wifi/configs/testcase.yaml diff --git a/tests/net/wifi/configs/CMakeLists.txt b/tests/net/wifi/configs/CMakeLists.txt new file mode 100644 index 0000000000000..518596a02f780 --- /dev/null +++ b/tests/net/wifi/configs/CMakeLists.txt @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(build_all) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/wifi/configs/prj.conf b/tests/net/wifi/configs/prj.conf new file mode 100644 index 0000000000000..2a2f4d2cf6b85 --- /dev/null +++ b/tests/net/wifi/configs/prj.conf @@ -0,0 +1,33 @@ +CONFIG_TEST=y +CONFIG_TEST_USERSPACE=y +CONFIG_NET_TEST=y + +CONFIG_NETWORKING=y +CONFIG_NET_IPV4=y +CONFIG_NET_IPV6=y +CONFIG_NET_CONFIG_SETTINGS=n + +CONFIG_WIFI=y +CONFIG_WIFI_NM=y + +CONFIG_SHELL=y +CONFIG_NET_SHELL=y +CONFIG_NET_L2_WIFI_SHELL=y +CONFIG_NET_L2_WIFI_MGMT=y + +CONFIG_WIFI_SHELL_MAX_AP_STA=2 +CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS=y +CONFIG_WIFI_MGMT_FORCED_PASSIVE_SCAN=y +CONFIG_WIFI_MGMT_SCAN_SSID_FILT_MAX=3 +CONFIG_WIFI_MGMT_SCAN_CHAN_MAX_MANUAL=10 +CONFIG_WIFI_NM_MAX_MANAGED_INTERFACES=2 +CONFIG_WIFI_MGMT_AP_STA_SKIP_INACTIVITY_POLL=y +CONFIG_WIFI_MGMT_AP_MAX_NUM_STA=10 + +CONFIG_WIFI_NM_WPA_SUPPLICANT=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_DEBUG_LEVEL=0 +CONFIG_WIFI_NM_WPA_SUPPLICANT_WEP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_ADVANCED_FEATURES=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_AP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_CLI=y +CONFIG_WPA_CLI=y diff --git a/tests/net/wifi/configs/src/main.c b/tests/net/wifi/configs/src/main.c new file mode 100644 index 0000000000000..a05ee59143061 --- /dev/null +++ b/tests/net/wifi/configs/src/main.c @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +int main(void) +{ + return 0; +} diff --git a/tests/net/wifi/configs/testcase.yaml b/tests/net/wifi/configs/testcase.yaml new file mode 100644 index 0000000000000..017407bc8467c --- /dev/null +++ b/tests/net/wifi/configs/testcase.yaml @@ -0,0 +1,66 @@ +common: + build_only: true + tags: + - drivers + - wifi + - net + platform_allow: + - native_sim + - native_sim/native/64 +tests: + wifi.build.crypto_default: + extra_configs: + - CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO=y + wifi.build.crypto_alt: + extra_configs: + - CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ALT=y + wifi.build.crypto_none: + extra_configs: + - CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE=y + # FIXME: The psa crypto does not work atm so commented out + # the build test temporarily. + # wifi.build.crypto_psa: + # extra_configs: + # - CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_MBEDTLS_PSA=y + wifi.build.crypto_enterprise: + extra_configs: + - CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ALT=y + - CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE=y + - CONFIG_MBEDTLS_TLS_VERSION_1_2=y + - CONFIG_EAP_TLS=y + - CONFIG_EAP_TTLS=y + - CONFIG_EAP_PEAP=y + - CONFIG_EAP_MD5=y + - CONFIG_EAP_MSCHAPV2=y + - CONFIG_EAP_LEAP=y + - CONFIG_EAP_PSK=y + - CONFIG_EAP_PAX=y + - CONFIG_EAP_SAKE=y + - CONFIG_EAP_GPSK=y + - CONFIG_EAP_PWD=y + - CONFIG_EAP_EKE=y + - CONFIG_EAP_IKEV2=y + - CONFIG_EAP_SIM=y + - CONFIG_EAP_AKA=y + wifi.build.wpa3: + extra_configs: + - CONFIG_WIFI_NM_WPA_SUPPLICANT_WPA3=y + - CONFIG_MBEDTLS_TLS_VERSION_1_2=y + wifi.build.wps: + extra_configs: + - CONFIG_WIFI_NM_WPA_SUPPLICANT_WPS=y + - CONFIG_WIFI_NM_WPA_SUPPLICANT_EAPOL=y + - CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO=y + wifi.build.p2p: + extra_configs: + - CONFIG_WIFI_NM_WPA_SUPPLICANT_P2P=y + - CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO=y + wifi.build.hostapd_ap: + extra_configs: + - CONFIG_WIFI_NM_HOSTAPD_AP=y + - CONFIG_WIFI_NM_WPA_SUPPLICANT_INF_MON=n + wifi.build.dpp: + extra_configs: + - CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ALT=y + - CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE=y + - CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP=y From 3cf8b09a9a830af76eb6c2d15d6611dbc1404c43 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 18 Oct 2024 10:28:37 +0300 Subject: [PATCH 1444/4482] manifest: hostap: Pull compile error fixes This is related to work on #79973 which creates build tests for hostap with different configurations. Signed-off-by: Jukka Rissanen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index c602543c11119..4279b74a60c73 100644 --- a/west.yml +++ b/west.yml @@ -259,7 +259,7 @@ manifest: - hal - name: hostap path: modules/lib/hostap - revision: ac59d28778b20cd68702f55dad2a27d648e3d571 + revision: e481fe559e17052ec8ea04388a934f3d30816737 - name: libmetal revision: a6851ba6dba8c9e87d00c42f171a822f7a29639b path: modules/hal/libmetal From 78f5821b379f3684bb310141c880312acecd7180 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Sun, 20 Oct 2024 00:17:26 +0530 Subject: [PATCH 1445/4482] modules: hostap: Add a config option for WPA control timeout WPA control interface timeout is hardcoded to 10s, add a configuration option to remove the hardcode, this is needed sometimes as a workaround e.g., crypto taking too long to complete the request. Work around for #79834, increase the default from 10 to 15s, in positive case this will have no impact. Signed-off-by: Chaitanya Tata --- modules/hostap/Kconfig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 1a82af8233dc6..e22059f00f067 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -543,4 +543,11 @@ config WIFI_NM_WPA_SUPPLICANT_CRYPTO_TEST bool depends on WIFI_NM_WPA_SUPPLICANT_CRYPTO_MBEDTLS_PSA +config WIFI_NM_WPA_CTRL_RESP_TIMEOUT_S + int "WPA supplicant control interface response timeout in seconds" + default 15 + help + Timeout for the control interface commands to get a response from the + supplicant. + endif # WIFI_NM_WPA_SUPPLICANT From 7574602108879a1d86c8361272ccff02456c8cda Mon Sep 17 00:00:00 2001 From: Dominik Kilian Date: Wed, 16 Oct 2024 14:11:55 +0200 Subject: [PATCH 1446/4482] doc: ipc: Add detailed protocol specs for ICMsg backend The details of how the ICMsg communication is done, are hidden inside the source code. This specification adds details about the ICBMsg protocol. Signed-off-by: Dominik Kilian --- .../backends/ipc_service_icmsg.rst | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/doc/services/ipc/ipc_service/backends/ipc_service_icmsg.rst b/doc/services/ipc/ipc_service/backends/ipc_service_icmsg.rst index 1b1298df49b1d..56f618b442df9 100644 --- a/doc/services/ipc/ipc_service/backends/ipc_service_icmsg.rst +++ b/doc/services/ipc/ipc_service/backends/ipc_service_icmsg.rst @@ -84,3 +84,111 @@ Samples ======= - :zephyr:code-sample:`ipc-icmsg` + +Detailed Protocol Specification +=============================== + +The ICMsg uses two shared memory regions and two MBOX channels. +The region and channel pair are used to transfer messages in one direction. +The other pair is symmetric and transfers messages in the opposite direction. +For this reason, the specification below focuses on one such pair. +The other pair is identical. + +The ICMsg provides just one endpoint per instance. + +Shared Memory Region Organization +--------------------------------- + +If data caching is enabled, the shared memory region provided to ICMsg must be aligned according to the cache requirement. +If cache is not enabled, the required alignment is 4 bytes. + +The shared memory region is entirely used by a single FIFO. +It contains read and write indexes followed by the data buffer. +The detailed structure is contained in the following table: + +.. list-table:: + :header-rows: 1 + + * - Field name + - Size (bytes) + - Byte order + - Description + * - ``rd_idx`` + - 4 + - little‑endian + - Index of the first incoming byte in the ``data`` field. + * - ``padding`` + - depends on cache alignment + - n/a + - Padding added to align ``wr_idx`` to the cache alignment. + * - ``wr_idx`` + - 4 + - little‑endian + - Index of the byte after the last incoming byte in the ``data`` field. + * - ``data`` + - everything to the end of the region + - n/a + - Circular buffer containing actual bytes to transfer. + +This is usual FIFO with a circular buffer: + +* The Indexes (``rd_idx`` and ``wr_idx``) are wrapped around when they reach the end of the ``data`` buffer. +* The FIFO is empty if ``rd_idx == wr_idx``. +* The FIFO has one byte less capacity than the ``data`` buffer length. + +Packets +------- + +Packets are sent over the FIFO described in the above section. +One packet can be wrapped around if it occurs at the end of the FIFO buffer. + +The following is the packet structure: + +.. list-table:: + :header-rows: 1 + + * - Field name + - Size (bytes) + - Byte order + - Description + * - ``len`` + - 2 + - big‑endian + - Length of the ``data`` field. + * - ``reserved`` + - 2 + - n/a + - Reserved for the future use. + It must be 0 for the current protocol version. + * - ``data`` + - ``len`` + - n/a + - Packet data. + * - ``padding`` + - 0‑3 + - n/a + - Padding is added to align the total packet size to 4 bytes. + +The packet send procedure is the following: + +#. Check if the packet fits into the buffer. +#. Write the packet to ``data`` FIFO buffer starting at ``wr_idx``. + Wrap it if needed. +#. Write a new value of the ``wr_idx``. +#. Notify the receiver over the MBOX channel. + +Initialization +-------------- + +The initialization sequence is the following: + +#. Set the ``wr_idx`` and ``rd_idx`` to zero. +#. Push a single packet to FIFO containing magic data: ``45 6d 31 6c 31 4b 30 72 6e 33 6c 69 34``. + The MBOX is not used yet. +#. Initialize the MBOX. +#. Repeat the notification over the MBOX channel using some interval, for example, 1 ms. +#. Wait for an incoming packet containing the magic data. + It will arrive over the other pair (shared memory region and MBOX). +#. Stop repeating the MBOX notification. + +After this, the ICMsg is bound, and it is ready to transfer packets. From 8d99393530adf8d478027996fd055bfb306ff3c9 Mon Sep 17 00:00:00 2001 From: Dominik Kilian Date: Wed, 16 Oct 2024 14:07:45 +0200 Subject: [PATCH 1447/4482] doc: ipc: Add detailed protocol specs for ICBMsg backend The details of how the ICBMsg communication is done, are hidden inside the source code. This specification adds details about the ICBMsg protocol. Signed-off-by: Dominik Kilian --- .../ipc/ipc_service/backends/icbmsg_flows.svg | 520 ++++++++++++++++++ .../ipc_service/backends/icbmsg_memory.svg | 266 +++++++++ .../ipc_service/backends/icbmsg_message.svg | 209 +++++++ .../backends/ipc_service_icbmsg.rst | 297 ++++++++++ 4 files changed, 1292 insertions(+) create mode 100644 doc/services/ipc/ipc_service/backends/icbmsg_flows.svg create mode 100644 doc/services/ipc/ipc_service/backends/icbmsg_memory.svg create mode 100644 doc/services/ipc/ipc_service/backends/icbmsg_message.svg diff --git a/doc/services/ipc/ipc_service/backends/icbmsg_flows.svg b/doc/services/ipc/ipc_service/backends/icbmsg_flows.svg new file mode 100644 index 0000000000000..f0ecb633a22aa --- /dev/null +++ b/doc/services/ipc/ipc_service/backends/icbmsg_flows.svg @@ -0,0 +1,520 @@ + + + + + + + +
+
+
+ ICBMsg +
+ implementation +
+
+
+
+ + ICBMsg... + +
+
+ + + + +
+
+
+ ICBMsg +
+ implementation +
+
+
+
+ + ICBMsg... + +
+
+ + + + + +
+
+
+ ICBMsg +
+ user +
+
+
+
+ + ICBMs... + +
+
+ + + + + +
+
+
+ ICBMsg +
+ user +
+
+
+
+ + ICBMs... + +
+
+ + + + + +
+
+
+ Initiator +
+
+
+
+ + Initiator + +
+
+ + + + +
+
+
+ Follower +
+
+
+
+ + Follower + +
+
+ + + + + + + + + + +
+
+
+ register endpoint +
+ "example1" +
+
+
+
+ + register... + +
+
+ + + + + +
+
+
+ MSG_BOUND, +
+ name "example1", address 0x01 +
+
+
+
+ + MSG_BOUND... + +
+
+ + + + + + +
+
+
+ register endpoint +
+ "example1" +
+
+
+
+ + register... + +
+
+ + + + + +
+
+
+ MSG_RELEASE_BOUND, +
+ address 0x01 +
+
+
+
+ + MSG_RELEA... + +
+
+ + + + + + +
+
+
+ bound callback +
+
+
+
+ + bound cal... + +
+
+ + + + + +
+
+
+ bound callback +
+
+
+
+ + bound cal... + +
+
+ + + + + + +
+
+
+ register endpoint +
+ "example2" +
+
+
+
+ + register... + +
+
+ + + + + +
+
+
+ MSG_BOUND, +
+ name "example2", address 0x02 +
+
+
+
+ + MSG_BOUND... + +
+
+ + + + + + +
+
+
+ register endpoint +
+ "example2" +
+
+
+
+ + register... + +
+
+ + + + + +
+
+
+ MSG_RELEASE_BOUND, +
+ address 0x02 +
+
+
+
+ + MSG_RELEA... + +
+
+ + + + + + +
+
+
+ bound callback +
+
+
+
+ + bound cal... + +
+
+ + + + + +
+
+
+ bound callback +
+
+
+
+ + bound cal... + +
+
+ + + + +
+
+
+ The initiator starts first +
+
+
+
+ + The initiator starts first + +
+
+ + + + +
+
+
+ The follower starts first +
+
+
+
+ + The follower starts first + +
+
+ + + + + + + + +
+
+
+ send data on +
+ endpoint "example2" +
+
+
+
+ + send data... + +
+
+ + + + + +
+
+
+ MSG_DATA, +
+ address 0x02 +
+
+
+
+ + MSG_DATA,... + +
+
+ + + + + + +
+
+
+ return from callback +
+ or data release +
+
+
+
+ + return fr... + +
+
+ + + + + +
+
+
+ MSG_RELEASE_DATA +
+
+
+
+ + MSG_RELEA... + +
+
+ + + + + +
+
+
+ data callback +
+
+
+
+ + data call... + +
+
+ + + + +
+
+
+ Data message +
+
+
+
+ + Data message + +
+
+ +
+ + + + + Text is not SVG - cannot display + + + +
\ No newline at end of file diff --git a/doc/services/ipc/ipc_service/backends/icbmsg_memory.svg b/doc/services/ipc/ipc_service/backends/icbmsg_memory.svg new file mode 100644 index 0000000000000..09fcfe2a6f94c --- /dev/null +++ b/doc/services/ipc/ipc_service/backends/icbmsg_memory.svg @@ -0,0 +1,266 @@ + + + + + + + +
+
+
+ ICMsg area +
+
+
+
+ + ICMsg area + +
+
+ + + + +
+
+
+ Blocks area +
+
+
+
+ + Blocks area + +
+
+ + + + +
+
+
+ Block 0 +
+
+
+
+ + Block 0 + +
+
+ + + + +
+
+
+ Block 1 +
+
+
+
+ + Block 1 + +
+
+ + + + +
+
+
+ Block 2 +
+
+
+
+ + Block 2 + +
+
+ + + + +
+
+
+ Block N-1 +
+
+
+
+ + Block N-1 + +
+
+ + + + + + +
+
+
+ Block 3 +
+
+
+
+ + Block 3 + +
+
+ + + + +
+
+
+ rx-region +
+
+
+
+ + rx-region + +
+
+ + + + +
+
+
+ tx-region +
+
+
+
+ + tx-region + +
+
+ + + + + + +
+
+
+ region_begin_aligned +
+
+
+
+ + region_begin_aligned + +
+
+ + + + +
+
+
+ blocks_area_address +
+
+
+
+ + blocks_area_address + +
+
+ + + + +
+
+
+ block_size +
+
+
+
+ + block_size + +
+
+ + + + +
+
+
+ region_end_aligned +
+
+
+
+ + region_end_aligned + +
+
+ + + + + + + + + + + + + +
+
+
+ The same organization as rx-region, but sizes and block count may be different. +
+
+
+
+ + The same organization as rx-region, but... + +
+
+ + +
+ + + + + Text is not SVG - cannot display + + + +
\ No newline at end of file diff --git a/doc/services/ipc/ipc_service/backends/icbmsg_message.svg b/doc/services/ipc/ipc_service/backends/icbmsg_message.svg new file mode 100644 index 0000000000000..0252501480b3f --- /dev/null +++ b/doc/services/ipc/ipc_service/backends/icbmsg_message.svg @@ -0,0 +1,209 @@ + + + + + + + +
+
+
+ Block 0 +
+
+
+
+ + Block 0 + +
+
+ + + + +
+
+
+ Block 1 +
+
+
+
+ + Block 1 + +
+
+ + + + +
+
+
+ Block 2 +
+
+
+
+ + Block 2 + +
+
+ + + + +
+
+
+ Block N-1 +
+
+
+
+ + Block N-1 + +
+
+ + + + +
+
+
+ header +
+ (size of data) +
+
+
+
+ + header... + +
+
+ + + + +
+
+
+ data +
+
+
+
+ + data + +
+
+ + + + +
+
+
+ unused +
+
+
+
+ + unused + +
+
+ + + + +
+
+
+ Block 3 +
+
+
+
+ + Block 3 + +
+
+ + + + + + +
+
+
+ Blocks area +
+
+
+
+ + Blocks area + +
+
+ + + + +
+
+
+ Example of a message allocated +
+ on block 1 and 2 +
+
+
+
+ + Example of a message allocated... + +
+
+ + + + + +
+
+
+ 4 bytes +
+
+
+
+ + 4 bytes + +
+
+ + +
+ + + + + Text is not SVG - cannot display + + + +
\ No newline at end of file diff --git a/doc/services/ipc/ipc_service/backends/ipc_service_icbmsg.rst b/doc/services/ipc/ipc_service/backends/ipc_service_icbmsg.rst index f06f7587df60c..f570766b0bd75 100644 --- a/doc/services/ipc/ipc_service/backends/ipc_service_icbmsg.rst +++ b/doc/services/ipc/ipc_service/backends/ipc_service_icbmsg.rst @@ -81,3 +81,300 @@ Samples ======= * :zephyr:code-sample:`ipc_multi_endpoint` + +Detailed Protocol Specification +=============================== + +The ICBMsg protocol transfers messages using dynamically allocated blocks of shared memory. +Internally, it uses ICMsg for control messages. + +Shared Memory Organization +-------------------------- + +The ICBMsg uses two shared memory regions, ``rx-region`` for message receiving, and ``tx-region`` for message transmission. +The regions do not need to be next to each other, placed in any specific order, or be of the same size. +Those regions are interchanged on each core. + +Each shared memory region is divided into following two parts: + +* **ICMsg area** - An area reserved by ICMsg instance and used to transfer the control messages. +* **Blocks area** - An area containing allocatable blocks carrying the content of the messages. + This area is divided into even-sized blocks aligned to cache boundaries. + +The location of each area is calculated to fulfill cache boundary requirements and allow optimal region usage. +It is calculated using the following algorithm: + +Inputs: + +* ``region_begin``, ``region_end`` - Boundaries of the region. +* ``local_blocks`` - Number of blocks in this region. +* ``remote_blocks`` - Number of blocks in the opposite region. +* ``alignment`` - Memory cache alignment. + +The algorithm: + +#. Align region boundaries to cache: + + * ``region_begin_aligned = ROUND_UP(region_begin, alignment)`` + * ``region_end_aligned = ROUND_DOWN(region_end, alignment)`` + * ``region_size_aligned = region_end_aligned - region_begin_aligned`` + +#. Calculate the minimum size required for ICMsg area ``icmsg_min_size``, which is a sum of: + + * ICMsg header size (refer to the ICMsg specification) + * ICMsg message size for 4 bytes of content (refer to the ICMsg specification) multiplied by ``local_blocks + remote_blocks + 2`` + +#. Calculate available size for block area. Note that the actual size may be smaller because of block alignment: + + ``blocks_area_available_size = region_size_aligned - icmsg_min_size`` + +#. Calculate single block size: + + ``block_size = ROUND_DOWN(blocks_area_available_size / local_blocks, alignment)`` + +#. Calculate actual block area size: + + ``blocks_area_size = block_size * local_blocks`` + +#. Calculate block area start address: + + ``blocks_area_begin = region_end_aligned - blocks_area_size`` + +The result: + +* ``region_begin_aligned`` - The start of ICMsg area. +* ``blocks_area_begin`` - End of ICMsg area and the start of block area. +* ``block_size`` - Single block size. +* ``region_end_aligned`` - End of blocks area. + +.. image:: icbmsg_memory.svg + :align: center + +| + +Message Transfer +---------------- + +The ICBMsg uses following two types of messages: + +* **Binding message** - Message exchanged during endpoint binding process (described below). +* **Data message** - Message carrying actual data from a user. + +They serve different purposes, but their lifetime and flow are the same. +The following steps describe it: + +#. The sender wants to send a message that contains ``K`` bytes. +#. The sender reserves blocks from his ``tx-region`` blocks area that can hold at least ``K + 4`` bytes. + The additional ``+ 4`` bytes are reserved for the header, which contains the exact size of the message. + The blocks must be continuous (one after another). + The sender is responsible for block allocation management. + It is up to the implementation to decide what to do if no blocks are available. +#. The sender fills the header with a 32-bit integer value, ``K`` (little-endian). +#. The sender fills the remaining part of the blocks with his data. + Unused space is ignored. +#. The sender sends an ``MSG_DATA`` or ``MSG_BOUND`` control message over ICMsg that contains starting block number (where the header is located). + Details about the control message are in the next section. +#. The control message travels to the receiver. +#. The receiver reads message size and data from his ``rx-region`` starting from the block number received in the control message. +#. The receiver processes the message. +#. The receiver sends ``MSG_RELEASE_DATA`` or ``MSG_RELEASE_BOUND`` control message over ICMsg containing the starting block number + (the same as inside received control message). +#. The control message travels back to the sender. +#. The sender releases the blocks starting from the block number provided in the control message. + The number of blocks to release can be calculated using a size from the header. + +.. image:: icbmsg_message.svg + :align: center + +| + +Control Messages +---------------- + +The control messages are transmitted over ICMsg. +Each control message contains three bytes. +The first byte tells what kind of message it is. + +The allocated size for ICMsg ensures that the maximum possible number of control messages will fit into its ring buffer, +so sending over the ICMsg will never fail because of buffer overflow. + +MSG_DATA +^^^^^^^^ + +.. list-table:: + :header-rows: 1 + + * - byte 0 + - byte 1 + - byte 2 + * - MSG_DATA + - endpoint address + - block number + * - 0x00 + - 0x00 ÷ 0xFD + - 0x00 ÷ N-1 + +The ``MSG_DATA`` control message indicates that a new data message was sent. +The data message starts with a header inside ``block number``. +The data message was sent over the endpoint specified in ``endpoint address``. +The endpoint binding procedure must be finished before sending this control message. + +MSG_RELEASE_DATA +^^^^^^^^^^^^^^^^ + +.. list-table:: + :header-rows: 1 + + * - byte 0 + - byte 1 + - byte 2 + * - MSG_RELEASE_DATA + - unused + - block number + * - 0x01 + - + - 0x00 ÷ N-1 + +The ``MSG_RELEASE_DATA`` control message is sent in response to ``MSG_DATA``. +It informs us that the data message starting with ``block number`` was received and is no longer needed. +When this control message is received, the blocks containing the message must be released. + +MSG_BOUND +^^^^^^^^^ + +.. list-table:: + :header-rows: 1 + + * - byte 0 + - byte 1 + - byte 2 + * - MSG_BOUND + - endpoint address + - block number + * - 0x02 + - 0x00 ÷ 0xFD + - 0x00 ÷ N-1 + +The ``MSG_BOUND`` control message is similar to the ``MSG_DATA`` except the blocks carry binding information. +See the next section for details on the binding procedure. + +MSG_RELEASE_BOUND +^^^^^^^^^^^^^^^^^ + +.. list-table:: + :header-rows: 1 + + * - byte 0 + - byte 1 + - byte 2 + * - MSG_RELEASE_BOUND + - endpoint address + - block number + * - 0x03 + - 0x00 ÷ 0xFD + - 0x00 ÷ N-1 + +The ``MSG_RELEASE_BOUND`` control message is sent in response to ``MSG_BOUND``. +It is similar to the ``MSG_RELEASE_DATA`` except the ``endpoint address`` is required. +See the next section for details on the binding procedure. + +Initialization +-------------- + +The ICBMsg initialization calls ICMsg to initialize. +When it is done, no further initialization is required. +Blocks can be left uninitialized. + +After ICBMsg initialization, you are ready for the endpoint binding procedure. + +Endpoint Binding +----------------- + +So far, the protocol is symmetrical. +Each side of the connection was the same. +The binding process is not symmetrical. +There are following two roles: + +* **Initiator** - It assigns endpoint addresses and sends binding messages. +* **Follower** - It waits for a binding message. + +The roles are determined based on the addresses of the ``rx-region`` and ``tx-region``. + +* If ``address of rx-region < address of tx-region``, then it is initiator. +* If ``address of rx-region > address of tx-region``, then it is follower. + +The binding process needs an endpoint name and is responsible for following two things: + +* To establish a common endpoint address, +* To make sure that two sides are ready to exchange messages over that endpoint. + +After ICMsg is initialized, both sides can start the endpoint binding. +There are no restrictions on the order in which the sides start the endpoint binding. + +Initiator Binding Procedure +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The initiator sends a binding message. +It contains a single null-terminated string with an endpoint name. +As usual, it is preceded by a message header containing the message size (including null-terminator). + +Example of the binding message for ``example`` endpoint name: + +.. list-table:: + :header-rows: 1 + + * - Header + - Endpoint name + - Null-terminator + * - bytes 0-3 + - bytes 4-10 + - byte 11 + * - 0x00000008 + - ``example`` + - 0x00 + +The binding message is sent using the ``MSG_BOUND`` control message and released with the ``MSG_RELEASE_BOUND`` control message. + +The endpoint binding procedure from the initiator's point of view is the following: + +#. The initiator assigns an endpoint address to this endpoint. +#. The initiator sends a binding message containing the endpoint name and address. +#. The initiator waits for any message from the follower using this endpoint address. + Usually, it will be ``MSG_RELEASE_BOUND``, but ``MSG_DATA`` is also allowed. +#. The initiator is bound to an endpoint, and it can send data messages using this endpoint. + +Follower Binding Procedure +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If the follower receives a binding message before it starts the binding procedure on that endpoint, it should store the message for later. +It should not send the ``MSG_RELEASE_BOUND`` yet. + +The endpoint binding procedure from the follower's point of view is the following: + +#. The follower waits for a binding message containing its endpoint name. + The message may be a newly received message or a message stored before the binding procedure started. +#. The follower stores the endpoint address assigned to this endpoint by the initiator. +#. The follower sends the ``MSG_RELEASE_BOUND`` control message. +#. The follower is bound to an endpoint, and it can send data messages using this endpoint. + +Example sequence diagrams +------------------------- + +The following diagram shows a few examples of how the messages flow between two ends. +There is a binding of two endpoints and one fully processed data message exchange. + +.. image:: icbmsg_flows.svg + :align: center + +| + +Protocol Versioning +------------------- + +The protocol allows improvements in future versions. +The newer implementations should be able to work with older ones in backward compatible mode. +To allow it, the current protocol version has the following restrictions: + +* If the receiver receives a longer control message, it should use only the first three bytes and ignore the remaining. +* If the receiver receives a control message starting with a byte that does not match any of the messages described here, it should ignore it. +* If the receiver receives a binding message with additional bytes at the end, it should ignore the additional bytes. From da81490034d8ae1ebe826878852a3b889694f00e Mon Sep 17 00:00:00 2001 From: Bartlomiej Buczek Date: Tue, 23 Jul 2024 07:48:19 +0200 Subject: [PATCH 1448/4482] tests: drivers: adc: add adc_error_cases tests. Tests are checking error codes returned from adc_read() and adc_channel_setup() used with invalid configurations. Signed-off-by: Bartlomiej Buczek --- .../adc/adc_error_cases/CMakeLists.txt | 9 + .../boards/nrf52840dk_nrf52840.overlay | 11 + .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 11 + .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 11 + tests/drivers/adc/adc_error_cases/prj.conf | 3 + .../adc/adc_error_cases/src/adc_error_cases.c | 220 ++++++++++++++++++ .../drivers/adc/adc_error_cases/testcase.yaml | 7 + 7 files changed, 272 insertions(+) create mode 100644 tests/drivers/adc/adc_error_cases/CMakeLists.txt create mode 100644 tests/drivers/adc/adc_error_cases/boards/nrf52840dk_nrf52840.overlay create mode 100644 tests/drivers/adc/adc_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 tests/drivers/adc/adc_error_cases/boards/nrf54l15dk_nrf54l15_cpuapp.overlay create mode 100644 tests/drivers/adc/adc_error_cases/prj.conf create mode 100644 tests/drivers/adc/adc_error_cases/src/adc_error_cases.c create mode 100644 tests/drivers/adc/adc_error_cases/testcase.yaml diff --git a/tests/drivers/adc/adc_error_cases/CMakeLists.txt b/tests/drivers/adc/adc_error_cases/CMakeLists.txt new file mode 100644 index 0000000000000..7b240573c8470 --- /dev/null +++ b/tests/drivers/adc/adc_error_cases/CMakeLists.txt @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(adc_error_cases) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/adc/adc_error_cases/boards/nrf52840dk_nrf52840.overlay b/tests/drivers/adc/adc_error_cases/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 0000000000000..18e74f72ee261 --- /dev/null +++ b/tests/drivers/adc/adc_error_cases/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,11 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 Nordic Semiconductor ASA + */ + +/ { + aliases { + adc = &adc; + }; +}; diff --git a/tests/drivers/adc/adc_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/adc/adc_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 0000000000000..18e74f72ee261 --- /dev/null +++ b/tests/drivers/adc/adc_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,11 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 Nordic Semiconductor ASA + */ + +/ { + aliases { + adc = &adc; + }; +}; diff --git a/tests/drivers/adc/adc_error_cases/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/adc/adc_error_cases/boards/nrf54l15dk_nrf54l15_cpuapp.overlay new file mode 100644 index 0000000000000..18e74f72ee261 --- /dev/null +++ b/tests/drivers/adc/adc_error_cases/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -0,0 +1,11 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 Nordic Semiconductor ASA + */ + +/ { + aliases { + adc = &adc; + }; +}; diff --git a/tests/drivers/adc/adc_error_cases/prj.conf b/tests/drivers/adc/adc_error_cases/prj.conf new file mode 100644 index 0000000000000..40f19db980dc5 --- /dev/null +++ b/tests/drivers/adc/adc_error_cases/prj.conf @@ -0,0 +1,3 @@ +CONFIG_ZTEST=y + +CONFIG_ADC=y diff --git a/tests/drivers/adc/adc_error_cases/src/adc_error_cases.c b/tests/drivers/adc/adc_error_cases/src/adc_error_cases.c new file mode 100644 index 0000000000000..0cfdf890d7b74 --- /dev/null +++ b/tests/drivers/adc/adc_error_cases/src/adc_error_cases.c @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2024, Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +static const struct device *dev_adc = DEVICE_DT_GET(DT_ALIAS(adc)); +#define BUFFER_LEN 8 +static uint16_t m_sample_buffer[BUFFER_LEN]; + +static const struct adc_channel_cfg valid_channel_cfg = { + .gain = ADC_GAIN_1, + .channel_id = 0, + .reference = ADC_REF_INTERNAL, + .acquisition_time = ADC_ACQ_TIME_DEFAULT, + .differential = false, + #ifdef CONFIG_ADC_CONFIGURABLE_INPUTS + .input_positive = 1, + #endif +}; + +static const struct adc_sequence valid_seq = { + .buffer = m_sample_buffer, + .buffer_size = BUFFER_LEN * sizeof(m_sample_buffer), + .options = NULL, + .resolution = 10, + .oversampling = 0, + .channels = 1, +}; + +/** + * @brief test adc_read() with invalid oversampling value + * + * function should return -EINVAL + */ + +ZTEST(adc_error_cases, test_adc_read_invalid_oversampling) +{ + int ret; + + adc_channel_setup(dev_adc, &valid_channel_cfg); + + struct adc_sequence invalid_seq = valid_seq; + /* Set oversampling to invalid value */ + invalid_seq.oversampling = 99; + + ret = adc_read(dev_adc, &invalid_seq); + + zassert_true( + ret == -EINVAL, + "adc_read() should return -EINVAL," + " got unexpected value of %d", + ret + ); +} + +/** + * @brief test adc_read() with invalid resolution value + * + * function should return -EINVAL + */ + +ZTEST(adc_error_cases, test_adc_read_invalid_resolution) +{ + int ret; + + adc_channel_setup(dev_adc, &valid_channel_cfg); + + struct adc_sequence invalid_seq = valid_seq; + /* Set resolution to invalid value */ + invalid_seq.resolution = 99; + + ret = adc_read(dev_adc, &invalid_seq); + + zassert_true( + ret == -EINVAL, + "adc_read() should return -EINVAL," + " got unexpected value of %d", + ret + ); +} + +/** + * @brief test adc_read() with invalid channels value + * + * function should return -EINVAL + */ + +ZTEST(adc_error_cases, test_adc_read_invalid_channels) +{ + int ret; + + adc_channel_setup(dev_adc, &valid_channel_cfg); + + struct adc_sequence invalid_seq = valid_seq; + /* Set channels configuration to invalid value */ + invalid_seq.channels = 0; + + ret = adc_read(dev_adc, &invalid_seq); + + zassert_true( + ret == -EINVAL, + "adc_read() should return -EINVAL," + " got unexpected value of %d", + ret + ); +} + +/** + * @brief test adc_read() with not configured channel + * + * function should return -EINVAL + */ + +ZTEST(adc_error_cases, test_adc_read_not_configured_channel) +{ + int ret; + + adc_channel_setup(dev_adc, &valid_channel_cfg); + + struct adc_sequence invalid_seq = valid_seq; + /* Set channels configuration to use not configured channel */ + invalid_seq.channels = BIT(1); + + ret = adc_read(dev_adc, &invalid_seq); + + zassert_true( + ret == -EINVAL, + "adc_read() should return -EINVAL," + " got unexpected value of %d", + ret + ); +} + +/** + * @brief test adc_read() with invalid buffer length + * + * function should return -ENOMEM + */ + +ZTEST(adc_error_cases, test_adc_read_invalid_buffer) +{ + int ret; + + adc_channel_setup(dev_adc, &valid_channel_cfg); + + struct adc_sequence invalid_seq = valid_seq; + /* set buffer size to 0 bytes */ + invalid_seq.buffer_size = 0; + + ret = adc_read(dev_adc, &invalid_seq); + + zassert_true( + ret == -ENOMEM, + "adc_read() should return -ENOMEM," + " got unexpected value of %d", + ret + ); +} + +/** + * @brief test adc_channel_setup() with invalid reference value + * + * function should return -EINVAL + */ + +ZTEST(adc_error_cases, test_adc_setup_invalid_reference) +{ + int ret; + + struct adc_channel_cfg invalid_channel_cfg = valid_channel_cfg; + /* set invalid reference */ + invalid_channel_cfg.reference = 99; + + ret = adc_channel_setup(dev_adc, &invalid_channel_cfg); + + zassert_true( + ret == -EINVAL, + "adc_channel_setup() should return -EINVAL," + " got unexpected value of %d", + ret + ); +} + +/** + * @brief test adc_read() with invalid gain value + * + * function should return -EINVAL + */ + +ZTEST(adc_error_cases, test_adc_setup_invalid_gain) +{ + int ret; + + struct adc_channel_cfg invalid_channel_cfg = valid_channel_cfg; + /* set invalid gain value */ + invalid_channel_cfg.gain = 99; + ret = adc_channel_setup(dev_adc, &invalid_channel_cfg); + zassert_true( + ret == -EINVAL, + "adc_channel_setup() should return -EINVAL," + " got unexpected value of %d", + ret + ); +} + +static void *suite_setup(void) +{ + TC_PRINT("Test executed on %s\n", CONFIG_BOARD_TARGET); + TC_PRINT("===================================================================\n"); + + return NULL; +} + +ZTEST_SUITE(adc_error_cases, NULL, suite_setup, NULL, NULL, NULL); diff --git a/tests/drivers/adc/adc_error_cases/testcase.yaml b/tests/drivers/adc/adc_error_cases/testcase.yaml new file mode 100644 index 0000000000000..039be590b38c2 --- /dev/null +++ b/tests/drivers/adc/adc_error_cases/testcase.yaml @@ -0,0 +1,7 @@ +tests: + drivers.adc_error_cases: + depends_on: adc + platform_allow: + - nrf52840dk/nrf52840 + - nrf54l15dk/nrf54l15/cpuapp + - nrf54h20dk/nrf54h20/cpuapp From dc9a9dcf40dc0f42d2532653aa4b7ac6f01eaecb Mon Sep 17 00:00:00 2001 From: Bartlomiej Buczek Date: Fri, 19 Jul 2024 10:01:52 +0200 Subject: [PATCH 1449/4482] tests: adc_accuracy: Add overlay for nrf52840dk. Add overlay and enable test for nrf52840dk. Signed-off-by: Bartlomiej Buczek --- .../boards/nrf52840dk_nrf52840.overlay | 28 +++++++++++++++++++ .../adc/adc_accuracy_test/testcase.yaml | 1 + 2 files changed, 29 insertions(+) create mode 100644 tests/drivers/adc/adc_accuracy_test/boards/nrf52840dk_nrf52840.overlay diff --git a/tests/drivers/adc/adc_accuracy_test/boards/nrf52840dk_nrf52840.overlay b/tests/drivers/adc/adc_accuracy_test/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 0000000000000..85a8c6880c93c --- /dev/null +++ b/tests/drivers/adc/adc_accuracy_test/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,28 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 Nordic Semiconductor ASA + */ + + +/ { + zephyr,user { + io-channels = <&adc 0>; + reference_mv = <3000>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1_6"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; /* P0.03 */ + zephyr,resolution = <14>; + }; + +}; diff --git a/tests/drivers/adc/adc_accuracy_test/testcase.yaml b/tests/drivers/adc/adc_accuracy_test/testcase.yaml index 8f6978a49fcd4..210ef2b70f0a5 100644 --- a/tests/drivers/adc/adc_accuracy_test/testcase.yaml +++ b/tests/drivers/adc/adc_accuracy_test/testcase.yaml @@ -20,3 +20,4 @@ tests: - frdm_kl25z - ek_ra8m1 - frdm_mcxc242 + - nrf52840dk/nrf52840 From d4c8b358fa747d56cd685381d8f757c4a0adb788 Mon Sep 17 00:00:00 2001 From: Bartlomiej Buczek Date: Fri, 19 Jul 2024 11:42:10 +0200 Subject: [PATCH 1450/4482] tests: adc_accuracy: Add overlay for nrf54h20dk. Add overlay and enable test for nrf54h20dk. Signed-off-by: Bartlomiej Buczek --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 26 +++++++++++++++++++ .../adc/adc_accuracy_test/testcase.yaml | 1 + 2 files changed, 27 insertions(+) create mode 100644 tests/drivers/adc/adc_accuracy_test/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/tests/drivers/adc/adc_accuracy_test/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/adc/adc_accuracy_test/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 0000000000000..20bd3110affee --- /dev/null +++ b/tests/drivers/adc/adc_accuracy_test/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,26 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 Nordic Semiconductor ASA + */ + +/ { + zephyr,user { + io-channels = <&adc 0>; + reference_mv = <1800>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1_2"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; + zephyr,resolution = <14>; + }; +}; diff --git a/tests/drivers/adc/adc_accuracy_test/testcase.yaml b/tests/drivers/adc/adc_accuracy_test/testcase.yaml index 210ef2b70f0a5..ccfaa02ed7dec 100644 --- a/tests/drivers/adc/adc_accuracy_test/testcase.yaml +++ b/tests/drivers/adc/adc_accuracy_test/testcase.yaml @@ -21,3 +21,4 @@ tests: - ek_ra8m1 - frdm_mcxc242 - nrf52840dk/nrf52840 + - nrf54h20dk/nrf54h20/cpuapp From 108f6cdf3a7a043f8511b67a614b73629b8e31ec Mon Sep 17 00:00:00 2001 From: Bartlomiej Buczek Date: Fri, 19 Jul 2024 12:03:56 +0200 Subject: [PATCH 1451/4482] tests: adc_accuracy: add overlay for nrf54l15dk. Add overlay and enable test for nrf54l15dk. Signed-off-by: Bartlomiej Buczek --- .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 26 +++++++++++++++++++ .../adc/adc_accuracy_test/testcase.yaml | 1 + 2 files changed, 27 insertions(+) create mode 100644 tests/drivers/adc/adc_accuracy_test/boards/nrf54l15dk_nrf54l15_cpuapp.overlay diff --git a/tests/drivers/adc/adc_accuracy_test/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/adc/adc_accuracy_test/boards/nrf54l15dk_nrf54l15_cpuapp.overlay new file mode 100644 index 0000000000000..950c52047f6a0 --- /dev/null +++ b/tests/drivers/adc/adc_accuracy_test/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -0,0 +1,26 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 Nordic Semiconductor ASA + */ + +/ { + zephyr,user { + io-channels = <&adc 0>; + reference_mv = <1800>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1_2"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; + zephyr,resolution = <14>; + }; +}; diff --git a/tests/drivers/adc/adc_accuracy_test/testcase.yaml b/tests/drivers/adc/adc_accuracy_test/testcase.yaml index ccfaa02ed7dec..4c7f2cfff5ce2 100644 --- a/tests/drivers/adc/adc_accuracy_test/testcase.yaml +++ b/tests/drivers/adc/adc_accuracy_test/testcase.yaml @@ -21,4 +21,5 @@ tests: - ek_ra8m1 - frdm_mcxc242 - nrf52840dk/nrf52840 + - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp From 008f8babac6e4ccf7295dc82905e434e9cf20acc Mon Sep 17 00:00:00 2001 From: Bartlomiej Buczek Date: Fri, 19 Jul 2024 15:34:42 +0200 Subject: [PATCH 1452/4482] tests: drivers: adc_api: change second channel gain for nrf54. It will increase test coverage for adc driver, no test uses ADC_GAIN_2_3 setting yet. Signed-off-by: Bartlomiej Buczek --- .../adc/adc_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 2 +- .../adc/adc_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/drivers/adc/adc_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/adc/adc_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index d9c1f965addb3..536366ec8d5b5 100644 --- a/tests/drivers/adc/adc_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/adc/adc_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -34,7 +34,7 @@ channel@2 { reg = <2>; - zephyr,gain = "ADC_GAIN_1_2"; + zephyr,gain = "ADC_GAIN_2_3"; zephyr,reference = "ADC_REF_INTERNAL"; zephyr,acquisition-time = ; zephyr,input-positive = ; diff --git a/tests/drivers/adc/adc_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/adc/adc_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index a7252902a0c9f..87707847eeab2 100644 --- a/tests/drivers/adc/adc_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/tests/drivers/adc/adc_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -34,7 +34,7 @@ channel@2 { reg = <2>; - zephyr,gain = "ADC_GAIN_2_5"; + zephyr,gain = "ADC_GAIN_2_3"; zephyr,reference = "ADC_REF_INTERNAL"; zephyr,acquisition-time = ; zephyr,input-positive = ; From 557b5bda9a043c1f9f01c877fe123808a90a8f88 Mon Sep 17 00:00:00 2001 From: Bartlomiej Buczek Date: Fri, 19 Jul 2024 15:34:42 +0200 Subject: [PATCH 1453/4482] tests: drivers: adc_accuracy: parametrize expected accuracy On nrf boards expected accuracy from ref voltage is 64 instead of 32. Signed-off-by: Bartlomiej Buczek --- tests/drivers/adc/adc_accuracy_test/boards/ek_ra8m1.overlay | 1 + tests/drivers/adc/adc_accuracy_test/boards/frdm_kl25z.overlay | 1 + .../drivers/adc/adc_accuracy_test/boards/frdm_mcxc242.overlay | 1 + .../adc/adc_accuracy_test/boards/nrf52840dk_nrf52840.overlay | 1 + .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 1 + .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 1 + tests/drivers/adc/adc_accuracy_test/src/ref_volt.c | 3 ++- 7 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/drivers/adc/adc_accuracy_test/boards/ek_ra8m1.overlay b/tests/drivers/adc/adc_accuracy_test/boards/ek_ra8m1.overlay index e3aced0a41b8a..83209ee3b9ecc 100644 --- a/tests/drivers/adc/adc_accuracy_test/boards/ek_ra8m1.overlay +++ b/tests/drivers/adc/adc_accuracy_test/boards/ek_ra8m1.overlay @@ -8,6 +8,7 @@ zephyr,user { io-channels = <&adc0 0>; reference_mv = <3300>; + expected_accuracy = <32>; }; }; diff --git a/tests/drivers/adc/adc_accuracy_test/boards/frdm_kl25z.overlay b/tests/drivers/adc/adc_accuracy_test/boards/frdm_kl25z.overlay index 148ecda4535b2..3be90387270f8 100644 --- a/tests/drivers/adc/adc_accuracy_test/boards/frdm_kl25z.overlay +++ b/tests/drivers/adc/adc_accuracy_test/boards/frdm_kl25z.overlay @@ -8,6 +8,7 @@ zephyr,user { io-channels = <&adc0 12>; reference_mv = <1100>; + expected_accuracy = <32>; }; }; diff --git a/tests/drivers/adc/adc_accuracy_test/boards/frdm_mcxc242.overlay b/tests/drivers/adc/adc_accuracy_test/boards/frdm_mcxc242.overlay index 7d0c761c9443d..1397a540c928b 100644 --- a/tests/drivers/adc/adc_accuracy_test/boards/frdm_mcxc242.overlay +++ b/tests/drivers/adc/adc_accuracy_test/boards/frdm_mcxc242.overlay @@ -10,6 +10,7 @@ zephyr,user { io-channels = <&adc0 1>; reference_mv = <1650>; + expected_accuracy = <32>; }; }; diff --git a/tests/drivers/adc/adc_accuracy_test/boards/nrf52840dk_nrf52840.overlay b/tests/drivers/adc/adc_accuracy_test/boards/nrf52840dk_nrf52840.overlay index 85a8c6880c93c..08aa282bc6039 100644 --- a/tests/drivers/adc/adc_accuracy_test/boards/nrf52840dk_nrf52840.overlay +++ b/tests/drivers/adc/adc_accuracy_test/boards/nrf52840dk_nrf52840.overlay @@ -9,6 +9,7 @@ zephyr,user { io-channels = <&adc 0>; reference_mv = <3000>; + expected_accuracy = <32>; }; }; diff --git a/tests/drivers/adc/adc_accuracy_test/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/adc/adc_accuracy_test/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 20bd3110affee..f6ee92720ca22 100644 --- a/tests/drivers/adc/adc_accuracy_test/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/adc/adc_accuracy_test/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -8,6 +8,7 @@ zephyr,user { io-channels = <&adc 0>; reference_mv = <1800>; + expected_accuracy = <64>; }; }; diff --git a/tests/drivers/adc/adc_accuracy_test/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/adc/adc_accuracy_test/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index 950c52047f6a0..53facf3dc313f 100644 --- a/tests/drivers/adc/adc_accuracy_test/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/tests/drivers/adc/adc_accuracy_test/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -8,6 +8,7 @@ zephyr,user { io-channels = <&adc 0>; reference_mv = <1800>; + expected_accuracy = <64>; }; }; diff --git a/tests/drivers/adc/adc_accuracy_test/src/ref_volt.c b/tests/drivers/adc/adc_accuracy_test/src/ref_volt.c index 1c4806b249e41..66eaddd5b036d 100644 --- a/tests/drivers/adc/adc_accuracy_test/src/ref_volt.c +++ b/tests/drivers/adc/adc_accuracy_test/src/ref_volt.c @@ -8,6 +8,7 @@ #include #define REF_V DT_PROP(DT_PATH(zephyr_user), reference_mv) +#define EXP_ACC DT_PROP(DT_PATH(zephyr_user), expected_accuracy) extern const struct adc_dt_spec *get_adc_channel(void); @@ -31,7 +32,7 @@ static int test_ref_to_adc(void) ret = adc_raw_to_millivolts_dt(adc_channel, &sample_buffer); zassert_equal(ret, 0, "adc_raw_to_millivolts_dt() failed with code %d", ret); - zassert_within(sample_buffer, REF_V, 32, + zassert_within(sample_buffer, REF_V, EXP_ACC, "Value %d mV read from ADC does not match expected range (%d mV).", sample_buffer, REF_V); From dfbcea777a10e27d12539a4fd85b5203f5421151 Mon Sep 17 00:00:00 2001 From: Bartlomiej Buczek Date: Wed, 31 Jul 2024 20:36:28 +0200 Subject: [PATCH 1454/4482] tests: drivers: adc_accuracy: add calibration before sampling Calibrate adc before taking measurement. Signed-off-by: Bartlomiej Buczek --- tests/drivers/adc/adc_accuracy_test/src/ref_volt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/drivers/adc/adc_accuracy_test/src/ref_volt.c b/tests/drivers/adc/adc_accuracy_test/src/ref_volt.c index 66eaddd5b036d..9679720c51ef2 100644 --- a/tests/drivers/adc/adc_accuracy_test/src/ref_volt.c +++ b/tests/drivers/adc/adc_accuracy_test/src/ref_volt.c @@ -20,6 +20,7 @@ static int test_ref_to_adc(void) struct adc_sequence sequence = { .buffer = &sample_buffer, .buffer_size = sizeof(sample_buffer), + .calibrate = true, }; const struct adc_dt_spec *adc_channel = get_adc_channel(); From b9058e8d1854dbafb115c4eb32acaffadab09fa4 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Wed, 23 Oct 2024 13:35:21 +0200 Subject: [PATCH 1455/4482] boards: nordic: nRF54L15 DK: Update note The note had become obsolete, point instead to Nordic's product and documentation pages. Signed-off-by: Carles Cufi --- boards/nordic/nrf54l15dk/doc/index.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/boards/nordic/nrf54l15dk/doc/index.rst b/boards/nordic/nrf54l15dk/doc/index.rst index 4886cadde76a7..8805e8746b50d 100644 --- a/boards/nordic/nrf54l15dk/doc/index.rst +++ b/boards/nordic/nrf54l15dk/doc/index.rst @@ -7,9 +7,9 @@ Overview ******** .. note:: - - All software for the nRF54L15 SoC is experimental and hardware availability - is restricted to the participants in the limited sampling program. + You can find more information about the nRF54L15 SoC on the `nRF54L15 website`_. + For the nRF54L15 technical documentation and other resources (such as + SoC Datasheet), see the `nRF54L15 documentation`_ page. The nRF54L15 Development Kit hardware provides support for the Nordic Semiconductor nRF54L15 Arm Cortex-M33 CPU and the following devices: @@ -146,3 +146,7 @@ Testing the LEDs and buttons in the nRF54L15 DK ************************************************ Test the nRF54L15 DK with a :zephyr:code-sample:`blinky` sample. + + +.. _nRF54L15 website: https://www.nordicsemi.com/Products/nRF54L15 +.. _nRF54L15 documentation: https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/app_dev/device_guides/nrf54l/index.html From 7da4f4d9cdce4a3d7e8a54d8a626aa8fc200ac73 Mon Sep 17 00:00:00 2001 From: Audun Korneliussen Date: Wed, 23 Oct 2024 08:44:58 +0200 Subject: [PATCH 1456/4482] driver: regulator: npm1300: fix build warning regulator_npm1300_init() generated uninitialized variable warning. Fix this by being consistent in the error checking in underlying function. Signed-off-by: Audun Korneliussen --- drivers/regulator/regulator_npm1300.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/regulator_npm1300.c b/drivers/regulator/regulator_npm1300.c index 8adb2d3cb817a..da0a3aedb6417 100644 --- a/drivers/regulator/regulator_npm1300.c +++ b/drivers/regulator/regulator_npm1300.c @@ -533,7 +533,7 @@ static int get_enabled_reg(const struct device *dev, uint8_t base, uint8_t offse int ret = mfd_npm1300_reg_read(config->mfd, base, offset, &data); - if (ret != 0) { + if (ret < 0) { return ret; } From 0e7c64e2ee8a5b4e5f28a2ddaac6034dfa1e937d Mon Sep 17 00:00:00 2001 From: The Nguyen Date: Mon, 21 Oct 2024 13:57:10 +0700 Subject: [PATCH 1457/4482] samples: net: prometheus: add filter to not build with Renesas RA FSP Exclude CONFIG_HAS_RENESAS_RA_FSP as Renesas RA HAL has build error with MbedTLS and Socket enabled Description in https://github.com/zephyrproject-rtos/zephyr/issues/80121 Signed-off-by: The Nguyen --- samples/net/prometheus/sample.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/samples/net/prometheus/sample.yaml b/samples/net/prometheus/sample.yaml index c50834045898f..c499e52f40f48 100644 --- a/samples/net/prometheus/sample.yaml +++ b/samples/net/prometheus/sample.yaml @@ -13,5 +13,7 @@ common: platform_exclude: - native_posix - native_posix/native/64 + # Exclude CONFIG_HAS_RENESAS_RA_FSP as Renesas RA HAL has build error with mbedtls Socket + filter: not CONFIG_HAS_RENESAS_RA_FSP tests: sample.net.prometheus: {} From bbdf72f015eca06cf72f276714daf7f9d219a91e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 17:21:38 +0200 Subject: [PATCH 1458/4482] doc: boards: add target-notes directive where missing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For the "References" section to be useful, it needs to include a call to the target-notes directive, which is the one that actually generates the list of references made in the current document. Signed-off-by: Benjamin Cabé --- boards/96boards/neonkey/doc/index.rst | 2 ++ boards/96boards/wistrio/doc/96b_wistrio.rst | 2 ++ boards/arduino/due/doc/index.rst | 2 ++ boards/arm/fvp_base_revc_2xaemv8a/doc/index.rst | 2 ++ boards/arm/fvp_baser_aemv8r/doc/aarch32.rst | 2 ++ boards/arm/fvp_baser_aemv8r/doc/aarch64.rst | 2 ++ boards/arm/fvp_baser_aemv8r/doc/debug-with-arm-ds.rst | 2 ++ boards/blues/swan_r5/doc/index.rst | 2 ++ boards/cdns/xt-sim/doc/index.rst | 2 ++ boards/cypress/cy8ckit_062_ble/doc/index.rst | 2 ++ boards/cypress/cy8ckit_062_wifi_bt/doc/index.rst | 2 ++ boards/espressif/esp32_devkitc_wroom/doc/index.rst | 2 ++ boards/espressif/esp32_devkitc_wrover/doc/index.rst | 2 ++ boards/espressif/esp32_ethernet_kit/doc/index.rst | 2 ++ boards/espressif/esp32c3_devkitc/doc/index.rst | 2 ++ boards/espressif/esp32c3_devkitm/doc/index.rst | 2 ++ boards/espressif/esp32c3_rust/doc/index.rst | 2 ++ boards/espressif/esp32c6_devkitc/doc/index.rst | 2 ++ boards/espressif/esp32s2_devkitc/doc/index.rst | 2 ++ boards/espressif/esp32s2_saola/doc/index.rst | 2 ++ boards/espressif/esp32s3_devkitc/doc/index.rst | 2 ++ boards/espressif/esp32s3_devkitm/doc/index.rst | 2 ++ boards/espressif/esp8684_devkitm/doc/index.rst | 2 ++ boards/espressif/esp_wrover_kit/doc/index.rst | 2 ++ boards/franzininho/esp32s2_franzininho/doc/index.rst | 2 ++ boards/infineon/cy8ckit_062s4/doc/index.rst | 2 ++ boards/infineon/cy8cproto_063_ble/doc/index.rst | 2 ++ boards/infineon/xmc45_relax_kit/doc/index.rst | 2 ++ boards/infineon/xmc47_relax_kit/doc/index.rst | 2 ++ boards/kincony/kincony_kc868_a32/doc/index.rst | 2 ++ boards/luatos/esp32c3_luatos_core/doc/index.rst | 2 ++ boards/luatos/esp32s3_luatos_core/doc/index.rst | 2 ++ boards/nuvoton/numaker_m2l31ki/doc/index.rst | 2 ++ boards/nuvoton/numaker_pfm_m467/doc/index.rst | 2 ++ boards/nuvoton/numaker_pfm_m487/doc/index.rst | 2 ++ boards/nxp/frdm_mcxw71/doc/index.rst | 2 ++ boards/nxp/rd_rw612_bga/doc/index.rst | 2 ++ boards/olimex/olimex_esp32_evb/doc/index.rst | 2 ++ boards/others/icev_wireless/doc/index.rst | 2 ++ boards/phytec/reel_board/doc/index.rst | 2 ++ boards/pjrc/teensy4/doc/index.rst | 2 ++ boards/qemu/cortex_a53/doc/index.rst | 2 ++ boards/qemu/cortex_r5/doc/index.rst | 2 ++ boards/raytac/mdbt53_db_40/doc/index.rst | 2 ++ boards/raytac/mdbt53v_db_40/doc/index.rst | 2 ++ boards/renesas/ek_ra2a1/doc/index.rst | 2 ++ boards/renesas/rzt2m_starterkit/doc/index.rst | 2 ++ boards/seeed/xiao_esp32s3/doc/index.rst | 2 ++ boards/snps/em_starterkit/doc/index.rst | 2 ++ boards/snps/hsdk/doc/index.rst | 2 ++ boards/snps/hsdk4xd/doc/index.rst | 2 ++ boards/snps/iotdk/doc/index.rst | 2 ++ boards/snps/nsim/arc_classic/doc/index.rst | 2 ++ boards/snps/nsim/arc_v/doc/index.rst | 2 ++ boards/ti/cc3235sf_launchxl/doc/index.rst | 2 ++ boards/ti/msp_exp432p401r_launchxl/doc/index.rst | 2 ++ boards/vcc-gnd/yd_esp32/doc/index.rst | 2 ++ boards/waveshare/esp32s3_touch_lcd_1_28/doc/index.rst | 2 ++ boards/wemos/esp32s2_lolin_mini/doc/index.rst | 2 ++ 59 files changed, 118 insertions(+) diff --git a/boards/96boards/neonkey/doc/index.rst b/boards/96boards/neonkey/doc/index.rst index df9fb1619c115..b69b94a471207 100644 --- a/boards/96boards/neonkey/doc/index.rst +++ b/boards/96boards/neonkey/doc/index.rst @@ -216,6 +216,8 @@ GDB instance. To reattach, just follow the same steps above, till References ********** +.. target-notes:: + .. _96Boards website: https://www.96boards.org/product/neonkey/ diff --git a/boards/96boards/wistrio/doc/96b_wistrio.rst b/boards/96boards/wistrio/doc/96b_wistrio.rst index 8db31fcf6cbfb..9fe756efe6bd6 100644 --- a/boards/96boards/wistrio/doc/96b_wistrio.rst +++ b/boards/96boards/wistrio/doc/96b_wistrio.rst @@ -189,6 +189,8 @@ GDB instance. To reattach, just follow the same steps above, till References ********** +.. target-notes:: + .. _AN2606: https://www.st.com/resource/en/application_note/cd00167594.pdf diff --git a/boards/arduino/due/doc/index.rst b/boards/arduino/due/doc/index.rst index dfc6e0078011f..e1eda346744cc 100644 --- a/boards/arduino/due/doc/index.rst +++ b/boards/arduino/due/doc/index.rst @@ -205,6 +205,8 @@ Now press the Reset button and you should see "Hello World! arduino_due" in your References ********** +.. target-notes:: + .. _Arduino Due website: https://www.arduino.cc/en/Main/ArduinoBoardDue .. _Atmel SAM3X8E Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-11057-32-bit-Cortex-M3-Microcontroller-SAM3X-SAM3A_Datasheet.pdf diff --git a/boards/arm/fvp_base_revc_2xaemv8a/doc/index.rst b/boards/arm/fvp_base_revc_2xaemv8a/doc/index.rst index 81a098b3ae1d2..0954a2d90a130 100644 --- a/boards/arm/fvp_base_revc_2xaemv8a/doc/index.rst +++ b/boards/arm/fvp_base_revc_2xaemv8a/doc/index.rst @@ -117,6 +117,8 @@ Networking References ********** +.. target-notes:: + 1. (ID070919) Arm® Architecture Reference Manual - Armv8, for Armv8-A architecture profile 2. AArch64 Exception and Interrupt Handling 3. https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms diff --git a/boards/arm/fvp_baser_aemv8r/doc/aarch32.rst b/boards/arm/fvp_baser_aemv8r/doc/aarch32.rst index d191100202044..8fcc4d07b0ec9 100644 --- a/boards/arm/fvp_baser_aemv8r/doc/aarch32.rst +++ b/boards/arm/fvp_baser_aemv8r/doc/aarch32.rst @@ -96,6 +96,8 @@ Refer to the detailed overview about :ref:`application_debugging`. References ********** +.. target-notes:: + .. [1] https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms/arm-ecosystem-models .. [2] Arm Architecture Reference Manual Supplement - Armv8, for Armv8-R AArch32 architecture profile https://developer.arm.com/documentation/ddi0568/latest diff --git a/boards/arm/fvp_baser_aemv8r/doc/aarch64.rst b/boards/arm/fvp_baser_aemv8r/doc/aarch64.rst index 3c45ce22840e7..724ee182cc9a6 100644 --- a/boards/arm/fvp_baser_aemv8r/doc/aarch64.rst +++ b/boards/arm/fvp_baser_aemv8r/doc/aarch64.rst @@ -106,6 +106,8 @@ See :ref:`debug_with_arm_ds` for how to debug with Arm Development Studio [5]_. References ********** +.. target-notes:: + .. [1] https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms/arm-ecosystem-models .. [2] Arm Architecture Reference Manual Supplement - Armv8, for Armv8-R AArch64 architecture profile https://developer.arm.com/documentation/ddi0600/latest/ diff --git a/boards/arm/fvp_baser_aemv8r/doc/debug-with-arm-ds.rst b/boards/arm/fvp_baser_aemv8r/doc/debug-with-arm-ds.rst index 874cd70aa7e2f..79b48aca53568 100644 --- a/boards/arm/fvp_baser_aemv8r/doc/debug-with-arm-ds.rst +++ b/boards/arm/fvp_baser_aemv8r/doc/debug-with-arm-ds.rst @@ -141,5 +141,7 @@ connected in ``Debug Control`` window. References ********** +.. target-notes:: + .. [1] https://developer.arm.com/tools-and-software/embedded/arm-development-studio .. [2] https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms/arm-ecosystem-models diff --git a/boards/blues/swan_r5/doc/index.rst b/boards/blues/swan_r5/doc/index.rst index 6ee06251f30ef..e29510d93d964 100644 --- a/boards/blues/swan_r5/doc/index.rst +++ b/boards/blues/swan_r5/doc/index.rst @@ -222,6 +222,8 @@ You should see the following message on the console: References ********** +.. target-notes:: + .. _Swan Product Page: https://blues.io/products/swan diff --git a/boards/cdns/xt-sim/doc/index.rst b/boards/cdns/xt-sim/doc/index.rst index 5f97e597250db..30a86d00953fd 100644 --- a/boards/cdns/xt-sim/doc/index.rst +++ b/boards/cdns/xt-sim/doc/index.rst @@ -177,4 +177,6 @@ Build and run as follows: References ********** +.. target-notes:: + .. _Xtensa tools: https://ip.cadence.com/support/sdk-evaluation-request diff --git a/boards/cypress/cy8ckit_062_ble/doc/index.rst b/boards/cypress/cy8ckit_062_ble/doc/index.rst index 46940f0691a66..f2194d084c0dc 100644 --- a/boards/cypress/cy8ckit_062_ble/doc/index.rst +++ b/boards/cypress/cy8ckit_062_ble/doc/index.rst @@ -283,6 +283,8 @@ UART_RTS with UART_CTS from KitProg2. References ********** +.. target-notes:: + .. _PSoC 63 BLE MCU SoC Website: https://www.cypress.com/products/32-bit-arm-cortex-m4-cortex-m0-psoc-63-connectivity-line diff --git a/boards/cypress/cy8ckit_062_wifi_bt/doc/index.rst b/boards/cypress/cy8ckit_062_wifi_bt/doc/index.rst index d7e20c9bcb0ce..515eb920c55c0 100644 --- a/boards/cypress/cy8ckit_062_wifi_bt/doc/index.rst +++ b/boards/cypress/cy8ckit_062_wifi_bt/doc/index.rst @@ -186,6 +186,8 @@ serial port: References ********** +.. target-notes:: + .. _PSoC 62 MCU SoC Website: https://www.cypress.com/products/32-bit-arm-cortex-m4-psoc-6 diff --git a/boards/espressif/esp32_devkitc_wroom/doc/index.rst b/boards/espressif/esp32_devkitc_wroom/doc/index.rst index 4107dbf6cfe36..0df38f0c40e54 100644 --- a/boards/espressif/esp32_devkitc_wroom/doc/index.rst +++ b/boards/espressif/esp32_devkitc_wroom/doc/index.rst @@ -292,6 +292,8 @@ GDB stub is enabled on ESP32. References ********** +.. target-notes:: + .. _`ESP32-DevKitC-WROOM`: https://docs.espressif.com/projects/esp-idf/en/stable/esp32/hw-reference/esp32/get-started-devkitc.html# .. _`ESP32 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf .. _`ESP32 Technical Reference Manual`: https://espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf diff --git a/boards/espressif/esp32_devkitc_wrover/doc/index.rst b/boards/espressif/esp32_devkitc_wrover/doc/index.rst index 79bb94f6b1ae2..f1bd6172f14e2 100644 --- a/boards/espressif/esp32_devkitc_wrover/doc/index.rst +++ b/boards/espressif/esp32_devkitc_wrover/doc/index.rst @@ -292,6 +292,8 @@ GDB stub is enabled on ESP32. References ********** +.. target-notes:: + .. _`ESP32-DevKitC-WROVER`: https://docs.espressif.com/projects/esp-idf/en/stable/esp32/hw-reference/esp32/get-started-devkitc.html# .. _`ESP32 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf .. _`ESP32 Technical Reference Manual`: https://espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf diff --git a/boards/espressif/esp32_ethernet_kit/doc/index.rst b/boards/espressif/esp32_ethernet_kit/doc/index.rst index 37144964421ee..2884fbadb5a39 100644 --- a/boards/espressif/esp32_ethernet_kit/doc/index.rst +++ b/boards/espressif/esp32_ethernet_kit/doc/index.rst @@ -615,6 +615,8 @@ during board initialization (board_init.c) References ********** +.. target-notes:: + .. _`ESP32-Ethernet-Kit V1.2 Ethernet Board (A) Schematic`: https://dl.espressif.com/dl/schematics/SCH_ESP32-Ethernet-Kit_A_V1.2_20200528.pdf .. _`ESP32-WROVER-E Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-wrover-e_esp32-wrover-ie_datasheet_en.pdf .. _`OpenOCD ESP32`: https://github.com/espressif/openocd-esp32/releases diff --git a/boards/espressif/esp32c3_devkitc/doc/index.rst b/boards/espressif/esp32c3_devkitc/doc/index.rst index 97ce7f181b5fc..cd24beaff37c8 100644 --- a/boards/espressif/esp32c3_devkitc/doc/index.rst +++ b/boards/espressif/esp32c3_devkitc/doc/index.rst @@ -246,6 +246,8 @@ You can debug an application in the usual way. Here is an example for the :zephy References ********** +.. target-notes:: + .. _`ESP32-C3-DevKitC`: https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32c3/esp32-c3-devkitc-02/index.html .. _`ESP32-C3 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf .. _`ESP32-C3 Technical Reference Manual`: https://espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf diff --git a/boards/espressif/esp32c3_devkitm/doc/index.rst b/boards/espressif/esp32c3_devkitm/doc/index.rst index aed67104255af..41bd0ecf11aea 100644 --- a/boards/espressif/esp32c3_devkitm/doc/index.rst +++ b/boards/espressif/esp32c3_devkitm/doc/index.rst @@ -246,6 +246,8 @@ You can debug an application in the usual way. Here is an example for the :zephy References ********** +.. target-notes:: + .. _`ESP32-C3-DevKitM`: https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/hw-reference/esp32c3/user-guide-devkitm-1.html .. _`ESP32-C3 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf .. _`ESP32-C3 Technical Reference Manual`: https://espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf diff --git a/boards/espressif/esp32c3_rust/doc/index.rst b/boards/espressif/esp32c3_rust/doc/index.rst index 7b80d30ee5fd6..ed31773b796c2 100644 --- a/boards/espressif/esp32c3_rust/doc/index.rst +++ b/boards/espressif/esp32c3_rust/doc/index.rst @@ -291,6 +291,8 @@ You can debug an application in the usual way. Here is an example for the :zephy References ********** +.. target-notes:: + .. _`ESP32-C3-DevKit-RUST`: https://github.com/esp-rs/esp-rust-board/tree/v1.2 .. _`ESP32-C3 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf .. _`ESP32-C3 Technical Reference Manual`: https://espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf diff --git a/boards/espressif/esp32c6_devkitc/doc/index.rst b/boards/espressif/esp32c6_devkitc/doc/index.rst index 7b856912a9a1c..3914c9e584384 100644 --- a/boards/espressif/esp32c6_devkitc/doc/index.rst +++ b/boards/espressif/esp32c6_devkitc/doc/index.rst @@ -281,6 +281,8 @@ You can debug an application in the usual way. Here is an example for the :zephy References ********** +.. target-notes:: + .. _`ESP32-C6-DevKitC`: https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32c6/esp32-c6-devkitc-1/user_guide.html .. _`ESP32-C6 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf .. _`ESP32-C6 Technical Reference Manual`: https://espressif.com/sites/default/files/documentation/esp32-c6_technical_reference_manual_en.pdf diff --git a/boards/espressif/esp32s2_devkitc/doc/index.rst b/boards/espressif/esp32s2_devkitc/doc/index.rst index 9e1bb15fd10de..f1367429b9110 100644 --- a/boards/espressif/esp32s2_devkitc/doc/index.rst +++ b/boards/espressif/esp32s2_devkitc/doc/index.rst @@ -252,6 +252,8 @@ You can debug an application in the usual way. Here is an example for the :zephy References ********** +.. target-notes:: + .. _`ESP32-S3-DevKitC`: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/hw-reference/esp32s2/user-guide-saola-1-v1.2.html .. _`ESP32-S2 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf .. _`ESP32-S2 Technical Reference Manual`: https://espressif.com/sites/default/files/documentation/esp32-s2_technical_reference_manual_en.pdf diff --git a/boards/espressif/esp32s2_saola/doc/index.rst b/boards/espressif/esp32s2_saola/doc/index.rst index dba54f93cae0d..78457ca36b2eb 100644 --- a/boards/espressif/esp32s2_saola/doc/index.rst +++ b/boards/espressif/esp32s2_saola/doc/index.rst @@ -252,6 +252,8 @@ You can debug an application in the usual way. Here is an example for the :zephy References ********** +.. target-notes:: + .. _`ESP32-S3-DevKitC`: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/hw-reference/esp32s2/user-guide-saola-1-v1.2.html .. _`ESP32-S2 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf .. _`ESP32-S2 Technical Reference Manual`: https://espressif.com/sites/default/files/documentation/esp32-s2_technical_reference_manual_en.pdf diff --git a/boards/espressif/esp32s3_devkitc/doc/index.rst b/boards/espressif/esp32s3_devkitc/doc/index.rst index cd49316dacd33..5cf44e08df771 100644 --- a/boards/espressif/esp32s3_devkitc/doc/index.rst +++ b/boards/espressif/esp32s3_devkitc/doc/index.rst @@ -279,6 +279,8 @@ You can debug an application in the usual way. Here is an example for the :zephy References ********** +.. target-notes:: + .. _`ESP32-S3-DevKitC`: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html .. _`ESP32-S3 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-s3-wroom-1_wroom-1u_datasheet_en.pdf .. _`ESP32-S3 Technical Reference Manual`: https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf diff --git a/boards/espressif/esp32s3_devkitm/doc/index.rst b/boards/espressif/esp32s3_devkitm/doc/index.rst index 04a3997abba02..9106f71ec08b3 100644 --- a/boards/espressif/esp32s3_devkitm/doc/index.rst +++ b/boards/espressif/esp32s3_devkitm/doc/index.rst @@ -279,6 +279,8 @@ You can debug an application in the usual way. Here is an example for the :zephy References ********** +.. target-notes:: + .. _`ESP32-S3-DevKitM User Guide`: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitm-1.html .. _`ESP32-S3 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-s3-mini-1_mini-1u_datasheet_en.pdf .. _`ESP32-S3 Technical Reference Manual`: https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf diff --git a/boards/espressif/esp8684_devkitm/doc/index.rst b/boards/espressif/esp8684_devkitm/doc/index.rst index fe2ba1e60bf3b..68919d8f1e5ba 100644 --- a/boards/espressif/esp8684_devkitm/doc/index.rst +++ b/boards/espressif/esp8684_devkitm/doc/index.rst @@ -242,6 +242,8 @@ You can debug an application in the usual way. Here is an example for the :zephy References ********** +.. target-notes:: + .. _`ESP8684-DevKitM User Guide`: https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp8684/esp8684-devkitm-1/user_guide.html .. _`ESP8684 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp8684_datasheet_en.pdf .. _`ESP8684 Technical Reference Manual`: https://www.espressif.com/sites/default/files/documentation/esp8684_technical_reference_manual_en.pdf diff --git a/boards/espressif/esp_wrover_kit/doc/index.rst b/boards/espressif/esp_wrover_kit/doc/index.rst index 0a92c4f16791a..326afb3246a5c 100644 --- a/boards/espressif/esp_wrover_kit/doc/index.rst +++ b/boards/espressif/esp_wrover_kit/doc/index.rst @@ -652,6 +652,8 @@ You can debug an application in the usual way. Here is an example for the :zephy References ********** +.. target-notes:: + .. _`ESP32 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf (PDF) .. _`ESP32-WROVER-E Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-wrover-e_esp32-wrover-ie_datasheet_en.pdf (PDF) .. _`OpenOCD ESP32`: https://github.com/espressif/openocd-esp32/releases diff --git a/boards/franzininho/esp32s2_franzininho/doc/index.rst b/boards/franzininho/esp32s2_franzininho/doc/index.rst index efa47c90719ff..803cb9be652a6 100644 --- a/boards/franzininho/esp32s2_franzininho/doc/index.rst +++ b/boards/franzininho/esp32s2_franzininho/doc/index.rst @@ -173,6 +173,8 @@ message in the monitor: References ********** +.. target-notes:: + .. [1] https://www.espressif.com/en/products/socs/esp32-s2 .. _`ESP32S2 Technical Reference Manual`: https://espressif.com/sites/default/files/documentation/esp32-s2_technical_reference_manual_en.pdf .. _`ESP32S2 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf diff --git a/boards/infineon/cy8ckit_062s4/doc/index.rst b/boards/infineon/cy8ckit_062s4/doc/index.rst index 9d2b74b55cbcf..c697a60d872c9 100644 --- a/boards/infineon/cy8ckit_062s4/doc/index.rst +++ b/boards/infineon/cy8ckit_062s4/doc/index.rst @@ -100,6 +100,8 @@ To get the OpenOCD package, it is required that you References ********** +.. target-notes:: + .. _CY8CKIT 062S4 Pioneer Kit Guide: https://www.infineon.com/dgdl/Infineon-CY8CKIT_062S4_PSoC62S4_pioneer_kit_guide-UserManual-v01_00-EN.pdf?fileId=8ac78c8c7e7124d1017e962f98992207 diff --git a/boards/infineon/cy8cproto_063_ble/doc/index.rst b/boards/infineon/cy8cproto_063_ble/doc/index.rst index 86cc9cd5c1595..fa03c072e0982 100644 --- a/boards/infineon/cy8cproto_063_ble/doc/index.rst +++ b/boards/infineon/cy8cproto_063_ble/doc/index.rst @@ -119,6 +119,8 @@ On Linux: References ********** +.. target-notes:: + .. _PSoC 63 BLE MCU SoC Website: https://www.cypress.com/products/32-bit-arm-cortex-m4-psoc-6 diff --git a/boards/infineon/xmc45_relax_kit/doc/index.rst b/boards/infineon/xmc45_relax_kit/doc/index.rst index 621fc1cc83e05..1209b7da84285 100644 --- a/boards/infineon/xmc45_relax_kit/doc/index.rst +++ b/boards/infineon/xmc45_relax_kit/doc/index.rst @@ -96,6 +96,8 @@ Step through the application in your debugger. References ********** +.. target-notes:: + .. _Relax Kit User Manual: https://www.infineon.com/dgdl/Board_Users_Manual_XMC4500_Relax_Kit-V1_R1.2_released.pdf?fileId=db3a30433acf32c9013adf6b97b112f9 diff --git a/boards/infineon/xmc47_relax_kit/doc/index.rst b/boards/infineon/xmc47_relax_kit/doc/index.rst index 57eb28efaedb1..3170d1f41b41e 100644 --- a/boards/infineon/xmc47_relax_kit/doc/index.rst +++ b/boards/infineon/xmc47_relax_kit/doc/index.rst @@ -99,6 +99,8 @@ Step through the application in your debugger. References ********** +.. target-notes:: + .. _Relax Kit User Manual: https://www.infineon.com/dgdl/Infineon-Board_User_Manual_XMC4700_XMC4800_Relax_Kit_Series-UserManual-v01_04-EN.pdf?fileId=5546d46250cc1fdf01513f8e052d07fc diff --git a/boards/kincony/kincony_kc868_a32/doc/index.rst b/boards/kincony/kincony_kc868_a32/doc/index.rst index ccc8676f512a4..8c89d3de3715e 100644 --- a/boards/kincony/kincony_kc868_a32/doc/index.rst +++ b/boards/kincony/kincony_kc868_a32/doc/index.rst @@ -94,4 +94,6 @@ Enable Ethernet in KConfig: References ********** +.. target-notes:: + .. _KINCONY KC868-A32 User Guide: https://www.kincony.com/arduino-esp32-32-channel-relay-module-kc868-a32.html diff --git a/boards/luatos/esp32c3_luatos_core/doc/index.rst b/boards/luatos/esp32c3_luatos_core/doc/index.rst index 2e0d5ed56b25a..02df6687cb3c1 100644 --- a/boards/luatos/esp32c3_luatos_core/doc/index.rst +++ b/boards/luatos/esp32c3_luatos_core/doc/index.rst @@ -256,6 +256,8 @@ You can debug an application in the usual way. Here is an example for the :zephy References ********** +.. target-notes:: + .. [1] https://www.espressif.com/en/products/socs/esp32-c3 .. _ESP32C3 Core Website: https://wiki.luatos.com/chips/esp32c3/board.html .. _ESP32C3 Technical Reference Manual: https://espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf diff --git a/boards/luatos/esp32s3_luatos_core/doc/index.rst b/boards/luatos/esp32s3_luatos_core/doc/index.rst index 7aa4310206947..c8e3f74375f75 100644 --- a/boards/luatos/esp32s3_luatos_core/doc/index.rst +++ b/boards/luatos/esp32s3_luatos_core/doc/index.rst @@ -286,6 +286,8 @@ You can debug an application in the usual way. Here is an example for the :zephy References ********** +.. target-notes:: + .. _`ESP32S3-Luatos-Core`: https://wiki.luatos.com/chips/esp32s3/board.html .. _`ESP32-S3 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-s3-mini-1_mini-1u_datasheet_en.pdf .. _`ESP32-S3 Technical Reference Manual`: https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf diff --git a/boards/nuvoton/numaker_m2l31ki/doc/index.rst b/boards/nuvoton/numaker_m2l31ki/doc/index.rst index 8c2e8b8bf77fe..031deb73b67b7 100644 --- a/boards/nuvoton/numaker_m2l31ki/doc/index.rst +++ b/boards/nuvoton/numaker_m2l31ki/doc/index.rst @@ -89,6 +89,8 @@ Step through the application in your debugger. References ********** +.. target-notes:: + .. _NuMaker M2L31KI User Manual: https://www.nuvoton.com/products/microcontrollers/arm-cortex-m23-mcus/m2l31-series/ .. _M2L31 TRM: diff --git a/boards/nuvoton/numaker_pfm_m467/doc/index.rst b/boards/nuvoton/numaker_pfm_m467/doc/index.rst index 6620acce55947..e43ad1415f69b 100644 --- a/boards/nuvoton/numaker_pfm_m467/doc/index.rst +++ b/boards/nuvoton/numaker_pfm_m467/doc/index.rst @@ -93,6 +93,8 @@ Step through the application in your debugger. References ********** +.. target-notes:: + .. _PFM M467 User Manual: https://www.nuvoton.com/export/resource-files/UM_NuMaker-PFM-M467_User_Manual_EN_Rev1.01.pdf .. _M460 TRM: diff --git a/boards/nuvoton/numaker_pfm_m487/doc/index.rst b/boards/nuvoton/numaker_pfm_m487/doc/index.rst index 180ae3c5665a1..034fac9a86759 100644 --- a/boards/nuvoton/numaker_pfm_m487/doc/index.rst +++ b/boards/nuvoton/numaker_pfm_m487/doc/index.rst @@ -92,6 +92,8 @@ Step through the application in your debugger. References ********** +.. target-notes:: + .. _PFM M487 User Manual: https://www.nuvoton.com/export/resource-files/UM_NuMaker-PFM-M487_User_Manual_EN_Rev1.01.pdf .. _M480 TRM: diff --git a/boards/nxp/frdm_mcxw71/doc/index.rst b/boards/nxp/frdm_mcxw71/doc/index.rst index 7b4e37a907529..01daa23f20835 100644 --- a/boards/nxp/frdm_mcxw71/doc/index.rst +++ b/boards/nxp/frdm_mcxw71/doc/index.rst @@ -196,6 +196,8 @@ For more details: References ********** +.. target-notes:: + .. _MCXW71 SoC Website: https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/mcx-arm-cortex-m/mcx-w-series-microcontrollers/mcx-w71x-secure-and-ultra-low-power-mcus-for-matter-thread-zigbee-and-bluetooth-le:MCX-W71X diff --git a/boards/nxp/rd_rw612_bga/doc/index.rst b/boards/nxp/rd_rw612_bga/doc/index.rst index a45c2e979e704..2a1b8ac6a20b3 100644 --- a/boards/nxp/rd_rw612_bga/doc/index.rst +++ b/boards/nxp/rd_rw612_bga/doc/index.rst @@ -249,5 +249,7 @@ Then, build for the board target ``rd_rw612_bga//ethernet``. Resources ********* +.. target-notes:: + .. _RW612 Website: https://www.nxp.com/products/wireless-connectivity/wi-fi-plus-bluetooth-plus-802-15-4/wireless-mcu-with-integrated-tri-radiobr1x1-wi-fi-6-plus-bluetooth-low-energy-5-3-802-15-4:RW612 diff --git a/boards/olimex/olimex_esp32_evb/doc/index.rst b/boards/olimex/olimex_esp32_evb/doc/index.rst index 5af913a12732d..fcb00c2a57f89 100644 --- a/boards/olimex/olimex_esp32_evb/doc/index.rst +++ b/boards/olimex/olimex_esp32_evb/doc/index.rst @@ -256,6 +256,8 @@ You can debug an application in the usual way. Here is an example for the :zephy References ********** +.. target-notes:: + .. _ESP32-EVB Website: https://www.olimex.com/Products/IoT/ESP32/ESP32-EVB/open-source-hardware diff --git a/boards/others/icev_wireless/doc/index.rst b/boards/others/icev_wireless/doc/index.rst index 5b56cd94c3d2d..c699686caf31a 100644 --- a/boards/others/icev_wireless/doc/index.rst +++ b/boards/others/icev_wireless/doc/index.rst @@ -244,6 +244,8 @@ You can debug an application in the usual way. Here is an example for the References ********** +.. target-notes:: + .. _ICE-V Wireless Github Project: https://github.com/ICE-V-Wireless/ICE-V-Wireless diff --git a/boards/phytec/reel_board/doc/index.rst b/boards/phytec/reel_board/doc/index.rst index d468a6c559af6..7e588bebf865f 100644 --- a/boards/phytec/reel_board/doc/index.rst +++ b/boards/phytec/reel_board/doc/index.rst @@ -552,6 +552,8 @@ your board. References ********** +.. target-notes:: + .. _reel board Website: https://www.phytec.de/reelboard/ diff --git a/boards/pjrc/teensy4/doc/index.rst b/boards/pjrc/teensy4/doc/index.rst index f9644699d68dd..66aefe952c0a2 100644 --- a/boards/pjrc/teensy4/doc/index.rst +++ b/boards/pjrc/teensy4/doc/index.rst @@ -225,6 +225,8 @@ etc.): References ********** +.. target-notes:: + .. _Teensy 4.0 Website: https://www.pjrc.com/store/teensy40.html diff --git a/boards/qemu/cortex_a53/doc/index.rst b/boards/qemu/cortex_a53/doc/index.rst index 930671bb927bd..424d6e5f874b6 100644 --- a/boards/qemu/cortex_a53/doc/index.rst +++ b/boards/qemu/cortex_a53/doc/index.rst @@ -103,6 +103,8 @@ and shell would need to be disabled, therefore this is not directly supported. References ********** +.. target-notes:: + 1. (ID050815) ARM® Cortex®-A Series - Programmer’s Guide for ARMv8-A 2. (ID070919) Arm® Architecture Reference Manual - Armv8, for Armv8-A architecture profile 3. (ARM DAI 0527A) Application Note Bare-metal Boot Code for ARMv8-A Processors diff --git a/boards/qemu/cortex_r5/doc/index.rst b/boards/qemu/cortex_r5/doc/index.rst index 9fd59d117acb5..c566e5d4c0408 100644 --- a/boards/qemu/cortex_r5/doc/index.rst +++ b/boards/qemu/cortex_r5/doc/index.rst @@ -99,6 +99,8 @@ Refer to the detailed overview about :ref:`application_debugging`. References ********** +.. target-notes:: + 1. ARMv7-A and ARMv7-R Architecture Reference Manual (ARM DDI 0406C ID051414) 2. Cortex-R5 and Cortex-R5F Technical Reference Manual (ARM DDI 0460C ID021511) 3. Zynq UltraScale+ Device Technical Reference Manual (UG1085) diff --git a/boards/raytac/mdbt53_db_40/doc/index.rst b/boards/raytac/mdbt53_db_40/doc/index.rst index 9ddb5b77c5d6e..ff7b7140378ef 100644 --- a/boards/raytac/mdbt53_db_40/doc/index.rst +++ b/boards/raytac/mdbt53_db_40/doc/index.rst @@ -259,6 +259,8 @@ boards with a Segger IC. References ********** +.. target-notes:: + .. _IDAU: https://developer.arm.com/docs/100690/latest/attribution-units-sau-and-idau .. _MDBT53-DB-40 website: diff --git a/boards/raytac/mdbt53v_db_40/doc/index.rst b/boards/raytac/mdbt53v_db_40/doc/index.rst index 27a2aeee34591..6df0362e831ee 100644 --- a/boards/raytac/mdbt53v_db_40/doc/index.rst +++ b/boards/raytac/mdbt53v_db_40/doc/index.rst @@ -249,6 +249,8 @@ J-Link OB IF to debug. References ********** +.. target-notes:: + .. _IDAU: https://developer.arm.com/docs/100690/latest/attribution-units-sau-and-idau .. _MDBT53V-DB-40 website: diff --git a/boards/renesas/ek_ra2a1/doc/index.rst b/boards/renesas/ek_ra2a1/doc/index.rst index 060f1627d2cf2..49ba90a9b30f0 100644 --- a/boards/renesas/ek_ra2a1/doc/index.rst +++ b/boards/renesas/ek_ra2a1/doc/index.rst @@ -101,5 +101,7 @@ Also, see the instructions specific to the debug server that you use. References ********** +.. target-notes:: + .. EK-RA2A1 Web site: https://www.renesas.com/us/en/products/microcontrollers-microprocessors/ra-cortex-m-mcus/ek-ra2a1-evaluation-kit-ra2a1-mcu-group diff --git a/boards/renesas/rzt2m_starterkit/doc/index.rst b/boards/renesas/rzt2m_starterkit/doc/index.rst index eecaa1bc3c67b..69f6c5327005a 100644 --- a/boards/renesas/rzt2m_starterkit/doc/index.rst +++ b/boards/renesas/rzt2m_starterkit/doc/index.rst @@ -95,4 +95,6 @@ Connect GDB to the server and load an application: References ********** +.. target-notes:: + .. _RZT2M Product page: https://www.renesas.com/us/en/products/microcontrollers-microprocessors/rz-mpus/rzt2m-high-performance-multi-function-mpu-realizing-high-speed-processing-and-high-precision-control diff --git a/boards/seeed/xiao_esp32s3/doc/index.rst b/boards/seeed/xiao_esp32s3/doc/index.rst index 60aef4a2e7d0e..0da45987f3515 100644 --- a/boards/seeed/xiao_esp32s3/doc/index.rst +++ b/boards/seeed/xiao_esp32s3/doc/index.rst @@ -228,6 +228,8 @@ You can debug an application in the usual way. Here is an example for the :zephy References ********** +.. target-notes:: + .. _`Seeed Studio XIAO ESP32S3`: https://wiki.seeedstudio.com/xiao_esp32s3_getting_started/ .. _`JTAG debugging for ESP32-S3`: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/jtag-debugging/ .. _`OpenOCD ESP32`: https://github.com/espressif/openocd-esp32/releases diff --git a/boards/snps/em_starterkit/doc/index.rst b/boards/snps/em_starterkit/doc/index.rst index e569031e37805..1bca8bd69de4e 100644 --- a/boards/snps/em_starterkit/doc/index.rst +++ b/boards/snps/em_starterkit/doc/index.rst @@ -307,6 +307,8 @@ The following is a list of TODO items: References ********** +.. target-notes:: + .. _embARC website: https://www.embarc.org .. _Designware ARC EM Starter Kit website: https://www.synopsys.com/dw/ipdir.php?ds=arc_em_starter_kit diff --git a/boards/snps/hsdk/doc/index.rst b/boards/snps/hsdk/doc/index.rst index b79ecbca968eb..6bf82bce86555 100644 --- a/boards/snps/hsdk/doc/index.rst +++ b/boards/snps/hsdk/doc/index.rst @@ -518,6 +518,8 @@ Release Notes References ********** +.. target-notes:: + .. _embARC website: https://www.embarc.org .. _Designware HS Development Kit website: https://www.synopsys.com/dw/ipdir.php?ds=arc-hs-development-kit diff --git a/boards/snps/hsdk4xd/doc/index.rst b/boards/snps/hsdk4xd/doc/index.rst index 04b30bcaf9b43..96c8ae73370cd 100644 --- a/boards/snps/hsdk4xd/doc/index.rst +++ b/boards/snps/hsdk4xd/doc/index.rst @@ -547,6 +547,8 @@ The following list indicates the state of HS4x/HS4xD Development Kit peripherals References ********** +.. target-notes:: + .. _embARC website: https://www.embarc.org .. _Designware HS Development Kit website: https://www.synopsys.com/dw/ipdir.php?ds=arc-hs-development-kit diff --git a/boards/snps/iotdk/doc/index.rst b/boards/snps/iotdk/doc/index.rst index 5482bed17d938..4b740ce6223e5 100644 --- a/boards/snps/iotdk/doc/index.rst +++ b/boards/snps/iotdk/doc/index.rst @@ -189,6 +189,8 @@ Release Notes References ********** +.. target-notes:: + .. _embARC website: https://www.embarc.org .. _Designware ARC IoT Development Kit website: https://www.synopsys.com/dw/ipdir.php?ds=arc_iot_development_kit diff --git a/boards/snps/nsim/arc_classic/doc/index.rst b/boards/snps/nsim/arc_classic/doc/index.rst index 24a35ac9544d2..5f4dd81f302a0 100644 --- a/boards/snps/nsim/arc_classic/doc/index.rst +++ b/boards/snps/nsim/arc_classic/doc/index.rst @@ -333,6 +333,8 @@ For the MWDT toolchain all hardware-specific compiler options are set directly i References ********** +.. target-notes:: + .. _Designware ARC nSIM: https://www.synopsys.com/dw/ipdir.php?ds=sim_nsim .. _DesignWare ARC Free nSIM: https://www.synopsys.com/cgi-bin/dwarcnsim/req1.cgi .. _HAPS: https://www.synopsys.com/verification/prototyping/haps.html diff --git a/boards/snps/nsim/arc_v/doc/index.rst b/boards/snps/nsim/arc_v/doc/index.rst index 22a0ecc23e9ab..e863124f13767 100644 --- a/boards/snps/nsim/arc_v/doc/index.rst +++ b/boards/snps/nsim/arc_v/doc/index.rst @@ -193,6 +193,8 @@ on SoC level. References ********** +.. target-notes:: + .. _Designware ARC nSIM: https://www.synopsys.com/dw/ipdir.php?ds=sim_nsim .. _DesignWare ARC Free nSIM: https://www.synopsys.com/cgi-bin/dwarcnsim/req1.cgi .. _HAPS: https://www.synopsys.com/verification/prototyping/haps.html diff --git a/boards/ti/cc3235sf_launchxl/doc/index.rst b/boards/ti/cc3235sf_launchxl/doc/index.rst index 69c5bae82f638..edaabf082eac0 100644 --- a/boards/ti/cc3235sf_launchxl/doc/index.rst +++ b/boards/ti/cc3235sf_launchxl/doc/index.rst @@ -266,6 +266,8 @@ using the TI UniFlash tool for certificate programming. References ********** +.. target-notes:: + TI SimpleLink MCUs: http://www.ti.com/microcontrollers/simplelink-mcus/overview.html diff --git a/boards/ti/msp_exp432p401r_launchxl/doc/index.rst b/boards/ti/msp_exp432p401r_launchxl/doc/index.rst index e59942416f989..9baec99f0a998 100644 --- a/boards/ti/msp_exp432p401r_launchxl/doc/index.rst +++ b/boards/ti/msp_exp432p401r_launchxl/doc/index.rst @@ -133,6 +133,8 @@ build target: References ********** +.. target-notes:: + TI MSP432 Wiki: https://en.wikipedia.org/wiki/TI_MSP432 diff --git a/boards/vcc-gnd/yd_esp32/doc/index.rst b/boards/vcc-gnd/yd_esp32/doc/index.rst index 20201b3a347f6..737b606392c49 100644 --- a/boards/vcc-gnd/yd_esp32/doc/index.rst +++ b/boards/vcc-gnd/yd_esp32/doc/index.rst @@ -306,6 +306,8 @@ GDB stub is enabled on ESP32. References ********** +.. target-notes:: + .. _`ESP32-DevKitC-WROVER`: https://docs.espressif.com/projects/esp-idf/en/stable/esp32/hw-reference/esp32/get-started-devkitc.html# .. _`ESP32 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf .. _`ESP32 Technical Reference Manual`: https://espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/doc/index.rst b/boards/waveshare/esp32s3_touch_lcd_1_28/doc/index.rst index b80884a2e961c..d2e7a88be870a 100644 --- a/boards/waveshare/esp32s3_touch_lcd_1_28/doc/index.rst +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/doc/index.rst @@ -122,6 +122,8 @@ It is the default option when building the application without additional config References ********** +.. target-notes:: + .. _ESP32-S3-Touch-LCD-1.28 Waveshare Wiki: https://www.waveshare.com/wiki/ESP32-S3-Touch-LCD-1.28 .. _ESP32-S3 Datasheet: https://www.espressif.com/sites/default/files/documentation/esp32-s3-mini-1_mini-1u_datasheet_en.pdf .. _ESP32-S3 Technical Reference Manual: https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf diff --git a/boards/wemos/esp32s2_lolin_mini/doc/index.rst b/boards/wemos/esp32s2_lolin_mini/doc/index.rst index d09dec2b5f97f..6d4e57dc8fcd7 100644 --- a/boards/wemos/esp32s2_lolin_mini/doc/index.rst +++ b/boards/wemos/esp32s2_lolin_mini/doc/index.rst @@ -91,6 +91,8 @@ message in the monitor: References ********** +.. target-notes:: + .. [1] https://www.espressif.com/en/products/socs/esp32-s2 .. _`ESP32S2 Technical Reference Manual`: https://espressif.com/sites/default/files/documentation/esp32-s2_technical_reference_manual_en.pdf .. _`ESP32S2 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf From fa0b17e4b1bd85fa62655c720ba0878b7f9f5121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 17:32:36 +0200 Subject: [PATCH 1459/4482] doc: samples: add target-notes directive where missing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For the "References" section to be useful, it needs to include a call to the target-notes directive, which is the one that actually generates the list of references made in the current document. Signed-off-by: Benjamin Cabé --- samples/drivers/fpga/fpga_controller/README.rst | 2 ++ samples/drivers/video/capture/README.rst | 2 ++ samples/drivers/video/capture_to_lvgl/README.rst | 2 ++ samples/drivers/video/tcpserversink/README.rst | 2 ++ samples/modules/lvgl/demos/README.rst | 2 ++ samples/sensor/max17262/README.rst | 4 +++- 6 files changed, 13 insertions(+), 1 deletion(-) diff --git a/samples/drivers/fpga/fpga_controller/README.rst b/samples/drivers/fpga/fpga_controller/README.rst index 371cc23a372c6..92f4ea67d663e 100644 --- a/samples/drivers/fpga/fpga_controller/README.rst +++ b/samples/drivers/fpga/fpga_controller/README.rst @@ -117,5 +117,7 @@ Now the bitstream can be uploaded again. References ********** +.. target-notes:: + .. _Quicklogic Quickfeather board: https://github.com/QuickLogic-Corp/quick-feather-dev-board diff --git a/samples/drivers/video/capture/README.rst b/samples/drivers/video/capture/README.rst index 22634811a4ebd..384f37b6035a1 100644 --- a/samples/drivers/video/capture/README.rst +++ b/samples/drivers/video/capture/README.rst @@ -107,6 +107,8 @@ Sample Output References ********** +.. target-notes:: + .. _Camera iMXRT: https://community.nxp.com/t5/i-MX-RT-Knowledge-Base/Connecting-camera-and-LCD-to-i-MX-RT-EVKs/ta-p/1122183 .. _MT9M114 camera module: https://www.onsemi.com/PowerSolutions/product.do?id=MT9M114 .. _OV5640 camera module: https://cdn.sparkfun.com/datasheets/Sensors/LightImaging/OV5640_datasheet.pdf diff --git a/samples/drivers/video/capture_to_lvgl/README.rst b/samples/drivers/video/capture_to_lvgl/README.rst index 1e40764ecae9d..0d8a2a8152a2f 100644 --- a/samples/drivers/video/capture_to_lvgl/README.rst +++ b/samples/drivers/video/capture_to_lvgl/README.rst @@ -70,4 +70,6 @@ Sample Output References ********** +.. target-notes:: + .. _WeAct Studio STM32H743: https://github.com/WeActStudio/MiniSTM32H7xx diff --git a/samples/drivers/video/tcpserversink/README.rst b/samples/drivers/video/tcpserversink/README.rst index ef34061f854ea..6ac32f67c8dbb 100644 --- a/samples/drivers/video/tcpserversink/README.rst +++ b/samples/drivers/video/tcpserversink/README.rst @@ -64,4 +64,6 @@ For video software generator, the default resolution should be width=320 and hei References ********** +.. target-notes:: + .. _MT9M114 camera module: https://www.onsemi.com/PowerSolutions/product.do?id=MT9M114 diff --git a/samples/modules/lvgl/demos/README.rst b/samples/modules/lvgl/demos/README.rst index f835cc3f4a22e..4d5c78cbb8be6 100644 --- a/samples/modules/lvgl/demos/README.rst +++ b/samples/modules/lvgl/demos/README.rst @@ -78,4 +78,6 @@ board argument may also be replaced by ``native_sim/native/64``. References ********** +.. target-notes:: + .. _LVGL demos Readme: https://github.com/zephyrproject-rtos/lvgl/blob/zephyr/demos/README.md diff --git a/samples/sensor/max17262/README.rst b/samples/sensor/max17262/README.rst index cd2ebb5e8a478..27cf5a10ba5f4 100644 --- a/samples/sensor/max17262/README.rst +++ b/samples/sensor/max17262/README.rst @@ -53,6 +53,8 @@ This example uses ``picocom`` on the serial port ``/dev/ttyUSB0``: V: 3.626406 V; I: -3.437500 mA; T: 28.011718 °C References -*********** +********** + +.. target-notes:: .. _max17262 datasheet: https://datasheets.maximintegrated.com/en/ds/MAX17262.pdf From 074c0492ce35a9f02be88252df15421615374318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 17:49:36 +0200 Subject: [PATCH 1460/4482] doc: guidelines: add target-notes instructions and example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit .. target-notes:: is a useful directive that needs to explicitly be included for a "References" section to really be useful. This commit updates the doc guidelines accordingly to help ensure that future docs are using it correctly. Signed-off-by: Benjamin Cabé --- doc/contribute/documentation/guidelines.rst | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/contribute/documentation/guidelines.rst b/doc/contribute/documentation/guidelines.rst index 96dda3660e2e1..7458ca0a33cb7 100644 --- a/doc/contribute/documentation/guidelines.rst +++ b/doc/contribute/documentation/guidelines.rst @@ -655,6 +655,19 @@ you can reference it with:: Read the `Zephyr Wikipedia Page`_ for more information about the project. +.. tip:: + + When a document contains many external links, it can be useful to list them in a single + "References" section at the end of the document. This can be done using the + :rst:dir:`target-notes` directive. Example:: + + References + ========== + + .. target-notes:: + + .. _external_link1: https://example.com + .. _external_link2: https://example.org Cross-referencing C documentation ================================= @@ -684,7 +697,6 @@ Cross-referencing C documentation You may provide a custom link text, similar to the built-in :rst:role:`ref` role. - Visual Elements *************** @@ -1213,3 +1225,9 @@ Boards This directive is used to generate a catalog of Zephyr-supported boards that can be used to quickly browse the list of all supported boards and filter them according to various criteria. + + +References +********** + +.. target-notes:: From a2ecead78a4c12dc561cab91f70ca3829bb2f2cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 16:46:04 +0200 Subject: [PATCH 1461/4482] boards: rakwireless: Use proper vendor prefix as board folder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit hwmv2 established a convention that boards live in a folder named after the vendor prefix. RAK Wireless boards apparently missed the memo :) Signed-off-by: Benjamin Cabé --- boards/{rak => rakwireless}/index.rst | 0 .../{rak => rakwireless}/rak11720/Kconfig.rak11720 | 0 boards/{rak => rakwireless}/rak11720/board.cmake | 0 boards/{rak => rakwireless}/rak11720/board.yml | 0 .../rak11720/doc/img/rak11720.webp | Bin boards/{rak => rakwireless}/rak11720/doc/index.rst | 0 boards/{rak => rakwireless}/rak11720/rak11720.dts | 0 boards/{rak => rakwireless}/rak11720/rak11720.yaml | 0 .../rak11720/rak11720_apollo3-pinctrl.dtsi | 0 .../rak11720/rak11720_defconfig | 0 .../{rak => rakwireless}/rak4631/Kconfig.defconfig | 0 boards/{rak => rakwireless}/rak4631/Kconfig.rak4631 | 0 boards/{rak => rakwireless}/rak4631/board.cmake | 0 boards/{rak => rakwireless}/rak4631/board.yml | 0 .../rak4631/doc/img/rak4631-front-parts.jpg | Bin boards/{rak => rakwireless}/rak4631/doc/index.rst | 0 .../{rak => rakwireless}/rak4631/pre_dt_board.cmake | 0 .../rak4631/rak4631_nrf52840-pinctrl.dtsi | 0 .../rak4631/rak4631_nrf52840.dts | 0 .../rak4631/rak4631_nrf52840.yaml | 0 .../rak4631/rak4631_nrf52840_defconfig | 0 .../{rak => rakwireless}/rak5010/Kconfig.defconfig | 0 boards/{rak => rakwireless}/rak5010/Kconfig.rak5010 | 0 boards/{rak => rakwireless}/rak5010/board.cmake | 0 boards/{rak => rakwireless}/rak5010/board.yml | 0 .../rak5010/doc/img/rak5010-front-parts.jpg | Bin boards/{rak => rakwireless}/rak5010/doc/index.rst | 0 .../{rak => rakwireless}/rak5010/pre_dt_board.cmake | 0 .../rak5010/rak5010_nrf52840-pinctrl.dtsi | 0 .../rak5010/rak5010_nrf52840.dts | 0 .../rak5010/rak5010_nrf52840.yaml | 0 .../rak5010/rak5010_nrf52840_defconfig | 0 doc/_scripts/redirects.py | 4 ++++ 33 files changed, 4 insertions(+) rename boards/{rak => rakwireless}/index.rst (100%) rename boards/{rak => rakwireless}/rak11720/Kconfig.rak11720 (100%) rename boards/{rak => rakwireless}/rak11720/board.cmake (100%) rename boards/{rak => rakwireless}/rak11720/board.yml (100%) rename boards/{rak => rakwireless}/rak11720/doc/img/rak11720.webp (100%) rename boards/{rak => rakwireless}/rak11720/doc/index.rst (100%) rename boards/{rak => rakwireless}/rak11720/rak11720.dts (100%) rename boards/{rak => rakwireless}/rak11720/rak11720.yaml (100%) rename boards/{rak => rakwireless}/rak11720/rak11720_apollo3-pinctrl.dtsi (100%) rename boards/{rak => rakwireless}/rak11720/rak11720_defconfig (100%) rename boards/{rak => rakwireless}/rak4631/Kconfig.defconfig (100%) rename boards/{rak => rakwireless}/rak4631/Kconfig.rak4631 (100%) rename boards/{rak => rakwireless}/rak4631/board.cmake (100%) rename boards/{rak => rakwireless}/rak4631/board.yml (100%) rename boards/{rak => rakwireless}/rak4631/doc/img/rak4631-front-parts.jpg (100%) rename boards/{rak => rakwireless}/rak4631/doc/index.rst (100%) rename boards/{rak => rakwireless}/rak4631/pre_dt_board.cmake (100%) rename boards/{rak => rakwireless}/rak4631/rak4631_nrf52840-pinctrl.dtsi (100%) rename boards/{rak => rakwireless}/rak4631/rak4631_nrf52840.dts (100%) rename boards/{rak => rakwireless}/rak4631/rak4631_nrf52840.yaml (100%) rename boards/{rak => rakwireless}/rak4631/rak4631_nrf52840_defconfig (100%) rename boards/{rak => rakwireless}/rak5010/Kconfig.defconfig (100%) rename boards/{rak => rakwireless}/rak5010/Kconfig.rak5010 (100%) rename boards/{rak => rakwireless}/rak5010/board.cmake (100%) rename boards/{rak => rakwireless}/rak5010/board.yml (100%) rename boards/{rak => rakwireless}/rak5010/doc/img/rak5010-front-parts.jpg (100%) rename boards/{rak => rakwireless}/rak5010/doc/index.rst (100%) rename boards/{rak => rakwireless}/rak5010/pre_dt_board.cmake (100%) rename boards/{rak => rakwireless}/rak5010/rak5010_nrf52840-pinctrl.dtsi (100%) rename boards/{rak => rakwireless}/rak5010/rak5010_nrf52840.dts (100%) rename boards/{rak => rakwireless}/rak5010/rak5010_nrf52840.yaml (100%) rename boards/{rak => rakwireless}/rak5010/rak5010_nrf52840_defconfig (100%) diff --git a/boards/rak/index.rst b/boards/rakwireless/index.rst similarity index 100% rename from boards/rak/index.rst rename to boards/rakwireless/index.rst diff --git a/boards/rak/rak11720/Kconfig.rak11720 b/boards/rakwireless/rak11720/Kconfig.rak11720 similarity index 100% rename from boards/rak/rak11720/Kconfig.rak11720 rename to boards/rakwireless/rak11720/Kconfig.rak11720 diff --git a/boards/rak/rak11720/board.cmake b/boards/rakwireless/rak11720/board.cmake similarity index 100% rename from boards/rak/rak11720/board.cmake rename to boards/rakwireless/rak11720/board.cmake diff --git a/boards/rak/rak11720/board.yml b/boards/rakwireless/rak11720/board.yml similarity index 100% rename from boards/rak/rak11720/board.yml rename to boards/rakwireless/rak11720/board.yml diff --git a/boards/rak/rak11720/doc/img/rak11720.webp b/boards/rakwireless/rak11720/doc/img/rak11720.webp similarity index 100% rename from boards/rak/rak11720/doc/img/rak11720.webp rename to boards/rakwireless/rak11720/doc/img/rak11720.webp diff --git a/boards/rak/rak11720/doc/index.rst b/boards/rakwireless/rak11720/doc/index.rst similarity index 100% rename from boards/rak/rak11720/doc/index.rst rename to boards/rakwireless/rak11720/doc/index.rst diff --git a/boards/rak/rak11720/rak11720.dts b/boards/rakwireless/rak11720/rak11720.dts similarity index 100% rename from boards/rak/rak11720/rak11720.dts rename to boards/rakwireless/rak11720/rak11720.dts diff --git a/boards/rak/rak11720/rak11720.yaml b/boards/rakwireless/rak11720/rak11720.yaml similarity index 100% rename from boards/rak/rak11720/rak11720.yaml rename to boards/rakwireless/rak11720/rak11720.yaml diff --git a/boards/rak/rak11720/rak11720_apollo3-pinctrl.dtsi b/boards/rakwireless/rak11720/rak11720_apollo3-pinctrl.dtsi similarity index 100% rename from boards/rak/rak11720/rak11720_apollo3-pinctrl.dtsi rename to boards/rakwireless/rak11720/rak11720_apollo3-pinctrl.dtsi diff --git a/boards/rak/rak11720/rak11720_defconfig b/boards/rakwireless/rak11720/rak11720_defconfig similarity index 100% rename from boards/rak/rak11720/rak11720_defconfig rename to boards/rakwireless/rak11720/rak11720_defconfig diff --git a/boards/rak/rak4631/Kconfig.defconfig b/boards/rakwireless/rak4631/Kconfig.defconfig similarity index 100% rename from boards/rak/rak4631/Kconfig.defconfig rename to boards/rakwireless/rak4631/Kconfig.defconfig diff --git a/boards/rak/rak4631/Kconfig.rak4631 b/boards/rakwireless/rak4631/Kconfig.rak4631 similarity index 100% rename from boards/rak/rak4631/Kconfig.rak4631 rename to boards/rakwireless/rak4631/Kconfig.rak4631 diff --git a/boards/rak/rak4631/board.cmake b/boards/rakwireless/rak4631/board.cmake similarity index 100% rename from boards/rak/rak4631/board.cmake rename to boards/rakwireless/rak4631/board.cmake diff --git a/boards/rak/rak4631/board.yml b/boards/rakwireless/rak4631/board.yml similarity index 100% rename from boards/rak/rak4631/board.yml rename to boards/rakwireless/rak4631/board.yml diff --git a/boards/rak/rak4631/doc/img/rak4631-front-parts.jpg b/boards/rakwireless/rak4631/doc/img/rak4631-front-parts.jpg similarity index 100% rename from boards/rak/rak4631/doc/img/rak4631-front-parts.jpg rename to boards/rakwireless/rak4631/doc/img/rak4631-front-parts.jpg diff --git a/boards/rak/rak4631/doc/index.rst b/boards/rakwireless/rak4631/doc/index.rst similarity index 100% rename from boards/rak/rak4631/doc/index.rst rename to boards/rakwireless/rak4631/doc/index.rst diff --git a/boards/rak/rak4631/pre_dt_board.cmake b/boards/rakwireless/rak4631/pre_dt_board.cmake similarity index 100% rename from boards/rak/rak4631/pre_dt_board.cmake rename to boards/rakwireless/rak4631/pre_dt_board.cmake diff --git a/boards/rak/rak4631/rak4631_nrf52840-pinctrl.dtsi b/boards/rakwireless/rak4631/rak4631_nrf52840-pinctrl.dtsi similarity index 100% rename from boards/rak/rak4631/rak4631_nrf52840-pinctrl.dtsi rename to boards/rakwireless/rak4631/rak4631_nrf52840-pinctrl.dtsi diff --git a/boards/rak/rak4631/rak4631_nrf52840.dts b/boards/rakwireless/rak4631/rak4631_nrf52840.dts similarity index 100% rename from boards/rak/rak4631/rak4631_nrf52840.dts rename to boards/rakwireless/rak4631/rak4631_nrf52840.dts diff --git a/boards/rak/rak4631/rak4631_nrf52840.yaml b/boards/rakwireless/rak4631/rak4631_nrf52840.yaml similarity index 100% rename from boards/rak/rak4631/rak4631_nrf52840.yaml rename to boards/rakwireless/rak4631/rak4631_nrf52840.yaml diff --git a/boards/rak/rak4631/rak4631_nrf52840_defconfig b/boards/rakwireless/rak4631/rak4631_nrf52840_defconfig similarity index 100% rename from boards/rak/rak4631/rak4631_nrf52840_defconfig rename to boards/rakwireless/rak4631/rak4631_nrf52840_defconfig diff --git a/boards/rak/rak5010/Kconfig.defconfig b/boards/rakwireless/rak5010/Kconfig.defconfig similarity index 100% rename from boards/rak/rak5010/Kconfig.defconfig rename to boards/rakwireless/rak5010/Kconfig.defconfig diff --git a/boards/rak/rak5010/Kconfig.rak5010 b/boards/rakwireless/rak5010/Kconfig.rak5010 similarity index 100% rename from boards/rak/rak5010/Kconfig.rak5010 rename to boards/rakwireless/rak5010/Kconfig.rak5010 diff --git a/boards/rak/rak5010/board.cmake b/boards/rakwireless/rak5010/board.cmake similarity index 100% rename from boards/rak/rak5010/board.cmake rename to boards/rakwireless/rak5010/board.cmake diff --git a/boards/rak/rak5010/board.yml b/boards/rakwireless/rak5010/board.yml similarity index 100% rename from boards/rak/rak5010/board.yml rename to boards/rakwireless/rak5010/board.yml diff --git a/boards/rak/rak5010/doc/img/rak5010-front-parts.jpg b/boards/rakwireless/rak5010/doc/img/rak5010-front-parts.jpg similarity index 100% rename from boards/rak/rak5010/doc/img/rak5010-front-parts.jpg rename to boards/rakwireless/rak5010/doc/img/rak5010-front-parts.jpg diff --git a/boards/rak/rak5010/doc/index.rst b/boards/rakwireless/rak5010/doc/index.rst similarity index 100% rename from boards/rak/rak5010/doc/index.rst rename to boards/rakwireless/rak5010/doc/index.rst diff --git a/boards/rak/rak5010/pre_dt_board.cmake b/boards/rakwireless/rak5010/pre_dt_board.cmake similarity index 100% rename from boards/rak/rak5010/pre_dt_board.cmake rename to boards/rakwireless/rak5010/pre_dt_board.cmake diff --git a/boards/rak/rak5010/rak5010_nrf52840-pinctrl.dtsi b/boards/rakwireless/rak5010/rak5010_nrf52840-pinctrl.dtsi similarity index 100% rename from boards/rak/rak5010/rak5010_nrf52840-pinctrl.dtsi rename to boards/rakwireless/rak5010/rak5010_nrf52840-pinctrl.dtsi diff --git a/boards/rak/rak5010/rak5010_nrf52840.dts b/boards/rakwireless/rak5010/rak5010_nrf52840.dts similarity index 100% rename from boards/rak/rak5010/rak5010_nrf52840.dts rename to boards/rakwireless/rak5010/rak5010_nrf52840.dts diff --git a/boards/rak/rak5010/rak5010_nrf52840.yaml b/boards/rakwireless/rak5010/rak5010_nrf52840.yaml similarity index 100% rename from boards/rak/rak5010/rak5010_nrf52840.yaml rename to boards/rakwireless/rak5010/rak5010_nrf52840.yaml diff --git a/boards/rak/rak5010/rak5010_nrf52840_defconfig b/boards/rakwireless/rak5010/rak5010_nrf52840_defconfig similarity index 100% rename from boards/rak/rak5010/rak5010_nrf52840_defconfig rename to boards/rakwireless/rak5010/rak5010_nrf52840_defconfig diff --git a/doc/_scripts/redirects.py b/doc/_scripts/redirects.py index 27d146c6a3513..0760f20af8976 100644 --- a/doc/_scripts/redirects.py +++ b/doc/_scripts/redirects.py @@ -16,6 +16,10 @@ # zephyr-keep-sorted-start ('application/index', 'develop/application/index'), ('boards/arduino/uno_r4_minima/doc/index', 'boards/arduino/uno_r4/doc/index'), + ('boards/rak/index', 'boards/rakwireless/index'), + ('boards/rak/rak11720/doc/index', 'boards/rakwireless/rak11720/doc/index'), + ('boards/rak/rak4631/doc/index', 'boards/rakwireless/rak4631/doc/index'), + ('boards/rak/rak5010/doc/index', 'boards/rakwireless/rak5010/doc/index'), ('boards/x86/ehl_crb/doc/index', 'boards/x86/intel_ehl/doc/index'), ('boards/x86/intel_ehl/doc/index', 'boards/intel/ehl/doc/index'), ('boards/x86/intel_rpl/doc/index', 'boards/intel/rpl/doc/index'), From e4fa386882269c34cdbaca1ae874de46e2b8aca6 Mon Sep 17 00:00:00 2001 From: Sean Madigan Date: Tue, 15 Oct 2024 16:19:00 +0100 Subject: [PATCH 1462/4482] soc: nordic: nrf53: SOC_NRF53_CPUNET_ENABLE should not depend on !BT The previous changes in https://github.com/zephyrproject-rtos/zephyr/pull/74304 assumed that because this is also handled in `bt_hci_transport_setup` that it shouldn't be done on initialisation too. However, if someone wants to develop their own app which uses BT and also wants to enable the CPUNET by default this KConfig should be available to them. Signed-off-by: Sean Madigan --- soc/nordic/nrf53/Kconfig | 2 -- 1 file changed, 2 deletions(-) diff --git a/soc/nordic/nrf53/Kconfig b/soc/nordic/nrf53/Kconfig index 9fd39b2fb0625..ecf7c112e82f0 100644 --- a/soc/nordic/nrf53/Kconfig +++ b/soc/nordic/nrf53/Kconfig @@ -177,7 +177,6 @@ config SOC_NRF53_CPUNET_MGMT config SOC_NRF53_CPUNET_ENABLE bool "NRF53 Network MCU is enabled at boot time" - depends on !BT default y if NRF_802154_SER_HOST select SOC_NRF53_CPUNET_MGMT help @@ -195,7 +194,6 @@ config BOARD_ENABLE_CPUNET bool "[DEPRECATED] NRF53 Network MCU is enabled at boot time" select SOC_NRF53_CPUNET_ENABLE select DEPRECATED - depends on !BT help Use SOC_NRF53_CPUNET_ENABLE instead. From d172847da58d52caca92866308b47b418c57aa2b Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Mon, 7 Oct 2024 20:58:42 +0200 Subject: [PATCH 1463/4482] drivers: sensor: adi: ltc2990 init trigger measurement This commit triggers measurement during sensor initialization Signed-off-by: Jilay Pandya --- drivers/sensor/adi/adltc2990/adltc2990.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/sensor/adi/adltc2990/adltc2990.c b/drivers/sensor/adi/adltc2990/adltc2990.c index ea56065ede6e0..8dcd1dec66f17 100644 --- a/drivers/sensor/adi/adltc2990/adltc2990.c +++ b/drivers/sensor/adi/adltc2990/adltc2990.c @@ -228,6 +228,7 @@ static int adltc2990_fetch_property_value(const struct device *dev, static int adltc2990_init(const struct device *dev) { const struct adltc2990_config *cfg = dev->config; + int err; if (!i2c_is_ready_dt(&cfg->bus)) { LOG_ERR("I2C bus %s not ready", cfg->bus.bus->name); @@ -238,12 +239,17 @@ static int adltc2990_init(const struct device *dev) cfg->measurement_mode[1] << 3 | cfg->measurement_mode[0]; LOG_DBG("Setting Control Register to: 0x%x", ctrl_reg_setting); - int err = i2c_reg_write_byte_dt(&cfg->bus, ADLTC2990_REG_CONTROL, ctrl_reg_setting); - + err = i2c_reg_write_byte_dt(&cfg->bus, ADLTC2990_REG_CONTROL, ctrl_reg_setting); if (err < 0) { LOG_ERR("configuring for single bus failed: %d", err); return err; } + + err = adltc2990_trigger_measurement(dev); + if (err < 0) { + LOG_ERR("triggering measurement failed: %d", err); + } + LOG_INF("Initializing ADLTC2990 with name %s", dev->name); return 0; } From 3b6555a99219bbad8a61eee76b53be7a727fe7d4 Mon Sep 17 00:00:00 2001 From: Michael Arnold Date: Fri, 23 Aug 2024 13:31:49 +0000 Subject: [PATCH 1464/4482] runners: jlink: Make port selectable for J-Link IP If multiple J-Links with IP support are used, they can be selected with different ports. The actual implementation is just using the default port. Make the port selectable with :. Signed-off-by: Michael Arnold --- scripts/west_commands/runners/jlink.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/west_commands/runners/jlink.py b/scripts/west_commands/runners/jlink.py index 21a510e2721f8..d6d7d472bea67 100644 --- a/scripts/west_commands/runners/jlink.py +++ b/scripts/west_commands/runners/jlink.py @@ -31,7 +31,7 @@ def is_ip(ip): try: - ipaddress.ip_address(ip) + ipaddress.ip_address(ip.split(':')[0]) except ValueError: return False return True From 1a89d4b13e411ebd30b316ae56fb1521962290b7 Mon Sep 17 00:00:00 2001 From: Florian Weber Date: Wed, 23 Oct 2024 13:52:52 +0200 Subject: [PATCH 1465/4482] drivers: sensor: akm09918: make submit function more unblocking The driver now does not wait for the completion of a measurement in the submit function. Instead it schedule the fetch and the completion of the submission queue entry as delayed work to the system work queue. Signed-off-by: Florian Weber --- .../sensor/asahi_kasei/akm09918c/akm09918c.c | 50 ++++++++---- .../sensor/asahi_kasei/akm09918c/akm09918c.h | 15 +++- .../asahi_kasei/akm09918c/akm09918c_async.c | 79 +++++++++++++++---- 3 files changed, 109 insertions(+), 35 deletions(-) diff --git a/drivers/sensor/asahi_kasei/akm09918c/akm09918c.c b/drivers/sensor/asahi_kasei/akm09918c/akm09918c.c index 50664bcdbc5ad..19bb837cc09c9 100644 --- a/drivers/sensor/asahi_kasei/akm09918c/akm09918c.c +++ b/drivers/sensor/asahi_kasei/akm09918c/akm09918c.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2023 Google LLC + * Copyright (c) 2024 Florian Weber * SPDX-License-Identifier: Apache-2.0 */ @@ -21,21 +22,16 @@ LOG_MODULE_REGISTER(AKM09918C, CONFIG_SENSOR_LOG_LEVEL); /** - * @brief Perform the bus transaction to fetch samples + * @brief Perform the bus transaction to start measurement. * * @param dev Sensor device to operate on - * @param chan Channel ID to fetch - * @param x Location to write X channel sample. - * @param y Location to write Y channel sample. - * @param z Location to write Z channel sample. + * @param chan Channel ID for starting the measurement * @return int 0 if successful or error code */ -int akm09918c_sample_fetch_helper(const struct device *dev, enum sensor_channel chan, int16_t *x, - int16_t *y, int16_t *z) +int akm09918c_start_measurement(const struct device *dev, enum sensor_channel chan) { struct akm09918c_data *data = dev->data; const struct akm09918c_config *cfg = dev->config; - uint8_t buf[9] = {0}; if (chan != SENSOR_CHAN_ALL && chan != SENSOR_CHAN_MAGN_X && chan != SENSOR_CHAN_MAGN_Y && chan != SENSOR_CHAN_MAGN_Z && chan != SENSOR_CHAN_MAGN_XYZ) { @@ -49,11 +45,24 @@ int akm09918c_sample_fetch_helper(const struct device *dev, enum sensor_channel LOG_ERR("Failed to start measurement."); return -EIO; } - - /* Wait for sample */ - LOG_DBG("Waiting for sample..."); - k_usleep(AKM09918C_MEASURE_TIME_US); } + return 0; +} + +/** + * @brief Perform the bus transaction to fetch samples. + * + * @param dev Sensor device to operate on + * @param chan Channel ID to fetch + * @param x Location to write X channel sample. + * @param y Location to write Y channel sample. + * @param z Location to write Z channel sample. + * @return int 0 if successful or error code + */ +int akm09918c_fetch_measurement(const struct device *dev, int16_t *x, int16_t *y, int16_t *z) +{ + const struct akm09918c_config *cfg = dev->config; + uint8_t buf[9] = {0}; /* We have to read through the TMPS register or the data_ready bit won't clear */ if (i2c_burst_read_dt(&cfg->i2c, AKM09918C_REG_ST1, buf, ARRAY_SIZE(buf)) != 0) { @@ -77,8 +86,16 @@ static int akm09918c_sample_fetch(const struct device *dev, enum sensor_channel { struct akm09918c_data *data = dev->data; - return akm09918c_sample_fetch_helper(dev, chan, &data->x_sample, &data->y_sample, - &data->z_sample); + int ret = akm09918c_start_measurement(dev, chan); + + if (ret) { + return ret; + } + /* Wait for sample */ + LOG_DBG("Waiting for sample..."); + k_usleep(AKM09918C_MEASURE_TIME_US); + + return akm09918c_fetch_measurement(dev, &data->x_sample, &data->y_sample, &data->z_sample); } static void akm09918c_convert(struct sensor_value *val, int16_t sample) @@ -213,7 +230,10 @@ static int akm09918c_init(const struct device *dev) return rc; } data->mode = AKM09918C_CNTL2_PWR_DOWN; - +#ifdef CONFIG_SENSOR_ASYNC_API + /* init work for fetching after measurement has completed */ + k_work_init_delayable(&data->work_ctx.async_fetch_work, akm09918_async_fetch); +#endif return 0; } diff --git a/drivers/sensor/asahi_kasei/akm09918c/akm09918c.h b/drivers/sensor/asahi_kasei/akm09918c/akm09918c.h index a4b35c64dd838..f8a4f5c7c4395 100644 --- a/drivers/sensor/asahi_kasei/akm09918c/akm09918c.h +++ b/drivers/sensor/asahi_kasei/akm09918c/akm09918c.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2023 Google LLC + * Copyright (c) 2024 Florian Weber * SPDX-License-Identifier: Apache-2.0 */ @@ -34,6 +35,13 @@ struct akm09918c_data { int16_t y_sample; int16_t z_sample; uint8_t mode; +#ifdef CONFIG_SENSOR_ASYNC_API + struct akm09918c_async_fetch_ctx { + struct rtio_iodev_sqe *iodev_sqe; + uint64_t timestamp; + struct k_work_delayable async_fetch_work; + } work_ctx; +#endif }; struct akm09918c_config { @@ -74,22 +82,23 @@ static inline void akm09918c_reg_to_hz(uint8_t reg, struct sensor_value *val) break; } } +int akm09918c_start_measurement(const struct device *dev, enum sensor_channel chan); +int akm09918c_fetch_measurement(const struct device *dev, int16_t *x, int16_t *y, int16_t *z); /* * RTIO types */ struct akm09918c_decoder_header { uint64_t timestamp; -} __attribute__((__packed__)); +} __packed; struct akm09918c_encoded_data { struct akm09918c_decoder_header header; int16_t readings[3]; }; -int akm09918c_sample_fetch_helper(const struct device *dev, enum sensor_channel chan, int16_t *x, - int16_t *y, int16_t *z); +void akm09918_async_fetch(struct k_work *work); int akm09918c_get_decoder(const struct device *dev, const struct sensor_decoder_api **decoder); diff --git a/drivers/sensor/asahi_kasei/akm09918c/akm09918c_async.c b/drivers/sensor/asahi_kasei/akm09918c/akm09918c_async.c index e8ad6beca42ce..832d046bdd7ab 100644 --- a/drivers/sensor/asahi_kasei/akm09918c/akm09918c_async.c +++ b/drivers/sensor/asahi_kasei/akm09918c/akm09918c_async.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2023 Google LLC * Copyright (c) 2024 Croxel Inc. + * Copyright (c) 2024 Florian Weber * * SPDX-License-Identifier: Apache-2.0 */ @@ -16,32 +17,46 @@ void akm09918c_submit_sync(struct rtio_iodev_sqe *iodev_sqe) { const struct sensor_read_config *cfg = iodev_sqe->sqe.iodev->data; const struct device *dev = cfg->sensor; - uint32_t min_buf_len = sizeof(struct akm09918c_encoded_data); + struct akm09918c_data *data = dev->data; + const struct sensor_chan_spec *const channels = cfg->channels; + const size_t num_channels = cfg->count; int rc; - uint8_t *buf; - uint32_t buf_len; - struct akm09918c_encoded_data *edata; - /* Get the buffer for the frame, it may be allocated dynamically by the rtio context */ - rc = rtio_sqe_rx_buf(iodev_sqe, min_buf_len, min_buf_len, &buf, &buf_len); - if (rc != 0) { - LOG_ERR("Failed to get a read buffer of size %u bytes", min_buf_len); - rtio_iodev_sqe_err(iodev_sqe, rc); - return; + /* Check if the requested channels are supported */ + for (size_t i = 0; i < num_channels; i++) { + switch (channels[i].chan_type) { + case SENSOR_CHAN_MAGN_X: + case SENSOR_CHAN_MAGN_Y: + case SENSOR_CHAN_MAGN_Z: + case SENSOR_CHAN_MAGN_XYZ: + case SENSOR_CHAN_ALL: + break; + default: + LOG_ERR("Unsupported channel type %d", channels[i].chan_type); + rtio_iodev_sqe_err(iodev_sqe, -ENOTSUP); + return; + } } - edata = (struct akm09918c_encoded_data *)buf; - edata->header.timestamp = k_ticks_to_ns_floor64(k_uptime_ticks()); - - rc = akm09918c_sample_fetch_helper(dev, SENSOR_CHAN_MAGN_XYZ, &edata->readings[0], - &edata->readings[1], &edata->readings[2]); + /* start the measurement in the sensor */ + rc = akm09918c_start_measurement(dev, SENSOR_CHAN_MAGN_XYZ); if (rc != 0) { - LOG_ERR("Failed to fetch samples"); + LOG_ERR("Failed to fetch samples."); rtio_iodev_sqe_err(iodev_sqe, rc); return; } - rtio_iodev_sqe_ok(iodev_sqe, 0); + /* save information for the work item */ + data->work_ctx.timestamp = k_ticks_to_ns_floor64(k_uptime_ticks()); + data->work_ctx.iodev_sqe = iodev_sqe; + + rc = k_work_schedule(&data->work_ctx.async_fetch_work, K_USEC(AKM09918C_MEASURE_TIME_US)); + if (rc == 0) { + LOG_ERR("The last fetch has not finished yet. " + "Try again later when the last sensor read operation has finished."); + rtio_iodev_sqe_err(iodev_sqe, -EBUSY); + } + return; } void akm09918c_submit(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe) @@ -57,3 +72,33 @@ void akm09918c_submit(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe rtio_work_req_submit(req, iodev_sqe, akm09918c_submit_sync); } + +void akm09918_async_fetch(struct k_work *work) +{ + struct k_work_delayable *dwork = k_work_delayable_from_work(work); + struct akm09918c_async_fetch_ctx *ctx = + CONTAINER_OF(dwork, struct akm09918c_async_fetch_ctx, async_fetch_work); + const struct sensor_read_config *cfg = ctx->iodev_sqe->sqe.iodev->data; + const struct device *dev = cfg->sensor; + uint32_t req_buf_len = sizeof(struct akm09918c_encoded_data); + uint32_t buf_len; + uint8_t *buf; + struct akm09918c_encoded_data *edata; + int rc; + + /* Get the buffer for the frame, it may be allocated dynamically by the rtio context */ + rc = rtio_sqe_rx_buf(ctx->iodev_sqe, req_buf_len, req_buf_len, &buf, &buf_len); + if (rc != 0) { + LOG_ERR("Failed to get a read buffer of size %u bytes", req_buf_len); + rtio_iodev_sqe_err(ctx->iodev_sqe, rc); + return; + } + edata = (struct akm09918c_encoded_data *)buf; + rc = akm09918c_fetch_measurement(dev, &edata->readings[0], &edata->readings[1], + &edata->readings[2]); + if (rc != 0) { + rtio_iodev_sqe_err(ctx->iodev_sqe, rc); + return; + } + rtio_iodev_sqe_ok(ctx->iodev_sqe, 0); +} From cbaafe209c17f03feea3760be855dc76ef5612cc Mon Sep 17 00:00:00 2001 From: Dominik Kilian Date: Wed, 23 Oct 2024 14:23:00 +0200 Subject: [PATCH 1466/4482] boards: nordic: ipc: added dcache alignement The nRF54 and nRF92 chips has data cache, which means the ICMsg and ICBMsg must be configured to follow required cache alignment of the shared memory. The `dcache-alignement` needs to be defined for that. Signed-off-by: Dominik Kilian --- .../nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi | 1 + .../nordic/nrf9280pdk/nrf9280pdk_nrf9280-ipc_conf.dtsi | 1 + .../ipc/ipc_service/backends/ipc_service_icbmsg.rst | 10 ++++++++++ .../ipc/ipc_service/backends/ipc_service_icmsg.rst | 10 ++++++++++ dts/bindings/ipc/zephyr,ipc-icmsg.yaml | 2 +- .../icmsg/boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 1 + .../boards/nrf54l15dk_nrf54l15_cpuapp_icbmsg.overlay | 1 + .../remote/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay | 1 + .../boards/nrf54l15dk_nrf54l15_cpuflpr_icbmsg.overlay | 1 + subsys/ipc/ipc_service/backends/ipc_icbmsg.c | 4 ++-- 10 files changed, 29 insertions(+), 3 deletions(-) diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi index 0b866a889f62f..94cda5e8ee2e8 100644 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-ipc_conf.dtsi @@ -24,6 +24,7 @@ cpuapp_cpurad_ipc: ipc-2-3 { compatible = "zephyr,ipc-icbmsg"; + dcache-alignment = <32>; status = "disabled"; mboxes = <&cpuapp_bellboard 18>, <&cpurad_bellboard 12>; diff --git a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-ipc_conf.dtsi b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-ipc_conf.dtsi index f3a05ee5a05b3..0588e8d080183 100644 --- a/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-ipc_conf.dtsi +++ b/boards/nordic/nrf9280pdk/nrf9280pdk_nrf9280-ipc_conf.dtsi @@ -24,6 +24,7 @@ cpuapp_cpurad_ipc: ipc-2-3 { compatible = "zephyr,ipc-icbmsg"; + dcache-alignment = <32>; status = "disabled"; mboxes = <&cpuapp_bellboard 18>, <&cpurad_bellboard 12>; diff --git a/doc/services/ipc/ipc_service/backends/ipc_service_icbmsg.rst b/doc/services/ipc/ipc_service/backends/ipc_service_icbmsg.rst index f570766b0bd75..b1f13d7566a87 100644 --- a/doc/services/ipc/ipc_service/backends/ipc_service_icbmsg.rst +++ b/doc/services/ipc/ipc_service/backends/ipc_service_icbmsg.rst @@ -40,12 +40,21 @@ Configuration The backend is configured using Kconfig and devicetree. When configuring the backend, do the following: +* If at least one of the cores uses data cache on shared memory, set the ``dcache-alignment`` value. + This must be the largest value of the invalidation or the write-back size for both sides of the communication. + You can skip it if none of the communication sides is using data cache on shared memory. * Define two memory regions and assign them to ``tx-region`` and ``rx-region`` of an instance. Ensure that the memory regions used for data exchange are unique (not overlapping any other region) and accessible by both domains (or CPUs). * Define the number of allocable blocks for each region with ``tx-blocks`` and ``rx-blocks``. * Define MBOX devices for sending a signal that informs the other domain (or CPU) of the written data. Ensure that the other domain (or CPU) can receive the signal. +.. caution:: + + Make sure that you set correct value of the ``dcache-alignment``. + At first, wrong value may not show any signs, which may give a false impression that everything works. + Unstable behavior will appear sooner or later. + See the following configuration example for one of the instances: .. code-block:: devicetree @@ -63,6 +72,7 @@ See the following configuration example for one of the instances: ipc { ipc0: ipc0 { compatible = "zephyr,ipc-icbmsg"; + dcache-alignment = <32>; tx-region = <&tx>; rx-region = <&rx>; tx-blocks = <16>; diff --git a/doc/services/ipc/ipc_service/backends/ipc_service_icmsg.rst b/doc/services/ipc/ipc_service/backends/ipc_service_icmsg.rst index 56f618b442df9..251a332027a44 100644 --- a/doc/services/ipc/ipc_service/backends/ipc_service_icmsg.rst +++ b/doc/services/ipc/ipc_service/backends/ipc_service_icmsg.rst @@ -24,6 +24,9 @@ Configuration The backend is configured via Kconfig and devicetree. When configuring the backend, do the following: +* If at least one of the cores uses data cache on shared memory, set the ``dcache-alignment`` value. + This must be the largest value of the invalidation or the write-back size for both sides of the communication. + You can skip it if none of the communication sides is using data cache on shared memory. * Define two memory regions and assign them to ``tx-region`` and ``rx-region`` of an instance. Ensure that the memory regions used for data exchange are unique (not overlapping any other region) and accessible by both domains @@ -32,6 +35,12 @@ When configuring the backend, do the following: domain (or CPU) that data has been written. Ensure that the other domain (or CPU) is able to receive the signal. +.. caution:: + + Make sure that you set correct value of the ``dcache-alignment``. + At first, wrong value may not show any signs, which may give a false impression that everything works. + Unstable behavior will appear sooner or later. + See the following configuration example for one of the instances: .. code-block:: devicetree @@ -49,6 +58,7 @@ See the following configuration example for one of the instances: ipc { ipc0: ipc0 { compatible = "zephyr,ipc-icmsg"; + dcache-alignment = <32>; tx-region = <&tx>; rx-region = <&rx>; mboxes = <&mbox 0>, <&mbox 1>; diff --git a/dts/bindings/ipc/zephyr,ipc-icmsg.yaml b/dts/bindings/ipc/zephyr,ipc-icmsg.yaml index 417930053734d..13a9e2b84b69c 100644 --- a/dts/bindings/ipc/zephyr,ipc-icmsg.yaml +++ b/dts/bindings/ipc/zephyr,ipc-icmsg.yaml @@ -32,7 +32,7 @@ properties: For example: Side A: no data cache Side B: 32 Bytes write-back size, 16 Bytes invalidation size - dcache-alignment = 32; for both + dcache-alignment = <32>; for both mboxes: description: phandle to the MBOX controller (TX and RX are required) diff --git a/samples/subsys/ipc/ipc_service/icmsg/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/samples/subsys/ipc/ipc_service/icmsg/boards/nrf54l15dk_nrf54l15_cpuapp.overlay index b6f20acc42ac6..56b3ae097d81a 100644 --- a/samples/subsys/ipc/ipc_service/icmsg/boards/nrf54l15dk_nrf54l15_cpuapp.overlay +++ b/samples/subsys/ipc/ipc_service/icmsg/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -23,6 +23,7 @@ ipc { ipc0: ipc0 { compatible = "zephyr,ipc-icmsg"; + dcache-alignment = <32>; tx-region = <&sram_tx>; rx-region = <&sram_rx>; mboxes = <&cpuapp_vevif_rx 20>, <&cpuapp_vevif_tx 21>; diff --git a/samples/subsys/ipc/ipc_service/icmsg/boards/nrf54l15dk_nrf54l15_cpuapp_icbmsg.overlay b/samples/subsys/ipc/ipc_service/icmsg/boards/nrf54l15dk_nrf54l15_cpuapp_icbmsg.overlay index a3f853c6e3d5d..639ad5e844b40 100644 --- a/samples/subsys/ipc/ipc_service/icmsg/boards/nrf54l15dk_nrf54l15_cpuapp_icbmsg.overlay +++ b/samples/subsys/ipc/ipc_service/icmsg/boards/nrf54l15dk_nrf54l15_cpuapp_icbmsg.overlay @@ -23,6 +23,7 @@ ipc { ipc0: ipc0 { compatible = "zephyr,ipc-icbmsg"; + dcache-alignment = <32>; tx-region = <&sram_tx>; rx-region = <&sram_rx>; tx-blocks = <16>; diff --git a/samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay b/samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay index c6e59f2b1312e..b3e86e96361cb 100644 --- a/samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay +++ b/samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15dk_nrf54l15_cpuflpr.overlay @@ -23,6 +23,7 @@ ipc { ipc0: ipc0 { compatible = "zephyr,ipc-icmsg"; + dcache-alignment = <32>; tx-region = <&sram_tx>; rx-region = <&sram_rx>; mboxes = <&cpuflpr_vevif_rx 21>, <&cpuflpr_vevif_tx 20>; diff --git a/samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15dk_nrf54l15_cpuflpr_icbmsg.overlay b/samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15dk_nrf54l15_cpuflpr_icbmsg.overlay index 0033e62210739..7fe78a716539a 100644 --- a/samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15dk_nrf54l15_cpuflpr_icbmsg.overlay +++ b/samples/subsys/ipc/ipc_service/icmsg/remote/boards/nrf54l15dk_nrf54l15_cpuflpr_icbmsg.overlay @@ -23,6 +23,7 @@ ipc { ipc0: ipc0 { compatible = "zephyr,ipc-icbmsg"; + dcache-alignment = <32>; tx-region = <&sram_tx>; rx-region = <&sram_rx>; tx-blocks = <18>; diff --git a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c index 9fd7752999f80..927950dd50aa1 100644 --- a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c +++ b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c @@ -1434,11 +1434,11 @@ const static struct ipc_service_backend backend_ops = { }; \ BUILD_ASSERT(IS_POWER_OF_TWO(GET_CACHE_ALIGNMENT(i)), \ "This module supports only power of two cache alignment"); \ - BUILD_ASSERT((GET_BLOCK_SIZE_INST(i, tx, rx) > GET_CACHE_ALIGNMENT(i)) && \ + BUILD_ASSERT((GET_BLOCK_SIZE_INST(i, tx, rx) >= GET_CACHE_ALIGNMENT(i)) && \ (GET_BLOCK_SIZE_INST(i, tx, rx) < \ GET_MEM_SIZE_INST(i, tx)), \ "TX region is too small for provided number of blocks"); \ - BUILD_ASSERT((GET_BLOCK_SIZE_INST(i, rx, tx) > GET_CACHE_ALIGNMENT(i)) && \ + BUILD_ASSERT((GET_BLOCK_SIZE_INST(i, rx, tx) >= GET_CACHE_ALIGNMENT(i)) && \ (GET_BLOCK_SIZE_INST(i, rx, tx) < \ GET_MEM_SIZE_INST(i, rx)), \ "RX region is too small for provided number of blocks"); \ From 0d2f23f2510239bf75492012387d1ff3705aa35a Mon Sep 17 00:00:00 2001 From: Gang Li Date: Tue, 22 Oct 2024 11:01:50 +0900 Subject: [PATCH 1467/4482] net: wifi: Fix the ap config command using the sta interface The "wifi ap config" command uses the station interface via net_if_get_first_wifi(), and should use the ap interface. Signed-off-by: Gang Li --- subsys/net/l2/wifi/wifi_shell.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index d422abb5024c5..75fec48b0bd1f 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1694,7 +1694,11 @@ static int wifi_ap_config_args_to_params(const struct shell *sh, size_t argc, ch static int cmd_wifi_ap_config_params(const struct shell *sh, size_t argc, char *argv[]) { +#ifdef CONFIG_WIFI_NM_HOSTAPD_AP + struct net_if *iface = net_if_get_wifi_sap(); +#else struct net_if *iface = net_if_get_first_wifi(); +#endif struct wifi_ap_config_params ap_config_params = { 0 }; int ret = -1; From 1b0840e91000db6e08d8bedb02ee3c8d73906bf1 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 23 Oct 2024 15:23:14 +0200 Subject: [PATCH 1468/4482] drivers: pwm: nrf_sw: always default to yes There's no need to add conditions to CONFIG_PWM_NRF_SW, because it is already conditioned to DT status. Right now, if any system uses both normal PWM and "SW PWM", it needs to manually enable the driver Kconfig. Signed-off-by: Gerard Marull-Paretas --- drivers/pwm/Kconfig.nrf_sw | 2 +- samples/bluetooth/mesh_demo/boards/bbc_microbit.conf | 1 - samples/boards/bbc/microbit/pong/prj.conf | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pwm/Kconfig.nrf_sw b/drivers/pwm/Kconfig.nrf_sw index 1d68993db5a84..7fc492c56f58e 100644 --- a/drivers/pwm/Kconfig.nrf_sw +++ b/drivers/pwm/Kconfig.nrf_sw @@ -5,7 +5,7 @@ config PWM_NRF_SW bool "Nordic Semiconductor nRF family S/W PWM" - default y if !PWM_NRFX + default y depends on DT_HAS_NORDIC_NRF_SW_PWM_ENABLED select NRFX_GPIOTE select NRFX_PPI if HAS_HW_NRF_PPI diff --git a/samples/bluetooth/mesh_demo/boards/bbc_microbit.conf b/samples/bluetooth/mesh_demo/boards/bbc_microbit.conf index 64adc46579455..4874ce5676064 100644 --- a/samples/bluetooth/mesh_demo/boards/bbc_microbit.conf +++ b/samples/bluetooth/mesh_demo/boards/bbc_microbit.conf @@ -5,7 +5,6 @@ CONFIG_GPIO=y CONFIG_DISPLAY=y CONFIG_MICROBIT_DISPLAY=y CONFIG_PWM=y -CONFIG_PWM_NRF_SW=y CONFIG_BT_RX_STACK_SIZE=1280 CONFIG_BT_CTLR_DUP_FILTER_LEN=0 diff --git a/samples/boards/bbc/microbit/pong/prj.conf b/samples/boards/bbc/microbit/pong/prj.conf index dfd56a675865c..9fa74785b71d2 100644 --- a/samples/boards/bbc/microbit/pong/prj.conf +++ b/samples/boards/bbc/microbit/pong/prj.conf @@ -8,7 +8,6 @@ CONFIG_GPIO=y CONFIG_DISPLAY=y CONFIG_MICROBIT_DISPLAY=y CONFIG_PWM=y -CONFIG_PWM_NRF_SW=y # This feature isn't needed as this sample is intended to be used # between zephyr devices only. From 7609a17dc3f0b14b092f67971715632ec9f59a32 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 23 Oct 2024 19:40:45 +0100 Subject: [PATCH 1469/4482] mgmt: mcumgr: grp: zephyr_basic: Add missing FLASH_MAP dependency Adds a missing dependency, this command requires it to erase the storage area Signed-off-by: Jamie McCrae --- subsys/mgmt/mcumgr/grp/zephyr_basic/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/mgmt/mcumgr/grp/zephyr_basic/Kconfig b/subsys/mgmt/mcumgr/grp/zephyr_basic/Kconfig index 94fa6c42d13b3..77f85deb75c5c 100644 --- a/subsys/mgmt/mcumgr/grp/zephyr_basic/Kconfig +++ b/subsys/mgmt/mcumgr/grp/zephyr_basic/Kconfig @@ -10,6 +10,7 @@ if MCUMGR_GRP_ZBASIC config MCUMGR_GRP_ZBASIC_STORAGE_ERASE bool "Storage erase command" + depends on FLASH_MAP help Enables command that allows to erase storage partition. From a30270668d4b90bac932794ef75df12a2b6f6f78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Wed, 23 Oct 2024 18:22:20 +0200 Subject: [PATCH 1470/4482] dts: bindings: vendor-prefixes: fix UP Bridge the Gap typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit s/brige/bridge/ Signed-off-by: Benjamin Cabé --- dts/bindings/vendor-prefixes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dts/bindings/vendor-prefixes.txt b/dts/bindings/vendor-prefixes.txt index 466ea9e3f3ce8..5ad47d5969b67 100644 --- a/dts/bindings/vendor-prefixes.txt +++ b/dts/bindings/vendor-prefixes.txt @@ -695,7 +695,7 @@ udoo Udoo ugoos Ugoos Industrial Co., Ltd. ultrachip UltraChip Inc. uniwest United Western Technologies Corp (UniWest) -up-brige-the-gap UP Bridge the Gap +up-bridge-the-gap UP Bridge the Gap upisemi uPI Semiconductor Corp. urt United Radiant Technology Corporation usi Universal Scientific Industrial Co., Ltd. From bd9cba897b7f3dad3e796c95981e6b5a96297f1c Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Wed, 23 Oct 2024 14:28:56 -0500 Subject: [PATCH 1471/4482] dts: nxp: rw6xx: Add sctimer node Add node for sctimer to RW SOC DTS Signed-off-by: Declan Snyder --- dts/arm/nxp/nxp_rw6xx_common.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dts/arm/nxp/nxp_rw6xx_common.dtsi b/dts/arm/nxp/nxp_rw6xx_common.dtsi index 3c33a37c2d90c..b0e1e3781ac7d 100644 --- a/dts/arm/nxp/nxp_rw6xx_common.dtsi +++ b/dts/arm/nxp/nxp_rw6xx_common.dtsi @@ -363,6 +363,16 @@ prescale = <0>; }; + sctimer: pwm@146000 { + compatible = "nxp,sctimer-pwm"; + reg = <0x146000 0x1000>; + interrupts = <12 0>; + clocks = <&clkctl1 MCUX_SCTIMER_CLK>; + status = "disabled"; + prescaler = <8>; + #pwm-cells = <3>; + }; + mrt0: mrt@2d000 { compatible = "nxp,mrt"; reg = <0x2d000 0x100>; From 8c9d7b624c006220eea8aed0505c916616924546 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Wed, 23 Oct 2024 14:29:22 -0500 Subject: [PATCH 1472/4482] boards: nxp: rw: Enable sctimer Enable sctimer on RW612 boards Signed-off-by: Declan Snyder --- boards/nxp/frdm_rw612/doc/index.rst | 2 ++ boards/nxp/frdm_rw612/frdm_rw612-pinctrl.dtsi | 7 +++++++ boards/nxp/frdm_rw612/frdm_rw612.dts | 7 +++++++ boards/nxp/frdm_rw612/frdm_rw612.yaml | 1 + boards/nxp/rd_rw612_bga/doc/index.rst | 2 ++ boards/nxp/rd_rw612_bga/rd_rw612_bga-pinctrl.dtsi | 7 +++++++ boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi | 7 +++++++ boards/nxp/rd_rw612_bga/rd_rw612_bga.yaml | 1 + 8 files changed, 34 insertions(+) diff --git a/boards/nxp/frdm_rw612/doc/index.rst b/boards/nxp/frdm_rw612/doc/index.rst index 92d94ca03fcc6..76bec1d343487 100644 --- a/boards/nxp/frdm_rw612/doc/index.rst +++ b/boards/nxp/frdm_rw612/doc/index.rst @@ -55,6 +55,8 @@ Supported Features +-----------+------------+-----------------------------------+ | CTIMER | on-chip | counter | +-----------+------------+-----------------------------------+ +| SCTIMER | on-chip | pwm | ++-----------+------------+-----------------------------------+ | MRT | on-chip | counter | +-----------+------------+-----------------------------------+ | OS_TIMER | on-chip | os timer | diff --git a/boards/nxp/frdm_rw612/frdm_rw612-pinctrl.dtsi b/boards/nxp/frdm_rw612/frdm_rw612-pinctrl.dtsi index 80a6caa12ed20..12ecaa90f404b 100644 --- a/boards/nxp/frdm_rw612/frdm_rw612-pinctrl.dtsi +++ b/boards/nxp/frdm_rw612/frdm_rw612-pinctrl.dtsi @@ -53,4 +53,11 @@ slew-rate = "ultra"; }; }; + + pinmux_pwm0: pinmux_pwm0 { + group0 { + pinmux = ; + slew-rate = "normal"; + }; + }; }; diff --git a/boards/nxp/frdm_rw612/frdm_rw612.dts b/boards/nxp/frdm_rw612/frdm_rw612.dts index e3868f95f77e4..5b5d3d998e093 100644 --- a/boards/nxp/frdm_rw612/frdm_rw612.dts +++ b/boards/nxp/frdm_rw612/frdm_rw612.dts @@ -17,6 +17,7 @@ watchdog0 = &wwdt; usart-0 = &flexcomm3; i2c-0 = &flexcomm2; + pwm-0 = &sctimer; }; chosen { @@ -162,6 +163,12 @@ status = "okay"; }; +&sctimer { + status = "okay"; + pinctrl-0 = <&pinmux_pwm0>; + pinctrl-names = "default"; +}; + zephyr_udc0: &usb_otg { status = "okay"; }; diff --git a/boards/nxp/frdm_rw612/frdm_rw612.yaml b/boards/nxp/frdm_rw612/frdm_rw612.yaml index c6a4ca9e36e1d..0ad00472dc293 100644 --- a/boards/nxp/frdm_rw612/frdm_rw612.yaml +++ b/boards/nxp/frdm_rw612/frdm_rw612.yaml @@ -23,6 +23,7 @@ supported: - usb_device - watchdog - counter + - pwm - hwinfo - adc - dac diff --git a/boards/nxp/rd_rw612_bga/doc/index.rst b/boards/nxp/rd_rw612_bga/doc/index.rst index 2a1b8ac6a20b3..ed565bfec75c6 100644 --- a/boards/nxp/rd_rw612_bga/doc/index.rst +++ b/boards/nxp/rd_rw612_bga/doc/index.rst @@ -59,6 +59,8 @@ Supported Features +-----------+------------+-----------------------------------+ | CTIMER | on-chip | counter | +-----------+------------+-----------------------------------+ +| SCTIMER | on-chip | pwm | ++-----------+------------+-----------------------------------+ | MRT | on-chip | counter | +-----------+------------+-----------------------------------+ | OS_TIMER | on-chip | os timer | diff --git a/boards/nxp/rd_rw612_bga/rd_rw612_bga-pinctrl.dtsi b/boards/nxp/rd_rw612_bga/rd_rw612_bga-pinctrl.dtsi index 78193e6b5122a..a82b286091a95 100644 --- a/boards/nxp/rd_rw612_bga/rd_rw612_bga-pinctrl.dtsi +++ b/boards/nxp/rd_rw612_bga/rd_rw612_bga-pinctrl.dtsi @@ -112,4 +112,11 @@ slew-rate = "fast"; }; }; + + pinmux_pwm0: pinmux_pwm0 { + group0 { + pinmux = ; + slew-rate = "normal"; + }; + }; }; diff --git a/boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi b/boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi index f33f112c50329..21e7a1387d5ce 100644 --- a/boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi +++ b/boards/nxp/rd_rw612_bga/rd_rw612_bga.dtsi @@ -19,6 +19,7 @@ watchdog0 = &wwdt; dmic-dev = &dmic0; mcuboot-button0 = &sw_4; + pwm-0 = &sctimer; }; chosen { @@ -263,6 +264,12 @@ nxp_8080_touch_panel_i2c: &arduino_i2c { status = "okay"; }; +&sctimer { + status = "okay"; + pinctrl-0 = <&pinmux_pwm0>; + pinctrl-names = "default"; +}; + &pmu { reset-causes-en = , , diff --git a/boards/nxp/rd_rw612_bga/rd_rw612_bga.yaml b/boards/nxp/rd_rw612_bga/rd_rw612_bga.yaml index 919f10479ee43..fd7cb2a535e85 100644 --- a/boards/nxp/rd_rw612_bga/rd_rw612_bga.yaml +++ b/boards/nxp/rd_rw612_bga/rd_rw612_bga.yaml @@ -24,6 +24,7 @@ supported: - usb_device - watchdog - counter + - pwm - hwinfo - adc - dac From c597523515f62cf50e5cb2a9ca002bc172bd21c6 Mon Sep 17 00:00:00 2001 From: Neil Chen Date: Wed, 23 Oct 2024 16:37:53 +0800 Subject: [PATCH 1473/4482] dts: arm/nxp: Add flexio nodes to NXP MCXN23x dtsi file Add flexio nodes to NXP MCXN23x dtsi file Signed-off-by: Neil Chen --- dts/arm/nxp/nxp_mcxn23x_common.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dts/arm/nxp/nxp_mcxn23x_common.dtsi b/dts/arm/nxp/nxp_mcxn23x_common.dtsi index 7a8c9ff34b126..5431542a9f2b8 100644 --- a/dts/arm/nxp/nxp_mcxn23x_common.dtsi +++ b/dts/arm/nxp/nxp_mcxn23x_common.dtsi @@ -757,6 +757,18 @@ clk-source = <0>; status = "disabled"; }; + + flexio0: flexio@105000 { + compatible = "nxp,flexio"; + reg = <0x105000 0x1000>; + status = "disabled"; + interrupts = <105 0>; + clocks = <&syscon MCUX_FLEXIO0_CLK>; + flexio0_lcd: flexio0-lcd { + compatible = "nxp,mipi-dbi-flexio-lcdif"; + status = "disabled"; + }; + }; }; &systick { From f5f3efada205c1069e54c9a5162bc3d162c63547 Mon Sep 17 00:00:00 2001 From: Neil Chen Date: Wed, 23 Oct 2024 16:39:59 +0800 Subject: [PATCH 1474/4482] boards: nxp: frdm_mcxn236: Support flexio and lcd_par_s035 Support flexio and lcd_par_s035 for NXP frdm_mcxn236 board Signed-off-by: Neil Chen --- boards/nxp/frdm_mcxn236/board.c | 5 +++ boards/nxp/frdm_mcxn236/doc/index.rst | 5 +++ .../frdm_mcxn236/frdm_mcxn236-pinctrl.dtsi | 41 +++++++++++++++++++ boards/nxp/frdm_mcxn236/frdm_mcxn236.dts | 4 ++ boards/nxp/frdm_mcxn236/frdm_mcxn236.dtsi | 35 ++++++++++++++++ 5 files changed, 90 insertions(+) diff --git a/boards/nxp/frdm_mcxn236/board.c b/boards/nxp/frdm_mcxn236/board.c index 56e21aa3e5e73..3ada0c1cd73bc 100644 --- a/boards/nxp/frdm_mcxn236/board.c +++ b/boards/nxp/frdm_mcxn236/board.c @@ -212,6 +212,11 @@ static int frdm_mcxn236_init(void) SPC_EnableActiveModeAnalogModules(SPC0, (kSPC_controlCmp0 | kSPC_controlCmp0Dac)); #endif +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexio0)) + CLOCK_SetClkDiv(kCLOCK_DivFlexioClk, 1u); + CLOCK_AttachClk(kPLL0_to_FLEXIO); +#endif + /* Set SystemCoreClock variable. */ SystemCoreClock = CLOCK_INIT_CORE_CLOCK; diff --git a/boards/nxp/frdm_mcxn236/doc/index.rst b/boards/nxp/frdm_mcxn236/doc/index.rst index 515cf4d8f98f8..ad6a5a3982dcc 100644 --- a/boards/nxp/frdm_mcxn236/doc/index.rst +++ b/boards/nxp/frdm_mcxn236/doc/index.rst @@ -76,6 +76,11 @@ The FRDM-MCXN236 board configuration supports the following hardware features: +-----------+------------+-------------------------------------+ | FLEXCAN | on-chip | CAN | +-----------+------------+-------------------------------------+ +| FLEXIO | on-chip | flexio | ++-----------+------------+-------------------------------------+ +| DISPLAY | on-chip | flexio; MIPI-DBI. Tested with | +| | | :ref:`lcd_par_s035` | ++-----------+------------+-------------------------------------+ Targets available ================== diff --git a/boards/nxp/frdm_mcxn236/frdm_mcxn236-pinctrl.dtsi b/boards/nxp/frdm_mcxn236/frdm_mcxn236-pinctrl.dtsi index 129d6e28ce751..e8c0907b87d25 100644 --- a/boards/nxp/frdm_mcxn236/frdm_mcxn236-pinctrl.dtsi +++ b/boards/nxp/frdm_mcxn236/frdm_mcxn236-pinctrl.dtsi @@ -119,4 +119,45 @@ input-enable; }; }; + + pinmux_flexio_lcd: pinmux_flexio_lcd { + group0 { + pinmux = , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + ; + slew-rate = "fast"; + drive-strength = "low"; + input-enable; + }; + group1 { + pinmux = ; + slew-rate = "fast"; + drive-strength = "low"; + input-enable; + bias-pull-up; + }; + group2 { + pinmux = ; + slew-rate = "slow"; + drive-strength = "low"; + input-enable; + bias-pull-up; + }; + }; }; diff --git a/boards/nxp/frdm_mcxn236/frdm_mcxn236.dts b/boards/nxp/frdm_mcxn236/frdm_mcxn236.dts index e954472b3bfb0..bff8cd907acb4 100644 --- a/boards/nxp/frdm_mcxn236/frdm_mcxn236.dts +++ b/boards/nxp/frdm_mcxn236/frdm_mcxn236.dts @@ -130,3 +130,7 @@ &lpcmp0 { status = "okay"; }; + +&flexio0 { + status = "okay"; +}; diff --git a/boards/nxp/frdm_mcxn236/frdm_mcxn236.dtsi b/boards/nxp/frdm_mcxn236/frdm_mcxn236.dtsi index 8840c69753621..51dadf4673c4d 100644 --- a/boards/nxp/frdm_mcxn236/frdm_mcxn236.dtsi +++ b/boards/nxp/frdm_mcxn236/frdm_mcxn236.dtsi @@ -46,6 +46,19 @@ zephyr,code = ; }; }; + + /* + * This node describes the GPIO pins of the LCD-PAR-S035 panel 8080 interface. + */ + nxp_lcd_8080_connector: lcd-8080-connector { + compatible = "nxp,lcd-8080"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map = <9 0 &gpio0 23 0>, /* Pin 9, LCD touch INT */ + <10 0 &gpio4 6 0>, /* Pin 10, LCD backlight control */ + <11 0 &gpio4 7 0>; /* Pin 11, LCD and touch reset */ + }; }; &flexcomm2_lpuart2 { @@ -60,6 +73,12 @@ clock-frequency = ; }; +nxp_8080_touch_panel_i2c: &flexcomm2_lpi2c2 { + pinctrl-0 = <&pinmux_flexcomm2_lpi2c>; + pinctrl-names = "default"; + clock-frequency = ; +}; + &flexcomm3_lpspi3 { pinctrl-0 = <&pinmux_flexcomm3_lpspi>; pinctrl-names = "default"; @@ -133,3 +152,19 @@ pinctrl-0 = <&pinmux_flexcan1>; pinctrl-names = "default"; }; + +zephyr_mipi_dbi_parallel: &flexio0_lcd { + /* DMA channels 0, muxed to FlexIO TX */ + dmas = <&edma0 0 61>; + dma-names = "tx"; + shifters-count = <8>; + timers-count = <1>; + enwr-pin = <28>; + rd-pin = <27>; + data-pin-start = <4>; + reset-gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; + cs-gpios = <&gpio4 14 GPIO_ACTIVE_HIGH>; + rs-gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&pinmux_flexio_lcd>; + pinctrl-names = "default"; +}; From a10ce8e833c133e9a6028275056bf3a9cce27bfb Mon Sep 17 00:00:00 2001 From: Neil Chen Date: Wed, 23 Oct 2024 16:45:36 +0800 Subject: [PATCH 1475/4482] samples: drivers: display: add board to the display testcase Add platform:frdm_mcxn236:SHIELD=lcd_par_s035_8080 to the display testcase Signed-off-by: Neil Chen --- samples/drivers/display/sample.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/drivers/display/sample.yaml b/samples/drivers/display/sample.yaml index 4a13203f27959..e2f359bbc66e2 100644 --- a/samples/drivers/display/sample.yaml +++ b/samples/drivers/display/sample.yaml @@ -86,3 +86,4 @@ tests: - platform:mimxrt1050_evk:SHIELD=rk043fn66hs_ctg - platform:mimxrt1040_evk:SHIELD=rk043fn66hs_ctg - platform:frdm_mcxn947/mcxn947/cpu0:SHIELD=lcd_par_s035_8080 + - platform:frdm_mcxn236:SHIELD=lcd_par_s035_8080 From 088e4c571c6b8469ce1a2ec7dc768c76fcf67e3a Mon Sep 17 00:00:00 2001 From: Maochen Wang Date: Tue, 8 Oct 2024 16:05:12 +0800 Subject: [PATCH 1476/4482] manifest: Update hal_nxp to add Wi-Fi driver Update hal_nxp to add Wi-Fi driver code. Signed-off-by: Maochen Wang --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 4279b74a60c73..e4abd8562356d 100644 --- a/west.yml +++ b/west.yml @@ -198,7 +198,7 @@ manifest: groups: - hal - name: hal_nxp - revision: 683c007c3b834012358b4adf96a532d18ce05646 + revision: 99570ee6fa32a9ab413b8ee9c0226cda26f6a2ae path: modules/hal/nxp groups: - hal From db271a7392cc00dc0da14925fcfacc6f385b4d20 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 18 Oct 2024 15:39:00 -0500 Subject: [PATCH 1477/4482] modules: hostap: remove ap_bandwidth API ap_bandwidth API implementation is not complete. Remove the structure definition and implementation from the NXP WiFi driver to fix a build error. Signed-off-by: Daniel DeGrasse --- drivers/wifi/nxp/nxp_wifi_drv.c | 43 --------------------------------- 1 file changed, 43 deletions(-) diff --git a/drivers/wifi/nxp/nxp_wifi_drv.c b/drivers/wifi/nxp/nxp_wifi_drv.c index e14bebb033db8..4efa3ffcdff57 100644 --- a/drivers/wifi/nxp/nxp_wifi_drv.c +++ b/drivers/wifi/nxp/nxp_wifi_drv.c @@ -769,47 +769,6 @@ static int nxp_wifi_version(const struct device *dev, struct wifi_version *param return 0; } -static int nxp_wifi_ap_bandwidth(const struct device *dev, struct wifi_ap_params *params) -{ - int status = NXP_WIFI_RET_SUCCESS; - int ret = WM_SUCCESS; - struct interface *if_handle = (struct interface *)dev->data; - - if (if_handle->state.interface != WLAN_BSS_TYPE_UAP) { - LOG_ERR("Wi-Fi not in uAP mode"); - return -EIO; - } - - if (s_nxp_wifi_State != NXP_WIFI_STARTED) { - status = NXP_WIFI_RET_NOT_READY; - } - - if (status == NXP_WIFI_RET_SUCCESS) { - - if (params->oper == WIFI_MGMT_SET) { - - ret = wlan_uap_set_bandwidth(params->bandwidth); - - if (ret != WM_SUCCESS) { - status = NXP_WIFI_RET_FAIL; - } - } else { - ret = wlan_uap_get_bandwidth(¶ms->bandwidth); - - if (ret != WM_SUCCESS) { - status = NXP_WIFI_RET_FAIL; - } - } - } - - if (status != NXP_WIFI_RET_SUCCESS) { - LOG_ERR("Failed to get/set Wi-Fi AP bandwidth"); - return -EAGAIN; - } - - return 0; -} - static int nxp_wifi_connect(const struct device *dev, struct wifi_connect_req_params *params) { int status = NXP_WIFI_RET_SUCCESS; @@ -1758,7 +1717,6 @@ static const struct wifi_mgmt_ops nxp_wifi_sta_mgmt = { .reg_domain = nxp_wifi_reg_domain, #ifdef CONFIG_NXP_WIFI_SOFTAP_SUPPORT .ap_enable = nxp_wifi_start_ap, - .ap_bandwidth = nxp_wifi_ap_bandwidth, .ap_disable = nxp_wifi_stop_ap, #endif .iface_status = nxp_wifi_status, @@ -1838,7 +1796,6 @@ static const struct wifi_mgmt_ops nxp_wifi_uap_mgmt = { .set_power_save = nxp_wifi_power_save, .get_power_save_config = nxp_wifi_get_power_save, .set_btwt = nxp_wifi_set_btwt, - .ap_bandwidth = nxp_wifi_ap_bandwidth, .ap_config_params = nxp_wifi_ap_config_params, }; From 452770f9e90fb8c1517c6742dc2186846aa27bd1 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 18 Oct 2024 15:40:33 -0500 Subject: [PATCH 1478/4482] modules: hostap: remove set_btwt API set_btwt API implementation is not complete. Remove the structure definition and implementation from the NXP WiFi driver to fix a build error. Signed-off-by: Daniel DeGrasse --- drivers/wifi/nxp/nxp_wifi_drv.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/drivers/wifi/nxp/nxp_wifi_drv.c b/drivers/wifi/nxp/nxp_wifi_drv.c index 4efa3ffcdff57..dd044b8bb8a65 100644 --- a/drivers/wifi/nxp/nxp_wifi_drv.c +++ b/drivers/wifi/nxp/nxp_wifi_drv.c @@ -1421,25 +1421,6 @@ static int nxp_wifi_set_twt(const struct device *dev, struct wifi_twt_params *pa return ret; } -static int nxp_wifi_set_btwt(const struct device *dev, struct wifi_twt_params *params) -{ - wlan_btwt_config_t btwt_config; - int ret = -1; - - btwt_config.action = 1; - btwt_config.sub_id = params->btwt.sub_id; - btwt_config.nominal_wake = params->btwt.nominal_wake; - btwt_config.max_sta_support = params->btwt.max_sta_support; - btwt_config.twt_mantissa = params->btwt.twt_interval; - btwt_config.twt_offset = params->btwt.twt_offset; - btwt_config.twt_exponent = params->btwt.twt_exponent; - btwt_config.sp_gap = params->btwt.sp_gap; - - ret = wlan_set_btwt_cfg(&btwt_config); - - return ret; -} - static void nxp_wifi_sta_init(struct net_if *iface) { const struct device *dev = net_if_get_device(iface); @@ -1795,7 +1776,6 @@ static const struct wifi_mgmt_ops nxp_wifi_uap_mgmt = { #endif .set_power_save = nxp_wifi_power_save, .get_power_save_config = nxp_wifi_get_power_save, - .set_btwt = nxp_wifi_set_btwt, .ap_config_params = nxp_wifi_ap_config_params, }; From 4703fb07073ec3e33899fd81c42cfcd56c28c514 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 18 Oct 2024 15:41:09 -0500 Subject: [PATCH 1479/4482] drivers: wifi: nxp: remove non-existent TWT fields Remove references to TWT fields that did not exist, to resolve a build error. Signed-off-by: Daniel DeGrasse --- drivers/wifi/nxp/nxp_wifi_drv.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/wifi/nxp/nxp_wifi_drv.c b/drivers/wifi/nxp/nxp_wifi_drv.c index dd044b8bb8a65..3dd714f7d9d94 100644 --- a/drivers/wifi/nxp/nxp_wifi_drv.c +++ b/drivers/wifi/nxp/nxp_wifi_drv.c @@ -1402,12 +1402,10 @@ static int nxp_wifi_set_twt(const struct device *dev, struct wifi_twt_params *pa twt_setup_conf.implicit = params->setup.implicit; twt_setup_conf.announced = params->setup.announce; twt_setup_conf.trigger_enabled = params->setup.trigger; - twt_setup_conf.twt_info_disabled = params->setup.twt_info_disable; twt_setup_conf.negotiation_type = params->negotiation_type; twt_setup_conf.twt_wakeup_duration = params->setup.twt_wake_interval; twt_setup_conf.flow_identifier = params->flow_id; twt_setup_conf.hard_constraint = 1; - twt_setup_conf.twt_exponent = params->setup.exponent; twt_setup_conf.twt_mantissa = params->setup.twt_interval; twt_setup_conf.twt_request = params->setup.responder; ret = wlan_set_twt_setup_cfg(&twt_setup_conf); From 8ea2c4f6924d8a9934116e4f018095706363ab6b Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 18 Oct 2024 17:03:52 -0500 Subject: [PATCH 1480/4482] drivers: wifi: nxp: remove unused nxp_wifi_uap_status function Remove unused function `nxp_wifi_uap_status`. Signed-off-by: Daniel DeGrasse --- drivers/wifi/nxp/nxp_wifi_drv.c | 62 --------------------------------- 1 file changed, 62 deletions(-) diff --git a/drivers/wifi/nxp/nxp_wifi_drv.c b/drivers/wifi/nxp/nxp_wifi_drv.c index 3dd714f7d9d94..71041c3360ea9 100644 --- a/drivers/wifi/nxp/nxp_wifi_drv.c +++ b/drivers/wifi/nxp/nxp_wifi_drv.c @@ -917,68 +917,6 @@ static inline enum wifi_security_type nxp_wifi_security_type(enum wlan_security_ } } -#ifndef CONFIG_WIFI_NM_WPA_SUPPLICANT -static int nxp_wifi_uap_status(const struct device *dev, struct wifi_iface_status *status) -{ - enum wlan_connection_state connection_state = WLAN_DISCONNECTED; - struct interface *if_handle = (struct interface *)&g_uap; - - wlan_get_uap_connection_state(&connection_state); - - if (connection_state == WLAN_UAP_STARTED) { - - if (!wlan_get_current_uap_network(&nxp_wlan_network)) { - strncpy(status->ssid, nxp_wlan_network.ssid, WIFI_SSID_MAX_LEN); - status->ssid[WIFI_SSID_MAX_LEN - 1] = 0; - status->ssid_len = strlen(status->ssid); - - memcpy(status->bssid, nxp_wlan_network.bssid, WIFI_MAC_ADDR_LEN); - - status->rssi = nxp_wlan_network.rssi; - - status->channel = nxp_wlan_network.channel; - - status->beacon_interval = nxp_wlan_network.beacon_period; - - status->dtim_period = nxp_wlan_network.dtim_period; - - if (if_handle->state.interface == WLAN_BSS_TYPE_STA) { - status->iface_mode = WIFI_MODE_INFRA; - } -#ifdef CONFIG_NXP_WIFI_SOFTAP_SUPPORT - else if (if_handle->state.interface == WLAN_BSS_TYPE_UAP) { - status->iface_mode = WIFI_MODE_AP; - } -#endif - -#ifdef CONFIG_NXP_WIFI_11AX - if (nxp_wlan_network.dot11ax) { - status->link_mode = WIFI_6; - } -#endif -#ifdef CONFIG_NXP_WIFI_11AC - else if (nxp_wlan_network.dot11ac) { - status->link_mode = WIFI_5; - } -#endif - else if (nxp_wlan_network.dot11n) { - status->link_mode = WIFI_4; - } else { - status->link_mode = WIFI_3; - } - - status->band = nxp_wlan_network.channel > 14 ? WIFI_FREQ_BAND_5_GHZ - : WIFI_FREQ_BAND_2_4_GHZ; - status->security = nxp_wifi_security_type(nxp_wlan_network.security.type); - status->mfp = nxp_wlan_network.security.mfpr ? WIFI_MFP_REQUIRED : - (nxp_wlan_network.security.mfpc ? WIFI_MFP_OPTIONAL : 0); - } - } - - return 0; -} -#endif - static int nxp_wifi_status(const struct device *dev, struct wifi_iface_status *status) { enum wlan_connection_state connection_state = WLAN_DISCONNECTED; From 7bc316ba3c52ec60a688c9d28ae49d992f7b0d6d Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 18 Oct 2024 15:29:58 -0500 Subject: [PATCH 1481/4482] drivers: wifi: nxp: add CONFIG_NXP_WIFI_BUILD_ONLY_MODE for CI testing Add CONFIG_NXP_WIFI_BUILD_ONLY_MODE, which allows the NXP WiFi driver to be built without a binary blob. The built application will not be functional, but this enables continuous integration to run upstream. Signed-off-by: Daniel DeGrasse --- drivers/wifi/nxp/Kconfig.nxp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/wifi/nxp/Kconfig.nxp b/drivers/wifi/nxp/Kconfig.nxp index b3172e1b1b0ae..8832688700e80 100644 --- a/drivers/wifi/nxp/Kconfig.nxp +++ b/drivers/wifi/nxp/Kconfig.nxp @@ -20,6 +20,13 @@ module = WIFI_NXP config WIFI_MGMT_SCAN_CHAN_MAX_MANUAL default 50 +config NXP_WIFI_BUILD_ONLY_MODE + bool "Build only mode (do not link wireless firmware blob)" + help + Skip linking the firmware blob into the Wi-Fi build. This will + not result in a functional application, but allows the Wi-Fi + driver to be built without binary blobs + config NXP_WIFI_CUSTOM bool "Custom NXP Wi-Fi part" help From 6f2517807e24bf63c71300541b8f053aa130420c Mon Sep 17 00:00:00 2001 From: Maochen Wang Date: Mon, 21 Oct 2024 18:52:26 +0900 Subject: [PATCH 1482/4482] hostap: fix build error when WPS enabled Fix build error of multiple definition of `dh5_init' in crypto_mbedtls_alt.c when WPS enabled. Signed-off-by: Maochen Wang --- modules/hostap/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/hostap/CMakeLists.txt b/modules/hostap/CMakeLists.txt index e1bd8c6c232bc..9910b077e6ba6 100644 --- a/modules/hostap/CMakeLists.txt +++ b/modules/hostap/CMakeLists.txt @@ -331,8 +331,15 @@ zephyr_library_sources_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_WPS ${HOSTAP_SRC_BASE}/wps/wps_enrollee.c ${HOSTAP_SRC_BASE}/wps/wps_registrar.c ${HOSTAP_SRC_BASE}/crypto/dh_groups.c +) + +if(NOT CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ALT) +# dh_group5 is only needed if we are not using mbedtls, as mbedtls provides +# its own definition +zephyr_library_sources_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_WPS ${HOSTAP_SRC_BASE}/crypto/dh_group5.c ) +endif() zephyr_library_compile_definitions_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_P2P CONFIG_P2P From a5ec0bd20f8f10b23828e9684d1a563d38feef80 Mon Sep 17 00:00:00 2001 From: Maochen Wang Date: Tue, 22 Oct 2024 11:35:42 +0900 Subject: [PATCH 1483/4482] samples: wifi: fix build warning of DIV_ROUND_UP redefined Remove CONFIG_MBEDTLS_HAVE_TIME_DATE, which will cause that mbedtls include Zephyr time.h and leads to 'DIV_ROUND_UP' redefined warning. Signed-off-by: Maochen Wang --- samples/net/wifi/boards/rd_rw612_bga.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/net/wifi/boards/rd_rw612_bga.conf b/samples/net/wifi/boards/rd_rw612_bga.conf index d6435e874b77e..5b3ebdd7fc63b 100644 --- a/samples/net/wifi/boards/rd_rw612_bga.conf +++ b/samples/net/wifi/boards/rd_rw612_bga.conf @@ -93,7 +93,6 @@ CONFIG_MBEDTLS=y CONFIG_MBEDTLS_BUILTIN=y CONFIG_MBEDTLS_USER_CONFIG_ENABLE=y CONFIG_MBEDTLS_USER_CONFIG_FILE="wpa_supp_els_pkc_mbedtls_config.h" -CONFIG_MBEDTLS_HAVE_TIME_DATE=y # Include els_pkc in build CONFIG_ENTROPY_GENERATOR=y From e6fc2be803e28a2fcd29d79bb11906cb43c1b124 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 22 Oct 2024 16:44:56 -0500 Subject: [PATCH 1484/4482] net: l2: wifi: add explicit dependency on "app" target for pem headers Generated PEM headers need to be created before we build the WiFi shell when WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE is enabled, so add an explicit dependency on the app target to be certain these headers are created Signed-off-by: Daniel DeGrasse --- subsys/net/l2/wifi/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/subsys/net/l2/wifi/CMakeLists.txt b/subsys/net/l2/wifi/CMakeLists.txt index eb22a54cf7774..38f75109454f9 100644 --- a/subsys/net/l2/wifi/CMakeLists.txt +++ b/subsys/net/l2/wifi/CMakeLists.txt @@ -32,6 +32,7 @@ file(MAKE_DIRECTORY ${gen_dir}) # convert .pem files to array data at build time zephyr_include_directories(${gen_inc_dir}) +if (CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE) generate_inc_file_for_target( app ${ZEPHYR_BASE}/samples/net/wifi/test_certs/client.pem @@ -67,3 +68,9 @@ generate_inc_file_for_target( ${ZEPHYR_BASE}/samples/net/wifi/test_certs/ca2.pem ${gen_dir}/ca2.pem.inc ) + +# Add explicit dependency on app target for ZEPHYR_CURRENT_LIBRARY, so these +# headers are generated at the correct point in the build +add_dependencies(${ZEPHYR_CURRENT_LIBRARY} app) + +endif() # CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE From a3d2b865f86a960c6c9842f7591edb8c6ed7c50b Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 18 Oct 2024 15:44:03 -0500 Subject: [PATCH 1485/4482] samples: net: wifi: add support for building NXP WiFi Add support for building NXP WiFi. Since the driver typically requires binary blobs, enable CONFIG_NXP_WIFI_BUILD_ONLY_MODE for this testcase. Signed-off-by: Daniel DeGrasse --- samples/net/wifi/boards/frdm_rw612.conf | 158 ++++++++++++++++++++++++ samples/net/wifi/sample.yaml | 6 + 2 files changed, 164 insertions(+) create mode 100644 samples/net/wifi/boards/frdm_rw612.conf diff --git a/samples/net/wifi/boards/frdm_rw612.conf b/samples/net/wifi/boards/frdm_rw612.conf new file mode 100644 index 0000000000000..5b5ec82460e08 --- /dev/null +++ b/samples/net/wifi/boards/frdm_rw612.conf @@ -0,0 +1,158 @@ +CONFIG_WIFI_NXP=y +CONFIG_NXP_RW610=y +CONFIG_NXP_WIFI_SHELL=y + +# +# C Library +# +CONFIG_REQUIRES_FULL_LIBC=y +CONFIG_CBPRINTF_FP_SUPPORT=y + +# log +CONFIG_WIFI_LOG_LEVEL_DBG=y +CONFIG_THREAD_LOCAL_STORAGE=y +CONFIG_ASSERT=y +CONFIG_ASSERT_LEVEL=2 +CONFIG_LOG_MODE_IMMEDIATE=y +CONFIG_LOG_PRINTK=n + +# os +CONFIG_THREAD_CUSTOM_DATA=y +CONFIG_EVENTS=y +CONFIG_SYS_HEAP_AUTO=y +CONFIG_HEAP_MEM_POOL_SIZE=122880 +CONFIG_SCHED_MULTIQ=y +CONFIG_ZVFS_OPEN_MAX=30 + +# shell +CONFIG_SHELL_ARGC_MAX=48 +CONFIG_WIFI_SHELL_MAX_AP_STA=8 +CONFIG_WIFI_MGMT_AP_MAX_NUM_STA=8 +CONFIG_SHELL_CMD_BUFF_SIZE=512 + +# net +CONFIG_NET_L2_ETHERNET=y +CONFIG_NET_DHCPV4_SERVER_ADDR_COUNT=32 +CONFIG_NET_IPV4=y +CONFIG_NET_IPV6=y +CONFIG_ETH_MCUX=n +CONFIG_NET_ZPERF=y +CONFIG_NET_ZPERF_MAX_PACKET_SIZE=1500 +CONFIG_NET_BUF_LOG=y +CONFIG_NET_PKT_RX_COUNT=60 +CONFIG_NET_PKT_TX_COUNT=40 +CONFIG_NET_BUF_RX_COUNT=60 +CONFIG_NET_BUF_TX_COUNT=80 +CONFIG_NET_BUF_DATA_SIZE=1744 +CONFIG_NET_TC_TX_COUNT=1 +CONFIG_NET_TC_RX_COUNT=1 +CONFIG_NET_MGMT_EVENT_QUEUE_SIZE=20 +CONFIG_NET_IF_MAX_IPV4_COUNT=2 +CONFIG_NET_IF_MAX_IPV6_COUNT=2 +CONFIG_DNS_RESOLVER=y +CONFIG_DNS_RESOLVER_MAX_SERVERS=2 +CONFIG_NET_SOCKETS_POLL_MAX=14 +CONFIG_NET_ZPERF_MAX_SESSIONS=6 +CONFIG_NET_IPV4_FRAGMENT=y +CONFIG_NET_IPV4_FRAGMENT_MAX_COUNT=3 +CONFIG_NET_IPV4_FRAGMENT_MAX_PKT=7 +CONFIG_NET_IPV4_FRAGMENT_TIMEOUT=3 +CONFIG_NET_IPV6_FRAGMENT=y +CONFIG_NET_IPV6_FRAGMENT_MAX_COUNT=3 +CONFIG_NET_IPV6_FRAGMENT_MAX_PKT=8 +CONFIG_NET_IPV6_FRAGMENT_TIMEOUT=3 +CONFIG_NET_MAX_CONN=10 +CONFIG_NET_DHCPV4_SERVER_ICMP_PROBE_TIMEOUT=100 +CONFIG_ETH_DRIVER=n + +# net threads priority +CONFIG_NET_TC_THREAD_PRIO_CUSTOM=y +CONFIG_NET_TC_THREAD_PREEMPTIVE=y +CONFIG_NET_TCP_WORKER_PRIO=-16 +CONFIG_NET_TC_TX_THREAD_BASE_PRIO=3 +CONFIG_NET_TC_RX_THREAD_BASE_PRIO=3 +CONFIG_ZPERF_WORK_Q_THREAD_PRIORITY=3 +CONFIG_NET_SOCKETS_SERVICE_THREAD_PRIO=3 +CONFIG_NET_TC_SKIP_FOR_HIGH_PRIO=y +CONFIG_NET_CONTEXT_PRIORITY=y + +CONFIG_WIFI_NM_WPA_SUPPLICANT=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_CLI=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ALT=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_EAPOL=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_MBEDTLS_PSA=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_INF_MON=n +CONFIG_WIFI_NM_MAX_MANAGED_INTERFACES=2 +CONFIG_SAE_PWE_EARLY_EXIT=y +CONFIG_WIFI_NM_HOSTAPD_AP=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_WPS=y + +# Enable mbedtls +CONFIG_MBEDTLS=y +CONFIG_MBEDTLS_BUILTIN=y +CONFIG_MBEDTLS_USER_CONFIG_ENABLE=y +CONFIG_MBEDTLS_USER_CONFIG_FILE="wpa_supp_els_pkc_mbedtls_config.h" + +# Include els_pkc in build +CONFIG_ENTROPY_GENERATOR=y +CONFIG_MBEDTLS_PSA_CRYPTO_C=y +CONFIG_MBEDTLS_ENTROPY_C=y +CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y +CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=8192 + +# power management +CONFIG_PM=y +CONFIG_PM_DEVICE=y +CONFIG_PM_LOG_LEVEL_OFF=y +CONFIG_PM_DEVICE_LOG_LEVEL_OFF=y +CONFIG_IDLE_STACK_SIZE=1024 + +# stack size +CONFIG_SHELL_STACK_SIZE=6144 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 +CONFIG_NET_MGMT_EVENT_STACK_SIZE=4608 +CONFIG_NET_TCP_WORKQ_STACK_SIZE=2048 +CONFIG_MAIN_STACK_SIZE=4096 +CONFIG_NET_SOCKETS_SERVICE_STACK_SIZE=4096 +CONFIG_WIFI_NM_WPA_SUPPLICANT_WQ_STACK_SIZE=12288 +CONFIG_WIFI_NM_WPA_SUPPLICANT_THREAD_STACK_SIZE=12288 + +# optimization level +# refer to Kconfig.zephyr for Optimizations Level +CONFIG_SPEED_OPTIMIZATIONS=y +#CONFIG_SIZE_OPTIMIZATIONS=y +#CONFIG_DEBUG_OPTIMIZATIONS=y +#CONFIG_NO_OPTIMIZATIONS=y + +# debug & stats +CONFIG_SYS_HEAP_VALIDATE=y +CONFIG_SYS_HEAP_RUNTIME_STATS=y +#CONFIG_NET_PKT_TXTIME_STATS=y +#CONFIG_NET_PKT_TXTIME_STATS_DETAIL=y +CONFIG_NET_STATISTICS_WIFI=y +CONFIG_NET_STATISTICS_USER_API=y +#CONFIG_NET_STATISTICS_PERIODIC_OUTPUT=y +#CONFIG_NET_BUF_POOL_USAGE=y +#CONFIG_NET_DEBUG_NET_PKT_ALLOC=y + +# stack size for -O0 +#CONFIG_SHELL_STACK_SIZE=8192 +#CONFIG_NET_TCP_WORKQ_STACK_SIZE=4096 +#CONFIG_NET_TX_STACK_SIZE=4096 +#CONFIG_NET_RX_STACK_SIZE=4096 +#CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +#CONFIG_ZPERF_WORK_Q_STACK_SIZE=4096 +#CONFIG_MAIN_STACK_SIZE=4096 +#CONFIG_WIFI_NM_WPA_SUPPLICANT_WQ_STACK_SIZE=16384 +#CONFIG_WIFI_NM_WPA_SUPPLICANT_THREAD_STACK_SIZE=16384 +#CONFIG_IDLE_STACK_SIZE=2048 + +# comment out for -O0 +CONFIG_CODE_DATA_RELOCATION_SRAM=y +#CONFIG_WIFI_NM_WPA_SUPPLICANT_DEBUG_LEVEL=2 +CONFIG_WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_INF=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_WQ_PRIO=3 +CONFIG_WIFI_NM_WPA_SUPPLICANT_PRIO=3 +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=80000 diff --git a/samples/net/wifi/sample.yaml b/samples/net/wifi/sample.yaml index 34aea9386d262..c710f1627969c 100644 --- a/samples/net/wifi/sample.yaml +++ b/samples/net/wifi/sample.yaml @@ -74,3 +74,9 @@ tests: - thingy53/nrf5340/cpuapp integration_platforms: - thingy53/nrf5340/cpuapp + sample.net.wifi.nxp_wifi: + extra_args: + - CONFIG_NXP_WIFI_BUILD_ONLY_MODE=y + platform_allow: + - frdm_rw612 + - rd_rw612_bga From df95a86bc3fa79bb84f8642933fd33e627aedf00 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Tue, 24 Sep 2024 16:59:44 -0500 Subject: [PATCH 1486/4482] soc: nxp: mcxw71: Add FlexCAN node/clocking Add node and enable clock for the FlexCAN module on MCXW71. Signed-off-by: Declan Snyder --- dts/arm/nxp/nxp_mcxw71.dtsi | 10 ++++++++++ soc/nxp/mcx/mcxw/soc.c | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/dts/arm/nxp/nxp_mcxw71.dtsi b/dts/arm/nxp/nxp_mcxw71.dtsi index 608ae67fccf22..b8e9edf17bb33 100644 --- a/dts/arm/nxp/nxp_mcxw71.dtsi +++ b/dts/arm/nxp/nxp_mcxw71.dtsi @@ -307,6 +307,16 @@ interrupts = <48 2>; interrupt-names = "hci_int"; }; + + flexcan0: can@3b000 { + compatible = "nxp,flexcan"; + reg = <0x3b000 0x3080>; + interrupts = <47 0>; + interrupt-names = "common"; + clocks = <&scg SCG_K4_FIRC_CLK 0xec>; + clk-source = <2>; + status = "disabled"; + }; }; &fast_peripheral0 { diff --git a/soc/nxp/mcx/mcxw/soc.c b/soc/nxp/mcx/mcxw/soc.c index 905a80d2a0dc1..f3ab6c3745ec1 100644 --- a/soc/nxp/mcx/mcxw/soc.c +++ b/soc/nxp/mcx/mcxw/soc.c @@ -154,6 +154,10 @@ static ALWAYS_INLINE void clock_init(void) if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(lpspi1), nxp_imx_lpspi, okay)) { CLOCK_EnableClock(kCLOCK_Lpspi1); } + + if (IS_ENABLED(CONFIG_CAN_MCUX_FLEXCAN)) { + CLOCK_EnableClock(kCLOCK_Can0); + } } static void vbat_init(void) From 28ec98a54a06d6290c01445984fcbeedf2dd6fce Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Tue, 24 Sep 2024 17:43:41 -0500 Subject: [PATCH 1487/4482] boards: frdm_mcxw71: Enable FlexCAN Enable FlexCAN on MCXW71. Signed-off-by: Declan Snyder --- boards/nxp/frdm_mcxw71/doc/index.rst | 2 ++ boards/nxp/frdm_mcxw71/frdm_mcxw71-pinctrl.dtsi | 8 ++++++++ boards/nxp/frdm_mcxw71/frdm_mcxw71.dts | 11 +++++++++++ boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml | 1 + 4 files changed, 22 insertions(+) diff --git a/boards/nxp/frdm_mcxw71/doc/index.rst b/boards/nxp/frdm_mcxw71/doc/index.rst index 01daa23f20835..be543225a4347 100644 --- a/boards/nxp/frdm_mcxw71/doc/index.rst +++ b/boards/nxp/frdm_mcxw71/doc/index.rst @@ -69,6 +69,8 @@ The ``frdm_mcxw71`` board target in Zephyr currently supports the following feat +-----------+------------+-------------------------------------+ | BLE | on-chip | Bluetooth | +-----------+------------+-------------------------------------+ +| FLEXCAN | on-chip | can | ++-----------+------------+-------------------------------------+ Fetch Binary Blobs ****************** diff --git a/boards/nxp/frdm_mcxw71/frdm_mcxw71-pinctrl.dtsi b/boards/nxp/frdm_mcxw71/frdm_mcxw71-pinctrl.dtsi index ccaacab99284e..d91adb8f252a1 100644 --- a/boards/nxp/frdm_mcxw71/frdm_mcxw71-pinctrl.dtsi +++ b/boards/nxp/frdm_mcxw71/frdm_mcxw71-pinctrl.dtsi @@ -50,4 +50,12 @@ drive-strength = "low"; }; }; + + pinmux_flexcan: pinmux_flexcan { + group0 { + pinmux = , ; + slew-rate = "slow"; + drive-strength = "low"; + }; + }; }; diff --git a/boards/nxp/frdm_mcxw71/frdm_mcxw71.dts b/boards/nxp/frdm_mcxw71/frdm_mcxw71.dts index 99630d3cabb8a..5a66fb297645b 100644 --- a/boards/nxp/frdm_mcxw71/frdm_mcxw71.dts +++ b/boards/nxp/frdm_mcxw71/frdm_mcxw71.dts @@ -26,6 +26,7 @@ zephyr,console = &lpuart1; zephyr,shell-uart = &lpuart1; zephyr,uart-pipe = &lpuart0; + zephyr,canbus = &flexcan0; }; user_led { @@ -116,3 +117,13 @@ &lptmr0 { status = "okay"; }; + +&flexcan0 { + status = "okay"; + pinctrl-0 = <&pinmux_flexcan>; + pinctrl-names = "default"; + + can-transceiver { + max-bitrate = <5000000>; + }; +}; diff --git a/boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml b/boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml index d6a010c81d5a4..99e97ddae898e 100644 --- a/boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml +++ b/boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml @@ -18,3 +18,4 @@ supported: - flash - spi - i2c + - can From 614e7d5399c078ac6e784bac0062ab70a0ff2b06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Sat, 22 Jun 2024 16:19:42 +0200 Subject: [PATCH 1488/4482] tests: drivers: spi: loopback: Configurable large buffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to allow fiting test in targets with smaller memory make large buffer configurable through Kconfig. Signed-off-by: Krzysztof Chruściński --- tests/drivers/spi/spi_loopback/Kconfig | 4 ++++ tests/drivers/spi/spi_loopback/overlay-mcux-dspi-dma.conf | 1 + tests/drivers/spi/spi_loopback/src/spi.c | 8 +------- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/drivers/spi/spi_loopback/Kconfig b/tests/drivers/spi/spi_loopback/Kconfig index 8c26b7230925f..f3d89bf7317e6 100644 --- a/tests/drivers/spi/spi_loopback/Kconfig +++ b/tests/drivers/spi/spi_loopback/Kconfig @@ -7,6 +7,10 @@ source "Kconfig.zephyr" config SPI_LOOPBACK_MODE_LOOP bool "Configure the SPI in LOOP mode, so that no extra wiring is needed" +config SPI_LARGE_BUFFER_SIZE + int "Large buffer size" + default 8192 + if SOC_SERIES_STM32H7X config SPI_LOOPBACK_16BITS_FRAMES diff --git a/tests/drivers/spi/spi_loopback/overlay-mcux-dspi-dma.conf b/tests/drivers/spi/spi_loopback/overlay-mcux-dspi-dma.conf index eb7fe42776232..b41d3658e60c9 100644 --- a/tests/drivers/spi/spi_loopback/overlay-mcux-dspi-dma.conf +++ b/tests/drivers/spi/spi_loopback/overlay-mcux-dspi-dma.conf @@ -2,3 +2,4 @@ CONFIG_DMA=y CONFIG_DSPI_MCUX_EDMA=y CONFIG_MCUX_DSPI_BUFFER_SIZE=5760 +CONFIG_SPI_LARGE_BUFFER_SIZE=1440 diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index ac1f7e5d972f1..98c122238ea9f 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -58,13 +58,7 @@ static struct spi_dt_spec spi_slow = SPI_DT_SPEC_GET(SPI_SLOW_DEV, SPI_OP(FRAME_ #define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACK_SIZE) #define BUF_SIZE 18 #define BUF2_SIZE 36 - -#ifdef CONFIG_DSPI_MCUX_EDMA -/*DSPI DMA need aligned buffer for internal*/ -#define BUF3_SIZE 1440 -#else -#define BUF3_SIZE 8192 -#endif +#define BUF3_SIZE CONFIG_SPI_LARGE_BUFFER_SIZE #if CONFIG_NOCACHE_MEMORY From 20c34ea092d029bcb14a159f9a944852bbf2127a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 21 Jun 2024 15:57:14 +0200 Subject: [PATCH 1489/4482] tests: drivers: spi: spi_loopback: Add nrf54h20dk cpurad MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlay for nrf54h20dk cpurad. Signed-off-by: Krzysztof Chruściński --- .../boards/nrf54h20dk_nrf54h20_common.dtsi | 49 +++++++++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 34 +------------ .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 11 +++++ 3 files changed, 61 insertions(+), 33 deletions(-) create mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_common.dtsi create mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_common.dtsi new file mode 100644 index 0000000000000..0d31bf6e66eae --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_common.dtsi @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi130_default: spi130_default { + group1 { + psels = , + , + ; + }; + }; + + spi130_sleep: spi130_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; +}; + +&spi130 { + pinctrl-0 = <&spi130_default>; + pinctrl-1 = <&spi130_sleep>; + pinctrl-names = "default", "sleep"; + overrun-character = <0x00>; + slow@0 { + compatible = "test-spi-loopback-slow"; + reg = <0>; + spi-max-frequency = ; + }; + fast@0 { + compatible = "test-spi-loopback-fast"; + reg = <0>; + spi-max-frequency = ; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpiote130 { + status = "okay"; +}; diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 89e5fbad08a94..e9338612aed9b 100644 --- a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -3,41 +3,9 @@ * * SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - spi130_default: spi130_default { - group1 { - psels = , - , - ; - }; - }; - - spi130_sleep: spi130_sleep { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; -}; +#include "nrf54h20dk_nrf54h20_common.dtsi" &spi130 { status = "okay"; - pinctrl-0 = <&spi130_default>; - pinctrl-1 = <&spi130_sleep>; - pinctrl-names = "default", "sleep"; - overrun-character = <0x00>; memory-regions = <&cpuapp_dma_region>; - slow@0 { - compatible = "test-spi-loopback-slow"; - reg = <0>; - spi-max-frequency = ; - }; - fast@0 { - compatible = "test-spi-loopback-fast"; - reg = <0>; - spi-max-frequency = ; - }; }; diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.overlay new file mode 100644 index 0000000000000..b94da1560f655 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include "nrf54h20dk_nrf54h20_common.dtsi" + +&spi130 { + status = "okay"; + memory-regions = <&cpurad_dma_region>; +}; From f20b595dfe6ff6922ac140628ce4e527f7d6270a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Sat, 22 Jun 2024 16:17:53 +0200 Subject: [PATCH 1490/4482] tests: drivers: spi: loopback: Add nrf54h20dk cpuppr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add configuration for nrf54h20dk//cpuppr target. Signed-off-by: Krzysztof Chruściński --- .../boards/nrf54h20dk_nrf54h20_common.dtsi | 1 + .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 1 - .../boards/nrf54h20dk_nrf54h20_cpuppr.conf | 1 + .../boards/nrf54h20dk_nrf54h20_cpuppr.overlay | 6 ++++++ .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 1 - .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 11 +++++++++++ .../spi/spi_loopback/sysbuild/vpr_launcher/prj.conf | 1 + 7 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.conf create mode 100644 tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.overlay create mode 100644 tests/drivers/spi/spi_loopback/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 tests/drivers/spi/spi_loopback/sysbuild/vpr_launcher/prj.conf diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_common.dtsi index 0d31bf6e66eae..7b40db16deb3c 100644 --- a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_common.dtsi +++ b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_common.dtsi @@ -28,6 +28,7 @@ pinctrl-1 = <&spi130_sleep>; pinctrl-names = "default", "sleep"; overrun-character = <0x00>; + status = "okay"; slow@0 { compatible = "test-spi-loopback-slow"; reg = <0>; diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index e9338612aed9b..aa5dc30239ce4 100644 --- a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -6,6 +6,5 @@ #include "nrf54h20dk_nrf54h20_common.dtsi" &spi130 { - status = "okay"; memory-regions = <&cpuapp_dma_region>; }; diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.conf b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.conf new file mode 100644 index 0000000000000..af7d7e938e0f6 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.conf @@ -0,0 +1 @@ +CONFIG_SPI_LARGE_BUFFER_SIZE=1024 diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.overlay new file mode 100644 index 0000000000000..cea31612851b8 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpuppr.overlay @@ -0,0 +1,6 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include "nrf54h20dk_nrf54h20_common.dtsi" diff --git a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.overlay index b94da1560f655..e8607cce637f5 100644 --- a/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.overlay +++ b/tests/drivers/spi/spi_loopback/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -6,6 +6,5 @@ #include "nrf54h20dk_nrf54h20_common.dtsi" &spi130 { - status = "okay"; memory-regions = <&cpurad_dma_region>; }; diff --git a/tests/drivers/spi/spi_loopback/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/spi/spi_loopback/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 0000000000000..70b72f6dc0dad --- /dev/null +++ b/tests/drivers/spi/spi_loopback/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include "../../../boards/nrf54h20dk_nrf54h20_common.dtsi" + +&spi130 { + status = "reserved"; + interrupt-parent = <&cpuppr_clic>; +}; diff --git a/tests/drivers/spi/spi_loopback/sysbuild/vpr_launcher/prj.conf b/tests/drivers/spi/spi_loopback/sysbuild/vpr_launcher/prj.conf new file mode 100644 index 0000000000000..b2a4ba591044e --- /dev/null +++ b/tests/drivers/spi/spi_loopback/sysbuild/vpr_launcher/prj.conf @@ -0,0 +1 @@ +# nothing here From 949566f829631d1b1f4fdaa93acdd0d1ac1ce0a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 24 Jun 2024 10:55:11 +0200 Subject: [PATCH 1491/4482] tests: drivers: spi: spi_controller_peripheral: Add nrf54h20dk cpuppr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rework existing nrf54h20dk overlays to allow adding of nrf54h20dk//cpuppr target. Signed-off-by: Krzysztof Chruściński --- .../boards/nrf54h20dk_nrf54h20_cpuppr.overlay | 6 ++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 16 ++++++++++++++++ .../sysbuild/vpr_launcher/prj.conf | 1 + .../spi/spi_controller_peripheral/testcase.yaml | 5 +++-- 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_cpuppr.overlay create mode 100644 tests/drivers/spi/spi_controller_peripheral/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 tests/drivers/spi/spi_controller_peripheral/sysbuild/vpr_launcher/prj.conf diff --git a/tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_cpuppr.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_cpuppr.overlay new file mode 100644 index 0000000000000..83d3121c18963 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_cpuppr.overlay @@ -0,0 +1,6 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include "nrf54h20dk_nrf54h20_common.dtsi" diff --git a/tests/drivers/spi/spi_controller_peripheral/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/spi/spi_controller_peripheral/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 0000000000000..4343187f21fa6 --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include "../../../boards/nrf54h20dk_nrf54h20_common.dtsi" + +&spi130 { + status = "reserved"; + interrupt-parent = <&cpuppr_clic>; +}; + +&dut_spis { + status = "reserved"; + interrupt-parent = <&cpuppr_clic>; +}; diff --git a/tests/drivers/spi/spi_controller_peripheral/sysbuild/vpr_launcher/prj.conf b/tests/drivers/spi/spi_controller_peripheral/sysbuild/vpr_launcher/prj.conf new file mode 100644 index 0000000000000..b2a4ba591044e --- /dev/null +++ b/tests/drivers/spi/spi_controller_peripheral/sysbuild/vpr_launcher/prj.conf @@ -0,0 +1 @@ +# nothing here diff --git a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml index 675259a4dd0ca..e55a6a6a69d58 100644 --- a/tests/drivers/spi/spi_controller_peripheral/testcase.yaml +++ b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml @@ -5,8 +5,8 @@ common: harness_config: fixture: gpio_spi_loopback platform_allow: | - nrf52840dk/nrf52840 nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp nrf54h20dk/nrf54h20/cpurad + nrf52840dk/nrf52840 nrf54l15dk/nrf54l15/cpuapp nrf54h20dk/nrf54h20/cpuapp + nrf54h20dk/nrf54h20/cpurad nrf54h20dk/nrf54h20/cpuppr tests: drivers.spi.spi_mode0: @@ -57,3 +57,4 @@ tests: - nrf52840dk/nrf52840 - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpurad + - nrf54h20dk/nrf54h20/cpuppr From 1689eaf6a4551165905979772d981ed6713acef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 24 Jun 2024 11:54:58 +0200 Subject: [PATCH 1492/4482] tests: drivers: spi: spi_error_cases: Improve nrf54h20dk cpuppr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rework overlays and add sysbuild/vpr_launcher folder to allow standard test configuration for nrf54h20dk cpuppr. Signed-off-by: Krzysztof Chruściński --- .../boards/nrf54h20dk_nrf54h20_common.dtsi | 78 ++++++++++++++++++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 63 +-------------- .../boards/nrf54h20dk_nrf54h20_cpuppr.overlay | 81 +------------------ .../boards/nrf54h20dk_nrf54h20_cpurad.overlay | 15 ++++ .../nrf54h20dk_nrf54h20_cpuapp.overlay} | 7 +- .../sysbuild/vpr_launcher/prj.conf | 1 + .../drivers/spi/spi_error_cases/testcase.yaml | 8 -- 7 files changed, 98 insertions(+), 155 deletions(-) create mode 100644 tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_common.dtsi create mode 100644 tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpurad.overlay rename tests/drivers/spi/spi_error_cases/{boards/nrf54h20dk_nrf54h20_cpuppr_launcher.overlay => sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay} (76%) create mode 100644 tests/drivers/spi/spi_error_cases/sysbuild/vpr_launcher/prj.conf diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_common.dtsi new file mode 100644 index 0000000000000..7b8a3fa033a90 --- /dev/null +++ b/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_common.dtsi @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + spi130_default_alt: spi130_default_alt { + group1 { + psels = , + , + ; + }; + }; + + spi130_sleep_alt: spi130_sleep_alt { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; + + spis131_default_alt: spis131_default_alt { + group1 { + psels = , + , + , + ; + }; + }; + + spis131_sleep_alt: spis131_sleep_alt { + group1 { + psels = , + , + , + ; + low-power-enable; + }; + }; + +}; + +&gpiote130 { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&spi130 { + compatible = "nordic,nrf-spim"; + status = "okay"; + pinctrl-0 = <&spi130_default_alt>; + pinctrl-1 = <&spi130_sleep_alt>; + pinctrl-names = "default", "sleep"; + overrun-character = <0x00>; + cs-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; + dut_spi_dt: test-spi-dev@0 { + compatible = "vnd,spi-device"; + reg = <0>; + spi-max-frequency = <500000>; + }; +}; + +dut_spis: &spi131 { + compatible = "nordic,nrf-spis"; + status = "okay"; + def-char = <0x00>; + pinctrl-0 = <&spis131_default_alt>; + pinctrl-1 = <&spis131_sleep_alt>; + pinctrl-names = "default", "sleep"; + /delete-property/rx-delay-supported; + /delete-property/rx-delay; +}; diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index ec7e9a1702aea..871b62ad17dee 100644 --- a/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -4,73 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ -&pinctrl { - spi130_default_alt: spi130_default_alt { - group1 { - psels = , - , - ; - }; - }; - - spi130_sleep_alt: spi130_sleep_alt { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - - spis131_default_alt: spis131_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - spis131_sleep_alt: spis131_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; - -}; - -&gpio0 { - status = "okay"; -}; +#include "nrf54h20dk_nrf54h20_common.dtsi" &spi130 { - compatible = "nordic,nrf-spim"; - status = "okay"; - pinctrl-0 = <&spi130_default_alt>; - pinctrl-1 = <&spi130_sleep_alt>; - pinctrl-names = "default", "sleep"; - overrun-character = <0x00>; - cs-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <500000>; - }; memory-regions = <&cpuapp_dma_region>; }; dut_spis: &spi131 { - compatible = "nordic,nrf-spis"; - status = "okay"; - def-char = <0x00>; - pinctrl-0 = <&spis131_default_alt>; - pinctrl-1 = <&spis131_sleep_alt>; - pinctrl-names = "default", "sleep"; memory-regions = <&cpuapp_dma_region>; - /delete-property/rx-delay-supported; - /delete-property/rx-delay; }; diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpuppr.overlay b/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpuppr.overlay index 7643b94190908..83d3121c18963 100644 --- a/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpuppr.overlay +++ b/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpuppr.overlay @@ -3,83 +3,4 @@ * * SPDX-License-Identifier: Apache-2.0 */ - -&pinctrl { - spi130_default_alt: spi130_default_alt { - group1 { - psels = , - , - ; - }; - }; - - spi130_sleep_alt: spi130_sleep_alt { - group1 { - psels = , - , - ; - low-power-enable; - }; - }; - - spis131_default_alt: spis131_default_alt { - group1 { - psels = , - , - , - ; - }; - }; - - spis131_sleep_alt: spis131_sleep_alt { - group1 { - psels = , - , - , - ; - low-power-enable; - }; - }; - -}; - -&gpio0 { - status = "okay"; -}; - -&gpiote130 { - status = "okay"; - owned-channels = <7>; -}; - -&cpuapp_dma_region { - status = "okay"; -}; - -&spi130 { - compatible = "nordic,nrf-spim"; - status = "okay"; - pinctrl-0 = <&spi130_default_alt>; - pinctrl-1 = <&spi130_sleep_alt>; - pinctrl-names = "default", "sleep"; - overrun-character = <0x00>; - cs-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; - dut_spi_dt: test-spi-dev@0 { - compatible = "vnd,spi-device"; - reg = <0>; - spi-max-frequency = <500000>; - }; - memory-regions = <&cpuapp_dma_region>; -}; - -dut_spis: &spi131 { - compatible = "nordic,nrf-spis"; - status = "okay"; - def-char = <0x00>; - pinctrl-0 = <&spis131_default_alt>; - pinctrl-1 = <&spis131_sleep_alt>; - pinctrl-names = "default", "sleep"; - memory-regions = <&cpuapp_dma_region>; - /delete-property/rx-delay-supported; - /delete-property/rx-delay; -}; +#include "nrf54h20dk_nrf54h20_common.dtsi" diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpurad.overlay new file mode 100644 index 0000000000000..2a27f133a07e4 --- /dev/null +++ b/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpurad.overlay @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54h20dk_nrf54h20_common.dtsi" + +&spi130 { + memory-regions = <&cpurad_dma_region>; +}; + +dut_spis: &spi131 { + memory-regions = <&cpurad_dma_region>; +}; diff --git a/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpuppr_launcher.overlay b/tests/drivers/spi/spi_error_cases/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay similarity index 76% rename from tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpuppr_launcher.overlay rename to tests/drivers/spi/spi_error_cases/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index facf592d94ca6..4343187f21fa6 100644 --- a/tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpuppr_launcher.overlay +++ b/tests/drivers/spi/spi_error_cases/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -3,17 +3,14 @@ * * SPDX-License-Identifier: Apache-2.0 */ +#include "../../../boards/nrf54h20dk_nrf54h20_common.dtsi" &spi130 { status = "reserved"; interrupt-parent = <&cpuppr_clic>; }; -&spi131 { +&dut_spis { status = "reserved"; interrupt-parent = <&cpuppr_clic>; }; - -&gpio0 { - status = "reserved"; -}; diff --git a/tests/drivers/spi/spi_error_cases/sysbuild/vpr_launcher/prj.conf b/tests/drivers/spi/spi_error_cases/sysbuild/vpr_launcher/prj.conf new file mode 100644 index 0000000000000..b2a4ba591044e --- /dev/null +++ b/tests/drivers/spi/spi_error_cases/sysbuild/vpr_launcher/prj.conf @@ -0,0 +1 @@ +# nothing here diff --git a/tests/drivers/spi/spi_error_cases/testcase.yaml b/tests/drivers/spi/spi_error_cases/testcase.yaml index b00c73c2ef996..77225df31b2e8 100644 --- a/tests/drivers/spi/spi_error_cases/testcase.yaml +++ b/tests/drivers/spi/spi_error_cases/testcase.yaml @@ -16,11 +16,3 @@ tests: extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay" platform_allow: - nrf54h20dk/nrf54h20/cpuapp - drivers.spi.spi_error_cases.nrf54h20_cpuppr: - platform_allow: nrf54h20dk/nrf54h20/cpuppr - sysbuild: true - extra_args: - - vpr_launcher_DTC_OVERLAY_FILE="../../../tests/drivers/spi/spi_error_cases/boards/nrf54h20dk_nrf54h20_cpuppr_launcher.overlay" - - SB_CONFIG_VPR_LAUNCHER=y - # Disable asserts to fit in limited code memory - - CONFIG_ASSERT=n From 17599675976de32e693518ea3b06fa959b338b4c Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Thu, 24 Oct 2024 09:07:58 +0200 Subject: [PATCH 1493/4482] scripts: west_commands: runners: Fix jlink is_ip Commit f987e8c6f0a49b04a1184b1a36612612482e3d24 introduced a regression where the is_ip check fails if no --id is passed as an argument. Signed-off-by: Pieter De Gendt --- scripts/west_commands/runners/jlink.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/west_commands/runners/jlink.py b/scripts/west_commands/runners/jlink.py index d6d7d472bea67..c4647487c6828 100644 --- a/scripts/west_commands/runners/jlink.py +++ b/scripts/west_commands/runners/jlink.py @@ -30,6 +30,8 @@ DEFAULT_JLINK_RTT_PORT = 19021 def is_ip(ip): + if not ip: + return False try: ipaddress.ip_address(ip.split(':')[0]) except ValueError: From 518362094964fcbea9a2ccf71d0bdc7cefef71f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tja=C5=BE=20Vra=C4=8Dko?= Date: Thu, 24 Oct 2024 08:01:44 +0200 Subject: [PATCH 1494/4482] doc: wifi: Fix typo in wifi.rst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WPA2-PSK-256 is supported, not WPA3-PSK-256, which does not exist. Signed-off-by: Tjaž Vračko --- doc/connectivity/networking/api/wifi.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/connectivity/networking/api/wifi.rst b/doc/connectivity/networking/api/wifi.rst index 1499f1c75ab35..45c7b88592c9c 100644 --- a/doc/connectivity/networking/api/wifi.rst +++ b/doc/connectivity/networking/api/wifi.rst @@ -15,7 +15,7 @@ Only personal mode security is supported with below types: * Open * WPA2-PSK -* WPA3-PSK-256 +* WPA2-PSK-256 * WPA3-SAE The Wi-Fi management API is implemented in the ``wifi_mgmt`` module as a part of the networking L2 From da6310c96ce417f1e3b238bc7c163ddc3ad0569d Mon Sep 17 00:00:00 2001 From: Michal Smola Date: Tue, 22 Oct 2024 10:53:14 +0200 Subject: [PATCH 1495/4482] soc: mcxc: Enable bandgap buffer for on die temperature measurement Bandgap voltage is used for on die temperature measurement. Bandgap buffer has to be enabled explicitly to get correct tempearature. Enable the buffer if TEMP_KINETIS is selected. Signed-off-by: Michal Smola --- soc/nxp/mcx/mcxc/soc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/soc/nxp/mcx/mcxc/soc.c b/soc/nxp/mcx/mcxc/soc.c index 4cb7b3c5085fc..bd3f6ae96b79a 100644 --- a/soc/nxp/mcx/mcxc/soc.c +++ b/soc/nxp/mcx/mcxc/soc.c @@ -109,6 +109,11 @@ static void clock_init(void) void soc_early_init_hook(void) { +#ifdef CONFIG_TEMP_KINETIS + /* enable bandgap buffer */ + PMC->REGSC |= PMC_REGSC_BGBE_MASK; +#endif /* CONFIG_TEMP_KINETIS */ + clock_init(); } From 2e22e8c1da384be578cbd24067be4fa137bce572 Mon Sep 17 00:00:00 2001 From: Michal Smola Date: Tue, 22 Oct 2024 10:57:14 +0200 Subject: [PATCH 1496/4482] dts: nxp mcxc: Add die temperature measurement Die temperature measurement is not configured in devicetree for NXP MCX C series. Add die temperature measurement configuration. Signed-off-by: Michal Smola --- dts/arm/nxp/nxp_mcxc_common.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dts/arm/nxp/nxp_mcxc_common.dtsi b/dts/arm/nxp/nxp_mcxc_common.dtsi index 8c632b77e7478..92c7c8a86bd6b 100644 --- a/dts/arm/nxp/nxp_mcxc_common.dtsi +++ b/dts/arm/nxp/nxp_mcxc_common.dtsi @@ -48,6 +48,17 @@ }; }; + temp0: temp0 { + compatible = "nxp,kinetis-temperature"; + io-channels = <&adc0 26>, <&adc0 27>; + io-channel-names = "SENSOR", "BANDGAP"; + bandgap-voltage = <1000000>; + vtemp25 = <716000>; + sensor-slope-cold = <1620>; + sensor-slope-hot = <1620>; + status = "disabled"; + }; + soc { ftfa: flash-controller@40020000 { compatible = "nxp,kinetis-ftfa"; From ab3bf82efe4ca23222d467e54a9a90e6c6caa329 Mon Sep 17 00:00:00 2001 From: Michal Smola Date: Tue, 22 Oct 2024 12:31:31 +0200 Subject: [PATCH 1497/4482] drivers: sensor: nxp kinetis temp: Remove depends on kinetis Remove Kconfig dependency on SOC_FAMILY_KINETIS as the temperature sensor is available also on MCX family. Signed-off-by: Michal Smola --- drivers/sensor/nxp/nxp_kinetis_temp/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/sensor/nxp/nxp_kinetis_temp/Kconfig b/drivers/sensor/nxp/nxp_kinetis_temp/Kconfig index 10436fda53a3d..a7e2c446ce198 100644 --- a/drivers/sensor/nxp/nxp_kinetis_temp/Kconfig +++ b/drivers/sensor/nxp/nxp_kinetis_temp/Kconfig @@ -7,7 +7,6 @@ config TEMP_KINETIS bool "NXP Kinetis Temperature Sensor" default y depends on DT_HAS_NXP_KINETIS_TEMPERATURE_ENABLED - depends on SOC_FAMILY_KINETIS select ADC help Enable driver for NXP Kinetis temperature sensor. From 60aeab35798f93890e47ef2b65e757cf03bb1a54 Mon Sep 17 00:00:00 2001 From: Michal Smola Date: Tue, 22 Oct 2024 12:32:58 +0200 Subject: [PATCH 1498/4482] samples: die temperature polling: Enable sample for frdm_mcxc242 Die temperature polling sample is not enabled for frdm_mcxc242 board. Add devicetree overlay and Kconfig configuration for the sample to enable it. Signed-off-by: Michal Smola --- .../die_temp_polling/boards/frdm_mcxc242.conf | 1 + .../die_temp_polling/boards/frdm_mcxc242.overlay | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 samples/sensor/die_temp_polling/boards/frdm_mcxc242.conf create mode 100644 samples/sensor/die_temp_polling/boards/frdm_mcxc242.overlay diff --git a/samples/sensor/die_temp_polling/boards/frdm_mcxc242.conf b/samples/sensor/die_temp_polling/boards/frdm_mcxc242.conf new file mode 100644 index 0000000000000..3201f7a9cc405 --- /dev/null +++ b/samples/sensor/die_temp_polling/boards/frdm_mcxc242.conf @@ -0,0 +1 @@ +CONFIG_ADC_MCUX_ADC16_VREF_ALTERNATE=y diff --git a/samples/sensor/die_temp_polling/boards/frdm_mcxc242.overlay b/samples/sensor/die_temp_polling/boards/frdm_mcxc242.overlay new file mode 100644 index 0000000000000..ea39369d3106a --- /dev/null +++ b/samples/sensor/die_temp_polling/boards/frdm_mcxc242.overlay @@ -0,0 +1,15 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + aliases { + die-temp0 = &temp0; + }; +}; + +&temp0 { + status = "okay"; +}; From 795cd8678c8f4998b9080620cc8d42d213937045 Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Tue, 22 Oct 2024 11:29:45 +0200 Subject: [PATCH 1499/4482] samples: drivers: mbox: adjust timeout 30 sec is enough. Signed-off-by: Piotr Kosycarz --- samples/drivers/mbox/sample.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/drivers/mbox/sample.yaml b/samples/drivers/mbox/sample.yaml index 1cede3238992d..9e0483c49de32 100644 --- a/samples/drivers/mbox/sample.yaml +++ b/samples/drivers/mbox/sample.yaml @@ -3,6 +3,7 @@ sample: common: sysbuild: true tags: mbox + timeout: 30 tests: sample.drivers.mbox.real_hw: platform_allow: From 4c83883152d686973bc8fbd471fa336d1cbcb4ed Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Tue, 22 Oct 2024 11:30:54 +0200 Subject: [PATCH 1500/4482] samples: subsys: ipc: ipc_service: icmsg: adjust timeout 30 sec is enough. Signed-off-by: Piotr Kosycarz --- samples/subsys/ipc/ipc_service/icmsg/sample.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/samples/subsys/ipc/ipc_service/icmsg/sample.yaml b/samples/subsys/ipc/ipc_service/icmsg/sample.yaml index 27a2a8b6d8df9..cd065a855555f 100644 --- a/samples/subsys/ipc/ipc_service/icmsg/sample.yaml +++ b/samples/subsys/ipc/ipc_service/icmsg/sample.yaml @@ -1,5 +1,7 @@ sample: name: IPC Service example integration (icmsg backend) +common: + timeout: 30 tests: sample.ipc.icmsg: platform_allow: From ff6be0586b95d94f02c3332248f70f456189905d Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Tue, 22 Oct 2024 09:49:34 +0200 Subject: [PATCH 1501/4482] cmake: support range for find_package(Zephyr-sdk) Fixes: #80200 CMake `find_package( )` support the use of ranges, like `1.0.0...4.0.0`. Update the FindZephyr-sdk.cmake module to support this. This allows looking up the Zephyr SDK with an upper boundry, for example `find_package(Zephyr-sdk 0.16...<0.17)`. Signed-off-by: Torsten Rasmussen --- cmake/modules/FindZephyr-sdk.cmake | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/cmake/modules/FindZephyr-sdk.cmake b/cmake/modules/FindZephyr-sdk.cmake index 1b56379ec669f..90bbed017ce68 100644 --- a/cmake/modules/FindZephyr-sdk.cmake +++ b/cmake/modules/FindZephyr-sdk.cmake @@ -77,7 +77,7 @@ if(("zephyr" STREQUAL ${ZEPHYR_TOOLCHAIN_VARIANT}) OR # To support Zephyr SDK tools (DTC, and other tools) with 3rd party toolchains # then we keep track of current toolchain variant. set(ZEPHYR_CURRENT_TOOLCHAIN_VARIANT ${ZEPHYR_TOOLCHAIN_VARIANT}) - find_package(Zephyr-sdk ${Zephyr-sdk_FIND_VERSION} + find_package(Zephyr-sdk ${Zephyr-sdk_FIND_VERSION_COMPLETE} REQUIRED QUIET CONFIG HINTS ${ZEPHYR_SDK_INSTALL_DIR} ) if(DEFINED ZEPHYR_CURRENT_TOOLCHAIN_VARIANT) @@ -123,16 +123,27 @@ if(("zephyr" STREQUAL ${ZEPHYR_TOOLCHAIN_VARIANT}) OR endif() endforeach() else() + if("${Zephyr-sdk_FIND_VERSION_RANGE_MAX}" STREQUAL "INCLUDE") + set(upper_bound _EQUAL) + endif() + + if(NOT DEFINED Zephyr-sdk_FIND_VERSION_RANGE) + # Range not given, max out to ensure max version is not in effect. + set(Zephyr-sdk_FIND_VERSION_MAX 99999999) + endif() + # Loop over each found Zepher SDK version until one is found that is compatible. foreach(zephyr_sdk_candidate ${Zephyr-sdk_CONSIDERED_VERSIONS}) - if("${zephyr_sdk_candidate}" VERSION_GREATER_EQUAL "${Zephyr-sdk_FIND_VERSION}") + if("${zephyr_sdk_candidate}" VERSION_GREATER_EQUAL "${Zephyr-sdk_FIND_VERSION}" + AND "${zephyr_sdk_candidate}" VERSION_LESS${upper_bound} "${Zephyr-sdk_FIND_VERSION_MAX}" + ) # Find the path for the current version being checked and get the directory # of the Zephyr SDK so it can be checked. cmake_path(GET Zephyr-sdk-${zephyr_sdk_candidate}_DIR PARENT_PATH zephyr_sdk_current_check_path) cmake_path(GET zephyr_sdk_current_check_path PARENT_PATH zephyr_sdk_current_check_path) # Then see if this version is compatible. - find_package(Zephyr-sdk ${Zephyr-sdk_FIND_VERSION} QUIET CONFIG PATHS ${zephyr_sdk_current_check_path} NO_DEFAULT_PATH) + find_package(Zephyr-sdk ${Zephyr-sdk_FIND_VERSION_COMPLETE} QUIET CONFIG PATHS ${zephyr_sdk_current_check_path} NO_DEFAULT_PATH) if (${Zephyr-sdk_FOUND}) # A compatible version of the Zephyr SDK has been found which is the highest @@ -145,7 +156,7 @@ if(("zephyr" STREQUAL ${ZEPHYR_TOOLCHAIN_VARIANT}) OR if (NOT ${Zephyr-sdk_FOUND}) # This means no compatible Zephyr SDK versions were found, set the version # back to the minimum version so that it is displayed in the error text. - find_package(Zephyr-sdk ${Zephyr-sdk_FIND_VERSION} REQUIRED CONFIG PATHS ${zephyr_sdk_search_paths}) + find_package(Zephyr-sdk ${Zephyr-sdk_FIND_VERSION_COMPLETE} REQUIRED CONFIG PATHS ${zephyr_sdk_search_paths}) endif() endif() endif() From 05e73a009f30177ed06164e2d201a9299e6d0e55 Mon Sep 17 00:00:00 2001 From: Abderrahmane Jarmouni Date: Sat, 19 Oct 2024 00:09:02 +0200 Subject: [PATCH 1502/4482] samples: subsys: fs: littlefs: move stm32_blk.conf Move stm32_blk.conf ouside of 'boards' as this folder is meant to contain only board-specific devicetree overlays and Kconfig fragments. Signed-off-by: Abderrahmane Jarmouni --- samples/subsys/fs/littlefs/sample.yaml | 4 ++-- samples/subsys/fs/littlefs/{boards => }/stm32_blk.conf | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename samples/subsys/fs/littlefs/{boards => }/stm32_blk.conf (100%) diff --git a/samples/subsys/fs/littlefs/sample.yaml b/samples/subsys/fs/littlefs/sample.yaml index 6b49963327518..8d26a2a3e0572 100644 --- a/samples/subsys/fs/littlefs/sample.yaml +++ b/samples/subsys/fs/littlefs/sample.yaml @@ -51,7 +51,7 @@ tests: build_only: true platform_allow: stm32h747i_disco/stm32h747xx/m7 extra_args: - - EXTRA_CONF_FILE=boards/stm32_blk.conf + - EXTRA_CONF_FILE=stm32_blk.conf - CONF_FILE=prj_blk.conf extra_configs: - CONFIG_SDMMC_STM32_HWFC=y @@ -75,7 +75,7 @@ tests: build_only: true platform_allow: stm32f746g_disco extra_args: - - EXTRA_CONF_FILE=boards/stm32_blk.conf + - EXTRA_CONF_FILE=stm32_blk.conf - CONF_FILE=prj_blk.conf extra_configs: - CONFIG_SDMMC_STM32_HWFC=y diff --git a/samples/subsys/fs/littlefs/boards/stm32_blk.conf b/samples/subsys/fs/littlefs/stm32_blk.conf similarity index 100% rename from samples/subsys/fs/littlefs/boards/stm32_blk.conf rename to samples/subsys/fs/littlefs/stm32_blk.conf From 3a4dbd4a73eaa10b72da39fcb6a3257a3313d828 Mon Sep 17 00:00:00 2001 From: Abderrahmane Jarmouni Date: Sat, 19 Oct 2024 00:13:58 +0200 Subject: [PATCH 1503/4482] samples: sample.yaml: replace deprecated OVERLAY_CONFIG w\ EXTRA_CONF_FILE Replace some OVERLAY_CONFIG that were missed in a pervious PR. Signed-off-by: Abderrahmane Jarmouni --- samples/bluetooth/bap_broadcast_sink/sample.yaml | 2 +- samples/bluetooth/bap_broadcast_source/sample.yaml | 2 +- samples/bluetooth/bap_unicast_client/sample.yaml | 2 +- samples/bluetooth/bap_unicast_server/sample.yaml | 2 +- samples/bluetooth/cap_acceptor/sample.yaml | 2 +- samples/bluetooth/cap_initiator/sample.yaml | 2 +- samples/bluetooth/direction_finding_central/sample.yaml | 2 +- .../bluetooth/direction_finding_connectionless_rx/sample.yaml | 2 +- .../bluetooth/direction_finding_connectionless_tx/sample.yaml | 2 +- samples/bluetooth/direction_finding_peripheral/sample.yaml | 2 +- samples/bluetooth/hap_ha/sample.yaml | 4 ++-- samples/bluetooth/hci_uart/sample.yaml | 4 ++-- samples/bluetooth/hci_uart_3wire/sample.yaml | 2 +- samples/bluetooth/iso_broadcast/sample.yaml | 2 +- samples/bluetooth/iso_central/sample.yaml | 2 +- samples/bluetooth/iso_receive/sample.yaml | 2 +- samples/bluetooth/pbp_public_broadcast_sink/sample.yaml | 2 +- samples/bluetooth/pbp_public_broadcast_source/sample.yaml | 2 +- samples/bluetooth/tmap_peripheral/sample.yaml | 2 +- samples/net/zperf/sample.yaml | 2 +- 20 files changed, 22 insertions(+), 22 deletions(-) diff --git a/samples/bluetooth/bap_broadcast_sink/sample.yaml b/samples/bluetooth/bap_broadcast_sink/sample.yaml index b6360768f0ab5..5d06dee0bf89d 100644 --- a/samples/bluetooth/bap_broadcast_sink/sample.yaml +++ b/samples/bluetooth/bap_broadcast_sink/sample.yaml @@ -24,5 +24,5 @@ tests: - nrf52_bsim - nrf52833dk/nrf52833 - nrf52840dongle/nrf52840 - extra_args: OVERLAY_CONFIG=overlay-bt_ll_sw_split.conf + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/bap_broadcast_source/sample.yaml b/samples/bluetooth/bap_broadcast_source/sample.yaml index 27262103b29db..246a62a535f47 100644 --- a/samples/bluetooth/bap_broadcast_source/sample.yaml +++ b/samples/bluetooth/bap_broadcast_source/sample.yaml @@ -25,5 +25,5 @@ tests: - nrf52_bsim - nrf52833dk/nrf52833 - nrf52840dongle/nrf52840 - extra_args: OVERLAY_CONFIG=overlay-bt_ll_sw_split.conf + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/bap_unicast_client/sample.yaml b/samples/bluetooth/bap_unicast_client/sample.yaml index 536ab9144f0df..7283090b87813 100644 --- a/samples/bluetooth/bap_unicast_client/sample.yaml +++ b/samples/bluetooth/bap_unicast_client/sample.yaml @@ -22,5 +22,5 @@ tests: - nrf52840dk/nrf52840 integration_platforms: - nrf52dk/nrf52832 - extra_args: OVERLAY_CONFIG=overlay-bt_ll_sw_split.conf + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/bap_unicast_server/sample.yaml b/samples/bluetooth/bap_unicast_server/sample.yaml index fc14175a2d1aa..068f752b626b0 100644 --- a/samples/bluetooth/bap_unicast_server/sample.yaml +++ b/samples/bluetooth/bap_unicast_server/sample.yaml @@ -22,5 +22,5 @@ tests: - nrf52840dk/nrf52840 integration_platforms: - nrf52dk/nrf52832 - extra_args: OVERLAY_CONFIG=overlay-bt_ll_sw_split.conf + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/cap_acceptor/sample.yaml b/samples/bluetooth/cap_acceptor/sample.yaml index 6be99aab18382..824e744eecaff 100644 --- a/samples/bluetooth/cap_acceptor/sample.yaml +++ b/samples/bluetooth/cap_acceptor/sample.yaml @@ -26,5 +26,5 @@ tests: - nrf52833dk/nrf52833 - nrf52840dk/nrf52840 - nrf52840dongle/nrf52840 - extra_args: OVERLAY_CONFIG=overlay-bt_ll_sw_split.conf + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/cap_initiator/sample.yaml b/samples/bluetooth/cap_initiator/sample.yaml index 12a6022bcd7d0..b4f593c991295 100644 --- a/samples/bluetooth/cap_initiator/sample.yaml +++ b/samples/bluetooth/cap_initiator/sample.yaml @@ -26,5 +26,5 @@ tests: - nrf52833dk/nrf52833 - nrf52840dk/nrf52840 - nrf52840dongle/nrf52840 - extra_args: OVERLAY_CONFIG=overlay-bt_ll_sw_split.conf + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/direction_finding_central/sample.yaml b/samples/bluetooth/direction_finding_central/sample.yaml index b0c94537b518b..b7a118e6cdc85 100644 --- a/samples/bluetooth/direction_finding_central/sample.yaml +++ b/samples/bluetooth/direction_finding_central/sample.yaml @@ -16,7 +16,7 @@ tests: - nrf5340dk/nrf5340/cpuapp sample.bluetooth.direction_finding.central.aod: harness: bluetooth - extra_args: OVERLAY_CONFIG="overlay-aod.conf" + extra_args: EXTRA_CONF_FILE="overlay-aod.conf" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 diff --git a/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml b/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml index 1c79df412757a..8e6097de58aeb 100644 --- a/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml +++ b/samples/bluetooth/direction_finding_connectionless_rx/sample.yaml @@ -14,7 +14,7 @@ tests: - nrf5340dk/nrf5340/cpuapp sample.bluetooth.direction_finding_connectionless_rx.aod: harness: bluetooth - extra_args: OVERLAY_CONFIG="overlay-aod.conf" + extra_args: EXTRA_CONF_FILE="overlay-aod.conf" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 diff --git a/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml b/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml index 1ea189f508853..78d21b2c95f5a 100644 --- a/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml +++ b/samples/bluetooth/direction_finding_connectionless_tx/sample.yaml @@ -14,7 +14,7 @@ tests: - nrf5340dk/nrf5340/cpuapp sample.bluetooth.direction_finding_connectionless.aoa: harness: bluetooth - extra_args: OVERLAY_CONFIG="overlay-aoa.conf" + extra_args: EXTRA_CONF_FILE="overlay-aoa.conf" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 diff --git a/samples/bluetooth/direction_finding_peripheral/sample.yaml b/samples/bluetooth/direction_finding_peripheral/sample.yaml index 126355a735f51..f300cb415cc5e 100644 --- a/samples/bluetooth/direction_finding_peripheral/sample.yaml +++ b/samples/bluetooth/direction_finding_peripheral/sample.yaml @@ -16,7 +16,7 @@ tests: - nrf5340dk/nrf5340/cpuapp sample.bluetooth.direction_finding.peripheral.aod: harness: bluetooth - extra_args: OVERLAY_CONFIG="overlay-aoa.conf" + extra_args: EXTRA_CONF_FILE="overlay-aoa.conf" platform_allow: - nrf52833dk/nrf52833 - nrf52833dk/nrf52820 diff --git a/samples/bluetooth/hap_ha/sample.yaml b/samples/bluetooth/hap_ha/sample.yaml index 43888c252f3f2..d84e7bad0c646 100644 --- a/samples/bluetooth/hap_ha/sample.yaml +++ b/samples/bluetooth/hap_ha/sample.yaml @@ -21,14 +21,14 @@ tests: platform_allow: - native_sim tags: bluetooth - extra_args: OVERLAY_CONFIG="banded.conf" + extra_args: EXTRA_CONF_FILE="banded.conf" build_only: true sample.bluetooth.hap_ha.binaural: harness: bluetooth platform_allow: - native_sim tags: bluetooth - extra_args: OVERLAY_CONFIG="binaural.conf" + extra_args: EXTRA_CONF_FILE="binaural.conf" build_only: true extra_configs: - CONFIG_HAP_HA_SET_RANK=2 diff --git a/samples/bluetooth/hci_uart/sample.yaml b/samples/bluetooth/hci_uart/sample.yaml index 2c26b08208573..b555a74ac5bcd 100644 --- a/samples/bluetooth/hci_uart/sample.yaml +++ b/samples/bluetooth/hci_uart/sample.yaml @@ -82,7 +82,7 @@ tests: integration_platforms: - nrf52833dk/nrf52833 extra_args: - - OVERLAY_CONFIG=overlay-all-bt_ll_sw_split.conf + - EXTRA_CONF_FILE=overlay-all-bt_ll_sw_split.conf - DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay tags: - uart @@ -93,7 +93,7 @@ tests: integration_platforms: - nrf54l15dk/nrf54l15/cpuapp extra_args: - - OVERLAY_CONFIG=overlay-all-bt_ll_sw_split.conf + - EXTRA_CONF_FILE=overlay-all-bt_ll_sw_split.conf - DTC_OVERLAY_FILE=./boards/nrf54l15dk_nrf54l15_cpuapp_df.overlay tags: - uart diff --git a/samples/bluetooth/hci_uart_3wire/sample.yaml b/samples/bluetooth/hci_uart_3wire/sample.yaml index 19e799cf853c4..60d450600dae8 100644 --- a/samples/bluetooth/hci_uart_3wire/sample.yaml +++ b/samples/bluetooth/hci_uart_3wire/sample.yaml @@ -53,7 +53,7 @@ tests: integration_platforms: - nrf52833dk/nrf52833 extra_args: - - OVERLAY_CONFIG=overlay-all-bt_ll_sw_split.conf + - EXTRA_CONF_FILE=overlay-all-bt_ll_sw_split.conf - DTC_OVERLAY_FILE=./boards/nrf52833dk_nrf52833_df.overlay tags: - uart diff --git a/samples/bluetooth/iso_broadcast/sample.yaml b/samples/bluetooth/iso_broadcast/sample.yaml index 92bde54d7a0c7..58dbc5f2a9323 100644 --- a/samples/bluetooth/iso_broadcast/sample.yaml +++ b/samples/bluetooth/iso_broadcast/sample.yaml @@ -20,5 +20,5 @@ tests: - nrf52833dk/nrf52833 integration_platforms: - nrf52833dk/nrf52833 - extra_args: OVERLAY_CONFIG=overlay-bt_ll_sw_split.conf + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/iso_central/sample.yaml b/samples/bluetooth/iso_central/sample.yaml index d4350e0d9cfbd..3a7dedd404aee 100644 --- a/samples/bluetooth/iso_central/sample.yaml +++ b/samples/bluetooth/iso_central/sample.yaml @@ -17,5 +17,5 @@ tests: - nrf52833dk/nrf52833 integration_platforms: - nrf52833dk/nrf52833 - extra_args: OVERLAY_CONFIG=overlay-bt_ll_sw_split.conf + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/iso_receive/sample.yaml b/samples/bluetooth/iso_receive/sample.yaml index 2a065b7baa22d..a74b2249abe71 100644 --- a/samples/bluetooth/iso_receive/sample.yaml +++ b/samples/bluetooth/iso_receive/sample.yaml @@ -20,5 +20,5 @@ tests: - nrf52dk/nrf52832 integration_platforms: - nrf52dk/nrf52832 - extra_args: OVERLAY_CONFIG=overlay-bt_ll_sw_split.conf + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml b/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml index 2c4d31fd4b98e..d7c816ee5b76a 100644 --- a/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml +++ b/samples/bluetooth/pbp_public_broadcast_sink/sample.yaml @@ -23,5 +23,5 @@ tests: integration_platforms: - nrf52_bsim - nrf52833dk/nrf52833 - extra_args: OVERLAY_CONFIG=overlay-bt_ll_sw_split.conf + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/pbp_public_broadcast_source/sample.yaml b/samples/bluetooth/pbp_public_broadcast_source/sample.yaml index 31809027f2921..80c907042119e 100644 --- a/samples/bluetooth/pbp_public_broadcast_source/sample.yaml +++ b/samples/bluetooth/pbp_public_broadcast_source/sample.yaml @@ -23,5 +23,5 @@ tests: integration_platforms: - nrf52_bsim - nrf52833dk/nrf52833 - extra_args: OVERLAY_CONFIG=overlay-bt_ll_sw_split.conf + extra_args: EXTRA_CONF_FILE=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/tmap_peripheral/sample.yaml b/samples/bluetooth/tmap_peripheral/sample.yaml index a27626359685c..ebb6fcb9df08a 100644 --- a/samples/bluetooth/tmap_peripheral/sample.yaml +++ b/samples/bluetooth/tmap_peripheral/sample.yaml @@ -18,7 +18,7 @@ tests: - qemu_x86 - native_sim tags: bluetooth - extra_args: OVERLAY_CONFIG="duo.conf" + extra_args: EXTRA_CONF_FILE="duo.conf" extra_configs: - CONFIG_TMAP_PERIPHERAL_SET_RANK=2 integration_platforms: diff --git a/samples/net/zperf/sample.yaml b/samples/net/zperf/sample.yaml index 42238923f71a9..35fbfd42e6bfc 100644 --- a/samples/net/zperf/sample.yaml +++ b/samples/net/zperf/sample.yaml @@ -53,7 +53,7 @@ tests: depends_on: usb_device sample.net.zperf.device_next_ncm: harness: net - extra_args: OVERLAY_CONFIG="overlay-usbd_next.conf" + extra_args: EXTRA_CONF_FILE="overlay-usbd_next.conf" DTC_OVERLAY_FILE="usbd_next_ncm.overlay" platform_allow: nrf52840dk/nrf52840 frdm_k64f tags: usb net zperf From 8785b184e63d676fd23c378793a7a7ff26b3ccfa Mon Sep 17 00:00:00 2001 From: Abderrahmane Jarmouni Date: Fri, 18 Oct 2024 23:54:28 +0200 Subject: [PATCH 1504/4482] samples: subsys: shell: devmem_load: fix incorrect use of OVERLAY_CONFIG Replace OVERLAY_CONFIG with CONF_FILE since the file in question contains an alternative configuration to the one in prj.conf as clearly stated in the sample doc 'If you use poll you should also use `prj_poll.conf` instead of `prj.conf`.' Signed-off-by: Abderrahmane Jarmouni --- samples/subsys/shell/devmem_load/README.md | 2 +- samples/subsys/shell/devmem_load/sample.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/subsys/shell/devmem_load/README.md b/samples/subsys/shell/devmem_load/README.md index 9238ed31c5e6b..13ef263443d3b 100644 --- a/samples/subsys/shell/devmem_load/README.md +++ b/samples/subsys/shell/devmem_load/README.md @@ -20,7 +20,7 @@ west flash Building for boards without UART interrupt support: ```bash -west build -b native_sim -- -DEXTRA_CONF_FILE=prj_poll.conf samples/subsys/shell/devmem_load +west build -b native_sim -- -DCONF_FILE=prj_poll.conf samples/subsys/shell/devmem_load ``` ## Running After connecting to the UART console you should see the following output: diff --git a/samples/subsys/shell/devmem_load/sample.yaml b/samples/subsys/shell/devmem_load/sample.yaml index e4702ca5a965b..39ab65eede589 100644 --- a/samples/subsys/shell/devmem_load/sample.yaml +++ b/samples/subsys/shell/devmem_load/sample.yaml @@ -10,7 +10,7 @@ tests: sample.devmem_load.polled: integration_platforms: - native_sim - extra_args: EXTRA_CONF_FILE="prj_poll.conf" + extra_args: CONF_FILE="prj_poll.conf" sample.devmem_load.uart.interrupt: integration_platforms: - frdm_k64f From 94b000591d1da4771d8f544234f0e608b5007f5a Mon Sep 17 00:00:00 2001 From: Abderrahmane Jarmouni Date: Sat, 19 Oct 2024 00:03:30 +0200 Subject: [PATCH 1505/4482] tests: testcase.yaml: replace deprecated OVERLAY_CONFIG w\ EXTRA_CONF_FILE Replace some OVERLAY_CONFIG that were missed in a pervious PR. Signed-off-by: Abderrahmane Jarmouni --- tests/bluetooth/shell/testcase.yaml | 2 +- tests/bluetooth/tester/testcase.yaml | 4 ++-- tests/bsim/bluetooth/ll/bis/testcase.yaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/bluetooth/shell/testcase.yaml b/tests/bluetooth/shell/testcase.yaml index 80c2b054adf15..f8c3b7abb299d 100644 --- a/tests/bluetooth/shell/testcase.yaml +++ b/tests/bluetooth/shell/testcase.yaml @@ -42,7 +42,7 @@ tests: build_only: true bluetooth.shell.cdc_acm: extra_args: - - OVERLAY_CONFIG=cdc_acm.conf + - EXTRA_CONF_FILE=cdc_acm.conf - DTC_OVERLAY_FILE="usb.overlay" depends_on: usb_device platform_allow: diff --git a/tests/bluetooth/tester/testcase.yaml b/tests/bluetooth/tester/testcase.yaml index 80d96ef028763..62e999adaa1d2 100644 --- a/tests/bluetooth/tester/testcase.yaml +++ b/tests/bluetooth/tester/testcase.yaml @@ -23,7 +23,7 @@ tests: - native_sim - nrf5340dk/nrf5340/cpuapp - nrf5340_audio_dk/nrf5340/cpuapp - extra_args: OVERLAY_CONFIG="overlay-le-audio.conf" + extra_args: EXTRA_CONF_FILE="overlay-le-audio.conf" tags: bluetooth harness: bluetooth bluetooth.general.tester_mesh: @@ -32,6 +32,6 @@ tests: - qemu_x86 - native_sim - nrf52840dk/nrf52840 - extra_args: OVERLAY_CONFIG="overlay-mesh.conf" + extra_args: EXTRA_CONF_FILE="overlay-mesh.conf" tags: bluetooth harness: bluetooth diff --git a/tests/bsim/bluetooth/ll/bis/testcase.yaml b/tests/bsim/bluetooth/ll/bis/testcase.yaml index 2b75f6b2c28bc..dc88c8b144688 100644 --- a/tests/bsim/bluetooth/ll/bis/testcase.yaml +++ b/tests/bsim/bluetooth/ll/bis/testcase.yaml @@ -19,7 +19,7 @@ tests: harness_config: bsim_exe_name: tests_bsim_bluetooth_ll_bis_prj_conf bluetooth.ll.bis_ticker_expire_info: - extra_args: OVERLAY_CONFIG=overlay-ticker_expire_info.conf + extra_args: EXTRA_CONF_FILE=overlay-ticker_expire_info.conf platform_allow: - nrf52_bsim - nrf5340bsim/nrf5340/cpunet From d32c58b8cf19e6908a22577ffc27eadcbc356878 Mon Sep 17 00:00:00 2001 From: Abderrahmane Jarmouni Date: Sat, 19 Oct 2024 00:05:26 +0200 Subject: [PATCH 1506/4482] tests: subsys: pm: power_mgmt: fix incorrect use of OVERLAY_CONFIG Replace OVERLAY_CONFIG with CONF_FILE since no-device-pm.conf contains an alternative configuration to the one in prj.conf Signed-off-by: Abderrahmane Jarmouni --- tests/subsys/pm/power_mgmt/testcase.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/subsys/pm/power_mgmt/testcase.yaml b/tests/subsys/pm/power_mgmt/testcase.yaml index 9f87ac0d66645..51e7e6e618d01 100644 --- a/tests/subsys/pm/power_mgmt/testcase.yaml +++ b/tests/subsys/pm/power_mgmt/testcase.yaml @@ -5,4 +5,4 @@ tests: pm.system: {} pm.system.no.device.pm: extra_args: - - EXTRA_CONF_FILE="no-device-pm.conf" + - CONF_FILE="no-device-pm.conf" From 4d3f6a3145a61c9d767ce4a19f624505a1d7d076 Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Thu, 17 Oct 2024 00:16:39 +0200 Subject: [PATCH 1507/4482] drivers: dma: si32: Improve start and stop logic As per dma_stop() documentation, the implementation has to not just stop the transfer, but also to disable the channel. Before this commit, only the transfer has been stopped. Same goes for dma_start(). This also allows the enabling of a channel to be removed from dma_si32_config(). Signed-off-by: Reto Schneider --- drivers/dma/dma_si32.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/dma/dma_si32.c b/drivers/dma/dma_si32.c index 2e015af1370e0..f8dbea09ee7b5 100644 --- a/drivers/dma/dma_si32.c +++ b/drivers/dma/dma_si32.c @@ -333,8 +333,6 @@ static int dma_si32_config(const struct device *dev, uint32_t channel, struct dm return -EINVAL; } - SI32_DMACTRL_A_enable_channel(SI32_DMACTRL_0, channel); - return 0; } @@ -365,7 +363,6 @@ static int dma_si32_start(const struct device *dev, const uint32_t channel) __ASSERT(SI32_DMACTRL_A_is_primary_selected(SI32_DMACTRL_0, channel), "Primary descriptors must be used for basic and auto-request operations."); __ASSERT(SI32_SCONFIG_0->CONFIG.FDMAEN, "Fast mode is recommened to be enabled."); - __ASSERT(SI32_DMACTRL_0->CHENSET.U32 & BIT(channel), "Channel must be enabled."); __ASSERT(SI32_DMACTRL_0->CHSTATUS.U32 & BIT(channel), "Channel must be waiting for request"); @@ -377,6 +374,8 @@ static int dma_si32_start(const struct device *dev, const uint32_t channel) /* Enable interrupt for this DMA channels. */ irq_enable(DMACH0_IRQn + channel); + SI32_DMACTRL_A_enable_channel(SI32_DMACTRL_0, channel); + /* memory-to-memory transfers have to be started by this driver. When peripherals are * involved, the caller has to enable the peripheral to start the transfer. */ @@ -405,6 +404,8 @@ static int dma_si32_stop(const struct device *dev, const uint32_t channel) channel_descriptors[channel].CONFIG.TMD = 0; /* Stop the DMA channel. */ + SI32_DMACTRL_A_disable_channel(SI32_DMACTRL_0, channel); + return 0; } From 67cb174241b573b699db0bea2b24de2e919d3539 Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Wed, 16 Oct 2024 23:43:58 +0200 Subject: [PATCH 1508/4482] drivers: dma: si32: Prevent configuration of in-use DMA channel As per Zephyr DMA documentation, dma_config() must not be done on a running channel. Signed-off-by: Reto Schneider --- drivers/dma/dma_si32.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/dma/dma_si32.c b/drivers/dma/dma_si32.c index f8dbea09ee7b5..f6b8a46f1177c 100644 --- a/drivers/dma/dma_si32.c +++ b/drivers/dma/dma_si32.c @@ -141,6 +141,14 @@ static int dma_si32_config(const struct device *dev, uint32_t channel, struct dm return -EINVAL; } + /* Prevent messing up (potentially) ongoing DMA operations and their settings. This behavior + * is required by the Zephyr DMA API. + */ + if (SI32_DMACTRL_A_is_channel_enabled(SI32_DMACTRL_0, channel)) { + LOG_ERR("DMA channel is currently in use"); + return -EBUSY; + } + channel_descriptor = &channel_descriptors[channel]; if (cfg == NULL) { From 868e99aefb7f9477e21517d445502ebc8e38d533 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Tue, 23 Apr 2024 18:37:44 +0900 Subject: [PATCH 1509/4482] drivers: display: dummy: Enable config if `dummy-dc` device available Enabling the configuration if there is a valid `dummy-dc` node on the device tree. Signed-off-by: TOKITA Hiroshi --- drivers/display/Kconfig.dummy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/display/Kconfig.dummy b/drivers/display/Kconfig.dummy index d906afb4e292c..5961bca8180ad 100644 --- a/drivers/display/Kconfig.dummy +++ b/drivers/display/Kconfig.dummy @@ -5,5 +5,7 @@ config DUMMY_DISPLAY bool "Dummy display driver" + default y + depends on DT_HAS_ZEPHYR_DUMMY_DC_ENABLED help Enable dummy display driver compliant with display driver API. From 7c076a4d5e86b98044f52320e1c04f3cc2061444 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Mon, 14 Oct 2024 20:38:26 +0900 Subject: [PATCH 1510/4482] samples: drivers: display: Remove explicitly enabled CONFIG_DUMMY_DISPLAY The CONFIG_DUMMY_DISPLAY is now enabled in conjunction with devicetree, So, no need to be explicitly enabled. Remove the setting. Signed-off-by: TOKITA Hiroshi --- samples/drivers/display/sample.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/drivers/display/sample.yaml b/samples/drivers/display/sample.yaml index e2f359bbc66e2..41e728e38b366 100644 --- a/samples/drivers/display/sample.yaml +++ b/samples/drivers/display/sample.yaml @@ -14,7 +14,6 @@ tests: - native_sim extra_args: DTC_OVERLAY_FILE="dummy_dc.overlay" extra_configs: - - CONFIG_DUMMY_DISPLAY=y - CONFIG_SDL_DISPLAY=n - CONFIG_TEST=y tags: display From 00c5ff77f1f96c83d0df794723063034efeb22d7 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Mon, 14 Oct 2024 21:26:52 +0900 Subject: [PATCH 1511/4482] tests: lib: gui: lvgl: Remove explicitly enabled CONFIG_DUMMY_DISPLAY The CONFIG_DUMMY_DISPLAY is now enabled in conjunction with devicetree, So, no need to be explicitly enabled. Remove the setting. Signed-off-by: TOKITA Hiroshi --- tests/lib/gui/lvgl/prj.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/lib/gui/lvgl/prj.conf b/tests/lib/gui/lvgl/prj.conf index 9266865569293..2667982e6e048 100644 --- a/tests/lib/gui/lvgl/prj.conf +++ b/tests/lib/gui/lvgl/prj.conf @@ -2,7 +2,6 @@ CONFIG_ZTEST=y CONFIG_DISPLAY=y CONFIG_SDL_DISPLAY=n -CONFIG_DUMMY_DISPLAY=y CONFIG_LOG=y From 2ec5fb4a4b8c11d7f4a82c85d2033b068cc06152 Mon Sep 17 00:00:00 2001 From: Jonas Remmert Date: Thu, 24 Oct 2024 00:08:31 +0200 Subject: [PATCH 1512/4482] boards: PHYTEC: phyboard_pollux: remove mimx8mp prefix For easier recognition PHYTEC boards have been prefixed with the SoC name. As the new hardware model includes the SoC and cpu, this prefixing is not needed anymore. All PHYTEC eval boards have an individual and unique name and can be found easily via this name. Signed-off-by: Jonas Remmert --- boards/deprecated.cmake | 5 +++- .../phytec/mimx8mp_phyboard_pollux/board.yml | 6 ---- .../Kconfig.phyboard_pollux} | 4 +-- .../board.cmake | 0 boards/phytec/phyboard_pollux/board.yml | 6 ++++ .../doc/img/PEB-EVAL-01.jpg | Bin .../doc/img/Phyboard_Pollux.jpg | Bin .../doc/index.rst | 28 +++++++++--------- .../phyboard_pollux-pinctrl.dtsi} | 0 .../phyboard_pollux_mimx8ml8_m7.dts} | 6 ++-- .../phyboard_pollux_mimx8ml8_m7.yaml} | 4 +-- .../phyboard_pollux_mimx8ml8_m7_defconfig} | 0 doc/_scripts/redirects.py | 1 + doc/releases/release-notes-4.0.rst | 2 ++ 14 files changed, 34 insertions(+), 28 deletions(-) delete mode 100644 boards/phytec/mimx8mp_phyboard_pollux/board.yml rename boards/phytec/{mimx8mp_phyboard_pollux/Kconfig.mimx8mp_phyboard_pollux => phyboard_pollux/Kconfig.phyboard_pollux} (53%) rename boards/phytec/{mimx8mp_phyboard_pollux => phyboard_pollux}/board.cmake (100%) create mode 100644 boards/phytec/phyboard_pollux/board.yml rename boards/phytec/{mimx8mp_phyboard_pollux => phyboard_pollux}/doc/img/PEB-EVAL-01.jpg (100%) rename boards/phytec/{mimx8mp_phyboard_pollux => phyboard_pollux}/doc/img/Phyboard_Pollux.jpg (100%) rename boards/phytec/{mimx8mp_phyboard_pollux => phyboard_pollux}/doc/index.rst (92%) rename boards/phytec/{mimx8mp_phyboard_pollux/mimx8mp_phyboard_pollux-pinctrl.dtsi => phyboard_pollux/phyboard_pollux-pinctrl.dtsi} (100%) rename boards/phytec/{mimx8mp_phyboard_pollux/mimx8mp_phyboard_pollux_mimx8ml8_m7.dts => phyboard_pollux/phyboard_pollux_mimx8ml8_m7.dts} (90%) rename boards/phytec/{mimx8mp_phyboard_pollux/mimx8mp_phyboard_pollux_mimx8ml8_m7.yaml => phyboard_pollux/phyboard_pollux_mimx8ml8_m7.yaml} (77%) rename boards/phytec/{mimx8mp_phyboard_pollux/mimx8mp_phyboard_pollux_mimx8ml8_m7_defconfig => phyboard_pollux/phyboard_pollux_mimx8ml8_m7_defconfig} (100%) diff --git a/boards/deprecated.cmake b/boards/deprecated.cmake index 6295bb5444157..2260dd4c038a7 100644 --- a/boards/deprecated.cmake +++ b/boards/deprecated.cmake @@ -386,7 +386,7 @@ set(mimx8mp_evk_itcm_DEPRECATED imx8mp_evk/mimx8ml8/m7 ) set(mimx8mp_phyboard_pollux_DEPRECATED - mimx8mp_phyboard_pollux/mimx8ml8/m7 + phyboard_pollux/mimx8ml8/m7 ) set(mimx8mq_evk_cm4_DEPRECATED imx8mq_evk/mimx8mq6/m4 @@ -910,3 +910,6 @@ set(xiao_esp32s3_DEPRECATED set(yd_esp32_DEPRECATED yd_esp32/esp32/procpu ) +set(mimx8mp_phyboard_pollux/mimx8ml8/m7_DEPRECATED + phyboard_pollux/mimx8ml8/m7 +) diff --git a/boards/phytec/mimx8mp_phyboard_pollux/board.yml b/boards/phytec/mimx8mp_phyboard_pollux/board.yml deleted file mode 100644 index a8e5cbf9a0a71..0000000000000 --- a/boards/phytec/mimx8mp_phyboard_pollux/board.yml +++ /dev/null @@ -1,6 +0,0 @@ -board: - name: mimx8mp_phyboard_pollux - full_name: PhyBOARD Pollux (NXP i.MX8M Plus) - vendor: phytec - socs: - - name: mimx8ml8 diff --git a/boards/phytec/mimx8mp_phyboard_pollux/Kconfig.mimx8mp_phyboard_pollux b/boards/phytec/phyboard_pollux/Kconfig.phyboard_pollux similarity index 53% rename from boards/phytec/mimx8mp_phyboard_pollux/Kconfig.mimx8mp_phyboard_pollux rename to boards/phytec/phyboard_pollux/Kconfig.phyboard_pollux index d0f63578fe27b..3d09a55b2aa84 100644 --- a/boards/phytec/mimx8mp_phyboard_pollux/Kconfig.mimx8mp_phyboard_pollux +++ b/boards/phytec/phyboard_pollux/Kconfig.phyboard_pollux @@ -1,6 +1,6 @@ # Copyright (c) 2022 PHYTEC Messtechnik GmbH # SPDX-License-Identifier: Apache-2.0 -config BOARD_MIMX8MP_PHYBOARD_POLLUX - select SOC_MIMX8ML8_M7 if BOARD_MIMX8MP_PHYBOARD_POLLUX_MIMX8ML8_M7 +config BOARD_PHYBOARD_POLLUX + select SOC_MIMX8ML8_M7 if BOARD_PHYBOARD_POLLUX_MIMX8ML8_M7 select SOC_PART_NUMBER_MIMX8ML8DVNLZ diff --git a/boards/phytec/mimx8mp_phyboard_pollux/board.cmake b/boards/phytec/phyboard_pollux/board.cmake similarity index 100% rename from boards/phytec/mimx8mp_phyboard_pollux/board.cmake rename to boards/phytec/phyboard_pollux/board.cmake diff --git a/boards/phytec/phyboard_pollux/board.yml b/boards/phytec/phyboard_pollux/board.yml new file mode 100644 index 0000000000000..a636af4d8aaf6 --- /dev/null +++ b/boards/phytec/phyboard_pollux/board.yml @@ -0,0 +1,6 @@ +board: + name: phyboard_pollux + full_name: phyBOARD-Pollux i.MX8M Plus + vendor: phytec + socs: + - name: mimx8ml8 diff --git a/boards/phytec/mimx8mp_phyboard_pollux/doc/img/PEB-EVAL-01.jpg b/boards/phytec/phyboard_pollux/doc/img/PEB-EVAL-01.jpg similarity index 100% rename from boards/phytec/mimx8mp_phyboard_pollux/doc/img/PEB-EVAL-01.jpg rename to boards/phytec/phyboard_pollux/doc/img/PEB-EVAL-01.jpg diff --git a/boards/phytec/mimx8mp_phyboard_pollux/doc/img/Phyboard_Pollux.jpg b/boards/phytec/phyboard_pollux/doc/img/Phyboard_Pollux.jpg similarity index 100% rename from boards/phytec/mimx8mp_phyboard_pollux/doc/img/Phyboard_Pollux.jpg rename to boards/phytec/phyboard_pollux/doc/img/Phyboard_Pollux.jpg diff --git a/boards/phytec/mimx8mp_phyboard_pollux/doc/index.rst b/boards/phytec/phyboard_pollux/doc/index.rst similarity index 92% rename from boards/phytec/mimx8mp_phyboard_pollux/doc/index.rst rename to boards/phytec/phyboard_pollux/doc/index.rst index 6314b716513cc..73fa347b78310 100644 --- a/boards/phytec/mimx8mp_phyboard_pollux/doc/index.rst +++ b/boards/phytec/phyboard_pollux/doc/index.rst @@ -1,14 +1,14 @@ -.. _mimx8mp_phyboard_pollux: +.. _phyboard_pollux: -PhyBOARD Pollux (NXP i.MX8M Plus) -################################# +phyBOARD-Pollux i.MX8M Plus +########################### Overview ******** -The PhyBOARD Pollux is based upon the PhyCore-i.MX8M Plus SOM which is based on +The phyBOARD-Pollux is based upon the phyCORE-i.MX8M Plus SOM which is based on the NXP i.MX8M Plus SoC. The SoC includes four Coretex-A53 cores and one -Coretex-M7 core for real time applications like Zephyr. The PhyBOARD Pollux +Coretex-M7 core for real time applications like Zephyr. The phyBOARD-Pollux can be used for various applications like SmartHomes, Industry 4.0, IoT etc. It features a lots of interfaces and computing capacity. It can be used as a reference, to develop or in the final product too. @@ -33,7 +33,7 @@ Board features: - MMX/SD/SDIO: microSD slot - Display: LVDS(1x4 or 1x8), MIPI DSI(1x4), HDMI - Audio: SAI - - Camera: 2x MIPI CSI-2 (PhyCAM-M) + - Camera: 2x MIPI CSI-2 (phyCAM-M) - Expansion Bus: I2C, SPI, SDIO, UART, USB - JTAG: via PEB-EVAL-01 - LEDs: @@ -45,14 +45,14 @@ Board features: :width: 720px :align: center :height: 405px - :alt: PhyBOARD Pollux + :alt: phyBOARD-Pollux More information about the board can be found at the `PHYTEC website`_. Supported Features ================== -The Zephyr mimx8mp_phyboard_polis board configuration supports the following hardware +The Zephyr phyboard_polis board configuration supports the following hardware features: +-----------+------------+------------------------------------+ @@ -74,7 +74,7 @@ features: +-----------+------------+------------------------------------+ The default configuration can be found in the defconfig file: -:zephyr_file:`boards/phytec/mimx8mp_phyboard_pollux/mimx8mp_phyboard_pollux_mimx8ml8_m7_defconfig`. +:zephyr_file:`boards/phytec/phyboard_pollux/phyboard_pollux_mimx8ml8_m7_defconfig`. It's recommended to disable peripherals used by the M7-Core on the host running on the Linux host. Other hardware features are not currently supported with @@ -107,7 +107,7 @@ GPIO The pinmuxing for the GPIOs is the standard pinmuxing of the mimx8mp devicetree created by NXP and can be found at -:zephyr_file:`dts/arm/nxp/nxp_imx8ml_m7.dtsi`. The Pinout of the PhyBOARD Polis +:zephyr_file:`dts/arm/nxp/nxp_imx8ml_m7.dtsi`. The Pinout of the phyBOARD-Polis can be found at the `PHYTEC website`_. Programming and Debugging @@ -198,7 +198,7 @@ Connect to the console via your favorite terminal program. For example: Flashing and Debugging via JTAG =============================== -The PhyBOARD-Pollux can be debugged using a JTAG or SWD debug adapter. A Segger +The phyBOARD-Pollux can be debugged using a JTAG or SWD debug adapter. A Segger JLink can be connected to the compatible JTAG connector on Phytec's ``PEB-EVAL-01`` shield. @@ -219,7 +219,7 @@ Here is an example for the :zephyr:code-sample:`hello_world` application: .. zephyr-app-commands:: :zephyr-app: samples/hello_world - :board: mimx8mp_phyboard_pollux/mimx8ml8/m7 + :board: phyboard_pollux/mimx8ml8/m7 :goals: flash The console should now show the output of the application: @@ -227,13 +227,13 @@ The console should now show the output of the application: .. code-block:: console *** Booting Zephyr OS build v3.7.0 *** - Hello World! mimx8mp_phyboard_pollux/mimx8ml8/m7 + Hello World! phyboard_pollux/mimx8ml8/m7 Starting a debug session is similar to flashing: .. zephyr-app-commands:: :zephyr-app: samples/hello_world - :board: mimx8mp_phyboard_pollux/mimx8ml8/m7 + :board: phyboard_pollux/mimx8ml8/m7 :goals: debug Starting the M7-Core from U-Boot and Linux diff --git a/boards/phytec/mimx8mp_phyboard_pollux/mimx8mp_phyboard_pollux-pinctrl.dtsi b/boards/phytec/phyboard_pollux/phyboard_pollux-pinctrl.dtsi similarity index 100% rename from boards/phytec/mimx8mp_phyboard_pollux/mimx8mp_phyboard_pollux-pinctrl.dtsi rename to boards/phytec/phyboard_pollux/phyboard_pollux-pinctrl.dtsi diff --git a/boards/phytec/mimx8mp_phyboard_pollux/mimx8mp_phyboard_pollux_mimx8ml8_m7.dts b/boards/phytec/phyboard_pollux/phyboard_pollux_mimx8ml8_m7.dts similarity index 90% rename from boards/phytec/mimx8mp_phyboard_pollux/mimx8mp_phyboard_pollux_mimx8ml8_m7.dts rename to boards/phytec/phyboard_pollux/phyboard_pollux_mimx8ml8_m7.dts index b44577a4ee5e4..9376bfb1df7d0 100644 --- a/boards/phytec/mimx8mp_phyboard_pollux/mimx8mp_phyboard_pollux_mimx8ml8_m7.dts +++ b/boards/phytec/phyboard_pollux/phyboard_pollux_mimx8ml8_m7.dts @@ -7,11 +7,11 @@ /dts-v1/; #include -#include "mimx8mp_phyboard_pollux-pinctrl.dtsi" +#include "phyboard_pollux-pinctrl.dtsi" / { - model = "PhyBOARD Pollux (i.MX8MP)"; - compatible = "nxp,mimx8mp_phyboard_pollux"; + model = "phyBOARD-Pollux i.MX8MP"; + compatible = "nxp,phyboard_pollux"; chosen { /* TCM */ diff --git a/boards/phytec/mimx8mp_phyboard_pollux/mimx8mp_phyboard_pollux_mimx8ml8_m7.yaml b/boards/phytec/phyboard_pollux/phyboard_pollux_mimx8ml8_m7.yaml similarity index 77% rename from boards/phytec/mimx8mp_phyboard_pollux/mimx8mp_phyboard_pollux_mimx8ml8_m7.yaml rename to boards/phytec/phyboard_pollux/phyboard_pollux_mimx8ml8_m7.yaml index aa2cc09a553c2..01084520792db 100644 --- a/boards/phytec/mimx8mp_phyboard_pollux/mimx8mp_phyboard_pollux_mimx8ml8_m7.yaml +++ b/boards/phytec/phyboard_pollux/phyboard_pollux_mimx8ml8_m7.yaml @@ -4,8 +4,8 @@ # SPDX-License-Identifier: Apache-2.0 # -identifier: mimx8mp_phyboard_pollux/mimx8ml8/m7 -name: PhyBOARD Pollux (i.MX8MP) +identifier: phyboard_pollux/mimx8ml8/m7 +name: phyBOARD-Pollux i.MX8MP type: mcu arch: arm ram: 128 diff --git a/boards/phytec/mimx8mp_phyboard_pollux/mimx8mp_phyboard_pollux_mimx8ml8_m7_defconfig b/boards/phytec/phyboard_pollux/phyboard_pollux_mimx8ml8_m7_defconfig similarity index 100% rename from boards/phytec/mimx8mp_phyboard_pollux/mimx8mp_phyboard_pollux_mimx8ml8_m7_defconfig rename to boards/phytec/phyboard_pollux/phyboard_pollux_mimx8ml8_m7_defconfig diff --git a/doc/_scripts/redirects.py b/doc/_scripts/redirects.py index 0760f20af8976..06939caf849f4 100644 --- a/doc/_scripts/redirects.py +++ b/doc/_scripts/redirects.py @@ -16,6 +16,7 @@ # zephyr-keep-sorted-start ('application/index', 'develop/application/index'), ('boards/arduino/uno_r4_minima/doc/index', 'boards/arduino/uno_r4/doc/index'), + ('boards/phytec/mimx8mp_phyboard_pollux/doc/index', 'boards/phytec/phyboard_pollux/doc/index'), ('boards/rak/index', 'boards/rakwireless/index'), ('boards/rak/rak11720/doc/index', 'boards/rakwireless/rak11720/doc/index'), ('boards/rak/rak4631/doc/index', 'boards/rakwireless/rak4631/doc/index'), diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 0fcc7db7ead27..f633f54e2a376 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -160,6 +160,8 @@ Boards & SoC Support * STM32: Deprecated MCO configuration via Kconfig in favour of setting it through devicetree. See ``samples/boards/stm32/mco`` sample. * Removed the ``nrf54l15pdk`` board, use :ref:`nrf54l15dk_nrf54l15` instead. + * PHYTEC: ``mimx8mp_phyboard_pollux`` has been renamed to :ref:`phyboard_pollux`, + with the old name marked as deprecated. * Added support for the following shields: From 4dc2f6fd1cacb8cda3a658ccafff2ba00e624b9e Mon Sep 17 00:00:00 2001 From: Jonas Remmert Date: Thu, 24 Oct 2024 00:25:08 +0200 Subject: [PATCH 1513/4482] boards: PHYTEC: phyboard_polis: remove mimx8mm prefix For easier recognition PHYTEC boards have been prefixed with the SoC name. As the new hardware model includes the SoC and cpu, this prefixing is not needed anymore. All PHYTEC eval boards have an individual and unique name and can be found easily via this name. Signed-off-by: Jonas Remmert --- boards/deprecated.cmake | 5 +++- .../phytec/mimx8mm_phyboard_polis/board.yml | 6 ---- .../Kconfig.phyboard_polis} | 4 +-- .../board.cmake | 0 boards/phytec/phyboard_polis/board.yml | 6 ++++ .../doc/img/PEB-EVAL-01.jpg | Bin .../doc/img/phyBOARD-Polis.jpg | Bin .../doc/index.rst | 28 +++++++++--------- .../phyboard_polis-pinctrl.dtsi} | 0 .../phyboard_polis_mimx8mm6_m4.dts} | 6 ++-- .../phyboard_polis_mimx8mm6_m4.yaml} | 4 +-- .../phyboard_polis_mimx8mm6_m4_defconfig} | 0 doc/_scripts/redirects.py | 1 + doc/releases/release-notes-4.0.rst | 2 ++ 14 files changed, 34 insertions(+), 28 deletions(-) delete mode 100644 boards/phytec/mimx8mm_phyboard_polis/board.yml rename boards/phytec/{mimx8mm_phyboard_polis/Kconfig.mimx8mm_phyboard_polis => phyboard_polis/Kconfig.phyboard_polis} (57%) rename boards/phytec/{mimx8mm_phyboard_polis => phyboard_polis}/board.cmake (100%) create mode 100644 boards/phytec/phyboard_polis/board.yml rename boards/phytec/{mimx8mm_phyboard_polis => phyboard_polis}/doc/img/PEB-EVAL-01.jpg (100%) rename boards/phytec/{mimx8mm_phyboard_polis => phyboard_polis}/doc/img/phyBOARD-Polis.jpg (100%) rename boards/phytec/{mimx8mm_phyboard_polis => phyboard_polis}/doc/index.rst (94%) rename boards/phytec/{mimx8mm_phyboard_polis/mimx8mm_phyboard_polis-pinctrl.dtsi => phyboard_polis/phyboard_polis-pinctrl.dtsi} (100%) rename boards/phytec/{mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4.dts => phyboard_polis/phyboard_polis_mimx8mm6_m4.dts} (94%) rename boards/phytec/{mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4.yaml => phyboard_polis/phyboard_polis_mimx8mm6_m4.yaml} (78%) rename boards/phytec/{mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4_defconfig => phyboard_polis/phyboard_polis_mimx8mm6_m4_defconfig} (100%) diff --git a/boards/deprecated.cmake b/boards/deprecated.cmake index 2260dd4c038a7..f15b8fbee42db 100644 --- a/boards/deprecated.cmake +++ b/boards/deprecated.cmake @@ -365,7 +365,7 @@ set(mimx8mm_evk_a53_smp_DEPRECATED imx8mm_evk/mimx8mm6/a53/smp ) set(mimx8mm_phyboard_polis_DEPRECATED - mimx8mm_phyboard_polis/mimx8mm6/m4 + phyboard_polis/mimx8mm6/m4 ) set(mimx8mn_evk_a53_DEPRECATED imx8mn_evk/mimx8mn6/a53 @@ -913,3 +913,6 @@ set(yd_esp32_DEPRECATED set(mimx8mp_phyboard_pollux/mimx8ml8/m7_DEPRECATED phyboard_pollux/mimx8ml8/m7 ) +set(mimx8mm_phyboard_polis/mimx8mm6/m4_DEPRECATED + phyboard_polis/mimx8mm6/m4 +) diff --git a/boards/phytec/mimx8mm_phyboard_polis/board.yml b/boards/phytec/mimx8mm_phyboard_polis/board.yml deleted file mode 100644 index 8f8342053548f..0000000000000 --- a/boards/phytec/mimx8mm_phyboard_polis/board.yml +++ /dev/null @@ -1,6 +0,0 @@ -board: - name: mimx8mm_phyboard_polis - full_name: PhyBOARD Polis (NXP i.MX8M Mini) - vendor: phytec - socs: - - name: mimx8mm6 diff --git a/boards/phytec/mimx8mm_phyboard_polis/Kconfig.mimx8mm_phyboard_polis b/boards/phytec/phyboard_polis/Kconfig.phyboard_polis similarity index 57% rename from boards/phytec/mimx8mm_phyboard_polis/Kconfig.mimx8mm_phyboard_polis rename to boards/phytec/phyboard_polis/Kconfig.phyboard_polis index 0039e251a76c7..e409b0f0fc417 100644 --- a/boards/phytec/mimx8mm_phyboard_polis/Kconfig.mimx8mm_phyboard_polis +++ b/boards/phytec/phyboard_polis/Kconfig.phyboard_polis @@ -2,6 +2,6 @@ # Copyright 2024 NXP # SPDX-License-Identifier: Apache-2.0 -config BOARD_MIMX8MM_PHYBOARD_POLIS +config BOARD_PHYBOARD_POLIS select SOC_PART_NUMBER_MIMX8MM6DVTLZ - select SOC_MIMX8MM6_M4 if BOARD_MIMX8MM_PHYBOARD_POLIS_MIMX8MM6_M4 + select SOC_MIMX8MM6_M4 if BOARD_PHYBOARD_POLIS_MIMX8MM6_M4 diff --git a/boards/phytec/mimx8mm_phyboard_polis/board.cmake b/boards/phytec/phyboard_polis/board.cmake similarity index 100% rename from boards/phytec/mimx8mm_phyboard_polis/board.cmake rename to boards/phytec/phyboard_polis/board.cmake diff --git a/boards/phytec/phyboard_polis/board.yml b/boards/phytec/phyboard_polis/board.yml new file mode 100644 index 0000000000000..2ca447ffb92ed --- /dev/null +++ b/boards/phytec/phyboard_polis/board.yml @@ -0,0 +1,6 @@ +board: + name: phyboard_polis + full_name: phyBOARD-Polis i.MX8M Mini + vendor: phytec + socs: + - name: mimx8mm6 diff --git a/boards/phytec/mimx8mm_phyboard_polis/doc/img/PEB-EVAL-01.jpg b/boards/phytec/phyboard_polis/doc/img/PEB-EVAL-01.jpg similarity index 100% rename from boards/phytec/mimx8mm_phyboard_polis/doc/img/PEB-EVAL-01.jpg rename to boards/phytec/phyboard_polis/doc/img/PEB-EVAL-01.jpg diff --git a/boards/phytec/mimx8mm_phyboard_polis/doc/img/phyBOARD-Polis.jpg b/boards/phytec/phyboard_polis/doc/img/phyBOARD-Polis.jpg similarity index 100% rename from boards/phytec/mimx8mm_phyboard_polis/doc/img/phyBOARD-Polis.jpg rename to boards/phytec/phyboard_polis/doc/img/phyBOARD-Polis.jpg diff --git a/boards/phytec/mimx8mm_phyboard_polis/doc/index.rst b/boards/phytec/phyboard_polis/doc/index.rst similarity index 94% rename from boards/phytec/mimx8mm_phyboard_polis/doc/index.rst rename to boards/phytec/phyboard_polis/doc/index.rst index b159b5a1ab738..f1229b4b17b27 100644 --- a/boards/phytec/mimx8mm_phyboard_polis/doc/index.rst +++ b/boards/phytec/phyboard_polis/doc/index.rst @@ -1,7 +1,7 @@ -.. _mimx8mm_phyboard_polis: +.. _phyboard_polis: -PhyBOARD Polis (NXP i.MX8M Mini) -################################ +phyBOARD-Polis i.MX8M Mini +########################## Overview ******** @@ -61,7 +61,7 @@ the phyCORE-i.MX 8M Mini/Nano. .. image:: img/phyBOARD-Polis.jpg :align: center - :alt: PhyBOARD Polis + :alt: phyBOARD-Polis :width: 500 More information about the board can be found at the @@ -70,8 +70,8 @@ More information about the board can be found at the Supported Features ================== -The Zephyr ``mimx8mm_phyboard_polis/mimx8mm6/m4`` board configuration supports the following -hardware features: +The Zephyr ``phyboard_polis/mimx8mm6/m4`` board target configuration supports +the following hardware features: +-----------+------------+-------------------------------------+ | Interface | Controller | Driver/Component | @@ -96,7 +96,7 @@ hardware features: +-----------+------------+-------------------------------------+ The default configuration can be found in the defconfig file: -:zephyr_file:`boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4_defconfig`. +:zephyr_file:`boards/phytec/phyboard_polis/phyboard_polis_mimx8mm6_m4_defconfig`. It is recommended to disable peripherals used by the M4 core on the Linux host. @@ -111,7 +111,7 @@ The following components are tested and working correctly. UART: ----- -Zephyr is configured to use UART4 on the PhyBoard Polis by default to minimize +Zephyr is configured to use UART4 on the phyBOARD-Polis by default to minimize problems with the A53-Core because UART4 is only accessible from the M4-Core. +---------------+-----------------+-----------------------------------+ @@ -137,7 +137,7 @@ problems with the A53-Core because UART4 is only accessible from the M4-Core. SPI: ---- -ECSPI is disabled by default. On phyBOARD Polis, the SoC's ECSPI3 is not +ECSPI is disabled by default. On phyBOARD-Polis, the SoC's ECSPI3 is not usable. ECSPI1 is connected to the MCP2518 CAN controller with a chip select. Another device can be connected via the expansion header (X8): @@ -174,9 +174,9 @@ devicetree. .. warning:: There is a bug in the MCP2518 driver that causes the enable pin of the transceiver to be not set. This causes a ENETDOWN error when trying to send - a CAN frame. Receiving CAN frames in `listen-only` mode is possible. + a CAN frame. Receiving CAN frames in *listen-only* mode is possible. -The Pinout of the PhyBOARD Polis can be found here: +The Pinout of the phyBOARD-Polis can be found here: `PHYTEC website`_ @@ -218,7 +218,7 @@ For more information about memory mapping see the At compilation time you have to choose which RAM will be used. This configuration is done in -:zephyr_file:`boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4.dts` +:zephyr_file:`boards/phytec/phyboard_polis/phyboard_polis_mimx8mm6_m4.dts` with "zephyr,flash" and "zephyr,sram" properties. The following configurations are possible for the flash and sram chosen nodes @@ -308,7 +308,7 @@ on UART4. Debugging ========= -The PhyBOARD Polis can be debugged using a JTAG Debugger. +The phyBOARD-Polis can be debugged using a JTAG Debugger. The easiest way to do that is to use a SEGGER JLink Debugger and Phytec's ``PEB-EVAL-01`` Shield, which can be directly connected to the JLink. You can find the JLink Software package here: `JLink Software`_ @@ -391,7 +391,7 @@ For example: disabling ECSPI1 in Linux to use it on the M4-Core with Zephyr: .. _PHYTEC website: https://www.phytec.de/produkte/single-board-computer/phyboard-polis-imx8m-mini/ -.. _PhyBOARD Polis pinout: +.. _phyBOARD-Polis pinout: https://download.phytec.de/Products/phyBOARD-Polis-iMX8M_Mini/TechData/phyCORE-i.MX8M_MINI_Pin_Muxing_Table.A1.xlsx?_ga=2.237582016.1177557183.1660563641-1900651135.1634193918 .. _Remoteproc BSP: diff --git a/boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis-pinctrl.dtsi b/boards/phytec/phyboard_polis/phyboard_polis-pinctrl.dtsi similarity index 100% rename from boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis-pinctrl.dtsi rename to boards/phytec/phyboard_polis/phyboard_polis-pinctrl.dtsi diff --git a/boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4.dts b/boards/phytec/phyboard_polis/phyboard_polis_mimx8mm6_m4.dts similarity index 94% rename from boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4.dts rename to boards/phytec/phyboard_polis/phyboard_polis_mimx8mm6_m4.dts index 8352a8e9b6bda..76f43a91fe36a 100644 --- a/boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4.dts +++ b/boards/phytec/phyboard_polis/phyboard_polis_mimx8mm6_m4.dts @@ -7,11 +7,11 @@ /dts-v1/; #include -#include "mimx8mm_phyboard_polis-pinctrl.dtsi" +#include "phyboard_polis-pinctrl.dtsi" / { - model = "Phyboard Polis NXP i.MX8M Mini"; - compatible = "nxp,mimx8mm_phyboard_polis"; + model = "phyBOARD-Polis i.MX8M Mini"; + compatible = "nxp,phyboard_polis"; aliases { uart-4 = &uart4; diff --git a/boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4.yaml b/boards/phytec/phyboard_polis/phyboard_polis_mimx8mm6_m4.yaml similarity index 78% rename from boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4.yaml rename to boards/phytec/phyboard_polis/phyboard_polis_mimx8mm6_m4.yaml index d2ca6718e1eb8..5167e4d0aece5 100644 --- a/boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4.yaml +++ b/boards/phytec/phyboard_polis/phyboard_polis_mimx8mm6_m4.yaml @@ -4,8 +4,8 @@ # SPDX-License-Identifier: Apache-2.0 # -identifier: mimx8mm_phyboard_polis/mimx8mm6/m4 -name: Phyboard Polis i.MX8M Mini +identifier: phyboard_polis/mimx8mm6/m4 +name: phyBOARD-Polis i.MX8M Mini type: mcu arch: arm ram: 128 diff --git a/boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4_defconfig b/boards/phytec/phyboard_polis/phyboard_polis_mimx8mm6_m4_defconfig similarity index 100% rename from boards/phytec/mimx8mm_phyboard_polis/mimx8mm_phyboard_polis_mimx8mm6_m4_defconfig rename to boards/phytec/phyboard_polis/phyboard_polis_mimx8mm6_m4_defconfig diff --git a/doc/_scripts/redirects.py b/doc/_scripts/redirects.py index 06939caf849f4..31e7a3b0d190b 100644 --- a/doc/_scripts/redirects.py +++ b/doc/_scripts/redirects.py @@ -16,6 +16,7 @@ # zephyr-keep-sorted-start ('application/index', 'develop/application/index'), ('boards/arduino/uno_r4_minima/doc/index', 'boards/arduino/uno_r4/doc/index'), + ('boards/phytec/mimx8mm_phyboard_polis/doc/index', 'boards/phytec/phyboard_polis/doc/index'), ('boards/phytec/mimx8mp_phyboard_pollux/doc/index', 'boards/phytec/phyboard_pollux/doc/index'), ('boards/rak/index', 'boards/rakwireless/index'), ('boards/rak/rak11720/doc/index', 'boards/rakwireless/rak11720/doc/index'), diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index f633f54e2a376..da0fa4d054cb1 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -162,6 +162,8 @@ Boards & SoC Support * Removed the ``nrf54l15pdk`` board, use :ref:`nrf54l15dk_nrf54l15` instead. * PHYTEC: ``mimx8mp_phyboard_pollux`` has been renamed to :ref:`phyboard_pollux`, with the old name marked as deprecated. + * PHYTEC: ``mimx8mm_phyboard_polis`` has been renamed to :ref:`phyboard_polis`, + with the old name marked as deprecated. * Added support for the following shields: From d12de2d6b446b04e7e76fd0c644f95eeab4201e7 Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Thu, 3 Oct 2024 21:38:18 +0200 Subject: [PATCH 1514/4482] soc: silabs: Add soc_prep_hook() for Series 2 CMSIS SystemInit is not used in Zephyr. Implement the functionality that isn't already done by Zephyr startup using soc_prep_hook(). The reason the lack of TrustZone init did not create immediately obvious issues previously is that SMU faults can only happen if the SMU clock is enabled. Signed-off-by: Aksel Skauge Mellbye --- .../hal_silabs/simplicity_sdk/CMakeLists.txt | 4 -- soc/silabs/silabs_s2/Kconfig | 4 ++ soc/silabs/silabs_s2/efr32mg21/Kconfig | 1 + soc/silabs/silabs_s2/soc.c | 63 +++++++++++++++++++ west.yml | 2 +- 5 files changed, 69 insertions(+), 5 deletions(-) diff --git a/modules/hal_silabs/simplicity_sdk/CMakeLists.txt b/modules/hal_silabs/simplicity_sdk/CMakeLists.txt index e270d75ad17e1..949bf5794473f 100644 --- a/modules/hal_silabs/simplicity_sdk/CMakeLists.txt +++ b/modules/hal_silabs/simplicity_sdk/CMakeLists.txt @@ -119,10 +119,6 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_GECKO_DEV_INIT SL_CATALOG_HFXO_MANAGER_PRESENT ) -zephyr_compile_options( - -mcmse # Cortex-M Security Extensions are needed for startup code -) - zephyr_library_sources( ${DEVICE_DIR}/SiliconLabs/${SILABS_DEVICE_FAMILY}/Source/system_${CONFIG_SOC_SERIES}.c ${EMLIB_DIR}/src/em_system.c diff --git a/soc/silabs/silabs_s2/Kconfig b/soc/silabs/silabs_s2/Kconfig index f105aaf5f499f..f25bec21491f4 100644 --- a/soc/silabs/silabs_s2/Kconfig +++ b/soc/silabs/silabs_s2/Kconfig @@ -6,8 +6,12 @@ if SOC_FAMILY_SILABS_S2 config SOC_FAMILY_SILABS_S2 select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE select BUILD_OUTPUT_HEX + select SOC_PREP_HOOK select SOC_EARLY_INIT_HOOK rsource "*/Kconfig" +config ARM_SECURE_FIRMWARE + default y + endif diff --git a/soc/silabs/silabs_s2/efr32mg21/Kconfig b/soc/silabs/silabs_s2/efr32mg21/Kconfig index 0e34a386b14e8..db3f7e6ae66e7 100644 --- a/soc/silabs/silabs_s2/efr32mg21/Kconfig +++ b/soc/silabs/silabs_s2/efr32mg21/Kconfig @@ -6,6 +6,7 @@ config SOC_SERIES_EFR32MG21 select CPU_CORTEX_M33 select CPU_CORTEX_M_HAS_DWT select ARMV8_M_DSP + select ARM_TRUSTZONE_M select CPU_HAS_FPU select CPU_HAS_ARM_MPU select CPU_HAS_ARM_SAU diff --git a/soc/silabs/silabs_s2/soc.c b/soc/silabs/silabs_s2/soc.c index 7d503aa27add0..a6ad018bc43c0 100644 --- a/soc/silabs/silabs_s2/soc.c +++ b/soc/silabs/silabs_s2/soc.c @@ -18,6 +18,18 @@ #include #include +#if defined(CONFIG_PRINTK) || defined(CONFIG_LOG) +#define PR_EXC(...) LOG_ERR(__VA_ARGS__) +#else +#define PR_EXC(...) +#endif /* CONFIG_PRINTK || CONFIG_LOG */ + +#if (CONFIG_FAULT_DUMP == 2) +#define PR_FAULT_INFO(...) PR_EXC(__VA_ARGS__) +#else +#define PR_FAULT_INFO(...) +#endif + LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); void soc_early_init_hook(void) @@ -35,3 +47,54 @@ void soc_early_init_hook(void) sl_hfxo_manager_init(); } } + +#if defined(CONFIG_ARM_SECURE_FIRMWARE) && !defined(CONFIG_ARM_FIRMWARE_HAS_SECURE_ENTRY_FUNCS) +static void smu_fault(void) +{ + PR_FAULT_INFO("***** SMU FAULT *****"); + + if (SMU->IF & SMU_IF_BMPUSEC) { + PR_FAULT_INFO("Bus Manager Fault"); + PR_EXC("SMU.BMPUFS=%d", SMU->BMPUFS); + } + if (SMU->IF & SMU_IF_PPUSEC) { + PR_FAULT_INFO("Peripheral Access Fault"); + PR_EXC("SMU.PPUFS=%d", SMU->PPUFS); + } + + z_fatal_error(K_ERR_CPU_EXCEPTION, NULL); +} +#endif + +void soc_prep_hook(void) +{ + /* Initialize TrustZone state of the device. + * If this is a secure app with no non-secure callable functions, it is a secure-only app. + * Configure all peripherals except the SMU and SEMAILBOX to non-secure aliases, and make + * all bus transactions from the CPU have non-secure attribution. + * This makes the secure-only app behave more like a non-secure app, allowing the use of + * libraries that only expect to use non-secure peripherals, such as the radio subsystem. + */ +#if defined(CONFIG_ARM_SECURE_FIRMWARE) && !defined(CONFIG_ARM_FIRMWARE_HAS_SECURE_ENTRY_FUNCS) +#if defined(CMU_CLKEN1_SMU) + CMU_S->CLKEN1_SET = CMU_CLKEN1_SMU; +#endif + SMU->PPUSATD0_CLR = _SMU_PPUSATD0_MASK; +#if defined(SEMAILBOX_PRESENT) + SMU->PPUSATD1_CLR = (_SMU_PPUSATD1_MASK & (~SMU_PPUSATD1_SMU & ~SMU_PPUSATD1_SEMAILBOX)); +#else + SMU->PPUSATD1_CLR = (_SMU_PPUSATD1_MASK & ~SMU_PPUSATD1_SMU); +#endif + + SAU->CTRL = SAU_CTRL_ALLNS_Msk; + __DSB(); + __ISB(); + + NVIC_ClearPendingIRQ(SMU_SECURE_IRQn); + SMU->IF_CLR = SMU_IF_PPUSEC | SMU_IF_BMPUSEC; + SMU->IEN = SMU_IEN_PPUSEC | SMU_IEN_BMPUSEC; + + IRQ_DIRECT_CONNECT(SMU_SECURE_IRQn, 0, smu_fault, 0); + irq_enable(SMU_SECURE_IRQn); +#endif +} diff --git a/west.yml b/west.yml index e4abd8562356d..557cea2ff268d 100644 --- a/west.yml +++ b/west.yml @@ -223,7 +223,7 @@ manifest: groups: - hal - name: hal_silabs - revision: 5c7a7834a6df7882518a2da127f950d80987dfcb + revision: 69a5fad41aced94dc59d3103edd6ef370851e623 path: modules/hal/silabs groups: - hal From 4fa5fc3b4c2c93b4c61056ce7e6442fa79795676 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Mon, 20 May 2024 16:07:37 -0400 Subject: [PATCH 1515/4482] drivers: pinctrl: mec5: Microchip MEC5 HAL based pinctrl driver Add a pinctrl driver for Microchip MEC5 HAL based chips. The driver removes the YAML enum "no change" property value from the driver strength and slew rate properties. Update the shared header file in mec soc common folder to use a different Z_PINCTRL_STATE_PINCFG_INIT for MEC5. Modifications to legacy MEC172x XEC PINCTRL will be in a future PR. Signed-off-by: Scott Worley --- drivers/pinctrl/CMakeLists.txt | 1 + drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Kconfig.mec5 | 9 + drivers/pinctrl/pinctrl_mchp_mec5.c | 166 ++++++++++++++++++ dts/arm/microchip/mec5.dtsi | 1 + .../pinctrl/microchip,mec5-pinctrl.yaml | 124 +++++++++++++ soc/microchip/mec/common/pinctrl_soc.h | 53 ++++-- 7 files changed, 337 insertions(+), 18 deletions(-) create mode 100644 drivers/pinctrl/Kconfig.mec5 create mode 100644 drivers/pinctrl/pinctrl_mchp_mec5.c create mode 100644 dts/bindings/pinctrl/microchip,mec5-pinctrl.yaml diff --git a/drivers/pinctrl/CMakeLists.txt b/drivers/pinctrl/CMakeLists.txt index 5c99dd82e8fcc..99cb8d6b9e5f9 100644 --- a/drivers/pinctrl/CMakeLists.txt +++ b/drivers/pinctrl/CMakeLists.txt @@ -39,5 +39,6 @@ zephyr_library_sources_ifdef(CONFIG_PINCTRL_ENE_KB1200 pinctrl_ene_kb1200.c) zephyr_library_sources_ifdef(CONFIG_PINCTRL_IMX_SCU pinctrl_imx_scu.c) zephyr_library_sources_ifdef(CONFIG_PINCTRL_MAX32 pinctrl_max32.c) zephyr_library_sources_ifdef(CONFIG_PINCTRL_IMX_SCMI pinctrl_imx_scmi.c) +zephyr_library_sources_ifdef(CONFIG_PINCTRL_MCHP_MEC5 pinctrl_mchp_mec5.c) add_subdirectory(renesas) diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index b919fa0f169b0..511a8a22cb9ca 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig @@ -66,6 +66,7 @@ source "drivers/pinctrl/Kconfig.mci_io_mux" source "drivers/pinctrl/Kconfig.ene" source "drivers/pinctrl/Kconfig.zynqmp" source "drivers/pinctrl/Kconfig.max32" +source "drivers/pinctrl/Kconfig.mec5" rsource "renesas/Kconfig" diff --git a/drivers/pinctrl/Kconfig.mec5 b/drivers/pinctrl/Kconfig.mec5 new file mode 100644 index 0000000000000..837af56b3756a --- /dev/null +++ b/drivers/pinctrl/Kconfig.mec5 @@ -0,0 +1,9 @@ +# Copyright (c) 2024 Microchip Technology Inc. +# SPDX-License-Identifier: Apache-2.0 + +config PINCTRL_MCHP_MEC5 + bool "Pin controller driver for MCHP MEC5 MCUs" + default y + depends on DT_HAS_MICROCHIP_MEC5_PINCTRL_ENABLED + help + Enable pin controller driver for Microchip MEC5 MCUs diff --git a/drivers/pinctrl/pinctrl_mchp_mec5.c b/drivers/pinctrl/pinctrl_mchp_mec5.c new file mode 100644 index 0000000000000..bb4437a5f54b2 --- /dev/null +++ b/drivers/pinctrl/pinctrl_mchp_mec5.c @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2016 Open-RnD Sp. z o.o. + * Copyright (c) 2021 Linaro Limited + * Copyright (c) 2021 Nordic Semiconductor ASA + * Copyright (c) 2024 Microchip Technology Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT microchip_mec5_pinctrl + +#include +#include +#include + +static const struct mec_gpio_props cfg1[] = { + {MEC_GPIO_OSEL_PROP_ID, MEC_GPIO_PROP_OSEL_CTRL}, + {MEC_GPIO_INPAD_DIS_PROP_ID, MEC_GPIO_PROP_INPAD_EN}, +}; + +/* DT enable booleans take precedence over disable booleans. + * We initially clear alternate output disable allowing us to set output state + * in the control register. Hardware sets output state bit in both control and + * parallel output register bits. Alternate output disable only controls which + * register bit is writable by the EC. We also clear the input pad disable + * bit because we need the input pin state and we don't know if the requested + * alternate function is input or bi-directional. + * Note 1: hardware allows input and output to be simultaneously enabled. + * Note 2: hardware interrupt detection is only on the input path. + */ +static int mec5_config_pin(uint32_t pinmux, uint32_t altf) +{ + uint32_t conf = pinmux; + uint32_t pin = 0, temp = 0; + int ret = 0; + size_t idx = 0; + struct mec_gpio_props cfg2[12]; + + ret = mec_hal_gpio_pin_num(MCHP_XEC_PINMUX_PORT(pinmux), MCHP_XEC_PINMUX_PIN(pinmux), &pin); + if (ret) { + return -EINVAL; + } + + ret = mec_hal_gpio_set_props(pin, cfg1, ARRAY_SIZE(cfg1)); + if (ret) { + return -EIO; + } + + /* slew rate */ + temp = (conf >> MCHP_XEC_SLEW_RATE_POS) & MCHP_XEC_SLEW_RATE_MSK0; + if (temp != MCHP_XEC_SLEW_RATE_MSK0) { + cfg2[idx].prop = MEC_GPIO_SLEW_RATE_ID; + cfg2[idx].val = (uint8_t)MEC_GPIO_SLEW_RATE_SLOW; + if (temp == MCHP_XEC_SLEW_RATE_FAST0) { + cfg2[idx].val = (uint8_t)MEC_GPIO_SLEW_RATE_FAST; + } + idx++; + } + + /* drive strength */ + temp = (conf >> MCHP_XEC_DRV_STR_POS) & MCHP_XEC_DRV_STR_MSK0; + if (temp != MCHP_XEC_DRV_STR_MSK0) { + cfg2[idx].prop = MEC_GPIO_DRV_STR_ID; + cfg2[idx].val = (uint8_t)(temp - 1u); + idx++; + } + + /* Touch internal pull-up/pull-down? */ + cfg2[idx].prop = MEC_GPIO_PUD_PROP_ID; + if (conf & BIT(MCHP_XEC_NO_PUD_POS)) { + cfg2[idx++].val = MEC_GPIO_PROP_NO_PUD; + } else if (conf & BIT(MCHP_XEC_PU_POS)) { + cfg2[idx++].val = MEC_GPIO_PROP_PULL_UP; + } else if (conf & BIT(MCHP_XEC_PD_POS)) { + cfg2[idx++].val = MEC_GPIO_PROP_PULL_DN; + } + + /* Touch output enable. We always enable input */ + if (conf & (BIT(MCHP_XEC_OUT_DIS_POS) | BIT(MCHP_XEC_OUT_EN_POS))) { + cfg2[idx].prop = MEC_GPIO_DIR_PROP_ID; + cfg2[idx].val = MEC_GPIO_PROP_DIR_IN; + if (conf & BIT(MCHP_XEC_OUT_EN_POS)) { + cfg2[idx].val = MEC_GPIO_PROP_DIR_OUT; + } + idx++; + } + + /* Touch output state? Bit can be set even if the direction is input only */ + if (conf & (BIT(MCHP_XEC_OUT_LO_POS) | BIT(MCHP_XEC_OUT_HI_POS))) { + cfg2[idx].prop = MEC_GPIO_CTRL_OUT_VAL_ID; + cfg2[idx].val = 0u; + if (conf & BIT(MCHP_XEC_OUT_HI_POS)) { + cfg2[idx].val = 1u; + } + idx++; + } + + /* Touch output buffer type? */ + if (conf & (BIT(MCHP_XEC_PUSH_PULL_POS) | BIT(MCHP_XEC_OPEN_DRAIN_POS))) { + cfg2[idx].prop = MEC_GPIO_OBUFT_PROP_ID; + cfg2[idx].val = MEC_GPIO_PROP_PUSH_PULL; + if (conf & BIT(MCHP_XEC_OPEN_DRAIN_POS)) { + cfg2[idx].val = MEC_GPIO_PROP_OPEN_DRAIN; + } + idx++; + } + + /* Always touch power gate */ + cfg2[idx].prop = MEC_GPIO_PWRGT_PROP_ID; + cfg2[idx].val = MEC_GPIO_PROP_PWRGT_VTR; + if (conf & BIT(MCHP_XEC_PIN_LOW_POWER_POS)) { + cfg2[idx].val = MEC_GPIO_PROP_PWRGT_OFF; + } + idx++; + + /* Always touch MUX (alternate function) */ + cfg2[idx].prop = MEC_GPIO_MUX_PROP_ID; + cfg2[idx].val = (uint8_t)altf; + idx++; + + /* Always touch invert of alternate function. Need another bit to avoid touching */ + cfg2[idx].prop = MEC_GPIO_FUNC_POL_PROP_ID; + cfg2[idx].val = MEC_GPIO_PROP_FUNC_OUT_NON_INV; + if (conf & BIT(MCHP_XEC_FUNC_INV_POS)) { + cfg2[idx].val = MEC_GPIO_PROP_FUNC_OUT_INV; + } + idx++; + + /* HW sets output state set in control & parallel regs */ + ret = mec_hal_gpio_set_props(pin, cfg2, idx); + if (ret) { + return -EIO; + } + + /* make output state in control read-only in control and read-write in parallel reg */ + ret = mec_hal_gpio_set_property(pin, MEC_GPIO_OSEL_PROP_ID, MEC_GPIO_PROP_OSEL_PAROUT); + if (ret) { + return -EIO; + } + + return 0; +} + +int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintptr_t reg) +{ + uint32_t pinmux, func; + int ret; + + ARG_UNUSED(reg); + + for (uint8_t i = 0U; i < pin_cnt; i++) { + pinmux = pins[i]; + + func = MCHP_XEC_PINMUX_FUNC(pinmux); + if (func >= MCHP_AFMAX) { + return -EINVAL; + } + + ret = mec5_config_pin(pinmux, func); + if (ret < 0) { + return ret; + } + } + + return 0; +} diff --git a/dts/arm/microchip/mec5.dtsi b/dts/arm/microchip/mec5.dtsi index 9e16bfd75cc33..e105bea6bafe2 100644 --- a/dts/arm/microchip/mec5.dtsi +++ b/dts/arm/microchip/mec5.dtsi @@ -136,6 +136,7 @@ }; }; pinctrl: pin-controller@40081000 { + compatible = "microchip,mec5-pinctrl"; #address-cells = <1>; #size-cells = <1>; reg = <0x40081000 0x1000>; diff --git a/dts/bindings/pinctrl/microchip,mec5-pinctrl.yaml b/dts/bindings/pinctrl/microchip,mec5-pinctrl.yaml new file mode 100644 index 0000000000000..b469aa41a037b --- /dev/null +++ b/dts/bindings/pinctrl/microchip,mec5-pinctrl.yaml @@ -0,0 +1,124 @@ +# Copyright (c) 2024 Microchip Technology Inc. +# SPDX-License-Identifier: Apache-2.0 + +description: | + Microchip XEC Pin controller Node + Based on pincfg-node.yaml binding. + The MCHP XEC pin controller is a singleton node responsible for controlling + pin function selection and pin properties. For example, you can use this + node to select peripheral pin functions. + + The node has the 'pinctrl' node label set in your SoC's devicetree, + so you can modify it like this: + + &pinctrl { + /* your modifications go here */ + }; + + All device pin configurations should be placed in child nodes of the + 'pinctrl' node, as in the spi0 example shown at the end: + + A group can also specify shared pin properties common to all the specified + pins, such as the 'bias-pull-up' property in group 2. Here is a list of + supported standard pin properties: + + - bias-disable: Disable pull-up/down (default behavior, not required). + - bias-pull-down: Enable pull-down resistor. + - bias-pull-up: Enable pull-up resistor. + - drive-push-pull: Output driver is push-pull (default, not required). + - drive-open-drain: Output driver is open-drain. + - output-high: Set output state high when pin configured. + - output-low: Set output state low when pin configured. + + Custom pin properties for drive strength and slew rate are available: + - drive-strength + - slew-rate + + Driver strength and slew rate hardware defaults vary by SoC and pin. + + An example for MEC174x family, include the chip level pinctrl + DTSI file in the board level DTS: + + #include + + We want to use the shared SPI port of the MEC172x QMSPI controller + and want the chip select 0 to be open-drain. + + To change a pin's pinctrl default properties add a reference to the + pin in the board's DTS file and set the properties. + + &spi0 { + pinctrl-0 = < &shd_cs0_n_gpio055 + &shd_clk_gpio056 + &shd_io0_gpio223 + &shd_io1_gpio224 + &shd_io3_gpio016 >; + pinctrl-names = "default"; + } + + &shd_cs0_n_gpio055 { + drive-open-drain; + }; + +compatible: "microchip,mec5-pinctrl" + +include: base.yaml + +properties: + reg: + required: true + +child-binding: + description: | + This binding gives a base representation of the Microchip XEC pins + configuration + + include: + - name: pincfg-node.yaml + property-allowlist: + - bias-disable + - bias-pull-down + - bias-pull-up + - drive-push-pull + - drive-open-drain + - low-power-enable + - output-disable + - output-enable + - output-high + - output-low + + properties: + pinmux: + type: int + required: true + description: Pinmux selection + + slew-rate: + type: string + enum: + - "low-speed" + - "high-speed" + description: | + Pin speed. The default value of slew-rate is the SoC power-on-reset + value. Please refer to the data sheet as a small number of pins + may have a different default and some pins do not implement + slew rate adjustment. + + drive-strength: + type: string + enum: + - "1x" + - "2x" + - "4x" + - "6x" + description: | + Pin output drive strength for PIO and PIO-24 pin types. Default + is "1x" for most pins. PIO pins are 2, 4, 8, or 12 mA. PIO-24 pins + are 4, 8, 16, or 24 mA. Please refer to the data sheet for each + pin's PIO type and default drive strength. + + microchip,output-func-invert: + type: boolean + description: + Invert polarity of an output alternate function. Input functions + are not affected. diff --git a/soc/microchip/mec/common/pinctrl_soc.h b/soc/microchip/mec/common/pinctrl_soc.h index 1e5b5005027bf..0182167779db6 100644 --- a/soc/microchip/mec/common/pinctrl_soc.h +++ b/soc/microchip/mec/common/pinctrl_soc.h @@ -31,28 +31,45 @@ typedef uint32_t pinctrl_soc_pin_t; /* initialize pinmux member fields of pinctrl_pin_t */ #define Z_PINCTRL_MCHP_XEC_PINMUX_INIT(node_id) (uint32_t)(DT_PROP(node_id, pinmux)) -#define Z_PINCTRL_STATE_PINCFG_INIT(node_id) \ - ((DT_PROP(node_id, bias_disable) << MCHP_XEC_NO_PUD_POS) \ - | (DT_PROP(node_id, bias_pull_down) << MCHP_XEC_PD_POS) \ - | (DT_PROP(node_id, bias_pull_up) << MCHP_XEC_PU_POS) \ - | (DT_PROP(node_id, drive_push_pull) << MCHP_XEC_PUSH_PULL_POS) \ - | (DT_PROP(node_id, drive_open_drain) << MCHP_XEC_OPEN_DRAIN_POS) \ - | (DT_PROP(node_id, output_disable) << MCHP_XEC_OUT_DIS_POS) \ - | (DT_PROP(node_id, output_enable) << MCHP_XEC_OUT_EN_POS) \ - | (DT_PROP(node_id, output_high) << MCHP_XEC_OUT_HI_POS) \ - | (DT_PROP(node_id, output_low) << MCHP_XEC_OUT_LO_POS) \ - | (DT_PROP(node_id, low_power_enable) << MCHP_XEC_PIN_LOW_POWER_POS) \ - | (DT_PROP(node_id, microchip_output_func_invert) << MCHP_XEC_FUNC_INV_POS) \ - | (DT_ENUM_IDX(node_id, slew_rate) << MCHP_XEC_SLEW_RATE_POS) \ - | (DT_ENUM_IDX(node_id, drive_strength) << MCHP_XEC_DRV_STR_POS)) +#ifdef CONFIG_HAS_MEC5_HAL +#define Z_PINCTRL_STATE_PINCFG_INIT(node_id) \ + ((DT_PROP(node_id, bias_disable) << MCHP_XEC_NO_PUD_POS) | \ + (DT_PROP(node_id, bias_pull_down) << MCHP_XEC_PD_POS) | \ + (DT_PROP(node_id, bias_pull_up) << MCHP_XEC_PU_POS) | \ + (DT_PROP(node_id, drive_push_pull) << MCHP_XEC_PUSH_PULL_POS) | \ + (DT_PROP(node_id, drive_open_drain) << MCHP_XEC_OPEN_DRAIN_POS) | \ + (DT_PROP(node_id, output_disable) << MCHP_XEC_OUT_DIS_POS) | \ + (DT_PROP(node_id, output_enable) << MCHP_XEC_OUT_EN_POS) | \ + (DT_PROP(node_id, output_high) << MCHP_XEC_OUT_HI_POS) | \ + (DT_PROP(node_id, output_low) << MCHP_XEC_OUT_LO_POS) | \ + (DT_PROP(node_id, low_power_enable) << MCHP_XEC_PIN_LOW_POWER_POS) | \ + (DT_PROP(node_id, microchip_output_func_invert) << MCHP_XEC_FUNC_INV_POS) | \ + (DT_ENUM_IDX_OR(node_id, slew_rate, 0x3) << MCHP_XEC_SLEW_RATE_POS) | \ + (DT_ENUM_IDX_OR(node_id, drive_strength, 0x7) << MCHP_XEC_DRV_STR_POS)) +#else +#define Z_PINCTRL_STATE_PINCFG_INIT(node_id) \ + ((DT_PROP(node_id, bias_disable) << MCHP_XEC_NO_PUD_POS) | \ + (DT_PROP(node_id, bias_pull_down) << MCHP_XEC_PD_POS) | \ + (DT_PROP(node_id, bias_pull_up) << MCHP_XEC_PU_POS) | \ + (DT_PROP(node_id, drive_push_pull) << MCHP_XEC_PUSH_PULL_POS) | \ + (DT_PROP(node_id, drive_open_drain) << MCHP_XEC_OPEN_DRAIN_POS) | \ + (DT_PROP(node_id, output_disable) << MCHP_XEC_OUT_DIS_POS) | \ + (DT_PROP(node_id, output_enable) << MCHP_XEC_OUT_EN_POS) | \ + (DT_PROP(node_id, output_high) << MCHP_XEC_OUT_HI_POS) | \ + (DT_PROP(node_id, output_low) << MCHP_XEC_OUT_LO_POS) | \ + (DT_PROP(node_id, low_power_enable) << MCHP_XEC_PIN_LOW_POWER_POS) | \ + (DT_PROP(node_id, microchip_output_func_invert) << MCHP_XEC_FUNC_INV_POS) | \ + (DT_ENUM_IDX(node_id, slew_rate) << MCHP_XEC_SLEW_RATE_POS) | \ + (DT_ENUM_IDX(node_id, drive_strength) << MCHP_XEC_DRV_STR_POS)) +#endif /* initialize pin structure members */ -#define Z_PINCTRL_STATE_PIN_INIT(node_id, state_prop, idx) \ - (Z_PINCTRL_MCHP_XEC_PINMUX_INIT(DT_PROP_BY_IDX(node_id, state_prop, idx)) \ - | Z_PINCTRL_STATE_PINCFG_INIT(DT_PROP_BY_IDX(node_id, state_prop, idx))), +#define Z_PINCTRL_STATE_PIN_INIT(node_id, state_prop, idx) \ + (Z_PINCTRL_MCHP_XEC_PINMUX_INIT(DT_PROP_BY_IDX(node_id, state_prop, idx)) | \ + Z_PINCTRL_STATE_PINCFG_INIT(DT_PROP_BY_IDX(node_id, state_prop, idx))), /* Use DT FOREACH macro to initialize each used pin */ -#define Z_PINCTRL_STATE_PINS_INIT(node_id, prop) \ +#define Z_PINCTRL_STATE_PINS_INIT(node_id, prop) \ {DT_FOREACH_PROP_ELEM(node_id, prop, Z_PINCTRL_STATE_PIN_INIT)} /** @endcond */ From 0f6d6b2ef221a05cc174f172cb904b4d2828efe0 Mon Sep 17 00:00:00 2001 From: Jiafei Pan Date: Fri, 27 Sep 2024 18:39:19 +0800 Subject: [PATCH 1516/4482] drivers: gicv3: add distributor safe configuration In case of multiple OSes running on different CPU Cores which share the same GIC controller, need to avoid the distributor re-configured to avoid crash the OS has already been started. Signed-off-by: Jiafei Pan --- drivers/interrupt_controller/Kconfig.gic | 10 ++++++++++ drivers/interrupt_controller/intc_gicv3.c | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/interrupt_controller/Kconfig.gic b/drivers/interrupt_controller/Kconfig.gic index 0e90f9874fa08..b482bf3336b1e 100644 --- a/drivers/interrupt_controller/Kconfig.gic +++ b/drivers/interrupt_controller/Kconfig.gic @@ -63,4 +63,14 @@ config GIC_V3_ITS that ITS uses dynamic memory, so HEAP_MEM_POOL_SIZE should be enough to allocate ITS tables (size is probed at runtime). +config GIC_SAFE_CONFIG + bool "GIC Distributor Safe Configuration" + depends on GIC_V3 + default n + help + In case of multiple OSes running on different CPU Cores which share the + same GIC controller, need to avoid the distributor re-configured to avoid + crash the OS has already been started. With this enabled, it will bypass + GIC distributor configuration if it has been configured by other OS. + endif # CPU_CORTEX diff --git a/drivers/interrupt_controller/intc_gicv3.c b/drivers/interrupt_controller/intc_gicv3.c index f3f9259f5ea0c..c84a42c7e3632 100644 --- a/drivers/interrupt_controller/intc_gicv3.c +++ b/drivers/interrupt_controller/intc_gicv3.c @@ -447,6 +447,17 @@ static void gicv3_dist_init(void) unsigned int idx; mem_addr_t base = GIC_DIST_BASE; +#ifdef CONFIG_GIC_SAFE_CONFIG + /* + * Currently multiple OSes can run one the different CPU Cores which share single GIC, + * but GIC distributor should avoid to be re-configured in order to avoid crash the + * OSes has already been started. + */ + if (sys_read32(GICD_CTLR) & (BIT(GICD_CTLR_ENABLE_G0) | BIT(GICD_CTLR_ENABLE_G1NS))) { + return; + } +#endif + num_ints = sys_read32(GICD_TYPER); num_ints &= GICD_TYPER_ITLINESNUM_MASK; num_ints = (num_ints + 1) << 5; From f885c8ada30fb481f0d8298001bf053d7cbb443e Mon Sep 17 00:00:00 2001 From: Ricardo Rivera-Matos Date: Fri, 10 May 2024 15:04:21 +0000 Subject: [PATCH 1517/4482] regulator: cp9314: Uses FIELD_GET to read CHIP_REV Use FIELD_GET macro to grab CHIP_REV bitfield. This change improves the readability of the source code and does not change functionality. Signed-off-by: Ricardo Rivera-Matos --- drivers/regulator/regulator_cp9314.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/regulator_cp9314.c b/drivers/regulator/regulator_cp9314.c index 0e155b172478e..8944dcfb6d594 100644 --- a/drivers/regulator/regulator_cp9314.c +++ b/drivers/regulator/regulator_cp9314.c @@ -118,7 +118,7 @@ LOG_MODULE_REGISTER(CP9314, CONFIG_REGULATOR_LOG_LEVEL); #define CP9314_REG_BC_STS_C 0x62 #define CP9314_CHIP_REV_MASK GENMASK(7, 4) -#define CP9314_CHIP_REV_B0 0x10 +#define CP9314_CHIP_REV_B0 0x1 #define CP9314_REG_FORCE_SC_MISC 0x69 #define CP9314_FORCE_CSI_EN BIT(0) @@ -516,7 +516,7 @@ static int regulator_cp9314_init(const struct device *dev) return ret; } - value &= CP9314_CHIP_REV_MASK; + value = FIELD_GET(CP9314_CHIP_REV_MASK, value); switch (value) { case CP9314_CHIP_REV_B0: From 7fb2e707a236a1c023404f8b6d22900ae587045c Mon Sep 17 00:00:00 2001 From: Ricardo Rivera-Matos Date: Fri, 10 May 2024 15:20:14 +0000 Subject: [PATCH 1518/4482] regulator: cp9314: Prints CHIP_REV info after switch case Moves the CHIP_REV log message after the CHIP_REV switch case. Printing the log message after allows for the print to be reused for multiple CHIP_REV cases. Signed-off-by: Ricardo Rivera-Matos --- drivers/regulator/regulator_cp9314.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/regulator_cp9314.c b/drivers/regulator/regulator_cp9314.c index 8944dcfb6d594..dc017fad9f46f 100644 --- a/drivers/regulator/regulator_cp9314.c +++ b/drivers/regulator/regulator_cp9314.c @@ -520,7 +520,6 @@ static int regulator_cp9314_init(const struct device *dev) switch (value) { case CP9314_CHIP_REV_B0: - LOG_INF("Found CP9314 REV:0x%x\n", value); ret = regulator_cp9314_b0_init(dev); if (ret < 0) { return ret; @@ -531,6 +530,8 @@ static int regulator_cp9314_init(const struct device *dev) return -ENOTSUP; } + LOG_INF("Found CP9314 REV:0x%x\n", value); + ret = regulator_cp9314_otp_init(dev); if (ret < 0) { return ret; From 63acbef33f8865004956dad4542bbba47e75645a Mon Sep 17 00:00:00 2001 From: Ricardo Rivera-Matos Date: Wed, 29 May 2024 14:17:29 +0000 Subject: [PATCH 1519/4482] regulator: cp9314: Changes CHIP_REV log message to debug level Changes the log level for the CHIP_REV log message from INFO to DBG. Signed-off-by: Ricardo Rivera-Matos --- drivers/regulator/regulator_cp9314.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/regulator_cp9314.c b/drivers/regulator/regulator_cp9314.c index dc017fad9f46f..4477f7e220243 100644 --- a/drivers/regulator/regulator_cp9314.c +++ b/drivers/regulator/regulator_cp9314.c @@ -530,7 +530,7 @@ static int regulator_cp9314_init(const struct device *dev) return -ENOTSUP; } - LOG_INF("Found CP9314 REV:0x%x\n", value); + LOG_DBG("Found CP9314 REV:0x%x\n", value); ret = regulator_cp9314_otp_init(dev); if (ret < 0) { From 6843faaf693780add6c24edd31e6614ad2e0d351 Mon Sep 17 00:00:00 2001 From: Ricardo Rivera-Matos Date: Tue, 21 May 2024 21:47:34 +0000 Subject: [PATCH 1520/4482] regulator: cp9314: Adds support for B1 CHIP_REV Adds support for revision B1 silicon when checking CHIP_REV. This silicon revision introduces the hardware I2C lock. Signed-off-by: Ricardo Rivera-Matos --- drivers/regulator/regulator_cp9314.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/regulator/regulator_cp9314.c b/drivers/regulator/regulator_cp9314.c index 4477f7e220243..a9528eec55bfd 100644 --- a/drivers/regulator/regulator_cp9314.c +++ b/drivers/regulator/regulator_cp9314.c @@ -119,6 +119,7 @@ LOG_MODULE_REGISTER(CP9314, CONFIG_REGULATOR_LOG_LEVEL); #define CP9314_REG_BC_STS_C 0x62 #define CP9314_CHIP_REV_MASK GENMASK(7, 4) #define CP9314_CHIP_REV_B0 0x1 +#define CP9314_CHIP_REV_B1 0x3 #define CP9314_REG_FORCE_SC_MISC 0x69 #define CP9314_FORCE_CSI_EN BIT(0) @@ -525,6 +526,8 @@ static int regulator_cp9314_init(const struct device *dev) return ret; } break; + case CP9314_CHIP_REV_B1: + break; default: LOG_ERR("Invalid CP9314 REV:0x%x\n", value); return -ENOTSUP; From a684c36e772ba225eb432d7c6810729aaa051d91 Mon Sep 17 00:00:00 2001 From: Ricardo Rivera-Matos Date: Tue, 21 May 2024 16:17:33 +0000 Subject: [PATCH 1521/4482] dts: bindings: cp9314: Adds cirrus,hw-i2c-lock property Documents cirrus,hw-i2c-lock property in the devicetree bindings. This flag indicates that the control port write-lock was enabled in hardware via the PGPIO2 pin. Signed-off-by: Ricardo Rivera-Matos --- dts/bindings/regulator/cirrus,cp9314.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dts/bindings/regulator/cirrus,cp9314.yaml b/dts/bindings/regulator/cirrus,cp9314.yaml index 9718c20b39145..fcbc33d62c16e 100644 --- a/dts/bindings/regulator/cirrus,cp9314.yaml +++ b/dts/bindings/regulator/cirrus,cp9314.yaml @@ -39,3 +39,9 @@ properties: description: | Desired switched capacitor ratio set at initialization. This entry will overwrite the selection set by the PROG resistor. + + cirrus,hw-i2c-lock: + type: boolean + description: | + Indicate if the hardware write lock was enabled via the resistor value applied to + PGPIO2. From 2b3ed7016f1730d2a98ee560dd4e1318c42fca06 Mon Sep 17 00:00:00 2001 From: Ricardo Rivera-Matos Date: Fri, 24 May 2024 18:16:01 +0000 Subject: [PATCH 1522/4482] regulator: cp9314: Adds support for HW I2C Lock feature Adds support for the control port write-lock feature introduced in revision B1. The write-lock feature minimizes the risk of spurious I2C writes flipping sensitive bits during device operation by blocking writes to some or all of the register map. If desired, the write-lock must be set in hardware by biasing PGPIO2 appropriately and setting the cirrus,hw-i2c-lock flag in the devicetree entry. Signed-off-by: Ricardo Rivera-Matos --- drivers/regulator/regulator_cp9314.c | 133 +++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/drivers/regulator/regulator_cp9314.c b/drivers/regulator/regulator_cp9314.c index a9528eec55bfd..31d298807b71e 100644 --- a/drivers/regulator/regulator_cp9314.c +++ b/drivers/regulator/regulator_cp9314.c @@ -85,6 +85,7 @@ LOG_MODULE_REGISTER(CP9314, CONFIG_REGULATOR_LOG_LEVEL); #define CP9314_REG_LION_CFG_3 0x34 #define CP9314_LB_MIN_FREQ_SEL_0 GENMASK(7, 6) #define CP9314_MODE_CTRL_UPDATE_BW_1 GENMASK(5, 3) +#define CP9314_ALLOW_HW_I2C_LOCK BIT(0) #define CP9314_REG_LB_CTRL 0x38 #define CP9314_LB1_DELTA_CFG_1 GENMASK(6, 3) @@ -152,6 +153,8 @@ LOG_MODULE_REGISTER(CP9314, CONFIG_REGULATOR_LOG_LEVEL); #define CP9314_PTE_2_OTP_1 0x0 #define CP9314_PTE_2_OTP_2 0x1 +#define CP9314_REG_BACKDOOR_CTRL 0x8C + #define CP9314_FAULT1_STS 0x9A #define CP9314_VIN_OV_STS BIT(4) @@ -192,17 +195,25 @@ enum cp9314_sync_roles { CP9314_ROLE_STANDALONE, }; +enum cp9314_backdoor_keys { + CP9314_BACKDOOR_LOCKED_KEY = 0x0, + CP9314_BACKDOOR_PUBLIC_KEY = 0x0F, +}; + struct regulator_cp9314_config { struct regulator_common_config common; struct i2c_dt_spec i2c; struct gpio_dt_spec en_pin; struct gpio_dt_spec pgood_pin; uint8_t initial_op_mode_idx; + bool hw_i2c_lock; }; struct regulator_cp9314_data { struct regulator_common_data data; enum cp9314_sync_roles sync_role; + uint8_t backdoor_key; + bool allow_hw_i2c_lock; }; struct cp9314_reg_patch { @@ -284,14 +295,75 @@ static int regulator_cp9314_get_error_flags(const struct device *dev, return 0; } +static int regulator_cp9314_write_lock(const struct device *dev, + const enum cp9314_backdoor_keys key) +{ + const struct regulator_cp9314_config *config = dev->config; + struct regulator_cp9314_data *data = dev->data; + int ret; + + if (data->allow_hw_i2c_lock == 0U) { + ret = i2c_reg_update_byte_dt(&config->i2c, CP9314_REG_LION_CFG_3, + CP9314_ALLOW_HW_I2C_LOCK, CP9314_ALLOW_HW_I2C_LOCK); + if (ret < 0) { + return ret; + } + + data->allow_hw_i2c_lock = true; + } + + if ((uint8_t)key == data->backdoor_key) { + return 0; + } else { + return i2c_reg_write_byte_dt(&config->i2c, CP9314_REG_BACKDOOR_CTRL, (uint8_t)key); + } +} + +static int regulator_cp9314_write_lock_init(const struct device *dev) +{ + const struct regulator_cp9314_config *config = dev->config; + struct regulator_cp9314_data *data = dev->data; + uint8_t value; + int ret; + + ret = i2c_reg_read_byte_dt(&config->i2c, CP9314_REG_LION_CFG_3, &value); + if (ret < 0) { + return ret; + } + + data->allow_hw_i2c_lock = FIELD_GET(CP9314_ALLOW_HW_I2C_LOCK, value); + + ret = i2c_reg_read_byte_dt(&config->i2c, CP9314_REG_BACKDOOR_CTRL, &data->backdoor_key); + if (ret < 0) { + return ret; + } + + return 0; +} + static int regulator_cp9314_disable(const struct device *dev) { const struct regulator_cp9314_config *config = dev->config; + int ret; if (config->en_pin.port != NULL) { return gpio_pin_set_dt(&config->en_pin, 0); } + if (config->hw_i2c_lock != 0U) { + ret = regulator_cp9314_write_lock(dev, CP9314_BACKDOOR_PUBLIC_KEY); + if (ret < 0) { + return ret; + } + + ret = i2c_reg_update_byte_dt(&config->i2c, CP9314_REG_CTRL1, CP9314_CP_EN, 0); + if (ret < 0) { + return ret; + } + + return regulator_cp9314_write_lock(dev, CP9314_BACKDOOR_LOCKED_KEY); + } + return i2c_reg_update_byte_dt(&config->i2c, CP9314_REG_CTRL1, CP9314_CP_EN, 0); } @@ -301,6 +373,13 @@ static int regulator_cp9314_enable(const struct device *dev) uint8_t value; int ret; + if (config->hw_i2c_lock != 0U) { + ret = regulator_cp9314_write_lock(dev, CP9314_BACKDOOR_PUBLIC_KEY); + if (ret < 0) { + return ret; + } + } + ret = i2c_reg_read_byte_dt(&config->i2c, CP9314_REG_CONVERTER, &value); if (ret < 0) { return ret; @@ -353,6 +432,13 @@ static int regulator_cp9314_enable(const struct device *dev) } } + if (config->hw_i2c_lock != 0U) { + ret = regulator_cp9314_write_lock(dev, CP9314_BACKDOOR_LOCKED_KEY); + if (ret < 0) { + return ret; + } + } + return 0; } @@ -403,6 +489,19 @@ static int cp9314_do_soft_reset(const struct device *dev) const struct regulator_cp9314_config *config = dev->config; int ret; + if (config->hw_i2c_lock != 0U) { + ret = regulator_cp9314_write_lock(dev, CP9314_BACKDOOR_PUBLIC_KEY); + if (ret < 0) { + return ret; + } + + ret = i2c_reg_update_byte_dt(&config->i2c, CP9314_REG_LION_CFG_3, + CP9314_ALLOW_HW_I2C_LOCK, 0); + if (ret < 0) { + return ret; + } + } + ret = i2c_reg_write_byte_dt(&config->i2c, CP9314_REG_CRUS_CTRL, CP9314_CRUS_KEY_SOFT_RESET); if (ret < 0) { return ret; @@ -416,6 +515,13 @@ static int cp9314_do_soft_reset(const struct device *dev) k_msleep(CP9314_SOFT_RESET_DELAY_MSEC); + if (config->hw_i2c_lock != 0U) { + ret = regulator_cp9314_write_lock_init(dev); + if (ret < 0) { + return ret; + } + } + return 0; } @@ -507,11 +613,30 @@ static int regulator_cp9314_init(const struct device *dev) k_usleep(CP9314_EN_DEBOUNCE_USEC); } + if (config->hw_i2c_lock != 0U) { + ret = regulator_cp9314_write_lock_init(dev); + if (ret < 0) { + return ret; + } + } else { + data->allow_hw_i2c_lock = 0; + } + ret = cp9314_do_soft_reset(dev); if (ret < 0) { return ret; } + if (data->allow_hw_i2c_lock != 0U) { + ret = i2c_reg_update_byte_dt(&config->i2c, CP9314_REG_LION_CFG_3, + CP9314_ALLOW_HW_I2C_LOCK, 0x0); + if (ret < 0) { + return ret; + } + + data->allow_hw_i2c_lock = false; + } + ret = i2c_reg_read_byte_dt(&config->i2c, CP9314_REG_BC_STS_C, &value); if (ret < 0) { return ret; @@ -597,6 +722,13 @@ static int regulator_cp9314_init(const struct device *dev) } } + if (config->hw_i2c_lock != 0U) { + ret = regulator_cp9314_write_lock(dev, CP9314_BACKDOOR_LOCKED_KEY); + if (ret < 0) { + return ret; + } + } + regulator_common_data_init(dev); return regulator_common_init(dev, false); @@ -618,6 +750,7 @@ static const struct regulator_driver_api api = { .pgood_pin = GPIO_DT_SPEC_INST_GET_OR(inst, cirrus_pgood_gpios, {}), \ .initial_op_mode_idx = \ DT_INST_ENUM_IDX_OR(inst, cirrus_initial_switched_capacitor_mode, -1) + 1, \ + .hw_i2c_lock = DT_INST_PROP(inst, cirrus_hw_i2c_lock), \ }; \ \ DEVICE_DT_INST_DEFINE(inst, regulator_cp9314_init, NULL, &data_##inst, &config_##inst, \ From b64c69f84bab68e47c3119734796434fa8010fd3 Mon Sep 17 00:00:00 2001 From: Ricardo Rivera-Matos Date: Fri, 24 May 2024 15:26:46 +0000 Subject: [PATCH 1523/4482] regulator: cp9314: Drops B0 silicon support Removes support for B0 revision silicon. The B0 revision is no longer recommended for use in host-controlled applications and there are no users of this driver implementing B0 silicon in their final design. Signed-off-by: Ricardo Rivera-Matos --- drivers/regulator/regulator_cp9314.c | 48 ---------------------------- 1 file changed, 48 deletions(-) diff --git a/drivers/regulator/regulator_cp9314.c b/drivers/regulator/regulator_cp9314.c index 31d298807b71e..83706ff20419d 100644 --- a/drivers/regulator/regulator_cp9314.c +++ b/drivers/regulator/regulator_cp9314.c @@ -119,7 +119,6 @@ LOG_MODULE_REGISTER(CP9314, CONFIG_REGULATOR_LOG_LEVEL); #define CP9314_REG_BC_STS_C 0x62 #define CP9314_CHIP_REV_MASK GENMASK(7, 4) -#define CP9314_CHIP_REV_B0 0x1 #define CP9314_CHIP_REV_B1 0x3 #define CP9314_REG_FORCE_SC_MISC 0x69 @@ -222,31 +221,6 @@ struct cp9314_reg_patch { uint8_t value; }; -/* - * HW errata patch for B0 silicon. Intended to correct POR configuration values for protection - * comparators, disable OCP comparators, and enable the output undervoltage comparator. - */ -static struct cp9314_reg_patch b0_reg_patch[18] = { - {CP9314_REG_CRUS_CTRL, GENMASK(7, 0), CP9314_CRUS_KEY_UNLOCK}, - {CP9314_REG_LION_COMP_CTRL_3, CP9314_VIN_OV_CFG, 0x1B}, - {CP9314_REG_LION_COMP_CTRL_1, CP9314_VOUT_OV_CFG_0, 0x30}, - {CP9314_REG_LION_COMP_CTRL_2, CP9314_VOUT_OV_CFG_1, 0xC}, - {CP9314_REG_VIN2OUT_OVP, CP9314_VIN2OUT_OVP, 0x2}, - {CP9314_REG_VIN2OUT_UVP, CP9314_VIN2OUT_UVP, 0x1}, - {CP9314_REG_VOUT_UVP, CP9314_VOUT_UVP_DIS, 0}, - {CP9314_REG_VOUT_UVP, CP9314_VOUT_UVP, 0}, - {CP9314_REG_LION_COMP_CTRL_1, CP9314_VIN_SWITCH_OK_DIS_0, 0}, - {CP9314_REG_LION_COMP_CTRL_4, CP9314_VIN_SWITCH_OK_DIS_1, 0}, - {CP9314_REG_LION_COMP_CTRL_1, CP9314_VIN_SWITCH_OK_CFG, 0}, - {CP9314_REG_LION_CFG_3, CP9314_LB_MIN_FREQ_SEL_0, 0x80}, - {CP9314_REG_LB_CTRL, CP9314_LB_MIN_FREQ_SEL_1, 0x4}, - {CP9314_REG_TRIM_8, CP9314_MODE_CTRL_UPDATE_BW_0, 0x2}, - {CP9314_REG_LION_CFG_3, CP9314_MODE_CTRL_UPDATE_BW_1, 0x2}, - {CP9314_REG_IIN_OCP, CP9314_IIN_OCP_DIS, CP9314_IIN_OCP_DIS}, - {CP9314_REG_IIN_PEAK_OCP, CP9314_IIN_PEAK_OCP_DIS, CP9314_IIN_PEAK_OCP_DIS}, - {CP9314_REG_CRUS_CTRL, GENMASK(7, 0), CP9314_CRUS_KEY_LOCK}, -}; - /* OTP memory errata patch for OTP v1. Corrects trim errata. */ static struct cp9314_reg_patch otp_1_patch[3] = { {CP9314_REG_OPTION_REG_1, CP9314_LB1_DELAY_CFG, 0}, @@ -468,22 +442,6 @@ static int cp9314_cfg_sync(const struct device *dev) CP9314_FRC_SYNC_MODE); } -static int regulator_cp9314_b0_init(const struct device *dev) -{ - const struct regulator_cp9314_config *config = dev->config; - int ret; - - for (size_t i = 0U; i < ARRAY_SIZE(b0_reg_patch); i++) { - ret = i2c_reg_update_byte_dt(&config->i2c, b0_reg_patch[i].reg_addr, - b0_reg_patch[i].mask, b0_reg_patch[i].value); - if (ret < 0) { - return ret; - } - } - - return 0; -} - static int cp9314_do_soft_reset(const struct device *dev) { const struct regulator_cp9314_config *config = dev->config; @@ -645,12 +603,6 @@ static int regulator_cp9314_init(const struct device *dev) value = FIELD_GET(CP9314_CHIP_REV_MASK, value); switch (value) { - case CP9314_CHIP_REV_B0: - ret = regulator_cp9314_b0_init(dev); - if (ret < 0) { - return ret; - } - break; case CP9314_CHIP_REV_B1: break; default: From 245aee4a8b211289cbb3b59b3fa4bb5b657287b6 Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Mon, 29 Jul 2024 16:02:03 +0200 Subject: [PATCH 1524/4482] tests: drivers: timer: nrf_grtc: run GRTC tests on nRF54L20 Run GRTC tests for nRF54L20 platform. Signed-off-by: Adam Kondraciuk --- tests/drivers/timer/nrf_grtc_timer/testcase.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml index 8d7b2f8d86ef4..128d7944395ea 100644 --- a/tests/drivers/timer/nrf_grtc_timer/testcase.yaml +++ b/tests/drivers/timer/nrf_grtc_timer/testcase.yaml @@ -8,3 +8,4 @@ tests: - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad - nrf54h20dk/nrf54h20/cpuppr + - nrf54l20pdk/nrf54l20/cpuapp From 7db7edae3cf65006eea71157b2cd86876424ba0c Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Thu, 9 May 2024 12:38:11 +0200 Subject: [PATCH 1525/4482] Bluetooth: Controller: Minor updates to code comments Minor updates and correction to code comments. Signed-off-by: Vinayak Kariappa Chettimada --- .../bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c | 2 +- subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c | 4 +++- subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c index 175a76ecae6c5..d4a4f29537f1b 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c @@ -1602,7 +1602,7 @@ uint32_t radio_tmr_start_us(uint8_t trx, uint32_t start_us) uint32_t now_us = start_us; uint32_t actual_us; - /* Setup PPI while determining the latency in doing so */ + /* Setup timer compare while determining the latency in doing so */ do { /* Set start to be, now plus the determined latency */ start_us = (now_us << 1) - start_us; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c index 6f41be448486f..c1cbbd6e6ff8a 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c @@ -668,7 +668,9 @@ void lll_conn_isr_tx(void *param) #if defined(CONFIG_BT_CTLR_PROFILE_ISR) || \ defined(HAL_RADIO_GPIO_HAVE_PA_PIN) radio_tmr_end_capture(); -#endif /* CONFIG_BT_CTLR_PROFILE_ISR */ +#endif /* CONFIG_BT_CTLR_PROFILE_ISR || + * HAL_RADIO_GPIO_HAVE_PA_PIN + */ #if defined(HAL_RADIO_GPIO_HAVE_LNA_PIN) radio_gpio_lna_setup(); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c index b8e82692e3c0d..618512adf16ed 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c @@ -317,7 +317,9 @@ static int prepare_cb(struct lll_prepare_param *p) #if defined(CONFIG_BT_CTLR_PROFILE_ISR) || \ defined(HAL_RADIO_GPIO_HAVE_PA_PIN) radio_tmr_end_capture(); -#endif /* CONFIG_BT_CTLR_PROFILE_ISR */ +#endif /* CONFIG_BT_CTLR_PROFILE_ISR || + * HAL_RADIO_GPIO_HAVE_PA_PIN + */ #if defined(CONFIG_BT_CTLR_CONN_RSSI) radio_rssi_measure(); From d9f890bfdf85ee12390a1a24a82c3a6ecaf3d4e4 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Thu, 10 Oct 2024 13:54:12 +0200 Subject: [PATCH 1526/4482] Bluetooth: Controller: Defines for radio timer capture/compare indices Add defines for radio timer capture and compare indices used in the nRF Radio HAL implementation. Signed-off-by: Vinayak Kariappa Chettimada --- .../ll_sw/nordic/hal/nrf5/radio/radio.c | 29 +++++---- .../hal/nrf5/radio/radio_nrf5_resources.h | 64 ++++++++++++++++--- 2 files changed, 71 insertions(+), 22 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c index d4a4f29537f1b..fb9396540af8d 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c @@ -620,7 +620,7 @@ uint32_t radio_is_done(void) * Note: this depends on the function being called exactly once * in the ISR function. */ - last_pdu_end_us += EVENT_TIMER->CC[2]; + last_pdu_end_us += EVENT_TIMER->CC[HAL_EVENT_TIMER_TRX_END_CC_OFFSET]; return 1; } else { return 0; @@ -1362,7 +1362,7 @@ uint32_t radio_tmr_start(uint8_t trx, uint32_t ticks_start, uint32_t remainder) EVENT_TIMER->PRESCALER = HAL_EVENT_TIMER_PRESCALER_VALUE; EVENT_TIMER->BITMODE = 2; /* 24 - bit */ - nrf_timer_cc_set(EVENT_TIMER, 0, remainder); + nrf_timer_cc_set(EVENT_TIMER, HAL_EVENT_TIMER_TRX_CC_OFFSET, remainder); #if defined(CONFIG_BT_CTLR_NRF_GRTC) uint32_t cntr_l, cntr_h, cntr_h_overflow, stale; @@ -1486,7 +1486,7 @@ uint32_t radio_tmr_start_tick(uint8_t trx, uint32_t ticks_start) nrf_timer_task_trigger(EVENT_TIMER, NRF_TIMER_TASK_STOP); nrf_timer_task_trigger(EVENT_TIMER, NRF_TIMER_TASK_CLEAR); - nrf_timer_cc_set(EVENT_TIMER, 0, remainder_us); + nrf_timer_cc_set(EVENT_TIMER, HAL_EVENT_TIMER_TRX_CC_OFFSET, remainder_us); #if defined(CONFIG_BT_CTLR_NRF_GRTC) uint32_t cntr_l, cntr_h, cntr_h_overflow, stale; @@ -1624,15 +1624,15 @@ uint32_t radio_tmr_start_us(uint8_t trx, uint32_t start_us) actual_us += latency_us; #endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ - nrf_timer_event_clear(EVENT_TIMER, NRF_TIMER_EVENT_COMPARE0); - nrf_timer_cc_set(EVENT_TIMER, 0, actual_us); + nrf_timer_event_clear(EVENT_TIMER, HAL_EVENT_TIMER_TRX_EVENT); + nrf_timer_cc_set(EVENT_TIMER, HAL_EVENT_TIMER_TRX_CC_OFFSET, actual_us); /* Capture the current time */ - nrf_timer_task_trigger(EVENT_TIMER, - HAL_EVENT_TIMER_SAMPLE_TASK); + nrf_timer_task_trigger(EVENT_TIMER, HAL_EVENT_TIMER_SAMPLE_TASK); now_us = EVENT_TIMER->CC[HAL_EVENT_TIMER_SAMPLE_CC_OFFSET]; - } while ((now_us > start_us) && (EVENT_TIMER->EVENTS_COMPARE[0] == 0U)); + } while ((now_us > start_us) && + (EVENT_TIMER->EVENTS_COMPARE[HAL_EVENT_TIMER_TRX_CC_OFFSET] == 0U)); return actual_us; } @@ -1688,7 +1688,7 @@ void radio_tmr_stop(void) void radio_tmr_hcto_configure(uint32_t hcto) { - nrf_timer_cc_set(EVENT_TIMER, 1, hcto); + nrf_timer_cc_set(EVENT_TIMER, HAL_EVENT_TIMER_HCTO_CC_OFFSET, hcto); hal_radio_recv_timeout_cancel_ppi_config(); hal_radio_disable_on_hcto_ppi_config(); @@ -1708,7 +1708,7 @@ void radio_tmr_aa_capture(void) uint32_t radio_tmr_aa_get(void) { - return EVENT_TIMER->CC[1]; + return EVENT_TIMER->CC[HAL_EVENT_TIMER_HCTO_CC_OFFSET]; } static uint32_t radio_tmr_aa; @@ -1726,7 +1726,7 @@ uint32_t radio_tmr_aa_restore(void) uint32_t radio_tmr_ready_get(void) { - return EVENT_TIMER->CC[0]; + return EVENT_TIMER->CC[HAL_EVENT_TIMER_TRX_CC_OFFSET]; } static uint32_t radio_tmr_ready; @@ -1765,7 +1765,7 @@ uint32_t radio_tmr_end_get(void) #if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) return last_pdu_end_us; #else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ - return EVENT_TIMER->CC[2]; + return EVENT_TIMER->CC[HAL_EVENT_TIMER_TRX_END_CC_OFFSET]; #endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ } @@ -1909,9 +1909,10 @@ void radio_gpio_lna_off(void) void radio_gpio_pa_lna_enable(uint32_t trx_us) { - nrf_timer_cc_set(EVENT_TIMER, 2, trx_us); + nrf_timer_cc_set(EVENT_TIMER, HAL_EVENT_TIMER_PA_LNA_CC_OFFSET, trx_us); #if defined(HAL_RADIO_FEM_IS_NRF21540) && DT_NODE_HAS_PROP(FEM_NODE, pdn_gpios) - nrf_timer_cc_set(EVENT_TIMER, 3, (trx_us - NRF_GPIO_PDN_OFFSET)); + nrf_timer_cc_set(EVENT_TIMER, HAL_EVENT_TIMER_PA_LNA_PDN_CC_OFFSET, + (trx_us - NRF_GPIO_PDN_OFFSET)); hal_radio_nrf_ppi_channels_enable(BIT(HAL_ENABLE_PALNA_PPI) | BIT(HAL_DISABLE_PALNA_PPI) | BIT(HAL_ENABLE_FEM_PPI) | diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_resources.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_resources.h index 7a8fd0e8f13f2..618e1535839ee 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_resources.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_resources.h @@ -25,8 +25,20 @@ */ #define NRF_RADIO_SHORTS_TRX_END_DISABLE_Msk HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk -#define HAL_EVENT_TIMER_SAMPLE_CC_OFFSET 3 -#define HAL_EVENT_TIMER_SAMPLE_TASK NRF_TIMER_TASK_CAPTURE3 +#define HAL_EVENT_TIMER_TRX_CC_OFFSET 0 +#define HAL_EVENT_TIMER_TRX_EVENT NRF_TIMER_EVENT_COMPARE0 + +#define HAL_EVENT_TIMER_HCTO_CC_OFFSET 1 +#define HAL_EVENT_TIMER_TRX_END_CC_OFFSET 2 + +#define HAL_EVENT_TIMER_DEFERRED_TRX_CC_OFFSET 2 +#define HAL_EVENT_TIMER_DEFERRED_TX_EVENT NRF_TIMER_EVENT_COMPARE2 + +#define HAL_EVENT_TIMER_SAMPLE_CC_OFFSET 3 +#define HAL_EVENT_TIMER_SAMPLE_TASK NRF_TIMER_TASK_CAPTURE3 + +#define HAL_EVENT_TIMER_PA_LNA_CC_OFFSET 2 +#define HAL_EVENT_TIMER_PA_LNA_PDN_CC_OFFSET 3 #else /* !CONFIG_BT_CTLR_TIFS_HW */ #if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER) @@ -56,8 +68,20 @@ */ #define NRF_RADIO_SHORTS_TRX_END_DISABLE_Msk HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk -#define HAL_EVENT_TIMER_SAMPLE_CC_OFFSET 2 -#define HAL_EVENT_TIMER_SAMPLE_TASK NRF_TIMER_TASK_CAPTURE2 +#define HAL_EVENT_TIMER_TRX_CC_OFFSET 0 +#define HAL_EVENT_TIMER_TRX_EVENT NRF_TIMER_EVENT_COMPARE0 + +#define HAL_EVENT_TIMER_HCTO_CC_OFFSET 1 +#define HAL_EVENT_TIMER_TRX_END_CC_OFFSET 2 + +#define HAL_EVENT_TIMER_DEFERRED_TRX_CC_OFFSET 2 +#define HAL_EVENT_TIMER_DEFERRED_TX_EVENT NRF_TIMER_EVENT_COMPARE2 + +#define HAL_EVENT_TIMER_SAMPLE_CC_OFFSET 2 +#define HAL_EVENT_TIMER_SAMPLE_TASK NRF_TIMER_TASK_CAPTURE2 + +#define HAL_EVENT_TIMER_PA_LNA_CC_OFFSET 2 +#define HAL_EVENT_TIMER_PA_LNA_PDN_CC_OFFSET 3 #else /* !CONFIG_BT_CTLR_PHY_CODED */ #define SW_SWITCH_TIMER_EVTS_COMP_BASE 4 @@ -73,8 +97,20 @@ */ #define NRF_RADIO_SHORTS_TRX_END_DISABLE_Msk HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk -#define HAL_EVENT_TIMER_SAMPLE_CC_OFFSET 3 -#define HAL_EVENT_TIMER_SAMPLE_TASK NRF_TIMER_TASK_CAPTURE3 +#define HAL_EVENT_TIMER_TRX_CC_OFFSET 0 +#define HAL_EVENT_TIMER_TRX_EVENT NRF_TIMER_EVENT_COMPARE0 + +#define HAL_EVENT_TIMER_HCTO_CC_OFFSET 1 +#define HAL_EVENT_TIMER_TRX_END_CC_OFFSET 2 + +#define HAL_EVENT_TIMER_DEFERRED_TRX_CC_OFFSET 2 +#define HAL_EVENT_TIMER_DEFERRED_TX_EVENT NRF_TIMER_EVENT_COMPARE2 + +#define HAL_EVENT_TIMER_SAMPLE_CC_OFFSET 3 +#define HAL_EVENT_TIMER_SAMPLE_TASK NRF_TIMER_TASK_CAPTURE3 + +#define HAL_EVENT_TIMER_PA_LNA_CC_OFFSET 2 +#define HAL_EVENT_TIMER_PA_LNA_PDN_CC_OFFSET 3 #endif /* !CONFIG_BT_CTLR_PHY_CODED */ #else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ @@ -142,7 +178,19 @@ #define NRF_RADIO_SHORTS_TRX_END_DISABLE_Msk HAL_RADIO_SHORTS_TRX_END_DISABLE_Msk #endif /* !CONFIG_BT_CTLR_DF */ -#define HAL_EVENT_TIMER_SAMPLE_CC_OFFSET 3 -#define HAL_EVENT_TIMER_SAMPLE_TASK NRF_TIMER_TASK_CAPTURE3 +#define HAL_EVENT_TIMER_TRX_CC_OFFSET 0 +#define HAL_EVENT_TIMER_TRX_EVENT NRF_TIMER_EVENT_COMPARE0 + +#define HAL_EVENT_TIMER_HCTO_CC_OFFSET 1 +#define HAL_EVENT_TIMER_TRX_END_CC_OFFSET 2 + +#define HAL_EVENT_TIMER_DEFERRED_TRX_CC_OFFSET 2 +#define HAL_EVENT_TIMER_DEFERRED_TX_EVENT NRF_TIMER_EVENT_COMPARE2 + +#define HAL_EVENT_TIMER_SAMPLE_CC_OFFSET 3 +#define HAL_EVENT_TIMER_SAMPLE_TASK NRF_TIMER_TASK_CAPTURE3 + +#define HAL_EVENT_TIMER_PA_LNA_CC_OFFSET 2 +#define HAL_EVENT_TIMER_PA_LNA_PDN_CC_OFFSET 3 #endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */ #endif /* !CONFIG_BT_CTLR_TIFS_HW */ From ba1def1a343cf2a9c4a7ad09b2279da23fe1f65f Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Thu, 9 May 2024 05:30:22 +0200 Subject: [PATCH 1527/4482] Bluetooth: Controller: Add radio timer ISR usage support Add radio timer ISR usage support. Signed-off-by: Vinayak Kariappa Chettimada --- .../bluetooth/controller/Kconfig.ll_sw_split | 7 +++ .../ll_sw/nordic/hal/nrf5/radio/radio.c | 50 +++++++++++++++++++ .../ll_sw/nordic/hal/nrf5/radio/radio.h | 3 ++ .../controller/ll_sw/nordic/lll/lll.c | 45 +++++++++++++++++ 4 files changed, 105 insertions(+) diff --git a/subsys/bluetooth/controller/Kconfig.ll_sw_split b/subsys/bluetooth/controller/Kconfig.ll_sw_split index 1970b4cd03676..7b2231ac13590 100644 --- a/subsys/bluetooth/controller/Kconfig.ll_sw_split +++ b/subsys/bluetooth/controller/Kconfig.ll_sw_split @@ -902,6 +902,13 @@ config BT_CTLR_RADIO_ENABLE_FAST help Enable use of fast radio ramp-up mode. +config BT_CTLR_RADIO_TIMER_ISR + # Hidden, enables use of timer ISR callback + bool + depends on SOC_COMPATIBLE_NRF52X || SOC_COMPATIBLE_NRF53X + help + Enables use of timer ISR callback. + config BT_CTLR_TIFS_HW bool "H/w Accelerated tIFS Trx switching" depends on !BT_CTLR_RADIO_ENABLE_FAST && BT_CTLR_TIFS_HW_SUPPORT diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c index fb9396540af8d..f372ef667d0a0 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c @@ -1153,6 +1153,56 @@ uint32_t radio_bc_has_match(void) return (NRF_RADIO->EVENTS_BCMATCH != 0); } +#if defined(CONFIG_BT_CTLR_RADIO_TIMER_ISR) +static radio_isr_cb_t isr_radio_tmr_cb; +static void *isr_radio_tmr_cb_param; + +void isr_radio_tmr(void) +{ + irq_disable(TIMER0_IRQn); + nrf_timer_int_disable(EVENT_TIMER, TIMER_INTENSET_COMPARE2_Msk); + nrf_timer_event_clear(EVENT_TIMER, HAL_EVENT_TIMER_DEFERRED_TX_EVENT); + + isr_radio_tmr_cb(isr_radio_tmr_cb_param); +} + +uint32_t radio_tmr_isr_set(uint32_t start_us, radio_isr_cb_t cb, void *param) +{ + irq_disable(TIMER0_IRQn); + + isr_radio_tmr_cb_param = param; + isr_radio_tmr_cb = cb; + + /* start_us could be the current count in the timer */ + uint32_t now_us = start_us; + + /* Setup timer compare while determining the latency in doing so */ + do { + /* Set start to be, now plus the determined latency */ + start_us = (now_us << 1) - start_us; + + /* Setup compare event with min. 1 us offset */ + nrf_timer_event_clear(EVENT_TIMER, HAL_EVENT_TIMER_DEFERRED_TX_EVENT); + nrf_timer_cc_set(EVENT_TIMER, HAL_EVENT_TIMER_DEFERRED_TRX_CC_OFFSET, + start_us + 1U); + + /* Capture the current time */ + nrf_timer_task_trigger(EVENT_TIMER, HAL_EVENT_TIMER_SAMPLE_TASK); + + now_us = EVENT_TIMER->CC[HAL_EVENT_TIMER_SAMPLE_CC_OFFSET]; + } while ((now_us > start_us) && + (EVENT_TIMER->EVENTS_COMPARE[HAL_EVENT_TIMER_DEFERRED_TRX_CC_OFFSET] == 0U)); + + nrf_timer_int_enable(EVENT_TIMER, TIMER_INTENSET_COMPARE2_Msk); + + NVIC_ClearPendingIRQ(TIMER0_IRQn); + + irq_enable(TIMER0_IRQn); + + return start_us + 1U; +} +#endif /* CONFIG_BT_CTLR_RADIO_TIMER_ISR */ + void radio_tmr_status_reset(void) { #if defined(CONFIG_BT_CTLR_NRF_GRTC) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.h index eac3381c8824d..bc5d1605302c2 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.h @@ -130,6 +130,9 @@ void radio_bc_configure(uint32_t n); void radio_bc_status_reset(void); uint32_t radio_bc_has_match(void); +void isr_radio_tmr(void); +uint32_t radio_tmr_isr_set(uint32_t start_us, radio_isr_cb_t cb, void *param); + void radio_tmr_status_reset(void); void radio_tmr_tx_status_reset(void); void radio_tmr_rx_status_reset(void); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c index 098fd309352be..de8cffb388aa3 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c @@ -115,6 +115,33 @@ ISR_DIRECT_DECLARE(radio_nrf5_isr) #endif /* !CONFIG_DYNAMIC_DIRECT_INTERRUPTS */ } +#if defined(CONFIG_BT_CTLR_RADIO_TIMER_ISR) +#if defined(CONFIG_BT_CTLR_DYNAMIC_INTERRUPTS) && \ + defined(CONFIG_DYNAMIC_DIRECT_INTERRUPTS) +static void timer_nrf5_isr(const void *arg) +#else /* !CONFIG_BT_CTLR_DYNAMIC_INTERRUPTS */ +ISR_DIRECT_DECLARE(timer_nrf5_isr) +#endif /* !CONFIG_BT_CTLR_DYNAMIC_INTERRUPTS */ +{ + DEBUG_RADIO_ISR(1); + + lll_prof_enter_radio(); + + isr_radio_tmr(); + + ISR_DIRECT_PM(); + + lll_prof_exit_radio(); + + DEBUG_RADIO_ISR(0); + +#if !defined(CONFIG_BT_CTLR_DYNAMIC_INTERRUPTS) || \ + !defined(CONFIG_DYNAMIC_DIRECT_INTERRUPTS) + return 1; +#endif /* !CONFIG_DYNAMIC_DIRECT_INTERRUPTS */ +} +#endif /* CONFIG_BT_CTLR_RADIO_TIMER_ISR */ + static void rtc0_nrf5_isr(const void *arg) { DEBUG_TICKER_ISR(1); @@ -221,9 +248,19 @@ int lll_init(void) IRQ_CONNECT_FLAGS, no_reschedule); irq_connect_dynamic(HAL_RADIO_IRQn, CONFIG_BT_CTLR_LLL_PRIO, radio_nrf5_isr, NULL, IRQ_CONNECT_FLAGS); +#if defined(CONFIG_BT_CTLR_RADIO_TIMER_ISR) + ARM_IRQ_DIRECT_DYNAMIC_CONNECT(TIMER0_IRQn, CONFIG_BT_CTLR_LLL_PRIO, + IRQ_CONNECT_FLAGS, no_reschedule); + irq_connect_dynamic(TIMER0_IRQn, CONFIG_BT_CTLR_LLL_PRIO, + timer_nrf5_isr, NULL, IRQ_CONNECT_FLAGS); +#endif /* CONFIG_BT_CTLR_RADIO_TIMER_ISR */ #else /* !CONFIG_DYNAMIC_DIRECT_INTERRUPTS */ IRQ_DIRECT_CONNECT(HAL_RADIO_IRQn, CONFIG_BT_CTLR_LLL_PRIO, radio_nrf5_isr, IRQ_CONNECT_FLAGS); +#if defined(CONFIG_BT_CTLR_RADIO_TIMER_ISR) + IRQ_DIRECT_CONNECT(TIMER0_IRQn, CONFIG_BT_CTLR_LLL_PRIO, + timer_nrf5_isr, IRQ_CONNECT_FLAGS); +#endif /* CONFIG_BT_CTLR_RADIO_TIMER_ISR */ #endif /* !CONFIG_DYNAMIC_DIRECT_INTERRUPTS */ irq_connect_dynamic(HAL_RTC_IRQn, CONFIG_BT_CTLR_ULL_HIGH_PRIO, rtc0_nrf5_isr, NULL, 0U); @@ -238,6 +275,10 @@ int lll_init(void) #else /* !CONFIG_BT_CTLR_DYNAMIC_INTERRUPTS */ IRQ_DIRECT_CONNECT(HAL_RADIO_IRQn, CONFIG_BT_CTLR_LLL_PRIO, radio_nrf5_isr, IRQ_CONNECT_FLAGS); +#if defined(CONFIG_BT_CTLR_RADIO_TIMER_ISR) + IRQ_DIRECT_CONNECT(TIMER0_IRQn, CONFIG_BT_CTLR_LLL_PRIO, + timer_nrf5_isr, IRQ_CONNECT_FLAGS); +#endif /* CONFIG_BT_CTLR_RADIO_TIMER_ISR */ IRQ_CONNECT(HAL_RTC_IRQn, CONFIG_BT_CTLR_ULL_HIGH_PRIO, rtc0_nrf5_isr, NULL, 0); #if defined(CONFIG_BT_CTLR_ZLI) @@ -298,6 +339,10 @@ int lll_deinit(void) #if defined(CONFIG_DYNAMIC_DIRECT_INTERRUPTS) irq_disconnect_dynamic(HAL_RADIO_IRQn, CONFIG_BT_CTLR_LLL_PRIO, radio_nrf5_isr, NULL, IRQ_CONNECT_FLAGS); +#if defined(CONFIG_BT_CTLR_RADIO_TIMER_ISR) + irq_disconnect_dynamic(TIMER0_IRQn, CONFIG_BT_CTLR_LLL_PRIO, + timer_nrf5_isr, NULL, IRQ_CONNECT_FLAGS); +#endif /* CONFIG_BT_CTLR_RADIO_TIMER_ISR */ #endif /* CONFIG_DYNAMIC_DIRECT_INTERRUPTS */ irq_disconnect_dynamic(HAL_RTC_IRQn, CONFIG_BT_CTLR_ULL_HIGH_PRIO, rtc0_nrf5_isr, NULL, 0U); From 2ab1671af10e537cfd7446672375ebbb4a881867 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Thu, 9 May 2024 12:41:59 +0200 Subject: [PATCH 1528/4482] Bluetooth: Controller: Introduce deferred ACL Tx packet transmission Introduce deferred ACL Tx packet transmission setup by radio, so that an enqueued ACL Data packet can be transmitted with the shortest latency. Signed-off-by: Vinayak Kariappa Chettimada --- .../bluetooth/controller/Kconfig.ll_sw_split | 8 ++++ .../ll_sw/nordic/hal/nrf5/radio/radio_nrf5.h | 3 ++ .../controller/ll_sw/nordic/lll/lll_conn.c | 47 ++++++++++++++++++- .../ll_sw/nordic/lll/lll_peripheral.c | 2 + 4 files changed, 59 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/controller/Kconfig.ll_sw_split b/subsys/bluetooth/controller/Kconfig.ll_sw_split index 7b2231ac13590..5924fcb6035f1 100644 --- a/subsys/bluetooth/controller/Kconfig.ll_sw_split +++ b/subsys/bluetooth/controller/Kconfig.ll_sw_split @@ -1022,6 +1022,14 @@ config BT_CTLR_TX_RETRY_DISABLE would happen in the next connection event instead of repeated retries in the current connection event. +config BT_CTLR_TX_DEFER + bool "Deferred ACL Tx packet transmission setup" + select BT_CTLR_RADIO_TIMER_ISR + help + Enable deferred ACL Tx packet transmission setup by radio, so that an + enqueued ACL Data packet by the upper layer can be transmitted with + the shortest latency. + config BT_CTLR_THROUGHPUT bool "Measure incoming Tx throughput" help diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5.h b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5.h index 414e4a0dbb562..327888e4dfecd 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5.h +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5.h @@ -109,3 +109,6 @@ #else /* For simulated targets there is no delay for the PPI task -> TIMER start */ #define HAL_RADIO_TMR_START_DELAY_US 0U #endif + +/* This is the minimum prepare duration required to setup radio for deferred transmission */ +#define HAL_RADIO_TMR_DEFERRED_TX_DELAY_US 50U diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c index c1cbbd6e6ff8a..35c5162391ff1 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c @@ -48,11 +48,18 @@ static void isr_done(void *param); static inline int isr_rx_pdu(struct lll_conn *lll, struct pdu_data *pdu_data_rx, uint8_t *is_rx_enqueue, struct node_tx **tx_release, uint8_t *is_done); + +#if defined(CONFIG_BT_CTLR_TX_DEFER) +static void isr_tx_deferred_set(void *param); +#endif /* CONFIG_BT_CTLR_TX_DEFER */ + static void empty_tx_init(void); + #if defined(CONFIG_BT_CTLR_DF_CONN_CTE_RX) static inline bool create_iq_report(struct lll_conn *lll, uint8_t rssi_ready, uint8_t packet_status); #endif /* CONFIG_BT_CTLR_DF_CONN_CTE_RX */ + #if defined(CONFIG_BT_CTLR_DF_CONN_CTE_TX) static struct pdu_data *get_last_tx_pdu(struct lll_conn *lll); #endif /* CONFIG_BT_CTLR_DF_CONN_CTE_TX */ @@ -365,7 +372,8 @@ void lll_conn_isr_rx(void *param) } /* Decide on event continuation and hence Radio Shorts to use */ - is_done = is_done || ((crc_ok) && (pdu_data_rx->md == 0) && + is_done = is_done || ((crc_ok) && + (pdu_data_rx->md == 0) && (pdu_data_tx->md == 0) && (pdu_data_tx->len == 0)); @@ -445,6 +453,22 @@ void lll_conn_isr_rx(void *param) LL_ASSERT(!radio_is_address()); } +#if defined(CONFIG_BT_CTLR_TX_DEFER) + if (!is_empty_pdu_tx_retry && (pdu_data_tx->len == 0U)) { + uint32_t tx_defer_us; + uint32_t defer_us; + + /* Restore state if transmission setup for empty PDU */ + lll->empty = 0U; + + /* Setup deferred tx packet set */ + tx_defer_us = radio_tmr_tifs_base_get() + EVENT_IFS_US - + HAL_RADIO_TMR_DEFERRED_TX_DELAY_US; + defer_us = radio_tmr_isr_set(tx_defer_us, isr_tx_deferred_set, + param); + } +#endif /* CONFIG_BT_CTLR_TX_DEFER */ + lll_conn_isr_rx_exit: /* Save the AA captured for the first Rx in connection event */ if (!radio_tmr_aa_restore()) { @@ -666,9 +690,11 @@ void lll_conn_isr_tx(void *param) } #if defined(CONFIG_BT_CTLR_PROFILE_ISR) || \ + defined(CONFIG_BT_CTLR_TX_DEFER) || \ defined(HAL_RADIO_GPIO_HAVE_PA_PIN) radio_tmr_end_capture(); #endif /* CONFIG_BT_CTLR_PROFILE_ISR || + * CONFIG_BT_CTLR_TX_DEFER || * HAL_RADIO_GPIO_HAVE_PA_PIN */ @@ -1125,6 +1151,25 @@ static inline int isr_rx_pdu(struct lll_conn *lll, struct pdu_data *pdu_data_rx, return 0; } +#if defined(CONFIG_BT_CTLR_TX_DEFER) +static void isr_tx_deferred_set(void *param) +{ + struct pdu_data *pdu_data_tx; + struct lll_conn *lll; + + /* Prepare Tx PDU, maybe we have non-empty PDU when we check here */ + lll = param; + lll_conn_pdu_tx_prep(lll, &pdu_data_tx); + + /* Fill sn and nesn */ + pdu_data_tx->sn = lll->sn; + pdu_data_tx->nesn = lll->nesn; + + /* setup the radio tx packet buffer */ + lll_conn_tx_pkt_set(lll, pdu_data_tx); +} +#endif /* CONFIG_BT_CTLR_TX_DEFER */ + static void empty_tx_init(void) { struct pdu_data *p; diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c index 618512adf16ed..392686e573de9 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c @@ -315,9 +315,11 @@ static int prepare_cb(struct lll_prepare_param *p) #endif /* HAL_RADIO_GPIO_HAVE_LNA_PIN */ #if defined(CONFIG_BT_CTLR_PROFILE_ISR) || \ + defined(CONFIG_BT_CTLR_TX_DEFER) || \ defined(HAL_RADIO_GPIO_HAVE_PA_PIN) radio_tmr_end_capture(); #endif /* CONFIG_BT_CTLR_PROFILE_ISR || + * CONFIG_BT_CTLR_TX_DEFER || * HAL_RADIO_GPIO_HAVE_PA_PIN */ From cbae5d5f3fcd433198d72e7ef8287ba0421ecbe7 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Fri, 10 May 2024 18:48:09 +0200 Subject: [PATCH 1529/4482] tests: bsim: Bluetooth: Deferred ACL Tx transmission setup Added test to verify deferred ACL Tx transmission setup, such that GATT discovery completes with least latency and GATT notifications can be received earliest after connection establishment. Signed-off-by: Vinayak Kariappa Chettimada --- tests/bsim/bluetooth/ll/compile.sh | 1 + .../bluetooth/ll/conn/prj_split_tx_defer.conf | 19 ++++++++++++++ .../bluetooth/ll/conn/src/test_connect1.c | 7 +++++- .../bluetooth/ll/conn/src/test_connect2.c | 6 ++++- .../basic_conn_split_tx_defer.sh | 25 +++++++++++++++++++ 5 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 tests/bsim/bluetooth/ll/conn/prj_split_tx_defer.conf create mode 100755 tests/bsim/bluetooth/ll/conn/tests_scripts/basic_conn_split_tx_defer.sh diff --git a/tests/bsim/bluetooth/ll/compile.sh b/tests/bsim/bluetooth/ll/compile.sh index bdb385c65108a..4937c72951d14 100755 --- a/tests/bsim/bluetooth/ll/compile.sh +++ b/tests/bsim/bluetooth/ll/compile.sh @@ -17,6 +17,7 @@ app=tests/bsim/bluetooth/ll/advx \ conf_overlay=overlay-ticker_expire_info.conf compile app=tests/bsim/bluetooth/ll/conn conf_file=prj_split.conf compile +app=tests/bsim/bluetooth/ll/conn conf_file=prj_split_tx_defer.conf compile app=tests/bsim/bluetooth/ll/conn conf_file=prj_split_privacy.conf compile app=tests/bsim/bluetooth/ll/conn conf_file=prj_split_low_lat.conf compile app=tests/bsim/bluetooth/ll/conn conf_file=prj_split_single_timer.conf compile diff --git a/tests/bsim/bluetooth/ll/conn/prj_split_tx_defer.conf b/tests/bsim/bluetooth/ll/conn/prj_split_tx_defer.conf new file mode 100644 index 0000000000000..22dc32be4c429 --- /dev/null +++ b/tests/bsim/bluetooth/ll/conn/prj_split_tx_defer.conf @@ -0,0 +1,19 @@ +CONFIG_BT=y +CONFIG_LOG=y +CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_PRIVACY=y +CONFIG_BT_SMP=y +CONFIG_BT_SIGNING=y +CONFIG_BT_BAS=y +CONFIG_BT_HRS=y +CONFIG_BT_ATT_PREPARE_COUNT=2 +CONFIG_BT_GATT_CLIENT=y +CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y +CONFIG_BT_DEVICE_NAME="bsim_test_split" +CONFIG_BT_L2CAP_TX_BUF_COUNT=6 + +CONFIG_BT_CTLR_PRIVACY=n + +CONFIG_BT_CTLR_ADVANCED_FEATURES=y +CONFIG_BT_CTLR_TX_DEFER=y diff --git a/tests/bsim/bluetooth/ll/conn/src/test_connect1.c b/tests/bsim/bluetooth/ll/conn/src/test_connect1.c index 0e1da09068758..d1373084da565 100644 --- a/tests/bsim/bluetooth/ll/conn/src/test_connect1.c +++ b/tests/bsim/bluetooth/ll/conn/src/test_connect1.c @@ -60,6 +60,7 @@ static uint8_t connected_signal; */ #define WAIT_TIME 6 /*seconds*/ +#define WAIT_TIME_TX_DEFER 800 /* milliseconds */ #define WAIT_TIME_REPEAT 22 /*seconds*/ extern enum bst_result_t bst_result; @@ -77,7 +78,11 @@ extern enum bst_result_t bst_result; static void test_con1_init(void) { - bst_ticker_set_next_tick_absolute(WAIT_TIME*1e6); + if (IS_ENABLED(CONFIG_BT_CTLR_TX_DEFER)) { + bst_ticker_set_next_tick_absolute(WAIT_TIME_TX_DEFER*1e3); + } else { + bst_ticker_set_next_tick_absolute(WAIT_TIME*1e6); + } bst_result = In_progress; } diff --git a/tests/bsim/bluetooth/ll/conn/src/test_connect2.c b/tests/bsim/bluetooth/ll/conn/src/test_connect2.c index 44b7af7a55f5a..54551f01b5059 100644 --- a/tests/bsim/bluetooth/ll/conn/src/test_connect2.c +++ b/tests/bsim/bluetooth/ll/conn/src/test_connect2.c @@ -209,7 +209,11 @@ static void test_con2_main(void) * of starting delayed work so we do it here */ while (1) { - k_sleep(K_SECONDS(1)); + if (IS_ENABLED(CONFIG_BT_CTLR_TX_DEFER)) { + k_sleep(K_MSEC(1)); + } else { + k_sleep(K_SECONDS(1)); + } /* Heartrate measurements simulation */ hrs_notify(); diff --git a/tests/bsim/bluetooth/ll/conn/tests_scripts/basic_conn_split_tx_defer.sh b/tests/bsim/bluetooth/ll/conn/tests_scripts/basic_conn_split_tx_defer.sh new file mode 100755 index 0000000000000..59c7c465be021 --- /dev/null +++ b/tests/bsim/bluetooth/ll/conn/tests_scripts/basic_conn_split_tx_defer.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# Copyright 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source ${ZEPHYR_BASE}/tests/bsim/sh_common.source + +# Basic connection test: a central connects to a peripheral and expects a +# notification, using the split controller (ULL LLL) +simulation_id="basic_conn_split_tx_defer" +verbosity_level=2 + +cd ${BSIM_OUT_PATH}/bin + +Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_conn_prj_split_tx_defer_conf \ + -v=${verbosity_level} -s=${simulation_id} -d=0 -RealEncryption=0 \ + -testid=peripheral -rs=23 + +Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_conn_prj_split_tx_defer_conf\ + -v=${verbosity_level} -s=${simulation_id} -d=1 -RealEncryption=0 \ + -testid=central -rs=6 + +Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ + -D=2 -sim_length=20e6 $@ + +wait_for_background_jobs From e7799d4977682457c2b1799f2bad3e973c07c41d Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Wed, 8 May 2024 05:21:56 +0200 Subject: [PATCH 1530/4482] Bluetooth: Controller: Separate Tx/Rx frame spacing Separate Tx/Rx frame spacing. Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/lll_conn.h | 7 +++++- .../bluetooth/controller/ll_sw/lll_conn_iso.h | 5 ++++ .../controller/ll_sw/nordic/lll/lll_central.c | 2 +- .../ll_sw/nordic/lll/lll_central_iso.c | 10 ++++---- .../controller/ll_sw/nordic/lll/lll_conn.c | 23 +++++++++++-------- .../ll_sw/nordic/lll/lll_peripheral.c | 2 +- .../ll_sw/nordic/lll/lll_peripheral_iso.c | 8 +++---- subsys/bluetooth/controller/ll_sw/pdu.h | 2 ++ .../bluetooth/controller/ll_sw/ull_central.c | 7 +++++- .../controller/ll_sw/ull_central_iso.c | 1 + subsys/bluetooth/controller/ll_sw/ull_conn.c | 2 +- .../controller/ll_sw/ull_peripheral.c | 7 +++++- .../controller/ll_sw/ull_peripheral_iso.c | 4 ++++ 13 files changed, 55 insertions(+), 25 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/lll_conn.h b/subsys/bluetooth/controller/ll_sw/lll_conn.h index b57e4db5ea24c..5e196c0ad5a28 100644 --- a/subsys/bluetooth/controller/ll_sw/lll_conn.h +++ b/subsys/bluetooth/controller/ll_sw/lll_conn.h @@ -43,10 +43,15 @@ struct lll_conn { uint8_t access_addr[4]; uint8_t crc_init[3]; + uint16_t tifs_tx_us; + uint16_t tifs_rx_us; + uint16_t tifs_hcto_us; + uint16_t tifs_cis_us; + uint16_t handle; uint16_t interval; - uint16_t latency; + uint16_t latency; uint16_t latency_prepare; uint16_t lazy_prepare; uint16_t latency_event; diff --git a/subsys/bluetooth/controller/ll_sw/lll_conn_iso.h b/subsys/bluetooth/controller/ll_sw/lll_conn_iso.h index a8c1d5325905e..31e2f70fcd61b 100644 --- a/subsys/bluetooth/controller/ll_sw/lll_conn_iso.h +++ b/subsys/bluetooth/controller/ll_sw/lll_conn_iso.h @@ -36,6 +36,11 @@ struct lll_conn_iso_stream { uint32_t offset; /* Offset of CIS from start of CIG in us */ uint32_t sub_interval; /* Interval between subevents in us */ uint8_t nse:5; /* Number of subevents */ + + /* Frame Spacing */ + uint16_t tifs_us; + + /* Stream parameters */ struct lll_conn_iso_stream_rxtx rx; /* RX parameters */ struct lll_conn_iso_stream_rxtx tx; /* TX parameters */ diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c index 7a8405de84c9e..a66de337cfc30 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c @@ -186,7 +186,7 @@ static int prepare_cb(struct lll_prepare_param *p) radio_isr_set(lll_conn_isr_tx, lll); - radio_tmr_tifs_set(EVENT_IFS_US); + radio_tmr_tifs_set(lll->tifs_rx_us); #if defined(CONFIG_BT_CTLR_DF_CONN_CTE_RX) /* If CTE RX is enabled and the PHY is not CODED, store channel used for diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c index 218a1d133c094..4b4a76a3dec2e 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central_iso.c @@ -306,7 +306,7 @@ static int prepare_cb(struct lll_prepare_param *p) radio_isr_set(isr_tx, cis_lll); - radio_tmr_tifs_set(EVENT_IFS_US); + radio_tmr_tifs_set(cis_lll->tifs_us); #if defined(CONFIG_BT_CTLR_PHY) radio_switch_complete_and_rx(cis_lll->rx.phy); @@ -501,7 +501,7 @@ static void isr_tx(void *param) LL_ASSERT(!radio_is_ready()); /* +/- 2us active clock jitter, +1 us PPI to timer start compensation */ - hcto = radio_tmr_tifs_base_get() + EVENT_IFS_US + + hcto = radio_tmr_tifs_base_get() + cis_lll->tifs_us + (EVENT_CLOCK_JITTER_US << 1) + RANGE_DELAY_US + HAL_RADIO_TMR_START_DELAY_US; @@ -527,13 +527,13 @@ static void isr_tx(void *param) radio_gpio_lna_setup(); #if defined(CONFIG_BT_CTLR_PHY) - radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + EVENT_IFS_US - + radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + cis_lll->tifs_us - (EVENT_CLOCK_JITTER_US << 1) - radio_tx_chain_delay_get(cis_lll->tx.phy, cis_lll->tx.phy_flags) - HAL_RADIO_GPIO_LNA_OFFSET); #else /* !CONFIG_BT_CTLR_PHY */ - radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + EVENT_IFS_US - + radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + cis_lll->tifs_us - (EVENT_CLOCK_JITTER_US << 1) - radio_tx_chain_delay_get(0U, 0U) - HAL_RADIO_GPIO_LNA_OFFSET); @@ -1044,7 +1044,7 @@ static void isr_prepare_subevent(void *param) radio_tmr_rx_disable(); radio_tmr_tx_enable(); - radio_tmr_tifs_set(EVENT_IFS_US); + radio_tmr_tifs_set(cis_lll->tifs_us); #if defined(CONFIG_BT_CTLR_PHY) radio_switch_complete_and_rx(cis_lll->rx.phy); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c index 35c5162391ff1..52a1f326c297f 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c @@ -403,7 +403,7 @@ void lll_conn_isr_rx(void *param) #endif /* CONFIG_BT_PERIPHERAL */ } } else { - radio_tmr_tifs_set(EVENT_IFS_US); + radio_tmr_tifs_set(lll->tifs_rx_us); #if defined(CONFIG_BT_CTLR_PHY) radio_switch_complete_and_rx(lll->phy_rx); @@ -436,7 +436,7 @@ void lll_conn_isr_rx(void *param) radio_gpio_pa_setup(); pa_lna_enable_us = - radio_tmr_tifs_base_get() + EVENT_IFS_US + cte_len - HAL_RADIO_GPIO_PA_OFFSET; + radio_tmr_tifs_base_get() + lll->tifs_tx_us - cte_len - HAL_RADIO_GPIO_PA_OFFSET; #if defined(CONFIG_BT_CTLR_PHY) pa_lna_enable_us -= radio_rx_chain_delay_get(lll->phy_rx, PHY_FLAGS_S8); #else /* !CONFIG_BT_CTLR_PHY */ @@ -462,7 +462,7 @@ void lll_conn_isr_rx(void *param) lll->empty = 0U; /* Setup deferred tx packet set */ - tx_defer_us = radio_tmr_tifs_base_get() + EVENT_IFS_US - + tx_defer_us = radio_tmr_tifs_base_get() + lll->tifs_tx_us - HAL_RADIO_TMR_DEFERRED_TX_DELAY_US; defer_us = radio_tmr_isr_set(tx_defer_us, isr_tx_deferred_set, param); @@ -575,11 +575,11 @@ void lll_conn_isr_tx(void *param) /* Clear radio tx status and events */ lll_isr_tx_status_reset(); - /* setup tIFS switching */ - radio_tmr_tifs_set(EVENT_IFS_US); - lll = param; + /* setup tIFS switching */ + radio_tmr_tifs_set(lll->tifs_tx_us); + #if defined(CONFIG_BT_CTLR_DF_CONN_CTE_RX) #if defined(CONFIG_BT_CTLR_DF_PHYEND_OFFSET_COMPENSATION_ENABLE) enum radio_end_evt_delay_state end_evt_delay; @@ -616,6 +616,7 @@ void lll_conn_isr_tx(void *param) #if defined(CONFIG_BT_CTLR_DF_PHYEND_OFFSET_COMPENSATION_ENABLE) /* Use special API for SOC that requires compensation for PHYEND event delay. */ + #if defined(CONFIG_BT_CTLR_PHY) radio_switch_complete_with_delay_compensation_and_tx(lll->phy_rx, 0, lll->phy_tx, lll->phy_flags, end_evt_delay); @@ -660,7 +661,7 @@ void lll_conn_isr_tx(void *param) #endif /* CONFIG_BT_CTLR_DF_CONN_CTE_TX */ /* +/- 2us active clock jitter, +1 us PPI to timer start compensation */ - hcto = radio_tmr_tifs_base_get() + EVENT_IFS_US + + hcto = radio_tmr_tifs_base_get() + lll->tifs_hcto_us + (EVENT_CLOCK_JITTER_US << 1) + RANGE_DELAY_US + HAL_RADIO_TMR_START_DELAY_US; #if defined(CONFIG_BT_CTLR_DF_CONN_CTE_TX) @@ -701,13 +702,15 @@ void lll_conn_isr_tx(void *param) #if defined(HAL_RADIO_GPIO_HAVE_LNA_PIN) radio_gpio_lna_setup(); #if defined(CONFIG_BT_CTLR_PHY) - radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + EVENT_IFS_US - 4 - + radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + lll->tifs_rx_us - + (EVENT_CLOCK_JITTER_US << 1) - radio_tx_chain_delay_get(lll->phy_tx, lll->phy_flags) - HAL_RADIO_GPIO_LNA_OFFSET); #else /* !CONFIG_BT_CTLR_PHY */ - radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + EVENT_IFS_US - 4 - - radio_tx_chain_delay_get(0, 0) - + radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() + lll->tifs_rx_us - + (EVENT_CLOCK_JITTER_US << 1) - + radio_tx_chain_delay_get(0U, 0U) - HAL_RADIO_GPIO_LNA_OFFSET); #endif /* !CONFIG_BT_CTLR_PHY */ #endif /* HAL_RADIO_GPIO_HAVE_LNA_PIN */ diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c index 392686e573de9..13e2adf05b171 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c @@ -211,7 +211,7 @@ static int prepare_cb(struct lll_prepare_param *p) radio_isr_set(lll_conn_isr_rx, lll); - radio_tmr_tifs_set(EVENT_IFS_US); + radio_tmr_tifs_set(lll->tifs_tx_us); #if defined(CONFIG_BT_CTLR_DF_CONN_CTE_RX) #if defined(CONFIG_BT_CTLR_DF_PHYEND_OFFSET_COMPENSATION_ENABLE) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c index 1391755274dc1..d189a22d61e41 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c @@ -261,7 +261,7 @@ static int prepare_cb(struct lll_prepare_param *p) radio_isr_set(isr_rx, cis_lll); - radio_tmr_tifs_set(EVENT_IFS_US); + radio_tmr_tifs_set(cis_lll->tifs_us); #if defined(CONFIG_BT_CTLR_PHY) radio_switch_complete_and_tx(cis_lll->rx.phy, 0U, cis_lll->tx.phy, @@ -743,7 +743,7 @@ static void isr_rx(void *param) radio_gpio_pa_setup(); - pa_lna_enable_us = radio_tmr_tifs_base_get() + EVENT_IFS_US - + pa_lna_enable_us = radio_tmr_tifs_base_get() + cis_lll->tifs_us - HAL_RADIO_GPIO_PA_OFFSET; #if defined(CONFIG_BT_CTLR_PHY) pa_lna_enable_us -= radio_rx_chain_delay_get(cis_lll->rx.phy, @@ -897,7 +897,7 @@ static void isr_tx(void *param) radio_tmr_tx_disable(); radio_tmr_rx_enable(); - radio_tmr_tifs_set(EVENT_IFS_US); + radio_tmr_tifs_set(cis_lll->tifs_us); #if defined(CONFIG_BT_CTLR_PHY) radio_switch_complete_and_tx(cis_lll->rx.phy, 0U, cis_lll->tx.phy, @@ -1114,7 +1114,7 @@ static void isr_prepare_subevent_common(void *param) radio_tmr_tx_disable(); radio_tmr_rx_enable(); - radio_tmr_tifs_set(EVENT_IFS_US); + radio_tmr_tifs_set(cis_lll->tifs_us); #if defined(CONFIG_BT_CTLR_PHY) radio_switch_complete_and_tx(cis_lll->rx.phy, 0U, cis_lll->tx.phy, diff --git a/subsys/bluetooth/controller/ll_sw/pdu.h b/subsys/bluetooth/controller/ll_sw/pdu.h index 9457511977357..4e48c699c0ccc 100644 --- a/subsys/bluetooth/controller/ll_sw/pdu.h +++ b/subsys/bluetooth/controller/ll_sw/pdu.h @@ -185,6 +185,8 @@ #define EVENT_CLOCK_JITTER_US 2 /* Event interframe timings */ #define EVENT_IFS_US 150 +/* Event interframe timings, default */ +#define EVENT_IFS_DEFAULT_US EVENT_IFS_US /* Standard allows 2 us timing uncertainty inside the event */ #define EVENT_IFS_MAX_US (EVENT_IFS_US + EVENT_CLOCK_JITTER_US) /* Specification defined Minimum AUX Frame Space (MAFS) */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_central.c b/subsys/bluetooth/controller/ll_sw/ull_central.c index d5414be527634..aadeeb8d8f6bb 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_central.c +++ b/subsys/bluetooth/controller/ll_sw/ull_central.c @@ -311,6 +311,11 @@ uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window, /* Re-initialize the Tx Q */ ull_tx_q_init(&conn->tx_q); + conn_lll->tifs_tx_us = EVENT_IFS_DEFAULT_US; + conn_lll->tifs_rx_us = EVENT_IFS_DEFAULT_US; + conn_lll->tifs_hcto_us = EVENT_IFS_DEFAULT_US; + conn_lll->tifs_cis_us = EVENT_IFS_DEFAULT_US; + /* TODO: active_to_start feature port */ conn->ull.ticks_active_to_start = 0U; conn->ull.ticks_prepare_to_start = @@ -363,7 +368,7 @@ uint8_t ll_create_connection(uint16_t scan_interval, uint16_t scan_window, /* Calculate event time reservation */ slot_us = max_tx_time + max_rx_time; - slot_us += EVENT_IFS_US + (EVENT_CLOCK_JITTER_US << 1); + slot_us += conn_lll->tifs_rx_us + (EVENT_CLOCK_JITTER_US << 1); slot_us += ready_delay_us; slot_us += EVENT_OVERHEAD_START_US + EVENT_OVERHEAD_END_US; diff --git a/subsys/bluetooth/controller/ll_sw/ull_central_iso.c b/subsys/bluetooth/controller/ll_sw/ull_central_iso.c index 957d4e8863b1e..e46ecfb8c3916 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_central_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_central_iso.c @@ -931,6 +931,7 @@ uint8_t ull_central_iso_setup(uint16_t cis_handle, #endif /* CONFIG_BT_CTLR_ISOAL_PSN_IGNORE */ cis->lll.event_count = LLL_CONN_ISO_EVENT_COUNT_MAX; cis->lll.next_subevent = 0U; + cis->lll.tifs_us = conn->lll.tifs_cis_us; cis->lll.sn = 0U; cis->lll.nesn = 0U; cis->lll.cie = 0U; diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn.c b/subsys/bluetooth/controller/ll_sw/ull_conn.c index 7335473556d63..c9ebeb9c274d8 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn.c +++ b/subsys/bluetooth/controller/ll_sw/ull_conn.c @@ -1308,7 +1308,7 @@ void ull_conn_done(struct node_rx_event_done *done) /* Calculate event time reservation */ slot_us = tx_time + rx_time; - slot_us += EVENT_IFS_US + (EVENT_CLOCK_JITTER_US << 1); + slot_us += lll->tifs_rx_us + (EVENT_CLOCK_JITTER_US << 1); slot_us += ready_delay; if (IS_ENABLED(CONFIG_BT_CTLR_EVENT_OVERHEAD_RESERVE_MAX) || diff --git a/subsys/bluetooth/controller/ll_sw/ull_peripheral.c b/subsys/bluetooth/controller/ll_sw/ull_peripheral.c index 0aa64d1afd36e..76ea607df4b0c 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_peripheral.c +++ b/subsys/bluetooth/controller/ll_sw/ull_peripheral.c @@ -386,9 +386,14 @@ void ull_periph_setup(struct node_rx_pdu *rx, struct node_rx_ftr *ftr, ready_delay_us = lll_radio_rx_ready_delay_get(0U, 0U); #endif /* CONFIG_BT_CTLR_PHY */ + lll->tifs_tx_us = EVENT_IFS_DEFAULT_US; + lll->tifs_rx_us = EVENT_IFS_DEFAULT_US; + lll->tifs_hcto_us = EVENT_IFS_DEFAULT_US; + lll->tifs_cis_us = EVENT_IFS_DEFAULT_US; + /* Calculate event time reservation */ slot_us = max_rx_time + max_tx_time; - slot_us += EVENT_IFS_US + (EVENT_CLOCK_JITTER_US << 1); + slot_us += lll->tifs_rx_us + (EVENT_CLOCK_JITTER_US << 1); slot_us += ready_delay_us; if (IS_ENABLED(CONFIG_BT_CTLR_EVENT_OVERHEAD_RESERVE_MAX)) { diff --git a/subsys/bluetooth/controller/ll_sw/ull_peripheral_iso.c b/subsys/bluetooth/controller/ll_sw/ull_peripheral_iso.c index b7718a3091f80..345fddb874652 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_peripheral_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_peripheral_iso.c @@ -294,6 +294,7 @@ uint8_t ull_peripheral_iso_setup(struct pdu_data_llctrl_cis_ind *ind, { struct ll_conn_iso_stream *cis = NULL; struct ll_conn_iso_group *cig; + struct ll_conn *conn; uint32_t cis_offset; /* Get CIG by id */ @@ -310,6 +311,8 @@ uint8_t ull_peripheral_iso_setup(struct pdu_data_llctrl_cis_ind *ind, return BT_HCI_ERR_UNSPECIFIED; } + conn = ll_conn_get(cis->lll.acl_handle); + cis_offset = sys_get_le24(ind->cis_offset); #if defined(CONFIG_BT_CTLR_PERIPHERAL_ISO_EARLY_CIG_START) @@ -332,6 +335,7 @@ uint8_t ull_peripheral_iso_setup(struct pdu_data_llctrl_cis_ind *ind, #endif /* CONFIG_BT_CTLR_ISOAL_PSN_IGNORE */ cis->lll.event_count = LLL_CONN_ISO_EVENT_COUNT_MAX; cis->lll.next_subevent = 0U; + cis->lll.tifs_us = conn->lll.tifs_cis_us; cis->lll.sn = 0U; cis->lll.nesn = 0U; cis->lll.cie = 0U; From abfe5f17a949752ff0affecf8932e77b7d57e430 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Wed, 23 Jan 2019 23:36:52 +0530 Subject: [PATCH 1531/4482] Bluetooth: Controller: 1 ms connection 1 ms connection interval support. Signed-off-by: Vinayak Kariappa Chettimada --- .../bluetooth/controller/Kconfig.ll_sw_split | 13 ++ subsys/bluetooth/controller/ll_sw/lll.h | 11 +- subsys/bluetooth/controller/ll_sw/lll_conn.h | 5 +- .../controller/ll_sw/nordic/lll/lll.c | 13 +- .../controller/ll_sw/nordic/lll/lll_central.c | 4 +- .../controller/ll_sw/nordic/lll/lll_conn.c | 34 +++- .../ll_sw/nordic/lll/lll_peripheral.c | 4 +- subsys/bluetooth/controller/ll_sw/ull_conn.c | 164 +++++++++++++++--- .../controller/ll_sw/ull_conn_types.h | 1 + .../bluetooth/controller/ll_sw/ull_internal.h | 8 +- 10 files changed, 215 insertions(+), 42 deletions(-) diff --git a/subsys/bluetooth/controller/Kconfig.ll_sw_split b/subsys/bluetooth/controller/Kconfig.ll_sw_split index 5924fcb6035f1..f5a2abe228a08 100644 --- a/subsys/bluetooth/controller/Kconfig.ll_sw_split +++ b/subsys/bluetooth/controller/Kconfig.ll_sw_split @@ -1090,6 +1090,19 @@ config BT_CTLR_ALLOW_SAME_PEER_CONN WARNING: This option enables behavior that violates the Bluetooth specification. +config BT_CTLR_CONN_INTERVAL_LOW_LATENCY + bool "Allow low latency connection intervals" + help + Allow low latency connection intervals. + +config BT_CTLR_EVENT_IFS_LOW_LAT_US + prompt "Low latency tIFS value in microseconds" if BT_CTLR_CONN_INTERVAL_LOW_LATENCY + int + default 52 if BT_CTLR_CONN_INTERVAL_LOW_LATENCY + default 150 + help + Set low latency tIFS value. + endif # BT_CONN config BT_CTLR_ADV_INDICATION diff --git a/subsys/bluetooth/controller/ll_sw/lll.h b/subsys/bluetooth/controller/ll_sw/lll.h index 9a002e4852d36..bfe9be02500e0 100644 --- a/subsys/bluetooth/controller/ll_sw/lll.h +++ b/subsys/bluetooth/controller/ll_sw/lll.h @@ -16,11 +16,12 @@ #define EVENT_PIPELINE_MAX 7 -#define ADV_INT_UNIT_US 625U -#define SCAN_INT_UNIT_US 625U -#define CONN_INT_UNIT_US 1250U -#define ISO_INT_UNIT_US CONN_INT_UNIT_US -#define PERIODIC_INT_UNIT_US CONN_INT_UNIT_US +#define ADV_INT_UNIT_US 625U +#define SCAN_INT_UNIT_US 625U +#define CONN_INT_UNIT_US 1250U +#define ISO_INT_UNIT_US CONN_INT_UNIT_US +#define PERIODIC_INT_UNIT_US CONN_INT_UNIT_US +#define CONN_LOW_LAT_INT_UNIT_US 500U #define ISO_INTERVAL_TO_US(interval) ((interval) * ISO_INT_UNIT_US) diff --git a/subsys/bluetooth/controller/ll_sw/lll_conn.h b/subsys/bluetooth/controller/ll_sw/lll_conn.h index 5e196c0ad5a28..19a7820ed9492 100644 --- a/subsys/bluetooth/controller/ll_sw/lll_conn.h +++ b/subsys/bluetooth/controller/ll_sw/lll_conn.h @@ -175,7 +175,10 @@ int lll_conn_reset(void); void lll_conn_flush(uint16_t handle, struct lll_conn *lll); void lll_conn_prepare_reset(void); -int lll_conn_is_abort_cb(void *next, void *curr, lll_prepare_cb_t *resume_cb); +int lll_conn_central_is_abort_cb(void *next, void *curr, + lll_prepare_cb_t *resume_cb); +int lll_conn_peripheral_is_abort_cb(void *next, void *curr, + lll_prepare_cb_t *resume_cb); void lll_conn_abort_cb(struct lll_prepare_param *prepare_param, void *param); void lll_conn_isr_rx(void *param); void lll_conn_isr_tx(void *param); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c index de8cffb388aa3..ebfdf364941ea 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c @@ -1311,10 +1311,15 @@ static void preempt(void *param) /* Check if current event want to continue */ err = event.curr.is_abort_cb(ready->prepare_param.param, event.curr.param, &resume_cb); - if (!err) { - /* Let preemptor LLL know about the cancelled prepare */ - ready->is_aborted = 1; - ready->abort_cb(&ready->prepare_param, ready->prepare_param.param); + if (!err || (err == -EBUSY)) { + /* Returns -EBUSY when same curr and next state/role, do not + * abort same curr and next event. + */ + if (err != -EBUSY) { + /* Let preemptor LLL know about the cancelled prepare */ + ready->is_aborted = 1; + ready->abort_cb(&ready->prepare_param, ready->prepare_param.param); + } return; } diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c index a66de337cfc30..0fd8a368047e1 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_central.c @@ -75,8 +75,8 @@ void lll_central_prepare(void *param) LL_ASSERT(err >= 0); /* Invoke common pipeline handling of prepare */ - err = lll_prepare(lll_is_abort_cb, lll_conn_abort_cb, prepare_cb, 0, - param); + err = lll_prepare(lll_conn_central_is_abort_cb, lll_conn_abort_cb, + prepare_cb, 0, param); LL_ASSERT(!err || err == -EINPROGRESS); } diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c index 52a1f326c297f..4f61cba9665bc 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c @@ -157,7 +157,9 @@ void lll_conn_prepare_reset(void) #endif /* CONFIG_BT_CTLR_LE_ENC */ } -int lll_conn_is_abort_cb(void *next, void *curr, lll_prepare_cb_t *resume_cb) +#if defined(CONFIG_BT_CENTRAL) +int lll_conn_central_is_abort_cb(void *next, void *curr, + lll_prepare_cb_t *resume_cb) { struct lll_conn *lll = curr; @@ -166,8 +168,38 @@ int lll_conn_is_abort_cb(void *next, void *curr, lll_prepare_cb_t *resume_cb) return 0; } + /* Do not be aborted by same event if a single central trx has not been + * exchanged. + */ + if ((next == curr) && (trx_cnt < 1U)) { + return -EBUSY; + } + return -ECANCELED; } +#endif /* CONFIG_BT_CENTRAL */ + +#if defined(CONFIG_BT_PERIPHERAL) +int lll_conn_peripheral_is_abort_cb(void *next, void *curr, + lll_prepare_cb_t *resume_cb) +{ + struct lll_conn *lll = curr; + + /* Do not abort if near supervision timeout */ + if (lll->forced) { + return 0; + } + + /* Do not be aborted by same event if a single peripheral trx has not + * been exchanged. + */ + if ((next == curr) && (trx_cnt <= 1U)) { + return -EBUSY; + } + + return -ECANCELED; +} +#endif /* CONFIG_BT_PERIPHERAL */ void lll_conn_abort_cb(struct lll_prepare_param *prepare_param, void *param) { diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c index 13e2adf05b171..c15ca24eb9096 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral.c @@ -80,8 +80,8 @@ void lll_periph_prepare(void *param) lll = p->param; /* Invoke common pipeline handling of prepare */ - err = lll_prepare(lll_conn_is_abort_cb, lll_conn_abort_cb, prepare_cb, - 0U, p); + err = lll_prepare(lll_conn_peripheral_is_abort_cb, lll_conn_abort_cb, + prepare_cb, 0U, param); LL_ASSERT(!err || err == -EINPROGRESS); } diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn.c b/subsys/bluetooth/controller/ll_sw/ull_conn.c index c9ebeb9c274d8..93a610fa705f5 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn.c +++ b/subsys/bluetooth/controller/ll_sw/ull_conn.c @@ -711,7 +711,13 @@ uint8_t ll_apto_get(uint16_t handle, uint16_t *apto) return BT_HCI_ERR_UNKNOWN_CONN_ID; } - *apto = conn->apto_reload * conn->lll.interval * 125U / 1000; + if (conn->lll.interval >= BT_HCI_LE_INTERVAL_MIN) { + *apto = conn->apto_reload * conn->lll.interval * + CONN_INT_UNIT_US / (10U * USEC_PER_MSEC); + } else { + *apto = conn->apto_reload * (conn->lll.interval + 1U) * + CONN_LOW_LAT_INT_UNIT_US / (10U * USEC_PER_MSEC); + } return 0; } @@ -725,9 +731,17 @@ uint8_t ll_apto_set(uint16_t handle, uint16_t apto) return BT_HCI_ERR_UNKNOWN_CONN_ID; } - conn->apto_reload = RADIO_CONN_EVENTS(apto * 10U * 1000U, - conn->lll.interval * - CONN_INT_UNIT_US); + if (conn->lll.interval >= BT_HCI_LE_INTERVAL_MIN) { + conn->apto_reload = + RADIO_CONN_EVENTS(apto * 10U * USEC_PER_MSEC, + conn->lll.interval * + CONN_INT_UNIT_US); + } else { + conn->apto_reload = + RADIO_CONN_EVENTS(apto * 10U * USEC_PER_MSEC, + (conn->lll.interval + 1U) * + CONN_LOW_LAT_INT_UNIT_US); + } return 0; } @@ -1061,8 +1075,17 @@ void ull_conn_done(struct node_rx_event_done *done) if (0) { #if defined(CONFIG_BT_PERIPHERAL) } else if (lll->role) { - ull_drift_ticks_get(done, &ticks_drift_plus, - &ticks_drift_minus); + if (!conn->periph.drift_skip) { + ull_drift_ticks_get(done, &ticks_drift_plus, + &ticks_drift_minus); + + if (ticks_drift_plus || ticks_drift_minus) { + conn->periph.drift_skip = + ull_ref_get(&conn->ull); + } + } else { + conn->periph.drift_skip--; + } if (!ull_tx_q_peek(&conn->tx_q)) { ull_conn_tx_demux(UINT8_MAX); @@ -1106,10 +1129,18 @@ void ull_conn_done(struct node_rx_event_done *done) else { /* Start supervision timeout, if not started already */ if (!conn->supervision_expire) { - const uint32_t conn_interval_us = conn->lll.interval * CONN_INT_UNIT_US; + uint32_t conn_interval_us; + + if (conn->lll.interval >= BT_HCI_LE_INTERVAL_MIN) { + conn_interval_us = conn->lll.interval * + CONN_INT_UNIT_US; + } else { + conn_interval_us = (conn->lll.interval + 1U) * + CONN_LOW_LAT_INT_UNIT_US; + } conn->supervision_expire = RADIO_CONN_EVENTS( - (conn->supervision_timeout * 10U * 1000U), + (conn->supervision_timeout * 10U * USEC_PER_MSEC), conn_interval_us); } } @@ -2186,17 +2217,22 @@ void ull_conn_update_parameters(struct ll_conn *conn, uint8_t is_cu_proc, uint8_ uint32_t win_offset_us, uint16_t interval, uint16_t latency, uint16_t timeout, uint16_t instant) { - struct lll_conn *lll; + uint16_t conn_interval_unit_old; + uint16_t conn_interval_unit_new; uint32_t ticks_win_offset = 0U; + uint16_t conn_interval_old_us; + uint16_t conn_interval_new_us; uint32_t ticks_slot_overhead; uint16_t conn_interval_old; uint16_t conn_interval_new; uint32_t conn_interval_us; - uint32_t periodic_us; - uint16_t latency_upd; + uint32_t ticks_at_expire; uint16_t instant_latency; + uint32_t ready_delay_us; uint16_t event_counter; - uint32_t ticks_at_expire; + uint32_t periodic_us; + uint16_t latency_upd; + struct lll_conn *lll; lll = &conn->lll; @@ -2220,16 +2256,89 @@ void ull_conn_update_parameters(struct ll_conn *conn, uint8_t is_cu_proc, uint8_ } #endif /* CONFIG_BT_CTLR_XTAL_ADVANCED */ +#if defined(CONFIG_BT_CTLR_PHY) + ready_delay_us = lll_radio_tx_ready_delay_get(lll->phy_tx, + lll->phy_flags); +#else + ready_delay_us = lll_radio_tx_ready_delay_get(0U, 0U); +#endif + /* compensate for instant_latency due to laziness */ - conn_interval_old = instant_latency * lll->interval; - latency_upd = conn_interval_old / interval; - conn_interval_new = latency_upd * interval; - if (conn_interval_new > conn_interval_old) { - ticks_at_expire += HAL_TICKER_US_TO_TICKS((conn_interval_new - conn_interval_old) * - CONN_INT_UNIT_US); + if (lll->interval >= BT_HCI_LE_INTERVAL_MIN) { + conn_interval_old = instant_latency * lll->interval; + conn_interval_unit_old = CONN_INT_UNIT_US; } else { - ticks_at_expire -= HAL_TICKER_US_TO_TICKS((conn_interval_old - conn_interval_new) * - CONN_INT_UNIT_US); + conn_interval_old = instant_latency * (lll->interval + 1U); + conn_interval_unit_old = CONN_LOW_LAT_INT_UNIT_US; + } + + if (interval >= BT_HCI_LE_INTERVAL_MIN) { + uint16_t max_tx_time; + uint16_t max_rx_time; + uint32_t slot_us; + + conn_interval_new = interval; + conn_interval_unit_new = CONN_INT_UNIT_US; + lll->tifs_tx_us = EVENT_IFS_DEFAULT_US; + lll->tifs_rx_us = EVENT_IFS_DEFAULT_US; + lll->tifs_hcto_us = EVENT_IFS_DEFAULT_US; + +#if defined(CONFIG_BT_CTLR_DATA_LENGTH) && \ + defined(CONFIG_BT_CTLR_SLOT_RESERVATION_UPDATE) + max_tx_time = lll->dle.eff.max_tx_time; + max_rx_time = lll->dle.eff.max_rx_time; + +#else /* !CONFIG_BT_CTLR_DATA_LENGTH || + * !CONFIG_BT_CTLR_SLOT_RESERVATION_UPDATE + */ + max_tx_time = PDU_DC_MAX_US(PDU_DC_PAYLOAD_SIZE_MIN, PHY_1M); + max_rx_time = PDU_DC_MAX_US(PDU_DC_PAYLOAD_SIZE_MIN, PHY_1M); +#if defined(CONFIG_BT_CTLR_PHY) + max_tx_time = MAX(max_tx_time, PDU_DC_MAX_US(PDU_DC_PAYLOAD_SIZE_MIN, lll->phy_tx)); + max_rx_time = MAX(max_rx_time, PDU_DC_MAX_US(PDU_DC_PAYLOAD_SIZE_MIN, lll->phy_rx)); +#endif /* !CONFIG_BT_CTLR_PHY */ +#endif /* !CONFIG_BT_CTLR_DATA_LENGTH || + * !CONFIG_BT_CTLR_SLOT_RESERVATION_UPDATE + */ + + /* Calculate event time reservation */ + slot_us = max_tx_time + max_rx_time; + slot_us += lll->tifs_rx_us + (EVENT_CLOCK_JITTER_US << 1); + slot_us += ready_delay_us; + + if (IS_ENABLED(CONFIG_BT_CTLR_EVENT_OVERHEAD_RESERVE_MAX) || + (lll->role == BT_HCI_ROLE_CENTRAL)) { + slot_us += EVENT_OVERHEAD_START_US + EVENT_OVERHEAD_END_US; + } + + conn->ull.ticks_slot = HAL_TICKER_US_TO_TICKS_CEIL(slot_us); + + } else { + conn_interval_new = interval + 1U; + conn_interval_unit_new = CONN_LOW_LAT_INT_UNIT_US; + lll->tifs_tx_us = CONFIG_BT_CTLR_EVENT_IFS_LOW_LAT_US; + lll->tifs_rx_us = CONFIG_BT_CTLR_EVENT_IFS_LOW_LAT_US; + lll->tifs_hcto_us = CONFIG_BT_CTLR_EVENT_IFS_LOW_LAT_US; + /* Reserve only the processing overhead, on overlap the + * is_abort_cb mechanism will ensure to continue the event so + * as to not loose anchor point sync. + */ + conn->ull.ticks_slot = + HAL_TICKER_US_TO_TICKS_CEIL(EVENT_OVERHEAD_START_US); + } + + conn_interval_us = conn_interval_new * conn_interval_unit_new; + periodic_us = conn_interval_us; + + conn_interval_old_us = conn_interval_old * conn_interval_unit_old; + latency_upd = conn_interval_old_us / conn_interval_us; + conn_interval_new_us = latency_upd * conn_interval_us; + if (conn_interval_new_us > conn_interval_old_us) { + ticks_at_expire += HAL_TICKER_US_TO_TICKS( + conn_interval_new_us - conn_interval_old_us); + } else { + ticks_at_expire -= HAL_TICKER_US_TO_TICKS( + conn_interval_old_us - conn_interval_new_us); } lll->latency_prepare += conn->llcp.prep.lazy; @@ -2238,15 +2347,14 @@ void ull_conn_update_parameters(struct ll_conn *conn, uint8_t is_cu_proc, uint8_ /* calculate the offset */ if (IS_ENABLED(CONFIG_BT_CTLR_LOW_LAT)) { ticks_slot_overhead = - MAX(conn->ull.ticks_active_to_start, conn->ull.ticks_prepare_to_start); + MAX(conn->ull.ticks_active_to_start, + conn->ull.ticks_prepare_to_start); + } else { ticks_slot_overhead = 0U; } /* calculate the window widening and interval */ - conn_interval_us = interval * CONN_INT_UNIT_US; - periodic_us = conn_interval_us; - switch (lll->role) { #if defined(CONFIG_BT_PERIPHERAL) case BT_HCI_ROLE_PERIPHERAL: @@ -2333,7 +2441,13 @@ void ull_conn_update_peer_sca(struct ll_conn *conn) lll = &conn->lll; /* calculate the window widening and interval */ - conn_interval_us = lll->interval * CONN_INT_UNIT_US; + if (lll->interval >= BT_HCI_LE_INTERVAL_MIN) { + conn_interval_us = lll->interval * + CONN_INT_UNIT_US; + } else { + conn_interval_us = (lll->interval + 1U) * + CONN_LOW_LAT_INT_UNIT_US; + } periodic_us = conn_interval_us; lll->periph.window_widening_periodic_us = diff --git a/subsys/bluetooth/controller/ll_sw/ull_conn_types.h b/subsys/bluetooth/controller/ll_sw/ull_conn_types.h index 4b77c22b49991..e105ef277e64c 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_conn_types.h +++ b/subsys/bluetooth/controller/ll_sw/ull_conn_types.h @@ -205,6 +205,7 @@ struct ll_conn { #endif /* CONFIG_BT_CTLR_CONN_META */ uint8_t latency_cancel:1; uint8_t sca:3; + uint8_t drift_skip; uint32_t force; uint32_t ticks_to_offset; } periph; diff --git a/subsys/bluetooth/controller/ll_sw/ull_internal.h b/subsys/bluetooth/controller/ll_sw/ull_internal.h index 8218d1da61bd0..2f29fc2ec4b83 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_internal.h +++ b/subsys/bluetooth/controller/ll_sw/ull_internal.h @@ -8,11 +8,15 @@ * User CPR Interval */ #if !defined(CONFIG_BT_CTLR_USER_CPR_INTERVAL_MIN) +#if defined(CONFIG_BT_CTLR_CONN_INTERVAL_LOW_LATENCY) +#define CONN_INTERVAL_MIN(x) (0U) +#else /* !CONFIG_BT_CTLR_CONN_INTERVAL_LOW_LATENCY */ /* Bluetooth defined CPR Interval Minimum (7.5ms) */ -#define CONN_INTERVAL_MIN(x) (6) +#define CONN_INTERVAL_MIN(x) (6U) +#endif /* !CONFIG_BT_CTLR_CONN_INTERVAL_LOW_LATENCY */ #else /* CONFIG_BT_CTLR_USER_CPR_INTERVAL_MIN */ /* Proprietary user defined CPR Interval Minimum */ -#define CONN_INTERVAL_MIN(x) (MAX(ull_conn_interval_min_get(x), 1)) +#define CONN_INTERVAL_MIN(x) (MAX(ull_conn_interval_min_get(x), 1U)) #endif /* CONFIG_BT_CTLR_USER_CPR_INTERVAL_MIN */ /** From af0aeb33fcf153f792f7a7d357f0635787e92864 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Sat, 27 Apr 2024 07:06:25 +0200 Subject: [PATCH 1532/4482] tests: bsim: Bluetooth: Test 1ms connection interval support Test 1ms connection interval support. Signed-off-by: Vinayak Kariappa Chettimada --- tests/bsim/bluetooth/ll/compile.sh | 1 + tests/bsim/bluetooth/ll/conn/Kconfig | 11 +++++++ .../bsim/bluetooth/ll/conn/prj_split_1ms.conf | 23 +++++++++++++++ .../bluetooth/ll/conn/src/test_connect1.c | 29 +++++++++++++++++-- .../bluetooth/ll/conn/src/test_connect2.c | 3 +- .../tests_scripts/basic_conn_split_1ms.sh | 26 +++++++++++++++++ 6 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 tests/bsim/bluetooth/ll/conn/Kconfig create mode 100644 tests/bsim/bluetooth/ll/conn/prj_split_1ms.conf create mode 100755 tests/bsim/bluetooth/ll/conn/tests_scripts/basic_conn_split_1ms.sh diff --git a/tests/bsim/bluetooth/ll/compile.sh b/tests/bsim/bluetooth/ll/compile.sh index 4937c72951d14..5b7e374510aa8 100755 --- a/tests/bsim/bluetooth/ll/compile.sh +++ b/tests/bsim/bluetooth/ll/compile.sh @@ -17,6 +17,7 @@ app=tests/bsim/bluetooth/ll/advx \ conf_overlay=overlay-ticker_expire_info.conf compile app=tests/bsim/bluetooth/ll/conn conf_file=prj_split.conf compile +app=tests/bsim/bluetooth/ll/conn conf_file=prj_split_1ms.conf compile app=tests/bsim/bluetooth/ll/conn conf_file=prj_split_tx_defer.conf compile app=tests/bsim/bluetooth/ll/conn conf_file=prj_split_privacy.conf compile app=tests/bsim/bluetooth/ll/conn conf_file=prj_split_low_lat.conf compile diff --git a/tests/bsim/bluetooth/ll/conn/Kconfig b/tests/bsim/bluetooth/ll/conn/Kconfig new file mode 100644 index 0000000000000..87a403f2d7d92 --- /dev/null +++ b/tests/bsim/bluetooth/ll/conn/Kconfig @@ -0,0 +1,11 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config TEST_CONN_INTERVAL_1MS + bool "Test 1 ms connection interval support" + help + Test 1 ms connection interval support. + +menu "Zephyr Kernel" +source "Kconfig.zephyr" +endmenu diff --git a/tests/bsim/bluetooth/ll/conn/prj_split_1ms.conf b/tests/bsim/bluetooth/ll/conn/prj_split_1ms.conf new file mode 100644 index 0000000000000..58276bd991e64 --- /dev/null +++ b/tests/bsim/bluetooth/ll/conn/prj_split_1ms.conf @@ -0,0 +1,23 @@ +CONFIG_BT=y +CONFIG_LOG=y +CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_PRIVACY=y +CONFIG_BT_SMP=y +CONFIG_BT_SIGNING=y +CONFIG_BT_BAS=y +CONFIG_BT_HRS=y +CONFIG_BT_ATT_PREPARE_COUNT=2 +CONFIG_BT_GATT_CLIENT=y +CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y +CONFIG_BT_DEVICE_NAME="bsim_test_split_1m" +CONFIG_BT_L2CAP_TX_BUF_COUNT=6 + +CONFIG_BT_CTLR_PRIVACY=n + +CONFIG_BT_CONN_PARAM_ANY=y + +CONFIG_BT_CTLR_ADVANCED_FEATURES=y +CONFIG_BT_CTLR_CONN_INTERVAL_LOW_LATENCY=y + +CONFIG_TEST_CONN_INTERVAL_1MS=y diff --git a/tests/bsim/bluetooth/ll/conn/src/test_connect1.c b/tests/bsim/bluetooth/ll/conn/src/test_connect1.c index d1373084da565..a31ff3d0d9acd 100644 --- a/tests/bsim/bluetooth/ll/conn/src/test_connect1.c +++ b/tests/bsim/bluetooth/ll/conn/src/test_connect1.c @@ -29,10 +29,19 @@ static struct bt_uuid_16 uuid = BT_UUID_INIT_16(0); static struct bt_gatt_discover_params discover_params; static struct bt_gatt_subscribe_params subscribe_params; +#if defined(CONFIG_TEST_CONN_INTERVAL_1MS) +#define UPDATE_PARAM_INTERVAL_MIN 1 +#define UPDATE_PARAM_INTERVAL_MAX 1 +#define UPDATE_PARAM_LATENCY 0 +#define UPDATE_PARAM_TIMEOUT 10 +#define TEST_NOTIFY_COUNT 3000 +#else /* !CONFIG_TEST_CONN_INTERVAL_1MS */ #define UPDATE_PARAM_INTERVAL_MIN 25 #define UPDATE_PARAM_INTERVAL_MAX 45 #define UPDATE_PARAM_LATENCY 1 #define UPDATE_PARAM_TIMEOUT 250 +#define TEST_NOTIFY_COUNT 3 +#endif /* !CONFIG_TEST_CONN_INTERVAL_1MS */ static struct bt_le_conn_param update_params = { .interval_min = UPDATE_PARAM_INTERVAL_MIN, @@ -124,16 +133,32 @@ static uint8_t notify_func(struct bt_conn *conn, struct bt_gatt_subscribe_params *params, const void *data, uint16_t length) { + static uint32_t cycle_stamp; static int notify_count; + uint32_t cycle_now; + uint64_t delta; + if (!data) { printk("[UNSUBSCRIBED]\n"); params->value_handle = 0U; return BT_GATT_ITER_STOP; } - printk("[NOTIFICATION] data %p length %u\n", data, length); + cycle_now = k_cycle_get_32(); + delta = cycle_now - cycle_stamp; + cycle_stamp = cycle_now; + delta = k_cyc_to_ns_floor64(delta); + + if (!IS_ENABLED(CONFIG_TEST_CONN_INTERVAL_1MS) || + ((delta > (NSEC_PER_MSEC / 2U)) && + (delta < (NSEC_PER_MSEC + (NSEC_PER_MSEC / 2U))))) { + notify_count++; + } + + printk("[NOTIFICATION] %u. data %p length %u in %llu ns\n", + notify_count, data, length, delta); - if (notify_count++ >= 1) { /* We consider it passed */ + if (notify_count >= TEST_NOTIFY_COUNT) { /* We consider it passed */ int err; /* Disconnect before actually passing */ diff --git a/tests/bsim/bluetooth/ll/conn/src/test_connect2.c b/tests/bsim/bluetooth/ll/conn/src/test_connect2.c index 54551f01b5059..f648d2d2d905f 100644 --- a/tests/bsim/bluetooth/ll/conn/src/test_connect2.c +++ b/tests/bsim/bluetooth/ll/conn/src/test_connect2.c @@ -209,7 +209,8 @@ static void test_con2_main(void) * of starting delayed work so we do it here */ while (1) { - if (IS_ENABLED(CONFIG_BT_CTLR_TX_DEFER)) { + if (IS_ENABLED(CONFIG_TEST_CONN_INTERVAL_1MS) || + IS_ENABLED(CONFIG_BT_CTLR_TX_DEFER)) { k_sleep(K_MSEC(1)); } else { k_sleep(K_SECONDS(1)); diff --git a/tests/bsim/bluetooth/ll/conn/tests_scripts/basic_conn_split_1ms.sh b/tests/bsim/bluetooth/ll/conn/tests_scripts/basic_conn_split_1ms.sh new file mode 100755 index 0000000000000..0be845f12d67f --- /dev/null +++ b/tests/bsim/bluetooth/ll/conn/tests_scripts/basic_conn_split_1ms.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# Copyright 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source ${ZEPHYR_BASE}/tests/bsim/sh_common.source + +# Basic connection test: a central connects to a peripheral and expects a +# notification, using the split controller (ULL LLL) and 1ms connection +# interval +simulation_id="basic_conn_split_1ms" +verbosity_level=2 + +cd ${BSIM_OUT_PATH}/bin + +Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_conn_prj_split_1ms_conf \ + -v=${verbosity_level} -s=${simulation_id} -d=0 -RealEncryption=1 \ + -testid=peripheral -rs=23 + +Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_conn_prj_split_1ms_conf\ + -v=${verbosity_level} -s=${simulation_id} -d=1 -RealEncryption=1 \ + -testid=central -rs=6 + +Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ + -D=2 -sim_length=20e6 $@ + +wait_for_background_jobs From f6b60bd057ccf040b87c7a8a7701473fc35d96c8 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 22 Oct 2024 01:37:00 +0530 Subject: [PATCH 1533/4482] manifest: hal_nordic: Pull fix for build errors Few build errors due to bugs in previous commits. Signed-off-by: Chaitanya Tata --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 557cea2ff268d..425ef04c1c26a 100644 --- a/west.yml +++ b/west.yml @@ -188,7 +188,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 957d1a803d0663330e870af2985503ba0cdbb152 + revision: cb7600a1be4c8b177867e6d463729c07dd3f6d73 path: modules/hal/nordic groups: - hal From 3098c484cb9f87edf59bd788aadf5a8d68595968 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 22 Oct 2024 01:36:07 +0530 Subject: [PATCH 1534/4482] drivers: nrfwifi: Fix a build error The defines should explicitly be passed to nordic HAL as they dont' use the CONFIG_ prefix. Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/wifi/nrfwifi/CMakeLists.txt b/drivers/wifi/nrfwifi/CMakeLists.txt index 0cd45829318de..70223f739ef00 100644 --- a/drivers/wifi/nrfwifi/CMakeLists.txt +++ b/drivers/wifi/nrfwifi/CMakeLists.txt @@ -343,4 +343,5 @@ zephyr_compile_definitions( -DNRF70_ANT_GAIN_5G_BAND2=${CONFIG_NRF70_ANT_GAIN_5G_BAND2} -DNRF70_ANT_GAIN_5G_BAND3=${CONFIG_NRF70_ANT_GAIN_5G_BAND3} -DNRF_WIFI_PS_INT_PS=${CONFIG_NRF_WIFI_PS_INT_PS} + -DNRF_WIFI_RPU_RECOVERY_PS_ACTIVE_TIMEOUT_MS=${CONFIG_NRF_WIFI_RPU_RECOVERY_PS_ACTIVE_TIMEOUT_MS} ) From f840f660a4e0044722918874abde729fe4b897e4 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 22 Oct 2024 01:40:41 +0530 Subject: [PATCH 1535/4482] samples: wifi: Fix missing CONFIG for the option Missed adding CONFIG_ to the configuration option. Signed-off-by: Chaitanya Tata --- samples/net/wifi/sample.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/net/wifi/sample.yaml b/samples/net/wifi/sample.yaml index c710f1627969c..bc5f10b6751e3 100644 --- a/samples/net/wifi/sample.yaml +++ b/samples/net/wifi/sample.yaml @@ -67,7 +67,7 @@ tests: - nucleo_h723zg sample.net.wifi.nrf7002eb: extra_args: - - NRF70_UTIL=y + - CONFIG_NRF70_UTIL=y - CONFIG_NRF_WIFI_BUILD_ONLY_MODE=y - SHIELD=nrf7002eb platform_allow: From a5e3a33b39b905cb6562cf5c6e3f5124248aa519 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Tue, 22 Oct 2024 11:24:51 +0200 Subject: [PATCH 1536/4482] ipc: icmsg & icbmsg: Fix alloc_tx_buffer() doxygen description The return values were not correct, and the parameters descriptions were not too easy to understand. Signed-off-by: Alberto Escolar Piedras --- subsys/ipc/ipc_service/backends/ipc_icbmsg.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c index 927950dd50aa1..395931d9cd467 100644 --- a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c +++ b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c @@ -320,15 +320,16 @@ static int buffer_to_index_validate(const struct channel_config *ch_conf, /** * Allocate buffer for transmission * - * @param[in,out] size Required size of the buffer. If zero, first available block is - * allocated and all subsequent available blocks. Size actually - * allocated which is not less than requested. - * @param[out] buffer Allocated buffer data. + * @param[in,out] size Required size of the buffer. If set to zero, the first available block will + * be allocated, together with all contiguous free blocks that follow it. + * On success, size will contain the actually allocated size, which will be + * at least the requested size. + * @param[out] buffer Pointer to the newly allocated buffer. * @param[in] timeout Timeout. * * @return Positive index of the first allocated block or negative error. - * @retval -EINVAL If requested size is bigger than entire allocable space. - * @retval -ENOSPC If timeout was K_NO_WAIT and there was not enough space. + * @retval -ENOMEM If requested size is bigger than entire allocable space, or + * the timeout was K_NO_WAIT and there was not enough space. * @retval -EAGAIN If timeout occurred. */ static int alloc_tx_buffer(struct backend_data *dev_data, uint32_t *size, From 6f4bb118a8002acf2059d34b4408c97716577815 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 22 Oct 2024 16:00:54 +0200 Subject: [PATCH 1537/4482] pm: policy: split policy APIs implementations policy.c has grown organically, it contained many independent pieces of code. This patch splits each logical unit into its own C file, making it easier to browse the code. Signed-off-by: Gerard Marull-Paretas --- subsys/pm/CMakeLists.txt | 4 +- subsys/pm/Kconfig | 31 +- subsys/pm/policy.c | 456 -------------------------- subsys/pm/policy/CMakeLists.txt | 14 + subsys/pm/policy/Kconfig | 34 ++ subsys/pm/policy/policy_default.c | 79 +++++ subsys/pm/policy/policy_device_lock.c | 120 +++++++ subsys/pm/policy/policy_events.c | 101 ++++++ subsys/pm/policy/policy_latency.c | 107 ++++++ subsys/pm/policy/policy_state_lock.c | 86 +++++ 10 files changed, 546 insertions(+), 486 deletions(-) delete mode 100644 subsys/pm/policy.c create mode 100644 subsys/pm/policy/CMakeLists.txt create mode 100644 subsys/pm/policy/Kconfig create mode 100644 subsys/pm/policy/policy_default.c create mode 100644 subsys/pm/policy/policy_device_lock.c create mode 100644 subsys/pm/policy/policy_events.c create mode 100644 subsys/pm/policy/policy_latency.c create mode 100644 subsys/pm/policy/policy_state_lock.c diff --git a/subsys/pm/CMakeLists.txt b/subsys/pm/CMakeLists.txt index 0e961abda7837..67d67729d8a4d 100644 --- a/subsys/pm/CMakeLists.txt +++ b/subsys/pm/CMakeLists.txt @@ -1,10 +1,12 @@ # SPDX-License-Identifier: Apache-2.0 if(CONFIG_PM) - zephyr_sources(pm.c policy.c state.c) + zephyr_sources(pm.c state.c) zephyr_sources_ifdef(CONFIG_PM_STATS pm_stats.c) endif() +add_subdirectory(policy) + zephyr_sources_ifdef(CONFIG_PM_DEVICE device.c) zephyr_sources_ifdef(CONFIG_PM_DEVICE_RUNTIME device_runtime.c) zephyr_sources_ifdef(CONFIG_PM_DEVICE_SHELL pm_shell.c) diff --git a/subsys/pm/Kconfig b/subsys/pm/Kconfig index bf69f7780810d..8acee7c684843 100644 --- a/subsys/pm/Kconfig +++ b/subsys/pm/Kconfig @@ -19,6 +19,8 @@ config PM power management subsystem of the number of ticks until the next kernel timer is due to expire. +rsource "policy/Kconfig" + if PM module = PM @@ -51,35 +53,6 @@ config PM_NEED_ALL_DEVICES_IDLE When this option is enabled, check that no devices are busy before entering into system low power mode. -choice PM_POLICY - prompt "Idle State Power Management Policy" - default PM_POLICY_DEFAULT - help - Select the idle state power management policy. - -config PM_POLICY_DEFAULT - bool "Default PM policy" - help - This option selects the default PM policy. Default policy is based - on CPU residency times and other constraints imposed by the drivers or - application. - -config PM_POLICY_CUSTOM - bool "Custom PM Policy" - help - This options allows applications to override the default policy with - a custom implementation. - -endchoice - -config PM_POLICY_DEVICE_CONSTRAINTS - bool "Power state constraints per device" - help - This option allows devices to have a list of power states - that when the system transition to them, cause power loss in the device. - This used to set and release power state constraints when - it is needed by the device. - endif # PM config PM_DEVICE diff --git a/subsys/pm/policy.c b/subsys/pm/policy.c deleted file mode 100644 index 39742cdf38c8c..0000000000000 --- a/subsys/pm/policy.c +++ /dev/null @@ -1,456 +0,0 @@ -/* - * Copyright (c) 2018 Intel Corporation. - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) - -#define DT_SUB_LOCK_INIT(node_id) \ - { .state = PM_STATE_DT_INIT(node_id), \ - .substate_id = DT_PROP_OR(node_id, substate_id, 0), \ - .lock = ATOMIC_INIT(0), \ - }, - -/** - * State and substate lock structure. - * - * This struct is associating a reference counting to each - * couple to be used with the pm_policy_substate_lock_* functions. - * - * Operations on this array are in the order of O(n) with the number of power - * states and this is mostly due to the random nature of the substate value - * (that can be anything from a small integer value to a bitmask). We can - * probably do better with an hashmap. - */ -static struct { - enum pm_state state; - uint8_t substate_id; - atomic_t lock; -} substate_lock_t[] = { - DT_FOREACH_STATUS_OKAY(zephyr_power_state, DT_SUB_LOCK_INIT) -}; - -#endif - -#if defined(CONFIG_PM_POLICY_DEVICE_CONSTRAINTS) - -struct pm_state_device_constraint { - const struct device *const dev; - size_t pm_constraints_size; - struct pm_state_constraint *constraints; -}; - -/** - * @brief Synthesize the name of the object that holds a device pm constraint. - * - * @param dev_id Device identifier. - */ -#define PM_CONSTRAINTS_NAME(node_id) _CONCAT(__devicepmconstraints_, node_id) - -/** - * @brief initialize a device pm constraint with information from devicetree. - * - * @param node_id Node identifier. - */ -#define PM_STATE_CONSTRAINT_INIT(node_id) \ - { \ - .state = PM_STATE_DT_INIT(node_id), \ - .substate_id = DT_PROP_OR(node_id, substate_id, 0), \ - } - -/** - * @brief Helper macro to define a device pm constraints. - */ -#define PM_STATE_CONSTRAINT_DEFINE(i, node_id) \ - COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_PHANDLE_BY_IDX(node_id, \ - zephyr_disabling_power_states, i)), \ - (PM_STATE_CONSTRAINT_INIT(DT_PHANDLE_BY_IDX(node_id, \ - zephyr_disabling_power_states, i)),), ()) - -/** - * @brief Helper macro to generate a list of device pm constraints. - */ -#define PM_STATE_CONSTRAINTS_DEFINE(node_id) \ - { \ - LISTIFY(DT_PROP_LEN_OR(node_id, zephyr_disabling_power_states, 0), \ - PM_STATE_CONSTRAINT_DEFINE, (), node_id) \ - } - -/** - * @brief Helper macro to define an array of device pm constraints. - */ -#define CONSTRAINTS_DEFINE(node_id) \ - Z_DECL_ALIGN(struct pm_state_constraint) \ - PM_CONSTRAINTS_NAME(node_id)[] = \ - PM_STATE_CONSTRAINTS_DEFINE(node_id); - -#define DEVICE_CONSTRAINTS_DEFINE(node_id) \ - COND_CODE_0(DT_NODE_HAS_PROP(node_id, zephyr_disabling_power_states), (), \ - (CONSTRAINTS_DEFINE(node_id))) - -DT_FOREACH_STATUS_OKAY_NODE(DEVICE_CONSTRAINTS_DEFINE) - -/** - * @brief Helper macro to initialize a pm state device constraint - */ -#define PM_STATE_DEVICE_CONSTRAINT_INIT(node_id) \ - { \ - .dev = DEVICE_DT_GET(node_id), \ - .pm_constraints_size = DT_PROP_LEN(node_id, zephyr_disabling_power_states), \ - .constraints = PM_CONSTRAINTS_NAME(node_id), \ - }, - -/** - * @brief Helper macro to initialize a pm state device constraint - */ -#define PM_STATE_DEVICE_CONSTRAINT_DEFINE(node_id) \ - COND_CODE_0(DT_NODE_HAS_PROP(node_id, zephyr_disabling_power_states), (), \ - (PM_STATE_DEVICE_CONSTRAINT_INIT(node_id))) - -static struct pm_state_device_constraint _devices_constraints[] = { - DT_FOREACH_STATUS_OKAY_NODE(PM_STATE_DEVICE_CONSTRAINT_DEFINE) -}; - -#endif /* CONFIG_PM_POLICY_DEVICE_CONSTRAINTS */ - -/** Lock to synchronize access to the latency request list. */ -static struct k_spinlock latency_lock; -/** List of maximum latency requests. */ -static sys_slist_t latency_reqs; -/** Maximum CPU latency in us */ -static int32_t max_latency_us = SYS_FOREVER_US; -/** Maximum CPU latency in cycles */ -static int32_t max_latency_cyc = -1; -/** List of latency change subscribers. */ -static sys_slist_t latency_subs; - -/** Lock to synchronize access to the events list. */ -static struct k_spinlock events_lock; -/** List of events. */ -static sys_slist_t events_list; -/** Pointer to Next Event. */ -static struct pm_policy_event *next_event; - -/** @brief Update maximum allowed latency. */ -static void update_max_latency(void) -{ - int32_t new_max_latency_us = SYS_FOREVER_US; - struct pm_policy_latency_request *req; - - SYS_SLIST_FOR_EACH_CONTAINER(&latency_reqs, req, node) { - if ((new_max_latency_us == SYS_FOREVER_US) || - ((int32_t)req->value_us < new_max_latency_us)) { - new_max_latency_us = (int32_t)req->value_us; - } - } - - if (max_latency_us != new_max_latency_us) { - struct pm_policy_latency_subscription *sreq; - int32_t new_max_latency_cyc = -1; - - SYS_SLIST_FOR_EACH_CONTAINER(&latency_subs, sreq, node) { - sreq->cb(new_max_latency_us); - } - - if (new_max_latency_us != SYS_FOREVER_US) { - new_max_latency_cyc = (int32_t)k_us_to_cyc_ceil32(new_max_latency_us); - } - - max_latency_us = new_max_latency_us; - max_latency_cyc = new_max_latency_cyc; - } -} - -/** @brief Update next event. */ -static void update_next_event(uint32_t cyc) -{ - int64_t new_next_event_cyc = -1; - struct pm_policy_event *evt; - - /* unset the next event pointer */ - next_event = NULL; - - SYS_SLIST_FOR_EACH_CONTAINER(&events_list, evt, node) { - uint64_t cyc_evt = evt->value_cyc; - - /* - * cyc value is a 32-bit rolling counter: - * - * |---------------->-----------------------| - * 0 cyc UINT32_MAX - * - * Values from [0, cyc) are events happening later than - * [cyc, UINT32_MAX], so pad [0, cyc) with UINT32_MAX + 1 to do - * the comparison. - */ - if (cyc_evt < cyc) { - cyc_evt += (uint64_t)UINT32_MAX + 1U; - } - - if ((new_next_event_cyc < 0) || (cyc_evt < new_next_event_cyc)) { - new_next_event_cyc = cyc_evt; - next_event = evt; - } - } -} - -int32_t pm_policy_next_event_ticks(void) -{ - int32_t cyc_evt = -1; - - if ((next_event) && (next_event->value_cyc > 0)) { - cyc_evt = next_event->value_cyc - k_cycle_get_32(); - cyc_evt = MAX(0, cyc_evt); - BUILD_ASSERT(CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC >= CONFIG_SYS_CLOCK_TICKS_PER_SEC, - "HW Cycles per sec should be greater that ticks per sec"); - return k_cyc_to_ticks_floor32(cyc_evt); - } - - return -1; -} - -#ifdef CONFIG_PM_POLICY_DEFAULT -const struct pm_state_info *pm_policy_next_state(uint8_t cpu, int32_t ticks) -{ - int64_t cyc = -1; - uint8_t num_cpu_states; - const struct pm_state_info *cpu_states; - -#ifdef CONFIG_PM_NEED_ALL_DEVICES_IDLE - if (pm_device_is_any_busy()) { - return NULL; - } -#endif - - if (ticks != K_TICKS_FOREVER) { - cyc = k_ticks_to_cyc_ceil32(ticks); - } - - num_cpu_states = pm_state_cpu_get_all(cpu, &cpu_states); - - if ((next_event) && (next_event->value_cyc >= 0)) { - uint32_t cyc_curr = k_cycle_get_32(); - int64_t cyc_evt = next_event->value_cyc - cyc_curr; - - /* event happening after cycle counter max value, pad */ - if (next_event->value_cyc <= cyc_curr) { - cyc_evt += UINT32_MAX; - } - - if (cyc_evt > 0) { - /* if there's no system wakeup event always wins, - * otherwise, who comes earlier wins - */ - if (cyc < 0) { - cyc = cyc_evt; - } else { - cyc = MIN(cyc, cyc_evt); - } - } - } - - for (int16_t i = (int16_t)num_cpu_states - 1; i >= 0; i--) { - const struct pm_state_info *state = &cpu_states[i]; - uint32_t min_residency_cyc, exit_latency_cyc; - - /* check if there is a lock on state + substate */ - if (pm_policy_state_lock_is_active(state->state, state->substate_id)) { - continue; - } - - min_residency_cyc = k_us_to_cyc_ceil32(state->min_residency_us); - exit_latency_cyc = k_us_to_cyc_ceil32(state->exit_latency_us); - - /* skip state if it brings too much latency */ - if ((max_latency_cyc >= 0) && - (exit_latency_cyc >= max_latency_cyc)) { - continue; - } - - if ((cyc < 0) || - (cyc >= (min_residency_cyc + exit_latency_cyc))) { - return state; - } - } - - return NULL; -} -#endif - -void pm_policy_state_lock_get(enum pm_state state, uint8_t substate_id) -{ -#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) - for (size_t i = 0; i < ARRAY_SIZE(substate_lock_t); i++) { - if (substate_lock_t[i].state == state && - (substate_lock_t[i].substate_id == substate_id || - substate_id == PM_ALL_SUBSTATES)) { - atomic_inc(&substate_lock_t[i].lock); - } - } -#endif -} - -void pm_policy_state_lock_put(enum pm_state state, uint8_t substate_id) -{ -#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) - for (size_t i = 0; i < ARRAY_SIZE(substate_lock_t); i++) { - if (substate_lock_t[i].state == state && - (substate_lock_t[i].substate_id == substate_id || - substate_id == PM_ALL_SUBSTATES)) { - atomic_t cnt = atomic_dec(&substate_lock_t[i].lock); - - ARG_UNUSED(cnt); - - __ASSERT(cnt >= 1, "Unbalanced state lock get/put"); - } - } -#endif -} - -bool pm_policy_state_lock_is_active(enum pm_state state, uint8_t substate_id) -{ -#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) - for (size_t i = 0; i < ARRAY_SIZE(substate_lock_t); i++) { - if (substate_lock_t[i].state == state && - (substate_lock_t[i].substate_id == substate_id || - substate_id == PM_ALL_SUBSTATES)) { - return (atomic_get(&substate_lock_t[i].lock) != 0); - } - } -#endif - - return false; -} - -void pm_policy_latency_request_add(struct pm_policy_latency_request *req, - uint32_t value_us) -{ - req->value_us = value_us; - - k_spinlock_key_t key = k_spin_lock(&latency_lock); - - sys_slist_append(&latency_reqs, &req->node); - update_max_latency(); - - k_spin_unlock(&latency_lock, key); -} - -void pm_policy_latency_request_update(struct pm_policy_latency_request *req, - uint32_t value_us) -{ - k_spinlock_key_t key = k_spin_lock(&latency_lock); - - req->value_us = value_us; - update_max_latency(); - - k_spin_unlock(&latency_lock, key); -} - -void pm_policy_latency_request_remove(struct pm_policy_latency_request *req) -{ - k_spinlock_key_t key = k_spin_lock(&latency_lock); - - (void)sys_slist_find_and_remove(&latency_reqs, &req->node); - update_max_latency(); - - k_spin_unlock(&latency_lock, key); -} - -void pm_policy_latency_changed_subscribe(struct pm_policy_latency_subscription *req, - pm_policy_latency_changed_cb_t cb) -{ - k_spinlock_key_t key = k_spin_lock(&latency_lock); - - req->cb = cb; - sys_slist_append(&latency_subs, &req->node); - - k_spin_unlock(&latency_lock, key); -} - -void pm_policy_latency_changed_unsubscribe(struct pm_policy_latency_subscription *req) -{ - k_spinlock_key_t key = k_spin_lock(&latency_lock); - - (void)sys_slist_find_and_remove(&latency_subs, &req->node); - - k_spin_unlock(&latency_lock, key); -} - -void pm_policy_event_register(struct pm_policy_event *evt, uint32_t time_us) -{ - k_spinlock_key_t key = k_spin_lock(&events_lock); - uint32_t cyc = k_cycle_get_32(); - - evt->value_cyc = cyc + k_us_to_cyc_ceil32(time_us); - sys_slist_append(&events_list, &evt->node); - update_next_event(cyc); - - k_spin_unlock(&events_lock, key); -} - -void pm_policy_event_update(struct pm_policy_event *evt, uint32_t cycle) -{ - k_spinlock_key_t key = k_spin_lock(&events_lock); - - evt->value_cyc = cycle; - update_next_event(k_cycle_get_32()); - - k_spin_unlock(&events_lock, key); -} - -void pm_policy_event_unregister(struct pm_policy_event *evt) -{ - k_spinlock_key_t key = k_spin_lock(&events_lock); - - (void)sys_slist_find_and_remove(&events_list, &evt->node); - update_next_event(k_cycle_get_32()); - - k_spin_unlock(&events_lock, key); -} - -void pm_policy_device_power_lock_get(const struct device *dev) -{ -#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) && defined(CONFIG_PM_POLICY_DEVICE_CONSTRAINTS) - for (size_t i = 0; i < ARRAY_SIZE(_devices_constraints); i++) { - if (_devices_constraints[i].dev == dev) { - for (size_t j = 0; j < _devices_constraints[i].pm_constraints_size; j++) { - pm_policy_state_lock_get( - _devices_constraints[i].constraints[j].state, - _devices_constraints[i].constraints[j].substate_id); - } - break; - } - } -#endif -} - -void pm_policy_device_power_lock_put(const struct device *dev) -{ -#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) && defined(CONFIG_PM_POLICY_DEVICE_CONSTRAINTS) - for (size_t i = 0; i < ARRAY_SIZE(_devices_constraints); i++) { - if (_devices_constraints[i].dev == dev) { - for (size_t j = 0; j < _devices_constraints[i].pm_constraints_size; j++) { - pm_policy_state_lock_put( - _devices_constraints[i].constraints[j].state, - _devices_constraints[i].constraints[j].substate_id); - } - break; - } - } -#endif -} diff --git a/subsys/pm/policy/CMakeLists.txt b/subsys/pm/policy/CMakeLists.txt new file mode 100644 index 0000000000000..e9d7d791ec554 --- /dev/null +++ b/subsys/pm/policy/CMakeLists.txt @@ -0,0 +1,14 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if(CONFIG_PM) + zephyr_library_sources(policy_events.c policy_latency.c policy_state_lock.c) + + if(CONFIG_PM_POLICY_DEVICE_CONSTRAINTS) + zephyr_library_sources(policy_device_lock.c) + endif() + + if(CONFIG_PM_POLICY_DEFAULT) + zephyr_library_sources(policy_default.c) + endif() +endif() diff --git a/subsys/pm/policy/Kconfig b/subsys/pm/policy/Kconfig new file mode 100644 index 0000000000000..2060c52cb1324 --- /dev/null +++ b/subsys/pm/policy/Kconfig @@ -0,0 +1,34 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if PM +choice PM_POLICY + prompt "Idle State Power Management Policy" + default PM_POLICY_DEFAULT + help + Select the idle state power management policy. + +config PM_POLICY_DEFAULT + bool "Default PM policy" + help + This option selects the default PM policy. Default policy is based + on CPU residency times and other constraints imposed by the drivers or + application. + +config PM_POLICY_CUSTOM + bool "Custom PM Policy" + help + This options allows applications to override the default policy with + a custom implementation. + +endchoice + +config PM_POLICY_DEVICE_CONSTRAINTS + bool "Power state constraints per device" + help + This option allows devices to have a list of power states + that when the system transition to them, cause power loss in the device. + This used to set and release power state constraints when + it is needed by the device. + +endif # PM diff --git a/subsys/pm/policy/policy_default.c b/subsys/pm/policy/policy_default.c new file mode 100644 index 0000000000000..74a0443e6cdb1 --- /dev/null +++ b/subsys/pm/policy/policy_default.c @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2018 Intel Corporation. + * Copyright (c) 2022 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +extern struct pm_policy_event *next_event; +extern int32_t max_latency_cyc; + +const struct pm_state_info *pm_policy_next_state(uint8_t cpu, int32_t ticks) +{ + int64_t cyc = -1; + uint8_t num_cpu_states; + const struct pm_state_info *cpu_states; + +#ifdef CONFIG_PM_NEED_ALL_DEVICES_IDLE + if (pm_device_is_any_busy()) { + return NULL; + } +#endif + + if (ticks != K_TICKS_FOREVER) { + cyc = k_ticks_to_cyc_ceil32(ticks); + } + + num_cpu_states = pm_state_cpu_get_all(cpu, &cpu_states); + + if ((next_event) && (next_event->value_cyc >= 0)) { + uint32_t cyc_curr = k_cycle_get_32(); + int64_t cyc_evt = next_event->value_cyc - cyc_curr; + + /* event happening after cycle counter max value, pad */ + if (next_event->value_cyc <= cyc_curr) { + cyc_evt += UINT32_MAX; + } + + if (cyc_evt > 0) { + /* if there's no system wakeup event always wins, + * otherwise, who comes earlier wins + */ + if (cyc < 0) { + cyc = cyc_evt; + } else { + cyc = MIN(cyc, cyc_evt); + } + } + } + + for (int16_t i = (int16_t)num_cpu_states - 1; i >= 0; i--) { + const struct pm_state_info *state = &cpu_states[i]; + uint32_t min_residency_cyc, exit_latency_cyc; + + /* check if there is a lock on state + substate */ + if (pm_policy_state_lock_is_active(state->state, state->substate_id)) { + continue; + } + + min_residency_cyc = k_us_to_cyc_ceil32(state->min_residency_us); + exit_latency_cyc = k_us_to_cyc_ceil32(state->exit_latency_us); + + /* skip state if it brings too much latency */ + if ((max_latency_cyc >= 0) && + (exit_latency_cyc >= max_latency_cyc)) { + continue; + } + + if ((cyc < 0) || + (cyc >= (min_residency_cyc + exit_latency_cyc))) { + return state; + } + } + + return NULL; +} diff --git a/subsys/pm/policy/policy_device_lock.c b/subsys/pm/policy/policy_device_lock.c new file mode 100644 index 0000000000000..b508819fb7318 --- /dev/null +++ b/subsys/pm/policy/policy_device_lock.c @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2018 Intel Corporation. + * Copyright (c) 2022 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +struct pm_state_device_constraint { + const struct device *const dev; + size_t pm_constraints_size; + struct pm_state_constraint *constraints; +}; + +/** + * @brief Synthesize the name of the object that holds a device pm constraint. + * + * @param dev_id Device identifier. + */ +#define PM_CONSTRAINTS_NAME(node_id) _CONCAT(__devicepmconstraints_, node_id) + +/** + * @brief initialize a device pm constraint with information from devicetree. + * + * @param node_id Node identifier. + */ +#define PM_STATE_CONSTRAINT_INIT(node_id) \ + { \ + .state = PM_STATE_DT_INIT(node_id), \ + .substate_id = DT_PROP_OR(node_id, substate_id, 0), \ + } + +/** + * @brief Helper macro to define a device pm constraints. + */ +#define PM_STATE_CONSTRAINT_DEFINE(i, node_id) \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_PHANDLE_BY_IDX(node_id, \ + zephyr_disabling_power_states, i)), \ + (PM_STATE_CONSTRAINT_INIT(DT_PHANDLE_BY_IDX(node_id, \ + zephyr_disabling_power_states, i)),), ()) + +/** + * @brief Helper macro to generate a list of device pm constraints. + */ +#define PM_STATE_CONSTRAINTS_DEFINE(node_id) \ + { \ + LISTIFY(DT_PROP_LEN_OR(node_id, zephyr_disabling_power_states, 0), \ + PM_STATE_CONSTRAINT_DEFINE, (), node_id) \ + } + +/** + * @brief Helper macro to define an array of device pm constraints. + */ +#define CONSTRAINTS_DEFINE(node_id) \ + Z_DECL_ALIGN(struct pm_state_constraint) \ + PM_CONSTRAINTS_NAME(node_id)[] = \ + PM_STATE_CONSTRAINTS_DEFINE(node_id); + +#define DEVICE_CONSTRAINTS_DEFINE(node_id) \ + COND_CODE_0(DT_NODE_HAS_PROP(node_id, zephyr_disabling_power_states), (), \ + (CONSTRAINTS_DEFINE(node_id))) + +DT_FOREACH_STATUS_OKAY_NODE(DEVICE_CONSTRAINTS_DEFINE) + +/** + * @brief Helper macro to initialize a pm state device constraint + */ +#define PM_STATE_DEVICE_CONSTRAINT_INIT(node_id) \ + { \ + .dev = DEVICE_DT_GET(node_id), \ + .pm_constraints_size = DT_PROP_LEN(node_id, zephyr_disabling_power_states), \ + .constraints = PM_CONSTRAINTS_NAME(node_id), \ + }, + +/** + * @brief Helper macro to initialize a pm state device constraint + */ +#define PM_STATE_DEVICE_CONSTRAINT_DEFINE(node_id) \ + COND_CODE_0(DT_NODE_HAS_PROP(node_id, zephyr_disabling_power_states), (), \ + (PM_STATE_DEVICE_CONSTRAINT_INIT(node_id))) + +static struct pm_state_device_constraint _devices_constraints[] = { + DT_FOREACH_STATUS_OKAY_NODE(PM_STATE_DEVICE_CONSTRAINT_DEFINE) +}; + +void pm_policy_device_power_lock_get(const struct device *dev) +{ +#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) + for (size_t i = 0; i < ARRAY_SIZE(_devices_constraints); i++) { + if (_devices_constraints[i].dev == dev) { + for (size_t j = 0; j < _devices_constraints[i].pm_constraints_size; j++) { + pm_policy_state_lock_get( + _devices_constraints[i].constraints[j].state, + _devices_constraints[i].constraints[j].substate_id); + } + break; + } + } +#endif +} + +void pm_policy_device_power_lock_put(const struct device *dev) +{ +#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) + for (size_t i = 0; i < ARRAY_SIZE(_devices_constraints); i++) { + if (_devices_constraints[i].dev == dev) { + for (size_t j = 0; j < _devices_constraints[i].pm_constraints_size; j++) { + pm_policy_state_lock_put( + _devices_constraints[i].constraints[j].state, + _devices_constraints[i].constraints[j].substate_id); + } + break; + } + } +#endif +} diff --git a/subsys/pm/policy/policy_events.c b/subsys/pm/policy/policy_events.c new file mode 100644 index 0000000000000..dc06bffdf55bb --- /dev/null +++ b/subsys/pm/policy/policy_events.c @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2018 Intel Corporation. + * Copyright (c) 2022 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include +#include +#include +#include + +/** Lock to synchronize access to the events list. */ +static struct k_spinlock events_lock; +/** List of events. */ +static sys_slist_t events_list; +/** Pointer to Next Event. */ +struct pm_policy_event *next_event; + +/** @brief Update next event. */ +static void update_next_event(uint32_t cyc) +{ + int64_t new_next_event_cyc = -1; + struct pm_policy_event *evt; + + /* unset the next event pointer */ + next_event = NULL; + + SYS_SLIST_FOR_EACH_CONTAINER(&events_list, evt, node) { + uint64_t cyc_evt = evt->value_cyc; + + /* + * cyc value is a 32-bit rolling counter: + * + * |---------------->-----------------------| + * 0 cyc UINT32_MAX + * + * Values from [0, cyc) are events happening later than + * [cyc, UINT32_MAX], so pad [0, cyc) with UINT32_MAX + 1 to do + * the comparison. + */ + if (cyc_evt < cyc) { + cyc_evt += (uint64_t)UINT32_MAX + 1U; + } + + if ((new_next_event_cyc < 0) || (cyc_evt < new_next_event_cyc)) { + new_next_event_cyc = cyc_evt; + next_event = evt; + } + } +} + +int32_t pm_policy_next_event_ticks(void) +{ + int32_t cyc_evt = -1; + + if ((next_event) && (next_event->value_cyc > 0)) { + cyc_evt = next_event->value_cyc - k_cycle_get_32(); + cyc_evt = MAX(0, cyc_evt); + BUILD_ASSERT(CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC >= CONFIG_SYS_CLOCK_TICKS_PER_SEC, + "HW Cycles per sec should be greater that ticks per sec"); + return k_cyc_to_ticks_floor32(cyc_evt); + } + + return -1; +} + +void pm_policy_event_register(struct pm_policy_event *evt, uint32_t time_us) +{ + k_spinlock_key_t key = k_spin_lock(&events_lock); + uint32_t cyc = k_cycle_get_32(); + + evt->value_cyc = cyc + k_us_to_cyc_ceil32(time_us); + sys_slist_append(&events_list, &evt->node); + update_next_event(cyc); + + k_spin_unlock(&events_lock, key); +} + +void pm_policy_event_update(struct pm_policy_event *evt, uint32_t cycle) +{ + k_spinlock_key_t key = k_spin_lock(&events_lock); + + evt->value_cyc = cycle; + update_next_event(k_cycle_get_32()); + + k_spin_unlock(&events_lock, key); +} + +void pm_policy_event_unregister(struct pm_policy_event *evt) +{ + k_spinlock_key_t key = k_spin_lock(&events_lock); + + (void)sys_slist_find_and_remove(&events_list, &evt->node); + update_next_event(k_cycle_get_32()); + + k_spin_unlock(&events_lock, key); +} diff --git a/subsys/pm/policy/policy_latency.c b/subsys/pm/policy/policy_latency.c new file mode 100644 index 0000000000000..68e6ffcc5d577 --- /dev/null +++ b/subsys/pm/policy/policy_latency.c @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2018 Intel Corporation. + * Copyright (c) 2022 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include +#include + +/** Lock to synchronize access to the latency request list. */ +static struct k_spinlock latency_lock; +/** List of maximum latency requests. */ +static sys_slist_t latency_reqs; +/** Maximum CPU latency in us */ +static int32_t max_latency_us = SYS_FOREVER_US; +/** Maximum CPU latency in cycles */ +int32_t max_latency_cyc = -1; +/** List of latency change subscribers. */ +static sys_slist_t latency_subs; + +/** @brief Update maximum allowed latency. */ +static void update_max_latency(void) +{ + int32_t new_max_latency_us = SYS_FOREVER_US; + struct pm_policy_latency_request *req; + + SYS_SLIST_FOR_EACH_CONTAINER(&latency_reqs, req, node) { + if ((new_max_latency_us == SYS_FOREVER_US) || + ((int32_t)req->value_us < new_max_latency_us)) { + new_max_latency_us = (int32_t)req->value_us; + } + } + + if (max_latency_us != new_max_latency_us) { + struct pm_policy_latency_subscription *sreq; + int32_t new_max_latency_cyc = -1; + + SYS_SLIST_FOR_EACH_CONTAINER(&latency_subs, sreq, node) { + sreq->cb(new_max_latency_us); + } + + if (new_max_latency_us != SYS_FOREVER_US) { + new_max_latency_cyc = (int32_t)k_us_to_cyc_ceil32(new_max_latency_us); + } + + max_latency_us = new_max_latency_us; + max_latency_cyc = new_max_latency_cyc; + } +} + +void pm_policy_latency_request_add(struct pm_policy_latency_request *req, + uint32_t value_us) +{ + req->value_us = value_us; + + k_spinlock_key_t key = k_spin_lock(&latency_lock); + + sys_slist_append(&latency_reqs, &req->node); + update_max_latency(); + + k_spin_unlock(&latency_lock, key); +} + +void pm_policy_latency_request_update(struct pm_policy_latency_request *req, + uint32_t value_us) +{ + k_spinlock_key_t key = k_spin_lock(&latency_lock); + + req->value_us = value_us; + update_max_latency(); + + k_spin_unlock(&latency_lock, key); +} + +void pm_policy_latency_request_remove(struct pm_policy_latency_request *req) +{ + k_spinlock_key_t key = k_spin_lock(&latency_lock); + + (void)sys_slist_find_and_remove(&latency_reqs, &req->node); + update_max_latency(); + + k_spin_unlock(&latency_lock, key); +} + +void pm_policy_latency_changed_subscribe(struct pm_policy_latency_subscription *req, + pm_policy_latency_changed_cb_t cb) +{ + k_spinlock_key_t key = k_spin_lock(&latency_lock); + + req->cb = cb; + sys_slist_append(&latency_subs, &req->node); + + k_spin_unlock(&latency_lock, key); +} + +void pm_policy_latency_changed_unsubscribe(struct pm_policy_latency_subscription *req) +{ + k_spinlock_key_t key = k_spin_lock(&latency_lock); + + (void)sys_slist_find_and_remove(&latency_subs, &req->node); + + k_spin_unlock(&latency_lock, key); +} diff --git a/subsys/pm/policy/policy_state_lock.c b/subsys/pm/policy/policy_state_lock.c new file mode 100644 index 0000000000000..3876b76c804ff --- /dev/null +++ b/subsys/pm/policy/policy_state_lock.c @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2018 Intel Corporation. + * Copyright (c) 2022 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include + +#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) + +#define DT_SUB_LOCK_INIT(node_id) \ + { .state = PM_STATE_DT_INIT(node_id), \ + .substate_id = DT_PROP_OR(node_id, substate_id, 0), \ + .lock = ATOMIC_INIT(0), \ + }, + +/** + * State and substate lock structure. + * + * This struct is associating a reference counting to each + * couple to be used with the pm_policy_substate_lock_* functions. + * + * Operations on this array are in the order of O(n) with the number of power + * states and this is mostly due to the random nature of the substate value + * (that can be anything from a small integer value to a bitmask). We can + * probably do better with an hashmap. + */ +static struct { + enum pm_state state; + uint8_t substate_id; + atomic_t lock; +} substate_lock_t[] = { + DT_FOREACH_STATUS_OKAY(zephyr_power_state, DT_SUB_LOCK_INIT) +}; + +#endif + +void pm_policy_state_lock_get(enum pm_state state, uint8_t substate_id) +{ +#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) + for (size_t i = 0; i < ARRAY_SIZE(substate_lock_t); i++) { + if (substate_lock_t[i].state == state && + (substate_lock_t[i].substate_id == substate_id || + substate_id == PM_ALL_SUBSTATES)) { + atomic_inc(&substate_lock_t[i].lock); + } + } +#endif +} + +void pm_policy_state_lock_put(enum pm_state state, uint8_t substate_id) +{ +#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) + for (size_t i = 0; i < ARRAY_SIZE(substate_lock_t); i++) { + if (substate_lock_t[i].state == state && + (substate_lock_t[i].substate_id == substate_id || + substate_id == PM_ALL_SUBSTATES)) { + atomic_t cnt = atomic_dec(&substate_lock_t[i].lock); + + ARG_UNUSED(cnt); + + __ASSERT(cnt >= 1, "Unbalanced state lock get/put"); + } + } +#endif +} + +bool pm_policy_state_lock_is_active(enum pm_state state, uint8_t substate_id) +{ +#if DT_HAS_COMPAT_STATUS_OKAY(zephyr_power_state) + for (size_t i = 0; i < ARRAY_SIZE(substate_lock_t); i++) { + if (substate_lock_t[i].state == state && + (substate_lock_t[i].substate_id == substate_id || + substate_id == PM_ALL_SUBSTATES)) { + return (atomic_get(&substate_lock_t[i].lock) != 0); + } + } +#endif + + return false; +} From 578008cd472e6d091f2960ec9dc40c233329f372 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 22 Oct 2024 16:07:52 +0200 Subject: [PATCH 1538/4482] pm: policy: allow using latency API in standalone mode This option allows using the pm_policy_latency* APIs to gather latency requirements on systems that do not support PM (e.g. systems whithout CPU idle states). Because the API has a subscription mechanism, it can be useful to perform system-level adjustments based on latency requirements gathered from multiple system components. Signed-off-by: Gerard Marull-Paretas --- include/zephyr/pm/policy.h | 129 ++++++++++++++++---------------- subsys/pm/policy/CMakeLists.txt | 2 + subsys/pm/policy/Kconfig | 10 +++ 3 files changed, 78 insertions(+), 63 deletions(-) diff --git a/include/zephyr/pm/policy.h b/include/zephyr/pm/policy.h index caba887805a54..e1e910f3e0a53 100644 --- a/include/zephyr/pm/policy.h +++ b/include/zephyr/pm/policy.h @@ -137,49 +137,6 @@ void pm_policy_state_lock_put(enum pm_state state, uint8_t substate_id); */ bool pm_policy_state_lock_is_active(enum pm_state state, uint8_t substate_id); -/** - * @brief Add a new latency requirement. - * - * The system will not enter any power state that would make the system to - * exceed the given latency value. - * - * @param req Latency request. - * @param value_us Maximum allowed latency in microseconds. - */ -void pm_policy_latency_request_add(struct pm_policy_latency_request *req, - uint32_t value_us); - -/** - * @brief Update a latency requirement. - * - * @param req Latency request. - * @param value_us New maximum allowed latency in microseconds. - */ -void pm_policy_latency_request_update(struct pm_policy_latency_request *req, - uint32_t value_us); - -/** - * @brief Remove a latency requirement. - * - * @param req Latency request. - */ -void pm_policy_latency_request_remove(struct pm_policy_latency_request *req); - -/** - * @brief Subscribe to maximum latency changes. - * - * @param req Subscription request. - * @param cb Callback function (NULL to disable). - */ -void pm_policy_latency_changed_subscribe(struct pm_policy_latency_subscription *req, - pm_policy_latency_changed_cb_t cb); - -/** - * @brief Unsubscribe to maximum latency changes. - * - * @param req Subscription request. - */ -void pm_policy_latency_changed_unsubscribe(struct pm_policy_latency_subscription *req); /** * @brief Register an event. @@ -277,26 +234,6 @@ static inline bool pm_policy_state_lock_is_active(enum pm_state state, uint8_t s return false; } -static inline void pm_policy_latency_request_add( - struct pm_policy_latency_request *req, uint32_t value_us) -{ - ARG_UNUSED(req); - ARG_UNUSED(value_us); -} - -static inline void pm_policy_latency_request_update( - struct pm_policy_latency_request *req, uint32_t value_us) -{ - ARG_UNUSED(req); - ARG_UNUSED(value_us); -} - -static inline void pm_policy_latency_request_remove( - struct pm_policy_latency_request *req) -{ - ARG_UNUSED(req); -} - static inline void pm_policy_event_register(struct pm_policy_event *evt, uint32_t cycle) { ARG_UNUSED(evt); @@ -331,6 +268,72 @@ static inline int32_t pm_policy_next_event_ticks(void) #endif /* CONFIG_PM */ +#if defined(CONFIG_PM) || defined(CONFIG_PM_POLICY_LATENCY_STANDALONE) || defined(__DOXYGEN__) +/** + * @brief Add a new latency requirement. + * + * The system will not enter any power state that would make the system to + * exceed the given latency value. + * + * @param req Latency request. + * @param value_us Maximum allowed latency in microseconds. + */ +void pm_policy_latency_request_add(struct pm_policy_latency_request *req, + uint32_t value_us); + +/** + * @brief Update a latency requirement. + * + * @param req Latency request. + * @param value_us New maximum allowed latency in microseconds. + */ +void pm_policy_latency_request_update(struct pm_policy_latency_request *req, + uint32_t value_us); + +/** + * @brief Remove a latency requirement. + * + * @param req Latency request. + */ +void pm_policy_latency_request_remove(struct pm_policy_latency_request *req); + +/** + * @brief Subscribe to maximum latency changes. + * + * @param req Subscription request. + * @param cb Callback function (NULL to disable). + */ +void pm_policy_latency_changed_subscribe(struct pm_policy_latency_subscription *req, + pm_policy_latency_changed_cb_t cb); + +/** + * @brief Unsubscribe to maximum latency changes. + * + * @param req Subscription request. + */ +void pm_policy_latency_changed_unsubscribe(struct pm_policy_latency_subscription *req); +#else +static inline void pm_policy_latency_request_add( + struct pm_policy_latency_request *req, uint32_t value_us) +{ + ARG_UNUSED(req); + ARG_UNUSED(value_us); +} + +static inline void pm_policy_latency_request_update( + struct pm_policy_latency_request *req, uint32_t value_us) +{ + ARG_UNUSED(req); + ARG_UNUSED(value_us); +} + +static inline void pm_policy_latency_request_remove( + struct pm_policy_latency_request *req) +{ + ARG_UNUSED(req); +} +#endif /* CONFIG_PM CONFIG_PM_POLICY_LATENCY_STANDALONE */ + /** * @} */ diff --git a/subsys/pm/policy/CMakeLists.txt b/subsys/pm/policy/CMakeLists.txt index e9d7d791ec554..899e9f60b20f6 100644 --- a/subsys/pm/policy/CMakeLists.txt +++ b/subsys/pm/policy/CMakeLists.txt @@ -11,4 +11,6 @@ if(CONFIG_PM) if(CONFIG_PM_POLICY_DEFAULT) zephyr_library_sources(policy_default.c) endif() +elseif(CONFIG_PM_POLICY_LATENCY_STANDALONE) + zephyr_library_sources(policy_latency.c) endif() diff --git a/subsys/pm/policy/Kconfig b/subsys/pm/policy/Kconfig index 2060c52cb1324..1a224c4ecc760 100644 --- a/subsys/pm/policy/Kconfig +++ b/subsys/pm/policy/Kconfig @@ -32,3 +32,13 @@ config PM_POLICY_DEVICE_CONSTRAINTS it is needed by the device. endif # PM + +config PM_POLICY_LATENCY_STANDALONE + bool "Allow gathering latency requirements in standalone mode" + depends on !PM + help + This option allows using the pm_policy_latency* APIs to gather latency + requirements on systems that do not support PM (e.g. systems whithout + CPU idle states). Because the API has a subscription mechanism, it can + be useful to perform system-level adjustments based on latency + requirements gathered from multiple system components. From f302daf67a58ce115e95c54336691adcc1017ac1 Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Mon, 21 Oct 2024 12:14:07 +0200 Subject: [PATCH 1539/4482] dts: arm: silabs: Describe RTC timers correctly The DT node "stimer0" represented two different hardware timers, RTCC and SYSRTC. Use the correct peripheral names for the nodes. Add interrupt names and missing interrupt numbers. Signed-off-by: Aksel Skauge Mellbye --- boards/silabs/dev_kits/sltb010a/thunderboard.dtsi | 2 +- boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b.dts | 2 +- boards/silabs/dev_kits/xg27_dk2602a/thunderboard.dtsi | 2 +- boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts | 2 +- dts/arm/silabs/efr32bg22.dtsi | 3 ++- dts/arm/silabs/efr32bg27.dtsi | 3 ++- dts/arm/silabs/efr32bg2x.dtsi | 2 +- dts/arm/silabs/efr32mg21.dtsi | 1 + dts/arm/silabs/efr32mg24.dtsi | 5 +++-- 9 files changed, 13 insertions(+), 9 deletions(-) diff --git a/boards/silabs/dev_kits/sltb010a/thunderboard.dtsi b/boards/silabs/dev_kits/sltb010a/thunderboard.dtsi index 7197983747670..66b981e370bd0 100644 --- a/boards/silabs/dev_kits/sltb010a/thunderboard.dtsi +++ b/boards/silabs/dev_kits/sltb010a/thunderboard.dtsi @@ -134,7 +134,7 @@ status = "okay"; }; -&stimer0 { +&rtcc0 { status = "okay"; }; diff --git a/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b.dts b/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b.dts index 5c6e5934b3042..9605ff58d00d5 100644 --- a/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b.dts +++ b/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b.dts @@ -225,7 +225,7 @@ status = "okay"; }; -&stimer0 { +&sysrtc0 { status = "okay"; }; diff --git a/boards/silabs/dev_kits/xg27_dk2602a/thunderboard.dtsi b/boards/silabs/dev_kits/xg27_dk2602a/thunderboard.dtsi index 7197983747670..66b981e370bd0 100644 --- a/boards/silabs/dev_kits/xg27_dk2602a/thunderboard.dtsi +++ b/boards/silabs/dev_kits/xg27_dk2602a/thunderboard.dtsi @@ -134,7 +134,7 @@ status = "okay"; }; -&stimer0 { +&rtcc0 { status = "okay"; }; diff --git a/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts b/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts index 3d3c5064b0b7f..f398b91925717 100644 --- a/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts +++ b/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts @@ -152,7 +152,7 @@ status = "okay"; }; -&stimer0 { +&sysrtc0 { status = "okay"; }; diff --git a/dts/arm/silabs/efr32bg22.dtsi b/dts/arm/silabs/efr32bg22.dtsi index 56fd80195ba45..c8184284b61a3 100644 --- a/dts/arm/silabs/efr32bg22.dtsi +++ b/dts/arm/silabs/efr32bg22.dtsi @@ -74,8 +74,9 @@ clocks = <&cmu CLOCK_BURTC CLOCK_BRANCH_EM4GRPACLK>; }; -&stimer0 { +&rtcc0 { interrupts = <12 0>; + interrupt-names = "rtcc"; clocks = <&cmu CLOCK_RTCC CLOCK_BRANCH_RTCCCLK>; }; diff --git a/dts/arm/silabs/efr32bg27.dtsi b/dts/arm/silabs/efr32bg27.dtsi index f78542809ac40..9e4d9b1d26538 100644 --- a/dts/arm/silabs/efr32bg27.dtsi +++ b/dts/arm/silabs/efr32bg27.dtsi @@ -84,8 +84,9 @@ clocks = <&cmu CLOCK_BURTC CLOCK_BRANCH_EM4GRPACLK>; }; -&stimer0 { +&rtcc0 { interrupts = <15 0>; + interrupt-names = "rtcc"; clocks = <&cmu CLOCK_RTCC CLOCK_BRANCH_RTCCCLK>; }; diff --git a/dts/arm/silabs/efr32bg2x.dtsi b/dts/arm/silabs/efr32bg2x.dtsi index 6a3fb5e36fdb6..f5345abb39c65 100644 --- a/dts/arm/silabs/efr32bg2x.dtsi +++ b/dts/arm/silabs/efr32bg2x.dtsi @@ -254,7 +254,7 @@ status = "disabled"; }; - stimer0: stimer@58000000 { + rtcc0: stimer0: rtcc@58000000 { compatible = "silabs,gecko-stimer"; reg = <0x58000000 0x3054>; clock-frequency = <32768>; diff --git a/dts/arm/silabs/efr32mg21.dtsi b/dts/arm/silabs/efr32mg21.dtsi index 8b8cc794a2ad3..bc3de7156755d 100644 --- a/dts/arm/silabs/efr32mg21.dtsi +++ b/dts/arm/silabs/efr32mg21.dtsi @@ -260,6 +260,7 @@ compatible = "silabs,gecko-stimer"; reg = <0x58000000 0x400>; interrupts = <10 0>; + interrupt-names = "rtcc"; clock-frequency = <32768>; prescaler = <1>; clocks = <&cmu CLOCK_AUTO CLOCK_BRANCH_RTCCCLK>; diff --git a/dts/arm/silabs/efr32mg24.dtsi b/dts/arm/silabs/efr32mg24.dtsi index 2eeb2eb8c8601..00eeff0e38ba6 100644 --- a/dts/arm/silabs/efr32mg24.dtsi +++ b/dts/arm/silabs/efr32mg24.dtsi @@ -330,10 +330,11 @@ status = "disabled"; }; - stimer0: stimer@500a8000 { + sysrtc0: stimer0: sysrtc@500a8000 { compatible = "silabs,gecko-stimer"; reg = <0x500a8000 0x3054>; - interrupts = <67 0>; + interrupts = <67 0>, <68 0>; + interrupt-names = "sysrtc_app", "sysrtc_seq"; clock-frequency = <32768>; prescaler = <1>; clocks = <&cmu CLOCK_SYSRTC0 CLOCK_BRANCH_SYSRTCCLK>; From da6ddc92cd07b3d20f6da3d9c9c63bb9ce1518d5 Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Mon, 21 Oct 2024 12:27:03 +0200 Subject: [PATCH 1540/4482] drivers: timer: silabs: Add sleeptimer timer driver Add OS timer implementation making use of the Sleeptimer HAL. Sleeptimer integrates tightly with the Silabs Power Manager HAL, and must be used as the OS timer to achieve optimal power consumption when using the radio. Signed-off-by: Aksel Skauge Mellbye --- drivers/counter/Kconfig.gecko | 3 +- drivers/timer/CMakeLists.txt | 1 + drivers/timer/Kconfig | 1 + drivers/timer/Kconfig.silabs | 13 ++ drivers/timer/silabs_sleeptimer_timer.c | 166 ++++++++++++++++++ .../hal_silabs/simplicity_sdk/CMakeLists.txt | 19 +- soc/silabs/Kconfig | 7 + 7 files changed, 202 insertions(+), 8 deletions(-) create mode 100644 drivers/timer/Kconfig.silabs create mode 100644 drivers/timer/silabs_sleeptimer_timer.c diff --git a/drivers/counter/Kconfig.gecko b/drivers/counter/Kconfig.gecko index 8a5fdafab4d60..ded39e296855f 100644 --- a/drivers/counter/Kconfig.gecko +++ b/drivers/counter/Kconfig.gecko @@ -17,8 +17,7 @@ config COUNTER_GECKO_STIMER bool "Silicon Labs Gecko Counter Sleep Timer driver" default y depends on DT_HAS_SILABS_GECKO_STIMER_ENABLED - select SOC_GECKO_RTCC - select SOC_GECKO_PRS + select SOC_SILABS_SLEEPTIMER help Enable the counter driver for Sleep Timer module for Silicon Labs Gecko chips. diff --git a/drivers/timer/CMakeLists.txt b/drivers/timer/CMakeLists.txt index 653bff66a9868..80f0d03e69022 100644 --- a/drivers/timer/CMakeLists.txt +++ b/drivers/timer/CMakeLists.txt @@ -32,6 +32,7 @@ zephyr_library_sources_ifdef(CONFIG_RCAR_CMT_TIMER rcar_cmt_timer.c) zephyr_library_sources_ifdef(CONFIG_RISCV_MACHINE_TIMER riscv_machine_timer.c) zephyr_library_sources_ifdef(CONFIG_RV32M1_LPTMR_TIMER rv32m1_lptmr_timer.c) zephyr_library_sources_ifdef(CONFIG_SAM0_RTC_TIMER sam0_rtc_timer.c) +zephyr_library_sources_ifdef(CONFIG_SILABS_SLEEPTIMER_TIMER silabs_sleeptimer_timer.c) zephyr_library_sources_ifdef(CONFIG_STM32_LPTIM_TIMER stm32_lptim_timer.c) zephyr_library_sources_ifdef(CONFIG_TI_DM_TIMER ti_dmtimer.c) zephyr_library_sources_ifdef(CONFIG_XLNX_PSTTC_TIMER xlnx_psttc_timer.c) diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig index 8309fded78127..4a30c7ddaaeb8 100644 --- a/drivers/timer/Kconfig +++ b/drivers/timer/Kconfig @@ -91,6 +91,7 @@ source "drivers/timer/Kconfig.rcar_cmt" source "drivers/timer/Kconfig.riscv_machine" source "drivers/timer/Kconfig.rv32m1_lptmr" source "drivers/timer/Kconfig.sam0_rtc" +source "drivers/timer/Kconfig.silabs" source "drivers/timer/Kconfig.smartbond" source "drivers/timer/Kconfig.stm32_lptim" source "drivers/timer/Kconfig.ti_dm_timer" diff --git a/drivers/timer/Kconfig.silabs b/drivers/timer/Kconfig.silabs new file mode 100644 index 0000000000000..2e9abba8ef6da --- /dev/null +++ b/drivers/timer/Kconfig.silabs @@ -0,0 +1,13 @@ +# Copyright (c) 2024 Silicon Laboratories Inc. +# SPDX-License-Identifier: Apache-2.0 + +config SILABS_SLEEPTIMER_TIMER + bool "Silabs Sleeptimer system clock driver" + depends on SOC_FAMILY_SILABS_S2 + depends on DT_HAS_SILABS_GECKO_STIMER_ENABLED + select SOC_SILABS_SLEEPTIMER + select TICKLESS_CAPABLE + select TIMER_READS_ITS_FREQUENCY_AT_RUNTIME + help + This module implements a kernel device driver for the sleeptimer + and provides the standard "system clock driver" interfaces. diff --git a/drivers/timer/silabs_sleeptimer_timer.c b/drivers/timer/silabs_sleeptimer_timer.c new file mode 100644 index 0000000000000..405fa1496a5a7 --- /dev/null +++ b/drivers/timer/silabs_sleeptimer_timer.c @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2024 Silicon Laboratories Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +LOG_MODULE_REGISTER(silabs_sleeptimer_timer); + +/* Maximum time interval between timer interrupts (in hw_cycles) */ +#define MAX_TIMEOUT_CYC (UINT32_MAX >> 1) +#define MIN_DELAY_CYC (4U) + +#define DT_RTC DT_COMPAT_GET_ANY_STATUS_OKAY(silabs_gecko_stimer) + +/* Ensure interrupt names don't expand to register interface struct pointers */ +#undef RTCC + +/* With CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME, this global variable holds the clock frequency, + * and must be written by the driver at init. + */ +extern int z_clock_hw_cycles_per_sec; + +/* Global timer state */ +struct sleeptimer_timer_data { + uint32_t cyc_per_tick; /* Number of hw_cycles per 1 kernel tick */ + uint32_t max_timeout_ticks; /* MAX_TIMEOUT_CYC expressed as ticks */ + atomic_t last_count; /* Value of counter when the previous tick was announced */ + struct k_spinlock lock; /* Spinlock to sync between ISR and updating the timeout */ + bool initialized; /* Set to true when timer is initialized */ + sl_sleeptimer_timer_handle_t handle; /* Timer handle for system timer */ +}; +static struct sleeptimer_timer_data g_sleeptimer_timer_data = {0}; + +static void sleeptimer_cb(sl_sleeptimer_timer_handle_t *handle, void *data) +{ + ARG_UNUSED(handle); + struct sleeptimer_timer_data *timer = data; + + uint32_t curr = sl_sleeptimer_get_tick_count(); + uint32_t prev = atomic_get(&timer->last_count); + uint32_t pending = curr - prev; + + /* Number of unannounced ticks since the last announcement */ + uint32_t unannounced = pending / timer->cyc_per_tick; + + atomic_set(&timer->last_count, prev + unannounced * timer->cyc_per_tick); + + sys_clock_announce(unannounced); +} + +static void sleeptimer_clock_set_timeout(int32_t ticks, struct sleeptimer_timer_data *timer) +{ + if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { + return; + } + + ticks = (ticks == K_TICKS_FOREVER) ? timer->max_timeout_ticks : ticks; + ticks = CLAMP(ticks, 0, timer->max_timeout_ticks); + + k_spinlock_key_t key = k_spin_lock(&timer->lock); + + uint32_t curr = sl_sleeptimer_get_tick_count(); + uint32_t prev = atomic_get(&timer->last_count); + uint32_t pending = curr - prev; + uint32_t next = ticks * timer->cyc_per_tick; + + /* Next timeout is N ticks in the future, minus the current progress + * towards the timeout. If we are behind, set the timeout to the first + * possible upcoming tick. + */ + while (next < (pending + MIN_DELAY_CYC)) { + next += timer->cyc_per_tick; + } + next -= pending; + + sl_sleeptimer_restart_timer(&timer->handle, next, sleeptimer_cb, timer, 0, 0); + k_spin_unlock(&timer->lock, key); +} + +static uint32_t sleeptimer_clock_elapsed(struct sleeptimer_timer_data *timer) +{ + if (!IS_ENABLED(CONFIG_TICKLESS_KERNEL) || !timer->initialized) { + /* No unannounced ticks can have elapsed if not in tickless mode */ + return 0; + } else { + return (sl_sleeptimer_get_tick_count() - atomic_get(&timer->last_count)) / + timer->cyc_per_tick; + } +} + +void sys_clock_set_timeout(int32_t ticks, bool idle) +{ + ARG_UNUSED(idle); + + sleeptimer_clock_set_timeout(ticks, &g_sleeptimer_timer_data); +} + +uint32_t sys_clock_elapsed(void) +{ + return sleeptimer_clock_elapsed(&g_sleeptimer_timer_data); +} + +uint32_t sys_clock_cycle_get_32(void) +{ + return g_sleeptimer_timer_data.initialized ? sl_sleeptimer_get_tick_count() : 0; +} + +static int sleeptimer_init(void) +{ + sl_status_t status = SL_STATUS_OK; + struct sleeptimer_timer_data *timer = &g_sleeptimer_timer_data; + + IRQ_CONNECT(DT_IRQ(DT_RTC, irq), DT_IRQ(DT_RTC, priority), + CONCAT(DT_STRING_UPPER_TOKEN_BY_IDX(DT_RTC, interrupt_names, 0), _IRQHandler), + 0, 0); + + sl_sleeptimer_init(); + + z_clock_hw_cycles_per_sec = sl_sleeptimer_get_timer_frequency(); + + BUILD_ASSERT(CONFIG_SYS_CLOCK_TICKS_PER_SEC > 0, + "Invalid CONFIG_SYS_CLOCK_TICKS_PER_SEC value"); + + timer->cyc_per_tick = z_clock_hw_cycles_per_sec / CONFIG_SYS_CLOCK_TICKS_PER_SEC; + + __ASSERT(timer->cyc_per_tick >= MIN_DELAY_CYC, + "A tick of %u cycles is too short to be scheduled " + "(min is %u). Config: SYS_CLOCK_TICKS_PER_SEC is " + "%d and timer frequency is %u", + timer->cyc_per_tick, MIN_DELAY_CYC, CONFIG_SYS_CLOCK_TICKS_PER_SEC, + z_clock_hw_cycles_per_sec); + + timer->max_timeout_ticks = MAX_TIMEOUT_CYC / timer->cyc_per_tick; + timer->initialized = true; + + atomic_set(&timer->last_count, sl_sleeptimer_get_tick_count()); + + /* Start the timer and announce 1 kernel tick */ + if (IS_ENABLED(CONFIG_TICKLESS_KERNEL)) { + status = sl_sleeptimer_start_timer(&timer->handle, timer->cyc_per_tick, + sleeptimer_cb, timer, 0, 0); + } else { + status = sl_sleeptimer_start_periodic_timer(&timer->handle, timer->cyc_per_tick, + sleeptimer_cb, timer, 0, 0); + } + if (status != SL_STATUS_OK) { + return -ENODEV; + } + + return 0; +} + +SYS_INIT(sleeptimer_init, PRE_KERNEL_2, CONFIG_SYSTEM_CLOCK_INIT_PRIORITY); diff --git a/modules/hal_silabs/simplicity_sdk/CMakeLists.txt b/modules/hal_silabs/simplicity_sdk/CMakeLists.txt index 949bf5794473f..0398ed5b75d1c 100644 --- a/modules/hal_silabs/simplicity_sdk/CMakeLists.txt +++ b/modules/hal_silabs/simplicity_sdk/CMakeLists.txt @@ -139,6 +139,19 @@ if(NOT SILABS_DEVICE_FAMILY_NUMBER EQUAL "21") ) endif() +# Sleeptimer +if(CONFIG_SOC_SILABS_SLEEPTIMER) + zephyr_library_sources( + ${PERIPHERAL_DIR}/src/sl_hal_sysrtc.c + ${SERVICE_DIR}/sleeptimer/src/sl_sleeptimer_hal_rtcc.c + ${SERVICE_DIR}/sleeptimer/src/sl_sleeptimer_hal_sysrtc.c + ${SERVICE_DIR}/sleeptimer/src/sl_sleeptimer.c + ) + zephyr_compile_definitions( + SL_CATALOG_SLEEPTIMER_PRESENT + ) +endif() + zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_IADC ${EMLIB_DIR}/src/em_iadc.c) zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_BURTC ${EMLIB_DIR}/src/em_burtc.c) zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CMU ${EMLIB_DIR}/src/em_cmu.c) @@ -172,12 +185,6 @@ zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_PRS ${EMLIB_DIR}/src/em_p zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_RMU ${EMLIB_DIR}/src/em_rmu.c) zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_RTC ${EMLIB_DIR}/src/em_rtc.c) zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_RTCC ${EMLIB_DIR}/src/em_rtcc.c) -zephyr_library_sources_ifdef(CONFIG_COUNTER_GECKO_STIMER - ${PERIPHERAL_DIR}/src/sl_hal_sysrtc.c - ${SERVICE_DIR}/sleeptimer/src/sl_sleeptimer_hal_rtcc.c - ${SERVICE_DIR}/sleeptimer/src/sl_sleeptimer_hal_sysrtc.c - ${SERVICE_DIR}/sleeptimer/src/sl_sleeptimer.c -) zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_EUSART ${EMLIB_DIR}/src/em_eusart.c) zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_TIMER ${EMLIB_DIR}/src/em_timer.c) zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_USART ${EMLIB_DIR}/src/em_usart.c) diff --git a/soc/silabs/Kconfig b/soc/silabs/Kconfig index a9c9fde9da417..c9f7bdea180e9 100644 --- a/soc/silabs/Kconfig +++ b/soc/silabs/Kconfig @@ -121,6 +121,13 @@ config SOC_GECKO_TRNG help Set if the SoC has a True Random Number Generator (TRNG) module. +config SOC_SILABS_SLEEPTIMER + bool + select SOC_GECKO_PRS + select SOC_GECKO_RTCC if SOC_SERIES_EFR32BG22 || SOC_SERIES_EFR32BG27 || SOC_SERIES_EFR32MG21 + help + Set if the Sleeptimer HAL module is used. + if PM config SOC_GECKO_PM_BACKEND_PMGR From 51194bf03f999c999ca5f1195a2616580929ccee Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Mon, 21 Oct 2024 12:37:19 +0200 Subject: [PATCH 1541/4482] soc: silabs: Default to sleeptimer for OS timer on Series 2 Disable BURTC timer in board defconfigs, as it's no longer used. Signed-off-by: Aksel Skauge Mellbye --- boards/silabs/dev_kits/sltb010a/sltb010a_defconfig | 4 ---- boards/silabs/dev_kits/sltb010a/thunderboard.dtsi | 4 ---- .../silabs/dev_kits/xg24_dk2601b/xg24_dk2601b_defconfig | 1 - boards/silabs/dev_kits/xg27_dk2602a/thunderboard.dtsi | 4 ---- .../silabs/dev_kits/xg27_dk2602a/xg27_dk2602a_defconfig | 4 ---- boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts | 4 ---- .../radio_boards/xg24_rb4187c/xg24_rb4187c_defconfig | 4 ---- .../sparkfun_thing_plus_matter_mgm240p_defconfig | 1 - soc/silabs/silabs_s2/Kconfig.defconfig | 9 +++++++++ 9 files changed, 9 insertions(+), 26 deletions(-) diff --git a/boards/silabs/dev_kits/sltb010a/sltb010a_defconfig b/boards/silabs/dev_kits/sltb010a/sltb010a_defconfig index ecee74de4cc86..40057c1dd75a4 100644 --- a/boards/silabs/dev_kits/sltb010a/sltb010a_defconfig +++ b/boards/silabs/dev_kits/sltb010a/sltb010a_defconfig @@ -9,7 +9,3 @@ CONFIG_SOC_GECKO_EMU_DCDC=y CONFIG_SOC_GECKO_EMU_DCDC_MODE_ON=y CONFIG_HW_STACK_PROTECTION=y CONFIG_PINCTRL=y - -# Use BURTC as system clock source -CONFIG_GECKO_BURTC_TIMER=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1024 diff --git a/boards/silabs/dev_kits/sltb010a/thunderboard.dtsi b/boards/silabs/dev_kits/sltb010a/thunderboard.dtsi index 66b981e370bd0..e94827c0c810d 100644 --- a/boards/silabs/dev_kits/sltb010a/thunderboard.dtsi +++ b/boards/silabs/dev_kits/sltb010a/thunderboard.dtsi @@ -130,10 +130,6 @@ status = "okay"; }; -&burtc0 { - status = "okay"; -}; - &rtcc0 { status = "okay"; }; diff --git a/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b_defconfig b/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b_defconfig index b7dbc036d0c1d..751fbb5cae557 100644 --- a/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b_defconfig +++ b/boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b_defconfig @@ -5,7 +5,6 @@ CONFIG_ARM_MPU=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y CONFIG_SERIAL=y -CONFIG_CORTEX_M_SYSTICK=y CONFIG_GPIO=y CONFIG_HW_STACK_PROTECTION=y CONFIG_PINCTRL=y diff --git a/boards/silabs/dev_kits/xg27_dk2602a/thunderboard.dtsi b/boards/silabs/dev_kits/xg27_dk2602a/thunderboard.dtsi index 66b981e370bd0..e94827c0c810d 100644 --- a/boards/silabs/dev_kits/xg27_dk2602a/thunderboard.dtsi +++ b/boards/silabs/dev_kits/xg27_dk2602a/thunderboard.dtsi @@ -130,10 +130,6 @@ status = "okay"; }; -&burtc0 { - status = "okay"; -}; - &rtcc0 { status = "okay"; }; diff --git a/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a_defconfig b/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a_defconfig index ecee74de4cc86..40057c1dd75a4 100644 --- a/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a_defconfig +++ b/boards/silabs/dev_kits/xg27_dk2602a/xg27_dk2602a_defconfig @@ -9,7 +9,3 @@ CONFIG_SOC_GECKO_EMU_DCDC=y CONFIG_SOC_GECKO_EMU_DCDC_MODE_ON=y CONFIG_HW_STACK_PROTECTION=y CONFIG_PINCTRL=y - -# Use BURTC as system clock source -CONFIG_GECKO_BURTC_TIMER=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1024 diff --git a/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts b/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts index f398b91925717..7c45892f8d145 100644 --- a/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts +++ b/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c.dts @@ -148,10 +148,6 @@ status = "okay"; }; -&burtc0 { - status = "okay"; -}; - &sysrtc0 { status = "okay"; }; diff --git a/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c_defconfig b/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c_defconfig index b437d477f1045..9105d3b33441c 100644 --- a/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c_defconfig +++ b/boards/silabs/radio_boards/xg24_rb4187c/xg24_rb4187c_defconfig @@ -8,7 +8,3 @@ CONFIG_GPIO=y CONFIG_SOC_GECKO_EMU_DCDC=y CONFIG_SOC_GECKO_EMU_DCDC_MODE_ON=y CONFIG_PINCTRL=y - -# Use BURTC as system clock source -CONFIG_GECKO_BURTC_TIMER=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=1024 diff --git a/boards/sparkfun/thing_plus_matter_mgm240p/sparkfun_thing_plus_matter_mgm240p_defconfig b/boards/sparkfun/thing_plus_matter_mgm240p/sparkfun_thing_plus_matter_mgm240p_defconfig index 85bdf41ea99ad..28d1fa9d193ca 100644 --- a/boards/sparkfun/thing_plus_matter_mgm240p/sparkfun_thing_plus_matter_mgm240p_defconfig +++ b/boards/sparkfun/thing_plus_matter_mgm240p/sparkfun_thing_plus_matter_mgm240p_defconfig @@ -6,7 +6,6 @@ CONFIG_ARM_MPU=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y CONFIG_SERIAL=y -CONFIG_CORTEX_M_SYSTICK=y CONFIG_GPIO=y CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=76800000 CONFIG_SOC_GECKO_EMU_DCDC=y diff --git a/soc/silabs/silabs_s2/Kconfig.defconfig b/soc/silabs/silabs_s2/Kconfig.defconfig index 733c7c4df618a..d7dec5deb3df8 100644 --- a/soc/silabs/silabs_s2/Kconfig.defconfig +++ b/soc/silabs/silabs_s2/Kconfig.defconfig @@ -9,4 +9,13 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency) if CORTEX_M_SYSTICK default 32768 +config SYS_CLOCK_TICKS_PER_SEC + default 1024 if SILABS_SLEEPTIMER_TIMER || GECKO_BURTC_TIMER + +config SILABS_SLEEPTIMER_TIMER + default y + +config CORTEX_M_SYSTICK + default n if SILABS_SLEEPTIMER_TIMER || GECKO_BURTC_TIMER + endif From 8d4fa7be0bfde7a4ef03ec56d45b1e9bcbcd8275 Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Mon, 21 Oct 2024 12:38:55 +0200 Subject: [PATCH 1542/4482] soc: silabs: Remove counter dependency for pm Power Manager no longer requires the Counter driver. This seems to have been a hack to get the Sleeptimer HAL included in the build, as the Sleeptimer is the real dependency of the Silabs Power Manager HAL. Since Sleeptimer is now used for the OS timer, this hack is not needed. Signed-off-by: Aksel Skauge Mellbye --- soc/silabs/silabs_s2/efr32bg22/Kconfig.defconfig | 1 - soc/silabs/silabs_s2/efr32bg27/Kconfig.defconfig | 3 --- soc/silabs/silabs_s2/efr32mg24/Kconfig.defconfig | 1 - 3 files changed, 5 deletions(-) diff --git a/soc/silabs/silabs_s2/efr32bg22/Kconfig.defconfig b/soc/silabs/silabs_s2/efr32bg22/Kconfig.defconfig index 8613bafa7ed7c..2423ae5dedd1c 100644 --- a/soc/silabs/silabs_s2/efr32bg22/Kconfig.defconfig +++ b/soc/silabs/silabs_s2/efr32bg22/Kconfig.defconfig @@ -8,7 +8,6 @@ config NUM_IRQS default 60 config PM - select COUNTER select UART_INTERRUPT_DRIVEN config GPIO_GECKO diff --git a/soc/silabs/silabs_s2/efr32bg27/Kconfig.defconfig b/soc/silabs/silabs_s2/efr32bg27/Kconfig.defconfig index 747b004695c70..37b57c2fef4dd 100644 --- a/soc/silabs/silabs_s2/efr32bg27/Kconfig.defconfig +++ b/soc/silabs/silabs_s2/efr32bg27/Kconfig.defconfig @@ -7,9 +7,6 @@ config NUM_IRQS # must be >= the highest interrupt number used default 66 -config PM - select COUNTER - config GPIO_GECKO default y diff --git a/soc/silabs/silabs_s2/efr32mg24/Kconfig.defconfig b/soc/silabs/silabs_s2/efr32mg24/Kconfig.defconfig index fb3ad68bc3f37..8489c555eb12d 100644 --- a/soc/silabs/silabs_s2/efr32mg24/Kconfig.defconfig +++ b/soc/silabs/silabs_s2/efr32mg24/Kconfig.defconfig @@ -9,7 +9,6 @@ config NUM_IRQS config PM default n - select COUNTER select UART_INTERRUPT_DRIVEN if SERIAL_SUPPORT_INTERRUPT choice PM_POLICY From 0d9aa5a68c595f3a4f02145d3023144d2b1e5e60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Bj=C3=B6rnsson?= Date: Sun, 20 Oct 2024 20:35:02 +0200 Subject: [PATCH 1543/4482] drivers: watchdog: wdt_counter: Fix overflow warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cast variable to uint64_t to ensure the multiplication is performed using 64-bit arithmetic. Resolves static code analysis warning from Coverity. Signed-off-by: Benjamin Björnsson --- drivers/watchdog/wdt_counter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/watchdog/wdt_counter.c b/drivers/watchdog/wdt_counter.c index a26e5d23eec1a..a58fd777f4e14 100644 --- a/drivers/watchdog/wdt_counter.c +++ b/drivers/watchdog/wdt_counter.c @@ -104,7 +104,7 @@ static int wdt_counter_install_timeout(const struct device *dev, uint32_t max_timeout = counter_get_top_value(counter) - counter_get_guard_period(counter, COUNTER_GUARD_PERIOD_LATE_TO_SET); - uint32_t timeout_ticks = counter_us_to_ticks(counter, cfg->window.max * 1000); + uint32_t timeout_ticks = counter_us_to_ticks(counter, (uint64_t)cfg->window.max * 1000); if (cfg->flags & ~WDT_SUPPORTED_CFG_FLAGS) { return -ENOTSUP; From 23c43f171645f4704c14c25e3ae868f7f63edfb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 12:16:54 +0200 Subject: [PATCH 1544/4482] boards: 01space: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the 01space boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/01space/esp32c3_042_oled/doc/index.rst | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/boards/01space/esp32c3_042_oled/doc/index.rst b/boards/01space/esp32c3_042_oled/doc/index.rst index b8f3cbe7bc9f5..29fcfc7861502 100644 --- a/boards/01space/esp32c3_042_oled/doc/index.rst +++ b/boards/01space/esp32c3_042_oled/doc/index.rst @@ -1,7 +1,4 @@ -.. _01space_esp32c3_042_oled: - -ESP32C3 0.42 OLED -################# +.. zephyr:board:: esp32c3_042_oled Overview ******** @@ -11,12 +8,6 @@ RISC-V WiFi/Bluetooth dual-mode chip. For more details see the `01space ESP32C3 0.42 OLED`_ Github repo. -.. figure:: img/esp32c3_042_oled.webp - :align: center - :alt: 01space ESP32C3 0.42 OLED - - 01space ESP32C3 0.42 OLED - Hardware ******** From 77a35d835a4add3ac32ca7559ff4f0ee9c1059dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 12:18:57 +0200 Subject: [PATCH 1545/4482] boards: actinius: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Actinius boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/actinius/icarus/doc/index.rst | 11 +---------- boards/actinius/icarus_bee/doc/index.rst | 11 +---------- boards/actinius/icarus_som/doc/index.rst | 11 +---------- boards/actinius/icarus_som_dk/doc/index.rst | 12 +----------- samples/sensor/lis2dh/README.rst | 4 ++-- 5 files changed, 6 insertions(+), 43 deletions(-) diff --git a/boards/actinius/icarus/doc/index.rst b/boards/actinius/icarus/doc/index.rst index 8092c53c8c90e..4ac623efe2f42 100644 --- a/boards/actinius/icarus/doc/index.rst +++ b/boards/actinius/icarus/doc/index.rst @@ -1,17 +1,8 @@ -.. _actinius_icarus: - -Actinius Icarus -############### +.. zephyr:board:: actinius_icarus Overview ******** -.. figure:: img/Icarus_front.jpg - :align: center - :alt: Icarus IoT Dev Board - - Icarus IoT Dev Board (nRF9160 Feather) - The Icarus is a cost-effective cellular IoT board in Adafruit's Feather/FeatherWing form factor. It is built around Nordic Semi's nRF9160 modem and combines LTE-M, NB-IoT, GPS, accelerometer, USB, LiPo charger as well as diff --git a/boards/actinius/icarus_bee/doc/index.rst b/boards/actinius/icarus_bee/doc/index.rst index 630d0aa07c783..32378c92d45e6 100644 --- a/boards/actinius/icarus_bee/doc/index.rst +++ b/boards/actinius/icarus_bee/doc/index.rst @@ -1,17 +1,8 @@ -.. _actinius_icarus_bee: - -Actinius Icarus Bee -################### +.. zephyr:board:: actinius_icarus_bee Overview ******** -.. figure:: img/icarus-bee.jpg - :align: center - :alt: Icarus Bee - - Icarus Bee (nRF9160 Bee) - The Icarus Bee is a cellular IoT board in Bee/xBee form factor. It is built around Nordic Semi's nRF9160 modem and combines LTE-M, NB-IoT, GPS, accelerometer, SPI Flash, RGB LED, Button, diff --git a/boards/actinius/icarus_som/doc/index.rst b/boards/actinius/icarus_som/doc/index.rst index f3206e63fe3f7..ea4f47a4cf312 100644 --- a/boards/actinius/icarus_som/doc/index.rst +++ b/boards/actinius/icarus_som/doc/index.rst @@ -1,17 +1,8 @@ -.. _actinius_icarus_som: - -Actinius Icarus SoM -################### +.. zephyr:board:: actinius_icarus_som Overview ******** -.. figure:: img/icarus-som.jpg - :align: center - :alt: Icarus SoM - - Icarus SoM (nRF9160) - The Icarus SoM is a coin-sized, easy-to-solder cellular IoT Module built around Nordic Semi's nRF9160 modem and combines LTE-M, NB-IoT, GPS, accelerometer as well as an eSIM and option for diff --git a/boards/actinius/icarus_som_dk/doc/index.rst b/boards/actinius/icarus_som_dk/doc/index.rst index 7f9291489a50c..bca73ddbde779 100644 --- a/boards/actinius/icarus_som_dk/doc/index.rst +++ b/boards/actinius/icarus_som_dk/doc/index.rst @@ -1,18 +1,8 @@ -.. _actinius_icarus_som_dk: - -Actinius Icarus SoM DK -###################### +.. zephyr:board:: actinius_icarus_som_dk Overview ******** -.. figure:: img/icarus_som_dk.jpg - :width: 450px - :align: center - :alt: Icarus SoM DK - - Icarus SoM Development Kit (nRF9160) - The Icarus SoM DK is a single board development kit for evaluation and development on the Icarus SoM (`Icarus SoM Docs`_). The Icarus SoM features the nRF9160 SiP from Nordic Semiconductor, diff --git a/samples/sensor/lis2dh/README.rst b/samples/sensor/lis2dh/README.rst index be2216e8c9ca8..23a86bd1523e7 100644 --- a/samples/sensor/lis2dh/README.rst +++ b/samples/sensor/lis2dh/README.rst @@ -29,7 +29,7 @@ Building and Running The LIS2DH2 or compatible sensors are available on a variety of boards and shields supported by Zephyr, including: -* :ref:`actinius_icarus` +* :zephyr:board:`actinius_icarus` * :ref:`thingy52_nrf52832` * :ref:`stm32f3_disco_board` * :ref:`x-nucleo-iks01a2` @@ -40,7 +40,7 @@ and get access to the console where acceleration data is displayed. Building on actinius_icarus =========================== -:ref:`actinius_icarus` includes an ST LIS2DH12 accelerometer which +:zephyr:board:`actinius_icarus` includes an ST LIS2DH12 accelerometer which supports the LIS2DH interface. .. zephyr-app-commands:: From 599e0625e36b18391d431d4dfa0f15c614889417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 17:12:09 +0200 Subject: [PATCH 1546/4482] boards: adafruit: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Adafruit boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/adafruit/feather_m0_basic_proto/doc/index.rst | 9 +-------- boards/adafruit/feather_m0_lora/doc/index.rst | 9 +-------- boards/adafruit/feather_nrf52840/doc/index.rst | 5 +---- boards/adafruit/feather_stm32f405/doc/index.rst | 9 +-------- .../adafruit/grand_central_m4_express/doc/index.rst | 12 +----------- boards/adafruit/itsybitsy/doc/index.rst | 9 +-------- boards/adafruit/itsybitsy_m4_express/doc/index.rst | 9 +-------- boards/adafruit/kb2040/doc/index.rst | 12 +----------- boards/adafruit/nrf52_adafruit_feather/doc/index.rst | 11 +---------- boards/adafruit/qt_py_rp2040/doc/index.rst | 12 +----------- boards/adafruit/trinket_m0/doc/index.rst | 9 +-------- doc/develop/flash_debug/host-tools.rst | 2 +- samples/sensor/bme280/README.rst | 2 +- 13 files changed, 13 insertions(+), 97 deletions(-) diff --git a/boards/adafruit/feather_m0_basic_proto/doc/index.rst b/boards/adafruit/feather_m0_basic_proto/doc/index.rst index a01fe241d5960..20d1cd4750aba 100644 --- a/boards/adafruit/feather_m0_basic_proto/doc/index.rst +++ b/boards/adafruit/feather_m0_basic_proto/doc/index.rst @@ -1,7 +1,4 @@ -.. _adafruit_feather_m0_basic_proto: - -Adafruit Feather M0 Basic Proto -############################### +.. zephyr:board:: adafruit_feather_m0_basic_proto Overview ******** @@ -11,10 +8,6 @@ board with an onboard battery connector and charger for 3.7 V lithium polymer batteries, charging status indicator and user LEDs, native USB connector, 20 I/O pins, and a small prototyping area. -.. image:: img/adafruit_feather_m0_basic_proto.jpg - :align: center - :alt: Adafruit Feather M0 Basic Proto - Hardware ******** diff --git a/boards/adafruit/feather_m0_lora/doc/index.rst b/boards/adafruit/feather_m0_lora/doc/index.rst index 92d63b36ce3ad..7a3e9fc78bf5a 100644 --- a/boards/adafruit/feather_m0_lora/doc/index.rst +++ b/boards/adafruit/feather_m0_lora/doc/index.rst @@ -1,7 +1,4 @@ -.. _adafruit_feather_m0_lora: - -Adafruit Feather M0 LoRa -######################## +.. zephyr:board:: adafruit_feather_m0_lora Overview ******** @@ -11,10 +8,6 @@ boards with an onboard battery connector and charger for 3.7 V lithium polymer batteries, charging status indicator and user LEDs, native USB connector, 20 I/O pins, and a LoRa radio module from Semtech. -.. image:: img/adafruit_feather_m0_lora.jpg - :align: center - :alt: Adafruit Feather M0 LoRa - Hardware ******** diff --git a/boards/adafruit/feather_nrf52840/doc/index.rst b/boards/adafruit/feather_nrf52840/doc/index.rst index 7ab630978d43a..6f2477e673ffe 100644 --- a/boards/adafruit/feather_nrf52840/doc/index.rst +++ b/boards/adafruit/feather_nrf52840/doc/index.rst @@ -1,7 +1,4 @@ -.. _adafruit_feather_nrf52840: - -Adafruit Feather nRF52840 (Express, Sense) -########################################## +.. zephyr:board:: adafruit_feather_nrf52840 Overview ******** diff --git a/boards/adafruit/feather_stm32f405/doc/index.rst b/boards/adafruit/feather_stm32f405/doc/index.rst index 47d70537e693a..0cc6c327760f3 100644 --- a/boards/adafruit/feather_stm32f405/doc/index.rst +++ b/boards/adafruit/feather_stm32f405/doc/index.rst @@ -1,7 +1,4 @@ -.. _adafruit_feather_stm32f405: - -Adafruit Feather STM32F405 Express -################################## +.. zephyr:board:: adafruit_feather_stm32f405 Overview ******** @@ -12,10 +9,6 @@ devices labeled as Feathers or FeatherWings. The board is equipped with a lithium ion battery charger, native USB C connector, 2MB of external flash memory, and SD card socket. -.. image:: img/adafruit_feather_stm32f405.jpg - :align: center - :alt: Adafruit Feather STM32F405 Express - Hardware ******** diff --git a/boards/adafruit/grand_central_m4_express/doc/index.rst b/boards/adafruit/grand_central_m4_express/doc/index.rst index 0244fa73f8769..4bab888996724 100644 --- a/boards/adafruit/grand_central_m4_express/doc/index.rst +++ b/boards/adafruit/grand_central_m4_express/doc/index.rst @@ -1,7 +1,4 @@ -.. _adafruit_grand_central_m4_express: - -Adafruit Grand Central M4 Express -################################# +.. zephyr:board:: adafruit_grand_central_m4_express Overview ******** @@ -10,13 +7,6 @@ The Adafruit Grand Central M4 Express is an ARM development board with the form factor of an Arduino Mega. It features 70 GPIO pins, a microSDHC slot and 8MiB of QSPI Flash. -.. figure:: img/adafruit_grand_central_m4_express.webp - :width: 800px - :align: center - :alt: Adafruit Grand Central M4 Express - - Adafruit Grand Central M4 Express (Credit: Kattni Rembor / Adafruit) - Hardware ******** diff --git a/boards/adafruit/itsybitsy/doc/index.rst b/boards/adafruit/itsybitsy/doc/index.rst index c2e4330c04d9a..3fbcb918adb40 100644 --- a/boards/adafruit/itsybitsy/doc/index.rst +++ b/boards/adafruit/itsybitsy/doc/index.rst @@ -1,7 +1,4 @@ -.. _adafruit_itsybitsy_nrf52840: - -Adafruit ItsyBitsy nRF52840 -########################### +.. zephyr:board:: adafruit_itsybitsy Overview ******** @@ -29,10 +26,6 @@ This development kit has the following features: * :abbr:`USB (Universal Serial Bus)` * :abbr:`WDT (Watchdog Timer)` -.. image:: img/adafruit_itsybitsy_nrf52840.jpeg - :align: center - :alt: Adafruit ItsyBitsy nRF52840 Express - Hardware ******** - nRF52840 ARM Cortex-M4F CPU at 64MHz diff --git a/boards/adafruit/itsybitsy_m4_express/doc/index.rst b/boards/adafruit/itsybitsy_m4_express/doc/index.rst index 2ab1f7a5853ec..31e19cb8a992c 100644 --- a/boards/adafruit/itsybitsy_m4_express/doc/index.rst +++ b/boards/adafruit/itsybitsy_m4_express/doc/index.rst @@ -1,7 +1,4 @@ -.. _adafruit_itsybitsy_m4_express: - -Adafruit ItsyBitsy M4 Express -############################# +.. zephyr:board:: adafruit_itsybitsy_m4_express Overview ******** @@ -10,10 +7,6 @@ The Adafruit ItsyBitsy M4 express is a small (36 mm x 18 mm) ARM development board with an onboard RGB LED, USB port, 2 MiB of SPI flash, and range of I/O broken out onto 23 GPIO pins. -.. image:: img/adafruit_itsybitsy_m4_express.jpg - :align: center - :alt: Adafruit ItsyBitsy M4 Express - Hardware ******** diff --git a/boards/adafruit/kb2040/doc/index.rst b/boards/adafruit/kb2040/doc/index.rst index 58b53aec81518..f1b5d998dc83a 100644 --- a/boards/adafruit/kb2040/doc/index.rst +++ b/boards/adafruit/kb2040/doc/index.rst @@ -1,7 +1,4 @@ -.. _adafruit_kb2040: - -Adafruit KB2040 -############### +.. zephyr:board:: adafruit_kb2040 Overview ******** @@ -27,13 +24,6 @@ Hardware - On-board RGB LED - 1 Watchdog timer peripheral - -.. figure:: img/kb2040.jpg - :align: center - :alt: Adafruit KB2040 - - Adafruit KB2040 (Image courtesy of Adafruit) - Supported Features ================== diff --git a/boards/adafruit/nrf52_adafruit_feather/doc/index.rst b/boards/adafruit/nrf52_adafruit_feather/doc/index.rst index 1fff89aaeab8a..c84bc73f62bd3 100644 --- a/boards/adafruit/nrf52_adafruit_feather/doc/index.rst +++ b/boards/adafruit/nrf52_adafruit_feather/doc/index.rst @@ -1,7 +1,4 @@ -.. _nrf52_adafruit_feather: - -nRF52 Adafruit Feather -###################### +.. zephyr:board:: nrf52_adafruit_feather Overview ******** @@ -18,12 +15,6 @@ the following devices: * RADIO (Bluetooth Low Energy) * Segger RTT (RTT Console) -.. figure:: img/nrf52_adafruit_feather.jpg - :align: center - :alt: nRF52 Adafruit Feather Board - - nRF52 Adafruit Feather Board (Credit: Adafruit) - More information about the board and its features can be found at the `Adafruit Feather nRF52 Bluefruit Learning Guide`_. The `Nordic Semiconductor Infocenter`_ contains the processor's information and the datasheet. diff --git a/boards/adafruit/qt_py_rp2040/doc/index.rst b/boards/adafruit/qt_py_rp2040/doc/index.rst index bf081c029b74a..0db8b4e403480 100644 --- a/boards/adafruit/qt_py_rp2040/doc/index.rst +++ b/boards/adafruit/qt_py_rp2040/doc/index.rst @@ -1,7 +1,4 @@ -.. _adafruit_qt_py_rp2040: - -Adafruit QT Py RP2040 -##################### +.. zephyr:board:: adafruit_qt_py_rp2040 Overview ******** @@ -27,13 +24,6 @@ Hardware - On-board RGB LED - 1 Watchdog timer peripheral - -.. figure:: img/qtpy_rp2040.jpg - :align: center - :alt: Adafruit QT Py RP2040 - - Adafruit QT Py RP2040 (Image courtesy of Adafruit) - Supported Features ================== diff --git a/boards/adafruit/trinket_m0/doc/index.rst b/boards/adafruit/trinket_m0/doc/index.rst index 4714f9d1affd0..224f9aa4c6ded 100644 --- a/boards/adafruit/trinket_m0/doc/index.rst +++ b/boards/adafruit/trinket_m0/doc/index.rst @@ -1,7 +1,4 @@ -.. _adafruit_trinket_m0: - -Adafruit Trinket M0 -################### +.. zephyr:board:: adafruit_trinket_m0 Overview ******** @@ -10,10 +7,6 @@ The Adafruit Trinket M0 is a tiny (27 mm x 15 mm) ARM development board with an onboard RGB LED, USB port, and range of I/O broken out onto 5 pins. -.. image:: img/adafruit_trinket_m0.jpg - :align: center - :alt: Adafruit Trinket M0 - Hardware ******** diff --git a/doc/develop/flash_debug/host-tools.rst b/doc/develop/flash_debug/host-tools.rst index 04c3cae1b8587..1cb25cd01c4c1 100644 --- a/doc/develop/flash_debug/host-tools.rst +++ b/doc/develop/flash_debug/host-tools.rst @@ -177,7 +177,7 @@ More implementation details can be found in the :ref:`boards` documentation. As a quick reference, see these three board documentation pages: - :ref:`sam4e_xpro` (ROM bootloader) - - :ref:`adafruit_feather_m0_basic_proto` (Adafruit UF2 bootloader) + - :zephyr:board:`adafruit_feather_m0_basic_proto` (Adafruit UF2 bootloader) - :ref:`arduino_nano_33_iot` (Arduino bootloader) - :ref:`arduino_nano_33_ble` (Arduino legacy bootloader) diff --git a/samples/sensor/bme280/README.rst b/samples/sensor/bme280/README.rst index 49471ec601623..9226ac34d059a 100644 --- a/samples/sensor/bme280/README.rst +++ b/samples/sensor/bme280/README.rst @@ -112,7 +112,7 @@ See existing overlays for examples. The build system uses these overlays by default when targeting those boards, so no ``DTC_OVERLAY_FILE`` setting is needed when building and running. -For example, to build for the :ref:`adafruit_feather_m0_basic_proto` using the +For example, to build for the :zephyr:board:`adafruit_feather_m0_basic_proto` using the :zephyr_file:`samples/sensor/bme280/boards/adafruit_feather_m0_basic_proto.overlay` overlay provided with this sample: From 1b292732484d3339a3e29435c7db6eb1d95f5d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 17:29:23 +0200 Subject: [PATCH 1547/4482] boards: adi: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Analog Devices boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/adi/apard32690/doc/index.rst | 9 +-------- boards/adi/eval_adin1110ebz/doc/index.rst | 11 +---------- boards/adi/eval_adin2111ebz/doc/index.rst | 11 +---------- boards/adi/max32655evkit/doc/index.rst | 5 +---- boards/adi/max32655fthr/doc/index.rst | 5 +---- boards/adi/max32662evkit/doc/index.rst | 9 +-------- boards/adi/max32666evkit/doc/index.rst | 11 +---------- boards/adi/max32666fthr/doc/index.rst | 5 +---- boards/adi/max32670evkit/doc/index.rst | 9 +-------- boards/adi/max32672evkit/doc/index.rst | 9 +-------- boards/adi/max32672fthr/doc/index.rst | 5 +---- boards/adi/max32675evkit/doc/index.rst | 9 +-------- boards/adi/max32680evkit/doc/index.rst | 10 +--------- ...max32690evkit_img1.jpg => max32690evkit.jpg} | Bin boards/adi/max32690evkit/doc/index.rst | 7 ++----- boards/adi/max32690fthr/doc/index.rst | 5 +---- boards/adi/sdp_k1/doc/index.rst | 11 +---------- doc/releases/release-notes-3.7.rst | 16 ++++++++-------- 18 files changed, 25 insertions(+), 122 deletions(-) rename boards/adi/max32690evkit/doc/img/{max32690evkit_img1.jpg => max32690evkit.jpg} (100%) diff --git a/boards/adi/apard32690/doc/index.rst b/boards/adi/apard32690/doc/index.rst index 4fb9f77191b54..8223f2b88e981 100644 --- a/boards/adi/apard32690/doc/index.rst +++ b/boards/adi/apard32690/doc/index.rst @@ -1,7 +1,4 @@ -.. _ad_apard32690_sl: - -AD-APARD32690-SL -################ +.. zephyr:board:: apard32690 Overview ******** @@ -19,10 +16,6 @@ the required power circuitry. The Zephyr port is running on the MAX32690 MCU. -.. image:: img/apard32690_img.webp - :align: center - :alt: AD-APARD32690-SL Front - Hardware ******** diff --git a/boards/adi/eval_adin1110ebz/doc/index.rst b/boards/adi/eval_adin1110ebz/doc/index.rst index f39a04b73620d..4f38e78faf0f5 100644 --- a/boards/adi/eval_adin1110ebz/doc/index.rst +++ b/boards/adi/eval_adin1110ebz/doc/index.rst @@ -1,7 +1,4 @@ -.. _adi_eval_adin1110ebz: - -ADI EVAL-ADIN1110EVB Evaluation board -##################################### +.. zephyr:board:: adi_eval_adin1110ebz Overview ******** @@ -23,12 +20,6 @@ The SPI interface provides configuration and data access to the ADIN1110. A small prototyping area and test points are provided for experimentation with alternative cable connection topologies including isolation transformers and/or power coupling inductors. -.. figure:: img/adi_eval_adin1110ebz.webp - :align: center - :alt: ADI EVAL-ADIN1110EBZ - - ADI EVAL-ADIN1110EBZ (Credit: Analog Devices, Inc.) - .. important:: S201 DIP switches are shipped in Open Alliance SPI mode. The current Zephyr diff --git a/boards/adi/eval_adin2111ebz/doc/index.rst b/boards/adi/eval_adin2111ebz/doc/index.rst index ea0ce92be2a6b..7579c85b0cd2c 100644 --- a/boards/adi/eval_adin2111ebz/doc/index.rst +++ b/boards/adi/eval_adin2111ebz/doc/index.rst @@ -1,7 +1,4 @@ -.. _adi_eval_adin2111ebz: - -ADI EVAL-ADIN2111EVB Evaluation board -##################################### +.. zephyr:board:: adi_eval_adin2111ebz Overview ******** @@ -38,12 +35,6 @@ the 2 PHYs configuration and data exchange between SPI host and ports. so the S1 DIP switches must be set as ``SPI_CFG0 OFF and SPI_CFG1 OFF``. An inconsistent S1 DIP switches configuration will halt the boot. -.. figure:: img/adi_eval_adin2111ebz.webp - :align: center - :alt: ADI EVAL-ADIN2111EBZ - - ADI EVAL-ADIN2111EBZ (Credit: Analog Devices, Inc.) - Hardware ******** diff --git a/boards/adi/max32655evkit/doc/index.rst b/boards/adi/max32655evkit/doc/index.rst index b0eeb67689add..649df3bde3773 100644 --- a/boards/adi/max32655evkit/doc/index.rst +++ b/boards/adi/max32655evkit/doc/index.rst @@ -1,7 +1,4 @@ -.. _max32655_evkit: - -MAX32655EVKIT -############# +.. zephyr:board:: max32655evkit Overview ******** diff --git a/boards/adi/max32655fthr/doc/index.rst b/boards/adi/max32655fthr/doc/index.rst index c58fb62855f33..839365066cc12 100644 --- a/boards/adi/max32655fthr/doc/index.rst +++ b/boards/adi/max32655fthr/doc/index.rst @@ -1,7 +1,4 @@ -.. _max32655_fthr: - -MAX32655FTHR -############ +.. zephyr:board:: max32655fthr Overview ******** diff --git a/boards/adi/max32662evkit/doc/index.rst b/boards/adi/max32662evkit/doc/index.rst index b474f3ca49216..b343fb6ed99b8 100644 --- a/boards/adi/max32662evkit/doc/index.rst +++ b/boards/adi/max32662evkit/doc/index.rst @@ -1,7 +1,4 @@ -.. _max32662_evkit: - -MAX32662EVKIT -############# +.. zephyr:board:: max32662evkit Overview ******** @@ -12,10 +9,6 @@ for battery-powered edge devices. The Zephyr port is running on the MAX32662 MCU. -.. image:: img/max32662evkit.webp - :align: center - :alt: MAX32662EVKIT - Hardware ******** diff --git a/boards/adi/max32666evkit/doc/index.rst b/boards/adi/max32666evkit/doc/index.rst index 0a824fbee4263..f71b1a69bb6f4 100644 --- a/boards/adi/max32666evkit/doc/index.rst +++ b/boards/adi/max32666evkit/doc/index.rst @@ -1,21 +1,12 @@ -.. _max32666evkit: - -MAX32666EVKIT -############# +.. zephyr:board:: max32666evkit Overview ******** The MAX32666EVKIT provides a platform for evaluating the capabilities of the MAX32665 and MAX32666 high-efficiency Arm® microcontrollers and audio DSP for wearable and hearable device applications. - The Zephyr port is running on the MAX32666 MCU. -.. image:: img/max32666evkit.webp - :align: center - :alt: MAX32666EVKIT Front - - Hardware ******** diff --git a/boards/adi/max32666fthr/doc/index.rst b/boards/adi/max32666fthr/doc/index.rst index 76ee9a6288eec..1cd8a999de1c5 100644 --- a/boards/adi/max32666fthr/doc/index.rst +++ b/boards/adi/max32666fthr/doc/index.rst @@ -1,7 +1,4 @@ -.. _max32666_fthr: - -MAX32666FTHR -############ +.. zephyr:board:: max32666fthr Overview ******** diff --git a/boards/adi/max32670evkit/doc/index.rst b/boards/adi/max32670evkit/doc/index.rst index 063094b620693..a5b10ef8d9ee1 100644 --- a/boards/adi/max32670evkit/doc/index.rst +++ b/boards/adi/max32670evkit/doc/index.rst @@ -1,7 +1,4 @@ -.. _max32670_evkit: - -MAX32670EVKIT -############# +.. zephyr:board:: max32670evkit Overview ******** @@ -15,10 +12,6 @@ from 8-bit or 16-bit microcontrollers. The Zephyr port is running on the MAX32670 MCU. -.. image:: img/max32670evkit.webp - :align: center - :alt: MAX32670 EVKIT - Hardware ******** diff --git a/boards/adi/max32672evkit/doc/index.rst b/boards/adi/max32672evkit/doc/index.rst index 26d1967cfef9f..c706898a353e8 100644 --- a/boards/adi/max32672evkit/doc/index.rst +++ b/boards/adi/max32672evkit/doc/index.rst @@ -1,7 +1,4 @@ -.. _max32672_evkit: - -MAX32672EVKIT -############# +.. zephyr:board:: max32672evkit Overview ******** @@ -13,10 +10,6 @@ designs an easy, cost-optimal upgrade path from 8-bit or 16-bit microcontrollers The Zephyr port is running on the MAX32672 MCU. -.. image:: img/max32672evkit.webp - :align: center - :alt: MAX32672EVKIT - Hardware ******** diff --git a/boards/adi/max32672fthr/doc/index.rst b/boards/adi/max32672fthr/doc/index.rst index 5e6004de00d18..76033bf97ecf6 100644 --- a/boards/adi/max32672fthr/doc/index.rst +++ b/boards/adi/max32672fthr/doc/index.rst @@ -1,7 +1,4 @@ -.. _max32672_fthr: - -MAX32672FTHR -############ +.. zephyr:board:: max32672fthr Overview ******** diff --git a/boards/adi/max32675evkit/doc/index.rst b/boards/adi/max32675evkit/doc/index.rst index f1eb98a0c7ab0..a9de574eb21ee 100644 --- a/boards/adi/max32675evkit/doc/index.rst +++ b/boards/adi/max32675evkit/doc/index.rst @@ -1,7 +1,4 @@ -.. _max32675_evkit: - -MAX32675EVKIT -############# +.. zephyr:board:: max32675evkit Overview ******** @@ -13,10 +10,6 @@ industrial sensors for configuration and diagnostics. The Zephyr port is running on the MAX32675 MCU. -.. image:: img/max32675evkit.webp - :align: center - :alt: MAX32675EVKIT - Hardware ******** diff --git a/boards/adi/max32680evkit/doc/index.rst b/boards/adi/max32680evkit/doc/index.rst index a006091435673..13c6d7d06b603 100644 --- a/boards/adi/max32680evkit/doc/index.rst +++ b/boards/adi/max32680evkit/doc/index.rst @@ -1,7 +1,4 @@ -.. _max32680_evkit: - -MAX32680EVKIT -############# +.. zephyr:board:: max32680evkit Overview ******** @@ -17,11 +14,6 @@ the latest generation Bluetooth® 5.2 Low Energy The Zephyr port is running on the MAX32680 MCU. -.. image:: img/max32680evkit_img1.jpg - :align: center - :alt: MAX32680 EVKIT - - Hardware ******** diff --git a/boards/adi/max32690evkit/doc/img/max32690evkit_img1.jpg b/boards/adi/max32690evkit/doc/img/max32690evkit.jpg similarity index 100% rename from boards/adi/max32690evkit/doc/img/max32690evkit_img1.jpg rename to boards/adi/max32690evkit/doc/img/max32690evkit.jpg diff --git a/boards/adi/max32690evkit/doc/index.rst b/boards/adi/max32690evkit/doc/index.rst index 8d2ffba10ae12..d976048dcb6de 100644 --- a/boards/adi/max32690evkit/doc/index.rst +++ b/boards/adi/max32690evkit/doc/index.rst @@ -1,7 +1,4 @@ -.. _max32690_evkit: - -MAX32690EVKIT -############# +.. zephyr:board:: max32690evkit Overview ******** @@ -14,7 +11,7 @@ industrial sensors/networks, internet of things (IoT), and asset tracking. The Zephyr port is running on the MAX32690 MCU. -.. image:: img/max32690evkit_img1.jpg +.. image:: img/max32690evkit.jpg :align: center :alt: MAX32690 EVKIT Front diff --git a/boards/adi/max32690fthr/doc/index.rst b/boards/adi/max32690fthr/doc/index.rst index 8a8b3b45beb4d..fdce08e32e866 100644 --- a/boards/adi/max32690fthr/doc/index.rst +++ b/boards/adi/max32690fthr/doc/index.rst @@ -1,7 +1,4 @@ -.. _max32690_fthr: - -MAX32690FTHR -############ +.. zephyr:board:: max32690fthr Overview ******** diff --git a/boards/adi/sdp_k1/doc/index.rst b/boards/adi/sdp_k1/doc/index.rst index 0b23797da6bb5..680852f53dd91 100644 --- a/boards/adi/sdp_k1/doc/index.rst +++ b/boards/adi/sdp_k1/doc/index.rst @@ -1,7 +1,4 @@ -.. _adi_sdp_k1: - -ADI SDP-K1 -########## +.. zephyr:board:: adi_sdp_k1 Overview ******** @@ -24,12 +21,6 @@ ADI components. - 16MB SDRAM - Arduino UNO and 120-pin SDP connectors -.. figure:: img/adi_sdp_k1.webp - :align: center - :alt: ADI SDP-K1 - - ADI SDP-K1 (Credit: Analog Devices, Inc.) - More information about the board can be found on the `ADI SDP-K1 website`_. Hardware diff --git a/doc/releases/release-notes-3.7.rst b/doc/releases/release-notes-3.7.rst index 8519e0a250acf..b868d38b1a876 100644 --- a/doc/releases/release-notes-3.7.rst +++ b/doc/releases/release-notes-3.7.rst @@ -422,14 +422,14 @@ Boards & SoC Support * Added support for :ref:`ST STEVAL STWINBX1 Development kit `: ``steval_stwinbx1``. * Added support for NXP boards: ``frdm_mcxn947``, ``ke17z512``, ``rd_rw612_bga``, ``frdm_rw612``, ``frdm_ke15z``, ``frdm_ke17z`` * Added support for :ref:`Synopsys ARC-V RMX1xx nSIM-based simulation platform `: ``nsim_arc_v/rmx100``. - * Added support for :ref:`Analog Devices MAX32690EVKIT `: ``max32690evkit``. - * Added support for :ref:`Analog Devices MAX32680EVKIT `: ``max32680evkit``. - * Added support for :ref:`Analog Devices MAX32672EVKIT `: ``max32672evkit``. - * Added support for :ref:`Analog Devices MAX32672FTHR `: ``max32672fthr``. - * Added support for :ref:`Analog Devices MAX32670EVKIT `: ``max32670evkit``. - * Added support for :ref:`Analog Devices MAX32655EVKIT `: ``max32655evkit``. - * Added support for :ref:`Analog Devices MAX32655FTHR `: ``max32655fthr``. - * Added support for :ref:`Analog Devices AD-APARD32690-SL `: ``ad_apard32690_sl``. + * Added support for :zephyr:board:`Analog Devices MAX32690EVKIT `: ``max32690evkit``. + * Added support for :zephyr:board:`Analog Devices MAX32680EVKIT `: ``max32680evkit``. + * Added support for :zephyr:board:`Analog Devices MAX32672EVKIT `: ``max32672evkit``. + * Added support for :zephyr:board:`Analog Devices MAX32672FTHR `: ``max32672fthr``. + * Added support for :zephyr:board:`Analog Devices MAX32670EVKIT `: ``max32670evkit``. + * Added support for :zephyr:board:`Analog Devices MAX32655EVKIT `: ``max32655evkit``. + * Added support for :zephyr:board:`Analog Devices MAX32655FTHR `: ``max32655fthr``. + * Added support for :zephyr:board:`Analog Devices AD-APARD32690-SL `: ``ad_apard32690_sl``. * Added support for :ref:`Infineon Technologies CYW920829M2EVK-02 `: ``cyw920829m2evk_02``. * Added support for :ref:`Nuvoton Numaker M2L31KI board `: ``numaker_m2l31ki``. * Added support for :ref:`Espressif ESP32-S2 DevKit-C `: ``esp32s2_devkitc``. From 05c4c7abff56a0c99717f09a0d7f057f43359dc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 12:20:28 +0200 Subject: [PATCH 1548/4482] boards: alientek: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Alientek boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/alientek/pandora_stm32l475/doc/index.rst | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/boards/alientek/pandora_stm32l475/doc/index.rst b/boards/alientek/pandora_stm32l475/doc/index.rst index 082c814914af9..d976ee7740f17 100644 --- a/boards/alientek/pandora_stm32l475/doc/index.rst +++ b/boards/alientek/pandora_stm32l475/doc/index.rst @@ -1,7 +1,4 @@ -.. _pandora_stm32l475_board: - -Alientek STM32L475 Pandora -########################## +.. zephyr:board:: pandora_stm32l475 Overview ******** @@ -28,15 +25,12 @@ some highlights of the STM32L475 Pandora board: - MCU current ammeter with 4 ranges and auto-calibration - Connector for external board or RF-EEPROM - Four power supply options: + - ST-LINK/V2-1 - USB FS connector - External 5 V - CR2032 battery (not provided) -.. image:: img/pandora_stm32l475.jpg - :align: center - :alt: STM32L475 Pandora - More information about the board can be found at the `STM32L475 Pandora website`_. Hardware From 9c6bd0ee8628c6e5c80bfda5528524b29c06316d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 12:24:29 +0200 Subject: [PATCH 1549/4482] boards: altr: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Altera boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/altr/max10/doc/index.rst | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/boards/altr/max10/doc/index.rst b/boards/altr/max10/doc/index.rst index 0ff861b4f83bc..0c16aa329e8e6 100644 --- a/boards/altr/max10/doc/index.rst +++ b/boards/altr/max10/doc/index.rst @@ -1,21 +1,11 @@ -.. _altera_max10: - -Altera MAX10 -############ +.. zephyr:board:: altera_max10 Overview ******** - The Zephyr kernel is supported on the Altera MAX10 Rev C development kit, using the Nios II Gen 2 soft CPU. -.. figure:: img/altera_max10.jpg - :align: center - :alt: Altera's MAX* 10 - - Altera's MAX* 10 (Credit: Altera) - Hardware ******** From 0a5b7609341e41262207c2ee12f97295d384ec7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 12:27:07 +0200 Subject: [PATCH 1550/4482] boards: ambiq: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Ambiq boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/ambiq/apollo3_evb/doc/index.rst | 9 +-------- boards/ambiq/apollo3p_evb/doc/index.rst | 9 +-------- boards/ambiq/apollo4p_blue_kxr_evb/doc/index.rst | 9 +-------- boards/ambiq/apollo4p_evb/doc/index.rst | 9 +-------- doc/releases/release-notes-3.7.rst | 4 ++-- 5 files changed, 6 insertions(+), 34 deletions(-) diff --git a/boards/ambiq/apollo3_evb/doc/index.rst b/boards/ambiq/apollo3_evb/doc/index.rst index 570e1d54d4564..429d973d37810 100644 --- a/boards/ambiq/apollo3_evb/doc/index.rst +++ b/boards/ambiq/apollo3_evb/doc/index.rst @@ -1,14 +1,7 @@ -.. _apollo3_evb: - -Ambiq Apollo3 Blue EVB -###################### +.. zephyr:board:: apollo3_evb Apollo3 Blue EVB is a board by Ambiq featuring their ultra-low power Apollo3 Blue SoC. -.. image:: ./apollo3-blue-soc-eval-board.jpg - :align: center - :alt: Apollo3 Blue EVB - Hardware ******** diff --git a/boards/ambiq/apollo3p_evb/doc/index.rst b/boards/ambiq/apollo3p_evb/doc/index.rst index c06f3b1e168fa..a5f848c4f2c2d 100644 --- a/boards/ambiq/apollo3p_evb/doc/index.rst +++ b/boards/ambiq/apollo3p_evb/doc/index.rst @@ -1,14 +1,7 @@ -.. _apollo3p_evb: - -Ambiq Apollo3 Blue Plus EVB -########################### +.. zephyr:board:: apollo3p_evb Apollo3 Blue Plus EVB is a board by Ambiq featuring their ultra-low power Apollo3 Blue Plus SoC. -.. image:: ./apollo3-blue-plus-soc-eval-board.jpg - :align: center - :alt: Apollo3 Blue Plus EVB - Hardware ******** diff --git a/boards/ambiq/apollo4p_blue_kxr_evb/doc/index.rst b/boards/ambiq/apollo4p_blue_kxr_evb/doc/index.rst index 3a1876297d2ef..81158fba6dbf9 100644 --- a/boards/ambiq/apollo4p_blue_kxr_evb/doc/index.rst +++ b/boards/ambiq/apollo4p_blue_kxr_evb/doc/index.rst @@ -1,14 +1,7 @@ -.. _apollo4p_blue_kxr_evb: - -Ambiq Apollo4 Blue Plus KXR EVB -############################### +.. zephyr:board:: apollo4p_blue_kxr_evb Apollo4 Blue Plus KXR EVB is a board by Ambiq featuring their ultra-low power Apollo4 Blue Plus SoC. -.. image:: ./apollo4-blue-plus-kxr-soc-eval-board.jpg - :align: center - :alt: Apollo4 Blue Plus KXR EVB - Hardware ******** diff --git a/boards/ambiq/apollo4p_evb/doc/index.rst b/boards/ambiq/apollo4p_evb/doc/index.rst index fef698b0a1b2b..d2cc43e5bb41a 100644 --- a/boards/ambiq/apollo4p_evb/doc/index.rst +++ b/boards/ambiq/apollo4p_evb/doc/index.rst @@ -1,14 +1,7 @@ -.. _apollo4p_evb: - -Ambiq Apollo4P EVB -################## +.. zephyr:board:: apollo4p_evb Apollo4P EVB is a board by Ambiq featuring their ultra-low power Apollo4 Plus SoC. -.. image:: ./apollo4-plus-soc-eval-board.jpg - :align: center - :alt: Apollo4P EVB - Hardware ******** diff --git a/doc/releases/release-notes-3.7.rst b/doc/releases/release-notes-3.7.rst index b868d38b1a876..5c21c1e9e845a 100644 --- a/doc/releases/release-notes-3.7.rst +++ b/doc/releases/release-notes-3.7.rst @@ -407,8 +407,8 @@ Boards & SoC Support * Added support for these boards: - * Added support for :ref:`Ambiq Apollo3 Blue board `: ``apollo3_evb``. - * Added support for :ref:`Ambiq Apollo3 Blue Plus board `: ``apollo3p_evb``. + * Added support for :zephyr:board:`Ambiq Apollo3 Blue board `: ``apollo3_evb``. + * Added support for :zephyr:board:`Ambiq Apollo3 Blue Plus board `: ``apollo3p_evb``. * Added support for :ref:`Raspberry Pi 5 board `: ``rpi_5``. * Added support for :zephyr:board:`Seeed Studio XIAO RP2040 board `: ``xiao_rp2040``. * Added support for :ref:`Mikroe RA4M1 Clicker board `: ``mikroe_clicker_ra4m1``. From 02974bd2bbf8e73eb627fdc47ac27051144a7e15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 12:28:30 +0200 Subject: [PATCH 1551/4482] boards: amd: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the AMD boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/amd/kv260_r5/doc/index.rst | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/boards/amd/kv260_r5/doc/index.rst b/boards/amd/kv260_r5/doc/index.rst index ee1e04f2a7ea1..9383dbd9df616 100644 --- a/boards/amd/kv260_r5/doc/index.rst +++ b/boards/amd/kv260_r5/doc/index.rst @@ -1,7 +1,4 @@ -.. _kv260_r5: - -Xilinx KV260 Development Board RPU Cortex-R5 -############################################ +.. zephyr:board:: kv260_r5 Overview ******** @@ -17,10 +14,6 @@ This processing unit is based on an ARM Cortex-R5 CPU, it also enables the follo * Xilinx Zynq TTC (Cadence TTC) * Xilinx Zynq UART -.. figure:: kv260-starter-kit.jpg - :align: center - :alt: Xilinx KV260 Starter Kit - Hardware ******** Supported Features From c357d01aabc2c3c80a893a57ec552c20acdfe24e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 12:36:56 +0200 Subject: [PATCH 1552/4482] boards: aspeed: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Aspeed boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/aspeed/ast1030_evb/doc/index.rst | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/boards/aspeed/ast1030_evb/doc/index.rst b/boards/aspeed/ast1030_evb/doc/index.rst index fb7d83d074bd2..1c23d7d2644ff 100644 --- a/boards/aspeed/ast1030_evb/doc/index.rst +++ b/boards/aspeed/ast1030_evb/doc/index.rst @@ -1,7 +1,4 @@ -.. _ast1030_evb: - -AST1030_EVB -################### +.. zephyr:board:: ast1030_evb Overview ******** @@ -10,10 +7,6 @@ The AST1030_EVB kit is a development platform to evaluate the Aspeed AST10x0 series SOCs. This board needs to be mated with part number AST1030. -.. image:: ast1030_evb.jpg - :align: center - :alt: AST1030 Evaluation Board - Hardware ******** From 233d264e533058eb9ff7a5ee04261a834425cdd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 12:37:33 +0200 Subject: [PATCH 1553/4482] boards: atmarktechno: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Atmark boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/atmarktechno/degu_evk/doc/index.rst | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/boards/atmarktechno/degu_evk/doc/index.rst b/boards/atmarktechno/degu_evk/doc/index.rst index a252c4273e898..a41ff1238e388 100644 --- a/boards/atmarktechno/degu_evk/doc/index.rst +++ b/boards/atmarktechno/degu_evk/doc/index.rst @@ -1,7 +1,4 @@ -.. _degu_evk: - -Degu Evaluation Kit -#################### +.. zephyr:board:: degu_evk The Degu Evaluation Kit is an IoT device for sensors and actuators and can connect to an OpenThread mesh network. The Kit has a @@ -9,6 +6,4 @@ Nordic nRF52840 SoC and NXP A71CH Secure Element, and can connect some Seeed Grove sensors via GPIO, ADC, I2C, and UART. -.. figure:: img/degu_evk.jpg - For more information, see the `Degu Project website `__. From aaccb6323f955aa2ed422b174b22d2a9d3e685d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 12:38:17 +0200 Subject: [PATCH 1554/4482] boards: bbc: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the BBC boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/bbc/microbit/doc/index.rst | 11 +---------- boards/bbc/microbit_v2/doc/index.rst | 11 +---------- samples/basic/servo_motor/README.rst | 2 +- samples/boards/nordic/nrf_led_matrix/README.rst | 2 +- samples/sensor/fxos8700/README.rst | 2 +- 5 files changed, 5 insertions(+), 23 deletions(-) diff --git a/boards/bbc/microbit/doc/index.rst b/boards/bbc/microbit/doc/index.rst index c4d11f7a6717c..1d829d89a89ae 100644 --- a/boards/bbc/microbit/doc/index.rst +++ b/boards/bbc/microbit/doc/index.rst @@ -1,7 +1,4 @@ -.. _bbc_microbit: - -BBC MicroBit -############## +.. zephyr:board:: bbc_microbit Overview ******** @@ -23,12 +20,6 @@ connectors that are part of the 23-pin edge connector. * FLASH * RADIO (Bluetooth Low Energy) -.. figure:: img/bbc_microbit.jpg - :align: center - :alt: BBC Micro Bit - - BBC Micro Bit (Credit: http://microbit.org/) - More information about the board can be found at the `microbit website`_. Hardware diff --git a/boards/bbc/microbit_v2/doc/index.rst b/boards/bbc/microbit_v2/doc/index.rst index d906f13660b30..62c3cee2252c3 100644 --- a/boards/bbc/microbit_v2/doc/index.rst +++ b/boards/bbc/microbit_v2/doc/index.rst @@ -1,7 +1,4 @@ -.. _bbc_microbit_v2: - -BBC MicroBit V2 -################# +.. zephyr:board:: bbc_microbit_v2 Overview ******** @@ -16,12 +13,6 @@ magnetometer sensors, Bluetooth and USB connectivity, a display consisting of USB or an external battery pack. The device inputs and outputs are through five ring connectors that are part of the 23-pin edge connector. -.. figure:: img/bbc_microbit2.jpg - :align: center - :alt: BBC Micro Bit V2 - - BBC Micro Bit V2 (Credit: http://microbit.org/) - More information about the board can be found at the `microbit website`_. Hardware diff --git a/samples/basic/servo_motor/README.rst b/samples/basic/servo_motor/README.rst index e4f2e494196c3..4726a7ad18838 100644 --- a/samples/basic/servo_motor/README.rst +++ b/samples/basic/servo_motor/README.rst @@ -52,7 +52,7 @@ ground and the white wire to the SCL pin, i.e. pin P19 on the edge connector. Building and Running ******************** -The sample has a devicetree overlay for the :ref:`bbc_microbit`. +The sample has a devicetree overlay for the :zephyr:board:`bbc_microbit`. This sample can be built for multiple boards, in this example we will build it for the bbc_microbit board: diff --git a/samples/boards/nordic/nrf_led_matrix/README.rst b/samples/boards/nordic/nrf_led_matrix/README.rst index f7a0c829cb9e4..9cf33b6d13c01 100644 --- a/samples/boards/nordic/nrf_led_matrix/README.rst +++ b/samples/boards/nordic/nrf_led_matrix/README.rst @@ -8,7 +8,7 @@ Overview This is a simple application intended to present the nRF LED matrix display driver in action and to serve as a test ensuring that this driver is buildable -for both the :ref:`bbc_microbit_v2` and :ref:`bbc_microbit` boards. +for both the :zephyr:board:`bbc_microbit_v2` and :zephyr:board:`bbc_microbit` boards. Requirements ************ diff --git a/samples/sensor/fxos8700/README.rst b/samples/sensor/fxos8700/README.rst index 505952cec6ae5..52b8a96a33ec5 100644 --- a/samples/sensor/fxos8700/README.rst +++ b/samples/sensor/fxos8700/README.rst @@ -18,7 +18,7 @@ This project outputs sensor data to the console. FXOS8700 sensor is present on the :ref:`frdm_k64f`, :ref:`frdm_k22f`, :ref:`frdm_kw41z`, :ref:`hexiwear`, and :ref:`twr_ke18f` boards. Accelerometer only devices are present on the :ref:`frdm_kl25z`, -:ref:`bbc_microbit`, and :ref:`reel_board` boards. It does not work on +:zephyr:board:`bbc_microbit`, and :ref:`reel_board` boards. It does not work on QEMU. Building and Running for FRDM-K64F From 2e83e295b059549e57ca53b9517edb5ece9d7ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 15:38:37 +0200 Subject: [PATCH 1555/4482] boards: beagle: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the BeagleBoard boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/beagle/beaglebone_ai64/board.yml | 1 + .../assets/{bbai_64.webp => beaglebone_ai_64.webp} | Bin boards/beagle/beaglebone_ai64/doc/index.rst | 10 +--------- boards/beagle/beagleconnect_freedom/doc/index.rst | 13 +------------ .../beagle/beagleplay/doc/beagleplay_cc1352p7.rst | 13 +------------ boards/beagle/beaglev_fire/doc/index.rst | 9 +-------- doc/releases/release-notes-3.7.rst | 4 ++-- 7 files changed, 7 insertions(+), 43 deletions(-) rename boards/beagle/beaglebone_ai64/doc/assets/{bbai_64.webp => beaglebone_ai_64.webp} (100%) diff --git a/boards/beagle/beaglebone_ai64/board.yml b/boards/beagle/beaglebone_ai64/board.yml index f16d9a2d2487b..e81db526dd5ce 100644 --- a/boards/beagle/beaglebone_ai64/board.yml +++ b/boards/beagle/beaglebone_ai64/board.yml @@ -1,5 +1,6 @@ board: name: beaglebone_ai64 + full_name: BeagleBone AI-64 vendor: beagle socs: - name: j721e diff --git a/boards/beagle/beaglebone_ai64/doc/assets/bbai_64.webp b/boards/beagle/beaglebone_ai64/doc/assets/beaglebone_ai_64.webp similarity index 100% rename from boards/beagle/beaglebone_ai64/doc/assets/bbai_64.webp rename to boards/beagle/beaglebone_ai64/doc/assets/beaglebone_ai_64.webp diff --git a/boards/beagle/beaglebone_ai64/doc/index.rst b/boards/beagle/beaglebone_ai64/doc/index.rst index b5c69a818f305..d54775011dbd5 100644 --- a/boards/beagle/beaglebone_ai64/doc/index.rst +++ b/boards/beagle/beaglebone_ai64/doc/index.rst @@ -1,7 +1,4 @@ -.. _beaglebone_ai64: - -BeagleBone AI-64 -################ +.. zephyr:board:: beaglebone_ai64 Overview ******** @@ -9,11 +6,6 @@ Overview BeagleBone AI-64 is a computational platform powered by TI J721E SoC, which is targeted for automotive applications. -.. figure:: assets/bbai_64.webp - :align: center - :width: 600px - :alt: BeagleBoard.org BeagleBone AI-64 - Hardware ******** diff --git a/boards/beagle/beagleconnect_freedom/doc/index.rst b/boards/beagle/beagleconnect_freedom/doc/index.rst index f9b980c1f3041..8bf3bf4e6e60d 100644 --- a/boards/beagle/beagleconnect_freedom/doc/index.rst +++ b/boards/beagle/beagleconnect_freedom/doc/index.rst @@ -1,7 +1,4 @@ -.. _beagleconnect_freedom: - -BeagleConnect Freedom -##################### +.. zephyr:board:: beagleconnect_freedom Overview ******** @@ -9,14 +6,6 @@ Overview BeagleBoard.org BeagleConnect Freedom is a wireless Internet of Things board based on the SimpleLink multi-Standard CC1352P7 wireless MCU. - -.. figure:: img/beagleconnect_freedom.webp - :align: center - :width: 500px - :alt: BeagleBoard.org BeagleConnect Freedom - - BeagleBoard.org BeagleConnect Freedom - Hardware ******** BeagleBoard.org BeagleConnect Freedom board features the TI CC1352P7 wireless microcontroller. diff --git a/boards/beagle/beagleplay/doc/beagleplay_cc1352p7.rst b/boards/beagle/beagleplay/doc/beagleplay_cc1352p7.rst index fc36f0ce430d0..24665eafce18e 100644 --- a/boards/beagle/beagleplay/doc/beagleplay_cc1352p7.rst +++ b/boards/beagle/beagleplay/doc/beagleplay_cc1352p7.rst @@ -1,7 +1,4 @@ -.. _beagleplay_cc1352p7: - -BeaglePlay (CC1352) -################### +.. zephyr:board:: beagleplay Overview ******** @@ -10,14 +7,6 @@ BeagleBoard.org BeaglePlay is an open hardware single board computer based on a quad-core ARM Cortex-A53 SoC with an external TI SimpleLink multi-standard CC1352P7 wireless MCU providing long-range, low-power connectivity. - -.. figure:: img/beagle_play.webp - :align: center - :width: 500px - :alt: BeagleBoard.org BeaglePlay - - BeagleBoard.org BeaglePlay - Hardware ******** diff --git a/boards/beagle/beaglev_fire/doc/index.rst b/boards/beagle/beaglev_fire/doc/index.rst index 23d63f4db7a7f..e5e28f8cf727a 100644 --- a/boards/beagle/beaglev_fire/doc/index.rst +++ b/boards/beagle/beaglev_fire/doc/index.rst @@ -1,7 +1,4 @@ -.. _beaglev_fire: - -BeagleV®-Fire -############# +.. zephyr:board:: beaglev_fire Overview ******** @@ -15,10 +12,6 @@ Built around the powerful and energy-efficient RISC-V instruction set architectu its versatile FPGA fabric, BeagleV®-Fire SBC offers unparalleled opportunities for developers, hobbyists, and researchers to explore and experiment with RISC-V technology. -.. image:: img/BeagleV-Fire-Front-Annotated-768x432.webp - :align: center - :alt: beaglev_fire - Building ======== diff --git a/doc/releases/release-notes-3.7.rst b/doc/releases/release-notes-3.7.rst index 5c21c1e9e845a..a71bc2a4d1f08 100644 --- a/doc/releases/release-notes-3.7.rst +++ b/doc/releases/release-notes-3.7.rst @@ -455,7 +455,7 @@ Boards & SoC Support * nRF54H20 PDK (pre-release) converted to :ref:`nrf54h20dk_nrf54h20` * PPR core target in :ref:`nrf54h20dk_nrf54h20` runs from RAM by default. A new ``xip`` variant has been introduced which runs from MRAM (XIP). - * Refactored :ref:`beagleconnect_freedom` external antenna switch handling. + * Refactored :zephyr:board:`beagleconnect_freedom` external antenna switch handling. * Added Arduino dts node labels for the nRF5340 Audio DK. * Changed the default revision of the nRF54L15 PDK from 0.2.1 to 0.3.0. * In boards based on the nRF5340 SoC, replaced direct accesses to the register @@ -1048,7 +1048,7 @@ Drivers and Sensors * Added a Add QTMR PWM driver for NXP imxrt11xx * Made the NXP MCUX PWM driver thread safe * Fix :zephyr:code-sample:`pwm-blinky` code sample to demonstrate PWM support for - :ref:`beagleconnect_freedom`. + :zephyr:board:`beagleconnect_freedom`. * Added driver for ENE KB1200. * Added support for Nordic nRF54H and nRF54L Series SoCs. * Added support for Nuvoton Numaker M2L31X series. From 3d8271f32857d24567d5dd113ae4c71676018f9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 15:39:01 +0200 Subject: [PATCH 1556/4482] boards: blues: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Blues boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/blues/swan_r5/doc/index.rst | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/boards/blues/swan_r5/doc/index.rst b/boards/blues/swan_r5/doc/index.rst index e29510d93d964..51212bd4c6420 100644 --- a/boards/blues/swan_r5/doc/index.rst +++ b/boards/blues/swan_r5/doc/index.rst @@ -1,7 +1,4 @@ -.. _swan_r5_board: - -Blues Wireless Swan -################### +.. zephyr:board:: swan_r5 Overview ******** @@ -53,10 +50,6 @@ some highlights of the board: - 12-bit ADC, 2 x 12-bit DAC - low-power RTC, and CRC calculation peripherals -.. image:: img/swan.jpg - :align: center - :alt: Blues Wireless Swan - More information about the board can be found at the `Swan Product Page`_. Hardware From 1a9568a22c15b7e7e5b071fa062f0dcb5a839a89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 15:39:51 +0200 Subject: [PATCH 1557/4482] boards: dragino: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Dragino boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/dragino/lsn50/doc/index.rst | 9 +-------- boards/dragino/nbsn95/doc/index.rst | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/boards/dragino/lsn50/doc/index.rst b/boards/dragino/lsn50/doc/index.rst index 4a29c56af1d57..999c809a90f41 100644 --- a/boards/dragino/lsn50/doc/index.rst +++ b/boards/dragino/lsn50/doc/index.rst @@ -1,7 +1,4 @@ -.. _dragino_lsn50_board: - -Dragino LSN50 LoRA Sensor Node -############################## +.. zephyr:board:: dragino_lsn50 Overview ******** @@ -23,10 +20,6 @@ This kit provides: - GPIOs exposed via screw terminals on the carrier board - Housing -.. image:: img/dragino_lsn50.jpg - :align: center - :alt: Dragino LSN50 - More information about the board can be found at the `Dragino LSN50 website`_. Hardware diff --git a/boards/dragino/nbsn95/doc/index.rst b/boards/dragino/nbsn95/doc/index.rst index 27e32b7d06f5c..c18bb7eee4019 100644 --- a/boards/dragino/nbsn95/doc/index.rst +++ b/boards/dragino/nbsn95/doc/index.rst @@ -1,7 +1,4 @@ -.. _dragino_nbsn95_board: - -Dragino NBSN95 NB-IoT Sensor Node -################################# +.. zephyr:board:: dragino_nbsn95 Overview ******** @@ -22,10 +19,6 @@ This kit provides: - GPIOs exposed via screw terminals on the carrier board - Housing -.. image:: img/dragino_nbsn95.jpg - :align: center - :alt: Dragino NBSN95 - More information about the board can be found at the `Dragino NBSN95 website`_. Hardware From 4de10f353e611ff3c02dbc15ca9c031ef81aabca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 15:40:54 +0200 Subject: [PATCH 1558/4482] boards: efinix: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Efinix boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/efinix/titanium_ti60_f225/doc/index.rst | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/boards/efinix/titanium_ti60_f225/doc/index.rst b/boards/efinix/titanium_ti60_f225/doc/index.rst index 40338736308ed..ec193126434a8 100644 --- a/boards/efinix/titanium_ti60_f225/doc/index.rst +++ b/boards/efinix/titanium_ti60_f225/doc/index.rst @@ -1,7 +1,4 @@ -.. _titanium_ti60_f225: - -Efinix Titanium Ti60 F225 -######################### +.. zephyr:board:: titanium_ti60_f225 Overview ******** @@ -11,12 +8,6 @@ high performance with the lowest possible power on a small physical size. In add which is a user-configurable RISC-V SoC based on the VexRiscv core with configurable feature set and extension. Using the Efinity IP Manager, you can configure the SoC to include only the peripherals that you require. -.. figure:: img/titanium_ti60_f225.jpg - :align: center - :alt: titanium_ti60_f225_board - -Figure is the development board - Board block diagram ******************* From 1aa45f77d6261f540db513d840ee54be1ad600fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 15:41:36 +0200 Subject: [PATCH 1559/4482] boards: electronut: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Electronut boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/electronut/nrf52840_blip/doc/index.rst | 11 +---------- .../electronut/nrf52840_papyr/doc/nrf52840_papyr.rst | 11 +---------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/boards/electronut/nrf52840_blip/doc/index.rst b/boards/electronut/nrf52840_blip/doc/index.rst index 67a736bcd0639..03dfff0bf5666 100644 --- a/boards/electronut/nrf52840_blip/doc/index.rst +++ b/boards/electronut/nrf52840_blip/doc/index.rst @@ -1,7 +1,4 @@ -.. _nrf52840_blip: - -Electronut Labs Blip -#################### +.. zephyr:board:: nrf52840_blip Overview ******** @@ -25,12 +22,6 @@ nRF52840 ARM Cortex-M4F CPU and the following devices: * :abbr:`USB (Universal Serial Bus)` * :abbr:`WDT (Watchdog Timer)` -.. figure:: img/nrf52840_blip.jpg - :align: center - :alt: Electronut Labs Blip - - Electronut Labs Blip (Credit: Electronut Labs) - More information about the board is available at https://github.com/electronut/ElectronutLabs-blip. Hardware diff --git a/boards/electronut/nrf52840_papyr/doc/nrf52840_papyr.rst b/boards/electronut/nrf52840_papyr/doc/nrf52840_papyr.rst index 814ef88136091..391175eebc261 100644 --- a/boards/electronut/nrf52840_papyr/doc/nrf52840_papyr.rst +++ b/boards/electronut/nrf52840_papyr/doc/nrf52840_papyr.rst @@ -1,7 +1,4 @@ -.. _nrf52840_papyr: - -Electronut Labs Papyr -##################### +.. zephyr:board:: nrf52840_papyr Overview ******** @@ -27,12 +24,6 @@ the following devices: * :abbr:`WDT (Watchdog Timer)` * COUNTER -.. figure:: img/nrf52840_papyr.jpg - :align: center - :alt: Electronut Labs Papyr - - Electronut Labs Papyr (Credit: Electronut Labs) - More information about the board is available at https://gitlab.com/electronutlabs-public/papyr. Hardware From f0ec6ada1d3923b5c029e91bf080feed66938009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 17:13:38 +0200 Subject: [PATCH 1560/4482] boards: espressif: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Espressif boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/espressif/esp32_devkitc_wroom/doc/index.rst | 11 +---------- boards/espressif/esp32_devkitc_wrover/doc/index.rst | 11 +---------- boards/espressif/esp32_ethernet_kit/doc/index.rst | 12 +----------- boards/espressif/esp32c3_devkitc/doc/index.rst | 5 +---- boards/espressif/esp32c3_devkitm/doc/index.rst | 5 +---- boards/espressif/esp32c3_rust/doc/index.rst | 5 +---- boards/espressif/esp32c6_devkitc/doc/index.rst | 5 +---- boards/espressif/esp32s2_devkitc/doc/index.rst | 7 ++----- boards/espressif/esp32s2_saola/doc/index.rst | 5 +---- boards/espressif/esp32s3_devkitc/doc/index.rst | 5 +---- boards/espressif/esp32s3_devkitm/doc/index.rst | 5 +---- boards/espressif/esp32s3_eye/doc/index.rst | 9 +-------- boards/espressif/esp8684_devkitm/doc/index.rst | 5 +---- boards/espressif/esp_wrover_kit/doc/index.rst | 5 +---- doc/releases/release-notes-3.7.rst | 6 +++--- samples/basic/blinky_pwm/README.rst | 6 +++--- samples/boards/espressif/deep_sleep/README.rst | 2 +- samples/boards/espressif/wifi_apsta_mode/README.rst | 2 +- samples/subsys/display/lvgl/README.rst | 2 +- 19 files changed, 24 insertions(+), 89 deletions(-) diff --git a/boards/espressif/esp32_devkitc_wroom/doc/index.rst b/boards/espressif/esp32_devkitc_wroom/doc/index.rst index 0df38f0c40e54..228660a603aa7 100644 --- a/boards/espressif/esp32_devkitc_wroom/doc/index.rst +++ b/boards/espressif/esp32_devkitc_wroom/doc/index.rst @@ -1,7 +1,4 @@ -.. _esp32_devkitc_wroom: - -ESP32-DevKitC-WROOM -################### +.. zephyr:board:: esp32_devkitc_wroom Overview ******** @@ -41,12 +38,6 @@ The features include the following: - Cryptographic hardware acceleration (RNG, ECC, RSA, SHA-2, AES) - 5uA deep sleep current -.. figure:: img/esp32_devkitc_wroom.jpg - :align: center - :alt: ESP32-DevKitC-WROOM - - ESP32-DevKitC-WROOM-32D DK - For more information, check the datasheet at `ESP32 Datasheet`_ or the technical reference manual at `ESP32 Technical Reference Manual`_. diff --git a/boards/espressif/esp32_devkitc_wrover/doc/index.rst b/boards/espressif/esp32_devkitc_wrover/doc/index.rst index f1bd6172f14e2..cf1fb64f32f2c 100644 --- a/boards/espressif/esp32_devkitc_wrover/doc/index.rst +++ b/boards/espressif/esp32_devkitc_wrover/doc/index.rst @@ -1,7 +1,4 @@ -.. _esp32_devkitc_wrover: - -ESP32-DevKitC-WROVER -#################### +.. zephyr:board:: esp32_devkitc_wrover Overview ******** @@ -41,12 +38,6 @@ The features include the following: - Cryptographic hardware acceleration (RNG, ECC, RSA, SHA-2, AES) - 5uA deep sleep current -.. figure:: img/esp32_devkitc_wrover.jpg - :align: center - :alt: ESP32-DevKitC-WROVER - - ESP32-DevKitC-WROVER-IE - For more information, check the datasheet at `ESP32 Datasheet`_ or the technical reference manual at `ESP32 Technical Reference Manual`_. diff --git a/boards/espressif/esp32_ethernet_kit/doc/index.rst b/boards/espressif/esp32_ethernet_kit/doc/index.rst index 2884fbadb5a39..7233284d31413 100644 --- a/boards/espressif/esp32_ethernet_kit/doc/index.rst +++ b/boards/espressif/esp32_ethernet_kit/doc/index.rst @@ -1,7 +1,4 @@ -.. _esp32_ethernet_kit: - -ESP32-Ethernet-Kit -################## +.. zephyr:board:: esp32_ethernet_kit Overview ******** @@ -13,13 +10,6 @@ over Ethernet (PoE). .. _get-started-esp32-ethernet-kit-v1.2-overview: -.. figure:: img/esp32_ethernet_kit.jpg - :align: center - :alt: ESP32-Ethernet-Kit V1.2 - :figclass: align-center - - ESP32-Ethernet-Kit V1.2 Overview - ESP32-Ethernet-Kit is an ESP32-WROVER-E based development. For more information, check the datasheet at `ESP32-WROVER-E Datasheet`_. diff --git a/boards/espressif/esp32c3_devkitc/doc/index.rst b/boards/espressif/esp32c3_devkitc/doc/index.rst index cd24beaff37c8..a57d0be26235a 100644 --- a/boards/espressif/esp32c3_devkitc/doc/index.rst +++ b/boards/espressif/esp32c3_devkitc/doc/index.rst @@ -1,7 +1,4 @@ -.. _esp32c3_devkitc: - -ESP32-C3-DevKitC -################ +.. zephyr:board:: esp32c3_devkitc Overview ******** diff --git a/boards/espressif/esp32c3_devkitm/doc/index.rst b/boards/espressif/esp32c3_devkitm/doc/index.rst index 41bd0ecf11aea..24eb23bc7b8a7 100644 --- a/boards/espressif/esp32c3_devkitm/doc/index.rst +++ b/boards/espressif/esp32c3_devkitm/doc/index.rst @@ -1,7 +1,4 @@ -.. _esp32c3_devkitm: - -ESP32-C3-DevKitM -################ +.. zephyr:board:: esp32c3_devkitm Overview ******** diff --git a/boards/espressif/esp32c3_rust/doc/index.rst b/boards/espressif/esp32c3_rust/doc/index.rst index ed31773b796c2..a6f41a01866c6 100644 --- a/boards/espressif/esp32c3_rust/doc/index.rst +++ b/boards/espressif/esp32c3_rust/doc/index.rst @@ -1,7 +1,4 @@ -.. _esp32c3_rust: - -ESP32-C3-DevKit-RUST -#################### +.. zephyr:board:: esp32c3_rust Overview ******** diff --git a/boards/espressif/esp32c6_devkitc/doc/index.rst b/boards/espressif/esp32c6_devkitc/doc/index.rst index 3914c9e584384..5bae95abe8d83 100644 --- a/boards/espressif/esp32c6_devkitc/doc/index.rst +++ b/boards/espressif/esp32c6_devkitc/doc/index.rst @@ -1,7 +1,4 @@ -.. _esp32c6_devkitc: - -ESP32-C6-DevKitC -################ +.. zephyr:board:: esp32c6_devkitc Overview ******** diff --git a/boards/espressif/esp32s2_devkitc/doc/index.rst b/boards/espressif/esp32s2_devkitc/doc/index.rst index f1367429b9110..e5cb0ff6191dd 100644 --- a/boards/espressif/esp32s2_devkitc/doc/index.rst +++ b/boards/espressif/esp32s2_devkitc/doc/index.rst @@ -1,7 +1,4 @@ -.. _esp32s2_devkitc: - -ESP32-S2-DevKitC -################ +.. zephyr:board:: esp32s2_devkitc Overview ******** @@ -254,7 +251,7 @@ References .. target-notes:: -.. _`ESP32-S3-DevKitC`: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/hw-reference/esp32s2/user-guide-saola-1-v1.2.html +.. _`ESP32-S2-DevKitC`: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/hw-reference/esp32s2/user-guide-saola-1-v1.2.html .. _`ESP32-S2 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf .. _`ESP32-S2 Technical Reference Manual`: https://espressif.com/sites/default/files/documentation/esp32-s2_technical_reference_manual_en.pdf .. _`JTAG debugging for ESP32-S2`: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-guides/jtag-debugging/index.html diff --git a/boards/espressif/esp32s2_saola/doc/index.rst b/boards/espressif/esp32s2_saola/doc/index.rst index 78457ca36b2eb..a2ad776acfed5 100644 --- a/boards/espressif/esp32s2_saola/doc/index.rst +++ b/boards/espressif/esp32s2_saola/doc/index.rst @@ -1,7 +1,4 @@ -.. _esp32s2_saola: - -ESP32-S2-Saola -############## +.. zephyr:board:: esp32s2_saola Overview ******** diff --git a/boards/espressif/esp32s3_devkitc/doc/index.rst b/boards/espressif/esp32s3_devkitc/doc/index.rst index 5cf44e08df771..008b64fecae7e 100644 --- a/boards/espressif/esp32s3_devkitc/doc/index.rst +++ b/boards/espressif/esp32s3_devkitc/doc/index.rst @@ -1,7 +1,4 @@ -.. _esp32s3_devkitc: - -ESP32-S3-DevKitC -################ +.. zephyr:board:: esp32s3_devkitc Overview ******** diff --git a/boards/espressif/esp32s3_devkitm/doc/index.rst b/boards/espressif/esp32s3_devkitm/doc/index.rst index 9106f71ec08b3..ada774ec2a1e6 100644 --- a/boards/espressif/esp32s3_devkitm/doc/index.rst +++ b/boards/espressif/esp32s3_devkitm/doc/index.rst @@ -1,7 +1,4 @@ -.. _esp32s3_devkitm: - -ESP32-S3-DevKitM -################ +.. zephyr:board:: esp32s3_devkitm Overview ******** diff --git a/boards/espressif/esp32s3_eye/doc/index.rst b/boards/espressif/esp32s3_eye/doc/index.rst index bbe95728e94da..662c4e5199877 100644 --- a/boards/espressif/esp32s3_eye/doc/index.rst +++ b/boards/espressif/esp32s3_eye/doc/index.rst @@ -1,7 +1,4 @@ -.. _esp32s3_eye: - -ESP32-S3-EYE -############ +.. zephyr:board:: esp32s3_eye Overview ******** @@ -20,10 +17,6 @@ ESP32-S3-WROOM-1 module, camera, SD card slot, digital microphone, USB port, and and the sub board (ESP32-S3-EYE-SUB) that contains an LCD display. The main board and sub board are connected through pin headers. -.. figure:: img/ESP32-S3-EYE-isometric.webp - :align: center - :alt: ESP32-S3-EYE - Block Diagram ------------- diff --git a/boards/espressif/esp8684_devkitm/doc/index.rst b/boards/espressif/esp8684_devkitm/doc/index.rst index 68919d8f1e5ba..1b20435c586d0 100644 --- a/boards/espressif/esp8684_devkitm/doc/index.rst +++ b/boards/espressif/esp8684_devkitm/doc/index.rst @@ -1,7 +1,4 @@ -.. _esp8684_devkitm: - -ESP8684-DevKitM -############### +.. zephyr:board:: esp8684_devkitm Overview ******** diff --git a/boards/espressif/esp_wrover_kit/doc/index.rst b/boards/espressif/esp_wrover_kit/doc/index.rst index 326afb3246a5c..96f1c0570c2d8 100644 --- a/boards/espressif/esp_wrover_kit/doc/index.rst +++ b/boards/espressif/esp_wrover_kit/doc/index.rst @@ -1,7 +1,4 @@ -.. _esp_wrover_kit: - -ESP-WROVER-KIT -############## +.. zephyr:board:: esp_wrover_kit Overview ******** diff --git a/doc/releases/release-notes-3.7.rst b/doc/releases/release-notes-3.7.rst index a71bc2a4d1f08..b554c94007e4c 100644 --- a/doc/releases/release-notes-3.7.rst +++ b/doc/releases/release-notes-3.7.rst @@ -432,9 +432,9 @@ Boards & SoC Support * Added support for :zephyr:board:`Analog Devices AD-APARD32690-SL `: ``ad_apard32690_sl``. * Added support for :ref:`Infineon Technologies CYW920829M2EVK-02 `: ``cyw920829m2evk_02``. * Added support for :ref:`Nuvoton Numaker M2L31KI board `: ``numaker_m2l31ki``. - * Added support for :ref:`Espressif ESP32-S2 DevKit-C `: ``esp32s2_devkitc``. - * Added support for :ref:`Espressif ESP32-S3 DevKit-C `: ``esp32s3_devkitc``. - * Added support for :ref:`Espressif ESP32-C6 DevKit-C `: ``esp32c6_devkitc``. + * Added support for :zephyr:board:`Espressif ESP32-S2 DevKit-C `: ``esp32s2_devkitc``. + * Added support for :zephyr:board:`Espressif ESP32-S3 DevKit-C `: ``esp32s3_devkitc``. + * Added support for :zephyr:board:`Espressif ESP32-C6 DevKit-C `: ``esp32c6_devkitc``. * Added support for :ref:`Waveshare ESP32-S3-Touch-LCD-1.28 `: ``esp32s3_touch_lcd_1_28``. * Added support for :ref:`M5Stack ATOM Lite `: ``m5stack_atom_lite``. * Added support for :ref:`CTHINGS.CO Connectivity Card nRF52840 `: ``ctcc_nrf52840``. diff --git a/samples/basic/blinky_pwm/README.rst b/samples/basic/blinky_pwm/README.rst index 5999e9063b480..d8ec957b192f9 100644 --- a/samples/basic/blinky_pwm/README.rst +++ b/samples/basic/blinky_pwm/README.rst @@ -53,11 +53,11 @@ In these other cases, however, manual wiring is necessary: - connect PWM1 (PA8) to an LED * - :ref:`nucleo_wb55rg_board` - connect PWM1 (PA8) to an LED - * - :ref:`esp32_devkitc_wroom` + * - :zephyr:board:`esp32_devkitc_wroom` - connect GPIO2 to an LED - * - :ref:`esp32s2_saola` + * - :zephyr:board:`esp32s2_saola` - connect GPIO2 to an LED - * - :ref:`esp32c3_devkitm` + * - :zephyr:board:`esp32c3_devkitm` - connect GPIO2 to an LED Building and Running diff --git a/samples/boards/espressif/deep_sleep/README.rst b/samples/boards/espressif/deep_sleep/README.rst index 99ff112fcaf0e..8efe88759ac81 100644 --- a/samples/boards/espressif/deep_sleep/README.rst +++ b/samples/boards/espressif/deep_sleep/README.rst @@ -31,7 +31,7 @@ Requirements ************ This example should be able to run on any commonly available -:ref:`esp32_devkitc_wroom` development board without any extra hardware if +:zephyr:board:`esp32_devkitc_wroom` development board without any extra hardware if only ``Timer`` is used as wakeup source. However, when ``EXT1`` is also enabled, GPIO2 and GPIO4 should be pulled-down diff --git a/samples/boards/espressif/wifi_apsta_mode/README.rst b/samples/boards/espressif/wifi_apsta_mode/README.rst index cf0e5b193126b..e6c8ff65f357e 100644 --- a/samples/boards/espressif/wifi_apsta_mode/README.rst +++ b/samples/boards/espressif/wifi_apsta_mode/README.rst @@ -28,7 +28,7 @@ Requirements ************ This example should be able to run on any commonly available -:ref:`esp32_devkitc_wroom` development board without any extra hardware. +:zephyr:board:`esp32_devkitc_wroom` development board without any extra hardware. To enable or disable ``AP-STA`` mode, modify the :kconfig:option:`CONFIG_ESP32_WIFI_AP_STA_MODE` parameter in the ``boards/esp32_devkitc_wroom_procpu.conf`` file of the demo. Moreover, an diff --git a/samples/subsys/display/lvgl/README.rst b/samples/subsys/display/lvgl/README.rst index 7858e09409cc8..47862466535a8 100644 --- a/samples/subsys/display/lvgl/README.rst +++ b/samples/subsys/display/lvgl/README.rst @@ -45,7 +45,7 @@ for corresponding connectors, for example: or a board with an integrated display: -- :ref:`esp_wrover_kit` +- :zephyr:board:`esp_wrover_kit` or a simulated display environment in a :ref:`native_sim ` application: From 0ff3f0d36484e81af74eb15ac8a447c40908bfcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 17:21:17 +0200 Subject: [PATCH 1561/4482] boards: ezurio: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Ezurio boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/ezurio/bl5340_dvk/doc/index.rst | 11 +---------- boards/ezurio/bl652_dvk/doc/bl652_dvk.rst | 11 +---------- boards/ezurio/bl653_dvk/doc/bl653_dvk.rst | 11 +---------- boards/ezurio/bl654_dvk/doc/bl654_dvk.rst | 11 +---------- .../bl654_sensor_board/doc/bl654_sensor_board.rst | 11 +---------- boards/ezurio/bl654_usb/doc/bl654_usb.rst | 13 ++----------- boards/ezurio/bt510/doc/bt510.rst | 11 +---------- boards/ezurio/bt610/doc/bt610.rst | 11 +---------- .../bt610/doc/img/{bt610_front.jpg => bt610.jpg} | Bin boards/ezurio/mg100/doc/index.rst | 11 +---------- boards/ezurio/pinnacle_100_dvk/doc/index.rst | 11 +---------- .../doc/img/{RM186-DVK.jpg => rm1xx_dvk.jpg} | Bin boards/ezurio/rm1xx_dvk/doc/index.rst | 11 +---------- doc/hardware/porting/board_porting.rst | 4 ++-- doc/services/tfm/requirements.rst | 2 +- samples/drivers/dac/README.rst | 8 ++++---- samples/sensor/sm351lt/README.rst | 4 ++-- 17 files changed, 21 insertions(+), 120 deletions(-) rename boards/ezurio/bt610/doc/img/{bt610_front.jpg => bt610.jpg} (100%) rename boards/ezurio/rm1xx_dvk/doc/img/{RM186-DVK.jpg => rm1xx_dvk.jpg} (100%) diff --git a/boards/ezurio/bl5340_dvk/doc/index.rst b/boards/ezurio/bl5340_dvk/doc/index.rst index 62a7de87f934e..b19a0516c30d2 100644 --- a/boards/ezurio/bl5340_dvk/doc/index.rst +++ b/boards/ezurio/bl5340_dvk/doc/index.rst @@ -1,7 +1,4 @@ -.. _bl5340_dvk: - -Ezurio BL5340 DVK -################# +.. zephyr:board:: bl5340_dvk Overview ******** @@ -43,12 +40,6 @@ This development kit has the following features: * :abbr:`USB (Universal Serial Bus)` * :abbr:`WDT (Watchdog Timer)` -.. figure:: img/bl5340_dvk_top.jpg - :align: center - :alt: BL5340 DVK - - BL5340 DVK (Credit: Ezurio) - More information about the module can be found on the `BL5340 homepage`_. diff --git a/boards/ezurio/bl652_dvk/doc/bl652_dvk.rst b/boards/ezurio/bl652_dvk/doc/bl652_dvk.rst index aaae4b9071b34..27ec3f929288c 100644 --- a/boards/ezurio/bl652_dvk/doc/bl652_dvk.rst +++ b/boards/ezurio/bl652_dvk/doc/bl652_dvk.rst @@ -1,7 +1,4 @@ -.. _bl652_dvk: - -Ezurio BL652 DVK -################ +.. zephyr:board:: bl652_dvk Overview ******** @@ -31,12 +28,6 @@ Available BL652 DVK part numbers: * DVK-BL652-SA * DVK-BL652-SC -.. figure:: img/bl652_dvk.jpg - :align: center - :alt: BL652 DVK - - BL652 DVK Board - .. figure:: img/BL652-SA_DVK_BoxContents.jpg :align: center :alt: BL652-SA DVK Box Contents diff --git a/boards/ezurio/bl653_dvk/doc/bl653_dvk.rst b/boards/ezurio/bl653_dvk/doc/bl653_dvk.rst index 48c252b5ff9e1..e4de59757e853 100644 --- a/boards/ezurio/bl653_dvk/doc/bl653_dvk.rst +++ b/boards/ezurio/bl653_dvk/doc/bl653_dvk.rst @@ -1,7 +1,4 @@ -.. _bl653_dvk: - -Ezurio BL653 DVK -################ +.. zephyr:board:: bl653_dvk Overview ******** @@ -27,12 +24,6 @@ This development kit has the following features: * :abbr:`USB (Universal Serial Bus)` * :abbr:`WDT (Watchdog Timer)` -.. figure:: img/bl653_dvk.jpg - :align: center - :alt: BL653 Development Kit - - BL653 Development Kit Board - More information about the board can be found at the `BL653 website`_. diff --git a/boards/ezurio/bl654_dvk/doc/bl654_dvk.rst b/boards/ezurio/bl654_dvk/doc/bl654_dvk.rst index d262a9a5146ab..5a59932df25aa 100644 --- a/boards/ezurio/bl654_dvk/doc/bl654_dvk.rst +++ b/boards/ezurio/bl654_dvk/doc/bl654_dvk.rst @@ -1,7 +1,4 @@ -.. _bl654_dvk: - -Ezurio BL654 DVK -################ +.. zephyr:board:: bl654_dvk Overview ******** @@ -32,12 +29,6 @@ This development kit has the following features: * :abbr:`USB (Universal Serial Bus)` * :abbr:`WDT (Watchdog Timer)` -.. figure:: img/bl654_dvk.jpg - :align: center - :alt: BL654 Development Kit - - BL654 Development Kit Board - .. figure:: img/455-00001_BoxContents.jpg :align: center :alt: 455-00001 Box Contents diff --git a/boards/ezurio/bl654_sensor_board/doc/bl654_sensor_board.rst b/boards/ezurio/bl654_sensor_board/doc/bl654_sensor_board.rst index 32036e38ada8d..373e9bf1bdcbb 100644 --- a/boards/ezurio/bl654_sensor_board/doc/bl654_sensor_board.rst +++ b/boards/ezurio/bl654_sensor_board/doc/bl654_sensor_board.rst @@ -1,7 +1,4 @@ -.. _bl654_sensor_board: - -Ezurio BL654 Sensor Board -######################### +.. zephyr:board:: bl654_sensor_board Overview ******** @@ -27,12 +24,6 @@ This sensor board has the following features: * :abbr:`UART (Universal asynchronous receiver-transmitter)` * :abbr:`WDT (Watchdog Timer)` -.. figure:: img/bl654_sensor_board.jpg - :align: center - :alt: BL654 Sensor Board front and back - - BL654 Sensor Board front and back - .. figure:: img/bl654_sensor_board_usb_swd_programmer.jpg :align: center :alt: BL654 Sensor Board connected to USB-SWD Programmer (UART and SWD access) diff --git a/boards/ezurio/bl654_usb/doc/bl654_usb.rst b/boards/ezurio/bl654_usb/doc/bl654_usb.rst index c2ba1a2369855..345331890ec16 100644 --- a/boards/ezurio/bl654_usb/doc/bl654_usb.rst +++ b/boards/ezurio/bl654_usb/doc/bl654_usb.rst @@ -1,7 +1,4 @@ -.. _bl654_usb: - -Ezurio BL654 USB (451-00004) -############################ +.. zephyr:board:: bl654_usb Overview ******** @@ -23,12 +20,6 @@ This USB adapter has the following features: * :abbr:`WDT (Watchdog Timer)` * :abbr:`RTC (nRF RTC System Clock)` -.. figure:: img/bl654_usb.jpg - :align: center - :alt: BL654 USB adapter - - BL654 USB Adapter - .. figure:: img/bl654_usb_pcb.jpg :align: center :alt: 451-00004 Box Contents @@ -104,7 +95,7 @@ Programming and Debugging Applications for the ``bl654_usb`` board configuration can be built in the usual way (see :ref:`build_an_application` for more details). The ``bl654_usb`` board cannot be used for debugging. The compatible BL654 DVK -board can be used for development. Documentation can be found at the :ref:`bl654_dvk` +board can be used for development. Documentation can be found at the :zephyr:board:`bl654_dvk` site and :zephyr_file:`boards/ezurio/bl654_dvk/doc/bl654_dvk.rst` Flashing diff --git a/boards/ezurio/bt510/doc/bt510.rst b/boards/ezurio/bt510/doc/bt510.rst index bcdaf27226536..fdfd9312ffeb0 100644 --- a/boards/ezurio/bt510/doc/bt510.rst +++ b/boards/ezurio/bt510/doc/bt510.rst @@ -1,7 +1,4 @@ -.. _bt510: - -Ezurio Sentrius BT510 Sensor -############################ +.. zephyr:board:: bt510 Overview ******** @@ -24,12 +21,6 @@ The sensor has the following features: * :abbr:`UART (Universal Asynchronous Receiver-Transmitter)` * :abbr:`WDT (Watchdog Timer)` -.. figure:: img/bt510.jpg - :align: center - :alt: Sentrius BT510 Sensor, front view - - Sentrius BT510 Sensor, front view - .. figure:: img/bt510_back.jpg :align: center :alt: Sentrius BT510 Sensor, rear view diff --git a/boards/ezurio/bt610/doc/bt610.rst b/boards/ezurio/bt610/doc/bt610.rst index 528186ec88062..0ae62035a48b7 100644 --- a/boards/ezurio/bt610/doc/bt610.rst +++ b/boards/ezurio/bt610/doc/bt610.rst @@ -1,7 +1,4 @@ -.. _bt610: - -Ezurio Sentrius BT610 Sensor -############################ +.. zephyr:board:: bt610 Overview ******** @@ -28,12 +25,6 @@ The sensor has the following features: * :abbr:`UART (Universal Asynchronous Receiver-Transmitter)` * :abbr:`WDT (Watchdog Timer)` -.. figure:: img/bt610_front.jpg - :align: center - :alt: Sentrius BT610 Sensor, front view - - Sentrius BT610 Sensor, front view - .. figure:: img/bt610_back.jpg :align: center :alt: Sentrius BT610 Sensor, rear view diff --git a/boards/ezurio/bt610/doc/img/bt610_front.jpg b/boards/ezurio/bt610/doc/img/bt610.jpg similarity index 100% rename from boards/ezurio/bt610/doc/img/bt610_front.jpg rename to boards/ezurio/bt610/doc/img/bt610.jpg diff --git a/boards/ezurio/mg100/doc/index.rst b/boards/ezurio/mg100/doc/index.rst index 86b92c52abf14..5f66c65e1478c 100644 --- a/boards/ezurio/mg100/doc/index.rst +++ b/boards/ezurio/mg100/doc/index.rst @@ -1,7 +1,4 @@ -.. _mg100: - -Ezurio Sentrius™ MG100 Gateway -############################## +.. zephyr:board:: mg100 Overview ******** @@ -46,12 +43,6 @@ and the following devices: * :abbr:`HL7800 (Sierra Wireless HL7800 LTE-M1/NB-IoT modem)` * :abbr:`SD Card` -.. figure:: img/mg100.jpg - :align: center - :alt: MG100 - - MG100 (450-00054-K1) - Hardware ******** diff --git a/boards/ezurio/pinnacle_100_dvk/doc/index.rst b/boards/ezurio/pinnacle_100_dvk/doc/index.rst index 7b63ada033bd8..71511d8dfc815 100644 --- a/boards/ezurio/pinnacle_100_dvk/doc/index.rst +++ b/boards/ezurio/pinnacle_100_dvk/doc/index.rst @@ -1,7 +1,4 @@ -.. _pinnacle_100_dvk: - -Ezurio Pinnacle 100 DVK -####################### +.. zephyr:board:: pinnacle_100_dvk Overview ******** @@ -49,12 +46,6 @@ and the following devices: * :abbr:`BME680 (Bosch Sensortec BME680 environmental sensor)` * :abbr:`HL7800 (Sierra Wireless HL7800 LTE-M1/NB-IoT modem)` -.. figure:: img/pinnacle_100_dvk.jpg - :align: center - :alt: Pinnacle 100 DVK - - Pinnacle 100 DVK (453-00010-K1) - Hardware ******** diff --git a/boards/ezurio/rm1xx_dvk/doc/img/RM186-DVK.jpg b/boards/ezurio/rm1xx_dvk/doc/img/rm1xx_dvk.jpg similarity index 100% rename from boards/ezurio/rm1xx_dvk/doc/img/RM186-DVK.jpg rename to boards/ezurio/rm1xx_dvk/doc/img/rm1xx_dvk.jpg diff --git a/boards/ezurio/rm1xx_dvk/doc/index.rst b/boards/ezurio/rm1xx_dvk/doc/index.rst index bd57e8f400d07..8462f92c1b25a 100644 --- a/boards/ezurio/rm1xx_dvk/doc/index.rst +++ b/boards/ezurio/rm1xx_dvk/doc/index.rst @@ -1,7 +1,4 @@ -.. _rm1xx_dvk: - -Ezurio RM1xx DVK -################ +.. zephyr:board:: rm1xx_dvk Overview ******** @@ -28,12 +25,6 @@ This development kit has the following features: * :abbr:`UART (Universal asynchronous receiver-transmitter)` * :abbr:`WDT (Watchdog Timer)` -.. figure:: img/RM186-DVK.jpg - :align: center - :alt: RM1xx development kit (DVK) - - RM1xx development kit (DVK) (Credit: Ezurio) - .. figure:: img/RM186-SM.jpg :align: center :alt: RM1xx module diff --git a/doc/hardware/porting/board_porting.rst b/doc/hardware/porting/board_porting.rst index 0147c7c2679ca..a495f490861e1 100644 --- a/doc/hardware/porting/board_porting.rst +++ b/doc/hardware/porting/board_porting.rst @@ -123,7 +123,7 @@ This section focuses on the terminology used around hardware support, and in particular when defining and working with boards and SoCs. The overall set of terms used around the concept of board in Zephyr is depicted -in the image below, which uses the :ref:`bl5340_dvk` board as reference. +in the image below, which uses the :zephyr:board:`bl5340_dvk` board as reference. .. figure:: board/board-terminology.svg :width: 500px @@ -152,7 +152,7 @@ qualifiers, the board name can be used as a board target. Conversely, if board qualifiers are part of the board definition, then the SoC can be omitted by leaving it out but including the corresponding forward-slashes: ``//``. -Continuing with the example above, The board :ref:`bl5340_dvk` is a single SoC +Continuing with the example above, The board :zephyr:board:`bl5340_dvk` is a single SoC board where the SoC defines two CPU clusters: ``cpuapp`` and ``cpunet``. One of the CPU clusters, ``cpuapp``, additionally defines a non-secure board variant, ``ns``. diff --git a/doc/services/tfm/requirements.rst b/doc/services/tfm/requirements.rst index 13795986875be..f2acd1890d398 100644 --- a/doc/services/tfm/requirements.rst +++ b/doc/services/tfm/requirements.rst @@ -12,7 +12,7 @@ The following are some of the boards that can be used with TF-M: - ``mps2_an521_ns`` (qemu supported) * - :ref:`mps3_an547_board` - ``mps3_an547_ns`` (qemu supported) - * - :ref:`bl5340_dvk` + * - :zephyr:board:`bl5340_dvk` - ``bl5340_dvk/nrf5340/cpuapp/ns`` * - :ref:`lpcxpresso55s69` - ``lpcxpresso55s69_ns`` diff --git a/samples/drivers/dac/README.rst b/samples/drivers/dac/README.rst index c58d7f3de27ed..09bb215acc1d7 100644 --- a/samples/drivers/dac/README.rst +++ b/samples/drivers/dac/README.rst @@ -126,7 +126,7 @@ Building and Running for BL652 ============================== The BL652 DVK PCB contains a footprint for a MCP4725 to use as an external DAC. Note this is not populated by default. The sample can be built and -executed for the :ref:`bl652_dvk` as follows: +executed for the :zephyr:board:`bl652_dvk` as follows: .. zephyr-app-commands:: :zephyr-app: samples/drivers/dac @@ -140,7 +140,7 @@ Building and Running for BL653 ============================== The BL653 DVK PCB contains a footprint for a MCP4725 to use as an external DAC. Note this is not populated by default. The sample can be built and -executed for the :ref:`bl653_dvk` as follows: +executed for the :zephyr:board:`bl653_dvk` as follows: .. zephyr-app-commands:: :zephyr-app: samples/drivers/dac @@ -154,7 +154,7 @@ Building and Running for BL654 ============================== The BL654 DVK PCB contains a footprint for a MCP4725 to use as an external DAC. Note this is not populated by default. The sample can be built and -executed for the :ref:`bl654_dvk` as follows: +executed for the :zephyr:board:`bl654_dvk` as follows: .. zephyr-app-commands:: :zephyr-app: samples/drivers/dac @@ -167,7 +167,7 @@ DAC output is available on pin 1 of the MCP4725. Building and Running for BL5340 =============================== The BL5340 DVK PCB contains a MCP4725 to use as a DAC. The sample can be -built and executed for the :ref:`bl5340_dvk` as follows: +built and executed for the :zephyr:board:`bl5340_dvk` as follows: .. zephyr-app-commands:: :zephyr-app: samples/drivers/dac diff --git a/samples/sensor/sm351lt/README.rst b/samples/sensor/sm351lt/README.rst index d306fb8655433..76ee49f5072e0 100644 --- a/samples/sensor/sm351lt/README.rst +++ b/samples/sensor/sm351lt/README.rst @@ -26,12 +26,12 @@ Building and Running The SM351LT (or compatible) sensors are available on the following boards: -* :ref:`bt510` +* :zephyr:board:`bt510` Building on bt510 ================== -:ref:`bt510` includes a Honeywell SM351LT magnetoresistive sensor. +:zephyr:board:`bt510` includes a Honeywell SM351LT magnetoresistive sensor. .. zephyr-app-commands:: :zephyr-app: samples/sensor/sm351lt From 1645147c7fb1741c6d867af486039c9f592b7230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 15:30:11 +0200 Subject: [PATCH 1562/4482] boards: gardena: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Gardena boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/gardena/sgrm/doc/index.rst | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/boards/gardena/sgrm/doc/index.rst b/boards/gardena/sgrm/doc/index.rst index fcccfc8a097ae..e50554dc2bf60 100644 --- a/boards/gardena/sgrm/doc/index.rst +++ b/boards/gardena/sgrm/doc/index.rst @@ -1,18 +1,10 @@ -.. _gardena_sgrm: - -GARDENA Smart Garden Radio Module -################################# +.. zephyr:board:: sgrm Overview ******** This is a SoM that is used as a radio module by the GARDENA smart gateway (manual_, `FOSS parts`_). -.. figure:: sgrm.webp - :align: center - :alt: GARDENA smart Gateway with radio module - - .. _manual: https://www.gardena.com/tdrdownload//pub000070911/doc000120830 .. _FOSS parts: https://github.com/husqvarnagroup/smart-garden-gateway-public From 702f89a49fee5fca8b6f57792a39a786c0b5eb97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 17:06:09 +0200 Subject: [PATCH 1563/4482] boards: gd: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the GigaDevice boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/gd/gd32a503v_eval/doc/index.rst | 11 +---------- boards/gd/gd32e103v_eval/doc/index.rst | 11 +---------- boards/gd/gd32e507v_start/doc/index.rst | 9 +-------- boards/gd/gd32e507z_eval/doc/index.rst | 9 +-------- boards/gd/gd32f350r_eval/doc/index.rst | 9 +-------- boards/gd/gd32f403z_eval/doc/index.rst | 11 +---------- boards/gd/gd32f407v_start/doc/index.rst | 9 +-------- boards/gd/gd32f450i_eval/doc/index.rst | 10 +--------- boards/gd/gd32f450v_start/doc/index.rst | 9 +-------- boards/gd/gd32f450z_eval/doc/index.rst | 10 +--------- boards/gd/gd32f470i_eval/doc/index.rst | 10 +--------- boards/gd/gd32l233r_eval/doc/index.rst | 9 +-------- boards/gd/gd32vf103c_starter/doc/index.rst | 9 +-------- boards/gd/gd32vf103v_eval/doc/index.rst | 9 +-------- samples/drivers/dac/README.rst | 2 +- samples/drivers/eeprom/README.rst | 2 +- 16 files changed, 16 insertions(+), 123 deletions(-) diff --git a/boards/gd/gd32a503v_eval/doc/index.rst b/boards/gd/gd32a503v_eval/doc/index.rst index bd9170b16c43b..8fcec05bdc34d 100644 --- a/boards/gd/gd32a503v_eval/doc/index.rst +++ b/boards/gd/gd32a503v_eval/doc/index.rst @@ -1,8 +1,4 @@ -.. _gd32a503v_eval: - -GigaDevice GD32A503V-EVAL -######################### - +.. zephyr:board:: gd32a503v_eval Overview ******** @@ -14,11 +10,6 @@ The GD32A503VD features a single-core ARM Cortex-M4F MCU which can run up to 120-MHz with flash accesses zero wait states, 384kiB of Flash, 48kiB of SRAM and 88 GPIOs. -.. image:: img/gd32a503v_eval.jpg - :align: center - :alt: gd32a503v_eval - - Hardware ******** diff --git a/boards/gd/gd32e103v_eval/doc/index.rst b/boards/gd/gd32e103v_eval/doc/index.rst index f53d0b173d318..382bed8c7de0f 100644 --- a/boards/gd/gd32e103v_eval/doc/index.rst +++ b/boards/gd/gd32e103v_eval/doc/index.rst @@ -1,8 +1,4 @@ -.. _gd32e103v_eval: - -GigaDevice GD32E103V-EVAL -######################### - +.. zephyr:board:: gd32e103v_eval Overview ******** @@ -14,11 +10,6 @@ The GD32E103VB features a single-core ARM Cortex-M4F MCU which can run up to 120-MHz with flash accesses zero wait states, 128kiB of Flash, 32kiB of SRAM and 80 GPIOs. -.. image:: img/gd32e103v_eval.jpg - :align: center - :alt: gd32e103v_eval - - Hardware ******** diff --git a/boards/gd/gd32e507v_start/doc/index.rst b/boards/gd/gd32e507v_start/doc/index.rst index 902b4a2076672..a8b8f7a946969 100644 --- a/boards/gd/gd32e507v_start/doc/index.rst +++ b/boards/gd/gd32e507v_start/doc/index.rst @@ -1,7 +1,4 @@ -.. _gd32e507v_start: - -GigaDevice GD32E507V-START -########################## +.. zephyr:board:: gd32e507v_start Overview ******** @@ -13,10 +10,6 @@ The GD32E507VE features a single-core ARM Cortex-M33 MCU which can run up to 180 MHz with flash accesses zero wait states, 512kiB of Flash, 128kiB of SRAM and 80 GPIOs. -.. image:: img/gd32e507v_start.jpg - :align: center - :alt: gd32e507v_start - Hardware ******** diff --git a/boards/gd/gd32e507z_eval/doc/index.rst b/boards/gd/gd32e507z_eval/doc/index.rst index edaac63441094..610562b3eae22 100644 --- a/boards/gd/gd32e507z_eval/doc/index.rst +++ b/boards/gd/gd32e507z_eval/doc/index.rst @@ -1,7 +1,4 @@ -.. _gd32e507z_eval: - -GigaDevice GD32E507Z-EVAL -######################### +.. zephyr:board:: gd32e507z_eval Overview ******** @@ -13,10 +10,6 @@ The GD32E507ZE features a single-core ARM Cortex-M33 MCU which can run up to 180 MHz with flash accesses zero wait states, 512kiB of Flash, 128kiB of SRAM and 112 GPIOs. -.. image:: img/gd32e507z_eval.webp - :align: center - :alt: gd32e507z_eval - Hardware ******** diff --git a/boards/gd/gd32f350r_eval/doc/index.rst b/boards/gd/gd32f350r_eval/doc/index.rst index d5dc24f46c956..2c7ad72635279 100644 --- a/boards/gd/gd32f350r_eval/doc/index.rst +++ b/boards/gd/gd32f350r_eval/doc/index.rst @@ -1,7 +1,4 @@ -.. _gd32f350r_eval: - -GigaDevice GD32F350R-EVAL -######################### +.. zephyr:board:: gd32f350r_eval Overview ******** @@ -13,10 +10,6 @@ The GD32F350RBT6 features a single-core ARM Cortex-M4F MCU which can run up to 108-MHz with flash accesses zero wait states, 128kB of Flash, 16kB of SRAM and 55 GPIOs. -.. image:: img/gd32f350r_eval.webp - :align: center - :alt: gd32f350r_eval - Hardware ******** diff --git a/boards/gd/gd32f403z_eval/doc/index.rst b/boards/gd/gd32f403z_eval/doc/index.rst index c5c97fd727c55..d304094a3e76e 100644 --- a/boards/gd/gd32f403z_eval/doc/index.rst +++ b/boards/gd/gd32f403z_eval/doc/index.rst @@ -1,8 +1,4 @@ -.. _gd32f403z_eval: - -GigaDevice GD32F403Z-EVAL -######################### - +.. zephyr:board:: gd32f403z_eval Overview ******** @@ -14,11 +10,6 @@ The GD32F403ZE features a single-core ARM Cortex-M4F MCU which can run up to 168-MHz with flash accesses zero wait states, 512kiB of Flash, 96kiB of SRAM and 112 GPIOs. -.. image:: img/gd32f403z_eval.jpg - :align: center - :alt: gd32f403z_eval - - Hardware ******** diff --git a/boards/gd/gd32f407v_start/doc/index.rst b/boards/gd/gd32f407v_start/doc/index.rst index a59243db49887..68332eb51b8de 100644 --- a/boards/gd/gd32f407v_start/doc/index.rst +++ b/boards/gd/gd32f407v_start/doc/index.rst @@ -1,7 +1,4 @@ -.. _gd32f407v_start: - -GigaDevice GD32F407V-START -########################## +.. zephyr:board:: gd32f407v_start Overview ******** @@ -13,10 +10,6 @@ The GD32F407VE features a single-core ARM Cortex-M4 MCU which can run up to 168 MHz with flash accesses zero wait states, 3072kiB of Flash, 192kiB of SRAM and 82 GPIOs. -.. image:: img/gd32f407v_start.webp - :align: center - :alt: gd32f407v_start - Hardware ******** diff --git a/boards/gd/gd32f450i_eval/doc/index.rst b/boards/gd/gd32f450i_eval/doc/index.rst index e01c3957652be..d342cc9774d0b 100644 --- a/boards/gd/gd32f450i_eval/doc/index.rst +++ b/boards/gd/gd32f450i_eval/doc/index.rst @@ -1,7 +1,4 @@ -.. _gd32f450i_eval: - -GigaDevice GD32F450I-EVAL -######################### +.. zephyr:board:: gd32f450i_eval Overview ******** @@ -13,11 +10,6 @@ The GD32F450IK features a single-core ARM Cortex-M4F MCU which can run up to 200 MHz with flash accesses zero wait states, 3072kiB of Flash, 256kiB of SRAM and 140 GPIOs. -.. image:: img/gd32f450i_eval.webp - :align: center - :alt: gd32f450i_eval - - Hardware ******** diff --git a/boards/gd/gd32f450v_start/doc/index.rst b/boards/gd/gd32f450v_start/doc/index.rst index 0b1a781758b59..36870e0c6674c 100644 --- a/boards/gd/gd32f450v_start/doc/index.rst +++ b/boards/gd/gd32f450v_start/doc/index.rst @@ -1,7 +1,4 @@ -.. _gd32f450v_start: - -GigaDevice GD32F450V-START -########################## +.. zephyr:board:: gd32f450v_start Overview ******** @@ -13,10 +10,6 @@ The GD32F450VK features a single-core ARM Cortex-M4F MCU which can run up to 200 MHz with flash accesses zero wait states, 3072kiB of Flash, 256kiB of SRAM and 82 GPIOs. -.. image:: img/gd32f450v_start.webp - :align: center - :alt: gd32f450v_start - Hardware ******** diff --git a/boards/gd/gd32f450z_eval/doc/index.rst b/boards/gd/gd32f450z_eval/doc/index.rst index cdc4f8f42a73c..5a8d8b74763e9 100644 --- a/boards/gd/gd32f450z_eval/doc/index.rst +++ b/boards/gd/gd32f450z_eval/doc/index.rst @@ -1,7 +1,4 @@ -.. _gd32f450z_eval: - -GigaDevice GD32F450Z-EVAL -######################### +.. zephyr:board:: gd32f450z_eval Overview ******** @@ -13,11 +10,6 @@ The GD32F450ZK features a single-core ARM Cortex-M4F MCU which can run up to 200 MHz with flash accesses zero wait states, 3072kiB of Flash, 256kiB of SRAM and 114 GPIOs. -.. image:: img/gd32f450z_eval.webp - :align: center - :alt: gd32f450z_eval - - Hardware ******** diff --git a/boards/gd/gd32f470i_eval/doc/index.rst b/boards/gd/gd32f470i_eval/doc/index.rst index 75e33eaed2a28..1a8865f4d06fd 100644 --- a/boards/gd/gd32f470i_eval/doc/index.rst +++ b/boards/gd/gd32f470i_eval/doc/index.rst @@ -1,7 +1,4 @@ -.. _gd32f470i_eval: - -GigaDevice GD32F470I-EVAL -######################### +.. zephyr:board:: gd32f470i_eval Overview ******** @@ -13,11 +10,6 @@ The GD32F470IK features a single-core ARM Cortex-M4F MCU which can run up to 240 MHz with flash accesses zero wait states, 3072kiB of Flash, 256kiB of SRAM and 140 GPIOs. -.. image:: img/gd32f470i_eval.jpg - :align: center - :alt: gd32f470i_eval - - Hardware ******** diff --git a/boards/gd/gd32l233r_eval/doc/index.rst b/boards/gd/gd32l233r_eval/doc/index.rst index 884978fd02107..d677085625606 100644 --- a/boards/gd/gd32l233r_eval/doc/index.rst +++ b/boards/gd/gd32l233r_eval/doc/index.rst @@ -1,7 +1,4 @@ -.. _gd32l233r_eval: - -GigaDevice GD32L233R-EVA -######################### +.. zephyr:board:: gd32l233r_eval Overview ******** @@ -13,10 +10,6 @@ The GD32RCT6 features a single-core ARM Cortex-M4F MCU which can run up to 64-MHz with flash accesses zero wait states, 256kB of Flash, 32kB of SRAM and 59 GPIOs. -.. image:: img/gd32l233r_eval.jpg - :align: center - :alt: gd32l233r_eval - Hardware ******** diff --git a/boards/gd/gd32vf103c_starter/doc/index.rst b/boards/gd/gd32vf103c_starter/doc/index.rst index 29a428c6c9809..40b22fa18c5af 100644 --- a/boards/gd/gd32vf103c_starter/doc/index.rst +++ b/boards/gd/gd32vf103c_starter/doc/index.rst @@ -1,7 +1,4 @@ -.. _gd32vf103c_starter: - -GigaDevice GD32VF103C-STARTER -############################# +.. zephyr:board:: gd32vf103c_starter Overview ******** @@ -13,10 +10,6 @@ The GD32VF103CB features a single-core RISC-V 32-bit MCU which can run up to 108 MHz with flash accesses zero wait states, 128 KiB of Flash, 32 KiB of SRAM and 37 GPIOs. -.. image:: img/gd32vf103c_starter.jpg - :align: center - :alt: gd32vf103c_starter - Hardware ******** diff --git a/boards/gd/gd32vf103v_eval/doc/index.rst b/boards/gd/gd32vf103v_eval/doc/index.rst index 5aa8e8327bd23..773262c8eabee 100644 --- a/boards/gd/gd32vf103v_eval/doc/index.rst +++ b/boards/gd/gd32vf103v_eval/doc/index.rst @@ -1,7 +1,4 @@ -.. _gd32vf103v_eval: - -GigaDevice GD32VF103V-EVAL -########################## +.. zephyr:board:: gd32vf103v_eval Overview ******** @@ -13,10 +10,6 @@ The GD32VF103VB features a single-core RISC-V 32-bit MCU which can run up to 108 MHz with flash accesses zero wait states, 128 KiB of Flash, 32 KiB of SRAM and 80 GPIOs. -.. image:: img/gd32vf103v_eval.jpg - :align: center - :alt: gd32vf103v_eval - Hardware ******** diff --git a/samples/drivers/dac/README.rst b/samples/drivers/dac/README.rst index 09bb215acc1d7..6b86488479813 100644 --- a/samples/drivers/dac/README.rst +++ b/samples/drivers/dac/README.rst @@ -180,7 +180,7 @@ DAC output is available on pin 1 of the MCP4725. Building and Running for GD32450I-EVAL ====================================== The sample can be built and executed for the -:ref:`gd32f450i_eval` as follows: +:zephyr:board:`gd32f450i_eval` as follows: .. zephyr-app-commands:: :zephyr-app: samples/drivers/dac diff --git a/samples/drivers/eeprom/README.rst b/samples/drivers/eeprom/README.rst index 5381444bac5e0..6596b0fbc2bf4 100644 --- a/samples/drivers/eeprom/README.rst +++ b/samples/drivers/eeprom/README.rst @@ -35,7 +35,7 @@ as follows: :shield: x_nucleo_eeprma2 :compact: -For :ref:`gd32f450i_eval` board. First bridge the JP5 to USART with the jumper cap, +For :zephyr:board:`gd32f450i_eval` board. First bridge the JP5 to USART with the jumper cap, Then the sample can be built and executed for the as follows: .. zephyr-app-commands:: From fe1ecd4182cf12c2fe0a8a8980ab71d10fefde2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 15:45:03 +0200 Subject: [PATCH 1564/4482] boards: google: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Google boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/google/dragonclaw/doc/index.rst | 5 +---- boards/google/twinkie_v2/doc/index.rst | 5 +---- samples/boards/google/twinkie_v2/pda/README.rst | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/boards/google/dragonclaw/doc/index.rst b/boards/google/dragonclaw/doc/index.rst index ff4fc5253bba1..3f717a84341f9 100644 --- a/boards/google/dragonclaw/doc/index.rst +++ b/boards/google/dragonclaw/doc/index.rst @@ -1,7 +1,4 @@ -.. _google_dragonclaw_board: - -Google Dragonclaw Development Board -################################### +.. zephyr:board:: google_dragonclaw Overview ******** diff --git a/boards/google/twinkie_v2/doc/index.rst b/boards/google/twinkie_v2/doc/index.rst index 42be6aa2958e2..3ba2f42e2672c 100644 --- a/boards/google/twinkie_v2/doc/index.rst +++ b/boards/google/twinkie_v2/doc/index.rst @@ -1,7 +1,4 @@ -.. _google_twinkie_v2_board: - -Google Twinkie V2 -################# +.. zephyr:board:: google_twinkie_v2 Overview ******** diff --git a/samples/boards/google/twinkie_v2/pda/README.rst b/samples/boards/google/twinkie_v2/pda/README.rst index 17f3cb1777497..8b5ec26767563 100644 --- a/samples/boards/google/twinkie_v2/pda/README.rst +++ b/samples/boards/google/twinkie_v2/pda/README.rst @@ -7,7 +7,7 @@ Overview ******** -This provides access to :ref:`Twinkie ` so you can try out +This provides access to :zephyr:board:`google_twinkie_v2` so you can try out the supported features. Building and Running From 0bc32420d41ef862abda40cc19cfc771f595cf5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 15:45:45 +0200 Subject: [PATCH 1565/4482] boards: hardkernel: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the HardKernel boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/hardkernel/odroid_go/doc/index.rst | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/boards/hardkernel/odroid_go/doc/index.rst b/boards/hardkernel/odroid_go/doc/index.rst index 62f38d4799df9..0963435fa3d45 100644 --- a/boards/hardkernel/odroid_go/doc/index.rst +++ b/boards/hardkernel/odroid_go/doc/index.rst @@ -1,7 +1,4 @@ -.. _odroid_go: - -ODROID-GO -######### +.. zephyr:board:: odroid_go Overview ******** @@ -24,12 +21,6 @@ The features include the following: - Expansion port (I2C, GPIO, SPI) - Cryptographic hardware acceleration (RNG, ECC, RSA, SHA-2, AES) -.. figure:: img/odroid_go.jpg - :align: center - :alt: ODROID-GO - - ODROID-Go Game Kit - External Connector ================== From de03e63a2f088139c749c0b7b7b1108afac87369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 15:50:40 +0200 Subject: [PATCH 1566/4482] boards: heltec: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Heltec boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/heltec/heltec_wifi_lora32_v2/doc/index.rst | 5 +---- .../heltec_wireless_stick_lite_v3/doc/index.rst | 12 +----------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/boards/heltec/heltec_wifi_lora32_v2/doc/index.rst b/boards/heltec/heltec_wifi_lora32_v2/doc/index.rst index ee595e0a847b0..c4987a76b8fc7 100644 --- a/boards/heltec/heltec_wifi_lora32_v2/doc/index.rst +++ b/boards/heltec/heltec_wifi_lora32_v2/doc/index.rst @@ -1,7 +1,4 @@ -.. _heltec_wifi_lora32_v2: - -Heltec WiFi LoRa 32 (V2) -######################## +.. zephyr:board:: heltec_wifi_lora32_v2 Overview ******** diff --git a/boards/heltec/heltec_wireless_stick_lite_v3/doc/index.rst b/boards/heltec/heltec_wireless_stick_lite_v3/doc/index.rst index 352d158fbacb8..4f6430965e5a4 100644 --- a/boards/heltec/heltec_wireless_stick_lite_v3/doc/index.rst +++ b/boards/heltec/heltec_wireless_stick_lite_v3/doc/index.rst @@ -1,20 +1,10 @@ -.. heltec_wireless_stick_lite_v3: - -HelTec Wireless Stick Lite (V3) -############################### +.. zephyr:board:: heltec_wireless_stick_lite_v3 Overview ******** HelTec Wireless Stick Lite (V3) is a development board with Wi-Fi, Bluetooth and LoRa support. It is designed and produced by HelTec Automation(TM). [1]_ -.. figure:: heltec_wireless_stick_lite_v3.webp - :width: 400px - :align: center - :alt: HelTec Wireless Stick Lite (V3) - - HelTec Wireless Stick Lite (V3) (Credit: Chengdu HelTec Automation Technology Co., Ltd.) - Hardware ******** From 2a23cc45b058b038943b3ab9434869911c153afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 15:51:20 +0200 Subject: [PATCH 1567/4482] boards: holyiot: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Holyiot boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/holyiot/yj16019/doc/index.rst | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/boards/holyiot/yj16019/doc/index.rst b/boards/holyiot/yj16019/doc/index.rst index 7ecbf5b0931ac..86575a0838bcd 100644 --- a/boards/holyiot/yj16019/doc/index.rst +++ b/boards/holyiot/yj16019/doc/index.rst @@ -1,7 +1,4 @@ -.. _holyiot_yj16019: - -Holyiot YJ-16019 -################ +.. zephyr:board:: holyiot_yj16019 Overview ******** @@ -20,12 +17,6 @@ Semiconductor nRF52832 ARM Cortex-M4 CPU and the following devices: * Segger RTT (RTT Console) * :abbr:`WDT (Watchdog Timer)` -.. figure:: img/holyiot_yj16019_front.jpg - :align: center - :alt: Holyiot YJ-16019 - - Holyiot YJ-16019 (Credit: Holyiot) - The board is equipped with one LED, one push button, and is powered by a CR2032 coin cell. The `Nordic Semiconductor Infocenter`_ contains the processor's information and the datasheet. From 33e55f2c7c2985fabbd89015b41422941bd4db81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 14:39:11 +0200 Subject: [PATCH 1568/4482] boards: infineon: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Infineon boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/infineon/cy8ckit_062s4/doc/index.rst | 11 +---------- boards/infineon/cy8cproto_062_4343w/doc/index.rst | 9 +-------- boards/infineon/cy8cproto_063_ble/doc/index.rst | 9 +-------- boards/infineon/cyw920829m2evk_02/doc/index.rst | 9 +-------- boards/infineon/xmc45_relax_kit/doc/index.rst | 9 +-------- boards/infineon/xmc47_relax_kit/doc/index.rst | 9 +-------- doc/releases/release-notes-3.7.rst | 2 +- 7 files changed, 7 insertions(+), 51 deletions(-) diff --git a/boards/infineon/cy8ckit_062s4/doc/index.rst b/boards/infineon/cy8ckit_062s4/doc/index.rst index c697a60d872c9..0ee6df6d9029d 100644 --- a/boards/infineon/cy8ckit_062s4/doc/index.rst +++ b/boards/infineon/cy8ckit_062s4/doc/index.rst @@ -1,7 +1,4 @@ -.. _cy8ckit_062s4: - -INFINEON PSOC 62S4 Pioneer Kit -############################## +.. zephyr:board:: cy8ckit_062s4 Overview ******** @@ -15,12 +12,6 @@ programmer/debugger (KitProg3), a 512-Mbit Quad SPI NOR flash, a micro-B connect interface, a thermistor, an ambient light sensor, a 5-segment CapSense™ slider, two CapSense™ buttons, two user LEDs, and a push button. The board supports operating voltages from 1.8 V to 3.3 V for PSoC™ 6 MCU. -.. figure:: img/cy8ckit_062s4.png - :align: center - :alt: INFINEON PSOC 62S4 Pioneer Kit - - INFINEON PSOC 62S4 Pioneer Kit (Credit: Infineon) - Hardware ******** diff --git a/boards/infineon/cy8cproto_062_4343w/doc/index.rst b/boards/infineon/cy8cproto_062_4343w/doc/index.rst index a5934089f0b31..67dacd2151a4f 100644 --- a/boards/infineon/cy8cproto_062_4343w/doc/index.rst +++ b/boards/infineon/cy8cproto_062_4343w/doc/index.rst @@ -1,7 +1,4 @@ -.. _cy8cproto_062_4343w: - -INFINEON CY8CPROTO-062-4343W -############################ +.. zephyr:board:: cy8cproto_062_4343w Overview ******** @@ -16,10 +13,6 @@ This kit is designed with a snap-away form-factor, allowing the user to separate the different components and features that come with this kit and use independently. In addition, support for Digilent's Pmod interface is also provided with this kit. -.. image:: img/board.jpg - :align: center - :alt: CY8CPROTO-062-4343W - Hardware ******** diff --git a/boards/infineon/cy8cproto_063_ble/doc/index.rst b/boards/infineon/cy8cproto_063_ble/doc/index.rst index fa03c072e0982..cec1634fb3697 100644 --- a/boards/infineon/cy8cproto_063_ble/doc/index.rst +++ b/boards/infineon/cy8cproto_063_ble/doc/index.rst @@ -1,7 +1,4 @@ -.. _cy8cproto_063_ble: - -INFINEON CY8CPROTO-063-BLE -########################### +.. zephyr:board:: cy8cproto_063_ble Overview ******** @@ -9,10 +6,6 @@ Overview The PSoC 6 BLE Proto Kit (CY8CPROTO-063-BLE) is a hardware platform that enables design and debug of the Cypress PSoC 63 BLE MCU. -.. image:: img/cy8cproto-063-ble.jpg - :align: center - :alt: CY8CPROTO-063-BLE - Hardware ******** diff --git a/boards/infineon/cyw920829m2evk_02/doc/index.rst b/boards/infineon/cyw920829m2evk_02/doc/index.rst index 6c54aba4f25a3..d4c5193c3820d 100644 --- a/boards/infineon/cyw920829m2evk_02/doc/index.rst +++ b/boards/infineon/cyw920829m2evk_02/doc/index.rst @@ -1,7 +1,4 @@ -.. _cyw920829m2evk_02: - -INFINEON CYW920829M2EVK-02 -############################ +.. zephyr:board:: cyw920829m2evk_02 Overview ******** @@ -10,10 +7,6 @@ The AIROC™ CYW20829 Bluetooth® LE MCU Evaluation Kit (CYW920829M2EVK-02) with The system features Dual Arm® Cortex® - M33s for powering the MCU and Bluetooth subsystem with programmable and reconfigurable analog and digital blocks. In addition, on the kit, there is a suite of on-board peripherals including six-axis inertial measurement unit (IMU), thermistor, analog mic, user programmable buttons (2), LEDs (2), and RGB LED. There is also extensive GPIO support with extended headers and Arduino Uno R3 compatibility for third-party shields. -.. image:: img/cyw920829m2evk_02.webp - :align: center - :alt: CYW920829M2EVK_02 - Hardware ******** diff --git a/boards/infineon/xmc45_relax_kit/doc/index.rst b/boards/infineon/xmc45_relax_kit/doc/index.rst index 1209b7da84285..aeb988da85cd1 100644 --- a/boards/infineon/xmc45_relax_kit/doc/index.rst +++ b/boards/infineon/xmc45_relax_kit/doc/index.rst @@ -1,7 +1,4 @@ -.. _xmc45_relax_kit: - -INFINEON XMC45-RELAX-KIT -######################## +.. zephyr:board:: xmc45_relax_kit Overview ******** @@ -10,10 +7,6 @@ The XMC4500 Relax Kit is designed to evaluate the capabilities of the XMC4500 Microcontroller. It is based on High performance ARM Cortex-M4F which can run up to 120MHz. -.. image:: xmc45_relax_kit.jpg - :align: center - :alt: XMC45-RELAX-KIT - Features: ========= diff --git a/boards/infineon/xmc47_relax_kit/doc/index.rst b/boards/infineon/xmc47_relax_kit/doc/index.rst index 3170d1f41b41e..5441c414f2796 100644 --- a/boards/infineon/xmc47_relax_kit/doc/index.rst +++ b/boards/infineon/xmc47_relax_kit/doc/index.rst @@ -1,7 +1,4 @@ -.. _xmc47_relax_kit: - -INFINEON XMC47-RELAX-KIT -######################## +.. zephyr:board:: xmc47_relax_kit Overview ******** @@ -10,10 +7,6 @@ The XMC4700 Relax Kit is designed to evaluate the capabilities of the XMC4700 Microcontroller. It is based on High performance ARM Cortex-M4F which can run up to 144MHz. -.. image:: xmc47_relax_kit.jpg - :align: center - :alt: XMC47-RELAX-KIT - Features: ========= diff --git a/doc/releases/release-notes-3.7.rst b/doc/releases/release-notes-3.7.rst index b554c94007e4c..d567fe702be39 100644 --- a/doc/releases/release-notes-3.7.rst +++ b/doc/releases/release-notes-3.7.rst @@ -430,7 +430,7 @@ Boards & SoC Support * Added support for :zephyr:board:`Analog Devices MAX32655EVKIT `: ``max32655evkit``. * Added support for :zephyr:board:`Analog Devices MAX32655FTHR `: ``max32655fthr``. * Added support for :zephyr:board:`Analog Devices AD-APARD32690-SL `: ``ad_apard32690_sl``. - * Added support for :ref:`Infineon Technologies CYW920829M2EVK-02 `: ``cyw920829m2evk_02``. + * Added support for :zephyr:board:`Infineon Technologies CYW920829M2EVK-02 `: ``cyw920829m2evk_02``. * Added support for :ref:`Nuvoton Numaker M2L31KI board `: ``numaker_m2l31ki``. * Added support for :zephyr:board:`Espressif ESP32-S2 DevKit-C `: ``esp32s2_devkitc``. * Added support for :zephyr:board:`Espressif ESP32-S3 DevKit-C `: ``esp32s3_devkitc``. From 97e6092d22d4caedf1b6b349c5257d789c27cd42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 15:52:25 +0200 Subject: [PATCH 1569/4482] boards: innblue: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the innblue boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/innblue/innblue21/doc/index.rst | 11 +---------- boards/innblue/innblue22/doc/index.rst | 11 +---------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/boards/innblue/innblue21/doc/index.rst b/boards/innblue/innblue21/doc/index.rst index 0990c395c62ef..bafb7d9911a4a 100644 --- a/boards/innblue/innblue21/doc/index.rst +++ b/boards/innblue/innblue21/doc/index.rst @@ -1,7 +1,4 @@ -.. _nrf9160_innblue21: - -nRF9160 INNBLUE21 -################# +.. zephyr:board:: innblue21 Overview ******** @@ -9,12 +6,6 @@ Overview The nRF9160 innblue21 is a cellular IoT sensor development board, which is based on the nRF9160 SiP, and features NB-IoT and LTE-M connectivity. -.. figure:: img/nrf9160_innblue21.jpg - :align: center - :alt: nRF9160 innblue21 - - nRF9160 innblue21 (Credit: innblue) - Hardware ******** diff --git a/boards/innblue/innblue22/doc/index.rst b/boards/innblue/innblue22/doc/index.rst index 3485ad4de7713..9e84c4691dfa0 100644 --- a/boards/innblue/innblue22/doc/index.rst +++ b/boards/innblue/innblue22/doc/index.rst @@ -1,7 +1,4 @@ -.. _nrf9160_innblue22: - -nRF9160 INNBLUE22 -################# +.. zephyr:board:: innblue22 Overview ******** @@ -9,12 +6,6 @@ Overview The nRF9160 innblue22 is a cellular IoT sensor development board, which is based on the nRF9160 SiP, and features NB-IoT and LTE-M connectivity. -.. figure:: img/nrf9160_innblue22.jpg - :align: center - :alt: nRF9160 innblue22 - - nRF9160 innblue22 (Credit: innblue) - Hardware ******** From e86dc65cedf5888e996f597bf2f54a38546add57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 16:04:53 +0200 Subject: [PATCH 1570/4482] boards: m5stack: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the M5Stack boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/m5stack/m5stack_atom_lite/doc/index.rst | 13 +------------ boards/m5stack/m5stack_atoms3/doc/index.rst | 13 +------------ boards/m5stack/m5stack_atoms3_lite/doc/index.rst | 13 +------------ boards/m5stack/m5stack_core2/doc/index.rst | 12 +----------- boards/m5stack/m5stack_stamps3/doc/index.rst | 12 +----------- boards/m5stack/m5stickc_plus/doc/index.rst | 5 +---- boards/m5stack/stamp_c3/doc/index.rst | 5 +---- doc/releases/release-notes-3.7.rst | 2 +- 8 files changed, 8 insertions(+), 67 deletions(-) diff --git a/boards/m5stack/m5stack_atom_lite/doc/index.rst b/boards/m5stack/m5stack_atom_lite/doc/index.rst index 6a47c4a7f324f..87e56a236774b 100644 --- a/boards/m5stack/m5stack_atom_lite/doc/index.rst +++ b/boards/m5stack/m5stack_atom_lite/doc/index.rst @@ -1,7 +1,4 @@ -.. _m5stack_atom_lite: - -M5Stack ATOM Lite -################# +.. zephyr:board:: m5stack_atom_lite Overview ******** @@ -16,14 +13,6 @@ It features the following integrated components: - Infrared LED - 1x Grove extension port - -.. figure:: img/m5stack_atom_lite.webp - :align: center - :alt: M5Stack ATOM Lite - - M5Stack ATOM Lite - - Supported Features ================== diff --git a/boards/m5stack/m5stack_atoms3/doc/index.rst b/boards/m5stack/m5stack_atoms3/doc/index.rst index 69bff1ee0cfbe..1b863cb08be5e 100644 --- a/boards/m5stack/m5stack_atoms3/doc/index.rst +++ b/boards/m5stack/m5stack_atoms3/doc/index.rst @@ -1,7 +1,4 @@ -.. _m5stack_atoms3: - -M5Stack AtomS3 -############## +.. zephyr:board:: m5stack_atoms3 Overview ******** @@ -18,14 +15,6 @@ It features the following integrated components: - 6-axis IMU MPU6886 - Infrared emitter - -.. figure:: img/m5stack_atoms3.webp - :align: center - :alt: M5Stack AtomS3 - - M5Stack AtomS3 - - Supported Features ================== diff --git a/boards/m5stack/m5stack_atoms3_lite/doc/index.rst b/boards/m5stack/m5stack_atoms3_lite/doc/index.rst index ffbe8f1cb05d6..23af62d96e670 100644 --- a/boards/m5stack/m5stack_atoms3_lite/doc/index.rst +++ b/boards/m5stack/m5stack_atoms3_lite/doc/index.rst @@ -1,7 +1,4 @@ -.. _m5stack_atoms3_lite: - -M5Stack AtomS3 Lite -################### +.. zephyr:board:: m5stack_atoms3_lite Overview ******** @@ -16,14 +13,6 @@ It features the following integrated components: - 8MB of Flash - RGB Status-LED - -.. figure:: img/m5stack_atoms3_lite.webp - :align: center - :alt: M5Stack AtomS3 Lite - - M5Stack AtomS3 Lite - - Supported Features ================== diff --git a/boards/m5stack/m5stack_core2/doc/index.rst b/boards/m5stack/m5stack_core2/doc/index.rst index 02ba5fa724924..9855ef1de5994 100644 --- a/boards/m5stack/m5stack_core2/doc/index.rst +++ b/boards/m5stack/m5stack_core2/doc/index.rst @@ -1,7 +1,4 @@ -.. _m5stack_core2: - -M5Stack Core2 -############# +.. zephyr:board:: m5stack_core2 Overview ******** @@ -26,13 +23,6 @@ M5Stack Core2 features the following integrated components: - MIC SPM1423 - Battery 390mAh 3,7V -.. figure:: img/m5stack_core2.webp - :align: center - :alt: M5Stack-Core2 - :width: 400 px - - M5Stack-Core2 module - Functional Description ********************** diff --git a/boards/m5stack/m5stack_stamps3/doc/index.rst b/boards/m5stack/m5stack_stamps3/doc/index.rst index 36881121e8a39..3762fd49b1cba 100644 --- a/boards/m5stack/m5stack_stamps3/doc/index.rst +++ b/boards/m5stack/m5stack_stamps3/doc/index.rst @@ -1,7 +1,4 @@ -.. _m5stack_stamps3: - -M5Stack StampS3 -############### +.. zephyr:board:: m5stack_stamps3 Overview ******** @@ -17,13 +14,6 @@ It features the following integrated components: - Bluetooth - User-Button -.. figure:: img/m5stack_stamps3.webp - :align: center - :alt: M5Stack StampS3 - :width: 400 px - - M5Stack StampS3 module - Functional Description ********************** diff --git a/boards/m5stack/m5stickc_plus/doc/index.rst b/boards/m5stack/m5stickc_plus/doc/index.rst index 4fe431fea849c..f40e21fbd5e63 100644 --- a/boards/m5stack/m5stickc_plus/doc/index.rst +++ b/boards/m5stack/m5stickc_plus/doc/index.rst @@ -1,7 +1,4 @@ -.. _m5stickc_plus: - -M5StickC PLUS -############# +.. zephyr:board:: m5stickc_plus Overview ******** diff --git a/boards/m5stack/stamp_c3/doc/index.rst b/boards/m5stack/stamp_c3/doc/index.rst index 40869ee01664a..a953b595b2c79 100644 --- a/boards/m5stack/stamp_c3/doc/index.rst +++ b/boards/m5stack/stamp_c3/doc/index.rst @@ -1,7 +1,4 @@ -.. _stamp_c3: - -M5Stack STAMP-C3 -################## +.. zephyr:board:: stamp_c3 Overview ******** diff --git a/doc/releases/release-notes-3.7.rst b/doc/releases/release-notes-3.7.rst index d567fe702be39..b93a07d194e75 100644 --- a/doc/releases/release-notes-3.7.rst +++ b/doc/releases/release-notes-3.7.rst @@ -436,7 +436,7 @@ Boards & SoC Support * Added support for :zephyr:board:`Espressif ESP32-S3 DevKit-C `: ``esp32s3_devkitc``. * Added support for :zephyr:board:`Espressif ESP32-C6 DevKit-C `: ``esp32c6_devkitc``. * Added support for :ref:`Waveshare ESP32-S3-Touch-LCD-1.28 `: ``esp32s3_touch_lcd_1_28``. - * Added support for :ref:`M5Stack ATOM Lite `: ``m5stack_atom_lite``. + * Added support for :zephyr:board:`M5Stack ATOM Lite `: ``m5stack_atom_lite``. * Added support for :ref:`CTHINGS.CO Connectivity Card nRF52840 `: ``ctcc_nrf52840``. * Made these board changes: From 4e99eed2fc6d0822f6e0ae296339c437dabbde27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 16:06:04 +0200 Subject: [PATCH 1571/4482] boards: madmachine: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the MadMachine boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/madmachine/mm_feather/doc/index.rst | 9 +-------- boards/madmachine/mm_swiftio/doc/index.rst | 11 +---------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/boards/madmachine/mm_feather/doc/index.rst b/boards/madmachine/mm_feather/doc/index.rst index 0a556bc42b089..7c1b985fc7013 100644 --- a/boards/madmachine/mm_feather/doc/index.rst +++ b/boards/madmachine/mm_feather/doc/index.rst @@ -1,7 +1,4 @@ -.. _mm_feather: - -MadMachine SwiftIO Feather -########################## +.. zephyr:board:: mm_feather Overview ******** @@ -16,10 +13,6 @@ at: - `MadMachine Homepage`_ - `SwiftIO API Reference`_ -.. image:: mm_feather.jpg - :align: center - :alt: SwiftIO Feather Board - Hardware ******** diff --git a/boards/madmachine/mm_swiftio/doc/index.rst b/boards/madmachine/mm_swiftio/doc/index.rst index 5fb0837e1ead1..6845fa1fa3602 100644 --- a/boards/madmachine/mm_swiftio/doc/index.rst +++ b/boards/madmachine/mm_swiftio/doc/index.rst @@ -1,7 +1,4 @@ -.. _mm_swiftio: - -MadMachine SwiftIO -################## +.. zephyr:board:: mm_swiftio Overview ******** @@ -16,12 +13,6 @@ at: - `MadMachine Homepage`_ - `SwiftIO API Reference`_ - - -.. image:: mm_swiftio.jpg - :align: center - :alt: SwiftIO Board - Hardware ******** From dfde943cebe0e4502932b16eac5d2f69017ce70d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 16:06:42 +0200 Subject: [PATCH 1572/4482] boards: makerdiary: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the MakerDiary boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/makerdiary/nrf52832_mdk/doc/index.rst | 5 +---- boards/makerdiary/nrf52840_mdk/doc/index.rst | 5 +---- .../makerdiary/nrf52840_mdk_usb_dongle/doc/index.rst | 11 +---------- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/boards/makerdiary/nrf52832_mdk/doc/index.rst b/boards/makerdiary/nrf52832_mdk/doc/index.rst index 2c8667bfacd20..61ec37c09e8fc 100644 --- a/boards/makerdiary/nrf52832_mdk/doc/index.rst +++ b/boards/makerdiary/nrf52832_mdk/doc/index.rst @@ -1,7 +1,4 @@ -.. _nrf52832_mdk: - -nRF52832-mdk -################# +.. zephyr:board:: nrf52832_mdk Overview ******** diff --git a/boards/makerdiary/nrf52840_mdk/doc/index.rst b/boards/makerdiary/nrf52840_mdk/doc/index.rst index 6e0b24b65f2b4..e2bc31dabcaff 100644 --- a/boards/makerdiary/nrf52840_mdk/doc/index.rst +++ b/boards/makerdiary/nrf52840_mdk/doc/index.rst @@ -1,7 +1,4 @@ -.. _nrf52840_mdk: - -nRF52840-mdk -################# +.. zephyr:board:: nrf52840_mdk Overview ******** diff --git a/boards/makerdiary/nrf52840_mdk_usb_dongle/doc/index.rst b/boards/makerdiary/nrf52840_mdk_usb_dongle/doc/index.rst index 82202ec51acb4..ac4743c77488c 100644 --- a/boards/makerdiary/nrf52840_mdk_usb_dongle/doc/index.rst +++ b/boards/makerdiary/nrf52840_mdk_usb_dongle/doc/index.rst @@ -1,7 +1,4 @@ -.. _nrf52840_mdk_usb_dongle: - -nRF52840 MDK USB Dongle -####################### +.. zephyr:board:: nrf52840_mdk_usb_dongle Overview ******** @@ -15,12 +12,6 @@ Bluetooth5/Tread/802.15.4/ANT/2.4GHz multiprotocol node or development board. Alternatively the USB Dongle can be used as a Network Co-Processor(NCP) with a simple connection to a PC or other USB enabled device. -.. figure:: nrf52840-mdk-usb-dongle-pinout.jpg - :align: center - :alt: nRF52840 MDK USB Dongle - - nRF52840 MDK USB Dongle - See `nrf52840-mdk-usb-dongle website`_ for more information about the development board and `nRF52840 website`_ for the official reference on the IC itself. From 8f790bbe2879b610ba1854c1f6c1ed7da85e63dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 16:09:35 +0200 Subject: [PATCH 1573/4482] boards: microchip: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Microchip boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/microchip/ev11l78a/doc/index.rst | 12 +----------- boards/microchip/m2gl025_miv/doc/index.rst | 5 +---- .../microchip/mec1501modular_assy6885/doc/index.rst | 9 +-------- boards/microchip/mec15xxevb_assy6853/doc/index.rst | 9 +-------- boards/microchip/mec172xevb_assy6906/doc/index.rst | 9 +-------- .../doc/mec172xmodular_assy6930.rst | 12 +----------- boards/microchip/mpfs_icicle/doc/index.rst | 5 +---- 7 files changed, 7 insertions(+), 54 deletions(-) diff --git a/boards/microchip/ev11l78a/doc/index.rst b/boards/microchip/ev11l78a/doc/index.rst index 2197ede6331ad..95d05add0c0e4 100644 --- a/boards/microchip/ev11l78a/doc/index.rst +++ b/boards/microchip/ev11l78a/doc/index.rst @@ -1,7 +1,4 @@ -.. _ev11l78a: - -UPD301C Basic Sink Application Example -###################################### +.. zephyr:board:: ev11l78a Overview ******** @@ -12,13 +9,6 @@ Programmable USB Power Delivery (PD) Controller. This RoHS-compliant evaluation platform comes in a small form factor and adheres to the USB Type-C™ Connector Specification and USB PD 3.0 specification. -.. figure:: img/ev11l78a.jpg - :width: 500px - :align: center - :alt: EV11L78A - - UPD301C Basic Sink Application Example (Credit: `Microchip Technology`_) - Hardware ******** diff --git a/boards/microchip/m2gl025_miv/doc/index.rst b/boards/microchip/m2gl025_miv/doc/index.rst index cc9a24c866b95..88a4fa2b9512a 100644 --- a/boards/microchip/m2gl025_miv/doc/index.rst +++ b/boards/microchip/m2gl025_miv/doc/index.rst @@ -1,7 +1,4 @@ -.. _m2gl025-miv: - -Microchip M2GL025 Mi-V -###################### +.. zephyr:board:: m2gl025_miv Overview ******** diff --git a/boards/microchip/mec1501modular_assy6885/doc/index.rst b/boards/microchip/mec1501modular_assy6885/doc/index.rst index a70c20ee96198..910ba104da130 100644 --- a/boards/microchip/mec1501modular_assy6885/doc/index.rst +++ b/boards/microchip/mec1501modular_assy6885/doc/index.rst @@ -1,7 +1,4 @@ -.. _mec1501modular_assy6885: - -Microchip MEC1501 Modular card ASSY6885 -####################################### +.. zephyr:board:: mec1501modular_assy6885 Overview ******** @@ -10,10 +7,6 @@ The MEC1501 Modular card ASSY6885 is a development board to evaluate the Microch MEC152X series microcontrollers. This board can work standalone or be mated with any platform that complies with MECC specification. -.. image:: mec1501modular_assy6885.jpg - :align: center - :alt: MEC1501 Modular ASSY 6885 - Hardware ******** diff --git a/boards/microchip/mec15xxevb_assy6853/doc/index.rst b/boards/microchip/mec15xxevb_assy6853/doc/index.rst index 4eafd2e758c77..c712d74b563db 100644 --- a/boards/microchip/mec15xxevb_assy6853/doc/index.rst +++ b/boards/microchip/mec15xxevb_assy6853/doc/index.rst @@ -1,7 +1,4 @@ -.. _mec15xxevb_assy6853: - -Microchip MEC15xxEVB ASSY6853 -############################# +.. zephyr:board:: mec15xxevb_assy6853 Overview ******** @@ -15,10 +12,6 @@ been updated requiring a new SPI image tool. MEC1501 and MEC152x SPI image formats are not compatible with each other. Evaluation and cpu boards are compatible. -.. image:: mec15xxevb_assy6853.jpg - :align: center - :alt: MEC15XX EVB ASSY 6853 - Hardware ******** diff --git a/boards/microchip/mec172xevb_assy6906/doc/index.rst b/boards/microchip/mec172xevb_assy6906/doc/index.rst index 4765d787d948e..0671beb414364 100644 --- a/boards/microchip/mec172xevb_assy6906/doc/index.rst +++ b/boards/microchip/mec172xevb_assy6906/doc/index.rst @@ -1,7 +1,4 @@ -.. _mec172xevb_assy6906: - -Microchip MEC172xEVB ASSY6906 -############################# +.. zephyr:board:: mec172xevb_assy6906 Overview ******** @@ -11,10 +8,6 @@ Microchip MEC172X series microcontrollers. This board needs to be mated with part number MEC172x 144WFBGA SOLDER DC ASSY 6914 (cpu board) in order to operate. MEC172x and MEC152x SPI image formats are not compatible with each other. -.. image:: mec172xevb_assy6906.jpg - :align: center - :alt: MEC172X EVB ASSY 6906 - Hardware ******** diff --git a/boards/microchip/mec172xmodular_assy6930/doc/mec172xmodular_assy6930.rst b/boards/microchip/mec172xmodular_assy6930/doc/mec172xmodular_assy6930.rst index a85226e87d026..a6bc75fc8fb89 100644 --- a/boards/microchip/mec172xmodular_assy6930/doc/mec172xmodular_assy6930.rst +++ b/boards/microchip/mec172xmodular_assy6930/doc/mec172xmodular_assy6930.rst @@ -1,7 +1,4 @@ -.. _mec172xmodular_6930: - -Microchip MEC172x Modular Card ASSY6930 (Rev. B) -################################################ +.. zephyr:board:: mec172xmodular_assy6930 Overview ******** @@ -9,13 +6,6 @@ The MEC172x Modular Card ASSY6930 (Rev. B) is a development board to evaluate th Microchip MEC172X series microcontrollers. This board can work standalone or be mated with any platform that complies with MECC specification. - -.. image:: ./mec172xmodular_assy6930.jpg - :width: 576px - :align: center - :alt: MEC172x Modular ASSY 6930 - - Hardware ******** diff --git a/boards/microchip/mpfs_icicle/doc/index.rst b/boards/microchip/mpfs_icicle/doc/index.rst index 10ab696ae03ef..ee5d07b5bda0d 100644 --- a/boards/microchip/mpfs_icicle/doc/index.rst +++ b/boards/microchip/mpfs_icicle/doc/index.rst @@ -1,7 +1,4 @@ -.. _mpfs_icicle: - -Microchip mpfs_icicle -##################### +.. zephyr:board:: mpfs_icicle Overview ******** From ba419a6705edf3ddab816b7e12385951c2f32702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 16:13:21 +0200 Subject: [PATCH 1574/4482] boards: mikroe: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the MikroElektronika boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/mikroe/clicker_2/doc/mikroe_clicker_2.rst | 12 +----------- boards/mikroe/clicker_ra4m1/doc/index.rst | 11 +---------- .../doc/mikroe_mini_m4_for_stm32.rst | 9 +-------- boards/mikroe/stm32_m4_clicker/doc/index.rst | 11 +---------- doc/releases/release-notes-3.7.rst | 2 +- 5 files changed, 5 insertions(+), 40 deletions(-) diff --git a/boards/mikroe/clicker_2/doc/mikroe_clicker_2.rst b/boards/mikroe/clicker_2/doc/mikroe_clicker_2.rst index a1ef4aa09ecbc..a33f76d8beba2 100644 --- a/boards/mikroe/clicker_2/doc/mikroe_clicker_2.rst +++ b/boards/mikroe/clicker_2/doc/mikroe_clicker_2.rst @@ -1,7 +1,4 @@ -.. _mikroe_clicker_2: - -MikroE Clicker 2 for STM32 -########################## +.. zephyr:board:: mikroe_clicker_2 Overview ******** @@ -12,13 +9,6 @@ The board also has battery connection and a battery management unit on board. It can be powered either from a battery pack, such as a LiPo or from USB. The board is equipped with a 25MHz crystal as well as a 32.768kHz clock crystal. - -.. figure:: img/clicker-2-stm32f4-thickbox_default-2.jpg - :align: center - :alt: Clicker 2 For STM32 - - Clicker 2 For STM32 (Credit: MikroElektronika d.o.o.) - Hardware ******** The Clicker 2 board contains the following connections: diff --git a/boards/mikroe/clicker_ra4m1/doc/index.rst b/boards/mikroe/clicker_ra4m1/doc/index.rst index 5af9aa1125af2..56099ee6f4294 100644 --- a/boards/mikroe/clicker_ra4m1/doc/index.rst +++ b/boards/mikroe/clicker_ra4m1/doc/index.rst @@ -1,7 +1,4 @@ -.. _mikroe_clicker_ra4m1: - -Mikroe Clicker RA4M1 -#################### +.. zephyr:board:: mikroe_clicker_ra4m1 Overview ******** @@ -10,12 +7,6 @@ The Mikroe Clicker RA4M1 development board contains a Renesas Cortex-M4 based R7FA4M1AB3CFM Microcontroller operating at up to 48 MHz with 256 KB of Flash memory and 32 KB of SRAM. -.. figure:: img/mikroe_clicker_ra4m1.jpg - :align: center - :alt: Clicker RA4M1 - - Clicker RA4M1 (Credit: MikroElektronika d.o.o.) - Hardware ******** diff --git a/boards/mikroe/mini_m4_for_stm32/doc/mikroe_mini_m4_for_stm32.rst b/boards/mikroe/mini_m4_for_stm32/doc/mikroe_mini_m4_for_stm32.rst index 6194953b1daa8..02208b66bf329 100644 --- a/boards/mikroe/mini_m4_for_stm32/doc/mikroe_mini_m4_for_stm32.rst +++ b/boards/mikroe/mini_m4_for_stm32/doc/mikroe_mini_m4_for_stm32.rst @@ -1,7 +1,4 @@ -.. _mikroe_mini_m4_for_stm32: - -Mikroe MINI-M4 for STM32 -######################## +.. zephyr:board:: mikroe_mini_m4_for_stm32 Overview ******** @@ -15,10 +12,6 @@ It has a reset button and three signal LEDs. It operates on a 3.3V power supply. An on-board voltage regulator allows the board to be powered directly from a USB cable. -.. image:: img/mikroe_mini_m4_for_stm32.jpg - :align: center - :alt: MINI-M4 for STM32 - Pin Mapping =========== diff --git a/boards/mikroe/stm32_m4_clicker/doc/index.rst b/boards/mikroe/stm32_m4_clicker/doc/index.rst index c1f9f809ac70c..8bddfd3f7aaa9 100644 --- a/boards/mikroe/stm32_m4_clicker/doc/index.rst +++ b/boards/mikroe/stm32_m4_clicker/doc/index.rst @@ -1,7 +1,4 @@ -.. _mikroe_stm32_m4_clicker: - -Mikroe STM32 M4 Clicker -####################### +.. zephyr:board:: mikroe_stm32_m4_clicker Overview ******** @@ -10,12 +7,6 @@ The Mikroe STM32 M4 Clicker development board contains a STMicroelectronics Cortex-M4 based STM32F415RG Microcontroller operating at up to 168 MHz with 1 MB of Flash memory and 192 KB of SRAM. -.. figure:: img/stm32_m4_clicker.webp - :align: center - :alt: STM32 M4 Clicker - - STM32 M4 Clicker (Credit: MikroElektronika d.o.o.) - Hardware ******** diff --git a/doc/releases/release-notes-3.7.rst b/doc/releases/release-notes-3.7.rst index b93a07d194e75..e7c54a52e210a 100644 --- a/doc/releases/release-notes-3.7.rst +++ b/doc/releases/release-notes-3.7.rst @@ -411,7 +411,7 @@ Boards & SoC Support * Added support for :zephyr:board:`Ambiq Apollo3 Blue Plus board `: ``apollo3p_evb``. * Added support for :ref:`Raspberry Pi 5 board `: ``rpi_5``. * Added support for :zephyr:board:`Seeed Studio XIAO RP2040 board `: ``xiao_rp2040``. - * Added support for :ref:`Mikroe RA4M1 Clicker board `: ``mikroe_clicker_ra4m1``. + * Added support for :zephyr:board:`Mikroe RA4M1 Clicker board `: ``mikroe_clicker_ra4m1``. * Added support for :ref:`Arduino UNO R4 WiFi board `: ``arduino_uno_r4_wifi``. * Added support for :ref:`Renesas EK-RA8M1 board `: ``ek_ra8m1``. * Added support for :ref:`ST Nucleo H533RE `: ``nucleo_h533re``. From 769ec72a7c79c0cabd7f0e24da48d33468f08c78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 16:13:54 +0200 Subject: [PATCH 1575/4482] boards: mxchip: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the MXChip boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/mxchip/az3166_iotdevkit/doc/index.rst | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/boards/mxchip/az3166_iotdevkit/doc/index.rst b/boards/mxchip/az3166_iotdevkit/doc/index.rst index 694d53517a6b5..230073f829556 100644 --- a/boards/mxchip/az3166_iotdevkit/doc/index.rst +++ b/boards/mxchip/az3166_iotdevkit/doc/index.rst @@ -1,7 +1,4 @@ -.. _az3166_iotdevkit: - -AZ3166 MXChip IoT DevKit -######################## +.. zephyr:board:: az3166_iotdevkit Overview ******** @@ -11,12 +8,6 @@ projects. It's an all-in-one board powered by an Arm Cortex-M4 processor. On-boa include an OLED screen, headphone output, stereo microphone and abundant sensors like humidity & temperature, pressure, motion (accelerometer & gyroscope) and magnetometer. -.. figure:: img/az3166-iotdevkit.webp - :align: center - :alt: AZ3166 MXChip IoT DevKit - - AZ3166 MXChip IoT DevKit (Credit: MXChip) - More information about the board can be found at the `MXChip AZ3166 website`_. Hardware From a17d854004cf8ffb41124fe6ffb858aea46e0fa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 15:10:35 +0200 Subject: [PATCH 1576/4482] boards: nuvoton: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Nuvoton boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/nuvoton/npcm400_evb/doc/index.rst | 9 +-------- boards/nuvoton/npcx4m8f_evb/doc/index.rst | 9 +-------- boards/nuvoton/npcx7m6fb_evb/doc/index.rst | 9 +-------- boards/nuvoton/npcx9m6f_evb/doc/index.rst | 9 +-------- boards/nuvoton/numaker_m2l31ki/doc/index.rst | 9 +-------- boards/nuvoton/numaker_pfm_m467/doc/index.rst | 10 +--------- boards/nuvoton/numaker_pfm_m487/doc/index.rst | 9 +-------- doc/releases/release-notes-3.7.rst | 2 +- samples/sensor/adc_cmp_npcx/README.rst | 4 ++-- 9 files changed, 10 insertions(+), 60 deletions(-) diff --git a/boards/nuvoton/npcm400_evb/doc/index.rst b/boards/nuvoton/npcm400_evb/doc/index.rst index d5d9ee550c257..93c91eb474adc 100644 --- a/boards/nuvoton/npcm400_evb/doc/index.rst +++ b/boards/nuvoton/npcm400_evb/doc/index.rst @@ -1,7 +1,4 @@ -.. _npcm400_evb: - -Nuvoton NPCM400_EVB -#################### +.. zephyr:board:: npcm400_evb Overview ******** @@ -10,10 +7,6 @@ The NPCM400_EVB kit is a development platform to evaluate the Nuvoton NPCM4 series microcontrollers. This board needs to be mated with part number NPCM400 Satellite Management Controller (SMC). -.. image:: npcm400_evb.webp - :align: center - :alt: NPCM400 Evaluation Board - Hardware ******** diff --git a/boards/nuvoton/npcx4m8f_evb/doc/index.rst b/boards/nuvoton/npcx4m8f_evb/doc/index.rst index 928c4f2ce8177..1fd1e7ae5d97a 100644 --- a/boards/nuvoton/npcx4m8f_evb/doc/index.rst +++ b/boards/nuvoton/npcx4m8f_evb/doc/index.rst @@ -1,7 +1,4 @@ -.. _npcx4m8f_evb: - -Nuvoton NPCX4M8F_EVB -#################### +.. zephyr:board:: npcx4m8f_evb Overview ******** @@ -10,10 +7,6 @@ The NPCX4M8F_EVB kit is a development platform to evaluate the Nuvoton NPCX4 series microcontrollers. This board needs to be mated with part number NPCX498F. -.. image:: npcx4m8f_evb.jpg - :align: center - :alt: NPCX4M8F Evaluation Board - Hardware ******** diff --git a/boards/nuvoton/npcx7m6fb_evb/doc/index.rst b/boards/nuvoton/npcx7m6fb_evb/doc/index.rst index 3bcf013f84fe2..2dc8382d737b8 100644 --- a/boards/nuvoton/npcx7m6fb_evb/doc/index.rst +++ b/boards/nuvoton/npcx7m6fb_evb/doc/index.rst @@ -1,7 +1,4 @@ -.. _npcx7m6fb_evb: - -Nuvoton NPCX7M6FB_EVB -##################### +.. zephyr:board:: npcx7m6fb_evb Overview ******** @@ -10,10 +7,6 @@ The NPCX7M6FB_EVB kit is a development platform to evaluate the Nuvoton NPCX7 series microcontrollers. This board needs to be mated with part number NPCX796FB. -.. image:: npcx7m6fb_evb.jpg - :align: center - :alt: NPCX7M6FB Evaluation Board - Hardware ******** diff --git a/boards/nuvoton/npcx9m6f_evb/doc/index.rst b/boards/nuvoton/npcx9m6f_evb/doc/index.rst index e9ed19970c5c0..2e9ac2e368be3 100644 --- a/boards/nuvoton/npcx9m6f_evb/doc/index.rst +++ b/boards/nuvoton/npcx9m6f_evb/doc/index.rst @@ -1,7 +1,4 @@ -.. _npcx9m6f_evb: - -Nuvoton NPCX9M6F_EVB -#################### +.. zephyr:board:: npcx9m6f_evb Overview ******** @@ -10,10 +7,6 @@ The NPCX9M6F_EVB kit is a development platform to evaluate the Nuvoton NPCX9 series microcontrollers. This board needs to be mated with part number NPCX996F. -.. image:: npcx9m6f_evb.jpg - :align: center - :alt: NPCX9M6F Evaluation Board - Hardware ******** diff --git a/boards/nuvoton/numaker_m2l31ki/doc/index.rst b/boards/nuvoton/numaker_m2l31ki/doc/index.rst index 031deb73b67b7..98838ae7e1d1b 100644 --- a/boards/nuvoton/numaker_m2l31ki/doc/index.rst +++ b/boards/nuvoton/numaker_m2l31ki/doc/index.rst @@ -1,7 +1,4 @@ -.. _nuvoton_m2l31ki: - -NUVOTON NUMAKER M2L31KI -######################## +.. zephyr:board:: numaker_m2l31ki Overview ******** @@ -10,10 +7,6 @@ The NuMaker M2L31KI is an Internet of Things (IoT) application focused platform specially developed by Nuvoton. The NuMaker-M2L31KI is based on the NuMicro® M2L31 series MCU with ARM® -Cortex®-M23 core. -.. image:: ./m2l31ki.webp - :align: center - :alt: M2L31KI - Features: ========= - 32-bit Arm Cortex®-M23 M2L31KIDAE MCU diff --git a/boards/nuvoton/numaker_pfm_m467/doc/index.rst b/boards/nuvoton/numaker_pfm_m467/doc/index.rst index e43ad1415f69b..70d4cba1ec078 100644 --- a/boards/nuvoton/numaker_pfm_m467/doc/index.rst +++ b/boards/nuvoton/numaker_pfm_m467/doc/index.rst @@ -1,7 +1,4 @@ -.. _nuvoton_pfm_m467: - -NUVOTON NUMAKER PFM M467 -######################## +.. zephyr:board:: numaker_pfm_m467 Overview ******** @@ -10,11 +7,6 @@ The NuMaker PFM M467 is an Internet of Things (IoT) application focused platform specially developed by Nuvoton. The PFM-M467 is based on the NuMicro® M467 Ethernet series MCU with ARM® -Cortex®-M4F core. -.. image:: ./pfm_m467.jpeg - :width: 720px - :align: center - :alt: PFM-M467 - Features: ========= - 32-bit Arm Cortex®-M4 M467HJHAE MCU diff --git a/boards/nuvoton/numaker_pfm_m487/doc/index.rst b/boards/nuvoton/numaker_pfm_m487/doc/index.rst index 034fac9a86759..ce0e583bf301f 100644 --- a/boards/nuvoton/numaker_pfm_m487/doc/index.rst +++ b/boards/nuvoton/numaker_pfm_m487/doc/index.rst @@ -1,7 +1,4 @@ -.. _nuvoton_pfm_m487: - -NUVOTON NUMAKER PFM M487 -######################## +.. zephyr:board:: numaker_pfm_m487 Overview ******** @@ -10,10 +7,6 @@ The NuMaker PFM M487 is an Internet of Things (IoT) application focused platform specially developed by Nuvoton. The PFM-M487 is based on the NuMicro® M487 Ethernet series MCU with ARM® -Cortex®-M4F core. -.. image:: pfm_m487.jpg - :align: center - :alt: PFM-M487 - Features: ========= - 32-bit Arm Cortex®-M4 M487JIDAE MCU diff --git a/doc/releases/release-notes-3.7.rst b/doc/releases/release-notes-3.7.rst index e7c54a52e210a..fb8b1b5922125 100644 --- a/doc/releases/release-notes-3.7.rst +++ b/doc/releases/release-notes-3.7.rst @@ -431,7 +431,7 @@ Boards & SoC Support * Added support for :zephyr:board:`Analog Devices MAX32655FTHR `: ``max32655fthr``. * Added support for :zephyr:board:`Analog Devices AD-APARD32690-SL `: ``ad_apard32690_sl``. * Added support for :zephyr:board:`Infineon Technologies CYW920829M2EVK-02 `: ``cyw920829m2evk_02``. - * Added support for :ref:`Nuvoton Numaker M2L31KI board `: ``numaker_m2l31ki``. + * Added support for :zephyr:board:`Nuvoton Numaker M2L31KI board `: ``numaker_m2l31ki``. * Added support for :zephyr:board:`Espressif ESP32-S2 DevKit-C `: ``esp32s2_devkitc``. * Added support for :zephyr:board:`Espressif ESP32-S3 DevKit-C `: ``esp32s3_devkitc``. * Added support for :zephyr:board:`Espressif ESP32-C6 DevKit-C `: ``esp32c6_devkitc``. diff --git a/samples/sensor/adc_cmp_npcx/README.rst b/samples/sensor/adc_cmp_npcx/README.rst index 3fe5ad8562cac..d6a318a5a2bbd 100644 --- a/samples/sensor/adc_cmp_npcx/README.rst +++ b/samples/sensor/adc_cmp_npcx/README.rst @@ -8,7 +8,7 @@ Overview ******** This sample show how to use the NPCX ADC Comparator driver. The -sample supports the :ref:`npcx9m6f_evb`. +sample supports the :zephyr:board:`npcx9m6f_evb`. This application is a voltage comparator with hysteresis, upper limit is set at 1 V while lower limit is 250 mV. Initially configured to detect @@ -17,7 +17,7 @@ upper limit. Building and Running ******************** -Build the application for the :ref:`npcx9m6f_evb` board, and provide voltage +Build the application for the :zephyr:board:`npcx9m6f_evb` board, and provide voltage to ADC channel 8, when voltages cross upper/lower limits, detection messages will be printed. From d885957fe81669764d786f6a09578b932a932375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 15:05:51 +0200 Subject: [PATCH 1577/4482] boards: nxp: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the NXP boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/nxp/frdm_k22f/doc/index.rst | 11 ++--------- boards/nxp/frdm_k64f/doc/index.rst | 9 +-------- boards/nxp/frdm_k82f/doc/index.rst | 11 ++--------- boards/nxp/frdm_ke15z/doc/index.rst | 9 +-------- boards/nxp/frdm_ke17z/doc/index.rst | 11 +---------- boards/nxp/frdm_ke17z512/doc/index.rst | 11 +---------- boards/nxp/frdm_kl25z/doc/index.rst | 10 +--------- boards/nxp/frdm_kw41z/doc/index.rst | 9 +-------- boards/nxp/frdm_mcxa156/doc/index.rst | 9 +-------- boards/nxp/frdm_mcxc242/doc/index.rst | 10 +--------- boards/nxp/frdm_mcxc444/doc/index.rst | 10 +--------- boards/nxp/frdm_mcxn236/doc/index.rst | 9 +-------- boards/nxp/frdm_mcxn947/doc/index.rst | 9 +-------- boards/nxp/frdm_mcxw71/doc/index.rst | 9 +-------- boards/nxp/frdm_rw612/doc/index.rst | 5 +---- boards/nxp/imx8mm_evk/doc/index.rst | 5 +---- boards/nxp/imx8mn_evk/doc/index.rst | 5 +---- boards/nxp/imx8mp_evk/doc/index.rst | 5 +---- boards/nxp/imx8mq_evk/doc/index.rst | 9 +-------- boards/nxp/imx93_evk/doc/index.rst | 5 +---- boards/nxp/imx95_evk/doc/index.rst | 5 +---- boards/nxp/lpcxpresso11u68/doc/index.rst | 9 +-------- boards/nxp/lpcxpresso51u68/doc/index.rst | 9 +-------- boards/nxp/lpcxpresso54114/doc/index.rst | 9 +-------- boards/nxp/lpcxpresso55s06/doc/index.rst | 11 ++--------- boards/nxp/lpcxpresso55s16/doc/index.rst | 11 ++--------- boards/nxp/lpcxpresso55s28/doc/index.rst | 11 ++--------- boards/nxp/lpcxpresso55s36/doc/index.rst | 11 ++--------- boards/nxp/lpcxpresso55s69/doc/index.rst | 9 +-------- boards/nxp/ls1046ardb/doc/index.rst | 5 +---- boards/nxp/mimxrt1010_evk/doc/index.rst | 11 ++--------- boards/nxp/mimxrt1015_evk/doc/index.rst | 11 ++--------- boards/nxp/mimxrt1020_evk/doc/index.rst | 11 ++--------- boards/nxp/mimxrt1024_evk/doc/index.rst | 11 ++--------- boards/nxp/mimxrt1040_evk/doc/index.rst | 11 ++--------- boards/nxp/mimxrt1050_evk/doc/index.rst | 11 ++--------- boards/nxp/mimxrt1060_evk/doc/index.rst | 10 ++-------- boards/nxp/mimxrt1062_fmurt6/doc/index.rst | 11 ++--------- boards/nxp/mimxrt1064_evk/doc/index.rst | 9 +-------- boards/nxp/mimxrt1160_evk/doc/index.rst | 11 ++--------- boards/nxp/mimxrt1170_evk/doc/index.rst | 9 +-------- boards/nxp/mimxrt1180_evk/doc/index.rst | 9 +-------- boards/nxp/mimxrt595_evk/doc/index.rst | 10 ++-------- boards/nxp/mimxrt685_evk/doc/index.rst | 11 ++--------- boards/nxp/mr_canhubk3/doc/index.rst | 9 +-------- boards/nxp/rd_rw612_bga/doc/index.rst | 5 +---- boards/nxp/rddrone_fmuk66/doc/index.rst | 9 +-------- boards/nxp/s32z2xxdc2/doc/index.rst | 5 +---- boards/nxp/twr_ke18f/doc/index.rst | 11 +---------- boards/nxp/twr_kv58f220m/doc/index.rst | 11 +---------- boards/nxp/ucans32k1sic/doc/index.rst | 9 +-------- boards/nxp/usb_kw24d512/doc/index.rst | 5 +---- boards/nxp/vmu_rt1170/doc/index.rst | 9 +-------- boards/shields/frdm_cr20a/doc/index.rst | 2 +- boards/shields/frdm_kw41z/doc/index.rst | 4 ++-- doc/connectivity/networking/api/gptp.rst | 2 +- doc/develop/flash_debug/probes.rst | 2 +- doc/hardware/peripherals/can/shell.rst | 2 +- doc/hardware/porting/board_porting.rst | 4 ++-- doc/services/tfm/requirements.rst | 2 +- samples/drivers/can/babbling/README.rst | 2 +- samples/drivers/dac/README.rst | 6 +++--- samples/drivers/i2c/custom_target/README.rst | 2 +- samples/drivers/i2c/target_eeprom/README.rst | 2 +- samples/drivers/i2s/output/README.rst | 2 +- samples/drivers/ipm/ipm_mcux/README.rst | 8 ++++---- samples/drivers/led/is31fl3216a/README.rst | 2 +- samples/drivers/led/is31fl3733/README.rst | 2 +- samples/drivers/led/lp50xx/README.rst | 2 +- samples/drivers/video/capture/README.rst | 12 ++++++------ samples/drivers/video/tcpserversink/README.rst | 6 +++--- samples/modules/canopennode/README.rst | 4 ++-- samples/modules/lvgl/demos/README.rst | 2 +- samples/net/cloud/tagoio_http_post/README.rst | 2 +- samples/net/dhcpv4_client/README.rst | 4 ++-- samples/net/dns_resolve/README.rst | 4 ++-- samples/net/ipv4_autoconf/README.rst | 4 ++-- samples/net/telnet/README.rst | 10 +++++----- samples/sensor/fxos8700/README.rst | 6 +++--- samples/sensor/lps22hh_i3c/README.rst | 4 ++-- samples/sensor/lsm6dso_i2c_on_i3c/README.rst | 4 ++-- samples/sensor/mcux_acmp/README.rst | 12 ++++++------ samples/sensor/mcux_lpcmp/README.rst | 4 ++-- samples/sensor/tmp112/README.rst | 2 +- samples/shields/lmp90100_evb/rtd/README.rst | 2 +- samples/subsys/display/lvgl/README.rst | 6 +++--- samples/subsys/mgmt/hawkbit/README.rst | 6 +++--- samples/subsys/mgmt/updatehub/README.rst | 4 ++-- tests/drivers/can/host/README.rst | 2 +- 89 files changed, 143 insertions(+), 483 deletions(-) diff --git a/boards/nxp/frdm_k22f/doc/index.rst b/boards/nxp/frdm_k22f/doc/index.rst index 2e5ea18aab856..c150d83dcf036 100644 --- a/boards/nxp/frdm_k22f/doc/index.rst +++ b/boards/nxp/frdm_k22f/doc/index.rst @@ -1,7 +1,4 @@ -.. _frdm_k22f: - -NXP FRDM-K22F -############## +.. zephyr:board:: frdm_k22f Overview ******** @@ -19,10 +16,6 @@ MCUs. running an open source bootloader, offers options for serial communication, flash programming, and run-control debugging -.. image:: frdm_k22f.jpg - :align: center - :alt: FRDM-K22F - Hardware ******** @@ -59,7 +52,7 @@ Supported Features The frdm_k22f board configuration supports the hardware features listed below. For additional features not yet supported, please also refer to the -:ref:`frdm_k64f`, which is the superset board in NXP's Kinetis K series. +:zephyr:board:`frdm_k64f`, which is the superset board in NXP's Kinetis K series. NXP prioritizes enabling the superset board with NXP's Full Platform Support for Zephyr. Therefore, the frdm_k64f board may have additional features already supported, which can also be re-used on this frdm_k22f board: diff --git a/boards/nxp/frdm_k64f/doc/index.rst b/boards/nxp/frdm_k64f/doc/index.rst index 17af8d4cf2950..192398674c7a7 100644 --- a/boards/nxp/frdm_k64f/doc/index.rst +++ b/boards/nxp/frdm_k64f/doc/index.rst @@ -1,7 +1,4 @@ -.. _frdm_k64f: - -NXP FRDM-K64F -############## +.. zephyr:board:: frdm_k64f Overview ******** @@ -19,10 +16,6 @@ K63, and K24 MCUs. running an open source bootloader, offers options for serial communication, flash programming, and run-control debugging -.. image:: frdm_k64f.jpg - :align: center - :alt: FRDM-K64F - Hardware ******** diff --git a/boards/nxp/frdm_k82f/doc/index.rst b/boards/nxp/frdm_k82f/doc/index.rst index 9903e1b449320..4693e0dd244d0 100644 --- a/boards/nxp/frdm_k82f/doc/index.rst +++ b/boards/nxp/frdm_k82f/doc/index.rst @@ -1,7 +1,4 @@ -.. _frdm_k82f: - -NXP FRDM-K82F -############## +.. zephyr:board:: frdm_k82f Overview ******** @@ -19,10 +16,6 @@ and K82 MCUs. running an open source bootloader, offers options for serial communication, flash programming, and run-control debugging -.. image:: frdm_k82f.jpg - :align: center - :alt: FRDM-K82F - Hardware ******** @@ -60,7 +53,7 @@ Supported Features The frdm_k82f board configuration supports the hardware features listed below. For additional features not yet supported, please also refer to the -:ref:`frdm_k64f`, which is the superset board in NXP's Kinetis K series. +:zephyr:board:`frdm_k64f`, which is the superset board in NXP's Kinetis K series. NXP prioritizes enabling the superset board with NXP's Full Platform Support for Zephyr. Therefore, the frdm_k64f board may have additional features already supported, which can also be re-used on this frdm_k82f board: diff --git a/boards/nxp/frdm_ke15z/doc/index.rst b/boards/nxp/frdm_ke15z/doc/index.rst index 772de4f867860..c8d155be6fb02 100644 --- a/boards/nxp/frdm_ke15z/doc/index.rst +++ b/boards/nxp/frdm_ke15z/doc/index.rst @@ -1,7 +1,4 @@ -.. _frdm_ke15z: - -NXP FRDM-KE15Z -############## +.. zephyr:board:: frdm_ke15z Overview ******** @@ -12,10 +9,6 @@ with up to 50 channels which makes this board highly flexible for touch keys. Offers options for serial communication, flash programming, and run-control debugging. -.. figure:: frdm_ke15z.webp - :align: center - :alt: FRDM-KE15Z - Hardware ******** diff --git a/boards/nxp/frdm_ke17z/doc/index.rst b/boards/nxp/frdm_ke17z/doc/index.rst index 1f15fc99fb93a..3f9f7aa30497f 100644 --- a/boards/nxp/frdm_ke17z/doc/index.rst +++ b/boards/nxp/frdm_ke17z/doc/index.rst @@ -1,7 +1,4 @@ -.. _frdm_ke17z: - -NXP FRDM-KE17Z -############## +.. zephyr:board:: frdm_ke17z Overview ******** @@ -12,12 +9,6 @@ with up to 50 channels which makes this board highly flexible for touch keys. Offers options for serial communication, flash programming, and run-control debugging. -.. figure:: frdmke17z.webp - :align: center - :alt: FRDM-KE17Z - - FRDM-KE17Z (Credit: NXP) - Hardware ******** diff --git a/boards/nxp/frdm_ke17z512/doc/index.rst b/boards/nxp/frdm_ke17z512/doc/index.rst index ab4948307da67..09ac1d95c67b5 100644 --- a/boards/nxp/frdm_ke17z512/doc/index.rst +++ b/boards/nxp/frdm_ke17z512/doc/index.rst @@ -1,7 +1,4 @@ -.. _frdm_ke17z512: - -NXP FRDM-KE17Z512 -################## +.. zephyr:board:: frdm_ke17z512 Overview ******** @@ -11,12 +8,6 @@ MCU-based platforms. The onboard OpenSDAv2 serial and debug adapter, running an open source bootloader, offers options for serial communication, flash programming, and run-control debugging. -.. figure:: frdm_ke17z512.webp - :align: center - :alt: FRDM-KE17Z512 - - FRDM-KE17Z512 (Credit: NXP) - Hardware ******** diff --git a/boards/nxp/frdm_kl25z/doc/index.rst b/boards/nxp/frdm_kl25z/doc/index.rst index 215c476df03d6..134f577ce1e87 100644 --- a/boards/nxp/frdm_kl25z/doc/index.rst +++ b/boards/nxp/frdm_kl25z/doc/index.rst @@ -1,7 +1,4 @@ -.. _frdm_kl25z: - -NXP FRDM-KL25Z -############## +.. zephyr:board:: frdm_kl25z Overview ******** @@ -14,11 +11,6 @@ The FRDM-KL25Z features include easy access to MCU I/O, battery-ready, low-power operation, a standard-based form factor with expansion board options and a built-in debug interface for flash programming and run-control. - -.. image:: frdm_kl25z.jpg - :align: center - :alt: FRDM-KL25Z - Hardware ******** diff --git a/boards/nxp/frdm_kw41z/doc/index.rst b/boards/nxp/frdm_kw41z/doc/index.rst index b1643939f8efb..20b8368710623 100644 --- a/boards/nxp/frdm_kw41z/doc/index.rst +++ b/boards/nxp/frdm_kw41z/doc/index.rst @@ -1,7 +1,4 @@ -.. _frdm_kw41z: - -NXP FRDM-KW41Z -############## +.. zephyr:board:: frdm_kw41z Overview ******** @@ -22,10 +19,6 @@ F-antenna which can be bypassed to test via SMA connection, multiple power supply options, push/capacitive touch buttons, switches, LEDs and integrated sensors. -.. image:: frdm_kw41z.jpg - :align: center - :alt: FRDM-KW41Z - Hardware ******** diff --git a/boards/nxp/frdm_mcxa156/doc/index.rst b/boards/nxp/frdm_mcxa156/doc/index.rst index df622a40ddfda..066b75cc4a07c 100644 --- a/boards/nxp/frdm_mcxa156/doc/index.rst +++ b/boards/nxp/frdm_mcxa156/doc/index.rst @@ -1,7 +1,4 @@ -.. _frdm_mcxa156: - -NXP FRDM-MCXA156 -################ +.. zephyr:board:: frdm_mcxa156 Overview ******** @@ -13,10 +10,6 @@ an on-board MCU-Link debugger. MCX N Series are high-performance, low-power microcontrollers with intelligent peripherals and accelerators providing multi-tasking capabilities and performance efficiency. -.. image:: frdm_mcxa156.webp - :align: center - :alt: FRDM-MCXA156 - Hardware ******** diff --git a/boards/nxp/frdm_mcxc242/doc/index.rst b/boards/nxp/frdm_mcxc242/doc/index.rst index 8afb06da0fd02..feda4ecf3fabd 100644 --- a/boards/nxp/frdm_mcxc242/doc/index.rst +++ b/boards/nxp/frdm_mcxc242/doc/index.rst @@ -1,7 +1,4 @@ -.. _frdm_mcxc242: - -NXP FRDM-MCXC242 -################ +.. zephyr:board:: frdm_mcxc242 Overview ******** @@ -13,11 +10,6 @@ interfaces and on-board MCU-Link debugger. The MCXC is a general purpose ultra-low-power MCU family, providing additional memory, communications and analog peripheral. - -.. image:: frdm_mcxc242.webp - :align: center - :alt: FRDM-MCXC242 - Hardware ******** diff --git a/boards/nxp/frdm_mcxc444/doc/index.rst b/boards/nxp/frdm_mcxc444/doc/index.rst index db72f8d6fad1a..277a5a6495c26 100644 --- a/boards/nxp/frdm_mcxc444/doc/index.rst +++ b/boards/nxp/frdm_mcxc444/doc/index.rst @@ -1,7 +1,4 @@ -.. _frdm_mcxc444: - -NXP FRDM-MCXC444 -################ +.. zephyr:board:: frdm_mcxc444 Overview ******** @@ -13,11 +10,6 @@ interfaces and on-board MCU-Link debugger. The MCXC is a general purpose ultra-low-power MCU family, providing additional memory, communications and analog peripheral. - -.. image:: frdm_mcxc444.webp - :align: center - :alt: FRDM-MCXC444 - Hardware ******** diff --git a/boards/nxp/frdm_mcxn236/doc/index.rst b/boards/nxp/frdm_mcxn236/doc/index.rst index ad6a5a3982dcc..88f74619bcfcf 100644 --- a/boards/nxp/frdm_mcxn236/doc/index.rst +++ b/boards/nxp/frdm_mcxn236/doc/index.rst @@ -1,7 +1,4 @@ -.. _frdm_mcxn236: - -NXP FRDM-MCXN236 -################ +.. zephyr:board:: frdm_mcxn236 Overview ******** @@ -13,10 +10,6 @@ an on-board MCU-Link debugger. MCX N Series are high-performance, low-power microcontrollers with intelligent peripherals and accelerators providing multi-tasking capabilities and performance efficiency. -.. image:: frdm_mcxn236.webp - :align: center - :alt: FRDM-MCXN236 - Hardware ******** diff --git a/boards/nxp/frdm_mcxn947/doc/index.rst b/boards/nxp/frdm_mcxn947/doc/index.rst index 0db84d4355f96..8460ef2648ac1 100644 --- a/boards/nxp/frdm_mcxn947/doc/index.rst +++ b/boards/nxp/frdm_mcxn947/doc/index.rst @@ -1,7 +1,4 @@ -.. _frdm_mcxn947: - -NXP FRDM-MCXN947 -################ +.. zephyr:board:: frdm_mcxn947 Overview ******** @@ -13,10 +10,6 @@ an on-board MCU-Link debugger. MCX N Series are high-performance, low-power microcontrollers with intelligent peripherals and accelerators providing multi-tasking capabilities and performance efficiency. -.. image:: frdm_mcxn947.webp - :align: center - :alt: FRDM-MCXN947 - Hardware ******** diff --git a/boards/nxp/frdm_mcxw71/doc/index.rst b/boards/nxp/frdm_mcxw71/doc/index.rst index be543225a4347..0910086e37b1f 100644 --- a/boards/nxp/frdm_mcxw71/doc/index.rst +++ b/boards/nxp/frdm_mcxw71/doc/index.rst @@ -1,7 +1,4 @@ -.. _frdm_mcxw71: - -NXP FRDM-MCXW71 -################ +.. zephyr:board:: frdm_mcxw71 Overview ******** @@ -19,10 +16,6 @@ LE. The independent radio subsystem, with a dedicated core and memory, offloads the main CPU, preserving it for the primary application and allowing firmware updates to support future wireless standards. -.. image:: frdm_mcxw71.webp - :align: center - :alt: FRDM-MCXW71 - Hardware ******** diff --git a/boards/nxp/frdm_rw612/doc/index.rst b/boards/nxp/frdm_rw612/doc/index.rst index 76bec1d343487..c07d5b49878c7 100644 --- a/boards/nxp/frdm_rw612/doc/index.rst +++ b/boards/nxp/frdm_rw612/doc/index.rst @@ -1,7 +1,4 @@ -.. _frdm_rw612: - -NXP FRDM_RW612 -############## +.. zephyr:board:: frdm_rw612 Overview ******** diff --git a/boards/nxp/imx8mm_evk/doc/index.rst b/boards/nxp/imx8mm_evk/doc/index.rst index c557fb7bd01e9..6984f06a8e6db 100644 --- a/boards/nxp/imx8mm_evk/doc/index.rst +++ b/boards/nxp/imx8mm_evk/doc/index.rst @@ -1,7 +1,4 @@ -.. _imx8mm_evk: - -NXP i.MX8MM EVK -############### +.. zephyr:board:: imx8mm_evk Overview ******** diff --git a/boards/nxp/imx8mn_evk/doc/index.rst b/boards/nxp/imx8mn_evk/doc/index.rst index d23a6efe7020b..265c30be41c13 100644 --- a/boards/nxp/imx8mn_evk/doc/index.rst +++ b/boards/nxp/imx8mn_evk/doc/index.rst @@ -1,7 +1,4 @@ -.. _imx8mn_evk: - -NXP i.MX8MN EVK (Cortex-A53) -############################ +.. zephyr:board:: imx8mn_evk Overview ******** diff --git a/boards/nxp/imx8mp_evk/doc/index.rst b/boards/nxp/imx8mp_evk/doc/index.rst index 8d1f09c28da13..7afafb3359356 100644 --- a/boards/nxp/imx8mp_evk/doc/index.rst +++ b/boards/nxp/imx8mp_evk/doc/index.rst @@ -1,7 +1,4 @@ -.. _imx8mp_evk: - -NXP i.MX8MP EVK -############### +.. zephyr:board:: imx8mp_evk Overview ******** diff --git a/boards/nxp/imx8mq_evk/doc/index.rst b/boards/nxp/imx8mq_evk/doc/index.rst index 8f21c6e9328cd..6022aeb66678a 100644 --- a/boards/nxp/imx8mq_evk/doc/index.rst +++ b/boards/nxp/imx8mq_evk/doc/index.rst @@ -1,7 +1,4 @@ -.. _mimx8mq_evk: - -NXP MIMX8MQ EVK -############### +.. zephyr:board:: imx8mq_evk Overview ******** @@ -37,10 +34,6 @@ Zephyr OS is ported to run on the Cortex®-M4 core. - JTAG 10-pin connector - MicroUSB for UART debug, two COM ports for A53 and M4 -.. image:: img/mimx8mq_evk.jpg - :align: center - :alt: MIMX8MQ EVK - More information about the board can be found at the `NXP website`_. diff --git a/boards/nxp/imx93_evk/doc/index.rst b/boards/nxp/imx93_evk/doc/index.rst index 8f9de654dcaf3..88744045727fb 100644 --- a/boards/nxp/imx93_evk/doc/index.rst +++ b/boards/nxp/imx93_evk/doc/index.rst @@ -1,7 +1,4 @@ -.. _imx93_evk: - -NXP i.MX93 EVK -############## +.. zephyr:board:: imx93_evk Overview ******** diff --git a/boards/nxp/imx95_evk/doc/index.rst b/boards/nxp/imx95_evk/doc/index.rst index 880e6da524701..1acf8cc536f5d 100644 --- a/boards/nxp/imx95_evk/doc/index.rst +++ b/boards/nxp/imx95_evk/doc/index.rst @@ -1,7 +1,4 @@ -.. _imx95_evk: - -NXP i.MX95 EVK -############## +.. zephyr:board:: imx95_evk Overview ******** diff --git a/boards/nxp/lpcxpresso11u68/doc/index.rst b/boards/nxp/lpcxpresso11u68/doc/index.rst index 244fb7427b0ad..4fe74d245c83f 100644 --- a/boards/nxp/lpcxpresso11u68/doc/index.rst +++ b/boards/nxp/lpcxpresso11u68/doc/index.rst @@ -1,7 +1,4 @@ -.. _lpcxpresso11u68: - -NXP LPCXpresso11U68 -################### +.. zephyr:board:: lpcxpresso11u68 Overview ******** @@ -9,10 +6,6 @@ Overview The LPCXpresso11u68 development board uses an NXP LPC11U68 MCU based on an ARM Cortex-M0+ core. -.. figure:: lpcxpresso11u68.jpg - :align: center - :alt: LPCXpresso11U68 - Hardware ******** diff --git a/boards/nxp/lpcxpresso51u68/doc/index.rst b/boards/nxp/lpcxpresso51u68/doc/index.rst index 491aa2beab148..3246a9f939304 100644 --- a/boards/nxp/lpcxpresso51u68/doc/index.rst +++ b/boards/nxp/lpcxpresso51u68/doc/index.rst @@ -1,7 +1,4 @@ -.. _lpcxpresso51u68: - -NXP LPCXPRESSO51U68 -################### +.. zephyr:board:: lpcxpresso51u68 Overview ******** @@ -9,10 +6,6 @@ Overview The LPCXpresso51u68 development board uses an NXP LPC51U68 MCU based on an ARM CORTEX-M0+ core. -.. figure:: lpcxpresso51u68.jpg - :align: center - :alt: LPCXpresso51U68 - Hardware ******** diff --git a/boards/nxp/lpcxpresso54114/doc/index.rst b/boards/nxp/lpcxpresso54114/doc/index.rst index df2e2aabf0d68..410a052b43311 100644 --- a/boards/nxp/lpcxpresso54114/doc/index.rst +++ b/boards/nxp/lpcxpresso54114/doc/index.rst @@ -1,7 +1,4 @@ -.. _lpcxpresso54114: - -NXP LPCXPRESSO54114 -################### +.. zephyr:board:: lpcxpresso54114 Overview ******** @@ -13,10 +10,6 @@ microcontrollers. LPCXpresso is an end-to-end solution enabling embedded engineers to develop their applications from initial evaluation to final production. -.. image:: lpcxpresso54114_m4.jpg - :align: center - :alt: LPCXPRESSO54114 - Hardware ******** diff --git a/boards/nxp/lpcxpresso55s06/doc/index.rst b/boards/nxp/lpcxpresso55s06/doc/index.rst index 10a1b6728ca58..a4f5234aa70a4 100644 --- a/boards/nxp/lpcxpresso55s06/doc/index.rst +++ b/boards/nxp/lpcxpresso55s06/doc/index.rst @@ -1,7 +1,4 @@ -.. _lpcxpresso55s06: - -NXP LPCXpresso55S06 -################### +.. zephyr:board:: lpcxpresso55s06 Overview ******** @@ -13,10 +10,6 @@ with additional expansion ports around the Arduino footprint, along with a PMod/host interface port and MikroElektronika Click module site. -.. image:: lpcxpress55s06.jpg - :align: center - :alt: LPCXpresso55S06 - Hardware ******** @@ -45,7 +38,7 @@ Supported Features The lpcxpresso55s06 board configuration supports the hardware features listed below. For additional features not yet supported, please also refer to the -:ref:`lpcxpresso55s69` , which is the superset board in NXP's LPC55xx series. +:zephyr:board:`lpcxpresso55s69` , which is the superset board in NXP's LPC55xx series. NXP prioritizes enabling the superset board with NXP's Full Platform Support for Zephyr. Therefore, the lpcxpresso55s69 board may have additional features already supported, which can also be re-used on this lpcxpresso55s06 board: diff --git a/boards/nxp/lpcxpresso55s16/doc/index.rst b/boards/nxp/lpcxpresso55s16/doc/index.rst index 8089e3de0ef7a..f38fd083c8a3b 100644 --- a/boards/nxp/lpcxpresso55s16/doc/index.rst +++ b/boards/nxp/lpcxpresso55s16/doc/index.rst @@ -1,7 +1,4 @@ -.. _lpcxpresso55s16: - -NXP LPCXpresso55S16 -################### +.. zephyr:board:: lpcxpresso55s16 Overview ******** @@ -13,10 +10,6 @@ with additional expansion ports around the Arduino footprint, along with a PMod/host interface port and MikroElektronika Click module site. -.. image:: lpcxpresso55S16.jpg - :align: center - :alt: LPCXpresso55S16 - Hardware ******** @@ -50,7 +43,7 @@ Supported Features The lpcxpresso55s16 board configuration supports the hardware features listed below. For additional features not yet supported, please also refer to the -:ref:`lpcxpresso55s69` , which is the superset board in NXP's LPC55xx series. +:zephyr:board:`lpcxpresso55s69` , which is the superset board in NXP's LPC55xx series. NXP prioritizes enabling the superset board with NXP's Full Platform Support for Zephyr. Therefore, the lpcxpresso55s69 board may have additional features already supported, which can also be re-used on this lpcxpresso55s16 board: diff --git a/boards/nxp/lpcxpresso55s28/doc/index.rst b/boards/nxp/lpcxpresso55s28/doc/index.rst index df40571a18b45..b0cea1547bed2 100644 --- a/boards/nxp/lpcxpresso55s28/doc/index.rst +++ b/boards/nxp/lpcxpresso55s28/doc/index.rst @@ -1,7 +1,4 @@ -.. _lpcxpresso55s28: - -NXP LPCXpresso55S28 -################### +.. zephyr:board:: lpcxpresso55s28 Overview ******** @@ -12,10 +9,6 @@ architecture. The board includes a high-performance onboard debug probe, audio subsystem and accelerometer, with several options for adding off-the-shelf add-on boards for networking, sensors, displays, and other interfaces. -.. image:: LPC55S28-EVK.jpg - :align: center - :alt: LPCXpresso55S28 - Hardware ******** @@ -50,7 +43,7 @@ Supported Features The lpcxpresso55s28 board configuration supports the hardware features listed below. For additional features not yet supported, please also refer to the -:ref:`lpcxpresso55s69` , which is the superset board in NXP's LPC55xx series. +:zephyr:board:`lpcxpresso55s69` , which is the superset board in NXP's LPC55xx series. NXP prioritizes enabling the superset board with NXP's Full Platform Support for Zephyr. Therefore, the lpcxpresso55s69 board may have additional features already supported, which can also be re-used on this lpcxpresso55s28 board: diff --git a/boards/nxp/lpcxpresso55s36/doc/index.rst b/boards/nxp/lpcxpresso55s36/doc/index.rst index 32c7993c3a3e5..cf5a1848833bb 100644 --- a/boards/nxp/lpcxpresso55s36/doc/index.rst +++ b/boards/nxp/lpcxpresso55s36/doc/index.rst @@ -1,7 +1,4 @@ -.. _lpcxpresso55s36: - -NXP LPCXpresso55S36 -################### +.. zephyr:board:: lpcxpresso55s36 Overview ******** @@ -13,10 +10,6 @@ with additional expansion ports around the Arduino footprint, along with a PMod/host interface port and MikroElektronika Click module site. -.. image:: lpcxpresso55S36.jpg - :align: center - :alt: LPCXpresso55S36 - Hardware ******** @@ -52,7 +45,7 @@ family of MCUs. This board is a focus for NXP's Full Platform Support for Zephyr, to better enable the entire LPC55(S)3x family. NXP prioritizes enabling this board with new support for Zephyr features. The lpcxpresso55s36 board configuration supports the hardware features below. Another similar superset -board is the :ref:`lpcxpresso55s69`, and that board may have additional features +board is the :zephyr:board:`lpcxpresso55s69`, and that board may have additional features already supported, which can also be re-used on this lpcxpresso55s36 board: +-----------+------------+-------------------------------------+ diff --git a/boards/nxp/lpcxpresso55s69/doc/index.rst b/boards/nxp/lpcxpresso55s69/doc/index.rst index 85336fa285550..b4a7328af318a 100644 --- a/boards/nxp/lpcxpresso55s69/doc/index.rst +++ b/boards/nxp/lpcxpresso55s69/doc/index.rst @@ -1,7 +1,4 @@ -.. _lpcxpresso55s69: - -NXP LPCXPRESSO55S69 -################### +.. zephyr:board:: lpcxpresso55s69 Overview ******** @@ -12,10 +9,6 @@ architecture. The board includes a high performance onboard debug probe, audio subsystem, and accelerometer, with several options for adding off-the-shelf add-on boards for networking, sensors, displays, and other interfaces. -.. image:: lpcxpresso55s69.jpg - :align: center - :alt: LPCXPRESSO55S69 - Hardware ******** diff --git a/boards/nxp/ls1046ardb/doc/index.rst b/boards/nxp/ls1046ardb/doc/index.rst index c6065c4f312a5..28ad3259ed065 100644 --- a/boards/nxp/ls1046ardb/doc/index.rst +++ b/boards/nxp/ls1046ardb/doc/index.rst @@ -1,7 +1,4 @@ -.. _nxp_ls1046ardb: - -NXP LS1046A RDB -################################# +.. zephyr:board:: ls1046ardb Overview ******** diff --git a/boards/nxp/mimxrt1010_evk/doc/index.rst b/boards/nxp/mimxrt1010_evk/doc/index.rst index 6422927371ec5..7b2d5d8c5ef9a 100644 --- a/boards/nxp/mimxrt1010_evk/doc/index.rst +++ b/boards/nxp/mimxrt1010_evk/doc/index.rst @@ -1,7 +1,4 @@ -.. _mimxrt1010_evk: - -NXP MIMXRT1010-EVK -################## +.. zephyr:board:: mimxrt1010_evk Overview ******** @@ -11,10 +8,6 @@ series by providing the lowest-cost LQFP package option, combined with the high performance and ease-of-use known throughout the entire i.MX RT series. This device is fully supported by NXP’s MCUXpresso Software and Tools. -.. image:: mimxrt1010_evk.jpg - :align: center - :alt: MIMXRT1010-EVK - Hardware ******** @@ -69,7 +62,7 @@ Supported Features The mimxrt1010_evk board configuration supports the hardware features listed below. For additional features not yet supported, please also refer to the -:ref:`mimxrt1064_evk` , which is the superset board in NXP's i.MX RT10xx family. +:zephyr:board:`mimxrt1064_evk` , which is the superset board in NXP's i.MX RT10xx family. NXP prioritizes enabling the superset board with NXP's Full Platform Support for Zephyr. Therefore, the mimxrt1064_evk board may have additional features already supported, which can also be re-used on this mimxrt1010_evk board: diff --git a/boards/nxp/mimxrt1015_evk/doc/index.rst b/boards/nxp/mimxrt1015_evk/doc/index.rst index 7e22bd4c5541f..a4bf7bf6756e1 100644 --- a/boards/nxp/mimxrt1015_evk/doc/index.rst +++ b/boards/nxp/mimxrt1015_evk/doc/index.rst @@ -1,7 +1,4 @@ -.. _mimxrt1015_evk: - -NXP MIMXRT1015-EVK -################## +.. zephyr:board:: mimxrt1015_evk Overview ******** @@ -11,10 +8,6 @@ high-performance feature set in low-cost LQFP packages, further simplifying board design and layout for customers. The i.MX RT1015 runs on the Arm® Cortex®-M7 core at 500 MHz. -.. image:: mimxrt1015_evk.jpg - :align: center - :alt: MIMXRT1015-EVK - Hardware ******** @@ -69,7 +62,7 @@ Supported Features The mimxrt1015_evk board configuration supports the hardware features listed below. For additional features not yet supported, please also refer to the -:ref:`mimxrt1064_evk` , which is the superset board in NXP's i.MX RT10xx family. +:zephyr:board:`mimxrt1064_evk` , which is the superset board in NXP's i.MX RT10xx family. NXP prioritizes enabling the superset board with NXP's Full Platform Support for Zephyr. Therefore, the mimxrt1064_evk board may have additional features already supported, which can also be re-used on this mimxrt1015_evk board: diff --git a/boards/nxp/mimxrt1020_evk/doc/index.rst b/boards/nxp/mimxrt1020_evk/doc/index.rst index 0057dcd58ab2f..88e62be8b9e82 100644 --- a/boards/nxp/mimxrt1020_evk/doc/index.rst +++ b/boards/nxp/mimxrt1020_evk/doc/index.rst @@ -1,7 +1,4 @@ -.. _mimxrt1020_evk: - -NXP MIMXRT1020-EVK -################## +.. zephyr:board:: mimxrt1020_evk Overview ******** @@ -11,10 +8,6 @@ high-performance feature set in low-cost LQFP packages, further simplifying board design and layout for customers. The i.MX RT1020 runs on the Arm® Cortex®-M7 core at 500 MHz. -.. image:: mimxrt1020_evk.jpg - :align: center - :alt: MIMXRT1020-EVK - Hardware ******** @@ -81,7 +74,7 @@ Supported Features The mimxrt1020_evk board configuration supports the hardware features listed below. For additional features not yet supported, please also refer to the -:ref:`mimxrt1064_evk` , which is the superset board in NXP's i.MX RT10xx family. +:zephyr:board:`mimxrt1064_evk` , which is the superset board in NXP's i.MX RT10xx family. NXP prioritizes enabling the superset board with NXP's Full Platform Support for Zephyr. Therefore, the mimxrt1064_evk board may have additional features already supported, which can also be re-used on this mimxrt1020_evk board: diff --git a/boards/nxp/mimxrt1024_evk/doc/index.rst b/boards/nxp/mimxrt1024_evk/doc/index.rst index 10010775a10c1..62a5a987128ac 100644 --- a/boards/nxp/mimxrt1024_evk/doc/index.rst +++ b/boards/nxp/mimxrt1024_evk/doc/index.rst @@ -1,7 +1,4 @@ -.. _mimxrt1024_evk: - -NXP MIMXRT1024-EVK -################## +.. zephyr:board:: mimxrt1024_evk Overview ******** @@ -11,10 +8,6 @@ high-performance feature set in low-cost LQFP packages, further simplifying board design and layout for customers. The i.MX RT1024 runs on the Arm® Cortex®-M7 core at 500 MHz. -.. image:: mimxrt1024_evk.jpg - :align: center - :alt: MIMXRT1024-EVK - Hardware ******** @@ -82,7 +75,7 @@ Supported Features The mimxrt1024_evk board configuration supports the hardware features listed below. For additional features not yet supported, please also refer to the -:ref:`mimxrt1064_evk` , which is the superset board in NXP's i.MX RT10xx family. +:zephyr:board:`mimxrt1064_evk` , which is the superset board in NXP's i.MX RT10xx family. NXP prioritizes enabling the superset board with NXP's Full Platform Support for Zephyr. Therefore, the mimxrt1064_evk board may have additional features already supported, which can also be re-used on this mimxrt1024_evk board: diff --git a/boards/nxp/mimxrt1040_evk/doc/index.rst b/boards/nxp/mimxrt1040_evk/doc/index.rst index 21c7d53868484..8f9f4edf8da21 100644 --- a/boards/nxp/mimxrt1040_evk/doc/index.rst +++ b/boards/nxp/mimxrt1040_evk/doc/index.rst @@ -1,7 +1,4 @@ -.. _mimxrt1040_evk: - -NXP MIMXRT1040-EVK -################## +.. zephyr:board:: mimxrt1040_evk Overview ******** @@ -12,10 +9,6 @@ extended temperature range up to 125° C. The i.MX RT1040 MCU has a compact 2-layer PCB design. The i.MX RT1040 MCUs run on the Arm® Cortex®-M7 core at 600 MHz. -.. image:: mimxrt1040_evk.jpg - :align: center - :alt: MIMXRT1040-EVK - Hardware ******** @@ -91,7 +84,7 @@ Supported Features The mimxrt1040_evk board configuration supports the hardware features listed below. For additional features not yet supported, please also refer to the -:ref:`mimxrt1064_evk` , which is the superset board in NXP's i.MX RT10xx family. +:zephyr:board:`mimxrt1064_evk` , which is the superset board in NXP's i.MX RT10xx family. NXP prioritizes enabling the superset board with NXP's Full Platform Support for Zephyr. Therefore, the mimxrt1064_evk board may have additional features already supported, which can also be re-used on this mimxrt1040_evk board: diff --git a/boards/nxp/mimxrt1050_evk/doc/index.rst b/boards/nxp/mimxrt1050_evk/doc/index.rst index 19deec55f09ab..71e4fd4b96722 100644 --- a/boards/nxp/mimxrt1050_evk/doc/index.rst +++ b/boards/nxp/mimxrt1050_evk/doc/index.rst @@ -1,7 +1,4 @@ -.. _mimxrt1050_evk: - -NXP MIMXRT1050-EVK -################## +.. zephyr:board:: mimxrt1050_evk Overview ******** @@ -17,10 +14,6 @@ and camera sensors. As with other i.MX processors, i.MX RT1050 also has rich audio and video features, including LCD display, basic 2D graphics, camera interface, SPDIF, and I2S audio interface. -.. image:: mimxrt1050_evk.jpg - :align: center - :alt: MIMXRT1050-EVK - Hardware ******** @@ -104,7 +97,7 @@ Supported Features The mimxrt1050_evk board configuration supports the hardware features listed below. For additional features not yet supported, please also refer to the -:ref:`mimxrt1064_evk` , which is the superset board in NXP's i.MX RT10xx family. +:zephyr:board:`mimxrt1064_evk` , which is the superset board in NXP's i.MX RT10xx family. NXP prioritizes enabling the superset board with NXP's Full Platform Support for Zephyr. Therefore, the mimxrt1064_evk board may have additional features already supported, which can also be re-used on this mimxrt1050_evk board: diff --git a/boards/nxp/mimxrt1060_evk/doc/index.rst b/boards/nxp/mimxrt1060_evk/doc/index.rst index e17f57ee77f4c..a28a059ae2b90 100644 --- a/boards/nxp/mimxrt1060_evk/doc/index.rst +++ b/boards/nxp/mimxrt1060_evk/doc/index.rst @@ -1,7 +1,4 @@ -.. _mimxrt1060_evk: - -NXP MIMXRT1060-EVK -################## +.. zephyr:board:: mimxrt1060_evk Overview ******** @@ -15,9 +12,6 @@ ideal for real-time applications such as High-Speed GPIO, CAN FD, and synchronous parallel NAND/NOR/PSRAM controller. The i.MX RT1060 runs on the Arm® Cortex-M7® core up to 600 MHz. -.. image:: mimxrt1060_evk.jpg - :align: center - :alt: MIMXRT1060-EVK Hardware ******** @@ -103,7 +97,7 @@ Supported Features The mimxrt1060_evk board configuration supports the hardware features listed below. For additional features not yet supported, please also refer to the -:ref:`mimxrt1064_evk` , which is the superset board in NXP's i.MX RT10xx family. +:zephyr:board:`mimxrt1064_evk` , which is the superset board in NXP's i.MX RT10xx family. NXP prioritizes enabling the superset board with NXP's Full Platform Support for Zephyr. Therefore, the mimxrt1064_evk board may have additional features already supported, which can also be re-used on this mimxrt1060_evk board: diff --git a/boards/nxp/mimxrt1062_fmurt6/doc/index.rst b/boards/nxp/mimxrt1062_fmurt6/doc/index.rst index e587a8c508721..25dd714bf73b5 100644 --- a/boards/nxp/mimxrt1062_fmurt6/doc/index.rst +++ b/boards/nxp/mimxrt1062_fmurt6/doc/index.rst @@ -1,7 +1,4 @@ -.. _fmurt6: - -NXP FMURT6 -################## +.. zephyr:board:: mimxrt1062_fmurt6 Overview ******** @@ -15,10 +12,6 @@ ideal for real-time applications such as High-Speed GPIO, CAN FD, and synchronous parallel NAND/NOR/PSRAM controller. The i.MX RT1062 runs on the Arm® Cortex-M7® core up to 600 MHz. -.. image:: mimxrt1062_fmurt6.jpg - :align: center - :alt: MIMXRT1062_FMURT6 - Hardware ******** @@ -77,7 +70,7 @@ Supported Features The mimxrt1062_fmurt6 board configuration supports the hardware features listed below. For additional features not yet supported, please also refer to the -:ref:`mimxrt1064_evk` , which is the superset board in NXP's i.MX RT10xx family. +:zephyr:board:`mimxrt1064_evk` , which is the superset board in NXP's i.MX RT10xx family. NXP prioritizes enabling the superset board with NXP's Full Platform Support for Zephyr. Therefore, the mimxrt1064_evk board may have additional features already supported, which can also be re-used on this mimxrt1060_evk board: diff --git a/boards/nxp/mimxrt1064_evk/doc/index.rst b/boards/nxp/mimxrt1064_evk/doc/index.rst index 4f6fab6f0f646..865b1c2764fc8 100644 --- a/boards/nxp/mimxrt1064_evk/doc/index.rst +++ b/boards/nxp/mimxrt1064_evk/doc/index.rst @@ -1,7 +1,4 @@ -.. _mimxrt1064_evk: - -NXP MIMXRT1064-EVK -################## +.. zephyr:board:: mimxrt1064_evk Overview ******** @@ -14,10 +11,6 @@ ideal for real-time applications such as High-Speed GPIO, CAN FD, and synchronous parallel NAND/NOR/PSRAM controller. The i.MX RT1064 runs on the Arm® Cortex-M7® core up to 600 MHz. -.. image:: mimxrt1064_evk.jpg - :align: center - :alt: MIMXRT1064-EVK - Hardware ******** diff --git a/boards/nxp/mimxrt1160_evk/doc/index.rst b/boards/nxp/mimxrt1160_evk/doc/index.rst index 5b8a110d1b01e..c37185fb6e5ad 100644 --- a/boards/nxp/mimxrt1160_evk/doc/index.rst +++ b/boards/nxp/mimxrt1160_evk/doc/index.rst @@ -1,7 +1,4 @@ -.. _mimxrt1160_evk: - -NXP MIMXRT1160-EVK -################## +.. zephyr:board:: mimxrt1160_evk Overview ******** @@ -11,10 +8,6 @@ Cortex-M4 at 240 MHz. The i.MX RT1160 MCU offers support over a wide temperature range and is qualified for consumer, industrial and automotive markets. -.. image:: mimxrt1160_evk.jpg - :align: center - :alt: MIMXRT1160-EVK - Hardware ******** @@ -100,7 +93,7 @@ Supported Features The mimxrt1160_evk board configuration supports the hardware features listed below. For additional features not yet supported, please also refer to the -:ref:`mimxrt1170_evk` , which is the superset board in NXP's i.MX RT11xx family. +:zephyr:board:`mimxrt1170_evk` , which is the superset board in NXP's i.MX RT11xx family. NXP prioritizes enabling the superset board with NXP's Full Platform Support for Zephyr. Therefore, the mimxrt1170_evk board may have additional features already supported, which can also be re-used on this mimxrt1160_evk board: diff --git a/boards/nxp/mimxrt1170_evk/doc/index.rst b/boards/nxp/mimxrt1170_evk/doc/index.rst index 4ea519aea858d..870d7da7b637b 100644 --- a/boards/nxp/mimxrt1170_evk/doc/index.rst +++ b/boards/nxp/mimxrt1170_evk/doc/index.rst @@ -1,7 +1,4 @@ -.. _mimxrt1170_evk: - -NXP MIMXRT1170-EVK/EVKB -####################### +.. zephyr:board:: mimxrt1170_evk Overview ******** @@ -11,10 +8,6 @@ at 400 MHz. The i.MX RT1170 MCU offers support over a wide temperature range and is qualified for consumer, industrial and automotive markets. Zephyr supports the initial revision of this EVK, as well as rev EVKB. -.. image:: mimxrt1170_evk.jpg - :align: center - :alt: MIMXRT1170-EVK - Hardware ******** diff --git a/boards/nxp/mimxrt1180_evk/doc/index.rst b/boards/nxp/mimxrt1180_evk/doc/index.rst index e64a2afd933e3..459f071943638 100644 --- a/boards/nxp/mimxrt1180_evk/doc/index.rst +++ b/boards/nxp/mimxrt1180_evk/doc/index.rst @@ -1,7 +1,4 @@ -.. _mimxrt1180_evk: - -NXP MIMXRT1180-EVK -################## +.. zephyr:board:: mimxrt1180_evk Overview ******** @@ -11,10 +8,6 @@ Cortex-M7 at 792 MHz. The i.MX RT1180 MCU offers support over a wide temperature range and is qualified for consumer, industrial and automotive markets. -.. image:: mimxrt1180_evk.webp - :align: center - :alt: MIMXRT1180-EVK - Hardware ******** diff --git a/boards/nxp/mimxrt595_evk/doc/index.rst b/boards/nxp/mimxrt595_evk/doc/index.rst index 5465a912e8be0..899d777a6ffda 100644 --- a/boards/nxp/mimxrt595_evk/doc/index.rst +++ b/boards/nxp/mimxrt595_evk/doc/index.rst @@ -1,7 +1,4 @@ -.. _mimxrt595_evk: - -NXP MIMXRT595-EVK -################## +.. zephyr:board:: mimxrt595_evk Overview ******** @@ -16,9 +13,6 @@ i.MX RT500 MCUs provides up to 5MB of on-chip SRAM and several high-bandwidth in to access off-chip flash, including an Octal/Quad SPI interface with an on-the-fly decryption engine. -.. image:: mimxrt595_evk.jpg - :align: center - :alt: MIMXRT595-EVK Hardware ******** @@ -62,7 +56,7 @@ family of MCUs. This board is a focus for NXP's Full Platform Support for Zephyr, to better enable the entire RT5xx family. NXP prioritizes enabling this board with new support for Zephyr features. The mimxrt595_evk board configuration supports the hardware features below. Another very similar -board is the :ref:`mimxrt685_evk`, and that board may have additional features +board is the :zephyr:board:`mimxrt685_evk`, and that board may have additional features already supported, which can also be re-used on this mimxrt595_evk board: +-----------+------------+-------------------------------------+ diff --git a/boards/nxp/mimxrt685_evk/doc/index.rst b/boards/nxp/mimxrt685_evk/doc/index.rst index 4f53d6435b5b4..ebd1d9c1d31d3 100644 --- a/boards/nxp/mimxrt685_evk/doc/index.rst +++ b/boards/nxp/mimxrt685_evk/doc/index.rst @@ -1,7 +1,4 @@ -.. _mimxrt685_evk: - -NXP MIMXRT685-EVK -################## +.. zephyr:board:: mimxrt685_evk Overview ******** @@ -17,10 +14,6 @@ The i.MX RT600 family provides up to 4.5MB of on-chip SRAM and several high-bandwidth interfaces to access off-chip flash, including an Octal/Quad SPI interface with an on-the-fly decryption engine. -.. image:: mimxrt685_evk.jpg - :align: center - :alt: MIMXRT685-EVK - Hardware ******** @@ -59,7 +52,7 @@ family of MCUs. This board is a focus for NXP's Full Platform Support for Zephyr, to better enable the entire RT6xx family. NXP prioritizes enabling this board with new support for Zephyr features. The mimxrt685_evk board configuration supports the hardware features below. Another very similar -board is the :ref:`mimxrt595_evk`, and that board may have additional features +board is the :zephyr:board:`mimxrt595_evk`, and that board may have additional features already supported, which can also be re-used on this mimxrt685_evk board: +-----------+------------+-------------------------------------+ diff --git a/boards/nxp/mr_canhubk3/doc/index.rst b/boards/nxp/mr_canhubk3/doc/index.rst index 1de065e202a5e..fcb813b882d70 100644 --- a/boards/nxp/mr_canhubk3/doc/index.rst +++ b/boards/nxp/mr_canhubk3/doc/index.rst @@ -1,7 +1,4 @@ -.. _mr_canhubk3: - -NXP MR-CANHUBK3 -############### +.. zephyr:board:: mr_canhubk3 Overview ******** @@ -11,10 +8,6 @@ as autonomous mobile robots (AMR) and automated guided vehicles (AGV). It features an `NXP S32K344`_ general-purpose automotive microcontroller based on an Arm Cortex-M7 core (Lock-Step). -.. image:: img/mr_canhubk3_top.jpg - :align: center - :alt: NXP MR-CANHUBK3 (TOP) - Hardware ******** diff --git a/boards/nxp/rd_rw612_bga/doc/index.rst b/boards/nxp/rd_rw612_bga/doc/index.rst index ed565bfec75c6..c1ba78d3f64f0 100644 --- a/boards/nxp/rd_rw612_bga/doc/index.rst +++ b/boards/nxp/rd_rw612_bga/doc/index.rst @@ -1,7 +1,4 @@ -.. _rd_rw612_bga: - -NXP RD-RW612-BGA -################ +.. zephyr:board:: rd_rw612_bga Overview ******** diff --git a/boards/nxp/rddrone_fmuk66/doc/index.rst b/boards/nxp/rddrone_fmuk66/doc/index.rst index e938c685ba73d..f83f310974b51 100644 --- a/boards/nxp/rddrone_fmuk66/doc/index.rst +++ b/boards/nxp/rddrone_fmuk66/doc/index.rst @@ -1,7 +1,4 @@ -.. _rddrone_fmuk66: - -NXP RDDRONE-FMUK66 -################## +.. zephyr:board:: rddrone_fmuk66 Overview ******** @@ -11,10 +8,6 @@ connectors and a Kinetis K66 on board. - Comes with a J-Link Edu Mini for programming and UART console. -.. image:: rddrone_fmuk66.jpg - :align: center - :alt: RDDRONE-FMUK66 - Hardware ******** diff --git a/boards/nxp/s32z2xxdc2/doc/index.rst b/boards/nxp/s32z2xxdc2/doc/index.rst index 9200246fc5612..9cb0972bf8fc7 100644 --- a/boards/nxp/s32z2xxdc2/doc/index.rst +++ b/boards/nxp/s32z2xxdc2/doc/index.rst @@ -1,7 +1,4 @@ -.. _s32z2xxdc2: - -NXP X-S32Z27X-DC (DC2) -###################### +.. zephyr:board:: s32z2xxdc2 Overview ******** diff --git a/boards/nxp/twr_ke18f/doc/index.rst b/boards/nxp/twr_ke18f/doc/index.rst index dbde9a7282be3..5bdf3dcf51e88 100644 --- a/boards/nxp/twr_ke18f/doc/index.rst +++ b/boards/nxp/twr_ke18f/doc/index.rst @@ -1,7 +1,4 @@ -.. _twr_ke18f: - -NXP TWR-KE18F -############# +.. zephyr:board:: twr_ke18f Overview ******** @@ -11,12 +8,6 @@ MCU-based platforms. The onboard OpenSDAv2 serial and debug adapter, running an open source bootloader, offers options for serial communication, flash programming, and run-control debugging. -.. figure:: TWR-KE18F-DEVICE.jpg - :align: center - :alt: TWR-KE18F - - TWR-KE18F (Credit: NXP) - Hardware ******** diff --git a/boards/nxp/twr_kv58f220m/doc/index.rst b/boards/nxp/twr_kv58f220m/doc/index.rst index f9adc60064a24..69b5add3505f8 100644 --- a/boards/nxp/twr_kv58f220m/doc/index.rst +++ b/boards/nxp/twr_kv58f220m/doc/index.rst @@ -1,7 +1,4 @@ -.. _twr_kv58f220m: - -NXP TWR-KV58F220M -################# +.. zephyr:board:: twr_kv58f220m Overview ******** @@ -11,12 +8,6 @@ MCU-based platforms. The onboard OpenSDAv2 serial and debug adapter, running an open source bootloader, offers options for serial communication, flash programming, and run-control debugging. -.. figure:: twr_kv58f220m.jpg - :align: center - :alt: TWR-KV58F220M - - TWR-KV58F220M (Credit: NXP) - Hardware ******** diff --git a/boards/nxp/ucans32k1sic/doc/index.rst b/boards/nxp/ucans32k1sic/doc/index.rst index 3eca2900922c0..3aacf0459ddb2 100644 --- a/boards/nxp/ucans32k1sic/doc/index.rst +++ b/boards/nxp/ucans32k1sic/doc/index.rst @@ -1,7 +1,4 @@ -.. _ucans32k1sic: - -NXP UCANS32K1SIC -################ +.. zephyr:board:: ucans32k1sic Overview ******** @@ -11,10 +8,6 @@ board designed for both automotive and industrial applications. The UCANS32K1SIC provides two CAN SIC interfaces and is based on the 32-bit Arm Cortex-M4F `NXP S32K146`_ microcontroller. -.. image:: img/ucans32k1sic_top.webp - :align: center - :alt: NXP UCANS32K1SIC (TOP) - Hardware ******** diff --git a/boards/nxp/usb_kw24d512/doc/index.rst b/boards/nxp/usb_kw24d512/doc/index.rst index 37bbb88726d42..4706d94cc0d23 100644 --- a/boards/nxp/usb_kw24d512/doc/index.rst +++ b/boards/nxp/usb_kw24d512/doc/index.rst @@ -1,7 +1,4 @@ -.. _usb_kw24d512: - -NXP USB-KW24D512 -################ +.. zephyr:board:: usb_kw24d512 Overview ******** diff --git a/boards/nxp/vmu_rt1170/doc/index.rst b/boards/nxp/vmu_rt1170/doc/index.rst index 77c8264579ef0..4b5d72f9ba9ba 100644 --- a/boards/nxp/vmu_rt1170/doc/index.rst +++ b/boards/nxp/vmu_rt1170/doc/index.rst @@ -1,7 +1,4 @@ -.. _VMU RT1170: - -NXP VMU RT1170 -################## +.. zephyr:board:: vmu_rt1170 Overview ******** @@ -13,10 +10,6 @@ and is qualified for consumer, industrial and automotive markets. The VMU RT1170 is the default VMU for CogniPilot's Cerebri, a Zephyr RTOS based Autopilot. -.. image:: vmu_rt1170.jpg - :align: center - :alt: VMU RT1170 - Hardware ******** diff --git a/boards/shields/frdm_cr20a/doc/index.rst b/boards/shields/frdm_cr20a/doc/index.rst index 1e24e6ed2c255..244d34df0bcdf 100644 --- a/boards/shields/frdm_cr20a/doc/index.rst +++ b/boards/shields/frdm_cr20a/doc/index.rst @@ -10,7 +10,7 @@ The Freedom development board platform supports the MCR20A 2.4GHZ wireless transceiver. The FRDM-CR20A evaluation board is a small, low-power, cost-effective reference design for the MCR20A transceiver in a shield form factor, compatible with existing Freedom development platforms, such as -:ref:`frdm_k64f`. +:zephyr:board:`frdm_k64f`. .. image:: frdm_cr20a.jpg :align: center diff --git a/boards/shields/frdm_kw41z/doc/index.rst b/boards/shields/frdm_kw41z/doc/index.rst index ad9f784bcaeb3..6f471295e6207 100644 --- a/boards/shields/frdm_kw41z/doc/index.rst +++ b/boards/shields/frdm_kw41z/doc/index.rst @@ -13,7 +13,7 @@ integrated 2.4 GHz transceiver supporting Bluetooth |reg| Smart/Bluetooth (BLE) v4.2, Generic FSK, IEEE |reg| 802.15.4 and Thread. The FRDM-KW41Z can be used as a standalone board or as an Arduino shield. This -document covers usage as a shield; see :ref:`frdm_kw41z` for usage as a +document covers usage as a shield; see :zephyr:board:`frdm_kw41z` for usage as a standalone board. Bluetooth Controller @@ -53,7 +53,7 @@ host controller interface (HCI): OpenSDA circuit. #. Attach the FRDM-KW41Z to the Arduino header on your selected main board, - such as :ref:`mimxrt1050_evk` or :ref:`frdm_k64f`. + such as :zephyr:board:`mimxrt1050_evk` or :zephyr:board:`frdm_k64f`. #. Set ``--shield frdm_kw41z`` when you invoke ``west build`` in your Zephyr bluetooth application. For example, diff --git a/doc/connectivity/networking/api/gptp.rst b/doc/connectivity/networking/api/gptp.rst index 8f1c99701db93..5c4218c730f11 100644 --- a/doc/connectivity/networking/api/gptp.rst +++ b/doc/connectivity/networking/api/gptp.rst @@ -35,7 +35,7 @@ support must be enabled in ethernet drivers. Boards supported: -- :ref:`frdm_k64f` +- :zephyr:board:`frdm_k64f` - :ref:`nucleo_h743zi_board` - :ref:`nucleo_h745zi_q_board` - :ref:`nucleo_f767zi_board` diff --git a/doc/develop/flash_debug/probes.rst b/doc/develop/flash_debug/probes.rst index b8bc9d38df570..9f7470db580c0 100644 --- a/doc/develop/flash_debug/probes.rst +++ b/doc/develop/flash_debug/probes.rst @@ -85,7 +85,7 @@ debug microcontroller SOC: - LPC4322: :ref:`lpc-link2-onboard-debug-probe` - MK20: :ref:`opensda-onboard-debug-probe` -For example, the :ref:`frdm_k64f` board has an MK20 debug microcontroller, +For example, the :zephyr:board:`frdm_k64f` board has an MK20 debug microcontroller, so this board uses the :ref:`opensda-onboard-debug-probe`. .. _mcu-link-onboard-debug-probe: diff --git a/doc/hardware/peripherals/can/shell.rst b/doc/hardware/peripherals/can/shell.rst index 9c0999b6e7446..863a65eaadfb4 100644 --- a/doc/hardware/peripherals/can/shell.rst +++ b/doc/hardware/peripherals/can/shell.rst @@ -35,7 +35,7 @@ The following :ref:`Kconfig ` options enable additional subcommands and well. * :kconfig:option:`CONFIG_CAN_MANUAL_RECOVERY_MODE` enables the ``can recover`` subcommand. -For example, building the :zephyr:code-sample:`hello_world` sample for the :ref:`frdm_k64f` with the CAN shell and +For example, building the :zephyr:code-sample:`hello_world` sample for the :zephyr:board:`frdm_k64f` with the CAN shell and CAN statistics enabled: .. zephyr-app-commands:: diff --git a/doc/hardware/porting/board_porting.rst b/doc/hardware/porting/board_porting.rst index a495f490861e1..c5df470cc8280 100644 --- a/doc/hardware/porting/board_porting.rst +++ b/doc/hardware/porting/board_porting.rst @@ -95,7 +95,7 @@ the :term:`SoC series` and :term:`SoC family` levels are not always used. +============================================+==========================+=============+====================+====================+================+======================+ | :ref:`nrf52dk ` | nrf52832 | nRF52832 | nRF52 | Nordic nRF | Arm Cortex-M4 | ARMv7-M | +--------------------------------------------+--------------------------+-------------+--------------------+--------------------+----------------+----------------------+ - | :ref:`frdm_k64f ` | mk64f12 | MK64F12 | Kinetis K6x | NXP Kinetis | Arm Cortex-M4 | ARMv7-M | + | :zephyr:board:`frdm_k64f ` | mk64f12 | MK64F12 | Kinetis K6x | NXP Kinetis | Arm Cortex-M4 | ARMv7-M | +--------------------------------------------+--------------------------+-------------+--------------------+--------------------+----------------+----------------------+ | :ref:`rv32m1_vega ` | openisa_rv32m1/ri5cy | RV32M1 | (Not used) | (Not used) | RI5CY | RISC-V RV32 | +--------------------------------------------+--------------------------+-------------+--------------------+--------------------+----------------+----------------------+ @@ -103,7 +103,7 @@ the :term:`SoC series` and :term:`SoC family` levels are not always used. | +--------------------------+-------------+--------------------+--------------------+----------------+----------------------+ | | nrf5340/cpunet | nRF5340 | nRF53 | Nordic nRF | Arm Cortex-M33 | ARMv8-M | +--------------------------------------------+--------------------------+-------------+--------------------+--------------------+----------------+----------------------+ - | :ref:`mimx8mp_evk ` | mimx8ml8/a53 | i.MX8M Plus | i.MX8M | NXP i.MX | Arm Cortex-A53 | ARMv8-A | + | :zephyr:board:`mimx8mp_evk ` | mimx8ml8/a53 | i.MX8M Plus | i.MX8M | NXP i.MX | Arm Cortex-A53 | ARMv8-A | | +--------------------------+-------------+--------------------+--------------------+----------------+----------------------+ | | mimx8ml8/m7 | i.MX8M Plus | i.MX8M | NXP i.MX | Arm Cortex-M7 | ARMv7-M | | +--------------------------+-------------+--------------------+--------------------+----------------+----------------------+ diff --git a/doc/services/tfm/requirements.rst b/doc/services/tfm/requirements.rst index f2acd1890d398..f8e58dfb21b67 100644 --- a/doc/services/tfm/requirements.rst +++ b/doc/services/tfm/requirements.rst @@ -14,7 +14,7 @@ The following are some of the boards that can be used with TF-M: - ``mps3_an547_ns`` (qemu supported) * - :zephyr:board:`bl5340_dvk` - ``bl5340_dvk/nrf5340/cpuapp/ns`` - * - :ref:`lpcxpresso55s69` + * - :zephyr:board:`lpcxpresso55s69` - ``lpcxpresso55s69_ns`` * - :ref:`nrf9160dk_nrf9160` - ``nrf9160dk/nrf9160/ns`` diff --git a/samples/drivers/can/babbling/README.rst b/samples/drivers/can/babbling/README.rst index f13c80af8227f..8a0f6e55ac7e1 100644 --- a/samples/drivers/can/babbling/README.rst +++ b/samples/drivers/can/babbling/README.rst @@ -34,7 +34,7 @@ configured using the ``sw0`` :ref:`devicetree ` alias, usually in the Building and Running ******************** -Example building for :ref:`twr_ke18f`: +Example building for :zephyr:board:`twr_ke18f`: .. zephyr-app-commands:: :zephyr-app: samples/drivers/can/babbling diff --git a/samples/drivers/dac/README.rst b/samples/drivers/dac/README.rst index 6b86488479813..f65852f8bbc39 100644 --- a/samples/drivers/dac/README.rst +++ b/samples/drivers/dac/README.rst @@ -97,7 +97,7 @@ The sample can be built and executed for the Building and Running for NXP TWR-KE18F ====================================== -The sample can be built and executed for the :ref:`twr_ke18f` as +The sample can be built and executed for the :zephyr:board:`twr_ke18f` as follows: .. zephyr-app-commands:: @@ -111,7 +111,7 @@ connector. Building and Running for NXP FRDM-K64F ====================================== -The sample can be built and executed for the :ref:`frdm_k64f` as +The sample can be built and executed for the :zephyr:board:`frdm_k64f` as follows: .. zephyr-app-commands:: @@ -211,7 +211,7 @@ also can run for the Longan Nano Lite as follows: Building and Running for NXP LPCXpresso55S36 ============================================ -The sample can be built and executed for the :ref:`lpcxpresso55s36` as +The sample can be built and executed for the :zephyr:board:`lpcxpresso55s36` as follows: .. zephyr-app-commands:: diff --git a/samples/drivers/i2c/custom_target/README.rst b/samples/drivers/i2c/custom_target/README.rst index 5237b49a50105..08800bdcf953a 100644 --- a/samples/drivers/i2c/custom_target/README.rst +++ b/samples/drivers/i2c/custom_target/README.rst @@ -15,7 +15,7 @@ Requirements This sample requires an I2C peripheral which is capable of acting as a target. -This sample has been tested on :ref:`lpcxpresso55s69`. +This sample has been tested on :zephyr:board:`lpcxpresso55s69`. Building and Running ******************** diff --git a/samples/drivers/i2c/target_eeprom/README.rst b/samples/drivers/i2c/target_eeprom/README.rst index 620a24819eff9..31bc488b07b86 100644 --- a/samples/drivers/i2c/target_eeprom/README.rst +++ b/samples/drivers/i2c/target_eeprom/README.rst @@ -15,7 +15,7 @@ Requirements This sample requires an I2C peripheral which is capable of acting as a target. -This sample has been tested on :ref:`lpcxpresso55s69`. +This sample has been tested on :zephyr:board:`lpcxpresso55s69`. Building and Running ******************** diff --git a/samples/drivers/i2s/output/README.rst b/samples/drivers/i2s/output/README.rst index d8e10d81e0e13..69d821b36a077 100644 --- a/samples/drivers/i2s/output/README.rst +++ b/samples/drivers/i2s/output/README.rst @@ -20,7 +20,7 @@ Requirements The I2S device to be used by the sample is specified by defining a devicetree alias named ``i2s_tx`` -This sample has been tested on :ref:`mimxrt1060_evk` (mimxrt1060_evkb) +This sample has been tested on :zephyr:board:`mimxrt1060_evk` (mimxrt1060_evkb) Building and Running ******************** diff --git a/samples/drivers/ipm/ipm_mcux/README.rst b/samples/drivers/ipm/ipm_mcux/README.rst index cb75ffb521c4a..ea4d3394445cd 100644 --- a/samples/drivers/ipm/ipm_mcux/README.rst +++ b/samples/drivers/ipm/ipm_mcux/README.rst @@ -12,14 +12,14 @@ sample application uses a mailbox to send messages from one processor core to the other. This sample applies to the following boards: - - :ref:`lpcxpresso54114`, two core processors (Cortex-M4F and Cortex-M0+) - - :ref:`lpcxpresso55s69`, two core processors (dual Cortex-M33) + - :zephyr:board:`lpcxpresso54114`, two core processors (Cortex-M4F and Cortex-M0+) + - :zephyr:board:`lpcxpresso55s69`, two core processors (dual Cortex-M33) Requirements ************ -- :ref:`lpcxpresso54114` board -- :ref:`lpcxpresso55s69` board +- :zephyr:board:`lpcxpresso54114` board +- :zephyr:board:`lpcxpresso55s69` board Building the application for lpcxpresso54114/lpc54114/m4 ******************************************************** diff --git a/samples/drivers/led/is31fl3216a/README.rst b/samples/drivers/led/is31fl3216a/README.rst index fa527d0957982..784489fe3da48 100644 --- a/samples/drivers/led/is31fl3216a/README.rst +++ b/samples/drivers/led/is31fl3216a/README.rst @@ -33,7 +33,7 @@ This sample can be built and executed when the devicetree has an I2C device node with compatible :dtcompatible:`issi,is31fl3216a` enabled, along with the relevant bus controller node also being enabled. -As an example this sample provides a DTS overlay for the :ref:`lpcxpresso55s28` +As an example this sample provides a DTS overlay for the :zephyr:board:`lpcxpresso55s28` board (:file:`boards/lpcxpresso55s28.overlay`). It assumes that a I2C _is31fl3216a LED driver (with 16 LEDs wired) is connected to the I2C bus at address 0x74. diff --git a/samples/drivers/led/is31fl3733/README.rst b/samples/drivers/led/is31fl3733/README.rst index eefa04b184f3d..47f0c022eacaa 100644 --- a/samples/drivers/led/is31fl3733/README.rst +++ b/samples/drivers/led/is31fl3733/README.rst @@ -31,7 +31,7 @@ Building and Running This sample can be run on any board with an IS31FL3733 LED driver connected via I2C, and a node with the :dtcompatible:`issi,is31fl3733` compatible present in its devicetree. -This sample provides a DTS overlay for the :ref:`frdm_k22f` board +This sample provides a DTS overlay for the :zephyr:board:`frdm_k22f` board (:file:`boards/frdm_k22f.overlay`). It assumes that the IS31FL3733 LED controller is connected to I2C0, at address 0x50. The SDB GPIO should be connected to PTC2 (A3 on the arduino header) diff --git a/samples/drivers/led/lp50xx/README.rst b/samples/drivers/led/lp50xx/README.rst index 23d4fcaa3ff84..6f103414ea461 100644 --- a/samples/drivers/led/lp50xx/README.rst +++ b/samples/drivers/led/lp50xx/README.rst @@ -35,7 +35,7 @@ This sample can be built and executed on boards with an I2C LP5009, LP5012, LP5018, LP5024, LP5030 or LP5036 LED driver connected. A node matching the the device type binding should be defined in the board DTS files. -As an example this sample provides a DTS overlay for the :ref:`lpcxpresso11u68` +As an example this sample provides a DTS overlay for the :zephyr:board:`lpcxpresso11u68` board (:file:`boards/lpcxpresso11u68.overlay`). It assumes that a I2C LP5030 LED driver (with 10 LEDs wired) is connected to the I2C0 bus at address 0x30. diff --git a/samples/drivers/video/capture/README.rst b/samples/drivers/video/capture/README.rst index 384f37b6035a1..823e263ebdcf7 100644 --- a/samples/drivers/video/capture/README.rst +++ b/samples/drivers/video/capture/README.rst @@ -18,10 +18,10 @@ Supported camera modules on some i.MX RT boards can be found below. - `Camera iMXRT`_ -- :ref:`mimxrt1064_evk` +- :zephyr:board:`mimxrt1064_evk` - `MT9M114 camera module`_ -- :ref:`mimxrt1170_evk` +- :zephyr:board:`mimxrt1170_evk` - `OV5640 camera module`_ Also :ref:`arduino_nicla_vision_board` can be used in this sample as capture device, in that case @@ -30,11 +30,11 @@ The user can transfer the captured frames through on board USB. Wiring ****** -On :ref:`mimxrt1064_evk`, the MT9M114 camera module should be plugged in the +On :zephyr:board:`mimxrt1064_evk`, the MT9M114 camera module should be plugged in the J35 camera connector. A USB cable should be connected from a host to the micro USB debug connector (J41) in order to get console output via the freelink interface. -On :ref:`mimxrt1170_evk`, the OV5640 camera module should be plugged into the +On :zephyr:board:`mimxrt1170_evk`, the OV5640 camera module should be plugged into the J2 camera connector. A USB cable should be connected from a host to the micro USB debug connector (J11) in order to get console output via the daplink interface. @@ -43,7 +43,7 @@ For :ref:`arduino_nicla_vision_board` there is no extra wiring required. Building and Running ******************** -For :ref:`mimxrt1064_evk`, build this sample application with the following commands: +For :zephyr:board:`mimxrt1064_evk`, build this sample application with the following commands: .. zephyr-app-commands:: :zephyr-app: samples/drivers/video/capture @@ -52,7 +52,7 @@ For :ref:`mimxrt1064_evk`, build this sample application with the following comm :goals: build :compact: -For :ref:`mimxrt1170_evk`, build this sample application with the following commands: +For :zephyr:board:`mimxrt1170_evk`, build this sample application with the following commands: .. zephyr-app-commands:: :zephyr-app: samples/drivers/video/capture diff --git a/samples/drivers/video/tcpserversink/README.rst b/samples/drivers/video/tcpserversink/README.rst index 6ac32f67c8dbb..8245edea4c452 100644 --- a/samples/drivers/video/tcpserversink/README.rst +++ b/samples/drivers/video/tcpserversink/README.rst @@ -15,13 +15,13 @@ Requirements This samples requires a video capture device and network support. -- :ref:`mimxrt1064_evk` +- :zephyr:board:`mimxrt1064_evk` - `MT9M114 camera module`_ Wiring ****** -On :ref:`mimxrt1064_evk`, The MT9M114 camera module should be plugged in the +On :zephyr:board:`mimxrt1064_evk`, The MT9M114 camera module should be plugged in the J35 camera connector. A USB cable should be connected from a host to the micro USB debug connector (J41) in order to get console output via the freelink interface. Ethernet cable must be connected to RJ45 connector. @@ -29,7 +29,7 @@ interface. Ethernet cable must be connected to RJ45 connector. Building and Running ******************** -For :ref:`mimxrt1064_evk`, the sample can be built with the following command. +For :zephyr:board:`mimxrt1064_evk`, the sample can be built with the following command. If a mt9m114 camera shield is missing, video software generator will be used instead. .. zephyr-app-commands:: diff --git a/samples/modules/canopennode/README.rst b/samples/modules/canopennode/README.rst index aa88cb861c199..97dcc251dde60 100644 --- a/samples/modules/canopennode/README.rst +++ b/samples/modules/canopennode/README.rst @@ -35,7 +35,7 @@ First, ensure the optional CANopenNode module is enabled and available: Building and Running for TWR-KE18F ================================== -The :ref:`twr_ke18f` board is equipped with an onboard CAN +The :zephyr:board:`twr_ke18f` board is equipped with an onboard CAN transceiver. This board supports CANopen LED indicators (red and green LEDs). The sample can be built and executed for the TWR-KE18F as follows: @@ -51,7 +51,7 @@ counter object at index ``0x2102`` in the object dictionary. Building and Running for FRDM-K64F ================================== -The :ref:`frdm_k64f` board does not come with an onboard CAN +The :zephyr:board:`frdm_k64f` board does not come with an onboard CAN transceiver. In order to use the CAN bus on the FRDM-K64F board, an external CAN bus transceiver must be connected to ``PTB18`` (``CAN0_TX``) and ``PTB19`` (``CAN0_RX``). This board supports CANopen diff --git a/samples/modules/lvgl/demos/README.rst b/samples/modules/lvgl/demos/README.rst index 4d5c78cbb8be6..8c85495342b02 100644 --- a/samples/modules/lvgl/demos/README.rst +++ b/samples/modules/lvgl/demos/README.rst @@ -31,7 +31,7 @@ Note that other input devices types are not demonstrated in these demos, namely Building and Running ******************** -Example building for :ref:`mimxrt1060_evk`: +Example building for :zephyr:board:`mimxrt1060_evk`: .. zephyr-app-commands:: :zephyr-app: samples/modules/lvgl/demos diff --git a/samples/net/cloud/tagoio_http_post/README.rst b/samples/net/cloud/tagoio_http_post/README.rst index f227f9016317f..0f7d394fe5c5c 100644 --- a/samples/net/cloud/tagoio_http_post/README.rst +++ b/samples/net/cloud/tagoio_http_post/README.rst @@ -44,7 +44,7 @@ Ethernet You can use this application on a supported board with ethernet port. There are many like :ref:`sam4e_xpro`, :ref:`sam_v71_xplained_ultra`, -:ref:`frdm_k64f`, :ref:`nucleo_f767zi_board` etc. Pick one and just build +:zephyr:board:`frdm_k64f`, :ref:`nucleo_f767zi_board` etc. Pick one and just build tagoio-http-client sample application with minimal configuration: .. zephyr-app-commands:: diff --git a/samples/net/dhcpv4_client/README.rst b/samples/net/dhcpv4_client/README.rst index c98e46f99acb1..54e77cfd97d9e 100644 --- a/samples/net/dhcpv4_client/README.rst +++ b/samples/net/dhcpv4_client/README.rst @@ -103,10 +103,10 @@ FRDM_K64F ========= These are instructions for how to use this sample application running on -:ref:`frdm_k64f` board to negotiate IP address from DHCPv4 server (kea) running +:zephyr:board:`frdm_k64f` board to negotiate IP address from DHCPv4 server (kea) running on Linux host. -Connect ethernet cable from :ref:`Freedom-K64F board ` to Linux host +Connect ethernet cable from :zephyr:board:`Freedom-K64F board ` to Linux host machine and check for new interfaces: .. code-block:: console diff --git a/samples/net/dns_resolve/README.rst b/samples/net/dns_resolve/README.rst index b741b827ac926..c68899ca07cb5 100644 --- a/samples/net/dns_resolve/README.rst +++ b/samples/net/dns_resolve/README.rst @@ -41,7 +41,7 @@ Network Configuration Open the project configuration file for your platform, for example: :file:`prj_frdm_k64f.conf` is the configuration file for the -:ref:`frdm_k64f` board. +:zephyr:board:`frdm_k64f` board. In this sample application, both static or DHCPv4 IP addresses are supported. Static IP addresses are specified in the project configuration file, @@ -142,7 +142,7 @@ Open a terminal window and type: :goals: build flash :compact: -See :ref:`Freedom-K64F board documentation ` for more information +See :zephyr:board:`Freedom-K64F board documentation ` for more information about this board. Open a terminal window and type: diff --git a/samples/net/ipv4_autoconf/README.rst b/samples/net/ipv4_autoconf/README.rst index f9a8f63363bd8..cc9ab4b839f18 100644 --- a/samples/net/ipv4_autoconf/README.rst +++ b/samples/net/ipv4_autoconf/README.rst @@ -21,10 +21,10 @@ Building and Running ******************** These are instructions for how to use this sample application running -on a :ref:`frdm_k64f` board to configure a link local IPv4 address and +on a :zephyr:board:`frdm_k64f` board to configure a link local IPv4 address and connect to a Linux host. -Connect ethernet cable from a :ref:`Freedom-K64F board ` to a Linux +Connect ethernet cable from a :zephyr:board:`Freedom-K64F board ` to a Linux host machine and check for new interfaces. Running Avahi client in Linux Host diff --git a/samples/net/telnet/README.rst b/samples/net/telnet/README.rst index 7eb82cd9ddae2..b508b7688f960 100644 --- a/samples/net/telnet/README.rst +++ b/samples/net/telnet/README.rst @@ -66,14 +66,14 @@ Freedom-K64F Board =================== These are instructions for how to use this sample application running on a -Freedom-K64F board. Unlike running it on QEMU, :ref:`Freedom-K64F board +Freedom-K64F board. Unlike running it on QEMU, :zephyr:board:`Freedom-K64F board ` network configuration for IPv4 will rely on DHCPv4. You cad modify the :file:`prj_frdm_k64f.conf` to set static IPv4 addresses if it is really needed. For detailed instructions about building, flashing and using the serial console -logs, follow the :ref:`Freedom-K64F board ` documentation section. +logs, follow the :zephyr:board:`Freedom-K64F board ` documentation section. -Connect ethernet cable from :ref:`Freedom-K64F ` board to a +Connect ethernet cable from :zephyr:board:`Freedom-K64F ` board to a local network providing IPv4 address configuration via DHCPv4. Creating your own DHCP server on a local network is not in the scope of this README. @@ -85,7 +85,7 @@ Build Zephyr samples/net/telnet application: :goals: build :compact: -Flash the resulting Zephyr binary following the :ref:`Freedom-K64F ` +Flash the resulting Zephyr binary following the :zephyr:board:`Freedom-K64F ` board documentation noted above. From your host computer, open a serial console to your board: @@ -94,7 +94,7 @@ From your host computer, open a serial console to your board: $ sudo screen /dev/ttyACM0 115200 -Plug the Ethernet cable to the :ref:`Freedom-K64F ` board. +Plug the Ethernet cable to the :zephyr:board:`Freedom-K64F ` board. Reset the board, you should see first on the console: .. code-block:: console diff --git a/samples/sensor/fxos8700/README.rst b/samples/sensor/fxos8700/README.rst index 52b8a96a33ec5..cc0f3a5885a9b 100644 --- a/samples/sensor/fxos8700/README.rst +++ b/samples/sensor/fxos8700/README.rst @@ -15,9 +15,9 @@ Building and Running ******************** This project outputs sensor data to the console. FXOS8700 -sensor is present on the :ref:`frdm_k64f`, :ref:`frdm_k22f`, -:ref:`frdm_kw41z`, :ref:`hexiwear`, and :ref:`twr_ke18f` boards. -Accelerometer only devices are present on the :ref:`frdm_kl25z`, +sensor is present on the :zephyr:board:`frdm_k64f`, :zephyr:board:`frdm_k22f`, +:zephyr:board:`frdm_kw41z`, :ref:`hexiwear`, and :zephyr:board:`twr_ke18f` boards. +Accelerometer only devices are present on the :zephyr:board:`frdm_kl25z`, :zephyr:board:`bbc_microbit`, and :ref:`reel_board` boards. It does not work on QEMU. diff --git a/samples/sensor/lps22hh_i3c/README.rst b/samples/sensor/lps22hh_i3c/README.rst index bdb965b459185..06156bd7e7120 100644 --- a/samples/sensor/lps22hh_i3c/README.rst +++ b/samples/sensor/lps22hh_i3c/README.rst @@ -15,7 +15,7 @@ Requirements This sample uses the LPS22HH sensor controlled using the I3C interface. It has been tested using the LPS22HH on the evaluation board -STEVALMKI192-V1 connected to the I3C header on :ref:`mimxrt685_evk`. +STEVALMKI192-V1 connected to the I3C header on :zephyr:board:`mimxrt685_evk`. References ********** @@ -55,7 +55,7 @@ Board Preparations mimxrt685_evk ------------------ -On the board :ref:`mimxrt685_evk`, the I3C pins are exposed on the J18 +On the board :zephyr:board:`mimxrt685_evk`, the I3C pins are exposed on the J18 header, where: * SCL is on pin 1 diff --git a/samples/sensor/lsm6dso_i2c_on_i3c/README.rst b/samples/sensor/lsm6dso_i2c_on_i3c/README.rst index 708c2670447c1..ceb8f76feced8 100644 --- a/samples/sensor/lsm6dso_i2c_on_i3c/README.rst +++ b/samples/sensor/lsm6dso_i2c_on_i3c/README.rst @@ -17,7 +17,7 @@ Requirements This sample uses the LSM6DSO sensor controlled using the I2C interface exposed by the I3C controller. It has been tested using the LSM6DSO on the evaluation board STEVAL-MKI196V1 connected to the I3C header -on :ref:`mimxrt685_evk`. +on :zephyr:board:`mimxrt685_evk`. References ********** @@ -46,7 +46,7 @@ Board Preparations mimxrt685_evk ------------------ -On the board :ref:`mimxrt685_evk`, the I3C pins are exposed on the J18 +On the board :zephyr:board:`mimxrt685_evk`, the I3C pins are exposed on the J18 header, where: * SCL is on pin 1 diff --git a/samples/sensor/mcux_acmp/README.rst b/samples/sensor/mcux_acmp/README.rst index 5a7d1844ad3a3..765169fa0e186 100644 --- a/samples/sensor/mcux_acmp/README.rst +++ b/samples/sensor/mcux_acmp/README.rst @@ -8,15 +8,15 @@ Overview ******** This sample show how to use the NXP MCUX Analog Comparator (ACMP) driver. The -sample supports the :ref:`twr_ke18f`, :ref:`mimxrt1170_evk`, :ref:`frdm_ke17z` -, :ref:`frdm_ke17z512` and :ref:`mimxrt1180_evk`. +sample supports the :zephyr:board:`twr_ke18f`, :zephyr:board:`mimxrt1170_evk`, :zephyr:board:`frdm_ke17z` +, :zephyr:board:`frdm_ke17z512` and :zephyr:board:`mimxrt1180_evk`. The input voltage for the negative input of the analog comparator is provided by the ACMP Digital-to-Analog Converter (DAC). The input voltage for the positive input can be adjusted by turning the on-board potentiometer for -:ref:`twr_ke18f` board, for :ref:`mimxrt1170_evk` the voltage signal is -captured on J25-13, the :ref:`frdm_ke17z` and :ref:`frdm_ke17z512` boards are -captured in J2-3, the :ref:`mimxrt1180_evk` board are captured in J45-13, need +:zephyr:board:`twr_ke18f` board, for :zephyr:board:`mimxrt1170_evk` the voltage signal is +captured on J25-13, the :zephyr:board:`frdm_ke17z` and :zephyr:board:`frdm_ke17z512` boards are +captured in J2-3, the :zephyr:board:`mimxrt1180_evk` board are captured in J45-13, need change the external voltage signal to check the output. The output value of the analog comparator is reported on the console. @@ -26,7 +26,7 @@ Building and Running Building and Running for TWR-KE18F ================================== -Build the application for the :ref:`twr_ke18f` board, and adjust the +Build the application for the :zephyr:board:`twr_ke18f` board, and adjust the ACMP input voltage by turning the on-board potentiometer. .. zephyr-app-commands:: diff --git a/samples/sensor/mcux_lpcmp/README.rst b/samples/sensor/mcux_lpcmp/README.rst index 6cd790d571f99..3f6a5631debf0 100644 --- a/samples/sensor/mcux_lpcmp/README.rst +++ b/samples/sensor/mcux_lpcmp/README.rst @@ -27,7 +27,7 @@ Building and Running Building and Running for NXP FRDM-MCXN947 ========================================= -Build the application for the :ref:`frdm_mcxn947` board, and adjust the +Build the application for the :zephyr:board:`frdm_mcxn947` board, and adjust the LPCMP positive input port voltage by changing the voltage input to J2-17. .. zephyr-app-commands:: @@ -38,7 +38,7 @@ LPCMP positive input port voltage by changing the voltage input to J2-17. Building and Running for NXP FRDM-MCXN236 ========================================= -Build the application for the :ref:`frdm_mcxn236` board, and adjust the +Build the application for the :zephyr:board:`frdm_mcxn236` board, and adjust the LPCMP positive input port voltage by changing the voltage input to J2-8. .. zephyr-app-commands:: diff --git a/samples/sensor/tmp112/README.rst b/samples/sensor/tmp112/README.rst index 064e5e99b8ff0..54ba4d5f0ebfd 100644 --- a/samples/sensor/tmp112/README.rst +++ b/samples/sensor/tmp112/README.rst @@ -18,7 +18,7 @@ devicetree overlay with such a node added. Building and Running ******************** -To build and flash the sample for the :ref:`frdm_k64f`: +To build and flash the sample for the :zephyr:board:`frdm_k64f`: .. zephyr-app-commands:: :zephyr-app: samples/sensor/tmp112 diff --git a/samples/shields/lmp90100_evb/rtd/README.rst b/samples/shields/lmp90100_evb/rtd/README.rst index 26186beda4402..9ee677bd53f16 100644 --- a/samples/shields/lmp90100_evb/rtd/README.rst +++ b/samples/shields/lmp90100_evb/rtd/README.rst @@ -27,7 +27,7 @@ Building and Running This sample runs with the LMP90100 EVB connected to any development board with a matching Arduino connector. For this example, we use a -:ref:`frdm_k64f` board. +:zephyr:board:`frdm_k64f` board. .. zephyr-app-commands:: :zephyr-app: samples/shields/lmp90100_evb/rtd diff --git a/samples/subsys/display/lvgl/README.rst b/samples/subsys/display/lvgl/README.rst index 47862466535a8..0bfeff7c7639c 100644 --- a/samples/subsys/display/lvgl/README.rst +++ b/samples/subsys/display/lvgl/README.rst @@ -40,7 +40,7 @@ for corresponding connectors, for example: - :ref:`adafruit_2_8_tft_touch_v2` and :ref:`nrf52840dk_nrf52840` - :ref:`buydisplay_2_8_tft_touch_arduino` and :ref:`nrf52840dk_nrf52840` -- :ref:`ssd1306_128_shield` and :ref:`frdm_k64f` +- :ref:`ssd1306_128_shield` and :zephyr:board:`frdm_k64f` - :ref:`seeed_xiao_round_display` and :zephyr:board:`xiao_ble` or a board with an integrated display: @@ -54,12 +54,12 @@ or a simulated display environment in a :ref:`native_sim ` applicati or -- :ref:`mimxrt1050_evk` +- :zephyr:board:`mimxrt1050_evk` - `RK043FN02H-CT`_ or -- :ref:`mimxrt1060_evk` +- :zephyr:board:`mimxrt1060_evk` - `RK043FN02H-CT`_ Building and Running diff --git a/samples/subsys/mgmt/hawkbit/README.rst b/samples/subsys/mgmt/hawkbit/README.rst index 969fcc7f5063f..f4a206c32f987 100644 --- a/samples/subsys/mgmt/hawkbit/README.rst +++ b/samples/subsys/mgmt/hawkbit/README.rst @@ -26,7 +26,7 @@ Caveats ******* * The Zephyr port of hawkBit is configured to run on a - :ref:`Freedom-K64F ` MCU by default. The application should + :zephyr:board:`Freedom-K64F ` MCU by default. The application should build and run for other platforms with support internet connection. Some platforms need some modification. Overlay files would be needed to support BLE 6lowpan, 802.15.4 or OpenThread configurations as well as the @@ -78,7 +78,7 @@ the server URL, ``:8080``, and logging into the server using Step 4: Build hawkBit ===================== -hawkBit can be built for the :ref:`Freedom-K64F ` as follows: +hawkBit can be built for the :zephyr:board:`Freedom-K64F ` as follows: .. zephyr-app-commands:: :zephyr-app: samples/subsys/mgmt/hawkbit @@ -260,7 +260,7 @@ Step 9: Build hawkBit HTTPS * Convert the server.pem file to self_sign.der and place the der file in hawkbit/src directory -``hawkBit https`` can be built for the :ref:`Freedom-K64F ` as follows: +``hawkBit https`` can be built for the :zephyr:board:`Freedom-K64F ` as follows: .. zephyr-app-commands:: :zephyr-app: samples/subsys/mgmt/hawkbit diff --git a/samples/subsys/mgmt/updatehub/README.rst b/samples/subsys/mgmt/updatehub/README.rst index db63a8ae80ae1..b83b52cdc7c12 100644 --- a/samples/subsys/mgmt/updatehub/README.rst +++ b/samples/subsys/mgmt/updatehub/README.rst @@ -30,7 +30,7 @@ Caveats ******* * The Zephyr port of ``UpdateHub`` was initially developed to run on a - :ref:`Freedom-K64F ` kit using the ethernet connectivity. The + :zephyr:board:`Freedom-K64F ` kit using the ethernet connectivity. The application should build and run for other platforms with same connectivity. * The sample provides overlay files to enable other technologies like WIFI, @@ -453,7 +453,7 @@ The below list of hardware have been used by UpdateHub team. :widths: 50, 50 :width: 800px - :ref:`frdm_k64f`, "1, 2, 3, 4" + :zephyr:board:`frdm_k64f`, "1, 2, 3, 4" :ref:`nrf52840dk_nrf52840`, "2, 3, 4, 5, 6" :ref:`nucleo_f767zi_board`, "1, 2, 3, 4" diff --git a/tests/drivers/can/host/README.rst b/tests/drivers/can/host/README.rst index bc1dca4d73c05..946dcf7f13321 100644 --- a/tests/drivers/can/host/README.rst +++ b/tests/drivers/can/host/README.rst @@ -110,7 +110,7 @@ Next, python-can needs to be configured for the ``can0`` interface. One option i fd = True Once the SocketCAN interface has been brought up and configured the test suite can be launched using -Twister. Below is an example for running on the :ref:`lpcxpresso55s36`: +Twister. Below is an example for running on the :zephyr:board:`lpcxpresso55s36`: .. code-block:: shell From e8bf2a36f06e1e9f0cdf0d0092e28594549d58bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 16:59:51 +0200 Subject: [PATCH 1578/4482] boards: olimex: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Olimex boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- .../doc/olimex_lora_stm32wl_devkit.rst | 11 +---------- boards/olimex/olimex_esp32_evb/doc/index.rst | 11 +---------- boards/olimex/olimexino_stm32/doc/index.rst | 11 +---------- boards/olimex/stm32_e407/doc/index.rst | 11 +---------- .../doc/img/olimex_stm32_h103_bottom.jpg | Bin 69240 -> 0 bytes boards/olimex/stm32_h103/doc/index.rst | 15 +-------------- boards/olimex/stm32_h405/doc/index.rst | 17 +---------------- .../doc/olimex_stm32_h405_bottom.jpg | Bin 49265 -> 0 bytes boards/olimex/stm32_h407/doc/index.rst | 5 +---- boards/olimex/stm32_p405/doc/index.rst | 11 +---------- 10 files changed, 8 insertions(+), 84 deletions(-) delete mode 100644 boards/olimex/stm32_h103/doc/img/olimex_stm32_h103_bottom.jpg delete mode 100644 boards/olimex/stm32_h405/doc/olimex_stm32_h405_bottom.jpg diff --git a/boards/olimex/lora_stm32wl_devkit/doc/olimex_lora_stm32wl_devkit.rst b/boards/olimex/lora_stm32wl_devkit/doc/olimex_lora_stm32wl_devkit.rst index 84e219fc1700d..1755c3cdc721e 100644 --- a/boards/olimex/lora_stm32wl_devkit/doc/olimex_lora_stm32wl_devkit.rst +++ b/boards/olimex/lora_stm32wl_devkit/doc/olimex_lora_stm32wl_devkit.rst @@ -1,7 +1,4 @@ -.. _olimex_lora_stm32wl_devkit: - -Olimex LoRa STM32WL DevKit -########################## +.. zephyr:board:: olimex_lora_stm32wl_devkit Overview ******** @@ -9,12 +6,6 @@ Overview LoRaWAN development kit based on Olimex BB-STM32WL module using the STM32WLE5CCU6 MCU. -.. figure:: olimex-stm32wl-devkit.jpg - :align: center - :alt: Olimex LoRa STM32WL DevKit - - Olimex LoRa STM32WL DevKit (credit: OLIMEX) - Hardware ******** diff --git a/boards/olimex/olimex_esp32_evb/doc/index.rst b/boards/olimex/olimex_esp32_evb/doc/index.rst index fcb00c2a57f89..880e3933ab973 100644 --- a/boards/olimex/olimex_esp32_evb/doc/index.rst +++ b/boards/olimex/olimex_esp32_evb/doc/index.rst @@ -1,7 +1,4 @@ -.. _olimex_esp32_evb: - -Olimex ESP32-EVB -################ +.. zephyr:board:: olimex_esp32_evb Overview ******** @@ -15,12 +12,6 @@ The board can operate from a single LiPo backup battery as it has an internal LiPo battery charger. There is no step-up converter, so relays, CAN, and USB power does not work when running off battery. -.. figure:: ESP32-EVB.jpg - :align: center - :alt: ESP32-EVB - - ESP32-EVB (Credit: Olimex) - Hardware ******** diff --git a/boards/olimex/olimexino_stm32/doc/index.rst b/boards/olimex/olimexino_stm32/doc/index.rst index 913b6faa8d64f..af42d6b0ac189 100644 --- a/boards/olimex/olimexino_stm32/doc/index.rst +++ b/boards/olimex/olimexino_stm32/doc/index.rst @@ -1,7 +1,4 @@ -.. _olimexino_stm32: - -OLIMEXINO-STM32 -############### +.. zephyr:board:: olimexino_stm32 Overview ******** @@ -9,12 +6,6 @@ Overview The OLIMEXINO-STM32 board is based on the STMicroelectronics STM32F103RB ARM Cortex-M3 CPU. -.. figure:: img/olimexino_stm32.jpg - :align: center - :alt: OLIMEXINO-STM32 - - OLIMEXINO-STM32 - More information about the board can be found at the `OLIMEXINO-STM32 website`_ and `OLIMEXINO-STM32 user manual`_. The `ST STM32F103xB Datasheet`_ contains the processor's diff --git a/boards/olimex/stm32_e407/doc/index.rst b/boards/olimex/stm32_e407/doc/index.rst index 6af85cf75e07a..98a698b3c1476 100644 --- a/boards/olimex/stm32_e407/doc/index.rst +++ b/boards/olimex/stm32_e407/doc/index.rst @@ -1,7 +1,4 @@ -.. _olimex_stm32_e407: - -OLIMEX-STM32-E407 -################# +.. zephyr:board:: olimex_stm32_e407 Overview ******** @@ -9,12 +6,6 @@ Overview The OLIMEX-STM32-E407 board is open source hardware and is based on the STMicroelectronics STM32F407ZG ARM Cortex-M4 CPU. -.. figure:: img/olimex_stm32_e407.jpg - :align: center - :alt: OLIMEX-STM32-E407 - - OLIMEX-STM32-E407 - Hardware ******** diff --git a/boards/olimex/stm32_h103/doc/img/olimex_stm32_h103_bottom.jpg b/boards/olimex/stm32_h103/doc/img/olimex_stm32_h103_bottom.jpg deleted file mode 100644 index 829a9b3396a9cd1b18644c80092358c6a6736016..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 69240 zcmeFYRZv_}*Dcz(y99S=JPGca0Nsr?ZXpDB8iybW?$Wr2K;!NbAOvmP-8DcUxRcy` zw{G3KkN-LMKM$wsto^d9R@EGH?Nw{eJ;xmD@8aK005Mnzqy#`gK>?`zdjNk|0Ez%? zOiV0H3~VecEF2tcTzql@d^|jSYEm*Ha(Ws@26`GgIwm%LAQKBOD;*uDC>QUm*Fr)< zj6iW|F##!lK_P+v7(v0o!NJGFry?Mr5@4od7Wf|?f4>7ruu&FJJ<(7|0H`D=Xe20q z`v7zR6aXsPf870l2L>h@Iuy@X`KxPl84QkOlm{Lj9zPiz3H~0r*1xe_sFh{thUYtYYJTbkKybmj9m} z#rmNj&$dZ;g_Xib2!xW8OZAMoG8}*TU%BIN&M_`TiHzuT*$yjQ{;B7^hZ>>c6NH#l$VOqUXGaLr`KiQ=v zP4LB;s&9)h1j1JTEz>TeUz^YP*DwB%>`+<`<^BF5_AsJ;!iL&27|IHN2H* z4>Z*Sv$Ss;6$7Fo)GP0Zl+HFrbI7#3EUd>6%F>R3{HsMhk)7I-uQ|= z1#rC7r!iYWeicI6Z9#wERW`~`=)}SBFi$SYoNFrS+j55n_a4Wi<$6Qz?SicTMQ4mE z&$sm#-+>*&1V+oP%4Yy8@|-PrdgH8Y-sJlbH{;I; zIV3HQ*l!DBr&bdS4J&IxX9$gNiYiX1j7xN(Mgdk6yd{&_`5}*@IBVUWiPWcdooaDz z(`b5`>74cS*0b0CEWccRpgL?O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] boards: openisa: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the openISA boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/openisa/rv32m1_vega/doc/index.rst | 11 +---------- doc/hardware/porting/board_porting.rst | 2 +- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/boards/openisa/rv32m1_vega/doc/index.rst b/boards/openisa/rv32m1_vega/doc/index.rst index a8ff0b6c4b8e2..d5cf180bb1bbf 100644 --- a/boards/openisa/rv32m1_vega/doc/index.rst +++ b/boards/openisa/rv32m1_vega/doc/index.rst @@ -1,9 +1,6 @@ .. highlight:: sh -.. _rv32m1_vega: - -OpenISA VEGAboard -################# +.. zephyr:board:: rv32m1_vega Overview ******** @@ -13,12 +10,6 @@ on-die XIP flash, and a full complement of peripherals, including a 2.4 GHz multi-protocol radio. It also has built-in sensors and Arduino-style expansion connectors. -.. figure:: rv32m1_vega.jpg - :align: center - :alt: RV32M1-VEGA - - OpenISA VEGAboard (image copyright: www.open-isa.org) - The two RISC-V CPUs are named RI5CY and ZERO-RISCY, and are respectively based on the `PULP platform`_ designs by the same names: `RI5CY`_ and `ZERO-RISCY`_. RI5CY is the "main" core; it has more diff --git a/doc/hardware/porting/board_porting.rst b/doc/hardware/porting/board_porting.rst index c5df470cc8280..7291cc8e93ced 100644 --- a/doc/hardware/porting/board_porting.rst +++ b/doc/hardware/porting/board_porting.rst @@ -97,7 +97,7 @@ the :term:`SoC series` and :term:`SoC family` levels are not always used. +--------------------------------------------+--------------------------+-------------+--------------------+--------------------+----------------+----------------------+ | :zephyr:board:`frdm_k64f ` | mk64f12 | MK64F12 | Kinetis K6x | NXP Kinetis | Arm Cortex-M4 | ARMv7-M | +--------------------------------------------+--------------------------+-------------+--------------------+--------------------+----------------+----------------------+ - | :ref:`rv32m1_vega ` | openisa_rv32m1/ri5cy | RV32M1 | (Not used) | (Not used) | RI5CY | RISC-V RV32 | + | :zephyr:board:`rv32m1_vega ` | openisa_rv32m1/ri5cy | RV32M1 | (Not used) | (Not used) | RI5CY | RISC-V RV32 | +--------------------------------------------+--------------------------+-------------+--------------------+--------------------+----------------+----------------------+ | :ref:`nrf5340dk ` | nrf5340/cpuapp | nRF5340 | nRF53 | Nordic nRF | Arm Cortex-M33 | ARMv8-M | | +--------------------------+-------------+--------------------+--------------------+----------------+----------------------+ From 6205a387bba5b24c1f06887b1d57a6a22bf424b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 16:21:55 +0200 Subject: [PATCH 1580/4482] boards: panasonic: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Panasonic boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/panasonic/pan1770_evb/doc/index.rst | 15 ++++----------- boards/panasonic/pan1780_evb/doc/index.rst | 13 +++---------- boards/panasonic/pan1781_evb/doc/index.rst | 13 +++---------- boards/panasonic/pan1782_evb/doc/index.rst | 13 +++---------- boards/panasonic/pan1783/doc/index.rst | 11 ++--------- 5 files changed, 15 insertions(+), 50 deletions(-) diff --git a/boards/panasonic/pan1770_evb/doc/index.rst b/boards/panasonic/pan1770_evb/doc/index.rst index dd0efd1c8c416..c518d4baa82d8 100644 --- a/boards/panasonic/pan1770_evb/doc/index.rst +++ b/boards/panasonic/pan1770_evb/doc/index.rst @@ -1,7 +1,4 @@ -.. _pan1770_evb: - -PAN1770 Evaluation Board -######################## +.. zephyr:board:: pan1770_evb Overview ******** @@ -13,19 +10,15 @@ It is basically a clone of the official nRF52840 development kit (PCA10056) from Nordic Semiconductor. Please refer to :ref:`nrf52840dk_nrf52840` for further information. -.. figure:: pan1770_evaluation_board.jpg - :align: center - :alt: PAN1770 Evaluation Board - You can find more information about the PAN1770 module and the PAN1770 evaluation board on the `product website`_. The PAN1770 evaluation board is closely linked to these other evaluation boards: -* :ref:`pan1780_evb` -* :ref:`pan1781_evb` -* :ref:`pan1782_evb` +* :zephyr:board:`pan1780_evb` +* :zephyr:board:`pan1781_evb` +* :zephyr:board:`pan1782_evb` Usage ***** diff --git a/boards/panasonic/pan1780_evb/doc/index.rst b/boards/panasonic/pan1780_evb/doc/index.rst index 714b7b870f426..aac1ce9bd836f 100644 --- a/boards/panasonic/pan1780_evb/doc/index.rst +++ b/boards/panasonic/pan1780_evb/doc/index.rst @@ -1,7 +1,4 @@ -.. _pan1780_evb: - -PAN1780 Evaluation Board -######################## +.. zephyr:board:: pan1780_evb Overview ******** @@ -13,18 +10,14 @@ It is basically a clone of the official nRF52840 development kit (PCA10056) from Nordic Semiconductor. Please refer to :ref:`nrf52840dk_nrf52840` for further information. -.. figure:: pan1780_evaluation_board.jpg - :align: center - :alt: PAN1780 Evaluation Board - You can find more information about the PAN1780 module and the PAN1780 evaluation board on the `product website`_. The PAN1780 evaluation board is closely linked to these other evaluation boards: -* :ref:`pan1781_evb` -* :ref:`pan1782_evb` +* :zephyr:board:`pan1781_evb` +* :zephyr:board:`pan1782_evb` Usage ***** diff --git a/boards/panasonic/pan1781_evb/doc/index.rst b/boards/panasonic/pan1781_evb/doc/index.rst index 312aa581e0105..e8dc75b84ecae 100644 --- a/boards/panasonic/pan1781_evb/doc/index.rst +++ b/boards/panasonic/pan1781_evb/doc/index.rst @@ -1,7 +1,4 @@ -.. _pan1781_evb: - -PAN1781 Evaluation Board -######################## +.. zephyr:board:: pan1781_evb Overview ******** @@ -9,10 +6,6 @@ Overview The PAN1781 Evaluation Board is a development tool for the PAN1781 module which is based on the nRF52820 chipset from Nordic Semiconductor. -.. figure:: pan1781_evaluation_board.jpg - :align: center - :alt: PAN1781 Evaluation Board - You can find more information about the PAN1781 module and the PAN1781 evaluation board on the `product website`_. @@ -22,8 +15,8 @@ development kits for the nRF52820 from Nordic Semiconductor. The PAN1781 evaluation board is closely linked to these other evaluation boards: -* :ref:`pan1780_evb` -* :ref:`pan1782_evb` +* :zephyr:board:`pan1780_evb` +* :zephyr:board:`pan1782_evb` Usage ***** diff --git a/boards/panasonic/pan1782_evb/doc/index.rst b/boards/panasonic/pan1782_evb/doc/index.rst index c69b23c7bdc59..eb158172a88cb 100644 --- a/boards/panasonic/pan1782_evb/doc/index.rst +++ b/boards/panasonic/pan1782_evb/doc/index.rst @@ -1,7 +1,4 @@ -.. _pan1782_evb: - -PAN1782 Evaluation Board -######################## +.. zephyr:board:: pan1782_evb Overview ******** @@ -9,10 +6,6 @@ Overview The PAN1782 Evaluation Board is a development tool for the PAN1782 module which is based on the nRF52833 chipset from Nordic Semiconductor. -.. figure:: pan1782_evaluation_board.jpg - :align: center - :alt: PAN1782 Evaluation Board - You can find more information about the PAN1782 module and the PAN1782 evaluation board on the `product website`_. @@ -22,8 +15,8 @@ development kits for the nRF52833 from Nordic Semiconductor. The PAN1782 evaluation board is closely linked to these other evaluation boards: -* :ref:`pan1780_evb` -* :ref:`pan1781_evb` +* :zephyr:board:`pan1780_evb` +* :zephyr:board:`pan1781_evb` Usage ***** diff --git a/boards/panasonic/pan1783/doc/index.rst b/boards/panasonic/pan1783/doc/index.rst index 95b8b94444b98..72759be8d62ee 100644 --- a/boards/panasonic/pan1783/doc/index.rst +++ b/boards/panasonic/pan1783/doc/index.rst @@ -1,7 +1,4 @@ -.. _pan1783_evb: - -PAN1783, PAN1783A and PAN1783A-PA Evaluation Boards -################################################### +.. zephyr:board:: pan1783_evb Overview ******** @@ -17,11 +14,7 @@ Evaluation Boards can be found on the `product website`_. PAN1783 EVB *********** -.. figure:: img/pan1783_evb.webp - :align: center - :alt: PAN1783 EVB - - PAN1783 EVB (Credit: Panasonic) +This variant of the board is depicted in the "Board Overview" sidebar. PAN1783A EVB ************ From 3f1d066cdd7e00b72ef08485ebe41c4d540aab8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 16:23:14 +0200 Subject: [PATCH 1581/4482] boards: particle: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Particle boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/particle/argon/doc/index.rst | 11 +---------- boards/particle/boron/doc/index.rst | 11 +---------- boards/particle/nrf51_blenano/doc/index.rst | 5 +---- boards/particle/nrf52_blenano2/doc/index.rst | 5 +---- boards/particle/xenon/doc/index.rst | 11 +---------- 5 files changed, 5 insertions(+), 38 deletions(-) diff --git a/boards/particle/argon/doc/index.rst b/boards/particle/argon/doc/index.rst index 0cfedf946db83..d0391a102a495 100644 --- a/boards/particle/argon/doc/index.rst +++ b/boards/particle/argon/doc/index.rst @@ -1,7 +1,4 @@ -.. _particle_argon: - -Particle Argon -############## +.. zephyr:board:: particle_argon Overview ******** @@ -29,12 +26,6 @@ Hardware On the front of the board are RGB-LED, LED and LIPO circuitry. The RGB-LED is controlled by the nRF52840 via GPIO pins. -.. figure:: img/particle_argon.jpg - :align: center - :alt: Particle Argon - - Particle Argon (Credit: Particle Industries) - Power supply ============ diff --git a/boards/particle/boron/doc/index.rst b/boards/particle/boron/doc/index.rst index da87b144a0ddf..73ece4387d678 100644 --- a/boards/particle/boron/doc/index.rst +++ b/boards/particle/boron/doc/index.rst @@ -1,7 +1,4 @@ -.. _particle_boron: - -Particle Boron -############## +.. zephyr:board:: particle_boron Overview ******** @@ -29,12 +26,6 @@ Hardware On the front of the board are RGB-LED, LED and LIPO circuitry. The RGB-LED is controlled by the nRF52840 via GPIO pins. -.. figure:: img/particle_boron.jpg - :align: center - :alt: Particle Boron - - Particle Boron (Credit: Particle Industries) - Power supply ============ diff --git a/boards/particle/nrf51_blenano/doc/index.rst b/boards/particle/nrf51_blenano/doc/index.rst index 1d6d2ea4a2a93..5cedb0aa10011 100644 --- a/boards/particle/nrf51_blenano/doc/index.rst +++ b/boards/particle/nrf51_blenano/doc/index.rst @@ -1,7 +1,4 @@ -.. _nrf51_blenano: - -Redbear Labs Nano -################# +.. zephyr:board:: nrf51_blenano Overview ******** diff --git a/boards/particle/nrf52_blenano2/doc/index.rst b/boards/particle/nrf52_blenano2/doc/index.rst index b2d0824bfc116..5fd77e80c6784 100644 --- a/boards/particle/nrf52_blenano2/doc/index.rst +++ b/boards/particle/nrf52_blenano2/doc/index.rst @@ -1,7 +1,4 @@ -.. _nrf52_blenano2: - -Redbear Labs Nano v2 -#################### +.. zephyr:board:: nrf52_blenano2 Overview ******** diff --git a/boards/particle/xenon/doc/index.rst b/boards/particle/xenon/doc/index.rst index d28b8aac1c086..795393b09f4e8 100644 --- a/boards/particle/xenon/doc/index.rst +++ b/boards/particle/xenon/doc/index.rst @@ -1,7 +1,4 @@ -.. _particle_xenon: - -Particle Xenon -############## +.. zephyr:board:: particle_xenon Overview ******** @@ -28,12 +25,6 @@ Hardware On the front of the board are RGB-LED, LED and LIPO circuitry. The RGB-LED is controlled by the nRF52840 via GPIO pins. -.. figure:: img/particle_xenon.jpg - :align: center - :alt: Particle Xenon - - Particle Xenon (Credit: Particle Industries) - Power supply ============ From c4389076f5e2001c98e353ddacf1e688e4da8e55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 16:41:55 +0200 Subject: [PATCH 1582/4482] boards: pine64: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Pine64 boards to use the new `zephyr:board::` directive. Also drops the "leaflet" image which really isn't adding any value. Signed-off-by: Benjamin Cabé --- .../doc/img/PineTime_leaflet.jpg | Bin 67120 -> 0 bytes ...eTime_DevKit0.jpg => pinetime_devkit0.jpg} | Bin boards/pine64/pinetime_devkit0/doc/index.rst | 18 +----------------- 3 files changed, 1 insertion(+), 17 deletions(-) delete mode 100644 boards/pine64/pinetime_devkit0/doc/img/PineTime_leaflet.jpg rename boards/pine64/pinetime_devkit0/doc/img/{PineTime_DevKit0.jpg => pinetime_devkit0.jpg} (100%) diff --git a/boards/pine64/pinetime_devkit0/doc/img/PineTime_leaflet.jpg b/boards/pine64/pinetime_devkit0/doc/img/PineTime_leaflet.jpg deleted file mode 100644 index 8077093ac8396f1e114900a12bed9a5dba9097b7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 67120 zcmd42byQr>x;D6R2^yLNcb5bU?gS6+65O4}-4Y-joS;Di1c%@rAV?!Y0tA9f10CGm zrum(7?!B|t_kC+-{+eR#u4h-hRj-tE?cEO#e;!r<0wp;`IRFWfIFL91;9-^1O4irj z1^^Tl*#Jxc0MGz3Bs2gCfs_yz`MjgItLYj+PNSI4Vn1`1J0l4{vdAT3;BBB1%=J5mR-}na6 z2Qoq@3L;-aTqyt6kB-3T{{s{M8$Ze+A^)qNzX*){Z|s5a^D$xm^Y`#Sqwr`bLgT|c zAOm2cqhp|>VParlU}0fm&hB*eEJBTMNF&~p&x~7|0^VcB*uLU?93;Wq~5>hfoCT12^HojN<0)j%qGOuOj z9=Z0+nFJUqR;eSH1=Bi_A_jEepMNlN~dlA4yDk@=;du;^=X zNoiSaU427iQ*%q}kDlJXe(1p9(8T1_@9CL8vvaF!u=R~i_}{JVqvMm)v-69~tLsO< z9{v1J`d|7*i0}&;6%_>)h2N&~~(orsPn3=<@sm|xS4MbE2w zNNfTAh5d|yZ!od_G=EnK|w+c9tt5K0UQr;AH(UZm5enY z=VLf7EPXFn`Tz_HGmE5D2*-0Gkh36S!o^Ii#r@fn#O-4dQI*__^V?H~C`k%{D#KOL zF}~W{vru-2M~Psu=U|aA1hFEqfw3@1)>4zg7F<~9L2HHFCOmk8e4j#{L2H=XtlW~l z`Py~wNd^T;1*tQ>KqMIjv!TqC++BS*KX(n%>xhyR2bq!zks+-1TtpzvUz*6NHbNGP zXG}>D!vt)WFGbNTU$QE6B5elGnSNR1_`z5Ar!T{Oc>gc31(|9(tpBzB zowBJjQJ2#Ei#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bZpuG;i^6h%SBp<*>1 zW>ApPMU1$vm@O+So#hO+PF4%<`Zh`-Zniu(kkqUwN>`u9w%lr-$sXLHnxxNLF${<9-DXHJ zaK_f56S}q&644RXNUY=k$%oD_um;khF8UVNAYpv_&BWy|RKenJ=F|FParBaijjg8m z--A0*G28PjYk4&uYL|s`6};ZpcF`@Ikpo5<62Yw+N-h+Hw>tg~k!h{bxU--&J!2cC z{ogL)^39XaHGmLPzdB^Kr7ZeJyf|d3YvtV}hwm=OND%5{P~v(O2C5(hdoz*f3aHN+ zHAqmpKg(TgHz4--T=CybdVAczEg=51tIZYDzbcib#o$SK;)O5$EmkAJL*>o%np=!w zC{G8ltp}`HG7CgdREkx#^o1@QYEWypE|IszU4`3VqZGdiwO#ta(6=G^3>Hu)2sJ+L ztr2EtLU)nV8a>YCf7j~p;;nm^l*Bl)(&d>%8Al-2ps+@2tP$-*v_ow(8k@#GcTrq~ z3R7P{1@1-4Ouky@uU?L}a7aUDr7%mlgh>P!y`aLS3;F1Ml`1NzQ(%kT5V*dDBFmfa zxsL8ffXT|S7sw>4=>7NWuj`=toc%}{IBL&Qi;mFhoY&zTC@jR=XQjm3=f~@O+HSN~ zWa;L6Q$y(8DA9@y%)yBTM~MiWbqY>N@;C@ zKZc>Lb>M6gCB9vi<{}iRe#>^)jhH>w=A!s1yK@Fp`c4?(uGX&UK=s`z&!jLSj&{UP zxcsFe0fVNm${fD+dD0}xhY$ Date: Thu, 24 Oct 2024 13:05:08 -0700 Subject: [PATCH 1913/4482] net: http_server: Fix possible buffer underrun Avoid possible underruns when an url is shorter than a handled extension. Signed-off-by: Flavio Ceolin --- subsys/net/lib/http/http_server_core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/subsys/net/lib/http/http_server_core.c b/subsys/net/lib/http/http_server_core.c index 7574e385ea030..9b41d76d98339 100644 --- a/subsys/net/lib/http/http_server_core.c +++ b/subsys/net/lib/http/http_server_core.c @@ -760,7 +760,13 @@ void http_server_get_content_type_from_extension(char *url, char *content_type, size_t url_len = strlen(url); HTTP_SERVER_CONTENT_TYPE_FOREACH(ct) { - char *ext = &url[url_len - ct->extension_len]; + char *ext; + + if (url_len <= ct->extension_len) { + continue; + } + + ext = &url[url_len - ct->extension_len]; if (strncmp(ext, ct->extension, ct->extension_len) == 0) { strncpy(content_type, ct->content_type, content_type_size); From 46e16357738d8d2cf2f9b721a8336d8258b2a3e7 Mon Sep 17 00:00:00 2001 From: Riadh Ghaddab Date: Wed, 23 Oct 2024 18:09:14 +0200 Subject: [PATCH 1914/4482] fs: zms: multiple fixes from previous PR review This resolves some addressed comments in this PR https://github.com/zephyrproject-rtos/zephyr/pull/77930 It adds as well a section in the documentation about some recommendations to increase ZMS performance. Signed-off-by: Riadh Ghaddab --- doc/services/storage/zms/zms.rst | 84 +++++++++++----- include/zephyr/fs/zms.h | 108 ++++++++++----------- samples/subsys/fs/zms/src/main.c | 18 +++- subsys/fs/zms/Kconfig | 16 +-- subsys/fs/zms/zms.c | 162 ++++++++++++++++++++----------- subsys/fs/zms/zms_priv.h | 13 +-- tests/subsys/fs/zms/src/main.c | 53 +++++----- 7 files changed, 273 insertions(+), 181 deletions(-) diff --git a/doc/services/storage/zms/zms.rst b/doc/services/storage/zms/zms.rst index d1125e0505d24..02fed3cf77c4d 100644 --- a/doc/services/storage/zms/zms.rst +++ b/doc/services/storage/zms/zms.rst @@ -201,9 +201,9 @@ An entry has 16 bytes divided between these variables : struct zms_ate { uint8_t crc8; /* crc8 check of the entry */ - uint8_t cycle_cnt; /* cycle counter for non erasable devices */ - uint32_t id; /* data id */ + uint8_t cycle_cnt; /* cycle counter for non-erasable devices */ uint16_t len; /* data len within sector */ + uint32_t id; /* data id */ union { uint8_t data[8]; /* used to store small size data */ struct { @@ -218,21 +218,22 @@ An entry has 16 bytes divided between these variables : }; } __packed; -.. note:: The data CRC is checked only when the whole data of the element is read. - The data CRC is not checked for a partial read, as it is computed for the complete set of data. +.. note:: The CRC of the data is checked only when the whole the element is read. + The CRC of the data is not checked for a partial read, as it is computed for the whole element. -.. note:: Enabling the data CRC feature on a previously existing ZMS content without - data CRC will make all existing data invalid. +.. note:: Enabling the CRC feature on previously existing ZMS content without CRC enabled + will make all existing data invalid. .. _free-space: Available space for user data (key-value pairs) *********************************************** -For both scenarios ZMS should have always an empty sector to be able to perform the garbage -collection. -So if we suppose that 4 sectors exist in a partition, ZMS will only use 3 sectors to store -Key-value pairs and keep always one (rotating sector) empty to be able to launch GC. +For both scenarios ZMS should always have an empty sector to be able to perform the +garbage collection (GC). +So, if we suppose that 4 sectors exist in a partition, ZMS will only use 3 sectors to store +Key-value pairs and keep one sector empty to be able to launch GC. +The empty sector will rotate between the 4 sectors in the partition. .. note:: The maximum single data length that could be written at once in a sector is 64K (This could change in future versions of ZMS) @@ -240,8 +241,8 @@ Key-value pairs and keep always one (rotating sector) empty to be able to launch Small data values ================= -For small data values (<= 8 bytes), the data is stored within the entry (ATE) itself and no data -is written at the top of the sector. +Values smaller than 8 bytes will be stored within the entry (ATE) itself, without writing data +at the top of the sector. ZMS has an entry size of 16 bytes which means that the maximum available space in a partition to store data is computed in this scenario as : @@ -265,7 +266,7 @@ Large data values ================= Large data values ( > 8 bytes) are stored separately at the top of the sector. -In this case it is hard to estimate the free available space as this depends on the size of +In this case, it is hard to estimate the free available space, as this depends on the size of the data. But we can take into account that for N bytes of data (N > 8 bytes) an additional 16 bytes of ATE must be added at the bottom of the sector. @@ -286,17 +287,17 @@ This storage system is optimized for devices that do not require an erase. Using storage systems that rely on an erase-value (NVS as an example) will need to emulate the erase with write operations. This will cause a significant decrease in the life expectancy of these devices and will cause more delays for write operations and for initialization. -ZMS introduces a cycle count mechanism that avoids emulating erase operation for these devices. +ZMS uses a cycle count mechanism that avoids emulating erase operation for these devices. It also guarantees that every memory location is written only once for each cycle of sector write. -As an example, to erase a 4096 bytes sector on a non erasable device using NVS, 256 flash writes +As an example, to erase a 4096 bytes sector on a non-erasable device using NVS, 256 flash writes must be performed (supposing that write-block-size=16 bytes), while using ZMS only 1 write of 16 bytes is needed. This operation is 256 times faster in this case. Garbage collection operation is also adding some writes to the memory cell life expectancy as it is moving some blocks from one sector to another. To make the garbage collector not affect the life expectancy of the device it is recommended -to dimension correctly the partition size. Its size should be the double of the maximum size of +to correctly dimension the partition size. Its size should be the double of the maximum size of data (including extra headers) that could be written in the storage. See :ref:`free-space`. @@ -307,10 +308,10 @@ Device lifetime calculation Storage devices whether they are classical Flash or new technologies like RRAM/MRAM has a limited life expectancy which is determined by the number of times memory cells can be erased/written. Flash devices are erased one page at a time as part of their functional behavior (otherwise -memory cells cannot be overwritten) and for non erasable storage devices memory cells can be +memory cells cannot be overwritten) and for non-erasable storage devices memory cells can be overwritten directly. -A typical scenario is shown here to calculate the life expectancy of a device. +A typical scenario is shown here to calculate the life expectancy of a device: Let's suppose that we store an 8 bytes variable using the same ID but its content changes every minute. The partition has 4 sectors with 1024 bytes each. Each write of the variable requires 16 bytes of storage. @@ -361,9 +362,9 @@ Existing features ================= Version1 -------- -- Supports non erasable devices (only one write operation to erase a sector) +- Supports non-erasable devices (only one write operation to erase a sector) - Supports large partition size and sector size (64 bits address space) -- Supports large IDs width (32 bits) to store ID/Value pairs +- Supports 32-bit IDs to store ID/Value pairs - Small sized data ( <= 8 bytes) are stored in the ATE itself - Built-in Data CRC32 (included in the ATE) - Versionning of ZMS (to handle future evolution) @@ -375,7 +376,7 @@ Future features - Add multiple format ATE support to be able to use ZMS with different ATE formats that satisfies requirements from application - Add the possibility to skip garbage collector for some application usage where ID/value pairs - are written periodically and do not exceed half of the partition size (ther is always an old + are written periodically and do not exceed half of the partition size (there is always an old entry with the same ID). - Divide IDs into namespaces and allocate IDs on demand from application to handle collisions between IDs used by different subsystems or samples. @@ -394,9 +395,9 @@ functionality: :ref:`NVS ` and :ref:`FCB `. Which one to use in your application will depend on your needs and the hardware you are using, and this section provides information to help make a choice. -- If you are using a non erasable technology device like RRAM or MRAM, :ref:`ZMS ` is definitely the - best fit for your storage subsystem as it is designed very well to avoid emulating erase for - these devices and replace it by a single write call. +- If you are using a non-erasable technology device like RRAM or MRAM, :ref:`ZMS ` is definitely the + best fit for your storage subsystem as it is designed to avoid emulating erase operation using + large block writes for these devices and replaces it with a single write call. - For devices with large write_block_size and/or needs a sector size that is different than the classical flash page size (equal to erase_block_size), :ref:`ZMS ` is also the best fit as there is the possibility to customize these parameters and add the support of these devices in ZMS. @@ -414,6 +415,41 @@ verified to make sure that the application could work with one subsystem or the both solutions could be implemented, the best choice should be based on the calculations of the life expectancy of the device described in this section: :ref:`wear-leveling`. +Recommendations to increase performance +*************************************** + +Sector size and count +===================== + +- The total size of the storage partition should be well dimensioned to achieve the best + performance for ZMS. + All the information regarding the effectively available free space in ZMS can be found + in the documentation. See :ref:`free-space`. + We recommend choosing a storage partition that can hold double the size of the key-value pairs + that will be written in the storage. +- The size of a sector needs to be dimensioned to hold the maximum data length that will be stored. + Increasing the size of a sector will slow down the garbage collection operation which will + occur less frequently. + Decreasing its size, in the opposite, will make the garbage collection operation faster + which will occur more frequently. +- For some subsystems like :ref:`Settings `, all path-value pairs are split into two ZMS entries (ATEs). + The header needed by the two entries should be accounted when computing the needed storage space. +- Using small data to store in the ZMS entries can increase the performance, as this data is + written within the entry header. + For example, for the :ref:`Settings ` subsystem, choosing a path name that is + less than or equal to 8 bytes can make reads and writes faster. + +Dimensioning cache +================== + +- When using ZMS API directly, the recommended cache size should be, at least, equal to + the number of different entries that will be written in the storage. +- Each additional cache entry will add 8 bytes to your RAM usage. Cache size should be carefully + chosen. +- If you use ZMS through :ref:`Settings `, you have to take into account that each Settings entry is + divided into two ZMS entries. The recommended cache size should be, at least, twice the number + of Settings entries. + Sample ****** diff --git a/include/zephyr/fs/zms.h b/include/zephyr/fs/zms.h index 1155319d7924b..0f0fbb82cc94c 100644 --- a/include/zephyr/fs/zms.h +++ b/include/zephyr/fs/zms.h @@ -1,14 +1,14 @@ -/* ZMS: Zephyr Memory Storage - * - * Copyright (c) 2024 BayLibre SAS +/* Copyright (c) 2024 BayLibre SAS * * SPDX-License-Identifier: Apache-2.0 + * + * ZMS: Zephyr Memory Storage */ #ifndef ZEPHYR_INCLUDE_FS_ZMS_H_ #define ZEPHYR_INCLUDE_FS_ZMS_H_ -#include #include +#include #include #include #include @@ -18,7 +18,6 @@ extern "C" { #endif /** - * @brief Zephyr Memory Storage (ZMS) * @defgroup zms Zephyr Memory Storage (ZMS) * @ingroup file_system_storage * @{ @@ -26,37 +25,34 @@ extern "C" { */ /** - * @brief Zephyr Memory Storage Data Structures - * @defgroup zms_data_structures Zephyr Memory Storage Data Structures + * @defgroup zms_data_structures ZMS data structures * @ingroup zms * @{ */ -/** - * @brief Zephyr Memory Storage File system structure - */ +/** Zephyr Memory Storage file system structure */ struct zms_fs { - /** File system offset in flash **/ + /** File system offset in flash */ off_t offset; - /** Allocation table entry write address. - * Addresses are stored as uint64_t: + /** Allocation Table Entry (ATE) write address. + * Addresses are stored as `uint64_t`: * - high 4 bytes correspond to the sector * - low 4 bytes are the offset in the sector */ uint64_t ate_wra; /** Data write address */ uint64_t data_wra; - /** Storage system is split into sectors, each sector size must be multiple of erase-blocks - * if the device has erase capabilities + /** Storage system is split into sectors. The sector size must be a multiple of + * `erase-block-size` if the device has erase capabilities */ uint32_t sector_size; /** Number of sectors in the file system */ uint32_t sector_count; - /** Current cycle counter of the active sector (pointed by ate_wra)*/ + /** Current cycle counter of the active sector (pointed to by `ate_wra`) */ uint8_t sector_cycle; /** Flag indicating if the file system is initialized */ bool ready; - /** Mutex */ + /** Mutex used to lock flash writes */ struct k_mutex zms_lock; /** Flash device runtime structure */ const struct device *flash_device; @@ -65,7 +61,7 @@ struct zms_fs { /** Size of an Allocation Table Entry */ size_t ate_size; #if CONFIG_ZMS_LOOKUP_CACHE - /** Lookup table used to cache ATE address of a written ID */ + /** Lookup table used to cache ATE addresses of written IDs */ uint64_t lookup_cache[CONFIG_ZMS_LOOKUP_CACHE_SIZE]; #endif }; @@ -75,78 +71,77 @@ struct zms_fs { */ /** - * @brief Zephyr Memory Storage APIs - * @defgroup zms_high_level_api Zephyr Memory Storage APIs + * @defgroup zms_high_level_api ZMS API * @ingroup zms * @{ */ /** - * @brief Mount a ZMS file system onto the device specified in @p fs. + * @brief Mount a ZMS file system onto the device specified in `fs`. * - * @param fs Pointer to file system + * @param fs Pointer to the file system. * @retval 0 Success - * @retval -ERRNO errno code if error + * @retval -ERRNO Negative errno code on error */ int zms_mount(struct zms_fs *fs); /** * @brief Clear the ZMS file system from device. * - * @param fs Pointer to file system + * @param fs Pointer to the file system. * @retval 0 Success - * @retval -ERRNO errno code if error + * @retval -ERRNO Negative errno code on error */ int zms_clear(struct zms_fs *fs); /** * @brief Write an entry to the file system. * - * @note When @p len parameter is equal to @p 0 then entry is effectively removed (it is - * equivalent to calling of zms_delete). It is not possible to distinguish between a deleted + * @note When the `len` parameter is equal to `0` the entry is effectively removed (it is + * equivalent to calling @ref zms_delete()). It is not possible to distinguish between a deleted * entry and an entry with data of length 0. * - * @param fs Pointer to file system - * @param id Id of the entry to be written + * @param fs Pointer to the file system. + * @param id ID of the entry to be written * @param data Pointer to the data to be written - * @param len Number of bytes to be written (maximum 64 KB) + * @param len Number of bytes to be written (maximum 64 KiB) * * @return Number of bytes written. On success, it will be equal to the number of bytes requested - * to be written. When a rewrite of the same data already stored is attempted, nothing is written - * to flash, thus 0 is returned. On error, returns negative value of errno.h defined error codes. + * to be written or 0. + * When a rewrite of the same data already stored is attempted, nothing is written to flash, + * thus 0 is returned. On error, returns negative value of error codes defined in `errno.h`. */ ssize_t zms_write(struct zms_fs *fs, uint32_t id, const void *data, size_t len); /** * @brief Delete an entry from the file system * - * @param fs Pointer to file system - * @param id Id of the entry to be deleted + * @param fs Pointer to the file system. + * @param id ID of the entry to be deleted * @retval 0 Success - * @retval -ERRNO errno code if error + * @retval -ERRNO Negative errno code on error */ int zms_delete(struct zms_fs *fs, uint32_t id); /** * @brief Read an entry from the file system. * - * @param fs Pointer to file system - * @param id Id of the entry to be read + * @param fs Pointer to the file system. + * @param id ID of the entry to be read * @param data Pointer to data buffer - * @param len Number of bytes to be read (or size of the allocated read buffer) + * @param len Number of bytes to read at most * * @return Number of bytes read. On success, it will be equal to the number of bytes requested - * to be read. When the return value is less than the number of bytes requested to read this - * indicates that ATE contain less data than requested. On error, returns negative value of - * errno.h defined error codes. + * to be read or less than that if the stored data has a smaller size than the requested one. + * On error, returns negative value of error codes defined in `errno.h`. */ ssize_t zms_read(struct zms_fs *fs, uint32_t id, void *data, size_t len); /** * @brief Read a history entry from the file system. * - * @param fs Pointer to file system - * @param id Id of the entry to be read + * @param fs Pointer to the file system. + * @param id ID of the entry to be read * @param data Pointer to data buffer * @param len Number of bytes to be read * @param cnt History counter: 0: latest entry, 1: one before latest ... @@ -154,40 +149,41 @@ ssize_t zms_read(struct zms_fs *fs, uint32_t id, void *data, size_t len); * @return Number of bytes read. On success, it will be equal to the number of bytes requested * to be read. When the return value is larger than the number of bytes requested to read this * indicates not all bytes were read, and more data is available. On error, returns negative - * value of errno.h defined error codes. + * value of error codes defined in `errno.h`. */ ssize_t zms_read_hist(struct zms_fs *fs, uint32_t id, void *data, size_t len, uint32_t cnt); /** - * @brief Gets the data size that is stored in an entry with a given id + * @brief Gets the length of the data that is stored in an entry with a given ID * - * @param fs Pointer to file system - * @param id Id of the entry that we want to get its data length + * @param fs Pointer to the file system. + * @param id ID of the entry whose data length to retrieve. * * @return Data length contained in the ATE. On success, it will be equal to the number of bytes - * in the ATE. On error, returns negative value of errno.h defined error codes. + * in the ATE. On error, returns negative value of error codes defined in `errno.h`. */ ssize_t zms_get_data_length(struct zms_fs *fs, uint32_t id); + /** * @brief Calculate the available free space in the file system. * - * @param fs Pointer to file system + * @param fs Pointer to the file system. * - * @return Number of bytes free. On success, it will be equal to the number of bytes that can + * @return Number of free bytes. On success, it will be equal to the number of bytes that can * still be written to the file system. - * Calculating the free space is a time consuming operation, especially on spi flash. - * On error, returns negative value of errno.h defined error codes. + * Calculating the free space is a time-consuming operation, especially on SPI flash. + * On error, returns negative value of error codes defined in `errno.h`. */ ssize_t zms_calc_free_space(struct zms_fs *fs); /** - * @brief Tell how many contiguous free space remains in the currently active ZMS sector. + * @brief Tell how much contiguous free space remains in the currently active ZMS sector. * * @param fs Pointer to the file system. * * @return Number of free bytes. */ -size_t zms_sector_max_data_size(struct zms_fs *fs); +size_t zms_active_sector_free_space(struct zms_fs *fs); /** * @brief Close the currently active sector and switch to the next one. @@ -195,12 +191,12 @@ size_t zms_sector_max_data_size(struct zms_fs *fs); * @note The garbage collector is called on the new sector. * * @warning This routine is made available for specific use cases. - * It collides with the ZMS goal of avoiding any unnecessary flash erase operations. + * It collides with ZMS's goal of avoiding any unnecessary flash erase operations. * Using this routine extensively can result in premature failure of the flash device. * * @param fs Pointer to the file system. * - * @return 0 on success. On error, returns negative value of errno.h defined error codes. + * @return 0 on success. On error, returns negative value of error codes defined in `errno.h`. */ int zms_sector_use_next(struct zms_fs *fs); diff --git a/samples/subsys/fs/zms/src/main.c b/samples/subsys/fs/zms/src/main.c index a2166392724c9..959d5ac5f3e5b 100644 --- a/samples/subsys/fs/zms/src/main.c +++ b/samples/subsys/fs/zms/src/main.c @@ -83,7 +83,8 @@ int main(void) int rc = 0; char buf[16]; uint8_t key[8] = {0xDE, 0xAD, 0xBE, 0xEF, 0xDE, 0xAD, 0xBE, 0xEF}, longarray[128]; - uint32_t i_cnt = 0U, i; + uint32_t i_cnt = 0U; + uint32_t i; uint32_t id = 0; ssize_t free_space = 0; struct flash_pages_info info; @@ -144,7 +145,7 @@ int main(void) rc = zms_read(&fs, KEY_VALUE_ID, &key, sizeof(key)); if (rc > 0) { /* item was found, show it */ printk("Id: %x, Key: ", KEY_VALUE_ID); - for (int n = 0; n < 8; n++) { + for (uint8_t n = 0; n < 8; n++) { printk("%x ", key[n]); } printk("\n"); @@ -181,7 +182,7 @@ int main(void) if (rc > 0) { /* item was found, show it */ printk("Id: %d, Longarray: ", LONG_DATA_ID); - for (int n = 0; n < sizeof(longarray); n++) { + for (uint16_t n = 0; n < sizeof(longarray); n++) { printk("%x ", longarray[n]); } printk("\n"); @@ -204,7 +205,7 @@ int main(void) } if (i != MAX_ITERATIONS) { - printk("Error: Something went wrong at iteration %u rc=%d\n", i - 1, rc); + printk("Error: Something went wrong at iteration %u rc=%d\n", i, rc); return 0; } @@ -249,7 +250,7 @@ int main(void) * Let's compute free space in storage. But before doing that let's Garbage collect * all sectors where we deleted all entries and then compute the free space */ - for (uint32_t i = 0; i < fs.sector_count; i++) { + for (i = 0; i < fs.sector_count; i++) { rc = zms_sector_use_next(&fs); if (rc) { printk("Error while changing sector rc=%d\n", rc); @@ -261,6 +262,13 @@ int main(void) return 0; } printk("Free space in storage is %u bytes\n", free_space); + + /* Let's clean the storage now */ + rc = zms_clear(&fs); + if (rc < 0) { + printk("Error while cleaning the storage, rc=%d\n", rc); + } + printk("Sample code finished Successfully\n"); return 0; diff --git a/subsys/fs/zms/Kconfig b/subsys/fs/zms/Kconfig index 330ef11155ccc..dd3c5a184e1cf 100644 --- a/subsys/fs/zms/Kconfig +++ b/subsys/fs/zms/Kconfig @@ -1,9 +1,9 @@ -#Zephyr Memory Storage ZMS - #Copyright (c) 2024 BayLibre SAS #SPDX-License-Identifier: Apache-2.0 +#Zephyr Memory Storage ZMS + config ZMS bool "Zephyr Memory Storage" select CRC @@ -34,19 +34,19 @@ config ZMS_DATA_CRC help Enables DATA CRC -config ZMS_CUSTOM_BLOCK_SIZE - bool "Custom buffer size used by ZMS for reads and writes" +config ZMS_CUSTOMIZE_BLOCK_SIZE + bool "Customize the size of the buffer used internally for reads and writes" help - ZMS uses internal buffers to read/write and compare stored data. - Increasing the size of these buffers should be done carefully in order to not + ZMS uses an internal buffer to read/write and compare stored data. + Increasing the size of this buffer should be done carefully in order to not overflow the stack. Increasing this buffer means as well that ZMS could work with storage devices that have larger write-block-size which decreases ZMS performance -config ZMS_MAX_BLOCK_SIZE +config ZMS_CUSTOM_BLOCK_SIZE int "ZMS internal buffer size" default 32 - depends on ZMS_CUSTOM_BLOCK_SIZE + depends on ZMS_CUSTOMIZE_BLOCK_SIZE help Changes the internal buffer size of ZMS diff --git a/subsys/fs/zms/zms.c b/subsys/fs/zms/zms.c index 219303131093b..57ac0ad52e01b 100644 --- a/subsys/fs/zms/zms.c +++ b/subsys/fs/zms/zms.c @@ -1,8 +1,8 @@ -/* ZMS: Zephyr Memory Storage - * - * Copyright (c) 2024 BayLibre SAS +/* Copyright (c) 2024 BayLibre SAS * * SPDX-License-Identifier: Apache-2.0 + * + * ZMS: Zephyr Memory Storage */ #include @@ -42,8 +42,10 @@ static inline size_t zms_lookup_cache_pos(uint32_t id) static int zms_lookup_cache_rebuild(struct zms_fs *fs) { - int rc, previous_sector_num = ZMS_INVALID_SECTOR_NUM; - uint64_t addr, ate_addr; + int rc; + int previous_sector_num = ZMS_INVALID_SECTOR_NUM; + uint64_t addr; + uint64_t ate_addr; uint64_t *cache_entry; uint8_t current_cycle; struct zms_ate ate; @@ -110,6 +112,19 @@ static inline off_t zms_addr_to_offset(struct zms_fs *fs, uint64_t addr) return fs->offset + (fs->sector_size * SECTOR_NUM(addr)) + SECTOR_OFFSET(addr); } +/* Helper to round down len to the closest multiple of write_block_size */ +static inline size_t zms_round_down_write_block_size(struct zms_fs *fs, size_t len) +{ + return len & ~(fs->flash_parameters->write_block_size - 1U); +} + +/* Helper to round up len to multiple of write_block_size */ +static inline size_t zms_round_up_write_block_size(struct zms_fs *fs, size_t len) +{ + return (len + (fs->flash_parameters->write_block_size - 1U)) & + ~(fs->flash_parameters->write_block_size - 1U); +} + /* zms_al_size returns size aligned to fs->write_block_size */ static inline size_t zms_al_size(struct zms_fs *fs, size_t len) { @@ -118,7 +133,8 @@ static inline size_t zms_al_size(struct zms_fs *fs, size_t len) if (write_block_size <= 1U) { return len; } - return (len + (write_block_size - 1U)) & ~(write_block_size - 1U); + + return zms_round_up_write_block_size(fs, len); } /* Helper to get empty ATE address */ @@ -149,7 +165,7 @@ static int zms_flash_al_wrt(struct zms_fs *fs, uint64_t addr, const void *data, offset = zms_addr_to_offset(fs, addr); - blen = len & ~(fs->flash_parameters->write_block_size - 1U); + blen = zms_round_down_write_block_size(fs, len); if (blen > 0) { rc = flash_write(fs->flash_device, offset, data8, blen); if (rc) { @@ -231,10 +247,11 @@ static int zms_flash_block_cmp(struct zms_fs *fs, uint64_t addr, const void *dat { const uint8_t *data8 = (const uint8_t *)data; int rc; - size_t bytes_to_cmp, block_size; + size_t bytes_to_cmp; + size_t block_size; uint8_t buf[ZMS_BLOCK_SIZE]; - block_size = ZMS_BLOCK_SIZE & ~(fs->flash_parameters->write_block_size - 1U); + block_size = zms_round_down_write_block_size(fs, ZMS_BLOCK_SIZE); while (len) { bytes_to_cmp = MIN(block_size, len); @@ -260,10 +277,11 @@ static int zms_flash_block_cmp(struct zms_fs *fs, uint64_t addr, const void *dat static int zms_flash_cmp_const(struct zms_fs *fs, uint64_t addr, uint8_t value, size_t len) { int rc; - size_t bytes_to_cmp, block_size; + size_t bytes_to_cmp; + size_t block_size; uint8_t cmp[ZMS_BLOCK_SIZE]; - block_size = ZMS_BLOCK_SIZE & ~(fs->flash_parameters->write_block_size - 1U); + block_size = zms_round_down_write_block_size(fs, ZMS_BLOCK_SIZE); (void)memset(cmp, value, block_size); while (len) { @@ -284,10 +302,11 @@ static int zms_flash_cmp_const(struct zms_fs *fs, uint64_t addr, uint8_t value, static int zms_flash_block_move(struct zms_fs *fs, uint64_t addr, size_t len) { int rc; - size_t bytes_to_copy, block_size; + size_t bytes_to_copy; + size_t block_size; uint8_t buf[ZMS_BLOCK_SIZE]; - block_size = ZMS_BLOCK_SIZE & ~(fs->flash_parameters->write_block_size - 1U); + block_size = zms_round_down_write_block_size(fs, ZMS_BLOCK_SIZE); while (len) { bytes_to_copy = MIN(block_size, len); @@ -371,17 +390,17 @@ static int zms_ate_crc8_check(const struct zms_ate *entry) return 1; } -/* zms_ate_valid validates an ate: - * return 1 if crc8 and cycle_cnt valid, - * 0 otherwise +/* zms_ate_valid validates an ate in the current sector by checking if the ate crc is valid + * and its cycle cnt matches the cycle cnt of the active sector + * + * return 1 if ATE is valid, + * 0 otherwise + * + * see: zms_ate_valid_different_sector */ static int zms_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) { - if ((fs->sector_cycle != entry->cycle_cnt) || zms_ate_crc8_check(entry)) { - return 0; - } - - return 1; + return zms_ate_valid_different_sector(fs, entry, fs->sector_cycle); } /* zms_ate_valid_different_sector validates an ate that is in a different @@ -422,10 +441,11 @@ static inline int zms_get_cycle_on_sector_change(struct zms_fs *fs, uint64_t add return 0; } -/* zms_close_ate_valid validates an sector close ate: a valid sector close ate: - * - valid ate - * - len = 0 and id = ZMS_HEAD_ID - * - offset points to location at ate multiple from sector size +/* zms_close_ate_valid validates a sector close ate. + * A valid sector close ate should be: + * - a valid ate + * - with len = 0 and id = ZMS_HEAD_ID + * - and offset points to location at ate multiple from sector size * return true if valid, false otherwise */ static bool zms_close_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) @@ -434,9 +454,10 @@ static bool zms_close_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) (entry->id == ZMS_HEAD_ID) && !((fs->sector_size - entry->offset) % fs->ate_size)); } -/* zms_empty_ate_valid validates an sector empty ate: a valid sector empty ate: - * - valid ate - * - len = 0xffff and id = 0xffffffff +/* zms_empty_ate_valid validates an sector empty ate. + * A valid sector empty ate should be: + * - a valid ate + * - with len = 0xffff and id = 0xffffffff * return true if valid, false otherwise */ static bool zms_empty_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) @@ -531,7 +552,8 @@ static int zms_flash_write_entry(struct zms_fs *fs, uint32_t id, const void *dat */ static int zms_recover_last_ate(struct zms_fs *fs, uint64_t *addr, uint64_t *data_wra) { - uint64_t data_end_addr, ate_end_addr; + uint64_t data_end_addr; + uint64_t ate_end_addr; struct zms_ate end_ate; int rc; @@ -569,7 +591,8 @@ static int zms_recover_last_ate(struct zms_fs *fs, uint64_t *addr, uint64_t *dat static int zms_compute_prev_addr(struct zms_fs *fs, uint64_t *addr) { int sec_closed; - struct zms_ate empty_ate, close_ate; + struct zms_ate empty_ate; + struct zms_ate close_ate; *addr += fs->ate_size; if ((SECTOR_OFFSET(*addr)) != (fs->sector_size - 2 * fs->ate_size)) { @@ -632,7 +655,8 @@ static void zms_sector_advance(struct zms_fs *fs, uint64_t *addr) static int zms_sector_close(struct zms_fs *fs) { int rc; - struct zms_ate close_ate, garbage_ate; + struct zms_ate close_ate; + struct zms_ate garbage_ate; close_ate.id = ZMS_HEAD_ID; close_ate.len = 0U; @@ -806,7 +830,8 @@ static int zms_find_ate_with_id(struct zms_fs *fs, uint32_t id, uint64_t start_a { int rc; int previous_sector_num = ZMS_INVALID_SECTOR_NUM; - uint64_t wlk_prev_addr, wlk_addr; + uint64_t wlk_prev_addr; + uint64_t wlk_addr; int prev_found = 0; struct zms_ate wlk_ate; uint8_t current_cycle; @@ -848,9 +873,19 @@ static int zms_find_ate_with_id(struct zms_fs *fs, uint32_t id, uint64_t start_a */ static int zms_gc(struct zms_fs *fs) { - int rc, sec_closed; - struct zms_ate close_ate, gc_ate, wlk_ate, empty_ate; - uint64_t sec_addr, gc_addr, gc_prev_addr, wlk_addr, wlk_prev_addr, data_addr, stop_addr; + int rc; + int sec_closed; + struct zms_ate close_ate; + struct zms_ate gc_ate; + struct zms_ate wlk_ate; + struct zms_ate empty_ate; + uint64_t sec_addr; + uint64_t gc_addr; + uint64_t gc_prev_addr; + uint64_t wlk_addr; + uint64_t wlk_prev_addr; + uint64_t data_addr; + uint64_t stop_addr; uint8_t previous_cycle = 0; rc = zms_get_sector_cycle(fs, fs->ate_wra, &fs->sector_cycle); @@ -1027,14 +1062,16 @@ int zms_clear(struct zms_fs *fs) static int zms_init(struct zms_fs *fs) { - int rc, sec_closed; - struct zms_ate last_ate, first_ate, close_ate, empty_ate; - /* Initialize addr to 0 for the case fs->sector_count == 0. This - * should never happen as this is verified in zms_mount() but both - * Coverity and GCC believe the contrary. - */ - uint64_t addr = 0U, data_wra = 0U; - uint32_t i, closed_sectors = 0; + int rc; + int sec_closed; + struct zms_ate last_ate; + struct zms_ate first_ate; + struct zms_ate close_ate; + struct zms_ate empty_ate; + uint64_t addr = 0U; + uint64_t data_wra = 0U; + uint32_t i; + uint32_t closed_sectors = 0; bool zms_magic_exist = false; k_mutex_lock(&fs->zms_lock, K_FOREVER); @@ -1285,7 +1322,6 @@ static int zms_init(struct zms_fs *fs) int zms_mount(struct zms_fs *fs) { - int rc; struct flash_pages_info info; size_t write_block_size; @@ -1299,7 +1335,7 @@ int zms_mount(struct zms_fs *fs) } fs->ate_size = zms_al_size(fs, sizeof(struct zms_ate)); - write_block_size = flash_get_write_block_size(fs->flash_device); + write_block_size = fs->flash_parameters->write_block_size; /* check that the write block size is supported */ if (write_block_size > ZMS_BLOCK_SIZE || write_block_size == 0) { @@ -1357,8 +1393,10 @@ ssize_t zms_write(struct zms_fs *fs, uint32_t id, const void *data, size_t len) int rc; size_t data_size; struct zms_ate wlk_ate; - uint64_t wlk_addr, rd_addr; - uint32_t gc_count, required_space = 0U; /* no space, appropriate for delete ate */ + uint64_t wlk_addr; + uint64_t rd_addr; + uint32_t gc_count; + uint32_t required_space = 0U; /* no space, appropriate for delete ate */ int prev_found = 0; if (!fs->ready) { @@ -1498,8 +1536,11 @@ int zms_delete(struct zms_fs *fs, uint32_t id) ssize_t zms_read_hist(struct zms_fs *fs, uint32_t id, void *data, size_t len, uint32_t cnt) { - int rc, prev_found = 0; - uint64_t wlk_addr, rd_addr = 0, wlk_prev_addr = 0; + int rc; + int prev_found = 0; + uint64_t wlk_addr; + uint64_t rd_addr = 0; + uint64_t wlk_prev_addr = 0; uint32_t cnt_his; struct zms_ate wlk_ate; #ifdef CONFIG_ZMS_DATA_CRC @@ -1614,12 +1655,22 @@ ssize_t zms_get_data_length(struct zms_fs *fs, uint32_t id) ssize_t zms_calc_free_space(struct zms_fs *fs) { - - int rc, previous_sector_num = ZMS_INVALID_SECTOR_NUM, prev_found = 0, sec_closed; - struct zms_ate step_ate, wlk_ate, empty_ate, close_ate; - uint64_t step_addr, wlk_addr, step_prev_addr, wlk_prev_addr, data_wra = 0U; + int rc; + int previous_sector_num = ZMS_INVALID_SECTOR_NUM; + int prev_found = 0; + int sec_closed; + struct zms_ate step_ate; + struct zms_ate wlk_ate; + struct zms_ate empty_ate; + struct zms_ate close_ate; + uint64_t step_addr; + uint64_t wlk_addr; + uint64_t step_prev_addr; + uint64_t wlk_prev_addr; + uint64_t data_wra = 0U; uint8_t current_cycle; ssize_t free_space = 0; + const uint32_t second_to_last_offset = (2 * fs->ate_size); if (!fs->ready) { LOG_ERR("zms not initialized"); @@ -1683,9 +1734,8 @@ ssize_t zms_calc_free_space(struct zms_fs *fs) /* Let's look now for special cases where some sectors have only ATEs with * small data size. */ - const uint32_t second_to_last_offset = (2 * fs->ate_size); - for (uint32_t i = 0; i < fs->sector_count; i++) { + for (int i = 0; i < fs->sector_count; i++) { step_addr = zms_close_ate_addr(fs, ((uint64_t)i << ADDR_SECT_SHIFT)); /* verify if the sector is closed */ @@ -1718,7 +1768,7 @@ ssize_t zms_calc_free_space(struct zms_fs *fs) return free_space; } -size_t zms_sector_max_data_size(struct zms_fs *fs) +size_t zms_active_sector_free_space(struct zms_fs *fs) { if (!fs->ready) { LOG_ERR("ZMS not initialized"); diff --git a/subsys/fs/zms/zms_priv.h b/subsys/fs/zms/zms_priv.h index 6594048ea0f47..428ff6babca86 100644 --- a/subsys/fs/zms/zms_priv.h +++ b/subsys/fs/zms/zms_priv.h @@ -1,9 +1,10 @@ -/* ZMS: Zephyr Memory Storage - * - * Copyright (c) 2024 BayLibre SAS +/* Copyright (c) 2024 BayLibre SAS * * SPDX-License-Identifier: Apache-2.0 + * + * ZMS: Zephyr Memory Storage */ + #ifndef __ZMS_PRIV_H_ #define __ZMS_PRIV_H_ @@ -23,8 +24,8 @@ extern "C" { #define SECTOR_NUM(x) FIELD_GET(ADDR_SECT_MASK, x) #define SECTOR_OFFSET(x) FIELD_GET(ADDR_OFFS_MASK, x) -#if defined(CONFIG_ZMS_CUSTOM_BLOCK_SIZE) -#define ZMS_BLOCK_SIZE CONFIG_ZMS_MAX_BLOCK_SIZE +#if defined(CONFIG_ZMS_CUSTOMIZE_BLOCK_SIZE) +#define ZMS_BLOCK_SIZE CONFIG_ZMS_CUSTOM_BLOCK_SIZE #else #define ZMS_BLOCK_SIZE 32 #endif @@ -46,8 +47,8 @@ extern "C" { struct zms_ate { uint8_t crc8; /* crc8 check of the entry */ uint8_t cycle_cnt; /* cycle counter for non erasable devices */ - uint32_t id; /* data id */ uint16_t len; /* data len within sector */ + uint32_t id; /* data id */ union { uint8_t data[8]; /* used to store small size data */ struct { diff --git a/tests/subsys/fs/zms/src/main.c b/tests/subsys/fs/zms/src/main.c index 80866687dbab7..bd4e21dd74587 100644 --- a/tests/subsys/fs/zms/src/main.c +++ b/tests/subsys/fs/zms/src/main.c @@ -233,8 +233,7 @@ ZTEST_F(zms, test_zms_gc) int len; uint8_t buf[32]; uint8_t rd_buf[32]; - - const uint16_t max_id = 10; + const uint8_t max_id = 10; /* 21st write will trigger GC. */ const uint16_t max_writes = 21; @@ -243,7 +242,7 @@ ZTEST_F(zms, test_zms_gc) err = zms_mount(&fixture->fs); zassert_true(err == 0, "zms_mount call failure: %d", err); - for (uint32_t i = 0; i < max_writes; i++) { + for (int i = 0; i < max_writes; i++) { uint8_t id = (i % max_id); uint8_t id_data = id + max_id * (i / max_id); @@ -253,11 +252,11 @@ ZTEST_F(zms, test_zms_gc) zassert_true(len == sizeof(buf), "zms_write failed: %d", len); } - for (uint32_t id = 0; id < max_id; id++) { + for (int id = 0; id < max_id; id++) { len = zms_read(&fixture->fs, id, rd_buf, sizeof(buf)); zassert_true(len == sizeof(rd_buf), "zms_read unexpected failure: %d", len); - for (uint16_t i = 0; i < sizeof(rd_buf); i++) { + for (int i = 0; i < sizeof(rd_buf); i++) { rd_buf[i] = rd_buf[i] % max_id; buf[i] = id; } @@ -268,11 +267,11 @@ ZTEST_F(zms, test_zms_gc) err = zms_mount(&fixture->fs); zassert_true(err == 0, "zms_mount call failure: %d", err); - for (uint32_t id = 0; id < max_id; id++) { + for (int id = 0; id < max_id; id++) { len = zms_read(&fixture->fs, id, rd_buf, sizeof(buf)); zassert_true(len == sizeof(rd_buf), "zms_read unexpected failure: %d", len); - for (uint16_t i = 0; i < sizeof(rd_buf); i++) { + for (int i = 0; i < sizeof(rd_buf); i++) { rd_buf[i] = rd_buf[i] % max_id; buf[i] = id; } @@ -286,7 +285,7 @@ static void write_content(uint32_t max_id, uint32_t begin, uint32_t end, struct uint8_t buf[32]; ssize_t len; - for (uint32_t i = begin; i < end; i++) { + for (int i = begin; i < end; i++) { uint8_t id = (i % max_id); uint8_t id_data = id + max_id * (i / max_id); @@ -303,11 +302,11 @@ static void check_content(uint32_t max_id, struct zms_fs *fs) uint8_t buf[32]; ssize_t len; - for (uint32_t id = 0; id < max_id; id++) { + for (int id = 0; id < max_id; id++) { len = zms_read(fs, id, rd_buf, sizeof(buf)); zassert_true(len == sizeof(rd_buf), "zms_read unexpected failure: %d", len); - for (uint16_t i = 0; i < ARRAY_SIZE(rd_buf); i++) { + for (int i = 0; i < ARRAY_SIZE(rd_buf); i++) { rd_buf[i] = rd_buf[i] % max_id; buf[i] = id; } @@ -322,7 +321,6 @@ static void check_content(uint32_t max_id, struct zms_fs *fs) ZTEST_F(zms, test_zms_gc_3sectors) { int err; - const uint16_t max_id = 10; /* 41st write will trigger 1st GC. */ const uint16_t max_writes = 41; @@ -410,7 +408,6 @@ ZTEST_F(zms, test_zms_corrupted_sector_close_operation) uint32_t *flash_write_stat; uint32_t *flash_max_write_calls; uint32_t *flash_max_len; - const uint16_t max_id = 10; /* 21st write will trigger GC. */ const uint16_t max_writes = 21; @@ -423,7 +420,7 @@ ZTEST_F(zms, test_zms_corrupted_sector_close_operation) err = zms_mount(&fixture->fs); zassert_true(err == 0, "zms_mount call failure: %d", err); - for (uint32_t i = 0; i < max_writes; i++) { + for (int i = 0; i < max_writes; i++) { uint8_t id = (i % max_id); uint8_t id_data = id + max_id * (i / max_id); @@ -465,7 +462,7 @@ ZTEST_F(zms, test_zms_full_sector) int err; ssize_t len; uint32_t filling_id = 0; - uint32_t i, data_read; + uint32_t data_read; fixture->fs.sector_count = 3; @@ -493,7 +490,7 @@ ZTEST_F(zms, test_zms_full_sector) zassert_true(len == sizeof(filling_id), "zms_write failed: %d", len); /* sanitycheck on ZMS content */ - for (i = 0; i <= filling_id; i++) { + for (int i = 0; i <= filling_id; i++) { len = zms_read(&fixture->fs, i, &data_read, sizeof(data_read)); if (i == 1) { zassert_true(len == -ENOENT, "zms_read shouldn't found the entry: %d", len); @@ -511,8 +508,10 @@ ZTEST_F(zms, test_delete) { int err; ssize_t len; - uint32_t filling_id, data_read; - uint32_t ate_wra, data_wra; + uint32_t filling_id; + uint32_t data_read; + uint32_t ate_wra; + uint32_t data_wra; fixture->fs.sector_count = 3; @@ -570,7 +569,9 @@ ZTEST_F(zms, test_delete) */ ZTEST_F(zms, test_zms_gc_corrupt_close_ate) { - struct zms_ate ate, close_ate, empty_ate; + struct zms_ate ate; + struct zms_ate close_ate; + struct zms_ate empty_ate; uint32_t data; ssize_t len; int err; @@ -642,7 +643,8 @@ ZTEST_F(zms, test_zms_gc_corrupt_close_ate) */ ZTEST_F(zms, test_zms_gc_corrupt_ate) { - struct zms_ate corrupt_ate, close_ate; + struct zms_ate corrupt_ate; + struct zms_ate close_ate; int err; close_ate.id = 0xffffffff; @@ -685,10 +687,10 @@ ZTEST_F(zms, test_zms_gc_corrupt_ate) #ifdef CONFIG_ZMS_LOOKUP_CACHE static size_t num_matching_cache_entries(uint64_t addr, bool compare_sector_only, struct zms_fs *fs) { - size_t i, num = 0; + size_t num = 0; uint64_t mask = compare_sector_only ? ADDR_SECT_MASK : UINT64_MAX; - for (i = 0; i < CONFIG_ZMS_LOOKUP_CACHE_SIZE; i++) { + for (int i = 0; i < CONFIG_ZMS_LOOKUP_CACHE_SIZE; i++) { if ((fs->lookup_cache[i] & mask) == addr) { num++; } @@ -759,20 +761,19 @@ ZTEST_F(zms, test_zms_cache_collission) { #ifdef CONFIG_ZMS_LOOKUP_CACHE int err; - uint32_t id; uint16_t data; fixture->fs.sector_count = 4; err = zms_mount(&fixture->fs); zassert_true(err == 0, "zms_mount call failure: %d", err); - for (id = 0; id < CONFIG_ZMS_LOOKUP_CACHE_SIZE + 1; id++) { + for (int id = 0; id < CONFIG_ZMS_LOOKUP_CACHE_SIZE + 1; id++) { data = id; err = zms_write(&fixture->fs, id, &data, sizeof(data)); zassert_equal(err, sizeof(data), "zms_write call failure: %d", err); } - for (id = 0; id < CONFIG_ZMS_LOOKUP_CACHE_SIZE + 1; id++) { + for (int id = 0; id < CONFIG_ZMS_LOOKUP_CACHE_SIZE + 1; id++) { err = zms_read(&fixture->fs, id, &data, sizeof(data)); zassert_equal(err, sizeof(data), "zms_read call failure: %d", err); zassert_equal(data, id, "incorrect data read"); @@ -846,7 +847,7 @@ ZTEST_F(zms, test_zms_cache_hash_quality) /* Write ZMS IDs from 0 to CONFIG_ZMS_LOOKUP_CACHE_SIZE - 1 */ - for (uint16_t i = 0; i < CONFIG_ZMS_LOOKUP_CACHE_SIZE; i++) { + for (int i = 0; i < CONFIG_ZMS_LOOKUP_CACHE_SIZE; i++) { id = i; data = 0; @@ -869,7 +870,7 @@ ZTEST_F(zms, test_zms_cache_hash_quality) /* Write CONFIG_ZMS_LOOKUP_CACHE_SIZE ZMS IDs that form the following series: 0, 4, 8... */ - for (uint16_t i = 0; i < CONFIG_ZMS_LOOKUP_CACHE_SIZE; i++) { + for (int i = 0; i < CONFIG_ZMS_LOOKUP_CACHE_SIZE; i++) { id = i * 4; data = 0; From ee1cbf063c971e96ea1c92f95bb5273e97566f34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 25 Oct 2024 08:13:46 +0200 Subject: [PATCH 1915/4482] drivers: serial: nrfx_uart: Fix poll_out for low baudrates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit uart_poll_out had 1 ms timeout which is too short for lower baudrates. Increase to 10 ms. Signed-off-by: Krzysztof Chruściński --- drivers/serial/uart_nrfx_uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/serial/uart_nrfx_uart.c b/drivers/serial/uart_nrfx_uart.c index 1e0da0f882f01..2cf347ded291e 100644 --- a/drivers/serial/uart_nrfx_uart.c +++ b/drivers/serial/uart_nrfx_uart.c @@ -287,7 +287,7 @@ static void uart_nrfx_poll_out(const struct device *dev, unsigned char c) /* Wait until the transmitter is ready, i.e. the character is sent. */ bool res; - NRFX_WAIT_FOR(event_txdrdy_check(), 1000, 1, res); + NRFX_WAIT_FOR(event_txdrdy_check(), 10000, 1, res); /* Deactivate the transmitter so that it does not needlessly * consume power. From 94f307ab75f4fd4642186566cb8429395d3a14e7 Mon Sep 17 00:00:00 2001 From: Tahsin Mutlugun Date: Fri, 25 Oct 2024 09:50:01 +0300 Subject: [PATCH 1916/4482] arch: xtensa: rename processor state save and restore calls _xtos_pso_savearea and _xtos_core_restore_nw have been renamed to xthal_pso_savearea and xthal_core_restore_nw in recent Xtensa toolchains. Rename them in reset_vector.S to prevent linker errors when building Zephyr with Xtensa toolchain. Signed-off-by: Tahsin Mutlugun --- arch/xtensa/core/startup/reset_vector.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/xtensa/core/startup/reset_vector.S b/arch/xtensa/core/startup/reset_vector.S index 31877614ccdb6..21f4b25e77e07 100644 --- a/arch/xtensa/core/startup/reset_vector.S +++ b/arch/xtensa/core/startup/reset_vector.S @@ -104,7 +104,7 @@ _ResetHandler: /* Read PWRSTAT */ movi a2, XDM_MISC_PWRSTAT /* Save area address - retained for later */ - movi a3, _xtos_pso_savearea + movi a3, xthal_pso_savearea /* Signature for compare - retained for later */ movi a5, CORE_STATE_SIGNATURE /* PWRSTAT value - retained for later */ @@ -229,7 +229,7 @@ _ResetHandler: * MEMCTL register was already restored earlier, and as a side * effect, registers a3, a5, a7 are now preloaded with values * that we will use here. - * a3 - pointer to save area base address (_xtos_pso_savearea) + * a3 - pointer to save area base address (xthal_pso_savearea) * a5 - saved state signature (CORE_STATE_SIGNATURE) * a7 - contents of PWRSTAT register */ @@ -343,11 +343,11 @@ _ResetHandler: /* make shutoff routine return zero */ movi a2, 0 - movi a3, _xtos_pso_savearea + movi a3, xthal_pso_savearea /* Here, as below for _start, call0 is used as an unlimited-range * jump. */ - call0 _xtos_core_restore_nw + call0 xthal_core_restore_nw /* (does not return) */ .Lcoldstart: #endif From 27d93f8b6ca514623b2a50178d9695ce645562e8 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Mon, 28 Oct 2024 14:42:13 +0100 Subject: [PATCH 1917/4482] net: ipv4: Fix ARP probe check in address conflict detection The second condition needs to check ARP probes only The ACD is not properly implemented as described in RFC5227 ch. 2.1.1 The implementation incorrectly detects an IP conflict, if an ARP request is received for the target IP. The reason is that the current implementation checks for ARP requests instead of ARP probes. Signed-off-by: Andreas Huber --- subsys/net/ip/ipv4_acd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/subsys/net/ip/ipv4_acd.c b/subsys/net/ip/ipv4_acd.c index c4f5bdccad2a3..3cb1d2c6f9526 100644 --- a/subsys/net/ip/ipv4_acd.c +++ b/subsys/net/ip/ipv4_acd.c @@ -288,15 +288,18 @@ enum net_verdict net_ipv4_acd_input(struct net_if *iface, struct net_pkt *pkt) ll_addr = net_if_get_link_addr(addr_iface); /* RFC 5227, ch. 2.1.1 Probe Details: - * - Sender IP address match OR, - * - Target IP address match with different sender HW address, + * - ARP Request/Reply with Sender IP address match OR, + * - ARP Probe where Target IP address match with different sender HW address, * indicate a conflict. + * ARP Probe has an all-zero sender IP address */ if (net_ipv4_addr_cmp_raw(arp_hdr->src_ipaddr, (uint8_t *)&ifaddr->address.in_addr) || (net_ipv4_addr_cmp_raw(arp_hdr->dst_ipaddr, (uint8_t *)&ifaddr->address.in_addr) && - memcmp(&arp_hdr->src_hwaddr, ll_addr->addr, ll_addr->len) != 0)) { + (memcmp(&arp_hdr->src_hwaddr, ll_addr->addr, ll_addr->len) != 0) && + (net_ipv4_addr_cmp_raw(arp_hdr->src_ipaddr, + (uint8_t *)&(struct in_addr)INADDR_ANY_INIT)))) { NET_DBG("Conflict detected from %s for %s", net_sprint_ll_addr((uint8_t *)&arp_hdr->src_hwaddr, arp_hdr->hwlen), From f23318fa9c4b97aa03d4b7c231798e2521188441 Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Sun, 27 Oct 2024 21:18:33 +0100 Subject: [PATCH 1918/4482] doc: project: Fix collaborator reference Commit 52e8b1058cc074725603a3f20baa807f0c4ab3ca (doc: project: clarify WG member eligibility) broke the link to the collaborator section by using nested inline markup, which is currently not supported: https://docutils.sourceforge.io/FAQ.html#is-nested-inline-markup-possible As the various workarounds are not recommended by Docutils, this change simply ends the bold formatting before the link. Signed-off-by: Reto Schneider --- doc/project/working_groups.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/project/working_groups.rst b/doc/project/working_groups.rst index dcdf0e139e3e7..52a09fd57ad73 100644 --- a/doc/project/working_groups.rst +++ b/doc/project/working_groups.rst @@ -18,8 +18,8 @@ Working Group Membership Eligibility consultation with the TSC. - Each working group shall have a team of members who are actively involved in its activities and decision-making processes. -- It is expected that WG membership shall be **open to all Zephyr project - :ref:`Collaborators `**; however, working groups may impose +- It is expected that WG membership shall be **open to all** Zephyr project + :ref:`Collaborators `; however, working groups may impose restrictions such as the number of participants from a single company. - All TSC members are eligible to join a working group as members, part of the responsibilities being a TSC member. From 5030938b789439a48771896e2c6a5f2a28516be5 Mon Sep 17 00:00:00 2001 From: Sudan Landge Date: Thu, 24 Oct 2024 20:43:36 +0100 Subject: [PATCH 1919/4482] arm: linker: fix: incorrect __kernel_ram_start What is changed? arch32 related changes in linker script made in commit ad719014901303a0b89200ea7c80672dd7d75805 are reverted. Why do we need this change? The main intention of the previous commit was to fix the broken ci for aarch64. There was no issue reported for aarch32 and changes were made for consistency. However, it looks like keeping the `__kernel_ram_start` outside of the bss section works differently for different boards. For fvp_baser_aemv8r arch32, _bss_start points to _rom_region_end and __kernel_ram_start points to some region between _rom_region_start and _rom_region_end which leads to test failure. While for other board like v2m_musca_b1, _bss_start and __kernel_ram_start are same. The linker scripts might need a cleanup to avoid issues because of these inconsistncies however, till we understand this better, we need to revert this change. Signed-off-by: Sudan Landge --- include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld | 2 +- include/zephyr/arch/arm/cortex_m/scripts/linker.ld | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld b/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld index 32fd57ca15b28..239ab62129371 100644 --- a/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld @@ -293,7 +293,6 @@ SECTIONS _app_smem_rom_start = LOADADDR(_APP_SMEM_SECTION_NAME); #endif /* CONFIG_USERSPACE */ - __kernel_ram_start = .; SECTION_DATA_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD), BSS_ALIGN) { /* @@ -302,6 +301,7 @@ SECTIONS */ . = ALIGN(4); __bss_start = .; + __kernel_ram_start = .; *(.bss) *(".bss.*") diff --git a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld index 706182612a5c1..9e123b120de7c 100644 --- a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld @@ -289,7 +289,6 @@ SECTIONS _app_smem_size = _app_smem_end - _app_smem_start; _app_smem_rom_start = LOADADDR(_APP_SMEM_SECTION_NAME); - __kernel_ram_start = .; SECTION_DATA_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD),) { /* @@ -298,6 +297,7 @@ SECTIONS */ . = ALIGN(4); __bss_start = .; + __kernel_ram_start = .; *(.bss) *(".bss.*") @@ -358,7 +358,6 @@ SECTIONS __data_region_end = .; #ifndef CONFIG_USERSPACE - __kernel_ram_start = .; SECTION_DATA_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD),) { /* @@ -367,6 +366,7 @@ SECTIONS */ . = ALIGN(4); __bss_start = .; + __kernel_ram_start = .; *(.bss) *(".bss.*") From 5ee9d7a8695fe941020cac53ed4381d63c4bc7cf Mon Sep 17 00:00:00 2001 From: Dimitrije Lilic Date: Thu, 24 Oct 2024 15:57:46 +0200 Subject: [PATCH 1920/4482] driver: sensor: adxl345: Bug fix for q31_t conv This is a bug fix for adxl345_accel_convert_q31 functions. Functions are used to convert samples received from sensor to q31_t format when RTIO stream is used. Signed-off-by: Dimitrije Lilic --- drivers/sensor/adi/adxl345/adxl345.c | 13 +++- drivers/sensor/adi/adxl345/adxl345.h | 21 ++++-- drivers/sensor/adi/adxl345/adxl345_decoder.c | 78 ++++++++++++++++++-- drivers/sensor/adi/adxl345/adxl345_stream.c | 2 + 4 files changed, 96 insertions(+), 18 deletions(-) diff --git a/drivers/sensor/adi/adxl345/adxl345.c b/drivers/sensor/adi/adxl345/adxl345.c index 33c4d2a3a3268..d5f07bad26585 100644 --- a/drivers/sensor/adi/adxl345/adxl345.c +++ b/drivers/sensor/adi/adxl345/adxl345.c @@ -438,7 +438,7 @@ static int adxl345_init(const struct device *dev) #ifdef CONFIG_ADXL345_TRIGGER const struct adxl345_dev_config *cfg = dev->config; #endif - uint8_t dev_id; + uint8_t dev_id, full_res; data->sample_number = 0; @@ -459,12 +459,14 @@ static int adxl345_init(const struct device *dev) return -EIO; } - rc = adxl345_reg_write_byte(dev, ADXL345_DATA_FORMAT_REG, ADXL345_RANGE_16G); + rc = adxl345_reg_write_byte(dev, ADXL345_DATA_FORMAT_REG, ADXL345_RANGE_8G); if (rc < 0) { LOG_ERR("Data format set failed\n"); return -EIO; } + data->selected_range = ADXL345_RANGE_8G; + rc = adxl345_reg_write_byte(dev, ADXL345_RATE_REG, ADXL345_RATE_25HZ); if (rc < 0) { LOG_ERR("Rate setting failed\n"); @@ -497,11 +499,16 @@ static int adxl345_init(const struct device *dev) if (rc) { return rc; } - rc = adxl345_interrupt_config(dev, ADXL345_INT_MAP_WATERMARK_MSK); + rc = adxl345_interrupt_config(dev, ADXL345_INT_MAP_WATERMARK_MSK); if (rc) { return rc; } #endif + + rc = adxl345_reg_read_byte(dev, ADXL345_DATA_FORMAT_REG, &full_res); + uint8_t is_full_res_set = (full_res & ADXL345_DATA_FORMAT_FULL_RES) != 0; + + data->is_full_res = is_full_res_set; return 0; } diff --git a/drivers/sensor/adi/adxl345/adxl345.h b/drivers/sensor/adi/adxl345/adxl345.h index efa284ae0b63e..4fc55d307c1a3 100644 --- a/drivers/sensor/adi/adxl345/adxl345.h +++ b/drivers/sensor/adi/adxl345/adxl345.h @@ -40,13 +40,14 @@ #define SAMPLE_NUM 0x1F /* Registers */ -#define ADXL345_DEVICE_ID_REG 0x00 -#define ADXL345_RATE_REG 0x2c -#define ADXL345_POWER_CTL_REG 0x2d -#define ADXL345_DATA_FORMAT_REG 0x31 -#define ADXL345_X_AXIS_DATA_0_REG 0x32 -#define ADXL345_FIFO_CTL_REG 0x38 -#define ADXL345_FIFO_STATUS_REG 0x39 +#define ADXL345_DEVICE_ID_REG 0x00 +#define ADXL345_RATE_REG 0x2c +#define ADXL345_POWER_CTL_REG 0x2d +#define ADXL345_DATA_FORMAT_REG 0x31 +#define ADXL345_DATA_FORMAT_FULL_RES 0x08 +#define ADXL345_X_AXIS_DATA_0_REG 0x32 +#define ADXL345_FIFO_CTL_REG 0x38 +#define ADXL345_FIFO_STATUS_REG 0x39 #define ADXL345_PART_ID 0xe5 @@ -58,6 +59,7 @@ #define ADXL345_ENABLE_MEASURE_BIT (1 << 3) #define ADXL345_FIFO_STREAM_MODE (1 << 7) #define ADXL345_FIFO_COUNT_MASK 0x3f +#define ADXL345_COMPLEMENT_MASK(x) GENMASK(15, (x)) #define ADXL345_COMPLEMENT 0xfc00 #define ADXL345_MAX_FIFO_SIZE 32 @@ -149,6 +151,8 @@ struct adxl345_dev_data { int16_t bufy[ADXL345_MAX_FIFO_SIZE]; int16_t bufz[ADXL345_MAX_FIFO_SIZE]; struct adxl345_fifo_config fifo_config; + uint8_t is_full_res; + uint8_t selected_range; #ifdef CONFIG_ADXL345_TRIGGER struct gpio_callback gpio_cb; @@ -182,6 +186,8 @@ struct adxl345_dev_data { struct adxl345_fifo_data { uint8_t is_fifo: 1; + uint8_t is_full_res: 1; + uint8_t selected_range: 2; uint8_t sample_set_size: 4; uint8_t int_status; uint16_t accel_odr: 4; @@ -194,6 +200,7 @@ struct adxl345_sample { uint8_t is_fifo: 1; uint8_t res: 7; #endif /* CONFIG_ADXL345_STREAM */ + uint8_t selected_range; int16_t x; int16_t y; int16_t z; diff --git a/drivers/sensor/adi/adxl345/adxl345_decoder.c b/drivers/sensor/adi/adxl345/adxl345_decoder.c index ce8323628fd31..7a1bf53cb0584 100644 --- a/drivers/sensor/adi/adxl345/adxl345_decoder.c +++ b/drivers/sensor/adi/adxl345/adxl345_decoder.c @@ -19,13 +19,70 @@ static const uint32_t accel_period_ns[] = { [ADXL345_ODR_400HZ] = UINT32_C(1000000000) / 400, }; -static inline void adxl345_accel_convert_q31(q31_t *out, uint16_t sample) +static const uint32_t range_to_shift[] = { + [ADXL345_RANGE_2G] = 5, + [ADXL345_RANGE_4G] = 6, + [ADXL345_RANGE_8G] = 7, + [ADXL345_RANGE_16G] = 8, +}; + +/* (1 / sensitivity) * (pow(2,31) / pow(2,shift)) * (unit_scaler) */ +static const uint32_t qscale_factor_no_full_res[] = { + /* (1.0 / ADXL362_ACCEL_2G_LSB_PER_G) * (2^31 / 2^5) * SENSOR_G / 1000000 */ + [ADXL345_RANGE_2G] = UINT32_C(2569011), + /* (1.0 / ADXL362_ACCEL_4G_LSB_PER_G) * (2^31 / 2^6) * SENSOR_G / 1000000 */ + [ADXL345_RANGE_4G] = UINT32_C(642253), + /* (1.0 / ADXL362_ACCEL_8G_LSB_PER_G) * (2^31 / 2^7) ) * SENSOR_G / 1000000 */ + [ADXL345_RANGE_8G] = UINT32_C(160563), + /* (1.0 / ADXL362_ACCEL_8G_LSB_PER_G) * (2^31 / 2^8) ) * SENSOR_G / 1000000 */ + [ADXL345_RANGE_16G] = UINT32_C(40141), +}; + +/* (1 / sensitivity) * (pow(2,31) / pow(2,shift)) * (unit_scaler) */ +static const uint32_t qscale_factor_full_res[] = { + /* (1.0 / ADXL362_ACCEL_2G_LSB_PER_G) * (2^31 / 2^5) * SENSOR_G / 1000000 */ + [ADXL345_RANGE_2G] = UINT32_C(2569011), + /* (1.0 / ADXL362_ACCEL_4G_LSB_PER_G) * (2^31 / 2^6) * SENSOR_G / 1000000 */ + [ADXL345_RANGE_4G] = UINT32_C(1284506), + /* (1.0 / ADXL362_ACCEL_8G_LSB_PER_G) * (2^31 / 2^7) ) * SENSOR_G / 1000000 */ + [ADXL345_RANGE_8G] = UINT32_C(642253), + /* (1.0 / ADXL362_ACCEL_8G_LSB_PER_G) * (2^31 / 2^8) ) * SENSOR_G / 1000000 */ + [ADXL345_RANGE_16G] = UINT32_C(321126), +}; + +static inline void adxl345_accel_convert_q31(q31_t *out, int16_t sample, int32_t range, + uint8_t is_full_res) { - if (sample & BIT(9)) { - sample |= ADXL345_COMPLEMENT; + if (is_full_res) { + switch (range) { + case ADXL345_RANGE_2G: + if (sample & BIT(9)) { + sample |= ADXL345_COMPLEMENT_MASK(10); + } + break; + case ADXL345_RANGE_4G: + if (sample & BIT(10)) { + sample |= ADXL345_COMPLEMENT_MASK(11); + } + break; + case ADXL345_RANGE_8G: + if (sample & BIT(11)) { + sample |= ADXL345_COMPLEMENT_MASK(12); + } + break; + case ADXL345_RANGE_16G: + if (sample & BIT(12)) { + sample |= ADXL345_COMPLEMENT_MASK(13); + } + break; + } + } else { + if (sample & BIT(9)) { + sample |= ADXL345_COMPLEMENT; + } } - int32_t micro_ms2 = ((sample * SENSOR_G) / 32); - *out = CLAMP((((int64_t)micro_ms2) + (micro_ms2 % 1000000)), INT32_MIN, INT32_MAX); + + *out = sample * qscale_factor_no_full_res[range]; } static int adxl345_decode_stream(const uint8_t *buffer, struct sensor_chan_spec chan_spec, @@ -46,11 +103,13 @@ static int adxl345_decode_stream(const uint8_t *buffer, struct sensor_chan_spec memset(data, 0, sizeof(struct sensor_three_axis_data)); data->header.base_timestamp_ns = enc_data->timestamp; data->header.reading_count = 1; + data->shift = range_to_shift[enc_data->selected_range]; buffer += sizeof(struct adxl345_fifo_data); uint8_t sample_set_size = enc_data->sample_set_size; uint64_t period_ns = accel_period_ns[enc_data->accel_odr]; + uint8_t is_full_res = enc_data->is_full_res; /* Calculate which sample is decoded. */ if ((uint8_t *)*fit >= buffer) { @@ -73,13 +132,16 @@ static int adxl345_decode_stream(const uint8_t *buffer, struct sensor_chan_spec data->readings[count].timestamp_delta = sample_num * period_ns; uint8_t buff_offset = 0; - adxl345_accel_convert_q31(&data->readings[count].x, *(int16_t *)buffer); + adxl345_accel_convert_q31(&data->readings[count].x, *(int16_t *)buffer, + enc_data->selected_range, is_full_res); buff_offset = 2; adxl345_accel_convert_q31(&data->readings[count].y, - *(int16_t *)(buffer + buff_offset)); + *(int16_t *)(buffer + buff_offset), + enc_data->selected_range, is_full_res); buff_offset += 2; adxl345_accel_convert_q31(&data->readings[count].z, - *(int16_t *)(buffer + buff_offset)); + *(int16_t *)(buffer + buff_offset), + enc_data->selected_range, is_full_res); break; default: return -ENOTSUP; diff --git a/drivers/sensor/adi/adxl345/adxl345_stream.c b/drivers/sensor/adi/adxl345/adxl345_stream.c index a8aeb539041ae..c07778dd3dabe 100644 --- a/drivers/sensor/adi/adxl345/adxl345_stream.c +++ b/drivers/sensor/adi/adxl345/adxl345_stream.c @@ -157,6 +157,8 @@ static void adxl345_process_fifo_samples_cb(struct rtio *r, const struct rtio_sq hdr->is_fifo = 1; hdr->timestamp = data->timestamp; hdr->int_status = data->status1; + hdr->is_full_res = data->is_full_res; + hdr->selected_range = data->selected_range; hdr->accel_odr = cfg->odr; hdr->sample_set_size = sample_set_size; From 1647ad5c0a954a16f5f761d7b8e165ecd0fdc51a Mon Sep 17 00:00:00 2001 From: Simon Tomschik Date: Thu, 24 Oct 2024 14:32:07 +0200 Subject: [PATCH 1921/4482] timing: fix ARM Cortex-M timing functions wrap-around issue Added casts to uint32_t in arch_timing_cycles_get() to handle the wrap-around of the 32-bit cycle counter correctly. Signed-off-by: Simon Tomschik --- arch/arm/core/cortex_m/timing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/core/cortex_m/timing.c b/arch/arm/core/cortex_m/timing.c index 3b847af02ac58..d56ef8780a421 100644 --- a/arch/arm/core/cortex_m/timing.c +++ b/arch/arm/core/cortex_m/timing.c @@ -104,7 +104,7 @@ timing_t arch_timing_counter_get(void) uint64_t arch_timing_cycles_get(volatile timing_t *const start, volatile timing_t *const end) { - return (*end - *start); + return ((uint32_t)*end - (uint32_t)*start); } uint64_t arch_timing_freq_get(void) From da53adfc5699a550155e6471f8b2d46f07da7ffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Thu, 24 Oct 2024 10:56:02 +0200 Subject: [PATCH 1922/4482] drivers: serial: uart_async_to_irq: Fix uart_irq_tx_complete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit uart_irq_tx_complete is implemented by z_uart_async_to_irq_irq_tx_ready which changed recently (5bd53b6e2) to return positive value that may be bigger than 1. uart_irq_tx_complete shall not return value bigger than 1. Signed-off-by: Krzysztof Chruściński --- drivers/serial/uart_async_to_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/serial/uart_async_to_irq.c b/drivers/serial/uart_async_to_irq.c index b67dd6505aab6..762c4462837c9 100644 --- a/drivers/serial/uart_async_to_irq.c +++ b/drivers/serial/uart_async_to_irq.c @@ -284,7 +284,7 @@ void z_uart_async_to_irq_irq_rx_disable(const struct device *dev) /** Interrupt driven transfer complete function */ int z_uart_async_to_irq_irq_tx_complete(const struct device *dev) { - return z_uart_async_to_irq_irq_tx_ready(dev); + return z_uart_async_to_irq_irq_tx_ready(dev) > 0 ? 1 : 0; } /** Interrupt driven receiver ready function */ From b56d6e670e951a0064c49fea4c13bf75155dfdb6 Mon Sep 17 00:00:00 2001 From: Khoa Nguyen Date: Tue, 22 Oct 2024 13:44:22 +0700 Subject: [PATCH 1923/4482] drivers: counter: fix AGT renesas prefix properties - Modify the macro in source code AGT to get the right data from device tree - Modify name of agt node Signed-off-by: Khoa Nguyen --- drivers/counter/counter_renesas_ra_agt.c | 6 +++--- dts/arm/renesas/ra/ra8/ra8x1.dtsi | 4 ++-- samples/drivers/counter/alarm/boards/ek_ra8d1.overlay | 2 +- samples/drivers/counter/alarm/boards/ek_ra8m1.overlay | 2 +- samples/drivers/counter/alarm/boards/mck_ra8t1.overlay | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/counter/counter_renesas_ra_agt.c b/drivers/counter/counter_renesas_ra_agt.c index 0294bbed6a30a..4fd8a4fe8c533 100644 --- a/drivers/counter/counter_renesas_ra_agt.c +++ b/drivers/counter/counter_renesas_ra_agt.c @@ -552,14 +552,14 @@ static const struct counter_driver_api ra_agt_driver_api = { }, \ .agtio_filter = AGT_AGTIO_FILTER_NONE, \ .measurement_mode = 0U, \ - .source_div = DT_PROP(TIMER(n), prescaler), \ - .count_source = DT_STRING_TOKEN(TIMER(n), count_source), \ + .source_div = DT_PROP(TIMER(n), renesas_prescaler), \ + .count_source = DT_STRING_TOKEN(TIMER(n), renesas_count_source), \ .channel = DT_PROP(TIMER(n), channel), \ .channel_irq = DT_IRQ_BY_NAME(TIMER(n), agtcmai, irq), \ .channel_ipl = DT_IRQ_BY_NAME(TIMER(n), agtcmai, priority), \ .cycle_end_irq = DT_IRQ_BY_NAME(TIMER(n), agti, irq), \ .cycle_end_ipl = DT_IRQ_BY_NAME(TIMER(n), agti, priority), \ - .resolution = DT_PROP(TIMER(n), resolution), \ + .resolution = DT_PROP(TIMER(n), renesas_resolution), \ .dt_reg = DT_REG_ADDR(TIMER(n)), \ }; \ \ diff --git a/dts/arm/renesas/ra/ra8/ra8x1.dtsi b/dts/arm/renesas/ra/ra8/ra8x1.dtsi index a8c952f8228a5..96d493e25e4d6 100644 --- a/dts/arm/renesas/ra/ra8/ra8x1.dtsi +++ b/dts/arm/renesas/ra/ra8/ra8x1.dtsi @@ -494,7 +494,7 @@ status = "okay"; }; - agt0: agt0@40221000 { + agt0: agt@40221000 { compatible = "renesas,ra-agt"; channel = <0>; reg = <0x40221000 0x100>; @@ -511,7 +511,7 @@ }; }; - agt1: agt0@40221100 { + agt1: agt@40221100 { compatible = "renesas,ra-agt"; channel = <1>; reg = <0x40221100 0x100>; diff --git a/samples/drivers/counter/alarm/boards/ek_ra8d1.overlay b/samples/drivers/counter/alarm/boards/ek_ra8d1.overlay index 0799970c5b299..9412dbf3ee3d6 100644 --- a/samples/drivers/counter/alarm/boards/ek_ra8d1.overlay +++ b/samples/drivers/counter/alarm/boards/ek_ra8d1.overlay @@ -6,7 +6,7 @@ &agt0 { status = "okay"; - prescaler = <4>; + renesas,prescaler = <4>; counter0: counter { status = "okay"; }; diff --git a/samples/drivers/counter/alarm/boards/ek_ra8m1.overlay b/samples/drivers/counter/alarm/boards/ek_ra8m1.overlay index 0799970c5b299..9412dbf3ee3d6 100644 --- a/samples/drivers/counter/alarm/boards/ek_ra8m1.overlay +++ b/samples/drivers/counter/alarm/boards/ek_ra8m1.overlay @@ -6,7 +6,7 @@ &agt0 { status = "okay"; - prescaler = <4>; + renesas,prescaler = <4>; counter0: counter { status = "okay"; }; diff --git a/samples/drivers/counter/alarm/boards/mck_ra8t1.overlay b/samples/drivers/counter/alarm/boards/mck_ra8t1.overlay index 0799970c5b299..9412dbf3ee3d6 100644 --- a/samples/drivers/counter/alarm/boards/mck_ra8t1.overlay +++ b/samples/drivers/counter/alarm/boards/mck_ra8t1.overlay @@ -6,7 +6,7 @@ &agt0 { status = "okay"; - prescaler = <4>; + renesas,prescaler = <4>; counter0: counter { status = "okay"; }; From 14478cafa6a45fadc31ddd85bec2addc278d620e Mon Sep 17 00:00:00 2001 From: Gang Li Date: Tue, 22 Oct 2024 11:51:24 +0900 Subject: [PATCH 1924/4482] hostap: fix the issue of HE IE in beacon when disabled 11AX Add WIFI_NM_WPA_SUPPLICAT_11AX Kconfig to enable or disable 11AX. Signed-off-by: Gang Li --- modules/hostap/CMakeLists.txt | 10 ++++++++-- modules/hostap/Kconfig | 5 +++++ modules/hostap/src/supp_events.c | 8 ++++++++ modules/hostap/src/supp_main.c | 2 ++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/modules/hostap/CMakeLists.txt b/modules/hostap/CMakeLists.txt index 79fec27841d58..56298b5bcd152 100644 --- a/modules/hostap/CMakeLists.txt +++ b/modules/hostap/CMakeLists.txt @@ -183,7 +183,6 @@ zephyr_library_sources_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_AP ${HOSTAP_SRC_BASE}/ap/hw_features.c ${HOSTAP_SRC_BASE}/ap/ieee802_11_auth.c ${HOSTAP_SRC_BASE}/ap/ieee802_11.c - ${HOSTAP_SRC_BASE}/ap/ieee802_11_he.c ${HOSTAP_SRC_BASE}/ap/ieee802_11_ht.c ${HOSTAP_SRC_BASE}/ap/ieee802_11_shared.c ${HOSTAP_SRC_BASE}/ap/ieee802_11_vht.c @@ -214,6 +213,10 @@ zephyr_library_sources_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_AP ${HOSTAP_SRC_BASE}/utils/ip_addr.c ) +zephyr_library_sources_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_11AX + ${HOSTAP_SRC_BASE}/ap/ieee802_11_he.c +) + zephyr_library_compile_definitions_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_AP CONFIG_AP CONFIG_NO_RADIUS @@ -221,11 +224,14 @@ zephyr_library_compile_definitions_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_AP CONFIG_NO_ACCOUNTING NEED_AP_MLME CONFIG_IEEE80211AC - CONFIG_IEEE80211AX CONFIG_EAP_SERVER CONFIG_EAP_SERVER_IDENTITY ) +zephyr_library_compile_definitions_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_11AX + CONFIG_IEEE80211AX +) + zephyr_include_directories_ifdef(CONFIG_WIFI_NM_HOSTAPD_AP ${WIFI_NM_HOSTAPD_BASE}/ ) diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 3f011768b605c..4f0fccecbd6d5 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -293,6 +293,11 @@ config WIFI_NM_WPA_SUPPLICANT_DPP select MBEDTLS_X509_CSR_WRITE_C select MBEDTLS_X509_CSR_PARSE_C +config WIFI_NM_WPA_SUPPLICANT_11AX + bool "IEEE 802.11ax HE support" + depends on WIFI_NM_WPA_SUPPLICANT_AP || WIFI_NM_HOSTAPD_AP + default y + config WPA_CLI bool "WPA CLI support" help diff --git a/modules/hostap/src/supp_events.c b/modules/hostap/src/supp_events.c index 3b0cd94cc89aa..2557a130a7563 100644 --- a/modules/hostap/src/supp_events.c +++ b/modules/hostap/src/supp_events.c @@ -285,12 +285,20 @@ static enum wifi_link_mode get_sta_link_mode(struct wpa_supplicant *wpa_s, struc #ifdef CONFIG_WIFI_NM_HOSTAPD_AP static bool is_twt_capable(struct hostapd_iface *iface, struct sta_info *sta) { +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_11AX return hostapd_get_he_twt_responder(iface->bss[0], IEEE80211_MODE_AP); +#else + return false; +#endif } #else static bool is_twt_capable(struct wpa_supplicant *wpa_s, struct sta_info *sta) { +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_11AX return hostapd_get_he_twt_responder(wpa_s->ap_iface->bss[0], IEEE80211_MODE_AP); +#else + return false; +#endif } #endif diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index 75b0962b000c2..7840525c3b915 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -909,6 +909,7 @@ struct hostapd_config *hostapd_config_read2(const char *fname) conf->ieee80211ac = 1; conf->vht_oper_chwidth = CHANWIDTH_USE_HT; conf->vht_capab |= VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MAX; +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_11AX conf->ieee80211ax = 1; conf->he_oper_chwidth = CHANWIDTH_USE_HT; conf->he_phy_capab.he_su_beamformer = 0; @@ -918,6 +919,7 @@ struct hostapd_config *hostapd_config_read2(const char *fname) conf->he_op.he_default_pe_duration = 0; /* Set default basic MCS/NSS set to single stream MCS 0-7 */ conf->he_op.he_basic_mcs_nss_set = 0xfffc; +#endif for (i = 0; i < conf->num_bss; i++) { hostapd_set_security_params(conf->bss[i], 1); From e1389fa2cff66c4f0c1ac5d0b1b932ef0e3faf06 Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Tue, 29 Oct 2024 20:20:26 +0900 Subject: [PATCH 1925/4482] ci: doc-publish-pr: Improve workflow security Improve workflow security. Signed-off-by: Stephanos Ioannidis --- .github/workflows/doc-publish-pr.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/doc-publish-pr.yml b/.github/workflows/doc-publish-pr.yml index a9e7c072cf6f5..786bd14aed277 100644 --- a/.github/workflows/doc-publish-pr.yml +++ b/.github/workflows/doc-publish-pr.yml @@ -30,8 +30,12 @@ jobs: - name: Load PR number if: steps.download-artifacts.outputs.found_artifact == 'true' - run: | - echo "PR_NUM=$(> $GITHUB_ENV + uses: actions/github-script@v7 + with: + script: | + let fs = require("fs"); + let pr_number = Number(fs.readFileSync("./pr_num/pr_num")); + core.exportVariable("PR_NUM", pr_number); - name: Check PR number if: steps.download-artifacts.outputs.found_artifact == 'true' From 14e870d8d3a1dea7d2f72bd3dd63551d74161d5d Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 24 Oct 2024 11:15:32 +0200 Subject: [PATCH 1926/4482] tests/bluetooth/host/keys/bt_keys_get_addr: Correct mock prototypes In 82d8f09de18708259b85e5bbf5e32541fd807ed4 the bt_conn_foreach prototype was changed, but these unit tests kept using the old prototype which leads to a build warning. Let's fix the prototype in the tests. Signed-off-by: Alberto Escolar Piedras --- .../src/test_suite_full_list_invalid_values.c | 8 ++++---- .../src/test_suite_full_list_overwrite_oldest.c | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/bluetooth/host/keys/bt_keys_get_addr/src/test_suite_full_list_invalid_values.c b/tests/bluetooth/host/keys/bt_keys_get_addr/src/test_suite_full_list_invalid_values.c index 4d50d5117b523..af0190f8a146f 100644 --- a/tests/bluetooth/host/keys/bt_keys_get_addr/src/test_suite_full_list_invalid_values.c +++ b/tests/bluetooth/host/keys/bt_keys_get_addr/src/test_suite_full_list_invalid_values.c @@ -28,14 +28,14 @@ static int bt_unpair_unreachable_custom_fake(uint8_t id, const bt_addr_le_t *add return 0; } -static void bt_conn_foreach_conn_ref_null_custom_fake(int type, bt_conn_foreach_cb func, - void *data) +static void bt_conn_foreach_conn_ref_null_custom_fake(enum bt_conn_type type, + bt_conn_foreach_cb func, void *data) { func(NULL, data); } -static void bt_conn_foreach_data_ref_null_custom_fake(int type, bt_conn_foreach_cb func, - void *data) +static void bt_conn_foreach_data_ref_null_custom_fake(enum bt_conn_type type, + bt_conn_foreach_cb func, void *data) { struct bt_conn conn; diff --git a/tests/bluetooth/host/keys/bt_keys_get_addr/src/test_suite_full_list_overwrite_oldest.c b/tests/bluetooth/host/keys/bt_keys_get_addr/src/test_suite_full_list_overwrite_oldest.c index 469d96c53e368..2e06ae21731f3 100644 --- a/tests/bluetooth/host/keys/bt_keys_get_addr/src/test_suite_full_list_overwrite_oldest.c +++ b/tests/bluetooth/host/keys/bt_keys_get_addr/src/test_suite_full_list_overwrite_oldest.c @@ -46,8 +46,8 @@ static int bt_unpair_unreachable_custom_fake(uint8_t id, const bt_addr_le_t *add return 0; } -static void bt_conn_foreach_key_slot_0_in_use_custom_fake(int type, bt_conn_foreach_cb func, - void *data) +static void bt_conn_foreach_key_slot_0_in_use_custom_fake(enum bt_conn_type type, + bt_conn_foreach_cb func, void *data) { struct bt_conn conn; @@ -71,8 +71,8 @@ static void bt_conn_foreach_key_slot_0_in_use_custom_fake(int type, bt_conn_fore func(&conn, data); } -static void bt_conn_foreach_all_keys_in_use_custom_fake(int type, bt_conn_foreach_cb func, - void *data) +static void bt_conn_foreach_all_keys_in_use_custom_fake(enum bt_conn_type type, + bt_conn_foreach_cb func, void *data) { struct bt_conn conn; @@ -86,8 +86,8 @@ static void bt_conn_foreach_all_keys_in_use_custom_fake(int type, bt_conn_foreac } } -static void bt_conn_foreach_no_keys_in_use_custom_fake(int type, bt_conn_foreach_cb func, - void *data) +static void bt_conn_foreach_no_keys_in_use_custom_fake(enum bt_conn_type type, + bt_conn_foreach_cb func, void *data) { struct bt_conn conn; From 2af45d1d78baf4a46296903864e300559f6cd5fc Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 24 Oct 2024 11:18:45 +0200 Subject: [PATCH 1927/4482] subsys/bluetooth/host/keys.h: Add include guard and required include This header requires bluetooth.h but was not including it itself. Due to this we had 2 tests failing to build. Let's just include the dependencies to this header instead of relaying on users including the dependencies dependencies in the right order. Also, let's add an include guard as in a test this header was included twice leading to weird build errors. Signed-off-by: Alberto Escolar Piedras --- subsys/bluetooth/host/keys.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/subsys/bluetooth/host/keys.h b/subsys/bluetooth/host/keys.h index 76508e0cf3969..c1da17fb48812 100644 --- a/subsys/bluetooth/host/keys.h +++ b/subsys/bluetooth/host/keys.h @@ -6,6 +6,11 @@ * SPDX-License-Identifier: Apache-2.0 */ +#ifndef ZEPHYR_SUBSYS_BLUETOOTH_HOST_KEYS_H_ +#define ZEPHYR_SUBSYS_BLUETOOTH_HOST_KEYS_H_ + +#include + /** @cond INTERNAL_HIDDEN */ enum bt_keys_type { @@ -233,3 +238,5 @@ void bt_keys_link_key_update_usage(const bt_addr_t *addr); void bt_keys_show_sniffer_info(struct bt_keys *keys, void *data); /** @endcond */ + +#endif /* ZEPHYR_SUBSYS_BLUETOOTH_HOST_KEYS_H_ */ From 328e4a50390c0af43562dcb71ae13cdafdad5d67 Mon Sep 17 00:00:00 2001 From: Nik Schewtschuk Date: Thu, 24 Oct 2024 13:50:09 +0200 Subject: [PATCH 1928/4482] soc: espressif: esp32s3: Adjust BOOTLOADER_DRAM_SEG_LEN for worst case Larger image partitions require more space in DRAM due to the increase in .bss.sector_buffers. Each sector in .bss.sector_buffers consumes 16 bytes. In the worst case scenario, such as with the ESP32S3 N32R8V, which has 32 MB of flash and most likely 12 MB image partition, an addition of 0xc000 should be sufficient to accommodate this. Signed-off-by: Nik Schewtschuk --- soc/espressif/esp32s3/memory.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/soc/espressif/esp32s3/memory.h b/soc/espressif/esp32s3/memory.h index 7df7f26bccb0c..0283c51fe0d55 100644 --- a/soc/espressif/esp32s3/memory.h +++ b/soc/espressif/esp32s3/memory.h @@ -10,6 +10,7 @@ #define SRAM0_IRAM_START 0x40370000 #define SRAM0_SIZE 0x8000 #define SRAM1_DRAM_START 0x3fc88000 + /* IRAM equivalent address where DRAM actually start */ #define SRAM1_IRAM_START (SRAM0_IRAM_START + SRAM0_SIZE) #define SRAM2_DRAM_START 0x3fcf0000 @@ -49,7 +50,7 @@ /* For safety margin between bootloader data section and startup stacks */ #define BOOTLOADER_STACK_OVERHEAD 0x0 -#define BOOTLOADER_DRAM_SEG_LEN 0x9000 +#define BOOTLOADER_DRAM_SEG_LEN 0x15000 #define BOOTLOADER_IRAM_LOADER_SEG_LEN 0x1a00 #define BOOTLOADER_IRAM_SEG_LEN 0xc000 From c48c0ed0b8b6265533c5d1ff6d6cd9277e7ccfef Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 9 Oct 2024 12:18:59 +0200 Subject: [PATCH 1929/4482] dts: bindings: wifi: split nrf700x coex and wifi models The nrf7000, nrf7001 and nrf7002 expose a coex hardware interface which is independent from the wifi/control interface (spi and control pins) These interfaces where previously combined into a single model. This is incompatible with the actual usage of the interfaces where one core may interact only with the coex interface, and another with the wifi/control interface. This commit moves the coex interface, commonly described in "nordic,nrf70-coex.yaml", out of the wifi/control models "nrf700-.yaml" to its own models "nrf700-coex.yaml" Signed-off-by: Bjarki Arge Andreasen --- dts/bindings/wifi/nordic,nrf70-coex.yaml | 6 ------ dts/bindings/wifi/nordic,nrf70.yaml | 9 ++++++--- dts/bindings/wifi/nordic,nrf7000-coex.yaml | 9 +++++++++ dts/bindings/wifi/nordic,nrf7001-coex.yaml | 9 +++++++++ dts/bindings/wifi/nordic,nrf7002-coex.yaml | 9 +++++++++ 5 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 dts/bindings/wifi/nordic,nrf7000-coex.yaml create mode 100644 dts/bindings/wifi/nordic,nrf7001-coex.yaml create mode 100644 dts/bindings/wifi/nordic,nrf7002-coex.yaml diff --git a/dts/bindings/wifi/nordic,nrf70-coex.yaml b/dts/bindings/wifi/nordic,nrf70-coex.yaml index 208657f3fb53b..0a9c12f587ec9 100644 --- a/dts/bindings/wifi/nordic,nrf70-coex.yaml +++ b/dts/bindings/wifi/nordic,nrf70-coex.yaml @@ -27,9 +27,3 @@ properties: description: | GPIO of the SOC controlling the Priority (STATUS1) pin (in 4-wire coex case) of the nRF7002 - - srrf-switch-gpios: - type: phandle-array - description: | - GPIO of the RF Switch to control SR RF output to either SR Antenna - or shared Antenna with Wi-Fi diff --git a/dts/bindings/wifi/nordic,nrf70.yaml b/dts/bindings/wifi/nordic,nrf70.yaml index ff9021739ace7..abdc7ec2cb066 100644 --- a/dts/bindings/wifi/nordic,nrf70.yaml +++ b/dts/bindings/wifi/nordic,nrf70.yaml @@ -1,9 +1,6 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -# GPIO lines for controlling the nRF70 Series Wi-Fi chip. -include: nordic,nrf70-coex.yaml - properties: iovdd-ctrl-gpios: type: phandle-array @@ -19,3 +16,9 @@ properties: type: phandle-array required: true description: GPIO of the SoC controlling the HOST_IRQ pin of the nRF70 + + srrf-switch-gpios: + type: phandle-array + description: | + GPIO of the RF Switch to control SR RF output to either SR Antenna + or shared Antenna with Wi-Fi diff --git a/dts/bindings/wifi/nordic,nrf7000-coex.yaml b/dts/bindings/wifi/nordic,nrf7000-coex.yaml new file mode 100644 index 0000000000000..94dcc2181d33d --- /dev/null +++ b/dts/bindings/wifi/nordic,nrf7000-coex.yaml @@ -0,0 +1,9 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: This is a representation of the nRF7000 Wi-Fi chip with COEX interface. + +compatible: nordic,nrf7000-coex + +include: + - "nordic,nrf70-coex.yaml" diff --git a/dts/bindings/wifi/nordic,nrf7001-coex.yaml b/dts/bindings/wifi/nordic,nrf7001-coex.yaml new file mode 100644 index 0000000000000..d58afe7d44cbf --- /dev/null +++ b/dts/bindings/wifi/nordic,nrf7001-coex.yaml @@ -0,0 +1,9 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: This is a representation of the nRF7001 Wi-Fi chip with COEX interface. + +compatible: nordic,nrf7001-coex + +include: + - "nordic,nrf70-coex.yaml" diff --git a/dts/bindings/wifi/nordic,nrf7002-coex.yaml b/dts/bindings/wifi/nordic,nrf7002-coex.yaml new file mode 100644 index 0000000000000..1df61d0bf9873 --- /dev/null +++ b/dts/bindings/wifi/nordic,nrf7002-coex.yaml @@ -0,0 +1,9 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: This is a representation of the nRF7002 Wi-Fi chip with COEX interface. + +compatible: nordic,nrf7002-coex + +include: + - "nordic,nrf70-coex.yaml" From e23de8bf74a020c471fd819873e39a2a4afbf5c0 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 9 Oct 2024 12:36:43 +0200 Subject: [PATCH 1930/4482] boards: nordic: nrf7002dk: align with nrf700x split interface Remove the unused coex interface from the cpuapp of the nrf7002dk nrf5340 SoC. Signed-off-by: Bjarki Arge Andreasen --- boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp.dts | 1 - .../nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001.dts | 1 - boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet.dts | 7 +++++-- boards/nordic/nrf7002dk/nrf70_common.dtsi | 1 + boards/nordic/nrf7002dk/nrf70_common_coex.dtsi | 11 ----------- 5 files changed, 6 insertions(+), 15 deletions(-) delete mode 100644 boards/nordic/nrf7002dk/nrf70_common_coex.dtsi diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp.dts b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp.dts index fbe74a822240f..9b62eafea174b 100644 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp.dts +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp.dts @@ -32,7 +32,6 @@ qspi-quad-mode; #include "nrf70_common.dtsi" - #include "nrf70_common_coex.dtsi" #include "nrf70_common_5g.dtsi" }; }; diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001.dts b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001.dts index 1d78dddbe68ad..8d955c67fc72c 100644 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001.dts +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpuapp_nrf7001.dts @@ -32,6 +32,5 @@ qspi-quad-mode; #include "nrf70_common.dtsi" - #include "nrf70_common_coex.dtsi" }; }; diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet.dts b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet.dts index 823c9fafacba7..8e36e678581ac 100644 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet.dts +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet.dts @@ -84,9 +84,12 @@ nrf70: coex { status = "okay"; - compatible = "nordic,nrf70-coex"; + compatible = "nordic,nrf7002-coex"; - #include "nrf70_common_coex.dtsi" + req-gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>; + status0-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>; + grant-gpios = <&gpio0 24 (GPIO_PULL_DOWN | GPIO_ACTIVE_LOW)>; + swctrl1-gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>; }; /* These aliases are provided for compatibility with samples */ diff --git a/boards/nordic/nrf7002dk/nrf70_common.dtsi b/boards/nordic/nrf7002dk/nrf70_common.dtsi index f40f8ad9bb745..cd9cd23bb892e 100644 --- a/boards/nordic/nrf7002dk/nrf70_common.dtsi +++ b/boards/nordic/nrf7002dk/nrf70_common.dtsi @@ -7,6 +7,7 @@ iovdd-ctrl-gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>; bucken-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; host-irq-gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>; +srrf-switch-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; wifi-max-tx-pwr-2g-dsss = <21>; wifi-max-tx-pwr-2g-mcs0 = <16>; diff --git a/boards/nordic/nrf7002dk/nrf70_common_coex.dtsi b/boards/nordic/nrf7002dk/nrf70_common_coex.dtsi deleted file mode 100644 index 03f22c3edbaa0..0000000000000 --- a/boards/nordic/nrf7002dk/nrf70_common_coex.dtsi +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -req-gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>; -status0-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>; -grant-gpios = <&gpio0 24 (GPIO_PULL_DOWN | GPIO_ACTIVE_LOW)>; -swctrl1-gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>; -srrf-switch-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; From 1dc1d5be5f81a91dbc73fa00dba5abac7689b235 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 9 Oct 2024 12:49:38 +0200 Subject: [PATCH 1931/4482] boards: shields: nrf7002eb: align with nrf700x split interface Exclude the coex interface if the coex variant of the nrf7002eb is selected instead of adding the interface alongside the wifi/control interface. Signed-off-by: Bjarki Arge Andreasen --- boards/shields/nrf7002eb/nrf7002eb_coex.overlay | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/boards/shields/nrf7002eb/nrf7002eb_coex.overlay b/boards/shields/nrf7002eb/nrf7002eb_coex.overlay index a8925c2556752..59007ebe58eb5 100644 --- a/boards/shields/nrf7002eb/nrf7002eb_coex.overlay +++ b/boards/shields/nrf7002eb/nrf7002eb_coex.overlay @@ -4,10 +4,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "nrf7002eb.overlay" +/ { + nrf70: coex { + compatible = "nordic,nrf7002-coex"; + status = "okay"; -&nrf70 { - status0-gpios = <&edge_connector 5 GPIO_ACTIVE_HIGH>; - req-gpios = <&edge_connector 6 GPIO_ACTIVE_HIGH>; - grant-gpios = <&edge_connector 15 (GPIO_PULL_DOWN | GPIO_ACTIVE_LOW)>; + status0-gpios = <&edge_connector 5 GPIO_ACTIVE_HIGH>; + req-gpios = <&edge_connector 6 GPIO_ACTIVE_HIGH>; + grant-gpios = <&edge_connector 15 (GPIO_PULL_DOWN | GPIO_ACTIVE_LOW)>; + }; }; From fc4f385e824e3bbb8b0b816d80d795d5807658aa Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 9 Oct 2024 12:58:33 +0200 Subject: [PATCH 1932/4482] boards: shields: nrf7002ek: align with nrf700x split interface Add variant for the coex interface and move the coex interface out if the wifi/control interface variants. Signed-off-by: Bjarki Arge Andreasen --- boards/shields/nrf7002ek/Kconfig.shield | 3 +++ boards/shields/nrf7002ek/doc/index.rst | 13 ++++++------ .../shields/nrf7002ek/nrf7002ek_coex.overlay | 21 +++++++++++++++++++ .../shields/nrf7002ek/nrf7002ek_common.dtsi | 9 +------- 4 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 boards/shields/nrf7002ek/nrf7002ek_coex.overlay diff --git a/boards/shields/nrf7002ek/Kconfig.shield b/boards/shields/nrf7002ek/Kconfig.shield index 7627ff96dbd40..5b52d5710f278 100644 --- a/boards/shields/nrf7002ek/Kconfig.shield +++ b/boards/shields/nrf7002ek/Kconfig.shield @@ -9,3 +9,6 @@ config SHIELD_NRF7002EK_NRF7001 config SHIELD_NRF7002EK_NRF7000 def_bool $(shields_list_contains,nrf7002ek_nrf7000) + +config SHIELD_NRF7002EK_COEX + def_bool $(shields_list_contains,nrf7002ek_coex) diff --git a/boards/shields/nrf7002ek/doc/index.rst b/boards/shields/nrf7002ek/doc/index.rst index 9f247be3501dd..cfe08750f57b2 100644 --- a/boards/shields/nrf7002ek/doc/index.rst +++ b/boards/shields/nrf7002ek/doc/index.rst @@ -47,24 +47,25 @@ SR Co-existence ############### The nRF7002 EK supports SR co-existence provided the host board supports it. The SR co-existence -pins are connected to the host board's GPIO pins. +pins are connected to the host board's GPIO pins. The interface is selected by setting +``--shield nrf7002ek_coex`` when invoking ``west build``. Two Kconfig options are available to enable SR co-existence: -- :kconfig:option:`CONFIG_NRF70_SR_COEX`: Enables SR co-existence. +- :kconfig:option:`CONFIG_NRF70_SR_COEX`: Enables SR co-existence driver. - :kconfig:option:`CONFIG_NRF70_SR_COEX_RF_SWITCH`: Control SR side RF switch. Shield Variants ############### -The nRF7002 EK is available in three variants: +The nRF7002 EK is available in four variants: - ``nrf7002ek``: The default variant. - ``nrf7002ek_nrf7001``: Variant for the nRF7001 SoC or nRF7002 SoC emulating nRF7001 - that supports only 2.4GHz Wi-Fi. + that supports only 2.4GHz Wi-Fi. - ``nrf7002ek_nrf7000``: Variant for the nRF7000 SoC or nRF7002 SoC emulating nRF7000 - that supports only 2.4GHz Wi-Fi. - + that supports only 2.4GHz Wi-Fi. +- ``nrf7002ek_coex``: Variant for the SR co-existence interface References ********** diff --git a/boards/shields/nrf7002ek/nrf7002ek_coex.overlay b/boards/shields/nrf7002ek/nrf7002ek_coex.overlay new file mode 100644 index 0000000000000..4b592acbfb231 --- /dev/null +++ b/boards/shields/nrf7002ek/nrf7002ek_coex.overlay @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + nrf70: coex { + compatible = "nordic,nrf7002-coex"; + status = "okay"; + + /* D2 */ + status0-gpios = <&arduino_header 8 GPIO_ACTIVE_HIGH>; + /* D3 */ + req-gpios = <&arduino_header 9 GPIO_ACTIVE_HIGH>; + /* D4 */ + grant-gpios = <&arduino_header 10 (GPIO_PULL_DOWN | GPIO_ACTIVE_LOW)>; + /* D6 */ + swctrl1-gpios = <&arduino_header 12 GPIO_ACTIVE_HIGH>; + }; +}; diff --git a/boards/shields/nrf7002ek/nrf7002ek_common.dtsi b/boards/shields/nrf7002ek/nrf7002ek_common.dtsi index 102e0078d5f3c..c9bbbde4b9269 100644 --- a/boards/shields/nrf7002ek/nrf7002ek_common.dtsi +++ b/boards/shields/nrf7002ek/nrf7002ek_common.dtsi @@ -12,15 +12,8 @@ iovdd-ctrl-gpios = <&arduino_header 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; bucken-gpios = <&arduino_header 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; /* D7 */ host-irq-gpios = <&arduino_header 13 GPIO_ACTIVE_HIGH>; + /* Short-range (SR) co-existence */ -/* D2 */ -status0-gpios = <&arduino_header 8 GPIO_ACTIVE_HIGH>; -/* D3 */ -req-gpios = <&arduino_header 9 GPIO_ACTIVE_HIGH>; -/* D4 */ -grant-gpios = <&arduino_header 10 (GPIO_PULL_DOWN | GPIO_ACTIVE_LOW)>; -/* D6 */ -swctrl1-gpios = <&arduino_header 12 GPIO_ACTIVE_HIGH>; /* D8 */ srrf-switch-gpios = <&arduino_header 14 GPIO_ACTIVE_HIGH>; From 92c34954935aeb19f243c05b51b65a16496485fe Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 15 Oct 2024 09:50:04 +0200 Subject: [PATCH 1933/4482] drivers: i2c: nrfx_twi[m]: default to I2C_BITRATE_STANDARD Instead of forcing a definition in Devicetree. Right now, SoC DT files contain this default, but it should not be part of SoC DT files. Signed-off-by: Gerard Marull-Paretas --- drivers/i2c/i2c_nrfx_twi_common.h | 3 ++- drivers/i2c/i2c_nrfx_twim_common.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/i2c_nrfx_twi_common.h b/drivers/i2c/i2c_nrfx_twi_common.h index a8925d3f75b16..a3e9847bab5bd 100644 --- a/drivers/i2c/i2c_nrfx_twi_common.h +++ b/drivers/i2c/i2c_nrfx_twi_common.h @@ -22,7 +22,8 @@ extern "C" { : I2C_NRFX_TWI_INVALID_FREQUENCY) #define I2C(idx) DT_NODELABEL(i2c##idx) #define I2C_FREQUENCY(idx) \ - I2C_NRFX_TWI_FREQUENCY(DT_PROP(I2C(idx), clock_frequency)) + I2C_NRFX_TWI_FREQUENCY(DT_PROP_OR(I2C(idx), clock_frequency, \ + I2C_BITRATE_STANDARD)) struct i2c_nrfx_twi_common_data { uint32_t dev_config; diff --git a/drivers/i2c/i2c_nrfx_twim_common.h b/drivers/i2c/i2c_nrfx_twim_common.h index 23811a225e74d..ba7fa72f01984 100644 --- a/drivers/i2c/i2c_nrfx_twim_common.h +++ b/drivers/i2c/i2c_nrfx_twim_common.h @@ -28,7 +28,8 @@ extern "C" { #define I2C(idx) DT_NODELABEL(i2c##idx) #define I2C_HAS_PROP(idx, prop) DT_NODE_HAS_PROP(I2C(idx), prop) -#define I2C_FREQUENCY(idx) I2C_NRFX_TWIM_FREQUENCY(DT_PROP(I2C(idx), clock_frequency)) +#define I2C_FREQUENCY(idx) I2C_NRFX_TWIM_FREQUENCY(DT_PROP_OR(I2C(idx), clock_frequency, \ + I2C_BITRATE_STANDARD)) struct i2c_nrfx_twim_common_config { nrfx_twim_t twim; From 4e5df113c5b8b16eab45743a2ddfc74cb99735bb Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 15 Oct 2024 09:54:52 +0200 Subject: [PATCH 1934/4482] dts: nordic: remove clock-frequency from all i2c nodes Device driver now defaults to I2C_BITRATE_STANDARD if not specified. Signed-off-by: Gerard Marull-Paretas --- dts/arm/nordic/nrf51822.dtsi | 2 -- dts/arm/nordic/nrf52805.dtsi | 1 - dts/arm/nordic/nrf52810.dtsi | 1 - dts/arm/nordic/nrf52811.dtsi | 1 - dts/arm/nordic/nrf52820.dtsi | 2 -- dts/arm/nordic/nrf52832.dtsi | 2 -- dts/arm/nordic/nrf52833.dtsi | 2 -- dts/arm/nordic/nrf52840.dtsi | 2 -- dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi | 4 ---- dts/arm/nordic/nrf5340_cpunet.dtsi | 1 - dts/arm/nordic/nrf91_peripherals.dtsi | 4 ---- dts/common/nordic/nrf54l15.dtsi | 4 ---- dts/common/nordic/nrf54l20.dtsi | 4 ---- 13 files changed, 30 deletions(-) diff --git a/dts/arm/nordic/nrf51822.dtsi b/dts/arm/nordic/nrf51822.dtsi index a11677ad93450..c3c85b110a385 100644 --- a/dts/arm/nordic/nrf51822.dtsi +++ b/dts/arm/nordic/nrf51822.dtsi @@ -105,7 +105,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003000 0x1000>; - clock-frequency = ; interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <8>; status = "disabled"; @@ -133,7 +132,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40004000 0x1000>; - clock-frequency = ; interrupts = <4 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <8>; status = "disabled"; diff --git a/dts/arm/nordic/nrf52805.dtsi b/dts/arm/nordic/nrf52805.dtsi index fbf89434690d8..e1c8e6a2efbc8 100644 --- a/dts/arm/nordic/nrf52805.dtsi +++ b/dts/arm/nordic/nrf52805.dtsi @@ -127,7 +127,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003000 0x1000>; - clock-frequency = ; interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <14>; status = "disabled"; diff --git a/dts/arm/nordic/nrf52810.dtsi b/dts/arm/nordic/nrf52810.dtsi index 3be690a987ef7..40d872dda4463 100644 --- a/dts/arm/nordic/nrf52810.dtsi +++ b/dts/arm/nordic/nrf52810.dtsi @@ -131,7 +131,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003000 0x1000>; - clock-frequency = ; interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <10>; status = "disabled"; diff --git a/dts/arm/nordic/nrf52811.dtsi b/dts/arm/nordic/nrf52811.dtsi index 83a66d77792af..735bfee427b26 100644 --- a/dts/arm/nordic/nrf52811.dtsi +++ b/dts/arm/nordic/nrf52811.dtsi @@ -143,7 +143,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003000 0x1000>; - clock-frequency = ; interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <14>; status = "disabled"; diff --git a/dts/arm/nordic/nrf52820.dtsi b/dts/arm/nordic/nrf52820.dtsi index 71abcab55ccdf..82bdcb5893454 100644 --- a/dts/arm/nordic/nrf52820.dtsi +++ b/dts/arm/nordic/nrf52820.dtsi @@ -145,7 +145,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003000 0x1000>; - clock-frequency = ; interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <15>; status = "disabled"; @@ -182,7 +181,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40004000 0x1000>; - clock-frequency = ; interrupts = <4 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <15>; status = "disabled"; diff --git a/dts/arm/nordic/nrf52832.dtsi b/dts/arm/nordic/nrf52832.dtsi index 49acb441c57c7..abb1aed468cb5 100644 --- a/dts/arm/nordic/nrf52832.dtsi +++ b/dts/arm/nordic/nrf52832.dtsi @@ -131,7 +131,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003000 0x1000>; - clock-frequency = ; interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <8>; status = "disabled"; @@ -168,7 +167,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40004000 0x1000>; - clock-frequency = ; interrupts = <4 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <8>; status = "disabled"; diff --git a/dts/arm/nordic/nrf52833.dtsi b/dts/arm/nordic/nrf52833.dtsi index 7d23e15f5f84d..e8a033b40021b 100644 --- a/dts/arm/nordic/nrf52833.dtsi +++ b/dts/arm/nordic/nrf52833.dtsi @@ -145,7 +145,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003000 0x1000>; - clock-frequency = ; interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; @@ -182,7 +181,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40004000 0x1000>; - clock-frequency = ; interrupts = <4 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; diff --git a/dts/arm/nordic/nrf52840.dtsi b/dts/arm/nordic/nrf52840.dtsi index 56712a6bcccb8..e2265c130b0d1 100644 --- a/dts/arm/nordic/nrf52840.dtsi +++ b/dts/arm/nordic/nrf52840.dtsi @@ -133,7 +133,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003000 0x1000>; - clock-frequency = ; interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; @@ -170,7 +169,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40004000 0x1000>; - clock-frequency = ; interrupts = <4 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; diff --git a/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi index 12bf76a1a4d77..7fda659fa01c3 100644 --- a/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi @@ -115,7 +115,6 @@ i2c0: i2c@8000 { #address-cells = <1>; #size-cells = <0>; reg = <0x8000 0x1000>; - clock-frequency = ; interrupts = <8 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; @@ -157,7 +156,6 @@ i2c1: i2c@9000 { #address-cells = <1>; #size-cells = <0>; reg = <0x9000 0x1000>; - clock-frequency = ; interrupts = <9 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; @@ -212,7 +210,6 @@ i2c2: i2c@b000 { #address-cells = <1>; #size-cells = <0>; reg = <0xb000 0x1000>; - clock-frequency = ; interrupts = <11 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; @@ -254,7 +251,6 @@ i2c3: i2c@c000 { #address-cells = <1>; #size-cells = <0>; reg = <0xc000 0x1000>; - clock-frequency = ; interrupts = <12 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; diff --git a/dts/arm/nordic/nrf5340_cpunet.dtsi b/dts/arm/nordic/nrf5340_cpunet.dtsi index eb9ce3d66793b..cf752e60f4c9e 100644 --- a/dts/arm/nordic/nrf5340_cpunet.dtsi +++ b/dts/arm/nordic/nrf5340_cpunet.dtsi @@ -201,7 +201,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x41013000 0x1000>; - clock-frequency = ; interrupts = <19 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; diff --git a/dts/arm/nordic/nrf91_peripherals.dtsi b/dts/arm/nordic/nrf91_peripherals.dtsi index 1be26d50af9c1..8688582911766 100644 --- a/dts/arm/nordic/nrf91_peripherals.dtsi +++ b/dts/arm/nordic/nrf91_peripherals.dtsi @@ -156,7 +156,6 @@ i2c0: i2c@8000 { #address-cells = <1>; #size-cells = <0>; reg = <0x8000 0x1000>; - clock-frequency = ; interrupts = <8 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <13>; status = "disabled"; @@ -173,7 +172,6 @@ i2c1: i2c@9000 { #address-cells = <1>; #size-cells = <0>; reg = <0x9000 0x1000>; - clock-frequency = ; interrupts = <9 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <13>; status = "disabled"; @@ -190,7 +188,6 @@ i2c2: i2c@a000 { #address-cells = <1>; #size-cells = <0>; reg = <0xa000 0x1000>; - clock-frequency = ; interrupts = <10 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <13>; status = "disabled"; @@ -207,7 +204,6 @@ i2c3: i2c@b000 { #address-cells = <1>; #size-cells = <0>; reg = <0xb000 0x1000>; - clock-frequency = ; interrupts = <11 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <13>; status = "disabled"; diff --git a/dts/common/nordic/nrf54l15.dtsi b/dts/common/nordic/nrf54l15.dtsi index 63ed995251981..4c07c34560efd 100644 --- a/dts/common/nordic/nrf54l15.dtsi +++ b/dts/common/nordic/nrf54l15.dtsi @@ -240,7 +240,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0xc6000 0x1000>; - clock-frequency = ; interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; @@ -280,7 +279,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0xc7000 0x1000>; - clock-frequency = ; interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; @@ -320,7 +318,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0xc8000 0x1000>; - clock-frequency = ; interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; @@ -531,7 +528,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x104000 0x1000>; - clock-frequency = ; interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; diff --git a/dts/common/nordic/nrf54l20.dtsi b/dts/common/nordic/nrf54l20.dtsi index ccf99419923e6..d0e64a19b4d70 100644 --- a/dts/common/nordic/nrf54l20.dtsi +++ b/dts/common/nordic/nrf54l20.dtsi @@ -190,7 +190,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0xc6000 0x1000>; - clock-frequency = ; interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; @@ -230,7 +229,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0xc7000 0x1000>; - clock-frequency = ; interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; @@ -270,7 +268,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0xc8000 0x1000>; - clock-frequency = ; interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; @@ -472,7 +469,6 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x104000 0x1000>; - clock-frequency = ; interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; easydma-maxcnt-bits = <16>; status = "disabled"; From 022c8ee1afbc6373265ef9c0a198defa3e862247 Mon Sep 17 00:00:00 2001 From: Hao Luo Date: Fri, 25 Oct 2024 21:47:12 +0800 Subject: [PATCH 1935/4482] drivers: gpio: ambiq: fix port status get error It's not possible to get pinconfig of specific pin in ambiq_gpio_port_get_raw function, change to use OR value of RD and WT registers for one group of gpio. Signed-off-by: Hao Luo --- drivers/gpio/gpio_ambiq.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/gpio/gpio_ambiq.c b/drivers/gpio/gpio_ambiq.c index 7b1ec551e8f68..cf4e7899db50c 100644 --- a/drivers/gpio/gpio_ambiq.c +++ b/drivers/gpio/gpio_ambiq.c @@ -270,22 +270,14 @@ static int ambiq_gpio_port_get_direction(const struct device *dev, gpio_port_pin static int ambiq_gpio_port_get_raw(const struct device *dev, gpio_port_value_t *value) { const struct ambiq_gpio_config *const dev_cfg = dev->config; - am_hal_gpio_pincfg_t pincfg; uint32_t pin_offset; #if defined(CONFIG_SOC_SERIES_APOLLO3X) pin_offset = dev_cfg->offset; - am_hal_gpio_pinconfig_get(pin_offset, &pincfg); - if (pincfg.eGPInput == AM_HAL_GPIO_PIN_INPUT_ENABLE) { #else pin_offset = dev_cfg->offset >> 2; - am_hal_gpio_pinconfig_get(pin_offset, &pincfg); - if (pincfg.GP.cfg_b.eGPInput == AM_HAL_GPIO_PIN_INPUT_ENABLE) { #endif - *value = (*AM_HAL_GPIO_RDn(pin_offset)); - } else { - *value = (*AM_HAL_GPIO_WTn(pin_offset)); - } + *value = (*AM_HAL_GPIO_RDn(pin_offset)) | (*AM_HAL_GPIO_WTn(pin_offset)); return 0; } From 46042f73cf54f7573300bf2b1d28adc9601218ff Mon Sep 17 00:00:00 2001 From: David Leach Date: Mon, 28 Oct 2024 16:55:58 -0500 Subject: [PATCH 1936/4482] soc: nxp: lpc55s69: Fix part number typo There is a typo in the part number list for LPC55S69. The LPC55S69JET98 should be LPC55S69JEV98. Fixes #80541 Signed-off-by: David Leach --- soc/nxp/lpc/lpc55xxx/Kconfig.soc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soc/nxp/lpc/lpc55xxx/Kconfig.soc b/soc/nxp/lpc/lpc55xxx/Kconfig.soc index f05b75103f495..e0aca968c35c8 100644 --- a/soc/nxp/lpc/lpc55xxx/Kconfig.soc +++ b/soc/nxp/lpc/lpc55xxx/Kconfig.soc @@ -72,7 +72,7 @@ config SOC_PART_NUMBER_LPC55S36JBD100 config SOC_PART_NUMBER_LPC55S69JBD100 bool -config SOC_PART_NUMBER_LPC55S69JET98 +config SOC_PART_NUMBER_LPC55S69JEV98 bool config SOC_PART_NUMBER @@ -84,4 +84,4 @@ config SOC_PART_NUMBER default "LPC55S28JBD100" if SOC_PART_NUMBER_LPC55S28JBD100 default "LPC55S36JBD100" if SOC_PART_NUMBER_LPC55S36JBD100 default "LPC55S69JBD100" if SOC_PART_NUMBER_LPC55S69JBD100 - default "LPC55S69JET98" if SOC_PART_NUMBER_LPC55S69JET98 + default "LPC55S69JEV98" if SOC_PART_NUMBER_LPC55S69JEV98 From ff5afd8a9acd05d49962ffc4f1adb765d3e1a73a Mon Sep 17 00:00:00 2001 From: Johan Carlsson Date: Wed, 4 Sep 2024 11:53:33 +0200 Subject: [PATCH 1937/4482] drivers: spi: mcux_flexcomm: wait for specific dma tx status. when sending multiple bytes only the DMA_STATUS_COMPLETE status is interesting. otherwise the semaphore will be signaled twice. Signed-off-by: Johan Carlsson --- drivers/spi/spi_mcux_flexcomm.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/spi/spi_mcux_flexcomm.c b/drivers/spi/spi_mcux_flexcomm.c index ecc3202891b65..09a2e26f97c3c 100644 --- a/drivers/spi/spi_mcux_flexcomm.c +++ b/drivers/spi/spi_mcux_flexcomm.c @@ -54,6 +54,7 @@ struct stream { uint32_t channel; /* stores the channel for dma */ struct dma_config dma_cfg; struct dma_block_config dma_blk_cfg[2]; + int wait_for_dma_status; }; #endif @@ -314,6 +315,9 @@ static void spi_mcux_dma_callback(const struct device *dev, void *arg, } else { /* identify the origin of this callback */ if (channel == data->dma_tx.channel) { + if (status != data->dma_tx.wait_for_dma_status) { + return; + } /* this part of the transfer ends */ data->status_flags |= SPI_MCUX_FLEXCOMM_DMA_TX_DONE_FLAG; } else if (channel == data->dma_rx.channel) { @@ -418,12 +422,14 @@ static int spi_mcux_dma_tx_load(const struct device *dev, const uint8_t *buf, blk_cfg->block_size = sizeof(uint32_t); blk_cfg->source_addr_adj = DMA_ADDR_ADJ_NO_CHANGE; blk_cfg->dest_addr_adj = DMA_ADDR_ADJ_NO_CHANGE; + data->dma_tx.wait_for_dma_status = DMA_STATUS_COMPLETE; } else { blk_cfg->source_address = (uint32_t)&data->dummy_tx_buffer; blk_cfg->dest_address = (uint32_t)&base->FIFOWR; blk_cfg->block_size = len; blk_cfg->source_addr_adj = DMA_ADDR_ADJ_NO_CHANGE; blk_cfg->dest_addr_adj = DMA_ADDR_ADJ_NO_CHANGE; + data->dma_tx.wait_for_dma_status = DMA_STATUS_BLOCK; } } else { if (last_packet) { @@ -449,10 +455,12 @@ static int spi_mcux_dma_tx_load(const struct device *dev, const uint8_t *buf, blk_cfg->block_size = sizeof(uint32_t); blk_cfg->source_addr_adj = DMA_ADDR_ADJ_NO_CHANGE; blk_cfg->dest_addr_adj = DMA_ADDR_ADJ_NO_CHANGE; + data->dma_tx.wait_for_dma_status = DMA_STATUS_COMPLETE; } else { blk_cfg->source_address = (uint32_t)buf; blk_cfg->dest_address = (uint32_t)&base->FIFOWR; blk_cfg->block_size = len; + data->dma_tx.wait_for_dma_status = DMA_STATUS_BLOCK; } } From a3530d6a43a199ce6a7df326038ea95431148d57 Mon Sep 17 00:00:00 2001 From: Johan Carlsson Date: Wed, 4 Sep 2024 11:47:14 +0200 Subject: [PATCH 1938/4482] drivers: spi: mcux_flexcomm: use rxignore bit instead of dummy read. when no rx data need to be read set the rxignore bits. with this change the dma setup is faster and no unnecessary dummy writes are done to memory. Signed-off-by: Johan Carlsson --- drivers/spi/spi_mcux_flexcomm.c | 43 ++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/drivers/spi/spi_mcux_flexcomm.c b/drivers/spi/spi_mcux_flexcomm.c index 09a2e26f97c3c..3624cd334c12c 100644 --- a/drivers/spi/spi_mcux_flexcomm.c +++ b/drivers/spi/spi_mcux_flexcomm.c @@ -298,9 +298,6 @@ static int spi_mcux_configure(const struct device *dev, } #ifdef CONFIG_SPI_MCUX_FLEXCOMM_DMA -/* Dummy buffer used as a sink when rc buf is null */ -uint32_t dummy_rx_buffer; - /* This function is executed in the interrupt context */ static void spi_mcux_dma_callback(const struct device *dev, void *arg, uint32_t channel, int status) @@ -336,7 +333,7 @@ static void spi_mcux_dma_callback(const struct device *dev, void *arg, static void spi_mcux_prepare_txlastword(uint32_t *txLastWord, const uint8_t *buf, const struct spi_config *spi_cfg, - size_t len) + size_t len, bool rx_ignore) { uint32_t word_size; @@ -349,6 +346,10 @@ static void spi_mcux_prepare_txlastword(uint32_t *txLastWord, *txLastWord = buf[len - 1U]; } + if (rx_ignore) { + *txLastWord |= (uint32_t)SPI_FIFOWR_RXIGNORE_MASK; + } + *txLastWord |= (uint32_t)SPI_FIFOWR_EOT_MASK; *txLastWord |= ((uint32_t)SPI_DEASSERT_ALL & @@ -359,7 +360,8 @@ static void spi_mcux_prepare_txlastword(uint32_t *txLastWord, } static void spi_mcux_prepare_txdummy(uint32_t *dummy, bool last_packet, - const struct spi_config *spi_cfg) + const struct spi_config *spi_cfg, + bool rx_ignore) { uint32_t word_size; @@ -368,6 +370,9 @@ static void spi_mcux_prepare_txdummy(uint32_t *dummy, bool last_packet, if (last_packet) { *dummy |= (uint32_t)SPI_FIFOWR_EOT_MASK; } + if (rx_ignore) { + *dummy |= (uint32_t)SPI_FIFOWR_RXIGNORE_MASK; + } *dummy |= ((uint32_t)SPI_DEASSERT_ALL & (~(uint32_t)SPI_DEASSERTNUM_SSEL((uint32_t)spi_cfg->slave))); @@ -377,7 +382,8 @@ static void spi_mcux_prepare_txdummy(uint32_t *dummy, bool last_packet, } static int spi_mcux_dma_tx_load(const struct device *dev, const uint8_t *buf, - const struct spi_config *spi_cfg, size_t len, bool last_packet) + const struct spi_config *spi_cfg, size_t len, + bool last_packet, bool rx_ignore) { const struct spi_mcux_config *cfg = dev->config; struct spi_mcux_data *data = dev->data; @@ -400,11 +406,11 @@ static int spi_mcux_dma_tx_load(const struct device *dev, const uint8_t *buf, if (buf == NULL) { data->dummy_tx_buffer = 0; data->last_word = 0; - spi_mcux_prepare_txdummy(&data->dummy_tx_buffer, last_packet, spi_cfg); + spi_mcux_prepare_txdummy(&data->dummy_tx_buffer, last_packet, spi_cfg, rx_ignore); if (last_packet && ((word_size > 8) ? (len > 2U) : (len > 1U))) { - spi_mcux_prepare_txdummy(&data->last_word, last_packet, spi_cfg); + spi_mcux_prepare_txdummy(&data->last_word, last_packet, spi_cfg, rx_ignore); blk_cfg->source_address = (uint32_t)&data->dummy_tx_buffer; blk_cfg->dest_address = (uint32_t)&base->FIFOWR; blk_cfg->block_size = (word_size > 8) ? @@ -433,7 +439,7 @@ static int spi_mcux_dma_tx_load(const struct device *dev, const uint8_t *buf, } } else { if (last_packet) { - spi_mcux_prepare_txlastword(&data->last_word, buf, spi_cfg, len); + spi_mcux_prepare_txlastword(&data->last_word, buf, spi_cfg, len, rx_ignore); } /* If last packet and data transfer frame is bigger then 1, * use dma descriptor to send the last data. @@ -481,7 +487,7 @@ static int spi_mcux_dma_tx_load(const struct device *dev, const uint8_t *buf, uint32_t tmpData = 0U; - spi_mcux_prepare_txdummy(&tmpData, last_packet, spi_cfg); + spi_mcux_prepare_txdummy(&tmpData, last_packet, spi_cfg, rx_ignore); /* Setup the control info. * Halfword writes to just the control bits (offset 0xE22) doesn't push @@ -514,6 +520,11 @@ static int spi_mcux_dma_rx_load(const struct device *dev, uint8_t *buf, /* retrieve active RX DMA channel (used in callback) */ struct stream *stream = &data->dma_rx; + if (buf == NULL) { + data->status_flags |= SPI_MCUX_FLEXCOMM_DMA_RX_DONE_FLAG; + return 0; + } + blk_cfg = &stream->dma_blk_cfg[0]; /* prepare the block for this RX DMA channel */ @@ -521,14 +532,7 @@ static int spi_mcux_dma_rx_load(const struct device *dev, uint8_t *buf, blk_cfg->block_size = len; /* rx direction has periph as source and mem as dest. */ - if (buf == NULL) { - /* if rx buff is null, then write data to dummy address. */ - blk_cfg->dest_address = (uint32_t)&dummy_rx_buffer; - blk_cfg->dest_addr_adj = DMA_ADDR_ADJ_NO_CHANGE; - } else { - blk_cfg->dest_address = (uint32_t)buf; - } - + blk_cfg->dest_address = (uint32_t)buf; blk_cfg->source_address = (uint32_t)&base->FIFORD; /* direction is given by the DT */ @@ -554,6 +558,7 @@ static int spi_mcux_dma_move_buffers(const struct device *dev, size_t len, const struct spi_config *spi_cfg, bool last_packet) { struct spi_mcux_data *data = dev->data; + bool rx_ignore = data->ctx.rx_buf ? false : true; int ret; ret = spi_mcux_dma_rx_load(dev, data->ctx.rx_buf, len); @@ -563,7 +568,7 @@ static int spi_mcux_dma_move_buffers(const struct device *dev, size_t len, } ret = spi_mcux_dma_tx_load(dev, data->ctx.tx_buf, spi_cfg, - len, last_packet); + len, last_packet, rx_ignore); return ret; } From 6261e2a673286747b13b3c2e72dcee823a32b28b Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 24 Oct 2024 13:02:09 -0400 Subject: [PATCH 1939/4482] Revert "kernel: banner: Expose tainted builds" This reverts commit 6d4031f96c87d761fb198daebbd78e18b3c61edf. Those makes majority of builds og platforms with blobs tainted although the blob were not used or compiled in. So it is very misleading. Signed-off-by: Anas Nashif --- kernel/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/Kconfig b/kernel/Kconfig index 535bce42901ac..0553161eca1ee 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -450,7 +450,6 @@ config BOOT_BANNER config BOOT_BANNER_STRING string "Boot banner string" depends on BOOT_BANNER - default "Booting Zephyr OS build (tainted)" if TAINT default "Booting Zephyr OS build" help Use this option to set the boot banner. From b8999973d3fe250002bcfa99c4c7233a1b57db95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Thu, 24 Oct 2024 09:24:04 +0200 Subject: [PATCH 1940/4482] drivers: spi: litex: add flush of rx buffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this flushes the rx buffer before the start of a new transaction. It is needed because the litex bios is not always reading the rx buffer. Signed-off-by: Fin Maaß --- drivers/spi/spi_litex_litespi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/spi/spi_litex_litespi.c b/drivers/spi/spi_litex_litespi.c index ad8071ecf315d..c15aaed991746 100644 --- a/drivers/spi/spi_litex_litespi.c +++ b/drivers/spi/spi_litex_litespi.c @@ -152,6 +152,13 @@ static int spi_litex_xfer(const struct device *dev, const struct spi_config *con litex_write32(BIT(config->slave), dev_config->core_master_cs_addr); + /* Flush RX buffer */ + while ((litex_read8(dev_config->core_master_status_addr) & + BIT(SPIFLASH_CORE_MASTER_STATUS_RX_READY_OFFSET))) { + rxd = litex_read32(dev_config->core_master_rxtx_addr); + LOG_DBG("flushed rxd: 0x%x", rxd); + } + do { len = MIN(spi_context_max_continuous_chunk(ctx), dev_config->core_master_rxtx_size); if (len != old_len) { From dbebc9983a5f3a745f70102c9c4533b17ac0ba8f Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Wed, 9 Oct 2024 16:30:28 -0300 Subject: [PATCH 1941/4482] tests: wifi: esp32c2: esp8684: RAM adjustment config RAM adjustments to fit smaller SRAM availability on ESP32C2/ESP8684 Signed-off-by: Raffael Rostagno --- tests/boards/espressif/wifi/socs/esp32c2.conf | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/boards/espressif/wifi/socs/esp32c2.conf diff --git a/tests/boards/espressif/wifi/socs/esp32c2.conf b/tests/boards/espressif/wifi/socs/esp32c2.conf new file mode 100644 index 0000000000000..0b1e576c21964 --- /dev/null +++ b/tests/boards/espressif/wifi/socs/esp32c2.conf @@ -0,0 +1,14 @@ +CONFIG_HEAP_MEM_POOL_SIZE=5120 + +# Following settings are test only values, and +# were adjusted due to stricter SRAM limits on C2 + +CONFIG_NET_PKT_RX_COUNT=5 +CONFIG_NET_PKT_TX_COUNT=5 +CONFIG_NET_BUF_RX_COUNT=10 +CONFIG_NET_BUF_TX_COUNT=10 + +# Reduced by 512 bytes each +CONFIG_ISR_STACK_SIZE=1536 +CONFIG_NET_RX_STACK_SIZE=1536 +CONFIG_NET_MGMT_EVENT_STACK_SIZE=1536 From 0d1a788e381acb84d12e3d1924f4d9b3c61e2b8c Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Tue, 15 Oct 2024 12:57:37 -0300 Subject: [PATCH 1942/4482] samples: wifi: esp32c2: esp8684: Remove config files Remove wifi sample config files for esp32c2/esp8684, as device isn't able to run it after memory layout update. Signed-off-by: Raffael Rostagno --- samples/net/wifi/socs/esp32c2.conf | 11 ----------- samples/net/wifi/socs/esp32c2.overlay | 9 --------- 2 files changed, 20 deletions(-) delete mode 100644 samples/net/wifi/socs/esp32c2.conf delete mode 100644 samples/net/wifi/socs/esp32c2.overlay diff --git a/samples/net/wifi/socs/esp32c2.conf b/samples/net/wifi/socs/esp32c2.conf deleted file mode 100644 index a72fdf39efa24..0000000000000 --- a/samples/net/wifi/socs/esp32c2.conf +++ /dev/null @@ -1,11 +0,0 @@ -CONFIG_WIFI=y - -CONFIG_NETWORKING=y -CONFIG_NET_L2_ETHERNET=y - -CONFIG_NET_IPV6=n -CONFIG_NET_IPV4=y -CONFIG_NET_DHCPV4=y -CONFIG_ESP32_WIFI_STA_AUTO_DHCPV4=y - -CONFIG_NET_LOG=y diff --git a/samples/net/wifi/socs/esp32c2.overlay b/samples/net/wifi/socs/esp32c2.overlay deleted file mode 100644 index 872f2dfe2eaba..0000000000000 --- a/samples/net/wifi/socs/esp32c2.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&wifi { - status = "okay"; -}; From adced0c29bfad4a0236c52b910e696896eb695e3 Mon Sep 17 00:00:00 2001 From: Ian Morris Date: Thu, 24 Oct 2024 19:55:27 -0700 Subject: [PATCH 1943/4482] drivers: serial: fix renesas ra sci uart hardware flow control enable Fixed typo in Renesas RA SCI UART configuration that was preventing hardware flow control from being enabled. Signed-off-by: Ian Morris --- drivers/serial/uart_renesas_ra_sci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/serial/uart_renesas_ra_sci.c b/drivers/serial/uart_renesas_ra_sci.c index fc2b79104e015..1c424f19f5759 100644 --- a/drivers/serial/uart_renesas_ra_sci.c +++ b/drivers/serial/uart_renesas_ra_sci.c @@ -1180,7 +1180,7 @@ static void uart_ra_sci_eri_isr(const struct device *dev) .parity = UART_CFG_PARITY_NONE, \ .stop_bits = UART_CFG_STOP_BITS_1, \ .data_bits = UART_CFG_DATA_BITS_8, \ - .flow_ctrl = COND_CODE_1(DT_NODE_HAS_PROP(idx, hw_flow_control), \ + .flow_ctrl = COND_CODE_1(DT_INST_PROP(index, hw_flow_control), \ (UART_CFG_FLOW_CTRL_RTS_CTS), \ (UART_CFG_FLOW_CTRL_NONE)), \ }, \ From cd9ddc95a8e671019bb900376b8fdbdd7fc64b9f Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Fri, 25 Oct 2024 22:14:32 +0900 Subject: [PATCH 1944/4482] arch: arm: cortex_a_r: Fix mrc/mcr instruction usage The coprocessor number in ARM `mrc` and `mcr` instructions must be prefixed with `p`. GNU assembler allows specifying coprocessor number without the `p` prefix; but, LLVM assembler is more picky about this and prints out "invalid instruction" error otherwise. Signed-off-by: Stephanos Ioannidis --- arch/arm/core/cortex_a_r/__aeabi_read_tp.S | 2 +- arch/arm/core/cortex_a_r/swap_helper.S | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/core/cortex_a_r/__aeabi_read_tp.S b/arch/arm/core/cortex_a_r/__aeabi_read_tp.S index 40874c4a1fa0b..bafd7e8e3ece2 100644 --- a/arch/arm/core/cortex_a_r/__aeabi_read_tp.S +++ b/arch/arm/core/cortex_a_r/__aeabi_read_tp.S @@ -14,5 +14,5 @@ SECTION_FUNC(text, __aeabi_read_tp) /* * TPIDRURW will be used as a base pointer point to TLS aera. */ - mrc 15, 0, r0, c13, c0, 2 + mrc p15, 0, r0, c13, c0, 2 bx lr diff --git a/arch/arm/core/cortex_a_r/swap_helper.S b/arch/arm/core/cortex_a_r/swap_helper.S index 548bb446aa319..457f71e9d7b80 100644 --- a/arch/arm/core/cortex_a_r/swap_helper.S +++ b/arch/arm/core/cortex_a_r/swap_helper.S @@ -126,7 +126,7 @@ out_fp_inactive: * TPIDRURW is used as a base pointer to all * thread variables with offsets added by toolchain. */ - mcr 15, 0, r0, c13, c0, 2 + mcr p15, 0, r0, c13, c0, 2 #endif #if defined(CONFIG_ARM_STORE_EXC_RETURN) From d3fac0b7fe60f94163ead2bfaaa093fe0080fe6d Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 25 Oct 2024 14:02:33 -0500 Subject: [PATCH 1945/4482] soc: nxp: mcx: do not select HAS_SEGGER_RTT unless segger module is present Do not select HAS_SEGGER_RTT unless the segger module is present. This avoids a Kconfig error when SEGGER's debug module is not present in the west manifest Fixes #80529 Signed-off-by: Daniel DeGrasse --- soc/nxp/mcx/mcxa/Kconfig | 2 +- soc/nxp/mcx/mcxn/Kconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/soc/nxp/mcx/mcxa/Kconfig b/soc/nxp/mcx/mcxa/Kconfig index a123cfa4fa87f..6037d43b55d34 100644 --- a/soc/nxp/mcx/mcxa/Kconfig +++ b/soc/nxp/mcx/mcxa/Kconfig @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 config SOC_SERIES_MCXA - select HAS_SEGGER_RTT + select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE select CLOCK_CONTROL select ARM select HAS_MCUX diff --git a/soc/nxp/mcx/mcxn/Kconfig b/soc/nxp/mcx/mcxn/Kconfig index 0379358ca951f..57b5fb7e25eb7 100644 --- a/soc/nxp/mcx/mcxn/Kconfig +++ b/soc/nxp/mcx/mcxn/Kconfig @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 config SOC_SERIES_MCXN - select HAS_SEGGER_RTT + select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE select CLOCK_CONTROL select ARM select HAS_MCUX From 303c7d7e69d446662b810371edd96bcacd63d5f2 Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Thu, 24 Oct 2024 14:38:03 -0300 Subject: [PATCH 1946/4482] soc: dts: esp32c3: esp8685: Add files to indicate support Add SoC dtsi files to indicate support/compatibility with ESP32C3. Signed-off-by: Raffael Rostagno --- dts/riscv/espressif/esp32c3/esp8685.dtsi | 7 +++++++ dts/riscv/espressif/esp32c3/esp8685_h4.dtsi | 12 ++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 dts/riscv/espressif/esp32c3/esp8685.dtsi create mode 100644 dts/riscv/espressif/esp32c3/esp8685_h4.dtsi diff --git a/dts/riscv/espressif/esp32c3/esp8685.dtsi b/dts/riscv/espressif/esp32c3/esp8685.dtsi new file mode 100644 index 0000000000000..3decfe509c56f --- /dev/null +++ b/dts/riscv/espressif/esp32c3/esp8685.dtsi @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "esp32c3_common.dtsi" diff --git a/dts/riscv/espressif/esp32c3/esp8685_h4.dtsi b/dts/riscv/espressif/esp32c3/esp8685_h4.dtsi new file mode 100644 index 0000000000000..8f0cfa6868cce --- /dev/null +++ b/dts/riscv/espressif/esp32c3/esp8685_h4.dtsi @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "esp32c3_common.dtsi" + +/* 4MB flash */ +&flash0 { + reg = <0x0 DT_SIZE_M(4)>; +}; From c22233a1afcb97e55af2929c7d1416da77d96ca9 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Sat, 26 Oct 2024 15:50:14 +1000 Subject: [PATCH 1947/4482] net: nsos_sockets: free allocated socket on close Free the socket object allocated in `nsos_socket_create` when closing the socket. Signed-off-by: Jordan Yates --- drivers/net/nsos_sockets.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/nsos_sockets.c b/drivers/net/nsos_sockets.c index ac82e1ad52591..bfd8cb2c7f3e6 100644 --- a/drivers/net/nsos_sockets.c +++ b/drivers/net/nsos_sockets.c @@ -256,6 +256,8 @@ static int nsos_close(void *obj) errno = nsos_adapt_get_zephyr_errno(); } + k_free(sock); + return ret; } From b17156692fb60108efb0feac54f40a46c60b9e0a Mon Sep 17 00:00:00 2001 From: Filip Kokosinski Date: Mon, 28 Oct 2024 10:40:07 +0100 Subject: [PATCH 1948/4482] tests/kernel/device: add missing `#power-domain-cells` in overlays This commits defines the `#power-domain-cells` properties for fakedomain nodes in the HiFive Unmatched devicetree overlay file. Without this change, this tests fails to build for the `hifive_unmatched` Zephyr target. Fixes #80503. Signed-off-by: Filip Kokosinski --- tests/kernel/device/boards/hifive_unmatched.overlay | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/kernel/device/boards/hifive_unmatched.overlay b/tests/kernel/device/boards/hifive_unmatched.overlay index 6f16d2d9b7b0e..b5f5176ec541b 100644 --- a/tests/kernel/device/boards/hifive_unmatched.overlay +++ b/tests/kernel/device/boards/hifive_unmatched.overlay @@ -66,17 +66,20 @@ fakedomain_0: fakedomain_0 { compatible = "fakedomain"; status = "okay"; + #power-domain-cells = <0>; power-domains = <&fakedomain_2>; }; fakedomain_1: fakedomain_1 { compatible = "fakedomain"; status = "okay"; + #power-domain-cells = <0>; power-domains = <&fakedomain_0>; }; fakedomain_2: fakedomain_2 { compatible = "fakedomain"; status = "okay"; + #power-domain-cells = <0>; }; }; From a30e41f4d7b05679c22dda8c9d9eb2d3d430b717 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 28 Oct 2024 12:17:09 +0100 Subject: [PATCH 1949/4482] manifest: Update bsim to version v2.4 Main changes since v2.3: * Support for immediate RSSI measurements during abort reevaluations * Several minor improvements in the base components, including tolerating better under-setup docker images, improved C++ compatibility, a new sanity check for problematic user provided sim_ids, and other minor improvements. Note: Like before, bsim remains fully backwards compatible Signed-off-by: Alberto Escolar Piedras --- west.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/west.yml b/west.yml index 5d50af436004e..f5a8923c458eb 100644 --- a/west.yml +++ b/west.yml @@ -34,7 +34,7 @@ manifest: path: modules/lib/acpica - name: bsim repo-path: babblesim-manifest - revision: 9ee22c707970f6621adba0375841c0a609e24628 + revision: 1f242f4ed7fc141fdfcfeca8d21c6d9e801179d7 path: tools/bsim groups: - babblesim @@ -42,21 +42,21 @@ manifest: remote: babblesim repo-path: base path: tools/bsim/components - revision: a3dff9a57f334fb25daa9625841cd64cbfe56681 + revision: 0cc70e78a88c1de9d8ec045a703b38134861e7e7 groups: - babblesim - name: babblesim_ext_2G4_libPhyComv1 remote: babblesim repo-path: ext_2G4_libPhyComv1 path: tools/bsim/components/ext_2G4_libPhyComv1 - revision: aa4951317cc7d84f24152ea38ac9ac21e6d78a76 + revision: 15ae0f87fa049e04cbec48a866f3bc37d903f950 groups: - babblesim - name: babblesim_ext_2G4_phy_v1 remote: babblesim repo-path: ext_2G4_phy_v1 path: tools/bsim/components/ext_2G4_phy_v1 - revision: 04eeb3c3794444122fbeeb3715f4233b0b50cfbb + revision: 62e797b2c518e5bb6123a198382ed2b64b8c068e groups: - babblesim - name: babblesim_ext_2G4_channel_NtNcable From f380fcc52f3a00ab966aa2deb89417edeeab484e Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Mon, 28 Oct 2024 13:50:19 +0200 Subject: [PATCH 1950/4482] drivers: modem_cellular: fix handling of `+C*REG` answers `+C*REG:` may be received as AT read command answer or unsolicited notification. Their syntax differs, and even the overall parameter count varies depending on what `` is used in the `AT+CEREG=` write command. To handle all cases properly, check the parameter count and the presence of the `` parameter (which is a string and thus begins with `"`) to figure out what is the position of ``. Signed-off-by: Tomi Fontanilles --- drivers/modem/modem_cellular.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index aee527a26faae..9f1a9a527c64e 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -460,10 +460,15 @@ static void modem_cellular_chat_on_cxreg(struct modem_chat *chat, char **argv, u struct modem_cellular_data *data = (struct modem_cellular_data *)user_data; enum cellular_registration_status registration_status = 0; - if (argc == 2) { - registration_status = atoi(argv[1]); - } else if (argc == 3 || argc == 6) { + /* This receives both +C*REG? read command answers and unsolicited notifications. + * Their syntax differs in that the former has one more parameter, , which is first. + */ + if (argc >= 3 && argv[2][0] != '"') { + /* +CEREG: ,[,[...]] */ registration_status = atoi(argv[2]); + } else if (argc >= 2) { + /* +CEREG: [,[...]] */ + registration_status = atoi(argv[1]); } else { return; } @@ -472,7 +477,7 @@ static void modem_cellular_chat_on_cxreg(struct modem_chat *chat, char **argv, u data->registration_status_gsm = registration_status; } else if (strcmp(argv[0], "+CGREG: ") == 0) { data->registration_status_gprs = registration_status; - } else { + } else { /* CEREG */ data->registration_status_lte = registration_status; } From f277631b60092378d1e4fcd9bd727d23d972c648 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 29 Oct 2024 14:16:18 +0000 Subject: [PATCH 1951/4482] sysbuild: Add missing option for MCUboot encryption support Adds a missing 'default y' for the Kconfig option indicating that encryption is supported with the current configuration Signed-off-by: Jamie McCrae --- share/sysbuild/images/bootloader/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/share/sysbuild/images/bootloader/Kconfig b/share/sysbuild/images/bootloader/Kconfig index 81b17b5a6e1bd..df97b18e3e6bc 100644 --- a/share/sysbuild/images/bootloader/Kconfig +++ b/share/sysbuild/images/bootloader/Kconfig @@ -151,6 +151,7 @@ config BOOT_SIGNATURE_KEY_FILE config SUPPORT_BOOT_ENCRYPTION bool depends on !BOOT_SIGNATURE_TYPE_NONE && !MCUBOOT_MODE_DIRECT_XIP && !MCUBOOT_MODE_DIRECT_XIP_WITH_REVERT && !MCUBOOT_MODE_FIRMWARE_UPDATER + default y config BOOT_ENCRYPTION bool "Encrypted image support" From 2c43d7fe764b2ca9455a5c6a93903fcc89ce9089 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 28 Oct 2024 16:06:39 -0400 Subject: [PATCH 1952/4482] twister: oot soc: set soc_root using Path Set soc_root using Path to avoid wrong generated path in the list of soc_roots and other roots read from module.yml file Fixes #80531 Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/environment.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/environment.py b/scripts/pylib/twister/twisterlib/environment.py index 0ab3022729dde..ab4f1a3d6af45 100644 --- a/scripts/pylib/twister/twisterlib/environment.py +++ b/scripts/pylib/twister/twisterlib/environment.py @@ -980,13 +980,13 @@ def __init__(self, options, default_options=None) -> None: for module in modules: soc_root = module.meta.get("build", {}).get("settings", {}).get("soc_root") if soc_root: - self.soc_roots.append(os.path.join(module.project, soc_root)) + self.soc_roots.append(Path(module.project) / Path(soc_root)) dts_root = module.meta.get("build", {}).get("settings", {}).get("dts_root") if dts_root: - self.dts_roots.append(os.path.join(module.project, dts_root)) + self.dts_roots.append(Path(module.project) / Path(dts_root)) arch_root = module.meta.get("build", {}).get("settings", {}).get("arch_root") if arch_root: - self.arch_roots.append(os.path.join(module.project, arch_root)) + self.arch_roots.append(Path(module.project) / Path(arch_root)) self.hwm = None From 2fd8cc8d881940f1c5b1c5499cc5384fc1a93c73 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Mon, 28 Oct 2024 12:58:49 +0100 Subject: [PATCH 1953/4482] linker: lto: Remove experimental label LTO support was added with Zephyr 3.6.0, and it has been used in production with Nordic devices for a long time. Remove the experimental label to mark it ready for production. Signed-off-by: Carles Cufi --- Kconfig.zephyr | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Kconfig.zephyr b/Kconfig.zephyr index f97819896d94a..68abf89b42fc4 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -536,11 +536,10 @@ config NO_OPTIMIZATIONS endchoice config LTO - bool "Link Time Optimization [EXPERIMENTAL]" + bool "Link Time Optimization" depends on !(GEN_ISR_TABLES || GEN_IRQ_VECTOR_TABLE) || ISR_TABLES_LOCAL_DECLARATION depends on !NATIVE_LIBRARY depends on !CODE_DATA_RELOCATION - select EXPERIMENTAL help This option enables Link Time Optimization. From b46e17670439ebaaecb0a4c18a356d3d65fccb55 Mon Sep 17 00:00:00 2001 From: Gerson Fernando Budke Date: Sun, 27 Oct 2024 10:37:58 +0100 Subject: [PATCH 1954/4482] mgmt: mcumgr: stat: Fix stat_mgmt_list behavior The MCUmgr statistics only work correctly when selecting MCUMGR_SMP_LEGACY_RC_BEHAVIOUR option. Checks the option flag on the stat_mgmt_list and fix the behavior. Fixes: 80476 Signed-off-by: Gerson Fernando Budke --- .../mgmt/mcumgr/grp/stat_mgmt/src/stat_mgmt.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/subsys/mgmt/mcumgr/grp/stat_mgmt/src/stat_mgmt.c b/subsys/mgmt/mcumgr/grp/stat_mgmt/src/stat_mgmt.c index 664c65b281f36..901daff759c3d 100644 --- a/subsys/mgmt/mcumgr/grp/stat_mgmt/src/stat_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/stat_mgmt/src/stat_mgmt.c @@ -190,7 +190,7 @@ stat_mgmt_list(struct smp_streamer *ctxt) { const struct stats_hdr *cur = NULL; zcbor_state_t *zse = ctxt->writer->zs; - bool ok; + bool ok = true; size_t counter = 0; do { @@ -200,10 +200,15 @@ stat_mgmt_list(struct smp_streamer *ctxt) } } while (cur != NULL); - ok = zcbor_tstr_put_lit(zse, "rc") && - zcbor_int32_put(zse, MGMT_ERR_EOK) && - zcbor_tstr_put_lit(zse, "stat_list") && - zcbor_list_start_encode(zse, counter); + if (IS_ENABLED(CONFIG_MCUMGR_SMP_LEGACY_RC_BEHAVIOUR)) { + ok = zcbor_tstr_put_lit(zse, "rc") && + zcbor_int32_put(zse, MGMT_ERR_EOK); + } + + if (ok) { + ok = zcbor_tstr_put_lit(zse, "stat_list") && + zcbor_list_start_encode(zse, counter); + } if (!ok) { return MGMT_ERR_EMSGSIZE; @@ -224,7 +229,7 @@ stat_mgmt_list(struct smp_streamer *ctxt) return MGMT_ERR_EMSGSIZE; } - return 0; + return MGMT_ERR_EOK; } #ifdef CONFIG_MCUMGR_SMP_SUPPORT_ORIGINAL_PROTOCOL From 3c1fb4113630e2943843cd61fa7f8a01bf7cacb8 Mon Sep 17 00:00:00 2001 From: James Roy Date: Sat, 26 Oct 2024 13:52:51 +0800 Subject: [PATCH 1955/4482] style: Inconsistent macro names changed Fix incorrect header file pre-macro names in 'include/zephyr/app_memory', 'include/zephyr/display' and 'include/zephyr/mgmt'. Signed-off-by: James Roy --- include/zephyr/app_memory/mem_domain.h | 6 +++--- include/zephyr/display/cfb.h | 6 +++--- include/zephyr/mgmt/osdp.h | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/zephyr/app_memory/mem_domain.h b/include/zephyr/app_memory/mem_domain.h index 8fe75eb33d931..b950235fc0d8c 100644 --- a/include/zephyr/app_memory/mem_domain.h +++ b/include/zephyr/app_memory/mem_domain.h @@ -5,8 +5,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef INCLUDE_APP_MEMORY_MEM_DOMAIN_H -#define INCLUDE_APP_MEMORY_MEM_DOMAIN_H +#ifndef ZEPHYR_INCLUDE_APP_MEMORY_MEM_DOMAIN_H_ +#define ZEPHYR_INCLUDE_APP_MEMORY_MEM_DOMAIN_H_ #include #include @@ -193,4 +193,4 @@ int k_mem_domain_add_thread(struct k_mem_domain *domain, #endif /** @} */ -#endif /* INCLUDE_APP_MEMORY_MEM_DOMAIN_H */ +#endif /* ZEPHYR_INCLUDE_APP_MEMORY_MEM_DOMAIN_H_ */ diff --git a/include/zephyr/display/cfb.h b/include/zephyr/display/cfb.h index 6d10debe676c3..9cdf81e259af4 100644 --- a/include/zephyr/display/cfb.h +++ b/include/zephyr/display/cfb.h @@ -9,8 +9,8 @@ * @brief Public Monochrome Character Framebuffer API */ -#ifndef __CFB_H__ -#define __CFB_H__ +#ifndef ZEPHYR_INCLUDE_DISPLAY_CFB_H_ +#define ZEPHYR_INCLUDE_DISPLAY_CFB_H_ #include #include @@ -256,4 +256,4 @@ void cfb_framebuffer_deinit(const struct device *dev); * @} */ -#endif /* __CFB_H__ */ +#endif /* ZEPHYR_INCLUDE_DISPLAY_CFB_H_ */ diff --git a/include/zephyr/mgmt/osdp.h b/include/zephyr/mgmt/osdp.h index b73314aece2c5..29940ff03d109 100644 --- a/include/zephyr/mgmt/osdp.h +++ b/include/zephyr/mgmt/osdp.h @@ -9,8 +9,8 @@ * @brief Open Supervised Device Protocol (OSDP) public API header file. */ -#ifndef _OSDP_H_ -#define _OSDP_H_ +#ifndef ZEPHYR_INCLUDE_MGMT_OSDP_H_ +#define ZEPHYR_INCLUDE_MGMT_OSDP_H_ #include #include @@ -480,4 +480,4 @@ uint32_t osdp_get_sc_status_mask(void); } #endif -#endif /* _OSDP_H_ */ +#endif /* ZEPHYR_INCLUDE_MGMT_OSDP_H_ */ From 050fa718c8509d21c64acdfe6c71891083cb3fae Mon Sep 17 00:00:00 2001 From: James Roy Date: Sat, 26 Oct 2024 14:07:10 +0800 Subject: [PATCH 1956/4482] style: Inconsistent macro names changed Fix incorrect header file pre-macro names in 'include/zephyr/shell' and 'include/zephyr/task_wdt'. Signed-off-by: James Roy --- include/zephyr/shell/shell_backend.h | 6 +++--- include/zephyr/shell/shell_dummy.h | 6 +++--- include/zephyr/shell/shell_fprintf.h | 6 +++--- include/zephyr/shell/shell_history.h | 6 +++--- include/zephyr/shell/shell_log_backend.h | 6 +++--- include/zephyr/shell/shell_mqtt.h | 6 +++--- include/zephyr/shell/shell_rpmsg.h | 6 +++--- include/zephyr/shell/shell_rtt.h | 6 +++--- include/zephyr/shell/shell_string_conv.h | 6 +++--- include/zephyr/shell/shell_telnet.h | 6 +++--- include/zephyr/shell/shell_types.h | 6 +++--- include/zephyr/shell/shell_uart.h | 6 +++--- include/zephyr/shell/shell_websocket.h | 6 +++--- include/zephyr/task_wdt/task_wdt.h | 6 +++--- 14 files changed, 42 insertions(+), 42 deletions(-) diff --git a/include/zephyr/shell/shell_backend.h b/include/zephyr/shell/shell_backend.h index ae8f8a5afc31d..d0611f9244e77 100644 --- a/include/zephyr/shell/shell_backend.h +++ b/include/zephyr/shell/shell_backend.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef SHELL_BACKEND_H__ -#define SHELL_BACKEND_H__ +#ifndef ZEPHYR_INCLUDE_SHELL_BACKEND_H_ +#define ZEPHYR_INCLUDE_SHELL_BACKEND_H_ #include #include @@ -58,4 +58,4 @@ const struct shell *shell_backend_get_by_name(const char *backend_name); } #endif -#endif /* SHELL_BACKEND_H__ */ +#endif /* ZEPHYR_INCLUDE_SHELL_BACKEND_H_ */ diff --git a/include/zephyr/shell/shell_dummy.h b/include/zephyr/shell/shell_dummy.h index 43dc4a8697787..bd520f4a9e020 100644 --- a/include/zephyr/shell/shell_dummy.h +++ b/include/zephyr/shell/shell_dummy.h @@ -6,8 +6,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef SHELL_DUMMY_H__ -#define SHELL_DUMMY_H__ +#ifndef ZEPHYR_INCLUDE_SHELL_DUMMY_H_ +#define ZEPHYR_INCLUDE_SHELL_DUMMY_H_ #include @@ -68,4 +68,4 @@ void shell_backend_dummy_clear_output(const struct shell *sh); } #endif -#endif /* SHELL_DUMMY_H__ */ +#endif /* ZEPHYR_INCLUDE_SHELL_DUMMY_H_ */ diff --git a/include/zephyr/shell/shell_fprintf.h b/include/zephyr/shell/shell_fprintf.h index 979e88ebd2498..aaac65ea00d29 100644 --- a/include/zephyr/shell/shell_fprintf.h +++ b/include/zephyr/shell/shell_fprintf.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef SHELL_FPRINTF_H__ -#define SHELL_FPRINTF_H__ +#ifndef ZEPHYR_INCLUDE_SHELL_FPRINTF_H_ +#define ZEPHYR_INCLUDE_SHELL_FPRINTF_H_ #include #include @@ -80,4 +80,4 @@ void z_shell_fprintf_buffer_flush(const struct shell_fprintf *sh_fprintf); } #endif -#endif /* SHELL_FPRINTF_H__ */ +#endif /* ZEPHYR_INCLUDE_SHELL_FPRINTF_H_ */ diff --git a/include/zephyr/shell/shell_history.h b/include/zephyr/shell/shell_history.h index 9148335774c18..1ddf69b79383a 100644 --- a/include/zephyr/shell/shell_history.h +++ b/include/zephyr/shell/shell_history.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef SHELL_HISTORY_H__ -#define SHELL_HISTORY_H__ +#ifndef ZEPHYR_INCLUDE_SHELL_HISTORY_H_ +#define ZEPHYR_INCLUDE_SHELL_HISTORY_H_ #include #include @@ -111,4 +111,4 @@ static inline bool z_shell_history_active(struct shell_history *history) } #endif -#endif /* SHELL_HISTORY_H__ */ +#endif /* ZEPHYR_INCLUDE_SHELL_HISTORY_H_ */ diff --git a/include/zephyr/shell/shell_log_backend.h b/include/zephyr/shell/shell_log_backend.h index 620709ffd6a35..327e82d82ce15 100644 --- a/include/zephyr/shell/shell_log_backend.h +++ b/include/zephyr/shell/shell_log_backend.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef SHELL_LOG_BACKEND_H__ -#define SHELL_LOG_BACKEND_H__ +#ifndef ZEPHYR_INCLUDE_SHELL_LOG_BACKEND_H_ +#define ZEPHYR_INCLUDE_SHELL_LOG_BACKEND_H_ #include #include @@ -124,4 +124,4 @@ bool z_shell_log_backend_process(const struct shell_log_backend *backend); } #endif -#endif /* SHELL_LOG_BACKEND_H__ */ +#endif /* ZEPHYR_INCLUDE_SHELL_LOG_BACKEND_H_ */ diff --git a/include/zephyr/shell/shell_mqtt.h b/include/zephyr/shell/shell_mqtt.h index 72e597e6d53b2..92ce6987efefc 100644 --- a/include/zephyr/shell/shell_mqtt.h +++ b/include/zephyr/shell/shell_mqtt.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef SHELL_MQTT_H__ -#define SHELL_MQTT_H__ +#ifndef ZEPHYR_INCLUDE_SHELL_MQTT_H_ +#define ZEPHYR_INCLUDE_SHELL_MQTT_H_ #include #include @@ -137,4 +137,4 @@ bool shell_mqtt_get_devid(char *id, int id_max_len); } #endif -#endif /* SHELL_MQTT_H__ */ +#endif /* ZEPHYR_INCLUDE_SHELL_MQTT_H_ */ diff --git a/include/zephyr/shell/shell_rpmsg.h b/include/zephyr/shell/shell_rpmsg.h index 7a79c74ce051d..726cab47d31aa 100644 --- a/include/zephyr/shell/shell_rpmsg.h +++ b/include/zephyr/shell/shell_rpmsg.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef SHELL_RPMSG_H__ -#define SHELL_RPMSG_H__ +#ifndef ZEPHYR_INCLUDE_SHELL_RPMSG_H_ +#define ZEPHYR_INCLUDE_SHELL_RPMSG_H_ #include #include @@ -84,4 +84,4 @@ const struct shell *shell_backend_rpmsg_get_ptr(void); } #endif -#endif /* SHELL_RPMSG_H__ */ +#endif /* ZEPHYR_INCLUDE_SHELL_RPMSG_H_ */ diff --git a/include/zephyr/shell/shell_rtt.h b/include/zephyr/shell/shell_rtt.h index ab1e60d922b3b..930e5fff830ce 100644 --- a/include/zephyr/shell/shell_rtt.h +++ b/include/zephyr/shell/shell_rtt.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef SHELL_RTT_H__ -#define SHELL_RTT_H__ +#ifndef ZEPHYR_INCLUDE_SHELL_RTT_H_ +#define ZEPHYR_INCLUDE_SHELL_RTT_H_ #include @@ -41,4 +41,4 @@ const struct shell *shell_backend_rtt_get_ptr(void); } #endif -#endif /* SHELL_RTT_H__ */ +#endif /* ZEPHYR_INCLUDE_SHELL_RTT_H_ */ diff --git a/include/zephyr/shell/shell_string_conv.h b/include/zephyr/shell/shell_string_conv.h index 3b07242607616..0fed0b2352d0e 100644 --- a/include/zephyr/shell/shell_string_conv.h +++ b/include/zephyr/shell/shell_string_conv.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef SHELL_STRING_CONV_H__ -#define SHELL_STRING_CONV_H__ +#ifndef ZEPHYR_INCLUDE_SHELL_STRING_CONV_H_ +#define ZEPHYR_INCLUDE_SHELL_STRING_CONV_H_ #include #include @@ -86,4 +86,4 @@ bool shell_strtobool(const char *str, int base, int *err); } #endif -#endif /* SHELL_STRING_CONV_H__ */ +#endif /* ZEPHYR_INCLUDE_SHELL_STRING_CONV_H_ */ diff --git a/include/zephyr/shell/shell_telnet.h b/include/zephyr/shell/shell_telnet.h index 6501a63fa1b3e..a3ed366e98621 100644 --- a/include/zephyr/shell/shell_telnet.h +++ b/include/zephyr/shell/shell_telnet.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef SHELL_TELNET_H__ -#define SHELL_TELNET_H__ +#ifndef ZEPHYR_INCLUDE_SHELL_TELNET_H_ +#define ZEPHYR_INCLUDE_SHELL_TELNET_H_ #include #include @@ -85,4 +85,4 @@ const struct shell *shell_backend_telnet_get_ptr(void); } #endif -#endif /* SHELL_TELNET_H__ */ +#endif /* ZEPHYR_INCLUDE_SHELL_TELNET_H_ */ diff --git a/include/zephyr/shell/shell_types.h b/include/zephyr/shell/shell_types.h index a45f0c1753ab4..609c450cc33fd 100644 --- a/include/zephyr/shell/shell_types.h +++ b/include/zephyr/shell/shell_types.h @@ -3,8 +3,8 @@ * * SPDX-License-Identifier: Apache-2.0 */ -#ifndef SHELL_TYPES_H__ -#define SHELL_TYPES_H__ +#ifndef ZEPHYR_INCLUDE_SHELL_TYPES_H_ +#define ZEPHYR_INCLUDE_SHELL_TYPES_H_ #ifdef __cplusplus @@ -51,4 +51,4 @@ struct shell_vt100_ctx { } #endif -#endif /* SHELL_TYPES_H__ */ +#endif /* ZEPHYR_INCLUDE_SHELL_TYPES_H_ */ diff --git a/include/zephyr/shell/shell_uart.h b/include/zephyr/shell/shell_uart.h index e424a1857680b..d1a8a4df97ffb 100644 --- a/include/zephyr/shell/shell_uart.h +++ b/include/zephyr/shell/shell_uart.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef SHELL_UART_H__ -#define SHELL_UART_H__ +#ifndef ZEPHYR_INCLUDE_SHELL_UART_H_ +#define ZEPHYR_INCLUDE_SHELL_UART_H_ #include #include @@ -115,4 +115,4 @@ struct smp_shell_data *shell_uart_smp_shell_data_get_ptr(void); } #endif -#endif /* SHELL_UART_H__ */ +#endif /* ZEPHYR_INCLUDE_SHELL_UART_H_ */ diff --git a/include/zephyr/shell/shell_websocket.h b/include/zephyr/shell/shell_websocket.h index 8eacd964dbf3b..12bd49727a249 100644 --- a/include/zephyr/shell/shell_websocket.h +++ b/include/zephyr/shell/shell_websocket.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef SHELL_WEBSOCKET_H__ -#define SHELL_WEBSOCKET_H__ +#ifndef ZEPHYR_INCLUDE_SHELL_WEBSOCKET_H_ +#define ZEPHYR_INCLUDE_SHELL_WEBSOCKET_H_ #include #include @@ -148,4 +148,4 @@ extern int shell_websocket_enable(const struct shell *sh); } #endif -#endif /* SHELL_WEBSOCKET_H__ */ +#endif /* ZEPHYR_INCLUDE_SHELL_WEBSOCKET_H_ */ diff --git a/include/zephyr/task_wdt/task_wdt.h b/include/zephyr/task_wdt/task_wdt.h index e14ef5814fec1..91cc979850571 100644 --- a/include/zephyr/task_wdt/task_wdt.h +++ b/include/zephyr/task_wdt/task_wdt.h @@ -14,8 +14,8 @@ * threads. It can be used together with a hardware watchdog as a fallback. */ -#ifndef TASK_WDT_H_ -#define TASK_WDT_H_ +#ifndef ZEPHYR_INCLUDE_TASK_WDT_H_ +#define ZEPHYR_INCLUDE_TASK_WDT_H_ #include #include @@ -110,4 +110,4 @@ int task_wdt_feed(int channel_id); * @} */ -#endif /* TASK_WDT_H_ */ +#endif /* ZEPHYR_INCLUDE_TASK_WDT_H_ */ From 9cce72daa192d954ce462c5680bd8b7e1ed0a780 Mon Sep 17 00:00:00 2001 From: Artur Wilczak Date: Tue, 29 Oct 2024 13:01:18 +0100 Subject: [PATCH 1957/4482] boards: Fix to accommodate for slowly tests on UP2 To accommodate for some slow tests on up2. For example: tests/arch/x86/info/arch.x86.info.userspace Execution time of this test is close to 55s and sometimes above up to the 60s. Related issue: #80134 Signed-off-by: Artur Wilczak --- boards/up-bridge-the-gap/up_squared/up_squared.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/up-bridge-the-gap/up_squared/up_squared.yaml b/boards/up-bridge-the-gap/up_squared/up_squared.yaml index 79e4d5e7e92a6..959feb7dfceae 100644 --- a/boards/up-bridge-the-gap/up_squared/up_squared.yaml +++ b/boards/up-bridge-the-gap/up_squared/up_squared.yaml @@ -9,6 +9,7 @@ supported: - acpi - smp testing: + timeout_multiplier: 2 ignore_tags: - net - bluetooth From 83345401d680c8fca6050d9dbbbe97771b825e1f Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Thu, 3 Oct 2024 19:26:45 +0200 Subject: [PATCH 1958/4482] samples: drivers: crypto: Improve memory alignment Commit e1e19732bcdd00b55c5a7987580011eae0b640ee (samples: drivers: crypto: Aligned AES key) introduced the alignment for the key. According to the commit message, the intention was to align the variable at 32 bit boundaries. For this reason, passing 32 to __aligned seems like an error, as its argument is denoted in byte and not bits. Signed-off-by: Reto Schneider --- samples/drivers/crypto/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/drivers/crypto/src/main.c b/samples/drivers/crypto/src/main.c index ef0d248c36567..ac031e88672a2 100644 --- a/samples/drivers/crypto/src/main.c +++ b/samples/drivers/crypto/src/main.c @@ -37,7 +37,7 @@ LOG_MODULE_REGISTER(main); #error "You need to enable one crypto device" #endif -const static uint8_t key[16] __aligned(32) = { +const static uint8_t key[16] __aligned(4) = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c }; From 09dc9dcb0d19a54b2e4d0cb1adea0442b7dd0c1c Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Mon, 16 Sep 2024 02:09:04 +0200 Subject: [PATCH 1959/4482] samples: drivers: crypto: Align buffers This change extends what e1e19732bcdd00b55c5a7987580011eae0b640ee (samples: drivers: crypto: Aligned AES key) has started: For certain architectures (i.e. Si32), the alignment of the used buffers is important as the AES HW engine uses DMA and inherits its restrictions. Signed-off-by: Reto Schneider --- samples/drivers/crypto/src/main.c | 35 +++++++++++++++++-------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/samples/drivers/crypto/src/main.c b/samples/drivers/crypto/src/main.c index ac031e88672a2..3aa9d5b3273f0 100644 --- a/samples/drivers/crypto/src/main.c +++ b/samples/drivers/crypto/src/main.c @@ -37,12 +37,15 @@ LOG_MODULE_REGISTER(main); #error "You need to enable one crypto device" #endif -const static uint8_t key[16] __aligned(4) = { +/* Some crypto drivers require IO buffers to be aligned, i.e. due to underlying DMA requirements. */ +#define IO_ALIGNMENT_BYTES 4 + +const static uint8_t key[16] __aligned(IO_ALIGNMENT_BYTES) = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c }; -static uint8_t plaintext[64] = { +static uint8_t plaintext[64] __aligned(IO_ALIGNMENT_BYTES) = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51, 0x30, 0xc8, 0x1c, 0x46, @@ -119,17 +122,17 @@ void ecb_mode(const struct device *dev) 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; - uint8_t ecb_plaintext[16] = { + uint8_t ecb_plaintext[16] __aligned(IO_ALIGNMENT_BYTES) = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF }; - uint8_t ecb_ciphertext[16] = { + uint8_t ecb_ciphertext[16] __aligned(IO_ALIGNMENT_BYTES) = { 0x69, 0xC4, 0xE0, 0xD8, 0x6A, 0x7B, 0x04, 0x30, 0xD8, 0xCD, 0xB7, 0x80, 0x70, 0xB4, 0xC5, 0x5A }; - uint8_t encrypted[16] = {0}; - uint8_t decrypted[16] = {0}; + uint8_t encrypted[16] __aligned(IO_ALIGNMENT_BYTES) = {0}; + uint8_t decrypted[16] __aligned(IO_ALIGNMENT_BYTES) = {0}; struct cipher_ctx ini = { .keylen = sizeof(ecb_key), .key.bit_stream = ecb_key, @@ -210,8 +213,8 @@ static const uint8_t cbc_ciphertext[80] = { void cbc_mode(const struct device *dev) { - uint8_t encrypted[80] = {0}; - uint8_t decrypted[64] = {0}; + uint8_t encrypted[80] __aligned(IO_ALIGNMENT_BYTES) = {0}; + uint8_t decrypted[64] __aligned(IO_ALIGNMENT_BYTES) = {0}; struct cipher_ctx ini = { .keylen = sizeof(key), .key.bit_stream = key, @@ -299,8 +302,8 @@ static const uint8_t ctr_ciphertext[64] = { void ctr_mode(const struct device *dev) { - uint8_t encrypted[64] = {0}; - uint8_t decrypted[64] = {0}; + uint8_t encrypted[64] __aligned(IO_ALIGNMENT_BYTES) = {0}; + uint8_t decrypted[64] __aligned(IO_ALIGNMENT_BYTES) = {0}; struct cipher_ctx ini = { .keylen = sizeof(key), .key.bit_stream = key, @@ -387,7 +390,7 @@ static uint8_t ccm_nonce[13] = { static uint8_t ccm_hdr[8] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 }; -static uint8_t ccm_data[23] = { +static uint8_t ccm_data[23] __aligned(IO_ALIGNMENT_BYTES) = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e }; @@ -399,8 +402,8 @@ static const uint8_t ccm_expected[31] = { void ccm_mode(const struct device *dev) { - uint8_t encrypted[50]; - uint8_t decrypted[25]; + uint8_t encrypted[50] __aligned(IO_ALIGNMENT_BYTES); + uint8_t decrypted[25] __aligned(IO_ALIGNMENT_BYTES); struct cipher_ctx ini = { .keylen = sizeof(ccm_key), .key.bit_stream = ccm_key, @@ -499,7 +502,7 @@ static uint8_t gcm_hdr[20] = { 0xe2, 0x01, 0x06, 0xd7, 0xcd, 0x0d, 0xf0, 0x76, 0x1e, 0x8d, 0xcd, 0x3d, 0x88, 0xe5, 0x4c, 0x2a, 0x76, 0xd4, 0x57, 0xed }; -static uint8_t gcm_data[42] = { +static uint8_t gcm_data[42] __aligned(IO_ALIGNMENT_BYTES) = { 0x08, 0x00, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, @@ -516,8 +519,8 @@ static const uint8_t gcm_expected[58] = { void gcm_mode(const struct device *dev) { - uint8_t encrypted[60] = {0}; - uint8_t decrypted[44] = {0}; + uint8_t encrypted[60] __aligned(IO_ALIGNMENT_BYTES) = {0}; + uint8_t decrypted[44] __aligned(IO_ALIGNMENT_BYTES) = {0}; struct cipher_ctx ini = { .keylen = sizeof(gcm_key), .key.bit_stream = gcm_key, From 0cf71d96241672b74c962a742fe073865ab54372 Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Tue, 8 Oct 2024 08:29:08 +0200 Subject: [PATCH 1960/4482] samples: drivers: crypto: Make clang-format happy Without this, check_compliance.py suggests to run clang-format on the changed code lines. Signed-off-by: Reto Schneider --- samples/drivers/crypto/src/main.c | 64 +++++++++++++------------------ 1 file changed, 26 insertions(+), 38 deletions(-) diff --git a/samples/drivers/crypto/src/main.c b/samples/drivers/crypto/src/main.c index 3aa9d5b3273f0..d4609fc2d10c0 100644 --- a/samples/drivers/crypto/src/main.c +++ b/samples/drivers/crypto/src/main.c @@ -40,19 +40,16 @@ LOG_MODULE_REGISTER(main); /* Some crypto drivers require IO buffers to be aligned, i.e. due to underlying DMA requirements. */ #define IO_ALIGNMENT_BYTES 4 -const static uint8_t key[16] __aligned(IO_ALIGNMENT_BYTES) = { - 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, - 0x09, 0xcf, 0x4f, 0x3c -}; +const static uint8_t key[16] + __aligned(IO_ALIGNMENT_BYTES) = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, + 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}; static uint8_t plaintext[64] __aligned(IO_ALIGNMENT_BYTES) = { - 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, - 0x73, 0x93, 0x17, 0x2a, 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, - 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51, 0x30, 0xc8, 0x1c, 0x46, - 0xa3, 0x5c, 0xe4, 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef, - 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, - 0xe6, 0x6c, 0x37, 0x10 -}; + 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, + 0x93, 0x17, 0x2a, 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, 0x9e, 0xb7, + 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51, 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, + 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef, 0xf6, 0x9f, 0x24, 0x45, + 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10}; uint32_t cap_flags; @@ -122,14 +119,12 @@ void ecb_mode(const struct device *dev) 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; - uint8_t ecb_plaintext[16] __aligned(IO_ALIGNMENT_BYTES) = { - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF - }; - uint8_t ecb_ciphertext[16] __aligned(IO_ALIGNMENT_BYTES) = { - 0x69, 0xC4, 0xE0, 0xD8, 0x6A, 0x7B, 0x04, 0x30, - 0xD8, 0xCD, 0xB7, 0x80, 0x70, 0xB4, 0xC5, 0x5A - }; + uint8_t ecb_plaintext[16] + __aligned(IO_ALIGNMENT_BYTES) = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF}; + uint8_t ecb_ciphertext[16] + __aligned(IO_ALIGNMENT_BYTES) = {0x69, 0xC4, 0xE0, 0xD8, 0x6A, 0x7B, 0x04, 0x30, + 0xD8, 0xCD, 0xB7, 0x80, 0x70, 0xB4, 0xC5, 0x5A}; uint8_t encrypted[16] __aligned(IO_ALIGNMENT_BYTES) = {0}; uint8_t decrypted[16] __aligned(IO_ALIGNMENT_BYTES) = {0}; @@ -392,13 +387,11 @@ static uint8_t ccm_hdr[8] = { }; static uint8_t ccm_data[23] __aligned(IO_ALIGNMENT_BYTES) = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, - 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e -}; -static const uint8_t ccm_expected[31] = { - 0x58, 0x8c, 0x97, 0x9a, 0x61, 0xc6, 0x63, 0xd2, 0xf0, 0x66, 0xd0, 0xc2, - 0xc0, 0xf9, 0x89, 0x80, 0x6d, 0x5f, 0x6b, 0x61, 0xda, 0xc3, 0x84, 0x17, - 0xe8, 0xd1, 0x2c, 0xfd, 0xf9, 0x26, 0xe0 -}; + 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e}; +static const uint8_t ccm_expected[31] = {0x58, 0x8c, 0x97, 0x9a, 0x61, 0xc6, 0x63, 0xd2, + 0xf0, 0x66, 0xd0, 0xc2, 0xc0, 0xf9, 0x89, 0x80, + 0x6d, 0x5f, 0x6b, 0x61, 0xda, 0xc3, 0x84, 0x17, + 0xe8, 0xd1, 0x2c, 0xfd, 0xf9, 0x26, 0xe0}; void ccm_mode(const struct device *dev) { @@ -503,19 +496,14 @@ static uint8_t gcm_hdr[20] = { 0x88, 0xe5, 0x4c, 0x2a, 0x76, 0xd4, 0x57, 0xed }; static uint8_t gcm_data[42] __aligned(IO_ALIGNMENT_BYTES) = { - 0x08, 0x00, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, - 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, - 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, - 0x31, 0x32, 0x33, 0x34, 0x00, 0x04 -}; + 0x08, 0x00, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, + 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, + 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x00, 0x04}; static const uint8_t gcm_expected[58] = { - 0x13, 0xb4, 0xc7, 0x2b, 0x38, 0x9d, 0xc5, 0x01, 0x8e, 0x72, 0xa1, 0x71, - 0xdd, 0x85, 0xa5, 0xd3, 0x75, 0x22, 0x74, 0xd3, 0xa0, 0x19, 0xfb, 0xca, - 0xed, 0x09, 0xa4, 0x25, 0xcd, 0x9b, 0x2e, 0x1c, 0x9b, 0x72, 0xee, 0xe7, - 0xc9, 0xde, 0x7d, 0x52, 0xb3, 0xf3, - 0xd6, 0xa5, 0x28, 0x4f, 0x4a, 0x6d, 0x3f, 0xe2, 0x2a, 0x5d, 0x6c, 0x2b, - 0x96, 0x04, 0x94, 0xc3 -}; + 0x13, 0xb4, 0xc7, 0x2b, 0x38, 0x9d, 0xc5, 0x01, 0x8e, 0x72, 0xa1, 0x71, 0xdd, 0x85, 0xa5, + 0xd3, 0x75, 0x22, 0x74, 0xd3, 0xa0, 0x19, 0xfb, 0xca, 0xed, 0x09, 0xa4, 0x25, 0xcd, 0x9b, + 0x2e, 0x1c, 0x9b, 0x72, 0xee, 0xe7, 0xc9, 0xde, 0x7d, 0x52, 0xb3, 0xf3, 0xd6, 0xa5, 0x28, + 0x4f, 0x4a, 0x6d, 0x3f, 0xe2, 0x2a, 0x5d, 0x6c, 0x2b, 0x96, 0x04, 0x94, 0xc3}; void gcm_mode(const struct device *dev) { From 27aeabb5b25546d5024723927a2e2276875b1b08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Thu, 24 Oct 2024 13:40:56 +0200 Subject: [PATCH 1961/4482] drivers: flash: spi_nor: fix config struct MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lots of values from the DT where not set corretly, if `CONFIG_SPI_NOR_SFDP_RUNTIME` was enabled. This fixes it. Signed-off-by: Fin Maaß --- drivers/flash/spi_nor.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/drivers/flash/spi_nor.c b/drivers/flash/spi_nor.c index 236955887ab1f..dc53e7eeebd0e 100644 --- a/drivers/flash/spi_nor.c +++ b/drivers/flash/spi_nor.c @@ -1695,30 +1695,33 @@ static const struct flash_driver_api spi_nor_api = { DEFINE_PAGE_LAYOUT(idx) \ .flash_size = DT_INST_PROP(idx, size) / 8, \ .jedec_id = DT_INST_PROP(idx, jedec_id), \ - .dpd_exist = DT_INST_PROP(idx, has_dpd), \ - .dpd_wakeup_sequence_exist = DT_INST_NODE_HAS_PROP(idx, dpd_wakeup_sequence), \ - .mxicy_mx25r_power_mode_exist = DT_INST_NODE_HAS_PROP(idx, mxicy_mx25r_power_mode), \ - .reset_gpios_exist = DT_INST_NODE_HAS_PROP(idx, reset_gpios), \ - .requires_ulbpr_exist = DT_INST_PROP(idx, requires_ulbpr), \ - .wp_gpios_exist = DT_INST_NODE_HAS_PROP(idx, wp_gpios), \ - .hold_gpios_exist = DT_INST_NODE_HAS_PROP(idx, hold_gpios), \ - IF_ENABLED(INST_HAS_LOCK(idx), (.has_lock = DT_INST_PROP(idx, has_lock),)) \ IF_ENABLED(CONFIG_SPI_NOR_SFDP_MINIMAL, (CONFIGURE_4BYTE_ADDR(idx))) \ IF_ENABLED(CONFIG_SPI_NOR_SFDP_DEVICETREE, \ (.bfp_len = sizeof(bfp_##idx##_data) / 4, \ - .bfp = (const struct jesd216_bfp *)bfp_##idx##_data,)) \ - IF_ENABLED(ANY_INST_HAS_DPD, (INIT_T_ENTER_DPD(idx),)) \ - IF_ENABLED(UTIL_AND(ANY_INST_HAS_DPD, ANY_INST_HAS_T_EXIT_DPD), (INIT_T_EXIT_DPD(idx),))\ - IF_ENABLED(ANY_INST_HAS_DPD_WAKEUP_SEQUENCE, (INIT_WAKEUP_SEQ_PARAMS(idx),)) \ - IF_ENABLED(ANY_INST_HAS_MXICY_MX25R_POWER_MODE, (INIT_MXICY_MX25R_POWER_MODE(idx),)) \ - IF_ENABLED(ANY_INST_HAS_RESET_GPIOS, (INIT_RESET_GPIOS(idx),)) \ - IF_ENABLED(ANY_INST_HAS_WP_GPIOS, (INIT_WP_GPIOS(idx),)) \ - IF_ENABLED(ANY_INST_HAS_HOLD_GPIOS, (INIT_HOLD_GPIOS(idx),)) + .bfp = (const struct jesd216_bfp *)bfp_##idx##_data,)) #define GENERATE_CONFIG_STRUCT(idx) \ static const struct spi_nor_config spi_nor_##idx##_config = { \ .spi = SPI_DT_SPEC_INST_GET(idx, SPI_WORD_SET(8), CONFIG_SPI_NOR_CS_WAIT_DELAY),\ - COND_CODE_1(CONFIG_SPI_NOR_SFDP_RUNTIME, EMPTY(), (INST_CONFIG_STRUCT_GEN(idx)))}; + .dpd_exist = DT_INST_PROP(idx, has_dpd), \ + .dpd_wakeup_sequence_exist = DT_INST_NODE_HAS_PROP(idx, dpd_wakeup_sequence), \ + .mxicy_mx25r_power_mode_exist = \ + DT_INST_NODE_HAS_PROP(idx, mxicy_mx25r_power_mode), \ + .reset_gpios_exist = DT_INST_NODE_HAS_PROP(idx, reset_gpios), \ + .requires_ulbpr_exist = DT_INST_PROP(idx, requires_ulbpr), \ + .wp_gpios_exist = DT_INST_NODE_HAS_PROP(idx, wp_gpios), \ + .hold_gpios_exist = DT_INST_NODE_HAS_PROP(idx, hold_gpios), \ + IF_ENABLED(INST_HAS_LOCK(idx), (.has_lock = DT_INST_PROP(idx, has_lock),)) \ + IF_ENABLED(ANY_INST_HAS_DPD, (INIT_T_ENTER_DPD(idx),)) \ + IF_ENABLED(UTIL_AND(ANY_INST_HAS_DPD, ANY_INST_HAS_T_EXIT_DPD), \ + (INIT_T_EXIT_DPD(idx),)) \ + IF_ENABLED(ANY_INST_HAS_DPD_WAKEUP_SEQUENCE, (INIT_WAKEUP_SEQ_PARAMS(idx),)) \ + IF_ENABLED(ANY_INST_HAS_MXICY_MX25R_POWER_MODE, \ + (INIT_MXICY_MX25R_POWER_MODE(idx),)) \ + IF_ENABLED(ANY_INST_HAS_RESET_GPIOS, (INIT_RESET_GPIOS(idx),)) \ + IF_ENABLED(ANY_INST_HAS_WP_GPIOS, (INIT_WP_GPIOS(idx),)) \ + IF_ENABLED(ANY_INST_HAS_HOLD_GPIOS, (INIT_HOLD_GPIOS(idx),)) \ + IF_DISABLED(CONFIG_SPI_NOR_SFDP_RUNTIME, (INST_CONFIG_STRUCT_GEN(idx)))}; #define ASSIGN_PM(idx) \ PM_DEVICE_DT_INST_DEFINE(idx, spi_nor_pm_control); From 83c3b1c708db1b6ff40bebec00d1d66c8282528e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Thu, 24 Oct 2024 13:55:21 +0200 Subject: [PATCH 1962/4482] drivers: flash: spi_nor: simplify defines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit simplify defines by using `DT_INST_**_OR` macros. Signed-off-by: Fin Maaß --- drivers/flash/spi_nor.c | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/drivers/flash/spi_nor.c b/drivers/flash/spi_nor.c index dc53e7eeebd0e..9f849a4780bd2 100644 --- a/drivers/flash/spi_nor.c +++ b/drivers/flash/spi_nor.c @@ -1632,20 +1632,12 @@ static const struct flash_driver_api spi_nor_api = { #define INST_HAS_LOCK(idx) DT_INST_NODE_HAS_PROP(idx, has_lock) -#define INST_HAS_WP_GPIO(idx) DT_INST_NODE_HAS_PROP(idx, wp_gpios) - -#define INST_HAS_HOLD_GPIO(idx) DT_INST_NODE_HAS_PROP(idx, hold_gpios) - #define LOCK_DEFINE(idx) \ IF_ENABLED(INST_HAS_LOCK(idx), (BUILD_ASSERT(DT_INST_PROP(idx, has_lock) == \ (DT_INST_PROP(idx, has_lock) & 0xFF), \ "Need support for lock clear beyond SR1");)) -#define INST_HAS_ENTER_4BYTE_ADDR(idx) DT_INST_NODE_HAS_PROP(idx, enter_4byte_addr) - -#define CONFIGURE_4BYTE_ADDR(idx) \ - IF_ENABLED(INST_HAS_ENTER_4BYTE_ADDR(idx), \ - (.enter_4byte_addr = DT_INST_PROP(idx, enter_4byte_addr),)) +#define CONFIGURE_4BYTE_ADDR(idx) .enter_4byte_addr = DT_INST_PROP_OR(idx, enter_4byte_addr, 0), #define INIT_T_ENTER_DPD(idx) \ COND_CODE_1(DT_INST_NODE_HAS_PROP(idx, t_enter_dpd), \ @@ -1661,15 +1653,9 @@ static const struct flash_driver_api spi_nor_api = { (.t_exit_dpd = 0)) #endif -#define INIT_WP_GPIOS(idx) \ - COND_CODE_1(DT_INST_NODE_HAS_PROP(idx, wp_gpios), \ - (.wp = GPIO_DT_SPEC_INST_GET(idx, wp_gpios)), \ - (.wp = {0})) +#define INIT_WP_GPIOS(idx) .wp = GPIO_DT_SPEC_INST_GET_OR(idx, wp_gpios, {0}) -#define INIT_HOLD_GPIOS(idx) \ - COND_CODE_1(DT_INST_NODE_HAS_PROP(idx, hold_gpios), \ - (.hold = GPIO_DT_SPEC_INST_GET(idx, hold_gpios)), \ - (.hold = {0},)) +#define INIT_HOLD_GPIOS(idx) .hold = GPIO_DT_SPEC_INST_GET_OR(idx, hold_gpios, {0}) #define INIT_WAKEUP_SEQ_PARAMS(idx) \ COND_CODE_1(DT_INST_NODE_HAS_PROP(idx, dpd_wakeup_sequence), \ @@ -1681,15 +1667,10 @@ static const struct flash_driver_api spi_nor_api = { DT_INST_PROP_BY_IDX(idx, dpd_wakeup_sequence, 2), NSEC_PER_MSEC)),\ (.t_dpdd_ms = 0, .t_crdp_ms = 0, .t_rdp_ms = 0)) -#define INIT_MXICY_MX25R_POWER_MODE(idx) \ - COND_CODE_1(DT_INST_NODE_HAS_PROP(idx, mxicy_mx25r_power_mode), \ - (.mxicy_mx25r_power_mode = DT_INST_ENUM_IDX(idx, mxicy_mx25r_power_mode)),\ - (.mxicy_mx25r_power_mode = 0)) +#define INIT_MXICY_MX25R_POWER_MODE(idx) \ + .mxicy_mx25r_power_mode = DT_INST_ENUM_IDX_OR(idx, mxicy_mx25r_power_mode, 0) -#define INIT_RESET_GPIOS(idx) \ - COND_CODE_1(DT_INST_NODE_HAS_PROP(idx, reset_gpios), \ - (.reset = GPIO_DT_SPEC_INST_GET(idx, reset_gpios)), \ - (.reset = {0})) +#define INIT_RESET_GPIOS(idx) .reset = GPIO_DT_SPEC_INST_GET_OR(idx, reset_gpios, {0}) #define INST_CONFIG_STRUCT_GEN(idx) \ DEFINE_PAGE_LAYOUT(idx) \ From 92985011b6f41f1c2774e9f6813307b80bca5c59 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 28 Oct 2024 21:22:40 +0530 Subject: [PATCH 1963/4482] drivers: nrfwifi: Fix memory leak in TX path During secure association, if we get any data packets from the networking stack (as we switch off the dormancy) then they will be dropped till the 802.1x port is authorized, but with recent changes the corresponding network buffer isn't freed causing a memory leak. Handle this case and free the network buffer (Using an OSAL API though it's Zephyr to avoid duplication and also getting access to "struct nwb"); Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/src/net_if.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/wifi/nrfwifi/src/net_if.c b/drivers/wifi/nrfwifi/src/net_if.c index b8ca8915ff4c9..a4404cfb1a7a1 100644 --- a/drivers/wifi/nrfwifi/src/net_if.c +++ b/drivers/wifi/nrfwifi/src/net_if.c @@ -389,7 +389,7 @@ int nrf_wifi_if_send(const struct device *dev, #ifdef CONFIG_NRF70_RAW_DATA_TX if ((*(unsigned int *)pkt->frags->data) == NRF_WIFI_MAGIC_NUM_RAWTX) { if (vif_ctx_zep->if_carr_state != NRF_WIFI_FMAC_IF_CARR_STATE_ON) { - goto unlock; + goto drop; } ret = nrf_wifi_fmac_start_rawpkt_xmit(rpu_ctx_zep->rpu_ctx, @@ -399,7 +399,7 @@ int nrf_wifi_if_send(const struct device *dev, #endif /* CONFIG_NRF70_RAW_DATA_TX */ if ((vif_ctx_zep->if_carr_state != NRF_WIFI_FMAC_IF_CARR_STATE_ON) || (!vif_ctx_zep->authorized && !is_eapol(pkt))) { - goto unlock; + goto drop; } ret = nrf_wifi_fmac_start_xmit(rpu_ctx_zep->rpu_ctx, @@ -408,6 +408,10 @@ int nrf_wifi_if_send(const struct device *dev, #ifdef CONFIG_NRF70_RAW_DATA_TX } #endif /* CONFIG_NRF70_RAW_DATA_TX */ + goto unlock; +drop: + host_stats->total_tx_drop_pkts++; + nrf_wifi_osal_nbuf_free(nbuf); unlock: k_mutex_unlock(&vif_ctx_zep->vif_lock); #else From 14d0a19cc2378c24369ef2e11fe0e3a3e53fd676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 28 Oct 2024 16:56:08 +0100 Subject: [PATCH 1964/4482] doc: fix occurrences of broken zephyr_file: links MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In preparation of adding a check for dead references, this commit fixes currently broken zehpyr_file: links. Signed-off-by: Benjamin Cabé --- boards/cypress/cy8ckit_062_wifi_bt/doc/index.rst | 2 +- boards/native/nrf_bsim/doc/nrf5340bsim.rst | 2 +- boards/nordic/nrf51dk/doc/index.rst | 2 +- boards/others/stm32f103_mini/doc/index.rst | 2 +- boards/rakwireless/rak4631/doc/index.rst | 2 +- boards/silabs/radio_boards/slwrb4255a/doc/index.rst | 2 +- boards/silabs/radio_boards/slwrb4321a/doc/index.rst | 2 +- .../starter_kits/efm32wg_stk3800/doc/index.rst | 2 +- boards/silabs/starter_kits/slstk3400a/doc/index.rst | 2 +- boards/snps/em_starterkit/doc/index.rst | 2 +- boards/snps/nsim/arc_classic/doc/index.rst | 12 ++++++------ boards/snps/nsim/arc_v/doc/index.rst | 4 ++-- .../sparkfun/thing_plus_matter_mgm240p/doc/index.rst | 2 +- doc/hardware/porting/shields.rst | 2 +- doc/services/logging/cs_stm.rst | 2 +- samples/bluetooth/hci_spi/README.rst | 6 +++--- samples/bluetooth/hci_uart/README.rst | 2 +- samples/bluetooth/hci_uart_3wire/README.rst | 2 +- .../boards/96boards/argonkey/microphone/README.rst | 4 ++-- samples/boards/96boards/argonkey/sensors/README.rst | 2 +- samples/boards/nxp/s32/netc/README.rst | 2 +- samples/drivers/led/led_strip/README.rst | 2 +- .../shields/x_nucleo_iks02a1/sensorhub/README.rst | 1 - samples/sysbuild/hello_world/README.rst | 2 +- 24 files changed, 32 insertions(+), 33 deletions(-) diff --git a/boards/cypress/cy8ckit_062_wifi_bt/doc/index.rst b/boards/cypress/cy8ckit_062_wifi_bt/doc/index.rst index 515eb920c55c0..b11164e467d72 100644 --- a/boards/cypress/cy8ckit_062_wifi_bt/doc/index.rst +++ b/boards/cypress/cy8ckit_062_wifi_bt/doc/index.rst @@ -146,7 +146,7 @@ CM4 core working FW for both cores should be written into Flash. CM0+ FW should starts the CM4 core at one point using Cy_SysEnableCM4(CM4_START_ADDRESS); call. CM4_START_ADDRESS is 0x10060000 in the current configuration. The CM0+/CM4 Flash/SRAM areas are defined in -:zephyr_file:`dts/arm/cypress/psoc6.dtsi`. +:zephyr_file:`dts/arm/infineon/cat1a/legacy/psoc6.dtsi`. Build the project for CM0+ diff --git a/boards/native/nrf_bsim/doc/nrf5340bsim.rst b/boards/native/nrf_bsim/doc/nrf5340bsim.rst index 271e0db1bc171..7f43dc9093ca3 100644 --- a/boards/native/nrf_bsim/doc/nrf5340bsim.rst +++ b/boards/native/nrf_bsim/doc/nrf5340bsim.rst @@ -97,7 +97,7 @@ you can provide that image to the Zephyr build of the second image using You can also use :ref:`System build (sysbuild) ` to build your dual MCU executable. The best way to understand how, may be to look into how this is done in one of the examples in the tree. For example, for :ref:`the nrf53_sync_rtc sample `, -:zephyr_file:`samples/boards/nrf/nrf53_sync_rtc/sysbuild.cmake`. +:zephyr_file:`samples/boards/nordic/nrf53_sync_rtc/sysbuild.cmake`. .. note:: diff --git a/boards/nordic/nrf51dk/doc/index.rst b/boards/nordic/nrf51dk/doc/index.rst index f5a2acbbcde51..8cae453e2ed6f 100644 --- a/boards/nordic/nrf51dk/doc/index.rst +++ b/boards/nordic/nrf51dk/doc/index.rst @@ -1,4 +1,4 @@ -.. _nrf51dk_nrf51422: +.. _nrf51dk_nrf51822: nRF51 DK ######## diff --git a/boards/others/stm32f103_mini/doc/index.rst b/boards/others/stm32f103_mini/doc/index.rst index c19ded8a82f11..0377a9b5952ff 100644 --- a/boards/others/stm32f103_mini/doc/index.rst +++ b/boards/others/stm32f103_mini/doc/index.rst @@ -76,7 +76,7 @@ The Zephyr stm32f103_mini board configuration supports the following hardware fe Other hardware features are not yet supported in this Zephyr port. The default configuration can be found in -:zephyr_file:`boards/st/stm32f103_mini/stm32f103_mini_defconfig` +:zephyr_file:`boards/others/stm32f103_mini/stm32f103_mini_defconfig` Connections and IOs =================== diff --git a/boards/rakwireless/rak4631/doc/index.rst b/boards/rakwireless/rak4631/doc/index.rst index 49055f67bf51b..5d237f7bf71e8 100644 --- a/boards/rakwireless/rak4631/doc/index.rst +++ b/boards/rakwireless/rak4631/doc/index.rst @@ -71,7 +71,7 @@ The ``rak4631/nrf52840`` board configuration supports the following hardware fea +-----------+------------+----------------------+ The default board configuration can be found in -:zephyr_file:`boards/rak/rak4631/rak4631_nrf52840_defconfig` +:zephyr_file:`boards/rakwireless/rak4631/rak4631_nrf52840_defconfig` Connections and IOs =================== diff --git a/boards/silabs/radio_boards/slwrb4255a/doc/index.rst b/boards/silabs/radio_boards/slwrb4255a/doc/index.rst index 50506431cf462..47cb5a15fbbd9 100644 --- a/boards/silabs/radio_boards/slwrb4255a/doc/index.rst +++ b/boards/silabs/radio_boards/slwrb4255a/doc/index.rst @@ -58,7 +58,7 @@ The board configuration supports the following hardware features: +-----------+------------+-------------------------------------+ The default configuration can be found in -:zephyr_file:`boards/silabs/radio_boards/slwrb4255/slwrb4255_defconfig` +:zephyr_file:`boards/silabs/radio_boards/slwrb4255a/slwrb4255a_defconfig` Connections and IOs =================== diff --git a/boards/silabs/radio_boards/slwrb4321a/doc/index.rst b/boards/silabs/radio_boards/slwrb4321a/doc/index.rst index aa64ddc71d11c..85237f7286ad0 100644 --- a/boards/silabs/radio_boards/slwrb4321a/doc/index.rst +++ b/boards/silabs/radio_boards/slwrb4321a/doc/index.rst @@ -60,7 +60,7 @@ features: +-----------+------------+-------------------------------------+ The default configuration can be found in -:zephyr_file:`boards/silabs/slwrb4321a/slwrb4321a_defconfig` +:zephyr_file:`boards/silabs/radio_boards/slwrb4321a/slwrb4321a_defconfig` Other hardware features, including the WF200 WiFi transceiver, are currently not supported by the port. diff --git a/boards/silabs/starter_kits/efm32wg_stk3800/doc/index.rst b/boards/silabs/starter_kits/efm32wg_stk3800/doc/index.rst index 107bab8a518c2..d78df5eaaf1c0 100644 --- a/boards/silabs/starter_kits/efm32wg_stk3800/doc/index.rst +++ b/boards/silabs/starter_kits/efm32wg_stk3800/doc/index.rst @@ -50,7 +50,7 @@ The efm32wg_stk3800 board configuration supports the following hardware features +-----------+------------+-------------------------------------+ The default configuration can be found in -:zephyr_file:`boards/silabs/starter_kit/efm32wg_stk3800/efm32wg_stk3800_defconfig` +:zephyr_file:`boards/silabs/starter_kits/efm32wg_stk3800/efm32wg_stk3800_defconfig` Other hardware features are currently not supported by the port. diff --git a/boards/silabs/starter_kits/slstk3400a/doc/index.rst b/boards/silabs/starter_kits/slstk3400a/doc/index.rst index fdfa5a4aab2f6..f3e3f6314c564 100644 --- a/boards/silabs/starter_kits/slstk3400a/doc/index.rst +++ b/boards/silabs/starter_kits/slstk3400a/doc/index.rst @@ -51,7 +51,7 @@ The efm32hg_slstk3400 board configuration supports the following hardware featur +-----------+------------+-------------------------------------+ The default configuration can be found in -:zephyr_file:`boards/silabs/starter_kit/slstk3400a/slstk3400a_defconfig` +:zephyr_file:`boards/silabs/starter_kits/slstk3400a/slstk3400a_defconfig` Other hardware features are currently not supported by the port. diff --git a/boards/snps/em_starterkit/doc/index.rst b/boards/snps/em_starterkit/doc/index.rst index 28434f1d71192..9fc53692b66fd 100644 --- a/boards/snps/em_starterkit/doc/index.rst +++ b/boards/snps/em_starterkit/doc/index.rst @@ -19,7 +19,7 @@ See also this URL for details about the board: The latest version of EM Starter Kit is 2.3, developer can upgrade from 2.0/2.1/2.2 to 2.3 using latest firmware. The default configuration for EM Starter Kit boards can be found in -:zephyr_file:`boards/snps/em_starterkit/em_starterkit_defconfig`. +:zephyr_file:`boards/snps/em_starterkit/`. The default SoC for this board supported in Zephyr is the EM9D. This configuration is a Harvard Architecture, with a separate diff --git a/boards/snps/nsim/arc_classic/doc/index.rst b/boards/snps/nsim/arc_classic/doc/index.rst index 940d08f1b6378..c3839dfc893cd 100644 --- a/boards/snps/nsim/arc_classic/doc/index.rst +++ b/boards/snps/nsim/arc_classic/doc/index.rst @@ -36,7 +36,7 @@ available configurations are listed below: .. _board_arc_nsim_prop_args_files: It is recommended to look at precise description of a particular sub-configuration in either -``.props`` or ``.args`` files in :zephyr_file:`boards/snps/nsim/support/` directory to understand +``.props`` or ``.args`` files in :zephyr_file:`boards/snps/nsim/arc_classic/support/` directory to understand which options are configured and so will be used on invocation of the simulator. In case of single-core configurations it would be ``.props`` file which contains configuration @@ -52,14 +52,14 @@ simulation anyway). nSIM & MDB don't exactly match, so care should be taken). I.e. for the single-core ``nsim/nsim_hs5x`` platform there are -:zephyr_file:`boards/snps/nsim/support/nsim_hs5x.props` and -:zephyr_file:`boards/snps/nsim/support/mdb_hs5x.args`. +:zephyr_file:`boards/snps/nsim/arc_classic/support/nsim_hs5x.props` and +:zephyr_file:`boards/snps/nsim/arc_classic/support/mdb_hs5x.args`. For the multi-core configurations there is only ``.args`` file as the multi-core configuration can only be instantiated with help of MDB. I.e. for the multi-core ``nsim/nsim_hs5x/smp`` platform there is only -:zephyr_file:`boards/snps/nsim/support/mdb_hs5x_smp.args`. +:zephyr_file:`boards/snps/nsim/arc_classic/support/mdb_hs5x_smp.args`. .. warning:: All nSIM/MDB configurations are used for demo and testing purposes. They are not meant to @@ -87,7 +87,7 @@ Most board sub-configurations support building with both GNU and ARC MWDT toolch there might be exceptions from that, especially for newly added targets. You can check supported toolchains for the sub-configurations in the corresponding ``.yaml`` file. -I.e. for the ``nsim/nsim_hs5x`` board we can check :zephyr_file:`boards/snps/nsim/nsim_nsim_hs5x.yaml` +I.e. for the ``nsim/nsim_hs5x`` board we can check :zephyr_file:`boards/snps/nsim/arc_classic/nsim_nsim_hs5x.yaml` The supported toolchains are listed in ``toolchain:`` array in ``.yaml`` file, where we can find: @@ -313,7 +313,7 @@ GNU & MWDT toolchain compiler options ===================================== The hardware-specific compiler options are set in corresponding SoC cmake file. For ``nsim`` board -it is :zephyr_file:`soc/snps/nsim/CMakeLists.txt`. +it is :zephyr_file:`soc/snps/nsim/arc_classic/CMakeLists.txt`. For the GNU toolchain the basic configuration is set via ``-mcpu`` which is defined in generic code and based on the selected CPU model via Kconfig. It still can be forcefully set to required value diff --git a/boards/snps/nsim/arc_v/doc/index.rst b/boards/snps/nsim/arc_v/doc/index.rst index e7b1a48f1bbe8..a0bc41c2be784 100644 --- a/boards/snps/nsim/arc_v/doc/index.rst +++ b/boards/snps/nsim/arc_v/doc/index.rst @@ -17,7 +17,7 @@ Supported board targets for that platform are listed below: .. _board_nsim_arc_v_prop_files: It is recommended to look at precise description of a particular board target in ``.props`` -files in :zephyr_file:`boards/snps/nsim_arc_v/support/` directory to understand +files in :zephyr_file:`boards/snps/nsim/arc_v/support/` directory to understand which options are configured and so will be used on invocation of the simulator. .. warning:: @@ -40,7 +40,7 @@ Most board targets support building with both GNU and ARC MWDT toolchains, howev there might be exceptions from that, especially for newly added targets. You can check supported toolchains for the board targets in the corresponding ``.yaml`` file. -I.e. for the ``nsim_arc_v/rmx100`` board we can check :zephyr_file:`boards/snps/nsim_arc_v/nsim_arc_v_rmx100.yaml` +I.e. for the ``nsim_arc_v/rmx100`` board we can check :zephyr_file:`boards/snps/nsim/arc_v/nsim_arc_v_rmx100.yaml` The supported toolchains are listed in ``toolchain:`` array in ``.yaml`` file, where we can find: diff --git a/boards/sparkfun/thing_plus_matter_mgm240p/doc/index.rst b/boards/sparkfun/thing_plus_matter_mgm240p/doc/index.rst index 4280345d8a2db..2a3961884bf6b 100644 --- a/boards/sparkfun/thing_plus_matter_mgm240p/doc/index.rst +++ b/boards/sparkfun/thing_plus_matter_mgm240p/doc/index.rst @@ -81,7 +81,7 @@ means Pin number 2 on PORTA, as used in the board's datasheets and manuals. +-------+-------------+-------------------------------------+ The default configuration can be found in -:zephyr_file:`boards/silabs/sparkfun_thing_plus_matter_mgm240p/sparkfun_thing_plus_matter_mgm240p_defconfig` +:zephyr_file:`boards/sparkfun/thing_plus_matter_mgm240p/sparkfun_thing_plus_matter_mgm240p_defconfig` System Clock ============ diff --git a/doc/hardware/porting/shields.rst b/doc/hardware/porting/shields.rst index baf2a611fb78d..6f3dff1be5fb8 100644 --- a/doc/hardware/porting/shields.rst +++ b/doc/hardware/porting/shields.rst @@ -12,7 +12,7 @@ Shield porting and configuration ******************************** Shield configuration files are available in the board directory -under :zephyr_file:`/boards/shields`: +under :zephyr_file:`boards/shields`: .. code-block:: none diff --git a/doc/services/logging/cs_stm.rst b/doc/services/logging/cs_stm.rst index bf41ec3b25cf8..75a371dfd24e0 100644 --- a/doc/services/logging/cs_stm.rst +++ b/doc/services/logging/cs_stm.rst @@ -171,7 +171,7 @@ Stand-alone logging =================== Frontend is writing to STMESP registers. Message format is aligned with the on chip decoder -in :zephyr_file:`subsys/logging/frontend/log_frontend_stmesp_demux.c`. +in :zephyr_file:`subsys/logging/frontends/log_frontend_stmesp_demux.c`. ``Proxy`` is using Nordic specific peripheral (TBM) to get ETR buffer busyness and read and decode data and send human-readable data over UART. Nordic specific driver for ETR buffer is diff --git a/samples/bluetooth/hci_spi/README.rst b/samples/bluetooth/hci_spi/README.rst index 1276889e6a530..b29ab85b72ce0 100644 --- a/samples/bluetooth/hci_spi/README.rst +++ b/samples/bluetooth/hci_spi/README.rst @@ -23,9 +23,9 @@ for the HCI SPI slave device with compatible :dtcompatible:`zephyr,bt-hci-spi-slave`. This node sets an interrupt line to the host and associates the application with a SPI bus to use. -See :zephyr_file:`boards/nrf51dk_nrf51422.overlay -` in this sample -directory for an example overlay for the :ref:`nrf51dk_nrf51422` board. +See :zephyr_file:`boards/nrf51dk_nrf51822.overlay +` in this sample +directory for an example overlay for the :ref:`nrf51dk_nrf51822` board. You can then build this application and flash it onto your board in the usual way; see :ref:`boards` for board-specific building and diff --git a/samples/bluetooth/hci_uart/README.rst b/samples/bluetooth/hci_uart/README.rst index d07ddd4421e41..ac909319a8036 100644 --- a/samples/bluetooth/hci_uart/README.rst +++ b/samples/bluetooth/hci_uart/README.rst @@ -149,7 +149,7 @@ Check the :zephyr:code-sample:`ble_direction_finding_connectionless_rx` and the Using a USB CDC ACM UART ======================== -The sample can be configured to use a USB UART instead. See :zephyr_file:`samples/bluetooth/hci_uart/boards/nrf52840dongle_nrf52840.conf` and :zephyr_file:`samples/bluetooth/hci_uart/boards/nrf52840dongle_nrf52840.overlay`. +The sample can be configured to use a USB UART instead. See :zephyr_file:`samples/bluetooth/hci_uart/boards/nrf52840dongle_nrf52840.conf`. Using the controller with the Zephyr host ========================================= diff --git a/samples/bluetooth/hci_uart_3wire/README.rst b/samples/bluetooth/hci_uart_3wire/README.rst index effd001c7600d..6ebb9de32fd7d 100644 --- a/samples/bluetooth/hci_uart_3wire/README.rst +++ b/samples/bluetooth/hci_uart_3wire/README.rst @@ -149,7 +149,7 @@ Check the :zephyr:code-sample:`ble_direction_finding_connectionless_rx` and the Using a USB CDC ACM UART ======================== -The sample can be configured to use a USB UART instead. See :zephyr_file:`samples/bluetooth/hci_uart_3wire/boards/nrf52840dongle_nrf52840.conf` and :zephyr_file:`samples/bluetooth/hci_uart_3wire/boards/nrf52840dongle_nrf52840.overlay`. +The sample can be configured to use a USB UART instead. See :zephyr_file:`samples/bluetooth/hci_uart_3wire/boards/nrf52840dongle_nrf52840.conf`. Using the controller with the Zephyr host ========================================= diff --git a/samples/boards/96boards/argonkey/microphone/README.rst b/samples/boards/96boards/argonkey/microphone/README.rst index 64e70bc45ad7e..a62ceae084a2e 100644 --- a/samples/boards/96boards/argonkey/microphone/README.rst +++ b/samples/boards/96boards/argonkey/microphone/README.rst @@ -64,14 +64,14 @@ Five seconds of acquisition at a 16KHz sampling rate yields 80,000 16-bit sample The microphone PDM requested clock should lead the MP34DT05 driver to select an oversampling/decimation factor equal to 128, resulting in a 2.048MHz bit clock. -See pcm and pdm configuration in file :zephyr_file:`samples/boards/96b_argonkey/microphone/src/main.c`. +See pcm and pdm configuration in file :zephyr_file:`samples/boards/96boards/argonkey/microphone/src/main.c`. .. note:: It is possible to change the AUDIO_FREQ to 32000 acquiring only 2500 ms. In this case the oversampling/decimation factor will be 64. At the end of the acquisition the PCM data will be printed on the terminal emulator in either binary or ASCII format. The output is controlled by -following macro, off by default, in :zephyr_file:`samples/boards/96b_argonkey/microphone/src/main.c`: +following macro, off by default, in :zephyr_file:`samples/boards/96boards/argonkey/microphone/src/main.c`: * :c:macro:`PCM_OUTPUT_IN_ASCII` diff --git a/samples/boards/96boards/argonkey/sensors/README.rst b/samples/boards/96boards/argonkey/sensors/README.rst index 6f34235b45150..1fd90973d650d 100644 --- a/samples/boards/96boards/argonkey/sensors/README.rst +++ b/samples/boards/96boards/argonkey/sensors/README.rst @@ -20,7 +20,7 @@ in either one of the following two ways: - standalone mode, supplying 5V directly on P1 connector The user may select or unselect the sensors from -:zephyr_file:`samples/boards/96b_argonkey/sensors/prj.conf`. +:zephyr_file:`samples/boards/96boards/argonkey/sensors/prj.conf`. Please note that all sensor related code is conditionally compiled using the ``#ifdef`` directive, so this sample is supposed to always diff --git a/samples/boards/nxp/s32/netc/README.rst b/samples/boards/nxp/s32/netc/README.rst index ea2ee66ef1baf..d9d2c50123312 100644 --- a/samples/boards/nxp/s32/netc/README.rst +++ b/samples/boards/nxp/s32/netc/README.rst @@ -20,7 +20,7 @@ controls PSI) to allow users visualize the networking settings. Telnet shell and backend is also enabled. The source code for this sample application can be found at: -:zephyr_file:`samples/boards/nxp_s32/netc`. +:zephyr_file:`samples/boards/nxp/s32/netc`. Requirements ************ diff --git a/samples/drivers/led/led_strip/README.rst b/samples/drivers/led/led_strip/README.rst index 703f27c71896f..9c4efdc2c4418 100644 --- a/samples/drivers/led/led_strip/README.rst +++ b/samples/drivers/led/led_strip/README.rst @@ -57,7 +57,7 @@ Note about thingy52 The thingy52 has integrated NMOS transistors, that can be used instead of a level shifter. The I2S driver supports inverting the output to suit this scheme, using the ``out-active-low`` dts property. See the overlay file -:zephyr_file:`samples/drivers/led_strip/boards/thingy52_nrf52832.overlay` for more detail. +:zephyr_file:`samples/drivers/led/led_strip/boards/thingy52_nrf52832.overlay` for more detail. Building and Running ******************** diff --git a/samples/shields/x_nucleo_iks02a1/sensorhub/README.rst b/samples/shields/x_nucleo_iks02a1/sensorhub/README.rst index 55597b90eddd9..56d1f9e5e003b 100644 --- a/samples/shields/x_nucleo_iks02a1/sensorhub/README.rst +++ b/samples/shields/x_nucleo_iks02a1/sensorhub/README.rst @@ -32,7 +32,6 @@ and devicetree). See for example the :zephyr:board:`nucleo_f401re` board source code: - :zephyr_file:`boards/st/nucleo_f401re/nucleo_f401re.dts` -- :zephyr_file:`boards/st/nucleo_f401re/pinmux.c` Please note that this sample can't be used with boards already supporting one of the sensors available on the shield (such as disco_l475_iot1) diff --git a/samples/sysbuild/hello_world/README.rst b/samples/sysbuild/hello_world/README.rst index 161df95beaeb0..611d4a4781e8b 100644 --- a/samples/sysbuild/hello_world/README.rst +++ b/samples/sysbuild/hello_world/README.rst @@ -41,7 +41,7 @@ Here's an example to build and flash the sample for the :compact: The same can be achieved by using the -:zephyr_file:`samples/basic/multitarget_hello_world/sample.yaml` setup: +:zephyr_file:`samples/sysbuild/hello_world/sample.yaml` setup: .. zephyr-app-commands:: :zephyr-app: samples/sysbuild/hello_world From 3c83604b846d15fb6543542c3df10197ef5fdd8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 28 Oct 2024 16:57:19 +0100 Subject: [PATCH 1965/4482] doc: extensions: check dead zephyr_file/zephyr_raw links MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a check to ensure that all zephyr_file/zephyr_raw links are pointing to valid paths in the current zephyr tree. Signed-off-by: Benjamin Cabé --- doc/_extensions/zephyr/link-roles.py | 19 ++++++++++++++++++- doc/conf.py | 3 +++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/doc/_extensions/zephyr/link-roles.py b/doc/_extensions/zephyr/link-roles.py index c1474bab31223..be82226bd5710 100644 --- a/doc/_extensions/zephyr/link-roles.py +++ b/doc/_extensions/zephyr/link-roles.py @@ -9,7 +9,11 @@ import re import subprocess from docutils import nodes +from pathlib import Path from sphinx.util import logging +from typing import Final + +ZEPHYR_BASE: Final[str] = Path(__file__).parents[3] try: import west.manifest @@ -43,6 +47,7 @@ def setup(app): app.add_config_value("link_roles_manifest_baseurl", None, "env") app.add_config_value("link_roles_manifest_project", None, "env") + app.add_config_value("link_roles_manifest_project_broken_links_ignore_globs", [], "env") # The role just creates new nodes based on information in the # arguments; its behavior doesn't depend on any other documents. @@ -59,7 +64,8 @@ def role(name, rawtext, text, lineno, inliner, options={}, content=[]): rev = get_github_rev() config = inliner.document.settings.env.app.config baseurl = config.link_roles_manifest_baseurl - trace = f"at '{inliner.parent.source}', line {lineno}" + source, line = inliner.reporter.get_source_and_line(lineno) + trace = f"at '{source}:{line}'" m = re.search(r"(.*)\s*<(.*)>", text) if m: @@ -99,6 +105,17 @@ def role(name, rawtext, text, lineno, inliner, options={}, content=[]): f"Configuration value `link_roles_manifest_baseurl` not set\n\t{trace}" ) + if module == config.link_roles_manifest_project: + p = Path(source).relative_to(inliner.document.settings.env.srcdir) + if not any( + p.match(glob) + for glob in config.link_roles_manifest_project_broken_links_ignore_globs + ): + if not Path(ZEPHYR_BASE, link).exists(): + logger.warning( + f"{link} not found in {config.link_roles_manifest_project} {trace}" + ) + url = f"{baseurl}/{format}/{rev}/{link}" node = nodes.reference(rawtext, link_text, refuri=url, **options) return [node], [] diff --git a/doc/conf.py b/doc/conf.py index f5942acaf44fe..a25cc6818c7de 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -258,6 +258,9 @@ # -- Options for zephyr.link-roles ---------------------------------------- link_roles_manifest_project = "zephyr" +link_roles_manifest_project_broken_links_ignore_globs = [ + "releases/release-notes-[123].*.rst", +] link_roles_manifest_baseurl = "https://github.com/zephyrproject-rtos/zephyr" # -- Options for notfound.extension --------------------------------------- From 3a8ce6efb43dbcbe75e6186fd43e0bc1c83d270a Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Mon, 28 Oct 2024 15:42:20 +0100 Subject: [PATCH 1966/4482] tests: Bluetooth: tester: Add logging of messages for BTP Add log statements for each command, event and response for debugging purposes. Tests do not send enough of these to clutter the IUT logs and it is useful for debugging to more easily determine what command triggered a function call or when the responses and events are sent to the AutoPTS client. Signed-off-by: Emil Gydesen --- tests/bluetooth/tester/src/btp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/bluetooth/tester/src/btp.c b/tests/bluetooth/tester/src/btp.c index 60f3bc1cbbdf2..9ce8e44a726be 100644 --- a/tests/bluetooth/tester/src/btp.c +++ b/tests/bluetooth/tester/src/btp.c @@ -96,6 +96,9 @@ static void cmd_handler(void *p1, void *p2, void *p3) cmd = k_fifo_get(&cmds_queue, K_FOREVER); + LOG_DBG("cmd service %u opcode %u index %u", cmd->hdr.service, cmd->hdr.opcode, + cmd->hdr.index); + len = sys_le16_to_cpu(cmd->hdr.len); btp = find_btp_handler(cmd->hdr.service, cmd->hdr.opcode); @@ -293,6 +296,8 @@ static void tester_rsp_with_index(uint8_t service, uint8_t opcode, uint8_t index { struct btp_status s; + LOG_DBG("service %u opcode %u index %u status %u", service, opcode, index, status); + if (status == BTP_STATUS_SUCCESS) { tester_send_with_index(service, opcode, index, NULL, 0); return; @@ -305,6 +310,9 @@ static void tester_rsp_with_index(uint8_t service, uint8_t opcode, uint8_t index void tester_event(uint8_t service, uint8_t opcode, const void *data, size_t len) { __ASSERT_NO_MSG(opcode >= 0x80); + + LOG_DBG("service %u opcode %u", service, opcode); + tester_send_with_index(service, opcode, BTP_INDEX, data, len); } @@ -315,6 +323,8 @@ void tester_rsp_full(uint8_t service, uint8_t opcode, const void *rsp, size_t le __ASSERT_NO_MSG(opcode < 0x80); __ASSERT_NO_MSG(delayed_cmd != NULL); + LOG_DBG("service %u opcode %u", service, opcode); + tester_send_with_index(service, opcode, BTP_INDEX, rsp, len); cmd = delayed_cmd; @@ -331,6 +341,8 @@ void tester_rsp(uint8_t service, uint8_t opcode, uint8_t status) __ASSERT_NO_MSG(opcode < 0x80); __ASSERT_NO_MSG(delayed_cmd != NULL); + LOG_DBG("service %u opcode %u status %u", service, opcode, status); + tester_rsp_with_index(service, opcode, BTP_INDEX, status); cmd = delayed_cmd; From f889c1ababfbef49d215b04e75dc05a0a30bfa3e Mon Sep 17 00:00:00 2001 From: Jeroen Broersen Date: Fri, 25 Oct 2024 18:30:23 +0200 Subject: [PATCH 1967/4482] net: lwm2m: Add TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 to cipher list Add TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 to the list for use with x509 certificates. The LWM2M v1.1 specification says that a LWM2M client which used X509 certificates must support this ciphersuite and additional ciphersuites may be supported. Signed-off-by: Jeroen Broersen --- subsys/net/lib/lwm2m/lwm2m_engine.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/net/lib/lwm2m/lwm2m_engine.c b/subsys/net/lib/lwm2m/lwm2m_engine.c index f5a845b9a8f9b..ebf58c26f8ac8 100644 --- a/subsys/net/lib/lwm2m/lwm2m_engine.c +++ b/subsys/net/lib/lwm2m/lwm2m_engine.c @@ -1053,6 +1053,7 @@ static const int cipher_list_psk[] = { }; static const int cipher_list_cert[] = { + MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8, MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, }; From 39042dc9cccfb349c03f06ac13e3ac15f041129d Mon Sep 17 00:00:00 2001 From: Jacob McClellan Date: Wed, 16 Oct 2024 17:36:55 -0700 Subject: [PATCH 1968/4482] logging: Initialize 'chosen' pointer in z_log_msg_claim_oldest to NULL Fixes a compiler warning 'chosen' may be uninitialized when later dereferenced Signed-off-by: Jacob McClellan --- subsys/logging/log_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/logging/log_core.c b/subsys/logging/log_core.c index 494aabcba9c0b..f2e5363e094b8 100644 --- a/subsys/logging/log_core.c +++ b/subsys/logging/log_core.c @@ -705,7 +705,7 @@ union log_msg_generic *z_log_msg_local_claim(void) union log_msg_generic *z_log_msg_claim_oldest(k_timeout_t *backoff) { union log_msg_generic *msg = NULL; - struct log_msg_ptr *chosen; + struct log_msg_ptr *chosen = NULL; log_timestamp_t t_min = sizeof(log_timestamp_t) > sizeof(uint32_t) ? UINT64_MAX : UINT32_MAX; int i = 0; From d7765ccae7dd472fac9a67b1a0e38613d84dcae3 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Fri, 11 Oct 2024 11:44:06 +0000 Subject: [PATCH 1969/4482] tests/stream_flash: Disable SPI_NOR on nrf54l devices The stream flash test has been written with SoC internal storage in mind and its simplified structure does not take into account possibility of existence of devices with different erase characteristics, at run time. The commit fixes the test failing with Nordic bords that have CONFIG_SPI_NOR=y set by default, which made test to behave like device with erase capability has been tested. The commit sets CONFIG_SPI_NOR=n for nrf54l devices. Fixes #79181 Signed-off-by: Dominik Ermel --- tests/subsys/storage/stream/stream_flash/testcase.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/subsys/storage/stream/stream_flash/testcase.yaml b/tests/subsys/storage/stream/stream_flash/testcase.yaml index e20bb94e1e657..605f861916de1 100644 --- a/tests/subsys/storage/stream/stream_flash/testcase.yaml +++ b/tests/subsys/storage/stream/stream_flash/testcase.yaml @@ -15,6 +15,8 @@ tests: storage.stream_flash.no_explicit_erase: platform_allow: - nrf54l15dk/nrf54l15/cpuapp + extra_args: + - CONFIG_SPI_NOR=n storage.stream_flash.dword_wbs: extra_args: DTC_OVERLAY_FILE=unaligned_flush.overlay tags: stream_flash From e020f31fdb3e21cbf1a4d401dc2176c872c639bf Mon Sep 17 00:00:00 2001 From: Jonathon Penix Date: Wed, 9 Oct 2024 14:55:02 -0700 Subject: [PATCH 1970/4482] cmake: libc: minimal: Avoid linking against other libc implementations The minimal libc is currently built as a zephyr_library and will be included in the final link line as such. However, the c_library property will still be set as "-lc" (for most linkers) and will be added to the link line. This effectively requires that a separate libc implementation be available in the toolchain and makes it possible to accidentally pull from the non-minimal libc. This doesn't seem desirable, so try to prevent this by clearing the c_library property if we are using the minimal libc. Signed-off-by: Jonathon Penix --- lib/libc/minimal/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/libc/minimal/CMakeLists.txt b/lib/libc/minimal/CMakeLists.txt index abcab108e524e..10610b855c840 100644 --- a/lib/libc/minimal/CMakeLists.txt +++ b/lib/libc/minimal/CMakeLists.txt @@ -1,5 +1,9 @@ # SPDX-License-Identifier: Apache-2.0 +# As minimal libc will be built as a zephyr_library, clear c_library to +# prevent accidentally requiring or linking against another libc implementation. +set_property(TARGET linker PROPERTY c_library "") + zephyr_system_include_directories(include) zephyr_library() From fa29a0752699f9774d51ed59c50b18415c6de021 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 17 Jul 2024 22:25:39 +0200 Subject: [PATCH 1971/4482] doc: develop: west: Add alias documentation Add documentation and examples for west aliases. Signed-off-by: Pieter De Gendt --- doc/develop/west/alias.rst | 61 +++++++++++++++++++++++++++++++++++++ doc/develop/west/config.rst | 3 ++ doc/develop/west/index.rst | 1 + 3 files changed, 65 insertions(+) create mode 100644 doc/develop/west/alias.rst diff --git a/doc/develop/west/alias.rst b/doc/develop/west/alias.rst new file mode 100644 index 0000000000000..5e55652eb4e79 --- /dev/null +++ b/doc/develop/west/alias.rst @@ -0,0 +1,61 @@ +.. _west-aliases: + +West aliases +############ + +West allows to add alias commands to the local, global or system configuration files. +These aliases make it easy to add shortcuts for frequently used, or hard to memorize +commands for ease of development. + +Similar to how ``git`` aliases work, the alias command is replaced with the alias' +full text and parsed as a new shell argument list (using the Python function +`shlex.split()`_ internally to split the value). This enables adding argument +parameters as they were passed to the original command. Spaces are considered +argument separators; use proper escaping if arguments shouldn't be split. + +.. _shlex.split(): https://docs.python.org/3/library/shlex.html#shlex.split + +To add a new alias simply call the ``west config`` command: + +.. code-block:: shell + + west config alias.mylist "list -f '{name} {revision}'" + +To list aliases, use :samp:`west help {some_alias}`. + +Recursive aliases are allowed as an alias command can contain other aliases, effectively +building more complex but easy-to-remember commands. + +It is possible to override an existing command, for example to pass default arguments: + +.. code-block:: shell + + west config alias.update "update -o=--depth=1 -n" + +.. warning:: + + Overriding/shadowing other or built-in commands is an advanced use case, it can lead to + strange side-effects and should be done with great care. + +Examples +-------- + +Add ``west run`` and ``west menuconfig`` shortcuts to your global configuration to +call ``west build`` with the corresponding CMake targets: + +.. code-block:: shell + + west config --global alias.run "build --pristine=never --target run" + west config --global alias.menuconfig "build --pristine=never --target menuconfig" + +Create an alias for the sample you are actively developing with additional options: + +.. code-block:: shell + + west config alias.sample "build -b native_sim samples/hello_world -t run -- -DCONFIG_ASSERT=y" + +Override ``west update`` to check a local cache: + +.. code-block:: shell + + west config alias.update "update --path-cache $HOME/.cache/zephyrproject" diff --git a/doc/develop/west/config.rst b/doc/develop/west/config.rst index eae6c7e4b9ecb..51420abb83c04 100644 --- a/doc/develop/west/config.rst +++ b/doc/develop/west/config.rst @@ -130,6 +130,9 @@ commands are documented in the pages for those commands. * - Option - Description + * - :samp:`alias.{ALIAS}` + - String. If non-empty the ```` can be used as a west command. + See :ref:`west-aliases`. * - ``color.ui`` - Boolean. If ``true`` (the default), then west output is colorized when stdout is a terminal. diff --git a/doc/develop/west/index.rst b/doc/develop/west/index.rst index 7b5fd6b2cce86..ce73817902f11 100644 --- a/doc/develop/west/index.rst +++ b/doc/develop/west/index.rst @@ -37,6 +37,7 @@ each command. workspaces.rst manifest.rst config.rst + alias.rst extensions.rst build-flash-debug.rst sign.rst From 5dc5fa5ee2ac4c0b3914ce926d1e126f052d1e99 Mon Sep 17 00:00:00 2001 From: Sa Sasu Date: Mon, 12 Aug 2024 14:09:39 +0800 Subject: [PATCH 1972/4482] scripts: print the file name when decode syscall the script shows an incorrect file name, I check the wrong file first, then I find the script did not print the current reading file name. Fix this to prevent others from wasting their time on this. The new error message: ``` [1/179] Generating syscalls.json, struct_tags.json Error decoding zmk/.../altera_msgdma.c (included in zephyr/.../ethernet.c) ``` Signed-off-by: Sa Sasu --- scripts/build/parse_syscalls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build/parse_syscalls.py b/scripts/build/parse_syscalls.py index ebdb9bb73abd3..b748bb1c21089 100644 --- a/scripts/build/parse_syscalls.py +++ b/scripts/build/parse_syscalls.py @@ -119,7 +119,7 @@ def analyze_headers(include_dir, scan_dir, file_list): try: contents = fp.read() except Exception: - sys.stderr.write("Error decoding %s\n" % path) + sys.stderr.write("Error decoding %s (included in %s)\n" % (one_file, path)) raise fn = os.path.basename(one_file) From cc5adf2e923a260f87928d89983ecf87e957e8f0 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Mon, 28 Oct 2024 11:58:07 -0700 Subject: [PATCH 1973/4482] tests: timer_behavior: change sqrtf() to sqrt() sqrtf() is used for floats but the argument and resulting variable are both doubles. LLVM would complain about implicit conversion from float to double. So use sqrt() instead as it is used with doubles. Signed-off-by: Daniel Leung --- tests/kernel/timer/timer_behavior/src/jitter_drift.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/kernel/timer/timer_behavior/src/jitter_drift.c b/tests/kernel/timer/timer_behavior/src/jitter_drift.c index ba5b071880321..79a2deacadbd2 100644 --- a/tests/kernel/timer/timer_behavior/src/jitter_drift.c +++ b/tests/kernel/timer/timer_behavior/src/jitter_drift.c @@ -209,8 +209,8 @@ static void do_test_using(void (*sample_collection_fn)(void), const char *mechan variance_cyc = variance_cyc / (double)(CONFIG_TIMER_TEST_SAMPLES - periodic_rollovers); /* A measure of timer precision, ideal is 0 */ - double stddev_us = sqrtf(variance_us); - double stddev_cyc = sqrtf(variance_cyc); + double stddev_us = sqrt(variance_us); + double stddev_cyc = sqrt(variance_cyc); /* Use double precision math here as integer overflows are possible in doing all the * conversions otherwise From 38825c0ac57bdc31b8427a56f51baa435742edaf Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Mon, 28 Oct 2024 12:00:15 -0700 Subject: [PATCH 1974/4482] tests: timer_behavior: use fabs() instead of abs() abs() takes integer as argument but time_diff_us is of double. So use fabs() instead. Signed-off-by: Daniel Leung --- tests/kernel/timer/timer_behavior/src/jitter_drift.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/kernel/timer/timer_behavior/src/jitter_drift.c b/tests/kernel/timer/timer_behavior/src/jitter_drift.c index 79a2deacadbd2..1a7935435bc7f 100644 --- a/tests/kernel/timer/timer_behavior/src/jitter_drift.c +++ b/tests/kernel/timer/timer_behavior/src/jitter_drift.c @@ -333,7 +333,7 @@ static void do_test_using(void (*sample_collection_fn)(void), const char *mechan "Standard deviation (in microseconds) outside expected bound"); /* Validate the timer drift (accuracy over time) is within a configurable bound */ - zassert_true(abs(time_diff_us) < CONFIG_TIMER_TEST_MAX_DRIFT, + zassert_true(fabs(time_diff_us) < CONFIG_TIMER_TEST_MAX_DRIFT, "Drift (in microseconds) outside expected bound"); } From 99b7080abad9b0c9297c99da56aeeb80304f664f Mon Sep 17 00:00:00 2001 From: Riadh Ghaddab Date: Mon, 28 Oct 2024 16:27:26 +0100 Subject: [PATCH 1975/4482] MAINTAINERS: add myself rghaddab to collaborators of Flash Add myself to the collaborator list of flash to contribute to the work of enhancement of flash API Signed-off-by: Riadh Ghaddab --- MAINTAINERS.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 96790307c125d..a218c22c7c1b9 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -1397,6 +1397,8 @@ Release Notes: status: maintained maintainers: - de-nordic + collaborators: + - rghaddab files: - drivers/flash/ - dts/bindings/flash_controller/ From e07556964662c56cf4c06078298e01a0e590cbda Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 25 Oct 2024 13:54:44 -0500 Subject: [PATCH 1976/4482] boards: nxp: add documentation for SEGGER SystemView support with ECC SOCs using ECC require the SEGGER RTT control block address to be provided to the tooling, as the SEGGER tools will not scan the memory range of ECC ram. Add documentation making this clear to boards with these SOCs. Signed-off-by: Daniel DeGrasse --- boards/nxp/common/segger-ecc-systemview.rst | 17 +++++++++++++++++ boards/nxp/frdm_mcxa156/doc/index.rst | 6 ++++++ boards/nxp/frdm_mcxn236/doc/index.rst | 6 ++++++ boards/nxp/frdm_mcxn947/doc/index.rst | 6 ++++++ boards/nxp/frdm_mcxw71/doc/index.rst | 6 ++++++ 5 files changed, 41 insertions(+) create mode 100644 boards/nxp/common/segger-ecc-systemview.rst diff --git a/boards/nxp/common/segger-ecc-systemview.rst b/boards/nxp/common/segger-ecc-systemview.rst new file mode 100644 index 0000000000000..f60648e655c98 --- /dev/null +++ b/boards/nxp/common/segger-ecc-systemview.rst @@ -0,0 +1,17 @@ +:orphan: + +.. segger-ecc-systemview + +Using Segger SystemView and RTT +------------------------------- + +Note that when using SEGGER SystemView or RTT with this SOC, the RTT control +block address must be set manually within SystemView or the RTT Viewer. The +address provided to the tool should be the location of the ``_SEGGER_RTT`` +symbol, which can be found using a debugger or by examining the ``zephyr.map`` +file output by the linker. + +The RTT control block address must be provided manually because this SOC +supports ECC RAM. If the SEGGER tooling searches the ECC RAM space for the +control block a fault will occur, provided that ECC is enabled and the RAM +segment being searched has not been initialized to a known value. diff --git a/boards/nxp/frdm_mcxa156/doc/index.rst b/boards/nxp/frdm_mcxa156/doc/index.rst index 066b75cc4a07c..6af4aec4f4ee8 100644 --- a/boards/nxp/frdm_mcxa156/doc/index.rst +++ b/boards/nxp/frdm_mcxa156/doc/index.rst @@ -175,6 +175,12 @@ should see the following message in the terminal: *** Booting Zephyr OS build v3.6.0-4478-ge6c3a42f5f52 *** Hello World! frdm_mcxa156/mcxa156 +Troubleshooting +=============== + +.. include:: ../../common/segger-ecc-systemview.rst + :start-after: segger-ecc-systemview + .. _MCX-A156 SoC Website: https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/mcx-arm-cortex-m/mcx-a-series-microcontrollers/mcx-a13x-14x-15x-mcus-with-arm-cortex-m33-scalable-device-options-low-power-and-intelligent-peripherals:MCX-A13X-A14X-A15X diff --git a/boards/nxp/frdm_mcxn236/doc/index.rst b/boards/nxp/frdm_mcxn236/doc/index.rst index 2be790987cecf..066cdaeeb3abf 100644 --- a/boards/nxp/frdm_mcxn236/doc/index.rst +++ b/boards/nxp/frdm_mcxn236/doc/index.rst @@ -197,6 +197,12 @@ should see the following message in the terminal: *** Booting Zephyr OS build v3.6.0-4478-ge6c3a42f5f52 *** Hello World! frdm_mcxn236/mcxn236 +Troubleshooting +=============== + +.. include:: ../../common/segger-ecc-systemview.rst + :start-after: segger-ecc-systemview + .. _MCX-N236 SoC Website: https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/mcx-arm-cortex-m/mcx-n-series-microcontrollers/mcx-n23x-highly-integrated-mcus-with-on-chip-accelerators-intelligent-peripherals-and-advanced-security:MCX-N23X diff --git a/boards/nxp/frdm_mcxn947/doc/index.rst b/boards/nxp/frdm_mcxn947/doc/index.rst index 7caf478f9a4fd..63d0bbc7830d1 100644 --- a/boards/nxp/frdm_mcxn947/doc/index.rst +++ b/boards/nxp/frdm_mcxn947/doc/index.rst @@ -257,6 +257,12 @@ should see the following message in the terminal: *** Booting Zephyr OS build v3.6.0-479-g91faa20c6741 *** Hello World! frdm_mcxn947/mcxn947/cpu0 +Troubleshooting +=============== + +.. include:: ../../common/segger-ecc-systemview.rst + :start-after: segger-ecc-systemview + .. _MCX-N947 SoC Website: https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/mcx-arm-cortex-m/mcx-n-series-microcontrollers/mcx-n94x-54x-highly-integrated-multicore-mcus-with-on-chip-accelerators-intelligent-peripherals-and-advanced-security:MCX-N94X-N54X diff --git a/boards/nxp/frdm_mcxw71/doc/index.rst b/boards/nxp/frdm_mcxw71/doc/index.rst index 87800853fdaf7..c5a16d8e1a3f3 100644 --- a/boards/nxp/frdm_mcxw71/doc/index.rst +++ b/boards/nxp/frdm_mcxw71/doc/index.rst @@ -192,6 +192,12 @@ For more details: .. _blhost Website: https://www.nxp.com/search?keyword=blhost&start=0 +Troubleshooting +=============== + +.. include:: ../../common/segger-ecc-systemview.rst + :start-after: segger-ecc-systemview + References ********** From 054bd850f0919317b0a6481dbe61625fe5f3c4eb Mon Sep 17 00:00:00 2001 From: Timon Skerutsch Date: Sun, 20 Oct 2024 01:24:47 +0200 Subject: [PATCH 1977/4482] doc: gsg: Add second note about different Linux distributions The initial note about the install guide for different distributions can be easily overlooked. Add a second note to make it more prominent in the first step. Signed-off-by: Timon Skerutsch --- doc/develop/getting_started/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/develop/getting_started/index.rst b/doc/develop/getting_started/index.rst index 5d828f3bbd9b2..06729428eaf02 100644 --- a/doc/develop/getting_started/index.rst +++ b/doc/develop/getting_started/index.rst @@ -23,6 +23,7 @@ Click the operating system you are using. .. group-tab:: Ubuntu This guide covers Ubuntu version 20.04 LTS and later. + If you are using a different Linux distribution see :ref:`installation_linux`. .. code-block:: bash From 743761d7d1d7be7ef7cf0614e37ead5eb748b79e Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Tue, 22 Oct 2024 10:28:54 +0200 Subject: [PATCH 1978/4482] scripts: Fix CMake spelling As per its creators, CMake is written with a capital "M". The initial reason for this change is that I want Twister to print "ERROR : CMake build failure" instead of "ERROR : Cmake build failure". Signed-off-by: Reto Schneider --- scripts/pylib/twister/twisterlib/environment.py | 2 +- scripts/pylib/twister/twisterlib/runner.py | 6 +++--- scripts/tests/twister/test_environment.py | 2 +- scripts/tests/twister/test_runner.py | 4 ++-- scripts/tests/twister_blackbox/test_outfile.py | 3 ++- scripts/west_commands/spdx.py | 4 ++-- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/environment.py b/scripts/pylib/twister/twisterlib/environment.py index ab4f1a3d6af45..c81b03355ce5e 100644 --- a/scripts/pylib/twister/twisterlib/environment.py +++ b/scripts/pylib/twister/twisterlib/environment.py @@ -1075,7 +1075,7 @@ def run_cmake_script(args=[]): results = {"returncode": p.returncode, "msg": msg, "stdout": out} else: - logger.error("Cmake script failure: %s" % (args[0])) + logger.error("CMake script failure: %s" % (args[0])) results = {"returncode": p.returncode, "returnmsg": out} return results diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index 4a38eeb284a90..138813f45a0b4 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -437,12 +437,12 @@ def run_cmake(self, args="", filter_stages=[]): } else: self.instance.status = TwisterStatus.ERROR - self.instance.reason = "Cmake build failure" + self.instance.reason = "CMake build failure" for tc in self.instance.testcases: tc.status = self.instance.status - logger.error("Cmake build failure: %s for %s" % (self.source_dir, self.platform.name)) + logger.error("CMake build failure: %s for %s" % (self.source_dir, self.platform.name)) ret = {"returncode": p.returncode} if out: @@ -821,7 +821,7 @@ def process(self, pipeline, done, message, lock, results): mode = message.get("mode") if mode == "device": self.cleanup_device_testing_artifacts() - elif mode == "passed" or (mode == "all" and self.instance.reason != "Cmake build failure"): + elif mode == "passed" or (mode == "all" and self.instance.reason != "CMake build failure"): self.cleanup_artifacts() except StatusAttributeError as sae: logger.error(str(sae)) diff --git a/scripts/tests/twister/test_environment.py b/scripts/tests/twister/test_environment.py index 540708d6a1927..3a4e090598b04 100644 --- a/scripts/tests/twister/test_environment.py +++ b/scripts/tests/twister/test_environment.py @@ -488,7 +488,7 @@ def mocked_abspath(path): True, 1, b'another\x1B_dummy', - 'Cmake script failure: dummy/script/path', + 'CMake script failure: dummy/script/path', { 'returncode': 1, 'returnmsg': 'anotherdummy' diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index 1aecba6dbfc37..2b088fcb6bfd6 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -383,7 +383,7 @@ def mock_popen(*args, **kwargs): (False, [], 1, True, 'ERROR: region `FLASH\' overflowed by 123 MB', True, False, True, - TwisterStatus.ERROR, 'Cmake build failure', + TwisterStatus.ERROR, 'CMake build failure', [os.path.join('dummy', 'cmake'), '-B' + os.path.join('build', 'dir'), '-DTC_RUNID=1', '-DTC_NAME=testcase', '-DSB_CONFIG_COMPILER_WARNINGS_AS_ERRORS=n', @@ -1421,7 +1421,7 @@ def mock_getsize(filename, *args, **kwargs): ( {'op': 'cleanup', 'mode': 'all'}, mock.ANY, - 'Cmake build failure', + 'CMake build failure', mock.ANY, mock.ANY, mock.ANY, diff --git a/scripts/tests/twister_blackbox/test_outfile.py b/scripts/tests/twister_blackbox/test_outfile.py index e2b0ac92a974d..0376769781841 100644 --- a/scripts/tests/twister_blackbox/test_outfile.py +++ b/scripts/tests/twister_blackbox/test_outfile.py @@ -15,6 +15,7 @@ import sys import tarfile +# pylint: disable=no-name-in-module from conftest import ZEPHYR_BASE, TEST_DATA, sample_filename_mock, testsuite_filename_mock from twisterlib.testplan import TestPlan @@ -149,7 +150,7 @@ def test_short_build_path(self, out_path): flag_pattern = r'(?:\S+(?: \\)?)+- ' cmake_path = shutil.which('cmake') if not cmake_path: - assert False, 'Cmake not found.' + assert False, 'CMake not found.' cmake_call_section = r'^Calling cmake: ' + re.escape(cmake_path) calling_line = re.sub(cmake_call_section, '', calling_line) diff --git a/scripts/west_commands/spdx.py b/scripts/west_commands/spdx.py index 25ccde63e5be6..7a10b44153471 100644 --- a/scripts/west_commands/spdx.py +++ b/scripts/west_commands/spdx.py @@ -64,7 +64,7 @@ def do_run(self, args, unknown_args): self.do_run_spdx(args) def do_run_init(self, args): - self.inf("initializing Cmake file-based API prior to build") + self.inf("initializing CMake file-based API prior to build") if not args.build_dir: self.die("Build directory not specified; call `west spdx --init --build-dir=BUILD_DIR`") @@ -74,7 +74,7 @@ def do_run_init(self, args): if query_ready: self.inf("initialized; run `west build` then run `west spdx`") else: - self.err("Couldn't create Cmake file-based API query directory") + self.err("Couldn't create CMake file-based API query directory") self.err("You can manually create an empty file at $BUILDDIR/.cmake/api/v1/query/codemodel-v2") def do_run_spdx(self, args): From 14852f5b6eec188cef528b54268fd035f492a050 Mon Sep 17 00:00:00 2001 From: Nicola Ochsenbein Date: Thu, 5 Sep 2024 09:20:46 +0200 Subject: [PATCH 1979/4482] MAINTAINERS: remove maintainer FatFs Remove ox11 as maintainer and remove the FatFs reentrant subgroup Signed-off-by: Nicola Ochsenbein --- MAINTAINERS.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index a218c22c7c1b9..1bcb2b7d463e9 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -2302,18 +2302,6 @@ Filesystems: tests: - filesystem -"Filesystems: FatFs reentrant support": - status: maintained - maintainers: - - ox11 - files: - - modules/fatfs/zfs_ffsystem.c - - tests/subsys/fs/fat_fs_api/src/test_fat_file_reentrant.c - labels: - - "area: File System" - tests: - - filesystem.fat - Formatted Output: status: maintained maintainers: From 6cc28c78b7a5d85ce13a31c21939540f8f6a3eae Mon Sep 17 00:00:00 2001 From: Riadh Ghaddab Date: Fri, 25 Oct 2024 00:25:41 +0200 Subject: [PATCH 1980/4482] MAINTAINERS: add ZMS maintainer Add myself "rghaddab" as maintainer to the ZMS storage system as I am the author of this new storage solution Signed-off-by: Riadh Ghaddab --- MAINTAINERS.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 1bcb2b7d463e9..02ba5ecbf974f 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -4181,6 +4181,17 @@ Storage: tests: - storage +Storage ZMS: + status: maintained + maintainers: + - rghaddab + files: + - subsys/fs/zms/ + - include/zephyr/fs/zms.h + - samples/subsys/fs/zms/ + - tests/subsys/fs/zms/ + - doc/services/storage/zms/zms.rst + Sysbuild: status: maintained maintainers: From 124aae3876842154964726ba6e89565040648f9a Mon Sep 17 00:00:00 2001 From: Vukan Turkulov Date: Wed, 16 Oct 2024 21:36:45 +0200 Subject: [PATCH 1981/4482] doc: specify thread safety for each data structure The documentation of "Kernel/Data Structures" incorrectly states that 'all provided structures are uniformly unsynchronized; access to them is not threadsafe by default'. In reality, some of them are threadsafe and some are not. This might discourage users from using threadsafe data structures where applicable, or mislead users into adding unnecessary locks. This proposal addresses the issue by specifying thread safety for each provided data structure. My assessment of thread safety is based purely on source code analysis; hence an expert verification would be appreciated. Signed-off-by: Vukan Turkulov --- doc/kernel/data_structures/index.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/kernel/data_structures/index.rst b/doc/kernel/data_structures/index.rst index f7e7c5ad35422..e7fac7da20191 100644 --- a/doc/kernel/data_structures/index.rst +++ b/doc/kernel/data_structures/index.rst @@ -20,10 +20,12 @@ behind this design is to allow the collections to be used in contexts where dynamic allocation is disallowed (i.e. there is no need to allocate node objects because the memory is provided by the user). -Note also that these libraries are uniformly unsynchronized; access to +Note also that these libraries are generally unsynchronized; access to them is not threadsafe by default. These are data structures, not synchronization primitives. The expectation is that any locking -needed will be provided by the user. +needed will be provided by the user. Some of the provided data +structures are thread safe in specific usage scenarios (see +:ref:`spsc_lockfree` and :ref:`mpsc_lockfree`). .. toctree:: :maxdepth: 1 From 8d1a7026c56245b60a01add26b0cd346efb5c9c6 Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Thu, 31 Oct 2024 10:51:12 +0100 Subject: [PATCH 1982/4482] samples: video: capture: Fix floating point logging issue The default frame rate is printed as a floating point number. Without enabling CONFIG_REQUIRES_FLOAT_PRINTF, it is not printed at all. Fix it. Signed-off-by: Phi Bang Nguyen --- samples/drivers/video/capture/prj.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/drivers/video/capture/prj.conf b/samples/drivers/video/capture/prj.conf index ce6dcc316d67e..b96f5f78ed2bd 100644 --- a/samples/drivers/video/capture/prj.conf +++ b/samples/drivers/video/capture/prj.conf @@ -5,3 +5,4 @@ CONFIG_DEVICE_SHELL=y CONFIG_PRINTK=y CONFIG_LOG=y CONFIG_DISPLAY=y +CONFIG_REQUIRES_FLOAT_PRINTF=y From fad8a1ff3189b4724530bf28703d49c3eeb62b68 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 29 Oct 2024 11:42:08 +0000 Subject: [PATCH 1983/4482] intel_adsp: fix new style twister configuration Missed a few keys while moving to the new style twister.yaml file for the intel_adsp platform. Add those back. Signed-off-by: Anas Nashif --- boards/intel/adsp/twister.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/boards/intel/adsp/twister.yaml b/boards/intel/adsp/twister.yaml index 94b6f58c53dc1..7d74e68594ca9 100644 --- a/boards/intel/adsp/twister.yaml +++ b/boards/intel/adsp/twister.yaml @@ -17,9 +17,23 @@ variants: - xt-clang intel_adsp/ace30: twister: false + intel_adsp/ace20_lnl/sim: + type: sim + simulation: custom + testing: + timeout_multiplier: 4 + intel_adsp/ace15_mtpm/sim: + type: sim + simulation: custom + testing: + timeout_multiplier: 4 intel_adsp/ace30/ptl/sim: + type: sim + simulation: custom toolchain: - xt-clang + testing: + timeout_multiplier: 8 intel_adsp/cavs25: toolchain: - xcc From 075d5d30097fb54fe6b3ee1608deed4795db2c36 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Tue, 29 Oct 2024 11:25:37 +0100 Subject: [PATCH 1984/4482] net: mqtt: Fix missing close function If POSIX_API is not configured the close function is not available. Use zsock_close instead. Signed-off-by: Andreas Huber --- subsys/net/lib/mqtt/mqtt_transport_websocket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/mqtt/mqtt_transport_websocket.c b/subsys/net/lib/mqtt/mqtt_transport_websocket.c index 1bb2f4bcd46c2..22050d4c40679 100644 --- a/subsys/net/lib/mqtt/mqtt_transport_websocket.c +++ b/subsys/net/lib/mqtt/mqtt_transport_websocket.c @@ -77,7 +77,7 @@ int mqtt_client_websocket_connect(struct mqtt_client *client) NET_ERR("Websocket connect failed (%d)", client->transport.websocket.sock); - (void)close(transport_sock); + (void)zsock_close(transport_sock); return client->transport.websocket.sock; } From 74a5599ac86c9d1f7b1f07c7c02b93d01756c009 Mon Sep 17 00:00:00 2001 From: Piotr Krzyzanowski Date: Tue, 29 Oct 2024 11:42:40 +0100 Subject: [PATCH 1985/4482] samples: sensor: qdec: change pins used for qdec nrf54h20dk Change pins that are used for qdec nrf54h20dk to align with shield (loopbacks) used in internal CI. This change is needed to start qdec driver power management testing. Signed-off-by: Piotr Krzyzanowski --- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 14 +++++--------- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 18 +++++++----------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/samples/sensor/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/samples/sensor/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index c4f6fc7876ae7..654e778af97be 100644 --- a/samples/sensor/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/samples/sensor/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -13,10 +13,10 @@ encoder-emulate { compatible = "gpio-leds"; phase_a: phase_a { - gpios = <&gpio7 2 GPIO_ACTIVE_HIGH>; + gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>; }; phase_b: phase_b { - gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; + gpios = <&gpio2 11 GPIO_ACTIVE_HIGH>; }; }; }; @@ -24,17 +24,13 @@ &pinctrl { qdec_pinctrl: qdec_pinctrl { group1 { - psels = , - ; + psels = , + ; }; }; }; -&gpio1 { - status = "okay"; -}; - -&gpio7 { +&gpio2 { status = "okay"; }; diff --git a/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 0e552906a001f..7e6da5a345827 100644 --- a/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -13,10 +13,10 @@ encoder-emulate { compatible = "gpio-leds"; phase_a: phase_a { - gpios = <&gpio7 2 GPIO_ACTIVE_HIGH>; + gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>; }; phase_b: phase_b { - gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; + gpios = <&gpio2 11 GPIO_ACTIVE_HIGH>; }; }; }; @@ -24,25 +24,21 @@ &pinctrl { qdec_pinctrl: qdec_pinctrl { group1 { - psels = , - ; + psels = , + ; }; }; qdec_sleep_pinctrl: qdec_sleep_pinctrl { group1 { - psels = , - ; + psels = , + ; low-power-enable; }; }; }; -&gpio1 { - status = "okay"; -}; - -&gpio7 { +&gpio2 { status = "okay"; }; From 5ebe1194be5daf2c8a023de53d6fe3766a807525 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Mon, 28 Oct 2024 15:36:52 +0100 Subject: [PATCH 1986/4482] tests: Bluetooth: Tester: Fix use of uninitialized cig_id for CAP The CAP tests used u_group->cig->index but the u_group->cig may have been deleted when the stream is released, which meant that u_group->cig == NULL when e.g. unicast_stop_complete_cb was called and that could cause failing tests as the index would just be a uninitialized value. Signed-off-by: Emil Gydesen --- tests/bluetooth/tester/src/audio/btp_bap_unicast.c | 1 + tests/bluetooth/tester/src/audio/btp_bap_unicast.h | 4 ++++ tests/bluetooth/tester/src/audio/btp_cap.c | 8 ++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/bluetooth/tester/src/audio/btp_bap_unicast.c b/tests/bluetooth/tester/src/audio/btp_bap_unicast.c index 349cc471c4714..5bdfe1253501c 100644 --- a/tests/bluetooth/tester/src/audio/btp_bap_unicast.c +++ b/tests/bluetooth/tester/src/audio/btp_bap_unicast.c @@ -1140,6 +1140,7 @@ int btp_bap_unicast_group_create(uint8_t cig_id, } cigs[cig_id].in_use = true; + cigs[cig_id].cig_id = cig_id; *out_unicast_group = &cigs[cig_id]; return 0; diff --git a/tests/bluetooth/tester/src/audio/btp_bap_unicast.h b/tests/bluetooth/tester/src/audio/btp_bap_unicast.h index 2d62ad3e56edd..1dcff0ce4cd68 100644 --- a/tests/bluetooth/tester/src/audio/btp_bap_unicast.h +++ b/tests/bluetooth/tester/src/audio/btp_bap_unicast.h @@ -2,10 +2,13 @@ /* * Copyright (c) 2023 Codecoup + * Copyright (c) 2024 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ +#include + #include #define BTP_BAP_UNICAST_MAX_SNK_STREAMS_COUNT MIN(CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT, \ @@ -20,6 +23,7 @@ struct btp_bap_unicast_group { struct bt_bap_qos_cfg qos[CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT]; struct bt_bap_unicast_group *cig; + uint8_t cig_id; bool in_use; }; diff --git a/tests/bluetooth/tester/src/audio/btp_cap.c b/tests/bluetooth/tester/src/audio/btp_cap.c index ea0aedd52b8e1..9316db7c62bba 100644 --- a/tests/bluetooth/tester/src/audio/btp_cap.c +++ b/tests/bluetooth/tester/src/audio/btp_cap.c @@ -104,13 +104,13 @@ static void unicast_start_complete_cb(int err, struct bt_conn *conn) if (err != 0) { LOG_DBG("Failed to unicast-start, err %d", err); - btp_send_cap_unicast_start_completed_ev(u_group->cig->index, + btp_send_cap_unicast_start_completed_ev(u_group->cig_id, BTP_CAP_UNICAST_START_STATUS_FAILED); return; } - btp_send_cap_unicast_start_completed_ev(u_group->cig->index, + btp_send_cap_unicast_start_completed_ev(u_group->cig_id, BTP_CAP_UNICAST_START_STATUS_SUCCESS); } @@ -129,13 +129,13 @@ static void unicast_stop_complete_cb(int err, struct bt_conn *conn) if (err != 0) { LOG_DBG("Failed to unicast-stop, err %d", err); - btp_send_cap_unicast_stop_completed_ev(u_group->cig->index, + btp_send_cap_unicast_stop_completed_ev(u_group->cig_id, BTP_CAP_UNICAST_START_STATUS_FAILED); return; } - btp_send_cap_unicast_stop_completed_ev(u_group->cig->index, + btp_send_cap_unicast_stop_completed_ev(u_group->cig_id, BTP_CAP_UNICAST_START_STATUS_SUCCESS); } From ac37ba873972ae839120028fd0c36227ea9fc0a6 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Wed, 23 Oct 2024 08:42:01 -0400 Subject: [PATCH 1987/4482] tests/samples: use platform_key on cmsis_rtos tests/samples Coverage for cmsis rtos APIS should is provided using simulation, we should not build those on every platform we have. Avoid failures due to incompatiblities in requirements coming from various boards and also reduce churn and noise during testing and CI. Fixes #80215 Signed-off-by: Anas Nashif --- .../subsys/portability/cmsis_rtos_v1/philosophers/sample.yaml | 3 +++ .../cmsis_rtos_v1/timer_synchronization/sample.yaml | 3 +++ .../subsys/portability/cmsis_rtos_v2/philosophers/sample.yaml | 3 +++ .../cmsis_rtos_v2/timer_synchronization/sample.yaml | 3 +++ tests/subsys/portability/cmsis_rtos_v1/testcase.yaml | 3 +++ tests/subsys/portability/cmsis_rtos_v2/testcase.yaml | 4 +++- 6 files changed, 18 insertions(+), 1 deletion(-) diff --git a/samples/subsys/portability/cmsis_rtos_v1/philosophers/sample.yaml b/samples/subsys/portability/cmsis_rtos_v1/philosophers/sample.yaml index 64fd5053d85df..0f078b1cfd77c 100644 --- a/samples/subsys/portability/cmsis_rtos_v1/philosophers/sample.yaml +++ b/samples/subsys/portability/cmsis_rtos_v1/philosophers/sample.yaml @@ -1,6 +1,9 @@ sample: name: CMSIS_RTOS_V1 Dining Philosophers common: + platform_key: + - arch + - simulation integration_platforms: - native_sim extra_args: DEBUG_PRINTF=1 diff --git a/samples/subsys/portability/cmsis_rtos_v1/timer_synchronization/sample.yaml b/samples/subsys/portability/cmsis_rtos_v1/timer_synchronization/sample.yaml index e87d844993831..d849624aada54 100644 --- a/samples/subsys/portability/cmsis_rtos_v1/timer_synchronization/sample.yaml +++ b/samples/subsys/portability/cmsis_rtos_v1/timer_synchronization/sample.yaml @@ -2,6 +2,9 @@ sample: name: CMSIS_RTOS_V1 Synchronization tests: sample.portability.cmsis_rtos_v1.timer_synchronization: + platform_key: + - arch + - simulation integration_platforms: - native_sim tags: cmsis_rtos diff --git a/samples/subsys/portability/cmsis_rtos_v2/philosophers/sample.yaml b/samples/subsys/portability/cmsis_rtos_v2/philosophers/sample.yaml index 801b997fcb128..88c9cc4a80104 100644 --- a/samples/subsys/portability/cmsis_rtos_v2/philosophers/sample.yaml +++ b/samples/subsys/portability/cmsis_rtos_v2/philosophers/sample.yaml @@ -1,6 +1,9 @@ sample: name: CMSIS_RTOS_V2 Dining Philosophers common: + platform_key: + - arch + - simulation integration_platforms: - native_sim extra_args: DEBUG_PRINTF=1 diff --git a/samples/subsys/portability/cmsis_rtos_v2/timer_synchronization/sample.yaml b/samples/subsys/portability/cmsis_rtos_v2/timer_synchronization/sample.yaml index f3ef677839585..937d8b1d91347 100644 --- a/samples/subsys/portability/cmsis_rtos_v2/timer_synchronization/sample.yaml +++ b/samples/subsys/portability/cmsis_rtos_v2/timer_synchronization/sample.yaml @@ -2,6 +2,9 @@ sample: name: CMSIS_RTOS_V2 Synchronization tests: sample.portability.cmsis_rtos_v2.timer_synchronization: + platform_key: + - arch + - simulation integration_platforms: - native_sim platform_exclude: diff --git a/tests/subsys/portability/cmsis_rtos_v1/testcase.yaml b/tests/subsys/portability/cmsis_rtos_v1/testcase.yaml index 14dca3ad836e0..369a4c2cc0523 100644 --- a/tests/subsys/portability/cmsis_rtos_v1/testcase.yaml +++ b/tests/subsys/portability/cmsis_rtos_v1/testcase.yaml @@ -1,5 +1,8 @@ tests: portability.cmsis_rtos_v1: + platform_key: + - arch + - simulation tags: cmsis_rtos min_ram: 32 min_flash: 34 diff --git a/tests/subsys/portability/cmsis_rtos_v2/testcase.yaml b/tests/subsys/portability/cmsis_rtos_v2/testcase.yaml index 9de4ef3c939f0..4052a738afe4e 100644 --- a/tests/subsys/portability/cmsis_rtos_v2/testcase.yaml +++ b/tests/subsys/portability/cmsis_rtos_v2/testcase.yaml @@ -1,6 +1,8 @@ tests: portability.cmsis_rtos_v2: - platform_exclude: m2gl025_miv + platform_key: + - arch + - simulation tags: cmsis_rtos min_ram: 32 min_flash: 34 From 91d9cc259d677682572fa230573d3c71efd65c18 Mon Sep 17 00:00:00 2001 From: Fengming Ye Date: Tue, 29 Oct 2024 15:19:54 +0900 Subject: [PATCH 1988/4482] net: wifi: shell: add 80211R usage in connect command Add 80211R fast BSS transition argument usage in connect command. Signed-off-by: Fengming Ye --- subsys/net/l2/wifi/wifi_shell.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 77b2debe3550e..2cb83d031ca5e 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -3237,6 +3237,7 @@ SHELL_SUBCMD_ADD((wifi), connect, &wifi_commands, "[-I, --eap-id1]: Client Identity. Default no eap identity.\n" "[-P, --eap-pwd1]: Client Password.\n" "Default no password for eap user.\n" + "[-R, --ieee-80211r]: Use IEEE80211R fast BSS transition connect." "[-h, --help]: Print out the help for the connect command.\n", cmd_wifi_connect, 2, 19); From 502c9ffb3273c1841ed650aee0081f4555bbfb73 Mon Sep 17 00:00:00 2001 From: Damian Krolik Date: Fri, 18 Oct 2024 14:42:00 +0200 Subject: [PATCH 1989/4482] drivers: ieee802154_nrf5: skip Enh Ack conf for invalid short address If the invalid short address (0xfffe) is specified, configure the Enhanced Ack just for the extended address. This is needed because Header IEs for Enhanced Ack must be configured before the short address has been assigned to the child. Signed-off-by: Damian Krolik --- drivers/ieee802154/ieee802154_nrf5.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 8b9c9368e6df7..19df76c7d0786 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -934,7 +934,10 @@ static int nrf5_configure(const struct device *dev, sys_memcpy_swap(ext_addr_le, config->ack_ie.ext_addr, EXTENDED_ADDRESS_SIZE); if (config->ack_ie.header_ie == NULL || config->ack_ie.header_ie->length == 0) { - nrf_802154_ack_data_clear(short_addr_le, false, NRF_802154_ACK_DATA_IE); + if (config->ack_ie.short_addr != IEEE802154_NO_SHORT_ADDRESS_ASSIGNED) { + nrf_802154_ack_data_clear(short_addr_le, false, + NRF_802154_ACK_DATA_IE); + } nrf_802154_ack_data_clear(ext_addr_le, true, NRF_802154_ACK_DATA_IE); } else { element_id = ieee802154_header_ie_get_element_id(config->ack_ie.header_ie); @@ -955,10 +958,13 @@ static int nrf5_configure(const struct device *dev, return -ENOTSUP; } - nrf_802154_ack_data_set(short_addr_le, false, config->ack_ie.header_ie, - config->ack_ie.header_ie->length + - IEEE802154_HEADER_IE_HEADER_LENGTH, - NRF_802154_ACK_DATA_IE); + if (config->ack_ie.short_addr != IEEE802154_NO_SHORT_ADDRESS_ASSIGNED) { + nrf_802154_ack_data_set( + short_addr_le, false, config->ack_ie.header_ie, + config->ack_ie.header_ie->length + + IEEE802154_HEADER_IE_HEADER_LENGTH, + NRF_802154_ACK_DATA_IE); + } nrf_802154_ack_data_set(ext_addr_le, true, config->ack_ie.header_ie, config->ack_ie.header_ie->length + IEEE802154_HEADER_IE_HEADER_LENGTH, From ff1857af558e1fb5b133927d6eb5c33c0567b949 Mon Sep 17 00:00:00 2001 From: Lukasz Mrugala Date: Wed, 21 Aug 2024 11:24:51 +0000 Subject: [PATCH 1990/4482] scripts: twister: Enchance TestCase/Instance info and presentation ExecutionCounter has been expanded and now hold i.a. more information on the statuses of TestCases. This information is now incorporated in relevant summaries - runner.py and reports.py. Layout of those was changed to present that and previous information in a clear and concise way. TestInstance execution counter now is more intuitive. Instances filtered out before running are no longer included there. Retries now properly reset the counter. TestCases with None and other incorrect final statuses are logged as errors, but do not exit Twister with a nonzero exit code. This is because None statuses, although incorrect, are currently common. Inconsistent spacing in ERROR and FAILED fixed. Signed-off-by: Lukasz Mrugala scripts: Dmitri fix Fix of a problem noticed by Dmitri Removed unnecessary additional spaces when printing FAILED and ERROR status. Now TwisterStatus.get_color is used more. Signed-off-by: Lukasz Mrugala --- scripts/pylib/twister/twisterlib/reports.py | 56 +-- scripts/pylib/twister/twisterlib/runner.py | 389 +++++++++++++++--- scripts/tests/twister/test_runner.py | 143 +++++-- scripts/tests/twister_blackbox/test_device.py | 3 +- scripts/tests/twister_blackbox/test_error.py | 3 +- .../tests/twister_blackbox/test_platform.py | 61 ++- scripts/tests/twister_blackbox/test_runner.py | 67 +-- 7 files changed, 549 insertions(+), 173 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/reports.py b/scripts/pylib/twister/twisterlib/reports.py index e7160969ac9a8..058afce58c547 100644 --- a/scripts/pylib/twister/twisterlib/reports.py +++ b/scripts/pylib/twister/twisterlib/reports.py @@ -584,39 +584,43 @@ def summary(self, results, ignore_unrecognized_sections, duration): pass_rate = 0 logger.info( - "{}{} of {}{} test configurations passed ({:.2%}), {} built (not run), {}{}{} failed, {}{}{} errored, {} skipped with {}{}{} warnings in {:.2f} seconds".format( - Fore.RED if failed else Fore.GREEN, - results.passed, - results.total, - Fore.RESET, - pass_rate, - results.notrun, - Fore.RED if results.failed else Fore.RESET, - results.failed, - Fore.RESET, - Fore.RED if results.error else Fore.RESET, - results.error, - Fore.RESET, - results.skipped_configs, - Fore.YELLOW if self.plan.warnings else Fore.RESET, - self.plan.warnings, - Fore.RESET, - duration)) + f"{TwisterStatus.get_color(TwisterStatus.FAIL) if failed else TwisterStatus.get_color(TwisterStatus.PASS)}{results.passed}" + f" of {results.total - results.skipped_configs}{Fore.RESET}" + f" executed test configurations passed ({pass_rate:.2%})," + f" {f'{TwisterStatus.get_color(TwisterStatus.NOTRUN)}{results.notrun}{Fore.RESET}' if results.notrun else f'{results.notrun}'} built (not run)," + f" {f'{TwisterStatus.get_color(TwisterStatus.FAIL)}{results.failed}{Fore.RESET}' if results.failed else f'{results.failed}'} failed," + f" {f'{TwisterStatus.get_color(TwisterStatus.ERROR)}{results.error}{Fore.RESET}' if results.error else f'{results.error}'} errored," + f" with {f'{Fore.YELLOW}{self.plan.warnings}{Fore.RESET}' if self.plan.warnings else 'no'} warnings" + f" in {duration:.2f} seconds." + ) total_platforms = len(self.platforms) # if we are only building, do not report about tests being executed. if self.platforms and not self.env.options.build_only: - logger.info("In total {} test cases were executed, {} skipped on {} out of total {} platforms ({:02.2f}%)".format( - results.cases - results.skipped_cases - results.notrun, - results.skipped_cases, - len(self.filtered_platforms), - total_platforms, - (100 * len(self.filtered_platforms) / len(self.platforms)) - )) + executed_cases = results.cases - results.filtered_cases - results.skipped_cases - results.notrun_cases + pass_rate = 100 * (float(results.passed_cases) / float(executed_cases)) \ + if executed_cases != 0 else 0 + platform_rate = (100 * len(self.filtered_platforms) / len(self.platforms)) + logger.info( + f'{results.passed_cases} of {executed_cases} executed test cases passed ({pass_rate:02.2f}%)' + f'{", " + str(results.blocked_cases) + " blocked" if results.blocked_cases else ""}' + f'{", " + str(results.failed_cases) + " failed" if results.failed_cases else ""}' + f'{", " + str(results.error_cases) + " errored" if results.error_cases else ""}' + f'{", " + str(results.none_cases) + " without a status" if results.none_cases else ""}' + f' on {len(self.filtered_platforms)} out of total {total_platforms} platforms ({platform_rate:02.2f}%).' + ) + if results.skipped_cases or results.filtered_cases or results.notrun_cases: + logger.info( + f'{results.skipped_cases + results.filtered_cases} selected test cases not executed:' \ + f'{" " + str(results.skipped_cases) + " skipped" if results.skipped_cases else ""}' \ + f'{(", " if results.skipped_cases else " ") + str(results.filtered_cases) + " filtered" if results.filtered_cases else ""}' \ + f'{(", " if results.skipped_cases or results.filtered_cases else " ") + str(results.notrun_cases) + " not run (built only)" if results.notrun_cases else ""}' \ + f'.' + ) built_only = results.total - run - results.skipped_configs logger.info(f"{Fore.GREEN}{run}{Fore.RESET} test configurations executed on platforms, \ -{Fore.RED}{built_only}{Fore.RESET} test configurations were only built.") +{TwisterStatus.get_color(TwisterStatus.NOTRUN)}{built_only}{Fore.RESET} test configurations were only built.") def save_reports(self, name, suffix, report_dir, no_update, platform_reports): if not self.instances: diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index 138813f45a0b4..7bc45e2df677c 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -5,6 +5,7 @@ # SPDX-License-Identifier: Apache-2.0 import logging +from math import log10 import multiprocessing import os import pickle @@ -62,12 +63,16 @@ class ExecutionCounter(object): def __init__(self, total=0): ''' Most of the stats are at test instance level - Except that "_cases" and "_skipped_cases" are for cases of ALL test instances + Except that case statistics are for cases of ALL test instances - total complete = done + skipped_filter total = yaml test scenarios * applicable platforms - complete perctenage = (done + skipped_filter) / total + done := instances that reached report_out stage of the pipeline + done = skipped_configs + passed + failed + error + completed = done - skipped_filter + skipped_configs = skipped_runtime + skipped_filter + pass rate = passed / (total - skipped_configs) + case pass rate = passed_cases / (cases - filtered_cases - skipped_cases) ''' # instances that go through the pipeline # updated by report_out() @@ -92,13 +97,10 @@ def __init__(self, total=0): # updated by report_out() self._skipped_runtime = Value('i', 0) - # staic filtered at yaml parsing time + # static filtered at yaml parsing time # updated by update_counting_before_pipeline() self._skipped_filter = Value('i', 0) - # updated by update_counting_before_pipeline() and report_out() - self._skipped_cases = Value('i', 0) - # updated by report_out() in pipeline self._error = Value('i', 0) self._failed = Value('i', 0) @@ -106,25 +108,83 @@ def __init__(self, total=0): # initialized to number of test instances self._total = Value('i', total) + ####################################### + # TestCase counters for all instances # + ####################################### # updated in report_out self._cases = Value('i', 0) + + # updated by update_counting_before_pipeline() and report_out() + self._skipped_cases = Value('i', 0) + self._filtered_cases = Value('i', 0) + + # updated by report_out() in pipeline + self._passed_cases = Value('i', 0) + self._notrun_cases = Value('i', 0) + self._failed_cases = Value('i', 0) + self._error_cases = Value('i', 0) + self._blocked_cases = Value('i', 0) + + # Incorrect statuses + self._none_cases = Value('i', 0) + self._started_cases = Value('i', 0) + + self.lock = Lock() + @staticmethod + def _find_number_length(n): + if n > 0: + length = int(log10(n))+1 + elif n == 0: + length = 1 + else: + length = int(log10(-n))+2 + return length + def summary(self): - print("--------------------------------") - print(f"Total test suites: {self.total}") # actually test instances - print(f"Total test cases: {self.cases}") - print(f"Executed test cases: {self.cases - self.skipped_cases}") - print(f"Skipped test cases: {self.skipped_cases}") - print(f"Completed test suites: {self.done}") - print(f"Passing test suites: {self.passed}") - print(f"Built only test suites: {self.notrun}") - print(f"Failing test suites: {self.failed}") - print(f"Skipped test suites: {self.skipped_configs}") - print(f"Skipped test suites (runtime): {self.skipped_runtime}") - print(f"Skipped test suites (filter): {self.skipped_filter}") - print(f"Errors: {self.error}") - print("--------------------------------") + executed_cases = self.cases - self.skipped_cases - self.filtered_cases + completed_configs = self.done - self.skipped_filter + + # Find alignment length for aesthetic printing + suites_n_length = self._find_number_length(self.total if self.total > self.done else self.done) + processed_suites_n_length = self._find_number_length(self.done) + completed_suites_n_length = self._find_number_length(completed_configs) + skipped_suites_n_length = self._find_number_length(self.skipped_configs) + total_cases_n_length = self._find_number_length(self.cases) + executed_cases_n_length = self._find_number_length(executed_cases) + + print("--------------------------------------------------") + print(f"{'Total test suites: ':<23}{self.total:>{suites_n_length}}") # actually test instances + print(f"{'Processed test suites: ':<23}{self.done:>{suites_n_length}}") + print(f"├─ {'Filtered test suites (static): ':<37}{self.skipped_filter:>{processed_suites_n_length}}") + print(f"└─ {'Completed test suites: ':<37}{completed_configs:>{processed_suites_n_length}}") + print(f" ├─ {'Filtered test suites (at runtime): ':<37}{self.skipped_runtime:>{completed_suites_n_length}}") + print(f" ├─ {'Passed test suites: ':<37}{self.passed:>{completed_suites_n_length}}") + print(f" ├─ {'Built only test suites: ':<37}{self.notrun:>{completed_suites_n_length}}") + print(f" ├─ {'Failed test suites: ':<37}{self.failed:>{completed_suites_n_length}}") + print(f" └─ {'Errors in test suites: ':<37}{self.error:>{completed_suites_n_length}}") + print(f"") + print(f"{'Filtered test suites: ':<21}{self.skipped_configs}") + print(f"├─ {'Filtered test suites (static): ':<37}{self.skipped_filter:>{skipped_suites_n_length}}") + print(f"└─ {'Filtered test suites (at runtime): ':<37}{self.skipped_runtime:>{skipped_suites_n_length}}") + print("---------------------- ----------------------") + print(f"{'Total test cases: ':<18}{self.cases}") + print(f"├─ {'Filtered test cases: ':<21}{self.filtered_cases:>{total_cases_n_length}}") + print(f"├─ {'Skipped test cases: ':<21}{self.skipped_cases:>{total_cases_n_length}}") + print(f"└─ {'Executed test cases: ':<21}{executed_cases:>{total_cases_n_length}}") + print(f" ├─ {'Passed test cases: ':<25}{self.passed_cases:>{executed_cases_n_length}}") + print(f" ├─ {'Built only test cases: ':<25}{self.notrun_cases:>{executed_cases_n_length}}") + print(f" ├─ {'Blocked test cases: ':<25}{self.blocked_cases:>{executed_cases_n_length}}") + print(f" ├─ {'Failed test cases: ':<25}{self.failed_cases:>{executed_cases_n_length}}") + print(f" {'├' if self.none_cases or self.started_cases else '└'}─ {'Errors in test cases: ':<25}{self.error_cases:>{executed_cases_n_length}}") + if self.none_cases or self.started_cases: + print(f" ├──── The following test case statuses should not appear in a proper execution ───") + if self.none_cases: + print(f" {'├' if self.started_cases else '└'}─ {'Statusless test cases: ':<25}{self.none_cases:>{executed_cases_n_length}}") + if self.started_cases: + print(f" └─ {'Test cases only started: ':<25}{self.started_cases:>{executed_cases_n_length}}") + print("--------------------------------------------------") @property def cases(self): @@ -136,6 +196,10 @@ def cases(self, value): with self._cases.get_lock(): self._cases.value = value + def cases_increment(self, value=1): + with self._cases.get_lock(): + self._cases.value += value + @property def skipped_cases(self): with self._skipped_cases.get_lock(): @@ -146,6 +210,122 @@ def skipped_cases(self, value): with self._skipped_cases.get_lock(): self._skipped_cases.value = value + def skipped_cases_increment(self, value=1): + with self._skipped_cases.get_lock(): + self._skipped_cases.value += value + + @property + def filtered_cases(self): + with self._filtered_cases.get_lock(): + return self._filtered_cases.value + + @filtered_cases.setter + def filtered_cases(self, value): + with self._filtered_cases.get_lock(): + self._filtered_cases.value = value + + def filtered_cases_increment(self, value=1): + with self._filtered_cases.get_lock(): + self._filtered_cases.value += value + + @property + def passed_cases(self): + with self._passed_cases.get_lock(): + return self._passed_cases.value + + @passed_cases.setter + def passed_cases(self, value): + with self._passed_cases.get_lock(): + self._passed_cases.value = value + + def passed_cases_increment(self, value=1): + with self._passed_cases.get_lock(): + self._passed_cases.value += value + + @property + def notrun_cases(self): + with self._notrun_cases.get_lock(): + return self._notrun_cases.value + + @notrun_cases.setter + def notrun_cases(self, value): + with self._notrun.get_lock(): + self._notrun.value = value + + def notrun_cases_increment(self, value=1): + with self._notrun_cases.get_lock(): + self._notrun_cases.value += value + + @property + def failed_cases(self): + with self._failed_cases.get_lock(): + return self._failed_cases.value + + @failed_cases.setter + def failed_cases(self, value): + with self._failed_cases.get_lock(): + self._failed_cases.value = value + + def failed_cases_increment(self, value=1): + with self._failed_cases.get_lock(): + self._failed_cases.value += value + + @property + def error_cases(self): + with self._error_cases.get_lock(): + return self._error_cases.value + + @error_cases.setter + def error_cases(self, value): + with self._error_cases.get_lock(): + self._error_cases.value = value + + def error_cases_increment(self, value=1): + with self._error_cases.get_lock(): + self._error_cases.value += value + + @property + def blocked_cases(self): + with self._blocked_cases.get_lock(): + return self._blocked_cases.value + + @blocked_cases.setter + def blocked_cases(self, value): + with self._blocked_cases.get_lock(): + self._blocked_cases.value = value + + def blocked_cases_increment(self, value=1): + with self._blocked_cases.get_lock(): + self._blocked_cases.value += value + + @property + def none_cases(self): + with self._none_cases.get_lock(): + return self._none_cases.value + + @none_cases.setter + def none_cases(self, value): + with self._none_cases.get_lock(): + self._none_cases.value = value + + def none_cases_increment(self, value=1): + with self._none_cases.get_lock(): + self._none_cases.value += value + + @property + def started_cases(self): + with self._started_cases.get_lock(): + return self._started_cases.value + + @started_cases.setter + def started_cases(self, value): + with self._started_cases.get_lock(): + self._started_cases.value = value + + def started_cases_increment(self, value=1): + with self._started_cases.get_lock(): + self._started_cases.value += value + @property def error(self): with self._error.get_lock(): @@ -156,6 +336,10 @@ def error(self, value): with self._error.get_lock(): self._error.value = value + def error_increment(self, value=1): + with self._error.get_lock(): + self._error.value += value + @property def iteration(self): with self._iteration.get_lock(): @@ -166,6 +350,10 @@ def iteration(self, value): with self._iteration.get_lock(): self._iteration.value = value + def iteration_increment(self, value=1): + with self._iteration.get_lock(): + self._iteration.value += value + @property def done(self): with self._done.get_lock(): @@ -176,6 +364,10 @@ def done(self, value): with self._done.get_lock(): self._done.value = value + def done_increment(self, value=1): + with self._done.get_lock(): + self._done.value += value + @property def passed(self): with self._passed.get_lock(): @@ -186,6 +378,10 @@ def passed(self, value): with self._passed.get_lock(): self._passed.value = value + def passed_increment(self, value=1): + with self._passed.get_lock(): + self._passed.value += value + @property def notrun(self): with self._notrun.get_lock(): @@ -196,6 +392,10 @@ def notrun(self, value): with self._notrun.get_lock(): self._notrun.value = value + def notrun_increment(self, value=1): + with self._notrun.get_lock(): + self._notrun.value += value + @property def skipped_configs(self): with self._skipped_configs.get_lock(): @@ -206,6 +406,10 @@ def skipped_configs(self, value): with self._skipped_configs.get_lock(): self._skipped_configs.value = value + def skipped_configs_increment(self, value=1): + with self._skipped_configs.get_lock(): + self._skipped_configs.value += value + @property def skipped_filter(self): with self._skipped_filter.get_lock(): @@ -216,6 +420,10 @@ def skipped_filter(self, value): with self._skipped_filter.get_lock(): self._skipped_filter.value = value + def skipped_filter_increment(self, value=1): + with self._skipped_filter.get_lock(): + self._skipped_filter.value += value + @property def skipped_runtime(self): with self._skipped_runtime.get_lock(): @@ -226,6 +434,10 @@ def skipped_runtime(self, value): with self._skipped_runtime.get_lock(): self._skipped_runtime.value = value + def skipped_runtime_increment(self, value=1): + with self._skipped_runtime.get_lock(): + self._skipped_runtime.value += value + @property def failed(self): with self._failed.get_lock(): @@ -236,11 +448,24 @@ def failed(self, value): with self._failed.get_lock(): self._failed.value = value + def failed_increment(self, value=1): + with self._failed.get_lock(): + self._failed.value += value + @property def total(self): with self._total.get_lock(): return self._total.value + @total.setter + def total(self, value): + with self._total.get_lock(): + self._total.value = value + + def total_increment(self, value=1): + with self._total.get_lock(): + self._total.value += value + class CMake: config_re = re.compile('(CONFIG_[A-Za-z0-9_]+)[=]\"?([^\"]*)\"?$') dt_re = re.compile('([A-Za-z0-9_]+)[=]\"?([^\"]*)\"?$') @@ -652,7 +877,7 @@ def process(self, pipeline, done, message, lock, results): logger.debug("filtering %s" % self.instance.name) self.instance.status = TwisterStatus.FILTER self.instance.reason = "runtime filter" - results.skipped_runtime += 1 + results.skipped_runtime_increment() self.instance.add_missing_case_status(TwisterStatus.SKIP) next_op = 'report' else: @@ -683,7 +908,7 @@ def process(self, pipeline, done, message, lock, results): logger.debug("filtering %s" % self.instance.name) self.instance.status = TwisterStatus.FILTER self.instance.reason = "runtime filter" - results.skipped_runtime += 1 + results.skipped_runtime_increment() self.instance.add_missing_case_status(TwisterStatus.SKIP) next_op = 'report' else: @@ -710,7 +935,7 @@ def process(self, pipeline, done, message, lock, results): # Count skipped cases during build, for example # due to ram/rom overflow. if self.instance.status == TwisterStatus.SKIP: - results.skipped_runtime += 1 + results.skipped_runtime_increment() self.instance.add_missing_case_status(TwisterStatus.SKIP, self.instance.reason) if ret.get('returncode', 1) > 0: @@ -1069,52 +1294,84 @@ def _sanitize_zephyr_base_from_files(self): with open(file_path, "wt") as file: file.write(data) + @staticmethod + def _add_instance_testcases_to_status_counts(instance, results, decrement=False): + increment_value = -1 if decrement else 1 + for tc in instance.testcases: + match tc.status: + case TwisterStatus.PASS: + results.passed_cases_increment(increment_value) + case TwisterStatus.NOTRUN: + results.notrun_cases_increment(increment_value) + case TwisterStatus.BLOCK: + results.blocked_cases_increment(increment_value) + case TwisterStatus.SKIP: + results.skipped_cases_increment(increment_value) + case TwisterStatus.FILTER: + results.filtered_cases_increment(increment_value) + case TwisterStatus.ERROR: + results.error_cases_increment(increment_value) + case TwisterStatus.FAIL: + results.failed_cases_increment(increment_value) + # Statuses that should not appear. + # Crashing Twister at this point would be counterproductive, + # but having those statuses in this part of processing is an error. + case TwisterStatus.NONE: + results.none_cases_increment(increment_value) + logger.error(f'A None status detected in instance {instance.name},' + f' test case {tc.name}.') + case TwisterStatus.STARTED: + results.started_cases_increment(increment_value) + logger.error(f'A started status detected in instance {instance.name},' + f' test case {tc.name}.') + case _: + logger.error(f'An unknown status "{tc.status}" detected in instance {instance.name},' + f' test case {tc.name}.') + + def report_out(self, results): - total_to_do = results.total + total_to_do = results.total - results.skipped_filter total_tests_width = len(str(total_to_do)) - results.done += 1 + results.done_increment() instance = self.instance if results.iteration == 1: - results.cases += len(instance.testcases) + results.cases_increment(len(instance.testcases)) + + self._add_instance_testcases_to_status_counts(instance, results) + + status = f'{TwisterStatus.get_color(instance.status)}{str.upper(instance.status)}{Fore.RESET}' if instance.status in [TwisterStatus.ERROR, TwisterStatus.FAIL]: if instance.status == TwisterStatus.ERROR: - results.error += 1 - txt = " ERROR " + results.error_increment() else: - results.failed += 1 - txt = " FAILED " + results.failed_increment() if self.options.verbose: - status = Fore.RED + txt + Fore.RESET + instance.reason + status += " " + instance.reason else: logger.error( - "{:<25} {:<50} {}{}{}: {}".format( + "{:<25} {:<50} {}: {}".format( instance.platform.name, instance.testsuite.name, - Fore.RED, - txt, - Fore.RESET, + status, instance.reason)) if not self.options.verbose: self.log_info_file(self.options.inline_logs) - elif instance.status in [TwisterStatus.SKIP, TwisterStatus.FILTER]: - status = Fore.YELLOW + "SKIPPED" + Fore.RESET - results.skipped_configs += 1 - # test cases skipped at the test instance level - results.skipped_cases += len(instance.testsuite.testcases) + elif instance.status == TwisterStatus.SKIP: + results.skipped_configs_increment() + elif instance.status == TwisterStatus.FILTER: + results.skipped_configs_increment() elif instance.status == TwisterStatus.PASS: - status = Fore.GREEN + "PASSED" + Fore.RESET - results.passed += 1 + results.passed_increment() for case in instance.testcases: # test cases skipped at the test case level if case.status == TwisterStatus.SKIP: - results.skipped_cases += 1 + results.skipped_cases_increment() elif instance.status == TwisterStatus.NOTRUN: - status = Fore.CYAN + "NOT RUN" + Fore.RESET - results.notrun += 1 + results.notrun_increment() for case in instance.testcases: if case.status == TwisterStatus.SKIP: - results.skipped_cases += 1 + results.skipped_cases_increment() else: logger.debug(f"Unknown status = {instance.status}") status = Fore.YELLOW + "UNKNOWN" + Fore.RESET @@ -1140,7 +1397,7 @@ def report_out(self, results): and self.instance.handler.seed is not None ): more_info += "/seed: " + str(self.options.seed) logger.info("{:>{}}/{} {:<25} {:<50} {} ({})".format( - results.done, total_tests_width, total_to_do , instance.platform.name, + results.done - results.skipped_filter, total_tests_width, total_to_do , instance.platform.name, instance.testsuite.name, status, more_info)) if self.options.verbose > 1: @@ -1155,22 +1412,24 @@ def report_out(self, results): else: completed_perc = 0 if total_to_do > 0: - completed_perc = int((float(results.done) / total_to_do) * 100) + completed_perc = int((float(results.done - results.skipped_filter) / total_to_do) * 100) - sys.stdout.write("INFO - Total complete: %s%4d/%4d%s %2d%% built (not run): %4d, skipped: %s%4d%s, failed: %s%4d%s, error: %s%4d%s\r" % ( - Fore.GREEN, - results.done, + sys.stdout.write("INFO - Total complete: %s%4d/%4d%s %2d%% built (not run): %s%4d%s, filtered: %s%4d%s, failed: %s%4d%s, error: %s%4d%s\r" % ( + TwisterStatus.get_color(TwisterStatus.PASS), + results.done - results.skipped_filter, total_to_do, Fore.RESET, completed_perc, + TwisterStatus.get_color(TwisterStatus.NOTRUN), results.notrun, - Fore.YELLOW if results.skipped_configs > 0 else Fore.RESET, + Fore.RESET, + TwisterStatus.get_color(TwisterStatus.SKIP) if results.skipped_configs > 0 else Fore.RESET, results.skipped_configs, Fore.RESET, - Fore.RED if results.failed > 0 else Fore.RESET, + TwisterStatus.get_color(TwisterStatus.FAIL) if results.failed > 0 else Fore.RESET, results.failed, Fore.RESET, - Fore.RED if results.error > 0 else Fore.RESET, + TwisterStatus.get_color(TwisterStatus.ERROR) if results.error > 0 else Fore.RESET, results.error, Fore.RESET ) @@ -1377,15 +1636,16 @@ def run(self): self.update_counting_before_pipeline() while True: - self.results.iteration += 1 + self.results.iteration_increment() if self.results.iteration > 1: logger.info("%d Iteration:" % (self.results.iteration)) time.sleep(self.options.retry_interval) # waiting for the system to settle down - self.results.done = self.results.total - self.results.failed - self.results.error + self.results.done = self.results.total - self.results.failed self.results.failed = 0 if self.options.retry_build_errors: self.results.error = 0 + self.results.done -= self.results.error else: self.results.done = self.results.skipped_filter @@ -1422,16 +1682,16 @@ def update_counting_before_pipeline(self): ''' for instance in self.instances.values(): if instance.status == TwisterStatus.FILTER and not instance.reason == 'runtime filter': - self.results.skipped_filter += 1 - self.results.skipped_configs += 1 - self.results.skipped_cases += len(instance.testsuite.testcases) - self.results.cases += len(instance.testsuite.testcases) + self.results.skipped_filter_increment() + self.results.skipped_configs_increment() + self.results.filtered_cases_increment(len(instance.testsuite.testcases)) + self.results.cases_increment(len(instance.testsuite.testcases)) elif instance.status == TwisterStatus.ERROR: - self.results.error += 1 + self.results.error_increment() def show_brief(self): logger.info("%d test scenarios (%d test instances) selected, " - "%d configurations skipped (%d by static filter, %d at runtime)." % + "%d configurations filtered (%d by static filter, %d at runtime)." % (len(self.suites), len(self.instances), self.results.skipped_configs, self.results.skipped_filter, @@ -1451,6 +1711,9 @@ def add_tasks_to_queue(self, pipeline, build_only=False, test_only=False, retry_ if instance.status != TwisterStatus.NONE: instance.retries += 1 instance.status = TwisterStatus.NONE + # Previous states should be removed from the stats + if self.results.iteration > 1: + ProjectBuilder._add_instance_testcases_to_status_counts(instance, self.results, decrement=True) # Check if cmake package_helper script can be run in advance. instance.filter_stages = [] diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index 2b088fcb6bfd6..259fd7d1f5b54 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -206,20 +206,31 @@ def test_executioncounter(capfd): sys.stderr.write(err) assert ( - f'--------------------------------\n' - f'Total test suites: 12\n' - f'Total test cases: 25\n' - f'Executed test cases: 19\n' - f'Skipped test cases: 6\n' - f'Completed test suites: 9\n' - f'Passing test suites: 6\n' - f'Built only test suites: 0\n' - f'Failing test suites: 1\n' - f'Skipped test suites: 3\n' - f'Skipped test suites (runtime): 1\n' - f'Skipped test suites (filter): 2\n' - f'Errors: 2\n' - f'--------------------------------' + '--------------------------------------------------\n' + 'Total test suites: 12\n' + 'Processed test suites: 9\n' + '├─ Filtered test suites (static): 2\n' + '└─ Completed test suites: 7\n' + ' ├─ Filtered test suites (at runtime): 1\n' + ' ├─ Passed test suites: 6\n' + ' ├─ Built only test suites: 0\n' + ' ├─ Failed test suites: 1\n' + ' └─ Errors in test suites: 2\n' + '\n' + 'Filtered test suites: 3\n' + '├─ Filtered test suites (static): 2\n' + '└─ Filtered test suites (at runtime): 1\n' + '---------------------- ----------------------\n' + 'Total test cases: 25\n' + '├─ Filtered test cases: 0\n' + '├─ Skipped test cases: 6\n' + '└─ Executed test cases: 19\n' + ' ├─ Passed test cases: 0\n' + ' ├─ Built only test cases: 0\n' + ' ├─ Blocked test cases: 0\n' + ' ├─ Failed test cases: 0\n' + ' └─ Errors in test cases: 0\n' + '--------------------------------------------------\n' ) in out assert ec.cases == 25 @@ -1547,7 +1558,7 @@ def mock_determine_testcases(res): assert pb.instance.status == expected_status assert pb.instance.reason == expected_reason - assert results_mock.skipped_runtime == expected_skipped + assert results_mock.skipped_runtime_increment.call_args_list == [mock.call()] * expected_skipped if expected_missing: pb.instance.add_missing_case_status.assert_called_with(*expected_missing) @@ -1936,16 +1947,16 @@ def mock_open(fname, *args, **kwargs): TwisterStatus.ERROR, True, True, False, ['INFO 20/25 dummy platform' \ ' dummy.testsuite.name' \ - ' ERROR dummy reason (cmake)'], + ' ERROR dummy reason (cmake)'], None ), ( TwisterStatus.FAIL, False, False, False, ['ERROR dummy platform' \ ' dummy.testsuite.name' \ - ' FAILED : dummy reason'], + ' FAILED: dummy reason'], 'INFO - Total complete: 20/ 25 80%' \ - ' built (not run): 0, skipped: 3, failed: 3, error: 1' + ' built (not run): 0, filtered: 3, failed: 3, error: 1' ), ( TwisterStatus.SKIP, True, False, False, @@ -1958,7 +1969,7 @@ def mock_open(fname, *args, **kwargs): TwisterStatus.FILTER, False, False, False, [], 'INFO - Total complete: 20/ 25 80%' \ - ' built (not run): 0, skipped: 4, failed: 2, error: 1' + ' built (not run): 0, filtered: 4, failed: 2, error: 1' ), ( TwisterStatus.PASS, True, False, True, @@ -1979,7 +1990,7 @@ def mock_open(fname, *args, **kwargs): 'unknown status', False, False, False, ['Unknown status = unknown status'], 'INFO - Total complete: 20/ 25 80%' - ' built (not run): 0, skipped: 3, failed: 2, error: 1\r' + ' built (not run): 0, filtered: 3, failed: 2, error: 1\r' ) ] @@ -2026,21 +2037,49 @@ def test_projectbuilder_report_out( pb.options.seed = 123 pb.log_info_file = mock.Mock() - results_mock = mock.Mock() + results_mock = mock.Mock( + total = 25, + done = 19, + passed = 17, + notrun = 0, + failed = 2, + skipped_configs = 3, + skipped_runtime = 0, + skipped_filter = 0, + error = 1, + cases = 0, + filtered_cases = 0, + skipped_cases = 4, + failed_cases = 0, + error_cases = 0, + blocked_cases = 0, + passed_cases = 0, + none_cases = 0, + started_cases = 0 + ) results_mock.iteration = 1 - results_mock.total = 25 - results_mock.done = 19 - results_mock.passed = 17 - results_mock.notrun = 0 - results_mock.skipped_configs = 3 - results_mock.skipped_cases = 4 - results_mock.failed = 2 - results_mock.error = 1 - results_mock.cases = 0 + def results_done_increment(value=1, decrement=False): + results_mock.done += value * (-1 if decrement else 1) + results_mock.done_increment = results_done_increment + def skipped_configs_increment(value=1, decrement=False): + results_mock.skipped_configs += value * (-1 if decrement else 1) + results_mock.skipped_configs_increment = skipped_configs_increment + def skipped_filter_increment(value=1, decrement=False): + results_mock.skipped_filter += value * (-1 if decrement else 1) + results_mock.skipped_filter_increment = skipped_filter_increment + def skipped_runtime_increment(value=1, decrement=False): + results_mock.skipped_runtime += value * (-1 if decrement else 1) + results_mock.skipped_runtime_increment = skipped_runtime_increment + def failed_increment(value=1, decrement=False): + results_mock.failed += value * (-1 if decrement else 1) + results_mock.failed_increment = failed_increment + def notrun_increment(value=1, decrement=False): + results_mock.notrun += value * (-1 if decrement else 1) + results_mock.notrun_increment = notrun_increment pb.report_out(results_mock) - assert results_mock.cases == 25 + assert results_mock.cases_increment.call_args_list == [mock.call(25)] trim_actual_log = re.sub( r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])', @@ -2449,6 +2488,10 @@ def mock_client_from_environ(jobs): results_mock().failed = 2 results_mock().total = 9 + def iteration_increment(value=1, decrement=False): + results_mock().iteration += value * (-1 if decrement else 1) + results_mock().iteration_increment = iteration_increment + with mock.patch('twisterlib.runner.ExecutionCounter', results_mock), \ mock.patch('twisterlib.runner.BaseManager', manager_mock), \ mock.patch('twisterlib.runner.GNUMakeJobClient.from_environ', @@ -2519,18 +2562,45 @@ def test_twisterrunner_update_counting_before_pipeline(): tr = TwisterRunner(instances, suites, env=env_mock) tr.results = mock.Mock( - skipped_filter = 0, + total = 0, + done = 0, + passed = 0, + failed = 0, skipped_configs = 0, - skipped_cases = 0, + skipped_runtime = 0, + skipped_filter = 0, + error = 0, cases = 0, - error = 0 + filtered_cases = 0, + skipped_cases = 0, + failed_cases = 0, + error_cases = 0, + blocked_cases = 0, + passed_cases = 0, + none_cases = 0, + started_cases = 0 ) + def skipped_configs_increment(value=1, decrement=False): + tr.results.skipped_configs += value * (-1 if decrement else 1) + tr.results.skipped_configs_increment = skipped_configs_increment + def skipped_filter_increment(value=1, decrement=False): + tr.results.skipped_filter += value * (-1 if decrement else 1) + tr.results.skipped_filter_increment = skipped_filter_increment + def error_increment(value=1, decrement=False): + tr.results.error += value * (-1 if decrement else 1) + tr.results.error_increment = error_increment + def cases_increment(value=1, decrement=False): + tr.results.cases += value * (-1 if decrement else 1) + tr.results.cases_increment = cases_increment + def filtered_cases_increment(value=1, decrement=False): + tr.results.filtered_cases += value * (-1 if decrement else 1) + tr.results.filtered_cases_increment = filtered_cases_increment tr.update_counting_before_pipeline() assert tr.results.skipped_filter == 1 assert tr.results.skipped_configs == 1 - assert tr.results.skipped_cases == 4 + assert tr.results.filtered_cases == 4 assert tr.results.cases == 4 assert tr.results.error == 1 @@ -2558,7 +2628,7 @@ def test_twisterrunner_show_brief(caplog): tr.show_brief() log = '2 test scenarios (5 test instances) selected,' \ - ' 4 configurations skipped (3 by static filter, 1 at runtime).' + ' 4 configurations filtered (3 by static filter, 1 at runtime).' assert log in caplog.text @@ -2609,6 +2679,7 @@ def mock_get_cmake_filter_stages(filter, keys): tr.get_cmake_filter_stages = mock.Mock( side_effect=mock_get_cmake_filter_stages ) + tr.results = mock.Mock(iteration=0) pipeline_mock = mock.Mock() diff --git a/scripts/tests/twister_blackbox/test_device.py b/scripts/tests/twister_blackbox/test_device.py index 0ec9ae0322fe7..b6e78acc28b7a 100644 --- a/scripts/tests/twister_blackbox/test_device.py +++ b/scripts/tests/twister_blackbox/test_device.py @@ -13,6 +13,7 @@ import sys import re +# pylint: disable=no-name-in-module from conftest import ZEPHYR_BASE, TEST_DATA, testsuite_filename_mock from twisterlib.testplan import TestPlan @@ -71,5 +72,5 @@ def test_seed(self, capfd, out_path, seed): assert str(sys_exit.value) == '1' - expected_line = r'seed_native_sim.dummy FAILED Failed \(native (\d+\.\d+)s/seed: {}\)'.format(seed[0]) + expected_line = r'seed_native_sim.dummy FAILED Failed \(native (\d+\.\d+)s/seed: {}\)'.format(seed[0]) assert re.search(expected_line, err) diff --git a/scripts/tests/twister_blackbox/test_error.py b/scripts/tests/twister_blackbox/test_error.py index 3c18d8398bab3..ba43731e09734 100644 --- a/scripts/tests/twister_blackbox/test_error.py +++ b/scripts/tests/twister_blackbox/test_error.py @@ -13,6 +13,7 @@ import sys import re +# pylint: disable=no-name-in-module from conftest import ZEPHYR_BASE, TEST_DATA, testsuite_filename_mock from twisterlib.testplan import TestPlan from twisterlib.error import TwisterRuntimeError @@ -45,7 +46,7 @@ class TestError: ), ( '--overflow-as-errors', - r'always_overflow.dummy ERROR Build failure \(build\)' + r'always_overflow.dummy ERROR Build failure \(build\)' ) ] diff --git a/scripts/tests/twister_blackbox/test_platform.py b/scripts/tests/twister_blackbox/test_platform.py index d9d3b145b6c19..75a6cda909309 100644 --- a/scripts/tests/twister_blackbox/test_platform.py +++ b/scripts/tests/twister_blackbox/test_platform.py @@ -28,6 +28,7 @@ class TestPlatform: { 'selected_test_scenarios': 3, 'selected_test_instances': 9, + 'executed_test_instances': 6, 'skipped_configurations': 3, 'skipped_by_static_filter': 3, 'skipped_at_runtime': 0, @@ -48,6 +49,7 @@ class TestPlatform: { 'selected_test_scenarios': 1, 'selected_test_instances': 3, + 'executed_test_instances': 0, 'skipped_configurations': 3, 'skipped_by_static_filter': 3, 'skipped_at_runtime': 0, @@ -190,8 +192,9 @@ def test_any_platform(self, capfd, out_path, test_path, test_platforms, flag): os.path.join(TEST_DATA, 'tests', 'dummy', 'agnostic'), ['qemu_x86', 'qemu_x86_64'], { - 'passed_configurations': 2, 'selected_test_instances': 6, + 'passed_configurations': 2, + 'executed_test_instances': 3, 'executed_on_platform': 2, 'only_built': 1, } @@ -217,7 +220,7 @@ def test_exclude_platform(self, capfd, out_path, test_path, test_platforms, expe sys.stderr.write(err) pass_regex = r'^INFO - (?P[0-9]+) of' \ - r' (?P[0-9]+) test configurations passed' + r' (?P[0-9]+) executed test configurations passed' built_regex = r'^INFO - (?P[0-9]+)' \ r' test configurations executed on platforms, (?P[0-9]+)' \ @@ -229,7 +232,7 @@ def test_exclude_platform(self, capfd, out_path, test_path, test_platforms, expe assert int(pass_search.group('passed_configurations')) == \ expected['passed_configurations'] assert int(pass_search.group('test_instances')) == \ - expected['selected_test_instances'] + expected['executed_test_instances'] built_search = re.search(built_regex, err, re.MULTILINE) @@ -262,22 +265,31 @@ def test_emulation_only(self, capfd, out_path, test_path, test_platforms, expect select_regex = r'^INFO - (?P[0-9]+) test scenarios' \ r' \((?P[0-9]+) test instances\) selected,' \ - r' (?P[0-9]+) configurations skipped' \ + r' (?P[0-9]+) configurations filtered' \ r' \((?P[0-9]+) by static filter,' \ r' (?P[0-9]+) at runtime\)\.$' pass_regex = r'^INFO - (?P[0-9]+) of' \ - r' (?P[0-9]+) test configurations passed' \ + r' (?P[0-9]+) executed test configurations passed' \ r' \([0-9]+\.[0-9]+%\), (?P[0-9]+) built \(not run\),' \ r' (?P[0-9]+) failed,' \ r' (?P[0-9]+) errored,' \ - r' (?P[0-9]+) skipped with' \ - r' [0-9]+ warnings in [0-9]+\.[0-9]+ seconds$' - - case_regex = r'^INFO - In total (?P[0-9]+)' \ - r' test cases were executed, (?P[0-9]+) skipped' \ - r' on (?P[0-9]+) out of total [0-9]+ platforms' \ - r' \([0-9]+\.[0-9]+%\)$' + r' with (?:[0-9]+|no) warnings in [0-9]+\.[0-9]+ seconds.$' + + case_regex = r'^INFO - (?P[0-9]+) of' \ + r' (?P[0-9]+) executed test cases passed' \ + r' \([0-9]+\.[0-9]+%\)' \ + r'(?:, (?P[0-9]+) blocked)?' \ + r'(?:, (?P[0-9]+) failed)?' \ + r'(?:, (?P[0-9]+) errored)?' \ + r'(?:, (?P[0-9]+) without a status)?' \ + r' on (?P[0-9]+) out of total' \ + r' (?P[0-9]+) platforms \([0-9]+\.[0-9]+%\)' + + skip_regex = r'(?P[0-9]+) selected test cases not executed:' \ + r'(?: (?P[0-9]+) skipped)?' \ + r'(?:, (?P[0-9]+) filtered)?' \ + r'.' built_regex = r'^INFO - (?P[0-9]+)' \ r' test configurations executed on platforms, (?P[0-9]+)' \ @@ -306,27 +318,32 @@ def test_emulation_only(self, capfd, out_path, test_path, test_platforms, expect assert pass_search assert int(pass_search.group('passed_configurations')) == \ expected['passed_configurations'] - assert int(pass_search.group('test_instances')) == \ - expected['selected_test_instances'] assert int(pass_search.group('built_configurations')) == \ expected['built_configurations'] - assert int(pass_search.group('failed_configurations')) == \ - expected['failed_configurations'] - assert int(pass_search.group('errored_configurations')) == \ - expected['errored_configurations'] - assert int(pass_search.group('skipped_configurations')) == \ - expected['skipped_configurations'] + assert int(pass_search.group('executed_test_instances')) == \ + expected['executed_test_instances'] + if expected['failed_configurations']: + assert int(pass_search.group('failed_configurations')) == \ + expected['failed_configurations'] + if expected['errored_configurations']: + assert int(pass_search.group('errored_configurations')) == \ + expected['errored_configurations'] case_search = re.search(case_regex, err, re.MULTILINE) assert case_search assert int(case_search.group('executed_test_cases')) == \ expected['executed_test_cases'] - assert int(case_search.group('skipped_test_cases')) == \ - expected['skipped_test_cases'] assert int(case_search.group('platform_count')) == \ expected['platform_count'] + if expected['skipped_test_cases']: + skip_search = re.search(skip_regex, err, re.MULTILINE) + + assert skip_search + assert int(skip_search.group('skipped_test_cases')) == \ + expected['skipped_test_cases'] + built_search = re.search(built_regex, err, re.MULTILINE) assert built_search diff --git a/scripts/tests/twister_blackbox/test_runner.py b/scripts/tests/twister_blackbox/test_runner.py index e414e24fe25aa..865826741adc2 100644 --- a/scripts/tests/twister_blackbox/test_runner.py +++ b/scripts/tests/twister_blackbox/test_runner.py @@ -131,7 +131,7 @@ class TestRunner: ['dummy.agnostic.group2 SKIPPED: Command line testsuite tag filter', 'dummy.agnostic.group1.subgroup2 SKIPPED: Command line testsuite tag filter', 'dummy.agnostic.group1.subgroup1 SKIPPED: Command line testsuite tag filter', - r'0 of 4 test configurations passed \(0.00%\), 0 built \(not run\), 0 failed, 0 errored, 4 skipped' + r'0 of 0 executed test configurations passed \(0.00%\), 0 built \(not run\), 0 failed, 0 errored' ] ), ( @@ -139,14 +139,14 @@ class TestRunner: ['qemu_x86/atom'], ['subgrouped'], ['dummy.agnostic.group2 SKIPPED: Command line testsuite tag filter', - r'1 of 4 test configurations passed \(50.00%\), 1 built \(not run\), 0 failed, 0 errored, 2 skipped' + r'1 of 2 executed test configurations passed \(50.00%\), 1 built \(not run\), 0 failed, 0 errored' ] ), ( os.path.join(TEST_DATA, 'tests', 'dummy'), ['qemu_x86/atom'], ['agnostic', 'device'], - [r'2 of 4 test configurations passed \(66.67%\), 1 built \(not run\), 0 failed, 0 errored, 1 skipped'] + [r'2 of 3 executed test configurations passed \(66.67%\), 1 built \(not run\), 0 failed, 0 errored'] ), ] TESTDATA_10 = [ @@ -261,22 +261,32 @@ def test_runtest_only(self, capfd, out_path, test_path, test_platforms, expected select_regex = r'^INFO - (?P[0-9]+) test scenarios' \ r' \((?P[0-9]+) test instances\) selected,' \ - r' (?P[0-9]+) configurations skipped' \ + r' (?P[0-9]+) configurations filtered' \ r' \((?P[0-9]+) by static filter,' \ r' (?P[0-9]+) at runtime\)\.$' pass_regex = r'^INFO - (?P[0-9]+) of' \ - r' (?P[0-9]+) test configurations passed' \ + r' (?P[0-9]+) executed test configurations passed' \ r' \([0-9]+\.[0-9]+%\), (?P[0-9]+) built \(not run\),' \ r' (?P[0-9]+) failed,' \ - r' (?P[0-9]+) errored,' \ - r' (?P[0-9]+) skipped with' \ - r' [0-9]+ warnings in [0-9]+\.[0-9]+ seconds$' - - case_regex = r'^INFO - In total (?P[0-9]+)' \ - r' test cases were executed, (?P[0-9]+) skipped' \ - r' on (?P[0-9]+) out of total [0-9]+ platforms' \ - r' \([0-9]+\.[0-9]+%\)$' + r' (?P[0-9]+) errored, with' \ + r' (?:[0-9]+|no) warnings in [0-9]+\.[0-9]+ seconds.$' + + case_regex = r'^INFO - (?P[0-9]+) of' \ + r' (?P[0-9]+) executed test cases passed' \ + r' \([0-9]+\.[0-9]+%\)' \ + r'(?:, (?P[0-9]+) blocked)?' \ + r'(?:, (?P[0-9]+) failed)?' \ + r'(?:, (?P[0-9]+) errored)?' \ + r'(?:, (?P[0-9]+) without a status)?' \ + r' on (?P[0-9]+) out of total' \ + r' (?P[0-9]+) platforms \([0-9]+\.[0-9]+%\)' + + skip_regex = r'(?P[0-9]+) selected test cases not executed:' \ + r'(?: (?P[0-9]+) skipped)?' \ + r'(?:, (?P[0-9]+) filtered)?' \ + r'.' + built_regex = r'^INFO - (?P[0-9]+)' \ r' test configurations executed on platforms, (?P[0-9]+)' \ r' test configurations were only built.$' @@ -312,19 +322,21 @@ def test_runtest_only(self, capfd, out_path, test_path, test_platforms, expected expected['failed_configurations'] assert int(pass_search.group('errored_configurations')) == \ expected['errored_configurations'] - assert int(pass_search.group('skipped_configurations')) == \ - expected['skipped_configurations'] case_search = re.search(case_regex, err, re.MULTILINE) assert case_search assert int(case_search.group('executed_test_cases')) == \ expected['executed_test_cases'] - assert int(case_search.group('skipped_test_cases')) == \ - expected['skipped_test_cases'] assert int(case_search.group('platform_count')) == \ expected['platform_count'] + if expected['skipped_test_cases']: + skip_search = re.search(skip_regex, err, re.MULTILINE) + assert skip_search + assert int(skip_search.group('skipped_test_cases')) == \ + expected['skipped_test_cases'] + built_search = re.search(built_regex, err, re.MULTILINE) assert built_search @@ -384,7 +396,7 @@ def test_cmake_only(self, capfd, out_path, test_path, test_platforms, expected): sys.stderr.write(err) pass_regex = r'^INFO - (?P[0-9]+) of' \ - r' (?P[0-9]+) test configurations passed' + r' (?P[0-9]+) executed test configurations passed' built_regex = r'^INFO - (?P[0-9]+)' \ r' test configurations executed on platforms, (?P[0-9]+)' \ @@ -614,14 +626,18 @@ def test_only_failed(self, capfd, out_path, test_path, test_platforms, expected) pytest.raises(SystemExit) as sys_exit: self.loader.exec_module(self.twister_module) + select_regex = r'^INFO - (?P[0-9]+) test scenarios' \ + r' \((?P[0-9]+) test instances\) selected,' \ + r' (?P[0-9]+) configurations filtered' \ + r' \((?P[0-9]+) by static filter,' \ + r' (?P[0-9]+) at runtime\)\.$' pass_regex = r'^INFO - (?P[0-9]+) of' \ - r' (?P[0-9]+) test configurations passed' \ + r' (?P[0-9]+) executed test configurations passed' \ r' \([0-9]+\.[0-9]+%\), (?P[0-9]+) built \(not run\),' \ r' (?P[0-9]+) failed,' \ - r' (?P[0-9]+) errored,' \ - r' (?P[0-9]+) skipped with' \ - r' [0-9]+ warnings in [0-9]+\.[0-9]+ seconds$' + r' (?P[0-9]+) errored, with' \ + r' (?:[0-9]+|no) warnings in [0-9]+\.[0-9]+ seconds.$' out, err = capfd.readouterr() sys.stdout.write(out) @@ -631,6 +647,11 @@ def test_only_failed(self, capfd, out_path, test_path, test_platforms, expected) assert re.search( r'one_fail_one_pass.agnostic.group1.subgroup2 on qemu_x86/atom failed \(.*\)', err) + + select_search = re.search(select_regex, err, re.MULTILINE) + assert int(select_search.group('skipped_configurations')) == \ + expected['skipped_configurations'] + pass_search = re.search(pass_regex, err, re.MULTILINE) assert pass_search @@ -644,8 +665,6 @@ def test_only_failed(self, capfd, out_path, test_path, test_platforms, expected) expected['failed_configurations'] assert int(pass_search.group('errored_configurations')) == \ expected['errored_configurations'] - assert int(pass_search.group('skipped_configurations')) == \ - expected['skipped_configurations'] assert str(sys_exit.value) == '1' From 59b2163eeb160aa636beeeab4b474820d17fa5cb Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Tue, 8 Oct 2024 11:39:42 -0700 Subject: [PATCH 1991/4482] cmake: toolchain/xt-clang: force assembler ID to GNU xt-clang uses GNU Assembler (xt-as) based on binutils. However, CMake doesn't recognize it when invoking through xt-clang. This results in CMake going through all possible combinations of command line arguments while invoking xt-clang to determine assembler vendor. This multiple invocation of xt-clang unnecessarily lengthens the CMake phase of build, especially when xt-clang needs to obtain license information from remote licensing servers. So here forces the assembler ID to be GNU to speed things up a bit. Signed-off-by: Daniel Leung --- cmake/toolchain/xt-clang/generic.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmake/toolchain/xt-clang/generic.cmake b/cmake/toolchain/xt-clang/generic.cmake index e2293a5cff828..66a56a2adb157 100644 --- a/cmake/toolchain/xt-clang/generic.cmake +++ b/cmake/toolchain/xt-clang/generic.cmake @@ -7,4 +7,14 @@ set(CC clang) set(C++ clang++) set(LINKER xt-ld) +# xt-clang uses GNU Assembler (xt-as) based on binutils. +# However, CMake doesn't recognize it when invoking through xt-clang. +# This results in CMake going through all possible combinations of +# command line arguments while invoking xt-clang to determine +# assembler vendor. This multiple invocation of xt-clang unnecessarily +# lengthens the CMake phase of build, especially when xt-clang needs to +# obtain license information from remote licensing servers. So here +# forces the assembler ID to be GNU to speed things up a bit. +set(CMAKE_ASM_COMPILER_ID "GNU") + message(STATUS "Found toolchain: xt-clang (${XTENSA_TOOLCHAIN_PATH})") From cdb9166b810cb7b663a52b13b6b866b4edca04c6 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Tue, 8 Oct 2024 11:41:29 -0700 Subject: [PATCH 1992/4482] cmake: toolchain/xcc,xt-clang: env vars for multiple cores To use Xtensa toolchain, various environment variables must be set so the executables can find necessary files and what core to compile for. This becomes an annoyance when you have to test multiple boards with different cores. You have to use one set of environment variables per core. Twister cannot test them all in one setting, and it is especially annoying doing west builds. So enhance the environment variables handling so that TOOLCHAIN_VER and XTENSA_CORE can be replaced by TOOLCHAIN_VAR_ and XTENSA_CORE_ where is the normalized board target (think .yaml). CMake will then figure out the core ID for the toolchain to use. Signed-off-by: Daniel Leung --- arch/xtensa/core/CMakeLists.txt | 2 +- cmake/compiler/xcc/generic.cmake | 4 +-- cmake/toolchain/xcc/common.cmake | 24 ++++++++++++- doc/develop/toolchains/cadence_xcc.rst | 47 ++++++++++++++++++++------ 4 files changed, 62 insertions(+), 15 deletions(-) diff --git a/arch/xtensa/core/CMakeLists.txt b/arch/xtensa/core/CMakeLists.txt index d03e3641b42b4..7d7e260ca0b08 100644 --- a/arch/xtensa/core/CMakeLists.txt +++ b/arch/xtensa/core/CMakeLists.txt @@ -53,7 +53,7 @@ set(CORE_ISA_DM ${CMAKE_BINARY_DIR}/zephyr/include/generated/zephyr/core-isa-dM. set(CORE_ISA_IN ${CMAKE_BINARY_DIR}/zephyr/include/generated/core-isa-dM.c) file(WRITE ${CORE_ISA_IN} "#include \n") add_custom_command(OUTPUT ${CORE_ISA_DM} - COMMAND ${CMAKE_C_COMPILER} -E -dM -U__XCC__ + COMMAND ${CMAKE_C_COMPILER} -E -dM -U__XCC__ ${XTENSA_CORE_LOCAL_C_FLAG} -I${ZEPHYR_XTENSA_MODULE_DIR}/zephyr/soc/${CONFIG_SOC} -I${SOC_FULL_DIR} ${CORE_ISA_IN} -o ${CORE_ISA_DM}) diff --git a/cmake/compiler/xcc/generic.cmake b/cmake/compiler/xcc/generic.cmake index b6be58ceb9f46..d9020bf59bff8 100644 --- a/cmake/compiler/xcc/generic.cmake +++ b/cmake/compiler/xcc/generic.cmake @@ -17,13 +17,13 @@ TOOLCHAIN_VER: ${TOOLCHAIN_VER} endif() execute_process( - COMMAND ${CMAKE_C_COMPILER} --version + COMMAND ${CMAKE_C_COMPILER} --version ${XTENSA_CORE_LOCAL_C_FLAG} RESULT_VARIABLE ret OUTPUT_VARIABLE stdoutput ) if(ret) message(FATAL_ERROR "Executing the below command failed. Are permissions set correctly? - ${CMAKE_C_COMPILER} --version + ${CMAKE_C_COMPILER} --version ${XTENSA_CORE_LOCAL_C_FLAG} ${stdoutput} " ) diff --git a/cmake/toolchain/xcc/common.cmake b/cmake/toolchain/xcc/common.cmake index 7bca32f4e454b..06127567a30f1 100644 --- a/cmake/toolchain/xcc/common.cmake +++ b/cmake/toolchain/xcc/common.cmake @@ -7,7 +7,29 @@ if(NOT EXISTS ${XTENSA_TOOLCHAIN_PATH}) message(FATAL_ERROR "Nothing found at XTENSA_TOOLCHAIN_PATH: '${XTENSA_TOOLCHAIN_PATH}'") endif() -set(TOOLCHAIN_HOME ${XTENSA_TOOLCHAIN_PATH}/$ENV{TOOLCHAIN_VER}/XtensaTools) +zephyr_get(TOOLCHAIN_VER) +if(DEFINED TOOLCHAIN_VER) + set(XTENSA_TOOLCHAIN_VER ${TOOLCHAIN_VER}) +else() + zephyr_get(TOOLCHAIN_VER_${NORMALIZED_BOARD_TARGET}) + if(DEFINED TOOLCHAIN_VER_${NORMALIZED_BOARD_TARGET}) + set(XTENSA_TOOLCHAIN_VER ${TOOLCHAIN_VER_${NORMALIZED_BOARD_TARGET}}) + else() + message(FATAL "Environment variable TOOLCHAIN_VER must be set or given as -DTOOLCHAIN_VER=") + endif() +endif() + +zephyr_get(XTENSA_CORE_${NORMALIZED_BOARD_TARGET}) +if(DEFINED XTENSA_CORE_${NORMALIZED_BOARD_TARGET}) + set(XTENSA_CORE_LOCAL_C_FLAG "--xtensa-core=${XTENSA_CORE_${NORMALIZED_BOARD_TARGET}}") + list(APPEND TOOLCHAIN_C_FLAGS "--xtensa-core=${XTENSA_CORE_${NORMALIZED_BOARD_TARGET}}") +else() + # Not having XTENSA_CORE is not necessarily fatal as + # the toolchain can have a default core configuration to use. + set(XTENSA_CORE_LOCAL_C_FLAG) +endif() + +set(TOOLCHAIN_HOME ${XTENSA_TOOLCHAIN_PATH}/${XTENSA_TOOLCHAIN_VER}/XtensaTools) set(LINKER ld) set(BINTOOLS gnu) diff --git a/doc/develop/toolchains/cadence_xcc.rst b/doc/develop/toolchains/cadence_xcc.rst index f1de7ed1e5348..5826985f56d41 100644 --- a/doc/develop/toolchains/cadence_xcc.rst +++ b/doc/develop/toolchains/cadence_xcc.rst @@ -31,21 +31,46 @@ Cadence Tensilica Xtensa C/C++ Compiler (XCC) * Set :envvar:`ZEPHYR_TOOLCHAIN_VARIANT` to ``xcc`` or ``xt-clang``. * Set :envvar:`XTENSA_TOOLCHAIN_PATH` to the toolchain installation directory. - * Set :envvar:`XTENSA_CORE` to the SoC ID where application is being - targeting. - * Set :envvar:`TOOLCHAIN_VER` to the Xtensa SDK version. + + * There are two ways to specify the SoC ID and the SDK version to use. + They are mutually exclusive, and cannot be used together. + + #. When building for a single SoC: + + * Set :envvar:`XTENSA_CORE` to the SoC ID where application is being + targeted. + * Set :envvar:`TOOLCHAIN_VER` to the Xtensa SDK version. + + #. When building for multiple SoCs, for each SoC and board combination: + + * Set :envvar:`XTENSA_CORE_{normalized_board_target}` + to the SoC ID where application is being targeted. + * Set :envvar:`TOOLCHAIN_VAR_{normalized_board_target}` + to the Xtensa SDK version. #. For example, assuming the SDK is installed in ``/opt/xtensa``, and - using the SDK for application development on ``intel_adsp_cavs15``, - setup the environment using: + using the SDK for application development on ``intel_adsp/ace15_mtpm``, + setup the environment using the two above mentioned ways: + + #. Single SoC: + + .. code-block:: console + + # Linux + export ZEPHYR_TOOLCHAIN_VARIANT=xt-clang + export XTENSA_TOOLCHAIN_PATH=/opt/xtensa/XtDevTools/install/tools/ + export XTENSA_CORE=ace10_LX7HiFi4_2022_10 + export TOOLCHAIN_VER=RI-2022.10-linux + + #. Muiltiple SoCs: - .. code-block:: console + .. code-block:: console - # Linux - export ZEPHYR_TOOLCHAIN_VARIANT=xcc - export XTENSA_TOOLCHAIN_PATH=/opt/xtensa/XtDevTools/install/tools/ - export XTENSA_CORE=X6H3SUE_RI_2018_0 - export TOOLCHAIN_VER=RI-2018.0-linux + # Linux + export ZEPHYR_TOOLCHAIN_VARIANT=xt-clang + export XTENSA_TOOLCHAIN_PATH=/opt/xtensa/XtDevTools/install/tools/ + export TOOLCHAIN_VER_intel_adsp_ace15_mtpm=RI-2022.10-linux + export XTENSA_CORE_intel_adsp_ace15_mtpm=ace10_LX7HiFi4_2022_10 #. To use Clang-based compiler: From e31bf8bf50d98f53f9eb63f95484674d64ac14b8 Mon Sep 17 00:00:00 2001 From: Armin Kessler Date: Thu, 31 Oct 2024 08:46:35 +0100 Subject: [PATCH 1993/4482] scripts: twister: Add Espressif as manufacturer Adds Espressif as manufacturer so that generation of HW-Map file is possible Signed-off-by: Armin Kessler --- scripts/pylib/twister/twisterlib/hardwaremap.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/pylib/twister/twisterlib/hardwaremap.py b/scripts/pylib/twister/twisterlib/hardwaremap.py index 616538002809d..3b03b830aeff0 100644 --- a/scripts/pylib/twister/twisterlib/hardwaremap.py +++ b/scripts/pylib/twister/twisterlib/hardwaremap.py @@ -147,7 +147,8 @@ class HardwareMap: 'FTDI', 'Digilent', 'Microsoft', - 'Nuvoton' + 'Nuvoton', + 'Espressif', ] runner_mapping = { From 78f688a3e710fc8294fbc99d1bc4e676100ef213 Mon Sep 17 00:00:00 2001 From: Armin Kessler Date: Thu, 31 Oct 2024 08:33:02 +0100 Subject: [PATCH 1994/4482] scripts: twister: Fix serial_py referenced before assignment This fixes `serial_py referenced before assignment` if `flash_before` is set. Signed-off-by: Armin Kessler --- scripts/pylib/twister/twisterlib/hardwaremap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pylib/twister/twisterlib/hardwaremap.py b/scripts/pylib/twister/twisterlib/hardwaremap.py index 3b03b830aeff0..2bb0a5a54ebff 100644 --- a/scripts/pylib/twister/twisterlib/hardwaremap.py +++ b/scripts/pylib/twister/twisterlib/hardwaremap.py @@ -258,6 +258,7 @@ def load(self, map_file): flash_with_test = dut.get('flash_with_test') if flash_with_test is None: flash_with_test = self.options.device_flash_with_test + serial_pty = dut.get('serial_pty') flash_before = dut.get('flash_before') if flash_before is None: flash_before = self.options.flash_before and (not (flash_with_test or serial_pty)) @@ -265,7 +266,6 @@ def load(self, map_file): id = dut.get('id') runner = dut.get('runner') runner_params = dut.get('runner_params') - serial_pty = dut.get('serial_pty') serial = dut.get('serial') baud = dut.get('baud', None) product = dut.get('product') From 7015a0ee3787c61d998c8bdd5ac70b77955d9ea7 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Tue, 29 Oct 2024 16:33:13 +0000 Subject: [PATCH 1995/4482] arch: arm: cortex_m: move _main in input list Move the _main argument to the input list rather than the output one on the asm block and change the spec to "r". The ASM block does not return, so it does not make sense for it to expect any output. Signed-off-by: Wilfried Chauveau Signed-off-by: Fabio Baltieri --- arch/arm/core/cortex_m/thread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/core/cortex_m/thread.c b/arch/arm/core/cortex_m/thread.c index fa500032d3cc0..4cadc4e72bf5d 100644 --- a/arch/arm/core/cortex_m/thread.c +++ b/arch/arm/core/cortex_m/thread.c @@ -586,8 +586,8 @@ void arch_switch_to_main_thread(struct k_thread *main_thread, char *stack_ptr, "mov r3, #0\n" "ldr r4, =z_thread_entry\n" "bx r4\n" /* We don’t intend to return, so there is no need to link. */ - : "+r" (_main) - : "r" (stack_ptr) + : + : "r" (_main), "r" (stack_ptr) : "r0", "r1", "r2", "r3", "r4", "ip", "lr"); CODE_UNREACHABLE; From 63890e2526552dd4dc01e17d150fa4a462b2107a Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Tue, 29 Oct 2024 16:35:08 +0000 Subject: [PATCH 1996/4482] arch: arm: cortex_m: add memory to the clobber list Add "memory" to the clobber list" From GCC 14 the compiler optimizes away memory accesses that do not impact the asm block. Adding the memory to the clobber list lets the compiler know that the memory state is to be preserved. Signed-off-by: Wilfried Chauveau Signed-off-by: Fabio Baltieri --- arch/arm/core/cortex_m/thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/core/cortex_m/thread.c b/arch/arm/core/cortex_m/thread.c index 4cadc4e72bf5d..6cd7144e79d17 100644 --- a/arch/arm/core/cortex_m/thread.c +++ b/arch/arm/core/cortex_m/thread.c @@ -588,7 +588,7 @@ void arch_switch_to_main_thread(struct k_thread *main_thread, char *stack_ptr, "bx r4\n" /* We don’t intend to return, so there is no need to link. */ : : "r" (_main), "r" (stack_ptr) - : "r0", "r1", "r2", "r3", "r4", "ip", "lr"); + : "r0", "r1", "r2", "r3", "r4", "ip", "lr", "memory"); CODE_UNREACHABLE; } From ecf308e8de42b1ff03c0ba62867751d0e397679b Mon Sep 17 00:00:00 2001 From: Filip Kokosinski Date: Tue, 29 Oct 2024 12:22:04 +0100 Subject: [PATCH 1997/4482] dts/andes: adjust the sizes of PLIC nodes This commit adjusts the sizes of the two PLIC nodes AE350 defines: * `plic0` size is changed from `0x04000000` to `0x02000000` * `plic_sw` size is changed from `0x04000000` to `0x00400000` Without these change, `plic0` address space would overlap with `plic_sw`, and with other memory-mapped peripherals. Signed-off-by: Filip Kokosinski --- dts/riscv/andes/andes_v5_ae350.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dts/riscv/andes/andes_v5_ae350.dtsi b/dts/riscv/andes/andes_v5_ae350.dtsi index a4edbb613c083..538de399af94b 100644 --- a/dts/riscv/andes/andes_v5_ae350.dtsi +++ b/dts/riscv/andes/andes_v5_ae350.dtsi @@ -170,7 +170,7 @@ #address-cells = <1>; #interrupt-cells = <2>; interrupt-controller; - reg = <0xe4000000 0x04000000>; + reg = <0xe4000000 0x02000000>; riscv,max-priority = <255>; riscv,ndev = <1023>; interrupts-extended = <&cpu0_intc 11 &cpu1_intc 11 @@ -184,7 +184,7 @@ #address-cells = <1>; #interrupt-cells = <2>; interrupt-controller; - reg = <0xe6400000 0x04000000>; + reg = <0xe6400000 0x00400000>; riscv,max-priority = <255>; riscv,ndev = <1023>; interrupts-extended = <&cpu0_intc 3 &cpu1_intc 3 From d137527f88fcef806dffe418e2c6585dcfecfd57 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Sun, 27 Oct 2024 02:20:20 +0530 Subject: [PATCH 1998/4482] boards: nordic: Fix the label for nRF70 SR co-existence The co-existence modules expect a common and fixed name, so, rename it to avoid churn. Signed-off-by: Chaitanya Tata --- boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet.dts | 2 +- boards/shields/nrf7002eb/nrf7002eb_coex.overlay | 2 +- boards/shields/nrf7002ek/nrf7002ek_coex.overlay | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet.dts b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet.dts index 8e36e678581ac..faea5ee69e3ef 100644 --- a/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet.dts +++ b/boards/nordic/nrf7002dk/nrf7002dk_nrf5340_cpunet.dts @@ -82,7 +82,7 @@ <21 0 &gpio1 3 0>; /* D15 */ }; - nrf70: coex { + nrf_radio_coex: coex { status = "okay"; compatible = "nordic,nrf7002-coex"; diff --git a/boards/shields/nrf7002eb/nrf7002eb_coex.overlay b/boards/shields/nrf7002eb/nrf7002eb_coex.overlay index 59007ebe58eb5..09bfb6e1906ae 100644 --- a/boards/shields/nrf7002eb/nrf7002eb_coex.overlay +++ b/boards/shields/nrf7002eb/nrf7002eb_coex.overlay @@ -5,7 +5,7 @@ */ / { - nrf70: coex { + nrf_radio_coex: coex { compatible = "nordic,nrf7002-coex"; status = "okay"; diff --git a/boards/shields/nrf7002ek/nrf7002ek_coex.overlay b/boards/shields/nrf7002ek/nrf7002ek_coex.overlay index 4b592acbfb231..60ff3ca6ea42f 100644 --- a/boards/shields/nrf7002ek/nrf7002ek_coex.overlay +++ b/boards/shields/nrf7002ek/nrf7002ek_coex.overlay @@ -5,7 +5,7 @@ */ / { - nrf70: coex { + nrf_radio_coex: coex { compatible = "nordic,nrf7002-coex"; status = "okay"; From bb2f602b7eb7f5291455cb2aa247cb91e509171a Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 28 Oct 2024 01:18:13 +0530 Subject: [PATCH 1999/4482] shields: nrf7002eb: Add missing SR RF switch GPIO This causes a build error as nRF70 driver running on CPU APP needs this when SR co-existence is enabled. Signed-off-by: Chaitanya Tata --- boards/shields/nrf7002eb/nrf7002eb.overlay | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/shields/nrf7002eb/nrf7002eb.overlay b/boards/shields/nrf7002eb/nrf7002eb.overlay index d580a2efb8c00..7f9074da9d0c8 100644 --- a/boards/shields/nrf7002eb/nrf7002eb.overlay +++ b/boards/shields/nrf7002eb/nrf7002eb.overlay @@ -24,6 +24,7 @@ bucken-gpios = <&edge_connector 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; iovdd-ctrl-gpios = <&edge_connector 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>; host-irq-gpios = <&edge_connector 19 GPIO_ACTIVE_HIGH>; + srrf-switch-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; wlan0: wlan0 { compatible = "nordic,wlan"; From 1ea569d7764a3b12fe9cd5841ee6c9b73bad7a5b Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Wed, 23 Oct 2024 16:41:17 +0300 Subject: [PATCH 2000/4482] net: lib: coap_client: Protect initialization with mutex Protect global list of clients with mutex. Signed-off-by: Seppo Takalo --- subsys/net/lib/coap/coap_client.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index f1ced3a9cdcdc..763ee412c1f9e 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -20,6 +20,7 @@ LOG_MODULE_DECLARE(net_coap, CONFIG_COAP_LOG_LEVEL); #define BLOCK1_OPTION_SIZE 4 #define PAYLOAD_MARKER_SIZE 1 +static K_MUTEX_DEFINE(coap_client_mutex); static struct coap_client *clients[CONFIG_COAP_CLIENT_MAX_INSTANCES]; static int num_clients; static K_SEM_DEFINE(coap_client_recv_sem, 0, 1); @@ -1006,7 +1007,9 @@ int coap_client_init(struct coap_client *client, const char *info) return -EINVAL; } + k_mutex_lock(&coap_client_mutex, K_FOREVER); if (num_clients >= CONFIG_COAP_CLIENT_MAX_INSTANCES) { + k_mutex_unlock(&coap_client_mutex); return -ENOSPC; } @@ -1015,6 +1018,7 @@ int coap_client_init(struct coap_client *client, const char *info) clients[num_clients] = client; num_clients++; + k_mutex_unlock(&coap_client_mutex); return 0; } From 46b7c8451291cb88ee72d22b367ff1b70062aca5 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Wed, 23 Oct 2024 16:42:41 +0300 Subject: [PATCH 2001/4482] net: lib: coap_client: Release internal request when failed to send When transmission of first request fails, reset the internal request buffer as there is no ongoing CoAP transaction. Application can deal with the failure. Signed-off-by: Seppo Takalo --- subsys/net/lib/coap/coap_client.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index 763ee412c1f9e..89f980edb7521 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -69,6 +69,7 @@ static void reset_internal_request(struct coap_client_internal_request *request) request->offset = 0; request->last_id = 0; request->last_response_id = -1; + request->request_ongoing = false; reset_block_contexts(request); } @@ -426,6 +427,7 @@ int coap_client_req(struct coap_client *client, int sock, const struct sockaddr &client->address, client->socklen); if (ret < 0) { LOG_ERR("Transmission failed: %d", errno); + reset_internal_request(internal_req); } else { /* Do not return the number of bytes sent */ ret = 0; From 4c6dd4c7b7d0d3dc75a6d4800beabb176ffec85b Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Thu, 24 Oct 2024 13:25:37 +0300 Subject: [PATCH 2002/4482] net: lib: coap_client: check poll() condition before retrying CoAP msg Refactor the CoAP retry handling into the handle_poll() function, so that we only try to send retries if the socket reports POLLOUT. Also move the receiving into same loop, so when poll() reports POLLIN we recv() the message and handle it before proceeding to other sockets. Also fix tests to handle POLLOUT flag and add support for testing multiple clients. Signed-off-by: Seppo Takalo --- include/zephyr/net/coap_client.h | 2 - subsys/net/lib/coap/coap_client.c | 204 +++++++++-------------- tests/net/lib/coap_client/CMakeLists.txt | 1 + tests/net/lib/coap_client/src/main.c | 94 +++++++++-- tests/net/lib/coap_client/src/stubs.c | 17 +- tests/net/lib/coap_client/src/stubs.h | 23 ++- 6 files changed, 194 insertions(+), 147 deletions(-) diff --git a/include/zephyr/net/coap_client.h b/include/zephyr/net/coap_client.h index 00b97af60af2d..90a691de4e992 100644 --- a/include/zephyr/net/coap_client.h +++ b/include/zephyr/net/coap_client.h @@ -108,14 +108,12 @@ struct coap_client { int fd; struct sockaddr address; socklen_t socklen; - bool response_ready; struct k_mutex lock; uint8_t send_buf[MAX_COAP_MSG_LEN]; uint8_t recv_buf[MAX_COAP_MSG_LEN]; struct coap_client_internal_request requests[CONFIG_COAP_CLIENT_MAX_REQUESTS]; struct coap_option echo_option; bool send_echo; - int socket_error; }; /** @endcond */ diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index 89f980edb7521..9cba2225498e1 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -26,6 +26,13 @@ static int num_clients; static K_SEM_DEFINE(coap_client_recv_sem, 0, 1); static atomic_t coap_client_recv_active; +static bool timeout_expired(struct coap_client_internal_request *internal_req); +static void cancel_requests_with(struct coap_client *client, int error); +static int recv_response(struct coap_client *client, struct coap_packet *response, bool *truncated); +static int handle_response(struct coap_client *client, const struct coap_packet *response, + bool response_truncated); + + static int send_request(int sock, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen) { @@ -127,27 +134,26 @@ static bool has_ongoing_exchange(struct coap_client *client) return false; } -static struct coap_client_internal_request *get_free_request(struct coap_client *client) +static bool has_timeout_expired(struct coap_client *client) { for (int i = 0; i < CONFIG_COAP_CLIENT_MAX_REQUESTS; i++) { - if (client->requests[i].request_ongoing == false && - exchange_lifetime_exceeded(&client->requests[i])) { - return &client->requests[i]; + if (timeout_expired(&client->requests[i])) { + return true; } } - - return NULL; + return false; } -static bool has_ongoing_requests(void) +static struct coap_client_internal_request *get_free_request(struct coap_client *client) { - for (int i = 0; i < num_clients; i++) { - if (has_ongoing_request(clients[i])) { - return true; + for (int i = 0; i < CONFIG_COAP_CLIENT_MAX_REQUESTS; i++) { + if (client->requests[i].request_ongoing == false && + exchange_lifetime_exceeded(&client->requests[i])) { + return &client->requests[i]; } } - return false; + return NULL; } static bool has_ongoing_exchanges(void) @@ -498,86 +504,91 @@ static int resend_request(struct coap_client *client, return ret; } -static int coap_client_resend_handler(void) +static void coap_client_resend_handler(struct coap_client *client) { int ret = 0; - for (int i = 0; i < num_clients; i++) { - k_mutex_lock(&clients[i]->lock, K_FOREVER); + k_mutex_lock(&client->lock, K_FOREVER); - for (int j = 0; j < CONFIG_COAP_CLIENT_MAX_REQUESTS; j++) { - if (timeout_expired(&clients[i]->requests[j])) { - ret = resend_request(clients[i], &clients[i]->requests[j]); + for (int i = 0; i < CONFIG_COAP_CLIENT_MAX_REQUESTS; i++) { + if (timeout_expired(&client->requests[i])) { + ret = resend_request(client, &client->requests[i]); + if (ret < 0) { + report_callback_error(&client->requests[i], ret); + reset_internal_request(&client->requests[i]); } } - - k_mutex_unlock(&clients[i]->lock); } - return ret; + k_mutex_unlock(&client->lock); } static int handle_poll(void) { int ret = 0; - while (1) { - struct zsock_pollfd fds[CONFIG_COAP_CLIENT_MAX_INSTANCES] = {0}; - int nfds = 0; - - /* Use periodic timeouts */ - for (int i = 0; i < num_clients; i++) { - fds[i].fd = clients[i]->fd; - fds[i].events = ZSOCK_POLLIN; - fds[i].revents = 0; - nfds++; - } + struct zsock_pollfd fds[CONFIG_COAP_CLIENT_MAX_INSTANCES] = {0}; + int nfds = 0; - ret = zsock_poll(fds, nfds, COAP_PERIODIC_TIMEOUT); + /* Use periodic timeouts */ + for (int i = 0; i < num_clients; i++) { + fds[i].fd = clients[i]->fd; + fds[i].events = (has_ongoing_exchange(clients[i]) ? ZSOCK_POLLIN : 0) | + (has_timeout_expired(clients[i]) ? ZSOCK_POLLOUT : 0); + fds[i].revents = 0; + nfds++; + } - if (ret < 0) { - LOG_ERR("Error in poll:%d", errno); - errno = 0; - return ret; - } else if (ret == 0) { - /* Resend all the expired pending messages */ - ret = coap_client_resend_handler(); + ret = zsock_poll(fds, nfds, COAP_PERIODIC_TIMEOUT); - if (ret < 0) { - LOG_ERR("Error resending request: %d", ret); - } + if (ret < 0) { + ret = -errno; + LOG_ERR("Error in poll:%d", ret); + return ret; + } else if (ret == 0) { + return 0; + } - if (!has_ongoing_requests()) { - return ret; - } + for (int i = 0; i < nfds; i++) { + if (fds[i].revents & ZSOCK_POLLOUT) { + coap_client_resend_handler(clients[i]); + } + if (fds[i].revents & ZSOCK_POLLIN) { + struct coap_packet response; + bool response_truncated = false; - } else { - for (int i = 0; i < nfds; i++) { + k_mutex_lock(&clients[i]->lock, K_FOREVER); - if (fds[i].revents & ZSOCK_POLLERR) { - LOG_ERR("Error in poll for socket %d", fds[i].fd); - clients[i]->socket_error = -EIO; - } - if (fds[i].revents & ZSOCK_POLLHUP) { - LOG_ERR("Error in poll: POLLHUP for socket %d", fds[i].fd); - clients[i]->socket_error = -ENOTCONN; - } - if (fds[i].revents & ZSOCK_POLLNVAL) { - LOG_ERR("Error in poll: POLLNVAL - fd %d not open", - fds[i].fd); - clients[i]->socket_error = -EINVAL; - } - if (fds[i].revents & ZSOCK_POLLIN) { - clients[i]->response_ready = true; - } + ret = recv_response(clients[i], &response, &response_truncated); + if (ret < 0) { + LOG_ERR("Error receiving response"); + cancel_requests_with(clients[i], -EIO); + k_mutex_unlock(&clients[i]->lock); + continue; + } + ret = handle_response(clients[i], &response, response_truncated); + if (ret < 0) { + LOG_ERR("Error handling response"); } - return 0; + k_mutex_unlock(&clients[i]->lock); + } + if (fds[i].revents & ZSOCK_POLLERR) { + LOG_ERR("Error in poll for socket %d", fds[i].fd); + cancel_requests_with(clients[i], -EIO); + } + if (fds[i].revents & ZSOCK_POLLHUP) { + LOG_ERR("Error in poll: POLLHUP for socket %d", fds[i].fd); + cancel_requests_with(clients[i], -EIO); + } + if (fds[i].revents & ZSOCK_POLLNVAL) { + LOG_ERR("Error in poll: POLLNVAL - fd %d not open", fds[i].fd); + cancel_requests_with(clients[i], -EIO); } } - return ret; + return 0; } static bool token_compare(struct coap_client_internal_request *internal_req, @@ -895,14 +906,13 @@ static int handle_response(struct coap_client *client, const struct coap_packet } } fail: - client->response_ready = false; if (ret < 0 || !internal_req->is_observe) { internal_req->request_ongoing = false; } return ret; } -void coap_client_cancel_requests(struct coap_client *client) +static void cancel_requests_with(struct coap_client *client, int error) { k_mutex_lock(&client->lock, K_FOREVER); @@ -914,33 +924,20 @@ void coap_client_cancel_requests(struct coap_client *client) * do not reenter it. In that case, the user knows their * request was cancelled anyway. */ - report_callback_error(&client->requests[i], -ECANCELED); - client->requests[i].request_ongoing = false; - client->requests[i].is_observe = false; + report_callback_error(&client->requests[i], error); + reset_internal_request(&client->requests[i]); } } atomic_clear(&coap_client_recv_active); k_mutex_unlock(&client->lock); - /* Wait until after zsock_poll() can time out and return. */ - k_sleep(K_MSEC(COAP_PERIODIC_TIMEOUT)); } -static void signal_socket_error(struct coap_client *cli) +void coap_client_cancel_requests(struct coap_client *client) { - for (int i = 0; i < CONFIG_COAP_CLIENT_MAX_REQUESTS; i++) { - struct coap_client_internal_request *req = &cli->requests[i]; - - if (!req->request_ongoing) { - continue; - } - - req->request_ongoing = false; - if (req->coap_request.cb) { - req->coap_request.cb(cli->socket_error, 0, NULL, 0, - true, req->coap_request.user_data); - } - } + cancel_requests_with(client, -ECANCELED); + /* Wait until after zsock_poll() can time out and return. */ + k_sleep(K_MSEC(COAP_PERIODIC_TIMEOUT)); } void coap_client_recv(void *coap_cl, void *a, void *b) @@ -957,41 +954,6 @@ void coap_client_recv(void *coap_cl, void *a, void *b) goto idle; } - for (int i = 0; i < num_clients; i++) { - if (clients[i]->response_ready) { - struct coap_packet response; - bool response_truncated = false; - - k_mutex_lock(&clients[i]->lock, K_FOREVER); - - ret = recv_response(clients[i], &response, &response_truncated); - if (ret < 0) { - LOG_ERR("Error receiving response"); - clients[i]->response_ready = false; - k_mutex_unlock(&clients[i]->lock); - if (ret == -EOPNOTSUPP) { - LOG_ERR("Socket misconfigured."); - goto idle; - } - continue; - } - - ret = handle_response(clients[i], &response, response_truncated); - if (ret < 0) { - LOG_ERR("Error handling response"); - } - - clients[i]->response_ready = false; - k_mutex_unlock(&clients[i]->lock); - } - - if (clients[i]->socket_error) { - signal_socket_error(clients[i]); - clients[i]->socket_error = 0; - } - - } - /* There are more messages coming */ if (has_ongoing_exchanges()) { continue; diff --git a/tests/net/lib/coap_client/CMakeLists.txt b/tests/net/lib/coap_client/CMakeLists.txt index 0987064ef3b80..f8d21563b57a6 100644 --- a/tests/net/lib/coap_client/CMakeLists.txt +++ b/tests/net/lib/coap_client/CMakeLists.txt @@ -31,3 +31,4 @@ add_compile_definitions(CONFIG_COAP_CLIENT_MAX_REQUESTS=2) add_compile_definitions(CONFIG_COAP_CLIENT_MAX_INSTANCES=2) add_compile_definitions(CONFIG_COAP_MAX_RETRANSMIT=4) add_compile_definitions(CONFIG_COAP_BACKOFF_PERCENT=200) +add_compile_definitions(CONFIG_COAP_LOG_LEVEL=4) diff --git a/tests/net/lib/coap_client/src/main.c b/tests/net/lib/coap_client/src/main.c index 25c2c58f2fd67..20f1e4d8381e8 100644 --- a/tests/net/lib/coap_client/src/main.c +++ b/tests/net/lib/coap_client/src/main.c @@ -77,7 +77,7 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake(int sock, void *buf, size_t max memcpy(buf, ack_data, sizeof(ack_data)); - clear_socket_events(); + clear_socket_events(ZSOCK_POLLIN); return sizeof(ack_data); } @@ -205,7 +205,7 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake_response(int sock, void *buf, s memcpy(buf, ack_data, sizeof(ack_data)); - clear_socket_events(); + clear_socket_events(ZSOCK_POLLIN); return sizeof(ack_data); } @@ -247,7 +247,7 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake_unmatching(int sock, void *buf, memcpy(buf, ack_data, sizeof(ack_data)); - clear_socket_events(); + clear_socket_events(ZSOCK_POLLIN); return sizeof(ack_data); } @@ -273,7 +273,7 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake_echo(int sock, void *buf, size_ z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_response; z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_echo; - clear_socket_events(); + clear_socket_events(ZSOCK_POLLIN); return sizeof(ack_data); } @@ -299,7 +299,7 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake_echo_next_req(int sock, void *b z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_response; z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_echo_next_req; - clear_socket_events(); + clear_socket_events(ZSOCK_POLLIN); return sizeof(ack_data); } @@ -335,6 +335,9 @@ void coap_callback(int16_t code, size_t offset, const uint8_t *payload, size_t l { LOG_INF("CoAP response callback, %d", code); last_response_code = code; + if (user_data) { + k_sem_give((struct k_sem *) user_data); + } } ZTEST_SUITE(coap_client, NULL, suite_setup, test_setup, NULL, NULL); @@ -392,7 +395,7 @@ ZTEST(coap_client, test_resend_request) ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); k_sleep(K_MSEC(MORE_THAN_ACK_TIMEOUT_MS)); - set_socket_events(ZSOCK_POLLIN); + set_socket_events(ZSOCK_POLLIN | ZSOCK_POLLOUT); k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); @@ -547,6 +550,7 @@ ZTEST(coap_client, test_no_response) client_request.len = strlen(short_payload); z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; + set_socket_events(ZSOCK_POLLOUT); k_sleep(K_MSEC(1)); @@ -592,30 +596,35 @@ ZTEST(coap_client, test_multiple_requests) { int ret = 0; int retry = MORE_THAN_EXCHANGE_LIFETIME_MS; + struct k_sem sem1, sem2; struct sockaddr address = {0}; - struct coap_client_request client_request = { + struct coap_client_request req1 = { .method = COAP_METHOD_GET, .confirmable = true, .path = test_path, .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, .cb = coap_callback, - .payload = NULL, - .len = 0 + .payload = short_payload, + .len = strlen(short_payload), + .user_data = &sem1 }; + struct coap_client_request req2 = req1; - client_request.payload = short_payload; - client_request.len = strlen(short_payload); + req2.user_data = &sem2; + + k_sem_init(&sem1, 0, 1); + k_sem_init(&sem2, 0, 1); z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; k_sleep(K_MSEC(1)); LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, NULL); + ret = coap_client_req(&client, 0, &address, &req1, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); - ret = coap_client_req(&client, 0, &address, &client_request, NULL); + ret = coap_client_req(&client, 0, &address, &req2, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); set_socket_events(ZSOCK_POLLIN); @@ -625,8 +634,10 @@ ZTEST(coap_client, test_multiple_requests) } zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); + last_response_code = 0; set_socket_events(ZSOCK_POLLIN); - k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); + zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_ok(k_sem_take(&sem2, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); } @@ -653,6 +664,7 @@ ZTEST(coap_client, test_unmatching_tokens) client_request.len = strlen(short_payload); z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_unmatching; + set_socket_events(ZSOCK_POLLIN | ZSOCK_POLLOUT); k_sleep(K_MSEC(1)); @@ -663,3 +675,57 @@ ZTEST(coap_client, test_unmatching_tokens) k_sleep(K_MSEC(MORE_THAN_LONG_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, -ETIMEDOUT, "Unexpected response"); } + +ZTEST(coap_client, test_multiple_clients) +{ + int ret; + int retry = MORE_THAN_EXCHANGE_LIFETIME_MS; + static struct coap_client client2 = { + .fd = 2, + }; + struct k_sem sem1, sem2; + struct sockaddr address = {0}; + struct coap_client_request req1 = { + .method = COAP_METHOD_GET, + .confirmable = true, + .path = test_path, + .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, + .cb = coap_callback, + .payload = short_payload, + .len = strlen(short_payload), + .user_data = &sem1 + }; + struct coap_client_request req2 = req1; + + req2.user_data = &sem2; + req2.payload = long_payload; + req2.len = strlen(long_payload); + + zassert_ok(k_sem_init(&sem1, 0, 1)); + zassert_ok(k_sem_init(&sem2, 0, 1)); + + zassert_ok(coap_client_init(&client2, NULL)); + + k_sleep(K_MSEC(1)); + + LOG_INF("Sending requests"); + ret = coap_client_req(&client, 1, &address, &req1, NULL); + zassert_true(ret >= 0, "Sending request failed, %d", ret); + + ret = coap_client_req(&client2, 2, &address, &req2, NULL); + zassert_true(ret >= 0, "Sending request failed, %d", ret); + + while (last_response_code == 0 && retry > 0) { + retry--; + k_sleep(K_MSEC(1)); + } + set_socket_events(ZSOCK_POLLIN); + + k_sleep(K_SECONDS(1)); + + /* ensure we got both responses */ + zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_ok(k_sem_take(&sem2, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); + +} diff --git a/tests/net/lib/coap_client/src/stubs.c b/tests/net/lib/coap_client/src/stubs.c index ef9705daeb292..d698248b05059 100644 --- a/tests/net/lib/coap_client/src/stubs.c +++ b/tests/net/lib/coap_client/src/stubs.c @@ -29,9 +29,9 @@ void set_socket_events(short events) my_events |= events; } -void clear_socket_events(void) +void clear_socket_events(short events) { - my_events = 0; + my_events &= ~events; } int z_impl_zsock_socket(int family, int type, int proto) @@ -41,13 +41,14 @@ int z_impl_zsock_socket(int family, int type, int proto) int z_impl_zvfs_poll(struct zvfs_pollfd *fds, int nfds, int poll_timeout) { - LOG_INF("Polling, events %d", my_events); + int events = 0; k_sleep(K_MSEC(1)); - fds->revents = my_events; - - if (my_events) { - return 1; + for (int i = 0; i < nfds; i++) { + fds[i].revents = my_events & (fds[i].events | ZSOCK_POLLERR | ZSOCK_POLLHUP); + if (fds[i].revents) { + events++; + } } - return 0; + return events; } diff --git a/tests/net/lib/coap_client/src/stubs.h b/tests/net/lib/coap_client/src/stubs.h index eb340d914eb98..9a9f929ce76b9 100644 --- a/tests/net/lib/coap_client/src/stubs.h +++ b/tests/net/lib/coap_client/src/stubs.h @@ -15,11 +15,30 @@ #include -#define ZSOCK_POLLIN 1 + +/* Copy from zephyr/include/zephyr/net/socket.h */ +/** + * @name Options for poll() + * @{ + */ +/* ZSOCK_POLL* values are compatible with Linux */ +/** zsock_poll: Poll for readability */ +#define ZSOCK_POLLIN 1 +/** zsock_poll: Poll for exceptional condition */ +#define ZSOCK_POLLPRI 2 +/** zsock_poll: Poll for writability */ #define ZSOCK_POLLOUT 4 +/** zsock_poll: Poll results in error condition (output value only) */ +#define ZSOCK_POLLERR 8 +/** zsock_poll: Poll detected closed connection (output value only) */ +#define ZSOCK_POLLHUP 0x10 +/** zsock_poll: Invalid socket (output value only) */ +#define ZSOCK_POLLNVAL 0x20 +/** @} */ + void set_socket_events(short events); -void clear_socket_events(void); +void clear_socket_events(short events); DECLARE_FAKE_VALUE_FUNC(uint32_t, z_impl_sys_rand32_get); DECLARE_FAKE_VOID_FUNC(z_impl_sys_rand_get, void *, size_t); From 6481b0ec6ca5e668c12184181642bd7a150957ff Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Fri, 25 Oct 2024 15:47:44 +0300 Subject: [PATCH 2003/4482] net: lib: coap_client: Forward recv() errors to handling loop Forward recv() errors to handle_poll(), so there is only one place to handle error codes. Signed-off-by: Seppo Takalo --- subsys/net/lib/coap/coap_client.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index 9cba2225498e1..de0e8c00612a6 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -557,16 +557,17 @@ static int handle_poll(void) struct coap_packet response; bool response_truncated = false; - k_mutex_lock(&clients[i]->lock, K_FOREVER); - ret = recv_response(clients[i], &response, &response_truncated); if (ret < 0) { + if (ret == -EAGAIN) { + continue; + } LOG_ERR("Error receiving response"); cancel_requests_with(clients[i], -EIO); - k_mutex_unlock(&clients[i]->lock); continue; } + k_mutex_lock(&clients[i]->lock, K_FOREVER); ret = handle_response(clients[i], &response, response_truncated); if (ret < 0) { LOG_ERR("Error handling response"); @@ -622,14 +623,11 @@ static int recv_response(struct coap_client *client, struct coap_packet *respons &client->address, &client->socklen); if (total_len < 0) { - LOG_ERR("Error reading response: %d", errno); - if (errno == EOPNOTSUPP) { - return -errno; - } - return -EINVAL; + ret = -errno; + return ret; } else if (total_len == 0) { - LOG_ERR("Zero length recv"); - return -EINVAL; + /* Ignore, UDP can be zero length, but it is not CoAP anymore */ + return 0; } available_len = MIN(total_len, sizeof(client->recv_buf)); @@ -640,7 +638,6 @@ static int recv_response(struct coap_client *client, struct coap_packet *respons ret = coap_packet_parse(response, client->recv_buf, available_len, NULL, 0); if (ret < 0) { LOG_ERR("Invalid data received"); - return ret; } return ret; From 623a1ffd5221c571a307ed95a28e93a8bebb3918 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Fri, 25 Oct 2024 15:51:26 +0300 Subject: [PATCH 2004/4482] net: lib: coap_client: Don't decrease retry counter on send() failure If send() fails, we have not technically send the CoAP retry yet, so restore the same pending structure, so our timeouts and retry counters stay the same. This will trigger a retry next time the poll() return POLLOUT, so we know that we can send. Signed-off-by: Seppo Takalo --- subsys/net/lib/coap/coap_client.c | 34 +++++++++++++++++++------------ 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index de0e8c00612a6..7f50618291add 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -471,10 +471,13 @@ static int resend_request(struct coap_client *client, { int ret = 0; + /* Copy the pending structure if we need to restore it */ + struct coap_pending tmp = internal_req->pending; + if (internal_req->request_ongoing && internal_req->pending.timeout != 0 && coap_pending_cycle(&internal_req->pending)) { - LOG_ERR("Timeout in poll, retrying send"); + LOG_ERR("Timeout, retrying send"); /* Reset send block context as it was updated in previous init from packet */ if (internal_req->send_blk_ctx.total_size > 0) { @@ -483,22 +486,27 @@ static int resend_request(struct coap_client *client, ret = coap_client_init_request(client, &internal_req->coap_request, internal_req, true); if (ret < 0) { - LOG_ERR("Error re-creating CoAP request"); + LOG_ERR("Error re-creating CoAP request %d", ret); + return ret; + } + + ret = send_request(client->fd, internal_req->request.data, + internal_req->request.offset, 0, &client->address, + client->socklen); + if (ret > 0) { + ret = 0; + } else if (ret == -1 && errno == EAGAIN) { + /* Restore the pending structure, retry later */ + internal_req->pending = tmp; + /* Not a fatal socket error, will trigger a retry */ + ret = 0; } else { - ret = send_request(client->fd, internal_req->request.data, - internal_req->request.offset, 0, &client->address, - client->socklen); - if (ret > 0) { - ret = 0; - } else { - LOG_ERR("Failed to resend request, %d", ret); - } + ret = -errno; + LOG_ERR("Failed to resend request, %d", ret); } } else { - LOG_ERR("Timeout in poll, no more retries left"); + LOG_ERR("Timeout, no more retries left"); ret = -ETIMEDOUT; - report_callback_error(internal_req, ret); - internal_req->request_ongoing = false; } return ret; From a14f08303065c5c6e528ae84ee264084a8d5f5b4 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Fri, 25 Oct 2024 15:58:39 +0300 Subject: [PATCH 2005/4482] net: lib: coap_client: Use reset_internal_request() instead of flagging It is error prone to flag separate booleans, so try to use reset_internal_request() every time we release the internal request structure. Also refactor the reset_internal_request() so that we reset the timeout value so it does not trigger again. Signed-off-by: Seppo Takalo --- subsys/net/lib/coap/coap_client.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index 7f50618291add..fc3c1450752b2 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -60,24 +60,16 @@ static int receive(int sock, void *buf, size_t max_len, int flags, return err; } -static void reset_block_contexts(struct coap_client_internal_request *request) -{ - request->recv_blk_ctx.block_size = 0; - request->recv_blk_ctx.total_size = 0; - request->recv_blk_ctx.current = 0; - - request->send_blk_ctx.block_size = 0; - request->send_blk_ctx.total_size = 0; - request->send_blk_ctx.current = 0; -} - static void reset_internal_request(struct coap_client_internal_request *request) { request->offset = 0; request->last_id = 0; request->last_response_id = -1; request->request_ongoing = false; - reset_block_contexts(request); + request->is_observe = false; + request->pending.timeout = 0; + request->recv_blk_ctx = (struct coap_block_context){ 0 }; + request->send_blk_ctx = (struct coap_block_context){ 0 }; } static int coap_client_schedule_poll(struct coap_client *client, int sock, @@ -912,7 +904,7 @@ static int handle_response(struct coap_client *client, const struct coap_packet } fail: if (ret < 0 || !internal_req->is_observe) { - internal_req->request_ongoing = false; + reset_internal_request(internal_req); } return ret; } From 1890dbd63732c0075f0fde39c46cd78ee118ae65 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Thu, 24 Oct 2024 17:38:14 +0300 Subject: [PATCH 2006/4482] net: lib: coap_client: Fix reset handling Fix handling of received CoAP reset. Signed-off-by: Seppo Takalo --- include/zephyr/net/coap_client.h | 2 +- subsys/net/lib/coap/coap_client.c | 54 ++++++++++++++++++++++++------- 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/include/zephyr/net/coap_client.h b/include/zephyr/net/coap_client.h index 90a691de4e992..1d68661da3b08 100644 --- a/include/zephyr/net/coap_client.h +++ b/include/zephyr/net/coap_client.h @@ -88,7 +88,7 @@ struct coap_client_option { struct coap_client_internal_request { uint8_t request_token[COAP_TOKEN_MAX_LEN]; uint32_t offset; - uint32_t last_id; + uint16_t last_id; uint8_t request_tkl; bool request_ongoing; atomic_t in_callback; diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index fc3c1450752b2..24c8efd0a8882 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -31,6 +31,8 @@ static void cancel_requests_with(struct coap_client *client, int error); static int recv_response(struct coap_client *client, struct coap_packet *response, bool *truncated); static int handle_response(struct coap_client *client, const struct coap_packet *response, bool response_truncated); +static struct coap_client_internal_request *get_request_with_mid( + struct coap_client *client, const struct coap_packet *resp); static int send_request(int sock, const void *buf, size_t len, int flags, @@ -689,6 +691,23 @@ static struct coap_client_internal_request *get_request_with_token( return NULL; } +static struct coap_client_internal_request *get_request_with_mid( + struct coap_client *client, const struct coap_packet *resp) +{ + uint16_t mid = coap_header_get_id(resp); + + for (int i = 0; i < CONFIG_COAP_CLIENT_MAX_REQUESTS; i++) { + if (client->requests[i].request_ongoing) { + if (client->requests[i].last_id == mid) { + return &client->requests[i]; + } + } + } + + return NULL; +} + + static bool find_echo_option(const struct coap_packet *response, struct coap_option *option) { return coap_find_options(response, COAP_OPTION_ECHO, option, 1); @@ -698,7 +717,6 @@ static int handle_response(struct coap_client *client, const struct coap_packet bool response_truncated) { int ret = 0; - int response_type; int block_option; int block_num; bool blockwise_transfer = false; @@ -711,33 +729,45 @@ static int handle_response(struct coap_client *client, const struct coap_packet * NCON request results only as a separate CON or NCON message as there is no ACK * With RESET, just drop gloves and call the callback. */ - response_type = coap_header_get_type(response); - - internal_req = get_request_with_token(client, response); - /* Reset and Ack need to match the message ID with request */ - if ((response_type == COAP_TYPE_ACK || response_type == COAP_TYPE_RESET) && - internal_req == NULL) { - LOG_ERR("Unexpected ACK or Reset"); - return -EFAULT; - } else if (response_type == COAP_TYPE_RESET) { - coap_pending_clear(&internal_req->pending); - } /* CON, NON_CON and piggybacked ACK need to match the token with original request */ uint16_t payload_len; + uint8_t response_type = coap_header_get_type(response); uint8_t response_code = coap_header_get_code(response); uint16_t response_id = coap_header_get_id(response); const uint8_t *payload = coap_packet_get_payload(response, &payload_len); + if (response_type == COAP_TYPE_RESET) { + internal_req = get_request_with_mid(client, response); + if (!internal_req) { + LOG_WRN("No matching request for RESET"); + return 0; + } + report_callback_error(internal_req, -ECONNRESET); + reset_internal_request(internal_req); + return 0; + } + /* Separate response coming */ if (payload_len == 0 && response_type == COAP_TYPE_ACK && response_code == COAP_CODE_EMPTY) { + internal_req = get_request_with_mid(client, response); + if (!internal_req) { + LOG_WRN("No matching request for ACK"); + return 0; + } internal_req->pending.t0 = k_uptime_get(); internal_req->pending.timeout = internal_req->pending.t0 + COAP_SEPARATE_TIMEOUT; internal_req->pending.retries = 0; return 1; } + internal_req = get_request_with_token(client, response); + if (!internal_req) { + LOG_WRN("No matching request for response"); + return 0; + } + if (internal_req == NULL || !token_compare(internal_req, response)) { LOG_WRN("Not matching tokens"); return 1; From e96e95b6f63046dad3e77af8fb46cf995381a1d6 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Fri, 25 Oct 2024 13:30:37 +0300 Subject: [PATCH 2007/4482] net: coap: Add API to send reset message Add helper API to construct CoAP Reset message. Signed-off-by: Seppo Takalo --- include/zephyr/net/coap.h | 15 +++++++++++++++ subsys/net/lib/coap/coap.c | 13 +++++++++++++ 2 files changed, 28 insertions(+) diff --git a/include/zephyr/net/coap.h b/include/zephyr/net/coap.h index 7a0c7ee7f91db..09df1e98f8a88 100644 --- a/include/zephyr/net/coap.h +++ b/include/zephyr/net/coap.h @@ -552,6 +552,21 @@ int coap_packet_init(struct coap_packet *cpkt, uint8_t *data, uint16_t max_len, int coap_ack_init(struct coap_packet *cpkt, const struct coap_packet *req, uint8_t *data, uint16_t max_len, uint8_t code); +/** + * @brief Create a new CoAP Reset message for given request. + * + * This function works like @ref coap_packet_init, filling CoAP header type, + * and CoAP header message id fields. + * + * @param cpkt New packet to be initialized using the storage from @a data. + * @param req CoAP request packet that is being acknowledged + * @param data Data that will contain a CoAP packet information + * @param max_len Maximum allowable length of data + * + * @return 0 in case of success or negative in case of error. + */ +int coap_rst_init(struct coap_packet *cpkt, const struct coap_packet *req, + uint8_t *data, uint16_t max_len); /** * @brief Returns a randomly generated array of 8 bytes, that can be * used as a message's token. diff --git a/subsys/net/lib/coap/coap.c b/subsys/net/lib/coap/coap.c index 25ad262c9234f..70f2610adf022 100644 --- a/subsys/net/lib/coap/coap.c +++ b/subsys/net/lib/coap/coap.c @@ -232,6 +232,19 @@ int coap_ack_init(struct coap_packet *cpkt, const struct coap_packet *req, token, code, id); } +int coap_rst_init(struct coap_packet *cpkt, const struct coap_packet *req, + uint8_t *data, uint16_t max_len) +{ + uint16_t id; + uint8_t ver; + + ver = coap_header_get_version(req); + id = coap_header_get_id(req); + + return coap_packet_init(cpkt, data, max_len, ver, COAP_TYPE_RESET, 0, + NULL, 0, id); +} + static void option_header_set_delta(uint8_t *opt, uint8_t delta) { *opt = (delta & 0xF) << 4; From 1dc24872ce833bcfd702963b1eff98e84d64fb43 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Fri, 25 Oct 2024 13:32:43 +0300 Subject: [PATCH 2008/4482] net: lib: coap_client: Remove duplicate token comparison Response tokens are already compared in get_request_with_token(). Signed-off-by: Seppo Takalo --- subsys/net/lib/coap/coap_client.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index 24c8efd0a8882..d76c5535af220 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -594,21 +594,6 @@ static int handle_poll(void) return 0; } -static bool token_compare(struct coap_client_internal_request *internal_req, - const struct coap_packet *resp) -{ - uint8_t response_token[COAP_TOKEN_MAX_LEN]; - uint8_t response_tkl; - - response_tkl = coap_header_get_token(resp, response_token); - - if (internal_req->request_tkl != response_tkl) { - return false; - } - - return memcmp(&internal_req->request_token, &response_token, response_tkl) == 0; -} - static int recv_response(struct coap_client *client, struct coap_packet *response, bool *truncated) { int total_len; @@ -768,11 +753,6 @@ static int handle_response(struct coap_client *client, const struct coap_packet return 0; } - if (internal_req == NULL || !token_compare(internal_req, response)) { - LOG_WRN("Not matching tokens"); - return 1; - } - /* MID-based deduplication */ if (response_id == internal_req->last_response_id) { LOG_WRN("Duplicate MID, dropping"); From 350d20e027a9a13e741c8c72a4f642f748a27f99 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Fri, 25 Oct 2024 13:58:15 +0300 Subject: [PATCH 2009/4482] net: lib: coap_client: Send RST for unknown queries When receiving unknown response, respond with CoAP Reset. Signed-off-by: Seppo Takalo --- subsys/net/lib/coap/coap_client.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index d76c5535af220..6cea172332e18 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -651,6 +651,26 @@ static int send_ack(struct coap_client *client, const struct coap_packet *req, return 0; } +static int send_rst(struct coap_client *client, const struct coap_packet *req) +{ + int ret; + struct coap_packet rst; + + ret = coap_rst_init(&rst, req, client->send_buf, MAX_COAP_MSG_LEN); + if (ret < 0) { + LOG_ERR("Failed to initialize CoAP RST-message"); + return ret; + } + + ret = send_request(client->fd, rst.data, rst.offset, 0, &client->address, client->socklen); + if (ret < 0) { + LOG_ERR("Error sending a CoAP RST-message"); + return ret; + } + + return 0; +} + static struct coap_client_internal_request *get_request_with_token( struct coap_client *client, const struct coap_packet *resp) { @@ -750,6 +770,7 @@ static int handle_response(struct coap_client *client, const struct coap_packet internal_req = get_request_with_token(client, response); if (!internal_req) { LOG_WRN("No matching request for response"); + (void) send_rst(client, response); /* Ignore errors, unrelated to our queries */ return 0; } From 9c9dc9f760e77d462fb5649fc63f9acc22d9ac03 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Fri, 25 Oct 2024 16:27:20 +0300 Subject: [PATCH 2010/4482] tests: coap_client: Add tests for poll() errors If we receive poll() error during a request, it must be forwarded to application. If instead receive poll() error later, it should not be forwarded as it might be result of application closing the socket. Signed-off-by: Seppo Takalo --- tests/net/lib/coap_client/src/main.c | 61 ++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/tests/net/lib/coap_client/src/main.c b/tests/net/lib/coap_client/src/main.c index 20f1e4d8381e8..f06a0ce646c53 100644 --- a/tests/net/lib/coap_client/src/main.c +++ b/tests/net/lib/coap_client/src/main.c @@ -322,6 +322,7 @@ static void test_setup(void *data) z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake; z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake; + clear_socket_events(ZSOCK_POLLIN | ZSOCK_POLLOUT | ZSOCK_POLLERR); for (i = 0; i < ARRAY_SIZE(messages_needing_response); i++) { messages_needing_response[i] = 0; @@ -727,5 +728,65 @@ ZTEST(coap_client, test_multiple_clients) zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); zassert_ok(k_sem_take(&sem2, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); +} + + +ZTEST(coap_client, test_poll_err) +{ + int ret = 0; + struct sockaddr address = {0}; + struct coap_client_request client_request = { + .method = COAP_METHOD_GET, + .confirmable = true, + .path = test_path, + .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, + .cb = coap_callback, + .payload = short_payload, + .len = strlen(short_payload), + }; + + z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; + set_socket_events(ZSOCK_POLLERR); + + k_sleep(K_MSEC(1)); + + LOG_INF("Send request"); + ret = coap_client_req(&client, 0, &address, &client_request, NULL); + zassert_true(ret >= 0, "Sending request failed, %d", ret); + + k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); + zassert_equal(last_response_code, -EIO, "Unexpected response"); +} + +ZTEST(coap_client, test_poll_err_after_response) +{ + int ret = 0; + struct k_sem sem1; + struct sockaddr address = {0}; + struct coap_client_request client_request = { + .method = COAP_METHOD_GET, + .confirmable = true, + .path = test_path, + .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, + .cb = coap_callback, + .payload = short_payload, + .len = strlen(short_payload), + .user_data = &sem1 + }; + + zassert_ok(k_sem_init(&sem1, 0, 1)); + z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; + set_socket_events(ZSOCK_POLLIN); + + k_sleep(K_MSEC(1)); + + LOG_INF("Send request"); + ret = coap_client_req(&client, 0, &address, &client_request, NULL); + zassert_true(ret >= 0, "Sending request failed, %d", ret); + + zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); + set_socket_events(ZSOCK_POLLERR); + zassert_not_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); } From 1e5a537adee75805a9f3f52801c845876bf6c265 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 28 Oct 2024 13:29:14 +0200 Subject: [PATCH 2011/4482] net: lib: coap_client: Remove unnecessary atomic variable In receiving thread, continuing the loops is based on has_ongoing_exchanges() so it does not need atomic coap_client_recv_active variable. When idling, it wakes from semaphore. But there was potential deadlock when coap_client_schedule_poll() would not signal the semaphore, if atomic variable was already showing that it runs. Removing the atomic variable removes this deadlock. Signed-off-by: Seppo Takalo --- subsys/net/lib/coap/coap_client.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index 6cea172332e18..82f0bbda10888 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -24,7 +24,6 @@ static K_MUTEX_DEFINE(coap_client_mutex); static struct coap_client *clients[CONFIG_COAP_CLIENT_MAX_INSTANCES]; static int num_clients; static K_SEM_DEFINE(coap_client_recv_sem, 0, 1); -static atomic_t coap_client_recv_active; static bool timeout_expired(struct coap_client_internal_request *internal_req); static void cancel_requests_with(struct coap_client *client, int error); @@ -82,10 +81,7 @@ static int coap_client_schedule_poll(struct coap_client *client, int sock, memcpy(&internal_req->coap_request, req, sizeof(struct coap_client_request)); internal_req->request_ongoing = true; - if (!coap_client_recv_active) { - k_sem_give(&coap_client_recv_sem); - } - atomic_set(&coap_client_recv_active, 1); + k_sem_give(&coap_client_recv_sem); return 0; } @@ -956,7 +952,6 @@ static void cancel_requests_with(struct coap_client *client, int error) reset_internal_request(&client->requests[i]); } } - atomic_clear(&coap_client_recv_active); k_mutex_unlock(&client->lock); } @@ -974,7 +969,6 @@ void coap_client_recv(void *coap_cl, void *a, void *b) k_sem_take(&coap_client_recv_sem, K_FOREVER); while (true) { - atomic_set(&coap_client_recv_active, 1); ret = handle_poll(); if (ret < 0) { /* Error in polling */ @@ -987,7 +981,6 @@ void coap_client_recv(void *coap_cl, void *a, void *b) continue; } else { idle: - atomic_set(&coap_client_recv_active, 0); k_sem_take(&coap_client_recv_sem, K_FOREVER); } } From 9dc0af55e2fb35ba341d1d1366802f3fa63f7cf5 Mon Sep 17 00:00:00 2001 From: Lukasz Mrugala Date: Tue, 22 Oct 2024 10:05:44 +0000 Subject: [PATCH 2012/4482] scripts: twister: Fix NOTRUN in test_only When using the --build-only into --test-only Twister setup, NOTRUN statuses were not properly rerun. Now they are properly run again if runnable. Signed-off-by: Lukasz Mrugala --- scripts/pylib/twister/twisterlib/reports.py | 6 ++++++ scripts/pylib/twister/twisterlib/testplan.py | 9 ++++++--- scripts/tests/twister/test_testplan.py | 3 ++- scripts/tests/twister_blackbox/test_footprint.py | 16 +++++++++------- scripts/tests/twister_blackbox/test_runner.py | 6 +++--- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/reports.py b/scripts/pylib/twister/twisterlib/reports.py index 058afce58c547..a1dbe68b5a790 100644 --- a/scripts/pylib/twister/twisterlib/reports.py +++ b/scripts/pylib/twister/twisterlib/reports.py @@ -354,6 +354,12 @@ def json_report(self, filename, version="NA", platform=None, filters=None): elif instance.status == TwisterStatus.SKIP: suite["status"] = TwisterStatus.SKIP suite["reason"] = instance.reason + elif instance.status == TwisterStatus.NOTRUN: + suite["status"] = TwisterStatus.NOTRUN + suite["reason"] = instance.reason + else: + suite["status"] = TwisterStatus.NONE + suite["reason"] = 'Unknown Instance status.' if instance.status != TwisterStatus.NONE: suite["execution_time"] = f"{float(handler_time):.2f}" diff --git a/scripts/pylib/twister/twisterlib/testplan.py b/scripts/pylib/twister/twisterlib/testplan.py index 377a0dab2bb0b..4a9f4cb86e5f8 100755 --- a/scripts/pylib/twister/twisterlib/testplan.py +++ b/scripts/pylib/twister/twisterlib/testplan.py @@ -659,6 +659,9 @@ def load_from_file(self, file, filter_platform=[]): self.hwm ) + if self.options.test_only and not instance.run: + continue + instance.metrics['handler_time'] = ts.get('execution_time', 0) instance.metrics['used_ram'] = ts.get("used_ram", 0) instance.metrics['used_rom'] = ts.get("used_rom",0) @@ -676,9 +679,9 @@ def load_from_file(self, file, filter_platform=[]): instance.status = TwisterStatus.NONE instance.reason = None instance.retries += 1 - # test marked as passed (built only) but can run when - # --test-only is used. Reset status to capture new results. - elif status == TwisterStatus.PASS and instance.run and self.options.test_only: + # test marked as built only can run when --test-only is used. + # Reset status to capture new results. + elif status == TwisterStatus.NOTRUN and instance.run and self.options.test_only: instance.status = TwisterStatus.NONE instance.reason = None else: diff --git a/scripts/tests/twister/test_testplan.py b/scripts/tests/twister/test_testplan.py index de1c9595a21d8..eea3d3e9abefb 100644 --- a/scripts/tests/twister/test_testplan.py +++ b/scripts/tests/twister/test_testplan.py @@ -766,6 +766,7 @@ def test_testplan_load( testplan.apply_filters = mock.Mock() with mock.patch('twisterlib.testinstance.TestInstance.create_overlay', mock.Mock()), \ + mock.patch('twisterlib.testinstance.TestInstance.check_runnable', return_value=True), \ pytest.raises(exception) if exception else nullcontext(): testplan.load() @@ -1600,7 +1601,7 @@ def get_platform(name): 'testcases': { 'TS1.tc1': { 'status': TwisterStatus.PASS, - 'reason': None, + 'reason': 'passed', 'duration': 60.0, 'output': '' } diff --git a/scripts/tests/twister_blackbox/test_footprint.py b/scripts/tests/twister_blackbox/test_footprint.py index 364889da0da0c..35824d792b18c 100644 --- a/scripts/tests/twister_blackbox/test_footprint.py +++ b/scripts/tests/twister_blackbox/test_footprint.py @@ -16,6 +16,7 @@ # pylint: disable=no-name-in-module from conftest import ZEPHYR_BASE, TEST_DATA, testsuite_filename_mock, clear_log_in_test +from twisterlib.statuses import TwisterStatus from twisterlib.testplan import TestPlan @@ -76,9 +77,10 @@ def test_compare_report(self, caplog, out_path, old_ram_multiplier, expect_delta with open(os.path.join(out_path, 'twister.json')) as f: j = json.load(f) for ts in j['testsuites']: - if 'reason' not in ts: + if TwisterStatus(ts.get('status')) == TwisterStatus.NOTRUN: # We assume positive RAM usage. ts[self.RAM_KEY] *= old_ram_multiplier + with open(os.path.join(out_path, 'twister.json'), 'w') as f: f.write(json.dumps(j, indent=4)) @@ -137,7 +139,7 @@ def test_footprint_from_buildlog(self, out_path): with open(os.path.join(out_path, 'twister.json')) as f: j = json.load(f) for ts in j['testsuites']: - if 'reason' not in ts: + if TwisterStatus(ts.get('status')) == TwisterStatus.NOTRUN: assert self.RAM_KEY in ts old_values += [ts[self.RAM_KEY]] @@ -162,7 +164,7 @@ def test_footprint_from_buildlog(self, out_path): with open(os.path.join(out_path, 'twister.json')) as f: j = json.load(f) for ts in j['testsuites']: - if 'reason' not in ts: + if TwisterStatus(ts.get('status')) == TwisterStatus.NOTRUN: assert self.RAM_KEY in ts new_values += [ts[self.RAM_KEY]] @@ -202,7 +204,7 @@ def test_footprint_threshold(self, caplog, out_path, old_ram_multiplier, with open(os.path.join(out_path, 'twister.json')) as f: j = json.load(f) for ts in j['testsuites']: - if 'reason' not in ts: + if TwisterStatus(ts.get('status')) == TwisterStatus.NOTRUN: # We assume positive RAM usage. ts[self.RAM_KEY] *= old_ram_multiplier with open(os.path.join(out_path, 'twister.json'), 'w') as f: @@ -271,7 +273,7 @@ def test_show_footprint(self, caplog, out_path, flags, old_ram_multiplier, expec with open(os.path.join(out_path, 'twister.json')) as f: j = json.load(f) for ts in j['testsuites']: - if 'reason' not in ts: + if TwisterStatus(ts.get('status')) == TwisterStatus.NOTRUN: # We assume positive RAM usage. ts[self.RAM_KEY] *= old_ram_multiplier with open(os.path.join(out_path, 'twister.json'), 'w') as f: @@ -344,7 +346,7 @@ def test_last_metrics(self, caplog, out_path, old_ram_multiplier, expect_delta_l with open(os.path.join(out_path, 'twister.json')) as f: j = json.load(f) for ts in j['testsuites']: - if 'reason' not in ts: + if TwisterStatus(ts.get('status')) == TwisterStatus.NOTRUN: # We assume positive RAM usage. ts[self.RAM_KEY] *= old_ram_multiplier with open(os.path.join(out_path, 'twister.json'), 'w') as f: @@ -441,7 +443,7 @@ def test_all_deltas(self, caplog, out_path, old_ram_multiplier, expect_delta_log with open(os.path.join(out_path, 'twister.json')) as f: j = json.load(f) for ts in j['testsuites']: - if 'reason' not in ts: + if TwisterStatus(ts.get('status')) == TwisterStatus.NOTRUN: # We assume positive RAM usage. ts[self.RAM_KEY] *= old_ram_multiplier with open(os.path.join(out_path, 'twister.json'), 'w') as f: diff --git a/scripts/tests/twister_blackbox/test_runner.py b/scripts/tests/twister_blackbox/test_runner.py index 865826741adc2..6a6645bb5d869 100644 --- a/scripts/tests/twister_blackbox/test_runner.py +++ b/scripts/tests/twister_blackbox/test_runner.py @@ -46,19 +46,19 @@ class TestRunner: ['qemu_x86/atom', 'qemu_x86_64/atom', 'intel_adl_crb/alder_lake'], { 'selected_test_scenarios': 3, - 'selected_test_instances': 6, + 'selected_test_instances': 4, 'skipped_configurations': 0, 'skipped_by_static_filter': 0, 'skipped_at_runtime': 0, 'passed_configurations': 4, - 'built_configurations': 2, + 'built_configurations': 0, 'failed_configurations': 0, 'errored_configurations': 0, 'executed_test_cases': 8, 'skipped_test_cases': 0, 'platform_count': 0, 'executed_on_platform': 4, - 'only_built': 2 + 'only_built': 0 } ) ] From 193eeaef0c04570b80a954b58ccd98075150fb11 Mon Sep 17 00:00:00 2001 From: Mert Ekren Date: Fri, 18 Oct 2024 14:41:01 +0300 Subject: [PATCH 2013/4482] drivers: pinctrl: max32: fix correct configuring drive strength This commit fixes configuring pin drive strength in pinctrl driver. Previously, there was a mismatch while filling pincfg and checking pincfg drive strength field. This fix simplifies the operation and avoids gpio driver header dependency. Signed-off-by: Mert Ekren Co-Authored-By: Sadik Ozer --- drivers/pinctrl/pinctrl_max32.c | 16 +--------------- .../zephyr/dt-bindings/pinctrl/max32-pinctrl.h | 1 + 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/pinctrl/pinctrl_max32.c b/drivers/pinctrl/pinctrl_max32.c index e9fcf65aa8591..39b43b600af43 100644 --- a/drivers/pinctrl/pinctrl_max32.c +++ b/drivers/pinctrl/pinctrl_max32.c @@ -5,7 +5,6 @@ */ #include -#include #include #include @@ -67,20 +66,7 @@ static int pinctrl_configure_pin(pinctrl_soc_pin_t soc_pin) gpio_cfg.vssel = MXC_GPIO_VSSEL_VDDIO; } - switch (pincfg & MAX32_GPIO_DRV_STRENGTH_MASK) { - case MAX32_GPIO_DRV_STRENGTH_1: - gpio_cfg.drvstr = MXC_GPIO_DRVSTR_1; - break; - case MAX32_GPIO_DRV_STRENGTH_2: - gpio_cfg.drvstr = MXC_GPIO_DRVSTR_2; - break; - case MAX32_GPIO_DRV_STRENGTH_3: - gpio_cfg.drvstr = MXC_GPIO_DRVSTR_3; - break; - default: - gpio_cfg.drvstr = MXC_GPIO_DRVSTR_0; - break; - } + gpio_cfg.drvstr = (pincfg >> MAX32_DRV_STRENGTH_SHIFT) & MAX32_DRV_STRENGTH_MASK; if (MXC_GPIO_Config(&gpio_cfg) != 0) { return -ENOTSUP; diff --git a/include/zephyr/dt-bindings/pinctrl/max32-pinctrl.h b/include/zephyr/dt-bindings/pinctrl/max32-pinctrl.h index 97a3ab76748d1..fbfaf777be579 100644 --- a/include/zephyr/dt-bindings/pinctrl/max32-pinctrl.h +++ b/include/zephyr/dt-bindings/pinctrl/max32-pinctrl.h @@ -63,5 +63,6 @@ #define MAX32_POWER_SOURCE_SHIFT 0x04 #define MAX32_OUTPUT_HIGH_SHIFT 0x05 #define MAX32_DRV_STRENGTH_SHIFT 0x06 /* 2 bits */ +#define MAX32_DRV_STRENGTH_MASK 0x03 #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_MAX32_PINCTRL_H_ */ From 8d07197d6d03d2680d99394eede63121a5a21942 Mon Sep 17 00:00:00 2001 From: Joel Hirsbrunner Date: Tue, 29 Oct 2024 23:55:19 +0100 Subject: [PATCH 2014/4482] devicetree: Remove deprecated enum macro Remove deprecated _ENUM_TOKEN and _ENUM_UPPER_TOKEN. These are deprecated for over three years by now. Signed-off-by: Joel Hirsbrunner --- doc/releases/release-notes-4.0.rst | 2 ++ include/zephyr/devicetree.h | 4 ---- scripts/dts/gen_defines.py | 8 -------- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index a18f9dd9e9cf2..1b90f284de358 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -47,6 +47,8 @@ Removed APIs in this release * Macro ``K_THREAD_STACK_MEMBER``, deprecated since v3.5.0, has been removed. Use :c:macro:`K_KERNEL_STACK_MEMBER` instead. * ``CBPRINTF_PACKAGE_COPY_*`` macros, deprecated since Zephyr 3.5.0, have been removed. +* ``_ENUM_TOKEN`` and ``_ENUM_UPPER_TOKEN`` macros, deprecated since Zephyr 2.7.0, + are no longer generated. Deprecated in this release ========================== diff --git a/include/zephyr/devicetree.h b/include/zephyr/devicetree.h index aba28c0ab6325..57bcb0dd427e5 100644 --- a/include/zephyr/devicetree.h +++ b/include/zephyr/devicetree.h @@ -47,10 +47,6 @@ * * _ENUM_IDX: property's value as an index into bindings enum * _ENUM_VAL__EXISTS property's value as a token exists - * _ENUM_TOKEN: property's value as a token into bindings enum (string - * enum values are identifiers) [deprecated, use _STRING_TOKEN] - * _ENUM_UPPER_TOKEN: like _ENUM_TOKEN, but uppercased [deprecated, use - * _STRING_UPPER_TOKEN] * _EXISTS: property is defined * _FOREACH_PROP_ELEM: helper for "iterating" over values in the property * _FOREACH_PROP_ELEM_VARGS: foreach functions with variable number of arguments diff --git a/scripts/dts/gen_defines.py b/scripts/dts/gen_defines.py index 3a8fa7aaedd55..9fdb3cda5778c 100755 --- a/scripts/dts/gen_defines.py +++ b/scripts/dts/gen_defines.py @@ -672,14 +672,6 @@ def enum_macros(prop: edtlib.Property, macro: str): ret[macro + f"_IDX_{i}_EXISTS"] = 1 # DT_N__P__IDX__ENUM_VAL__EXISTS 1 ret[macro + f"_IDX_{i}_ENUM_VAL_{subval}_EXISTS"] = 1 - if not spec.enum_tokenizable: - continue - - # DT_N__P__IDX__ENUM_TOKEN - ret[macro + f"_IDX_{i}_ENUM_TOKEN"] = subval - if spec.enum_upper_tokenizable: - # DT_N__P__IDX__ENUM_UPPER_TOKEN - ret[macro + f"_IDX_{i}_ENUM_UPPER_TOKEN"] = subval.upper() return ret From 0b88078b28ca21af50fef1b1fb943179e66359b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Tue, 29 Oct 2024 15:37:53 +0100 Subject: [PATCH 2015/4482] Bluetooth: host: Fix unsafe cast in is_subscribed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current implementation casts the user data to the attribute value, which makes an assumption about the user data. This commit changes the implementation to use the attribute value read function when extracting the characteristic properties. Signed-off-by: Håvard Reierstad --- subsys/bluetooth/host/gatt.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index 023216073e03f..33d8bc8b60bbf 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -3475,10 +3475,24 @@ bool bt_gatt_is_subscribed(struct bt_conn *conn, /* Check if attribute is a characteristic declaration */ if (!bt_uuid_cmp(attr->uuid, BT_UUID_GATT_CHRC)) { - struct bt_gatt_chrc *chrc = attr->user_data; + uint8_t properties; + ssize_t len; + + CHECKIF(!attr->read) { + LOG_ERR("Read method not set"); + return false; + } + /* The charactestic properties is the first byte of the attribute value */ + len = attr->read(NULL, attr, &properties, 1, 0); + if (len < 0) { + LOG_ERR("Failed to read attribute (err %zd)", len); + return false; + } else if (len != 1) { + LOG_ERR("Invalid read length: %zd", len); + return false; + } - if (!(chrc->properties & - (BT_GATT_CHRC_NOTIFY | BT_GATT_CHRC_INDICATE))) { + if (!(properties & (BT_GATT_CHRC_NOTIFY | BT_GATT_CHRC_INDICATE))) { /* Characteristic doesn't support subscription */ return false; } From 96f07b832efed97fad5801c468626ac43d0ffa7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Wed, 30 Oct 2024 12:25:47 +0100 Subject: [PATCH 2016/4482] doc: move less important information under the fold MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Help make sure the most important documentation entry points are visible without scrolling by moving less important information "under the fold". Signed-off-by: Benjamin Cabé --- doc/index.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/index.rst b/doc/index.rst index 3a7d3d75ea925..811bc36ed2b00 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -21,14 +21,6 @@ Zephyr Project Documentation Use the version selection menu on the left to view documentation for a specific version of Zephyr. -For information about the changes and additions for releases, please -consult the published :ref:`zephyr_release_notes` documentation. - -The Zephyr OS is provided under the `Apache 2.0 license`_ (as found in -the LICENSE file in the project's `GitHub repo`_). The Zephyr OS also -imports or reuses packages, scripts, and other files that use other -licensing, as described in :ref:`Zephyr_Licensing`. - .. raw:: html @@ -91,6 +83,14 @@ licensing, as described in :ref:`Zephyr_Licensing`. +For information about the changes and additions for past releases, please +consult the published :ref:`zephyr_release_notes` documentation. + +The Zephyr OS is provided under the `Apache 2.0 license`_ (as found in +the LICENSE file in the project's `GitHub repo`_). The Zephyr OS also +imports or reuses packages, scripts, and other files that use other +licensing, as described in :ref:`Zephyr_Licensing`. + .. toctree:: :maxdepth: 1 :caption: Contents From f7ffadaf3db660806484c6d013fb47c7e243a637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Wed, 30 Oct 2024 12:26:39 +0100 Subject: [PATCH 2017/4482] doc: hide main table of contents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hide the main table of contents so that it doesn't show up in the actual documentation index, only in the side bar. This helps keep the index less cluttered and to the point. Signed-off-by: Benjamin Cabé --- doc/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/index.rst b/doc/index.rst index 811bc36ed2b00..aa4918c583b98 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -93,7 +93,7 @@ licensing, as described in :ref:`Zephyr_Licensing`. .. toctree:: :maxdepth: 1 - :caption: Contents + :hidden: introduction/index.rst develop/index.rst From 9cfd185ab0b96321e559e947091e05f0c8084a39 Mon Sep 17 00:00:00 2001 From: Mert Vatansever Date: Wed, 30 Oct 2024 13:56:55 +0300 Subject: [PATCH 2018/4482] tests: drivers: flash: Fix MAX32666 flash error This commit fixes flash error by correcting flash size. Signed-off-by: Mert Vatansever --- .../flash/common/boards/max32666evkit_max32666_cpu0.overlay | 6 +++--- .../flash/common/boards/max32666fthr_max32666_cpu0.overlay | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/drivers/flash/common/boards/max32666evkit_max32666_cpu0.overlay b/tests/drivers/flash/common/boards/max32666evkit_max32666_cpu0.overlay index f29875c4f04c4..4e008dfde6656 100644 --- a/tests/drivers/flash/common/boards/max32666evkit_max32666_cpu0.overlay +++ b/tests/drivers/flash/common/boards/max32666evkit_max32666_cpu0.overlay @@ -11,13 +11,13 @@ #size-cells = <1>; code_partition: partition@0 { - reg = <0x0 DT_SIZE_K(512)>; + reg = <0x0 DT_SIZE_K(256)>; read-only; }; - storage_partition: partition@80000 { + storage_partition: partition@40000 { label = "storage"; - reg = <0x80000 DT_SIZE_K(512)>; + reg = <0x40000 DT_SIZE_K(256)>; }; }; }; diff --git a/tests/drivers/flash/common/boards/max32666fthr_max32666_cpu0.overlay b/tests/drivers/flash/common/boards/max32666fthr_max32666_cpu0.overlay index f29875c4f04c4..4e008dfde6656 100644 --- a/tests/drivers/flash/common/boards/max32666fthr_max32666_cpu0.overlay +++ b/tests/drivers/flash/common/boards/max32666fthr_max32666_cpu0.overlay @@ -11,13 +11,13 @@ #size-cells = <1>; code_partition: partition@0 { - reg = <0x0 DT_SIZE_K(512)>; + reg = <0x0 DT_SIZE_K(256)>; read-only; }; - storage_partition: partition@80000 { + storage_partition: partition@40000 { label = "storage"; - reg = <0x80000 DT_SIZE_K(512)>; + reg = <0x40000 DT_SIZE_K(256)>; }; }; }; From f82ffc921380689c46185bd63d92e33aaa4c971f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 30 Oct 2024 12:13:40 +0100 Subject: [PATCH 2019/4482] tests: lib: cbprintf_package: Extend test coverage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add test for cbprintf_package_convert function which checks if it correctly handles array that holds string lengths. When convert function is used twice, at first to calculate size of the output package and then to actually convert the package, array of string lengths can be used to optimize operation by not calculating string lengths twice. However, array may not be able to hold all string lengths that are needed for that package. In that case, string lengths that did not fit into the array will be calculated twice, in both conversions. Signed-off-by: Krzysztof Chruściński --- tests/lib/cbprintf_package/src/main.c | 54 +++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/tests/lib/cbprintf_package/src/main.c b/tests/lib/cbprintf_package/src/main.c index adc59cae58ecb..35deba58013f3 100644 --- a/tests/lib/cbprintf_package/src/main.c +++ b/tests/lib/cbprintf_package/src/main.c @@ -893,6 +893,60 @@ ZTEST(cbprintf_package, test_cbprintf_package_convert) } +/* Test uses package convert with initial size calculation. Array provided to hold + * argument string lengths is shorter than number of string arguments. + */ +ZTEST(cbprintf_package, test_cbprintf_package_convert_strl) +{ + int slen, clen; + char test_str[] = "test %s %d %s %s"; + char test_str1[] = "test str1"; + char test_str2[] = "test str 2"; + char test_str3[] = "test str 3"; + /* Store indexes of rw strings. */ + uint32_t flags = CBPRINTF_PACKAGE_ADD_RW_STR_POS; + struct test_cbprintf_covert_ctx ctx; + uint16_t strl[2]; + +#define TEST_FMT test_str, test_str1, 100, test_str2, test_str3 + char exp_str[256]; + + snprintfcb(exp_str, sizeof(exp_str), TEST_FMT); + + slen = cbprintf_package(NULL, 0, flags, TEST_FMT); + zassert_true(slen > 0); + + uint8_t __aligned(CBPRINTF_PACKAGE_ALIGNMENT) spackage[slen]; + + memset(&ctx, 0, sizeof(ctx)); + memset(spackage, 0, slen); + + slen = cbprintf_package(spackage, slen, flags, TEST_FMT); + zassert_true(slen > 0); + + uint32_t copy_flags = CBPRINTF_PACKAGE_CONVERT_RW_STR | + CBPRINTF_PACKAGE_CONVERT_KEEP_RO_STR; + + clen = cbprintf_package_convert(spackage, slen, NULL, 0, copy_flags, + strl, ARRAY_SIZE(strl)); + zassert_true(clen > 0); + /* Two locations were provided to store string lengths. 3rd string length + * will need to be calculated in both conversions. + */ + zassert_equal(strl[0], strlen(test_str1) + 1); + zassert_equal(strl[1], strlen(test_str2) + 1); + + clen = cbprintf_package_convert(spackage, slen, convert_cb, &ctx, copy_flags, + strl, ARRAY_SIZE(strl)); + zassert_true(clen > 0); + zassert_true(ctx.null); + zassert_equal((int)ctx.offset, clen); + + check_package(ctx.buf, ctx.offset, exp_str); +#undef TEST_FMT + +} + ZTEST(cbprintf_package, test_cbprintf_package_convert_static) { int slen, clen, olen; From 3bf54a9e85b2a895ac91fcb46dbbb35259ad314a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 30 Oct 2024 12:16:20 +0100 Subject: [PATCH 2020/4482] lib: os: cbprintf_packaged: Fix cbprintf_package_convert MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When conversion is done in two steps (output length calculation followed by the actual conversion), it was failing when helper array for holding calculated string length from the first conversion run was shorter than number of strings that were supposed to be appended to the package. Fix by taking into account strl_len to determine if length can be taken from the array or need to be calculated again. Signed-off-by: Krzysztof Chruściński --- lib/os/cbprintf_packaged.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/os/cbprintf_packaged.c b/lib/os/cbprintf_packaged.c index 9696016d31d6f..d5add5ecf3780 100644 --- a/lib/os/cbprintf_packaged.c +++ b/lib/os/cbprintf_packaged.c @@ -1148,7 +1148,7 @@ int cbprintf_package_convert(void *in_packaged, for (unsigned int i = 0; i < scpy_cnt; i++) { uint8_t loc = cpy_str_pos[i]; const char *str = *(const char **)&buf32[loc]; - uint16_t str_len = strl ? strl[i] : 0; + uint16_t str_len = (strl && (i < strl_len)) ? strl[i] : 0; rv = cb(&loc, 1, ctx); if (rv < 0) { From a8d28928ed667f2ea94759f646017ae467d745db Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 30 Oct 2024 09:29:38 +0100 Subject: [PATCH 2021/4482] boards: nrf54l15bsim doc: Clarify around entropy and crypto Let's explicitly mention we are enabling the native_posix entropy driver for this board (the real nrf54l15dk does not have an entropy driver in Zephyr yet). And correct a bit the wording around mbedtls as for the real target we don't have mbedtls with HW acceleration. Signed-off-by: Alberto Escolar Piedras --- boards/native/nrf_bsim/doc/nrf54l15bsim.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/boards/native/nrf_bsim/doc/nrf54l15bsim.rst b/boards/native/nrf_bsim/doc/nrf54l15bsim.rst index 61ad06c4aa515..3b542073103c2 100644 --- a/boards/native/nrf_bsim/doc/nrf54l15bsim.rst +++ b/boards/native/nrf_bsim/doc/nrf54l15bsim.rst @@ -89,5 +89,6 @@ ARM's TrustZone is not modeled in this board. This means that: can be labeled as restricted for secure or non secure access. * TF-M cannot be used. -Note that the CRACEN peripheral is not modeled. The mbedTLS library can still be used -but with a SW crypto backend. +Note that the CRACEN peripheral is not modeled. +As crypto library, Mbed TLS can be used with its SW crypto backend. +As entropy driver, the :dtcompatible:`zephyr,native-posix-rng` is enabled by default. From 4e776408742ff36873897f0ea1f3f253b348dc64 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 30 Oct 2024 07:54:15 +0000 Subject: [PATCH 2022/4482] west.yml: MCUboot synchronization from upstream Update Zephyr fork of MCUboot to revision: f74b77cf7808919837c0ed14c2ead3918c546349 Brings following Zephyr relevant fixes: - f74b77cf imgtool: fix signing for fix-sig-pubkey public rsa - 439930ae boot_serial: Fix serial recovery for LPC55x and MCXNx Signed-off-by: Jamie McCrae --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index f5a8923c458eb..e1f6fda9a9adb 100644 --- a/west.yml +++ b/west.yml @@ -285,7 +285,7 @@ manifest: groups: - crypto - name: mcuboot - revision: 33de65cebaf78b306501a4195dc0ce4008315e1a + revision: f74b77cf7808919837c0ed14c2ead3918c546349 path: bootloader/mcuboot groups: - bootloader From d1a3f4f4fee8efdb74effb887e9e2ab0e0c8975a Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 30 Oct 2024 16:13:13 +0200 Subject: [PATCH 2023/4482] Bluetooth: Host: Fix monitor UART selection Most boards set zephyr,bt-mon-uart to point at the same device as zephyr,console. It's still useful to have the possibility of having these as two different devices, however it's useful to fall back to the UART console in case a dedicated monitor UART hasn't been specified. This also ensures that the fallback only happens if the console UART isn't enabled, but a DT chosen property exists for it. Additionally, we now get a user friendly error in case the Bluetooth UART monitor feature has been enabled in Kconfig but there isn't a suitable UART available for it in devicetree. Signed-off-by: Johan Hedberg --- subsys/bluetooth/host/monitor.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/subsys/bluetooth/host/monitor.c b/subsys/bluetooth/host/monitor.c index bf434daaf9cfa..a02f115c966a5 100644 --- a/subsys/bluetooth/host/monitor.c +++ b/subsys/bluetooth/host/monitor.c @@ -150,7 +150,15 @@ static void poll_out(char c) } #elif defined(CONFIG_BT_DEBUG_MONITOR_UART) static const struct device *const monitor_dev = +#if DT_HAS_CHOSEN(zephyr_bt_mon_uart) DEVICE_DT_GET(DT_CHOSEN(zephyr_bt_mon_uart)); +#elif !defined(CONFIG_UART_CONSOLE) && DT_HAS_CHOSEN(zephyr_console) + /* Fall back to console UART if it's available */ + DEVICE_DT_GET(DT_CHOSEN(zephyr_console)); +#else + NULL; +#error "BT_DEBUG_MONITOR_UART enabled but no UART specified" +#endif static void poll_out(char c) { From 5c376ad24c26a6881e0c46676e7ff70eae42cef1 Mon Sep 17 00:00:00 2001 From: Andrej Butok Date: Fri, 1 Nov 2024 11:02:10 +0100 Subject: [PATCH 2024/4482] samples: smp_svr: fix overlay-udp.conf build - fixes overlay-udp.conf build for platforms without TRNG. - adds TEST_RANDOM_GENERATOR, as for most network samples. Signed-off-by: Andrej Butok --- samples/subsys/mgmt/mcumgr/smp_svr/overlay-udp.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/overlay-udp.conf b/samples/subsys/mgmt/mcumgr/smp_svr/overlay-udp.conf index 20ef2fedb58aa..b2e7875a67e70 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/overlay-udp.conf +++ b/samples/subsys/mgmt/mcumgr/smp_svr/overlay-udp.conf @@ -11,5 +11,6 @@ CONFIG_NET_IPV6=y CONFIG_NET_SOCKETS=y CONFIG_NET_CONNECTION_MANAGER=y CONFIG_NET_CONFIG_SETTINGS=y +CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.168.1.1" CONFIG_NET_CONFIG_MY_IPV6_ADDR="2001:db8::1" From 5f4bb46f97cd9397744366daec82e3c913f95fbf Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 30 Oct 2024 17:23:00 +0200 Subject: [PATCH 2025/4482] samples: net: wifi: Move wifi sample to under shell directory Move samples/net/wifi application to samples/net/wifi/shell as it has been used as a shell application before. Following commits will add new wifi samples to this directory. Signed-off-by: Jukka Rissanen --- samples/net/wifi/{ => shell}/CMakeLists.txt | 0 samples/net/wifi/{ => shell}/README.rst | 0 samples/net/wifi/{ => shell}/boards/cc3220sf_launchxl.conf | 0 samples/net/wifi/{ => shell}/boards/cc3235sf_launchxl.conf | 0 samples/net/wifi/{ => shell}/boards/cy8cproto_062_4343w.conf | 0 samples/net/wifi/{ => shell}/boards/frdm_rw612.conf | 0 samples/net/wifi/{ => shell}/boards/rd_rw612_bga.conf | 0 samples/net/wifi/{ => shell}/boards/reel_board.conf | 0 samples/net/wifi/{ => shell}/boards/reel_board.overlay | 0 .../net/wifi/{ => shell}/overlay-enterprise-variable-bufs.conf | 0 samples/net/wifi/{ => shell}/overlay-enterprise.conf | 0 samples/net/wifi/{ => shell}/prj.conf | 0 samples/net/wifi/{ => shell}/sample.yaml | 0 samples/net/wifi/{ => shell}/socs/esp32_procpu.conf | 0 samples/net/wifi/{ => shell}/socs/esp32_procpu.overlay | 0 samples/net/wifi/{ => shell}/socs/esp32c3.conf | 0 samples/net/wifi/{ => shell}/socs/esp32c3.overlay | 0 samples/net/wifi/{ => shell}/socs/esp32s2.conf | 0 samples/net/wifi/{ => shell}/socs/esp32s2.overlay | 0 samples/net/wifi/{ => shell}/socs/esp32s3_procpu.conf | 0 samples/net/wifi/{ => shell}/socs/esp32s3_procpu.overlay | 0 samples/net/wifi/{ => shell}/src/wifi_test.c | 0 22 files changed, 0 insertions(+), 0 deletions(-) rename samples/net/wifi/{ => shell}/CMakeLists.txt (100%) rename samples/net/wifi/{ => shell}/README.rst (100%) rename samples/net/wifi/{ => shell}/boards/cc3220sf_launchxl.conf (100%) rename samples/net/wifi/{ => shell}/boards/cc3235sf_launchxl.conf (100%) rename samples/net/wifi/{ => shell}/boards/cy8cproto_062_4343w.conf (100%) rename samples/net/wifi/{ => shell}/boards/frdm_rw612.conf (100%) rename samples/net/wifi/{ => shell}/boards/rd_rw612_bga.conf (100%) rename samples/net/wifi/{ => shell}/boards/reel_board.conf (100%) rename samples/net/wifi/{ => shell}/boards/reel_board.overlay (100%) rename samples/net/wifi/{ => shell}/overlay-enterprise-variable-bufs.conf (100%) rename samples/net/wifi/{ => shell}/overlay-enterprise.conf (100%) rename samples/net/wifi/{ => shell}/prj.conf (100%) rename samples/net/wifi/{ => shell}/sample.yaml (100%) rename samples/net/wifi/{ => shell}/socs/esp32_procpu.conf (100%) rename samples/net/wifi/{ => shell}/socs/esp32_procpu.overlay (100%) rename samples/net/wifi/{ => shell}/socs/esp32c3.conf (100%) rename samples/net/wifi/{ => shell}/socs/esp32c3.overlay (100%) rename samples/net/wifi/{ => shell}/socs/esp32s2.conf (100%) rename samples/net/wifi/{ => shell}/socs/esp32s2.overlay (100%) rename samples/net/wifi/{ => shell}/socs/esp32s3_procpu.conf (100%) rename samples/net/wifi/{ => shell}/socs/esp32s3_procpu.overlay (100%) rename samples/net/wifi/{ => shell}/src/wifi_test.c (100%) diff --git a/samples/net/wifi/CMakeLists.txt b/samples/net/wifi/shell/CMakeLists.txt similarity index 100% rename from samples/net/wifi/CMakeLists.txt rename to samples/net/wifi/shell/CMakeLists.txt diff --git a/samples/net/wifi/README.rst b/samples/net/wifi/shell/README.rst similarity index 100% rename from samples/net/wifi/README.rst rename to samples/net/wifi/shell/README.rst diff --git a/samples/net/wifi/boards/cc3220sf_launchxl.conf b/samples/net/wifi/shell/boards/cc3220sf_launchxl.conf similarity index 100% rename from samples/net/wifi/boards/cc3220sf_launchxl.conf rename to samples/net/wifi/shell/boards/cc3220sf_launchxl.conf diff --git a/samples/net/wifi/boards/cc3235sf_launchxl.conf b/samples/net/wifi/shell/boards/cc3235sf_launchxl.conf similarity index 100% rename from samples/net/wifi/boards/cc3235sf_launchxl.conf rename to samples/net/wifi/shell/boards/cc3235sf_launchxl.conf diff --git a/samples/net/wifi/boards/cy8cproto_062_4343w.conf b/samples/net/wifi/shell/boards/cy8cproto_062_4343w.conf similarity index 100% rename from samples/net/wifi/boards/cy8cproto_062_4343w.conf rename to samples/net/wifi/shell/boards/cy8cproto_062_4343w.conf diff --git a/samples/net/wifi/boards/frdm_rw612.conf b/samples/net/wifi/shell/boards/frdm_rw612.conf similarity index 100% rename from samples/net/wifi/boards/frdm_rw612.conf rename to samples/net/wifi/shell/boards/frdm_rw612.conf diff --git a/samples/net/wifi/boards/rd_rw612_bga.conf b/samples/net/wifi/shell/boards/rd_rw612_bga.conf similarity index 100% rename from samples/net/wifi/boards/rd_rw612_bga.conf rename to samples/net/wifi/shell/boards/rd_rw612_bga.conf diff --git a/samples/net/wifi/boards/reel_board.conf b/samples/net/wifi/shell/boards/reel_board.conf similarity index 100% rename from samples/net/wifi/boards/reel_board.conf rename to samples/net/wifi/shell/boards/reel_board.conf diff --git a/samples/net/wifi/boards/reel_board.overlay b/samples/net/wifi/shell/boards/reel_board.overlay similarity index 100% rename from samples/net/wifi/boards/reel_board.overlay rename to samples/net/wifi/shell/boards/reel_board.overlay diff --git a/samples/net/wifi/overlay-enterprise-variable-bufs.conf b/samples/net/wifi/shell/overlay-enterprise-variable-bufs.conf similarity index 100% rename from samples/net/wifi/overlay-enterprise-variable-bufs.conf rename to samples/net/wifi/shell/overlay-enterprise-variable-bufs.conf diff --git a/samples/net/wifi/overlay-enterprise.conf b/samples/net/wifi/shell/overlay-enterprise.conf similarity index 100% rename from samples/net/wifi/overlay-enterprise.conf rename to samples/net/wifi/shell/overlay-enterprise.conf diff --git a/samples/net/wifi/prj.conf b/samples/net/wifi/shell/prj.conf similarity index 100% rename from samples/net/wifi/prj.conf rename to samples/net/wifi/shell/prj.conf diff --git a/samples/net/wifi/sample.yaml b/samples/net/wifi/shell/sample.yaml similarity index 100% rename from samples/net/wifi/sample.yaml rename to samples/net/wifi/shell/sample.yaml diff --git a/samples/net/wifi/socs/esp32_procpu.conf b/samples/net/wifi/shell/socs/esp32_procpu.conf similarity index 100% rename from samples/net/wifi/socs/esp32_procpu.conf rename to samples/net/wifi/shell/socs/esp32_procpu.conf diff --git a/samples/net/wifi/socs/esp32_procpu.overlay b/samples/net/wifi/shell/socs/esp32_procpu.overlay similarity index 100% rename from samples/net/wifi/socs/esp32_procpu.overlay rename to samples/net/wifi/shell/socs/esp32_procpu.overlay diff --git a/samples/net/wifi/socs/esp32c3.conf b/samples/net/wifi/shell/socs/esp32c3.conf similarity index 100% rename from samples/net/wifi/socs/esp32c3.conf rename to samples/net/wifi/shell/socs/esp32c3.conf diff --git a/samples/net/wifi/socs/esp32c3.overlay b/samples/net/wifi/shell/socs/esp32c3.overlay similarity index 100% rename from samples/net/wifi/socs/esp32c3.overlay rename to samples/net/wifi/shell/socs/esp32c3.overlay diff --git a/samples/net/wifi/socs/esp32s2.conf b/samples/net/wifi/shell/socs/esp32s2.conf similarity index 100% rename from samples/net/wifi/socs/esp32s2.conf rename to samples/net/wifi/shell/socs/esp32s2.conf diff --git a/samples/net/wifi/socs/esp32s2.overlay b/samples/net/wifi/shell/socs/esp32s2.overlay similarity index 100% rename from samples/net/wifi/socs/esp32s2.overlay rename to samples/net/wifi/shell/socs/esp32s2.overlay diff --git a/samples/net/wifi/socs/esp32s3_procpu.conf b/samples/net/wifi/shell/socs/esp32s3_procpu.conf similarity index 100% rename from samples/net/wifi/socs/esp32s3_procpu.conf rename to samples/net/wifi/shell/socs/esp32s3_procpu.conf diff --git a/samples/net/wifi/socs/esp32s3_procpu.overlay b/samples/net/wifi/shell/socs/esp32s3_procpu.overlay similarity index 100% rename from samples/net/wifi/socs/esp32s3_procpu.overlay rename to samples/net/wifi/shell/socs/esp32s3_procpu.overlay diff --git a/samples/net/wifi/src/wifi_test.c b/samples/net/wifi/shell/src/wifi_test.c similarity index 100% rename from samples/net/wifi/src/wifi_test.c rename to samples/net/wifi/shell/src/wifi_test.c From d75b21058ed0288664db2959f888e9096235fb42 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 30 Oct 2024 17:27:46 +0200 Subject: [PATCH 2026/4482] samples: net: wifi: Relocate AP and STA wifi sample The AT / STA wifi sample is generic so it does not need to be located under espressif board directory. Following commit will do additional changes to make the sample more generic. Signed-off-by: Jukka Rissanen --- .../wifi_apsta_mode => net/wifi/apsta_mode}/CMakeLists.txt | 0 .../espressif/wifi_apsta_mode => net/wifi/apsta_mode}/README.rst | 0 .../wifi/apsta_mode}/boards/esp32_devkitc_wroom_procpu.conf | 0 .../wifi/apsta_mode}/boards/esp32_devkitc_wroom_procpu.overlay | 0 .../espressif/wifi_apsta_mode => net/wifi/apsta_mode}/prj.conf | 0 .../espressif/wifi_apsta_mode => net/wifi/apsta_mode}/src/main.c | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename samples/{boards/espressif/wifi_apsta_mode => net/wifi/apsta_mode}/CMakeLists.txt (100%) rename samples/{boards/espressif/wifi_apsta_mode => net/wifi/apsta_mode}/README.rst (100%) rename samples/{boards/espressif/wifi_apsta_mode => net/wifi/apsta_mode}/boards/esp32_devkitc_wroom_procpu.conf (100%) rename samples/{boards/espressif/wifi_apsta_mode => net/wifi/apsta_mode}/boards/esp32_devkitc_wroom_procpu.overlay (100%) rename samples/{boards/espressif/wifi_apsta_mode => net/wifi/apsta_mode}/prj.conf (100%) rename samples/{boards/espressif/wifi_apsta_mode => net/wifi/apsta_mode}/src/main.c (100%) diff --git a/samples/boards/espressif/wifi_apsta_mode/CMakeLists.txt b/samples/net/wifi/apsta_mode/CMakeLists.txt similarity index 100% rename from samples/boards/espressif/wifi_apsta_mode/CMakeLists.txt rename to samples/net/wifi/apsta_mode/CMakeLists.txt diff --git a/samples/boards/espressif/wifi_apsta_mode/README.rst b/samples/net/wifi/apsta_mode/README.rst similarity index 100% rename from samples/boards/espressif/wifi_apsta_mode/README.rst rename to samples/net/wifi/apsta_mode/README.rst diff --git a/samples/boards/espressif/wifi_apsta_mode/boards/esp32_devkitc_wroom_procpu.conf b/samples/net/wifi/apsta_mode/boards/esp32_devkitc_wroom_procpu.conf similarity index 100% rename from samples/boards/espressif/wifi_apsta_mode/boards/esp32_devkitc_wroom_procpu.conf rename to samples/net/wifi/apsta_mode/boards/esp32_devkitc_wroom_procpu.conf diff --git a/samples/boards/espressif/wifi_apsta_mode/boards/esp32_devkitc_wroom_procpu.overlay b/samples/net/wifi/apsta_mode/boards/esp32_devkitc_wroom_procpu.overlay similarity index 100% rename from samples/boards/espressif/wifi_apsta_mode/boards/esp32_devkitc_wroom_procpu.overlay rename to samples/net/wifi/apsta_mode/boards/esp32_devkitc_wroom_procpu.overlay diff --git a/samples/boards/espressif/wifi_apsta_mode/prj.conf b/samples/net/wifi/apsta_mode/prj.conf similarity index 100% rename from samples/boards/espressif/wifi_apsta_mode/prj.conf rename to samples/net/wifi/apsta_mode/prj.conf diff --git a/samples/boards/espressif/wifi_apsta_mode/src/main.c b/samples/net/wifi/apsta_mode/src/main.c similarity index 100% rename from samples/boards/espressif/wifi_apsta_mode/src/main.c rename to samples/net/wifi/apsta_mode/src/main.c From c005997a0dc7d8ef27a8fbd3438a1c6411ffb3c6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 30 Oct 2024 17:33:37 +0200 Subject: [PATCH 2027/4482] samples: net: wifi: Update the AP-STA mode sample Update the AP/STA mode README file to make it more generic. Signed-off-by: Jukka Rissanen --- boards/ti/cc3220sf_launchxl/doc/index.rst | 2 +- boards/ti/cc3235sf_launchxl/doc/index.rst | 2 +- doc/_scripts/redirects.py | 3 ++- samples/net/wifi/README.rst | 5 +++++ samples/net/wifi/apsta_mode/README.rst | 8 ++++---- samples/net/wifi/shell/README.rst | 6 +++--- 6 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 samples/net/wifi/README.rst diff --git a/boards/ti/cc3220sf_launchxl/doc/index.rst b/boards/ti/cc3220sf_launchxl/doc/index.rst index 63952bd4351b8..6ff33afb88b2c 100644 --- a/boards/ti/cc3220sf_launchxl/doc/index.rst +++ b/boards/ti/cc3220sf_launchxl/doc/index.rst @@ -215,7 +215,7 @@ Usage: Set :kconfig:option:`CONFIG_WIFI_SIMPLELINK` and :kconfig:option:`CONFIG_WIFI` to ``y`` to enable Wi-Fi. -See :zephyr_file:`samples/net/wifi/boards/cc3220sf_launchxl.conf`. +See :zephyr_file:`samples/net/wifi/shell/boards/cc3220sf_launchxl.conf`. Provisioning: ============= diff --git a/boards/ti/cc3235sf_launchxl/doc/index.rst b/boards/ti/cc3235sf_launchxl/doc/index.rst index 5ddf5930d0d73..7602a3b27125a 100644 --- a/boards/ti/cc3235sf_launchxl/doc/index.rst +++ b/boards/ti/cc3235sf_launchxl/doc/index.rst @@ -215,7 +215,7 @@ Usage: Set :kconfig:option:`CONFIG_WIFI_SIMPLELINK` and :kconfig:option:`CONFIG_WIFI` to ``y`` to enable Wi-Fi. -See :zephyr_file:`samples/net/wifi/boards/cc3235sf_launchxl.conf`. +See :zephyr_file:`samples/net/wifi/shell/boards/cc3235sf_launchxl.conf`. Provisioning: ============= diff --git a/doc/_scripts/redirects.py b/doc/_scripts/redirects.py index 31e7a3b0d190b..d7c3d1d733706 100644 --- a/doc/_scripts/redirects.py +++ b/doc/_scripts/redirects.py @@ -231,8 +231,9 @@ ('samples/boards/esp32/flash_memory_mapped/README', 'samples/boards/espressif/flash_memory_mapped/README'), ('samples/boards/esp32/light_sleep/README', 'samples/boards/espressif/light_sleep/README'), ('samples/boards/esp32/spiram_test/README', 'samples/boards/espressif/spiram_test/README'), - ('samples/boards/esp32/wifi_apsta_mode/README', 'samples/boards/espressif/wifi_apsta_mode/README'), + ('samples/boards/esp32/wifi_apsta_mode/README', 'samples/net/wifi/apsta_mode/README'), ('samples/boards/esp32/xt_wdt/README', 'samples/boards/espressif/xt_wdt/README'), + ('samples/boards/espressif/wifi_apsta_mode/README', 'samples/net/wifi/apsta_mode/README'), ('samples/boards/google_twinkie_v2_pda/README', 'samples/boards/google/twinkie_v2/pda/README'), ('samples/boards/intel_adsp/code_relocation/README', 'samples/boards/intel/adsp/code_relocation/README'), ('samples/boards/litex/i2s/README', 'samples/boards/enjoydigital/litex/i2s/README'), diff --git a/samples/net/wifi/README.rst b/samples/net/wifi/README.rst new file mode 100644 index 0000000000000..b876e8b01dc30 --- /dev/null +++ b/samples/net/wifi/README.rst @@ -0,0 +1,5 @@ +.. zephyr:code-sample-category:: wifi + :name: Wi-Fi + :show-listing: + + These samples demonstrate various Wi-Fi use cases for boards that support it. diff --git a/samples/net/wifi/apsta_mode/README.rst b/samples/net/wifi/apsta_mode/README.rst index e6c8ff65f357e..38f5c1c2e7c37 100644 --- a/samples/net/wifi/apsta_mode/README.rst +++ b/samples/net/wifi/apsta_mode/README.rst @@ -1,13 +1,13 @@ -.. zephyr:code-sample:: esp32-wifi-ap-sta-mode +.. zephyr:code-sample:: wifi-ap-sta-mode :name: Wi-Fi AP-STA mode :relevant-api: wifi_mgmt dhcpv4_server - Setup ESP32 to function as both an Access Point (AP) and a Station (STA) simultaneously. + Configure a Wi-Fi board to operate as both an Access Point (AP) and a Station (STA). Overview ******** -The Wi-Fi AP-STA mode of the ESP32 allows it to function as both +The Wi-Fi AP-STA mode of a Wi-Fi board allows it to function as both an Access Point (AP) and a Station (STA) simultaneously. This sample demonstrates how to configure and utilize AP-STA mode. @@ -21,7 +21,7 @@ In this demo, AP-STA mode is enabled using :kconfig:option:`CONFIG_ESP32_WIFI_AP An additional Wi-Fi node is added in the ``.overlay`` file. The ``net_if``. In the sample code, initially, the AP mode is enabled, followed by enabling the STA mode. The driver checks if AP mode was previously enabled. If so, it transitions -the ESP32 into AP-STA mode to support both modes and attempts to connect to the +the board into AP-STA mode to support both modes and attempts to connect to the AP specified by the provided SSID and PSK. Requirements diff --git a/samples/net/wifi/shell/README.rst b/samples/net/wifi/shell/README.rst index 81aaa61a72910..74d77e63c04c9 100644 --- a/samples/net/wifi/shell/README.rst +++ b/samples/net/wifi/shell/README.rst @@ -17,11 +17,11 @@ Building and Running Verify the board and chip you are targeting provide Wi-Fi support. -For instance you can use TI's CC3220 by selecting the cc3220sf_launchxl board. +For instance you can use Nordic's nrf7002dk by selecting the nrf7002dk/nrf5340/cpuapp board. .. zephyr-app-commands:: - :zephyr-app: samples/net/wifi - :board: cc3220sf_launchxl + :zephyr-app: samples/net/wifi/shell + :board: nrf7002dk/nrf5340/cpuapp :goals: build :compact: From f3d29d6fd29d04fdec441d5e1fbbdbeb4c3888c4 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 10 Oct 2024 14:17:52 +0200 Subject: [PATCH 2028/4482] dts: bindings: power: add nordic,nrf-global-pd Add binding for Global Power Domain found in nRF54Hx SoCs. Signed-off-by: Gerard Marull-Paretas --- dts/bindings/power/nordic,nrf-gpd.yaml | 11 +++++++++++ .../zephyr/dt-bindings/power/nordic-nrf-gpd.h | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 dts/bindings/power/nordic,nrf-gpd.yaml create mode 100644 include/zephyr/dt-bindings/power/nordic-nrf-gpd.h diff --git a/dts/bindings/power/nordic,nrf-gpd.yaml b/dts/bindings/power/nordic,nrf-gpd.yaml new file mode 100644 index 0000000000000..feb5f2862e913 --- /dev/null +++ b/dts/bindings/power/nordic,nrf-gpd.yaml @@ -0,0 +1,11 @@ +# Copyright 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: Nordic nRF Global Power Domain + +compatible: "nordic,nrf-gpd" + +include: base.yaml + +power-domain-cells: + - id diff --git a/include/zephyr/dt-bindings/power/nordic-nrf-gpd.h b/include/zephyr/dt-bindings/power/nordic-nrf-gpd.h new file mode 100644 index 0000000000000..7f6952f6f0bcb --- /dev/null +++ b/include/zephyr/dt-bindings/power/nordic-nrf-gpd.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + + +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_POWER_NORDIC_NRF_GLOBAL_PD +#define ZEPHYR_INCLUDE_DT_BINDINGS_POWER_NORDIC_NRF_GLOBAL_PD + +/* numbers aligned to nrfs service identifiers */ +#define NRF_GPD_SLOW_MAIN 2U +#define NRF_GPD_SLOW_ACTIVE 1U +#define NRF_GPD_FAST_MAIN 3U +#define NRF_GPD_FAST_ACTIVE1 0U +#define NRF_GPD_FAST_ACTIVE0 4U + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_POWER_NORDIC_NRF_GLOBAL_PD */ From a56a170b7e4009d020969e17f3f82554c5f0b580 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 16 Oct 2024 10:47:17 +0200 Subject: [PATCH 2029/4482] dts: nordic: nrf54h20: define global power domain Add the global power domain entry. This domain is not memory-mapped but controlled using NRFS services. Signed-off-by: Gerard Marull-Paretas --- dts/common/nordic/nrf54h20.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index 92a4880cf1795..11dc00139963d 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -194,6 +194,11 @@ }; }; + gpd: global-power-domain { + compatible = "nordic,nrf-gpd"; + #power-domain-cells = <1>; + }; + soc { #address-cells = <1>; #size-cells = <1>; From 01e285c1bad4e1f175502a0bc39b13815c9055c9 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 10 Oct 2024 14:18:51 +0200 Subject: [PATCH 2030/4482] dts: nordic: nrf54h20: add power domain information So that it can be used to manually control certain power domains. Signed-off-by: Gerard Marull-Paretas --- dts/common/nordic/nrf54h20.dtsi | 84 +++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index 11dc00139963d..8da783386865b 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -13,6 +13,7 @@ #include #include #include +#include /delete-node/ &sw_pwm; @@ -206,6 +207,7 @@ mram1x: mram@e000000 { compatible = "nordic,mram"; reg = <0xe000000 DT_SIZE_K(2048)>; + power-domains = <&gpd NRF_GPD_FAST_ACTIVE0>; erase-block-size = <4096>; write-block-size = <16>; }; @@ -482,6 +484,7 @@ reg = <0x86000 0x1000>, <0x2f700000 0x40000>; reg-names = "wrapper", "core"; interrupts = <134 NRF_DEFAULT_IRQ_PRIORITY>; + power-domains = <&gpd NRF_GPD_FAST_ACTIVE0>; num-in-eps = <8>; num-out-eps = <10>; ghwcfg1 = <0xaa555000>; @@ -497,6 +500,7 @@ reg = <0x95000 0x500 0x95500 0xb00>; reg-names = "wrapper", "core"; interrupts = <149 NRF_DEFAULT_IRQ_PRIORITY>; + power-domains = <&gpd NRF_GPD_FAST_ACTIVE0>; clock-frequency = ; fifo-depth = <32>; max-xfer-size = <16>; @@ -506,18 +510,21 @@ cpusec_bellboard: mailbox@99000 { reg = <0x99000 0x1000>; status = "disabled"; + power-domains = <&gpd NRF_GPD_FAST_ACTIVE0>; #mbox-cells = <1>; }; cpuapp_bellboard: mailbox@9a000 { reg = <0x9a000 0x1000>; status = "disabled"; + power-domains = <&gpd NRF_GPD_FAST_ACTIVE0>; #mbox-cells = <1>; }; cpurad_bellboard: mailbox@9b000 { reg = <0x9b000 0x1000>; status = "disabled"; + power-domains = <&gpd NRF_GPD_FAST_ACTIVE0>; #mbox-cells = <1>; }; @@ -558,6 +565,7 @@ compatible = "nordic,nrf-vpr-coprocessor"; reg = <0x8d4000 0x1000>; status = "disabled"; + power-domains = <&gpd NRF_GPD_FAST_ACTIVE1>; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x8d4000 0x1000>; @@ -578,6 +586,7 @@ reg-names = "wrapper", "m_can", "message_ram"; interrupts = <216 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&canpll>; + power-domains = <&gpd NRF_GPD_FAST_ACTIVE1>; bosch,mram-cfg = <0x0 28 8 3 3 0 1 1>; status = "disabled"; }; @@ -586,6 +595,7 @@ compatible = "nordic,nrf-dppic-global"; reg = <0x8e1000 0x1000>; status = "disabled"; + power-domains = <&gpd NRF_GPD_FAST_ACTIVE1>; }; timer120: timer@8e2000 { @@ -594,6 +604,7 @@ status = "disabled"; cc-num = <6>; interrupts = <226 NRF_DEFAULT_IRQ_PRIORITY>; + power-domains = <&gpd NRF_GPD_FAST_ACTIVE1>; max-bit-width = <32>; max-frequency = ; prescaler = <0>; @@ -605,6 +616,7 @@ status = "disabled"; cc-num = <6>; interrupts = <227 NRF_DEFAULT_IRQ_PRIORITY>; + power-domains = <&gpd NRF_GPD_FAST_ACTIVE1>; max-bit-width = <32>; max-frequency = ; prescaler = <0>; @@ -615,6 +627,7 @@ reg = <0x8e4000 0x1000>; status = "disabled"; interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>; + power-domains = <&gpd NRF_GPD_FAST_ACTIVE1>; #pwm-cells = <3>; }; @@ -622,6 +635,7 @@ compatible = "nordic,nrf-spim"; reg = <0x8e6000 0x1000>; status = "disabled"; + power-domains = <&gpd NRF_GPD_FAST_ACTIVE1>; easydma-maxcnt-bits = <15>; interrupts = <230 NRF_DEFAULT_IRQ_PRIORITY>; max-frequency = ; @@ -639,6 +653,7 @@ status = "disabled"; interrupts = <230 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&hsfll120>; + power-domains = <&gpd NRF_GPD_FAST_ACTIVE1>; endtx-stoptx-supported; frame-timeout-supported; }; @@ -649,6 +664,7 @@ status = "disabled"; easydma-maxcnt-bits = <15>; interrupts = <231 NRF_DEFAULT_IRQ_PRIORITY>; + power-domains = <&gpd NRF_GPD_FAST_ACTIVE1>; max-frequency = ; #address-cells = <1>; #size-cells = <0>; @@ -665,6 +681,7 @@ #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x908000 0x1000>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; cpuppr_vevif_tx: mailbox@0 { compatible = "nordic,nrf-vevif-task-tx"; @@ -680,6 +697,7 @@ compatible = "nordic,nrf-ipct-global"; reg = <0x921000 0x1000>; status = "disabled"; + power-domains = <&gpd NRF_GPD_SLOW_MAIN>; channels = <8>; global-domain-id = <13>; }; @@ -688,6 +706,7 @@ compatible = "nordic,nrf-dppic-global"; reg = <0x922000 0x1000>; status = "disabled"; + power-domains = <&gpd NRF_GPD_SLOW_MAIN>; }; rtc130: rtc@928000 { @@ -697,6 +716,7 @@ cc-num = <4>; clock-frequency = <32768>; interrupts = <296 NRF_DEFAULT_IRQ_PRIORITY>; + power-domains = <&gpd NRF_GPD_SLOW_MAIN>; clocks = <&lfclk>; prescaler = <1>; }; @@ -708,6 +728,7 @@ cc-num = <4>; clock-frequency = <32768>; interrupts = <297 NRF_DEFAULT_IRQ_PRIORITY>; + power-domains = <&gpd NRF_GPD_SLOW_MAIN>; clocks = <&lfclk>; prescaler = <1>; }; @@ -718,6 +739,7 @@ status = "disabled"; interrupts = <299 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&lfclk>; + power-domains = <&gpd NRF_GPD_SLOW_MAIN>; }; wdt132: watchdog@92c000 { @@ -726,6 +748,7 @@ status = "disabled"; interrupts = <300 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&lfclk>; + power-domains = <&gpd NRF_GPD_SLOW_MAIN>; }; egu130: egu@92d000 { @@ -733,12 +756,14 @@ reg = <0x92d000 0x1000>; status = "disabled"; interrupts = <301 NRF_DEFAULT_IRQ_PRIORITY>; + power-domains = <&gpd NRF_GPD_SLOW_MAIN>; }; gpiote130: gpiote@934000 { compatible = "nordic,nrf-gpiote"; reg = <0x934000 0x1000>; status = "disabled"; + power-domains = <&gpd NRF_GPD_SLOW_MAIN>; instance = <130>; }; @@ -748,6 +773,7 @@ status = "disabled"; #gpio-cells = <2>; gpio-controller; + power-domains = <&gpd NRF_GPD_SLOW_MAIN>; gpiote-instance = <&gpiote130>; ngpios = <12>; port = <0>; @@ -759,6 +785,7 @@ status = "disabled"; #gpio-cells = <2>; gpio-controller; + power-domains = <&gpd NRF_GPD_SLOW_MAIN>; gpiote-instance = <&gpiote130>; ngpios = <12>; port = <1>; @@ -770,6 +797,7 @@ status = "disabled"; #gpio-cells = <2>; gpio-controller; + power-domains = <&gpd NRF_GPD_SLOW_MAIN>; gpiote-instance = <&gpiote130>; ngpios = <12>; port = <2>; @@ -781,6 +809,9 @@ status = "disabled"; #gpio-cells = <2>; gpio-controller; + power-domains = <&gpd NRF_GPD_SLOW_MAIN>, + <&gpd NRF_GPD_FAST_ACTIVE1>; + power-domain-names = "peripheral", "pad"; ngpios = <14>; port = <6>; }; @@ -791,6 +822,9 @@ status = "disabled"; #gpio-cells = <2>; gpio-controller; + power-domains = <&gpd NRF_GPD_SLOW_MAIN>, + <&gpd NRF_GPD_FAST_ACTIVE1>; + power-domain-names = "peripheral", "pad"; ngpios = <8>; port = <7>; }; @@ -801,6 +835,7 @@ status = "disabled"; #gpio-cells = <2>; gpio-controller; + power-domains = <&gpd NRF_GPD_SLOW_MAIN>; gpiote-instance = <&gpiote130>; ngpios = <6>; port = <9>; @@ -810,6 +845,7 @@ compatible = "nordic,nrf-dppic-global"; reg = <0x981000 0x1000>; status = "disabled"; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; }; adc: adc@982000 { @@ -818,6 +854,7 @@ interrupts = <386 NRF_DEFAULT_IRQ_PRIORITY>; status = "disabled"; #io-channel-cells = <1>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; }; comp: comparator@983000 { @@ -829,6 +866,7 @@ reg = <0x983000 0x1000>; status = "disabled"; interrupts = <387 NRF_DEFAULT_IRQ_PRIORITY>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; }; temp: temperature-sensor@984000 { @@ -836,6 +874,7 @@ reg = <0x984000 0x1000>; interrupts = <388 NRF_DEFAULT_IRQ_PRIORITY>; status = "disabled"; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; }; nfct: nfct@985000 { @@ -843,12 +882,14 @@ reg = <0x985000 0x1000>; status = "disabled"; interrupts = <389 NRF_DEFAULT_IRQ_PRIORITY>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; }; dppic132: dppic@991000 { compatible = "nordic,nrf-dppic-global"; reg = <0x991000 0x1000>; status = "disabled"; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; }; qdec130: qdec@994000 { @@ -856,6 +897,7 @@ reg = <0x994000 0x1000>; status = "disabled"; interrupts = <404 NRF_DEFAULT_IRQ_PRIORITY>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; }; qdec131: qdec@995000 { @@ -863,6 +905,7 @@ reg = <0x995000 0x1000>; status = "disabled"; interrupts = <405 NRF_DEFAULT_IRQ_PRIORITY>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; }; grtc: grtc@99c000 { @@ -875,12 +918,14 @@ * one is linked here. */ clocks = <&lfclk>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; }; dppic133: dppic@9a1000 { compatible = "nordic,nrf-dppic-global"; reg = <0x9a1000 0x1000>; status = "disabled"; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; }; timer130: timer@9a2000 { @@ -890,6 +935,7 @@ cc-num = <6>; interrupts = <418 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; max-bit-width = <32>; prescaler = <0>; }; @@ -901,6 +947,7 @@ cc-num = <6>; interrupts = <419 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; max-bit-width = <32>; prescaler = <0>; }; @@ -911,6 +958,7 @@ status = "disabled"; interrupts = <420 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; #pwm-cells = <3>; }; @@ -920,6 +968,7 @@ status = "disabled"; interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; easydma-maxcnt-bits = <15>; #address-cells = <1>; #size-cells = <0>; @@ -935,6 +984,7 @@ easydma-maxcnt-bits = <15>; interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; max-frequency = ; #address-cells = <1>; #size-cells = <0>; @@ -952,6 +1002,7 @@ status = "disabled"; interrupts = <421 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; @@ -963,6 +1014,7 @@ status = "disabled"; interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; easydma-maxcnt-bits = <15>; #address-cells = <1>; #size-cells = <0>; @@ -978,6 +1030,7 @@ easydma-maxcnt-bits = <15>; interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; max-frequency = ; #address-cells = <1>; #size-cells = <0>; @@ -995,6 +1048,7 @@ status = "disabled"; interrupts = <422 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; @@ -1004,6 +1058,7 @@ compatible = "nordic,nrf-dppic-global"; reg = <0x9b1000 0x1000>; status = "disabled"; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; }; timer132: timer@9b2000 { @@ -1013,6 +1068,7 @@ cc-num = <6>; interrupts = <434 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; max-bit-width = <32>; prescaler = <0>; }; @@ -1024,6 +1080,7 @@ cc-num = <6>; interrupts = <435 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; max-bit-width = <32>; prescaler = <0>; }; @@ -1034,6 +1091,7 @@ status = "disabled"; interrupts = <436 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; #pwm-cells = <3>; }; @@ -1043,6 +1101,7 @@ status = "disabled"; interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; easydma-maxcnt-bits = <15>; #address-cells = <1>; #size-cells = <0>; @@ -1058,6 +1117,7 @@ easydma-maxcnt-bits = <15>; interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; max-frequency = ; #address-cells = <1>; #size-cells = <0>; @@ -1075,6 +1135,7 @@ status = "disabled"; interrupts = <437 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; @@ -1086,6 +1147,7 @@ status = "disabled"; interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; easydma-maxcnt-bits = <15>; #address-cells = <1>; #size-cells = <0>; @@ -1101,6 +1163,7 @@ easydma-maxcnt-bits = <15>; interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; max-frequency = ; #address-cells = <1>; #size-cells = <0>; @@ -1118,6 +1181,7 @@ status = "disabled"; interrupts = <438 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; @@ -1127,6 +1191,7 @@ compatible = "nordic,nrf-dppic-global"; reg = <0x9c1000 0x1000>; status = "disabled"; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; }; timer134: timer@9c2000 { @@ -1136,6 +1201,7 @@ cc-num = <6>; interrupts = <450 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; max-bit-width = <32>; prescaler = <0>; }; @@ -1147,6 +1213,7 @@ cc-num = <6>; interrupts = <451 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; max-bit-width = <32>; prescaler = <0>; }; @@ -1158,6 +1225,7 @@ interrupts = <452 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; #pwm-cells = <3>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; }; i2c134: i2c@9c5000 { @@ -1166,6 +1234,7 @@ status = "disabled"; interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; easydma-maxcnt-bits = <15>; #address-cells = <1>; #size-cells = <0>; @@ -1181,6 +1250,7 @@ easydma-maxcnt-bits = <15>; interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; max-frequency = ; #address-cells = <1>; #size-cells = <0>; @@ -1198,6 +1268,7 @@ status = "disabled"; interrupts = <453 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; @@ -1209,6 +1280,7 @@ status = "disabled"; interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; easydma-maxcnt-bits = <15>; #address-cells = <1>; #size-cells = <0>; @@ -1224,6 +1296,7 @@ easydma-maxcnt-bits = <15>; interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; max-frequency = ; #address-cells = <1>; #size-cells = <0>; @@ -1241,6 +1314,7 @@ status = "disabled"; interrupts = <454 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; @@ -1250,6 +1324,7 @@ compatible = "nordic,nrf-dppic-global"; reg = <0x9d1000 0x1000>; status = "disabled"; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; }; timer136: timer@9d2000 { @@ -1259,6 +1334,7 @@ cc-num = <6>; interrupts = <466 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; max-bit-width = <32>; prescaler = <0>; }; @@ -1270,6 +1346,7 @@ cc-num = <6>; interrupts = <467 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; max-bit-width = <32>; prescaler = <0>; }; @@ -1281,6 +1358,7 @@ interrupts = <468 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; #pwm-cells = <3>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; }; i2c136: i2c@9d5000 { @@ -1289,6 +1367,7 @@ status = "disabled"; interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; easydma-maxcnt-bits = <15>; #address-cells = <1>; #size-cells = <0>; @@ -1304,6 +1383,7 @@ easydma-maxcnt-bits = <15>; interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; max-frequency = ; #address-cells = <1>; #size-cells = <0>; @@ -1321,6 +1401,7 @@ status = "disabled"; interrupts = <469 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; @@ -1332,6 +1413,7 @@ status = "disabled"; interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; easydma-maxcnt-bits = <15>; #address-cells = <1>; #size-cells = <0>; @@ -1347,6 +1429,7 @@ easydma-maxcnt-bits = <15>; interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; max-frequency = ; #address-cells = <1>; #size-cells = <0>; @@ -1364,6 +1447,7 @@ status = "disabled"; interrupts = <470 NRF_DEFAULT_IRQ_PRIORITY>; clocks = <&fll16m>; + power-domains = <&gpd NRF_GPD_SLOW_ACTIVE>; nordic,clockpin-enable = ; endtx-stoptx-supported; frame-timeout-supported; From 87a42a89cb60a0f725b6ef0e0d4e84dff5f461ba Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 10 Oct 2024 14:19:26 +0200 Subject: [PATCH 2031/4482] soc: nordic: nrf54h: add SoC level API to request/release GPD Add a new soc-level API that allows to manually request/release global power domains. Signed-off-by: Gerard Marull-Paretas --- soc/nordic/nrf54h/CMakeLists.txt | 2 + soc/nordic/nrf54h/Kconfig | 2 + soc/nordic/nrf54h/gpd/CMakeLists.txt | 5 + soc/nordic/nrf54h/gpd/Kconfig | 12 ++ soc/nordic/nrf54h/gpd/gpd.c | 276 ++++++++++++++++++++++++ soc/nordic/nrf54h/gpd/include/nrf/gpd.h | 33 +++ 6 files changed, 330 insertions(+) create mode 100644 soc/nordic/nrf54h/gpd/CMakeLists.txt create mode 100644 soc/nordic/nrf54h/gpd/Kconfig create mode 100644 soc/nordic/nrf54h/gpd/gpd.c create mode 100644 soc/nordic/nrf54h/gpd/include/nrf/gpd.h diff --git a/soc/nordic/nrf54h/CMakeLists.txt b/soc/nordic/nrf54h/CMakeLists.txt index 0496841ffe791..7edc4d43ea128 100644 --- a/soc/nordic/nrf54h/CMakeLists.txt +++ b/soc/nordic/nrf54h/CMakeLists.txt @@ -15,3 +15,5 @@ zephyr_include_directories(.) # Ensure that image size aligns with 16 bytes so that MRAMC finalizes all writes # for the image correctly zephyr_linker_sources(SECTIONS SORT_KEY zzz_place_align_at_end align.ld) + +add_subdirectory(gpd) diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index 9132ca8458b82..1b667e259853c 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -75,3 +75,5 @@ config SOC_NRF54H20_CPUFLPR config SOC_NRF54H20_ENGB_CPUFLPR depends on RISCV_CORE_NORDIC_VPR + +rsource "gpd/Kconfig" diff --git a/soc/nordic/nrf54h/gpd/CMakeLists.txt b/soc/nordic/nrf54h/gpd/CMakeLists.txt new file mode 100644 index 0000000000000..7d029d2c8fcd3 --- /dev/null +++ b/soc/nordic/nrf54h/gpd/CMakeLists.txt @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library_sources_ifdef(CONFIG_SOC_NRF54H20_GPD gpd.c) +zephyr_include_directories(include) diff --git a/soc/nordic/nrf54h/gpd/Kconfig b/soc/nordic/nrf54h/gpd/Kconfig new file mode 100644 index 0000000000000..b9bd568cda630 --- /dev/null +++ b/soc/nordic/nrf54h/gpd/Kconfig @@ -0,0 +1,12 @@ +# Copyright (c) 2024 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +config SOC_NRF54H20_GPD + bool "Global Power Domain service" + imply NRFS + imply NRFS_GDPWR_SERVICE_ENABLED + select ONOFF + default y if SOC_NRF54H20_CPUAPP || SOC_NRF54H20_ENGB_CPUAPP || \ + SOC_NRF54H20_CPURAD || SOC_NRF54H20_ENGB_CPURAD + help + This option enables the Global Power Domain service. diff --git a/soc/nordic/nrf54h/gpd/gpd.c b/soc/nordic/nrf54h/gpd/gpd.c new file mode 100644 index 0000000000000..33cdb876e167f --- /dev/null +++ b/soc/nordic/nrf54h/gpd/gpd.c @@ -0,0 +1,276 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +LOG_MODULE_REGISTER(gpd, CONFIG_SOC_LOG_LEVEL); + +/* enforce alignment between DT<->nrfs */ +BUILD_ASSERT(GDPWR_POWER_DOMAIN_ACTIVE_FAST == NRF_GPD_FAST_ACTIVE1); +BUILD_ASSERT(GDPWR_POWER_DOMAIN_ACTIVE_SLOW == NRF_GPD_SLOW_ACTIVE); +BUILD_ASSERT(GDPWR_POWER_DOMAIN_MAIN_SLOW == NRF_GPD_SLOW_MAIN); + +struct gpd_onoff_manager { + struct onoff_manager mgr; + onoff_notify_fn notify; + uint8_t id; +}; + +static void start(struct onoff_manager *mgr, onoff_notify_fn notify); +static void stop(struct onoff_manager *mgr, onoff_notify_fn notify); + +#define GPD_READY_TIMEOUT_MS 1000 + +#define GPD_SERVICE_READY BIT(0) +#define GPD_SERVICE_ERROR BIT(1) +#define GPD_SERVICE_REQ_OK BIT(2) +#define GPD_SERVICE_REQ_ERR BIT(3) +static atomic_t gpd_service_status = ATOMIC_INIT(0); + +static struct gpd_onoff_manager fast_active1 = {.id = NRF_GPD_FAST_ACTIVE1}; +static struct gpd_onoff_manager slow_active = {.id = NRF_GPD_SLOW_ACTIVE}; +static struct gpd_onoff_manager slow_main = {.id = NRF_GPD_SLOW_MAIN}; + +static const struct onoff_transitions transitions = + ONOFF_TRANSITIONS_INITIALIZER(start, stop, NULL); + +static struct gpd_onoff_manager *get_mgr(uint8_t id) +{ + switch (id) { + case NRF_GPD_FAST_ACTIVE1: + return &fast_active1; + case NRF_GPD_SLOW_ACTIVE: + return &slow_active; + case NRF_GPD_SLOW_MAIN: + return &slow_main; + default: + return NULL; + } +} + +static int nrf_gpd_sync(struct gpd_onoff_manager *gpd_mgr) +{ + int64_t start; + nrfs_err_t err; + gdpwr_request_type_t request; + + K_SPINLOCK(&gpd_mgr->mgr.lock) { + if (gpd_mgr->mgr.refs == 0) { + request = GDPWR_POWER_REQUEST_CLEAR; + } else { + request = GDPWR_POWER_REQUEST_SET; + } + } + + atomic_clear_bit(&gpd_service_status, GPD_SERVICE_REQ_ERR); + atomic_clear_bit(&gpd_service_status, GPD_SERVICE_REQ_OK); + + err = nrfs_gdpwr_power_request(gpd_mgr->id, request, gpd_mgr); + if (err != NRFS_SUCCESS) { + return -EIO; + } + + start = k_uptime_get(); + while (k_uptime_get() - start < GPD_READY_TIMEOUT_MS) { + if (atomic_test_bit(&gpd_service_status, GPD_SERVICE_REQ_ERR)) { + return -EIO; + } + + if (atomic_test_bit(&gpd_service_status, GPD_SERVICE_REQ_OK)) { + return 0; + } + } + + LOG_ERR("nRFs GDPWR request timed out"); + + return -ETIMEDOUT; +} + +static void evt_handler(nrfs_gdpwr_evt_t const *p_evt, void *context) +{ + if (atomic_test_bit(&gpd_service_status, GPD_SERVICE_READY)) { + struct gpd_onoff_manager *gpd_mgr = context; + + switch (p_evt->type) { + case NRFS_GDPWR_REQ_APPLIED: + gpd_mgr->notify(&gpd_mgr->mgr, 0); + break; + default: + LOG_ERR("nRFs GDPWR request not applied"); + gpd_mgr->notify(&gpd_mgr->mgr, -EIO); + break; + } + } else { + switch (p_evt->type) { + case NRFS_GDPWR_REQ_APPLIED: + atomic_set_bit(&gpd_service_status, GPD_SERVICE_REQ_OK); + break; + default: + LOG_ERR("nRFs GDPWR request not applied"); + atomic_set_bit(&gpd_service_status, GPD_SERVICE_REQ_ERR); + break; + } + } +} + +static void start(struct onoff_manager *mgr, onoff_notify_fn notify) +{ + struct gpd_onoff_manager *gpd_mgr = CONTAINER_OF(mgr, struct gpd_onoff_manager, mgr); + + gpd_mgr->notify = notify; + + if (!atomic_test_bit(&gpd_service_status, GPD_SERVICE_READY)) { + notify(mgr, 0); + } else { + nrfs_err_t err; + + err = nrfs_gdpwr_power_request(gpd_mgr->id, GDPWR_POWER_REQUEST_SET, gpd_mgr); + if (err != NRFS_SUCCESS) { + LOG_ERR("nRFs GDPWR request failed (%d)", err); + notify(mgr, -EIO); + } + } +} + +static void stop(struct onoff_manager *mgr, onoff_notify_fn notify) +{ + struct gpd_onoff_manager *gpd_mgr = CONTAINER_OF(mgr, struct gpd_onoff_manager, mgr); + + gpd_mgr->notify = notify; + + if (!atomic_test_bit(&gpd_service_status, GPD_SERVICE_READY)) { + notify(mgr, 0); + } else { + nrfs_err_t err; + + err = nrfs_gdpwr_power_request(gpd_mgr->id, GDPWR_POWER_REQUEST_CLEAR, gpd_mgr); + if (err != NRFS_SUCCESS) { + LOG_ERR("nRFs GDPWR request failed (%d)", err); + notify(mgr, -EIO); + } + } +} + +int nrf_gpd_request(uint8_t id) +{ + int ret; + struct onoff_client client; + struct gpd_onoff_manager *gpd_mgr; + + gpd_mgr = get_mgr(id); + if (gpd_mgr == NULL) { + return -EINVAL; + } + + if (atomic_test_bit(&gpd_service_status, GPD_SERVICE_ERROR)) { + LOG_ERR("GPD service did not initialize properly"); + return -EIO; + } + + sys_notify_init_spinwait(&client.notify); + + onoff_request(&gpd_mgr->mgr, &client); + + while (sys_notify_fetch_result(&client.notify, &ret) == -EAGAIN) { + } + + return ret; +} + +int nrf_gpd_release(uint8_t id) +{ + struct gpd_onoff_manager *gpd_mgr; + + gpd_mgr = get_mgr(id); + if (gpd_mgr == NULL) { + return -EINVAL; + } + + if (atomic_test_bit(&gpd_service_status, GPD_SERVICE_ERROR)) { + LOG_ERR("GPD service did not initialize properly"); + return -EIO; + } + + return onoff_release(&gpd_mgr->mgr); +} + +static int nrf_gpd_pre_init(void) +{ + int ret; + + ret = onoff_manager_init(&fast_active1.mgr, &transitions); + if (ret < 0) { + return ret; + } + + ret = onoff_manager_init(&slow_active.mgr, &transitions); + if (ret < 0) { + return ret; + } + + ret = onoff_manager_init(&slow_main.mgr, &transitions); + if (ret < 0) { + return ret; + } + + return 0; +} + +static int nrf_gpd_post_init(void) +{ + nrfs_err_t err; + int ret; + + err = nrfs_backend_wait_for_connection(K_FOREVER); + if (err != NRFS_SUCCESS) { + ret = -EIO; + goto err; + } + + err = nrfs_gdpwr_init(evt_handler); + if (err != NRFS_SUCCESS) { + ret = -EIO; + goto err; + } + + /* submit GD requests now to align collected statuses */ + ret = nrf_gpd_sync(&fast_active1); + if (ret < 0) { + goto err; + } + + ret = nrf_gpd_sync(&slow_active); + if (ret < 0) { + goto err; + } + + ret = nrf_gpd_sync(&slow_main); + if (ret < 0) { + goto err; + } + + atomic_set_bit(&gpd_service_status, GPD_SERVICE_READY); + + return 0; + +err: + atomic_set_bit(&gpd_service_status, GPD_SERVICE_ERROR); + + return ret; +} + +SYS_INIT(nrf_gpd_pre_init, PRE_KERNEL_1, 0); +SYS_INIT(nrf_gpd_post_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY); diff --git a/soc/nordic/nrf54h/gpd/include/nrf/gpd.h b/soc/nordic/nrf54h/gpd/include/nrf/gpd.h new file mode 100644 index 0000000000000..0504f94e8584b --- /dev/null +++ b/soc/nordic/nrf54h/gpd/include/nrf/gpd.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_SOC_NORDIC_NRF54H_GPD_INCLUDE_NRF_GPD_H_ +#define ZEPHYR_SOC_NORDIC_NRF54H_GPD_INCLUDE_NRF_GPD_H_ + +#include + +#include + +/** + * @brief Request a global power domain. + * + * @param id Domain ID. + * + * @retval 0 If the request was successful. + * @retval -errno If the request was not successful. + */ +int nrf_gpd_request(uint8_t id); + +/** + * @brief Release a global power domain. + * + * @param id Domain ID. + * + * @retval 0 If the request was successful. + * @retval -errno If the request was not successful. + */ +int nrf_gpd_release(uint8_t id); + +#endif /* ZEPHYR_SOC_NORDIC_NRF54H_GPD_INCLUDE_NRF_GPD_H_ */ From 9925ec99fddfe26bfd34a8cd4fce1642964573cb Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 10 Oct 2024 15:57:52 +0200 Subject: [PATCH 2032/4482] drivers: pinctrl: nrf: add flag to signal the FAST_ACTIVE1 peripherals This patch introduces a new flag to indicate if a peripheral belongs to FAST_ACTIVE1 domain. This way, pinctrl knows when to request the SLOW_ACTIVE domain (where CTRLSEL multiplexer resides). Signed-off-by: Gerard Marull-Paretas --- drivers/pinctrl/pinctrl_nrf.c | 32 +++++++++++++++++++ .../zephyr/dt-bindings/pinctrl/nrf-pinctrl.h | 12 +++++-- soc/nordic/common/pinctrl_soc.h | 22 ++++++++++++- 3 files changed, 62 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index 7c6d83020bf8a..1e80de8fe67c3 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -7,6 +7,9 @@ #include #include +#ifdef CONFIG_SOC_NRF54H20_GPD +#include +#endif BUILD_ASSERT(((NRF_PULL_NONE == NRF_GPIO_PIN_NOPULL) && (NRF_PULL_DOWN == NRF_GPIO_PIN_PULLDOWN) && @@ -352,6 +355,21 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, if (psel != PSEL_DISCONNECTED) { uint32_t pin = psel; +#ifdef CONFIG_SOC_NRF54H20_GPD + if (NRF_GET_GPD_FAST_ACTIVE1(pins[i]) == 1U) { + int ret; + uint32_t d_pin = pin; + NRF_GPIO_Type *port = nrf_gpio_pin_port_decode(&d_pin); + + ret = nrf_gpd_request(NRF_GPD_SLOW_ACTIVE); + if (ret < 0) { + return ret; + } + + port->RETAINCLR = BIT(d_pin); + } +#endif /* CONFIG_SOC_NRF54H20_GPD */ + if (write != NO_WRITE) { nrf_gpio_pin_write(pin, write); } @@ -367,6 +385,20 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, #if NRF_GPIO_HAS_CLOCKPIN nrf_gpio_pin_clock_set(pin, NRF_GET_CLOCKPIN_ENABLE(pins[i])); #endif +#ifdef CONFIG_SOC_NRF54H20_GPD + if (NRF_GET_GPD_FAST_ACTIVE1(pins[i]) == 1U) { + int ret; + uint32_t d_pin = pin; + NRF_GPIO_Type *port = nrf_gpio_pin_port_decode(&d_pin); + + port->RETAINSET = BIT(d_pin); + + ret = nrf_gpd_release(NRF_GPD_SLOW_ACTIVE); + if (ret < 0) { + return ret; + } + } +#endif /* CONFIG_SOC_NRF54H20_GPD */ } } diff --git a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h index 7afa678381431..4611baef95c2b 100644 --- a/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h +++ b/include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h @@ -10,7 +10,9 @@ * The whole nRF pin configuration information is encoded in a 32-bit bitfield * organized as follows: * - * - 31..18: Pin function. + * - 31..24: Pin function. + * - 19-23: Reserved. + * - 18: Associated peripheral belongs to GD FAST ACTIVE1 (nRF54H only) * - 17: Clockpin enable. * - 16: Pin inversion mode. * - 15: Pin low power mode. @@ -25,9 +27,13 @@ */ /** Position of the function field. */ -#define NRF_FUN_POS 18U +#define NRF_FUN_POS 24U /** Mask for the function field. */ -#define NRF_FUN_MSK 0x3FFFU +#define NRF_FUN_MSK 0xFFU +/** Position of the GPD FAST ACTIVE1 */ +#define NRF_GPD_FAST_ACTIVE1_POS 18U +/** Mask for the GPD FAST ACTIVE1 */ +#define NRF_GPD_FAST_ACTIVE1_MSK 0x1U /** Position of the clockpin enable field. */ #define NRF_CLOCKPIN_ENABLE_POS 17U /** Mask for the clockpin enable field. */ diff --git a/soc/nordic/common/pinctrl_soc.h b/soc/nordic/common/pinctrl_soc.h index ea0f0196e2b1b..f1d3b6357f97d 100644 --- a/soc/nordic/common/pinctrl_soc.h +++ b/soc/nordic/common/pinctrl_soc.h @@ -14,6 +14,7 @@ #include #include +#include #include #ifdef __cplusplus @@ -55,6 +56,16 @@ typedef uint32_t pinctrl_soc_pin_t; (), NRF_GET_FUN(DT_PROP_BY_IDX(node_id, prop, idx))) \ 0)), (0)) +/** + * @brief Utility macro to get the GPD_FAST_ACTIVE1 flag + * + * @param p_node_id Parent node identifier. + */ +#define Z_GET_GPD_FAST_ACTIVE1(p_node_id) \ + COND_CODE_1(DT_NODE_HAS_PROP(p_node_id, power_domains), \ + ((DT_PHA(p_node_id, power_domains, id) == \ + NRF_GPD_FAST_ACTIVE1) << NRF_GPD_FAST_ACTIVE1_POS), (0)) + /** * @brief Utility macro to initialize each pin. * @@ -70,7 +81,8 @@ typedef uint32_t pinctrl_soc_pin_t; (DT_PROP(node_id, nordic_drive_mode) << NRF_DRIVE_POS) | \ ((NRF_LP_ENABLE * DT_PROP(node_id, low_power_enable)) << NRF_LP_POS) |\ (DT_PROP(node_id, nordic_invert) << NRF_INVERT_POS) | \ - Z_GET_CLOCKPIN_ENABLE(node_id, prop, idx, p_node_id) \ + Z_GET_CLOCKPIN_ENABLE(node_id, prop, idx, p_node_id) | \ + Z_GET_GPD_FAST_ACTIVE1(p_node_id) \ ), /** @@ -99,6 +111,14 @@ typedef uint32_t pinctrl_soc_pin_t; #define NRF_GET_CLOCKPIN_ENABLE(pincfg) \ (((pincfg) >> NRF_CLOCKPIN_ENABLE_POS) & NRF_CLOCKPIN_ENABLE_MSK) +/** + * @brief Utility macro to obtain GPD_FAST_ACTIVE1 flag + * + * @param pincfg Pin configuration bit field. + */ +#define NRF_GET_GPD_FAST_ACTIVE1(pincfg) \ + (((pincfg) >> NRF_GPD_FAST_ACTIVE1_POS) & NRF_GPD_FAST_ACTIVE1_MSK) + /** * @brief Utility macro to obtain pin inversion flag. * From 0b18f31246cd5d0bcdd10a3ad6e3bd108bf3f95d Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 30 Oct 2024 11:20:41 +0100 Subject: [PATCH 2033/4482] modules: hal_nordic: bump regtool to 8.0.0 It is required for some pinctrl changes. Signed-off-by: Gerard Marull-Paretas --- modules/hal_nordic/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hal_nordic/CMakeLists.txt b/modules/hal_nordic/CMakeLists.txt index 9be36d4998d41..5209efdced978 100644 --- a/modules/hal_nordic/CMakeLists.txt +++ b/modules/hal_nordic/CMakeLists.txt @@ -12,7 +12,7 @@ if(CONFIG_NRF_REGTOOL_GENERATE_UICR) list(APPEND nrf_regtool_components GENERATE:UICR) endif() if(DEFINED nrf_regtool_components) - find_package(nrf-regtool 7.0.0 REQUIRED + find_package(nrf-regtool 8.0.0 COMPONENTS ${nrf_regtool_components} PATHS ${CMAKE_CURRENT_LIST_DIR}/nrf-regtool NO_CMAKE_PATH From 56c5b1e2da11318844f6bb19414efac32e77613d Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 10 Oct 2024 15:58:41 +0200 Subject: [PATCH 2034/4482] drivers: gpio: nrfx: add support for ports with pad on FAST_ACTIVE1 This patch allows to _safely_ configure GPIO ports that have their pad on FAST_ACTIVE1 domain. Signed-off-by: Gerard Marull-Paretas --- drivers/gpio/gpio_nrfx.c | 116 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 108 insertions(+), 8 deletions(-) diff --git a/drivers/gpio/gpio_nrfx.c b/drivers/gpio/gpio_nrfx.c index 151cf1a830c5c..d9eb9129937bf 100644 --- a/drivers/gpio/gpio_nrfx.c +++ b/drivers/gpio/gpio_nrfx.c @@ -14,6 +14,10 @@ #include +#ifdef CONFIG_SOC_NRF54H20_GPD +#include +#endif + struct gpio_nrfx_data { /* gpio_driver_data needs to be first */ struct gpio_driver_data common; @@ -27,6 +31,9 @@ struct gpio_nrfx_cfg { uint32_t edge_sense; uint8_t port_num; nrfx_gpiote_t gpiote; +#ifdef CONFIG_SOC_NRF54H20_GPD + uint8_t pad_pd; +#endif }; static inline struct gpio_nrfx_data *get_port_data(const struct device *port) @@ -55,9 +62,59 @@ static nrf_gpio_pin_pull_t get_pull(gpio_flags_t flags) return NRF_GPIO_PIN_NOPULL; } +static int gpio_nrfx_gpd_retain_set(const struct device *port, uint32_t mask, gpio_flags_t flags) +{ +#ifdef CONFIG_SOC_NRF54H20_GPD + const struct gpio_nrfx_cfg *cfg = get_port_cfg(port); + + if (cfg->pad_pd == NRF_GPD_FAST_ACTIVE1) { + int ret; + + if (flags & GPIO_OUTPUT) { + cfg->port->RETAINSET = mask; + } + + ret = nrf_gpd_release(NRF_GPD_FAST_ACTIVE1); + if (ret < 0) { + return ret; + } + } +#else + ARG_UNUSED(port); + ARG_UNUSED(mask); + ARG_UNUSED(flags); +#endif + + return 0; +} + +static int gpio_nrfx_gpd_retain_clear(const struct device *port, uint32_t mask) +{ +#ifdef CONFIG_SOC_NRF54H20_GPD + const struct gpio_nrfx_cfg *cfg = get_port_cfg(port); + + if (cfg->pad_pd == NRF_GPD_FAST_ACTIVE1) { + int ret; + + ret = nrf_gpd_request(NRF_GPD_FAST_ACTIVE1); + if (ret < 0) { + return ret; + } + + cfg->port->RETAINCLR = mask; + } +#else + ARG_UNUSED(port); + ARG_UNUSED(mask); +#endif + + return 0; +} + static int gpio_nrfx_pin_configure(const struct device *port, gpio_pin_t pin, gpio_flags_t flags) { + int ret = 0; nrfx_err_t err = NRFX_SUCCESS; uint8_t ch; bool free_ch = false; @@ -95,6 +152,11 @@ static int gpio_nrfx_pin_configure(const struct device *port, gpio_pin_t pin, return -EINVAL; } + ret = gpio_nrfx_gpd_retain_clear(port, BIT(pin)); + if (ret < 0) { + return ret; + } + if (flags & GPIO_OUTPUT_INIT_HIGH) { nrf_gpio_port_out_set(cfg->port, BIT(pin)); } else if (flags & GPIO_OUTPUT_INIT_LOW) { @@ -110,7 +172,8 @@ static int gpio_nrfx_pin_configure(const struct device *port, gpio_pin_t pin, : NRF_GPIO_PIN_INPUT_DISCONNECT; nrf_gpio_reconfigure(abs_pin, &dir, &input, &pull, &drive, NULL); - return 0; + + goto end; } /* Get the GPIOTE channel associated with this pin, if any. It needs @@ -137,7 +200,8 @@ static int gpio_nrfx_pin_configure(const struct device *port, gpio_pin_t pin, err = nrfx_gpiote_input_configure(&cfg->gpiote, abs_pin, &input_pin_config); if (err != NRFX_SUCCESS) { - return -EINVAL; + ret = -EINVAL; + goto end; } } @@ -162,7 +226,8 @@ static int gpio_nrfx_pin_configure(const struct device *port, gpio_pin_t pin, } if (err != NRFX_SUCCESS) { - return -EINVAL; + ret = -EINVAL; + goto end; } } @@ -171,7 +236,9 @@ static int gpio_nrfx_pin_configure(const struct device *port, gpio_pin_t pin, __ASSERT_NO_MSG(err == NRFX_SUCCESS); } - return 0; +end: + (void)gpio_nrfx_gpd_retain_set(port, BIT(pin), flags); + return ret; } static int gpio_nrfx_port_get_raw(const struct device *port, @@ -189,34 +256,52 @@ static int gpio_nrfx_port_set_masked_raw(const struct device *port, gpio_port_value_t value) { NRF_GPIO_Type *reg = get_port_cfg(port)->port; + int ret; const uint32_t set_mask = value & mask; const uint32_t clear_mask = (~set_mask) & mask; + ret = gpio_nrfx_gpd_retain_clear(port, mask); + if (ret < 0) { + return ret; + } + nrf_gpio_port_out_set(reg, set_mask); nrf_gpio_port_out_clear(reg, clear_mask); - return 0; + return gpio_nrfx_gpd_retain_set(port, mask, GPIO_OUTPUT); } static int gpio_nrfx_port_set_bits_raw(const struct device *port, gpio_port_pins_t mask) { NRF_GPIO_Type *reg = get_port_cfg(port)->port; + int ret; + + ret = gpio_nrfx_gpd_retain_clear(port, mask); + if (ret < 0) { + return ret; + } nrf_gpio_port_out_set(reg, mask); - return 0; + return gpio_nrfx_gpd_retain_set(port, mask, GPIO_OUTPUT); } static int gpio_nrfx_port_clear_bits_raw(const struct device *port, gpio_port_pins_t mask) { NRF_GPIO_Type *reg = get_port_cfg(port)->port; + int ret; + + ret = gpio_nrfx_gpd_retain_clear(port, mask); + if (ret < 0) { + return ret; + } nrf_gpio_port_out_clear(reg, mask); - return 0; + return gpio_nrfx_gpd_retain_set(port, mask, GPIO_OUTPUT); } static int gpio_nrfx_port_toggle_bits(const struct device *port, @@ -226,11 +311,17 @@ static int gpio_nrfx_port_toggle_bits(const struct device *port, const uint32_t value = nrf_gpio_port_out_read(reg) ^ mask; const uint32_t set_mask = value & mask; const uint32_t clear_mask = (~value) & mask; + int ret; + + ret = gpio_nrfx_gpd_retain_clear(port, mask); + if (ret < 0) { + return ret; + } nrf_gpio_port_out_set(reg, set_mask); nrf_gpio_port_out_clear(reg, clear_mask); - return 0; + return gpio_nrfx_gpd_retain_set(port, mask, GPIO_OUTPUT); } #ifdef CONFIG_GPIO_NRFX_INTERRUPT @@ -450,6 +541,14 @@ static const struct gpio_driver_api gpio_nrfx_drv_api_funcs = { "Please enable GPIOTE instance for used GPIO port!")), \ ()) +#ifdef CONFIG_SOC_NRF54H20_GPD +#define PAD_PD(inst) \ + .pad_pd = DT_INST_PHA_BY_NAME_OR(inst, power_domains, pad, id, \ + NRF_GPD_SLOW_MAIN), +#else +#define PAD_PD(inst) +#endif + #define GPIO_NRF_DEVICE(id) \ GPIOTE_CHECK(id); \ static const struct gpio_nrfx_cfg gpio_nrfx_p##id##_cfg = { \ @@ -461,6 +560,7 @@ static const struct gpio_driver_api gpio_nrfx_drv_api_funcs = { .port_num = DT_INST_PROP(id, port), \ .edge_sense = DT_INST_PROP_OR(id, sense_edge_mask, 0), \ .gpiote = GPIOTE_INSTANCE(id), \ + PAD_PD(id) \ }; \ \ static struct gpio_nrfx_data gpio_nrfx_p##id##_data; \ From 5e8905bb9483b33b4412e7c0a30e0e4dfa7f80b3 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 30 Oct 2024 11:42:28 +0100 Subject: [PATCH 2035/4482] scripts: checkpatch: add NRF_GPIO_Type to typedefs file So that we do not get false warnings about consistent spacing around '*'. Signed-off-by: Gerard Marull-Paretas --- scripts/checkpatch/typedefsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/checkpatch/typedefsfile b/scripts/checkpatch/typedefsfile index 62febe44e1bd8..0fc22b9779b43 100644 --- a/scripts/checkpatch/typedefsfile +++ b/scripts/checkpatch/typedefsfile @@ -8,3 +8,4 @@ io_rw_32 \b[a-zA-Z_][a-zA-Z0-9_]*TypeDef Pwm FILE +NRF_GPIO_Type From 77fc18327aa965625c60c958b5303cb14e456c00 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 29 Oct 2024 10:25:25 +0100 Subject: [PATCH 2036/4482] soc: nordic: nrf54h: gpd: add API to set/clear pin retention This API needs to be called by FAST peripherals before/after disabling/enabling them. Signed-off-by: Gerard Marull-Paretas --- soc/nordic/nrf54h/gpd/gpd.c | 29 +++++++++++++++++++++++++ soc/nordic/nrf54h/gpd/include/nrf/gpd.h | 12 ++++++++++ 2 files changed, 41 insertions(+) diff --git a/soc/nordic/nrf54h/gpd/gpd.c b/soc/nordic/nrf54h/gpd/gpd.c index 33cdb876e167f..ea439a5446034 100644 --- a/soc/nordic/nrf54h/gpd/gpd.c +++ b/soc/nordic/nrf54h/gpd/gpd.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -207,6 +208,34 @@ int nrf_gpd_release(uint8_t id) return onoff_release(&gpd_mgr->mgr); } +int nrf_gpd_retain_pins_set(const struct pinctrl_dev_config *pcfg, bool retain) +{ + const struct pinctrl_state *state; + int ret; + + ret = pinctrl_lookup_state(pcfg, PINCTRL_STATE_DEFAULT, &state); + if (ret < 0) { + return ret; + } + + for (uint8_t i = 0U; i < state->pin_cnt; i++) { + uint32_t pin = NRF_GET_PIN(state->pins[i]); + NRF_GPIO_Type *reg = nrf_gpio_pin_port_decode(&pin); + + if (pin == NRF_PIN_DISCONNECTED) { + continue; + } + + if (retain) { + reg->RETAINSET = BIT(pin); + } else { + reg->RETAINCLR = BIT(pin); + } + } + + return 0; +} + static int nrf_gpd_pre_init(void) { int ret; diff --git a/soc/nordic/nrf54h/gpd/include/nrf/gpd.h b/soc/nordic/nrf54h/gpd/include/nrf/gpd.h index 0504f94e8584b..b8aab94accbd0 100644 --- a/soc/nordic/nrf54h/gpd/include/nrf/gpd.h +++ b/soc/nordic/nrf54h/gpd/include/nrf/gpd.h @@ -9,6 +9,7 @@ #include #include +#include /** * @brief Request a global power domain. @@ -30,4 +31,15 @@ int nrf_gpd_request(uint8_t id); */ int nrf_gpd_release(uint8_t id); +/** + * @brief Retain set/clear a set of pins. + * + * @param pcfg Device pin configuration. + * @param retain Retain or not. + * + * @retval 0 If the request was successful. + * @retval -errno If the request was not successful. + */ +int nrf_gpd_retain_pins_set(const struct pinctrl_dev_config *pcfg, bool retain); + #endif /* ZEPHYR_SOC_NORDIC_NRF54H_GPD_INCLUDE_NRF_GPD_H_ */ From b6d45423c60b950d02c389262745c2fdcd27b4f0 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 29 Oct 2024 10:26:39 +0100 Subject: [PATCH 2037/4482] drivers: serial: nrfx_uarte: set/clear pins retention When GPD is managed by pinctrl, pins retention needs to be controlled by the driver to avoid glitches. Signed-off-by: Gerard Marull-Paretas --- drivers/serial/uart_nrfx_uarte.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 5c19485946c4e..e1af63b7993e7 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -23,6 +23,11 @@ #include #include #include + +#ifdef CONFIG_SOC_NRF54H20_GPD +#include +#endif + LOG_MODULE_REGISTER(uart_nrfx_uarte, CONFIG_UART_LOG_LEVEL); #if !defined(CONFIG_ARCH_POSIX) @@ -2098,6 +2103,9 @@ static void uarte_pm_resume(const struct device *dev) if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || !LOW_POWER_ENABLED(cfg)) { uarte_periph_enable(dev); +#ifdef CONFIG_SOC_NRF54H20_GPD + nrf_gpd_retain_pins_set(cfg->pcfg, false); +#endif } } @@ -2160,6 +2168,10 @@ static void uarte_pm_suspend(const struct device *dev) wait_for_tx_stopped(dev); } +#ifdef CONFIG_SOC_NRF54H20_GPD + nrf_gpd_retain_pins_set(cfg->pcfg, true); +#endif + nrf_uarte_disable(uarte); (void)pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_SLEEP); From 969326bfff2d90dfc1481fecb636d39a66a9581e Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 29 Oct 2024 15:17:27 +0100 Subject: [PATCH 2038/4482] soc: nordic: nrf54h: disable PM_DEVICE_POWER_DOMAIN It is enabled by default if we enable device PM, but we do not want this, otherwise we get linker errors (PM subsys, fun guaranteed!). Signed-off-by: Gerard Marull-Paretas --- soc/nordic/nrf54h/Kconfig.defconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/soc/nordic/nrf54h/Kconfig.defconfig b/soc/nordic/nrf54h/Kconfig.defconfig index b09b24e5e7040..65023fc18ca91 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig +++ b/soc/nordic/nrf54h/Kconfig.defconfig @@ -39,4 +39,7 @@ config SPI_DW_HSSI config SPI_DW_ACCESS_WORD_ONLY default y if SPI_DW +config PM_DEVICE_POWER_DOMAIN + default n if PM_DEVICE + endif # SOC_SERIES_NRF54HX From c6140b6f082e75947fe030ed80c8043be0d7bd70 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Wed, 30 Oct 2024 14:56:50 +0000 Subject: [PATCH 2039/4482] doc: release: 4.0: Add release note on fixing #80383 Release note update. Signed-off-by: Dominik Ermel --- doc/releases/release-notes-4.0.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 1b90f284de358..16baae3bb590b 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -245,6 +245,9 @@ Drivers and Sensors * Flash + * Fixed SPI NOR driver issue where wp, hold and reset pins were incorrectly initialized from + device tee when SFDP at run-time has been enabled (:github:`80383`) + * GNSS * GPIO From 7b4d8cf9ce3dce7bea97baa3c1592f9da7d24a51 Mon Sep 17 00:00:00 2001 From: Hake Huang Date: Tue, 29 Oct 2024 14:24:21 +0000 Subject: [PATCH 2040/4482] samples: sesnor: thermo: add harness_config for testing add harness_config for console for testing Signed-off-by: Hake Huang --- samples/sensor/thermometer/sample.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/samples/sensor/thermometer/sample.yaml b/samples/sensor/thermometer/sample.yaml index 4cce8e3973ee9..7d6b3479eb63a 100644 --- a/samples/sensor/thermometer/sample.yaml +++ b/samples/sensor/thermometer/sample.yaml @@ -3,7 +3,6 @@ sample: tests: sample.sensor.thermometer: tags: sensors - harness: sensor filter: dt_alias_exists("ambient-temp0") integration_platforms: - nrf52840dk/nrf52840 # mcp9700a @@ -11,3 +10,11 @@ tests: - robokit1 # ntc_thermistor - adi_eval_adin1110ebz # adt7420 - frdm_mcxn947/mcxn947/cpu0 # p3t1755 + harness: console + harness_config: + fixture: sensor_ambient_temp + type: multi_line + regex: + - "Thermometer Example (.*)" + - "Temperature device is 0x[0-9|a-z]+, name is [a-z|0-9]+@[a-z|0-9]+" + - "Temperature is [0-9|.]+°C" From 96877736e4a4f23ea1fd517fee49a1317f7454b3 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Wed, 30 Oct 2024 12:59:16 -0500 Subject: [PATCH 2041/4482] drivers: ethernet: ksz8081: Fix reset times 500 ms reset time is only for software reset and comes from IEEE spec. Datasheet mentions for hardware reset the assertion of the signal should only need to be 500 us, and 100 us after deassert to wait to access programming interface. Also remove an unused macro. Signed-off-by: Declan Snyder --- drivers/ethernet/phy/phy_microchip_ksz8081.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/ethernet/phy/phy_microchip_ksz8081.c b/drivers/ethernet/phy/phy_microchip_ksz8081.c index 98c9da37d86c1..a3d753d7b7d80 100644 --- a/drivers/ethernet/phy/phy_microchip_ksz8081.c +++ b/drivers/ethernet/phy/phy_microchip_ksz8081.c @@ -30,8 +30,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #define PHY_MC_KSZ8081_CTRL2_REG 0x1F #define PHY_MC_KSZ8081_CTRL2_REF_CLK_SEL BIT(7) -#define PHY_MC_KSZ8081_RESET_HOLD_TIME - enum ksz8081_interface { KSZ8081_MII, KSZ8081_RMII, @@ -289,11 +287,15 @@ static int phy_mc_ksz8081_reset(const struct device *dev) goto done; } - /* Wait for 500 ms as specified by datasheet */ - k_busy_wait(USEC_PER_MSEC * 500); + /* Wait for at least 500 us as specified by datasheet */ + k_busy_wait(1000); /* Reset over */ ret = gpio_pin_set_dt(&config->reset_gpio, 1); + + /* After deasserting reset, must wait at least 100 us to use programming interface */ + k_busy_wait(200); + goto done; skip_reset_gpio: #endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(reset_gpios) */ @@ -301,8 +303,11 @@ static int phy_mc_ksz8081_reset(const struct device *dev) if (ret) { goto done; } - /* Wait for 500 ms as specified by datasheet */ - k_busy_wait(USEC_PER_MSEC * 500); + + /* According to IEEE 802.3, Section 2, Subsection 22.2.4.1.1, + * a PHY reset may take up to 0.5 s. + */ + k_busy_wait(500 * USEC_PER_MSEC); done: /* Unlock mutex */ From 495a374a0d1eefdde3c57623fec3cbd7be844ecd Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Wed, 30 Oct 2024 13:00:56 -0500 Subject: [PATCH 2042/4482] drivers: ethernet: ksz8081: RMII override RNB part I for the life of me do not know what is going on here with the RNB chip but it seems this override must be set in order for the chip to work, regardless of strap-in configuration, and if not set explicitly, the value after a reset for these two bits will be seemingly random and inconsistent. And it was working before by luck before removing a second redundant reset in a recent commit, because apparently the register was getting the opposite of the reset value according to the datasheet which makes it work. The result of these bits after reset seem to vary depending on host mcu, board, debugger, number of times reset, type of reset, and with a pinch of random chance after keeping all variables seemingly the same, so let's just set it to the value that works explicitly, even if it doesn't make sense. The bit here doesn't have clear documentation but it seems it's for using RMII regardless of the strap in option, which is what we want to do anyways if we know the interface type from DT, so I think it's fine, considering it is making this driver work again. Signed-off-by: Declan Snyder --- drivers/ethernet/phy/phy_microchip_ksz8081.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/ethernet/phy/phy_microchip_ksz8081.c b/drivers/ethernet/phy/phy_microchip_ksz8081.c index a3d753d7b7d80..61a97ca03e7cd 100644 --- a/drivers/ethernet/phy/phy_microchip_ksz8081.c +++ b/drivers/ethernet/phy/phy_microchip_ksz8081.c @@ -26,6 +26,8 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #define PHY_MC_KSZ8081_OMSO_REG 0x16 #define PHY_MC_KSZ8081_OMSO_FACTORY_MODE_MASK BIT(15) #define PHY_MC_KSZ8081_OMSO_NAND_TREE_MASK BIT(5) +#define PHY_MC_KSZ8081_OMSO_RMII_OVERRIDE_MASK BIT(1) +#define PHY_MC_KSZ8081_OMSO_MII_OVERRIDE_MASK BIT(0) #define PHY_MC_KSZ8081_CTRL2_REG 0x1F #define PHY_MC_KSZ8081_CTRL2_REF_CLK_SEL BIT(7) @@ -235,6 +237,10 @@ static int phy_mc_ksz8081_static_cfg(const struct device *dev) omso &= ~PHY_MC_KSZ8081_OMSO_FACTORY_MODE_MASK & ~PHY_MC_KSZ8081_OMSO_NAND_TREE_MASK; + if (config->phy_iface == KSZ8081_RMII) { + omso &= ~PHY_MC_KSZ8081_OMSO_MII_OVERRIDE_MASK; + omso |= PHY_MC_KSZ8081_OMSO_RMII_OVERRIDE_MASK; + } ret = phy_mc_ksz8081_write(dev, PHY_MC_KSZ8081_OMSO_REG, (uint32_t)omso); if (ret) { From a5555ab0778bbc2fcaf4c8a2ce659b1f1d9c0c26 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Wed, 30 Oct 2024 23:49:54 +0800 Subject: [PATCH 2043/4482] testsuite: coverage: fix typo in the CMakeLists.txt `zephyr_BASE` should have been `ZEPHYR_BASE`, fix it. Signed-off-by: Yong Cong Sin --- subsys/testsuite/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/testsuite/CMakeLists.txt b/subsys/testsuite/CMakeLists.txt index b2b691fc8c911..4b452de32269a 100644 --- a/subsys/testsuite/CMakeLists.txt +++ b/subsys/testsuite/CMakeLists.txt @@ -6,6 +6,6 @@ if(CONFIG_TEST) zephyr_include_directories(${ZEPHYR_BASE}/subsys/testsuite/include) endif() add_subdirectory_ifdef(CONFIG_COVERAGE_GCOV coverage) -zephyr_include_directories_ifdef(CONFIG_COVERAGE_GCOV ${zephyr_BASE}/subsys/testsuite/coverage) +zephyr_include_directories_ifdef(CONFIG_COVERAGE_GCOV ${ZEPHYR_BASE}/subsys/testsuite/coverage) zephyr_library_sources_ifdef(CONFIG_TEST_BUSY_SIM busy_sim/busy_sim.c) From aaeaef0a1c65920bf78266a349f345fcea5e82b0 Mon Sep 17 00:00:00 2001 From: Lars-Ove Karlsson Date: Mon, 28 Oct 2024 10:35:30 +0100 Subject: [PATCH 2044/4482] drivers: flash: Removed a __packed attribute from struct jesd216_bfp The struct jesd216_bfp was declared as __packed but later in the code the address of a member was given to a non-packed pointer, potentially causing reading of wrong addresses, and causing warnings with the IAR ICCARM compiler. After studying the JEDEC documentation JESD216F.02, section 6.4.2 JEDEC Basic Flash Parameter Header: 2nd DWORD, the struct must be aligned to 4 so __packed is not necessary, just 4 byte alignment. Signed-off-by: Lars-Ove Karlsson --- drivers/flash/jesd216.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/flash/jesd216.h b/drivers/flash/jesd216.h index facd11a3054f5..4d45c564ae499 100644 --- a/drivers/flash/jesd216.h +++ b/drivers/flash/jesd216.h @@ -129,6 +129,8 @@ static inline uint32_t jesd216_sfdp_magic(const struct jesd216_sfdp_header *hp) * the standard. Rather than pre-define layouts to access to all * potential fields this header provides functions for specific fields * known to be important, such as density and erase command support. + * + * Must be aligned to a DWORD (32-bit) address according to JESD216F. */ struct jesd216_bfp { uint32_t dw1; @@ -141,7 +143,7 @@ struct jesd216_bfp { uint32_t dw8; uint32_t dw9; uint32_t dw10[]; -} __packed; +} __aligned(4); /* Provide a few word-specific flags and bitfield ranges for values * that an application or driver might expect to want to extract. From 7aa4032ac6f5096a0d4b32bbdc7e5798ac4d5d5d Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 31 Oct 2024 15:05:41 -0400 Subject: [PATCH 2045/4482] Revert "arch: arm: cortex_m: restore comment lost in translation" This reverts commit 7d7616214b90a26207e79a2e2fa3305e8a483db7. Signed-off-by: Anas Nashif --- arch/arm/core/cortex_m/swap.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/arch/arm/core/cortex_m/swap.c b/arch/arm/core/cortex_m/swap.c index 027fb47a01f06..b60f6acd675d3 100644 --- a/arch/arm/core/cortex_m/swap.c +++ b/arch/arm/core/cortex_m/swap.c @@ -96,15 +96,11 @@ uintptr_t z_arm_pendsv_c(uintptr_t exc_ret) /* restore mode */ IF_ENABLED(CONFIG_USERSPACE, ({ - CONTROL_Type ctrl = {.w = __get_CONTROL()}; - /* exit privileged state when returning to thread mode. */ - ctrl.b.nPRIV = 0; - /* __set_CONTROL inserts an ISB which is may not be necessary here - * (stack pointer may not be touched), but it's recommended to avoid - * executing pre-fetched instructions with the previous privilege. - */ - __set_CONTROL(ctrl.w | current->arch.mode); - })); + CONTROL_Type ctrl = {.w = __get_CONTROL()}; + /* exit privileged state when returing to thread mode. */ + ctrl.b.nPRIV = 0; + __set_CONTROL(ctrl.w | current->arch.mode); + })); return exc_ret; } From e646b7f3bb3828140bd7160570d0633bd186d156 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 31 Oct 2024 15:05:49 -0400 Subject: [PATCH 2046/4482] Revert "arch: arm: cortex_m: move part of swap_helper to C" This reverts commit 773739a52a1f82b4329fa81f5d9bfd90ff09be35. Fixes #80701 Signed-off-by: Anas Nashif --- arch/arm/core/cortex_m/swap.c | 57 ---------- arch/arm/core/cortex_m/swap_helper.S | 150 +++++++++++++++++++++++++-- 2 files changed, 140 insertions(+), 67 deletions(-) diff --git a/arch/arm/core/cortex_m/swap.c b/arch/arm/core/cortex_m/swap.c index b60f6acd675d3..9a597ef219d62 100644 --- a/arch/arm/core/cortex_m/swap.c +++ b/arch/arm/core/cortex_m/swap.c @@ -1,6 +1,5 @@ /* * Copyright (c) 2018 Linaro, Limited - * Copyright (c) 2023 Arm Limited * * SPDX-License-Identifier: Apache-2.0 */ @@ -48,59 +47,3 @@ int arch_swap(unsigned int key) */ return _current->arch.swap_return_value; } - -uintptr_t z_arm_pendsv_c(uintptr_t exc_ret) -{ - /* Store LSB of LR (EXC_RETURN) to the thread's 'mode' word. */ - IF_ENABLED(CONFIG_ARM_STORE_EXC_RETURN, - (_kernel.cpus[0].current->arch.mode_exc_return = (uint8_t)exc_ret;)); - - /* Protect the kernel state while we play with the thread lists */ - uint32_t basepri = arch_irq_lock(); - - /* fetch the thread to run from the ready queue cache */ - struct k_thread *current = _kernel.cpus[0].current = _kernel.ready_q.cache; - - /* - * Clear PendSV so that if another interrupt comes in and - * decides, with the new kernel state based on the new thread - * being context-switched in, that it needs to reschedule, it - * will take, but that previously pended PendSVs do not take, - * since they were based on the previous kernel state and this - * has been handled. - */ - SCB->ICSR = SCB_ICSR_PENDSVCLR_Msk; - - /* For Cortex-M, store TLS pointer in a global variable, - * as it lacks the process ID or thread ID register - * to be used by toolchain to access thread data. - */ - IF_ENABLED(CONFIG_THREAD_LOCAL_STORAGE, - (extern uintptr_t z_arm_tls_ptr; z_arm_tls_ptr = current->tls)); - - IF_ENABLED(CONFIG_ARM_STORE_EXC_RETURN, - (exc_ret = (exc_ret & 0xFFFFFF00) | current->arch.mode_exc_return)); - - /* Restore previous interrupt disable state (irq_lock key) - * (We clear the arch.basepri field after restoring state) - */ - basepri = current->arch.basepri; - current->arch.basepri = 0; - - arch_irq_unlock(basepri); - -#if defined(CONFIG_MPU_STACK_GUARD) || defined(CONFIG_USERSPACE) - /* Re-program dynamic memory map */ - z_arm_configure_dynamic_mpu_regions(current); -#endif - - /* restore mode */ - IF_ENABLED(CONFIG_USERSPACE, ({ - CONTROL_Type ctrl = {.w = __get_CONTROL()}; - /* exit privileged state when returing to thread mode. */ - ctrl.b.nPRIV = 0; - __set_CONTROL(ctrl.w | current->arch.mode); - })); - - return exc_ret; -} diff --git a/arch/arm/core/cortex_m/swap_helper.S b/arch/arm/core/cortex_m/swap_helper.S index c2cb3ef7f2fea..477ee2ac86d71 100644 --- a/arch/arm/core/cortex_m/swap_helper.S +++ b/arch/arm/core/cortex_m/swap_helper.S @@ -27,7 +27,6 @@ _ASM_FILE_PROLOGUE GTEXT(z_arm_svc) GTEXT(z_arm_pendsv) GTEXT(z_do_kernel_oops) -GTEXT(z_arm_pendsv_c) #if defined(CONFIG_USERSPACE) GTEXT(z_arm_do_syscall) #endif @@ -118,20 +117,125 @@ out_fp_endif: #error Unknown ARM architecture #endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */ - mov r4, lr - mov r0, lr - bl z_arm_pendsv_c - mov lr, r4 + /* Protect the kernel state while we play with the thread lists */ +#if defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE) + cpsid i +#elif defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE) + movs.n r0, #_EXC_IRQ_DEFAULT_PRIO + msr BASEPRI_MAX, r0 + isb /* Make the effect of disabling interrupts be realized immediately */ +#else +#error Unknown ARM architecture +#endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */ - ldr r1, =_kernel - ldr r2, [r1, #_kernel_offset_to_current] + /* + * Prepare to clear PendSV with interrupts unlocked, but + * don't clear it yet. PendSV must not be cleared until + * the new thread is context-switched in since all decisions + * to pend PendSV have been taken with the current kernel + * state and this is what we're handling currently. + */ + ldr r7, =_SCS_ICSR + ldr r6, =_SCS_ICSR_UNPENDSV + + /* _kernel is still in r1 */ + + /* fetch the thread to run from the ready queue cache */ + ldr r2, [r1, #_kernel_offset_to_ready_q_cache] + + str r2, [r1, #_kernel_offset_to_current] + + /* + * Clear PendSV so that if another interrupt comes in and + * decides, with the new kernel state based on the new thread + * being context-switched in, that it needs to reschedule, it + * will take, but that previously pended PendSVs do not take, + * since they were based on the previous kernel state and this + * has been handled. + */ + + /* _SCS_ICSR is still in r7 and _SCS_ICSR_UNPENDSV in r6 */ + str r6, [r7, #0] + +#if defined(CONFIG_THREAD_LOCAL_STORAGE) + /* Grab the TLS pointer */ + ldr r4, =_thread_offset_to_tls + adds r4, r2, r4 + ldr r0, [r4] + + /* For Cortex-M, store TLS pointer in a global variable, + * as it lacks the process ID or thread ID register + * to be used by toolchain to access thread data. + */ + ldr r4, =z_arm_tls_ptr + str r0, [r4] +#endif #if defined(CONFIG_ARM_STORE_EXC_RETURN) /* Restore EXC_RETURN value. */ - mov lr, r0 + ldrsb lr, [r2, #_thread_offset_to_mode_exc_return] +#endif + + /* Restore previous interrupt disable state (irq_lock key) + * (We clear the arch.basepri field after restoring state) + */ +#if defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE) && (_thread_offset_to_basepri > 124) + /* Doing it this way since the offset to thread->arch.basepri can in + * some configurations be larger than the maximum of 124 for ldr/str + * immediate offsets. + */ + ldr r4, =_thread_offset_to_basepri + adds r4, r2, r4 + + ldr r0, [r4] + movs.n r3, #0 + str r3, [r4] +#else + ldr r0, [r2, #_thread_offset_to_basepri] + movs r3, #0 + str r3, [r2, #_thread_offset_to_basepri] #endif #if defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE) + /* BASEPRI not available, previous interrupt disable state + * maps to PRIMASK. + * + * Only enable interrupts if value is 0, meaning interrupts + * were enabled before irq_lock was called. + */ + cmp r0, #0 + bne _thread_irq_disabled + cpsie i +_thread_irq_disabled: + +#if defined(CONFIG_MPU_STACK_GUARD) || defined(CONFIG_USERSPACE) + /* Re-program dynamic memory map */ + push {r2,lr} + mov r0, r2 + bl z_arm_configure_dynamic_mpu_regions + pop {r2,r3} + mov lr, r3 +#endif + +#ifdef CONFIG_USERSPACE + /* restore mode */ + ldr r3, =_thread_offset_to_mode + adds r3, r2, r3 + ldr r0, [r3] + mrs r3, CONTROL + movs.n r1, #1 + bics r3, r1 + orrs r3, r0 + msr CONTROL, r3 + + /* ISB is not strictly necessary here (stack pointer is not being + * touched), but it's recommended to avoid executing pre-fetched + * instructions with the previous privilege. + */ + isb + +#endif + ldr r4, =_thread_offset_to_callee_saved adds r0, r2, r4 @@ -149,6 +253,9 @@ out_fp_endif: subs r0, #36 ldmia r0!, {r4-r7} #elif defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE) + /* restore BASEPRI for the incoming thread */ + msr BASEPRI, r0 + #ifdef CONFIG_FPU_SHARING /* Assess whether switched-in thread had been using the FP registers. */ tst lr, #_EXC_RETURN_FTYPE_Msk @@ -178,6 +285,30 @@ in_fp_endif: isb #endif +#if defined(CONFIG_MPU_STACK_GUARD) || defined(CONFIG_USERSPACE) + /* Re-program dynamic memory map */ + push {r2,lr} + mov r0, r2 /* _current thread */ + bl z_arm_configure_dynamic_mpu_regions + pop {r2,lr} +#endif + +#ifdef CONFIG_USERSPACE + /* restore mode */ + ldr r0, [r2, #_thread_offset_to_mode] + mrs r3, CONTROL + bic r3, #1 + orr r3, r0 + msr CONTROL, r3 + + /* ISB is not strictly necessary here (stack pointer is not being + * touched), but it's recommended to avoid executing pre-fetched + * instructions with the previous privilege. + */ + isb + +#endif + /* load callee-saved + psp from thread */ add r0, r2, #_thread_offset_to_callee_saved ldmia r0, {r4-r11, ip} @@ -298,8 +429,7 @@ _stack_frame_endif: #endif /* exception return is done in z_arm_int_exit() */ - ldr r0, =z_arm_int_exit - bx r0 + b z_arm_int_exit #endif _oops: From d9bc0b60b989c9ab05f717d245546dde8b97d078 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 1 Nov 2024 17:50:50 -0400 Subject: [PATCH 2047/4482] arm: cortex_m: restore fix for loading z_arm_int_exit This change was in the same commit previously reverted and seem to be unrelated and should not be reverted. Fixes the problem: ..... /swap_helper.S:432:(.text.z_arm_svc+0x26): relocation truncated to fit: R_ARM_THM_JUMP11 against symbol `z_arm_int_exit' defined in .text._HandlerModeExit section in ....core/cortex_m/libarch__arm__core__cortex_m.a(exc_exit.c.obj) Signed-off-by: Anas Nashif --- arch/arm/core/cortex_m/swap_helper.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/core/cortex_m/swap_helper.S b/arch/arm/core/cortex_m/swap_helper.S index 477ee2ac86d71..7a557e904f1e0 100644 --- a/arch/arm/core/cortex_m/swap_helper.S +++ b/arch/arm/core/cortex_m/swap_helper.S @@ -429,7 +429,9 @@ _stack_frame_endif: #endif /* exception return is done in z_arm_int_exit() */ - b z_arm_int_exit + ldr r0, =z_arm_int_exit + bx r0 + #endif _oops: From e90c58a5b1ca4c9b040eb343d9c10b8ba59f3beb Mon Sep 17 00:00:00 2001 From: Dan Kalowsky Date: Fri, 1 Nov 2024 11:34:24 -0700 Subject: [PATCH 2048/4482] release: Zephyr 4.0.0-rc2 Bump the version file for RC2. Signed-off-by: Dan Kalowsky --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 1659ec4dbe225..939e2dae1ef3c 100644 --- a/VERSION +++ b/VERSION @@ -2,4 +2,4 @@ VERSION_MAJOR = 4 VERSION_MINOR = 0 PATCHLEVEL = 0 VERSION_TWEAK = 0 -EXTRAVERSION = rc1 +EXTRAVERSION = rc2 From 12821f8ec6bb9d817a05fae1e5a51258c1d00d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 1 Nov 2024 12:16:28 +0100 Subject: [PATCH 2049/4482] doc: releases: Add list of added boards in 4.0 cycle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds the list of new boards for 4.0 release, sorted by vendor name. Signed-off-by: Benjamin Cabé --- doc/releases/release-notes-4.0.rst | 61 +++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 16baae3bb590b..8d36f61d132b8 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -160,7 +160,66 @@ Boards & SoC Support * Added support for these boards: - * Added support for :ref:`PHYTEC phyBOARD-Nash `: ``phyboard_nash``. + * :zephyr:board:`01space ESP32C3 0.42 OLED ` (``esp32c3_042_oled``) + * :zephyr:board:`ADI MAX32662EVKIT ` (``max32662evkit``) + * :zephyr:board:`ADI MAX32666EVKIT ` (``max32666evkit``) + * :zephyr:board:`ADI MAX32666FTHR ` (``max32666fthr``) + * :zephyr:board:`ADI MAX32675EVKIT ` (``max32675evkit``) + * :zephyr:board:`ADI MAX32690FTHR ` (``max32690fthr``) + * :ref:`Arduino Nicla Vision ` (``arduino_nicla_vision``) + * :zephyr:board:`BeagleBone AI-64 ` (``beaglebone_ai64``) + * :zephyr:board:`BeaglePlay (CC1352) ` (``beagleplay``) + * :zephyr:board:`DPTechnics Walter ` (``walter``) + * :zephyr:board:`Espressif ESP32-C3-DevKitC ` (``esp32c3_devkitc``) + * :zephyr:board:`Espressif ESP32-C3-DevKit-RUST ` (``esp32c3_rust``) + * :zephyr:board:`Espressif ESP32-S3-EYE ` (``esp32s3_eye``) + * :zephyr:board:`Espressif ESP8684-DevKitM ` (``esp8684_devkitm``) + * :zephyr:board:`Gardena Smart Garden Radio Module ` (``sgrm``) + * :zephyr:board:`mikroe STM32 M4 Clicker ` (``mikroe_stm32_m4_clicker``) + * :ref:`Nordic Semiconductor nRF54L15 DK ` (``nrf54l15dk``) + * :ref:`Nordic Semiconductor nRF54L20 PDK ` (``nrf54l20pdk``) + * :ref:`Nordic Semiconductor nRF7002 DK ` (``nrf7002dk``) + * :zephyr:board:`Nuvoton NPCM400_EVB ` (``npcm400_evb``) + * :zephyr:board:`NXP FRDM-MCXA156 ` (``frdm_mcxa156``) + * :zephyr:board:`NXP FRDM-MCXC242 ` (``frdm_mcxc242``) + * :zephyr:board:`NXP FRDM-MCXC444 ` (``frdm_mcxc444``) + * :zephyr:board:`NXP FRDM-MCXN236 ` (``frdm_mcxn236``) + * :zephyr:board:`NXP FRDM-MCXW71 ` (``frdm_mcxw71``) + * :zephyr:board:`NXP i.MX95 EVK ` (``imx95_evk``) + * :zephyr:board:`NXP MIMXRT1180-EVK ` (``mimxrt1180_evk``) + * :ref:`PHYTEC phyBOARD-Nash i.MX93 ` (``phyboard_nash``) + * :ref:`Renesas RA2A1 Evaluation Kit ` (``ek_ra2a1``) + * :ref:`Renesas RA4E2 Evaluation Kit ` (``ek_ra4e2``) + * :ref:`Renesas RA4M2 Evaluation Kit ` (``ek_ra4m2``) + * :ref:`Renesas RA4M3 Evaluation Kit ` (``ek_ra4m3``) + * :ref:`Renesas RA4W1 Evaluation Kit ` (``ek_ra4w1``) + * :ref:`Renesas RA6E2 Evaluation Kit ` (``ek_ra6e2``) + * :ref:`Renesas RA6M1 Evaluation Kit ` (``ek_ra6m1``) + * :ref:`Renesas RA6M2 Evaluation Kit ` (``ek_ra6m2``) + * :ref:`Renesas RA6M3 Evaluation Kit ` (``ek_ra6m3``) + * :ref:`Renesas RA6M4 Evaluation Kit ` (``ek_ra6m4``) + * :ref:`Renesas RA6M5 Evaluation Kit ` (``ek_ra6m5``) + * :ref:`Renesas RA8D1 Evaluation Kit ` (``ek_ra8d1``) + * :ref:`Renesas RA6E1 Fast Prototyping Board ` (``fpb_ra6e1``) + * :ref:`Renesas RA6E2 Fast Prototyping Board ` (``fpb_ra6e2``) + * :ref:`Renesas RA8T1 Evaluation Kit ` (``mck_ra8t1``) + * :zephyr:board:`Renode Cortex-R8 Virtual ` (``cortex_r8_virtual``) + * :ref:`sensry.io Ganymed Break-Out-Board (BOB) ` (``ganymed_bob``) + * :zephyr:board:`SiLabs SiM3U1xx 32-bit MCU USB Development Kit ` (``sim3u1xx_dk``) + * :ref:`SparkFun Thing Plus Matter ` (``sparkfun_thing_plus_matter_mgm240p``) + * :zephyr:board:`ST Nucleo G431KB ` (``nucleo_g431kb``) + * :zephyr:board:`ST Nucleo H503RB ` (``nucleo_h503rb``) + * :zephyr:board:`ST Nucleo H755ZI-Q ` (``nucleo_h755zi_q``) + * :zephyr:board:`ST Nucleo U031R8 ` (``nucleo_u031r8``) + * :zephyr:board:`ST Nucleo U083RC ` (``nucleo_u083rc``) + * :zephyr:board:`ST Nucleo WB05KZ ` (``nucleo_wb05kz``) + * :zephyr:board:`ST Nucleo WB09KE ` (``nucleo_wb09ke``) + * :zephyr:board:`ST STM32U083C-DK ` (``stm32u083c_dk``) + * :zephyr:board:`TI CC1352P7 LaunchPad ` (``cc1352p7_lp``) + * :zephyr:board:`vcc-gnd YD-STM32H750VB ` (``yd_stm32h750vb``) + * :zephyr:board:`WeAct Studio STM32F405 Core Board V1.0 ` (``weact_stm32f405_core``) + * :zephyr:board:`WeAct Studio USB2CANFDV1 ` (``usb2canfdv1``) + * :zephyr:board:`Witte Technology Linum Board ` (``linum``) * Made these board changes: From 8beaf986fc34f0dba83752ac8a38f0c5cf6c9855 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 1 Nov 2024 14:01:18 +0100 Subject: [PATCH 2050/4482] doc: releases: Add list of added shields in 4.0 cycle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds the list of new shields for 4.0 release, sorted by vendor name. Signed-off-by: Benjamin Cabé --- boards/shields/eval_adxl362_ardz/doc/index.rst | 2 +- boards/shields/eval_adxl372_ardz/doc/index.rst | 2 +- boards/shields/pmod_acl/doc/index.rst | 2 +- doc/releases/release-notes-4.0.rst | 9 +++++++++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/boards/shields/eval_adxl362_ardz/doc/index.rst b/boards/shields/eval_adxl362_ardz/doc/index.rst index 68c7d479690a9..e14f708f3f152 100644 --- a/boards/shields/eval_adxl362_ardz/doc/index.rst +++ b/boards/shields/eval_adxl362_ardz/doc/index.rst @@ -1,4 +1,4 @@ -.. eval_adxl362_ardz: +.. _eval_adxl362_ardz: EVAL-ADXL362-ARDZ ################# diff --git a/boards/shields/eval_adxl372_ardz/doc/index.rst b/boards/shields/eval_adxl372_ardz/doc/index.rst index 77e75e37c9b9c..b4210d2d9ca55 100644 --- a/boards/shields/eval_adxl372_ardz/doc/index.rst +++ b/boards/shields/eval_adxl372_ardz/doc/index.rst @@ -1,4 +1,4 @@ -.. eval_adxl372_ardz: +.. _eval_adxl372_ardz: EVAL-ADXL372-ARDZ ################# diff --git a/boards/shields/pmod_acl/doc/index.rst b/boards/shields/pmod_acl/doc/index.rst index 7a635f435ad45..19d2ee0386752 100644 --- a/boards/shields/pmod_acl/doc/index.rst +++ b/boards/shields/pmod_acl/doc/index.rst @@ -1,4 +1,4 @@ -.. pmod_acl: +.. _pmod_acl: Digilent Pmod ACL ################# diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 8d36f61d132b8..4edc8c3ffe475 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -243,6 +243,15 @@ Boards & SoC Support * Added support for the following shields: + * :ref:`ADI EVAL-ADXL362-ARDZ ` + * :ref:`ADI EVAL-ADXL372-ARDZ ` + * :ref:`Digilent Pmod ACL ` + * :ref:`MikroElektronika BLE TINY Click ` + * :ref:`Nordic SemiConductor nRF7002 EB ` + * :ref:`Nordic SemiConductor nRF7002 EK ` + * :ref:`ST X-NUCLEO-WB05KN1: BLE expansion board ` + * :ref:`WeAct Studio MiniSTM32H7xx OV2640 Camera Sensor ` + Build system and Infrastructure ******************************* From 23fb3b77a2b2cf53eff1697888f443236069b30c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 1 Nov 2024 14:05:29 +0100 Subject: [PATCH 2051/4482] doc: releases: Use :cve: role in security section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adopte `:cve:` role to automatically link to CVE. Signed-off-by: Benjamin Cabé --- doc/releases/release-notes-4.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 4edc8c3ffe475..c47b46e588ba0 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -25,7 +25,7 @@ The following CVEs are addressed by this release: More detailed information can be found in: https://docs.zephyrproject.org/latest/security/vulnerabilities.html -* CVE-2024-8798: Under embargo until 2024-11-22 +* :cve:`2024-8798`: Under embargo until 2024-11-22 API Changes *********** From 52d21d7bf017349399263ae0dad5bead83eda036 Mon Sep 17 00:00:00 2001 From: Gerson Fernando Budke Date: Thu, 31 Oct 2024 18:00:45 +0100 Subject: [PATCH 2052/4482] soc: gd32: Drop PINCTRL from Kconfig.defconfig This Kconfig has wrongly been added to defconfig files. It is not the right place for it. It has never been the right place for it. Drivers that need it should select the symbol in their Kconfig entries. Drop PINCTL from Kconfig.defconfig and add proper select at Kconfig.gd32. Fixes #78619 Signed-off-by: Gerson Fernando Budke --- drivers/adc/Kconfig.gd32 | 1 + drivers/dac/Kconfig.gd32 | 1 + drivers/i2c/Kconfig.gd32 | 1 + drivers/pwm/Kconfig.gd32 | 1 + drivers/serial/Kconfig.gd32 | 1 + drivers/spi/Kconfig.gd32 | 1 + soc/gd/gd32/Kconfig.defconfig | 3 --- 7 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/adc/Kconfig.gd32 b/drivers/adc/Kconfig.gd32 index 96bd60d1e54d8..3123cccd6cf32 100644 --- a/drivers/adc/Kconfig.gd32 +++ b/drivers/adc/Kconfig.gd32 @@ -7,5 +7,6 @@ config ADC_GD32 bool "GD32 ADC driver" default y depends on DT_HAS_GD_GD32_ADC_ENABLED + select PINCTRL help Enable GigaDevice GD32 ADC driver diff --git a/drivers/dac/Kconfig.gd32 b/drivers/dac/Kconfig.gd32 index 260ecce284994..607df9111a3d1 100644 --- a/drivers/dac/Kconfig.gd32 +++ b/drivers/dac/Kconfig.gd32 @@ -8,5 +8,6 @@ config DAC_GD32 bool "GD32 DAC driver" default y depends on DT_HAS_GD_GD32_DAC_ENABLED + select PINCTRL help Enable GigaDevice GD32 DAC driver diff --git a/drivers/i2c/Kconfig.gd32 b/drivers/i2c/Kconfig.gd32 index 3089647ca529c..6e09116bb0e55 100644 --- a/drivers/i2c/Kconfig.gd32 +++ b/drivers/i2c/Kconfig.gd32 @@ -5,5 +5,6 @@ config I2C_GD32 bool "GigaDevice GD32 I2C driver" default y depends on DT_HAS_GD_GD32_I2C_ENABLED + select PINCTRL help Enables GigaDevice GD32 I2C driver diff --git a/drivers/pwm/Kconfig.gd32 b/drivers/pwm/Kconfig.gd32 index f82c3b48878b7..9dc55872963aa 100644 --- a/drivers/pwm/Kconfig.gd32 +++ b/drivers/pwm/Kconfig.gd32 @@ -5,5 +5,6 @@ config PWM_GD32 bool "GigaDevice GD32 PWM driver" default y depends on DT_HAS_GD_GD32_PWM_ENABLED + select PINCTRL help Enable the GigaDevice GD32 PWM driver. diff --git a/drivers/serial/Kconfig.gd32 b/drivers/serial/Kconfig.gd32 index ed66a9a5c7467..7d60926723089 100644 --- a/drivers/serial/Kconfig.gd32 +++ b/drivers/serial/Kconfig.gd32 @@ -5,6 +5,7 @@ config USART_GD32 bool "GD32 serial driver" default y depends on DT_HAS_GD_GD32_USART_ENABLED + select PINCTRL select SERIAL_HAS_DRIVER select SERIAL_SUPPORT_INTERRUPT select USE_GD32_USART diff --git a/drivers/spi/Kconfig.gd32 b/drivers/spi/Kconfig.gd32 index 6c167c0044110..a6e029368b136 100644 --- a/drivers/spi/Kconfig.gd32 +++ b/drivers/spi/Kconfig.gd32 @@ -5,6 +5,7 @@ config SPI_GD32 bool "Gigadevice GD32 SPI driver" default y depends on DT_HAS_GD_GD32_SPI_ENABLED + select PINCTRL help Enables Gigadevice GD32 SPI driver. diff --git a/soc/gd/gd32/Kconfig.defconfig b/soc/gd/gd32/Kconfig.defconfig index 345f14c062979..9847bb415bd1f 100644 --- a/soc/gd/gd32/Kconfig.defconfig +++ b/soc/gd/gd32/Kconfig.defconfig @@ -5,9 +5,6 @@ if SOC_FAMILY_GD_GD32 rsource "*/Kconfig.defconfig.series" -config PINCTRL - default y - config RESET default y From adeb28d147ccea8aba005167f1dba387b3a547e9 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 31 Oct 2024 14:40:35 +0200 Subject: [PATCH 2053/4482] net: dhcpv4: Fix DNS server list allocation Allocate one extra pointer for the DNS server list so that DNS resolving code can detect the end of the list. Signed-off-by: Jukka Rissanen --- subsys/net/lib/dhcpv4/dhcpv4.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/subsys/net/lib/dhcpv4/dhcpv4.c b/subsys/net/lib/dhcpv4/dhcpv4.c index 4b3f60a86c111..8f55293e2d003 100644 --- a/subsys/net/lib/dhcpv4/dhcpv4.c +++ b/subsys/net/lib/dhcpv4/dhcpv4.c @@ -1054,14 +1054,15 @@ static bool dhcpv4_parse_options(struct net_pkt *pkt, break; } #if defined(CONFIG_DNS_RESOLVER) +#define MAX_DNS_SERVERS CONFIG_DNS_RESOLVER_MAX_SERVERS case DHCPV4_OPTIONS_DNS_SERVER: { struct dns_resolve_context *ctx; - struct sockaddr_in dnses[CONFIG_DNS_RESOLVER_MAX_SERVERS] = { 0 }; - const struct sockaddr *dns_servers[CONFIG_DNS_RESOLVER_MAX_SERVERS]; + struct sockaddr_in dnses[MAX_DNS_SERVERS] = { 0 }; + const struct sockaddr *dns_servers[MAX_DNS_SERVERS + 1] = { 0 }; const uint8_t addr_size = 4U; int status; - for (uint8_t i = 0; i < CONFIG_DNS_RESOLVER_MAX_SERVERS; i++) { + for (uint8_t i = 0; i < MAX_DNS_SERVERS; i++) { dns_servers[i] = (struct sockaddr *)&dnses[i]; } @@ -1079,12 +1080,11 @@ static bool dhcpv4_parse_options(struct net_pkt *pkt, const uint8_t provided_servers_cnt = length / addr_size; uint8_t dns_servers_cnt = 0; - if (provided_servers_cnt > CONFIG_DNS_RESOLVER_MAX_SERVERS) { + if (provided_servers_cnt > MAX_DNS_SERVERS) { NET_WARN("DHCP server provided more DNS servers than can be saved"); - dns_servers_cnt = CONFIG_DNS_RESOLVER_MAX_SERVERS; + dns_servers_cnt = MAX_DNS_SERVERS; } else { - for (uint8_t i = provided_servers_cnt; - i < CONFIG_DNS_RESOLVER_MAX_SERVERS; i++) { + for (uint8_t i = provided_servers_cnt; i < MAX_DNS_SERVERS; i++) { dns_servers[i] = NULL; } From ec18ab1eda6851d9c6f5ffae3b8ba22c1b286289 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 31 Oct 2024 13:38:30 +0200 Subject: [PATCH 2054/4482] net: dns: Convert the query and answer to small case letters Because we might get answers in capital letters, convert the answer to small case letters and also make sure we send query in small case latters. This makes sure that our query_hash is properly calculated regardless of how the resolver gets the data. Signed-off-by: Jukka Rissanen --- subsys/net/lib/dns/resolve.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/subsys/net/lib/dns/resolve.c b/subsys/net/lib/dns/resolve.c index 21377cb0fa617..ff17b6b6257fe 100644 --- a/subsys/net/lib/dns/resolve.c +++ b/subsys/net/lib/dns/resolve.c @@ -19,6 +19,7 @@ LOG_MODULE_REGISTER(net_dns_resolve, CONFIG_DNS_RESOLVER_LOG_LEVEL); #include #include #include +#include #include #include @@ -653,7 +654,7 @@ int dns_validate_msg(struct dns_resolve_context *ctx, struct dns_addrinfo info = { 0 }; uint32_t ttl; /* RR ttl, so far it is not passed to caller */ uint8_t *src, *addr; - const char *query_name; + char *query_name; int address_size; /* index that points to the current answer being analyzed */ int answer_ptr; @@ -743,6 +744,13 @@ int dns_validate_msg(struct dns_resolve_context *ctx, query_name = dns_msg->msg + dns_msg->query_offset; + /* Convert the query name to small case so that our + * hash checker can find it. + */ + for (size_t i = 0, n = strlen(query_name); i < n; i++) { + query_name[i] = tolower(query_name[i]); + } + /* Add \0 and query type (A or AAAA) to the hash */ *query_hash = crc16_ansi(query_name, strlen(query_name) + 1 + 2); @@ -955,6 +963,7 @@ static int dns_write(struct dns_resolve_context *ctx, int server_addr_len; uint16_t dns_id, len; int ret, sock, family; + char *query_name; sock = ctx->servers[server_idx].sock; family = ctx->servers[server_idx].dns_server.sa_family; @@ -971,11 +980,20 @@ static int dns_write(struct dns_resolve_context *ctx, return -EINVAL; } + query_name = buf + DNS_MSG_HEADER_SIZE; + + /* Convert the query name to small case so that our + * hash checker can find it later when we get the answer. + */ + for (int i = 0; i < dns_qname->len; i++) { + query_name[i] = tolower(query_name[i]); + } + /* Add \0 and query type (A or AAAA) to the hash. Note that * the dns_qname->len contains the length of \0 */ ctx->queries[query_idx].query_hash = - crc16_ansi(buf + DNS_MSG_HEADER_SIZE, dns_qname->len + 2); + crc16_ansi(query_name, dns_qname->len + 2); if (hop_limit > 0) { if (IS_ENABLED(CONFIG_NET_IPV6) && family == AF_INET6) { From 5c529919ec95d1fe12b94a99533a19842f2083e3 Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Mon, 28 Oct 2024 15:26:33 +0100 Subject: [PATCH 2055/4482] dts: arm: st: stm32h7 with dual core have flash clock enable bit Define the "clocks" property, for the flash "st,stm32h7-flash-controller" node, only for the stm32H7 dual-core devices which have the RCC bit 8 present in their RCC AHB3 register. Signed-off-by: Francois Ramu --- dts/arm/st/h7/stm32h7.dtsi | 1 - dts/arm/st/h7/stm32h7_dualcore.dtsi | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/dts/arm/st/h7/stm32h7.dtsi b/dts/arm/st/h7/stm32h7.dtsi index 64abc777b769f..3858f8f97ea44 100644 --- a/dts/arm/st/h7/stm32h7.dtsi +++ b/dts/arm/st/h7/stm32h7.dtsi @@ -144,7 +144,6 @@ compatible = "st,stm32-flash-controller", "st,stm32h7-flash-controller"; reg = <0x52002000 0x400>; interrupts = <4 0>; - clocks = <&rcc STM32_CLOCK(AHB3, 8U)>; #address-cells = <1>; #size-cells = <1>; diff --git a/dts/arm/st/h7/stm32h7_dualcore.dtsi b/dts/arm/st/h7/stm32h7_dualcore.dtsi index e3b3d88a77aec..081c70519f414 100644 --- a/dts/arm/st/h7/stm32h7_dualcore.dtsi +++ b/dts/arm/st/h7/stm32h7_dualcore.dtsi @@ -25,3 +25,7 @@ }; }; }; + +&flash { + clocks = <&rcc STM32_CLOCK(AHB3, 8U)>; +}; From 331423d8e3456ab584c6610ec282abae6b2fefb1 Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Mon, 28 Oct 2024 15:26:54 +0100 Subject: [PATCH 2056/4482] drivers: flash: stm32H7 flash driver enable clock when defined Not all the stm32H7 have a clock enable for their flash; only the dual-core. For the st,stm32h7-flash-controller with "clocks" property, the driver will enable the flash clock bit in the corresponding RCC register. Signed-off-by: Francois Ramu --- drivers/flash/flash_stm32h7x.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/flash/flash_stm32h7x.c b/drivers/flash/flash_stm32h7x.c index afba8bc436b7b..008c787a57c38 100644 --- a/drivers/flash/flash_stm32h7x.c +++ b/drivers/flash/flash_stm32h7x.c @@ -702,8 +702,10 @@ void flash_stm32_page_layout(const struct device *dev, static struct flash_stm32_priv flash_data = { .regs = (FLASH_TypeDef *) DT_INST_REG_ADDR(0), +#if DT_NODE_HAS_PROP(DT_INST(0, st_stm32h7_flash_controller), clocks) .pclken = { .bus = DT_INST_CLOCKS_CELL(0, bus), .enr = DT_INST_CLOCKS_CELL(0, bits)}, +#endif }; static const struct flash_driver_api flash_stm32h7_api = { @@ -718,6 +720,8 @@ static const struct flash_driver_api flash_stm32h7_api = { static int stm32h7_flash_init(const struct device *dev) { +#if DT_NODE_HAS_PROP(DT_INST(0, st_stm32h7_flash_controller), clocks) + /* Only stm32h7 dual core devices have the clocks property */ struct flash_stm32_priv *p = FLASH_STM32_PRIV(dev); const struct device *const clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE); @@ -726,12 +730,12 @@ static int stm32h7_flash_init(const struct device *dev) return -ENODEV; } - /* enable clock */ + /* enable clock : enable the RCC_AHB3ENR_FLASHEN bit */ if (clock_control_on(clk, (clock_control_subsys_t)&p->pclken) != 0) { LOG_ERR("Failed to enable clock"); return -EIO; } - +#endif flash_stm32_sem_init(dev); LOG_DBG("Flash initialized. BS: %zu", From a925d60cbdc4bce630196e1fdd7c3f85b2422061 Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Mon, 28 Oct 2024 15:51:01 +0100 Subject: [PATCH 2057/4482] drivers: flash: stm32h7 flash driver reformat code Apply clang-format to re-format the flash_stm32h7.c driver Signed-off-by: Francois Ramu --- drivers/flash/flash_stm32h7x.c | 155 ++++++++++++--------------------- 1 file changed, 56 insertions(+), 99 deletions(-) diff --git a/drivers/flash/flash_stm32h7x.c b/drivers/flash/flash_stm32h7x.c index 008c787a57c38..76970d3b50b5a 100644 --- a/drivers/flash/flash_stm32h7x.c +++ b/drivers/flash/flash_stm32h7x.c @@ -26,15 +26,14 @@ #include "stm32_hsem.h" #define LOG_DOMAIN flash_stm32h7 -#define LOG_LEVEL CONFIG_FLASH_LOG_LEVEL +#define LOG_LEVEL CONFIG_FLASH_LOG_LEVEL #include LOG_MODULE_REGISTER(LOG_DOMAIN); /* Let's wait for double the max erase time to be sure that the operation is * completed. */ -#define STM32H7_FLASH_TIMEOUT \ - (2 * DT_PROP(DT_INST(0, st_stm32_nv_flash), max_erase_time)) +#define STM32H7_FLASH_TIMEOUT (2 * DT_PROP(DT_INST(0, st_stm32_nv_flash), max_erase_time)) #define STM32H7_M4_FLASH_SIZE DT_PROP_OR(DT_INST(0, st_stm32_nv_flash), bank2_flash_size, 0) #ifdef CONFIG_CPU_CORTEX_M4 @@ -46,14 +45,14 @@ LOG_MODULE_REGISTER(LOG_DOMAIN); #else #define REAL_FLASH_SIZE_KB KB(LL_GetFlashSize()) #endif -#define SECTOR_PER_BANK ((REAL_FLASH_SIZE_KB / FLASH_SECTOR_SIZE) / 2) +#define SECTOR_PER_BANK ((REAL_FLASH_SIZE_KB / FLASH_SECTOR_SIZE) / 2) #if defined(DUAL_BANK) -#define STM32H7_SERIES_MAX_FLASH_KB KB(2048) -#define BANK2_OFFSET (STM32H7_SERIES_MAX_FLASH_KB / 2) +#define STM32H7_SERIES_MAX_FLASH_KB KB(2048) +#define BANK2_OFFSET (STM32H7_SERIES_MAX_FLASH_KB / 2) /* When flash is dual bank and flash size is smaller than Max flash size of * the serie, there is a discontinuty between bank1 and bank2. */ -#define DISCONTINUOUS_BANKS (REAL_FLASH_SIZE_KB < STM32H7_SERIES_MAX_FLASH_KB) +#define DISCONTINUOUS_BANKS (REAL_FLASH_SIZE_KB < STM32H7_SERIES_MAX_FLASH_KB) #endif struct flash_stm32_sector_t { @@ -90,9 +89,7 @@ static inline void _flash_stm32_sem_give(const struct device *dev) #define flash_stm32_sem_give(dev) #endif -bool flash_stm32_valid_range(const struct device *dev, off_t offset, - uint32_t len, - bool write) +bool flash_stm32_valid_range(const struct device *dev, off_t offset, uint32_t len, bool write) { #if defined(DUAL_BANK) if (DISCONTINUOUS_BANKS) { @@ -101,8 +98,7 @@ bool flash_stm32_valid_range(const struct device *dev, off_t offset, * start before bank2 and end beyond bank1 at the same time. * Locations beyond bank2 are caught by flash_stm32_range_exists */ - if ((offset < BANK2_OFFSET) - && (offset + len > REAL_FLASH_SIZE_KB / 2)) { + if ((offset < BANK2_OFFSET) && (offset + len > REAL_FLASH_SIZE_KB / 2)) { LOG_ERR("Range ovelaps flash bank discontinuity"); return false; } @@ -113,7 +109,7 @@ bool flash_stm32_valid_range(const struct device *dev, off_t offset, if ((offset % (FLASH_NB_32BITWORD_IN_FLASHWORD * 4)) != 0) { LOG_ERR("Write offset not aligned on flashword length. " "Offset: 0x%lx, flashword length: %d", - (unsigned long) offset, FLASH_NB_32BITWORD_IN_FLASHWORD * 4); + (unsigned long)offset, FLASH_NB_32BITWORD_IN_FLASHWORD * 4); return false; } } @@ -128,16 +124,13 @@ static int flash_stm32_check_status(const struct device *dev) * errors, so in this case we just log a warning. */ #ifdef DUAL_BANK - uint32_t const error_bank2 = (FLASH_FLAG_ALL_ERRORS_BANK2 - & ~FLASH_FLAG_SNECCERR_BANK2); + uint32_t const error_bank2 = (FLASH_FLAG_ALL_ERRORS_BANK2 & ~FLASH_FLAG_SNECCERR_BANK2); #endif uint32_t sr; #if defined(CONFIG_SOC_SERIES_STM32H7RSX) - uint32_t const error_bank = (FLASH_FLAG_ECC_ERRORS - & ~FLASH_FLAG_SNECCERR - & ~FLASH_FLAG_DBECCERR); - + uint32_t const error_bank = + (FLASH_FLAG_ECC_ERRORS & ~FLASH_FLAG_SNECCERR & ~FLASH_FLAG_DBECCERR); /* Read the Interrupt status flags. */ sr = regs->ISR; @@ -159,12 +152,11 @@ static int flash_stm32_check_status(const struct device *dev) regs->ICR = FLASH_FLAG_ECC_ERRORS; if (sr & error_bank) { #else - uint32_t const error_bank1 = (FLASH_FLAG_ALL_ERRORS_BANK1 - & ~FLASH_FLAG_SNECCERR_BANK1); + uint32_t const error_bank1 = (FLASH_FLAG_ALL_ERRORS_BANK1 & ~FLASH_FLAG_SNECCERR_BANK1); /* Read the status flags. */ sr = regs->SR1; - if (sr & (FLASH_FLAG_SNECCERR_BANK1|FLASH_FLAG_DBECCERR_BANK1)) { + if (sr & (FLASH_FLAG_SNECCERR_BANK1 | FLASH_FLAG_DBECCERR_BANK1)) { uint32_t word = regs->ECC_FA1 & FLASH_ECC_FA_FAIL_ECC_ADDR; LOG_WRN("Bank%d ECC error at 0x%08x", 1, @@ -181,7 +173,7 @@ static int flash_stm32_check_status(const struct device *dev) #ifdef DUAL_BANK sr = regs->SR2; - if (sr & (FLASH_FLAG_SNECCERR_BANK1|FLASH_FLAG_DBECCERR_BANK1)) { + if (sr & (FLASH_FLAG_SNECCERR_BANK1 | FLASH_FLAG_DBECCERR_BANK1)) { uint32_t word = regs->ECC_FA2 & FLASH_ECC_FA_FAIL_ECC_ADDR; LOG_WRN("Bank%d ECC error at 0x%08x", 2, @@ -209,7 +201,6 @@ static int flash_stm32_check_status(const struct device *dev) return 0; } - int flash_stm32_wait_flash_idle(const struct device *dev) { int64_t timeout_time = k_uptime_get() + STM32H7_FLASH_TIMEOUT; @@ -220,8 +211,8 @@ int flash_stm32_wait_flash_idle(const struct device *dev) return -EIO; } #ifdef DUAL_BANK - while ((FLASH_STM32_REGS(dev)->SR1 & FLASH_SR_QW) - || (FLASH_STM32_REGS(dev)->SR2 & FLASH_SR_QW)) + while ((FLASH_STM32_REGS(dev)->SR1 & FLASH_SR_QW) || + (FLASH_STM32_REGS(dev)->SR2 & FLASH_SR_QW)) #else while (FLASH_STM32_REGS(dev)->SR1 & FLASH_SR_QW) #endif @@ -235,8 +226,7 @@ int flash_stm32_wait_flash_idle(const struct device *dev) return 0; } -static struct flash_stm32_sector_t get_sector(const struct device *dev, - off_t offset) +static struct flash_stm32_sector_t get_sector(const struct device *dev, off_t offset) { struct flash_stm32_sector_t sector; FLASH_TypeDef *regs = FLASH_STM32_REGS(dev); @@ -246,8 +236,7 @@ static struct flash_stm32_sector_t get_sector(const struct device *dev, bool bank_swap; /* Check whether bank1/2 are swapped */ - bank_swap = (READ_BIT(FLASH->OPTCR, FLASH_OPTCR_SWAP_BANK) - == FLASH_OPTCR_SWAP_BANK); + bank_swap = (READ_BIT(FLASH->OPTCR, FLASH_OPTCR_SWAP_BANK) == FLASH_OPTCR_SWAP_BANK); sector.sector_index = offset / FLASH_SECTOR_SIZE; if ((temp_offset < (REAL_FLASH_SIZE_KB / 2)) && !bank_swap) { sector.bank = 1; @@ -297,7 +286,7 @@ static int erase_sector(const struct device *dev, int offset) if (sector.bank == 0) { - LOG_ERR("Offset %ld does not exist", (long) offset); + LOG_ERR("Offset %ld does not exist", (long)offset); return -EINVAL; } @@ -312,8 +301,7 @@ static int erase_sector(const struct device *dev, int offset) } *(sector.cr) &= ~FLASH_CR_SNB; - *(sector.cr) |= (FLASH_CR_SER - | ((sector.sector_index << FLASH_CR_SNB_Pos) & FLASH_CR_SNB)); + *(sector.cr) |= (FLASH_CR_SER | ((sector.sector_index << FLASH_CR_SNB_Pos) & FLASH_CR_SNB)); *(sector.cr) |= FLASH_CR_START; /* flush the register write */ barrier_dsync_fence_full(); @@ -324,15 +312,12 @@ static int erase_sector(const struct device *dev, int offset) return rc; } - -int flash_stm32_block_erase_loop(const struct device *dev, - unsigned int offset, - unsigned int len) +int flash_stm32_block_erase_loop(const struct device *dev, unsigned int offset, unsigned int len) { unsigned int address = offset; int rc = 0; - for (; address <= offset + len - 1 ; address += FLASH_SECTOR_SIZE) { + for (; address <= offset + len - 1; address += FLASH_SECTOR_SIZE) { rc = erase_sector(dev, address); if (rc < 0) { break; @@ -355,18 +340,15 @@ static int wait_write_queue(const struct flash_stm32_sector_t *sector) return 0; } -static int write_ndwords(const struct device *dev, - off_t offset, const uint64_t *data, - uint8_t n) +static int write_ndwords(const struct device *dev, off_t offset, const uint64_t *data, uint8_t n) { - volatile uint64_t *flash = (uint64_t *)(offset - + FLASH_STM32_BASE_ADDRESS); + volatile uint64_t *flash = (uint64_t *)(offset + FLASH_STM32_BASE_ADDRESS); int rc; int i; struct flash_stm32_sector_t sector = get_sector(dev, offset); if (sector.bank == 0) { - LOG_ERR("Offset %ld does not exist", (long) offset); + LOG_ERR("Offset %ld does not exist", (long)offset); return -EINVAL; } @@ -414,8 +396,8 @@ static int write_ndwords(const struct device *dev, return rc; } -int flash_stm32_write_range(const struct device *dev, unsigned int offset, - const void *data, unsigned int len) +int flash_stm32_write_range(const struct device *dev, unsigned int offset, const void *data, + unsigned int len) { int rc = 0; int i, j; @@ -424,9 +406,7 @@ int flash_stm32_write_range(const struct device *dev, unsigned int offset, uint8_t unaligned_datas[nbytes]; for (i = 0; i < len && i + nbytes <= len; i += nbytes, offset += nbytes) { - rc = write_ndwords(dev, offset, - (const uint64_t *) data + (i >> 3), - ndwords); + rc = write_ndwords(dev, offset, (const uint64_t *)data + (i >> 3), ndwords); if (rc < 0) { return rc; } @@ -440,9 +420,7 @@ int flash_stm32_write_range(const struct device *dev, unsigned int offset, for (j = 0; j < len - i; ++j) { unaligned_datas[j] = ((uint8_t *)data)[i + j]; } - rc = write_ndwords(dev, offset, - (const uint64_t *)unaligned_datas, - ndwords); + rc = write_ndwords(dev, offset, (const uint64_t *)unaligned_datas, ndwords); if (rc < 0) { return rc; } @@ -495,8 +473,7 @@ static int flash_stm32h7_write_protection(const struct device *dev, bool enable) } #ifdef CONFIG_CPU_CORTEX_M7 -static void flash_stm32h7_flush_caches(const struct device *dev, - off_t offset, size_t len) +static void flash_stm32h7_flush_caches(const struct device *dev, off_t offset, size_t len) { ARG_UNUSED(dev); @@ -504,26 +481,22 @@ static void flash_stm32h7_flush_caches(const struct device *dev, return; /* Cache not enabled */ } - SCB_InvalidateDCache_by_Addr((uint32_t *)(FLASH_STM32_BASE_ADDRESS - + offset), len); + SCB_InvalidateDCache_by_Addr((uint32_t *)(FLASH_STM32_BASE_ADDRESS + offset), len); } #endif /* CONFIG_CPU_CORTEX_M7 */ -static int flash_stm32h7_erase(const struct device *dev, off_t offset, - size_t len) +static int flash_stm32h7_erase(const struct device *dev, off_t offset, size_t len) { int rc, rc2; #ifdef CONFIG_CPU_CORTEX_M7 /* Flush whole sectors */ off_t flush_offset = ROUND_DOWN(offset, FLASH_SECTOR_SIZE); - size_t flush_len = ROUND_UP(offset + len - 1, FLASH_SECTOR_SIZE) - - flush_offset; + size_t flush_len = ROUND_UP(offset + len - 1, FLASH_SECTOR_SIZE) - flush_offset; #endif /* CONFIG_CPU_CORTEX_M7 */ if (!flash_stm32_valid_range(dev, offset, len, true)) { - LOG_ERR("Erase range invalid. Offset: %ld, len: %zu", - (long) offset, len); + LOG_ERR("Erase range invalid. Offset: %ld, len: %zu", (long)offset, len); return -EINVAL; } @@ -533,7 +506,7 @@ static int flash_stm32h7_erase(const struct device *dev, off_t offset, flash_stm32_sem_take(dev); - LOG_DBG("Erase offset: %ld, len: %zu", (long) offset, len); + LOG_DBG("Erase offset: %ld, len: %zu", (long)offset, len); rc = flash_stm32h7_write_protection(dev, false); if (rc) { @@ -546,8 +519,7 @@ static int flash_stm32h7_erase(const struct device *dev, off_t offset, /* Flush cache on all sectors affected by the erase */ flash_stm32h7_flush_caches(dev, flush_offset, flush_len); #elif CONFIG_CPU_CORTEX_M4 - if (LL_AHB1_GRP1_IsEnabledClock(LL_AHB1_GRP1_PERIPH_ART) - && LL_ART_IsEnabled()) { + if (LL_AHB1_GRP1_IsEnabledClock(LL_AHB1_GRP1_PERIPH_ART) && LL_ART_IsEnabled()) { LOG_ERR("Cortex M4: ART enabled not supported by flash driver"); } #endif /* CONFIG_CPU_CORTEX_M7 */ @@ -563,15 +535,12 @@ static int flash_stm32h7_erase(const struct device *dev, off_t offset, return rc; } - -static int flash_stm32h7_write(const struct device *dev, off_t offset, - const void *data, size_t len) +static int flash_stm32h7_write(const struct device *dev, off_t offset, const void *data, size_t len) { int rc; if (!flash_stm32_valid_range(dev, offset, len, true)) { - LOG_ERR("Write range invalid. Offset: %ld, len: %zu", - (long) offset, len); + LOG_ERR("Write range invalid. Offset: %ld, len: %zu", (long)offset, len); return -EINVAL; } @@ -581,7 +550,7 @@ static int flash_stm32h7_write(const struct device *dev, off_t offset, flash_stm32_sem_take(dev); - LOG_DBG("Write offset: %ld, len: %zu", (long) offset, len); + LOG_DBG("Write offset: %ld, len: %zu", (long)offset, len); rc = flash_stm32h7_write_protection(dev, false); if (!rc) { @@ -599,13 +568,10 @@ static int flash_stm32h7_write(const struct device *dev, off_t offset, return rc; } -static int flash_stm32h7_read(const struct device *dev, off_t offset, - void *data, - size_t len) +static int flash_stm32h7_read(const struct device *dev, off_t offset, void *data, size_t len) { if (!flash_stm32_valid_range(dev, offset, len, false)) { - LOG_ERR("Read range invalid. Offset: %ld, len: %zu", - (long) offset, len); + LOG_ERR("Read range invalid. Offset: %ld, len: %zu", (long)offset, len); return -EINVAL; } @@ -613,7 +579,7 @@ static int flash_stm32h7_read(const struct device *dev, off_t offset, return 0; } - LOG_DBG("Read offset: %ld, len: %zu", (long) offset, len); + LOG_DBG("Read offset: %ld, len: %zu", (long)offset, len); /* During the read we mask bus errors and only allow NMI. * @@ -627,7 +593,7 @@ static int flash_stm32h7_read(const struct device *dev, off_t offset, barrier_dsync_fence_full(); barrier_isync_fence_full(); - memcpy(data, (uint8_t *) FLASH_STM32_BASE_ADDRESS + offset, len); + memcpy(data, (uint8_t *)FLASH_STM32_BASE_ADDRESS + offset, len); __set_FAULTMASK(0); SCB->CCR &= ~SCB_CCR_BFHFNMIGN_Msk; @@ -638,23 +604,19 @@ static int flash_stm32h7_read(const struct device *dev, off_t offset, return flash_stm32_check_status(dev); } - static const struct flash_parameters flash_stm32h7_parameters = { .write_block_size = FLASH_STM32_WRITE_BLOCK_SIZE, .erase_value = 0xff, }; -static const struct flash_parameters * -flash_stm32h7_get_parameters(const struct device *dev) +static const struct flash_parameters *flash_stm32h7_get_parameters(const struct device *dev) { ARG_UNUSED(dev); return &flash_stm32h7_parameters; } - -void flash_stm32_page_layout(const struct device *dev, - const struct flash_pages_layout **layout, +void flash_stm32_page_layout(const struct device *dev, const struct flash_pages_layout **layout, size_t *layout_size) { ARG_UNUSED(dev); @@ -672,8 +634,8 @@ void flash_stm32_page_layout(const struct device *dev, * between bank1/2 */ stm32h7_flash_layout[1].pages_count = 1; - stm32h7_flash_layout[1].pages_size = BANK2_OFFSET - - (SECTOR_PER_BANK * FLASH_SECTOR_SIZE); + stm32h7_flash_layout[1].pages_size = + BANK2_OFFSET - (SECTOR_PER_BANK * FLASH_SECTOR_SIZE); /* Bank2 */ stm32h7_flash_layout[2].pages_count = SECTOR_PER_BANK; stm32h7_flash_layout[2].pages_size = FLASH_SECTOR_SIZE; @@ -691,8 +653,7 @@ void flash_stm32_page_layout(const struct device *dev, static struct flash_pages_layout stm32h7_flash_layout[1]; if (stm32h7_flash_layout[0].pages_count == 0) { - stm32h7_flash_layout[0].pages_count = - REAL_FLASH_SIZE_KB / FLASH_SECTOR_SIZE; + stm32h7_flash_layout[0].pages_count = REAL_FLASH_SIZE_KB / FLASH_SECTOR_SIZE; stm32h7_flash_layout[0].pages_size = FLASH_SECTOR_SIZE; } *layout_size = ARRAY_SIZE(stm32h7_flash_layout); @@ -701,10 +662,9 @@ void flash_stm32_page_layout(const struct device *dev, } static struct flash_stm32_priv flash_data = { - .regs = (FLASH_TypeDef *) DT_INST_REG_ADDR(0), + .regs = (FLASH_TypeDef *)DT_INST_REG_ADDR(0), #if DT_NODE_HAS_PROP(DT_INST(0, st_stm32h7_flash_controller), clocks) - .pclken = { .bus = DT_INST_CLOCKS_CELL(0, bus), - .enr = DT_INST_CLOCKS_CELL(0, bits)}, + .pclken = {.bus = DT_INST_CLOCKS_CELL(0, bus), .enr = DT_INST_CLOCKS_CELL(0, bits)}, #endif }; @@ -738,8 +698,7 @@ static int stm32h7_flash_init(const struct device *dev) #endif flash_stm32_sem_init(dev); - LOG_DBG("Flash initialized. BS: %zu", - flash_stm32h7_parameters.write_block_size); + LOG_DBG("Flash initialized. BS: %zu", flash_stm32h7_parameters.write_block_size); #if ((CONFIG_FLASH_LOG_LEVEL >= LOG_LEVEL_DBG) && CONFIG_FLASH_PAGE_LAYOUT) const struct flash_pages_layout *layout; @@ -747,15 +706,13 @@ static int stm32h7_flash_init(const struct device *dev) flash_stm32_page_layout(dev, &layout, &layout_size); for (size_t i = 0; i < layout_size; i++) { - LOG_DBG("Block %zu: bs: %zu count: %zu", i, - layout[i].pages_size, layout[i].pages_count); + LOG_DBG("Block %zu: bs: %zu count: %zu", i, layout[i].pages_size, + layout[i].pages_count); } #endif return flash_stm32h7_write_protection(dev, false); } - -DEVICE_DT_INST_DEFINE(0, stm32h7_flash_init, NULL, - &flash_data, NULL, POST_KERNEL, - CONFIG_FLASH_INIT_PRIORITY, &flash_stm32h7_api); +DEVICE_DT_INST_DEFINE(0, stm32h7_flash_init, NULL, &flash_data, NULL, POST_KERNEL, + CONFIG_FLASH_INIT_PRIORITY, &flash_stm32h7_api); From ec7d0c8e6f24ff82551201048448e6f93ec3dd10 Mon Sep 17 00:00:00 2001 From: Philipp Steiner Date: Mon, 28 Oct 2024 14:32:30 +0100 Subject: [PATCH 2058/4482] doc: add missing Ethernet Support for Nucleo H563ZI & STM32H573I-DK I recently found out, that the Ethernet support for the boards Nucleo H563ZI and STM32H573I-DK is already available but it isn't mentioned in the "Supported Features" section. Signed-off-by: Philipp Steiner --- boards/st/nucleo_h563zi/doc/index.rst | 3 ++- boards/st/stm32h573i_dk/doc/index.rst | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/boards/st/nucleo_h563zi/doc/index.rst b/boards/st/nucleo_h563zi/doc/index.rst index 092a1aec678e5..c53d2f267cf36 100644 --- a/boards/st/nucleo_h563zi/doc/index.rst +++ b/boards/st/nucleo_h563zi/doc/index.rst @@ -174,7 +174,8 @@ The Zephyr nucleo_h563zi board configuration supports the following hardware fea +-----------+------------+-------------------------------------+ | USB | on-chip | USB full-speed host/device bus | +-----------+------------+-------------------------------------+ - +| ETHERNET | on-chip | ethernet | ++-----------+------------+-------------------------------------+ Other hardware features are not yet supported on this Zephyr port. diff --git a/boards/st/stm32h573i_dk/doc/index.rst b/boards/st/stm32h573i_dk/doc/index.rst index 9c04b4165b445..c5ae45a9a20d3 100644 --- a/boards/st/stm32h573i_dk/doc/index.rst +++ b/boards/st/stm32h573i_dk/doc/index.rst @@ -192,7 +192,8 @@ hardware features: +-----------+------------+-------------------------------------+ | RTC | on-chip | rtc | +-----------+------------+-------------------------------------+ - +| ETHERNET | on-chip | ethernet | ++-----------+------------+-------------------------------------+ Other hardware features are not yet supported on this Zephyr port. From cef75af6afdc800c74769e402acdf2881e4a5b9f Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 25 Oct 2024 11:05:12 +0100 Subject: [PATCH 2059/4482] doc: release: 4.0: Add MCUboot and other misc. updates Adds notes on MCUboot changes to this release and some other updates for boards/build system Signed-off-by: Jamie McCrae --- doc/releases/release-notes-4.0.rst | 56 ++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index c47b46e588ba0..16c1b595ac105 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -240,6 +240,8 @@ Boards & SoC Support * ``mps3/an547`` to ``mps3/corstone300/an547`` for secure and * ``mps3/an547/ns`` to ``mps3/corstone300/an547/ns`` for non-secure. + * Added Thingy53 forwarding of network core pins to network core for SPI peripheral (disabled + by default) including pin mappings. * Added support for the following shields: @@ -271,6 +273,10 @@ Build system and Infrastructure * Switched to using imgtool directly from the build system when signing images instead of calling ``west sign``. +* Added support for selecting MCUboot operating mode in sysbuild using ``SB_CONFIG_MCUBOOT_MODE``. + +* Added support for RAM-load MCUboot operating mode in build system, including sysbuild support. + Documentation ************* @@ -623,6 +629,56 @@ HALs MCUboot ******* + * Removed broken target config header feature. + * Removed ``image_index`` from ``boot_encrypt``. + * Renamed boot_enc_decrypt to boot_decrypt_key. + * Updated to use ``EXTRA_CONF_FILE`` instead of the deprecated ``OVERLAY_CONFIG`` argument. + * Updated ``boot_encrypt()`` to instead be ``boot_enc_encrypt()`` and ``boot_enc_decrypt()``. + * Updated ``boot_enc_valid`` to take slot instead of image index. + * Updated ``boot_enc_load()`` to take slot number instead of image. + * Updated logging to debug level in boot_serial. + * Updated Kconfig to allow disabling NRFX_WDT on nRF devices. + * Updated CMake ERROR statements into FATAL_ERROR. + * Added application version that is being booted output prior to booting it. + * Added sysbuild support to the hello-world sample. + * Added SIG_PURE TLV to bootutil. + * Added write block size checking to bootutil. + * Added check for unexpected flash sector size. + * Added SHA512 support to MCUboot code and support for calculating SHA512 hash in imgtool. + * Added fallback to USB DFU option. + * Added better mode selection checks to bootutil. + * Added bootuil protected TLV size to image size check. + * Added functionaliy to remove images with conflicting flags or where features are required + that are not supported. + * Added compressed image flags and TLVs to MCUboot, Kconfig options and support for generating + compressed LZMA2 images with ARM thumb filter to imgtool. + * Added image header verification before checking image. + * Added state to ``boot_is_header_valid()`` function. + * Added ``CONFIG_MCUBOOT_ENC_BUILTIN_KEY`` Kconfig option. + * Added non-bootable flag to imgtool. + * Added zephyr prefix to generated header path. + * Added optional img mgmt slot info feature. + * Added bootutil support for maximum image size details for additional images. + * Added support for automatically calculcating max sectors. + * Added missing ``boot_enc_init()`` function. + * Added support for keeping image encrypted in scratch area in bootutil. + * Fixed serial recovery for NXP IMX.RT, LPC55x and MCXNx platforms + * Fixed issue with public RSA signing in imgtool. + * Fixed issue with ``boot_serial_enter()`` being defined but not used warning. + * Fixed issue with ``main()`` in sample returning wrong type warning. + * Fixed issue with using pointers in bootutil. + * Fixed wrong usage of slot numbers in boot_serial. + * Fixed slot info for directXIP/RAM load in bootutil. + * Fixed bootutil issue with not zeroing AES and SHA-256 contexts with mbedTLS. + * Fixed boot_serial ``format`` and ``incompatible-pointer-types`` warnings. + * Fixed booltuil wrong definition of ``find_swap_count``. + * Fixed bootutil swap move max app size calculation. + * Fixed imgtool issue where getpub failed for ed25519 key. + * Fixed issue with sysbuild if something else is named mcuboot. + * Fixed RAM load chain load address. + * Fixed issue with properly retrieving image headers after interrupted swap-scratch in bootutil. + * The MCUboot version in this release is version ``2.1.0+0-dev``. + OSDP **** From 0bb5270f7b35758e738d1b6b5e83fbdb3bae541b Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Fri, 1 Nov 2024 16:19:26 +0000 Subject: [PATCH 2060/4482] drivers: can: sam: fix sys_write32() arguments order Fix the order of the arguments to sys_write32(). Fixes: #80750 Signed-off-by: Henrik Brix Andersen --- drivers/can/can_sam.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/can/can_sam.c b/drivers/can/can_sam.c index 23d9dd5089f65..e3fc6c1839333 100644 --- a/drivers/can/can_sam.c +++ b/drivers/can/can_sam.c @@ -106,7 +106,7 @@ static int can_sam_init(const struct device *dev) uint32_t mrba = sam_cfg->mram & 0xFFFF0000; /* keep lower 16bit; update DMA Base Register */ - sys_write32(sam_cfg->dma_base, (sys_read32(sam_cfg->dma_base) & 0x0000FFFF) | mrba); + sys_write32((sys_read32(sam_cfg->dma_base) & 0x0000FFFF) | mrba, sam_cfg->dma_base); ret = can_mcan_configure_mram(dev, mrba, sam_cfg->mram); if (ret != 0) { From 0cc8f93e8a41f0e05374b27ff89b1af321c437ce Mon Sep 17 00:00:00 2001 From: Gerson Fernando Budke Date: Thu, 31 Oct 2024 19:08:31 +0100 Subject: [PATCH 2061/4482] soc: atmel: Drop PINCTRL from Kconfig.defconfig This Kconfig has wrongly been added to defconfig files. It is not the right place for it. It has never been the right place for it. Drivers that need it should select the symbol in their Kconfig entries. Drop PINCTL from Kconfig.defconfig and add proper select at Kconfig.sam*. Fixes #78619 Signed-off-by: Gerson Fernando Budke --- drivers/adc/Kconfig.sam | 1 + drivers/adc/Kconfig.sam0 | 1 + drivers/adc/Kconfig.sam_afec | 1 + drivers/counter/Kconfig.sam | 1 + drivers/counter/Kconfig.sam0 | 1 + drivers/dac/Kconfig.sam | 1 + drivers/dac/Kconfig.sam0 | 1 + drivers/ethernet/Kconfig.sam_gmac | 1 + drivers/i2c/Kconfig | 2 ++ drivers/i2c/Kconfig.sam0 | 1 + drivers/i2c/Kconfig.sam_twihs | 1 + drivers/i2s/Kconfig.sam_ssc | 1 + drivers/memc/Kconfig.sam | 1 + drivers/pwm/Kconfig.sam | 1 + drivers/pwm/Kconfig.sam0 | 1 + drivers/sdhc/Kconfig.sam_hsmci | 1 + drivers/sensor/qdec_sam/Kconfig | 1 + drivers/serial/Kconfig.sam0 | 1 + drivers/serial/Kconfig.uart_sam | 1 + drivers/serial/Kconfig.usart_sam | 1 + drivers/spi/Kconfig.sam | 1 + drivers/spi/Kconfig.sam0 | 1 + drivers/timer/Kconfig.sam0_rtc | 1 + drivers/usb/device/Kconfig | 2 ++ soc/atmel/sam/Kconfig.defconfig | 3 --- soc/atmel/sam0/Kconfig.defconfig | 3 --- 26 files changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/adc/Kconfig.sam b/drivers/adc/Kconfig.sam index 20c1bd4249dfa..6eda9e6a55711 100644 --- a/drivers/adc/Kconfig.sam +++ b/drivers/adc/Kconfig.sam @@ -5,6 +5,7 @@ config ADC_SAM bool "Atmel SAM series ADC Driver" default y depends on DT_HAS_ATMEL_SAM_ADC_ENABLED + select PINCTRL select ADC_CONFIGURABLE_INPUTS help Enable Atmel SAM MCU Family Analog-to-Digital Converter (ADC) driver. diff --git a/drivers/adc/Kconfig.sam0 b/drivers/adc/Kconfig.sam0 index c161f35bbf8e3..7b17f885c4bdd 100644 --- a/drivers/adc/Kconfig.sam0 +++ b/drivers/adc/Kconfig.sam0 @@ -5,6 +5,7 @@ config ADC_SAM0 bool "Atmel SAM0 series ADC Driver" default y depends on DT_HAS_ATMEL_SAM0_ADC_ENABLED + select PINCTRL select ADC_CONFIGURABLE_INPUTS help Enable Atmel SAM0 MCU Family Analog-to-Digital Converter (ADC) driver. diff --git a/drivers/adc/Kconfig.sam_afec b/drivers/adc/Kconfig.sam_afec index 388b1298ad086..9c93e36fc2fc1 100644 --- a/drivers/adc/Kconfig.sam_afec +++ b/drivers/adc/Kconfig.sam_afec @@ -7,6 +7,7 @@ config ADC_SAM_AFEC bool "SAM ADC Driver" default y depends on DT_HAS_ATMEL_SAM_AFEC_ENABLED + select PINCTRL help Enable Atmel SAM MCU Family Analog-to-Digital Converter (ADC) driver based on AFEC module. diff --git a/drivers/counter/Kconfig.sam b/drivers/counter/Kconfig.sam index cb4e0aeb09163..5f253c86a7ce3 100644 --- a/drivers/counter/Kconfig.sam +++ b/drivers/counter/Kconfig.sam @@ -5,5 +5,6 @@ config COUNTER_SAM_TC bool "Atmel SAM MCU family counter (TC) driver" default y depends on DT_HAS_ATMEL_SAM_TC_ENABLED + select PINCTRL help Enable the Atmel SAM MCU family counter (TC) driver. diff --git a/drivers/counter/Kconfig.sam0 b/drivers/counter/Kconfig.sam0 index 7a42b3a7e5c8e..7ab2e51b7a325 100644 --- a/drivers/counter/Kconfig.sam0 +++ b/drivers/counter/Kconfig.sam0 @@ -5,6 +5,7 @@ config COUNTER_SAM0_TC32 bool "SAM0 series 32-bit basic timer driver" default y depends on DT_HAS_ATMEL_SAM0_TC32_ENABLED + select PINCTRL help Enable the SAM0 series timer counter (TC) driver in 32-bit wide mode. diff --git a/drivers/dac/Kconfig.sam b/drivers/dac/Kconfig.sam index e3328af8d15e8..b2451e3d9bdc0 100644 --- a/drivers/dac/Kconfig.sam +++ b/drivers/dac/Kconfig.sam @@ -6,5 +6,6 @@ config DAC_SAM bool "Atmel SAM DAC driver" default y depends on DT_HAS_ATMEL_SAM_DAC_ENABLED + select PINCTRL help Enable Atmel SAM MCU Family Digital Audio Converter (DAC) driver. diff --git a/drivers/dac/Kconfig.sam0 b/drivers/dac/Kconfig.sam0 index 1f018ab58219e..ac86ff2b9cf15 100644 --- a/drivers/dac/Kconfig.sam0 +++ b/drivers/dac/Kconfig.sam0 @@ -5,5 +5,6 @@ config DAC_SAM0 bool "Atmel SAM0 series DAC Driver" default y depends on DT_HAS_ATMEL_SAM0_DAC_ENABLED + select PINCTRL help Enables the Atmel SAM0 MCU Family Digital-to-Analog (DAC) driver. diff --git a/drivers/ethernet/Kconfig.sam_gmac b/drivers/ethernet/Kconfig.sam_gmac index 7037c313a00fb..aecb9488f25f8 100644 --- a/drivers/ethernet/Kconfig.sam_gmac +++ b/drivers/ethernet/Kconfig.sam_gmac @@ -12,6 +12,7 @@ menuconfig ETH_SAM_GMAC select NOCACHE_MEMORY if ARCH_HAS_NOCACHE_MEMORY_SUPPORT select MDIO select ETH_DSA_SUPPORT + select PINCTRL help Enable Atmel SAM MCU Family Ethernet driver. diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index 86e7165bf080c..ef43c9198dec4 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig @@ -177,6 +177,7 @@ config I2C_SAM_TWIM bool "Atmel SAM (TWIM) I2C driver" default y depends on DT_HAS_ATMEL_SAM_I2C_TWIM_ENABLED + select PINCTRL help Enable Atmel SAM MCU Family (TWIM) I2C bus driver. @@ -184,6 +185,7 @@ config I2C_SAM_TWI bool "Atmel SAM (TWI) I2C driver" default y depends on DT_HAS_ATMEL_SAM_I2C_TWI_ENABLED + select PINCTRL help Enable Atmel SAM MCU Family (TWI) I2C bus driver. diff --git a/drivers/i2c/Kconfig.sam0 b/drivers/i2c/Kconfig.sam0 index 0abad71360da0..c7c62e0d95489 100644 --- a/drivers/i2c/Kconfig.sam0 +++ b/drivers/i2c/Kconfig.sam0 @@ -5,6 +5,7 @@ menuconfig I2C_SAM0 bool "SAM0 series I2C SERCOM driver" default y depends on DT_HAS_ATMEL_SAM0_I2C_ENABLED + select PINCTRL help Enable the SAM0 series SERCOM I2C driver. diff --git a/drivers/i2c/Kconfig.sam_twihs b/drivers/i2c/Kconfig.sam_twihs index 5f1daa6f4c462..ebe7879313501 100644 --- a/drivers/i2c/Kconfig.sam_twihs +++ b/drivers/i2c/Kconfig.sam_twihs @@ -7,5 +7,6 @@ config I2C_SAM_TWIHS bool "Atmel SAM (TWIHS) I2C driver" default y depends on DT_HAS_ATMEL_SAM_I2C_TWIHS_ENABLED + select PINCTRL help Enable Atmel SAM MCU Family (TWIHS) I2C bus driver. diff --git a/drivers/i2s/Kconfig.sam_ssc b/drivers/i2s/Kconfig.sam_ssc index 4226ba58bfbff..212f8278f10d9 100644 --- a/drivers/i2s/Kconfig.sam_ssc +++ b/drivers/i2s/Kconfig.sam_ssc @@ -7,6 +7,7 @@ menuconfig I2S_SAM_SSC bool "Atmel SAM MCU family I2S (SSC) Bus Driver" default y depends on DT_HAS_ATMEL_SAM_SSC_ENABLED + select PINCTRL select DMA help Enable Inter Sound (I2S) bus driver for Atmel SAM MCU family based on diff --git a/drivers/memc/Kconfig.sam b/drivers/memc/Kconfig.sam index fef4f51040b4c..91707305dcd3d 100644 --- a/drivers/memc/Kconfig.sam +++ b/drivers/memc/Kconfig.sam @@ -5,5 +5,6 @@ config MEMC_SAM_SMC bool "Atmel Static Memory Controller (SMC)" default y depends on DT_HAS_ATMEL_SAM_SMC_ENABLED + select PINCTRL help Enable Atmel Static Memory Controller. diff --git a/drivers/pwm/Kconfig.sam b/drivers/pwm/Kconfig.sam index 839b6cb9de7f4..d34aa4924cc4b 100644 --- a/drivers/pwm/Kconfig.sam +++ b/drivers/pwm/Kconfig.sam @@ -7,5 +7,6 @@ config PWM_SAM bool "Atmel SAM MCU Family PWM Driver" default y depends on DT_HAS_ATMEL_SAM_PWM_ENABLED + select PINCTRL help Enable PWM driver for Atmel SAM MCUs. diff --git a/drivers/pwm/Kconfig.sam0 b/drivers/pwm/Kconfig.sam0 index bde4cf490217a..8354983b51fda 100644 --- a/drivers/pwm/Kconfig.sam0 +++ b/drivers/pwm/Kconfig.sam0 @@ -7,5 +7,6 @@ config PWM_SAM0_TCC bool "Atmel SAM0 MCU Family TCC PWM Driver" default y depends on DT_HAS_ATMEL_SAM0_TCC_PWM_ENABLED + select PINCTRL help Enable PWM driver for Atmel SAM0 MCUs using the TCC timer/counter. diff --git a/drivers/sdhc/Kconfig.sam_hsmci b/drivers/sdhc/Kconfig.sam_hsmci index fca9bafdaffeb..183e028cf4841 100644 --- a/drivers/sdhc/Kconfig.sam_hsmci +++ b/drivers/sdhc/Kconfig.sam_hsmci @@ -5,6 +5,7 @@ config SAM_HSMCI bool "ATMEL SAM HSMCI driver" default y depends on DT_HAS_ATMEL_SAM_HSMCI_ENABLED + select PINCTRL select SDHC_SUPPORTS_NATIVE_MODE help Enable the ATMEL SAM HSMCI MMC/SD card driver. diff --git a/drivers/sensor/qdec_sam/Kconfig b/drivers/sensor/qdec_sam/Kconfig index 45daf9e56a514..4bb73b5143f56 100644 --- a/drivers/sensor/qdec_sam/Kconfig +++ b/drivers/sensor/qdec_sam/Kconfig @@ -9,5 +9,6 @@ config QDEC_SAM default y depends on DT_HAS_ATMEL_SAM_TC_QDEC_ENABLED depends on SOC_FAMILY_ATMEL_SAM + select PINCTRL help Atmel SAM MCU family Quadrature Decoder (TC) driver. diff --git a/drivers/serial/Kconfig.sam0 b/drivers/serial/Kconfig.sam0 index eb6eaed670f83..244180d6b7a0d 100644 --- a/drivers/serial/Kconfig.sam0 +++ b/drivers/serial/Kconfig.sam0 @@ -7,6 +7,7 @@ config UART_SAM0 bool "Atmel SAM0 series SERCOM USART driver" default y depends on DT_HAS_ATMEL_SAM0_UART_ENABLED + select PINCTRL select SERIAL_HAS_DRIVER select SERIAL_SUPPORT_INTERRUPT select SERIAL_SUPPORT_ASYNC if DT_HAS_ATMEL_SAM0_DMAC_ENABLED diff --git a/drivers/serial/Kconfig.uart_sam b/drivers/serial/Kconfig.uart_sam index 03900d9894c28..347405af59b3d 100644 --- a/drivers/serial/Kconfig.uart_sam +++ b/drivers/serial/Kconfig.uart_sam @@ -8,6 +8,7 @@ config UART_SAM bool "Atmel SAM MCU family UART driver" default y depends on DT_HAS_ATMEL_SAM_UART_ENABLED + select PINCTRL select SERIAL_HAS_DRIVER select SERIAL_SUPPORT_INTERRUPT help diff --git a/drivers/serial/Kconfig.usart_sam b/drivers/serial/Kconfig.usart_sam index beea28e3abf5a..2ce6daa506f1c 100644 --- a/drivers/serial/Kconfig.usart_sam +++ b/drivers/serial/Kconfig.usart_sam @@ -7,6 +7,7 @@ config USART_SAM bool "Atmel SAM MCU family USART driver" default y depends on DT_HAS_ATMEL_SAM_USART_ENABLED + select PINCTRL select SERIAL_HAS_DRIVER select SERIAL_SUPPORT_INTERRUPT help diff --git a/drivers/spi/Kconfig.sam b/drivers/spi/Kconfig.sam index 78ff7c54265eb..90e8a6300abe7 100644 --- a/drivers/spi/Kconfig.sam +++ b/drivers/spi/Kconfig.sam @@ -8,6 +8,7 @@ config SPI_SAM bool "Atmel SAM series SPI driver" default y depends on DT_HAS_ATMEL_SAM_SPI_ENABLED + select PINCTRL select GPIO help Enable support for the SAM SPI driver. diff --git a/drivers/spi/Kconfig.sam0 b/drivers/spi/Kconfig.sam0 index 314938221e00e..819e5404e2ed2 100644 --- a/drivers/spi/Kconfig.sam0 +++ b/drivers/spi/Kconfig.sam0 @@ -7,6 +7,7 @@ config SPI_SAM0 bool "Atmel SAM0 series SERCOM SPI driver" default y depends on DT_HAS_ATMEL_SAM0_SPI_ENABLED + select PINCTRL select DMA if SPI_ASYNC help Enable support for the SAM0 SERCOM SPI driver. diff --git a/drivers/timer/Kconfig.sam0_rtc b/drivers/timer/Kconfig.sam0_rtc index d39e9ece84aff..14c4ee73939fd 100644 --- a/drivers/timer/Kconfig.sam0_rtc +++ b/drivers/timer/Kconfig.sam0_rtc @@ -7,6 +7,7 @@ config SAM0_RTC_TIMER bool "Atmel SAM0 series RTC timer" default y depends on DT_HAS_ATMEL_SAM0_RTC_ENABLED + select PINCTRL select TICKLESS_CAPABLE help This module implements a kernel device driver for the Atmel SAM0 diff --git a/drivers/usb/device/Kconfig b/drivers/usb/device/Kconfig index 5658e5247d20b..ab17819538191 100644 --- a/drivers/usb/device/Kconfig +++ b/drivers/usb/device/Kconfig @@ -71,6 +71,7 @@ config USB_DC_SAM0 bool "SAM0 series USB Device Controller driver" default y depends on DT_HAS_ATMEL_SAM0_USB_ENABLED + select PINCTRL help SAM0 family USB device controller Driver. @@ -88,6 +89,7 @@ config USB_DC_SAM_USBC bool "SAM4L USBC Device Controller driver" default y depends on DT_HAS_ATMEL_SAM_USBC_ENABLED + select PINCTRL help SAM4L family USBC device controller Driver. diff --git a/soc/atmel/sam/Kconfig.defconfig b/soc/atmel/sam/Kconfig.defconfig index 49ad614522376..caa6bf86b9060 100644 --- a/soc/atmel/sam/Kconfig.defconfig +++ b/soc/atmel/sam/Kconfig.defconfig @@ -14,9 +14,6 @@ config CLOCK_CONTROL config GPIO default y -config PINCTRL - default y - config SYS_CLOCK_HW_CYCLES_PER_SEC default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency) diff --git a/soc/atmel/sam0/Kconfig.defconfig b/soc/atmel/sam0/Kconfig.defconfig index 2980bbe87c49c..cc8094aa6f4fa 100644 --- a/soc/atmel/sam0/Kconfig.defconfig +++ b/soc/atmel/sam0/Kconfig.defconfig @@ -14,9 +14,6 @@ config GPIO config HWINFO_SAM0 default HWINFO -config PINCTRL - default y - config SYS_CLOCK_HW_CYCLES_PER_SEC default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency) From 5c9b0a5a33cab280ed29bb73e854a355fcd4194b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 1 Nov 2024 17:42:31 +0100 Subject: [PATCH 2062/4482] drivers: comparator: fix wrong @since tag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Comparator API was introduced in 4.0, not 3.7 Signed-off-by: Benjamin Cabé --- include/zephyr/drivers/comparator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/drivers/comparator.h b/include/zephyr/drivers/comparator.h index 3d246fea5ff15..1f4fc1db8c577 100644 --- a/include/zephyr/drivers/comparator.h +++ b/include/zephyr/drivers/comparator.h @@ -10,7 +10,7 @@ /** * @brief Comparator Interface * @defgroup comparator_interface Comparator Interface - * @since 3.7 + * @since 4.0 * @version 0.1.0 * @ingroup io_interfaces * @{ From 4bb945300bf92e4708404102d2a3b54e540bfd6c Mon Sep 17 00:00:00 2001 From: Lukasz Mrugala Date: Mon, 21 Oct 2024 14:01:44 +0000 Subject: [PATCH 2063/4482] scripts: twister: Python Version Guard Twister shall now verify that the user does not use an obsolete Python version. If user's Python is deemed too old, it will raise a relevant error. This check will also happen when running Twister via west. Signed-off-by: Lukasz Mrugala --- scripts/pylib/twister/twisterlib/environment.py | 11 +++++++++++ scripts/twister | 5 ++++- scripts/west_commands/twister_cmd.py | 3 ++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/environment.py b/scripts/pylib/twister/twisterlib/environment.py index c81b03355ce5e..2b330caf2ab33 100644 --- a/scripts/pylib/twister/twisterlib/environment.py +++ b/scripts/pylib/twister/twisterlib/environment.py @@ -51,6 +51,17 @@ def _get_installed_packages() -> Generator[str, None, None]: yield dist.metadata['Name'] +def python_version_guard(): + min_ver = (3, 10) + if sys.version_info < min_ver: + min_ver_str = '.'.join([str(v) for v in min_ver]) + cur_ver_line = f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}" + print(f"Unsupported Python version {cur_ver_line}.") + print(f"Currently, Twister requires at least Python {min_ver_str}.") + print("Install a newer Python version and retry.") + sys.exit(1) + + installed_packages: List[str] = list(_get_installed_packages()) PYTEST_PLUGIN_INSTALLED = 'pytest-twister-harness' in installed_packages diff --git a/scripts/twister b/scripts/twister index c6382f9a9e337..db692ceb1cdb8 100755 --- a/scripts/twister +++ b/scripts/twister @@ -203,12 +203,15 @@ if not ZEPHYR_BASE: sys.path.insert(0, os.path.join(ZEPHYR_BASE, "scripts/pylib/twister/")) sys.path.insert(0, os.path.join(ZEPHYR_BASE, "scripts/pylib/build_helpers")) -from twisterlib.environment import add_parse_arguments, parse_arguments +from twisterlib.environment import add_parse_arguments, parse_arguments, python_version_guard from twisterlib.twister_main import main + if __name__ == "__main__": ret = 0 try: + python_version_guard() + parser = add_parse_arguments() options = parse_arguments(parser, sys.argv[1:]) default_options = parse_arguments(parser, [], on_init=False) diff --git a/scripts/west_commands/twister_cmd.py b/scripts/west_commands/twister_cmd.py index 266b60d2bf2ec..d9616c4e614d8 100644 --- a/scripts/west_commands/twister_cmd.py +++ b/scripts/west_commands/twister_cmd.py @@ -18,7 +18,7 @@ sys.path.insert(0, str(twister_path)) sys.path.insert(0, str(twister_path / "pylib" / "twister")) -from twisterlib.environment import add_parse_arguments, parse_arguments +from twisterlib.environment import add_parse_arguments, parse_arguments, python_version_guard from twisterlib.twister_main import main TWISTER_DESCRIPTION = """\ @@ -37,6 +37,7 @@ def __init__(self): TWISTER_DESCRIPTION, accepts_unknown_args=True, ) + python_version_guard() def do_add_parser(self, parser_adder): parser = parser_adder.add_parser( From 5249619f6a19a3265852ae8a7ceba1b703be4c58 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 5 Nov 2024 12:53:36 +0100 Subject: [PATCH 2064/4482] soc: nordic: nrf54h: gpd: fix compile warning when CONFIG_DEBUG=y Usage of K_SPINLOCK with CONFIG_DEBUG=y seems to trigger a compiler warning about request not always being initialized. Fallback to k_spin_lock/unlock calls to fix this issue. Signed-off-by: Gerard Marull-Paretas --- soc/nordic/nrf54h/gpd/gpd.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/soc/nordic/nrf54h/gpd/gpd.c b/soc/nordic/nrf54h/gpd/gpd.c index ea439a5446034..d100c89353802 100644 --- a/soc/nordic/nrf54h/gpd/gpd.c +++ b/soc/nordic/nrf54h/gpd/gpd.c @@ -66,16 +66,19 @@ static int nrf_gpd_sync(struct gpd_onoff_manager *gpd_mgr) { int64_t start; nrfs_err_t err; + k_spinlock_key_t key; gdpwr_request_type_t request; - K_SPINLOCK(&gpd_mgr->mgr.lock) { - if (gpd_mgr->mgr.refs == 0) { - request = GDPWR_POWER_REQUEST_CLEAR; - } else { - request = GDPWR_POWER_REQUEST_SET; - } + key = k_spin_lock(&gpd_mgr->mgr.lock); + + if (gpd_mgr->mgr.refs == 0) { + request = GDPWR_POWER_REQUEST_CLEAR; + } else { + request = GDPWR_POWER_REQUEST_SET; } + k_spin_unlock(&gpd_mgr->mgr.lock, key); + atomic_clear_bit(&gpd_service_status, GPD_SERVICE_REQ_ERR); atomic_clear_bit(&gpd_service_status, GPD_SERVICE_REQ_OK); From 0a75809a8ec865c53556794f15c9c8e48b1a3c2f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 1 Nov 2024 10:24:01 +0200 Subject: [PATCH 2065/4482] net: wifi: mgmt: Check string length in sscanf Make sure we are not able to overwrite string variables in sscanf call. Allocate also one extra byte for null terminator character. Fixes #80644 Signed-off-by: Jukka Rissanen --- subsys/net/l2/wifi/wifi_mgmt.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 11adc826cf4d6..ac16e7d3a77ee 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -23,7 +23,7 @@ LOG_MODULE_REGISTER(net_wifi_mgmt, CONFIG_NET_L2_WIFI_MGMT_LOG_LEVEL); #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_ROAMING #define MAX_NEIGHBOR_AP_LIMIT 6U -#define MAX_EVENT_STR_LEN 32U +#define MAX_EVENT_STR_LEN 32 struct wifi_rrm_neighbor_ap_t { char ssid[WIFI_SSID_MAX_LEN + 1]; @@ -502,16 +502,21 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_NEIGHBOR_REP_COMPLETE, void wifi_mgmt_raise_neighbor_rep_recv_event(struct net_if *iface, char *inbuf, size_t buf_len) { const uint8_t *buf = inbuf; - char event[MAX_EVENT_STR_LEN] = {0}; - char bssid[WIFI_SSID_MAX_LEN] = {0}; - char bssid_info[WIFI_SSID_MAX_LEN] = {0}; + char event[MAX_EVENT_STR_LEN + 1] = {0}; + char bssid[WIFI_SSID_MAX_LEN + 1] = {0}; + char bssid_info[WIFI_SSID_MAX_LEN + 1] = {0}; int op_class, channel, phy_type; int idx = roaming_params.neighbor_rep.neighbor_cnt; if (!buf || buf[0] == '\0') { return; } - if (sscanf(buf, "%s bssid=%s info=%s op_class=%d chan=%d phy_type=%d", + + if (sscanf(buf, + "%" STRINGIFY(MAX_EVENT_STR_LEN) "s " + "bssid=%" STRINGIFY(WIFI_SSID_MAX_LEN) "s " + "info=%" STRINGIFY(WIFI_SSID_MAX_LEN) "s " + "op_class=%d chan=%d phy_type=%d", event, bssid, bssid_info, &op_class, &channel, &phy_type) == 6) { int i; int match = 0; From 3e1e2ea8ecd2ec73e7d31e0c41c3f11984e38a4f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 1 Nov 2024 22:01:11 +0200 Subject: [PATCH 2066/4482] net: wifi: mgmt: Use memcpy instead of strncpy Using strncpy gives this warning warning: 'strncpy' output may be truncated copying 32 bytes from a string of length 32 [-Wstringop-truncation] strncpy(roaming_params.neighbor_rep.neighbor_ap[idx].bssid_info, bssid_info, sizeof(roaming_params.neighbor_rep.neighbor_ap->bssid_info)); There is '\0' at the end of the allocated buffer so we can safely use memcpy() here to avoid any warnings. Signed-off-by: Jukka Rissanen --- subsys/net/l2/wifi/wifi_mgmt.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index ac16e7d3a77ee..3a1f611add1c3 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -535,14 +535,15 @@ void wifi_mgmt_raise_neighbor_rep_recv_event(struct net_if *iface, char *inbuf, } } if (!match && (roaming_params.neighbor_rep.neighbor_cnt < MAX_NEIGHBOR_AP_LIMIT)) { - strncpy((char *)roaming_params.neighbor_rep.neighbor_ap[idx].bssid, - bssid, sizeof(roaming_params.neighbor_rep.neighbor_ap[idx].bssid)); + memcpy((char *)roaming_params.neighbor_rep.neighbor_ap[idx].bssid, + bssid, + sizeof(roaming_params.neighbor_rep.neighbor_ap[idx].bssid)); len = strnlen(bssid, sizeof(bssid) - 1); roaming_params.neighbor_rep.neighbor_ap[idx].bssid[len] = (uint8_t)'\0'; - strncpy((char *)roaming_params.neighbor_rep.neighbor_ap[idx].bssid_info, - (bssid_info), - sizeof(roaming_params.neighbor_rep.neighbor_ap->bssid_info)); + memcpy((char *)roaming_params.neighbor_rep.neighbor_ap[idx].bssid_info, + bssid_info, + sizeof(roaming_params.neighbor_rep.neighbor_ap[idx].bssid_info)); len = strnlen(bssid_info, sizeof(bssid_info) - 1); roaming_params.neighbor_rep.neighbor_ap[idx].bssid_info[len] = (uint8_t)'\0'; From 6619d1566270f206ede6e45b5843a2208c1a339a Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Fri, 1 Nov 2024 10:53:55 +0100 Subject: [PATCH 2067/4482] doc: usb: update the USB device stack deprecation plans Deprecation has been postponed one version. Signed-off-by: Johann Fischer --- doc/connectivity/usb/device/usb_device.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/connectivity/usb/device/usb_device.rst b/doc/connectivity/usb/device/usb_device.rst index 30ee886ea8c3d..e0f5b9fc23932 100644 --- a/doc/connectivity/usb/device/usb_device.rst +++ b/doc/connectivity/usb/device/usb_device.rst @@ -27,9 +27,9 @@ over time. It provides the following functionalities: .. note:: It is planned to deprecate all APIs listed in :ref:`usb_api` and the - functions that depend on them between Zephyr v3.7.0 and v4.0.0, and remove - them in v4.2.0. The new USB device support, represented by the APIs in - :ref:`usb_device_next_api`, will become the default in Zephyr v4.0.0. + functions that depend on them between Zephyr v4.0.0 and v4.1.0, and remove + them in v4.3.0. The new USB device support, represented by the APIs in + :ref:`usb_device_next_api`, will become the default in Zephyr v4.1.0. Supported USB classes ********************* From 0c299e66a45f5228ed538ee400d0a9bcd984dee6 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Mon, 30 Sep 2024 12:53:20 +0200 Subject: [PATCH 2068/4482] drivers: udc_kinetis: reset control endpoint busy flags Reset control endpoint busy flags if configured and enabled, otherwise it could mark the wrong buffer as busy after endpoint disable/enable. Signed-off-by: Johann Fischer --- drivers/usb/udc/udc_kinetis.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/udc/udc_kinetis.c b/drivers/usb/udc/udc_kinetis.c index 5a93d4a8b3a59..c471fb15ebda6 100644 --- a/drivers/usb/udc/udc_kinetis.c +++ b/drivers/usb/udc/udc_kinetis.c @@ -882,6 +882,8 @@ static int usbfsotg_ep_enable(const struct device *dev, if (cfg->addr == USB_CONTROL_EP_OUT) { struct net_buf *buf; + priv->busy[0] = false; + priv->busy[1] = false; buf = udc_ctrl_alloc(dev, USB_CONTROL_EP_OUT, USBFSOTG_EP0_SIZE); usbfsotg_bd_set_ctrl(bd_even, buf->size, buf->data, false); priv->out_buf[0] = buf; From 973f914b90a2e204165e9e32cdf4a653acc00cd9 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Wed, 23 Oct 2024 11:23:23 +0200 Subject: [PATCH 2069/4482] drivers: udc_nrf: fix enqueue of control IN transfer with length 0 If the direction of the last setup packet is not to the device but to the host, then the transfer is not a status stage and should be queued. This is not checked and prevents a zero length control IN transfer to the host, e.g. used by the DFU class to indicate the end of the upload process. Signed-off-by: Johann Fischer --- drivers/usb/udc/udc_nrf.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/usb/udc/udc_nrf.c b/drivers/usb/udc/udc_nrf.c index c024d2a6a1847..2d1eb17d47231 100644 --- a/drivers/usb/udc/udc_nrf.c +++ b/drivers/usb/udc/udc_nrf.c @@ -487,7 +487,7 @@ static void udc_nrf_power_handler(nrfx_power_usb_evt_t pwr_evt) } } -static void udc_nrf_fake_status_in(const struct device *dev) +static bool udc_nrf_fake_status_in(const struct device *dev) { struct udc_nrf_evt evt = { .type = UDC_NRF_EVT_STATUS_IN, @@ -497,7 +497,10 @@ static void udc_nrf_fake_status_in(const struct device *dev) if (nrf_usbd_common_last_setup_dir_get() == USB_CONTROL_EP_OUT) { /* Let controller perform status IN stage */ k_msgq_put(&drv_msgq, &evt, K_NO_WAIT); + return true; } + + return false; } static int udc_nrf_ep_enqueue(const struct device *dev, @@ -512,8 +515,9 @@ static int udc_nrf_ep_enqueue(const struct device *dev, udc_buf_put(cfg, buf); if (cfg->addr == USB_CONTROL_EP_IN && buf->len == 0) { - udc_nrf_fake_status_in(dev); - return 0; + if (udc_nrf_fake_status_in(dev)) { + return 0; + } } k_msgq_put(&drv_msgq, &evt, K_NO_WAIT); From 580707ed4d29299d7c3b1bb306aca378634cfe8b Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 1 Nov 2024 21:49:25 +0530 Subject: [PATCH 2070/4482] drivers: nrfwifi: Fixes from doc review Help text fixes from doc-team. Signed-off-by: Richa Pandey Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/Kconfig.nrfwifi | 144 +++++++++++++-------------- 1 file changed, 68 insertions(+), 76 deletions(-) diff --git a/drivers/wifi/nrfwifi/Kconfig.nrfwifi b/drivers/wifi/nrfwifi/Kconfig.nrfwifi index 41bd04afc1238..6679e40e04882 100644 --- a/drivers/wifi/nrfwifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrfwifi/Kconfig.nrfwifi @@ -69,15 +69,14 @@ config NRF70_RADIO_TEST bool "Radio test mode of the nRF70 driver" config NRF70_OFFLOADED_RAW_TX - bool "Offloaded raw Tx mode of the nRF70 driver" + bool "Offloaded raw TX mode of the nRF70 driver" config NRF70_SYSTEM_WITH_RAW_MODES bool "nRF70 system mode with raw modes" depends on WIFI_NRF7002 || WIFI_NRF7001 select WIFI_NM_WPA_SUPPLICANT help - Select this option to enable system mode of the nRF70 driver with raw modes - + Select this option to enable system mode of the nRF70 driver with raw modes. endchoice config NRF70_SYSTEM_MODE_COMMON @@ -88,7 +87,7 @@ config NET_L2_ETHERNET default y if (!NRF70_RADIO_TEST && !NRF70_OFFLOADED_RAW_TX) config HEAP_MEM_POOL_ADD_SIZE_NRF70 - # Use a maximum that works for typical usecases and boards, each sample/app can override + # Use a maximum that works for typical use cases and boards, each sample/app can override # this value if needed by using CONFIG_HEAP_MEM_POOL_IGNORE_MIN def_int 25000 if NRF70_SCAN_ONLY def_int 150000 @@ -98,7 +97,7 @@ config NRF70_STA_MODE bool "nRF70 STA mode" default y help - Select this option to enable STA mode of the nRF70 driver + Select this option to enable STA mode of the nRF70 driver. config NRF70_AP_MODE bool "Access point mode" @@ -117,7 +116,7 @@ config NRF70_RAW_DATA_RX select EXPERIMENTAL config NRF70_PROMISC_DATA_RX - bool "promiscuous RX sniffer operation in the driver" + bool "Promiscuous RX sniffer operation in the driver" select WIFI_NM_WPA_SUPPLICANT select EXPERIMENTAL select NET_PROMISCUOUS_MODE @@ -154,7 +153,7 @@ config NRF_WIFI_PATCHES_EXTERNAL endchoice config NRF_WIFI_LOW_POWER - bool "low power mode in nRF Wi-Fi chipsets" + bool "Low power mode in nRF Wi-Fi chipsets" default y config NRF70_TCP_IP_CHECKSUM_OFFLOAD @@ -235,7 +234,7 @@ config NRF70_PCB_LOSS_2G range 0 4 help Specifies PCB loss from the antenna connector to the RF pin. - The values are in dB scale in steps of 1dB and range of 0-4dB. + The values are in dB scale in steps of 1 dB and range of 0-4 dB. The loss is considered in the RX path only. config NRF70_PCB_LOSS_5G_BAND1 @@ -244,7 +243,7 @@ config NRF70_PCB_LOSS_5G_BAND1 range 0 4 help Specifies PCB loss from the antenna connector to the RF pin. - The values are in dB scale in steps of 1dB and range of 0-4dB. + The values are in dB scale in steps of 1 dB and range of 0-4 dB. The loss is considered in the RX path only. config NRF70_PCB_LOSS_5G_BAND2 @@ -253,7 +252,7 @@ config NRF70_PCB_LOSS_5G_BAND2 range 0 4 help Specifies PCB loss from the antenna connector to the RF pin. - The values are in dB scale in steps of 1dB and range of 0-4dB. + The values are in dB scale in steps of 1 dB and range of 0-4 dB. The loss is considered in the RX path only. config NRF70_PCB_LOSS_5G_BAND3 @@ -262,7 +261,7 @@ config NRF70_PCB_LOSS_5G_BAND3 range 0 4 help Specifies PCB loss from the antenna connector to the RF pin. - The values are in dB scale in steps of 1dB and range of 0-4dB. + The values are in dB scale in steps of 1 dB and range of 0-4 dB. The loss is considered in the RX path only. config NRF70_ANT_GAIN_2G @@ -491,25 +490,23 @@ config NRF70_RPU_PS_IDLE_TIMEOUT_MS config NRF70_RPU_EXTEND_TWT_SP bool "extending TWT service period" help - In case frames accepted before beginning of SP are not - transmitted before the SP completes then typically they are - dropped to conform to SP window as per specification i.e., no + In case frames accepted before the beginning of SP are not + transmitted before the SP completes, then typically they are + dropped to conform to the SP window as per the specification that is, no transmission outside SP window. - - This feature mitigates the frame loss by transmitting even after SP - completion by using standard contention mechanism which is allowed + This feature mitigates frame loss by transmitting even after SP + completion by using a standard contention mechanism, which is allowed in specification but not recommended. As the device is actively transmitting beyond SP, the power consumption increases depending on the amount - of traffic available at the start of SP. - - Please note that if a frame is sent after SP starts it will be queued and this + of traffic available at the start of the SP. + Note that if a frame is sent after the SP starts, it will be queued, and this mechanism is not used. endif # NRF_WIFI_LOW_POWER config WIFI_FIXED_MAC_ADDRESS - string "WiFi Fixed MAC address in format XX:XX:XX:XX:XX:XX" + string "Wi-Fi Fixed MAC address in format XX:XX:XX:XX:XX:XX" help - This overrides the MAC address read from OTP. Strictly for testing purposes only. + This option overrides the MAC address read from OTP. It is strictly for testing purposes only. choice prompt "Wi-Fi MAC address type" @@ -529,7 +526,7 @@ config WIFI_FIXED_MAC_ADDRESS_ENABLED Enable fixed MAC address config WIFI_RANDOM_MAC_ADDRESS - bool "random MAC address generation at runtime" + bool "Random MAC address generation at runtime" depends on ENTROPY_GENERATOR help This option enables random MAC address generation at runtime. @@ -541,17 +538,17 @@ config NRF70_RSSI_STALE_TIMEOUT_MS int "RSSI stale timeout in milliseconds" default 1000 help - RSSI stale timeout is the period after which driver queries - RPU to get the RSSI the value. - If data is active (e.g. ping), driver stores the RSSI value from + RSSI stale timeout is the period after which the driver queries + RPU to get the RSSI value. + If data is active (for example, ping), the driver stores the RSSI value from the received frames and provides this stored information - to wpa_supplicant. In this case a higher value will be suitable - as stored RSSI value at driver will be updated regularly. + to wpa_supplicant. In this case, a higher value will be suitable + as the stored RSSI value at the driver will be updated regularly. If data is not active or after the stale timeout duration, - driver queries the RPU to get the RSSI value - and provides it to wpa_supplicant. The value should be set to lower - value as driver does not store it and requires RPU to provide the - info. + the driver queries the RPU to get the RSSI value + and provides it to wpa_supplicant. The value should be set to a lower + value as the driver does not store it and requires RPU to provide the + information. if NETWORKING # Finetune defaults for certain system components used by the driver @@ -575,7 +572,7 @@ config MAIN_STACK_SIZE config SHELL_STACK_SIZE default 4096 -# Override the Wi-Fi subsytems WIFI_MGMT_SCAN_SSID_FILT_MAX parameter, +# Override the Wi-Fi subsystems WIFI_MGMT_SCAN_SSID_FILT_MAX parameter, # since we support a maximum of 2 SSIDs for scan result filtering. config WIFI_MGMT_SCAN_SSID_FILT_MAX default 2 @@ -588,7 +585,7 @@ config NRF_WIFI_SCAN_MAX_BSS_CNT Maximum number of scan results to return. 0 represents unlimited number of BSSes. config NRF_WIFI_BEAMFORMING - bool "Wi-Fi beamforming. Enabling beamforming can provide slight improvement in performance where as disabling it can provide better power saving in low network activity applications" + bool "Wi-Fi beamforming. Enabling beamforming can provide a slight improvement in performance, whereas disabling it can provide better power savings in low network activity applications" default y config WIFI_NRF70_SCAN_TIMEOUT_S @@ -625,19 +622,18 @@ config NRF_WIFI_IFACE_MTU default 1500 config WIFI_NRF70_SKIP_LOCAL_ADMIN_MAC - bool "Suppress networks with non-individual MAC address as BSSID in the scan results" + bool "Suppress networks with non-individual MAC addresses as BSSID in the scan results" help - Wi-Fi access points use locally administered MAC address to manage - multiple virtual interfaces, for geo-location usecase these networks - from the virtual interfaces do not help in anyway as they are co-located with the primary interface - that has globally unique MAC address. - + Wi-Fi access points use locally administered MAC addresses to manage + multiple virtual interfaces. For geo-location use cases, these networks + from the virtual interfaces do not help in any way as they are co-located with the primary interface + that has a globally unique MAC address. So, to save resources, this option drops such networks from the scan results. config WIFI_NRF70_SCAN_DISABLE_DFS_CHANNELS bool "Disables DFS channels in scan operation" help - This option disables inclusion of DFS channels in scan operation. + This option disables inclusion of the DFS channels in the scan operation. This is useful to reduce the scan time, as DFS channels are seldom used. config NET_INTERFACE_NAME_LEN @@ -649,29 +645,28 @@ config NRF_WIFI_AP_DEAD_DETECT_TIMEOUT range 1 30 default 20 help - The number of seconds after which AP is declared dead if no beacons - are received from the AP. Used to detect AP silently going down e.g., power off. + The number of seconds after which the AP is declared dead if no beacons + are received from the AP. This is used to detect AP silently going down, for example, due to power off. config NRF_WIFI_RPU_RECOVERY bool "RPU recovery mechanism" depends on NRF_WIFI_LOW_POWER select EXPERIMENTAL help - Enable RPU recovery mechanism to recover from RPU (nRF70) hang. - This feature performs an interface reset (down and up) which triggers - a RPU coldboot. Application's network connection will be lost during - the recovery process and it is application's responsibility to + Enable the RPU recovery mechanism to recover from an RPU (nRF70) hang. + This feature performs an interface reset (down and up), which triggers + a RPU cold boot. The application's network connection will be lost during + the recovery process, and it is the application's responsibility to re-establish the network connection. if NRF_WIFI_RPU_RECOVERY - config NRF_WIFI_RPU_RECOVERY_PROPAGATION_DELAY_MS int "RPU recovery propagation delay in milliseconds" default 2000 help Propagation delay in milliseconds to wait after RPU is powered down before powering it up. This delay is required to ensure that the recovery - is propagted to all the applications and stack and have enough time to + is propagated to all the applications and stack and have enough time to clean up the resources. config NET_MGMT_EVENT_QUEUE_SIZE @@ -682,16 +677,16 @@ config NRF_WIFI_RPU_RECOVERY_PROPAGATION_DELAY_MS int "RPU recovery propagation delay in milliseconds" default 10 help - Propagation delay in milliseconds to wait after RPU is powered down + Propagation delay in milliseconds to wait after the RPU is powered down before powering it up. This delay is required to ensure that the recovery - is propagated to all the applications and stack and have enough time to + is propagated to all the applications and stack, and has enough time to clean up the resources. config NRF_WIFI_RPU_RECOVERY_PS_ACTIVE_TIMEOUT_MS int "RPU recovery power save active timeout in milliseconds" default 50000 help - Power save active timeout in milliseconds after which RPU recovery + Power save active timeout in milliseconds, after which the RPU recovery mechanism will be triggered. This timeout is used to ensure that the RPU attempts to enter power save mode in case of inactivity. @@ -706,7 +701,7 @@ config NRF_WIFI_RPU_MIN_TIME_TO_ENTER_SLEEP_MS config NRF_WIFI_RPU_RECOVERY_DEBUG bool "RPU recovery debug logs" help - Enable RPU recovery debug logs to help debug RPU recovery mechanism. + Enable RPU recovery debug logs to help debug the RPU recovery mechanism. config NRF_WIFI_RPU_RECOVERY_QUIET_PERIOD_MS int "RPU recovery quiet period in milliseconds" @@ -720,7 +715,7 @@ config NRF_WIFI_RPU_RECOVERY_MAX_RETRIES default 0 help Maximum number of consecutive RPU recovery retries before giving up - and resetting the system. Set to 0 to keep retrying indefinitely. + and resetting the system. Set it to 0 to keep retrying indefinitely. config NRF_WIFI_RPU_RECOVERY_RETRY_WINDOW_S int "RPU recovery retry window in seconds" @@ -734,16 +729,14 @@ config NRF_WIFI_RPU_RECOVERY_RETRY_WINDOW_S config NRF_WIFI_RPU_RECOVERY_PS_STATE_DEBUG bool "RPU recovery power save state debug logs" help - Enable RPU recovery power save state debug logs to help debug RPU recovery mechanism. - - + Enable RPU recovery power save state debug logs to help debug the RPU recovery mechanism. endif # NRF_WIFI_RPU_RECOVERY config NRF_WIFI_FEAT_WMM bool "WMM/QoS support" default y help - This option controls disable/enable of the WMM(Wireless Multi-Media) feature. + This option controls disable/enable of the WMM (Wireless Multi-Media) feature. choice NRF_WIFI_PS_DATA_RETRIEVAL_MECHANISM prompt "Power save data retrieval mechanism" @@ -752,37 +745,36 @@ choice NRF_WIFI_PS_DATA_RETRIEVAL_MECHANISM Select the mechanism to retrieve buffered data from AP. config NRF_WIFI_PS_POLL_BASED_RETRIEVAL - bool "PS-Poll frame based mechanism to retrieve buffered data from AP" + bool "PS-Poll frame-based mechanism to retrieve buffered data from AP" help - When AP notifies about availability of buffered data, the STA stays in power save - and retrieves the frames one-by-one, this conserved more power but adds latency - to the traffic. Ideal for minimum number of frames. + When the AP notifies about the availability of buffered data, the STA stays in power save + and retrieves the frames one-by-one. This conserves more power but adds latency + to the traffic. It is ideal for minimum number of frames. config NRF_WIFI_QOS_NULL_BASED_RETRIEVAL - bool "QoS null frame based mechanism to retrieve buffered data from AP" + bool "QoS null frame-based mechanism to retrieve buffered data from AP" help - When AP notifies about availability of buffered data, the STA comes out of - power save and then AP can deliver all buffered frames without any additional + When the AP notifies about the availability of buffered data, the STA comes out of + power save, and then AP can deliver all buffered frames without any additional overhead or latency, but STA enters power save after a delay costing more power - depending on the delay. Ideal for heavy buffered traffic. - + depending on the delay. It is ideal for heavy buffered traffic. endchoice config NRF_WIFI_MGMT_BUFF_OFFLOAD - bool "management buffer offload" + bool "Management buffer offload" default y help - This option offloads the refilling of management buffers to UMAC, saves host - having to exchange commands and events for every management packet even if it is + This option offloads the refilling of management buffers to the UMAC, saving the host + from having to exchange commands and events for every management packet even if it is consumed by UMAC. config NRF_WIFI_FEAT_KEEPALIVE bool "Wi-Fi keepalive feature for connection maintenance" depends on NRF70_STA_MODE help - Enable Wi-Fi keepalive feature to keep the connection alive by sending - keepalive packets to the AP. Primarily intended to interoperate with APs - that disconnect idle clients without any explicit checks. Slightly increases + Enable the Wi-Fi keepalive feature to keep the connection alive by sending + keepalive packets to the AP. This feature is primarily intended to interoperate with APs + that disconnect idle clients without any explicit checks. It slightly increases power consumption. if NRF_WIFI_FEAT_KEEPALIVE @@ -809,9 +801,9 @@ config NRF_WIFI_PS_EXIT_EVERY_TIM config NRF_WIFI_PS_INT_PS bool "Exit power save based on an intelligent algorithm" help - Exit power save based on an intelligent algorithm to retrieve buffered data from AP. + Exit power save based on an intelligent algorithm to retrieve buffered data from the AP. The algorithm tracks the buffered data at the AP and then dynamically decides - whether to stay in PS (for lower amount of buffered data) or exit PS (for higher + whether to stay in PS (for a lower amount of buffered data) or exit PS (for a higher amount of buffered data). endchoice @@ -820,5 +812,5 @@ config NRF70_PASSIVE_SCAN_ONLY depends on NRF70_SCAN_ONLY help Enable this configuration to force passive scan on all channels. - This will override application specified scan type. + This will override application-specified scan type. endif # WIFI_NRF70 From 2995eb79f1f2d7246d27a2b54d690b0e6acd75c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 1 Nov 2024 16:35:05 +0100 Subject: [PATCH 2071/4482] doc: fix scrolling glitch causing search bar to be partially hidden MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the recent update to Sphinx RTD theme 3.0.0, a 19px-high element that used to display the version number is not visible anymore, so the JS code that hides the upper-left logo when scrolling down needs to be adjusted to account for this change. Signed-off-by: Benjamin Cabé --- doc/_static/js/custom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/_static/js/custom.js b/doc/_static/js/custom.js index 52f254b38c786..049d327c809a4 100644 --- a/doc/_static/js/custom.js +++ b/doc/_static/js/custom.js @@ -16,7 +16,7 @@ const registerOnScrollEvent = (function(){ // Configuration. // The number of pixels the user must scroll by before the logo is completely hidden. - const scrollTopPixels = 156; + const scrollTopPixels = 137; // The target margin to be applied to the navigation bar when the logo is hidden. const menuTopMargin = 54; // The max-height offset when the logo is completely visible. From f2ea8506aea3462b9f0a5d7b41e599ec209dc080 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Fri, 1 Nov 2024 15:22:23 +0100 Subject: [PATCH 2072/4482] cmake: use CMake variable KERNEL_VERSION_CUSTOMIZATION for default value Fixes: #80193 With #62395 the Zephyr kernel and app version customization values were moved to target properties to allow Zephyr modules to adjust the values. This had the consequence described by #80193 that version customization using CMake arguments, `-D`, or CMakeList.txt toplevel file can no longer be used for customizing the version. To support both CMake variable as well as Zephyr module version customization use-cases then this commit uses `zephyr_get()` to fetch any CMake variable adjustments and uses the value for default property setting. This allows users to set customized version while still allow Zephyr modules to overrule this as intended with #62395. Signed-off-by: Torsten Rasmussen --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ce4b5ff1e9e9..88b2d77c3a4d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -598,6 +598,8 @@ add_custom_command( COMMAND_EXPAND_LISTS ) add_custom_target(version_h DEPENDS ${PROJECT_BINARY_DIR}/include/generated/zephyr/version.h) +zephyr_get(KERNEL_VERSION_CUSTOMIZATION SYSBUILD LOCAL) +set_property(TARGET version_h PROPERTY KERNEL_VERSION_CUSTOMIZATION ${KERNEL_VERSION_CUSTOMIZATION}) if(EXISTS ${APPLICATION_SOURCE_DIR}/VERSION) add_custom_command( @@ -616,6 +618,8 @@ if(EXISTS ${APPLICATION_SOURCE_DIR}/VERSION) app_version_h DEPENDS ${PROJECT_BINARY_DIR}/include/generated/zephyr/app_version.h) add_dependencies(zephyr_interface app_version_h) + zephyr_get(APP_VERSION_CUSTOMIZATION SYSBUILD LOCAL) + set_property(TARGET app_version_h PROPERTY APP_VERSION_CUSTOMIZATION ${APP_VERSION_CUSTOMIZATION}) endif() # Unfortunately, the order in which CMakeLists.txt code is processed From 6bb0c092b5daaf49216b17ad7199ada0d33c4bfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 4 Nov 2024 14:37:12 +0100 Subject: [PATCH 2073/4482] doc: comparator: fix nested bullet list formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit add missing newline for sub-list to render correctly Signed-off-by: Benjamin Cabé --- doc/hardware/peripherals/comparator.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/hardware/peripherals/comparator.rst b/doc/hardware/peripherals/comparator.rst index e0e6340766171..cd7ad43a9f3d0 100644 --- a/doc/hardware/peripherals/comparator.rst +++ b/doc/hardware/peripherals/comparator.rst @@ -43,6 +43,7 @@ The ``comp`` shell command provides the following subcommands: * ``get_output`` See :c:func:`comparator_get_output` * ``set_trigger`` See :c:func:`comparator_set_trigger` * ``await_trigger`` Awaits trigger using the following flow: + * Set trigger callback using :c:func:`comparator_set_trigger_callback` * Await callback or time out after default or optionally provided timeout * Clear trigger callback using :c:func:`comparator_set_trigger_callback` From 4690689a36d4c9e7fa70c91a6386caa8bd99c00e Mon Sep 17 00:00:00 2001 From: Kevin ORourke Date: Fri, 11 Oct 2024 08:26:20 +0200 Subject: [PATCH 2074/4482] drivers: ethernet: eth_stm32_hal: fix bus error after disconnect In some circumstances the struct eth_stm32_tx_context object that was allocated on eth_tx's stack is still referenced after the function exits. This usually happens when the network is disconnected, depending on the PHY hardware. When the network is reconnected there will eventually be a call to HAL_ETH_ReleaseTxPacket, which calls HAL_ETH_TxFreeCallback with the (now invalid) pointer to the tx context. When HAL_ETH_TxFreeCallback tries to dereference that pointer we get a bus error. Fix this by allocating struct eth_stm32_tx_context objects from a static array, similarly to how the buffers are allocated. This ensures that they remain valid until the HAL is finished with them. Fixes: #79037 Signed-off-by: Kevin ORourke --- drivers/ethernet/eth_stm32_hal.c | 46 +++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/drivers/ethernet/eth_stm32_hal.c b/drivers/ethernet/eth_stm32_hal.c index 59adaad032c30..d2c76261498d9 100644 --- a/drivers/ethernet/eth_stm32_hal.c +++ b/drivers/ethernet/eth_stm32_hal.c @@ -122,10 +122,12 @@ struct eth_stm32_tx_buffer_header { struct eth_stm32_tx_context { struct net_pkt *pkt; uint16_t first_tx_buffer_index; + bool used; }; static struct eth_stm32_rx_buffer_header dma_rx_buffer_header[ETH_RX_DESC_CNT]; static struct eth_stm32_tx_buffer_header dma_tx_buffer_header[ETH_TX_DESC_CNT]; +static struct eth_stm32_tx_context dma_tx_context[ETH_TX_DESC_CNT]; void HAL_ETH_RxAllocateCallback(uint8_t **buf) { @@ -188,6 +190,7 @@ void HAL_ETH_TxFreeCallback(uint32_t *buff) buffer_header = NULL; } } + ctx->used = false; } /* allocate a tx buffer and mark it as used */ @@ -203,6 +206,22 @@ static inline uint16_t allocate_tx_buffer(void) k_yield(); } } + +/* allocate a tx context and mark it as used, the first tx buffer is also allocated */ +static inline struct eth_stm32_tx_context *allocate_tx_context(struct net_pkt *pkt) +{ + for (;;) { + for (uint16_t index = 0; index < ETH_TX_DESC_CNT; index++) { + if (!dma_tx_context[index].used) { + dma_tx_context[index].used = true; + dma_tx_context[index].pkt = pkt; + dma_tx_context[index].first_tx_buffer_index = allocate_tx_buffer(); + return &dma_tx_context[index]; + } + } + k_yield(); + } +} #endif /* CONFIG_ETH_STM32_HAL_API_V2 */ #if defined(CONFIG_ETH_STM32_HAL_API_V2) @@ -304,7 +323,7 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt) size_t total_len; #if defined(CONFIG_ETH_STM32_HAL_API_V2) size_t remaining_read; - struct eth_stm32_tx_context ctx = {.pkt = pkt, .first_tx_buffer_index = 0}; + struct eth_stm32_tx_context *ctx = NULL; struct eth_stm32_tx_buffer_header *buf_header = NULL; #else uint8_t *dma_buffer; @@ -331,8 +350,8 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt) k_mutex_lock(&dev_data->tx_mutex, K_FOREVER); #if defined(CONFIG_ETH_STM32_HAL_API_V2) - ctx.first_tx_buffer_index = allocate_tx_buffer(); - buf_header = &dma_tx_buffer_header[ctx.first_tx_buffer_index]; + ctx = allocate_tx_context(pkt); + buf_header = &dma_tx_buffer_header[ctx->first_tx_buffer_index]; #else dma_tx_desc = heth->TxDesc; while (IS_ETH_DMATXDESC_OWN(dma_tx_desc) != (uint32_t)RESET) { @@ -388,8 +407,8 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt) #if defined(CONFIG_ETH_STM32_HAL_API_V2) tx_config.Length = total_len; - tx_config.pData = &ctx; - tx_config.TxBuffer = &dma_tx_buffer_header[ctx.first_tx_buffer_index].tx_buff; + tx_config.pData = ctx; + tx_config.TxBuffer = &dma_tx_buffer_header[ctx->first_tx_buffer_index].tx_buff; /* Reset TX complete interrupt semaphore before TX request*/ k_sem_reset(&dev_data->tx_int_sem); @@ -405,6 +424,9 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt) goto error; } + /* the tx context is now owned by the HAL */ + ctx = NULL; + /* Wait for end of TX buffer transmission */ /* If the semaphore timeout breaks, it means */ /* an error occurred or IT was not fired */ @@ -500,14 +522,14 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt) error: #if defined(CONFIG_ETH_STM32_HAL_API_V2) - /* free package tx buffer */ - if (res != 0) { - HAL_ETH_TxFreeCallback((uint32_t *)&ctx); - } else if (HAL_ETH_ReleaseTxPacket(heth) != HAL_OK) { - LOG_ERR("HAL_ETH_ReleaseTxPacket failed"); - res = -EIO; + if (!ctx) { + /* The HAL owns the tx context */ + HAL_ETH_ReleaseTxPacket(heth); + } else { + /* We need to release the tx context and its buffers */ + HAL_ETH_TxFreeCallback((uint32_t *)ctx); } -#endif +#endif /* CONFIG_ETH_STM32_HAL_API_V2 */ k_mutex_unlock(&dev_data->tx_mutex); From 0a68d492e2d907bf35bde832bdc2e741fb2ac53d Mon Sep 17 00:00:00 2001 From: Duy Nguyen Date: Thu, 10 Oct 2024 20:19:20 +0700 Subject: [PATCH 2075/4482] dts: renesas: Separate pll p q r into child node The new update of clock device tree make the pll p q r clock source cannot be choose by other node This fix add 1 new dts binding for pll out p q r out line Signed-off-by: Duy Nguyen --- boards/renesas/ek_ra8d1/ek_ra8d1.dts | 23 ++++--- boards/renesas/ek_ra8m1/ek_ra8m1.dts | 23 ++++--- boards/renesas/mck_ra8t1/mck_ra8t1.dts | 22 ++++--- .../clock_control_renesas_ra_cgc.c | 4 +- dts/arm/renesas/ra/ra8/r7fa8d1xh.dtsi | 62 ++++++++++++++---- dts/arm/renesas/ra/ra8/r7fa8m1xh.dtsi | 62 ++++++++++++++---- dts/arm/renesas/ra/ra8/r7fa8t1xh.dtsi | 65 ++++++++++++++----- .../clock/renesas,ra-cgc-pll-out.yaml | 19 ++++++ dts/bindings/clock/renesas,ra-cgc-pll.yaml | 12 ---- .../drivers/clock_control/renesas_ra_cgc.h | 15 ++++- 10 files changed, 220 insertions(+), 87 deletions(-) create mode 100644 dts/bindings/clock/renesas,ra-cgc-pll-out.yaml diff --git a/boards/renesas/ek_ra8d1/ek_ra8d1.dts b/boards/renesas/ek_ra8d1/ek_ra8d1.dts index 4e82e5efa0262..6f189fe7d1138 100644 --- a/boards/renesas/ek_ra8d1/ek_ra8d1.dts +++ b/boards/renesas/ek_ra8d1/ek_ra8d1.dts @@ -57,20 +57,23 @@ }; &pll { - clocks = <&xtal>; - div = <2>; - mul = <96 0>; - divp = <2>; - freqp = ; - divq = <2>; - freqq = ; - divr = <2>; - freqr = ; status = "okay"; + pllp { + status = "okay"; + }; + + pllq { + status = "okay"; + }; + + pllr { + status = "okay"; + }; }; + &sciclk { - clocks = <&pll>; + clocks = <&pllp>; div = <4>; status = "okay"; }; diff --git a/boards/renesas/ek_ra8m1/ek_ra8m1.dts b/boards/renesas/ek_ra8m1/ek_ra8m1.dts index 8bbeec4ed40e1..fbfbe483b4b45 100644 --- a/boards/renesas/ek_ra8m1/ek_ra8m1.dts +++ b/boards/renesas/ek_ra8m1/ek_ra8m1.dts @@ -87,20 +87,23 @@ }; &pll { - clocks = <&xtal>; - div = <2>; - mul = <96 0>; - divp = <2>; - freqp = ; - divq = <2>; - freqq = ; - divr = <2>; - freqr = ; status = "okay"; + pllp { + status = "okay"; + }; + + pllq { + status = "okay"; + }; + + pllr { + status = "okay"; + }; }; + &sciclk { - clocks = <&pll>; + clocks = <&pllp>; div = <4>; status = "okay"; }; diff --git a/boards/renesas/mck_ra8t1/mck_ra8t1.dts b/boards/renesas/mck_ra8t1/mck_ra8t1.dts index 1f275fcbff24c..1866767f6748c 100644 --- a/boards/renesas/mck_ra8t1/mck_ra8t1.dts +++ b/boards/renesas/mck_ra8t1/mck_ra8t1.dts @@ -61,20 +61,22 @@ }; &pll { - clocks = <&xtal>; - div = <2>; - mul = <80 0>; - divp = <2>; - freqp = ; - divq = <2>; - freqq = ; - divr = <2>; - freqr = ; status = "okay"; + pllp { + status = "okay"; + }; + + pllq { + status = "okay"; + }; + + pllr { + status = "okay"; + }; }; &sciclk { - clocks = <&pll>; + clocks = <&pllp>; div = <4>; status = "okay"; }; diff --git a/drivers/clock_control/clock_control_renesas_ra_cgc.c b/drivers/clock_control/clock_control_renesas_ra_cgc.c index 79da94a6d278c..4ed4bb30daaa2 100644 --- a/drivers/clock_control/clock_control_renesas_ra_cgc.c +++ b/drivers/clock_control/clock_control_renesas_ra_cgc.c @@ -58,7 +58,7 @@ static int clock_control_renesas_ra_get_rate(const struct device *dev, clock_con } clk_src_rate = R_BSP_SourceClockHzGet(config->clk_src); - clk_div_val = R_FSP_ClockDividerGet(config->clk_div); + clk_div_val = config->clk_div; *rate = clk_src_rate / clk_div_val; return 0; } @@ -94,7 +94,7 @@ static const struct clock_control_driver_api clock_control_reneas_ra_api = { DT_NODE_HAS_PROP(node_id, clocks), \ (RA_CGC_CLK_SRC(DT_CLOCKS_CTLR(node_id))), \ (RA_CGC_CLK_SRC(DT_CLOCKS_CTLR(DT_PARENT(node_id))))), \ - .clk_div = RA_CGC_CLK_DIV(node_id, div, 1)}; \ + .clk_div = DT_PROP(node_id, div)}; \ DEVICE_DT_DEFINE(node_id, &clock_control_ra_init_pclk, NULL, NULL, \ &node_id##_cfg, PRE_KERNEL_1, \ CONFIG_KERNEL_INIT_PRIORITY_OBJECTS, \ diff --git a/dts/arm/renesas/ra/ra8/r7fa8d1xh.dtsi b/dts/arm/renesas/ra/ra8/r7fa8d1xh.dtsi index 3db4898ccb2f7..cd2b62c0924a7 100644 --- a/dts/arm/renesas/ra/ra8/r7fa8d1xh.dtsi +++ b/dts/arm/renesas/ra/ra8/r7fa8d1xh.dtsi @@ -52,12 +52,30 @@ clocks = <&xtal>; div = <2>; mul = <96 0>; - divp = <2>; - freqp = ; - divq = <2>; - freqq = ; - divr = <2>; - freqr = ; + + pllp: pllp { + compatible = "renesas,ra-cgc-pll-out"; + div = <2>; + freq = ; + status = "disabled"; + #clock-cells = <0>; + }; + + pllq: pllq { + compatible = "renesas,ra-cgc-pll-out"; + div = <2>; + freq = ; + status = "disabled"; + #clock-cells = <0>; + }; + + pllr: pllr { + compatible = "renesas,ra-cgc-pll-out"; + div = <2>; + freq = ; + status = "disabled"; + #clock-cells = <0>; + }; status = "disabled"; }; @@ -68,12 +86,30 @@ /* PLL2 */ div = <2>; mul = <96 0>; - divp = <2>; - freqp = ; - divq = <2>; - freqq = ; - divr = <2>; - freqr = ; + + pll2p: pll2p { + compatible = "renesas,ra-cgc-pll-out"; + div = <2>; + freq = ; + status = "disabled"; + #clock-cells = <0>; + }; + + pll2q: pll2q { + compatible = "renesas,ra-cgc-pll-out"; + div = <2>; + freq = ; + status = "disabled"; + #clock-cells = <0>; + }; + + pll2r: pll2r { + compatible = "renesas,ra-cgc-pll-out"; + div = <2>; + freq = ; + status = "disabled"; + #clock-cells = <0>; + }; status = "disabled"; }; @@ -84,7 +120,7 @@ reg-names = "MSTPA", "MSTPB","MSTPC", "MSTPD", "MSTPE"; #clock-cells = <0>; - clocks = <&pll>; + clocks = <&pllp>; status = "okay"; cpuclk: cpuclk { diff --git a/dts/arm/renesas/ra/ra8/r7fa8m1xh.dtsi b/dts/arm/renesas/ra/ra8/r7fa8m1xh.dtsi index cb22fd3357a51..aedecdd38ff93 100644 --- a/dts/arm/renesas/ra/ra8/r7fa8m1xh.dtsi +++ b/dts/arm/renesas/ra/ra8/r7fa8m1xh.dtsi @@ -52,12 +52,30 @@ clocks = <&xtal>; div = <2>; mul = <96 0>; - divp = <2>; - freqp = ; - divq = <2>; - freqq = ; - divr = <2>; - freqr = ; + + pllp: pllp { + compatible = "renesas,ra-cgc-pll-out"; + div = <2>; + freq = ; + status = "disabled"; + #clock-cells = <0>; + }; + + pllq: pllq { + compatible = "renesas,ra-cgc-pll-out"; + div = <2>; + freq = ; + status = "disabled"; + #clock-cells = <0>; + }; + + pllr: pllr { + compatible = "renesas,ra-cgc-pll-out"; + div = <2>; + freq = ; + status = "disabled"; + #clock-cells = <0>; + }; status = "disabled"; }; @@ -68,12 +86,30 @@ /* PLL2 */ div = <2>; mul = <96 0>; - divp = <2>; - freqp = ; - divq = <2>; - freqq = ; - divr = <2>; - freqr = ; + + pll2p: pll2p { + compatible = "renesas,ra-cgc-pll-out"; + div = <2>; + freq = ; + status = "disabled"; + #clock-cells = <0>; + }; + + pll2q: pll2q { + compatible = "renesas,ra-cgc-pll-out"; + div = <2>; + freq = ; + status = "disabled"; + #clock-cells = <0>; + }; + + pll2r: pll2r { + compatible = "renesas,ra-cgc-pll-out"; + div = <2>; + freq = ; + status = "disabled"; + #clock-cells = <0>; + }; status = "disabled"; }; @@ -84,7 +120,7 @@ reg-names = "MSTPA", "MSTPB","MSTPC", "MSTPD", "MSTPE"; #clock-cells = <0>; - clocks = <&pll>; + clocks = <&pllp>; status = "okay"; cpuclk: cpuclk { diff --git a/dts/arm/renesas/ra/ra8/r7fa8t1xh.dtsi b/dts/arm/renesas/ra/ra8/r7fa8t1xh.dtsi index de851f6bf47e4..a2013deab2592 100644 --- a/dts/arm/renesas/ra/ra8/r7fa8t1xh.dtsi +++ b/dts/arm/renesas/ra/ra8/r7fa8t1xh.dtsi @@ -47,17 +47,33 @@ pll: pll { compatible = "renesas,ra-cgc-pll"; #clock-cells = <0>; - - /* PLL */ clocks = <&xtal>; div = <2>; mul = <80 0>; - divp = <2>; - freqp = ; - divq = <2>; - freqq = ; - divr = <2>; - freqr = ; + + pllp: pllp { + compatible = "renesas,ra-cgc-pll-out"; + div = <2>; + freq = ; + status = "disabled"; + #clock-cells = <0>; + }; + + pllq: pllq { + compatible = "renesas,ra-cgc-pll-out"; + div = <2>; + freq = ; + status = "disabled"; + #clock-cells = <0>; + }; + + pllr: pllr { + compatible = "renesas,ra-cgc-pll-out"; + div = <2>; + freq = ; + status = "disabled"; + #clock-cells = <0>; + }; status = "disabled"; }; @@ -65,15 +81,32 @@ compatible = "renesas,ra-cgc-pll"; #clock-cells = <0>; - /* PLL2 */ div = <2>; mul = <96 0>; - divp = <2>; - freqp = ; - divq = <2>; - freqq = ; - divr = <2>; - freqr = ; + + pll2p: pll2p { + compatible = "renesas,ra-cgc-pll-out"; + div = <2>; + freq = ; + status = "disabled"; + #clock-cells = <0>; + }; + + pll2q: pll2q { + compatible = "renesas,ra-cgc-pll-out"; + div = <2>; + freq = ; + status = "disabled"; + #clock-cells = <0>; + }; + + pll2r: pll2r { + compatible = "renesas,ra-cgc-pll-out"; + div = <2>; + freq = ; + status = "disabled"; + #clock-cells = <0>; + }; status = "disabled"; }; @@ -84,7 +117,7 @@ reg-names = "MSTPA", "MSTPB","MSTPC", "MSTPD", "MSTPE"; #clock-cells = <0>; - clocks = <&pll>; + clocks = <&pllp>; status = "okay"; cpuclk: cpuclk { diff --git a/dts/bindings/clock/renesas,ra-cgc-pll-out.yaml b/dts/bindings/clock/renesas,ra-cgc-pll-out.yaml new file mode 100644 index 0000000000000..2d35a714899bf --- /dev/null +++ b/dts/bindings/clock/renesas,ra-cgc-pll-out.yaml @@ -0,0 +1,19 @@ +# Copyright (c) 2024 Renesas Electronics Corporation +# SPDX-License-Identifier: Apache-2.0 + +description: Renesas RA Clock Generation Circuit PLL Clock out line + +compatible: "renesas,ra-cgc-pll-out" + +include: [clock-controller.yaml, base.yaml] + +properties: + div: + required: true + type: int + freq: + required: true + type: int + + "#clock-cells": + const: 0 diff --git a/dts/bindings/clock/renesas,ra-cgc-pll.yaml b/dts/bindings/clock/renesas,ra-cgc-pll.yaml index 7c959b6a01db5..38d1dc410a230 100644 --- a/dts/bindings/clock/renesas,ra-cgc-pll.yaml +++ b/dts/bindings/clock/renesas,ra-cgc-pll.yaml @@ -16,18 +16,6 @@ properties: mul: required: true type: array - divp: - type: int - freqp: - type: int - divq: - type: int - freqq: - type: int - divr: - type: int - freqr: - type: int "#clock-cells": const: 0 diff --git a/include/zephyr/drivers/clock_control/renesas_ra_cgc.h b/include/zephyr/drivers/clock_control/renesas_ra_cgc.h index a7f147382fdc0..1c29c9c893e78 100644 --- a/include/zephyr/drivers/clock_control/renesas_ra_cgc.h +++ b/include/zephyr/drivers/clock_control/renesas_ra_cgc.h @@ -37,14 +37,27 @@ #define RA_CGC_DIV_PCLKD(n) UTIL_CAT(BSP_CLOCKS_SYS_CLOCK_DIV_, n) #define RA_CGC_DIV_PCLKE(n) UTIL_CAT(BSP_CLOCKS_SYS_CLOCK_DIV_, n) #define RA_CGC_DIV_PLL(n) UTIL_CAT(BSP_CLOCKS_PLL_DIV_, n) +#define RA_CGC_DIV_PLLP(n) UTIL_CAT(BSP_CLOCKS_PLL_DIV_, n) +#define RA_CGC_DIV_PLLQ(n) UTIL_CAT(BSP_CLOCKS_PLL_DIV_, n) +#define RA_CGC_DIV_PLLR(n) UTIL_CAT(BSP_CLOCKS_PLL_DIV_, n) #define RA_CGC_DIV_PLL2(n) UTIL_CAT(BSP_CLOCKS_PLL_DIV_, n) +#define RA_CGC_DIV_PLL2P(n) UTIL_CAT(BSP_CLOCKS_PLL_DIV_, n) +#define RA_CGC_DIV_PLL2Q(n) UTIL_CAT(BSP_CLOCKS_PLL_DIV_, n) +#define RA_CGC_DIV_PLL2R(n) UTIL_CAT(BSP_CLOCKS_PLL_DIV_, n) #define RA_CGC_DIV_SCICLK(n) UTIL_CAT(BSP_CLOCKS_SCI_CLOCK_DIV_, n) #define RA_CGC_DIV_SPICLK(n) UTIL_CAT(BSP_CLOCKS_SPI_CLOCK_DIV_, n) #define RA_CGC_DIV_U60CLK(n) UTIL_CAT(BSP_CLOCKS_USB60_CLOCK_DIV_, n) #define RA_CGC_DIV_UCLK(n) UTIL_CAT(BSP_CLOCKS_USB_CLOCK_DIV_, n) #define BSP_CLOCKS_SOURCE_PLL BSP_CLOCKS_SOURCE_CLOCK_PLL -#define BSP_CLOCKS_SOURCE_PLL2 BSP_CLOCKS_SOURCE_CLOCK_PLL +#define BSP_CLOCKS_SOURCE_PLLP BSP_CLOCKS_SOURCE_CLOCK_PLL +#define BSP_CLOCKS_SOURCE_PLLQ BSP_CLOCKS_SOURCE_CLOCK_PLL1Q +#define BSP_CLOCKS_SOURCE_PLLR BSP_CLOCKS_SOURCE_CLOCK_PLL1R + +#define BSP_CLOCKS_SOURCE_PLL2 BSP_CLOCKS_SOURCE_CLOCK_PLL2 +#define BSP_CLOCKS_SOURCE_PLL2P BSP_CLOCKS_SOURCE_CLOCK_PLL2 +#define BSP_CLOCKS_SOURCE_PLL2Q BSP_CLOCKS_SOURCE_CLOCK_PLL2Q +#define BSP_CLOCKS_SOURCE_PLL2R BSP_CLOCKS_SOURCE_CLOCK_PLL2R #define BSP_CLOCKS_CLKOUT_DIV_1 (0) #define BSP_CLOCKS_CLKOUT_DIV_2 (1) From 639d9ae96f691e2c0002f8e0a64a3c1bf5383735 Mon Sep 17 00:00:00 2001 From: Duy Nguyen Date: Mon, 14 Oct 2024 10:36:43 +0700 Subject: [PATCH 2076/4482] manifest: Update hal_renesas commit ID Update hal renesas commit ID to resolve PLL clock config issue Signed-off-by: Duy Nguyen --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index e1f6fda9a9adb..6ee2aaa5e53c0 100644 --- a/west.yml +++ b/west.yml @@ -214,7 +214,7 @@ manifest: - hal - name: hal_renesas path: modules/hal/renesas - revision: 3dafd030046f8d6f8a26080e9b9c1bcc92d45999 + revision: 10326518701e25bf336a2eaeb8b5820110e4e6a3 groups: - hal - name: hal_rpi_pico From 145d04101d416e20af04b8a9c8bf5fe8fbb0c77b Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Tue, 29 Oct 2024 10:52:37 +0100 Subject: [PATCH 2077/4482] pm: policy: fix pm_policy_event_register arg The pm_policy_event_register() API takes absolute cycles as the second arg, like pm_policy_event_update(), but the arg is renamed time_us and treated as a relative time in us rather than abs cycles. Fix implementation of pm_policy_event_register() to treat cycles like pm_policy_event_update() and API docs suggest. Signed-off-by: Bjarki Arge Andreasen --- subsys/pm/policy/policy_events.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/subsys/pm/policy/policy_events.c b/subsys/pm/policy/policy_events.c index dc06bffdf55bb..53fec3edc5d73 100644 --- a/subsys/pm/policy/policy_events.c +++ b/subsys/pm/policy/policy_events.c @@ -68,14 +68,13 @@ int32_t pm_policy_next_event_ticks(void) return -1; } -void pm_policy_event_register(struct pm_policy_event *evt, uint32_t time_us) +void pm_policy_event_register(struct pm_policy_event *evt, uint32_t cycle) { k_spinlock_key_t key = k_spin_lock(&events_lock); - uint32_t cyc = k_cycle_get_32(); - evt->value_cyc = cyc + k_us_to_cyc_ceil32(time_us); + evt->value_cyc = cycle; sys_slist_append(&events_list, &evt->node); - update_next_event(cyc); + update_next_event(k_cycle_get_32()); k_spin_unlock(&events_lock, key); } From 0911003c11346106a725bca0050f08dea3df4dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ju=C5=99ena?= Date: Wed, 23 Oct 2024 15:22:43 +0200 Subject: [PATCH 2078/4482] boards: st: stm32h745i_disco: m7: Fix PHY address MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to the datasheet, the PHY address is 0x1. When changed to this value the PHY id is correctly read. Before: ``` [00:00:00.602,000] phy_mii: No PHY found at address 0 ``` After: ``` [00:00:00.051,000] phy_mii: PHY (1) ID 7C111 ``` Signed-off-by: Tomáš Juřena --- boards/st/stm32h745i_disco/Kconfig.defconfig | 4 ++++ .../st/stm32h745i_disco/stm32h745i_disco_stm32h745xx_m7.dts | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/boards/st/stm32h745i_disco/Kconfig.defconfig b/boards/st/stm32h745i_disco/Kconfig.defconfig index f2830611565ac..1788447e060b2 100644 --- a/boards/st/stm32h745i_disco/Kconfig.defconfig +++ b/boards/st/stm32h745i_disco/Kconfig.defconfig @@ -14,6 +14,10 @@ config NET_L2_ETHERNET config ETH_STM32_HAL_MII default y +# STM32H745I-DISCO have PHY connected to address 1 +config ETH_STM32_HAL_PHY_ADDRESS + default 1 + endif # NETWORKING config MEMC diff --git a/boards/st/stm32h745i_disco/stm32h745i_disco_stm32h745xx_m7.dts b/boards/st/stm32h745i_disco/stm32h745i_disco_stm32h745xx_m7.dts index fbc3a388b9cc9..f1e7204a8646e 100644 --- a/boards/st/stm32h745i_disco/stm32h745i_disco_stm32h745xx_m7.dts +++ b/boards/st/stm32h745i_disco/stm32h745i_disco_stm32h745xx_m7.dts @@ -151,9 +151,9 @@ pinctrl-0 = <ð_mdio_pa2 ð_mdc_pc1>; pinctrl-names = "default"; - ethernet-phy@0 { + ethernet-phy@1 { compatible = "ethernet-phy"; - reg = <0x00>; + reg = <0x01>; status = "okay"; }; }; From cfb73221076f7dbd845658341b62b7142fd20870 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Wed, 16 Oct 2024 16:20:51 -0500 Subject: [PATCH 2079/4482] drivers: flash: flash_mcux_flexspi: add support for W25Q512NW-IQ/IN Add support for the W25Q512NW-IQ/IN with the FLEXSPI, using a custom LUT table. Fixes #80592 Signed-off-by: Daniel DeGrasse --- drivers/flash/flash_mcux_flexspi_nor.c | 38 ++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/flash/flash_mcux_flexspi_nor.c b/drivers/flash/flash_mcux_flexspi_nor.c index ea9377d075414..b2b045e1b02cc 100644 --- a/drivers/flash/flash_mcux_flexspi_nor.c +++ b/drivers/flash/flash_mcux_flexspi_nor.c @@ -1008,6 +1008,44 @@ static int flash_flexspi_nor_check_jedec(struct flash_flexspi_nor_data *data, /* Device uses bit 1 of status reg 2 for QE */ return flash_flexspi_nor_quad_enable(data, flexspi_lut, JESD216_DW15_QER_VAL_S2B1v5); + case 0x60ef: + if ((vendor_id & 0xFFFFFF) != 0x2060ef) { + /* + * This is not the correct flash chip, and will not + * support the LUT table. Return here + */ + return -ENOTSUP; + } + /* W25Q512NW-IQ/IN flash, use 4 byte read/write */ + flexspi_lut[READ][0] = FLEXSPI_LUT_SEQ( + kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, SPI_NOR_CMD_4READ_4B, + kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_4PAD, 32); + /* Flash needs 8 dummy cycles (at 133MHz) */ + flexspi_lut[READ][1] = FLEXSPI_LUT_SEQ( + kFLEXSPI_Command_DUMMY_SDR, kFLEXSPI_4PAD, 8, + kFLEXSPI_Command_READ_SDR, kFLEXSPI_4PAD, 0x04); + /* Only 1S-1S-4S page program supported */ + flexspi_lut[PAGE_PROGRAM][0] = FLEXSPI_LUT_SEQ( + kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, SPI_NOR_CMD_PP_1_1_4_4B, + kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_1PAD, 32); + flexspi_lut[PAGE_PROGRAM][1] = FLEXSPI_LUT_SEQ( + kFLEXSPI_Command_WRITE_SDR, kFLEXSPI_4PAD, 0x4, + kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0x0); + /* Update ERASE commands for 4 byte mode */ + flexspi_lut[ERASE_SECTOR][0] = FLEXSPI_LUT_SEQ( + kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, SPI_NOR_CMD_SE_4B, + kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_1PAD, 32); + flexspi_lut[ERASE_BLOCK][0] = FLEXSPI_LUT_SEQ( + kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0xDC, + kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_1PAD, 32), + /* Read instruction used for polling is 0x05 */ + data->legacy_poll = true; + flexspi_lut[READ_STATUS_REG][0] = FLEXSPI_LUT_SEQ( + kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, SPI_NOR_CMD_RDSR, + kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x01); + /* Device uses bit 1 of status reg 2 for QE */ + return flash_flexspi_nor_quad_enable(data, flexspi_lut, + JESD216_DW15_QER_VAL_S2B1v5); case 0x25C2: /* MX25 flash, use 4 byte read/write */ flexspi_lut[READ][0] = FLEXSPI_LUT_SEQ( From 0856ceed7b2248c11a52b012e76b9fe6007fef8d Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Wed, 16 Oct 2024 16:18:42 -0500 Subject: [PATCH 2080/4482] soc: nxp: imxrt: correct flexspi XIP check to avoid reclocking RT11xx SOC init should check to see if the zephyr flash node is set to a device on the FLEXSPI bus to determine if the part is running in XIP mode. This check was incorrect, so the FLEXSPI was being reclocked in XIP mode to 24 MHz. Fix this check so the FlexSPI is not downclocked. Fixes #75702 Signed-off-by: Daniel DeGrasse --- soc/nxp/imxrt/imxrt11xx/soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/nxp/imxrt/imxrt11xx/soc.c b/soc/nxp/imxrt/imxrt11xx/soc.c index 4f1cca4dcc6db..5ba737cb28607 100644 --- a/soc/nxp/imxrt/imxrt11xx/soc.c +++ b/soc/nxp/imxrt/imxrt11xx/soc.c @@ -559,7 +559,7 @@ static ALWAYS_INLINE void clock_init(void) #endif #endif -#if !(DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_flash), nxp_imx_flexspi)) && \ +#if !(DT_NODE_HAS_COMPAT(DT_PARENT(DT_CHOSEN(zephyr_flash)), nxp_imx_flexspi)) && \ defined(CONFIG_MEMC_MCUX_FLEXSPI) && DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(flexspi)) /* Configure FLEXSPI1 using OSC_RC_48M_DIV2 */ rootCfg.mux = kCLOCK_FLEXSPI1_ClockRoot_MuxOscRc48MDiv2; From 21f37c8bfd06eb1994829062126ec1c244261099 Mon Sep 17 00:00:00 2001 From: David Leach Date: Wed, 30 Oct 2024 14:27:39 -0500 Subject: [PATCH 2081/4482] tests: counter: RW612 dts overlay support for basic_api tests Remove memory spaces not needed for the counter_basic_api test. Add frdm_rw612.overlay Signed-off-by: David Leach --- .../boards/frdm_rw612.overlay | 48 +++++++++++++++++++ .../boards/rd_rw612_bga.overlay | 17 ++++++- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 tests/drivers/counter/counter_basic_api/boards/frdm_rw612.overlay diff --git a/tests/drivers/counter/counter_basic_api/boards/frdm_rw612.overlay b/tests/drivers/counter/counter_basic_api/boards/frdm_rw612.overlay new file mode 100644 index 0000000000000..536e2f60093c1 --- /dev/null +++ b/tests/drivers/counter/counter_basic_api/boards/frdm_rw612.overlay @@ -0,0 +1,48 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&ctimer1 { + status = "okay"; +}; + +&ctimer2 { + status = "okay"; +}; + +&ctimer3 { + status = "okay"; +}; + +&mrt0_channel1 { + status = "okay"; +}; + +&mrt0_channel3 { + status = "okay"; +}; + +&mrt1_channel2 { + status = "okay"; +}; + +&mrt1_channel3 { + status = "okay"; +}; + +/* + * For testing purposes, free up memory spaces not needed by the testing. + */ +&smu1 { + smu1_data: memory@0 { + /delete-property/ zephyr,memory-attr; + }; +}; + +&smu2 { + smu2_data: memory@0 { + /delete-property/ zephyr,memory-attr; + }; +}; diff --git a/tests/drivers/counter/counter_basic_api/boards/rd_rw612_bga.overlay b/tests/drivers/counter/counter_basic_api/boards/rd_rw612_bga.overlay index b47bf1bde7ef6..919714d996c22 100644 --- a/tests/drivers/counter/counter_basic_api/boards/rd_rw612_bga.overlay +++ b/tests/drivers/counter/counter_basic_api/boards/rd_rw612_bga.overlay @@ -1,5 +1,5 @@ /* - * Copyright 2023 NXP + * Copyright 2023-2024 NXP * * SPDX-License-Identifier: Apache-2.0 */ @@ -31,3 +31,18 @@ &mrt1_channel3 { status = "okay"; }; + +/* + * For testing purposes, free up memory spaces not needed by the testing. + */ +&smu1 { + smu1_data: memory@0 { + /delete-property/ zephyr,memory-attr; + }; +}; + +&smu2 { + smu2_data: memory@0 { + /delete-property/ zephyr,memory-attr; + }; +}; From 9cabb8996958d265266a15b536695a19f7f5f348 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 31 Oct 2024 06:03:41 -0400 Subject: [PATCH 2082/4482] tests: drivers: display: fix filtering Test was marked build only with filters in each scenario looking for sdl-dc which is only available on native_sim, so cut the chase and use platform_only to narrow things down to native_sim directly instead of building the world to get information we already know. reduces build/run time from 78s to 17s on invocation of twister with default options, saves a ton more when running twister with --all. Signed-off-by: Anas Nashif --- .../display/display_read_write/testcase.yaml | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/tests/drivers/display/display_read_write/testcase.yaml b/tests/drivers/display/display_read_write/testcase.yaml index 8e31d2f91f831..499fc58a1f97e 100644 --- a/tests/drivers/display/display_read_write/testcase.yaml +++ b/tests/drivers/display/display_read_write/testcase.yaml @@ -5,48 +5,55 @@ common: tags: - drivers - display - filter: dt_chosen_enabled("zephyr,display") - build_only: true # The CI environment has no display device + harness: display tests: drivers.display.read_write.sdl.argb8888: - filter: dt_compat_enabled("zephyr,sdl-dc") + platform_allow: + - native_sim extra_configs: - CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_ARGB_8888=y - CONFIG_SDL_DISPLAY_USE_HARDWARE_ACCELERATOR=n drivers.display.read_write.sdl.rgb888: - filter: dt_compat_enabled("zephyr,sdl-dc") + platform_allow: + - native_sim extra_configs: - CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_RGB_888=y - CONFIG_SDL_DISPLAY_USE_HARDWARE_ACCELERATOR=n drivers.display.read_write.sdl.mono01: - filter: dt_compat_enabled("zephyr,sdl-dc") + platform_allow: + - native_sim extra_configs: - CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_MONO01=y - CONFIG_SDL_DISPLAY_USE_HARDWARE_ACCELERATOR=n drivers.display.read_write.sdl.mono10: - filter: dt_compat_enabled("zephyr,sdl-dc") + platform_allow: + - native_sim extra_configs: - CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_MONO10=y - CONFIG_SDL_DISPLAY_USE_HARDWARE_ACCELERATOR=n drivers.display.read_write.sdl.mono01.lsbfirst: - filter: dt_compat_enabled("zephyr,sdl-dc") + platform_allow: + - native_sim extra_configs: - CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_MONO01=y - CONFIG_SDL_DISPLAY_USE_HARDWARE_ACCELERATOR=n - CONFIG_SDL_DISPLAY_MONO_MSB_FIRST=n drivers.display.read_write.sdl.mono10.lsbfirst: - filter: dt_compat_enabled("zephyr,sdl-dc") + platform_allow: + - native_sim extra_configs: - CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_MONO10=y - CONFIG_SDL_DISPLAY_USE_HARDWARE_ACCELERATOR=n - CONFIG_SDL_DISPLAY_MONO_MSB_FIRST=n drivers.display.read_write.sdl.rgb565: - filter: dt_compat_enabled("zephyr,sdl-dc") + platform_allow: + - native_sim extra_configs: - CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_RGB_565=y - CONFIG_SDL_DISPLAY_USE_HARDWARE_ACCELERATOR=n drivers.display.read_write.sdl.bgr565: - filter: dt_compat_enabled("zephyr,sdl-dc") + platform_allow: + - native_sim extra_configs: - CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_BGR_565=y - CONFIG_SDL_DISPLAY_USE_HARDWARE_ACCELERATOR=n From c1776df8ae8bacf4b6a0f2ad225846e4c2c41c5e Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Thu, 31 Oct 2024 11:54:12 +0100 Subject: [PATCH 2083/4482] soc: nordic: dmm: Fix DMM_REG_ALIGN_SIZE macro when CONFIG_DCACHE=n Make sure this expansion doesn't include `CONFIG_DCACHE_LINE_SIZE`, which would be undefined and produce a build error. Signed-off-by: Grzegorz Swiderski --- soc/nordic/common/dmm.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/soc/nordic/common/dmm.h b/soc/nordic/common/dmm.h index e92f01d07b85c..34b517c92dfc7 100644 --- a/soc/nordic/common/dmm.h +++ b/soc/nordic/common/dmm.h @@ -23,12 +23,13 @@ extern "C" { /** @cond INTERNAL_HIDDEN */ +#ifdef CONFIG_DCACHE + /* Determine if memory region is cacheable. */ -#define DMM_IS_REG_CACHEABLE(node_id) \ - COND_CODE_1(CONFIG_DCACHE, \ - (COND_CODE_1(DT_NODE_HAS_PROP(node_id, zephyr_memory_attr), \ - ((DT_PROP(node_id, zephyr_memory_attr) & DT_MEM_CACHEABLE)), \ - (0))), (0)) +#define DMM_IS_REG_CACHEABLE(node_id) \ + COND_CODE_1(DT_NODE_HAS_PROP(node_id, zephyr_memory_attr), \ + ((DT_PROP(node_id, zephyr_memory_attr) & DT_MEM_CACHEABLE)), \ + (0)) /* Determine required alignment of the data buffers in specified memory region. * Cache line alignment is required if region is cacheable and data cache is enabled. @@ -36,6 +37,13 @@ extern "C" { #define DMM_REG_ALIGN_SIZE(node_id) \ (DMM_IS_REG_CACHEABLE(node_id) ? CONFIG_DCACHE_LINE_SIZE : sizeof(uint8_t)) +#else + +#define DMM_IS_REG_CACHEABLE(node_id) 0 +#define DMM_REG_ALIGN_SIZE(node_id) (sizeof(uint8_t)) + +#endif /* CONFIG_DCACHE */ + /* Determine required alignment of the data buffers in memory region * associated with specified device node. */ From 39015912d05977361db1c9be7f04e19ea8ce91c2 Mon Sep 17 00:00:00 2001 From: The Nguyen Date: Wed, 30 Oct 2024 15:02:04 +0700 Subject: [PATCH 2084/4482] boards: renesas: doc: update supported feature on Renesas RA boards Add information about CAN supported on these boards: - ek_ra8m1 - ek_ra8d1 - mck_ra8t1 Signed-off-by: The Nguyen --- boards/renesas/ek_ra8d1/doc/index.rst | 2 ++ boards/renesas/ek_ra8m1/doc/index.rst | 2 ++ boards/renesas/mck_ra8t1/doc/index.rst | 2 ++ 3 files changed, 6 insertions(+) diff --git a/boards/renesas/ek_ra8d1/doc/index.rst b/boards/renesas/ek_ra8d1/doc/index.rst index 1e423cc65baff..a56e8869c334d 100644 --- a/boards/renesas/ek_ra8d1/doc/index.rst +++ b/boards/renesas/ek_ra8d1/doc/index.rst @@ -108,6 +108,8 @@ The below features are currently supported on Zephyr OS for EK-RA8D1 board: +--------------+------------+------------------+ | COUNTER | on-chip | counter | +--------------+------------+------------------+ +| CAN | on-chip | canfd | ++--------------+------------+------------------+ Other hardware features are currently not supported by the port. diff --git a/boards/renesas/ek_ra8m1/doc/index.rst b/boards/renesas/ek_ra8m1/doc/index.rst index 1c22cd84bb906..09d36befe02dc 100644 --- a/boards/renesas/ek_ra8m1/doc/index.rst +++ b/boards/renesas/ek_ra8m1/doc/index.rst @@ -110,6 +110,8 @@ The below features are currently supported on Zephyr OS for EK-RA8M1 board: +-----------+------------+----------------------+ | COUNTER | on-chip | counter | +-----------+------------+----------------------+ +| CAN | on-chip | canfd | ++-----------+------------+----------------------+ Other hardware features are currently not supported by the port. diff --git a/boards/renesas/mck_ra8t1/doc/index.rst b/boards/renesas/mck_ra8t1/doc/index.rst index 5c13563514719..4e24da06e38d2 100644 --- a/boards/renesas/mck_ra8t1/doc/index.rst +++ b/boards/renesas/mck_ra8t1/doc/index.rst @@ -106,6 +106,8 @@ The below features are currently supported on Zephyr OS for MCB-RA8T1 board: +--------------+------------+----------------------+ | COUNTER | on-chip | counter | +--------------+------------+----------------------+ +| CAN | on-chip | canfd | ++--------------+------------+----------------------+ Other hardware features are currently not supported by the port. From dbda4642cd92033ef00bc91c28ce5b7f5a407c7a Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Thu, 10 Oct 2024 11:13:34 +0200 Subject: [PATCH 2085/4482] drivers: crypto: deprecated TinyCrypt shim driver As part of the deprecation process of TinyCrypt started in #79566, this commit set the TinyCrypt based crypto shim driver as deprecated. Signed-off-by: Valerio Setti --- doc/releases/migration-guide-4.0.rst | 6 ++++++ drivers/crypto/Kconfig | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index f5ad27bff7767..1f2f48bb4f31a 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -199,6 +199,12 @@ Clock control Controller Area Network (CAN) ============================= +Crypto +====== + +* Following the deprecation of the TinyCrypt library (:github:`79566`), the + TinyCrypt-based shim driver was marked as deprecated (:github:`79653`). + Display ======= diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index 964e9439db041..a1b147b12bfae 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig @@ -22,14 +22,14 @@ module-str = CRYPTO source "subsys/logging/Kconfig.template.log_config" config CRYPTO_TINYCRYPT_SHIM - bool "TinyCrypt shim driver [EXPERIMENTAL]" + bool "TinyCrypt shim driver [DEPRECATED]" select TINYCRYPT select TINYCRYPT_AES select TINYCRYPT_AES_CBC select TINYCRYPT_AES_CTR select TINYCRYPT_AES_CCM select TINYCRYPT_AES_CMAC - select EXPERIMENTAL + select DEPRECATED help Enable TinyCrypt shim layer compliant with crypto APIs. From adad8dc48a8eeded928a6a4a067487f3a9e52146 Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Thu, 10 Oct 2024 12:09:46 +0200 Subject: [PATCH 2086/4482] soc: remove usage of TinyCrypt in NXP SOCs As for the IMX SOCs all the lines removed in this commit were actually commented out so there's basically no change in code behavior expected here. The only affected SOCs family is therefore the Kinetis one. Signed-off-by: Valerio Setti --- soc/nxp/imxrt/Kconfig.defconfig | 4 ---- soc/nxp/imxrt/imxrt5xx/Kconfig.defconfig | 4 ---- soc/nxp/imxrt/imxrt6xx/Kconfig.defconfig | 4 ---- soc/nxp/kinetis/kwx/Kconfig.defconfig | 4 ---- 4 files changed, 16 deletions(-) diff --git a/soc/nxp/imxrt/Kconfig.defconfig b/soc/nxp/imxrt/Kconfig.defconfig index efada2fc317c7..caf637260d7c4 100644 --- a/soc/nxp/imxrt/Kconfig.defconfig +++ b/soc/nxp/imxrt/Kconfig.defconfig @@ -85,11 +85,7 @@ choice SEGGER_SYSVIEW_SECTION depends on SEGGER_SYSTEMVIEW endchoice -# -# MBEDTLS is larger but much faster than TinyCrypt so choose wisely -# config MBEDTLS -#config TINYCRYPT default y if CSPRNG_ENABLED depends on ENTROPY_GENERATOR diff --git a/soc/nxp/imxrt/imxrt5xx/Kconfig.defconfig b/soc/nxp/imxrt/imxrt5xx/Kconfig.defconfig index d25750e704ea0..3c803947269c4 100644 --- a/soc/nxp/imxrt/imxrt5xx/Kconfig.defconfig +++ b/soc/nxp/imxrt/imxrt5xx/Kconfig.defconfig @@ -20,11 +20,7 @@ config NUM_IRQS config ZTEST_NO_YIELD default y if (PM && ZTEST) -# -# MBEDTLS is larger but much faster than TinyCrypt so choose wisely -# config MBEDTLS -#config TINYCRYPT default y if CSPRNG_ENABLED depends on ENTROPY_GENERATOR diff --git a/soc/nxp/imxrt/imxrt6xx/Kconfig.defconfig b/soc/nxp/imxrt/imxrt6xx/Kconfig.defconfig index 4a961be41cf23..cd2b03f8eb078 100644 --- a/soc/nxp/imxrt/imxrt6xx/Kconfig.defconfig +++ b/soc/nxp/imxrt/imxrt6xx/Kconfig.defconfig @@ -34,11 +34,7 @@ config NUM_IRQS config ZTEST_NO_YIELD default y if (ZTEST && PM) -# -# MBEDTLS is larger but much faster than TinyCrypt so choose wisely -# config MBEDTLS -#config TINYCRYPT default y if CSPRNG_ENABLED depends on ENTROPY_GENERATOR diff --git a/soc/nxp/kinetis/kwx/Kconfig.defconfig b/soc/nxp/kinetis/kwx/Kconfig.defconfig index d2fb4f0de0daa..3785dcd1fd259 100644 --- a/soc/nxp/kinetis/kwx/Kconfig.defconfig +++ b/soc/nxp/kinetis/kwx/Kconfig.defconfig @@ -25,10 +25,6 @@ choice RNG_GENERATOR_CHOICE default XOSHIRO_RANDOM_GENERATOR endchoice -config TINYCRYPT - default y - depends on ENTROPY_GENERATOR && SOC_MKW41Z4 - endif # SOC_MKW40Z4 || SOC_MKW41Z4 endif # SOC_SERIES_KINETIS_KWX From f4b7d151c599931cc4061b1cba788afa6ee8d6f1 Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Thu, 10 Oct 2024 12:47:22 +0200 Subject: [PATCH 2087/4482] board: remove references to TinyCrypt Following the deprecation of TinyCrypt (#79566) we remove tags referring to it. Signed-off-by: Valerio Setti --- boards/96boards/avenger96/96b_avenger96.yaml | 1 - boards/st/stm32mp157c_dk2/stm32mp157c_dk2.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/boards/96boards/avenger96/96b_avenger96.yaml b/boards/96boards/avenger96/96b_avenger96.yaml index 5d50bcd694342..ef14d1b879d98 100644 --- a/boards/96boards/avenger96/96b_avenger96.yaml +++ b/boards/96boards/avenger96/96b_avenger96.yaml @@ -14,7 +14,6 @@ testing: - cmsis_rtos_v2 - net - mpu - - tinycrypt - crypto - aes - cmm diff --git a/boards/st/stm32mp157c_dk2/stm32mp157c_dk2.yaml b/boards/st/stm32mp157c_dk2/stm32mp157c_dk2.yaml index d552a6d6aa0d8..91a4aa38fe075 100644 --- a/boards/st/stm32mp157c_dk2/stm32mp157c_dk2.yaml +++ b/boards/st/stm32mp157c_dk2/stm32mp157c_dk2.yaml @@ -18,7 +18,6 @@ testing: - cmsis_rtos_v2 - net - mpu - - tinycrypt - crypto - aes - cmm From 3d45ee7cb7e98b868d01ce738304cd569344add1 Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Thu, 10 Oct 2024 13:17:03 +0200 Subject: [PATCH 2088/4482] random: remove TinyCrypt usage Following the deprecation of TinyCrypt (#79566) we remove TinyCrypt usage in random generators. This basically only affects the CTR-DRBG random generator which from now only will only make use of Mbed TLS. Signed-off-by: Valerio Setti --- doc/releases/migration-guide-4.0.rst | 8 +++ subsys/random/Kconfig | 6 +-- subsys/random/random_ctr_drbg.c | 74 ---------------------------- 3 files changed, 10 insertions(+), 78 deletions(-) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 1f2f48bb4f31a..49b7e4e0be4f2 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -559,6 +559,14 @@ MCUmgr Modem ===== +Random +====== + +* Following the deprecation of the TinyCrypt library (:github:`79566`), usage + of TinyCrypt in the CTR-DRBG random number generator was removed. From now on + Mbed TLS is required to enable :kconfig:option:`CONFIG_CTR_DRBG_CSPRNG_GENERATOR`. + (:github:`79653`) + Shell ===== diff --git a/subsys/random/Kconfig b/subsys/random/Kconfig index 8eb3fe2e48b27..137929d78d20c 100644 --- a/subsys/random/Kconfig +++ b/subsys/random/Kconfig @@ -106,11 +106,9 @@ config HARDWARE_DEVICE_CS_GENERATOR config CTR_DRBG_CSPRNG_GENERATOR bool "Use CTR-DRBG CSPRNG" - depends on MBEDTLS || TINYCRYPT + depends on MBEDTLS depends on ENTROPY_HAS_DRIVER - select MBEDTLS_CIPHER_AES_ENABLED if MBEDTLS - select TINYCRYPT_CTR_PRNG if TINYCRYPT - select TINYCRYPT_AES if TINYCRYPT + select MBEDTLS_CIPHER_AES_ENABLED help Enables the CTR-DRBG pseudo-random number generator. This CSPRNG shall use the entropy API for an initialization seed. The CTR-DRBG diff --git a/subsys/random/random_ctr_drbg.c b/subsys/random/random_ctr_drbg.c index 88c591075f182..697c29da58b88 100644 --- a/subsys/random/random_ctr_drbg.c +++ b/subsys/random/random_ctr_drbg.c @@ -10,7 +10,6 @@ #include #include -#if defined(CONFIG_MBEDTLS) #if !defined(CONFIG_MBEDTLS_CFG_FILE) #include "mbedtls/config.h" #else @@ -18,14 +17,6 @@ #endif /* CONFIG_MBEDTLS_CFG_FILE */ #include -#elif defined(CONFIG_TINYCRYPT) - -#include -#include -#include - -#endif /* CONFIG_MBEDTLS */ - /* * entropy_dev is initialized at runtime to allow first time initialization * of the ctr_drbg engine. @@ -35,8 +26,6 @@ static const unsigned char drbg_seed[] = CONFIG_CS_CTR_DRBG_PERSONALIZATION; static bool ctr_initialised; static struct k_mutex ctr_lock; -#if defined(CONFIG_MBEDTLS) - static mbedtls_ctr_drbg_context ctr_ctx; static int ctr_drbg_entropy_func(void *ctx, unsigned char *buf, size_t len) @@ -44,13 +33,6 @@ static int ctr_drbg_entropy_func(void *ctx, unsigned char *buf, size_t len) return entropy_get_entropy(entropy_dev, (void *)buf, len); } -#elif defined(CONFIG_TINYCRYPT) - -static TCCtrPrng_t ctr_ctx; - -#endif /* CONFIG_MBEDTLS */ - - static int ctr_drbg_initialize(void) { int ret; @@ -62,8 +44,6 @@ static int ctr_drbg_initialize(void) return -ENODEV; } -#if defined(CONFIG_MBEDTLS) - mbedtls_ctr_drbg_init(&ctr_ctx); ret = mbedtls_ctr_drbg_seed(&ctr_ctx, @@ -77,27 +57,6 @@ static int ctr_drbg_initialize(void) return -EIO; } -#elif defined(CONFIG_TINYCRYPT) - - uint8_t entropy[TC_AES_KEY_SIZE + TC_AES_BLOCK_SIZE]; - - ret = entropy_get_entropy(entropy_dev, (void *)&entropy, - sizeof(entropy)); - if (ret != 0) { - return -EIO; - } - - ret = tc_ctr_prng_init(&ctr_ctx, - (uint8_t *)&entropy, - sizeof(entropy), - (uint8_t *)drbg_seed, - sizeof(drbg_seed)); - - if (ret == TC_CRYPTO_FAIL) { - return -EIO; - } - -#endif ctr_initialised = true; return 0; } @@ -117,41 +76,8 @@ int z_impl_sys_csrand_get(void *dst, uint32_t outlen) } } -#if defined(CONFIG_MBEDTLS) - ret = mbedtls_ctr_drbg_random(&ctr_ctx, (unsigned char *)dst, outlen); -#elif defined(CONFIG_TINYCRYPT) - - uint8_t entropy[TC_AES_KEY_SIZE + TC_AES_BLOCK_SIZE]; - - ret = tc_ctr_prng_generate(&ctr_ctx, 0, 0, (uint8_t *)dst, outlen); - - if (ret == TC_CRYPTO_SUCCESS) { - ret = 0; - } else if (ret == TC_CTR_PRNG_RESEED_REQ) { - - ret = entropy_get_entropy(entropy_dev, - (void *)&entropy, sizeof(entropy)); - if (ret != 0) { - ret = -EIO; - goto end; - } - - ret = tc_ctr_prng_reseed(&ctr_ctx, - entropy, - sizeof(entropy), - drbg_seed, - sizeof(drbg_seed)); - - ret = tc_ctr_prng_generate(&ctr_ctx, 0, 0, - (uint8_t *)dst, outlen); - - ret = (ret == TC_CRYPTO_SUCCESS) ? 0 : -EIO; - } else { - ret = -EIO; - } -#endif end: k_mutex_unlock(&ctr_lock); From 7f5574817fab1a422e19f6b66de5cd764f4ab78f Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Thu, 10 Oct 2024 15:45:08 +0200 Subject: [PATCH 2089/4482] jwt: remove TinyCrypt usage As part of TinyCrypt deprecation process (#79566) this commit removes usage of this library from the JWT subsystem and its related tests. Signed-off-by: Valerio Setti --- doc/releases/migration-guide-4.0.rst | 20 ++++-- doc/releases/release-notes-4.0.rst | 12 ++-- subsys/jwt/CMakeLists.txt | 6 +- subsys/jwt/Kconfig | 67 +++++--------------- subsys/jwt/jwt.c | 8 +-- subsys/jwt/jwt_legacy_ecdsa.c | 82 ------------------------- subsys/jwt/jwt_psa.c | 6 +- tests/subsys/jwt/src/jwt-test-private.c | 4 +- tests/subsys/jwt/testcase.yaml | 13 +--- 9 files changed, 54 insertions(+), 164 deletions(-) delete mode 100644 subsys/jwt/jwt_legacy_ecdsa.c diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 49b7e4e0be4f2..dbe251676204f 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -576,11 +576,21 @@ Shell JWT (JSON Web Token) ==================== -* By default, the signature is now computed through PSA Crypto API for both RSA and ECDSA. - The newly-added :kconfig:option:`CONFIG_JWT_USE_LEGACY` can be used to switch - back to previous libraries (TinyCrypt for ECDSA and Mbed TLS for RSA). - The conversion to the PSA Crypto API is being done in preparation for the - deprecation of TinyCrypt. (:github:`78243` and :github:`43712`) +* By default, the signature is now computed using the PSA Crypto API for both RSA and ECDSA + (:github:`78243`). The conversion to the PSA Crypto API is part of the adoption + of a standard interface for crypto operations (:github:`43712`). Moreover, + following the deprecation of the TinyCrypt library (:github:`79566`), usage + of TinyCrypt was removed from the JWT subsystem (:github:`79653`). + +* The following new symbols were added to allow specifying both the signature + algorithm and crypto library: + + * :kconfig:option:`CONFIG_JWT_SIGN_RSA_PSA` (default) RSA signature using the PSA Crypto API; + * :kconfig:option:`CONFIG_JWT_SIGN_RSA_LEGACY` RSA signature using Mbed TLS; + * :kconfig:option:`CONFIG_JWT_SIGN_ECDSA_PSA` ECDSA signature using the PSA Crypto API. + + They replace the previously-existing Kconfigs ``CONFIG_JWT_SIGN_RSA`` and + ``CONFIG_JWT_SIGN_ECDSA``. (:github:`79653`) Architectures ************* diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 16c1b595ac105..dba6c620904ac 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -608,12 +608,14 @@ Libraries / Subsystems * JWT (JSON Web Token) - * The following new Kconfigs were added to specify which library to use for the - signature: + * The following new symbols were added to allow specifying both the signature + algorithm and crypto library: - * :kconfig:option:`CONFIG_JWT_USE_PSA` (default) use the PSA Crypto API; - * :kconfig:option:`CONFIG_JWT_USE_LEGACY` use legacy libraries, i.e. TinyCrypt - for ECDSA and Mbed TLS for RSA. + * :kconfig:option:`CONFIG_JWT_SIGN_RSA_PSA` (default) RSA signature using the PSA Crypto API; + * :kconfig:option:`CONFIG_JWT_SIGN_RSA_LEGACY` RSA signature using Mbed TLS; + * :kconfig:option:`CONFIG_JWT_SIGN_ECDSA_PSA` ECDSA signature using the PSA Crypto API. + + (:github:`79653`) HALs **** diff --git a/subsys/jwt/CMakeLists.txt b/subsys/jwt/CMakeLists.txt index 82c65f11f414c..6bc93cd92b8c1 100644 --- a/subsys/jwt/CMakeLists.txt +++ b/subsys/jwt/CMakeLists.txt @@ -3,8 +3,10 @@ zephyr_library() zephyr_library_sources(jwt.c) -zephyr_library_sources_ifdef(CONFIG_JWT_SIGN_ECDSA_LEGACY jwt_legacy_ecdsa.c) zephyr_library_sources_ifdef(CONFIG_JWT_SIGN_RSA_LEGACY jwt_legacy_rsa.c) -zephyr_library_sources_ifdef(CONFIG_JWT_USE_PSA jwt_psa.c) + +if (CONFIG_JWT_SIGN_RSA_PSA OR CONFIG_JWT_SIGN_ECDSA_PSA) + zephyr_library_sources(jwt_psa.c) +endif() zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS) diff --git a/subsys/jwt/Kconfig b/subsys/jwt/Kconfig index 651fe46cbf57f..97446e27d9ee7 100644 --- a/subsys/jwt/Kconfig +++ b/subsys/jwt/Kconfig @@ -12,69 +12,34 @@ if JWT choice prompt "JWT signature algorithm" - default JWT_SIGN_RSA + default JWT_SIGN_RSA_PSA help Select which algorithm to use for signing JWT tokens. -config JWT_SIGN_RSA - bool "Use RSA signature (RS-256)" - -config JWT_SIGN_ECDSA - bool "Use ECDSA signature (ES-256)" - -endchoice - -choice - default JWT_USE_PSA - prompt "Select crypto library to be used" +config JWT_SIGN_RSA_LEGACY + bool "Use RSA signature (RS-256). Use Mbed TLS as crypto library." + depends on CSPRNG_ENABLED + select MBEDTLS + select MBEDTLS_KEY_EXCHANGE_RSA_ENABLED -config JWT_USE_PSA - bool "PSA crypto API library" +config JWT_SIGN_RSA_PSA + bool "Use RSA signature (RS-256). Use PSA Crypto API." select MBEDTLS if !BUILD_WITH_TFM select MBEDTLS_PSA_CRYPTO_C if !BUILD_WITH_TFM + select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY + select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT + select PSA_WANT_ALG_RSA_PKCS1V15_SIGN + select PSA_WANT_ALG_SHA_256 -config JWT_USE_LEGACY - bool "Legacy library: TinyCrypt for ECDSA, Mbed TLS for RSA" - -endchoice - -# Prompless Kconfigs to effectively select which algorithm and library will be used -# to sign the JWT. User's selections on the above choices will determine which -# element will be picked here. config JWT_SIGN_ECDSA_PSA - bool - default y - depends on JWT_SIGN_ECDSA && JWT_USE_PSA + bool "Use ECDSA signature (ES-256). Use PSA Crypto API." + select MBEDTLS if !BUILD_WITH_TFM + select MBEDTLS_PSA_CRYPTO_C if !BUILD_WITH_TFM select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT select PSA_WANT_ALG_ECDSA select PSA_WANT_ECC_SECP_R1_256 select PSA_WANT_ALG_SHA_256 -config JWT_SIGN_ECDSA_LEGACY - bool - default y - depends on JWT_SIGN_ECDSA && JWT_USE_LEGACY - select TINYCRYPT - select TINYCRYPT_SHA256 - select TINYCRYPT_ECC_DSA - select TINYCRYPT_CTR_PRNG - select TINYCRYPT_AES - -config JWT_SIGN_RSA_PSA - bool - default y - depends on JWT_SIGN_RSA && JWT_USE_PSA - select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY - select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT - select PSA_WANT_ALG_RSA_PKCS1V15_SIGN - select PSA_WANT_ALG_SHA_256 - -config JWT_SIGN_RSA_LEGACY - bool - default y - depends on JWT_SIGN_RSA && JWT_USE_LEGACY - depends on CSPRNG_ENABLED - select MBEDTLS - select MBEDTLS_KEY_EXCHANGE_RSA_ENABLED +endchoice endif # JWT diff --git a/subsys/jwt/jwt.c b/subsys/jwt/jwt.c index 4487e557096af..1774637cff962 100644 --- a/subsys/jwt/jwt.c +++ b/subsys/jwt/jwt.c @@ -14,9 +14,9 @@ #include "jwt.h" -#if defined(CONFIG_JWT_SIGN_RSA) +#if defined(CONFIG_JWT_SIGN_RSA_PSA) || defined(JWT_SIGN_RSA_LEGACY) #define JWT_SIGNATURE_LEN 256 -#else /* CONFIG_JWT_SIGN_ECDSA */ +#else /* CONFIG_JWT_SIGN_ECDSA_PSA */ #define JWT_SIGNATURE_LEN 64 #endif @@ -143,10 +143,10 @@ static int jwt_add_header(struct jwt_builder *builder) * Use https://www.base64encode.org/ for update */ const char jwt_header[] = -#ifdef CONFIG_JWT_SIGN_RSA +#if defined(CONFIG_JWT_SIGN_RSA_PSA) || defined(CONFIG_JWT_SIGN_RSA_LEGACY) /* {"alg":"RS256","typ":"JWT"} */ "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9"; -#else /* CONFIG_JWT_SIGN_ECDSA */ +#else /* CONFIG_JWT_SIGN_ECDSA_PSA */ /* {"alg":"ES256","typ":"JWT"} */ "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9"; #endif diff --git a/subsys/jwt/jwt_legacy_ecdsa.c b/subsys/jwt/jwt_legacy_ecdsa.c deleted file mode 100644 index d8368280270d0..0000000000000 --- a/subsys/jwt/jwt_legacy_ecdsa.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2024 BayLibre SAS - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include "jwt.h" - -static TCCtrPrng_t prng_state; -static bool prng_init; - -static const char personalize[] = "zephyr:drivers/jwt/jwt.c"; - -static int setup_prng(void) -{ - if (prng_init) { - return 0; - } - prng_init = true; - - uint8_t entropy[TC_AES_KEY_SIZE + TC_AES_BLOCK_SIZE]; - - sys_rand_get(entropy, sizeof(entropy)); - - int res = tc_ctr_prng_init(&prng_state, (const uint8_t *)&entropy, sizeof(entropy), - personalize, sizeof(personalize)); - - return res == TC_CRYPTO_SUCCESS ? 0 : -EINVAL; -} - -/* This function is declared in - * modules/crypto/tinycrypt/lib/include/tinycrypt/ecc_platform_specific.h. - * - * TinyCrypt expects this function to be implemented somewhere when using the - * ECC module. - */ -int default_CSPRNG(uint8_t *dest, unsigned int size) -{ - int res = tc_ctr_prng_generate(&prng_state, NULL, 0, dest, size); - return res; -} - -int jwt_sign_impl(struct jwt_builder *builder, const unsigned char *der_key, size_t der_key_len, - unsigned char *sig, size_t sig_size) -{ - struct tc_sha256_state_struct ctx; - uint8_t hash[32]; - int res; - - ARG_UNUSED(sig_size); - - tc_sha256_init(&ctx); - tc_sha256_update(&ctx, builder->base, builder->buf - builder->base); - tc_sha256_final(hash, &ctx); - - res = setup_prng(); - - if (res != 0) { - return res; - } - - /* Note that tinycrypt only supports P-256. */ - res = uECC_sign(der_key, hash, sizeof(hash), sig, &curve_secp256r1); - if (res != TC_CRYPTO_SUCCESS) { - return -EINVAL; - } - - return 0; -} diff --git a/subsys/jwt/jwt_psa.c b/subsys/jwt/jwt_psa.c index edbafa6fefee5..ce5928c09bbd1 100644 --- a/subsys/jwt/jwt_psa.c +++ b/subsys/jwt/jwt_psa.c @@ -24,15 +24,15 @@ int jwt_sign_impl(struct jwt_builder *builder, const unsigned char *der_key, siz psa_algorithm_t alg; int ret; -#if defined(CONFIG_JWT_SIGN_ECDSA) +#if defined(CONFIG_JWT_SIGN_ECDSA_PSA) psa_set_key_type(&attr, PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1)); psa_set_key_algorithm(&attr, PSA_ALG_ECDSA(PSA_ALG_SHA_256)); alg = PSA_ALG_ECDSA(PSA_ALG_SHA_256); -#else /* CONFIG_JWT_SIGN_RSA */ +#else psa_set_key_type(&attr, PSA_KEY_TYPE_RSA_KEY_PAIR); psa_set_key_algorithm(&attr, PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256)); alg = PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256); -#endif /* CONFIG_JWT_SIGN_ECDSA || CONFIG_JWT_SIGN_RSA */ +#endif psa_set_key_usage_flags(&attr, PSA_KEY_USAGE_SIGN_MESSAGE); status = psa_import_key(&attr, der_key, der_key_len, &key_id); diff --git a/tests/subsys/jwt/src/jwt-test-private.c b/tests/subsys/jwt/src/jwt-test-private.c index a6fc98a8fb765..600eaf62d5b13 100644 --- a/tests/subsys/jwt/src/jwt-test-private.c +++ b/tests/subsys/jwt/src/jwt-test-private.c @@ -4,7 +4,7 @@ * */ -#if defined(CONFIG_JWT_SIGN_RSA) +#if defined(CONFIG_JWT_SIGN_RSA_PSA) || defined(CONFIG_JWT_SIGN_RSA_LEGACY) /* To generate the key in the correct format use the following command: * $ openssl genrsa 2048 | openssl rsa -outform DER | xxd -i @@ -113,7 +113,7 @@ unsigned char jwt_test_private_der[] = { 0x05, 0xfd, 0x71, 0xb0, 0x3e }; -#else /* CONFIG_JWT_SIGN_ECDSA */ +#else /* CONFIG_JWT_SIGN_ECDSA_PSA */ /* Here's how to generate the key in the correct format: * - generate the key using OpenSSL: diff --git a/tests/subsys/jwt/testcase.yaml b/tests/subsys/jwt/testcase.yaml index 6606780a9f1b2..f439e9aea9e1c 100644 --- a/tests/subsys/jwt/testcase.yaml +++ b/tests/subsys/jwt/testcase.yaml @@ -9,24 +9,17 @@ common: extra_configs: - CONFIG_TEST_RANDOM_GENERATOR=y tests: - libraries.encoding.jwt.ecdsa.legacy: - extra_configs: - - CONFIG_JWT_SIGN_ECDSA=y - - CONFIG_JWT_USE_LEGACY=y libraries.encoding.jwt.ecdsa.psa: extra_configs: - - CONFIG_JWT_SIGN_ECDSA=y - - CONFIG_JWT_USE_PSA=y + - CONFIG_JWT_SIGN_ECDSA_PSA=y - CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG=y - CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG_ALLOW_NON_CSPRNG=y libraries.encoding.jwt.rsa.legacy: filter: CSPRNG_ENABLED extra_configs: - - CONFIG_JWT_SIGN_RSA=y - - CONFIG_JWT_USE_LEGACY=y + - CONFIG_JWT_SIGN_RSA_LEGACY=y libraries.encoding.jwt.rsa.psa: extra_configs: - - CONFIG_JWT_SIGN_RSA=y - - CONFIG_JWT_USE_PSA=y + - CONFIG_JWT_SIGN_RSA_PSA=y - CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG=y - CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG_ALLOW_NON_CSPRNG=y From db967209ca6f3bcaf59d9bfdd4e30ff757d72acc Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Sat, 2 Nov 2024 08:08:54 +0100 Subject: [PATCH 2090/4482] Bluetooth: Controller: Fix spurious ISO Sync receiver stall Fix spurious ISO Sync Receiver stall due to uninitialised value accessed due to regression introduced by commit 64faceea7270 ("Bluetooth: controller: Stop Sync ISO ticker when establishment fails"). Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c index 2b17807f217ed..5eeba29b5e88c 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c @@ -427,6 +427,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) LL_ASSERT(e); e->type = EVENT_DONE_EXTRA_TYPE_SYNC_ISO; + e->estab_failed = 0U; e->trx_cnt = 0U; e->crc_valid = 0U; @@ -1281,6 +1282,7 @@ static void isr_rx_done(void *param) /* Calculate and place the drift information in done event */ e->type = EVENT_DONE_EXTRA_TYPE_SYNC_ISO; + e->estab_failed = 0U; e->trx_cnt = trx_cnt; e->crc_valid = crc_ok_anchor; From 4c5c434ea20d745a251e2ad063142969854133aa Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Wed, 30 Oct 2024 13:29:30 +0100 Subject: [PATCH 2091/4482] bluetooth: mesh: adv: legacy: Check suspended flag in the adv thread Instead of checking the `enabled` flag, check if BT_MESH_SUSPENDED is set in the legacy advertiser thread. BT_MESH_SUSPENDED is set earlier than advertiser is stopped and will prevent the advertiser send anything earlier. Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/mesh/adv_legacy.c | 31 ++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/subsys/bluetooth/mesh/adv_legacy.c b/subsys/bluetooth/mesh/adv_legacy.c index c79a118cf1554..207ff718566e4 100644 --- a/subsys/bluetooth/mesh/adv_legacy.c +++ b/subsys/bluetooth/mesh/adv_legacy.c @@ -38,7 +38,11 @@ LOG_MODULE_REGISTER(bt_mesh_adv_legacy); static struct k_thread adv_thread_data; static K_KERNEL_STACK_DEFINE(adv_thread_stack, CONFIG_BT_MESH_ADV_STACK_SIZE); static int32_t adv_timeout; -static bool enabled; + +static bool is_mesh_suspended(void) +{ + return atomic_test_bit(bt_mesh.flags, BT_MESH_SUSPENDED); +} static int bt_data_send(uint8_t num_events, uint16_t adv_int, const struct bt_data *ad, size_t ad_len, @@ -104,7 +108,7 @@ static int bt_data_send(uint8_t num_events, uint16_t adv_int, bt_mesh_adv_send_start(duration, err, ctx); } - if (enabled) { + if (!is_mesh_suspended()) { k_sleep(K_MSEC(duration)); } @@ -148,7 +152,7 @@ static void adv_thread(void *p1, void *p2, void *p3) LOG_DBG("started"); struct bt_mesh_adv *adv; - while (enabled) { + while (!is_mesh_suspended()) { if (IS_ENABLED(CONFIG_BT_MESH_GATT_SERVER)) { adv = bt_mesh_adv_get(K_NO_WAIT); if (IS_ENABLED(CONFIG_BT_MESH_PROXY_SOLICITATION) && !adv) { @@ -234,7 +238,13 @@ void bt_mesh_adv_init(void) int bt_mesh_adv_enable(void) { - enabled = true; + /* The advertiser thread relies on BT_MESH_SUSPENDED flag. No point in starting the + * advertiser thread if the flag is not set. + */ + if (is_mesh_suspended()) { + return -EINVAL; + } + k_thread_start(&adv_thread_data); return 0; } @@ -243,12 +253,21 @@ int bt_mesh_adv_disable(void) { int err; - enabled = false; + /* k_thread_join will sleep forever if BT_MESH_SUSPENDED flag is not set. The advertiser + * thread will exit once the flag is set. The flag is set by the higher layer function. Here + * we need to check that the flag is dropped and ensure that the thread is stopped. + */ + if (!is_mesh_suspended()) { + return -EINVAL; + } err = k_thread_join(&adv_thread_data, K_FOREVER); LOG_DBG("Advertising disabled: %d", err); - return 0; + /* Since the thread will immediately stop after this function call and won’t perform any + * further operations, it’s safe to ignore the deadlock error (EDEADLK). + */ + return err == -EDEADLK ? 0 : err; } int bt_mesh_adv_gatt_start(const struct bt_le_adv_param *param, int32_t duration, From 457a20c4a2a9225a865653c2312b23d8d32d13d3 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Wed, 30 Oct 2024 14:29:43 +0100 Subject: [PATCH 2092/4482] test: bsim: bluetooth: mesh: Wait until adv is actually sent k_sleep may not be enough to let advertiser send the message. Instead we should rely on the bt_mesh_send_cb. Signed-off-by: Pavel Vasilyev --- tests/bsim/bluetooth/mesh/src/mesh_test.c | 8 +++++- tests/bsim/bluetooth/mesh/src/mesh_test.h | 2 ++ tests/bsim/bluetooth/mesh/src/test_suspend.c | 26 ++++++++++++++++++-- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/tests/bsim/bluetooth/mesh/src/mesh_test.c b/tests/bsim/bluetooth/mesh/src/mesh_test.c index c092c9135b179..757e150c35013 100644 --- a/tests/bsim/bluetooth/mesh/src/mesh_test.c +++ b/tests/bsim/bluetooth/mesh/src/mesh_test.c @@ -569,11 +569,17 @@ uint16_t bt_mesh_test_own_addr_get(uint16_t start_addr) } void bt_mesh_test_send_over_adv(void *data, size_t len) +{ + bt_mesh_test_send_over_adv_cb(data, len, NULL, NULL); +} + +void bt_mesh_test_send_over_adv_cb(void *data, size_t len, const struct bt_mesh_send_cb *cb, + void *cb_data) { struct bt_mesh_adv *adv = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_ADV_TAG_LOCAL, BT_MESH_TRANSMIT(0, 20), K_NO_WAIT); net_buf_simple_add_mem(&adv->b, data, len); - bt_mesh_adv_send(adv, NULL, NULL); + bt_mesh_adv_send(adv, cb, cb_data); } int bt_mesh_test_wait_for_packet(bt_le_scan_cb_t scan_cb, struct k_sem *observer_sem, uint16_t wait) diff --git a/tests/bsim/bluetooth/mesh/src/mesh_test.h b/tests/bsim/bluetooth/mesh/src/mesh_test.h index d3af115c8814b..2a88d4156ca2b 100644 --- a/tests/bsim/bluetooth/mesh/src/mesh_test.h +++ b/tests/bsim/bluetooth/mesh/src/mesh_test.h @@ -204,6 +204,8 @@ void bt_mesh_test_ra_cb_setup(void (*cb)(uint8_t *, size_t)); uint16_t bt_mesh_test_own_addr_get(uint16_t start_addr); void bt_mesh_test_send_over_adv(void *data, size_t len); +void bt_mesh_test_send_over_adv_cb(void *data, size_t len, const struct bt_mesh_send_cb *cb, + void *cb_data); /* Wait for a packet (i. e. an advertisement or a GATT frame) sent by a device. * `scan_cb` is triggered if the packet is received, and must release `observer_sem` when finished. */ diff --git a/tests/bsim/bluetooth/mesh/src/test_suspend.c b/tests/bsim/bluetooth/mesh/src/test_suspend.c index 5ec6a8dc68525..58154f3744640 100644 --- a/tests/bsim/bluetooth/mesh/src/test_suspend.c +++ b/tests/bsim/bluetooth/mesh/src/test_suspend.c @@ -318,8 +318,29 @@ static void dut_pub_common(bool disable_bt) ASSERT_OK(bt_mesh_suspend()); } +static void send_start(uint16_t duration, int err, void *cb_data) +{ + if (err) { + FAIL("Failed to send message (err %d)", err); + } +} + +static void send_end(int err, void *cb_data) +{ + k_sem_give((struct k_sem *)cb_data); +} + static void dut_gatt_common(bool disable_bt) { + struct k_sem send_sem; + + k_sem_init(&send_sem, 0, 1); + + const struct bt_mesh_send_cb send_cb = { + .start = send_start, + .end = send_end, + }; + bt_mesh_test_cfg_set(NULL, WAIT_TIME); bt_mesh_device_setup(&prov, &comp); ASSERT_OK_MSG(bt_mesh_prov_enable(BT_MESH_PROV_GATT), "Failed to enable GATT provisioner"); @@ -336,8 +357,9 @@ static void dut_gatt_common(bool disable_bt) /* Send a mesh message to notify Tester that DUT is about to be suspended. */ dut_status = DUT_SUSPENDED; - bt_mesh_test_send_over_adv(&dut_status, sizeof(enum dut_mesh_status)); - k_sleep(K_MSEC(150)); + bt_mesh_test_send_over_adv_cb(&dut_status, sizeof(enum dut_mesh_status), &send_cb, + &send_sem); + ASSERT_OK(k_sem_take(&send_sem, K_MSEC(200))); ASSERT_OK_MSG(bt_mesh_suspend(), "Failed to suspend Mesh."); From 94ad822a339e06beafa653bcdb58ba20b1d6d4c2 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Tue, 5 Nov 2024 16:29:04 +0100 Subject: [PATCH 2093/4482] include: dt-bindings: regulator: nrf5x: Fix guards Fix the include guard mismatch. Found building with clang. Signed-off-by: Carles Cufi --- include/zephyr/dt-bindings/regulator/nrf5x.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/dt-bindings/regulator/nrf5x.h b/include/zephyr/dt-bindings/regulator/nrf5x.h index d2507c74a6ea4..1f4e048e9d1f1 100644 --- a/include/zephyr/dt-bindings/regulator/nrf5x.h +++ b/include/zephyr/dt-bindings/regulator/nrf5x.h @@ -4,7 +4,7 @@ */ #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_REGULATOR_NRF5X_H_ -#define ZEPHYR_INCLUDE_DT_BINDINGS_REGULATOR_NRF_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_REGULATOR_NRF5X_H_ /** * @defgroup regulator_nrf5x nRF5X regulator devicetree helpers. From 646775bf9e36c280ad62c8a1811edc030abf7b8c Mon Sep 17 00:00:00 2001 From: Daniel Baluta Date: Tue, 22 Oct 2024 11:41:25 +0300 Subject: [PATCH 2094/4482] manifest: hal_nxp: Pull in change to fix irqsteer mask computation This fixes irq_steer channel mask index computation for i.MX8MP platform. Signed-off-by: Daniel Baluta --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 6ee2aaa5e53c0..36be63ac83469 100644 --- a/west.yml +++ b/west.yml @@ -198,7 +198,7 @@ manifest: groups: - hal - name: hal_nxp - revision: 4a4741fa2be33f6b638a49e357c5e33bb7ad0544 + revision: ca9c81a06fbd3db10faf708194443511f1eadacb path: modules/hal/nxp groups: - hal From b9fbfc9a23167ed3c490d02ef91360195a7c40ec Mon Sep 17 00:00:00 2001 From: Lingao Meng Date: Tue, 24 Sep 2024 14:41:44 +0800 Subject: [PATCH 2095/4482] Bluetooth: Mesh: Introduce separate workq for ADV EXT this PR is to make the host always send packets. Signed-off-by: Lingao Meng --- doc/releases/release-notes-4.0.rst | 5 ++ subsys/bluetooth/mesh/Kconfig | 58 +++++++++++++++++++ subsys/bluetooth/mesh/adv.h | 2 + subsys/bluetooth/mesh/adv_ext.c | 39 +++++++++++-- subsys/bluetooth/mesh/adv_legacy.c | 5 ++ subsys/bluetooth/mesh/proxy_msg.c | 49 +++++++++++++++- subsys/bluetooth/mesh/proxy_msg.h | 3 + subsys/bluetooth/mesh/proxy_srv.c | 2 +- tests/bsim/bluetooth/mesh/compile.sh | 5 +- .../bluetooth/mesh/overlay_workq_sys.conf | 1 + tests/bsim/bluetooth/mesh/src/test_suspend.c | 3 + .../mesh/tests_scripts/advertiser/disable.sh | 3 + .../tests_scripts/advertiser/proxy_mixin.sh | 3 + .../tests_scripts/advertiser/random_order.sh | 3 + .../tests_scripts/advertiser/reverse_order.sh | 3 + .../tests_scripts/advertiser/send_order.sh | 3 + .../tests_scripts/advertiser/tx_cb_multi.sh | 3 + .../tests_scripts/advertiser/tx_cb_single.sh | 3 + .../tests_scripts/proxy_sol/sol_replay.sh | 12 ++++ 19 files changed, 197 insertions(+), 8 deletions(-) create mode 100644 tests/bsim/bluetooth/mesh/overlay_workq_sys.conf diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index dba6c620904ac..04f4a043ef9fe 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -148,6 +148,11 @@ Bluetooth * HCI Drivers +* Mesh + + * Introduced a mesh-specific workqueue to increase reliability of the mesh messages + transmission. To get the old behavior enable :kconfig:option:`CONFIG_BT_MESH_WORKQ_SYS`. + Boards & SoC Support ******************** diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 384033f79083e..37f15191c771c 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -103,6 +103,64 @@ menuconfig BT_MESH_ADV_EXT if BT_MESH_ADV_EXT +choice BT_MESH_WORKQ_CONTEXT + prompt "Advertising thread selection" + default BT_MESH_WORKQ_MESH + help + Defines a context for mesh messages transmission. + +config BT_MESH_WORKQ_MESH + bool "Mesh-specific workqueue" + help + When this option is selected, the mesh sends messages from the + mesh-specific workqueue. This will ensure that messages are always sent. + The application needs to ensure the mesh-specific workqueue size is large + enough. Refer to BT_MESH_ADV_STACK_SIZE for the recommended minimum. + +config BT_MESH_WORKQ_SYS + bool "System workqueue" + help + When this option is selected, the mesh sends messages from + the system work queue. The application needs to ensure the system + workqueue stack size (SYSTEM_WORKQUEUE_STACK_SIZE) is large enough, + refer to BT_MESH_ADV_STACK_SIZE for the recommended minimum. + + When this option is enabled and the mesh tries to send a message, + and the host ran out the HCI command buffers controlled by + CONFIG_BT_BUF_CMD_TX_COUNT, the host returns -ENOBUFS immediately + and the mesh drops the message transmission. To mitigate this + issue, make sure to have sufficient number of HCI command buffers. + When this option is enabled, the latency of sending mesh messages + will be affected by other users on the system work queue, resulting in + reduced reliability for sending mesh messages. + +endchoice + +if BT_MESH_WORKQ_MESH + +config BT_MESH_ADV_STACK_SIZE + int "Mesh extended advertiser thread stack size" + default 1536 if BT_MESH_PROXY + default 1024 if BT_HOST_CRYPTO + default 776 if BT_MESH_PRIV_BEACONS + default 768 + help + Size of bt mesh adv thread stack. + + NOTE: This is an advanced setting and should not be changed unless + absolutely necessary + +config BT_MESH_ADV_PRIO + int "Mesh advertiser thread priority" + default 7 + help + Priority of bt mesh adv thread. + + NOTE: This is an advanced setting and should not be changed unless + absolutely necessary + +endif # BT_MESH_WORKQ_MESH + config BT_MESH_RELAY_ADV_SETS int "Maximum of simultaneous relay message support" default 0 diff --git a/subsys/bluetooth/mesh/adv.h b/subsys/bluetooth/mesh/adv.h index cbe4f6e9adb8b..563a2118b711d 100644 --- a/subsys/bluetooth/mesh/adv.h +++ b/subsys/bluetooth/mesh/adv.h @@ -123,4 +123,6 @@ int bt_mesh_scan_active_set(bool active); int bt_mesh_adv_bt_data_send(uint8_t num_events, uint16_t adv_interval, const struct bt_data *ad, size_t ad_len); +int bt_mesh_wq_submit(struct k_work *work); + #endif /* ZEPHYR_SUBSYS_BLUETOOTH_MESH_ADV_H_ */ diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index b206b81b74342..2f790f5bc162e 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -33,6 +33,14 @@ LOG_MODULE_REGISTER(bt_mesh_adv_ext); #define CONFIG_BT_MESH_RELAY_ADV_SETS 0 #endif +#ifdef CONFIG_BT_MESH_ADV_STACK_SIZE +#define MESH_WORKQ_PRIORITY CONFIG_BT_MESH_ADV_PRIO +#define MESH_WORKQ_STACK_SIZE CONFIG_BT_MESH_ADV_STACK_SIZE +#else +#define MESH_WORKQ_PRIORITY 0 +#define MESH_WORKQ_STACK_SIZE 0 +#endif + enum { /** Controller is currently advertising */ ADV_FLAG_ACTIVE, @@ -69,6 +77,15 @@ struct bt_mesh_ext_adv { static void send_pending_adv(struct k_work *work); static bool schedule_send(struct bt_mesh_ext_adv *ext_adv); +static struct k_work_q bt_mesh_workq; +static K_KERNEL_STACK_DEFINE(thread_stack, MESH_WORKQ_STACK_SIZE); + +#if defined(CONFIG_BT_MESH_WORKQ_MESH) +#define MESH_WORKQ &bt_mesh_workq +#else /* CONFIG_BT_MESH_WORKQ_SYS */ +#define MESH_WORKQ &k_sys_work_q +#endif /* CONFIG_BT_MESH_WORKQ_MESH */ + static struct bt_mesh_ext_adv advs[] = { [0] = { .tags = ( @@ -258,7 +275,7 @@ static bool schedule_send_with_mask(struct bt_mesh_ext_adv *ext_adv, int ignore_ } atomic_clear_bit(ext_adv->flags, ADV_FLAG_SCHEDULE_PENDING); - k_work_submit(&ext_adv->work); + bt_mesh_wq_submit(&ext_adv->work); return true; } @@ -407,7 +424,7 @@ int bt_mesh_adv_terminate(struct bt_mesh_adv *adv) atomic_set_bit(ext_adv->flags, ADV_FLAG_SENT); - k_work_submit(&ext_adv->work); + bt_mesh_wq_submit(&ext_adv->work); return 0; } @@ -429,6 +446,13 @@ void bt_mesh_adv_init(void) for (int i = 0; i < ARRAY_SIZE(advs); i++) { (void)memcpy(&advs[i].adv_param, &adv_param, sizeof(adv_param)); } + + if (IS_ENABLED(CONFIG_BT_MESH_WORKQ_MESH)) { + k_work_queue_init(&bt_mesh_workq); + k_work_queue_start(&bt_mesh_workq, thread_stack, MESH_WORKQ_STACK_SIZE, + K_PRIO_COOP(MESH_WORKQ_PRIORITY), NULL); + k_thread_name_set(&bt_mesh_workq.thread, "BT MESH WQ"); + } } static struct bt_mesh_ext_adv *adv_instance_find(struct bt_le_ext_adv *instance) @@ -458,7 +482,7 @@ static void adv_sent(struct bt_le_ext_adv *instance, atomic_set_bit(ext_adv->flags, ADV_FLAG_SENT); - k_work_submit(&ext_adv->work); + bt_mesh_wq_submit(&ext_adv->work); } #if defined(CONFIG_BT_MESH_GATT_SERVER) @@ -503,13 +527,13 @@ int bt_mesh_adv_enable(void) int bt_mesh_adv_disable(void) { - int err; struct k_work_sync sync; + int err; for (int i = 0; i < ARRAY_SIZE(advs); i++) { atomic_set_bit(advs[i].flags, ADV_FLAG_SUSPENDING); - if (k_current_get() != &k_sys_work_q.thread || + if (k_current_get() != k_work_queue_thread_get(MESH_WORKQ) || (k_work_busy_get(&advs[i].work) & K_WORK_RUNNING) == 0) { k_work_flush(&advs[i].work, &sync); } @@ -562,3 +586,8 @@ int bt_mesh_adv_bt_data_send(uint8_t num_events, uint16_t adv_interval, { return bt_data_send(advs, num_events, adv_interval, ad, ad_len); } + +int bt_mesh_wq_submit(struct k_work *work) +{ + return k_work_submit_to_queue(MESH_WORKQ, work); +} diff --git a/subsys/bluetooth/mesh/adv_legacy.c b/subsys/bluetooth/mesh/adv_legacy.c index 207ff718566e4..3048adc4170fb 100644 --- a/subsys/bluetooth/mesh/adv_legacy.c +++ b/subsys/bluetooth/mesh/adv_legacy.c @@ -277,3 +277,8 @@ int bt_mesh_adv_gatt_start(const struct bt_le_adv_param *param, int32_t duration adv_timeout = duration; return bt_le_adv_start(param, ad, ad_len, sd, sd_len); } + +int bt_mesh_wq_submit(struct k_work *work) +{ + return k_work_submit(work); +} diff --git a/subsys/bluetooth/mesh/proxy_msg.c b/subsys/bluetooth/mesh/proxy_msg.c index e2818f8634bf6..861935f58ccf7 100644 --- a/subsys/bluetooth/mesh/proxy_msg.c +++ b/subsys/bluetooth/mesh/proxy_msg.c @@ -64,6 +64,15 @@ static void proxy_sar_timeout(struct k_work *work) LOG_WRN("Proxy SAR timeout"); role = CONTAINER_OF(dwork, struct bt_mesh_proxy_role, sar_timer); + + while (!k_fifo_is_empty(&role->pending)) { + struct bt_mesh_adv *adv = k_fifo_get(&role->pending, K_NO_WAIT); + + __ASSERT_NO_MSG(adv); + + bt_mesh_adv_unref(adv); + } + if (role->conn) { bt_conn_disconnect(role->conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN); @@ -200,7 +209,7 @@ static void buf_send_end(struct bt_conn *conn, void *user_data) bt_mesh_adv_unref(adv); } -int bt_mesh_proxy_relay_send(struct bt_conn *conn, struct bt_mesh_adv *adv) +static int proxy_relay_send(struct bt_conn *conn, struct bt_mesh_adv *adv) { int err; @@ -230,6 +239,41 @@ int bt_mesh_proxy_relay_send(struct bt_conn *conn, struct bt_mesh_adv *adv) return err; } +int bt_mesh_proxy_relay_send(struct bt_conn *conn, struct bt_mesh_adv *adv) +{ + struct bt_mesh_proxy_role *role = &roles[bt_conn_index(conn)]; + + k_fifo_put(&role->pending, bt_mesh_adv_ref(adv)); + + bt_mesh_wq_submit(&role->work); + + return 0; +} + +static void proxy_msg_send_pending(struct k_work *work) +{ + struct bt_mesh_proxy_role *role; + struct k_work_delayable *dwork = k_work_delayable_from_work(work); + struct bt_mesh_adv *adv; + + role = CONTAINER_OF(dwork, struct bt_mesh_proxy_role, sar_timer); + if (!role->conn) { + return; + } + + adv = k_fifo_get(&role->pending, K_NO_WAIT); + if (!adv) { + return; + } + + (void)proxy_relay_send(role->conn, adv); + bt_mesh_adv_unref(adv); + + if (!k_fifo_is_empty(&role->pending)) { + bt_mesh_wq_submit(&role->work); + } +} + static void proxy_msg_init(struct bt_mesh_proxy_role *role) { /* Check if buf has been allocated, in this way, we no longer need @@ -247,6 +291,9 @@ static void proxy_msg_init(struct bt_mesh_proxy_role *role) net_buf_simple_reset(&role->buf); + k_fifo_init(&role->pending); + k_work_init(&role->work, proxy_msg_send_pending); + k_work_init_delayable(&role->sar_timer, proxy_sar_timeout); } diff --git a/subsys/bluetooth/mesh/proxy_msg.h b/subsys/bluetooth/mesh/proxy_msg.h index 7ad4be7ae5d37..99564b716933d 100644 --- a/subsys/bluetooth/mesh/proxy_msg.h +++ b/subsys/bluetooth/mesh/proxy_msg.h @@ -37,6 +37,9 @@ struct bt_mesh_proxy_role { struct bt_conn *conn; uint8_t msg_type; + struct k_fifo pending; + struct k_work work; + struct { proxy_send_cb_t send; proxy_recv_cb_t recv; diff --git a/subsys/bluetooth/mesh/proxy_srv.c b/subsys/bluetooth/mesh/proxy_srv.c index 8855f021734e3..476006b4eee39 100644 --- a/subsys/bluetooth/mesh/proxy_srv.c +++ b/subsys/bluetooth/mesh/proxy_srv.c @@ -916,7 +916,7 @@ static ssize_t proxy_ccc_write(struct bt_conn *conn, client = find_client(conn); if (client->filter_type == NONE) { client->filter_type = ACCEPT; - k_work_submit(&client->send_beacons); + bt_mesh_wq_submit(&client->send_beacons); } return sizeof(value); diff --git a/tests/bsim/bluetooth/mesh/compile.sh b/tests/bsim/bluetooth/mesh/compile.sh index aa86e6ccb25cc..05c51f7bfe1e0 100755 --- a/tests/bsim/bluetooth/mesh/compile.sh +++ b/tests/bsim/bluetooth/mesh/compile.sh @@ -15,12 +15,15 @@ app=tests/bsim/bluetooth/mesh conf_overlay=overlay_pst.conf compile app=tests/bsim/bluetooth/mesh conf_overlay=overlay_gatt.conf compile app=tests/bsim/bluetooth/mesh conf_overlay=overlay_low_lat.conf compile app=tests/bsim/bluetooth/mesh conf_overlay=overlay_psa.conf compile +app=tests/bsim/bluetooth/mesh conf_overlay=overlay_workq_sys.conf compile app=tests/bsim/bluetooth/mesh conf_overlay="overlay_pst.conf;overlay_psa.conf" compile app=tests/bsim/bluetooth/mesh conf_overlay="overlay_gatt.conf;overlay_psa.conf" compile +app=tests/bsim/bluetooth/mesh conf_overlay="overlay_gatt.conf;overlay_workq_sys.conf" compile app=tests/bsim/bluetooth/mesh conf_overlay="overlay_low_lat.conf;overlay_psa.conf" compile app=tests/bsim/bluetooth/mesh conf_overlay="overlay_gatt.conf;overlay_low_lat.conf" compile app=tests/bsim/bluetooth/mesh conf_overlay="overlay_pst.conf;overlay_gatt.conf" compile app=tests/bsim/bluetooth/mesh \ conf_overlay="overlay_pst.conf;overlay_gatt.conf;overlay_psa.conf" compile - +app=tests/bsim/bluetooth/mesh \ + conf_overlay="overlay_pst.conf;overlay_gatt.conf;overlay_workq_sys.conf" compile wait_for_background_jobs diff --git a/tests/bsim/bluetooth/mesh/overlay_workq_sys.conf b/tests/bsim/bluetooth/mesh/overlay_workq_sys.conf new file mode 100644 index 0000000000000..b4ee51bf8d54e --- /dev/null +++ b/tests/bsim/bluetooth/mesh/overlay_workq_sys.conf @@ -0,0 +1 @@ +CONFIG_BT_MESH_WORKQ_SYS=y diff --git a/tests/bsim/bluetooth/mesh/src/test_suspend.c b/tests/bsim/bluetooth/mesh/src/test_suspend.c index 58154f3744640..34a2ac408957a 100644 --- a/tests/bsim/bluetooth/mesh/src/test_suspend.c +++ b/tests/bsim/bluetooth/mesh/src/test_suspend.c @@ -295,6 +295,9 @@ static void dut_pub_common(bool disable_bt) ASSERT_OK_MSG(k_sem_take(&publish_sem, K_SECONDS(30)), "Pub timed out"); } + /* Allow publishing to finish before suspending. */ + k_sleep(K_MSEC(100)); + ASSERT_OK_MSG(bt_mesh_suspend(), "Failed to suspend Mesh."); if (disable_bt) { diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/disable.sh b/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/disable.sh index 50d2a53a16dc4..d0288a3964b93 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/disable.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/disable.sh @@ -36,3 +36,6 @@ RunTest mesh_adv_disable adv_tx_disable adv_rx_disable # Low latency overlay uses legacy advertiser overlay=overlay_low_lat_conf RunTest mesh_adv_disable adv_tx_disable adv_rx_disable + +overlay=overlay_workq_sys_conf +RunTest mesh_adv_disable_workq adv_tx_disable adv_rx_disable diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/proxy_mixin.sh b/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/proxy_mixin.sh index 6c49d03fe9f88..fb6af48f65180 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/proxy_mixin.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/proxy_mixin.sh @@ -21,5 +21,8 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh overlay=overlay_gatt_conf RunTest mesh_adv_proxy_mixin adv_tx_proxy_mixin adv_rx_proxy_mixin +overlay=overlay_gatt_conf_overlay_workq_sys_conf +RunTest mesh_adv_proxy_mixin_workq adv_tx_proxy_mixin adv_rx_proxy_mixin + overlay="overlay_gatt_conf_overlay_psa_conf" RunTest mesh_adv_proxy_mixin_psa adv_tx_proxy_mixin adv_rx_proxy_mixin diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/random_order.sh b/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/random_order.sh index a171ffd60f35b..5808d2cd5086d 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/random_order.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/random_order.sh @@ -7,5 +7,8 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # test buffer management by filling buffers and sending them in random order. RunTest mesh_adv_random_order adv_tx_random_order adv_rx_random_order +overlay=overlay_workq_sys_conf +RunTest mesh_adv_random_order_workq adv_tx_random_order adv_rx_random_order + overlay=overlay_psa_conf RunTest mesh_adv_random_order_psa adv_tx_random_order adv_rx_random_order diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/reverse_order.sh b/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/reverse_order.sh index 2b047138109ba..1428833a35b0d 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/reverse_order.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/reverse_order.sh @@ -7,5 +7,8 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # test buffer management by filling all the buffer and sending them in reversed order. RunTest mesh_adv_reverse_order adv_tx_reverse_order adv_rx_receive_order +overlay=overlay_workq_sys_conf +RunTest mesh_adv_reverse_order_workq adv_tx_reverse_order adv_rx_receive_order + overlay=overlay_psa_conf RunTest mesh_adv_reverse_order_psa adv_tx_reverse_order adv_rx_receive_order diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/send_order.sh b/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/send_order.sh index a9e8d1ea86174..5122d7fdf0532 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/send_order.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/send_order.sh @@ -7,5 +7,8 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # test buffer management by filling all the buffer and sending them all in order. RunTest mesh_adv_send_order adv_tx_send_order adv_rx_receive_order +overlay=overlay_workq_sys_conf +RunTest mesh_adv_send_order_workq adv_tx_send_order adv_rx_receive_order + overlay=overlay_psa_conf RunTest mesh_adv_send_order_psa adv_tx_send_order adv_rx_receive_order diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/tx_cb_multi.sh b/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/tx_cb_multi.sh index 4ca2838ddf933..a7e3ec954371a 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/tx_cb_multi.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/tx_cb_multi.sh @@ -7,5 +7,8 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # test tx callbacks sequence for multiple advs RunTest mesh_adv_tx_cb_multi adv_tx_cb_multi +overlay=overlay_workq_sys_conf +RunTest mesh_adv_tx_cb_multi_workq adv_tx_cb_multi + overlay=overlay_psa_conf RunTest mesh_adv_tx_cb_multi_psa adv_tx_cb_multi diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/tx_cb_single.sh b/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/tx_cb_single.sh index a2b1ad0e9612d..48d81a6013640 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/tx_cb_single.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/advertiser/tx_cb_single.sh @@ -7,5 +7,8 @@ source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh # test tx callbacks parameters and xmit sequence for single adv RunTest mesh_adv_tx_cb_single adv_tx_cb_single adv_rx_xmit +overlay=overlay_workq_sys_conf +RunTest mesh_adv_tx_cb_single_workq adv_tx_cb_single adv_rx_xmit + overlay=overlay_psa_conf RunTest mesh_adv_tx_cb_single_psa adv_tx_cb_single adv_rx_xmit diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/proxy_sol/sol_replay.sh b/tests/bsim/bluetooth/mesh/tests_scripts/proxy_sol/sol_replay.sh index c3da4435eb104..02f7c93325416 100755 --- a/tests/bsim/bluetooth/mesh/tests_scripts/proxy_sol/sol_replay.sh +++ b/tests/bsim/bluetooth/mesh/tests_scripts/proxy_sol/sol_replay.sh @@ -32,6 +32,18 @@ RunTest mesh_srpl_replay_attack \ proxy_sol_iut_power_replay_attack \ -flash=../results/mesh_srpl_replay_attack/flash.bin -flash_rm +overlay="overlay_pst_conf_overlay_gatt_conf_overlay_workq_sys_conf" +RunTest mesh_srpl_replay_attack_workq \ + proxy_sol_tester_immediate_replay_attack \ + proxy_sol_iut_immediate_replay_attack \ + -flash=../results/mesh_srpl_replay_attack/flash.bin -flash_erase + +overlay="overlay_pst_conf_overlay_gatt_conf_overlay_workq_sys_conf" +RunTest mesh_srpl_replay_attack_workq \ + proxy_sol_tester_power_replay_attack \ + proxy_sol_iut_power_replay_attack \ + -flash=../results/mesh_srpl_replay_attack/flash.bin -flash_rm + overlay="overlay_pst_conf_overlay_gatt_conf_overlay_psa_conf" RunTest mesh_srpl_replay_attack_psa \ proxy_sol_tester_immediate_replay_attack \ From 87bb0b921252ab640aa43c41fdeabd121eccdd6a Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Thu, 31 Oct 2024 10:43:43 +0200 Subject: [PATCH 2096/4482] manifest: tf-m: update to 2.1.1 Update the TF-M repos to version 2.1.1. Signed-off-by: Tomi Fontanilles --- doc/releases/release-notes-4.0.rst | 7 +++++-- submanifests/optional.yaml | 2 +- west.yml | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 04f4a043ef9fe..77a092000bede 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -689,8 +689,11 @@ MCUboot OSDP **** -Trusted Firmware-M -****************** +Trusted Firmware-M (TF-M) +************************* + +* TF-M was updated to version 2.1.1 (from 2.1.0). + The release notes can be found at: https://trustedfirmware-m.readthedocs.io/en/tf-mv2.1.1/releases/2.1.1.html LVGL **** diff --git a/submanifests/optional.yaml b/submanifests/optional.yaml index c0c0d45e4ca2d..59e837c877fb8 100644 --- a/submanifests/optional.yaml +++ b/submanifests/optional.yaml @@ -46,7 +46,7 @@ manifest: groups: - optional - name: tf-m-tests - revision: d552e4f18b92032bd335d5e3aa312f6acd82a83b + revision: 502ea90105ee18f20c78f710e2ba2ded0fc0756e path: modules/tee/tf-m/tf-m-tests remote: upstream groups: diff --git a/west.yml b/west.yml index 36be63ac83469..4da2eab84bb9e 100644 --- a/west.yml +++ b/west.yml @@ -327,7 +327,7 @@ manifest: groups: - crypto - name: trusted-firmware-m - revision: a11cd27905aecc4416cfc85552bfc3b997375056 + revision: 8134106ef9cb3df60e8bd22b172532558e936bd2 path: modules/tee/tf-m/trusted-firmware-m groups: - tee From a1dc0b8b3e97542ca9f0c84cba37067710b61ccb Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Thu, 31 Oct 2024 20:24:57 +0000 Subject: [PATCH 2097/4482] drivers: disk: sdmmc_subsys: remove CONFIG_SDMMC_VOLUME_NAME Remove CONFIG_SDMMC_VOLUME_NAME, and set the disk name based on the ``disk-name`` property. This aligns with other disk drivers, and allows for multiple instances of the sdmmc_subsys disk driver to be registered. Add disk-name properties for all in tree definitions for the sdmmc-subsys disk driver, and change all in tree usage of the disk name Fixes #75004 Signed-off-by: Daniel DeGrasse --- .../adafruit_grand_central_m4_express.dts | 1 + boards/arduino/mkrzero/arduino_mkrzero.dts | 1 + boards/atmel/sam/sam4e_xpro/sam4e_xpro.dts | 1 + .../esp_wrover_kit/esp_wrover_kit_procpu.dts | 1 + .../bl5340_dvk_nrf5340_cpuapp_common.dtsi | 1 + boards/ezurio/mg100/mg100.dts | 1 + .../hardkernel/odroid_go/odroid_go_procpu.dts | 1 + .../intel_socfpga_agilex5_socdk.dts | 1 + .../m5stack_core2/m5stack_core2_procpu.dts | 1 + boards/madmachine/mm_swiftio/mm_swiftio.dts | 1 + ...nrf5340_audio_dk_nrf5340_cpuapp_common.dtsi | 1 + boards/nxp/frdm_k64f/frdm_k64f.dts | 1 + .../frdm_mcxn947_mcxn947_cpu0.dtsi | 1 + .../lpcxpresso55s69_lpc55s69_cpu0.dts | 1 + boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts | 1 + boards/nxp/mimxrt1024_evk/mimxrt1024_evk.dts | 1 + boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dts | 1 + boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dts | 1 + .../mimxrt1062_fmurt6/mimxrt1062_fmurt6.dts | 1 + boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts | 1 + .../mimxrt1170_evk_mimxrt1176_cm7.dts | 1 + .../mimxrt685_evk_mimxrt685s_cm33.dts | 1 + .../vmu_rt1170/vmu_rt1170_mimxrt1176_cm7.dts | 1 + .../olimex/olimexino_stm32/olimexino_stm32.dts | 1 + boards/pjrc/teensy4/teensy41.dts | 1 + .../rcar_h3ulcb/rcar_h3ulcb_r8a77951_a57.dts | 1 + boards/seeed/wio_terminal/wio_terminal.dts | 1 + .../xiao_esp32s3/xiao_esp32s3_procpu_sense.dts | 1 + .../dts/adafruit_2_8_tft_touch_v2.dtsi | 1 + .../adafruit_data_logger.overlay | 1 + .../seeed_xiao_expansion_board.overlay | 1 + .../seeed_xiao_round_display.overlay | 1 + .../sparkfun_carrier_asset_tracker.overlay | 1 + boards/shields/v2c_daplink/v2c_daplink.overlay | 1 + .../v2c_daplink/v2c_daplink_cfg.overlay | 1 + .../dts/waveshare_epaper_common.dtsi | 1 + .../sipeed/longan_nano/longan_nano-common.dtsi | 1 + doc/connectivity/usb/device/usb_device.rst | 10 +++++----- doc/services/storage/disk/access.rst | 1 + drivers/disk/Kconfig.sdmmc | 7 ------- drivers/disk/sdmmc_stm32.c | 2 +- drivers/disk/sdmmc_subsys.c | 18 +++++++++--------- dts/bindings/sd/zephyr,sdmmc-disk.yaml | 9 ++++++++- .../fs_sample/boards/hifive_unmatched.overlay | 1 + .../fs/fs_sample/boards/nrf52840_blip.overlay | 1 + .../fs/fs_sample/boards/nucleo_f429zi.overlay | 1 + samples/subsys/fs/fs_sample/src/main.c | 2 +- samples/subsys/fs/littlefs/README.rst | 6 +++--- samples/subsys/fs/littlefs/src/main.c | 2 +- subsys/fs/shell.c | 2 +- tests/drivers/build_all/disk/spi.dtsi | 1 + tests/drivers/disk/disk_access/src/main.c | 2 +- tests/drivers/disk/disk_performance/src/main.c | 2 +- .../stm32h747i_disco_stm32h747xx_m7.overlay | 6 ------ tests/lib/gui/lvgl/src/main.c | 2 +- .../fs/ext2/boards/hifive_unmatched.overlay | 1 + tests/subsys/fs/ext2/src/main.c | 2 +- tests/subsys/fs/fat_fs_api/src/test_fat.h | 2 +- 58 files changed, 77 insertions(+), 40 deletions(-) diff --git a/boards/adafruit/grand_central_m4_express/adafruit_grand_central_m4_express.dts b/boards/adafruit/grand_central_m4_express/adafruit_grand_central_m4_express.dts index 5cc038332b1ff..24ffdf89acfef 100644 --- a/boards/adafruit/grand_central_m4_express/adafruit_grand_central_m4_express.dts +++ b/boards/adafruit/grand_central_m4_express/adafruit_grand_central_m4_express.dts @@ -72,6 +72,7 @@ mmc { status = "okay"; compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; }; }; }; diff --git a/boards/arduino/mkrzero/arduino_mkrzero.dts b/boards/arduino/mkrzero/arduino_mkrzero.dts index b682e84aec894..a0f26d57fa0a6 100644 --- a/boards/arduino/mkrzero/arduino_mkrzero.dts +++ b/boards/arduino/mkrzero/arduino_mkrzero.dts @@ -89,6 +89,7 @@ spi-max-frequency = <1000000>; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/atmel/sam/sam4e_xpro/sam4e_xpro.dts b/boards/atmel/sam/sam4e_xpro/sam4e_xpro.dts index ddd73d0faeffb..253d5ba48d1d9 100644 --- a/boards/atmel/sam/sam4e_xpro/sam4e_xpro.dts +++ b/boards/atmel/sam/sam4e_xpro/sam4e_xpro.dts @@ -219,6 +219,7 @@ pinctrl-names = "default"; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/espressif/esp_wrover_kit/esp_wrover_kit_procpu.dts b/boards/espressif/esp_wrover_kit/esp_wrover_kit_procpu.dts index 757d15d006fea..3d37df9d5a7d9 100644 --- a/boards/espressif/esp_wrover_kit/esp_wrover_kit_procpu.dts +++ b/boards/espressif/esp_wrover_kit/esp_wrover_kit_procpu.dts @@ -209,6 +209,7 @@ mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_cpuapp_common.dtsi b/boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_cpuapp_common.dtsi index bd39a87266b66..c6986c7c87808 100644 --- a/boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_cpuapp_common.dtsi +++ b/boards/ezurio/bl5340_dvk/bl5340_dvk_nrf5340_cpuapp_common.dtsi @@ -252,6 +252,7 @@ spi-max-frequency = <8000000>; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/ezurio/mg100/mg100.dts b/boards/ezurio/mg100/mg100.dts index de091a3ab662c..18826ed8956a6 100644 --- a/boards/ezurio/mg100/mg100.dts +++ b/boards/ezurio/mg100/mg100.dts @@ -154,6 +154,7 @@ spi-max-frequency = <8000000>; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/hardkernel/odroid_go/odroid_go_procpu.dts b/boards/hardkernel/odroid_go/odroid_go_procpu.dts index 108e503cec47c..4553b7e338bd0 100644 --- a/boards/hardkernel/odroid_go/odroid_go_procpu.dts +++ b/boards/hardkernel/odroid_go/odroid_go_procpu.dts @@ -144,6 +144,7 @@ status = "okay"; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; spi-max-frequency = <20000000>; diff --git a/boards/intel/socfpga/agilex5_socdk/intel_socfpga_agilex5_socdk.dts b/boards/intel/socfpga/agilex5_socdk/intel_socfpga_agilex5_socdk.dts index d2f6c4370a379..6b185154fa697 100644 --- a/boards/intel/socfpga/agilex5_socdk/intel_socfpga_agilex5_socdk.dts +++ b/boards/intel/socfpga/agilex5_socdk/intel_socfpga_agilex5_socdk.dts @@ -26,6 +26,7 @@ mmc { /*SD Disk Access */ compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/m5stack/m5stack_core2/m5stack_core2_procpu.dts b/boards/m5stack/m5stack_core2/m5stack_core2_procpu.dts index e9bf8d0da33fe..5ab9ad9eacd6a 100644 --- a/boards/m5stack/m5stack_core2/m5stack_core2_procpu.dts +++ b/boards/m5stack/m5stack_core2/m5stack_core2_procpu.dts @@ -217,6 +217,7 @@ spi-max-frequency = <20000000>; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; diff --git a/boards/madmachine/mm_swiftio/mm_swiftio.dts b/boards/madmachine/mm_swiftio/mm_swiftio.dts index 14af45b01b800..cbdf85c3c12e6 100644 --- a/boards/madmachine/mm_swiftio/mm_swiftio.dts +++ b/boards/madmachine/mm_swiftio/mm_swiftio.dts @@ -186,6 +186,7 @@ pinctrl-names = "default", "slow", "med", "fast"; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpuapp_common.dtsi b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpuapp_common.dtsi index 71c05529cc17a..f29db4cfeb2c3 100644 --- a/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpuapp_common.dtsi +++ b/boards/nordic/nrf5340_audio_dk/nrf5340_audio_dk_nrf5340_cpuapp_common.dtsi @@ -214,6 +214,7 @@ arduino_spi: &spi4 { status = "okay"; sdmmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; diff --git a/boards/nxp/frdm_k64f/frdm_k64f.dts b/boards/nxp/frdm_k64f/frdm_k64f.dts index 8e91aa8cfb99d..9cb864ccf3897 100644 --- a/boards/nxp/frdm_k64f/frdm_k64f.dts +++ b/boards/nxp/frdm_k64f/frdm_k64f.dts @@ -163,6 +163,7 @@ arduino_spi: &spi0 { status = "okay"; sdmmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; spi-max-frequency = <24000000>; diff --git a/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi b/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi index cad61c08cbf7c..d2483b4ec0840 100644 --- a/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi +++ b/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi @@ -166,6 +166,7 @@ status = "okay"; sdmmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/nxp/lpcxpresso55s69/lpcxpresso55s69_lpc55s69_cpu0.dts b/boards/nxp/lpcxpresso55s69/lpcxpresso55s69_lpc55s69_cpu0.dts index 82f0e9e330d3b..e87cb04fc7996 100644 --- a/boards/nxp/lpcxpresso55s69/lpcxpresso55s69_lpc55s69_cpu0.dts +++ b/boards/nxp/lpcxpresso55s69/lpcxpresso55s69_lpc55s69_cpu0.dts @@ -121,6 +121,7 @@ pinctrl-names = "default"; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts b/boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts index 955f363c8a44d..6c3d096ff8ecb 100644 --- a/boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts +++ b/boards/nxp/mimxrt1020_evk/mimxrt1020_evk.dts @@ -206,6 +206,7 @@ zephyr_udc0: &usb1 { pwr-gpios = <&gpio3 24 GPIO_ACTIVE_HIGH>; sdmmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/nxp/mimxrt1024_evk/mimxrt1024_evk.dts b/boards/nxp/mimxrt1024_evk/mimxrt1024_evk.dts index 3cb80ddfd78cd..bc20298898a71 100644 --- a/boards/nxp/mimxrt1024_evk/mimxrt1024_evk.dts +++ b/boards/nxp/mimxrt1024_evk/mimxrt1024_evk.dts @@ -241,6 +241,7 @@ zephyr_udc0: &usb1 { no-1-8-v; sdmmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dts b/boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dts index 846782af5d975..3879b04cb506a 100644 --- a/boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dts +++ b/boards/nxp/mimxrt1050_evk/mimxrt1050_evk.dts @@ -221,6 +221,7 @@ zephyr_udc0: &usb1 { pinctrl-names = "default", "slow", "med", "fast"; sdmmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dts b/boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dts index c6879a2417033..84dbaac3ae4a9 100644 --- a/boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dts +++ b/boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dts @@ -229,6 +229,7 @@ zephyr_udc0: &usb1 { pinctrl-names = "default", "slow", "med", "fast"; sdmmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/nxp/mimxrt1062_fmurt6/mimxrt1062_fmurt6.dts b/boards/nxp/mimxrt1062_fmurt6/mimxrt1062_fmurt6.dts index 780e792eca69b..9d124b7b2c306 100644 --- a/boards/nxp/mimxrt1062_fmurt6/mimxrt1062_fmurt6.dts +++ b/boards/nxp/mimxrt1062_fmurt6/mimxrt1062_fmurt6.dts @@ -420,6 +420,7 @@ zephyr_udc0: &usb1 { pinctrl-names = "default", "slow", "med", "fast"; sdmmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts b/boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts index 1a3d76ce75341..8d9f2437d6a80 100644 --- a/boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts +++ b/boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts @@ -276,6 +276,7 @@ zephyr_udc0: &usb1 { pinctrl-names = "default", "slow", "med", "fast"; sdmmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7.dts b/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7.dts index f01c8f7f43117..7e2a6c182fb7c 100644 --- a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7.dts +++ b/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7.dts @@ -118,6 +118,7 @@ nxp_mipi_i2c: &lpi2c5 { pwr-gpios = <&gpio10 2 GPIO_ACTIVE_LOW>; sdmmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/nxp/mimxrt685_evk/mimxrt685_evk_mimxrt685s_cm33.dts b/boards/nxp/mimxrt685_evk/mimxrt685_evk_mimxrt685s_cm33.dts index d211e26d3375a..bc091a2abf424 100644 --- a/boards/nxp/mimxrt685_evk/mimxrt685_evk_mimxrt685s_cm33.dts +++ b/boards/nxp/mimxrt685_evk/mimxrt685_evk_mimxrt685s_cm33.dts @@ -344,6 +344,7 @@ i2s1: &flexcomm3 { cd-gpios = <&gpio2 9 GPIO_ACTIVE_LOW>; sdmmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; pinctrl-0 = <&pinmux_usdhc>; diff --git a/boards/nxp/vmu_rt1170/vmu_rt1170_mimxrt1176_cm7.dts b/boards/nxp/vmu_rt1170/vmu_rt1170_mimxrt1176_cm7.dts index 53d7818b0b75a..205b2149c8b6e 100644 --- a/boards/nxp/vmu_rt1170/vmu_rt1170_mimxrt1176_cm7.dts +++ b/boards/nxp/vmu_rt1170/vmu_rt1170_mimxrt1176_cm7.dts @@ -459,6 +459,7 @@ cd-gpios = <&gpio3 31 (GPIO_ACTIVE_LOW | GPIO_PULL_DOWN)>; sdmmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/olimex/olimexino_stm32/olimexino_stm32.dts b/boards/olimex/olimexino_stm32/olimexino_stm32.dts index 8c3a3b1491a10..604c58a94fa49 100644 --- a/boards/olimex/olimexino_stm32/olimexino_stm32.dts +++ b/boards/olimex/olimexino_stm32/olimexino_stm32.dts @@ -136,6 +136,7 @@ uext_serial: &usart1 {}; spi-max-frequency = <24000000>; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/pjrc/teensy4/teensy41.dts b/boards/pjrc/teensy4/teensy41.dts index c742bcc8009f1..98fc9aa4f4ce2 100644 --- a/boards/pjrc/teensy4/teensy41.dts +++ b/boards/pjrc/teensy4/teensy41.dts @@ -71,6 +71,7 @@ pinctrl-names = "default", "slow", "med", "fast"; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/renesas/rcar_h3ulcb/rcar_h3ulcb_r8a77951_a57.dts b/boards/renesas/rcar_h3ulcb/rcar_h3ulcb_r8a77951_a57.dts index 117b6bb4e741b..8c470e05538e8 100644 --- a/boards/renesas/rcar_h3ulcb/rcar_h3ulcb_r8a77951_a57.dts +++ b/boards/renesas/rcar_h3ulcb/rcar_h3ulcb_r8a77951_a57.dts @@ -66,6 +66,7 @@ pinctrl-names = "default", "uhs"; disk { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; diff --git a/boards/seeed/wio_terminal/wio_terminal.dts b/boards/seeed/wio_terminal/wio_terminal.dts index 42df242515ad3..27d24604f44cc 100644 --- a/boards/seeed/wio_terminal/wio_terminal.dts +++ b/boards/seeed/wio_terminal/wio_terminal.dts @@ -277,6 +277,7 @@ spi-max-frequency = <24000000>; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; }; }; }; diff --git a/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.dts b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.dts index 1fc6f2560d7fa..4dd7a68abced5 100644 --- a/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.dts +++ b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.dts @@ -64,6 +64,7 @@ status = "okay"; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; spi-max-frequency = <20000000>; diff --git a/boards/shields/adafruit_2_8_tft_touch_v2/dts/adafruit_2_8_tft_touch_v2.dtsi b/boards/shields/adafruit_2_8_tft_touch_v2/dts/adafruit_2_8_tft_touch_v2.dtsi index d4ecb5e20d6ec..b2df10395b14c 100644 --- a/boards/shields/adafruit_2_8_tft_touch_v2/dts/adafruit_2_8_tft_touch_v2.dtsi +++ b/boards/shields/adafruit_2_8_tft_touch_v2/dts/adafruit_2_8_tft_touch_v2.dtsi @@ -58,6 +58,7 @@ spi-max-frequency = <24000000>; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/shields/adafruit_data_logger/adafruit_data_logger.overlay b/boards/shields/adafruit_data_logger/adafruit_data_logger.overlay index 00d4876736dc4..1d3ffb8fc7573 100644 --- a/boards/shields/adafruit_data_logger/adafruit_data_logger.overlay +++ b/boards/shields/adafruit_data_logger/adafruit_data_logger.overlay @@ -43,6 +43,7 @@ sdmmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/shields/seeed_xiao_expansion_board/seeed_xiao_expansion_board.overlay b/boards/shields/seeed_xiao_expansion_board/seeed_xiao_expansion_board.overlay index b61e2c85fc549..54405f39d73d7 100644 --- a/boards/shields/seeed_xiao_expansion_board/seeed_xiao_expansion_board.overlay +++ b/boards/shields/seeed_xiao_expansion_board/seeed_xiao_expansion_board.overlay @@ -60,6 +60,7 @@ status = "okay"; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; spi-max-frequency = <24000000>; diff --git a/boards/shields/seeed_xiao_round_display/seeed_xiao_round_display.overlay b/boards/shields/seeed_xiao_round_display/seeed_xiao_round_display.overlay index d959fb4b391b9..9e0540d8231c5 100644 --- a/boards/shields/seeed_xiao_round_display/seeed_xiao_round_display.overlay +++ b/boards/shields/seeed_xiao_round_display/seeed_xiao_round_display.overlay @@ -89,6 +89,7 @@ status = "okay"; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; spi-max-frequency = ; diff --git a/boards/shields/sparkfun_carrier_asset_tracker/sparkfun_carrier_asset_tracker.overlay b/boards/shields/sparkfun_carrier_asset_tracker/sparkfun_carrier_asset_tracker.overlay index 6c7a9383c27f0..8341690076325 100644 --- a/boards/shields/sparkfun_carrier_asset_tracker/sparkfun_carrier_asset_tracker.overlay +++ b/boards/shields/sparkfun_carrier_asset_tracker/sparkfun_carrier_asset_tracker.overlay @@ -35,6 +35,7 @@ status = "okay"; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; spi-max-frequency = ; diff --git a/boards/shields/v2c_daplink/v2c_daplink.overlay b/boards/shields/v2c_daplink/v2c_daplink.overlay index 2ecc1feeb007d..110971cafbb3e 100644 --- a/boards/shields/v2c_daplink/v2c_daplink.overlay +++ b/boards/shields/v2c_daplink/v2c_daplink.overlay @@ -41,6 +41,7 @@ spi-max-frequency = <25000000>; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/shields/v2c_daplink/v2c_daplink_cfg.overlay b/boards/shields/v2c_daplink/v2c_daplink_cfg.overlay index 0a00a2792bb78..1a4c31d719958 100644 --- a/boards/shields/v2c_daplink/v2c_daplink_cfg.overlay +++ b/boards/shields/v2c_daplink/v2c_daplink_cfg.overlay @@ -33,6 +33,7 @@ spi-max-frequency = <25000000>; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/shields/waveshare_epaper/dts/waveshare_epaper_common.dtsi b/boards/shields/waveshare_epaper/dts/waveshare_epaper_common.dtsi index 9e62469af645f..80480cf5787f8 100644 --- a/boards/shields/waveshare_epaper/dts/waveshare_epaper_common.dtsi +++ b/boards/shields/waveshare_epaper/dts/waveshare_epaper_common.dtsi @@ -16,6 +16,7 @@ spi-max-frequency = <24000000>; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/boards/sipeed/longan_nano/longan_nano-common.dtsi b/boards/sipeed/longan_nano/longan_nano-common.dtsi index c5e9202e94f25..b5ec0c06a7ffa 100644 --- a/boards/sipeed/longan_nano/longan_nano-common.dtsi +++ b/boards/sipeed/longan_nano/longan_nano-common.dtsi @@ -170,6 +170,7 @@ spi-max-frequency = <24000000>; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; }; diff --git a/doc/connectivity/usb/device/usb_device.rst b/doc/connectivity/usb/device/usb_device.rst index e0f5b9fc23932..f98a5f4c62dad 100644 --- a/doc/connectivity/usb/device/usb_device.rst +++ b/doc/connectivity/usb/device/usb_device.rst @@ -321,11 +321,11 @@ access and expose a RAM disk, emulated block device on a flash partition, or SD Card to the host. Only one disk instance can be exported at a time. The disc to be used by the implementation is set by the -:kconfig:option:`CONFIG_MASS_STORAGE_DISK_NAME` and should be the same as the name -used by the disc access driver that the application wants to expose to the host. -SD card disk drivers use options :kconfig:option:`CONFIG_MMC_VOLUME_NAME` or -:kconfig:option:`CONFIG_SDMMC_VOLUME_NAME`, and flash and RAM disk drivers use -node property ``disk-name`` to set the disk name. +:kconfig:option:`CONFIG_MASS_STORAGE_DISK_NAME` and should be the same as the +name used by the disc access driver that the application wants to expose to the +host. MMC disk drivers use option :kconfig:option:`CONFIG_MMC_VOLUME_NAME`, or +flash, RAM, and SDMMC disk drivers use node property ``disk-name`` to set +the disk name. For the emulated block device on a flash partition, the flash partition and flash disk to be used must be described in the devicetree. If a storage partition diff --git a/doc/services/storage/disk/access.rst b/doc/services/storage/disk/access.rst index 7cc5fe12f5419..047a47478ccf4 100644 --- a/doc/services/storage/disk/access.rst +++ b/doc/services/storage/disk/access.rst @@ -78,6 +78,7 @@ at 24 MHz once the SD card has been initialized: status = "okay"; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; spi-max-frequency = <24000000>; diff --git a/drivers/disk/Kconfig.sdmmc b/drivers/disk/Kconfig.sdmmc index 9b49d3d40c21e..42d82676b18f2 100644 --- a/drivers/disk/Kconfig.sdmmc +++ b/drivers/disk/Kconfig.sdmmc @@ -20,13 +20,6 @@ config SD_INIT_PRIORITY help SDMMC controller driver initialization priority. -config SDMMC_VOLUME_NAME - string "SDMMC Disk mount point or drive name" - default "SD" if FAT_FILESYSTEM_ELM - default "SDMMC" - help - Disk name as per file system naming guidelines. - config SDMMC_SUBSYS bool "SDMMC access via SD subsystem" select SDMMC_STACK diff --git a/drivers/disk/sdmmc_stm32.c b/drivers/disk/sdmmc_stm32.c index faf9564a9fb0d..114e7d6b467ab 100644 --- a/drivers/disk/sdmmc_stm32.c +++ b/drivers/disk/sdmmc_stm32.c @@ -537,7 +537,7 @@ static const struct disk_operations stm32_sdmmc_ops = { }; static struct disk_info stm32_sdmmc_info = { - .name = CONFIG_SDMMC_VOLUME_NAME, + .name = "SD", .ops = &stm32_sdmmc_ops, }; diff --git a/drivers/disk/sdmmc_subsys.c b/drivers/disk/sdmmc_subsys.c index 4eb61c90e7f85..500471d4d659d 100644 --- a/drivers/disk/sdmmc_subsys.c +++ b/drivers/disk/sdmmc_subsys.c @@ -26,7 +26,7 @@ struct sdmmc_config { struct sdmmc_data { struct sd_card card; enum sd_status status; - char *name; + struct disk_info *disk_info; }; @@ -111,19 +111,13 @@ static const struct disk_operations sdmmc_disk_ops = { .ioctl = disk_sdmmc_access_ioctl, }; -static struct disk_info sdmmc_disk = { - .ops = &sdmmc_disk_ops, -}; - static int disk_sdmmc_init(const struct device *dev) { struct sdmmc_data *data = dev->data; data->status = SD_UNINIT; - sdmmc_disk.dev = dev; - sdmmc_disk.name = data->name; - return disk_access_register(&sdmmc_disk); + return disk_access_register(data->disk_info); } #define DISK_ACCESS_SDMMC_INIT(n) \ @@ -131,8 +125,14 @@ static int disk_sdmmc_init(const struct device *dev) .host_controller = DEVICE_DT_GET(DT_INST_PARENT(n)), \ }; \ \ + static struct disk_info sdmmc_disk_##n = { \ + .name = DT_INST_PROP(n, disk_name), \ + .ops = &sdmmc_disk_ops, \ + .dev = DEVICE_DT_INST_GET(n), \ + }; \ + \ static struct sdmmc_data sdmmc_data_##n = { \ - .name = CONFIG_SDMMC_VOLUME_NAME, \ + .disk_info = &sdmmc_disk_##n, \ }; \ \ DEVICE_DT_INST_DEFINE(n, \ diff --git a/dts/bindings/sd/zephyr,sdmmc-disk.yaml b/dts/bindings/sd/zephyr,sdmmc-disk.yaml index bdf84a86db247..866e99da7c94c 100644 --- a/dts/bindings/sd/zephyr,sdmmc-disk.yaml +++ b/dts/bindings/sd/zephyr,sdmmc-disk.yaml @@ -1,5 +1,5 @@ description: | - Zephyr MMC disk node. A binding with this compatible present within an SD + Zephyr SDMMC disk node. A binding with this compatible present within an SD host controller device node indicates that an SDMMC disk is attached to that SD bus. This binding will enable that disk to be used with the disk driver API and any subsystems that utilize it. @@ -7,3 +7,10 @@ description: | compatible: "zephyr,sdmmc-disk" include: [sd-device.yaml] + +properties: + disk-name: + type: string + required: true + description: | + Disk name. diff --git a/samples/subsys/fs/fs_sample/boards/hifive_unmatched.overlay b/samples/subsys/fs/fs_sample/boards/hifive_unmatched.overlay index e2daf505227e9..45f299c3ecfbb 100644 --- a/samples/subsys/fs/fs_sample/boards/hifive_unmatched.overlay +++ b/samples/subsys/fs/fs_sample/boards/hifive_unmatched.overlay @@ -13,6 +13,7 @@ status = "okay"; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; spi-max-frequency = <20000000>; diff --git a/samples/subsys/fs/fs_sample/boards/nrf52840_blip.overlay b/samples/subsys/fs/fs_sample/boards/nrf52840_blip.overlay index 88bfd3a9336c5..0c3bfa5018923 100644 --- a/samples/subsys/fs/fs_sample/boards/nrf52840_blip.overlay +++ b/samples/subsys/fs/fs_sample/boards/nrf52840_blip.overlay @@ -14,6 +14,7 @@ status = "okay"; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; spi-max-frequency = <24000000>; diff --git a/samples/subsys/fs/fs_sample/boards/nucleo_f429zi.overlay b/samples/subsys/fs/fs_sample/boards/nucleo_f429zi.overlay index 0942251eb2fd1..ff756caac4674 100644 --- a/samples/subsys/fs/fs_sample/boards/nucleo_f429zi.overlay +++ b/samples/subsys/fs/fs_sample/boards/nucleo_f429zi.overlay @@ -11,6 +11,7 @@ status = "okay"; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; spi-max-frequency = <25000000>; diff --git a/samples/subsys/fs/fs_sample/src/main.c b/samples/subsys/fs/fs_sample/src/main.c index 01d935d7e1b50..b21bafe01ced7 100644 --- a/samples/subsys/fs/fs_sample/src/main.c +++ b/samples/subsys/fs/fs_sample/src/main.c @@ -36,7 +36,7 @@ static struct fs_mount_t mp = { #include -#define DISK_DRIVE_NAME "SDMMC" +#define DISK_DRIVE_NAME "SD" #define DISK_MOUNT_PT "/ext" static struct fs_mount_t mp = { diff --git a/samples/subsys/fs/littlefs/README.rst b/samples/subsys/fs/littlefs/README.rst index 600008b5f2b1e..9aa63b8a174f7 100644 --- a/samples/subsys/fs/littlefs/README.rst +++ b/samples/subsys/fs/littlefs/README.rst @@ -96,9 +96,9 @@ present and enabled in the final board dts and configuration files simultaneousl point name for the ``littlefs`` file system block device will be determined based on the following logic: -* if the :kconfig:option:`CONFIG_SDMMC_VOLUME_NAME` configuration is defined, it will be used - as the mount point name; -* if the :kconfig:option:`CONFIG_SDMMC_VOLUME_NAME` configuration is not defined, but the +* if the :kconfig:option:`CONFIG_DISK_DRIVER_SDMMC` configuration is defined, ``"SD"`` + will be used as the mount point name; +* if the :kconfig:option:`CONFIG_DISK_DRIVER_SDMMC` configuration is not defined, but the :kconfig:option:`CONFIG_MMC_VOLUME_NAME` configuration is defined, :kconfig:option:`CONFIG_MMC_VOLUME_NAME` will be used as the mount point name; * if neither :kconfig:option:`CONFIG_SDMMC_VOLUME_NAME` nor :kconfig:option:`CONFIG_MMC_VOLUME_NAME` diff --git a/samples/subsys/fs/littlefs/src/main.c b/samples/subsys/fs/littlefs/src/main.c index b04b998d7d5ae..2a47f0e5ca8fb 100644 --- a/samples/subsys/fs/littlefs/src/main.c +++ b/samples/subsys/fs/littlefs/src/main.c @@ -311,7 +311,7 @@ static int littlefs_mount(struct fs_mount_t *mp) #ifdef CONFIG_APP_LITTLEFS_STORAGE_BLK_SDMMC #if defined(CONFIG_DISK_DRIVER_SDMMC) -#define DISK_NAME CONFIG_SDMMC_VOLUME_NAME +#define DISK_NAME "SD" #elif defined(CONFIG_DISK_DRIVER_MMC) #define DISK_NAME CONFIG_MMC_VOLUME_NAME #else diff --git a/subsys/fs/shell.c b/subsys/fs/shell.c index cb72b6591e748..b5fd364b3965f 100644 --- a/subsys/fs/shell.c +++ b/subsys/fs/shell.c @@ -40,7 +40,7 @@ static struct fs_mount_t fatfs_mnt = { #ifdef CONFIG_FS_LITTLEFS_BLK_DEV #if defined(CONFIG_DISK_DRIVER_SDMMC) -#define DISK_NAME CONFIG_SDMMC_VOLUME_NAME +#define DISK_NAME "SD" #elif defined(CONFIG_DISK_DRIVER_MMC) #define DISK_NAME CONFIG_MMC_VOLUME_NAME #else diff --git a/tests/drivers/build_all/disk/spi.dtsi b/tests/drivers/build_all/disk/spi.dtsi index 72014996abd89..cd36ac3604848 100644 --- a/tests/drivers/build_all/disk/spi.dtsi +++ b/tests/drivers/build_all/disk/spi.dtsi @@ -11,6 +11,7 @@ sdhc@0 { sdmmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; diff --git a/tests/drivers/disk/disk_access/src/main.c b/tests/drivers/disk/disk_access/src/main.c index 8e26cc0356eaf..11689006f4d61 100644 --- a/tests/drivers/disk/disk_access/src/main.c +++ b/tests/drivers/disk/disk_access/src/main.c @@ -21,7 +21,7 @@ #endif #if defined(CONFIG_DISK_DRIVER_SDMMC) -#define DISK_NAME_PHYS CONFIG_SDMMC_VOLUME_NAME +#define DISK_NAME_PHYS "SD" #elif defined(CONFIG_DISK_DRIVER_MMC) #define DISK_NAME_PHYS CONFIG_MMC_VOLUME_NAME #elif defined(CONFIG_DISK_DRIVER_FLASH) diff --git a/tests/drivers/disk/disk_performance/src/main.c b/tests/drivers/disk/disk_performance/src/main.c index 0042cde68ee66..82bf2008ab279 100644 --- a/tests/drivers/disk/disk_performance/src/main.c +++ b/tests/drivers/disk/disk_performance/src/main.c @@ -13,7 +13,7 @@ #include #if defined(CONFIG_DISK_DRIVER_SDMMC) -#define DISK_NAME CONFIG_SDMMC_VOLUME_NAME +#define DISK_NAME "SD" #elif defined(CONFIG_DISK_DRIVER_MMC) #define DISK_NAME CONFIG_MMC_VOLUME_NAME #elif defined(CONFIG_NVME) diff --git a/tests/lib/gui/lvgl/boards/stm32h747i_disco_stm32h747xx_m7.overlay b/tests/lib/gui/lvgl/boards/stm32h747i_disco_stm32h747xx_m7.overlay index 13dcfa3307467..8bbcd2cb1e54c 100644 --- a/tests/lib/gui/lvgl/boards/stm32h747i_disco_stm32h747xx_m7.overlay +++ b/tests/lib/gui/lvgl/boards/stm32h747i_disco_stm32h747xx_m7.overlay @@ -4,12 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -&sdmmc1 { - sdmmc { - compatible = "zephyr,sdmmc-disk"; - }; -}; - /delete-node/ &storage_partition; &flash0 { diff --git a/tests/lib/gui/lvgl/src/main.c b/tests/lib/gui/lvgl/src/main.c index 8ee495d936aed..91e38e1714c8f 100644 --- a/tests/lib/gui/lvgl/src/main.c +++ b/tests/lib/gui/lvgl/src/main.c @@ -18,7 +18,7 @@ #ifdef CONFIG_FS_LITTLEFS_BLK_DEV #ifdef CONFIG_DISK_DRIVER_SDMMC -#define DISK_NAME CONFIG_SDMMC_VOLUME_NAME +#define DISK_NAME "SD" #elif defined(CONFIG_DISK_DRIVER_MMC) #define DISK_NAME CONFIG_MMC_VOLUME_NAME #else diff --git a/tests/subsys/fs/ext2/boards/hifive_unmatched.overlay b/tests/subsys/fs/ext2/boards/hifive_unmatched.overlay index e2daf505227e9..45f299c3ecfbb 100644 --- a/tests/subsys/fs/ext2/boards/hifive_unmatched.overlay +++ b/tests/subsys/fs/ext2/boards/hifive_unmatched.overlay @@ -13,6 +13,7 @@ status = "okay"; mmc { compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; status = "okay"; }; spi-max-frequency = <20000000>; diff --git a/tests/subsys/fs/ext2/src/main.c b/tests/subsys/fs/ext2/src/main.c index d58a904270ee0..5262a1d942bab 100644 --- a/tests/subsys/fs/ext2/src/main.c +++ b/tests/subsys/fs/ext2/src/main.c @@ -14,7 +14,7 @@ #elif CONFIG_DISK_DRIVER_FLASH #define STORAGE_DEVICE "NAND" #elif CONFIG_DISK_DRIVER_SDMMC - #define STORAGE_DEVICE "SDMMC" + #define STORAGE_DEVICE "SD" #endif /* All tests must use this structure to mount file system. After each test this structure is cleaned diff --git a/tests/subsys/fs/fat_fs_api/src/test_fat.h b/tests/subsys/fs/fat_fs_api/src/test_fat.h index c5ef9b12b267d..f6464ddc88e03 100644 --- a/tests/subsys/fs/fat_fs_api/src/test_fat.h +++ b/tests/subsys/fs/fat_fs_api/src/test_fat.h @@ -16,7 +16,7 @@ #elif defined(CONFIG_DISK_DRIVER_FLASH) #define DISK_NAME DT_PROP(DT_NODELABEL(test_disk), disk_name) #elif defined(CONFIG_DISK_DRIVER_SDMMC) -#define DISK_NAME CONFIG_SDMMC_VOLUME_NAME +#define DISK_NAME "SD" #elif defined(CONFIG_DISK_DRIVER_MMC) #define DISK_NAME CONFIG_MMC_VOLUME_NAME #else From 07a8e3253a2d8a2076c9c83c4ed4158fa3fbb2a2 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Thu, 31 Oct 2024 21:03:44 +0000 Subject: [PATCH 2098/4482] drivers: disk: mmc_subsys: remove CONFIG_MMC_VOLUME_NAME Remove CONFIG_MMC_VOLUME_NAME, and set the disk name based on the ``disk-name`` property. This aligns with other disk drivers, and allows for multiple instances of the mmc_subsys disk driver to be registered. Add disk-name properties for all in tree definitions for the mmc-subsys disk driver, and change all in tree usage of the disk name Fixes #75004 Signed-off-by: Daniel DeGrasse --- .../mimxrt595_evk_mimxrt595s_cm33.dts | 1 + .../rcar_h3ulcb/rcar_h3ulcb_r8a77951_a57.dts | 1 + .../rcar_salvator_xs/rcar_salvator_xs.dts | 1 + .../rcar_spider_s4_r8a779f0_a55.dts | 1 + doc/connectivity/usb/device/usb_device.rst | 5 ++--- drivers/disk/Kconfig.mmc | 7 ------- drivers/disk/mmc_subsys.c | 18 +++++++++--------- dts/bindings/sd/zephyr,mmc-disk.yaml | 6 ++++++ dts/x86/intel/alder_lake.dtsi | 1 + samples/subsys/fs/fs_sample/src/main.c | 5 +++++ samples/subsys/fs/littlefs/README.rst | 6 +++--- samples/subsys/fs/littlefs/src/main.c | 2 +- subsys/fs/shell.c | 2 +- tests/drivers/build_all/disk/spi.dtsi | 1 + tests/drivers/disk/disk_access/src/main.c | 2 +- tests/drivers/disk/disk_performance/src/main.c | 2 +- tests/lib/gui/lvgl/src/main.c | 2 +- tests/subsys/fs/fat_fs_api/prj_mmc.conf | 1 - tests/subsys/fs/fat_fs_api/src/test_fat.h | 2 +- 19 files changed, 37 insertions(+), 29 deletions(-) diff --git a/boards/nxp/mimxrt595_evk/mimxrt595_evk_mimxrt595s_cm33.dts b/boards/nxp/mimxrt595_evk/mimxrt595_evk_mimxrt595s_cm33.dts index 77c778e763481..efa9d9d244a69 100644 --- a/boards/nxp/mimxrt595_evk/mimxrt595_evk_mimxrt595s_cm33.dts +++ b/boards/nxp/mimxrt595_evk/mimxrt595_evk_mimxrt595s_cm33.dts @@ -371,6 +371,7 @@ zephyr_udc0: &usbhs { cd-gpios = <&gpio2 9 GPIO_ACTIVE_LOW>; mmc { compatible = "zephyr,mmc-disk"; + disk-name = "SD2"; status = "okay"; }; pinctrl-0 = <&pinmux_usdhc>; diff --git a/boards/renesas/rcar_h3ulcb/rcar_h3ulcb_r8a77951_a57.dts b/boards/renesas/rcar_h3ulcb/rcar_h3ulcb_r8a77951_a57.dts index 8c470e05538e8..fd814bc977e03 100644 --- a/boards/renesas/rcar_h3ulcb/rcar_h3ulcb_r8a77951_a57.dts +++ b/boards/renesas/rcar_h3ulcb/rcar_h3ulcb_r8a77951_a57.dts @@ -94,6 +94,7 @@ pinctrl-names = "default", "uhs"; disk { compatible = "zephyr,mmc-disk"; + disk-name = "SD2"; status = "disabled"; }; bus-width = <8>; diff --git a/boards/renesas/rcar_salvator_xs/rcar_salvator_xs.dts b/boards/renesas/rcar_salvator_xs/rcar_salvator_xs.dts index bc926dfddd4fc..33f836f592427 100644 --- a/boards/renesas/rcar_salvator_xs/rcar_salvator_xs.dts +++ b/boards/renesas/rcar_salvator_xs/rcar_salvator_xs.dts @@ -46,6 +46,7 @@ pinctrl-names = "default", "uhs"; disk { compatible = "zephyr,mmc-disk"; + disk-name = "SD2"; status = "disabled"; }; bus-width = <8>; diff --git a/boards/renesas/rcar_spider_s4/rcar_spider_s4_r8a779f0_a55.dts b/boards/renesas/rcar_spider_s4/rcar_spider_s4_r8a779f0_a55.dts index 3a7b5c4eb829b..c512a13f04bd5 100644 --- a/boards/renesas/rcar_spider_s4/rcar_spider_s4_r8a779f0_a55.dts +++ b/boards/renesas/rcar_spider_s4/rcar_spider_s4_r8a779f0_a55.dts @@ -41,6 +41,7 @@ pinctrl-names = "default", "uhs"; disk { compatible = "zephyr,mmc-disk"; + disk-name = "SD2"; status = "okay"; }; bus-width = <8>; diff --git a/doc/connectivity/usb/device/usb_device.rst b/doc/connectivity/usb/device/usb_device.rst index f98a5f4c62dad..f1230e073d42b 100644 --- a/doc/connectivity/usb/device/usb_device.rst +++ b/doc/connectivity/usb/device/usb_device.rst @@ -323,9 +323,8 @@ or SD Card to the host. Only one disk instance can be exported at a time. The disc to be used by the implementation is set by the :kconfig:option:`CONFIG_MASS_STORAGE_DISK_NAME` and should be the same as the name used by the disc access driver that the application wants to expose to the -host. MMC disk drivers use option :kconfig:option:`CONFIG_MMC_VOLUME_NAME`, or -flash, RAM, and SDMMC disk drivers use node property ``disk-name`` to set -the disk name. +host. Flash, RAM, and SDMMC/MMC disk drivers use node property ``disk-name`` to +set the disk name. For the emulated block device on a flash partition, the flash partition and flash disk to be used must be described in the devicetree. If a storage partition diff --git a/drivers/disk/Kconfig.mmc b/drivers/disk/Kconfig.mmc index 72a81b8e60f8e..3811ee4b60a38 100644 --- a/drivers/disk/Kconfig.mmc +++ b/drivers/disk/Kconfig.mmc @@ -16,13 +16,6 @@ config SD_INIT_PRIORITY help MMC controller driver initialization priority. -config MMC_VOLUME_NAME - string "MMC Disk mount point or drive name" - default "SD" if FAT_FILESYSTEM_ELM - default "MMC" - help - Disk name as per file system naming guidelines. - config MMC_SUBSYS bool "MMC access via SD subsystem" select MMC_STACK diff --git a/drivers/disk/mmc_subsys.c b/drivers/disk/mmc_subsys.c index c595c0edb8a7e..b8e81cd528f5e 100644 --- a/drivers/disk/mmc_subsys.c +++ b/drivers/disk/mmc_subsys.c @@ -27,7 +27,7 @@ struct mmc_config { struct mmc_data { struct sd_card card; enum sd_status status; - char *name; + struct disk_info *disk_info; }; @@ -107,10 +107,6 @@ static const struct disk_operations mmc_disk_ops = { .ioctl = disk_mmc_access_ioctl, }; -static struct disk_info mmc_disk = { - .ops = &mmc_disk_ops, -}; - static int disk_mmc_init(const struct device *dev) { struct mmc_data *data = dev->data; @@ -118,10 +114,8 @@ static int disk_mmc_init(const struct device *dev) data->status = SD_UNINIT; data->card.bus_width = config->bus_width; - mmc_disk.dev = dev; - mmc_disk.name = data->name; - return disk_access_register(&mmc_disk); + return disk_access_register(data->disk_info); } #define DISK_ACCESS_MMC_INIT(n) \ @@ -130,8 +124,14 @@ static int disk_mmc_init(const struct device *dev) .bus_width = DT_INST_PROP(n, bus_width), \ }; \ \ + static struct disk_info mmc_disk_##n = { \ + .name = DT_INST_PROP(n, disk_name), \ + .ops = &mmc_disk_ops, \ + .dev = DEVICE_DT_INST_GET(n), \ + }; \ + \ static struct mmc_data mmc_data_##n = { \ - .name = CONFIG_MMC_VOLUME_NAME, \ + .disk_info = &mmc_disk_##n, \ }; \ \ DEVICE_DT_INST_DEFINE(n, \ diff --git a/dts/bindings/sd/zephyr,mmc-disk.yaml b/dts/bindings/sd/zephyr,mmc-disk.yaml index f702b341e1a51..4246a994e2eee 100644 --- a/dts/bindings/sd/zephyr,mmc-disk.yaml +++ b/dts/bindings/sd/zephyr,mmc-disk.yaml @@ -19,3 +19,9 @@ properties: - 1 - 4 - 8 + + disk-name: + type: string + required: true + description: | + Disk name. diff --git a/dts/x86/intel/alder_lake.dtsi b/dts/x86/intel/alder_lake.dtsi index b847278b24faf..b205df4858915 100644 --- a/dts/x86/intel/alder_lake.dtsi +++ b/dts/x86/intel/alder_lake.dtsi @@ -348,6 +348,7 @@ mmc { compatible = "zephyr,mmc-disk"; + disk-name = "SD2"; bus-width = <8>; status = "okay"; }; diff --git a/samples/subsys/fs/fs_sample/src/main.c b/samples/subsys/fs/fs_sample/src/main.c index b21bafe01ced7..cb50716c67f81 100644 --- a/samples/subsys/fs/fs_sample/src/main.c +++ b/samples/subsys/fs/fs_sample/src/main.c @@ -22,7 +22,12 @@ * Note the fatfs library is able to mount only strings inside _VOLUME_STRS * in ffconf.h */ +#if defined(CONFIG_DISK_DRIVER_MMC) +#define DISK_DRIVE_NAME "SD2" +#else #define DISK_DRIVE_NAME "SD" +#endif + #define DISK_MOUNT_PT "/"DISK_DRIVE_NAME":" static FATFS fat_fs; diff --git a/samples/subsys/fs/littlefs/README.rst b/samples/subsys/fs/littlefs/README.rst index 9aa63b8a174f7..4c4407cb2521d 100644 --- a/samples/subsys/fs/littlefs/README.rst +++ b/samples/subsys/fs/littlefs/README.rst @@ -99,9 +99,9 @@ following logic: * if the :kconfig:option:`CONFIG_DISK_DRIVER_SDMMC` configuration is defined, ``"SD"`` will be used as the mount point name; * if the :kconfig:option:`CONFIG_DISK_DRIVER_SDMMC` configuration is not defined, but the - :kconfig:option:`CONFIG_MMC_VOLUME_NAME` configuration is defined, - :kconfig:option:`CONFIG_MMC_VOLUME_NAME` will be used as the mount point name; -* if neither :kconfig:option:`CONFIG_SDMMC_VOLUME_NAME` nor :kconfig:option:`CONFIG_MMC_VOLUME_NAME` + :kconfig:option:`CONFIG_DISK_DRIVER_MMC` configuration is defined, ``"SD2"`` will + be used as the mount point name; +* if neither :kconfig:option:`CONFIG_DISK_DRIVER_SDMMC` nor :kconfig:option:`CONFIG_DISK_DRIVER_MMC` configurations are defined, the mount point name will not be determined, and an appropriate error will appear during the sample build. diff --git a/samples/subsys/fs/littlefs/src/main.c b/samples/subsys/fs/littlefs/src/main.c index 2a47f0e5ca8fb..e228baad1fa63 100644 --- a/samples/subsys/fs/littlefs/src/main.c +++ b/samples/subsys/fs/littlefs/src/main.c @@ -313,7 +313,7 @@ static int littlefs_mount(struct fs_mount_t *mp) #if defined(CONFIG_DISK_DRIVER_SDMMC) #define DISK_NAME "SD" #elif defined(CONFIG_DISK_DRIVER_MMC) -#define DISK_NAME CONFIG_MMC_VOLUME_NAME +#define DISK_NAME "SD2" #else #error "No disk device defined, is your board supported?" #endif diff --git a/subsys/fs/shell.c b/subsys/fs/shell.c index b5fd364b3965f..465e70af4f1aa 100644 --- a/subsys/fs/shell.c +++ b/subsys/fs/shell.c @@ -42,7 +42,7 @@ static struct fs_mount_t fatfs_mnt = { #if defined(CONFIG_DISK_DRIVER_SDMMC) #define DISK_NAME "SD" #elif defined(CONFIG_DISK_DRIVER_MMC) -#define DISK_NAME CONFIG_MMC_VOLUME_NAME +#define DISK_NAME "SD2" #else #error "No disk device defined, is your board supported?" #endif diff --git a/tests/drivers/build_all/disk/spi.dtsi b/tests/drivers/build_all/disk/spi.dtsi index cd36ac3604848..389a1a07d213b 100644 --- a/tests/drivers/build_all/disk/spi.dtsi +++ b/tests/drivers/build_all/disk/spi.dtsi @@ -17,6 +17,7 @@ sdhc@0 { mmc { compatible = "zephyr,mmc-disk"; + disk-name = "SD2"; status = "okay"; }; }; diff --git a/tests/drivers/disk/disk_access/src/main.c b/tests/drivers/disk/disk_access/src/main.c index 11689006f4d61..0c36f1d6121ee 100644 --- a/tests/drivers/disk/disk_access/src/main.c +++ b/tests/drivers/disk/disk_access/src/main.c @@ -23,7 +23,7 @@ #if defined(CONFIG_DISK_DRIVER_SDMMC) #define DISK_NAME_PHYS "SD" #elif defined(CONFIG_DISK_DRIVER_MMC) -#define DISK_NAME_PHYS CONFIG_MMC_VOLUME_NAME +#define DISK_NAME_PHYS "SD2" #elif defined(CONFIG_DISK_DRIVER_FLASH) #define DISK_NAME_PHYS "NAND" #elif defined(CONFIG_NVME) diff --git a/tests/drivers/disk/disk_performance/src/main.c b/tests/drivers/disk/disk_performance/src/main.c index 82bf2008ab279..c1ac10ba68413 100644 --- a/tests/drivers/disk/disk_performance/src/main.c +++ b/tests/drivers/disk/disk_performance/src/main.c @@ -15,7 +15,7 @@ #if defined(CONFIG_DISK_DRIVER_SDMMC) #define DISK_NAME "SD" #elif defined(CONFIG_DISK_DRIVER_MMC) -#define DISK_NAME CONFIG_MMC_VOLUME_NAME +#define DISK_NAME "SD2" #elif defined(CONFIG_NVME) #define DISK_NAME "nvme0n0" #else diff --git a/tests/lib/gui/lvgl/src/main.c b/tests/lib/gui/lvgl/src/main.c index 91e38e1714c8f..0f59d01bd02fd 100644 --- a/tests/lib/gui/lvgl/src/main.c +++ b/tests/lib/gui/lvgl/src/main.c @@ -20,7 +20,7 @@ #ifdef CONFIG_DISK_DRIVER_SDMMC #define DISK_NAME "SD" #elif defined(CONFIG_DISK_DRIVER_MMC) -#define DISK_NAME CONFIG_MMC_VOLUME_NAME +#define DISK_NAME "SD2" #else #error "No disk device defined, is your board supported?" #endif /* CONFIG_DISK_DRIVER_SDMMC */ diff --git a/tests/subsys/fs/fat_fs_api/prj_mmc.conf b/tests/subsys/fs/fat_fs_api/prj_mmc.conf index e3e903f5a890e..98181cf96a0e8 100644 --- a/tests/subsys/fs/fat_fs_api/prj_mmc.conf +++ b/tests/subsys/fs/fat_fs_api/prj_mmc.conf @@ -4,5 +4,4 @@ CONFIG_FAT_FILESYSTEM_ELM=y CONFIG_SPI=y CONFIG_GPIO=y CONFIG_ZTEST=y -CONFIG_MMC_VOLUME_NAME="NAND" CONFIG_MAIN_STACK_SIZE=4096 diff --git a/tests/subsys/fs/fat_fs_api/src/test_fat.h b/tests/subsys/fs/fat_fs_api/src/test_fat.h index f6464ddc88e03..adbeffe78dc12 100644 --- a/tests/subsys/fs/fat_fs_api/src/test_fat.h +++ b/tests/subsys/fs/fat_fs_api/src/test_fat.h @@ -18,7 +18,7 @@ #elif defined(CONFIG_DISK_DRIVER_SDMMC) #define DISK_NAME "SD" #elif defined(CONFIG_DISK_DRIVER_MMC) -#define DISK_NAME CONFIG_MMC_VOLUME_NAME +#define DISK_NAME "SD2" #else #error "Failed to select DISK access type" #endif From 832e02daa6b68a7cc536279f55057d750de4baa5 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Thu, 31 Oct 2024 21:10:17 +0000 Subject: [PATCH 2099/4482] doc: releases: migration-guide-4.0: add note about disk-name for SD/MMC SD and MMC devices now require the disk-name property. Add a note to the migration guide so that users know the recommended value to add for this name for each disk driver type. Signed-off-by: Daniel DeGrasse --- doc/releases/migration-guide-4.0.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index dbe251676204f..fcf1763d15e15 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -208,6 +208,22 @@ Crypto Display ======= +Disk +==== + +* The SDMMC subsystem driver now requires a ``disk-name`` property be supplied + with the definition of the disk, which is used when registering the + SD device with the disk subsystem. This permits multiple SD devices to be + registered simultaneously. If unsure, ``disk-name = "SD"`` may be used + as a sane default. + +* The MMC subsystem driver now requires a ``disk-name`` property be supplied + with the definition of the disk, which is used when registering the + MMC device with the disk subsystem. This permits multiple MMC devices to be + registered simultaneously. If unsure, ``disk-name = "SD2"`` may be used + as a sane default. + + Enhanced Serial Peripheral Interface (eSPI) =========================================== From ba52c8c350aa24480b249abcab20648222287a9b Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Fri, 1 Nov 2024 16:38:34 -0300 Subject: [PATCH 2100/4482] west.yml: Update for esp32c2/esp32c6 ledc clock fix Update HAL for esp32c2/esp32c6 ledc clock fix Signed-off-by: Raffael Rostagno --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 4da2eab84bb9e..5a6a4d46dcce5 100644 --- a/west.yml +++ b/west.yml @@ -157,7 +157,7 @@ manifest: groups: - hal - name: hal_espressif - revision: 0f1874284f5dee0d49cb23f44f756e7be404e7b7 + revision: 23c17a8735d3047da95e3a81adafa36425636c55 path: modules/hal/espressif west-commands: west/west-commands.yml groups: From b9fc4cc4151fc319f2fa8648a68807baceae01b4 Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Fri, 1 Nov 2024 16:27:03 -0300 Subject: [PATCH 2101/4482] drivers: pwm: ledc: esp32c2: esp32c6: Fix clock frequency Fix clock frequency for both devices. Signed-off-by: Raffael Rostagno --- drivers/pwm/pwm_led_esp32.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/pwm/pwm_led_esp32.c b/drivers/pwm/pwm_led_esp32.c index 4c1804ca2371b..ab787bb52ef2f 100644 --- a/drivers/pwm/pwm_led_esp32.c +++ b/drivers/pwm/pwm_led_esp32.c @@ -22,6 +22,17 @@ #include LOG_MODULE_REGISTER(pwm_ledc_esp32, CONFIG_PWM_LOG_LEVEL); +#if SOC_LEDC_SUPPORT_APB_CLOCK +#define CLOCK_SOURCE LEDC_APB_CLK +#elif SOC_LEDC_SUPPORT_PLL_DIV_CLOCK +#define CLOCK_SOURCE LEDC_SCLK +#if defined(CONFIG_SOC_SERIES_ESP32C2) +#define SCLK_CLK_FREQ MHZ(60) +#elif defined(CONFIG_SOC_SERIES_ESP32C6) +#define SCLK_CLK_FREQ MHZ(80) +#endif +#endif + struct pwm_ledc_esp32_data { ledc_hal_context_t hal; struct k_sem cmd_sem; @@ -350,12 +361,6 @@ static const struct pwm_driver_api pwm_led_esp32_api = { PINCTRL_DT_INST_DEFINE(0); -#if SOC_LEDC_SUPPORT_APB_CLOCK - #define CLOCK_SOURCE LEDC_APB_CLK -#elif SOC_LEDC_SUPPORT_PLL_DIV_CLOCK - #define CLOCK_SOURCE LEDC_SCLK -#endif - #define CHANNEL_CONFIG(node_id) \ { \ .idx = DT_REG_ADDR(node_id), \ From 5c00d99f4b799a0e91805a36c716727b67220305 Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Wed, 6 Nov 2024 10:52:53 +0900 Subject: [PATCH 2102/4482] ci: Add '-specs' to ccache ignore option list `-specs=` is an alternate form of `--specs=`, which is now used by the Zephyr build system. This commit adds `-specs=*` to the ccache ignore option list because, as with `--specs=*`, ccache is unable to resolve the toolchain specs file path and refuses to cache when this option is specified. Signed-off-by: Stephanos Ioannidis --- .github/workflows/codecov.yaml | 2 +- .github/workflows/twister.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codecov.yaml b/.github/workflows/codecov.yaml index 56edb6a1e87e1..f22fa7a75820b 100644 --- a/.github/workflows/codecov.yaml +++ b/.github/workflows/codecov.yaml @@ -34,7 +34,7 @@ jobs: CCACHE_REMOTE_STORAGE: "redis://cache-*.keydb-cache.svc.cluster.local|shards=1,2,3" CCACHE_REMOTE_ONLY: "true" # `--specs` is ignored because ccache is unable to resovle the toolchain specs file path. - CCACHE_IGNOREOPTIONS: '--specs=*' + CCACHE_IGNOREOPTIONS: '-specs=* --specs=*' steps: - name: Apply container owner mismatch workaround run: | diff --git a/.github/workflows/twister.yaml b/.github/workflows/twister.yaml index f12cdeb2efaa2..84fa06390585e 100644 --- a/.github/workflows/twister.yaml +++ b/.github/workflows/twister.yaml @@ -142,7 +142,7 @@ jobs: CCACHE_REMOTE_STORAGE: "redis://cache-*.keydb-cache.svc.cluster.local|shards=1,2,3" CCACHE_REMOTE_ONLY: "true" # `--specs` is ignored because ccache is unable to resolve the toolchain specs file path. - CCACHE_IGNOREOPTIONS: '--specs=*' + CCACHE_IGNOREOPTIONS: '-specs=* --specs=*' BSIM_OUT_PATH: /opt/bsim/ BSIM_COMPONENTS_PATH: /opt/bsim/components TWISTER_COMMON: ' --force-color --inline-logs -v -N -M --retry-failed 3 --timeout-multiplier 2 ' From d4b7bf986c6a5ea0eedaf2d2b5e2a22567b1dac9 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Tue, 5 Nov 2024 10:36:51 +0100 Subject: [PATCH 2103/4482] tests bsim bt audio: Increase execution timeout These tests have been seen failing in CI due to the real time execution timeout. Let's increase it so it does not happen. Signed-off-by: Alberto Escolar Piedras --- .../test_scripts/bap_broadcast_audio_assistant_incorrect_code.sh | 1 + tests/bsim/bluetooth/audio/test_scripts/bap_unicast_audio.sh | 1 + .../audio/test_scripts/bap_unicast_audio_acl_disconnect.sh | 1 + 3 files changed, 3 insertions(+) diff --git a/tests/bsim/bluetooth/audio/test_scripts/bap_broadcast_audio_assistant_incorrect_code.sh b/tests/bsim/bluetooth/audio/test_scripts/bap_broadcast_audio_assistant_incorrect_code.sh index e81bb6492f7c6..da853e6085dc1 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/bap_broadcast_audio_assistant_incorrect_code.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/bap_broadcast_audio_assistant_incorrect_code.sh @@ -6,6 +6,7 @@ SIMULATION_ID="bap_broadcast_audio_assistant_incorrect_code" VERBOSITY_LEVEL=2 +EXECUTE_TIMEOUT=180 source ${ZEPHYR_BASE}/tests/bsim/sh_common.source diff --git a/tests/bsim/bluetooth/audio/test_scripts/bap_unicast_audio.sh b/tests/bsim/bluetooth/audio/test_scripts/bap_unicast_audio.sh index 5bbf5d3d1a8e0..24444440aa7a1 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/bap_unicast_audio.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/bap_unicast_audio.sh @@ -6,6 +6,7 @@ SIMULATION_ID="unicast_audio" VERBOSITY_LEVEL=2 +EXECUTE_TIMEOUT=120 source ${ZEPHYR_BASE}/tests/bsim/sh_common.source diff --git a/tests/bsim/bluetooth/audio/test_scripts/bap_unicast_audio_acl_disconnect.sh b/tests/bsim/bluetooth/audio/test_scripts/bap_unicast_audio_acl_disconnect.sh index 412473db53a9c..1b0d1c2890d4e 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/bap_unicast_audio_acl_disconnect.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/bap_unicast_audio_acl_disconnect.sh @@ -6,6 +6,7 @@ SIMULATION_ID="unicast_audio_acl_disconnect" VERBOSITY_LEVEL=2 +EXECUTE_TIMEOUT=120 source ${ZEPHYR_BASE}/tests/bsim/sh_common.source From 7e1cd18be4aab4c42fce2ea74e21b92d130ff06f Mon Sep 17 00:00:00 2001 From: Dmitrii Golovanov Date: Sun, 3 Nov 2024 18:26:47 +0100 Subject: [PATCH 2104/4482] twister: Fix NOTRUN status Fix Twister TestCase statuses left not assigned ('NONE') in these 'NOTRUN' situations: * a test suite has `integration platform` which is not available to run. * `--cmake-only` execution. Signed-off-by: Dmitrii Golovanov --- scripts/pylib/twister/twisterlib/runner.py | 8 +++++++- scripts/tests/twister/test_runner.py | 2 +- scripts/tests/twister_blackbox/test_runner.py | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index 7bc45e2df677c..201a869a82a9f 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -900,7 +900,9 @@ def process(self, pipeline, done, message, lock, results): next_op = 'report' elif self.options.cmake_only: if self.instance.status == TwisterStatus.NONE: - self.instance.status = TwisterStatus.PASS + logger.debug("CMake only: PASS %s" % self.instance.name) + self.instance.status = TwisterStatus.NOTRUN + self.instance.add_missing_case_status(TwisterStatus.NOTRUN, 'CMake only') next_op = 'report' else: # Here we check the runtime filter results coming from running cmake @@ -974,6 +976,10 @@ def process(self, pipeline, done, message, lock, results): elif self.instance.run and self.instance.handler.ready: next_op = 'run' else: + if self.instance.status == TwisterStatus.NOTRUN: + run_conditions = f"(run:{self.instance.run}, handler.ready:{self.instance.handler.ready})" + logger.debug(f"Instance {self.instance.name} can't run {run_conditions}") + self.instance.add_missing_case_status(TwisterStatus.NOTRUN, f"Nowhere to run") next_op = 'report' except StatusAttributeError as sae: logger.error(str(sae)) diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index 259fd7d1f5b54..b6cd151d78ad0 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -978,7 +978,7 @@ def mock_getsize(filename, *args, **kwargs): mock.ANY, [], {'op': 'report', 'test': mock.ANY}, - TwisterStatus.PASS, + TwisterStatus.NOTRUN, mock.ANY, 0, None diff --git a/scripts/tests/twister_blackbox/test_runner.py b/scripts/tests/twister_blackbox/test_runner.py index 6a6645bb5d869..0ace7fb05157b 100644 --- a/scripts/tests/twister_blackbox/test_runner.py +++ b/scripts/tests/twister_blackbox/test_runner.py @@ -73,7 +73,7 @@ class TestRunner: os.path.join(TEST_DATA, 'tests', 'dummy', 'agnostic'), ['qemu_x86', 'qemu_x86_64'], { - 'passed_configurations': 6, + 'passed_configurations': 0, 'selected_test_instances': 6, 'executed_on_platform': 0, 'only_built': 6, From 952daca6952f68d32a3ed4fa77ca09bbfaf99fad Mon Sep 17 00:00:00 2001 From: Ryan McClelland Date: Fri, 1 Nov 2024 15:52:39 -0700 Subject: [PATCH 2105/4482] debug: symtab: fix ignored type qualifiers on func return type const is ignored on the function return type. A warning is reported with -Wignored-qualifers. Remove the ignored const. Signed-off-by: Ryan McClelland --- include/zephyr/debug/symtab.h | 4 ++-- subsys/debug/symtab/symtab.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/zephyr/debug/symtab.h b/include/zephyr/debug/symtab.h index ba4e8c572c8a0..19afb5947b892 100644 --- a/include/zephyr/debug/symtab.h +++ b/include/zephyr/debug/symtab.h @@ -46,7 +46,7 @@ struct symtab_info { * * @return Pointer to the symbol table. */ -const struct symtab_info *const symtab_get(void); +const struct symtab_info *symtab_get(void); /** * @brief Find the symbol name with a binary search @@ -57,7 +57,7 @@ const struct symtab_info *const symtab_get(void); * * @return Name of the nearest symbol if found, otherwise "?" is returned. */ -const char *const symtab_find_symbol_name(uintptr_t addr, uint32_t *offset); +const char *symtab_find_symbol_name(uintptr_t addr, uint32_t *offset); /** * @} diff --git a/subsys/debug/symtab/symtab.c b/subsys/debug/symtab/symtab.c index d82df0cd3c2b5..5cbe600532190 100644 --- a/subsys/debug/symtab/symtab.c +++ b/subsys/debug/symtab/symtab.c @@ -10,14 +10,14 @@ #include #include -const struct symtab_info *const symtab_get(void) +const struct symtab_info *symtab_get(void) { extern const struct symtab_info z_symtab; return &z_symtab; } -const char *const symtab_find_symbol_name(uintptr_t addr, uint32_t *offset) +const char *symtab_find_symbol_name(uintptr_t addr, uint32_t *offset) { const struct symtab_info *const symtab = symtab_get(); const uint32_t symbol_offset = addr - symtab->first_addr; From 5106a0407e53191c67a920ae41ad0a2d40ff2eb4 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 1 Nov 2024 21:03:32 +0530 Subject: [PATCH 2106/4482] boards: thingy53: Fix missing GPIOs Status and request GPIOs are missing from the edge connector, add those to fix Thingy53 + nRF7002EB build. Signed-off-by: Chaitanya Tata --- boards/nordic/thingy53/thingy53_nrf5340_cpunet.dts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/boards/nordic/thingy53/thingy53_nrf5340_cpunet.dts b/boards/nordic/thingy53/thingy53_nrf5340_cpunet.dts index aa4d4df909c47..3003d4924ce56 100644 --- a/boards/nordic/thingy53/thingy53_nrf5340_cpunet.dts +++ b/boards/nordic/thingy53/thingy53_nrf5340_cpunet.dts @@ -72,7 +72,9 @@ #gpio-cells = <2>; gpio-map-mask = <0xffffffff 0xffffffc0>; gpio-map-pass-thru = <0 0x3f>; - gpio-map = <8 0 &gpio0 5 0>, /* P8, P0.05/AIN1 */ + gpio-map = <5 0 &gpio1 1 0>, /* P5, P1.01/GRANT */ + <6 0 &gpio1 0 0>, /* P6, P1.00/REQ */ + <8 0 &gpio0 5 0>, /* P8, P0.05/AIN1 */ <9 0 &gpio0 4 0>, /* P9, P0.04/AIN0 */ <15 0 &gpio0 8 0>, /* P15, P0.08/TRACEDATA3 */ <16 0 &gpio0 9 0>, /* P16, P0.09/TRACEDATA2 */ From 130c5c00025995780f9ce430605f6c5bec2bed97 Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Wed, 16 Oct 2024 22:00:10 -0500 Subject: [PATCH 2107/4482] tests: zbus: publish_stats: Fix for non-zero boot delay Fixes the zbus publishing statistics test to account for a non-zero boot delay, which is often used in hardware testing environments. This fixes an assertion failure observed on multiple max32 boards in the adi board farm. Signed-off-by: Maureen Helm --- tests/subsys/zbus/publish_stats/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/subsys/zbus/publish_stats/src/main.c b/tests/subsys/zbus/publish_stats/src/main.c index 86143e707ac17..b93bedfc12052 100644 --- a/tests/subsys/zbus/publish_stats/src/main.c +++ b/tests/subsys/zbus/publish_stats/src/main.c @@ -25,7 +25,7 @@ ZTEST(publish_stats, test_channel_metadata) zassert_equal(0, zbus_chan_pub_stats_avg_period(&chan)); /* Should be no different after a second of runtime */ - k_sleep(K_SECONDS(1)); + k_sleep(K_TIMEOUT_ABS_MS(1000)); zassert_equal(0, zbus_chan_pub_stats_count(&chan)); zassert_equal(0, zbus_chan_pub_stats_last_time(&chan)); zassert_equal(0, zbus_chan_pub_stats_avg_period(&chan)); From a597feafb8e50624ad7374b1e0111693bd5a30cb Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 4 Nov 2024 13:18:46 +0100 Subject: [PATCH 2108/4482] test: net: lib: prometheus: formatter: Fix test flakiness If a string is already present in the provided buffer, prometheus_format_exposition() appends it instead of overwriting, hence the buffer needs to be cleared on the test start, otherwise it works by chance. Signed-off-by: Robert Lubos --- tests/net/lib/prometheus/formatter/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/net/lib/prometheus/formatter/src/main.c b/tests/net/lib/prometheus/formatter/src/main.c index 12af8153cc6e8..f8170b99c1987 100644 --- a/tests/net/lib/prometheus/formatter/src/main.c +++ b/tests/net/lib/prometheus/formatter/src/main.c @@ -36,7 +36,7 @@ PROMETHEUS_COLLECTOR_DEFINE(test_custom_collector); ZTEST(test_formatter, test_prometheus_formatter_simple) { int ret; - char formatted[MAX_BUFFER_SIZE]; + char formatted[MAX_BUFFER_SIZE] = { 0 }; struct prometheus_counter *counter; char exposed[] = "# HELP test_counter Test counter\n" "# TYPE test_counter counter\n" From 97d6cd335cd60c9acb779769f62e66cd58329cfc Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Mon, 4 Nov 2024 14:59:25 +0100 Subject: [PATCH 2109/4482] scripts: check_maintainers: add scripts for checking GitHub accounts Add script for checking if maintainer and collaborator GitHub accounts exist. Signed-off-by: Henrik Brix Andersen --- scripts/check_maintainers.py | 71 ++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 scripts/check_maintainers.py diff --git a/scripts/check_maintainers.py b/scripts/check_maintainers.py new file mode 100755 index 0000000000000..8b393b0ec81eb --- /dev/null +++ b/scripts/check_maintainers.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2024 Vestas Wind Systems A/S +# +# SPDX-License-Identifier: Apache-2.0 + +import argparse +import sys + +from github_helpers import get_github_object +from get_maintainer import Maintainers +from github.GithubException import UnknownObjectException + +def parse_args(): + parser = argparse.ArgumentParser( + formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, allow_abbrev=False) + + parser.add_argument( + "-m", "--maintainers", + metavar="MAINTAINERS_FILE", + help="Maintainers file to load. If not specified, MAINTAINERS.yml in " + "the top-level repository directory is used, and must exist. " + "Paths in the maintainers file will always be taken as relative " + "to the top-level directory.") + + return parser.parse_args() + +def main() -> None: + args = parse_args() + zephyr_repo = get_github_object().get_repo('zephyrproject-rtos/zephyr') + maintainers = Maintainers(args.maintainers) + gh = get_github_object() + gh_users = [] + notfound = [] + noncollabs = [] + + for area in maintainers.areas.values(): + gh_users = list(set(gh_users + area.maintainers + area.collaborators)) + + gh_users.sort() + + print('Checking maintainer and collaborator user accounts on GitHub:') + for gh_user in gh_users: + try: + print('.', end='', flush=True) + gh.get_user(gh_user) + + if not zephyr_repo.has_in_collaborators(gh_user): + noncollabs.append(gh_user) + except UnknownObjectException: + notfound.append(gh_user) + print('\n') + + if notfound: + print('The following GitHub user accounts do not exist:') + print('\n'.join(notfound)) + else: + print('No non-existing user accounts found') + + if noncollabs: + print('The following GitHub user accounts are not collaborators:') + print('\n'.join(noncollabs)) + else: + print('No non-collaborator user accounts found') + + if notfound or noncollabs: + sys.exit(1) + +if __name__ == '__main__': + main() From c261bdf6fc395385420e584b4f60ae32b2c16880 Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Mon, 4 Nov 2024 15:07:41 +0100 Subject: [PATCH 2110/4482] MAINTAINERS: remove nonexistent GitHub user accounts Remove nonexistent GitHub user accounts as reported by the scripts/check_maintainers.py script. Signed-off-by: Henrik Brix Andersen --- MAINTAINERS.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 02ba5ecbf974f..4b905622b3b33 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -1586,9 +1586,7 @@ Release Notes: - drivers.i3c "Drivers: IEEE 802.15.4": - status: maintained - maintainers: - - fgrandel + status: odd fixes collaborators: - rlubos - ankuns @@ -2923,8 +2921,6 @@ Networking: status: maintained maintainers: - jukkar - collaborators: - - fgrandel files: - doc/connectivity/networking/api/gptp.rst - include/zephyr/net/gptp.h @@ -2996,9 +2992,7 @@ Networking: - sample.net.ptp "Networking: Native IEEE 802.15.4": - status: maintained - maintainers: - - fgrandel + status: odd fixes collaborators: - rlubos - jukkar From c86225384a12589a7fff5c8ccd6f47f24b13ca10 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 4 Nov 2024 21:42:53 +0530 Subject: [PATCH 2111/4482] drivers: nrfwifi: Add a NULL check for FMAC context In case the driver UP fails, the FMAC context will be NULL, so, add a NULL check in the DOWN. Fixes a crash seen when working with unprogrammed OTP (no MAC) that fails the interface UP. Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/src/net_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/wifi/nrfwifi/src/net_if.c b/drivers/wifi/nrfwifi/src/net_if.c index a4404cfb1a7a1..1a8b0c7361af4 100644 --- a/drivers/wifi/nrfwifi/src/net_if.c +++ b/drivers/wifi/nrfwifi/src/net_if.c @@ -877,7 +877,7 @@ int nrf_wifi_if_stop_zep(const struct device *dev) } rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; - if (!rpu_ctx_zep) { + if (!rpu_ctx_zep || !rpu_ctx_zep->rpu_ctx) { LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); goto unlock; From ae077b947558f3dc8dbc6872414e5096400fcdec Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 4 Nov 2024 21:47:06 +0530 Subject: [PATCH 2112/4482] manifest: hal_nordic: Pull logging level fix Fix the noise during boot. Signed-off-by: Chaitanya Tata --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 5a6a4d46dcce5..f6c0a3b09f380 100644 --- a/west.yml +++ b/west.yml @@ -188,7 +188,7 @@ manifest: groups: - hal - name: hal_nordic - revision: cb7600a1be4c8b177867e6d463729c07dd3f6d73 + revision: 2d78179cc4f0601a891553132b13184fa51b6ef9 path: modules/hal/nordic groups: - hal From 9705fc06b481a95c4fdc426a03e07b77f20ed943 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 5 Nov 2024 02:52:17 +0530 Subject: [PATCH 2113/4482] [nrf fromlist] drivers: nrfwifi: Fix CSUM support With introduction of Raw modes, nRF70 driver now advertises get_c onfig OP, but doesn't implement all types. This causes problems two-fold with checksum calculations: 1. The "config" isn't uninitialized, so, every call returns differnet values. So, for UDP header checksum would be done and pkt->chksumdone would be set. But for IPv4 header checksum might be skipped. 2. Even if we initialize to zero, then network stack gets all zeros and calculates checksum by itself rendering offload moot. There is another problem in #1, as there is only single flag for pkt for all checksum, nRF70 driver sees this and tells UMAC to skip checksum for the entire packet. The design isn't coherent, and should be converted to communicate per-type checksum status (some are filled by network stack and some HW). But as nRF70 support all checksum offloads, advertise all types for both RX and TX. Upstream PR #: 80882 Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/src/net_if.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/wifi/nrfwifi/src/net_if.c b/drivers/wifi/nrfwifi/src/net_if.c index 1a8b0c7361af4..19b232b6fe347 100644 --- a/drivers/wifi/nrfwifi/src/net_if.c +++ b/drivers/wifi/nrfwifi/src/net_if.c @@ -980,10 +980,23 @@ int nrf_wifi_if_get_config_zep(const struct device *dev, goto unlock; } + memset(config, 0, sizeof(struct ethernet_config)); + if (type == ETHERNET_CONFIG_TYPE_TXINJECTION_MODE) { config->txinjection_mode = def_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx]->txinjection_mode; } +#ifdef CONFIG_NRF70_TCP_IP_CHECKSUM_OFFLOAD + if (type == ETHERNET_CONFIG_TYPE_TX_CHECKSUM_SUPPORT || + type == ETHERNET_CONFIG_TYPE_RX_CHECKSUM_SUPPORT) { + config->chksum_support = ETHERNET_CHECKSUM_SUPPORT_IPV4_HEADER | + ETHERNET_CHECKSUM_SUPPORT_IPV4_ICMP | + ETHERNET_CHECKSUM_SUPPORT_IPV6_HEADER | + ETHERNET_CHECKSUM_SUPPORT_IPV6_ICMP | + ETHERNET_CHECKSUM_SUPPORT_TCP | + ETHERNET_CHECKSUM_SUPPORT_UDP; + } +#endif ret = 0; unlock: k_mutex_unlock(&vif_ctx_zep->vif_lock); From 47562485e4ebe0554ac2bbb6b4386702126b0fa5 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 4 Nov 2024 10:18:16 +0200 Subject: [PATCH 2114/4482] MAINTAINERS: Fix issues with Bluetooth HCI section The primary header file was missing, and one of the labels was wrong. Signed-off-by: Johan Hedberg --- MAINTAINERS.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 4b905622b3b33..3e60959ea1653 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -314,12 +314,13 @@ Bluetooth HCI: - HoZHel files: - include/zephyr/drivers/bluetooth/ + - include/zephyr/drivers/bluetooth.h - drivers/bluetooth/ - samples/bluetooth/hci_*/ - tests/bsim/bluetooth/hci_uart/ - dts/bindings/bluetooth/ labels: - - "area: Bluetooth Host" + - "area: Bluetooth HCI" - "area: Bluetooth" tests: - bluetooth From 9bdb71fe558183ba0fa892e4d11af488cf9e3a34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 4 Nov 2024 13:43:41 +0100 Subject: [PATCH 2115/4482] tests: subsys: dfu: img_util: Increase stack size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix a problem with the test that manifested itself with a surprising assertion failure at lib/utils/onoff.c:283. Apparently, due to the stack being too small, some memory got accidentally overwritten. Signed-off-by: Andrzej Głąbek --- tests/subsys/dfu/img_util/prj.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/subsys/dfu/img_util/prj.conf b/tests/subsys/dfu/img_util/prj.conf index 6beb6b102a09c..4f0bc092cefeb 100644 --- a/tests/subsys/dfu/img_util/prj.conf +++ b/tests/subsys/dfu/img_util/prj.conf @@ -7,3 +7,4 @@ CONFIG_IMG_MANAGER=y CONFIG_IMG_ENABLE_IMAGE_CHECK=y CONFIG_MCUBOOT_IMG_MANAGER=y CONFIG_IMG_BLOCK_BUF_SIZE=512 +CONFIG_ZTEST_STACK_SIZE=1536 From c0a84524cd16cdb3c4dd95ace36113739f75828e Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Sat, 2 Nov 2024 17:14:23 +0530 Subject: [PATCH 2116/4482] drivers: nrfwifi: Fix the undefined macro usage This works because undefined macro in conditional is treated as zero, but could end up choosing the wrong divider. Fix the macro with the new name. Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/src/qspi/src/qspi_if.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/wifi/nrfwifi/src/qspi/src/qspi_if.c b/drivers/wifi/nrfwifi/src/qspi/src/qspi_if.c index 26d9249248cb7..46c92def8f7e0 100644 --- a/drivers/wifi/nrfwifi/src/qspi/src/qspi_if.c +++ b/drivers/wifi/nrfwifi/src/qspi/src/qspi_if.c @@ -85,7 +85,7 @@ BUILD_ASSERT(QSPI_IF_DEVICE_FREQUENCY >= (NRF_QSPI_BASE_CLOCK_FREQ / 16), * PCLK192M frequency"), but after that operation is complete, the default * divider needs to be restored to avoid increased current consumption. */ -#if (INST_0_SCK_FREQUENCY >= NRF_QSPI_BASE_CLOCK_FREQ) +#if (QSPI_IF_DEVICE_FREQUENCY >= NRF_QSPI_BASE_CLOCK_FREQ) /* For requested SCK >= 96 MHz, use HFCLK192M / 1 / (2*1) = 96 MHz */ #define BASE_CLOCK_DIV NRF_CLOCK_HFCLK_DIV_1 #define INST_0_SCK_CFG NRF_QSPI_FREQ_DIV1 @@ -93,12 +93,12 @@ BUILD_ASSERT(QSPI_IF_DEVICE_FREQUENCY >= (NRF_QSPI_BASE_CLOCK_FREQ / 16), #elif NRF53_ERRATA_159_ENABLE_WORKAROUND #define BASE_CLOCK_DIV NRF_CLOCK_HFCLK_DIV_1 #define INST_0_SCK_CFG (DIV_ROUND_UP(NRF_QSPI_BASE_CLOCK_FREQ, \ - INST_0_SCK_FREQUENCY) - 1) -#elif (INST_0_SCK_FREQUENCY >= (NRF_QSPI_BASE_CLOCK_FREQ / 2)) + QSPI_IF_DEVICE_FREQUENCY) - 1) +#elif (QSPI_IF_DEVICE_FREQUENCY >= (NRF_QSPI_BASE_CLOCK_FREQ / 2)) /* For 96 MHz > SCK >= 48 MHz, use HFCLK192M / 2 / (2*1) = 48 MHz */ #define BASE_CLOCK_DIV NRF_CLOCK_HFCLK_DIV_2 #define INST_0_SCK_CFG NRF_QSPI_FREQ_DIV1 -#elif (INST_0_SCK_FREQUENCY >= (NRF_QSPI_BASE_CLOCK_FREQ / 3)) +#elif (QSPI_IF_DEVICE_FREQUENCY >= (NRF_QSPI_BASE_CLOCK_FREQ / 3)) /* For 48 MHz > SCK >= 32 MHz, use HFCLK192M / 1 / (2*3) = 32 MHz */ #define BASE_CLOCK_DIV NRF_CLOCK_HFCLK_DIV_1 #define INST_0_SCK_CFG NRF_QSPI_FREQ_DIV3 From 75bc16f0a2a2e0563480b475d7e4ab3afc71eca9 Mon Sep 17 00:00:00 2001 From: Thao Luong Date: Fri, 1 Nov 2024 00:06:53 +0700 Subject: [PATCH 2117/4482] boards: renesas: Remove CONFIG_PINCTRL for RA boards Remove CONFIG_PINCTRL from defconfig files of RA boards Signed-off-by: Thao Luong --- boards/renesas/ek_ra2a1/ek_ra2a1_defconfig | 1 - boards/renesas/ek_ra4e2/ek_ra4e2_defconfig | 1 - boards/renesas/ek_ra4m2/ek_ra4m2_defconfig | 1 - boards/renesas/ek_ra4m3/ek_ra4m3_defconfig | 1 - boards/renesas/ek_ra4w1/ek_ra4w1_defconfig | 1 - boards/renesas/ek_ra6e2/ek_ra6e2_defconfig | 1 - boards/renesas/ek_ra6m1/ek_ra6m1_defconfig | 1 - boards/renesas/ek_ra6m2/ek_ra6m2_defconfig | 1 - boards/renesas/ek_ra6m3/ek_ra6m3_defconfig | 1 - boards/renesas/ek_ra6m4/ek_ra6m4_defconfig | 1 - boards/renesas/ek_ra6m5/ek_ra6m5_defconfig | 1 - boards/renesas/ek_ra8d1/ek_ra8d1_defconfig | 1 - boards/renesas/ek_ra8m1/ek_ra8m1_defconfig | 1 - boards/renesas/fpb_ra6e1/fpb_ra6e1_defconfig | 1 - boards/renesas/fpb_ra6e2/fpb_ra6e2_defconfig | 1 - boards/renesas/mck_ra8t1/mck_ra8t1_defconfig | 1 - 16 files changed, 16 deletions(-) diff --git a/boards/renesas/ek_ra2a1/ek_ra2a1_defconfig b/boards/renesas/ek_ra2a1/ek_ra2a1_defconfig index 6058aa5eb98c9..325e7c85ca21a 100644 --- a/boards/renesas/ek_ra2a1/ek_ra2a1_defconfig +++ b/boards/renesas/ek_ra2a1/ek_ra2a1_defconfig @@ -5,7 +5,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=48000000 # Enable GPIO CONFIG_GPIO=y -CONFIG_PINCTRL=y # Enable Console CONFIG_SERIAL=y diff --git a/boards/renesas/ek_ra4e2/ek_ra4e2_defconfig b/boards/renesas/ek_ra4e2/ek_ra4e2_defconfig index ceaa9b32580a3..091058ed2aca2 100644 --- a/boards/renesas/ek_ra4e2/ek_ra4e2_defconfig +++ b/boards/renesas/ek_ra4e2/ek_ra4e2_defconfig @@ -5,7 +5,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=100000000 # Enable GPIO CONFIG_GPIO=y -CONFIG_PINCTRL=y # Enable Console CONFIG_SERIAL=y diff --git a/boards/renesas/ek_ra4m2/ek_ra4m2_defconfig b/boards/renesas/ek_ra4m2/ek_ra4m2_defconfig index ceaa9b32580a3..091058ed2aca2 100644 --- a/boards/renesas/ek_ra4m2/ek_ra4m2_defconfig +++ b/boards/renesas/ek_ra4m2/ek_ra4m2_defconfig @@ -5,7 +5,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=100000000 # Enable GPIO CONFIG_GPIO=y -CONFIG_PINCTRL=y # Enable Console CONFIG_SERIAL=y diff --git a/boards/renesas/ek_ra4m3/ek_ra4m3_defconfig b/boards/renesas/ek_ra4m3/ek_ra4m3_defconfig index ceaa9b32580a3..091058ed2aca2 100644 --- a/boards/renesas/ek_ra4m3/ek_ra4m3_defconfig +++ b/boards/renesas/ek_ra4m3/ek_ra4m3_defconfig @@ -5,7 +5,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=100000000 # Enable GPIO CONFIG_GPIO=y -CONFIG_PINCTRL=y # Enable Console CONFIG_SERIAL=y diff --git a/boards/renesas/ek_ra4w1/ek_ra4w1_defconfig b/boards/renesas/ek_ra4w1/ek_ra4w1_defconfig index 92542b8ab9c11..3b4854b85b7c2 100644 --- a/boards/renesas/ek_ra4w1/ek_ra4w1_defconfig +++ b/boards/renesas/ek_ra4w1/ek_ra4w1_defconfig @@ -5,7 +5,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=32000000 # Enable GPIO CONFIG_GPIO=y -CONFIG_PINCTRL=y # Enable Console CONFIG_SERIAL=y diff --git a/boards/renesas/ek_ra6e2/ek_ra6e2_defconfig b/boards/renesas/ek_ra6e2/ek_ra6e2_defconfig index 92bb425cfa8bb..956d3f6d6505c 100644 --- a/boards/renesas/ek_ra6e2/ek_ra6e2_defconfig +++ b/boards/renesas/ek_ra6e2/ek_ra6e2_defconfig @@ -5,7 +5,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=200000000 # Enable GPIO CONFIG_GPIO=y -CONFIG_PINCTRL=y # Enable Console CONFIG_SERIAL=y diff --git a/boards/renesas/ek_ra6m1/ek_ra6m1_defconfig b/boards/renesas/ek_ra6m1/ek_ra6m1_defconfig index 00adc77146e5e..f252ad1bf25e5 100644 --- a/boards/renesas/ek_ra6m1/ek_ra6m1_defconfig +++ b/boards/renesas/ek_ra6m1/ek_ra6m1_defconfig @@ -5,7 +5,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=120000000 # Enable GPIO CONFIG_GPIO=y -CONFIG_PINCTRL=y CONFIG_BUILD_OUTPUT_HEX=y CONFIG_BUILD_NO_GAP_FILL=y diff --git a/boards/renesas/ek_ra6m2/ek_ra6m2_defconfig b/boards/renesas/ek_ra6m2/ek_ra6m2_defconfig index 00adc77146e5e..f252ad1bf25e5 100644 --- a/boards/renesas/ek_ra6m2/ek_ra6m2_defconfig +++ b/boards/renesas/ek_ra6m2/ek_ra6m2_defconfig @@ -5,7 +5,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=120000000 # Enable GPIO CONFIG_GPIO=y -CONFIG_PINCTRL=y CONFIG_BUILD_OUTPUT_HEX=y CONFIG_BUILD_NO_GAP_FILL=y diff --git a/boards/renesas/ek_ra6m3/ek_ra6m3_defconfig b/boards/renesas/ek_ra6m3/ek_ra6m3_defconfig index 31c2fa759e481..82698fecf6237 100644 --- a/boards/renesas/ek_ra6m3/ek_ra6m3_defconfig +++ b/boards/renesas/ek_ra6m3/ek_ra6m3_defconfig @@ -5,7 +5,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=120000000 # Enable GPIO CONFIG_GPIO=y -CONFIG_PINCTRL=y # Enable Console CONFIG_SERIAL=y diff --git a/boards/renesas/ek_ra6m4/ek_ra6m4_defconfig b/boards/renesas/ek_ra6m4/ek_ra6m4_defconfig index 45a5a73366a55..7cdc7f0680aec 100644 --- a/boards/renesas/ek_ra6m4/ek_ra6m4_defconfig +++ b/boards/renesas/ek_ra6m4/ek_ra6m4_defconfig @@ -5,7 +5,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=200000000 # Enable GPIO CONFIG_GPIO=y -CONFIG_PINCTRL=y # Enable Console CONFIG_SERIAL=y diff --git a/boards/renesas/ek_ra6m5/ek_ra6m5_defconfig b/boards/renesas/ek_ra6m5/ek_ra6m5_defconfig index 4b5534eb1ff12..80c741f62fb3f 100644 --- a/boards/renesas/ek_ra6m5/ek_ra6m5_defconfig +++ b/boards/renesas/ek_ra6m5/ek_ra6m5_defconfig @@ -5,7 +5,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=200000000 # Enable GPIO CONFIG_GPIO=y -CONFIG_PINCTRL=y CONFIG_BUILD_OUTPUT_HEX=y CONFIG_BUILD_NO_GAP_FILL=y diff --git a/boards/renesas/ek_ra8d1/ek_ra8d1_defconfig b/boards/renesas/ek_ra8d1/ek_ra8d1_defconfig index 02195f347f9c1..ee29549b28c80 100644 --- a/boards/renesas/ek_ra8d1/ek_ra8d1_defconfig +++ b/boards/renesas/ek_ra8d1/ek_ra8d1_defconfig @@ -5,7 +5,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=480000000 # Enable GPIO CONFIG_GPIO=y -CONFIG_PINCTRL=y # Enable Console CONFIG_SERIAL=y diff --git a/boards/renesas/ek_ra8m1/ek_ra8m1_defconfig b/boards/renesas/ek_ra8m1/ek_ra8m1_defconfig index d68962b8c92e9..7fd87eb217c23 100644 --- a/boards/renesas/ek_ra8m1/ek_ra8m1_defconfig +++ b/boards/renesas/ek_ra8m1/ek_ra8m1_defconfig @@ -5,7 +5,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=480000000 # Enable GPIO CONFIG_GPIO=y -CONFIG_PINCTRL=y # Enable Console CONFIG_SERIAL=y diff --git a/boards/renesas/fpb_ra6e1/fpb_ra6e1_defconfig b/boards/renesas/fpb_ra6e1/fpb_ra6e1_defconfig index fa7ef716d3f62..8733fd3cdc7cd 100644 --- a/boards/renesas/fpb_ra6e1/fpb_ra6e1_defconfig +++ b/boards/renesas/fpb_ra6e1/fpb_ra6e1_defconfig @@ -5,7 +5,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=200000000 # Enable GPIO CONFIG_GPIO=y -CONFIG_PINCTRL=y CONFIG_BUILD_OUTPUT_HEX=y CONFIG_BUILD_NO_GAP_FILL=y diff --git a/boards/renesas/fpb_ra6e2/fpb_ra6e2_defconfig b/boards/renesas/fpb_ra6e2/fpb_ra6e2_defconfig index 92bb425cfa8bb..956d3f6d6505c 100644 --- a/boards/renesas/fpb_ra6e2/fpb_ra6e2_defconfig +++ b/boards/renesas/fpb_ra6e2/fpb_ra6e2_defconfig @@ -5,7 +5,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=200000000 # Enable GPIO CONFIG_GPIO=y -CONFIG_PINCTRL=y # Enable Console CONFIG_SERIAL=y diff --git a/boards/renesas/mck_ra8t1/mck_ra8t1_defconfig b/boards/renesas/mck_ra8t1/mck_ra8t1_defconfig index 5cd13d146bfb5..3a064b9d95877 100644 --- a/boards/renesas/mck_ra8t1/mck_ra8t1_defconfig +++ b/boards/renesas/mck_ra8t1/mck_ra8t1_defconfig @@ -5,7 +5,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=480000000 # Enable GPIO CONFIG_GPIO=y -CONFIG_PINCTRL=y # Enable Console CONFIG_SERIAL=y From 56326e4677767994513f8134a1292ca9c1f91c82 Mon Sep 17 00:00:00 2001 From: Thao Luong Date: Fri, 1 Nov 2024 00:09:09 +0700 Subject: [PATCH 2118/4482] soc: renesas: ra: Remove CONFIG_PINCTRL Remove CONFIG_PINCTRL from ra defconfig files Signed-off-by: Thao Luong --- soc/renesas/ra/ra2a1/Kconfig.defconfig | 3 --- soc/renesas/ra/ra4e2/Kconfig.defconfig | 3 --- soc/renesas/ra/ra4m2/Kconfig.defconfig | 3 --- soc/renesas/ra/ra4m3/Kconfig.defconfig | 3 --- soc/renesas/ra/ra4w1/Kconfig.defconfig | 3 --- soc/renesas/ra/ra6e1/Kconfig.defconfig | 3 --- soc/renesas/ra/ra6e2/Kconfig.defconfig | 3 --- soc/renesas/ra/ra6m1/Kconfig.defconfig | 3 --- soc/renesas/ra/ra6m2/Kconfig.defconfig | 3 --- soc/renesas/ra/ra6m3/Kconfig.defconfig | 3 --- soc/renesas/ra/ra6m4/Kconfig.defconfig | 3 --- soc/renesas/ra/ra6m5/Kconfig.defconfig | 3 --- soc/renesas/ra/ra8d1/Kconfig.defconfig | 3 --- soc/renesas/ra/ra8m1/Kconfig.defconfig | 3 --- soc/renesas/ra/ra8t1/Kconfig.defconfig | 3 --- 15 files changed, 45 deletions(-) diff --git a/soc/renesas/ra/ra2a1/Kconfig.defconfig b/soc/renesas/ra/ra2a1/Kconfig.defconfig index 33a1effb92b6b..7176e95746acb 100644 --- a/soc/renesas/ra/ra2a1/Kconfig.defconfig +++ b/soc/renesas/ra/ra2a1/Kconfig.defconfig @@ -6,7 +6,4 @@ if SOC_SERIES_RA2A1 config NUM_IRQS default 32 -config PINCTRL - default y - endif # SOC_SERIES_RA2A1 diff --git a/soc/renesas/ra/ra4e2/Kconfig.defconfig b/soc/renesas/ra/ra4e2/Kconfig.defconfig index 985e17502d705..c19cc52a7f7f4 100644 --- a/soc/renesas/ra/ra4e2/Kconfig.defconfig +++ b/soc/renesas/ra/ra4e2/Kconfig.defconfig @@ -6,7 +6,4 @@ if SOC_SERIES_RA4E2 config NUM_IRQS default 96 -config PINCTRL - default y - endif # SOC_SERIES_RA4E2 diff --git a/soc/renesas/ra/ra4m2/Kconfig.defconfig b/soc/renesas/ra/ra4m2/Kconfig.defconfig index 4d0b12330b0c5..27a3e35097d89 100644 --- a/soc/renesas/ra/ra4m2/Kconfig.defconfig +++ b/soc/renesas/ra/ra4m2/Kconfig.defconfig @@ -6,7 +6,4 @@ if SOC_SERIES_RA4M2 config NUM_IRQS default 96 -config PINCTRL - default y - endif # SOC_SERIES_RA4M2 diff --git a/soc/renesas/ra/ra4m3/Kconfig.defconfig b/soc/renesas/ra/ra4m3/Kconfig.defconfig index a93ed41ee240f..974ba532beec0 100644 --- a/soc/renesas/ra/ra4m3/Kconfig.defconfig +++ b/soc/renesas/ra/ra4m3/Kconfig.defconfig @@ -6,7 +6,4 @@ if SOC_SERIES_RA4M3 config NUM_IRQS default 96 -config PINCTRL - default y - endif # SOC_SERIES_RA4M3 diff --git a/soc/renesas/ra/ra4w1/Kconfig.defconfig b/soc/renesas/ra/ra4w1/Kconfig.defconfig index c73bab8b0975f..56c1866d0e96b 100644 --- a/soc/renesas/ra/ra4w1/Kconfig.defconfig +++ b/soc/renesas/ra/ra4w1/Kconfig.defconfig @@ -6,7 +6,4 @@ if SOC_SERIES_RA4W1 config NUM_IRQS default 32 -config PINCTRL - default y - endif # SOC_SERIES_RA4W1 diff --git a/soc/renesas/ra/ra6e1/Kconfig.defconfig b/soc/renesas/ra/ra6e1/Kconfig.defconfig index 07ec796a33fb2..dfdaec67bf456 100644 --- a/soc/renesas/ra/ra6e1/Kconfig.defconfig +++ b/soc/renesas/ra/ra6e1/Kconfig.defconfig @@ -6,7 +6,4 @@ if SOC_SERIES_RA6E1 config NUM_IRQS default 96 -config PINCTRL - default y - endif # SOC_SERIES_RA6E1 diff --git a/soc/renesas/ra/ra6e2/Kconfig.defconfig b/soc/renesas/ra/ra6e2/Kconfig.defconfig index e08fb2e13563d..25c013dd85529 100644 --- a/soc/renesas/ra/ra6e2/Kconfig.defconfig +++ b/soc/renesas/ra/ra6e2/Kconfig.defconfig @@ -6,7 +6,4 @@ if SOC_SERIES_RA6E2 config NUM_IRQS default 96 -config PINCTRL - default y - endif # SOC_SERIES_RA6E2 diff --git a/soc/renesas/ra/ra6m1/Kconfig.defconfig b/soc/renesas/ra/ra6m1/Kconfig.defconfig index 4f61b47586958..af401ae242cd0 100644 --- a/soc/renesas/ra/ra6m1/Kconfig.defconfig +++ b/soc/renesas/ra/ra6m1/Kconfig.defconfig @@ -6,7 +6,4 @@ if SOC_SERIES_RA6M1 config NUM_IRQS default 96 -config PINCTRL - default y - endif # SOC_SERIES_RA6M1 diff --git a/soc/renesas/ra/ra6m2/Kconfig.defconfig b/soc/renesas/ra/ra6m2/Kconfig.defconfig index 33ada2c756e89..c95ecd0cc2928 100644 --- a/soc/renesas/ra/ra6m2/Kconfig.defconfig +++ b/soc/renesas/ra/ra6m2/Kconfig.defconfig @@ -6,7 +6,4 @@ if SOC_SERIES_RA6M2 config NUM_IRQS default 96 -config PINCTRL - default y - endif # SOC_SERIES_RA6M2 diff --git a/soc/renesas/ra/ra6m3/Kconfig.defconfig b/soc/renesas/ra/ra6m3/Kconfig.defconfig index f1d9a2998d3e4..e2a02946b3849 100644 --- a/soc/renesas/ra/ra6m3/Kconfig.defconfig +++ b/soc/renesas/ra/ra6m3/Kconfig.defconfig @@ -6,7 +6,4 @@ if SOC_SERIES_RA6M3 config NUM_IRQS default 96 -config PINCTRL - default y - endif # SOC_SERIES_RA6M3 diff --git a/soc/renesas/ra/ra6m4/Kconfig.defconfig b/soc/renesas/ra/ra6m4/Kconfig.defconfig index 672c88d9aa3b2..aa79e91370a74 100644 --- a/soc/renesas/ra/ra6m4/Kconfig.defconfig +++ b/soc/renesas/ra/ra6m4/Kconfig.defconfig @@ -6,7 +6,4 @@ if SOC_SERIES_RA6M4 config NUM_IRQS default 96 -config PINCTRL - default y - endif # SOC_SERIES_RA6M4 diff --git a/soc/renesas/ra/ra6m5/Kconfig.defconfig b/soc/renesas/ra/ra6m5/Kconfig.defconfig index ca09319ed2a0c..d0c5c5fc0c3c4 100644 --- a/soc/renesas/ra/ra6m5/Kconfig.defconfig +++ b/soc/renesas/ra/ra6m5/Kconfig.defconfig @@ -6,7 +6,4 @@ if SOC_SERIES_RA6M5 config NUM_IRQS default 96 -config PINCTRL - default y - endif # SOC_SERIES_RA6M5 diff --git a/soc/renesas/ra/ra8d1/Kconfig.defconfig b/soc/renesas/ra/ra8d1/Kconfig.defconfig index 4ff5330ac5a29..5c2a630bfd75d 100644 --- a/soc/renesas/ra/ra8d1/Kconfig.defconfig +++ b/soc/renesas/ra/ra8d1/Kconfig.defconfig @@ -6,9 +6,6 @@ if SOC_SERIES_RA8D1 config NUM_IRQS default 96 -config PINCTRL - default y - # Set to the minimal size of data which can be written. config FLASH_FILL_BUFFER_SIZE default 128 diff --git a/soc/renesas/ra/ra8m1/Kconfig.defconfig b/soc/renesas/ra/ra8m1/Kconfig.defconfig index 426625e029589..d963468bb07e3 100644 --- a/soc/renesas/ra/ra8m1/Kconfig.defconfig +++ b/soc/renesas/ra/ra8m1/Kconfig.defconfig @@ -6,9 +6,6 @@ if SOC_SERIES_RA8M1 config NUM_IRQS default 96 -config PINCTRL - default y - # Set to the minimal size of data which can be written. config FLASH_FILL_BUFFER_SIZE default 128 diff --git a/soc/renesas/ra/ra8t1/Kconfig.defconfig b/soc/renesas/ra/ra8t1/Kconfig.defconfig index 1cd1578e62142..3e721bd8fc3ac 100644 --- a/soc/renesas/ra/ra8t1/Kconfig.defconfig +++ b/soc/renesas/ra/ra8t1/Kconfig.defconfig @@ -6,9 +6,6 @@ if SOC_SERIES_RA8T1 config NUM_IRQS default 96 -config PINCTRL - default y - # Set to the minimal size of data which can be written. config FLASH_FILL_BUFFER_SIZE default 128 From c66dcd52db81c3f39c779d00d4f86896cde8d3d3 Mon Sep 17 00:00:00 2001 From: Thao Luong Date: Fri, 1 Nov 2024 00:12:12 +0700 Subject: [PATCH 2119/4482] drivers: Select PINCTRL for renesas RA drivers Select PINCTRL for drivers: adc, i2c, pwm, serial and spi Signed-off-by: Thao Luong --- drivers/adc/Kconfig.renesas_ra | 1 + drivers/i2c/Kconfig.renesas_ra | 1 + drivers/pwm/Kconfig.renesas_ra8 | 1 + drivers/serial/Kconfig.renesas_ra8 | 1 + drivers/spi/Kconfig.renesas_ra8 | 1 + 5 files changed, 5 insertions(+) diff --git a/drivers/adc/Kconfig.renesas_ra b/drivers/adc/Kconfig.renesas_ra index 1027788f9c613..b63050b7f5353 100644 --- a/drivers/adc/Kconfig.renesas_ra +++ b/drivers/adc/Kconfig.renesas_ra @@ -8,5 +8,6 @@ config ADC_RENESAS_RA default y depends on DT_HAS_RENESAS_RA_ADC_ENABLED select USE_RA_FSP_ADC + select PINCTRL help Enable Renesas RA ADC Driver. diff --git a/drivers/i2c/Kconfig.renesas_ra b/drivers/i2c/Kconfig.renesas_ra index bf11f2d072887..cf68b2a459767 100644 --- a/drivers/i2c/Kconfig.renesas_ra +++ b/drivers/i2c/Kconfig.renesas_ra @@ -8,5 +8,6 @@ config RENESAS_RA_I2C_IIC default y depends on DT_HAS_RENESAS_RA_IIC_ENABLED select USE_RA_FSP_I2C_IIC + select PINCTRL help Enable Renesas RA I2C IIC Driver. diff --git a/drivers/pwm/Kconfig.renesas_ra8 b/drivers/pwm/Kconfig.renesas_ra8 index 31701a132ce9e..b44a1bc971180 100644 --- a/drivers/pwm/Kconfig.renesas_ra8 +++ b/drivers/pwm/Kconfig.renesas_ra8 @@ -6,5 +6,6 @@ config PWM_RENESAS_RA8 default y depends on DT_HAS_RENESAS_RA8_PWM_ENABLED select USE_RA_FSP_GPT + select PINCTRL help Enable Renesas RA8 PWM Driver. diff --git a/drivers/serial/Kconfig.renesas_ra8 b/drivers/serial/Kconfig.renesas_ra8 index a3752695f5ef2..c95018f41bba3 100644 --- a/drivers/serial/Kconfig.renesas_ra8 +++ b/drivers/serial/Kconfig.renesas_ra8 @@ -10,6 +10,7 @@ config UART_RA8_SCI_B select SERIAL_SUPPORT_ASYNC select USE_RA_FSP_SCI_B_UART select USE_RA_FSP_DTC if UART_ASYNC_API + select PINCTRL help Enable Renesas RA SCI_B UART Driver. diff --git a/drivers/spi/Kconfig.renesas_ra8 b/drivers/spi/Kconfig.renesas_ra8 index fe0512d049a22..f2bf3a18fd30b 100644 --- a/drivers/spi/Kconfig.renesas_ra8 +++ b/drivers/spi/Kconfig.renesas_ra8 @@ -8,6 +8,7 @@ config SPI_RENESAS_RA8 default y depends on DT_HAS_RENESAS_RA8_SPI_B_ENABLED select USE_RA_FSP_SPI_B + select PINCTRL help Enable Renesas RA RA SPI B Driver. From d33686fef703e216e810bbc49a8528db255aaa95 Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Fri, 25 Oct 2024 17:14:40 +0200 Subject: [PATCH 2120/4482] tests/subsys/llext: Remove llext.simple.readonly_fs_loader The fs_loader test is always executed in the main test source when CONFIG_FILE_SYSTEM is set, and this is in turn enabled by per-board config overlays. So there is no point in having a separate test case: it is simply a duplicate of the "readonly" test. Signed-off-by: Luca Burelli --- tests/subsys/llext/simple/testcase.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/subsys/llext/simple/testcase.yaml b/tests/subsys/llext/simple/testcase.yaml index 334ad8bf4b393..b3c06bca766e9 100644 --- a/tests/subsys/llext/simple/testcase.yaml +++ b/tests/subsys/llext/simple/testcase.yaml @@ -48,14 +48,6 @@ tests: extra_configs: - CONFIG_USERSPACE=y - CONFIG_LLEXT_STORAGE_WRITABLE=n - llext.simple.readonly_fs_loader: - arch_allow: arm riscv # Xtensa needs writable storage - filter: not CONFIG_MPU and not CONFIG_MMU and not CONFIG_SOC_SERIES_S32ZE - extra_configs: - - arch:arm:CONFIG_ARM_MPU=n - - arch:arm:CONFIG_ARM_AARCH32_MMU=n - - arch:riscv:CONFIG_RISCV_PMP=n - - CONFIG_LLEXT_STORAGE_WRITABLE=n llext.simple.readonly_mmu: arch_allow: arm64 arm riscv filter: CONFIG_ARM_MMU From 184a2a65a2b9155194fd5145e85c67fd893aeb16 Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Wed, 30 Oct 2024 17:37:16 +0100 Subject: [PATCH 2121/4482] tests/subsys/llext: update filtering logic Restore Apollo boards now that the issue has been fixed. Also remove extra CONFIG_SOC_SERIES_S32ZE filters, as they are already covered by the 'platform_exclude' common section. Signed-off-by: Luca Burelli --- tests/subsys/llext/simple/testcase.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/subsys/llext/simple/testcase.yaml b/tests/subsys/llext/simple/testcase.yaml index b3c06bca766e9..16948980f4a1e 100644 --- a/tests/subsys/llext/simple/testcase.yaml +++ b/tests/subsys/llext/simple/testcase.yaml @@ -2,8 +2,6 @@ common: tags: llext platform_exclude: # platforms with active issues - - apollo4p_evb # See #73443 - - apollo4p_blue_kxr_evb # See #73443 - numaker_pfm_m487 # See #63167 - s32z2xxdc2/s32z270/rtu0 # See commit 18a0660 - s32z2xxdc2/s32z270/rtu1 # See commit 18a0660 @@ -35,7 +33,7 @@ tests: # subsystem (storage type, ELF type, MPU/MMU etc) llext.simple.readonly: arch_allow: arm riscv # Xtensa needs writable storage - filter: not CONFIG_MPU and not CONFIG_MMU and not CONFIG_SOC_SERIES_S32ZE + filter: not CONFIG_MPU and not CONFIG_MMU extra_configs: - arch:arm:CONFIG_ARM_MPU=n - arch:arm:CONFIG_ARM_AARCH32_MMU=n @@ -59,7 +57,7 @@ tests: arch_allow: arm xtensa riscv integration_platforms: - qemu_xtensa/dc233c # Xtensa ISA - filter: not CONFIG_MPU and not CONFIG_MMU and not CONFIG_SOC_SERIES_S32ZE + filter: not CONFIG_MPU and not CONFIG_MMU extra_configs: - arch:arm:CONFIG_ARM_MPU=n - arch:arm:CONFIG_ARM_AARCH32_MMU=n @@ -83,7 +81,7 @@ tests: arch_allow: arm xtensa riscv integration_platforms: - qemu_xtensa/dc233c # Xtensa ISA - filter: not CONFIG_MPU and not CONFIG_MMU and not CONFIG_SOC_SERIES_S32ZE + filter: not CONFIG_MPU and not CONFIG_MMU extra_configs: - arch:arm:CONFIG_ARM_MPU=n - arch:arm:CONFIG_ARM_AARCH32_MMU=n From 7427d1c85b49255440628b7d9546fffddf4cf037 Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Fri, 25 Oct 2024 17:35:26 +0200 Subject: [PATCH 2122/4482] tests/subsys/llext: cleanup memory protection options Most of the tests in the LLEXT subsystem test suite run with memory protection hardware (MPU/MMU) disabled, to avoid including memory domain issues while testing the core functionality. Only a few tests need to run with MPU/MMU enabled. This patch simplifies the testcase.yaml by setting the memory protection as disabled in a shared config file that is included by most tests. Signed-off-by: Luca Burelli --- .../llext/simple/no_mem_protection.conf | 8 ++++++ tests/subsys/llext/simple/prj.conf | 3 ++ tests/subsys/llext/simple/testcase.yaml | 28 ++++++++----------- 3 files changed, 22 insertions(+), 17 deletions(-) create mode 100644 tests/subsys/llext/simple/no_mem_protection.conf diff --git a/tests/subsys/llext/simple/no_mem_protection.conf b/tests/subsys/llext/simple/no_mem_protection.conf new file mode 100644 index 0000000000000..d45d7836d4d1f --- /dev/null +++ b/tests/subsys/llext/simple/no_mem_protection.conf @@ -0,0 +1,8 @@ +# Disable MPU and MMU on all supported arches for the bulk of the tests. +# +# This uses the fact that setting an unknown symbol to 'n' has no effect, +# so it is safe to group different arch-specific settings here. +# +CONFIG_ARM_MPU=n +CONFIG_ARM_AARCH32_MMU=n +CONFIG_RISCV_PMP=n diff --git a/tests/subsys/llext/simple/prj.conf b/tests/subsys/llext/simple/prj.conf index d2733eb1dc34f..33f3a0208e460 100644 --- a/tests/subsys/llext/simple/prj.conf +++ b/tests/subsys/llext/simple/prj.conf @@ -7,3 +7,6 @@ CONFIG_LLEXT_EXPORT_DEVICES=y CONFIG_LLEXT_LOG_LEVEL_DBG=y CONFIG_APPLICATION_DEFINED_SYSCALL=y + +# The bulk of the tests run with MPU/MMU disabled by including additional +# configuration entries from no_mem_protection.conf. diff --git a/tests/subsys/llext/simple/testcase.yaml b/tests/subsys/llext/simple/testcase.yaml index 16948980f4a1e..55139a274322d 100644 --- a/tests/subsys/llext/simple/testcase.yaml +++ b/tests/subsys/llext/simple/testcase.yaml @@ -20,6 +20,8 @@ common: - mps2/an521/cpu0 # ARM Cortex-M33 (ARMv8-M ISA) extra_configs: - arch:arm64:CONFIG_LLEXT_HEAP_SIZE=128 + extra_conf_files: + - prj.conf tests: # While there is in practice no value in compiling subsys/llext/*.c @@ -29,15 +31,15 @@ tests: llext.simple.loader_build: build_only: true - # Run the suite with all combinations of core Kconfig options for the llext - # subsystem (storage type, ELF type, MPU/MMU etc) + # Run the suite with all combinations of core Kconfig options for the LLEXT + # subsystem (storage type, ELF type, MPU/MMU etc). To focus on LLEXT issues, + # most tests include no_mem_protection.conf, which disables memory protection + # hardware completely. llext.simple.readonly: arch_allow: arm riscv # Xtensa needs writable storage filter: not CONFIG_MPU and not CONFIG_MMU + extra_conf_files: ['no_mem_protection.conf'] extra_configs: - - arch:arm:CONFIG_ARM_MPU=n - - arch:arm:CONFIG_ARM_AARCH32_MMU=n - - arch:riscv:CONFIG_RISCV_PMP=n - CONFIG_LLEXT_STORAGE_WRITABLE=n llext.simple.readonly_mpu: min_ram: 128 @@ -58,20 +60,16 @@ tests: integration_platforms: - qemu_xtensa/dc233c # Xtensa ISA filter: not CONFIG_MPU and not CONFIG_MMU + extra_conf_files: ['no_mem_protection.conf'] extra_configs: - - arch:arm:CONFIG_ARM_MPU=n - - arch:arm:CONFIG_ARM_AARCH32_MMU=n - - arch:riscv:CONFIG_RISCV_PMP=n - CONFIG_LLEXT_STORAGE_WRITABLE=y llext.simple.writable_relocatable: arch_allow: arm xtensa riscv integration_platforms: - qemu_xtensa/dc233c # Xtensa ISA filter: not CONFIG_MPU and not CONFIG_MMU + extra_conf_files: ['no_mem_protection.conf'] extra_configs: - - arch:arm:CONFIG_ARM_MPU=n - - arch:arm:CONFIG_ARM_AARCH32_MMU=n - - arch:riscv:CONFIG_RISCV_PMP=n - CONFIG_LLEXT_STORAGE_WRITABLE=y - CONFIG_LLEXT_TYPE_ELF_RELOCATABLE=y @@ -82,10 +80,8 @@ tests: integration_platforms: - qemu_xtensa/dc233c # Xtensa ISA filter: not CONFIG_MPU and not CONFIG_MMU + extra_conf_files: ['no_mem_protection.conf'] extra_configs: - - arch:arm:CONFIG_ARM_MPU=n - - arch:arm:CONFIG_ARM_AARCH32_MMU=n - - arch:riscv:CONFIG_RISCV_PMP=n - CONFIG_LLEXT_STORAGE_WRITABLE=y - CONFIG_LLEXT_EXPORT_BUILTINS_BY_SLID=y llext.simple.writable_relocatable_slid_linking: @@ -93,10 +89,8 @@ tests: integration_platforms: - qemu_xtensa/dc233c # Xtensa ISA filter: not CONFIG_MPU and not CONFIG_MMU + extra_conf_files: ['no_mem_protection.conf'] extra_configs: - - arch:arm:CONFIG_ARM_MPU=n - - arch:arm:CONFIG_ARM_AARCH32_MMU=n - - arch:riscv:CONFIG_RISCV_PMP=n - CONFIG_LLEXT_STORAGE_WRITABLE=y - CONFIG_LLEXT_TYPE_ELF_RELOCATABLE=y - CONFIG_LLEXT_EXPORT_BUILTINS_BY_SLID=y From de1e76fa4e592bcd8592c64501484b0abf5241dd Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Wed, 30 Oct 2024 17:45:35 +0100 Subject: [PATCH 2123/4482] tests/subsys/llext: fix coverage for readonly_mmu test The test was not being run on arm64 and riscv because the filter was incorrect. Properly fix the filter to run the test on all platforms that have any kind of MMU enabled. Signed-off-by: Luca Burelli --- tests/subsys/llext/simple/testcase.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/subsys/llext/simple/testcase.yaml b/tests/subsys/llext/simple/testcase.yaml index 55139a274322d..901bd3d06ad6f 100644 --- a/tests/subsys/llext/simple/testcase.yaml +++ b/tests/subsys/llext/simple/testcase.yaml @@ -50,10 +50,11 @@ tests: - CONFIG_LLEXT_STORAGE_WRITABLE=n llext.simple.readonly_mmu: arch_allow: arm64 arm riscv - filter: CONFIG_ARM_MMU + filter: CONFIG_MMU or CONFIG_RISCV_PMP integration_platforms: - qemu_cortex_a53 # ARM Cortex-A53 (ARMv8-A ISA) extra_configs: + - CONFIG_LLEXT_HEAP_SIZE=128 # qemu_cortex_a9 requires larger heap - CONFIG_LLEXT_STORAGE_WRITABLE=n llext.simple.writable: arch_allow: arm xtensa riscv From f59e2477ba326459b47c6be1adee120c9cdc8e06 Mon Sep 17 00:00:00 2001 From: Zheng Wu Date: Wed, 30 Oct 2024 19:34:45 +0800 Subject: [PATCH 2124/4482] drivers: serial: fix potential overflow in fifo_fill and fifo_read Change the type of num_tx/num_rx to avoid overflow. Fixes #80599 Signed-off-by: Zheng Wu --- drivers/serial/leuart_gecko.c | 4 ++-- drivers/serial/uart_gecko.c | 4 ++-- drivers/serial/uart_mcux.c | 4 ++-- drivers/serial/uart_mcux_flexcomm.c | 4 ++-- drivers/serial/uart_mcux_iuart.c | 4 ++-- drivers/serial/uart_mcux_lpsci.c | 4 ++-- drivers/serial/uart_mcux_lpuart.c | 4 ++-- drivers/serial/uart_nrfx_uart.c | 4 ++-- drivers/serial/uart_pl011.c | 4 ++-- drivers/serial/uart_renesas_ra8_sci_b.c | 4 ++-- drivers/serial/uart_renesas_ra_sci.c | 4 ++-- drivers/serial/uart_rv32m1_lpuart.c | 4 ++-- drivers/serial/uart_stellaris.c | 4 ++-- drivers/serial/uart_stm32.c | 22 ++++++++-------------- drivers/serial/usart_gd32.c | 4 ++-- 15 files changed, 36 insertions(+), 42 deletions(-) diff --git a/drivers/serial/leuart_gecko.c b/drivers/serial/leuart_gecko.c index 9eec982802c15..335e2285c1acc 100644 --- a/drivers/serial/leuart_gecko.c +++ b/drivers/serial/leuart_gecko.c @@ -101,7 +101,7 @@ static int leuart_gecko_fifo_fill(const struct device *dev, int len) { LEUART_TypeDef *base = DEV_BASE(dev); - uint8_t num_tx = 0U; + int num_tx = 0U; while ((len - num_tx > 0) && (base->STATUS & LEUART_STATUS_TXBL)) { @@ -116,7 +116,7 @@ static int leuart_gecko_fifo_read(const struct device *dev, uint8_t *rx_data, const int len) { LEUART_TypeDef *base = DEV_BASE(dev); - uint8_t num_rx = 0U; + int num_rx = 0U; while ((len - num_rx > 0) && (base->STATUS & LEUART_STATUS_RXDATAV)) { diff --git a/drivers/serial/uart_gecko.c b/drivers/serial/uart_gecko.c index ffda4fd977ee4..11c396bcd9f1f 100644 --- a/drivers/serial/uart_gecko.c +++ b/drivers/serial/uart_gecko.c @@ -222,7 +222,7 @@ static int uart_gecko_fifo_fill(const struct device *dev, const uint8_t *tx_data int len) { const struct uart_gecko_config *config = dev->config; - uint8_t num_tx = 0U; + int num_tx = 0U; while ((len - num_tx > 0) && (config->base->STATUS & USART_STATUS_TXBL)) { @@ -237,7 +237,7 @@ static int uart_gecko_fifo_read(const struct device *dev, uint8_t *rx_data, const int len) { const struct uart_gecko_config *config = dev->config; - uint8_t num_rx = 0U; + int num_rx = 0U; while ((len - num_rx > 0) && (config->base->STATUS & USART_STATUS_RXDATAV)) { diff --git a/drivers/serial/uart_mcux.c b/drivers/serial/uart_mcux.c index 7f741ebc3499e..07b0a0e44e255 100644 --- a/drivers/serial/uart_mcux.c +++ b/drivers/serial/uart_mcux.c @@ -179,7 +179,7 @@ static int uart_mcux_fifo_fill(const struct device *dev, int len) { const struct uart_mcux_config *config = dev->config; - uint8_t num_tx = 0U; + int num_tx = 0U; while ((len - num_tx > 0) && (UART_GetStatusFlags(config->base) & kUART_TxDataRegEmptyFlag)) { @@ -194,7 +194,7 @@ static int uart_mcux_fifo_read(const struct device *dev, uint8_t *rx_data, const int len) { const struct uart_mcux_config *config = dev->config; - uint8_t num_rx = 0U; + int num_rx = 0U; while ((len - num_rx > 0) && (UART_GetStatusFlags(config->base) & kUART_RxDataRegFullFlag)) { diff --git a/drivers/serial/uart_mcux_flexcomm.c b/drivers/serial/uart_mcux_flexcomm.c index 7b1a7d7c29d55..b39a3a48f11a8 100644 --- a/drivers/serial/uart_mcux_flexcomm.c +++ b/drivers/serial/uart_mcux_flexcomm.c @@ -146,7 +146,7 @@ static int mcux_flexcomm_fifo_fill(const struct device *dev, int len) { const struct mcux_flexcomm_config *config = dev->config; - uint8_t num_tx = 0U; + int num_tx = 0U; while ((len - num_tx > 0) && (USART_GetStatusFlags(config->base) @@ -162,7 +162,7 @@ static int mcux_flexcomm_fifo_read(const struct device *dev, uint8_t *rx_data, const int len) { const struct mcux_flexcomm_config *config = dev->config; - uint8_t num_rx = 0U; + int num_rx = 0U; while ((len - num_rx > 0) && (USART_GetStatusFlags(config->base) diff --git a/drivers/serial/uart_mcux_iuart.c b/drivers/serial/uart_mcux_iuart.c index f13e3e8df9383..d067f7f622050 100644 --- a/drivers/serial/uart_mcux_iuart.c +++ b/drivers/serial/uart_mcux_iuart.c @@ -86,7 +86,7 @@ static int mcux_iuart_fifo_fill(const struct device *dev, int len) { const struct mcux_iuart_config *config = dev->config; - uint8_t num_tx = 0U; + int num_tx = 0U; while ((len - num_tx > 0) && (UART_GetStatusFlag(config->base, kUART_TxEmptyFlag))) { @@ -101,7 +101,7 @@ static int mcux_iuart_fifo_read(const struct device *dev, uint8_t *rx_data, const int len) { const struct mcux_iuart_config *config = dev->config; - uint8_t num_rx = 0U; + int num_rx = 0U; while ((len - num_rx > 0) && (UART_GetStatusFlag(config->base, kUART_RxDataReadyFlag))) { diff --git a/drivers/serial/uart_mcux_lpsci.c b/drivers/serial/uart_mcux_lpsci.c index 9a5439d48ed2e..6a87ef217d7c0 100644 --- a/drivers/serial/uart_mcux_lpsci.c +++ b/drivers/serial/uart_mcux_lpsci.c @@ -89,7 +89,7 @@ static int mcux_lpsci_fifo_fill(const struct device *dev, int len) { const struct mcux_lpsci_config *config = dev->config; - uint8_t num_tx = 0U; + int num_tx = 0U; while ((len - num_tx > 0) && (LPSCI_GetStatusFlags(config->base) @@ -105,7 +105,7 @@ static int mcux_lpsci_fifo_read(const struct device *dev, uint8_t *rx_data, const int len) { const struct mcux_lpsci_config *config = dev->config; - uint8_t num_rx = 0U; + int num_rx = 0U; while ((len - num_rx > 0) && (LPSCI_GetStatusFlags(config->base) diff --git a/drivers/serial/uart_mcux_lpuart.c b/drivers/serial/uart_mcux_lpuart.c index a4c775c5b4e49..5697a904d7f19 100644 --- a/drivers/serial/uart_mcux_lpuart.c +++ b/drivers/serial/uart_mcux_lpuart.c @@ -233,7 +233,7 @@ static int mcux_lpuart_fifo_fill(const struct device *dev, int len) { const struct mcux_lpuart_config *config = dev->config; - uint8_t num_tx = 0U; + int num_tx = 0U; while ((len - num_tx > 0) && (LPUART_GetStatusFlags(config->base) @@ -248,7 +248,7 @@ static int mcux_lpuart_fifo_read(const struct device *dev, uint8_t *rx_data, const int len) { const struct mcux_lpuart_config *config = dev->config; - uint8_t num_rx = 0U; + int num_rx = 0U; while ((len - num_rx > 0) && (LPUART_GetStatusFlags(config->base) diff --git a/drivers/serial/uart_nrfx_uart.c b/drivers/serial/uart_nrfx_uart.c index 2cf347ded291e..c151ef490585a 100644 --- a/drivers/serial/uart_nrfx_uart.c +++ b/drivers/serial/uart_nrfx_uart.c @@ -786,7 +786,7 @@ static int uart_nrfx_fifo_fill(const struct device *dev, const uint8_t *tx_data, int len) { - uint8_t num_tx = 0U; + int num_tx = 0U; while ((len - num_tx > 0) && event_txdrdy_check()) { @@ -806,7 +806,7 @@ static int uart_nrfx_fifo_read(const struct device *dev, uint8_t *rx_data, const int size) { - uint8_t num_rx = 0U; + int num_rx = 0U; while ((size - num_rx > 0) && nrf_uart_event_check(uart0_addr, NRF_UART_EVENT_RXDRDY)) { diff --git a/drivers/serial/uart_pl011.c b/drivers/serial/uart_pl011.c index 2f25c30562723..130d4e95957bc 100644 --- a/drivers/serial/uart_pl011.c +++ b/drivers/serial/uart_pl011.c @@ -317,7 +317,7 @@ static int pl011_runtime_config_get(const struct device *dev, static int pl011_fifo_fill(const struct device *dev, const uint8_t *tx_data, int len) { - uint8_t num_tx = 0U; + int num_tx = 0U; while (!(get_uart(dev)->fr & PL011_FR_TXFF) && (len - num_tx > 0)) { get_uart(dev)->dr = tx_data[num_tx++]; @@ -328,7 +328,7 @@ static int pl011_fifo_fill(const struct device *dev, static int pl011_fifo_read(const struct device *dev, uint8_t *rx_data, const int len) { - uint8_t num_rx = 0U; + int num_rx = 0U; while ((len - num_rx > 0) && !(get_uart(dev)->fr & PL011_FR_RXFE)) { rx_data[num_rx++] = get_uart(dev)->dr; diff --git a/drivers/serial/uart_renesas_ra8_sci_b.c b/drivers/serial/uart_renesas_ra8_sci_b.c index 5918966f18ea5..8922dd0fbb3d0 100644 --- a/drivers/serial/uart_renesas_ra8_sci_b.c +++ b/drivers/serial/uart_renesas_ra8_sci_b.c @@ -256,7 +256,7 @@ static int uart_ra_sci_b_fifo_fill(const struct device *dev, const uint8_t *tx_d { struct uart_ra_sci_b_data *data = dev->data; const struct uart_ra_sci_b_config *cfg = dev->config; - uint8_t num_tx = 0U; + int num_tx = 0U; if (IS_ENABLED(CONFIG_UART_RA_SCI_B_UART_FIFO_ENABLE) && data->sci.fifo_depth > 0) { while ((size - num_tx > 0) && cfg->regs->FTSR != 0x10U) { @@ -281,7 +281,7 @@ static int uart_ra_sci_b_fifo_read(const struct device *dev, uint8_t *rx_data, c { struct uart_ra_sci_b_data *data = dev->data; const struct uart_ra_sci_b_config *cfg = dev->config; - uint8_t num_rx = 0U; + int num_rx = 0U; if (IS_ENABLED(CONFIG_UART_RA_SCI_B_UART_FIFO_ENABLE) && data->sci.fifo_depth > 0) { while ((size - num_rx > 0) && cfg->regs->FRSR_b.R > 0U) { diff --git a/drivers/serial/uart_renesas_ra_sci.c b/drivers/serial/uart_renesas_ra_sci.c index 1c424f19f5759..0e9f927a357a2 100644 --- a/drivers/serial/uart_renesas_ra_sci.c +++ b/drivers/serial/uart_renesas_ra_sci.c @@ -301,7 +301,7 @@ static int uart_ra_sci_fifo_fill(const struct device *dev, const uint8_t *tx_dat { struct uart_ra_sci_data *data = dev->data; const struct uart_ra_sci_config *cfg = dev->config; - uint8_t num_tx = 0U; + int num_tx = 0U; #if CONFIG_UART_RA_SCI_UART_FIFO_ENABLE if (data->sci.fifo_depth != 0) { @@ -326,7 +326,7 @@ static int uart_ra_sci_fifo_read(const struct device *dev, uint8_t *rx_data, con { struct uart_ra_sci_data *data = dev->data; const struct uart_ra_sci_config *cfg = dev->config; - uint8_t num_rx = 0U; + int num_rx = 0U; #if CONFIG_UART_RA_SCI_UART_FIFO_ENABLE if (data->sci.fifo_depth != 0) { diff --git a/drivers/serial/uart_rv32m1_lpuart.c b/drivers/serial/uart_rv32m1_lpuart.c index ee3a9621d8c7e..603a1cd061754 100644 --- a/drivers/serial/uart_rv32m1_lpuart.c +++ b/drivers/serial/uart_rv32m1_lpuart.c @@ -93,7 +93,7 @@ static int rv32m1_lpuart_fifo_fill(const struct device *dev, int len) { const struct rv32m1_lpuart_config *config = dev->config; - uint8_t num_tx = 0U; + int num_tx = 0U; while ((len - num_tx > 0) && (LPUART_GetStatusFlags(config->base) @@ -109,7 +109,7 @@ static int rv32m1_lpuart_fifo_read(const struct device *dev, uint8_t *rx_data, const int len) { const struct rv32m1_lpuart_config *config = dev->config; - uint8_t num_rx = 0U; + int num_rx = 0U; while ((len - num_rx > 0) && (LPUART_GetStatusFlags(config->base) diff --git a/drivers/serial/uart_stellaris.c b/drivers/serial/uart_stellaris.c index 2dc49d31e513f..731ea8a3c09d2 100644 --- a/drivers/serial/uart_stellaris.c +++ b/drivers/serial/uart_stellaris.c @@ -313,7 +313,7 @@ static int uart_stellaris_fifo_fill(const struct device *dev, int len) { const struct uart_stellaris_config *config = dev->config; - uint8_t num_tx = 0U; + int num_tx = 0U; while ((len - num_tx > 0) && ((config->uart->fr & UARTFR_TXFF) == 0U)) { config->uart->dr = (uint32_t)tx_data[num_tx++]; @@ -336,7 +336,7 @@ static int uart_stellaris_fifo_read(const struct device *dev, const int size) { const struct uart_stellaris_config *config = dev->config; - uint8_t num_rx = 0U; + int num_rx = 0U; while ((size - num_rx > 0) && ((config->uart->fr & UARTFR_RXFE) == 0U)) { rx_data[num_rx++] = (uint8_t)config->uart->dr; diff --git a/drivers/serial/uart_stm32.c b/drivers/serial/uart_stm32.c index e0232c550e62e..1f9e7abe01271 100644 --- a/drivers/serial/uart_stm32.c +++ b/drivers/serial/uart_stm32.c @@ -816,15 +816,14 @@ static inline void __uart_stm32_get_clock(const struct device *dev) #ifdef CONFIG_UART_INTERRUPT_DRIVEN -typedef void (*fifo_fill_fn)(USART_TypeDef *usart, const void *tx_data, - const uint8_t offset); +typedef void (*fifo_fill_fn)(USART_TypeDef *usart, const void *tx_data, const int offset); static int uart_stm32_fifo_fill_visitor(const struct device *dev, const void *tx_data, int size, fifo_fill_fn fill_fn) { const struct uart_stm32_config *config = dev->config; USART_TypeDef *usart = config->usart; - uint8_t num_tx = 0U; + int num_tx = 0U; unsigned int key; if (!LL_USART_IsActiveFlag_TXE(usart)) { @@ -847,8 +846,7 @@ static int uart_stm32_fifo_fill_visitor(const struct device *dev, const void *tx return num_tx; } -static void fifo_fill_with_u8(USART_TypeDef *usart, - const void *tx_data, const uint8_t offset) +static void fifo_fill_with_u8(USART_TypeDef *usart, const void *tx_data, const int offset) { const uint8_t *data = (const uint8_t *)tx_data; /* Send a character (8bit) */ @@ -865,15 +863,14 @@ static int uart_stm32_fifo_fill(const struct device *dev, const uint8_t *tx_data fifo_fill_with_u8); } -typedef void (*fifo_read_fn)(USART_TypeDef *usart, void *rx_data, - const uint8_t offset); +typedef void (*fifo_read_fn)(USART_TypeDef *usart, void *rx_data, const int offset); static int uart_stm32_fifo_read_visitor(const struct device *dev, void *rx_data, const int size, fifo_read_fn read_fn) { const struct uart_stm32_config *config = dev->config; USART_TypeDef *usart = config->usart; - uint8_t num_rx = 0U; + int num_rx = 0U; while ((size - num_rx > 0) && LL_USART_IsActiveFlag_RXNE(usart)) { /* RXNE flag will be cleared upon read from DR|RDR register */ @@ -894,8 +891,7 @@ static int uart_stm32_fifo_read_visitor(const struct device *dev, void *rx_data, return num_rx; } -static void fifo_read_with_u8(USART_TypeDef *usart, void *rx_data, - const uint8_t offset) +static void fifo_read_with_u8(USART_TypeDef *usart, void *rx_data, const int offset) { uint8_t *data = (uint8_t *)rx_data; @@ -914,8 +910,7 @@ static int uart_stm32_fifo_read(const struct device *dev, uint8_t *rx_data, cons #ifdef CONFIG_UART_WIDE_DATA -static void fifo_fill_with_u16(USART_TypeDef *usart, - const void *tx_data, const uint8_t offset) +static void fifo_fill_with_u16(USART_TypeDef *usart, const void *tx_data, const int offset) { const uint16_t *data = (const uint16_t *)tx_data; @@ -933,8 +928,7 @@ static int uart_stm32_fifo_fill_u16(const struct device *dev, const uint16_t *tx fifo_fill_with_u16); } -static void fifo_read_with_u16(USART_TypeDef *usart, void *rx_data, - const uint8_t offset) +static void fifo_read_with_u16(USART_TypeDef *usart, void *rx_data, const int offset) { uint16_t *data = (uint16_t *)rx_data; diff --git a/drivers/serial/usart_gd32.c b/drivers/serial/usart_gd32.c index 972c622f3ad92..4e5ac37a230e9 100644 --- a/drivers/serial/usart_gd32.c +++ b/drivers/serial/usart_gd32.c @@ -167,7 +167,7 @@ int usart_gd32_fifo_fill(const struct device *dev, const uint8_t *tx_data, int len) { const struct gd32_usart_config *const cfg = dev->config; - uint8_t num_tx = 0U; + int num_tx = 0U; while ((len - num_tx > 0) && usart_flag_get(cfg->reg, USART_FLAG_TBE)) { @@ -181,7 +181,7 @@ int usart_gd32_fifo_read(const struct device *dev, uint8_t *rx_data, const int size) { const struct gd32_usart_config *const cfg = dev->config; - uint8_t num_rx = 0U; + int num_rx = 0U; while ((size - num_rx > 0) && usart_flag_get(cfg->reg, USART_FLAG_RBNE)) { From 593f4423ab7e9245603c93e02e73f1ba6d9597af Mon Sep 17 00:00:00 2001 From: Michal Smola Date: Wed, 30 Oct 2024 08:21:09 +0100 Subject: [PATCH 2125/4482] samples: led: pwm: fix console harness regex Led blinking period was made configurable and time unit changed from sec to msec recently in the source code of the sample. Console harness regex was not changed accordingly in sample.yaml. Device testing fails when run with twister. Change the regex to accept any period and change the units to msec. Signed-off-by: Michal Smola --- samples/drivers/led/pwm/sample.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/drivers/led/pwm/sample.yaml b/samples/drivers/led/pwm/sample.yaml index fe9a3845ffbe6..21d27c0d6a999 100644 --- a/samples/drivers/led/pwm/sample.yaml +++ b/samples/drivers/led/pwm/sample.yaml @@ -17,6 +17,6 @@ tests: - "Turned on" - "Turned off" - "Increasing brightness gradually" - - "Blinking on: 0.1 sec, off: 0.1 sec" - - "(Blinking on: 1 sec, off: 1 sec|Cycle period not supported)" + - "Blinking on: ([0-9]+) msec, off: ([0-9]+) msec" + - "(Blinking on: ([0-9]+) msec, off: ([0-9]+) msec|Cycle period not supported)" - "Turned off, loop end" From cbe07bcb92ea37b0ea3d4f4b5fd5a48819a3b4e5 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Thu, 31 Oct 2024 21:17:46 +0000 Subject: [PATCH 2126/4482] Revert "drivers: display: elcdif: Modify interrupt enablement" This reverts commit 206897658ab88444f32d59e2dbcec65e38d66779. We must keep the frame completion interrupt disabled until we send a new frame to the eLCDIF, as the frame completion interrupt fires at each vertical blank interval. If we keep it enabled, then the semaphore we use to indicate the frame has been loaded by the eLCDIF will be posted to when we do not have a frame queued, and calls to `display_write` will return before the eLCDIF has actually loaded the new framebuffer. Fixes #80590 Signed-off-by: Daniel DeGrasse --- drivers/display/Kconfig.mcux_elcdif | 12 ------------ drivers/display/display_mcux_elcdif.c | 18 ++++++------------ 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/drivers/display/Kconfig.mcux_elcdif b/drivers/display/Kconfig.mcux_elcdif index c183ac6ada001..e9b48f761449e 100644 --- a/drivers/display/Kconfig.mcux_elcdif +++ b/drivers/display/Kconfig.mcux_elcdif @@ -54,18 +54,6 @@ config MCUX_ELCDIF_PXP display_write is called with a framebuffer equal in size to the display. -config MCUX_ELCDIF_LP - bool "ELCDIF low power" - help - This option, when enabled, will enable CUR_FRAME_DONE_IRQ at the display - write function and disable it at the interruption handler for each new frame. - Disabling the interrupt when no new frame needs to be sent gives the CPU the - possibility to enter low-power mode, thus saving energy. - This option, when disabled, CUR_FRAME_DONE_IRQ will be enabled only - once at initialization. This option should be disabled when the application's - frame rate is close to the display's refresh rate to avoid introducing - additional latency caused by frequently enabling and disabling CUR_FRAME_DONE_IRQ. - if MCUX_ELCDIF_PXP choice MCUX_ELCDIF_PXP_ROTATE_DIRECTION diff --git a/drivers/display/display_mcux_elcdif.c b/drivers/display/display_mcux_elcdif.c index 828fcf4314ec8..d082ac1996409 100644 --- a/drivers/display/display_mcux_elcdif.c +++ b/drivers/display/display_mcux_elcdif.c @@ -214,10 +214,8 @@ static int mcux_elcdif_write(const struct device *dev, const uint16_t x, const u /* Update index of active framebuffer */ dev_data->next_idx = (dev_data->next_idx + 1) % CONFIG_MCUX_ELCDIF_FB_NUM; #endif - - if (IS_ENABLED(CONFIG_MCUX_ELCDIF_LP)) { - ELCDIF_EnableInterrupts(config->base, kELCDIF_CurFrameDoneInterruptEnable); - } + /* Enable frame buffer completion interrupt */ + ELCDIF_EnableInterrupts(config->base, kELCDIF_CurFrameDoneInterruptEnable); /* Wait for frame send to complete */ k_sem_take(&dev_data->sem, K_FOREVER); return ret; @@ -310,11 +308,10 @@ static void mcux_elcdif_isr(const struct device *dev) status = ELCDIF_GetInterruptStatus(config->base); ELCDIF_ClearInterruptStatus(config->base, status); if (config->base->CUR_BUF == ((uint32_t)dev_data->active_fb)) { - if (IS_ENABLED(CONFIG_MCUX_ELCDIF_LP)) { - /* Disable frame completion interrupt if Low power mode is activated*/ - ELCDIF_DisableInterrupts(config->base, kELCDIF_CurFrameDoneInterruptEnable); - } - /* Post to sem to notify that frame display is complete.*/ + /* Disable frame completion interrupt, post to + * sem to notify that frame send is complete. + */ + ELCDIF_DisableInterrupts(config->base, kELCDIF_CurFrameDoneInterruptEnable); k_sem_give(&dev_data->sem); } } @@ -352,9 +349,6 @@ static int mcux_elcdif_init(const struct device *dev) dev_data->active_fb = dev_data->fb[0]; ELCDIF_RgbModeInit(config->base, &dev_data->rgb_mode); - if (!IS_ENABLED(CONFIG_MCUX_ELCDIF_LP)) { - ELCDIF_EnableInterrupts(config->base, kELCDIF_CurFrameDoneInterruptEnable); - } ELCDIF_RgbModeStart(config->base); return 0; From 6c2bc2ff3719081510715c960bca55258c4b525c Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Sun, 27 Oct 2024 12:37:11 +0100 Subject: [PATCH 2127/4482] west build: warn about conditional flags in 'extra_configs' The 'west build' command does not know about conditional flags (in the format 'type:value:CONFIG_FOO=bar') in the 'extra_configs' argument of Twister testcase.yaml files, and currently converts them to malformed arguments that are silently ignored by cmake. This change adds a check to 'west build' to clearly warn the user if the 'extra_configs' list contains conditional flags and provide a hint on how to add them to the CMake command line. Signed-off-by: Luca Burelli --- scripts/west_commands/build.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/west_commands/build.py b/scripts/west_commands/build.py index 8181640adac10..a06ae0d45040e 100644 --- a/scripts/west_commands/build.py +++ b/scripts/west_commands/build.py @@ -361,7 +361,19 @@ def _parse_test_item(self, test_item): arg_list = extra if data == 'extra_configs': - args = ["-D{}".format(arg.replace('"', '\"')) for arg in arg_list] + args = [] + for arg in arg_list: + equals = arg.find('=') + colon = arg.rfind(':', 0, equals) + if colon != -1: + # conditional configs (xxx:yyy:CONFIG_FOO=bar) + # are not supported by 'west build' + self.wrn('"west build" does not support ' + 'conditional config "{}". Add "-D{}" ' + 'to the supplied CMake arguments if ' + 'desired.'.format(arg, arg[colon+1:])) + continue + args.append("-D{}".format(arg.replace('"', '\"'))) elif data == 'extra_args': # Retain quotes around config options config_options = [arg for arg in arg_list if arg.startswith("CONFIG_")] From ba58b066d49e833e69352e265489708653f6cc01 Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Wed, 30 Oct 2024 11:36:09 +0100 Subject: [PATCH 2128/4482] west build: fix a leftover "log" reference in build.py A recent commit changed all references to the global 'west.log' instance (now deprecated) to the new WestCommand logging API, but another PR merged in the same period added an extra instance that is now causing CI to fail. Convert this last reference to the new API. Signed-off-by: Luca Burelli --- scripts/west_commands/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/west_commands/build.py b/scripts/west_commands/build.py index a06ae0d45040e..d3c159db2fc62 100644 --- a/scripts/west_commands/build.py +++ b/scripts/west_commands/build.py @@ -265,7 +265,7 @@ def do_run(self, args, remainder): with open(build_info_file, "w") as f: yaml.dump(build_command, f, default_flow_style=False) except Exception as e: - log.wrn(f'Failed to create info file: {build_info_file},', e) + self.wrn(f'Failed to create info file: {build_info_file},', e) board, origin = self._find_board() self._run_cmake(board, origin, self.args.cmake_opts) From 3a39ca1e7e199e1a1ea2771ee4af1cce070265fa Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Mon, 4 Nov 2024 15:42:11 +0100 Subject: [PATCH 2129/4482] samples: Bluetooth: BAP: Add missing return in stream_is_streaming Add missing return before a `false`;. Signed-off-by: Emil Gydesen --- samples/bluetooth/bap_unicast_client/src/stream_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/bluetooth/bap_unicast_client/src/stream_tx.c b/samples/bluetooth/bap_unicast_client/src/stream_tx.c index 06ea3a3c349ec..ebdc01ab87f97 100644 --- a/samples/bluetooth/bap_unicast_client/src/stream_tx.c +++ b/samples/bluetooth/bap_unicast_client/src/stream_tx.c @@ -48,7 +48,7 @@ static bool stream_is_streaming(const struct bt_bap_stream *bap_stream) err = bt_bap_ep_get_info(bap_stream->ep, &ep_info); if (err != 0) { - false; + return false; } return ep_info.state == BT_BAP_EP_STATE_STREAMING; From 5d52e39a5298a1a5c8d7375d92de8a2376a4ac1f Mon Sep 17 00:00:00 2001 From: Robin Kastberg Date: Fri, 1 Nov 2024 22:17:05 +0100 Subject: [PATCH 2130/4482] random: random_timer.c Remove __GNUC__ ifdef Remove an old __GNUC__ ifdef Signed-off-by: Robin Kastberg --- subsys/random/random_timer.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/subsys/random/random_timer.c b/subsys/random/random_timer.c index 74ca676098b62..46534d8860131 100644 --- a/subsys/random/random_timer.c +++ b/subsys/random/random_timer.c @@ -20,8 +20,6 @@ #include #include -#if defined(__GNUC__) - static struct k_spinlock rand32_lock; /** @@ -71,4 +69,3 @@ void z_impl_sys_rand_get(void *dst, size_t outlen) outlen -= blocksize; } } -#endif /* __GNUC__ */ From 8bd4f244b0aa66476c59d536be5aecf58346611f Mon Sep 17 00:00:00 2001 From: Mark Holden Date: Wed, 22 May 2024 17:49:51 -0700 Subject: [PATCH 2131/4482] coredump: ARM: Ensure sp in dump is set as gdb expects Gdb is typically able to reconstruct the first two frames of the failing stack using the "pc" and "lr" registers. After that, (if the frame pointer is omitted) it appears to need the stack pointer (sp register) to point to the top of the stack before a fatal error occurred. The ARM Cortex-M processors push registers r0-r3, r12, LR, {possibly FPU registers}, PC, SPSR onto the stack before entering the exception handler. We adjust the stack pointer back to the point before these registers were pushed for preservation in the dump. During k_oops/k_panic, the sp wasn't stored in the core dump at all. Apply similar logic to store it when failures occur in that path. Signed-off-by: Mark Holden --- arch/arm/core/cortex_a_r/swap_helper.S | 6 +- arch/arm/core/cortex_a_r/switch.S | 6 +- arch/arm/core/cortex_m/fault.c | 52 +-------------- arch/arm/core/cortex_m/swap_helper.S | 1 + arch/arm/core/fatal.c | 5 +- arch/arm/include/cortex_a_r/exception.h | 9 +++ arch/arm/include/cortex_m/exception.h | 85 +++++++++++++++++++++++++ 7 files changed, 108 insertions(+), 56 deletions(-) diff --git a/arch/arm/core/cortex_a_r/swap_helper.S b/arch/arm/core/cortex_a_r/swap_helper.S index 457f71e9d7b80..a41e1ab5942fe 100644 --- a/arch/arm/core/cortex_a_r/swap_helper.S +++ b/arch/arm/core/cortex_a_r/swap_helper.S @@ -336,12 +336,14 @@ _context_switch: _oops: /* - * Pass the exception frame to z_do_kernel_oops. r0 contains the - * exception reason. + * Pass the exception frame to z_do_kernel_oops. */ cps #MODE_SYS mov r0, sp cps #MODE_SVC + /* Zero callee_regs and exc_return (only used on Cortex-M) */ + mov r1, #0 + mov r2, #0 bl z_do_kernel_oops b z_arm_int_exit diff --git a/arch/arm/core/cortex_a_r/switch.S b/arch/arm/core/cortex_a_r/switch.S index 800d46bbf94dd..4d5a6a627b1cc 100644 --- a/arch/arm/core/cortex_a_r/switch.S +++ b/arch/arm/core/cortex_a_r/switch.S @@ -150,10 +150,12 @@ offload: _oops: /* - * Pass the exception frame to z_do_kernel_oops. r0 contains the - * exception reason. + * Pass the exception frame to z_do_kernel_oops. */ mov r0, sp + /* Zero callee_regs and exc_return (only used on Cortex-M) */ + mov r1, #0 + mov r2, #0 bl z_do_kernel_oops inv: diff --git a/arch/arm/core/cortex_m/fault.c b/arch/arm/core/cortex_m/fault.c index 4e604ba8033c1..604801a6414d9 100644 --- a/arch/arm/core/cortex_m/fault.c +++ b/arch/arm/core/cortex_m/fault.c @@ -40,54 +40,6 @@ LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); #define EACD(edr) (((edr) & SYSMPU_EDR_EACD_MASK) >> SYSMPU_EDR_EACD_SHIFT) #endif -/* Exception Return (EXC_RETURN) is provided in LR upon exception entry. - * It is used to perform an exception return and to detect possible state - * transition upon exception. - */ - -/* Prefix. Indicates that this is an EXC_RETURN value. - * This field reads as 0b11111111. - */ -#define EXC_RETURN_INDICATOR_PREFIX (0xFF << 24) -/* bit[0]: Exception Secure. The security domain the exception was taken to. */ -#define EXC_RETURN_EXCEPTION_SECURE_Pos 0 -#define EXC_RETURN_EXCEPTION_SECURE_Msk \ - BIT(EXC_RETURN_EXCEPTION_SECURE_Pos) -#define EXC_RETURN_EXCEPTION_SECURE_Non_Secure 0 -#define EXC_RETURN_EXCEPTION_SECURE_Secure EXC_RETURN_EXCEPTION_SECURE_Msk -/* bit[2]: Stack Pointer selection. */ -#define EXC_RETURN_SPSEL_Pos 2 -#define EXC_RETURN_SPSEL_Msk BIT(EXC_RETURN_SPSEL_Pos) -#define EXC_RETURN_SPSEL_MAIN 0 -#define EXC_RETURN_SPSEL_PROCESS EXC_RETURN_SPSEL_Msk -/* bit[3]: Mode. Indicates the Mode that was stacked from. */ -#define EXC_RETURN_MODE_Pos 3 -#define EXC_RETURN_MODE_Msk BIT(EXC_RETURN_MODE_Pos) -#define EXC_RETURN_MODE_HANDLER 0 -#define EXC_RETURN_MODE_THREAD EXC_RETURN_MODE_Msk -/* bit[4]: Stack frame type. Indicates whether the stack frame is a standard - * integer only stack frame or an extended floating-point stack frame. - */ -#define EXC_RETURN_STACK_FRAME_TYPE_Pos 4 -#define EXC_RETURN_STACK_FRAME_TYPE_Msk BIT(EXC_RETURN_STACK_FRAME_TYPE_Pos) -#define EXC_RETURN_STACK_FRAME_TYPE_EXTENDED 0 -#define EXC_RETURN_STACK_FRAME_TYPE_STANDARD EXC_RETURN_STACK_FRAME_TYPE_Msk -/* bit[5]: Default callee register stacking. Indicates whether the default - * stacking rules apply, or whether the callee registers are already on the - * stack. - */ -#define EXC_RETURN_CALLEE_STACK_Pos 5 -#define EXC_RETURN_CALLEE_STACK_Msk BIT(EXC_RETURN_CALLEE_STACK_Pos) -#define EXC_RETURN_CALLEE_STACK_SKIPPED 0 -#define EXC_RETURN_CALLEE_STACK_DEFAULT EXC_RETURN_CALLEE_STACK_Msk -/* bit[6]: Secure or Non-secure stack. Indicates whether a Secure or - * Non-secure stack is used to restore stack frame on exception return. - */ -#define EXC_RETURN_RETURN_STACK_Pos 6 -#define EXC_RETURN_RETURN_STACK_Msk BIT(EXC_RETURN_RETURN_STACK_Pos) -#define EXC_RETURN_RETURN_STACK_Non_Secure 0 -#define EXC_RETURN_RETURN_STACK_Secure EXC_RETURN_RETURN_STACK_Msk - /* Integrity signature for an ARMv8-M implementation */ #if defined(CONFIG_ARMV7_M_ARMV8_M_FP) #define INTEGRITY_SIGNATURE_STD 0xFEFA125BUL @@ -1112,9 +1064,7 @@ void z_arm_fault(uint32_t msp, uint32_t psp, uint32_t exc_return, __ASSERT(esf != NULL, "ESF could not be retrieved successfully. Shall never occur."); -#ifdef CONFIG_DEBUG_COREDUMP - z_arm_coredump_fault_sp = POINTER_TO_UINT(esf); -#endif + z_arm_set_fault_sp(esf, exc_return); reason = fault_handle(esf, fault, &recoverable); if (recoverable) { diff --git a/arch/arm/core/cortex_m/swap_helper.S b/arch/arm/core/cortex_m/swap_helper.S index 7a557e904f1e0..c6207084b5ea6 100644 --- a/arch/arm/core/cortex_m/swap_helper.S +++ b/arch/arm/core/cortex_m/swap_helper.S @@ -447,6 +447,7 @@ _oops: mov r1, sp /* pointer to _callee_saved_t */ #endif /* CONFIG_ARMV7_M_ARMV8_M_MAINLINE */ #endif /* CONFIG_EXTRA_EXCEPTION_INFO */ + mov r2, lr /* EXC_RETURN */ bl z_do_kernel_oops /* return from SVC exception is done here */ #if defined(CONFIG_EXTRA_EXCEPTION_INFO) diff --git a/arch/arm/core/fatal.c b/arch/arm/core/fatal.c index 4532e238f05c9..d64855b6b8e3e 100644 --- a/arch/arm/core/fatal.c +++ b/arch/arm/core/fatal.c @@ -101,8 +101,9 @@ void z_arm_fatal_error(unsigned int reason, const struct arch_esf *esf) * * @param esf exception frame * @param callee_regs Callee-saved registers (R4-R11) + * @param exc_return EXC_RETURN value present in LR after exception entry. */ -void z_do_kernel_oops(const struct arch_esf *esf, _callee_saved_t *callee_regs) +void z_do_kernel_oops(const struct arch_esf *esf, _callee_saved_t *callee_regs, uint32_t exc_return) { #if !(defined(CONFIG_EXTRA_EXCEPTION_INFO) && defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)) ARG_UNUSED(callee_regs); @@ -110,6 +111,8 @@ void z_do_kernel_oops(const struct arch_esf *esf, _callee_saved_t *callee_regs) /* Stacked R0 holds the exception reason. */ unsigned int reason = esf->basic.r0; + z_arm_set_fault_sp(esf, exc_return); + #if defined(CONFIG_USERSPACE) if (z_arm_preempted_thread_in_user_mode(esf)) { /* diff --git a/arch/arm/include/cortex_a_r/exception.h b/arch/arm/include/cortex_a_r/exception.h index 6daa9c106ee2b..4326444f112ec 100644 --- a/arch/arm/include/cortex_a_r/exception.h +++ b/arch/arm/include/cortex_a_r/exception.h @@ -43,6 +43,15 @@ static ALWAYS_INLINE bool arch_is_in_nested_exception(const struct arch_esf *esf return (arch_curr_cpu()->arch.exc_depth > 1U) ? (true) : (false); } +/** + * @brief No current implementation where core dump is not supported + * + * @param esf exception frame + * @param exc_return EXC_RETURN value present in LR after exception entry. + */ +static ALWAYS_INLINE void z_arm_set_fault_sp(const struct arch_esf *esf, uint32_t exc_return) +{} + #if defined(CONFIG_USERSPACE) /* * This function is used by privileged code to determine if the thread diff --git a/arch/arm/include/cortex_m/exception.h b/arch/arm/include/cortex_m/exception.h index 89bdd4b83e9a2..94491a71b3fcc 100644 --- a/arch/arm/include/cortex_m/exception.h +++ b/arch/arm/include/cortex_m/exception.h @@ -39,6 +39,54 @@ extern volatile irq_offload_routine_t offload_routine; */ #define AIRCR_VECT_KEY_PERMIT_WRITE 0x05FAUL +/* Exception Return (EXC_RETURN) is provided in LR upon exception entry. + * It is used to perform an exception return and to detect possible state + * transition upon exception. + */ + +/* Prefix. Indicates that this is an EXC_RETURN value. + * This field reads as 0b11111111. + */ +#define EXC_RETURN_INDICATOR_PREFIX (0xFF << 24) +/* bit[0]: Exception Secure. The security domain the exception was taken to. */ +#define EXC_RETURN_EXCEPTION_SECURE_Pos 0 +#define EXC_RETURN_EXCEPTION_SECURE_Msk \ + BIT(EXC_RETURN_EXCEPTION_SECURE_Pos) +#define EXC_RETURN_EXCEPTION_SECURE_Non_Secure 0 +#define EXC_RETURN_EXCEPTION_SECURE_Secure EXC_RETURN_EXCEPTION_SECURE_Msk +/* bit[2]: Stack Pointer selection. */ +#define EXC_RETURN_SPSEL_Pos 2 +#define EXC_RETURN_SPSEL_Msk BIT(EXC_RETURN_SPSEL_Pos) +#define EXC_RETURN_SPSEL_MAIN 0 +#define EXC_RETURN_SPSEL_PROCESS EXC_RETURN_SPSEL_Msk +/* bit[3]: Mode. Indicates the Mode that was stacked from. */ +#define EXC_RETURN_MODE_Pos 3 +#define EXC_RETURN_MODE_Msk BIT(EXC_RETURN_MODE_Pos) +#define EXC_RETURN_MODE_HANDLER 0 +#define EXC_RETURN_MODE_THREAD EXC_RETURN_MODE_Msk +/* bit[4]: Stack frame type. Indicates whether the stack frame is a standard + * integer only stack frame or an extended floating-point stack frame. + */ +#define EXC_RETURN_STACK_FRAME_TYPE_Pos 4 +#define EXC_RETURN_STACK_FRAME_TYPE_Msk BIT(EXC_RETURN_STACK_FRAME_TYPE_Pos) +#define EXC_RETURN_STACK_FRAME_TYPE_EXTENDED 0 +#define EXC_RETURN_STACK_FRAME_TYPE_STANDARD EXC_RETURN_STACK_FRAME_TYPE_Msk +/* bit[5]: Default callee register stacking. Indicates whether the default + * stacking rules apply, or whether the callee registers are already on the + * stack. + */ +#define EXC_RETURN_CALLEE_STACK_Pos 5 +#define EXC_RETURN_CALLEE_STACK_Msk BIT(EXC_RETURN_CALLEE_STACK_Pos) +#define EXC_RETURN_CALLEE_STACK_SKIPPED 0 +#define EXC_RETURN_CALLEE_STACK_DEFAULT EXC_RETURN_CALLEE_STACK_Msk +/* bit[6]: Secure or Non-secure stack. Indicates whether a Secure or + * Non-secure stack is used to restore stack frame on exception return. + */ +#define EXC_RETURN_RETURN_STACK_Pos 6 +#define EXC_RETURN_RETURN_STACK_Msk BIT(EXC_RETURN_RETURN_STACK_Pos) +#define EXC_RETURN_RETURN_STACK_Non_Secure 0 +#define EXC_RETURN_RETURN_STACK_Secure EXC_RETURN_RETURN_STACK_Msk + /* * The current executing vector is found in the IPSR register. All * IRQs and system exceptions are considered as interrupt context. @@ -184,6 +232,43 @@ static ALWAYS_INLINE void z_arm_clear_faults(void) #endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */ } +/** + * @brief Set z_arm_coredump_fault_sp to stack pointer value expected by GDB + * + * @param esf exception frame + * @param exc_return EXC_RETURN value present in LR after exception entry. + */ +static ALWAYS_INLINE void z_arm_set_fault_sp(const struct arch_esf *esf, uint32_t exc_return) +{ +#ifdef CONFIG_DEBUG_COREDUMP + z_arm_coredump_fault_sp = POINTER_TO_UINT(esf); +#if defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE) || defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE) + /* Gdb expects a stack pointer that does not include the exception stack frame in order to + * unwind. So adjust the stack pointer accordingly. + */ + z_arm_coredump_fault_sp += sizeof(esf->basic); + +#if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING) + /* Assess whether thread had been using the FP registers and add size of additional + * registers if necessary + */ + if ((exc_return & EXC_RETURN_STACK_FRAME_TYPE_STANDARD) == + EXC_RETURN_STACK_FRAME_TYPE_EXTENDED) { + z_arm_coredump_fault_sp += sizeof(esf->fpu); + } +#endif /* CONFIG_FPU && CONFIG_FPU_SHARING */ + +#ifndef CONFIG_ARMV8_M_MAINLINE + if ((esf->basic.xpsr & SCB_CCR_STKALIGN_Msk) == SCB_CCR_STKALIGN_Msk) { + /* Adjust stack alignment after PSR bit[9] detected */ + z_arm_coredump_fault_sp |= 0x4; + } +#endif /* !CONFIG_ARMV8_M_MAINLINE */ + +#endif /* CONFIG_ARMV7_M_ARMV8_M_MAINLINE || CONFIG_ARMV6_M_ARMV8_M_BASELINE */ +#endif /* CONFIG_DEBUG_COREDUMP */ +} + /** * @brief Assess whether a debug monitor event should be treated as an error * From 6984237c063883ded7c9b5b97aa2a08c54552e69 Mon Sep 17 00:00:00 2001 From: Ha Duong Quang Date: Wed, 9 Oct 2024 10:32:12 +0700 Subject: [PATCH 2132/4482] arch: arm: core: cortex_a_r: enable the VFP unit on boot for FPU_SHARING The FPU is already disabled by the z_arm_svc function when the first thread starts. Therefore, disabling the FPU at boot is unnecessary for lazy FPU; instead, it must be enabled to handle floating-point instructions before the lazy FPU works. Signed-off-by: Ha Duong Quang --- arch/arm/core/cortex_a_r/prep_c.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm/core/cortex_a_r/prep_c.c b/arch/arm/core/cortex_a_r/prep_c.c index 8e068f2e3923f..a10588a49275f 100644 --- a/arch/arm/core/cortex_a_r/prep_c.c +++ b/arch/arm/core/cortex_a_r/prep_c.c @@ -62,7 +62,6 @@ static inline void z_arm_floating_point_init(void) __set_CPACR(reg_val); barrier_isync_fence_full(); -#if !defined(CONFIG_FPU_SHARING) /* * FPEXC: Floating-Point Exception Control register * comp. ARM Architecture Reference Manual, ARMv7-A and ARMv7-R edition, @@ -84,7 +83,6 @@ static inline void z_arm_floating_point_init(void) */ __set_FPEXC(FPEXC_EN); #endif -#endif } #endif /* CONFIG_CPU_HAS_FPU */ From 6023d6a1428d880a988f1be3ab1b5da5a6e86d61 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 1 Nov 2024 22:36:32 +0000 Subject: [PATCH 2133/4482] arch: common: fix copy for ramfunc region during XIP init ramfunc region is copied into RAM from FLASH region during XIP init. We copy from the loadaddr of the region, and were previously loading to the symbol __ramfunc_start. This is incorrect when using an MPU with alignment requirements, as the __ramfunc_start symbol may have padding placed before it in the region. The __ramfunc_start symbol still needs to be aligned in order to be used by the MPU though, so define a new symbol __ramfunc_region_start, and use that symbol when copying the __ramfunc region from FLASH to RAM. Fixes #75296 Signed-off-by: Daniel DeGrasse --- arch/common/ramfunc.ld | 1 + cmake/linker_script/arm/linker.cmake | 1 + include/zephyr/linker/linker-defs.h | 1 + kernel/xip.c | 4 ++-- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/common/ramfunc.ld b/arch/common/ramfunc.ld index 3894dbfef4357..45dea79d6b669 100644 --- a/arch/common/ramfunc.ld +++ b/arch/common/ramfunc.ld @@ -9,6 +9,7 @@ SECTION_DATA_PROLOGUE(.ramfunc,,) { + __ramfunc_region_start = .; MPU_ALIGN(__ramfunc_size); __ramfunc_start = .; *(.ramfunc) diff --git a/cmake/linker_script/arm/linker.cmake b/cmake/linker_script/arm/linker.cmake index 332d44b24359e..bb501a16cdb2f 100644 --- a/cmake/linker_script/arm/linker.cmake +++ b/cmake/linker_script/arm/linker.cmake @@ -144,6 +144,7 @@ endif() include(${COMMON_ZEPHYR_LINKER_DIR}/ram-end.cmake) +zephyr_linker_symbol(SYMBOL __ramfunc_region_start EXPR "ADDR(.ramfunc)") zephyr_linker_symbol(SYMBOL __kernel_ram_start EXPR "(@__bss_start@)") zephyr_linker_symbol(SYMBOL __kernel_ram_end EXPR "(${RAM_ADDR} + ${RAM_SIZE})") zephyr_linker_symbol(SYMBOL __kernel_ram_size EXPR "(@__kernel_ram_end@ - @__bss_start@)") diff --git a/include/zephyr/linker/linker-defs.h b/include/zephyr/linker/linker-defs.h index ff3cbe6ca6cf4..9c795ae78517a 100644 --- a/include/zephyr/linker/linker-defs.h +++ b/include/zephyr/linker/linker-defs.h @@ -231,6 +231,7 @@ extern char _nocache_ram_size[]; * section, stored in RAM instead of FLASH. */ #ifdef CONFIG_ARCH_HAS_RAMFUNC_SUPPORT +extern char __ramfunc_region_start[]; extern char __ramfunc_start[]; extern char __ramfunc_end[]; extern char __ramfunc_size[]; diff --git a/kernel/xip.c b/kernel/xip.c index 94d38e9b30dcc..898dfe2ae4cbb 100644 --- a/kernel/xip.c +++ b/kernel/xip.c @@ -28,8 +28,8 @@ void z_data_copy(void) z_early_memcpy(&__data_region_start, &__data_region_load_start, __data_region_end - __data_region_start); #ifdef CONFIG_ARCH_HAS_RAMFUNC_SUPPORT - z_early_memcpy(&__ramfunc_start, &__ramfunc_load_start, - (uintptr_t) &__ramfunc_size); + z_early_memcpy(&__ramfunc_region_start, &__ramfunc_load_start, + __ramfunc_end - __ramfunc_region_start); #endif /* CONFIG_ARCH_HAS_RAMFUNC_SUPPORT */ #if DT_NODE_HAS_STATUS_OKAY(DT_CHOSEN(zephyr_ccm)) z_early_memcpy(&__ccm_data_start, &__ccm_data_rom_start, From 99b1c2a91202c367ed51bee5df99004ca5ff7bc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 4 Nov 2024 18:25:00 +0100 Subject: [PATCH 2134/4482] doc: releases: rework linkage to old release notes/migration guides MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the link to old release notes and migration guides to the bottom of the document Signed-off-by: Benjamin Cabé --- doc/releases/eol_releases.rst | 24 ++++++++++++++++++++++-- doc/releases/index.rst | 16 ++++++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/doc/releases/eol_releases.rst b/doc/releases/eol_releases.rst index cf29d850a4daf..f16f74a87aa73 100644 --- a/doc/releases/eol_releases.rst +++ b/doc/releases/eol_releases.rst @@ -1,7 +1,15 @@ +.. _eol_releases: + End-of-life releases -==================== +#################### + +Release notes and migration guides for end-of-life releases of Zephyr RTOS are kept here for +historical purposes. + +.. _eol_releases_relesase_notes: -Release notes for end-of-life releases of Zephyr RTOS are kept here for historical purposes. +Release Notes +************* .. toctree:: :maxdepth: 1 @@ -12,3 +20,15 @@ Release notes for end-of-life releases of Zephyr RTOS are kept here for historic release-notes-1.* release-notes-2.[0-6] release-notes-3.[0-5] + +.. _eol_releases_migration_guides: + +Migration Guides +**************** + +.. toctree:: + :maxdepth: 1 + :glob: + :reversed: + + migration-guide-3.[5] diff --git a/doc/releases/index.rst b/doc/releases/index.rst index 0f4c7f8ccdd51..9f8c1a968b3a7 100644 --- a/doc/releases/index.rst +++ b/doc/releases/index.rst @@ -81,7 +81,6 @@ needs to be changed are to be detailed in the release's migration guide. :glob: :reversed: - eol_releases release-notes-2.7 release-notes-3.[6-7] release-notes-4.0 @@ -115,7 +114,20 @@ to be able to understand the context of the change. :glob: :reversed: - migration-guide-* + migration-guide-3.[6-7] + migration-guide-4.[0] + +End-of-life Releases +******************** + +.. toctree:: + :hidden: + :maxdepth: 1 + + eol_releases + +Release notes and migration guides for end-of-life releases of Zephyr RTOS can be accessed +:ref:`here `. .. _`GitHub repository`: https://github.com/zephyrproject-rtos/zephyr .. _`GitHub tagged releases`: https://github.com/zephyrproject-rtos/zephyr/tags From d342f9e0c2858ed97aa640814c4a12f84b2bbe6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 4 Nov 2024 18:27:33 +0100 Subject: [PATCH 2135/4482] doc: releases: introduce release notes and migration guide docs for 4.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This introduces the release notes and migration guide for 4.1.0 earlier than we typically do, so that people have a placeholder to start adding content as they line up pull requests for 4.1. The two documents are currently orphan and not visible from the main documentation as this would confuse users of 4.0. Signed-off-by: Benjamin Cabé --- doc/releases/migration-guide-4.1.rst | 112 +++++++++++ doc/releases/release-notes-4.1.rst | 288 +++++++++++++++++++++++++++ 2 files changed, 400 insertions(+) create mode 100644 doc/releases/migration-guide-4.1.rst create mode 100644 doc/releases/release-notes-4.1.rst diff --git a/doc/releases/migration-guide-4.1.rst b/doc/releases/migration-guide-4.1.rst new file mode 100644 index 0000000000000..d35ab96073c73 --- /dev/null +++ b/doc/releases/migration-guide-4.1.rst @@ -0,0 +1,112 @@ +:orphan: + +.. _migration_4.1: + +Migration guide to Zephyr v4.1.0 (Working Draft) +################################################ + +This document describes the changes required when migrating your application from Zephyr v4.0.0 to +Zephyr v4.1.0. + +Any other changes (not directly related to migrating applications) can be found in +the :ref:`release notes`. + +.. contents:: + :local: + :depth: 2 + +Build System +************ + +Kernel +****** + +Boards +****** + +Modules +******* + +Mbed TLS +======== + +Trusted Firmware-M +================== + +LVGL +==== + +Device Drivers and Devicetree +***************************** + +Controller Area Network (CAN) +============================= + +Display +======= + +Enhanced Serial Peripheral Interface (eSPI) +=========================================== + +GNSS +==== + +Input +===== + +Interrupt Controller +==================== + +LED Strip +========= + +Sensors +======= + +Serial +====== + +Regulator +========= + +Bluetooth +********* + +Bluetooth HCI +============= + +Bluetooth Mesh +============== + +Bluetooth Audio +=============== + +Bluetooth Classic +================= + +Bluetooth Host +============== + +Bluetooth Crypto +================ + +Networking +********** + +Other Subsystems +**************** + +Flash map +========= + +hawkBit +======= + +MCUmgr +====== + +Modem +===== + +Architectures +************* diff --git a/doc/releases/release-notes-4.1.rst b/doc/releases/release-notes-4.1.rst new file mode 100644 index 0000000000000..202fdb20489ba --- /dev/null +++ b/doc/releases/release-notes-4.1.rst @@ -0,0 +1,288 @@ +:orphan: + +.. _zephyr_4.1: + +Zephyr 4.1.0 (Working Draft) +############################ + +We are pleased to announce the release of Zephyr version 4.1.0. + +Major enhancements with this release include: + +An overview of the changes required or recommended when migrating your application from Zephyr +v4.0.0 to Zephyr v4.1.0 can be found in the separate :ref:`migration guide`. + +The following sections provide detailed lists of changes by component. + +Security Vulnerability Related +****************************** +The following CVEs are addressed by this release: + +More detailed information can be found in: +https://docs.zephyrproject.org/latest/security/vulnerabilities.html + +API Changes +*********** + +Removed APIs in this release +============================ + +Deprecated in this release +========================== + +Architectures +************* + +* ARC + +* ARM + +* ARM64 + +* RISC-V + +* Xtensa + +Kernel +****** + +Bluetooth +********* + +* Audio + +* Host + +* HCI Drivers + +Boards & SoC Support +******************** + +* Added support for these SoC series: + +* Made these changes in other SoC series: + +* Added support for these boards: + +* Made these board changes: + +* Added support for the following shields: + +Build system and Infrastructure +******************************* + +Drivers and Sensors +******************* + +* ADC + +* Battery + +* CAN + +* Charger + +* Clock control + +* Counter + +* DAC + +* Disk + +* Display + +* Ethernet + +* Flash + +* GNSS + +* GPIO + +* Hardware info + +* I2C + +* I2S + +* I3C + +* Input + +* LED + +* LED Strip + +* LoRa + +* Mailbox + +* MDIO + +* MFD + +* Modem + +* MIPI-DBI + +* MSPI + +* Pin control + +* PWM + +* Regulators + +* Reset + +* RTC + +* RTIO + +* SDHC + +* Sensors + +* Serial + +* SPI + +* USB + +* Video + +* Watchdog + +* Wi-Fi + +Networking +********** + +* ARP: + +* CoAP: + +* Connection manager: + +* DHCPv4: + +* DHCPv6: + +* DNS/mDNS/LLMNR: + +* gPTP/PTP: + +* HTTP: + +* IPSP: + +* IPv4: + +* IPv6: + +* LwM2M: + +* Misc: + +* MQTT: + +* Network Interface: + +* OpenThread + +* PPP + +* Shell: + +* Sockets: + +* Syslog: + +* TCP: + +* Websocket: + +* Wi-Fi: + +* zperf: + +USB +*** + +Devicetree +********** + +Kconfig +******* + +Libraries / Subsystems +********************** + +* Debug + +* Demand Paging + +* Formatted output + +* Management + +* Logging + +* Modem modules + +* Power management + +* Crypto + +* CMSIS-NN + +* FPGA + +* Random + +* SD + +* State Machine Framework + +* Storage + +* Task Watchdog + +* POSIX API + +* LoRa/LoRaWAN + +* ZBus + +HALs +**** + +* Nordic + +* STM32 + +* ADI + +* Espressif + +MCUboot +******* + +OSDP +**** + +Trusted Firmware-M +****************** + +LVGL +**** + +Tests and Samples +***************** + +Issue Related Items +******************* + +Known Issues +============ From 756affe2ebda6d436370d36c1ff8914d42f69174 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Mon, 4 Nov 2024 12:04:32 +0100 Subject: [PATCH 2136/4482] doc: releases: 4.0: Add release notes for Flash and Storage Update of release notes in areas related to Storage and Flash. Additionally two known Stream Flash issues have been added to Know Issue section. Signed-off-by: Dominik Ermel --- doc/releases/release-notes-4.0.rst | 47 ++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 77a092000bede..3161f8fc5bb6d 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -327,6 +327,20 @@ Drivers and Sensors * Fixed SPI NOR driver issue where wp, hold and reset pins were incorrectly initialized from device tee when SFDP at run-time has been enabled (:github:`80383`) + * Added :kconfig:option:`CONFIG_SPI_NOR_ACTIVE_DWELL_MS`, to the SPI NOR driver configuration, + which allows setting the time during which the driver will wait before triggering Deep Power Down (DPD). + This option replaces ``CONFIG_SPI_NOR_IDLE_IN_DPD``, aiming at reducing unnecessary power + state changes and SPI transfers between other operations, specifically when burst type + access to an SPI NOR device occurs. + + * Added :kconfig:option:`CONFIG_SPI_NOR_INIT_PRIORITY` to allow selecting the SPI NOR driver initialization priority. + + * The flash API has been extended with the :c:func:`flash_copy` utility function which allows performing + direct data copies between two Flash API devices. + + * Fixed a Flash Simulator issue where offsets were assumed to be absolute instead of relative + to the device base address (:github:`79082`). + * GNSS * GPIO @@ -603,6 +617,36 @@ Libraries / Subsystems from version 2.8.1, the last module update, up to and including the released version 2.9.3. + * LittleFS: Fixed an issue where the DTS option for configuring block cycles for LittleFS instances + was ignored (:github:`79072`). + + * LittleFS: Fixed issue with lookahead buffer size mismatch to actual allocated buffer size + (:github:`77917`). + + * FAT FS: Added :kconfig:option:`CONFIG_FILE_SYSTEM_LIB_LINK` to allow linking file system + support libraries without enabling the File System subsystem. This option can be used + when a user wants to directly use file system libraries, bypassing the File System + subsystem. + + * FAT FS: Added :kconfig:option:`CONFIG_FS_FATFS_LBA64` to enable support for the 64-bit LBA + and GPT in FAT file system driver. + + * FAT FS: Added :kconfig:option:`CONFIG_FS_FATFS_MULTI_PARTITION` that enables support for + devices partitioned with GPT or MBR. + + * FAT FS: Added :kconfig:option:`CONFIG_FS_FATFS_HAS_RTC` that enables RTC usage for time-stamping + files on FAT file systems. + + * FAT FS: Added :kconfig:option:`CONFIG_FS_FATFS_EXTRA_NATIVE_API` that enables additional FAT + file system driver functions, which are not exposed via Zephyr File System subsystem, + for users that intend to directly call them in their code. + + * Stream Flash: Fixed an issue where :c:func:`stream_flash_erase_page` did not properly check + the requested erase range and possibly allowed erasing any page on a device (:github:`79800`). + + * Shell: Fixed an issue were a failed file system mount attempt using the shell would make it + impossible to ever succeed in mounting that file system again until the device was reset (:github:`80024`). + * Task Watchdog * POSIX API @@ -724,3 +768,6 @@ Issue Related Items Known Issues ============ + +- :github:`71042` stream_flash: stream_flash_init() size parameter allows to ignore partition layout +- :github:`67407` stream_flash: stream_flash_erase_page allows to accidentally erase stream From 87a9363fa787edbf789409ed6748af198bf34f1f Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 4 Nov 2024 15:53:42 +0530 Subject: [PATCH 2137/4482] drivers: nrfiwif: Enable recovery by default This is needed to ensure Wi-Fi can always be used. Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/Kconfig.nrfwifi | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/wifi/nrfwifi/Kconfig.nrfwifi b/drivers/wifi/nrfwifi/Kconfig.nrfwifi index 6679e40e04882..2e6934bef2252 100644 --- a/drivers/wifi/nrfwifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrfwifi/Kconfig.nrfwifi @@ -651,6 +651,7 @@ config NRF_WIFI_AP_DEAD_DETECT_TIMEOUT config NRF_WIFI_RPU_RECOVERY bool "RPU recovery mechanism" depends on NRF_WIFI_LOW_POWER + default y select EXPERIMENTAL help Enable the RPU recovery mechanism to recover from an RPU (nRF70) hang. From f5090110daa449665d237a9170383e10bd3c8149 Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Mon, 4 Nov 2024 09:38:56 +0100 Subject: [PATCH 2138/4482] doc: releases: 4.0: add CAN release notes Add CAN related release notes for Zephyr v4.0.0. Signed-off-by: Henrik Brix Andersen --- doc/releases/migration-guide-4.0.rst | 3 --- doc/releases/release-notes-4.0.rst | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index fcf1763d15e15..82c2779a84279 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -196,9 +196,6 @@ Clock control load-capacitance-femtofarad = <...>; }; -Controller Area Network (CAN) -============================= - Crypto ====== diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 3161f8fc5bb6d..a23a41c3341a2 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -298,6 +298,11 @@ Drivers and Sensors * CAN + * Added initial support for Renesas RA CANFD (:dtcompatible:`renesas,ra-canfd-global`, + :dtcompatible:`renesas,ra-canfd`) + * Added Flexcan support for S32Z27x (:dtcompatible:`nxp,flexcan`, :dtcompatible:`nxp,flexcan-fd`) + * Improved NXP S32 CANXL error reporting (:dtcompatible:`nxp,s32-canxl`) + * Charger * Clock control From d5c88d6576fc406382e87513365fff8131d05d04 Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Mon, 4 Nov 2024 09:42:56 +0100 Subject: [PATCH 2139/4482] doc: releases: 4.0: add EEPROM release notes Add EEPROM related release notes for Zephyr v4.0.0. Signed-off-by: Henrik Brix Andersen --- doc/releases/release-notes-4.0.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index a23a41c3341a2..bd08679b1b3c4 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -323,6 +323,11 @@ Drivers and Sensors * Display +* EEPROM + + * Added support for using the EEPROM simulator with embedded C standard libraries + (:dtcompatible:`zephyr,sim-eeprom`). + * Ethernet * LiteX: Renamed the ``compatible`` from ``litex,eth0`` to :dtcompatible:`litex,liteeth`. From af3dac213172bca42472bafef181f5998975fe09 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 4 Nov 2024 08:39:59 +0200 Subject: [PATCH 2140/4482] Bluetooth: drivers: Sync bus types with BlueZ The authoritative source of these values is BlueZ: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/lib/hci.h#n38 Update our values with the above. The IPM definiton doesn't exist in BlueZ, but should be added there to make sure we don't get out of sync again. Signed-off-by: Johan Hedberg --- dts/bindings/bluetooth/bt-hci.yaml | 2 ++ include/zephyr/drivers/bluetooth.h | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dts/bindings/bluetooth/bt-hci.yaml b/dts/bindings/bluetooth/bt-hci.yaml index a010310f75532..a56ced5dae102 100644 --- a/dts/bindings/bluetooth/bt-hci.yaml +++ b/dts/bindings/bluetooth/bt-hci.yaml @@ -19,6 +19,8 @@ properties: - "sdio" - "spi" - "i2c" + - "smd" + - "virtio" - "ipm" bt-hci-quirks: type: string-array diff --git a/include/zephyr/drivers/bluetooth.h b/include/zephyr/drivers/bluetooth.h index f06481948efe9..4f67f512273d2 100644 --- a/include/zephyr/drivers/bluetooth.h +++ b/include/zephyr/drivers/bluetooth.h @@ -69,7 +69,9 @@ enum bt_hci_bus { BT_HCI_BUS_SDIO = 6, BT_HCI_BUS_SPI = 7, BT_HCI_BUS_I2C = 8, - BT_HCI_BUS_IPM = 9, + BT_HCI_BUS_SMD = 9, + BT_HCI_BUS_VIRTIO = 10, + BT_HCI_BUS_IPM = 11, }; #define BT_DT_HCI_QUIRK_OR(node_id, prop, idx) \ From b710167f1b5bd99118f6b2b006afe16f86e07f33 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 4 Nov 2024 14:03:00 +0200 Subject: [PATCH 2141/4482] Bluetooth: drivers: Rename IPM to IPC This bus type was originally created for what's today the ipc.c HCI driver. Since this type hasn't yet been synced with BlueZ, rename it for consistency, however leave the old define to not break backwards compatibility with existing DT bindings (there are several more that use "ipm" than ipc.c). Signed-off-by: Johan Hedberg --- dts/bindings/bluetooth/bt-hci.yaml | 3 ++- dts/bindings/bluetooth/zephyr,bt-hci-ipc.yaml | 2 +- include/zephyr/drivers/bluetooth.h | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dts/bindings/bluetooth/bt-hci.yaml b/dts/bindings/bluetooth/bt-hci.yaml index a56ced5dae102..52d3f82e4ef42 100644 --- a/dts/bindings/bluetooth/bt-hci.yaml +++ b/dts/bindings/bluetooth/bt-hci.yaml @@ -21,7 +21,8 @@ properties: - "i2c" - "smd" - "virtio" - - "ipm" + - "ipm" # Deprecated. "ipc" should be used instead. + - "ipc" bt-hci-quirks: type: string-array description: HCI device quirks diff --git a/dts/bindings/bluetooth/zephyr,bt-hci-ipc.yaml b/dts/bindings/bluetooth/zephyr,bt-hci-ipc.yaml index ee1f8e76c3b17..f5186e8a3be12 100644 --- a/dts/bindings/bluetooth/zephyr,bt-hci-ipc.yaml +++ b/dts/bindings/bluetooth/zephyr,bt-hci-ipc.yaml @@ -8,7 +8,7 @@ properties: bt-hci-name: default: "IPC" bt-hci-bus: - default: "ipm" + default: "ipc" bt-hci-quirks: default: ["no-auto-dle"] bt-hci-ipc-name: diff --git a/include/zephyr/drivers/bluetooth.h b/include/zephyr/drivers/bluetooth.h index 4f67f512273d2..330ac850b828a 100644 --- a/include/zephyr/drivers/bluetooth.h +++ b/include/zephyr/drivers/bluetooth.h @@ -71,7 +71,9 @@ enum bt_hci_bus { BT_HCI_BUS_I2C = 8, BT_HCI_BUS_SMD = 9, BT_HCI_BUS_VIRTIO = 10, - BT_HCI_BUS_IPM = 11, + BT_HCI_BUS_IPC = 11, + /* IPM is deprecated and simply an alias for IPC */ + BT_HCI_BUS_IPM = BT_HCI_BUS_IPC, }; #define BT_DT_HCI_QUIRK_OR(node_id, prop, idx) \ From 1f1e4afa4f145699677f8ee50dac5c5890d42dd9 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Fri, 1 Nov 2024 15:05:30 +0100 Subject: [PATCH 2142/4482] Bluetooth: CSIP: Handle disconnects while in procedure If a device disconnects while we are in a procedure then get_next_active_instance would return a service instance pointer with the `conn` set to NULL. The issue was caused by the set_info being potentially memset when the device that disconnected was the one that held the set_info pointer. The solution is to not use a pointer, but rather a copy of the set_info, so that the active.set_info value is still valid after a disconnect. Since the set_info is not longer a pointer to a specific set_info from one of the members, the logs have been updated as well, as the pointer of the active.set_info is useless for debugging. Signed-off-by: Emil Gydesen --- subsys/bluetooth/audio/csip_set_coordinator.c | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/subsys/bluetooth/audio/csip_set_coordinator.c b/subsys/bluetooth/audio/csip_set_coordinator.c index 3436f512c49f5..f27a85087ee1f 100644 --- a/subsys/bluetooth/audio/csip_set_coordinator.c +++ b/subsys/bluetooth/audio/csip_set_coordinator.c @@ -58,7 +58,7 @@ LOG_MODULE_REGISTER(bt_csip_set_coordinator, CONFIG_BT_CSIP_SET_COORDINATOR_LOG_ static struct active_members { struct bt_csip_set_coordinator_set_member *members[CONFIG_BT_MAX_CONN]; - const struct bt_csip_set_coordinator_set_info *info; + struct bt_csip_set_coordinator_set_info info; uint8_t members_count; uint8_t members_handled; uint8_t members_restored; @@ -169,7 +169,7 @@ static struct bt_csip_set_coordinator_svc_inst *lookup_instance_by_set_info( member_set_info = &member->insts[i].info; if (member_set_info->set_size == set_info->set_size && - memcmp(&member_set_info->sirk, &set_info->sirk, sizeof(set_info->sirk)) == 0) { + memcmp(member_set_info->sirk, set_info->sirk, sizeof(set_info->sirk)) == 0) { return bt_csip_set_coordinator_lookup_instance_by_index(inst->conn, i); } } @@ -184,9 +184,9 @@ static struct bt_csip_set_coordinator_svc_inst *get_next_active_instance(void) member = active.members[active.members_handled]; - svc_inst = lookup_instance_by_set_info(member, active.info); + svc_inst = lookup_instance_by_set_info(member, &active.info); if (svc_inst == NULL) { - LOG_DBG("Failed to lookup instance by set_info %p", active.info); + LOG_DBG("Failed to lookup instance by set_info"); } return svc_inst; @@ -201,8 +201,8 @@ static int member_rank_compare_asc(const void *m1, const void *m2) struct bt_csip_set_coordinator_svc_inst *svc_inst_1; struct bt_csip_set_coordinator_svc_inst *svc_inst_2; - svc_inst_1 = lookup_instance_by_set_info(member_1, active.info); - svc_inst_2 = lookup_instance_by_set_info(member_2, active.info); + svc_inst_1 = lookup_instance_by_set_info(member_1, &active.info); + svc_inst_2 = lookup_instance_by_set_info(member_2, &active.info); if (svc_inst_1 == NULL) { LOG_ERR("svc_inst_1 was NULL for member %p", member_1); @@ -232,7 +232,7 @@ static void active_members_store_ordered(const struct bt_csip_set_coordinator_se { (void)memcpy(active.members, members, count * sizeof(members[0U])); active.members_count = count; - active.info = info; + memcpy(&active.info, info, sizeof(active.info)); if (count > 1U && CONFIG_BT_MAX_CONN > 1) { qsort(active.members, count, sizeof(members[0U]), @@ -1079,7 +1079,7 @@ static void csip_set_coordinator_write_restore_cb(struct bt_conn *conn, int csip_err; member = active.members[active.members_handled - active.members_restored - 1]; - client->cur_inst = lookup_instance_by_set_info(member, active.info); + client->cur_inst = lookup_instance_by_set_info(member, &active.info); if (client->cur_inst == NULL) { release_set_complete(-ENOENT); @@ -1114,9 +1114,9 @@ static void csip_set_coordinator_write_lock_cb(struct bt_conn *conn, active.members_restored = 0; member = active.members[active.members_handled - active.members_restored]; - client->cur_inst = lookup_instance_by_set_info(member, active.info); + client->cur_inst = lookup_instance_by_set_info(member, &active.info); if (client->cur_inst == NULL) { - LOG_DBG("Failed to lookup instance by set_info %p", active.info); + LOG_DBG("Failed to lookup instance by set_info"); lock_set_complete(-ENOENT); return; @@ -1214,7 +1214,7 @@ static void csip_set_coordinator_write_release_cb(struct bt_conn *conn, uint8_t static void csip_set_coordinator_lock_state_read_cb(int err, bool locked) { - const struct bt_csip_set_coordinator_set_info *info = active.info; + const struct bt_csip_set_coordinator_set_info *info = &active.info; struct bt_csip_set_coordinator_set_member *cur_member = NULL; if (err || locked) { @@ -1606,9 +1606,9 @@ csip_set_coordinator_get_lock_state(const struct bt_csip_set_coordinator_set_mem for (uint8_t i = 0U; i < count; i++) { struct bt_csip_set_coordinator_svc_inst *svc_inst; - svc_inst = lookup_instance_by_set_info(active.members[i], active.info); + svc_inst = lookup_instance_by_set_info(active.members[i], &active.info); if (svc_inst == NULL) { - LOG_DBG("Failed to lookup instance by set_info %p", active.info); + LOG_DBG("Failed to lookup instance by set_info"); active_members_reset(); return -ENOENT; @@ -1632,11 +1632,11 @@ csip_set_coordinator_get_lock_state(const struct bt_csip_set_coordinator_set_mem * here. */ if (active.oap_cb == NULL || - !active.oap_cb(active.info, active.members, active.members_count)) { + !active.oap_cb(&active.info, active.members, active.members_count)) { err = -ECANCELED; } - ordered_access_complete(active.info, err, false, NULL); + ordered_access_complete(&active.info, err, false, NULL); } return err; @@ -1718,9 +1718,9 @@ int bt_csip_set_coordinator_lock( active_members_store_ordered(members, count, set_info, true); - svc_inst = lookup_instance_by_set_info(active.members[0], active.info); + svc_inst = lookup_instance_by_set_info(active.members[0], &active.info); if (svc_inst == NULL) { - LOG_DBG("Failed to lookup instance by set_info %p", active.info); + LOG_DBG("Failed to lookup instance by set_info"); active_members_reset(); return -ENOENT; @@ -1764,9 +1764,9 @@ int bt_csip_set_coordinator_release(const struct bt_csip_set_coordinator_set_mem active_members_store_ordered(members, count, set_info, false); - svc_inst = lookup_instance_by_set_info(active.members[0], active.info); + svc_inst = lookup_instance_by_set_info(active.members[0], &active.info); if (svc_inst == NULL) { - LOG_DBG("Failed to lookup instance by set_info %p", active.info); + LOG_DBG("Failed to lookup instance by set_info"); active_members_reset(); return -ENOENT; From e20c095eeebe2cb0bc8455ef6ee87ee49bc3d5d5 Mon Sep 17 00:00:00 2001 From: Xiaoli Ji Date: Wed, 6 Nov 2024 13:55:32 +0800 Subject: [PATCH 2143/4482] soc: nxp: imxrt118x: update MPU configuration fixes: #80721 Updated mpu region address to secure address. Signed-off-by: Xiaoli Ji --- soc/nxp/imxrt/imxrt118x/m33/mpu_regions.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/soc/nxp/imxrt/imxrt118x/m33/mpu_regions.c b/soc/nxp/imxrt/imxrt118x/m33/mpu_regions.c index 13a20dd1be6ec..0e017caa56b3c 100644 --- a/soc/nxp/imxrt/imxrt118x/m33/mpu_regions.c +++ b/soc/nxp/imxrt/imxrt118x/m33/mpu_regions.c @@ -7,18 +7,18 @@ #include #include -#define REGION_HYPERRAM_BASE_ADDRESS 0x04000000 -#define REGION_HYPERRAM_SIZE 0x04000000 -#define REGION_DTCM_BASE_ADDRESS 0x20000000 +#define REGION_FLEXSPI2_BASE_ADDRESS 0x14000000 +#define REGION_FLEXSPI2_SIZE 0x04000000 +#define REGION_DTCM_BASE_ADDRESS 0x30000000 #define REGION_DTCM_SIZE 0x00020000 -#define REGION_FLEXSPI_BASE_ADDRESS 0x28000000 +#define REGION_FLEXSPI_BASE_ADDRESS 0x38000000 #define REGION_FLEXSPI_SIZE 0x08000000 -#define REGION_PERIPHERAL_BASE_ADDRESS 0x40000000 +#define REGION_PERIPHERAL_BASE_ADDRESS 0x50000000 #define REGION_PERIPHERAL_SIZE 0x40000000 static const struct arm_mpu_region mpu_regions[] = { - MPU_REGION_ENTRY("HYPERRAM", REGION_HYPERRAM_BASE_ADDRESS, - REGION_RAM_ATTR(REGION_HYPERRAM_BASE_ADDRESS, REGION_HYPERRAM_SIZE)), + MPU_REGION_ENTRY("FLEXSPI2", REGION_FLEXSPI2_BASE_ADDRESS, + REGION_RAM_ATTR(REGION_FLEXSPI2_BASE_ADDRESS, REGION_FLEXSPI2_SIZE)), MPU_REGION_ENTRY("FLEXSPI", REGION_FLEXSPI_BASE_ADDRESS, REGION_FLASH_ATTR(REGION_FLEXSPI_BASE_ADDRESS, REGION_FLEXSPI_SIZE)), MPU_REGION_ENTRY("DTCM", REGION_DTCM_BASE_ADDRESS, From ec10d56fbb4e9ede93b4fc1973940279f8ab95a3 Mon Sep 17 00:00:00 2001 From: Daniel Kampert Date: Thu, 19 Sep 2024 13:38:03 +0200 Subject: [PATCH 2144/4482] drivers: rtc: rv8263-c8: Alarm reworking - Fix typos for alarm field identification - Fix a bug where an alarm interrupt starts update interrupts - Rework interrupt code to reduce code size and complexity Signed-off-by: Daniel Kampert --- drivers/rtc/rtc_rv8263.c | 94 ++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 51 deletions(-) diff --git a/drivers/rtc/rtc_rv8263.c b/drivers/rtc/rtc_rv8263.c index f3cf86c6c7a11..7e76e7fc55d1f 100644 --- a/drivers/rtc/rtc_rv8263.c +++ b/drivers/rtc/rtc_rv8263.c @@ -86,16 +86,18 @@ struct rv8263c8_data { struct gpio_callback gpio_cb; #endif +#if (CONFIG_RTC_ALARM || CONFIG_RTC_UPDATE) && DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) + struct k_work interrupt_work; +#endif + #if CONFIG_RTC_ALARM && DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) rtc_alarm_callback alarm_cb; void *alarm_cb_data; - struct k_work alarm_work; #endif #if CONFIG_RTC_UPDATE && DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) rtc_update_callback update_cb; void *update_cb_data; - struct k_work update_work; #endif }; @@ -126,41 +128,12 @@ static void rv8263c8_gpio_callback_handler(const struct device *p_port, struct g struct rv8263c8_data *data = CONTAINER_OF(p_cb, struct rv8263c8_data, gpio_cb); -#if CONFIG_RTC_ALARM - k_work_submit(&data->alarm_work); -#endif - -#if CONFIG_RTC_UPDATE - k_work_submit(&data->update_work); +#if CONFIG_RTC_ALARM || CONFIG_RTC_UPDATE + k_work_submit(&data->interrupt_work); #endif } #endif -#if CONFIG_RTC_ALARM && DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) -static void rv8263c8_alarm_worker(struct k_work *p_work) -{ - struct rv8263c8_data *data = CONTAINER_OF(p_work, struct rv8263c8_data, alarm_work); - const struct rv8263c8_config *config = data->dev->config; - - LOG_DBG("Process alarm worker from interrupt"); - - if (data->alarm_cb != NULL) { - uint8_t reg; - - i2c_reg_read_byte_dt(&config->i2c_bus, RV8263C8_REGISTER_CONTROL_2, ®); - - if (reg & RV8263C8_BM_AF) { - reg &= ~RV8263C8_BM_AF; - - LOG_DBG("Calling alarm callback"); - data->alarm_cb(data->dev, 0, data->alarm_cb_data); - - i2c_reg_write_byte_dt(&config->i2c_bus, RV8263C8_REGISTER_CONTROL_2, reg); - } - } -} -#endif - #if CONFIG_RTC_UPDATE && DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) static int rv8263c8_update_enable_timer(const struct device *dev) { @@ -181,27 +154,48 @@ static int rv8263c8_update_enable_timer(const struct device *dev) RV8263_BM_TI_TP_PULSE; return i2c_write_dt(&config->i2c_bus, buf, 2); } +#endif -static void rv8263c8_update_worker(struct k_work *p_work) +#if (CONFIG_RTC_ALARM || CONFIG_RTC_UPDATE) && DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) +static void rv8263c8_interrupt_worker(struct k_work *p_work) { uint8_t reg; - struct rv8263c8_data *data = CONTAINER_OF(p_work, struct rv8263c8_data, update_work); + struct rv8263c8_data *data = CONTAINER_OF(p_work, struct rv8263c8_data, interrupt_work); const struct rv8263c8_config *config = data->dev->config; - LOG_DBG("Process update worker from interrupt"); + i2c_reg_read_byte_dt(&config->i2c_bus, RV8263C8_REGISTER_CONTROL_2, ®); - if (data->update_cb != NULL) { - i2c_reg_read_byte_dt(&config->i2c_bus, RV8263C8_REGISTER_CONTROL_2, ®); +#if CONFIG_RTC_ALARM + /* An alarm interrupt occurs. Clear the timer flag, */ + /* and call the callback. */ + if (reg & RV8263C8_BM_AF) { + LOG_DBG("Process alarm interrupt"); + reg &= ~RV8263C8_BM_AF; - if (reg & RV8263C8_BM_TF) { + if (data->alarm_cb != NULL) { + LOG_DBG("Calling alarm callback"); + data->alarm_cb(data->dev, 0, data->alarm_cb_data); + } + } +#endif + +#if CONFIG_RTC_UPDATE + /* A timer interrupt occurs. Clear the timer flag, */ + /* enable the timer again and call the callback. */ + if (reg & RV8263C8_BM_TF) { + LOG_DBG("Process update interrupt"); + reg &= ~RV8263C8_BM_TF; + + if (data->update_cb != NULL) { LOG_DBG("Calling update callback"); data->update_cb(data->dev, data->update_cb_data); } + + rv8263c8_update_enable_timer(data->dev); } +#endif - rv8263c8_update_enable_timer(data->dev); - i2c_reg_update_byte_dt(&config->i2c_bus, RV8263C8_REGISTER_CONTROL_2, RV8263C8_BM_TF, - RV8263C8_BM_TF); + i2c_reg_write_byte_dt(&config->i2c_bus, RV8263C8_REGISTER_CONTROL_2, reg); } #endif @@ -336,6 +330,7 @@ static int rv8263c8_init(const struct device *dev) #endif #if (CONFIG_RTC_ALARM || CONFIG_RTC_UPDATE) && DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) + LOG_DBG("Configure interrupt pin"); if (!gpio_is_ready_dt(&config->int_gpio)) { LOG_ERR("GPIO not ready!"); return err; @@ -364,18 +359,15 @@ static int rv8263c8_init(const struct device *dev) #endif (void)k_sem_take(&data->lock, K_FOREVER); -#if CONFIG_RTC_ALARM && DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) - data->alarm_work.handler = rv8263c8_alarm_worker; -#endif - -#if CONFIG_RTC_UPDATE && DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) - data->update_work.handler = rv8263c8_update_worker; +#if (CONFIG_RTC_ALARM || CONFIG_RTC_UPDATE) && DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) + data->interrupt_work.handler = rv8263c8_interrupt_worker; #endif #if (CONFIG_RTC_ALARM || CONFIG_RTC_UPDATE) && DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios) data->dev = dev; #endif k_sem_give(&data->lock); + LOG_DBG("Done"); return 0; } @@ -442,19 +434,19 @@ static int rv8263c8_alarm_set_time(const struct device *dev, uint16_t id, uint16 } if (mask & RTC_ALARM_TIME_MASK_HOUR) { - regs[3] = bin2bcd(timeptr->tm_min) & HOURS_BITS; + regs[3] = bin2bcd(timeptr->tm_hour) & HOURS_BITS; } else { regs[3] = RV8263C8_BM_ALARM_DISABLE; } if (mask & RTC_ALARM_TIME_MASK_MONTHDAY) { - regs[4] = bin2bcd(timeptr->tm_min) & DATE_BITS; + regs[4] = bin2bcd(timeptr->tm_mday) & DATE_BITS; } else { regs[4] = RV8263C8_BM_ALARM_DISABLE; } if (mask & RTC_ALARM_TIME_MASK_WEEKDAY) { - regs[5] = bin2bcd(timeptr->tm_min) & WEEKDAY_BITS; + regs[5] = bin2bcd(timeptr->tm_wday) & WEEKDAY_BITS; } else { regs[5] = RV8263C8_BM_ALARM_DISABLE; } From 308b568219b1c87ce28f8ba89395acd573867a13 Mon Sep 17 00:00:00 2001 From: Christophe Dufaza Date: Thu, 17 Oct 2024 20:44:01 +0200 Subject: [PATCH 2145/4482] Revert "edtlib: test filters set by including bindings" This unit test was added specifically to cover a regression reported by the CI while working on [1]. Further work on related issues [2] showed that: - [1] and [2] are dead end: we need to first rethink how bindings (and especially child-bindings) are initialized - the inclusion mechanism supported by Zephyr deserves more systematic testing in edtlib if we want to work with confidence The approach we choose is to: - revert all changes made in [1] - from there, systematically add unit tests as we address the issues we identified (or the additional features we need) one after the other [1] edtlib: fix last modified semantic in included property specs [2] edtlib: Preserve paths of properties from included child bindings See also: #65221, #78095 This reverts commit 33bb3b60d95b78149b14b7b09753c355f41fffd9. Signed-off-by: Christophe Dufaza --- .../tests/test-bindings-include/inc-base.yaml | 3 --- .../tests/test-bindings-include/top-allows.yaml | 10 ---------- .../tests/test-bindings-include/top-blocks.yaml | 10 ---------- .../dts/python-devicetree/tests/test_edtlib.py | 17 ----------------- 4 files changed, 40 deletions(-) delete mode 100644 scripts/dts/python-devicetree/tests/test-bindings-include/inc-base.yaml delete mode 100644 scripts/dts/python-devicetree/tests/test-bindings-include/top-allows.yaml delete mode 100644 scripts/dts/python-devicetree/tests/test-bindings-include/top-blocks.yaml diff --git a/scripts/dts/python-devicetree/tests/test-bindings-include/inc-base.yaml b/scripts/dts/python-devicetree/tests/test-bindings-include/inc-base.yaml deleted file mode 100644 index 59dc45eab0dbb..0000000000000 --- a/scripts/dts/python-devicetree/tests/test-bindings-include/inc-base.yaml +++ /dev/null @@ -1,3 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause - -include: base.yaml diff --git a/scripts/dts/python-devicetree/tests/test-bindings-include/top-allows.yaml b/scripts/dts/python-devicetree/tests/test-bindings-include/top-allows.yaml deleted file mode 100644 index a4938eb0d6768..0000000000000 --- a/scripts/dts/python-devicetree/tests/test-bindings-include/top-allows.yaml +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause - -description: Test property-allowlist filters set by including bindings - -compatible: "top-allowlist" - -include: - - name: inc-base.yaml - property-allowlist: - - x diff --git a/scripts/dts/python-devicetree/tests/test-bindings-include/top-blocks.yaml b/scripts/dts/python-devicetree/tests/test-bindings-include/top-blocks.yaml deleted file mode 100644 index 787db223a939e..0000000000000 --- a/scripts/dts/python-devicetree/tests/test-bindings-include/top-blocks.yaml +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause - -description: Test property-blocklist filters set by including bindings. - -compatible: "top-blocklist" - -include: - - name: inc-base.yaml - property-blocklist: - - x diff --git a/scripts/dts/python-devicetree/tests/test_edtlib.py b/scripts/dts/python-devicetree/tests/test_edtlib.py index d02bfd7fc6ddf..acf47ba626555 100644 --- a/scripts/dts/python-devicetree/tests/test_edtlib.py +++ b/scripts/dts/python-devicetree/tests/test_edtlib.py @@ -378,23 +378,6 @@ def test_include_paths(): assert 'base.yaml' == os.path.basename(top.prop2specs["y"].path) assert 'top.yaml' == os.path.basename(top.prop2specs["p"].path) -def test_include_filters_included_bindings(): - '''Test filters set by including bindings.''' - fname2path = {'base.yaml': 'test-bindings-include/base.yaml', - 'inc-base.yaml': 'test-bindings-include/inc-base.yaml'} - - with from_here(): - top_allows = edtlib.Binding('test-bindings-include/top-allows.yaml', fname2path) - assert top_allows.prop2specs.get("x") - assert not top_allows.prop2specs.get("y") - - with from_here(): - top_blocks = edtlib.Binding('test-bindings-include/top-blocks.yaml', fname2path) - assert not top_blocks.prop2specs.get("x") - assert top_blocks.prop2specs.get("y") - - - def test_bus(): '''Test 'bus:' and 'on-bus:' in bindings''' with from_here(): From 0b946dfc01e9658cbd204ff6e3dc76f4e548bbac Mon Sep 17 00:00:00 2001 From: Christophe Dufaza Date: Thu, 17 Oct 2024 21:56:24 +0200 Subject: [PATCH 2146/4482] Revert "edtlib: test "last modified" semantic for ... specs" This unit test was added to cover the change introduced by [1]. Further work on related issues [2] showed that the chosen approach is dead end. We're reverting all changes made in [1]. [1] edtlib: fix last modified semantic in included property specs [2] edtlib: Preserve paths of properties from included child bindings See also: #65221, #78095 This reverts commit 70eaa61cb0a4d6796575e6c68614e7c5fe361047. Signed-off-by: Christophe Dufaza --- .../tests/test-bindings-include/base.yaml | 7 ------- .../tests/test-bindings-include/modified.yaml | 7 ------- .../tests/test-bindings-include/top.yaml | 21 ------------------- .../python-devicetree/tests/test_edtlib.py | 12 ----------- 4 files changed, 47 deletions(-) delete mode 100644 scripts/dts/python-devicetree/tests/test-bindings-include/base.yaml delete mode 100644 scripts/dts/python-devicetree/tests/test-bindings-include/modified.yaml delete mode 100644 scripts/dts/python-devicetree/tests/test-bindings-include/top.yaml diff --git a/scripts/dts/python-devicetree/tests/test-bindings-include/base.yaml b/scripts/dts/python-devicetree/tests/test-bindings-include/base.yaml deleted file mode 100644 index f564578b48d0b..0000000000000 --- a/scripts/dts/python-devicetree/tests/test-bindings-include/base.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause - -properties: - x: - type: int - y: - type: int diff --git a/scripts/dts/python-devicetree/tests/test-bindings-include/modified.yaml b/scripts/dts/python-devicetree/tests/test-bindings-include/modified.yaml deleted file mode 100644 index 3d8130c1aedd0..0000000000000 --- a/scripts/dts/python-devicetree/tests/test-bindings-include/modified.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause - -include: base.yaml - -properties: - x: - required: true diff --git a/scripts/dts/python-devicetree/tests/test-bindings-include/top.yaml b/scripts/dts/python-devicetree/tests/test-bindings-include/top.yaml deleted file mode 100644 index 8fb9320676d51..0000000000000 --- a/scripts/dts/python-devicetree/tests/test-bindings-include/top.yaml +++ /dev/null @@ -1,21 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause - -description: | - Top-level binding file for testing included property spec paths. - - base.yaml: specifies properties "x" and "y" - modified.yaml: includes base.yaml, modifies property "x" - top.yaml (this file): includes modified.yaml, specifies property "p" - - From the top-level binding, we expect: - - "x" was last modified in modified.yaml - - "y" was last modified in base.yaml - - "p" was last modified in top.yaml - -compatible: top-level - -include: modified.yaml - -properties: - p: - type: int diff --git a/scripts/dts/python-devicetree/tests/test_edtlib.py b/scripts/dts/python-devicetree/tests/test_edtlib.py index acf47ba626555..80709feac0907 100644 --- a/scripts/dts/python-devicetree/tests/test_edtlib.py +++ b/scripts/dts/python-devicetree/tests/test_edtlib.py @@ -365,18 +365,6 @@ def test_include_filters(): assert set(child.prop2specs.keys()) == {'child-prop-1', 'child-prop-2', 'x', 'z'} # root level 'y' is blocked -def test_include_paths(): - '''Test "last modified" semantic for included bindings paths.''' - - fname2path = {'base.yaml': 'test-bindings-include/base.yaml', - 'modified.yaml': 'test-bindings-include/modified.yaml'} - - with from_here(): - top = edtlib.Binding('test-bindings-include/top.yaml', fname2path) - - assert 'modified.yaml' == os.path.basename(top.prop2specs["x"].path) - assert 'base.yaml' == os.path.basename(top.prop2specs["y"].path) - assert 'top.yaml' == os.path.basename(top.prop2specs["p"].path) def test_bus(): '''Test 'bus:' and 'on-bus:' in bindings''' From c58d6761bcf5c7b4e27c173975e8bbe6098b579f Mon Sep 17 00:00:00 2001 From: Christophe Dufaza Date: Thu, 17 Oct 2024 22:16:29 +0200 Subject: [PATCH 2147/4482] edtlib: tests: cover basics of filtering inherited properties Use-case "B includes I includes X": - X is a base binding file, specifying common properties - I is an intermediary binding file, which includes X without modification nor filter - B includes I, filtering the properties it chooses to inherit with an allowlist or a blocklist Check that the properties inherited from X via I are actually filtered as B intends to, up to the grandchild-binding level. Signed-off-by: Christophe Dufaza --- .../tests/test-bindings-include/simple.yaml | 30 +++++ .../simple_filter_allowlist.yaml | 12 ++ .../simple_filter_blocklist.yaml | 12 ++ .../test-bindings-include/simple_inherit.yaml | 5 + .../python-devicetree/tests/test_edtlib.py | 112 ++++++++++++++++++ 5 files changed, 171 insertions(+) create mode 100644 scripts/dts/python-devicetree/tests/test-bindings-include/simple.yaml create mode 100644 scripts/dts/python-devicetree/tests/test-bindings-include/simple_filter_allowlist.yaml create mode 100644 scripts/dts/python-devicetree/tests/test-bindings-include/simple_filter_blocklist.yaml create mode 100644 scripts/dts/python-devicetree/tests/test-bindings-include/simple_inherit.yaml diff --git a/scripts/dts/python-devicetree/tests/test-bindings-include/simple.yaml b/scripts/dts/python-devicetree/tests/test-bindings-include/simple.yaml new file mode 100644 index 0000000000000..9ce3fe8b1ee26 --- /dev/null +++ b/scripts/dts/python-devicetree/tests/test-bindings-include/simple.yaml @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: BSD-3-Clause +# +# Base properties for testing property filters up to +# the grandchild-binding level. + +properties: + prop-1: + type: int + prop-2: + type: int + prop-3: + type: int + +child-binding: + properties: + child-prop-1: + type: int + child-prop-2: + type: int + child-prop-3: + type: int + + child-binding: + properties: + grandchild-prop-1: + type: int + grandchild-prop-2: + type: int + grandchild-prop-3: + type: int diff --git a/scripts/dts/python-devicetree/tests/test-bindings-include/simple_filter_allowlist.yaml b/scripts/dts/python-devicetree/tests/test-bindings-include/simple_filter_allowlist.yaml new file mode 100644 index 0000000000000..cae1cb2800acc --- /dev/null +++ b/scripts/dts/python-devicetree/tests/test-bindings-include/simple_filter_allowlist.yaml @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: BSD-3-Clause +# +# Filter inherited property specifications +# up to the grandchild-binding level. + +include: + - name: simple_inherit.yaml + property-allowlist: [prop-1] + child-binding: + property-allowlist: [child-prop-1] + child-binding: + property-allowlist: [grandchild-prop-1] diff --git a/scripts/dts/python-devicetree/tests/test-bindings-include/simple_filter_blocklist.yaml b/scripts/dts/python-devicetree/tests/test-bindings-include/simple_filter_blocklist.yaml new file mode 100644 index 0000000000000..e605c6a65dc5e --- /dev/null +++ b/scripts/dts/python-devicetree/tests/test-bindings-include/simple_filter_blocklist.yaml @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: BSD-3-Clause +# +# Filter inherited property specifications +# up to the grandchild-binding level. + +include: + - name: simple_inherit.yaml + property-blocklist: [prop-2, prop-3] + child-binding: + property-blocklist: [child-prop-2, child-prop-3] + child-binding: + property-blocklist: [grandchild-prop-2, grandchild-prop-3] diff --git a/scripts/dts/python-devicetree/tests/test-bindings-include/simple_inherit.yaml b/scripts/dts/python-devicetree/tests/test-bindings-include/simple_inherit.yaml new file mode 100644 index 0000000000000..8a95ef38f9511 --- /dev/null +++ b/scripts/dts/python-devicetree/tests/test-bindings-include/simple_inherit.yaml @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# +# Inherits property specifications without modification. + +include: simple.yaml diff --git a/scripts/dts/python-devicetree/tests/test_edtlib.py b/scripts/dts/python-devicetree/tests/test_edtlib.py index 80709feac0907..30fbc7c3fc36f 100644 --- a/scripts/dts/python-devicetree/tests/test_edtlib.py +++ b/scripts/dts/python-devicetree/tests/test_edtlib.py @@ -365,6 +365,118 @@ def test_include_filters(): assert set(child.prop2specs.keys()) == {'child-prop-1', 'child-prop-2', 'x', 'z'} # root level 'y' is blocked +def test_include_filters_inherited_bindings() -> None: + '''Test the basics of filtering properties inherited via an intermediary binding file. + + Use-case "B includes I includes X": + - X is a base binding file, specifying common properties + - I is an intermediary binding file, which includes X without modification + nor filter + - B includes I, filtering the properties it chooses to inherit + with an allowlist or a blocklist + + Checks that the properties inherited from X via I are actually filtered + as B intends to. + ''' + fname2path = { + # Base binding file, specifies a few properties up to the grandchild-binding level. + "simple.yaml": "test-bindings-include/simple.yaml", + # 'include:'s the base file above, without modification nor filter + "simple_inherit.yaml": "test-bindings-include/simple_inherit.yaml", + } + with from_here(): + binding = edtlib.Binding( + # Filters inherited specifications with an allowlist. + "test-bindings-include/simple_filter_allowlist.yaml", + fname2path, + require_compatible=False, + require_description=False, + ) + # Only property allowed. + assert {"prop-1"} == set(binding.prop2specs.keys()) + + with from_here(): + binding = edtlib.Binding( + # Filters inherited specifications with a blocklist. + "test-bindings-include/simple_filter_blocklist.yaml", + fname2path, + require_compatible=False, + require_description=False, + ) + # Only non blocked property. + assert {"prop-1"} == set(binding.prop2specs.keys()) + +def test_include_filters_inherited_child_bindings() -> None: + '''Test the basics of filtering properties inherited via an intermediary binding file + (child-binding level). + + See also: test_include_filters_inherited_bindings() + ''' + fname2path = { + "simple.yaml": "test-bindings-include/simple.yaml", + "simple_inherit.yaml": "test-bindings-include/simple_inherit.yaml", + } + with from_here(): + binding = edtlib.Binding( + "test-bindings-include/simple_filter_allowlist.yaml", + fname2path, + require_compatible=False, + require_description=False, + ) + assert binding.child_binding + child_binding = binding.child_binding + # Only property allowed. + assert {"child-prop-1"} == set(child_binding.prop2specs.keys()) + + with from_here(): + binding = edtlib.Binding( + "test-bindings-include/simple_filter_blocklist.yaml", + fname2path, + require_compatible=False, + require_description=False, + ) + # Only non blocked property. + assert binding.child_binding + child_binding = binding.child_binding + assert {"child-prop-1"} == set(child_binding.prop2specs.keys()) + +def test_include_filters_inherited_grandchild_bindings() -> None: + '''Test the basics of filtering properties inherited via an intermediary binding file + (grandchild-binding level). + + See also: test_include_filters_inherited_bindings() + ''' + fname2path = { + "simple.yaml": "test-bindings-include/simple.yaml", + "simple_inherit.yaml": "test-bindings-include/simple_inherit.yaml", + } + with from_here(): + binding = edtlib.Binding( + "test-bindings-include/simple_filter_allowlist.yaml", + fname2path, + require_compatible=False, + require_description=False, + ) + assert binding.child_binding + child_binding = binding.child_binding + assert child_binding.child_binding + grandchild_binding = child_binding.child_binding + # Only property allowed. + assert {"grandchild-prop-1"} == set(grandchild_binding.prop2specs.keys()) + + with from_here(): + binding = edtlib.Binding( + "test-bindings-include/simple_filter_blocklist.yaml", + fname2path, + require_compatible=False, + require_description=False, + ) + assert binding.child_binding + child_binding = binding.child_binding + assert child_binding.child_binding + grandchild_binding = child_binding.child_binding + # Only non blocked property. + assert {"grandchild-prop-1"} == set(grandchild_binding.prop2specs.keys()) def test_bus(): '''Test 'bus:' and 'on-bus:' in bindings''' From b0b278503f75bab70a10e65b0287f879765e661f Mon Sep 17 00:00:00 2001 From: Christophe Dufaza Date: Thu, 17 Oct 2024 22:21:24 +0200 Subject: [PATCH 2148/4482] Revert "edtlib: fix "last modified" semantic for included ... specs" [1] was introduced to get more valuable answers from the PropertySpec.path API, which is supposed to tell in which file the property's specification was "last modfied". Further work on related issues [2] showed that the approach chosen in [1] is dead end: we need to first rethink how bindings (and especially child-bindings) are initialized. [1] edtlib: fix last modified semantic in included property specs [2] edtlib: Preserve paths of properties from included child bindings See also: #65221, #78095 This reverts commit b3b5ad8156866ac39a6ac63236bada28d650b5d6. Signed-off-by: Christophe Dufaza --- .../src/devicetree/edtlib.py | 131 ++---------------- 1 file changed, 15 insertions(+), 116 deletions(-) diff --git a/scripts/dts/python-devicetree/src/devicetree/edtlib.py b/scripts/dts/python-devicetree/src/devicetree/edtlib.py index 099f3672addc1..61db1c8af3437 100644 --- a/scripts/dts/python-devicetree/src/devicetree/edtlib.py +++ b/scripts/dts/python-devicetree/src/devicetree/edtlib.py @@ -163,9 +163,7 @@ class Binding: def __init__(self, path: Optional[str], fname2path: Dict[str, str], raw: Any = None, require_compatible: bool = True, - require_description: bool = True, - inc_allowlist: Optional[List[str]] = None, - inc_blocklist: Optional[List[str]] = None): + require_description: bool = True): """ Binding constructor. @@ -193,36 +191,16 @@ def __init__(self, path: Optional[str], fname2path: Dict[str, str], "description:" line. If False, a missing "description:" is not an error. Either way, "description:" must be a string if it is present in the binding. - - inc_allowlist: - The property-allowlist filter set by including bindings. - - inc_blocklist: - The property-blocklist filter set by including bindings. """ self.path: Optional[str] = path self._fname2path: Dict[str, str] = fname2path - self._inc_allowlist: Optional[List[str]] = inc_allowlist - self._inc_blocklist: Optional[List[str]] = inc_blocklist - if raw is None: if path is None: _err("you must provide either a 'path' or a 'raw' argument") with open(path, encoding="utf-8") as f: raw = yaml.load(f, Loader=_BindingLoader) - # Get the properties this binding modifies - # before we merge the included ones. - last_modified_props = list(raw.get("properties", {}).keys()) - - # Map property names to their specifications: - # - first, _merge_includes() will recursively populate prop2specs with - # the properties specified by the included bindings - # - eventually, we'll update prop2specs with the properties - # this binding itself defines or modifies - self.prop2specs: Dict[str, 'PropertySpec'] = {} - # Merge any included files into self.raw. This also pulls in # inherited child binding definitions, so it has to be done # before initializing those. @@ -246,11 +224,10 @@ def __init__(self, path: Optional[str], fname2path: Dict[str, str], # Make sure this is a well defined object. self._check(require_compatible, require_description) - # Update specs with the properties this binding defines or modifies. - for prop_name in last_modified_props: - self.prop2specs[prop_name] = PropertySpec(prop_name, self) - # Initialize look up tables. + self.prop2specs: Dict[str, 'PropertySpec'] = {} + for prop_name in self.raw.get("properties", {}).keys(): + self.prop2specs[prop_name] = PropertySpec(prop_name, self) self.specifier2cells: Dict[str, List[str]] = {} for key, val in self.raw.items(): if key.endswith("-cells"): @@ -314,41 +291,18 @@ def _merge_includes(self, raw: dict, binding_path: Optional[str]) -> dict: if isinstance(include, str): # Simple scalar string case - # Load YAML file and register property specs into prop2specs. - inc_raw = self._load_raw(include, self._inc_allowlist, - self._inc_blocklist) - - _merge_props(merged, inc_raw, None, binding_path, False) + _merge_props(merged, self._load_raw(include), None, binding_path, + False) elif isinstance(include, list): # List of strings and maps. These types may be intermixed. for elem in include: if isinstance(elem, str): - # Load YAML file and register property specs into prop2specs. - inc_raw = self._load_raw(elem, self._inc_allowlist, - self._inc_blocklist) - - _merge_props(merged, inc_raw, None, binding_path, False) + _merge_props(merged, self._load_raw(elem), None, + binding_path, False) elif isinstance(elem, dict): name = elem.pop('name', None) - - # Merge this include property-allowlist filter - # with filters from including bindings. allowlist = elem.pop('property-allowlist', None) - if allowlist is not None: - if self._inc_allowlist: - allowlist.extend(self._inc_allowlist) - else: - allowlist = self._inc_allowlist - - # Merge this include property-blocklist filter - # with filters from including bindings. blocklist = elem.pop('property-blocklist', None) - if blocklist is not None: - if self._inc_blocklist: - blocklist.extend(self._inc_blocklist) - else: - blocklist = self._inc_blocklist - child_filter = elem.pop('child-binding', None) if elem: @@ -359,12 +313,10 @@ def _merge_includes(self, raw: dict, binding_path: Optional[str]) -> dict: _check_include_dict(name, allowlist, blocklist, child_filter, binding_path) - # Load YAML file, and register (filtered) property specs - # into prop2specs. - contents = self._load_raw(name, - allowlist, blocklist, - child_filter) + contents = self._load_raw(name) + _filter_properties(contents, allowlist, blocklist, + child_filter, binding_path) _merge_props(merged, contents, None, binding_path, False) else: _err(f"all elements in 'include:' in {binding_path} " @@ -384,17 +336,11 @@ def _merge_includes(self, raw: dict, binding_path: Optional[str]) -> dict: return raw - - def _load_raw(self, fname: str, - allowlist: Optional[List[str]] = None, - blocklist: Optional[List[str]] = None, - child_filter: Optional[dict] = None) -> dict: + def _load_raw(self, fname: str) -> dict: # Returns the contents of the binding given by 'fname' after merging - # any bindings it lists in 'include:' into it, according to the given - # property filters. - # - # Will also register the (filtered) included property specs - # into prop2specs. + # any bindings it lists in 'include:' into it. 'fname' is just the + # basename of the file, so we check that there aren't multiple + # candidates. path = self._fname2path.get(fname) @@ -406,55 +352,8 @@ def _load_raw(self, fname: str, if not isinstance(contents, dict): _err(f'{path}: invalid contents, expected a mapping') - # Apply constraints to included YAML contents. - _filter_properties(contents, - allowlist, blocklist, - child_filter, self.path) - - # Register included property specs. - self._add_included_prop2specs(fname, contents, allowlist, blocklist) - return self._merge_includes(contents, path) - def _add_included_prop2specs(self, fname: str, contents: dict, - allowlist: Optional[List[str]] = None, - blocklist: Optional[List[str]] = None) -> None: - # Registers the properties specified by an included binding file - # into the properties this binding supports/requires (aka prop2specs). - # - # Consider "this" binding B includes I1 which itself includes I2. - # - # We assume to be called in that order: - # 1) _add_included_prop2spec(B, I1) - # 2) _add_included_prop2spec(B, I2) - # - # Where we don't want I2 "taking ownership" for properties - # modified by I1. - # - # So we: - # - first create a binding that represents the included file - # - then add the property specs defined by this binding to prop2specs, - # without overriding the specs modified by an including binding - # - # Note: Unfortunately, we can't cache these base bindings, - # as a same YAML file may be included with different filters - # (property-allowlist and such), leading to different contents. - - inc_binding = Binding( - self._fname2path[fname], - self._fname2path, - contents, - require_compatible=False, - require_description=False, - # Recursively pass filters to included bindings. - inc_allowlist=allowlist, - inc_blocklist=blocklist, - ) - - for prop, spec in inc_binding.prop2specs.items(): - if prop not in self.prop2specs: - self.prop2specs[prop] = spec - def _check(self, require_compatible: bool, require_description: bool): # Does sanity checking on the binding. From 8a824f307d0b69ccb3161eddc6be2a08ef60f112 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 17 Oct 2024 12:01:34 -0400 Subject: [PATCH 2149/4482] mips: tracing: add switched_out trace point add missing switched_out trace point. Partially fixes #76057 Signed-off-by: Anas Nashif --- arch/mips/core/isr.S | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/mips/core/isr.S b/arch/mips/core/isr.S index 86d05d1983356..f2f2f34205364 100644 --- a/arch/mips/core/isr.S +++ b/arch/mips/core/isr.S @@ -70,6 +70,7 @@ GTEXT(_Fault) GTEXT(_k_neg_eagain) GTEXT(z_thread_mark_switched_in) +GTEXT(z_thread_mark_switched_out) /* exports */ GTEXT(__isr_vec) @@ -209,6 +210,9 @@ on_thread_stack: #endif /* CONFIG_PREEMPT_ENABLED */ reschedule: +#ifdef CONFIG_INSTRUMENT_THREAD_SWITCHING + jal z_thread_mark_switched_out +#endif /* * Check if the current thread is the same as the thread on the ready Q. If * so, do not reschedule. From 2f6a65c8a466714b51dcd17a1f41bd5135553105 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Thu, 10 Oct 2024 16:13:24 +0200 Subject: [PATCH 2150/4482] test: bluetooth: Update ICS to TCRL 2024-2 GAP PAST (and BAP) tests were also enabled since controller support is under review. This also adds bqw file which is exported draft project from Qualification Workspace. Signed-off-by: Szymon Janc --- tests/bluetooth/qualification/.editorconfig | 2 +- .../ICS_Zephyr_Bluetooth_Host.bqw | 3161 +++++++++++++++++ .../ICS_Zephyr_Bluetooth_Host.pts | 383 +- 3 files changed, 3519 insertions(+), 27 deletions(-) create mode 100644 tests/bluetooth/qualification/ICS_Zephyr_Bluetooth_Host.bqw diff --git a/tests/bluetooth/qualification/.editorconfig b/tests/bluetooth/qualification/.editorconfig index 40957fa40e6b9..38519f2381289 100644 --- a/tests/bluetooth/qualification/.editorconfig +++ b/tests/bluetooth/qualification/.editorconfig @@ -1,2 +1,2 @@ -[*.{pts}] +[*.{pts,bqw}] end_of_line = crlf diff --git a/tests/bluetooth/qualification/ICS_Zephyr_Bluetooth_Host.bqw b/tests/bluetooth/qualification/ICS_Zephyr_Bluetooth_Host.bqw new file mode 100644 index 0000000000000..958ad9fd319b5 --- /dev/null +++ b/tests/bluetooth/qualification/ICS_Zephyr_Bluetooth_Host.bqw @@ -0,0 +1,3161 @@ + + + + + + + + + + GAP 10/5 + GAP 16/3 + GAP 31/8 + GAP 8a/11 + GAP 8a/15 + GAP 8a/16 + GAP 10/4 + GAP 16/4 + GAP 36/3 + GAP 8a/7 + GAP 17/3 + GAP 35/4 + GAP 8a/1 + GAP 8a/4 + GAP 21/2 + GAP 21/10 + GAP 22/1 + GAP 31/10 + GAP 32/1 + GAP 32/2 + GAP 22/3 + GAP 24/4 + GAP 10/2 + GAP 11/2 + GAP 36/5 + GAP 8a/2 + GAP 8a/9 + GAP 12/2 + GAP 21/9 + GAP 22/2 + GAP 24/2 + GAP 25/4 + GAP 31/4 + GAP 35/3 + GAP 35/5 + GAP 36/2 + GAP 8a/3 + GAP 8a/8 + GAP 8a/10 + GAP 12/1 + GAP 21/7 + GAP 28/1 + GAP 31/1 + GAP 31/6 + GAP 31/9 + GAP 8a/13 + GAP 8a/17 + GAP 6/1 + GAP 9/1 + GAP 16/1 + GAP 35/6 + GAP 14a/18 + GAP 30a/1 + GAP 30a/3 + GAP 34/3 + GAP 37b/6 + GAP 8a/5 + GAP 10/1 + GAP 21/1 + GAP 21/4 + GAP 22/4 + GAP 24/1 + GAP 32/3 + GAP 34/2 + GAP 8a/19 + GAP 14a/1 + GAP 14a/13 + GAP 27b/7 + GAP 37b/1 + GAP 6/2 + GAP 15/1 + GAP 17/1 + GAP 18/1 + GAP 18/2 + GAP 21/5 + GAP 28/2 + GAP 34/1 + GAP 36/1 + GAP 8a/12 + GAP 8a/14 + GAP 11/3 + GAP 14a/2 + GAP 14a/8 + GAP 14a/12 + GAP 14a/16 + GAP 14a/19 + GAP 24/3 + GAP 30a/11 + GAP 14a/4 + GAP 14a/14 + GAP 30a/7 + GAP 30a/12 + GAP 37b/7 + GAP 10/3 + GAP 20/3 + GAP 25/14 + GAP 27c/2 + GAP 27c/3 + GAP 14a/3 + GAP 14a/5 + GAP 14a/6 + GAP 14a/7 + GAP 30a/6 + GAP 30a/8 + GAP 30a/17 + GAP 35/14 + GAP 37b/8 + GAP 14a/9 + GAP 14a/11 + GAP 30a/9 + GAP 30a/14 + GAP 30a/18 + GAP 30a/19 + GAP 8a/18 + GAP 27b/1 + GAP 30a/2 + GAP 30a/4 + GAP 30a/5 + GAP 30a/10 + GAP 30a/13 + GAP 11/1 + GAP 21/6 + GAP 25/3 + GAP 31/2 + GAP 31/5 + GAP 21/8 + GAP 5/2 + GAP 8/3 + GAP 11b/1 + GAP 14/1 + GAP 5/1 + GAP 14a/10 + GAP 14a/15 + GAP 14a/17 + GAP 27b/6 + GAP 27b/8 + GAP 30a/15 + GAP 30a/16 + GAP 8/2 + GAP 20/2 + GAP 31/11 + GAP 35/15 + GAP 37b/9 + GAP 37c/1 + GAP 37c/3 + GAP 7/1 + GAP 13/2 + GAP 17a/2 + GAP 17b/1 + GAP 20/6 + GAP 20A/5 + GAP 20A/8 + GAP 23/2 + GAP 23/6 + GAP 25/1 + GAP 25/6 + GAP 25/12 + GAP 25/13a + GAP 27/7 + GAP 33/4 + GAP 33/8a + GAP 35/10 + GAP 37/3 + GAP 37/3a + GAP 37a/6 + GAP 20/1 + GAP 27b/9 + GAP 27c/1 + GAP 5/3 + GAP 8/5 + GAP 14/2 + GAP 7/3 + GAP 11a/2 + GAP 17a/1 + GAP 17a/4 + GAP 19/1 + GAP 20/5 + GAP 20A/7 + GAP 20A/18 + GAP 23/3 + GAP 23/7 + GAP 23/7a + GAP 25/2 + GAP 25/5 + GAP 26/3 + GAP 27/5 + GAP 27a/1 + GAP 27a/3 + GAP 27a/4 + GAP 27a/5 + GAP 27b/5 + GAP 31/3 + GAP 37a/2 + GAP 17/4 + GAP 20A/3 + GAP 20A/15 + GAP 25/9 + GAP 25/13b + GAP 25/13c + GAP 27/6 + GAP 27a/2 + GAP 29/4 + GAP 30/1 + GAP 33/1 + GAP 33/5 + GAP 33/8 + GAP 35/8 + GAP 35/11 + GAP 35/12 + GAP 35/13 + GAP 35/13c + GAP 11/5 + GAP 11a/1 + GAP 13/1 + GAP 17/2 + GAP 17/5 + GAP 17b/2 + GAP 20/7 + GAP 20A/2 + GAP 20A/9 + GAP 20A/11 + GAP 20A/13 + GAP 20A/16 + GAP 23/1 + GAP 23/5 + GAP 26/6 + GAP 27/1 + GAP 27/9 + GAP 30/2 + GAP 33/7 + GAP 36/6 + GAP 37a/4 + GAP 0/2 + GAP 17b/3 + GAP 20A/6 + GAP 25/10 + GAP 25/13 + GAP 26/1 + GAP 26/2 + GAP 26/4 + GAP 27/9a + GAP 27b/2 + GAP 29/3 + GAP 33/2 + GAP 35/13a + GAP 35/13b + GAP 37b/5 + GAP 8a/14a + GAP 21/11 + GAP 30a/14a + GAP 8/4 + GAP 8a/6 + GAP 11b/3 + GAP 17a/5 + GAP 19/2 + GAP 19/3 + GAP 20A/10 + GAP 20A/12 + GAP 20A/14a + GAP 20A/17 + GAP 21/3 + GAP 25/7 + GAP 26/5 + GAP 29/1 + GAP 29/2 + GAP 35/1 + GAP 35/9 + GAP 37/7 + GAP 37a/1 + GAP 37a/5 + GAP 37b/2 + GAP 8/1 + GAP 16/2 + GAP 37c/2 + GAP 14a/14a + GAP 20/4 + GAP 5/4 + GAP 11/4 + GAP 7/2 + GAP 11b/2 + GAP 11b/4 + GAP 17b/4 + GAP 20A/4 + GAP 20A/19 + GAP 23/4 + GAP 25/8 + GAP 25/11 + GAP 27b/3 + GAP 33/6 + GAP 35/7 + GAP 37/2 + GAP 37/6 + GAP 37a/3 + GAP 37b/3 + GAP 11c/1 + GAP 20A/1 + GAP 20A/14 + GAP 27/2 + GAP 27a/6 + GAP 35/2 + GAP 37/1 + + + + + L2CAP 2/46 + L2CAP 3/1 + L2CAP 1/5 + L2CAP 2/40 + L2CAP 2/42 + L2CAP 2/47 + L2CAP 3/16 + L2CAP 2/43 + L2CAP 3/12 + L2CAP 4/3 + L2CAP 1/4 + L2CAP 1/6 + L2CAP 2/45a + L2CAP 0/2 + L2CAP 2/48 + L2CAP 4/1 + L2CAP 2/41 + L2CAP 2/48b + L2CAP 4/2 + L2CAP 2/49 + L2CAP 1/3 + + + + + IOP 2/2 + IOP 1/1 + + + + + GATT 3/10 + GATT 3/11 + GATT 3/16 + GATT 4/16 + GATT 3/7 + GATT 4/8 + GATT 4/17 + GATT 4/2 + GATT 4/22 + GATT 3/13 + GATT 3/21 + GATT 3/22 + GATT 3/23 + GATT 4/7 + GATT 3/18 + GATT 3/6 + GATT 4/4 + GATT 3/2 + GATT 3/3 + GATT 3/8 + GATT 3/12 + GATT 3/14 + GATT 3/19 + GATT 3/20 + GATT 4/6 + GATT 4/9 + GATT 4/11 + GATT 4/14 + GATT 7/7 + GATT 9/5 + GATT 9/6 + GATT 10/5 + GATT 4/25 + GATT 8/8 + GATT 3a/1 + GATT 4/12 + GATT 7/2 + GATT 9/10 + GATT 4/19 + GATT 4a/2 + GATT 9/4 + GATT 10/1 + GATT 10/3 + GATT 10/4 + GATT 10/6 + GATT 3/17 + GATT 4/21 + GATT 7/4 + GATT 7/6 + GATT 9/7 + GATT 9/8 + GATT 9/14 + GATT 10/7 + GATT 10/8 + GATT 10/12 + GATT 3/1 + GATT 4/23 + GATT 4/26 + GATT 7/8 + GATT 8/2 + GATT 4/20 + GATT 9/3 + GATT 9/9 + GATT 9/13 + GATT 10/2 + GATT 10/9 + GATT 2/5 + GATT 4/5 + GATT 7/5 + GATT 9/11 + GATT 9/15 + GATT 3/5 + GATT 4/10 + GATT 4/15 + GATT 4a/1 + GATT 4/1 + GATT 4/13 + GATT 4/18 + GATT 3/4 + GATT 3/9 + GATT 3/15 + GATT 4/3 + GATT 9/12 + GATT 1a/1 + GATT 1a/3 + GATT 2/2 + GATT 2/4 + GATT 3a/2 + GATT 7/3 + GATT 9/1 + GATT 9/2 + GATT 10/11 + GATT 2/3a + GATT 4/30 + GATT 4/31 + GATT 1/2 + GATT 3/25 + GATT 1/1 + GATT 3/29 + GATT 3/30 + GATT 3/26 + GATT 4/27 + + + + + SM 4/1 + SM 6/1 + SM 6/2 + SM 2/2 + SM 5/3 + SM 7a/3 + SM 7b/3 + SM 3/1 + SM 2/3 + SM 7a/2 + SM 5/1 + SM 5/4 + SM 5/2 + SM 7a/1 + SM 1/2 + SM 7b/2 + SM 7b/1 + SM 2/1 + SM 1/1 + SM 4/3 + SM 2/5 + SM 4/2 + + + + + ATT 3/12 + ATT 3/15 + ATT 3/18 + ATT 4/10 + ATT 4/7 + ATT 4/8 + ATT 4/12 + ATT 4/22 + ATT 4/24 + ATT 4/27 + ATT 3/3 + ATT 3/4 + ATT 3/6 + ATT 3/9 + ATT 3/19 + ATT 3/21 + ATT 3/22 + ATT 3/25 + ATT 3/28 + ATT 4/2 + ATT 4/16 + ATT 4/26 + ATT 4/20 + ATT 3/10 + ATT 3/16 + ATT 1/1 + ATT 3/26 + ATT 4/1 + ATT 4/13 + ATT 3/7 + ATT 3/11 + ATT 3/14 + ATT 3/17 + ATT 4/3 + ATT 4/6 + ATT 4/9 + ATT 4/19 + ATT 3/8 + ATT 3/23 + ATT 4/4 + ATT 4/5 + ATT 4/14 + ATT 4/17 + ATT 4/23 + ATT 7/2 + ATT 2/3a + ATT 3/31 + ATT 4/33 + ATT 1/2 + ATT 3/1 + ATT 3/2 + ATT 3/5 + ATT 3/13 + ATT 3/20 + ATT 3/24 + ATT 3/27 + ATT 4/11 + ATT 4/15 + ATT 4/18 + ATT 4/21 + ATT 4/25 + ATT 4/28 + ATT 4/32 + ATT 7/3 + ATT 6/1 + ATT 4/31 + ATT 2/2 + ATT 3/30 + ATT 3/32 + ATT 7/1 + + + + + DIS 1/2 + DIS 2/5 + DIS 2/3 + DIS 2/11 + DIS 2/2 + DIS 2/4 + DIS 2/6 + DIS 2/7 + DIS 3/3 + DIS 2/1 + DIS 0/2 + DIS 5/1 + + + + + IAS 2/2 + IAS 2/3 + IAS 1/2 + IAS 3/2 + IAS 0/1 + IAS 2/1 + IAS 2/4 + IAS 3/1 + + + + + HRS 1/2 + HRS 2/1 + HRS 3/6 + HRS 0/1 + HRS 3/2 + HRS 3/5 + HRS 2/2 + HRS 3/4 + + + + + BAS 0/2 + BAS 2/3 + BAS 2/1 + BAS 3/5 + BAS 3/3 + BAS 4/1 + BAS 1/2 + BAS 4/2 + + + + + OTS 4/13 + OTS 4/15 + OTS 6/1 + OTS 3/3 + OTS 4/7 + OTS 5/3 + OTS 5/6 + OTS 8/4 + OTS 8/7 + OTS 2/1 + OTS 4/6 + OTS 6/2 + OTS 6/4 + OTS 6/5 + OTS 3/2 + OTS 4/12 + OTS 5/2 + OTS 8/3 + OTS 4/2 + OTS 4/3 + OTS 4/16 + OTS 4/20 + OTS 5/1 + OTS 0/1 + OTS 5/9 + OTS 6/3 + OTS 7/1 + OTS 8/8 + OTS 4/1 + OTS 5/5 + OTS 8/1 + OTS 8/6 + OTS 8/2 + OTS 4/4 + OTS 4/5 + + + + + OTP 6/10 + OTP 6/12 + OTP 7/1 + OTP 7/20 + OTP 9/12 + OTP 2/2 + OTP 5/1 + OTP 7/6 + OTP 9/4 + OTP 9/9 + OTP 2/1 + OTP 6/11 + OTP 7/15 + OTP 7/17 + OTP 9/10 + OTP 0/1 + OTP 6/3 + OTP 7/3 + OTP 7/19 + OTP 8/30 + OTP 9/3 + OTP 9/11 + OTP 9/15 + OTP 3/2 + OTP 6/1 + OTP 6/13 + OTP 7/16 + OTP 9/18 + OTP 7/18 + OTP 8/1 + OTP 9/5 + OTP 9/8 + OTP 6/9 + OTP 9/6 + OTP 9/13 + OTP 4/1 + OTP 6/2 + OTP 6/14 + OTP 7/2 + OTP 9/1 + OTP 9/14 + OTP 9/16 + OTP 10/1 + OTP 7/7 + OTP 6/7 + OTP 8/19 + OTP 8/18 + OTP 7/12 + OTP 6/4 + OTP 8/2 + OTP 8/17 + + + + + MESH 0/2 + MESH 4/2 + MESH 4/6 + MESH 4/15 + MESH 6/1 + MESH 7/5 + MESH 10/3 + MESH 11/2 + MESH 11/12 + MESH 11/17 + MESH 11/18 + MESH 11/21 + MESH 2/2 + MESH 4/3 + MESH 4/8 + MESH 5/4 + MESH 11/15 + MESH 12/3 + MESH 12/6 + MESH 18/11 + MESH 21/2 + MESH 3/1 + MESH 4/17 + MESH 7/1 + MESH 10/1 + MESH 13/1 + MESH 14/4 + MESH 16/4 + MESH 18/1 + MESH 18/9 + MESH 20/2 + MESH 21/1 + MESH 21/4 + MESH 1a/2 + MESH 4/11 + MESH 4/13 + MESH 7/4 + MESH 11/6 + MESH 11/14 + MESH 11/23 + MESH 12/12 + MESH 14/1 + MESH 18/2 + MESH 18/6 + MESH 18/12 + MESH 11/1 + MESH 11/4 + MESH 11/22 + MESH 12/1 + MESH 15/1 + MESH 20/3 + MESH 2/3 + MESH 3/2 + MESH 4/1 + MESH 4/4 + MESH 4/9 + MESH 4/12 + MESH 4/16 + MESH 5/3 + MESH 6/3 + MESH 7/2 + MESH 8/1 + MESH 9/1 + MESH 11/8 + MESH 11/20 + MESH 12/2 + MESH 12/4 + MESH 14/2 + MESH 14/3 + MESH 15/2 + MESH 15/3 + MESH 16/1 + MESH 16/2 + MESH 16/3 + MESH 16/6 + MESH 18/4 + MESH 18/7 + MESH 20/4 + MESH 21/3 + MESH 12/5 + MESH 12/11 + MESH 18/3 + MESH 18/10 + MESH 20/5 + MESH 10/5 + MESH 11/13 + MESH 12/7 + MESH 2/1 + MESH 4/7 + MESH 4/14 + MESH 7/3 + MESH 10/4 + MESH 11/11 + MESH 12/8 + MESH 15/4 + MESH 15/5 + MESH 16/5 + MESH 18/13 + MESH 19/1 + MESH 4/5 + MESH 4/10 + MESH 5/1 + MESH 5/2 + MESH 6/2 + MESH 10/2 + MESH 11/3 + MESH 11/5 + MESH 11/7 + MESH 11/19 + MESH 11/24 + MESH 13/2 + MESH 14/5 + MESH 18/5 + MESH 18/8 + MESH 20/1 + MESH 11/16 + + + + + LC3 1/1 + LC3 5/2 + LC3 5/4 + LC3 5/6 + LC3 3/6 + LC3 5/5 + LC3 2/3 + LC3 4/1 + LC3 5/1 + LC3 6/1 + LC3 2/1 + LC3 3/3 + LC3 3/5 + LC3 5/3 + LC3 0/1 + LC3 3/1 + LC3 3/2 + LC3 3/4 + LC3 6/2 + LC3 2/2 + LC3 4/2 + + + + + AICS 2/1 + AICS 2/3 + AICS 2/5 + AICS 3/4 + AICS 3/2 + AICS 3/5 + AICS 2/4 + AICS 2/2 + AICS 2/6 + AICS 2/7 + AICS 4/1 + AICS 4/2 + AICS 3/1 + AICS 3/3 + AICS 1/2 + AICS 4/4 + AICS 4/6 + AICS 2/8 + AICS 4/3 + AICS 0/1 + + + + + VOCS 2/2 + VOCS 2/5 + VOCS 2/4 + VOCS 2/7 + VOCS 3/1 + VOCS 3/6 + VOCS 2/1 + VOCS 2/3 + VOCS 3/3 + VOCS 1/2 + VOCS 2/6 + VOCS 2/8 + VOCS 3/4 + VOCS 3/2 + VOCS 0/1 + + + + + VCS 3/1 + VCS 3/2 + VCS 3/4 + VCS 3/7 + VCS 2/2 + VCS 2/1 + VCS 2/4 + VCS 3/6 + VCS 3/5 + VCS 4/3 + VCS 2/3 + VCS 3/3 + VCS 1/2 + VCS 4/4 + VCS 4/6 + VCS 0/1 + VCS 4/1 + VCS 4/2 + + + + + VCP 14/8 + VCP 16/5 + VCP 16/11 + VCP 13/4 + VCP 15/6 + VCP 14/6 + VCP 15/3 + VCP 17/7 + VCP 17/10 + VCP 17/11 + VCP 16/9 + VCP 14/4 + VCP 14/5 + VCP 16/7 + VCP 15/2 + VCP 16/8 + VCP 16/13 + VCP 8/1 + VCP 11/1 + VCP 11/3 + VCP 5/1 + VCP 5/2 + VCP 5/3 + VCP 17/6 + VCP 14/7 + VCP 16/12 + VCP 16/14 + VCP 12/11 + VCP 13/1 + VCP 15/1 + VCP 12/3 + VCP 12/4 + VCP 17/9 + VCP 13/2 + VCP 13/3 + VCP 16/3 + VCP 16/6 + VCP 3/1 + VCP 17/3 + VCP 17/8 + VCP 16/2 + VCP 17/1 + VCP 17/5 + VCP 18/7 + VCP 1/1 + VCP 1/2 + VCP 14/1 + VCP 18/2 + VCP 18/6 + VCP 12/1 + VCP 12/6 + VCP 12/12 + VCP 6/3 + VCP 2/2 + VCP 12/9 + VCP 12/10 + VCP 14/2 + VCP 17/4 + VCP 6/1 + VCP 17/2 + VCP 18/1 + VCP 18/12 + VCP 6/10 + VCP 18/15 + VCP 6/8 + VCP 16/1 + VCP 18/4 + VCP 11/2 + VCP 14/3 + VCP 14/9 + VCP 16/4 + VCP 16/10 + VCP 15/4 + VCP 15/5 + VCP 12/2 + VCP 12/5 + VCP 5/4 + VCP 6/11 + VCP 10/2 + VCP 10/3 + VCP 6/2 + VCP 12/7 + VCP 12/8 + VCP 18/3 + VCP 18/14 + VCP 6/13 + VCP 10/1 + + + + + MICS 2/1 + MICS 3/3 + MICS 1/2 + MICS 3/6 + MICS 3/2 + MICS 3/1 + MICS 0/1 + MICS 3/4 + + + + + MICP 13/3 + MICP 12/2 + MICP 12/3 + MICP 14/4 + MICP 15/6 + MICP 15/11 + MICP 14/5 + MICP 14/9 + MICP 15/10 + MICP 13/5 + MICP 14/3 + MICP 14/13 + MICP 5/2 + MICP 15/7 + MICP 16/4 + MICP 14/7 + MICP 14/11 + MICP 14/12 + MICP 15/8 + MICP 16/5 + MICP 13/4 + MICP 13/6 + MICP 14/6 + MICP 6/1 + MICP 11/1 + MICP 14/8 + MICP 14/10 + MICP 5/1 + MICP 15/9 + MICP 6/4 + MICP 6/6 + MICP 15/5 + MICP 14/1 + MICP 15/4 + MICP 1/1 + MICP 1/2 + MICP 13/1 + MICP 16/1 + MICP 15/1 + MICP 16/3 + MICP 6/2 + MICP 6/8 + MICP 14/2 + MICP 15/2 + MICP 2/2 + MICP 8/1 + MICP 16/13 + MICP 12/1 + MICP 14/14 + MICP 16/6 + MICP 16/7 + MICP 6/14 + MICP 10/2 + MICP 6/5 + MICP 13/2 + MICP 15/3 + MICP 10/1 + MICP 3/1 + MICP 16/14 + MICP 6/13 + + + + + MCS 22/12 + MCS 22/21 + MCS 23/9 + MCS 24/3 + MCS 22/5 + MCS 22/13 + MCS 22/19 + MCS 22/20 + MCS 22/25 + MCS 23/7 + MCS 23/10 + MCS 24/1 + MCS 24/2 + MCS 25/2 + MCS 25/4 + MCS 22/7 + MCS 22/24 + MCS 23/14 + MCS 23/20 + MCS 25/3 + MCS 20/1 + MCS 21/2 + MCS 22/3 + MCS 22/17 + MCS 22/23 + MCS 23/13 + MCS 22/8 + MCS 22/9 + MCS 22/11 + MCS 22/14 + MCS 22/26 + MCS 23/6 + MCS 23/8 + MCS 23/12 + MCS 23/21 + MCS 24/4 + MCS 22/4 + MCS 22/6 + MCS 22/10 + MCS 22/18 + MCS 23/1 + MCS 23/2 + MCS 23/11 + MCS 23/17 + MCS 0b/2 + MCS 22/1 + MCS 22/2 + MCS 22/15 + MCS 22/16 + MCS 22/22 + MCS 23/5 + MCS 23/15 + MCS 23/16 + MCS 23/18 + MCS 25/1 + MCS 25/6 + MCS 23/3 + MCS 23/4 + MCS 23/19 + + + + + MCP 16/9 + MCP 17/3 + MCP 17/4 + MCP 17/7 + MCP 16/13 + MCP 16/14 + MCP 16/22 + MCP 17/8 + MCP 16/6 + MCP 16/19 + MCP 17/17 + MCP 17/18 + MCP 16/5 + MCP 16/11 + MCP 16/17 + MCP 17/5 + MCP 17/6 + MCP 17/12 + MCP 18/7 + MCP 6/2 + MCP 18/2 + MCP 16/7 + MCP 16/8 + MCP 16/16 + MCP 2/2 + MCP 16/20 + MCP 17/1 + MCP 17/9 + MCP 17/11 + MCP 17/13 + MCP 17/14 + MCP 17/19 + MCP 6/3 + MCP 16/21 + MCP 16/2 + MCP 16/4 + MCP 16/10 + MCP 16/15 + MCP 17/15 + MCP 17/20 + MCP 6/5 + MCP 10/1 + MCP 18/3 + MCP 18/4 + MCP 1/2 + MCP 6/4 + MCP 10/2 + MCP 1/1 + MCP 6/6 + MCP 6/1 + MCP 9/2 + MCP 9/3 + MCP 18/8 + MCP 16/1 + MCP 16/3 + MCP 16/12 + MCP 16/18 + MCP 17/2 + MCP 17/10 + MCP 17/16 + MCP 18/5 + MCP 18/6 + MCP 6/13 + MCP 5/3 + MCP 6/7 + MCP 9/1 + MCP 8/1 + MCP 21/3 + MCP 13/3 + MCP 20/1 + MCP 21/2 + MCP 3/1 + MCP 6/14 + MCP 13/2 + MCP 21/1 + MCP 5/2 + MCP 11/1 + MCP 18/14 + MCP 18/15 + MCP 5/4 + + + + + TBS 2/3 + TBS 3/1 + TBS 3/2 + TBS 3/6 + TBS 2/15 + TBS 3/5 + TBS 2/18 + TBS 3/4 + TBS 2/9 + TBS 2/12 + TBS 2/23 + TBS 3/3 + TBS 2/24 + TBS 2/16 + TBS 2/17 + TBS 2/20 + TBS 4/4 + TBS 22/13 + TBS 22/15 + TBS 22/16 + TBS 22/17 + TBS 1/2 + TBS 2/4 + TBS 2/5 + TBS 2/21 + TBS 2/22 + TBS 22/4 + TBS 22/10 + TBS 22/11 + TBS 23/5 + TBS 24/2 + TBS 24/7 + TBS 2/8 + TBS 2/10 + TBS 2/13 + TBS 2/25 + TBS 4/5 + TBS 22/3 + TBS 22/12 + TBS 22/14 + TBS 22/22 + TBS 24/3 + TBS 2/11 + TBS 4/1 + TBS 20/1 + TBS 22/8 + TBS 22/19 + TBS 22/20 + TBS 23/1 + TBS 23/4 + TBS 24/1 + TBS 24/5 + TBS 0/1 + TBS 2/14 + TBS 4/2 + TBS 22/2 + TBS 22/5 + TBS 0b/2 + TBS 2/1 + TBS 2/2 + TBS 2/6 + TBS 4/7 + TBS 21/2 + TBS 22/1 + TBS 22/6 + TBS 22/7 + TBS 22/24 + TBS 23/3 + TBS 2/7 + TBS 2/19 + TBS 22/9 + TBS 22/18 + TBS 22/21 + TBS 22/23 + TBS 22/25 + TBS 23/6 + TBS 24/4 + TBS 0b/1 + TBS 4/3 + TBS 23/2 + + + + + CCP 11/5 + CCP 11/10 + CCP 12/2 + CCP 12/6 + CCP 12/16 + CCP 13/5 + CCP 13/9 + CCP 13/10 + CCP 14/4 + CCP 14/5 + CCP 12/3 + CCP 12/19 + CCP 12/20 + CCP 13/11 + CCP 14/3 + CCP 14/8 + CCP 11/3 + CCP 11/9 + CCP 11/12 + CCP 12/14 + CCP 12/21 + CCP 13/1 + CCP 13/3 + CCP 13/13 + CCP 13/14 + CCP 11/7 + CCP 12/4 + CCP 12/7 + CCP 12/8 + CCP 12/11 + CCP 12/15 + CCP 12/22 + CCP 13/4 + CCP 14/16 + CCP 14/17 + CCP 11/2 + CCP 12/13 + CCP 12/17 + CCP 13/2 + CCP 14/12 + CCP 14/13 + CCP 14/15 + CCP 14/14 + CCP 11/4 + CCP 11/14 + CCP 11/16 + CCP 12/5 + CCP 12/9 + CCP 12/12 + CCP 12/18 + CCP 13/16 + CCP 14/7 + CCP 14/11 + CCP 14/19 + CCP 14/20 + CCP 6/6 + CCP 13/6 + CCP 11/1 + CCP 11/8 + CCP 11/15 + CCP 12/1 + CCP 13/7 + CCP 13/12 + CCP 13/15 + CCP 14/2 + CCP 14/9 + CCP 14/10 + CCP 1/1 + CCP 6/1 + CCP 6/5 + CCP 6/2 + CCP 2/2 + CCP 6/7 + CCP 15/6 + CCP 1/2 + CCP 15/2 + CCP 11/11 + CCP 11/13 + CCP 12/10 + CCP 13/8 + CCP 14/1 + CCP 14/6 + CCP 14/18 + CCP 14/21 + CCP 14/22 + CCP 15/7 + CCP 15/3 + CCP 5/2 + CCP 11/6 + CCP 6/4 + CCP 15/14 + CCP 3/1 + CCP 6/14 + CCP 15/15 + CCP 8/1 + CCP 10/2 + CCP 5/3 + CCP 15/4 + CCP 15/5 + CCP 15/8 + CCP 5/1 + CCP 6/13 + CCP 10/1 + + + + + CSIS 2/3 + CSIS 2/4 + CSIS 3/2 + CSIS 2/2 + CSIS 3/1 + CSIS 2/1 + CSIS 3/4 + CSIS 3/3 + CSIS 1/2 + CSIS 2/5 + CSIS 0a/2 + CSIS 2/6 + CSIS 3/6 + + + + + CSIP 11/2 + CSIP 12/4 + CSIP 6/2 + CSIP 13/3 + CSIP 13/8 + CSIP 5/2 + CSIP 13/6 + CSIP 13/9 + CSIP 14/2 + CSIP 14/5 + CSIP 14/7 + CSIP 12/2 + CSIP 6/1 + CSIP 6/9 + CSIP 5/5 + CSIP 6/8 + CSIP 12/3 + CSIP 14/3 + CSIP 14/6 + CSIP 1/1 + CSIP 1/2 + CSIP 6/7 + CSIP 11/1 + CSIP 11/3 + CSIP 11/4 + CSIP 12/1 + CSIP 12/5 + CSIP 14/9 + CSIP 5/4 + CSIP 13/11 + CSIP 2/2 + CSIP 6/6 + CSIP 13/1 + CSIP 5/1 + CSIP 13/10 + CSIP 14/4 + CSIP 4/2 + CSIP 9/2 + CSIP 13/4 + CSIP 14/15 + CSIP 13/7 + CSIP 14/8 + CSIP 6/15 + CSIP 6/16 + CSIP 13/2 + CSIP 13/5 + CSIP 6/3 + CSIP 10/1 + CSIP 6/4 + CSIP 14/16 + + + + + PACS 4/9 + PACS 4/10 + PACS 4/5 + PACS 4/11 + PACS 4/14 + PACS 4/6 + PACS 5/1 + PACS 4/12 + PACS 4/16 + PACS 3/5 + PACS 4/7 + PACS 4/15 + PACS 4/13 + PACS 3/4 + PACS 4/3 + PACS 3/1 + PACS 4/1 + PACS 4/4 + PACS 4/2 + PACS 2/2 + PACS 3/2 + PACS 3/3 + PACS 6/1 + PACS 6/3 + PACS 4/8 + PACS 3/6 + PACS 6/7 + PACS 6/2 + PACS 6/5 + PACS 6/4 + PACS 1/1 + + + + + ASCS 6/4 + ASCS 6/7 + ASCS 7/4 + ASCS 6/5 + ASCS 7/3 + ASCS 7/5 + ASCS 4/1 + ASCS 6/1 + ASCS 6/2 + ASCS 6/9 + ASCS 6/3 + ASCS 6/8 + ASCS 7/2 + ASCS 2/2 + ASCS 8/2 + ASCS 7/1 + ASCS 5/1 + ASCS 8/1 + ASCS 9/3 + ASCS 6/6 + ASCS 5/3 + ASCS 9/5 + ASCS 0/1 + ASCS 3/1 + ASCS 5/2 + ASCS 9/1 + ASCS 9/7 + ASCS 9/2 + ASCS 9/4 + ASCS 9/9 + ASCS 9/6 + + + + + BASS 3/2 + BASS 3/5 + BASS 4/1 + BASS 5/2 + BASS 5/6 + BASS 4/5 + BASS 5/1 + BASS 3/1 + BASS 4/2 + BASS 4/6 + BASS 4/3 + BASS 5/8 + BASS 5/3 + BASS 0/1 + BASS 2/2 + BASS 3/4 + BASS 4/4 + BASS 5/4 + BASS 5/5 + + + + + BAP 45/7 + BAP 46/1 + BAP 74/2 + BAP 80/3 + BAP 89/9 + BAP 89/12 + BAP 90/1 + BAP 11/2 + BAP 7/2 + BAP 7/3 + BAP 20/5 + BAP 20/10 + BAP 31/2 + BAP 31/6 + BAP 32/3 + BAP 32/4 + BAP 16/12 + BAP 16/15 + BAP 17/6 + BAP 80/6 + BAP 89/6 + BAP 10/5 + BAP 20/7 + BAP 33/7 + BAP 16/11 + BAP 16/14 + BAP 17/12 + BAP 17/14 + BAP 38/2 + BAP 39/1 + BAP 39/8 + BAP 39/10 + BAP 39/15 + BAP 55/5 + BAP 56/1 + BAP 56/6 + BAP 56/8 + BAP 56/12 + BAP 56/16 + BAP 69/1 + BAP 69/16 + BAP 70/1 + BAP 70/7 + BAP 45/11 + BAP 46/2 + BAP 74/1 + BAP 90/5 + BAP 90/7 + BAP 90/8 + BAP 10/2 + BAP 11/3 + BAP 12/17 + BAP 9/8 + BAP 20/6 + BAP 20/8 + BAP 16/9 + BAP 17/2 + BAP 17/9 + BAP 38/3 + BAP 39/11 + BAP 55/3 + BAP 55/6 + BAP 55/12 + BAP 56/5 + BAP 69/10 + BAP 69/15 + BAP 70/12 + BAP 23/1 + BAP 80/1 + BAP 22/2 + BAP 32/5 + BAP 32/6 + BAP 35/2 + BAP 59/4 + BAP 66/2 + BAP 67/3 + BAP 73/5 + BAP 11/1 + BAP 13/17 + BAP 7/1 + BAP 20/2 + BAP 20/3 + BAP 20/11 + BAP 32/2 + BAP 17/5 + BAP 17/13 + BAP 17/16 + BAP 37/17 + BAP 38/4 + BAP 38/9 + BAP 45/6 + BAP 45/8 + BAP 45/13 + BAP 89/7 + BAP 89/10 + BAP 10/4 + BAP 20/4 + BAP 33/4 + BAP 16/13 + BAP 17/3 + BAP 17/10 + BAP 38/10 + BAP 39/5 + BAP 39/12 + BAP 54/4 + BAP 55/9 + BAP 69/2 + BAP 46/3 + BAP 74/3 + BAP 21/3 + BAP 21/5 + BAP 33/1 + BAP 51/3 + BAP 53/1 + BAP 73/8 + BAP 73/10 + BAP 87/1 + BAP 87/2 + BAP 88/6 + BAP 44/3 + BAP 44/7 + BAP 9/7 + BAP 20/9 + BAP 31/1 + BAP 32/1 + BAP 16/10 + BAP 17/11 + BAP 38/6 + BAP 38/7 + BAP 39/9 + BAP 39/14 + BAP 43/1 + BAP 55/4 + BAP 56/4 + BAP 57/1 + BAP 68/6 + BAP 69/4 + BAP 69/7 + BAP 69/13 + BAP 69/14 + BAP 70/3 + BAP 70/14 + BAP 21/6 + BAP 21/7 + BAP 22/9 + BAP 22/12 + BAP 33/2 + BAP 34/2 + BAP 35/1 + BAP 65/2 + BAP 65/4 + BAP 65/5 + BAP 72/1 + BAP 86/4 + BAP 88/5 + BAP 44/6 + BAP 22/4 + BAP 30/3 + BAP 31/5 + BAP 32/7 + BAP 32/9 + BAP 33/6 + BAP 34/3 + BAP 36/17 + BAP 51/1 + BAP 51/5 + BAP 52/1 + BAP 53/2 + BAP 58/3 + BAP 86/1 + BAP 86/2 + BAP 44/2 + BAP 44/8 + BAP 9/1 + BAP 9/3 + BAP 14/2 + BAP 14/3 + BAP 14/4 + BAP 14/10 + BAP 21/2 + BAP 22/7 + BAP 32/10 + BAP 34/4 + BAP 54/17 + BAP 59/2 + BAP 59/12 + BAP 65/1 + BAP 67/2 + BAP 73/2 + BAP 73/12 + BAP 87/3 + BAP 44/9 + BAP 45/9 + BAP 45/10 + BAP 45/12 + BAP 45/14 + BAP 60/1 + BAP 60/2 + BAP 89/8 + BAP 89/13 + BAP 90/3 + BAP 21/4 + BAP 21/8 + BAP 21/9 + BAP 21/10 + BAP 21/11 + BAP 21/12 + BAP 22/3 + BAP 22/6 + BAP 34/5 + BAP 51/4 + BAP 51/6 + BAP 52/2 + BAP 58/1 + BAP 59/1 + BAP 59/5 + BAP 59/8 + BAP 59/10 + BAP 65/3 + BAP 67/1 + BAP 73/1 + BAP 73/4 + BAP 73/9 + BAP 73/11 + BAP 88/1 + BAP 88/3 + BAP 44/10 + BAP 44/13 + BAP 44/15 + BAP 21/1 + BAP 22/5 + BAP 30/1 + BAP 30/2 + BAP 32/8 + BAP 33/3 + BAP 34/1 + BAP 52/4 + BAP 52/5 + BAP 59/3 + BAP 73/6 + BAP 87/4 + BAP 88/2 + BAP 88/4 + BAP 44/4 + BAP 44/11 + BAP 44/12 + BAP 44/14 + BAP 44/16 + BAP 17/8 + BAP 39/2 + BAP 55/10 + BAP 55/11 + BAP 55/14 + BAP 55/16 + BAP 56/7 + BAP 56/9 + BAP 56/11 + BAP 69/5 + BAP 69/8 + BAP 70/8 + BAP 70/10 + BAP 60/4 + BAP 38/13 + BAP 39/4 + BAP 55/2 + BAP 56/2 + BAP 56/3 + BAP 56/10 + BAP 56/14 + BAP 56/15 + BAP 69/9 + BAP 69/11 + BAP 70/6 + BAP 37/8 + BAP 37/13 + BAP 54/5 + BAP 54/11 + BAP 60/3 + BAP 1/1 + BAP 45/5 + BAP 10/1 + BAP 10/3 + BAP 31/7 + BAP 16/16 + BAP 17/4 + BAP 17/7 + BAP 17/15 + BAP 18/1 + BAP 19/1 + BAP 36/4 + BAP 37/4 + BAP 38/12 + BAP 38/14 + BAP 38/16 + BAP 39/7 + BAP 39/13 + BAP 55/1 + BAP 55/7 + BAP 55/15 + BAP 68/4 + BAP 68/17 + BAP 70/2 + BAP 70/4 + BAP 70/15 + BAP 71/1 + BAP 14/5 + BAP 15/12 + BAP 15/13 + BAP 16/5 + BAP 9/4 + BAP 12/6 + BAP 14/16 + BAP 15/3 + BAP 15/4 + BAP 15/5 + BAP 9/2 + BAP 12/4 + BAP 14/11 + BAP 15/1 + BAP 15/15 + BAP 16/8 + BAP 69/3 + BAP 70/5 + BAP 70/11 + BAP 70/13 + BAP 70/16 + BAP 36/12 + BAP 37/1 + BAP 37/9 + BAP 54/7 + BAP 54/13 + BAP 68/10 + BAP 68/15 + BAP 14/13 + BAP 15/2 + BAP 15/14 + BAP 14/7 + BAP 14/12 + BAP 16/6 + BAP 16/7 + BAP 1/4 + BAP 29/1 + BAP 72/2 + BAP 9a/1 + BAP 33a/7 + BAP 33a/8 + BAP 40/1 + BAP 41/11 + BAP 41/13 + BAP 41/16 + BAP 61/3 + BAP 1/2 + BAP 8/1 + BAP 29/2 + BAP 45/4 + BAP 45/3 + BAP 46/4 + BAP 89/3 + BAP 89/11 + BAP 22/1 + BAP 22/8 + BAP 22/10 + BAP 22/11 + BAP 31/3 + BAP 31/4 + BAP 33/5 + BAP 33/8 + BAP 51/2 + BAP 52/3 + BAP 59/6 + BAP 59/7 + BAP 59/9 + BAP 59/11 + BAP 66/1 + BAP 73/3 + BAP 73/7 + BAP 86/3 + BAP 88/7 + BAP 44/1 + BAP 44/5 + BAP 72/3 + BAP 20/1 + BAP 17/1 + BAP 38/1 + BAP 38/5 + BAP 38/8 + BAP 38/11 + BAP 38/15 + BAP 39/3 + BAP 39/6 + BAP 39/16 + BAP 42/1 + BAP 55/8 + BAP 55/13 + BAP 56/13 + BAP 69/6 + BAP 69/12 + BAP 70/9 + BAP 9/5 + BAP 13/4 + BAP 14/6 + BAP 15/10 + BAP 15/11 + BAP 1/6 + BAP 1/5 + BAP 8/2 + BAP 45/2 + BAP 58/2 + BAP 89/1 + BAP 89/5 + BAP 7/10 + BAP 14/1 + BAP 14/9 + BAP 14/15 + BAP 15/8 + BAP 15/9 + BAP 15/16 + BAP 16/1 + BAP 16/3 + BAP 6/2 + BAP 6/4 + BAP 7/6 + BAP 25/2 + BAP 28/2 + BAP 40/10 + BAP 40/13 + BAP 41/3 + BAP 36/15 + BAP 37/5 + BAP 37/10 + BAP 37/12 + BAP 54/2 + BAP 54/10 + BAP 54/16 + BAP 68/1 + BAP 68/12 + BAP 7/7 + BAP 9a/6 + BAP 23/4 + BAP 40/2 + BAP 40/12 + BAP 74/11 + BAP 76/1 + BAP 76/3 + BAP 76/4 + BAP 80/10 + BAP 80/16 + BAP 80/22 + BAP 82/3 + BAP 92/3 + BAP 92/7 + BAP 95/5 + BAP 12/14 + BAP 36/6 + BAP 36/9 + BAP 37/15 + BAP 54/14 + BAP 84/1 + BAP 1/3 + BAP 7/9 + BAP 7/4 + BAP 9a/2 + BAP 9a/7 + BAP 23/2 + BAP 23/7 + BAP 23/19 + BAP 33a/4 + BAP 33a/5 + BAP 40/5 + BAP 40/11 + BAP 41/2 + BAP 74/7 + BAP 7/5 + BAP 7/8 + BAP 9a/4 + BAP 23/10 + BAP 25/1 + BAP 33a/3 + BAP 40/7 + BAP 40/8 + BAP 40/16 + BAP 41/1 + BAP 41/4 + BAP 41/6 + BAP 41/7 + BAP 41/15 + BAP 46/5 + BAP 46/6 + BAP 46/15 + BAP 48/3 + BAP 9a/8 + BAP 23/5 + BAP 33a/1 + BAP 40/3 + BAP 40/6 + BAP 40/9 + BAP 40/14 + BAP 40/15 + BAP 41/14 + BAP 61/1 + BAP 61/2 + BAP 82/1 + BAP 90/2 + BAP 90/4 + BAP 92/6 + BAP 93/5 + BAP 93/6 + BAP 95/2 + BAP 95/3 + BAP 96/2 + BAP 12/10 + BAP 12/12 + BAP 13/5 + BAP 13/8 + BAP 13/9 + BAP 13/11 + BAP 13/16 + BAP 36/5 + BAP 61/5 + BAP 61/6 + BAP 74/23 + BAP 85/4 + BAP 90/17 + BAP 12/3 + BAP 27/4 + BAP 36/14 + BAP 37/7 + BAP 68/3 + BAP 23/6 + BAP 23/18 + BAP 33a/6 + BAP 41/9 + BAP 41/12 + BAP 64/2 + BAP 74/9 + BAP 79/2 + BAP 80/2 + BAP 80/14 + BAP 80/21 + BAP 85/2 + BAP 92/4 + BAP 93/2 + BAP 95/4 + BAP 5/1 + BAP 12/2 + BAP 12/7 + BAP 13/15 + BAP 36/10 + BAP 37/2 + BAP 37/6 + BAP 37/14 + BAP 54/1 + BAP 54/3 + BAP 54/15 + BAP 63/1 + BAP 68/5 + BAP 68/7 + BAP 68/14 + BAP 46/14 + BAP 48/1 + BAP 48/2 + BAP 74/6 + BAP 74/10 + BAP 80/15 + BAP 90/11 + BAP 90/16 + BAP 90/21 + BAP 92/1 + BAP 95/1 + BAP 95/6 + BAP 12/16 + BAP 13/10 + BAP 36/1 + BAP 36/7 + BAP 36/8 + BAP 36/13 + BAP 36/16 + BAP 37/3 + BAP 37/16 + BAP 50/1 + BAP 54/9 + BAP 54/12 + BAP 68/13 + BAP 68/16 + BAP 80/7 + BAP 80/13 + BAP 82/4 + BAP 92/2 + BAP 92/5 + BAP 93/1 + BAP 93/3 + BAP 93/4 + BAP 96/1 + BAP 12/5 + BAP 12/11 + BAP 13/2 + BAP 13/6 + BAP 36/2 + BAP 36/3 + BAP 36/11 + BAP 37/11 + BAP 54/6 + BAP 54/8 + BAP 68/2 + BAP 68/11 + BAP 3/1 + BAP 89/2 + BAP 89/4 + BAP 9/6 + BAP 14/8 + BAP 14/14 + BAP 15/6 + BAP 15/7 + BAP 16/2 + BAP 16/4 + BAP 9a/3 + BAP 9a/5 + BAP 25/3 + BAP 45/1 + BAP 74/8 + BAP 74/15 + BAP 74/22 + BAP 82/2 + BAP 90/6 + BAP 94/1 + BAP 12/1 + BAP 12/8 + BAP 12/13 + BAP 12/15 + BAP 13/3 + BAP 27/2 + BAP 28/4 + BAP 33a/2 + BAP 40/4 + BAP 41/5 + BAP 41/8 + BAP 41/10 + BAP 46/9 + BAP 61/4 + BAP 74/4 + BAP 76/2 + BAP 80/5 + BAP 90/20 + BAP 94/2 + BAP 5/3 + BAP 12/9 + BAP 13/1 + BAP 13/7 + BAP 13/12 + BAP 13/13 + BAP 13/14 + BAP 68/8 + BAP 68/9 + BAP 78/1 + + + + + CAS 5/2 + CAS 0/1 + CAS 3/1 + CAS 2/2 + + + + + CAP 7/2 + CAP 7/4 + CAP 7/9 + CAP 8/1 + CAP 8/2 + CAP 8/3 + CAP 8/4 + CAP 11/7 + CAP 14/1 + CAP 17/2 + CAP 20/5 + CAP 23/2 + CAP 6/1 + CAP 6/7 + CAP 7/6 + CAP 11/2 + CAP 11/12 + CAP 13/1 + CAP 21/1 + CAP 22/8 + CAP 22/9 + CAP 22/10 + CAP 28/6 + CAP 7/8 + CAP 11/3 + CAP 11/11 + CAP 12/1 + CAP 20/1 + CAP 22/5 + CAP 28/7 + CAP 28/9 + CAP 9/1 + CAP 10/1 + CAP 11/10 + CAP 16/1 + CAP 16/5 + CAP 22/3 + CAP 22/7 + CAP 6/5 + CAP 6/6 + CAP 11/1 + CAP 13/2 + CAP 20/2 + CAP 20/4 + CAP 22/1 + CAP 22/6 + CAP 26/6 + CAP 28/8 + CAP 2/2 + CAP 7/3 + CAP 11/4 + CAP 16/6 + CAP 17/5 + CAP 22/2 + CAP 22/12 + CAP 28/10 + CAP 29/1 + CAP 6a/2 + CAP 31/4 + CAP 32/2 + CAP 16/3 + CAP 18/2 + CAP 27/4 + CAP 31/1 + CAP 31/3 + CAP 32/1 + CAP 6/8 + CAP 7/5 + CAP 11/5 + CAP 16/4 + CAP 17/1 + CAP 20/3 + CAP 20/6 + CAP 20/9 + CAP 22/4 + CAP 26/7 + CAP 16/2 + CAP 19/2 + CAP 27/5 + CAP 19/4 + CAP 26/4 + CAP 26/5 + CAP 6/2 + CAP 7/1 + CAP 7/7 + CAP 10/2 + CAP 11/6 + CAP 11/8 + CAP 11/9 + CAP 21/2 + CAP 21/3 + CAP 22/11 + CAP 23/1 + CAP 24/1 + CAP 26/1 + CAP 28/11 + CAP 33/1 + CAP 33/2 + CAP 1/1 + CAP 3/1 + CAP 4/1 + CAP 6/4 + CAP 6a/1 + CAP 18/1 + CAP 19/1 + CAP 31/2 + CAP 6/3 + CAP 1/3 + CAP 1/2 + + + + + HAS 3/1 + HAS 3/5 + HAS 3/12 + HAS 4/5 + HAS 4/6 + HAS 5/2 + HAS 5/3 + HAS 3/14 + HAS 3/10 + HAS 4/1 + HAS 5/1 + HAS 5/4 + HAS 5/6 + HAS 3/1a + HAS 4/4 + HAS 2/2 + HAS 3/3 + HAS 3/4 + HAS 3/8 + HAS 3/9 + HAS 3/13 + HAS 4/7 + HAS 3/2 + HAS 3/7 + HAS 3/11 + HAS 4/3 + HAS 0/1 + HAS 3/6 + HAS 4/2 + HAS 5/5 + HAS 4/9 + HAS 4/8 + HAS 4/10 + + + + + HAP 13/7 + HAP 1/1 + HAP 13/6 + HAP 18/1 + HAP 19/2 + HAP 10/1 + HAP 17/1 + HAP 40/1 + HAP 43/1 + HAP 43/2 + HAP 51/1 + HAP 92/1 + HAP 12/4 + HAP 12/5 + HAP 13/2 + HAP 13/3 + HAP 14/3 + HAP 16/2 + HAP 2/2 + HAP 16/1 + HAP 24/1 + HAP 26/1 + HAP 13/1 + HAP 13/5 + HAP 24/2 + HAP 24/6 + HAP 43/4 + HAP 1/2 + HAP 1/4 + HAP 12/1 + HAP 12/2 + HAP 13/4 + HAP 14/2 + HAP 24/5 + HAP 43/3 + HAP 46/2 + HAP 50/1 + HAP 50/2 + HAP 90/1 + HAP 12/6 + HAP 12/7 + HAP 46/1 + HAP 12/3 + HAP 14/1 + HAP 19/1 + HAP 24/3 + HAP 24/4 + + + + + TMAP 1/4 + TMAP 1/1 + TMAP 1/8 + TMAP 13/1 + TMAP 17/1 + TMAP 18/2 + TMAP 53/1 + TMAP 55/6 + TMAP 56/14 + TMAP 70/1 + TMAP 75/4 + TMAP 75/5 + TMAP 77/1 + TMAP 92/1 + TMAP 93/1 + TMAP 96/10 + TMAP 14/2 + TMAP 14/4 + TMAP 14/5 + TMAP 15/1 + TMAP 15/3 + TMAP 15/6 + TMAP 17/5 + TMAP 50/1 + TMAP 56/8 + TMAP 56/13 + TMAP 75/2 + TMAP 76/5 + TMAP 90/1 + TMAP 95/4 + TMAP 96/1 + TMAP 96/7 + TMAP 96/15 + TMAP 98/2 + TMAP 99/2 + TMAP 117/2 + TMAP 1/2 + TMAP 1/6 + TMAP 14/3 + TMAP 15/5 + TMAP 16/3 + TMAP 16/6 + TMAP 17/2 + TMAP 17/3 + TMAP 52/1 + TMAP 55/4 + TMAP 56/9 + TMAP 72/1 + TMAP 74/2 + TMAP 76/3 + TMAP 76/4 + TMAP 77/2 + TMAP 95/7 + TMAP 96/5 + TMAP 96/9 + TMAP 115/7 + TMAP 115/8 + TMAP 119/1 + TMAP 121/2 + TMAP 151/3 + TMAP 10/1 + TMAP 12/2 + TMAP 14/7 + TMAP 15/2 + TMAP 17/7 + TMAP 19/1 + TMAP 55/7 + TMAP 56/16 + TMAP 57/2 + TMAP 72/2 + TMAP 75/3 + TMAP 95/1 + TMAP 96/2 + TMAP 96/8 + TMAP 96/11 + TMAP 96/16 + TMAP 115/4 + TMAP 116/3 + TMAP 116/9 + TMAP 116/10 + TMAP 118/1 + TMAP 131/1 + TMAP 1/5 + TMAP 1/7 + TMAP 16/5 + TMAP 19/2 + TMAP 19/3 + TMAP 52/2 + TMAP 55/1 + TMAP 55/8 + TMAP 56/1 + TMAP 56/5 + TMAP 56/12 + TMAP 57/1 + TMAP 96/6 + TMAP 97/2 + TMAP 112/2 + TMAP 114/2 + TMAP 96/13 + TMAP 98/1 + TMAP 114/1 + TMAP 115/3 + TMAP 116/8 + TMAP 116/11 + TMAP 3/1 + TMAP 14/1 + TMAP 16/1 + TMAP 16/4 + TMAP 17/6 + TMAP 54/3 + TMAP 55/2 + TMAP 55/3 + TMAP 55/5 + TMAP 56/7 + TMAP 56/10 + TMAP 57/3 + TMAP 74/6 + TMAP 76/1 + TMAP 76/6 + TMAP 78/1 + TMAP 78/2 + TMAP 79/2 + TMAP 95/5 + TMAP 95/6 + TMAP 96/14 + TMAP 98/3 + TMAP 100/1 + TMAP 110/1 + TMAP 113/1 + TMAP 114/4 + TMAP 115/5 + TMAP 116/4 + TMAP 116/7 + TMAP 117/1 + TMAP 118/3 + TMAP 119/2 + TMAP 153/4 + TMAP 14/6 + TMAP 15/4 + TMAP 16/2 + TMAP 17/4 + TMAP 54/1 + TMAP 56/2 + TMAP 56/4 + TMAP 56/6 + TMAP 56/15 + TMAP 74/1 + TMAP 74/3 + TMAP 76/2 + TMAP 78/3 + TMAP 79/1 + TMAP 92/2 + TMAP 94/1 + TMAP 94/5 + TMAP 96/3 + TMAP 96/12 + TMAP 97/1 + TMAP 99/1 + TMAP 114/3 + TMAP 115/1 + TMAP 116/1 + TMAP 116/5 + TMAP 116/14 + TMAP 116/15 + TMAP 151/4 + TMAP 151/5 + TMAP 156/1 + TMAP 151/1 + TMAP 153/1 + TMAP 154/1 + TMAP 2/2 + TMAP 12/1 + TMAP 12/3 + TMAP 18/1 + TMAP 54/2 + TMAP 56/3 + TMAP 56/11 + TMAP 73/1 + TMAP 74/4 + TMAP 74/5 + TMAP 75/1 + TMAP 75/6 + TMAP 94/2 + TMAP 94/3 + TMAP 94/4 + TMAP 95/2 + TMAP 95/3 + TMAP 95/8 + TMAP 96/4 + TMAP 100/2 + TMAP 112/1 + TMAP 116/12 + TMAP 116/16 + TMAP 120/1 + TMAP 153/2 + TMAP 115/2 + TMAP 115/6 + TMAP 116/2 + TMAP 116/6 + TMAP 116/13 + TMAP 118/2 + TMAP 121/1 + TMAP 150/1 + TMAP 151/6 + TMAP 153/5 + TMAP 153/6 + TMAP 151/2 + TMAP 152/1 + + + + + PBP 3/1 + PBP 5/1 + PBP 2/2 + PBP 6/1 + PBP 8/3 + PBP 8/8 + PBP 8/10 + PBP 1/1 + PBP 12/1 + PBP 14/5 + PBP 14/10 + PBP 7/3 + PBP 7/4 + PBP 8/6 + PBP 8/7 + PBP 14/6 + PBP 5/2 + PBP 6/2 + PBP 9/1 + PBP 13/1 + PBP 13/4 + PBP 14/4 + PBP 14/9 + PBP 11/2 + PBP 13/2 + PBP 6/6 + PBP 8/9 + PBP 12/2 + PBP 14/11 + PBP 6/4 + PBP 6/7 + PBP 6/8 + PBP 7/1 + PBP 7/2 + PBP 14/7 + PBP 14/12 + PBP 8/4 + PBP 8/12 + PBP 13/3 + PBP 1/2 + PBP 6/3 + PBP 6/5 + PBP 8/1 + PBP 8/2 + PBP 8/5 + PBP 8/11 + PBP 11/1 + PBP 14/1 + PBP 14/2 + PBP 14/3 + PBP 14/8 + + + + + MBT 20/2 + MBT 3/2 + MBT 20/1 + MBT 0/1 + MBT 10/1 + MBT 10/2 + MBT 3/1 + + + + + DFU 3/1 + DFU 10/1 + DFU 22/3 + DFU 30/1 + DFU 3/2 + DFU 0/1 + DFU 3/3 + DFU 20/1 + DFU 11/1 + DFU 21/1 + DFU 22/1 + DFU 11/2 + DFU 21/2 + + + + + GMAP 15/1 + GMAP 16/1 + GMAP 17/5 + GMAP 20/8 + GMAP 20/13 + GMAP 20/19 + GMAP 20/25 + GMAP 20/60 + GMAP 20/67 + GMAP 20/68 + GMAP 20/76 + GMAP 20/83 + GMAP 20/86 + GMAP 20/87 + GMAP 20/92 + GMAP 20/95 + GMAP 20/97 + GMAP 20/105 + GMAP 20/109 + GMAP 21/1 + GMAP 1/2 + GMAP 12/3 + GMAP 14/1 + GMAP 14/4 + GMAP 14/6 + GMAP 18/2 + GMAP 18/6 + GMAP 20/11 + GMAP 20/15 + GMAP 20/16 + GMAP 20/22 + GMAP 20/24 + GMAP 20/31 + GMAP 20/40 + GMAP 20/41 + GMAP 20/42 + GMAP 20/54 + GMAP 20/57 + GMAP 20/64 + GMAP 20/71 + GMAP 20/73 + GMAP 1/4 + GMAP 1/5 + GMAP 14/3 + GMAP 14/9 + GMAP 16/5 + GMAP 19/2 + GMAP 20/4 + GMAP 20/14 + GMAP 20/17 + GMAP 20/27 + GMAP 20/29 + GMAP 20/30 + GMAP 20/33 + GMAP 20/36 + GMAP 20/38 + GMAP 20/45 + GMAP 20/46 + GMAP 20/48 + GMAP 20/72 + GMAP 20/75 + GMAP 20/89 + GMAP 20/114 + GMAP 30/1 + GMAP 10/1 + GMAP 14/2 + GMAP 14/5 + GMAP 14/8 + GMAP 14/10 + GMAP 15/2 + GMAP 16/3 + GMAP 20/7 + GMAP 20/9 + GMAP 20/21 + GMAP 20/47 + GMAP 20/52 + GMAP 20/53 + GMAP 20/55 + GMAP 20/66 + GMAP 20/69 + GMAP 20/91 + GMAP 20/96 + GMAP 20/104 + GMAP 35/6 + GMAP 37/2 + GMAP 37/3 + GMAP 37/5 + GMAP 38/5 + GMAP 40/13 + GMAP 40/18 + GMAP 40/26 + GMAP 40/28 + GMAP 40/37 + GMAP 40/46 + GMAP 40/48 + GMAP 54/2 + GMAP 54/3 + GMAP 56/1 + GMAP 1/1 + GMAP 1/6 + GMAP 2/2 + GMAP 14/12 + GMAP 16/2 + GMAP 17/4 + GMAP 18/4 + GMAP 18/5 + GMAP 32/4 + GMAP 35/4 + GMAP 35/5 + GMAP 35/8 + GMAP 36/1 + GMAP 37/4 + GMAP 37/6 + GMAP 40/4 + GMAP 40/8 + GMAP 40/14 + GMAP 40/21 + GMAP 40/27 + GMAP 40/33 + GMAP 40/36 + GMAP 20/78 + GMAP 20/79 + GMAP 20/82 + GMAP 20/84 + GMAP 20/88 + GMAP 20/90 + GMAP 20/103 + GMAP 20/111 + GMAP 32/2 + GMAP 34/3 + GMAP 34/4 + GMAP 35/1 + GMAP 35/2 + GMAP 36/2 + GMAP 38/6 + GMAP 40/6 + GMAP 40/7 + GMAP 40/12 + GMAP 40/15 + GMAP 40/17 + GMAP 40/19 + GMAP 40/23 + GMAP 40/32 + GMAP 40/38 + GMAP 40/39 + GMAP 40/44 + GMAP 59/5 + GMAP 59/6 + GMAP 59/8 + GMAP 59/9 + GMAP 59/11 + GMAP 75/1 + GMAP 76/2 + GMAP 76/4 + GMAP 79/8 + GMAP 79/16 + GMAP 92/5 + GMAP 93/2 + GMAP 93/4 + GMAP 102/4 + GMAP 103/4 + GMAP 105/7 + GMAP 12/2 + GMAP 13/1 + GMAP 14/7 + GMAP 16/6 + GMAP 18/3 + GMAP 19/1 + GMAP 20/10 + GMAP 20/26 + GMAP 20/39 + GMAP 20/43 + GMAP 20/50 + GMAP 20/56 + GMAP 20/61 + GMAP 20/85 + GMAP 20/98 + GMAP 20/110 + GMAP 32/3 + GMAP 33/1 + GMAP 35/7 + GMAP 35/10 + GMAP 38/2 + GMAP 38/3 + GMAP 40/1 + GMAP 40/3 + GMAP 40/25 + GMAP 40/34 + GMAP 40/50 + GMAP 40/52 + GMAP 40/63 + GMAP 40/65 + GMAP 40/67 + GMAP 40/72 + GMAP 41/1 + GMAP 56/2 + GMAP 57/3 + GMAP 59/1 + GMAP 77/4 + GMAP 79/14 + GMAP 92/1 + GMAP 93/1 + GMAP 93/5 + GMAP 105/5 + GMAP 107/2 + GMAP 14/11 + GMAP 16/4 + GMAP 17/2 + GMAP 17/3 + GMAP 18/1 + GMAP 20/2 + GMAP 20/3 + GMAP 20/6 + GMAP 20/12 + GMAP 20/18 + GMAP 20/23 + GMAP 20/34 + GMAP 20/37 + GMAP 20/44 + GMAP 20/59 + GMAP 20/65 + GMAP 20/77 + GMAP 20/100 + GMAP 20/106 + GMAP 20/107 + GMAP 20/112 + GMAP 20/113 + GMAP 22/1 + GMAP 34/2 + GMAP 35/3 + GMAP 35/11 + GMAP 36/5 + GMAP 38/1 + GMAP 38/4 + GMAP 40/9 + GMAP 40/10 + GMAP 40/41 + GMAP 40/43 + GMAP 40/60 + GMAP 40/70 + GMAP 50/1 + GMAP 52/1 + GMAP 74/2 + GMAP 75/2 + GMAP 77/1 + GMAP 79/5 + GMAP 79/7 + GMAP 79/10 + GMAP 92/4 + GMAP 94/1 + GMAP 102/1 + GMAP 102/3 + GMAP 103/2 + GMAP 104/1 + GMAP 57/4 + GMAP 58/1 + GMAP 58/2 + GMAP 59/10 + GMAP 60/1 + GMAP 79/2 + GMAP 79/3 + GMAP 79/12 + GMAP 105/4 + GMAP 105/6 + GMAP 107/1 + GMAP 32/5 + GMAP 32/7 + GMAP 35/9 + GMAP 36/3 + GMAP 39/1 + GMAP 40/11 + GMAP 40/20 + GMAP 40/30 + GMAP 40/31 + GMAP 40/35 + GMAP 40/49 + GMAP 40/55 + GMAP 40/61 + GMAP 40/66 + GMAP 40/69 + GMAP 40/71 + GMAP 42/1 + GMAP 54/1 + GMAP 62/1 + GMAP 74/1 + GMAP 74/3 + GMAP 76/3 + GMAP 77/2 + GMAP 82/1 + GMAP 104/3 + GMAP 110/1 + GMAP 20/1 + GMAP 20/35 + GMAP 20/49 + GMAP 20/58 + GMAP 20/63 + GMAP 20/80 + GMAP 20/93 + GMAP 20/94 + GMAP 20/99 + GMAP 20/101 + GMAP 20/102 + GMAP 32/6 + GMAP 35/12 + GMAP 36/4 + GMAP 37/1 + GMAP 40/5 + GMAP 40/16 + GMAP 40/24 + GMAP 40/40 + GMAP 40/42 + GMAP 40/45 + GMAP 40/51 + GMAP 40/53 + GMAP 40/59 + GMAP 40/62 + GMAP 40/64 + GMAP 40/68 + GMAP 57/2 + GMAP 59/2 + GMAP 59/3 + GMAP 59/4 + GMAP 59/7 + GMAP 72/2 + GMAP 102/2 + GMAP 102/5 + GMAP 108/1 + GMAP 40/47 + GMAP 40/57 + GMAP 40/58 + GMAP 53/1 + GMAP 59/12 + GMAP 72/1 + GMAP 74/4 + GMAP 76/1 + GMAP 79/4 + GMAP 79/6 + GMAP 79/9 + GMAP 79/13 + GMAP 92/3 + GMAP 93/3 + GMAP 93/7 + GMAP 103/1 + GMAP 105/1 + GMAP 106/1 + GMAP 104/2 + GMAP 105/2 + GMAP 1/3 + GMAP 12/1 + GMAP 17/1 + GMAP 17/6 + GMAP 19/3 + GMAP 20/5 + GMAP 20/20 + GMAP 20/28 + GMAP 20/32 + GMAP 20/51 + GMAP 20/62 + GMAP 20/70 + GMAP 20/74 + GMAP 20/81 + GMAP 20/108 + GMAP 32/1 + GMAP 34/1 + GMAP 34/5 + GMAP 36/6 + GMAP 40/2 + GMAP 40/22 + GMAP 40/29 + GMAP 40/54 + GMAP 40/56 + GMAP 54/4 + GMAP 55/1 + GMAP 56/3 + GMAP 57/1 + GMAP 70/1 + GMAP 73/1 + GMAP 77/3 + GMAP 78/3 + GMAP 79/1 + GMAP 79/11 + GMAP 79/15 + GMAP 81/1 + GMAP 90/1 + GMAP 92/2 + GMAP 93/6 + GMAP 100/1 + GMAP 103/3 + GMAP 105/3 + + + + + CORE 11/3 + CORE 40/2 + CORE 2a/60 + CORE 11/1 + CORE 11/2 + CORE 12/1 + CORE 12/3 + CORE 2a/53 + CORE 31/2 + CORE 2a/51 + CORE 2a/52 + CORE 2a/54 + CORE 11/5 + CORE 41/2 + CORE 2/1 + CORE 2/60 + CORE 2a/50 + CORE 2b/60 + CORE 11/6 + CORE 20/4 + CORE 20a/1 + + + + + UHCI 0/60 + + + + \ No newline at end of file diff --git a/tests/bluetooth/qualification/ICS_Zephyr_Bluetooth_Host.pts b/tests/bluetooth/qualification/ICS_Zephyr_Bluetooth_Host.pts index 613ae9734e6b9..f6cac3f08c401 100644 --- a/tests/bluetooth/qualification/ICS_Zephyr_Bluetooth_Host.pts +++ b/tests/bluetooth/qualification/ICS_Zephyr_Bluetooth_Host.pts @@ -1,7 +1,7 @@ - + - 300252 - Zephyr_Bluetooth_Host + 302478 + Zephyr Host GAP @@ -21,6 +21,14 @@ 11b
3 + + 11c
+ 1 +
+ + 17a
+ 4 +
35
11 @@ -29,14 +37,26 @@ 14a
7
+ + 23
+ 7a +
27b
7
+ + 25
+ 13b +
37c
2
+ + 37
+ 3a +
30a
5 @@ -45,6 +65,10 @@ 30a
3
+ + 17
+ 5 +
8a
14a @@ -61,10 +85,22 @@ 30a
10
+ + 36
+ 6 +
30a
17
+ + 37
+ 6 +
+ + 27a
+ 5 +
27b
5 @@ -105,6 +141,14 @@ 25
12
+ + 35
+ 13b +
+ + 25
+ 13c +
17b
3 @@ -113,6 +157,14 @@ 30a
19
+ + 37
+ 7 +
+ + 37a
+ 5 +
30a
18 @@ -137,6 +189,10 @@ 37b
1
+ + 27a
+ 4 +
27b
1 @@ -145,6 +201,14 @@ 30a
4
+ + 35
+ 13c +
+ + 37a
+ 4 +
37b
9 @@ -165,6 +229,10 @@ 30a
13
+ + 17a
+ 5 +
37c
1 @@ -185,6 +253,10 @@ 11b
4
+ + 37a
+ 6 +
20A
18 @@ -201,6 +273,10 @@ 11b
2
+ + 8
+ 5 +
30a
6 @@ -233,6 +309,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 96
+ 2 +
90
2 @@ -6105,6 +6332,10 @@ 39
3
+ + 93
+ 5 +
17
2 @@ -6153,6 +6384,10 @@ 30
3
+ + 90
+ 16 +
36
6 @@ -6161,6 +6396,10 @@ 60
1
+ + 93
+ 6 +
21
2 @@ -6373,10 +6612,18 @@ 52
1
+ + 95
+ 3 +
11
3
+ + 90
+ 17 +
15
12 @@ -6405,6 +6652,10 @@ 56
6
+ + 95
+ 2 +
16
4 @@ -6637,6 +6888,10 @@ 22
9
+ + 88
+ 5 +
68
5 @@ -6653,6 +6908,10 @@ 37
17
+ + 92
+ 5 +
16
5 @@ -6817,6 +7076,10 @@ 41
6
+ + 93
+ 2 +
34
5 @@ -6857,6 +7120,10 @@ 53
2
+ + 80
+ 13 +
89
11 @@ -6957,6 +7224,10 @@ 38
14
+ + 93
+ 3 +
20
11 @@ -7029,6 +7300,10 @@ 80
6
+ + 80
+ 14 +
80
2 @@ -7045,6 +7320,10 @@ 17
10
+ + 80
+ 15 +
54
16 @@ -7229,6 +7508,14 @@ 34
2
+ + 95
+ 5 +
+ + 80
+ 16 +
6
2 @@ -7289,6 +7576,10 @@ 65
2
+ + 95
+ 1 +
46
5 @@ -7305,6 +7596,10 @@ 21
6
+ + 92
+ 4 +
88
6 @@ -7357,6 +7652,10 @@ 92
1
+ + 94
+ 1 +
25
1 @@ -7389,6 +7688,10 @@ 7
1
+ + 93
+ 1 +
52
2 @@ -7401,6 +7704,10 @@ 33a
1
+ + 96
+ 1 +
12
15 @@ -7501,6 +7808,10 @@ 69
7
+ + 95
+ 4 +
13
13 @@ -7589,6 +7900,10 @@ 14
12
+ + 95
+ 6 +
33
7 @@ -7685,6 +8000,10 @@ 73
10
+ + 94
+ 2 +
87
4 @@ -7805,6 +8124,10 @@ 68
16
+ + 82
+ 4 +
31
7 @@ -8913,6 +9236,10 @@ 13
1
+ + 13
+ 7 +
18
1 @@ -11717,12 +12044,16 @@
2
- 54 + 60
20a
1
+ + 2b
+ 60 +
11
2 @@ -11759,6 +12090,10 @@ 20
4
+ + 2a
+ 60 +
2a
50 @@ -11771,10 +12106,6 @@ 2a
52
- - 2b
- 54 -
11
3 @@ -11784,8 +12115,8 @@ UHCI 0
- 54 + 60
-
+ \ No newline at end of file From ce02d0c0fcace84f5a06ca52fa8e7b0ba1e536e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 4 Nov 2024 12:24:26 +0100 Subject: [PATCH 2151/4482] doc: releases: Complete documentation release notes for 4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This completes the existing "Documentation" section of the release notes for 4.0 by documenting the various changes/improvements implemented during the last development cycle. Signed-off-by: Benjamin Cabé --- doc/releases/release-notes-4.0.rst | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index bd08679b1b3c4..4c85812fc5751 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -285,9 +285,24 @@ Build system and Infrastructure Documentation ************* - * Added two new build commands, ``make html-live`` and ``make html-live-fast``, that automatically locally - host the generated documentation. They also automatically rebuild and rehost the documentation when changes - to the input ``.rst`` files are detected on the filesystem. +* Added a new :ref:`interactive board catalog ` enabling users to search boards by criteria + such as name, architecture, vendor, or SoC. +* Added a new :zephyr:code-sample-category:`interactive code sample catalog ` for quickly + finding code samples based on name and description. +* Added :rst:dir:`zephyr:board` directive and :rst:role:`zephyr:board` role to mark Sphinx pages as + board documentation and reference them from other pages. Most existing board documentation pages + have been updated to use this directive, with full migration planned for the next release. +* Added :rst:dir:`zephyr:code-sample-category` directive to describe and group code samples in the + documentation. +* Added a link to the source code of the driver matching a binding's compatible string (when one can + be found in the Zephyr tree) to the :ref:`dt-bindings` documentation. +* Added a button to all code sample README pages allowing to directly browse the sample's source + code on GitHub. +* Moved Zephyr C API documentation out of main documentation. API references now feature a rich + tooltip and link to the dedicated Doxygen site. +* Added two new build commands, ``make html-live`` and ``make html-live-fast``, that automatically + locally host the generated documentation. They also automatically rebuild and rehost the + documentation when changes to the input ``.rst`` files are detected on the filesystem. Drivers and Sensors ******************* From 8fc161f8207a7df52ad707edbb644a85fc28ac8e Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Mon, 4 Nov 2024 13:49:55 +0100 Subject: [PATCH 2152/4482] west: runners: nrf: Check for missing UICR On nRF54H and nRF92, booting certain cores requires programming a UICR, which is normally generated using nrf-regtool. This should be considered an optional dependency, because we do not wish to force non-Nordic users to install it just to work with Zephyr, or just for build-only tests. When nrf-regtool is not installed, a CMake warning will be displayed, but people ignore warnings all the time. As the last line of defense, check for missing UICR in the nrfutil flash runner, to prevent our users from unintentionally programming unbootable firmware. Show a fatal error specifically if CONFIG_NRF_REGTOOL_GENERATE_UICR=y, yet no UICR exists. Signed-off-by: Grzegorz Swiderski --- scripts/west_commands/runners/nrf_common.py | 38 ++++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index cf723ba7bd3e6..81aaaf73bf257 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -35,9 +35,17 @@ 'NRFDL_DEVICE_CORE_APPLICATION': (0x00FF8000, 0x00FF8800), 'NRFDL_DEVICE_CORE_NETWORK': (0x01FF8000, 0x01FF8800), }, + 'NRF54H_FAMILY': { + 'NRFDL_DEVICE_CORE_APPLICATION': (0x0FFF8000, 0x0FFF8800), + 'NRFDL_DEVICE_CORE_NETWORK': (0x0FFFA000, 0x0FFFA800), + }, 'NRF91_FAMILY': { 'NRFDL_DEVICE_CORE_APPLICATION': (0x00FF8000, 0x00FF8800), - } + }, + 'NRF92_FAMILY': { + 'NRFDL_DEVICE_CORE_APPLICATION': (0x0FFF8000, 0x0FFF8800), + 'NRFDL_DEVICE_CORE_NETWORK': (0x0FFFA000, 0x0FFFA800), + }, } # Relative to the root of the hal_nordic module @@ -307,6 +315,19 @@ def program_hex(self): self.build_conf.getboolean('CONFIG_SOC_NRF54H20_ENGB_CPURAD') or self.build_conf.getboolean('CONFIG_SOC_NRF9280_CPURAD') ) + generated_uicr = self.build_conf.getboolean('CONFIG_NRF_REGTOOL_GENERATE_UICR') + + if cpuapp: + core = 'NRFDL_DEVICE_CORE_APPLICATION' + elif cpurad: + core = 'NRFDL_DEVICE_CORE_NETWORK' + + if generated_uicr and not self.hex_get_uicrs().get(core): + raise RuntimeError( + f"Expected a UICR to be contained in: {self.hex_}\n" + "Please ensure that the correct version of nrf-regtool is " + "installed, then run 'west build --cmake' to try again." + ) if self.erase: self.exec_op('erase', core='NRFDL_DEVICE_CORE_APPLICATION') @@ -335,18 +356,9 @@ def program_hex(self): mpi_hex_dir / 'suit_installed_envelopes_application_merged.hex') self.op_program(app_root_envelope_hex_file, 'ERASE_NONE', None, defer=True, core='NRFDL_DEVICE_CORE_APPLICATION') - if cpuapp: - if not self.erase and self.build_conf.getboolean('CONFIG_NRF_REGTOOL_GENERATE_UICR'): - self.exec_op('erase', core='NRFDL_DEVICE_CORE_APPLICATION', - option={'chip_erase_mode': 'ERASE_UICR', - 'qspi_erase_mode': 'ERASE_NONE'}) - core = 'NRFDL_DEVICE_CORE_APPLICATION' - elif cpurad: - if not self.erase and self.build_conf.getboolean('CONFIG_NRF_REGTOOL_GENERATE_UICR'): - self.exec_op('erase', core='NRFDL_DEVICE_CORE_NETWORK', - option={'chip_erase_mode': 'ERASE_UICR', - 'qspi_erase_mode': 'ERASE_NONE'}) - core = 'NRFDL_DEVICE_CORE_NETWORK' + if not self.erase and generated_uicr: + self.exec_op('erase', core=core, option={'chip_erase_mode': 'ERASE_UICR', + 'qspi_erase_mode': 'ERASE_NONE'}) else: if self.erase: erase_arg = 'ERASE_ALL' From e0d1e5973d8bf6350f9bf39fa2cf408c7e7a5b07 Mon Sep 17 00:00:00 2001 From: Sumit Batra Date: Wed, 6 Nov 2024 15:57:52 +0530 Subject: [PATCH 2153/4482] mdio: fmurt6: dts: Enable the parent node of mdio mdio_enet_nxp driver accesses the registers of its parent node Ethernet MAC This commit enables this node in mimxrt1062_fmurt6 board's device tree. This also fixes Issue #80881 Signed-off-by: Sumit Batra --- boards/nxp/mimxrt1062_fmurt6/mimxrt1062_fmurt6.dts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/boards/nxp/mimxrt1062_fmurt6/mimxrt1062_fmurt6.dts b/boards/nxp/mimxrt1062_fmurt6/mimxrt1062_fmurt6.dts index 9d124b7b2c306..44a00e72d9a36 100644 --- a/boards/nxp/mimxrt1062_fmurt6/mimxrt1062_fmurt6.dts +++ b/boards/nxp/mimxrt1062_fmurt6/mimxrt1062_fmurt6.dts @@ -385,12 +385,17 @@ nxp,prescaler = <64>; }; +&enet2 { + status = "okay"; +}; + &enet2_mac { pinctrl-0 = <&pinmux_enet>; pinctrl-names = "default"; zephyr,random-mac-address; phy-connection-type = "rmii"; phy-handle = <&phy>; + status = "okay"; }; &enet2_mdio { From 6fb8157ee457b2beebf9c931121990e0b86c0bda Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Wed, 6 Nov 2024 11:11:09 -0800 Subject: [PATCH 2154/4482] doc: release/4.0: add bits about demand paging This adds some bits about demand paging in release note for 4.0. Signed-off-by: Daniel Leung --- doc/releases/release-notes-4.0.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 4c85812fc5751..c65898468e2a3 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -79,6 +79,8 @@ Architectures * Added initial support for :c:func:`arch_stack_walk` that supports unwinding via esf only + * Added support for demand paging. + * RISC-V * The stack traces upon fatal exception now prints the address of stack pointer (sp) or frame @@ -541,6 +543,8 @@ Libraries / Subsystems * Demand Paging + * Added LRU (Least Recently Used) eviction algorithm. + * Formatted output * Management From d4b1302387b763badbee80f8e94773cb1bda6d42 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Wed, 6 Nov 2024 10:59:32 -0800 Subject: [PATCH 2155/4482] doc: release/4.0: add bits about serial This adds some bits about serial/UART in the migration and release notes for 4.0. Signed-off-by: Daniel Leung --- doc/releases/migration-guide-4.0.rst | 2 ++ doc/releases/release-notes-4.0.rst | 3 +++ 2 files changed, 5 insertions(+) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 82c2779a84279..20e10f9a77bc0 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -297,6 +297,8 @@ Serial can accept data bytes, instead of ``ret == 1``. The function now returns a lower bound on the number of bytes that can be provided to :c:func:`uart_fifo_fill` without truncation. + * LiteX: ``CONFIG_UART_LITEUART`` has been renamed to :kconfig:option:`CONFIG_UART_LITEX`. + Regulator ========= diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index c65898468e2a3..16c941de34ede 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -449,6 +449,9 @@ Drivers and Sensors * LiteX: Renamed the ``compatible`` from ``litex,uart0`` to :dtcompatible:`litex,uart`. * Nordic: Removed ``CONFIG_UART_n_GPIO_MANAGEMENT`` Kconfig options (where n is an instance index) which had no use after pinctrl driver was introduced. + * NS16550: Added support for Synopsys Designware 8250 UART. + * Renesas: Added support for SCI UART. + * Sensry: Added UART support for Ganymed SY1XX. * SPI From 467f31190e6e111edf7ee204ecd3de27c3ff9c9a Mon Sep 17 00:00:00 2001 From: Josuah Demangeon Date: Tue, 5 Nov 2024 16:01:52 +0000 Subject: [PATCH 2156/4482] doc: release: 4.0: Add video driver and video API updates Add entries for video driver contributed or enhanced. Add entries for video APIs introduced or modified. Signed-off-by: Josuah Demangeon --- doc/releases/release-notes-4.0.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 16c941de34ede..8e3d243e6d67f 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -470,6 +470,18 @@ Drivers and Sensors * Video + * Introduced API to control frame rate + * Introduced API for partial frames transfer with the video buffer field ``line_offset`` + * Introduced API for :ref:`multi-heap` video buffer allocation with + :kconfig:option:`CONFIG_VIDEO_BUFFER_USE_SHARED_MULTI_HEAP` + * Introduced bindings for common video link properties in ``video-interfaces.yaml`` + * Introduced missing :kconfig:option:`CONFIG_VIDEO_LOG_LEVEL` + * Added support for GalaxyCore GC2145 image sensor (:dtcompatible:`gc,gc2145`) + * Added support for ESP32-S3 LCD-CAM interface (:dtcompatible:`espressif,esp32-lcd-cam`) + * Added support for NXP MCUX SMARTDMA interface (:dtcompatible:`nxp,smartdma`) + * Added support for more OmniVision OV2640 controls (:dtcompatible:`ovti,ov2640`) + * Added support for more OmniVision OV5640 controls (:dtcompatible:`ovti,ov5640`) + * Watchdog * Wi-Fi From 41b3cd77df371604609b3baf76cced88b648937e Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Wed, 6 Nov 2024 09:07:11 -0300 Subject: [PATCH 2157/4482] docs: boards: xiao_esp32s3: migrate board name to new directive Update board name to meet zephyr:board model. Signed-off-by: Sylvio Alves --- boards/seeed/xiao_esp32s3/doc/index.rst | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/boards/seeed/xiao_esp32s3/doc/index.rst b/boards/seeed/xiao_esp32s3/doc/index.rst index 6ce906d3bde59..7945ec352f0f3 100644 --- a/boards/seeed/xiao_esp32s3/doc/index.rst +++ b/boards/seeed/xiao_esp32s3/doc/index.rst @@ -1,7 +1,4 @@ -.. _xiao_esp32s3: - -XIAO ESP32S3/XIAO ESP32S3 Sense -############################### +.. zephyr:board:: xiao_esp32s3 Overview ******** From 07fd5600a9e0cd104259a56cfa304d7f2dd27080 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Tue, 5 Nov 2024 09:45:26 -0300 Subject: [PATCH 2158/4482] kconfig: fix typo and help description. Fix typo and re-phrase help description to improve it. Signed-off-by: Sylvio Alves --- soc/espressif/common/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/soc/espressif/common/Kconfig b/soc/espressif/common/Kconfig index ccb37c6fff78e..ffeac4ab04535 100644 --- a/soc/espressif/common/Kconfig +++ b/soc/espressif/common/Kconfig @@ -20,7 +20,7 @@ config ESP_SIMPLE_BOOT default y if !BOOTLOADER_MCUBOOT && !MCUBOOT help The Simple Boot is a booting method that doesn't need a 2nd stage bootloader. - Output is a single image that should be flashed at a offset defined by used SOC. + Output is a single image that should be flashed at an offset defined by used SOC. Please note that this method brings the system up with all memories set-up, but all other features, such as secure boot OTA or slots management are not available. @@ -28,8 +28,8 @@ config ESP_HEAP_RUNTIME bool default y help - Enabling this will allocate SRAM area starting by a last linked data at symbolic `_end`, - ending by a last memory location that can be safely accesed (depending on a boot mode). + Enabling this will allocate SRAM area starting from the last linked data at the symbolic `_end`, + ending at the last memory location that can be safely accessed (depending on a boot mode). This is a memory pool used in runtime to create a new heap memory. config ESP32_TIMER_TASK_STACK_SIZE From 85f9940e144f9f29559b1a36320ff1078cc0cd11 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Tue, 5 Nov 2024 09:41:32 -0300 Subject: [PATCH 2159/4482] doc: release: 4.0: Add Espressif changes. Adds notes on Espressif changes to this release. Signed-off-by: Sylvio Alves --- doc/releases/release-notes-4.0.rst | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 8e3d243e6d67f..c144a0ae069b4 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -160,10 +160,13 @@ Boards & SoC Support * Added support for these SoC series: + * Added ESP32-C2 and ESP8684 SoC support. + * Made these changes in other SoC series: * NXP S32Z270: Added support for the new silicon cut version 2.0. Note that the previous versions (1.0 and 1.1) are no longer supported. + * Added ESP32 WROVER-E-N16R4 variant. * Added support for these boards: @@ -211,6 +214,7 @@ Boards & SoC Support * :ref:`Renesas RA6E2 Fast Prototyping Board ` (``fpb_ra6e2``) * :ref:`Renesas RA8T1 Evaluation Kit ` (``mck_ra8t1``) * :zephyr:board:`Renode Cortex-R8 Virtual ` (``cortex_r8_virtual``) + * :zephyr:board:`Seeed XIAO ESP32-S3 Sense Variant `: ``xiao_esp32s3``. * :ref:`sensry.io Ganymed Break-Out-Board (BOB) ` (``ganymed_bob``) * :zephyr:board:`SiLabs SiM3U1xx 32-bit MCU USB Development Kit ` (``sim3u1xx_dk``) * :ref:`SparkFun Thing Plus Matter ` (``sparkfun_thing_plus_matter_mgm240p``) @@ -311,6 +315,9 @@ Drivers and Sensors * ADC + * Added proper ADC2 calibration entries in ESP32. + * Fixed calibration scheme in ESP32-S3. + * Battery * CAN @@ -353,6 +360,7 @@ Drivers and Sensors * Fixed SPI NOR driver issue where wp, hold and reset pins were incorrectly initialized from device tee when SFDP at run-time has been enabled (:github:`80383`) + * Updated all Espressif's SoC driver initialization to allow new chipsets and octal flash support. * Added :kconfig:option:`CONFIG_SPI_NOR_ACTIVE_DWELL_MS`, to the SPI NOR driver configuration, which allows setting the time during which the driver will wait before triggering Deep Power Down (DPD). @@ -381,10 +389,18 @@ Drivers and Sensors * I2S + * Added ESP32-S3 and ESP32-C3 driver support. + * I3C * Input + * Fixed broken ESP32 input touch sensor driver. + +* Interrupt + + * Updated ESP32 family interrupt allocator with proper IRQ flags and priorities. + * LED * lp5562: added ``enable-gpios`` property to describe the EN/VCC GPIO of the lp5562. @@ -403,6 +419,8 @@ Drivers and Sensors * Mailbox + * Added driver support for ESP32 and ESP32-S3 SoCs. + * MDIO * MFD @@ -432,6 +450,8 @@ Drivers and Sensors * SDHC + * Added ESP32-S3 driver support. + * Sensors * The existing driver for the Microchip MCP9808 temperature sensor transformed and renamed @@ -486,6 +506,10 @@ Drivers and Sensors * Wi-Fi + * Added ESP32-C2 Wi-Fi support. + * Added ESP32 driver APSTA support. + * Updated ESP32 Wi-Fi driver to reflect actual negotiated PHY mode. + Networking ********** @@ -605,6 +629,8 @@ Libraries / Subsystems * Power management + * Added initial ESP32-C6 power management interface to allow light and deep-sleep features. + * Crypto * Mbed TLS was updated to version 3.6.2 (from 3.6.0). The release notes can be found at: @@ -721,6 +747,9 @@ HALs * Espressif + * Synced HAL to version v5.1.4 to update SoCs low level files, RF libraries and + overall driver support. + MCUboot ******* From 4300a4c33b0f6becc43d1e3a130ebee19c411c6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Tue, 5 Nov 2024 11:48:01 +0100 Subject: [PATCH 2160/4482] doc: boards: esp32: fix XIAO-ESP32S3 build instructions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix wrong board target in build command snippets Signed-off-by: Benjamin Cabé --- boards/seeed/xiao_esp32s3/doc/index.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/boards/seeed/xiao_esp32s3/doc/index.rst b/boards/seeed/xiao_esp32s3/doc/index.rst index 7945ec352f0f3..afc3a7e231c74 100644 --- a/boards/seeed/xiao_esp32s3/doc/index.rst +++ b/boards/seeed/xiao_esp32s3/doc/index.rst @@ -196,14 +196,14 @@ Build and flash applications as usual (see :ref:`build_an_application` and .. zephyr-app-commands:: :zephyr-app: samples/hello_world - :board: xiao_esp32s3/esp32/procpu + :board: xiao_esp32s3/esp32s3/procpu :goals: build .. group-tab:: XIAO ESP32S3 Sense .. zephyr-app-commands:: :zephyr-app: samples/hello_world - :board: xiao_esp32s3/esp32/procpu/sense + :board: xiao_esp32s3/esp32s3/procpu/sense :goals: build The usual ``flash`` target will work with the ``xiao_esp32s3`` board @@ -216,14 +216,14 @@ application. .. zephyr-app-commands:: :zephyr-app: samples/hello_world - :board: xiao_esp32s3/esp32/procpu + :board: xiao_esp32s3/esp32s3/procpu :goals: flash .. group-tab:: XIAO ESP32S3 Sense .. zephyr-app-commands:: :zephyr-app: samples/hello_world - :board: xiao_esp32s3/esp32/procpu/sense + :board: xiao_esp32s3/esp32s3/procpu/sense :goals: flash Open the serial monitor using the following command: @@ -257,14 +257,14 @@ Here is an example for building the :zephyr:code-sample:`hello_world` applicatio .. zephyr-app-commands:: :zephyr-app: samples/hello_world - :board: xiao_esp32s3/esp32/procpu + :board: xiao_esp32s3/esp32s3/procpu :goals: debug .. group-tab:: XIAO ESP32S3 Sense .. zephyr-app-commands:: :zephyr-app: samples/hello_world - :board: xiao_esp32s3/esp32/procpu/sense + :board: xiao_esp32s3/esp32s3/procpu/sense :goals: debug You can debug an application in the usual way. Here is an example for the :zephyr:code-sample:`hello_world` application. @@ -275,14 +275,14 @@ You can debug an application in the usual way. Here is an example for the :zephy .. zephyr-app-commands:: :zephyr-app: samples/hello_world - :board: xiao_esp32s3/esp32/procpu + :board: xiao_esp32s3/esp32s3/procpu :goals: debug .. group-tab:: XIAO ESP32S3 Sense .. zephyr-app-commands:: :zephyr-app: samples/hello_world - :board: xiao_esp32s3/esp32/procpu/sense + :board: xiao_esp32s3/esp32s3/procpu/sense :goals: debug References From f556826c831edeee835ea1fc1e42e2ff085f392a Mon Sep 17 00:00:00 2001 From: Riadh Ghaddab Date: Tue, 5 Nov 2024 12:18:13 +0100 Subject: [PATCH 2161/4482] doc: release: 4.0: add notes on ZMS Add notes about the new storage system ZMS Signed-off-by: Riadh Ghaddab --- doc/releases/release-notes-4.0.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index c144a0ae069b4..9c21cb8b2285e 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -717,6 +717,10 @@ Libraries / Subsystems * Shell: Fixed an issue were a failed file system mount attempt using the shell would make it impossible to ever succeed in mounting that file system again until the device was reset (:github:`80024`). + * :ref:`ZMS`: Introduction of a new storage system that is designed to work with all types of + non-volatile storage technologies. It supports classical on-chip NOR flash as well as + new technologies like RRAM and MRAM that do not require a separate erase operation at all. + * Task Watchdog * POSIX API From 5155c0e8200d08cccd03ebe234b966e03c9c1d2b Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Wed, 6 Nov 2024 01:35:25 +0000 Subject: [PATCH 2162/4482] doc: release: add a step to verify that the tag is signed Add an extra "git show" step to the release process to verify that the key has been indeed signed. Signed-off-by: Fabio Baltieri --- doc/project/release_process.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/doc/project/release_process.rst b/doc/project/release_process.rst index 82fd5e303490e..9c3b39fa38c32 100644 --- a/doc/project/release_process.rst +++ b/doc/project/release_process.rst @@ -453,10 +453,20 @@ steps: #. Post a PR with the updated :zephyr_file:`VERSION` file using ``release: Zephyr 1.11.0-rc1`` as the commit subject. Merge the PR after successful CI. + #. Tag and push the version, using an annotated tag:: $ git pull $ git tag -s -m "Zephyr 1.11.0-rc1" v1.11.0-rc1 + + #. Verify that the tag has been signed correctly, ``git show`` for the + tag must contain a signature (look for the ``BEGIN PGP SIGNATURE`` + or ``BEGIN SSH SIGNATURE`` marker in the output):: + + $ git show v1.11.0-rc1 + + #. Push the tag:: + $ git push git@github.com:zephyrproject-rtos/zephyr.git v1.11.0-rc1 #. Send an email to the mailing lists (``announce`` and ``devel``) @@ -486,6 +496,15 @@ steps: $ git pull $ git tag -s -m "Zephyr 1.11.0" v1.11.0 + + #. Verify that the tag has been signed correctly, ``git show`` for the + tag must contain a signature (look for the ``BEGIN PGP SIGNATURE`` + or ``BEGIN SSH SIGNATURE`` marker in the output):: + + $ git show v1.11.0 + + #. Push the tag:: + $ git push git@github.com:zephyrproject-rtos/zephyr.git v1.11.0 #. Find the new ``v1.11.0`` tag at the top of the releases page and From c3466b14d09b1e51b6ca472f3b3654e40cba12d8 Mon Sep 17 00:00:00 2001 From: Gaofeng Zhang Date: Tue, 22 Oct 2024 10:31:53 +0800 Subject: [PATCH 2163/4482] manifest: Update hal_nxp to fix hang when board reset Update hal_nxp to fix hang when board reset Signed-off-by: Gaofeng Zhang --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index f6c0a3b09f380..b61f2b97afb79 100644 --- a/west.yml +++ b/west.yml @@ -198,7 +198,7 @@ manifest: groups: - hal - name: hal_nxp - revision: ca9c81a06fbd3db10faf708194443511f1eadacb + revision: 6e7d5cf2e6463e1b6c967d85ce0032deaa15fb59 path: modules/hal/nxp groups: - hal From e254a7f3c8519082f78cf99f0803ddb15bd992da Mon Sep 17 00:00:00 2001 From: Henrik Skreslet Date: Thu, 31 Oct 2024 08:46:00 +0100 Subject: [PATCH 2164/4482] modem: cmux: added validation of cmux frame length Validates cmux frame length and drops it if its larger than the receive buffer Signed-off-by: Henrik Skreslet --- subsys/modem/modem_cmux.c | 8 ++++ tests/subsys/modem/modem_cmux/src/main.c | 50 ++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/subsys/modem/modem_cmux.c b/subsys/modem/modem_cmux.c index 4a755284bff02..7a78b06a8f346 100644 --- a/subsys/modem/modem_cmux.c +++ b/subsys/modem/modem_cmux.c @@ -816,6 +816,14 @@ static void modem_cmux_process_received_byte(struct modem_cmux *cmux, uint8_t by /* Get last 8 bits of data length */ cmux->frame.data_len |= ((uint16_t)byte) << 7; + if (cmux->frame.data_len > cmux->receive_buf_size) { + LOG_ERR("Indicated frame data length %u exceeds receive buffer size %u", + cmux->frame.data_len, cmux->receive_buf_size); + + cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_DROP; + break; + } + /* Await data */ cmux->receive_state = MODEM_CMUX_RECEIVE_STATE_DATA; break; diff --git a/tests/subsys/modem/modem_cmux/src/main.c b/tests/subsys/modem/modem_cmux/src/main.c index 28d772614b185..579dbb8635ed0 100644 --- a/tests/subsys/modem/modem_cmux/src/main.c +++ b/tests/subsys/modem/modem_cmux/src/main.c @@ -148,6 +148,14 @@ static uint8_t cmux_frame_dlci2_at_newline[] = {0xF9, 0x0B, 0xEF, 0x05, 0x0D, 0x static uint8_t cmux_frame_data_dlci2_at_newline[] = {0x0D, 0x0A}; +/*************************************************************************************************/ +/* DLCI2 AT CMUX error frames */ +/*************************************************************************************************/ +static uint8_t cmux_frame_dlci2_at_cgdcont_invalid_length[] = { + 0xF9, 0x0B, 0xEF, 0xFE, 0x41, 0x54, 0x2B, 0x43, 0x47, 0x44, 0x43, 0x4F, 0x4E, + 0x54, 0x3D, 0x31, 0x2C, 0x22, 0x49, 0x50, 0x22, 0x2C, 0x22, 0x74, 0x72, 0x61, + 0x63, 0x6B, 0x75, 0x6E, 0x69, 0x74, 0x2E, 0x6D, 0x32, 0x6D, 0x22, 0x23, 0xF9}; + /*************************************************************************************************/ /* DLCI1 AT CMUX frames */ /*************************************************************************************************/ @@ -814,4 +822,46 @@ ZTEST(modem_cmux, test_modem_cmux_prevent_work_while_released) zassert_ok(modem_pipe_open(dlci2_pipe, K_SECONDS(10))); } +ZTEST(modem_cmux, test_modem_drop_frames_with_invalid_length) +{ + int ret; + uint32_t events; + + modem_backend_mock_put(&bus_mock, cmux_frame_dlci2_at_cgdcont_invalid_length, + sizeof(cmux_frame_dlci2_at_cgdcont_invalid_length)); + + k_msleep(100); + + events = k_event_test(&cmux_event, EVENT_CMUX_DLCI2_RECEIVE_READY); + + zassert_false(events & EVENT_CMUX_DLCI2_RECEIVE_READY, + "Receive event should not have been received for DLCI2 pipe"); + + modem_backend_mock_put(&bus_mock, cmux_frame_dlci2_at_cgdcont, + sizeof(cmux_frame_dlci2_at_cgdcont)); + + modem_backend_mock_put(&bus_mock, cmux_frame_dlci2_at_newline, + sizeof(cmux_frame_dlci2_at_newline)); + + k_msleep(100); + + events = k_event_test(&cmux_event, EVENT_CMUX_DLCI2_RECEIVE_READY); + zassert_equal(events, EVENT_CMUX_DLCI2_RECEIVE_READY, + "Receive ready event not received for DLCI2 pipe"); + + ret = modem_pipe_receive(dlci2_pipe, buffer2, sizeof(buffer2)); + zassert_true(ret == (sizeof(cmux_frame_data_dlci2_at_cgdcont) + + sizeof(cmux_frame_data_dlci2_at_newline)), + "Incorrect number of bytes received"); + + zassert_true(memcmp(buffer2, cmux_frame_data_dlci2_at_cgdcont, + sizeof(cmux_frame_data_dlci2_at_cgdcont)) == 0, + "Incorrect data received"); + + zassert_true(memcmp(&buffer2[sizeof(cmux_frame_data_dlci2_at_cgdcont)], + cmux_frame_data_dlci2_at_newline, + sizeof(cmux_frame_data_dlci2_at_newline)) == 0, + "Incorrect data received"); +} + ZTEST_SUITE(modem_cmux, NULL, test_modem_cmux_setup, test_modem_cmux_before, NULL, NULL); From 5a03d3f51ca4b97e399c2bd06b5daed7ae169ea6 Mon Sep 17 00:00:00 2001 From: Andries Kruithof Date: Thu, 31 Oct 2024 13:38:34 +0100 Subject: [PATCH 2165/4482] Bluetooth: Audio: Fix description for broadcast_code callback Small mismatch between the actual procedure name and the name as described in the doxygen documentation for the bap set broadcast code procedure Signed-off-by: Andries Kruithof --- include/zephyr/bluetooth/audio/bap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/bluetooth/audio/bap.h b/include/zephyr/bluetooth/audio/bap.h index 30e265599e0e4..90caa07eb2906 100644 --- a/include/zephyr/bluetooth/audio/bap.h +++ b/include/zephyr/bluetooth/audio/bap.h @@ -2597,7 +2597,7 @@ struct bt_bap_broadcast_assistant_cb { void (*mod_src)(struct bt_conn *conn, int err); /** - * @brief Callback function for bt_bap_broadcast_assistant_broadcast_code(). + * @brief Callback function for bt_bap_broadcast_assistant_set_broadcast_code(). * * @param conn The connection to the peer device. * @param err Error value. 0 on success, GATT error on fail. From 20cd3a3f094047294810c49f9060e674a0fdaa2e Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Wed, 23 Oct 2024 18:08:05 +0200 Subject: [PATCH 2166/4482] drivers/flash/mcux: fix flash_read() operation on LPC55S36 As other targets in the LPC55xxx series, the LPC55S36 has a Flash controller that raises ECC errors when reading erased pages directly. To avoid this, there is special code for this platform that calls the HAL FLASH_IsFlashAreaReadable() function. However, this in turn calls a function at an hardcoded address in ROM that _always_ causes an instruction fault, making the situation worse. This patch reworks the read operation to use the FLASH_Read() HAL function for this target to gracefully handle error conditions and properly emulate accesses to erased pages. The preprocessor is required since some targets do not define the FLASH_Read() function. Fixes: #80325 Signed-off-by: Luca Burelli --- drivers/flash/soc_flash_mcux.c | 48 +++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/drivers/flash/soc_flash_mcux.c b/drivers/flash/soc_flash_mcux.c index bcde5bcfc8878..88b0387f62329 100644 --- a/drivers/flash/soc_flash_mcux.c +++ b/drivers/flash/soc_flash_mcux.c @@ -55,7 +55,7 @@ LOG_MODULE_REGISTER(flash_mcux); #define SOC_NV_FLASH_NODE DT_INST(0, soc_nv_flash) -#if defined(CONFIG_CHECK_BEFORE_READING) && !defined(CONFIG_SOC_LPC55S36) +#if defined(CONFIG_CHECK_BEFORE_READING) && !defined(CONFIG_SOC_LPC55S36) #define FMC_STATUS_FAIL FLASH_INT_CLR_ENABLE_FAIL_MASK #define FMC_STATUS_ERR FLASH_INT_CLR_ENABLE_ERR_MASK #define FMC_STATUS_DONE FLASH_INT_CLR_ENABLE_DONE_MASK @@ -205,35 +205,53 @@ static int flash_mcux_read(const struct device *dev, off_t offset, addr = offset + priv->pflash_block_base; #ifdef CONFIG_CHECK_BEFORE_READING + /* + * Ensure the area is readable, since a direct access may cause faults + * on erased or otherwise unreadable pages. Emulate erased pages, + * return other errors. + */ #ifdef CONFIG_SOC_LPC55S36 - /* Validates the given address range is loaded in the flash hiding region. */ - rc = FLASH_IsFlashAreaReadable(&priv->config, addr, len); - if (rc != kStatus_FLASH_Success) { - rc = -EIO; - } else { - /* Check whether the flash is erased ("len" and "addr" must be word-aligned). */ + /* On LPC55S36, use a HAL function to safely copy from Flash. */ + rc = FLASH_Read(&priv->config, addr, data, len); + switch (rc) { + case kStatus_FLASH_Success: + rc = 0; + break; + case kStatus_FLASH_EccError: + /* Check id the ECC issue is due to the Flash being erased + * ("addr" and "len" must be word-aligned for this call). + */ rc = FLASH_VerifyErase(&priv->config, ((addr + 0x3) & ~0x3), ((len + 0x3) & ~0x3)); if (rc == kStatus_FLASH_Success) { rc = -ENODATA; } else { - rc = 0; + rc = -EIO; } + break; + default: + rc = -EIO; + break; } - #else + #else /* CONFIG_SOC_LPC55S36 */ + /* On all other targets, check if the Flash area is readable. + * If so, copy data from it directly. + */ rc = is_area_readable(addr, len); - #endif /* CONFIG_SOC_LPC55S36 */ -#endif /* CONFIG_CHECK_BEFORE_READING */ - if (!rc) { memcpy(data, (void *) addr, len); } -#ifdef CONFIG_CHECK_BEFORE_READING - else if (rc == -ENODATA) { + #endif /* CONFIG_SOC_LPC55S36 */ + + if (rc == -ENODATA) { /* Erased area, return dummy data as an erased page. */ memset(data, 0xFF, len); rc = 0; } -#endif +#else /* CONFIG_CHECK_BEFORE_READING */ + /* No safety checks, directly copy the memory mapped data. */ + memcpy(data, (void *) addr, len); +#endif /* CONFIG_CHECK_BEFORE_READING */ + return rc; } From 33def3036a59f08954fc4c33b31365e17e7046f2 Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Tue, 5 Nov 2024 11:30:37 +0100 Subject: [PATCH 2167/4482] drivers/flash/soc_flash_mcux: adjust alignment logic The current alignment logic does not work as expected if given unaligned values, resulting in a skip of the first word. The length also has to take into account the starting address: for example, asking for 2 bytes at offset 3 should actually check 8 bytes. This patch adjusts the logic so that it always includes the first and the last word of the input area. Signed-off-by: Luca Burelli --- drivers/flash/soc_flash_mcux.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/flash/soc_flash_mcux.c b/drivers/flash/soc_flash_mcux.c index 88b0387f62329..070535f76751c 100644 --- a/drivers/flash/soc_flash_mcux.c +++ b/drivers/flash/soc_flash_mcux.c @@ -221,7 +221,9 @@ static int flash_mcux_read(const struct device *dev, off_t offset, /* Check id the ECC issue is due to the Flash being erased * ("addr" and "len" must be word-aligned for this call). */ - rc = FLASH_VerifyErase(&priv->config, ((addr + 0x3) & ~0x3), ((len + 0x3) & ~0x3)); + rc = FLASH_VerifyErase(&priv->config, + ROUND_DOWN(addr, 4), + ROUND_DOWN(addr + len + 3, 4) - ROUND_DOWN(addr, 4)); if (rc == kStatus_FLASH_Success) { rc = -ENODATA; } else { From c6cc7a17e50d40ed7e6354bbe2340b90a9ca50f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Tue, 5 Nov 2024 12:18:20 +0100 Subject: [PATCH 2168/4482] samples: drivers: video: fix shield name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The capture to LVGL sample is using an incorrect name for the weact_ov2640_cam_module shield Signed-off-by: Benjamin Cabé --- samples/drivers/video/capture_to_lvgl/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/drivers/video/capture_to_lvgl/README.rst b/samples/drivers/video/capture_to_lvgl/README.rst index c63fb73f2fcd0..f3fa5e992ad3a 100644 --- a/samples/drivers/video/capture_to_lvgl/README.rst +++ b/samples/drivers/video/capture_to_lvgl/README.rst @@ -32,7 +32,7 @@ For :zephyr:board:`mini_stm32h743`, build this sample application with the follo .. zephyr-app-commands:: :zephyr-app: samples/drivers/video/capture_to_lvgl/ :board: mini_stm32h743 - :shield: weact_ministm32h7xx_ov2640 + :shield: weact_ov2640_cam_module :goals: build flash :gen-args: -DCONFIG_BOOT_DELAY=2000 :compact: From 035b139f64defffb23481938a49ffd6a6077f20b Mon Sep 17 00:00:00 2001 From: Benedikt Schmidt Date: Tue, 5 Nov 2024 13:19:32 +0100 Subject: [PATCH 2169/4482] drivers: fpga: add checks for optional properties of iCE40 Add checks in the GPIO bitbang mode to avoid a fault for missing configuration in the devicetree. Fixes #80850 Signed-off-by: Benedikt Schmidt --- drivers/fpga/fpga_ice40.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/fpga/fpga_ice40.c b/drivers/fpga/fpga_ice40.c index 9a5d6aa87aa46..ac00734f369f1 100644 --- a/drivers/fpga/fpga_ice40.c +++ b/drivers/fpga/fpga_ice40.c @@ -207,6 +207,26 @@ static int fpga_ice40_load_gpio(const struct device *dev, uint32_t *image_ptr, u struct fpga_ice40_data *data = dev->data; const struct fpga_ice40_config *config = dev->config; + if (!device_is_ready(config->clk.port)) { + LOG_ERR("%s: GPIO for clk is not ready", dev->name); + return -ENODEV; + } + + if (!device_is_ready(config->pico.port)) { + LOG_ERR("%s: GPIO for pico is not ready", dev->name); + return -ENODEV; + } + + if (config->set == NULL) { + LOG_ERR("%s: set register was not specified", dev->name); + return -EFAULT; + } + + if (config->clear == NULL) { + LOG_ERR("%s: clear register was not specified", dev->name); + return -EFAULT; + } + /* prepare masks */ cs = BIT(config->bus.config.cs.gpio.pin); clk = BIT(config->clk.pin); @@ -502,6 +522,16 @@ static int fpga_ice40_init(const struct device *dev) int ret; const struct fpga_ice40_config *config = dev->config; + if (!device_is_ready(config->creset.port)) { + LOG_ERR("%s: GPIO for creset is not ready", dev->name); + return -ENODEV; + } + + if (!device_is_ready(config->cdone.port)) { + LOG_ERR("%s: GPIO for cdone is not ready", dev->name); + return -ENODEV; + } + ret = gpio_pin_configure_dt(&config->creset, GPIO_OUTPUT_HIGH); if (ret < 0) { LOG_ERR("failed to configure CRESET: %d", ret); From 2696220bee3d4e655b51f0a9c3597ba4a2d52975 Mon Sep 17 00:00:00 2001 From: Raymond Lei Date: Wed, 6 Nov 2024 13:51:02 -0600 Subject: [PATCH 2170/4482] soc: nxp: imxrt11xx: Typo in clock initialization of usb2 a typo in usb2 clock initialization which impact the function of usb2. fixes: #81027 Signed-off-by: Raymond Lei --- soc/nxp/imxrt/imxrt11xx/soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/nxp/imxrt/imxrt11xx/soc.c b/soc/nxp/imxrt/imxrt11xx/soc.c index 5ba737cb28607..8d6bae6323114 100644 --- a/soc/nxp/imxrt/imxrt11xx/soc.c +++ b/soc/nxp/imxrt/imxrt11xx/soc.c @@ -536,7 +536,7 @@ static ALWAYS_INLINE void clock_init(void) kCLOCK_Usb480M, DT_PROP_BY_PHANDLE(DT_NODELABEL(usb2), clocks, clock_frequency)); CLOCK_EnableUsbhs1Clock(kCLOCK_Usb480M, DT_PROP_BY_PHANDLE(DT_NODELABEL(usb2), clocks, clock_frequency)); -#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && CONFIG_USB_DC_NXP_EHCI +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb2)) && CONFIG_USB_DC_NXP_EHCI USB_EhciPhyInit(kUSB_ControllerEhci1, CPU_XTAL_CLK_HZ, &usbPhyConfig); #endif #endif From 4331b5fe77987c5dcf2845fdf68e043688113df4 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Tue, 5 Nov 2024 15:15:29 +0100 Subject: [PATCH 2171/4482] tests: Bluetooth: PBP: Fix adv data for PBP BSIM test The test had a few off-by-ones in the code, which caused access to invalid data. Fixed by setting the right buffer sizes and the right AD length fields. Signed-off-by: Emil Gydesen --- .../audio/src/pbp_public_broadcast_source_test.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/bsim/bluetooth/audio/src/pbp_public_broadcast_source_test.c b/tests/bsim/bluetooth/audio/src/pbp_public_broadcast_source_test.c index cd703406e32fc..86df90cc38671 100644 --- a/tests/bsim/bluetooth/audio/src/pbp_public_broadcast_source_test.c +++ b/tests/bsim/bluetooth/audio/src/pbp_public_broadcast_source_test.c @@ -127,7 +127,7 @@ static int setup_extended_adv_data(struct bt_cap_broadcast_source *source, { /* Broadcast Audio Streaming Endpoint advertising data */ NET_BUF_SIMPLE_DEFINE(ad_buf, BT_UUID_SIZE_16 + BT_AUDIO_BROADCAST_ID_SIZE); - NET_BUF_SIMPLE_DEFINE(pbp_ad_buf, BT_UUID_SIZE_16 + 1 + ARRAY_SIZE(pba_metadata)); + NET_BUF_SIMPLE_DEFINE(pbp_ad_buf, BT_PBP_MIN_PBA_SIZE + ARRAY_SIZE(pba_metadata)); NET_BUF_SIMPLE_DEFINE(base_buf, 128); static enum bt_pbp_announcement_feature pba_params; struct bt_data ext_ad[2]; @@ -145,7 +145,7 @@ static int setup_extended_adv_data(struct bt_cap_broadcast_source *source, net_buf_simple_add_le16(&ad_buf, BT_UUID_BROADCAST_AUDIO_VAL); net_buf_simple_add_le24(&ad_buf, broadcast_id); ext_ad[0].type = BT_DATA_SVC_DATA16; - ext_ad[0].data_len = ad_buf.len + sizeof(ext_ad[0].type); + ext_ad[0].data_len = ad_buf.len; ext_ad[0].data = ad_buf.data; /** @@ -162,8 +162,8 @@ static int setup_extended_adv_data(struct bt_cap_broadcast_source *source, printk("Starting stream with high quality!\n"); } - err = bt_pbp_get_announcement(pba_metadata, ARRAY_SIZE(pba_metadata) - 1, - pba_params, &pbp_ad_buf); + err = bt_pbp_get_announcement(pba_metadata, ARRAY_SIZE(pba_metadata), pba_params, + &pbp_ad_buf); if (err != 0) { printk("Failed to create public broadcast announcement!: %d\n", err); From 4f85ce6eda93199946277d09bd5220b5eddd997e Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Tue, 5 Nov 2024 14:58:13 +0100 Subject: [PATCH 2172/4482] dp: swdp_bitbang: fix missing reset pin error This patch fixes an issue where the reset pin is used even when it's not given. Signed-off-by: Maximilian Deubel --- drivers/dp/swdp_bitbang.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/dp/swdp_bitbang.c b/drivers/dp/swdp_bitbang.c index 7822315ab8e12..8dec65b6c1055 100644 --- a/drivers/dp/swdp_bitbang.c +++ b/drivers/dp/swdp_bitbang.c @@ -601,9 +601,11 @@ static int sw_port_on(const struct device *dev) return ret; } - ret = gpio_pin_configure_dt(&config->reset, GPIO_OUTPUT_ACTIVE); - if (ret) { - return ret; + if (config->reset.port) { + ret = gpio_pin_configure_dt(&config->reset, GPIO_OUTPUT_ACTIVE); + if (ret) { + return ret; + } } return 0; From 10fa1eab50ac54e41bf75ab0ad01daa4bd25ba13 Mon Sep 17 00:00:00 2001 From: Arif Balik Date: Sat, 26 Oct 2024 15:01:57 +0300 Subject: [PATCH 2173/4482] drivers: clock: fix STM32_PERIPH_BUS_MIN for STM32U0 `STM32_PERIPH_BUS_MIN` is not the minimum bus address in `stm32u0_clock.h` Signed-off-by: Arif Balik --- include/zephyr/dt-bindings/clock/stm32u0_clock.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/zephyr/dt-bindings/clock/stm32u0_clock.h b/include/zephyr/dt-bindings/clock/stm32u0_clock.h index aee6cbd8518ae..5ee5059885562 100644 --- a/include/zephyr/dt-bindings/clock/stm32u0_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32u0_clock.h @@ -9,12 +9,12 @@ #include "stm32_common_clocks.h" /** Bus gatting clocks */ -#define STM32_CLOCK_BUS_IOP 0x4C #define STM32_CLOCK_BUS_AHB1 0x48 +#define STM32_CLOCK_BUS_IOP 0x4C #define STM32_CLOCK_BUS_APB1 0x58 #define STM32_CLOCK_BUS_APB1_2 0x60 -#define STM32_PERIPH_BUS_MIN STM32_CLOCK_BUS_IOP +#define STM32_PERIPH_BUS_MIN STM32_CLOCK_BUS_AHB1 #define STM32_PERIPH_BUS_MAX STM32_CLOCK_BUS_APB1_2 /** Domain clocks */ From b92bd6d345659211f0f8bc7eb0cea5c57e4a2416 Mon Sep 17 00:00:00 2001 From: Johan Lafon Date: Mon, 4 Nov 2024 12:10:57 +0100 Subject: [PATCH 2174/4482] drivers: display: ssd1322: fix never returning call to display_write A call to the write API function was never returning as we were trapped into an infinite loop. This was caused by the pixel_count pointer not being incremented properly. Signed-off-by: Johan Lafon --- drivers/display/ssd1322.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/display/ssd1322.c b/drivers/display/ssd1322.c index e0e154cb03237..c6e20f6f97b29 100644 --- a/drivers/display/ssd1322.c +++ b/drivers/display/ssd1322.c @@ -107,7 +107,7 @@ static int ssd1322_conv_mono01_grayscale(const uint8_t **buf_in, uint32_t *pixel } buf_in += pixels_in_chunk / 8; - pixel_count -= pixels_in_chunk; + *pixel_count -= pixels_in_chunk; return pixels_in_chunk * segments_per_pixel / 2; } From a140dd3de98e663b8f638fafec73300c7bf16d76 Mon Sep 17 00:00:00 2001 From: Johan Lafon Date: Mon, 4 Nov 2024 12:11:15 +0100 Subject: [PATCH 2175/4482] drivers: display: ssd1322: fix low and uneven pixel brightness In case more than one segment per pixel is required, only part of the segments were written resulting in low and uneven pixel brightness (at least on NHD-2.7-12864WDW3). Fix it by writing all required segments. Signed-off-by: Johan Lafon --- drivers/display/ssd1322.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/display/ssd1322.c b/drivers/display/ssd1322.c index c6e20f6f97b29..75d2d1c90a255 100644 --- a/drivers/display/ssd1322.c +++ b/drivers/display/ssd1322.c @@ -40,6 +40,9 @@ LOG_MODULE_REGISTER(ssd1322, CONFIG_DISPLAY_LOG_LEVEL); #define SSD1322_SET_MUX_RATIO 0xCA #define SSD1322_COMMAND_LOCK 0xFD +#define BITS_PER_SEGMENT 4 +#define SEGMENTS_PER_BYTE (8 / BITS_PER_SEGMENT) + struct ssd1322_config { const struct device *mipi_dev; struct mipi_dbi_config dbi_config; @@ -57,7 +60,7 @@ struct ssd1322_config { bool remap_com_dual; uint8_t segments_per_pixel; uint8_t *conversion_buf; - uint16_t conversion_buf_size; + size_t conversion_buf_size; }; static inline int ssd1322_write_command(const struct device *dev, uint8_t cmd, const uint8_t *buf, @@ -96,19 +99,28 @@ static int ssd1322_conv_mono01_grayscale(const uint8_t **buf_in, uint32_t *pixel /* Output buffer size gets rounded down to avoid splitting chunks in the middle of input * bytes */ - uint16_t pixels_in_chunk = MIN(*pixel_count, ROUND_DOWN(buf_out_size / 2, 8)); + uint16_t pixels_in_chunk = + MIN(*pixel_count, + ROUND_DOWN((buf_out_size * SEGMENTS_PER_BYTE) / segments_per_pixel, 8)); for (uint16_t in_idx = 0; in_idx < pixels_in_chunk; in_idx++) { - uint16_t seg_idx = in_idx * segments_per_pixel; uint8_t color = ((*buf_in)[in_idx / 8] & BIT(in_idx % 8)) ? 0xF : 0; - buf_out[seg_idx / 2] = - (seg_idx % 2 == 0) ? color : ((color << 4) | buf_out[seg_idx / 2]); + for (size_t i = 0; i < segments_per_pixel; i++) { + size_t seg_idx = in_idx * segments_per_pixel + i; + size_t shift = BITS_PER_SEGMENT * (seg_idx % SEGMENTS_PER_BYTE); + + if (shift == 0) { + buf_out[seg_idx / SEGMENTS_PER_BYTE] = color; + } else { + buf_out[seg_idx / SEGMENTS_PER_BYTE] |= color << shift; + } + } } buf_in += pixels_in_chunk / 8; *pixel_count -= pixels_in_chunk; - return pixels_in_chunk * segments_per_pixel / 2; + return pixels_in_chunk * segments_per_pixel / SEGMENTS_PER_BYTE; } static int ssd1322_write_pixels(const struct device *dev, const uint8_t *buf, uint32_t pixel_count) From 2b5ee0ca91e34944f75580317274c135a5d7c855 Mon Sep 17 00:00:00 2001 From: Johan Lafon Date: Mon, 4 Nov 2024 12:08:29 +0100 Subject: [PATCH 2176/4482] drivers: display: ssd1322: fix only part of the image being diplayed Only the first chunk of the desired image is displayed repeatedly over the screen height (at least on an NHD-2.7-12864WDW3 display). Fix it by computing the internal mono01 to 4bit grayscale conversion buffer size correctly so it can fit the entire image. Signed-off-by: Johan Lafon --- drivers/display/ssd1322.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/display/ssd1322.c b/drivers/display/ssd1322.c index 75d2d1c90a255..9dee7d3d4c5f5 100644 --- a/drivers/display/ssd1322.c +++ b/drivers/display/ssd1322.c @@ -358,7 +358,9 @@ static struct display_driver_api ssd1322_driver_api = { }; #define SSD1322_CONV_BUFFER_SIZE(node_id) \ - (DT_PROP(node_id, width) * DT_PROP(node_id, segments_per_pixel) * 4) + DIV_ROUND_UP(DT_PROP(node_id, width) * DT_PROP(node_id, height) * \ + DT_PROP(node_id, segments_per_pixel), \ + SEGMENTS_PER_BYTE) #define SSD1322_DEFINE(node_id) \ static uint8_t conversion_buf##node_id[SSD1322_CONV_BUFFER_SIZE(node_id)]; \ From 2a250af7937182a88f8eafdfaad7f16b4b26f8ea Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Wed, 6 Nov 2024 16:28:59 +0000 Subject: [PATCH 2177/4482] doc: release: 4.0: add Input release notes Add Input subsystem release notes. Signed-off-by: Fabio Baltieri --- doc/releases/release-notes-4.0.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 9c21cb8b2285e..e8167ee5eb273 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -395,6 +395,18 @@ Drivers and Sensors * Input + * New feature: :dtcompatible:`zephyr,input-double-tap`. + + * New driver: :dtcompatible:`ilitek,ili2132a`. + + * Added power management support to all keyboard matrix drivers, added a + ``no-disconnect`` property to :dtcompatible:`gpio-keys` so it can be used + with power management on GPIO drivers that do not support pin + disconnection. + + * Added a new framework for touchscreen common properties and features + (screen size, inversion, xy swap). + * Fixed broken ESP32 input touch sensor driver. * Interrupt From 6b0e259d27549c5bc0b961ed0d48d727612129c5 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Wed, 6 Nov 2024 23:27:57 -0500 Subject: [PATCH 2178/4482] doc: release/4.0: more bits about demand paging Mention SMP and demand mapping. Signed-off-by: Nicolas Pitre --- doc/releases/release-notes-4.0.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index e8167ee5eb273..5c5567ceb099e 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -596,6 +596,10 @@ Libraries / Subsystems * Added LRU (Least Recently Used) eviction algorithm. + * Added on-demand memory mapping support (:kconfig:option:`CONFIG_DEMAND_MAPPING`). + + * Made demand paging SMP compatible. + * Formatted output * Management From e5602f859e7ea206b061af4a0e1b861b94f8c4a2 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 7 Nov 2024 10:04:46 +0100 Subject: [PATCH 2179/4482] doc: release-notes-4.0: add relevant regulator changes Add notable changes to the regulator drivers. Signed-off-by: Gerard Marull-Paretas --- doc/releases/release-notes-4.0.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 5c5567ceb099e..14d0876d693f5 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -454,6 +454,9 @@ Drivers and Sensors * Regulators + * Upgraded CP9314 driver to B1 silicon revision + * Added basic driver for MPS MPM54304 + * Reset * RTC From 654303cd73db0a7176b8c4bfdfafc933af7e07b7 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 7 Nov 2024 10:09:24 +0100 Subject: [PATCH 2180/4482] doc: release-notes-4.0: add relevant pinctrl changes Add relevant changes for the pinctrl area. Signed-off-by: Gerard Marull-Paretas --- doc/releases/release-notes-4.0.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 14d0876d693f5..42c52a52c82a7 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -448,6 +448,11 @@ Drivers and Sensors * Pin control + * Added support for Microchip MEC5 + * Added SCMI-based driver for NXP i.MX + * Added support for i.MX93 M33 core + * Added support for ESP32C2 + * PWM * rpi_pico: The driver now configures the divide ratio adaptively. From d22c209c4b5f23a43876809bddeccee89322f10c Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 7 Nov 2024 10:12:39 +0100 Subject: [PATCH 2181/4482] doc: release-notes-4.0: add device changes Not much happening here, just some LLEXT related changes. Signed-off-by: Gerard Marull-Paretas --- doc/releases/release-notes-4.0.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 42c52a52c82a7..19763a805db4d 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -102,6 +102,8 @@ Architectures Kernel ****** +* Devicetree devices are now exported to :ref:`llext`. + Bluetooth ********* From faf075a9d4d261591ac9a0d3338de5fdb26cb2cd Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 4 Nov 2024 10:14:36 +0100 Subject: [PATCH 2182/4482] soc: nrf54h: gpd: use callback to fetch nrfs async result Busy-waiting for the result of the nrfs service calls can stall, so let's use a callback that flags a semaphore instead. Since the API is supposed to be callable in the context of pre-kernel, fallback to busy-wait on that scenario. Signed-off-by: Gerard Marull-Paretas --- soc/nordic/nrf54h/gpd/gpd.c | 55 +++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 6 deletions(-) diff --git a/soc/nordic/nrf54h/gpd/gpd.c b/soc/nordic/nrf54h/gpd/gpd.c index d100c89353802..a4d1889e53ffb 100644 --- a/soc/nordic/nrf54h/gpd/gpd.c +++ b/soc/nordic/nrf54h/gpd/gpd.c @@ -28,6 +28,9 @@ struct gpd_onoff_manager { struct onoff_manager mgr; onoff_notify_fn notify; uint8_t id; + struct k_mutex lock; + struct k_sem sem; + int res; }; static void start(struct onoff_manager *mgr, onoff_notify_fn notify); @@ -41,9 +44,21 @@ static void stop(struct onoff_manager *mgr, onoff_notify_fn notify); #define GPD_SERVICE_REQ_ERR BIT(3) static atomic_t gpd_service_status = ATOMIC_INIT(0); -static struct gpd_onoff_manager fast_active1 = {.id = NRF_GPD_FAST_ACTIVE1}; -static struct gpd_onoff_manager slow_active = {.id = NRF_GPD_SLOW_ACTIVE}; -static struct gpd_onoff_manager slow_main = {.id = NRF_GPD_SLOW_MAIN}; +static struct gpd_onoff_manager fast_active1 = { + .id = NRF_GPD_FAST_ACTIVE1, + .lock = Z_MUTEX_INITIALIZER(fast_active1.lock), + .sem = Z_SEM_INITIALIZER(fast_active1.sem, 0, 1), +}; +static struct gpd_onoff_manager slow_active = { + .id = NRF_GPD_SLOW_ACTIVE, + .lock = Z_MUTEX_INITIALIZER(slow_active.lock), + .sem = Z_SEM_INITIALIZER(slow_active.sem, 0, 1), +}; +static struct gpd_onoff_manager slow_main = { + .id = NRF_GPD_SLOW_MAIN, + .lock = Z_MUTEX_INITIALIZER(slow_main.lock), + .sem = Z_SEM_INITIALIZER(slow_main.sem, 0, 1), +}; static const struct onoff_transitions transitions = ONOFF_TRANSITIONS_INITIALIZER(start, stop, NULL); @@ -62,6 +77,18 @@ static struct gpd_onoff_manager *get_mgr(uint8_t id) } } +static void request_cb(struct onoff_manager *mgr_, struct onoff_client *cli, uint32_t state, + int res) +{ + ARG_UNUSED(cli); + ARG_UNUSED(state); + + struct gpd_onoff_manager *gpd_mgr = CONTAINER_OF(mgr_, struct gpd_onoff_manager, mgr); + + gpd_mgr->res = res; + k_sem_give(&gpd_mgr->sem); +} + static int nrf_gpd_sync(struct gpd_onoff_manager *gpd_mgr) { int64_t start; @@ -184,11 +211,27 @@ int nrf_gpd_request(uint8_t id) return -EIO; } - sys_notify_init_spinwait(&client.notify); + if (k_is_pre_kernel()) { + sys_notify_init_spinwait(&client.notify); + + ret = onoff_request(&gpd_mgr->mgr, &client); + if (ret < 0) { + return ret; + } - onoff_request(&gpd_mgr->mgr, &client); + while (sys_notify_fetch_result(&client.notify, &ret) == -EAGAIN) { + } + } else { + sys_notify_init_callback(&client.notify, request_cb); + k_mutex_lock(&gpd_mgr->lock, K_FOREVER); + + ret = onoff_request(&gpd_mgr->mgr, &client); + if (ret >= 0) { + (void)k_sem_take(&gpd_mgr->sem, K_FOREVER); + ret = gpd_mgr->res; + } - while (sys_notify_fetch_result(&client.notify, &ret) == -EAGAIN) { + k_mutex_unlock(&gpd_mgr->lock); } return ret; From 69e85b25fe7f17ef0ace4f5f55b2b3c2778a73b8 Mon Sep 17 00:00:00 2001 From: Jun Lin Date: Fri, 1 Nov 2024 16:40:27 +0800 Subject: [PATCH 2183/4482] board: npcx: remove CONFIG_PINCTRL from defconfig of npcx boards The CONFIG_PINCTRL is removed from the board's defconfig files. Drivers which use pin control function should add "select PINCTRL" in their Kconfig files. Fixes #78619 Signed-off-by: Jun Lin --- boards/nuvoton/npcx4m8f_evb/npcx4m8f_evb_defconfig | 3 --- boards/nuvoton/npcx7m6fb_evb/npcx7m6fb_evb_defconfig | 3 --- boards/nuvoton/npcx9m6f_evb/npcx9m6f_evb_defconfig | 3 --- drivers/adc/Kconfig.npcx | 1 + drivers/espi/Kconfig.npcx | 1 + drivers/flash/Kconfig.npcx_fiu | 1 + drivers/i2c/Kconfig.npcx | 1 + drivers/i3c/Kconfig.npcx | 1 + drivers/input/Kconfig.npcx | 1 + drivers/peci/Kconfig.npcx | 1 + drivers/ps2/Kconfig.npcx | 1 + drivers/pwm/Kconfig.npcx | 1 + drivers/sensor/nuvoton/nuvoton_tach_npcx/Kconfig | 1 + drivers/serial/Kconfig.npcx | 1 + drivers/spi/Kconfig.npcx | 1 + subsys/mgmt/ec_host_cmd/backends/Kconfig | 1 + 16 files changed, 13 insertions(+), 9 deletions(-) diff --git a/boards/nuvoton/npcx4m8f_evb/npcx4m8f_evb_defconfig b/boards/nuvoton/npcx4m8f_evb/npcx4m8f_evb_defconfig index 05a91e020f348..f57da9fa69a72 100644 --- a/boards/nuvoton/npcx4m8f_evb/npcx4m8f_evb_defconfig +++ b/boards/nuvoton/npcx4m8f_evb/npcx4m8f_evb_defconfig @@ -26,9 +26,6 @@ CONFIG_UART_INTERRUPT_DRIVEN=y # GPIO Driver CONFIG_GPIO=y -# Pin Controller Driver -CONFIG_PINCTRL=y - # Console Driver CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y diff --git a/boards/nuvoton/npcx7m6fb_evb/npcx7m6fb_evb_defconfig b/boards/nuvoton/npcx7m6fb_evb/npcx7m6fb_evb_defconfig index 13dabc3f51c68..0eb25c33a791e 100644 --- a/boards/nuvoton/npcx7m6fb_evb/npcx7m6fb_evb_defconfig +++ b/boards/nuvoton/npcx7m6fb_evb/npcx7m6fb_evb_defconfig @@ -26,9 +26,6 @@ CONFIG_UART_INTERRUPT_DRIVEN=y # GPIO Driver CONFIG_GPIO=y -# Pin Controller Driver -CONFIG_PINCTRL=y - # Console Driver CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y diff --git a/boards/nuvoton/npcx9m6f_evb/npcx9m6f_evb_defconfig b/boards/nuvoton/npcx9m6f_evb/npcx9m6f_evb_defconfig index c076f90611224..443d5beff37e6 100644 --- a/boards/nuvoton/npcx9m6f_evb/npcx9m6f_evb_defconfig +++ b/boards/nuvoton/npcx9m6f_evb/npcx9m6f_evb_defconfig @@ -26,9 +26,6 @@ CONFIG_UART_INTERRUPT_DRIVEN=y # GPIO Driver CONFIG_GPIO=y -# Pin Controller Driver -CONFIG_PINCTRL=y - # Console Driver CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y diff --git a/drivers/adc/Kconfig.npcx b/drivers/adc/Kconfig.npcx index 0209fd845d976..a61266ffe6767 100644 --- a/drivers/adc/Kconfig.npcx +++ b/drivers/adc/Kconfig.npcx @@ -7,6 +7,7 @@ config ADC_NPCX bool "Nuvoton NPCX embedded controller (EC) ADC driver" default y depends on DT_HAS_NUVOTON_NPCX_ADC_ENABLED + select PINCTRL help This option enables the ADC driver for NPCX family of processors. diff --git a/drivers/espi/Kconfig.npcx b/drivers/espi/Kconfig.npcx index 94624c9a26e13..dbeadaddfa2e6 100644 --- a/drivers/espi/Kconfig.npcx +++ b/drivers/espi/Kconfig.npcx @@ -8,6 +8,7 @@ config ESPI_NPCX default y depends on SOC_FAMILY_NPCX depends on DT_HAS_NUVOTON_NPCX_ESPI_ENABLED + select PINCTRL help This option enables the Intel Enhanced Serial Peripheral Interface (eSPI) for NPCX family of processors. diff --git a/drivers/flash/Kconfig.npcx_fiu b/drivers/flash/Kconfig.npcx_fiu index 9d464f48bb78c..3ddf9a2b7e53f 100644 --- a/drivers/flash/Kconfig.npcx_fiu +++ b/drivers/flash/Kconfig.npcx_fiu @@ -7,6 +7,7 @@ config FLASH_NPCX_FIU_QSPI bool "Nuvoton NPCX QSPI Bus Flash driver" default y depends on DT_HAS_NUVOTON_NPCX_FIU_QSPI_ENABLED + select PINCTRL help This option enables the QSPI Bus Flash driver for NPCX family of processors. diff --git a/drivers/i2c/Kconfig.npcx b/drivers/i2c/Kconfig.npcx index c02f544401d4a..2ac4880eb7892 100644 --- a/drivers/i2c/Kconfig.npcx +++ b/drivers/i2c/Kconfig.npcx @@ -7,6 +7,7 @@ config I2C_NPCX bool "Nuvoton NPCX embedded controller (EC) I2C driver" default y depends on DT_HAS_NUVOTON_NPCX_I2C_PORT_ENABLED + select PINCTRL help This option enables the I2C driver for NPCX family of processors. diff --git a/drivers/i3c/Kconfig.npcx b/drivers/i3c/Kconfig.npcx index b3b317a6fb6ff..0f2101a5fe1b5 100644 --- a/drivers/i3c/Kconfig.npcx +++ b/drivers/i3c/Kconfig.npcx @@ -10,6 +10,7 @@ config I3C_NPCX depends on DT_HAS_NUVOTON_NPCX_I3C_ENABLED select RESET select I3C_IBI_WORKQUEUE if I3C_USE_IBI + select PINCTRL default y help This option enables the I3C driver for NPCX family of diff --git a/drivers/input/Kconfig.npcx b/drivers/input/Kconfig.npcx index 07c2e301944bd..1c5a08a33946d 100644 --- a/drivers/input/Kconfig.npcx +++ b/drivers/input/Kconfig.npcx @@ -8,6 +8,7 @@ config INPUT_NPCX_KBD default y depends on DT_HAS_NUVOTON_NPCX_KBD_ENABLED select INPUT_KBD_MATRIX + select PINCTRL help This option enables the keyboard scan driver for NPCX family of processors. diff --git a/drivers/peci/Kconfig.npcx b/drivers/peci/Kconfig.npcx index 4b1e01274b4f6..e79114c54a10d 100644 --- a/drivers/peci/Kconfig.npcx +++ b/drivers/peci/Kconfig.npcx @@ -8,5 +8,6 @@ config PECI_NPCX default y depends on DT_HAS_NUVOTON_NPCX_PECI_ENABLED select PECI_INTERRUPT_DRIVEN + select PINCTRL help Enable the NPCX PECI IO driver. diff --git a/drivers/ps2/Kconfig.npcx b/drivers/ps2/Kconfig.npcx index afbec76d92653..5d8c515c916d7 100644 --- a/drivers/ps2/Kconfig.npcx +++ b/drivers/ps2/Kconfig.npcx @@ -6,6 +6,7 @@ menuconfig PS2_NPCX bool "Nuvoton NPCX embedded controller (EC) PS2 driver" depends on DT_HAS_NUVOTON_NPCX_PS2_CHANNEL_ENABLED + select PINCTRL default y help Enable the NPCX family PS2 driver. It provides four PS/2 channels. diff --git a/drivers/pwm/Kconfig.npcx b/drivers/pwm/Kconfig.npcx index e8869c2ef8900..2e8bdc9beb1f0 100644 --- a/drivers/pwm/Kconfig.npcx +++ b/drivers/pwm/Kconfig.npcx @@ -7,6 +7,7 @@ config PWM_NPCX bool "Nuvoton NPCX embedded controller (EC) PWM driver" default y depends on DT_HAS_NUVOTON_NPCX_PWM_ENABLED + select PINCTRL help This option enables the PWM driver for NPCX family of processors. diff --git a/drivers/sensor/nuvoton/nuvoton_tach_npcx/Kconfig b/drivers/sensor/nuvoton/nuvoton_tach_npcx/Kconfig index d30139b414c10..fbd485efb197b 100644 --- a/drivers/sensor/nuvoton/nuvoton_tach_npcx/Kconfig +++ b/drivers/sensor/nuvoton/nuvoton_tach_npcx/Kconfig @@ -8,5 +8,6 @@ config TACH_NPCX default y depends on DT_HAS_NUVOTON_NPCX_TACH_ENABLED depends on SOC_FAMILY_NPCX + select PINCTRL help Enable the "Nuvoton NPCX tachometer sensor. diff --git a/drivers/serial/Kconfig.npcx b/drivers/serial/Kconfig.npcx index 6284ed3a3728f..78f4dd16e12a4 100644 --- a/drivers/serial/Kconfig.npcx +++ b/drivers/serial/Kconfig.npcx @@ -11,6 +11,7 @@ config UART_NPCX depends on DT_HAS_NUVOTON_NPCX_UART_ENABLED select SERIAL_HAS_DRIVER select SERIAL_SUPPORT_INTERRUPT + select PINCTRL help This option enables the UART driver for NPCX family of processors. diff --git a/drivers/spi/Kconfig.npcx b/drivers/spi/Kconfig.npcx index 196e85cf02d8c..1c04bab441e06 100644 --- a/drivers/spi/Kconfig.npcx +++ b/drivers/spi/Kconfig.npcx @@ -7,6 +7,7 @@ menuconfig SPI_NPCX_SPIP bool "Nuvoton NPCX embedded controller (EC) SPI driver" default y depends on DT_HAS_NUVOTON_NPCX_SPIP_ENABLED + select PINCTRL help Enable the SPI peripherals on NPCX MCU. diff --git a/subsys/mgmt/ec_host_cmd/backends/Kconfig b/subsys/mgmt/ec_host_cmd/backends/Kconfig index bc3dbed16bdc3..8b03d0de844f6 100644 --- a/subsys/mgmt/ec_host_cmd/backends/Kconfig +++ b/subsys/mgmt/ec_host_cmd/backends/Kconfig @@ -55,6 +55,7 @@ config EC_HOST_CMD_BACKEND_SHI_NPCX bool "SHI by Nuvoton" depends on DT_HAS_NUVOTON_NPCX_SHI_ENABLED || \ DT_HAS_NUVOTON_NPCX_SHI_ENHANCED_ENABLED + select PINCTRL help This option enables the driver for SHI backend in the Nuvoton NPCX chip. From 4ae6520c3a28b33d598a5ede8d11ad82116a086a Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 30 Oct 2024 01:38:47 +0530 Subject: [PATCH 2184/4482] drivers: nrfwifi: Fix passing of RAW scan results flag The CONFIG_ prefix should be removed when passing to OSAL code. Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/wifi/nrfwifi/CMakeLists.txt b/drivers/wifi/nrfwifi/CMakeLists.txt index 70223f739ef00..17ec7176cb269 100644 --- a/drivers/wifi/nrfwifi/CMakeLists.txt +++ b/drivers/wifi/nrfwifi/CMakeLists.txt @@ -301,6 +301,10 @@ zephyr_compile_definitions_ifdef(CONFIG_NRF_WIFI_FEAT_KEEPALIVE -DNRF_WIFI_KEEPALIVE_PERIOD_S=${CONFIG_NRF_WIFI_KEEPALIVE_PERIOD_S} ) +zephyr_compile_definitions_ifdef(CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS + -DWIFI_MGMT_RAW_SCAN_RESULTS=${CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS} +) + zephyr_compile_definitions( -DNRF70_RX_NUM_BUFS=${CONFIG_NRF70_RX_NUM_BUFS} -DNRF70_MAX_TX_TOKENS=${CONFIG_NRF70_MAX_TX_TOKENS} From 8232440bb17a0ec372e158f05104fa38cd61abab Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Wed, 6 Nov 2024 23:10:02 -0500 Subject: [PATCH 2185/4482] doc: release: 4.0: mention LLEXT for ARM64 Mention LLEXT for ARM64. Signed-off-by: Nicolas Pitre --- doc/releases/release-notes-4.0.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 19763a805db4d..00b7bb2258f62 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -81,6 +81,8 @@ Architectures * Added support for demand paging. + * Added support for Linkable Loadable Extensions (LLEXT). + * RISC-V * The stack traces upon fatal exception now prints the address of stack pointer (sp) or frame From 52f9a129b5cff42761246def0ef81c0bdfb3d5a7 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 7 Nov 2024 05:19:48 -0500 Subject: [PATCH 2186/4482] twister: custom simulator needs an exec defined custom simulator needs an executable defined, or else we will have tests marked runnable with nothing to run them which would result in an error/warning. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/testinstance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pylib/twister/twisterlib/testinstance.py b/scripts/pylib/twister/twisterlib/testinstance.py index 64ca808a314f6..825403e8d84c3 100644 --- a/scripts/pylib/twister/twisterlib/testinstance.py +++ b/scripts/pylib/twister/twisterlib/testinstance.py @@ -277,7 +277,7 @@ def check_runnable(self, if self.testsuite.harness == 'pytest': target_ready = bool(filter == 'runnable' or self.platform.simulation in SUPPORTED_SIMS_IN_PYTEST) - SUPPORTED_SIMS_WITH_EXEC = ['nsim', 'mdb-nsim', 'renode', 'tsim', 'native', 'simics'] + SUPPORTED_SIMS_WITH_EXEC = ['nsim', 'mdb-nsim', 'renode', 'tsim', 'native', 'simics', 'custom'] if filter != 'runnable' and \ self.platform.simulation in SUPPORTED_SIMS_WITH_EXEC and \ self.platform.simulation_exec: From ac162b041abf5e734151fd41d5589244aa55b0f4 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 7 Nov 2024 05:22:04 -0500 Subject: [PATCH 2187/4482] intel_adsp: set exec for simulator targets Set exec in combination with custom simulator to all for correct test/envionment evaluation. Signed-off-by: Anas Nashif --- boards/intel/adsp/twister.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/boards/intel/adsp/twister.yaml b/boards/intel/adsp/twister.yaml index 7d74e68594ca9..fa49433b40d46 100644 --- a/boards/intel/adsp/twister.yaml +++ b/boards/intel/adsp/twister.yaml @@ -20,16 +20,19 @@ variants: intel_adsp/ace20_lnl/sim: type: sim simulation: custom + simulation_exec: acesim testing: timeout_multiplier: 4 intel_adsp/ace15_mtpm/sim: type: sim simulation: custom + simulation_exec: acesim testing: timeout_multiplier: 4 intel_adsp/ace30/ptl/sim: type: sim simulation: custom + simulation_exec: acesim toolchain: - xt-clang testing: From 0e9376ebfffeec5b8ff0ac0f931ae74887f6a996 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Mon, 4 Nov 2024 13:10:48 -0800 Subject: [PATCH 2188/4482] tests: thread_error_case: no ICOUNT for qemu/xtensa/dc233c/mmu For some weird reasons, enabling ICOUNT would result in some tests crashing QEMU. So disable ICOUNT. Signed-off-by: Daniel Leung --- .../thread_error_case/boards/qemu_xtensa_dc233c_mmu.conf | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tests/kernel/threads/thread_error_case/boards/qemu_xtensa_dc233c_mmu.conf diff --git a/tests/kernel/threads/thread_error_case/boards/qemu_xtensa_dc233c_mmu.conf b/tests/kernel/threads/thread_error_case/boards/qemu_xtensa_dc233c_mmu.conf new file mode 100644 index 0000000000000..469d835c3222b --- /dev/null +++ b/tests/kernel/threads/thread_error_case/boards/qemu_xtensa_dc233c_mmu.conf @@ -0,0 +1,3 @@ +# For some weird reasons, enabling ICOUNT would crash QEMU +# on this test. So disable it. +CONFIG_QEMU_ICOUNT=n From eb9fc642b96f27f1d0888c52a2291176404362c0 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Mon, 4 Nov 2024 13:11:52 -0800 Subject: [PATCH 2189/4482] xtensa: remove mem_domain excess padding The ptables field in arch_mem_domain for Xtensa has excessive padding as it is incorrectly marked with needing page size alignment. This is simply a pointer and not the actual page table so there is no need for that alignment. So remove it. Fixes #71896 Signed-off-by: Daniel Leung --- include/zephyr/arch/xtensa/arch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/arch/xtensa/arch.h b/include/zephyr/arch/xtensa/arch.h index 90614e707de42..794bd1b5d7066 100644 --- a/include/zephyr/arch/xtensa/arch.h +++ b/include/zephyr/arch/xtensa/arch.h @@ -63,7 +63,7 @@ extern "C" { struct arch_mem_domain { #ifdef CONFIG_XTENSA_MMU - uint32_t *ptables __aligned(CONFIG_MMU_PAGE_SIZE); + uint32_t *ptables; uint8_t asid; bool dirty; #endif From 580e93e9b4115c98dc45032ea58d7aaeb1aa92db Mon Sep 17 00:00:00 2001 From: Robin Kastberg Date: Fri, 1 Nov 2024 21:14:08 +0100 Subject: [PATCH 2190/4482] arm: tests: kernel: fix bug in fatal_exception test In ARM architectures the entry_cpu_exception_extend calls svc #0 when trying to generate a `K_ERR_CPU_EXCEPTION`, however z_arm_svc calls z_do_oops with a stack frame only, and gets the reason from `r0`. This means that the test working was just lucky and running it with another compiler (or setting the value of r0 before the svc #0 call, made the test fail). Cortex-A/R 32-bit architectures was doing a BKPT, this works better but will not be a hard exception when debugger is attached. I switched all the Cortex 32-bits to the ARM specified undefined instruction. Also RISC-V has a designated unimp instruction that should be used to guarantee trap. Signed-off-by: Robin Kastberg --- tests/kernel/fatal/exception/src/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/kernel/fatal/exception/src/main.c b/tests/kernel/fatal/exception/src/main.c index a946d02de7f9e..6eb97068b6ce1 100644 --- a/tests/kernel/fatal/exception/src/main.c +++ b/tests/kernel/fatal/exception/src/main.c @@ -108,16 +108,16 @@ void entry_cpu_exception_extend(void *p1, void *p2, void *p3) #if defined(CONFIG_ARM64) __asm__ volatile ("svc 0"); #elif defined(CONFIG_CPU_AARCH32_CORTEX_R) || defined(CONFIG_CPU_AARCH32_CORTEX_A) - __asm__ volatile ("BKPT"); + __asm__ volatile ("udf #0"); #elif defined(CONFIG_CPU_CORTEX_M) - __asm__ volatile ("swi 0"); + __asm__ volatile ("udf #0"); #elif defined(CONFIG_NIOS2) __asm__ volatile ("trap"); #elif defined(CONFIG_RISCV) /* In riscv architecture, use an undefined * instruction to trigger illegal instruction on RISCV. */ - __asm__ volatile (".word 0x77777777"); + __asm__ volatile ("unimp"); /* In arc architecture, SWI instruction is used * to trigger soft interrupt. */ From 60442a221a58f99ef6727f6dc8bbad3f8c29362f Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Fri, 4 Oct 2024 13:44:24 +1000 Subject: [PATCH 2191/4482] modules: segger: remove mutex locking Remove mutex locking in favour of the standard IRQ locking mechanism. The primary problem with the mutex implementation is that mutex locking is forbidden in ISR's. This means that any logging from an interrupt context (e.g. LOG_PANIC in an exception handler), will itself trigger another assertion due its attempt to use a mutex. Furthermore, mutexes are a relatively heavyweight locking scheme, which doesn't necessarily make sense in the context of extremely short locking periods that would be expected from RTT. This change aligns Zephyr with the default RTT locking scheme, which uses interrupt masking to perform access control. Resolves #79403. Signed-off-by: Jordan Yates --- drivers/serial/uart_rtt.c | 17 +---------------- modules/segger/Kconfig | 2 +- modules/segger/SEGGER_RTT_zephyr.c | 30 ------------------------------ west.yml | 2 +- 4 files changed, 3 insertions(+), 48 deletions(-) diff --git a/drivers/serial/uart_rtt.c b/drivers/serial/uart_rtt.c index 59044d87e60cb..7ed234329b80d 100644 --- a/drivers/serial/uart_rtt.c +++ b/drivers/serial/uart_rtt.c @@ -10,8 +10,6 @@ #define DT_DRV_COMPAT segger_rtt_uart -extern struct k_mutex rtt_term_mutex; - struct uart_rtt_config { void *up_buffer; size_t up_size; @@ -100,21 +98,8 @@ static int uart_rtt_tx(const struct device *dev, ARG_UNUSED(timeout); - /* RTT mutex cannot be claimed in ISRs */ - if (k_is_in_isr()) { - return -ENOTSUP; - } - - /* Claim the RTT lock */ - if (k_mutex_lock(&rtt_term_mutex, K_NO_WAIT) != 0) { - return -EBUSY; - } - /* Output the buffer */ - SEGGER_RTT_WriteNoLock(ch, buf, len); - - /* Return RTT lock */ - SEGGER_RTT_UNLOCK(); + SEGGER_RTT_Write(ch, buf, len); /* Send the TX complete callback */ if (data->callback) { diff --git a/modules/segger/Kconfig b/modules/segger/Kconfig index fd04ac99b0f82..597b4ab9f32ce 100644 --- a/modules/segger/Kconfig +++ b/modules/segger/Kconfig @@ -23,7 +23,7 @@ if USE_SEGGER_RTT config SEGGER_RTT_CUSTOM_LOCKING bool "Custom locking" help - Enable custom locking using a mutex. + Enable custom locking using Zephyr APIs. config SEGGER_RTT_MAX_NUM_UP_BUFFERS int "Maximum number of up-buffers" diff --git a/modules/segger/SEGGER_RTT_zephyr.c b/modules/segger/SEGGER_RTT_zephyr.c index b7b8e83e4abcb..a673f15d3d69e 100644 --- a/modules/segger/SEGGER_RTT_zephyr.c +++ b/modules/segger/SEGGER_RTT_zephyr.c @@ -9,41 +9,13 @@ #include #include "SEGGER_RTT.h" -/* - * Common mutex for locking access to terminal buffer. - * Note that SEGGER uses same lock macros for both SEGGER_RTT_Write and - * SEGGER_RTT_Read functions. Because of this we are not able generally - * separate up and down access using two mutexes until SEGGER library fix - * this. - * - * If sharing access cause performance problems, consider using another - * non terminal buffers. - */ - -K_MUTEX_DEFINE(rtt_term_mutex); - static int rtt_init(void) { - SEGGER_RTT_Init(); return 0; } -#ifdef CONFIG_MULTITHREADING - -void zephyr_rtt_mutex_lock(void) -{ - k_mutex_lock(&rtt_term_mutex, K_FOREVER); -} - -void zephyr_rtt_mutex_unlock(void) -{ - k_mutex_unlock(&rtt_term_mutex); -} - -#endif /* CONFIG_MULTITHREADING */ - unsigned int zephyr_rtt_irq_lock(void) { return irq_lock(); @@ -54,6 +26,4 @@ void zephyr_rtt_irq_unlock(unsigned int key) irq_unlock(key); } - - SYS_INIT(rtt_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_OBJECTS); diff --git a/west.yml b/west.yml index b61f2b97afb79..ba68f6d18ce00 100644 --- a/west.yml +++ b/west.yml @@ -317,7 +317,7 @@ manifest: path: modules/lib/picolibc revision: d492d5fa7c96918e37653f303028346bb0dd51a2 - name: segger - revision: b011c45b585e097d95d9cf93edf4f2e01588d3cd + revision: 798f95ea9304e5ed8165a661081443051f210733 path: modules/debug/segger groups: - debug From 91a59e7e15fee5ab3a18b289d7bfbb80f2133a74 Mon Sep 17 00:00:00 2001 From: Grixa Yrev Date: Thu, 31 Oct 2024 23:31:59 +0300 Subject: [PATCH 2192/4482] soc: nxp: imxrt: exclude mpu_regions.c when ARM_MPU disabled When option ARM_MPU is disabled exclude soc\nxp\imxrt\mpu_regions.c. It is needed to remove constraints of SRAM and FLASH size. Fixes #70920 Signed-off-by: Grixa Yrev --- soc/nxp/imxrt/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/nxp/imxrt/CMakeLists.txt b/soc/nxp/imxrt/CMakeLists.txt index e803787ef63ab..ac5302a32fc7e 100644 --- a/soc/nxp/imxrt/CMakeLists.txt +++ b/soc/nxp/imxrt/CMakeLists.txt @@ -16,7 +16,7 @@ if(CONFIG_SOC_SERIES_IMXRT10XX OR CONFIG_SOC_SERIES_IMXRT11XX) if(CONFIG_EXTERNAL_MEM_CONFIG_DATA) set(boot_hdr_xmcd_data_section ".boot_hdr.xmcd_data") endif() - zephyr_sources(mpu_regions.c) + zephyr_sources_ifdef(CONFIG_ARM_MPU mpu_regions.c) zephyr_linker_section_configure( SECTION .rom_start INPUT ".boot_hdr.conf" From 39f32eac370249cfce99c8a0d150a8247b0b3a25 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Thu, 7 Nov 2024 10:49:54 -0600 Subject: [PATCH 2193/4482] doc: twister: Clarify that the minimums are rough There is no way to know for sure the size of an image built for a test, given that zephyr can build for so many different architectures, platforms, software supports, etc. So it should be clear that the filter for min_ram and min_flash on the twister testcases is an estimate, and not a strictly well known value. Signed-off-by: Declan Snyder --- doc/develop/test/twister.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/develop/test/twister.rst b/doc/develop/test/twister.rst index 3999e6c96014c..f535648dd6e91 100644 --- a/doc/develop/test/twister.rst +++ b/doc/develop/test/twister.rst @@ -415,11 +415,11 @@ levels: test will be selectable using the command line option ``--level `` min_ram: - minimum amount of RAM in KB needed for this test to build and run. This is + estimated minimum amount of RAM in KB needed for this test to build and run. This is compared with information provided by the board metadata. min_flash: - minimum amount of ROM in KB needed for this test to build and run. This is + estimated minimum amount of ROM in KB needed for this test to build and run. This is compared with information provided by the board metadata. .. _twister_test_case_timeout: From 6984fd87a3aca61b45df98d503cc769e128f4887 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Wed, 6 Nov 2024 12:26:31 -0600 Subject: [PATCH 2194/4482] drivers: eth_nxp_enet: use net_if_carrier_off init Use net_if_carrier_off during iface init instead of net_eth_carrier_off, to immediately mark net if as down Signed-off-by: Declan Snyder --- drivers/ethernet/nxp_enet/eth_nxp_enet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ethernet/nxp_enet/eth_nxp_enet.c b/drivers/ethernet/nxp_enet/eth_nxp_enet.c index 5f6d58ad12c36..31ce4720c27c8 100644 --- a/drivers/ethernet/nxp_enet/eth_nxp_enet.c +++ b/drivers/ethernet/nxp_enet/eth_nxp_enet.c @@ -262,7 +262,7 @@ static void eth_nxp_enet_iface_init(struct net_if *iface) #endif ethernet_init(iface); - net_eth_carrier_off(data->iface); + net_if_carrier_off(data->iface); config->irq_config_func(); From 6c79fdf2caddcdbcbdfa66e39c4fb33fc35c4068 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Tue, 5 Nov 2024 22:47:21 +0100 Subject: [PATCH 2195/4482] Bluetooth: BAP: Fix bad state check for broadcast sink The state check used != instead of == to very that it entered the streaming state for all streams. Signed-off-by: Emil Gydesen --- subsys/bluetooth/audio/bap_broadcast_sink.c | 29 +++++++++------------ 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/subsys/bluetooth/audio/bap_broadcast_sink.c b/subsys/bluetooth/audio/bap_broadcast_sink.c index 611ecb3b73a6e..bff6a139e8413 100644 --- a/subsys/bluetooth/audio/bap_broadcast_sink.c +++ b/subsys/bluetooth/audio/bap_broadcast_sink.c @@ -295,31 +295,30 @@ static void broadcast_sink_iso_recv(struct bt_iso_chan *chan, } } -/** Gets the "highest" state of all BIS in the broadcast sink */ -static enum bt_bap_ep_state broadcast_sink_get_state(struct bt_bap_broadcast_sink *sink) +static bool broadcast_sink_is_in_state(struct bt_bap_broadcast_sink *sink, + enum bt_bap_ep_state state) { - enum bt_bap_ep_state state = BT_BAP_EP_STATE_IDLE; struct bt_bap_stream *stream; if (sink == NULL) { LOG_DBG("sink is NULL"); - return state; + return state == BT_BAP_EP_STATE_IDLE; } if (sys_slist_is_empty(&sink->streams)) { LOG_DBG("Sink does not have any streams"); - return state; + return state == BT_BAP_EP_STATE_IDLE; } SYS_SLIST_FOR_EACH_CONTAINER(&sink->streams, stream, _node) { - if (stream->ep != NULL) { - state = MAX(state, stream->ep->status.state); + if (stream->ep != NULL && stream->ep->status.state != state) { + return false; } } - return state; + return true; } static void broadcast_sink_iso_connected(struct bt_iso_chan *chan) @@ -362,7 +361,7 @@ static void broadcast_sink_iso_connected(struct bt_iso_chan *chan) LOG_WRN("No callback for started set"); } - if (broadcast_sink_get_state(sink) != BT_BAP_EP_STATE_STREAMING) { + if (broadcast_sink_is_in_state(sink, BT_BAP_EP_STATE_STREAMING)) { update_recv_state_big_synced(sink); } } @@ -1291,7 +1290,6 @@ int bt_bap_broadcast_sink_sync(struct bt_bap_broadcast_sink *sink, uint32_t inde int bt_bap_broadcast_sink_stop(struct bt_bap_broadcast_sink *sink) { - enum bt_bap_ep_state state; int err; CHECKIF(sink == NULL) { @@ -1304,9 +1302,8 @@ int bt_bap_broadcast_sink_stop(struct bt_bap_broadcast_sink *sink) return -EALREADY; } - state = broadcast_sink_get_state(sink); - if (state != BT_BAP_EP_STATE_STREAMING && state != BT_BAP_EP_STATE_QOS_CONFIGURED) { - LOG_DBG("Broadcast sink %p invalid state: %u", sink, state); + if (broadcast_sink_is_in_state(sink, BT_BAP_EP_STATE_IDLE)) { + LOG_DBG("Broadcast sink %p in idle state", sink); return -EBADMSG; } @@ -1324,16 +1321,14 @@ int bt_bap_broadcast_sink_stop(struct bt_bap_broadcast_sink *sink) int bt_bap_broadcast_sink_delete(struct bt_bap_broadcast_sink *sink) { - enum bt_bap_ep_state state; CHECKIF(sink == NULL) { LOG_DBG("sink is NULL"); return -EINVAL; } - state = broadcast_sink_get_state(sink); - if (state != BT_BAP_EP_STATE_IDLE) { - LOG_DBG("Broadcast sink %p invalid state: %u", sink, state); + if (!broadcast_sink_is_in_state(sink, BT_BAP_EP_STATE_IDLE)) { + LOG_DBG("Broadcast sink %p not in idle state", sink); return -EBADMSG; } From 073f68d248fc10fe6cea5f6306f39dea3b0c5bb6 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 6 Nov 2024 02:14:53 +0530 Subject: [PATCH 2196/4482] drivers: nrfwifi: WAR for performance regression With the newly introduced settling time for PLLS, we are seeing a peak performance drop of 3Mbps in Zperf benchmarks, and also other performance tests are also impacted. This settling time was introduced based on observations in lab and not because of any real problem or bug reported, so, for now, use zero settling time (same as earlier) till we fully investigate and understand the impacts and need. Fixes #80951. Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/src/qspi/src/qspi_if.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/wifi/nrfwifi/src/qspi/src/qspi_if.c b/drivers/wifi/nrfwifi/src/qspi/src/qspi_if.c index 46c92def8f7e0..754fe14971350 100644 --- a/drivers/wifi/nrfwifi/src/qspi/src/qspi_if.c +++ b/drivers/wifi/nrfwifi/src/qspi/src/qspi_if.c @@ -125,7 +125,10 @@ BUILD_ASSERT(QSPI_IF_DEVICE_FREQUENCY >= (NRF_QSPI_BASE_CLOCK_FREQ / 16), * starts. It was measured with a logic analyzer (unfortunately, the nRF5340 * specification does not provide any numbers in this regard). */ -#define BASE_CLOCK_SWITCH_DELAY_US 7 +/* FIXME: This has adverse impact on performance, ~3Mbps, so, for now, it is + * disabled till further investigation. + */ +#define BASE_CLOCK_SWITCH_DELAY_US 0 #else /* From e516a2219bb71167734177e8701fcd0595134ca2 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 29 Oct 2024 19:26:03 +0000 Subject: [PATCH 2197/4482] boards: shields: rk055hdmipi4ma0: increase DSI clock for RT1160 Increase target DSI clock frequency for the RT1160, as the DSI peripheral requires a faster clock to account for the DSI packets that must be sent outside of video mode frames. This fix was previously applied for the RT1170, but is also needed for the RT1160 SOC as they use the same DSI IP. Fixes #78299 Signed-off-by: Daniel DeGrasse --- .../boards/mimxrt1160_evk_mimxrt1166_cm7.overlay | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 boards/shields/rk055hdmipi4ma0/boards/mimxrt1160_evk_mimxrt1166_cm7.overlay diff --git a/boards/shields/rk055hdmipi4ma0/boards/mimxrt1160_evk_mimxrt1166_cm7.overlay b/boards/shields/rk055hdmipi4ma0/boards/mimxrt1160_evk_mimxrt1166_cm7.overlay new file mode 100644 index 0000000000000..7578cac75c266 --- /dev/null +++ b/boards/shields/rk055hdmipi4ma0/boards/mimxrt1160_evk_mimxrt1166_cm7.overlay @@ -0,0 +1,10 @@ +/* + * Copyright 2024, NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&zephyr_mipi_dsi { + /* Raise the DSI clock frequency */ + phy-clock = <792000000>; +}; From f781d7a26f81361668dc22851e90cac6d2c85971 Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Mon, 28 Oct 2024 13:46:30 +0100 Subject: [PATCH 2198/4482] soc: st: stm32U5/L5 series also have SWO line Add the SWO trace output to the stm32H5/H7RS/L5/U5/WB series Signed-off-by: Francois Ramu --- soc/st/stm32/common/soc_config.c | 6 +++--- soc/st/stm32/stm32l5x/Kconfig | 1 + soc/st/stm32/stm32u5x/Kconfig | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/soc/st/stm32/common/soc_config.c b/soc/st/stm32/common/soc_config.c index 83a69f1c0fe40..9275ce72babba 100644 --- a/soc/st/stm32/common/soc_config.c +++ b/soc/st/stm32/common/soc_config.c @@ -28,7 +28,9 @@ static int st_stm32_common_config(void) { #ifdef CONFIG_LOG_BACKEND_SWO /* Enable SWO trace asynchronous mode */ -#if defined(CONFIG_SOC_SERIES_STM32WBX) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if defined(CONFIG_SOC_SERIES_STM32H5X) || defined(CONFIG_SOC_SERIES_STM32H7RSX) || \ + defined(CONFIG_SOC_SERIES_STM32L5X) || defined(CONFIG_SOC_SERIES_STM32U5X) || \ + defined(CONFIG_SOC_SERIES_STM32WBX) LL_DBGMCU_EnableTraceClock(); #endif #if !defined(CONFIG_SOC_SERIES_STM32WBX) && defined(DBGMCU_CR_TRACE_IOEN) @@ -36,7 +38,6 @@ static int st_stm32_common_config(void) #endif #endif /* CONFIG_LOG_BACKEND_SWO */ - #if defined(CONFIG_USE_SEGGER_RTT) /* On some STM32 boards, for unclear reason, * RTT feature is working with realtime update only when @@ -49,7 +50,6 @@ static int st_stm32_common_config(void) __HAL_RCC_GPDMA1_CLK_ENABLE(); #endif /* __HAL_RCC_DMA1_CLK_ENABLE */ - #endif /* CONFIG_USE_SEGGER_RTT */ /* On some STM32 boards, for unclear reason, diff --git a/soc/st/stm32/stm32l5x/Kconfig b/soc/st/stm32/stm32l5x/Kconfig index be4ef81f8fde4..96cce0087b408 100644 --- a/soc/st/stm32/stm32l5x/Kconfig +++ b/soc/st/stm32/stm32l5x/Kconfig @@ -13,5 +13,6 @@ config SOC_SERIES_STM32L5X select ARMV8_M_DSP select CPU_CORTEX_M_HAS_DWT select HAS_STM32CUBE + select HAS_SWO select HAS_PM select SOC_EARLY_INIT_HOOK diff --git a/soc/st/stm32/stm32u5x/Kconfig b/soc/st/stm32/stm32u5x/Kconfig index 0c25912542908..7a09cf69866f2 100644 --- a/soc/st/stm32/stm32u5x/Kconfig +++ b/soc/st/stm32/stm32u5x/Kconfig @@ -16,6 +16,7 @@ config SOC_SERIES_STM32U5X select CPU_CORTEX_M_HAS_DWT select HAS_STM32CUBE select HAS_PM + select HAS_SWO select HAS_POWEROFF select SOC_EARLY_INIT_HOOK From 862af5e90357233a11bea31565ad5f2d6fec44c8 Mon Sep 17 00:00:00 2001 From: Chris Desjardins Date: Thu, 30 May 2024 17:11:45 +0200 Subject: [PATCH 2199/4482] fs: Fix null pointer exception caused by async fs_unmount The mp pointer is in fs_file_t and fs_dir_t so if the fs pointer is made NULL then subsequent file I/O operations will cause a NULL pointer exception. Removing the mount point from the list is threadsafe and should be sufficient. Signed-off-by: Chris Desjardins --- subsys/fs/fs.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/subsys/fs/fs.c b/subsys/fs/fs.c index 6e8daeee287c5..37781535f32e5 100644 --- a/subsys/fs/fs.c +++ b/subsys/fs/fs.c @@ -815,9 +815,6 @@ int fs_unmount(struct fs_mount_t *mp) goto unmount_err; } - /* clear file system interface */ - mp->fs = NULL; - /* remove mount node from the list */ sys_dlist_remove(&mp->node); LOG_DBG("fs unmounted from %s", mp->mnt_point); From fd7fc17810d155d3121aa9bd4ff5f03488c38479 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 7 Nov 2024 18:35:56 +0530 Subject: [PATCH 2200/4482] net: wifi: Fix strings for missing enumerations Enumerations were extended but respective strings were not added. Signed-off-by: Chaitanya Tata --- subsys/net/l2/wifi/wifi_mgmt.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 3a1f611add1c3..257eb6a5407fd 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -53,10 +53,6 @@ const char *wifi_security_txt(enum wifi_security_type security) switch (security) { case WIFI_SECURITY_TYPE_NONE: return "OPEN"; - case WIFI_SECURITY_TYPE_WEP: - return "WEP"; - case WIFI_SECURITY_TYPE_WPA_PSK: - return "WPA-PSK"; case WIFI_SECURITY_TYPE_PSK: return "WPA2-PSK"; case WIFI_SECURITY_TYPE_PSK_SHA256: @@ -70,9 +66,25 @@ const char *wifi_security_txt(enum wifi_security_type security) case WIFI_SECURITY_TYPE_WAPI: return "WAPI"; case WIFI_SECURITY_TYPE_EAP_TLS: - return "EAP"; + return "EAP-TLS"; + case WIFI_SECURITY_TYPE_WEP: + return "WEP"; + case WIFI_SECURITY_TYPE_WPA_PSK: + return "WPA-PSK"; case WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL: return "WPA/WPA2/WPA3 PSK"; + case WIFI_SECURITY_TYPE_DPP: + return "DPP"; + case WIFI_SECURITY_TYPE_EAP_PEAP_MSCHAPV2: + return "EAP-PEAP-MSCHAPV2"; + case WIFI_SECURITY_TYPE_EAP_PEAP_GTC: + return "EAP-PEAP-GTC"; + case WIFI_SECURITY_TYPE_EAP_TTLS_MSCHAPV2: + return "EAP-TTLS-MSCHAPV2"; + case WIFI_SECURITY_TYPE_EAP_PEAP_TLS: + return "EAP-PEAP-TLS"; + case WIFI_SECURITY_TYPE_EAP_TLS_SHA256: + return "EAP-TLS-SHA256"; case WIFI_SECURITY_TYPE_FT_PSK: return "FT-PSK"; case WIFI_SECURITY_TYPE_FT_SAE: From 41064c8e1d91e96fa67a215e909f1f783101730f Mon Sep 17 00:00:00 2001 From: Peter Mitsis Date: Fri, 1 Nov 2024 14:17:15 -0700 Subject: [PATCH 2201/4482] tests: Add objcore to latency_measure testcase.yaml Adds the object core configuration to the latency_measure benchmark's testcase.yaml file as there have been requests for it. Signed-off-by: Peter Mitsis --- .../benchmarks/latency_measure/testcase.yaml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/benchmarks/latency_measure/testcase.yaml b/tests/benchmarks/latency_measure/testcase.yaml index d58c8aa3bcecb..73a4dcb66c9b5 100644 --- a/tests/benchmarks/latency_measure/testcase.yaml +++ b/tests/benchmarks/latency_measure/testcase.yaml @@ -54,3 +54,25 @@ tests: regex: "(?P.*) - (?P.*):(?P.*) cycles ,(?P.*) ns" regex: - "PROJECT EXECUTION SUCCESSFUL" + + benchmark.kernel.latency.objcore: + # FIXME: no DWT and no RTC_TIMER for qemu_cortex_m0 + platform_exclude: + - qemu_cortex_m0 + - m2gl025_miv + filter: CONFIG_PRINTK and not CONFIG_SOC_FAMILY_STM32 + timeout: 300 + extra_configs: + - CONFIG_OBJ_CORE=y + - CONFIG_OBJ_CORE_STATS=y + harness: console + integration_platforms: + - qemu_x86 + - qemu_arc/qemu_arc_em + - qemu_riscv64/qemu_virt_riscv64/smp + harness_config: + type: one_line + record: + regex: "(?P.*) - (?P.*):(?P.*) cycles ,(?P.*) ns" + regex: + - "PROJECT EXECUTION SUCCESSFUL" From 67980643d799f76aff93118346a8dabfb472a642 Mon Sep 17 00:00:00 2001 From: Hui Bai Date: Mon, 4 Nov 2024 15:32:47 +0800 Subject: [PATCH 2202/4482] net: wifi: Fix 11k command errors Add condition check so that the 11k flag will be updated for set operation only. Fix print log error when getting 11k status. Signed-off-by: Hui Bai --- subsys/net/l2/wifi/wifi_mgmt.c | 4 +++- subsys/net/l2/wifi/wifi_shell.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 257eb6a5407fd..659b13fb81c14 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -741,7 +741,9 @@ static int wifi_11k_cfg(uint32_t mgmt_request, struct net_if *iface, } #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_ROAMING - roaming_params.is_11k_enabled = params->enable_11k; + if (params->oper == WIFI_MGMT_SET) { + roaming_params.is_11k_enabled = params->enable_11k; + } #endif return wifi_mgmt_api->cfg_11k(dev, params); diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 2cb83d031ca5e..d8918be34cb53 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1248,7 +1248,7 @@ static int cmd_wifi_11k(const struct shell *sh, size_t argc, char *argv[]) } if (params.oper == WIFI_MGMT_GET) { - PR("11k is %s\n", params.enable_11k ? "disabled" : "enabled"); + PR("11k is %s\n", params.enable_11k ? "enabled" : "disabled"); } else { PR("%s %s requested\n", argv[0], argv[1]); } From 5776436136bc9a83bc4c922b31377511b430f5b0 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Wed, 30 Oct 2024 19:22:41 -0400 Subject: [PATCH 2203/4482] tests: shell: limit build only config tests Limit build_only config tests to one platform. Signed-off-by: Anas Nashif --- tests/subsys/shell/shell/testcase.yaml | 38 ++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/tests/subsys/shell/shell/testcase.yaml b/tests/subsys/shell/shell/testcase.yaml index 7a5b4170af462..26f8a211849cb 100644 --- a/tests/subsys/shell/shell/testcase.yaml +++ b/tests/subsys/shell/shell/testcase.yaml @@ -1,79 +1,107 @@ common: tags: shell - min_ram: 32 - integration_platforms: - - native_sim - tests: shell.core: min_flash: 64 - + min_ram: 32 + integration_platforms: + - native_sim + # all tests below are just a build test verifying config options, it fails if run + # and can be covered with one platform. shell.min: min_flash: 32 extra_args: CONF_FILE=shell_min.conf + platform_allow: + - mps2/an385 build_only: true shell.min_cmds: min_flash: 32 extra_args: CONF_FILE=shell_min_cmds.conf build_only: true + platform_allow: + - mps2/an385 shell.min_cmds_all: min_flash: 32 extra_args: CONF_FILE=shell_min_cmds_all.conf build_only: true + platform_allow: + - mps2/an385 shell.min_cmds_resize: min_flash: 32 extra_args: CONF_FILE=shell_min_cmds_resize.conf build_only: true + platform_allow: + - mps2/an385 shell.min_cmds_select: min_flash: 32 extra_args: CONF_FILE=shell_min_cmds_select.conf build_only: true + platform_allow: + - mps2/an385 shell.min_colors: min_flash: 32 extra_args: CONF_FILE=shell_min_colors.conf build_only: true + platform_allow: + - mps2/an385 shell.min_help: min_flash: 32 extra_args: CONF_FILE=shell_min_help.conf build_only: true + platform_allow: + - mps2/an385 shell.min_help_all: min_flash: 32 extra_args: CONF_FILE=shell_min_help_all.conf build_only: true + platform_allow: + - mps2/an385 shell.min_history: min_flash: 32 extra_args: CONF_FILE=shell_min_history.conf build_only: true + platform_allow: + - mps2/an385 shell.min_log_backend: min_flash: 64 extra_args: CONF_FILE=shell_min_log_backend.conf build_only: true + platform_allow: + - mps2/an385 shell.min_metakeys: min_flash: 32 extra_args: CONF_FILE=shell_min_metakeys.conf build_only: true + platform_allow: + - mps2/an385 shell.min_tab: min_flash: 32 extra_args: CONF_FILE=shell_min_tab.conf build_only: true + platform_allow: + - mps2/an385 shell.min_tab_auto: min_flash: 32 extra_args: CONF_FILE=shell_min_tab_auto.conf build_only: true + platform_allow: + - mps2/an385 shell.min_wildcards: min_flash: 32 extra_args: CONF_FILE=shell_min_wildcards.conf build_only: true + platform_allow: + - mps2/an385 From 7c40b071e448f57868b56b67d2f5bd23443c232a Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Tue, 5 Nov 2024 17:53:56 +0100 Subject: [PATCH 2204/4482] Bluetooth: CSIP: Fix off-by-one in in lock restore If the lock request was rejected by a set member we should restore any previously written logs in reverse order. However there was a off-by-one error in csip_set_coordinator_write_lock_cb which caused us to attempt to release member[1] instead of member[0] if member[1] was the one that rejected the lock request. Additionally, the lock_set_complete would be called prematurely before we get the response from the restore request. Signed-off-by: Emil Gydesen --- subsys/bluetooth/audio/csip_set_coordinator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/audio/csip_set_coordinator.c b/subsys/bluetooth/audio/csip_set_coordinator.c index f27a85087ee1f..a56ee7d5456d7 100644 --- a/subsys/bluetooth/audio/csip_set_coordinator.c +++ b/subsys/bluetooth/audio/csip_set_coordinator.c @@ -1113,7 +1113,7 @@ static void csip_set_coordinator_write_lock_cb(struct bt_conn *conn, active.members_restored = 0; - member = active.members[active.members_handled - active.members_restored]; + member = active.members[active.members_handled - 1]; client->cur_inst = lookup_instance_by_set_info(member, &active.info); if (client->cur_inst == NULL) { LOG_DBG("Failed to lookup instance by set_info"); @@ -1130,10 +1130,10 @@ static void csip_set_coordinator_write_lock_cb(struct bt_conn *conn, active_members_reset(); return; } + } else { + lock_set_complete(err); } - lock_set_complete(err); - return; } From b2c9db7606ddcbe8e7363a40140ef883fde4ab0c Mon Sep 17 00:00:00 2001 From: Erwan Gouriou Date: Wed, 6 Nov 2024 09:33:22 +0100 Subject: [PATCH 2205/4482] boards: st: stm32l5: Fix TF-M by restricting Libc malloc aera By default, libc malloc allocated area is using all available RAM. For some yet unknown reason, this conflicts with TF-M resulting in a Hard Fault before jumping in the non secure application. For now, define a Libc malloc area defined to 2048 which is the default in some other typical applications (ARMv7 targets enabling USERSPACE). Fixes #77847 Signed-off-by: Erwan Gouriou --- boards/st/nucleo_l552ze_q/Kconfig.defconfig | 20 ++++++++++++++++++++ boards/st/stm32l562e_dk/Kconfig.defconfig | 12 ++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 boards/st/nucleo_l552ze_q/Kconfig.defconfig diff --git a/boards/st/nucleo_l552ze_q/Kconfig.defconfig b/boards/st/nucleo_l552ze_q/Kconfig.defconfig new file mode 100644 index 0000000000000..901b4cf1ad694 --- /dev/null +++ b/boards/st/nucleo_l552ze_q/Kconfig.defconfig @@ -0,0 +1,20 @@ +# STM32L552ZE-Q Nucleo board configuration + +# Copyright (c) 2024 STMicroelectronics +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_NUCLEO_L552ZE_Q + +if BUILD_WITH_TFM + +# Not defining LIBC malloc arena has the effect of declaring all available RAM +# as available for malloc. +# This currently conflicts with TF-M MPU setting, resulting in a hard fault. +# Define a specific size to avoid this situation. + +config COMMON_LIBC_MALLOC_ARENA_SIZE + default 2048 + +endif # BUILD_WITH_TFM + +endif # BOARD_NUCLEO_L552ZE_Q diff --git a/boards/st/stm32l562e_dk/Kconfig.defconfig b/boards/st/stm32l562e_dk/Kconfig.defconfig index 118968f4c082a..7547fd3eb9c34 100644 --- a/boards/st/stm32l562e_dk/Kconfig.defconfig +++ b/boards/st/stm32l562e_dk/Kconfig.defconfig @@ -30,4 +30,16 @@ endchoice endif # DISPLAY +if BUILD_WITH_TFM + +# Not defining LIBC malloc arena has the effect of declaring all available RAM +# as available for malloc. +# This currently conflicts with TF-M MPU setting, resulting in a hard fault. +# Define a specific size to avoid this situation. + +config COMMON_LIBC_MALLOC_ARENA_SIZE + default 2048 + +endif # BUILD_WITH_TFM + endif # BOARD_STM32L562E_DK From 5c9d6f1dba8e863986f90b150d35d3db5ad3b37b Mon Sep 17 00:00:00 2001 From: Emilio Benavente Date: Tue, 5 Nov 2024 16:15:42 -0600 Subject: [PATCH 2206/4482] tests: lib: cmsis_dsp: transform: Update Ram Size Updating the minimum Ram Size for failing tests that require more ram memory for heap allocations. Signed-off-by: Emilio Benavente --- tests/lib/cmsis_dsp/transform/testcase.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/lib/cmsis_dsp/transform/testcase.yaml b/tests/lib/cmsis_dsp/transform/testcase.yaml index d6679bd4ae2f0..61689aa43a696 100644 --- a/tests/lib/cmsis_dsp/transform/testcase.yaml +++ b/tests/lib/cmsis_dsp/transform/testcase.yaml @@ -70,7 +70,7 @@ tests: - native_sim tags: cmsis-dsp min_flash: 1024 - min_ram: 64 + min_ram: 80 extra_args: CONF_FILE=prj_base.conf extra_configs: - CONFIG_CMSIS_DSP_TEST_TRANSFORM_CQ31=y @@ -81,7 +81,7 @@ tests: - cmsis-dsp - fpu min_flash: 1024 - min_ram: 64 + min_ram: 80 extra_args: CONF_FILE=prj_base.conf extra_configs: - CONFIG_CMSIS_DSP_TEST_TRANSFORM_CQ31=y @@ -256,7 +256,7 @@ tests: - native_sim tags: cmsis-dsp min_flash: 1024 - min_ram: 64 + min_ram: 80 extra_args: CONF_FILE=prj_base.conf extra_configs: - CONFIG_CMSIS_DSP_TEST_TRANSFORM_RF64=y @@ -267,7 +267,7 @@ tests: - cmsis-dsp - fpu min_flash: 1024 - min_ram: 64 + min_ram: 80 extra_args: CONF_FILE=prj_base.conf extra_configs: - CONFIG_CMSIS_DSP_TEST_TRANSFORM_RF64=y From 3018ff7a4d1fc5463adf73b8c29005355fd15d4f Mon Sep 17 00:00:00 2001 From: Emilio Benavente Date: Tue, 5 Nov 2024 16:18:32 -0600 Subject: [PATCH 2207/4482] dts: arm: nxp: Updating the ram size for the MCXW71 Updating the SRAM space for the MCXW71 SOC. Signed-off-by: Emilio Benavente --- dts/arm/nxp/nxp_mcxw71.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dts/arm/nxp/nxp_mcxw71.dtsi b/dts/arm/nxp/nxp_mcxw71.dtsi index 7b5f13e5d544e..e17ae42ea5f8a 100644 --- a/dts/arm/nxp/nxp_mcxw71.dtsi +++ b/dts/arm/nxp/nxp_mcxw71.dtsi @@ -57,7 +57,8 @@ stcm0: system_memory@0 { compatible = "mmio-sram"; - reg = <0x0 DT_SIZE_K(64)>; + /* With only the first 64KB having ECC */ + reg = <0x0 DT_SIZE_K(104)>; }; stcm1: system_memory@1a000 { From 525ba389bc8255125dbd56b803c8ae3ce7f71281 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Wed, 6 Nov 2024 12:40:45 +0100 Subject: [PATCH 2208/4482] tests: Bluetooth: tester: Workaround Bus Fault in nRF53x using full RAM Workaround failing autopts weekly run due to tester application having Bus Fault in the nRF53 NET core hci_ipc firmware at startup. Having atleast 32 bytes free in nRF53x hci_ipc sample to avoid Bus Fault when Zephyr Kernel does SYSINIT calls. Reduce supported ISO Broadcaster instance and ISO TX buffer counts in the Controller hci_ipc firmware. Add sysbuild support for tester application so that the build is CI verified. sysbuild commandline for LE audio PTS testing: # west build --sysbuild -b nrf5340_audio_dk/nrf5340/cpuapp -d build/tester tests/bluetooth/tester -DEXTRA_CONF_FILE="overlay-le-audio.conf" Signed-off-by: Vinayak Kariappa Chettimada --- tests/bluetooth/tester/Kconfig.sysbuild | 14 +++++++++ .../tester/nrf5340_hci_ipc_cpunet.conf | 10 +++++-- tests/bluetooth/tester/sysbuild.cmake | 29 +++++++++++++++++++ tests/bluetooth/tester/testcase.yaml | 7 ++++- 4 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 tests/bluetooth/tester/Kconfig.sysbuild create mode 100644 tests/bluetooth/tester/sysbuild.cmake diff --git a/tests/bluetooth/tester/Kconfig.sysbuild b/tests/bluetooth/tester/Kconfig.sysbuild new file mode 100644 index 0000000000000..5256fa48d8823 --- /dev/null +++ b/tests/bluetooth/tester/Kconfig.sysbuild @@ -0,0 +1,14 @@ +# Copyright 2023-2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "share/sysbuild/Kconfig" + +config NET_CORE_BOARD + string + default "nrf5340dk/nrf5340/cpunet" if "$(BOARD)" = "nrf5340dk" + default "nrf5340_audio_dk/nrf5340/cpunet" if "$(BOARD)" = "nrf5340_audio_dk" + +config NET_CORE_IMAGE_HCI_IPC + bool "HCI IPC image on network core" + default y + depends on NET_CORE_BOARD != "" diff --git a/tests/bluetooth/tester/nrf5340_hci_ipc_cpunet.conf b/tests/bluetooth/tester/nrf5340_hci_ipc_cpunet.conf index 91f6566f2084d..c224508d51ad1 100644 --- a/tests/bluetooth/tester/nrf5340_hci_ipc_cpunet.conf +++ b/tests/bluetooth/tester/nrf5340_hci_ipc_cpunet.conf @@ -1,5 +1,11 @@ # Apply this overlay at hci_ipc controller build -CONFIG_BT_CTLR_CONN_ISO_LOW_LATENCY_POLICY=y + +# Changes towards reduced RAM usage, in order to fit the tweaks +CONFIG_HEAP_MEM_POOL_SIZE=7168 + +# PTS required counts +CONFIG_BT_MAX_CONN=3 + +# PTS tests specific tweaks CONFIG_BT_CTLR_PERIPHERAL_ISO_EARLY_CIG_START=y CONFIG_BT_CTLR_ISOAL_PSN_IGNORE=y -CONFIG_BT_MAX_CONN=3 diff --git a/tests/bluetooth/tester/sysbuild.cmake b/tests/bluetooth/tester/sysbuild.cmake new file mode 100644 index 0000000000000..605d7ab74da81 --- /dev/null +++ b/tests/bluetooth/tester/sysbuild.cmake @@ -0,0 +1,29 @@ +# Copyright (c) 2023-2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) + # For builds in the nrf5340, we build the netcore image with the controller + + set(NET_APP hci_ipc) + set(NET_APP_SRC_DIR ${ZEPHYR_BASE}/samples/bluetooth/${NET_APP}) + + ExternalZephyrProject_Add( + APPLICATION ${NET_APP} + SOURCE_DIR ${NET_APP_SRC_DIR} + BOARD ${SB_CONFIG_NET_CORE_BOARD} + ) + + set(${NET_APP}_CONF_FILE + ${NET_APP_SRC_DIR}/nrf5340_cpunet_iso-bt_ll_sw_split.conf + CACHE INTERNAL "" + ) + + set(${NET_APP}_EXTRA_CONF_FILE + ${APP_DIR}/nrf5340_hci_ipc_cpunet.conf + CACHE INTERNAL "" + ) + + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) +endif() + +native_simulator_set_final_executable(${DEFAULT_IMAGE}) diff --git a/tests/bluetooth/tester/testcase.yaml b/tests/bluetooth/tester/testcase.yaml index 62e999adaa1d2..45bf841facc6e 100644 --- a/tests/bluetooth/tester/testcase.yaml +++ b/tests/bluetooth/tester/testcase.yaml @@ -23,9 +23,14 @@ tests: - native_sim - nrf5340dk/nrf5340/cpuapp - nrf5340_audio_dk/nrf5340/cpuapp - extra_args: EXTRA_CONF_FILE="overlay-le-audio.conf" + integration_platforms: + - nrf5340dk/nrf5340/cpuapp + - nrf5340_audio_dk/nrf5340/cpuapp + extra_args: + - EXTRA_CONF_FILE="overlay-le-audio.conf" tags: bluetooth harness: bluetooth + sysbuild: true bluetooth.general.tester_mesh: build_only: true platform_allow: From e7c34367cfed20f46d384a83202aea7979171f3a Mon Sep 17 00:00:00 2001 From: James Roy Date: Wed, 6 Nov 2024 20:51:46 +0800 Subject: [PATCH 2209/4482] doc: build: dts: Fix incorrect rst tag Replaced incorrect ':c:func:' tag for devicetree macro with ':c:macro' tag. Signed-off-by: James Roy --- doc/build/dts/api-usage.rst | 52 ++++++++++++++++++------------------- doc/build/dts/howtos.rst | 22 ++++++++-------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/doc/build/dts/api-usage.rst b/doc/build/dts/api-usage.rst index 5bf0884c91243..c53ece8ee6a70 100644 --- a/doc/build/dts/api-usage.rst +++ b/doc/build/dts/api-usage.rst @@ -34,18 +34,18 @@ identifier* for it. This is a just a C macro that refers to the node. These are the main ways to get a node identifier: By path - Use :c:func:`DT_PATH()` along with the node's full path in the devicetree, + Use :c:macro:`DT_PATH()` along with the node's full path in the devicetree, starting from the root node. This is mostly useful if you happen to know the exact node you're looking for. By node label - Use :c:func:`DT_NODELABEL()` to get a node identifier from a :ref:`node + Use :c:macro:`DT_NODELABEL()` to get a node identifier from a :ref:`node label `. Node labels are often provided by SoC :file:`.dtsi` files to give nodes names that match the SoC datasheet, like ``i2c1``, ``spi2``, etc. By alias - Use :c:func:`DT_ALIAS()` to get a node identifier for a property of the + Use :c:macro:`DT_ALIAS()` to get a node identifier for a property of the special ``/aliases`` node. This is sometimes done by applications (like :zephyr:code-sample:`blinky`, which uses the ``led0`` alias) that need to refer to *some* device of a particular type ("the board's user LED") but @@ -54,14 +54,14 @@ By alias By instance number This is done primarily by device drivers, as instance numbers are a way to refer to individual nodes based on a matching compatible. Get these with - :c:func:`DT_INST()`, but be careful doing so. See below. + :c:macro:`DT_INST()`, but be careful doing so. See below. By chosen node - Use :c:func:`DT_CHOSEN()` to get a node identifier for ``/chosen`` node + Use :c:macro:`DT_CHOSEN()` to get a node identifier for ``/chosen`` node properties. By parent/child - Use :c:func:`DT_PARENT()` and :c:func:`DT_CHILD()` to get a node identifier + Use :c:macro:`DT_PARENT()` and :c:macro:`DT_CHILD()` to get a node identifier for a parent or child node, starting from a node identifier you already have. Two node identifiers which refer to the same node are identical and can be used @@ -82,7 +82,7 @@ Here are a few ways to get node identifiers for the ``i2c@40002000`` node: - ``DT_NODELABEL(i2c1)`` - ``DT_ALIAS(sensor_controller)`` - ``DT_INST(x, vnd_soc_i2c)`` for some unknown number ``x``. See the - :c:func:`DT_INST()` documentation for details. + :c:macro:`DT_INST()` documentation for details. .. important:: @@ -133,7 +133,7 @@ The right API to use to read property values depends on the node and property. Checking properties and values ============================== -You can use :c:func:`DT_NODE_HAS_PROP()` to check if a node has a property. For +You can use :c:macro:`DT_NODE_HAS_PROP()` to check if a node has a property. For the :ref:`example devicetree ` above: .. code-block:: c @@ -202,7 +202,7 @@ Its properties can be accessed like this: unsigned char b[] = DT_PROP(FOO, b); /* {0xaa, 0xbb, 0xcc, 0xdd} */ char* c[] = DT_PROP(FOO, c); /* {"foo", "bar"} */ -You can use :c:func:`DT_PROP_LEN()` to get logical array lengths in number of +You can use :c:macro:`DT_PROP_LEN()` to get logical array lengths in number of elements. .. code-block:: c @@ -226,12 +226,12 @@ total number of register blocks in the node's ``reg`` property. You **cannot** read register block addresses and lengths with ``DT_PROP(node, reg)``. Instead, if a node only has one register block, use -:c:func:`DT_REG_ADDR` or :c:func:`DT_REG_SIZE`: +:c:macro:`DT_REG_ADDR` or :c:macro:`DT_REG_SIZE`: - ``DT_REG_ADDR(node_id)``: the given node's register block address - ``DT_REG_SIZE(node_id)``: its size -Use :c:func:`DT_REG_ADDR_BY_IDX` or :c:func:`DT_REG_SIZE_BY_IDX` instead if the +Use :c:macro:`DT_REG_ADDR_BY_IDX` or :c:macro:`DT_REG_SIZE_BY_IDX` instead if the node has multiple register blocks: - ``DT_REG_ADDR_BY_IDX(node_id, idx)``: address of register block at index @@ -261,7 +261,7 @@ Given a node identifier ``node_id``, ``DT_NUM_IRQS(node_id)`` is the total number of interrupt specifiers in the node's ``interrupts`` property. The most general purpose API macro for accessing these is -:c:func:`DT_IRQ_BY_IDX`: +:c:macro:`DT_IRQ_BY_IDX`: .. code-block:: c @@ -274,7 +274,7 @@ macro, check the bindings file for the node you are interested in to find the ``val`` names. Most Zephyr devicetree bindings have a cell named ``irq``, which is the -interrupt number. You can use :c:func:`DT_IRQN` as a convenient way to get a +interrupt number. You can use :c:macro:`DT_IRQN` as a convenient way to get a processed view of this value. .. warning:: @@ -302,8 +302,8 @@ syntax introduced in :ref:`dt-writing-property-values`. Properties which contain phandles have type ``phandle``, ``phandles``, or ``phandle-array`` in their bindings. We'll call these "phandle properties" for short. -You can convert a phandle to a node identifier using :c:func:`DT_PHANDLE`, -:c:func:`DT_PHANDLE_BY_IDX`, or :c:func:`DT_PHANDLE_BY_NAME`, depending on the +You can convert a phandle to a node identifier using :c:macro:`DT_PHANDLE`, +:c:macro:`DT_PHANDLE_BY_IDX`, or :c:macro:`DT_PHANDLE_BY_NAME`, depending on the type of property you are working with. One common use case for phandle properties is referring to other hardware in @@ -312,13 +312,13 @@ phandle to a Zephyr driver-level :ref:`struct device `. See :ref:`dt-get-device` for ways to do that. Another common use case is accessing specifier values in a phandle array. The -general purpose APIs for this are :c:func:`DT_PHA_BY_IDX` and :c:func:`DT_PHA`. -There are also hardware-specific shorthands like :c:func:`DT_GPIO_CTLR_BY_IDX`, -:c:func:`DT_GPIO_CTLR`, -:c:func:`DT_GPIO_PIN_BY_IDX`, :c:func:`DT_GPIO_PIN`, -:c:func:`DT_GPIO_FLAGS_BY_IDX`, and :c:func:`DT_GPIO_FLAGS`. +general purpose APIs for this are :c:macro:`DT_PHA_BY_IDX` and :c:macro:`DT_PHA`. +There are also hardware-specific shorthands like :c:macro:`DT_GPIO_CTLR_BY_IDX`, +:c:macro:`DT_GPIO_CTLR`, +:c:macro:`DT_GPIO_PIN_BY_IDX`, :c:macro:`DT_GPIO_PIN`, +:c:macro:`DT_GPIO_FLAGS_BY_IDX`, and :c:macro:`DT_GPIO_FLAGS`. -See :c:func:`DT_PHA_HAS_CELL_AT_IDX` and :c:func:`DT_PROP_HAS_IDX` for ways to +See :c:macro:`DT_PHA_HAS_CELL_AT_IDX` and :c:macro:`DT_PROP_HAS_IDX` for ways to check if a specifier value is present in a phandle property. .. _other-devicetree-apis: @@ -328,12 +328,12 @@ Other APIs Here are pointers to some other available APIs. -- :c:func:`DT_CHOSEN`, :c:func:`DT_HAS_CHOSEN`: for properties +- :c:macro:`DT_CHOSEN`, :c:macro:`DT_HAS_CHOSEN`: for properties of the special ``/chosen`` node -- :c:func:`DT_HAS_COMPAT_STATUS_OKAY`, :c:func:`DT_NODE_HAS_COMPAT`: global- and +- :c:macro:`DT_HAS_COMPAT_STATUS_OKAY`, :c:macro:`DT_NODE_HAS_COMPAT`: global- and node-specific tests related to the ``compatible`` property -- :c:func:`DT_BUS`: get a node's bus controller, if there is one -- :c:func:`DT_ENUM_IDX`: for properties whose values are among a fixed list of +- :c:macro:`DT_BUS`: get a node's bus controller, if there is one +- :c:macro:`DT_ENUM_IDX`: for properties whose values are among a fixed list of choices - :ref:`devicetree-flash-api`: APIs for managing fixed flash partitions. Also see :ref:`flash_map_api`, which wraps this in a more user-friendly API. @@ -346,7 +346,7 @@ rely on :ref:`instance identifiers `. To use these, you must define ``DT_DRV_COMPAT`` to the ``compat`` value your driver implements support for. This ``compat`` value is what you would pass to -:c:func:`DT_INST`. +:c:macro:`DT_INST`. If you do that, you can access the properties of individual instances of your compatible with less typing, like this: diff --git a/doc/build/dts/howtos.rst b/doc/build/dts/howtos.rst index b132e7ff1a7d9..def093f407845 100644 --- a/doc/build/dts/howtos.rst +++ b/doc/build/dts/howtos.rst @@ -101,7 +101,7 @@ works best for your requirements. Here are some examples: #define MY_SERIAL DT_PATH(soc, serial_40002000) Once you have a node identifier there are two ways to proceed. One way to get a -device is to use :c:func:`DEVICE_DT_GET`: +device is to use :c:macro:`DEVICE_DT_GET`: .. code-block:: c @@ -112,9 +112,9 @@ device is to use :c:func:`DEVICE_DT_GET`: return -ENODEV; } -There are variants of :c:func:`DEVICE_DT_GET` such as -:c:func:`DEVICE_DT_GET_OR_NULL`, :c:func:`DEVICE_DT_GET_ONE` or -:c:func:`DEVICE_DT_GET_ANY`. This idiom fetches the device pointer at +There are variants of :c:macro:`DEVICE_DT_GET` such as +:c:macro:`DEVICE_DT_GET_OR_NULL`, :c:macro:`DEVICE_DT_GET_ONE` or +:c:macro:`DEVICE_DT_GET_ANY`. This idiom fetches the device pointer at build-time, which means there is no runtime penalty. This method is useful if you want to store the device pointer as configuration data. But because the device may not be initialized, or may have failed to initialize, you must verify @@ -510,12 +510,12 @@ using instance numbers. Do this after defining ``my_api_funcs``. MY_DEV_INIT_LEVEL, MY_DEV_INIT_PRIORITY, \ &my_api_funcs); -Notice the use of APIs like :c:func:`DT_INST_PROP` and -:c:func:`DEVICE_DT_INST_DEFINE` to access devicetree node data. These +Notice the use of APIs like :c:macro:`DT_INST_PROP` and +:c:macro:`DEVICE_DT_INST_DEFINE` to access devicetree node data. These APIs retrieve data from the devicetree for instance number ``inst`` of the node with compatible determined by ``DT_DRV_COMPAT``. -Finally, pass the instantiation macro to :c:func:`DT_INST_FOREACH_STATUS_OKAY`: +Finally, pass the instantiation macro to :c:macro:`DT_INST_FOREACH_STATUS_OKAY`: .. code-block:: c @@ -534,7 +534,7 @@ Option 2: create devices using node labels Some device drivers cannot use instance numbers. One example is an SoC peripheral driver which relies on vendor HAL APIs specialized for individual IP blocks to implement Zephyr driver callbacks. Cases like this should use -:c:func:`DT_NODELABEL` to refer to individual nodes in the devicetree +:c:macro:`DT_NODELABEL` to refer to individual nodes in the devicetree representing the supported peripherals on the SoC. The devicetree.h :ref:`devicetree-generic-apis` can then be used to access node data. @@ -587,8 +587,8 @@ devicetree to operate on specific device nodes: MY_DEV_INIT_LEVEL, MY_DEV_INIT_PRIORITY, \ &my_api_funcs) -Notice the use of APIs like :c:func:`DT_PROP` and -:c:func:`DEVICE_DT_DEFINE` to access devicetree node data. +Notice the use of APIs like :c:macro:`DT_PROP` and +:c:macro:`DEVICE_DT_DEFINE` to access devicetree node data. Finally, manually detect each enabled devicetree node and use ``CREATE_MY_DEVICE`` to instantiate each ``struct device``: @@ -621,7 +621,7 @@ its SPI bus controller device. Some advice: - In particular, for bus devices, your driver's binding should include a file like :zephyr_file:`dts/bindings/spi/spi-device.yaml` which provides common definitions for devices addressable via a specific bus. This enables - use of APIs like :c:func:`DT_BUS` to obtain a node identifier for the bus + use of APIs like :c:macro:`DT_BUS` to obtain a node identifier for the bus node. You can then :ref:`dt-get-device` for the bus in the usual way. Search existing bindings and device drivers for examples. From 2ad01d966b7f5c499e3d52ffa37d75b40406bec7 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Thu, 7 Nov 2024 15:16:21 -0600 Subject: [PATCH 2210/4482] modules: hal: nxp: update to include fix for CACHE64_GetInstanceByAddr() CACHE64_GetInstanceByAddr() function was asserting when an instance was requested for an invalid address that the CACHE64 controller does not manage. This behavior is not correct, as the CACHE64 management functions check to see if the instance number returned by this function is out of range (and if so, simply return without modifying the cache). This assertion was causing a failure within the USDHC driver, which performs a cache clean/invalidate for tx/rx transfers within the HAL layer. When a transfer was run using a data buffer not in the CACHE64 address range, this assertion failed and caused the application to crash Fixes #80901 Signed-off-by: Daniel DeGrasse --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index ba68f6d18ce00..e6da3b2c34e8b 100644 --- a/west.yml +++ b/west.yml @@ -198,7 +198,7 @@ manifest: groups: - hal - name: hal_nxp - revision: 6e7d5cf2e6463e1b6c967d85ce0032deaa15fb59 + revision: c410b73bd00c2025b9f62bb53f99c5e8b6e45eb2 path: modules/hal/nxp groups: - hal From a8c3025de28233614525344d582b3eaae1417ccd Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Wed, 6 Nov 2024 11:40:19 -0800 Subject: [PATCH 2211/4482] MAINTAINERS: remove duplicate soc/cdns/dc233c This removes the duplicate soc/cdns/dc233c paths from the Xtensa arch. Signed-off-by: Daniel Leung --- MAINTAINERS.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 3e60959ea1653..f2d75109d55f4 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -5250,7 +5250,6 @@ Xtensa arch: - boards/qemu/xtensa/ - boards/cdns/xt-sim/ - soc/cdns/dc233c/ - - soc/cdns/dc233c/ - soc/cdns/xtensa_sample_controller/ - tests/arch/xtensa/ labels: From 9861a6a7c10a8b0f94971719768b79a3b9502065 Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Thu, 7 Nov 2024 14:41:32 -0600 Subject: [PATCH 2212/4482] drivers: flexspi_nor: Fix Flash failures seen on FRDM-MCXN947 The flash_flexspi_nor_check_jedec() checks the lower 16-bits of the manufacturer ID and installs a custom LUT table. Add an exception to check for the whole 32-bits so we do not accidentally install custom LUT for flash devices that do not support this LUT table. Signed-off-by: Mahesh Mahadevan --- drivers/flash/flash_mcux_flexspi_nor.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/flash/flash_mcux_flexspi_nor.c b/drivers/flash/flash_mcux_flexspi_nor.c index b2b045e1b02cc..ac6fdac8223f6 100644 --- a/drivers/flash/flash_mcux_flexspi_nor.c +++ b/drivers/flash/flash_mcux_flexspi_nor.c @@ -978,6 +978,13 @@ static int flash_flexspi_nor_check_jedec(struct flash_flexspi_nor_data *data, /* Still return an error- we want the JEDEC configuration to run */ return -ENOTSUP; case 0x40ef: + if ((vendor_id & 0xFFFFFF) != 0x2040ef) { + /* + * This is not the correct flash chip, and will not + * support the LUT table. Return here + */ + return -ENOTSUP; + } /* W25Q512JV flash, use 4 byte read/write */ flexspi_lut[READ][0] = FLEXSPI_LUT_SEQ( kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, SPI_NOR_CMD_4READ_4B, From c06ecf9a5083d2bf61fd00cc897548e25a56d10f Mon Sep 17 00:00:00 2001 From: Emilio Benavente Date: Wed, 6 Nov 2024 16:03:19 -0600 Subject: [PATCH 2213/4482] soc: nxp: mcxw: Update IRQ Size for MCXW to remove reserved IRQ The FRDM_MCXW71 Platform has a reserved IRQ as its last IRQ, this test was using this IRQ to test an interrupt and would not fire. This change ensures the test does not use the reserved IRQ. Signed-off-by: Emilio Benavente --- soc/nxp/mcx/mcxw/Kconfig.defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/nxp/mcx/mcxw/Kconfig.defconfig b/soc/nxp/mcx/mcxw/Kconfig.defconfig index 6a106466e67c6..8d715a3aaf712 100644 --- a/soc/nxp/mcx/mcxw/Kconfig.defconfig +++ b/soc/nxp/mcx/mcxw/Kconfig.defconfig @@ -4,7 +4,7 @@ if SOC_SERIES_MCXW config NUM_IRQS - default 76 + default 75 config SYS_CLOCK_HW_CYCLES_PER_SEC default 96000000 if CORTEX_M_SYSTICK From 3ca53ac518a029082df520a9d8c29b0d1a8ab003 Mon Sep 17 00:00:00 2001 From: Thomas Stranger Date: Fri, 8 Nov 2024 07:10:12 +0100 Subject: [PATCH 2214/4482] doc: release notes: add 1-wire release notes for 4.0 Add 1-Wire related release notes for Zephyr v4.0. Signed-off-by: Thomas Stranger --- doc/releases/release-notes-4.0.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 00b7bb2258f62..fd2fc682aa7db 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -526,6 +526,10 @@ Drivers and Sensors * Added support for more OmniVision OV2640 controls (:dtcompatible:`ovti,ov2640`) * Added support for more OmniVision OV5640 controls (:dtcompatible:`ovti,ov5640`) +* W1 + + * Added 1-Wire master driver for Analog Devices MAX32 SoC series (:dtcompatible:`adi,max32-w1`) + * Watchdog * Wi-Fi From e3ec7021962eb9be80b05b0c734b7b9b807efcb7 Mon Sep 17 00:00:00 2001 From: Dmitrii Golovanov Date: Wed, 6 Nov 2024 23:05:29 +0100 Subject: [PATCH 2215/4482] tests: drivers: ipm: Fix drivers.ipc.mailbox Fix 'drivers.ipc.mailbox' test suite to restore and improve its testing functionality: * fix printf() redirection through IPM console. * fix and check the dummy driver initialization. * specify correct Twister harness type (Console) and use matching patterns to recognize the expected console output. Signed-off-by: Dmitrii Golovanov --- tests/drivers/ipm/src/main.c | 41 +++++++++++++++++++++------------ tests/drivers/ipm/testcase.yaml | 19 +++++++++++++++ 2 files changed, 45 insertions(+), 15 deletions(-) diff --git a/tests/drivers/ipm/src/main.c b/tests/drivers/ipm/src/main.c index afd2d9ffce42c..6c1660798d09b 100644 --- a/tests/drivers/ipm/src/main.c +++ b/tests/drivers/ipm/src/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Intel Corporation + * Copyright (c) 2015-2024 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ @@ -34,7 +34,7 @@ extern struct ipm_driver_api ipm_dummy_api; struct ipm_dummy_driver_data ipm_dummy0_driver_data; DEVICE_DEFINE(ipm_dummy0, "ipm_dummy0", NULL, NULL, &ipm_dummy0_driver_data, NULL, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, + PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &ipm_dummy_api); /* Sending side of the console IPM driver, will forward anything sent @@ -81,24 +81,35 @@ int main(void) int rv, i; const struct device *ipm; + rv = TC_PASS; + TC_SUITE_START("test_ipm"); ipm = device_get_binding("ipm_dummy0"); - - /* Try sending a raw string to the IPM device to show that the - * receiver works - */ - for (i = 0; i < strlen(thestr); i++) { - ipm_send(ipm, 1, thestr[i], NULL, 0); + if (ipm == NULL) { + TC_ERROR("unable to get device 'ipm_dummy0'\n"); + rv = TC_FAIL; + } else { + /* Try sending a raw string to the IPM device to show that the + * receiver works + */ + int rc = 0; + + for (i = 0; i < strlen(thestr) && rc == 0; i++) { + rc = ipm_send(ipm, 1, thestr[i], NULL, 0); + } + if (rc) { + TC_ERROR("ipm_send() error=%u\n", rc); + rv = TC_FAIL; + } else { + /* Now do this through printf() to exercise the sender */ + /* I will be split to lines of LINE_BUF_SIZE */ + printf(LOREM_IPSUM_SHORT "\n"); + } } - - /* Now do this through printf() to exercise the sender */ - printf(LOREM_IPSUM_SHORT "\n"); - - /* XXX how to tell if something was actually printed out for - * automation purposes? + /* Twister Console Harness checks the output actually printed out for + * automation purposes. */ - rv = TC_PASS; TC_END_RESULT(rv); TC_SUITE_END("test_ipm", rv); TC_END_REPORT(rv); diff --git a/tests/drivers/ipm/testcase.yaml b/tests/drivers/ipm/testcase.yaml index 4a9da9054d087..7121a2f309147 100644 --- a/tests/drivers/ipm/testcase.yaml +++ b/tests/drivers/ipm/testcase.yaml @@ -8,3 +8,22 @@ tests: - ipc integration_platforms: - qemu_x86 + harness: console + harness_config: + type: multi_line + ordered: true + regex: + - "Running TESTSUITE test_ipm" + - "ipm_console: 'everything is awesome'" + - "ipm_console: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, \ + sed do eiusmod tempor '" + - "ipm_console: 'incididunt ut labore et dolore magna aliqua. Ut enim ad \ + minim veniam, quis nost'" + - "ipm_console: 'rud exercitation ullamco laboris nisi ut aliquip ex ea commodo \ + consequat. Duis '" + - "ipm_console: 'aute irure dolor in reprehenderit in voluptate velit esse cillum \ + dolore eu fugi'" + - "ipm_console: 'at nulla pariatur. Excepteur sint occaecat cupidatat non proident, \ + sunt in culp'" + - "ipm_console: 'a qui officia deserunt mollit anim id est laborum.'" + - "TESTSUITE test_ipm succeeded" From e8cf9601c12744a6bb459e870fdd7c411218abf9 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Wed, 6 Nov 2024 10:13:03 -0600 Subject: [PATCH 2216/4482] drivers: flash: mcx: Clear cache after erase Cache needs to be cleared after erase in order to read back erased values correctly. Signed-off-by: Declan Snyder --- drivers/flash/soc_flash_mcux.c | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/flash/soc_flash_mcux.c b/drivers/flash/soc_flash_mcux.c index 070535f76751c..8351c12162d3a 100644 --- a/drivers/flash/soc_flash_mcux.c +++ b/drivers/flash/soc_flash_mcux.c @@ -125,6 +125,32 @@ static status_t is_area_readable(uint32_t addr, size_t len) } #endif /* CONFIG_CHECK_BEFORE_READING && ! CONFIG_SOC_LPC55S36 */ +#define SOC_FLASH_NEED_CLEAR_CACHES 1 +#ifdef CONFIG_SOC_SERIES_MCXW +static void clear_flash_caches(void) +{ + volatile uint32_t *const smscm_ocmdr0 = (volatile uint32_t *)0x40015400; + /* this bit clears the flash cache */ + *smscm_ocmdr0 |= BIT(8); + volatile uint32_t *mcm_cpcr2 = (volatile uint32_t *)0xe0080034; + /* this bit clears the code cache */ + *mcm_cpcr2 |= BIT(0); +} +#elif CONFIG_SOC_SERIES_MCXN +static void clear_flash_caches(void) +{ + volatile uint32_t *const nvm_ctrl = (volatile uint32_t *)0x40000400; + /* this bit clears the flash cache */ + *nvm_ctrl |= BIT(5); + volatile uint32_t *const lpcac_ctrl = (volatile uint32_t *)0x40000824; + /* this bit clears the code cache */ + *lpcac_ctrl |= BIT(1); +} +#else +#undef SOC_FLASH_NEED_CLEAR_CACHES +#define clear_flash_caches(...) +#endif + struct flash_priv { flash_config_t config; /* @@ -172,6 +198,11 @@ static int flash_mcux_erase(const struct device *dev, off_t offset, (FMU_Type *) DT_INST_REG_ADDR(0), #endif addr, len, kFLASH_ApiEraseKey); + + if (IS_ENABLED(SOC_FLASH_NEED_CLEAR_CACHES)) { + clear_flash_caches(); + } + irq_unlock(key); k_sem_give(&priv->write_lock); @@ -277,6 +308,11 @@ static int flash_mcux_write(const struct device *dev, off_t offset, (FMU_Type *) DT_INST_REG_ADDR(0), #endif addr, (uint8_t *) data, len); + + if (IS_ENABLED(SOC_FLASH_NEED_CLEAR_CACHES)) { + clear_flash_caches(); + } + irq_unlock(key); k_sem_give(&priv->write_lock); From d7fe3d1a75c5b6828c98244e6d75c298701690d0 Mon Sep 17 00:00:00 2001 From: Dmitrii Golovanov Date: Sun, 3 Nov 2024 15:14:42 +0100 Subject: [PATCH 2217/4482] tests: crypto: tinycrypt: Fix premature Ztest end Don't use TC_END_RESULT() to report Ztest's result prematurely. Signed-off-by: Dmitrii Golovanov --- tests/crypto/tinycrypt/src/cbc_mode.c | 4 ++-- tests/crypto/tinycrypt/src/ccm_mode.c | 1 - tests/crypto/tinycrypt/src/cmac_mode.c | 5 ----- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/crypto/tinycrypt/src/cbc_mode.c b/tests/crypto/tinycrypt/src/cbc_mode.c index 8c1338255c3c5..bf309244c685a 100644 --- a/tests/crypto/tinycrypt/src/cbc_mode.c +++ b/tests/crypto/tinycrypt/src/cbc_mode.c @@ -128,7 +128,7 @@ ZTEST(tinycrypt, test_cbc_sp_800_38a_encrypt_decrypt) result = check_result(1, ciphertext, sizeof(encrypted), encrypted, sizeof(encrypted), 1); - TC_END_RESULT(result); + zassert_false(result, "CBC test #1 failed."); TC_PRINT("CBC test #2 (decryption SP 800-38a tests):\n"); (void)tc_aes128_set_decrypt_key(&a, key); @@ -145,5 +145,5 @@ ZTEST(tinycrypt, test_cbc_sp_800_38a_encrypt_decrypt) decrypted, sizeof(decrypted), 1); /**TESTPOINT: Check result*/ - zassert_false(result, "CBC test #1 failed."); + zassert_false(result, "CBC test #2 failed."); } diff --git a/tests/crypto/tinycrypt/src/ccm_mode.c b/tests/crypto/tinycrypt/src/ccm_mode.c index bd1d69b7cbc01..415a3bbc9f818 100644 --- a/tests/crypto/tinycrypt/src/ccm_mode.c +++ b/tests/crypto/tinycrypt/src/ccm_mode.c @@ -464,7 +464,6 @@ ZTEST(tinycrypt, test_ccm_vector_8) } result = TC_PASS; - TC_END_RESULT(result); /**TESTPOINT: Check result*/ zassert_false(result, "CCM test #8 (no payload data) failed."); diff --git a/tests/crypto/tinycrypt/src/cmac_mode.c b/tests/crypto/tinycrypt/src/cmac_mode.c index be9817927f2d5..888897643d645 100644 --- a/tests/crypto/tinycrypt/src/cmac_mode.c +++ b/tests/crypto/tinycrypt/src/cmac_mode.c @@ -111,7 +111,6 @@ static uint32_t verify_gf_2_128_double(uint8_t *K1, uint8_t *K2, struct tc_cmac_ return TC_FAIL; } - TC_END_RESULT(result); return result; } @@ -138,7 +137,6 @@ static uint32_t verify_cmac_null_msg(TCCmacState_t s) return TC_FAIL; } - TC_END_RESULT(result); return result; } @@ -170,7 +168,6 @@ static uint32_t verify_cmac_1_block_msg(TCCmacState_t s) return TC_FAIL; } - TC_END_RESULT(result); return result; } @@ -205,7 +202,6 @@ static uint32_t verify_cmac_320_bit_msg(TCCmacState_t s) return TC_FAIL; } - TC_END_RESULT(result); return result; } @@ -243,7 +239,6 @@ static uint32_t verify_cmac_512_bit_msg(TCCmacState_t s) return TC_FAIL; } - TC_END_RESULT(result); return result; } From 42ae483795ff6abed6b75ee407c8521ca21d2189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Wed, 6 Nov 2024 12:34:15 +0100 Subject: [PATCH 2218/4482] Bluetooth: Host: Ensure only connected peers affect `_bt_gatt_ccc.value` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The doc on `_bt_gatt_ccc.value` specifies that only connected peers contribute to that value. But before this change, it was computed from all entries in `_bt_gatt_ccc.cfg`, which include bonded but not connected peers when `CONFIG_BT_SETTINGS_CCC_LAZY_LOADING` is set. Co-authored-by: Aleksander Wasaznik Signed-off-by: Håvard Reierstad --- subsys/bluetooth/host/gatt.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index 33d8bc8b60bbf..118af2097afe0 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -2195,8 +2195,17 @@ static void gatt_ccc_changed(const struct bt_gatt_attr *attr, uint16_t value = 0x0000; for (i = 0; i < ARRAY_SIZE(ccc->cfg); i++) { - if (ccc->cfg[i].value > value) { - value = ccc->cfg[i].value; + /* `ccc->value` shall be a summary of connected peers' CCC values, but + * `ccc->cfg` can contain entries for bonded but not connected peers. + */ + struct bt_conn *conn = bt_conn_lookup_addr_le(ccc->cfg[i].id, &ccc->cfg[i].peer); + + if (conn) { + if (ccc->cfg[i].value > value) { + value = ccc->cfg[i].value; + } + + bt_conn_unref(conn); } } From d565f6e62a3a7fc181759bad9f395f64c4b72c09 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Mon, 4 Nov 2024 14:17:26 -0600 Subject: [PATCH 2219/4482] samples: drivers: display: remove lpc54114 from shield test LPC54114 does not define arduino_header nodelabel, so it cannot be supported by the shield test within the display sample. Replace with mimxrt1010_evk, which is supported. Fixes #80876 Signed-off-by: Daniel DeGrasse --- samples/drivers/display/sample.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/drivers/display/sample.yaml b/samples/drivers/display/sample.yaml index 41e728e38b366..252d5313fc9e6 100644 --- a/samples/drivers/display/sample.yaml +++ b/samples/drivers/display/sample.yaml @@ -73,7 +73,7 @@ tests: - platform:mimxrt685_evk/mimxrt685/cm33:SHIELD=waveshare_epaper_gdeh0213b1 - platform:nucleo_l433rc_p:SHIELD=waveshare_epaper_gdew042t2 - platform:nrf52dk/nrf52832:SHIELD=st7789v_tl019fqv01 - - platform:lpcxpresso54114/lpc54114/m4:SHIELD=st7789v_waveshare_240x240 + - platform:mimxrt1010_evk/mimxrt1011:SHIELD=st7789v_waveshare_240x240 - platform:frdm_k22f:SHIELD=ls013b7dh03 - platform:nrf52833dk/nrf52833:SHIELD=st7735r_ada_160x128 - platform:mimxrt1170_evk@B/mimxrt1176/cm7:SHIELD=rk055hdmipi4m From fc3ebac704d14237508f322917f6f7a22f1f36c2 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Mon, 4 Nov 2024 14:25:55 -0600 Subject: [PATCH 2220/4482] samples: drivers: display: make platform names fully qualified Twister's extra arguments feature only works correctly if the fully qualified platform name is given, which was not the case. Make all platform names for the shield testcase fully qualified to resolve this. Fixes #80876 Signed-off-by: Daniel DeGrasse --- samples/drivers/display/sample.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/samples/drivers/display/sample.yaml b/samples/drivers/display/sample.yaml index 252d5313fc9e6..4e22184dce89b 100644 --- a/samples/drivers/display/sample.yaml +++ b/samples/drivers/display/sample.yaml @@ -69,20 +69,20 @@ tests: extra_args: - platform:lpcxpresso55s69/lpc55s69/cpu0:SHIELD=adafruit_2_8_tft_touch_v2 - platform:nrf52840dk/nrf52840:SHIELD=ssd1306_128x32 - - platform:frdm_k64f:SHIELD=ssd1306_128x64 + - platform:frdm_k64f/mk64f12:SHIELD=ssd1306_128x64 - platform:mimxrt685_evk/mimxrt685/cm33:SHIELD=waveshare_epaper_gdeh0213b1 - - platform:nucleo_l433rc_p:SHIELD=waveshare_epaper_gdew042t2 + - platform:nucleo_l433rc_p/stm32l433xx:SHIELD=waveshare_epaper_gdew042t2 - platform:nrf52dk/nrf52832:SHIELD=st7789v_tl019fqv01 - platform:mimxrt1010_evk/mimxrt1011:SHIELD=st7789v_waveshare_240x240 - - platform:frdm_k22f:SHIELD=ls013b7dh03 + - platform:frdm_k22f/mk22f51212:SHIELD=ls013b7dh03 - platform:nrf52833dk/nrf52833:SHIELD=st7735r_ada_160x128 - - platform:mimxrt1170_evk@B/mimxrt1176/cm7:SHIELD=rk055hdmipi4m - - platform:da1469x_dk_pro:DTC_OVERLAY_FILE=da1469x_dk_pro_mipi_dbi.overlay + - platform:mimxrt1170_evk/mimxrt1176/cm7:SHIELD=rk055hdmipi4m + - platform:da1469x_dk_pro/da14699:DTC_OVERLAY_FILE=da1469x_dk_pro_mipi_dbi.overlay - platform:nrf52840dk/nrf52840:SHIELD=max7219_8x8 - platform:stm32h747i_disco/stm32h747xx/m7:SHIELD=st_b_lcd40_dsi1_mb1166 - - platform:mimxrt1064_evk:SHIELD=rk043fn66hs_ctg - - platform:mimxrt1060_evk:SHIELD=rk043fn66hs_ctg - - platform:mimxrt1050_evk:SHIELD=rk043fn66hs_ctg - - platform:mimxrt1040_evk:SHIELD=rk043fn66hs_ctg + - platform:mimxrt1064_evk/mimxrt1064:SHIELD=rk043fn66hs_ctg + - platform:mimxrt1060_evk/mimxrt1062:SHIELD=rk043fn66hs_ctg + - platform:mimxrt1050_evk/mimxrt1052:SHIELD=rk043fn66hs_ctg + - platform:mimxrt1040_evk/mimxrt1042:SHIELD=rk043fn66hs_ctg - platform:frdm_mcxn947/mcxn947/cpu0:SHIELD=lcd_par_s035_8080 - - platform:frdm_mcxn236:SHIELD=lcd_par_s035_8080 + - platform:frdm_mcxn236/mcxn236:SHIELD=lcd_par_s035_8080 From 1cf44557c5132b59768bc6a1beffd8fd17438498 Mon Sep 17 00:00:00 2001 From: Marek Matej Date: Tue, 5 Nov 2024 22:01:27 +0000 Subject: [PATCH 2221/4482] manifest: update hal_espressif Fetch latest features to support fixes. Signed-off-by: Marek Matej --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index e6da3b2c34e8b..fe3c5dfa7800a 100644 --- a/west.yml +++ b/west.yml @@ -157,7 +157,7 @@ manifest: groups: - hal - name: hal_espressif - revision: 23c17a8735d3047da95e3a81adafa36425636c55 + revision: 174547ef6a97dafcd6786ecd171cc701f5c0893b path: modules/hal/espressif west-commands: west/west-commands.yml groups: From f3e70fdd75556658b9d82d930a3142264f44f907 Mon Sep 17 00:00:00 2001 From: Marek Matej Date: Wed, 4 Sep 2024 13:59:40 +0200 Subject: [PATCH 2222/4482] dts: esp32s3: shm nodes update Align the shared memories with the memory.h layout. Reorder nodes to show memory related nodes together. Signed-off-by: Marek Matej --- .../espressif/esp32s3/esp32s3_common.dtsi | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/dts/xtensa/espressif/esp32s3/esp32s3_common.dtsi b/dts/xtensa/espressif/esp32s3/esp32s3_common.dtsi index 3a50e60d249be..777f7959f34f4 100644 --- a/dts/xtensa/espressif/esp32s3/esp32s3_common.dtsi +++ b/dts/xtensa/espressif/esp32s3/esp32s3_common.dtsi @@ -91,14 +91,39 @@ reg = <0x3fc88000 0x77FFF>; }; - ipmmem0: memory@3fcbd000 { + ipmmem0: memory@3fcb2000 { compatible = "mmio-sram"; - reg = <0x3fcbd000 0x400>; + reg = <0x3fcb2000 0x400>; }; - shm0: memory@3fcbd400 { + shm0: memory@3fcb2400 { compatible = "mmio-sram"; - reg = <0x3fcbd400 0x4000>; + reg = <0x3fcb2400 0x3c00>; + }; + + ipm0: ipm@3fcb6000 { + compatible = "espressif,esp32-ipm"; + reg = <0x3fcb6000 0x8>; + status = "disabled"; + shared-memory = <&ipmmem0>; + shared-memory-size = <0x400>; + interrupts = + , + ; + interrupt-parent = <&intc>; + }; + + mbox0: mbox@3fcb6008 { + compatible = "espressif,mbox-esp32"; + reg = <0x3fcb6008 0x8>; + status = "disabled"; + shared-memory = <&ipmmem0>; + shared-memory-size = <0x400>; + interrupts = + , + ; + interrupt-parent = <&intc>; + #mbox-cells = <1>; }; intc: interrupt-controller@600c2000 { @@ -159,31 +184,6 @@ status = "disabled"; }; - ipm0: ipm@3fcc1400 { - compatible = "espressif,esp32-ipm"; - reg = <0x3fcc1400 0x8>; - status = "disabled"; - shared-memory = <&ipmmem0>; - shared-memory-size = <0x400>; - interrupts = - , - ; - interrupt-parent = <&intc>; - }; - - mbox0: mbox@3fcc1408 { - compatible = "espressif,mbox-esp32"; - reg = <0x3fcc1408 0x8>; - status = "disabled"; - shared-memory = <&ipmmem0>; - shared-memory-size = <0x400>; - interrupts = - , - ; - interrupt-parent = <&intc>; - #mbox-cells = <1>; - }; - uart0: uart@60000000 { compatible = "espressif,esp32-uart"; reg = <0x60000000 0x1000>; From 93121879cffeddad89a1f7db5c82afa55ef821a9 Mon Sep 17 00:00:00 2001 From: Marek Matej Date: Tue, 5 Nov 2024 19:56:18 +0000 Subject: [PATCH 2223/4482] boards: esp32s3: AMP support and fixes Fix missing flash and code partition. Add missing dts entries and use common partition tables to all related non-Espressif boards, previously ommited. Add uart1 node in pinctrl for APPCPU. Signed-off-by: Marek Matej --- .../walter/walter_esp32s3_appcpu.dts | 2 + .../esp32s3_devkitc-pinctrl.dtsi | 11 +++++ .../esp32s3_devkitc_appcpu.dts | 3 ++ .../esp32s3_devkitc_procpu.dts | 4 +- .../esp32s3_devkitm-pinctrl.dtsi | 11 +++++ .../esp32s3_devkitm_appcpu.dts | 3 ++ .../esp32s3_devkitm_appcpu_defconfig | 3 +- .../esp32s3_devkitm_procpu.dts | 2 +- .../esp32s3_devkitm_procpu_defconfig | 2 +- .../esp32s3_eye/esp32s3_eye_appcpu.dts | 43 ++----------------- .../heltec_wireless_stick_lite_v3_appcpu.dts | 43 ++----------------- .../esp32s3_luatos_core.dtsi | 40 +---------------- .../esp32s3_luatos_core_appcpu.dts | 43 ++----------------- .../esp32s3_luatos_core_appcpu_usb.dts | 43 ++----------------- .../m5stack_atoms3/m5stack_atoms3_appcpu.dts | 43 ++----------------- .../m5stack_atoms3/m5stack_atoms3_procpu.dts | 36 +--------------- .../m5stack_atoms3_lite_appcpu.dts | 43 ++----------------- .../m5stack_atoms3_lite_procpu.dts | 36 +--------------- .../m5stack_stamps3_appcpu.dts | 43 ++----------------- .../m5stack_stamps3_procpu.dts | 36 +--------------- .../m5stickc_plus/m5stickc_plus_appcpu.dts | 40 +---------------- .../m5stickc_plus/m5stickc_plus_procpu.dts | 40 +---------------- boards/others/icev_wireless/icev_wireless.dts | 36 +--------------- boards/seeed/xiao_esp32c3/xiao_esp32c3.dts | 35 +-------------- .../xiao_esp32s3/xiao_esp32s3_appcpu.dts | 43 ++----------------- .../xiao_esp32s3/xiao_esp32s3_procpu.dts | 2 + .../xiao_esp32s3_procpu_common.dtsi | 35 --------------- .../xiao_esp32s3_procpu_sense.dts | 1 + .../esp32s3_touch_lcd_1_28_esp32s3_appcpu.dts | 42 +++--------------- 29 files changed, 83 insertions(+), 681 deletions(-) diff --git a/boards/dptechnics/walter/walter_esp32s3_appcpu.dts b/boards/dptechnics/walter/walter_esp32s3_appcpu.dts index a2ef2198559c0..b886a2cec6cab 100644 --- a/boards/dptechnics/walter/walter_esp32s3_appcpu.dts +++ b/boards/dptechnics/walter/walter_esp32s3_appcpu.dts @@ -16,6 +16,8 @@ zephyr,sram = &sram0; zephyr,ipc_shm = &shm0; zephyr,ipc = &ipm0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_appcpu_partition; }; }; diff --git a/boards/espressif/esp32s3_devkitc/esp32s3_devkitc-pinctrl.dtsi b/boards/espressif/esp32s3_devkitc/esp32s3_devkitc-pinctrl.dtsi index 2967cce447d43..0eef5f1add78c 100644 --- a/boards/espressif/esp32s3_devkitc/esp32s3_devkitc-pinctrl.dtsi +++ b/boards/espressif/esp32s3_devkitc/esp32s3_devkitc-pinctrl.dtsi @@ -20,6 +20,17 @@ }; }; + uart1_default: uart1_default { + group1 { + pinmux = ; + output-high; + }; + group2 { + pinmux = ; + bias-pull-up; + }; + }; + i2c0_default: i2c0_default { group1 { pinmux = , diff --git a/boards/espressif/esp32s3_devkitc/esp32s3_devkitc_appcpu.dts b/boards/espressif/esp32s3_devkitc/esp32s3_devkitc_appcpu.dts index cddc827b4e350..b1ad215672403 100644 --- a/boards/espressif/esp32s3_devkitc/esp32s3_devkitc_appcpu.dts +++ b/boards/espressif/esp32s3_devkitc/esp32s3_devkitc_appcpu.dts @@ -7,6 +7,7 @@ #include #include +#include "esp32s3_devkitc-pinctrl.dtsi" / { model = "Espressif ESP32S3-DevkitC APPCPU"; @@ -16,6 +17,8 @@ zephyr,sram = &sram0; zephyr,ipc_shm = &shm0; zephyr,ipc = &ipm0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_appcpu_partition; }; }; diff --git a/boards/espressif/esp32s3_devkitc/esp32s3_devkitc_procpu.dts b/boards/espressif/esp32s3_devkitc/esp32s3_devkitc_procpu.dts index cae78713f81e2..99810fa22c75c 100644 --- a/boards/espressif/esp32s3_devkitc/esp32s3_devkitc_procpu.dts +++ b/boards/espressif/esp32s3_devkitc/esp32s3_devkitc_procpu.dts @@ -5,11 +5,11 @@ */ /dts-v1/; -#include "espressif/esp32s3/esp32s3_wroom_n8.dtsi" -#include "esp32s3_devkitc-pinctrl.dtsi" +#include #include #include #include +#include "esp32s3_devkitc-pinctrl.dtsi" / { model = "Espressif ESP32S3-DevkitC PROCPU"; diff --git a/boards/espressif/esp32s3_devkitm/esp32s3_devkitm-pinctrl.dtsi b/boards/espressif/esp32s3_devkitm/esp32s3_devkitm-pinctrl.dtsi index aa048eb4b7ff9..adbe936cb2ac7 100644 --- a/boards/espressif/esp32s3_devkitm/esp32s3_devkitm-pinctrl.dtsi +++ b/boards/espressif/esp32s3_devkitm/esp32s3_devkitm-pinctrl.dtsi @@ -20,6 +20,17 @@ }; }; + uart1_default: uart1_default { + group1 { + pinmux = ; + output-high; + }; + group2 { + pinmux = ; + bias-pull-up; + }; + }; + i2c0_default: i2c0_default { group1 { pinmux = , diff --git a/boards/espressif/esp32s3_devkitm/esp32s3_devkitm_appcpu.dts b/boards/espressif/esp32s3_devkitm/esp32s3_devkitm_appcpu.dts index 0a758507c3f48..a74e8f91751e3 100644 --- a/boards/espressif/esp32s3_devkitm/esp32s3_devkitm_appcpu.dts +++ b/boards/espressif/esp32s3_devkitm/esp32s3_devkitm_appcpu.dts @@ -7,6 +7,7 @@ #include #include +#include "esp32s3_devkitm-pinctrl.dtsi" / { model = "Espressif ESP32S3-DevkitM APPCPU"; @@ -16,6 +17,8 @@ zephyr,sram = &sram0; zephyr,ipc_shm = &shm0; zephyr,ipc = &ipm0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_appcpu_partition; }; }; diff --git a/boards/espressif/esp32s3_devkitm/esp32s3_devkitm_appcpu_defconfig b/boards/espressif/esp32s3_devkitm/esp32s3_devkitm_appcpu_defconfig index 9abf2ff0430ab..1ac2b1c55c9b7 100644 --- a/boards/espressif/esp32s3_devkitm/esp32s3_devkitm_appcpu_defconfig +++ b/boards/espressif/esp32s3_devkitm/esp32s3_devkitm_appcpu_defconfig @@ -1,4 +1,3 @@ # SPDX-License-Identifier: Apache-2.0 -CONFIG_MAIN_STACK_SIZE=2048 -CONFIG_CLOCK_CONTROL=y +CONFIG_MAIN_STACK_SIZE=4096 diff --git a/boards/espressif/esp32s3_devkitm/esp32s3_devkitm_procpu.dts b/boards/espressif/esp32s3_devkitm/esp32s3_devkitm_procpu.dts index d168e97fe60f7..7b758eedd4d44 100644 --- a/boards/espressif/esp32s3_devkitm/esp32s3_devkitm_procpu.dts +++ b/boards/espressif/esp32s3_devkitm/esp32s3_devkitm_procpu.dts @@ -6,10 +6,10 @@ /dts-v1/; #include -#include "esp32s3_devkitm-pinctrl.dtsi" #include #include #include +#include "esp32s3_devkitm-pinctrl.dtsi" / { model = "Espressif ESP32S3-DevkitM PROCPU"; diff --git a/boards/espressif/esp32s3_devkitm/esp32s3_devkitm_procpu_defconfig b/boards/espressif/esp32s3_devkitm/esp32s3_devkitm_procpu_defconfig index d789bab1824a6..92308aa841b2e 100644 --- a/boards/espressif/esp32s3_devkitm/esp32s3_devkitm_procpu_defconfig +++ b/boards/espressif/esp32s3_devkitm/esp32s3_devkitm_procpu_defconfig @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 -CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_MAIN_STACK_SIZE=4096 CONFIG_CONSOLE=y CONFIG_SERIAL=y diff --git a/boards/espressif/esp32s3_eye/esp32s3_eye_appcpu.dts b/boards/espressif/esp32s3_eye/esp32s3_eye_appcpu.dts index 4b5d624018513..f51ffacab0bdf 100644 --- a/boards/espressif/esp32s3_eye/esp32s3_eye_appcpu.dts +++ b/boards/espressif/esp32s3_eye/esp32s3_eye_appcpu.dts @@ -6,6 +6,8 @@ /dts-v1/; #include +#include + / { model = "Espressif ESP32S3-EYE APPCPU"; compatible = "espressif,esp32s3"; @@ -14,6 +16,8 @@ zephyr,sram = &sram0; zephyr,ipc_shm = &shm0; zephyr,ipc = &ipm0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_appcpu_partition; }; }; @@ -24,42 +28,3 @@ &ipm0 { status = "okay"; }; - -&flash0 { - status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* Reserve 64kB for the bootloader */ - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x00010000>; - read-only; - }; - - /* Reserve 1024kB for the application in slot 0 */ - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - /* Reserve 1024kB for the application in slot 1 */ - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - /* Reserve 256kB for the scratch partition */ - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; diff --git a/boards/heltec/heltec_wireless_stick_lite_v3/heltec_wireless_stick_lite_v3_appcpu.dts b/boards/heltec/heltec_wireless_stick_lite_v3/heltec_wireless_stick_lite_v3_appcpu.dts index 92bde107bc3a8..9a5e3eb304b12 100644 --- a/boards/heltec/heltec_wireless_stick_lite_v3/heltec_wireless_stick_lite_v3_appcpu.dts +++ b/boards/heltec/heltec_wireless_stick_lite_v3/heltec_wireless_stick_lite_v3_appcpu.dts @@ -6,6 +6,8 @@ /dts-v1/; #include +#include + / { model = "Heltec Wireless Stick Lite V3 APPCPU"; compatible = "espressif,esp32s3"; @@ -14,6 +16,8 @@ zephyr,sram = &sram0; zephyr,ipc_shm = &shm0; zephyr,ipc = &ipm0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_appcpu_partition; }; }; @@ -24,42 +28,3 @@ &ipm0 { status = "okay"; }; - -&flash0 { - status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* Reserve 64kB for the bootloader */ - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x00010000>; - read-only; - }; - - /* Reserve 1024kB for the application in slot 0 */ - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - /* Reserve 1024kB for the application in slot 1 */ - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - /* Reserve 256kB for the scratch partition */ - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; diff --git a/boards/luatos/esp32s3_luatos_core/esp32s3_luatos_core.dtsi b/boards/luatos/esp32s3_luatos_core/esp32s3_luatos_core.dtsi index 60365fdcd65a3..43ee4b452646f 100644 --- a/boards/luatos/esp32s3_luatos_core/esp32s3_luatos_core.dtsi +++ b/boards/luatos/esp32s3_luatos_core/esp32s3_luatos_core.dtsi @@ -7,6 +7,7 @@ #include #include "esp32s3_luatos_core-pinctrl.dtsi" #include +#include / { leds { @@ -103,45 +104,6 @@ status = "okay"; }; -&flash0 { - status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* Reserve 64kB for the bootloader */ - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x00010000>; - read-only; - }; - - /* Reserve 1024kB for the application in slot 0 */ - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - /* Reserve 1024kB for the application in slot 1 */ - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - /* Reserve 256kB for the scratch partition */ - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; - &esp32_bt_hci { status = "okay"; }; diff --git a/boards/luatos/esp32s3_luatos_core/esp32s3_luatos_core_appcpu.dts b/boards/luatos/esp32s3_luatos_core/esp32s3_luatos_core_appcpu.dts index 510e587925ea7..611a3b648492b 100644 --- a/boards/luatos/esp32s3_luatos_core/esp32s3_luatos_core_appcpu.dts +++ b/boards/luatos/esp32s3_luatos_core/esp32s3_luatos_core_appcpu.dts @@ -6,6 +6,8 @@ /dts-v1/; #include +#include + / { model = "ESP32S3 Luatos Core APPCPU"; compatible = "espressif,esp32s3"; @@ -14,6 +16,8 @@ zephyr,sram = &sram0; zephyr,ipc_shm = &shm0; zephyr,ipc = &ipm0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_appcpu_partition; }; }; @@ -24,42 +28,3 @@ &ipm0 { status = "okay"; }; - -&flash0 { - status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* Reserve 64kB for the bootloader */ - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x00010000>; - read-only; - }; - - /* Reserve 1024kB for the application in slot 0 */ - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - /* Reserve 1024kB for the application in slot 1 */ - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - /* Reserve 256kB for the scratch partition */ - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; diff --git a/boards/luatos/esp32s3_luatos_core/esp32s3_luatos_core_appcpu_usb.dts b/boards/luatos/esp32s3_luatos_core/esp32s3_luatos_core_appcpu_usb.dts index b36963af0134b..8a383ad135d9b 100644 --- a/boards/luatos/esp32s3_luatos_core/esp32s3_luatos_core_appcpu_usb.dts +++ b/boards/luatos/esp32s3_luatos_core/esp32s3_luatos_core_appcpu_usb.dts @@ -6,6 +6,8 @@ /dts-v1/; #include +#include + / { model = "ESP32S3 Luatos Core USB APPCPU"; compatible = "espressif,esp32s3"; @@ -14,6 +16,8 @@ zephyr,sram = &sram0; zephyr,ipc_shm = &shm0; zephyr,ipc = &ipm0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_appcpu_partition; }; }; @@ -24,42 +28,3 @@ &ipm0 { status = "okay"; }; - -&flash0 { - status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* Reserve 64kB for the bootloader */ - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x00010000>; - read-only; - }; - - /* Reserve 1024kB for the application in slot 0 */ - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - /* Reserve 1024kB for the application in slot 1 */ - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - /* Reserve 256kB for the scratch partition */ - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; diff --git a/boards/m5stack/m5stack_atoms3/m5stack_atoms3_appcpu.dts b/boards/m5stack/m5stack_atoms3/m5stack_atoms3_appcpu.dts index a117ee02922fb..ab05fa95eba63 100644 --- a/boards/m5stack/m5stack_atoms3/m5stack_atoms3_appcpu.dts +++ b/boards/m5stack/m5stack_atoms3/m5stack_atoms3_appcpu.dts @@ -6,6 +6,8 @@ /dts-v1/; #include +#include + / { model = "M5Stack AtomS3 APPCPU"; compatible = "espressif,esp32s3"; @@ -14,6 +16,8 @@ zephyr,sram = &sram0; zephyr,ipc_shm = &shm0; zephyr,ipc = &ipm0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_appcpu_partition; }; }; @@ -24,42 +28,3 @@ &ipm0 { status = "okay"; }; - -&flash0 { - status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* Reserve 64kB for the bootloader */ - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x00010000>; - read-only; - }; - - /* Reserve 1024kB for the application in slot 0 */ - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - /* Reserve 1024kB for the application in slot 1 */ - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - /* Reserve 256kB for the scratch partition */ - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; diff --git a/boards/m5stack/m5stack_atoms3/m5stack_atoms3_procpu.dts b/boards/m5stack/m5stack_atoms3/m5stack_atoms3_procpu.dts index dd20fb00a8d9e..dec42a668986e 100644 --- a/boards/m5stack/m5stack_atoms3/m5stack_atoms3_procpu.dts +++ b/boards/m5stack/m5stack_atoms3/m5stack_atoms3_procpu.dts @@ -10,6 +10,7 @@ #include "grove_connectors.dtsi" #include #include +#include / { model = "M5Stack AtomS3 PROCPU"; @@ -154,41 +155,6 @@ status = "okay"; }; -&flash0 { - status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x0000F000>; - read-only; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; - &esp32_bt_hci { status = "okay"; }; diff --git a/boards/m5stack/m5stack_atoms3_lite/m5stack_atoms3_lite_appcpu.dts b/boards/m5stack/m5stack_atoms3_lite/m5stack_atoms3_lite_appcpu.dts index 2323548e7fcd9..9eab1cb663de6 100644 --- a/boards/m5stack/m5stack_atoms3_lite/m5stack_atoms3_lite_appcpu.dts +++ b/boards/m5stack/m5stack_atoms3_lite/m5stack_atoms3_lite_appcpu.dts @@ -6,6 +6,8 @@ /dts-v1/; #include +#include + / { model = "M5Stack AtomS3 Lite APPCPU"; compatible = "espressif,esp32s3"; @@ -14,6 +16,8 @@ zephyr,sram = &sram0; zephyr,ipc_shm = &shm0; zephyr,ipc = &ipm0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_appcpu_partition; }; }; @@ -24,42 +28,3 @@ &ipm0 { status = "okay"; }; - -&flash0 { - status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* Reserve 64kB for the bootloader */ - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x00010000>; - read-only; - }; - - /* Reserve 1024kB for the application in slot 0 */ - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - /* Reserve 1024kB for the application in slot 1 */ - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - /* Reserve 256kB for the scratch partition */ - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; diff --git a/boards/m5stack/m5stack_atoms3_lite/m5stack_atoms3_lite_procpu.dts b/boards/m5stack/m5stack_atoms3_lite/m5stack_atoms3_lite_procpu.dts index 166ee2014ca01..457d4fa628773 100644 --- a/boards/m5stack/m5stack_atoms3_lite/m5stack_atoms3_lite_procpu.dts +++ b/boards/m5stack/m5stack_atoms3_lite/m5stack_atoms3_lite_procpu.dts @@ -11,6 +11,7 @@ #include #include #include +#include / { model = "M5Stack AtomS3 Lite PROCPU"; @@ -112,41 +113,6 @@ status = "okay"; }; -&flash0 { - status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x0000F000>; - read-only; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; - &esp32_bt_hci { status = "okay"; }; diff --git a/boards/m5stack/m5stack_stamps3/m5stack_stamps3_appcpu.dts b/boards/m5stack/m5stack_stamps3/m5stack_stamps3_appcpu.dts index ce947b579724c..d12429f633e62 100644 --- a/boards/m5stack/m5stack_stamps3/m5stack_stamps3_appcpu.dts +++ b/boards/m5stack/m5stack_stamps3/m5stack_stamps3_appcpu.dts @@ -6,6 +6,8 @@ /dts-v1/; #include +#include + / { model = "M5Stack StampS3 APPCPU"; compatible = "espressif,esp32s3"; @@ -14,6 +16,8 @@ zephyr,sram = &sram0; zephyr,ipc_shm = &shm0; zephyr,ipc = &ipm0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_appcpu_partition; }; }; @@ -24,42 +28,3 @@ &ipm0 { status = "okay"; }; - -&flash0 { - status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* Reserve 64kB for the bootloader */ - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x00010000>; - read-only; - }; - - /* Reserve 1024kB for the application in slot 0 */ - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - /* Reserve 1024kB for the application in slot 1 */ - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - /* Reserve 256kB for the scratch partition */ - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; diff --git a/boards/m5stack/m5stack_stamps3/m5stack_stamps3_procpu.dts b/boards/m5stack/m5stack_stamps3/m5stack_stamps3_procpu.dts index 9e231fba57f0d..2abacdd87ed41 100644 --- a/boards/m5stack/m5stack_stamps3/m5stack_stamps3_procpu.dts +++ b/boards/m5stack/m5stack_stamps3/m5stack_stamps3_procpu.dts @@ -12,6 +12,7 @@ #include #include #include +#include / { model = "M5Stack StampS3 PROCPU"; @@ -152,41 +153,6 @@ status = "okay"; }; -&flash0 { - status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x0000F000>; - read-only; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; - &esp32_bt_hci { status = "okay"; }; diff --git a/boards/m5stack/m5stickc_plus/m5stickc_plus_appcpu.dts b/boards/m5stack/m5stickc_plus/m5stickc_plus_appcpu.dts index 1911e4fe56d55..c2764a78f3402 100644 --- a/boards/m5stack/m5stickc_plus/m5stickc_plus_appcpu.dts +++ b/boards/m5stack/m5stickc_plus/m5stickc_plus_appcpu.dts @@ -6,6 +6,7 @@ /dts-v1/; #include +#include / { model = "M5StickC Plus APPCPU"; @@ -25,42 +26,3 @@ &trng0 { status = "okay"; }; - -&flash0 { - status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* Reserve 60kB for the bootloader */ - boot_partition: partition@1000 { - label = "mcuboot"; - reg = <0x00001000 0x0000F000>; - read-only; - }; - - /* Reserve 1024kB for the application in slot 0 */ - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - /* Reserve 1024kB for the application in slot 1 */ - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - /* Reserve 256kB for the scratch partition */ - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; diff --git a/boards/m5stack/m5stickc_plus/m5stickc_plus_procpu.dts b/boards/m5stack/m5stickc_plus/m5stickc_plus_procpu.dts index 28779d87ecb4b..940d888bfd264 100644 --- a/boards/m5stack/m5stickc_plus/m5stickc_plus_procpu.dts +++ b/boards/m5stack/m5stickc_plus/m5stickc_plus_procpu.dts @@ -10,6 +10,7 @@ #include #include #include +#include / { model = "M5StickC Plus PROCPU"; @@ -214,45 +215,6 @@ status = "okay"; }; -&flash0 { - status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* Reserve 60kB for the bootloader */ - boot_partition: partition@1000 { - label = "mcuboot"; - reg = <0x00001000 0x0000F000>; - read-only; - }; - - /* Reserve 1024kB for the application in slot 0 */ - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - /* Reserve 1024kB for the application in slot 1 */ - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - /* Reserve 256kB for the scratch partition */ - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; - &esp32_bt_hci { status = "okay"; }; diff --git a/boards/others/icev_wireless/icev_wireless.dts b/boards/others/icev_wireless/icev_wireless.dts index 6209aeac7c21e..d044209cec48c 100644 --- a/boards/others/icev_wireless/icev_wireless.dts +++ b/boards/others/icev_wireless/icev_wireless.dts @@ -9,6 +9,7 @@ #include #include "icev_wireless-pinctrl.dtsi" #include +#include / { model = "ICEV Wireless"; @@ -93,41 +94,6 @@ status = "okay"; }; -&flash0 { - status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x0000F000>; - read-only; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; - &esp32_bt_hci { status = "okay"; }; diff --git a/boards/seeed/xiao_esp32c3/xiao_esp32c3.dts b/boards/seeed/xiao_esp32c3/xiao_esp32c3.dts index 68687958b8a2a..0be67a645c434 100644 --- a/boards/seeed/xiao_esp32c3/xiao_esp32c3.dts +++ b/boards/seeed/xiao_esp32c3/xiao_esp32c3.dts @@ -7,6 +7,7 @@ /dts-v1/; #include +#include #include "xiao_esp32c3-pinctrl.dtsi" #include "seeed_xiao_connector.dtsi" @@ -86,40 +87,6 @@ status = "okay"; }; -&flash0 { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x0000F000>; - read-only; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; - &esp32_bt_hci { status = "okay"; }; diff --git a/boards/seeed/xiao_esp32s3/xiao_esp32s3_appcpu.dts b/boards/seeed/xiao_esp32s3/xiao_esp32s3_appcpu.dts index f2cf95742ac14..0f678dc0ccaa1 100644 --- a/boards/seeed/xiao_esp32s3/xiao_esp32s3_appcpu.dts +++ b/boards/seeed/xiao_esp32s3/xiao_esp32s3_appcpu.dts @@ -6,6 +6,8 @@ /dts-v1/; #include +#include + / { model = "Seeed Xiao ESP32S3 APPCPU"; compatible = "espressif,esp32s3"; @@ -14,6 +16,8 @@ zephyr,sram = &sram0; zephyr,ipc_shm = &shm0; zephyr,ipc = &ipm0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_appcpu_partition; }; }; @@ -24,42 +28,3 @@ &ipm0 { status = "okay"; }; - -&flash0 { - status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* Reserve 64kB for the bootloader */ - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x00010000>; - read-only; - }; - - /* Reserve 1024kB for the application in slot 0 */ - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - /* Reserve 1024kB for the application in slot 1 */ - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - /* Reserve 256kB for the scratch partition */ - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; diff --git a/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu.dts b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu.dts index 2a68af1ee1878..cdf5801e362f3 100644 --- a/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu.dts +++ b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu.dts @@ -5,7 +5,9 @@ */ /dts-v1/; + #include "xiao_esp32s3_procpu_common.dtsi" +#include / { model = "Seeed Xiao ESP32S3 PROCPU"; diff --git a/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_common.dtsi b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_common.dtsi index 8a99ef2c694f5..f8e4906f88c6b 100644 --- a/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_common.dtsi +++ b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_common.dtsi @@ -91,41 +91,6 @@ status = "okay"; }; -&flash0 { - status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x0000F000>; - read-only; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; - &esp32_bt_hci { status = "okay"; }; diff --git a/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.dts b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.dts index 4dd7a68abced5..f8f7ed4a31675 100644 --- a/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.dts +++ b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.dts @@ -6,6 +6,7 @@ /dts-v1/; #include "xiao_esp32s3_procpu_common.dtsi" +#include / { model = "Seeed Xiao ESP32S3 PROCPU Sense"; diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_appcpu.dts b/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_appcpu.dts index 9b345338aa41c..13562961dc845 100644 --- a/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_appcpu.dts +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/esp32s3_touch_lcd_1_28_esp32s3_appcpu.dts @@ -5,6 +5,7 @@ /dts-v1/; #include +#include / { model = "ESP32-S3-Touch-LCD-1.28 APPCPU"; @@ -12,43 +13,10 @@ chosen { zephyr,sram = &sram0; - }; -}; - -&flash0 { - status = "okay"; - reg = <0x0 DT_SIZE_M(16)>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x0000F000>; - read-only; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; + zephyr,ipc_shm = &shm0; + zephyr,ipc = &ipm0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_appcpu_partition; }; }; From 82eb8a1fb683497a6bb708f13c248a035b085b93 Mon Sep 17 00:00:00 2001 From: Marek Matej Date: Thu, 17 Oct 2024 11:26:50 +0100 Subject: [PATCH 2224/4482] drivers: clock_control: amp clock fix Avoid APPCPU to interact with a clock settings. Fix warning when LOG_LEVEL_DBG. Signed-off-by: Marek Matej --- drivers/clock_control/clock_control_esp32.c | 5 ++++- drivers/ipm/ipm_esp32.c | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/clock_control/clock_control_esp32.c b/drivers/clock_control/clock_control_esp32.c index 346997d898daa..5a2157cf9a12d 100644 --- a/drivers/clock_control/clock_control_esp32.c +++ b/drivers/clock_control/clock_control_esp32.c @@ -154,7 +154,10 @@ static void esp32_clock_perip_init(void) #if !defined(CONFIG_SOC_SERIES_ESP32) uint32_t common_perip_clk1; #endif - + /* Avoid APPCPU to mess with the clocks. */ +#if defined(CONFIG_SOC_ESP32_APPCPU) || defined(CONFIG_SOC_ESP32S3_APPCPU) + return; +#endif /* For reason that only reset CPU, do not disable the clocks * that have been enabled before reset. */ diff --git a/drivers/ipm/ipm_esp32.c b/drivers/ipm/ipm_esp32.c index 27fb90b6f9fa3..fd84919b80a1c 100644 --- a/drivers/ipm/ipm_esp32.c +++ b/drivers/ipm/ipm_esp32.c @@ -216,9 +216,9 @@ static int esp32_ipm_init(const struct device *dev) data->other_core_id = (data->this_core_id == 0) ? 1 : 0; LOG_DBG("Size of IPM shared memory: %d", data->shm_size); - LOG_DBG("Address of PRO_CPU IPM shared memory: %p", data->shm.pro_cpu_shm); - LOG_DBG("Address of APP_CPU IPM shared memory: %p", data->shm.app_cpu_shm); - LOG_DBG("Address of IPM control structure: %p", data->control); + LOG_DBG("Address of PRO_CPU IPM shared memory: %p", (void *)data->shm.pro_cpu_shm); + LOG_DBG("Address of APP_CPU IPM shared memory: %p", (void *)data->shm.app_cpu_shm); + LOG_DBG("Address of IPM control structure: %p", (void *)data->control); /* pro_cpu is responsible to initialize the lock of shared memory */ if (data->this_core_id == 0) { From ed1179713ca2a6994d68272a3e91e0c58bb2d3e7 Mon Sep 17 00:00:00 2001 From: Marek Matej Date: Wed, 4 Sep 2024 14:28:07 +0200 Subject: [PATCH 2225/4482] soc: esp32s3: AMP support Updates and fixes to support APPCPU. - fix ld scripts - fix and update memory layout - fix build issues - fix sysbuild Signed-off-by: Marek Matej --- soc/espressif/common/loader.c | 4 +- soc/espressif/esp32/Kconfig | 3 +- soc/espressif/esp32s3/CMakeLists.txt | 69 ++--- soc/espressif/esp32s3/Kconfig | 24 +- soc/espressif/esp32s3/Kconfig.amp | 31 ++ soc/espressif/esp32s3/Kconfig.defconfig | 3 + soc/espressif/esp32s3/default.ld | 65 +++-- soc/espressif/esp32s3/default_appcpu.ld | 362 ++++++++++++++++-------- soc/espressif/esp32s3/esp32s3-mp.c | 155 +++++++++- soc/espressif/esp32s3/memory.h | 68 +++-- soc/espressif/esp32s3/soc.c | 53 +--- soc/espressif/esp32s3/soc_appcpu.c | 7 +- 12 files changed, 555 insertions(+), 289 deletions(-) create mode 100644 soc/espressif/esp32s3/Kconfig.amp diff --git a/soc/espressif/common/loader.c b/soc/espressif/common/loader.c index b520e427ac20d..01e27bc588656 100644 --- a/soc/espressif/common/loader.c +++ b/soc/espressif/common/loader.c @@ -84,7 +84,6 @@ void map_rom_segments(uint32_t app_drom_start, uint32_t app_drom_vaddr, unsigned int segments = 0; unsigned int ram_segments = 0; - /* Using already fetched bootloader image header from bootloader_init */ offset += sizeof(esp_image_header_t); while (segments++ < 16) { @@ -223,7 +222,6 @@ void map_rom_segments(uint32_t app_drom_start, uint32_t app_drom_vaddr, "IROM", app_irom_start_aligned, app_irom_vaddr_aligned, app_irom_size, app_irom_size); - ets_printf("\n\r"); esp_rom_uart_tx_wait_idle(0); } @@ -248,7 +246,7 @@ void __start(void) } #endif -#ifndef CONFIG_MCUBOOT +#if !defined(CONFIG_MCUBOOT) && !defined(CONFIG_SOC_ESP32S3_APPCPU) map_rom_segments(_app_drom_start, _app_drom_vaddr, _app_drom_size, _app_irom_start, _app_irom_vaddr, _app_irom_size); #endif diff --git a/soc/espressif/esp32/Kconfig b/soc/espressif/esp32/Kconfig index 3059ea322f5dd..9aeaada682e90 100644 --- a/soc/espressif/esp32/Kconfig +++ b/soc/espressif/esp32/Kconfig @@ -32,8 +32,7 @@ config ESP32_APPCPU_DRAM config SOC_ENABLE_APPCPU bool default y - depends on IPM && SOC_ESP32_PROCPU - depends on MBOX && SOC_ESP32_PROCPU + depends on (IPM || MBOX) && SOC_ESP32_PROCPU help This hidden configuration lets PROCPU core to map and start APPCPU whenever IPM is enabled. diff --git a/soc/espressif/esp32s3/CMakeLists.txt b/soc/espressif/esp32s3/CMakeLists.txt index 5f64bd335c2ff..706fe6eb39fc8 100644 --- a/soc/espressif/esp32s3/CMakeLists.txt +++ b/soc/espressif/esp32s3/CMakeLists.txt @@ -1,14 +1,20 @@ # SPDX-License-Identifier: Apache-2.0 if (CONFIG_SOC_ESP32S3_APPCPU) - zephyr_sources(soc_appcpu.c) + + zephyr_sources( + soc_appcpu.c + ) + else() + zephyr_sources( soc.c soc_cache.c esp32s3-mp.c ../common/loader.c ) + endif() zephyr_include_directories(.) @@ -22,13 +28,24 @@ zephyr_library_sources_ifdef(CONFIG_POWEROFF poweroff.c) # Get flash size to use in esptool as string math(EXPR esptoolpy_flashsize "${CONFIG_FLASH_SIZE} / 0x100000") -# Make rom loader compatible binary file -if(NOT CONFIG_BOOTLOADER_MCUBOOT) +# Get UART baudrate from DT +dt_chosen(dts_shell_uart PROPERTY "zephyr,shell-uart") +if(${dts_shell_uart}) + dt_prop(monitor_baud PATH ${dts_shell_uart} PROPERTY "current-speed") +endif() + +board_runner_args(esp32 "--esp-monitor-baud=${monitor_baud}") + +message("-- Espressif HAL path: ${ESP_IDF_PATH}") + +# Select image processing + +if(CONFIG_ESP_SIMPLE_BOOT OR CONFIG_MCUBOOT) if(CONFIG_BUILD_OUTPUT_BIN) set(ESPTOOL_PY ${ESP_IDF_PATH}/tools/esptool_py/esptool.py) - message("esptool path: ${ESPTOOL_PY}") + message("-- Use the esptool.py: ${ESPTOOL_PY}") set(ELF2IMAGE_ARG "") if(NOT CONFIG_MCUBOOT) @@ -37,49 +54,35 @@ if(NOT CONFIG_BOOTLOADER_MCUBOOT) set_property(GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND ${PYTHON_EXECUTABLE} ${ESPTOOL_PY} - ARGS --chip esp32s3 elf2image ${ELF2IMAGE_ARG} + ARGS --chip ${CONFIG_SOC} elf2image ${ELF2IMAGE_ARG} --flash_mode dio --flash_freq 40m --flash_size ${esptoolpy_flashsize}MB -o ${CMAKE_BINARY_DIR}/zephyr/${CONFIG_KERNEL_BIN_NAME}.bin ${CMAKE_BINARY_DIR}/zephyr/${CONFIG_KERNEL_BIN_NAME}.elf) - endif() - -endif() -## When building for APPCPU -if (CONFIG_SOC_ESP32S3_APPCPU) - - if(CONFIG_BUILD_OUTPUT_BIN) - set_property(GLOBAL APPEND PROPERTY extra_post_build_commands - COMMAND ${PYTHON_EXECUTABLE} ${ESP_IDF_PATH}/tools/esp_bin2c_array.py - ARGS -i ${CMAKE_BINARY_DIR}/zephyr/${CONFIG_KERNEL_BIN_NAME}.bin - -o ${CMAKE_BINARY_DIR}/zephyr/${CONFIG_KERNEL_BIN_NAME}.c - -a "esp32s3_appcpu_fw_array") endif() -else() - ## Building for PROCPU - - set_property(TARGET bintools PROPERTY disassembly_flag_inline_source) +endif() - # Get code-partition boot address +# Select the image origin depending on the boot configuration +if(CONFIG_SOC_ESP32S3_APPCPU) + dt_nodelabel(dts_partition_path NODELABEL "slot0_appcpu_partition") +elseif(CONFIG_MCUBOOT) dt_nodelabel(dts_partition_path NODELABEL "boot_partition") - dt_reg_addr(boot_off PATH ${dts_partition_path}) - - # Get code-partition slot0 address +elseif(CONFIG_ESP_SIMPLE_BOOT) + dt_nodelabel(dts_partition_path NODELABEL "boot_partition") +else() dt_nodelabel(dts_partition_path NODELABEL "slot0_partition") - dt_reg_addr(img_0_off PATH ${dts_partition_path}) +endif() - if(CONFIG_BOOTLOADER_MCUBOOT) - board_finalize_runner_args(esp32 "--esp-app-address=${img_0_off}") - else() - board_finalize_runner_args(esp32 "--esp-app-address=${boot_off}") - endif() +dt_reg_addr(image_off PATH ${dts_partition_path}) +board_finalize_runner_args(esp32 "--esp-app-address=${image_off}") -endif() +message("-- Image partition ${dts_partition_path}") +# Look for cross references between bootloader sections if(CONFIG_MCUBOOT) - # search from cross references between bootloader sections + message("check_callgraph using: ${ESP_IDF_PATH}/tools/ci/check_callgraph.py") set_property(GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND diff --git a/soc/espressif/esp32s3/Kconfig b/soc/espressif/esp32s3/Kconfig index cfda258d8c22c..3e2886edcf663 100644 --- a/soc/espressif/esp32s3/Kconfig +++ b/soc/espressif/esp32s3/Kconfig @@ -14,28 +14,6 @@ config SOC_SERIES_ESP32S3 if SOC_SERIES_ESP32S3 -config ESP32S3_APPCPU_IRAM - hex "ESP32S3 APPCPU IRAM size" - depends on SOC_ESP32S3_PROCPU || SOC_ESP32S3_APPCPU - default 0x20000 - help - Defines APPCPU IRAM area in bytes. - -config ESP32S3_APPCPU_DRAM - hex "ESP32S3 APPCPU DRAM size" - depends on SOC_ESP32S3_PROCPU || SOC_ESP32S3_APPCPU - default 0x10000 - help - Defines APPCPU DRAM area in bytes. - -config SOC_ENABLE_APPCPU - bool - default y - depends on IPM && SOC_ESP32S3_PROCPU - depends on MBOX && SOC_ESP32S3_PROCPU - help - This hidden configuration lets PROCPU core to map and start APPCPU whenever IPM is enabled. - menu "Cache config" choice ESP32S3_INSTRUCTION_CACHE_SIZE @@ -178,4 +156,6 @@ config MAC_BB_PD endmenu # Cache config +rsource "Kconfig.amp" + endif # SOC_SERIES_ESP32S3 diff --git a/soc/espressif/esp32s3/Kconfig.amp b/soc/espressif/esp32s3/Kconfig.amp new file mode 100644 index 0000000000000..f6acbbc52a24e --- /dev/null +++ b/soc/espressif/esp32s3/Kconfig.amp @@ -0,0 +1,31 @@ +# Copyright (c) 2023 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +if SOC_SERIES_ESP32S3 + +menu "AMP config" + +config ESP32S3_APPCPU_IRAM_SIZE + hex "ESP32S3 APPCPU IRAM size" + depends on SOC_ESP32S3_PROCPU || SOC_ESP32S3_APPCPU + default 0x10000 + help + Defines APPCPU IRAM area size in bytes. + +config ESP32S3_APPCPU_DRAM_SIZE + hex "ESP32S3 APPCPU DRAM size" + depends on SOC_ESP32S3_PROCPU || SOC_ESP32S3_APPCPU + default 0x10000 + help + Defines APPCPU DRAM area size in bytes. + +config SOC_ENABLE_APPCPU + bool + default y + depends on (IPM || MBOX) && SOC_ESP32S3_PROCPU + help + This hidden configuration lets PROCPU core to map and start APPCPU whenever IPM is enabled. + +endmenu # AMP config + +endif # SOC_SERIES_ESP32S3 diff --git a/soc/espressif/esp32s3/Kconfig.defconfig b/soc/espressif/esp32s3/Kconfig.defconfig index 2d61a5cfa4b2d..110471dba6298 100644 --- a/soc/espressif/esp32s3/Kconfig.defconfig +++ b/soc/espressif/esp32s3/Kconfig.defconfig @@ -9,4 +9,7 @@ config FLASH_SIZE config FLASH_BASE_ADDRESS default $(dt_node_reg_addr_hex,/soc/flash-controller@60002000/flash@0) +config BOOTLOADER_MCUBOOT + default y if SOC_ESP32S3_APPCPU + endif # SOC_SERIES_ESP32S3 diff --git a/soc/espressif/esp32s3/default.ld b/soc/espressif/esp32s3/default.ld index 17d865cf526f9..b51f1d5282c7b 100644 --- a/soc/espressif/esp32s3/default.ld +++ b/soc/espressif/esp32s3/default.ld @@ -10,24 +10,16 @@ #include "memory.h" -/* The "user_iram_end" represents the 2nd stage bootloader - * "iram_loader_seg" start address (that should not be overlapped). - * If no bootloader is used, we can extend it to gain more user ram. - */ -#ifdef CONFIG_ESP_SIMPLE_BOOT -user_iram_end = (BOOTLOADER_USER_DRAM_END + IRAM_DRAM_OFFSET); -#else -user_iram_end = BOOTLOADER_IRAM_LOADER_SEG_START; -#endif - /* User available SRAM memory segments */ -user_dram_seg_org = SRAM1_DRAM_START; -user_iram_seg_org = SRAM0_IRAM_START + CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE; -user_dram_end = BOOTLOADER_IRAM_LOADER_SEG_START - IRAM_DRAM_OFFSET; -user_idram_size = user_dram_end - SRAM1_DRAM_START; -sram0_iram_size = SRAM0_SIZE - CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE; -user_iram_seg_len = user_idram_size + sram0_iram_size; -user_dram_seg_len = user_idram_size; +amp_total_size = APPCPU_SRAM_TOTAL_SIZE; +procpu_iram_end = USER_IRAM_END - APPCPU_SRAM_TOTAL_SIZE; +procpu_dram_end = USER_DRAM_END - APPCPU_SRAM_TOTAL_SIZE; + +procpu_iram_org = SRAM_USER_IRAM_START; +procpu_iram_len = procpu_iram_end - procpu_iram_org; + +procpu_dram_org = SRAM1_DRAM_START; +procpu_dram_len = procpu_dram_end - procpu_dram_org; /* Aliases */ #define FLASH_CODE_REGION irom0_0_seg @@ -36,6 +28,7 @@ user_dram_seg_len = user_idram_size; #define RAMABLE_REGION dram0_0_seg #define ROMABLE_REGION FLASH +/* Zephyr macro re-definitions */ #undef GROUP_DATA_LINK_IN #define GROUP_DATA_LINK_IN(vregion, lregion) > vregion AT > lregion @@ -66,14 +59,13 @@ MEMORY FLASH (R): org = 0x0, len = FLASH_SIZE - 0x100 #endif /* CONFIG_BOOTLOADER_MCUBOOT */ - iram0_0_seg(RX): org = user_iram_seg_org, len = user_iram_seg_len - APPCPU_IRAM_SIZE - dram0_0_seg(RW): org = user_dram_seg_org, len = user_dram_seg_len - APPCPU_DRAM_SIZE + iram0_0_seg(RX): org = procpu_iram_org, len = procpu_iram_len + dram0_0_seg(RW): org = procpu_dram_org, len = procpu_dram_len irom0_0_seg(RX): org = IROM_SEG_ORG, len = IROM_SEG_LEN drom0_0_seg(R): org = DROM_SEG_ORG, len = DROM_SEG_LEN - /** - * `ext_ram_seg` and `drom0_0_seg` share the same bus and the address region. + /* The `ext_ram_seg` and `drom0_0_seg` share the same bus and the address region. * A dummy section is used to avoid overlap. See `.ext_ram.dummy` in `sections.ld.in` */ #if defined(CONFIG_ESP_SPIRAM) @@ -101,11 +93,15 @@ MEMORY ENTRY(CONFIG_KERNEL_ENTRY) /* Used as a pointer to the heap end */ +#ifdef CONFIG_SOC_ENABLE_APPCPU +_heap_sentry = procpu_dram_end; +#else _heap_sentry = DRAM_RESERVED_START; +#endif SECTIONS { - _iram_dram_offset = IRAM_DRAM_OFFSET; + _iram_dram_offset = IRAM_DRAM_OFFSET; #ifdef CONFIG_BOOTLOADER_MCUBOOT /* Reserve space for MCUboot header in the binary */ @@ -116,6 +112,7 @@ SECTIONS QUAD(0x0) QUAD(0x0) } > mcuboot_hdr + /* Image load table */ .metadata : { /* 0. Magic byte for load header */ @@ -144,7 +141,6 @@ SECTIONS } > metadata #endif /* CONFIG_BOOTLOADER_MCUBOOT */ - /* Virtual non-loadable sections */ #include @@ -275,7 +271,9 @@ SECTIONS *(.entry.text) *(.init.literal) *(.init) + _init_end = ABSOLUTE(.); + } GROUP_DATA_LINK_IN(IRAM_REGION, ROMABLE_REGION) .iram0.text : ALIGN(4) @@ -310,6 +308,11 @@ SECTIONS *libphy.a:(.phyiram .phyiram.*) *libgcov.a:(.literal .text .literal.* .text.*) + /* APPCPU_ENABLED */ + *libzephyr.a:esp32s3-mp.*(.literal .text .literal.* .text.*) + *libzephyr.a:bootloader_flash.*(.literal .text .literal.* .text.*) + *libzephyr.a:flash_mmap.*(.literal .text .literal.* .text.*) + /* [mapping:esp_psram] */ *libzephyr.a:mmu_psram_flash.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_psram_impl_quad.*(.literal .literal.* .text .text.*) @@ -550,6 +553,11 @@ SECTIONS *libzephyr.a:esp_mmu_map.*(.rodata .rodata.*) *libdrivers__interrupt_controller.a:(.rodata .rodata.*) + /* APPCPU_ENABLE */ + *libzephyr.a:esp32s3-mp.*(.rodata .rodata.*) + *libzephyr.a:bootloader_flash.*(.rodata .rodata.* .sdata2 .sdata2.* .srodata .srodata.*) + *libzephyr.a:flash_mmap.*(.rodata .rodata.* .sdata2 .sdata2.* .srodata .srodata.*) + /* [mapping:esp_psram] */ *libzephyr.a:mmu_psram_flash.*(.rodata .rodata.*) *libzephyr.a:esp_psram_impl_octal.*(.rodata .rodata.*) @@ -798,6 +806,10 @@ SECTIONS } GROUP_DATA_LINK_IN(FLASH_CODE_REGION, ROMABLE_REGION) + /* --- END OF IROM --- */ + + /* --- START OF DROM --- */ + /* This dummy section represents the .flash.text section but in default_rodata_seg. * Thus, it must have its alignment and (at least) its size. */ @@ -879,6 +891,10 @@ SECTIONS _image_rodata_end = ABSOLUTE(.); } GROUP_DATA_LINK_IN(RODATA_REGION, ROMABLE_REGION) + /* --- END OF DROM --- */ + + /* --- START OF SPIRAM --- */ + /** * This section is required to skip flash rodata sections, because `ext_ram_seg` * and `drom0_0_seg` are on the same bus @@ -907,8 +923,9 @@ SECTIONS #endif /* CONFIG_ESP_SPIRAM */ - /* --- XTENSA GLUE AND DEBUG BEGIN --- */ + /* --- END OF SPIRAM --- */ + /* --- XTENSA GLUE AND DEBUG BEGIN --- */ #ifdef CONFIG_GEN_ISR_TABLES #include #endif diff --git a/soc/espressif/esp32s3/default_appcpu.ld b/soc/espressif/esp32s3/default_appcpu.ld index 4641540db75e9..58ec051e389f9 100644 --- a/soc/espressif/esp32s3/default_appcpu.ld +++ b/soc/espressif/esp32s3/default_appcpu.ld @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Espressif Systems (Shanghai) Co., Ltd. + * Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. * SPDX-License-Identifier: Apache-2.0 */ @@ -8,48 +8,121 @@ #include #include -#define SRAM_IRAM_START 0x40370000 -#define SRAM_DIRAM_I_START 0x40378000 -#define SRAM_IRAM_END 0x403BA000 -#define I_D_SRAM_OFFSET (SRAM_DIRAM_I_START - SRAM_DRAM_START) -#define DRAM_RESERVED_START 0x3fce9704 -#define IRAM_DRAM_OFFSET 0x6f0000 +#include "memory.h" -#define SRAM_DRAM_START 0x3FC88000 -#define SRAM_DRAM_END (SRAM_IRAM_END - I_D_SRAM_OFFSET) +/* User available SRAM memory segments */ +appcpu_iram_end = USER_IRAM_END; +appcpu_dram_end = USER_DRAM_END; -#define IRAM_REGION iram0_0_seg -#define RAMABLE_REGION dram0_0_seg -#define ROMABLE_REGION iram0_0_seg +appcpu_iram_org = appcpu_iram_end - APPCPU_SRAM_SIZE; +appcpu_dram_org = appcpu_dram_end - APPCPU_SRAM_SIZE; -#define IROM_SEG_ALIGN 0x4 +appcpu_iram_len = APPCPU_SRAM_SIZE; +appcpu_dram_len = APPCPU_SRAM_SIZE; + +/* Aliases */ +#define ROMABLE_REGION FLASH +#define RODATA_REGION dram0_1_seg /* drom0_1_seg */ +#define RAMABLE_REGION dram0_1_seg +#define IRAM_REGION iram0_1_seg + +/* Zephyr macro re-definitions */ +#undef GROUP_DATA_LINK_IN +#define GROUP_DATA_LINK_IN(vregion, lregion) > vregion AT > lregion + +#undef GROUP_NOLOAD_LINK_IN +#define GROUP_NOLOAD_LINK_IN(vregion, lregion) > vregion + +/* Flash segments (rodata and text) should be mapped in the virtual address spaces. + * Executing directly from LMA is not possible. */ +#undef GROUP_ROM_LINK_IN +#define GROUP_ROM_LINK_IN(vregion, lregion) > RODATA_REGION AT > lregion + +/* Make sure new sections have consistent alignment between input and output sections */ +#undef SECTION_DATA_PROLOGUE +#define SECTION_DATA_PROLOGUE(name, options, align) name options : ALIGN_WITH_INPUT + +#undef SECTION_PROLOGUE +#define SECTION_PROLOGUE SECTION_DATA_PROLOGUE MEMORY { - iram0_0_seg(RX): org = SRAM_IRAM_END - CONFIG_ESP32S3_APPCPU_IRAM, len = CONFIG_ESP32S3_APPCPU_IRAM - dram0_0_seg(RW): org = SRAM_DRAM_END - CONFIG_ESP32S3_APPCPU_DRAM, len = CONFIG_ESP32S3_APPCPU_DRAM +#ifdef CONFIG_BOOTLOADER_MCUBOOT + mcuboot_hdr (R): org = 0x0, len = 0x20 + metadata (R): org = 0x20, len = 0x20 + FLASH (R): org = 0x40, len = FLASH_SIZE - 0x40 +#else + /* Make safety margin in the FLASH memory size so the + * (esp_img_header + (n*esp_seg_headers)) would fit */ + FLASH (R): org = 0x0, len = FLASH_SIZE - 0x100 +#endif /* CONFIG_BOOTLOADER_MCUBOOT */ + + iram0_1_seg(RX): org = appcpu_iram_org, len = appcpu_iram_len + dram0_1_seg(RW): org = appcpu_dram_org, len = appcpu_dram_len + #ifdef CONFIG_GEN_ISR_TABLES IDT_LIST(RW): org = 0x3ebfe010, len = 0x2000 #endif } /* Default entry point: */ -ENTRY(__app_cpu_start) +ENTRY(__appcpu_start) /* Used as a pointer to the heap end */ _heap_sentry = DRAM_RESERVED_START; SECTIONS { +#if defined(CONFIG_BOOTLOADER_MCUBOOT) + /* Reserve space for MCUboot header in the binary */ + .mcuboot_header : + { + QUAD(0x0) + QUAD(0x0) + QUAD(0x0) + QUAD(0x0) + } > mcuboot_hdr + /* Image load table */ + .metadata : + { + /* 0. Magic byte for load header */ + LONG(0xace637d3) + + /* 1. Application entry point address */ + KEEP(*(.entry_addr)) + + /* IRAM metadata: + * 2. Destination address (VMA) for IRAM region + * 3. Flash offset (LMA) for start of IRAM region + * 4. Size of IRAM region + */ + LONG(ADDR(.iram0.vectors)) + LONG(LOADADDR(.iram0.vectors)) + LONG(_iram_end - _init_start); + + /* DRAM metadata: + * 5. Destination address (VMA) for DRAM region + * 6. Flash offset (LMA) for start of DRAM region + * 7. Size of DRAM region + */ + LONG(ADDR(.dram0.data)) + LONG(LOADADDR(.dram0.data)) + LONG(_data_end - _data_start) + } > metadata +#endif /* CONFIG_BOOTLOADER_MCUBOOT */ + #include #ifdef CONFIG_LLEXT #include #endif - /* Send .iram0 code to iram */ + /* --- START OF IRAM --- */ + + /* Send .iram0 code to iram */ .iram0.vectors : ALIGN(4) { + _iram_start = ABSOLUTE(.); /* Vectors go to IRAM */ _init_start = ABSOLUTE(.); /* Vectors according to builds/RF-2015.2-win32/esp108_v1_2_s5_512int_2/config.html */ @@ -83,15 +156,14 @@ SECTIONS *(.entry.text) *(.init.literal) *(.init) - . = ALIGN (4); + . = ALIGN (16); + _init_end = ABSOLUTE(.); - _iram_start = ABSOLUTE(.); - } GROUP_LINK_IN(IRAM_REGION) + } GROUP_DATA_LINK_IN(IRAM_REGION, ROMABLE_REGION) - SECTION_PROLOGUE(_TEXT_SECTION_NAME, , ALIGN(4)) + .iram0.text : ALIGN(4) { - /* Code marked as running out of IRAM */ _iram_text_start = ABSOLUTE(.); *(.iram1 .iram1.*) *(.iram0.literal .iram.literal .iram.text.literal .iram0.text .iram.text) @@ -122,13 +194,104 @@ SECTIONS *libphy.a:(.phyiram .phyiram.*) *libgcov.a:(.literal .text .literal.* .text.*) + . = ALIGN(16); + + } GROUP_DATA_LINK_IN(IRAM_REGION, ROMABLE_REGION) + + .flash.text : ALIGN(16) + { + _stext = .; + _text_start = ABSOLUTE(.); + + *(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) + *(.irom0.text) /* catch stray ICACHE_RODATA_ATTR */ + *(.fini.literal) + *(.fini) + *(.gnu.version) + *(.literal .text .literal.* .text.*) + + /* CPU will try to prefetch up to 16 bytes of + * of instructions. This means that any configuration (e.g. MMU, PMS) must allow + * safe access to up to 16 bytes after the last real instruction, add + * dummy bytes to ensure this + */ + . += 16; + + _text_end = ABSOLUTE(.); + _etext = .; + + /* Similar to _iram_start, this symbol goes here so it is + * resolved by addr2line in preference to the first symbol in + * the flash.text segment. + */ + . = ALIGN(4); + _flash_cache_start = ABSOLUTE(0); + . = ALIGN(4); _iram_end = ABSOLUTE(.); - . = ALIGN(4) + 16; - } GROUP_LINK_IN(IRAM_REGION) + } GROUP_DATA_LINK_IN(IRAM_REGION, ROMABLE_REGION) + + /* --- END OF IRAM --- */ - SECTION_PROLOGUE(_RODATA_SECTION_NAME,,) + /* --- START OF DRAM --- */ + + .dram0.dummy (NOLOAD): + { + . = ORIGIN(dram0_1_seg) + MAX(_iram_end, appcpu_iram_org) - appcpu_iram_org; + . = ALIGN(16); + } GROUP_LINK_IN(RAMABLE_REGION) + + .dram0.data : + { + . = ALIGN (8); + __data_start = ABSOLUTE(.); + _data_start = ABSOLUTE(.); + + *(.data) + *(.data.*) + *(.gnu.linkonce.d.*) + *(.data1) + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s.*) + *(.sdata2) + *(.sdata2.*) + *(.gnu.linkonce.s2.*) + /* rodata for panic handler(libarch__xtensa__core.a) and all + * dependent functions should be placed in DRAM to avoid issue + * when flash cache is disabled */ + *libarch__xtensa__core.a:(.rodata .rodata.*) + *libkernel.a:fatal.*(.rodata .rodata.*) + *libkernel.a:init.*(.rodata .rodata.*) + *libzephyr.a:cbprintf_complete*(.rodata .rodata.*) + *libzephyr.a:systimer_hal.*(.rodata .rodata.*) + *libzephyr.a:log_core.*(.rodata .rodata.*) + *libzephyr.a:log_backend_uart.*(.rodata .rodata.*) + *libzephyr.a:log_output.*(.rodata .rodata.*) + *libzephyr.a:loader.*(.rodata .rodata.*) + *libdrivers__serial.a:uart_esp32.*(.rodata .rodata.*) + *libdrivers__flash.a:flash_esp32.*(.rodata .rodata.*) + + . = ALIGN(4); + #include + . = ALIGN(4); + + KEEP(*(.jcr)) + *(.dram1 .dram1.*) + . = ALIGN(16); + + } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) + + #include + #include + #include + #include + #include + #include + + /* SECTION_PROLOGUE(_RODATA_SECTION_NAME,,) */ + .dram0.rodata : ALIGN(4) { _rodata_start = ABSOLUTE(.); @@ -140,8 +303,29 @@ SECTIONS #include . = ALIGN(4); - *(EXCLUDE_FILE (*libarch__xtensa__core.a:* *libkernel.a:fatal.* *libkernel.a:init.* *libzephyr.a:cbprintf_complete* *libzephyr.a:log_core.* *libzephyr.a:log_backend_uart.* *libzephyr.a:log_output.* *libzephyr.a:loader.* *libdrivers__serial.a:uart_esp32.*) .rodata) - *(EXCLUDE_FILE (*libarch__xtensa__core.a:* *libkernel.a:fatal.* *libkernel.a:init.* *libzephyr.a:cbprintf_complete* *libzephyr.a:log_core.* *libzephyr.a:log_backend_uart.* *libzephyr.a:log_output.* *libzephyr.a:loader.* *libdrivers__serial.a:uart_esp32.*) .rodata.*) + *(EXCLUDE_FILE ( + *libarch__xtensa__core.a:* + *libkernel.a:fatal.* + *libkernel.a:init.* + *libzephyr.a:cbprintf_complete* + *libzephyr.a:log_core.* + *libzephyr.a:log_backend_uart.* + *libzephyr.a:log_output.* + *libzephyr.a:loader.* + *libdrivers__serial.a:uart_esp32.*) .rodata) + + *(EXCLUDE_FILE ( + *libarch__xtensa__core.a:* + *libkernel.a:fatal.* + *libkernel.a:init.* + *libzephyr.a:cbprintf_complete* + *libzephyr.a:log_core.* + *libzephyr.a:log_backend_uart.* + *libzephyr.a:log_output.* + *libzephyr.a:loader.* + *libdrivers__serial.a:uart_esp32.*) .rodata.*) + + . = ALIGN(4); *(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */ *(.gnu.linkonce.r.*) @@ -183,13 +367,15 @@ SECTIONS _thread_local_end = ABSOLUTE(.); _rodata_reserved_end = ABSOLUTE(.); . = ALIGN(4); - } GROUP_DATA_LINK_IN(RAMABLE_REGION, IRAM_REGION) + } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) /* Flash segments (rodata and text) should be mapped in virtual address space by providing VMA. * Executing directly from LMA is not possible. */ #pragma push_macro("GROUP_ROM_LINK_IN") #undef GROUP_ROM_LINK_IN #define GROUP_ROM_LINK_IN(vregion, lregion) > RAMABLE_REGION AT > lregion + + #include #include #include #include @@ -197,78 +383,37 @@ SECTIONS #include #include #include + #include + #include + #pragma pop_macro("GROUP_ROM_LINK_IN") /* Create an explicit section at the end of all the data that shall be mapped into drom. * This is used to calculate the size of the _image_drom_size variable */ - SECTION_PROLOGUE(_RODATA_SECTION_END,,) + /* SECTION_PROLOGUE(_RODATA_SECTION_END,,) */ + .dram0.rodata_end : ALIGN(0x10) { . = ALIGN(16); _image_rodata_end = ABSOLUTE(.); - } GROUP_DATA_LINK_IN(RAMABLE_REGION, IRAM_REGION) - -#include + } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) - .dram0.data : - { - . = ALIGN (8); - __data_start = ABSOLUTE(.); - - *(.data) - *(.data.*) - *(.gnu.linkonce.d.*) - *(.data1) - *(.sdata) - *(.sdata.*) - *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) - *(.gnu.linkonce.s2.*) - /* rodata for panic handler(libarch__xtensa__core.a) and all - * dependent functions should be placed in DRAM to avoid issue - * when flash cache is disabled */ - *libarch__xtensa__core.a:(.rodata .rodata.*) - *libkernel.a:fatal.*(.rodata .rodata.*) - *libkernel.a:init.*(.rodata .rodata.*) - *libzephyr.a:cbprintf_complete*(.rodata .rodata.*) - *libzephyr.a:systimer_hal.*(.rodata .rodata.*) - *libzephyr.a:log_core.*(.rodata .rodata.*) - *libzephyr.a:log_backend_uart.*(.rodata .rodata.*) - *libzephyr.a:log_output.*(.rodata .rodata.*) - *libzephyr.a:loader.*(.rodata .rodata.*) - *libdrivers__serial.a:uart_esp32.*(.rodata .rodata.*) - *libdrivers__flash.a:flash_esp32.*(.rodata .rodata.*) - - KEEP(*(.jcr)) - *(.dram1 .dram1.*) - . = ALIGN(4); - } GROUP_DATA_LINK_IN(RAMABLE_REGION, IRAM_REGION) - - #include - #include - #include - #include - #include - - /* logging sections should be placed in RAM area to avoid flash cache disabled issues */ - #pragma push_macro("GROUP_ROM_LINK_IN") - #undef GROUP_ROM_LINK_IN - #define GROUP_ROM_LINK_IN GROUP_DATA_LINK_IN - #include - #pragma pop_macro("GROUP_ROM_LINK_IN") .dram0.end : { - . = ALIGN(4); - - #include - - . = ALIGN(4); __data_end = ABSOLUTE(.); - } GROUP_DATA_LINK_IN(RAMABLE_REGION, IRAM_REGION) + _data_end = ABSOLUTE(.); + } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) + + .dram0.noinit (NOLOAD): + { + . = ALIGN(8); + *(.noinit) + *(.noinit.*) + . = ALIGN(8) ; + } GROUP_LINK_IN(RAMABLE_REGION) /* Shared RAM */ - SECTION_DATA_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD),) + .dram0.bss (NOLOAD) : { . = ALIGN (8); _bss_start = ABSOLUTE(.); /* required by bluetooth library */ @@ -296,45 +441,15 @@ SECTIONS _image_ram_start = _iram_start - IRAM_DRAM_OFFSET; #include - ASSERT(((__bss_end - ORIGIN(dram0_0_seg)) <= LENGTH(dram0_0_seg)), "DRAM segment data does not fit.") - - SECTION_DATA_PROLOGUE(_NOINIT_SECTION_NAME, (NOLOAD),) - { - . = ALIGN(8); - *(.noinit) - *(.noinit.*) - . = ALIGN(8) ; - } GROUP_LINK_IN(RAMABLE_REGION) - - .flash.text : ALIGN(IROM_SEG_ALIGN) - { - _stext = .; - _text_start = ABSOLUTE(.); - - *(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) - *(.irom0.text) /* catch stray ICACHE_RODATA_ATTR */ - *(.fini.literal) - *(.fini) - *(.gnu.version) - *(.literal .text .literal.* .text.*) + ASSERT(((__bss_end - ORIGIN(dram0_1_seg)) <= LENGTH(dram0_1_seg)), "DRAM segment data does not fit.") - /* CPU will try to prefetch up to 16 bytes of - * of instructions. This means that any configuration (e.g. MMU, PMS) must allow - * safe access to up to 16 bytes after the last real instruction, add - * dummy bytes to ensure this - */ - . += 16; + /* --- END OF DRAM --- */ - _text_end = ABSOLUTE(.); - _etext = .; + /* --- START OF IROM --- */ + /* --- END OF IROM --- */ - /* Similar to _iram_start, this symbol goes here so it is - * resolved by addr2line in preference to the first symbol in - * the flash.text segment. - */ - . = ALIGN(4); - _flash_cache_start = ABSOLUTE(0); - } GROUP_LINK_IN(IRAM_REGION) + /* --- START OF DROM --- */ + /* --- END OF DROM --- */ #ifdef CONFIG_GEN_ISR_TABLES #include @@ -375,8 +490,7 @@ SECTIONS KEEP (*(.xt.profile_files)) KEEP (*(.gnu.linkonce.xt.profile_files.*)) } - } -ASSERT(((_iram_end - ORIGIN(iram0_0_seg)) <= LENGTH(iram0_0_seg)), +ASSERT(((_iram_end - ORIGIN(iram0_1_seg)) <= LENGTH(iram0_1_seg)), "IRAM0 segment data does not fit.") diff --git a/soc/espressif/esp32s3/esp32s3-mp.c b/soc/espressif/esp32s3/esp32s3-mp.c index 61e4d8d5812a4..8cae6d5e87cad 100644 --- a/soc/espressif/esp32s3/esp32s3-mp.c +++ b/soc/espressif/esp32s3/esp32s3-mp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Espressif Systems (Shanghai) Co., Ltd. + * Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. * * SPDX-License-Identifier: Apache-2.0 */ @@ -8,19 +8,22 @@ #include #include #include +#include +#include #include #include -#include +#include "esp_rom_uart.h" -void smp_log(const char *msg) -{ - while (*msg) { - esp_rom_uart_tx_one_char(*msg++); - } - esp_rom_uart_tx_one_char('\r'); - esp_rom_uart_tx_one_char('\n'); -} +#include "esp_mcuboot_image.h" +#include "esp_memory_utils.h" + +#ifdef CONFIG_SOC_ENABLE_APPCPU + +#include "bootloader_flash_priv.h" + +#define sys_mmap bootloader_mmap +#define sys_munmap bootloader_munmap void esp_appcpu_start(void *entry_point) { @@ -35,7 +38,135 @@ void esp_appcpu_start(void *entry_point) esp_rom_ets_set_appcpu_boot_addr((void *)entry_point); - ets_delay_us(50000); + esp_cpu_reset(1); +} + +static int load_segment(uint32_t src_addr, uint32_t src_len, uint32_t dst_addr) +{ + const uint32_t *data = (const uint32_t *)sys_mmap(src_addr, src_len); + + if (!data) { + ets_printf("%s: mmap failed", __func__); + return -1; + } + + volatile uint32_t *dst = (volatile uint32_t *)dst_addr; + + for (int i = 0; i < src_len / 4; i++) { + dst[i] = data[i]; + } + + sys_munmap(data); + + return 0; +} + +int IRAM_ATTR esp_appcpu_image_load(unsigned int hdr_offset, unsigned int *entry_addr) +{ + const uint32_t img_off = FIXED_PARTITION_OFFSET(slot0_appcpu_partition); + const uint32_t fa_size = FIXED_PARTITION_SIZE(slot0_appcpu_partition); + const uint8_t fa_id = FIXED_PARTITION_ID(slot0_appcpu_partition); + int rc = 0; + + if (entry_addr == NULL) { + ets_printf("Can't return the entry address. Aborting!\n"); + abort(); + return -1; + } + + ets_printf("Loading appcpu image, area id: %d, offset: 0x%x, hdr.off: 0x%x, size: %d kB\n", + fa_id, img_off, hdr_offset, fa_size / 1024); + + uint32_t mcuboot_header[8] = {0}; + esp_image_load_header_t image_header = {0}; + + const uint32_t *data = (const uint32_t *)sys_mmap(img_off, 0x40); + + memcpy((void *)&mcuboot_header, data, sizeof(mcuboot_header)); + memcpy((void *)&image_header, data + (hdr_offset / sizeof(uint32_t)), + sizeof(esp_image_load_header_t)); + + sys_munmap(data); + + if (image_header.header_magic == ESP_LOAD_HEADER_MAGIC) { + ets_printf("MCUboot image format\n"); + } else if ((image_header.header_magic & 0xff) == 0xE9) { + ets_printf("ESP image format is not supported\n"); + abort(); + } else { + ets_printf("Unknown or empty image detected. Aborting!\n"); + abort(); + } + + if (!esp_ptr_in_iram((void *)image_header.iram_dest_addr) || + !esp_ptr_in_iram((void *)(image_header.iram_dest_addr + image_header.iram_size))) { + ets_printf("IRAM region in load header is not valid. Aborting"); + abort(); + } + + if (!esp_ptr_in_dram((void *)image_header.dram_dest_addr) || + !esp_ptr_in_dram((void *)(image_header.dram_dest_addr + image_header.dram_size))) { + ets_printf("DRAM region in load header is not valid. Aborting"); + abort(); + } + + if (!esp_ptr_in_iram((void *)image_header.entry_addr)) { + ets_printf("Application entry point (%xh) is not in IRAM. Aborting", + image_header.entry_addr); + abort(); + } + + ets_printf("IRAM segment: paddr=%08xh, vaddr=%08xh, size=%05xh (%6d) load\n", + (img_off + image_header.iram_flash_offset), image_header.iram_dest_addr, + image_header.iram_size, image_header.iram_size); + + load_segment(img_off + image_header.iram_flash_offset, image_header.iram_size, + image_header.iram_dest_addr); + + ets_printf("DRAM segment: paddr=%08xh, vaddr=%08xh, size=%05xh (%6d) load\n", + (img_off + image_header.dram_flash_offset), image_header.dram_dest_addr, + image_header.dram_size, image_header.dram_size); + + load_segment(img_off + image_header.dram_flash_offset, image_header.dram_size, + image_header.dram_dest_addr); + + ets_printf("Application start=%xh\n", image_header.entry_addr); + esp_rom_uart_tx_wait_idle(0); + + assert(entry_addr != NULL); + *entry_addr = image_header.entry_addr; + + return rc; +} + +void esp_appcpu_image_stop(void) +{ + esp_cpu_stall(1); +} + +void esp_appcpu_image_start(unsigned int hdr_offset) +{ + static int started; + unsigned int entry_addr = 0; + + if (started) { + printk("APPCPU already started.\r\n"); + return; + } + + /* Input image meta header, output appcpu entry point */ + esp_appcpu_image_load(hdr_offset, &entry_addr); + + esp_appcpu_start((void *)entry_addr); +} + +int esp_appcpu_init(void) +{ + /* Load APPCPU image using image header offset + * (skipping the MCUBoot header) + */ + esp_appcpu_image_start(0x20); - smp_log("ESP32S3: CPU1 start sequence complete"); + return 0; } +#endif /* CONFIG_SOC_ENABLE_APPCPU */ diff --git a/soc/espressif/esp32s3/memory.h b/soc/espressif/esp32s3/memory.h index 0283c51fe0d55..f3e22a0451375 100644 --- a/soc/espressif/esp32s3/memory.h +++ b/soc/espressif/esp32s3/memory.h @@ -4,17 +4,19 @@ */ #pragma once -/* SRAM0 (64k), SRAM1 (416k), SRAM2 (64k) memories +/* SRAM0 (32k), SRAM1 (416k), SRAM2 (64k) memories * Ibus and Dbus address space */ -#define SRAM0_IRAM_START 0x40370000 -#define SRAM0_SIZE 0x8000 -#define SRAM1_DRAM_START 0x3fc88000 +#define SRAM0_IRAM_START 0x40370000 +#define SRAM0_SIZE 0x8000 +#define SRAM1_DRAM_START 0x3fc88000 +#define SRAM1_IRAM_START 0x40378000 +#define SRAM_USER_IRAM_START (SRAM0_IRAM_START + CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE) -/* IRAM equivalent address where DRAM actually start */ -#define SRAM1_IRAM_START (SRAM0_IRAM_START + SRAM0_SIZE) -#define SRAM2_DRAM_START 0x3fcf0000 -#define SRAM2_SIZE 0x10000 +#define SRAM2_DRAM_START 0x3fcf0000 +#define SRAM2_SIZE 0x10000 +#define SRAM2_USER_DRAM_START (SRAM2_DRAM_START + CONFIG_ESP32S3_DATA_CACHE_SIZE) +#define SRAM2_USER_DRAM_SIZE (SRAM2_SIZE - CONFIG_ESP32S3_DATA_CACHE_SIZE) /** Simplified memory map for the bootloader. * Make sure the bootloader can load into main memory without overwriting itself. @@ -43,24 +45,51 @@ /* Set the limit for the application runtime dynamic allocations */ #define DRAM_RESERVED_START DRAM_BUFFERS_END -/* Base address used for calculating memory layout - * counted from Dbus backwards and back to the Ibus - */ -#define BOOTLOADER_USER_DRAM_END DRAM_BUFFERS_START - /* For safety margin between bootloader data section and startup stacks */ #define BOOTLOADER_STACK_OVERHEAD 0x0 #define BOOTLOADER_DRAM_SEG_LEN 0x15000 #define BOOTLOADER_IRAM_LOADER_SEG_LEN 0x1a00 #define BOOTLOADER_IRAM_SEG_LEN 0xc000 +/* Base address used for calculating memory layout + * counted from Dbus backwards and back to the Ibus + */ +#define BOOTLOADER_USER_DRAM_END (DRAM_BUFFERS_START - BOOTLOADER_STACK_OVERHEAD) + /* Start of the lower region is determined by region size and the end of the higher region */ -#define BOOTLOADER_IRAM_LOADER_SEG_START (BOOTLOADER_USER_DRAM_END - BOOTLOADER_STACK_OVERHEAD + \ - IRAM_DRAM_OFFSET - BOOTLOADER_IRAM_LOADER_SEG_LEN) +#define BOOTLOADER_IRAM_LOADER_SEG_START \ + (BOOTLOADER_USER_DRAM_END - BOOTLOADER_IRAM_LOADER_SEG_LEN + IRAM_DRAM_OFFSET) #define BOOTLOADER_IRAM_SEG_START (BOOTLOADER_IRAM_LOADER_SEG_START - BOOTLOADER_IRAM_SEG_LEN) #define BOOTLOADER_DRAM_SEG_END (BOOTLOADER_IRAM_SEG_START - IRAM_DRAM_OFFSET) #define BOOTLOADER_DRAM_SEG_START (BOOTLOADER_DRAM_SEG_END - BOOTLOADER_DRAM_SEG_LEN) +/* The "USER_IRAM_END" represents the end of staticaly allocated memory. + * This address is where 2nd stage bootloader starts allocating memory, + * and it should not be overlapped by the user image. + * When there is no 2nd stage bootloader the bootstrapping is done + * by the so-called SIMPLE_BOOT. + */ +#ifdef CONFIG_ESP_SIMPLE_BOOT +#define USER_DRAM_END BOOTLOADER_USER_DRAM_END +#else +#define USER_DRAM_END (BOOTLOADER_IRAM_LOADER_SEG_START - IRAM_DRAM_OFFSET) +#endif +#define USER_IRAM_END (USER_DRAM_END + IRAM_DRAM_OFFSET) + +/* AMP */ +#if defined(CONFIG_SOC_ENABLE_APPCPU) || defined(CONFIG_SOC_ESP32S3_APPCPU) +#define APPCPU_IRAM_SIZE CONFIG_ESP32S3_APPCPU_IRAM_SIZE +#define APPCPU_DRAM_SIZE CONFIG_ESP32S3_APPCPU_DRAM_SIZE +#define AMP_COMM_SIZE (0x4000 + 0x400) +#else +#define APPCPU_IRAM_SIZE 0 +#define APPCPU_DRAM_SIZE 0 +#define AMP_COMM_SIZE 0 +#endif + +#define APPCPU_SRAM_SIZE (APPCPU_IRAM_SIZE + APPCPU_DRAM_SIZE) +#define APPCPU_SRAM_TOTAL_SIZE (APPCPU_SRAM_SIZE + AMP_COMM_SIZE) + /* Flash */ #ifdef CONFIG_FLASH_SIZE #define FLASH_SIZE CONFIG_FLASH_SIZE @@ -74,12 +103,3 @@ #define IROM_SEG_LEN FLASH_SIZE #define DROM_SEG_ORG 0x3c000000 #define DROM_SEG_LEN FLASH_SIZE - -/* AMP */ -#ifdef CONFIG_SOC_ENABLE_APPCPU -#define APPCPU_IRAM_SIZE CONFIG_ESP32S3_APPCPU_IRAM -#define APPCPU_DRAM_SIZE CONFIG_ESP32S3_APPCPU_DRAM -#else -#define APPCPU_IRAM_SIZE 0 -#define APPCPU_DRAM_SIZE 0 -#endif diff --git a/soc/espressif/esp32s3/soc.c b/soc/espressif/esp32s3/soc.c index a1349b61db01b..80a02696fe049 100644 --- a/soc/espressif/esp32s3/soc.c +++ b/soc/espressif/esp32s3/soc.c @@ -47,49 +47,14 @@ #include #include "esp_log.h" +#include +#include + #define TAG "boot.esp32s3" extern void z_prep_c(void); extern void esp_reset_reason_init(void); - -#ifdef CONFIG_SOC_ENABLE_APPCPU -extern const unsigned char esp32s3_appcpu_fw_array[]; - -void IRAM_ATTR esp_start_appcpu(void) -{ - esp_image_header_t *header = (esp_image_header_t *)&esp32s3_appcpu_fw_array[0]; - esp_image_segment_header_t *segment = - (esp_image_segment_header_t *)&esp32s3_appcpu_fw_array[sizeof(esp_image_header_t)]; - uint8_t *segment_payload; - uint32_t entry_addr = header->entry_addr; - uint32_t idx = sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t); - - for (int i = 0; i < header->segment_count; i++) { - segment_payload = (uint8_t *)&esp32s3_appcpu_fw_array[idx]; - - if (segment->load_addr >= SOC_IRAM_LOW && segment->load_addr < SOC_IRAM_HIGH) { - /* IRAM segment only accepts 4 byte access, avoid memcpy usage here */ - volatile uint32_t *src = (volatile uint32_t *)segment_payload; - volatile uint32_t *dst = (volatile uint32_t *)segment->load_addr; - - for (int i = 0; i < segment->data_len / 4; i++) { - dst[i] = src[i]; - } - - } else if (segment->load_addr >= SOC_DRAM_LOW && - segment->load_addr < SOC_DRAM_HIGH) { - memcpy((void *)segment->load_addr, (const void *)segment_payload, - segment->data_len); - } - - idx += segment->data_len; - segment = (esp_image_segment_header_t *)&esp32s3_appcpu_fw_array[idx]; - idx += sizeof(esp_image_segment_header_t); - } - - esp_appcpu_start((void *)entry_addr); -} -#endif /* CONFIG_SOC_ENABLE_APPCPU*/ +extern int esp_appcpu_init(void); #ifndef CONFIG_MCUBOOT /* @@ -175,11 +140,6 @@ void IRAM_ATTR __esp_platform_start(void) esp_init_psram(); #endif /* CONFIG_ESP_SPIRAM */ -#if CONFIG_SOC_ENABLE_APPCPU - /* start the ESP32S3 APP CPU */ - esp_start_appcpu(); -#endif - #endif /* !CONFIG_MCUBOOT */ esp_intr_initialize(); @@ -213,3 +173,8 @@ void sys_arch_reboot(int type) { esp_restart_noos(); } + +#if defined(CONFIG_SOC_ENABLE_APPCPU) && !defined(CONFIG_MCUBOOT) +extern int esp_appcpu_init(void); +SYS_INIT(esp_appcpu_init, POST_KERNEL, 50); +#endif diff --git a/soc/espressif/esp32s3/soc_appcpu.c b/soc/espressif/esp32s3/soc_appcpu.c index 6ca213557ced0..a03304c87519e 100644 --- a/soc/espressif/esp32s3/soc_appcpu.c +++ b/soc/espressif/esp32s3/soc_appcpu.c @@ -33,6 +33,11 @@ #include #include +#define HDR_ATTR __attribute__((section(".entry_addr"))) __attribute__((used)) + +void __appcpu_start(void); +static HDR_ATTR void (*_entry_point)(void) = &__appcpu_start; + extern void z_prep_c(void); static void core_intr_matrix_clear(void) @@ -44,7 +49,7 @@ static void core_intr_matrix_clear(void) } } -void IRAM_ATTR __app_cpu_start(void) +void IRAM_ATTR __appcpu_start(void) { extern uint32_t _init_start; From a8ab8b49f296d4ff417d3c736374ad65183db3db Mon Sep 17 00:00:00 2001 From: Marek Matej Date: Wed, 4 Sep 2024 14:31:23 +0200 Subject: [PATCH 2226/4482] samples: drivers: IPM fixes Updates and fixes to support IPM sample on ESP32: - fix IPM sample code for APPCPU and PROCPU - align with memory layout, add flash awarenes - shell commands to stop/start APPCPU - reorganize overlays Signed-off-by: Marek Matej --- samples/drivers/ipm/ipm_esp32/CMakeLists.txt | 30 ++-------- .../drivers/ipm/ipm_esp32/Kconfig.sysbuild | 11 ++++ samples/drivers/ipm/ipm_esp32/README.rst | 35 ++++++----- .../ipm/ipm_esp32/ipm_esp_appcpu/prj.conf | 2 - .../{ipm_esp_appcpu => remote}/CMakeLists.txt | 4 +- samples/drivers/ipm/ipm_esp32/remote/prj.conf | 3 + .../socs/esp32s3_appcpu.overlay} | 0 .../{ipm_esp_appcpu => remote}/src/main.c | 13 ++-- .../esp32_procpu.overlay} | 0 .../ipm/ipm_esp32/socs/esp32s3_procpu.overlay | 3 + samples/drivers/ipm/ipm_esp32/src/main.c | 28 ++++++--- .../drivers/ipm/ipm_esp32/src/procpu_shell.c | 59 +++++++++++++++++++ samples/drivers/ipm/ipm_esp32/sysbuild.cmake | 21 +++++++ 13 files changed, 150 insertions(+), 59 deletions(-) create mode 100644 samples/drivers/ipm/ipm_esp32/Kconfig.sysbuild delete mode 100644 samples/drivers/ipm/ipm_esp32/ipm_esp_appcpu/prj.conf rename samples/drivers/ipm/ipm_esp32/{ipm_esp_appcpu => remote}/CMakeLists.txt (66%) create mode 100644 samples/drivers/ipm/ipm_esp32/remote/prj.conf rename samples/drivers/ipm/ipm_esp32/{boards/esp32_devkitc_wroom_procpu.overlay => remote/socs/esp32s3_appcpu.overlay} (100%) rename samples/drivers/ipm/ipm_esp32/{ipm_esp_appcpu => remote}/src/main.c (73%) rename samples/drivers/ipm/ipm_esp32/{boards/esp32_devkitc_wrover_procpu.overlay => socs/esp32_procpu.overlay} (100%) create mode 100644 samples/drivers/ipm/ipm_esp32/socs/esp32s3_procpu.overlay create mode 100644 samples/drivers/ipm/ipm_esp32/src/procpu_shell.c create mode 100644 samples/drivers/ipm/ipm_esp32/sysbuild.cmake diff --git a/samples/drivers/ipm/ipm_esp32/CMakeLists.txt b/samples/drivers/ipm/ipm_esp32/CMakeLists.txt index c4399df8a9280..f343fa37b01bf 100644 --- a/samples/drivers/ipm/ipm_esp32/CMakeLists.txt +++ b/samples/drivers/ipm/ipm_esp32/CMakeLists.txt @@ -2,33 +2,11 @@ cmake_minimum_required(VERSION 3.20.0) -set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/ipm_esp32_appcpu-prefix/src/ipm_esp32_appcpu-build/zephyr) - -if("${BOARD}" STREQUAL "esp32_devkitc_wrover/esp32/procpu") - set(BOARD_REMOTE "esp32_devkitc_wrover/esp32/appcpu") -elseif("${BOARD}" STREQUAL "esp32_devkitc_wroom/esp32/procpu") - set(BOARD_REMOTE "esp32_devkitc_wroom/esp32/appcpu") -elseif("${BOARD}" STREQUAL "esp32s3_devkitm/esp32s3/procpu") - set(BOARD_REMOTE "esp32s3_devkitm/esp32s3/appcpu") -else() - message(FATAL_ERROR "${BOARD} was not supported for this sample") -endif() +set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../ipm_esp32_remote/zephyr) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(ipm_esp32) - -set_source_files_properties(${REMOTE_ZEPHYR_DIR}/esp32_appcpu_firmware.c PROPERTIES GENERATED TRUE) -target_sources(app PRIVATE src/main.c ${REMOTE_ZEPHYR_DIR}/esp32_appcpu_firmware.c) -include(ExternalProject) - -ExternalProject_Add( - ipm_esp32_appcpu - SOURCE_DIR ${APPLICATION_SOURCE_DIR}/ipm_esp_appcpu - INSTALL_COMMAND "" - CMAKE_CACHE_ARGS -DBOARD:STRING=${BOARD_REMOTE} - BUILD_BYPRODUCTS "${REMOTE_ZEPHYR_DIR}/${KERNEL_BIN_NAME}" - BUILD_ALWAYS True -) +message(STATUS "${BOARD} compile as Master in this sample") +project(ipm_esp32) -add_dependencies(app ipm_esp32_appcpu) +target_sources(app PRIVATE src/main.c src/procpu_shell.c) diff --git a/samples/drivers/ipm/ipm_esp32/Kconfig.sysbuild b/samples/drivers/ipm/ipm_esp32/Kconfig.sysbuild new file mode 100644 index 0000000000000..143c6c08eb505 --- /dev/null +++ b/samples/drivers/ipm/ipm_esp32/Kconfig.sysbuild @@ -0,0 +1,11 @@ +# Copyright 2022 NXP +# +# SPDX-License-Identifier: Apache-2.0 + +source "share/sysbuild/Kconfig" + +config IPM_REMOTE_BOARD + string + default "esp32_devkitc_wrover/esp32/appcpu" if $(BOARD) = "esp32_devkitc_wroom" + default "esp32_devkitc_wroom/esp32/appcpu" if $(BOARD) = "esp32_devkitc_wroom" + default "esp32s3_devkitm/esp32s3/appcpu" if $(BOARD) = "esp32s3_devkitm" diff --git a/samples/drivers/ipm/ipm_esp32/README.rst b/samples/drivers/ipm/ipm_esp32/README.rst index 5deb498b2f9d5..9f17389cc62d2 100644 --- a/samples/drivers/ipm/ipm_esp32/README.rst +++ b/samples/drivers/ipm/ipm_esp32/README.rst @@ -26,7 +26,8 @@ Build the ESP32 IPM sample code as follows: .. zephyr-app-commands:: :zephyr-app: samples/drivers/ipm/ipm_esp32 - :board: esp32_devkitc_wroom/esp32/procpu + :board: esp32s3_devkitm/esp32s3/procpu + :west-args: --sysbuild :goals: build :compact: @@ -38,18 +39,20 @@ console program (e.g., minicom, putty, screen, etc). .. code-block:: console - *** Booting Zephyr OS build v3.3.0-rc3-38-gc9225e4365b9 *** - PRO_CPU is sending a fake request, waiting remote response... - PRO_CPU received a message from APP_CPU : APP_CPU: This is a response - PRO_CPU is sending a fake request, waiting remote response... - PRO_CPU received a message from APP_CPU : APP_CPU: This is a response - PRO_CPU is sending a fake request, waiting remote response... - PRO_CPU received a message from APP_CPU : APP_CPU: This is a response - PRO_CPU is sending a fake request, waiting remote response... - PRO_CPU received a message from APP_CPU : APP_CPU: This is a response - PRO_CPU is sending a fake request, waiting remote response... - PRO_CPU received a message from APP_CPU : APP_CPU: This is a response - PRO_CPU is sending a fake request, waiting remote response... - PRO_CPU received a message from APP_CPU : APP_CPU: This is a response - PRO_CPU is sending a fake request, waiting remote response... - PRO_CPU received a message from APP_CPU : APP_CPU: This is a response + *** Booting Zephyr OS build v4.0.0-rc2-61-ga24efebe15e2 *** + PRO_CPU is sending a request, waiting remote response... + PRO_CPU received a message from APP_CPU : APP_CPU uptime ticks 502 + PRO_CPU is sending a request, waiting remote response... + PRO_CPU received a message from APP_CPU : APP_CPU uptime ticks 10502 + PRO_CPU is sending a request, waiting remote response... + PRO_CPU received a message from APP_CPU : APP_CPU uptime ticks 20503 + PRO_CPU is sending a request, waiting remote response... + PRO_CPU received a message from APP_CPU : APP_CPU uptime ticks 30504 + PRO_CPU is sending a request, waiting remote response... + PRO_CPU received a message from APP_CPU : APP_CPU uptime ticks 40505 + PRO_CPU is sending a request, waiting remote response... + PRO_CPU received a message from APP_CPU : APP_CPU uptime ticks 50506 + PRO_CPU is sending a request, waiting remote response... + PRO_CPU received a message from APP_CPU : APP_CPU uptime ticks 60507 + PRO_CPU is sending a request, waiting remote response... + PRO_CPU received a message from APP_CPU : APP_CPU uptime ticks 70508 diff --git a/samples/drivers/ipm/ipm_esp32/ipm_esp_appcpu/prj.conf b/samples/drivers/ipm/ipm_esp32/ipm_esp_appcpu/prj.conf deleted file mode 100644 index 05a3de09ec11c..0000000000000 --- a/samples/drivers/ipm/ipm_esp32/ipm_esp_appcpu/prj.conf +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_HEAP_MEM_POOL_SIZE=256 -CONFIG_IPM=y diff --git a/samples/drivers/ipm/ipm_esp32/ipm_esp_appcpu/CMakeLists.txt b/samples/drivers/ipm/ipm_esp32/remote/CMakeLists.txt similarity index 66% rename from samples/drivers/ipm/ipm_esp32/ipm_esp_appcpu/CMakeLists.txt rename to samples/drivers/ipm/ipm_esp32/remote/CMakeLists.txt index 44114da84509a..51ba683f4f67a 100644 --- a/samples/drivers/ipm/ipm_esp32/ipm_esp_appcpu/CMakeLists.txt +++ b/samples/drivers/ipm/ipm_esp32/remote/CMakeLists.txt @@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(ipm_esp32_appcpu) + +message(STATUS "${BOARD} compiles as remote in this sample") +project(ipm_esp32_remote) target_sources(app PRIVATE src/main.c) diff --git a/samples/drivers/ipm/ipm_esp32/remote/prj.conf b/samples/drivers/ipm/ipm_esp32/remote/prj.conf new file mode 100644 index 0000000000000..c56177a430671 --- /dev/null +++ b/samples/drivers/ipm/ipm_esp32/remote/prj.conf @@ -0,0 +1,3 @@ +CONFIG_HEAP_MEM_POOL_SIZE=2048 +CONFIG_MAIN_STACK_SIZE=4096 +CONFIG_IPM=y diff --git a/samples/drivers/ipm/ipm_esp32/boards/esp32_devkitc_wroom_procpu.overlay b/samples/drivers/ipm/ipm_esp32/remote/socs/esp32s3_appcpu.overlay similarity index 100% rename from samples/drivers/ipm/ipm_esp32/boards/esp32_devkitc_wroom_procpu.overlay rename to samples/drivers/ipm/ipm_esp32/remote/socs/esp32s3_appcpu.overlay diff --git a/samples/drivers/ipm/ipm_esp32/ipm_esp_appcpu/src/main.c b/samples/drivers/ipm/ipm_esp32/remote/src/main.c similarity index 73% rename from samples/drivers/ipm/ipm_esp32/ipm_esp_appcpu/src/main.c rename to samples/drivers/ipm/ipm_esp32/remote/src/main.c index afb7921fc6460..9e7abde4cb5c8 100644 --- a/samples/drivers/ipm/ipm_esp32/ipm_esp_appcpu/src/main.c +++ b/samples/drivers/ipm/ipm_esp32/remote/src/main.c @@ -4,17 +4,18 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include +#include #include #include -#include static const struct device *ipm_dev; -static const char fake_resp[] = {"APP_CPU: This is a response"}; +static char resp[64]; struct k_sem sync; -static void ipm_receive_callback(const struct device *ipmdev, void *user_data, - uint32_t id, volatile void *data) +static void ipm_receive_callback(const struct device *ipmdev, void *user_data, uint32_t id, + volatile void *data) { k_sem_give(&sync); } @@ -33,7 +34,9 @@ int main(void) while (1) { k_sem_take(&sync, K_FOREVER); - ipm_send(ipm_dev, -1, sizeof(fake_resp), &fake_resp, sizeof(fake_resp)); + snprintf(resp, sizeof(resp), "APP_CPU uptime ticks %lli\n", k_uptime_ticks()); + ipm_send(ipm_dev, -1, sizeof(resp), &resp, sizeof(resp)); } + return 0; } diff --git a/samples/drivers/ipm/ipm_esp32/boards/esp32_devkitc_wrover_procpu.overlay b/samples/drivers/ipm/ipm_esp32/socs/esp32_procpu.overlay similarity index 100% rename from samples/drivers/ipm/ipm_esp32/boards/esp32_devkitc_wrover_procpu.overlay rename to samples/drivers/ipm/ipm_esp32/socs/esp32_procpu.overlay diff --git a/samples/drivers/ipm/ipm_esp32/socs/esp32s3_procpu.overlay b/samples/drivers/ipm/ipm_esp32/socs/esp32s3_procpu.overlay new file mode 100644 index 0000000000000..ab1795abad772 --- /dev/null +++ b/samples/drivers/ipm/ipm_esp32/socs/esp32s3_procpu.overlay @@ -0,0 +1,3 @@ +&ipm0 { + status = "okay"; +}; diff --git a/samples/drivers/ipm/ipm_esp32/src/main.c b/samples/drivers/ipm/ipm_esp32/src/main.c index 5bb06f9cf98fb..4a884281e3603 100644 --- a/samples/drivers/ipm/ipm_esp32/src/main.c +++ b/samples/drivers/ipm/ipm_esp32/src/main.c @@ -10,24 +10,26 @@ #include #include -static const char fake_request[] = {"PRO_CPU: Fake request to APP_CPU"}; +static const char request[] = {"PRO_CPU: request to APP_CPU"}; static const struct device *ipm_dev; static char received_string[64]; static struct k_sem sync; -static void ipm_receive_callback(const struct device *ipmdev, void *user_data, - uint32_t id, volatile void *data) +static void ipm_receive_callback(const struct device *ipmdev, void *user_data, uint32_t id, + volatile void *data) { ARG_UNUSED(ipmdev); ARG_UNUSED(user_data); - strcpy(received_string, (const char *)data); + strncpy(received_string, (const char *)data, sizeof(received_string)); k_sem_give(&sync); } int main(void) { + int ret; + k_sem_init(&sync, 0, 1); ipm_dev = DEVICE_DT_GET(DT_NODELABEL(ipm0)); @@ -38,15 +40,23 @@ int main(void) ipm_register_callback(ipm_dev, ipm_receive_callback, NULL); + /* Workaround to catch up with APPCPU */ + k_sleep(K_MSEC(50)); + while (1) { - printk("PRO_CPU is sending a fake request, waiting remote response...\n\r"); + printk("PRO_CPU is sending a request, waiting remote response...\n\r"); + + ipm_send(ipm_dev, -1, sizeof(request), &request, sizeof(request)); - ipm_send(ipm_dev, -1, sizeof(fake_request), &fake_request, sizeof(fake_request)); - k_sem_take(&sync, K_FOREVER); + ret = k_sem_take(&sync, K_MSEC(5000)); - printk("PRO_CPU received a message from APP_CPU : %s\n\r", received_string); + if (ret) { + printk("No response from APP_CPU - trying again.\r\n"); + } else { + printk("PRO_CPU received a message from APP_CPU : %s\n\r", received_string); + } - k_sleep(K_MSEC(200)); + k_sleep(K_MSEC(1000)); } return 0; } diff --git a/samples/drivers/ipm/ipm_esp32/src/procpu_shell.c b/samples/drivers/ipm/ipm_esp32/src/procpu_shell.c new file mode 100644 index 0000000000000..e3889efa4ba5b --- /dev/null +++ b/samples/drivers/ipm/ipm_esp32/src/procpu_shell.c @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Command usage info. */ +#define START_HELP ("\n\nStart the APPCPU") +#define STOP_HELP ("\n\nStop the APPCPU") + +void esp_appcpu_image_start(unsigned int hdr_offset); +void esp_appcpu_image_stop(void); + +static int cmd_appcpu_start(const struct shell *sh, size_t argc, char *argv[]) +{ + ARG_UNUSED(sh); + ARG_UNUSED(argc); + ARG_UNUSED(argv); + + printk("start appcpu\n"); + + esp_appcpu_image_start(0x20); + + return 0; +} + +static int cmd_appcpu_stop(const struct shell *sh, size_t argc, char *argv[]) +{ + ARG_UNUSED(sh); + ARG_UNUSED(argc); + ARG_UNUSED(argv); + + printk("stop appcpu\n"); + + esp_appcpu_image_stop(); + + return 0; +} + +SHELL_STATIC_SUBCMD_SET_CREATE(sub_amp, + /* Alphabetically sorted to ensure correct Tab autocompletion. */ + SHELL_CMD_ARG(appstart, NULL, START_HELP, cmd_appcpu_start, 1, 0), + SHELL_CMD_ARG(appstop, NULL, STOP_HELP, cmd_appcpu_stop, 1, 0), + SHELL_SUBCMD_SET_END /* Array terminated. */ +); + +SHELL_CMD_REGISTER(amp, &sub_amp, "AMP debug commands.", NULL); diff --git a/samples/drivers/ipm/ipm_esp32/sysbuild.cmake b/samples/drivers/ipm/ipm_esp32/sysbuild.cmake new file mode 100644 index 0000000000000..1ec5cf9c3e4d3 --- /dev/null +++ b/samples/drivers/ipm/ipm_esp32/sysbuild.cmake @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright 2024 Espressif + +# Add external project +ExternalZephyrProject_Add( + APPLICATION ipm_esp32_remote + SOURCE_DIR ${APP_DIR}/remote + BOARD ${SB_CONFIG_IPM_REMOTE_BOARD} + ) + +# Add dependencies so that the remote sample will be built first +# This is required because some primary cores need information from the +# remote core's build, such as the output image's LMA +add_dependencies(ipm_esp32 ipm_esp32_remote) +sysbuild_add_dependencies(CONFIGURE ipm_esp32 ipm_esp32_remote) + +if(SB_CONFIG_BOOTLOADER_MCUBOOT) + # Make sure MCUboot is flashed first + sysbuild_add_dependencies(FLASH ipm_esp32_remote mcuboot) +endif() From c4b79038280bec1f7ecf0ae363c14cb963fbb242 Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Mon, 4 Nov 2024 16:21:40 -0300 Subject: [PATCH 2227/4482] pinctrl: esp32c6: Fix for input/output enable flags Fix missing input/output enable flags on pinctrl macro, which wouldn't allow for driver to see and apply flags configuration made in the device tree. Signed-off-by: Raffael Rostagno --- soc/espressif/esp32c6/pinctrl_soc.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/soc/espressif/esp32c6/pinctrl_soc.h b/soc/espressif/esp32c6/pinctrl_soc.h index 2a92315fc9e56..db809815baf8d 100644 --- a/soc/espressif/esp32c6/pinctrl_soc.h +++ b/soc/espressif/esp32c6/pinctrl_soc.h @@ -40,14 +40,16 @@ typedef struct pinctrl_soc_pin { * * @param node_id Node identifier. */ -#define Z_PINCTRL_ESP32_PINCFG_INIT(node_id) \ - (((ESP32_NO_PULL * DT_PROP(node_id, bias_disable)) << ESP32_PIN_BIAS_SHIFT) | \ - ((ESP32_PULL_UP * DT_PROP(node_id, bias_pull_up)) << ESP32_PIN_BIAS_SHIFT) | \ - ((ESP32_PULL_DOWN * DT_PROP(node_id, bias_pull_down)) << ESP32_PIN_BIAS_SHIFT) | \ - ((ESP32_PUSH_PULL * DT_PROP(node_id, drive_push_pull)) << ESP32_PIN_DRV_SHIFT) | \ - ((ESP32_OPEN_DRAIN * DT_PROP(node_id, drive_open_drain)) << ESP32_PIN_DRV_SHIFT) | \ - ((ESP32_PIN_OUT_HIGH * DT_PROP(node_id, output_high)) << ESP32_PIN_OUT_SHIFT) | \ - ((ESP32_PIN_OUT_LOW * DT_PROP(node_id, output_low)) << ESP32_PIN_OUT_SHIFT)) +#define Z_PINCTRL_ESP32_PINCFG_INIT(node_id) \ + (((ESP32_NO_PULL * DT_PROP(node_id, bias_disable)) << ESP32_PIN_BIAS_SHIFT) | \ + ((ESP32_PULL_UP * DT_PROP(node_id, bias_pull_up)) << ESP32_PIN_BIAS_SHIFT) | \ + ((ESP32_PULL_DOWN * DT_PROP(node_id, bias_pull_down)) << ESP32_PIN_BIAS_SHIFT) | \ + ((ESP32_PUSH_PULL * DT_PROP(node_id, drive_push_pull)) << ESP32_PIN_DRV_SHIFT) | \ + ((ESP32_OPEN_DRAIN * DT_PROP(node_id, drive_open_drain)) << ESP32_PIN_DRV_SHIFT) | \ + ((ESP32_PIN_OUT_HIGH * DT_PROP(node_id, output_high)) << ESP32_PIN_OUT_SHIFT) | \ + ((ESP32_PIN_OUT_LOW * DT_PROP(node_id, output_low)) << ESP32_PIN_OUT_SHIFT) | \ + ((ESP32_PIN_OUT_EN * DT_PROP(node_id, output_enable)) << ESP32_PIN_EN_DIR_SHIFT) | \ + ((ESP32_PIN_IN_EN * DT_PROP(node_id, input_enable)) << ESP32_PIN_EN_DIR_SHIFT)) /** * @brief Utility macro to initialize each pin. From 38a70cc1fda3ab7fe79f43c9bed2cc04cb5d92bb Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Mon, 4 Nov 2024 16:23:33 -0300 Subject: [PATCH 2228/4482] tests: drivers: spi: esp32c6: Fix overlay configuration for loopback Fixes overlay configuration to allow running the test on CI without externally connecting two pins. Signed-off-by: Raffael Rostagno --- tests/drivers/spi/spi_loopback/socs/esp32c6.overlay | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/drivers/spi/spi_loopback/socs/esp32c6.overlay b/tests/drivers/spi/spi_loopback/socs/esp32c6.overlay index f34b784339cfc..7436f9b6aecbe 100644 --- a/tests/drivers/spi/spi_loopback/socs/esp32c6.overlay +++ b/tests/drivers/spi/spi_loopback/socs/esp32c6.overlay @@ -8,11 +8,11 @@ spim2_loopback: spim2_loopback { group1 { pinmux = ; - output-enable; /* Connect GPIO2 and GPIO3 externally for testing */ + output-enable; /* Enable internal loopback */ }; group2 { - pinmux = ; - input-enable; /* Connect GPIO2 and GPIO3 externally for testing */ + pinmux = ; + input-enable; /* Enable internal loopback */ }; group3 { pinmux = , From 397b5cbcd99e542df314839fb967e922d639ff33 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Fri, 25 Oct 2024 15:17:18 +0200 Subject: [PATCH 2229/4482] doc: Use correct RST headings in autopts-linux.rst The documentation guidelines have a specified order of header underlines that this file did not follow. Signed-off-by: Emil Gydesen --- .../bluetooth/autopts/autopts-linux.rst | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/doc/connectivity/bluetooth/autopts/autopts-linux.rst b/doc/connectivity/bluetooth/autopts/autopts-linux.rst index 5977b20b3b231..18646fc969176 100644 --- a/doc/connectivity/bluetooth/autopts/autopts-linux.rst +++ b/doc/connectivity/bluetooth/autopts/autopts-linux.rst @@ -24,10 +24,10 @@ For running with QEMU or :ref:`native_sim `, see :ref:`bluetooth_qem :depth: 2 Setup Linux -=========== +*********** Install nrftools (only required in the actual hardware test mode) -================================================================= +***************************************************************** Download latest nrftools (version >= 10.12.1) from site https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Command-Line-Tools/Download. @@ -47,7 +47,7 @@ and README.md. To install the tools, double click on each .deb file or follow instructions from README.md. Setup Windows 10 virtual machine -================================== +******************************** Choose and install your hypervisor like VMWare Workstation(preferred) or VirtualBox. On VirtualBox could be some issues, if your host has fewer than 6 CPU. @@ -58,17 +58,17 @@ installed guest extensions. Setup tested with VirtualBox 6.1.18 and VMWare Workstation 16.1.1 Pro. Update Windows ---------------- +============== Update Windows in: Start -> Settings -> Update & Security -> Windows Update Setup static IP ----------------- +=============== WMWare Works -^^^^^^^^^^^^^ +------------ On Linux, open Virtual Network Editor app and create network: @@ -92,7 +92,7 @@ If you type 'ifconfig' in terminal, you should be able to find your host IP: :align: center VirtualBox -^^^^^^^^^^^^^ +---------- Go to: @@ -114,7 +114,7 @@ Add adapter 2: :align: center Windows -^^^^^^^^ +------- Setup static IP on Windows virtual machine. Go to Settings -> Network & Internet -> Ethernet -> Unidentified network -> Edit @@ -127,7 +127,7 @@ and set: :align: center Install Python 3 ------------------ +================ Download and install latest `Python 3 `_ on Windows. Let the installer add the Python installation directory to the PATH and @@ -144,7 +144,7 @@ disable the path length limitation. :align: center Install Git ------------- +=========== Download and install `Git `_. During installation enable option: Enable experimental support for pseudo @@ -156,7 +156,7 @@ consoles. We will use Git Bash as Windows terminal. :align: center Install PTS 8 --------------- +============= On Windows virtual machine, install latest PTS from https://www.bluetooth.org. Remember to install drivers from installation directory @@ -173,7 +173,7 @@ Remember to install drivers from installation directory So to capture Bluetooth events, you have to download it separately. Connect PTS dongle --------------------- +================== With VirtualBox there should be no problem. Just find dongle in Devices -> USB and connect. @@ -202,7 +202,7 @@ Write anywhere in the file following line: just replace 0x0a12 with Vendor number and 0x0001 with ProdID number you found earlier. Connect devices (only required in the actual hardware test mode) -================================================================ +**************************************************************** .. image:: devices_1.png :height: 400 @@ -215,7 +215,7 @@ Connect devices (only required in the actual hardware test mode) :align: center Flash board (only required in the actual hardware test mode) -============================================================ +************************************************************ On Linux, go to ~/zephyrproject. There should be already ~/zephyrproject/build directory. Flash board: @@ -225,10 +225,10 @@ directory. Flash board: west flash Setup auto-pts project -======================= +********************** AutoPTS client on Linux ------------------------- +======================= Clone auto-pts project: @@ -252,7 +252,7 @@ Install required python modules: pip3 install --user -r autoptsclient_requirements.txt Autopts server on Windows virtual machine ------------------------------------------- +========================================= In Git Bash, clone auto-pts project repo: .. code-block:: @@ -270,7 +270,7 @@ Install required python modules: Restart virtual machine. Running AutoPTS -================ +**************** Server and client by default will run on localhost address. Run server: @@ -338,7 +338,7 @@ At the first run, when Windows asks, enable connection through firewall: :align: center Troubleshooting -================ +**************** - "After running one test, I need to restart my Windows virtual machine to run another, because of fail verdict from APICOM in PTS logs." From e89a5d10efe1199f0aff561657ae16fff3e245c3 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Fri, 25 Oct 2024 15:33:38 +0200 Subject: [PATCH 2230/4482] doc: Update Virtualbox steps for autopts-linux The exisitng documentation was out of date and possibly not working. Added a section on how to use NAT and port forwarding. Signed-off-by: Emil Gydesen --- .../bluetooth/autopts/autopts-linux.rst | 39 ++++++++++++++++-- .../bluetooth/autopts/virtualbox_nat_1.png | Bin 0 -> 53716 bytes .../bluetooth/autopts/virtualbox_nat_2.png | Bin 0 -> 12377 bytes .../autopts/virtualbox_static_ip_1.png | Bin 39544 -> 34515 bytes .../autopts/virtualbox_static_ip_2.png | Bin 50361 -> 51092 bytes 5 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 doc/connectivity/bluetooth/autopts/virtualbox_nat_1.png create mode 100644 doc/connectivity/bluetooth/autopts/virtualbox_nat_2.png diff --git a/doc/connectivity/bluetooth/autopts/autopts-linux.rst b/doc/connectivity/bluetooth/autopts/autopts-linux.rst index 18646fc969176..4d02f67cb84b1 100644 --- a/doc/connectivity/bluetooth/autopts/autopts-linux.rst +++ b/doc/connectivity/bluetooth/autopts/autopts-linux.rst @@ -55,7 +55,7 @@ VirtualBox. On VirtualBox could be some issues, if your host has fewer than 6 CP Create Windows virtual machine instance. Make sure it has at least 2 cores and installed guest extensions. -Setup tested with VirtualBox 6.1.18 and VMWare Workstation 16.1.1 Pro. +Setup tested with VirtualBox 7.1.4 and VMWare Workstation 16.1.1 Pro. Update Windows ============== @@ -64,9 +64,37 @@ Update Windows in: Start -> Settings -> Update & Security -> Windows Update +Setup NAT +========= + +It is possible to use NAT and portforwarding to setup communication between a Linux host and a +Windows guest. This is easiest setup for VirtualBox, and does not require any static IPs to be +configured, and will not get blocked by the Windows Firewall. + +VirtualBox +---------- + +Open virtual machine network settings. On adapter 1 you will have created by default NAT. +Open the Port Forwarding menu an add the ports you want. + + +.. image:: virtualbox_nat_1.png + :width: 500 + :align: center + +For example setting up the following will allow you to use +``localhost:65000`` and ``localhost:65002`` (or ``127.0.0.0:65000`` and ``127.0.0.0:65002``) +to connect to an AutoPTS Server in Windows running on ports 65000 and 65002. + +.. image:: virtualbox_nat_2.png + :width: 500 + :align: center + Setup static IP =============== +If you cannot or do not want to use NAT it is possible to configure a static IP. + WMWare Works ------------ @@ -94,14 +122,17 @@ If you type 'ifconfig' in terminal, you should be able to find your host IP: VirtualBox ---------- +VirtualBox on Linux, macOS and Solaris Oracle VM VirtualBox will only allow IP addresses in +``192.168.56.0/21`` range to be assigned to host-only adapters, so if using a static address with +VirtualBox this is the only address range you can use. + Go to: -File -> Host Network Manager +File -> Tools -> Network Manager and create network: .. image:: virtualbox_static_ip_1.png - :height: 400 :width: 500 :align: center @@ -109,7 +140,6 @@ Open virtual machine network settings. On adapter 1 you will have created by def Add adapter 2: .. image:: virtualbox_static_ip_2.png - :height: 400 :width: 500 :align: center @@ -126,6 +156,7 @@ and set: :width: 400 :align: center + Install Python 3 ================ diff --git a/doc/connectivity/bluetooth/autopts/virtualbox_nat_1.png b/doc/connectivity/bluetooth/autopts/virtualbox_nat_1.png new file mode 100644 index 0000000000000000000000000000000000000000..2f743426a2bdd8728dce2ad21eab17360e4dc2bf GIT binary patch literal 53716 zcmZsCcQjmG*Z2^kT!|7!Cj>!^9w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FL58$Yp{(8edt-K)ontdb5?b!!Vxo;>;B`7FW~ z;^WNHCJ+QC*moeUR9i7zsGUy}(-b?lH+LWzCWF_)0VQL!us2K4O>ARWjfO^gazsvb zjP`{N@5kBqS_tc9jM6mZifO;!?~^Du3MmHy>Fba%Iy0siRqEn)*tT`!EljHE`MG_chtT&)qT1XD27}K#3{y~+o8)F-3A)y4qVTqbnMpAf>q9i~jD87dv z&G{Avvv1!n7Yc<4{tvdyaKdeS%rBD`wLoOQL_`aPzm8Yl1Z&9zR&8CmqjDQGxG5k> z0;|o#L&mNobKwxz+AZ89lh!gotLMBjHFxvJ@WKncZg%(Hy~ht{3{SSao-r)F0zu$7 z+d@h`oxKw`Q1o^?rQF2RE)#=KCSUXIlFV=STrk#eA&_-{ECe9hIH4w>+=}nU&pP_? z7J8@+5;!_BF;R*}%jIYZzaqV(E{Yh3uAxTgx48YHg~Gp2W(NUvG8r7B=(>9C{rrsK z)6QlK=U;;$IKsXIZJx1QD3=QreYA}>u@?H%+Yxwr0eo zP_c~ccWkhQ_S)!IL<@!g(e4ye*}zdZIA_N;kX|i4vRVQ`;QaO$@|hs3rp3+rhi08}V@2f`M{6)t_Uk$-a=Z?d>KS_l9Y zD$xNw%y<5~g}1mCj-9*P44gN#5CAGvq659W?-U!5<;jMUCMPDUg~NDiTn6^6Dgc1$ zl;}XK^PMt}%fp9B(k9amF)ft-l8JT#0H{xi4zxNE(LiumZyLHUE#wUx0AQbJApl_S zUhUPf4Zt7}05SAUBue%lHZ)9e_7Zj>0Cg?|pw5K=)VUCVIu`;^=RyGLTnIp&3jwHe zApmtQ1fb4^0Mxw;0ieu<0My+J=L3MQxfgC30?;-4taSjOZ2iI$9!;Z-@L2!=002ov JPDHLkV1mt3(ZT=# literal 0 HcmV?d00001 diff --git a/doc/connectivity/bluetooth/autopts/virtualbox_nat_2.png b/doc/connectivity/bluetooth/autopts/virtualbox_nat_2.png new file mode 100644 index 0000000000000000000000000000000000000000..634b1afc73057345d6c09f714d817224f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XGw#eu-G91wWyVFgQp-Kt(OVis%(69(-<||3Sbt}5u8$vlh6|WV zf#qm2>^14GuIVcdRn;Smw&(Wkg0_4%15SzJU@w6hrm)Gi5ve)1kXREvj3+QNQfC28>EQ>bOGgvwHr^W>wF;E ijZ;l}bJ(DoYe2b6)}adzyYJr_nu>y^d=1Pp?B4+2>A?&D literal 0 HcmV?d00001 diff --git a/doc/connectivity/bluetooth/autopts/virtualbox_static_ip_1.png b/doc/connectivity/bluetooth/autopts/virtualbox_static_ip_1.png index d9d684011e369bd085c7ef8e8cdaeeb4fb5bc9e4..8767201cbe4be8c3816a42fbd18980a0c191662f 100644 GIT binary patch literal 34515 zcmYhi1yoeu7cdIaB_SF%F?P+0%qadA;mQE_r|^6>Cb7?zUh zet&#?BsVBxW@ct%V^dUAsi~=^rgndSudJ+02zEU@JSaJS z)Y8)W^XJd%>S|3*&CShiet!PIz<`sJ)8ypj<>ggYR#swSVrOS(e0+RbTAGiKPgz-+ zp`l?y~)Rulasvf-?R1}D<17!U0rQ$?aa)~tczA%=O5+0YjgJ> zA9sRDRp2PF*xcM)IyyS%l~9(y%t1+^lIM~3EiShz)OW*;-^r=?;h9@o6z#dWY)6g_t4m`8lt*gp^YOIg;n z{J8KQ7N7E15^3xi{7@?#y7nkid^quU|32M=F5>>tO*!cR>@kmJ(EVsL_;44b|6l<= zIy!JJMA;x;- z>=9D_kTSe3W8}{+qipLJ$DpBim@czuK-hNpxD)XP8wbZsmMdxE8rrz|0RiUn{6*u^ zZ68&v?U^nw$bD1z#>F>u-9sizfo{cxx@_@Q>&skqN1uN|RjbA;vDDRY0jgmIVyC?2 zU3Es0tg9JI5u*yqQXxVzQ-|=3S~m&i$2Q!!MMXni#^3L0^~)5Uelgr0j|*C))+T?z zb?^@{8)8?6qK+~C3zVg-}(K8VRdRK>92p00iLnWEydv&zrV7gf2DhS&7%w= z0?@M=07Qw>3)Al$FK+E6QQSB2&In9k3Z^~?&!azXRK~_m6Zykm&DZ|;+KIrkf-x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H3@tJ=ae#*zof={g zXPA22Aa3ZeVW6L9f}$$4YGz5!C|R@PSl@#!f(zxvUL3Xg z@JqWS0(C+)zJ6#btIbS%ygbNxdqCx`&Ab!MypTSB(~Rnt#CDNB0JL|`@l)P&3%*Ux zwRN3y&$Ls}1GDc<%M2%ST-v3izz4SP=2CmC`J=~_wR7%$TBIy}K=GJf(o4&Q6Cn|C zv|mb5bEtfOv70?sO_)7Levs{~-{r(&zci`eg_7`};deU3>S~AB9*rALIVC2xaGrtA J1?`o8{a>(Wv=;yX diff --git a/doc/connectivity/bluetooth/autopts/virtualbox_static_ip_2.png b/doc/connectivity/bluetooth/autopts/virtualbox_static_ip_2.png index 52f0342e66f75beecfff387913eaef66de2eb1ce..ed455fc84a2e49088cd6bcd56b1aea7816e6d510 100644 GIT binary patch literal 51092 zcmZsCbySqk_y2+l%2FyUAfSMV)Y2j)u{6@nE&@w;cOxt!At~M6xikna-QC?FDUH-` zd4Ilt{?4AW=ZU#9cV0K=&OF~0 z*x1-)Wo21dSm^2LNxxJwGBV1^$$>O-Np-80l$7G*<4Ls3Nub5Ix3?s)Qjlf=9UUF1 zUM)yHn+)D?aIjCJRTvW!UXl5DW&p`uES@-~Zy`LSJA1vC*iYm|SaXtFEr@%*@Pl zh_{A@MoCGD>*#%VcXwxJ=lJ+IY~o&j`o6cf7ic<4td{xZ%a^vcHb+NCGV9TxprG2? zS{oai-Q8VAr_uWQ`mL=kXJ@Au7Nc+MMw^?P&CJZQ_wWDR+|13*zS6DW7LZUKyC*eh zj@!8>({FsGQ);(xKRP;EU0ppnIqA84e|UHpzI9K*3rkE)RMylppS|x}IGLZHCsxZy z-Mtr5v*ya*x3{;qv$KQ4;X&*74h{}GJ3D@>_aaitbPl7=OZVh@Rcum59&Lw=LRu0^ zx^ErES8&>>-iJHyW{qg-fW(eRAzWW(8N3ssoPL)s&{C zu*wJMlX0_L|)6#`K5eb?@JV^Omggt8IcxWI1{SMjUYKBXH> z=1B0@nYY0ULf@tg2Ct+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# zfq@4IvZT-J7wPifSLO*~6WTvx&$=!c?$ZyrT0z0G5+5G^M3 zrq~W!qkD%9U>;@ zRg00Hk?XRGUd8s3W<~q=ozCOeAiy`yjsn(2cLE;sS0KNAo(gFm{?;{e!^+MyPH=UH zzV1L(6bI`+Q&UY%dHM-V^umq+2X?(5R5~zGMHbfMjCRv6dmGq4p9Lk(C7=3d^ikj= zp#GYI&*)*$3IiLk#iB%7fb;GY(C1zH-kYCgeTO)oO<&-)h}`;Z;joZHKj9#yL5MQo zKUJ+E_iI*LFJQH=L!Lv8`&Bmw9eApq*nrdx2Az0jD}y;-S0r{@e0==6wNqOxDf0pjL-12BM0wV$TZs~vUs(YQ${vQT;Rx&?3ufe#b?Q` z9+Q?fPYY(8X1xy)l$_X6Vx!P6BIIv> zz53SrolJxfQhny09>3n=K<`ih!&M@fIPHXkUPj8`v93Y>`@flKm0D%RWh3yW@QIA+ zGH7d=t~75p=~*HIFs~Nh4y4Aw<-@3nu#?3|4ol1C{+~{4 Date: Fri, 25 Oct 2024 15:44:19 +0200 Subject: [PATCH 2231/4482] doc: autopts-linux: Add troubleshooting for window opening and closing Refactored the structure of the troubleshooting section so it is more similar to how e.g. the ArchWiki lists troubleshooting entries, which makes it easier to search for and separate each entry. Signed-off-by: Emil Gydesen --- .../bluetooth/autopts/autopts-linux.rst | 21 ++++++++++++++++-- .../autopts/pts_automation_window.png | Bin 0 -> 7054 bytes 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 doc/connectivity/bluetooth/autopts/pts_automation_window.png diff --git a/doc/connectivity/bluetooth/autopts/autopts-linux.rst b/doc/connectivity/bluetooth/autopts/autopts-linux.rst index 4d02f67cb84b1..36b761ea96fad 100644 --- a/doc/connectivity/bluetooth/autopts/autopts-linux.rst +++ b/doc/connectivity/bluetooth/autopts/autopts-linux.rst @@ -371,13 +371,15 @@ At the first run, when Windows asks, enable connection through firewall: Troubleshooting **************** -- "After running one test, I need to restart my Windows virtual machine to run another, because of fail verdict from APICOM in PTS logs." +After running one test, I need to restart my Windows virtual machine to run another, because of fail verdict from APICOM in PTS logs +==================================================================================================================================== It means your virtual machine has not enough processor cores or memory. Try to add more in settings. Note that a host with 4 CPUs could be not enough with VirtualBox as hypervisor. In this case, choose rather VMWare Workstation. -- "I cannot start autoptsserver-zephyr.py. I always got error:" +I cannot start autoptsserver-zephyr.py. I always get a Python error +=================================================================== .. image:: autoptsserver_typical_error.png :height: 300 @@ -393,3 +395,18 @@ One or more of the following steps should help: - Delete temporary workspace. You will find it in auto-pts-code/workspaces/zephyr/zephyr-master/ as temp_zephyr-master. Be careful, do not remove the original one zephyr-master.pqw6. - Restart Windows virtual machine. + +The PTS automation window keeps opening and closing +=================================================== + +This indicates that it fails to capture a PTS dongle. +If the AutoPTS server is able to find and use a PTS dongle, +then the title of the window will show the Bluetooth address of the dongle. +If this does not happen then ensure that the dongle is plugged in, updated and recognized by PTS. + +.. image:: pts_automation_window.png + :width: 500 + :align: center + +If it still fails to run tests after this, +please ensure that the Bluetooth Protocol Viewer is installed. diff --git a/doc/connectivity/bluetooth/autopts/pts_automation_window.png b/doc/connectivity/bluetooth/autopts/pts_automation_window.png new file mode 100644 index 0000000000000000000000000000000000000000..5b2339cbf4ed8685b0e4eb4923a10b2eb3d19704 GIT binary patch literal 7054 zcmeHMcT`i^)(;jyBp{+l6G9Zl5)wiR2?V6q1f(MZ-Xu40C54huRYrl}fHUH#s6;@d zNfQMXMi3MRab~cAD58SESWrNiQ4wk1O)R6|_tyH>to7bn?+-5=?!M>j{X2XA&OSRi zm+w6ojz}eKB?JP2bat}yL?GrP5r}y%iu2)~faL+z@a-1p@62&_UXM_OA7D+n1qeB* zKCB}5QFfUJ8_CT_NUg+hTMElk9cj~+TPVBlgJqqM@*!9@`lth&B247wA>ert$Ki&D z&8~}!V3ZWd*4D$>))o~JCE!3@5P^t0zViUhsb!OHYlv5o=N8>zRI7ol zs5&G4xo^2gic-FBSl5+5IKM}vnHU>? zV|=5g;pPmbdHWUickZhhXD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ypt^8y1n-b&Lj?(&hBz6jnuy)rcK?Y=0bJ2QBW|7yDf{i+UJfD5n&iLI#23X`}20h)-kr^T`DSRokWcugD zhRr(u?6u~u*=g^42mFHPYRs|P;(KF%)Ch*SuUVmeyG9ObNhpSo8j@WwWyt#azch!r zZ3tRm#T5p=xUenQKlp;Vq+F5b*3zqPd3$GKXC^@?i9gg;np)J!%YnP2 zdwNtyiAlk6{Wu}@fx0}@eN}(QL2=&VWC9o9b%*JWS{|?68IUQioXLMq_f2^#1_Xjm zC{DeJ!nu_9J^$9BOGBzdqy!CzT)VtC=W& zb|P=4t>*#_IX7>;76NhE%3M!bzT}l<>dPx76KUgRJ-aN;0;Y&6H)k719+e~u&1rSD z&u%v-50xhE%04XaJQLB<+^1Up*21p8A^7A}lJUleGsy~hbEAV(3KvTD>h9WMhP>54 zD0JOAmJ$ADYHmf=qyP4_|Sh9A!T3_c>H$4^WK4+?VT(?cU z{+v(p!E?mZr~H&4W2%L_#g)^!R$@c*ZNsoMJ{&f(A1pd!_yz!JD(B6v<2t!Lq$+*@d>X zx#AMNHbvbc$8DieF+dV9$h4BukYhY#j{Eb3 zf&9Cz3@A$+w|e^=_h+vyZnj4Ahe~T0LnmGwx}njT>2tlK!mF$UM;o7OF25&+h@*EE z(wh^kRCNa4s}_vMcRg+ow>>JJv&g9Q%|5yR<+=nDymV@C)Sve+eh!# rJ4ycs^X>XCWq^AvX-0k1NNp3s9y#XOa4?ZAb=29OVRzbQ+n)acr0q79 literal 0 HcmV?d00001 From 4d8acdf9ed86795446118ccf3c4af30acf70b544 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Mon, 28 Oct 2024 09:56:48 +0100 Subject: [PATCH 2232/4482] doc: Fix VMWare type in autopots-linux It is called VMWare and not WMWare. Signed-off-by: Emil Gydesen --- doc/connectivity/bluetooth/autopts/autopts-linux.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/connectivity/bluetooth/autopts/autopts-linux.rst b/doc/connectivity/bluetooth/autopts/autopts-linux.rst index 36b761ea96fad..d97b5e8dcbd1d 100644 --- a/doc/connectivity/bluetooth/autopts/autopts-linux.rst +++ b/doc/connectivity/bluetooth/autopts/autopts-linux.rst @@ -95,7 +95,7 @@ Setup static IP If you cannot or do not want to use NAT it is possible to configure a static IP. -WMWare Works +VMWare Works ------------ On Linux, open Virtual Network Editor app and create network: From 72534b83e47da28862cb7696158e6503710f5e03 Mon Sep 17 00:00:00 2001 From: Marcus Penate Date: Wed, 9 Oct 2024 11:38:48 -0400 Subject: [PATCH 2233/4482] net: lib: sntp_simple: Handle responses from previous iterations SNTP simple runs request iterations with exponential backoff. If the net interface is a slower connection (ie. CAT M1 modems) then the request will be sent but the response may take time to be received, thus causing a timeout and another request to be sent. Because of the nature of UDP and the fact that the same socket (source IP/port combo) is being used for both requests, a delayed response to the first request can be received as the response to the second request, causing -EINVAL to be returned when the timestamps mismatch (see subsys/net/lib/sntp/sntp.c). The solution provided retries receiving the response when the timestamp is mismatched (without sending an additional request). Signed-off-by: Marcus Penate --- include/zephyr/net/sntp.h | 17 ++++++-- subsys/net/lib/sntp/sntp.c | 72 +++++++++++++++---------------- subsys/net/lib/sntp/sntp_simple.c | 25 ++++++++++- 3 files changed, 74 insertions(+), 40 deletions(-) diff --git a/include/zephyr/net/sntp.h b/include/zephyr/net/sntp.h index 02619fd352862..66128f76b467b 100644 --- a/include/zephyr/net/sntp.h +++ b/include/zephyr/net/sntp.h @@ -73,13 +73,24 @@ int sntp_init(struct sntp_ctx *ctx, struct sockaddr *addr, * * @param ctx Address of sntp context. * @param timeout Timeout of waiting for sntp response (in milliseconds). - * @param time Timestamp including integer and fractional seconds since + * @param ts Timestamp including integer and fractional seconds since + * 1 Jan 1970 (output). + * + * @return 0 if ok, <0 if error (-ETIMEDOUT if timeout). + */ +int sntp_query(struct sntp_ctx *ctx, uint32_t timeout, struct sntp_time *ts); + +/** + * @brief Attempt to receive an SNTP response after issuing a query + * + * @param ctx Address of sntp context. + * @param timeout Timeout of waiting for sntp response (in milliseconds). + * @param ts Timestamp including integer and fractional seconds since * 1 Jan 1970 (output). * * @return 0 if ok, <0 if error (-ETIMEDOUT if timeout). */ -int sntp_query(struct sntp_ctx *ctx, uint32_t timeout, - struct sntp_time *time); +int sntp_recv_response(struct sntp_ctx *ctx, uint32_t timeout, struct sntp_time *ts); /** * @brief Release SNTP context diff --git a/subsys/net/lib/sntp/sntp.c b/subsys/net/lib/sntp/sntp.c index d6f4620272efb..f7ac8cd566944 100644 --- a/subsys/net/lib/sntp/sntp.c +++ b/subsys/net/lib/sntp/sntp.c @@ -70,7 +70,7 @@ static int32_t parse_response(uint8_t *data, uint16_t len, struct sntp_time *exp NET_DBG("Mismatch originate timestamp: %d.%09d, expect: %llu.%09u", ntohl(pkt->orig_tm_s), ntohl(pkt->orig_tm_f), expected_orig_ts->seconds, expected_orig_ts->fraction); - return -EINVAL; + return -ERANGE; } if (pkt->mode != SNTP_MODE_SERVER) { @@ -151,38 +151,6 @@ static int32_t parse_response(uint8_t *data, uint16_t len, struct sntp_time *exp return 0; } -static int sntp_recv_response(struct sntp_ctx *sntp, uint32_t timeout, - struct sntp_time *time) -{ - struct sntp_pkt buf = { 0 }; - int status; - int rcvd; - - status = zsock_poll(sntp->sock.fds, sntp->sock.nfds, timeout); - if (status < 0) { - NET_ERR("Error in poll:%d", errno); - return -errno; - } - - if (status == 0) { - return -ETIMEDOUT; - } - - rcvd = zsock_recv(sntp->sock.fd, (uint8_t *)&buf, sizeof(buf), 0); - if (rcvd < 0) { - return -errno; - } - - if (rcvd != sizeof(struct sntp_pkt)) { - return -EMSGSIZE; - } - - status = parse_response((uint8_t *)&buf, sizeof(buf), - &sntp->expected_orig_ts, - time); - return status; -} - int sntp_init(struct sntp_ctx *ctx, struct sockaddr *addr, socklen_t addr_len) { int ret; @@ -213,13 +181,13 @@ int sntp_init(struct sntp_ctx *ctx, struct sockaddr *addr, socklen_t addr_len) return 0; } -int sntp_query(struct sntp_ctx *ctx, uint32_t timeout, struct sntp_time *time) +int sntp_query(struct sntp_ctx *ctx, uint32_t timeout, struct sntp_time *ts) { struct sntp_pkt tx_pkt = { 0 }; int ret = 0; int64_t ts_us = 0; - if (!ctx || !time) { + if (!ctx || !ts) { return -EFAULT; } @@ -239,7 +207,39 @@ int sntp_query(struct sntp_ctx *ctx, uint32_t timeout, struct sntp_time *time) return ret; } - return sntp_recv_response(ctx, timeout, time); + return sntp_recv_response(ctx, timeout, ts); +} + +int sntp_recv_response(struct sntp_ctx *ctx, uint32_t timeout, + struct sntp_time *ts) +{ + struct sntp_pkt buf = { 0 }; + int status; + int rcvd; + + status = zsock_poll(ctx->sock.fds, ctx->sock.nfds, timeout); + if (status < 0) { + NET_ERR("Error in poll:%d", errno); + return -errno; + } + + if (status == 0) { + return -ETIMEDOUT; + } + + rcvd = zsock_recv(ctx->sock.fd, (uint8_t *)&buf, sizeof(buf), 0); + if (rcvd < 0) { + return -errno; + } + + if (rcvd != sizeof(struct sntp_pkt)) { + return -EMSGSIZE; + } + + status = parse_response((uint8_t *)&buf, sizeof(buf), + &ctx->expected_orig_ts, + ts); + return status; } void sntp_close(struct sntp_ctx *ctx) diff --git a/subsys/net/lib/sntp/sntp_simple.c b/subsys/net/lib/sntp/sntp_simple.c index a4c6490948f27..cd8d280758516 100644 --- a/subsys/net/lib/sntp/sntp_simple.c +++ b/subsys/net/lib/sntp/sntp_simple.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ #include +#include #include #include @@ -15,6 +16,7 @@ static int sntp_simple_helper(struct sockaddr *addr, socklen_t addr_len, uint32_ struct sntp_ctx sntp_ctx; uint64_t deadline; uint32_t iter_timeout; + bool first_iter; res = sntp_init(&sntp_ctx, addr, addr_len); if (res < 0) { @@ -29,18 +31,39 @@ static int sntp_simple_helper(struct sockaddr *addr, socklen_t addr_len, uint32_ /* Timeout for current iteration */ iter_timeout = 100; + first_iter = true; while (k_uptime_get() < deadline) { res = sntp_query(&sntp_ctx, iter_timeout, ts); if (res != -ETIMEDOUT) { - break; + if (false == first_iter && -ERANGE == res) { + while (-ERANGE == res) { + /* Possible out of order packet received. + * Retry recv with current iteration timeout + * until an error or timeout (flushing the socket + * of old iteration responses until we timeout or + * receive our iteration's response) + */ + res = sntp_recv_response(&sntp_ctx, iter_timeout, ts); + } + + if (res != ETIMEDOUT) { + break; + } + } else { + break; + } } /* Exponential backoff with limit */ if (iter_timeout < 1000) { iter_timeout *= 2; } + + if (first_iter) { + first_iter = false; + } } sntp_close(&sntp_ctx); From f1572b988b61072a83afb5220583d354d73066c7 Mon Sep 17 00:00:00 2001 From: Maochen Wang Date: Fri, 8 Nov 2024 15:46:19 +0800 Subject: [PATCH 2234/4482] manifest: Update hostap to fix ECSA issue Update hostap to fix ECSA issue that warning log and current_mode is not updated. Signed-off-by: Maochen Wang --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index fe3c5dfa7800a..97bfaf602d24c 100644 --- a/west.yml +++ b/west.yml @@ -259,7 +259,7 @@ manifest: - hal - name: hostap path: modules/lib/hostap - revision: c533ab18dcf71795dcee61f4d2598ae31098f731 + revision: 0f7b166487b1ac08e1c6c492383f5c103320b2be - name: libmetal revision: a6851ba6dba8c9e87d00c42f171a822f7a29639b path: modules/hal/libmetal From 9561a0ac76bcdc092a7d28af3b99e6f204d9c745 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 8 Nov 2024 17:31:04 +0530 Subject: [PATCH 2235/4482] drivers: nrfwifi: Fix recovery for SAP nRF70 recovery relies on power-management feature which isn't applicable for SAP, so, we keep seeing false recovery causing interface restart. Disabled recovery for SAP to fix the issue. Fixes #81130. Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/Kconfig.nrfwifi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/wifi/nrfwifi/Kconfig.nrfwifi b/drivers/wifi/nrfwifi/Kconfig.nrfwifi index 2e6934bef2252..5101f225c58fc 100644 --- a/drivers/wifi/nrfwifi/Kconfig.nrfwifi +++ b/drivers/wifi/nrfwifi/Kconfig.nrfwifi @@ -650,7 +650,9 @@ config NRF_WIFI_AP_DEAD_DETECT_TIMEOUT config NRF_WIFI_RPU_RECOVERY bool "RPU recovery mechanism" + # Relies on power-save mode, so, LPM is needed and AP mode is not supported depends on NRF_WIFI_LOW_POWER + depends on !NRF70_AP_MODE default y select EXPERIMENTAL help From 414316379ad6604b39aa5a16632952ca0dd350d0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 7 Nov 2024 11:30:06 +0200 Subject: [PATCH 2236/4482] net: ipv4: fragmentation: Drop the packet if fragmentation fails If we could not fragment the IPv4 packet, then drop it and do not try to send it. Let the upper layer re-send the packet if needed. It is causing more trouble if we try to send the packet and not honor the MTU setting. Fixes #81021 Signed-off-by: Jukka Rissanen --- subsys/net/ip/ipv4_fragment.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/subsys/net/ip/ipv4_fragment.c b/subsys/net/ip/ipv4_fragment.c index 7eeaf53e2fc62..2fe6fb2033dd3 100644 --- a/subsys/net/ip/ipv4_fragment.c +++ b/subsys/net/ip/ipv4_fragment.c @@ -635,16 +635,15 @@ enum net_verdict net_ipv4_prepare_for_send(struct net_pkt *pkt) if (ret < 0) { LOG_DBG("Cannot fragment IPv4 pkt (%d)", ret); - if (ret == -ENOMEM || ret == -ENOBUFS || ret == -EPERM) { - /* Try to send the packet if we could not allocate enough - * network packets or if the don't fragment flag is set + if (ret == -EPERM) { + /* Try to send the packet if the don't fragment flag is set * and hope the original large packet can be sent OK. */ goto ignore_frag_error; - } else { - /* Other error, drop the packet */ - return NET_DROP; } + + /* Other error, drop the packet */ + return NET_DROP; } /* We need to unref here because we simulate the packet being sent. */ From fe56ce5a1c9659a05777754a2760866aad8e1fa3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 7 Nov 2024 11:32:46 +0200 Subject: [PATCH 2237/4482] net: ipv6: fragmentation: Drop the packet if fragmentation fails If we could not fragment the IPv6 packet, then drop it and do not try to send it. Let the upper layer re-send the packet if needed. It is causing more trouble if we try to send the packet and not honor the MTU setting. Signed-off-by: Jukka Rissanen --- subsys/net/ip/ipv6_nbr.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/subsys/net/ip/ipv6_nbr.c b/subsys/net/ip/ipv6_nbr.c index 6677df73ae859..86e6b1f2173b1 100644 --- a/subsys/net/ip/ipv6_nbr.c +++ b/subsys/net/ip/ipv6_nbr.c @@ -818,15 +818,7 @@ enum net_verdict net_ipv6_prepare_for_send(struct net_pkt *pkt) pkt, pkt_len); if (ret < 0) { NET_DBG("Cannot fragment IPv6 pkt (%d)", ret); - - if (ret == -ENOMEM) { - /* Try to send the packet if we could - * not allocate enough network packets - * and hope the original large packet - * can be sent ok. - */ - goto ignore_frag_error; - } + return NET_DROP; } /* We need to unref here because we simulate the packet @@ -841,7 +833,6 @@ enum net_verdict net_ipv6_prepare_for_send(struct net_pkt *pkt) return NET_CONTINUE; } } -ignore_frag_error: #endif /* CONFIG_NET_IPV6_FRAGMENT */ /* If the IPv6 destination address is not link local, then try to get From c7cbe9176074bdd967fb36953c6936817187ee7e Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Wed, 6 Nov 2024 13:34:59 +0100 Subject: [PATCH 2238/4482] drivers: i2c: stm32 I2C V2 handles i2c_target processed_cb return code Check the return code of the i2c_target_read/write callback function is 0 before continuing the transmit/receive operation on I2C target When Transmitting: 0 if data has been provided, then continue When address matches: 0 if the write is accepted or if more data can be requested depending on the transfer direction. Signed-off-by: Francois Ramu --- drivers/i2c/i2c_ll_stm32_v2.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/i2c_ll_stm32_v2.c b/drivers/i2c/i2c_ll_stm32_v2.c index 2b96a89725c4e..8e97fffbf09b8 100644 --- a/drivers/i2c/i2c_ll_stm32_v2.c +++ b/drivers/i2c/i2c_ll_stm32_v2.c @@ -254,8 +254,11 @@ static void stm32_i2c_slave_event(const struct device *dev) if (LL_I2C_IsActiveFlag_TXIS(i2c)) { uint8_t val; - slave_cb->read_processed(slave_cfg, &val); - LL_I2C_TransmitData8(i2c, val); + if (slave_cb->read_processed(slave_cfg, &val) < 0) { + LOG_ERR("Error continuing reading"); + } else { + LL_I2C_TransmitData8(i2c, val); + } return; } @@ -293,14 +296,20 @@ static void stm32_i2c_slave_event(const struct device *dev) dir = LL_I2C_GetTransferDirection(i2c); if (dir == LL_I2C_DIRECTION_WRITE) { - slave_cb->write_requested(slave_cfg); - LL_I2C_EnableIT_RX(i2c); + if (slave_cb->write_requested(slave_cfg) < 0) { + LOG_ERR("Error initiating writing"); + } else { + LL_I2C_EnableIT_RX(i2c); + } } else { uint8_t val; - slave_cb->read_requested(slave_cfg, &val); - LL_I2C_TransmitData8(i2c, val); - LL_I2C_EnableIT_TX(i2c); + if (slave_cb->read_requested(slave_cfg, &val) < 0) { + LOG_ERR("Error initiating reading"); + } else { + LL_I2C_TransmitData8(i2c, val); + LL_I2C_EnableIT_TX(i2c); + } } stm32_i2c_enable_transfer_interrupts(dev); From dc2c13bebdbab323534b052ffb788565abb379bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 8 Nov 2024 11:40:00 +0100 Subject: [PATCH 2239/4482] doc: ci: Build documentation on board documentation changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds glob expression triggering CI for *all* changes in boards' documentation, not just those matching the "*.rst" pattern since there can also be images being changed without any other change on RST files. Signed-off-by: Benjamin Cabé --- .github/workflows/doc-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/doc-build.yml b/.github/workflows/doc-build.yml index c7009b2450c6a..7564d163f81d5 100644 --- a/.github/workflows/doc-build.yml +++ b/.github/workflows/doc-build.yml @@ -42,6 +42,7 @@ jobs: with: files: | doc/ + boards/**/doc/ **.rst include/ kernel/include/kernel_arch_interface.h From 7c5c45944080358f8bb357e70676c09d9bddf97a Mon Sep 17 00:00:00 2001 From: Ioannis Karachalios Date: Mon, 7 Oct 2024 18:17:22 +0300 Subject: [PATCH 2240/4482] drivers: memc: Fix various APS6404 device issues This commit deals with fixing various issues that prevents the device from being built. In specific: 1. Fix default timing macro definitions to build with an MSPI controller, other than AMBIG. Add macro definition for MSPI_PORT. 2. Timing settings should be applied only when MSPI_TIMING is defined. Otherwise, the APS6404 initialization routine will fail with -EIO. 3. Similarly, use MSPI_XIP and MSPI_SCRAMBLE to apply XIP and SCRAMBLE device settings, respectively (optimization). 4. MEMC_INIT_PRIORITY is assigned higher priority than MSPI_INIT_PRIORITY which results in compiler error as APS6404 device initialization depends on its underlying MSPI bus controller. 5. The 'acquire' subroutine should be compiled when PM_DEVICE is used (suppress compiler warning). Signed-off-by: Ioannis Karachalios --- drivers/memc/Kconfig | 1 + drivers/memc/memc_mspi_aps6404l.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/memc/Kconfig b/drivers/memc/Kconfig index 0e351bc44ae94..966b7ecb63494 100644 --- a/drivers/memc/Kconfig +++ b/drivers/memc/Kconfig @@ -13,6 +13,7 @@ if MEMC config MEMC_INIT_PRIORITY int "Initialization priority" + default 80 if MSPI default 0 help Memory controllers initialization priority. diff --git a/drivers/memc/memc_mspi_aps6404l.c b/drivers/memc/memc_mspi_aps6404l.c index 300736c3e9393..a3bf64cb45006 100644 --- a/drivers/memc/memc_mspi_aps6404l.c +++ b/drivers/memc/memc_mspi_aps6404l.c @@ -135,6 +135,7 @@ static int memc_mspi_aps6404l_command_read(const struct device *psram, uint8_t c return ret; } +#if CONFIG_PM_DEVICE static void acquire(const struct device *psram) { const struct memc_mspi_aps6404l_config *cfg = psram->config; @@ -154,6 +155,7 @@ static void acquire(const struct device *psram) } } } +#endif /* CONFIG_PM_DEVICE */ static void release(const struct device *psram) { @@ -341,13 +343,16 @@ static int memc_mspi_aps6404l_init(const struct device *psram) } data->dev_cfg = cfg->tar_dev_cfg; +#if CONFIG_MSPI_TIMING if (mspi_timing_config(cfg->bus, &cfg->dev_id, cfg->timing_cfg_mask, (void *)&cfg->tar_timing_cfg)) { LOG_ERR("Failed to config mspi timing/%u", __LINE__); return -EIO; } data->timing_cfg = cfg->tar_timing_cfg; +#endif /* CONFIG_MSPI_TIMING */ +#if CONFIG_MSPI_XIP if (cfg->tar_xip_cfg.enable) { if (mspi_xip_config(cfg->bus, &cfg->dev_id, &cfg->tar_xip_cfg)) { LOG_ERR("Failed to enable XIP/%u", __LINE__); @@ -355,7 +360,9 @@ static int memc_mspi_aps6404l_init(const struct device *psram) } data->xip_cfg = cfg->tar_xip_cfg; } +#endif /* CONFIG_MSPI_XIP */ +#if CONFIG_MSPI_SCRAMBLE if (cfg->tar_scramble_cfg.enable) { if (mspi_scramble_config(cfg->bus, &cfg->dev_id, &cfg->tar_scramble_cfg)) { LOG_ERR("Failed to enable scrambling/%u", __LINE__); @@ -363,6 +370,7 @@ static int memc_mspi_aps6404l_init(const struct device *psram) } data->scramble_cfg = cfg->tar_scramble_cfg; } +#endif /* MSPI_SCRAMBLE */ release(psram); @@ -423,8 +431,9 @@ static int memc_mspi_aps6404l_init(const struct device *psram) } #define MSPI_TIMING_CONFIG_MASK(n) DT_INST_PROP(n, ambiq_timing_config_mask) #else -#define MSPI_TIMING_CONFIG(n) -#define MSPI_TIMING_CONFIG_MASK(n) +#define MSPI_TIMING_CONFIG(n) {} +#define MSPI_TIMING_CONFIG_MASK(n) MSPI_TIMING_PARAM_DUMMY +#define MSPI_PORT(n) 0 #endif #define MEMC_MSPI_APS6404L(n) \ From ebac6f2f219b42699d6a3da0a5d6c12aaf179997 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Fri, 8 Nov 2024 11:49:42 +0100 Subject: [PATCH 2241/4482] doc: release-notes: Add 4.0.0 release notes for networking Add 4.0.0 release notes for networking. Signed-off-by: Robert Lubos --- doc/releases/release-notes-4.0.rst | 205 +++++++++++++++++++++++++++-- 1 file changed, 196 insertions(+), 9 deletions(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index fd2fc682aa7db..5dba55b941a41 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -541,59 +541,246 @@ Drivers and Sensors Networking ********** +* 802.15.4: + + * Implemented support for beacons without association bit. + * Implemented support for beacons payload. + * Fixed a bug where LL address endianness was swapped twice when deciphering a frame. + * Fixed missing context lock release when checking destination address. + * Improved error logging in 6LoWPAN fragmentation. + * Improved error logging in 802.15.4 management commands. + * ARP: + * Fixed ARP probe verification during IPv4 address conflict detection. + * CoAP: -* Connection manager: + * Added new API :c:func:`coap_rst_init` to simplify creating RST replies. + * Implemented replying with CoAP RST response for unknown queries in CoAP client. + * Added support for runtime configuration of ACK random factor parameter. + * Added support for No Response CoAP option. + * Added a new sample demonstrating downloading a resource with GET request. + * Fixed handling of received CoAP RST reply in CoAP client. + * Fixed socket error reporting to the application in CoAP client. + * Fixed handling of response retransmissions in CoAP client. + * Fixed a bug where CoAP block numbers were limited to ``uint8_t``. + * Various fixes in the block transfer support in CoAP client. + * Improved handling of truncated datagrams in CoAP client. + * Improved thread safety of CoAP client. + * Fixed missing ``static`` keyword in some internal functions. + * Various other minor fixes in CoAP client. * DHCPv4: + * Added support for parsing multiple DNS servers received from DHCP server. + * Added support for DNS Server option in DHCPv4 server. + * Added support for Router option in DHCPv4 server. + * Added support for application callback which allows to assign custom addresses + in DHCPv4 server. + * Fixed DNS server list allocation in DHCPv4 client. + * Fixed a bug where system workqueue could be blocked indefinitely by DHCPv4 client. + * DHCPv6: + * Fixed a bug where system workqueue could be blocked indefinitely by DHCPv6 client. + * DNS/mDNS/LLMNR: + * Added support for collecting DNS statistics. + * Added support for more error codes in :c:func:`zsock_gai_strerror`. + * Fixed handling of DNS responses encoded with capital letters. + * Fixed DNS dispatcher operation on multiple network interfaces. + * Fixed error being reported for mDNS queries with query count equal to 0. + * Various other minor fixes in DNS/mDNS implementations. + +* Ethernet: + * gPTP/PTP: + * Fixed handling of second overflow/underflow. + * Fixed PTP clock adjusting with offset. + * HTTP: -* IPSP: + * Added support for specifying response headers and response code by the application. + * Added support for netusb in the HTTP server sample. + * Added support for accessing HTTP request headers from the application callback. + * Added support for handling IPv4 connections over IPv6 socket in HTTP server. + * Added support for creating HTTP server instances without specifying local host. + * Added overlays to support HTTP over IEEE 802.15.4 for HTTP client and server + samples. + * Added support for static filesystem resources in HTTP server. + * Fixed assertion in HTTP server sample when resource upload was aborted. + * Refactored dynamic resource callback format for easier handling of short + requests/replies. + * Fixed possible busy-looping in case of errors in the HTTP server sample. + * Fixed possible incorrect HTTP headers matching in HTTP server. + * Refactored HTTP server sample to better demonstrate server use cases. + * Fixed processing of multiple HTTP/1 requests over the same connection. + * Improved HTTP server test coverage. + * Various other minor fixes in HTTP server. * IPv4: + * Improved IGMP test coverage. + * Fixed IGMPv2 queries processing when IGMPv3 is enabled. + * Fixed :kconfig:option:`CONFIG_NET_NATIVE_IPV4` dependency for native IPv4 options. + * Fix net_pkt leak in :c:func:`send_ipv4_fragment`.` + * IPv6: + * Added a public header for Multicast Listener Discovery APIs. + * Added new :c:func:`net_ipv6_addr_prefix_mask` API function. + * Made IPv6 Router Solicitation timeout configurable. + * Fixed endless IPv6 packet looping with both routing and VLAN support enabled. + * Fixed unneeded error logging in case of dropped NS packets. + * Fixed accepting of incoming DAD NS messages. + * Various fixes improving IPv6 routing. + * LwM2M: - * Location object: optional resources altitude, radius, and speed can now be - used optionally as per the location object's specification. Users of these - resources will now need to provide a read buffer. - * lwm2m_senml_cbor: Regenerated generated code files using zcbor 0.9.0 + * Added TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 to DTLS cipher list. + * Added LwM2M shell command for listing resources. + * Added LwM2M shell command to list observations. + * Added support for accepting SenML-CBOR floats decoded as integers. + * Added support for X509 hostname verification if using certificates, when + URI contains valid name. + * Regenerated generated code files using zcbor 0.9.0 for lwm2m_senml_cbor. + * Improved thread safety of the LwM2M engine. + * Fixed block transfer issues for composite operations. + * Fixed enabler version reporting during bootstrap discovery. + * Removed unneeded Security object instance from the LwM2M client sample. + * Fixed buffer size check for U16 resource. + * Removed deprecated APIs and configs. + * Optional Location object resources altitude, radius, and speed can now be + used optionally as per the location object's specification. Users of these + resources will now need to provide a read buffer. + * Fixed the retry counter not being reset on successful Registration update. + * Fixed REGISTRATION_TIMEOUT event not always being emitted on registration + errors. + * Fixed c++ support in LwM2M public header. + * Fixed a bug where DISCONNECTED event was not always emitted when needed. * Misc: + * Added support for network packet allocation statistics. + * Added a new library implementing Prometheus monitoring support. + * Added USB CDC NCM support for Echo Server sample. + * Added packet drop statistics for capture interfaces. + * Added new :c:func:`net_hostname_set_postfix_str` API function to set hostname + postfix in non-hexadecimal format. + * Added API version information to public networking headers. + * Implemented optional periodic SNTP time resynchronization. + * Improved error reporting when starting/stopping virtual interfaces. + * Fixed build error of packet capture library when variable sized buffers are used. + * Fixed build error of packet capture library when either IPv4 or IPv6 is disabled. + * Fixed CMake complaint about missing sources in net library in certain + configurations. + * Fixed compilation issues with networking and SystemView Tracing enabled. + * Removed redundant DHCPv4 code from telnet sample. + * Fixed build warnings in Echo Client sample with IPv6 disabled. + * Removed deprecated net_pkt functions. + * Extended network tracing support and added documentation page + (:ref:`network_tracing`). + * Moved network buffers implementation out of net subsystem into lib directory + and renamed public header to :zephyr_file:`include/zephyr/net_buf.h`. + * Deprecated the :c:func:`net_buf_put` and :c:func:`net_buf_get` API functions. + * Removed ``wpansub`` sample. + * MQTT: + * Updated information in the mqtt_publisher sample about Mosquitto broker + configuration. + * Updated MQTT tests to be self-contained, no longer requiring external broker. + * Optimized buffer handling in MQTT encoder/decoder. + +* Network contexts: + + * Fixed IPv4 destination address setting when using :c:func:`sendmsg` with + :kconfig:option:`CONFIG_NET_IPV4_MAPPING_TO_IPV6` option enabled. + * Fixed possible unaligned memory access when in :c:func:`net_context_bind`. + * Fixed missing NULL pointer check for V6ONLY option read. + * Network Interface: -* OpenThread + * Added new :c:func:`net_if_ipv4_get_gw` API function. + * Fixed checksum offloading checks for VLAN interfaces. + * Fixed native IP support being required to register IP addresses on an + interface. + * Fixed missing mutex locks in a few net_if functions. + * Fixed rejoining of IPv6 multicast groups. + * Fixed :c:func:`net_if_send_data` operation for offloaded interfaces. + * Fixed needless IPv6 multicast groups joining if IPv6 is disabled. + * Fixed compiler warnings when building with ``-Wtype-limits``. + +* OpenThread: + + * Added support for :kconfig:option:`CONFIG_IEEE802154_SELECTIVE_TXCHANNEL` + option in OpenThread radio platform. + * Added NAT64 send and receive callbacks. + * Added new Kconfig options: -* PPP + * :kconfig:option:`CONFIG_OPENTHREAD_NAT64_CIDR` + * :kconfig:option:`CONFIG_OPENTHREAD_STORE_FRAME_COUNTER_AHEAD` + * :kconfig:option:`CONFIG_OPENTHREAD_DEFAULT_RX_SENSITIVITY` + * :kconfig:option:`CONFIG_OPENTHREAD_CSL_REQUEST_TIME_AHEAD` + + * Fixed deprecated/preferred IPv6 address state transitions. + * Fixed handling of deprecated IPv6 addresses. + * Other various minor fixes in Zephyr's OpenThread port. * Shell: + * Added support for enabling/disabling individual network shell commands with + Kconfig. + * Added new ``net dhcpv4/6 client`` commands for DHCPv4/6 client management. + * Added new ``net virtual`` commands for virtual interface management. + * ``net ipv4/6`` commands are now available even if native IP stack is disabled. + * Added new ``net cm`` commands exposing Connection Manager functionality. + * Fixed possible assertion if telnet shell backend connection is terminated. + * Event monitor thread stack size is now configurable with Kconfig. + * Relocated ``bridge`` command under ``net`` command, i. e. ``net bridge``. + * Multiple minor improvements in various command outputs. + * Sockets: -* Syslog: + * Added dedicated ``net_socket_service_handler_t`` callback function type for + socket services. + * Added TLS 1.3 support for TLS sockets. + * Fixed socket leak when closing NSOS socket. + * Moved socket service library out of experimental. + * Deprecated ``CONFIG_NET_SOCKETS_POLL_MAX``. + * Moved ``zsock_poll()`` and ``zsock_select`` implementations into ``zvfs`` + library. + * Removed ``work_q`` parameter from socket service macros as it was no longer + used. + * Separated native INET sockets implementation from socket syscalls so that + it doesn't have to be built when offloaded sockets are used. + * Fixed possible infinite block inside TLS socket :c:func:`zsock_connect` when + peer goes down silently. + * Fixed ``msg_controllen`` not being set correctly in :c:func:`zsock_recvmsg`. + * Fixed possible busy-looping when polling TLS socket for POLLOUT event. * TCP: + * Fixed propagating connection errors to the socket layer. + * Improved ACK reply logic when peer does not send PSH flag with data. + * Websocket: + * Added support for Websocket console in the Echo Server sample. + * Fixed undefined reference to ``MSG_DONTWAIT`` while building websockets + without POSIX. + * Wi-Fi: * zperf: + * Added support for USB CDC NCM in the zperf sample. + * Fixed DHCPv4 client not being started in the zperf sample in certain + configurations. + USB *** From 50ab6953c23619c12884313632482442949d00b3 Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Fri, 8 Nov 2024 16:24:49 +0100 Subject: [PATCH 2242/4482] linker: llext: avoid modifying current address in linker script snippet The linker script snippet that places the llext_no_syscall_impl section has the unfortunate side effect of overwriting the current linker address. This can lead to unexpected behavior of the caller script. Saving the current address before defining the section and restoring it afterwards avoids this issue. Fixes #81136. Signed-off-by: Luca Burelli --- include/zephyr/linker/llext-sections.ld | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/zephyr/linker/llext-sections.ld b/include/zephyr/linker/llext-sections.ld index 3dcfc3e8f0cd8..f6344a531298b 100644 --- a/include/zephyr/linker/llext-sections.ld +++ b/include/zephyr/linker/llext-sections.ld @@ -1,12 +1,16 @@ /* SPDX-License-Identifier: Apache-2.0 */ /* - * Map the no_syscall_impl symbol in llext_export_syscalls.c to + * Save the current address to avoid changing it in this file. + */ + HIDDEN(__llext_current_addr = .); + + /* + * Map the 'no_syscall_impl' symbol in 'syscall_export_llext.c' to * absolute address 0 so other weak symbols are exported as NULL. * This section is used for mapping that symbol only and is not * to be included in the final binary. */ - SECTION_PROLOGUE(llext_no_syscall_impl, 0 (COPY), ) { *(llext_no_syscall_impl) @@ -29,3 +33,5 @@ KEEP(*(llext_exports_strtab)) } #endif + + . = __llext_current_addr; From 32b1140066d13b9bd61ba95853e83ac83e5ff054 Mon Sep 17 00:00:00 2001 From: Zak Portnoy Date: Tue, 5 Nov 2024 12:21:26 +0200 Subject: [PATCH 2243/4482] mgmt: smp: shell: Respond on uart shell device when changed at runtime Responses are currently set to the shell device that was configured in the device tree. The shell_uart driver allows for changing it's device during runtime which leads to a situation where we recieve packets on one device and respond on another. This patch causes smp_shell_tx_raw to use the shell_uart device Signed-off-by: Zak Portnoy --- subsys/mgmt/mcumgr/transport/src/smp_shell.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/subsys/mgmt/mcumgr/transport/src/smp_shell.c b/subsys/mgmt/mcumgr/transport/src/smp_shell.c index 0a8d483d60fd6..ea5a27961293b 100644 --- a/subsys/mgmt/mcumgr/transport/src/smp_shell.c +++ b/subsys/mgmt/mcumgr/transport/src/smp_shell.c @@ -39,6 +39,8 @@ static struct smp_transport smp_shell_transport; static struct mcumgr_serial_rx_ctxt smp_shell_rx_ctxt; +static const struct shell_uart_common *shell_uart; + #ifdef CONFIG_SMP_CLIENT static struct smp_client_transport_entry smp_client_transport; #endif @@ -210,11 +212,10 @@ static uint16_t smp_shell_get_mtu(const struct net_buf *nb) static int smp_shell_tx_raw(const void *data, int len) { - static const struct device *const sh_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_shell_uart)); const uint8_t *out = data; while ((out != NULL) && (len != 0)) { - uart_poll_out(sh_dev, *out); + uart_poll_out(shell_uart->dev, *out); ++out; --len; } @@ -226,6 +227,7 @@ static int smp_shell_tx_pkt(struct net_buf *nb) { int rc; + shell_uart = (struct shell_uart_common *)shell_backend_uart_get_ptr()->iface->ctx; rc = mcumgr_serial_tx_pkt(nb->data, nb->len, smp_shell_tx_raw); smp_packet_free(nb); From a77d499e2dae37d7b549f5c1954db1582763fd12 Mon Sep 17 00:00:00 2001 From: Simon Moser Date: Wed, 30 Oct 2024 09:57:32 +0100 Subject: [PATCH 2244/4482] doc: fix body length in SMP UART transport In the description of the partial-final frame of the SMP UART transport specification was a typo in the maximum allowed raw body size. The size must not be larger than MTU - 5 because there are 5 bytes occupied by total length (2), frame termination (1) and crc (2). Signed-off-by: Simon Moser --- doc/services/device_mgmt/smp_transport.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/services/device_mgmt/smp_transport.rst b/doc/services/device_mgmt/smp_transport.rst index d01300475769b..644ef7c484ee0 100644 --- a/doc/services/device_mgmt/smp_transport.rst +++ b/doc/services/device_mgmt/smp_transport.rst @@ -179,7 +179,7 @@ taking form: | Content | Size | Description | +===============+===============+===========================+ | body | no more than | Raw body data fragment | - | | MTU - 3 | | + | | MTU - 5 | | +---------------+---------------+---------------------------+ | crc16 | 2 bytes | CRC16 of entire packet | | | | body, preceding length | From fddc009f581182f2c3361a1dddbb0791efc383d9 Mon Sep 17 00:00:00 2001 From: Raymond Lei Date: Wed, 6 Nov 2024 16:20:59 -0600 Subject: [PATCH 2245/4482] drivers: dma: edma: Pending length calculation incorrect Pending length should be mainloop count multiply NBYTES of minor loops. Signed-off-by: Raymond Lei --- drivers/dma/dma_mcux_edma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/dma/dma_mcux_edma.c b/drivers/dma/dma_mcux_edma.c index e4115d10b1e41..257d1dfb319a6 100644 --- a/drivers/dma/dma_mcux_edma.c +++ b/drivers/dma/dma_mcux_edma.c @@ -544,8 +544,10 @@ static int dma_mcux_edma_get_status(const struct device *dev, uint32_t channel, if (DEV_CHANNEL_DATA(dev, channel)->busy) { status->busy = true; + /* Be aware that here we need multiply NBYTES for each minor loops */ status->pending_length = - EDMA_GetRemainingMajorLoopCount(DEV_BASE(dev), hw_channel); + EDMA_GetRemainingMajorLoopCount(DEV_BASE(dev), hw_channel) * + DEV_CHANNEL_DATA(dev, channel)->transfer_settings.source_data_size; } else { status->busy = false; status->pending_length = 0; From dfb1652deccd7689abff98bce69212b7c3f9f3b6 Mon Sep 17 00:00:00 2001 From: Raymond Lei Date: Wed, 6 Nov 2024 16:21:14 -0600 Subject: [PATCH 2246/4482] drivers: dma: edma: eDMA loop SG mode support Existing dynamic SG mode have some issues which cause uart sync api and I2S speed test failed. These issues are: a wrong "Done" bit issue found on UART async api test. An invalid destination address issue found on I2S speed test. By introducing loop SG mode, these issues are all fixed. Some data structures are different between eDMA and eDMA V4, use different macros defined in SDK driver for each of them. Signed-off-by: Raymond Lei --- drivers/dma/dma_mcux_edma.c | 298 ++++++++++++++++++++++++++++++------ 1 file changed, 252 insertions(+), 46 deletions(-) diff --git a/drivers/dma/dma_mcux_edma.c b/drivers/dma/dma_mcux_edma.c index 257d1dfb319a6..eede99c1eb36e 100644 --- a/drivers/dma/dma_mcux_edma.c +++ b/drivers/dma/dma_mcux_edma.c @@ -92,6 +92,14 @@ struct dma_mcux_channel_transfer_edma_settings { enum dma_channel_direction direction; edma_transfer_type_t transfer_type; bool valid; + /* This var indicate it is dynamic SG mode or loop SG mode. */ + bool cyclic; + /* These parameters are for cyclic mode only. + * Next empty TCD idx which can be used for transfer + */ + volatile int8_t write_idx; + /* How many TCDs in TCD pool is emtpy(can be used to write transfer parameters) */ + volatile uint8_t empty_tcds; }; @@ -130,6 +138,35 @@ struct dma_mcux_edma_data { (ch % DEV_CFG(dev)->channels_per_mux) ^ (DEV_CFG(dev)->dmamux_reg_offset) #endif +/* Definations for SW TCD fields */ +#if defined(CONFIG_DMA_MCUX_EDMA) || defined(CONFIG_DMA_MCUX_EDMA_V3) +#define EDMA_TCD_SADDR(tcd, flag) ((tcd)->SADDR) +#define EDMA_TCD_DADDR(tcd, flag) ((tcd)->DADDR) +#define EDMA_TCD_BITER(tcd, flag) ((tcd)->BITER) +#define EDMA_TCD_CITER(tcd, flag) ((tcd)->CITER) +#define EDMA_TCD_CSR(tcd, flag) ((tcd)->CSR) +#define EDMA_TCD_DLAST_SGA(tcd, flag) ((tcd)->DLAST_SGA) +#define EDMA_HW_TCD_CH_ACTIVE_MASK (DMA_CSR_ACTIVE_MASK) +#elif defined(CONFIG_DMA_MCUX_EDMA_V4) +/* Above macros have been defined in fsl_edma_core.h */ +#define EDMA_HW_TCD_CH_ACTIVE_MASK (DMA_CH_CSR_ACTIVE_MASK) +#endif + +/* Definations for HW TCD fields */ +#ifdef CONFIG_DMA_MCUX_EDMA +#define EDMA_HW_TCD_SADDR(dev, ch) (DEV_BASE(dev)->TCD[ch].SADDR) +#define EDMA_HW_TCD_DADDR(dev, ch) (DEV_BASE(dev)->TCD[ch].DADDR) +#define EDMA_HW_TCD_BITER(dev, ch) (DEV_BASE(dev)->TCD[ch].BITER_ELINKNO) +#define EDMA_HW_TCD_CITER(dev, ch) (DEV_BASE(dev)->TCD[ch].CITER_ELINKNO) +#define EDMA_HW_TCD_CSR(dev, ch) (DEV_BASE(dev)->TCD[ch].CSR) +#elif defined(CONFIG_DMA_MCUX_EDMA_V3) || defined(CONFIG_DMA_MCUX_EDMA_V4) +#define EDMA_HW_TCD_SADDR(dev, ch) (DEV_BASE(dev)->CH[ch].TCD_SADDR) +#define EDMA_HW_TCD_DADDR(dev, ch) (DEV_BASE(dev)->CH[ch].TCD_DADDR) +#define EDMA_HW_TCD_BITER(dev, ch) (DEV_BASE(dev)->CH[ch].TCD_BITER_ELINKNO) +#define EDMA_HW_TCD_CITER(dev, ch) (DEV_BASE(dev)->CH[ch].TCD_CITER_ELINKNO) +#define EDMA_HW_TCD_CSR(dev, ch) (DEV_BASE(dev)->CH[ch].TCD_CSR) +#endif + /* * The hardware channel (takes the gap into account) is used when access DMA registers. * For data structures in the shim driver still use the primitive channel. @@ -178,10 +215,14 @@ static void nxp_edma_callback(edma_handle_t *handle, void *param, bool transferD { int ret = -EIO; struct call_back *data = (struct call_back *)param; - uint32_t channel = dma_mcux_edma_remove_channel_gap(data->dev, handle->channel); - if (transferDone) { + if (data->transfer_settings.cyclic) { + data->transfer_settings.empty_tcds++; + /*In loop mode, DMA is always busy*/ + data->busy = 1; + ret = DMA_STATUS_COMPLETE; + } else if (transferDone) { /* DMA is no longer busy when there are no remaining TCDs to transfer */ data->busy = (handle->tcdPool != NULL) && (handle->tcdUsed > 0); ret = DMA_STATUS_COMPLETE; @@ -254,6 +295,7 @@ static int dma_mcux_edma_configure(const struct device *dev, uint32_t channel, edma_transfer_type_t transfer_type; unsigned int key; int ret = 0; + edma_tcd_t *tcd = NULL; if (slot >= DEV_CFG(dev)->dma_requests) { LOG_ERR("source number is out of scope %d", slot); @@ -316,7 +358,7 @@ static int dma_mcux_edma_configure(const struct device *dev, uint32_t channel, data->transfer_settings.direction = config->channel_direction; data->transfer_settings.transfer_type = transfer_type; data->transfer_settings.valid = true; - + data->transfer_settings.cyclic = config->cyclic; /* Lock and page in the channel configuration */ key = irq_lock(); @@ -357,26 +399,93 @@ static int dma_mcux_edma_configure(const struct device *dev, uint32_t channel, LOG_DBG("channel is %d", channel); EDMA_EnableChannelInterrupts(DEV_BASE(dev), hw_channel, kEDMA_ErrorInterruptEnable); + /* Initialize all TCD pool as 0*/ + for (int i = 0; i < CONFIG_DMA_TCD_QUEUE_SIZE; i++) { + memset(&DEV_CFG(dev)->tcdpool[channel][i], 0, + sizeof(DEV_CFG(dev)->tcdpool[channel][i])); + } + if (block_config->source_gather_en || block_config->dest_scatter_en) { - EDMA_InstallTCDMemory(p_handle, DEV_CFG(dev)->tcdpool[channel], - CONFIG_DMA_TCD_QUEUE_SIZE); - while (block_config != NULL) { + if (config->cyclic) { + /* Loop SG mode */ + data->transfer_settings.write_idx = 0; + data->transfer_settings.empty_tcds = CONFIG_DMA_TCD_QUEUE_SIZE; + EDMA_PrepareTransfer( - &(data->transferConfig), - (void *)block_config->source_address, - config->source_data_size, - (void *)block_config->dest_address, - config->dest_data_size, - config->source_burst_length, + &data->transferConfig, (void *)block_config->source_address, + config->source_data_size, (void *)block_config->dest_address, + config->dest_data_size, config->source_burst_length, block_config->block_size, transfer_type); - const status_t submit_status = - EDMA_SubmitTransfer(p_handle, &(data->transferConfig)); - if (submit_status != kStatus_Success) { - LOG_ERR("Error submitting EDMA Transfer: 0x%x", submit_status); - ret = -EFAULT; + /* Init all TCDs with the para in transfer config and link them. */ + for (int i = 0; i < CONFIG_DMA_TCD_QUEUE_SIZE; i++) { + EDMA_TcdSetTransferConfig( + &DEV_CFG(dev)->tcdpool[channel][i], &data->transferConfig, + &DEV_CFG(dev)->tcdpool[channel][(i + 1) % + CONFIG_DMA_TCD_QUEUE_SIZE]); + + /* Enable Major loop interrupt.*/ + EDMA_TcdEnableInterrupts(&DEV_CFG(dev)->tcdpool[channel][i], + kEDMA_MajorInterruptEnable); + } + + /* Load valid transfer parameters */ + while (block_config != NULL && data->transfer_settings.empty_tcds > 0) { + tcd = &(DEV_CFG(dev)->tcdpool[channel] + [data->transfer_settings.write_idx]); + + EDMA_TCD_SADDR(tcd, kEDMA_EDMA4Flag) = block_config->source_address; + EDMA_TCD_DADDR(tcd, kEDMA_EDMA4Flag) = block_config->dest_address; + EDMA_TCD_BITER(tcd, kEDMA_EDMA4Flag) = + block_config->block_size / config->source_data_size; + EDMA_TCD_CITER(tcd, kEDMA_EDMA4Flag) = + block_config->block_size / config->source_data_size; + /*Enable auto stop for last transfer.*/ + if (block_config->next_block == NULL) { + EDMA_TCD_CSR(tcd, kEDMA_EDMA4Flag) |= DMA_CSR_DREQ(1U); + } else { + EDMA_TCD_CSR(tcd, kEDMA_EDMA4Flag) &= ~DMA_CSR_DREQ(1U); + } + + data->transfer_settings.write_idx = + (data->transfer_settings.write_idx + 1) % + CONFIG_DMA_TCD_QUEUE_SIZE; + data->transfer_settings.empty_tcds--; + block_config = block_config->next_block; + } + + if (block_config != NULL && data->transfer_settings.empty_tcds == 0) { + /* User input more blocks than TCD number, return error */ + LOG_ERR("Too much request blocks,increase TCD buffer size!"); + ret = -ENOBUFS; + } + /* Push the 1st TCD into HW */ + EDMA_InstallTCD(p_handle->base, hw_channel, + &DEV_CFG(dev)->tcdpool[channel][0]); + + } else { + /* Dynamic Scatter Gather mode */ + EDMA_InstallTCDMemory(p_handle, DEV_CFG(dev)->tcdpool[channel], + CONFIG_DMA_TCD_QUEUE_SIZE); + + while (block_config != NULL) { + EDMA_PrepareTransfer(&(data->transferConfig), + (void *)block_config->source_address, + config->source_data_size, + (void *)block_config->dest_address, + config->dest_data_size, + config->source_burst_length, + block_config->block_size, transfer_type); + + const status_t submit_status = + EDMA_SubmitTransfer(p_handle, &(data->transferConfig)); + if (submit_status != kStatus_Success) { + LOG_ERR("Error submitting EDMA Transfer: 0x%x", + submit_status); + ret = -EFAULT; + } + block_config = block_config->next_block; } - block_config = block_config->next_block; } } else { /* block_count shall be 1 */ @@ -395,11 +504,8 @@ static int dma_mcux_edma_configure(const struct device *dev, uint32_t channel, LOG_ERR("Error submitting EDMA Transfer: 0x%x", submit_status); ret = -EFAULT; } -#if defined(CONFIG_DMA_MCUX_EDMA_V3) || defined(CONFIG_DMA_MCUX_EDMA_V4) - LOG_DBG("DMA TCD_CSR 0x%x", DEV_BASE(dev)->CH[hw_channel].TCD_CSR); -#else - LOG_DBG("data csr is 0x%x", DEV_BASE(dev)->TCD[hw_channel].CSR); -#endif + + LOG_DBG("DMA TCD CSR 0x%x", EDMA_HW_TCD_CSR(dev, hw_channel)); } if (config->dest_chaining_en) { @@ -491,11 +597,23 @@ static int dma_mcux_edma_resume(const struct device *dev, uint32_t channel) return 0; } +static void dma_mcux_edma_update_hw_tcd(const struct device *dev, uint32_t channel, uint32_t src, + uint32_t dst, size_t size) +{ + EDMA_HW_TCD_SADDR(dev, channel) = src; + EDMA_HW_TCD_DADDR(dev, channel) = dst; + EDMA_HW_TCD_BITER(dev, channel) = size; + EDMA_HW_TCD_CITER(dev, channel) = size; + EDMA_HW_TCD_CSR(dev, channel) |= DMA_CSR_DREQ(1U); +} static int dma_mcux_edma_reload(const struct device *dev, uint32_t channel, uint32_t src, uint32_t dst, size_t size) { struct call_back *data = DEV_CHANNEL_DATA(dev, channel); + edma_tcd_t *tcd = NULL; + edma_tcd_t *pre_tcd = NULL; + uint32_t hw_id, sw_id; /* Lock the channel configuration */ const unsigned int key = irq_lock(); @@ -507,29 +625,115 @@ static int dma_mcux_edma_reload(const struct device *dev, uint32_t channel, goto cleanup; } - /* If the tcdPool is not in use (no s/g) then only a single TCD can be active at once. */ - if (data->busy && data->edma_handle.tcdPool == NULL) { - LOG_ERR("EDMA busy. Wait until the transfer completes before reloading."); - ret = -EBUSY; - goto cleanup; - } + if (data->transfer_settings.cyclic) { + if (data->transfer_settings.empty_tcds == 0) { + LOG_ERR("TCD list is full in loop mode."); + ret = -ENOBUFS; + goto cleanup; + } - EDMA_PrepareTransfer( - &(data->transferConfig), - (void *)src, - data->transfer_settings.source_data_size, - (void *)dst, - data->transfer_settings.dest_data_size, - data->transfer_settings.source_burst_length, - size, - data->transfer_settings.transfer_type); - - const status_t submit_status = - EDMA_SubmitTransfer(DEV_EDMA_HANDLE(dev, channel), &(data->transferConfig)); - - if (submit_status != kStatus_Success) { - LOG_ERR("Error submitting EDMA Transfer: 0x%x", submit_status); - ret = -EFAULT; + /* Convert size into major loop count */ + size = size / data->transfer_settings.dest_data_size; + + /* Configure a TCD for the transfer */ + tcd = &(DEV_CFG(dev)->tcdpool[channel][data->transfer_settings.write_idx]); + pre_tcd = &(DEV_CFG(dev)->tcdpool[channel][(data->transfer_settings.write_idx - 1) % + CONFIG_DMA_TCD_QUEUE_SIZE]); + + EDMA_TCD_SADDR(tcd, kEDMA_EDMA4Flag) = src; + EDMA_TCD_DADDR(tcd, kEDMA_EDMA4Flag) = dst; + EDMA_TCD_BITER(tcd, kEDMA_EDMA4Flag) = size; + EDMA_TCD_CITER(tcd, kEDMA_EDMA4Flag) = size; + /* Enable automatically stop */ + EDMA_TCD_CSR(tcd, kEDMA_EDMA4Flag) |= DMA_CSR_DREQ(1U); + sw_id = EDMA_TCD_DLAST_SGA(tcd, kEDMA_EDMA4Flag); + + /* Block the peripheral's hardware request trigger to prevent + * starting the DMA before updating the TCDs. Make sure the + * code between EDMA_DisableChannelRequest() and + * EDMA_EnableChannelRequest() is minimum. + */ + EDMA_DisableChannelRequest(DEV_BASE(dev), channel); + + /* Wait for the DMA to be inactive before updating the TCDs. + * The CSR[ACTIVE] bit will deassert quickly after the EDMA's + * minor loop burst completes. + */ + while (EDMA_HW_TCD_CSR(dev, channel) & EDMA_HW_TCD_CH_ACTIVE_MASK) { + ; + } + + /* Identify the current active TCD. Use DLAST_SGA as the HW ID */ + hw_id = EDMA_GetNextTCDAddress(DEV_EDMA_HANDLE(dev, channel)); + if (data->transfer_settings.empty_tcds >= CONFIG_DMA_TCD_QUEUE_SIZE || + hw_id == sw_id) { + /* All transfers have been done.DMA is stopped automatically, + * invalid TCD has been loaded into the HW, update HW. + */ + dma_mcux_edma_update_hw_tcd(dev, channel, src, dst, size); + LOG_DBG("Transfer done,auto stop"); + + } else { + /* Previous TCD can automatically start this TCD. + * Enable the peripheral DMA request in the previous TCD + */ + EDMA_TCD_CSR(pre_tcd, kEDMA_EDMA4Flag) &= ~DMA_CSR_DREQ(1U); + + if (data->transfer_settings.empty_tcds == CONFIG_DMA_TCD_QUEUE_SIZE - 1 || + hw_id == (uint32_t)tcd) { + /* DMA is running on last transfer. HW has loaded the last one, + * we need ensure it's DREQ is cleared. + */ + EDMA_EnableAutoStopRequest(DEV_BASE(dev), channel, false); + LOG_DBG("Last transfer."); + } + LOG_DBG("Manu stop"); + } + +#ifdef CONFIG_DMA_MCUX_EDMA + /* It seems that there is HW issue which may cause ESG bit is cleared. + * This is a workaround. Clear the DONE bit before setting ESG bit. + */ + EDMA_ClearChannelStatusFlags(DEV_BASE(dev), channel, kEDMA_DoneFlag); + EDMA_HW_TCD_CSR(dev, channel) |= DMA_CSR_ESG_MASK; +#elif (CONFIG_DMA_MCUX_EDMA_V3 || CONFIG_DMA_MCUX_EDMA_V4) + /*We have not verified if this issue exist on V3/V4 HW, jut place a holder here. */ +#endif + /* TCDs are configured. Resume DMA */ + EDMA_EnableChannelRequest(DEV_BASE(dev), channel); + + /* Update the write index and available TCD numbers. */ + data->transfer_settings.write_idx = + (data->transfer_settings.write_idx + 1) % CONFIG_DMA_TCD_QUEUE_SIZE; + data->transfer_settings.empty_tcds--; + + LOG_DBG("w_idx:%d no:%d(ch:%d)", data->transfer_settings.write_idx, + data->transfer_settings.empty_tcds, channel); + + } else { + /* Dynamice Scatter/Gather mode: + * If the tcdPool is not in use (no s/g) then only a single TCD + * can be active at once. + */ + if (data->busy && data->edma_handle.tcdPool == NULL) { + LOG_ERR("EDMA busy. Wait until the transfer completes before reloading."); + ret = -EBUSY; + goto cleanup; + } + + EDMA_PrepareTransfer(&(data->transferConfig), (void *)src, + data->transfer_settings.source_data_size, (void *)dst, + data->transfer_settings.dest_data_size, + data->transfer_settings.source_burst_length, size, + data->transfer_settings.transfer_type); + + const status_t submit_status = + EDMA_SubmitTransfer(DEV_EDMA_HANDLE(dev, channel), &(data->transferConfig)); + + if (submit_status != kStatus_Success) { + LOG_ERR("Error submitting EDMA Transfer: 0x%x", submit_status); + ret = -EFAULT; + } } cleanup: @@ -544,7 +748,9 @@ static int dma_mcux_edma_get_status(const struct device *dev, uint32_t channel, if (DEV_CHANNEL_DATA(dev, channel)->busy) { status->busy = true; - /* Be aware that here we need multiply NBYTES for each minor loops */ + /* pending_length is in bytes. Multiply remaining major loop + * count by NBYTES for each minor loop + */ status->pending_length = EDMA_GetRemainingMajorLoopCount(DEV_BASE(dev), hw_channel) * DEV_CHANNEL_DATA(dev, channel)->transfer_settings.source_data_size; From 7145295a4acd3978f429b489efc819347420afc5 Mon Sep 17 00:00:00 2001 From: Raymond Lei Date: Wed, 6 Nov 2024 16:21:17 -0600 Subject: [PATCH 2247/4482] Drivers: driver: i2s: Use eDMA loop SG mode I2S speed test failed because of "Invalid destination address" issue By use eDMA loop SG mode, this issue is fixed. Fixes: #70777 Signed-off-by: Raymond Lei --- drivers/i2s/i2s_mcux_sai.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/i2s/i2s_mcux_sai.c b/drivers/i2s/i2s_mcux_sai.c index 5ec1ff739c16f..27439d6f46b09 100644 --- a/drivers/i2s/i2s_mcux_sai.c +++ b/drivers/i2s/i2s_mcux_sai.c @@ -1,5 +1,5 @@ /* - * Copyright 2021,2023 NXP Semiconductor INC. + * Copyright 2021,2023-2024 NXP Semiconductor INC. * All rights reserved. * * SPDX-License-Identifier: Apache-2.0 @@ -299,7 +299,6 @@ static void i2s_dma_tx_callback(const struct device *dma_dev, void *arg, uint32_ strm->state = I2S_STATE_ERROR; goto disabled_exit_no_drop; } - dma_start(dev_data->dev_dma, strm->dma_channel); if (blocks_queued || (strm->free_tx_dma_blocks < MAX_TX_DMA_BLOCKS)) { goto enabled_exit; @@ -389,7 +388,6 @@ static void i2s_dma_rx_callback(const struct device *dma_dev, void *arg, uint32_ ret); } - dma_start(dev_data->dev_dma, strm->dma_channel); } } else { i2s_rx_stream_disable(dev, true, false); @@ -1213,6 +1211,7 @@ static const struct i2s_driver_api i2s_mcux_driver_api = { .channel_direction = MEMORY_TO_PERIPHERAL, \ .dma_slot = DT_INST_DMAS_CELL_BY_NAME(i2s_id, tx, \ source), \ + .cyclic = 1, \ }, \ }, \ .rx = \ @@ -1230,6 +1229,7 @@ static const struct i2s_driver_api i2s_mcux_driver_api = { .channel_direction = PERIPHERAL_TO_MEMORY, \ .dma_slot = DT_INST_DMAS_CELL_BY_NAME(i2s_id, rx, \ source), \ + .cyclic = 1, \ }, \ }, \ }; \ From 209cb8157ab9e3187167a77484fad64f0d655cf4 Mon Sep 17 00:00:00 2001 From: Raymond Lei Date: Wed, 6 Nov 2024 16:21:21 -0600 Subject: [PATCH 2248/4482] drivers: serial: lpuart: Enable SG mode of LPUART New implemented eDMA loop SG mode can be used to lpuart driver to fix the conflict of "Done" bit issue which cause uart_async_api test failed when SG mode is enabled. Also, this loop SG mode works well even with a high bandrate(test done on 2000000bps). Fixes: #78291 Signed-off-by: Raymond Lei --- drivers/serial/uart_mcux_lpuart.c | 38 ++++++++++++------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/drivers/serial/uart_mcux_lpuart.c b/drivers/serial/uart_mcux_lpuart.c index 5697a904d7f19..67fc33fef3164 100644 --- a/drivers/serial/uart_mcux_lpuart.c +++ b/drivers/serial/uart_mcux_lpuart.c @@ -585,7 +585,7 @@ static void prepare_rx_dma_block_config(const struct device *dev) head_block_config->dest_address = (uint32_t)rx_dma_params->buf; head_block_config->source_address = LPUART_GetDataRegisterAddress(lpuart); head_block_config->block_size = rx_dma_params->buf_len; - head_block_config->dest_scatter_en = false; + head_block_config->dest_scatter_en = true; } static int configure_and_start_rx_dma( @@ -616,37 +616,20 @@ static int uart_mcux_lpuart_dma_replace_rx_buffer(const struct device *dev) struct mcux_lpuart_data *data = (struct mcux_lpuart_data *)dev->data; const struct mcux_lpuart_config *config = dev->config; LPUART_Type *lpuart = config->base; - struct mcux_lpuart_rx_dma_params *rx_dma_params = &data->async.rx_dma_params; LOG_DBG("Replacing RX buffer, new length: %d", data->async.next_rx_buffer_len); - /* There must be a buffer to replace this one with */ assert(data->async.next_rx_buffer != NULL); assert(data->async.next_rx_buffer_len != 0U); - rx_dma_params->buf = data->async.next_rx_buffer; - rx_dma_params->buf_len = data->async.next_rx_buffer_len; - rx_dma_params->offset = 0; - rx_dma_params->counter = 0; - data->async.next_rx_buffer = NULL; - data->async.next_rx_buffer_len = 0U; const int success = dma_reload(config->rx_dma_config.dma_dev, config->rx_dma_config.dma_channel, - LPUART_GetDataRegisterAddress(lpuart), (uint32_t)rx_dma_params->buf, - rx_dma_params->buf_len); + LPUART_GetDataRegisterAddress(lpuart), + (uint32_t)data->async.next_rx_buffer, data->async.next_rx_buffer_len); if (success != 0) { LOG_ERR("Error %d reloading DMA with next RX buffer", success); } - /* Request next buffer */ - async_evt_rx_buf_request(dev); - - int ret = dma_start(config->rx_dma_config.dma_dev, config->rx_dma_config.dma_channel); - - if (ret < 0) { - LOG_ERR("Failed to start DMA(Rx) Ch %d(%d)", config->rx_dma_config.dma_channel, - ret); - } return success; } @@ -692,9 +675,16 @@ static void dma_callback(const struct device *dma_dev, void *callback_arg, uint3 async_evt_rx_rdy(dev); async_evt_rx_buf_release(dev); - if (data->async.next_rx_buffer != NULL && data->async.next_rx_buffer_len > 0) { + /* Remember the buf so it can be released after it is done. */ + rx_dma_params->buf = data->async.next_rx_buffer; + rx_dma_params->buf_len = data->async.next_rx_buffer_len; + data->async.next_rx_buffer = NULL; + data->async.next_rx_buffer_len = 0U; + + /* A new buffer was available (and already loaded into the DMA engine) */ + if (rx_dma_params->buf != NULL && rx_dma_params->buf_len > 0) { /* Request the next buffer */ - uart_mcux_lpuart_dma_replace_rx_buffer(dev); + async_evt_rx_buf_request(dev); } else { /* Buffer full without valid next buffer, disable RX DMA */ LOG_INF("Disabled RX DMA, no valid next buffer "); @@ -873,6 +863,7 @@ static int mcux_lpuart_rx_buf_rsp(const struct device *dev, uint8_t *buf, size_t assert(data->async.next_rx_buffer_len == 0); data->async.next_rx_buffer = buf; data->async.next_rx_buffer_len = len; + uart_mcux_lpuart_dma_replace_rx_buffer(dev); irq_unlock(key); return 0; } @@ -1347,7 +1338,8 @@ static const struct uart_driver_api mcux_lpuart_driver_api = { .dma_slot = DT_INST_DMAS_CELL_BY_NAME( \ id, rx, source), \ .dma_callback = dma_callback, \ - .user_data = (void *)DEVICE_DT_INST_GET(id) \ + .user_data = (void *)DEVICE_DT_INST_GET(id), \ + .cyclic = 1, \ }, \ }, #else From a6466249a9c17eecffff35e65dc73ce7fbd115f9 Mon Sep 17 00:00:00 2001 From: Raymond Lei Date: Mon, 4 Nov 2024 14:54:57 -0600 Subject: [PATCH 2249/4482] drivers: dma: edma: Put the TCD pool in DTCM by default To reduce the latency of CPU accessing/modifying SW TCD content, it better to put TCD pool to DTCM by default. Signed-off-by: Raymond Lei --- drivers/dma/Kconfig.mcux_edma | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/dma/Kconfig.mcux_edma b/drivers/dma/Kconfig.mcux_edma index 9b3d0c9e0fbcb..4a618aa9f7ac7 100644 --- a/drivers/dma/Kconfig.mcux_edma +++ b/drivers/dma/Kconfig.mcux_edma @@ -44,6 +44,8 @@ config DMA_MCUX_TEST_SLOT_START config DMA_MCUX_USE_DTCM_FOR_DMA_DESCRIPTORS bool "Use DTCM for DMA descriptors" + default y + depends on DT_HAS_NXP_IMX_DTCM_ENABLED help When this option is activated, the descriptors for DMA transfer are located in the DTCM (Data Tightly Coupled Memory). From 9c94ee53466c89ac1aa70db84c758ab0ac63b9c2 Mon Sep 17 00:00:00 2001 From: Franciszek Pindel Date: Mon, 28 Oct 2024 16:10:17 +0100 Subject: [PATCH 2250/4482] include/zephyr: Use ROMABLE_REGION for LMA in .last_ram_section Currently RAMABLE_REGION is used for both virtual address (VMA) and a load address (LMA). It results in wrong LMA for some platforms. This commits adds using ROMABLE_REGION for LMA. Signed-off-by: Franciszek Pindel --- include/zephyr/linker/ram-end.ld | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/linker/ram-end.ld b/include/zephyr/linker/ram-end.ld index ad4da2b46f321..71d4571e0fb0a 100644 --- a/include/zephyr/linker/ram-end.ld +++ b/include/zephyr/linker/ram-end.ld @@ -12,4 +12,4 @@ _image_ram_size = _image_ram_end - _image_ram_start; _end = .; /* end of image */ z_mapped_end = .; - } GROUP_NOLOAD_LINK_IN(RAMABLE_REGION, RAMABLE_REGION) + } GROUP_NOLOAD_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) From a2e920cf968979ab634d9232ad39d36aefb96905 Mon Sep 17 00:00:00 2001 From: Andrew Feldhaus Date: Tue, 10 Sep 2024 10:46:17 +0100 Subject: [PATCH 2251/4482] drivers: rtc: rtc_ds1307: Fix corruption of SECONDS register We read/modify/write the CH/SECONDS register at initialisation to clear only the Clock Halt bit and only if it is set. The previous implementation zeroes the entire register unconditionally at initialisation, which wipes the SECONDS fields. Fixes #77354. Signed-off-by: Andrew Feldhaus --- drivers/rtc/rtc_ds1307.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/rtc/rtc_ds1307.c b/drivers/rtc/rtc_ds1307.c index bfbe0abe2550f..8b90285a3166f 100644 --- a/drivers/rtc/rtc_ds1307.c +++ b/drivers/rtc/rtc_ds1307.c @@ -136,13 +136,23 @@ static int ds1307_init(const struct device *dev) /* Disable squarewave output */ err = i2c_reg_write_byte_dt(&config->i2c_bus, DS1307_REG_CTRL, 0x00); if (err < 0) { - LOG_ERR("Error: SQW:%d\n", err); + LOG_ERR("Error: SQW: %d\n", err); } - /* Make clock halt = 0 */ - err = i2c_reg_write_byte_dt(&config->i2c_bus, DS1307_REG_SECONDS, 0x00); + /* Ensure Clock Halt = 0 */ + uint8_t reg = 0; + + err = i2c_reg_read_byte_dt(&config->i2c_bus, DS1307_REG_SECONDS, ®); if (err < 0) { - LOG_ERR("Error: Set clock halt bit:%d\n", err); + LOG_ERR("Error: Read SECONDS/Clock Halt register: %d\n", err); + } + if (reg & ~SECONDS_BITS) { + /* Clock Halt bit is set */ + err = i2c_reg_write_byte_dt(&config->i2c_bus, DS1307_REG_SECONDS, + reg & SECONDS_BITS); + if (err < 0) { + LOG_ERR("Error: Clear Clock Halt bit: %d\n", err); + } } return 0; From c5fa9af23569fc7fc081c4896e968a22806b0d58 Mon Sep 17 00:00:00 2001 From: Hongquan Li Date: Sun, 3 Nov 2024 14:23:25 +0800 Subject: [PATCH 2252/4482] drivers/wifi/nrfwifi: Add buffer for discard bytes Some spi drivers do not allow the send buffer and receive buffer to be empty at the same time, if this happens it will cause the spi to be unable to communicate with the nrf7002, so add the receive buffer for the discard byte in the spim_xfer_rx. Fix #80686 Signed-off-by: Hongquan Li --- drivers/wifi/nrfwifi/src/qspi/src/spi_if.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/wifi/nrfwifi/src/qspi/src/spi_if.c b/drivers/wifi/nrfwifi/src/qspi/src/spi_if.c index 2cdf3662fd5c8..4bf9f46439104 100644 --- a/drivers/wifi/nrfwifi/src/qspi/src/spi_if.c +++ b/drivers/wifi/nrfwifi/src/qspi/src/spi_if.c @@ -58,6 +58,7 @@ static int spim_xfer_rx(unsigned int addr, void *data, unsigned int len, unsigne addr & 0xFF, 0 /* dummy byte */ }; + uint8_t discard[sizeof(hdr) + 2 * 4]; const struct spi_buf tx_buf[] = { {.buf = hdr, .len = sizeof(hdr) }, @@ -67,12 +68,17 @@ static int spim_xfer_rx(unsigned int addr, void *data, unsigned int len, unsigne const struct spi_buf_set tx = { .buffers = tx_buf, .count = 2 }; const struct spi_buf rx_buf[] = { - {.buf = NULL, .len = sizeof(hdr) + discard_bytes}, + {.buf = discard, .len = sizeof(hdr) + discard_bytes}, {.buf = data, .len = len }, }; const struct spi_buf_set rx = { .buffers = rx_buf, .count = 2 }; + if (rx_buf[0].len > sizeof(discard)) { + LOG_ERR("Discard bytes too large, please adjust buf size"); + return -EINVAL; + } + return spi_transceive_dt(&spi_spec, &tx, &rx); } From 02c8a5a80c5dc8699285723f8ac149804f58a8d8 Mon Sep 17 00:00:00 2001 From: Karun Kumar Eagalapati Date: Wed, 6 Nov 2024 18:49:21 +0530 Subject: [PATCH 2253/4482] manifest: Update hal_nordic Updated manifest to include fix for incorrect display of scan results when APs have EAP and PMF enabled. Fixes #80995 Signed-off-by: Karun Kumar Eagalapati --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 97bfaf602d24c..1d27186b2e9f4 100644 --- a/west.yml +++ b/west.yml @@ -188,7 +188,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 2d78179cc4f0601a891553132b13184fa51b6ef9 + revision: 5c8d109371ebb740fbef1f440a3b59e488a36717 path: modules/hal/nordic groups: - hal From 18818c15cd901fb431dfb3d6847225be9f05172a Mon Sep 17 00:00:00 2001 From: Simon Maurer Date: Tue, 29 Oct 2024 18:44:22 +0100 Subject: [PATCH 2254/4482] openamp: resource table: fixes resource table for ram_console section in commit 1cd37f21f3a the global ram console buffer was replaced with a pointer. This didn't work with the OpenAMP resource table anymore (#75656). Signed-off-by: Simon Maurer --- lib/open-amp/resource_table.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/open-amp/resource_table.c b/lib/open-amp/resource_table.c index a857c3ca05f44..1bc8d5cb6ebc0 100644 --- a/lib/open-amp/resource_table.c +++ b/lib/open-amp/resource_table.c @@ -29,7 +29,7 @@ #include #include -extern char ram_console[]; +extern char ram_console_buf[]; #define __resource Z_GENERIC_SECTION(.resource_table) @@ -68,7 +68,7 @@ static struct fw_resource_table __resource resource_table = { #if defined(CONFIG_RAM_CONSOLE) .cm_trace = { RSC_TRACE, - (uint32_t)ram_console, CONFIG_RAM_CONSOLE_BUFFER_SIZE, 0, + (uint32_t)ram_console_buf, CONFIG_RAM_CONSOLE_BUFFER_SIZE, 0, "Zephyr_log", }, #endif From aeaddd70b7250c1e9d43824f247d78fa4ecb6cbb Mon Sep 17 00:00:00 2001 From: Peter Mitsis Date: Thu, 7 Nov 2024 14:15:04 -0800 Subject: [PATCH 2255/4482] tests: Fix IRQ locking in sched benchmark Corrects an issue that was introduced when the interrupt locking/unlocking was added to the 'sched' benchmark by unlocking the interrupts before the context switch done by k_yield(), but after the call to z_unpend_first_thread(). Fixes PR #81050 Signed-off-by: Peter Mitsis --- tests/benchmarks/sched/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/benchmarks/sched/src/main.c b/tests/benchmarks/sched/src/main.c index 1a590af1eb37b..a372ba3c1a835 100644 --- a/tests/benchmarks/sched/src/main.c +++ b/tests/benchmarks/sched/src/main.c @@ -112,6 +112,7 @@ int main(void) key = arch_irq_lock(); stamp(UNPENDING); z_unpend_first_thread(&waitq); + arch_irq_unlock(key); stamp(UNPENDED_READYING); z_ready_thread(th); stamp(READIED_YIELDING); @@ -124,7 +125,6 @@ int main(void) */ k_yield(); stamp(YIELDED); - arch_irq_unlock(key); uint32_t avg, whole = stamps[4] - stamps[0]; From 431c34039a303549b295954e19bf71d594853f2a Mon Sep 17 00:00:00 2001 From: Dong Wang Date: Wed, 23 Oct 2024 09:30:05 +0800 Subject: [PATCH 2256/4482] tests: debug/coredump: Change to call k_panic() for ISH SoCs ISH SoCs have zero-address memory mapped to I2C0 controller. Coredump cannot be triggered by zero-address access. Signed-off-by: Dong Wang --- tests/subsys/debug/coredump/src/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/subsys/debug/coredump/src/main.c b/tests/subsys/debug/coredump/src/main.c index e1c1aead92ca8..0deda7e032ff6 100644 --- a/tests/subsys/debug/coredump/src/main.c +++ b/tests/subsys/debug/coredump/src/main.c @@ -39,6 +39,7 @@ __no_optimization void func_3(uint32_t *addr) defined(CONFIG_BOARD_LONGAN_NANO) || \ defined(CONFIG_BOARD_QEMU_XTENSA) || \ defined(CONFIG_BOARD_RISCV32_VIRTUAL) || \ + defined(CONFIG_SOC_FAMILY_INTEL_ISH) || \ defined(CONFIG_SOC_FAMILY_INTEL_ADSP) ARG_UNUSED(addr); /* Call k_panic() directly so Renode doesn't pause execution. From b6b8eeedf0a2b2444b9eccd511982e99425142b1 Mon Sep 17 00:00:00 2001 From: Bernardo Perez Priego Date: Fri, 30 Aug 2024 13:02:24 -0700 Subject: [PATCH 2257/4482] serial: mchp_xec: Fix `uart_xec_irq_tx_complete` function This function is only checking for current byte being transmitted. This patch ensures that function returns `1` until TX is disabled and no byte is being transmitted. Signed-off-by: Bernardo Perez Priego --- drivers/serial/uart_mchp_xec.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/serial/uart_mchp_xec.c b/drivers/serial/uart_mchp_xec.c index a41f24dcd7a46..5b37d0aa7c8eb 100644 --- a/drivers/serial/uart_mchp_xec.c +++ b/drivers/serial/uart_mchp_xec.c @@ -747,10 +747,15 @@ static int uart_xec_irq_tx_complete(const struct device *dev) const struct uart_xec_device_config * const dev_cfg = dev->config; struct uart_xec_dev_data *dev_data = dev->data; struct uart_regs *regs = dev_cfg->regs; + int ret; k_spinlock_key_t key = k_spin_lock(&dev_data->lock); - int ret = ((regs->LSR & (LSR_TEMT | LSR_THRE)) - == (LSR_TEMT | LSR_THRE)) ? 1 : 0; + if ((regs->IER & IER_TBE) || + ((regs->LSR & (LSR_TEMT | LSR_THRE)) != (LSR_TEMT | LSR_THRE))) { + ret = 0; + } else { + ret = 1; + } k_spin_unlock(&dev_data->lock, key); From 92d02878139d7489427532e733de701626ae9567 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Fri, 8 Nov 2024 14:50:16 -0600 Subject: [PATCH 2258/4482] drivers: spi_mcux_lpspi: Fix DMA path on RT Apparently, the previous change to fix the chip select only works on some newer revisions of the LPSPI, and the behavior is different on older parts like RT. For now put some #ifdef to keep the fixed CS on MCXN but have the old behavior on RT and other platforms. Signed-off-by: Declan Snyder --- drivers/spi/spi_mcux_lpspi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/spi/spi_mcux_lpspi.c b/drivers/spi/spi_mcux_lpspi.c index 39535e6808ffe..11deabce1d30d 100644 --- a/drivers/spi/spi_mcux_lpspi.c +++ b/drivers/spi/spi_mcux_lpspi.c @@ -483,7 +483,9 @@ static int transceive_dma(const struct device *dev, const struct spi_config *spi return ret; } +#ifdef CONFIG_SOC_SERIES_MCXN base->TCR |= LPSPI_TCR_CONT_MASK; +#endif /* DMA is fast enough watermarks are not required */ LPSPI_SetFifoWatermarks(base, 0U, 0U); @@ -500,9 +502,11 @@ static int transceive_dma(const struct device *dev, const struct spi_config *spi goto out; } +#ifdef CONFIG_SOC_SERIES_MCXN while (!(LPSPI_GetStatusFlags(base) & kLPSPI_TxDataRequestFlag)) { /* wait until previous tx finished */ } +#endif /* Enable DMA Requests */ LPSPI_EnableDMA(base, kLPSPI_TxDmaEnable | kLPSPI_RxDmaEnable); @@ -513,6 +517,12 @@ static int transceive_dma(const struct device *dev, const struct spi_config *spi goto out; } +#ifndef CONFIG_SOC_SERIES_MCXN + while ((LPSPI_GetStatusFlags(base) & kLPSPI_ModuleBusyFlag)) { + /* wait until module is idle */ + } +#endif + /* Disable DMA */ LPSPI_DisableDMA(base, kLPSPI_TxDmaEnable | kLPSPI_RxDmaEnable); From 04d8b7c595039fb9c95377df9f42bd32a0631285 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 22 Oct 2024 16:18:00 +0300 Subject: [PATCH 2259/4482] net: sockets: Cleanup socket properly if POSIX API is enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sock_obj_core_dealloc() was not called if close() is called instead of zsock_close(). This happens if POSIX API is enabled. Fix this by calling zvfs_close() from zsock_close() and then pass the socket number to zsock_close_ctx() so that the cleanup can be done properly. Reported-by: Andreas Ålgård Signed-off-by: Jukka Rissanen --- include/zephyr/sys/fdtable.h | 5 +++- lib/os/fdtable.c | 9 ++++++- subsys/net/lib/sockets/sockets.c | 32 ++++++----------------- subsys/net/lib/sockets/sockets_inet.c | 22 +++++++++++----- subsys/net/lib/sockets/sockets_internal.h | 2 +- subsys/net/lib/sockets/sockets_packet.c | 6 ++--- subsys/net/lib/sockets/sockets_tls.c | 12 ++++++--- 7 files changed, 48 insertions(+), 40 deletions(-) diff --git a/include/zephyr/sys/fdtable.h b/include/zephyr/sys/fdtable.h index dbe134e70f6d3..3d0b71494e0d0 100644 --- a/include/zephyr/sys/fdtable.h +++ b/include/zephyr/sys/fdtable.h @@ -64,7 +64,10 @@ struct fd_op_vtable { ssize_t (*write)(void *obj, const void *buf, size_t sz); ssize_t (*write_offs)(void *obj, const void *buf, size_t sz, size_t offset); }; - int (*close)(void *obj); + union { + int (*close)(void *obj); + int (*close2)(void *obj, int fd); + }; int (*ioctl)(void *obj, unsigned int request, va_list args); }; diff --git a/lib/os/fdtable.c b/lib/os/fdtable.c index 5baa8412e9321..a2514b1c296be 100644 --- a/lib/os/fdtable.c +++ b/lib/os/fdtable.c @@ -389,7 +389,14 @@ int zvfs_close(int fd) (void)k_mutex_lock(&fdtable[fd].lock, K_FOREVER); if (fdtable[fd].vtable->close != NULL) { /* close() is optional - e.g. stdinout_fd_op_vtable */ - res = fdtable[fd].vtable->close(fdtable[fd].obj); + if (fdtable[fd].mode & ZVFS_MODE_IFSOCK) { + /* Network socket needs to know socket number so pass + * it via close2() call. + */ + res = fdtable[fd].vtable->close2(fdtable[fd].obj, fd); + } else { + res = fdtable[fd].vtable->close(fdtable[fd].obj); + } } k_mutex_unlock(&fdtable[fd].lock); diff --git a/subsys/net/lib/sockets/sockets.c b/subsys/net/lib/sockets/sockets.c index 007606ac84f8f..441ed438472b4 100644 --- a/subsys/net/lib/sockets/sockets.c +++ b/subsys/net/lib/sockets/sockets.c @@ -147,42 +147,26 @@ static inline int z_vrfy_zsock_socket(int family, int type, int proto) #include #endif /* CONFIG_USERSPACE */ +extern int zvfs_close(int fd); + int z_impl_zsock_close(int sock) +{ + return zvfs_close(sock); +} + +#ifdef CONFIG_USERSPACE +static inline int z_vrfy_zsock_close(int sock) { const struct socket_op_vtable *vtable; struct k_mutex *lock; void *ctx; - int ret; - - SYS_PORT_TRACING_OBJ_FUNC_ENTER(socket, close, sock); ctx = get_sock_vtable(sock, &vtable, &lock); if (ctx == NULL) { errno = EBADF; - SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, close, sock, -errno); return -1; } - (void)k_mutex_lock(lock, K_FOREVER); - - NET_DBG("close: ctx=%p, fd=%d", ctx, sock); - - ret = vtable->fd_vtable.close(ctx); - - k_mutex_unlock(lock); - - SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, close, sock, ret < 0 ? -errno : ret); - - zvfs_free_fd(sock); - - (void)sock_obj_core_dealloc(sock); - - return ret; -} - -#ifdef CONFIG_USERSPACE -static inline int z_vrfy_zsock_close(int sock) -{ return z_impl_zsock_close(sock); } #include diff --git a/subsys/net/lib/sockets/sockets_inet.c b/subsys/net/lib/sockets/sockets_inet.c index 88e4e47bfe4a6..acb9d470a5ea9 100644 --- a/subsys/net/lib/sockets/sockets_inet.c +++ b/subsys/net/lib/sockets/sockets_inet.c @@ -137,10 +137,14 @@ static int zsock_socket_internal(int family, int type, int proto) return fd; } -int zsock_close_ctx(struct net_context *ctx) +int zsock_close_ctx(struct net_context *ctx, int sock) { int ret; + SYS_PORT_TRACING_OBJ_FUNC_ENTER(socket, close, sock); + + NET_DBG("close: ctx=%p, fd=%d", ctx, sock); + /* Reset callbacks to avoid any race conditions while * flushing queues. No need to check return values here, * as these are fail-free operations and we're closing @@ -160,10 +164,16 @@ int zsock_close_ctx(struct net_context *ctx) ret = net_context_put(ctx); if (ret < 0) { errno = -ret; - return -1; + ret = -1; } - return 0; + SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, close, sock, ret < 0 ? -errno : ret); + + if (ret == 0) { + (void)sock_obj_core_dealloc(sock); + } + + return ret; } static void zsock_accepted_cb(struct net_context *new_ctx, @@ -2771,9 +2781,9 @@ static int sock_setsockopt_vmeth(void *obj, int level, int optname, return zsock_setsockopt_ctx(obj, level, optname, optval, optlen); } -static int sock_close_vmeth(void *obj) +static int sock_close2_vmeth(void *obj, int fd) { - return zsock_close_ctx(obj); + return zsock_close_ctx(obj, fd); } static int sock_getpeername_vmeth(void *obj, struct sockaddr *addr, socklen_t *addrlen) @@ -2791,7 +2801,7 @@ const struct socket_op_vtable sock_fd_op_vtable = { .fd_vtable = { .read = sock_read_vmeth, .write = sock_write_vmeth, - .close = sock_close_vmeth, + .close2 = sock_close2_vmeth, .ioctl = sock_ioctl_vmeth, }, .shutdown = sock_shutdown_vmeth, diff --git a/subsys/net/lib/sockets/sockets_internal.h b/subsys/net/lib/sockets/sockets_internal.h index 7efd6745ed387..647d45834439e 100644 --- a/subsys/net/lib/sockets/sockets_internal.h +++ b/subsys/net/lib/sockets/sockets_internal.h @@ -15,7 +15,7 @@ #define SOCK_NONBLOCK 2 #define SOCK_ERROR 4 -int zsock_close_ctx(struct net_context *ctx); +int zsock_close_ctx(struct net_context *ctx, int sock); int zsock_poll_internal(struct zsock_pollfd *fds, int nfds, k_timeout_t timeout); int zsock_wait_data(struct net_context *ctx, k_timeout_t *timeout); diff --git a/subsys/net/lib/sockets/sockets_packet.c b/subsys/net/lib/sockets/sockets_packet.c index 3fe9258c7996b..ec2d7e1853932 100644 --- a/subsys/net/lib/sockets/sockets_packet.c +++ b/subsys/net/lib/sockets/sockets_packet.c @@ -462,16 +462,16 @@ static int packet_sock_setsockopt_vmeth(void *obj, int level, int optname, return zpacket_setsockopt_ctx(obj, level, optname, optval, optlen); } -static int packet_sock_close_vmeth(void *obj) +static int packet_sock_close2_vmeth(void *obj, int fd) { - return zsock_close_ctx(obj); + return zsock_close_ctx(obj, fd); } static const struct socket_op_vtable packet_sock_fd_op_vtable = { .fd_vtable = { .read = packet_sock_read_vmeth, .write = packet_sock_write_vmeth, - .close = packet_sock_close_vmeth, + .close2 = packet_sock_close2_vmeth, .ioctl = packet_sock_ioctl_vmeth, }, .bind = packet_sock_bind_vmeth, diff --git a/subsys/net/lib/sockets/sockets_tls.c b/subsys/net/lib/sockets/sockets_tls.c index 57120321b3a2b..bb7b44097d09f 100644 --- a/subsys/net/lib/sockets/sockets_tls.c +++ b/subsys/net/lib/sockets/sockets_tls.c @@ -2108,7 +2108,7 @@ static int ztls_socket(int family, int type, int proto) return -1; } -int ztls_close_ctx(struct tls_context *ctx) +int ztls_close_ctx(struct tls_context *ctx, int sock) { int ret, err = 0; @@ -2120,6 +2120,10 @@ int ztls_close_ctx(struct tls_context *ctx) err = tls_release(ctx); ret = zsock_close(ctx->sock); + if (ret == 0) { + (void)sock_obj_core_dealloc(sock); + } + /* In case close fails, we propagate errno value set by close. * In case close succeeds, but tls_release fails, set errno * according to tls_release return value. @@ -3826,9 +3830,9 @@ static int tls_sock_setsockopt_vmeth(void *obj, int level, int optname, return ztls_setsockopt_ctx(obj, level, optname, optval, optlen); } -static int tls_sock_close_vmeth(void *obj) +static int tls_sock_close2_vmeth(void *obj, int sock) { - return ztls_close_ctx(obj); + return ztls_close_ctx(obj, sock); } static int tls_sock_getpeername_vmeth(void *obj, struct sockaddr *addr, @@ -3851,7 +3855,7 @@ static const struct socket_op_vtable tls_sock_fd_op_vtable = { .fd_vtable = { .read = tls_sock_read_vmeth, .write = tls_sock_write_vmeth, - .close = tls_sock_close_vmeth, + .close2 = tls_sock_close2_vmeth, .ioctl = tls_sock_ioctl_vmeth, }, .shutdown = tls_sock_shutdown_vmeth, From c58c130b48b801b70ea1ffecbf7176425412ee5d Mon Sep 17 00:00:00 2001 From: Ryan McClelland Date: Fri, 1 Nov 2024 15:35:35 -0700 Subject: [PATCH 2260/4482] drivers: sensor: default_rtio_sensor: fix limited range warning `chan_type` is defined as a `uint16_t`. This makes checking if it is < 0 always false. A warning is shown with -Wtype-limits. Remove the check as it is unnecessary. Signed-off-by: Ryan McClelland --- drivers/sensor/default_rtio_sensor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/sensor/default_rtio_sensor.c b/drivers/sensor/default_rtio_sensor.c index 11b8fc0c14051..123d6b1ff955f 100644 --- a/drivers/sensor/default_rtio_sensor.c +++ b/drivers/sensor/default_rtio_sensor.c @@ -348,7 +348,7 @@ int sensor_natively_supported_channel_size_info(struct sensor_chan_spec channel, __ASSERT_NO_MSG(base_size != NULL); __ASSERT_NO_MSG(frame_size != NULL); - if (((int)channel.chan_type < 0) || channel.chan_type >= (SENSOR_CHAN_ALL)) { + if (channel.chan_type >= SENSOR_CHAN_ALL) { return -ENOTSUP; } @@ -474,7 +474,7 @@ static int decode(const uint8_t *buffer, struct sensor_chan_spec chan_spec, return -EINVAL; } - if (((int)chan_spec.chan_type < 0) || chan_spec.chan_type >= (SENSOR_CHAN_ALL)) { + if (chan_spec.chan_type >= SENSOR_CHAN_ALL) { return 0; } From 207da3ad15dbb19129194f5e036e8cfe8645eb4b Mon Sep 17 00:00:00 2001 From: Marek Matej Date: Thu, 7 Nov 2024 22:22:13 +0000 Subject: [PATCH 2261/4482] doc: espressif: Add missing images Update and add missing Espressif board images. Signed-off-by: Marek Matej --- .../doc/img/esp32c3_devkitc.webp | Bin 0 -> 31546 bytes .../doc/img/esp32c3_devkitm.webp | Bin 0 -> 31046 bytes .../esp32c3_rust/doc/img/esp32c3_rust.webp | Bin 0 -> 16424 bytes .../doc/img/esp32c6_devkitc.webp | Bin 0 -> 22016 bytes .../doc/img/esp32s2_devkitc.webp | Bin 0 -> 19062 bytes .../esp32s2_saola/doc/img/esp32s2_saola.webp | Bin 0 -> 20460 bytes .../doc/img/esp32s3_devkitc.webp | Bin 0 -> 17434 bytes .../doc/img/esp32s3_devkitm.webp | Bin 0 -> 18464 bytes ...2-S3-EYE-isometric.webp => esp32s3_eye.webp} | Bin .../doc/img/esp8684_devkitm.webp | Bin 0 -> 30462 bytes 10 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 boards/espressif/esp32c3_devkitc/doc/img/esp32c3_devkitc.webp create mode 100644 boards/espressif/esp32c3_devkitm/doc/img/esp32c3_devkitm.webp create mode 100644 boards/espressif/esp32c3_rust/doc/img/esp32c3_rust.webp create mode 100644 boards/espressif/esp32c6_devkitc/doc/img/esp32c6_devkitc.webp create mode 100644 boards/espressif/esp32s2_devkitc/doc/img/esp32s2_devkitc.webp create mode 100644 boards/espressif/esp32s2_saola/doc/img/esp32s2_saola.webp create mode 100644 boards/espressif/esp32s3_devkitc/doc/img/esp32s3_devkitc.webp create mode 100644 boards/espressif/esp32s3_devkitm/doc/img/esp32s3_devkitm.webp rename boards/espressif/esp32s3_eye/doc/img/{ESP32-S3-EYE-isometric.webp => esp32s3_eye.webp} (100%) create mode 100644 boards/espressif/esp8684_devkitm/doc/img/esp8684_devkitm.webp diff --git a/boards/espressif/esp32c3_devkitc/doc/img/esp32c3_devkitc.webp b/boards/espressif/esp32c3_devkitc/doc/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n-nn%8RGcPVHF4_`VU1xdCBbjf-3kuOL9000Hn z#p?ZyFV$3HscjHWAr=oZvYde2!7Md%duGM@i>f;z2tXmW1iO<^WmA<%1f4623G_$H zC1J?=HLvBjVKKA2^FC1=p!Qyz88FObMF!T@q#XE;uGKo5?!=`m%0GzHp}$=~zg9cR z2&gvb8Iyc6wJOAiJq_#Dx><`Lh@7Do4sJEJIm%f)FyOhOcf9JgAcTr^6mu1=Q)nD0 zF4-5oBZ6!ok;ni502N>`d@}31n;vUGHy}P2gsu)bB&_(v(jC_M1%oi$cVOA3j;C3j zYC1xm5~Ka*${9oPYf5n9vtpx3IX1a#r{8}AGG6pCCNnA^23loEHPlA>vAIo!uK!>F z000DKTa3^ycBnL=5o;VFbTf7C+r9nkeG$|88iK@ja6|Bv$|_r$#o)(5Xg^v^_QJ>j i00052FYDZ&d{M>568c+NL@FFv!BvZH?G%6j0002hYZrI` literal 0 HcmV?d00001 diff --git a/boards/espressif/esp32c3_devkitm/doc/img/esp32c3_devkitm.webp b/boards/espressif/esp32c3_devkitm/doc/img/esp32c3_devkitm.webp new file mode 100644 index 0000000000000000000000000000000000000000..d28264253d702b1953748e5e40aae458a43b6744 GIT binary patch literal 31046 zcmYJZQ;;Z1v~5|oZQHhO+qSvOwr$(CZQHi(sy?^x>(_rH|1xr}h@2y0DM^Zn@p%9M zsEZ0Is3~v|F#X5%CxAJCR2o1JfP4u8nUW<%g%lO4odpO;kmhzrlHNJi--zxjrJ+G9 zTY^_{?3l1!G#`2U_-B7!uRTBV zzi}|Xc77w5i0^+-e$RQEKOqL7tM=2+5O3ml{EfRcesQON4|%t|{$20iv_5g`(68uK zeP8&0Jfl7y*QlRwe?i~+ZFzrxzj<(eUVVRGgTB{Uvaw^v4eQr#+_~Tlk!IpYh{xO?mnh>B@3F~>hJ|}i{G1ES>Oosm zGp(j^mYa7H=B$77j1@kVIkRWYnKPzOo&N(UOCg@?xUQD5f)%Rp7`v34VC80G`+Kc& zuPmoq_NE3OTn1rP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LWwb5yKmY&$0L=nYY@WYf nN+&z~AZUs+3`S;z%Kd+YguqM$bie=r000DzmH+?%00000?pJ)Y literal 0 HcmV?d00001 diff --git a/boards/espressif/esp32c3_rust/doc/img/esp32c3_rust.webp b/boards/espressif/esp32c3_rust/doc/img/esp32c3_rust.webp new file mode 100644 index 0000000000000000000000000000000000000000..aba51b8fe69619455546a767f81ec878aca62a6c GIT binary patch literal 16424 zcmYjYQ*>_4vi)M)wr$(Cv6JlB=8kPU*|BZgwr$(K|2^ki^wWCkQ9Wzctl2esDNBiq z6AA(V8e+nV>WZ9%sQ-K;iUVZ>QELK=1M|m=|CK2!C?GDZ=Q6KFhO)5TbL9uF&k79n ztw)`Im%2ZAAxP!-e2aKPXy+eov%7rwCJ+_K{pS7_c)hXmU3Eu!Ao%iCjGYoF@*VpA zxfFQg8_=2gBoMr@?|%5;I!Ac*arCZu2LDbxc?q~V_7?Wl^^`qpx{NimZm)!vW@uFYw}L*u=(V2aBgClTkAx$OVXe$ zTr?G|q;yEINwN4!%^OIXz+FGsvyv(6e5@QiPM2S|M4mi^79`oJmD4y+ZyFy~Wf{f! zfsj>&#)^Goz~l%O1pBY(ycGg6R=zK}+Fb1C5DDGFOknE1Ap33tvUK(Ad~=us=8P!4 z*E7$8>7weGH8hy>W{U}070PZ^Js@77o_Nw*KPz!!@ko?OXZZ?jfO_^POLFyqON_O` zwGJjBf0BCIxdO`p2tDNL zdk7RNl^ziyds2vQl2U>29~}6hV+qGd!fCYAtVr%IF{uPEXuQPA#wx0GI!x z9~=X48D#8u`y>nRJYa zZ2YJ;eU126)g<8=@+@Ah#+4HqmS_4QB5SH^l*mA$;;Pct8CQVo$Wx*B zmjtH0tQCds6;I@}-y+=0T`)Ne8u}$wRj5Hdf&9N6(K!DHD3#q}rsD(Xlj-Uf|BRP% z`NqAGAMU0_YK6D1gfwz*!ls;xmR}%Ud{@SW$P=LhvFlf|X;ZxSqwU9Mh~bwT z0xe{EsJbMHQAM3))0Pb{8>U?uv*f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fzue-1~pMV%-`?n$l!bV9;WiU3UK&s-2*R?+`D=$MUc<)-w6`T!1+5k;6w9 zTXn+5aTMJbF;6QJv4Mb!$Xe)F{cXv!QwgUrgqx>A`F08l$=dv*7riyVj9HLzwVf+V z5fG+LI8+k_vQT&ht@+k4367R&pMk|DRO(zkYjC0_wl+S|N4PXTOndmZXsr zUl&Dc&=*vY0bq#*w_QEi%7cn^BcC8l#Fyg}g~pmx(S#;nEOlsZSgx^ORR>#lTTf61 z&Y*~AbM$MWvkdXIJ_fwm$Y0-Mc-Xe|i7_?@kUc@ZqE-Bx$ToY}<*mYOwvyOuK}koS z%K)@eq0aZ1rTwLiF&^3Fx=g`MY^nze4Z+h!POl0?w!TE#Vh@Do7~5FvVr!Pn>cW8r zQsQ?O`oSIq54r|keW)^Kl#I+6575nu8cAGit||5=3KsoXb^$&UqN0ACKPQY&;7@%!TUL($+C_*bII z1*tKm#z+p`qiGYfDvUgFBO%&!9L_BLF;sdqEO5&MCjdZ*U+fNN*sKnoL~S$w3iJ?H ztYM3aHY*WOnuiPZpuv0YIKoQft=u~eX;z}y>TI$RRHp=y4_f@R_RY|wD682ls_Xa9 J?_B@A{tNp%z+nIY literal 0 HcmV?d00001 diff --git a/boards/espressif/esp32c6_devkitc/doc/img/esp32c6_devkitc.webp b/boards/espressif/esp32c6_devkitc/doc/img/esp32c6_devkitc.webp new file mode 100644 index 0000000000000000000000000000000000000000..3b16025a0a87e256e4642573a6fb3af2a0633348 GIT binary patch literal 22016 zcmb@sQ&L0$Vw$aReqL_A&~yXf$YyB{UYX81QHdSabpj(2-`Km_&lVLyge? z=Y`E9f&*A%WB;cc(fpz6`8;JHukg8CS_E?X`5GBXr)@{Y|80NHEHEVlVkN+PG2$)h zh(%6b<^z>QEzZy0BVD{GKK9XMEZ{bJKX={n0}ma=e#PzZy;vbN-bfFW$?d3C`X@Irt54!}kKYh%^nGxFY|97m=N~3juGu})Z z%^i6_BKMV$#Lc51T$k$D?)DFsF;Qa%FGr-xz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_+CEWXLy$EDQ>_iQjn%de>f`i>3tZNs&6R!UE$`pBU(tO;d7$z(SRg9Zd$i zQ-uJXwYV`AS=^O$>;(6c0BlW2!ktFlxCH*aCeENGCQkq&Jp)+a{jeF_>TTn!?+7Z6 z#hwe>E8)}BEJDJxvAI*+ZI5n?k~skVyEx^o;fQ-JgwrIE+z$yWqgw=Mh5RQdrLN;d zii*05%^>8$a~@w!eUC|<2A_IoxzFb%6h04i^H7Ow-e?KJ0Vy2vl*fO=-~x<)uaz^y zV-6lxuP^X#p-w4 zy^uHTnk(+R&fca0I_@E|Z-OjlkV|0F<^T?LyIa*D>c1jEn0Zz<1kXhR8G5zzKmY)0 zp8Q}Jqzi-eu{^pl1Rx*LLI6POT_owzIv33gU^ze*?GIug00000000000000000000 I000000HU0VegFUf literal 0 HcmV?d00001 diff --git a/boards/espressif/esp32s2_devkitc/doc/img/esp32s2_devkitc.webp b/boards/espressif/esp32s2_devkitc/doc/img/esp32s2_devkitc.webp new file mode 100644 index 0000000000000000000000000000000000000000..07f8b7ee41e197a7cb8646dc0ecfe150042353ac GIT binary patch literal 19062 zcmagEQkYcgg+haq1Udp>Kje!!P&u?)~Cn;az7Gd+a+;;LfslWN$8Y8D<@aqq?MmVgiW;j>8Zk`Tw&$em9`krrp{1bBOR6S)dTOCPG4Q zx!puXOC%OB24nf;)}857PD~E}xq0`OwxMYg-5(t%dp1zDa9yD{j1;>+@*P zEgk3D?G&da*S!YMzeC`PED6lcv=gZvcGJ24<`q`aZSW~k)TIbF8z|3n}$j=%!P zW*F+6n5lu?(jkC%?A+S9^}`hAHR1^esFdy(FPPR;UYHue>`JUq+Vp=^3l^J_?Mdf( zSrPeuO9eF8kG_0aE0d@Z9YI)@Xs{ze3x4|F+98o1Tbh~p8M%Z#RXJ2xU(w)IGGO7u zKL|$kSnPFszcZ1!+mku|d)Z@i^&_c3Vj&#cMnn`;7;5vGnfVxrSw&Ds>}whqlK)s1 zdVr}{J2$N4{7{5}$$cbc+J>c=6rx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?vEKOaIn4yw9OHbuW5bfLSJc2hgaG<;B87=R(jNjL1s%Wt8(&;S4) nB24KXH$LlJWKn1}wji`NOalmdu1mN8000000000000000Q!`Jr literal 0 HcmV?d00001 diff --git a/boards/espressif/esp32s2_saola/doc/img/esp32s2_saola.webp b/boards/espressif/esp32s2_saola/doc/img/esp32s2_saola.webp new file mode 100644 index 0000000000000000000000000000000000000000..833147b884c077ca6f3c6a256550d9090b3f61e1 GIT binary patch literal 20460 zcmb@NQSY;Ss> z+NO82A6XwB0M7__)nEFqe30HvKJ}n~DL&es_x8S#7}qvSi~TshlD_TkeOG?lZ%C`RHYQ`4e)E69p26dzw*L)Qd%AaMn=Bl?)G2A=`_Z$DysGlwP}I$OeB#IY z4fvTTP|6{@@%oheR#U)nDR3}cO;7e5jX3T|BWS66!v-hl#u(p+P^YW>KU8S*sIK^J z$7yn~%KF{A;17}NbXD9<4FgL>#$JPjQFn5cYg{I^Ajwry?{RxkG&P{=E!u0VlHYk9 zIntn8ApR!^ZwN(WOTLaTnlNfmzh9e5MGfhbyv440m8C12UFhj*Iv-Mb=hfs$1#PYv z285ON>=U~iz0 zaw6lH#wmlK&M&lfJe{qT(raawOyj>&%U_`vj4U&c6@GX zO$>Y&5YjcTw#!{y_b-YKG0y24Ub1ceUk2B*J?r+_Fotu*?-V@~3FQTX7(@sK6;7{W ztQ-M$C!%bV7Jtu!8j-;RXSe$56MYgu~O=!}ToT#)Q zu7ZvWWz1E+){aY%lux}v;s>{OcfS(XX^@o8AYW8QD~QqY+Y|W8N$cG($%Q!AFY+mk zo~p8)xh3cj|IuQkP827SaxI!}1YmFrsDuZ=)DiMLvX&VGJ|ph;UrfLN0w1~^@XE^4 zad=@vbI}r1%bJcv#Z0W8#w+T^XMX6oE?Kh^rNn?5r(`q$qUSXW{YgU+wV? zlA6KV5?#Qvi+}z$tq%U;QsuL`tU-J<6oK*`SIBm5IE1|6v*#mvOq159v~6KrYBp1~ z2to5mSPS|MS7iJPr{E}P-j7>u)$c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lB2f zHDj#TVl#RQn4~vm|2ifAmnex2vgvz-&9SbCX8JBbm7`RS|GTPWbqwL=nTt*%7>g{e zF_jq<#pdpjml9u8|CGVRdXu47rYvnJ6?XYb5xez~kQ9rzQ~RcOt{;E^Sx^CKY6yRa zNcE@=*9Vp}|9O4|x-kZ6K^Kn!0LGF=xm-d0`OuNE@aX{1@eZd@0u57IQieB}{r{cA zvNef;agKFF$Hg8Ohe${Kid|n0mHyMx5ZQ5_qnrMpc8&k`>^whAC%;Ald6U;b>ZSE} z0fUzy5j$DE0>`+Fyq;ytlne-OjC4>Ch(F;TA(J!c5UujN@N3!oQu+Qzqc%QyD_}@? z9L^kO+}uJ>UDA`9{Rd$)_U7rd+#yL`-?$=9cm3;_Y{Lx0 z??C@+tN-FiaGFpd&sLYAMiBo#nHVR2Tpk8UzzkTn$nqm=b4!4!Wy(mWZap$ZeaY`y z0PAT!ud2bL+rqfuh+RUR>SbBn#zkWTQ#7!IrpvmE*9D9JCX__79MU3pB}h4=xY`gT zkBfqDNE7NjHWc%?&W>ss1aHYDT>`x(@L0I<7cv=@mB za8|e>X!)o?xSF$|GAbVUA0j{#h8NQN#egP!I!qOjnC%DT8db>42_5|Ns^^L+#RmMB zt~01S<*^9PhwX#s(MR*4UJxP!q(KNpuks;_;YVM2RU|?cfB3gNG+cjX$QPe)4&$+_ z;vE70n}?wmpLRoHjJ!X#B%7bDVHFa+JLPM}OQ1ULJH}1AOhea3(YltYGd?h)e=9ZB0l7Y5<$jR{>*(UK??>~p)LQ;ckolP{l z@;v(V4Ial}OO+CAI{^;3p}_bJ3D{%ZH?Y~>x)YS50002_@aX_BygErK_5LFcsdHFp%t>sQ&Dz~4;?70M)00000kl&Vy literal 0 HcmV?d00001 From f81c20d088e04531196388e6b889ebb4703d2552 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Wed, 6 Nov 2024 16:09:25 -0800 Subject: [PATCH 2262/4482] Revert "tinycrypt: deprecate the library" This reverts commit 5e225e0c8b2fb1ceb290fe91170b0e2d5bc46259. Based on #79931 and TSC discussions, it was decided that TinyCrypt will be deprecated *AFTER* 4.0. Signed-off-by: Flavio Ceolin --- doc/releases/migration-guide-4.0.rst | 13 ------------- doc/releases/release-notes-4.0.rst | 10 ---------- modules/Kconfig.tinycrypt | 1 - 3 files changed, 24 deletions(-) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 20e10f9a77bc0..358f92bbd857e 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -75,19 +75,6 @@ Mbed TLS corresponding build symbol was removed in Mbed TLS 3.1.0 and is now assumed to be enabled. (:github:`77657`) -TinyCrypt -========= - -* Starting from this release the library is marked as deprecated (:github:`79566`). - The reasons for this are (:github:`43712``): - - * the upstream version of this library is unmaintained. - - * to reduce the number of crypto libraries available in Zephyr (currently there are - 3 different implementations: TinyCrypt, MbedTLS and PSA Crypto APIs). - - The PSA Crypto API is now the de-facto standard to perform crypto operations. - Trusted Firmware-M ================== diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 5dba55b941a41..8405c8e567556 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -58,16 +58,6 @@ Deprecated in this release * The :ref:`kscan_api` subsystem has been marked as deprecated. -* The TinyCrypt library was marked as deprecated (:github:`79566`). The reasons - for this are (:github:`43712``): - - * the upstream version of this library is unmaintained. - - * to reduce the number of crypto libraries available in Zephyr (currently there are - 3 different implementations: TinyCrypt, MbedTLS and PSA Crypto APIs). - - The PSA Crypto API is now the de-facto standard to perform crypto operations. - Architectures ************* diff --git a/modules/Kconfig.tinycrypt b/modules/Kconfig.tinycrypt index b54ad7641285e..168e05ed79980 100644 --- a/modules/Kconfig.tinycrypt +++ b/modules/Kconfig.tinycrypt @@ -9,7 +9,6 @@ config ZEPHYR_TINYCRYPT_MODULE config TINYCRYPT bool "TinyCrypt Support" depends on ZEPHYR_TINYCRYPT_MODULE - select DEPRECATED help This option enables the TinyCrypt cryptography library. From 429d2e79b12e0b49ad3a213dd9842e2efdd4430f Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Fri, 8 Nov 2024 09:46:52 -0800 Subject: [PATCH 2263/4482] docs: release/4.0: Info about TinyCrypt Add an information about upcoming TinyCrypt deprecation. Signed-off-by: Flavio Ceolin --- doc/releases/migration-guide-4.0.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 358f92bbd857e..4ab7f154b20f9 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -75,6 +75,12 @@ Mbed TLS corresponding build symbol was removed in Mbed TLS 3.1.0 and is now assumed to be enabled. (:github:`77657`) +TinyCrypt +========= + +Albeit the formal deprecation of TinyCrypt is not started yet, its removal from +the Zephyr codebase is. Formal deprecation will happen in the next release. + Trusted Firmware-M ================== From 4e50521a22036334782b2de795b2b2973686a8c7 Mon Sep 17 00:00:00 2001 From: Erwan Gouriou Date: Thu, 7 Nov 2024 15:24:53 +0100 Subject: [PATCH 2264/4482] doc: release notes v4.0: STM32 additions Gathers STM32 noteworthy additions for 4.0 release. Signed-off-by: Erwan Gouriou --- doc/releases/release-notes-4.0.rst | 54 +++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 8405c8e567556..23f3f5f6e6d65 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -155,12 +155,16 @@ Boards & SoC Support * Added support for these SoC series: * Added ESP32-C2 and ESP8684 SoC support. + * Added STM32U0 series with GPIO, Serial, I2C, DAC, ADC, flash, PWM and counter driver support. + * Added STM32WB0 series with GPIO, Serial, I2C, SPI, ADC, DMA and flash driver support. + * Added STM32U545xx SoC variant. * Made these changes in other SoC series: * NXP S32Z270: Added support for the new silicon cut version 2.0. Note that the previous versions (1.0 and 1.1) are no longer supported. * Added ESP32 WROVER-E-N16R4 variant. + * STM32H5: Added support for OpenOCD through STMicroelectronics OpenOCD fork. * Added support for these boards: @@ -235,6 +239,7 @@ Boards & SoC Support * Support for Google Kukui EC board (``google_kukui``) has been dropped. * STM32: Deprecated MCO configuration via Kconfig in favour of setting it through devicetree. See ``samples/boards/stm32/mco`` sample. + * STM32: STM32CubeProgrammer is now the default runner on all STMicroelectronics STM32 boards. * Removed the ``nrf54l15pdk`` board, use :ref:`nrf54l15dk_nrf54l15` instead. * PHYTEC: ``mimx8mp_phyboard_pollux`` has been renamed to :ref:`phyboard_pollux`, with the old name marked as deprecated. @@ -311,6 +316,7 @@ Drivers and Sensors * Added proper ADC2 calibration entries in ESP32. * Fixed calibration scheme in ESP32-S3. + * STM32H7: Added support for higher sampling frequencies thanks to boost mode implementation. * Battery @@ -325,6 +331,12 @@ Drivers and Sensors * Clock control + * STM32 MCO (Microcontroller Clock Output) is now available on STM32U5 series. + * STM32 MCO can and should now be configured with device tree. + * STM32: :kconfig:option:`CONFIG_CLOCK_CONTROL` is now enabled by default at family level and doesn't need + to be enabled at board level anymore. + * STM32H7: PLL FRACN can now be configured (see :dtcompatible:`st,stm32h7-pll-clock`) + * Comparator * Introduced comparator device driver subsystem selected with :kconfig:option:`CONFIG_COMPARATOR` @@ -335,10 +347,19 @@ Drivers and Sensors * Counter +* Crypto + + * Added support for STM32L4 AES. + * DAC + * DAC API now supports specifying channel path as internal. Support has been added in STM32 drivers. + * Disk + * STM32F7 SDMMC driver now supports usage of DMA. + * STM32 mem controller driver now supports FMC for STM32H5. + * Display * EEPROM @@ -349,26 +370,28 @@ Drivers and Sensors * Ethernet * LiteX: Renamed the ``compatible`` from ``litex,eth0`` to :dtcompatible:`litex,liteeth`. + * STM32: Driver can now be configured to use a preemptive RX thread priority, which could be useful + in case of high network traffic load (reduces jitter). * Flash * Fixed SPI NOR driver issue where wp, hold and reset pins were incorrectly initialized from device tee when SFDP at run-time has been enabled (:github:`80383`) * Updated all Espressif's SoC driver initialization to allow new chipsets and octal flash support. - * Added :kconfig:option:`CONFIG_SPI_NOR_ACTIVE_DWELL_MS`, to the SPI NOR driver configuration, which allows setting the time during which the driver will wait before triggering Deep Power Down (DPD). This option replaces ``CONFIG_SPI_NOR_IDLE_IN_DPD``, aiming at reducing unnecessary power state changes and SPI transfers between other operations, specifically when burst type access to an SPI NOR device occurs. - * Added :kconfig:option:`CONFIG_SPI_NOR_INIT_PRIORITY` to allow selecting the SPI NOR driver initialization priority. - * The flash API has been extended with the :c:func:`flash_copy` utility function which allows performing direct data copies between two Flash API devices. - * Fixed a Flash Simulator issue where offsets were assumed to be absolute instead of relative to the device base address (:github:`79082`). + * Extended STM32 OSPI drivers to support QUAL, DUAL and SPI modes. Additionally, added support + for custom write and SFDP:BFP opcodes. + * Added possibility to run STM32H7 flash driver from Cortex-M4 core. + * Implemented readout protection handling (RDP levels) for STM32F7 SoCs. * GNSS @@ -446,6 +469,8 @@ Drivers and Sensors * Added SCMI-based driver for NXP i.MX * Added support for i.MX93 M33 core * Added support for ESP32C2 + * STM32: :kconfig:option:`CONFIG_PINCTRL` is now selected by drivers requiring it and + shouldn't be enabled at board level anymore. * PWM @@ -460,6 +485,8 @@ Drivers and Sensors * RTC + * STM32: HSE can now be used as domain clock. + * RTIO * SDHC @@ -502,6 +529,8 @@ Drivers and Sensors * USB + * Added support for USB HS on STM32U59x/STM32U5Ax SoC variants. + * Video * Introduced API to control frame rate @@ -515,6 +544,7 @@ Drivers and Sensors * Added support for NXP MCUX SMARTDMA interface (:dtcompatible:`nxp,smartdma`) * Added support for more OmniVision OV2640 controls (:dtcompatible:`ovti,ov2640`) * Added support for more OmniVision OV5640 controls (:dtcompatible:`ovti,ov5640`) + * STM32: Implemented :c:func:`video_get_ctrl` and :c:func:`video_set_ctrl` APIs. * W1 @@ -785,6 +815,8 @@ Libraries / Subsystems * Debug + * Added west runner for probe-rs, a Rust-based embedded toolkit. + * Demand Paging * Added LRU (Least Recently Used) eviction algorithm. @@ -956,6 +988,20 @@ HALs * STM32 + * Updated STM32C0 to cube version V1.2.0. + * Updated STM32F1 to cube version V1.8.6. + * Updated STM32F2 to cube version V1.9.5. + * Updated STM32F4 to cube version V1.28.1. + * Updated STM32G4 to cube version V1.6.0. + * Updated STM32H5 to cube version V1.3.0. + * Updated STM32H7 to cube version V1.11.2. + * Updated STM32H7RS to cube version V1.1.0. + * Added STM32U0 Cube package (1.1.0) + * Updated STM32U5 to cube version V1.6.0. + * Updated STM32WB to cube version V1.20.0. + * Added STM32WB0 Cube package (1.0.0) + * Updated STM32WBA to cube version V1.4.1. + * ADI * Espressif From 8025c8473bf2997c11d4d237e10aee8632dccb56 Mon Sep 17 00:00:00 2001 From: Erwan Gouriou Date: Fri, 8 Nov 2024 15:22:24 +0100 Subject: [PATCH 2265/4482] doc: Migration guide v4.0: STM32 additions STM32 noteworthy additions for 4.0 release. Signed-off-by: Erwan Gouriou --- doc/releases/migration-guide-4.0.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 4ab7f154b20f9..3561d142af472 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -58,6 +58,7 @@ STM32 * On all official STM32 boards, ``west flash`` selects STM32CubeProgrammer as the default west runner. If you want to enforce the selection of another runner like OpenOCD or pyOCD for flashing, you should specify it using the west ``--runner`` or ``-r`` option. (:github:`75284`) +* ADC: Domain clock needs to be explicitly defined if property st,adc-clock-source = is used. Modules ******* From 0775b507b59544819733923b7b4b646fc9aebadc Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Tue, 29 Oct 2024 10:51:22 +0100 Subject: [PATCH 2266/4482] submanifests: optional: Bump nanopb to 0.4.9 Sync upstream and get the latest tagged version 0.4.9. Signed-off-by: Pieter De Gendt --- submanifests/optional.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submanifests/optional.yaml b/submanifests/optional.yaml index 59e837c877fb8..d7dd59b3669a9 100644 --- a/submanifests/optional.yaml +++ b/submanifests/optional.yaml @@ -22,7 +22,7 @@ manifest: groups: - optional - name: nanopb - revision: 4474bd35bd39de067f0532a1b19ce3aed9ed9807 + revision: 98bf4db69897b53434f3d0ba72e0a3ab1a902824 path: modules/lib/nanopb remote: upstream groups: From 373ed89e4bf811afcd783fd41220b3928135d2b2 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Fri, 8 Nov 2024 18:09:02 +0100 Subject: [PATCH 2267/4482] doc: release: 4.0: Add nanopb 0.4.9 update Add section for nanopb and upstream sync. Signed-off-by: Pieter De Gendt --- doc/releases/release-notes-4.0.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 23f3f5f6e6d65..19469ea732a20 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -1071,6 +1071,12 @@ Trusted Firmware-M (TF-M) * TF-M was updated to version 2.1.1 (from 2.1.0). The release notes can be found at: https://trustedfirmware-m.readthedocs.io/en/tf-mv2.1.1/releases/2.1.1.html +Nanopb +****** + +* Updated the nanopb module to version 0.4.9. + Full release notes at https://github.com/nanopb/nanopb/blob/0.4.9/CHANGELOG.txt + LVGL **** From c50777a8431157bd4ab3a2c2e2a37e8151ae07da Mon Sep 17 00:00:00 2001 From: Dan Kalowsky Date: Fri, 8 Nov 2024 13:23:24 -0800 Subject: [PATCH 2268/4482] VERSION: bump for 4.0.0-rc3 Update the VERSION file to reflect the taggingg for v4.0.0-rc3 release Signed-off-by: Dan Kalowsky --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 939e2dae1ef3c..78abb38a7d723 100644 --- a/VERSION +++ b/VERSION @@ -2,4 +2,4 @@ VERSION_MAJOR = 4 VERSION_MINOR = 0 PATCHLEVEL = 0 VERSION_TWEAK = 0 -EXTRAVERSION = rc2 +EXTRAVERSION = rc3 From 1aba3ce280a924029d32fd43130f7097c3b029d3 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Sun, 10 Nov 2024 21:55:01 -0800 Subject: [PATCH 2269/4482] doc: release/4.0: Add CVE under embargo Add information about CVE under embargo. Signed-off-by: Flavio Ceolin --- doc/releases/release-notes-4.0.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 19469ea732a20..8b19b3a652be7 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -26,6 +26,7 @@ More detailed information can be found in: https://docs.zephyrproject.org/latest/security/vulnerabilities.html * :cve:`2024-8798`: Under embargo until 2024-11-22 +* :cve:`2024-10395`: Under embargo until 2025-01-23 API Changes *********** From a19fb8e122c4787b69817aae03dbfd3c61707971 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Sun, 10 Nov 2024 21:57:44 -0800 Subject: [PATCH 2270/4482] doc: security: Add CVE under embargo Add an entry to CVE-2024-10395 Signed-off-by: Flavio Ceolin --- doc/security/vulnerabilities.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/security/vulnerabilities.rst b/doc/security/vulnerabilities.rst index 39c7353019c33..6bdf011f9dcb8 100644 --- a/doc/security/vulnerabilities.rst +++ b/doc/security/vulnerabilities.rst @@ -1789,3 +1789,8 @@ This has been fixed in main for v3.7.0 ---------------- Under embargo until 2024-11-22 + +:cve:`2024-10395` +----------------- + +Under embargo until 2025-01-23 From 7f4cab95b3aa522cce89e758ec558960104302e2 Mon Sep 17 00:00:00 2001 From: Duy Nguyen Date: Mon, 11 Nov 2024 12:51:34 +0700 Subject: [PATCH 2271/4482] doc: release notes v4.0: Renesas RA addition Update noteworthy support of Renesas RA driver for 4.0 release Signed-off-by: Duy Nguyen --- doc/releases/release-notes-4.0.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 8b19b3a652be7..0ef673d2c8b24 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -318,6 +318,7 @@ Drivers and Sensors * Added proper ADC2 calibration entries in ESP32. * Fixed calibration scheme in ESP32-S3. * STM32H7: Added support for higher sampling frequencies thanks to boost mode implementation. + * Added initial support for Renesas RA8 ADC driver (:dtcompatible:`renesas,ra-adc`) * Battery @@ -337,6 +338,10 @@ Drivers and Sensors * STM32: :kconfig:option:`CONFIG_CLOCK_CONTROL` is now enabled by default at family level and doesn't need to be enabled at board level anymore. * STM32H7: PLL FRACN can now be configured (see :dtcompatible:`st,stm32h7-pll-clock`) + * Added initial support for Renesas RA clock control driver (:dtcompatible:`renesas,ra-cgc-pclk`, + :dtcompatible:`renesas,ra-cgc-pclk-block`, :dtcompatible:`renesas,ra-cgc-pll`, + :dtcompatible:`renesas,ra-cgc-external-clock`, :dtcompatible:`renesas,ra-cgc-subclk`, + :dtcompatible:`renesas,ra-cgc-pll-out`) * Comparator @@ -348,6 +353,8 @@ Drivers and Sensors * Counter + * Added initial support for Renesas RA8 AGT counter driver (:dtcompatible:`renesas,ra-agt`) + * Crypto * Added support for STM32L4 AES. @@ -368,6 +375,10 @@ Drivers and Sensors * Added support for using the EEPROM simulator with embedded C standard libraries (:dtcompatible:`zephyr,sim-eeprom`). +* Entropy + + * Added initial support for Renesas RA8 Entropy driver (:dtcompatible:`renesas,ra-rsip-e51a-trng`) + * Ethernet * LiteX: Renamed the ``compatible`` from ``litex,eth0`` to :dtcompatible:`litex,liteeth`. @@ -393,6 +404,7 @@ Drivers and Sensors for custom write and SFDP:BFP opcodes. * Added possibility to run STM32H7 flash driver from Cortex-M4 core. * Implemented readout protection handling (RDP levels) for STM32F7 SoCs. + * Added initial support for Renesas RA8 Flash controller driver (:dtcompatible:`renesas,ra-flash-hp-controller`) * GNSS @@ -405,6 +417,8 @@ Drivers and Sensors * I2C + * Added initial support for Renesas RA8 I2C driver (:dtcompatible:`renesas,ra-iic`) + * I2S * Added ESP32-S3 and ESP32-C3 driver support. @@ -476,6 +490,7 @@ Drivers and Sensors * PWM * rpi_pico: The driver now configures the divide ratio adaptively. + * Added initial support for Renesas RA8 PWM driver (:dtcompatible:`renesas,ra8-pwm`) * Regulators @@ -517,6 +532,8 @@ Drivers and Sensors * SPI + * Added initial support for Renesas RA8 SPI driver (:dtcompatible:`renesas,ra8-spi-b`) + * Steppers * Introduced stepper controller device driver subsystem selected with From 65511eacf9d17bf22a6cf28c3ace467a86a159f5 Mon Sep 17 00:00:00 2001 From: Dat Nguyen Duy Date: Sat, 9 Nov 2024 14:10:29 +0700 Subject: [PATCH 2272/4482] drivers: dma_mcux_edma: utilize correct macros for edma v3 Utilize correct macros for edma v3 Signed-off-by: Dat Nguyen Duy --- drivers/dma/dma_mcux_edma.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/dma/dma_mcux_edma.c b/drivers/dma/dma_mcux_edma.c index eede99c1eb36e..432a913e6fa97 100644 --- a/drivers/dma/dma_mcux_edma.c +++ b/drivers/dma/dma_mcux_edma.c @@ -146,7 +146,12 @@ struct dma_mcux_edma_data { #define EDMA_TCD_CITER(tcd, flag) ((tcd)->CITER) #define EDMA_TCD_CSR(tcd, flag) ((tcd)->CSR) #define EDMA_TCD_DLAST_SGA(tcd, flag) ((tcd)->DLAST_SGA) +#if defined(CONFIG_DMA_MCUX_EDMA_V3) +#define DMA_CSR_DREQ DMA_TCD_CSR_DREQ +#define EDMA_HW_TCD_CH_ACTIVE_MASK (DMA_CH_CSR_ACTIVE_MASK) +#else #define EDMA_HW_TCD_CH_ACTIVE_MASK (DMA_CSR_ACTIVE_MASK) +#endif /* CONFIG_DMA_MCUX_EDMA_V3 */ #elif defined(CONFIG_DMA_MCUX_EDMA_V4) /* Above macros have been defined in fsl_edma_core.h */ #define EDMA_HW_TCD_CH_ACTIVE_MASK (DMA_CH_CSR_ACTIVE_MASK) From 79f742f252b18844a584f7b5ce98f145d5c1f017 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 8 Nov 2024 10:37:08 -0500 Subject: [PATCH 2273/4482] doc: tests: remove page about deprecated ztest APIs Remove leftover page about deprecated ztest APIs. Signed-off-by: Anas Nashif --- doc/develop/test/index.rst | 1 - doc/develop/test/ztest.rst | 2 +- doc/develop/test/ztest_deprecated.rst | 266 -------------------------- 3 files changed, 1 insertion(+), 268 deletions(-) delete mode 100644 doc/develop/test/ztest_deprecated.rst diff --git a/doc/develop/test/index.rst b/doc/develop/test/index.rst index 9f43f86f8bc86..c5f96b400caee 100644 --- a/doc/develop/test/index.rst +++ b/doc/develop/test/index.rst @@ -12,4 +12,3 @@ Testing pytest coverage BabbleSim - ztest_deprecated diff --git a/doc/develop/test/ztest.rst b/doc/develop/test/ztest.rst index 8e5ccddd6a92c..6db3867a09c67 100644 --- a/doc/develop/test/ztest.rst +++ b/doc/develop/test/ztest.rst @@ -263,7 +263,7 @@ prj.conf :language: text :linenos: -src/main.c (see :ref:`best practices `) +src/main.c .. literalinclude:: ../../../samples/subsys/testsuite/integration/src/main.c :language: c diff --git a/doc/develop/test/ztest_deprecated.rst b/doc/develop/test/ztest_deprecated.rst deleted file mode 100644 index 2bd7194c55b8f..0000000000000 --- a/doc/develop/test/ztest_deprecated.rst +++ /dev/null @@ -1,266 +0,0 @@ -.. _test-framework-deprecated: - -ZTest Deprecated APIs -##################### - -Ztest is currently being migrated to a new API, this documentation provides information about the -deprecated APIs which will eventually be removed. See :ref:`Test Framework ` for the new API. -Similarly, ZTest's mocking framework is also deprecated (see :ref:`Mocking via FFF `). - -Quick start - Unit testing -************************** - -Ztest can be used for unit testing. This means that rather than including the -entire Zephyr OS for testing a single function, you can focus the testing -efforts into the specific module in question. This will speed up testing since -only the module will have to be compiled in, and the tested functions will be -called directly. - -Since you won't be including basic kernel data structures that most code -depends on, you have to provide function stubs in the test. Ztest provides -some helpers for mocking functions, as demonstrated below. - -In a unit test, mock objects can simulate the behavior of complex real objects -and are used to decide whether a test failed or passed by verifying whether an -interaction with an object occurred, and if required, to assert the order of -that interaction. - -.. _main_c_bp: - -Best practices for declaring the test suite -=========================================== - -*twister* and other validation tools need to obtain the list of -subcases that a Zephyr *ztest* test image will expose. - -.. admonition:: Rationale - - This all is for the purpose of traceability. It's not enough to - have only a semaphore test project. We also need to show that we - have testpoints for all APIs and functionality, and we trace back - to documentation of the API, and functional requirements. - - The idea is that test reports show results for every sub-testcase - as passed, failed, blocked, or skipped. Reporting on only the - high-level test project level, particularly when tests do too - many things, is too vague. - -There exist two alternatives to writing tests. The first, and more verbose, -approach is to directly declare and run the test suites. -Here is a generic template for a test showing the expected use of -:c:func:`ztest_test_suite`: - -.. code-block:: C - - #include - - extern void test_sometest1(void); - extern void test_sometest2(void); - #ifndef CONFIG_WHATEVER /* Conditionally skip test_sometest3 */ - void test_sometest3(void) - { - ztest_test_skip(); - } - #else - extern void test_sometest3(void); - #endif - extern void test_sometest4(void); - ... - - void test_main(void) - { - ztest_test_suite(common, - ztest_unit_test(test_sometest1), - ztest_unit_test(test_sometest2), - ztest_unit_test(test_sometest3), - ztest_unit_test(test_sometest4) - ); - ztest_run_test_suite(common); - } - -Alternatively, it is possible to split tests across multiple files using -:c:func:`ztest_register_test_suite` which bypasses the need for ``extern``: - -.. code-block:: C - - #include - - void test_sometest1(void) { - zassert_true(1, "true"); - } - - ztest_register_test_suite(common, NULL, - ztest_unit_test(test_sometest1) - ); - -The above sample simple registers the test suite and uses a ``NULL`` pragma -function (more on that later). It is important to note that the test suite isn't -directly run in this file. Instead two alternatives exist for running the suite. -First, if to do nothing. A default ``test_main`` function is provided by -ztest. This is the preferred approach if the test doesn't involve a state and -doesn't require use of the pragma. - -In cases of an integration test it is possible that some general state needs to -be set between test suites. This can be thought of as a state diagram in which -``test_main`` simply goes through various actions that modify the board's -state and different test suites need to run. This is achieved in the following: - -.. code-block:: C - - #include - - struct state { - bool is_hibernating; - bool is_usb_connected; - } - - static bool pragma_always(const void *state) - { - return true; - } - - static bool pragma_not_hibernating_not_connected(const void *s) - { - struct state *state = s; - return !state->is_hibernating && !state->is_usb_connected; - } - - static bool pragma_usb_connected(const void *s) - { - return ((struct state *)s)->is_usb_connected; - } - - ztest_register_test_suite(baseline, pragma_always, - ztest_unit_test(test_case0)); - ztest_register_test_suite(before_usb, pragma_not_hibernating_not_connected, - ztest_unit_test(test_case1), - ztest_unit_test(test_case2)); - ztest_register_test_suite(with_usb, pragma_usb_connected,, - ztest_unit_test(test_case3), - ztest_unit_test(test_case4)); - - void test_main(void) - { - struct state state; - - /* Should run `baseline` test suite only. */ - ztest_run_registered_test_suites(&state); - - /* Simulate power on and update state. */ - emulate_power_on(); - /* Should run `baseline` and `before_usb` test suites. */ - ztest_run_registered_test_suites(&state); - - /* Simulate plugging in a USB device. */ - emulate_plugging_in_usb(); - /* Should run `baseline` and `with_usb` test suites. */ - ztest_run_registered_test_suites(&state); - - /* Verify that all the registered test suites actually ran. */ - ztest_verify_all_registered_test_suites_ran(); - } - -For *twister* to parse source files and create a list of subcases, -the declarations of :c:func:`ztest_test_suite` and -:c:func:`ztest_register_test_suite` must follow a few rules: - -- one declaration per line - -- conditional execution by using :c:func:`ztest_test_skip` - -What to avoid: - -- packing multiple testcases in one source file - - .. code-block:: C - - void test_main(void) - { - #ifdef TEST_feature1 - ztest_test_suite(feature1, - ztest_unit_test(test_1a), - ztest_unit_test(test_1b), - ztest_unit_test(test_1c) - ); - ztest_run_test_suite(feature1); - #endif - - #ifdef TEST_feature2 - ztest_test_suite(feature2, - ztest_unit_test(test_2a), - ztest_unit_test(test_2b) - ); - ztest_run_test_suite(feature2); - #endif - } - - -- Do not use ``#if`` - - .. code-block:: C - - ztest_test_suite(common, - ztest_unit_test(test_sometest1), - ztest_unit_test(test_sometest2), - #ifdef CONFIG_WHATEVER - ztest_unit_test(test_sometest3), - #endif - ztest_unit_test(test_sometest4), - ... - -- Do not add comments on lines with a call to :c:func:`ztest_unit_test`: - - .. code-block:: C - - ztest_test_suite(common, - ztest_unit_test(test_sometest1), - ztest_unit_test(test_sometest2) /* will fail */, - /* will fail! */ ztest_unit_test(test_sometest3), - ztest_unit_test(test_sometest4), - ... - -- Do not define multiple definitions of unit / user unit test case per - line - - - .. code-block:: C - - ztest_test_suite(common, - ztest_unit_test(test_sometest1), ztest_unit_test(test_sometest2), - ztest_unit_test(test_sometest3), - ztest_unit_test(test_sometest4), - ... - - -Other questions: - -- Why not pre-scan with CPP and then parse? or post scan the ELF file? - - If C pre-processing or building fails because of any issue, then we - won't be able to tell the subcases. - -- Why not declare them in the YAML testcase description? - - A separate testcase description file would be harder to maintain - than just keeping the information in the test source files - themselves -- only one file to update when changes are made - eliminates duplication. - -Mocking -******* - -These functions allow abstracting callbacks and related functions and -controlling them from specific tests. You can enable the mocking framework by -setting :kconfig:option:`CONFIG_ZTEST_MOCKING` to "y" in the configuration file of the -test. The amount of concurrent return values and expected parameters is -limited by :kconfig:option:`CONFIG_ZTEST_PARAMETER_COUNT`. - -Here is an example for configuring the function ``expect_two_parameters`` to -expect the values ``a=2`` and ``b=3``, and telling ``returns_int`` to return -``5``: - -.. literalinclude:: mocking.c - :language: c - :linenos: - -.. doxygengroup:: ztest_mock From 05ad0ae8fd725809704a85040d6b770d4275ff49 Mon Sep 17 00:00:00 2001 From: Robert Middleton Date: Sat, 28 Sep 2024 08:44:32 -0400 Subject: [PATCH 2274/4482] doc: develop: tools: Add STM32CubeIDE directions Add directions on using STM32CubeIDE for developing Zephyr. Signed-off-by: Robert Middleton --- .../tools/img/stm32cube_add_include.webp | Bin 0 -> 8326 bytes .../tools/img/stm32cube_autoconf_h.webp | Bin 0 -> 33606 bytes .../tools/img/stm32cube_new_cmake.webp | Bin 0 -> 28792 bytes .../img/stm32cube_preprocessor_include.webp | Bin 0 -> 31946 bytes .../img/stm32cube_project_properties.webp | Bin 0 -> 24494 bytes doc/develop/tools/index.rst | 1 + doc/develop/tools/stm32cubeide.rst | 110 ++++++++++++++++++ 7 files changed, 111 insertions(+) create mode 100644 doc/develop/tools/img/stm32cube_add_include.webp create mode 100644 doc/develop/tools/img/stm32cube_autoconf_h.webp create mode 100644 doc/develop/tools/img/stm32cube_new_cmake.webp create mode 100644 doc/develop/tools/img/stm32cube_preprocessor_include.webp create mode 100644 doc/develop/tools/img/stm32cube_project_properties.webp create mode 100644 doc/develop/tools/stm32cubeide.rst diff --git a/doc/develop/tools/img/stm32cube_add_include.webp b/doc/develop/tools/img/stm32cube_add_include.webp new file mode 100644 index 0000000000000000000000000000000000000000..ce48090c590981f6cc6288e811c4a4e786f73624 GIT binary patch literal 8326 zcmbVxWlS7U)9&K#6n7}D1&Xz}ySo;LQi?lEaVW*z-Q8V^7b{*|7g*d2EW3OA=DW%L z-oJN}$w{8fOeXWpN#>lsZGJZld zPcGF}CQK^viOX91+>({mwz4o1x)SPj%W3G`m}ys62BHwS&Bw_Tmg(6{K=m+l?!t3- z*`gY9t`F<7kj`+vY*~43N$)BUiURekeBbPl_ujW@JqoThJNn4DS_nSMp7-N_=c*Cb z6;IHbe(quMG~I)DZr9X!$IQ8+20N30?=`^1TULB!>S^KE6~UJW>U*rgI*d8tP zX~*=qZW^lqw&E(1ZqfgOwFBQ8cu_F7#Sc#aLWHPhEFgJ1kSXA>rDG@_aBJ_iX$KZY zJ1meidK|oP^ZIc03f^g%j<|lN&C>{m&B0L*>L)8Cyd;C}XyNk$=zAq%h1-1)AMEdi zRKJ57haBj=rP(6iwC2w9)DD%|=4nk)9JW(y33gx^&z_L3Y({!3$_?8{iIq@rid5hA z|M)}jR=xz3J9}a5Y<#?wP10P;?_?CooX-F2lkwC84>r01DHB^WOE&&6+!k^$b@B{cbJONJo{|&$;^3|)reK4U5+dSQ= zP?WQ9`7x&7Abl_0Hz%l?Gg^SrD01@uO~! z>hF|Fg0dlG=kGGl95U`YlAM3Py<9Q0zWCXi<9*bc!`#7T+`8R3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>7X@oGs`<)5CH2?GFl!H23Lg0+RE9>IV2!^&g7^;=D+ zW;%)Nm)Tn`If*ftt~qNlvKs|=;Z>Jh1rV`0i8?;UBgfdWps9&NEHlvqNJ#sEl4>3+ zNnfk#F9M%|QW)2LU{)G6-{Il>Mdox>jz9ZG{O=NR@>);IKGW>)>vsF5|HLy0Z_1^f z5tJ458lIz-`DrANrsFKzd-H=@4+$oKd(CiErja2a^)i!#(-hU?yRaZ9d2YRJtGrL> z!wy3uD}%o$gO tLvu%*IJC{}yfdSt*@xR@c14a`w|LJt?}{+8d3z?1k1`E@@BUBY{vXlcaJB#d literal 0 HcmV?d00001 diff --git a/doc/develop/tools/img/stm32cube_autoconf_h.webp b/doc/develop/tools/img/stm32cube_autoconf_h.webp new file mode 100644 index 0000000000000000000000000000000000000000..8a8f154b8d5ed30b222596ff5089703146f37b17 GIT binary patch literal 33606 zcmb@sWpL%pmL+OtX12@BTxNEenaa$}%yu0!Gc&Wx%*_+PQNrrIe+_#RUREK-9%V6n`pmX~2PifS~+6xFA4K!9j#&6(xQD-hpD1 zph(`W#uQ{qnW=+4H3G!Bhy0_Gx&Iz1ThkYyupg zOuky)N5YwuzwkeM-iVcevA)S4?$5|~z(?Sa&+4cBC)2CoX6(H{_y@&T&HM7z^_xPR z{x~27ko>j%Mfaq#X#P$-sSm@?`=S5IbobTU-SIK~8T(9pPy7b_^M(e*{(}A(`2gN* z1A!l((67r+!26yZL2p3sryqdgEAcDygX)^<`5FlP>K+5K0b@Tn6D78K7J%nKwj0Qg z>9?A9{hOY>o_jzX@b7l3|I+gYH~`Fl?RzVJ06zeq)Az(@0Q;{#U^+k@82^R-aedkI zPfhQhuh0Hp7l2P-;?2mr7!dgEVGaXZLbN$CGqB#~h2!ncB#LZzcw%_D(S^X@k(wXc z;&hWGTo~CO(0k!ZQp-yyNslz53=dwn@c*XZe3FBs7Kidf%C-0O-6jFALjU2jSqf2& zaX`sv5{5Uj-U`ayt-iCkH6g_NZJ$u+#%>QMAhI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RAhQ(u!PfZAns~%I3K*{f2;)aDFu?jtl_jMKpJL ziep*y%-VR3tnPo()SF=EORkkUg-8$D>zeQb69E{j^ABeGAMs2F3S)9+8S>Qq{)+Cs zhCuo?ycig0CV~ZC!H2D`?(U4Hq>O^{QPYnnLvthcU4VVHRV{`wcWCThifl{{SLLZU zSEk}U3AiG0O6KquRa;qT zVHd47*h!2X7*(5GPm5OCXOGug9bnw-QWr96tMv4(ZM7>{ z#cQb#HjNQbDUQoG$0^(t#`V$Ng7KmzNSjs6e8K?|mpZ-RW8H{2aYT=Scx(HCq+lr$s`BY+{yVG}AgHft` zK(KatC-4P)fKd4xHnBd5WS%zl2y{we60$Ap9g$Rr*et6Fa#($)B*m4P-qgdCP&8_7 z1yZ7nDim*TK{Kr!#ZF2wY1e}69&yjib!z@2n^U?%U=F~EpCQHJYb2hCjW;L6xF`?) zqlz#^UoBCwkl4Ucg#a)jXJ@uKqeUo40VMW39le6;o#hXwMI~yJ51yzj$ErE*r_yzV zO+(*0zQ+qwYUl^yaZeznQWit6-Z}fTSwf|_=H4$%sXO++9|$HTYw!DMzUo8A@!gAn itq=jB7RHd`#d|JtNEK!saXZesu8;HEKLwx+7ytk!cUFb~ literal 0 HcmV?d00001 diff --git a/doc/develop/tools/img/stm32cube_new_cmake.webp b/doc/develop/tools/img/stm32cube_new_cmake.webp new file mode 100644 index 0000000000000000000000000000000000000000..dd192cc1f2f75fa01c7cdbd2b8586dcb98d50d63 GIT binary patch literal 28792 zcmY&GrV0HHuz*njFQ zMX;ZJzwNyziE#7xmQ9}&Qg(YBpWhn{dToC5UTA!Lms9dM+zmot+V7Bq)oa3=zHWaJZ`!x`%Ye)8k$||b+&A#g z&9|}-#;brszp38nuW%cTLVyRr;zPjDz_d3U@aGfq*rGGPF(3=j@v-oA`2F`N4B!Xc z0(L(+kLuPSALgzEuKkbr6~DDU2#;D`zMl(_t&WZ+4uJ!yRW*x-Pr113`<^I zE-9Cq5ie>4p!cfO*f2eYuKx%s9j(ss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RumCUpd(e-H{@18Zx?G@~3`kM|DhTL%1m?1GMJX-NoUQuv zyk`V#&=c}c zO&cea?{>GPCf+TUQC|0MVXLy~j&YQZ59A-J?*0W;GS#%Simh%<;(!6KVEbBEzWec& z=Dh4MK>&~a1yXSHMVXmReC6v0074JojlXDP?`!Ys;<`e~p^=jm+%>MA1eyOsgQ5#5 z_n~53(edJNFD+dUZXs z@LW57K2>%^#x^D*u~kr`&^{GHQXsLme3#qzaBX}O@?CD=N=~^@(@lv+6w?!3KyhrE zQ{Mgs0AtXeT`pb<8=h%Zkte?+WYJufvABBx8^=u~Ql@82Ow|xwhu`tdsT#Nw-0_hf zm=VhFTm3#F(K9DS}ey4q|DL(f+E~y<=0Q#5{QVUg} z{@`@oF3*fUw{3e8=vV~dwxp@t6-e<5~3qBlfG`B3-YD z84+>S-r^r)l;&>1*9%c*={#G+moQw6r<@*o<@fZ+JXIp*?UJ)4j^JEjEVm&`#*yNQeKnD z#(_u%`glDA*nsi6`pUp2E2~s>7)!f(lJU34nlL_f0HlyDW!vL|OvK&OzLZtSW`>D| zW>u9Y5Np>qQL;Ve3iu^z-sJb}N&y5%PieGOTehi=3i?L|Yn%RRf}vUv^lxK2Y*CFB z_p7C+PIyL<`hgOPd*;eNFjwjJ?Z$WJz6j`DnHm^s0P9QL+?>ZU)-p=f=MraK?D+c3=|LM86js z3|Im@ZfvZ<-!I!us4!@`JnH+~5Nt2qvu)i=WwKy=Q+6+5Muq8AXN;@5$9J zFF66vfzwT5Of=;hN7>A4`_W2n&NI{1^pHjwgkK@3yBe2o8RkCp@kwE0mjCvMXN zWEg+-D*SH)9yT(kVbtt|!ViOZfCQ&uF^&)(yBu3 pfoa{0ykriT_h@#<=4(**3Dz82o%%vC5s#1n00097pa1{>007sv495Tf literal 0 HcmV?d00001 diff --git a/doc/develop/tools/index.rst b/doc/develop/tools/index.rst index 304a9bb811d0b..4114fdcae227a 100644 --- a/doc/develop/tools/index.rst +++ b/doc/develop/tools/index.rst @@ -8,4 +8,5 @@ Tools and IDEs clion.rst coccinelle.rst + stm32cubeide.rst vscode.rst diff --git a/doc/develop/tools/stm32cubeide.rst b/doc/develop/tools/stm32cubeide.rst new file mode 100644 index 0000000000000..73e160ee1ebe6 --- /dev/null +++ b/doc/develop/tools/stm32cubeide.rst @@ -0,0 +1,110 @@ +.. _stm32cube_ide: + +STM32CubeIDE +############ + +STM32CubeIDE_ is an Eclipse-based integrated development environment from STMicroelectronics designed for the STM32 series of MCUs and MPUs. + +This guide describes the process of setting up, building, and debugging Zephyr +applications using the IDE. + +A project must have already been created with Zephyr and west. + +These directions have been validated to work with version 1.16.0 of the IDE +on Linux. + +Project Setup +************* + +#. Before you start, make sure you have a working Zephyr development environment, as per the + instructions in the :ref:`getting_started`. + +#. Run STM32CubeIDE from your Zephyr environment. Example: + + .. code-block:: + + $ /opt/st/stm32cubeide_1.16.0/stm32cubeide + +#. Open your already existing project by going to + :menuselection:`File --> New --> STM32 CMake Project`: + + .. figure:: img/stm32cube_new_cmake.webp + :align: center + :alt: Create new CMake project + +#. Select :guilabel:`Project with existing CMake sources`, then click :guilabel:`Next`. + +#. Select :menuselection:`Next` and browse to the location of your sources. The + folder that is opened should have the ``CMakeLists.txt`` and ``prj.conf`` files. + +#. Select :menuselection:`Next` and select the appropriate MCU. + Press :guilabel:`Finish` and your project should now be available. + However, more actions must still be done in order to configure it properly. + +#. Right-click on the newly created project in the workspace, and select + :guilabel:`Properties`. + +#. Go to the :guilabel:`C/C++ Build` page and set the Generator + to ``Ninja``. In :guilabel:`Other Options`, specify the target ``BOARD`` in + CMake argument format. If an out-of-tree board is targeted, the ``BOARD_ROOT`` + option must also be set. The resulting settings page should look similar to this: + + .. figure:: img/stm32cube_project_properties.webp + :align: center + :alt: Properties dialog for project + + These options may or may not be needed depending on if you have an + out-of-tree project or not. + +#. Go to the :menuselection:`C/C++ General --> Preprocessor Include` page. + Select the :guilabel:`GNU C` language, and click on the + :menuselection:`CDT User Settings Entries` option. + + .. figure:: img/stm32cube_preprocessor_include.webp + :align: center + :alt: Properties dialog for preprocessor options + + Click :guilabel:`Add` to add an :guilabel:`Include File` + that points to Zephyr's ``autoconf.h``, which is located in + ``/zephyr/include/generated/autoconf.h``. This will ensure + that STM32CubeIDE picks up Zephyr configuration options. + The following dialog will be shown. Fill it in as follows: + + .. figure:: img/stm32cube_add_include.webp + :align: center + :alt: Add include file dialog + + Once the include file has been added, your properties page should look + similar to the following: + + .. figure:: img/stm32cube_autoconf_h.webp + :align: center + :alt: Properties page after adding autoconf.h file + +#. Click :guilabel:`Apply and Close` + +#. You may now build the project using the :guilabel:`Build` button on the toolbar. + The project can be run using the :guilabel:`Run` button, as well as debugged + using the :guilabel:`Debug` button. + +Troubleshooting +*************** + +When configuring your project you see an error that looks similar to: + +.. code-block:: + + Error message: Traceback (most recent call last): + + File "/path/to/zephyr/scripts/list_boards.py", line 11, in + import pykwalify.core + + ModuleNotFoundError: No module named 'pykwalify' + + +This means that you did not start the IDE in a Zephyr environment. You must +delete the ``config_default`` build directory and start STM32CubeIDE again, +making sure that you can run ``west`` in the shell that you start STM32CubeIDE +from. + +.. _STM32CubeIDE: https://www.st.com/en/development-tools/stm32cubeide.html From 3b16920ada57bf6b45134fba5c19521a97071447 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Mon, 11 Nov 2024 12:02:24 -0600 Subject: [PATCH 2275/4482] doc: release-notes-4.0: Add ethernet/mdio notes Add release notes for ethernet and mdio drivers for 4.0 Signed-off-by: Declan Snyder --- doc/releases/release-notes-4.0.rst | 70 ++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 0ef673d2c8b24..22f27372b07d1 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -381,9 +381,67 @@ Drivers and Sensors * Ethernet - * LiteX: Renamed the ``compatible`` from ``litex,eth0`` to :dtcompatible:`litex,liteeth`. - * STM32: Driver can now be configured to use a preemptive RX thread priority, which could be useful - in case of high network traffic load (reduces jitter). + * Added a :c:func:`get_phy` function to the ethernet driver api, which returns the phy device + associated to a network interface. + * Added 2.5G and 5G link speeds to the ethernet hardware capabilities api. + * Added check for null api pointer in :c:func:`net_eth_get_hw_capabilities`, fixing netusb crash. + * Added synopsis dwc_xgmac ethernet driver. + * Added NXP iMX NETC driver. + * Adin2111 + + * Fixed bug that resulted in double RX buffer read when generic spi protocol is used. + * Fixed essential thread termination on OA read failure. + * Skip checks for port 2 on the adin1110 since it doesn't apply, as there is no port 2. + * ENC28J60 + + * Added support for the ``zephyr,random-mac-address`` property. + * Fixed race condition between interrupt service and L2 init affecting carrier status in init. + * ENC424j600: Added ability to change mac address at runtime with net management api. + * ESP32: Added configuration of interrupts from DT. + * Lan865x + + * Enable all multicast MAC address for IPv6. All multicast mac address can now be + received and allows for correct handling of the IPv6 neighbor discovery protocol. + * Fixed transmission stopping when setting mac address or promiscuous mode. + * LiteX + + * Renamed the ``compatible`` from ``litex,eth0`` to :dtcompatible:`litex,liteeth`. + * Added support for multiple instances of the liteX ethernet driver. + * Added support for VLAN to the liteX ethernet driver. + * Added phy support. + * Native_posix + + * Implemented getting the interface name from the command line. + * Now prints error number in error message when creating an interface. + * NXP ENET_QOS: Fixed check for ``zephyr,random-mac-address`` property. + * NXP ENET: + + * Fixed fused MAC address initialization code. + * Fixed code path for handling tx errors with timestamped frames. + * Fixed network carrier status race condition during init. + * NXP S32: Added configs to enable VLAN promiscuous and untagged, and enable SI message interrupt. + * STM32 + + * Driver can now be configured to use a preemptive RX thread priority, which could be useful + in case of high network traffic load (reduces jitter). + * Added support for DT-defined mdio. + * Fixed bus error after network disconnection that happened in some cases. + * TC6: Combine read chunks into continuous net buffer. This fixes IPv6 neighbor discovery protocol + because 64 bytes was not enough for all headers. + * PHY driver changes + + * Added Qualcomm AR8031 phy driver. + * Added DP83825 phy driver. + * PHY_MII + + * Fixed generic phy_mii driver not using the value of the ``no-reset`` property from devicetree. + * Removed excess newlines from log output of phy_mii driver. + * KSZ8081 + + * Fixed reset times during init that were unnecessarily long. + * Removed unnecessary reset on every link configuration that blocked system workqueue + * Fixed issue relating to strap-in override bits. + * Flash @@ -467,6 +525,12 @@ Drivers and Sensors * MDIO + * Added litex MDIO driver. + * Added support for mdio shell to stm32 mdio. + * Added mdio driver for dwc_xgmac synopsis ethernet. + * Added NXP IMX NETC mdio driver. + * NXP ENET MDIO: Fixed inconsistent behavior by keeping the mdio interrupt enabled all the time. + * MFD * Modem From 0ab7ecf0388240fa1b7fc091fe86c49166c06958 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 11 Nov 2024 12:31:25 +0200 Subject: [PATCH 2276/4482] doc: release-notes-4.0: Add notes for Wi-Fi Added release notes for Wi-Fi. Signed-off-by: Jukka Rissanen --- doc/releases/release-notes-4.0.rst | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 22f27372b07d1..cb666e47a9abd 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -636,9 +636,31 @@ Drivers and Sensors * Wi-Fi - * Added ESP32-C2 Wi-Fi support. - * Added ESP32 driver APSTA support. + * Add Wi-Fi Easy Connect (DPP) support. + * Add support for Wi-Fi credentials library. + * Add enterprise support for station. + * Add Wi-Fi snippet support for networking samples. + * Add build testing for various Wi-Fi config combinations. + * Add regulatory domain support to Wi-Fi shell. + * Add WPS support to Wi-Fi shell. + * Add 802.11r connect command usage in Wi-Fi shell. + * Add current PHY rate to hostap status message. + * Allow user to reset Wi-Fi statistics in Wi-Fi shell. + * Display RTS threshold in Wi-Fi shell. + * Fix SSID array length size in scanning results. + * Fix the "wifi ap config" command using the STA interface instead of SAP interface. + * Fix memory leak in hostap when doing a disconnect. + * Fix setting of frequency band both in AP and STA mode in Wi-Fi shell. + * Fix correct channel scan range in Wi-Fi 6GHz. + * Fix scan results printing in Wi-Fi shell. + * Increase main and shell stack sizes for Wi-Fi shell sample. + * Increase the maximum count of connected STA to 8 in Wi-Fi shell. + * Relocate AP and STA Wi-Fi sample to samples/net/wifi directory. + * Run Wi-Fi tests together with network tests. * Updated ESP32 Wi-Fi driver to reflect actual negotiated PHY mode. + * Add ESP32-C2 Wi-Fi support. + * Add ESP32 driver APSTA support. + * Add NXP RW612 driver support. Networking ********** From 782247bc6a133ffe4ce963feeb94dae0eea33b55 Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Mon, 11 Nov 2024 23:14:24 -0600 Subject: [PATCH 2277/4482] doc: release: Add sensor notes for v4.0.0 Adds release notes for notable changes and new sensor drivers introduced since the last release. Signed-off-by: Maureen Helm --- doc/releases/release-notes-4.0.rst | 53 +++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index cb666e47a9abd..e0ed653c5bb1d 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -575,10 +575,55 @@ Drivers and Sensors * Sensors - * The existing driver for the Microchip MCP9808 temperature sensor transformed and renamed - to support all JEDEC JC 42.4 compatible temperature sensors. It now uses the - :dtcompatible:`jedec,jc-42.4-temp` compatible string instead to the ``microchip,mcp9808`` - string. + * General + + * The existing driver for the Microchip MCP9808 temperature sensor transformed and renamed to + support all JEDEC JC 42.4 compatible temperature sensors. It now uses the + :dtcompatible:`jedec,jc-42.4-temp` compatible string instead to the ``microchip,mcp9808`` + string. + * Added support for VDD based ADC reference to the NTC thermistor driver. + * Added Avago APDS9253 (:dtcompatible:`avago,apds9253`) and APDS9306 + (:dtcompatible:`avago,apds9306`) ambient light sensor drivers. + * Added gain and resolution attributes (:c:enum:`SENSOR_ATTR_GAIN` and + :c:enum:`SENSOR_ATTR_RESOLUTION`). + + * ADI + + * Add RTIO streaming support to ADXL345, ADXL362, and ADXL372 accelerometer drivers. + + * Bosch + + * Merged BMP390 into BMP388. + * Added support for power domains to BMM150 and BME680 drivers. + * Added BMP180 pressure sensor driver (:dtcompatible:`bosch,bmp180`). + + * Memsic + + * Added MMC56X3 magnetometer and temperature sensor driver (:dtcompatible:`memsic,mmc56x3`). + + * NXP + + * Added P3T1755 digital temperature sensor driver (:dtcompatible:`nxp,p3t1755`). + * Added FXLS8974 accelerometer driver (:dtcompatible:`nxp,fxls8974`). + + * ST + + * Aligned drivers to stmemsc HAL i/f v2.6. + * Added LSM9DS1 accelerometer/gyroscope/magnetometer sensor driver (:dtcompatible:`st,lsm9ds1`). + + * TDK + + * Added I2C bus support to ICM42670. + + * TI + + * Added support for INA236 to the existing INA230 driver. + * Added support for TMAG3001 to the existing TMAG5273 driver. + * Added TMP1075 temperature sensor driver (:dtcompatible:`ti,tmp1075`). + + * Vishay + + * Added trigger capability to VCNL36825T driver. * WE From 27fca4d24f22005da3ae9a642e78b4afd0c2f860 Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Mon, 11 Nov 2024 23:35:56 -0600 Subject: [PATCH 2278/4482] doc: release: Add ADI notes for v4.0.0 Adds release notes for new ADI drivers and notable changes introduced since the last release. Signed-off-by: Maureen Helm --- doc/releases/release-notes-4.0.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index e0ed653c5bb1d..5798bb5c04615 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -166,6 +166,7 @@ Boards & SoC Support versions (1.0 and 1.1) are no longer supported. * Added ESP32 WROVER-E-N16R4 variant. * STM32H5: Added support for OpenOCD through STMicroelectronics OpenOCD fork. + * MAX32: Enabled Segger RTT and SystemView support. * Added support for these boards: @@ -319,6 +320,7 @@ Drivers and Sensors * Fixed calibration scheme in ESP32-S3. * STM32H7: Added support for higher sampling frequencies thanks to boost mode implementation. * Added initial support for Renesas RA8 ADC driver (:dtcompatible:`renesas,ra-adc`) + * Added driver for Analog Devices MAX32 SoC series (:dtcompatible:`adi,max32-adc`). * Battery @@ -354,6 +356,7 @@ Drivers and Sensors * Counter * Added initial support for Renesas RA8 AGT counter driver (:dtcompatible:`renesas,ra-agt`) + * Added driver for Analog Devices MAX32 SoC series (:dtcompatible:`adi,max32-counter`). * Crypto @@ -370,6 +373,10 @@ Drivers and Sensors * Display +* DMA + + * Added driver for Analog Devices MAX32 SoC series (:dtcompatible:`adi,max32-dma`). + * EEPROM * Added support for using the EEPROM simulator with embedded C standard libraries @@ -378,6 +385,7 @@ Drivers and Sensors * Entropy * Added initial support for Renesas RA8 Entropy driver (:dtcompatible:`renesas,ra-rsip-e51a-trng`) + * Added driver for Analog Devices MAX32 SoC series (:dtcompatible:`adi,max32-trng`). * Ethernet @@ -463,6 +471,7 @@ Drivers and Sensors * Added possibility to run STM32H7 flash driver from Cortex-M4 core. * Implemented readout protection handling (RDP levels) for STM32F7 SoCs. * Added initial support for Renesas RA8 Flash controller driver (:dtcompatible:`renesas,ra-flash-hp-controller`) + * Added driver for Analog Devices MAX32 SoC series (:dtcompatible:`adi,max32-flash-controller`). * GNSS @@ -555,6 +564,7 @@ Drivers and Sensors * rpi_pico: The driver now configures the divide ratio adaptively. * Added initial support for Renesas RA8 PWM driver (:dtcompatible:`renesas,ra8-pwm`) + * Added driver for Analog Devices MAX32 SoC series (:dtcompatible:`adi,max32-pwm`). * Regulators @@ -642,6 +652,7 @@ Drivers and Sensors * SPI * Added initial support for Renesas RA8 SPI driver (:dtcompatible:`renesas,ra8-spi-b`) + * Added RTIO support to the Analog Devices MAX32 driver. * Steppers @@ -679,6 +690,8 @@ Drivers and Sensors * Watchdog + * Added driver for Analog Devices MAX32 SoC series (:dtcompatible:`adi,max32-watchdog`). + * Wi-Fi * Add Wi-Fi Easy Connect (DPP) support. From 0cbb92c2c8d26395c7aae2385b87ec331f5be50e Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Mon, 11 Nov 2024 08:27:38 -0300 Subject: [PATCH 2279/4482] boards: heltec: fix kconfig cpu entry name Minimum heap pool should be always set for the board in order to enable internal drivers/subsystems to work. It is currently not defined for APPCPU due to typo in board's Kconfig, possibly causing build failures. Fixes #81218 Signed-off-by: Sylvio Alves --- boards/heltec/heltec_wireless_stick_lite_v3/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/heltec/heltec_wireless_stick_lite_v3/Kconfig b/boards/heltec/heltec_wireless_stick_lite_v3/Kconfig index b84cf42142c87..02f8c7bdbd33a 100644 --- a/boards/heltec/heltec_wireless_stick_lite_v3/Kconfig +++ b/boards/heltec/heltec_wireless_stick_lite_v3/Kconfig @@ -4,4 +4,4 @@ config HEAP_MEM_POOL_ADD_SIZE_BOARD int default 4096 if BOARD_HELTEC_WIRELESS_STICK_LITE_V3_ESP32S3_PROCPU - default 256 if BOARD_HELTEC_WIRELESS_STICK_LITE_V3_ESP32S3_PROCPU + default 256 if BOARD_HELTEC_WIRELESS_STICK_LITE_V3_ESP32S3_APPCPU From d9ef4b7e69905a0781c9203626ab647738c9b3ef Mon Sep 17 00:00:00 2001 From: Maochen Wang Date: Mon, 11 Nov 2024 10:42:18 +0800 Subject: [PATCH 2280/4482] manifest: Update hal_nxp to fix psa_crypto_init failure The MBEDTLS_PSA_ACCEL_xxx macro means it will not enable the SW/Builtin implementation of the feature. The PSA_WANT_xxx macro means it will enable the PSA-API usage of the feature, and can use SW or HW acceleration. If enable the MBEDTLS_PSA_ACCEL_xxx macros, during psa_crypto_init, mbedtls_psa_hash_setup will failed, as the macro MBEDTLS_PSA_BUILTIN_ALG_SHA_512 is undefined. Remove the marco of MBEDTLS_PSA_ACCEL_xxx can enable maco MBEDTLS_PSA_BUILTIN_ALG_xxx, and fix the supp_psa_crypto_init fail and Wi-Fi connection failed issue. Signed-off-by: Maochen Wang --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 1d27186b2e9f4..615bc3eb44622 100644 --- a/west.yml +++ b/west.yml @@ -198,7 +198,7 @@ manifest: groups: - hal - name: hal_nxp - revision: c410b73bd00c2025b9f62bb53f99c5e8b6e45eb2 + revision: 3c64cd63125c86870802a561ce79dc33697b005c path: modules/hal/nxp groups: - hal From db9ba1865a5060f922577ed667836e0d8760703b Mon Sep 17 00:00:00 2001 From: Fabian Blatz Date: Mon, 11 Nov 2024 08:20:40 +0100 Subject: [PATCH 2281/4482] doc: release: 4.0: Add lvgl notes Add release notes section about lvgl and the added sample. Signed-off-by: Fabian Blatz --- doc/releases/release-notes-4.0.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 5798bb5c04615..f70d05b284867 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -1242,6 +1242,9 @@ Nanopb LVGL **** +* Added definition of ``LV_ATTRIBUTE_MEM_ALIGN`` so library internal data structures can be aligned + to a specific boundary. + zcbor ***** @@ -1263,6 +1266,9 @@ Tests and Samples explicitly run in native_posix now run in :ref:`native_sim` instead. native_posix as a platform remains tested though. +* Added :zephyr:code-sample:`smf_calculator` sample demonstrating the usage of the State Machine framework + in combination with LVGL to create a simple calculator application. + Issue Related Items ******************* From 81491df4acc1c5e1bb8d166bccfc5dcb6556802c Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Sun, 10 Nov 2024 22:10:23 -0800 Subject: [PATCH 2282/4482] doc: release/4.0: Crypto driver notes Add information about TinyCrypt shim driver deprecation. Signed-off-by: Flavio Ceolin --- doc/releases/release-notes-4.0.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index f70d05b284867..04d6b9d64e4b2 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -361,6 +361,7 @@ Drivers and Sensors * Crypto * Added support for STM32L4 AES. + * Deprecated the TinyCrypt shim driver ``CONFIG_CRYPTO_TINYCRYPT_SHIM``. * DAC From 35295f366378f9af89c317fce78b1b64eee0a41e Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Sun, 10 Nov 2024 14:27:55 +1000 Subject: [PATCH 2283/4482] zbus: `observervation` -> `observation` Fix a typo in the doxygen and service documentation. Signed-off-by: Jordan Yates --- doc/services/zbus/index.rst | 2 +- include/zephyr/zbus/zbus.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/services/zbus/index.rst b/doc/services/zbus/index.rst index 401fd47c70128..1cc053ce75d7d 100644 --- a/doc/services/zbus/index.rst +++ b/doc/services/zbus/index.rst @@ -92,7 +92,7 @@ The above figure illustrates some states, from (a) to (d), for channels from ``C ``Subscriber 1``, and the observations. The last two are in orange to indicate they are dynamically allocated (runtime observation). (a) shows that the observer and all observations are enabled. (b) shows the observer is disabled, so the event dispatcher will ignore it. (c) shows the observer -enabled. However, there is one static observervation disabled. The event dispatcher will only stop +enabled. However, there is one static observation disabled. The event dispatcher will only stop sending notifications from channel ``C3``. In (d), the event dispatcher will stop sending notifications from channels ``C3`` and ``C5`` to ``Subscriber 1``. diff --git a/include/zephyr/zbus/zbus.h b/include/zephyr/zbus/zbus.h index d4ff69a544b3e..e5657c0a54933 100644 --- a/include/zephyr/zbus/zbus.h +++ b/include/zephyr/zbus/zbus.h @@ -268,7 +268,7 @@ struct zbus_channel_observation { /* clang-format off */ /** - * @brief Add a static channel observervation. + * @brief Add a static channel observation. * * This macro initializes a channel observation by receiving the * channel and the observer. @@ -290,7 +290,7 @@ struct zbus_channel_observation { /* clang-format on */ /** - * @brief Add a static channel observervation. + * @brief Add a static channel observation. * * This macro initializes a channel observation by receiving the * channel and the observer. From db4dc5b450d8518d1999779117e563f25fba58df Mon Sep 17 00:00:00 2001 From: Josuah Demangeon Date: Tue, 12 Nov 2024 17:05:08 +0100 Subject: [PATCH 2284/4482] doc: releases: 4.0: Add LVGL capture sample to Video The LVGL pull request was started before v3.7 release but merged after, so needs to be included in v4.0 release notes. This was an omission in commit 467f31190e6e111edf7ee204ecd3de27c3ff9c9a. Signed-off-by: Josuah Demangeon --- doc/releases/release-notes-4.0.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 04d6b9d64e4b2..2190db9cb156b 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -678,6 +678,8 @@ Drivers and Sensors :kconfig:option:`CONFIG_VIDEO_BUFFER_USE_SHARED_MULTI_HEAP` * Introduced bindings for common video link properties in ``video-interfaces.yaml`` * Introduced missing :kconfig:option:`CONFIG_VIDEO_LOG_LEVEL` + * Added a sample for capturing video and displaying it with LVGL + (:zephyr:code-sample:`video-capture-to-lvgl`) * Added support for GalaxyCore GC2145 image sensor (:dtcompatible:`gc,gc2145`) * Added support for ESP32-S3 LCD-CAM interface (:dtcompatible:`espressif,esp32-lcd-cam`) * Added support for NXP MCUX SMARTDMA interface (:dtcompatible:`nxp,smartdma`) From d9745bd36d6753855fbe4e6691e1f81b1773ecdd Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 12 Nov 2024 12:27:34 -0600 Subject: [PATCH 2285/4482] doc: release-notes-4.0: add MIPI-DBI release notes Add release notes for MIPI-DBI capturing significant changes since 3.7 Signed-off-by: Daniel DeGrasse --- doc/releases/release-notes-4.0.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 2190db9cb156b..a696a56125e45 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -550,6 +550,11 @@ Drivers and Sensors * MIPI-DBI + * Added bitbang MIPI-DBI driver, supporting 8080 and 6800 mode + (:dtcompatible:`zephyr,mipi-dbi-bitbang`). + * Added support for STM32 FMC memory controller (:dtcompatible:`st,stm32-fmc-mipi-dbi`). + * Added support for 8080 mode to NXP LCDIC controller. + * MSPI * Pin control From 00f08ba004a8fe7767fd3c6a5a0faf14e6626a69 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 12 Nov 2024 12:21:10 -0600 Subject: [PATCH 2286/4482] doc: release-notes-4.0: add release notes for display Add release notes for displays for 4.0 release Signed-off-by: Daniel DeGrasse --- doc/releases/release-notes-4.0.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index a696a56125e45..6d6e039e8596a 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -374,6 +374,16 @@ Drivers and Sensors * Display + * NXP ELCDIF driver now supports flipping the image along the horizontal + or vertical axis using the PXP. Use + :kconfig:option:`CONFIG_MCUX_ELCDIF_PXP_FLIP_DIRECTION` to set the desired + flip. + * ST7789V driver now supports BGR565, enabled with + :kconfig:option:`CONFIG_ST7789V_BGR565`. + * Added driver for SSD1327 OLED display controller (:dtcompatible:`solomon,ssd1327fb`). + * Added driver for SSD1322 OLED display controller (:dtcompatible:`solomon,ssd1322`). + * Added driver for IST3931 monochrome display controller (:dtcompatible:`istech,ist3931`). + * DMA * Added driver for Analog Devices MAX32 SoC series (:dtcompatible:`adi,max32-dma`). From 5ef6e46010efc2ad83795fa31bd888c29642e82b Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 12 Nov 2024 11:40:41 -0600 Subject: [PATCH 2287/4482] doc: release-notes-4.0: add release notes for disk Add release notes for the disk driver subsystem Signed-off-by: Daniel DeGrasse --- doc/releases/release-notes-4.0.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 6d6e039e8596a..21ed7b7146863 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -371,6 +371,8 @@ Drivers and Sensors * STM32F7 SDMMC driver now supports usage of DMA. * STM32 mem controller driver now supports FMC for STM32H5. + * SDMMC subsystem driver will now power down the SD card when the disk is + deinitialized * Display From 4606e1cfe5bf148665c81455c31c6e3ace37d39b Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 12 Nov 2024 11:42:38 -0600 Subject: [PATCH 2288/4482] doc: release-notes-4.0: add SDHC release notes Add release notes for SD host controllers for 4.0 Signed-off-by: Daniel DeGrasse --- doc/releases/release-notes-4.0.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 21ed7b7146863..3e48c9198cfb0 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -600,6 +600,7 @@ Drivers and Sensors * SDHC * Added ESP32-S3 driver support. + * SPI SDHC driver now handles SPI devices with runtime PM support correctly * Sensors From 37c9cf22cec3a57aa55e93f8ca84614bb4509d3f Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 12 Nov 2024 11:56:24 -0600 Subject: [PATCH 2289/4482] doc: release-notes-4.0: add release notes for SD subsystem No significant changes have been made to the SD subsystem since 3.7. Add a note documenting this for the 4.0 release. Signed-off-by: Daniel DeGrasse --- doc/releases/release-notes-4.0.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 3e48c9198cfb0..58f086df01aa0 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -1088,6 +1088,8 @@ Libraries / Subsystems * SD + * No significant changes in this release + * Settings * Settings has been extended to allow prioritizing the commit handlers using From 092fd18d5b87c7ca59082d0a927c8e656955c687 Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Mon, 11 Nov 2024 14:05:28 +0100 Subject: [PATCH 2290/4482] doc: release-notes-4.0: Add Silabs notes Add noteworthy additions for Silabs socs, boards and drivers. Signed-off-by: Aksel Skauge Mellbye --- doc/releases/release-notes-4.0.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 58f086df01aa0..9ea2358a893b9 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -167,6 +167,9 @@ Boards & SoC Support * Added ESP32 WROVER-E-N16R4 variant. * STM32H5: Added support for OpenOCD through STMicroelectronics OpenOCD fork. * MAX32: Enabled Segger RTT and SystemView support. + * Silabs Series 2: Use oscillator, clock and DCDC configuration from device tree during init. + * Silabs Series 2: Added initialization for SMU (Security Management Unit). + * Silabs Series 2: Use sleeptimer as the default OS timer instead of systick. * Added support for these boards: @@ -344,6 +347,7 @@ Drivers and Sensors :dtcompatible:`renesas,ra-cgc-pclk-block`, :dtcompatible:`renesas,ra-cgc-pll`, :dtcompatible:`renesas,ra-cgc-external-clock`, :dtcompatible:`renesas,ra-cgc-subclk`, :dtcompatible:`renesas,ra-cgc-pll-out`) + * Silabs: Added support for Series 2+ Clock Management Unit (see :dtcompatible:`silabs,series-clock`) * Comparator @@ -672,6 +676,7 @@ Drivers and Sensors * Added initial support for Renesas RA8 SPI driver (:dtcompatible:`renesas,ra8-spi-b`) * Added RTIO support to the Analog Devices MAX32 driver. + * Silabs: Added support for EUSART (:dtcompatible:`silabs,gecko-spi-eusart`) * Steppers @@ -684,6 +689,10 @@ Drivers and Sensors * Added stepper api test-suite * Added stepper shell test-suite +* Timer + + * Silabs: Added support for Sleeptimer (:dtcompatible:`silabs,gecko-stimer`) + * USB * Added support for USB HS on STM32U59x/STM32U5Ax SoC variants. @@ -1194,6 +1203,10 @@ HALs * Synced HAL to version v5.1.4 to update SoCs low level files, RF libraries and overall driver support. +* Silabs + + * Updated Series 2 to Simplicity SDK 2024.6, while Series 0/1 continue to use Gecko SDK 4.4. + MCUboot ******* From 88fb090b7f157842d673fd03bcfc7564406d90e3 Mon Sep 17 00:00:00 2001 From: Ryan McClelland Date: Mon, 11 Nov 2024 23:20:30 -0800 Subject: [PATCH 2291/4482] doc: release: add release notes for I3C for v4.0.0 add release notes for I3C for zephyr v4.0.0 Signed-off-by: Ryan McClelland --- doc/releases/release-notes-4.0.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 9ea2358a893b9..fbd2562db09d5 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -509,6 +509,24 @@ Drivers and Sensors * I3C + * Added support for SETAASA optmization during initialization. Added a + ``supports-setaasa`` property to ``i3c-devices.yaml``. + * Added sending DEFTGTS if any devices that support functioning as a secondary + controller on the bus. + * Added retrieving GETMXDS within :c:func:`i3c_device_basic_info_get` if BCR mxds + bit is set. + * Added helper functions for sending CCCs for ENTTM, VENDOR, DEFTGTS, SETAASA, + GETMXDS, SETBUSCON, RSTACT DC, ENTAS0, ENTAS1, ENTAS2, and ENTAS3. + * Added shell commands for sending CCCs for ENTTM, VENDOR, DEFTGTS, SETAASA, + GETMXDS, SETBUSCON, RSTACT DC, ENTAS0, ENTAS1, ENTAS2, and ENTAS3. + * Added shell commands for setting the I3C speed, sending HDR-DDR, raising IBIs, + enabling IBIs, disabling IBIs, and scanning I2C addresses. + * :c:func:`i3c_ccc_do_setdasa` has been modified to now require specifying the assigned + dynamic address rather than having the dynamic address be determined within the function. + * :c:func:`i3c_determine_default_addr` has been removed + * ``attach_i3c_device`` now no longer requires the attached address as an argument. It is now + up to the driver to determine the attached address from the ``i3c_device_desc``. + * Input * New feature: :dtcompatible:`zephyr,input-double-tap`. From a66c070598aff89d29e0c1feb479c72870816a77 Mon Sep 17 00:00:00 2001 From: Ioannis Karachalios Date: Sun, 10 Nov 2024 22:37:03 +0200 Subject: [PATCH 2292/4482] drivers: counter: Fix unbalanced policy state lock This commit should deal with fixing unbalanced policy state locks. When PM and PM_DEVICE are declared, default state, policy locks should be given only when active. Signed-off-by: Ioannis Karachalios --- drivers/counter/counter_smartbond_timer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/counter/counter_smartbond_timer.c b/drivers/counter/counter_smartbond_timer.c index 8ee8f006dae6a..1869c3e6911e6 100644 --- a/drivers/counter/counter_smartbond_timer.c +++ b/drivers/counter/counter_smartbond_timer.c @@ -68,7 +68,9 @@ static void counter_smartbond_pm_policy_state_lock_get(const struct device *dev) static void counter_smartbond_pm_policy_state_lock_put(const struct device *dev) { pm_device_runtime_put(dev); - pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES); + if (pm_policy_state_lock_is_active(PM_STATE_STANDBY, PM_ALL_SUBSTATES)) { + pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES); + } } /* From 135214d844c0033ae02686ed645eb8906e8a701d Mon Sep 17 00:00:00 2001 From: Ioannis Damigos Date: Thu, 7 Nov 2024 17:24:28 +0200 Subject: [PATCH 2293/4482] driver/dma_smartbond: Fix driver initialization when PM_DEVICE is set Fix DMA driver initialization when PM_DEVICE is set. Don't put PM policy state lock if it is not active. Signed-off-by: Ioannis Damigos --- drivers/dma/dma_smartbond.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/dma/dma_smartbond.c b/drivers/dma/dma_smartbond.c index a360933dd862b..ced9580dbfe5c 100644 --- a/drivers/dma/dma_smartbond.c +++ b/drivers/dma/dma_smartbond.c @@ -188,7 +188,9 @@ static inline void dma_smartbond_pm_policy_state_lock_get(void) static inline void dma_smartbond_pm_policy_state_lock_put(void) { #if defined(CONFIG_PM_DEVICE) - pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES); + if (pm_policy_state_lock_is_active(PM_STATE_STANDBY, PM_ALL_SUBSTATES)) { + pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES); + } #endif } From b1f42f2e71340fe5f68a04a3c3830d607d435d9b Mon Sep 17 00:00:00 2001 From: Jeremy Bettis Date: Tue, 22 Oct 2024 13:30:42 -0600 Subject: [PATCH 2294/4482] drivers: Fix uninitialized variable warning. In GCC 14.2.0, the keyvariable in usb_dc_ep_write is detected to be used before initialization, even though this usage should be safe. Fix by initializing the key variable to 0, and making the 2 if statements explicitly checking the same value. Signed-off-by: Jeremy Bettis --- drivers/usb/device/usb_dc_it82xx2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/device/usb_dc_it82xx2.c b/drivers/usb/device/usb_dc_it82xx2.c index 3270860256d50..ee69712026e63 100644 --- a/drivers/usb/device/usb_dc_it82xx2.c +++ b/drivers/usb/device/usb_dc_it82xx2.c @@ -1322,7 +1322,7 @@ int usb_dc_ep_write(uint8_t ep, const uint8_t *buf, { struct usb_it82xx2_regs *const usb_regs = it82xx2_get_usb_regs(); struct it82xx2_usb_ep_fifo_regs *ff_regs = usb_regs->fifo_regs; - unsigned int key; + unsigned int key = 0; uint8_t ep_idx = USB_EP_GET_IDX(ep); uint8_t ep_fifo = (ep_idx > 0) ? (ep_fifo_res[ep_idx % FIFO_NUM]) : 0; @@ -1369,7 +1369,7 @@ int usb_dc_ep_write(uint8_t ep, const uint8_t *buf, } it82xx2_usb_set_ep_ctrl(ep_idx, EP_READY_ENABLE, true); - if (ep_idx != 0) { + if (ep_idx != EP0) { irq_unlock(key); } From c394a27d77b13dca93c04e9fae9ec9c07a17ebb2 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 7 Nov 2024 17:15:38 -0500 Subject: [PATCH 2295/4482] twister: count filtered testcases as such, not as skipped When a suite is filtered, its testcases are also filtered and not skipped. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/runner.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index 201a869a82a9f..55bf2daa2350f 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -877,8 +877,8 @@ def process(self, pipeline, done, message, lock, results): logger.debug("filtering %s" % self.instance.name) self.instance.status = TwisterStatus.FILTER self.instance.reason = "runtime filter" - results.skipped_runtime_increment() - self.instance.add_missing_case_status(TwisterStatus.SKIP) + results.filtered_cases_increment() + self.instance.add_missing_case_status(TwisterStatus.FILTER) next_op = 'report' else: next_op = 'cmake' @@ -911,7 +911,7 @@ def process(self, pipeline, done, message, lock, results): self.instance.status = TwisterStatus.FILTER self.instance.reason = "runtime filter" results.skipped_runtime_increment() - self.instance.add_missing_case_status(TwisterStatus.SKIP) + self.instance.add_missing_case_status(TwisterStatus.FILTER) next_op = 'report' else: next_op = 'build' From 81af36202bd0031c7c0aa7b5934e12ec1132bf0e Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 7 Nov 2024 17:18:27 -0500 Subject: [PATCH 2296/4482] twister: use consistent language for test configurations In the summary, use "configurations" instead of instances. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/runner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index 55bf2daa2350f..e9529604b3ff9 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -1696,7 +1696,7 @@ def update_counting_before_pipeline(self): self.results.error_increment() def show_brief(self): - logger.info("%d test scenarios (%d test instances) selected, " + logger.info("%d test scenarios (%d configurations) selected, " "%d configurations filtered (%d by static filter, %d at runtime)." % (len(self.suites), len(self.instances), self.results.skipped_configs, From 64f950420af2b9434510687e2e28c6a800e55103 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 7 Nov 2024 17:28:24 -0500 Subject: [PATCH 2297/4482] twister: do not report filtered cases in summary It is confusing to report filtered testcases as testcases that were selected but not exexuted. If they are filtered, then there should not be considered as selected. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/reports.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/reports.py b/scripts/pylib/twister/twisterlib/reports.py index a1dbe68b5a790..de0ae1f9b346a 100644 --- a/scripts/pylib/twister/twisterlib/reports.py +++ b/scripts/pylib/twister/twisterlib/reports.py @@ -615,12 +615,11 @@ def summary(self, results, ignore_unrecognized_sections, duration): f'{", " + str(results.none_cases) + " without a status" if results.none_cases else ""}' f' on {len(self.filtered_platforms)} out of total {total_platforms} platforms ({platform_rate:02.2f}%).' ) - if results.skipped_cases or results.filtered_cases or results.notrun_cases: + if results.skipped_cases or results.notrun_cases: logger.info( - f'{results.skipped_cases + results.filtered_cases} selected test cases not executed:' \ + f'{results.skipped_cases} selected test cases not executed:' \ f'{" " + str(results.skipped_cases) + " skipped" if results.skipped_cases else ""}' \ - f'{(", " if results.skipped_cases else " ") + str(results.filtered_cases) + " filtered" if results.filtered_cases else ""}' \ - f'{(", " if results.skipped_cases or results.filtered_cases else " ") + str(results.notrun_cases) + " not run (built only)" if results.notrun_cases else ""}' \ + f'{(", " if results.skipped_cases else " ") + str(results.notrun_cases) + " not run (built only)" if results.notrun_cases else ""}' \ f'.' ) From 11447e4463c774b04c67ea5d6b66ce34cc246a45 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 7 Nov 2024 18:46:24 -0500 Subject: [PATCH 2298/4482] twister: stats: not run tests are also part not executed summary Add notrun tests to the count of non-executed tests. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/reports.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pylib/twister/twisterlib/reports.py b/scripts/pylib/twister/twisterlib/reports.py index de0ae1f9b346a..670d8d2e8ea8d 100644 --- a/scripts/pylib/twister/twisterlib/reports.py +++ b/scripts/pylib/twister/twisterlib/reports.py @@ -617,7 +617,7 @@ def summary(self, results, ignore_unrecognized_sections, duration): ) if results.skipped_cases or results.notrun_cases: logger.info( - f'{results.skipped_cases} selected test cases not executed:' \ + f'{results.skipped_cases + results.notrun_cases} selected test cases not executed:' \ f'{" " + str(results.skipped_cases) + " skipped" if results.skipped_cases else ""}' \ f'{(", " if results.skipped_cases else " ") + str(results.notrun_cases) + " not run (built only)" if results.notrun_cases else ""}' \ f'.' From 5ad5b95fde46ceb56c0487e21b762fb112c35e00 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Wed, 30 Oct 2024 08:46:12 -0400 Subject: [PATCH 2299/4482] twister: remove verbose debug message about adding platforms This is very verbose and very long sometimes getting the way when trying to debug a problem. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/testplan.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/pylib/twister/twisterlib/testplan.py b/scripts/pylib/twister/twisterlib/testplan.py index 4a9f4cb86e5f8..da8eaa0a74908 100755 --- a/scripts/pylib/twister/twisterlib/testplan.py +++ b/scripts/pylib/twister/twisterlib/testplan.py @@ -439,7 +439,6 @@ def init_and_add_platforms(data, board, target, qualifier, aliases): raise Exception(f"Duplicate platform identifier {platform.name} found") if not platform.twister: return - logger.debug(f"Adding platform {platform.name} with aliases {platform.aliases}") self.platforms.append(platform) for board in known_boards.values(): From 950dccc5bb962138fae3693f2c508e83807d6eaf Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 8 Nov 2024 07:25:44 -0500 Subject: [PATCH 2300/4482] twister: status inconsistencies are now warnings Do not report status issues as errors, very confusing and developer end up looking at the wrong thing, instead, treat those as warnings and count them and report them at the end. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/reports.py | 2 +- scripts/pylib/twister/twisterlib/runner.py | 24 ++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/reports.py b/scripts/pylib/twister/twisterlib/reports.py index 670d8d2e8ea8d..a0ea7defe79c7 100644 --- a/scripts/pylib/twister/twisterlib/reports.py +++ b/scripts/pylib/twister/twisterlib/reports.py @@ -596,7 +596,7 @@ def summary(self, results, ignore_unrecognized_sections, duration): f" {f'{TwisterStatus.get_color(TwisterStatus.NOTRUN)}{results.notrun}{Fore.RESET}' if results.notrun else f'{results.notrun}'} built (not run)," f" {f'{TwisterStatus.get_color(TwisterStatus.FAIL)}{results.failed}{Fore.RESET}' if results.failed else f'{results.failed}'} failed," f" {f'{TwisterStatus.get_color(TwisterStatus.ERROR)}{results.error}{Fore.RESET}' if results.error else f'{results.error}'} errored," - f" with {f'{Fore.YELLOW}{self.plan.warnings}{Fore.RESET}' if self.plan.warnings else 'no'} warnings" + f" with {f'{Fore.YELLOW}{self.plan.warnings + results.warnings}{Fore.RESET}' if (self.plan.warnings + results.warnings) else 'no'} warnings" f" in {duration:.2f} seconds." ) diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index e9529604b3ff9..8f8ecc7e9c2a8 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -129,6 +129,7 @@ def __init__(self, total=0): self._none_cases = Value('i', 0) self._started_cases = Value('i', 0) + self._warnings = Value('i', 0) self.lock = Lock() @@ -186,6 +187,20 @@ def summary(self): print(f" └─ {'Test cases only started: ':<25}{self.started_cases:>{executed_cases_n_length}}") print("--------------------------------------------------") + @property + def warnings(self): + with self._warnings.get_lock(): + return self._warnings.value + + @warnings.setter + def warnings(self, value): + with self._warnings.get_lock(): + self._warnings.value = value + + def warnings_increment(self, value=1): + with self._warnings.get_lock(): + self._warnings.value += value + @property def cases(self): with self._cases.get_lock(): @@ -1324,15 +1339,18 @@ def _add_instance_testcases_to_status_counts(instance, results, decrement=False) # but having those statuses in this part of processing is an error. case TwisterStatus.NONE: results.none_cases_increment(increment_value) - logger.error(f'A None status detected in instance {instance.name},' + logger.warning(f'A None status detected in instance {instance.name},' f' test case {tc.name}.') + results.warnings_increment(1) case TwisterStatus.STARTED: results.started_cases_increment(increment_value) - logger.error(f'A started status detected in instance {instance.name},' + logger.warning(f'A started status detected in instance {instance.name},' f' test case {tc.name}.') + results.warnings_increment(1) case _: - logger.error(f'An unknown status "{tc.status}" detected in instance {instance.name},' + logger.warning(f'An unknown status "{tc.status}" detected in instance {instance.name},' f' test case {tc.name}.') + results.warnings_increment(1) def report_out(self, results): From 7e23b35c330e94f9a1ea0de94646371b33ce085e Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 8 Nov 2024 10:19:26 -0500 Subject: [PATCH 2301/4482] twister: stats: 'Executed test cases' -> 'Completed test cases' Built tests are not executed, change column title. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/runner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index 8f8ecc7e9c2a8..4eabdcd7efaff 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -173,7 +173,7 @@ def summary(self): print(f"{'Total test cases: ':<18}{self.cases}") print(f"├─ {'Filtered test cases: ':<21}{self.filtered_cases:>{total_cases_n_length}}") print(f"├─ {'Skipped test cases: ':<21}{self.skipped_cases:>{total_cases_n_length}}") - print(f"└─ {'Executed test cases: ':<21}{executed_cases:>{total_cases_n_length}}") + print(f"└─ {'Selected test cases: ':<21}{executed_cases:>{total_cases_n_length}}") print(f" ├─ {'Passed test cases: ':<25}{self.passed_cases:>{executed_cases_n_length}}") print(f" ├─ {'Built only test cases: ':<25}{self.notrun_cases:>{executed_cases_n_length}}") print(f" ├─ {'Blocked test cases: ':<25}{self.blocked_cases:>{executed_cases_n_length}}") From eddb0b77a3b6d81f0ba892952cd0b114d2a7b908 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Sat, 9 Nov 2024 05:51:40 -0500 Subject: [PATCH 2302/4482] twisters: tests: adapt twister testsuite Adapt tests for new changes in twister. Signed-off-by: Anas Nashif --- scripts/tests/twister/test_runner.py | 10 +++++----- scripts/tests/twister_blackbox/test_platform.py | 6 +++--- scripts/tests/twister_blackbox/test_runner.py | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index b6cd151d78ad0..172c8dcc10058 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -224,7 +224,7 @@ def test_executioncounter(capfd): 'Total test cases: 25\n' '├─ Filtered test cases: 0\n' '├─ Skipped test cases: 6\n' - '└─ Executed test cases: 19\n' + '└─ Selected test cases: 19\n' ' ├─ Passed test cases: 0\n' ' ├─ Built only test cases: 0\n' ' ├─ Blocked test cases: 0\n' @@ -914,8 +914,8 @@ def mock_getsize(filename, *args, **kwargs): {'op': 'report', 'test': mock.ANY}, TwisterStatus.FILTER, 'runtime filter', - 1, - (TwisterStatus.SKIP,) + 0, + (TwisterStatus.FILTER,) ), ( {'op': 'filter'}, @@ -1025,7 +1025,7 @@ def mock_getsize(filename, *args, **kwargs): TwisterStatus.FILTER, 'runtime filter', 1, - (TwisterStatus.SKIP,) + (TwisterStatus.FILTER,) # this is a tuple ), ( {'op': 'cmake'}, @@ -2627,7 +2627,7 @@ def test_twisterrunner_show_brief(caplog): tr.show_brief() - log = '2 test scenarios (5 test instances) selected,' \ + log = '2 test scenarios (5 configurations) selected,' \ ' 4 configurations filtered (3 by static filter, 1 at runtime).' assert log in caplog.text diff --git a/scripts/tests/twister_blackbox/test_platform.py b/scripts/tests/twister_blackbox/test_platform.py index 75a6cda909309..43ff3346cf8af 100644 --- a/scripts/tests/twister_blackbox/test_platform.py +++ b/scripts/tests/twister_blackbox/test_platform.py @@ -37,7 +37,7 @@ class TestPlatform: 'failed_configurations': 0, 'errored_configurations': 0, 'executed_test_cases': 8, - 'skipped_test_cases': 5, + 'skipped_test_cases': 2, 'platform_count': 3, 'executed_on_platform': 4, 'only_built': 2 @@ -58,7 +58,7 @@ class TestPlatform: 'failed_configurations': 0, 'errored_configurations': 0, 'executed_test_cases': 0, - 'skipped_test_cases': 3, + 'skipped_test_cases': 0, 'platform_count': 3, 'executed_on_platform': 0, 'only_built': 0 @@ -264,7 +264,7 @@ def test_emulation_only(self, capfd, out_path, test_path, test_platforms, expect self.loader.exec_module(self.twister_module) select_regex = r'^INFO - (?P[0-9]+) test scenarios' \ - r' \((?P[0-9]+) test instances\) selected,' \ + r' \((?P[0-9]+) configurations\) selected,' \ r' (?P[0-9]+) configurations filtered' \ r' \((?P[0-9]+) by static filter,' \ r' (?P[0-9]+) at runtime\)\.$' diff --git a/scripts/tests/twister_blackbox/test_runner.py b/scripts/tests/twister_blackbox/test_runner.py index 0ace7fb05157b..1ab50522c5ebf 100644 --- a/scripts/tests/twister_blackbox/test_runner.py +++ b/scripts/tests/twister_blackbox/test_runner.py @@ -260,7 +260,7 @@ def test_runtest_only(self, capfd, out_path, test_path, test_platforms, expected select_regex = r'^INFO - (?P[0-9]+) test scenarios' \ - r' \((?P[0-9]+) test instances\) selected,' \ + r' \((?P[0-9]+) configurations\) selected,' \ r' (?P[0-9]+) configurations filtered' \ r' \((?P[0-9]+) by static filter,' \ r' (?P[0-9]+) at runtime\)\.$' @@ -627,7 +627,7 @@ def test_only_failed(self, capfd, out_path, test_path, test_platforms, expected) self.loader.exec_module(self.twister_module) select_regex = r'^INFO - (?P[0-9]+) test scenarios' \ - r' \((?P[0-9]+) test instances\) selected,' \ + r' \((?P[0-9]+) configurations\) selected,' \ r' (?P[0-9]+) configurations filtered' \ r' \((?P[0-9]+) by static filter,' \ r' (?P[0-9]+) at runtime\)\.$' From 1647b46a07dd79f3bcd589e0b22054d37ad4c5e6 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Sat, 9 Nov 2024 18:46:50 +0000 Subject: [PATCH 2303/4482] twister: stats: remove double counting of statuses We have been double counting some statuses, remove to get the stats right. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/runner.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index 4eabdcd7efaff..755d011d05aa6 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -892,7 +892,6 @@ def process(self, pipeline, done, message, lock, results): logger.debug("filtering %s" % self.instance.name) self.instance.status = TwisterStatus.FILTER self.instance.reason = "runtime filter" - results.filtered_cases_increment() self.instance.add_missing_case_status(TwisterStatus.FILTER) next_op = 'report' else: @@ -1387,15 +1386,8 @@ def report_out(self, results): results.skipped_configs_increment() elif instance.status == TwisterStatus.PASS: results.passed_increment() - for case in instance.testcases: - # test cases skipped at the test case level - if case.status == TwisterStatus.SKIP: - results.skipped_cases_increment() elif instance.status == TwisterStatus.NOTRUN: results.notrun_increment() - for case in instance.testcases: - if case.status == TwisterStatus.SKIP: - results.skipped_cases_increment() else: logger.debug(f"Unknown status = {instance.status}") status = Fore.YELLOW + "UNKNOWN" + Fore.RESET From 61aefee3ad8c86c83e21392f848316027c8e2b1d Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Sun, 10 Nov 2024 11:30:23 +0000 Subject: [PATCH 2304/4482] twister: stats: skipped testcases are part of selected group Count skipped cases as part of selected group in stats. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/runner.py | 22 +++++++++++----------- scripts/tests/twister/test_runner.py | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index 755d011d05aa6..ce2d9b7560292 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -144,7 +144,7 @@ def _find_number_length(n): return length def summary(self): - executed_cases = self.cases - self.skipped_cases - self.filtered_cases + selected_cases = self.cases - self.filtered_cases completed_configs = self.done - self.skipped_filter # Find alignment length for aesthetic printing @@ -153,7 +153,7 @@ def summary(self): completed_suites_n_length = self._find_number_length(completed_configs) skipped_suites_n_length = self._find_number_length(self.skipped_configs) total_cases_n_length = self._find_number_length(self.cases) - executed_cases_n_length = self._find_number_length(executed_cases) + selected_cases_n_length = self._find_number_length(selected_cases) print("--------------------------------------------------") print(f"{'Total test suites: ':<23}{self.total:>{suites_n_length}}") # actually test instances @@ -172,19 +172,19 @@ def summary(self): print("---------------------- ----------------------") print(f"{'Total test cases: ':<18}{self.cases}") print(f"├─ {'Filtered test cases: ':<21}{self.filtered_cases:>{total_cases_n_length}}") - print(f"├─ {'Skipped test cases: ':<21}{self.skipped_cases:>{total_cases_n_length}}") - print(f"└─ {'Selected test cases: ':<21}{executed_cases:>{total_cases_n_length}}") - print(f" ├─ {'Passed test cases: ':<25}{self.passed_cases:>{executed_cases_n_length}}") - print(f" ├─ {'Built only test cases: ':<25}{self.notrun_cases:>{executed_cases_n_length}}") - print(f" ├─ {'Blocked test cases: ':<25}{self.blocked_cases:>{executed_cases_n_length}}") - print(f" ├─ {'Failed test cases: ':<25}{self.failed_cases:>{executed_cases_n_length}}") - print(f" {'├' if self.none_cases or self.started_cases else '└'}─ {'Errors in test cases: ':<25}{self.error_cases:>{executed_cases_n_length}}") + print(f"└─ {'Selected test cases: ':<21}{selected_cases:>{total_cases_n_length}}") + print(f" ├─ {'Passed test cases: ':<25}{self.passed_cases:>{selected_cases_n_length}}") + print(f" ├─ {'Skipped test cases: ':<25}{self.skipped_cases:>{total_cases_n_length}}") + print(f" ├─ {'Built only test cases: ':<25}{self.notrun_cases:>{selected_cases_n_length}}") + print(f" ├─ {'Blocked test cases: ':<25}{self.blocked_cases:>{selected_cases_n_length}}") + print(f" ├─ {'Failed test cases: ':<25}{self.failed_cases:>{selected_cases_n_length}}") + print(f" {'├' if self.none_cases or self.started_cases else '└'}─ {'Errors in test cases: ':<25}{self.error_cases:>{selected_cases_n_length}}") if self.none_cases or self.started_cases: print(f" ├──── The following test case statuses should not appear in a proper execution ───") if self.none_cases: - print(f" {'├' if self.started_cases else '└'}─ {'Statusless test cases: ':<25}{self.none_cases:>{executed_cases_n_length}}") + print(f" {'├' if self.started_cases else '└'}─ {'Statusless test cases: ':<25}{self.none_cases:>{selected_cases_n_length}}") if self.started_cases: - print(f" └─ {'Test cases only started: ':<25}{self.started_cases:>{executed_cases_n_length}}") + print(f" └─ {'Test cases only started: ':<25}{self.started_cases:>{selected_cases_n_length}}") print("--------------------------------------------------") @property diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index 172c8dcc10058..532fca5e37aaf 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -223,9 +223,9 @@ def test_executioncounter(capfd): '---------------------- ----------------------\n' 'Total test cases: 25\n' '├─ Filtered test cases: 0\n' - '├─ Skipped test cases: 6\n' - '└─ Selected test cases: 19\n' + '└─ Selected test cases: 25\n' ' ├─ Passed test cases: 0\n' + ' ├─ Skipped test cases: 6\n' ' ├─ Built only test cases: 0\n' ' ├─ Blocked test cases: 0\n' ' ├─ Failed test cases: 0\n' From d69d14aac61d72c3cb98dbf332118d582cf5b4e5 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 11 Nov 2024 15:55:18 +0000 Subject: [PATCH 2305/4482] twister: stats: skipped_configs -> filtered_configs Rename variables leading to confusion between skipped and filtered suites. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/reports.py | 8 ++-- scripts/pylib/twister/twisterlib/runner.py | 50 ++++++++++----------- scripts/tests/twister/test_runner.py | 24 +++++----- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/reports.py b/scripts/pylib/twister/twisterlib/reports.py index a0ea7defe79c7..c0f06fc514288 100644 --- a/scripts/pylib/twister/twisterlib/reports.py +++ b/scripts/pylib/twister/twisterlib/reports.py @@ -584,14 +584,14 @@ def summary(self, results, ignore_unrecognized_sections, duration): if float(handler_time) > 0: run += 1 - if results.total and results.total != results.skipped_configs: - pass_rate = (float(results.passed) / float(results.total - results.skipped_configs)) + if results.total and results.total != results.filtered_configs: + pass_rate = (float(results.passed) / float(results.total - results.filtered_configs)) else: pass_rate = 0 logger.info( f"{TwisterStatus.get_color(TwisterStatus.FAIL) if failed else TwisterStatus.get_color(TwisterStatus.PASS)}{results.passed}" - f" of {results.total - results.skipped_configs}{Fore.RESET}" + f" of {results.total - results.filtered_configs}{Fore.RESET}" f" executed test configurations passed ({pass_rate:.2%})," f" {f'{TwisterStatus.get_color(TwisterStatus.NOTRUN)}{results.notrun}{Fore.RESET}' if results.notrun else f'{results.notrun}'} built (not run)," f" {f'{TwisterStatus.get_color(TwisterStatus.FAIL)}{results.failed}{Fore.RESET}' if results.failed else f'{results.failed}'} failed," @@ -623,7 +623,7 @@ def summary(self, results, ignore_unrecognized_sections, duration): f'.' ) - built_only = results.total - run - results.skipped_configs + built_only = results.total - run - results.filtered_configs logger.info(f"{Fore.GREEN}{run}{Fore.RESET} test configurations executed on platforms, \ {TwisterStatus.get_color(TwisterStatus.NOTRUN)}{built_only}{Fore.RESET} test configurations were only built.") diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index ce2d9b7560292..7b920c49dbb6a 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -67,11 +67,11 @@ def __init__(self, total=0): total = yaml test scenarios * applicable platforms done := instances that reached report_out stage of the pipeline - done = skipped_configs + passed + failed + error + done = filtered_configs + passed + failed + error completed = done - skipped_filter - skipped_configs = skipped_runtime + skipped_filter + filtered_configs = skipped_runtime + skipped_filter - pass rate = passed / (total - skipped_configs) + pass rate = passed / (total - filtered_configs) case pass rate = passed_cases / (cases - filtered_cases - skipped_cases) ''' # instances that go through the pipeline @@ -91,7 +91,7 @@ def __init__(self, total=0): # static filter + runtime filter + build skipped # updated by update_counting_before_pipeline() and report_out() - self._skipped_configs = Value('i', 0) + self._filtered_configs = Value('i', 0) # cmake filter + build skipped # updated by report_out() @@ -151,7 +151,7 @@ def summary(self): suites_n_length = self._find_number_length(self.total if self.total > self.done else self.done) processed_suites_n_length = self._find_number_length(self.done) completed_suites_n_length = self._find_number_length(completed_configs) - skipped_suites_n_length = self._find_number_length(self.skipped_configs) + skipped_suites_n_length = self._find_number_length(self.filtered_configs) total_cases_n_length = self._find_number_length(self.cases) selected_cases_n_length = self._find_number_length(selected_cases) @@ -159,14 +159,14 @@ def summary(self): print(f"{'Total test suites: ':<23}{self.total:>{suites_n_length}}") # actually test instances print(f"{'Processed test suites: ':<23}{self.done:>{suites_n_length}}") print(f"├─ {'Filtered test suites (static): ':<37}{self.skipped_filter:>{processed_suites_n_length}}") - print(f"└─ {'Completed test suites: ':<37}{completed_configs:>{processed_suites_n_length}}") - print(f" ├─ {'Filtered test suites (at runtime): ':<37}{self.skipped_runtime:>{completed_suites_n_length}}") + print(f"└─ {'Selected test suites: ':<37}{completed_configs:>{processed_suites_n_length}}") + print(f" ├─ {'Skipped test suites: ':<37}{self.skipped_runtime:>{completed_suites_n_length}}") print(f" ├─ {'Passed test suites: ':<37}{self.passed:>{completed_suites_n_length}}") print(f" ├─ {'Built only test suites: ':<37}{self.notrun:>{completed_suites_n_length}}") print(f" ├─ {'Failed test suites: ':<37}{self.failed:>{completed_suites_n_length}}") print(f" └─ {'Errors in test suites: ':<37}{self.error:>{completed_suites_n_length}}") print(f"") - print(f"{'Filtered test suites: ':<21}{self.skipped_configs}") + print(f"{'Filtered test suites: ':<21}{self.filtered_configs}") print(f"├─ {'Filtered test suites (static): ':<37}{self.skipped_filter:>{skipped_suites_n_length}}") print(f"└─ {'Filtered test suites (at runtime): ':<37}{self.skipped_runtime:>{skipped_suites_n_length}}") print("---------------------- ----------------------") @@ -412,18 +412,18 @@ def notrun_increment(self, value=1): self._notrun.value += value @property - def skipped_configs(self): - with self._skipped_configs.get_lock(): - return self._skipped_configs.value + def filtered_configs(self): + with self._filtered_configs.get_lock(): + return self._filtered_configs.value - @skipped_configs.setter - def skipped_configs(self, value): - with self._skipped_configs.get_lock(): - self._skipped_configs.value = value + @filtered_configs.setter + def filtered_configs(self, value): + with self._filtered_configs.get_lock(): + self._filtered_configs.value = value - def skipped_configs_increment(self, value=1): - with self._skipped_configs.get_lock(): - self._skipped_configs.value += value + def filtered_configs_increment(self, value=1): + with self._filtered_configs.get_lock(): + self._filtered_configs.value += value @property def skipped_filter(self): @@ -1381,9 +1381,9 @@ def report_out(self, results): if not self.options.verbose: self.log_info_file(self.options.inline_logs) elif instance.status == TwisterStatus.SKIP: - results.skipped_configs_increment() + results.filtered_configs_increment() elif instance.status == TwisterStatus.FILTER: - results.skipped_configs_increment() + results.filtered_configs_increment() elif instance.status == TwisterStatus.PASS: results.passed_increment() elif instance.status == TwisterStatus.NOTRUN: @@ -1439,8 +1439,8 @@ def report_out(self, results): TwisterStatus.get_color(TwisterStatus.NOTRUN), results.notrun, Fore.RESET, - TwisterStatus.get_color(TwisterStatus.SKIP) if results.skipped_configs > 0 else Fore.RESET, - results.skipped_configs, + TwisterStatus.get_color(TwisterStatus.SKIP) if results.filtered_configs > 0 else Fore.RESET, + results.filtered_configs, Fore.RESET, TwisterStatus.get_color(TwisterStatus.FAIL) if results.failed > 0 else Fore.RESET, results.failed, @@ -1699,7 +1699,7 @@ def update_counting_before_pipeline(self): for instance in self.instances.values(): if instance.status == TwisterStatus.FILTER and not instance.reason == 'runtime filter': self.results.skipped_filter_increment() - self.results.skipped_configs_increment() + self.results.filtered_configs_increment() self.results.filtered_cases_increment(len(instance.testsuite.testcases)) self.results.cases_increment(len(instance.testsuite.testcases)) elif instance.status == TwisterStatus.ERROR: @@ -1709,9 +1709,9 @@ def show_brief(self): logger.info("%d test scenarios (%d configurations) selected, " "%d configurations filtered (%d by static filter, %d at runtime)." % (len(self.suites), len(self.instances), - self.results.skipped_configs, + self.results.filtered_configs, self.results.skipped_filter, - self.results.skipped_configs - self.results.skipped_filter)) + self.results.filtered_configs - self.results.skipped_filter)) def add_tasks_to_queue(self, pipeline, build_only=False, test_only=False, retry_build_errors=False): for instance in self.instances.values(): diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index 532fca5e37aaf..e02f761c4956c 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -194,7 +194,7 @@ def test_executioncounter(capfd): ec.iteration = 2 ec.done = 9 ec.passed = 6 - ec.skipped_configs = 3 + ec.filtered_configs = 3 ec.skipped_runtime = 1 ec.skipped_filter = 2 ec.failed = 1 @@ -239,7 +239,7 @@ def test_executioncounter(capfd): assert ec.iteration == 2 assert ec.done == 9 assert ec.passed == 6 - assert ec.skipped_configs == 3 + assert ec.filtered_configs == 3 assert ec.skipped_runtime == 1 assert ec.skipped_filter == 2 assert ec.failed == 1 @@ -2043,7 +2043,7 @@ def test_projectbuilder_report_out( passed = 17, notrun = 0, failed = 2, - skipped_configs = 3, + filtered_configs = 3, skipped_runtime = 0, skipped_filter = 0, error = 1, @@ -2061,9 +2061,9 @@ def test_projectbuilder_report_out( def results_done_increment(value=1, decrement=False): results_mock.done += value * (-1 if decrement else 1) results_mock.done_increment = results_done_increment - def skipped_configs_increment(value=1, decrement=False): - results_mock.skipped_configs += value * (-1 if decrement else 1) - results_mock.skipped_configs_increment = skipped_configs_increment + def filtered_configs_increment(value=1, decrement=False): + results_mock.filtered_configs += value * (-1 if decrement else 1) + results_mock.filtered_configs_increment = filtered_configs_increment def skipped_filter_increment(value=1, decrement=False): results_mock.skipped_filter += value * (-1 if decrement else 1) results_mock.skipped_filter_increment = skipped_filter_increment @@ -2566,7 +2566,7 @@ def test_twisterrunner_update_counting_before_pipeline(): done = 0, passed = 0, failed = 0, - skipped_configs = 0, + filtered_configs = 0, skipped_runtime = 0, skipped_filter = 0, error = 0, @@ -2580,9 +2580,9 @@ def test_twisterrunner_update_counting_before_pipeline(): none_cases = 0, started_cases = 0 ) - def skipped_configs_increment(value=1, decrement=False): - tr.results.skipped_configs += value * (-1 if decrement else 1) - tr.results.skipped_configs_increment = skipped_configs_increment + def filtered_configs_increment(value=1, decrement=False): + tr.results.filtered_configs += value * (-1 if decrement else 1) + tr.results.filtered_configs_increment = filtered_configs_increment def skipped_filter_increment(value=1, decrement=False): tr.results.skipped_filter += value * (-1 if decrement else 1) tr.results.skipped_filter_increment = skipped_filter_increment @@ -2599,7 +2599,7 @@ def filtered_cases_increment(value=1, decrement=False): tr.update_counting_before_pipeline() assert tr.results.skipped_filter == 1 - assert tr.results.skipped_configs == 1 + assert tr.results.filtered_configs == 1 assert tr.results.filtered_cases == 4 assert tr.results.cases == 4 assert tr.results.error == 1 @@ -2619,7 +2619,7 @@ def test_twisterrunner_show_brief(caplog): tr = TwisterRunner(instances, suites, env=env_mock) tr.results = mock.Mock( skipped_filter = 3, - skipped_configs = 4, + filtered_configs = 4, skipped_cases = 0, cases = 0, error = 0 From b578fa5b2ad4579bd5aa14c2e633defe980fb8bf Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 11 Nov 2024 15:59:55 +0000 Subject: [PATCH 2306/4482] twister: stats: more renames skipped -> filtered Additional variable renames leading to confusion between skipped and filtered. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/runner.py | 78 +++++++++++----------- scripts/tests/twister/test_runner.py | 42 ++++++------ 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index 7b920c49dbb6a..4f12226b82774 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -68,8 +68,8 @@ def __init__(self, total=0): total = yaml test scenarios * applicable platforms done := instances that reached report_out stage of the pipeline done = filtered_configs + passed + failed + error - completed = done - skipped_filter - filtered_configs = skipped_runtime + skipped_filter + completed = done - filtered_static + filtered_configs = filtered_runtime + filtered_static pass rate = passed / (total - filtered_configs) case pass rate = passed_cases / (cases - filtered_cases - skipped_cases) @@ -95,11 +95,11 @@ def __init__(self, total=0): # cmake filter + build skipped # updated by report_out() - self._skipped_runtime = Value('i', 0) + self._filtered_runtime = Value('i', 0) # static filtered at yaml parsing time # updated by update_counting_before_pipeline() - self._skipped_filter = Value('i', 0) + self._filtered_static = Value('i', 0) # updated by report_out() in pipeline self._error = Value('i', 0) @@ -145,7 +145,7 @@ def _find_number_length(n): def summary(self): selected_cases = self.cases - self.filtered_cases - completed_configs = self.done - self.skipped_filter + completed_configs = self.done - self.filtered_static # Find alignment length for aesthetic printing suites_n_length = self._find_number_length(self.total if self.total > self.done else self.done) @@ -158,17 +158,17 @@ def summary(self): print("--------------------------------------------------") print(f"{'Total test suites: ':<23}{self.total:>{suites_n_length}}") # actually test instances print(f"{'Processed test suites: ':<23}{self.done:>{suites_n_length}}") - print(f"├─ {'Filtered test suites (static): ':<37}{self.skipped_filter:>{processed_suites_n_length}}") + print(f"├─ {'Filtered test suites (static): ':<37}{self.filtered_static:>{processed_suites_n_length}}") print(f"└─ {'Selected test suites: ':<37}{completed_configs:>{processed_suites_n_length}}") - print(f" ├─ {'Skipped test suites: ':<37}{self.skipped_runtime:>{completed_suites_n_length}}") + print(f" ├─ {'Skipped test suites: ':<37}{self.filtered_runtime:>{completed_suites_n_length}}") print(f" ├─ {'Passed test suites: ':<37}{self.passed:>{completed_suites_n_length}}") print(f" ├─ {'Built only test suites: ':<37}{self.notrun:>{completed_suites_n_length}}") print(f" ├─ {'Failed test suites: ':<37}{self.failed:>{completed_suites_n_length}}") print(f" └─ {'Errors in test suites: ':<37}{self.error:>{completed_suites_n_length}}") print(f"") print(f"{'Filtered test suites: ':<21}{self.filtered_configs}") - print(f"├─ {'Filtered test suites (static): ':<37}{self.skipped_filter:>{skipped_suites_n_length}}") - print(f"└─ {'Filtered test suites (at runtime): ':<37}{self.skipped_runtime:>{skipped_suites_n_length}}") + print(f"├─ {'Filtered test suites (static): ':<37}{self.filtered_static:>{skipped_suites_n_length}}") + print(f"└─ {'Filtered test suites (at runtime): ':<37}{self.filtered_runtime:>{skipped_suites_n_length}}") print("---------------------- ----------------------") print(f"{'Total test cases: ':<18}{self.cases}") print(f"├─ {'Filtered test cases: ':<21}{self.filtered_cases:>{total_cases_n_length}}") @@ -426,32 +426,32 @@ def filtered_configs_increment(self, value=1): self._filtered_configs.value += value @property - def skipped_filter(self): - with self._skipped_filter.get_lock(): - return self._skipped_filter.value + def filtered_static(self): + with self._filtered_static.get_lock(): + return self._filtered_static.value - @skipped_filter.setter - def skipped_filter(self, value): - with self._skipped_filter.get_lock(): - self._skipped_filter.value = value + @filtered_static.setter + def filtered_static(self, value): + with self._filtered_static.get_lock(): + self._filtered_static.value = value - def skipped_filter_increment(self, value=1): - with self._skipped_filter.get_lock(): - self._skipped_filter.value += value + def filtered_static_increment(self, value=1): + with self._filtered_static.get_lock(): + self._filtered_static.value += value @property - def skipped_runtime(self): - with self._skipped_runtime.get_lock(): - return self._skipped_runtime.value + def filtered_runtime(self): + with self._filtered_runtime.get_lock(): + return self._filtered_runtime.value - @skipped_runtime.setter - def skipped_runtime(self, value): - with self._skipped_runtime.get_lock(): - self._skipped_runtime.value = value + @filtered_runtime.setter + def filtered_runtime(self, value): + with self._filtered_runtime.get_lock(): + self._filtered_runtime.value = value - def skipped_runtime_increment(self, value=1): - with self._skipped_runtime.get_lock(): - self._skipped_runtime.value += value + def filtered_runtime_increment(self, value=1): + with self._filtered_runtime.get_lock(): + self._filtered_runtime.value += value @property def failed(self): @@ -924,7 +924,7 @@ def process(self, pipeline, done, message, lock, results): logger.debug("filtering %s" % self.instance.name) self.instance.status = TwisterStatus.FILTER self.instance.reason = "runtime filter" - results.skipped_runtime_increment() + results.filtered_runtime_increment() self.instance.add_missing_case_status(TwisterStatus.FILTER) next_op = 'report' else: @@ -951,7 +951,7 @@ def process(self, pipeline, done, message, lock, results): # Count skipped cases during build, for example # due to ram/rom overflow. if self.instance.status == TwisterStatus.SKIP: - results.skipped_runtime_increment() + results.filtered_runtime_increment() self.instance.add_missing_case_status(TwisterStatus.SKIP, self.instance.reason) if ret.get('returncode', 1) > 0: @@ -1353,7 +1353,7 @@ def _add_instance_testcases_to_status_counts(instance, results, decrement=False) def report_out(self, results): - total_to_do = results.total - results.skipped_filter + total_to_do = results.total - results.filtered_static total_tests_width = len(str(total_to_do)) results.done_increment() instance = self.instance @@ -1413,7 +1413,7 @@ def report_out(self, results): and self.instance.handler.seed is not None ): more_info += "/seed: " + str(self.options.seed) logger.info("{:>{}}/{} {:<25} {:<50} {} ({})".format( - results.done - results.skipped_filter, total_tests_width, total_to_do , instance.platform.name, + results.done - results.filtered_static, total_tests_width, total_to_do , instance.platform.name, instance.testsuite.name, status, more_info)) if self.options.verbose > 1: @@ -1428,11 +1428,11 @@ def report_out(self, results): else: completed_perc = 0 if total_to_do > 0: - completed_perc = int((float(results.done - results.skipped_filter) / total_to_do) * 100) + completed_perc = int((float(results.done - results.filtered_static) / total_to_do) * 100) sys.stdout.write("INFO - Total complete: %s%4d/%4d%s %2d%% built (not run): %s%4d%s, filtered: %s%4d%s, failed: %s%4d%s, error: %s%4d%s\r" % ( TwisterStatus.get_color(TwisterStatus.PASS), - results.done - results.skipped_filter, + results.done - results.filtered_static, total_to_do, Fore.RESET, completed_perc, @@ -1663,7 +1663,7 @@ def run(self): self.results.error = 0 self.results.done -= self.results.error else: - self.results.done = self.results.skipped_filter + self.results.done = self.results.filtered_static self.execute(pipeline, done_queue) @@ -1698,7 +1698,7 @@ def update_counting_before_pipeline(self): ''' for instance in self.instances.values(): if instance.status == TwisterStatus.FILTER and not instance.reason == 'runtime filter': - self.results.skipped_filter_increment() + self.results.filtered_static_increment() self.results.filtered_configs_increment() self.results.filtered_cases_increment(len(instance.testsuite.testcases)) self.results.cases_increment(len(instance.testsuite.testcases)) @@ -1710,8 +1710,8 @@ def show_brief(self): "%d configurations filtered (%d by static filter, %d at runtime)." % (len(self.suites), len(self.instances), self.results.filtered_configs, - self.results.skipped_filter, - self.results.filtered_configs - self.results.skipped_filter)) + self.results.filtered_static, + self.results.filtered_configs - self.results.filtered_static)) def add_tasks_to_queue(self, pipeline, build_only=False, test_only=False, retry_build_errors=False): for instance in self.instances.values(): diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index e02f761c4956c..d1716e9831874 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -195,8 +195,8 @@ def test_executioncounter(capfd): ec.done = 9 ec.passed = 6 ec.filtered_configs = 3 - ec.skipped_runtime = 1 - ec.skipped_filter = 2 + ec.filtered_runtime = 1 + ec.filtered_static = 2 ec.failed = 1 ec.summary() @@ -240,8 +240,8 @@ def test_executioncounter(capfd): assert ec.done == 9 assert ec.passed == 6 assert ec.filtered_configs == 3 - assert ec.skipped_runtime == 1 - assert ec.skipped_filter == 2 + assert ec.filtered_runtime == 1 + assert ec.filtered_static == 2 assert ec.failed == 1 @@ -1547,7 +1547,7 @@ def mock_determine_testcases(res): __exit__=mock.Mock(return_value=None) ) results_mock = mock.Mock() - results_mock.skipped_runtime = 0 + results_mock.filtered_runtime = 0 pb.process(pipeline_mock, done_mock, message, lock_mock, results_mock) @@ -1558,7 +1558,7 @@ def mock_determine_testcases(res): assert pb.instance.status == expected_status assert pb.instance.reason == expected_reason - assert results_mock.skipped_runtime_increment.call_args_list == [mock.call()] * expected_skipped + assert results_mock.filtered_runtime_increment.call_args_list == [mock.call()] * expected_skipped if expected_missing: pb.instance.add_missing_case_status.assert_called_with(*expected_missing) @@ -2044,8 +2044,8 @@ def test_projectbuilder_report_out( notrun = 0, failed = 2, filtered_configs = 3, - skipped_runtime = 0, - skipped_filter = 0, + filtered_runtime = 0, + filtered_static = 0, error = 1, cases = 0, filtered_cases = 0, @@ -2064,12 +2064,12 @@ def results_done_increment(value=1, decrement=False): def filtered_configs_increment(value=1, decrement=False): results_mock.filtered_configs += value * (-1 if decrement else 1) results_mock.filtered_configs_increment = filtered_configs_increment - def skipped_filter_increment(value=1, decrement=False): - results_mock.skipped_filter += value * (-1 if decrement else 1) - results_mock.skipped_filter_increment = skipped_filter_increment - def skipped_runtime_increment(value=1, decrement=False): - results_mock.skipped_runtime += value * (-1 if decrement else 1) - results_mock.skipped_runtime_increment = skipped_runtime_increment + def filtered_static_increment(value=1, decrement=False): + results_mock.filtered_static += value * (-1 if decrement else 1) + results_mock.filtered_static_increment = filtered_static_increment + def filtered_runtime_increment(value=1, decrement=False): + results_mock.filtered_runtime += value * (-1 if decrement else 1) + results_mock.filtered_runtime_increment = filtered_runtime_increment def failed_increment(value=1, decrement=False): results_mock.failed += value * (-1 if decrement else 1) results_mock.failed_increment = failed_increment @@ -2567,8 +2567,8 @@ def test_twisterrunner_update_counting_before_pipeline(): passed = 0, failed = 0, filtered_configs = 0, - skipped_runtime = 0, - skipped_filter = 0, + filtered_runtime = 0, + filtered_static = 0, error = 0, cases = 0, filtered_cases = 0, @@ -2583,9 +2583,9 @@ def test_twisterrunner_update_counting_before_pipeline(): def filtered_configs_increment(value=1, decrement=False): tr.results.filtered_configs += value * (-1 if decrement else 1) tr.results.filtered_configs_increment = filtered_configs_increment - def skipped_filter_increment(value=1, decrement=False): - tr.results.skipped_filter += value * (-1 if decrement else 1) - tr.results.skipped_filter_increment = skipped_filter_increment + def filtered_static_increment(value=1, decrement=False): + tr.results.filtered_static += value * (-1 if decrement else 1) + tr.results.filtered_static_increment = filtered_static_increment def error_increment(value=1, decrement=False): tr.results.error += value * (-1 if decrement else 1) tr.results.error_increment = error_increment @@ -2598,7 +2598,7 @@ def filtered_cases_increment(value=1, decrement=False): tr.update_counting_before_pipeline() - assert tr.results.skipped_filter == 1 + assert tr.results.filtered_static == 1 assert tr.results.filtered_configs == 1 assert tr.results.filtered_cases == 4 assert tr.results.cases == 4 @@ -2618,7 +2618,7 @@ def test_twisterrunner_show_brief(caplog): tr = TwisterRunner(instances, suites, env=env_mock) tr.results = mock.Mock( - skipped_filter = 3, + filtered_static = 3, filtered_configs = 4, skipped_cases = 0, cases = 0, From a43a67e3a3ed5f5a10d9d94f42a217e6ddd63cc1 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 11 Nov 2024 17:33:05 +0000 Subject: [PATCH 2307/4482] twister: stats: fix suite statistics suite stats were not correct, a mixup between skipped and filtered suites was leading to inconsistent numbers. This is now fixed. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/runner.py | 37 +++++++++++++++------- scripts/tests/twister/test_runner.py | 16 ++++------ 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index 4f12226b82774..80bec680c3b91 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -104,6 +104,7 @@ def __init__(self, total=0): # updated by report_out() in pipeline self._error = Value('i', 0) self._failed = Value('i', 0) + self._skipped = Value('i', 0) # initialized to number of test instances self._total = Value('i', total) @@ -145,30 +146,27 @@ def _find_number_length(n): def summary(self): selected_cases = self.cases - self.filtered_cases - completed_configs = self.done - self.filtered_static + completed_configs = self.done - self.filtered_static - self.filtered_runtime # Find alignment length for aesthetic printing suites_n_length = self._find_number_length(self.total if self.total > self.done else self.done) - processed_suites_n_length = self._find_number_length(self.done) completed_suites_n_length = self._find_number_length(completed_configs) - skipped_suites_n_length = self._find_number_length(self.filtered_configs) + filtered_suites_n_length = self._find_number_length(self.filtered_configs) total_cases_n_length = self._find_number_length(self.cases) selected_cases_n_length = self._find_number_length(selected_cases) print("--------------------------------------------------") print(f"{'Total test suites: ':<23}{self.total:>{suites_n_length}}") # actually test instances print(f"{'Processed test suites: ':<23}{self.done:>{suites_n_length}}") - print(f"├─ {'Filtered test suites (static): ':<37}{self.filtered_static:>{processed_suites_n_length}}") - print(f"└─ {'Selected test suites: ':<37}{completed_configs:>{processed_suites_n_length}}") - print(f" ├─ {'Skipped test suites: ':<37}{self.filtered_runtime:>{completed_suites_n_length}}") + print(f"└─{'Filtered test suites: ':<21}{self.filtered_configs}") + print(f" ├─ {'Filtered test suites (static): ':<37}{self.filtered_static:>{filtered_suites_n_length}}") + print(f" └─ {'Filtered test suites (at runtime): ':<37}{self.filtered_runtime:>{filtered_suites_n_length}}") + print(f"└─ {'Selected test suites: ':<37}{completed_configs:>{completed_suites_n_length}}") + print(f" ├─ {'Skipped test suites: ':<37}{self.skipped:>{completed_suites_n_length}}") print(f" ├─ {'Passed test suites: ':<37}{self.passed:>{completed_suites_n_length}}") print(f" ├─ {'Built only test suites: ':<37}{self.notrun:>{completed_suites_n_length}}") print(f" ├─ {'Failed test suites: ':<37}{self.failed:>{completed_suites_n_length}}") print(f" └─ {'Errors in test suites: ':<37}{self.error:>{completed_suites_n_length}}") - print(f"") - print(f"{'Filtered test suites: ':<21}{self.filtered_configs}") - print(f"├─ {'Filtered test suites (static): ':<37}{self.filtered_static:>{skipped_suites_n_length}}") - print(f"└─ {'Filtered test suites (at runtime): ':<37}{self.filtered_runtime:>{skipped_suites_n_length}}") print("---------------------- ----------------------") print(f"{'Total test cases: ':<18}{self.cases}") print(f"├─ {'Filtered test cases: ':<21}{self.filtered_cases:>{total_cases_n_length}}") @@ -341,6 +339,20 @@ def started_cases_increment(self, value=1): with self._started_cases.get_lock(): self._started_cases.value += value + @property + def skipped(self): + with self._skipped.get_lock(): + return self._skipped.value + + @skipped.setter + def skipped(self, value): + with self._skipped.get_lock(): + self._skipped.value = value + + def skipped_increment(self, value=1): + with self._skipped.get_lock(): + self._skipped.value += value + @property def error(self): with self._error.get_lock(): @@ -892,6 +904,7 @@ def process(self, pipeline, done, message, lock, results): logger.debug("filtering %s" % self.instance.name) self.instance.status = TwisterStatus.FILTER self.instance.reason = "runtime filter" + results.filtered_runtime_increment() self.instance.add_missing_case_status(TwisterStatus.FILTER) next_op = 'report' else: @@ -951,7 +964,7 @@ def process(self, pipeline, done, message, lock, results): # Count skipped cases during build, for example # due to ram/rom overflow. if self.instance.status == TwisterStatus.SKIP: - results.filtered_runtime_increment() + results.skipped_increment() self.instance.add_missing_case_status(TwisterStatus.SKIP, self.instance.reason) if ret.get('returncode', 1) > 0: @@ -1381,7 +1394,7 @@ def report_out(self, results): if not self.options.verbose: self.log_info_file(self.options.inline_logs) elif instance.status == TwisterStatus.SKIP: - results.filtered_configs_increment() + results.skipped_increment() elif instance.status == TwisterStatus.FILTER: results.filtered_configs_increment() elif instance.status == TwisterStatus.PASS: diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index d1716e9831874..c19ff08babc10 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -209,17 +209,15 @@ def test_executioncounter(capfd): '--------------------------------------------------\n' 'Total test suites: 12\n' 'Processed test suites: 9\n' - '├─ Filtered test suites (static): 2\n' - '└─ Completed test suites: 7\n' - ' ├─ Filtered test suites (at runtime): 1\n' + '└─Filtered test suites: 3\n' + ' ├─ Filtered test suites (static): 2\n' + ' └─ Filtered test suites (at runtime): 1\n' + '└─ Selected test suites: 6\n' + ' ├─ Skipped test suites: 0\n' ' ├─ Passed test suites: 6\n' ' ├─ Built only test suites: 0\n' ' ├─ Failed test suites: 1\n' ' └─ Errors in test suites: 2\n' - '\n' - 'Filtered test suites: 3\n' - '├─ Filtered test suites (static): 2\n' - '└─ Filtered test suites (at runtime): 1\n' '---------------------- ----------------------\n' 'Total test cases: 25\n' '├─ Filtered test cases: 0\n' @@ -914,7 +912,7 @@ def mock_getsize(filename, *args, **kwargs): {'op': 'report', 'test': mock.ANY}, TwisterStatus.FILTER, 'runtime filter', - 0, + 1, (TwisterStatus.FILTER,) ), ( @@ -1091,7 +1089,7 @@ def mock_getsize(filename, *args, **kwargs): {'op': 'gather_metrics', 'test': mock.ANY}, mock.ANY, mock.ANY, - 1, + 0, (TwisterStatus.SKIP, mock.ANY) ), ( From 049b243b51f354c27273094a798ad2c9f34481c1 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 12 Nov 2024 06:12:22 -0500 Subject: [PATCH 2308/4482] twister: stats: use anytree to create summary Do not create the tree structure manually, use anytree instead. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/runner.py | 69 +++++++++++----------- scripts/tests/twister/test_runner.py | 43 +++++++------- 2 files changed, 54 insertions(+), 58 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index 80bec680c3b91..128bc598ed9c4 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -57,6 +57,7 @@ logger = logging.getLogger('twister') logger.setLevel(logging.DEBUG) import expr_parser +from anytree import Node, RenderTree class ExecutionCounter(object): @@ -146,44 +147,42 @@ def _find_number_length(n): def summary(self): selected_cases = self.cases - self.filtered_cases - completed_configs = self.done - self.filtered_static - self.filtered_runtime - - # Find alignment length for aesthetic printing - suites_n_length = self._find_number_length(self.total if self.total > self.done else self.done) - completed_suites_n_length = self._find_number_length(completed_configs) - filtered_suites_n_length = self._find_number_length(self.filtered_configs) - total_cases_n_length = self._find_number_length(self.cases) - selected_cases_n_length = self._find_number_length(selected_cases) - - print("--------------------------------------------------") - print(f"{'Total test suites: ':<23}{self.total:>{suites_n_length}}") # actually test instances - print(f"{'Processed test suites: ':<23}{self.done:>{suites_n_length}}") - print(f"└─{'Filtered test suites: ':<21}{self.filtered_configs}") - print(f" ├─ {'Filtered test suites (static): ':<37}{self.filtered_static:>{filtered_suites_n_length}}") - print(f" └─ {'Filtered test suites (at runtime): ':<37}{self.filtered_runtime:>{filtered_suites_n_length}}") - print(f"└─ {'Selected test suites: ':<37}{completed_configs:>{completed_suites_n_length}}") - print(f" ├─ {'Skipped test suites: ':<37}{self.skipped:>{completed_suites_n_length}}") - print(f" ├─ {'Passed test suites: ':<37}{self.passed:>{completed_suites_n_length}}") - print(f" ├─ {'Built only test suites: ':<37}{self.notrun:>{completed_suites_n_length}}") - print(f" ├─ {'Failed test suites: ':<37}{self.failed:>{completed_suites_n_length}}") - print(f" └─ {'Errors in test suites: ':<37}{self.error:>{completed_suites_n_length}}") - print("---------------------- ----------------------") - print(f"{'Total test cases: ':<18}{self.cases}") - print(f"├─ {'Filtered test cases: ':<21}{self.filtered_cases:>{total_cases_n_length}}") - print(f"└─ {'Selected test cases: ':<21}{selected_cases:>{total_cases_n_length}}") - print(f" ├─ {'Passed test cases: ':<25}{self.passed_cases:>{selected_cases_n_length}}") - print(f" ├─ {'Skipped test cases: ':<25}{self.skipped_cases:>{total_cases_n_length}}") - print(f" ├─ {'Built only test cases: ':<25}{self.notrun_cases:>{selected_cases_n_length}}") - print(f" ├─ {'Blocked test cases: ':<25}{self.blocked_cases:>{selected_cases_n_length}}") - print(f" ├─ {'Failed test cases: ':<25}{self.failed_cases:>{selected_cases_n_length}}") - print(f" {'├' if self.none_cases or self.started_cases else '└'}─ {'Errors in test cases: ':<25}{self.error_cases:>{selected_cases_n_length}}") + selected_configs = self.done - self.filtered_static - self.filtered_runtime + + + root = Node("Summary") + + Node(f"Total test suites: {self.total}", parent=root) + processed_suites = Node(f"Processed test suites: {self.done}", parent=root) + filtered_suites = Node(f"Filtered test suites: {self.filtered_configs}", parent=processed_suites) + Node(f"Filtered test suites (static): {self.filtered_static}", parent=filtered_suites) + Node(f"Filtered test suites (at runtime): {self.filtered_runtime}", parent=filtered_suites) + selected_suites = Node(f"Selected test suites: {selected_configs}", parent=processed_suites) + Node(f"Skipped test suites: {self.skipped}", parent=selected_suites) + Node(f"Passed test suites: {self.passed}", parent=selected_suites) + Node(f"Built only test suites: {self.notrun}", parent=selected_suites) + Node(f"Failed test suites: {self.failed}", parent=selected_suites) + Node(f"Errors in test suites: {self.error}", parent=selected_suites) + + total_cases = Node(f"Total test cases: {self.cases}", parent=root) + Node(f"Filtered test cases: {self.filtered_cases}", parent=total_cases) + selected_cases_node = Node(f"Selected test cases: {selected_cases}", parent=total_cases) + Node(f"Passed test cases: {self.passed_cases}", parent=selected_cases_node) + Node(f"Skipped test cases: {self.skipped_cases}", parent=selected_cases_node) + Node(f"Built only test cases: {self.notrun_cases}", parent=selected_cases_node) + Node(f"Blocked test cases: {self.blocked_cases}", parent=selected_cases_node) + Node(f"Failed test cases: {self.failed_cases}", parent=selected_cases_node) + error_cases_node = Node(f"Errors in test cases: {self.error_cases}", parent=selected_cases_node) + if self.none_cases or self.started_cases: - print(f" ├──── The following test case statuses should not appear in a proper execution ───") + Node("The following test case statuses should not appear in a proper execution", parent=error_cases_node) if self.none_cases: - print(f" {'├' if self.started_cases else '└'}─ {'Statusless test cases: ':<25}{self.none_cases:>{selected_cases_n_length}}") + Node(f"Statusless test cases: {self.none_cases}", parent=error_cases_node) if self.started_cases: - print(f" └─ {'Test cases only started: ':<25}{self.started_cases:>{selected_cases_n_length}}") - print("--------------------------------------------------") + Node(f"Test cases only started: {self.started_cases}", parent=error_cases_node) + + for pre, _, node in RenderTree(root): + print("%s%s" % (pre, node.name)) @property def warnings(self): diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index c19ff08babc10..3ab7de2fb935f 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -206,29 +206,26 @@ def test_executioncounter(capfd): sys.stderr.write(err) assert ( - '--------------------------------------------------\n' - 'Total test suites: 12\n' - 'Processed test suites: 9\n' - '└─Filtered test suites: 3\n' - ' ├─ Filtered test suites (static): 2\n' - ' └─ Filtered test suites (at runtime): 1\n' - '└─ Selected test suites: 6\n' - ' ├─ Skipped test suites: 0\n' - ' ├─ Passed test suites: 6\n' - ' ├─ Built only test suites: 0\n' - ' ├─ Failed test suites: 1\n' - ' └─ Errors in test suites: 2\n' - '---------------------- ----------------------\n' - 'Total test cases: 25\n' - '├─ Filtered test cases: 0\n' - '└─ Selected test cases: 25\n' - ' ├─ Passed test cases: 0\n' - ' ├─ Skipped test cases: 6\n' - ' ├─ Built only test cases: 0\n' - ' ├─ Blocked test cases: 0\n' - ' ├─ Failed test cases: 0\n' - ' └─ Errors in test cases: 0\n' - '--------------------------------------------------\n' +"├── Total test suites: 12\n" +"├── Processed test suites: 9\n" +"│ ├── Filtered test suites: 3\n" +"│ │ ├── Filtered test suites (static): 2\n" +"│ │ └── Filtered test suites (at runtime): 1\n" +"│ └── Selected test suites: 6\n" +"│ ├── Skipped test suites: 0\n" +"│ ├── Passed test suites: 6\n" +"│ ├── Built only test suites: 0\n" +"│ ├── Failed test suites: 1\n" +"│ └── Errors in test suites: 2\n" +"└── Total test cases: 25\n" +" ├── Filtered test cases: 0\n" +" └── Selected test cases: 25\n" +" ├── Passed test cases: 0\n" +" ├── Skipped test cases: 6\n" +" ├── Built only test cases: 0\n" +" ├── Blocked test cases: 0\n" +" ├── Failed test cases: 0\n" +" └── Errors in test cases: 0\n" ) in out assert ec.cases == 25 From 0da16f7ec65cb3757f96a4cfb8b4fe1f2843e211 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Tue, 12 Nov 2024 07:11:46 -0600 Subject: [PATCH 2309/4482] drivers: nxp_enet: put phy cb before iface init This commit moves one function before another, to make the diff of the next commit clearer of what it's doing. Signed-off-by: Declan Snyder --- drivers/ethernet/nxp_enet/eth_nxp_enet.c | 51 ++++++++++++------------ 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/drivers/ethernet/nxp_enet/eth_nxp_enet.c b/drivers/ethernet/nxp_enet/eth_nxp_enet.c index 31ce4720c27c8..dd993e8e3b958 100644 --- a/drivers/ethernet/nxp_enet/eth_nxp_enet.c +++ b/drivers/ethernet/nxp_enet/eth_nxp_enet.c @@ -243,32 +243,6 @@ static int eth_nxp_enet_tx(const struct device *dev, struct net_pkt *pkt) return ret; } -static void eth_nxp_enet_iface_init(struct net_if *iface) -{ - const struct device *dev = net_if_get_device(iface); - struct nxp_enet_mac_data *data = dev->data; - const struct nxp_enet_mac_config *config = dev->config; - - net_if_set_link_addr(iface, data->mac_addr, - sizeof(data->mac_addr), - NET_LINK_ETHERNET); - - if (data->iface == NULL) { - data->iface = iface; - } - -#if defined(CONFIG_NET_DSA) - dsa_register_master_tx(iface, ð_nxp_enet_tx); -#endif - - ethernet_init(iface); - net_if_carrier_off(data->iface); - - config->irq_config_func(); - - nxp_enet_driver_cb(config->mdio, NXP_ENET_MDIO, NXP_ENET_INTERRUPT_ENABLED, NULL); -} - static enum ethernet_hw_caps eth_nxp_enet_get_capabilities(const struct device *dev) { #if defined(CONFIG_ETH_NXP_ENET_1G) @@ -523,6 +497,31 @@ static void nxp_enet_phy_cb(const struct device *phy, } } +static void eth_nxp_enet_iface_init(struct net_if *iface) +{ + const struct device *dev = net_if_get_device(iface); + struct nxp_enet_mac_data *data = dev->data; + const struct nxp_enet_mac_config *config = dev->config; + + net_if_set_link_addr(iface, data->mac_addr, + sizeof(data->mac_addr), + NET_LINK_ETHERNET); + + if (data->iface == NULL) { + data->iface = iface; + } + +#if defined(CONFIG_NET_DSA) + dsa_register_master_tx(iface, ð_nxp_enet_tx); +#endif + + ethernet_init(iface); + net_if_carrier_off(iface); + + config->irq_config_func(); + + nxp_enet_driver_cb(config->mdio, NXP_ENET_MDIO, NXP_ENET_INTERRUPT_ENABLED, NULL); +} static int nxp_enet_phy_init(const struct device *dev) { From c1398250e9958eaa67d90c37c612ef392afcf812 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Tue, 12 Nov 2024 07:12:57 -0600 Subject: [PATCH 2310/4482] drivers: nxp_enet: Check link state in iface init Still mark the iface as down after ethernet_init, but then actually check the link state and initialize carrier appropriately This fixes the case where, the phy driver doesn't give a callback after iface init due to the link already being up, there was no change from the phy driver perspective, so callback wouldn't happen, and therefore the interface could remain marked as down after boot even if carrier is up. Signed-off-by: Declan Snyder --- drivers/ethernet/nxp_enet/eth_nxp_enet.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/ethernet/nxp_enet/eth_nxp_enet.c b/drivers/ethernet/nxp_enet/eth_nxp_enet.c index dd993e8e3b958..c5b1ac92b13d0 100644 --- a/drivers/ethernet/nxp_enet/eth_nxp_enet.c +++ b/drivers/ethernet/nxp_enet/eth_nxp_enet.c @@ -502,6 +502,8 @@ static void eth_nxp_enet_iface_init(struct net_if *iface) const struct device *dev = net_if_get_device(iface); struct nxp_enet_mac_data *data = dev->data; const struct nxp_enet_mac_config *config = dev->config; + const struct device *phy_dev = config->phy_dev; + struct phy_link_state state; net_if_set_link_addr(iface, data->mac_addr, sizeof(data->mac_addr), @@ -518,6 +520,14 @@ static void eth_nxp_enet_iface_init(struct net_if *iface) ethernet_init(iface); net_if_carrier_off(iface); + /* In case the phy driver doesn't report a state change due to link being up + * before calling phy_configure, we should check the state ourself, and then do a + * pseudo-callback + */ + phy_get_link_state(phy_dev, &state); + + nxp_enet_phy_cb(phy_dev, &state, (void *)dev); + config->irq_config_func(); nxp_enet_driver_cb(config->mdio, NXP_ENET_MDIO, NXP_ENET_INTERRUPT_ENABLED, NULL); From 55e7cc659cdf25c94d5a931c5225b9abfc183265 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 7 Nov 2024 14:10:31 +0000 Subject: [PATCH 2311/4482] doc: Fix renamed ARM MPS* board targets Fixes some board target names that have changed or were not updated for hwmv2 Signed-off-by: Jamie McCrae --- doc/build/sysbuild/index.rst | 6 ++-- doc/hardware/arch/arm_cortex_m.rst | 46 +++++++++++++++--------------- doc/services/tfm/build.rst | 10 +++---- doc/services/tfm/integration.rst | 15 +++++----- doc/services/tfm/overview.rst | 4 +-- doc/services/tfm/requirements.rst | 9 +++--- 6 files changed, 45 insertions(+), 45 deletions(-) diff --git a/doc/build/sysbuild/index.rst b/doc/build/sysbuild/index.rst index 80c11ce219139..4d11d5a1fa33d 100644 --- a/doc/build/sysbuild/index.rst +++ b/doc/build/sysbuild/index.rst @@ -499,8 +499,8 @@ In sysbuild and Zephyr CMake build system a board may refer to: * A specific SoC on a physical board with multiple SoCs, such as :ref:`nrf9160dk_nrf9160` and :ref:`nrf9160dk_nrf52840`. -If your main application, for example, is built for ``mps2_an521``, and your -helper application must target the ``mps2_an521_remote`` board (cpu1), add +If your main application, for example, is built for ``mps2/an521/cpu0``, and your +helper application must target the ``mps2/an521/cpu1`` board target, add a CMake function call that is structured as follows: .. code-block:: cmake @@ -508,7 +508,7 @@ a CMake function call that is structured as follows: ExternalZephyrProject_Add( APPLICATION my_sample SOURCE_DIR /my_sample - BOARD mps2_an521_remote + BOARD mps2/an521/cpu1 ) This could be useful, for example, if your main application requires another diff --git a/doc/hardware/arch/arm_cortex_m.rst b/doc/hardware/arch/arm_cortex_m.rst index d0c9fcec71345..7e68398c9ccb0 100644 --- a/doc/hardware/arch/arm_cortex_m.rst +++ b/doc/hardware/arch/arm_cortex_m.rst @@ -651,29 +651,29 @@ The table below lists the QEMU platform targets defined in Zephyr along with the corresponding Cortex-M implementation variant and the peripherals these targets emulate. -+---------------------------------+--------------------+--------------------+----------------+-----------------+----------------+ -| | **QEMU target** | -+---------------------------------+--------------------+--------------------+----------------+-----------------+----------------+ -| Architecture variant | Arm v6-M | Arm v7-M | Arm v8-M | Arm v8.1-M | -+---------------------------------+--------------------+--------------------+----------------+-----------------+----------------+ -| | **qemu_cortex_m0** | **qemu_cortex_m3** | **mps2_an385** | **mps2_an521** | **mps3_an547** | -+---------------------------------+--------------------+--------------------+----------------+-----------------+----------------+ -| **Emulated features** | | -+---------------------------------+--------------------+--------------------+----------------+-----------------+----------------+ -| NVIC | Y | Y | Y | Y | Y | -+---------------------------------+--------------------+--------------------+----------------+-----------------+----------------+ -| BASEPRI | N | Y | Y | Y | Y | -+---------------------------------+--------------------+--------------------+----------------+-----------------+----------------+ -| SysTick | N | Y | Y | Y | Y | -+---------------------------------+--------------------+--------------------+----------------+-----------------+----------------+ -| MPU | N | N | Y | Y | Y | -+---------------------------------+--------------------+--------------------+----------------+-----------------+----------------+ -| FPU | N | N | N | Y | N | -+---------------------------------+--------------------+--------------------+----------------+-----------------+----------------+ -| SPLIM | N | N | N | Y | Y | -+---------------------------------+--------------------+--------------------+----------------+-----------------+----------------+ -| TrustZone-M | N | N | N | Y | N | -+---------------------------------+--------------------+--------------------+----------------+-----------------+----------------+ ++---------------------------------+--------------------+--------------------+----------------+----------------------+----------------------------+ +| | **QEMU target** | ++---------------------------------+--------------------+--------------------+----------------+----------------------+----------------------------+ +| Architecture variant | Arm v6-M | Arm v7-M | Arm v8-M | Arm v8.1-M | ++---------------------------------+--------------------+--------------------+----------------+----------------------+----------------------------+ +| | **qemu_cortex_m0** | **qemu_cortex_m3** | **mps2/an385** | **mps2/an521/cpu0** | **mps3/corstone300/an547** | ++---------------------------------+--------------------+--------------------+----------------+----------------------+----------------------------+ +| **Emulated features** | | ++---------------------------------+--------------------+--------------------+----------------+----------------------+----------------------------+ +| NVIC | Y | Y | Y | Y | Y | ++---------------------------------+--------------------+--------------------+----------------+----------------------+----------------------------+ +| BASEPRI | N | Y | Y | Y | Y | ++---------------------------------+--------------------+--------------------+----------------+----------------------+----------------------------+ +| SysTick | N | Y | Y | Y | Y | ++---------------------------------+--------------------+--------------------+----------------+----------------------+----------------------------+ +| MPU | N | N | Y | Y | Y | ++---------------------------------+--------------------+--------------------+----------------+----------------------+----------------------------+ +| FPU | N | N | N | Y | N | ++---------------------------------+--------------------+--------------------+----------------+----------------------+----------------------------+ +| SPLIM | N | N | N | Y | Y | ++---------------------------------+--------------------+--------------------+----------------+----------------------+----------------------------+ +| TrustZone-M | N | N | N | Y | N | ++---------------------------------+--------------------+--------------------+----------------+----------------------+----------------------------+ Maintainers & Collaborators *************************** diff --git a/doc/services/tfm/build.rst b/doc/services/tfm/build.rst index 3575ecc3a890a..7f8f75d56849a 100644 --- a/doc/services/tfm/build.rst +++ b/doc/services/tfm/build.rst @@ -11,7 +11,7 @@ steps required: .. code-block:: bash - $ west build -p auto -b mps2_an521_ns samples/tfm_integration/psa_protected_storage/ -t run + $ west build -p auto -b mps2/an521/cpu0/ns samples/tfm_integration/psa_protected_storage/ -t run The outputs and certain key steps in this build process are described here, however, since you will need to understand and interact with the outputs, and @@ -146,7 +146,7 @@ Use the ``tfm_ram_report`` to get the RAM report for TF-M secure firmware (tfm_s .. zephyr-app-commands:: :tool: all :zephyr-app: samples/hello_world - :board: mps2_an521_ns + :board: mps2/an521/cpu0/ns :goals: tfm_ram_report Use the ``tfm_rom_report`` to get the ROM report for TF-M secure firmware (tfm_s). @@ -154,7 +154,7 @@ Use the ``tfm_rom_report`` to get the ROM report for TF-M secure firmware (tfm_s .. zephyr-app-commands:: :tool: all :zephyr-app: samples/hello_world - :board: mps2_an521_ns + :board: mps2/an521/cpu0/ns :goals: tfm_rom_report Use the ``bl2_ram_report`` to get the RAM report for TF-M MCUboot, if enabled. @@ -162,7 +162,7 @@ Use the ``bl2_ram_report`` to get the RAM report for TF-M MCUboot, if enabled. .. zephyr-app-commands:: :tool: all :zephyr-app: samples/hello_world - :board: mps2_an521_ns + :board: mps2/an521/cpu0/ns :goals: bl2_ram_report Use the ``bl2_rom_report`` to get the ROM report for TF-M MCUboot, if enabled. @@ -170,5 +170,5 @@ Use the ``bl2_rom_report`` to get the ROM report for TF-M MCUboot, if enabled. .. zephyr-app-commands:: :tool: all :zephyr-app: samples/hello_world - :board: mps2_an521_ns + :board: mps2/an521/cpu0/ns :goals: bl2_rom_report diff --git a/doc/services/tfm/integration.rst b/doc/services/tfm/integration.rst index 506184f0bde2c..08d0900aad400 100644 --- a/doc/services/tfm/integration.rst +++ b/doc/services/tfm/integration.rst @@ -23,13 +23,13 @@ processing environment. :kconfig:option:`CONFIG_TFM_BOARD` must also be set via to the board name that TF-M expects for this target, so that it knows which target to build for the secure processing environment. -Example: ``mps2_an521_ns`` -========================== +Example: ``mps2/an521/cpu0/ns`` +=============================== -The ``mps2_an521`` target is a dual-core Arm Cortex-M33 evaluation board that, -when using the default board variant, would generate a secure Zephyr binary. +The ``mps2/an521/cpu0`` board target is a dual-core Arm Cortex-M33 evaluation board that generates +a secure Zephyr binary. -The optional ``mps2_an521_ns`` target, however, sets these additional +The optional ``mps2/an521/cpu0/ns`` board target, however, sets these additional kconfig flags that indicate that Zephyr should be built as a non-secure image, linked with TF-M as an external project, and optionally the secure bootloader: @@ -37,8 +37,9 @@ secure bootloader: * :kconfig:option:`CONFIG_TRUSTED_EXECUTION_NONSECURE` ``y`` * :kconfig:option:`CONFIG_ARM_TRUSTZONE_M` ``y`` -Comparing the ``mps2_an521.dts`` and ``mps2_an521_ns.dts`` files, we can see -that the ``_ns`` version defines offsets in flash and SRAM memory, which leave +Comparing the :zephyr_file:`boards/arm/mps2/mps2_an521_cpu0.dts` and +:zephyr_file:`boards/arm/mps2/mps2_an521_cpu0_ns.dts` files, +we can see that the ``ns`` version defines offsets in flash and SRAM memory, which leave the required space for TF-M and the secure bootloader: :: diff --git a/doc/services/tfm/overview.rst b/doc/services/tfm/overview.rst index 8ecbd5946d864..287c7fef43188 100644 --- a/doc/services/tfm/overview.rst +++ b/doc/services/tfm/overview.rst @@ -261,8 +261,8 @@ Non-Secure Processing Environment Zephyr is used for the NSPE, using a board that is supported by TF-M where the :kconfig:option:`CONFIG_BUILD_WITH_TFM` flag has been enabled. -Generally, you simply need to select the ``*_ns`` variant of a valid target -(for example ``mps2_an521_ns``), which will configure your Zephyr application +Generally, you simply need to select the ``*/ns`` board target of a valid board +(for example ``mps2/an521/cpu0/ns``), which will configure your Zephyr application to run in the NSPE, correctly build and link it with the TF-M secure images, sign the secure and non-secure images, and merge the three binaries into a single ``tfm_merged.hex`` file. The :ref:`west flash ` command diff --git a/doc/services/tfm/requirements.rst b/doc/services/tfm/requirements.rst index 3170b03fc1ba8..0221683d4a1a2 100644 --- a/doc/services/tfm/requirements.rst +++ b/doc/services/tfm/requirements.rst @@ -9,7 +9,7 @@ The following are some of the boards that can be used with TF-M: * - Board - NSPE board name * - :ref:`mps2_an521_board` - - ``mps2_an521_ns`` (qemu supported) + - ``mps2/an521/cpu0/ns`` (qemu supported) * - :ref:`mps3_board` - ``mps3/corstone300/an547/ns`` (qemu supported) * - :zephyr:board:`bl5340_dvk` @@ -27,12 +27,11 @@ The following are some of the boards that can be used with TF-M: * - :zephyr:board:`stm32l562e_dk` - ``stm32l562e_dk/stm32l562xx/ns`` * - :ref:`v2m_musca_b1_board` - - ``v2m_musca_b1_ns`` + - ``v2m_musca_b1/musca_b1/ns`` * - :ref:`v2m_musca_s1_board` - - ``v2m_musca_s1_ns`` + - ``v2m_musca_s1/musca_s1/ns`` -You can run ``west boards -n _ns$`` to search for non-secure variants -of different board targets. To make sure TF-M is supported for a board +To make sure TF-M is supported for a board in its output, check that :kconfig:option:`CONFIG_TRUSTED_EXECUTION_NONSECURE` is set to ``y`` in that board's default configuration. From 996b8a63e719055ac68e3684b5c1239acaf9c362 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 29 Oct 2024 14:53:34 +0000 Subject: [PATCH 2312/4482] mgmt: mcumgr: Remove deprecated function smp_add_cmd_ret Removes a function that was deprecated in Zephyr 3.4 Signed-off-by: Jamie McCrae --- include/zephyr/mgmt/mcumgr/smp/smp.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/include/zephyr/mgmt/mcumgr/smp/smp.h b/include/zephyr/mgmt/mcumgr/smp/smp.h index cc72e801a959b..16d7ada858f7e 100644 --- a/include/zephyr/mgmt/mcumgr/smp/smp.h +++ b/include/zephyr/mgmt/mcumgr/smp/smp.h @@ -121,12 +121,6 @@ int smp_process_request_packet(struct smp_streamer *streamer, void *req); */ bool smp_add_cmd_err(zcbor_state_t *zse, uint16_t group, uint16_t ret); -/** @deprecated Deprecated after Zephyr 3.4, use smp_add_cmd_err() instead */ -__deprecated inline bool smp_add_cmd_ret(zcbor_state_t *zse, uint16_t group, uint16_t ret) -{ - return smp_add_cmd_err(zse, group, ret); -} - #if defined(CONFIG_MCUMGR_SMP_SUPPORT_ORIGINAL_PROTOCOL) /** @typedef smp_translate_error_fn * @brief Translates a SMP version 2 error response to a legacy SMP version 1 error code. From 17214542665c4ff7652409b62687bf5a68b35790 Mon Sep 17 00:00:00 2001 From: IBEN EL HADJ MESSAOUD Marwa Date: Tue, 12 Nov 2024 15:22:37 +0100 Subject: [PATCH 2313/4482] Revert "drivers: ethernet: eth_stm32_hal_priv.h" This reverts commit fbeda5959dd82b58027c07f1ce95a58a9001626e. Signed-off-by: IBEN EL HADJ MESSAOUD Marwa --- drivers/ethernet/eth_stm32_hal_priv.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/ethernet/eth_stm32_hal_priv.h b/drivers/ethernet/eth_stm32_hal_priv.h index 0d19578cd4826..2957f13d5ecaa 100644 --- a/drivers/ethernet/eth_stm32_hal_priv.h +++ b/drivers/ethernet/eth_stm32_hal_priv.h @@ -22,6 +22,8 @@ #define ST_OUI_B1 0x80 #define ST_OUI_B2 0xE1 +#define ETH_STM32_HAL_FRAME_SIZE_MAX (NET_ETH_MTU + 18) + /* Device constant configuration parameters */ struct eth_stm32_hal_dev_cfg { void (*config_func)(void); From db6589f780995012d7d4bc111f5ba8b3600a7a13 Mon Sep 17 00:00:00 2001 From: IBEN EL HADJ MESSAOUD Marwa Date: Tue, 12 Nov 2024 15:25:36 +0100 Subject: [PATCH 2314/4482] Revert "drivers: ethernet: eth_stm32_hal" This reverts commit 0036b8bf21c709835d6a9fcfaf2b994bd1c3ab4d. The reverted commit causes a compile error with the STM32F2 because there are some variables used in the file eth_stm32_hal that are not defined in the HAL module of the STM32F2 series, such as 'ETH_RX_DESC_CNT' and 'HAL_ETH_MII_MODE' Signed-off-by: IBEN EL HADJ MESSAOUD Marwa --- drivers/ethernet/eth_stm32_hal.c | 54 +++++++++++++++------------ drivers/ethernet/eth_stm32_hal_priv.h | 7 +++- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/drivers/ethernet/eth_stm32_hal.c b/drivers/ethernet/eth_stm32_hal.c index d2c76261498d9..0c468f0fd7f33 100644 --- a/drivers/ethernet/eth_stm32_hal.c +++ b/drivers/ethernet/eth_stm32_hal.c @@ -73,6 +73,12 @@ static const struct device *eth_stm32_phy_dev = DEVICE_PHY_BY_NAME(0); #define IS_ETH_DMATXDESC_OWN(dma_tx_desc) (dma_tx_desc->DESC3 & \ ETH_DMATXNDESCRF_OWN) +#define ETH_RXBUFNB ETH_RX_DESC_CNT +#define ETH_TXBUFNB ETH_TX_DESC_CNT + +#define ETH_MEDIA_INTERFACE_MII HAL_ETH_MII_MODE +#define ETH_MEDIA_INTERFACE_RMII HAL_ETH_RMII_MODE + /* Only one tx_buffer is sufficient to pass only 1 dma_buffer */ #define ETH_TXBUF_DEF_NB 1U #else @@ -99,14 +105,14 @@ static const struct device *eth_stm32_phy_dev = DEVICE_PHY_BY_NAME(0); #define __eth_stm32_buf __aligned(4) #endif -static ETH_DMADescTypeDef dma_rx_desc_tab[ETH_RX_DESC_CNT] __eth_stm32_desc; -static ETH_DMADescTypeDef dma_tx_desc_tab[ETH_TX_DESC_CNT] __eth_stm32_desc; -static uint8_t dma_rx_buffer[ETH_RX_DESC_CNT][ETH_MAX_PACKET_SIZE] __eth_stm32_buf; -static uint8_t dma_tx_buffer[ETH_TX_DESC_CNT][ETH_MAX_PACKET_SIZE] __eth_stm32_buf; +static ETH_DMADescTypeDef dma_rx_desc_tab[ETH_RXBUFNB] __eth_stm32_desc; +static ETH_DMADescTypeDef dma_tx_desc_tab[ETH_TXBUFNB] __eth_stm32_desc; +static uint8_t dma_rx_buffer[ETH_RXBUFNB][ETH_STM32_RX_BUF_SIZE] __eth_stm32_buf; +static uint8_t dma_tx_buffer[ETH_TXBUFNB][ETH_STM32_TX_BUF_SIZE] __eth_stm32_buf; #if defined(CONFIG_ETH_STM32_HAL_API_V2) -BUILD_ASSERT(ETH_MAX_PACKET_SIZE % 4 == 0, "Rx buffer size must be a multiple of 4"); +BUILD_ASSERT(ETH_STM32_RX_BUF_SIZE % 4 == 0, "Rx buffer size must be a multiple of 4"); struct eth_stm32_rx_buffer_header { struct eth_stm32_rx_buffer_header *next; @@ -125,13 +131,13 @@ struct eth_stm32_tx_context { bool used; }; -static struct eth_stm32_rx_buffer_header dma_rx_buffer_header[ETH_RX_DESC_CNT]; -static struct eth_stm32_tx_buffer_header dma_tx_buffer_header[ETH_TX_DESC_CNT]; +static struct eth_stm32_rx_buffer_header dma_rx_buffer_header[ETH_RXBUFNB]; +static struct eth_stm32_tx_buffer_header dma_tx_buffer_header[ETH_TXBUFNB]; static struct eth_stm32_tx_context dma_tx_context[ETH_TX_DESC_CNT]; void HAL_ETH_RxAllocateCallback(uint8_t **buf) { - for (size_t i = 0; i < ETH_RX_DESC_CNT; ++i) { + for (size_t i = 0; i < ETH_RXBUFNB; ++i) { if (!dma_rx_buffer_header[i].used) { dma_rx_buffer_header[i].next = NULL; dma_rx_buffer_header[i].size = 0; @@ -143,8 +149,8 @@ void HAL_ETH_RxAllocateCallback(uint8_t **buf) *buf = NULL; } -/* Pointer to an array of ETH_MAX_PACKET_SIZE uint8_t's */ -typedef uint8_t (*RxBufferPtr)[ETH_MAX_PACKET_SIZE]; +/* Pointer to an array of ETH_STM32_RX_BUF_SIZE uint8_t's */ +typedef uint8_t (*RxBufferPtr)[ETH_STM32_RX_BUF_SIZE]; /* called by HAL_ETH_ReadData() */ void HAL_ETH_RxLinkCallback(void **pStart, void **pEnd, uint8_t *buff, uint16_t Length) @@ -155,7 +161,7 @@ void HAL_ETH_RxLinkCallback(void **pStart, void **pEnd, uint8_t *buff, uint16_t size_t index = (RxBufferPtr)buff - &dma_rx_buffer[0]; struct eth_stm32_rx_buffer_header *header = &dma_rx_buffer_header[index]; - __ASSERT_NO_MSG(index < ETH_RX_DESC_CNT); + __ASSERT_NO_MSG(index < ETH_RXBUFNB); header->size = Length; @@ -197,7 +203,7 @@ void HAL_ETH_TxFreeCallback(uint32_t *buff) static inline uint16_t allocate_tx_buffer(void) { for (;;) { - for (uint16_t index = 0; index < ETH_TX_DESC_CNT; index++) { + for (uint16_t index = 0; index < ETH_TXBUFNB; index++) { if (!dma_tx_buffer_header[index].used) { dma_tx_buffer_header[index].used = true; return index; @@ -342,7 +348,7 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt) heth = &dev_data->heth; total_len = net_pkt_get_len(pkt); - if (total_len > (ETH_MAX_PACKET_SIZE * ETH_TX_DESC_CNT)) { + if (total_len > (ETH_STM32_TX_BUF_SIZE * ETH_TXBUFNB)) { LOG_ERR("PKT too big"); return -EIO; } @@ -375,19 +381,19 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt) #if defined(CONFIG_ETH_STM32_HAL_API_V2) remaining_read = total_len; /* fill and allocate buffer until remaining data fits in one buffer */ - while (remaining_read > ETH_MAX_PACKET_SIZE) { - if (net_pkt_read(pkt, buf_header->tx_buff.buffer, ETH_MAX_PACKET_SIZE)) { + while (remaining_read > ETH_STM32_TX_BUF_SIZE) { + if (net_pkt_read(pkt, buf_header->tx_buff.buffer, ETH_STM32_TX_BUF_SIZE)) { res = -ENOBUFS; goto error; } const uint16_t next_buffer_id = allocate_tx_buffer(); - buf_header->tx_buff.len = ETH_MAX_PACKET_SIZE; + buf_header->tx_buff.len = ETH_STM32_TX_BUF_SIZE; /* append new buffer to the linked list */ buf_header->tx_buff.next = &dma_tx_buffer_header[next_buffer_id].tx_buff; /* and adjust tail pointer */ buf_header = &dma_tx_buffer_header[next_buffer_id]; - remaining_read -= ETH_MAX_PACKET_SIZE; + remaining_read -= ETH_STM32_TX_BUF_SIZE; } if (net_pkt_read(pkt, buf_header->tx_buff.buffer, remaining_read)) { res = -ENOBUFS; @@ -626,7 +632,7 @@ static struct net_pkt *eth_rx(const struct device *dev) rx_header; rx_header = rx_header->next) { const size_t index = rx_header - &dma_rx_buffer_header[0]; - __ASSERT_NO_MSG(index < ETH_RX_DESC_CNT); + __ASSERT_NO_MSG(index < ETH_RXBUFNB); if (net_pkt_write(pkt, dma_rx_buffer[index], rx_header->size)) { LOG_ERR("Failed to append RX buffer to context buffer"); net_pkt_unref(pkt); @@ -963,7 +969,7 @@ static int eth_initialize(const struct device *dev) #if defined(CONFIG_ETH_STM32_HAL_API_V2) heth->Init.TxDesc = dma_tx_desc_tab; heth->Init.RxDesc = dma_rx_desc_tab; - heth->Init.RxBuffLen = ETH_MAX_PACKET_SIZE; + heth->Init.RxBuffLen = ETH_STM32_RX_BUF_SIZE; #endif /* CONFIG_ETH_STM32_HAL_API_V2 */ hal_ret = HAL_ETH_Init(heth); @@ -1029,16 +1035,16 @@ static int eth_initialize(const struct device *dev) #if defined(CONFIG_ETH_STM32_HAL_API_V2) /* prepare tx buffer header */ - for (uint16_t i = 0; i < ETH_TX_DESC_CNT; ++i) { + for (uint16_t i = 0; i < ETH_TXBUFNB; ++i) { dma_tx_buffer_header[i].tx_buff.buffer = dma_tx_buffer[i]; } hal_ret = HAL_ETH_Start_IT(heth); #else HAL_ETH_DMATxDescListInit(heth, dma_tx_desc_tab, - &dma_tx_buffer[0][0], ETH_TX_DESC_CNT); + &dma_tx_buffer[0][0], ETH_TXBUFNB); HAL_ETH_DMARxDescListInit(heth, dma_rx_desc_tab, - &dma_rx_buffer[0][0], ETH_RX_DESC_CNT); + &dma_rx_buffer[0][0], ETH_RXBUFNB); hal_ret = HAL_ETH_Start(heth); #endif /* CONFIG_ETH_STM32_HAL_API_V2 */ @@ -1325,14 +1331,14 @@ static struct eth_stm32_hal_dev_data eth0_data = { ETH_CHECKSUM_BY_HARDWARE : ETH_CHECKSUM_BY_SOFTWARE, #endif /* !CONFIG_SOC_SERIES_STM32H7X */ .MediaInterface = IS_ENABLED(CONFIG_ETH_STM32_HAL_MII) ? - HAL_ETH_MII_MODE : HAL_ETH_RMII_MODE, + ETH_MEDIA_INTERFACE_MII : ETH_MEDIA_INTERFACE_RMII, }, }, }; ETH_NET_DEVICE_DT_INST_DEFINE(0, eth_initialize, NULL, ð0_data, ð0_config, - CONFIG_ETH_INIT_PRIORITY, ð_api, NET_ETH_MTU); + CONFIG_ETH_INIT_PRIORITY, ð_api, ETH_STM32_HAL_MTU); #if defined(CONFIG_PTP_CLOCK_STM32_HAL) diff --git a/drivers/ethernet/eth_stm32_hal_priv.h b/drivers/ethernet/eth_stm32_hal_priv.h index 2957f13d5ecaa..4aef0389d4097 100644 --- a/drivers/ethernet/eth_stm32_hal_priv.h +++ b/drivers/ethernet/eth_stm32_hal_priv.h @@ -22,7 +22,12 @@ #define ST_OUI_B1 0x80 #define ST_OUI_B2 0xE1 -#define ETH_STM32_HAL_FRAME_SIZE_MAX (NET_ETH_MTU + 18) +#define ETH_STM32_HAL_MTU NET_ETH_MTU +#define ETH_STM32_HAL_FRAME_SIZE_MAX (ETH_STM32_HAL_MTU + 18) + +/* Definition of the Ethernet driver buffers size and count */ +#define ETH_STM32_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */ +#define ETH_STM32_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */ /* Device constant configuration parameters */ struct eth_stm32_hal_dev_cfg { From b93a51ae78353e285bdf1e49d2e8120afb93ce9d Mon Sep 17 00:00:00 2001 From: Akshay James Date: Tue, 12 Nov 2024 21:42:41 +0530 Subject: [PATCH 2315/4482] doc: fix typo in blackpill_f401cc docs Fix the text and links where it mentions 'blackpill_f401ce' instead of 'blackpill_f401cc'. Signed-off-by: Akshay James --- boards/weact/blackpill_f401cc/doc/index.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boards/weact/blackpill_f401cc/doc/index.rst b/boards/weact/blackpill_f401cc/doc/index.rst index ff6ef271f700b..e5ea1e7f699c7 100644 --- a/boards/weact/blackpill_f401cc/doc/index.rst +++ b/boards/weact/blackpill_f401cc/doc/index.rst @@ -37,7 +37,7 @@ hardware components: Supported Features ================== -The Zephyr blackpill_f401ce board configuration supports the following +The Zephyr blackpill_f401cc board configuration supports the following hardware features: +------------+------------+-------------------------------------+ @@ -65,7 +65,7 @@ hardware features: +------------+------------+-------------------------------------+ The default configuration can be found in -:zephyr_file:`boards/weact/blackpill_f401ce/blackpill_f401ce_defconfig` +:zephyr_file:`boards/weact/blackpill_f401cc/blackpill_f401cc_defconfig` Pin Mapping =========== From 1a5ae376a3f93312fd85016464a8b6221c554c14 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Tue, 12 Nov 2024 10:16:12 -0600 Subject: [PATCH 2316/4482] doc: release-notes-4.0: Add DT 4.0 notes Add release notes for DT area for zephyr 4.0. Signed-off-by: Declan Snyder --- doc/releases/release-notes-4.0.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index fbd2562db09d5..316f5310eceeb 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -1017,6 +1017,19 @@ USB Devicetree ********** +* Added support for string-array and array type properties to be enums. + Many new macros added for this, for example :c:macro:`DT_ENUM_IDX_BY_IDX`. +* Added :c:macro:`DT_ANY_COMPAT_HAS_PROP_STATUS_OKAY`. +* Added :c:macro:`DT_NODE_HAS_STATUS_OKAY`. +* Added :c:macro:`DT_INST_NUM_IRQS`. +* Added macros :c:macro:`DT_NODE_FULL_NAME_UNQUOTED`, :c:macro:`DT_NODE_FULL_NAME_TOKEN`, + and :c:macro:`DT_NODE_FULL_NAME_UPPER_TOKEN`. +* ``DT_*_REG_ADDR`` now returns an explicit unsigned value with C's ``U`` suffix. +* Fixed escaping of double quotes, backslashes, and new line characters from DTS + so that they can be used in string properties. +* Renamed ``power-domain`` base property to ``power-domains``, + and introduced ``power-domain-names`` property. ``#power-domain-cells`` is now required as well. + Kconfig ******* From 1175f5764057f6976a92df8cc971a14c16293be6 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Wed, 13 Nov 2024 17:54:07 +0700 Subject: [PATCH 2317/4482] doc: fix typo in multiple directories before v4.0.0 release Utilize a code spell-checking tool to scan for and correct spelling errors in various files within the `doc` directory. Signed-off-by: Pisit Sawangvonganan --- doc/connectivity/networking/network_tracing.rst | 2 +- doc/contribute/documentation/guidelines.rst | 2 +- doc/develop/toolchains/cadence_xcc.rst | 2 +- doc/hardware/arch/arm-scmi.rst | 4 ++-- doc/releases/migration-guide-4.0.rst | 2 +- doc/releases/release-notes-4.0.rst | 6 +++--- doc/services/smf/index.rst | 2 +- doc/services/storage/zms/zms.rst | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/connectivity/networking/network_tracing.rst b/doc/connectivity/networking/network_tracing.rst index d3655ee037c2c..87f4a46a6fa9c 100644 --- a/doc/connectivity/networking/network_tracing.rst +++ b/doc/connectivity/networking/network_tracing.rst @@ -9,7 +9,7 @@ Network Tracing User can enable network core stack and socket API calls tracing. -The :kconfig:option:`CONFIG_TRACING_NET_CORE` option contols the core network +The :kconfig:option:`CONFIG_TRACING_NET_CORE` option controls the core network stack tracing. This option is enabled by default if tracing and networking are enabled. The system will start to collect the receiving and sending call verdicts i.e., whether the network packet was successfully sent or received. diff --git a/doc/contribute/documentation/guidelines.rst b/doc/contribute/documentation/guidelines.rst index 7458ca0a33cb7..468b8cecede58 100644 --- a/doc/contribute/documentation/guidelines.rst +++ b/doc/contribute/documentation/guidelines.rst @@ -796,7 +796,7 @@ Application build commands :board: qemu_x86 :goals: build - This wil render as: + This will render as: .. zephyr-app-commands:: :zephyr-app: samples/hello_world diff --git a/doc/develop/toolchains/cadence_xcc.rst b/doc/develop/toolchains/cadence_xcc.rst index 5826985f56d41..a3425bcd22341 100644 --- a/doc/develop/toolchains/cadence_xcc.rst +++ b/doc/develop/toolchains/cadence_xcc.rst @@ -62,7 +62,7 @@ Cadence Tensilica Xtensa C/C++ Compiler (XCC) export XTENSA_CORE=ace10_LX7HiFi4_2022_10 export TOOLCHAIN_VER=RI-2022.10-linux - #. Muiltiple SoCs: + #. Multiple SoCs: .. code-block:: console diff --git a/doc/hardware/arch/arm-scmi.rst b/doc/hardware/arch/arm-scmi.rst index 6d6259987d65c..65dad1bffce65 100644 --- a/doc/hardware/arch/arm-scmi.rst +++ b/doc/hardware/arch/arm-scmi.rst @@ -142,9 +142,9 @@ Currently, Zephyr has support for the following standard protocols: Clock management protocol ************************* -This protocol is used to perfrom clock management operations. This is done +This protocol is used to perform clock management operations. This is done via a driver (:file:`drivers/clock_control/clock_control_arm_scmi.c`), which -implements the Zephyr clock control subsytem API. As such, from the user's +implements the Zephyr clock control subsystem API. As such, from the user's perspective, using this driver is no different than using any other clock management driver. diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 3561d142af472..0503995eac174 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -368,7 +368,7 @@ Bluetooth Audio :kconfig:option:`CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT` to reflect that they now serve as a compile-time maximum configuration of ASEs to be used. :c:func:`bt_bap_unicast_server_register` needs to be called once before using the Unicast Server, - and more specfically prior to calling :c:func:`bt_bap_unicast_server_register_cb` for the first + and more specifically prior to calling :c:func:`bt_bap_unicast_server_register_cb` for the first time. It does not need to be called again until the new function :c:func:`bt_bap_unicast_server_unregister` has been called. (:github:`76632`) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 316f5310eceeb..664b7e885e419 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -509,7 +509,7 @@ Drivers and Sensors * I3C - * Added support for SETAASA optmization during initialization. Added a + * Added support for SETAASA optimization during initialization. Added a ``supports-setaasa`` property to ``i3c-devices.yaml``. * Added sending DEFTGTS if any devices that support functioning as a secondary controller on the bus. @@ -1070,7 +1070,7 @@ Libraries / Subsystems * :c:func:`hawkbit_autohandler` now takes one argument. If the argument is set to true, the autohandler will reshedule itself after running. If the argument is set to false, the - autohandler will not reshedule itself. Both variants are sheduled independent of each other. + autohandler will not reshedule itself. Both variants are scheduled independent of each other. The autohandler always runs in the system workqueue. * Use the :c:func:`hawkbit_autohandler_wait` function to wait for the autohandler to finish. @@ -1271,7 +1271,7 @@ MCUboot * Added zephyr prefix to generated header path. * Added optional img mgmt slot info feature. * Added bootutil support for maximum image size details for additional images. - * Added support for automatically calculcating max sectors. + * Added support for automatically calculating max sectors. * Added missing ``boot_enc_init()`` function. * Added support for keeping image encrypted in scratch area in bootutil. * Fixed serial recovery for NXP IMX.RT, LPC55x and MCXNx platforms diff --git a/doc/services/smf/index.rst b/doc/services/smf/index.rst index 9b5ee62af7642..f752772d08059 100644 --- a/doc/services/smf/index.rst +++ b/doc/services/smf/index.rst @@ -335,7 +335,7 @@ Code:: /* Child states do not have entry or exit actions */ [S0] = SMF_CREATE_STATE(NULL, s0_run, NULL, &demo_states[PARENT], NULL), [S1] = SMF_CREATE_STATE(NULL, s1_run, NULL, &demo_states[PARENT], NULL), - /* State S2 do ot have entry or exit actions and no parent */ + /* State S2 do not have entry or exit actions and no parent */ [S2] = SMF_CREATE_STATE(NULL, s2_run, NULL, NULL, NULL), }; diff --git a/doc/services/storage/zms/zms.rst b/doc/services/storage/zms/zms.rst index 02fed3cf77c4d..3523bfc5eae02 100644 --- a/doc/services/storage/zms/zms.rst +++ b/doc/services/storage/zms/zms.rst @@ -367,7 +367,7 @@ Version1 - Supports 32-bit IDs to store ID/Value pairs - Small sized data ( <= 8 bytes) are stored in the ATE itself - Built-in Data CRC32 (included in the ATE) -- Versionning of ZMS (to handle future evolution) +- Versioning of ZMS (to handle future evolution) - Supports large write-block-size (Only for platforms that need this) Future features From dee76a7907e7518b7bb91772cdb7084500ad6d97 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 8 Nov 2024 16:48:52 +0000 Subject: [PATCH 2318/4482] boards: nxp: mimxrt1170_evk: document flash support for EVKB Flash support for RT1170 EVKB was fixed with cfb73221076 (drivers: flash: flash_mcux_flexspi: add support for W25Q512NW-IQ/IN). Document this support in the board page. Signed-off-by: Daniel DeGrasse --- boards/nxp/mimxrt1170_evk/doc/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/nxp/mimxrt1170_evk/doc/index.rst b/boards/nxp/mimxrt1170_evk/doc/index.rst index 870d7da7b637b..05fda1a60c7ee 100644 --- a/boards/nxp/mimxrt1170_evk/doc/index.rst +++ b/boards/nxp/mimxrt1170_evk/doc/index.rst @@ -157,7 +157,7 @@ RT1170 EVKB (``mimxrt1170_evk@B//cm7/cm4``) +-----------+------------+-------------------------------------+-----------------+-----------------+ | CAAM RNG | on-chip | entropy | Supported (M7) | No support | +-----------+------------+-------------------------------------+-----------------+-----------------+ -| FLEXSPI | on-chip | flash programming | Supported (M7) | No support | +| FLEXSPI | on-chip | flash programming | Supported (M7) | Supported (M7) | +-----------+------------+-------------------------------------+-----------------+-----------------+ | SDHC | on-chip | SD host controller | Supported (M7) | Supported (M7) | +-----------+------------+-------------------------------------+-----------------+-----------------+ From 44e0edcf1b50c8bfdad0d88e165300b684420ee2 Mon Sep 17 00:00:00 2001 From: David Brown Date: Wed, 13 Nov 2024 09:10:22 -0700 Subject: [PATCH 2319/4482] submanifests: optional: rust: Limit build targets Brings in a change in the v4.0-branch branch to limit the targets that rust tests are run on to those that have been tested. This will avoid a large number of failure in the nightly build on platforms that aren't expected to work. Signed-off-by: David Brown --- submanifests/optional.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submanifests/optional.yaml b/submanifests/optional.yaml index d7dd59b3669a9..c9e185d40c3d4 100644 --- a/submanifests/optional.yaml +++ b/submanifests/optional.yaml @@ -34,7 +34,7 @@ manifest: groups: - optional - name: zephyr-lang-rust - revision: f20afb5bae9a4b64332a230a734c0244b39d4035 + revision: 7af3db47bf7335ac6a6fe7480df6b41fb46dbe9d path: modules/lang/rust remote: upstream groups: From 40cd35e56d43716bdbdeafafa6c356407121ca2e Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Wed, 13 Nov 2024 12:29:33 -0300 Subject: [PATCH 2320/4482] west.yml: espressif: fix mcuboot assert in hal Espressif contains mcuboot calls for loading image. This fixes the way assert call is included in that scenario. Fixes #81351 Signed-off-by: Sylvio Alves --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 615bc3eb44622..87657ebf6df36 100644 --- a/west.yml +++ b/west.yml @@ -157,7 +157,7 @@ manifest: groups: - hal - name: hal_espressif - revision: 174547ef6a97dafcd6786ecd171cc701f5c0893b + revision: 07ff57e8d197765652b7819b297415d859ed7815 path: modules/hal/espressif west-commands: west/west-commands.yml groups: From 9f5ef471849a7611552d9332b7ad412e8e2e8721 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Wed, 13 Nov 2024 09:35:08 -0500 Subject: [PATCH 2321/4482] ci: twister: also report filtered instances For statistical purposes and to improve over all coverage, report filtered suites so we can see trends in elasticsearch and act on them. Signed-off-by: Anas Nashif --- .github/workflows/twister.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/twister.yaml b/.github/workflows/twister.yaml index 84fa06390585e..e893e2fa2f015 100644 --- a/.github/workflows/twister.yaml +++ b/.github/workflows/twister.yaml @@ -148,7 +148,7 @@ jobs: TWISTER_COMMON: ' --force-color --inline-logs -v -N -M --retry-failed 3 --timeout-multiplier 2 ' DAILY_OPTIONS: ' -M --build-only --all --show-footprint' PR_OPTIONS: ' --clobber-output --integration' - PUSH_OPTIONS: ' --clobber-output -M --show-footprint' + PUSH_OPTIONS: ' --clobber-output -M --show-footprint --report-filtered' COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} BASE_REF: ${{ github.base_ref }} steps: From 7498329d59b64cd407ced13a8daf478253635e5d Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Tue, 12 Nov 2024 16:59:22 -0600 Subject: [PATCH 2322/4482] random: remove deprecated rand32.h Header file was kept for 2 releases, time to remove it. Signed-off-by: Mahesh Mahadevan --- doc/releases/release-notes-4.0.rst | 3 +++ include/zephyr/random/rand32.h | 15 --------------- 2 files changed, 3 insertions(+), 15 deletions(-) delete mode 100644 include/zephyr/random/rand32.h diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 664b7e885e419..fab09c239bc03 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -42,6 +42,9 @@ API Changes * Deprecated ``EARLY``, ``APPLICATION`` and ``SMP`` init levels can no longer be used for devices. +* Removed deprecated header file + ``include/zephyr/random/rand32.h``. ``random.h`` needs to be included now. + Removed APIs in this release ============================ diff --git a/include/zephyr/random/rand32.h b/include/zephyr/random/rand32.h deleted file mode 100644 index cb9ef54ca63a8..0000000000000 --- a/include/zephyr/random/rand32.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) 2013-2014 Wind River Systems, Inc. - * Copyright (c) 2023 Intel Corporation - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_INCLUDE_RANDOM_RAND32_H_ -#define ZEPHYR_INCLUDE_RANDOM_RAND32_H_ - -#include - -#warning " is deprecated, include instead" - -#endif /* ZEPHYR_INCLUDE_RANDOM_RAND32_H_ */ From d9bfdaf996c63ce14ad1bc68b8d51784b96c9f48 Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Tue, 12 Nov 2024 16:07:55 -0600 Subject: [PATCH 2323/4482] bluetooth: kconfig: Remove deprecated config Remove deprecated Kconfig BT_MESH_PROV_DEVICE Signed-off-by: Mahesh Mahadevan --- subsys/bluetooth/mesh/Kconfig | 9 --------- 1 file changed, 9 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 37f15191c771c..e300e18d799ea 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -325,15 +325,6 @@ config BT_MESH_PB_GATT_CLIENT endif # BT_CONN -config BT_MESH_PROV_DEVICE - bool "[DEPRECATED] Provisioning device role support" - select DEPRECATED - select BT_MESH_PROVISIONEE - help - Enable this option to allow the device to be provisioned into a mesh network. - The option is marked as deprecated and will be replaced by BT_MESH_PROVISIONEE - option. - config BT_MESH_PROVISIONEE bool "Provisionee role support" depends on BT_MESH_PB_ADV || BT_MESH_PB_GATT From d267402404138b224b0c7b493bad6138e1b02cd6 Mon Sep 17 00:00:00 2001 From: Jimmy Zheng Date: Thu, 14 Nov 2024 07:33:22 +0800 Subject: [PATCH 2324/4482] tests: drivers: build_all: eeprom: fix label name conflict Renamed the label of 'ti_tmp116_eeprom@0' node because 'eeprom' label name already exists in some boards, such as adp_xc7k/ae350, bytesensi_l, same54_xpro. Signed-off-by: Jimmy Zheng --- tests/drivers/build_all/eeprom/app.overlay | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/drivers/build_all/eeprom/app.overlay b/tests/drivers/build_all/eeprom/app.overlay index 9ec89f1cdbafa..b861c382ff4da 100644 --- a/tests/drivers/build_all/eeprom/app.overlay +++ b/tests/drivers/build_all/eeprom/app.overlay @@ -59,7 +59,7 @@ #address-cells = <1>; #size-cells = <0>; - eeprom: ti_tmp116_eeprom@0 { + test_tmp116_eeprom: ti_tmp116_eeprom@0 { compatible = "ti,tmp116-eeprom"; reg = <0x0>; read-only; From de3a845612b6d4f5be53e79525c4b3d82521824c Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Sun, 10 Nov 2024 13:51:02 +0800 Subject: [PATCH 2325/4482] arch: riscv: add macro to access hardware registers Add macros to read / write hardware registers. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- include/zephyr/arch/riscv/reg.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 include/zephyr/arch/riscv/reg.h diff --git a/include/zephyr/arch/riscv/reg.h b/include/zephyr/arch/riscv/reg.h new file mode 100644 index 0000000000000..6d3b2d88b1755 --- /dev/null +++ b/include/zephyr/arch/riscv/reg.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2024 Meta Platforms + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_ZEPHYR_ARCH_RISCV_REG_H_ +#define ZEPHYR_INCLUDE_ZEPHYR_ARCH_RISCV_REG_H_ + +#define reg_read(reg) \ + ({ \ + register unsigned long __rv; \ + __asm__ volatile("mv %0, " STRINGIFY(reg) : "=r"(__rv)); \ + __rv; \ + }) + +#define reg_write(reg, val) ({ __asm__("mv " STRINGIFY(reg) ", %0" : : "r"(val)); }) + +#endif /* ZEPHYR_INCLUDE_ZEPHYR_ARCH_RISCV_REG_H_ */ From e30db2d53fb36c7c75f52fdfd1a23e2988056482 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Sat, 9 Nov 2024 02:15:21 +0800 Subject: [PATCH 2326/4482] arch: riscv: reset global pointer on exception Reset the gp on exception entry from u-mode to protect the kernel against a possible rogue user thread. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- arch/riscv/core/isr.S | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/riscv/core/isr.S b/arch/riscv/core/isr.S index 65c40e63456e1..5ac71fe17b473 100644 --- a/arch/riscv/core/isr.S +++ b/arch/riscv/core/isr.S @@ -163,6 +163,14 @@ SECTION_FUNC(exception.entry, _isr_wrapper) lr t0, ___cpu_t_current_OFFSET(s0) lr tp, _thread_offset_to_tls(t0) + /* Make sure global pointer is sane */ +#ifdef CONFIG_RISCV_GP + .option push + .option norelax + la gp, __global_pointer$ + .option pop +#endif /* CONFIG_RISCV_GP */ + /* Clear our per-thread usermode flag */ lui t0, %tprel_hi(is_user_mode) add t0, t0, tp, %tprel_add(is_user_mode) From 408c151282a4eac221df8876756dd1ace009509a Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Sun, 10 Nov 2024 14:03:35 +0800 Subject: [PATCH 2327/4482] tests: arch: riscv: make sure that `gp` reg can't be corrupted Add a test to make sure that the `gp` global pointer register used for relative addressing when `CONFIG_RISCV_GP` is enabled can't be corrupted by a rogue user thread. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- .../riscv/userspace/riscv_gp/CMakeLists.txt | 8 ++++ tests/arch/riscv/userspace/riscv_gp/prj.conf | 3 ++ .../arch/riscv/userspace/riscv_gp/src/main.c | 47 +++++++++++++++++++ .../riscv/userspace/riscv_gp/testcase.yaml | 8 ++++ 4 files changed, 66 insertions(+) create mode 100644 tests/arch/riscv/userspace/riscv_gp/CMakeLists.txt create mode 100644 tests/arch/riscv/userspace/riscv_gp/prj.conf create mode 100644 tests/arch/riscv/userspace/riscv_gp/src/main.c create mode 100644 tests/arch/riscv/userspace/riscv_gp/testcase.yaml diff --git a/tests/arch/riscv/userspace/riscv_gp/CMakeLists.txt b/tests/arch/riscv/userspace/riscv_gp/CMakeLists.txt new file mode 100644 index 0000000000000..04987303450f5 --- /dev/null +++ b/tests/arch/riscv/userspace/riscv_gp/CMakeLists.txt @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(riscv_gp) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/arch/riscv/userspace/riscv_gp/prj.conf b/tests/arch/riscv/userspace/riscv_gp/prj.conf new file mode 100644 index 0000000000000..1f8e1275be3e2 --- /dev/null +++ b/tests/arch/riscv/userspace/riscv_gp/prj.conf @@ -0,0 +1,3 @@ +CONFIG_ZTEST=y +CONFIG_RISCV_GP=y +CONFIG_TEST_USERSPACE=y diff --git a/tests/arch/riscv/userspace/riscv_gp/src/main.c b/tests/arch/riscv/userspace/riscv_gp/src/main.c new file mode 100644 index 0000000000000..76a9ecffc22f7 --- /dev/null +++ b/tests/arch/riscv/userspace/riscv_gp/src/main.c @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Meta Platforms + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include +#include + +#define ROGUE_USER_STACK_SZ 2048 + +static struct k_thread rogue_user_thread; +static K_THREAD_STACK_DEFINE(rogue_user_stack, ROGUE_USER_STACK_SZ); + +static void rogue_user_fn(void *p1, void *p2, void *p3) +{ + zassert_true(k_is_user_context()); + + reg_write(gp, 0xbad); + zassert_equal(reg_read(gp), 0xbad); +} + +ZTEST_USER(riscv_gp, test_gp_value) +{ + uintptr_t gp_val = reg_read(gp); + k_tid_t th; + + zassert_not_equal(gp_val, 0); + + th = k_thread_create(&rogue_user_thread, rogue_user_stack, ROGUE_USER_STACK_SZ, + rogue_user_fn, NULL, NULL, NULL, -1, K_USER, K_NO_WAIT); + zassert_ok(k_thread_join(th, K_FOREVER)); + + zassert_equal(reg_read(gp), gp_val, "`gp` corrupted by user thread"); +} + +static void *userspace_setup(void) +{ + k_thread_access_grant(k_current_get(), &rogue_user_thread, &rogue_user_stack); + + return NULL; +} + +ZTEST_SUITE(riscv_gp, NULL, userspace_setup, NULL, NULL, NULL); diff --git a/tests/arch/riscv/userspace/riscv_gp/testcase.yaml b/tests/arch/riscv/userspace/riscv_gp/testcase.yaml new file mode 100644 index 0000000000000..5b1345abc5475 --- /dev/null +++ b/tests/arch/riscv/userspace/riscv_gp/testcase.yaml @@ -0,0 +1,8 @@ +common: + ignore_faults: true + ignore_qemu_crash: true + tags: kernel riscv + platform_allow: + - qemu_riscv64 +tests: + arch.riscv64.riscv_gp: {} From 241c7b3fb793d99ead07deac1ec6ea13d9a43eff Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 9 Nov 2024 14:00:08 +0900 Subject: [PATCH 2328/4482] arch: arc: Fixed an error in include-guard Fixed definitions duplicated with those in `include/zephyr/arch/xtensa/arch_inlines.h`. Signed-off-by: TOKITA Hiroshi --- include/zephyr/arch/arc/arch_inlines.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/zephyr/arch/arc/arch_inlines.h b/include/zephyr/arch/arc/arch_inlines.h index 1d1e0b92cbdc5..b15888fb789ad 100644 --- a/include/zephyr/arch/arc/arch_inlines.h +++ b/include/zephyr/arch/arc/arch_inlines.h @@ -5,8 +5,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_ARCH_XTENSA_ARCH_INLINES_H_ -#define ZEPHYR_INCLUDE_ARCH_XTENSA_ARCH_INLINES_H_ +#ifndef ZEPHYR_INCLUDE_ARCH_ARC_ARCH_INLINES_H_ +#define ZEPHYR_INCLUDE_ARCH_ARC_ARCH_INLINES_H_ #ifndef _ASMLANGUAGE @@ -42,4 +42,4 @@ static ALWAYS_INLINE unsigned int arch_num_cpus(void) } #endif /* !_ASMLANGUAGE */ -#endif /* ZEPHYR_INCLUDE_ARCH_XTENSA_ARCH_INLINES_H_ */ +#endif /* ZEPHYR_INCLUDE_ARCH_ARC_ARCH_INLINES_H_ */ From 9e51f1a75456dac9d7a7c0a218545298590cccbd Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 9 Nov 2024 14:06:24 +0900 Subject: [PATCH 2329/4482] drivers: sensor: mmc56x3: Fixed an error in include-guard Fixed definitions duplicated with those in `include/zephyr/drivers/sensor/tsl2591.h`. Signed-off-by: TOKITA Hiroshi --- include/zephyr/drivers/sensor/mmc56x3.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/zephyr/drivers/sensor/mmc56x3.h b/include/zephyr/drivers/sensor/mmc56x3.h index d255e382d8b80..b59ea4a4155b6 100644 --- a/include/zephyr/drivers/sensor/mmc56x3.h +++ b/include/zephyr/drivers/sensor/mmc56x3.h @@ -12,8 +12,8 @@ * setting the continuous mode and bandwidth selection bits. */ -#ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_TSL2591_H_ -#define ZEPHYR_INCLUDE_DRIVERS_SENSOR_TSL2591_H_ +#ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_MMC56X3_H_ +#define ZEPHYR_INCLUDE_DRIVERS_SENSOR_MMC56X3_H_ #include @@ -48,4 +48,4 @@ enum sensor_attribute_mmc56x3 { } #endif -#endif /* ZEPHYR_INCLUDE_DRIVERS_SENSOR_TSL2591_H_ */ +#endif /* ZEPHYR_INCLUDE_DRIVERS_SENSOR_MMC56X3_H_ */ From c0a0e6a3887c53e5519ae5b30352b39cf7e9288f Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Wed, 13 Nov 2024 13:09:32 +0200 Subject: [PATCH 2330/4482] doc: release-notes-4.0: add release notes for firmware subsystem Includes notes on SCMI's introduction. Signed-off-by: Laurentiu Mihalcea --- doc/releases/release-notes-4.0.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index fab09c239bc03..afeddfeb6f42f 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -1209,6 +1209,14 @@ Libraries / Subsystems (:github:`79653`) +* Firmware + + * Introduced basic support for ARM's System Control and Management Interface, which includes: + + * Subset of clock management protocol commands + * Subset of pin control protocol commands + * Shared memory and mailbox-based transport + HALs **** From f7ff83079fcb0216b6a44a5188d4e0ecd8f839b7 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Thu, 14 Nov 2024 10:50:54 +0000 Subject: [PATCH 2331/4482] github: west_cmds: add missing anytree package Add missing anytree package, runners started to fail on it: ../pylib/twister/twisterlib/runner.py:60: in from anytree import Node, RenderTree E ModuleNotFoundError: No module named 'anytree' Signed-off-by: Fabio Baltieri --- .github/workflows/west_cmds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/west_cmds.yml b/.github/workflows/west_cmds.yml index 73d942cadfe3d..d7b671bc7e7f1 100644 --- a/.github/workflows/west_cmds.yml +++ b/.github/workflows/west_cmds.yml @@ -66,7 +66,7 @@ jobs: - name: install pytest run: | pip3 install wheel - pip3 install pytest west pyelftools canopen natsort progress mypy intelhex psutil ply pyserial + pip3 install pytest west pyelftools canopen natsort progress mypy intelhex psutil ply pyserial anytree - name: run pytest-win if: runner.os == 'Windows' run: | From 876b44d1500da9165ab2148b9aaca775262cce6a Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Thu, 14 Nov 2024 08:55:24 +0100 Subject: [PATCH 2332/4482] soc: mediatek: mt8195_adsp: add support for LLEXT build The linker script for this SoC was not including the LLEXT section definitions when CONFIG_LLEXT was enabled. This patch adds the missing include directive to the linker script. Signed-off-by: Luca Burelli --- soc/mediatek/mtk_adsp/mt8195_adsp/linker.ld | 3 +++ 1 file changed, 3 insertions(+) diff --git a/soc/mediatek/mtk_adsp/mt8195_adsp/linker.ld b/soc/mediatek/mtk_adsp/mt8195_adsp/linker.ld index 37e11375c3b4f..b58b91e5dc97f 100644 --- a/soc/mediatek/mtk_adsp/mt8195_adsp/linker.ld +++ b/soc/mediatek/mtk_adsp/mt8195_adsp/linker.ld @@ -136,4 +136,7 @@ SECTIONS { */ #include +#ifdef CONFIG_LLEXT +#include +#endif } /* SECTIONS */ From 7f8b531d4c398251d85e20c2dc1cbc1858ab71e2 Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Thu, 14 Nov 2024 10:47:26 +0100 Subject: [PATCH 2333/4482] drivers: serial: gecko: Fix build error on Series 0 Series 0 does not have the TXIDLE status flag. The closest equivalent is TXC, but it isn't set until the first transmission completes, and is therefore not safe to use in PM suspend without also separately keeping track of whether the driver has ever initiated a transmission. For now, disable the TXIDLE check on devices that don't support it as a minimal fix for the observed build error. This is effectively equivalent to reverting the addition of PM support for these devices only. Since these devices don't have a low-power system timer implementation anyway, the lack of PM handling does not hurt anything. Signed-off-by: Aksel Skauge Mellbye --- drivers/serial/uart_gecko.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/serial/uart_gecko.c b/drivers/serial/uart_gecko.c index 11c396bcd9f1f..32d3c71c910c1 100644 --- a/drivers/serial/uart_gecko.c +++ b/drivers/serial/uart_gecko.c @@ -492,13 +492,15 @@ static int uart_gecko_init(const struct device *dev) #ifdef CONFIG_PM_DEVICE static int uart_gecko_pm_action(const struct device *dev, enum pm_device_action action) { - const struct uart_gecko_config *config = dev->config; + __maybe_unused const struct uart_gecko_config *config = dev->config; switch (action) { case PM_DEVICE_ACTION_SUSPEND: +#ifdef USART_STATUS_TXIDLE /* Wait for TX FIFO to flush before suspending */ while (!(USART_StatusGet(config->base) & USART_STATUS_TXIDLE)) { } +#endif break; case PM_DEVICE_ACTION_RESUME: From 07df2c5d5e59abd9684721f4f282461b56516cb6 Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Thu, 14 Nov 2024 08:55:24 +0100 Subject: [PATCH 2334/4482] soc: sensry: sy1xx: add support for LLEXT build The linker script for this SoC was not including the LLEXT section definitions when CONFIG_LLEXT was enabled. This patch adds the necessary include directive to the linker script and fixes the build issue identified by CI. Signed-off-by: Luca Burelli --- soc/sensry/ganymed/sy1xx/common/linker.ld | 3 +++ 1 file changed, 3 insertions(+) diff --git a/soc/sensry/ganymed/sy1xx/common/linker.ld b/soc/sensry/ganymed/sy1xx/common/linker.ld index 49b38680a4160..c9a08957c8101 100644 --- a/soc/sensry/ganymed/sy1xx/common/linker.ld +++ b/soc/sensry/ganymed/sy1xx/common/linker.ld @@ -78,6 +78,9 @@ SECTIONS #include + #ifdef CONFIG_LLEXT + #include + #endif SECTION_PROLOGUE(.plt,,) { From d0ea9d5243465ca2a3586f5062e42cc7f718c386 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Thu, 14 Nov 2024 12:42:57 +0100 Subject: [PATCH 2335/4482] doc: release-notes-4.0: add release notes for USB Add release notes for USB support. Signed-off-by: Johann Fischer --- doc/releases/release-notes-4.0.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index afeddfeb6f42f..550431b14fde9 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -717,6 +717,8 @@ Drivers and Sensors * USB * Added support for USB HS on STM32U59x/STM32U5Ax SoC variants. + * Enhanced DWC2 UDC driver + * Added UDC drivers for Smartbond, NuMaker USBD and RP2040 device controllers * Video @@ -1017,6 +1019,13 @@ Networking USB *** +* New USB device stack: + + * Added USB CDC Network Control Model implementation + * Enhanced USB Audio class 2 implementation + * Made USB device stack high-bandwidth aware + * Enhanced CDC ACM and HID class implementations + Devicetree ********** From 2f81bbbdf86ab0781724b7d684f466b0da2412af Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Thu, 14 Nov 2024 13:31:43 +0100 Subject: [PATCH 2336/4482] doc: release: doc comparator API as major enhancement Add entry in "Major enhancements with this release include:" for comparator device driver subsystem. Signed-off-by: Bjarki Arge Andreasen --- doc/releases/release-notes-4.0.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 550431b14fde9..e3276e2592c27 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -13,6 +13,12 @@ Major enhancements with this release include: PSA Secure Storage API and of persistent keys in the PSA Crypto API on all board targets. It is now the standard way to provide device-specific protection to data at rest. (:github:`76222`) +* The introduction of the :ref:`comparator` device driver subsystem for analog + comparators, complete with shell support. It supports initial configuration through devicetree + and runtime configuration through vendor specific APIs. Initially the + :dtcompatible:`nordic,nrf-comp`, :dtcompatible:`nordic,nrf-lpcomp` and + :dtcompatible:`nxp,kinetis-acmp` are supported. + An overview of the changes required or recommended when migrating your application from Zephyr v3.7.0 to Zephyr v4.0.0 can be found in the separate :ref:`migration guide`. From a88af572f4c6047295cf31c548796d49c07adb59 Mon Sep 17 00:00:00 2001 From: Ricardo Rivera-Matos Date: Thu, 14 Nov 2024 10:14:58 -0600 Subject: [PATCH 2337/4482] doc: releases: 4.0: Adds Haptics notes Introduces haptics subsystem and DRV2605 support in the release notes. Signed-off-by: Ricardo Rivera-Matos --- doc/releases/release-notes-4.0.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index e3276e2592c27..5bb993bd5a4ae 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -508,6 +508,12 @@ Drivers and Sensors * Hardware info +* Haptics + + * Introduced a haptics device driver subsystem selected with :kconfig:option:`CONFIG_HAPTICS` + * Added support for TI DRV2605 haptic driver IC (:dtcompatible:`ti,drv2605`) + * Added a sample for the DRV2605 haptic driver to trigger ROM events (:zephyr:code-sample:`drv2605`) + * I2C * Added initial support for Renesas RA8 I2C driver (:dtcompatible:`renesas,ra-iic`) From 4ddef9fc0fa48d2254e1219b32527e19f9ed27e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Thu, 14 Nov 2024 18:14:52 +0100 Subject: [PATCH 2338/4482] boards: lilygo: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the LilyGO boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/lilygo/ttgo_lora32/doc/index.rst | 12 +----------- boards/lilygo/ttgo_t8c3/doc/index.rst | 11 +---------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/boards/lilygo/ttgo_lora32/doc/index.rst b/boards/lilygo/ttgo_lora32/doc/index.rst index bb80805c39b4d..4a0ae0a5dde13 100644 --- a/boards/lilygo/ttgo_lora32/doc/index.rst +++ b/boards/lilygo/ttgo_lora32/doc/index.rst @@ -1,7 +1,4 @@ -.. _ttgo_lora32: - -Lilygo TTGO LoRa32 -################## +.. zephyr:board:: ttgo_lora32 Overview ******** @@ -18,13 +15,6 @@ It's available in two versions supporting two different frequency ranges and fea Some of the ESP32 I/O pins are accessible on the board's pin headers. -.. figure:: img/ttgo_lora32.webp - :align: center - :alt: Lilygo TTGO LoRa32 module - :width: 400 px - - Lilygo TTGO LoRa32 module - Functional Description ********************** diff --git a/boards/lilygo/ttgo_t8c3/doc/index.rst b/boards/lilygo/ttgo_t8c3/doc/index.rst index a2aa6934a6d02..4179528b6af57 100644 --- a/boards/lilygo/ttgo_t8c3/doc/index.rst +++ b/boards/lilygo/ttgo_t8c3/doc/index.rst @@ -1,7 +1,4 @@ -.. _ttgo_t8c3: - -Lilygo TTGO T8-C3 -################# +.. zephyr:board:: ttgo_t8c3 Overview ******** @@ -17,12 +14,6 @@ It features the following integrated components: - JST GH 2-pin battery connector - LED -.. figure:: img/ttgo_t8c3.webp - :align: center - :alt: TTGO T8-C3 - - Lilygo TTGO T8-C3 - Functional Description ********************** This board is based on the ESP32-C3 with 4MB of flash, WiFi and BLE support. It From 3dff1a0a6f10be6c7af98e9875978f2782c71f2b Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Wed, 13 Nov 2024 10:53:08 +0100 Subject: [PATCH 2339/4482] doc: release-notes-4.0: Add camera colorbar pattern test This is added via PRs #79337 and #79263 to automatically check if a colorbar pattern generated by a camera pipeline is correct or not. Signed-off-by: Phi Bang Nguyen --- doc/releases/release-notes-4.0.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 5bb993bd5a4ae..aa3637bb1e321 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -742,6 +742,7 @@ Drivers and Sensors * Introduced missing :kconfig:option:`CONFIG_VIDEO_LOG_LEVEL` * Added a sample for capturing video and displaying it with LVGL (:zephyr:code-sample:`video-capture-to-lvgl`) + * Added an automatic test to check colorbar pattern correctness * Added support for GalaxyCore GC2145 image sensor (:dtcompatible:`gc,gc2145`) * Added support for ESP32-S3 LCD-CAM interface (:dtcompatible:`espressif,esp32-lcd-cam`) * Added support for NXP MCUX SMARTDMA interface (:dtcompatible:`nxp,smartdma`) From da8de0945a9e2925181eeabffe57de4b19ab992b Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Wed, 13 Nov 2024 11:10:39 +0100 Subject: [PATCH 2340/4482] doc: release-notes-4.0: Add fixed chicken-egg issue on NXP RT10xx Add the chicken-egg issue on init order for the camera pipeline on NXP RT10xx platforms Signed-off-by: Phi Bang Nguyen --- doc/releases/release-notes-4.0.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index aa3637bb1e321..b4b1b81999703 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -749,6 +749,8 @@ Drivers and Sensors * Added support for more OmniVision OV2640 controls (:dtcompatible:`ovti,ov2640`) * Added support for more OmniVision OV5640 controls (:dtcompatible:`ovti,ov5640`) * STM32: Implemented :c:func:`video_get_ctrl` and :c:func:`video_set_ctrl` APIs. + * Removed an init order circular dependency for the camera pipeline on NXP RT10xx platforms + (:github:`80304`) * W1 From c872b49ab01bb65608ff300906f9a5e86439fcd9 Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Wed, 13 Nov 2024 11:25:31 +0100 Subject: [PATCH 2341/4482] doc: release-notes-4.0: Add tracked issue for video-interface bindings Add link to the track the migration to the new video-interfaces bindings. Signed-off-by: Phi Bang Nguyen --- doc/releases/release-notes-4.0.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index b4b1b81999703..41f259a1f8578 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -738,7 +738,8 @@ Drivers and Sensors * Introduced API for partial frames transfer with the video buffer field ``line_offset`` * Introduced API for :ref:`multi-heap` video buffer allocation with :kconfig:option:`CONFIG_VIDEO_BUFFER_USE_SHARED_MULTI_HEAP` - * Introduced bindings for common video link properties in ``video-interfaces.yaml`` + * Introduced bindings for common video link properties in ``video-interfaces.yaml``. Migration to the + new bindings is tracked in :github:`80514` * Introduced missing :kconfig:option:`CONFIG_VIDEO_LOG_LEVEL` * Added a sample for capturing video and displaying it with LVGL (:zephyr:code-sample:`video-capture-to-lvgl`) From 44aa6f11a675e360b5ffe202a5fc8cca293600e9 Mon Sep 17 00:00:00 2001 From: Nazar Palamar Date: Thu, 14 Nov 2024 09:35:09 +0200 Subject: [PATCH 2342/4482] cy8ckit_062_ble: board: moved uart-6 to common dts for m4 Moved uatr6 to common dts for m4 - cm0 uses uart-5 in ver 0.0.0 and uart-5 in ver 1.0.0 (for using of Arduino headers). - cm4 by default uses uart-2 (for ver 0.0.0 and ver 1.0.0) Signed-off-by: Nazar Palamar --- .../cy8ckit_062_ble_cy8c6347_m4.dts | 15 +++++++++++ .../cy8ckit_062_ble_cy8c6347_m4_0_0_0.overlay | 26 ------------------- 2 files changed, 15 insertions(+), 26 deletions(-) delete mode 100644 boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m4_0_0_0.overlay diff --git a/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m4.dts b/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m4.dts index e232445e811a6..dc702bf2a7661 100644 --- a/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m4.dts +++ b/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m4.dts @@ -9,13 +9,28 @@ #include #include "cy8ckit_062_ble_common.dtsi" +#include "cy8ckit_062_ble_cy8c6347-pinctrl.dtsi" / { model = "Cypress PSoC6 BLE Pioneer Kit"; compatible = "cypress,cy8c6xx7_cm4", "cypress,psoc6"; + aliases { + uart-6 = &uart6; + }; + chosen { zephyr,sram = &sram2; zephyr,flash = &flash1; + zephyr,console = &uart6; + zephyr,shell-uart = &uart6; }; }; + +&uart6 { + status = "okay"; + current-speed = <115200>; + + pinctrl-0 = <&p13_0_scb6_uart_rx &p13_1_scb6_uart_tx>; + pinctrl-names = "default"; +}; diff --git a/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m4_0_0_0.overlay b/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m4_0_0_0.overlay deleted file mode 100644 index 26f422a9b4dc3..0000000000000 --- a/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m4_0_0_0.overlay +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2021, ATL Electronics - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "cy8ckit_062_ble_cy8c6347-pinctrl.dtsi" - -/ { - aliases { - uart-6 = &uart6; - }; - - chosen { - zephyr,console = &uart6; - zephyr,shell-uart = &uart6; - }; -}; - -&uart6 { - status = "okay"; - current-speed = <115200>; - - pinctrl-0 = <&p13_0_scb6_uart_rx &p13_1_scb6_uart_tx>; - pinctrl-names = "default"; -}; From 7e1b00d35eb5f21c98c844a589f6d745ab0fcdba Mon Sep 17 00:00:00 2001 From: Nazar Palamar Date: Thu, 14 Nov 2024 14:31:16 +0200 Subject: [PATCH 2343/4482] Infineon: board: remove CONFIG_GPIO from defconfigs Remove CONFIG_GPIO from defconfigs for Infineon boards. Applications, drivers will enable GPIO if need. Added 'select GPIO' from spi/Kconfig.ifx_cat1 Added 'select GPIO' from wifi/infineon/Kconfig.airoc Signed-off-by: Nazar Palamar --- .../infineon/cy8cproto_062_4343w/cy8cproto_062_4343w_defconfig | 3 --- boards/infineon/cy8cproto_063_ble/cy8cproto_063_ble_defconfig | 3 --- boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02_defconfig | 3 --- drivers/spi/Kconfig.ifx_cat1 | 1 + drivers/wifi/infineon/Kconfig.airoc | 1 + 5 files changed, 2 insertions(+), 9 deletions(-) diff --git a/boards/infineon/cy8cproto_062_4343w/cy8cproto_062_4343w_defconfig b/boards/infineon/cy8cproto_062_4343w/cy8cproto_062_4343w_defconfig index 221643eca2791..2bda7847628ab 100644 --- a/boards/infineon/cy8cproto_062_4343w/cy8cproto_062_4343w_defconfig +++ b/boards/infineon/cy8cproto_062_4343w/cy8cproto_062_4343w_defconfig @@ -17,9 +17,6 @@ CONFIG_UART_CONSOLE=y # Enable UART driver CONFIG_SERIAL=y -# Enable GPIO driver -CONFIG_GPIO=y - # Enable clock controller CONFIG_CLOCK_CONTROL=y diff --git a/boards/infineon/cy8cproto_063_ble/cy8cproto_063_ble_defconfig b/boards/infineon/cy8cproto_063_ble/cy8cproto_063_ble_defconfig index 7d0d29ea39cc9..98136255552ab 100644 --- a/boards/infineon/cy8cproto_063_ble/cy8cproto_063_ble_defconfig +++ b/boards/infineon/cy8cproto_063_ble/cy8cproto_063_ble_defconfig @@ -18,9 +18,6 @@ CONFIG_UART_CONSOLE=y # Enable UART driver CONFIG_SERIAL=y -# Enable GPIO -CONFIG_GPIO=y - # Enable clock controller CONFIG_CLOCK_CONTROL=y diff --git a/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02_defconfig b/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02_defconfig index 426cd85d30f37..14c8035580030 100644 --- a/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02_defconfig +++ b/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02_defconfig @@ -18,9 +18,6 @@ CONFIG_UART_CONSOLE=y # Enable UART driver CONFIG_SERIAL=y -# Enable GPIO driver -CONFIG_GPIO=y - # Enable clock controller CONFIG_CLOCK_CONTROL=y diff --git a/drivers/spi/Kconfig.ifx_cat1 b/drivers/spi/Kconfig.ifx_cat1 index d7dbbde1f7ef5..e08dc5e13ccc6 100644 --- a/drivers/spi/Kconfig.ifx_cat1 +++ b/drivers/spi/Kconfig.ifx_cat1 @@ -9,5 +9,6 @@ config SPI_INFINEON_CAT1 depends on DT_HAS_INFINEON_CAT1_SPI_ENABLED select USE_INFINEON_SPI select PINCTRL + select GPIO help This option enables the SPI driver for Infineon CAT1 family. diff --git a/drivers/wifi/infineon/Kconfig.airoc b/drivers/wifi/infineon/Kconfig.airoc index 319253378d318..775396fb24579 100644 --- a/drivers/wifi/infineon/Kconfig.airoc +++ b/drivers/wifi/infineon/Kconfig.airoc @@ -9,6 +9,7 @@ menuconfig WIFI_AIROC select NET_L2_WIFI_MGMT select SDIO_STACK select SDHC + select GPIO select WIFI_USE_NATIVE_NETWORKING select USE_INFINEON_ABSTRACTION_RTOS depends on DT_HAS_INFINEON_AIROC_WIFI_ENABLED From 94c1079560a8fdfe1fd9d93f1ecd74d59b47dadd Mon Sep 17 00:00:00 2001 From: Mark Holden Date: Wed, 13 Nov 2024 12:59:22 -0800 Subject: [PATCH 2344/4482] arch: arm: Don't use STKALIGN mask on ARMv8-M Baseline The STKALIGN mask is not present for CONFIG_ARMV8_M_BASELINE as well as CONFIG_ARMV8_M_MAINLINE. So filter out that check when setting the sp for ARM core dumps. Signed-off-by: Mark Holden --- arch/arm/include/cortex_m/exception.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/include/cortex_m/exception.h b/arch/arm/include/cortex_m/exception.h index 94491a71b3fcc..c021d59d76411 100644 --- a/arch/arm/include/cortex_m/exception.h +++ b/arch/arm/include/cortex_m/exception.h @@ -258,7 +258,7 @@ static ALWAYS_INLINE void z_arm_set_fault_sp(const struct arch_esf *esf, uint32_ } #endif /* CONFIG_FPU && CONFIG_FPU_SHARING */ -#ifndef CONFIG_ARMV8_M_MAINLINE +#if !(defined(CONFIG_ARMV8_M_MAINLINE) || defined(CONFIG_ARMV8_M_BASELINE)) if ((esf->basic.xpsr & SCB_CCR_STKALIGN_Msk) == SCB_CCR_STKALIGN_Msk) { /* Adjust stack alignment after PSR bit[9] detected */ z_arm_coredump_fault_sp |= 0x4; From 422a41ddc1d6f6f82a7104b14193f8f28e589544 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Sun, 10 Nov 2024 22:19:35 -0800 Subject: [PATCH 2345/4482] MAINTAINERS: Add Bjarki as pm co-maintainer Add bjarki-andreasen as second maintainer for power management. Signed-off-by: Flavio Ceolin --- MAINTAINERS.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index f2d75109d55f4..cfae0a0898ec7 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -3133,6 +3133,7 @@ Power management: status: maintained maintainers: - ceolin + - bjarki-andreasen collaborators: - nashif - teburd From 2fe4a37f3871423893075f9ca83ad8e670d5fdb5 Mon Sep 17 00:00:00 2001 From: McAtee Maxwell Date: Thu, 17 Oct 2024 13:39:12 -0700 Subject: [PATCH 2346/4482] Documentation: Update documenation for Infineon boards -Update formatting and contents of index.rst for cy8ckit_062s4 -Update formatting and contents of index.rst for cy8ckit_064s0s2_4343w -Update formatting and contents of index.rst for cy8cproto_062_4343w -Update formatting and contents of index.rst for cy8cproto_063_ble -Update formatting and contents of index.rst for xmc45_relax_kit -Update formatting and contents of index.rst for xmc47_relax_kit -Change all instances of "PSoC" to "PSOC" for infineon platforms Signed-off-by: McAtee Maxwell --- .../cy8ckit_062_ble/Kconfig.cy8ckit_062_ble | 2 +- boards/cypress/cy8ckit_062_ble/board.yml | 2 +- .../cy8ckit_062_ble_cy8c6347_m0.dts | 2 +- .../cy8ckit_062_ble_cy8c6347_m0_0_0_0.yaml | 2 +- .../cy8ckit_062_ble_cy8c6347_m0_1_0_0.yaml | 2 +- .../cy8ckit_062_ble_cy8c6347_m4.dts | 2 +- .../cy8ckit_062_ble_cy8c6347_m4_0_0_0.yaml | 2 +- .../cy8ckit_062_ble_cy8c6347_m4_1_0_0.yaml | 2 +- boards/cypress/cy8ckit_062_ble/doc/index.rst | 60 ++++----- .../Kconfig.cy8ckit_062_wifi_bt | 2 +- boards/cypress/cy8ckit_062_wifi_bt/board.yml | 2 +- .../cy8ckit_062_wifi_bt_cy8c6247_m0.dts | 4 +- .../cy8ckit_062_wifi_bt_cy8c6247_m0.yaml | 2 +- .../cy8ckit_062_wifi_bt_cy8c6247_m4.dts | 4 +- .../cy8ckit_062_wifi_bt_cy8c6247_m4.yaml | 2 +- .../cypress/cy8ckit_062_wifi_bt/doc/index.rst | 64 +++++----- .../infineon/cy8ckit_062s4/cy8ckit_062s4.dts | 2 +- .../infineon/cy8ckit_062s4/cy8ckit_062s4.yaml | 2 +- boards/infineon/cy8ckit_062s4/doc/index.rst | 88 +++++++++---- .../Kconfig.cy8cproto_062_4343w | 2 +- .../cy8cproto_062_4343w/Kconfig.defconfig | 2 +- .../cy8cproto_062_4343w.dts | 4 +- .../cy8cproto_062_4343w.yaml | 2 +- .../cy8cproto_062_4343w/doc/index.rst | 118 ++++++++++-------- .../Kconfig.cy8cproto_063_ble | 2 +- .../cy8cproto_063_ble/Kconfig.defconfig | 2 +- .../cy8cproto_063_ble/cy8cproto_063_ble.dts | 4 +- .../cy8cproto_063_ble/cy8cproto_063_ble.yaml | 2 +- .../infineon/cy8cproto_063_ble/doc/index.rst | 115 ++++++++++------- boards/infineon/xmc45_relax_kit/doc/index.rst | 49 +++++--- boards/infineon/xmc47_relax_kit/doc/index.rst | 46 ++++--- drivers/bluetooth/hci/Kconfig | 2 +- drivers/bluetooth/hci/hci_ifx_psoc6_bless.c | 4 +- drivers/gpio/Kconfig.psoc6 | 4 +- drivers/hwinfo/Kconfig | 4 +- drivers/serial/Kconfig.psoc6 | 4 +- drivers/serial/uart_psoc6.c | 2 +- drivers/spi/Kconfig.psoc6 | 4 +- drivers/spi/spi_psoc6.c | 2 +- dts/bindings/adc/infineon,cat1-adc.yaml | 2 +- .../bluetooth/infineon,cat1-bless-hci.yaml | 2 +- dts/bindings/hwinfo/cypress,psoc6-uid.yaml | 2 +- .../cypress,psoc6-intmux.yaml | 8 +- dts/bindings/serial/cypress,psoc6-uart.yaml | 2 +- dts/bindings/spi/cypress,psoc6-spi.yaml | 2 +- .../hal_infineon/mtb-hal-cat1/CMakeLists.txt | 2 +- soc/infineon/cat1a/Kconfig | 8 +- soc/infineon/cat1a/Kconfig.soc | 2 +- soc/infineon/cat1a/common/soc.c | 2 +- soc/infineon/cat1a/common/soc.h | 2 +- soc/infineon/cat1a/psoc6_01/Kconfig.defconfig | 2 +- soc/infineon/cat1a/psoc6_01/Kconfig.soc | 2 +- soc/infineon/cat1a/psoc6_02/Kconfig.defconfig | 2 +- soc/infineon/cat1a/psoc6_02/Kconfig.soc | 2 +- soc/infineon/cat1a/psoc6_03/Kconfig.defconfig | 2 +- soc/infineon/cat1a/psoc6_03/Kconfig.soc | 2 +- soc/infineon/cat1a/psoc6_04/Kconfig.defconfig | 2 +- soc/infineon/cat1a/psoc6_04/Kconfig.soc | 2 +- .../cat1a/psoc6_legacy/Kconfig.defconfig | 2 +- soc/infineon/cat1a/psoc6_legacy/Kconfig.soc | 2 +- .../cat1a/psoc6_legacy/cypress_psoc6_dt.h | 6 +- soc/infineon/cat1a/psoc6_legacy/soc.c | 2 +- 62 files changed, 407 insertions(+), 277 deletions(-) diff --git a/boards/cypress/cy8ckit_062_ble/Kconfig.cy8ckit_062_ble b/boards/cypress/cy8ckit_062_ble/Kconfig.cy8ckit_062_ble index 450f6530657c9..5720120d8de39 100644 --- a/boards/cypress/cy8ckit_062_ble/Kconfig.cy8ckit_062_ble +++ b/boards/cypress/cy8ckit_062_ble/Kconfig.cy8ckit_062_ble @@ -1,4 +1,4 @@ -# PSoC6 BLE Pioneer Kit configuration +# PSOC 6 BLE Pioneer Kit configuration # Copyright (c) 2018 Cypress # Copyright (c) 2020 ATL Electronics diff --git a/boards/cypress/cy8ckit_062_ble/board.yml b/boards/cypress/cy8ckit_062_ble/board.yml index 8640f1e7d980b..d737b33762e18 100644 --- a/boards/cypress/cy8ckit_062_ble/board.yml +++ b/boards/cypress/cy8ckit_062_ble/board.yml @@ -1,6 +1,6 @@ board: name: cy8ckit_062_ble - full_name: PSoC63 BLE Pioneer Kit + full_name: PSOC 63 BLE Pioneer Kit vendor: cypress revision: format: "major.minor.patch" diff --git a/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m0.dts b/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m0.dts index 0fae593a8794a..b4394a6a91042 100644 --- a/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m0.dts +++ b/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m0.dts @@ -11,7 +11,7 @@ #include "cy8ckit_062_ble_common.dtsi" / { - model = "Cypress PSoC6 BLE Pioneer Kit"; + model = "Cypress PSOC 6 BLE Pioneer Kit"; compatible = "cypress,cy8c6xx7_cm0p", "cypress,psoc6"; chosen { diff --git a/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m0_0_0_0.yaml b/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m0_0_0_0.yaml index a8e935bd50ae9..0ef2e8ae82358 100644 --- a/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m0_0_0_0.yaml +++ b/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m0_0_0_0.yaml @@ -6,7 +6,7 @@ # identifier: cy8ckit_062_ble@0.0.0/cy8c6347/m0 -name: Cypress PSoC6 BLE Pioneer Kit (M0, rev. 0.0.0) +name: Cypress PSOC 6 BLE Pioneer Kit (M0, rev. 0.0.0) type: mcu arch: arm ram: 288 diff --git a/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m0_1_0_0.yaml b/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m0_1_0_0.yaml index 27b02fa4bedba..032fc65cdf356 100644 --- a/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m0_1_0_0.yaml +++ b/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m0_1_0_0.yaml @@ -6,7 +6,7 @@ # identifier: cy8ckit_062_ble@1.0.0/cy8c6347/m0 -name: Cypress PSoC6 BLE Pioneer Kit (M0, rev. 1.0.0) +name: Cypress PSOC 6 BLE Pioneer Kit (M0, rev. 1.0.0) type: mcu arch: arm ram: 288 diff --git a/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m4.dts b/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m4.dts index dc702bf2a7661..81cd184bb1f70 100644 --- a/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m4.dts +++ b/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m4.dts @@ -12,7 +12,7 @@ #include "cy8ckit_062_ble_cy8c6347-pinctrl.dtsi" / { - model = "Cypress PSoC6 BLE Pioneer Kit"; + model = "Cypress PSOC 6 BLE Pioneer Kit"; compatible = "cypress,cy8c6xx7_cm4", "cypress,psoc6"; aliases { diff --git a/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m4_0_0_0.yaml b/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m4_0_0_0.yaml index 30708da7fa423..1ca0aaa3a1133 100644 --- a/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m4_0_0_0.yaml +++ b/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m4_0_0_0.yaml @@ -6,7 +6,7 @@ # identifier: cy8ckit_062_ble@0.0.0/cy8c6347/m4 -name: Cypress PSoC6 BLE Pioneer Kit (M4, rev. 0.0.0) +name: Cypress PSOC 6 BLE Pioneer Kit (M4, rev. 0.0.0) type: mcu arch: arm ram: 288 diff --git a/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m4_1_0_0.yaml b/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m4_1_0_0.yaml index c75724709788d..cdfb09a694291 100644 --- a/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m4_1_0_0.yaml +++ b/boards/cypress/cy8ckit_062_ble/cy8ckit_062_ble_cy8c6347_m4_1_0_0.yaml @@ -6,7 +6,7 @@ # identifier: cy8ckit_062_ble@1.0.0/cy8c6347/m4 -name: Cypress PSoC6 BLE Pioneer Kit (M4, rev. 1.0.0) +name: Cypress PSOC 6 BLE Pioneer Kit (M4, rev. 1.0.0) type: mcu arch: arm ram: 288 diff --git a/boards/cypress/cy8ckit_062_ble/doc/index.rst b/boards/cypress/cy8ckit_062_ble/doc/index.rst index f2194d084c0dc..01ad4696ea23b 100644 --- a/boards/cypress/cy8ckit_062_ble/doc/index.rst +++ b/boards/cypress/cy8ckit_062_ble/doc/index.rst @@ -1,21 +1,21 @@ .. _cy8ckit_062_ble: -INFINEON PSoC63 BLE Pioneer Kit -############################### +INFINEON PSOC 63 BLE Pioneer Kit +################################ Overview ******** -The PSoC 6 BLE Pioneer Kit (CY8CKIT-062-BLE) is a hardware platform that -enables design and debug of the Cypress PSoC 63 BLE MCU. +The PSOC 6 BLE Pioneer Kit (CY8CKIT-062-BLE) is a hardware platform that +enables design and debug of the Cypress PSOC 63 BLE MCU. -The PSoC 6 BLE Pioneer Kit features the PSoC 63 MCU: a dual-core MCU, with a +The PSOC 6 BLE Pioneer Kit features the PSOC 63 MCU: a dual-core MCU, with a 150-MHz Arm Cortex-M4 as the primary application processor and a 100-MHz Arm Cortex-M0+ that supports low-power operations, 1MB of Flash, 288KB of SRAM, an integrated BLE 4.2 radio, 78 GPIO, 7 programmable analog blocks, 12 programmable digital blocks, and capacitive-sensing with CapSense. -The PSoC 6 BLE Pioneer board offers compatibility with Arduino shields, a +The PSOC 6 BLE Pioneer board offers compatibility with Arduino shields, a 512-Mb NOR flash, onboard programmer/debugger (KitProg2), USB Type-C power delivery system (EZ-PD™ CCG3), 5-segment CapSense slider, two CapSense buttons, one CapSense proximity sensing header, an RGB LED, two user LEDs, @@ -42,45 +42,45 @@ enables the CM4 core. 6. KitProg2 I/O header (J6)1 7. KitProg2 programming/custom application header (J7)1 8. External power supply connector (J9) -9. PSoC 6 BLE user button (SW2) +9. PSOC 6 BLE user button (SW2) 10. KitProg2 application selection button (SW4) 11. Digilent® Pmod™ compatible I/O header (J14)1 12. Power LED (LED4) 13. KitProg2 status LEDs (LED1, LED2, and LED3) -14. PSoC 6 reset button (SW1) -15. PSoC 6 I/O header (J18, J19 and J20) +14. PSOC 6 reset button (SW1) +15. PSOC 6 I/O header (J18, J19 and J20) 16. Arduino™ Uno R3 compatible power header (J1) -17. PSoC 6 debug and trace header (J12) -18. Arduino Uno R3 compatible PSoC 6 I/O header (J2, J3 and J4) -19. PSoC 6 program and debug header (J11) +17. PSOC 6 debug and trace header (J12) +18. Arduino Uno R3 compatible PSOC 6 I/O header (J2, J3 and J4) +19. PSOC 6 program and debug header (J11) 20. KitProg2 programming target selection switch (SW6) 21. CapSense slider and buttons 22. CapSense proximity header (J13) -23. PSoC 6 BLE VDD selection switch (SW5) -24. PSoC 6 BLE power monitoring jumper (J8)2 +23. PSOC 6 BLE VDD selection switch (SW5) +24. PSOC 6 BLE power monitoring jumper (J8)2 25. Arduino Uno R3 compatible ICSP header (J5)1 -26. PSoC 6 user LEDs (LED8 and LED9) +26. PSOC 6 user LEDs (LED8 and LED9) 27. RGB LED (LED5) 28. Cypress 512-Mbit serial NOR Flash memory (S25FL512S, U4) 29. Cypress serial Ferroelectric RAM (U5)1 30. VBACKUP and PMIC control selection switch (SW7)2 -31. Cypress PSoC 6 BLE (CY8C6347BZI-BLD53, U1) +31. Cypress PSOC 6 BLE (CY8C6347BZI-BLD53, U1) 32. BLE Antenna 33. U.FL connector for external antenna (J17)1 34. Cypress main voltage regulator (MB39C022G, U6) -35. KitProg2 (PSoC 5LP) programmer and debugger(CY8C5868LTI-LP039, U2) +35. KitProg2 (PSOC 5LP) programmer and debugger(CY8C5868LTI-LP039, U2) 36. Battery connector (J15)1,2 37. USB PD output voltage (9V/12V) connector (J16) Hardware ******** -For more information about the PSoC 63 BLE MCU SoC and CY8CKIT-062-BLE board: +For more information about the PSOC 63 BLE MCU SoC and CY8CKIT-062-BLE board: -- `PSoC 63 BLE MCU SoC Website`_ -- `PSoC 63 BLE MCU Datasheet`_ -- `PSoC 63 BLE MCU Architecture Reference Manual`_ -- `PSoC 63 BLE MCU Register Reference Manual`_ +- `PSOC 63 BLE MCU SoC Website`_ +- `PSOC 63 BLE MCU Datasheet`_ +- `PSOC 63 BLE MCU Architecture Reference Manual`_ +- `PSOC 63 BLE MCU Register Reference Manual`_ - `CY8CKIT-062-BLE Website`_ - `CY8CKIT-062-BLE User Guide`_ - `CY8CKIT-062-BLE Schematics`_ @@ -118,18 +118,18 @@ Cortex-M4 System Clock ============ -The PSoC 63 BLE MCU SoC is configured to use the internal IMO+FLL as a source for +The PSOC 63 BLE MCU SoC is configured to use the internal IMO+FLL as a source for the system clock. CM0+ works at 50MHz, CM4 - at 100MHz. Other sources for the system clock are provided in the SOC, depending on your system requirements. Serial Port =========== -The PSoC 63 BLE MCU SoC has 8 SCB blocks and each one can be configured as +The PSOC 63 BLE MCU SoC has 8 SCB blocks and each one can be configured as UART/SPI/I2C interfaces for serial communication. At the moment UART5 on SCB5 and UART6 on SCB6 are configured. SCB5 is connected to the onboard KitProg2's USB-UART Bridge working as a serial console interface. SCB6 to P13_0, P13_1 -pins on the J3 of the Arduino Uno R3 compatible PSoC6 I/O header for general +pins on the J3 of the Arduino Uno R3 compatible PSOC 6 I/O header for general purposes. OpenOCD Installation @@ -149,7 +149,7 @@ Programming and Debugging The CY8CKIT-062-BLE includes an onboard programmer/debugger (KitProg2) with mass storage programming to provide debugging, flash programming, and serial -communication over USB. There are also PSoC 6 program and debug headers J11 +communication over USB. There are also PSOC 6 program and debug headers J11 and J12 that can be used with Segger J-Link [default]. A watchdog timer is enabled by default. To disable it call Cy_WDT_Unlock() and Cy_WDT_Disable(). @@ -285,16 +285,16 @@ References .. target-notes:: -.. _PSoC 63 BLE MCU SoC Website: +.. _PSOC 63 BLE MCU SoC Website: https://www.cypress.com/products/32-bit-arm-cortex-m4-cortex-m0-psoc-63-connectivity-line -.. _PSoC 63 BLE MCU Datasheet: +.. _PSOC 63 BLE MCU Datasheet: https://www.cypress.com/documentation/datasheets/psoc-6-mcu-psoc-63-ble-datasheet-programmable-system-chip-psoc -.. _PSoC 63 BLE MCU Architecture Reference Manual: +.. _PSOC 63 BLE MCU Architecture Reference Manual: https://www.cypress.com/documentation/technical-reference-manuals/psoc-6-mcu-psoc-63-ble-architecture-technical-reference -.. _PSoC 63 BLE MCU Register Reference Manual: +.. _PSOC 63 BLE MCU Register Reference Manual: https://www.cypress.com/documentation/technical-reference-manuals/psoc-6-mcu-cy8c63x6-cy8c63x7-cy8c63x6-cy8c63x7-registers .. _CY8CKIT-062-BLE Website: diff --git a/boards/cypress/cy8ckit_062_wifi_bt/Kconfig.cy8ckit_062_wifi_bt b/boards/cypress/cy8ckit_062_wifi_bt/Kconfig.cy8ckit_062_wifi_bt index e77e648b62a23..8f25a09652b39 100644 --- a/boards/cypress/cy8ckit_062_wifi_bt/Kconfig.cy8ckit_062_wifi_bt +++ b/boards/cypress/cy8ckit_062_wifi_bt/Kconfig.cy8ckit_062_wifi_bt @@ -1,4 +1,4 @@ -# PSoC6 WiFi-BT Pioneer Kit configuration +# PSOC 6 WiFi-BT Pioneer Kit configuration # Copyright (c) 2018 Cypress # Copyright (c) 2020 ATL Electronics diff --git a/boards/cypress/cy8ckit_062_wifi_bt/board.yml b/boards/cypress/cy8ckit_062_wifi_bt/board.yml index f070d6f396044..c1dd112325a20 100644 --- a/boards/cypress/cy8ckit_062_wifi_bt/board.yml +++ b/boards/cypress/cy8ckit_062_wifi_bt/board.yml @@ -1,6 +1,6 @@ board: name: cy8ckit_062_wifi_bt - full_name: PSoC6 WiFi-BT Pioneer Kit + full_name: PSOC 6 WiFi-BT Pioneer Kit vendor: cypress socs: - name: cy8c6247 diff --git a/boards/cypress/cy8ckit_062_wifi_bt/cy8ckit_062_wifi_bt_cy8c6247_m0.dts b/boards/cypress/cy8ckit_062_wifi_bt/cy8ckit_062_wifi_bt_cy8c6247_m0.dts index 73766b76c1049..a4cd4709c617c 100644 --- a/boards/cypress/cy8ckit_062_wifi_bt/cy8ckit_062_wifi_bt_cy8c6247_m0.dts +++ b/boards/cypress/cy8ckit_062_wifi_bt/cy8ckit_062_wifi_bt_cy8c6247_m0.dts @@ -12,8 +12,8 @@ #include "cy8ckit_062_wifi_bt_cy8c6247-pinctrl.dtsi" / { - model = "cy8ckit_062_wifi_bt_m0 with a Cypress PSoC6 SoC"; - compatible = "cypress,cy8ckit_062_wifi_bt_m0", "cypress,PSoC6"; + model = "cy8ckit_062_wifi_bt_m0 with a Cypress PSOC 6 SoC"; + compatible = "cypress,cy8ckit_062_wifi_bt_m0", "cypress,PSOC6"; aliases { sw0 = &user_bt; diff --git a/boards/cypress/cy8ckit_062_wifi_bt/cy8ckit_062_wifi_bt_cy8c6247_m0.yaml b/boards/cypress/cy8ckit_062_wifi_bt/cy8ckit_062_wifi_bt_cy8c6247_m0.yaml index 3b2372a04dca1..4135437c52ae3 100644 --- a/boards/cypress/cy8ckit_062_wifi_bt/cy8ckit_062_wifi_bt_cy8c6247_m0.yaml +++ b/boards/cypress/cy8ckit_062_wifi_bt/cy8ckit_062_wifi_bt_cy8c6247_m0.yaml @@ -5,7 +5,7 @@ # identifier: cy8ckit_062_wifi_bt/cy8c6247/m0 -name: Cypress PSoC6 WiFi-BT Pioneer Kit (M0) +name: Cypress PSOC 6 WiFi-BT Pioneer Kit (M0) type: mcu arch: arm ram: 288 diff --git a/boards/cypress/cy8ckit_062_wifi_bt/cy8ckit_062_wifi_bt_cy8c6247_m4.dts b/boards/cypress/cy8ckit_062_wifi_bt/cy8ckit_062_wifi_bt_cy8c6247_m4.dts index 29ea4b85134c3..04bbfa1fb96ac 100644 --- a/boards/cypress/cy8ckit_062_wifi_bt/cy8ckit_062_wifi_bt_cy8c6247_m4.dts +++ b/boards/cypress/cy8ckit_062_wifi_bt/cy8ckit_062_wifi_bt_cy8c6247_m4.dts @@ -10,8 +10,8 @@ #include "cy8ckit_062_wifi_bt_cy8c6247-pinctrl.dtsi" / { - model = "cy8ckit_062_wifi_bt_m4 with a Cypress PSoC6 SoC"; - compatible = "cypress,cy8ckit_062_wifi_bt_m4", "cypress,PSoC6"; + model = "cy8ckit_062_wifi_bt_m4 with a Cypress PSOC 6 SoC"; + compatible = "cypress,cy8ckit_062_wifi_bt_m4", "cypress,PSOC6"; aliases { uart-5 = &uart5; diff --git a/boards/cypress/cy8ckit_062_wifi_bt/cy8ckit_062_wifi_bt_cy8c6247_m4.yaml b/boards/cypress/cy8ckit_062_wifi_bt/cy8ckit_062_wifi_bt_cy8c6247_m4.yaml index df5c8c0b53b9d..e861d197140fd 100644 --- a/boards/cypress/cy8ckit_062_wifi_bt/cy8ckit_062_wifi_bt_cy8c6247_m4.yaml +++ b/boards/cypress/cy8ckit_062_wifi_bt/cy8ckit_062_wifi_bt_cy8c6247_m4.yaml @@ -5,7 +5,7 @@ # identifier: cy8ckit_062_wifi_bt/cy8c6247/m4 -name: Cypress PSoC6 WiFi-BT Pioneer Kit (M4) +name: Cypress PSOC 6 WiFi-BT Pioneer Kit (M4) type: mcu arch: arm ram: 288 diff --git a/boards/cypress/cy8ckit_062_wifi_bt/doc/index.rst b/boards/cypress/cy8ckit_062_wifi_bt/doc/index.rst index b11164e467d72..a0ad601ad6334 100644 --- a/boards/cypress/cy8ckit_062_wifi_bt/doc/index.rst +++ b/boards/cypress/cy8ckit_062_wifi_bt/doc/index.rst @@ -1,16 +1,16 @@ .. _cy8ckit_062_wifi_bt: -INFINEON PSoC6 WiFi-BT Pioneer Kit -################################## +INFINEON PSOC 6 WiFi-BT Pioneer Kit +################################### Overview ******** -The PSoC 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WiFi-BT) is a low-cost hardware -platform that enables design and debug of the PSoC 62 MCU and the Murata +The PSOC 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WiFi-BT) is a low-cost hardware +platform that enables design and debug of the PSOC 62 MCU and the Murata LBEE5KL1DX Module (CYW4343W WiFi + Bluetooth Combo Chip). -The PSoC 6 WiFi-BT Pioneer Kit features the PSoC 62 MCU: a +The PSOC 6 WiFi-BT Pioneer Kit features the PSOC 62 MCU: a dual-core MCU, with a 150-MHz Arm Cortex-M4 as the primary application processor and a 100-MHz Arm Cortex-M0+ that supports low-power operations, 1MB of Flash, 288KB of SRAM, 104 GPIO, 7 programmable analog blocks, @@ -18,7 +18,7 @@ processor and a 100-MHz Arm Cortex-M0+ that supports low-power operations, a PDM-PCM digital microphone interface, and industry-leading capacitive-sensing with CapSense. -The PSoC 6 WiFi-BT Pioneer board offers compatibility with Arduino shields. +The PSOC 6 WiFi-BT Pioneer board offers compatibility with Arduino shields. The Cortex-M0+ is a primary core on the board's SoC. It starts first and enables the CM4 core. @@ -35,45 +35,45 @@ enables the CM4 core. 6. KitProg2 I/O header (J6)1 7. KitProg2 programming/custom application header (J7)1 8. External power supply connector (J9) -9. PSoC 6 user button (SW2) +9. PSOC 6 user button (SW2) 10. KitProg2 application selection button (SW4) 11. Digilent® Pmod™ compatible I/O header (J14)1 12. Power LED (LED4) 13. KitProg2 status LEDs (LED1, LED2, and LED3) -14. PSoC 6 reset button (SW1) -15. PSoC 6 I/O header (J18, J19 and J20) +14. PSOC 6 reset button (SW1) +15. PSOC 6 I/O header (J18, J19 and J20) 16. Arduino™ Uno R3 compatible power header (J1) -17. PSoC 6 debug and trace header (J12) -18. Arduino Uno R3 compatible PSoC 6 I/O header (J2, J3 and J4) -19. PSoC 6 program and debug header (J11) +17. PSOC 6 debug and trace header (J12) +18. Arduino Uno R3 compatible PSOC 6 I/O header (J2, J3 and J4) +19. PSOC 6 program and debug header (J11) 20. CapSense proximity header (J13) 21. CapSense slider and buttons -22. PSoC 6 VDD selection switch (SW5) +22. PSOC 6 VDD selection switch (SW5) 23. Cypress 512-Mbit serial NOR Flash memory (S25-FL512S, U4) -24. PSoC 6 user LEDs (LED8 and LED9) +24. PSOC 6 user LEDs (LED8 and LED9) 25. RGB LED (LED5) 26. WiFi/BT module (LBEE5KL 1DX, U6) 27. Cypress serial Ferroelectric RAM (U5)1 28. WiFi-BT Antenna 29. VBACKUP and PMIC control selection switch (SW7)2 -30. PSoC 6 USB device Type-C connector (J28) -31. Cypress PSoC 6 (CY8C6247BZI-D54, U1) -32. PSoC 6 USB Host Type-A connector (J27) +30. PSOC 6 USB device Type-C connector (J28) +31. Cypress PSOC 6 (CY8C6247BZI-D54, U1) +32. PSOC 6 USB Host Type-A connector (J27) 33. Arduino Uno R3 compatible ICSP header (J5)1 -34. PSoC 6 power monitoring jumper (J8)2 -35. KitProg2 (PSoC 5LP) programmer and debugger(CY8C5868LTI-LP039, U2) +34. PSOC 6 power monitoring jumper (J8)2 +35. KitProg2 (PSOC 5LP) programmer and debugger(CY8C5868LTI-LP039, U2) 36. Battery connector (J15)1,2 37. USB PD output voltage (9V/12V) connector (J16) Hardware ******** -For more information about the PSoC 62 MCU SoC and CY8CKIT-062-WiFi-BT board: +For more information about the PSOC 62 MCU SoC and CY8CKIT-062-WiFi-BT board: -- `PSoC 62 MCU SoC Website`_ -- `PSoC 62 MCU Datasheet`_ -- `PSoC 62 MCU Architecture Reference Manual`_ -- `PSoC 62 MCU Register Reference Manual`_ +- `PSOC 62 MCU SoC Website`_ +- `PSOC 62 MCU Datasheet`_ +- `PSOC 62 MCU Architecture Reference Manual`_ +- `PSOC 62 MCU Register Reference Manual`_ - `CY8CKIT-062-WiFi-BT Website`_ - `CY8CKIT-062-WiFi-BT User Guide`_ - `CY8CKIT-062-WiFi-BT Schematics`_ @@ -105,18 +105,18 @@ The default configuration can be found in the Kconfig System Clock ============ -The PSoC 62 MCU SoC is configured to use the internal IMO+FLL as a source for +The PSOC 62 MCU SoC is configured to use the internal IMO+FLL as a source for the system clock. CM0+ works at 50MHz, CM4 - at 100MHz. Other sources for the system clock are provided in the SOC, depending on your system requirements. Serial Port =========== -The PSoC 62 MCU SoC has 9 SCB blocks 8 of each can be configured as UART +The PSOC 62 MCU SoC has 9 SCB blocks 8 of each can be configured as UART interfaces for serial communication. At the moment UART5 on SCB5 and UART6 on SCB6 are configured. SCB5 is connected to the onboard KitProg2's USB-UART Bridge, SCB6 to P12_0, P12_1 pins on the J3 of the Arduino Uno R3 compatible -PSoC6 I/O header. +PSOC 6 I/O header. OpenOCD Installation ==================== @@ -136,7 +136,7 @@ Programming and Debugging The CY8CKIT-062-WiFi-BT includes an onboard programmer/debugger (KitProg2) with mass storage programming to provide debugging, flash programming, and serial -communication over USB. There are also PSoC 6 program and debug headers J11 +communication over USB. There are also PSOC 6 program and debug headers J11 and J12 that can be used with Segger J-Link. A watchdog timer is enabled by default. To disable it call Cy_WDT_Unlock() and Cy_WDT_Disable(). @@ -188,16 +188,16 @@ References .. target-notes:: -.. _PSoC 62 MCU SoC Website: +.. _PSOC 62 MCU SoC Website: https://www.cypress.com/products/32-bit-arm-cortex-m4-psoc-6 -.. _PSoC 62 MCU Datasheet: +.. _PSOC 62 MCU Datasheet: https://www.cypress.com/documentation/datasheets/psoc-6-mcu-psoc-62-datasheet-programmable-system-chip-psoc-preliminary -.. _PSoC 62 MCU Architecture Reference Manual: +.. _PSOC 62 MCU Architecture Reference Manual: https://www.cypress.com/documentation/technical-reference-manuals/psoc-6-mcu-psoc-62-architecture-technical-reference-manual -.. _PSoC 62 MCU Register Reference Manual: +.. _PSOC 62 MCU Register Reference Manual: https://www.cypress.com/documentation/technical-reference-manuals/psoc-6-mcu-psoc-62-register-technical-reference-manual-trm .. _CY8CKIT-062-WiFi-BT Website: diff --git a/boards/infineon/cy8ckit_062s4/cy8ckit_062s4.dts b/boards/infineon/cy8ckit_062s4/cy8ckit_062s4.dts index 9328a0cf60dcf..4ba5a5b9fdaf3 100644 --- a/boards/infineon/cy8ckit_062s4/cy8ckit_062s4.dts +++ b/boards/infineon/cy8ckit_062s4/cy8ckit_062s4.dts @@ -7,7 +7,7 @@ #include / { - model = "Infineon PSoC 62S4 Pioneer Kit"; + model = "Infineon PSOC 62S4 Pioneer Kit"; compatible ="cypress,psoc6"; chosen { zephyr,sram = &sram0; diff --git a/boards/infineon/cy8ckit_062s4/cy8ckit_062s4.yaml b/boards/infineon/cy8ckit_062s4/cy8ckit_062s4.yaml index 4ab5c7580ecdd..0965da54b3a6d 100644 --- a/boards/infineon/cy8ckit_062s4/cy8ckit_062s4.yaml +++ b/boards/infineon/cy8ckit_062s4/cy8ckit_062s4.yaml @@ -2,7 +2,7 @@ # Copyright (c) 2023 David Ullmann identifier: cy8ckit_062s4 -name: CY8CKIT-062S4 PSoC 62S4 +name: CY8CKIT-062S4 PSOC 62S4 type: mcu arch: arm ram: 128 diff --git a/boards/infineon/cy8ckit_062s4/doc/index.rst b/boards/infineon/cy8ckit_062s4/doc/index.rst index 0ee6df6d9029d..b5e3e39cc1d84 100644 --- a/boards/infineon/cy8ckit_062s4/doc/index.rst +++ b/boards/infineon/cy8ckit_062s4/doc/index.rst @@ -2,7 +2,7 @@ Overview ******** -The PSOC 62S4 Pioneer kit has a CY8C62x4 MCU, which is an ultra-low-power PSoC device specifically designed for battery-operated analog +The PSOC 62S4 Pioneer kit has a CY8C62x4 MCU, which is an ultra-low-power PSOC device specifically designed for battery-operated analog sensing applications. It includes a 150-MHz Arm® Cortex®-M4 CPU as the primary application processor, a 100-MHz Arm® Cortex®-M0+ CPU that supports low-power operations, up to 256 KB Flash and 128 KB SRAM, programmable analog sensing, CapSense™ touch-sensing, and programmable digital peripherals. @@ -39,8 +39,10 @@ The board configuration supports the following hardware features: | UART | on-chip | serial port-polling; | +-----------+------------+-----------------------+ + The default configuration can be found in the Kconfig -:zephyr_file:`boards/infineon/cy8ckit_062s4/cy8ckit_062s4_defconfig`. + +:zephyr_file:`boards/infineon/cy8ckit_062s4/cy8ckit_062s4_defconfig` Clock Configuration =================== @@ -56,37 +58,67 @@ Clock Configuration +-----------+------------+-----------------------+ Fetch Binary Blobs -================== +****************** .. code-block:: console west blobs fetch hal_infineon +Build blinking led sample +************************* -Build and flash hello world sample -********************************** +Here is an example for building the :zephyr:code-sample:`blinky` sample application. +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: cy8ckit_062s4 + :goals: build -.. code-block:: console +Programming and Debugging +************************* + +The CY8CKIT-062S4 includes an onboard programmer/debugger (`KitProg3`_) to provide debugging, flash programming, and serial communication over USB. Flash and debug commands use OpenOCD and require a custom Infineon OpenOCD version, that supports KitProg3, to be installed. + +Infineon OpenOCD Installation +============================= + +Both the full `ModusToolbox`_ and the `ModusToolbox Programming Tools`_ packages include Infineon OpenOCD. Installing either of these packages will also install Infineon OpenOCD. If neither package is installed, a minimal installation can be done by downloading the `Infineon OpenOCD`_ release for your system and manually extract the files to a location of your choice. + +.. note:: Linux requires device access rights to be set up for KitProg3. This is handled automatically by the ModusToolbox and ModusToolbox Programming Tools installations. When doing a minimal installation, this can be done manually by executing the script ``openocd/udev_rules/install_rules.sh``. + +West Commands +============= + +The path to the installed Infineon OpenOCD executable must be available to the ``west`` tool commands. There are multiple ways of doing this. The example below uses a permanent CMake argument to set the CMake variable ``OPENOCD``. - cd zephyr/samples/hello_world - west build -p auto -b cy8ckit_062s4 --pristine - west flash - picocom /dev/ttyACM0 -b 115200 + .. tabs:: + .. group-tab:: Windows -OpenOCD Installation -==================== + .. code-block:: shell -To get the OpenOCD package, it is required that you + # Run west config once to set permanent CMake argument + west config build.cmake-args -- -DOPENOCD=path/to/infineon/openocd/bin/openocd.exe -1. Download the software ModusToolbox 3.1. https://softwaretools.infineon.com/tools/com.ifx.tb.tool.modustoolbox -2. Once downloaded add the path to access the Scripts folder provided by ModusToolbox:: + # Do a pristine build once after setting CMake argument + west build -b cy8ckit_062s4 -p always samples/basic/blinky - export PATH=$PATH:/path/to/ModusToolbox/tools_3.1/openocd/scripts + west flash + west debug -3. Add the OpenOCD executable file's path to west flash/debug. -4. Flash using: ``west flash --openocd path/to/infineon/openocd/bin/openocd`` -5. Debug using: ``west debug --openocd path/to/infineon/openocd/bin/openocd`` + .. group-tab:: Linux + + .. code-block:: shell + + # Run west config once to set permanent CMake argument + west config build.cmake-args -- -DOPENOCD=path/to/infineon/openocd/bin/openocd + + # Do a pristine build once after setting CMake argument + west build -b cy8ckit_062s4 -p always samples/basic/blinky + + west flash + west debug + +Once the gdb console starts after executing the west debug command, you may now set breakpoints and perform other standard GDB debugging on the PSOC 6 CM4 core. References ********** @@ -94,16 +126,28 @@ References .. target-notes:: .. _CY8CKIT 062S4 Pioneer Kit Guide: - https://www.infineon.com/dgdl/Infineon-CY8CKIT_062S4_PSoC62S4_pioneer_kit_guide-UserManual-v01_00-EN.pdf?fileId=8ac78c8c7e7124d1017e962f98992207 + https://www.infineon.com/dgdl/Infineon-CY8CKIT_062S4_PSOC62S4_pioneer_kit_guide-UserManual-v01_00-EN.pdf?fileId=8ac78c8c7e7124d1017e962f98992207 .. _CY8CKIT 062S4 Pioneer Kit Website: https://www.infineon.com/cms/en/product/evaluation-boards/cy8ckit-062s4/?redirId=VL1508&utm_medium=referral&utm_source=cypress&utm_campaign=202110_globe_en_all_integration-dev_kit .. _CY8CKIT 062S4 Pioneer Kit Schematic: - https://www.infineon.com/dgdl/Infineon-CY8CKIT-062S4_PSoC_62S4_Pioneer_Kit_Schematic-PCBDesignData-v01_00-EN.pdf?fileId=8ac78c8c7d710014017d7153484d2081 + https://www.infineon.com/dgdl/Infineon-CY8CKIT-062S4_PSOC_62S4_Pioneer_Kit_Schematic-PCBDesignData-v01_00-EN.pdf?fileId=8ac78c8c7d710014017d7153484d2081 .. _CY8CKIT 062S4 Pioneer Kit Technical Reference Manual: https://www.infineon.com/dgdl/Infineon-PSOC_6_MCU_CY8C61X4CY8C62X4_REGISTERS_TECHNICAL_REFERENCE_MANUAL_(TRM)_PSOC_61_PSOC_62_MCU-AdditionalTechnicalInformation-v03_00-EN.pdf?fileId=8ac78c8c7d0d8da4017d0fb34f0627a7 .. _CY8CKIT 062S4 Pioneer Kit Datasheet: - https://www.infineon.com/dgdl/Infineon-PSoC_6_MCU_CY8C62X4-DataSheet-v12_00-EN.pdf?fileId=8ac78c8c7ddc01d7017ddd026d585901 + https://www.infineon.com/dgdl/Infineon-PSOC_6_MCU_CY8C62X4-DataSheet-v12_00-EN.pdf?fileId=8ac78c8c7ddc01d7017ddd026d585901 + +.. _ModusToolbox: + https://softwaretools.infineon.com/tools/com.ifx.tb.tool.modustoolbox + +.. _ModusToolbox Programming Tools: + https://softwaretools.infineon.com/tools/com.ifx.tb.tool.modustoolboxprogtools + +.. _Infineon OpenOCD: + https://github.com/Infineon/openocd/releases/latest + +.. _KitProg3: + https://github.com/Infineon/KitProg3 diff --git a/boards/infineon/cy8cproto_062_4343w/Kconfig.cy8cproto_062_4343w b/boards/infineon/cy8cproto_062_4343w/Kconfig.cy8cproto_062_4343w index 6af485a6bed6c..63d5185839bf2 100644 --- a/boards/infineon/cy8cproto_062_4343w/Kconfig.cy8cproto_062_4343w +++ b/boards/infineon/cy8cproto_062_4343w/Kconfig.cy8cproto_062_4343w @@ -1,4 +1,4 @@ -# CY8CPROTO-062-4343W PSoC™ 6 Wi-Fi BT Prototyping Kit +# CY8CPROTO-062-4343W PSOC™ 6 Wi-Fi BT Prototyping Kit # Copyright (c) 2021 Cypress Semiconductor Corporation. # SPDX-License-Identifier: Apache-2.0 diff --git a/boards/infineon/cy8cproto_062_4343w/Kconfig.defconfig b/boards/infineon/cy8cproto_062_4343w/Kconfig.defconfig index 5573b7f041773..d26e3293d2e5f 100644 --- a/boards/infineon/cy8cproto_062_4343w/Kconfig.defconfig +++ b/boards/infineon/cy8cproto_062_4343w/Kconfig.defconfig @@ -1,4 +1,4 @@ -# CY8CPROTO-062-4343W PSoC™ 6 Wi-Fi BT Prototyping Kit configuration +# CY8CPROTO-062-4343W PSOC™ 6 Wi-Fi BT Prototyping Kit configuration # Copyright (c) 2021 Cypress Semiconductor Corporation. # SPDX-License-Identifier: Apache-2.0 diff --git a/boards/infineon/cy8cproto_062_4343w/cy8cproto_062_4343w.dts b/boards/infineon/cy8cproto_062_4343w/cy8cproto_062_4343w.dts index b9e74ac685d0b..389806380222f 100644 --- a/boards/infineon/cy8cproto_062_4343w/cy8cproto_062_4343w.dts +++ b/boards/infineon/cy8cproto_062_4343w/cy8cproto_062_4343w.dts @@ -10,8 +10,8 @@ #include "cy8cproto_062_4343w-pinctrl.dtsi" / { - model = "cy8cproto_062_4343w with an Cypress PSoC™ 6 SoC"; - compatible = "cypress,cy8cproto_062_4343w", "cypress,PSoC6"; + model = "cy8cproto_062_4343w with an Cypress PSOC™ 6 SoC"; + compatible = "cypress,cy8cproto_062_4343w", "cypress,PSOC6"; aliases { uart-5 = &uart5; diff --git a/boards/infineon/cy8cproto_062_4343w/cy8cproto_062_4343w.yaml b/boards/infineon/cy8cproto_062_4343w/cy8cproto_062_4343w.yaml index 113c686db0371..5eb55d4de6d30 100644 --- a/boards/infineon/cy8cproto_062_4343w/cy8cproto_062_4343w.yaml +++ b/boards/infineon/cy8cproto_062_4343w/cy8cproto_062_4343w.yaml @@ -4,7 +4,7 @@ # identifier: cy8cproto_062_4343w -name: CY8CPROTO-062-4343W PSoC 6 Wi-Fi BT Prototyping Kit +name: CY8CPROTO-062-4343W PSOC 6 Wi-Fi BT Prototyping Kit type: mcu arch: arm ram: 1024 diff --git a/boards/infineon/cy8cproto_062_4343w/doc/index.rst b/boards/infineon/cy8cproto_062_4343w/doc/index.rst index 67dacd2151a4f..f04c28e5d00a7 100644 --- a/boards/infineon/cy8cproto_062_4343w/doc/index.rst +++ b/boards/infineon/cy8cproto_062_4343w/doc/index.rst @@ -3,8 +3,8 @@ Overview ******** -The CY8CPROTO-062-4343W PSoC 6 Wi-Fi BT Prototyping Kit is a low-cost hardware -platform that enables design and debug of PSoC 6 MCUs. It comes with a Murata +The CY8CPROTO-062-4343W PSOC 6 Wi-Fi BT Prototyping Kit is a low-cost hardware +platform that enables design and debug of PSOC 6 MCUs. It comes with a Murata LBEE5KL1DX module, based on the CYW4343W combo device, industry-leading CAPSENSE for touch buttons and slider, on-board debugger/programmer with KitProg3, microSD card interface, 512-Mb Quad-SPI NOR flash, PDM-PCM microphone, and a thermistor. @@ -16,15 +16,15 @@ In addition, support for Digilent's Pmod interface is also provided with this ki Hardware ******** -For more information about the PSoC 62 MCU SoC and CY8CPROTO-062-4343W board: +For more information about the PSOC 62 MCU SoC and CY8CPROTO-062-4343W board: -- `PSoC 62 MCU SoC Website`_ -- `PSoC 62 MCU Datasheet`_ -- `PSoC 62 MCU Architecture Reference Manual`_ -- `PSoC 62 MCU Register Reference Manual`_ -- `CY8CPROTO-062-4343W PSoC 6 Wi-Fi BT Website`_ -- `CY8CPROTO-062-4343W PSoC 6 Wi-Fi BT User Guide`_ -- `CY8CPROTO-062-4343W PSoC 6 Wi-Fi BT Schematics`_ +- `PSOC 62 MCU SoC Website`_ +- `PSOC 62 MCU Datasheet`_ +- `PSOC 62 MCU Architecture Reference Manual`_ +- `PSOC 62 MCU Register Reference Manual`_ +- `CY8CPROTO-062-4343W PSOC 6 Wi-Fi BT Website`_ +- `CY8CPROTO-062-4343W PSOC 6 Wi-Fi BT User Guide`_ +- `CY8CPROTO-062-4343W PSOC 6 Wi-Fi BT Schematics`_ Kit Features: ============= @@ -41,9 +41,10 @@ Kit Features: Kit Contents: ============= -- PSoC 6 Wi-Fi BT Prototyping Board +- PSOC 6 Wi-Fi BT Prototyping Board - USB Type-A to Micro-B cable -- Quick Start Guide +- Quick start guide + Supported Features ================== @@ -73,7 +74,7 @@ The default configuration can be found in the Kconfig System Clock ============ -The PSoC 62 MCU SoC is configured to use the internal IMO+FLL as a source for +The PSOC 62 MCU SoC is configured to use the internal IMO+FLL as a source for the system clock. CM0+ works at 50MHz, CM4 - at 100MHz. Other sources for the system clock are provided in the SOC, depending on your system requirements. @@ -94,50 +95,58 @@ To fetch Binary Blobs: Build blinking led sample ************************* -Here is an example for the :zephyr:code-sample:`blinky` application. +Here is an example for building the :zephyr:code-sample:`blinky` sample application. -.. code-block:: console +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: cy8cproto_062_4343w + :goals: build - cd zephyr - west build -p auto -b cy8cproto_062_4343w samples/basic/blink +Programming and Debugging +************************* -OpenOCD Installation -==================== +The CY8CPROTO-062-4343W includes an onboard programmer/debugger (`KitProg3`_) to provide debugging, flash programming, and serial communication over USB. Flash and debug commands use OpenOCD and require a custom Infineon OpenOCD version, that supports KitProg3, to be installed. -To get the OpenOCD package, it is required that you +Infineon OpenOCD Installation +============================= -1. Download the software ModusToolbox 3.1. https://softwaretools.infineon.com/tools/com.ifx.tb.tool.modustoolbox -2. Once downloaded add the path to access the Scripts folder provided by ModusToolbox - export PATH=$PATH:/path/to/ModusToolbox/tools_3.1/openocd/scripts -3. Add the OpenOCD executable file's path to west flash/debug. -4. Flash using: west flash --openocd path/to/infineon/openocd/bin/openocd -5. Debug using: west debug --openocd path/to/infineon/openocd/bin/openocd +Both the full `ModusToolbox`_ and the `ModusToolbox Programming Tools`_ packages include Infineon OpenOCD. Installing either of these packages will also install Infineon OpenOCD. If neither package is installed, a minimal installation can be done by downloading the `Infineon OpenOCD`_ release for your system and manually extract the files to a location of your choice. +.. note:: Linux requires device access rights to be set up for KitProg3. This is handled automatically by the ModusToolbox and ModusToolbox Programming Tools installations. When doing a minimal installation, this can be done manually by executing the script ``openocd/udev_rules/install_rules.sh``. -Programming and Debugging -************************* +West Commands +============= -The CY8CPROTO-062-4343W includes an onboard programmer/debugger (KitProg2) with -mass storage programming to provide debugging, flash programming, and serial -communication over USB. Flash and debug commands must be pointed to the Cypress -OpenOCD you downloaded above. +The path to the installed Infineon OpenOCD executable must be available to the ``west`` tool commands. There are multiple ways of doing this. The example below uses a permanent CMake argument to set the CMake variable ``OPENOCD``. -On Windows: + .. tabs:: + .. group-tab:: Windows -.. code-block:: console + .. code-block:: shell - west flash --openocd path/to/infineon/openocd/bin/openocd.exe - west debug --openocd path/to/infineon/openocd/bin/openocd.exe + # Run west config once to set permanent CMake argument + west config build.cmake-args -- -DOPENOCD=path/to/infineon/openocd/bin/openocd.exe -On Linux: + # Do a pristine build once after setting CMake argument + west build -b cy8cproto_062_4343w -p always samples/basic/blinky -.. code-block:: console + west flash + west debug + + .. group-tab:: Linux + + .. code-block:: shell + + # Run west config once to set permanent CMake argument + west config build.cmake-args -- -DOPENOCD=path/to/infineon/openocd/bin/openocd - west flash --openocd path/to/infineon/openocd/bin/openocd - west debug --openocd path/to/infineon/openocd/bin/openocd + # Do a pristine build once after setting CMake argument + west build -b cy8cproto_062_4343w -p always samples/basic/blinky -Once the gdb console starts after executing the west debug command, you may -now set breakpoints and perform other standard GDB debugging on the PSoC 6 CM4 core. + west flash + west debug + +Once the gdb console starts after executing the west debug command, you may now set breakpoints and perform other standard GDB debugging on the PSOC 6 CM4 core. Errata ====== @@ -152,26 +161,35 @@ Errata | a server instance started by west debugserver. | | +------------------------------------------------+----------------------------------------+ -.. _PSoC 62 MCU SoC Website: +.. _PSOC 62 MCU SoC Website: https://www.cypress.com/products/32-bit-arm-cortex-m4-psoc-6 -.. _PSoC 62 MCU Datasheet: +.. _PSOC 62 MCU Datasheet: https://www.cypress.com/documentation/datasheets/psoc-6-mcu-psoc-62-datasheet-programmable-system-chip-psoc-preliminary -.. _PSoC 62 MCU Architecture Reference Manual: +.. _PSOC 62 MCU Architecture Reference Manual: https://www.cypress.com/documentation/technical-reference-manuals/psoc-6-mcu-psoc-62-architecture-technical-reference-manual -.. _PSoC 62 MCU Register Reference Manual: +.. _PSOC 62 MCU Register Reference Manual: https://www.cypress.com/documentation/technical-reference-manuals/psoc-6-mcu-psoc-62-register-technical-reference-manual-trm -.. _CY8CPROTO-062-4343W PSoC 6 Wi-Fi BT Website: +.. _CY8CPROTO-062-4343W PSOC 6 Wi-Fi BT Website: https://www.infineon.com/cms/en/product/evaluation-boards/cy8cproto-062-4343w/ -.. _CY8CPROTO-062-4343W PSoC 6 Wi-Fi BT User Guide: +.. _CY8CPROTO-062-4343W PSOC 6 Wi-Fi BT User Guide: https://www.infineon.com/cms/en/product/evaluation-boards/cy8cproto-062-4343w/#!?fileId=8ac78c8c7d0d8da4017d0f0118571844 -.. _CY8CPROTO-062-4343W PSoC 6 Wi-Fi BT Schematics: +.. _CY8CPROTO-062-4343W PSOC 6 Wi-Fi BT Schematics: https://www.infineon.com/cms/en/product/evaluation-boards/cy8cproto-062-4343w/#!?fileId=8ac78c8c7d0d8da4017d0f01126b183f +.. _ModusToolbox: + https://softwaretools.infineon.com/tools/com.ifx.tb.tool.modustoolbox + +.. _ModusToolbox Programming Tools: + https://softwaretools.infineon.com/tools/com.ifx.tb.tool.modustoolboxprogtools + .. _Infineon OpenOCD: - https://github.com/infineon/openocd/releases/tag/release-v4.3.0 + https://github.com/Infineon/openocd/releases/latest + +.. _KitProg3: + https://github.com/Infineon/KitProg3 diff --git a/boards/infineon/cy8cproto_063_ble/Kconfig.cy8cproto_063_ble b/boards/infineon/cy8cproto_063_ble/Kconfig.cy8cproto_063_ble index 23763f500c3d2..bc269a7fcfe30 100644 --- a/boards/infineon/cy8cproto_063_ble/Kconfig.cy8cproto_063_ble +++ b/boards/infineon/cy8cproto_063_ble/Kconfig.cy8cproto_063_ble @@ -1,4 +1,4 @@ -# CY8CPROTO-063-BLE PSoC™ 6 BLE Prototyping Kit +# CY8CPROTO-063-BLE PSOC™ 6 BLE Prototyping Kit # # Copyright (c) 2023 Cypress Semiconductor Corporation (an Infineon company) or # an affiliate of Cypress Semiconductor Corporation diff --git a/boards/infineon/cy8cproto_063_ble/Kconfig.defconfig b/boards/infineon/cy8cproto_063_ble/Kconfig.defconfig index 4123455e9f93b..0c805b26b8003 100644 --- a/boards/infineon/cy8cproto_063_ble/Kconfig.defconfig +++ b/boards/infineon/cy8cproto_063_ble/Kconfig.defconfig @@ -1,4 +1,4 @@ -# CY8CPROTO-063-BLE PSoC™ 6 BLE Prototyping Kit +# CY8CPROTO-063-BLE PSOC™ 6 BLE Prototyping Kit # Copyright (c) 2023 Cypress Semiconductor Corporation (an Infineon company) or # an affiliate of Cypress Semiconductor Corporation diff --git a/boards/infineon/cy8cproto_063_ble/cy8cproto_063_ble.dts b/boards/infineon/cy8cproto_063_ble/cy8cproto_063_ble.dts index 5516895fddd8b..3cb9253a8065f 100644 --- a/boards/infineon/cy8cproto_063_ble/cy8cproto_063_ble.dts +++ b/boards/infineon/cy8cproto_063_ble/cy8cproto_063_ble.dts @@ -12,8 +12,8 @@ #include / { - model = "CY8CPROTO-063-BLE PSoC™ 6 BLE Prototyping Kit"; - compatible = "cypress,cy8cproto_063_ble", "cypress,PSoC6"; + model = "CY8CPROTO-063-BLE PSOC™ 6 BLE Prototyping Kit"; + compatible = "cypress,cy8cproto_063_ble", "cypress,PSOC6"; aliases { uart-5 = &uart5; diff --git a/boards/infineon/cy8cproto_063_ble/cy8cproto_063_ble.yaml b/boards/infineon/cy8cproto_063_ble/cy8cproto_063_ble.yaml index db4f1ec95b001..9fdb92c305e24 100644 --- a/boards/infineon/cy8cproto_063_ble/cy8cproto_063_ble.yaml +++ b/boards/infineon/cy8cproto_063_ble/cy8cproto_063_ble.yaml @@ -4,7 +4,7 @@ # identifier: cy8cproto_063_ble -name: CY8CPROTO-063-BLE PSoC™ 6 BLE Prototyping Kit +name: CY8CPROTO-063-BLE PSOC™ 6 BLE Prototyping Kit type: mcu arch: arm ram: 288 diff --git a/boards/infineon/cy8cproto_063_ble/doc/index.rst b/boards/infineon/cy8cproto_063_ble/doc/index.rst index cec1634fb3697..90623b80382e7 100644 --- a/boards/infineon/cy8cproto_063_ble/doc/index.rst +++ b/boards/infineon/cy8cproto_063_ble/doc/index.rst @@ -3,18 +3,18 @@ Overview ******** -The PSoC 6 BLE Proto Kit (CY8CPROTO-063-BLE) is a hardware platform that -enables design and debug of the Cypress PSoC 63 BLE MCU. +The PSOC 6 BLE Proto Kit (CY8CPROTO-063-BLE) is a hardware platform that +enables design and debug of the Cypress PSOC 63 BLE MCU. Hardware ******** -For more information about the PSoC 63 BLE MCU SoC and CY8CPROTO-063-BLE board: +For more information about the PSOC 63 BLE MCU SoC and CY8CPROTO-063-BLE board: -- `PSoC 63 BLE MCU SoC Website`_ -- `PSoC 63 BLE MCU Datasheet`_ -- `PSoC 63 BLE MCU Architecture Reference Manual`_ -- `PSoC 63 BLE MCU Register Reference Manual`_ +- `PSOC 63 BLE MCU SoC Website`_ +- `PSOC 63 BLE MCU Datasheet`_ +- `PSOC 63 BLE MCU Architecture Reference Manual`_ +- `PSOC 63 BLE MCU Register Reference Manual`_ - `CY8CPROTO-063-BLE Website`_ - `CY8CPROTO-063-BLE User Guide`_ - `CY8CPROTO-063-BLE Schematics`_ @@ -32,11 +32,11 @@ The board configuration supports the following hardware features: +-----------+------------+-----------------------+ | SYSTICK | on-chip | system clock | +-----------+------------+-----------------------+ -| GPIO | on-chip | gpio | +| GPIO | on-chip | GPIO | +-----------+------------+-----------------------+ | PINCTRL | on-chip | pin control | +-----------+------------+-----------------------+ -| SPI | on-chip | spi | +| SPI | on-chip | SPI | +-----------+------------+-----------------------+ | UART | on-chip | serial port-polling; | | | | serial port-interrupt | @@ -51,30 +51,18 @@ The board configuration supports the following hardware features: +-----------+------------+-----------------------+ -The default configurations can be found in +The default configuration can be found in the Kconfig + :zephyr_file:`boards/infineon/cy8cproto_063_ble/cy8cproto_063_ble_defconfig` System Clock ============ -The PSoC 63 BLE MCU SoC is configured to use the internal IMO+FLL as a source for +The PSOC 63 BLE MCU SoC is configured to use the internal IMO+FLL as a source for the system clock. CM0+ works at 50MHz, CM4 - at 100MHz. Other sources for the system clock are provided in the SOC, depending on your system requirements. -OpenOCD Installation -==================== - -To get the OpenOCD package, it is required that you - -1. Download the software ModusToolbox 3.1. https://softwaretools.infineon.com/tools/com.ifx.tb.tool.modustoolbox -2. Once downloaded add the path to access the Scripts folder provided by ModusToolbox - export PATH=$PATH:/path/to/ModusToolbox/tools_3.1/openocd/scripts -3. Add the OpenOCD executable file's path to west flash/debug. -4. Flash using: west flash --openocd path/to/infineon/openocd/bin/openocd -5. Debug using: west debug --openocd path/to/infineon/openocd/bin/openocd - - Fetch Binary Blobs ****************** @@ -87,43 +75,77 @@ To fetch Binary Blobs: west blobs fetch hal_infineon + +Build blinking led sample +************************* + +Here is an example for building the :zephyr:code-sample:`blinky` sample application. + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: cy8cproto_063_ble + :goals: build + Programming and Debugging ************************* -The CY8CPROTO-063-BLE includes an onboard programmer/debugger (KitProg3) with -mass storage programming to provide debugging, flash programming, and serial -communication over USB. Flash and debug commands must be pointed to the Cypress -OpenOCD you downloaded above. +The CY8CPROTO-063-BLE includes an onboard programmer/debugger (`KitProg3`_) to provide debugging, flash programming, and serial communication over USB. Flash and debug commands use OpenOCD and require a custom Infineon OpenOCD version, that supports KitProg3, to be installed. -On Windows: +Infineon OpenOCD Installation +============================= -.. code-block:: console +Both the full `ModusToolbox`_ and the `ModusToolbox Programming Tools`_ packages include Infineon OpenOCD. Installing either of these packages will also install Infineon OpenOCD. If neither package is installed, a minimal installation can be done by downloading the `Infineon OpenOCD`_ release for your system and manually extract the files to a location of your choice. - west flash --openocd path/to/infineon/openocd/bin/openocd.exe - west debug --openocd path/to/infineon/openocd/bin/openocd.exe +.. note:: Linux requires device access rights to be set up for KitProg3. This is handled automatically by the ModusToolbox and ModusToolbox Programming Tools installations. When doing a minimal installation, this can be done manually by executing the script ``openocd/udev_rules/install_rules.sh``. -On Linux: +West Commands +============= -.. code-block:: console +The path to the installed Infineon OpenOCD executable must be available to the ``west`` tool commands. There are multiple ways of doing this. The example below uses a permanent CMake argument to set the CMake variable ``OPENOCD``. + + .. tabs:: + .. group-tab:: Windows + + .. code-block:: shell + + # Run west config once to set permanent CMake argument + west config build.cmake-args -- -DOPENOCD=path/to/infineon/openocd/bin/openocd.exe + + # Do a pristine build once after setting CMake argument + west build -b cy8cproto_063_ble -p always samples/basic/blinky + + west flash + west debug + + .. group-tab:: Linux + + .. code-block:: shell + + # Run west config once to set permanent CMake argument + west config build.cmake-args -- -DOPENOCD=path/to/infineon/openocd/bin/openocd + + # Do a pristine build once after setting CMake argument + west build -b cy8cproto_063_ble -p always samples/basic/blinky + + west flash + west debug - west flash --openocd path/to/infineon/openocd/bin/openocd - west debug --openocd path/to/infineon/openocd/bin/openocd References ********** .. target-notes:: -.. _PSoC 63 BLE MCU SoC Website: +.. _PSOC 63 BLE MCU SoC Website: https://www.cypress.com/products/32-bit-arm-cortex-m4-psoc-6 -.. _PSoC 63 BLE MCU Datasheet: - https://www.infineon.com/dgdl/Infineon-PSoC_6_MCU_PSoC_63_with_BLE_Datasheet_Programmable_System-on-Chip_(PSoC)-DataSheet-v16_00-EN.pdf?fileId=8ac78c8c7d0d8da4017d0ee4efe46c37&utm_source=cypress&utm_medium=referral&utm_campaign=202110_globe_en_all_integration-files +.. _PSOC 63 BLE MCU Datasheet: + https://www.infineon.com/dgdl/Infineon-PSOC_6_MCU_PSOC_63_with_BLE_Datasheet_Programmable_System-on-Chip_(PSOC)-DataSheet-v16_00-EN.pdf?fileId=8ac78c8c7d0d8da4017d0ee4efe46c37&utm_source=cypress&utm_medium=referral&utm_campaign=202110_globe_en_all_integration-files -.. _PSoC 63 BLE MCU Architecture Reference Manual: +.. _PSOC 63 BLE MCU Architecture Reference Manual: https://documentation.infineon.com/html/psoc6/zrs1651212645947.html -.. _PSoC 63 BLE MCU Register Reference Manual: +.. _PSOC 63 BLE MCU Register Reference Manual: https://documentation.infineon.com/html/psoc6/bnm1651211483724.html .. _CY8CPROTO-063-BLE Website: @@ -135,5 +157,14 @@ References .. _CY8CPROTO-063-BLE Schematics: https://www.infineon.com/cms/en/product/evaluation-boards/cy8cproto-063-ble/#!?fileId=8ac78c8c7d0d8da4017d0f00ea3c1821 +.. _ModusToolbox: + https://softwaretools.infineon.com/tools/com.ifx.tb.tool.modustoolbox + +.. _ModusToolbox Programming Tools: + https://softwaretools.infineon.com/tools/com.ifx.tb.tool.modustoolboxprogtools + .. _Infineon OpenOCD: - https://github.com/infineon/openocd/releases/tag/release-v4.3.0 + https://github.com/Infineon/openocd/releases/latest + +.. _KitProg3: + https://github.com/Infineon/KitProg3 diff --git a/boards/infineon/xmc45_relax_kit/doc/index.rst b/boards/infineon/xmc45_relax_kit/doc/index.rst index aeb988da85cd1..bfad619aedc35 100644 --- a/boards/infineon/xmc45_relax_kit/doc/index.rst +++ b/boards/infineon/xmc45_relax_kit/doc/index.rst @@ -60,31 +60,50 @@ The Relax Kit development board configuration supports the following hardware fe +-----------+------------+-----------------------+ More details about the supported peripherals are available in `XMC4500 TRM`_ -Other hardware features are not currently supported by the Zephyr kernel. -Building and Flashing -********************* -Flashing -======== +The default configuration can be found in the Kconfig -Here is an example for the :zephyr:code-sample:`hello_world` application. +:zephyr_file:`boards/infineon/xmc45_relax_kit/xmc45_relax_kit_defconfig` + +Other hardware features are not currently supported by the Zephyr kernel. + +Build hello world sample +************************ +Here is an example for building the :zephyr:code-sample:`hello_world` sample application. .. zephyr-app-commands:: :zephyr-app: samples/hello_world :board: xmc45_relax_kit - :goals: flash - -Debugging -========= + :goals: build +Programming and Debugging +************************* +West Commands +============= Here is an example for the :zephyr:code-sample:`hello_world` application. -.. zephyr-app-commands:: - :zephyr-app: samples/hello_world - :board: xmc45_relax_kit - :goals: debug + .. tabs:: + .. group-tab:: Windows + + .. code-block:: shell + + # Do a pristine build + west build -b xmc45_relax_kit -p always samples/hello_world + + west flash + west debug + + .. group-tab:: Linux + + .. code-block:: shell + + # Do a pristine build + west build -b xmc45_relax_kit -p always samples/hello_world + + west flash + west debug -Step through the application in your debugger. +Once the gdb console starts after executing the west debug command, you may now set breakpoints and perform other standard GDB debugging. References ********** diff --git a/boards/infineon/xmc47_relax_kit/doc/index.rst b/boards/infineon/xmc47_relax_kit/doc/index.rst index 5441c414f2796..d5796afd7ea85 100644 --- a/boards/infineon/xmc47_relax_kit/doc/index.rst +++ b/boards/infineon/xmc47_relax_kit/doc/index.rst @@ -65,29 +65,47 @@ The Relax Kit development board configuration supports the following hardware fe More details about the supported peripherals are available in `XMC4700 TRM`_ Other hardware features are not currently supported by the Zephyr kernel. -Building and Flashing -********************* -Flashing -======== +The default configuration can be found in the Kconfig -Here is an example for the :zephyr:code-sample:`hello_world` application. +:zephyr_file:`boards/infineon/xmc47_relax_kit/xmc47_relax_kit_defconfig` + +Build hello world sample +************************ +Here is an example for building the :zephyr:code-sample:`hello_world` sample application. .. zephyr-app-commands:: :zephyr-app: samples/hello_world :board: xmc47_relax_kit - :goals: flash - -Debugging -========= + :goals: build +Programming and Debugging +************************* +West Commands +============= Here is an example for the :zephyr:code-sample:`hello_world` application. -.. zephyr-app-commands:: - :zephyr-app: samples/hello_world - :board: xmc47_relax_kit - :goals: debug + .. tabs:: + .. group-tab:: Windows + + .. code-block:: shell + + # Do a pristine build + west build -b xmc47_relax_kit -p always samples/hello_world + + west flash + west debug + + .. group-tab:: Linux + + .. code-block:: shell + + # Do a pristine build + west build -b xmc47_relax_kit -p always samples/hello_world + + west flash + west debug -Step through the application in your debugger. +Once the gdb console starts after executing the west debug command, you may now set breakpoints and perform other standard GDB debugging. References ********** diff --git a/drivers/bluetooth/hci/Kconfig b/drivers/bluetooth/hci/Kconfig index c18142dcbe6b6..e15ba3bb1f388 100644 --- a/drivers/bluetooth/hci/Kconfig +++ b/drivers/bluetooth/hci/Kconfig @@ -144,7 +144,7 @@ config BT_PSOC6_BLESS depends on ZEPHYR_HAL_INFINEON_MODULE_BLOBS select BT_HCI_SETUP help - PSOC6 BLESS driver with BLE Controller which operates in + PSOC 6 BLESS driver with BLE Controller which operates in Single CPU mode. config BT_DA1469X diff --git a/drivers/bluetooth/hci/hci_ifx_psoc6_bless.c b/drivers/bluetooth/hci/hci_ifx_psoc6_bless.c index 95e9aa02912db..4c575c1d29bd7 100644 --- a/drivers/bluetooth/hci/hci_ifx_psoc6_bless.c +++ b/drivers/bluetooth/hci/hci_ifx_psoc6_bless.c @@ -6,7 +6,7 @@ */ /** - * @brief PSoC 6 BLE (BLESS) driver. + * @brief PSOC 6 BLE (BLESS) driver. */ #include @@ -245,7 +245,7 @@ static int psoc6_bless_hci_init(const struct device *dev) /* Registers the generic callback functions. */ Cy_BLE_RegisterEventCallback(psoc6_bless_events_handler); - /* Initializes the PSoC 6 BLESS Controller. */ + /* Initializes the PSOC 6 BLESS Controller. */ result = Cy_BLE_InitController(&psoc6_bless_config); if (result != CY_BLE_SUCCESS) { LOG_ERR("Failed to init the BLE Controller"); diff --git a/drivers/gpio/Kconfig.psoc6 b/drivers/gpio/Kconfig.psoc6 index bef4dc69d052b..ce19408244502 100644 --- a/drivers/gpio/Kconfig.psoc6 +++ b/drivers/gpio/Kconfig.psoc6 @@ -2,8 +2,8 @@ # SPDX-License-Identifier: Apache-2.0 config GPIO_PSOC6 - bool "Cypress PSoC-6 GPIO driver" + bool "Cypress PSOC 6 GPIO driver" default y depends on DT_HAS_CYPRESS_PSOC6_GPIO_ENABLED help - Enable support for the Cypress PSoC-6 GPIO controllers. + Enable support for the Cypress PSOC 6 GPIO controllers. diff --git a/drivers/hwinfo/Kconfig b/drivers/hwinfo/Kconfig index 2e27074061929..df1747a8e93e7 100644 --- a/drivers/hwinfo/Kconfig +++ b/drivers/hwinfo/Kconfig @@ -194,12 +194,12 @@ config HWINFO_LITEX Enable LiteX hwinfo driver config HWINFO_PSOC6 - bool "Cypress PSoC-6 unique device ID" + bool "Cypress PSOC 6 unique device ID" default y depends on SOC_FAMILY_PSOC6_LEGACY select HWINFO_HAS_DRIVER help - Enable Cypress PSoC-6 hwinfo driver. + Enable Cypress PSOC 6 hwinfo driver. config HWINFO_GECKO bool "GECKO hwinfo" diff --git a/drivers/serial/Kconfig.psoc6 b/drivers/serial/Kconfig.psoc6 index 4f0bb2c8fca0a..f008c820332c4 100644 --- a/drivers/serial/Kconfig.psoc6 +++ b/drivers/serial/Kconfig.psoc6 @@ -5,7 +5,7 @@ # SPDX-License-Identifier: Apache-2.0 config UART_PSOC6 - bool "PSoC-6 MCU SCB serial driver" + bool "PSOC 6 MCU SCB serial driver" default y depends on DT_HAS_CYPRESS_PSOC6_UART_ENABLED select SERIAL_HAS_DRIVER @@ -13,4 +13,4 @@ config UART_PSOC6 select USE_INFINEON_UART select PINCTRL help - This option enables the SCB[UART] driver for PSoC-6 SoC family. + This option enables the SCB[UART] driver for PSOC 6 SoC family. diff --git a/drivers/serial/uart_psoc6.c b/drivers/serial/uart_psoc6.c index 32c1d9e125f6b..d0482c46a3a51 100644 --- a/drivers/serial/uart_psoc6.c +++ b/drivers/serial/uart_psoc6.c @@ -6,7 +6,7 @@ #define DT_DRV_COMPAT cypress_psoc6_uart /** @file - * @brief UART driver for Cypress PSoC6 MCU family. + * @brief UART driver for Cypress PSOC 6 MCU family. * * Note: * - Error handling is not implemented. diff --git a/drivers/spi/Kconfig.psoc6 b/drivers/spi/Kconfig.psoc6 index 5b7fe353d8190..b42e9668e8502 100644 --- a/drivers/spi/Kconfig.psoc6 +++ b/drivers/spi/Kconfig.psoc6 @@ -4,10 +4,10 @@ # SPDX-License-Identifier: Apache-2.0 config SPI_PSOC6 - bool "PSoC-6 MCU SCB spi driver" + bool "PSOC 6 MCU SCB spi driver" default y depends on DT_HAS_CYPRESS_PSOC6_SPI_ENABLED select USE_INFINEON_SPI select PINCTRL help - This option enables the SCB[SPI] driver for PSoC-6 SoC family. + This option enables the SCB[SPI] driver for PSOC 6 SoC family. diff --git a/drivers/spi/spi_psoc6.c b/drivers/spi/spi_psoc6.c index 88f9ddc22d92f..c37da3117548e 100644 --- a/drivers/spi/spi_psoc6.c +++ b/drivers/spi/spi_psoc6.c @@ -169,7 +169,7 @@ static uint32_t spi_psoc6_get_freqdiv(uint32_t frequency) uint32_t oversample; uint32_t bus_freq = 100000000UL; /* - * TODO: Get PerBusSpeed when clocks are available to PSoC-6. + * TODO: Get PerBusSpeed when clocks are available to PSOC 6. * Currently the bus freq is fixed to 50Mhz and max SPI clk can be * 12.5MHz. */ diff --git a/dts/bindings/adc/infineon,cat1-adc.yaml b/dts/bindings/adc/infineon,cat1-adc.yaml index 7ae64d8845af0..6b58cd1343abf 100644 --- a/dts/bindings/adc/infineon,cat1-adc.yaml +++ b/dts/bindings/adc/infineon,cat1-adc.yaml @@ -5,7 +5,7 @@ description: | Infineon Cat1 ADC - Each ADC group Cat1 is assigned to a Zephyr device. Refer to the Infineon PSoC6 reference + Each ADC group Cat1 is assigned to a Zephyr device. Refer to the Infineon PSOC 6 reference manual (Section Port I/O functions) for the group/channel mapping to a specific port-pin on the board. For example on the cy8cproto_062_4343w P10.0 is mapped to adc0,channel0 and P10.1 is mapped to adc0,channel1. diff --git a/dts/bindings/bluetooth/infineon,cat1-bless-hci.yaml b/dts/bindings/bluetooth/infineon,cat1-bless-hci.yaml index 1d221144eb6b9..1a145908c1331 100644 --- a/dts/bindings/bluetooth/infineon,cat1-bless-hci.yaml +++ b/dts/bindings/bluetooth/infineon,cat1-bless-hci.yaml @@ -12,7 +12,7 @@ include: bt-hci.yaml properties: bt-hci-name: - default: "PSoC 6 BLESS" + default: "PSOC 6 BLESS" bt-hci-bus: default: "virtual" bt-hci-quirks: diff --git a/dts/bindings/hwinfo/cypress,psoc6-uid.yaml b/dts/bindings/hwinfo/cypress,psoc6-uid.yaml index 8602842c074b4..8ce2b960c4046 100644 --- a/dts/bindings/hwinfo/cypress,psoc6-uid.yaml +++ b/dts/bindings/hwinfo/cypress,psoc6-uid.yaml @@ -1,7 +1,7 @@ # Copyright (c) 2020 ATL Electronics # SPDX-License-Identifier: Apache-2.0 -description: Cypress PSoC-6 Unique 88-bit Serial Number +description: Cypress PSOC 6 Unique 88-bit Serial Number compatible: "cypress,psoc6-uid" diff --git a/dts/bindings/interrupt-controller/cypress,psoc6-intmux.yaml b/dts/bindings/interrupt-controller/cypress,psoc6-intmux.yaml index 4e9770e65ce85..636dce546c7a8 100644 --- a/dts/bindings/interrupt-controller/cypress,psoc6-intmux.yaml +++ b/dts/bindings/interrupt-controller/cypress,psoc6-intmux.yaml @@ -5,7 +5,7 @@ description: | Cypress Interrupt Multiplex - The PSoC-6 Cortex-M0+ NVIC can handle up to 32 interrupts. This means that + The PSOC 6 Cortex-M0+ NVIC can handle up to 32 interrupts. This means that user can select up to 32 interrupts sources from the 240 possible vectors to be processed in the Cortex-M0+ CPU. @@ -20,7 +20,7 @@ description: | On a general view, the below represents the Interrupt Multiplexer configuration and how the Cortex-M0+ NVIC sources are organized. Each channel chX represents a Cortex-M0+ NVIC line and it stores a vector number. - The vector number selects the PSoC-6 peripheral interrupt source for the + The vector number selects the PSOC 6 peripheral interrupt source for the Cortex-M0+ NVIC controller line. intmux[0] = {ch03, ch02, ch01, ch00} @@ -31,7 +31,7 @@ description: | In practical terms, the Cortex-M0+ requires user to define all NVIC interrupt sources and the proper NVIC interrupt order. With that, the system configures the Cortex-M0+ Interrupt Multiplexer and interrupts can be processed. - More information about it at PSoC-6 Architecture Technical Reference Manual, + More information about it at PSOC 6 Architecture Technical Reference Manual, section CPU Sub System (CPUSS) Registers. @@ -56,7 +56,7 @@ description: | CH REGS INT NUM CH CH/REG intmux[20 mod 8] |= 0x02 << (20 mod 4); - These results in Cortex-M0+ NVIC line 20 handling PSoC-6 interrupt source 2. + These results in Cortex-M0+ NVIC line 20 handling PSOC 6 interrupt source 2. The interrupt can be enabled/disabled at NVIC at line 20 as usual. Notes: diff --git a/dts/bindings/serial/cypress,psoc6-uart.yaml b/dts/bindings/serial/cypress,psoc6-uart.yaml index 6cf83bce61790..05f03a8b1cd52 100644 --- a/dts/bindings/serial/cypress,psoc6-uart.yaml +++ b/dts/bindings/serial/cypress,psoc6-uart.yaml @@ -28,7 +28,7 @@ properties: nodelabel that matches the Cypress SoC HAL defines and be of the form p___. - For example the UART on PSoC-63 Pioneer Kit would be + For example the UART on PSOC 63 Pioneer Kit would be pinctrl-0 = <&p5_0_uart5_rx &p5_1_uart5_tx>; required: true diff --git a/dts/bindings/spi/cypress,psoc6-spi.yaml b/dts/bindings/spi/cypress,psoc6-spi.yaml index bebdc53d314b1..3a162ec2cd3ac 100644 --- a/dts/bindings/spi/cypress,psoc6-spi.yaml +++ b/dts/bindings/spi/cypress,psoc6-spi.yaml @@ -28,7 +28,7 @@ properties: nodes will have a nodelabel that matches the Cypress SoC HAL defines and be of the form p___. - For example the SPI on PSoC-63 Pioneer Kit would be + For example the SPI on PSOC 63 Pioneer Kit would be pinctrl-0 = <&p12_0_spi6_mosi &p12_1_spi6_miso &p12_2_spi6_clk &p12_3_spi6_sel0>; required: true diff --git a/modules/hal_infineon/mtb-hal-cat1/CMakeLists.txt b/modules/hal_infineon/mtb-hal-cat1/CMakeLists.txt index bff5cb96e66c3..268ae46546fd0 100644 --- a/modules/hal_infineon/mtb-hal-cat1/CMakeLists.txt +++ b/modules/hal_infineon/mtb-hal-cat1/CMakeLists.txt @@ -7,7 +7,7 @@ set(hal_dir ${ZEPHYR_HAL_INFINEON_MODULE_DIR}/mtb-hal-cat1) set(hal_cat1a_dir ${hal_dir}/COMPONENT_CAT1A) set(hal_cat1b_dir ${hal_dir}/COMPONENT_CAT1B) -# PSoC 6 family defines +# PSOC 6 family defines zephyr_compile_definitions_ifdef(CONFIG_SOC_FAMILY_INFINEON_CAT1A COMPONENT_CAT1A) zephyr_compile_definitions_ifdef(CONFIG_SOC_FAMILY_INFINEON_CAT1B COMPONENT_CAT1B) zephyr_compile_definitions_ifdef(CONFIG_SOC_FAMILY_INFINEON_CAT1 COMPONENT_CAT1) diff --git a/soc/infineon/cat1a/Kconfig b/soc/infineon/cat1a/Kconfig index f7e3e0b49b477..c69e8f5e0bdf7 100644 --- a/soc/infineon/cat1a/Kconfig +++ b/soc/infineon/cat1a/Kconfig @@ -35,17 +35,17 @@ config SOC_PSOC6_M0_ENABLES_M4 Cortex-M0 CPU should boot Cortex-M4 if SOC_FAMILY_PSOC6 -## PSoC™ 6 Cortex M0+ prebuilt images +## PSOC™ 6 Cortex M0+ prebuilt images choice - prompt "PSoC™ 6 Cortex M0+ prebuilt images" + prompt "PSOC™ 6 Cortex M0+ prebuilt images" help - Choose the prebuilt application image to be executed on the Cortex-M0+ core of the PSoC™ 6 + Choose the prebuilt application image to be executed on the Cortex-M0+ core of the PSOC™ 6 dual-core MCU. The image is responsible for booting the Cortex-M4 on the device. config SOC_PSOC6_CM0P_IMAGE_SLEEP bool "DeepSleep" help - DeepSleep prebuilt application image is executed on the Cortex-M0+ core of the PSoC™ 6 BLE + DeepSleep prebuilt application image is executed on the Cortex-M0+ core of the PSOC™ 6 BLE dual-core MCU.The image is provided as C array ready to be compiled as part of the Cortex-M4 application. The Cortex-M0+ application code is placed to internal flash by the Cortex-M4 linker script. diff --git a/soc/infineon/cat1a/Kconfig.soc b/soc/infineon/cat1a/Kconfig.soc index a70e341dd410a..66231ceea55a6 100644 --- a/soc/infineon/cat1a/Kconfig.soc +++ b/soc/infineon/cat1a/Kconfig.soc @@ -27,7 +27,7 @@ config SOC_FAMILY_PSOC6_LEGACY_M4 config SOC_FAMILY_PSOC6_LEGACY_M0 bool -# Cypress PSoC™ 6 MCU lines +# Cypress PSOC™ 6 MCU lines config SOC_SERIES_PSOC6_60 bool select SOC_FAMILY_PSOC6 if !SOC_FAMILY_PSOC6_LEGACY diff --git a/soc/infineon/cat1a/common/soc.c b/soc/infineon/cat1a/common/soc.c index 74c3703bb03a1..8355ab72f8026 100644 --- a/soc/infineon/cat1a/common/soc.c +++ b/soc/infineon/cat1a/common/soc.c @@ -6,7 +6,7 @@ */ /** - * @brief Infineon PSoC 6 SOC. + * @brief Infineon PSOC 6 SOC. */ #include diff --git a/soc/infineon/cat1a/common/soc.h b/soc/infineon/cat1a/common/soc.h index a108dc09d8cc1..cfc3e8f15abb4 100644 --- a/soc/infineon/cat1a/common/soc.h +++ b/soc/infineon/cat1a/common/soc.h @@ -6,7 +6,7 @@ */ /** - * @brief Infineon PSoC 6 SOC. + * @brief Infineon PSOC 6 SOC. */ #ifndef _SOC__H_ diff --git a/soc/infineon/cat1a/psoc6_01/Kconfig.defconfig b/soc/infineon/cat1a/psoc6_01/Kconfig.defconfig index aec3e32650c80..acfefd580e24f 100644 --- a/soc/infineon/cat1a/psoc6_01/Kconfig.defconfig +++ b/soc/infineon/cat1a/psoc6_01/Kconfig.defconfig @@ -2,7 +2,7 @@ # an affiliate of Cypress Semiconductor Corporation # SPDX-License-Identifier: Apache-2.0 -# Infineon PSoC6_01 based MCU default configuration +# Infineon PSOC 6_01 based MCU default configuration if SOC_DIE_PSOC6_01 diff --git a/soc/infineon/cat1a/psoc6_01/Kconfig.soc b/soc/infineon/cat1a/psoc6_01/Kconfig.soc index 3380db75d79d6..ef1a359674225 100644 --- a/soc/infineon/cat1a/psoc6_01/Kconfig.soc +++ b/soc/infineon/cat1a/psoc6_01/Kconfig.soc @@ -31,7 +31,7 @@ config SOC_PACKAGE_PSOC6_01_104_M_CSP_BLE_USB config SOC_PACKAGE_PSOC6_01_68_QFN_BLE bool -# Infineon PSoC6_01 series MCUs +# Infineon PSOC 6_01 series MCUs config SOC_CY8C6036BZI_F04 bool select SOC_DIE_PSOC6_01 diff --git a/soc/infineon/cat1a/psoc6_02/Kconfig.defconfig b/soc/infineon/cat1a/psoc6_02/Kconfig.defconfig index 65c86f0b831b6..7f3f36d865fa2 100644 --- a/soc/infineon/cat1a/psoc6_02/Kconfig.defconfig +++ b/soc/infineon/cat1a/psoc6_02/Kconfig.defconfig @@ -2,7 +2,7 @@ # an affiliate of Cypress Semiconductor Corporation # SPDX-License-Identifier: Apache-2.0 -# Infineon PSoC6_02 based MCU default configuration +# Infineon PSOC 6_02 based MCU default configuration if SOC_DIE_PSOC6_02 diff --git a/soc/infineon/cat1a/psoc6_02/Kconfig.soc b/soc/infineon/cat1a/psoc6_02/Kconfig.soc index 1a3d7e054673e..0cfca7802278d 100644 --- a/soc/infineon/cat1a/psoc6_02/Kconfig.soc +++ b/soc/infineon/cat1a/psoc6_02/Kconfig.soc @@ -19,7 +19,7 @@ config SOC_PACKAGE_PSOC6_02_128_TQFP config SOC_PACKAGE_PSOC6_02_68_QFN bool -# Infineon PSoC6_02 series MCUs +# Infineon PSOC 6_02 series MCUs config SOC_CYB0644ABZI_S2D44 bool select SOC_DIE_PSOC6_02 diff --git a/soc/infineon/cat1a/psoc6_03/Kconfig.defconfig b/soc/infineon/cat1a/psoc6_03/Kconfig.defconfig index 9986f512d3ea8..1516df04b3365 100644 --- a/soc/infineon/cat1a/psoc6_03/Kconfig.defconfig +++ b/soc/infineon/cat1a/psoc6_03/Kconfig.defconfig @@ -2,7 +2,7 @@ # an affiliate of Cypress Semiconductor Corporation # SPDX-License-Identifier: Apache-2.0 -# Infineon PSoC6_03 based MCU default configuration +# Infineon PSOC 6_03 based MCU default configuration if SOC_DIE_PSOC6_03 diff --git a/soc/infineon/cat1a/psoc6_03/Kconfig.soc b/soc/infineon/cat1a/psoc6_03/Kconfig.soc index 1863a4fd22988..16379c8af07b9 100644 --- a/soc/infineon/cat1a/psoc6_03/Kconfig.soc +++ b/soc/infineon/cat1a/psoc6_03/Kconfig.soc @@ -16,7 +16,7 @@ config SOC_PACKAGE_PSOC6_03_68_QFN config SOC_PACKAGE_PSOC6_03_49_WLCSP bool -# Infineon PSoC6_03 series MCUs +# Infineon PSOC 6_03 series MCUs config SOC_CY8C6245AZI_S3D72 bool select SOC_DIE_PSOC6_03 diff --git a/soc/infineon/cat1a/psoc6_04/Kconfig.defconfig b/soc/infineon/cat1a/psoc6_04/Kconfig.defconfig index 77de960a053b6..3ebc2882b79be 100644 --- a/soc/infineon/cat1a/psoc6_04/Kconfig.defconfig +++ b/soc/infineon/cat1a/psoc6_04/Kconfig.defconfig @@ -2,7 +2,7 @@ # an affiliate of Cypress Semiconductor Corporation # SPDX-License-Identifier: Apache-2.0 -# Infineon PSoC6_04 based MCU default configuration +# Infineon PSOC 6_04 based MCU default configuration if SOC_DIE_PSOC6_04 diff --git a/soc/infineon/cat1a/psoc6_04/Kconfig.soc b/soc/infineon/cat1a/psoc6_04/Kconfig.soc index b70ed63313cb5..2f312922fe98b 100644 --- a/soc/infineon/cat1a/psoc6_04/Kconfig.soc +++ b/soc/infineon/cat1a/psoc6_04/Kconfig.soc @@ -19,7 +19,7 @@ config SOC_PACKAGE_PSOC6_04_80_TQFP config SOC_PACKAGE_PSOC6_04_80_M_CSP bool -# Infineon PSoC6_04 series MCUs +# Infineon PSOC 6_04 series MCUs config SOC_CY8C6244AZI_S4D92 bool select SOC_DIE_PSOC6_04 diff --git a/soc/infineon/cat1a/psoc6_legacy/Kconfig.defconfig b/soc/infineon/cat1a/psoc6_legacy/Kconfig.defconfig index c6da791fa963f..2fa63b441e847 100644 --- a/soc/infineon/cat1a/psoc6_legacy/Kconfig.defconfig +++ b/soc/infineon/cat1a/psoc6_legacy/Kconfig.defconfig @@ -2,7 +2,7 @@ # an affiliate of Cypress Semiconductor Corporation # SPDX-License-Identifier: Apache-2.0 -# Infineon PSoC6 (Legacy) based MCU default configuration +# Infineon PSOC 6 (Legacy) based MCU default configuration if SOC_FAMILY_PSOC6_LEGACY diff --git a/soc/infineon/cat1a/psoc6_legacy/Kconfig.soc b/soc/infineon/cat1a/psoc6_legacy/Kconfig.soc index 7cb8f8acde994..a4bced821fe34 100644 --- a/soc/infineon/cat1a/psoc6_legacy/Kconfig.soc +++ b/soc/infineon/cat1a/psoc6_legacy/Kconfig.soc @@ -2,7 +2,7 @@ # an affiliate of Cypress Semiconductor Corporation # SPDX-License-Identifier: Apache-2.0 -# Infineon PSoC6 (legacy) series MCUs +# Infineon PSOC 6 (legacy) series MCUs config SOC_CY8C6247_M0 bool select SOC_SERIES_PSOC6_62 diff --git a/soc/infineon/cat1a/psoc6_legacy/cypress_psoc6_dt.h b/soc/infineon/cat1a/psoc6_legacy/cypress_psoc6_dt.h index 21e88f61c4127..5e3863ac71e1f 100644 --- a/soc/infineon/cat1a/psoc6_legacy/cypress_psoc6_dt.h +++ b/soc/infineon/cat1a/psoc6_legacy/cypress_psoc6_dt.h @@ -6,7 +6,7 @@ */ /** @file - * @brief Cypress PSoC-6 MCU family devicetree helper macros + * @brief Cypress PSOC 6 MCU family devicetree helper macros */ #ifndef _CYPRESS_PSOC6_DT_H_ @@ -19,7 +19,7 @@ * Devicetree macros related to interrupt * * The main "API" macro is CY_PSOC6_IRQ_CONFIG. It is an internal definition - * used to configure the PSoC-6 interrupts in a generic way. This is necessary + * used to configure the PSOC 6 interrupts in a generic way. This is necessary * because Cortex-M0+ can handle a limited number of interrupts and have * multiplexers in front of any NVIC interrupt line. * @@ -48,7 +48,7 @@ * configuration code. * * The Cortex-M0+ must get from interrupt parent the interrupt line and - * configure the interrupt channel to connect PSoC-6 peripheral interrupt to + * configure the interrupt channel to connect PSOC 6 peripheral interrupt to * Cortex-M0+ NVIC. The multiplexer is configured by CY_PSOC6_DT_NVIC_MUX_MAP * using the interrupt value from the interrupt parent. * diff --git a/soc/infineon/cat1a/psoc6_legacy/soc.c b/soc/infineon/cat1a/psoc6_legacy/soc.c index d75693744e4ac..8a5dd3470d0af 100644 --- a/soc/infineon/cat1a/psoc6_legacy/soc.c +++ b/soc/infineon/cat1a/psoc6_legacy/soc.c @@ -38,7 +38,7 @@ #define CY_CFG_PWR_USING_ULP 0 /* Dummy symbols, requres for cy_sysint.c module. - * NOTE: in this PSoC 6 integration, PSoC 6 Zephyr drivers (uart, spi, gpio) + * NOTE: in this PSOC 6 integration, PSOC 6 Zephyr drivers (uart, spi, gpio) * do not use cy_sysint.c implementation to handle interrupt routine. * Instead this they use IRQ_CONNECT to define ISR. */ From 5f418f506c717ed39686ab0b11a3e6e4bf4fb756 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Fri, 15 Nov 2024 00:45:36 +0100 Subject: [PATCH 2347/4482] docs: contribute: documentation: generation: fix missing doc fix the path where the user has to be in order to execute make html-fast Signed-off-by: Jilay Pandya --- doc/contribute/documentation/generation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/contribute/documentation/generation.rst b/doc/contribute/documentation/generation.rst index 79f777204c3a0..8c5675333231d 100644 --- a/doc/contribute/documentation/generation.rst +++ b/doc/contribute/documentation/generation.rst @@ -255,7 +255,7 @@ To enable this mode, set the following option when invoking cmake:: or invoke make with the following target:: - cd ~/zephyr + cd ~/zephyr/doc # To generate HTML output without detailed Kconfig make html-fast From 7092335c11869f11ebc8f7d65440126bcc2b8683 Mon Sep 17 00:00:00 2001 From: Lukasz Mrugala Date: Mon, 28 Oct 2024 09:29:05 +0000 Subject: [PATCH 2348/4482] doc: Add information on Twister Statuses Currently, Twister Statuses are only useful for the initiated, save for the very basics. This is in opposition to the fact that they are the main thing end users take into account when checking their Twister run reports. In order to make Statuses more useful for the end user, a new documentation page has been created, elucidating the full meaning of all Statuses. Signed-off-by: Lukasz Mrugala --- doc/develop/test/index.rst | 1 + doc/develop/test/twister.rst | 8 +- doc/develop/test/twister_statuses.rst | 215 ++++++++++++++++++++++++++ 3 files changed, 222 insertions(+), 2 deletions(-) create mode 100644 doc/develop/test/twister_statuses.rst diff --git a/doc/develop/test/index.rst b/doc/develop/test/index.rst index c5f96b400caee..b0d836a0e4f0e 100644 --- a/doc/develop/test/index.rst +++ b/doc/develop/test/index.rst @@ -8,6 +8,7 @@ Testing ztest twister + twister_statuses twister/twister_blackbox pytest coverage diff --git a/doc/develop/test/twister.rst b/doc/develop/test/twister.rst index f535648dd6e91..eb34435dded9f 100644 --- a/doc/develop/test/twister.rst +++ b/doc/develop/test/twister.rst @@ -19,8 +19,10 @@ complete code tree buildable. When using (at least) one ``-v`` option, twister's console output shows for every test application how the test is run (qemu, native_sim, etc.) or -whether the binary was just built. There are a few reasons why twister -only builds a test and doesn't run it: +whether the binary was just built. The resultant +:ref:`status ` +of a test is likewise reported in the ``twister.json`` and other report files. +There are a few reasons why twister only builds a test and doesn't run it: - The test is marked as ``build_only: true`` in its ``.yaml`` configuration file. @@ -214,6 +216,8 @@ env: used, for example, only if some required software or hardware is present, and to signal that presence to twister using these environment variables. +.. _twister_tests_long_version: + Tests ****** diff --git a/doc/develop/test/twister_statuses.rst b/doc/develop/test/twister_statuses.rst new file mode 100644 index 0000000000000..91e829564940b --- /dev/null +++ b/doc/develop/test/twister_statuses.rst @@ -0,0 +1,215 @@ +.. _twister_statuses: + +Twister Status +############## + +What is a Twister Status? +========================= + +Twister Status formulates the current state of + +- ``Harness`` +- ``TestCase`` +- ``TestSuite`` +- ``TestInstance`` + +in a comprehensive and easy-to understand way. +In practice, most users will be interested in Statuses +of Instances and Cases after the conclusion of their Twister runs. + +.. tip:: + + Nomenclature reminder: + + .. tabs:: + + .. tab:: ``Harness`` + + ``Harness`` is a Python class inside Twister that allows us + to capture and analyse output from a program external to Twister. + It has been excised from this page for clarity, + as it does not appear in final reports. + + .. tab:: ``TestCase`` + + ``TestCase``, also called Case, is a piece of code that aims to verify some assertion. + It is the smallest subdivision of testing in Zephyr. + + .. tab:: ``TestSuite`` + + ``TestSuite``, also called Suite, is a grouping of Cases. + One can modify Twister's behaviour on a per-Suite basis via ``testcase.yaml`` files. + Such grouped Cases should have enough in common + for it to make sense to treat them all the same by Twister. + + .. tab:: ``TestInstance`` + + ``TestInstance``, also called Instance, is a Suite on some platform. + Twister typically reports its results for Instances, + despite them being called "Suites" there. + If a status is marked as applicable for Suites, it is also applicable for Instances. + As the distinction between them is not useful in this section, + whenever you read "Suite", assume the same for Instances. + + More detailed explanation can be found :ref:`here `. + +Possible Twister Statuses +========================= + +.. list-table:: Twister Statuses + :widths: 10 10 66 7 7 + :header-rows: 1 + + * - In-code + - In-text + - Description + - Suite + - Case + * - FILTER + - filtered + - A static or runtime filter has eliminated the test from the list of tests to use. + - ✓ + - ✓ + * - NOTRUN + - not run + - The test wasn't run because it was not runnable in current configuration. + It was, however, built correctly. + - ✓ + - ✓ + * - BLOCK + - blocked + - The test was not run because of an error or crash in the test suite. + - ✕ + - ✓ + * - SKIP + - skipped + - Test was skipped by some other reason than previously delineated. + - ✓ + - ✓ + * - ERROR + - error + - The test produced an error in running the test itself. + - ✓ + - ✓ + * - FAIL + - failed + - The test produced results different than expected. + - ✓ + - ✓ + * - PASS + - passed + - The test produced results as expected. + - ✓ + - ✓ + +**In-code** and **In-text** are the naming contexts of a given status: +the former is rather internal for Twister and appears in logs, +whereas the latter is used in the JSON reports. + +.. note:: + + There are two more Statuses that are internal to Twister. + ``NONE`` (A starting status for Cases and Suites) and + ``STARTED`` (Indicating an in-progress Case). + Those should not appear in the final Twister report. + Appearance of those non-terminal Statuses in one's report files indicates a problem with Twister. + + +Case and Suite Status combinations +============================================ + +.. list-table:: Case and Suite Status combinations + :widths: 22 13 13 13 13 13 13 + :align: center + :header-rows: 1 + :stub-columns: 1 + + * - ↓ Case\\Suite → + - FILTER + - ERROR + - FAIL + - PASS + - NOTRUN + - SKIP + * - FILTER + - ✓ + - ✕ + - ✕ + - ✕ + - ✕ + - ✕ + * - ERROR + - ✕ + - ✓ + - ✕ + - ✕ + - ✕ + - ✕ + * - BLOCK + - ✕ + - ✓ + - ✓ + - ✕ + - ✕ + - ✕ + * - FAIL + - ✕ + - ✓ + - ✓ + - ✕ + - ✕ + - ✕ + * - PASS + - ✕ + - ✓ + - ✓ + - ✓ + - ✕ + - ✕ + * - NOTRUN + - ✕ + - ✕ + - ✕ + - ✕ + - ✓ + - ✕ + * - SKIP + - ✕ + - ✓ + - ✓ + - ✓ + - ✕ + - ✓ + +✕ indicates that such a combination should not happen in a proper Twister run. In other words, +no Suite of a status indicated by the table column should contain any Cases of a status indicated +by the table row. + +✓ indicates a proper combination. + +Detailed explanation, per Suite Status +------------------------------------------- + +``FILTER``: + This status indicates that the whole Suite has been statically filtered + out of a given Twister run. Thus, any Case within it should also have such a status. + +``ERROR``: + Suite encountered a problem when running the test. It requires at least one case with + ``ERROR`` or ``BLOCK`` status. As this takes precedence over all other Case statuses, all valid + terminal Case statuses can be within such a Suite. + +``FAIL``: + Suite has at least one Case that did not meet its assertions. This takes precedence over + all other Case statuses, given that the conditions for an ERROR status have not been met. + +``PASS``: + Suite has passed properly. It cannot contain any Cases with ``BLOCK``, ``ERROR``, or ``FAIL`` + statuses, as those indicate a problem when running the Suite. + +``NOTRUN``: + Whole suite was not run, but only built. It requires than all Cases within were not run. + As runnability is decided on a per-Suite basis, only ``NOTRUN`` is applicable for its Cases. + +``SKIP``: + Whole Suite has been skipped at runtime. All Cases need to have ``SKIP`` status as well. From a482884751aedf7a1f2da80fd26950b1e3486a73 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Fri, 15 Nov 2024 00:49:57 +0100 Subject: [PATCH 2349/4482] doc: release: doc stepper API as major enhancement Add entry in "Major enhancements with this release include:" for stepper device driver subsystem. Signed-off-by: Jilay Pandya --- doc/releases/release-notes-4.0.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 41f259a1f8578..848e99d76eed2 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -19,6 +19,11 @@ Major enhancements with this release include: :dtcompatible:`nordic,nrf-comp`, :dtcompatible:`nordic,nrf-lpcomp` and :dtcompatible:`nxp,kinetis-acmp` are supported. +* The introduction of the :ref:`stepper` device driver subsystem for stepper motors, + complete with shell support. Initially implemented drivers include a simple + :dtcompatible:`zephyr,gpio-stepper` and a complex sensor-less stall-detection capable with + integrated ramp-controller :dtcompatible:`adi,tmc5041`. + An overview of the changes required or recommended when migrating your application from Zephyr v3.7.0 to Zephyr v4.0.0 can be found in the separate :ref:`migration guide`. From 8034de73d57b135f37341919b1264504459a8275 Mon Sep 17 00:00:00 2001 From: Ahmed Adel Date: Thu, 14 Nov 2024 23:50:57 +0100 Subject: [PATCH 2350/4482] doc: services: debugging: Remove unwanted reference link Remove unwanted reference link to the section (Usage) in ARM Coresight Trace Deformatter that shows up in the main Debugging documentation page, by lowering the level of (Usage) heading from ##### to ***** The commit also has a typo fix. Signed-off-by: Ahmed Adel --- doc/services/debugging/coredump.rst | 2 +- doc/services/debugging/cs_trace_defmt.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/services/debugging/coredump.rst b/doc/services/debugging/coredump.rst index a5a84b96ccd42..aed426fb26ceb 100644 --- a/doc/services/debugging/coredump.rst +++ b/doc/services/debugging/coredump.rst @@ -45,7 +45,7 @@ Usage When the core dump module is enabled, during a fatal error, CPU registers and memory content are printed or stored according to which backends -are enabled. This core dump data can fed into a custom-made GDB server as +are enabled. This core dump data can be fed into a custom-made GDB server as a remote target for GDB (and other GDB compatible debuggers). CPU registers, memory content and stack can be examined in the debugger. diff --git a/doc/services/debugging/cs_trace_defmt.rst b/doc/services/debugging/cs_trace_defmt.rst index 7bade40c9f7a4..aea18947516ec 100644 --- a/doc/services/debugging/cs_trace_defmt.rst +++ b/doc/services/debugging/cs_trace_defmt.rst @@ -11,7 +11,7 @@ decoded offline by the host but deformatter can be used on-chip to decode the da application runtime. Usage -##### +***** Deformatter is initialized with a user callback. Data is decoded using :c:func:`cs_trace_defmt_process` in 16 bytes chunks. Callback is called whenever stream changes or From 24c2c43bcd240badeb4a3f0e2697554b29bd4816 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 14 Nov 2024 19:10:21 +0100 Subject: [PATCH 2351/4482] boards nrf52_bsim: Fix sample used as example Let's fix the sample used in the example. The peripheral_hr and central_hr are meant to be run with each other. Let's also use the :zephyr:code-sample: directive to refer to the samples so we get a link. Signed-off-by: Alberto Escolar Piedras --- boards/native/nrf_bsim/doc/nrf52_bsim.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/boards/native/nrf_bsim/doc/nrf52_bsim.rst b/boards/native/nrf_bsim/doc/nrf52_bsim.rst index 78c8e5c327963..01bd2c9f88ef8 100644 --- a/boards/native/nrf_bsim/doc/nrf52_bsim.rst +++ b/boards/native/nrf_bsim/doc/nrf52_bsim.rst @@ -120,10 +120,10 @@ most Zephyr samples and tests. When you want to run a simulation with radio activity you need to run also the BableSim 2G4 (2.4GHz) physical layer simulation (phy). -For example, if you would like to run a simple case with 1 BLE ``central_hr`` -sample application connecting to a BLE ``peripheral`` sample application: -Build the ``central_hr`` application targeting this board and copy the resulting -executable to the simulator bin folder with a sensible name: +For example, if you would like to run a simple case with a BLE :zephyr:code-sample:`ble_central_hr` +sample application connecting to a BLE :zephyr:code-sample:`ble_peripheral_hr` sample application: +Build the :zephyr:code-sample:`ble_central_hr` application targeting this board and copy the +resulting executable to the simulator bin folder with a sensible name: .. zephyr-app-commands:: :zephyr-app: samples/bluetooth/central_hr @@ -137,10 +137,10 @@ executable to the simulator bin folder with a sensible name: $ cp build/zephyr/zephyr.exe \ ${BSIM_OUT_PATH}/bin/bs_nrf52_bsim_samples_bluetooth_central_hr -Do the same for the ``peripheral`` sample app: +Do the same for the :zephyr:code-sample:`ble_peripheral_hr` sample app: .. zephyr-app-commands:: - :zephyr-app: samples/bluetooth/peripheral + :zephyr-app: samples/bluetooth/peripheral_hr :host-os: unix :board: nrf52_bsim :goals: build @@ -149,7 +149,7 @@ Do the same for the ``peripheral`` sample app: .. code-block:: console $ cp build/zephyr/zephyr.exe \ - ${BSIM_OUT_PATH}/bin/bs_nrf52_bsim_samples_bluetooth_peripheral + ${BSIM_OUT_PATH}/bin/bs_nrf52_bsim_samples_bluetooth_peripheral_hr And then run them together with BabbleSim's 2G4 physical layer simulation: From d71d4c0e80a6c6b6a84dec123eb4840c0656eb3c Mon Sep 17 00:00:00 2001 From: Gerson Fernando Budke Date: Fri, 15 Nov 2024 16:26:26 +0100 Subject: [PATCH 2352/4482] drivers: rtc: sam: Fix missing function The #64939 introduced a few convenience function like rtc_utils_validate_rtc_time. However the PR did not replace all occurrences which result on a build error. This add the missing header include to remove a building warning and replace the old function by the new one. Fixes #81454 Signed-off-by: Gerson Fernando Budke --- drivers/rtc/rtc_sam.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/rtc_sam.c b/drivers/rtc/rtc_sam.c index c9868e636520e..22aec94f1d875 100644 --- a/drivers/rtc/rtc_sam.c +++ b/drivers/rtc/rtc_sam.c @@ -14,6 +14,7 @@ #include #include +#include "rtc_utils.h" #define RTC_SAM_REG_GET_FIELD(value, field) \ ((RTC_##field##_Msk & value) >> RTC_##field##_Pos) @@ -358,7 +359,7 @@ static int rtc_sam_alarm_set_time(const struct device *dev, uint16_t id, uint16_ return -EINVAL; } - if (rtc_sam_validate_tm(timeptr, mask) == false) { + if (rtc_utils_validate_rtc_time(timeptr, mask) == false) { return -EINVAL; } From 214837fa2b3e80f12331ce9325f4b2a3f963abe9 Mon Sep 17 00:00:00 2001 From: Yves Vandervennet Date: Mon, 11 Nov 2024 09:54:52 -0600 Subject: [PATCH 2353/4482] doc: release: NXP contribution Adding NXP's contributions to v4.0 Signed-off-by: Yves Vandervennet --- doc/releases/release-notes-4.0.rst | 140 ++++++++++++++++++++++++++++- 1 file changed, 139 insertions(+), 1 deletion(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 848e99d76eed2..c6cbb556fa2e1 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -80,9 +80,12 @@ Architectures * ARM + * Added support of device memory attributes on Cortex-M (arm_mpu_v8) + * ARM64 * Added initial support for :c:func:`arch_stack_walk` that supports unwinding via esf only + * Added sys_arch_reboot() support to ARM64 * Added support for demand paging. @@ -151,6 +154,22 @@ Bluetooth :c:func:`bt_conn_le_create` and :c:func:`bt_conn_le_create_synced` return an error if the connection pointer passed as an argument is not NULL. + * Fixed an ltk derive issue in L2CAP + * Added listener callback for discovery (BR) + * Corrected BR bonding type (SSP) + * Added support for non-bondable mode (SSP) + * Changed SSP so that no MITM if required level is less than L3 + * Added checking the receiving buffer length before pulling data (AVDTP) + * Added support of security level 4 to SSP + * Fixed LE LTK cannot be derived + * Added support for Multi-Command Packet (l2cap) + * Improved the L2CAP code to Set flags in CFG RSP + * Improved the L2CAP code to handle all configuration options + * Improved the SSP code to clear pairing flag if ssp pairing completed area + * Improved the SMP code to check if remote supports CID 0x0007 + * Added support for SMP CT2 flag + * Improved the SSP code so the proper callback is called when pairing fails + * Controller * Added Periodic Advertising Sync Transfer (PAST) support with support for both sending and receiving roles. @@ -173,10 +192,14 @@ Boards & SoC Support * Added STM32U0 series with GPIO, Serial, I2C, DAC, ADC, flash, PWM and counter driver support. * Added STM32WB0 series with GPIO, Serial, I2C, SPI, ADC, DMA and flash driver support. * Added STM32U545xx SoC variant. + * Added NXP i.MX93's Cortex-M33 core + * Added NXP MCXW71, MCXC242, MCXA156, MCXN236, MCXC444, RT1180 * Made these changes in other SoC series: * NXP S32Z270: Added support for the new silicon cut version 2.0. Note that the previous + * NXP s32k3: fixed RAM retention issue + * NXP s32k1: obtain system clock frequency from Devicetree versions (1.0 and 1.1) are no longer supported. * Added ESP32 WROVER-E-N16R4 variant. * STM32H5: Added support for OpenOCD through STMicroelectronics OpenOCD fork. @@ -184,6 +207,19 @@ Boards & SoC Support * Silabs Series 2: Use oscillator, clock and DCDC configuration from device tree during init. * Silabs Series 2: Added initialization for SMU (Security Management Unit). * Silabs Series 2: Use sleeptimer as the default OS timer instead of systick. + * NXP i.MX8MP: Enable the IRQ_STEER interrupt controller. + * NXP RWxxx: + + * added additional support to Wakeup from low power modes + * RW61x: increased main stack size to avoid stack overflows when running BLE + * RW612: enabled SCTIMER + + * NXP IMXRT: Fixed flexspi boot issue caused by am erroneous relocation of the Flash Configuration Block + of Kconfig defaults being sourced + * NXP RT11xx: enabled FlexIO + * NXP IMXRT116x: Fixed bus clocking to align with the settings of the MCUXpresso SDK + * NXP mimxrt685: fixed clocks to enable DMIC + * NXP MCX N Series: Fixed NXP LPSPI native chip select when using synchronous API with DMA bug * Added support for these boards: @@ -249,6 +285,7 @@ Boards & SoC Support * :zephyr:board:`WeAct Studio USB2CANFDV1 ` (``usb2canfdv1``) * :zephyr:board:`Witte Technology Linum Board ` (``linum``) + * Made these board changes: * :ref:`native_posix` has been deprecated in favour of @@ -271,6 +308,15 @@ Boards & SoC Support * Added Thingy53 forwarding of network core pins to network core for SPI peripheral (disabled by default) including pin mappings. + * Added uart, flexio pwm, flexio spi, watchdog, flash, rtc, i2c, lpspi, edma, gpio, acmp, adc and lptmr support + to NXP ``frdm_ke17z`` and ``frdm_ke17z512`` + * Enabled support for MCUmgr on NXP boards + * Enabled MCUboot, FlexCAN, LPI2C, VREF, LPADC and timers (TPM, LPTMR, counter, watchdog) on NXP ``frdm_mcxw71`` + * Enabled I2C, PWM on NXP ``imx95_evk`` + * Enabled FLEXCAN, LPI2C on NXP ``s32z2xxdc2`` + * Enabled DSPI and EDMA3 on NXP ``s32z270dc2`` + * Enabled ENET ethernet on NXP ``imx8mm`` and ``imx8mn`` + * Added support for the NXP ``imx8qm`` and ``imx8qxp`` DSP core to enable the openAMP sample * Added support for the following shields: @@ -306,6 +352,9 @@ Build system and Infrastructure * Added support for RAM-load MCUboot operating mode in build system, including sysbuild support. +* Added a script parameter to Twister to enable HW specific arguments, such as a system specific + timeout + Documentation ************* @@ -338,6 +387,7 @@ Drivers and Sensors * STM32H7: Added support for higher sampling frequencies thanks to boost mode implementation. * Added initial support for Renesas RA8 ADC driver (:dtcompatible:`renesas,ra-adc`) * Added driver for Analog Devices MAX32 SoC series (:dtcompatible:`adi,max32-adc`). + * Added support for NXP S32 SAR_ADC (:dtcompatible:`nxp,s32-adc-sar`) * Battery @@ -363,6 +413,10 @@ Drivers and Sensors :dtcompatible:`renesas,ra-cgc-pll-out`) * Silabs: Added support for Series 2+ Clock Management Unit (see :dtcompatible:`silabs,series-clock`) +* Codec (Audio) + + * Added a driver for the Wolfson WM8904 audio codec (:dtcompatible:`wolfson,wm8904`) + * Comparator * Introduced comparator device driver subsystem selected with :kconfig:option:`CONFIG_COMPARATOR` @@ -384,6 +438,12 @@ Drivers and Sensors * DAC * DAC API now supports specifying channel path as internal. Support has been added in STM32 drivers. + * Updated the NXP counter_mcux_lptmr driver to support multiple instances of the lptmr + peripheral. + * Updated the initialization of clocks for the NXP LPTMR driver + * Converted the NXP S32 System Timer Module driver to native Zephyr code + * Converted NXP S32 Software Watchdog Timer driver to native Zephyr code + * Added support late and short relative alarms area to NXP nxp_sys_timer (:dtcompatible:`nxp,s32-sys-timer`) * Disk @@ -407,6 +467,8 @@ Drivers and Sensors * DMA * Added driver for Analog Devices MAX32 SoC series (:dtcompatible:`adi,max32-dma`). + * Added flip feature to the NXP dma_mcux_pxp driver (:dtcompatible:`nxp,pxp`) + * Added support for eDMAv5 and cyclic mode (:github:`80584`) to the NXP EMDA driver (:dtcompatible:`nxp,edma`) * EEPROM @@ -503,6 +565,8 @@ Drivers and Sensors * Implemented readout protection handling (RDP levels) for STM32F7 SoCs. * Added initial support for Renesas RA8 Flash controller driver (:dtcompatible:`renesas,ra-flash-hp-controller`) * Added driver for Analog Devices MAX32 SoC series (:dtcompatible:`adi,max32-flash-controller`). + * Added support for W25Q512JV and W25Q512NW-IQ/IN to NXP's MCUX Flexspi driver + * Renamed the binding :dtcompatible:`nxp,iap-msf1` to :dtcompatible:`nxp,msf1` for accuracy * GNSS @@ -510,6 +574,8 @@ Drivers and Sensors * tle9104: Add support for the parallel output mode via setting the properties ``parallel-out12`` and ``parallel-out34``. + * Converted the NXP S32 SIUL2 drivers to native Zephyr code + * Converted the NXP wake-up drivers to native Zephyr code * Hardware info @@ -563,9 +629,17 @@ Drivers and Sensors * Fixed broken ESP32 input touch sensor driver. + * gt911: + * Fixed the INT pin to be always set during probe to allow for proper initialization + * Fixed OOB buffer write to touch points array + * Add support for multitouch events + * Interrupt * Updated ESP32 family interrupt allocator with proper IRQ flags and priorities. + * Implemented a function to set pending interrupts for Arm GIC + * Added a safe configuration option so multiple OS'es can share the same GIC and avoid reconfiguring + the distributor * LED @@ -595,6 +669,10 @@ Drivers and Sensors * Added NXP IMX NETC mdio driver. * NXP ENET MDIO: Fixed inconsistent behavior by keeping the mdio interrupt enabled all the time. +* MEMC + + * Add driver for APS6404L PSRAM using NXP FLEXSPI + * MFD * Modem @@ -607,7 +685,12 @@ Drivers and Sensors * Added bitbang MIPI-DBI driver, supporting 8080 and 6800 mode (:dtcompatible:`zephyr,mipi-dbi-bitbang`). * Added support for STM32 FMC memory controller (:dtcompatible:`st,stm32-fmc-mipi-dbi`). - * Added support for 8080 mode to NXP LCDIC controller. + * Added support for 8080 mode to NXP LCDIC controller (:dtcompatible:`nxp,lcdic`). + * Fixed the calculation of the reset delay for NXP's LCD controller (:dtcompatible:`nxp,lcdic`) + +* MIPI-CSI + + * Improve NXP CSI and MIPI_CSI2Rx drivers to support varibale frame rates * MSPI @@ -625,6 +708,7 @@ Drivers and Sensors * rpi_pico: The driver now configures the divide ratio adaptively. * Added initial support for Renesas RA8 PWM driver (:dtcompatible:`renesas,ra8-pwm`) * Added driver for Analog Devices MAX32 SoC series (:dtcompatible:`adi,max32-pwm`). + * Fixed a build issue of the NXP TPM driver for variants without the capability to combine channels * Regulators @@ -636,13 +720,22 @@ Drivers and Sensors * RTC * STM32: HSE can now be used as domain clock. + * Added the NXP IRTC Driver. * RTIO +* SAI + + * Improved NXP's SAI driver to use a default clock if none is provided in the DT + * Fixed a bug in the NXP SAI driver that caused a crash on a FIFO under- and overrun + * Fixed a bug that reset the NXP ESAI during initialization (unnecessary) + * Added support for PM operations in NXP's SAI driver + * SDHC * Added ESP32-S3 driver support. * SPI SDHC driver now handles SPI devices with runtime PM support correctly + * Improved NXP's imx SDHC driver to assume card is present if no detection method is provided * Sensors @@ -701,6 +794,9 @@ Drivers and Sensors * Added Würth Elektronik HIDS-2525020210002 :dtcompatible:`we,wsen-hids-2525020210002` humidity sensor driver. + * Added general samples for triggers + * Added driver for NXP's fxls8974 accelerometer + * Serial * LiteX: Renamed the ``compatible`` from ``litex,uart0`` to :dtcompatible:`litex,uart`. @@ -736,6 +832,8 @@ Drivers and Sensors * Added support for USB HS on STM32U59x/STM32U5Ax SoC variants. * Enhanced DWC2 UDC driver * Added UDC drivers for Smartbond, NuMaker USBD and RP2040 device controllers + * Enabled SoF in NXP USB drivers (UDC) + * Enabled cache maintenance in the NXP EHCI USB driver * Video @@ -757,6 +855,9 @@ Drivers and Sensors * STM32: Implemented :c:func:`video_get_ctrl` and :c:func:`video_set_ctrl` APIs. * Removed an init order circular dependency for the camera pipeline on NXP RT10xx platforms (:github:`80304`) + * Added an NXP's smartdma based video driver (:dtcompatible:`nxp,video-smartdma`) + * Added frame interval APIs to support variable frame rates (video_sw_generator.c) + * Added image controls to the OV5640 driver * W1 @@ -883,6 +984,7 @@ Networking * Fixed IGMPv2 queries processing when IGMPv3 is enabled. * Fixed :kconfig:option:`CONFIG_NET_NATIVE_IPV4` dependency for native IPv4 options. * Fix net_pkt leak in :c:func:`send_ipv4_fragment`.` + * Fixed tx_pkts slab leak in send_ipv4_fragment * IPv6: @@ -893,9 +995,13 @@ Networking * Fixed unneeded error logging in case of dropped NS packets. * Fixed accepting of incoming DAD NS messages. * Various fixes improving IPv6 routing. + * Added onlink and forwarding check to IPv6-prepare * LwM2M: + * Location object: optional resources altitude, radius, and speed can now be + used optionally as per the location object's specification. Users of these + resources will now need to provide a read buffer. * Added TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 to DTLS cipher list. * Added LwM2M shell command for listing resources. * Added LwM2M shell command to list observations. @@ -1031,6 +1137,11 @@ Networking * Wi-Fi: + * Add a 80211R fast BSS transition argument usage to the wifi shell's connect command. + * Fixed the shell's ap config command using the sta interface area + * Added AP configuration cmd support to the NXP Wifi drivers + * Fixed the dormant state in the NXP WiFi driver to be set to off once a connection to an AP is achieved + * zperf: * Added support for USB CDC NCM in the zperf sample. @@ -1062,6 +1173,7 @@ Devicetree so that they can be used in string properties. * Renamed ``power-domain`` base property to ``power-domains``, and introduced ``power-domain-names`` property. ``#power-domain-cells`` is now required as well. +* Moved the NXP Remote Domain Controller property to its own schema file Kconfig ******* @@ -1185,6 +1297,7 @@ Libraries / Subsystems * LittleFS: The module has been updated with changes committed upstream from version 2.8.1, the last module update, up to and including the released version 2.9.3. + * Fixed static analysis error caused by mismatched variable assignment in NVS * LittleFS: Fixed an issue where the DTS option for configuring block cycles for LittleFS instances was ignored (:github:`79072`). @@ -1222,6 +1335,11 @@ Libraries / Subsystems * Task Watchdog +* Tracing + + * Added support for a "user event" trace, with the purpose to allow driver or + application developers to quickly add tracing for events for debug purposes + * POSIX API * LoRa/LoRaWAN @@ -1274,6 +1392,10 @@ HALs * Synced HAL to version v5.1.4 to update SoCs low level files, RF libraries and overall driver support. +* NXP + + * Updated the MCUX HAL to the SDK version 2.16.000 + * Updated the NXP S32ZE HAL drivers to version 2.0.0 * Silabs @@ -1331,6 +1453,8 @@ MCUboot * Fixed RAM load chain load address. * Fixed issue with properly retrieving image headers after interrupted swap-scratch in bootutil. * The MCUboot version in this release is version ``2.1.0+0-dev``. + * Add the following nxp boards as test targets area: ``frdm_ke17z``, ``frdm_ke17z512``, + ``rddrone_fmuk66``, ``twr_ke18f``, ``frdm_mcxn947/mcxn947/cpu0`` OSDP **** @@ -1352,6 +1476,7 @@ LVGL * Added definition of ``LV_ATTRIBUTE_MEM_ALIGN`` so library internal data structures can be aligned to a specific boundary. +* Provided alignment definition to accommodate the alignment requirement of some GPU's zcbor ***** @@ -1373,9 +1498,22 @@ Tests and Samples * Together with the deprecation of :ref:`native_posix`, many tests which were explicitly run in native_posix now run in :ref:`native_sim` instead. native_posix as a platform remains tested though. +* Added documentation (readme) for the erase_blocks flash test +* Extended the tests of counter_basic_api with a testcase for counters wihtout alarms +* Excluded NXP RW612 based boards from the WiFi test suite, as these boards require binary blobs + be downloaded in order to build as expected +* Added support for testing SDMMC devices to the fatfs API test +* Extended net/vlan to add IPv6 prefix config to each vlan-iface +* Enhanced the camera fixture test by adding a color bar to enable automation +* Fixed floating point logging issue in the video driver sample code +* Added a number crunching (maths such as FFT, echo cancellation) sample using optimized an + library for the NXP ADSP board +* Tailored the SPI_LOOPBACK test to the limitations of NXP Kinetis MCU's +* Enabled the video sample to run video capture (samples/drivers/video) * Added :zephyr:code-sample:`smf_calculator` sample demonstrating the usage of the State Machine framework in combination with LVGL to create a simple calculator application. +* Consolidated display sample where possible to use a single testcase for all shields Issue Related Items ******************* From 95f4912e727ffdc453898192a5bdeb0a97c0ad67 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Fri, 15 Nov 2024 09:43:45 -0500 Subject: [PATCH 2354/4482] doc: posix: options: correct anchor for thread safe functions Previously, the anchor for `_POSIX_THREAD_SAFE_FUNCTIONS` was `posix_thread_safe_functions` but it should have been `posix_option_thread_safe_functions`. Signed-off-by: Chris Friedt --- doc/services/portability/posix/conformance/index.rst | 2 +- doc/services/portability/posix/option_groups/index.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/services/portability/posix/conformance/index.rst b/doc/services/portability/posix/conformance/index.rst index acba97e6d85f8..e809ae08401f8 100644 --- a/doc/services/portability/posix/conformance/index.rst +++ b/doc/services/portability/posix/conformance/index.rst @@ -44,7 +44,7 @@ POSIX System Interfaces :ref:`_POSIX_REALTIME_SIGNALS`, -1, :kconfig:option:`CONFIG_POSIX_REALTIME_SIGNALS` :ref:`_POSIX_SEMAPHORES`, 200809L, :kconfig:option:`CONFIG_POSIX_SEMAPHORES` :ref:`_POSIX_SPIN_LOCKS`, 200809L, :kconfig:option:`CONFIG_POSIX_SPIN_LOCKS` - :ref:`_POSIX_THREAD_SAFE_FUNCTIONS`, -1, :kconfig:option:`CONFIG_POSIX_THREAD_SAFE_FUNCTIONS` + :ref:`_POSIX_THREAD_SAFE_FUNCTIONS`, -1, :kconfig:option:`CONFIG_POSIX_THREAD_SAFE_FUNCTIONS` :ref:`_POSIX_THREADS`, -1, :kconfig:option:`CONFIG_POSIX_THREADS` :ref:`_POSIX_TIMEOUTS`, 200809L, :kconfig:option:`CONFIG_POSIX_TIMEOUTS` :ref:`_POSIX_TIMERS`, 200809L, :kconfig:option:`CONFIG_POSIX_TIMERS` diff --git a/doc/services/portability/posix/option_groups/index.rst b/doc/services/portability/posix/option_groups/index.rst index 41d9aa4872bec..300fd9118e3ca 100644 --- a/doc/services/portability/posix/option_groups/index.rst +++ b/doc/services/portability/posix/option_groups/index.rst @@ -979,7 +979,7 @@ Enable this option with :kconfig:option:`CONFIG_POSIX_THREAD_PRIORITY_SCHEDULING pthread_setschedparam(),yes pthread_setschedprio(),yes -.. _posix_thread_safe_functions: +.. _posix_option_thread_safe_functions: _POSIX_THREAD_SAFE_FUNCTIONS ++++++++++++++++++++++++++++ From 1bf22569fc5e9aab39e9ba15ef1febb71bc784fa Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Fri, 15 Nov 2024 07:24:22 -0500 Subject: [PATCH 2355/4482] doc: release-notes-4.0: add posix api release notes Add POSIX API release notes for new features and enhancements since v3.7.0 . Signed-off-by: Chris Friedt --- doc/releases/release-notes-4.0.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index c6cbb556fa2e1..dc4d1c4583f18 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -1342,6 +1342,30 @@ Libraries / Subsystems * POSIX API + * Added support for the following Option Groups: + + * :ref:`POSIX_DEVICE_IO ` + * :ref:`POSIX_SIGNALS ` + + * Added support for the following Options: + + * :ref:`_POSIX_SYNCHRONIZED_IO ` + * :ref:`_POSIX_THREAD_PRIO_PROTECT ` + + * :ref:`POSIX_FILE_SYSTEM ` improvements: + + * Support for :c:macro:`O_TRUNC` flag in :c:func:`open()`. + * Support for :c:func:`rmdir` and :c:func:`remove`. + + * :ref:`_POSIX_THREAD_SAFE_FUNCTIONS ` improvements: + + * Support for :c:func:`asctime_r`, :c:func:`ctime_r`, and :c:func:`localtime_r`. + + * :ref:`POSIX_THREADS_BASE ` improvements: + + * Use the :ref:`user mode semaphore API ` instead of the + :ref:`spinlock API ` for pool synchronization. + * LoRa/LoRaWAN * ZBus From c4b00f7beae7a447a240a68c25f746d945d8cc1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 15 Nov 2024 10:06:00 +0100 Subject: [PATCH 2356/4482] doc: releases: add more release highlights for 4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds a few more entries to hopefully complete the list of 4.0 highlights. Signed-off-by: Benjamin Cabé --- doc/releases/release-notes-4.0.rst | 58 ++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index dc4d1c4583f18..38abec3b4b119 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -9,20 +9,51 @@ We are pleased to announce the release of Zephyr version 4.0.0. Major enhancements with this release include: -* The introduction of the :ref:`secure storage` subsystem. It allows the use of the - PSA Secure Storage API and of persistent keys in the PSA Crypto API on all board targets. It +* **Secure Storage Subsystem**: + A newly introduced :ref:`secure storage` subsystem allows the use of the + PSA Secure Storage API and of persistent keys in the PSA Crypto API on *all* board targets. It is now the standard way to provide device-specific protection to data at rest. (:github:`76222`) -* The introduction of the :ref:`comparator` device driver subsystem for analog - comparators, complete with shell support. It supports initial configuration through devicetree - and runtime configuration through vendor specific APIs. Initially the - :dtcompatible:`nordic,nrf-comp`, :dtcompatible:`nordic,nrf-lpcomp` and - :dtcompatible:`nxp,kinetis-acmp` are supported. +* **ZMS (Zephyr Memory Storage) Subsystem**: + :ref:`ZMS ` is a new key-value storage subsystem compatible with all non-volatile storage + types, including traditional NOR flash and advanced technologies like RRAM and MRAM that support + write without erasure. -* The introduction of the :ref:`stepper` device driver subsystem for stepper motors, - complete with shell support. Initially implemented drivers include a simple - :dtcompatible:`zephyr,gpio-stepper` and a complex sensor-less stall-detection capable with - integrated ramp-controller :dtcompatible:`adi,tmc5041`. +* **Analog Comparators**: + A new :ref:`comparator` device driver subsystem for analog comparators has been + added, complete with shell support. It supports initial configuration through Devicetree and + runtime configuration through vendor specific APIs. Initially the :dtcompatible:`nordic,nrf-comp`, + :dtcompatible:`nordic,nrf-lpcomp` and :dtcompatible:`nxp,kinetis-acmp` are supported. + +* **Stepper Motors**: + It is now possible to interact with stepper motors using a standard API thanks to the new + :ref:`stepper` device driver subsystem, which also comes with shell support. + Initially implemented drivers include a simple :dtcompatible:`zephyr,gpio-steppers` and a complex + sensor-less stall-detection capable with integrated ramp-controller :dtcompatible:`adi,tmc5041`. + +* **Haptics**: + A new :ref:`haptics_api` device driver subsystem allows unified access to haptic controllers, + enabling users to add haptic feedback to their applications. + +* **Multimedia Capabilities** + Zephyr's audio and video capabilities have been expanded with support for new image sensors, video + interfaces, audio interfaces, and codecs being supported. + +* **Prometheus Library**: + A `Prometheus`_ metrics library has been added to the networking stack. It provides a way to + expose metrics to Prometheus clients over HTTP, facilitating the consolidated remote monitoring of + Zephyr devices alongside other systems typically monitored using Prometheus. + +* **Documentation Improvements**: + Several enhancements were made to the online documentation to improve content discovery and + navigation. These include a new :ref:`interactive board catalog ` and an interactive + directory for :zephyr:code-sample-category:`code samples `. + +* **Expanded Board Support**: + Over 60 :ref:`new boards ` and + :ref:`shields ` are supported in Zephyr 4.0. + +.. _`Prometheus`: https://prometheus.io/ An overview of the changes required or recommended when migrating your application from Zephyr v3.7.0 to Zephyr v4.0.0 can be found in the separate :ref:`migration guide`. @@ -221,6 +252,8 @@ Boards & SoC Support * NXP mimxrt685: fixed clocks to enable DMIC * NXP MCX N Series: Fixed NXP LPSPI native chip select when using synchronous API with DMA bug +.. _boards_added_in_zephyr_4_0: + * Added support for these boards: * :zephyr:board:`01space ESP32C3 0.42 OLED ` (``esp32c3_042_oled``) @@ -318,6 +351,9 @@ Boards & SoC Support * Enabled ENET ethernet on NXP ``imx8mm`` and ``imx8mn`` * Added support for the NXP ``imx8qm`` and ``imx8qxp`` DSP core to enable the openAMP sample + +.. _shields_added_in_zephyr_4_0: + * Added support for the following shields: * :ref:`ADI EVAL-ADXL362-ARDZ ` From 8f0a4bd3238c9913d8c45d5a6de5ae736440a1c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 15 Nov 2024 11:18:01 +0100 Subject: [PATCH 2357/4482] doc: releases: fix Devicetree spelling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Spell Devicetree with a capital D Signed-off-by: Benjamin Cabé --- doc/releases/release-notes-4.0.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 38abec3b4b119..d8c4ce74edfad 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -326,7 +326,7 @@ Boards & SoC Support * The nrf54l15bsim target now includes models of the AAR, CCM and ECB peripherals, and many other improvements. * Support for Google Kukui EC board (``google_kukui``) has been dropped. - * STM32: Deprecated MCO configuration via Kconfig in favour of setting it through devicetree. + * STM32: Deprecated MCO configuration via Kconfig in favour of setting it through Devicetree. See ``samples/boards/stm32/mco`` sample. * STM32: STM32CubeProgrammer is now the default runner on all STMicroelectronics STM32 boards. * Removed the ``nrf54l15pdk`` board, use :ref:`nrf54l15dk_nrf54l15` instead. @@ -571,7 +571,7 @@ Drivers and Sensors * Added DP83825 phy driver. * PHY_MII - * Fixed generic phy_mii driver not using the value of the ``no-reset`` property from devicetree. + * Fixed generic phy_mii driver not using the value of the ``no-reset`` property from Devicetree. * Removed excess newlines from log output of phy_mii driver. * KSZ8081 From a3978892c39a80ba6fb40a5b93b6796afa24ca45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 15 Nov 2024 11:21:28 +0100 Subject: [PATCH 2358/4482] doc: releases: drop empty driver subsections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drop sections with no updates Signed-off-by: Benjamin Cabé --- doc/releases/release-notes-4.0.rst | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index d8c4ce74edfad..4036d314fab50 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -425,8 +425,6 @@ Drivers and Sensors * Added driver for Analog Devices MAX32 SoC series (:dtcompatible:`adi,max32-adc`). * Added support for NXP S32 SAR_ADC (:dtcompatible:`nxp,s32-adc-sar`) -* Battery - * CAN * Added initial support for Renesas RA CANFD (:dtcompatible:`renesas,ra-canfd-global`, @@ -434,8 +432,6 @@ Drivers and Sensors * Added Flexcan support for S32Z27x (:dtcompatible:`nxp,flexcan`, :dtcompatible:`nxp,flexcan-fd`) * Improved NXP S32 CANXL error reporting (:dtcompatible:`nxp,s32-canxl`) -* Charger - * Clock control * STM32 MCO (Microcontroller Clock Output) is now available on STM32U5 series. @@ -604,8 +600,6 @@ Drivers and Sensors * Added support for W25Q512JV and W25Q512NW-IQ/IN to NXP's MCUX Flexspi driver * Renamed the binding :dtcompatible:`nxp,iap-msf1` to :dtcompatible:`nxp,msf1` for accuracy -* GNSS - * GPIO * tle9104: Add support for the parallel output mode via setting the properties ``parallel-out12`` and @@ -613,8 +607,6 @@ Drivers and Sensors * Converted the NXP S32 SIUL2 drivers to native Zephyr code * Converted the NXP wake-up drivers to native Zephyr code -* Hardware info - * Haptics * Introduced a haptics device driver subsystem selected with :kconfig:option:`CONFIG_HAPTICS` @@ -691,8 +683,6 @@ Drivers and Sensors * Updated ws2812 GPIO driver to support dynamic bus timings -* LoRa - * Mailbox * Added driver support for ESP32 and ESP32-S3 SoCs. @@ -728,8 +718,6 @@ Drivers and Sensors * Improve NXP CSI and MIPI_CSI2Rx drivers to support varibale frame rates -* MSPI - * Pin control * Added support for Microchip MEC5 @@ -751,8 +739,6 @@ Drivers and Sensors * Upgraded CP9314 driver to B1 silicon revision * Added basic driver for MPS MPM54304 -* Reset - * RTC * STM32: HSE can now be used as domain clock. From 36ccae904dff54dd8c80b72a29116b3dbb08dd0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 15 Nov 2024 11:28:50 +0100 Subject: [PATCH 2359/4482] doc: releases: drop empty lib/subsystems subsections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drop sections with no updates Signed-off-by: Benjamin Cabé --- doc/releases/release-notes-4.0.rst | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 4036d314fab50..eb9f8c39c2166 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -1215,8 +1215,6 @@ Libraries / Subsystems * Made demand paging SMP compatible. -* Formatted output - * Management * MCUmgr @@ -1254,10 +1252,6 @@ Libraries / Subsystems ```` and the configuration header file is now ````. -* Logging - -* Modem modules - * Power management * Added initial ESP32-C6 power management interface to allow light and deep-sleep features. @@ -1287,12 +1281,6 @@ Libraries / Subsystems * :kconfig:option:`CONFIG_MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED` for TLS 1.3 PSK ephemeral key exchange mode. -* CMSIS-NN - -* FPGA - -* Random - * SD * No significant changes in this release @@ -1312,8 +1300,6 @@ Libraries / Subsystems * ``kernel reboot`` shell command without any additional arguments will now do a cold reboot instead of requiring you to type ``kernel reboot cold``. -* State Machine Framework - * Storage * LittleFS: The module has been updated with changes committed upstream From 657229f72ea753cb2606eff8ebb52b91b56d6406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 15 Nov 2024 11:29:10 +0100 Subject: [PATCH 2360/4482] doc: releases: fix typos in MCUboot section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix minor typos Signed-off-by: Benjamin Cabé --- doc/releases/release-notes-4.0.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index eb9f8c39c2166..ce1f26f42d753 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -1454,8 +1454,8 @@ MCUboot * Added SHA512 support to MCUboot code and support for calculating SHA512 hash in imgtool. * Added fallback to USB DFU option. * Added better mode selection checks to bootutil. - * Added bootuil protected TLV size to image size check. - * Added functionaliy to remove images with conflicting flags or where features are required + * Added bootutil protected TLV size to image size check. + * Added functionality to remove images with conflicting flags or where features are required that are not supported. * Added compressed image flags and TLVs to MCUboot, Kconfig options and support for generating compressed LZMA2 images with ARM thumb filter to imgtool. @@ -1478,7 +1478,7 @@ MCUboot * Fixed slot info for directXIP/RAM load in bootutil. * Fixed bootutil issue with not zeroing AES and SHA-256 contexts with mbedTLS. * Fixed boot_serial ``format`` and ``incompatible-pointer-types`` warnings. - * Fixed booltuil wrong definition of ``find_swap_count``. + * Fixed bootutil wrong definition of ``find_swap_count``. * Fixed bootutil swap move max app size calculation. * Fixed imgtool issue where getpub failed for ed25519 key. * Fixed issue with sysbuild if something else is named mcuboot. From 7fa0d8396684dadf5bed2282a3d3b500235d39b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 15 Nov 2024 11:31:31 +0100 Subject: [PATCH 2361/4482] doc: releases: drop empty subsections from migration guide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drop sections with no updates Signed-off-by: Benjamin Cabé --- doc/releases/migration-guide-4.0.rst | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 0503995eac174..3ff09ab261363 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -196,9 +196,6 @@ Crypto * Following the deprecation of the TinyCrypt library (:github:`79566`), the TinyCrypt-based shim driver was marked as deprecated (:github:`79653`). -Display -======= - Disk ==== @@ -239,12 +236,6 @@ Input * The :dtcompatible:`analog-axis` ``invert`` property has been renamed to ``invert-input`` (there's now an ``invert-output`` available as well). -Interrupt Controller -==================== - -LED Strip -========= - PWM === @@ -348,9 +339,6 @@ Bluetooth HCI * The Kconfig option :kconfig:option:`BT_SPI` is now automatically selected based on devicetree compatibles and can be removed from board ``.defconfig`` files. -Bluetooth Mesh -============== - Bluetooth Audio =============== @@ -413,9 +401,6 @@ Bluetooth Audio * ``BT_AUDIO_BROADCAST_CODE_SIZE`` has been removed and ``BT_ISO_BROADCAST_CODE_SIZE`` should be used instead. (:github:`80217`) -Bluetooth Classic -================= - Bluetooth Host ============== @@ -491,9 +476,6 @@ Refer to the extended advertising sample for an example implementation of advertiser restarting. The same technique can be used for legacy advertising. -Bluetooth Crypto -================ - Networking ********** @@ -565,9 +547,6 @@ MCUmgr The requirement for Bluetooth authentication is now indicated by the :kconfig:option:`CONFIG_MCUMGR_TRANSPORT_BT_PERM_RW_AUTHEN` Kconfig option. To remove the default requirement for Bluetooth authentication it is necessary to enable the :kconfig:option:`CONFIG_MCUMGR_TRANSPORT_BT_PERM_RW` Kconfig option in the project configuration. -Modem -===== - Random ====== @@ -600,6 +579,3 @@ JWT (JSON Web Token) They replace the previously-existing Kconfigs ``CONFIG_JWT_SIGN_RSA`` and ``CONFIG_JWT_SIGN_ECDSA``. (:github:`79653`) - -Architectures -************* From 2be735c55858310aebcd5956057ab7c8c00ef743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 15 Nov 2024 14:56:48 +0100 Subject: [PATCH 2362/4482] doc: releases: fix galaxycore,gc2145 compatible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix typo in compatible name Signed-off-by: Benjamin Cabé --- doc/releases/release-notes-4.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index ce1f26f42d753..15eab79919a10 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -869,7 +869,7 @@ Drivers and Sensors * Added a sample for capturing video and displaying it with LVGL (:zephyr:code-sample:`video-capture-to-lvgl`) * Added an automatic test to check colorbar pattern correctness - * Added support for GalaxyCore GC2145 image sensor (:dtcompatible:`gc,gc2145`) + * Added support for GalaxyCore GC2145 image sensor (:dtcompatible:`galaxycore,gc2145`) * Added support for ESP32-S3 LCD-CAM interface (:dtcompatible:`espressif,esp32-lcd-cam`) * Added support for NXP MCUX SMARTDMA interface (:dtcompatible:`nxp,smartdma`) * Added support for more OmniVision OV2640 controls (:dtcompatible:`ovti,ov2640`) From c1d150934a3fe7cb0a45ecef887453a0afb00163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 15 Nov 2024 15:03:11 +0100 Subject: [PATCH 2363/4482] doc: releases: use correct compatible for zephyr.gpio-steppers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current name of the compatible is zephyr,gpio-steppers Signed-off-by: Benjamin Cabé --- doc/releases/release-notes-4.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 15eab79919a10..cd39d174e349d 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -841,7 +841,7 @@ Drivers and Sensors * Introduced stepper shell commands for controlling and configuring stepper motors with :kconfig:option:`CONFIG_STEPPER_SHELL` * Added support for ADI TMC5041 (:dtcompatible:`adi,tmc5041`) - * Added support for gpio-stepper-controller (:dtcompatible:`gpio-stepper-controller`) + * Added support for gpio-stepper-controller (:dtcompatible:`zephyr,gpio-steppers`) * Added stepper api test-suite * Added stepper shell test-suite From 275f44730ec32adacb1c8ebe447ea9ee8eadaf59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 15 Nov 2024 17:07:26 +0100 Subject: [PATCH 2364/4482] doc: releases: re-arrange API Changes section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit some entries were not properly put under either Removed or Deprecated section. This commit fixes that. Signed-off-by: Benjamin Cabé --- doc/releases/release-notes-4.0.rst | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index cd39d174e349d..2a03bf17b570f 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -73,6 +73,17 @@ https://docs.zephyrproject.org/latest/security/vulnerabilities.html API Changes *********** +Removed APIs in this release +============================ + +* Macro ``K_THREAD_STACK_MEMBER``, deprecated since v3.5.0, has been removed. + Use :c:macro:`K_KERNEL_STACK_MEMBER` instead. + +* ``CBPRINTF_PACKAGE_COPY_*`` macros, deprecated since Zephyr 3.5.0, have been removed. + +* ``_ENUM_TOKEN`` and ``_ENUM_UPPER_TOKEN`` macros, deprecated since Zephyr 2.7.0, + are no longer generated. + * Removed deprecated arch-level CMSIS header files ``include/zephyr/arch/arm/cortex_a_r/cmsis.h`` and ``include/zephyr/arch/arm/cortex_m/cmsis.h``. ``cmsis_core.h`` needs to be @@ -81,20 +92,11 @@ API Changes * Removed deprecated ``ceiling_fraction`` macro. :c:macro:`DIV_ROUND_UP` needs to be used now. -* Deprecated ``EARLY``, ``APPLICATION`` and ``SMP`` init levels can no longer be - used for devices. - * Removed deprecated header file ``include/zephyr/random/rand32.h``. ``random.h`` needs to be included now. -Removed APIs in this release -============================ - -* Macro ``K_THREAD_STACK_MEMBER``, deprecated since v3.5.0, has been removed. - Use :c:macro:`K_KERNEL_STACK_MEMBER` instead. -* ``CBPRINTF_PACKAGE_COPY_*`` macros, deprecated since Zephyr 3.5.0, have been removed. -* ``_ENUM_TOKEN`` and ``_ENUM_UPPER_TOKEN`` macros, deprecated since Zephyr 2.7.0, - are no longer generated. +* Deprecated ``EARLY``, ``APPLICATION`` and ``SMP`` init levels can no longer be + used for devices. Deprecated in this release ========================== From 7aa7e894bc5314273c92fd39bbba52ea367bfc18 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Fri, 15 Nov 2024 09:26:48 -0800 Subject: [PATCH 2365/4482] doc: security: Disclose CVE-2024-11263 Disclose information about published CVE Signed-off-by: Flavio Ceolin --- doc/security/vulnerabilities.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/doc/security/vulnerabilities.rst b/doc/security/vulnerabilities.rst index 6bdf011f9dcb8..da3b353d9893f 100644 --- a/doc/security/vulnerabilities.rst +++ b/doc/security/vulnerabilities.rst @@ -1794,3 +1794,22 @@ Under embargo until 2024-11-22 ----------------- Under embargo until 2025-01-23 + +:cve:`2024-11263` +----------------- + +arch: riscv: userspace: potential security risk when CONFIG_RISCV_GP=y + +A rogue thread can corrupt the gp reg and cause the entire system to hard fault at best, at worst, +it can potentially trick the system to access another set of random global symbols. + +- `Zephyr project bug tracker GHSA-jjf3-7x72-pqm9 + `_ + +This has been fixed in main for v4.0.0 + +- `PR 81155 fix for main + `_ + +- `PR 81370 fix for 3.7 + `_ From 659eec8d85ca6751fd4174487168ea6553c53767 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Fri, 15 Nov 2024 09:31:58 -0800 Subject: [PATCH 2366/4482] doc: release-notes-4.0: Add CVE-2024-11263 info Add CVE-2024-11263 to release notes. Signed-off-by: Flavio Ceolin --- doc/releases/release-notes-4.0.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 2a03bf17b570f..261991abc348a 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -69,6 +69,8 @@ https://docs.zephyrproject.org/latest/security/vulnerabilities.html * :cve:`2024-8798`: Under embargo until 2024-11-22 * :cve:`2024-10395`: Under embargo until 2025-01-23 +* :cve:`2024-11263` `Zephyr project bug tracker GHSA-jjf3-7x72-pqm9 + `_ API Changes *********** From c7a1b53f82dc7060e7ebe903744bddc99155ee7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 15 Nov 2024 15:22:10 +0100 Subject: [PATCH 2367/4482] doc: release-notes-4.0: Add a few Nordic related entries and an ADC one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add notes for Nordic HAL and other nRF related stuff plus one more ADC entry. Signed-off-by: Andrzej Głąbek --- doc/releases/release-notes-4.0.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 261991abc348a..6fb6a4a26fc39 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -255,6 +255,7 @@ Boards & SoC Support * NXP IMXRT116x: Fixed bus clocking to align with the settings of the MCUXpresso SDK * NXP mimxrt685: fixed clocks to enable DMIC * NXP MCX N Series: Fixed NXP LPSPI native chip select when using synchronous API with DMA bug + * Nordic nRF54H: Added support for the FLPR (Fast Lightweight Processor) RISC-V CPU. .. _boards_added_in_zephyr_4_0: @@ -428,6 +429,7 @@ Drivers and Sensors * Added initial support for Renesas RA8 ADC driver (:dtcompatible:`renesas,ra-adc`) * Added driver for Analog Devices MAX32 SoC series (:dtcompatible:`adi,max32-adc`). * Added support for NXP S32 SAR_ADC (:dtcompatible:`nxp,s32-adc-sar`) + * Added support for Ambiq Apollo3 series (:dtcompatible:`ambiq,adc`). * CAN @@ -448,6 +450,7 @@ Drivers and Sensors :dtcompatible:`renesas,ra-cgc-external-clock`, :dtcompatible:`renesas,ra-cgc-subclk`, :dtcompatible:`renesas,ra-cgc-pll-out`) * Silabs: Added support for Series 2+ Clock Management Unit (see :dtcompatible:`silabs,series-clock`) + * Added initial support for Nordic nRF54H Series clock controllers. * Codec (Audio) @@ -920,6 +923,7 @@ Drivers and Sensors * Add ESP32-C2 Wi-Fi support. * Add ESP32 driver APSTA support. * Add NXP RW612 driver support. + * Added nRF70 Wi-Fi driver. Networking ********** @@ -1406,6 +1410,9 @@ HALs * Nordic + * Updated nrfx to version 3.7.0. + * Added OS agnostic parts of the nRF70 Wi-Fi driver. + * STM32 * Updated STM32C0 to cube version V1.2.0. From 91c3768b255efc71961ec016b80143a285310a45 Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Fri, 15 Nov 2024 13:58:54 -0600 Subject: [PATCH 2368/4482] doc: release-notes-4.0: Release notes cleanup 1. Move deprecated items to the deprecated section. 2. Fixed a portion of a sentence that was deleted. 3. Miscellaneous cleanup. Signed-off-by: Mahesh Mahadevan --- doc/releases/release-notes-4.0.rst | 40 ++++++++++++++++-------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 6fb6a4a26fc39..b8e7d183a2e7a 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -100,6 +100,8 @@ Removed APIs in this release * Deprecated ``EARLY``, ``APPLICATION`` and ``SMP`` init levels can no longer be used for devices. +* Removed deprecated net_pkt functions. + Deprecated in this release ========================== @@ -108,6 +110,17 @@ Deprecated in this release * The :ref:`kscan_api` subsystem has been marked as deprecated. +* Deprecated the TinyCrypt shim driver ``CONFIG_CRYPTO_TINYCRYPT_SHIM``. + +* :ref:`native_posix` has been deprecated in favour of + :ref:`native_sim`. + +* ``include/zephyr/net/buf.h`` is deprecated in favor of + ``include/zephyr/net_buf.h>``. The old header will be removed in future releases + and its usage should be avoided. + +* Deprecated the :c:func:`net_buf_put` and :c:func:`net_buf_get` API functions. + Architectures ************* @@ -233,6 +246,7 @@ Boards & SoC Support * Made these changes in other SoC series: * NXP S32Z270: Added support for the new silicon cut version 2.0. Note that the previous + versions (1.0 and 1.1) are no longer supported. * NXP s32k3: fixed RAM retention issue * NXP s32k1: obtain system clock frequency from Devicetree versions (1.0 and 1.1) are no longer supported. @@ -249,7 +263,7 @@ Boards & SoC Support * RW61x: increased main stack size to avoid stack overflows when running BLE * RW612: enabled SCTIMER - * NXP IMXRT: Fixed flexspi boot issue caused by am erroneous relocation of the Flash Configuration Block + * NXP IMXRT: Fixed flexspi boot issue caused by an erroneous relocation of the Flash Configuration Block of Kconfig defaults being sourced * NXP RT11xx: enabled FlexIO * NXP IMXRT116x: Fixed bus clocking to align with the settings of the MCUXpresso SDK @@ -326,13 +340,11 @@ Boards & SoC Support * Made these board changes: - * :ref:`native_posix` has been deprecated in favour of - :ref:`native_sim`. * The nrf54l15bsim target now includes models of the AAR, CCM and ECB peripherals, and many other improvements. * Support for Google Kukui EC board (``google_kukui``) has been dropped. * STM32: Deprecated MCO configuration via Kconfig in favour of setting it through Devicetree. - See ``samples/boards/stm32/mco`` sample. + See ``samples/boards/st/mco`` sample. * STM32: STM32CubeProgrammer is now the default runner on all STMicroelectronics STM32 boards. * Removed the ``nrf54l15pdk`` board, use :ref:`nrf54l15dk_nrf54l15` instead. * PHYTEC: ``mimx8mp_phyboard_pollux`` has been renamed to :ref:`phyboard_pollux`, @@ -409,7 +421,7 @@ Documentation * Added :rst:dir:`zephyr:code-sample-category` directive to describe and group code samples in the documentation. * Added a link to the source code of the driver matching a binding's compatible string (when one can - be found in the Zephyr tree) to the :ref:`dt-bindings` documentation. + be found in the Zephyr tree) to the :ref:`Devicetree bindings ` documentation. * Added a button to all code sample README pages allowing to directly browse the sample's source code on GitHub. * Moved Zephyr C API documentation out of main documentation. API references now feature a rich @@ -468,17 +480,16 @@ Drivers and Sensors * Added initial support for Renesas RA8 AGT counter driver (:dtcompatible:`renesas,ra-agt`) * Added driver for Analog Devices MAX32 SoC series (:dtcompatible:`adi,max32-counter`). + * Updated the NXP counter_mcux_lptmr driver to support multiple instances of the lptmr + peripheral. * Crypto * Added support for STM32L4 AES. - * Deprecated the TinyCrypt shim driver ``CONFIG_CRYPTO_TINYCRYPT_SHIM``. * DAC * DAC API now supports specifying channel path as internal. Support has been added in STM32 drivers. - * Updated the NXP counter_mcux_lptmr driver to support multiple instances of the lptmr - peripheral. * Updated the initialization of clocks for the NXP LPTMR driver * Converted the NXP S32 System Timer Module driver to native Zephyr code * Converted NXP S32 Software Watchdog Timer driver to native Zephyr code @@ -822,9 +833,7 @@ Drivers and Sensors * Added Würth Elektronik HIDS-2525020210002 :dtcompatible:`we,wsen-hids-2525020210002` humidity sensor driver. - * Added general samples for triggers - * Added driver for NXP's fxls8974 accelerometer * Serial @@ -1072,12 +1081,9 @@ Networking * Fixed compilation issues with networking and SystemView Tracing enabled. * Removed redundant DHCPv4 code from telnet sample. * Fixed build warnings in Echo Client sample with IPv6 disabled. - * Removed deprecated net_pkt functions. * Extended network tracing support and added documentation page (:ref:`network_tracing`). * Moved network buffers implementation out of net subsystem into lib directory - and renamed public header to :zephyr_file:`include/zephyr/net_buf.h`. - * Deprecated the :c:func:`net_buf_put` and :c:func:`net_buf_get` API functions. * Removed ``wpansub`` sample. * MQTT: @@ -1541,15 +1547,11 @@ Tests and Samples * Together with the deprecation of :ref:`native_posix`, many tests which were explicitly run in native_posix now run in :ref:`native_sim` instead. native_posix as a platform remains tested though. -* Added documentation (readme) for the erase_blocks flash test -* Extended the tests of counter_basic_api with a testcase for counters wihtout alarms -* Excluded NXP RW612 based boards from the WiFi test suite, as these boards require binary blobs - be downloaded in order to build as expected +* Extended the tests of counter_basic_api with a testcase for counters without alarms * Added support for testing SDMMC devices to the fatfs API test * Extended net/vlan to add IPv6 prefix config to each vlan-iface * Enhanced the camera fixture test by adding a color bar to enable automation -* Fixed floating point logging issue in the video driver sample code -* Added a number crunching (maths such as FFT, echo cancellation) sample using optimized an +* Added a number crunching (maths such as FFT, echo cancellation) sample using an optimized library for the NXP ADSP board * Tailored the SPI_LOOPBACK test to the limitations of NXP Kinetis MCU's * Enabled the video sample to run video capture (samples/drivers/video) From 955d7974d5a4ad545ff82e2eeb583a78099e9b4b Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Fri, 15 Nov 2024 21:57:12 +0100 Subject: [PATCH 2369/4482] docs: release notes: add 80875 to known issues add #80875 to known issues in release notes 4.0.0. Signed-off-by: Jilay Pandya --- doc/releases/release-notes-4.0.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index b8e7d183a2e7a..d5a191adc7e6a 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -1568,3 +1568,4 @@ Known Issues - :github:`71042` stream_flash: stream_flash_init() size parameter allows to ignore partition layout - :github:`67407` stream_flash: stream_flash_erase_page allows to accidentally erase stream +- :github:`80875` stepper_api: incorrect c-prototype stepper.h and absence of NULL check stepper_shell.c From 5c31f61d51d95dd68df6ff66ddb6e178c3ea353e Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Fri, 15 Nov 2024 16:10:54 -0600 Subject: [PATCH 2370/4482] doc: release-notes-4.0: Update the DAC section This incorrectly had references to timers and watchdog related items. Signed-off-by: Mahesh Mahadevan --- doc/releases/release-notes-4.0.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index d5a191adc7e6a..decc10203b374 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -482,6 +482,8 @@ Drivers and Sensors * Added driver for Analog Devices MAX32 SoC series (:dtcompatible:`adi,max32-counter`). * Updated the NXP counter_mcux_lptmr driver to support multiple instances of the lptmr peripheral. + * Converted the NXP S32 System Timer Module driver to native Zephyr code + * Added support for late and short relative alarms area to NXP nxp_sys_timer (:dtcompatible:`nxp,s32-sys-timer`) * Crypto @@ -490,10 +492,6 @@ Drivers and Sensors * DAC * DAC API now supports specifying channel path as internal. Support has been added in STM32 drivers. - * Updated the initialization of clocks for the NXP LPTMR driver - * Converted the NXP S32 System Timer Module driver to native Zephyr code - * Converted NXP S32 Software Watchdog Timer driver to native Zephyr code - * Added support late and short relative alarms area to NXP nxp_sys_timer (:dtcompatible:`nxp,s32-sys-timer`) * Disk @@ -904,6 +902,7 @@ Drivers and Sensors * Watchdog * Added driver for Analog Devices MAX32 SoC series (:dtcompatible:`adi,max32-watchdog`). + * Converted NXP S32 Software Watchdog Timer driver to native Zephyr code * Wi-Fi From 95633cf68c807fd0f3808ba3a6422f139bf92c37 Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Fri, 15 Nov 2024 12:37:25 -0600 Subject: [PATCH 2371/4482] doc: release: Add v4.0.0 to the list of supported releases Add v4.0.0 to the list of supported releases. Signed-off-by: Mahesh Mahadevan --- doc/conf.py | 1 + doc/releases/index.rst | 3 +++ 2 files changed, 4 insertions(+) diff --git a/doc/conf.py b/doc/conf.py index a25cc6818c7de..94068de899db8 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -191,6 +191,7 @@ "current_version": version, "versions": ( ("latest", "/"), + ("4.0.0", "/4.0.0/"), ("3.7.0 (LTS)", "/3.7.0/"), ("3.6.0", "/3.6.0/"), ("2.7.6 (LTS)", "/2.7.6/"), diff --git a/doc/releases/index.rst b/doc/releases/index.rst index 9f8c1a968b3a7..89678b2515818 100644 --- a/doc/releases/index.rst +++ b/doc/releases/index.rst @@ -64,6 +64,8 @@ Supported Releases +-----------------+----------------+---------------+ | `Zephyr 3.6.0`_ | 2024-02-23 | 2024-11-29 | +-----------------+----------------+---------------+ +| `Zephyr 4.0.0`_ | 2024-11-15 | 2025-07-18 | ++-----------------+----------------+---------------+ As of 2022-01-01, LTS1 (1.14.x) is not supported and has reached end of life (EOL). @@ -134,3 +136,4 @@ Release notes and migration guides for end-of-life releases of Zephyr RTOS can b .. _`Zephyr 2.7.6`: https://docs.zephyrproject.org/2.7.6/ .. _`Zephyr 3.6.0`: https://docs.zephyrproject.org/3.6.0/ .. _`Zephyr 3.7.0`: https://docs.zephyrproject.org/3.7.0/ +.. _`Zephyr 4.0.0`: https://docs.zephyrproject.org/4.0.0/ From c5b27d948adb338d0140d9dce0a5ce56ba3df722 Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Fri, 15 Nov 2024 12:38:25 -0600 Subject: [PATCH 2372/4482] doc: release: Finalize v3.7.0 release notes and migration guide Remove working draft status from the 4.0.0 release notes and migration guide. Signed-off-by: Mahesh Mahadevan --- doc/releases/migration-guide-4.0.rst | 4 ++-- doc/releases/release-notes-4.0.rst | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index 3ff09ab261363..b686643873539 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -2,8 +2,8 @@ .. _migration_4.0: -Migration guide to Zephyr v4.0.0 (Working Draft) -################################################ +Migration guide to Zephyr v4.0.0 +################################ This document describes the changes required when migrating your application from Zephyr v3.7.0 to Zephyr v4.0.0. diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index decc10203b374..8b9ede8f11eba 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -2,8 +2,8 @@ .. _zephyr_4.0: -Zephyr 4.0.0 (Working Draft) -############################ +Zephyr 4.0.0 +############ We are pleased to announce the release of Zephyr version 4.0.0. From 8469084dfae85f854555f0607f2c838dad097235 Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Fri, 15 Nov 2024 12:39:27 -0600 Subject: [PATCH 2373/4482] release: Zephyr v4.0.0 Set the version to v4.0.0 Signed-off-by: Mahesh Mahadevan --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 78abb38a7d723..be5e51844ccea 100644 --- a/VERSION +++ b/VERSION @@ -2,4 +2,4 @@ VERSION_MAJOR = 4 VERSION_MINOR = 0 PATCHLEVEL = 0 VERSION_TWEAK = 0 -EXTRAVERSION = rc3 +EXTRAVERSION = From 0006ba8ee3b4087f3979fcc987623f6b6f6db33d Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Fri, 15 Nov 2024 22:55:39 -0600 Subject: [PATCH 2374/4482] release: Zephyr v4.0.99 Set the version to v4.0.99 Signed-off-by: Mahesh Mahadevan --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index be5e51844ccea..b170abf44be15 100644 --- a/VERSION +++ b/VERSION @@ -1,5 +1,5 @@ VERSION_MAJOR = 4 VERSION_MINOR = 0 -PATCHLEVEL = 0 +PATCHLEVEL = 99 VERSION_TWEAK = 0 EXTRAVERSION = From a3cc5322218496d94b16c9398ce6d6244ccd0a99 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Mon, 28 Oct 2024 16:17:36 +0100 Subject: [PATCH 2375/4482] actions: manifest: check additional metadata in projects See https://github.com/zephyrproject-rtos/action-manifest/pull/14. Signed-off-by: Carles Cufi --- .github/workflows/manifest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/manifest.yml b/.github/workflows/manifest.yml index 76b80f6650412..538f06a1d5da6 100644 --- a/.github/workflows/manifest.yml +++ b/.github/workflows/manifest.yml @@ -26,7 +26,7 @@ jobs: west init -l . || true - name: Manifest - uses: zephyrproject-rtos/action-manifest@v1.3.1 + uses: zephyrproject-rtos/action-manifest@v1.5.0 with: github-token: ${{ secrets.ZB_GITHUB_TOKEN }} manifest-path: 'west.yml' From cfc232fa321f903c1901d76f1b03924f68725dda Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Wed, 13 Nov 2024 13:58:45 -0500 Subject: [PATCH 2376/4482] twister: stats: fix platform stats Fix wrong reporting about where testcases were executed. We have: INFO - 1130 of 1130 executed test cases passed (100.00%) on 0 out of total 860 platforms (0.00%). which is obviously wrong. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/reports.py | 8 +++++--- scripts/pylib/twister/twisterlib/testplan.py | 4 ---- scripts/tests/twister_blackbox/test_platform.py | 4 ++-- scripts/tests/twister_blackbox/test_runner.py | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/reports.py b/scripts/pylib/twister/twisterlib/reports.py index c0f06fc514288..cdbfc63373fd9 100644 --- a/scripts/pylib/twister/twisterlib/reports.py +++ b/scripts/pylib/twister/twisterlib/reports.py @@ -46,13 +46,13 @@ def __init__(self, plan, env) -> None: self.instances = plan.instances self.platforms = plan.platforms self.selected_platforms = plan.selected_platforms - self.filtered_platforms = plan.filtered_platforms self.env = env self.timestamp = datetime.now().isoformat() self.outdir = os.path.abspath(env.options.outdir) self.instance_fail_count = plan.instance_fail_count self.footprint = None + @staticmethod def process_log(log_file): filtered_string = "" @@ -601,19 +601,21 @@ def summary(self, results, ignore_unrecognized_sections, duration): ) total_platforms = len(self.platforms) + filtered_platforms = set(instance.platform.name for instance in self.instances.values() + if instance.status not in[TwisterStatus.FILTER, TwisterStatus.NOTRUN, TwisterStatus.SKIP]) # if we are only building, do not report about tests being executed. if self.platforms and not self.env.options.build_only: executed_cases = results.cases - results.filtered_cases - results.skipped_cases - results.notrun_cases pass_rate = 100 * (float(results.passed_cases) / float(executed_cases)) \ if executed_cases != 0 else 0 - platform_rate = (100 * len(self.filtered_platforms) / len(self.platforms)) + platform_rate = (100 * len(filtered_platforms) / len(self.platforms)) logger.info( f'{results.passed_cases} of {executed_cases} executed test cases passed ({pass_rate:02.2f}%)' f'{", " + str(results.blocked_cases) + " blocked" if results.blocked_cases else ""}' f'{", " + str(results.failed_cases) + " failed" if results.failed_cases else ""}' f'{", " + str(results.error_cases) + " errored" if results.error_cases else ""}' f'{", " + str(results.none_cases) + " without a status" if results.none_cases else ""}' - f' on {len(self.filtered_platforms)} out of total {total_platforms} platforms ({platform_rate:02.2f}%).' + f' on {len(filtered_platforms)} out of total {total_platforms} platforms ({platform_rate:02.2f}%).' ) if results.skipped_cases or results.notrun_cases: logger.info( diff --git a/scripts/pylib/twister/twisterlib/testplan.py b/scripts/pylib/twister/twisterlib/testplan.py index da8eaa0a74908..930b9f6fa3ca6 100755 --- a/scripts/pylib/twister/twisterlib/testplan.py +++ b/scripts/pylib/twister/twisterlib/testplan.py @@ -106,7 +106,6 @@ def __init__(self, env=None): self.platforms = [] self.platform_names = [] self.selected_platforms = [] - self.filtered_platforms = [] self.default_platforms = [] self.load_errors = 0 self.instances = dict() @@ -1079,9 +1078,6 @@ def apply_filters(self, **kwargs): filtered_instance.add_missing_case_status(filtered_instance.status) - self.filtered_platforms = set(p.platform.name for p in self.instances.values() - if p.status != TwisterStatus.SKIP ) - def add_instances(self, instance_list): for instance in instance_list: self.instances[instance.name] = instance diff --git a/scripts/tests/twister_blackbox/test_platform.py b/scripts/tests/twister_blackbox/test_platform.py index 43ff3346cf8af..83fe07b274b9c 100644 --- a/scripts/tests/twister_blackbox/test_platform.py +++ b/scripts/tests/twister_blackbox/test_platform.py @@ -38,7 +38,7 @@ class TestPlatform: 'errored_configurations': 0, 'executed_test_cases': 8, 'skipped_test_cases': 2, - 'platform_count': 3, + 'platform_count': 2, 'executed_on_platform': 4, 'only_built': 2 } @@ -59,7 +59,7 @@ class TestPlatform: 'errored_configurations': 0, 'executed_test_cases': 0, 'skipped_test_cases': 0, - 'platform_count': 3, + 'platform_count': 0, 'executed_on_platform': 0, 'only_built': 0 } diff --git a/scripts/tests/twister_blackbox/test_runner.py b/scripts/tests/twister_blackbox/test_runner.py index 1ab50522c5ebf..a4a253fbff7a8 100644 --- a/scripts/tests/twister_blackbox/test_runner.py +++ b/scripts/tests/twister_blackbox/test_runner.py @@ -56,7 +56,7 @@ class TestRunner: 'errored_configurations': 0, 'executed_test_cases': 8, 'skipped_test_cases': 0, - 'platform_count': 0, + 'platform_count': 2, 'executed_on_platform': 4, 'only_built': 0 } From a199f7f9d39b09a0cf9a190f1c0478f5ba0ff7c9 Mon Sep 17 00:00:00 2001 From: Nidhal BEN OTHMEN Date: Wed, 13 Nov 2024 15:49:22 +0100 Subject: [PATCH 2377/4482] tests: bluetooth: tester: Fix bluetooth tester for nucleo_wba55cg Fix compilation error by specifying usart1 to be used for uart-pipe. Add a board-specific configuration file to disable the console, so, the usart1 will be used only for bluetooth and to specify the BT_HCI_TX_STACK_SIZE. Signed-off-by: Nidhal BEN OTHMEN --- boards/st/nucleo_wba55cg/nucleo_wba55cg.dts | 1 + tests/bluetooth/tester/boards/nucleo_wba55cg.conf | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 tests/bluetooth/tester/boards/nucleo_wba55cg.conf diff --git a/boards/st/nucleo_wba55cg/nucleo_wba55cg.dts b/boards/st/nucleo_wba55cg/nucleo_wba55cg.dts index d6e1c1f7a5d2e..1ff550809dd90 100644 --- a/boards/st/nucleo_wba55cg/nucleo_wba55cg.dts +++ b/boards/st/nucleo_wba55cg/nucleo_wba55cg.dts @@ -20,6 +20,7 @@ chosen { zephyr,bt-c2h-uart = &usart1; + zephyr,uart-pipe = &usart1; zephyr,console = &usart1; zephyr,shell-uart = &usart1; zephyr,sram = &sram0; diff --git a/tests/bluetooth/tester/boards/nucleo_wba55cg.conf b/tests/bluetooth/tester/boards/nucleo_wba55cg.conf new file mode 100644 index 0000000000000..db659a367176d --- /dev/null +++ b/tests/bluetooth/tester/boards/nucleo_wba55cg.conf @@ -0,0 +1,5 @@ +CONFIG_CONSOLE=n + +CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y +# TODO: Investigation to be done to optimize this value +CONFIG_BT_HCI_TX_STACK_SIZE=4096 From 05196e38a9ece8d01c4f90ef08dc70f9e0f77c68 Mon Sep 17 00:00:00 2001 From: Marvin Ouma Date: Wed, 13 Nov 2024 16:27:42 +0300 Subject: [PATCH 2378/4482] tests: posix: common: separate posix barriers to standalone test posix.common contains testsuites that can be separated into smaller groups of tests. This change moves barrier into a singular testsuite at tests/posix/barriers app directory. Signed-off-by: Marvin Ouma --- tests/posix/barriers/CMakeLists.txt | 9 +++++++ tests/posix/barriers/prj.conf | 5 ++++ .../src/barrier.c => barriers/src/main.c} | 4 +-- tests/posix/barriers/testcase.yaml | 25 +++++++++++++++++++ 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 tests/posix/barriers/CMakeLists.txt create mode 100644 tests/posix/barriers/prj.conf rename tests/posix/{common/src/barrier.c => barriers/src/main.c} (92%) create mode 100644 tests/posix/barriers/testcase.yaml diff --git a/tests/posix/barriers/CMakeLists.txt b/tests/posix/barriers/CMakeLists.txt new file mode 100644 index 0000000000000..31a050bb62fa9 --- /dev/null +++ b/tests/posix/barriers/CMakeLists.txt @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(posix_barriers) + +target_sources(app PRIVATE src/main.c) + +target_compile_options(app PRIVATE -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L) diff --git a/tests/posix/barriers/prj.conf b/tests/posix/barriers/prj.conf new file mode 100644 index 0000000000000..6d70b4e147287 --- /dev/null +++ b/tests/posix/barriers/prj.conf @@ -0,0 +1,5 @@ +CONFIG_POSIX_API=y +CONFIG_ZTEST=y + +CONFIG_POSIX_AEP_CHOICE_BASE=y +CONFIG_POSIX_BARRIERS=y diff --git a/tests/posix/common/src/barrier.c b/tests/posix/barriers/src/main.c similarity index 92% rename from tests/posix/common/src/barrier.c rename to tests/posix/barriers/src/main.c index f168f8368dc58..9e76a9ca7b510 100644 --- a/tests/posix/common/src/barrier.c +++ b/tests/posix/barriers/src/main.c @@ -10,7 +10,7 @@ #include #include -ZTEST(barrier, test_barrier) +ZTEST(posix_barriers, test_barrier) { int ret, pshared; pthread_barrierattr_t attr; @@ -38,4 +38,4 @@ ZTEST(barrier, test_barrier) zassert_equal(ret, 0, "pthread_barrierattr_destroy failed"); } -ZTEST_SUITE(barrier, NULL, NULL, NULL, NULL, NULL); +ZTEST_SUITE(posix_barriers, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/posix/barriers/testcase.yaml b/tests/posix/barriers/testcase.yaml new file mode 100644 index 0000000000000..a00bd02322f0d --- /dev/null +++ b/tests/posix/barriers/testcase.yaml @@ -0,0 +1,25 @@ +common: + filter: not CONFIG_NATIVE_LIBC + tags: + - posix + - barriers + # 1 tier0 platform per supported architecture + platform_key: + - arch + - simulation + min_flash: 64 + min_ram: 32 +tests: + portability.posix.barriers: {} + portability.posix.barriers.minimal: + extra_configs: + - CONFIG_MINIMAL_LIBC=y + portability.posix.barriers.newlib: + filter: TOOLCHAIN_HAS_NEWLIB == 1 + extra_configs: + - CONFIG_NEWLIB_LIBC=y + portability.posix.barriers.picolibc: + tags: picolibc + filter: CONFIG_PICOLIBC_SUPPORTED + extra_configs: + - CONFIG_PICOLIBC=y From 5e6c28bfa3db9d19f99d20040c704cf4698751a5 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 13 Nov 2024 13:54:18 +0100 Subject: [PATCH 2379/4482] doc nrf54l15bsim: Remove experimental warning This target simulated is reasonably tested. Let's stop warning about it being experimental. Signed-off-by: Alberto Escolar Piedras --- boards/native/nrf_bsim/doc/nrf54l15bsim.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/boards/native/nrf_bsim/doc/nrf54l15bsim.rst b/boards/native/nrf_bsim/doc/nrf54l15bsim.rst index 3b542073103c2..eaab71b3edd4c 100644 --- a/boards/native/nrf_bsim/doc/nrf54l15bsim.rst +++ b/boards/native/nrf_bsim/doc/nrf54l15bsim.rst @@ -29,10 +29,6 @@ on the simulated nRF54L15 SOC. This simulated target does **not** yet support targeting the cpuflpr core. -.. warning:: - - This target is experimental. - This boards include models of some of the nRF54L15 SOC peripherals: * AAR (Accelerated Address Resolver) From 2324d5daa1c510e3651cf98b2db481e11943365e Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 13 Nov 2024 13:57:35 +0100 Subject: [PATCH 2380/4482] doc nrf54l15bsim: Clarify the L10 and L05 are also covered Clarify that one can simulate equally well the nRF54L10 and L05 variants with this target. Signed-off-by: Alberto Escolar Piedras --- boards/native/nrf_bsim/doc/nrf54l15bsim.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/boards/native/nrf_bsim/doc/nrf54l15bsim.rst b/boards/native/nrf_bsim/doc/nrf54l15bsim.rst index eaab71b3edd4c..44dbbf78f253c 100644 --- a/boards/native/nrf_bsim/doc/nrf54l15bsim.rst +++ b/boards/native/nrf_bsim/doc/nrf54l15bsim.rst @@ -25,6 +25,12 @@ Just like for the nrf54l15dk target, the nrf54l15bsim/nrf54l15/cpuapp build target provides support for the application core, on the simulated nRF54L15 SOC. +.. note:: + + Unlike real nRF54L15 devices, the nrf54l15bsim target has unlimited RAM, and code does not + occupy its RRAM. Therefore, as the nRF54L15, nRF54L10 and nRF54L05 SOCs only differ in the amount + of available RAM and RRAM either can be simulated using the nrf54l15bsim. + .. note:: This simulated target does **not** yet support targeting the cpuflpr core. @@ -51,9 +57,6 @@ and will use the same drivers as the nrf54l15dk targets for these. For more information on what is modeled to which level of detail, check the `HW models implementation status`_. -Note that unlike a real nrf54l15 device, the nrf54l15bsim boards have unlimited RAM, and code does -not occupy their RRAM. - .. _BabbleSim: https://BabbleSim.github.io From ed8f613e55102184eb40e11d11cba5714d26f305 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 13 Nov 2024 12:58:56 +0000 Subject: [PATCH 2381/4482] cmake: dts: Use temporary file for dts.cmake Uses a temporary file for dts output then uses CMake to copy to the correct file if it has changed. This prevents a ping-pong issue when sysbuild is used of configuring and building cycle when nothing has changed and there is sysbuild code which loads in the devicetree data from an image Signed-off-by: Jamie McCrae --- cmake/modules/dts.cmake | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmake/modules/dts.cmake b/cmake/modules/dts.cmake index a2c56577cfa54..737e083aa5720 100644 --- a/cmake/modules/dts.cmake +++ b/cmake/modules/dts.cmake @@ -349,17 +349,26 @@ endif() # # Run GEN_DTS_CMAKE_SCRIPT. # +# A temporary file is copied to the original file if it differs. This prevents issue such as a +# cycle when sysbuild is used of configuring and building multiple times due to the dts.cmake file +# of images having a newer modification time than the sysbuild build.ninja file, despite the +# output having not changed +# +set(dts_cmake_tmp ${DTS_CMAKE}.new) execute_process( COMMAND ${PYTHON_EXECUTABLE} ${GEN_DTS_CMAKE_SCRIPT} --edt-pickle ${EDT_PICKLE} - --cmake-out ${DTS_CMAKE} + --cmake-out ${dts_cmake_tmp} WORKING_DIRECTORY ${PROJECT_BINARY_DIR} RESULT_VARIABLE ret ) if(NOT "${ret}" STREQUAL "0") message(FATAL_ERROR "gen_dts_cmake.py failed with return code: ${ret}") else() + zephyr_file_copy(${dts_cmake_tmp} ${DTS_CMAKE} ONLY_IF_DIFFERENT) + file(REMOVE ${dts_cmake_tmp}) + set(dts_cmake_tmp) message(STATUS "Including generated dts.cmake file: ${DTS_CMAKE}") include(${DTS_CMAKE}) endif() From a730d9abad9241c0eb3fe0be64f42137692a6285 Mon Sep 17 00:00:00 2001 From: Andrej Butok Date: Wed, 13 Nov 2024 12:56:59 +0100 Subject: [PATCH 2382/4482] boards: nxp: fix s26ks512s0 flash write-block-size - Sets s26ks512s0 flash write-block-size to correct 256KB. - Optimizes MCUboot partitions to fit the correct write-block-size. Fixes #80284 Signed-off-by: Andrej Butok --- ...imxrt1050_evk_mimxrt1052_hyperflash.overlay | 18 +++++++++--------- ...imxrt1060_evk_mimxrt1062_hyperflash.overlay | 18 +++++++++--------- .../mimxrt1062_fmurt6/mimxrt1062_fmurt6.dts | 18 +++++++++--------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/boards/nxp/mimxrt1050_evk/mimxrt1050_evk_mimxrt1052_hyperflash.overlay b/boards/nxp/mimxrt1050_evk/mimxrt1050_evk_mimxrt1052_hyperflash.overlay index cc31988f583dd..346aaca819f8c 100644 --- a/boards/nxp/mimxrt1050_evk/mimxrt1050_evk_mimxrt1052_hyperflash.overlay +++ b/boards/nxp/mimxrt1050_evk/mimxrt1050_evk_mimxrt1052_hyperflash.overlay @@ -39,7 +39,7 @@ ahb-write-wait-unit = <2>; ahb-write-wait-interval = <20>; status = "okay"; - erase-block-size = <4096>; + erase-block-size = ; write-block-size = <16>; partitions { @@ -48,22 +48,22 @@ #size-cells = <1>; boot_partition: partition@0 { label = "mcuboot"; - reg = <0x00000000 DT_SIZE_K(128)>; + reg = <0x00000000 DT_SIZE_K(256)>; }; - /* The MCUBoot swap-move algorithm uses the last 11 sectors + /* The MCUBoot swap-move algorithm uses the last 2 sectors * of the primary slot0 for swap status and move. */ - slot0_partition: partition@20000 { + slot0_partition: partition@40000 { label = "image-0"; - reg = <0x00020000 (DT_SIZE_M(3) + DT_SIZE_K(44))>; + reg = <0x00040000 (DT_SIZE_M(3) + DT_SIZE_K(512))>; }; - slot1_partition: partition@32B000 { + slot1_partition: partition@3C0000 { label = "image-1"; - reg = <0x0032B000 DT_SIZE_M(3)>; + reg = <0x003C0000 DT_SIZE_M(3)>; }; - storage_partition: partition@62B000 { + storage_partition: partition@6C0000 { label = "storage"; - reg = <0x0062B000 (DT_SIZE_M(58) - DT_SIZE_K(172))>; + reg = <0x006C0000 (DT_SIZE_M(58) - DT_SIZE_K(768))>; }; }; }; diff --git a/boards/nxp/mimxrt1060_evk/mimxrt1060_evk_mimxrt1062_hyperflash.overlay b/boards/nxp/mimxrt1060_evk/mimxrt1060_evk_mimxrt1062_hyperflash.overlay index 27e013f2cad8a..0a3bb58d33d7d 100644 --- a/boards/nxp/mimxrt1060_evk/mimxrt1060_evk_mimxrt1062_hyperflash.overlay +++ b/boards/nxp/mimxrt1060_evk/mimxrt1060_evk_mimxrt1062_hyperflash.overlay @@ -37,7 +37,7 @@ ahb-write-wait-unit = <2>; ahb-write-wait-interval = <20>; status = "okay"; - erase-block-size = <4096>; + erase-block-size = ; write-block-size = <16>; partitions { @@ -46,22 +46,22 @@ #size-cells = <1>; boot_partition: partition@0 { label = "mcuboot"; - reg = <0x00000000 DT_SIZE_K(128)>; + reg = <0x00000000 DT_SIZE_K(256)>; }; - /* The MCUBoot swap-move algorithm uses the last 11 sectors + /* The MCUBoot swap-move algorithm uses the last 2 sectors * of the primary slot0 for swap status and move. */ - slot0_partition: partition@20000 { + slot0_partition: partition@40000 { label = "image-0"; - reg = <0x00020000 (DT_SIZE_M(3) + DT_SIZE_K(44))>; + reg = <0x00040000 (DT_SIZE_M(3) + DT_SIZE_K(512))>; }; - slot1_partition: partition@32B000 { + slot1_partition: partition@3C0000 { label = "image-1"; - reg = <0x0032B000 DT_SIZE_M(3)>; + reg = <0x003C0000 DT_SIZE_M(3)>; }; - storage_partition: partition@62B000 { + storage_partition: partition@6C0000 { label = "storage"; - reg = <0x0062B000 (DT_SIZE_M(58) - DT_SIZE_K(172))>; + reg = <0x006C0000 (DT_SIZE_M(58) - DT_SIZE_K(768))>; }; }; }; diff --git a/boards/nxp/mimxrt1062_fmurt6/mimxrt1062_fmurt6.dts b/boards/nxp/mimxrt1062_fmurt6/mimxrt1062_fmurt6.dts index 44a00e72d9a36..de159e4ce240a 100644 --- a/boards/nxp/mimxrt1062_fmurt6/mimxrt1062_fmurt6.dts +++ b/boards/nxp/mimxrt1062_fmurt6/mimxrt1062_fmurt6.dts @@ -200,7 +200,7 @@ ahb-write-wait-unit = <2>; ahb-write-wait-interval = <20>; status = "okay"; - erase-block-size = <4096>; + erase-block-size = ; write-block-size = <16>; partitions { @@ -209,22 +209,22 @@ #size-cells = <1>; boot_partition: partition@0 { label = "mcuboot"; - reg = <0x00000000 DT_SIZE_K(128)>; + reg = <0x00000000 DT_SIZE_K(256)>; }; - /* The MCUBoot swap-move algorithm uses the last 11 sectors + /* The MCUBoot swap-move algorithm uses the last 2 sectors * of the primary slot0 for swap status and move. */ - slot0_partition: partition@20000 { + slot0_partition: partition@40000 { label = "image-0"; - reg = <0x00020000 (DT_SIZE_M(3) + DT_SIZE_K(44))>; + reg = <0x00040000 (DT_SIZE_M(3) + DT_SIZE_K(512))>; }; - slot1_partition: partition@32B000 { + slot1_partition: partition@3C0000 { label = "image-1"; - reg = <0x0032B000 DT_SIZE_M(3)>; + reg = <0x003C0000 DT_SIZE_M(3)>; }; - storage_partition: partition@62B000 { + storage_partition: partition@6C0000 { label = "storage"; - reg = <0x0062B000 (DT_SIZE_M(58) - DT_SIZE_K(172))>; + reg = <0x006C0000 (DT_SIZE_M(58) - DT_SIZE_K(768))>; }; }; }; From 8f14c68660bcb64a8e25ddfab7d4fe58ef95e44a Mon Sep 17 00:00:00 2001 From: Marcin Niestroj Date: Wed, 13 Nov 2024 12:33:19 +0100 Subject: [PATCH 2383/4482] boards: st: nucleo_u5a5zj_q: configure PD14 as SPI1 nCS ST ZIO connector is Arduino Uno compatible. Arduino SPI pins are placed on D10-D13 pins, where D10 is SPI nCS pin. This pin is connected with PD14 of STM32U5A. According to schematics of this Nucleo board [1]: Due to muxing constrainte, the SPI_NSS is not available as an alternate on this IO, so this pin is affected with an I/O function to do the Chip Select This means that software control of GPIO is needed to make use of this SPI interface on regular SPI signals on Arduino connector. Reconfigure SPI1 (used as Arduino SPI) interface to account for that. Note that previously configured PE12 is only available on ST ZIO and ST Morpho connectors, not on Arduino connector. Update documentation as well, which was referencing PA4 as nCS signal (used on some other Nucleo boards). [1] https://www.st.com/resource/en/schematic_pack/mb1549-u5a5ziq-c04-schematic.pdf Signed-off-by: Marcin Niestroj --- boards/st/nucleo_u5a5zj_q/doc/index.rst | 2 +- boards/st/nucleo_u5a5zj_q/nucleo_u5a5zj_q-common.dtsi | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/boards/st/nucleo_u5a5zj_q/doc/index.rst b/boards/st/nucleo_u5a5zj_q/doc/index.rst index 60701060fcc1f..ea919c4f10ee7 100644 --- a/boards/st/nucleo_u5a5zj_q/doc/index.rst +++ b/boards/st/nucleo_u5a5zj_q/doc/index.rst @@ -236,7 +236,7 @@ Default Zephyr Peripheral Mapping: - LD3 : PG2 - LPUART_1_TX : PG7 - LPUART_1_RX : PG8 -- SPI_1_NSS : PA4 +- SPI_1 nCS (GPIO) : PD14 - SPI_1_SCK : PA5 - SPI_1_MISO : PA6 - SPI_1_MOSI : PA7 diff --git a/boards/st/nucleo_u5a5zj_q/nucleo_u5a5zj_q-common.dtsi b/boards/st/nucleo_u5a5zj_q/nucleo_u5a5zj_q-common.dtsi index a08d7b47ce2a4..ecc9e862c990f 100644 --- a/boards/st/nucleo_u5a5zj_q/nucleo_u5a5zj_q-common.dtsi +++ b/boards/st/nucleo_u5a5zj_q/nucleo_u5a5zj_q-common.dtsi @@ -112,9 +112,9 @@ }; &spi1 { - pinctrl-0 = <&spi1_nss_pe12 &spi1_sck_pa5 - &spi1_miso_pa6 &spi1_mosi_pa7>; + pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>; pinctrl-names = "default"; + cs-gpios = <&gpiod 14 GPIO_ACTIVE_LOW>; status = "okay"; }; From 175bfb4bc9e59371a8101af96c6ff853ad18dab6 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 13 Nov 2024 08:39:54 +0100 Subject: [PATCH 2384/4482] tests: net: lib: lwm2m: interop: Fix strip-with-multi-characters (B005) All strip functions remove any of the provided characters instead of a prefix/suffix. This is likely a bug. See https://docs.astral.sh/ruff/rules/strip-with-multi-characters/ Signed-off-by: Pieter De Gendt --- tests/net/lib/lwm2m/interop/pytest/leshan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/net/lib/lwm2m/interop/pytest/leshan.py b/tests/net/lib/lwm2m/interop/pytest/leshan.py index 024bc6775c0b4..916661a8a4e52 100644 --- a/tests/net/lib/lwm2m/interop/pytest/leshan.py +++ b/tests/net/lib/lwm2m/interop/pytest/leshan.py @@ -455,7 +455,7 @@ def next_event(self, event: str): for line in self._it: if not line.startswith('data: '): continue - data = json.loads(line.lstrip('data: ')) + data = json.loads(line.removeprefix('data: ')) if event == 'SEND' or (event == 'NOTIFICATION' and data['kind'] == 'composite'): return Leshan.parse_composite(data['val']) if event == 'NOTIFICATION': From 92a7ddfb566d2ee55b7741d5d572d8bc2aa74caa Mon Sep 17 00:00:00 2001 From: Nidhal BEN OTHMEN Date: Tue, 12 Nov 2024 18:09:27 +0100 Subject: [PATCH 2385/4482] boards: st: Update nucleo_wba55cg dts file Update nucleo_wba55cg dts file to use pinctrl dtsi file of WBA55 instead of WBA52. Signed-off-by: Nidhal BEN OTHMEN --- boards/st/nucleo_wba55cg/nucleo_wba55cg.dts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/boards/st/nucleo_wba55cg/nucleo_wba55cg.dts b/boards/st/nucleo_wba55cg/nucleo_wba55cg.dts index 1ff550809dd90..d527eea704303 100644 --- a/boards/st/nucleo_wba55cg/nucleo_wba55cg.dts +++ b/boards/st/nucleo_wba55cg/nucleo_wba55cg.dts @@ -6,8 +6,7 @@ /dts-v1/; #include -/* Todo: Once available, use wba55 dedicated pinctrl.dtsi */ -#include +#include #include "arduino_r3_connector.dtsi" #include From 9bed2b7a98d7ff03de4ea13cb79807f80f746b90 Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Tue, 12 Nov 2024 17:13:07 +0100 Subject: [PATCH 2386/4482] scripts: logging: dictionary: Add support for size_t %z format specifier This patch adds support for the size_t %z format specifier to the dictionary parser. It's the correct format to use for size_t types in modern C, but it's not supported in python directly. Signed-off-by: Maximilian Deubel --- scripts/logging/dictionary/dictionary_parser/log_parser.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/logging/dictionary/dictionary_parser/log_parser.py b/scripts/logging/dictionary/dictionary_parser/log_parser.py index 07b0419b7d0db..b95274b22858b 100644 --- a/scripts/logging/dictionary/dictionary_parser/log_parser.py +++ b/scripts/logging/dictionary/dictionary_parser/log_parser.py @@ -46,6 +46,9 @@ def formalize_fmt_string(fmt_str): # No %p for pointer either, so use %x new_str = new_str.replace("%p", "0x%x") + # No %z support, use %d instead + new_str = new_str.replace("%z", "%d") + return new_str From 6d1a3bb36e006943fbbace3ad432e62d4e41827d Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Tue, 12 Nov 2024 09:43:04 -0600 Subject: [PATCH 2387/4482] boards: rd_rw612_bga: Move FCB in tree Move the FCB to be in tree for this board instead of in the NXP HAL. Signed-off-by: Declan Snyder --- boards/nxp/rd_rw612_bga/CMakeLists.txt | 5 +- .../nxp/rd_rw612_bga/MX25U51245GZ4I00_FCB.c | 99 +++++++++++++++++++ 2 files changed, 100 insertions(+), 4 deletions(-) create mode 100644 boards/nxp/rd_rw612_bga/MX25U51245GZ4I00_FCB.c diff --git a/boards/nxp/rd_rw612_bga/CMakeLists.txt b/boards/nxp/rd_rw612_bga/CMakeLists.txt index 45052c065fb41..1317c39df3102 100644 --- a/boards/nxp/rd_rw612_bga/CMakeLists.txt +++ b/boards/nxp/rd_rw612_bga/CMakeLists.txt @@ -12,9 +12,6 @@ if(CONFIG_NXP_RW6XX_BOOT_HEADER) endif() zephyr_compile_definitions(BOOT_HEADER_ENABLE=1) zephyr_compile_definitions(BOARD_FLASH_SIZE=CONFIG_FLASH_SIZE*1024) - set(RW612_BOARD_DIR - "${ZEPHYR_HAL_NXP_MODULE_DIR}/mcux/mcux-sdk/boards/rdrw612bga") zephyr_library() - zephyr_library_sources(${RW612_BOARD_DIR}/flash_config/flash_config.c) - zephyr_library_include_directories(${RW612_BOARD_DIR}/flash_config) + zephyr_library_sources(MX25U51245GZ4I00_FCB.c) endif() diff --git a/boards/nxp/rd_rw612_bga/MX25U51245GZ4I00_FCB.c b/boards/nxp/rd_rw612_bga/MX25U51245GZ4I00_FCB.c new file mode 100644 index 0000000000000..48a6e9ca08a5e --- /dev/null +++ b/boards/nxp/rd_rw612_bga/MX25U51245GZ4I00_FCB.c @@ -0,0 +1,99 @@ +/* + * Copyright 2021-2023 NXP + * All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include + +__attribute__((section(".flash_conf"), used)) +const fc_flexspi_nor_config_t flexspi_config = { + .memConfig = { + .tag = FC_BLOCK_TAG, + .version = FC_BLOCK_VERSION, + .readSampleClkSrc = 1, + .csHoldTime = 3, + .csSetupTime = 3, + .deviceModeCfgEnable = 1, + .deviceModeSeq = {.seqNum = 1, .seqId = 2}, + .deviceModeArg = 0xC740, + .configCmdEnable = 0, + .deviceType = 0x1, + .sflashPadType = kSerialFlash_4Pads, + .serialClkFreq = 7, + .sflashA1Size = 0x4000000U, + .sflashA2Size = 0, + .sflashB1Size = 0, + .sflashB2Size = 0, + .lookupTable = { + /* Read */ + [0] = FC_FLEXSPI_LUT_SEQ( + FC_CMD_SDR, FC_FLEXSPI_1PAD, + 0xEC, FC_RADDR_SDR, + FC_FLEXSPI_4PAD, 0x20), + [1] = FC_FLEXSPI_LUT_SEQ( + FC_DUMMY_SDR, + FC_FLEXSPI_4PAD, 0x0A, + FC_READ_SDR, + FC_FLEXSPI_4PAD, 0x04), + + /* Read Status */ + [4 * 1 + 0] = FC_FLEXSPI_LUT_SEQ( + FC_CMD_SDR, FC_FLEXSPI_1PAD, + 0x05, FC_READ_SDR, + FC_FLEXSPI_1PAD, 0x04), + + /* Write Status */ + [4 * 2 + 0] = FC_FLEXSPI_LUT_SEQ( + FC_CMD_SDR, FC_FLEXSPI_1PAD, + 0x01, FC_WRITE_SDR, + FC_FLEXSPI_1PAD, 0x02), + + /* Write Enable */ + [4 * 3 + 0] = FC_FLEXSPI_LUT_SEQ( + FC_CMD_SDR, FC_FLEXSPI_1PAD, + 0x06, FC_STOP_EXE, + FC_FLEXSPI_1PAD, 0x00), + + /* Sector erase */ + [4 * 5 + 0] = FC_FLEXSPI_LUT_SEQ( + FC_CMD_SDR, FC_FLEXSPI_1PAD, + 0x21, FC_RADDR_SDR, + FC_FLEXSPI_1PAD, 0x20), + + /* Block erase */ + [4 * 8 + 0] = + FC_FLEXSPI_LUT_SEQ(FC_CMD_SDR, + FC_FLEXSPI_1PAD, + 0x5C, FC_RADDR_SDR, + FC_FLEXSPI_1PAD, + 0x20), + + /* Page program */ + [4 * 9 + 0] = + FC_FLEXSPI_LUT_SEQ(FC_CMD_SDR, + FC_FLEXSPI_1PAD, + 0x12, FC_RADDR_SDR, + FC_FLEXSPI_1PAD, + 0x20), + [4 * 9 + 1] = + FC_FLEXSPI_LUT_SEQ(FC_WRITE_SDR, + FC_FLEXSPI_1PAD, + 0x00, + FC_STOP_EXE, FC_FLEXSPI_1PAD, + 0x00), + + /* chip erase */ + [4 * 11 + 0] = FC_FLEXSPI_LUT_SEQ(FC_CMD_SDR, + FC_FLEXSPI_1PAD, + 0x60, FC_STOP_EXE, + FC_FLEXSPI_1PAD, + 0x00), + }, + }, + .pageSize = 0x100, + .sectorSize = 0x1000, + .ipcmdSerialClkFreq = 0, + .blockSize = 0x8000, + .fcb_fill[0] = 0xFFFFFFFF, +}; From 0be5dcd25d18330b67db68509ac427246c4dbfc2 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 12 Nov 2024 09:38:08 -0600 Subject: [PATCH 2388/4482] arch: arm: add MPU definitions for all flash and SRAM region sizes Add definitions for all possible flash and SRAM region sizes for ARMv7 MPU. Also, correct some of the SRAM size checks to use <= instead of ==, to be consistent with the remainder of the file Signed-off-by: Daniel DeGrasse --- .../arch/arm/cortex_m/arm_mpu_mem_cfg.h | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/include/zephyr/arch/arm/cortex_m/arm_mpu_mem_cfg.h b/include/zephyr/arch/arm/cortex_m/arm_mpu_mem_cfg.h index 7f0d3e3ef662f..3f74451c34a7c 100644 --- a/include/zephyr/arch/arm/cortex_m/arm_mpu_mem_cfg.h +++ b/include/zephyr/arch/arm/cortex_m/arm_mpu_mem_cfg.h @@ -37,6 +37,12 @@ #define REGION_FLASH_SIZE REGION_256M #elif CONFIG_FLASH_SIZE <= 524288 #define REGION_FLASH_SIZE REGION_512M +#elif CONFIG_FLASH_SIZE <= 1048576 +#define REGION_FLASH_SIZE REGION_1G +#elif CONFIG_FLASH_SIZE <= 2097152 +#define REGION_FLASH_SIZE REGION_2G +#elif CONFIG_FLASH_SIZE <= 4194304 +#define REGION_FLASH_SIZE REGION_4G #else #error "Unsupported flash size configuration" #endif @@ -64,10 +70,22 @@ #define REGION_SRAM_SIZE REGION_8M #elif CONFIG_SRAM_SIZE <= 16384 #define REGION_SRAM_SIZE REGION_16M -#elif CONFIG_SRAM_SIZE == 32768 +#elif CONFIG_SRAM_SIZE <= 32768 #define REGION_SRAM_SIZE REGION_32M -#elif CONFIG_SRAM_SIZE == 65536 +#elif CONFIG_SRAM_SIZE <= 65536 #define REGION_SRAM_SIZE REGION_64M +#elif CONFIG_SRAM_SIZE <= 131072 +#define REGION_SRAM_SIZE REGION_128M +#elif CONFIG_SRAM_SIZE <= 262144 +#define REGION_SRAM_SIZE REGION_256M +#elif CONFIG_SRAM_SIZE <= 524288 +#define REGION_SRAM_SIZE REGION_512M +#elif CONFIG_SRAM_SIZE <= 1048576 +#define REGION_SRAM_SIZE REGION_1G +#elif CONFIG_SRAM_SIZE <= 2097152 +#define REGION_SRAM_SIZE REGION_2G +#elif CONFIG_SRAM_SIZE <= 4194304 +#define REGION_SRAM_SIZE REGION_4G #else #error "Unsupported sram size configuration" #endif From ca67f51170a53f32ff9c0769d085fcbc47b905da Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 11 Nov 2024 14:35:30 +0200 Subject: [PATCH 2389/4482] tests: coap_client: Improve socket stubs * Use sys_rand_get() and seed the CoAP library, so our MIDs are random. * Set socket events per socket, so we don't accidentally receive on wrong socket * Reply with correct tokens Signed-off-by: Seppo Takalo --- tests/net/lib/coap_client/prj.conf | 1 + tests/net/lib/coap_client/src/main.c | 91 +++++++++++++++++++-------- tests/net/lib/coap_client/src/stubs.c | 20 +++--- tests/net/lib/coap_client/src/stubs.h | 7 +-- 4 files changed, 77 insertions(+), 42 deletions(-) diff --git a/tests/net/lib/coap_client/prj.conf b/tests/net/lib/coap_client/prj.conf index c7265029a21a4..8405a56f80036 100644 --- a/tests/net/lib/coap_client/prj.conf +++ b/tests/net/lib/coap_client/prj.conf @@ -1,3 +1,4 @@ #Testing CONFIG_ZTEST=y CONFIG_ZTEST_STACK_SIZE=4096 +CONFIG_TEST_RANDOM_GENERATOR=y diff --git a/tests/net/lib/coap_client/src/main.c b/tests/net/lib/coap_client/src/main.c index f06a0ce646c53..e066f86bae666 100644 --- a/tests/net/lib/coap_client/src/main.c +++ b/tests/net/lib/coap_client/src/main.c @@ -11,7 +11,7 @@ #include "stubs.h" -LOG_MODULE_REGISTER(coap_client_test); +LOG_MODULE_REGISTER(coap_client_test, LOG_LEVEL_DBG); DEFINE_FFF_GLOBALS; #define FFF_FAKES_LIST(FAKE) @@ -23,11 +23,14 @@ DEFINE_FFF_GLOBALS; (CONFIG_COAP_INIT_ACK_TIMEOUT_MS + CONFIG_COAP_INIT_ACK_TIMEOUT_MS / 2) #define VALID_MESSAGE_ID BIT(31) +#define TOKEN_OFFSET 4 static int16_t last_response_code; static const char *test_path = "test"; static uint32_t messages_needing_response[2]; +static uint8_t last_token[2][COAP_TOKEN_MAX_LEN]; +static const uint8_t empty_token[COAP_TOKEN_MAX_LEN] = {0}; static struct coap_client client; @@ -61,6 +64,27 @@ static void set_next_pending_message_id(uint16_t id) } } +static void store_token(uint8_t *buf) +{ + for (int i = 0; i < ARRAY_SIZE(last_token); i++) { + if (memcmp(last_token[i], empty_token, 8) == 0) { + memcpy(last_token[i], buf + TOKEN_OFFSET, COAP_TOKEN_MAX_LEN); + return; + } + } +} + +static void restore_token(uint8_t *buf) +{ + for (int i = 0; i < ARRAY_SIZE(last_token); i++) { + if (memcmp(last_token[i], empty_token, 8) != 0) { + memcpy(buf + TOKEN_OFFSET, last_token[i], COAP_TOKEN_MAX_LEN); + memset(last_token[i], 0, COAP_TOKEN_MAX_LEN); + return; + } + } +} + static ssize_t z_impl_zsock_recvfrom_custom_fake(int sock, void *buf, size_t max_len, int flags, struct sockaddr *src_addr, socklen_t *addrlen) { @@ -74,10 +98,11 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake(int sock, void *buf, size_t max ack_data[2] = (uint8_t)(last_message_id >> 8); ack_data[3] = (uint8_t)last_message_id; + restore_token(ack_data); memcpy(buf, ack_data, sizeof(ack_data)); - clear_socket_events(ZSOCK_POLLIN); + clear_socket_events(sock, ZSOCK_POLLIN); return sizeof(ack_data); } @@ -90,14 +115,14 @@ static ssize_t z_impl_zsock_sendto_custom_fake(int sock, void *buf, size_t len, last_message_id |= ((uint8_t *)buf)[2] << 8; last_message_id |= ((uint8_t *)buf)[3]; - type = (((uint8_t *)buf)[0] & 0x30) >> 4; + store_token(buf); set_next_pending_message_id(last_message_id); LOG_INF("Latest message ID: %d", last_message_id); if (type == 0) { - set_socket_events(ZSOCK_POLLIN); + set_socket_events(sock, ZSOCK_POLLIN); } return 1; @@ -111,6 +136,7 @@ static ssize_t z_impl_zsock_sendto_custom_fake_no_reply(int sock, void *buf, siz last_message_id |= ((uint8_t *)buf)[2] << 8; last_message_id |= ((uint8_t *)buf)[3]; + store_token(buf); set_next_pending_message_id(last_message_id); LOG_INF("Latest message ID: %d", last_message_id); @@ -128,6 +154,7 @@ static ssize_t z_impl_zsock_sendto_custom_fake_echo(int sock, void *buf, size_t last_message_id |= ((uint8_t *)buf)[2] << 8; last_message_id |= ((uint8_t *)buf)[3]; + store_token(buf); set_next_pending_message_id(last_message_id); LOG_INF("Latest message ID: %d", last_message_id); @@ -144,7 +171,7 @@ static ssize_t z_impl_zsock_sendto_custom_fake_echo(int sock, void *buf, size_t z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake; - set_socket_events(ZSOCK_POLLIN); + set_socket_events(sock, ZSOCK_POLLIN); return 1; } @@ -160,6 +187,7 @@ static ssize_t z_impl_zsock_sendto_custom_fake_echo_next_req(int sock, void *buf last_message_id |= ((uint8_t *)buf)[2] << 8; last_message_id |= ((uint8_t *)buf)[3]; + store_token(buf); set_next_pending_message_id(last_message_id); LOG_INF("Latest message ID: %d", last_message_id); @@ -184,7 +212,7 @@ static ssize_t z_impl_zsock_sendto_custom_fake_echo_next_req(int sock, void *buf z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake; - set_socket_events(ZSOCK_POLLIN); + set_socket_events(sock, ZSOCK_POLLIN); return 1; } @@ -202,10 +230,11 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake_response(int sock, void *buf, s ack_data[2] = (uint8_t)(last_message_id >> 8); ack_data[3] = (uint8_t)last_message_id; + restore_token(ack_data); memcpy(buf, ack_data, sizeof(ack_data)); - clear_socket_events(ZSOCK_POLLIN); + clear_socket_events(sock, ZSOCK_POLLIN); return sizeof(ack_data); } @@ -216,7 +245,7 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake_empty_ack(int sock, void *buf, { uint16_t last_message_id = 0; - static uint8_t ack_data[] = {0x68, 0x00, 0x00, 0x00, 0x00, 0x00, + static uint8_t ack_data[] = {0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; last_message_id = get_next_pending_message_id(); @@ -247,7 +276,7 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake_unmatching(int sock, void *buf, memcpy(buf, ack_data, sizeof(ack_data)); - clear_socket_events(ZSOCK_POLLIN); + clear_socket_events(sock, ZSOCK_POLLIN); return sizeof(ack_data); } @@ -267,13 +296,14 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake_echo(int sock, void *buf, size_ ack_data[2] = (uint8_t)(last_message_id >> 8); ack_data[3] = (uint8_t)last_message_id; + restore_token(ack_data); memcpy(buf, ack_data, sizeof(ack_data)); z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_response; z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_echo; - clear_socket_events(ZSOCK_POLLIN); + clear_socket_events(sock, ZSOCK_POLLIN); return sizeof(ack_data); } @@ -293,19 +323,23 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake_echo_next_req(int sock, void *b ack_data[2] = (uint8_t)(last_message_id >> 8); ack_data[3] = (uint8_t)last_message_id; + restore_token(ack_data); memcpy(buf, ack_data, sizeof(ack_data)); z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_response; z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_echo_next_req; - clear_socket_events(ZSOCK_POLLIN); + clear_socket_events(sock, ZSOCK_POLLIN); return sizeof(ack_data); } +extern void net_coap_init(void); + static void *suite_setup(void) { + net_coap_init(); coap_client_init(&client, NULL); return NULL; @@ -315,6 +349,8 @@ static void test_setup(void *data) { int i; + k_mutex_lock(&client.lock, K_FOREVER); + /* Register resets */ DO_FOREACH_FAKE(RESET_FAKE); /* reset common FFF internal structures */ @@ -322,13 +358,19 @@ static void test_setup(void *data) z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake; z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake; - clear_socket_events(ZSOCK_POLLIN | ZSOCK_POLLOUT | ZSOCK_POLLERR); + clear_socket_events(0, ZSOCK_POLLIN | ZSOCK_POLLOUT | ZSOCK_POLLERR); + clear_socket_events(1, ZSOCK_POLLIN | ZSOCK_POLLOUT | ZSOCK_POLLERR); for (i = 0; i < ARRAY_SIZE(messages_needing_response); i++) { messages_needing_response[i] = 0; } + memset(&client.requests, 0, sizeof(client.requests)); + memset(last_token, 0, sizeof(last_token)); + last_response_code = 0; + + k_mutex_unlock(&client.lock); } void coap_callback(int16_t code, size_t offset, const uint8_t *payload, size_t len, bool last_block, @@ -396,7 +438,7 @@ ZTEST(coap_client, test_resend_request) ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); k_sleep(K_MSEC(MORE_THAN_ACK_TIMEOUT_MS)); - set_socket_events(ZSOCK_POLLIN | ZSOCK_POLLOUT); + set_socket_events(client.fd, ZSOCK_POLLIN | ZSOCK_POLLOUT); k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); @@ -551,7 +593,7 @@ ZTEST(coap_client, test_no_response) client_request.len = strlen(short_payload); z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; - set_socket_events(ZSOCK_POLLOUT); + set_socket_events(client.fd, ZSOCK_POLLOUT); k_sleep(K_MSEC(1)); @@ -628,7 +670,7 @@ ZTEST(coap_client, test_multiple_requests) ret = coap_client_req(&client, 0, &address, &req2, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); - set_socket_events(ZSOCK_POLLIN); + set_socket_events(client.fd, ZSOCK_POLLIN); while (last_response_code == 0 && retry > 0) { retry--; k_sleep(K_MSEC(1)); @@ -636,7 +678,7 @@ ZTEST(coap_client, test_multiple_requests) zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); last_response_code = 0; - set_socket_events(ZSOCK_POLLIN); + set_socket_events(client.fd, ZSOCK_POLLIN); zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); zassert_ok(k_sem_take(&sem2, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); @@ -665,7 +707,7 @@ ZTEST(coap_client, test_unmatching_tokens) client_request.len = strlen(short_payload); z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_unmatching; - set_socket_events(ZSOCK_POLLIN | ZSOCK_POLLOUT); + set_socket_events(client.fd, ZSOCK_POLLIN | ZSOCK_POLLOUT); k_sleep(K_MSEC(1)); @@ -681,9 +723,6 @@ ZTEST(coap_client, test_multiple_clients) { int ret; int retry = MORE_THAN_EXCHANGE_LIFETIME_MS; - static struct coap_client client2 = { - .fd = 2, - }; struct k_sem sem1, sem2; struct sockaddr address = {0}; struct coap_client_request req1 = { @@ -710,17 +749,17 @@ ZTEST(coap_client, test_multiple_clients) k_sleep(K_MSEC(1)); LOG_INF("Sending requests"); - ret = coap_client_req(&client, 1, &address, &req1, NULL); + ret = coap_client_req(&client, client.fd, &address, &req1, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); - ret = coap_client_req(&client2, 2, &address, &req2, NULL); + ret = coap_client_req(&client2, client2.fd, &address, &req2, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); while (last_response_code == 0 && retry > 0) { retry--; k_sleep(K_MSEC(1)); } - set_socket_events(ZSOCK_POLLIN); + set_socket_events(client2.fd, ZSOCK_POLLIN); k_sleep(K_SECONDS(1)); @@ -746,7 +785,7 @@ ZTEST(coap_client, test_poll_err) }; z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; - set_socket_events(ZSOCK_POLLERR); + set_socket_events(client.fd, ZSOCK_POLLERR); k_sleep(K_MSEC(1)); @@ -776,7 +815,7 @@ ZTEST(coap_client, test_poll_err_after_response) zassert_ok(k_sem_init(&sem1, 0, 1)); z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; - set_socket_events(ZSOCK_POLLIN); + set_socket_events(client.fd, ZSOCK_POLLIN); k_sleep(K_MSEC(1)); @@ -787,6 +826,6 @@ ZTEST(coap_client, test_poll_err_after_response) zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); - set_socket_events(ZSOCK_POLLERR); + set_socket_events(client.fd, ZSOCK_POLLERR); zassert_not_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); } diff --git a/tests/net/lib/coap_client/src/stubs.c b/tests/net/lib/coap_client/src/stubs.c index d698248b05059..8d251157ac1a6 100644 --- a/tests/net/lib/coap_client/src/stubs.c +++ b/tests/net/lib/coap_client/src/stubs.c @@ -10,7 +10,6 @@ LOG_MODULE_DECLARE(coap_client_test); DEFINE_FAKE_VALUE_FUNC(uint32_t, z_impl_sys_rand32_get); -DEFINE_FAKE_VOID_FUNC(z_impl_sys_rand_get, void *, size_t); DEFINE_FAKE_VALUE_FUNC(ssize_t, z_impl_zsock_recvfrom, int, void *, size_t, int, struct sockaddr *, socklen_t *); DEFINE_FAKE_VALUE_FUNC(ssize_t, z_impl_zsock_sendto, int, void *, size_t, int, @@ -22,21 +21,17 @@ struct zvfs_pollfd { short revents; }; -static short my_events; +static short my_events[NUM_FD]; -void set_socket_events(short events) +void set_socket_events(int fd, short events) { - my_events |= events; + __ASSERT_NO_MSG(fd < NUM_FD); + my_events[fd] |= events; } -void clear_socket_events(short events) +void clear_socket_events(int fd, short events) { - my_events &= ~events; -} - -int z_impl_zsock_socket(int family, int type, int proto) -{ - return 0; + my_events[fd] &= ~events; } int z_impl_zvfs_poll(struct zvfs_pollfd *fds, int nfds, int poll_timeout) @@ -44,7 +39,8 @@ int z_impl_zvfs_poll(struct zvfs_pollfd *fds, int nfds, int poll_timeout) int events = 0; k_sleep(K_MSEC(1)); for (int i = 0; i < nfds; i++) { - fds[i].revents = my_events & (fds[i].events | ZSOCK_POLLERR | ZSOCK_POLLHUP); + fds[i].revents = + my_events[fds[i].fd] & (fds[i].events | ZSOCK_POLLERR | ZSOCK_POLLHUP); if (fds[i].revents) { events++; } diff --git a/tests/net/lib/coap_client/src/stubs.h b/tests/net/lib/coap_client/src/stubs.h index 9a9f929ce76b9..c3024536b5453 100644 --- a/tests/net/lib/coap_client/src/stubs.h +++ b/tests/net/lib/coap_client/src/stubs.h @@ -36,12 +36,12 @@ #define ZSOCK_POLLNVAL 0x20 /** @} */ +#define NUM_FD 2 -void set_socket_events(short events); -void clear_socket_events(short events); +void set_socket_events(int fd, short events); +void clear_socket_events(int fd, short events); DECLARE_FAKE_VALUE_FUNC(uint32_t, z_impl_sys_rand32_get); -DECLARE_FAKE_VOID_FUNC(z_impl_sys_rand_get, void *, size_t); DECLARE_FAKE_VALUE_FUNC(ssize_t, z_impl_zsock_recvfrom, int, void *, size_t, int, struct sockaddr *, socklen_t *); DECLARE_FAKE_VALUE_FUNC(ssize_t, z_impl_zsock_sendto, int, void*, size_t, int, @@ -50,7 +50,6 @@ DECLARE_FAKE_VALUE_FUNC(ssize_t, z_impl_zsock_sendto, int, void*, size_t, int, #define DO_FOREACH_FAKE(FUNC) \ do { \ FUNC(z_impl_sys_rand32_get) \ - FUNC(z_impl_sys_rand_get) \ FUNC(z_impl_zsock_recvfrom) \ FUNC(z_impl_zsock_sendto) \ } while (0) From 83bc1fcb46b6c32d324c9c4d0fa697b51dfb5a0e Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 11 Nov 2024 14:36:46 +0200 Subject: [PATCH 2390/4482] tests: coap_client: Add test for duplicate response Add test where we receive same UDP packet twice. Signed-off-by: Seppo Takalo --- tests/net/lib/coap_client/CMakeLists.txt | 2 +- tests/net/lib/coap_client/src/main.c | 55 ++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/tests/net/lib/coap_client/CMakeLists.txt b/tests/net/lib/coap_client/CMakeLists.txt index f8d21563b57a6..6e3b6353e08ca 100644 --- a/tests/net/lib/coap_client/CMakeLists.txt +++ b/tests/net/lib/coap_client/CMakeLists.txt @@ -26,7 +26,7 @@ add_compile_definitions(CONFIG_COAP_CLIENT_MESSAGE_HEADER_SIZE=48) add_compile_definitions(CONFIG_COAP_CLIENT_STACK_SIZE=1024) add_compile_definitions(CONFIG_COAP_CLIENT_THREAD_PRIORITY=10) add_compile_definitions(CONFIG_COAP_LOG_LEVEL=4) -add_compile_definitions(CONFIG_COAP_INIT_ACK_TIMEOUT_MS=10) +add_compile_definitions(CONFIG_COAP_INIT_ACK_TIMEOUT_MS=100) add_compile_definitions(CONFIG_COAP_CLIENT_MAX_REQUESTS=2) add_compile_definitions(CONFIG_COAP_CLIENT_MAX_INSTANCES=2) add_compile_definitions(CONFIG_COAP_MAX_RETRANSMIT=4) diff --git a/tests/net/lib/coap_client/src/main.c b/tests/net/lib/coap_client/src/main.c index e066f86bae666..d03160ca53f13 100644 --- a/tests/net/lib/coap_client/src/main.c +++ b/tests/net/lib/coap_client/src/main.c @@ -335,6 +335,30 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake_echo_next_req(int sock, void *b return sizeof(ack_data); } +static ssize_t z_impl_zsock_recvfrom_custom_fake_duplicate_response(int sock, void *buf, + size_t max_len, int flags, + struct sockaddr *src_addr, + socklen_t *addrlen) +{ + uint8_t token[TOKEN_OFFSET + COAP_TOKEN_MAX_LEN]; + + uint16_t last_message_id = get_next_pending_message_id(); + + restore_token(token); + + set_next_pending_message_id(last_message_id); + set_next_pending_message_id(last_message_id); + store_token(token); + store_token(token); + + int ret = z_impl_zsock_recvfrom_custom_fake(sock, buf, max_len, flags, src_addr, addrlen); + + set_socket_events(sock, ZSOCK_POLLIN); + z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake; + + return ret; +} + extern void net_coap_init(void); static void *suite_setup(void) @@ -829,3 +853,34 @@ ZTEST(coap_client, test_poll_err_after_response) set_socket_events(client.fd, ZSOCK_POLLERR); zassert_not_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); } + +ZTEST(coap_client, test_duplicate_response) +{ + int ret = 0; + struct k_sem sem; + struct sockaddr address = {0}; + struct coap_client_request client_request = { + .method = COAP_METHOD_GET, + .confirmable = true, + .path = test_path, + .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, + .cb = coap_callback, + .payload = short_payload, + .len = strlen(short_payload), + .user_data = &sem, + }; + + zassert_ok(k_sem_init(&sem, 0, 2)); + z_impl_zsock_recvfrom_fake.custom_fake = + z_impl_zsock_recvfrom_custom_fake_duplicate_response; + + k_sleep(K_MSEC(1)); + LOG_INF("Send request"); + ret = coap_client_req(&client, 0, &address, &client_request, NULL); + zassert_true(ret >= 0, "Sending request failed, %d", ret); + + zassert_ok(k_sem_take(&sem, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); + + zassert_equal(k_sem_take(&sem, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)), -EAGAIN, ""); +} From 120aabbb8f3bdc97e6338b0590cd738d0795615b Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 11 Nov 2024 16:42:52 +0200 Subject: [PATCH 2391/4482] tests: coap_client: Add test when separate response is lost Test a scenario where Ack is received but the actual response is not coming. Signed-off-by: Seppo Takalo --- tests/net/lib/coap_client/src/main.c | 47 +++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/tests/net/lib/coap_client/src/main.c b/tests/net/lib/coap_client/src/main.c index d03160ca53f13..1ed77cbfc62fc 100644 --- a/tests/net/lib/coap_client/src/main.c +++ b/tests/net/lib/coap_client/src/main.c @@ -21,7 +21,7 @@ DEFINE_FFF_GLOBALS; #define MORE_THAN_LONG_EXCHANGE_LIFETIME_MS 4 * LONG_ACK_TIMEOUT_MS #define MORE_THAN_ACK_TIMEOUT_MS \ (CONFIG_COAP_INIT_ACK_TIMEOUT_MS + CONFIG_COAP_INIT_ACK_TIMEOUT_MS / 2) - +#define COAP_SEPARATE_TIMEOUT (6000 * 3) /* Needs a safety marging, tests run faster than -rt */ #define VALID_MESSAGE_ID BIT(31) #define TOKEN_OFFSET 4 @@ -33,6 +33,9 @@ static uint8_t last_token[2][COAP_TOKEN_MAX_LEN]; static const uint8_t empty_token[COAP_TOKEN_MAX_LEN] = {0}; static struct coap_client client; +static struct coap_client client2 = { + .fd = 1, +}; static char *short_payload = "testing"; static char *long_payload = LOREM_IPSUM_SHORT; @@ -260,6 +263,18 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake_empty_ack(int sock, void *buf, return sizeof(ack_data); } +static ssize_t z_impl_zsock_recvfrom_custom_fake_only_ack(int sock, void *buf, size_t max_len, + int flags, struct sockaddr *src_addr, + socklen_t *addrlen) +{ + int ret; + + ret = z_impl_zsock_recvfrom_custom_fake_empty_ack(sock, buf, max_len, flags, src_addr, + addrlen); + clear_socket_events(sock, ZSOCK_POLLIN); + return ret; +} + static ssize_t z_impl_zsock_recvfrom_custom_fake_unmatching(int sock, void *buf, size_t max_len, int flags, struct sockaddr *src_addr, socklen_t *addrlen) @@ -659,6 +674,36 @@ ZTEST(coap_client, test_separate_response) zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); } +ZTEST(coap_client, test_separate_response_lost) +{ + int ret = 0; + struct k_sem sem; + struct sockaddr address = {0}; + struct coap_client_request client_request = { + .method = COAP_METHOD_GET, + .confirmable = true, + .path = test_path, + .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, + .cb = coap_callback, + .payload = short_payload, + .len = strlen(short_payload), + .user_data = &sem, + }; + + zassert_ok(k_sem_init(&sem, 0, 1)); + z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_only_ack; + set_socket_events(client.fd, ZSOCK_POLLOUT); + + k_sleep(K_MSEC(1)); + + LOG_INF("Send request"); + ret = coap_client_req(&client, 0, &address, &client_request, NULL); + zassert_true(ret >= 0, "Sending request failed, %d", ret); + + zassert_ok(k_sem_take(&sem, K_MSEC(COAP_SEPARATE_TIMEOUT))); + zassert_equal(last_response_code, -ETIMEDOUT, ""); +} + ZTEST(coap_client, test_multiple_requests) { int ret = 0; From 5559a520c9b0c619a32f306666a1618caed7c238 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Tue, 12 Nov 2024 13:32:53 +0200 Subject: [PATCH 2392/4482] tests: coap_client: Improve retry testcases Add testcases for testing client's retry behaviour. Signed-off-by: Seppo Takalo --- tests/net/lib/coap_client/src/main.c | 57 ++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 7 deletions(-) diff --git a/tests/net/lib/coap_client/src/main.c b/tests/net/lib/coap_client/src/main.c index 1ed77cbfc62fc..330ad689b971b 100644 --- a/tests/net/lib/coap_client/src/main.c +++ b/tests/net/lib/coap_client/src/main.c @@ -220,6 +220,22 @@ static ssize_t z_impl_zsock_sendto_custom_fake_echo_next_req(int sock, void *buf return 1; } +static ssize_t z_impl_zsock_sendto_custom_fake_block(int sock, void *buf, size_t len, int flags, + const struct sockaddr *dest_addr, + socklen_t addrlen) +{ + errno = EAGAIN; + return -1; +} + +static ssize_t z_impl_zsock_sendto_custom_fake_err(int sock, void *buf, size_t len, int flags, + const struct sockaddr *dest_addr, + socklen_t addrlen) +{ + errno = ENETDOWN; + return -1; +} + static ssize_t z_impl_zsock_recvfrom_custom_fake_response(int sock, void *buf, size_t max_len, int flags, struct sockaddr *src_addr, socklen_t *addrlen) @@ -452,6 +468,30 @@ ZTEST(coap_client, test_get_request) LOG_INF("Test done"); } +ZTEST(coap_client, test_request_block) +{ + int ret = 0; + struct sockaddr address = {0}; + struct coap_client_request client_request = { + .method = COAP_METHOD_GET, + .confirmable = true, + .path = test_path, + .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, + .cb = coap_callback, + .payload = short_payload, + .len = strlen(short_payload), + }; + + z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_block; + + k_sleep(K_MSEC(1)); + + LOG_INF("Send request"); + ret = coap_client_req(&client, 0, &address, &client_request, NULL); + zassert_equal(ret, -EAGAIN, ""); +} + + ZTEST(coap_client, test_resend_request) { int ret = 0; @@ -462,14 +502,18 @@ ZTEST(coap_client, test_resend_request) .path = test_path, .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, .cb = coap_callback, - .payload = NULL, - .len = 0 + .payload = short_payload, + .len = strlen(short_payload), }; - client_request.payload = short_payload; - client_request.len = strlen(short_payload); + int (*sendto_fakes[])(int, void *, size_t, int, const struct sockaddr *, socklen_t) = { + z_impl_zsock_sendto_custom_fake_no_reply, + z_impl_zsock_sendto_custom_fake_block, + z_impl_zsock_sendto_custom_fake, + }; - z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; + SET_CUSTOM_FAKE_SEQ(z_impl_zsock_sendto, sendto_fakes, ARRAY_SIZE(sendto_fakes)); + set_socket_events(client.fd, ZSOCK_POLLOUT); k_sleep(K_MSEC(1)); @@ -477,11 +521,10 @@ ZTEST(coap_client, test_resend_request) ret = coap_client_req(&client, 0, &address, &client_request, NULL); zassert_true(ret >= 0, "Sending request failed, %d", ret); k_sleep(K_MSEC(MORE_THAN_ACK_TIMEOUT_MS)); - set_socket_events(client.fd, ZSOCK_POLLIN | ZSOCK_POLLOUT); k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); - zassert_equal(z_impl_zsock_sendto_fake.call_count, 2); + zassert_equal(z_impl_zsock_sendto_fake.call_count, 3); LOG_INF("Test done"); } From fc51fa491ff70574092fb9e5fd9c5d7e4caa2985 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Tue, 12 Nov 2024 13:38:11 +0200 Subject: [PATCH 2393/4482] tests: coap_client: Add testcase for Ack failure Add testcase where sending Ack to incomming Confirmable message fails. This should be reported to application as now the server is unaware that transmission have succeeded, so we cannot thread it as success. Signed-off-by: Seppo Takalo --- tests/net/lib/coap_client/src/main.c | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/net/lib/coap_client/src/main.c b/tests/net/lib/coap_client/src/main.c index 330ad689b971b..7554ffcd7ab1c 100644 --- a/tests/net/lib/coap_client/src/main.c +++ b/tests/net/lib/coap_client/src/main.c @@ -747,6 +747,41 @@ ZTEST(coap_client, test_separate_response_lost) zassert_equal(last_response_code, -ETIMEDOUT, ""); } +ZTEST(coap_client, test_separate_response_ack_fail) +{ + int ret = 0; + struct k_sem sem; + struct sockaddr address = {0}; + struct coap_client_request client_request = { + .method = COAP_METHOD_GET, + .confirmable = true, + .path = test_path, + .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, + .cb = coap_callback, + .payload = short_payload, + .len = strlen(short_payload), + .user_data = &sem, + }; + zassert_ok(k_sem_init(&sem, 0, 1)); + + int (*sendto_fakes[])(int, void *, size_t, int, const struct sockaddr *, socklen_t) = { + z_impl_zsock_sendto_custom_fake, + z_impl_zsock_sendto_custom_fake_err, + }; + + SET_CUSTOM_FAKE_SEQ(z_impl_zsock_sendto, sendto_fakes, ARRAY_SIZE(sendto_fakes)); + z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_empty_ack; + + k_sleep(K_MSEC(1)); + + LOG_INF("Send request"); + ret = coap_client_req(&client, 0, &address, &client_request, NULL); + zassert_true(ret >= 0, "Sending request failed, %d", ret); + + zassert_ok(k_sem_take(&sem, K_MSEC(COAP_SEPARATE_TIMEOUT))); + zassert_equal(last_response_code, -ENETDOWN, ""); +} + ZTEST(coap_client, test_multiple_requests) { int ret = 0; From 237b26c44a1be61cfb04305bbf6f92fe116ab729 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Tue, 12 Nov 2024 15:01:23 +0200 Subject: [PATCH 2394/4482] tests: coap_client: Test for operating on socket while another fails CoAP client should be able to push data through functioning socket while another sockets is failing or reporting poll() errors. Signed-off-by: Seppo Takalo --- tests/net/lib/coap_client/src/main.c | 45 ++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/tests/net/lib/coap_client/src/main.c b/tests/net/lib/coap_client/src/main.c index 7554ffcd7ab1c..69e5b7dc9bddb 100644 --- a/tests/net/lib/coap_client/src/main.c +++ b/tests/net/lib/coap_client/src/main.c @@ -395,7 +395,8 @@ extern void net_coap_init(void); static void *suite_setup(void) { net_coap_init(); - coap_client_init(&client, NULL); + zassert_ok(coap_client_init(&client, NULL)); + zassert_ok(coap_client_init(&client2, NULL)); return NULL; } @@ -891,8 +892,6 @@ ZTEST(coap_client, test_multiple_clients) zassert_ok(k_sem_init(&sem1, 0, 1)); zassert_ok(k_sem_init(&sem2, 0, 1)); - zassert_ok(coap_client_init(&client2, NULL)); - k_sleep(K_MSEC(1)); LOG_INF("Sending requests"); @@ -977,6 +976,46 @@ ZTEST(coap_client, test_poll_err_after_response) zassert_not_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); } +ZTEST(coap_client, test_poll_err_on_another_sock) +{ + int ret = 0; + struct k_sem sem1, sem2; + struct sockaddr address = {0}; + struct coap_client_request client_request = { + .method = COAP_METHOD_GET, + .confirmable = true, + .path = test_path, + .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, + .cb = coap_callback, + .payload = short_payload, + .len = strlen(short_payload), + .user_data = &sem1 + }; + struct coap_client_request request2 = client_request; + + request2.user_data = &sem2; + + zassert_ok(k_sem_init(&sem1, 0, 1)); + zassert_ok(k_sem_init(&sem2, 0, 1)); + + z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; + set_socket_events(client.fd, ZSOCK_POLLERR); + + k_sleep(K_MSEC(1)); + + ret = coap_client_req(&client2, client2.fd, &address, &request2, NULL); + zassert_true(ret >= 0, "Sending request failed, %d", ret); + ret = coap_client_req(&client, client.fd, &address, &client_request, NULL); + zassert_true(ret >= 0, "Sending request failed, %d", ret); + + set_socket_events(client2.fd, ZSOCK_POLLIN); + + zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_equal(last_response_code, -EIO, ""); + zassert_ok(k_sem_take(&sem2, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, ""); +} + ZTEST(coap_client, test_duplicate_response) { int ret = 0; From 05a6ba678efc6e4a49b70c84669d32006a98bbdc Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Tue, 12 Nov 2024 16:07:54 +0200 Subject: [PATCH 2395/4482] tests: coap_client: Add testcase for observation Add test for ongoing observation and cancellation. Signed-off-by: Seppo Takalo --- tests/net/lib/coap_client/src/main.c | 52 ++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/tests/net/lib/coap_client/src/main.c b/tests/net/lib/coap_client/src/main.c index 69e5b7dc9bddb..6c4b624798cf0 100644 --- a/tests/net/lib/coap_client/src/main.c +++ b/tests/net/lib/coap_client/src/main.c @@ -390,6 +390,18 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake_duplicate_response(int sock, vo return ret; } +static ssize_t z_impl_zsock_recvfrom_custom_fake_observe(int sock, void *buf, size_t max_len, + int flags, struct sockaddr *src_addr, + socklen_t *addrlen) +{ + int ret = z_impl_zsock_recvfrom_custom_fake_duplicate_response(sock, buf, max_len, flags, + src_addr, addrlen); + + set_next_pending_message_id(get_next_pending_message_id() + 1); + z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_observe; + return ret; +} + extern void net_coap_init(void); static void *suite_setup(void) @@ -1046,3 +1058,43 @@ ZTEST(coap_client, test_duplicate_response) zassert_equal(k_sem_take(&sem, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)), -EAGAIN, ""); } + +ZTEST(coap_client, test_observe) +{ + struct k_sem sem; + struct sockaddr address = {0}; + struct coap_client_option options = { + .code = COAP_OPTION_OBSERVE, + .value[0] = 0, + .len = 1, + }; + struct coap_client_request client_request = { + .method = COAP_METHOD_GET, + .confirmable = true, + .path = test_path, + .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, + .cb = coap_callback, + .payload = short_payload, + .len = strlen(short_payload), + .options = &options, + .num_options = 1, + .user_data = &sem, + }; + + zassert_ok(k_sem_init(&sem, 0, 1)); + z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_observe; + + k_sleep(K_MSEC(1)); + + zassert_ok(coap_client_req(&client, 0, &address, &client_request, NULL)); + + zassert_ok(k_sem_take(&sem, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_ok(k_sem_take(&sem, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_ok(k_sem_take(&sem, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + + coap_client_cancel_requests(&client); + zassert_ok(k_sem_take(&sem, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_equal(last_response_code, -ECANCELED, ""); + + zassert_not_ok(k_sem_take(&sem, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); +} From 107dc9b96dd0627805a25f5ec91407bfb86bc00c Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Tue, 12 Nov 2024 16:18:46 +0200 Subject: [PATCH 2396/4482] tests: coap_client: Add testcase for receiving RST When server responds with CoAP RESET, we should inform the client and stop the request. Signed-off-by: Seppo Takalo --- tests/net/lib/coap_client/src/main.c | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tests/net/lib/coap_client/src/main.c b/tests/net/lib/coap_client/src/main.c index 6c4b624798cf0..c44fd30fbdc70 100644 --- a/tests/net/lib/coap_client/src/main.c +++ b/tests/net/lib/coap_client/src/main.c @@ -279,6 +279,25 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake_empty_ack(int sock, void *buf, return sizeof(ack_data); } +static ssize_t z_impl_zsock_recvfrom_custom_fake_rst(int sock, void *buf, size_t max_len, int flags, + struct sockaddr *src_addr, socklen_t *addrlen) +{ + uint16_t last_message_id = 0; + + static uint8_t rst_data[] = {0x70, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + + last_message_id = get_next_pending_message_id(); + + rst_data[2] = (uint8_t)(last_message_id >> 8); + rst_data[3] = (uint8_t)last_message_id; + + memcpy(buf, rst_data, sizeof(rst_data)); + clear_socket_events(sock, ZSOCK_POLLIN); + + return sizeof(rst_data); +} + static ssize_t z_impl_zsock_recvfrom_custom_fake_only_ack(int sock, void *buf, size_t max_len, int flags, struct sockaddr *src_addr, socklen_t *addrlen) @@ -1098,3 +1117,28 @@ ZTEST(coap_client, test_observe) zassert_not_ok(k_sem_take(&sem, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); } + +ZTEST(coap_client, test_request_rst) +{ + struct k_sem sem; + struct sockaddr address = {0}; + struct coap_client_request client_request = { + .method = COAP_METHOD_GET, + .confirmable = true, + .path = test_path, + .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, + .cb = coap_callback, + .payload = short_payload, + .len = strlen(short_payload), + .user_data = &sem, + }; + + zassert_ok(k_sem_init(&sem, 0, 1)); + k_sleep(K_MSEC(1)); + z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_rst; + + zassert_ok(coap_client_req(&client, 0, &address, &client_request, NULL)); + + zassert_ok(k_sem_take(&sem, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_equal(last_response_code, -ECONNRESET, ""); +} From 41ee35ae8b52095cce830ac3381b5ffa3c4162b4 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 11 Nov 2024 14:19:49 +0200 Subject: [PATCH 2397/4482] net: lib: coap_client: Don't clear internal structures on response When response is received and handled, don't just clear the structure but instead mark it as ongoing=false. So if we later on receive a duplicate response for it, we can still respond with Ack or Rst. This is achieved by using release_internal_request() when we don't expect any response for it and reset_internal_request() when we really fill up a new request. Signed-off-by: Seppo Takalo --- subsys/net/lib/coap/coap_client.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index 82f0bbda10888..0a4ebccd7b8dc 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -61,16 +61,24 @@ static int receive(int sock, void *buf, size_t max_len, int flags, return err; } +/** Reset all fields to zero. + * Use when a new request is filled in. + */ static void reset_internal_request(struct coap_client_internal_request *request) { - request->offset = 0; - request->last_id = 0; - request->last_response_id = -1; + *request = (struct coap_client_internal_request){ + .last_response_id = -1, + }; +} + +/** Release a request structure. + * Use when a request is no longer needed, but we might still receive + * responses for it, which must be handled. + */ +static void release_internal_request(struct coap_client_internal_request *request) +{ request->request_ongoing = false; - request->is_observe = false; request->pending.timeout = 0; - request->recv_blk_ctx = (struct coap_block_context){ 0 }; - request->send_blk_ctx = (struct coap_block_context){ 0 }; } static int coap_client_schedule_poll(struct coap_client *client, int sock, @@ -417,6 +425,7 @@ int coap_client_req(struct coap_client *client, int sock, const struct sockaddr coap_pending_cycle(&internal_req->pending); internal_req->is_observe = coap_request_is_observe(&internal_req->request); + LOG_DBG("Request is_observe %d", internal_req->is_observe); } ret = send_request(sock, internal_req->request.data, internal_req->request.offset, 0, @@ -513,7 +522,7 @@ static void coap_client_resend_handler(struct coap_client *client) ret = resend_request(client, &client->requests[i]); if (ret < 0) { report_callback_error(&client->requests[i], ret); - reset_internal_request(&client->requests[i]); + release_internal_request(&client->requests[i]); } } } @@ -745,7 +754,7 @@ static int handle_response(struct coap_client *client, const struct coap_packet return 0; } report_callback_error(internal_req, -ECONNRESET); - reset_internal_request(internal_req); + release_internal_request(internal_req); return 0; } @@ -931,7 +940,7 @@ static int handle_response(struct coap_client *client, const struct coap_packet } fail: if (ret < 0 || !internal_req->is_observe) { - reset_internal_request(internal_req); + release_internal_request(internal_req); } return ret; } @@ -949,7 +958,7 @@ static void cancel_requests_with(struct coap_client *client, int error) * request was cancelled anyway. */ report_callback_error(&client->requests[i], error); - reset_internal_request(&client->requests[i]); + release_internal_request(&client->requests[i]); } } k_mutex_unlock(&client->lock); From 7b0cce4418403e046e710009c591fa21e6aaed3c Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 11 Nov 2024 14:21:29 +0200 Subject: [PATCH 2398/4482] net: lib: coap_client: Parse incoming MID only once Incomming Message-ID is already parsed, use it as a parameter to get_request_with_mid(). Signed-off-by: Seppo Takalo --- subsys/net/lib/coap/coap_client.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index 0a4ebccd7b8dc..7b16843fd0e02 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -30,9 +30,8 @@ static void cancel_requests_with(struct coap_client *client, int error); static int recv_response(struct coap_client *client, struct coap_packet *response, bool *truncated); static int handle_response(struct coap_client *client, const struct coap_packet *response, bool response_truncated); -static struct coap_client_internal_request *get_request_with_mid( - struct coap_client *client, const struct coap_packet *resp); - +static struct coap_client_internal_request *get_request_with_mid(struct coap_client *client, + uint16_t mid); static int send_request(int sock, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen) @@ -701,14 +700,12 @@ static struct coap_client_internal_request *get_request_with_token( return NULL; } -static struct coap_client_internal_request *get_request_with_mid( - struct coap_client *client, const struct coap_packet *resp) +static struct coap_client_internal_request *get_request_with_mid(struct coap_client *client, + uint16_t mid) { - uint16_t mid = coap_header_get_id(resp); - for (int i = 0; i < CONFIG_COAP_CLIENT_MAX_REQUESTS; i++) { if (client->requests[i].request_ongoing) { - if (client->requests[i].last_id == mid) { + if (client->requests[i].last_id == (int)mid) { return &client->requests[i]; } } @@ -717,7 +714,6 @@ static struct coap_client_internal_request *get_request_with_mid( return NULL; } - static bool find_echo_option(const struct coap_packet *response, struct coap_option *option) { return coap_find_options(response, COAP_OPTION_ECHO, option, 1); @@ -748,7 +744,7 @@ static int handle_response(struct coap_client *client, const struct coap_packet const uint8_t *payload = coap_packet_get_payload(response, &payload_len); if (response_type == COAP_TYPE_RESET) { - internal_req = get_request_with_mid(client, response); + internal_req = get_request_with_mid(client, response_id); if (!internal_req) { LOG_WRN("No matching request for RESET"); return 0; @@ -761,7 +757,7 @@ static int handle_response(struct coap_client *client, const struct coap_packet /* Separate response coming */ if (payload_len == 0 && response_type == COAP_TYPE_ACK && response_code == COAP_CODE_EMPTY) { - internal_req = get_request_with_mid(client, response); + internal_req = get_request_with_mid(client, response_id); if (!internal_req) { LOG_WRN("No matching request for ACK"); return 0; From 934c74f26e8f2d25bfb7b4ac517db251b2197780 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 11 Nov 2024 17:14:50 +0200 Subject: [PATCH 2399/4482] net: lib: coap_client: Don't match zero length tokens If our internal structure is cleared, don't match tokens. Signed-off-by: Seppo Takalo --- subsys/net/lib/coap/coap_client.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index 7b16843fd0e02..038961ca571ce 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -687,6 +687,9 @@ static struct coap_client_internal_request *get_request_with_token( for (int i = 0; i < CONFIG_COAP_CLIENT_MAX_REQUESTS; i++) { if (client->requests[i].request_ongoing || !exchange_lifetime_exceeded(&client->requests[i])) { + if (client->requests[i].request_tkl == 0) { + continue; + } if (client->requests[i].request_tkl != response_tkl) { continue; } From a1368a7ff707af009575dac8799799b2319cad50 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 11 Nov 2024 14:25:04 +0200 Subject: [PATCH 2400/4482] net: lib: coap_client: Drop duplicate responses When response is already handled, don't forward anymore responses to the client application. Signed-off-by: Seppo Takalo --- subsys/net/lib/coap/coap_client.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index 038961ca571ce..ae1c359fdd0fc 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -844,6 +844,15 @@ static int handle_response(struct coap_client *client, const struct coap_packet } } + if (!internal_req->request_ongoing) { + if (internal_req->is_observe) { + (void) send_rst(client, response); + return 0; + } + LOG_DBG("Drop request, already handled"); + goto fail; + } + if (internal_req->pending.timeout != 0) { coap_pending_clear(&internal_req->pending); } From 48434a3c1b16c44a410b07a50905681af506ea76 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 11 Nov 2024 16:44:41 +0200 Subject: [PATCH 2401/4482] net: lib: coap_client: Return -errno from send_request() Return the -errno when zsock_sendto() or zsock_recvfrom() fails, so rest of the code can deal with return values, instead of separately comparing errno and return value. Signed-off-by: Seppo Takalo --- subsys/net/lib/coap/coap_client.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index ae1c359fdd0fc..77017c65f3cab 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -36,12 +36,16 @@ static struct coap_client_internal_request *get_request_with_mid(struct coap_cli static int send_request(int sock, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen) { + int ret; + LOG_HEXDUMP_DBG(buf, len, "Send CoAP Request:"); if (addrlen == 0) { - return zsock_sendto(sock, buf, len, flags, NULL, 0); + ret = zsock_sendto(sock, buf, len, flags, NULL, 0); } else { - return zsock_sendto(sock, buf, len, flags, dest_addr, addrlen); + ret = zsock_sendto(sock, buf, len, flags, dest_addr, addrlen); } + + return ret >= 0 ? ret : -errno; } static int receive(int sock, void *buf, size_t max_len, int flags, @@ -57,7 +61,7 @@ static int receive(int sock, void *buf, size_t max_len, int flags, if (err > 0) { LOG_HEXDUMP_DBG(buf, err, "Receive CoAP Response:"); } - return err; + return err >= 0 ? err : -errno; } /** Reset all fields to zero. @@ -493,13 +497,12 @@ static int resend_request(struct coap_client *client, client->socklen); if (ret > 0) { ret = 0; - } else if (ret == -1 && errno == EAGAIN) { + } else if (ret == -EAGAIN) { /* Restore the pending structure, retry later */ internal_req->pending = tmp; /* Not a fatal socket error, will trigger a retry */ ret = 0; } else { - ret = -errno; LOG_ERR("Failed to resend request, %d", ret); } } else { From c0eb260c2c53b183aa4ce4a5d1d3ad20516a0b08 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 11 Nov 2024 16:46:33 +0200 Subject: [PATCH 2402/4482] net: lib: coap_client: Drop duplicate MID only after responding with Ack Even if we receive duplicate confirmable message, we should still respond with the Ack. Just don't deliver the second callback. This is achieved by moving the MID deduplication to after Ack handling. Signed-off-by: Seppo Takalo --- subsys/net/lib/coap/coap_client.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index 77017c65f3cab..81a93cde770fd 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -781,14 +781,6 @@ static int handle_response(struct coap_client *client, const struct coap_packet return 0; } - /* MID-based deduplication */ - if (response_id == internal_req->last_response_id) { - LOG_WRN("Duplicate MID, dropping"); - goto fail; - } - - internal_req->last_response_id = response_id; - /* Received echo option */ if (find_echo_option(response, &client->echo_option)) { /* Resend request with echo option */ @@ -847,13 +839,21 @@ static int handle_response(struct coap_client *client, const struct coap_packet } } + /* MID-based deduplication */ + if (response_id == internal_req->last_response_id) { + LOG_WRN("Duplicate MID, dropping"); + return 0; + } + + internal_req->last_response_id = response_id; + if (!internal_req->request_ongoing) { if (internal_req->is_observe) { (void) send_rst(client, response); return 0; } LOG_DBG("Drop request, already handled"); - goto fail; + return 0; } if (internal_req->pending.timeout != 0) { From f72d634826f5c45ee7ed54b4658c3391ae83fe54 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 11 Nov 2024 16:48:42 +0200 Subject: [PATCH 2403/4482] net: lib: coap_client: All error cases should be reported to callback When the client fails when parsing the response and we stop proceeding, we should report that to the application. Signed-off-by: Seppo Takalo --- subsys/net/lib/coap/coap_client.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index 81a93cde770fd..59c8e1384560b 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -950,7 +950,10 @@ static int handle_response(struct coap_client *client, const struct coap_packet } } fail: - if (ret < 0 || !internal_req->is_observe) { + if (ret < 0) { + report_callback_error(internal_req, ret); + } + if (!internal_req->is_observe) { release_internal_request(internal_req); } return ret; From f0c6efe7980002eb72e5ad009a8b822d2a43846d Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Tue, 12 Nov 2024 15:00:05 +0200 Subject: [PATCH 2404/4482] net: lib: coap_client: Stop polling on unneeded sockets poll() only for sockets that have traffic ongoing or have some lifetime left. On socket failures during a poll(), stop listening for the socket. Application can recover by reconnecting the socket. Signed-off-by: Seppo Takalo --- subsys/net/lib/coap/coap_client.c | 56 ++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index 59c8e1384560b..4c4e13d8f0cb8 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -532,6 +532,17 @@ static void coap_client_resend_handler(struct coap_client *client) k_mutex_unlock(&client->lock); } +static struct coap_client *get_client(int sock) +{ + for (int i = 0; i < num_clients; i++) { + if (clients[i]->fd == sock) { + return clients[i]; + } + } + + return NULL; +} + static int handle_poll(void) { int ret = 0; @@ -541,10 +552,16 @@ static int handle_poll(void) /* Use periodic timeouts */ for (int i = 0; i < num_clients; i++) { - fds[i].fd = clients[i]->fd; - fds[i].events = (has_ongoing_exchange(clients[i]) ? ZSOCK_POLLIN : 0) | - (has_timeout_expired(clients[i]) ? ZSOCK_POLLOUT : 0); - fds[i].revents = 0; + short events = (has_ongoing_exchange(clients[i]) ? ZSOCK_POLLIN : 0) | + (has_timeout_expired(clients[i]) ? ZSOCK_POLLOUT : 0); + + if (events == 0) { + /* Skip this socket */ + continue; + } + fds[nfds].fd = clients[i]->fd; + fds[nfds].events = events; + fds[nfds].revents = 0; nfds++; } @@ -559,42 +576,49 @@ static int handle_poll(void) } for (int i = 0; i < nfds; i++) { + struct coap_client *client = get_client(fds[i].fd); + + if (!client) { + LOG_ERR("No client found for socket %d", fds[i].fd); + continue; + } + if (fds[i].revents & ZSOCK_POLLOUT) { - coap_client_resend_handler(clients[i]); + coap_client_resend_handler(client); } if (fds[i].revents & ZSOCK_POLLIN) { struct coap_packet response; bool response_truncated = false; - ret = recv_response(clients[i], &response, &response_truncated); + ret = recv_response(client, &response, &response_truncated); if (ret < 0) { if (ret == -EAGAIN) { continue; } LOG_ERR("Error receiving response"); - cancel_requests_with(clients[i], -EIO); + cancel_requests_with(client, -EIO); continue; } - k_mutex_lock(&clients[i]->lock, K_FOREVER); - ret = handle_response(clients[i], &response, response_truncated); + k_mutex_lock(&client->lock, K_FOREVER); + ret = handle_response(client, &response, response_truncated); if (ret < 0) { LOG_ERR("Error handling response"); } - k_mutex_unlock(&clients[i]->lock); + k_mutex_unlock(&client->lock); } if (fds[i].revents & ZSOCK_POLLERR) { LOG_ERR("Error in poll for socket %d", fds[i].fd); - cancel_requests_with(clients[i], -EIO); + cancel_requests_with(client, -EIO); } if (fds[i].revents & ZSOCK_POLLHUP) { LOG_ERR("Error in poll: POLLHUP for socket %d", fds[i].fd); - cancel_requests_with(clients[i], -EIO); + cancel_requests_with(client, -EIO); } if (fds[i].revents & ZSOCK_POLLNVAL) { LOG_ERR("Error in poll: POLLNVAL - fd %d not open", fds[i].fd); - cancel_requests_with(clients[i], -EIO); + cancel_requests_with(client, -EIO); } } @@ -974,6 +998,12 @@ static void cancel_requests_with(struct coap_client *client, int error) report_callback_error(&client->requests[i], error); release_internal_request(&client->requests[i]); } + /* If our socket has failed, clear all requests, even completed ones, + * so that our handle_poll() does not poll() anymore for this socket. + */ + if (error == -EIO) { + reset_internal_request(&client->requests[i]); + } } k_mutex_unlock(&client->lock); From b3f3bce23eaa854f0eb03e2c92e1c342b9a4ef4a Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Wed, 13 Nov 2024 13:24:28 +0200 Subject: [PATCH 2405/4482] net: lib: coap_client: Add API to cancel specific request Add a new API to cancel just one, or mathing requests, instead of cancelling all ongoing requests. Signed-off-by: Seppo Takalo --- include/zephyr/net/coap_client.h | 15 ++++ subsys/net/lib/coap/coap_client.c | 35 +++++++++ tests/net/lib/coap_client/src/main.c | 108 +++++++++++++++++++++++++++ 3 files changed, 158 insertions(+) diff --git a/include/zephyr/net/coap_client.h b/include/zephyr/net/coap_client.h index 1d68661da3b08..bbeebb2d26c46 100644 --- a/include/zephyr/net/coap_client.h +++ b/include/zephyr/net/coap_client.h @@ -158,6 +158,21 @@ int coap_client_req(struct coap_client *client, int sock, const struct sockaddr */ void coap_client_cancel_requests(struct coap_client *client); +/** + * @brief Cancel matching requests. + * + * This function cancels all CoAP client request that matches the given request. + * The request is matched based on the method, path, callback and user_data, if provided. + * Any field set to NULL is considered a wildcard. + * + * (struct coap_client_request){0} cancels all requests. + * (struct coap_client_request){.method = COAP_METHOD_GET} cancels all GET requests. + * + * @param client Pointer to the CoAP client instance. + * @param req Pointer to the CoAP client request to be canceled. + */ +void coap_client_cancel_request(struct coap_client *client, struct coap_client_request *req); + /** * @brief Initialise a Block2 option to be added to a request * diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index 4c4e13d8f0cb8..bda131121757e 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -1016,6 +1016,41 @@ void coap_client_cancel_requests(struct coap_client *client) k_sleep(K_MSEC(COAP_PERIODIC_TIMEOUT)); } +static bool requests_match(struct coap_client_request *a, struct coap_client_request *b) +{ + /* enum coap_method does not have value for zero, so differentiate valid values */ + if (a->method && b->method && a->method != b->method) { + return false; + } + if (a->path && b->path && strcmp(a->path, b->path) != 0) { + return false; + } + if (a->cb && b->cb && a->cb != b->cb) { + return false; + } + if (a->user_data && b->user_data && a->user_data != b->user_data) { + return false; + } + /* It is intentional that (struct coap_client_request){0} matches all */ + return true; +} + +void coap_client_cancel_request(struct coap_client *client, struct coap_client_request *req) +{ + k_mutex_lock(&client->lock, K_FOREVER); + + for (int i = 0; i < CONFIG_COAP_CLIENT_MAX_REQUESTS; i++) { + if (client->requests[i].request_ongoing && + requests_match(&client->requests[i].coap_request, req)) { + LOG_DBG("Cancelling request %d", i); + report_callback_error(&client->requests[i], -ECANCELED); + release_internal_request(&client->requests[i]); + } + } + + k_mutex_unlock(&client->lock); +} + void coap_client_recv(void *coap_cl, void *a, void *b) { int ret; diff --git a/tests/net/lib/coap_client/src/main.c b/tests/net/lib/coap_client/src/main.c index c44fd30fbdc70..2f3fa28ebff0c 100644 --- a/tests/net/lib/coap_client/src/main.c +++ b/tests/net/lib/coap_client/src/main.c @@ -1142,3 +1142,111 @@ ZTEST(coap_client, test_request_rst) zassert_ok(k_sem_take(&sem, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); zassert_equal(last_response_code, -ECONNRESET, ""); } + +ZTEST(coap_client, test_cancel) +{ + struct k_sem sem1, sem2; + struct sockaddr address = {0}; + struct coap_client_request req1 = { + .method = COAP_METHOD_GET, + .confirmable = true, + .path = test_path, + .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, + .cb = coap_callback, + .payload = short_payload, + .len = strlen(short_payload), + .user_data = &sem1 + }; + struct coap_client_request req2 = req1; + + req2.user_data = &sem2; + + k_sem_init(&sem1, 0, 1); + k_sem_init(&sem2, 0, 1); + + z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; + + k_sleep(K_MSEC(1)); + + zassert_ok(coap_client_req(&client, 0, &address, &req1, NULL)); + zassert_ok(coap_client_req(&client, 0, &address, &req2, NULL)); + + k_sleep(K_SECONDS(1)); + + coap_client_cancel_request(&client, &req1); + zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_not_ok(k_sem_take(&sem2, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_equal(last_response_code, -ECANCELED, ""); + + set_socket_events(client.fd, ZSOCK_POLLIN); /* First response is the cancelled one */ + zassert_not_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + set_socket_events(client.fd, ZSOCK_POLLIN); + zassert_ok(k_sem_take(&sem2, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, ""); +} + +ZTEST(coap_client, test_cancel_match) +{ + struct k_sem sem1, sem2; + struct sockaddr address = {0}; + struct coap_client_request req1 = { + .method = COAP_METHOD_GET, + .confirmable = true, + .path = test_path, + .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, + .cb = coap_callback, + .payload = short_payload, + .len = strlen(short_payload), + .user_data = &sem1 + }; + struct coap_client_request req2 = req1; + + req2.user_data = &sem2; + req2.path = "another"; + + k_sem_init(&sem1, 0, 1); + k_sem_init(&sem2, 0, 1); + + z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; + + k_sleep(K_MSEC(1)); + + zassert_ok(coap_client_req(&client, 0, &address, &req1, NULL)); + zassert_ok(coap_client_req(&client, 0, &address, &req2, NULL)); + + k_sleep(K_SECONDS(1)); + + /* match only one */ + coap_client_cancel_request(&client, &(struct coap_client_request) { + .path = test_path + }); + zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_not_ok(k_sem_take(&sem2, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_equal(last_response_code, -ECANCELED, ""); + + zassert_ok(coap_client_req(&client, 0, &address, &req1, NULL)); + + /* should not match */ + coap_client_cancel_request(&client, &(struct coap_client_request) { + .path = test_path, + .user_data = &sem2, + }); + zassert_not_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_not_ok(k_sem_take(&sem2, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + + /* match both (all GET queries) */ + coap_client_cancel_request(&client, &(struct coap_client_request) { + .method = COAP_METHOD_GET, + }); + zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_ok(k_sem_take(&sem2, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + + zassert_ok(coap_client_req(&client, 0, &address, &req1, NULL)); + zassert_ok(coap_client_req(&client, 0, &address, &req2, NULL)); + + /* match both (wildcard)*/ + coap_client_cancel_request(&client, &(struct coap_client_request) {0}); + zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_ok(k_sem_take(&sem2, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + +} From bb7319e7f21e77751d18595d947522876b963788 Mon Sep 17 00:00:00 2001 From: Tarang Raval Date: Tue, 12 Nov 2024 11:06:12 +0530 Subject: [PATCH 2406/4482] drivers: sensor: ina219: remove redundant error check The function ina219_set_msr_delay always returns zero, indicating success. Therefore, the error check on its return value is unnecessary and can be removed. Signed-off-by: Tarang Raval --- drivers/sensor/ti/ina219/ina219.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/sensor/ti/ina219/ina219.c b/drivers/sensor/ti/ina219/ina219.c index cebe0dc812a33..2560d879b8cf1 100644 --- a/drivers/sensor/ti/ina219/ina219.c +++ b/drivers/sensor/ti/ina219/ina219.c @@ -269,11 +269,7 @@ static int ina219_init(const struct device *dev) } /* Set measurement delay */ - rc = ina219_set_msr_delay(dev); - if (rc) { - LOG_ERR("Could not get measurement delay."); - return rc; - } + ina219_set_msr_delay(dev); k_sleep(K_USEC(INA219_WAIT_STARTUP)); From 9c3482b1d5acbf3618627e29a383050760d43845 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Tue, 12 Nov 2024 13:15:24 +0800 Subject: [PATCH 2407/4482] arch: riscv: smp: allow other IPI implementation The currently IPI implementation assumes that CLINT exists in the system, however, that might not be the case as IPI can be implemented with PLIC that supports software-triggering as well, such as the Andes NCEPLIC100. Refactor the CLINT-based IPI implementations into `ipi_clint.c`, and create Kconfig that selects the CLINT implementation when `sifive-clint0` exists and enabled, otherwise default to `RISCV_SMP_IPI_CUSTOM` which allows OOT implementation. This also makes way for the upstreaming of non-clint IPI implementation later. Signed-off-by: Yong Cong Sin --- arch/riscv/Kconfig | 25 +++++++++ arch/riscv/core/CMakeLists.txt | 6 +++ arch/riscv/core/ipi.c | 14 +++++ arch/riscv/core/ipi_clint.c | 97 ++++++++++++++++++++++++++++++++++ arch/riscv/core/smp.c | 97 ---------------------------------- 5 files changed, 142 insertions(+), 97 deletions(-) create mode 100644 arch/riscv/core/ipi.c create mode 100644 arch/riscv/core/ipi_clint.c diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 575c9871c1304..a783247282199 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -37,6 +37,31 @@ config RISCV_ALWAYS_SWITCH_THROUGH_ECALL and most people should say n here to minimize context switching overhead. +choice RISCV_SMP_IPI_IMPL + prompt "RISC-V SMP IPI implementation" + depends on SMP + default RISCV_SMP_IPI_CLINT if DT_HAS_SIFIVE_CLINT0_ENABLED + default RISCV_SMP_IPI_CUSTOM + +config RISCV_SMP_IPI_CLINT + bool "CLINT-based IPI" + depends on DT_HAS_SIFIVE_CLINT0_ENABLED + help + Use CLINT-based IPI implementation. + +config RISCV_SMP_IPI_CUSTOM + bool "Custom IPI implementation" + help + Allow custom IPI implementation. + + When this is selected, the following functions must be provided: + - arch_sched_directed_ipi() + - arch_flush_fpu_ipi() if CONFIG_FPU_SHARING + - arch_spin_relax() if CONFIG_FPU_SHARING + - arch_smp_init() + +endchoice # RISCV_SMP_IPI_IMPL + menu "RISCV Processor Options" config INCLUDE_RESET_VECTOR diff --git a/arch/riscv/core/CMakeLists.txt b/arch/riscv/core/CMakeLists.txt index a15e1ba7f9fc1..52a748c3247f0 100644 --- a/arch/riscv/core/CMakeLists.txt +++ b/arch/riscv/core/CMakeLists.txt @@ -17,6 +17,12 @@ if ((CONFIG_MP_MAX_NUM_CPUS GREATER 1) OR (CONFIG_SMP)) zephyr_library_sources(smp.c) endif () +if (CONFIG_SMP) + zephyr_library_sources(ipi.c) + + zephyr_library_sources_ifdef(CONFIG_RISCV_SMP_IPI_CLINT ipi_clint.c) +endif() + zephyr_library_sources_ifdef(CONFIG_FPU_SHARING fpu.c fpu.S) zephyr_library_sources_ifdef(CONFIG_DEBUG_COREDUMP coredump.c) zephyr_library_sources_ifdef(CONFIG_IRQ_OFFLOAD irq_offload.c) diff --git a/arch/riscv/core/ipi.c b/arch/riscv/core/ipi.c new file mode 100644 index 0000000000000..c2683b617018b --- /dev/null +++ b/arch/riscv/core/ipi.c @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2021 Intel Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include + +void arch_sched_broadcast_ipi(void) +{ + arch_sched_directed_ipi(IPI_ALL_CPUS_MASK); +} diff --git a/arch/riscv/core/ipi_clint.c b/arch/riscv/core/ipi_clint.c new file mode 100644 index 0000000000000..ee9c6f2d554f7 --- /dev/null +++ b/arch/riscv/core/ipi_clint.c @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2021 Intel Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include + +#define MSIP_BASE 0x2000000UL +#define MSIP(hartid) ((volatile uint32_t *)MSIP_BASE)[hartid] + +static atomic_val_t cpu_pending_ipi[CONFIG_MP_MAX_NUM_CPUS]; +#define IPI_SCHED 0 +#define IPI_FPU_FLUSH 1 + +void arch_sched_directed_ipi(uint32_t cpu_bitmap) +{ + unsigned int key = arch_irq_lock(); + unsigned int id = _current_cpu->id; + unsigned int num_cpus = arch_num_cpus(); + + for (unsigned int i = 0; i < num_cpus; i++) { + if ((i != id) && _kernel.cpus[i].arch.online && ((cpu_bitmap & BIT(i)) != 0)) { + atomic_set_bit(&cpu_pending_ipi[i], IPI_SCHED); + MSIP(_kernel.cpus[i].arch.hartid) = 1; + } + } + + arch_irq_unlock(key); +} + +#ifdef CONFIG_FPU_SHARING +void arch_flush_fpu_ipi(unsigned int cpu) +{ + atomic_set_bit(&cpu_pending_ipi[cpu], IPI_FPU_FLUSH); + MSIP(_kernel.cpus[cpu].arch.hartid) = 1; +} +#endif /* CONFIG_FPU_SHARING */ + +static void sched_ipi_handler(const void *unused) +{ + ARG_UNUSED(unused); + + MSIP(csr_read(mhartid)) = 0; + + atomic_val_t pending_ipi = atomic_clear(&cpu_pending_ipi[_current_cpu->id]); + + if (pending_ipi & ATOMIC_MASK(IPI_SCHED)) { + z_sched_ipi(); + } +#ifdef CONFIG_FPU_SHARING + if (pending_ipi & ATOMIC_MASK(IPI_FPU_FLUSH)) { + /* disable IRQs */ + csr_clear(mstatus, MSTATUS_IEN); + /* perform the flush */ + arch_flush_local_fpu(); + /* + * No need to re-enable IRQs here as long as + * this remains the last case. + */ + } +#endif /* CONFIG_FPU_SHARING */ +} + +#ifdef CONFIG_FPU_SHARING +/* + * Make sure there is no pending FPU flush request for this CPU while + * waiting for a contended spinlock to become available. This prevents + * a deadlock when the lock we need is already taken by another CPU + * that also wants its FPU content to be reinstated while such content + * is still live in this CPU's FPU. + */ +void arch_spin_relax(void) +{ + atomic_val_t *pending_ipi = &cpu_pending_ipi[_current_cpu->id]; + + if (atomic_test_and_clear_bit(pending_ipi, IPI_FPU_FLUSH)) { + /* + * We may not be in IRQ context here hence cannot use + * arch_flush_local_fpu() directly. + */ + arch_float_disable(_current_cpu->arch.fpu_owner); + } +} +#endif /* CONFIG_FPU_SHARING */ + +int arch_smp_init(void) +{ + + IRQ_CONNECT(RISCV_IRQ_MSOFT, 0, sched_ipi_handler, NULL, 0); + irq_enable(RISCV_IRQ_MSOFT); + + return 0; +} diff --git a/arch/riscv/core/smp.c b/arch/riscv/core/smp.c index 15cb006395019..3e8b3df21937e 100644 --- a/arch/riscv/core/smp.c +++ b/arch/riscv/core/smp.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -81,99 +80,3 @@ void arch_secondary_cpu_init(int hartid) #endif /* CONFIG_PLIC_IRQ_AFFINITY */ riscv_cpu_init[cpu_num].fn(riscv_cpu_init[cpu_num].arg); } - -#ifdef CONFIG_SMP - -#define MSIP_BASE 0x2000000UL -#define MSIP(hartid) ((volatile uint32_t *)MSIP_BASE)[hartid] - -static atomic_val_t cpu_pending_ipi[CONFIG_MP_MAX_NUM_CPUS]; -#define IPI_SCHED 0 -#define IPI_FPU_FLUSH 1 - -void arch_sched_directed_ipi(uint32_t cpu_bitmap) -{ - unsigned int key = arch_irq_lock(); - unsigned int id = _current_cpu->id; - unsigned int num_cpus = arch_num_cpus(); - - for (unsigned int i = 0; i < num_cpus; i++) { - if ((i != id) && _kernel.cpus[i].arch.online && - ((cpu_bitmap & BIT(i)) != 0)) { - atomic_set_bit(&cpu_pending_ipi[i], IPI_SCHED); - MSIP(_kernel.cpus[i].arch.hartid) = 1; - } - } - - arch_irq_unlock(key); -} - -void arch_sched_broadcast_ipi(void) -{ - arch_sched_directed_ipi(IPI_ALL_CPUS_MASK); -} - -#ifdef CONFIG_FPU_SHARING -void arch_flush_fpu_ipi(unsigned int cpu) -{ - atomic_set_bit(&cpu_pending_ipi[cpu], IPI_FPU_FLUSH); - MSIP(_kernel.cpus[cpu].arch.hartid) = 1; -} -#endif - -static void sched_ipi_handler(const void *unused) -{ - ARG_UNUSED(unused); - - MSIP(csr_read(mhartid)) = 0; - - atomic_val_t pending_ipi = atomic_clear(&cpu_pending_ipi[_current_cpu->id]); - - if (pending_ipi & ATOMIC_MASK(IPI_SCHED)) { - z_sched_ipi(); - } -#ifdef CONFIG_FPU_SHARING - if (pending_ipi & ATOMIC_MASK(IPI_FPU_FLUSH)) { - /* disable IRQs */ - csr_clear(mstatus, MSTATUS_IEN); - /* perform the flush */ - arch_flush_local_fpu(); - /* - * No need to re-enable IRQs here as long as - * this remains the last case. - */ - } -#endif -} - -#ifdef CONFIG_FPU_SHARING -/* - * Make sure there is no pending FPU flush request for this CPU while - * waiting for a contended spinlock to become available. This prevents - * a deadlock when the lock we need is already taken by another CPU - * that also wants its FPU content to be reinstated while such content - * is still live in this CPU's FPU. - */ -void arch_spin_relax(void) -{ - atomic_val_t *pending_ipi = &cpu_pending_ipi[_current_cpu->id]; - - if (atomic_test_and_clear_bit(pending_ipi, IPI_FPU_FLUSH)) { - /* - * We may not be in IRQ context here hence cannot use - * arch_flush_local_fpu() directly. - */ - arch_float_disable(_current_cpu->arch.fpu_owner); - } -} -#endif - -int arch_smp_init(void) -{ - - IRQ_CONNECT(RISCV_IRQ_MSOFT, 0, sched_ipi_handler, NULL, 0); - irq_enable(RISCV_IRQ_MSOFT); - - return 0; -} -#endif /* CONFIG_SMP */ From 8345775de002c5a03488698595af33634a8c430a Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Tue, 12 Nov 2024 10:40:03 +1000 Subject: [PATCH 2408/4482] fuel_gauge: sbs_gauge: fix negative currents Fix negative currents being read as extremely high currents due to unsigned variable use. Signed-off-by: Jordan Yates --- drivers/fuel_gauge/sbs_gauge/sbs_gauge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/fuel_gauge/sbs_gauge/sbs_gauge.c b/drivers/fuel_gauge/sbs_gauge/sbs_gauge.c index 79537d2f50978..16877030f29e6 100644 --- a/drivers/fuel_gauge/sbs_gauge/sbs_gauge.c +++ b/drivers/fuel_gauge/sbs_gauge/sbs_gauge.c @@ -83,7 +83,7 @@ static int sbs_gauge_get_prop(const struct device *dev, fuel_gauge_prop_t prop, break; case FUEL_GAUGE_CURRENT: rc = sbs_cmd_reg_read(dev, SBS_GAUGE_CMD_CURRENT, &tmp_val); - val->current = tmp_val * 1000; + val->current = (int16_t)tmp_val * 1000; break; case FUEL_GAUGE_FULL_CHARGE_CAPACITY: rc = sbs_cmd_reg_read(dev, SBS_GAUGE_CMD_FULL_CAPACITY, &tmp_val); From 8b69b79279e0dcfad208ff5d922973c3f8c6d01f Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Tue, 12 Nov 2024 11:00:42 +1000 Subject: [PATCH 2409/4482] tests: fuel_gauge: test negative current Validate that the SBS fuel gauge driver returns the expected values for negative currents (discharging). Signed-off-by: Jordan Yates --- .../fuel_gauge/sbs_gauge/src/test_sbs_gauge.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/drivers/fuel_gauge/sbs_gauge/src/test_sbs_gauge.c b/tests/drivers/fuel_gauge/sbs_gauge/src/test_sbs_gauge.c index 6b302c42f63f9..577f32ba5ffb9 100644 --- a/tests/drivers/fuel_gauge/sbs_gauge/src/test_sbs_gauge.c +++ b/tests/drivers/fuel_gauge/sbs_gauge/src/test_sbs_gauge.c @@ -206,7 +206,24 @@ ZTEST_USER_F(sbs_gauge_new_api, test_get_buffer_props__returns_ok) ZTEST_USER_F(sbs_gauge_new_api, test_charging_5v_3a) { uint32_t expected_uV = 5000 * 1000; - uint32_t expected_uA = 3000 * 1000; + int32_t expected_uA = 3000 * 1000; + + union fuel_gauge_prop_val voltage; + union fuel_gauge_prop_val current; + + zassume_ok(emul_fuel_gauge_set_battery_charging(fixture->sbs_fuel_gauge, expected_uV, + expected_uA)); + zassert_ok(fuel_gauge_get_prop(fixture->dev, FUEL_GAUGE_VOLTAGE, &voltage)); + zassert_ok(fuel_gauge_get_prop(fixture->dev, FUEL_GAUGE_CURRENT, ¤t)); + + zassert_equal(voltage.voltage, expected_uV, "Got %d instead of %d", voltage, expected_uV); + zassert_equal(current.current, expected_uA, "Got %d instead of %d", current, expected_uA); +} + +ZTEST_USER_F(sbs_gauge_new_api, test_charging_5v_neg_1a) +{ + uint32_t expected_uV = 5000 * 1000; + int32_t expected_uA = -1000 * 1000; union fuel_gauge_prop_val voltage; union fuel_gauge_prop_val current; From 2bdffc68181fb03c6d2ecbd7b4052c603b5c2a20 Mon Sep 17 00:00:00 2001 From: Martin Stumpf Date: Wed, 16 Oct 2024 16:42:15 +0200 Subject: [PATCH 2410/4482] display: add `frame_incomplete` to `display_buffer_descriptor` Introduces support for double-buffered/latched displays. Currently, every write has to be presented to the user immediately, which negates the advantage of latched displays to prevent frame tearing. Now, GUI managers can indicate whether the current `display_write` call is the last call of the frame or not, allowing displays to group writes to a single present. Signed-off-by: Martin Stumpf --- doc/releases/release-notes-4.1.rst | 4 ++++ include/zephyr/drivers/display.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/doc/releases/release-notes-4.1.rst b/doc/releases/release-notes-4.1.rst index 202fdb20489ba..f0db5e8cbd9d4 100644 --- a/doc/releases/release-notes-4.1.rst +++ b/doc/releases/release-notes-4.1.rst @@ -92,6 +92,10 @@ Drivers and Sensors * Display + * Added flag ``frame_incomplete`` to ``display_write`` that indicates whether a write is the last + write of the frame, allowing display drivers to implement double buffering / tearing enable + signal handling (:github:`81250`) + * Ethernet * Flash diff --git a/include/zephyr/drivers/display.h b/include/zephyr/drivers/display.h index 067d441d4551b..8fd26978beab4 100644 --- a/include/zephyr/drivers/display.h +++ b/include/zephyr/drivers/display.h @@ -127,6 +127,8 @@ struct display_buffer_descriptor { uint16_t height; /** Number of pixels between consecutive rows in the data buffer */ uint16_t pitch; + /** Indicates that this is not the last write buffer of the frame */ + bool frame_incomplete; }; /** From 05bb8d9504cde83944d558eec833c952d8c84de2 Mon Sep 17 00:00:00 2001 From: Martin Stumpf Date: Thu, 17 Oct 2024 10:25:17 +0200 Subject: [PATCH 2411/4482] lvgl: add `frame_incomplete` information to `display_write` In frames with multiple writes (officially supported through `CONFIG_LV_Z_VDB_SIZE`) the display needs to be signalled that the current frame is over and the content should be displayed. This allows displays to present the UI without tearing artifacts. Signed-off-by: Martin Stumpf --- doc/releases/release-notes-4.1.rst | 3 +++ modules/lvgl/lvgl_display.c | 2 ++ modules/lvgl/lvgl_display_mono.c | 13 ++++++++----- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/doc/releases/release-notes-4.1.rst b/doc/releases/release-notes-4.1.rst index f0db5e8cbd9d4..cd207e67a7ed2 100644 --- a/doc/releases/release-notes-4.1.rst +++ b/doc/releases/release-notes-4.1.rst @@ -282,6 +282,9 @@ Trusted Firmware-M LVGL **** +* Added ``frame_incomplete`` support to indicate whether a write is the last + write of the frame (:github:`81250`) + Tests and Samples ***************** diff --git a/modules/lvgl/lvgl_display.c b/modules/lvgl/lvgl_display.c index 604cd0078d806..39f3da1f795df 100644 --- a/modules/lvgl/lvgl_display.c +++ b/modules/lvgl/lvgl_display.c @@ -25,6 +25,7 @@ void lvgl_flush_thread_entry(void *arg1, void *arg2, void *arg3) k_msgq_get(&flush_queue, &flush, K_FOREVER); data = (struct lvgl_disp_data *)flush.disp_drv->user_data; + flush.desc.frame_incomplete = !lv_disp_flush_is_last(flush.disp_drv); display_write(data->display_dev, flush.x, flush.y, &flush.desc, flush.buf); @@ -132,6 +133,7 @@ void lvgl_flush_display(struct lvgl_display_flush *request) struct lvgl_disp_data *data = (struct lvgl_disp_data *)request->disp_drv->user_data; + request->desc.frame_incomplete = !lv_disp_flush_is_last(request->disp_drv); display_write(data->display_dev, request->x, request->y, &request->desc, request->buf); lv_disp_flush_ready(request->disp_drv); diff --git a/modules/lvgl/lvgl_display_mono.c b/modules/lvgl/lvgl_display_mono.c index 07f84b7d19efc..b6b7669962733 100644 --- a/modules/lvgl/lvgl_display_mono.c +++ b/modules/lvgl/lvgl_display_mono.c @@ -14,7 +14,6 @@ void lvgl_flush_cb_mono(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color uint16_t h = area->y2 - area->y1 + 1; struct lvgl_disp_data *data = (struct lvgl_disp_data *)disp_drv->user_data; const struct device *display_dev = data->display_dev; - struct display_buffer_descriptor desc; const bool is_epd = data->cap.screen_info & SCREEN_INFO_EPD; const bool is_last = lv_disp_flush_is_last(disp_drv); @@ -29,10 +28,14 @@ void lvgl_flush_cb_mono(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color data->blanking_on = true; } - desc.buf_size = (w * h) / 8U; - desc.width = w; - desc.pitch = w; - desc.height = h; + struct display_buffer_descriptor desc = { + .buf_size = (w * h) / 8U, + .width = w, + .pitch = w, + .height = h, + .frame_incomplete = !is_last, + }; + display_write(display_dev, area->x1, area->y1, &desc, (void *)color_p); if (data->cap.screen_info & SCREEN_INFO_DOUBLE_BUFFER) { display_write(display_dev, area->x1, area->y1, &desc, (void *)color_p); From 2e0687cfd2c6c21a70dbc88db46b790648d0e542 Mon Sep 17 00:00:00 2001 From: Martin Stumpf Date: Tue, 29 Oct 2024 21:05:28 +0100 Subject: [PATCH 2412/4482] generic: add `frame_incomplete` where missing The newly introduced `frame_incomplete` flag of `display_buffer_descriptor` needed to be added at several places to avoid uninitialized memory. Signed-off-by: Martin Stumpf --- drivers/display/display_gc9x01x.c | 1 + drivers/display/display_ili9xxx.c | 1 + samples/drivers/display/src/main.c | 15 +++++++++++++++ samples/drivers/video/capture/src/main.c | 12 ++++++------ subsys/fb/cfb.c | 11 ++++++----- 5 files changed, 29 insertions(+), 11 deletions(-) diff --git a/drivers/display/display_gc9x01x.c b/drivers/display/display_gc9x01x.c index 963e0dbe7a69a..4ff5e990f07ea 100644 --- a/drivers/display/display_gc9x01x.c +++ b/drivers/display/display_gc9x01x.c @@ -541,6 +541,7 @@ static int gc9x01x_write(const struct device *dev, const uint16_t x, const uint1 mipi_desc.width = desc->width; /* Per MIPI API, pitch must always match width */ mipi_desc.pitch = desc->width; + mipi_desc.frame_incomplete = desc->frame_incomplete; ret = gc9x01x_transmit(dev, GC9X01X_CMD_MEMWR, NULL, 0); if (ret < 0) { diff --git a/drivers/display/display_ili9xxx.c b/drivers/display/display_ili9xxx.c index a13786122fb32..2cdd4d6cafb39 100644 --- a/drivers/display/display_ili9xxx.c +++ b/drivers/display/display_ili9xxx.c @@ -163,6 +163,7 @@ static int ili9xxx_write(const struct device *dev, const uint16_t x, mipi_desc.width = desc->width; /* Per MIPI API, pitch must always match width */ mipi_desc.pitch = desc->width; + mipi_desc.frame_incomplete = desc->frame_incomplete; r = ili9xxx_transmit(dev, ILI9XXX_RAMWR, NULL, 0); if (r < 0) { diff --git a/samples/drivers/display/src/main.c b/samples/drivers/display/src/main.c index fb81955c78aad..8cbfb64040ac1 100644 --- a/samples/drivers/display/src/main.c +++ b/samples/drivers/display/src/main.c @@ -297,6 +297,14 @@ int main(void) buf_desc.width = capabilities.x_resolution; buf_desc.height = h_step; + /* + * The following writes will only render parts of the image, + * so turn this option on. + * This allows double-buffered displays to hold the pixels + * back until the image is complete. + */ + buf_desc.frame_incomplete = true; + for (int idx = 0; idx < capabilities.y_resolution; idx += h_step) { /* * Tweaking the height value not to draw outside of the display. @@ -323,6 +331,13 @@ int main(void) y = 0; display_write(display_dev, x, y, &buf_desc, buf); + /* + * This is the last write of the frame, so turn this off. + * Double-buffered displays will now present the new image + * to the user. + */ + buf_desc.frame_incomplete = false; + fill_buffer_fnc(BOTTOM_RIGHT, 0, buf, buf_size); x = capabilities.x_resolution - rect_w; y = capabilities.y_resolution - rect_h; diff --git a/samples/drivers/video/capture/src/main.c b/samples/drivers/video/capture/src/main.c index 6134b7e56d01a..66d495188698f 100644 --- a/samples/drivers/video/capture/src/main.c +++ b/samples/drivers/video/capture/src/main.c @@ -70,12 +70,12 @@ static inline void video_display_frame(const struct device *const display_dev, const struct video_buffer *const vbuf, const struct video_format fmt) { - struct display_buffer_descriptor buf_desc; - - buf_desc.buf_size = vbuf->bytesused; - buf_desc.width = fmt.width; - buf_desc.pitch = buf_desc.width; - buf_desc.height = vbuf->bytesused / fmt.pitch; + struct display_buffer_descriptor buf_desc = { + .buf_size = vbuf->bytesused, + .width = fmt.width, + .pitch = buf_desc.width, + .height = vbuf->bytesused / fmt.pitch, + }; display_write(display_dev, 0, vbuf->line_offset, &buf_desc, vbuf->buffer); } diff --git a/subsys/fb/cfb.c b/subsys/fb/cfb.c index 7dc3a3b5cfc91..7ba0882c90bca 100644 --- a/subsys/fb/cfb.c +++ b/subsys/fb/cfb.c @@ -460,17 +460,18 @@ int cfb_framebuffer_finalize(const struct device *dev) { const struct display_driver_api *api = dev->api; const struct char_framebuffer *fb = &char_fb; - struct display_buffer_descriptor desc; int err; if (!fb || !fb->buf) { return -ENODEV; } - desc.buf_size = fb->size; - desc.width = fb->x_res; - desc.height = fb->y_res; - desc.pitch = fb->x_res; + struct display_buffer_descriptor desc = { + .buf_size = fb->size, + .width = fb->x_res, + .height = fb->y_res, + .pitch = fb->x_res, + }; if (!(fb->pixel_format & PIXEL_FORMAT_MONO10) != !(fb->inverted)) { cfb_invert(fb); From abc296ff654a433fe95d2ac5ef9be96c7fe06c3b Mon Sep 17 00:00:00 2001 From: Martin Stumpf Date: Sun, 10 Nov 2024 15:25:54 +0100 Subject: [PATCH 2413/4482] drivers: display: display_sdl: implement display_show Adds frame synchronization to every frame. This prevents frame tearing. Signed-off-by: Martin Stumpf --- doc/releases/release-notes-4.1.rst | 2 ++ drivers/display/display_sdl.c | 6 +++--- drivers/display/display_sdl_bottom.c | 11 ++++++----- drivers/display/display_sdl_bottom.h | 14 ++++++-------- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/doc/releases/release-notes-4.1.rst b/doc/releases/release-notes-4.1.rst index cd207e67a7ed2..c8cfe497b5c28 100644 --- a/doc/releases/release-notes-4.1.rst +++ b/doc/releases/release-notes-4.1.rst @@ -95,6 +95,8 @@ Drivers and Sensors * Added flag ``frame_incomplete`` to ``display_write`` that indicates whether a write is the last write of the frame, allowing display drivers to implement double buffering / tearing enable signal handling (:github:`81250`) + * Added ``frame_incomplete`` handling to SDL display driver (:dtcompatible:`zephyr,sdl-dc`) + (:github:`81250`) * Ethernet diff --git a/drivers/display/display_sdl.c b/drivers/display/display_sdl.c index 04370c855026f..2c88e16bd7514 100644 --- a/drivers/display/display_sdl.c +++ b/drivers/display/display_sdl.c @@ -260,9 +260,9 @@ static int sdl_display_write(const struct device *dev, const uint16_t x, sdl_display_write_bgr565(disp_data->buf, desc, buf); } - sdl_display_write_bottom(desc->height, desc->width, x, y, - disp_data->renderer, disp_data->mutex, disp_data->texture, - disp_data->buf, disp_data->display_on); + sdl_display_write_bottom(desc->height, desc->width, x, y, disp_data->renderer, + disp_data->mutex, disp_data->texture, disp_data->buf, + disp_data->display_on, desc->frame_incomplete); return 0; } diff --git a/drivers/display/display_sdl_bottom.c b/drivers/display/display_sdl_bottom.c index 0e995a341c9a3..e0fbd4a5fbb5f 100644 --- a/drivers/display/display_sdl_bottom.c +++ b/drivers/display/display_sdl_bottom.c @@ -5,6 +5,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include "display_sdl_bottom.h" + #include #include #include @@ -64,10 +66,9 @@ int sdl_display_init_bottom(uint16_t height, uint16_t width, uint16_t zoom_pct, return 0; } -void sdl_display_write_bottom(const uint16_t height, const uint16_t width, - const uint16_t x, const uint16_t y, - void *renderer, void *mutex, void *texture, - uint8_t *buf, bool display_on) +void sdl_display_write_bottom(const uint16_t height, const uint16_t width, const uint16_t x, + const uint16_t y, void *renderer, void *mutex, void *texture, + uint8_t *buf, bool display_on, bool frame_incomplete) { SDL_Rect rect; int err; @@ -85,7 +86,7 @@ void sdl_display_write_bottom(const uint16_t height, const uint16_t width, SDL_UpdateTexture(texture, &rect, buf, 4 * rect.w); - if (display_on) { + if (display_on && !frame_incomplete) { SDL_RenderClear(renderer); SDL_RenderCopy(renderer, texture, NULL, NULL); SDL_RenderPresent(renderer); diff --git a/drivers/display/display_sdl_bottom.h b/drivers/display/display_sdl_bottom.h index 54973777f1be0..721cfa2b5a81e 100644 --- a/drivers/display/display_sdl_bottom.h +++ b/drivers/display/display_sdl_bottom.h @@ -23,14 +23,12 @@ extern "C" { int sdl_display_init_bottom(uint16_t height, uint16_t width, uint16_t zoom_pct, bool use_accelerator, void **window, void **renderer, void **mutex, void **texture, void **read_texture); -void sdl_display_write_bottom(const uint16_t height, const uint16_t width, - const uint16_t x, const uint16_t y, - void *renderer, void *mutex, void *texture, - uint8_t *buf, bool display_on); -int sdl_display_read_bottom(const uint16_t height, const uint16_t width, - const uint16_t x, const uint16_t y, - void *renderer, void *buf, uint16_t pitch, - void *mutex, void *texture, void **read_texture); +void sdl_display_write_bottom(const uint16_t height, const uint16_t width, const uint16_t x, + const uint16_t y, void *renderer, void *mutex, void *texture, + uint8_t *buf, bool display_on, bool frame_incomplete); +int sdl_display_read_bottom(const uint16_t height, const uint16_t width, const uint16_t x, + const uint16_t y, void *renderer, void *buf, uint16_t pitch, + void *mutex, void *texture, void *read_texture); void sdl_display_blanking_off_bottom(void *renderer, void *texture); void sdl_display_blanking_on_bottom(void *renderer); void sdl_display_cleanup_bottom(void **window, void **renderer, void **mutex, void **texture, From 0ea212918f60583e1608cfe17375f6cc922eb37e Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Mon, 11 Nov 2024 16:55:00 -0600 Subject: [PATCH 2414/4482] cmake: extensions: use INTERFACE_SOURCES as property for code relocation In order to enable code relocation, we use a custom target (code_data_relocation_target), and add files we wish to relocate, as well as which sections should be relocated to the COMPILE_DEFINITIONS property for the target. This approach has been fragile, because COMPILE_DEFINITIONS can also be added to for all targets using `add_definitions`. This means if another part of the project uses `add_definitions` and CONFIG_CODE_DATA_RELOCATION is on, a warning will appear about the "file" not being found. The "file" of course, is just the definition added by `add_definitions`. To work around this, switch to overloading the INTERFACE_SOURCES property. This property should be a bit more robust, because nobody else will add sources to the code_data_relocation_target. However, this approach has the downside that the CMake documentation pstates targets created with `add_custom_target()` (which the code_data_relocation_target is) do not have an INTERFACE scope for their sources- so while this approach works, it is not officially supported by CMake Fixes #60220 Signed-off-by: Daniel DeGrasse --- cmake/linker/arcmwdt/target.cmake | 2 +- cmake/linker/ld/target_relocation.cmake | 2 +- cmake/modules/extensions.cmake | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/linker/arcmwdt/target.cmake b/cmake/linker/arcmwdt/target.cmake index 4eaf824b7c093..389bbeb5845b3 100644 --- a/cmake/linker/arcmwdt/target.cmake +++ b/cmake/linker/arcmwdt/target.cmake @@ -155,7 +155,7 @@ macro(toolchain_ld_relocation) ${ZEPHYR_BASE}/scripts/build/gen_relocate_app.py $<$:--verbose> -d ${APPLICATION_BINARY_DIR} - -i \"$\" + -i \"$\" -o ${MEM_RELOCATION_LD} -s ${MEM_RELOCATION_SRAM_DATA_LD} -b ${MEM_RELOCATION_SRAM_BSS_LD} diff --git a/cmake/linker/ld/target_relocation.cmake b/cmake/linker/ld/target_relocation.cmake index a90941d04af9f..2bc2aa24c11d5 100644 --- a/cmake/linker/ld/target_relocation.cmake +++ b/cmake/linker/ld/target_relocation.cmake @@ -16,7 +16,7 @@ macro(toolchain_ld_relocation) OUTPUT ${DICT_FILE} CONTENT - $ + $ ) add_custom_command( diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index d5cd84256d2e6..b91566024ef65 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -1526,9 +1526,9 @@ function(zephyr_code_relocate) # each directive can embed multiple CMake lists, representing flags and files, # the latter of which can come from generator expressions. get_property(code_rel_str TARGET code_data_relocation_target - PROPERTY COMPILE_DEFINITIONS) + PROPERTY INTERFACE_SOURCES) set_property(TARGET code_data_relocation_target - PROPERTY COMPILE_DEFINITIONS + PROPERTY INTERFACE_SOURCES "${code_rel_str}|${CODE_REL_LOCATION}:${flag_list}:${file_list}") endfunction() From 6342eff58b4624ea938bf6438238029e635f90ec Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Mon, 11 Nov 2024 22:51:46 +0000 Subject: [PATCH 2415/4482] led: add a struct led_dt_spec and some _dt wrapper APIs Add a struct led_dt_spec to hold an LED device and index pointer, some initializer and wrapper APIs. This allows simpler LED usage, such as: static const struct led_dt_spec led = LED_DT_SPEC_GET(DT_NODELABEL(led0)); led_on_dt(&led); led_off_dt(&led); Signed-off-by: Fabio Baltieri --- doc/releases/release-notes-4.1.rst | 2 + include/zephyr/drivers/led.h | 129 +++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+) diff --git a/doc/releases/release-notes-4.1.rst b/doc/releases/release-notes-4.1.rst index c8cfe497b5c28..2e734c7f8197b 100644 --- a/doc/releases/release-notes-4.1.rst +++ b/doc/releases/release-notes-4.1.rst @@ -118,6 +118,8 @@ Drivers and Sensors * LED + * Added a new set of devicetree based LED APIs, see :c:struct:`led_dt_spec`. + * LED Strip * LoRa diff --git a/include/zephyr/drivers/led.h b/include/zephyr/drivers/led.h index fbb66b5f28517..dc0bd13321040 100644 --- a/include/zephyr/drivers/led.h +++ b/include/zephyr/drivers/led.h @@ -330,6 +330,135 @@ static inline int z_impl_led_off(const struct device *dev, uint32_t led) return api->off(dev, led); } +/* + * LED DT helpers. + */ + +/** + * @brief Container for an LED information specified in devicetree. + * + * This type contains a pointer to and LED device and an LED index. + * + * @see LED_DT_SPEC_GET + * @see LED_DT_SPEC_GET_OR + */ +struct led_dt_spec { + /** LED device instance. */ + const struct device *dev; + /** Index of the LED on the controller. */ + uint32_t index; +}; + +/** + * @brief Set LED brightness from a led_dt_spec. + * + * @param spec LED device specification from devicetree. + * @param value Brightness value to set in percent. + * @return 0 on success, negative on error. + * + * @see led_set_brightness() + */ +static inline int led_set_brightness_dt(const struct led_dt_spec *spec, + uint8_t value) +{ + return led_set_brightness(spec->dev, spec->index, value); +} + +/** + * @brief Turn on an LED from a struct led_dt_spec. + * + * @param spec LED device specification from devicetree. + * @return 0 on success, negative on error. + * + * @see led_on() + */ +static inline int led_on_dt(const struct led_dt_spec *spec) +{ + return led_on(spec->dev, spec->index); +} + +/** + * @brief Turn off an LED from a struct led_dt_spec. + * + * @param spec LED device specification from devicetree. + * @return 0 on success, negative on error. + * + * @see led_off() + */ +static inline int led_off_dt(const struct led_dt_spec *spec) +{ + return led_off(spec->dev, spec->index); +} + +/** + * @brief Validate that the LED device is ready. + * + * @param spec LED specification from devicetree. + * + * @retval true If the LED device is ready for use. + * @retval false If the LED device is not ready for use. + */ +static inline bool led_is_ready_dt(const struct led_dt_spec *spec) +{ + return device_is_ready(spec->dev); +} + +/** + * @brief Static initializer for a struct led_dt_spec + * + * This returns a static initializer for a struct led_dt_spec given a devicetree + * node identifier. + * + * Example devicetree fragment: + * + * @code{.dts} + * leds { + * compatible = "gpio-leds"; + * led0: led_0 { + * ... + * }; + * }; + * @endcode + * + * Example usage: + * + * @code{.c} + * const struct led_dt_spec spec = LED_DT_SPEC_GET(DT_NODELABEL(led0)); + * + * // Initializes 'spec' to: + * // { + * // .dev = DEVICE_DT_GET(DT_PARENT(led0)), + * // .index = 0, + * // } + * @endcode + * + * The device (dev) must still be checked for readiness, e.g. using + * device_is_ready(). + * + * @param node_id Devicetree node identifier. + * + * @return Static initializer for a struct led_dt_spec for the property. + */ +#define LED_DT_SPEC_GET(node_id) \ + { \ + .dev = DEVICE_DT_GET(DT_PARENT(node_id)), \ + .index = DT_NODE_CHILD_IDX(node_id), \ + } + +/** + * @brief Like LED_DT_SPEC_GET(), with a fallback value if the node does not exist. + * + * @param node_id Devicetree node identifier. + * + * @return Static initializer for a struct led_dt_spec for the property. + * + * @see LED_DT_SPEC_GET + */ +#define LED_DT_SPEC_GET_OR(node_id, default_value) \ + COND_CODE_1(DT_NODE_EXISTS(node_id), \ + (LED_DT_SPEC_GET(node_id)), \ + (default_value)) + /** * @} */ From 84dc9a1721a0da83c1751519ca94df615a7d7bc4 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 11 Nov 2024 16:38:09 +0100 Subject: [PATCH 2416/4482] lib/cpp: Remove deprecated CONFIG_CPP_STATIC_INIT_GNU This option was replaced with CONFIG_STATIC_INIT_GNU 2 releases ago in 6e977ae2d54c4f5443f752ce3a88f22043dcbf07 Signed-off-by: Alberto Escolar Piedras --- lib/cpp/Kconfig | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib/cpp/Kconfig b/lib/cpp/Kconfig index 1b0f8ee6396ca..728162f55368d 100644 --- a/lib/cpp/Kconfig +++ b/lib/cpp/Kconfig @@ -143,14 +143,6 @@ config CPP_RTTI endif # !MINIMAL_LIBCPP -config CPP_STATIC_INIT_GNU - bool - select STATIC_INIT_GNU - select DEPRECATED - help - GNU-compatible initialization of CPP static objects. - This option is deprecated in favour of STATIC_INIT_GNU - endif # CPP endmenu From 51bc60e142aef8fe63256e2ad89d33d5326c5a8c Mon Sep 17 00:00:00 2001 From: Juha Sunnari Date: Mon, 11 Nov 2024 10:50:46 +0200 Subject: [PATCH 2417/4482] logging: frontends: stmesp: alternate message output option Add an alternate message output option in which messages are ended with an additional zero data byte with marker and timestamp. Can be used to maintain compatibility with certain decoders. Signed-off-by: Juha Sunnari --- subsys/logging/frontends/Kconfig | 8 +++++ .../logging/frontends/log_frontend_stmesp.c | 32 +++++++++++++++---- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/subsys/logging/frontends/Kconfig b/subsys/logging/frontends/Kconfig index 4d6d85e3e8834..ec3945fa1ffd4 100644 --- a/subsys/logging/frontends/Kconfig +++ b/subsys/logging/frontends/Kconfig @@ -74,6 +74,14 @@ config LOG_FRONTEND_STMESP_GUARANTEED_ACCESS When enabled, accessing STMESP registers will stall if write cannot be performed (e.g. ETR buffer is full). +config LOG_FRONTEND_STMESP_MSG_END_TIMESTAMP + bool "Generate timestamp and marker at message end" + help + Generate a zero data byte with timestamp and marker at message end, + instead of generating a timestamp and marker at message start and + a flag at end. This can be used to maintain compatibility with + certain decoders. + endif # LOG_FRONTEND_STMESP config LOG_FRONTEND_STMESP_DEMUX diff --git a/subsys/logging/frontends/log_frontend_stmesp.c b/subsys/logging/frontends/log_frontend_stmesp.c index 9ba444bcd1d99..288d557a0db78 100644 --- a/subsys/logging/frontends/log_frontend_stmesp.c +++ b/subsys/logging/frontends/log_frontend_stmesp.c @@ -312,7 +312,11 @@ static inline int16_t get_source_id(const void *source) static void packet_end(STMESP_Type *stm_esp) { - STM_FLAG(stm_esp); + if (IS_ENABLED(CONFIG_LOG_FRONTEND_STMESP_MSG_END_TIMESTAMP)) { + STM_D8(stm_esp, 0, true, true); + } else { + STM_FLAG(stm_esp); + } atomic_set(&new_data, 1); } @@ -363,7 +367,11 @@ void log_frontend_msg(const void *source, const struct log_msg_desc desc, uint8_ return; } - STM_D32(stm_esp, hdr.raw, use_timestamp, true); + if (IS_ENABLED(CONFIG_LOG_FRONTEND_STMESP_MSG_END_TIMESTAMP)) { + STM_D32(stm_esp, hdr.raw, false, false); + } else { + STM_D32(stm_esp, hdr.raw, use_timestamp, true); + } (void)cbprintf_package_convert(package, desc.package_len, package_cb, stm_esp, flags, strl, ARRAY_SIZE(strl)); write_data(sname, sname_len, stm_esp); @@ -412,7 +420,11 @@ void log_frontend_msg(const void *source, const struct log_msg_desc desc, uint8_ return; } - STM_D32(stm_esp, dict_desc.raw, true, true); + if (IS_ENABLED(CONFIG_LOG_FRONTEND_STMESP_MSG_END_TIMESTAMP)) { + STM_D32(stm_esp, dict_desc.raw, false, false); + } else { + STM_D32(stm_esp, dict_desc.raw, true, true); + } (void)cbprintf_package_convert(package, desc.package_len, package_cb, stm_esp, flags, NULL, 0); if (data) { @@ -460,7 +472,11 @@ static inline void msg_start(STMESP_Type *stm_esp, uint32_t level, const void *s { union stm_log_dict_hdr dict_desc = DICT_HDR_INITIALIZER(level, get_source_id(source), 0); - STM_D32(stm_esp, dict_desc.raw, true, true); + if (IS_ENABLED(CONFIG_LOG_FRONTEND_STMESP_MSG_END_TIMESTAMP)) { + STM_D32(stm_esp, dict_desc.raw, false, false); + } else { + STM_D32(stm_esp, dict_desc.raw, true, true); + } STM_D32(stm_esp, package_hdr, false, false); STM_D32(stm_esp, (uint32_t)fmt, false, false); } @@ -609,8 +625,12 @@ int log_frontend_stmesp_etr_ready(void) early_buf_read_mode(); while ((len = early_buf_get_data((void **)&buf)) > 0) { - /* Write first word with Marked and timestamp. */ - STM_D32(stm_esp, *buf, true, true); + if (IS_ENABLED(CONFIG_LOG_FRONTEND_STMESP_MSG_END_TIMESTAMP)) { + STM_D32(stm_esp, *buf, false, false); + } else { + /* Write first word with Marked and timestamp. */ + STM_D32(stm_esp, *buf, true, true); + } buf++; len -= sizeof(uint32_t); From 7918c921d5d551158d1898a21dfc0fcfcbcd01f4 Mon Sep 17 00:00:00 2001 From: Benedikt Schmidt Date: Thu, 7 Nov 2024 08:04:59 +0100 Subject: [PATCH 2418/4482] drivers: fpga: always check state of CDONE during configuration of iCE40 Turn the assert into an if-statement to ensure that CDONE is always checked during the configuration of an iCE40. Signed-off-by: Benedikt Schmidt --- drivers/fpga/fpga_ice40.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/fpga/fpga_ice40.c b/drivers/fpga/fpga_ice40.c index ac00734f369f1..16512a9260761 100644 --- a/drivers/fpga/fpga_ice40.c +++ b/drivers/fpga/fpga_ice40.c @@ -262,7 +262,11 @@ static int fpga_ice40_load_gpio(const struct device *dev, uint32_t *image_ptr, u LOG_DBG("Delay %u us", config->creset_delay_us); fpga_ice40_delay(2 * config->mhz_delay_count * config->creset_delay_us); - __ASSERT(gpio_pin_get_dt(&config->cdone) == 0, "CDONE was not high"); + if (gpio_pin_get_dt(&config->cdone) != 0) { + LOG_ERR("CDONE should be low after the reset"); + ret = -EIO; + goto unlock; + } LOG_DBG("Set CRESET high"); *config->set |= creset; @@ -368,7 +372,11 @@ static int fpga_ice40_load_spi(const struct device *dev, uint32_t *image_ptr, ui LOG_DBG("Delay %u us", config->creset_delay_us); k_usleep(config->creset_delay_us); - __ASSERT(gpio_pin_get_dt(&config->cdone) == 0, "CDONE was not high"); + if (gpio_pin_get_dt(&config->cdone) != 0) { + LOG_ERR("CDONE should be low after the reset"); + ret = -EIO; + goto unlock; + } LOG_DBG("Set CRESET high"); ret = gpio_pin_configure_dt(&config->creset, GPIO_OUTPUT_HIGH); From 532c775787d0dc010f102df99d5f912c37999c5a Mon Sep 17 00:00:00 2001 From: Tarang Raval Date: Sun, 10 Nov 2024 19:27:40 +0530 Subject: [PATCH 2419/4482] board: silabs: slstk3701a: add i2c2 node Enable the I2C2 node on the EFM32GG11 SLSTK3701A board Signed-off-by: Tarang Raval --- .../starter_kits/slstk3701a/slstk3701a-pinctrl.dtsi | 9 +++++++++ boards/silabs/starter_kits/slstk3701a/slstk3701a.dts | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/boards/silabs/starter_kits/slstk3701a/slstk3701a-pinctrl.dtsi b/boards/silabs/starter_kits/slstk3701a/slstk3701a-pinctrl.dtsi index 4540922dd2f19..a8731a39368c4 100644 --- a/boards/silabs/starter_kits/slstk3701a/slstk3701a-pinctrl.dtsi +++ b/boards/silabs/starter_kits/slstk3701a/slstk3701a-pinctrl.dtsi @@ -43,4 +43,13 @@ ; }; }; + + i2c2_default: i2c2_default { + group1 { + psels = , + , + , + ; + }; + }; }; diff --git a/boards/silabs/starter_kits/slstk3701a/slstk3701a.dts b/boards/silabs/starter_kits/slstk3701a/slstk3701a.dts index 1e67f024d7f43..331a21637180a 100644 --- a/boards/silabs/starter_kits/slstk3701a/slstk3701a.dts +++ b/boards/silabs/starter_kits/slstk3701a/slstk3701a.dts @@ -92,6 +92,12 @@ status = "okay"; }; +&i2c2 { + pinctrl-0 = <&i2c2_default>; + pinctrl-names = "default"; + status = "okay"; +}; + &rtcc0 { prescaler = <1>; status = "okay"; From cebd1c78e8712e22db7b85d6a1cf1bd648f18e40 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Sun, 10 Nov 2024 12:43:00 +0100 Subject: [PATCH 2420/4482] drivers: sensor: emul_bmi160: fix cid 215232 This commit fixes the issue of Null pointer dereferencing Signed-off-by: Jilay Pandya --- drivers/sensor/bosch/bmi160/emul_bmi160.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/sensor/bosch/bmi160/emul_bmi160.c b/drivers/sensor/bosch/bmi160/emul_bmi160.c index 9fc33b48b6aa9..83139fac5fa18 100644 --- a/drivers/sensor/bosch/bmi160/emul_bmi160.c +++ b/drivers/sensor/bosch/bmi160/emul_bmi160.c @@ -180,10 +180,15 @@ static int bmi160_emul_io_spi(const struct emul *target, const struct spi_config LOG_DBG("Unknown tx_bufs->count %d", count); return -EIO; } - tx = tx_bufs->buffers; - txd = &tx_bufs->buffers[1]; + tx = tx_bufs ? tx_bufs->buffers : NULL; + txd = tx_bufs ? &tx_bufs->buffers[1] : NULL; rxd = rx_bufs ? &rx_bufs->buffers[1] : NULL; + if (tx == NULL) { + LOG_DBG("tx cannot be NULL"); + return -EIO; + } + if (tx->len != 1) { LOG_DBG("Unknown tx->len %d", tx->len); return -EIO; From 5c4f7d9e82d11874fc765a01236f70087a75e23c Mon Sep 17 00:00:00 2001 From: Djordje Nedic Date: Mon, 11 Nov 2024 18:56:29 +0100 Subject: [PATCH 2421/4482] soc: Fix missing mem.h include in stm32h562 This caused failed builds due to the missing DT_SIZE_K(x) macro. Signed-off-by: Djordje Nedic --- dts/arm/st/h5/stm32h562.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/dts/arm/st/h5/stm32h562.dtsi b/dts/arm/st/h5/stm32h562.dtsi index 290343ef426a4..ffdbc50638689 100644 --- a/dts/arm/st/h5/stm32h562.dtsi +++ b/dts/arm/st/h5/stm32h562.dtsi @@ -8,6 +8,7 @@ #include /* keep both header files for compatibility */ #include +#include / { clocks { From 6a0d7351d550c5e3e4c783a4adb04316fbc6accc Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Sat, 9 Nov 2024 18:07:07 +0100 Subject: [PATCH 2422/4482] drivers: sensor: fcx_mldx5 fix string_overflow issue This commit fixes Copy into fixed size buffer (STRING_OVERFLOW) by checking the cmd_data_len Signed-off-by: Jilay Pandya --- drivers/sensor/fcx_mldx5/fcx_mldx5.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/sensor/fcx_mldx5/fcx_mldx5.c b/drivers/sensor/fcx_mldx5/fcx_mldx5.c index c68bd3725684e..a6f5ba3866c0e 100644 --- a/drivers/sensor/fcx_mldx5/fcx_mldx5.c +++ b/drivers/sensor/fcx_mldx5/fcx_mldx5.c @@ -235,9 +235,10 @@ static void fcx_mldx5_uart_send(const struct device *dev, enum fcx_mldx5_cmd cmd buf[FCX_MLDX5_STX_INDEX] = FCX_MLDX5_STX; memcpy(&buf[FCX_MLDX5_CMD_INDEX], fcx_mldx5_cmds[cmd], FCX_MLDX5_CMD_LEN); - if (cmd_data_len != 0) { + if (cmd_data_len != 0 && cmd_data_len == fcx_mldx5_cmds_data_len[cmd]) { memcpy(&buf[FCX_MLDX5_DATA_INDEX], cmd_data, strlen(cmd_data)); } + checksum = fcx_mldx5_calculate_checksum(&buf[FCX_MLDX5_CMD_INDEX], FCX_MLDX5_CMD_LEN + cmd_data_len); bin2hex(&checksum, 1, &buf[FCX_MLDX5_CHECKSUM_INDEX(frame_len)], From 79bc3d1de5266b1e6925809474439b9a40f9b5f8 Mon Sep 17 00:00:00 2001 From: Marcin Niestroj Date: Sat, 9 Nov 2024 11:55:59 +0100 Subject: [PATCH 2423/4482] samples: dap: drop 'sample.dap.bulk.nrf' 'nrf52840dk/nrf52840' is already listed under "generic" 'sample.dap.bulk', so keeping 'sample.dap.bulk.nrf' has no value. The only difference is dependency on 'gpio' instead of 'arduino_gpio', but 'nrf52840dk_nrf52840.overlay' references arduino header gpios only. Signed-off-by: Marcin Niestroj --- samples/subsys/dap/sample.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/samples/subsys/dap/sample.yaml b/samples/subsys/dap/sample.yaml index 65264fa242943..541e576031eae 100644 --- a/samples/subsys/dap/sample.yaml +++ b/samples/subsys/dap/sample.yaml @@ -8,9 +8,3 @@ tests: - nrf52840dk/nrf52840 - frdm_k64f tags: dap - sample.dap.bulk.nrf: - build_only: true - depends_on: gpio usb_device - platform_allow: - - nrf52840dk/nrf52840 - tags: dap From 60dba528596742f0b73df90a7361a217b5850826 Mon Sep 17 00:00:00 2001 From: Marcin Niestroj Date: Sat, 9 Nov 2024 11:32:02 +0100 Subject: [PATCH 2424/4482] boards: st: nucleo_h533re: add arduino_{gpio,serial} supported tags This allows to build samples by twister which depend on 'arduino_gpio' and/or 'arduino_serial'. Signed-off-by: Marcin Niestroj --- boards/st/nucleo_h533re/nucleo_h533re.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boards/st/nucleo_h533re/nucleo_h533re.yaml b/boards/st/nucleo_h533re/nucleo_h533re.yaml index 11cf9f30a1c94..9562322e9c1b8 100644 --- a/boards/st/nucleo_h533re/nucleo_h533re.yaml +++ b/boards/st/nucleo_h533re/nucleo_h533re.yaml @@ -10,6 +10,8 @@ toolchain: ram: 272 flash: 512 supported: + - arduino_gpio + - arduino_serial - gpio - watchdog - pwm From 70abb6077dc8ff3aa5717d4b801f2bc26210d227 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Sat, 9 Nov 2024 13:29:05 +0800 Subject: [PATCH 2425/4482] tests/benchmarks: latency_measure: add qemu_riscv_64_smp board Add `qemu_riscv64/qemu_virt_riscv64/smp` to the list of integration_platforms. Signed-off-by: Yong Cong Sin --- tests/benchmarks/sched/testcase.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/benchmarks/sched/testcase.yaml b/tests/benchmarks/sched/testcase.yaml index 9ae091c3d6249..34b0a29061710 100644 --- a/tests/benchmarks/sched/testcase.yaml +++ b/tests/benchmarks/sched/testcase.yaml @@ -6,6 +6,7 @@ tests: integration_platforms: - mps2/an385 - qemu_x86 + - qemu_riscv64/qemu_virt_riscv64/smp slow: true harness: console harness_config: From 1993ea019b15857786b624b889198e32862ada59 Mon Sep 17 00:00:00 2001 From: Mark Inderhees Date: Fri, 8 Nov 2024 17:12:09 -0800 Subject: [PATCH 2426/4482] build: support newlines in syscall decls Some auto formatters will wrap long lines of code and insert newlines that are part of function decls outside of arguments. This change strips out all newlines so syscall typename regex function as expected. Signed-off-by: Mark Inderhees --- scripts/build/gen_syscalls.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/build/gen_syscalls.py b/scripts/build/gen_syscalls.py index 44e0b793a124d..13dc1448a1f29 100755 --- a/scripts/build/gen_syscalls.py +++ b/scripts/build/gen_syscalls.py @@ -184,6 +184,7 @@ class SyscallParseException(Exception): def typename_split(item): + item = item.strip().replace("\n", " ") if "[" in item: raise SyscallParseException( "Please pass arrays to syscalls as pointers, unable to process '%s'" % @@ -396,7 +397,7 @@ def analyze_fn(match_group, fn, userspace_only): if args == "void": args = [] else: - args = [typename_split(a.strip()) for a in args.split(",")] + args = [typename_split(a) for a in args.split(",")] func_type, func_name = typename_split(func) except SyscallParseException: From c32210b0032365f3e3152487b9587d095e4f6d5b Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Fri, 8 Nov 2024 17:41:55 +0100 Subject: [PATCH 2427/4482] Bluetooth: Host: ID: Log resolve list conflicts In case of conflicts when calling bt_id_find_conflict there was no way to easily determine what conflicted. This is a rare occurance, but has happened when testing against PTS. Signed-off-by: Emil Gydesen --- subsys/bluetooth/host/id.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index 4e1313c5d2ce5..3a6fdf3ee28aa 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -974,6 +974,11 @@ void find_rl_conflict(struct bt_keys *resident, void *user_data) bt_irk_eq(&conflict->candidate->irk, &resident->irk)); if (addr_conflict || irk_conflict) { + LOG_DBG("Resident : addr %s and IRK %s", bt_addr_le_str(&resident->addr), + bt_hex(resident->irk.val, sizeof(resident->irk.val))); + LOG_DBG("Candidate: addr %s and IRK %s", bt_addr_le_str(&conflict->candidate->addr), + bt_hex(conflict->candidate->irk.val, sizeof(conflict->candidate->irk.val))); + conflict->found = resident; } } From 9e5d4084b17fb557cbaf23067991614719f1b73d Mon Sep 17 00:00:00 2001 From: James Roy Date: Fri, 8 Nov 2024 23:33:00 +0800 Subject: [PATCH 2428/4482] style: Inconsistent macro name changed Fix incorrect header file pre-macro name in 'include/zephyr/devicetree.h'. Signed-off-by: James Roy --- include/zephyr/devicetree.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/zephyr/devicetree.h b/include/zephyr/devicetree.h index 57bcb0dd427e5..3a26a1dd355c4 100644 --- a/include/zephyr/devicetree.h +++ b/include/zephyr/devicetree.h @@ -13,8 +13,8 @@ * API for accessing the current application's devicetree macros. */ -#ifndef DEVICETREE_H -#define DEVICETREE_H +#ifndef ZEPHYR_INCLUDE_DEVICETREE_H_ +#define ZEPHYR_INCLUDE_DEVICETREE_H_ #include #include @@ -5157,4 +5157,4 @@ #include #include -#endif /* DEVICETREE_H */ +#endif /* ZEPHYR_INCLUDE_DEVICETREE_H_ */ From 8776ae316c3eaac861918446d2b327992a7aa9e2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 8 Nov 2024 15:47:33 +0200 Subject: [PATCH 2429/4482] tests: posix: headers: net: sin6_scope_id is supported The Posix documentation uses sin6_scope_id for scope id and we support that already. Signed-off-by: Jukka Rissanen --- tests/posix/headers/src/netinet_in_h.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/posix/headers/src/netinet_in_h.c b/tests/posix/headers/src/netinet_in_h.c index 78adfe6be82c1..cd96d5931ead2 100644 --- a/tests/posix/headers/src/netinet_in_h.c +++ b/tests/posix/headers/src/netinet_in_h.c @@ -38,8 +38,7 @@ ZTEST(posix_headers, test_netinet_in_h) /* not implemented */ /* zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_flowinfo)); */ zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_addr)); - /* not implemented */ - /* zassert_not_equal(-1, offsetof(struct sockaddr_in6, scope_id)); */ + zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_scope_id)); zassert_not_null(&in6addr_loopback); struct in6_addr any6 = IN6ADDR_ANY_INIT; From 5216b52477bd6b1d3b16ade45941f2c8951038ef Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 8 Nov 2024 15:49:58 +0200 Subject: [PATCH 2430/4482] tests: posix: headers: net: Add check for in6addr_any variable The in6addr_any is a global symbol that can be used when any address (all zero bits) is being referenced. Signed-off-by: Jukka Rissanen --- tests/posix/headers/src/netinet_in_h.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/posix/headers/src/netinet_in_h.c b/tests/posix/headers/src/netinet_in_h.c index cd96d5931ead2..61e2750239df2 100644 --- a/tests/posix/headers/src/netinet_in_h.c +++ b/tests/posix/headers/src/netinet_in_h.c @@ -40,6 +40,7 @@ ZTEST(posix_headers, test_netinet_in_h) zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_addr)); zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_scope_id)); + zassert_not_null(&in6addr_any); zassert_not_null(&in6addr_loopback); struct in6_addr any6 = IN6ADDR_ANY_INIT; struct in6_addr lo6 = IN6ADDR_LOOPBACK_INIT; From 96795f0b6c4703fe6a184a29e9c3d16705e14002 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 8 Nov 2024 15:59:22 +0200 Subject: [PATCH 2431/4482] tests: posix: headers: net: Add IPv6 join/leave group The IPV6_JOIN/LEAVE_GROUP corresponds to IPV6_ADD/DROP_MEMBERSHIP definitions so define the former and add tests for them. Signed-off-by: Jukka Rissanen --- include/zephyr/net/socket.h | 6 ++++++ tests/posix/headers/src/netinet_in_h.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/zephyr/net/socket.h b/include/zephyr/net/socket.h index f1a937d42294d..fec26c9ee9879 100644 --- a/include/zephyr/net/socket.h +++ b/include/zephyr/net/socket.h @@ -1225,6 +1225,12 @@ struct ip_mreqn { /** Leave IPv6 multicast group. */ #define IPV6_DROP_MEMBERSHIP 21 +/** Join IPv6 multicast group. */ +#define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP + +/** Leave IPv6 multicast group. */ +#define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP + /** * @brief Struct used when joining or leaving a IPv6 multicast group. */ diff --git a/tests/posix/headers/src/netinet_in_h.c b/tests/posix/headers/src/netinet_in_h.c index 61e2750239df2..1e015a41f4c65 100644 --- a/tests/posix/headers/src/netinet_in_h.c +++ b/tests/posix/headers/src/netinet_in_h.c @@ -63,8 +63,8 @@ ZTEST(posix_headers, test_netinet_in_h) zassert_equal(INET_ADDRSTRLEN, 16); zassert_equal(INET6_ADDRSTRLEN, 46); - /* zassert_not_equal(-1, IPV6_JOIN_GROUP); */ /* not implemented */ - /* zassert_not_equal(-1, IPV6_LEAVE_GROUP); */ /* not implemented */ + zassert_equal(IPV6_ADD_MEMBERSHIP, IPV6_JOIN_GROUP); + zassert_equal(IPV6_DROP_MEMBERSHIP, IPV6_LEAVE_GROUP); /* zassert_not_equal(-1, IPV6_MULTICAST_HOPS); */ /* not implemented */ /* zassert_not_equal(-1, IPV6_MULTICAST_IF); */ /* not implemented */ /* zassert_not_equal(-1, IPV6_MULTICAST_LOOP); */ /* not implemented */ From f2d58c4e1860b61062c0f9dfe0d5e0395fb1cdeb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 8 Nov 2024 16:02:55 +0200 Subject: [PATCH 2432/4482] tests: posix: headers: net: Mark unicast/multicast hops supported Both the IPV6_UNICAST_HOPS and IPV6_MULTICAST_HOPS are supported so add tests for them. Signed-off-by: Jukka Rissanen --- tests/posix/headers/src/netinet_in_h.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/posix/headers/src/netinet_in_h.c b/tests/posix/headers/src/netinet_in_h.c index 1e015a41f4c65..6dba608521e2d 100644 --- a/tests/posix/headers/src/netinet_in_h.c +++ b/tests/posix/headers/src/netinet_in_h.c @@ -65,10 +65,10 @@ ZTEST(posix_headers, test_netinet_in_h) zassert_equal(IPV6_ADD_MEMBERSHIP, IPV6_JOIN_GROUP); zassert_equal(IPV6_DROP_MEMBERSHIP, IPV6_LEAVE_GROUP); - /* zassert_not_equal(-1, IPV6_MULTICAST_HOPS); */ /* not implemented */ + zassert_not_equal(-1, IPV6_MULTICAST_HOPS); /* zassert_not_equal(-1, IPV6_MULTICAST_IF); */ /* not implemented */ /* zassert_not_equal(-1, IPV6_MULTICAST_LOOP); */ /* not implemented */ - /* zassert_not_equal(-1, IPV6_UNICAST_HOPS); */ /* not implemented */ + zassert_not_equal(-1, IPV6_UNICAST_HOPS); zassert_not_equal(-1, IPV6_V6ONLY); /* IN6_IS_ADDR_UNSPECIFIED(&any6); */ /* not implemented */ From 606eeed8c92f8852194f7ad1ff999cd4369c5980 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 8 Nov 2024 16:05:32 +0200 Subject: [PATCH 2433/4482] tests: posix: headers: net: Add INADDR_BROADCAST definition Add INADDR_BROADCAST definition and a test for it. Signed-off-by: Jukka Rissanen --- include/zephyr/net/net_ip.h | 3 +++ tests/posix/headers/src/netinet_in_h.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/zephyr/net/net_ip.h b/include/zephyr/net/net_ip.h index 0963bdd69bc31..499d5a4f3131d 100644 --- a/include/zephyr/net/net_ip.h +++ b/include/zephyr/net/net_ip.h @@ -438,6 +438,9 @@ extern const struct in6_addr in6addr_loopback; /** IPv4 any address */ #define INADDR_ANY 0 +/** IPv4 broadcast address */ +#define INADDR_BROADCAST 0xffffffff + /** IPv4 address initializer */ #define INADDR_ANY_INIT { { { INADDR_ANY } } } diff --git a/tests/posix/headers/src/netinet_in_h.c b/tests/posix/headers/src/netinet_in_h.c index 6dba608521e2d..f860484b58c25 100644 --- a/tests/posix/headers/src/netinet_in_h.c +++ b/tests/posix/headers/src/netinet_in_h.c @@ -58,7 +58,7 @@ ZTEST(posix_headers, test_netinet_in_h) zassert_not_equal(-1, IPPROTO_UDP); zassert_not_equal(-1, INADDR_ANY); - /* zassert_not_equal(-1, INADDR_BROADCAST); */ /* not implemented */ + zassert_equal(0xffffffff, INADDR_BROADCAST); zassert_equal(INET_ADDRSTRLEN, 16); zassert_equal(INET6_ADDRSTRLEN, 46); From 8f49925a0fccd90800be5861d1db0c5130bfa2c8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 8 Nov 2024 16:58:37 +0200 Subject: [PATCH 2434/4482] tests: posix: headers: net: Add various IPv6 address check macros Add these Posix specified IPv6 address checking macros IN6_IS_ADDR_UNSPECIFIED IN6_IS_ADDR_LOOPBACK IN6_IS_ADDR_MULTICAST IN6_IS_ADDR_LINKLOCAL IN6_IS_ADDR_SITELOCAL IN6_IS_ADDR_V4MAPPED IN6_IS_ADDR_MC_NODELOCAL IN6_IS_ADDR_MC_LINKLOCAL IN6_IS_ADDR_MC_SITELOCAL IN6_IS_ADDR_MC_ORGLOCAL IN6_IS_ADDR_MC_GLOBAL and tests for them. Signed-off-by: Jukka Rissanen --- include/zephyr/net/socket.h | 40 ++++++++++++++++++++++++++ tests/posix/headers/src/netinet_in_h.c | 39 ++++++++++++++++++------- 2 files changed, 68 insertions(+), 11 deletions(-) diff --git a/include/zephyr/net/socket.h b/include/zephyr/net/socket.h index fec26c9ee9879..fb1865b1296a5 100644 --- a/include/zephyr/net/socket.h +++ b/include/zephyr/net/socket.h @@ -1295,6 +1295,46 @@ struct in6_pktinfo { #define SOMAXCONN 128 /** @} */ +/** + * @name Macros for checking special IPv6 addresses. + * @{ + */ +/** Check unspecified IPv6 address. */ +#define IN6_IS_ADDR_UNSPECIFIED(addr) \ + net_ipv6_addr_cmp(net_ipv6_unspecified_address(), addr) + +/** Check loopback IPv6 address. */ +#define IN6_IS_ADDR_LOOPBACK(addr) net_ipv6_is_addr_loopback(addr) + +/** Check IPv6 multicast address */ +#define IN6_IS_ADDR_MULTICAST(addr) net_ipv6_is_addr_mcast(addr) + +/** Check IPv6 link local address */ +#define IN6_IS_ADDR_LINKLOCAL(addr) net_ipv6_is_ll_addr(addr) + +/** Check IPv6 site local address */ +#define IN6_IS_ADDR_SITELOCAL(addr) net_ipv6_is_sl_addr(addr) + +/** Check IPv6 v4 mapped address */ +#define IN6_IS_ADDR_V4MAPPED(addr) net_ipv6_addr_is_v4_mapped(addr) + +/** Check IPv6 multicast global address */ +#define IN6_IS_ADDR_MC_GLOBAL(addr) net_ipv6_is_addr_mcast_global(addr) + +/** Check IPv6 multicast node local address */ +#define IN6_IS_ADDR_MC_NODELOCAL(addr) net_ipv6_is_addr_mcast_iface(addr) + +/** Check IPv6 multicast link local address */ +#define IN6_IS_ADDR_MC_LINKLOCAL(addr) net_ipv6_is_addr_mcast_link(addr) + +/** Check IPv6 multicast site local address */ +#define IN6_IS_ADDR_MC_SITELOCAL(addr) net_ipv6_is_addr_mcast_site(addr) + +/** Check IPv6 multicast organization local address */ +#define IN6_IS_ADDR_MC_ORGLOCAL(addr) net_ipv6_is_addr_mcast_org(addr) + +/** @} */ + /** @cond INTERNAL_HIDDEN */ /** * @brief Registration information for a given BSD socket family. diff --git a/tests/posix/headers/src/netinet_in_h.c b/tests/posix/headers/src/netinet_in_h.c index f860484b58c25..e3bd53cf1e67c 100644 --- a/tests/posix/headers/src/netinet_in_h.c +++ b/tests/posix/headers/src/netinet_in_h.c @@ -45,6 +45,23 @@ ZTEST(posix_headers, test_netinet_in_h) struct in6_addr any6 = IN6ADDR_ANY_INIT; struct in6_addr lo6 = IN6ADDR_LOOPBACK_INIT; + struct in6_addr mcast6 = { { { 0xff, 0 } } }; + struct in6_addr ll6 = { { { 0xfe, 0x80, 0x01, 0x02, + 0, 0, 0, 0, 0, 0x01 } } }; + struct in6_addr sl6 = { { { 0xfe, 0xc0, 0, 0x01, 0x02 } } }; + struct in6_addr v4mapped = { { { 0, 0, 0, 0, 0, 0, 0, 0, + 0xff, 0xff, 0xff, 0xff, 0xc0, 0, 0x02, 0x01 } } }; + struct in6_addr mcnl6 = { { { 0xff, 0x01, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0x01 } } }; + struct in6_addr mcll6 = { { { 0xff, 0x02, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0x01 } } }; + struct in6_addr mcsl6 = { { { 0xff, 0x05, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0x01 } } }; + struct in6_addr mcol6 = { { { 0xff, 0x08, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0x01 } } }; + struct in6_addr mcg6 = { { { 0xff, 0x0e, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0x01 } } }; + /* not implemented */ /* zassert_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_multiaddr)); */ /* not implemented */ @@ -71,18 +88,18 @@ ZTEST(posix_headers, test_netinet_in_h) zassert_not_equal(-1, IPV6_UNICAST_HOPS); zassert_not_equal(-1, IPV6_V6ONLY); - /* IN6_IS_ADDR_UNSPECIFIED(&any6); */ /* not implemented */ - /* IN6_IS_ADDR_LOOPBACK(&lo6); */ /* not implemented */ + zassert_true(IN6_IS_ADDR_UNSPECIFIED(&any6)); + zassert_true(IN6_IS_ADDR_LOOPBACK(&lo6)); - /* IN6_IS_ADDR_MULTICAST(&lo6); */ /* not implemented */ - /* IN6_IS_ADDR_LINKLOCAL(&lo6); */ /* not implemented */ - /* IN6_IS_ADDR_SITELOCAL(&lo6); */ /* not implemented */ - /* IN6_IS_ADDR_V4MAPPED(&lo6); */ /* not implemented */ + zassert_true(IN6_IS_ADDR_MULTICAST(&mcast6)); + zassert_true(IN6_IS_ADDR_LINKLOCAL(&ll6)); + zassert_true(IN6_IS_ADDR_SITELOCAL(&sl6)); + zassert_true(IN6_IS_ADDR_V4MAPPED(&v4mapped)); /* IN6_IS_ADDR_V4COMPAT(&lo6); */ /* not implemented */ - /* IN6_IS_ADDR_MC_NODELOCAL(&lo6); */ /* not implemented */ - /* IN6_IS_ADDR_MC_LINKLOCAL(&lo6); */ /* not implemented */ - /* IN6_IS_ADDR_MC_SITELOCAL(&lo6); */ /* not implemented */ - /* IN6_IS_ADDR_MC_ORGLOCAL(&lo6); */ /* not implemented */ - /* IN6_IS_ADDR_MC_GLOBAL(&lo6); */ /* not implemented */ + zassert_true(IN6_IS_ADDR_MC_NODELOCAL(&mcnl6)); + zassert_true(IN6_IS_ADDR_MC_LINKLOCAL(&mcll6)); + zassert_true(IN6_IS_ADDR_MC_SITELOCAL(&mcsl6)); + zassert_true(IN6_IS_ADDR_MC_ORGLOCAL(&mcol6)); + zassert_true(IN6_IS_ADDR_MC_GLOBAL(&mcg6)); } #pragma GCC diagnostic pop From d1e42fc147a6f216520c0b7949c22a405cff951a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 8 Nov 2024 17:16:49 +0200 Subject: [PATCH 2435/4482] tests: posix: headers: net: Add test for ipv6_mreq The "struct ipv6_mreq" is supported so enable the tests for it. Signed-off-by: Jukka Rissanen --- tests/posix/headers/src/netinet_in_h.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/posix/headers/src/netinet_in_h.c b/tests/posix/headers/src/netinet_in_h.c index e3bd53cf1e67c..25cceb6aa97df 100644 --- a/tests/posix/headers/src/netinet_in_h.c +++ b/tests/posix/headers/src/netinet_in_h.c @@ -62,10 +62,8 @@ ZTEST(posix_headers, test_netinet_in_h) struct in6_addr mcg6 = { { { 0xff, 0x0e, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01 } } }; - /* not implemented */ - /* zassert_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_multiaddr)); */ - /* not implemented */ - /* zassert_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_interface)); */ + zassert_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_multiaddr)); + zassert_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_ifindex)); zassert_not_equal(-1, IPPROTO_IP); zassert_not_equal(-1, IPPROTO_IPV6); From 5b007183d0e3c5b4493ea82853000b0c7ce6c553 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 11 Nov 2024 13:57:04 +0200 Subject: [PATCH 2436/4482] tests: posix: headers: net: Convert to use zexpect Use zexpect instead of zassert so that the failed tests do not stop the test execution but we run all the tests. Signed-off-by: Jukka Rissanen --- tests/posix/headers/src/netinet_in_h.c | 102 ++++++++++++------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/tests/posix/headers/src/netinet_in_h.c b/tests/posix/headers/src/netinet_in_h.c index 25cceb6aa97df..141e2eb69fcf5 100644 --- a/tests/posix/headers/src/netinet_in_h.c +++ b/tests/posix/headers/src/netinet_in_h.c @@ -21,27 +21,27 @@ */ ZTEST(posix_headers, test_netinet_in_h) { - zassert_equal(sizeof(in_port_t), sizeof(uint16_t)); - zassert_equal(sizeof(in_addr_t), sizeof(uint32_t)); + zexpect_equal(sizeof(in_port_t), sizeof(uint16_t)); + zexpect_equal(sizeof(in_addr_t), sizeof(uint32_t)); - zassert_not_equal(-1, offsetof(struct in_addr, s_addr)); + zexpect_not_equal(-1, offsetof(struct in_addr, s_addr)); - zassert_not_equal(-1, offsetof(struct sockaddr_in, sin_family)); - zassert_not_equal(-1, offsetof(struct sockaddr_in, sin_port)); - zassert_not_equal(-1, offsetof(struct sockaddr_in, sin_addr)); + zexpect_not_equal(-1, offsetof(struct sockaddr_in, sin_family)); + zexpect_not_equal(-1, offsetof(struct sockaddr_in, sin_port)); + zexpect_not_equal(-1, offsetof(struct sockaddr_in, sin_addr)); - zassert_not_equal(-1, offsetof(struct in6_addr, s6_addr)); - zassert_equal(sizeof(((struct in6_addr *)NULL)->s6_addr), 16 * sizeof(uint8_t)); + zexpect_not_equal(-1, offsetof(struct in6_addr, s6_addr)); + zexpect_equal(sizeof(((struct in6_addr *)NULL)->s6_addr), 16 * sizeof(uint8_t)); - zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_family)); - zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_port)); + zexpect_not_equal(-1, offsetof(struct sockaddr_in6, sin6_family)); + zexpect_not_equal(-1, offsetof(struct sockaddr_in6, sin6_port)); /* not implemented */ - /* zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_flowinfo)); */ - zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_addr)); - zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_scope_id)); + /* zexpect_not_equal(-1, offsetof(struct sockaddr_in6, sin6_flowinfo)); */ + zexpect_not_equal(-1, offsetof(struct sockaddr_in6, sin6_addr)); + zexpect_not_equal(-1, offsetof(struct sockaddr_in6, sin6_scope_id)); - zassert_not_null(&in6addr_any); - zassert_not_null(&in6addr_loopback); + zexpect_not_null(&in6addr_any); + zexpect_not_null(&in6addr_loopback); struct in6_addr any6 = IN6ADDR_ANY_INIT; struct in6_addr lo6 = IN6ADDR_LOOPBACK_INIT; @@ -62,42 +62,42 @@ ZTEST(posix_headers, test_netinet_in_h) struct in6_addr mcg6 = { { { 0xff, 0x0e, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01 } } }; - zassert_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_multiaddr)); - zassert_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_ifindex)); - - zassert_not_equal(-1, IPPROTO_IP); - zassert_not_equal(-1, IPPROTO_IPV6); - zassert_not_equal(-1, IPPROTO_ICMP); - zassert_not_equal(-1, IPPROTO_RAW); - zassert_not_equal(-1, IPPROTO_TCP); - zassert_not_equal(-1, IPPROTO_UDP); - - zassert_not_equal(-1, INADDR_ANY); - zassert_equal(0xffffffff, INADDR_BROADCAST); - - zassert_equal(INET_ADDRSTRLEN, 16); - zassert_equal(INET6_ADDRSTRLEN, 46); - - zassert_equal(IPV6_ADD_MEMBERSHIP, IPV6_JOIN_GROUP); - zassert_equal(IPV6_DROP_MEMBERSHIP, IPV6_LEAVE_GROUP); - zassert_not_equal(-1, IPV6_MULTICAST_HOPS); - /* zassert_not_equal(-1, IPV6_MULTICAST_IF); */ /* not implemented */ - /* zassert_not_equal(-1, IPV6_MULTICAST_LOOP); */ /* not implemented */ - zassert_not_equal(-1, IPV6_UNICAST_HOPS); - zassert_not_equal(-1, IPV6_V6ONLY); - - zassert_true(IN6_IS_ADDR_UNSPECIFIED(&any6)); - zassert_true(IN6_IS_ADDR_LOOPBACK(&lo6)); - - zassert_true(IN6_IS_ADDR_MULTICAST(&mcast6)); - zassert_true(IN6_IS_ADDR_LINKLOCAL(&ll6)); - zassert_true(IN6_IS_ADDR_SITELOCAL(&sl6)); - zassert_true(IN6_IS_ADDR_V4MAPPED(&v4mapped)); + zexpect_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_multiaddr)); + zexpect_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_ifindex)); + + zexpect_not_equal(-1, IPPROTO_IP); + zexpect_not_equal(-1, IPPROTO_IPV6); + zexpect_not_equal(-1, IPPROTO_ICMP); + zexpect_not_equal(-1, IPPROTO_RAW); + zexpect_not_equal(-1, IPPROTO_TCP); + zexpect_not_equal(-1, IPPROTO_UDP); + + zexpect_not_equal(-1, INADDR_ANY); + zexpect_equal(0xffffffff, INADDR_BROADCAST); + + zexpect_equal(INET_ADDRSTRLEN, 16); + zexpect_equal(INET6_ADDRSTRLEN, 46); + + zexpect_equal(IPV6_ADD_MEMBERSHIP, IPV6_JOIN_GROUP); + zexpect_equal(IPV6_DROP_MEMBERSHIP, IPV6_LEAVE_GROUP); + zexpect_not_equal(-1, IPV6_MULTICAST_HOPS); + /* zexpect_not_equal(-1, IPV6_MULTICAST_IF); */ /* not implemented */ + /* zexpect_not_equal(-1, IPV6_MULTICAST_LOOP); */ /* not implemented */ + zexpect_not_equal(-1, IPV6_UNICAST_HOPS); + zexpect_not_equal(-1, IPV6_V6ONLY); + + zexpect_true(IN6_IS_ADDR_UNSPECIFIED(&any6)); + zexpect_true(IN6_IS_ADDR_LOOPBACK(&lo6)); + + zexpect_true(IN6_IS_ADDR_MULTICAST(&mcast6)); + zexpect_true(IN6_IS_ADDR_LINKLOCAL(&ll6)); + zexpect_true(IN6_IS_ADDR_SITELOCAL(&sl6)); + zexpect_true(IN6_IS_ADDR_V4MAPPED(&v4mapped)); /* IN6_IS_ADDR_V4COMPAT(&lo6); */ /* not implemented */ - zassert_true(IN6_IS_ADDR_MC_NODELOCAL(&mcnl6)); - zassert_true(IN6_IS_ADDR_MC_LINKLOCAL(&mcll6)); - zassert_true(IN6_IS_ADDR_MC_SITELOCAL(&mcsl6)); - zassert_true(IN6_IS_ADDR_MC_ORGLOCAL(&mcol6)); - zassert_true(IN6_IS_ADDR_MC_GLOBAL(&mcg6)); + zexpect_true(IN6_IS_ADDR_MC_NODELOCAL(&mcnl6)); + zexpect_true(IN6_IS_ADDR_MC_LINKLOCAL(&mcll6)); + zexpect_true(IN6_IS_ADDR_MC_SITELOCAL(&mcsl6)); + zexpect_true(IN6_IS_ADDR_MC_ORGLOCAL(&mcol6)); + zexpect_true(IN6_IS_ADDR_MC_GLOBAL(&mcg6)); } #pragma GCC diagnostic pop From 51c5bc7667cdf99fa1ec5ef0e52eb6ea8d6a8ce3 Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Thu, 7 Nov 2024 23:21:32 +0100 Subject: [PATCH 2437/4482] tests: drivers: gpio: gpio_basic_api: enable for nrf54l15dk Incorrectly removed during transfer pdk->dk. Signed-off-by: Piotr Kosycarz --- .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay new file mode 100644 index 0000000000000..8eb1b3c9f9ff7 --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + resources { + compatible = "test-gpio-basic-api"; + out-gpios = <&gpio1 10 0>; + in-gpios = <&gpio1 11 0>; + }; +}; + +&gpiote20 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; From e4b830fe7a8a991b4e326d61490d715e5a25889d Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Thu, 7 Nov 2024 23:23:20 +0100 Subject: [PATCH 2438/4482] tests: drivers: sensor: temp_sensor: enable for nrf54l15dk Incorrectly removed during transfer pdk->dk. Signed-off-by: Piotr Kosycarz --- .../temp_sensor/boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tests/drivers/sensor/temp_sensor/boards/nrf54l15dk_nrf54l15_cpuapp.overlay diff --git a/tests/drivers/sensor/temp_sensor/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/sensor/temp_sensor/boards/nrf54l15dk_nrf54l15_cpuapp.overlay new file mode 100644 index 0000000000000..435e4f4a6ccf8 --- /dev/null +++ b/tests/drivers/sensor/temp_sensor/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -0,0 +1,3 @@ +temp_sensor: &temp { + status = "okay"; +}; From c759b8ac3dc629fdcf05d1775424a50983467a8c Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 18 Nov 2023 11:50:38 -0800 Subject: [PATCH 2439/4482] libc/picolibc: Split hooks into separate files This splits the picolibc helper functions into separate files instead of smashing them all together. Signed-off-by: Keith Packard --- boards/qemu/x86/qemu_x86_tiny.ld | 6 +- lib/libc/picolibc/CMakeLists.txt | 13 +- lib/libc/picolibc/assert.c | 28 ++++ lib/libc/picolibc/cbprintf.c | 31 ++++ lib/libc/picolibc/chk_fail.c | 18 ++ lib/libc/picolibc/errno_wrap.c | 21 +++ lib/libc/picolibc/exit.c | 15 ++ lib/libc/picolibc/libc-hooks.c | 253 ----------------------------- lib/libc/picolibc/locks.c | 106 ++++++++++++ lib/libc/picolibc/picolibc-hooks.h | 32 ++++ lib/libc/picolibc/stdio.c | 54 ++++++ 11 files changed, 317 insertions(+), 260 deletions(-) create mode 100644 lib/libc/picolibc/assert.c create mode 100644 lib/libc/picolibc/cbprintf.c create mode 100644 lib/libc/picolibc/chk_fail.c create mode 100644 lib/libc/picolibc/errno_wrap.c create mode 100644 lib/libc/picolibc/exit.c delete mode 100644 lib/libc/picolibc/libc-hooks.c create mode 100644 lib/libc/picolibc/locks.c create mode 100644 lib/libc/picolibc/picolibc-hooks.h create mode 100644 lib/libc/picolibc/stdio.c diff --git a/boards/qemu/x86/qemu_x86_tiny.ld b/boards/qemu/x86/qemu_x86_tiny.ld index 548e5fbdcb03b..607b096e9d779 100644 --- a/boards/qemu/x86/qemu_x86_tiny.ld +++ b/boards/qemu/x86/qemu_x86_tiny.ld @@ -144,10 +144,10 @@ MEMORY #endif /* CONFIG_NEWLIB_LIBC */ #ifdef CONFIG_PICOLIBC -/* For Picolibc libc-hook.c. */ +/* For Picolibc, all files under lib/libc/picolibc */ #define LIB_C_IN_SECT(lsect) \ - *liblib__libc__picolibc.a:libc-hooks.c.obj(.##lsect) \ - *liblib__libc__picolibc.a:libc-hooks.c.obj(.##lsect##.*) + *liblib__libc__picolibc.a:(.##lsect) \ + *liblib__libc__picolibc.a:(.##lsect##.*) #endif /* CONFIG_PICOLIBC */ diff --git a/lib/libc/picolibc/CMakeLists.txt b/lib/libc/picolibc/CMakeLists.txt index 14af66b7b7dc3..d1abfa675d25f 100644 --- a/lib/libc/picolibc/CMakeLists.txt +++ b/lib/libc/picolibc/CMakeLists.txt @@ -1,10 +1,15 @@ # SPDX-License-Identifier: Apache-2.0 zephyr_library() -zephyr_library_sources(libc-hooks.c) - -# Do not allow LTO when compiling libc-hooks.c file -set_source_files_properties(libc-hooks.c PROPERTIES COMPILE_OPTIONS $) +zephyr_library_sources( + assert.c + cbprintf.c + chk_fail.c + errno_wrap.c + exit.c + locks.c + stdio.c + ) # define __LINUX_ERRNO_EXTENSIONS__ so we get errno defines like -ESHUTDOWN # used by the network stack diff --git a/lib/libc/picolibc/assert.c b/lib/libc/picolibc/assert.c new file mode 100644 index 0000000000000..806d996a230a1 --- /dev/null +++ b/lib/libc/picolibc/assert.c @@ -0,0 +1,28 @@ +/* + * Copyright © 2021, Keith Packard + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "picolibc-hooks.h" + +#ifdef CONFIG_PICOLIBC_ASSERT_VERBOSE + +FUNC_NORETURN void __assert_func(const char *file, int line, + const char *function, const char *expression) +{ + __ASSERT(0, "assertion \"%s\" failed: file \"%s\", line %d%s%s\n", + expression, file, line, + function ? ", function: " : "", function ? function : ""); + CODE_UNREACHABLE; +} + +#else + +FUNC_NORETURN void __assert_no_args(void) +{ + __ASSERT_NO_MSG(0); + CODE_UNREACHABLE; +} + +#endif diff --git a/lib/libc/picolibc/cbprintf.c b/lib/libc/picolibc/cbprintf.c new file mode 100644 index 0000000000000..a81aaaf22bdfa --- /dev/null +++ b/lib/libc/picolibc/cbprintf.c @@ -0,0 +1,31 @@ +/* + * Copyright © 2021, Keith Packard + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "picolibc-hooks.h" + +struct cb_bits { + FILE f; + cbprintf_cb out; + void *ctx; +}; + +static int cbputc(char c, FILE *_s) +{ + struct cb_bits *s = (struct cb_bits *) _s; + + (*s->out) (c, s->ctx); + return 0; +} + +int cbvprintf(cbprintf_cb out, void *ctx, const char *fp, va_list ap) +{ + struct cb_bits s = { + .f = FDEV_SETUP_STREAM(cbputc, NULL, NULL, _FDEV_SETUP_WRITE), + .out = out, + .ctx = ctx, + }; + return vfprintf(&s.f, fp, ap); +} diff --git a/lib/libc/picolibc/chk_fail.c b/lib/libc/picolibc/chk_fail.c new file mode 100644 index 0000000000000..24abbcb34f5b5 --- /dev/null +++ b/lib/libc/picolibc/chk_fail.c @@ -0,0 +1,18 @@ +/* + * Copyright © 2021, Keith Packard + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "picolibc-hooks.h" + +/* This function gets called if static buffer overflow detection is enabled on + * stdlib side (Picolibc here), in case such an overflow is detected. Picolibc + * provides an implementation not suitable for us, so we override it here. + */ +__weak FUNC_NORETURN void __chk_fail(void) +{ + printk("* buffer overflow detected *\n"); + z_except_reason(K_ERR_STACK_CHK_FAIL); + CODE_UNREACHABLE; +} diff --git a/lib/libc/picolibc/errno_wrap.c b/lib/libc/picolibc/errno_wrap.c new file mode 100644 index 0000000000000..4e9b81cec54b9 --- /dev/null +++ b/lib/libc/picolibc/errno_wrap.c @@ -0,0 +1,21 @@ +/* + * Copyright © 2021, Keith Packard + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "picolibc-hooks.h" + +#ifndef CONFIG_LIBC_ERRNO + +/* + * Picolibc needs to be able to declare this itself so that the library + * doesn't end up needing zephyr header files. That means using a regular + * function instead of an inline. + */ +int *z_errno_wrap(void) +{ + return z_errno(); +} + +#endif diff --git a/lib/libc/picolibc/exit.c b/lib/libc/picolibc/exit.c new file mode 100644 index 0000000000000..cf4ab856e25ac --- /dev/null +++ b/lib/libc/picolibc/exit.c @@ -0,0 +1,15 @@ +/* + * Copyright © 2021, Keith Packard + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "picolibc-hooks.h" + +__weak void _exit(int status) +{ + printf("exit\n"); + while (1) { + Z_SPIN_DELAY(100); + } +} diff --git a/lib/libc/picolibc/libc-hooks.c b/lib/libc/picolibc/libc-hooks.c deleted file mode 100644 index cefb0d46ddd37..0000000000000 --- a/lib/libc/picolibc/libc-hooks.c +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright © 2021, Keith Packard - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef CONFIG_MMU -#include -#endif - -#define LIBC_BSS K_APP_BMEM(z_libc_partition) -#define LIBC_DATA K_APP_DMEM(z_libc_partition) - -static LIBC_DATA int (*_stdout_hook)(int); - -int z_impl_zephyr_fputc(int a, FILE *out) -{ - (*_stdout_hook)(a); - return 0; -} - -#ifdef CONFIG_USERSPACE -static inline int z_vrfy_zephyr_fputc(int c, FILE *stream) -{ - return z_impl_zephyr_fputc(c, stream); -} -#include -#endif - -static int picolibc_put(char a, FILE *f) -{ - zephyr_fputc(a, f); - return 0; -} - -static LIBC_DATA FILE __stdout = FDEV_SETUP_STREAM(picolibc_put, NULL, NULL, 0); -static LIBC_DATA FILE __stdin = FDEV_SETUP_STREAM(NULL, NULL, NULL, 0); - -#ifdef __strong_reference -#define STDIO_ALIAS(x) __strong_reference(stdout, x); -#else -#define STDIO_ALIAS(x) FILE *const x = &__stdout; -#endif - -FILE *const stdin = &__stdin; -FILE *const stdout = &__stdout; -STDIO_ALIAS(stderr); - -void __stdout_hook_install(int (*hook)(int)) -{ - _stdout_hook = hook; - __stdout.flags |= _FDEV_SETUP_WRITE; -} - -void __stdin_hook_install(unsigned char (*hook)(void)) -{ - __stdin.get = (int (*)(FILE *)) hook; - __stdin.flags |= _FDEV_SETUP_READ; -} - -#include - -struct cb_bits { - FILE f; - cbprintf_cb out; - void *ctx; -}; - -static int cbputc(char c, FILE *_s) -{ - struct cb_bits *s = (struct cb_bits *) _s; - - (*s->out) (c, s->ctx); - return 0; -} - -int cbvprintf(cbprintf_cb out, void *ctx, const char *fp, va_list ap) -{ - struct cb_bits s = { - .f = FDEV_SETUP_STREAM(cbputc, NULL, NULL, _FDEV_SETUP_WRITE), - .out = out, - .ctx = ctx, - }; - return vfprintf(&s.f, fp, ap); -} - -__weak void _exit(int status) -{ - printk("exit\n"); - while (1) { - Z_SPIN_DELAY(100); - } -} - -#ifdef CONFIG_MULTITHREADING -#define _LOCK_T void * -K_MUTEX_DEFINE(__lock___libc_recursive_mutex); - -#ifdef CONFIG_USERSPACE -/* Grant public access to picolibc lock after boot */ -static int picolibc_locks_prepare(void) -{ - - /* Initialise recursive locks */ - k_object_access_all_grant(&__lock___libc_recursive_mutex); - - return 0; -} - -SYS_INIT(picolibc_locks_prepare, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); -#endif /* CONFIG_USERSPACE */ - -/* Create a new dynamic recursive lock */ -void __retarget_lock_init_recursive(_LOCK_T *lock) -{ - __ASSERT_NO_MSG(lock != NULL); - - /* Allocate mutex object */ -#ifndef CONFIG_USERSPACE - *lock = malloc(sizeof(struct k_mutex)); -#else - *lock = k_object_alloc(K_OBJ_MUTEX); -#endif /* !CONFIG_USERSPACE */ - __ASSERT(*lock != NULL, "recursive lock allocation failed"); - - k_mutex_init((struct k_mutex *)*lock); -} - -/* Create a new dynamic non-recursive lock */ -void __retarget_lock_init(_LOCK_T *lock) -{ - __retarget_lock_init_recursive(lock); -} - -/* Close dynamic recursive lock */ -void __retarget_lock_close_recursive(_LOCK_T lock) -{ - __ASSERT_NO_MSG(lock != NULL); -#ifndef CONFIG_USERSPACE - free(lock); -#else - k_object_release(lock); -#endif /* !CONFIG_USERSPACE */ -} - -/* Close dynamic non-recursive lock */ -void __retarget_lock_close(_LOCK_T lock) -{ - __retarget_lock_close_recursive(lock); -} - -/* Acquiure recursive lock */ -void __retarget_lock_acquire_recursive(_LOCK_T lock) -{ - __ASSERT_NO_MSG(lock != NULL); - k_mutex_lock((struct k_mutex *)lock, K_FOREVER); -} - -/* Acquiure non-recursive lock */ -void __retarget_lock_acquire(_LOCK_T lock) -{ - __retarget_lock_acquire_recursive(lock); -} - -/* Try acquiring recursive lock */ -int __retarget_lock_try_acquire_recursive(_LOCK_T lock) -{ - __ASSERT_NO_MSG(lock != NULL); - return !k_mutex_lock((struct k_mutex *)lock, K_NO_WAIT); -} - -/* Try acquiring non-recursive lock */ -int __retarget_lock_try_acquire(_LOCK_T lock) -{ - return __retarget_lock_try_acquire_recursive(lock); -} - -/* Release recursive lock */ -void __retarget_lock_release_recursive(_LOCK_T lock) -{ - __ASSERT_NO_MSG(lock != NULL); - k_mutex_unlock((struct k_mutex *)lock); -} - -/* Release non-recursive lock */ -void __retarget_lock_release(_LOCK_T lock) -{ - __retarget_lock_release_recursive(lock); -} - -#endif /* CONFIG_MULTITHREADING */ - -#ifdef CONFIG_PICOLIBC_ASSERT_VERBOSE - -FUNC_NORETURN void __assert_func(const char *file, int line, - const char *function, const char *expression) -{ - __ASSERT(0, "assertion \"%s\" failed: file \"%s\", line %d%s%s\n", - expression, file, line, - function ? ", function: " : "", function ? function : ""); - CODE_UNREACHABLE; -} - -#else - -FUNC_NORETURN void __assert_no_args(void) -{ - __ASSERT_NO_MSG(0); - CODE_UNREACHABLE; -} - -#endif - -/* This function gets called if static buffer overflow detection is enabled on - * stdlib side (Picolibc here), in case such an overflow is detected. Picolibc - * provides an implementation not suitable for us, so we override it here. - */ -__weak FUNC_NORETURN void __chk_fail(void) -{ - printk("* buffer overflow detected *\n"); - z_except_reason(K_ERR_STACK_CHK_FAIL); - CODE_UNREACHABLE; -} - -#ifndef CONFIG_LIBC_ERRNO - -/* - * Picolibc needs to be able to declare this itself so that the library - * doesn't end up needing zephyr header files. That means using a regular - * function instead of an inline. - */ -int *z_errno_wrap(void) -{ - return z_errno(); -} - -#endif diff --git a/lib/libc/picolibc/locks.c b/lib/libc/picolibc/locks.c new file mode 100644 index 0000000000000..c32ab15839848 --- /dev/null +++ b/lib/libc/picolibc/locks.c @@ -0,0 +1,106 @@ +/* + * Copyright © 2021, Keith Packard + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "picolibc-hooks.h" + +#ifdef CONFIG_MULTITHREADING +#define _LOCK_T void * +K_MUTEX_DEFINE(__lock___libc_recursive_mutex); + +#ifdef CONFIG_USERSPACE +/* Grant public access to picolibc lock after boot */ +static int picolibc_locks_prepare(void) +{ + + /* Initialise recursive locks */ + k_object_access_all_grant(&__lock___libc_recursive_mutex); + + return 0; +} + +SYS_INIT(picolibc_locks_prepare, POST_KERNEL, + CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); +#endif /* CONFIG_USERSPACE */ + +/* Create a new dynamic recursive lock */ +void __retarget_lock_init_recursive(_LOCK_T *lock) +{ + __ASSERT_NO_MSG(lock != NULL); + + /* Allocate mutex object */ +#ifndef CONFIG_USERSPACE + *lock = malloc(sizeof(struct k_mutex)); +#else + *lock = k_object_alloc(K_OBJ_MUTEX); +#endif /* !CONFIG_USERSPACE */ + __ASSERT(*lock != NULL, "recursive lock allocation failed"); + + k_mutex_init((struct k_mutex *)*lock); +} + +/* Create a new dynamic non-recursive lock */ +void __retarget_lock_init(_LOCK_T *lock) +{ + __retarget_lock_init_recursive(lock); +} + +/* Close dynamic recursive lock */ +void __retarget_lock_close_recursive(_LOCK_T lock) +{ + __ASSERT_NO_MSG(lock != NULL); +#ifndef CONFIG_USERSPACE + free(lock); +#else + k_object_release(lock); +#endif /* !CONFIG_USERSPACE */ +} + +/* Close dynamic non-recursive lock */ +void __retarget_lock_close(_LOCK_T lock) +{ + __retarget_lock_close_recursive(lock); +} + +/* Acquiure recursive lock */ +void __retarget_lock_acquire_recursive(_LOCK_T lock) +{ + __ASSERT_NO_MSG(lock != NULL); + k_mutex_lock((struct k_mutex *)lock, K_FOREVER); +} + +/* Acquiure non-recursive lock */ +void __retarget_lock_acquire(_LOCK_T lock) +{ + __retarget_lock_acquire_recursive(lock); +} + +/* Try acquiring recursive lock */ +int __retarget_lock_try_acquire_recursive(_LOCK_T lock) +{ + __ASSERT_NO_MSG(lock != NULL); + return !k_mutex_lock((struct k_mutex *)lock, K_NO_WAIT); +} + +/* Try acquiring non-recursive lock */ +int __retarget_lock_try_acquire(_LOCK_T lock) +{ + return __retarget_lock_try_acquire_recursive(lock); +} + +/* Release recursive lock */ +void __retarget_lock_release_recursive(_LOCK_T lock) +{ + __ASSERT_NO_MSG(lock != NULL); + k_mutex_unlock((struct k_mutex *)lock); +} + +/* Release non-recursive lock */ +void __retarget_lock_release(_LOCK_T lock) +{ + __retarget_lock_release_recursive(lock); +} + +#endif /* CONFIG_MULTITHREADING */ diff --git a/lib/libc/picolibc/picolibc-hooks.h b/lib/libc/picolibc/picolibc-hooks.h new file mode 100644 index 0000000000000..1800e5ee404e3 --- /dev/null +++ b/lib/libc/picolibc/picolibc-hooks.h @@ -0,0 +1,32 @@ +/* + * Copyright © 2021, Keith Packard + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef _PICOLIBC_HOOKS_H_ +#define _PICOLIBC_HOOKS_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef CONFIG_MMU +#include +#endif + +#define LIBC_BSS K_APP_BMEM(z_libc_partition) +#define LIBC_DATA K_APP_DMEM(z_libc_partition) + +#endif /* _PICOLIBC_HOOKS_H_ */ diff --git a/lib/libc/picolibc/stdio.c b/lib/libc/picolibc/stdio.c new file mode 100644 index 0000000000000..342eedc877101 --- /dev/null +++ b/lib/libc/picolibc/stdio.c @@ -0,0 +1,54 @@ +/* + * Copyright © 2021, Keith Packard + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "picolibc-hooks.h" + +static LIBC_DATA int (*_stdout_hook)(int); + +int z_impl_zephyr_fputc(int a, FILE *out) +{ + (*_stdout_hook)(a); + return 0; +} + +#ifdef CONFIG_USERSPACE +static inline int z_vrfy_zephyr_fputc(int c, FILE *stream) +{ + return z_impl_zephyr_fputc(c, stream); +} +#include +#endif + +static int picolibc_put(char a, FILE *f) +{ + zephyr_fputc(a, f); + return 0; +} + +static LIBC_DATA FILE __stdout = FDEV_SETUP_STREAM(picolibc_put, NULL, NULL, 0); +static LIBC_DATA FILE __stdin = FDEV_SETUP_STREAM(NULL, NULL, NULL, 0); + +#ifdef __strong_reference +#define STDIO_ALIAS(x) __strong_reference(stdout, x); +#else +#define STDIO_ALIAS(x) FILE *const x = &__stdout; +#endif + +FILE *const stdin = &__stdin; +FILE *const stdout = &__stdout; +STDIO_ALIAS(stderr); + +void __stdout_hook_install(int (*hook)(int)) +{ + _stdout_hook = hook; + __stdout.flags |= _FDEV_SETUP_WRITE; +} + +void __stdin_hook_install(unsigned char (*hook)(void)) +{ + __stdin.get = (int (*)(FILE *)) hook; + __stdin.flags |= _FDEV_SETUP_READ; +} From 7e7e1aa719fced86c62b7518cab7ef1e5d13382a Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 7 Nov 2024 21:25:10 +0100 Subject: [PATCH 2440/4482] Bluetooth: BAP: Fix CONFIG_BT_BAP_BASS_MAX_SUBGROUPS include issue There were a few cases where CONFIG_BT_BAP_BASS_MAX_SUBGROUPS was used in structs in the public header files. Unfortunately using a Kconfig for an array size will cause include issues if the file is included without the Kconfig being available. For now add and use a new #define value that will be 0 if CONFIG_BT_BAP_BASS_MAX_SUBGROUPS is not defined. Signed-off-by: Emil Gydesen --- include/zephyr/bluetooth/audio/bap.h | 19 ++++++++++++------- include/zephyr/bluetooth/audio/cap.h | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/include/zephyr/bluetooth/audio/bap.h b/include/zephyr/bluetooth/audio/bap.h index 90caa07eb2906..38356a175271b 100644 --- a/include/zephyr/bluetooth/audio/bap.h +++ b/include/zephyr/bluetooth/audio/bap.h @@ -41,6 +41,12 @@ extern "C" { #endif +#if defined(CONFIG_BT_BAP_BASS_MAX_SUBGROUPS) +#define BT_BAP_BASS_MAX_SUBGROUPS CONFIG_BT_BAP_BASS_MAX_SUBGROUPS +#else +#define BT_BAP_BASS_MAX_SUBGROUPS 0 +#endif /* CONFIG_BT_BAP_BASS_MAX_SUBGROUPS*/ + /** An invalid Broadcast ID */ #define BT_BAP_INVALID_BROADCAST_ID 0xFFFFFFFFU @@ -582,7 +588,7 @@ struct bt_bap_scan_delegator_recv_state { * If the @ref bt_bap_bass_subgroup.bis_sync value is @ref BT_BAP_BIS_SYNC_FAILED then it * indicates that the BIG sync failed. */ - struct bt_bap_bass_subgroup subgroups[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]; + struct bt_bap_bass_subgroup subgroups[BT_BAP_BASS_MAX_SUBGROUPS]; }; /** @@ -676,7 +682,7 @@ struct bt_bap_scan_delegator_cb { */ int (*bis_sync_req)(struct bt_conn *conn, const struct bt_bap_scan_delegator_recv_state *recv_state, - const uint32_t bis_sync_req[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]); + const uint32_t bis_sync_req[BT_BAP_BASS_MAX_SUBGROUPS]); /** * @brief Broadcast Assistant scanning state callback * @@ -2377,9 +2383,8 @@ int bt_bap_scan_delegator_set_pa_state(uint8_t src_id, * subgroup. * @return int Error value. 0 on success, ERRNO on fail. */ -int bt_bap_scan_delegator_set_bis_sync_state( - uint8_t src_id, - uint32_t bis_synced[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]); +int bt_bap_scan_delegator_set_bis_sync_state(uint8_t src_id, + uint32_t bis_synced[BT_BAP_BASS_MAX_SUBGROUPS]); /** Parameters for bt_bap_scan_delegator_add_src() */ struct bt_bap_scan_delegator_add_src_param { @@ -2399,7 +2404,7 @@ struct bt_bap_scan_delegator_add_src_param { uint8_t num_subgroups; /** Subgroup specific information */ - struct bt_bap_bass_subgroup subgroups[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]; + struct bt_bap_bass_subgroup subgroups[BT_BAP_BASS_MAX_SUBGROUPS]; }; /** @@ -2437,7 +2442,7 @@ struct bt_bap_scan_delegator_mod_src_param { * If a subgroup's metadata_len is set to 0, the existing metadata * for the subgroup will remain unchanged */ - struct bt_bap_bass_subgroup subgroups[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]; + struct bt_bap_bass_subgroup subgroups[BT_BAP_BASS_MAX_SUBGROUPS]; }; /** diff --git a/include/zephyr/bluetooth/audio/cap.h b/include/zephyr/bluetooth/audio/cap.h index 69e984711e87c..359aa45632bff 100644 --- a/include/zephyr/bluetooth/audio/cap.h +++ b/include/zephyr/bluetooth/audio/cap.h @@ -918,7 +918,7 @@ struct bt_cap_commander_broadcast_reception_start_member_param { * * At least one bit in one of the subgroups bis_sync parameters shall be set. */ - struct bt_bap_bass_subgroup subgroups[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]; + struct bt_bap_bass_subgroup subgroups[BT_BAP_BASS_MAX_SUBGROUPS]; /** Number of subgroups */ size_t num_subgroups; From 3f95fd4349d332f83cbd824ba9c5f7a9695ffd97 Mon Sep 17 00:00:00 2001 From: Vijay Hiremath Date: Thu, 7 Nov 2024 18:48:29 -0800 Subject: [PATCH 2441/4482] eSPI: NPCX/ITE: Enable conditional virtual wire valid bit check On the new Intel SoC, the "Valid" bit of the Virtual Wire is set only for Virtual Wires that undergo changes. This behavior differs from previous generations. Therefore, to maintain backward compatibility, a conditional check for the virtual wire valid bit is added for processing the virtual wire level. Signed-off-by: Vijay Hiremath --- drivers/espi/Kconfig | 9 +++++++++ drivers/espi/espi_it8xxx2.c | 12 ++++++++---- drivers/espi/espi_npcx.c | 11 +++++++++-- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/espi/Kconfig b/drivers/espi/Kconfig index 0bfacd1581259..07dc6e997edc3 100644 --- a/drivers/espi/Kconfig +++ b/drivers/espi/Kconfig @@ -46,6 +46,15 @@ config ESPI_VWIRE_CHANNEL help eSPI Controller supports virtual wires channel. +config ESPI_VWIRE_VALID_BIT_CHECK + bool "eSPI virtual wire valid bit check" + default y + depends on ESPI_VWIRE_CHANNEL + help + Enable the checking of the eSPI virtual wire valid bit. If this + configuration is not set, treat the new values as the previously + retained valid values and return the received virtual wire level. + config ESPI_AUTOMATIC_WARNING_ACKNOWLEDGE bool "Automatic acknowledge for eSPI HOST warnings" default y diff --git a/drivers/espi/espi_it8xxx2.c b/drivers/espi/espi_it8xxx2.c index ef8eb7b7fbb5b..3af7293a87927 100644 --- a/drivers/espi/espi_it8xxx2.c +++ b/drivers/espi/espi_it8xxx2.c @@ -730,11 +730,15 @@ static int espi_it8xxx2_receive_vwire(const struct device *dev, return -EIO; } - if (vw_reg->VW_INDEX[vw_index] & valid_mask) { - *level = !!(vw_reg->VW_INDEX[vw_index] & level_mask); + if (IS_ENABLED(CONFIG_ESPI_VWIRE_VALID_BIT_CHECK)) { + if (vw_reg->VW_INDEX[vw_index] & valid_mask) { + *level = !!(vw_reg->VW_INDEX[vw_index] & level_mask); + } else { + /* Not valid */ + *level = 0; + } } else { - /* Not valid */ - *level = 0; + *level = !!(vw_reg->VW_INDEX[vw_index] & level_mask); } return 0; diff --git a/drivers/espi/espi_npcx.c b/drivers/espi/espi_npcx.c index 28c88b7fc6a05..a44fec50706a4 100644 --- a/drivers/espi/espi_npcx.c +++ b/drivers/espi/espi_npcx.c @@ -872,8 +872,11 @@ static int espi_npcx_receive_vwire(const struct device *dev, val = GET_FIELD(inst->VWEVMS[reg_idx], NPCX_VWEVMS_WIRE); - val &= GET_FIELD(inst->VWEVMS[reg_idx], + + if (IS_ENABLED(CONFIG_ESPI_VWIRE_VALID_BIT_CHECK)) { + val &= GET_FIELD(inst->VWEVMS[reg_idx], NPCX_VWEVMS_VALID); + } *level = !!(val & bitmask); return 0; @@ -888,8 +891,12 @@ static int espi_npcx_receive_vwire(const struct device *dev, val = GET_FIELD(inst->VWEVSM[reg_idx], NPCX_VWEVSM_WIRE); - val &= GET_FIELD(inst->VWEVSM[reg_idx], + + if (IS_ENABLED(CONFIG_ESPI_VWIRE_VALID_BIT_CHECK)) { + val &= GET_FIELD(inst->VWEVSM[reg_idx], NPCX_VWEVSM_VALID); + } + *level = !!(val & bitmask); return 0; } From c120ffb31d30031fda143497f96c37007332cb46 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Fri, 8 Nov 2024 01:40:56 +0700 Subject: [PATCH 2442/4482] bluetooth: shell: avoid multiple `strlen` calls Add `len` to store the result of `strlen(addr_arg)` to avoid multiple calls to `strlen` within the `for-loop` in `cmd_scan_filter_set_addr`. While the performance impact may be minimal in a shell context, storing `strlen(addr_arg)` in `len` ensures a single call, making the code more predictable and consistent. Signed-off-by: Pisit Sawangvonganan --- subsys/bluetooth/host/shell/bt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/shell/bt.c b/subsys/bluetooth/host/shell/bt.c index e53e8123aa0d6..328c6d9d9ff07 100644 --- a/subsys/bluetooth/host/shell/bt.c +++ b/subsys/bluetooth/host/shell/bt.c @@ -1769,16 +1769,17 @@ static int cmd_scan_filter_set_addr(const struct shell *sh, size_t argc, { const size_t max_cpy_len = sizeof(scan_filter.addr) - 1; const char *addr_arg = argv[1]; + size_t len = strlen(addr_arg); /* Validate length including null terminator. */ - if (strlen(addr_arg) > max_cpy_len) { + if (len > max_cpy_len) { shell_error(ctx_shell, "Invalid address string: %s\n", addr_arg); return -ENOEXEC; } /* Validate input to check if valid (subset of) BT address */ - for (size_t i = 0; i < strlen(addr_arg); i++) { + for (size_t i = 0; i < len; i++) { const char c = addr_arg[i]; uint8_t tmp; From 501f07fe530b00b57f55f0eec47c7a7bac370894 Mon Sep 17 00:00:00 2001 From: Thomas Stranger Date: Thu, 7 Nov 2024 19:27:11 +0100 Subject: [PATCH 2443/4482] drivers: sensor: sensirion: sht4x: update measurement duration Update the measurement durations for the sht4x sensors in accordance with the datasheet revision 6.6 (2024-04). These timings have been updated by sensirion in rev 3 of the datasheet. Signed-off-by: Thomas Stranger --- drivers/sensor/sensirion/sht4x/sht4x.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/sensor/sensirion/sht4x/sht4x.h b/drivers/sensor/sensirion/sht4x/sht4x.h index 35a11d2f56e8f..6409bea2d700a 100644 --- a/drivers/sensor/sensirion/sht4x/sht4x.h +++ b/drivers/sensor/sensirion/sht4x/sht4x.h @@ -41,7 +41,7 @@ static const uint8_t measure_cmd[3] = { }; static const uint16_t measure_wait_us[3] = { - 1700, 4500, 8200 + 1600, 4500, 8300 }; /* From dd93bce0b9f73471445d421cbabe572d4894b64d Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Thu, 7 Nov 2024 17:47:22 +0100 Subject: [PATCH 2444/4482] tests: flash_map: Reduce flash wear in test_flash_area_get_sectors Remove needless writes/read and erase in flash_area_get_sectors test scenario, by replacing it with comparison with layout directly obtained from device. Signed-off-by: Dominik Ermel --- tests/subsys/storage/flash_map/src/main.c | 62 +++++------------------ 1 file changed, 14 insertions(+), 48 deletions(-) diff --git a/tests/subsys/storage/flash_map/src/main.c b/tests/subsys/storage/flash_map/src/main.c index 555f973d35b96..a4c6a3572ccf5 100644 --- a/tests/subsys/storage/flash_map/src/main.c +++ b/tests/subsys/storage/flash_map/src/main.c @@ -15,6 +15,7 @@ #define SLOT1_PARTITION_ID FIXED_PARTITION_ID(SLOT1_PARTITION) #define SLOT1_PARTITION_DEV FIXED_PARTITION_DEVICE(SLOT1_PARTITION) #define SLOT1_PARTITION_NODE DT_NODELABEL(SLOT1_PARTITION) +#define SLOT1_PARTITION_OFFSET FIXED_PARTITION_OFFSET(SLOT1_PARTITION) extern int flash_map_entries; struct flash_sector fs_sectors[1024]; @@ -41,8 +42,6 @@ ZTEST(flash_map, test_flash_area_get_sectors) int i; int rc; off_t off; - uint8_t wd[512]; - uint8_t rd[512]; const struct device *flash_dev; const struct device *flash_dev_a = SLOT1_PARTITION_DEV; @@ -55,61 +54,28 @@ ZTEST(flash_map, test_flash_area_get_sectors) /* Device obtained by label should match the one from fa object */ zassert_equal(flash_dev, flash_dev_a, "Device for slot1_partition do not match"); - rc = flash_erase(flash_dev, fa->fa_off, fa->fa_size); - zassert_true(rc == 0, "flash area erase fail"); - - (void)memset(wd, 0xa5, sizeof(wd)); - sec_cnt = ARRAY_SIZE(fs_sectors); rc = flash_area_get_sectors(SLOT1_PARTITION_ID, &sec_cnt, fs_sectors); zassert_true(rc == 0, "flash_area_get_sectors failed"); - /* write stuff to beginning of every sector */ off = 0; - for (i = 0; i < sec_cnt; i++) { - rc = flash_area_write(fa, off, wd, sizeof(wd)); - zassert_true(rc == 0, "flash_area_write() fail"); - - /* read it back via hal_flash_Read() */ - rc = flash_read(flash_dev, fa->fa_off + off, rd, sizeof(rd)); - zassert_true(rc == 0, "hal_flash_read() fail"); - - rc = memcmp(wd, rd, sizeof(wd)); - zassert_true(rc == 0, "read data != write data"); - - /* write stuff to end of area */ - rc = flash_write(flash_dev, fa->fa_off + off + - fs_sectors[i].fs_size - sizeof(wd), - wd, sizeof(wd)); - zassert_true(rc == 0, "hal_flash_write() fail"); - - /* and read it back */ - (void)memset(rd, 0, sizeof(rd)); - rc = flash_area_read(fa, off + fs_sectors[i].fs_size - - sizeof(rd), - rd, sizeof(rd)); - zassert_true(rc == 0, "hal_flash_read() fail"); - - rc = memcmp(wd, rd, sizeof(rd)); - zassert_true(rc == 0, "read data != write data"); + /* For each reported sector, check if it corresponds to real page on device */ + for (i = 0; i < sec_cnt; ++i) { + struct flash_pages_info fpi; + + zassert_ok(flash_get_page_info_by_offs(flash_dev, + SLOT1_PARTITION_OFFSET + off, + &fpi)); + /* Offset of page taken directly from device corresponds to offset + * within flash area + */ + zassert_equal(fpi.start_offset, + fs_sectors[i].fs_off + SLOT1_PARTITION_OFFSET); + zassert_equal(fpi.size, fs_sectors[i].fs_size); off += fs_sectors[i].fs_size; } - /* erase it */ - rc = flash_area_erase(fa, 0, fa->fa_size); - zassert_true(rc == 0, "read data != write data"); - - /* should read back ff all throughout*/ - (void)memset(wd, 0xff, sizeof(wd)); - for (off = 0; off < fa->fa_size; off += sizeof(rd)) { - rc = flash_area_read(fa, off, rd, sizeof(rd)); - zassert_true(rc == 0, "hal_flash_read() fail"); - - rc = memcmp(wd, rd, sizeof(rd)); - zassert_true(rc == 0, "area not erased"); - } - flash_area_close(fa); } From 06c0b764cc3a83a8f95c75a98f95a3f16493e656 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Thu, 7 Nov 2024 18:05:55 +0100 Subject: [PATCH 2445/4482] tests: flash_map: Move SHA test to separate test scenario The commit moves SHA calculation to separate test scenario, so that it can be run separately from other flash map tests. This reduces flash wear by not running basic flash map tests each time different SHA backend is tested. Signed-off-by: Dominik Ermel --- tests/subsys/storage/flash_map/CMakeLists.txt | 7 +- tests/subsys/storage/flash_map/src/main.c | 119 --------------- tests/subsys/storage/flash_map/src/main_sha.c | 139 ++++++++++++++++++ tests/subsys/storage/flash_map/testcase.yaml | 4 +- 4 files changed, 147 insertions(+), 122 deletions(-) create mode 100644 tests/subsys/storage/flash_map/src/main_sha.c diff --git a/tests/subsys/storage/flash_map/CMakeLists.txt b/tests/subsys/storage/flash_map/CMakeLists.txt index 832036757645c..8c0287e6f171b 100644 --- a/tests/subsys/storage/flash_map/CMakeLists.txt +++ b/tests/subsys/storage/flash_map/CMakeLists.txt @@ -4,5 +4,10 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(flash_map) -FILE(GLOB app_sources src/*.c) +if(NOT CONFIG_FLASH_AREA_CHECK_INTEGRITY_PSA AND NOT CONFIG_FLASH_AREA_CHECK_INTEGRITY_MBEDTLS) + FILE(GLOB app_sources src/main.c) +else() + FILE(GLOB app_sources src/main_sha.c) +endif() + target_sources(app PRIVATE ${app_sources}) diff --git a/tests/subsys/storage/flash_map/src/main.c b/tests/subsys/storage/flash_map/src/main.c index a4c6a3572ccf5..2ff7724f42c95 100644 --- a/tests/subsys/storage/flash_map/src/main.c +++ b/tests/subsys/storage/flash_map/src/main.c @@ -79,125 +79,6 @@ ZTEST(flash_map, test_flash_area_get_sectors) flash_area_close(fa); } -ZTEST(flash_map, test_flash_area_check_int_sha256) -{ - /* for i in {1..16}; do echo $'0123456789abcdef\nfedcba98765432' >> tst.sha; done - * hexdump tst.sha - */ - uint8_t tst_vec[] = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, - 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, - 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, - 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, - 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, - 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, - 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, - 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, - 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, - 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, - 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, - 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, - 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, - 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, - 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, - 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, - 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, - 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, - 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, - 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, - 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, - 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, - 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, - 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, - 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, - 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, - 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, - 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, - 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, - 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, - 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, - 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, - 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a }; - /* sha256sum tst.sha */ - uint8_t tst_sha[] = { 0xae, 0xed, 0x7d, 0x59, 0x53, 0xbd, 0xb7, 0x28, - 0x3e, 0x59, 0xc2, 0x65, 0x59, 0x62, 0xe3, 0x7e, - 0xfa, 0x97, 0xbd, 0x76, 0xf6, 0xac, 0xc3, 0x92, - 0x59, 0x48, 0x4e, 0xc0, 0xaf, 0xa8, 0x49, 0x65 }; - - const struct flash_area *fa; - struct flash_area_check fac = { NULL, 0, -1, NULL, 0 }; - uint8_t buffer[16]; - int rc; - - rc = flash_area_open(SLOT1_PARTITION_ID, &fa); - zassert_true(rc == 0, "flash_area_open() fail, error %d\n", rc); - rc = flash_area_erase(fa, 0, fa->fa_size); - zassert_true(rc == 0, "Flash erase failure (%d), error %d\n", rc); - rc = flash_area_write(fa, 0, tst_vec, sizeof(tst_vec)); - zassert_true(rc == 0, "Flash img write, error %d\n", rc); - - rc = flash_area_check_int_sha256(NULL, NULL); - zassert_true(rc == -EINVAL, "Flash area check int 256 params 1, 2\n"); - rc = flash_area_check_int_sha256(NULL, &fac); - zassert_true(rc == -EINVAL, "Flash area check int 256 params 2\n"); - rc = flash_area_check_int_sha256(fa, NULL); - zassert_true(rc == -EINVAL, "Flash area check int 256 params 1\n"); - - rc = flash_area_check_int_sha256(fa, &fac); - zassert_true(rc == -EINVAL, "Flash area check int 256 fac match\n"); - fac.match = tst_sha; - rc = flash_area_check_int_sha256(fa, &fac); - zassert_true(rc == -EINVAL, "Flash area check int 256 fac clen\n"); - fac.clen = sizeof(tst_vec); - rc = flash_area_check_int_sha256(fa, &fac); - zassert_true(rc == -EINVAL, "Flash area check int 256 fac off\n"); - fac.off = 0; - rc = flash_area_check_int_sha256(fa, &fac); - zassert_true(rc == -EINVAL, "Flash area check int 256 fac rbuf\n"); - fac.rbuf = buffer; - rc = flash_area_check_int_sha256(fa, &fac); - zassert_true(rc == -EINVAL, "Flash area check int 256 fac rblen\n"); - fac.rblen = sizeof(buffer); - - rc = flash_area_check_int_sha256(fa, &fac); - zassert_true(rc == 0, "Flash area check int 256 OK, error %d\n", rc); - tst_sha[0] = 0x00; - rc = flash_area_check_int_sha256(fa, &fac); - zassert_false(rc == 0, "Flash area check int 256 wrong sha\n"); - - flash_area_close(fa); -} - ZTEST(flash_map, test_flash_area_erased_val) { const struct flash_parameters *param; diff --git a/tests/subsys/storage/flash_map/src/main_sha.c b/tests/subsys/storage/flash_map/src/main_sha.c new file mode 100644 index 0000000000000..01a4c7b8394c7 --- /dev/null +++ b/tests/subsys/storage/flash_map/src/main_sha.c @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2017-2024 Nordic Semiconductor ASA + * Copyright (c) 2015 Runtime Inc + * Copyright (c) 2020 Gerson Fernando Budke + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#define SLOT1_PARTITION slot1_partition +#define SLOT1_PARTITION_ID FIXED_PARTITION_ID(SLOT1_PARTITION) +#define SLOT1_PARTITION_DEV FIXED_PARTITION_DEVICE(SLOT1_PARTITION) +#define SLOT1_PARTITION_NODE DT_NODELABEL(SLOT1_PARTITION) +#define SLOT1_PARTITION_OFFSET FIXED_PARTITION_OFFSET(SLOT1_PARTITION) + +ZTEST(flash_map_sha, test_flash_area_check_int_sha256) +{ + /* for i in {1..16}; do echo $'0123456789abcdef\nfedcba98765432' >> tst.sha; done + * hexdump tst.sha + */ + uint8_t tst_vec[] = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, + 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, + 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, + 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, + 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, + 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, + 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, + 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, + 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, + 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, + 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, + 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, + 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, + 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, + 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, + 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, + 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, + 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, + 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, + 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, + 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, + 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, + 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, + 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, + 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, + 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, + 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, + 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, + 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, + 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, + 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, + 0x0a, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x39, + 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x0a }; + /* sha256sum tst.sha */ + uint8_t tst_sha[] = { 0xae, 0xed, 0x7d, 0x59, 0x53, 0xbd, 0xb7, 0x28, + 0x3e, 0x59, 0xc2, 0x65, 0x59, 0x62, 0xe3, 0x7e, + 0xfa, 0x97, 0xbd, 0x76, 0xf6, 0xac, 0xc3, 0x92, + 0x59, 0x48, 0x4e, 0xc0, 0xaf, 0xa8, 0x49, 0x65 }; + + const struct flash_area *fa; + struct flash_area_check fac = { NULL, 0, -1, NULL, 0 }; + uint8_t buffer[16]; + int rc; + + rc = flash_area_open(SLOT1_PARTITION_ID, &fa); + zassert_true(rc == 0, "flash_area_open() fail, error %d\n", rc); + rc = flash_area_erase(fa, 0, fa->fa_size); + zassert_true(rc == 0, "Flash erase failure (%d), error %d\n", rc); + rc = flash_area_write(fa, 0, tst_vec, sizeof(tst_vec)); + zassert_true(rc == 0, "Flash img write, error %d\n", rc); + + rc = flash_area_check_int_sha256(NULL, NULL); + zassert_true(rc == -EINVAL, "Flash area check int 256 params 1, 2\n"); + rc = flash_area_check_int_sha256(NULL, &fac); + zassert_true(rc == -EINVAL, "Flash area check int 256 params 2\n"); + rc = flash_area_check_int_sha256(fa, NULL); + zassert_true(rc == -EINVAL, "Flash area check int 256 params 1\n"); + + rc = flash_area_check_int_sha256(fa, &fac); + zassert_true(rc == -EINVAL, "Flash area check int 256 fac match\n"); + fac.match = tst_sha; + rc = flash_area_check_int_sha256(fa, &fac); + zassert_true(rc == -EINVAL, "Flash area check int 256 fac clen\n"); + fac.clen = sizeof(tst_vec); + rc = flash_area_check_int_sha256(fa, &fac); + zassert_true(rc == -EINVAL, "Flash area check int 256 fac off\n"); + fac.off = 0; + rc = flash_area_check_int_sha256(fa, &fac); + zassert_true(rc == -EINVAL, "Flash area check int 256 fac rbuf\n"); + fac.rbuf = buffer; + rc = flash_area_check_int_sha256(fa, &fac); + zassert_true(rc == -EINVAL, "Flash area check int 256 fac rblen\n"); + fac.rblen = sizeof(buffer); + + rc = flash_area_check_int_sha256(fa, &fac); + zassert_true(rc == 0, "Flash area check int 256 OK, error %d\n", rc); + tst_sha[0] = 0x00; + rc = flash_area_check_int_sha256(fa, &fac); + zassert_false(rc == 0, "Flash area check int 256 wrong sha\n"); + + flash_area_close(fa); +} + +ZTEST_SUITE(flash_map_sha, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/subsys/storage/flash_map/testcase.yaml b/tests/subsys/storage/flash_map/testcase.yaml index 9256dad8bf597..c1b65b0fdf90b 100644 --- a/tests/subsys/storage/flash_map/testcase.yaml +++ b/tests/subsys/storage/flash_map/testcase.yaml @@ -22,7 +22,7 @@ tests: integration_platforms: - nrf52840dk/nrf52840 tags: flash_map - storage.flash_map.mbedtls: + storage.flash_map_sha.mbedtls: extra_args: EXTRA_CONF_FILE=overlay-mbedtls.conf platform_allow: - nrf51dk/nrf51822 @@ -33,7 +33,7 @@ tests: tags: flash_map integration_platforms: - native_sim - storage.flash_map.psa: + storage.flash_map_sha.psa: extra_args: EXTRA_CONF_FILE=overlay-psa.conf platform_allow: - nrf51dk/nrf51822 From 5f3e6212af7fefb86a081f148b3ef3991ba71a44 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 7 Nov 2024 16:24:31 +0200 Subject: [PATCH 2446/4482] net: utils: Port parsing failure in net_ipaddr_parse() If trying to parse a string like 192.0.2.2:80/foobar and setting the length to 12 which means to parse the IP address and port, the parsing failed because it used one extra character from the string. This issue was not present if the input string was terminated after the port number. Add a test case to catch this problem. Signed-off-by: Jukka Rissanen --- subsys/net/ip/utils.c | 4 ++-- tests/net/utils/src/main.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/subsys/net/ip/utils.c b/subsys/net/ip/utils.c index f130a184bcb27..5025e326b803b 100644 --- a/subsys/net/ip/utils.c +++ b/subsys/net/ip/utils.c @@ -864,8 +864,8 @@ static bool parse_ipv4(const char *str, size_t str_len, return true; } - memcpy(ipaddr, ptr + 1, str_len - end); - ipaddr[str_len - end] = '\0'; + memcpy(ipaddr, ptr + 1, str_len - end - 1); + ipaddr[str_len - end - 1] = '\0'; ret = convert_port(ipaddr, &port); if (!ret) { diff --git a/tests/net/utils/src/main.c b/tests/net/utils/src/main.c index a4ef8db7e0ebb..15a51e8ca73ca 100644 --- a/tests/net/utils/src/main.c +++ b/tests/net/utils/src/main.c @@ -532,6 +532,21 @@ ZTEST(test_utils_fn, test_addr_parse) }, .verdict = true }, + { + .address = "192.0.2.3:80/foobar", + .len = sizeof("192.0.2.3:80") - 1, + .result = { + .sin_family = AF_INET, + .sin_port = htons(80), + .sin_addr = { + .s4_addr[0] = 192, + .s4_addr[1] = 0, + .s4_addr[2] = 2, + .s4_addr[3] = 3 + } + }, + .verdict = true + }, { .address = "192.0.2.3/foobar", .len = sizeof("192.0.2.3/foobar") - 1, From 6c95daf0ae3e3e2997acd8ec2fca1c810ea6d91b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 7 Nov 2024 17:17:30 +0200 Subject: [PATCH 2447/4482] net: dns: Bind DNS server to a network interface Allow user to specify a network interface in the DNS server list. User can append "%" and network interface name to the DNS server to use this. If the network interface is mentioned in the server list, then the DNS queries are sent via this network interface. For example setting the interfaces like this: 192.0.2.2%eth1 [2001:db8::2]:5353%ppp0 would cause the DNS queries to sent to 192.0.2.1 via eth1 in the first example, and to 2001:db8::2 via ppp0 in the second example. Signed-off-by: Jukka Rissanen --- include/zephyr/net/dns_resolve.h | 5 ++ subsys/net/lib/dns/Kconfig | 6 ++ subsys/net/lib/dns/resolve.c | 98 +++++++++++++++++++++++++++++--- 3 files changed, 102 insertions(+), 7 deletions(-) diff --git a/include/zephyr/net/dns_resolve.h b/include/zephyr/net/dns_resolve.h index 9e1591c0b8646..33398dabdf134 100644 --- a/include/zephyr/net/dns_resolve.h +++ b/include/zephyr/net/dns_resolve.h @@ -344,6 +344,11 @@ struct dns_resolve_context { /** Connection to the DNS server */ int sock; + /** Network interface index if the DNS resolving should be done + * via this interface. Value 0 indicates any interface can be used. + */ + int if_index; + /** Is this server mDNS one */ uint8_t is_mdns : 1; diff --git a/subsys/net/lib/dns/Kconfig b/subsys/net/lib/dns/Kconfig index 654f7c940136e..8067e85653d5d 100644 --- a/subsys/net/lib/dns/Kconfig +++ b/subsys/net/lib/dns/Kconfig @@ -87,6 +87,12 @@ config DNS_SERVER1 192.0.2.1:5353 2001:db8::1 [2001:db8::1]:5353 + It is possible to bind the DNS connection via a certain network + interface by appending "%" and network interface name to the server + address. For example: 192.0.2.1%eth1 would bind the connection socket + to the network interface eth1. This is optional and by default the + resolver connects to server by selecting the output network interface + using normal IP routing. It is not mandatory to use this Kconfig option at all. The one calling dns_resolve_init() can use this option or not to populate the server list. If the DNS server addresses are diff --git a/subsys/net/lib/dns/resolve.c b/subsys/net/lib/dns/resolve.c index ff17b6b6257fe..5b9402768da31 100644 --- a/subsys/net/lib/dns/resolve.c +++ b/subsys/net/lib/dns/resolve.c @@ -27,6 +27,7 @@ LOG_MODULE_REGISTER(net_dns_resolve, CONFIG_DNS_RESOLVER_LOG_LEVEL); #include #include #include +#include "../../ip/net_private.h" #include "dns_pack.h" #include "dns_internal.h" #include "dns_cache.h" @@ -319,6 +320,31 @@ static int register_dispatcher(struct dns_resolve_context *ctx, return dns_dispatcher_register(&server->dispatcher); } +static int bind_to_iface(int sock, const struct sockaddr *addr, int if_index) +{ + struct ifreq ifreq = { 0 }; + int ret; + + ret = net_if_get_name(net_if_get_by_index(if_index), ifreq.ifr_name, + sizeof(ifreq.ifr_name)); + if (ret < 0) { + LOG_DBG("Cannot get interface name for %d (%d)", if_index, ret); + return ret; + } + + ret = zsock_setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, + &ifreq, sizeof(ifreq)); + if (ret < 0) { + ret = -errno; + + NET_DBG("Cannot bind %s to %d (%d)", + net_sprint_addr(addr->sa_family, &net_sin(addr)->sin_addr), + if_index, ret); + } + + return ret; +} + /* Must be invoked with context lock held */ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, const char *servers[], @@ -363,24 +389,56 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, if (servers) { for (i = 0; idx < SERVER_COUNT && servers[i]; i++) { + const char *iface_str; + size_t server_len; + struct sockaddr *addr = &ctx->servers[idx].dns_server; + iface_str = strstr(servers[i], "%"); + if (iface_str) { + server_len = iface_str - servers[i]; + iface_str++; + + if (server_len == 0) { + NET_DBG("Empty server name"); + continue; + } + + /* Skip empty interface name */ + if (iface_str[0] == '\0') { + ctx->servers[idx].if_index = 0; + iface_str = NULL; + } else { + ctx->servers[idx].if_index = + net_if_get_by_name(iface_str); + } + + } else { + server_len = strlen(servers[i]); + ctx->servers[idx].if_index = 0; + } + (void)memset(addr, 0, sizeof(*addr)); - ret = net_ipaddr_parse(servers[i], strlen(servers[i]), - addr); + ret = net_ipaddr_parse(servers[i], server_len, addr); if (!ret) { + if (servers[i] != NULL && servers[i][0] != '\0') { + NET_DBG("Invalid server address %.*s", + server_len, servers[i]); + } + continue; } dns_postprocess_server(ctx, idx); - NET_DBG("[%d] %s%s%s", i, servers[i], + NET_DBG("[%d] %.*s%s%s%s%s", i, server_len, servers[i], IS_ENABLED(CONFIG_MDNS_RESOLVER) ? (ctx->servers[i].is_mdns ? " mDNS" : "") : "", IS_ENABLED(CONFIG_LLMNR_RESOLVER) ? - (ctx->servers[i].is_llmnr ? - " LLMNR" : "") : ""); + (ctx->servers[i].is_llmnr ? " LLMNR" : "") : "", + iface_str != NULL ? " via " : "", + iface_str != NULL ? iface_str : ""); idx++; } } @@ -441,14 +499,40 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, ctx->servers[i].sock = ret; + /* Try to bind to the interface if it is set */ + if (ctx->servers[i].if_index > 0) { + ret = bind_to_iface(ctx->servers[i].sock, + &ctx->servers[i].dns_server, + ctx->servers[i].if_index); + if (ret < 0) { + zsock_close(ctx->servers[i].sock); + ctx->servers[i].sock = -1; + continue; + } + + iface = net_if_get_by_index(ctx->servers[i].if_index); + NET_DBG("Binding %s to %d", + net_sprint_addr(ctx->servers[i].dns_server.sa_family, + &net_sin(&ctx->servers[i].dns_server)->sin_addr), + ctx->servers[i].if_index); + } else { + iface = NULL; + } + if (ctx->servers[i].dns_server.sa_family == AF_INET6) { - iface = net_if_ipv6_select_src_iface( + if (iface == NULL) { + iface = net_if_ipv6_select_src_iface( &net_sin6(&ctx->servers[i].dns_server)->sin6_addr); + } + addr6 = net_if_ipv6_select_src_addr(iface, &net_sin6(&ctx->servers[i].dns_server)->sin6_addr); } else { - iface = net_if_ipv4_select_src_iface( + if (iface == NULL) { + iface = net_if_ipv4_select_src_iface( &net_sin(&ctx->servers[i].dns_server)->sin_addr); + } + addr4 = net_if_ipv4_select_src_addr(iface, &net_sin(&ctx->servers[i].dns_server)->sin_addr); } From f95ab280fbc714692c6a1c066efd88305f16092c Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 7 Nov 2024 17:23:06 +0200 Subject: [PATCH 2448/4482] net: shell: dns: Print DNS server with network interface If network interface is specified in the DNS server, then send the queries to the server via the network interface. Print this information in the server list. Signed-off-by: Jukka Rissanen --- subsys/net/lib/shell/dns.c | 41 +++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/subsys/net/lib/shell/dns.c b/subsys/net/lib/shell/dns.c index 54c768cecd1c8..6c6285990d889 100644 --- a/subsys/net/lib/shell/dns.c +++ b/subsys/net/lib/shell/dns.c @@ -8,6 +8,7 @@ #include LOG_MODULE_DECLARE(net_shell); +#include #include #include "net_shell_private.h" @@ -59,29 +60,55 @@ static void dns_result_cb(enum dns_resolve_status status, PR_WARNING("dns: Unhandled status %d received\n", status); } +static const char *printable_iface(const char *iface_name, + const char *found, + const char *not_found) +{ + if (iface_name[0] != '\0') { + return found; + } + + return not_found; +} + static void print_dns_info(const struct shell *sh, struct dns_resolve_context *ctx) { - int i; + int i, ret; PR("DNS servers:\n"); for (i = 0; i < CONFIG_DNS_RESOLVER_MAX_SERVERS + DNS_MAX_MCAST_SERVERS; i++) { + char iface_name[IFNAMSIZ] = { 0 }; + + if (ctx->servers[i].if_index > 0) { + ret = net_if_get_name( + net_if_get_by_index(ctx->servers[i].if_index), + iface_name, sizeof(iface_name)); + if (ret < 0) { + snprintk(iface_name, sizeof(iface_name), "%d", + ctx->servers[i].if_index); + } + } + if (ctx->servers[i].dns_server.sa_family == AF_INET) { - PR("\t%s:%u\n", + PR("\t%s:%u%s%s\n", net_sprint_ipv4_addr( &net_sin(&ctx->servers[i].dns_server)-> sin_addr), - ntohs(net_sin( - &ctx->servers[i].dns_server)->sin_port)); + ntohs(net_sin(&ctx->servers[i].dns_server)->sin_port), + printable_iface(iface_name, " via ", ""), + printable_iface(iface_name, iface_name, "")); + } else if (ctx->servers[i].dns_server.sa_family == AF_INET6) { - PR("\t[%s]:%u\n", + PR("\t[%s]:%u%s%s\n", net_sprint_ipv6_addr( &net_sin6(&ctx->servers[i].dns_server)-> sin6_addr), - ntohs(net_sin6( - &ctx->servers[i].dns_server)->sin6_port)); + ntohs(net_sin6(&ctx->servers[i].dns_server)->sin6_port), + printable_iface(iface_name, " via ", ""), + printable_iface(iface_name, iface_name, "")); } } From 2188387dd3ad5562b90bd031cdad9606508ec3bf Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 8 Nov 2024 10:15:19 +0200 Subject: [PATCH 2449/4482] samples: net: mdns_responder: Increase interface name len for VLAN In this sample, VLAN has longer interface name so increase it to max. Signed-off-by: Jukka Rissanen --- samples/net/mdns_responder/overlay-vlan.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/samples/net/mdns_responder/overlay-vlan.conf b/samples/net/mdns_responder/overlay-vlan.conf index 83d84cbf3fbab..bdab8a44350b1 100644 --- a/samples/net/mdns_responder/overlay-vlan.conf +++ b/samples/net/mdns_responder/overlay-vlan.conf @@ -32,3 +32,6 @@ CONFIG_NET_SAMPLE_IFACE3_VLAN_TAG=200 # we do not run out of them. CONFIG_NET_MAX_CONTEXTS=10 CONFIG_NET_MAX_CONN=10 + +CONFIG_NET_INTERFACE_NAME=y +CONFIG_NET_INTERFACE_NAME_LEN=15 From d0816a1a600dd6df2cfca8f6835e261dcadb0bbd Mon Sep 17 00:00:00 2001 From: Thomas Stranger Date: Fri, 8 Nov 2024 06:23:46 +0100 Subject: [PATCH 2450/4482] drivers: w1: updates to reflect analog maxim acquisition Links and the manufacturer name are updated from maxim to analog for the 1-wire subsystem and the related ds18b20 sensor. After the acquisition of Maxim Integrated the documentation of these devices has been moved to the analog.com website. Redirects exist, so they are not broken yet, but we should not rely on that. Signed-off-by: Thomas Stranger --- doc/hardware/peripherals/w1.rst | 10 +++++----- drivers/sensor/maxim/ds18b20/ds18b20.c | 10 ++++------ drivers/w1/w1_ds2477_85_common.c | 2 +- drivers/w1/w1_ds2485.c | 2 +- drivers/w1/w1_net.c | 4 +++- drivers/w1/w1_zephyr_gpio.c | 6 +++--- drivers/w1/w1_zephyr_serial.c | 2 +- include/zephyr/drivers/w1.h | 6 +++--- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/doc/hardware/peripherals/w1.rst b/doc/hardware/peripherals/w1.rst index 588a359e1307d..a2dfc61fcae84 100644 --- a/doc/hardware/peripherals/w1.rst +++ b/doc/hardware/peripherals/w1.rst @@ -52,7 +52,7 @@ In Zephyr this API is split into the following layers. includes a 8-bit `1-Wire Family Code`_ and a 8-bit CRC. * In order to find slaves on the bus, the standard specifies an search algorithm which successively detects all slaves on the bus. - This algorithm is described in detail by `Maxim's Applicationnote 187`_. + This algorithm is described in the `1-Wire Search Algorithm Application Note`_. * Transport layer and Presentation layer functions are not implemented in the generic 1-Wire driver and therefore must be handled in individual slave drivers. @@ -91,10 +91,10 @@ Functions that are not directly related to any of the networking layers. .. _BOOK OF IBUTTON STANDARDS: - https://www.maximintegrated.com/en/design/technical-documents/app-notes/9/937.html + https://www.analog.com/en/resources/technical-articles/book-of-ibuttonreg-standards.html .. _1-Wire Family Code: - https://www.maximintegrated.com/en/design/technical-documents/app-notes/1/155.html + https://www.analog.com/en/resources/technical-articles/1wire-software-resource-guide-device-description.html -.. _Maxim's Applicationnote 187: - https://www.maximintegrated.com/en/design/technical-documents/app-notes/1/187.html +.. _1-Wire Search Algorithm Application Note: + https://www.analog.com/en/resources/app-notes/1wire-search-algorithm.html diff --git a/drivers/sensor/maxim/ds18b20/ds18b20.c b/drivers/sensor/maxim/ds18b20/ds18b20.c index b671f8a43c701..138eed0e93f1a 100644 --- a/drivers/sensor/maxim/ds18b20/ds18b20.c +++ b/drivers/sensor/maxim/ds18b20/ds18b20.c @@ -5,12 +5,10 @@ */ /** - * Driver for DS18B20 1-Wire temperature sensors - * A datasheet is available at: - * https://datasheets.maximintegrated.com/en/ds/DS18B20.pdf - * - * Driver also support the older DS18S20 1-Wire temperature sensors. - * https://www.analog.com/media/en/technical-documentation/data-sheets/ds18b20.pdf + * Driver for DS18B20 and DS18S20 1-Wire temperature sensors + * Datasheets for the compatible sensors are available at: + * - https://www.analog.com/media/en/technical-documentation/data-sheets/ds18b20.pdf + * - https://www.analog.com/media/en/technical-documentation/data-sheets/ds18s20.pdf * * Parasite power configuration is not supported by the driver. */ diff --git a/drivers/w1/w1_ds2477_85_common.c b/drivers/w1/w1_ds2477_85_common.c index 95ef515b7cda1..5b2b156ad9dda 100644 --- a/drivers/w1/w1_ds2477_85_common.c +++ b/drivers/w1/w1_ds2477_85_common.c @@ -5,7 +5,7 @@ */ /** - * @brief Common functions for Maxim DS2477,DS2485 1-Wire Masters + * @brief Common functions for Analog Devices DS2477,DS2485 1-Wire Masters */ #include "w1_ds2477_85_common.h" diff --git a/drivers/w1/w1_ds2485.c b/drivers/w1/w1_ds2485.c index c50733629d0d5..dacfddae8befe 100644 --- a/drivers/w1/w1_ds2485.c +++ b/drivers/w1/w1_ds2485.c @@ -7,7 +7,7 @@ #define DT_DRV_COMPAT maxim_ds2485 /** - * @brief Driver for the Maxim ds2485 1-Wire Master + * @brief Driver for the Analog Devices DS2485 1-Wire Master */ #include "w1_ds2477_85_common.h" diff --git a/drivers/w1/w1_net.c b/drivers/w1/w1_net.c index 06ac4b19cba49..1627d0e954c38 100644 --- a/drivers/w1/w1_net.c +++ b/drivers/w1/w1_net.c @@ -31,7 +31,9 @@ LOG_MODULE_REGISTER(w1, CONFIG_W1_LOG_LEVEL); * W1_SEARCH_LAST_SLAVE, and in case no slave participated in the search, * the discrepancy is set to W1_SEARCH_NO_SLAVE. * - * The implementation is similar to suggested in the maxim application note 187. + * The implementation is similar to that suggested in the Maxim Integrated + * application note 187. + * @see https://www.analog.com/media/en/technical-documentation/app-notes/1wire-search-algorithm.pdf * The master reads the first ROM bit and its complementary value of all slaves. * Due to physical characteristics, the value received is a * logical AND of all slaves' 1st bit. Slaves only continue to diff --git a/drivers/w1/w1_zephyr_gpio.c b/drivers/w1/w1_zephyr_gpio.c index bcab363494801..ac42b446355f9 100644 --- a/drivers/w1/w1_zephyr_gpio.c +++ b/drivers/w1/w1_zephyr_gpio.c @@ -16,11 +16,11 @@ * The driver supports both standard speed and overdrive speed modes. * * This driver is heavily based on the w1_zephyr_serial.c driver and the - * technical documentation from Maxim Integrated. + * technical article from Analog Devices. * * - w1_zephyr_serial.c: drivers/w1/w1_zephyr_serial.c - * - Maxim Integrated 1-Wire Communication Through Software: - * https://www.analog.com/en/technical-articles/1wire-communication-through-software.html + * - Analog Devices 1-Wire Communication Through Software: + * https://www.analog.com/en/resources/technical-articles/1wire-communication-through-software.html */ #include diff --git a/drivers/w1/w1_zephyr_serial.c b/drivers/w1/w1_zephyr_serial.c index e83ef6fe596c1..341680805cbe1 100644 --- a/drivers/w1/w1_zephyr_serial.c +++ b/drivers/w1/w1_zephyr_serial.c @@ -13,7 +13,7 @@ * The driver uses a uart peripheral with a baudrate of 115.2 kBd to send * and receive data bits and a baurade of 9.6 kBd for slave reset and * presence detection as suggested for normal speed operating mode in: - * https://www.maximintegrated.com/en/design/technical-documents/tutorials/2/214.html + * https://www.analog.com/en/resources/technical-articles/using-a-uart-to-implement-a-1wire-bus-master.html * For overdrive speed communication baudrates of 1 MBd and 115.2 kBd * are used, respectively. */ diff --git a/include/zephyr/drivers/w1.h b/include/zephyr/drivers/w1.h index a233712a4fc25..fe264489e10eb 100644 --- a/include/zephyr/drivers/w1.h +++ b/include/zephyr/drivers/w1.h @@ -435,7 +435,7 @@ struct w1_rom { /** @brief The 1-Wire family code identifying the slave device type. * * An incomplete list of family codes is available at: - * https://www.maximintegrated.com/en/app-notes/index.mvp/id/155 + * https://www.analog.com/en/resources/technical-articles/1wire-software-resource-guide-device-description.html * others are documented in the respective device data sheet. */ uint8_t family; @@ -584,7 +584,7 @@ int w1_write_read(const struct device *dev, const struct w1_slave_config *config * If a callback is passed, the callback is called for each found slave. * * The algorithm mostly follows the suggestions of - * https://pdfserv.maximintegrated.com/en/an/AN187.pdf + * https://www.analog.com/en/resources/app-notes/1wire-search-algorithm.html * * Note: Filtering on families is not supported. * @@ -695,7 +695,7 @@ static inline uint8_t w1_crc8(const uint8_t *src, size_t len) * X^16 + X^15 * + X^2 + 1 with the initial value set to 0x0000. * See also APPLICATION NOTE 27: * "UNDERSTANDING AND USING CYCLIC REDUNDANCY CHECKS WITH MAXIM 1-WIRE AND IBUTTON PRODUCTS" - * https://www.maximintegrated.com/en/design/technical-documents/app-notes/2/27.html + * https://www.analog.com/en/resources/technical-articles/understanding-and-using-cyclic-redundancy-checks-with-maxim-1wire-and-ibutton-products.html * * @param seed Init value for the CRC, it is usually set to 0x0000. * @param[in] src Input bytes for the computation. From e6664e38ba391bd9bad4a3e32f2b7ec51f2a809b Mon Sep 17 00:00:00 2001 From: Thomas Stranger Date: Fri, 8 Nov 2024 06:31:25 +0100 Subject: [PATCH 2451/4482] samples: sensor: ds18b20: updates to reflect analog maxim acquisition Links and the manufacturer name are updated from maxim to analog. After the acquisition of Maxim Integrated the documentation of these devices has been moved to the analog.com website. Redirects exist, so they are not broken yet, but we should not rely on that. Signed-off-by: Thomas Stranger --- samples/sensor/ds18b20/README.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/sensor/ds18b20/README.rst b/samples/sensor/ds18b20/README.rst index 2d1e05d06f272..c7785462b898a 100644 --- a/samples/sensor/ds18b20/README.rst +++ b/samples/sensor/ds18b20/README.rst @@ -8,10 +8,10 @@ Overview ******** This sample shows how to use the Zephyr :ref:`sensor` API driver for the -`Maxim DS18B20`_ temperature sensor. +`DS18B20`_ 1-Wire temperature sensor. -.. _Maxim DS18B20: - https://www.maximintegrated.com/en/products/sensors/DS18B20.html +.. _DS18B20: + https://www.analog.com/en/products/ds18b20.html The sample periodically reads temperature data from the first available DS18B20 device discovered in the system. The sample checks the @@ -28,7 +28,7 @@ as shown in the Figure Hardware Configuration of the `DS18B20 datasheet`_ at page 10. .. _DS18B20 datasheet: - https://datasheets.maximintegrated.com/en/ds/DS18B20.pdf + https://www.analog.com/media/en/technical-documentation/data-sheets/ds18b20.pdf Boards with a built-in DS18B20 or a board-specific overlay ========================================================== From 7ec8c8e753b34d19d25c837fcff424e672efa810 Mon Sep 17 00:00:00 2001 From: Teresa Zepeda Ventura Date: Thu, 7 Nov 2024 08:09:49 -0600 Subject: [PATCH 2452/4482] boards: adafruit: add initial support for feather m4 express The Adafruit Feather M4 Express is a compact, lightweight ARM development board with an onboard mini NeoPixel, 2 MiB of SPI flash, charging status indicator and user LEDs, USB connector, 21 GPIO pins and a small prototyping area. Signed-off-by: Teresa Zepeda Ventura --- .../Kconfig.adafruit_feather_m4_express | 5 + .../adafruit_feather_m4_express-pinctrl.dtsi | 51 +++++ .../adafruit_feather_m4_express.dts | 111 ++++++++++ .../adafruit_feather_m4_express.yaml | 20 ++ .../adafruit_feather_m4_express_defconfig | 17 ++ .../adafruit/feather_m4_express/board.cmake | 5 + boards/adafruit/feather_m4_express/board.yml | 6 + .../doc/img/adafruit_feather_m4_express.webp | Bin 0 -> 54892 bytes .../adafruit/feather_m4_express/doc/index.rst | 201 ++++++++++++++++++ .../feather_m4_express/pre_dt_board.cmake | 7 + .../feather_m4_express/support/openocd.cfg | 21 ++ 11 files changed, 444 insertions(+) create mode 100644 boards/adafruit/feather_m4_express/Kconfig.adafruit_feather_m4_express create mode 100644 boards/adafruit/feather_m4_express/adafruit_feather_m4_express-pinctrl.dtsi create mode 100644 boards/adafruit/feather_m4_express/adafruit_feather_m4_express.dts create mode 100644 boards/adafruit/feather_m4_express/adafruit_feather_m4_express.yaml create mode 100644 boards/adafruit/feather_m4_express/adafruit_feather_m4_express_defconfig create mode 100644 boards/adafruit/feather_m4_express/board.cmake create mode 100644 boards/adafruit/feather_m4_express/board.yml create mode 100644 boards/adafruit/feather_m4_express/doc/img/adafruit_feather_m4_express.webp create mode 100644 boards/adafruit/feather_m4_express/doc/index.rst create mode 100644 boards/adafruit/feather_m4_express/pre_dt_board.cmake create mode 100644 boards/adafruit/feather_m4_express/support/openocd.cfg diff --git a/boards/adafruit/feather_m4_express/Kconfig.adafruit_feather_m4_express b/boards/adafruit/feather_m4_express/Kconfig.adafruit_feather_m4_express new file mode 100644 index 0000000000000..747fade8f4a3d --- /dev/null +++ b/boards/adafruit/feather_m4_express/Kconfig.adafruit_feather_m4_express @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Daikin Comfort Technologies North America, Inc. +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_ADAFRUIT_FEATHER_M4_EXPRESS + select SOC_SAMD51J19A diff --git a/boards/adafruit/feather_m4_express/adafruit_feather_m4_express-pinctrl.dtsi b/boards/adafruit/feather_m4_express/adafruit_feather_m4_express-pinctrl.dtsi new file mode 100644 index 0000000000000..34ddd2b858cbf --- /dev/null +++ b/boards/adafruit/feather_m4_express/adafruit_feather_m4_express-pinctrl.dtsi @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2022, Gerson Fernando Budke + * Copyright (c) 2024 Daikin Comfort Technologies North America, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&pinctrl { + sercom1_spi_default: sercom1_spi_default { + group1 { + pinmux = , + , + ; + }; + }; + + sercom2_i2c_default: sercom3_i2c_default { + group1 { + pinmux = , + ; + }; + }; + + sercom5_uart_default: sercom5_uart_default { + group1 { + pinmux = , + ; + }; + }; + + pwm0_default: pwm0_default { + group1 { + pinmux = ; + }; + }; + pwm1_default: pwm1_default { + group1 { + pinmux = , + ; + }; + }; + + usb_dc_default: usb_dc_default { + group1 { + pinmux = , + ; + }; + }; +}; diff --git a/boards/adafruit/feather_m4_express/adafruit_feather_m4_express.dts b/boards/adafruit/feather_m4_express/adafruit_feather_m4_express.dts new file mode 100644 index 0000000000000..374123bae71b0 --- /dev/null +++ b/boards/adafruit/feather_m4_express/adafruit_feather_m4_express.dts @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2020 Google LLC. + * Copyright (c) 2024 Daikin Comfort Technologies North America, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include "adafruit_feather_m4_express-pinctrl.dtsi" + +/ { + model = "Adafruit Feather M4 Express"; + compatible = "adafruit,feather-m4-express"; + + chosen { + zephyr,console = &sercom5; + zephyr,shell-uart = &sercom5; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,code-partition = &code_partition; + }; + + /* These aliases are provided for compatibility with samples */ + aliases { + led0 = &led0; + pwm-0 = &tcc0; + }; + + leds { + compatible = "gpio-leds"; + led0: led_0 { + gpios = <&porta 23 0>; + label = "LED"; + }; + }; +}; + +&cpu0 { + clock-frequency = <120000000>; +}; + +&sercom5 { + status = "okay"; + compatible = "atmel,sam0-uart"; + current-speed = <115200>; + rxpo = <1>; + txpo = <0>; + pinctrl-0 = <&sercom5_uart_default>; + pinctrl-names = "default"; +}; + +&sercom1 { + status = "okay"; + compatible = "atmel,sam0-spi"; + dipo = <3>; + dopo = <0>; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-0 = <&sercom1_spi_default>; + pinctrl-names = "default"; +}; + +&tcc0 { + status = "okay"; + compatible = "atmel,sam0-tcc-pwm"; + prescaler = <8>; + #pwm-cells = <2>; + pinctrl-0 = <&pwm0_default>; + pinctrl-names = "default"; +}; + +zephyr_udc0: &usb0 { + status = "okay"; + pinctrl-0 = <&usb_dc_default>; + pinctrl-names = "default"; +}; + +&dmac { + status = "okay"; +}; + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "uf2"; + reg = <0x00000000 DT_SIZE_K(16)>; + read-only; + }; + + code_partition: partition@4000 { + label = "code"; + reg = <0x4000 DT_SIZE_K(512-16-16)>; + read-only; + }; + + /* + * The final 16 KiB is reserved for the application. + * Storage partition will be used by FCB/LittleFS/NVS + * if enabled. + */ + storage_partition: partition@7c000 { + label = "storage"; + reg = <0x7c000 DT_SIZE_K(16)>; + }; + }; +}; diff --git a/boards/adafruit/feather_m4_express/adafruit_feather_m4_express.yaml b/boards/adafruit/feather_m4_express/adafruit_feather_m4_express.yaml new file mode 100644 index 0000000000000..a8d50925d9fbd --- /dev/null +++ b/boards/adafruit/feather_m4_express/adafruit_feather_m4_express.yaml @@ -0,0 +1,20 @@ +identifier: adafruit_feather_m4_express +name: Adafruit Feather M4 Express +type: mcu +arch: arm +ram: 192 +flash: 512 +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - dma + - gpio + - hwinfo + - pwm + - spi + - uart + - usb_device + - watchdog +vendor: adafruit diff --git a/boards/adafruit/feather_m4_express/adafruit_feather_m4_express_defconfig b/boards/adafruit/feather_m4_express/adafruit_feather_m4_express_defconfig new file mode 100644 index 0000000000000..5cb651c5bb621 --- /dev/null +++ b/boards/adafruit/feather_m4_express/adafruit_feather_m4_express_defconfig @@ -0,0 +1,17 @@ +# Copyright (c) 2024 Daikin Comfort Technologies North America, Inc. +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_ATMEL_SAMD5X_OSCULP32K_AS_MAIN=y + +CONFIG_BOOTLOADER_BOSSA=y +CONFIG_BOOTLOADER_BOSSA_ADAFRUIT_UF2=y +CONFIG_BUILD_OUTPUT_HEX=y +CONFIG_BUILD_OUTPUT_UF2=y + +CONFIG_ARM_MPU=y +CONFIG_HW_STACK_PROTECTION=y + +CONFIG_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_UART_CONSOLE=y +CONFIG_UART_INTERRUPT_DRIVEN=y diff --git a/boards/adafruit/feather_m4_express/board.cmake b/boards/adafruit/feather_m4_express/board.cmake new file mode 100644 index 0000000000000..e240a42f36a39 --- /dev/null +++ b/boards/adafruit/feather_m4_express/board.cmake @@ -0,0 +1,5 @@ +# Copyright (c) 2020 Google LLC. +# SPDX-License-Identifier: Apache-2.0 + +include(${ZEPHYR_BASE}/boards/common/bossac.board.cmake) +include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/adafruit/feather_m4_express/board.yml b/boards/adafruit/feather_m4_express/board.yml new file mode 100644 index 0000000000000..5b9961e1f9e43 --- /dev/null +++ b/boards/adafruit/feather_m4_express/board.yml @@ -0,0 +1,6 @@ +board: + name: adafruit_feather_m4_express + full_name: Feather M4 Express + vendor: adafruit + socs: + - name: samd51j19a diff --git a/boards/adafruit/feather_m4_express/doc/img/adafruit_feather_m4_express.webp b/boards/adafruit/feather_m4_express/doc/img/adafruit_feather_m4_express.webp new file mode 100644 index 0000000000000000000000000000000000000000..62ad405f9de3689749d4bd5108fb34e6f535bcb8 GIT binary patch literal 54892 zcmYhBW00pYv$w~#%^lme?HyY?wr$(9W81cE+qOOPfA@LLsZ(#NQu%ZzT}h{Nb^mT< zDRFU=6(AsWF=55uikuoSKtMo9|2j1Y&>S$3kgTGl12hm2@SV1e*OugF3o)jKBq%Tu zJf|W#>lslL!P#8iI;aiz6I8BYmQ@O+M`!`jzTXF}!S!yOag-c@ z1m&39Wl!!ADVIHk|Aq(A-f*8yuj4xo-K$HG!tD`nga2@~bzXiqhrcSb#&#o1a9n$r z&eqK`#`5J#;F&`6cgMqHy*FcvM$W`VF4FFSmBGz~?$-GM#+T>0rHduJ>krsF2V9Ir zZZ^J>tci_8m3sWp`4L}RhbwQx5S86fAKF-77|Zms6?z~~i?|wOyVCDJ^kD)%`Rr%f z#Yb<~@qKC#Dw|&lv$dzAe+^q>7H=P(&W@(Ba6x(rtQX_dTLc@AE3<4VwnCjPR4(7n* zpM=0(U_uy4KYuVoB$HW~ITp3#FK;RV#dD^j?MUl|NZ^=>eIa`wQbzdAzxo-P{cU7J z!5l4#nU9CAi1BTgEfX2xc`J{b@(>C*tF_|$fw>dU#6%@lVDSscY`Wu#m!~}8qe_S6 zn5MDvo!>N*4^R5Lw7R9h9%@?)4ose~2$qlj+()(K2I8N4&L`u#tMpdFVAns&70@<< z+xj*fNW>YiPeQLFPsJ9nk{YOId$9fPcSYw@Rf;tUXMqKwT^D)ood+7@<8K+~YEQ65 z`=!Avs7}Nrcej;g%+y>*`x*lR#lq^Q9Y@j(g-4=Xks0nLw~HtCXFbBCR@I|hD4A}ViYWeo<;&J zUf|7!VK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PQ3S5Dy~&sjm29 zh2!mOlovB}zrgneLU(eBXyZ>_50H!RN9IcES?b3412pi#p1C$)5On?bFehw@Pl zg6s(&mpp1VysS9|)(THeVI z$biuYfieH9o;@3sq;@@DWF!ecm!)E=@9d(oQC=c)H#LAs%%ySddrisUK?&J8Z$@lt z{JDy&Q5%!4UIl?mlJoMN!T&*j6z3(+)iO6sPs2^JTGYyq9LmH#Yd;EspSMd1URd{u z;rz9|F_;g{rd$EfQUq8Md^D(SpRh6Z18bjEV7g2huLQUHe-vj%1bDm0H6ginC;s Date: Thu, 7 Nov 2024 13:53:12 +0100 Subject: [PATCH 2453/4482] west.yml: Update zcbor from 0.9.0 to 0.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is just a README update, so no changes are needed in Zephyr. Signed-off-by: Øyvind Rønningstad --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 87657ebf6df36..924a95c647027 100644 --- a/west.yml +++ b/west.yml @@ -340,7 +340,7 @@ manifest: revision: 84ef879a46d7bfd9a423fbfb502b04289861f9ea path: modules/lib/uoscore-uedhoc - name: zcbor - revision: 47f34dd7f5284e8750b5a715dee7f77c6c5bdc3f + revision: 9b07780aca6fb21f82a241ba386ad9b379809337 path: modules/lib/zcbor self: From d0aced304bbff3da4a3c299d40de0cfb53025da3 Mon Sep 17 00:00:00 2001 From: Steve Boylan Date: Tue, 11 Jun 2024 14:52:15 -0400 Subject: [PATCH 2454/4482] drivers: spi: RPi Pico PIO SPI code size and byte order. Use minimized PIO code for 3-wire operation. Input and output buffers are conventionally stored in bus byte order. For 16 and 32 bit transfers, this is effectively big-endian, so txbuf and rxbuf need to be read as such. Those pointers also need to be declared uint8_t * instead of void *. In addition, tx_count and rx_count are based on dts, and refer to whole transfers (8, 16, or 32 bits), not bytes. Added rpi_pico.overlay to samples/sensor/magn_polling to demonstrate 32-bit word size, and updated the README.rst to make it independent of the specific sensor. Clean up compliance check failures. Fix typos. Synchronize 3-wire TX and RX cycles. Simplify state machine synchronization Minimize SPI bus delay time in 3-wire mode Move clock delay to PIO code and remove k_sleep Signed-off-by: Steve Boylan --- drivers/spi/spi_rpi_pico_pio.c | 215 ++++++------------ samples/sensor/magn_polling/README.rst | 24 ++ .../magn_polling/boards/rpi_pico.overlay | 44 ++++ 3 files changed, 134 insertions(+), 149 deletions(-) create mode 100644 samples/sensor/magn_polling/boards/rpi_pico.overlay diff --git a/drivers/spi/spi_rpi_pico_pio.c b/drivers/spi/spi_rpi_pico_pio.c index c7eb014d9d578..951ac4c7936dd 100644 --- a/drivers/spi/spi_rpi_pico_pio.c +++ b/drivers/spi/spi_rpi_pico_pio.c @@ -12,6 +12,7 @@ LOG_MODULE_REGISTER(spi_pico_pio); #include #include +#include #include #include #include @@ -48,7 +49,6 @@ struct spi_pico_pio_data { uint32_t pio_rx_offset; uint32_t pio_rx_wrap_target; uint32_t pio_rx_wrap; - uint32_t tx_period_ticks; uint32_t bits; uint32_t dfs; }; @@ -62,10 +62,10 @@ struct spi_pico_pio_data { #define SPI_MODE_0_0_CYCLES 4 RPI_PICO_PIO_DEFINE_PROGRAM(spi_mode_0_0, SPI_MODE_0_0_WRAP_TARGET, SPI_MODE_0_0_WRAP, - /* .wrap_target */ - 0x6101, /* 0: out pins, 1 side 0 [1] */ - 0x5101, /* 1: in pins, 1 side 1 [1] */ - /* .wrap */ + /* .wrap_target */ + 0x6101, /* 0: out pins, 1 side 0 [1] */ + 0x5101, /* 1: in pins, 1 side 1 [1] */ + /* .wrap */ ); /* ------------ */ @@ -77,11 +77,11 @@ RPI_PICO_PIO_DEFINE_PROGRAM(spi_mode_0_0, SPI_MODE_0_0_WRAP_TARGET, SPI_MODE_0_0 #define SPI_MODE_1_1_CYCLES 4 RPI_PICO_PIO_DEFINE_PROGRAM(spi_mode_1_1, SPI_MODE_1_1_WRAP_TARGET, SPI_MODE_1_1_WRAP, - /* .wrap_target */ - 0x7021, /* 0: out x, 1 side 1 */ - 0xa101, /* 1: mov pins, x side 0 [1] */ - 0x5001, /* 2: in pins, 1 side 1 */ - /* .wrap */ + /* .wrap_target */ + 0x7021, /* 0: out x, 1 side 1 */ + 0xa101, /* 1: mov pins, x side 0 [1] */ + 0x5001, /* 2: in pins, 1 side 1 */ + /* .wrap */ ); #if SPI_RPI_PICO_PIO_HALF_DUPLEX_ENABLED @@ -95,74 +95,29 @@ RPI_PICO_PIO_DEFINE_PROGRAM(spi_mode_1_1, SPI_MODE_1_1_WRAP_TARGET, SPI_MODE_1_1 RPI_PICO_PIO_DEFINE_PROGRAM(spi_sio_mode_0_0_tx, SPI_SIO_MODE_0_0_TX_WRAP_TARGET, SPI_SIO_MODE_0_0_TX_WRAP, - /* .wrap_target */ - 0x80a0, /* 0: pull block side 0 */ - 0x6001, /* 1: out pins, 1 side 0 */ - 0x10e1, /* 2: jmp !osre, 1 side 1 */ - /* .wrap */ + /* .wrap_target */ + 0x80a0, /* 0: pull block side 0 */ + 0x6001, /* 1: out pins, 1 side 0 */ + 0x10e1, /* 2: jmp !osre, 1 side 1 */ + /* .wrap */ ); /* ------------------------- */ -/* spi_sio_mode_0_0_8_bit_rx */ +/* spi_sio_mode_0_0_rx */ /* ------------------------- */ -#define SPI_SIO_MODE_0_0_8_BIT_RX_WRAP_TARGET 0 -#define SPI_SIO_MODE_0_0_8_BIT_RX_WRAP 6 -#define SPI_SIO_MODE_0_0_8_BIT_RX_CYCLES 2 - -RPI_PICO_PIO_DEFINE_PROGRAM(spi_sio_mode_0_0_8_bit_rx, SPI_SIO_MODE_0_0_8_BIT_RX_WRAP_TARGET, - SPI_SIO_MODE_0_0_8_BIT_RX_WRAP, - /* .wrap_target */ - 0x80a0, /* 0: pull block side 0 */ - 0x6020, /* 1: out x, 32 side 0 */ - 0xe047, /* 2: set y, 7 side 0 */ - 0x5001, /* 3: in pins, 1 side 1 */ - 0x0083, /* 4: jmp y--, 3 side 0 */ - 0x8020, /* 5: push block side 0 */ - 0x0042, /* 6: jmp x--, 2 side 0 */ - /* .wrap */ -); - -/* -------------------------- */ -/* spi_sio_mode_0_0_16_bit_rx */ -/* -------------------------- */ - -#define SPI_SIO_MODE_0_0_16_BIT_RX_WRAP_TARGET 0 -#define SPI_SIO_MODE_0_0_16_BIT_RX_WRAP 6 -#define SPI_SIO_MODE_0_0_16_BIT_RX_CYCLES 2 - -RPI_PICO_PIO_DEFINE_PROGRAM(spi_sio_mode_0_0_16_bit_rx, SPI_SIO_MODE_0_0_16_BIT_RX_WRAP_TARGET, - SPI_SIO_MODE_0_0_16_BIT_RX_WRAP, - /* .wrap_target */ - 0x80a0, /* 0: pull block side 0 */ - 0x6020, /* 1: out x, 32 side 0 */ - 0xe04f, /* 2: set y, 15 side 0 */ - 0x5001, /* 3: in pins, 1 side 1 */ - 0x0083, /* 4: jmp y--, 3 side 0 */ - 0x8020, /* 5: push block side 0 */ - 0x0042, /* 6: jmp x--, 2 side 0 */ - /* .wrap */ -); - -/* -------------------------- */ -/* spi_sio_mode_0_0_32_bit_rx */ -/* -------------------------- */ - -#define SPI_SIO_MODE_0_0_32_BIT_RX_WRAP_TARGET 0 -#define SPI_SIO_MODE_0_0_32_BIT_RX_WRAP 6 -#define SPI_SIO_MODE_0_0_32_BIT_RX_CYCLES 2 - -RPI_PICO_PIO_DEFINE_PROGRAM(spi_sio_mode_0_0_32_bit_rx, SPI_SIO_MODE_0_0_32_BIT_RX_WRAP_TARGET, - SPI_SIO_MODE_0_0_32_BIT_RX_WRAP, - /* .wrap_target */ - 0x80a0, /* 0: pull block side 0 */ - 0x6020, /* 1: out x, 32 side 0 */ - 0xe05f, /* 2: set y, 31 side 0 */ - 0x5001, /* 3: in pins, 1 side 1 */ - 0x0083, /* 4: jmp y--, 3 side 0 */ - 0x8020, /* 5: push block side 0 */ - 0x0042, /* 6: jmp x--, 2 side 0 */ - /* .wrap */ +#define SPI_SIO_MODE_0_0_RX_WRAP_TARGET 0 +#define SPI_SIO_MODE_0_0_RX_WRAP 3 +#define SPI_SIO_MODE_0_0_RX_CYCLES 2 + +RPI_PICO_PIO_DEFINE_PROGRAM(spi_sio_mode_0_0_rx, SPI_SIO_MODE_0_0_RX_WRAP_TARGET, + SPI_SIO_MODE_0_0_RX_WRAP, + /* .wrap_target */ + 0x80a0, /* 0: pull block side 0 */ + 0x6020, /* 1: out x, 32 side 0 */ + 0x5001, /* 2: in pins, 1 side 1 */ + 0x0042, /* 3: jmp x--, 2 side 0 */ + /* .wrap */ ); #endif /* SPI_RPI_PICO_PIO_HALF_DUPLEX_ENABLED */ @@ -237,7 +192,8 @@ static inline uint32_t spi_pico_pio_sm_get32(PIO pio, uint sm) static inline int spi_pico_pio_sm_complete(struct spi_pico_pio_data *data) { - return (data->pio->sm[data->pio_sm].addr == data->pio_tx_offset); + return ((data->pio->sm[data->pio_sm].addr == data->pio_tx_offset) && + pio_sm_is_tx_fifo_empty(data->pio, data->pio_sm)); } static int spi_pico_pio_configure(const struct spi_pico_pio_config *dev_cfg, @@ -349,53 +305,22 @@ static int spi_pico_pio_configure(const struct spi_pico_pio_config *dev_cfg, float clock_div = spi_pico_pio_clock_divisor(clock_freq, SPI_SIO_MODE_0_0_TX_CYCLES, spi_cfg->frequency); - data->tx_period_ticks = DIV_ROUND_UP((data->bits * CONFIG_SYS_CLOCK_TICKS_PER_SEC), - spi_cfg->frequency); data->pio_tx_offset = pio_add_program(data->pio, RPI_PICO_PIO_GET_PROGRAM(spi_sio_mode_0_0_tx)); - switch (data->dfs) { - case 4: - data->pio_rx_offset = pio_add_program( - data->pio, RPI_PICO_PIO_GET_PROGRAM(spi_sio_mode_0_0_32_bit_rx)); - data->pio_rx_wrap_target = - data->pio_rx_offset + - RPI_PICO_PIO_GET_WRAP_TARGET(spi_sio_mode_0_0_32_bit_rx); - data->pio_rx_wrap = data->pio_rx_offset + - RPI_PICO_PIO_GET_WRAP(spi_sio_mode_0_0_32_bit_rx); - break; - - case 2: - data->pio_rx_offset = pio_add_program( - data->pio, RPI_PICO_PIO_GET_PROGRAM(spi_sio_mode_0_0_16_bit_rx)); - data->pio_rx_wrap_target = - data->pio_rx_offset + - RPI_PICO_PIO_GET_WRAP_TARGET(spi_sio_mode_0_0_16_bit_rx); - data->pio_rx_wrap = data->pio_rx_offset + - RPI_PICO_PIO_GET_WRAP(spi_sio_mode_0_0_16_bit_rx); - break; - - case 1: - data->pio_rx_offset = pio_add_program( - data->pio, RPI_PICO_PIO_GET_PROGRAM(spi_sio_mode_0_0_8_bit_rx)); - data->pio_rx_wrap_target = - data->pio_rx_offset + - RPI_PICO_PIO_GET_WRAP_TARGET(spi_sio_mode_0_0_8_bit_rx); - data->pio_rx_wrap = data->pio_rx_offset + - RPI_PICO_PIO_GET_WRAP(spi_sio_mode_0_0_8_bit_rx); - break; - - default: - LOG_ERR("Support for %d transfer size not enabled", (data->dfs * 8)); - return -EINVAL; - } + data->pio_rx_offset = + pio_add_program(data->pio, RPI_PICO_PIO_GET_PROGRAM(spi_sio_mode_0_0_rx)); + data->pio_rx_wrap_target = + data->pio_rx_offset + RPI_PICO_PIO_GET_WRAP_TARGET(spi_sio_mode_0_0_rx); + data->pio_rx_wrap = + data->pio_rx_offset + RPI_PICO_PIO_GET_WRAP(spi_sio_mode_0_0_rx); sm_config = pio_get_default_sm_config(); sm_config_set_clkdiv(&sm_config, clock_div); sm_config_set_in_pins(&sm_config, sio->pin); - sm_config_set_in_shift(&sm_config, lsb, false, data->bits); + sm_config_set_in_shift(&sm_config, lsb, true, data->bits); sm_config_set_out_pins(&sm_config, sio->pin, 1); sm_config_set_out_shift(&sm_config, lsb, false, data->bits); hw_set_bits(&data->pio->input_sync_bypass, 1u << sio->pin); @@ -496,8 +421,8 @@ static void spi_pico_pio_txrx_4_wire(const struct device *dev) { struct spi_pico_pio_data *data = dev->data; const size_t chunk_len = spi_context_max_continuous_chunk(&data->spi_ctx); - const void *txbuf = data->spi_ctx.tx_buf; - void *rxbuf = data->spi_ctx.rx_buf; + const uint8_t *txbuf = data->spi_ctx.tx_buf; + uint8_t *rxbuf = data->spi_ctx.rx_buf; uint32_t txrx; size_t fifo_cnt = 0; @@ -516,18 +441,16 @@ static void spi_pico_pio_txrx_4_wire(const struct device *dev) switch (data->dfs) { case 4: { if (txbuf) { - txrx = ((uint32_t *)txbuf)[data->tx_count]; + txrx = sys_get_be32(txbuf + (data->tx_count * 4)); } spi_pico_pio_sm_put32(data->pio, data->pio_sm, txrx); - data->tx_count += 4; } break; case 2: { if (txbuf) { - txrx = ((uint16_t *)txbuf)[data->tx_count]; + txrx = sys_get_be16(txbuf + (data->tx_count * 2)); } spi_pico_pio_sm_put16(data->pio, data->pio_sm, txrx); - data->tx_count += 2; } break; case 1: { @@ -535,13 +458,13 @@ static void spi_pico_pio_txrx_4_wire(const struct device *dev) txrx = ((uint8_t *)txbuf)[data->tx_count]; } spi_pico_pio_sm_put8(data->pio, data->pio_sm, txrx); - data->tx_count++; } break; default: LOG_ERR("Support fot %d bits not enabled", (data->dfs * 8)); break; } + data->tx_count++; fifo_cnt++; } @@ -553,9 +476,8 @@ static void spi_pico_pio_txrx_4_wire(const struct device *dev) /* Discard received data if rx buffer not assigned */ if (rxbuf) { - ((uint32_t *)rxbuf)[data->rx_count] = (uint32_t)txrx; + sys_put_be32(txrx, rxbuf + (data->rx_count * 4)); } - data->rx_count += 4; } break; case 2: { @@ -563,9 +485,8 @@ static void spi_pico_pio_txrx_4_wire(const struct device *dev) /* Discard received data if rx buffer not assigned */ if (rxbuf) { - ((uint16_t *)rxbuf)[data->rx_count] = (uint16_t)txrx; + sys_put_be16(txrx, rxbuf + (data->rx_count * 2)); } - data->rx_count += 2; } break; case 1: { @@ -575,13 +496,13 @@ static void spi_pico_pio_txrx_4_wire(const struct device *dev) if (rxbuf) { ((uint8_t *)rxbuf)[data->rx_count] = (uint8_t)txrx; } - data->rx_count++; } break; default: LOG_ERR("Support fot %d bits not enabled", (data->dfs * 8)); break; } + data->rx_count++; fifo_cnt--; } } @@ -592,8 +513,8 @@ static void spi_pico_pio_txrx_3_wire(const struct device *dev) #if SPI_RPI_PICO_PIO_HALF_DUPLEX_ENABLED struct spi_pico_pio_data *data = dev->data; const struct spi_pico_pio_config *dev_cfg = dev->config; - const void *txbuf = data->spi_ctx.tx_buf; - void *rxbuf = data->spi_ctx.rx_buf; + const uint8_t *txbuf = data->spi_ctx.tx_buf; + uint8_t *rxbuf = data->spi_ctx.rx_buf; uint32_t txrx; int sio_pin = dev_cfg->sio_gpio.pin; uint32_t tx_size = data->spi_ctx.tx_len; /* Number of WORDS to send */ @@ -622,33 +543,32 @@ static void spi_pico_pio_txrx_3_wire(const struct device *dev) switch (data->dfs) { case 4: { - txrx = ((uint32_t *)txbuf)[data->tx_count]; + txrx = sys_get_be32(txbuf + (data->tx_count * 4)); spi_pico_pio_sm_put32(data->pio, data->pio_sm, txrx); - data->tx_count += 4; } break; case 2: { - txrx = ((uint16_t *)txbuf)[data->tx_count]; + txrx = sys_get_be16(txbuf + (data->tx_count * 2)); spi_pico_pio_sm_put16(data->pio, data->pio_sm, txrx); - data->tx_count += 2; } break; case 1: { txrx = ((uint8_t *)txbuf)[data->tx_count]; spi_pico_pio_sm_put8(data->pio, data->pio_sm, txrx); - data->tx_count++; } break; default: LOG_ERR("Support fot %d bits not enabled", (data->dfs * 8)); break; } + data->tx_count++; } } + /* Wait for the state machine to complete the cycle */ + /* before resetting the PIO for reading. */ while ((!pio_sm_is_tx_fifo_empty(data->pio, data->pio_sm)) || - (!spi_pico_pio_sm_complete(data))) { - k_sleep(K_TICKS(data->tx_period_ticks)); - } + (!spi_pico_pio_sm_complete(data))) + ; } if (rxbuf) { @@ -659,8 +579,7 @@ static void spi_pico_pio_txrx_3_wire(const struct device *dev) pio_sm_set_pindirs_with_mask(data->pio, data->pio_sm, 0, BIT(sio_pin)); pio_sm_restart(data->pio, data->pio_sm); pio_sm_clkdiv_restart(data->pio, data->pio_sm); - pio_sm_put(data->pio, data->pio_sm, rx_size - 1); - pio_sm_exec(data->pio, data->pio_sm, pio_encode_out(pio_x, 32)); + pio_sm_put(data->pio, data->pio_sm, (rx_size * data->bits) - 1); pio_sm_exec(data->pio, data->pio_sm, pio_encode_jmp(data->pio_rx_offset)); pio_sm_set_enabled(data->pio, data->pio_sm, true); @@ -671,26 +590,24 @@ static void spi_pico_pio_txrx_3_wire(const struct device *dev) switch (data->dfs) { case 4: { txrx = spi_pico_pio_sm_get32(data->pio, data->pio_sm); - ((uint32_t *)rxbuf)[data->rx_count] = (uint32_t)txrx; - data->rx_count += 4; + sys_put_be32(txrx, rxbuf + (data->rx_count * 4)); } break; case 2: { txrx = spi_pico_pio_sm_get16(data->pio, data->pio_sm); - ((uint16_t *)rxbuf)[data->rx_count] = (uint16_t)txrx; - data->rx_count += 2; + sys_put_be16(txrx, rxbuf + (data->rx_count * 2)); } break; case 1: { txrx = spi_pico_pio_sm_get8(data->pio, data->pio_sm); - ((uint8_t *)rxbuf)[data->rx_count] = (uint8_t)txrx; - data->rx_count++; + rxbuf[data->rx_count] = (uint8_t)txrx; } break; default: LOG_ERR("Support fot %d bits not enabled", (data->dfs * 8)); break; } + data->rx_count++; } } } @@ -846,12 +763,12 @@ int spi_pico_pio_init(const struct device *dev) &spi_pico_pio_config_##inst, POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ &spi_pico_pio_api); \ BUILD_ASSERT(DT_INST_NODE_HAS_PROP(inst, clk_gpios), "Missing clock GPIO"); \ - BUILD_ASSERT(((DT_INST_NODE_HAS_PROP(inst, mosi_gpios) \ - || DT_INST_NODE_HAS_PROP(inst, miso_gpios)) \ - && (!DT_INST_NODE_HAS_PROP(inst, sio_gpios))) \ - || (DT_INST_NODE_HAS_PROP(inst, sio_gpios) \ - && !(DT_INST_NODE_HAS_PROP(inst, mosi_gpios) \ - || DT_INST_NODE_HAS_PROP(inst, miso_gpios))), \ - "Invalid GPIO Configuration"); + BUILD_ASSERT(((DT_INST_NODE_HAS_PROP(inst, mosi_gpios) || \ + DT_INST_NODE_HAS_PROP(inst, miso_gpios)) && \ + (!DT_INST_NODE_HAS_PROP(inst, sio_gpios))) || \ + (DT_INST_NODE_HAS_PROP(inst, sio_gpios) && \ + !(DT_INST_NODE_HAS_PROP(inst, mosi_gpios) || \ + DT_INST_NODE_HAS_PROP(inst, miso_gpios))), \ + "Invalid GPIO Configuration"); DT_INST_FOREACH_STATUS_OKAY(SPI_PICO_PIO_INIT) diff --git a/samples/sensor/magn_polling/README.rst b/samples/sensor/magn_polling/README.rst index e0eaa50d3d64d..97f860a706918 100644 --- a/samples/sensor/magn_polling/README.rst +++ b/samples/sensor/magn_polling/README.rst @@ -10,3 +10,27 @@ Overview Sample application that periodically reads magnetometer (X, Y, Z) data from the first available device that implements SENSOR_CHAN_MAGN_* (predefined array of device names). + +Board-specific overlays +*********************** + +TMAG5170 via Raspberry Pi Pico +============================== + +The Zephyr driver for the :dtcompatible:`ti,tmag5170`` requires an SPI driver +that supports 32-bit SPI_WORD_SIZE. On the :zephyr:board:`rpi_pico`, the +:dtcompatible:`raspberrypi,pico-spi-pio` SPI driver provides this support, +demonstrated with the +:zephyr_file:`samples/sensor/magn_polling/boards/rpi_pico.overlay`. + +The GPIO pin assignments in the overlay file are arbitrary. The PIO SPI +driver allows using any four GPIO pins for the SPI bus. Just keep in mind +that the pin assignments in the pinctrl block and the pio0_spi0 block +must match. + +With the sensor wired to the desired pins, build and flash with: + +.. zephyr-app-commands:: + :zephyr-app: samples/sensor/magn_polling + :goals: build flash + :board: rpi_pico diff --git a/samples/sensor/magn_polling/boards/rpi_pico.overlay b/samples/sensor/magn_polling/boards/rpi_pico.overlay new file mode 100644 index 0000000000000..e2cf9fe377024 --- /dev/null +++ b/samples/sensor/magn_polling/boards/rpi_pico.overlay @@ -0,0 +1,44 @@ +/ { + aliases { + magn0 = &tmag5170; + }; +}; + +&pinctrl { + pio0_spi0_default: pio0_spi0_default { + /* gpio 9 is used for chip select, not assigned to the PIO */ + group1 { + pinmux = , ; + }; + group2 { + pinmux = ; + input-enable; + }; + }; + +}; + +&pio0 { + status = "okay"; + + pio0_spi0: pio0_spi0 { + pinctrl-0 = <&pio0_spi0_default>; + pinctrl-names = "default"; + + compatible = "raspberrypi,pico-spi-pio"; + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&clocks RPI_PICO_CLKID_CLK_SYS>; + miso-gpios = <&gpio0 8 0>; + cs-gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; + clk-gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>; + mosi-gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; + tmag5170: tmag5170@0 { + compatible = "ti,tmag5170"; + reg = <0>; + operating-mode = <3>; + spi-max-frequency = <1000000>; /* conservatively set to 1MHz */ + }; + }; +}; From 6d187ba8820af456fe893eb499224f05c7211038 Mon Sep 17 00:00:00 2001 From: Andries Kruithof Date: Wed, 24 Jul 2024 11:26:06 +0200 Subject: [PATCH 2455/4482] Bluetooth: Audio: Bablesim tests for CAP broadcast reception stop Implement a babblesim test for the CAP broadcast reception stop procedure Signed-off-by: Andries Kruithof --- .../bluetooth/audio/src/cap_acceptor_test.c | 30 ++++++++++-- .../bluetooth/audio/src/cap_commander_test.c | 48 ++++++++++++++++--- 2 files changed, 66 insertions(+), 12 deletions(-) diff --git a/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c b/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c index d0a33bdc0a253..dab3708657a51 100644 --- a/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c @@ -401,9 +401,15 @@ static int bis_sync_req_cb(struct bt_conn *conn, const struct bt_bap_scan_delegator_recv_state *recv_state, const uint32_t bis_sync_req[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]) { - /* We only care about a single subgroup in this test */ + uint32_t total_bis = 0U; + broadcaster_broadcast_id = recv_state->broadcast_id; - if (bis_sync_req[0] != 0) { + + for (int i = 0; i < recv_state->num_subgroups; i++) { + total_bis |= bis_sync_req[i]; + } + + if (total_bis != 0U) { SET_FLAG(flag_bis_sync_requested); } else { UNSET_FLAG(flag_bis_sync_requested); @@ -792,6 +798,7 @@ static void init(void) UNSET_FLAG(flag_pa_request); UNSET_FLAG(flag_received); UNSET_FLAG(flag_base_metadata_updated); + UNSET_FLAG(flag_bis_sync_requested); for (size_t i = 0U; i < ARRAY_SIZE(broadcast_sink_streams); i++) { bt_cap_stream_ops_register( @@ -1039,10 +1046,12 @@ static void test_cap_acceptor_broadcast_reception(void) { static struct bt_bap_stream *bap_streams[ARRAY_SIZE(broadcast_sink_streams)]; size_t stream_count; + int err; init(); WAIT_FOR_FLAG(flag_pa_request); + WAIT_FOR_FLAG(flag_bis_sync_requested); pa_sync_create(); @@ -1051,12 +1060,23 @@ static void test_cap_acceptor_broadcast_reception(void) sink_wait_for_data(); /* Since we are re-using the BAP broadcast source test - * we get a metadata update, and we need to send an extra - * backchannel sync + * we get a metadata update */ base_wait_for_metadata_update(); - backchannel_sync_send_all(); /* let broadcaster know we can stop the source */ + /* when flag_bis_sync_requested is unset the bis_sync for all subgroups were set to 0 */ + WAIT_FOR_UNSET_FLAG(flag_bis_sync_requested); + + UNSET_FLAG(flag_syncable); + err = bt_bap_broadcast_sink_stop(g_broadcast_sink); + if (err != 0) { + FAIL("Unable to stop the sink: %d\n", err); + return; + } + + WAIT_FOR_FLAG(flag_syncable); + /* Although in theory we can now sync, in practice we can not since all BIS-syncs are 0 */ + backchannel_sync_send_all(); /* signal that we have stopped listening */ wait_for_streams_stop(stream_count); diff --git a/tests/bsim/bluetooth/audio/src/cap_commander_test.c b/tests/bsim/bluetooth/audio/src/cap_commander_test.c index 43e57a2e6f5b7..e35aa6ec92def 100644 --- a/tests/bsim/bluetooth/audio/src/cap_commander_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_commander_test.c @@ -51,6 +51,7 @@ static uint32_t broadcaster_broadcast_id; static uint8_t received_base[UINT8_MAX]; static uint8_t received_base_size; +static uint8_t src_id[CONFIG_BT_MAX_CONN]; static struct k_sem sem_disconnected; static struct k_sem sem_cas_discovered; @@ -66,6 +67,7 @@ CREATE_FLAG(flag_microphone_mute_changed); CREATE_FLAG(flag_microphone_gain_changed); CREATE_FLAG(flag_broadcast_reception_start); +CREATE_FLAG(flag_broadcast_reception_stop); CREATE_FLAG(flag_broadcaster_found); CREATE_FLAG(flag_base_received); CREATE_FLAG(flag_recv_state_updated_with_bis_sync); @@ -166,6 +168,16 @@ static void cap_broadcast_reception_start_cb(struct bt_conn *conn, int err) SET_FLAG(flag_broadcast_reception_start); } + +static void cap_broadcast_reception_stop_cb(struct bt_conn *conn, int err) +{ + if (err != 0) { + FAIL("Failed to perform broadcast reception stop for conn %p: %d\n", conn, err); + return; + } + + SET_FLAG(flag_broadcast_reception_stop); +} #endif /* CONFIG_BT_BAP_BROADCAST_ASSISTANT*/ static struct bt_cap_commander_cb cap_cb = { @@ -185,6 +197,7 @@ static struct bt_cap_commander_cb cap_cb = { #endif /* CONFIG_BT_MICP_MIC_CTLR */ #if defined(CONFIG_BT_BAP_BROADCAST_ASSISTANT) .broadcast_reception_start = cap_broadcast_reception_start_cb, + .broadcast_reception_stop = cap_broadcast_reception_stop_cb, #endif /* CONFIG_BT_BAP_BROADCAST_ASSISTANT*/ }; @@ -428,6 +441,7 @@ bap_broadcast_assistant_recv_state_cb(struct bt_conn *conn, int err, { char le_addr[BT_ADDR_LE_STR_LEN]; char bad_code[BT_ISO_BROADCAST_CODE_SIZE * 2 + 1]; + size_t acceptor_count = get_dev_cnt() - 2; if (err != 0) { FAIL("BASS recv state read failed (%d)\n", err); @@ -451,6 +465,12 @@ bap_broadcast_assistant_recv_state_cb(struct bt_conn *conn, int err, return; } + for (size_t index = 0; index < acceptor_count; index++) { + if (conn == connected_conns[index]) { + src_id[index] = state->src_id; + } + } + for (uint8_t i = 0; i < state->num_subgroups; i++) { const struct bt_bap_bass_subgroup *subgroup = &state->subgroups[i]; struct net_buf_simple buf; @@ -544,6 +564,7 @@ static void init(size_t acceptor_cnt) UNSET_FLAG(flag_microphone_gain_changed); UNSET_FLAG(flag_broadcast_reception_start); + UNSET_FLAG(flag_broadcast_reception_stop); UNSET_FLAG(flag_broadcaster_found); UNSET_FLAG(flag_base_received); UNSET_FLAG(flag_recv_state_updated_with_bis_sync); @@ -978,17 +999,31 @@ static void test_broadcast_reception_start(size_t acceptor_count) static void test_broadcast_reception_stop(size_t acceptor_count) { - struct bt_cap_commander_broadcast_reception_stop_param reception_stop_param; + struct bt_cap_commander_broadcast_reception_stop_param reception_stop_param = {0}; + struct bt_cap_commander_broadcast_reception_stop_member_param param[CONFIG_BT_MAX_CONN] = { + 0}; + int err; - /* reception stop is not implemented yet, for now the following command will fail*/ reception_stop_param.type = BT_CAP_SET_TYPE_AD_HOC; - reception_stop_param.param = NULL; - reception_stop_param.count = 0U; + reception_stop_param.param = param; + reception_stop_param.count = acceptor_count; + for (size_t i = 0; i < acceptor_count; i++) { + uint8_t num_subgroups; + + reception_stop_param.param[i].member.member = connected_conns[i]; + + reception_stop_param.param[i].src_id = src_id[i]; + num_subgroups = + bt_bap_base_get_subgroup_count((const struct bt_bap_base *)received_base); + reception_stop_param.param[i].num_subgroups = num_subgroups; + } err = bt_cap_commander_broadcast_reception_stop(&reception_stop_param); if (err != 0) { - printk("Command not implemented yet, could not stop broadcast reception %d\n", err); + FAIL("Could not initiate broadcast reception stop: %d\n", err); + return; } + WAIT_FOR_FLAG(flag_broadcast_reception_stop); } static void test_main_cap_commander_capture_and_render(void) @@ -1070,8 +1105,7 @@ static void test_main_cap_commander_broadcast_reception(void) backchannel_sync_wait_any(); /* wait for the acceptor to receive data */ - backchannel_sync_wait_any(); /* wait for the acceptor to receive a metadata update - */ + backchannel_sync_wait_any(); /* wait for the acceptor to receive a metadata update */ test_broadcast_reception_stop(acceptor_count); From 9df661ea1a16e29fb4423fe5036f8bf53fe2072e Mon Sep 17 00:00:00 2001 From: Adrien Leravat Date: Tue, 23 Jul 2024 21:31:40 -0700 Subject: [PATCH 2456/4482] drivers: sensor: hc-sr04: add driver Add a simple driver for the HC-SR04 ultrasonic distance sensor. Signed-off-by: Adrien Leravat --- drivers/sensor/CMakeLists.txt | 1 + drivers/sensor/Kconfig | 1 + drivers/sensor/hc_sr04/CMakeLists.txt | 4 + drivers/sensor/hc_sr04/Kconfig | 12 ++ drivers/sensor/hc_sr04/hc_sr04.c | 189 ++++++++++++++++++++++++++ dts/bindings/sensor/hc-sr04.yaml | 22 +++ 6 files changed, 229 insertions(+) create mode 100644 drivers/sensor/hc_sr04/CMakeLists.txt create mode 100644 drivers/sensor/hc_sr04/Kconfig create mode 100644 drivers/sensor/hc_sr04/hc_sr04.c create mode 100644 dts/bindings/sensor/hc-sr04.yaml diff --git a/drivers/sensor/CMakeLists.txt b/drivers/sensor/CMakeLists.txt index 53f12d5eeb63a..ca65a4128003c 100644 --- a/drivers/sensor/CMakeLists.txt +++ b/drivers/sensor/CMakeLists.txt @@ -42,6 +42,7 @@ add_subdirectory_ifdef(CONFIG_EXPLORIR_M explorir_m) add_subdirectory_ifdef(CONFIG_F75303 f75303) add_subdirectory_ifdef(CONFIG_FCX_MLDX5 fcx_mldx5) add_subdirectory_ifdef(CONFIG_GROW_R502A grow_r502a) +add_subdirectory_ifdef(CONFIG_HC_SR04 hc_sr04) add_subdirectory_ifdef(CONFIG_HP206C hp206c) add_subdirectory_ifdef(CONFIG_IST8310 ist8310) add_subdirectory_ifdef(CONFIG_LM35 lm35) diff --git a/drivers/sensor/Kconfig b/drivers/sensor/Kconfig index 329a6a858698a..452d8182eb798 100644 --- a/drivers/sensor/Kconfig +++ b/drivers/sensor/Kconfig @@ -126,6 +126,7 @@ source "drivers/sensor/explorir_m/Kconfig" source "drivers/sensor/f75303/Kconfig" source "drivers/sensor/fcx_mldx5/Kconfig" source "drivers/sensor/grow_r502a/Kconfig" +source "drivers/sensor/hc_sr04/Kconfig" source "drivers/sensor/hp206c/Kconfig" source "drivers/sensor/ist8310/Kconfig" source "drivers/sensor/lm35/Kconfig" diff --git a/drivers/sensor/hc_sr04/CMakeLists.txt b/drivers/sensor/hc_sr04/CMakeLists.txt new file mode 100644 index 0000000000000..d05237a77c481 --- /dev/null +++ b/drivers/sensor/hc_sr04/CMakeLists.txt @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library() +zephyr_library_sources(hc_sr04.c) diff --git a/drivers/sensor/hc_sr04/Kconfig b/drivers/sensor/hc_sr04/Kconfig new file mode 100644 index 0000000000000..13b4b1e7cb9b3 --- /dev/null +++ b/drivers/sensor/hc_sr04/Kconfig @@ -0,0 +1,12 @@ +# HC-SR04 Ultrasound sensor configuration options + +# Copyright (c) 2024 Adrien Leravat +# SPDX-License-Identifier: Apache-2.0 + +config HC_SR04 + bool "HC-SR04 Ultrasound distance sensor" + default y + depends on DT_HAS_HC_SR04_ENABLED + depends on GPIO + help + Enable driver for HC-SR04 distance sensor. diff --git a/drivers/sensor/hc_sr04/hc_sr04.c b/drivers/sensor/hc_sr04/hc_sr04.c new file mode 100644 index 0000000000000..b3da2372aa35b --- /dev/null +++ b/drivers/sensor/hc_sr04/hc_sr04.c @@ -0,0 +1,189 @@ +/* + * Copyright (c) 2024 Adrien Leravat + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT hc_sr04 + +#include +#include +#include +#include + +LOG_MODULE_REGISTER(HC_SR04, CONFIG_SENSOR_LOG_LEVEL); + +#define HC_SR04_MM_PER_MS 171 + +static const uint32_t hw_cycles_per_ms = sys_clock_hw_cycles_per_sec() / 1000; + +struct hcsr04_data { + const struct device *dev; + struct gpio_callback gpio_cb; + struct k_sem sem; + uint32_t start_cycles; + atomic_t echo_high_cycles; +}; + +struct hcsr04_config { + struct gpio_dt_spec trigger_gpios; + struct gpio_dt_spec echo_gpios; +}; + +static void hcsr04_gpio_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins); + +static int hcsr04_configure_gpios(const struct hcsr04_config *cfg) +{ + int ret; + + if (!gpio_is_ready_dt(&cfg->trigger_gpios)) { + LOG_ERR("GPIO '%s' not ready", cfg->trigger_gpios.port->name); + return -ENODEV; + } + ret = gpio_pin_configure_dt(&cfg->trigger_gpios, GPIO_OUTPUT_LOW); + if (ret < 0) { + LOG_ERR("Failed to configure '%s' as output: %d", cfg->trigger_gpios.port->name, + ret); + return ret; + } + + if (!gpio_is_ready_dt(&cfg->echo_gpios)) { + LOG_ERR("GPIO '%s' not ready", cfg->echo_gpios.port->name); + return -ENODEV; + } + ret = gpio_pin_configure_dt(&cfg->echo_gpios, GPIO_INPUT); + if (ret < 0) { + LOG_ERR("Failed to configure '%s' as output: %d", cfg->echo_gpios.port->name, ret); + return ret; + } + + return 0; +} + +static int hcsr04_configure_interrupt(const struct hcsr04_config *cfg, struct hcsr04_data *data) +{ + int ret; + + /* Disable initially to avoid spurious interrupts. */ + ret = gpio_pin_interrupt_configure(cfg->echo_gpios.port, cfg->echo_gpios.pin, + GPIO_INT_DISABLE); + if (ret < 0) { + LOG_ERR("Failed to configure '%s' as interrupt: %d", cfg->echo_gpios.port->name, + ret); + return -EIO; + } + gpio_init_callback(&data->gpio_cb, &hcsr04_gpio_callback, BIT(cfg->echo_gpios.pin)); + ret = gpio_add_callback(cfg->echo_gpios.port, &data->gpio_cb); + if (ret < 0) { + LOG_ERR("Failed to add callback on '%s': %d", cfg->echo_gpios.port->name, ret); + return -EIO; + } + return 0; +} + +static int hcsr04_init(const struct device *dev) +{ + const struct hcsr04_config *cfg = dev->config; + struct hcsr04_data *data = dev->data; + int ret; + + k_sem_init(&data->sem, 0, 1); + + ret = hcsr04_configure_gpios(cfg); + if (ret < 0) { + return ret; + } + + ret = hcsr04_configure_interrupt(cfg, data); + if (ret < 0) { + return ret; + } + + return 0; +} + +static void hcsr04_gpio_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins) +{ + struct hcsr04_data *data = CONTAINER_OF(cb, struct hcsr04_data, gpio_cb); + const struct hcsr04_config *cfg = data->dev->config; + + if (gpio_pin_get(dev, cfg->echo_gpios.pin) == 1) { + data->start_cycles = k_cycle_get_32(); + } else { + atomic_set(&data->echo_high_cycles, k_cycle_get_32() - data->start_cycles); + gpio_pin_interrupt_configure_dt(&cfg->echo_gpios, GPIO_INT_DISABLE); + k_sem_give(&data->sem); + } +} + +static int hcsr04_sample_fetch(const struct device *dev, enum sensor_channel chan) +{ + const struct hcsr04_config *cfg = dev->config; + struct hcsr04_data *data = dev->data; + int ret; + + ret = gpio_pin_interrupt_configure_dt(&cfg->echo_gpios, GPIO_INT_EDGE_BOTH); + if (ret < 0) { + LOG_ERR("Failed to set configure echo pin as interrupt: %d", ret); + return ret; + } + + /* Generate 10us trigger */ + ret = gpio_pin_set_dt(&cfg->trigger_gpios, 1); + if (ret < 0) { + LOG_ERR("Failed to set trigger pin: %d", ret); + return ret; + } + + k_busy_wait(10); + + ret = gpio_pin_set_dt(&cfg->trigger_gpios, 0); + if (ret < 0) { + LOG_ERR("Failed to set trigger pin: %d", ret); + return ret; + } + + if (k_sem_take(&data->sem, K_MSEC(10)) != 0) { + LOG_ERR("Echo signal was not received"); + return -EIO; + } + return 0; +} + +static int hcsr04_channel_get(const struct device *dev, enum sensor_channel chan, + struct sensor_value *val) +{ + const struct hcsr04_data *data = dev->data; + uint32_t distance_mm; + + if (chan != SENSOR_CHAN_DISTANCE) { + return -ENOTSUP; + } + + distance_mm = HC_SR04_MM_PER_MS * atomic_get(&data->echo_high_cycles) / + hw_cycles_per_ms; + return sensor_value_from_milli(val, distance_mm); +} + +static const struct sensor_driver_api hcsr04_driver_api = { + .sample_fetch = hcsr04_sample_fetch, + .channel_get = hcsr04_channel_get +}; + + +#define HC_SR04_INIT(index) \ + static struct hcsr04_data hcsr04_data_##index = { \ + .dev = DEVICE_DT_INST_GET(index), \ + .start_cycles = 0, \ + .echo_high_cycles = ATOMIC_INIT(0), \ + }; \ + static struct hcsr04_config hcsr04_config_##index = { \ + .trigger_gpios = GPIO_DT_SPEC_INST_GET(index, trigger_gpios), \ + .echo_gpios = GPIO_DT_SPEC_INST_GET(index, echo_gpios), \ + }; \ + \ + SENSOR_DEVICE_DT_INST_DEFINE(index, &hcsr04_init, NULL, &hcsr04_data_##index, \ + &hcsr04_config_##index, POST_KERNEL, \ + CONFIG_SENSOR_INIT_PRIORITY, &hcsr04_driver_api); \ + +DT_INST_FOREACH_STATUS_OKAY(HC_SR04_INIT) diff --git a/dts/bindings/sensor/hc-sr04.yaml b/dts/bindings/sensor/hc-sr04.yaml new file mode 100644 index 0000000000000..9f7f9a4857273 --- /dev/null +++ b/dts/bindings/sensor/hc-sr04.yaml @@ -0,0 +1,22 @@ +# Copyright (c) 2024, Adrien Leravat +# SPDX-License-Identifier: Apache-2.0 + +description: HC-SR04 ultrasound sensor. + +compatible: "hc-sr04" + +include: sensor-device.yaml + +properties: + trigger-gpios: + type: phandle-array + required: true + description: | + Output pin used to trigger the distance measurement. + echo-gpios: + type: phandle-array + required: true + description: | + Input pin. The pulse received on this pin corresponds to + the duration between the ultrasonic pulse emission and + the reception of its "echo". From 1d6a89d26eb31212089dda757f43ef77d1576b4c Mon Sep 17 00:00:00 2001 From: Adrien Leravat Date: Sat, 27 Jul 2024 19:12:11 -0700 Subject: [PATCH 2457/4482] tests: drivers: sensor: add hc-sr04 tests Add automated build and functional tests for the HC-SR04. Signed-off-by: Adrien Leravat --- tests/drivers/build_all/sensor/gpio.dtsi | 6 + tests/drivers/sensor/hc-sr04/CMakeLists.txt | 8 + .../sensor/hc-sr04/boards/native_sim.overlay | 11 ++ tests/drivers/sensor/hc-sr04/prj.conf | 13 ++ tests/drivers/sensor/hc-sr04/src/main.c | 139 ++++++++++++++++++ tests/drivers/sensor/hc-sr04/testcase.yaml | 11 ++ 6 files changed, 188 insertions(+) create mode 100644 tests/drivers/sensor/hc-sr04/CMakeLists.txt create mode 100644 tests/drivers/sensor/hc-sr04/boards/native_sim.overlay create mode 100644 tests/drivers/sensor/hc-sr04/prj.conf create mode 100644 tests/drivers/sensor/hc-sr04/src/main.c create mode 100644 tests/drivers/sensor/hc-sr04/testcase.yaml diff --git a/tests/drivers/build_all/sensor/gpio.dtsi b/tests/drivers/build_all/sensor/gpio.dtsi index 95626ae9015a6..b3a6cc011aeb0 100644 --- a/tests/drivers/build_all/sensor/gpio.dtsi +++ b/tests/drivers/build_all/sensor/gpio.dtsi @@ -17,3 +17,9 @@ test_gpio_dht22: dht22 { dio-gpios = <&test_gpio 0 0>; /* dht22; */ }; + +test_gpio_hcsr04: hcsr04 { + compatible = "hc-sr04"; + trigger-gpios = <&test_gpio 0 0>; + echo-gpios = <&test_gpio 1 0>; +}; diff --git a/tests/drivers/sensor/hc-sr04/CMakeLists.txt b/tests/drivers/sensor/hc-sr04/CMakeLists.txt new file mode 100644 index 0000000000000..bad8fd3aa073d --- /dev/null +++ b/tests/drivers/sensor/hc-sr04/CMakeLists.txt @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Adrien Leravat +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(device) + +target_sources(app PRIVATE src/main.c) diff --git a/tests/drivers/sensor/hc-sr04/boards/native_sim.overlay b/tests/drivers/sensor/hc-sr04/boards/native_sim.overlay new file mode 100644 index 0000000000000..120f1201c12fb --- /dev/null +++ b/tests/drivers/sensor/hc-sr04/boards/native_sim.overlay @@ -0,0 +1,11 @@ +/* Copyright (c) 2024 Adrien Leravat + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + hc_sr04: hc_sr04 { + compatible = "hc-sr04"; + trigger-gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; + echo-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>; + }; +}; diff --git a/tests/drivers/sensor/hc-sr04/prj.conf b/tests/drivers/sensor/hc-sr04/prj.conf new file mode 100644 index 0000000000000..19255693009da --- /dev/null +++ b/tests/drivers/sensor/hc-sr04/prj.conf @@ -0,0 +1,13 @@ +# Copyright (c) 2024 Adrien Leravat +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_ZTEST=y + +# Set log levels +CONFIG_SENSOR_LOG_LEVEL_WRN=y + +# Enable sensors +CONFIG_SENSOR=y + +# Enable GPIO +CONFIG_GPIO=y diff --git a/tests/drivers/sensor/hc-sr04/src/main.c b/tests/drivers/sensor/hc-sr04/src/main.c new file mode 100644 index 0000000000000..fb61c69425950 --- /dev/null +++ b/tests/drivers/sensor/hc-sr04/src/main.c @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2024 Adrien Leravat + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include + +#if DT_NODE_HAS_STATUS(DT_INST(0, hc_sr04), okay) +#define HC_SR04 DT_NODELABEL(hc_sr04) +#define HC_SR04_GPIO_OUT DT_GPIO_CTLR(DT_INST(0, hc_sr04), trigger_gpios) +#define HC_SR04_PIN_OUT DT_GPIO_PIN(DT_INST(0, hc_sr04), trigger_gpios) +#define HC_SR04_GPIO_IN DT_GPIO_CTLR(DT_INST(0, hc_sr04), echo_gpios) +#define HC_SR04_PIN_IN DT_GPIO_PIN(DT_INST(0, hc_sr04), echo_gpios) +#else +#error "HC-SR04 not enabled" +#endif + +#define TEST_MEASURED_VALUE(fixture, value, duration_us, value1, value2) \ + fixture->emul.echo_duration_us = duration_us; \ + zassert_false(sensor_sample_fetch(fixture->dev), "sensor_sample_fetch failed"); \ + zassert_false(sensor_channel_get(fixture->dev, SENSOR_CHAN_DISTANCE, &value), \ + "sensor_channel_get failed"); \ + zassert_equal(value.val1, value1, "incorrect measurement for value.val1"); \ + zassert_within(value.val2, value2, 10000, "incorrect measurement for value.val2"); \ + +struct hcsr04_emul { + bool fail_echo; + uint32_t echo_duration_us; + struct gpio_callback cb; +}; + +struct hcsr04_fixture { + const struct device *dev; + struct hcsr04_emul emul; +}; + +static void gpio_emul_callback_handler(const struct device *port, + struct gpio_callback *cb, + gpio_port_pins_t pins); + +static void *hcsr04_setup(void) +{ + static struct hcsr04_fixture fixture = { + .dev = DEVICE_DT_GET(HC_SR04), + .emul = { + .fail_echo = false, + .echo_duration_us = 0 + } + }; + const struct device *gpio_dev = DEVICE_DT_GET(HC_SR04_GPIO_IN); + + zassert_not_null(fixture.dev); + zassert_not_null(gpio_dev); + zassert_true(device_is_ready(fixture.dev)); + zassert_equal(DEVICE_DT_GET(HC_SR04_GPIO_IN), DEVICE_DT_GET(HC_SR04_GPIO_OUT), + "Input and output GPIO devices must the same"); + + zassert_true(device_is_ready(gpio_dev), "GPIO dev is not ready"); + + gpio_init_callback(&fixture.emul.cb, &gpio_emul_callback_handler, BIT(HC_SR04_PIN_OUT)); + zassert_false(gpio_add_callback(gpio_dev, &fixture.emul.cb), + "Failed to add emulation callback"); + + return &fixture; +} + +static void hcsr04_before(void *f) +{ + struct hcsr04_fixture *fixture = f; + + fixture->emul.fail_echo = false; +} + +static void gpio_emul_callback_handler(const struct device *port, + struct gpio_callback *cb, + gpio_port_pins_t pins) +{ + const struct hcsr04_emul *emul = CONTAINER_OF(cb, struct hcsr04_emul, cb); + + if (emul->fail_echo) { + return; + } + if (gpio_emul_output_get(port, HC_SR04_PIN_OUT) == 1) { + /* Ignore rising edge */ + return; + } + + /* Output high-level on echo pin */ + gpio_emul_input_set(port, HC_SR04_PIN_IN, 1); + k_busy_wait(emul->echo_duration_us); + gpio_emul_input_set(port, HC_SR04_PIN_IN, 0); +} + +ZTEST_SUITE(hcsr04, NULL, hcsr04_setup, hcsr04_before, NULL, NULL); + +ZTEST_USER_F(hcsr04, test_sample_fetch_fail_no_echo) +{ + int ret; + + fixture->emul.fail_echo = true; + + ret = sensor_sample_fetch(fixture->dev); + zassert_equal(-EIO, ret, "sensor_sample_fetch unexpected return code %d", ret); +} + +ZTEST_USER_F(hcsr04, test_sample_fetch) +{ + int ret; + + ret = sensor_sample_fetch(fixture->dev); + zassert_equal(0, ret, "sensor_sample_fetch unexpected return code %d", ret); +} + +ZTEST_USER_F(hcsr04, test_channel_get_fails_with_wrong_channel) +{ + int ret; + struct sensor_value value; + + ret = sensor_channel_get(fixture->dev, SENSOR_CHAN_ACCEL_X, &value); + zassert_equal(-ENOTSUP, ret, "sensor_channel_get returned unexpected code with %d", ret); +} + +ZTEST_USER_F(hcsr04, test_channel_get_at_10cm) +{ + struct sensor_value value; + + TEST_MEASURED_VALUE(fixture, value, 583, 0, 100000); +} + +ZTEST_USER_F(hcsr04, test_channel_get_at_150cm) +{ + struct sensor_value value; + + TEST_MEASURED_VALUE(fixture, value, 8745, 1, 500000); +} diff --git a/tests/drivers/sensor/hc-sr04/testcase.yaml b/tests/drivers/sensor/hc-sr04/testcase.yaml new file mode 100644 index 0000000000000..11a823801e299 --- /dev/null +++ b/tests/drivers/sensor/hc-sr04/testcase.yaml @@ -0,0 +1,11 @@ +# Copyright (c) 2024 Adrien Leravat +# SPDX-License-Identifier: Apache-2.0 + +tests: + drivers.sensor.hc-sr04: + tags: + - drivers + - sensor + - subsys + platform_allow: + - native_sim From 7dd7dffe3322cf8d44bb61f7e3499bd05e8de8e3 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 4 Nov 2024 11:39:16 +0100 Subject: [PATCH 2458/4482] arch: arm: cortex_m: pm_s2ram: ignore xPSR Remove all xPSR-related registers from struct __cpu_context, and the associated save/restore code in S2RAM code, as they are not needed: * EPSR and IPSR are read-only - they cannot be "restored" * Bits N, V, Z, C, V, Q, and GE (if DSP Extension is implemented) of APSR could be restored, but this is not needed as the AAPCS indicates these bits to be "undefined on entry to or return from a public interface" Signed-off-by: Mathieu Choplain --- arch/arm/core/cortex_m/pm_s2ram.S | 18 ------------------ arch/arm/core/offsets/offsets_aarch32.c | 3 --- include/zephyr/arch/arm/cortex_m/cpu.h | 3 --- 3 files changed, 24 deletions(-) diff --git a/arch/arm/core/cortex_m/pm_s2ram.S b/arch/arm/core/cortex_m/pm_s2ram.S index 27c2a1e96a71a..90cd54555654e 100644 --- a/arch/arm/core/cortex_m/pm_s2ram.S +++ b/arch/arm/core/cortex_m/pm_s2ram.S @@ -46,15 +46,6 @@ SECTION_FUNC(TEXT, arch_pm_s2ram_suspend) mrs r2, psplim str r2, [r1, #___cpu_context_t_psplim_OFFSET] - mrs r2, apsr - str r2, [r1, #___cpu_context_t_apsr_OFFSET] - - mrs r2, ipsr - str r2, [r1, #___cpu_context_t_ipsr_OFFSET] - - mrs r2, epsr - str r2, [r1, #___cpu_context_t_epsr_OFFSET] - mrs r2, primask str r2, [r1, #___cpu_context_t_primask_OFFSET] @@ -129,15 +120,6 @@ resume: ldr r1, [r0, #___cpu_context_t_psplim_OFFSET] msr psplim, r1 - ldr r1, [r0, #___cpu_context_t_apsr_OFFSET] - msr apsr_nzcvq, r1 - - ldr r1, [r0, #___cpu_context_t_ipsr_OFFSET] - msr ipsr, r1 - - ldr r1, [r0, #___cpu_context_t_epsr_OFFSET] - msr epsr, r1 - ldr r1, [r0, #___cpu_context_t_primask_OFFSET] msr primask, r1 diff --git a/arch/arm/core/offsets/offsets_aarch32.c b/arch/arm/core/offsets/offsets_aarch32.c index 4399377134de0..8b9f438202143 100644 --- a/arch/arm/core/offsets/offsets_aarch32.c +++ b/arch/arm/core/offsets/offsets_aarch32.c @@ -86,9 +86,6 @@ GEN_OFFSET_SYM(_cpu_context_t, msp); GEN_OFFSET_SYM(_cpu_context_t, msplim); GEN_OFFSET_SYM(_cpu_context_t, psp); GEN_OFFSET_SYM(_cpu_context_t, psplim); -GEN_OFFSET_SYM(_cpu_context_t, apsr); -GEN_OFFSET_SYM(_cpu_context_t, ipsr); -GEN_OFFSET_SYM(_cpu_context_t, epsr); GEN_OFFSET_SYM(_cpu_context_t, primask); GEN_OFFSET_SYM(_cpu_context_t, faultmask); diff --git a/include/zephyr/arch/arm/cortex_m/cpu.h b/include/zephyr/arch/arm/cortex_m/cpu.h index c8318bd9f7a8e..6e08baa5036e1 100644 --- a/include/zephyr/arch/arm/cortex_m/cpu.h +++ b/include/zephyr/arch/arm/cortex_m/cpu.h @@ -57,9 +57,6 @@ struct __cpu_context { uint32_t msplim; uint32_t psp; uint32_t psplim; - uint32_t apsr; - uint32_t ipsr; - uint32_t epsr; uint32_t primask; uint32_t faultmask; uint32_t basepri; From 041714cb37a809971bd5eff50c6a31f5ee4329f5 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 4 Nov 2024 13:17:57 +0100 Subject: [PATCH 2459/4482] arch: arm: cortex_m: pm_s2ram: use macros to access struct __cpu_context Use macros to wrap the interaction between the assembly code and the struct __cpu_context. This helps making the assembly more readable. Signed-off-by: Mathieu Choplain --- arch/arm/core/cortex_m/pm_s2ram.S | 72 +++++++++++++++++-------------- 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/arch/arm/core/cortex_m/pm_s2ram.S b/arch/arm/core/cortex_m/pm_s2ram.S index 90cd54555654e..35d5b01cf76f2 100644 --- a/arch/arm/core/cortex_m/pm_s2ram.S +++ b/arch/arm/core/cortex_m/pm_s2ram.S @@ -14,6 +14,30 @@ #include #include +/** + * Macro expanding to an integer literal equal to the offset of + * field `sr_name` in `struct __cpu_context`. This macro has to + * be implemented in C, because GEN_OFFSET_SYM provides offsets + * as C preprocessor definitions - there are not visible to the + * assembler. + * + * See also: `arch/arm/core/offsets/offsets_aarch32.c` + */ +#define CPU_CTX_SR_OFFSET(sr_name) \ + ___cpu_context_t_ ## sr_name ## _OFFSET + +/** + * Macros used to save / load a special register in __cpu_context. + * These also have to be implemented in C due to CPU_CTX_SR_OFFSET. + */ +#define SAVE_SPECIAL_REG(sr_name, cpu_ctx_reg, tmp_reg) \ + mrs tmp_reg, sr_name; \ + str tmp_reg, [cpu_ctx_reg, # CPU_CTX_SR_OFFSET(sr_name)]; + +#define RESTORE_SPECIAL_REG(sr_name, cpu_ctx_reg, tmp_reg) \ + ldr tmp_reg, [cpu_ctx_reg, # CPU_CTX_SR_OFFSET(sr_name)]; \ + msr sr_name, tmp_reg; + _ASM_FILE_PROLOGUE GTEXT(pm_s2ram_mark_set) @@ -34,29 +58,21 @@ SECTION_FUNC(TEXT, arch_pm_s2ram_suspend) /* Store CPU context */ ldr r1, =_cpu_context - mrs r2, msp - str r2, [r1, #___cpu_context_t_msp_OFFSET] + SAVE_SPECIAL_REG(msp, r1, r2) - mrs r2, msplim - str r2, [r1, #___cpu_context_t_msplim_OFFSET] + SAVE_SPECIAL_REG(msplim, r1, r2) - mrs r2, psp - str r2, [r1, #___cpu_context_t_psp_OFFSET] + SAVE_SPECIAL_REG(psp, r1, r2) - mrs r2, psplim - str r2, [r1, #___cpu_context_t_psplim_OFFSET] + SAVE_SPECIAL_REG(psplim, r1, r2) - mrs r2, primask - str r2, [r1, #___cpu_context_t_primask_OFFSET] + SAVE_SPECIAL_REG(primask, r1, r2) - mrs r2, faultmask - str r2, [r1, #___cpu_context_t_faultmask_OFFSET] + SAVE_SPECIAL_REG(faultmask, r1, r2) - mrs r2, basepri - str r2, [r1, #___cpu_context_t_basepri_OFFSET] + SAVE_SPECIAL_REG(basepri, r1, r2) - mrs r2, control - str r2, [r1, #___cpu_context_t_control_OFFSET] + SAVE_SPECIAL_REG(control, r1, r2) /* * Mark entering suspend to RAM. @@ -108,29 +124,21 @@ resume: */ ldr r0, =_cpu_context - ldr r1, [r0, #___cpu_context_t_msp_OFFSET] - msr msp, r1 + RESTORE_SPECIAL_REG(msp, r0, r1) - ldr r1, [r0, #___cpu_context_t_msplim_OFFSET] - msr msplim, r1 + RESTORE_SPECIAL_REG(msplim, r0, r1) - ldr r1, [r0, #___cpu_context_t_psp_OFFSET] - msr psp, r1 + RESTORE_SPECIAL_REG(psp, r0, r1) - ldr r1, [r0, #___cpu_context_t_psplim_OFFSET] - msr psplim, r1 + RESTORE_SPECIAL_REG(psplim, r0, r1) - ldr r1, [r0, #___cpu_context_t_primask_OFFSET] - msr primask, r1 + RESTORE_SPECIAL_REG(primask, r0, r1) - ldr r1, [r0, #___cpu_context_t_faultmask_OFFSET] - msr faultmask, r1 + RESTORE_SPECIAL_REG(faultmask, r0, r1) - ldr r1, [r0, #___cpu_context_t_basepri_OFFSET] - msr basepri, r1 + RESTORE_SPECIAL_REG(basepri, r0, r1) - ldr r1, [r0, #___cpu_context_t_control_OFFSET] - msr control, r1 + RESTORE_SPECIAL_REG(control, r0, r1) isb pop {r4-r12, lr} From 18f41aa63c4d2d7f4af60a04ec0e1ea2918418fa Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 4 Nov 2024 13:55:25 +0100 Subject: [PATCH 2460/4482] arch: arm: cortex_m: pm_s2ram: wrap context save/restore in macros Wrap the CPU register save/restore operations (GPR and special registers) in macros to make core logic simpler to follow. This is also a preparatory step to introduce ARMv6-M and ARMv7-M support. Signed-off-by: Mathieu Choplain --- arch/arm/core/cortex_m/pm_s2ram.S | 96 ++++++++++++++++++++----------- 1 file changed, 62 insertions(+), 34 deletions(-) diff --git a/arch/arm/core/cortex_m/pm_s2ram.S b/arch/arm/core/cortex_m/pm_s2ram.S index 35d5b01cf76f2..a3ff9460a3953 100644 --- a/arch/arm/core/cortex_m/pm_s2ram.S +++ b/arch/arm/core/cortex_m/pm_s2ram.S @@ -38,6 +38,63 @@ ldr tmp_reg, [cpu_ctx_reg, # CPU_CTX_SR_OFFSET(sr_name)]; \ msr sr_name, tmp_reg; +/* + * The following macros could be written as assembler macros, but C is used + * for portability (assembler macro syntax may differ between toolchains). + */ + +/* + * Pushes registers r4~r12 and lr on the stack. + * r0 is unmodified but other GPRs may be overwritten. + */ +#define PUSH_GPRS \ + push {r4-r12, lr} + +/* + * Pops registers r4~r12 and lr from the stack + * r0 is unmodified but other GPRs may be overwritten. + */ +#define POP_GPRS \ + pop {r4-r12, lr} + +/* + * Saves the CPU's special registers in the `struct __cpu_context` + * pointed to by the `cpu_ctx` register. + * The `tmp_reg` register is overwritten as part of this process. + */ +#define SAVE_SPECIAL_REGISTERS(cpu_ctx, tmp_reg) \ + SAVE_SPECIAL_REG(msp, cpu_ctx, tmp_reg) \ + SAVE_SPECIAL_REG(msplim, cpu_ctx, tmp_reg) \ + SAVE_SPECIAL_REG(psp, cpu_ctx, tmp_reg) \ + SAVE_SPECIAL_REG(psplim, cpu_ctx, tmp_reg) \ + SAVE_SPECIAL_REG(primask, cpu_ctx, tmp_reg) \ + SAVE_SPECIAL_REG(faultmask, cpu_ctx, tmp_reg) \ + SAVE_SPECIAL_REG(basepri, cpu_ctx, tmp_reg) \ + SAVE_SPECIAL_REG(control, cpu_ctx, tmp_reg) + +/* + * Restores the CPU's special registers from the `struct __cpu_context` + * pointed to by the `cpu_ctx` register. + * The `tmp_reg` register is overwritten as part of this process. + * + * N.B.: ISB at the end is required because "Software must use an ISB + * barrier instruction to ensure a write to the CONTROL register takes + * effect before the next instruction is executed." + * + * If this macro is modified, make sure CONTROL is always the last + * restored register, and that an ISB follows the MSR instruction. + */ +#define RESTORE_SPECIAL_REGISTERS(cpu_ctx, tmp_reg) \ + RESTORE_SPECIAL_REG(msp, cpu_ctx, tmp_reg) \ + RESTORE_SPECIAL_REG(msplim, cpu_ctx, tmp_reg) \ + RESTORE_SPECIAL_REG(psp, cpu_ctx, tmp_reg) \ + RESTORE_SPECIAL_REG(psplim, cpu_ctx, tmp_reg) \ + RESTORE_SPECIAL_REG(primask, cpu_ctx, tmp_reg) \ + RESTORE_SPECIAL_REG(faultmask, cpu_ctx, tmp_reg) \ + RESTORE_SPECIAL_REG(basepri, cpu_ctx, tmp_reg) \ + RESTORE_SPECIAL_REG(control, cpu_ctx, tmp_reg) \ + isb + _ASM_FILE_PROLOGUE GTEXT(pm_s2ram_mark_set) @@ -50,7 +107,7 @@ SECTION_FUNC(TEXT, arch_pm_s2ram_suspend) * * r0: address of the system_off function */ - push {r4-r12, lr} + PUSH_GPRS /* Move system_off to protected register. */ mov r4, r0 @@ -58,21 +115,7 @@ SECTION_FUNC(TEXT, arch_pm_s2ram_suspend) /* Store CPU context */ ldr r1, =_cpu_context - SAVE_SPECIAL_REG(msp, r1, r2) - - SAVE_SPECIAL_REG(msplim, r1, r2) - - SAVE_SPECIAL_REG(psp, r1, r2) - - SAVE_SPECIAL_REG(psplim, r1, r2) - - SAVE_SPECIAL_REG(primask, r1, r2) - - SAVE_SPECIAL_REG(faultmask, r1, r2) - - SAVE_SPECIAL_REG(basepri, r1, r2) - - SAVE_SPECIAL_REG(control, r1, r2) + SAVE_SPECIAL_REGISTERS(/* ctx: */ r1, /* tmp: */ r2) /* * Mark entering suspend to RAM. @@ -102,7 +145,7 @@ SECTION_FUNC(TEXT, arch_pm_s2ram_suspend) /* Move system_off back to r0 as return value */ mov r0, r4 - pop {r4-r12, lr} + POP_GPRS bx lr @@ -124,24 +167,9 @@ resume: */ ldr r0, =_cpu_context - RESTORE_SPECIAL_REG(msp, r0, r1) + RESTORE_SPECIAL_REGISTERS(/* ctx: */ r0, /* tmp: */ r1) - RESTORE_SPECIAL_REG(msplim, r0, r1) - - RESTORE_SPECIAL_REG(psp, r0, r1) - - RESTORE_SPECIAL_REG(psplim, r0, r1) - - RESTORE_SPECIAL_REG(primask, r0, r1) - - RESTORE_SPECIAL_REG(faultmask, r0, r1) - - RESTORE_SPECIAL_REG(basepri, r0, r1) - - RESTORE_SPECIAL_REG(control, r0, r1) - isb - - pop {r4-r12, lr} + POP_GPRS /* * Set the return value and return From f27323a45de87bd8cf33c758dc5e87d1962a6656 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 4 Nov 2024 14:10:03 +0100 Subject: [PATCH 2461/4482] arch: arm: cortex_m: pm_s2ram: add support for all architectures Extend the ARM M-profile suspend-to-RAM implementation to be compatible with all versions of the M-profile supported by Zephyr: ARMv6-M, ARMv7-M, and ARMv8-M Baseline. Signed-off-by: Mathieu Choplain --- arch/arm/core/cortex_m/pm_s2ram.S | 76 ++++++++++++++++++++++--- arch/arm/core/offsets/offsets_aarch32.c | 15 +++-- include/zephyr/arch/arm/cortex_m/cpu.h | 14 ++++- 3 files changed, 89 insertions(+), 16 deletions(-) diff --git a/arch/arm/core/cortex_m/pm_s2ram.S b/arch/arm/core/cortex_m/pm_s2ram.S index a3ff9460a3953..1a4da5ce784f8 100644 --- a/arch/arm/core/cortex_m/pm_s2ram.S +++ b/arch/arm/core/cortex_m/pm_s2ram.S @@ -47,15 +47,77 @@ * Pushes registers r4~r12 and lr on the stack. * r0 is unmodified but other GPRs may be overwritten. */ +#if !defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE) +/* `push` on ARMv6-M / ARMv8-M Baseline: + * only r0~r7 and lr may be pushed + */ +#define PUSH_GPRS \ + push {r4-r7}; \ + mov r1, r8; \ + mov r2, r9; \ + mov r3, r10; \ + mov r4, r11; \ + mov r5, r12; \ + push {r1-r5, lr} +#else +/* `push` on ARMv7-M and ARMv8-M Mainline: no limitation */ #define PUSH_GPRS \ push {r4-r12, lr} +#endif /* !CONFIG_ARMV7_M_ARMV8_M_MAINLINE */ /* * Pops registers r4~r12 and lr from the stack * r0 is unmodified but other GPRs may be overwritten. */ +#if !defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE) +/* `pop` on ARMv6-M / ARMv8-M Baseline: + * can only pop to r0~r7 and pc (not lr!) + */ +#define POP_GPRS \ + pop {r1-r6}; \ + mov lr, r6; \ + mov r12, r5; \ + mov r11, r4; \ + mov r10, r3; \ + mov r9, r2; \ + mov r8, r1; \ + pop {r4-r7} +#else +/* `pop` on ARMv7-M and ARMv8-M Mainline: no limitation */ #define POP_GPRS \ pop {r4-r12, lr} +#endif /* !CONFIG_ARMV7_M_ARMV8_M_MAINLINE */ + + +#if defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE) +/* Registers present only on ARMv7-M and ARMv8-M Mainline */ +#define SAVE_FM_BP_REGS(cpu_ctx, tmp_reg) \ + SAVE_SPECIAL_REG(faultmask, cpu_ctx, tmp_reg) \ + SAVE_SPECIAL_REG(basepri, cpu_ctx, tmp_reg) + +#define RESTORE_FM_BP_REGS(cpu_ctx, tmp_reg) \ + RESTORE_SPECIAL_REG(faultmask, cpu_ctx, tmp_reg) \ + RESTORE_SPECIAL_REG(basepri, cpu_ctx, tmp_reg) +#else +/* Registers not present: do nothing */ +#define SAVE_FM_BP_REGS(cpu_ctx, tmp_reg) +#define RESTORE_FM_BP_REGS(cpu_ctx, tmp_reg) +#endif /* CONFIG_ARMV7_M_ARMV8_M_MAINLINE */ + +#if defined(CONFIG_CPU_CORTEX_M_HAS_SPLIM) +/* Registers present only on certain ARMv8-M implementations */ +#define SAVE_SPLIM_REGS(cpu_ctx, tmp_reg) \ + SAVE_SPECIAL_REG(msplim, cpu_ctx, tmp_reg) \ + SAVE_SPECIAL_REG(psplim, cpu_ctx, tmp_reg) + +#define RESTORE_SPLIM_REGS(cpu_ctx, tmp_reg) \ + RESTORE_SPECIAL_REG(msplim, cpu_ctx, tmp_reg) \ + RESTORE_SPECIAL_REG(psplim, cpu_ctx, tmp_reg) +#else +/* Registers not present: do nothing */ +#define SAVE_SPLIM_REGS(cpu_ctx, tmp_reg) +#define RESTORE_SPLIM_REGS(cpu_ctx, tmp_reg) +#endif /* CONFIG_CPU_CORTEX_M_HAS_SPLIM */ /* * Saves the CPU's special registers in the `struct __cpu_context` @@ -64,12 +126,10 @@ */ #define SAVE_SPECIAL_REGISTERS(cpu_ctx, tmp_reg) \ SAVE_SPECIAL_REG(msp, cpu_ctx, tmp_reg) \ - SAVE_SPECIAL_REG(msplim, cpu_ctx, tmp_reg) \ SAVE_SPECIAL_REG(psp, cpu_ctx, tmp_reg) \ - SAVE_SPECIAL_REG(psplim, cpu_ctx, tmp_reg) \ SAVE_SPECIAL_REG(primask, cpu_ctx, tmp_reg) \ - SAVE_SPECIAL_REG(faultmask, cpu_ctx, tmp_reg) \ - SAVE_SPECIAL_REG(basepri, cpu_ctx, tmp_reg) \ + SAVE_SPLIM_REGS( cpu_ctx, tmp_reg) \ + SAVE_FM_BP_REGS( cpu_ctx, tmp_reg) \ SAVE_SPECIAL_REG(control, cpu_ctx, tmp_reg) /* @@ -86,12 +146,10 @@ */ #define RESTORE_SPECIAL_REGISTERS(cpu_ctx, tmp_reg) \ RESTORE_SPECIAL_REG(msp, cpu_ctx, tmp_reg) \ - RESTORE_SPECIAL_REG(msplim, cpu_ctx, tmp_reg) \ RESTORE_SPECIAL_REG(psp, cpu_ctx, tmp_reg) \ - RESTORE_SPECIAL_REG(psplim, cpu_ctx, tmp_reg) \ RESTORE_SPECIAL_REG(primask, cpu_ctx, tmp_reg) \ - RESTORE_SPECIAL_REG(faultmask, cpu_ctx, tmp_reg) \ - RESTORE_SPECIAL_REG(basepri, cpu_ctx, tmp_reg) \ + RESTORE_SPLIM_REGS( cpu_ctx, tmp_reg) \ + RESTORE_FM_BP_REGS( cpu_ctx, tmp_reg) \ RESTORE_SPECIAL_REG(control, cpu_ctx, tmp_reg) \ isb @@ -174,5 +232,5 @@ resume: /* * Set the return value and return */ - mov r0, #0 + movs r0, #0 bx lr diff --git a/arch/arm/core/offsets/offsets_aarch32.c b/arch/arm/core/offsets/offsets_aarch32.c index 8b9f438202143..693546630b05e 100644 --- a/arch/arm/core/offsets/offsets_aarch32.c +++ b/arch/arm/core/offsets/offsets_aarch32.c @@ -83,14 +83,21 @@ GEN_OFFSET_SYM(_thread_stack_info_t, start); */ #if defined(CONFIG_PM_S2RAM) GEN_OFFSET_SYM(_cpu_context_t, msp); -GEN_OFFSET_SYM(_cpu_context_t, msplim); GEN_OFFSET_SYM(_cpu_context_t, psp); -GEN_OFFSET_SYM(_cpu_context_t, psplim); - GEN_OFFSET_SYM(_cpu_context_t, primask); +GEN_OFFSET_SYM(_cpu_context_t, control); + +#if defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE) +/* Registers present only on ARMv7-M and ARMv8-M Mainline */ GEN_OFFSET_SYM(_cpu_context_t, faultmask); GEN_OFFSET_SYM(_cpu_context_t, basepri); -GEN_OFFSET_SYM(_cpu_context_t, control); +#endif /* CONFIG_ARMV7_M_ARMV8_M_MAINLINE */ + +#if defined(CONFIG_CPU_CORTEX_M_HAS_SPLIM) +/* Registers present only on certain ARMv8-M implementations */ +GEN_OFFSET_SYM(_cpu_context_t, msplim); +GEN_OFFSET_SYM(_cpu_context_t, psplim); +#endif /* CONFIG_CPU_CORTEX_M_HAS_SPLIM */ #endif /* CONFIG_PM_S2RAM */ #endif /* _ARM_OFFSETS_INC_ */ diff --git a/include/zephyr/arch/arm/cortex_m/cpu.h b/include/zephyr/arch/arm/cortex_m/cpu.h index 6e08baa5036e1..064d8f92d56e2 100644 --- a/include/zephyr/arch/arm/cortex_m/cpu.h +++ b/include/zephyr/arch/arm/cortex_m/cpu.h @@ -54,13 +54,21 @@ extern "C" { struct __cpu_context { /* GPRs are saved onto the stack */ uint32_t msp; - uint32_t msplim; uint32_t psp; - uint32_t psplim; uint32_t primask; + uint32_t control; + +#if defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE) + /* Registers present only on ARMv7-M and ARMv8-M Mainline */ uint32_t faultmask; uint32_t basepri; - uint32_t control; +#endif /* CONFIG_ARMV7_M_ARMV8_M_MAINLINE */ + +#if defined(CONFIG_CPU_CORTEX_M_HAS_SPLIM) + /* Registers present only on certain ARMv8-M implementations */ + uint32_t msplim; + uint32_t psplim; +#endif /* CONFIG_CPU_CORTEX_M_HAS_SPLIM */ }; typedef struct __cpu_context _cpu_context_t; From 0cf866037d21d276be6910e698e07f4652b39508 Mon Sep 17 00:00:00 2001 From: Zhang Xingtao Date: Tue, 6 Aug 2024 02:00:01 +0800 Subject: [PATCH 2462/4482] boards: xtensa: add M5Stack CoreS3 support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Initial support for M5Statck CoreS3 development board. Signed-off-by: Zhang Xingtao Co-authored-by: Benjamin Cabé Co-authored-by: TOKITA Hiroshi --- boards/m5stack/m5stack_cores3/Kconfig | 21 ++++ .../m5stack_cores3/Kconfig.m5stack_cores3 | 9 ++ boards/m5stack/m5stack_cores3/board.cmake | 9 ++ boards/m5stack/m5stack_cores3/board.yml | 6 + .../doc/img/m5stack_cores3.webp | Bin 0 -> 74066 bytes boards/m5stack/m5stack_cores3/doc/index.rst | 117 +++++++++++++++++ .../m5stack_cores3-pinctrl.dtsi | 43 +++++++ .../m5stack_cores3/m5stack_cores3_appcpu.dts | 66 ++++++++++ .../m5stack_cores3/m5stack_cores3_appcpu.yaml | 27 ++++ .../m5stack_cores3_appcpu_defconfig | 4 + .../m5stack_cores3/m5stack_cores3_procpu.dts | 118 ++++++++++++++++++ .../m5stack_cores3/m5stack_cores3_procpu.yaml | 21 ++++ .../m5stack_cores3_procpu_defconfig | 7 ++ .../m5stack_cores3/support/openocd.cfg | 7 ++ 14 files changed, 455 insertions(+) create mode 100644 boards/m5stack/m5stack_cores3/Kconfig create mode 100644 boards/m5stack/m5stack_cores3/Kconfig.m5stack_cores3 create mode 100644 boards/m5stack/m5stack_cores3/board.cmake create mode 100644 boards/m5stack/m5stack_cores3/board.yml create mode 100644 boards/m5stack/m5stack_cores3/doc/img/m5stack_cores3.webp create mode 100644 boards/m5stack/m5stack_cores3/doc/index.rst create mode 100644 boards/m5stack/m5stack_cores3/m5stack_cores3-pinctrl.dtsi create mode 100644 boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.dts create mode 100644 boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.yaml create mode 100644 boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu_defconfig create mode 100644 boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.dts create mode 100644 boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.yaml create mode 100644 boards/m5stack/m5stack_cores3/m5stack_cores3_procpu_defconfig create mode 100644 boards/m5stack/m5stack_cores3/support/openocd.cfg diff --git a/boards/m5stack/m5stack_cores3/Kconfig b/boards/m5stack/m5stack_cores3/Kconfig new file mode 100644 index 0000000000000..0fa82611253a5 --- /dev/null +++ b/boards/m5stack/m5stack_cores3/Kconfig @@ -0,0 +1,21 @@ +# Copyright (c) 2024 Zhang Xingtao +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_M5STACK_CORES3_ESP32S3_PROCPU + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default $(UINT16_MAX) if WIFI && BT + default 51200 if WIFI + default 40960 if BT + default 4096 + +endif # BOARD_M5STACK_CORES3_ESP32S3_PROCPU + +if BOARD_M5STACK_CORES3_ESP32S3_APPCPU + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 256 + +endif # BOARD_M5STACK_CORES3_ESP32S3_APPCPU diff --git a/boards/m5stack/m5stack_cores3/Kconfig.m5stack_cores3 b/boards/m5stack/m5stack_cores3/Kconfig.m5stack_cores3 new file mode 100644 index 0000000000000..990925a96bb90 --- /dev/null +++ b/boards/m5stack/m5stack_cores3/Kconfig.m5stack_cores3 @@ -0,0 +1,9 @@ +# M5Stack CoreS3 board configuration + +# Copyright (c) 2024 Zhang Xingtao +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_M5STACK_CORES3 + select SOC_ESP32S3 + select SOC_ESP32S3_PROCPU if BOARD_M5STACK_CORES3_ESP32S3_PROCPU + select SOC_ESP32S3_APPCPU if BOARD_M5STACK_CORES3_ESP32S3_APPCPU diff --git a/boards/m5stack/m5stack_cores3/board.cmake b/boards/m5stack/m5stack_cores3/board.cmake new file mode 100644 index 0000000000000..2f04d1fe8861e --- /dev/null +++ b/boards/m5stack/m5stack_cores3/board.cmake @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +if(NOT "${OPENOCD}" MATCHES "^${ESPRESSIF_TOOLCHAIN_PATH}/.*") + set(OPENOCD OPENOCD-NOTFOUND) +endif() +find_program(OPENOCD openocd PATHS ${ESPRESSIF_TOOLCHAIN_PATH}/openocd-esp32/bin NO_DEFAULT_PATH) + +include(${ZEPHYR_BASE}/boards/common/esp32.board.cmake) +include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/m5stack/m5stack_cores3/board.yml b/boards/m5stack/m5stack_cores3/board.yml new file mode 100644 index 0000000000000..64479891d23d8 --- /dev/null +++ b/boards/m5stack/m5stack_cores3/board.yml @@ -0,0 +1,6 @@ +board: + name: m5stack_cores3 + full_name: CoreS3 + vendor: m5stack + socs: + - name: esp32s3 diff --git a/boards/m5stack/m5stack_cores3/doc/img/m5stack_cores3.webp b/boards/m5stack/m5stack_cores3/doc/img/m5stack_cores3.webp new file mode 100644 index 0000000000000000000000000000000000000000..37ee8f6b8ee7fdd34926c16c1f517f5997d3c397 GIT binary patch literal 74066 zcmV)8K*qmPNk&FWAprnaMM6+kP&gnyAprnz;RBrkDj)+O13sNZol7hxq$;QKOZc!8 ziDhp52kN2FMLFj_$}#31Zf$bu$ue>O$JV*@pWA&b>)+*ny?(&{`|n@Bk30X7<}c-6 z$a%~EQ~OWuEA+SQSHKtaKk^^0-`xGN{Y(Fe|IO+n`d|J}-2Znk`ro_W_?Y|TLW&20?zwZC%f7Snm z^%wG=r~f1U>-_io-|zo1-;@8n{#(hvT>s+#RqB`Wuf6}O{?q<5{-5~YpMTVUtp6eV zyZ%?vznNd-|C0UL|7G$E`5*J&@;})>$o|3l&;O_Xo4Z4F|Ed3D{U@+5u-{$(i~Z01 z*ZyzwUmpKI|3CZx?`OIHv;U?4h5i5iAO9cqUtmAZKe~Up{`>hk^mqM_+P@{Q#(&NK z+5Y$73;BomFZ-Y6KhOTz{XhSk|Fivv`j6aSY+t5-y#Lw$qy0bb57kBRX3;>Q*^vBi!oabt@dSl}!xx{+aB z)Qbx4q*rKaH@Prn5NY6303-fH{E7J!@+ag^$e)ovB7M`8&(gD4TfZRC5IKB%sTLK) zo}ju@T4i_I-j-U{RYs#O{p6r?Qp1g_CswE%Ff)QCg*_6s1+eNjLq_&~uKdKFaZcI* z^1i?Q=lR6UXfcT$^o#5vBS9vSxFwvwsEZoe?Hzm6Rkz}*sB0L#gc-OU1n1;P3aFN? zneg(c9o9Cq4g2pE_2FS%)Qbx4I6fNMw|s^ReQAgMVVDa)R$dF7em!1Nu2BP4+tBw0 z_!L6$y8r*L02lY-Y;5AK8wb5Q$u)XPA#!qqV{lZ#`^q5N83KS^t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{06T==Z2$lO literal 0 HcmV?d00001 diff --git a/boards/m5stack/m5stack_cores3/doc/index.rst b/boards/m5stack/m5stack_cores3/doc/index.rst new file mode 100644 index 0000000000000..f1b1290d16c73 --- /dev/null +++ b/boards/m5stack/m5stack_cores3/doc/index.rst @@ -0,0 +1,117 @@ +.. _m5stack_cores3: + +M5Stack CoreS3 +############## + +Overview +******** + +M5Stack CoreS3 is an ESP32-based development board from M5Stack. It is the third generation of the M5Stack Core series. + +M5Stack CoreS3 features consist of: + +- ESP32-S3 chip (dual-core Xtensa LX7 processor @240MHz, WIFI, OTG and CDC functions) +- PSRAM 8MB +- Flash 16MB +- LCD ISP 2", 320x240 pixel ILI9342C +- Capacitive multi touch FT6336U +- Camera 30W pixel GC0308 +- Speaker 1W AW88298 +- Dual Microphones ES7210 Audio decoder +- RTC BM8563 +- USB-C +- SD-Card slot +- Geomagnetic sensor BMM150 +- Proximity sensor LTR-553ALS-WA +- 6-Axis IMU BMI270 +- PMIC AXP2101 +- Battery 500mAh 3.7 V + +.. figure:: img/m5stack_cores3.webp + :align: center + :alt: M5Stack-CoreS3 + :width: 400 px + + M5Stack CoreS3 module + +Start Application Development +***************************** + +Before powering up your M5Stack CoreS3, please make sure that the board is in good +condition with no obvious signs of damage. + +System requirements +=================== + +Prerequisites +------------- + +Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command +below to retrieve those files. + +.. code-block:: console + + west blobs fetch hal_espressif + +.. note:: + + It is recommended running the command above after :file:`west update`. + +Building & Flashing +------------------- + +Build and flash applications as usual (see :ref:`build_an_application` and +:ref:`application_run` for more details). + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: m5stack_cores3/esp32s3/procpu + :goals: build + +The usual ``flash`` target will work with the ``m5stack_cores3/esp32s3/procpu`` board +configuration. Here is an example for the :zephyr:code-sample:`hello_world` +application. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: m5stack_cores3/esp32s3/procpu + :goals: flash + +The baud rate of 921600bps is set by default. If experiencing issues when flashing, +try using different values by using ``--esp-baud-rate `` option during +``west flash`` (e.g. ``west flash --esp-baud-rate 115200``). + +You can also open the serial monitor using the following command: + +.. code-block:: shell + + west espressif monitor + +After the board has automatically reset and booted, you should see the following +message in the monitor: + +.. code-block:: console + + *** Booting Zephyr OS build vx.x.x-xxx-gxxxxxxxxxxxx *** + Hello World! m5stack_cores3/esp32s3/procpu + + +Debugging +--------- + +ESP32-S3 support on OpenOCD is available upstream as of version 0.12.0. +Download and install OpenOCD from `OpenOCD`_. + +ESP32-S3 has a built-in JTAG circuitry and can be debugged without any additional chip. Only an USB cable connected to the D+/D- pins is necessary. + +Further documentation can be obtained from the SoC vendor in `JTAG debugging for ESP32-S3`_. + +.. _`OpenOCD`: https://github.com/openocd-org/openocd +.. _`JTAG debugging for ESP32-S3`: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/jtag-debugging/ + + +Related Documents +***************** + +- `M5Stack CoreS3 official docs `_ +- `M5Stack CoreS3 schematic `_ (PDF) diff --git a/boards/m5stack/m5stack_cores3/m5stack_cores3-pinctrl.dtsi b/boards/m5stack/m5stack_cores3/m5stack_cores3-pinctrl.dtsi new file mode 100644 index 0000000000000..a759fbc3c7794 --- /dev/null +++ b/boards/m5stack/m5stack_cores3/m5stack_cores3-pinctrl.dtsi @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Zhang Xingtao + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +&pinctrl { + uart0_default: uart0_default { + group1 { + pinmux = ; + output-high; + }; + group2 { + pinmux = ; + bias-pull-up; + }; + }; + + spim2_default: spim2_default { + group1 { + pinmux = , + ; + }; + group2 { + pinmux = ; + output-low; + }; + }; + + i2c0_default: i2c0_default { + group1 { + pinmux = , + ; + bias-pull-up; + drive-open-drain; + output-high; + }; + }; +}; diff --git a/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.dts b/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.dts new file mode 100644 index 0000000000000..02b85a6934278 --- /dev/null +++ b/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.dts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2023 Espressif Systems (Shanghai) Co., Ltd. + * + * SPDX-License-Identifier: Apache-2.0 + */ +/dts-v1/; + +#include + +/ { + model = "M5Stack CoreS3 APPCPU"; + compatible = "espressif,esp32s3"; + + chosen { + zephyr,sram = &sram0; + zephyr,ipc_shm = &shm0; + zephyr,ipc = &ipm0; + }; +}; + +&ipm0 { + status = "okay"; +}; + +&trng0 { + status = "okay"; +}; + +&flash0 { + status = "okay"; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* Reserve 60kB for the bootloader */ + boot_partition: partition@1000 { + label = "mcuboot"; + reg = <0x00001000 0x0000F000>; + read-only; + }; + + /* Reserve 1024kB for the application in slot 0 */ + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x00010000 0x00100000>; + }; + + /* Reserve 1024kB for the application in slot 1 */ + slot1_partition: partition@110000 { + label = "image-1"; + reg = <0x00110000 0x00100000>; + }; + + /* Reserve 256kB for the scratch partition */ + scratch_partition: partition@210000 { + label = "image-scratch"; + reg = <0x00210000 0x00040000>; + }; + + storage_partition: partition@250000 { + label = "storage"; + reg = <0x00250000 0x00006000>; + }; + }; +}; diff --git a/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.yaml b/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.yaml new file mode 100644 index 0000000000000..19e6b770c68f3 --- /dev/null +++ b/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.yaml @@ -0,0 +1,27 @@ +identifier: m5stack_cores3/esp32s3/appcpu +name: M5Stack CoreS3 APPCPU +type: mcu +arch: xtensa +toolchain: + - zephyr +supported: + - uart +testing: + ignore_tags: + - net + - bluetooth + - flash + - cpp + - posix + - watchdog + - logging + - kernel + - pm + - gpio + - crypto + - eeprom + - heap + - cmsis_rtos + - jwt + - zdsp +vendor: m5stack diff --git a/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu_defconfig b/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu_defconfig new file mode 100644 index 0000000000000..9abf2ff0430ab --- /dev/null +++ b/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu_defconfig @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_CLOCK_CONTROL=y diff --git a/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.dts b/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.dts new file mode 100644 index 0000000000000..9ac36cb8a86f0 --- /dev/null +++ b/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.dts @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2024 Zhang Xingtao + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "m5stack_cores3-pinctrl.dtsi" + +/ { + model = "M5Stack CoreS3 PROCPU"; + compatible = "m5stack,cores3"; + + chosen { + zephyr,sram = &sram0; + zephyr,console = &usb_serial; + zephyr,shell-uart = &usb_serial; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_partition; + zephyr,bt-hci = &esp32_bt_hci; + }; + + aliases { + i2c-0 = &i2c0; + watchdog0 = &wdt0; + accel0 = &bmi270; + magn0 = &bmm150; + }; +}; + +&usb_serial { + status = "okay"; +}; + +&uart0 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart0_default>; + pinctrl-names = "default"; +}; + +&i2c0 { + status = "okay"; + clock-frequency = ; + pinctrl-0 = <&i2c0_default>; + pinctrl-names = "default"; + + bmi270: bmi270@69 { + compatible = "bosch,bmi270"; + reg = <0x69>; + }; + + bmm150: bmm150@10 { + compatible = "bosch,bmm150"; + status = "okay"; + reg = <0x10>; + }; +}; + +&spi2 { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + pinctrl-0 = <&spim2_default>; + pinctrl-names = "default"; +}; + +&wdt0 { + status = "okay"; +}; + +&psram0 { + reg = <0x3c000000 DT_SIZE_M(8)>; + status = "okay"; +}; + +&flash0 { + status = "okay"; + reg = <0x0 DT_SIZE_M(16)>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 0x0000F000>; + read-only; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x00010000 0x00100000>; + }; + + slot1_partition: partition@110000 { + label = "image-1"; + reg = <0x00110000 0x00100000>; + }; + + scratch_partition: partition@210000 { + label = "image-scratch"; + reg = <0x00210000 0x00040000>; + }; + + storage_partition: partition@250000 { + label = "storage"; + reg = <0x00250000 0x00006000>; + }; + }; +}; + +&esp32_bt_hci { + status = "okay"; +}; diff --git a/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.yaml b/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.yaml new file mode 100644 index 0000000000000..e0e1f9c32cb7d --- /dev/null +++ b/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.yaml @@ -0,0 +1,21 @@ +identifier: m5stack_cores3/esp32s3/procpu +name: M5Stack CoreS3 PROCPU +type: mcu +arch: xtensa +toolchain: + - zephyr +supported: + - dma + - i2c + - spi + - uart + - watchdog +testing: + ignore_tags: + - bluetooth + - gpio + - net + - pinmux + - pwm + - regulator +vendor: m5stack diff --git a/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu_defconfig b/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu_defconfig new file mode 100644 index 0000000000000..6539bd42e5947 --- /dev/null +++ b/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu_defconfig @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_UART_CONSOLE=y +CONFIG_GPIO=y diff --git a/boards/m5stack/m5stack_cores3/support/openocd.cfg b/boards/m5stack/m5stack_cores3/support/openocd.cfg new file mode 100644 index 0000000000000..2f740b4a36ab1 --- /dev/null +++ b/boards/m5stack/m5stack_cores3/support/openocd.cfg @@ -0,0 +1,7 @@ +set ESP_RTOS none +set ESP32_ONLYCPU 1 + +# Source the JTAG interface configuration file +source [find interface/esp_usb_jtag.cfg] +# Source the ESP32-S3 configuration file +source [find target/esp32s3.cfg] From 5595f66851c31e2318b1661a29b21374aa5d6e5a Mon Sep 17 00:00:00 2001 From: Meir Komet Date: Sat, 17 Aug 2024 12:23:14 +0300 Subject: [PATCH 2463/4482] multi_heap: introduce support for realloc() Add support for realloc (and realloc_aligned) into the multi heap lib, where the buffer sent in will either be reused (maybe shrinked), or enlarged by allocating on any of the matching heaps of the multi heap. Signed-off-by: Meir Komet --- doc/kernel/memory_management/heap.rst | 7 +++++ include/zephyr/sys/multi_heap.h | 26 ++++++++++++++++ lib/heap/multi_heap.c | 36 +++++++++++++++++++++++ tests/lib/multi_heap/src/test_mheap_api.c | 25 ++++++++++++++++ 4 files changed, 94 insertions(+) diff --git a/doc/kernel/memory_management/heap.rst b/doc/kernel/memory_management/heap.rst index bdaf63cb59dd8..18c240882796f 100644 --- a/doc/kernel/memory_management/heap.rst +++ b/doc/kernel/memory_management/heap.rst @@ -127,6 +127,13 @@ application-provided callback is responsible for doing the underlying allocation from one of the managed heaps, and may use the configuration parameter in any way it likes to make that decision. +For modifying the size of an allocated buffer (whether shrinking +or enlarging it), you can use the +:c:func:`sys_multi_heap_realloc` and +:c:func:`sys_multi_heap_aligned_realloc` APIs. If the buffer cannot be +enlarged on the heap where it currently resides, +any of the eligible heaps specified by the configuration parameter may be used. + When unused, a multi heap may be freed via :c:func:`sys_multi_heap_free`. The application does not need to pass a configuration parameter. Memory allocated from any of the managed diff --git a/include/zephyr/sys/multi_heap.h b/include/zephyr/sys/multi_heap.h index af970ceac3cc6..25e61e7e6dbe5 100644 --- a/include/zephyr/sys/multi_heap.h +++ b/include/zephyr/sys/multi_heap.h @@ -168,6 +168,32 @@ const struct sys_multi_heap_rec *sys_multi_heap_get_heap(const struct sys_multi_ */ void sys_multi_heap_free(struct sys_multi_heap *mheap, void *block); +/** @brief Expand the size of an existing allocation on the multi heap + * + * Returns a pointer to a new memory region with the same contents, + * but a different allocated size. If the new allocation can be + * expanded in place, the pointer returned will be identical. + * Otherwise the data will be copies to a new block and the old one + * will be freed as per sys_heap_free(). If the specified size is + * smaller than the original, the block will be truncated in place and + * the remaining memory returned to the heap. If the allocation of a + * new block fails, then NULL will be returned and the old block will + * not be freed or modified. If a new allocation is needed, the choice + * for the heap used will be bases on the cfg parameter (same as in sys_multi_heap_aligned_alloc). + * + * @param mheap Multi heap pointer + * @param cfg Opaque configuration parameter, as for sys_multi_heap_fn_t + * @param ptr Original pointer returned from a previous allocation + * @param align Alignment in bytes, must be a power of two + * @param bytes Number of bytes requested for the new block + * @return Pointer to memory the caller can now use, or NULL + */ +void *sys_multi_heap_aligned_realloc(struct sys_multi_heap *mheap, void *cfg, + void *ptr, size_t align, size_t bytes); + +#define sys_multi_heap_realloc(mheap, cfg, ptr, bytes) \ + sys_multi_heap_aligned_realloc(mheap, cfg, ptr, 0, bytes) + /** * @} */ diff --git a/lib/heap/multi_heap.c b/lib/heap/multi_heap.c index d494fa6d509b2..5cecfec4f8a4f 100644 --- a/lib/heap/multi_heap.c +++ b/lib/heap/multi_heap.c @@ -5,6 +5,7 @@ #include #include #include +#include void sys_multi_heap_init(struct sys_multi_heap *heap, sys_multi_heap_fn_t choice_fn) { @@ -90,3 +91,38 @@ void sys_multi_heap_free(struct sys_multi_heap *mheap, void *block) sys_heap_free(heap->heap, block); } } + +void *sys_multi_heap_aligned_realloc(struct sys_multi_heap *mheap, void *cfg, + void *ptr, size_t align, size_t bytes) +{ + /* special realloc semantics */ + if (ptr == NULL) { + return sys_multi_heap_aligned_alloc(mheap, cfg, align, bytes); + } + if (bytes == 0) { + sys_multi_heap_free(mheap, ptr); + return NULL; + } + + const struct sys_multi_heap_rec *rec = sys_multi_heap_get_heap(mheap, ptr); + + __ASSERT_NO_MSG(rec); + + /* Invoke the realloc function on the same heap, to try to reuse in place */ + void *new_ptr = sys_heap_aligned_realloc(rec->heap, ptr, align, bytes); + + if (new_ptr != NULL) { + return new_ptr; + } + + size_t old_size = sys_heap_usable_size(rec->heap, ptr); + + /* Otherwise, allocate a new block and copy the data */ + new_ptr = sys_multi_heap_aligned_alloc(mheap, cfg, align, bytes); + if (new_ptr != NULL) { + memcpy(new_ptr, ptr, MIN(old_size, bytes)); + sys_multi_heap_free(mheap, ptr); + } + + return new_ptr; +} diff --git a/tests/lib/multi_heap/src/test_mheap_api.c b/tests/lib/multi_heap/src/test_mheap_api.c index 0c024ec7abdcc..9c1a4210ed6b0 100644 --- a/tests/lib/multi_heap/src/test_mheap_api.c +++ b/tests/lib/multi_heap/src/test_mheap_api.c @@ -335,6 +335,11 @@ ZTEST(mheap_api, test_multi_heap) zassert_true(blocks[i] >= &heap_mem[i][0] && blocks[i] < &heap_mem[i+1][0], "allocation not in correct heap"); + + void *ptr = sys_multi_heap_realloc(&multi_heap, (void *)(long)i, + blocks[i], MHEAP_BYTES / 2); + + zassert_equal(ptr, blocks[i], "realloc moved pointer"); } /* Make sure all heaps fail to allocate another */ @@ -355,5 +360,25 @@ ZTEST(mheap_api, test_multi_heap) blocks[i] = sys_multi_heap_alloc(&multi_heap, (void *)(long)i, MHEAP_BYTES / 2); zassert_not_null(blocks[i], "final re-allocation failed"); + + /* Allocating smaller buffer should stay within */ + void *ptr = sys_multi_heap_realloc(&multi_heap, (void *)(long)i, + blocks[i], MHEAP_BYTES / 4); + zassert_equal(ptr, blocks[i], "realloc should return same value"); + + ptr = sys_multi_heap_alloc(&multi_heap, (void *)(long)i, + MHEAP_BYTES / 4); + zassert_between_inclusive((uintptr_t)ptr, (uintptr_t)blocks[i] + MHEAP_BYTES / 4, + (uintptr_t)blocks[i] + MHEAP_BYTES / 2 - 1, + "realloc failed to shrink prev buffer"); } + + /* Test realloc special cases */ + void *ptr = sys_multi_heap_realloc(&multi_heap, (void *)0L, + blocks[0], /* size = */ 0); + zassert_is_null(ptr); + + ptr = sys_multi_heap_realloc(&multi_heap, (void *)0L, + /* ptr = */ NULL, MHEAP_BYTES / 4); + zassert_not_null(ptr); } From 22945254efe279c59237884cc0d8952be428e931 Mon Sep 17 00:00:00 2001 From: Jan Faeh Date: Tue, 20 Aug 2024 16:18:38 +0200 Subject: [PATCH 2464/4482] drivers: sensor: STS4x Add driver This adds support for Sensirion's STS4x temperature sensor. Signed-off-by: Jan Faeh --- drivers/sensor/sensirion/CMakeLists.txt | 1 + drivers/sensor/sensirion/Kconfig | 1 + drivers/sensor/sensirion/sts4x/CMakeLists.txt | 5 + drivers/sensor/sensirion/sts4x/Kconfig | 13 ++ drivers/sensor/sensirion/sts4x/sts4x.c | 168 ++++++++++++++++++ dts/bindings/sensor/sensirion,sts4x.yaml | 22 +++ tests/drivers/build_all/sensor/i2c.dtsi | 6 + 7 files changed, 216 insertions(+) create mode 100644 drivers/sensor/sensirion/sts4x/CMakeLists.txt create mode 100644 drivers/sensor/sensirion/sts4x/Kconfig create mode 100644 drivers/sensor/sensirion/sts4x/sts4x.c create mode 100644 dts/bindings/sensor/sensirion,sts4x.yaml diff --git a/drivers/sensor/sensirion/CMakeLists.txt b/drivers/sensor/sensirion/CMakeLists.txt index 68a26c2518aad..2ef59c627dc0a 100644 --- a/drivers/sensor/sensirion/CMakeLists.txt +++ b/drivers/sensor/sensirion/CMakeLists.txt @@ -6,4 +6,5 @@ add_subdirectory_ifdef(CONFIG_SGP40 sgp40) add_subdirectory_ifdef(CONFIG_SHT3XD sht3xd) add_subdirectory_ifdef(CONFIG_SHT4X sht4x) add_subdirectory_ifdef(CONFIG_SHTCX shtcx) +add_subdirectory_ifdef(CONFIG_STS4X sts4x) # zephyr-keep-sorted-stop diff --git a/drivers/sensor/sensirion/Kconfig b/drivers/sensor/sensirion/Kconfig index 87409404fa8e4..6d1f48dbe959e 100644 --- a/drivers/sensor/sensirion/Kconfig +++ b/drivers/sensor/sensirion/Kconfig @@ -6,4 +6,5 @@ source "drivers/sensor/sensirion/sgp40/Kconfig" source "drivers/sensor/sensirion/sht3xd/Kconfig" source "drivers/sensor/sensirion/sht4x/Kconfig" source "drivers/sensor/sensirion/shtcx/Kconfig" +source "drivers/sensor/sensirion/sts4x/Kconfig" # zephyr-keep-sorted-stop diff --git a/drivers/sensor/sensirion/sts4x/CMakeLists.txt b/drivers/sensor/sensirion/sts4x/CMakeLists.txt new file mode 100644 index 0000000000000..832fce632962b --- /dev/null +++ b/drivers/sensor/sensirion/sts4x/CMakeLists.txt @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library() + +zephyr_library_sources(sts4x.c) diff --git a/drivers/sensor/sensirion/sts4x/Kconfig b/drivers/sensor/sensirion/sts4x/Kconfig new file mode 100644 index 0000000000000..d37ea8c8ed921 --- /dev/null +++ b/drivers/sensor/sensirion/sts4x/Kconfig @@ -0,0 +1,13 @@ +# Drivers configuration options for Sensirion STS4x + +# Copyright (c) 2024 Jan Fäh +# SPDX-License-Identifier: Apache-2.0 + +config STS4X + bool "STS4x Temperature Sensor" + default y + depends on DT_HAS_SENSIRION_STS4X_ENABLED + select I2C + select CRC + help + Enable driver for the Sensirion STS4x temperature sensors. diff --git a/drivers/sensor/sensirion/sts4x/sts4x.c b/drivers/sensor/sensirion/sts4x/sts4x.c new file mode 100644 index 0000000000000..288622bca2edc --- /dev/null +++ b/drivers/sensor/sensirion/sts4x/sts4x.c @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2024 Jan Fäh + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT sensirion_sts4x + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +LOG_MODULE_REGISTER(STS4X, CONFIG_SENSOR_LOG_LEVEL); + +#define STS4X_CMD_RESET 0x94 + +#define STS4X_RESET_TIME 1 + +#define STS4X_CRC_POLY 0x31 +#define STS4X_CRC_INIT 0xFF + +#define STS4X_MAX_TEMP 175 +#define STS4X_MIN_TEMP -45 + +struct sts4x_config { + struct i2c_dt_spec bus; + uint8_t repeatability; +}; + +struct sts4x_data { + uint16_t temp_sample; +}; + +static const uint8_t measure_cmds[3] = {0xE0, 0xF6, 0xFD}; +static const uint16_t measure_time_us[3] = {1600, 4500, 8300}; + +static int sts4x_crc_check(uint16_t value, uint8_t sensor_crc) +{ + uint8_t buf[2]; + + sys_put_be16(value, buf); + + uint8_t calculated_crc = crc8(buf, 2, STS4X_CRC_POLY, STS4X_CRC_INIT, false); + + if (calculated_crc == sensor_crc) { + return 0; + } + + return -EIO; +} + +static int sts4x_write_command(const struct device *dev, uint8_t cmd) +{ + const struct sts4x_config *cfg = dev->config; + uint8_t tx_buf = cmd; + + return i2c_write_dt(&cfg->bus, &tx_buf, 1); +} + +static int sts4x_read_sample(const struct device *dev, uint16_t *temp_sample) +{ + const struct sts4x_config *cfg = dev->config; + uint8_t rx_buf[3]; + int ret; + + ret = i2c_read_dt(&cfg->bus, rx_buf, sizeof(rx_buf)); + if (ret < 0) { + LOG_ERR("Failed to read data."); + return ret; + } + + *temp_sample = sys_get_be16(rx_buf); + ret = sts4x_crc_check(*temp_sample, rx_buf[2]); + if (ret < 0) { + LOG_ERR("Invalid CRC."); + return ret; + } + + return 0; +} + +static int sts4x_sample_fetch(const struct device *dev, enum sensor_channel chan) +{ + struct sts4x_data *data = dev->data; + const struct sts4x_config *cfg = dev->config; + int ret; + + if (chan == SENSOR_CHAN_ALL || chan == SENSOR_CHAN_AMBIENT_TEMP) { + ret = sts4x_write_command(dev, measure_cmds[cfg->repeatability]); + if (ret < 0) { + LOG_ERR("Failed to write measure command."); + return ret; + } + + k_usleep(measure_time_us[cfg->repeatability]); + + ret = sts4x_read_sample(dev, &data->temp_sample); + if (ret < 0) { + LOG_ERR("Failed to get temperature data."); + return ret; + } + + return 0; + } else { + return -ENOTSUP; + } +} + +static int sts4x_channel_get(const struct device *dev, enum sensor_channel chan, + struct sensor_value *val) +{ + const struct sts4x_data *data = dev->data; + + if (chan == SENSOR_CHAN_AMBIENT_TEMP) { + int64_t temp; + + temp = data->temp_sample * STS4X_MAX_TEMP; + val->val1 = (int32_t)(temp / 0xFFFF) + STS4X_MIN_TEMP; + val->val2 = ((temp % 0xFFFF) * 1000000) / 0xFFFF; + } else { + return -ENOTSUP; + } + return 0; +} + +static int sts4x_init(const struct device *dev) +{ + const struct sts4x_config *cfg = dev->config; + int ret; + + if (!i2c_is_ready_dt(&cfg->bus)) { + LOG_ERR("Device not ready."); + return -ENODEV; + } + + ret = sts4x_write_command(dev, STS4X_CMD_RESET); + if (ret < 0) { + LOG_ERR("Failed to reset the device."); + return ret; + } + + k_msleep(STS4X_RESET_TIME); + + return 0; +} + +static const struct sensor_driver_api sts4x_api_funcs = { + .sample_fetch = sts4x_sample_fetch, + .channel_get = sts4x_channel_get, +}; + +#define STS4X_INIT(inst) \ + static struct sts4x_data sts4x_data_##inst; \ + static const struct sts4x_config sts4x_config_##inst = { \ + .bus = I2C_DT_SPEC_INST_GET(inst), \ + .repeatability = DT_INST_PROP(inst, repeatability), \ + }; \ + SENSOR_DEVICE_DT_INST_DEFINE(inst, sts4x_init, NULL, &sts4x_data_##inst, \ + &sts4x_config_##inst, POST_KERNEL, \ + CONFIG_SENSOR_INIT_PRIORITY, &sts4x_api_funcs); + +DT_INST_FOREACH_STATUS_OKAY(STS4X_INIT) diff --git a/dts/bindings/sensor/sensirion,sts4x.yaml b/dts/bindings/sensor/sensirion,sts4x.yaml new file mode 100644 index 0000000000000..da01cbd3633b1 --- /dev/null +++ b/dts/bindings/sensor/sensirion,sts4x.yaml @@ -0,0 +1,22 @@ +# Copyright (c) 2024, Jan Fäh +# SPDX-License-Identifier: Apache-2.0 + +description: Sensirion STS4x temperature sensor + +compatible: "sensirion,sts4x" + +include: [sensor-device.yaml, i2c-device.yaml] + +properties: + repeatability: + type: int + required: true + description: | + Repeatability of the T Measurement + 0 = low -> 1.6 ms + 1 = med -> 4.5 ms + 2 = high -> 8.3 ms + enum: + - 0 + - 1 + - 2 diff --git a/tests/drivers/build_all/sensor/i2c.dtsi b/tests/drivers/build_all/sensor/i2c.dtsi index 9a21c61a698a7..9b1a5cd1f95a2 100644 --- a/tests/drivers/build_all/sensor/i2c.dtsi +++ b/tests/drivers/build_all/sensor/i2c.dtsi @@ -1125,3 +1125,9 @@ test_i2c_ilps22qs: ilps22qs@9c { avg = ; fs = ; }; + +test_i2c_sts4x: sts4x@9d { + compatible = "sensirion,sts4x"; + reg = <0x99>; + repeatability = <2>; +}; From a8ac02f9adcd8760e336bb806009757f8fbe1949 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Thu, 29 Aug 2024 16:18:26 +0300 Subject: [PATCH 2465/4482] drivers: dma: intel-adsp-gpdma: Account for LLPL wrapping In case the LLP wraps we need to re-read the LLPU to make sure we return the correct value. Suggested-by: Pierre-Louis Bossart Signed-off-by: Peter Ujfalusi --- drivers/dma/dma_intel_adsp_gpdma.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/dma/dma_intel_adsp_gpdma.c b/drivers/dma/dma_intel_adsp_gpdma.c index 3ccb08675df85..bed6296adf8fd 100644 --- a/drivers/dma/dma_intel_adsp_gpdma.c +++ b/drivers/dma/dma_intel_adsp_gpdma.c @@ -131,9 +131,15 @@ static inline void intel_adsp_gpdma_llp_read(const struct device *dev, { #ifdef CONFIG_DMA_INTEL_ADSP_GPDMA_HAS_LLP const struct intel_adsp_gpdma_cfg *const dev_cfg = dev->config; + uint32_t tmp; - *llp_l = dw_read(dev_cfg->shim, GPDMA_CHLLPL(channel)); + tmp = dw_read(dev_cfg->shim, GPDMA_CHLLPL(channel)); *llp_u = dw_read(dev_cfg->shim, GPDMA_CHLLPU(channel)); + *llp_l = dw_read(dev_cfg->shim, GPDMA_CHLLPL(channel)); + if (tmp > *llp_l) { + /* re-read the LLPU value, as LLPL just wrapped */ + *llp_u = dw_read(dev_cfg->shim, GPDMA_CHLLPU(channel)); + } #endif } From 041f9821ca6cd3ddc19a8852cb57f74e70047c0d Mon Sep 17 00:00:00 2001 From: Andriy Gelman Date: Thu, 25 Apr 2024 23:38:46 -0400 Subject: [PATCH 2466/4482] drivers: xmc4xxx_uart: Delay transmit interrupt until byte is sent out Generate the Tx service request after the symbol is shifted out of the UART. This is useful when the UART is connected to an RS485 transducer which has a separate transmit enable gpio/line. Hence it's important to know when the transmission actually finishes so that the drive enable line can be disabled. Signed-off-by: Andriy Gelman --- drivers/serial/uart_xmc4xxx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/serial/uart_xmc4xxx.c b/drivers/serial/uart_xmc4xxx.c index 51ec19cf4275f..f797e27a11ecd 100644 --- a/drivers/serial/uart_xmc4xxx.c +++ b/drivers/serial/uart_xmc4xxx.c @@ -116,7 +116,7 @@ static void disable_tx_events(const struct uart_xmc4xxx_config *config) XMC_USIC_CH_TXFIFO_DisableEvent(config->uart, XMC_USIC_CH_TXFIFO_EVENT_CONF_STANDARD); } else { - XMC_USIC_CH_DisableEvent(config->uart, XMC_USIC_CH_EVENT_TRANSMIT_BUFFER); + XMC_USIC_CH_DisableEvent(config->uart, XMC_USIC_CH_EVENT_TRANSMIT_SHIFT); } } #endif @@ -131,7 +131,7 @@ static void enable_tx_events(const struct uart_xmc4xxx_config *config) XMC_USIC_CH_TXFIFO_EnableEvent(config->uart, XMC_USIC_CH_TXFIFO_EVENT_CONF_STANDARD); } else { - XMC_USIC_CH_EnableEvent(config->uart, XMC_USIC_CH_EVENT_TRANSMIT_BUFFER); + XMC_USIC_CH_EnableEvent(config->uart, XMC_USIC_CH_EVENT_TRANSMIT_SHIFT); } } @@ -189,7 +189,7 @@ static void uart_xmc4xxx_configure_service_requests(const struct device *dev) data->service_request_tx); } else { XMC_USIC_CH_SetInterruptNodePointer( - config->uart, XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER, + config->uart, XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, data->service_request_tx); } @@ -338,7 +338,7 @@ static void uart_xmc4xxx_irq_tx_disable(const struct device *dev) XMC_USIC_CH_TXFIFO_DisableEvent(config->uart, XMC_USIC_CH_TXFIFO_EVENT_CONF_STANDARD); } else { - XMC_USIC_CH_DisableEvent(config->uart, XMC_USIC_CH_EVENT_TRANSMIT_BUFFER); + XMC_USIC_CH_DisableEvent(config->uart, XMC_USIC_CH_EVENT_TRANSMIT_SHIFT); } } From 0a9c0f401791914d25a5639f96903ecd7c5e2f1b Mon Sep 17 00:00:00 2001 From: Sreeram Tatapudi Date: Wed, 4 Sep 2024 14:15:52 -0700 Subject: [PATCH 2467/4482] soc: infineon: Support for power management on 20829 - Initial changes in board, dts, and soc files to support system power management Signed-off-by: Sreeram Tatapudi --- .../cyw920829m2evk_02/cyw920829m2evk_02.dts | 4 + .../cyw920829m2evk_02_defconfig | 1 - dts/arm/infineon/cat1b/cyw20829/cyw20829.dtsi | 15 ++++ .../hal_infineon/mtb-pdl-cat1/CMakeLists.txt | 2 + soc/infineon/cat1b/cyw20829/CMakeLists.txt | 2 + soc/infineon/cat1b/cyw20829/Kconfig | 1 + soc/infineon/cat1b/cyw20829/Kconfig.defconfig | 6 ++ soc/infineon/cat1b/cyw20829/power.c | 73 +++++++++++++++++++ soc/infineon/cat1b/cyw20829/soc.c | 10 +++ 9 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 soc/infineon/cat1b/cyw20829/power.c diff --git a/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02.dts b/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02.dts index 83825dd8693ce..927b1f865f4bd 100644 --- a/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02.dts +++ b/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02.dts @@ -81,6 +81,10 @@ uart2: &scb2 { status = "okay"; }; +&mcwdt0 { + status = "okay"; +}; + &bluetooth { status = "okay"; }; diff --git a/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02_defconfig b/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02_defconfig index 14c8035580030..11ac9fb5c324c 100644 --- a/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02_defconfig +++ b/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02_defconfig @@ -4,7 +4,6 @@ # # General configuration -CONFIG_CORTEX_M_SYSTICK=y CONFIG_BUILD_OUTPUT_HEX=y CONFIG_BUILD_OUTPUT_BIN=y diff --git a/dts/arm/infineon/cat1b/cyw20829/cyw20829.dtsi b/dts/arm/infineon/cat1b/cyw20829/cyw20829.dtsi index 139e8f38e8523..763eca835d21d 100644 --- a/dts/arm/infineon/cat1b/cyw20829/cyw20829.dtsi +++ b/dts/arm/infineon/cat1b/cyw20829/cyw20829.dtsi @@ -16,6 +16,21 @@ device_type = "cpu"; compatible = "arm,cortex-m33"; reg = <0>; + cpu-power-states = <&idle &suspend_to_ram>; + }; + + power-states { + idle: idle { + compatible = "zephyr,power-state"; + power-state-name = "suspend-to-idle"; + min-residency-us = <1000000>; + }; + + suspend_to_ram: suspend_to_ram { + compatible = "zephyr,power-state"; + power-state-name = "suspend-to-ram"; + min-residency-us = <2000000>; + }; }; }; diff --git a/modules/hal_infineon/mtb-pdl-cat1/CMakeLists.txt b/modules/hal_infineon/mtb-pdl-cat1/CMakeLists.txt index a7a1155612345..1166a48438198 100644 --- a/modules/hal_infineon/mtb-pdl-cat1/CMakeLists.txt +++ b/modules/hal_infineon/mtb-pdl-cat1/CMakeLists.txt @@ -90,6 +90,8 @@ if(CONFIG_SOC_FAMILY_INFINEON_CAT1B) zephyr_library_sources(${pdl_drv_dir}/source/cy_systick_v2.c) zephyr_library_sources(${pdl_drv_dir}/source/cy_syspm_v2.c) zephyr_library_sources(${pdl_drv_dir}/source/cy_syspm_btss.c) + zephyr_library_sources(${pdl_drv_dir}/source/cy_syspm_ppu.c) + zephyr_library_sources(${pdl_drv_dir}/source/ppu_v1.c) endif() zephyr_library_sources(${pdl_drv_dir}/source/cy_syslib.c) zephyr_library_sources(${pdl_drv_dir}/source/cy_syspm.c) diff --git a/soc/infineon/cat1b/cyw20829/CMakeLists.txt b/soc/infineon/cat1b/cyw20829/CMakeLists.txt index 8532a44108aea..464a3f44a3067 100644 --- a/soc/infineon/cat1b/cyw20829/CMakeLists.txt +++ b/soc/infineon/cat1b/cyw20829/CMakeLists.txt @@ -5,6 +5,8 @@ zephyr_sources(soc.c) zephyr_sources(app_header.c) zephyr_include_directories(.) +zephyr_sources_ifdef(CONFIG_PM power.c) + # CAT1B family defines zephyr_compile_definitions_ifdef(CONFIG_SOC_FAMILY_INFINEON_CAT1 CY_USING_HAL) zephyr_compile_definitions_ifdef(CONFIG_SOC_FAMILY_INFINEON_CAT1B COMPONENT_CAT1B) diff --git a/soc/infineon/cat1b/cyw20829/Kconfig b/soc/infineon/cat1b/cyw20829/Kconfig index 242a356901880..85ec200be8e9d 100644 --- a/soc/infineon/cat1b/cyw20829/Kconfig +++ b/soc/infineon/cat1b/cyw20829/Kconfig @@ -12,3 +12,4 @@ config SOC_SERIES_CYW20829 select CPU_HAS_FPU select DYNAMIC_INTERRUPTS select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE + select HAS_PM diff --git a/soc/infineon/cat1b/cyw20829/Kconfig.defconfig b/soc/infineon/cat1b/cyw20829/Kconfig.defconfig index 896abd9475c55..78b2cdd8956f2 100644 --- a/soc/infineon/cat1b/cyw20829/Kconfig.defconfig +++ b/soc/infineon/cat1b/cyw20829/Kconfig.defconfig @@ -6,6 +6,12 @@ if SOC_DIE_CYW20829 +config INFINEON_CAT1_LP_TIMER + bool + +config CORTEX_M_SYSTICK + default n if INFINEON_CAT1_LP_TIMER + config NUM_IRQS default 70 diff --git a/soc/infineon/cat1b/cyw20829/power.c b/soc/infineon/cat1b/cyw20829/power.c new file mode 100644 index 0000000000000..f5d6e272fc48d --- /dev/null +++ b/soc/infineon/cat1b/cyw20829/power.c @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2021 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +#include +#include + +LOG_MODULE_REGISTER(soc_power, CONFIG_SOC_LOG_LEVEL); + +/* + * Called from pm_system_suspend(int32_t ticks) in subsys/power.c + * For deep sleep pm_system_suspend has executed all the driver + * power management call backs. + */ +void pm_state_set(enum pm_state state, uint8_t substate_id) +{ + ARG_UNUSED(substate_id); + + /* Set BASEPRI to 0 */ + irq_unlock(0); + + switch (state) { + case PM_STATE_SUSPEND_TO_IDLE: + LOG_DBG("Entering PM state suspend to idle"); + cyhal_syspm_sleep(); + break; + case PM_STATE_SUSPEND_TO_RAM: + LOG_DBG("Entering PM state suspend to RAM"); + cyhal_syspm_deepsleep(); + + /* + * The HAL function doesn't clear this bit. It is a problem + * if the Zephyr idle function executes the wfi instruction + * with this bit set. We will always clear it here to avoid + * that situation. + */ + SCB_SCR &= (uint32_t)~SCB_SCR_SLEEPDEEP_Msk; + break; + default: + LOG_DBG("Unsupported power state %u", state); + break; + } +} + +void pm_state_exit_post_ops(enum pm_state state, uint8_t substate_id) +{ + ARG_UNUSED(substate_id); + + switch (state) { + case PM_STATE_SUSPEND_TO_IDLE: + case PM_STATE_SUSPEND_TO_RAM: + break; + + default: + break; + } +} + +int ifx_pm_init(void) +{ + /* System Domain Idle Power Mode Configuration */ + Cy_SysPm_SetDeepSleepMode(CY_SYSPM_MODE_DEEPSLEEP); + + return cyhal_syspm_init(); +} diff --git a/soc/infineon/cat1b/cyw20829/soc.c b/soc/infineon/cat1b/cyw20829/soc.c index 5e87a400841b4..3a55e035c7940 100644 --- a/soc/infineon/cat1b/cyw20829/soc.c +++ b/soc/infineon/cat1b/cyw20829/soc.c @@ -11,10 +11,13 @@ #include #include #include + #include #include #include "cy_pdl.h" +extern int ifx_pm_init(void); + cy_en_sysint_status_t Cy_SysInt_Init(const cy_stc_sysint_t *config, cy_israddress userIsr) { CY_ASSERT_L3(CY_SYSINT_IS_PRIORITY_VALID(config->intrPriority)); @@ -94,3 +97,10 @@ static int init_cycfg_platform_wrapper(void) } SYS_INIT(init_cycfg_platform_wrapper, PRE_KERNEL_1, 0); + +#ifdef CONFIG_PM +void soc_early_init_hook(void) +{ + ifx_pm_init(); +} +#endif From 8084111e542abb869fc6cc517fd7c4999dfff80e Mon Sep 17 00:00:00 2001 From: Philip-Dylan Gleonec Date: Fri, 16 Aug 2024 18:34:09 +0200 Subject: [PATCH 2468/4482] boards: shields: add adafruit adalogger featherwing Add definition for the Adafruit Adalogger Featherwing. This shield compatible with the Adafruit Feather family is equipped with an SD card slot and a PCF8524 RTC. This work is based on the Adafruit Data Logger shield definition. Signed-off-by: Philip-Dylan Gleonec --- .../Kconfig.shield | 5 ++ .../adafruit_adalogger_featherwing.overlay | 41 +++++++++++++ .../doc/adafruit_adalogger_featherwing.webp | Bin 0 -> 77104 bytes .../doc/index.rst | 58 ++++++++++++++++++ 4 files changed, 104 insertions(+) create mode 100644 boards/shields/adafruit_adalogger_featherwing/Kconfig.shield create mode 100644 boards/shields/adafruit_adalogger_featherwing/adafruit_adalogger_featherwing.overlay create mode 100644 boards/shields/adafruit_adalogger_featherwing/doc/adafruit_adalogger_featherwing.webp create mode 100644 boards/shields/adafruit_adalogger_featherwing/doc/index.rst diff --git a/boards/shields/adafruit_adalogger_featherwing/Kconfig.shield b/boards/shields/adafruit_adalogger_featherwing/Kconfig.shield new file mode 100644 index 0000000000000..eb5446a4746fd --- /dev/null +++ b/boards/shields/adafruit_adalogger_featherwing/Kconfig.shield @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Philip-Dylan Gleonec +# SPDX-License-Identifier: Apache-2.0 + +config SHIELD_ADAFRUIT_DATA_LOGGER + def_bool $(shields_list_contains,adafruit_adalogger_featherwing) diff --git a/boards/shields/adafruit_adalogger_featherwing/adafruit_adalogger_featherwing.overlay b/boards/shields/adafruit_adalogger_featherwing/adafruit_adalogger_featherwing.overlay new file mode 100644 index 0000000000000..3576ff838b01b --- /dev/null +++ b/boards/shields/adafruit_adalogger_featherwing/adafruit_adalogger_featherwing.overlay @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Philip-Dylan Gleonec + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + aliases { + rtc = &rtc0_adafruit_adalogger_featherwing; + sdhc0 = &sdhc0_adafruit_adalogger_featherwing; + }; +}; + +&feather_spi { + status = "okay"; + cs-gpios = <&feather_header 17 GPIO_ACTIVE_LOW>; /* D10 */ + + sdhc0_adafruit_adalogger_featherwing: sdhc@0 { + compatible = "zephyr,sdhc-spi-slot"; + reg = <0>; + spi-max-frequency = <12000000>; + status = "okay"; + + sdmmc { + compatible = "zephyr,sdmmc-disk"; + status = "okay"; + }; + }; +}; + +&feather_i2c { + status = "okay"; + + rtc0_adafruit_adalogger_featherwing: rtc@68 { + compatible = "nxp,pcf8523"; + reg = <0x68>; + alarms-count = <1>; + battery-switch-over = "standard"; + status = "okay"; + }; +}; diff --git a/boards/shields/adafruit_adalogger_featherwing/doc/adafruit_adalogger_featherwing.webp b/boards/shields/adafruit_adalogger_featherwing/doc/adafruit_adalogger_featherwing.webp new file mode 100644 index 0000000000000000000000000000000000000000..1e8e5960c04718ca585d10da4e681ee82cd47796 GIT binary patch literal 77104 zcmaI6V~{36*Dd7bI0Tl!Q z?Cf2gl_i7;HMO(}A&SrO&pzF|6#*_nBBwG@jp2IA4WB?G&22%tN&qI=YI?Qhu8nZ8~-nS z{U2=cU;N*sP@PqkMgHZ6`j02H_}{Sc|AtL0o$dZdo`7RBk8}63y=Uv0ptLR078HCoN{}>m5^1rz7 z|HY5}U%%o%m+?QB6~N@5Llocuumc$V*AMv5J@}{j*Z!xrF6J!E|D}Lng#iGt-JhRF zG5`P~2>|$t|M~eS`1$!N1OPy`0f2t{|M5HI0|1;)|M>X-;YjlU0EA!wpmq3vIO8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zIJMh3I$;_Kwkc?XoMfg)r<2Ff+EVx z#?!$a?cnChevOE*cJoF{12O*p3e3eFb35w~u&bBA?=S^y+*}0x5blBy0kEKp%XPHB zwY|_vJ{aS_!}wpdy$t-_QG$9XFE?*b8aqpBzkyml&qbhB|lO8gcf5U`LKN*DqXMWIAN!Vs`92q6j+28p9Y#H}GH zA(${yg~Y`~K(^wdD3GuSLI@;o1BQS^z~W*^VR37u zD9Q%Njsm5|p_l?Fluz<;0WI3v)u7+ql*6!_yV$D6EA^@9m62v zI_of|zgr{$_e3GkZk`5iZqCxcf5zlr*EBI>0*OE)6cK0?2J4?8YVc=>@`0feU`((W z0wgrukPf!~|0mV!QTV$*?>cy4-1`4LqV!Q7e@o5|?7#C_0%7x4oL&eY6cYG%rHwtp z)eeOj=a^jkOU>bb=}$3n8*3O8j0A~_!7%xN6vwQrkv8HW2m}ff1B)VrZ6UBf_Fitb zXkUaUO5P4b4Tb?sYW<#-*m-_a&ihBt*B*7vCx!zMSPTRO8$hlnD+!4B-y8`3Ka3v% zMq!dxOb8@ui?9I+i;IY0Qdvj@B!o#Iu&4;a8X^3D6~8zLEc8G7@H&3M>#69kt`Pj6 zz4ZIqf0?%asAJ~BYw@3{RfhfF*S`$>%fP=3{L8?<4E)Q$|9=ep=i&_Iiut7Gi&=X8 E2XcfQ?f?J) literal 0 HcmV?d00001 diff --git a/boards/shields/adafruit_adalogger_featherwing/doc/index.rst b/boards/shields/adafruit_adalogger_featherwing/doc/index.rst new file mode 100644 index 0000000000000..bc11d86bf516c --- /dev/null +++ b/boards/shields/adafruit_adalogger_featherwing/doc/index.rst @@ -0,0 +1,58 @@ +.. _adafruit_adalogger_featherwing_shield: + +Adafruit Adalogger Featherwing Shield +##################################### + +Overview +******** + +The `Adafruit Adalogger Featherwing Shield`_ features an `NXP PCF8523 Real-Time +Clock/Calendar with Battery Backup`_, and an SD card interface. + +.. figure:: adafruit_adalogger_featherwing.webp + :align: center + :alt: Adafruit Adalogger Featherwing Shield + + Adafruit Adalogger Featherwing Shield (Credit: Adafruit) + +Pin Assignments +=============== + ++-----------------------+---------------------------------------------+ +| Shield Connector Pin | Function | ++=======================+=============================================+ +| D10 | SD card SPI CS | ++-----------------------+---------------------------------------------+ +| MOSI | SD card SPI MOSI | ++-----------------------+---------------------------------------------+ +| MISO | SD card SPI MISO | ++-----------------------+---------------------------------------------+ +| SCK | SD card SPI SCK | ++-----------------------+---------------------------------------------+ +| SDA | PCF8523 RTC I2C SDA | ++-----------------------+---------------------------------------------+ +| SCL | PCF8523 RTC I2C SCL | ++-----------------------+---------------------------------------------+ + +Requirements +************ + +This shield can only be used with a board which provides a configuration for Feather connectors and +defines node aliases for SPI, I2C and GPIO interfaces (see :ref:`shields` for more details). + +Programming +*********** + +Set ``--shield adafruit_adalogger_featherwing`` when you invoke ``west build``. For example: + +.. zephyr-app-commands:: + :zephyr-app: tests/drivers/rtc/rtc_api + :board: adafruit_feather_m0_basic_proto + :shield: adafruit_adalogger_featherwing + :goals: build + +.. _Adafruit Adalogger Featherwing Shield: + https://learn.adafruit.com/adafruit-adalogger-featherwing + +.. _NXP PCF8523 Real-Time Clock/Calendar with Battery Backup: + https://www.nxp.com/docs/en/data-sheet/PCF8523.pdf From 91d3eb910770390e3f8d73587a127eb31c9e53f6 Mon Sep 17 00:00:00 2001 From: Maksim Drachov Date: Wed, 4 Sep 2024 11:48:38 +0300 Subject: [PATCH 2469/4482] soc: atmel: fix wait state value The datasheet specifies that 2 wait states are required at 48 MHz. Signed-off-by: Maksim Drachov --- soc/atmel/sam0/common/soc_samc2x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soc/atmel/sam0/common/soc_samc2x.c b/soc/atmel/sam0/common/soc_samc2x.c index d133ee97187cc..1581b62eef2e7 100644 --- a/soc/atmel/sam0/common/soc_samc2x.c +++ b/soc/atmel/sam0/common/soc_samc2x.c @@ -17,8 +17,8 @@ static void flash_waitstates_init(void) { - /* One wait state at 48 MHz. */ - NVMCTRL->CTRLB.bit.RWS = NVMCTRL_CTRLB_RWS_HALF_Val; + /* Two wait state at 48 MHz. */ + NVMCTRL->CTRLB.bit.RWS = NVMCTRL_CTRLB_RWS_DUAL_Val; } static void osc48m_init(void) From 866905fd6a5fdee2200687243eedada0ef26df1f Mon Sep 17 00:00:00 2001 From: romain pelletant Date: Wed, 22 Feb 2023 12:10:45 +0100 Subject: [PATCH 2470/4482] lorawan: change downlink callback Change downlink callback to transport data using flags. Related to Issue #55072 Co-authored-by: Jan Kowalewski Signed-off-by: romain pelletant Signed-off-by: Jan Kowalewski --- include/zephyr/lorawan/lorawan.h | 14 ++++++++++---- samples/subsys/lorawan/class_a/src/main.c | 5 +++-- subsys/lorawan/lorawan.c | 11 ++++++----- subsys/lorawan/services/clock_sync.c | 2 +- subsys/lorawan/services/frag_transport.c | 4 ++-- subsys/lorawan/services/multicast.c | 2 +- 6 files changed, 23 insertions(+), 15 deletions(-) diff --git a/include/zephyr/lorawan/lorawan.h b/include/zephyr/lorawan/lorawan.h index 058c4cbabc703..61f0599750487 100644 --- a/include/zephyr/lorawan/lorawan.h +++ b/include/zephyr/lorawan/lorawan.h @@ -103,6 +103,13 @@ enum lorawan_message_type { LORAWAN_MSG_CONFIRMED, /**< Confirmed message */ }; +/** + * @brief LoRaWAN downlink flags. + */ +enum lorawan_dl_flags { + LORAWAN_DATA_PENDING = BIT(0), +}; + /** * @brief LoRaWAN join parameters for over-the-Air activation (OTAA) * @@ -181,15 +188,14 @@ struct lorawan_downlink_cb { * and should therefore be as short as possible. * * @param port Port message was sent on - * @param data_pending Network server has more downlink packets pending + * @param flags Downlink data flags (see @ref lorawan_dl_flags) * @param rssi Received signal strength in dBm * @param snr Signal to Noise ratio in dBm * @param len Length of data received, will be 0 for ACKs * @param data Data received, will be NULL for ACKs */ - void (*cb)(uint8_t port, bool data_pending, - int16_t rssi, int8_t snr, - uint8_t len, const uint8_t *data); + void (*cb)(uint8_t port, uint8_t flags, int16_t rssi, int8_t snr, uint8_t len, + const uint8_t *data); /** Node for callback list */ sys_snode_t node; }; diff --git a/samples/subsys/lorawan/class_a/src/main.c b/samples/subsys/lorawan/class_a/src/main.c index 1e31baf36e477..e09d6945907fd 100644 --- a/samples/subsys/lorawan/class_a/src/main.c +++ b/samples/subsys/lorawan/class_a/src/main.c @@ -27,11 +27,12 @@ LOG_MODULE_REGISTER(lorawan_class_a); char data[] = {'h', 'e', 'l', 'l', 'o', 'w', 'o', 'r', 'l', 'd'}; -static void dl_callback(uint8_t port, bool data_pending, +static void dl_callback(uint8_t port, uint8_t flags, int16_t rssi, int8_t snr, uint8_t len, const uint8_t *hex_data) { - LOG_INF("Port %d, Pending %d, RSSI %ddB, SNR %ddBm", port, data_pending, rssi, snr); + LOG_INF("Port %d, Pending %d, RSSI %ddB, SNR %ddBm", + port, flags & LORAWAN_DATA_PENDING, rssi, snr); if (hex_data) { LOG_HEXDUMP_INF(hex_data, len, "Payload: "); } diff --git a/subsys/lorawan/lorawan.c b/subsys/lorawan/lorawan.c index 8a4830a37e21c..1e33f95d2d7af 100644 --- a/subsys/lorawan/lorawan.c +++ b/subsys/lorawan/lorawan.c @@ -148,6 +148,7 @@ static void mcps_confirm_handler(McpsConfirm_t *mcps_confirm) static void mcps_indication_handler(McpsIndication_t *mcps_indication) { struct lorawan_downlink_cb *cb; + uint8_t flags = 0; LOG_DBG("Received McpsIndication %d", mcps_indication->McpsIndication); @@ -162,15 +163,15 @@ static void mcps_indication_handler(McpsIndication_t *mcps_indication) datarate_observe(false); } + /* IsUplinkTxPending also indicates pending downlinks */ + flags |= (mcps_indication->IsUplinkTxPending == 1 ? LORAWAN_DATA_PENDING : 0); + /* Iterate over all registered downlink callbacks */ SYS_SLIST_FOR_EACH_CONTAINER(&dl_callbacks, cb, node) { if ((cb->port == LW_RECV_PORT_ANY) || (cb->port == mcps_indication->Port)) { - cb->cb(mcps_indication->Port, - /* IsUplinkTxPending also indicates pending downlinks */ - mcps_indication->IsUplinkTxPending == 1, - mcps_indication->Rssi, mcps_indication->Snr, - mcps_indication->BufferSize, + cb->cb(mcps_indication->Port, flags, mcps_indication->Rssi, + mcps_indication->Snr, mcps_indication->BufferSize, mcps_indication->Buffer); } } diff --git a/subsys/lorawan/services/clock_sync.c b/subsys/lorawan/services/clock_sync.c index 5249f43b88138..bac4b466cda70 100644 --- a/subsys/lorawan/services/clock_sync.c +++ b/subsys/lorawan/services/clock_sync.c @@ -91,7 +91,7 @@ static inline k_timeout_t clock_sync_calc_periodicity(void) return K_SECONDS(ctx.periodicity - 30 + sys_rand32_get() % 61); } -static void clock_sync_package_callback(uint8_t port, bool data_pending, int16_t rssi, int8_t snr, +static void clock_sync_package_callback(uint8_t port, uint8_t flags, int16_t rssi, int8_t snr, uint8_t len, const uint8_t *rx_buf) { uint8_t tx_buf[3 * MAX_CLOCK_SYNC_ANS_LEN]; diff --git a/subsys/lorawan/services/frag_transport.c b/subsys/lorawan/services/frag_transport.c index 24541e30de0ed..5bb180bb161f8 100644 --- a/subsys/lorawan/services/frag_transport.c +++ b/subsys/lorawan/services/frag_transport.c @@ -101,8 +101,8 @@ static struct frag_transport_context ctx; /* Callback for notification of finished firmware transfer */ static void (*finished_cb)(void); -static void frag_transport_package_callback(uint8_t port, bool data_pending, int16_t rssi, - int8_t snr, uint8_t len, const uint8_t *rx_buf) +static void frag_transport_package_callback(uint8_t port, uint8_t flags, int16_t rssi, int8_t snr, + uint8_t len, const uint8_t *rx_buf) { uint8_t tx_buf[FRAG_TRANSPORT_MAX_CMDS_PER_PACKAGE * FRAG_TRANSPORT_MAX_ANS_LEN]; uint8_t tx_pos = 0; diff --git a/subsys/lorawan/services/multicast.c b/subsys/lorawan/services/multicast.c index c6af76eca1ed8..72f2de0497ea3 100644 --- a/subsys/lorawan/services/multicast.c +++ b/subsys/lorawan/services/multicast.c @@ -107,7 +107,7 @@ static int32_t multicast_schedule_class_c_session(uint8_t id, uint32_t session_t return time_to_start; } -static void multicast_package_callback(uint8_t port, bool data_pending, int16_t rssi, int8_t snr, +static void multicast_package_callback(uint8_t port, uint8_t flags, int16_t rssi, int8_t snr, uint8_t len, const uint8_t *rx_buf) { uint8_t tx_buf[MAX_MULTICAST_CMDS_PER_PACKAGE * MAX_MULTICAST_ANS_LEN]; From ae0c1b72cfc4e019276cdd4f59760f8ee894ad91 Mon Sep 17 00:00:00 2001 From: romain pelletant Date: Sat, 19 Aug 2023 19:26:03 +0200 Subject: [PATCH 2471/4482] lorawan: add devicetime request support Add devicetime request support. Update lorawan sample Related to Issue #55072 Co-authored-by: Jan Kowalewski Signed-off-by: romain pelletant Signed-off-by: Jan Kowalewski --- include/zephyr/lorawan/lorawan.h | 27 ++++++++++++++ samples/subsys/lorawan/class_a/src/main.c | 9 ++--- samples/subsys/lorawan/fuota/src/main.c | 7 ++-- subsys/lorawan/lorawan.c | 45 +++++++++++++++++++++++ 4 files changed, 79 insertions(+), 9 deletions(-) diff --git a/include/zephyr/lorawan/lorawan.h b/include/zephyr/lorawan/lorawan.h index 61f0599750487..914997243e180 100644 --- a/include/zephyr/lorawan/lorawan.h +++ b/include/zephyr/lorawan/lorawan.h @@ -108,6 +108,7 @@ enum lorawan_message_type { */ enum lorawan_dl_flags { LORAWAN_DATA_PENDING = BIT(0), + LORAWAN_TIME_UPDATED = BIT(1), }; /** @@ -378,6 +379,32 @@ void lorawan_get_payload_sizes(uint8_t *max_next_payload_size, */ int lorawan_set_region(enum lorawan_region region); +/** + * @brief Request for time according to DeviceTimeReq MAC cmd + * + * Append MAC DevTimeReq command. It will be processed on next send + * message or force sending empty message to request time immediately. + * + * @param force_request Immediately send an empty message to execute the request + * @return 0 if successful, negative errno otherwise + */ +int lorawan_request_device_time(bool force_request); + +/** + * @brief Retrieve the current time from LoRaWAN stack updated by + * DeviceTimeAns on MAC layer. + * + * This function uses the GPS epoch format, as used in all LoRaWAN services. + * + * The GPS epoch started on 1980-01-06T00:00:00Z, but has since diverged + * from UTC, as it does not consider corrections like leap seconds. + * + * @param gps_time Synchronized time in GPS epoch format truncated to 32-bit. + * + * @return 0 if successful, -EAGAIN if the clock is not yet synchronized. + */ +int lorawan_device_time_get(uint32_t *gps_time); + #ifdef CONFIG_LORAWAN_APP_CLOCK_SYNC /** diff --git a/samples/subsys/lorawan/class_a/src/main.c b/samples/subsys/lorawan/class_a/src/main.c index e09d6945907fd..ee48cee6a1158 100644 --- a/samples/subsys/lorawan/class_a/src/main.c +++ b/samples/subsys/lorawan/class_a/src/main.c @@ -27,12 +27,11 @@ LOG_MODULE_REGISTER(lorawan_class_a); char data[] = {'h', 'e', 'l', 'l', 'o', 'w', 'o', 'r', 'l', 'd'}; -static void dl_callback(uint8_t port, uint8_t flags, - int16_t rssi, int8_t snr, - uint8_t len, const uint8_t *hex_data) +static void dl_callback(uint8_t port, uint8_t flags, int16_t rssi, int8_t snr, uint8_t len, + const uint8_t *hex_data) { - LOG_INF("Port %d, Pending %d, RSSI %ddB, SNR %ddBm", - port, flags & LORAWAN_DATA_PENDING, rssi, snr); + LOG_INF("Port %d, Pending %d, RSSI %ddB, SNR %ddBm, Time %d", port, + flags & LORAWAN_DATA_PENDING, rssi, snr, !!(flags & LORAWAN_TIME_UPDATED)); if (hex_data) { LOG_HEXDUMP_INF(hex_data, len, "Payload: "); } diff --git a/samples/subsys/lorawan/fuota/src/main.c b/samples/subsys/lorawan/fuota/src/main.c index e6254bdf4b85b..ef6f8680cea6d 100644 --- a/samples/subsys/lorawan/fuota/src/main.c +++ b/samples/subsys/lorawan/fuota/src/main.c @@ -24,11 +24,10 @@ LOG_MODULE_REGISTER(lorawan_fuota, CONFIG_LORAWAN_SERVICES_LOG_LEVEL); char data[] = {'h', 'e', 'l', 'l', 'o', 'w', 'o', 'r', 'l', 'd'}; -static void downlink_info(uint8_t port, bool data_pending, int16_t rssi, int8_t snr, - uint8_t len, const uint8_t *data) +static void downlink_info(uint8_t port, uint8_t flags, int16_t rssi, int8_t snr, uint8_t len, + const uint8_t *data) { - LOG_INF("Received from port %d, pending %d, RSSI %ddB, SNR %ddBm", - port, data_pending, rssi, snr); + LOG_INF("Received from port %d, flags %d, RSSI %ddB, SNR %ddBm", port, flags, rssi, snr); if (data) { LOG_HEXDUMP_INF(data, len, "Payload: "); } diff --git a/subsys/lorawan/lorawan.c b/subsys/lorawan/lorawan.c index 1e33f95d2d7af..6dedafcb4b85e 100644 --- a/subsys/lorawan/lorawan.c +++ b/subsys/lorawan/lorawan.c @@ -68,6 +68,7 @@ K_MUTEX_DEFINE(lorawan_send_mutex); static enum lorawan_datarate default_datarate; static enum lorawan_datarate current_datarate; static bool lorawan_adr_enable; +static bool lorawan_device_time_updated_once; static sys_slist_t dl_callbacks; @@ -162,9 +163,14 @@ static void mcps_indication_handler(McpsIndication_t *mcps_indication) if (lorawan_adr_enable) { datarate_observe(false); } + /* Save time has been updated at least once */ + if (!lorawan_device_time_updated_once && mcps_indication->DeviceTimeAnsReceived) { + lorawan_device_time_updated_once = true; + } /* IsUplinkTxPending also indicates pending downlinks */ flags |= (mcps_indication->IsUplinkTxPending == 1 ? LORAWAN_DATA_PENDING : 0); + flags |= (mcps_indication->DeviceTimeAnsReceived ? LORAWAN_TIME_UPDATED : 0); /* Iterate over all registered downlink callbacks */ SYS_SLIST_FOR_EACH_CONTAINER(&dl_callbacks, cb, node) { @@ -202,6 +208,9 @@ static void mlme_confirm_handler(MlmeConfirm_t *mlme_confirm) /* Not implemented */ LOG_INF("Link check not implemented yet!"); break; + case MLME_DEVICE_TIME: + LOG_INF("DevTimeReq done"); + break; default: break; } @@ -382,6 +391,42 @@ int lorawan_set_region(enum lorawan_region region) return 0; } +int lorawan_request_device_time(bool force_request) +{ + int ret = 0; + LoRaMacStatus_t status; + MlmeReq_t mlme_req; + + mlme_req.Type = MLME_DEVICE_TIME; + status = LoRaMacMlmeRequest(&mlme_req); + if (status != LORAMAC_STATUS_OK) { + LOG_ERR("DeviceTime Req. failed: %s", lorawan_status2str(status)); + ret = lorawan_status2errno(status); + return ret; + } + + if (force_request) { + ret = lorawan_send(0U, "", 0U, LORAWAN_MSG_UNCONFIRMED); + } + + return ret; +} + +int lorawan_device_time_get(uint32_t *gps_time) +{ + SysTime_t local_time; + + __ASSERT(gps_time != NULL, "gps_time parameter is required"); + + if (lorawan_device_time_updated_once) { + local_time = SysTimeGet(); + *gps_time = local_time.Seconds - UNIX_GPS_EPOCH_OFFSET; + return 0; + } else { + return -EAGAIN; + } +} + int lorawan_join(const struct lorawan_join_config *join_cfg) { MibRequestConfirm_t mib_req; From bea68273d5adfcf4ee0a40a73a3d067eda94a0b4 Mon Sep 17 00:00:00 2001 From: romain pelletant Date: Sun, 24 Sep 2023 17:46:10 +0200 Subject: [PATCH 2472/4482] lorawan: replace booleans by atomic flags ADR status and devtime updated flags merged into an atomic bits array. Related to Issue #55072 Co-authored-by: Jan Kowalewski Signed-off-by: romain pelletant Signed-off-by: Jan Kowalewski --- subsys/lorawan/lorawan.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/subsys/lorawan/lorawan.c b/subsys/lorawan/lorawan.c index 6dedafcb4b85e..0f3c777feceff 100644 --- a/subsys/lorawan/lorawan.c +++ b/subsys/lorawan/lorawan.c @@ -61,14 +61,20 @@ K_SEM_DEFINE(mcps_confirm_sem, 0, 1); K_MUTEX_DEFINE(lorawan_join_mutex); K_MUTEX_DEFINE(lorawan_send_mutex); +/* lorawan flags: store lorawan states */ +enum { + LORAWAN_FLAG_ADR_ENABLE, + LORAWAN_FLAG_DEVICETIME_UPDATED_ONCE, + LORAWAN_FLAG_COUNT, +}; + /* We store both the default datarate requested through lorawan_set_datarate * and the current datarate so that we can use the default datarate for all * join requests, even as the current datarate changes due to ADR. */ static enum lorawan_datarate default_datarate; static enum lorawan_datarate current_datarate; -static bool lorawan_adr_enable; -static bool lorawan_device_time_updated_once; +static ATOMIC_DEFINE(lorawan_flags, LORAWAN_FLAG_COUNT); static sys_slist_t dl_callbacks; @@ -138,7 +144,7 @@ static void mcps_confirm_handler(McpsConfirm_t *mcps_confirm) } /* Datarate may have changed due to a missed ADRACK */ - if (lorawan_adr_enable) { + if (atomic_test_bit(lorawan_flags, LORAWAN_FLAG_ADR_ENABLE)) { datarate_observe(false); } @@ -160,12 +166,14 @@ static void mcps_indication_handler(McpsIndication_t *mcps_indication) } /* Datarate can change as result of ADR command from server */ - if (lorawan_adr_enable) { + if (atomic_test_bit(lorawan_flags, LORAWAN_FLAG_ADR_ENABLE)) { datarate_observe(false); } + /* Save time has been updated at least once */ - if (!lorawan_device_time_updated_once && mcps_indication->DeviceTimeAnsReceived) { - lorawan_device_time_updated_once = true; + if (!atomic_test_bit(lorawan_flags, LORAWAN_FLAG_DEVICETIME_UPDATED_ONCE) && + mcps_indication->DeviceTimeAnsReceived) { + atomic_set_bit(lorawan_flags, LORAWAN_FLAG_DEVICETIME_UPDATED_ONCE); } /* IsUplinkTxPending also indicates pending downlinks */ @@ -418,13 +426,13 @@ int lorawan_device_time_get(uint32_t *gps_time) __ASSERT(gps_time != NULL, "gps_time parameter is required"); - if (lorawan_device_time_updated_once) { - local_time = SysTimeGet(); - *gps_time = local_time.Seconds - UNIX_GPS_EPOCH_OFFSET; - return 0; - } else { + if (!atomic_test_bit(lorawan_flags, LORAWAN_FLAG_DEVICETIME_UPDATED_ONCE)) { return -EAGAIN; } + + local_time = SysTimeGet(); + *gps_time = local_time.Seconds - UNIX_GPS_EPOCH_OFFSET; + return 0; } int lorawan_join(const struct lorawan_join_config *join_cfg) @@ -485,7 +493,7 @@ int lorawan_join(const struct lorawan_join_config *join_cfg) * performed when ADR is disabled as it the network servers * responsibility to increase datarates when ADR is enabled. */ - if (!lorawan_adr_enable) { + if (!atomic_test_bit(lorawan_flags, LORAWAN_FLAG_ADR_ENABLE)) { MibRequestConfirm_t mib_req2; mib_req2.Type = MIB_CHANNELS_DATARATE; @@ -565,7 +573,7 @@ int lorawan_set_datarate(enum lorawan_datarate dr) MibRequestConfirm_t mib_req; /* Bail out if using ADR */ - if (lorawan_adr_enable) { + if (atomic_test_bit(lorawan_flags, LORAWAN_FLAG_ADR_ENABLE)) { return -EINVAL; } @@ -609,11 +617,11 @@ void lorawan_enable_adr(bool enable) { MibRequestConfirm_t mib_req; - if (enable != lorawan_adr_enable) { - lorawan_adr_enable = enable; + if (enable != atomic_test_bit(lorawan_flags, LORAWAN_FLAG_ADR_ENABLE)) { + atomic_set_bit_to(lorawan_flags, LORAWAN_FLAG_ADR_ENABLE, enable); mib_req.Type = MIB_ADR; - mib_req.Param.AdrEnable = lorawan_adr_enable; + mib_req.Param.AdrEnable = atomic_test_bit(lorawan_flags, LORAWAN_FLAG_ADR_ENABLE); LoRaMacMibSetRequestConfirm(&mib_req); } } From 095bc56a5758ddd195ab00383181227fe775856c Mon Sep 17 00:00:00 2001 From: Tomasz Leman Date: Tue, 15 Oct 2024 13:57:56 +0200 Subject: [PATCH 2473/4482] soc: intel_adsp: ace: Ensure TLB entry for HW registers during power-down This commit addresses an issue on platforms with an MMU where a LoadStoreTLBMissCause exception occurs when accessing hardware registers during the power-down process. The exception arises when attempting to access the IPC register after HPSRAM has been powered down, leading to a double exception: LoadStoreTLBMissCause followed by InstrPIFDataErrorCause. To resolve this, we preload the IPC register before shutting down LPSRAM. This change prevents the double exception by ensuring that the page table entries are correctly managed in the TLB before HPSRAM is powered down and allowing the power-down sequence to complete successfully. Signed-off-by: Tomasz Leman --- soc/intel/intel_adsp/ace/power_down.S | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/soc/intel/intel_adsp/ace/power_down.S b/soc/intel/intel_adsp/ace/power_down.S index 42ea10899efae..acc417fa6d07f 100644 --- a/soc/intel/intel_adsp/ace/power_down.S +++ b/soc/intel/intel_adsp/ace/power_down.S @@ -72,6 +72,28 @@ power_down: /* load address of DIPCTDR register */ movi p_ipc_regs, IPC_HOST_BASE movi u32_ipc_response_mask, 0x20000000 +#if CONFIG_XTENSA_MMU + /** + * Preload the IPC register to ensure the TLB entry is present. + * This addresses an issue on platforms with an MMU where a + * LoadStoreTLBMissCause exception occurs when accessing hardware + * registers during the power-down process. By preloading the IPC + * register, we ensure that the necessary TLB entry is available, + * preventing a double exception (LoadStoreTLBMissCause followed by + * InstrPIFDataErrorCause) when accessing the IPC register after + * HPSRAM is powered down. + * + * Two solutions were considered: + * 1. Use TLB way9 to lock IPC MMIO registers (Zephyr PR80333) + * 2. Manually force TLB entry to be fetched in power_down (this solution) + * + * The decision was made to proceed with this solution due to its + * simplicity and directness, despite the potential performance benefits + * of the TLB way9 approach. The TLB way9 approach would also reserve + * way9, potentially limiting its use for other purposes in the future. + */ + l32i pfl_reg, p_ipc_regs, 0 +#endif beqz pu32_hpsram_mask, _PD_DISABLE_LPSRAM movi pu32_hpsram_mask, hpsram_mask From f810b5d292d277d1da3400dee645e3eb18589d23 Mon Sep 17 00:00:00 2001 From: Tomasz Leman Date: Thu, 8 Aug 2024 19:12:40 +0200 Subject: [PATCH 2474/4482] soc: intel_adsp: ace: Clean up macro indentation in power_down.S This commit improves the readability of the power_down.S assembly file by standardizing the indentation of the preprocessor definitions. No functional changes have been made; this is purely a cosmetic update to the code formatting. Signed-off-by: Tomasz Leman --- soc/intel/intel_adsp/ace/power_down.S | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/soc/intel/intel_adsp/ace/power_down.S b/soc/intel/intel_adsp/ace/power_down.S index acc417fa6d07f..d1cb240390632 100644 --- a/soc/intel/intel_adsp/ace/power_down.S +++ b/soc/intel/intel_adsp/ace/power_down.S @@ -36,20 +36,20 @@ sram_dis_loop_cnt: * @param A4 - send response to ipc */ -#define IPC_HOST_BASE 0x00073000 -#define b_enable_lpsram a2 -#define pu32_hpsram_mask a3 -#define b_ipc_response a4 -#define temp_reg0 a6 -#define temp_reg1 a7 -#define temp_reg2 a8 -#define temp_reg3 a9 -#define temp_reg4 a10 -#define temp_reg5 a11 -#define temp_reg6 a12 -#define p_ipc_regs a13 +#define IPC_HOST_BASE 0x00073000 +#define b_enable_lpsram a2 +#define pu32_hpsram_mask a3 +#define b_ipc_response a4 +#define temp_reg0 a6 +#define temp_reg1 a7 +#define temp_reg2 a8 +#define temp_reg3 a9 +#define temp_reg4 a10 +#define temp_reg5 a11 +#define temp_reg6 a12 +#define p_ipc_regs a13 #define u32_ipc_response_mask a14 -#define pfl_reg a15 +#define pfl_reg a15 power_down: entry sp, 32 From e0977dccd85700563ed816253bd57ebb4586d8bf Mon Sep 17 00:00:00 2001 From: Tomasz Leman Date: Fri, 9 Aug 2024 19:00:15 +0200 Subject: [PATCH 2475/4482] dts: xtensa: intel: Add hsbcap register node for ADSP ACE platforms This commit introduces the L2 Memory Capabilities (hsbcap) register node to the Devicetree specifications for Intel ADSP ACE platforms. The hsbcap register provides information on the general capabilities associated with the L2 memory, which is critical for system configuration and resource management. The hsbcap node has been added to the Devicetree source files for ACE 1.5 (MTPM), ACE 2.0 (LNL), and ACE 3.0 (PTL) platforms. In addition, the DFL2MM_REG macro in adsp_memory.h has been updated to use the Devicetree node label for hsbcap, ensuring a consistent and maintainable approach to accessing this register across the codebase. Signed-off-by: Tomasz Leman --- dts/xtensa/intel/intel_adsp_ace15_mtpm.dtsi | 5 +++++ dts/xtensa/intel/intel_adsp_ace20_lnl.dtsi | 5 +++++ dts/xtensa/intel/intel_adsp_ace30_ptl.dtsi | 5 +++++ soc/intel/intel_adsp/ace/include/adsp_memory.h | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/dts/xtensa/intel/intel_adsp_ace15_mtpm.dtsi b/dts/xtensa/intel/intel_adsp_ace15_mtpm.dtsi index 3500e51f76129..da00cf53a4ed2 100644 --- a/dts/xtensa/intel/intel_adsp_ace15_mtpm.dtsi +++ b/dts/xtensa/intel/intel_adsp_ace15_mtpm.dtsi @@ -126,6 +126,11 @@ reg = <0x1fe80088 0x4>; }; + hsbcap: hsbcap@71d00 { + compatible = "intel,adsp-hsbcap"; + reg = <0x71d00 0x4>; + }; + lsbpm: lsbpm@71d80 { compatible = "intel,adsp-lsbpm"; reg = <0x71d80 0x0008>; diff --git a/dts/xtensa/intel/intel_adsp_ace20_lnl.dtsi b/dts/xtensa/intel/intel_adsp_ace20_lnl.dtsi index 8dc4489d0ee30..66a5784185097 100644 --- a/dts/xtensa/intel/intel_adsp_ace20_lnl.dtsi +++ b/dts/xtensa/intel/intel_adsp_ace20_lnl.dtsi @@ -145,6 +145,11 @@ reg = <0x1fe80088 0x4>; }; + hsbcap: hsbcap@71d00 { + compatible = "intel,adsp-hsbcap"; + reg = <0x71d00 0x4>; + }; + lsbpm: lsbpm@71d80 { compatible = "intel,adsp-lsbpm"; reg = <0x71d80 0x0008>; diff --git a/dts/xtensa/intel/intel_adsp_ace30_ptl.dtsi b/dts/xtensa/intel/intel_adsp_ace30_ptl.dtsi index 26ae1c47f560f..a7c39cceac9c1 100644 --- a/dts/xtensa/intel/intel_adsp_ace30_ptl.dtsi +++ b/dts/xtensa/intel/intel_adsp_ace30_ptl.dtsi @@ -139,6 +139,11 @@ reg = <0x3fe80088 0x4>; }; + hsbcap: hsbcap@71d00 { + compatible = "intel,adsp-hsbcap"; + reg = <0x71d00 0x4>; + }; + lsbpm: lsbpm@71d80 { compatible = "intel,adsp-lsbpm"; reg = <0x71d80 0x0008>; diff --git a/soc/intel/intel_adsp/ace/include/adsp_memory.h b/soc/intel/intel_adsp/ace/include/adsp_memory.h index 80733ff175f75..1a643b0c42d1b 100644 --- a/soc/intel/intel_adsp/ace/include/adsp_memory.h +++ b/soc/intel/intel_adsp/ace/include/adsp_memory.h @@ -99,7 +99,7 @@ /* L2 Local Memory Management */ /* These registers are for the L2 memory control and status. */ -#define DFL2MM_REG 0x71d00 +#define DFL2MM_REG (DT_REG_ADDR(DT_NODELABEL(hsbcap))) struct ace_l2mm { uint32_t l2mcap; From f447d10b0a044e02cea7414afca40b961f3ba548 Mon Sep 17 00:00:00 2001 From: Tomasz Leman Date: Thu, 12 Sep 2024 15:08:08 +0200 Subject: [PATCH 2476/4482] soc: intel_adsp: ace: Add macro to power down entire HPSRAM Introduce a new assembly macro, m_ace_hpsram_power_down_entire, which utilizes Zephyr Devicetree macros to power down the entire HPSRAM on Intel ADSP ACE platforms. This macro dynamically retrieves the HPSRAM bank count and control register address from the Devicetree, streamlining the power-down process. The macro is designed to iterate over all HPSRAM banks and issue a power down command to each, ensuring a complete shutdown of the HPSRAM when required by the system's power management policy. Signed-off-by: Tomasz Leman --- .../intel_adsp/ace/asm_memory_management.h | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/soc/intel/intel_adsp/ace/asm_memory_management.h b/soc/intel/intel_adsp/ace/asm_memory_management.h index d154000a1b038..85be5fbea12d4 100644 --- a/soc/intel/intel_adsp/ace/asm_memory_management.h +++ b/soc/intel/intel_adsp/ace/asm_memory_management.h @@ -17,6 +17,8 @@ #define EBB_SEGMENT_SIZE 32 #define PLATFORM_HPSRAM_EBB_COUNT 22 +#include + #ifdef _ASMLANGUAGE .macro m_ace_hpsram_power_change segment_index, mask, ax, ay, az, au, aw @@ -79,5 +81,27 @@ addi \au, \au, -1 bnez \au, 2b .endm + +.macro m_ace_hpsram_power_down_entire ax, ay, az, au + /* Read the HPSRAM bank count from ACE_L2MCAP register */ + movi \au, DT_REG_ADDR(DT_NODELABEL(hsbcap)) + l32i \au, \au, 0 + extui \au, \au, 0, 8 /* Bank count is in the lower 8 bits */ + + movi \ay, 1 /* Power down command */ + + /* Calculate the address of the HSxPGCTL register */ + movi \az, DT_REG_ADDR(DT_NODELABEL(hsbpm)) +2 : + s8i \ay, \az, 0 /* HSxPGCTL.l2lmpge = 1 (power down) */ + memw +1 : + l8ui \ax, \az, 4 /* ax = HSxPGISTS.l2lmpgis */ + bne \ax, \ay, 1b /* wait till status == request */ + + addi \az, \az, DT_REG_SIZE(DT_NODELABEL(hsbpm)) /* Move to next bank control register */ + addi \au, \au, -1 /* Decrement bank count */ + bnez \au, 2b /* If banks are left, continue loop */ +.endm #endif /* _ASMLANGUAGE */ #endif /* __Z_ACE_LIB_ASM_MEMORY_MANAGEMENT_H__ */ From 2d997082fce62bb38134faee31bc62d82abe8f5c Mon Sep 17 00:00:00 2001 From: Tomasz Leman Date: Thu, 12 Sep 2024 15:22:50 +0200 Subject: [PATCH 2477/4482] soc: intel_adsp: ace: Update power_down to use new HPSRAM power-down macro Refactor the power_down function to utilize the newly introduced m_ace_hpsram_power_down_entire macro for shutting down the entire HPSRAM. This change simplifies the power-down process by replacing the previous segment-based power gating mask approach with a single boolean flag that indicates whether the entire HPSRAM should be disabled. The function signature of power_down has been updated to accept the new boolean flag, and the corresponding call sites have been modified to pass the flag based on the CONFIG_ADSP_POWER_DOWN_HPSRAM Kconfig option. Additionally, the assembly code has been cleaned up to remove the now-obsolete hpsram_mask array and related logic. Signed-off-by: Tomasz Leman --- soc/intel/intel_adsp/ace/power.c | 18 ++------- soc/intel/intel_adsp/ace/power_down.S | 55 +++++++-------------------- 2 files changed, 16 insertions(+), 57 deletions(-) diff --git a/soc/intel/intel_adsp/ace/power.c b/soc/intel/intel_adsp/ace/power.c index 822b9d422cf14..ed133b8eedd9c 100644 --- a/soc/intel/intel_adsp/ace/power.c +++ b/soc/intel/intel_adsp/ace/power.c @@ -68,11 +68,10 @@ __imr void power_init(void) * NOTE: there's no return from this function. * * @param disable_lpsram flag if LPSRAM is to be disabled (whole) - * @param hpsram_pg_mask pointer to memory segments power gating mask - * (each bit corresponds to one ebb) + * @param disable_hpsram flag if HPSRAM is to be disabled (whole) * @param response_to_ipc flag if ipc response should be send during power down */ -void power_down(bool disable_lpsram, bool hpsram_mask, bool response_to_ipc); +void power_down(bool disable_lpsram, bool disable_hpsram, bool response_to_ipc); #ifdef CONFIG_ADSP_IMR_CONTEXT_SAVE /** @@ -274,9 +273,6 @@ __imr void pm_state_imr_restore(void) } #endif /* CONFIG_ADSP_IMR_CONTEXT_SAVE */ -#include "asm_memory_management.h" -extern uint32_t hpsram_mask[MAX_MEMORY_SEGMENTS]; - void pm_state_set(enum pm_state state, uint8_t substate_id) { ARG_UNUSED(substate_id); @@ -343,16 +339,8 @@ void pm_state_set(enum pm_state state, uint8_t substate_id) (void *)rom_entry; sys_cache_data_flush_range((void *)imr_layout, sizeof(*imr_layout)); #endif /* CONFIG_ADSP_IMR_CONTEXT_SAVE */ -#ifdef CONFIG_ADSP_POWER_DOWN_HPSRAM - /* turn off all HPSRAM banks - get a full bitmap */ - uint32_t ebb_banks = ace_hpsram_get_bank_count(); - hpsram_mask[0] = (1 << ebb_banks) - 1; -#define HPSRAM_MASK true -#else -#define HPSRAM_MASK false -#endif /* CONFIG_ADSP_POWER_DOWN_HPSRAM */ /* do power down - this function won't return */ - power_down(true, HPSRAM_MASK, true); + power_down(true, CONFIG_ADSP_POWER_DOWN_HPSRAM, true); } else { power_gate_entry(cpu); } diff --git a/soc/intel/intel_adsp/ace/power_down.S b/soc/intel/intel_adsp/ace/power_down.S index d1cb240390632..abdb13eb5efd5 100644 --- a/soc/intel/intel_adsp/ace/power_down.S +++ b/soc/intel/intel_adsp/ace/power_down.S @@ -4,15 +4,6 @@ #include "asm_memory_management.h" - .section .cached.hpsram_mask, "w" - .align 64 -hpsram_mask: - .rept MAX_MEMORY_SEGMENTS - .word 0 - .endr - - .global hpsram_mask - .section .text, "ax" .align 64 power_down_literals: @@ -31,14 +22,13 @@ sram_dis_loop_cnt: * Depending on arguments, memories are switched off. * * @param A2 - argument for LPSRAM - * @param A3 - pointer to array containing power gating mask. - * Size of array is determined by MAX_MEMORY_SEGMENTS define. + * @param A3 - argument for HPSRAM * @param A4 - send response to ipc */ #define IPC_HOST_BASE 0x00073000 -#define b_enable_lpsram a2 -#define pu32_hpsram_mask a3 +#define b_disable_lpsram a2 +#define b_disable_hpsram a3 #define b_ipc_response a4 #define temp_reg0 a6 #define temp_reg1 a7 @@ -95,44 +85,25 @@ power_down: l32i pfl_reg, p_ipc_regs, 0 #endif - beqz pu32_hpsram_mask, _PD_DISABLE_LPSRAM - movi pu32_hpsram_mask, hpsram_mask - _PD_DISABLE_LPSRAM: /** * effectively executes: - * if (b_enable_lpsram) { + * if (b_disable_lpsram) { * ace_lpsram_power_down_entire(); * } */ - beqz b_enable_lpsram, _PD_DISABLE_HPSRAM + beqz b_disable_lpsram, _PD_DISABLE_HPSRAM m_ace_lpsram_power_down_entire temp_reg0, temp_reg1, temp_reg2, temp_reg3 _PD_DISABLE_HPSRAM: - /* if value pu32_hpsram_mask = 0 - do not disable hpsram. */ - beqz pu32_hpsram_mask, _PD_SEND_IPC - /** - * effectively executes: - * for (size_t seg_index = (MAX_MEMORY_SEGMENTS - 1); seg_index >= 0; - * --seg_index) { - * ace_hpsram_power_change(seg_index, mask[seg_index]); - * } - * where mask is given in pu32_hpsram_mask register - */ - - .set seg_index, MAX_MEMORY_SEGMENTS - 1 - .rept MAX_MEMORY_SEGMENTS - l32i temp_reg0, pu32_hpsram_mask, 4 * seg_index - m_ace_hpsram_power_change\ - /*segment_index=*/ seg_index,\ - /*mask=*/ temp_reg0,\ - temp_reg1,\ - temp_reg2,\ - temp_reg3,\ - temp_reg4,\ - temp_reg5 - .set seg_index, seg_index - 1 - .endr +/** + * effectively executes: + * if (b_disable_hpsram) { + * ace_hpsram_power_down_entire(); + * } + */ + beqz b_disable_hpsram, _PD_SEND_IPC + m_ace_hpsram_power_down_entire temp_reg0, temp_reg1, temp_reg2, temp_reg3 _PD_SEND_IPC: /** From 946aeaa7e8d135cd6fee48e4df288241a03e9371 Mon Sep 17 00:00:00 2001 From: Tomasz Leman Date: Thu, 12 Sep 2024 15:29:23 +0200 Subject: [PATCH 2478/4482] soc: intel_adsp: ace: Remove obsolete HPSRAM power change macro Remove the m_ace_hpsram_power_change macro from asm_memory_management.h as it is no longer used after refactoring the power_down function to utilize the new m_ace_hpsram_power_down_entire macro. This cleanup helps to reduce code complexity and maintainability. Signed-off-by: Tomasz Leman --- .../intel_adsp/ace/asm_memory_management.h | 44 ------------------- 1 file changed, 44 deletions(-) diff --git a/soc/intel/intel_adsp/ace/asm_memory_management.h b/soc/intel/intel_adsp/ace/asm_memory_management.h index 85be5fbea12d4..95c14b5aa2983 100644 --- a/soc/intel/intel_adsp/ace/asm_memory_management.h +++ b/soc/intel/intel_adsp/ace/asm_memory_management.h @@ -13,55 +13,11 @@ #define LSPGCTL 0x71D80 #define LSPGCTL_HIGH ((LSPGCTL >> 4) & 0xff00) #define LSPGCTL_LOW ((LSPGCTL >> 4) & 0xff) -#define MAX_MEMORY_SEGMENTS 1 -#define EBB_SEGMENT_SIZE 32 -#define PLATFORM_HPSRAM_EBB_COUNT 22 #include #ifdef _ASMLANGUAGE -.macro m_ace_hpsram_power_change segment_index, mask, ax, ay, az, au, aw - .if \segment_index == 0 - .if EBB_SEGMENT_SIZE > PLATFORM_HPSRAM_EBB_COUNT - .set i_end, PLATFORM_HPSRAM_EBB_COUNT - .else - .set i_end, EBB_SEGMENT_SIZE - .endif - .elseif PLATFORM_HPSRAM_EBB_COUNT >= EBB_SEGMENT_SIZE - .set i_end, PLATFORM_HPSRAM_EBB_COUNT - EBB_SEGMENT_SIZE - .else - .err - .endif - - rsr.sar \aw /* store old sar value */ - - /* SHIM_HSPGCTL(ebb_index): 0x17a800 >> 11 == 0x2f5 */ - movi \az, 0x2f5 - slli \az, \az, 0xb - /* 8 * (\segment_index << 5) == (\segment_index << 5) << 3 == \segment_index << 8 */ - addmi \az, \az, \segment_index << 8 - - movi \au, i_end - 1 /* au = banks count in segment */ -2 : - /* au = current bank in segment */ - mov \ax, \mask /* ax = mask */ - ssr \au - srl \ax, \ax /* ax >>= current bank */ - extui \ax, \ax, 0, 1 /* ax &= BIT(1) */ - s8i \ax, \az, 0 /* HSxPGCTL.l2lmpge = ax */ - memw - 1 : - l8ui \ay, \az, 4 /* ax=HSxPGISTS.l2lmpgis */ - bne \ax, \ay, 1b /* wait till status==request */ - - addi \az, \az, 8 - addi \au, \au, -1 - bnez \au, 2b - - wsr.sar \aw -.endm - .macro m_ace_lpsram_power_down_entire ax, ay, az, au movi \au, 8 /* LPSRAM_EBB_QUANTITY */ movi \az, LSPGCTL_LOW From 5cf2cb6a37d784b2655b22e71bf03a61b7319b1d Mon Sep 17 00:00:00 2001 From: Tomasz Leman Date: Mon, 16 Sep 2024 17:56:16 +0200 Subject: [PATCH 2479/4482] soc: intel_adsp: ace: Use DT macros instead of hardcoded values Replace hardcoded register addresses and values in asm_memory_management.h with Devicetree (DT) macros for LPSRAM power-down operations. This change ensures that register addresses and bank counts are dynamically obtained from the Devicetree, improving code portability and reducing the risk of errors due to manual updates. - Removed hardcoded LSPGCTL address definitions. - Updated m_ace_lpsram_power_down_entire macro to use DT_NODELABEL to fetch LPSRAM bank count and control register address - Adjusted bit field extraction logic to align with the updated register information from the Devicetree. This commit aligns with the ongoing effort to utilize Devicetree for hardware abstraction and to facilitate easier maintenance and updates to the codebase. Signed-off-by: Tomasz Leman --- .../intel_adsp/ace/asm_memory_management.h | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/soc/intel/intel_adsp/ace/asm_memory_management.h b/soc/intel/intel_adsp/ace/asm_memory_management.h index 95c14b5aa2983..cd2268807375a 100644 --- a/soc/intel/intel_adsp/ace/asm_memory_management.h +++ b/soc/intel/intel_adsp/ace/asm_memory_management.h @@ -9,33 +9,34 @@ #ifndef __ZEPHYR_ACE_LIB_ASM_MEMORY_MANAGEMENT_H__ #define __ZEPHYR_ACE_LIB_ASM_MEMORY_MANAGEMENT_H__ -/* These definitions should be placed elsewhere, but I can't find a good place for them. */ -#define LSPGCTL 0x71D80 -#define LSPGCTL_HIGH ((LSPGCTL >> 4) & 0xff00) -#define LSPGCTL_LOW ((LSPGCTL >> 4) & 0xff) - #include #ifdef _ASMLANGUAGE .macro m_ace_lpsram_power_down_entire ax, ay, az, au - movi \au, 8 /* LPSRAM_EBB_QUANTITY */ - movi \az, LSPGCTL_LOW - addmi \az, \az, LSPGCTL_HIGH - slli \az, \az, 4 + /* Retrieve the LPSRAM bank count from the ACE_L2MCAP register */ + movi \az, DT_REG_ADDR(DT_NODELABEL(hsbcap)) + l32i \az, \az, 0 + /* Extract the 4-bit bank count field starting from bit 8 */ + extui \au, \az, 8, 4 + + movi \ay, 1 /* Power down command */ - movi \ay, 1 + /* Get the address of the LPSRAM control register from the Devicetree */ + movi \az, DT_REG_ADDR(DT_NODELABEL(lsbpm)) 2 : + /* Issue the power down command to the current LPSRAM bank */ s8i \ay, \az, 0 memw - 1 : + /* Poll the status register to confirm the power down command has taken effect */ l8ui \ax, \az, 4 bne \ax, \ay, 1b - addi \az, \az, 8 - addi \au, \au, -1 - bnez \au, 2b + /* Move to the next LPSRAM bank control register */ + addi \az, \az, DT_REG_SIZE(DT_NODELABEL(lsbpm)) + addi \au, \au, -1 /* Decrement bank count */ + bnez \au, 2b /* If banks are left, continue loop */ .endm .macro m_ace_hpsram_power_down_entire ax, ay, az, au From f556a760819bbc7d0f6198b82ed58f08fb278cbc Mon Sep 17 00:00:00 2001 From: Damian Nikodem Date: Mon, 16 Sep 2024 10:55:05 +0200 Subject: [PATCH 2480/4482] driver: ssp: Refactor SSP driver to use SSP_IP_VER for version checks This commit updates the SSP driver to use the newly defined SSP_IP_VER macros for IP version checks instead of relying on CONFIG_SOC_* macros. The change ensures better readability and maintainability by centralizing the IP version definitions and comparisons. Signed-off-by: Damian Nikodem --- drivers/dai/intel/ssp/ssp.c | 51 +++++++++++++++++++++---------------- drivers/dai/intel/ssp/ssp.h | 20 ++++++++++++++- 2 files changed, 48 insertions(+), 23 deletions(-) diff --git a/drivers/dai/intel/ssp/ssp.c b/drivers/dai/intel/ssp/ssp.c index 218f3c33162c8..f1b628cbf6dc3 100644 --- a/drivers/dai/intel/ssp/ssp.c +++ b/drivers/dai/intel/ssp/ssp.c @@ -792,7 +792,7 @@ static void dai_ssp_pm_runtime_en_ssp_power(struct dai_intel_ssp *dp, uint32_t s int ret; LOG_INF("SSP%d", ssp_index); -#if CONFIG_SOC_INTEL_ACE15_MTPM || CONFIG_SOC_SERIES_INTEL_ADSP_CAVS +#if SSP_IP_VER < SSP_IP_VER_2_0 sys_write32(sys_read32(dai_ip_base(dp) + I2SLCTL_OFFSET) | I2SLCTL_SPA(ssp_index), dai_ip_base(dp) + I2SLCTL_OFFSET); @@ -800,7 +800,7 @@ static void dai_ssp_pm_runtime_en_ssp_power(struct dai_intel_ssp *dp, uint32_t s ret = dai_ssp_poll_for_register_delay(dai_ip_base(dp) + I2SLCTL_OFFSET, I2SLCTL_CPA(ssp_index), I2SLCTL_CPA(ssp_index), DAI_INTEL_SSP_MAX_SEND_TIME_PER_SAMPLE); -#elif CONFIG_SOC_INTEL_ACE20_LNL || CONFIG_SOC_INTEL_ACE30 +#elif SSP_IP_VER > SSP_IP_VER_1_5 sys_write32(sys_read32(dai_hdamlssp_base(dp) + I2SLCTL_OFFSET) | I2SLCTL_SPA(ssp_index), dai_hdamlssp_base(dp) + I2SLCTL_OFFSET); @@ -826,7 +826,7 @@ static void dai_ssp_pm_runtime_dis_ssp_power(struct dai_intel_ssp *dp, uint32_t int ret; LOG_INF("SSP%d", ssp_index); -#if CONFIG_SOC_INTEL_ACE15_MTPM || CONFIG_SOC_SERIES_INTEL_ADSP_CAVS +#if SSP_IP_VER < SSP_IP_VER_2_0 sys_write32(sys_read32(dai_ip_base(dp) + I2SLCTL_OFFSET) & (~I2SLCTL_SPA(ssp_index)), dai_ip_base(dp) + I2SLCTL_OFFSET); @@ -835,7 +835,7 @@ static void dai_ssp_pm_runtime_dis_ssp_power(struct dai_intel_ssp *dp, uint32_t I2SLCTL_CPA(ssp_index), 0, DAI_INTEL_SSP_MAX_SEND_TIME_PER_SAMPLE); -#elif CONFIG_SOC_INTEL_ACE20_LNL || CONFIG_SOC_INTEL_ACE30 +#elif SSP_IP_VER > SSP_IP_VER_1_5 sys_write32(sys_read32(dai_hdamlssp_base(dp) + I2SLCTL_OFFSET) & (~I2SLCTL_SPA(ssp_index)), dai_hdamlssp_base(dp) + I2SLCTL_OFFSET); @@ -873,7 +873,7 @@ static void dai_ssp_program_channel_map(struct dai_intel_ssp *dp, /* Program HDA input stream parameters */ sys_write16((pcmsycm & 0xffff), reg_add); } -#elif defined(CONFIG_SOC_INTEL_ACE30) +#elif SSP_IP_VER > SSP_IP_VER_2_0 const struct dai_intel_ipc4_ssp_configuration_blob_ver_3_0 *blob30 = spec_config; const struct dai_intel_ipc4_ssp_configuration_blob *blob = spec_config; uint64_t time_slot_map = 0; @@ -930,7 +930,7 @@ static void dai_ssp_empty_tx_fifo(struct dai_intel_ssp *dp) * SSSR_TNF is cleared when TX FIFO is empty or full, * so wait for set TNF then for TFL zero - order matter. */ -#ifdef CONFIG_SOC_INTEL_ACE30 +#if SSP_IP_VER > SSP_IP_VER_2_0 ret = dai_ssp_poll_for_register_delay(dai_base(dp) + SSMODyCS(dp->tdm_slot_group), SSMODyCS_TNF, SSMODyCS_TNF, DAI_INTEL_SSP_MAX_SEND_TIME_PER_SAMPLE); @@ -959,7 +959,7 @@ static void dai_ssp_empty_tx_fifo(struct dai_intel_ssp *dp) } } -#ifdef CONFIG_SOC_INTEL_ACE30 +#if SSP_IP_VER > SSP_IP_VER_2_0 static void ssp_empty_rx_fifo_on_start(struct dai_intel_ssp *dp) { uint32_t retry = DAI_INTEL_SSP_RX_FLUSH_RETRY_MAX; @@ -1162,7 +1162,6 @@ static int dai_ssp_bclk_prepare_enable(struct dai_intel_ssp *dp) struct dai_intel_ssp_plat_data *ssp_plat_data = dai_get_plat_data(dp); uint32_t sscr0; uint32_t mdiv; - bool need_ecs = false; int ret = 0; if (ssp_plat_data->clk_active & SSP_CLK_BCLK_ACTIVE) { @@ -1172,6 +1171,7 @@ static int dai_ssp_bclk_prepare_enable(struct dai_intel_ssp *dp) sscr0 = sys_read32(dai_base(dp) + SSCR0); #if CONFIG_INTEL_MN + bool need_ecs = false; /* BCLK config */ ret = dai_ssp_mn_set_bclk(dp, dp->dai_index, ssp_plat_data->params.bclk_rate, &mdiv, &need_ecs); @@ -1191,10 +1191,12 @@ static int dai_ssp_bclk_prepare_enable(struct dai_intel_ssp *dp) mdiv = ft[DAI_INTEL_SSP_DEFAULT_IDX].freq / ssp_plat_data->params.bclk_rate; #endif -#ifndef CONFIG_SOC_INTEL_ACE30 +#if SSP_IP_VER < CONFIG_SOC_INTEL_ACE30 +#if CONFIG_INTEL_MN if (need_ecs) { sscr0 |= SSCR0_ECS; } +#endif #endif /* clock divisor is SCR + 1 */ @@ -1724,7 +1726,8 @@ static int dai_ssp_set_config_tplg(struct dai_intel_ssp *dp, const struct dai_co sys_write32(sspsp2, dai_base(dp) + SSPSP2); sys_write32(ssioc, dai_base(dp) + SSIOC); sys_write32(ssto, dai_base(dp) + SSTO); -#ifdef CONFIG_SOC_INTEL_ACE30 + +#if SSP_IP_VER > SSP_IP_VER_2_0 for (uint32_t idx = 0; idx < I2SIPCMC; ++idx) { sys_write64(sstsa, dai_base(dp) + SSMODyTSA(idx)); } @@ -1777,7 +1780,8 @@ static int dai_ssp_set_config_tplg(struct dai_intel_ssp *dp, const struct dai_co ssp_plat_data->clk_active |= SSP_CLK_BCLK_ES_REQ; if (enable_sse) { -#ifdef CONFIG_SOC_INTEL_ACE30 + +#if SSP_IP_VER > SSP_IP_VER_2_0 dai_ssp_update_bits(dp, SSMIDyCS(dp->tdm_slot_group), SSMIDyCS_RSRE, SSMIDyCS_RSRE); dai_ssp_update_bits(dp, SSMODyCS(dp->tdm_slot_group), @@ -1806,7 +1810,8 @@ static int dai_ssp_set_config_tplg(struct dai_intel_ssp *dp, const struct dai_co LOG_INF("hw_free stage: releasing BCLK clocks for SSP%d...", dp->dai_index); if (ssp_plat_data->clk_active & SSP_CLK_BCLK_ACTIVE) { -#ifdef CONFIG_SOC_INTEL_ACE30 + +#if SSP_IP_VER > SSP_IP_VER_2_0 for (uint32_t idx = 0; idx < I2SOPCMC; ++idx) { dai_ssp_update_bits(dp, SSMODyCS(idx), SSMODyCS_TSRE, 0); } @@ -1865,7 +1870,7 @@ static int dai_ssp_check_aux_data(struct ssp_intel_aux_tlv *aux_tlv, int aux_len size = sizeof(struct ssp_intel_ext_ctl); break; case SSP_LINK_CLK_SOURCE: -#ifdef CONFIG_SOC_SERIES_INTEL_ADSP_ACE +#if SSP_IP_VER >= SSP_IP_VER_1_5 size = sizeof(struct ssp_intel_link_ctl); break; #else @@ -1931,7 +1936,7 @@ static int dai_ssp_parse_tlv(struct dai_intel_ssp *dp, const uint8_t *aux_ptr, s struct ssp_intel_node_ctl *node; struct ssp_intel_sync_ctl *sync; struct ssp_intel_ext_ctl *ext; -#ifdef CONFIG_SOC_SERIES_INTEL_ADSP_ACE +#if SSP_IP_VER >= SSP_IP_VER_1_5 struct ssp_intel_link_ctl *link; #endif @@ -1978,14 +1983,14 @@ static int dai_ssp_parse_tlv(struct dai_intel_ssp *dp, const uint8_t *aux_ptr, s LOG_INF("ext ext_data %u", ext->ext_data); break; case SSP_LINK_CLK_SOURCE: -#ifdef CONFIG_SOC_SERIES_INTEL_ADSP_ACE +#if SSP_IP_VER >= SSP_IP_VER_1_5 link = (struct ssp_intel_link_ctl *)&aux_tlv->val; -#if CONFIG_SOC_INTEL_ACE15_MTPM +#if SSP_IP_VER < SSP_IP_VER_2_0 sys_write32((sys_read32(dai_ip_base(dp) + I2SLCTL_OFFSET) & ~I2CLCTL_MLCS(0x7)) | I2CLCTL_MLCS(link->clock_source), dai_ip_base(dp) + I2SLCTL_OFFSET); -#elif CONFIG_SOC_INTEL_ACE20_LNL || CONFIG_SOC_INTEL_ACE30 +#elif SSP_IP_VER > SSP_IP_VER_1_5 sys_write32((sys_read32(dai_i2svss_base(dp) + I2SLCTL_OFFSET) & ~I2CLCTL_MLCS(0x7)) | I2CLCTL_MLCS(link->clock_source), @@ -2065,7 +2070,7 @@ static int dai_ssp_set_clock_control_ver_1(struct dai_intel_ssp *dp, return 0; } -#ifdef CONFIG_SOC_INTEL_ACE30 +#if SSP_IP_VER > SSP_IP_VER_2_0 static void dai_ssp_set_reg_config(struct dai_intel_ssp *dp, const struct dai_config *cfg, const void *spec_config) { @@ -2184,7 +2189,7 @@ static int dai_ssp_set_config_blob(struct dai_intel_ssp *dp, const struct dai_co struct dai_intel_ssp_plat_data *ssp_plat_data = dai_get_plat_data(dp); int err; -#ifdef CONFIG_SOC_INTEL_ACE30 +#if SSP_IP_VER > SSP_IP_VER_2_0 dp->tdm_slot_group = cfg->tdm_slot_group; #endif @@ -2322,7 +2327,7 @@ static void dai_ssp_start(struct dai_intel_ssp *dp, int direction) /* enable DMA */ -#if CONFIG_SOC_INTEL_ACE30 +#if SSP_IP_VER > SSP_IP_VER_2_0 if (direction == DAI_DIR_PLAYBACK) { dai_ssp_update_bits(dp, SSMODyCS(dp->tdm_slot_group), SSMODyCS_TSRE, SSMODyCS_TSRE); @@ -2392,7 +2397,8 @@ static void dai_ssp_stop(struct dai_intel_ssp *dp, int direction) if (direction == DAI_DIR_CAPTURE && dp->state[DAI_DIR_CAPTURE] != DAI_STATE_PRE_RUNNING) { LOG_INF("SSP%d RX", dp->dai_index); -#if CONFIG_SOC_INTEL_ACE30 + +#if SSP_IP_VER > SSP_IP_VER_2_0 dai_ssp_update_bits(dp, SSMIDyCS(dp->tdm_slot_group), SSMIDyCS_RXEN, 0); dai_ssp_update_bits(dp, SSMIDyCS(dp->tdm_slot_group), SSMIDyCS_RSRE, 0); #else @@ -2407,7 +2413,8 @@ static void dai_ssp_stop(struct dai_intel_ssp *dp, int direction) if (direction == DAI_DIR_PLAYBACK && dp->state[DAI_DIR_PLAYBACK] != DAI_STATE_PRE_RUNNING) { LOG_INF("SSP%d TX", dp->dai_index); -#if CONFIG_SOC_INTEL_ACE30 + +#if SSP_IP_VER > SSP_IP_VER_2_0 dai_ssp_update_bits(dp, SSMODyCS(dp->tdm_slot_group), SSMODyCS_TSRE, 0); dai_ssp_empty_tx_fifo(dp); dai_ssp_update_bits(dp, SSMODyCS(dp->tdm_slot_group), SSMODyCS_TXEN, 0); diff --git a/drivers/dai/intel/ssp/ssp.h b/drivers/dai/intel/ssp/ssp.h index 5d1c294372445..baf4d02e2d617 100644 --- a/drivers/dai/intel/ssp/ssp.h +++ b/drivers/dai/intel/ssp/ssp.h @@ -7,6 +7,24 @@ #ifndef __INTEL_DAI_DRIVER_SSP_H__ #define __INTEL_DAI_DRIVER_SSP_H__ +#define SSP_IP_VER_1_0 0x10000 /* cAVS */ +#define SSP_IP_VER_1_5 0x10500 /* ACE15 */ +#define SSP_IP_VER_2_0 0x20000 /* ACE20 */ +#define SSP_IP_VER_3_0 0x30000 /* ACE30 */ + +/* SSP IP version defined by CONFIG_SOC*/ +#if defined(CONFIG_SOC_SERIES_INTEL_ADSP_CAVS) +#define SSP_IP_VER SSP_IP_VER_1_0 +#elif defined(CONFIG_SOC_INTEL_ACE15_MTPM) +#define SSP_IP_VER SSP_IP_VER_1_5 +#elif defined(CONFIG_SOC_INTEL_ACE20_LNL) +#define SSP_IP_VER SSP_IP_VER_2_0 +#elif defined(CONFIG_SOC_INTEL_ACE30) +#define SSP_IP_VER SSP_IP_VER_3_0 +#else +#error "Unknown SSP IP" +#endif + #include #include #include "dai-params-intel-ipc3.h" @@ -116,7 +134,7 @@ struct dai_intel_ssp_plat_data { uint32_t base; uint32_t ip_base; uint32_t shim_base; -#if defined(CONFIG_SOC_INTEL_ACE20_LNL) || defined(CONFIG_SOC_INTEL_ACE30) +#if SSP_IP_VER > SSP_IP_VER_1_5 uint32_t hdamlssp_base; uint32_t i2svss_base; #endif From 8f14d08bf5a16ebf18fcb0638ef11f95dc8410d1 Mon Sep 17 00:00:00 2001 From: Piotr Zierhoffer Date: Mon, 16 Sep 2024 14:53:03 +0200 Subject: [PATCH 2481/4482] x86: Divide Intel Atom CPU compatible to x86 and x86_64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit atom.dtsi enforces "intel,x86", but it doesn't help us discern if the platform is 32 or 64-bit. We do that for example in RISC-V and it's useful from the tooling perspective. Signed-off-by: Piotr Zierhoffer Signed-off-by: Mateusz Hołenko --- boards/acrn/acrn/acrn.dts | 4 ++++ boards/qemu/x86/qemu_x86.dts | 4 ++++ boards/qemu/x86/qemu_x86_64.dts | 6 +++++- boards/qemu/x86/qemu_x86_64_atom_nokpti.dts | 6 +++++- dts/x86/intel/atom.dtsi | 3 +-- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/boards/acrn/acrn/acrn.dts b/boards/acrn/acrn/acrn.dts index dbd30373e34be..8d7376daf706f 100644 --- a/boards/acrn/acrn/acrn.dts +++ b/boards/acrn/acrn/acrn.dts @@ -46,3 +46,7 @@ status = "okay"; current-speed = <115200>; }; + +&cpu { + compatible = "intel,x86_64"; +}; diff --git a/boards/qemu/x86/qemu_x86.dts b/boards/qemu/x86/qemu_x86.dts index 907e8a1ec1cb7..e26bf00057f23 100644 --- a/boards/qemu/x86/qemu_x86.dts +++ b/boards/qemu/x86/qemu_x86.dts @@ -166,3 +166,7 @@ }; }; }; + +&cpu { + compatible = "intel,x86"; +}; diff --git a/boards/qemu/x86/qemu_x86_64.dts b/boards/qemu/x86/qemu_x86_64.dts index fc2521047735f..64d33dca69acb 100644 --- a/boards/qemu/x86/qemu_x86_64.dts +++ b/boards/qemu/x86/qemu_x86_64.dts @@ -9,7 +9,7 @@ cpus { cpu@1 { device_type = "cpu"; - compatible = "intel,x86"; + compatible = "intel,x86_64"; d-cache-line-size = <64>; reg = <1>; }; @@ -29,3 +29,7 @@ status = "okay"; }; }; + +&cpu { + compatible = "intel,x86_64"; +}; diff --git a/boards/qemu/x86/qemu_x86_64_atom_nokpti.dts b/boards/qemu/x86/qemu_x86_64_atom_nokpti.dts index 8a5f2d5115458..692f9f1e88061 100644 --- a/boards/qemu/x86/qemu_x86_64_atom_nokpti.dts +++ b/boards/qemu/x86/qemu_x86_64_atom_nokpti.dts @@ -9,9 +9,13 @@ cpus { cpu@1 { device_type = "cpu"; - compatible = "intel,x86"; + compatible = "intel,x86_64"; d-cache-line-size = <64>; reg = <1>; }; }; }; + +&cpu { + compatible = "intel,x86_64"; +}; diff --git a/dts/x86/intel/atom.dtsi b/dts/x86/intel/atom.dtsi index 9d1715aa84081..f5a815766c116 100644 --- a/dts/x86/intel/atom.dtsi +++ b/dts/x86/intel/atom.dtsi @@ -12,9 +12,8 @@ #address-cells = <1>; #size-cells = <0>; - cpu@0 { + cpu: cpu@0 { device_type = "cpu"; - compatible = "intel,x86"; d-cache-line-size = <64>; reg = <0>; }; From 12a27f31a16f9f3f2229346c7d2e656cdc68e1c9 Mon Sep 17 00:00:00 2001 From: Piotr Zierhoffer Date: Mon, 16 Sep 2024 14:55:10 +0200 Subject: [PATCH 2482/4482] intel: Explicitly set x86 compat in intel_ish5 and lakemont MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Those dtsi are a base for a range of 32-bit platforms. Setting this compatible makes it easier to distinguish all 32-bit x86 platforms. Signed-off-by: Piotr Zierhoffer Signed-off-by: Mateusz Hołenko y --- dts/x86/intel/intel_ish5.dtsi | 2 +- dts/x86/intel/lakemont.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dts/x86/intel/intel_ish5.dtsi b/dts/x86/intel/intel_ish5.dtsi index 545879b3e09a8..0aac6fdf39469 100644 --- a/dts/x86/intel/intel_ish5.dtsi +++ b/dts/x86/intel/intel_ish5.dtsi @@ -39,7 +39,7 @@ cpu0: cpu0@0 { device_type = "cpu"; - compatible = "intel,ish"; + compatible = "intel,ish", "intel,x86"; reg = <0>; cpu-power-states = <&d0i0 &d0i2 &d0i3>; }; diff --git a/dts/x86/intel/lakemont.dtsi b/dts/x86/intel/lakemont.dtsi index 23e3f95b34b91..39cb922039a5e 100644 --- a/dts/x86/intel/lakemont.dtsi +++ b/dts/x86/intel/lakemont.dtsi @@ -14,7 +14,7 @@ cpu@0 { device_type = "cpu"; - compatible = "intel,lakemont"; + compatible = "intel,lakemont", "intel,x86"; d-cache-line-size = <64>; reg = <0>; }; From b05136fc067cf58b1fba5494587ee717d809bcd4 Mon Sep 17 00:00:00 2001 From: Piotr Zierhoffer Date: Mon, 16 Sep 2024 15:03:27 +0200 Subject: [PATCH 2483/4482] x86: Add intel,x86_64 compat to all x86-64 platforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will help distinguish 64 and 32-bit platforms by tooling, following the pattern visible in e.g. RISC-V. Signed-off-by: Piotr Zierhoffer Signed-off-by: Mateusz Hołenko --- boards/intel/adl/intel_adl.dts | 4 ++++ boards/up-bridge-the-gap/up_squared/up_squared.dts | 4 ++-- dts/x86/intel/alder_lake.dtsi | 4 ++-- dts/x86/intel/apollo_lake.dtsi | 2 +- dts/x86/intel/elkhart_lake.dtsi | 2 +- dts/x86/intel/raptor_lake_p.dtsi | 2 +- dts/x86/intel/raptor_lake_s.dtsi | 2 +- 7 files changed, 12 insertions(+), 8 deletions(-) diff --git a/boards/intel/adl/intel_adl.dts b/boards/intel/adl/intel_adl.dts index 16dfb20a55664..10b37802aeb72 100644 --- a/boards/intel/adl/intel_adl.dts +++ b/boards/intel/adl/intel_adl.dts @@ -22,3 +22,7 @@ sdhc0 = &emmc; }; }; + +&cpu { + compatible = "intel,x86_64"; +}; diff --git a/boards/up-bridge-the-gap/up_squared/up_squared.dts b/boards/up-bridge-the-gap/up_squared/up_squared.dts index 2e8e763115f60..24818e9893055 100644 --- a/boards/up-bridge-the-gap/up_squared/up_squared.dts +++ b/boards/up-bridge-the-gap/up_squared/up_squared.dts @@ -36,14 +36,14 @@ cpu@0 { device_type = "cpu"; - compatible = "intel,apollo-lake"; + compatible = "intel,apollo-lake", "intel,x86_64"; d-cache-line-size = <64>; reg = <0>; }; cpu@1 { device_type = "cpu"; - compatible = "intel,apollo-lake"; + compatible = "intel,apollo-lake", "intel,x86_64"; d-cache-line-size = <64>; reg = <1>; }; diff --git a/dts/x86/intel/alder_lake.dtsi b/dts/x86/intel/alder_lake.dtsi index b205df4858915..6f33e2a44d1bd 100644 --- a/dts/x86/intel/alder_lake.dtsi +++ b/dts/x86/intel/alder_lake.dtsi @@ -16,9 +16,9 @@ #address-cells = <1>; #size-cells = <0>; - cpu@0 { + cpu: cpu@0 { device_type = "cpu"; - compatible = "intel,alder-lake"; + compatible = "intel,alder-lake", "intel,x86_64"; d-cache-line-size = <64>; reg = <0>; }; diff --git a/dts/x86/intel/apollo_lake.dtsi b/dts/x86/intel/apollo_lake.dtsi index a439feea175e9..5920decfc4d9e 100644 --- a/dts/x86/intel/apollo_lake.dtsi +++ b/dts/x86/intel/apollo_lake.dtsi @@ -16,7 +16,7 @@ cpu@0 { device_type = "cpu"; - compatible = "intel,apollo-lake"; + compatible = "intel,apollo-lake", "intel,x86_64"; d-cache-line-size = <64>; reg = <0>; }; diff --git a/dts/x86/intel/elkhart_lake.dtsi b/dts/x86/intel/elkhart_lake.dtsi index 828db51d28b0b..43a7806a8ec20 100644 --- a/dts/x86/intel/elkhart_lake.dtsi +++ b/dts/x86/intel/elkhart_lake.dtsi @@ -16,7 +16,7 @@ cpu@0 { device_type = "cpu"; - compatible = "intel,elkhart-lake"; + compatible = "intel,elkhart-lake", "intel,x86_64"; d-cache-line-size = <64>; reg = <0>; }; diff --git a/dts/x86/intel/raptor_lake_p.dtsi b/dts/x86/intel/raptor_lake_p.dtsi index 1c6de091d2f28..2f3c4bfa61044 100644 --- a/dts/x86/intel/raptor_lake_p.dtsi +++ b/dts/x86/intel/raptor_lake_p.dtsi @@ -15,7 +15,7 @@ #size-cells = <0>; cpu@0 { - compatible = "intel,raptor-lake"; + compatible = "intel,raptor-lake", "intel,x86_64"; device_type = "cpu"; d-cache-line-size = <64>; reg = <0>; diff --git a/dts/x86/intel/raptor_lake_s.dtsi b/dts/x86/intel/raptor_lake_s.dtsi index 0e55b60a0b3cd..96b59a019c061 100644 --- a/dts/x86/intel/raptor_lake_s.dtsi +++ b/dts/x86/intel/raptor_lake_s.dtsi @@ -16,7 +16,7 @@ cpu@0 { device_type = "cpu"; - compatible = "intel,raptor-lake"; + compatible = "intel,raptor-lake", "intel,x86_64"; d-cache-line-size = <64>; reg = <0>; }; From cc0796ab868876386891192e31035906ee8b99ea Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Wed, 30 Oct 2024 22:26:58 +0800 Subject: [PATCH 2484/4482] soc: andestech: soc_per_core_init_hook() shouldn't return value The `soc_per_core_init_hook()` function now has `void` type after da118b9, so it should just return without any value. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- soc/andestech/ae350/pma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/andestech/ae350/pma.c b/soc/andestech/ae350/pma.c index 71da2248b728b..7e1e07111adf4 100644 --- a/soc/andestech/ae350/pma.c +++ b/soc/andestech/ae350/pma.c @@ -216,7 +216,7 @@ void soc_early_init_hook(void) LOG_ERR("CPU doesn't support PMA. " "Please disable CONFIG_SOC_ANDES_V5_PMA"); #endif - return -ENODEV; + return; } pma_init_per_core(); From de347a4e07ac6c2cc6383f516ad765323baf1761 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Wed, 30 Oct 2024 22:19:51 +0800 Subject: [PATCH 2485/4482] init: support per-core init hook Allow SoC to implement their custom per-core initialization function by selecting `CONFIG_SOC_PER_CORE_INIT_HOOK` and implement `soc_per_core_init_hook()`. Signed-off-by: Maxim Adelman Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- arch/arc/core/smp.c | 6 ++++++ arch/arc/include/kernel_arch_func.h | 6 ++++++ arch/arm/core/cortex_a_r/smp.c | 5 +++++ arch/arm/include/cortex_a_r/kernel_arch_func.h | 5 +++++ arch/arm/include/cortex_m/kernel_arch_func.h | 6 ++++++ arch/arm64/core/smp.c | 5 +++++ arch/arm64/include/kernel_arch_func.h | 6 ++++++ arch/mips/include/kernel_arch_func.h | 5 +++++ arch/nios2/include/kernel_arch_func.h | 5 +++++ arch/posix/include/kernel_arch_func.h | 6 +++++- arch/riscv/core/smp.c | 4 ++++ arch/riscv/include/kernel_arch_func.h | 5 +++++ arch/sparc/include/kernel_arch_func.h | 5 +++++ arch/x86/include/ia32/kernel_arch_func.h | 6 +++++- arch/x86/include/intel64/kernel_arch_func.h | 6 +++++- arch/xtensa/include/kernel_arch_func.h | 5 ++++- include/zephyr/platform/hooks.h | 8 ++++++++ kernel/Kconfig.init | 9 +++++++++ 18 files changed, 99 insertions(+), 4 deletions(-) diff --git a/arch/arc/core/smp.c b/arch/arc/core/smp.c index e8463b7b53b35..1b06c2ac7d111 100644 --- a/arch/arc/core/smp.c +++ b/arch/arc/core/smp.c @@ -16,6 +16,7 @@ #include #include #include +#include #include volatile struct { @@ -115,6 +116,11 @@ void arch_secondary_cpu_init(int cpu_num) DT_IRQ(DT_NODELABEL(ici), priority), 0); irq_enable(DT_IRQN(DT_NODELABEL(ici))); #endif + +#ifdef CONFIG_SOC_PER_CORE_INIT_HOOK + soc_per_core_init_hook(); +#endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */ + /* call the function set by arch_cpu_start */ fn = arc_cpu_init[cpu_num].fn; diff --git a/arch/arc/include/kernel_arch_func.h b/arch/arc/include/kernel_arch_func.h index ca382a274f4b1..73bd352a24980 100644 --- a/arch/arc/include/kernel_arch_func.h +++ b/arch/arc/include/kernel_arch_func.h @@ -26,6 +26,8 @@ #include +#include + #ifdef __cplusplus extern "C" { #endif @@ -33,6 +35,10 @@ extern "C" { static ALWAYS_INLINE void arch_kernel_init(void) { z_irq_setup(); + +#ifdef CONFIG_SOC_PER_CORE_INIT_HOOK + soc_per_core_init_hook(); +#endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */ } diff --git a/arch/arm/core/cortex_a_r/smp.c b/arch/arm/core/cortex_a_r/smp.c index df9d0a686df53..d0e31acb1ed83 100644 --- a/arch/arm/core/cortex_a_r/smp.c +++ b/arch/arm/core/cortex_a_r/smp.c @@ -12,6 +12,7 @@ #include "zephyr/cache.h" #include "zephyr/kernel/thread_stack.h" #include "zephyr/toolchain/gcc.h" +#include #define INV_MPID UINT32_MAX @@ -198,6 +199,10 @@ void arch_secondary_cpu_init(void) */ #endif +#ifdef CONFIG_SOC_PER_CORE_INIT_HOOK + soc_per_core_init_hook(); +#endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */ + fn = arm_cpu_boot_params.fn; arg = arm_cpu_boot_params.arg; barrier_dsync_fence_full(); diff --git a/arch/arm/include/cortex_a_r/kernel_arch_func.h b/arch/arm/include/cortex_a_r/kernel_arch_func.h index 3486d7d4d4e02..ecd467f3c91eb 100644 --- a/arch/arm/include/cortex_a_r/kernel_arch_func.h +++ b/arch/arm/include/cortex_a_r/kernel_arch_func.h @@ -20,6 +20,8 @@ #ifndef ZEPHYR_ARCH_ARM_INCLUDE_CORTEX_A_R_KERNEL_ARCH_FUNC_H_ #define ZEPHYR_ARCH_ARM_INCLUDE_CORTEX_A_R_KERNEL_ARCH_FUNC_H_ +#include + #ifdef __cplusplus extern "C" { #endif @@ -28,6 +30,9 @@ extern "C" { static ALWAYS_INLINE void arch_kernel_init(void) { +#ifdef CONFIG_SOC_PER_CORE_INIT_HOOK + soc_per_core_init_hook(); +#endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */ } #ifndef CONFIG_USE_SWITCH diff --git a/arch/arm/include/cortex_m/kernel_arch_func.h b/arch/arm/include/cortex_m/kernel_arch_func.h index 132c056c91022..bb79e3941066d 100644 --- a/arch/arm/include/cortex_m/kernel_arch_func.h +++ b/arch/arm/include/cortex_m/kernel_arch_func.h @@ -20,6 +20,8 @@ #ifndef ZEPHYR_ARCH_ARM_INCLUDE_CORTEX_M_KERNEL_ARCH_FUNC_H_ #define ZEPHYR_ARCH_ARM_INCLUDE_CORTEX_M_KERNEL_ARCH_FUNC_H_ +#include + #ifdef __cplusplus extern "C" { #endif @@ -53,6 +55,10 @@ static ALWAYS_INLINE void arch_kernel_init(void) */ z_arm_configure_static_mpu_regions(); #endif /* CONFIG_ARM_MPU */ + +#ifdef CONFIG_SOC_PER_CORE_INIT_HOOK + soc_per_core_init_hook(); +#endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */ } static ALWAYS_INLINE void diff --git a/arch/arm64/core/smp.c b/arch/arm64/core/smp.c index bbb7f9634317d..fd9d457ea7df5 100644 --- a/arch/arm64/core/smp.c +++ b/arch/arm64/core/smp.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include "boot.h" @@ -163,6 +164,10 @@ void arch_secondary_cpu_init(int cpu_num) #endif #endif +#ifdef CONFIG_SOC_PER_CORE_INIT_HOOK + soc_per_core_init_hook(); +#endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */ + fn = arm64_cpu_boot_params.fn; arg = arm64_cpu_boot_params.arg; barrier_dsync_fence_full(); diff --git a/arch/arm64/include/kernel_arch_func.h b/arch/arm64/include/kernel_arch_func.h index d2c346be1f02c..c37ea6257a50d 100644 --- a/arch/arm64/include/kernel_arch_func.h +++ b/arch/arm64/include/kernel_arch_func.h @@ -22,6 +22,8 @@ #include +#include + #ifdef __cplusplus extern "C" { #endif @@ -35,6 +37,10 @@ static ALWAYS_INLINE void arch_kernel_init(void) #ifdef CONFIG_XEN xen_enlighten_init(); #endif + +#ifdef CONFIG_SOC_PER_CORE_INIT_HOOK + soc_per_core_init_hook(); +#endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */ } static inline void arch_switch(void *switch_to, void **switched_from) diff --git a/arch/mips/include/kernel_arch_func.h b/arch/mips/include/kernel_arch_func.h index b01cc1a4c65da..7c35d1bf864a3 100644 --- a/arch/mips/include/kernel_arch_func.h +++ b/arch/mips/include/kernel_arch_func.h @@ -19,6 +19,8 @@ #include +#include + #ifdef __cplusplus extern "C" { #endif @@ -26,6 +28,9 @@ extern "C" { #ifndef _ASMLANGUAGE static ALWAYS_INLINE void arch_kernel_init(void) { +#ifdef CONFIG_SOC_PER_CORE_INIT_HOOK + soc_per_core_init_hook(); +#endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */ } static ALWAYS_INLINE void diff --git a/arch/nios2/include/kernel_arch_func.h b/arch/nios2/include/kernel_arch_func.h index 2df268a1c6245..464ba32a7a738 100644 --- a/arch/nios2/include/kernel_arch_func.h +++ b/arch/nios2/include/kernel_arch_func.h @@ -22,6 +22,8 @@ #include +#include + #ifdef __cplusplus extern "C" { #endif @@ -30,6 +32,9 @@ extern "C" { static ALWAYS_INLINE void arch_kernel_init(void) { +#ifdef CONFIG_SOC_PER_CORE_INIT_HOOK + soc_per_core_init_hook(); +#endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */ } static ALWAYS_INLINE void diff --git a/arch/posix/include/kernel_arch_func.h b/arch/posix/include/kernel_arch_func.h index bb8d36a089c62..98289d5d7c68a 100644 --- a/arch/posix/include/kernel_arch_func.h +++ b/arch/posix/include/kernel_arch_func.h @@ -12,6 +12,8 @@ #include +#include + #ifndef _ASMLANGUAGE #ifdef __cplusplus @@ -20,7 +22,9 @@ extern "C" { static inline void arch_kernel_init(void) { - /* Nothing to be done */ +#ifdef CONFIG_SOC_PER_CORE_INIT_HOOK + soc_per_core_init_hook(); +#endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */ } static ALWAYS_INLINE void diff --git a/arch/riscv/core/smp.c b/arch/riscv/core/smp.c index 3e8b3df21937e..8607215cab346 100644 --- a/arch/riscv/core/smp.c +++ b/arch/riscv/core/smp.c @@ -11,6 +11,7 @@ #include #include #include +#include volatile struct { arch_cpustart_t fn; @@ -78,5 +79,8 @@ void arch_secondary_cpu_init(int hartid) /* Enable on secondary cores so that they can respond to PLIC */ irq_enable(RISCV_IRQ_MEXT); #endif /* CONFIG_PLIC_IRQ_AFFINITY */ +#ifdef CONFIG_SOC_PER_CORE_INIT_HOOK + soc_per_core_init_hook(); +#endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */ riscv_cpu_init[cpu_num].fn(riscv_cpu_init[cpu_num].arg); } diff --git a/arch/riscv/include/kernel_arch_func.h b/arch/riscv/include/kernel_arch_func.h index c5ed6ff3f7f42..a8fc863c75d06 100644 --- a/arch/riscv/include/kernel_arch_func.h +++ b/arch/riscv/include/kernel_arch_func.h @@ -18,6 +18,8 @@ #include #include +#include + #ifdef __cplusplus extern "C" { #endif @@ -53,6 +55,9 @@ static ALWAYS_INLINE void arch_kernel_init(void) #ifdef CONFIG_RISCV_PMP z_riscv_pmp_init(); #endif +#ifdef CONFIG_SOC_PER_CORE_INIT_HOOK + soc_per_core_init_hook(); +#endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */ } static ALWAYS_INLINE void diff --git a/arch/sparc/include/kernel_arch_func.h b/arch/sparc/include/kernel_arch_func.h index 8b79b130ad655..fc59fdf7aa69e 100644 --- a/arch/sparc/include/kernel_arch_func.h +++ b/arch/sparc/include/kernel_arch_func.h @@ -17,6 +17,8 @@ #include +#include + #ifdef __cplusplus extern "C" { #endif @@ -24,6 +26,9 @@ extern "C" { #ifndef _ASMLANGUAGE static ALWAYS_INLINE void arch_kernel_init(void) { +#ifdef CONFIG_SOC_PER_CORE_INIT_HOOK + soc_per_core_init_hook(); +#endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */ } void z_sparc_context_switch(struct k_thread *newt, struct k_thread *oldt); diff --git a/arch/x86/include/ia32/kernel_arch_func.h b/arch/x86/include/ia32/kernel_arch_func.h index a0521fca3da79..878281c7ba896 100644 --- a/arch/x86/include/ia32/kernel_arch_func.h +++ b/arch/x86/include/ia32/kernel_arch_func.h @@ -14,13 +14,17 @@ #include /* For size_t */ +#include + #ifdef __cplusplus extern "C" { #endif static inline void arch_kernel_init(void) { - /* No-op on this arch */ +#ifdef CONFIG_SOC_PER_CORE_INIT_HOOK + soc_per_core_init_hook(); +#endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */ } static ALWAYS_INLINE void diff --git a/arch/x86/include/intel64/kernel_arch_func.h b/arch/x86/include/intel64/kernel_arch_func.h index abf022fe5fd55..da553fd08ac72 100644 --- a/arch/x86/include/intel64/kernel_arch_func.h +++ b/arch/x86/include/intel64/kernel_arch_func.h @@ -8,6 +8,8 @@ #include +#include + #ifndef _ASMLANGUAGE extern void z_x86_switch(void *switch_to, void **switched_from); @@ -27,7 +29,9 @@ extern void z_x86_ipi_setup(void); static inline void arch_kernel_init(void) { - /* nothing */; +#ifdef CONFIG_SOC_PER_CORE_INIT_HOOK + soc_per_core_init_hook(); +#endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */ } FUNC_NORETURN void z_x86_cpu_init(struct x86_cpuboot *cpuboot); diff --git a/arch/xtensa/include/kernel_arch_func.h b/arch/xtensa/include/kernel_arch_func.h index c422494ee2b36..5e735dedffff7 100644 --- a/arch/xtensa/include/kernel_arch_func.h +++ b/arch/xtensa/include/kernel_arch_func.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #ifdef __cplusplus @@ -25,7 +26,9 @@ K_KERNEL_STACK_ARRAY_DECLARE(z_interrupt_stacks, CONFIG_MP_MAX_NUM_CPUS, static ALWAYS_INLINE void arch_kernel_init(void) { - +#ifdef CONFIG_SOC_PER_CORE_INIT_HOOK + soc_per_core_init_hook(); +#endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */ } void xtensa_switch(void *switch_to, void **switched_from); diff --git a/include/zephyr/platform/hooks.h b/include/zephyr/platform/hooks.h index 765b886a63803..d310b0c37ca47 100644 --- a/include/zephyr/platform/hooks.h +++ b/include/zephyr/platform/hooks.h @@ -53,6 +53,14 @@ void soc_early_init_hook(void); */ void soc_late_init_hook(void); +/** + * @brief SoC per-core initialization + * + * This hook is implemented by the SoC and can be used to perform any + * SoC-specific per-core initialization + */ +void soc_per_core_init_hook(void); + /* * @brief Board hook executed before the kernel starts. * diff --git a/kernel/Kconfig.init b/kernel/Kconfig.init index 21cb5d9d8f120..495381638fb08 100644 --- a/kernel/Kconfig.init +++ b/kernel/Kconfig.init @@ -38,6 +38,15 @@ config SOC_LATE_INIT_HOOK A custom SoC hook soc_late_init_hook() is executed after the kernel and devices are initialized +config SOC_PER_CORE_INIT_HOOK + bool "Run SoC per-core initialization hook" + help + Run an SoC initialization hook for every core + + A custom SoC hook soc_per_core_init_hook() is executeds at the end of + arch_kernel_init() for the primary core, and at the end of arch_secondary_cpu_init() + for secondary cores. + config BOARD_EARLY_INIT_HOOK bool "Run early board hook" help From 01b69e9c22ea7b9ce55a6f5a15a6ac6b25453759 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Wed, 30 Oct 2024 22:42:27 +0800 Subject: [PATCH 2486/4482] soc: andestech: run pma_init_per_core() with soc_per_core_init_hook() The function `pma_init_per_core()`, as its name suggest, should be run from every core, so call it from `soc_per_core_init_hook()` Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- soc/andestech/ae350/CMakeLists.txt | 1 + soc/andestech/ae350/Kconfig | 1 + soc/andestech/ae350/pma.c | 9 --------- soc/andestech/ae350/pma.h | 15 +++++++++++++++ soc/andestech/ae350/soc.c | 16 ++++++++++++++++ 5 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 soc/andestech/ae350/pma.h create mode 100644 soc/andestech/ae350/soc.c diff --git a/soc/andestech/ae350/CMakeLists.txt b/soc/andestech/ae350/CMakeLists.txt index 583134a91ce2d..a7dfd256f8783 100644 --- a/soc/andestech/ae350/CMakeLists.txt +++ b/soc/andestech/ae350/CMakeLists.txt @@ -3,6 +3,7 @@ zephyr_include_directories(.) zephyr_sources( + soc.c start.S soc_irq.S ) diff --git a/soc/andestech/ae350/Kconfig b/soc/andestech/ae350/Kconfig index 4d466048e847c..d82c22e3819d3 100644 --- a/soc/andestech/ae350/Kconfig +++ b/soc/andestech/ae350/Kconfig @@ -92,6 +92,7 @@ config SOC_ANDES_V5_PMA bool "Andes V5 Physical Memory Attribute (PMA)" select ARCH_HAS_NOCACHE_MEMORY_SUPPORT select SOC_EARLY_INIT_HOOK + select SOC_PER_CORE_INIT_HOOK help This option enables the Andes V5 PMA, in order to support SW to configure physical memory attribute by PMA CSRs. The address diff --git a/soc/andestech/ae350/pma.c b/soc/andestech/ae350/pma.c index 7e1e07111adf4..d880e7130973c 100644 --- a/soc/andestech/ae350/pma.c +++ b/soc/andestech/ae350/pma.c @@ -187,13 +187,6 @@ static void configure_nocache_region(void) } #endif /* CONFIG_NOCACHE_MEMORY */ -/* - * @brief Init PMA CSRs of each CPU core - * - * In SMP, each CPU has it's own PMA CSR and PMA CSR only affect one CPU. - * We should configure CSRs of all CPUs to make memory attribute - * (e.g. uncacheable) affects all CPUs. - */ void pma_init_per_core(void) { #ifdef CONFIG_NOCACHE_MEMORY @@ -218,6 +211,4 @@ void soc_early_init_hook(void) #endif return; } - - pma_init_per_core(); } diff --git a/soc/andestech/ae350/pma.h b/soc/andestech/ae350/pma.h new file mode 100644 index 0000000000000..9f6db1c655c7d --- /dev/null +++ b/soc/andestech/ae350/pma.h @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2021 Andes Technology Corporation + * Copyright (c) 2024 Meta Platforms + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * @brief Init PMA CSRs of each CPU core + * + * In SMP, each CPU has it's own PMA CSR and PMA CSR only affect one CPU. + * We should configure CSRs of all CPUs to make memory attribute + * (e.g. uncacheable) affects all CPUs. + */ +void pma_init_per_core(void); diff --git a/soc/andestech/ae350/soc.c b/soc/andestech/ae350/soc.c new file mode 100644 index 0000000000000..2decfe4082651 --- /dev/null +++ b/soc/andestech/ae350/soc.c @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2024 Meta Platforms + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "pma.h" + +#ifdef CONFIG_SOC_PER_CORE_INIT_HOOK +void soc_per_core_init_hook(void) +{ +#ifdef CONFIG_SOC_ANDES_V5_PMA + pma_init_per_core(); +#endif /* SOC_ANDES_V5_PMA */ +} +#endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */ From ad7f3a9a0c559e461f0e3c06ffc0a01b05820512 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Fri, 1 Nov 2024 14:13:29 +0800 Subject: [PATCH 2487/4482] soc: andestech: refactor out soc_early_init_hook() from pma.c Refactor out the `soc_early_init_hook()` function from `pma.c` to `soc.c` which is always compiled so that it can be extended to run other init functions easily in the future. Then, restore the function in `pma.c` to `pma_init()`. Signed-off-by: Yong Cong Sin --- soc/andestech/ae350/pma.c | 2 +- soc/andestech/ae350/pma.h | 3 +++ soc/andestech/ae350/soc.c | 9 +++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/soc/andestech/ae350/pma.c b/soc/andestech/ae350/pma.c index d880e7130973c..326bdf372b9bf 100644 --- a/soc/andestech/ae350/pma.c +++ b/soc/andestech/ae350/pma.c @@ -194,7 +194,7 @@ void pma_init_per_core(void) #endif /* CONFIG_NOCACHE_MEMORY */ } -void soc_early_init_hook(void) +void pma_init(void) { unsigned long mmsc_cfg; diff --git a/soc/andestech/ae350/pma.h b/soc/andestech/ae350/pma.h index 9f6db1c655c7d..459db7c98d946 100644 --- a/soc/andestech/ae350/pma.h +++ b/soc/andestech/ae350/pma.h @@ -13,3 +13,6 @@ * (e.g. uncacheable) affects all CPUs. */ void pma_init_per_core(void); + +/* Initialize PMA */ +void pma_init(void); diff --git a/soc/andestech/ae350/soc.c b/soc/andestech/ae350/soc.c index 2decfe4082651..852da6d811342 100644 --- a/soc/andestech/ae350/soc.c +++ b/soc/andestech/ae350/soc.c @@ -14,3 +14,12 @@ void soc_per_core_init_hook(void) #endif /* SOC_ANDES_V5_PMA */ } #endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */ + +#ifdef CONFIG_SOC_EARLY_INIT_HOOK +void soc_early_init_hook(void) +{ +#ifdef CONFIG_SOC_ANDES_V5_PMA + pma_init(); +#endif /* CONFIG_SOC_ANDES_V5_PMA */ +} +#endif /* CONFIG_SOC_EARLY_INIT_HOOK */ From 0efbca30a5d1d24816f461da113479e6465d3914 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 7 Nov 2024 13:31:56 +0100 Subject: [PATCH 2488/4482] manifest: Update nRF hw models to latest Update the HW models module to: aeef3db9fa9e4b9d12b3bbec44f9cedc8fcb7d9c Including the following: aeef3db GPIO & GPIOTE: Improve notes and documentation 93549c4 UART: Fix command line parameter description dbab746 nrf_hack: Add a few missing peripherals 4b1a61b 53 UARTE: Correct subscribe sideeffects function name 197e9cf docs: UART can be used now for 5340 in Zephyr dc18d14 53: GPIO+TE: Add app core instances b236c08 GPIO+TE: Add to 5340's netcore 7a621f6 GPIO: Clarify function description 1a2e1e4 GPIO+TE: Build for 54L d121db4 nrf_gpio hal: Add new nrf_gpio_port_pin_{in,out}put_set 9bc41ce GPIOTE: Connect to DPPI 7141042 GPIOTE: Add simple support for PORT.SECURE & NONSECURE dc930ba GPIOTE: Support having or not sense functionality per instance a07180d GPIO: Support multiple GPIOTEs 14bdce5 GPIO: Collect status in single struct b91da53 GPIOTE: Add support for N interrupt lines 9963424 GPIO & GPIOTE: Generalize to N instances 7379c23 GPIO+TE: Fix indentation 8d691c6 Add SPU registers stub dd68ca9 Add NFCT register stub cf2cc5b HW_models: NHW_NVMC: fix buffer read validation f3db727 zephyr: module.yml: add `depends` field 09fc98f CMakeLists: remove trailing whitespace Signed-off-by: Alberto Escolar Piedras --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 924a95c647027..100234bda0620 100644 --- a/west.yml +++ b/west.yml @@ -300,7 +300,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: aca798cf7cf0c5dc1fd89c66cf62670051feb8d0 + revision: aeef3db9fa9e4b9d12b3bbec44f9cedc8fcb7d9c path: modules/bsim_hw_models/nrf_hw_models - name: open-amp revision: b735edbc739ad59156eb55bb8ce2583d74537719 From 4b890bc7b570da76dd99f2d6786969ee330eed88 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 4 Nov 2024 18:12:51 +0100 Subject: [PATCH 2489/4482] boards nrfbsim: Enable GPIO & GPIOTE peripherals for nrf54l15bsim The HW models now support these pheripherals, let's enable them Signed-off-by: Alberto Escolar Piedras --- .../nrf_bsim/nrf54l15bsim_nrf54l15_cpuapp.dts | 26 +++++++++++++++---- .../nrf54l15bsim_nrf54l15_cpuapp.yaml | 2 +- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/boards/native/nrf_bsim/nrf54l15bsim_nrf54l15_cpuapp.dts b/boards/native/nrf_bsim/nrf54l15bsim_nrf54l15_cpuapp.dts index cd8b95be6645c..fbfe0f0dc6512 100644 --- a/boards/native/nrf_bsim/nrf54l15bsim_nrf54l15_cpuapp.dts +++ b/boards/native/nrf_bsim/nrf54l15bsim_nrf54l15_cpuapp.dts @@ -32,7 +32,6 @@ /delete-node/ vpr@4c000; /delete-node/ mailbox@0; /delete-node/ interrupt-controller@f0000000; - /delete-node/ gpio@50400; /delete-node/ i2c@c6000; /delete-node/ spi@c6000; /delete-node/ uart@c6000; @@ -47,8 +46,6 @@ /delete-node/ pwm@d4000; /delete-node/ adc@d5000; /delete-node/ nfct@d6000; - /delete-node/ gpio@d8200; - /delete-node/ gpiote@da000; /delete-node/ i2s@dd000; /delete-node/ qdec@e0000; /delete-node/ qdec@e1000; @@ -57,8 +54,6 @@ /delete-node/ uart@104000; /delete-node/ watchdog@108000; /delete-node/ watchdog@109000; - /delete-node/ gpio@10a000; - /delete-node/ gpiote@10c000; }; }; @@ -91,6 +86,27 @@ }; }; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpiote20 { + status = "okay"; +}; + +&gpiote30 { + status = "okay"; +}; + &temp { status = "okay"; }; diff --git a/boards/native/nrf_bsim/nrf54l15bsim_nrf54l15_cpuapp.yaml b/boards/native/nrf_bsim/nrf54l15bsim_nrf54l15_cpuapp.yaml index cbdd257334f44..6bbf454266024 100644 --- a/boards/native/nrf_bsim/nrf54l15bsim_nrf54l15_cpuapp.yaml +++ b/boards/native/nrf_bsim/nrf54l15bsim_nrf54l15_cpuapp.yaml @@ -9,9 +9,9 @@ toolchain: - zephyr supported: - counter + - gpio testing: ignore_tags: - - gpio - modem - uart - bsim_skip_CI From 1b1d3ca5d5bd8fab282c7574f937431c25f45fb9 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 4 Nov 2024 18:13:54 +0100 Subject: [PATCH 2490/4482] tests gpio_basic_api: Enable for nrf54l15bsim Enable this test, and provide overlays, in the nrf54l15bsim Note this test specs 2 GPIO pins to be shorted. This can be done for the simulation target by calling zephyr.exe with the option `-gpio_conf_file=shorts_config.txt` Where that file would contain this one line (for the provided overlay) ---- shorts_config.txt short 1.1 1.2 ---- Signed-off-by: Alberto Escolar Piedras --- .../boards/nrf54l15bsim_nrf54l15_cpuapp.conf | 1 + .../boards/nrf54l15bsim_nrf54l15_cpuapp.overlay | 7 +++++++ tests/drivers/gpio/gpio_basic_api/testcase.yaml | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54l15bsim_nrf54l15_cpuapp.conf create mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l15bsim_nrf54l15_cpuapp.conf b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l15bsim_nrf54l15_cpuapp.conf new file mode 100644 index 0000000000000..b9d02cf11d5d4 --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l15bsim_nrf54l15_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_SKIP_PULL_TEST=y diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay new file mode 100644 index 0000000000000..2edc8260dc3a8 --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf52_bsim.overlay" diff --git a/tests/drivers/gpio/gpio_basic_api/testcase.yaml b/tests/drivers/gpio/gpio_basic_api/testcase.yaml index 36c8e438fafd8..3cbb9b8d9599d 100644 --- a/tests/drivers/gpio/gpio_basic_api/testcase.yaml +++ b/tests/drivers/gpio/gpio_basic_api/testcase.yaml @@ -13,7 +13,7 @@ tests: filter: dt_compat_enabled("test-gpio-basic-api") and not dt_compat_enabled("arduino-header-r3") drivers.gpio.nrf_sense_edge: - platform_allow: nrf52840dk/nrf52840 nrf52_bsim + platform_allow: nrf52840dk/nrf52840 nrf52_bsim nrf54l15bsim/nrf54l15/cpuapp extra_args: "DTC_OVERLAY_FILE=boards/nrf52840dk_nrf52840.overlay;\ boards/nrf52840dk_nrf52840_sense_edge.overlay" From fb5ee609a0f0082faa2ef012637f61825d58a857 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 4 Nov 2024 18:14:42 +0100 Subject: [PATCH 2491/4482] tests gpio_hogs: Enable for nrf54l15bsim Enable this test, and provide overlays, in the nrf54l15bsim Signed-off-by: Alberto Escolar Piedras --- .../nrf54l15bsim_nrf54l15_cpuapp.overlay | 35 +++++++++++++++++++ tests/drivers/gpio/gpio_hogs/testcase.yaml | 1 + 2 files changed, 36 insertions(+) create mode 100644 tests/drivers/gpio/gpio_hogs/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay diff --git a/tests/drivers/gpio/gpio_hogs/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay b/tests/drivers/gpio/gpio_hogs/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay new file mode 100644 index 0000000000000..6bf18e1faa11d --- /dev/null +++ b/tests/drivers/gpio/gpio_hogs/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2023 Vestas Wind Systems A/S + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/ { + zephyr,user { + output-high-gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; + output-low-gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>; + input-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + }; +}; + +&gpio0 { + hog1 { + gpio-hog; + gpios = <3 GPIO_ACTIVE_LOW>; + output-high; + }; + + hog2 { + gpio-hog; + gpios = <4 GPIO_ACTIVE_HIGH>; + output-low; + }; + + hog3 { + gpio-hog; + gpios = <1 GPIO_ACTIVE_LOW>; + input; + }; +}; diff --git a/tests/drivers/gpio/gpio_hogs/testcase.yaml b/tests/drivers/gpio/gpio_hogs/testcase.yaml index 998d68d7c67de..81b9a1d8d6012 100644 --- a/tests/drivers/gpio/gpio_hogs/testcase.yaml +++ b/tests/drivers/gpio/gpio_hogs/testcase.yaml @@ -11,6 +11,7 @@ tests: - nrf52840dk/nrf52840 - nucleo_g474re - nrf52_bsim + - nrf54l15bsim/nrf54l15/cpuapp - mr_canhubk3 - s32z2xxdc2/s32z270/rtu0 - s32z2xxdc2/s32z270/rtu1 From 990fc4c1305fa98712d8b71bd9a0b22207995c22 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 4 Nov 2024 18:21:08 +0100 Subject: [PATCH 2492/4482] tests gpio_get_direction: Enable for nrf54l15bsim Enable this test by providing an overlay for the nrf54l15bsim Signed-off-by: Alberto Escolar Piedras --- .../boards/nrf54l15bsim_nrf54l15_cpuapp.overlay | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tests/drivers/gpio/gpio_get_direction/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay diff --git a/tests/drivers/gpio/gpio_get_direction/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay b/tests/drivers/gpio/gpio_get_direction/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay new file mode 100644 index 0000000000000..2edc8260dc3a8 --- /dev/null +++ b/tests/drivers/gpio/gpio_get_direction/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf52_bsim.overlay" From d0746f1177fd16fad4acf39effa827685708b881 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 6 Nov 2024 15:49:38 +0100 Subject: [PATCH 2493/4482] boards nrfbsim: Enable GPIO & GPIOTE peripherals for nrf5340bsim The HW models now support these pheripherals, let's enable them Signed-off-by: Alberto Escolar Piedras --- .../nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts | 19 +++++++++++++------ .../nrf_bsim/nrf5340bsim_nrf5340_cpuapp.yaml | 3 ++- .../nrf_bsim/nrf5340bsim_nrf5340_cpunet.dts | 18 ++++++++++++------ .../nrf_bsim/nrf5340bsim_nrf5340_cpunet.yaml | 3 ++- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts b/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts index 256b9bfb87526..f70d06aae7580 100644 --- a/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts +++ b/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts @@ -35,9 +35,6 @@ /delete-property/ i2s-0; /delete-property/ qdec-0; /delete-property/ qdec-1; - /delete-property/ gpio-0; - /delete-property/ gpio-1; - /delete-property/ gpiote-0; }; chosen { @@ -82,11 +79,8 @@ /delete-node/ regulator@37000; /delete-node/ kmu@39000; /delete-node/ vmc@81000; - /delete-node/ gpio@842500; - /delete-node/ gpio@842800; }; /delete-node/ spu@50003000; - /delete-node/ gpiote@5000d000; /delete-node/ crypto@50844000; }; @@ -112,6 +106,19 @@ }; }; + +&gpiote { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + /* We re-use the IPC shared buffer definition from the real HW. But note the start address of the * buffer won't be used. */ diff --git a/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.yaml b/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.yaml index 055bc9e578f57..8e0cdf59fb778 100644 --- a/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.yaml +++ b/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.yaml @@ -9,7 +9,8 @@ toolchain: - zephyr testing: ignore_tags: - - gpio - modem - uart - bsim_skip_CI +supported: + - gpio diff --git a/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpunet.dts b/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpunet.dts index d7d6a2fe75db1..0b9d3a79d1aec 100644 --- a/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpunet.dts +++ b/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpunet.dts @@ -17,12 +17,9 @@ aliases { /delete-property/ sram-0; /delete-property/ sram-1; - /delete-property/ gpiote-0; /delete-property/ wdt-0; /delete-property/ i2c-0; /delete-property/ spi-0; - /delete-property/ gpio-0; - /delete-property/ gpio-1; }; chosen { @@ -36,14 +33,11 @@ soc { /delete-node/ memory@20000000; /delete-node/ memory@21000000; - /delete-node/ gpiote@4100a000; /delete-node/ watchdog@4100b000; /delete-node/ i2c@41013000; /delete-node/ spi@41013000; /delete-node/ acl@41080000; /delete-node/ vmc@41081000; - /delete-node/ gpio@418c0500; - /delete-node/ gpio@418c0800; }; /delete-node/ cpus; @@ -73,6 +67,18 @@ }; }; +&gpiote { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + /* We re-use the IPC shared buffer definition from the real HW. But note the start address of the * buffer won't be used. */ diff --git a/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpunet.yaml b/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpunet.yaml index f88fb9c6ca866..c774a3a578223 100644 --- a/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpunet.yaml +++ b/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpunet.yaml @@ -9,7 +9,8 @@ toolchain: - zephyr testing: ignore_tags: - - gpio - modem - uart - bsim_skip_CI +supported: + - gpio From 8bd0a2525c4249819fc6519453bf5bed0a385d02 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 6 Nov 2024 16:50:23 +0100 Subject: [PATCH 2494/4482] tests gpio_hogs: Enable for nrf5340bsim Enable this test, and provide overlays, for the nrf5340bsim. Both for the app and net core. Signed-off-by: Alberto Escolar Piedras --- .../gpio_hogs/boards/nrf5340bsim_nrf5340_cpuapp.overlay | 7 +++++++ .../gpio_hogs/boards/nrf5340bsim_nrf5340_cpunet.overlay | 7 +++++++ tests/drivers/gpio/gpio_hogs/testcase.yaml | 2 ++ 3 files changed, 16 insertions(+) create mode 100644 tests/drivers/gpio/gpio_hogs/boards/nrf5340bsim_nrf5340_cpuapp.overlay create mode 100644 tests/drivers/gpio/gpio_hogs/boards/nrf5340bsim_nrf5340_cpunet.overlay diff --git a/tests/drivers/gpio/gpio_hogs/boards/nrf5340bsim_nrf5340_cpuapp.overlay b/tests/drivers/gpio/gpio_hogs/boards/nrf5340bsim_nrf5340_cpuapp.overlay new file mode 100644 index 0000000000000..e84f379d899c5 --- /dev/null +++ b/tests/drivers/gpio/gpio_hogs/boards/nrf5340bsim_nrf5340_cpuapp.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2023 Vestas Wind Systems A/S + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf52_bsim.overlay" diff --git a/tests/drivers/gpio/gpio_hogs/boards/nrf5340bsim_nrf5340_cpunet.overlay b/tests/drivers/gpio/gpio_hogs/boards/nrf5340bsim_nrf5340_cpunet.overlay new file mode 100644 index 0000000000000..e84f379d899c5 --- /dev/null +++ b/tests/drivers/gpio/gpio_hogs/boards/nrf5340bsim_nrf5340_cpunet.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2023 Vestas Wind Systems A/S + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf52_bsim.overlay" diff --git a/tests/drivers/gpio/gpio_hogs/testcase.yaml b/tests/drivers/gpio/gpio_hogs/testcase.yaml index 81b9a1d8d6012..fa3108e21e622 100644 --- a/tests/drivers/gpio/gpio_hogs/testcase.yaml +++ b/tests/drivers/gpio/gpio_hogs/testcase.yaml @@ -11,6 +11,8 @@ tests: - nrf52840dk/nrf52840 - nucleo_g474re - nrf52_bsim + - nrf5340bsim/nrf5340/cpuapp + - nrf5340bsim/nrf5340/cpunet - nrf54l15bsim/nrf54l15/cpuapp - mr_canhubk3 - s32z2xxdc2/s32z270/rtu0 From 14c096ff3832efb2130653283e6ee3dbd2c24f41 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 6 Nov 2024 16:51:28 +0100 Subject: [PATCH 2495/4482] tests gpio_basic_api: Enable for nrf5340bsim Enable this test, and provide overlays, in the nrf5340bsim Note this test specs 2 GPIO pins to be shorted. This can be done for the simulation target by calling zephyr.exe with the option `-gpio_conf_file=shorts_config.txt` Where that file would contain this one line (for the provided overlay), for the cpunet: ---- shorts_config.txt short 1.1 1.2 ---- And this for the cpuapp: ---- shorts_config.txt short 3.1 3.2 ---- Signed-off-by: Alberto Escolar Piedras --- .../gpio_basic_api/boards/nrf5340bsim_nrf5340_cpuapp.conf | 1 + .../boards/nrf5340bsim_nrf5340_cpuapp.overlay | 7 +++++++ .../gpio_basic_api/boards/nrf5340bsim_nrf5340_cpunet.conf | 1 + .../boards/nrf5340bsim_nrf5340_cpunet.overlay | 7 +++++++ tests/drivers/gpio/gpio_basic_api/testcase.yaml | 7 ++++++- 5 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf5340bsim_nrf5340_cpuapp.conf create mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf5340bsim_nrf5340_cpuapp.overlay create mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf5340bsim_nrf5340_cpunet.conf create mode 100644 tests/drivers/gpio/gpio_basic_api/boards/nrf5340bsim_nrf5340_cpunet.overlay diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf5340bsim_nrf5340_cpuapp.conf b/tests/drivers/gpio/gpio_basic_api/boards/nrf5340bsim_nrf5340_cpuapp.conf new file mode 100644 index 0000000000000..b9d02cf11d5d4 --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/boards/nrf5340bsim_nrf5340_cpuapp.conf @@ -0,0 +1 @@ +CONFIG_SKIP_PULL_TEST=y diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf5340bsim_nrf5340_cpuapp.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf5340bsim_nrf5340_cpuapp.overlay new file mode 100644 index 0000000000000..2edc8260dc3a8 --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/boards/nrf5340bsim_nrf5340_cpuapp.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf52_bsim.overlay" diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf5340bsim_nrf5340_cpunet.conf b/tests/drivers/gpio/gpio_basic_api/boards/nrf5340bsim_nrf5340_cpunet.conf new file mode 100644 index 0000000000000..b9d02cf11d5d4 --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/boards/nrf5340bsim_nrf5340_cpunet.conf @@ -0,0 +1 @@ +CONFIG_SKIP_PULL_TEST=y diff --git a/tests/drivers/gpio/gpio_basic_api/boards/nrf5340bsim_nrf5340_cpunet.overlay b/tests/drivers/gpio/gpio_basic_api/boards/nrf5340bsim_nrf5340_cpunet.overlay new file mode 100644 index 0000000000000..2edc8260dc3a8 --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/boards/nrf5340bsim_nrf5340_cpunet.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf52_bsim.overlay" diff --git a/tests/drivers/gpio/gpio_basic_api/testcase.yaml b/tests/drivers/gpio/gpio_basic_api/testcase.yaml index 3cbb9b8d9599d..a251a86124823 100644 --- a/tests/drivers/gpio/gpio_basic_api/testcase.yaml +++ b/tests/drivers/gpio/gpio_basic_api/testcase.yaml @@ -13,7 +13,12 @@ tests: filter: dt_compat_enabled("test-gpio-basic-api") and not dt_compat_enabled("arduino-header-r3") drivers.gpio.nrf_sense_edge: - platform_allow: nrf52840dk/nrf52840 nrf52_bsim nrf54l15bsim/nrf54l15/cpuapp + platform_allow: + - nrf52840dk/nrf52840 + - nrf52_bsim + - nrf5340bsim/nrf5340/cpuapp + - nrf5340bsim/nrf5340/cpunet + - nrf54l15bsim/nrf54l15/cpuapp extra_args: "DTC_OVERLAY_FILE=boards/nrf52840dk_nrf52840.overlay;\ boards/nrf52840dk_nrf52840_sense_edge.overlay" From da01758908ae4f7cfe455d453427fb3c4fee56c9 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 6 Nov 2024 16:52:28 +0100 Subject: [PATCH 2496/4482] tests gpio_get_direction: Enable for nrf5340bsim Enable this test by providing an overlay for the nrf5340bsim Both for the app and net core. Signed-off-by: Alberto Escolar Piedras --- .../boards/nrf5340bsim_nrf5340_cpuapp.overlay | 7 +++++++ .../boards/nrf5340bsim_nrf5340_cpunet.overlay | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 tests/drivers/gpio/gpio_get_direction/boards/nrf5340bsim_nrf5340_cpuapp.overlay create mode 100644 tests/drivers/gpio/gpio_get_direction/boards/nrf5340bsim_nrf5340_cpunet.overlay diff --git a/tests/drivers/gpio/gpio_get_direction/boards/nrf5340bsim_nrf5340_cpuapp.overlay b/tests/drivers/gpio/gpio_get_direction/boards/nrf5340bsim_nrf5340_cpuapp.overlay new file mode 100644 index 0000000000000..2edc8260dc3a8 --- /dev/null +++ b/tests/drivers/gpio/gpio_get_direction/boards/nrf5340bsim_nrf5340_cpuapp.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf52_bsim.overlay" diff --git a/tests/drivers/gpio/gpio_get_direction/boards/nrf5340bsim_nrf5340_cpunet.overlay b/tests/drivers/gpio/gpio_get_direction/boards/nrf5340bsim_nrf5340_cpunet.overlay new file mode 100644 index 0000000000000..2edc8260dc3a8 --- /dev/null +++ b/tests/drivers/gpio/gpio_get_direction/boards/nrf5340bsim_nrf5340_cpunet.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf52_bsim.overlay" From 3418305eb8aa60722e2f48c80af5e4dd238cd88d Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Fri, 8 Nov 2024 17:15:00 +0100 Subject: [PATCH 2497/4482] doc boards nrfbsim: Mention the GPIO & GPIOTE as supported Include in the list of supported peripherals the GPIO and GPIOT for both the nrf5340 and nrf54l15 Signed-off-by: Alberto Escolar Piedras --- boards/native/nrf_bsim/doc/nrf5340bsim.rst | 1 + boards/native/nrf_bsim/doc/nrf54l15bsim.rst | 1 + 2 files changed, 2 insertions(+) diff --git a/boards/native/nrf_bsim/doc/nrf5340bsim.rst b/boards/native/nrf_bsim/doc/nrf5340bsim.rst index 7f43dc9093ca3..518965d15e632 100644 --- a/boards/native/nrf_bsim/doc/nrf5340bsim.rst +++ b/boards/native/nrf_bsim/doc/nrf5340bsim.rst @@ -34,6 +34,7 @@ These boards include models of some of the nRF5340 SOC peripherals: * DPPI (Distributed Programmable Peripheral Interconnect) * EGU (Event Generator Unit) * FICR (Factory Information Configuration Registers) +* GPIO & GPIOTE * IPC (Interprocessor communication) * MUTEX (Mutual exclusive peripheral) * NVMC (Non-Volatile Memory Controller / Flash) diff --git a/boards/native/nrf_bsim/doc/nrf54l15bsim.rst b/boards/native/nrf_bsim/doc/nrf54l15bsim.rst index 44dbbf78f253c..eaabaf1cc4de1 100644 --- a/boards/native/nrf_bsim/doc/nrf54l15bsim.rst +++ b/boards/native/nrf_bsim/doc/nrf54l15bsim.rst @@ -44,6 +44,7 @@ This boards include models of some of the nRF54L15 SOC peripherals: * ECB (AES electronic codebook mode encryption) * EGU (Event Generator Unit) * FICR (Factory Information Configuration Registers) +* GPIO & GPIOTE * GRTC (Global Real-time Counter) * PPIB (PPI Bridge) * RADIO From a7abf80064444d0ac729d66856832cab90505c7c Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 7 Nov 2024 12:51:13 +0100 Subject: [PATCH 2498/4482] boards nrfbsim: Enable UART(E) peripherals for nrf5340bsim The HW models now support this peripheral for these targets. Let's enable them. Signed-off-by: Alberto Escolar Piedras --- boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts | 9 +++++++++ boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.yaml | 1 - boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpunet.dts | 10 ++++++++++ boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpunet.yaml | 1 - 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts b/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts index f70d06aae7580..0273ee4d77681 100644 --- a/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts +++ b/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.dts @@ -8,6 +8,7 @@ #include #include +#include <../boards/nordic/nrf5340dk/nrf5340_cpuapp_common-pinctrl.dtsi> / { model = "Nordic NRF5340 BSIM NRF5340 Application"; @@ -119,6 +120,14 @@ status = "okay"; }; +&uart0 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart0_default>; + pinctrl-1 = <&uart0_sleep>; + pinctrl-names = "default", "sleep"; +}; + /* We re-use the IPC shared buffer definition from the real HW. But note the start address of the * buffer won't be used. */ diff --git a/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.yaml b/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.yaml index 8e0cdf59fb778..9d31586454a7f 100644 --- a/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.yaml +++ b/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpuapp.yaml @@ -10,7 +10,6 @@ toolchain: testing: ignore_tags: - modem - - uart - bsim_skip_CI supported: - gpio diff --git a/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpunet.dts b/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpunet.dts index 0b9d3a79d1aec..0f098a7dd2909 100644 --- a/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpunet.dts +++ b/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpunet.dts @@ -8,6 +8,7 @@ #include #include +#include <../boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpunet-pinctrl.dtsi> / { model = "Nordic NRF5340 BSIM NRF5340 Network"; @@ -23,6 +24,7 @@ }; chosen { + zephyr,console = &uart0; zephyr,bt-hci-ipc = &ipc0; nordic,802154-spinel-ipc = &ipc0; zephyr,ieee802154 = &ieee802154; @@ -79,6 +81,14 @@ status = "okay"; }; +&uart0 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart0_default>; + pinctrl-1 = <&uart0_sleep>; + pinctrl-names = "default", "sleep"; +}; + /* We re-use the IPC shared buffer definition from the real HW. But note the start address of the * buffer won't be used. */ diff --git a/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpunet.yaml b/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpunet.yaml index c774a3a578223..a0d6d2caa443b 100644 --- a/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpunet.yaml +++ b/boards/native/nrf_bsim/nrf5340bsim_nrf5340_cpunet.yaml @@ -10,7 +10,6 @@ toolchain: testing: ignore_tags: - modem - - uart - bsim_skip_CI supported: - gpio From dd13fa0c472a86f2d74acbd70eadf57ee3da434c Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 7 Nov 2024 12:53:52 +0100 Subject: [PATCH 2499/4482] tests uart_async_api: Enable in nrf5340bsim//cpuapp Enable this test in the simulated nrf5340 by providing an appropriate overlay. Signed-off-by: Alberto Escolar Piedras --- .../uart_async_api/boards/nrf5340bsim_nrf5340_cpuapp.conf | 2 ++ .../uart_async_api/boards/nrf5340bsim_nrf5340_cpuapp.overlay | 3 +++ tests/drivers/uart/uart_async_api/testcase.yaml | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf5340bsim_nrf5340_cpuapp.conf create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf5340bsim_nrf5340_cpuapp.overlay diff --git a/tests/drivers/uart/uart_async_api/boards/nrf5340bsim_nrf5340_cpuapp.conf b/tests/drivers/uart/uart_async_api/boards/nrf5340bsim_nrf5340_cpuapp.conf new file mode 100644 index 0000000000000..e7a460fde6bb5 --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf5340bsim_nrf5340_cpuapp.conf @@ -0,0 +1,2 @@ +CONFIG_UART_1_NRF_HW_ASYNC_TIMER=1 +CONFIG_UART_NRFX_UARTE_ENHANCED_RX=y diff --git a/tests/drivers/uart/uart_async_api/boards/nrf5340bsim_nrf5340_cpuapp.overlay b/tests/drivers/uart/uart_async_api/boards/nrf5340bsim_nrf5340_cpuapp.overlay new file mode 100644 index 0000000000000..bfd4f8676f1b1 --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf5340bsim_nrf5340_cpuapp.overlay @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf5340dk_nrf5340_cpuapp.overlay" diff --git a/tests/drivers/uart/uart_async_api/testcase.yaml b/tests/drivers/uart/uart_async_api/testcase.yaml index 91ef347af3425..15974269c3946 100644 --- a/tests/drivers/uart/uart_async_api/testcase.yaml +++ b/tests/drivers/uart/uart_async_api/testcase.yaml @@ -26,7 +26,10 @@ tests: integration_platforms: - nucleo_h743zi drivers.uart.async_api.nrf_uarte_new: - platform_allow: nrf52840dk/nrf52840 nrf52_bsim + platform_allow: + - nrf52840dk/nrf52840 + - nrf52_bsim + - nrf5340bsim/nrf5340/cpuapp filter: CONFIG_SERIAL_SUPPORT_ASYNC harness: ztest harness_config: From 51053cce11d57347a1fad14bc583385f18d3ad51 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Fri, 8 Nov 2024 17:35:39 +0100 Subject: [PATCH 2500/4482] tests uart_mix_fifo_poll: Enable for nrf5340bsim Enable this test in the simulated nrf5340 and provide an appropriate overlay. Signed-off-by: Alberto Escolar Piedras --- .../boards/nrf5340bsim_nrf5340_cpuapp.overlay | 3 +++ tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml | 1 + 2 files changed, 4 insertions(+) create mode 100644 tests/drivers/uart/uart_mix_fifo_poll/boards/nrf5340bsim_nrf5340_cpuapp.overlay diff --git a/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf5340bsim_nrf5340_cpuapp.overlay b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf5340bsim_nrf5340_cpuapp.overlay new file mode 100644 index 0000000000000..bfd4f8676f1b1 --- /dev/null +++ b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf5340bsim_nrf5340_cpuapp.overlay @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf5340dk_nrf5340_cpuapp.overlay" diff --git a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml index 1b13bc5716625..91470dc990be4 100644 --- a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml +++ b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml @@ -8,6 +8,7 @@ common: - nrf52840dk/nrf52840 - nrf9160dk/nrf9160 - nrf5340dk/nrf5340/cpuapp + - nrf5340bsim/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad From 5321941a5dfa1d5e38b5406dae8487ff5fa86bc4 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 7 Nov 2024 14:32:20 +0100 Subject: [PATCH 2501/4482] tests uart_pm: Enable for nrf5340bsim Enable this test in the simulated nrf5340 and provide an appropriate overlay. Signed-off-by: Alberto Escolar Piedras --- .../uart/uart_pm/boards/nrf5340bsim_nrf5340_cpuapp.overlay | 3 +++ tests/drivers/uart/uart_pm/testcase.yaml | 1 + 2 files changed, 4 insertions(+) create mode 100644 tests/drivers/uart/uart_pm/boards/nrf5340bsim_nrf5340_cpuapp.overlay diff --git a/tests/drivers/uart/uart_pm/boards/nrf5340bsim_nrf5340_cpuapp.overlay b/tests/drivers/uart/uart_pm/boards/nrf5340bsim_nrf5340_cpuapp.overlay new file mode 100644 index 0000000000000..c7277e73775c8 --- /dev/null +++ b/tests/drivers/uart/uart_pm/boards/nrf5340bsim_nrf5340_cpuapp.overlay @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf52840dk_nrf52840.overlay" diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index 9a7729c8236e5..f9a7a8f902cf3 100644 --- a/tests/drivers/uart/uart_pm/testcase.yaml +++ b/tests/drivers/uart/uart_pm/testcase.yaml @@ -8,6 +8,7 @@ common: - nrf54l15dk/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf52_bsim + - nrf5340bsim/nrf5340/cpuapp harness_config: fixture: gpio_loopback depends_on: gpio From 7065b4628b25bf2c74caeb5d98e582215aa955dd Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Fri, 8 Nov 2024 17:40:25 +0100 Subject: [PATCH 2502/4482] doc boards nrfbsim: Mention the UARTE as supported for nrf5340 Include in the list of supported peripherals the UARTE for the simulated nrf5340 Signed-off-by: Alberto Escolar Piedras --- boards/native/nrf_bsim/doc/nrf5340bsim.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/native/nrf_bsim/doc/nrf5340bsim.rst b/boards/native/nrf_bsim/doc/nrf5340bsim.rst index 518965d15e632..7e252511f3388 100644 --- a/boards/native/nrf_bsim/doc/nrf5340bsim.rst +++ b/boards/native/nrf_bsim/doc/nrf5340bsim.rst @@ -43,6 +43,7 @@ These boards include models of some of the nRF5340 SOC peripherals: * RTC (Real Time Counter) * TEMP (Temperature sensor) * TIMER +* UARTE (UART with Easy DMA) * UICR (User Information Configuration Registers) and will use the same drivers as the nrf5340dk targets for these. From 0d249ecd23fc14e5fb1eea4bd852c3f026b7c746 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Fri, 8 Nov 2024 17:42:44 +0100 Subject: [PATCH 2503/4482] tests/bsim: Also runtime test the UART drivers for the nrf5340 To increase coverage. Signed-off-by: Alberto Escolar Piedras --- tests/bsim/ci.uart.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/bsim/ci.uart.sh b/tests/bsim/ci.uart.sh index ab49280e130d4..86c5282fa921c 100755 --- a/tests/bsim/ci.uart.sh +++ b/tests/bsim/ci.uart.sh @@ -13,7 +13,8 @@ set -uex echo "UART: Single device tests" ${ZEPHYR_BASE}/scripts/twister -T tests/drivers/uart/ --force-color --inline-logs -v -M \ - -p nrf52_bsim --fixture gpio_loopback -- -uart0_loopback + -p nrf52_bsim -p nrf5340bsim/nrf5340/cpuapp --fixture gpio_loopback \ + -- -uart0_loopback -uart1_loopback echo "UART: Multi device tests" WORK_DIR=${ZEPHYR_BASE}/bsim_uart nice tests/bsim/drivers/uart/compile.sh From 87033817642e05a8f28346c055a7fe158c276454 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 7 Nov 2024 11:49:24 +0100 Subject: [PATCH 2504/4482] Bluetooth: Host: Add conversion macros from ms to various units Add conversion macros from milliseconds to various units. The purpose of these macros is to make it more clear/easier for users to set and read values using milliseconds rather than the various BT units which may be in 0.625, 1.25 or 10ms units. This is especially useful when comparing related values using different units, such as advertising interval (0.625ms units) and periodic advertising interval units (1.25ms units). Users will have to be aware that these macros can provide slightly different values than what is provided, if the provided values do not match the units. Signed-off-by: Emil Gydesen --- include/zephyr/bluetooth/conn.h | 6 +- include/zephyr/bluetooth/gap.h | 217 +++++++++++++++++- .../bap_broadcast_assistant/src/main.c | 7 +- .../bluetooth/bap_broadcast_sink/src/main.c | 7 +- .../bluetooth/bap_broadcast_source/src/main.c | 4 +- .../cap_acceptor/src/cap_acceptor_broadcast.c | 7 +- samples/bluetooth/central_past/src/main.c | 26 ++- .../src/main.c | 26 ++- samples/bluetooth/hci_pwr_ctrl/src/main.c | 5 +- .../pbp_public_broadcast_sink/src/main.c | 7 +- samples/bluetooth/periodic_sync/src/main.c | 25 +- .../tmap_bmr/src/bap_broadcast_sink.c | 7 +- subsys/bluetooth/audio/bap_broadcast_sink.c | 7 +- subsys/bluetooth/audio/shell/bap.c | 7 +- .../audio/shell/bap_broadcast_assistant.c | 9 +- .../audio/shell/bap_scan_delegator.c | 7 +- tests/bluetooth/gap/CMakeLists.txt | 12 + tests/bluetooth/gap/prj.conf | 3 + tests/bluetooth/gap/src/main.c | 135 +++++++++++ tests/bluetooth/gap/testcase.yaml | 7 + .../tester/src/audio/btp_bap_broadcast.c | 6 +- tests/bluetooth/tester/src/btp_gap.c | 3 +- .../bluetooth/audio/src/cap_commander_test.c | 8 +- .../audio/src/cap_initiator_broadcast_test.c | 15 +- .../audio/src/cap_initiator_unicast_test.c | 8 +- tests/bsim/bluetooth/audio/src/common.c | 7 +- .../bsim/bluetooth/audio/src/gmap_ugg_test.c | 21 +- tests/bsim/bluetooth/audio/src/mcc_test.c | 6 +- .../bluetooth/host/iso/bis/src/bis_receiver.c | 15 +- tests/bsim/bluetooth/ll/cis/src/main.c | 20 +- 30 files changed, 540 insertions(+), 100 deletions(-) create mode 100644 tests/bluetooth/gap/CMakeLists.txt create mode 100644 tests/bluetooth/gap/prj.conf create mode 100644 tests/bluetooth/gap/src/main.c create mode 100644 tests/bluetooth/gap/testcase.yaml diff --git a/include/zephyr/bluetooth/conn.h b/include/zephyr/bluetooth/conn.h index b4cf1c5c6bab2..5ef3628172690 100644 --- a/include/zephyr/bluetooth/conn.h +++ b/include/zephyr/bluetooth/conn.h @@ -74,9 +74,9 @@ struct bt_le_conn_param { * Latency: 0 * Timeout: 4 s */ -#define BT_LE_CONN_PARAM_DEFAULT BT_LE_CONN_PARAM(BT_GAP_INIT_CONN_INT_MIN, \ - BT_GAP_INIT_CONN_INT_MAX, \ - 0, 400) +#define BT_LE_CONN_PARAM_DEFAULT \ + BT_LE_CONN_PARAM(BT_GAP_INIT_CONN_INT_MIN, BT_GAP_INIT_CONN_INT_MAX, 0, \ + BT_GAP_MS_TO_CONN_TIMEOUT(4000)) /** Connection PHY information for LE connections */ struct bt_conn_le_phy_info { diff --git a/include/zephyr/bluetooth/gap.h b/include/zephyr/bluetooth/gap.h index f1c8093b5b539..1b1569e300318 100644 --- a/include/zephyr/bluetooth/gap.h +++ b/include/zephyr/bluetooth/gap.h @@ -825,12 +825,225 @@ enum { /** Maximum Periodic Advertising Interval (N * 1.25 ms) */ #define BT_GAP_PER_ADV_MAX_INTERVAL 0xFFFF /* 81.91875 s */ +/** + * @brief Convert periodic advertising interval (N * 0.625 ms) to microseconds + * + * Value range of @p _interval is @ref BT_LE_ADV_INTERVAL_MIN to @ref BT_LE_ADV_INTERVAL_MAX + */ +#define BT_GAP_ADV_INTERVAL_TO_US(_interval) ((uint32_t)((_interval) * 625U)) + +/** + * @brief Convert periodic advertising interval (N * 0.625 ms) to milliseconds + * + * Value range of @p _interval is @ref BT_LE_ADV_INTERVAL_MIN to @ref BT_LE_ADV_INTERVAL_MAX + * + * @note When intervals cannot be represented in milliseconds, this will round down. + * For example BT_GAP_ADV_INTERVAL_TO_MS(0x0021) will become 20 ms instead of 20.625 ms + */ +#define BT_GAP_ADV_INTERVAL_TO_MS(_interval) (BT_GAP_ADV_INTERVAL_TO_US(_interval) / USEC_PER_MSEC) + +/** + * @brief Convert isochronous interval (N * 1.25 ms) to microseconds + * + * Value range of @p _interval is @ref BT_HCI_ISO_INTERVAL_MIN to @ref BT_HCI_ISO_INTERVAL_MAX + */ +#define BT_GAP_ISO_INTERVAL_TO_US(_interval) ((uint32_t)((_interval) * 1250U)) + +/** + * @brief Convert isochronous interval (N * 1.25 ms) to milliseconds + * + * Value range of @p _interval is @ref BT_HCI_ISO_INTERVAL_MIN to @ref BT_HCI_ISO_INTERVAL_MAX + * + * @note When intervals cannot be represented in milliseconds, this will round down. + * For example BT_GAP_ISO_INTERVAL_TO_MS(0x0005) will become 6 ms instead of 6.25 ms + */ +#define BT_GAP_ISO_INTERVAL_TO_MS(_interval) (BT_GAP_ISO_INTERVAL_TO_US(_interval) / USEC_PER_MSEC) + +/** @brief Convert periodic advertising interval (N * 1.25 ms) to microseconds * + * + * Value range of @p _interval is @ref BT_HCI_LE_PER_ADV_INTERVAL_MIN to @ref + * BT_HCI_LE_PER_ADV_INTERVAL_MAX + */ +#define BT_GAP_PER_ADV_INTERVAL_TO_US(_interval) ((uint32_t)((_interval) * 1250U)) + /** * @brief Convert periodic advertising interval (N * 1.25 ms) to milliseconds * - * 5 / 4 represents 1.25 ms unit. + * @note When intervals cannot be represented in milliseconds, this will round down. + * For example BT_GAP_PER_ADV_INTERVAL_TO_MS(0x0009) will become 11 ms instead of 11.25 ms + */ +#define BT_GAP_PER_ADV_INTERVAL_TO_MS(_interval) \ + (BT_GAP_PER_ADV_INTERVAL_TO_US(_interval) / USEC_PER_MSEC) + +/** + * @brief Convert microseconds to advertising interval units (0.625 ms) + * + * Value range of @p _interval is 20000 to 1024000 + * + * @note If @p _interval is not a multiple of the unit, it will round down to nearest. + * For example BT_GAP_US_TO_ADV_INTERVAL(21000) will become 20625 microseconds + */ +#define BT_GAP_US_TO_ADV_INTERVAL(_interval) ((uint16_t)((_interval) / 625U)) + +/** + * @brief Convert milliseconds to advertising interval units (0.625 ms) + * + * Value range of @p _interval is 20 to 1024 + * + * @note If @p _interval is not a multiple of the unit, it will round down to nearest. + * For example BT_GAP_MS_TO_ADV_INTERVAL(21) will become 20.625 milliseconds + */ +#define BT_GAP_MS_TO_ADV_INTERVAL(_interval) \ + (BT_GAP_US_TO_ADV_INTERVAL((_interval) * USEC_PER_MSEC)) + +/** + * @brief Convert microseconds to periodic advertising interval units (1.25 ms) + * + * Value range of @p _interval is 7500 to 81918750 + * + * @note If @p _interval is not a multiple of the unit, it will round down to nearest. + * For example BT_GAP_US_TO_PER_ADV_INTERVAL(11000) will become 10000 microseconds + */ +#define BT_GAP_US_TO_PER_ADV_INTERVAL(_interval) ((uint16_t)((_interval) / 1250U)) + +/** + * @brief Convert milliseconds to periodic advertising interval units (1.25 ms) + * + * Value range of @p _interval is 7.5 to 81918.75 + * + * @note If @p _interval is not a multiple of the unit, it will round down to nearest. + * For example BT_GAP_MS_TO_PER_ADV_INTERVAL(11) will become 10 milliseconds + */ +#define BT_GAP_MS_TO_PER_ADV_INTERVAL(_interval) \ + (BT_GAP_US_TO_PER_ADV_INTERVAL((_interval) * USEC_PER_MSEC)) + +/** + * @brief Convert milliseconds to periodic advertising sync timeout units (10 ms) + * + * Value range of @p _timeout is 100 to 163840 + * + * @note If @p _timeout is not a multiple of the unit, it will round down to nearest. + * For example BT_GAP_MS_TO_PER_ADV_SYNC_TIMEOUT(4005) will become 4000 milliseconds + */ +#define BT_GAP_MS_TO_PER_ADV_SYNC_TIMEOUT(_timeout) ((uint16_t)((_timeout) / 10U)) + +/** + * @brief Convert microseconds to periodic advertising sync timeout units (10 ms) + * + * Value range of @p _timeout is 100000 to 163840000 + * + * @note If @p _timeout is not a multiple of the unit, it will round down to nearest. + * For example BT_GAP_MS_TO_PER_ADV_SYNC_TIMEOUT(4005000) will become 4000000 microseconds + */ +#define BT_GAP_US_TO_PER_ADV_SYNC_TIMEOUT(_timeout) \ + (BT_GAP_MS_TO_PER_ADV_SYNC_TIMEOUT((_timeout) / USEC_PER_MSEC)) + +/** + * @brief Convert microseconds to scan interval units (0.625 ms) + * + * Value range of @p _interval is 2500 to 40959375 if @kconfig{CONFIG_BT_EXT_ADV} else + * 2500 to 10240000 + * + * @note If @p _interval is not a multiple of the unit, it will round down to nearest. + * For example BT_GAP_US_TO_SCAN_INTERVAL(21000) will become 20625 microseconds + */ +#define BT_GAP_US_TO_SCAN_INTERVAL(_interval) ((uint16_t)((_interval) / 625U)) + +/** + * @brief Convert milliseconds to scan interval units (0.625 ms) + * + * Value range of @p _interval is 2.5 to 40959.375 if @kconfig{CONFIG_BT_EXT_ADV} else + * 2500 to 10240 + * + * @note If @p _interval is not a multiple of the unit, it will round down to nearest. + * For example BT_GAP_MS_TO_SCAN_INTERVAL(21) will become 20.625 milliseconds + */ +#define BT_GAP_MS_TO_SCAN_INTERVAL(_interval) \ + (BT_GAP_US_TO_SCAN_INTERVAL((_interval) * USEC_PER_MSEC)) + +/** + * @brief Convert microseconds to scan window units (0.625 ms) + * + * Value range of @p _window is 2500 to 40959375 if @kconfig{CONFIG_BT_EXT_ADV} else + * 2500 to 10240000 + * + * @note If @p _window is not a multiple of the unit, it will round down to nearest. + * For example BT_GAP_US_TO_SCAN_WINDOW(21000) will become 20625 microseconds + */ +#define BT_GAP_US_TO_SCAN_WINDOW(_window) ((uint16_t)((_window) / 625U)) + +/** + * @brief Convert milliseconds to scan window units (0.625 ms) + * + * Value range of @p _window is 2.5 to 40959.375 if @kconfig{CONFIG_BT_EXT_ADV} else + * 2500 to 10240 + * + * @note If @p _window is not a multiple of the unit, it will round down to nearest. + * For example BT_GAP_MS_TO_SCAN_WINDOW(21) will become 20.625 milliseconds + */ +#define BT_GAP_MS_TO_SCAN_WINDOW(_window) (BT_GAP_US_TO_SCAN_WINDOW((_window) * USEC_PER_MSEC)) + +/** + * @brief Convert microseconds to connection interval units (1.25 ms) + * + * Value range of @p _interval is 7500 to 4000000 + * + * @note If @p _interval is not a multiple of the unit, it will round down to nearest. + * For example BT_GAP_US_TO_CONN_INTERVAL(21000) will become 20000 microseconds + */ +#define BT_GAP_US_TO_CONN_INTERVAL(_interval) ((uint16_t)((_interval) / 1250U)) + +/** + * @brief Convert milliseconds to connection interval units (1.25 ms) + * + * Value range of @p _interval is 7.5 to 4000 + * + * @note If @p _interval is not a multiple of the unit, it will round down to nearest. + * For example BT_GAP_MS_TO_CONN_INTERVAL(21) will become 20 milliseconds + */ +#define BT_GAP_MS_TO_CONN_INTERVAL(_interval) \ + (BT_GAP_US_TO_CONN_INTERVAL((_interval) * USEC_PER_MSEC)) + +/** + * @brief Convert milliseconds to connection supervision timeout units (10 ms) + * + * Value range of @p _timeout is 100 to 32000 + * + * @note If @p _timeout is not a multiple of the unit, it will round down to nearest. + * For example BT_GAP_MS_TO_CONN_TIMEOUT(4005) will become 4000 milliseconds + */ +#define BT_GAP_MS_TO_CONN_TIMEOUT(_timeout) ((uint16_t)((_timeout) / 10U)) + +/** + * @brief Convert microseconds to connection supervision timeout units (10 ms) + + * Value range of @p _timeout is 100000 to 32000000 + * + * @note If @p _timeout is not a multiple of the unit, it will round down to nearest. + * For example BT_GAP_MS_TO_CONN_TIMEOUT(4005000) will become 4000000 microseconds + */ +#define BT_GAP_US_TO_CONN_TIMEOUT(_timeout) (BT_GAP_MS_TO_CONN_TIMEOUT((_timeout) / USEC_PER_MSEC)) + +/** + * @brief Convert milliseconds to connection event length units (0.625) + * + * Value range of @p _event_len is 0 to 40959375 + * + * @note If @p _event_len is not a multiple of the unit, it will round down to nearest. + * For example BT_GAP_US_TO_CONN_EVENT_LEN(21000) will become 20625 milliseconds + */ +#define BT_GAP_US_TO_CONN_EVENT_LEN(_event_len) ((uint16_t)((_event_len) / 625U)) + +/** + * @brief Convert milliseconds to connection event length units (0.625) + * + * Value range of @p _event_len is 0 to 40959.375 + * + * @note If @p _event_len is not a multiple of the unit, it will round down to nearest. + * For example BT_GAP_MS_TO_CONN_EVENT_LEN(21) will become 20.625 milliseconds */ -#define BT_GAP_PER_ADV_INTERVAL_TO_MS(interval) ((interval) * 5 / 4) +#define BT_GAP_MS_TO_CONN_EVENT_LEN(_event_len) \ + (BT_GAP_US_TO_CONN_EVENT_LEN((_event_len) * USEC_PER_MSEC)) /** Constant Tone Extension (CTE) types */ enum { diff --git a/samples/bluetooth/bap_broadcast_assistant/src/main.c b/samples/bluetooth/bap_broadcast_assistant/src/main.c index 321bacf131a63..49b630d1dbbf6 100644 --- a/samples/bluetooth/bap_broadcast_assistant/src/main.c +++ b/samples/bluetooth/bap_broadcast_assistant/src/main.c @@ -260,12 +260,13 @@ static uint16_t interval_to_sync_timeout(uint16_t pa_interval) /* Use maximum value to maximize chance of success */ pa_timeout = BT_GAP_PER_ADV_MAX_TIMEOUT; } else { - uint32_t interval_ms; + uint32_t interval_us; uint32_t timeout; /* Add retries and convert to unit in 10's of ms */ - interval_ms = BT_GAP_PER_ADV_INTERVAL_TO_MS(pa_interval); - timeout = (interval_ms * PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO) / 10; + interval_us = BT_GAP_PER_ADV_INTERVAL_TO_US(pa_interval); + timeout = BT_GAP_US_TO_PER_ADV_SYNC_TIMEOUT(interval_us) * + PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO; /* Enforce restraints */ pa_timeout = CLAMP(timeout, BT_GAP_PER_ADV_MIN_TIMEOUT, BT_GAP_PER_ADV_MAX_TIMEOUT); diff --git a/samples/bluetooth/bap_broadcast_sink/src/main.c b/samples/bluetooth/bap_broadcast_sink/src/main.c index 8fd6d01ec4a6c..cee4f5b008cb9 100644 --- a/samples/bluetooth/bap_broadcast_sink/src/main.c +++ b/samples/bluetooth/bap_broadcast_sink/src/main.c @@ -851,12 +851,13 @@ static uint16_t interval_to_sync_timeout(uint16_t pa_interval) /* Use maximum value to maximize chance of success */ pa_timeout = BT_GAP_PER_ADV_MAX_TIMEOUT; } else { - uint32_t interval_ms; + uint32_t interval_us; uint32_t timeout; /* Add retries and convert to unit in 10's of ms */ - interval_ms = BT_GAP_PER_ADV_INTERVAL_TO_MS(pa_interval); - timeout = (interval_ms * PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO) / 10; + interval_us = BT_GAP_PER_ADV_INTERVAL_TO_US(pa_interval); + timeout = BT_GAP_US_TO_PER_ADV_SYNC_TIMEOUT(interval_us) * + PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO; /* Enforce restraints */ pa_timeout = CLAMP(timeout, BT_GAP_PER_ADV_MIN_TIMEOUT, BT_GAP_PER_ADV_MAX_TIMEOUT); diff --git a/samples/bluetooth/bap_broadcast_source/src/main.c b/samples/bluetooth/bap_broadcast_source/src/main.c index 9d3fc8759e12f..b0238ade6bd02 100644 --- a/samples/bluetooth/bap_broadcast_source/src/main.c +++ b/samples/bluetooth/bap_broadcast_source/src/main.c @@ -39,7 +39,9 @@ BUILD_ASSERT(strlen(CONFIG_BROADCAST_CODE) <= BT_ISO_BROADCAST_CODE_SIZE, "Inval * And, for 10 ms ISO interval, can use 90 ms minus 10 ms ==> 80 ms advertising * interval. */ -#define BT_LE_EXT_ADV_CUSTOM BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV, 0x0080, 0x0080, NULL) +#define BT_LE_EXT_ADV_CUSTOM \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV, BT_GAP_MS_TO_ADV_INTERVAL(80), \ + BT_GAP_MS_TO_ADV_INTERVAL(80), NULL) /* When BROADCAST_ENQUEUE_COUNT > 1 we can enqueue enough buffers to ensure that * the controller is never idle diff --git a/samples/bluetooth/cap_acceptor/src/cap_acceptor_broadcast.c b/samples/bluetooth/cap_acceptor/src/cap_acceptor_broadcast.c index 4bb2b24bc4c17..444c5f06e3ce2 100644 --- a/samples/bluetooth/cap_acceptor/src/cap_acceptor_broadcast.c +++ b/samples/bluetooth/cap_acceptor/src/cap_acceptor_broadcast.c @@ -291,12 +291,13 @@ static uint16_t interval_to_sync_timeout(uint16_t pa_interval) /* Use maximum value to maximize chance of success */ pa_timeout = BT_GAP_PER_ADV_MAX_TIMEOUT; } else { - uint32_t interval_ms; + uint32_t interval_us; uint32_t timeout; /* Add retries and convert to unit in 10's of ms */ - interval_ms = BT_GAP_PER_ADV_INTERVAL_TO_MS(pa_interval); - timeout = (interval_ms * PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO) / 10; + interval_us = BT_GAP_PER_ADV_INTERVAL_TO_US(pa_interval); + timeout = BT_GAP_US_TO_PER_ADV_SYNC_TIMEOUT(interval_us) * + PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO; /* Enforce restraints */ pa_timeout = CLAMP(timeout, BT_GAP_PER_ADV_MIN_TIMEOUT, BT_GAP_PER_ADV_MAX_TIMEOUT); diff --git a/samples/bluetooth/central_past/src/main.c b/samples/bluetooth/central_past/src/main.c index 458fe763eff38..d79277bf6b375 100644 --- a/samples/bluetooth/central_past/src/main.c +++ b/samples/bluetooth/central_past/src/main.c @@ -1,15 +1,19 @@ /* - * Copyright (c) 2021 Nordic Semiconductor ASA + * Copyright (c) 2021-2024 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ +#include + +#include #include #include #include #include #include #include +#include #define NAME_LEN 30 @@ -17,7 +21,7 @@ static bool per_adv_found; static bt_addr_le_t per_addr; static uint8_t per_sid; static struct bt_conn *default_conn; -static uint32_t per_adv_interval_ms; +static uint16_t per_adv_sync_timeout; static K_SEM_DEFINE(sem_conn, 0, 1); static K_SEM_DEFINE(sem_conn_lost, 0, 1); @@ -106,8 +110,22 @@ static void scan_recv(const struct bt_le_scan_recv_info *info, } else { /* If info->interval it is a periodic advertiser, mark for sync */ if (!per_adv_found && info->interval) { + uint32_t interval_us; + uint32_t timeout; + per_adv_found = true; - per_adv_interval_ms = BT_GAP_PER_ADV_INTERVAL_TO_MS(info->interval); + + /* Add retries and convert to unit in 10's of ms */ + interval_us = BT_GAP_PER_ADV_INTERVAL_TO_US(info->interval); + + timeout = BT_GAP_US_TO_PER_ADV_SYNC_TIMEOUT(interval_us); + + /* 10 attempts */ + timeout *= 10; + + /* Enforce restraints */ + per_adv_sync_timeout = CLAMP(timeout, BT_GAP_PER_ADV_MIN_TIMEOUT, + BT_GAP_PER_ADV_MAX_TIMEOUT); per_sid = info->sid; bt_addr_le_copy(&per_addr, info->addr); @@ -296,7 +314,7 @@ int main(void) sync_create_param.options = 0; sync_create_param.sid = per_sid; sync_create_param.skip = 0; - sync_create_param.timeout = per_adv_interval_ms * 10 / 10; /* 10 attempts */ + sync_create_param.timeout = per_adv_sync_timeout; err = bt_le_per_adv_sync_create(&sync_create_param, &sync); if (err != 0) { printk("failed (err %d)\n", err); diff --git a/samples/bluetooth/direction_finding_connectionless_rx/src/main.c b/samples/bluetooth/direction_finding_connectionless_rx/src/main.c index 242da519c09dc..3c5304e2c0d02 100644 --- a/samples/bluetooth/direction_finding_connectionless_rx/src/main.c +++ b/samples/bluetooth/direction_finding_connectionless_rx/src/main.c @@ -1,11 +1,11 @@ /* - * Copyright (c) 2021 Nordic Semiconductor ASA + * Copyright (c) 2021-2024 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ #include -#include +#include #include #include @@ -38,7 +38,7 @@ static bool scan_enabled; static bool sync_wait; static bool sync_terminated; static uint8_t per_sid; -static uint32_t sync_create_timeout_ms; +static uint16_t sync_create_timeout; static K_SEM_DEFINE(sem_per_adv, 0, 1); static K_SEM_DEFINE(sem_per_sync, 0, 1); @@ -78,9 +78,19 @@ static struct bt_le_scan_cb scan_callbacks = { .recv = scan_recv, }; -static uint32_t sync_create_timeout_get(uint16_t interval) +static uint16_t sync_create_timeout_get(uint16_t interval) { - return BT_GAP_PER_ADV_INTERVAL_TO_MS(interval) * SYNC_CREATE_TIMEOUT_INTERVAL_NUM; + uint32_t interval_us; + uint32_t timeout; + + /* Add retries and convert to unit in 10's of ms */ + interval_us = BT_GAP_PER_ADV_INTERVAL_TO_US(interval); + timeout = BT_GAP_US_TO_PER_ADV_SYNC_TIMEOUT(interval_us) * SYNC_CREATE_TIMEOUT_INTERVAL_NUM; + + /* Enforce restraints */ + timeout = CLAMP(timeout, BT_GAP_PER_ADV_MIN_TIMEOUT, BT_GAP_PER_ADV_MAX_TIMEOUT); + + return (uint16_t)timeout; } static const char *phy2str(uint8_t phy) @@ -244,7 +254,7 @@ static void scan_recv(const struct bt_le_scan_recv_info *info, info->interval, info->interval * 5 / 4, info->sid); if (!per_adv_found && info->interval != 0) { - sync_create_timeout_ms = sync_create_timeout_get(info->interval); + sync_create_timeout = sync_create_timeout_get(info->interval); per_adv_found = true; per_sid = info->sid; bt_addr_le_copy(&per_addr, info->addr); @@ -263,7 +273,7 @@ static void create_sync(void) sync_create_param.options = BT_LE_PER_ADV_SYNC_OPT_SYNC_ONLY_CONST_TONE_EXT; sync_create_param.sid = per_sid; sync_create_param.skip = 0; - sync_create_param.timeout = sync_create_timeout_ms / 10; + sync_create_param.timeout = sync_create_timeout; err = bt_le_per_adv_sync_create(&sync_create_param, &adv_sync); if (err != 0) { printk("failed (err %d)\n", err); @@ -398,7 +408,7 @@ int main(void) create_sync(); printk("Waiting for periodic sync...\n"); - err = k_sem_take(&sem_per_sync, K_MSEC(sync_create_timeout_ms)); + err = k_sem_take(&sem_per_sync, K_MSEC(sync_create_timeout)); if (err != 0 || sync_terminated) { if (err != 0) { printk("failed (err %d)\n", err); diff --git a/samples/bluetooth/hci_pwr_ctrl/src/main.c b/samples/bluetooth/hci_pwr_ctrl/src/main.c index 3b08d45b8a009..7595326bd131c 100644 --- a/samples/bluetooth/hci_pwr_ctrl/src/main.c +++ b/samples/bluetooth/hci_pwr_ctrl/src/main.c @@ -6,6 +6,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include #include #include @@ -42,8 +43,8 @@ static K_THREAD_STACK_DEFINE(pwr_thread_stack, 512); static const int8_t txpower[DEVICE_BEACON_TXPOWER_NUM] = {4, 0, -3, -8, -15, -18, -23, -30}; -static const struct bt_le_adv_param *param = - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, 0x0020, 0x0020, NULL); +static const struct bt_le_adv_param *param = BT_LE_ADV_PARAM( + BT_LE_ADV_OPT_CONN, BT_GAP_MS_TO_ADV_INTERVAL(20), BT_GAP_MS_TO_ADV_INTERVAL(20), NULL); static void read_conn_rssi(uint16_t handle, int8_t *rssi) { diff --git a/samples/bluetooth/pbp_public_broadcast_sink/src/main.c b/samples/bluetooth/pbp_public_broadcast_sink/src/main.c index 81a726b10e8b8..63f4609a03232 100644 --- a/samples/bluetooth/pbp_public_broadcast_sink/src/main.c +++ b/samples/bluetooth/pbp_public_broadcast_sink/src/main.c @@ -122,12 +122,13 @@ static struct bt_pacs_cap cap = { static uint16_t interval_to_sync_timeout(uint16_t interval) { - uint32_t interval_ms; + uint32_t interval_us; uint32_t timeout; /* Add retries and convert to unit in 10's of ms */ - interval_ms = BT_GAP_PER_ADV_INTERVAL_TO_MS(interval); - timeout = (interval_ms * PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO) / 10; + interval_us = BT_GAP_PER_ADV_INTERVAL_TO_US(interval); + timeout = + BT_GAP_US_TO_PER_ADV_SYNC_TIMEOUT(interval_us) * PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO; /* Enforce restraints */ timeout = CLAMP(timeout, BT_GAP_PER_ADV_MIN_TIMEOUT, BT_GAP_PER_ADV_MAX_TIMEOUT); diff --git a/samples/bluetooth/periodic_sync/src/main.c b/samples/bluetooth/periodic_sync/src/main.c index a8baf5d260066..fdc736c52fe87 100644 --- a/samples/bluetooth/periodic_sync/src/main.c +++ b/samples/bluetooth/periodic_sync/src/main.c @@ -1,20 +1,23 @@ /* - * Copyright (c) 2020 Nordic Semiconductor ASA + * Copyright (c) 2020-2024 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ +#include +#include #include #include #include #include +#include #define TIMEOUT_SYNC_CREATE K_SECONDS(10) #define NAME_LEN 30 static bool per_adv_found; static bt_addr_le_t per_addr; -static uint32_t per_adv_interval_ms; +static uint16_t per_adv_sync_timeout; static uint8_t per_sid; static K_SEM_DEFINE(sem_per_adv, 0, 1); @@ -97,8 +100,22 @@ static void scan_recv(const struct bt_le_scan_recv_info *info, info->interval, info->interval * 5 / 4, info->sid); if (!per_adv_found && info->interval) { + uint32_t interval_us; + uint32_t timeout; + per_adv_found = true; - per_adv_interval_ms = BT_GAP_PER_ADV_INTERVAL_TO_MS(info->interval); + + /* Add retries and convert to unit in 10's of ms */ + interval_us = BT_GAP_PER_ADV_INTERVAL_TO_US(info->interval); + + timeout = BT_GAP_US_TO_PER_ADV_SYNC_TIMEOUT(interval_us); + + /* 10 attempts */ + timeout *= 10; + + /* Enforce restraints */ + per_adv_sync_timeout = + CLAMP(timeout, BT_GAP_PER_ADV_MIN_TIMEOUT, BT_GAP_PER_ADV_MAX_TIMEOUT); per_sid = info->sid; bt_addr_le_copy(&per_addr, info->addr); @@ -235,7 +252,7 @@ int main(void) sync_create_param.options = 0; sync_create_param.sid = per_sid; sync_create_param.skip = 0; - sync_create_param.timeout = per_adv_interval_ms * 10 / 10; /* 10 attempts */ + sync_create_param.timeout = per_adv_sync_timeout; err = bt_le_per_adv_sync_create(&sync_create_param, &sync); if (err) { printk("failed (err %d)\n", err); diff --git a/samples/bluetooth/tmap_bmr/src/bap_broadcast_sink.c b/samples/bluetooth/tmap_bmr/src/bap_broadcast_sink.c index 4ee361934a533..9c2994f99976e 100644 --- a/samples/bluetooth/tmap_bmr/src/bap_broadcast_sink.c +++ b/samples/bluetooth/tmap_bmr/src/bap_broadcast_sink.c @@ -113,12 +113,13 @@ static struct bt_pacs_cap cap = { static uint16_t interval_to_sync_timeout(uint16_t interval) { - uint32_t interval_ms; + uint32_t interval_us; uint32_t timeout; /* Add retries and convert to unit in 10's of ms */ - interval_ms = BT_GAP_PER_ADV_INTERVAL_TO_MS(interval); - timeout = (interval_ms * PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO) / 10; + interval_us = BT_GAP_PER_ADV_INTERVAL_TO_US(interval); + timeout = + BT_GAP_US_TO_PER_ADV_SYNC_TIMEOUT(interval_us) * PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO; /* Enforce restraints */ timeout = CLAMP(timeout, BT_GAP_PER_ADV_MIN_TIMEOUT, BT_GAP_PER_ADV_MAX_TIMEOUT); diff --git a/subsys/bluetooth/audio/bap_broadcast_sink.c b/subsys/bluetooth/audio/bap_broadcast_sink.c index bff6a139e8413..d6b8578696805 100644 --- a/subsys/bluetooth/audio/bap_broadcast_sink.c +++ b/subsys/bluetooth/audio/bap_broadcast_sink.c @@ -952,12 +952,13 @@ static void biginfo_recv(struct bt_le_per_adv_sync *sync, static uint16_t interval_to_sync_timeout(uint16_t interval) { - uint32_t interval_ms; + uint32_t interval_us; uint32_t timeout; /* Add retries and convert to unit in 10's of ms */ - interval_ms = BT_GAP_PER_ADV_INTERVAL_TO_MS(interval); - timeout = (interval_ms * PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO) / 10; + interval_us = BT_GAP_PER_ADV_INTERVAL_TO_US(interval); + timeout = + BT_GAP_US_TO_PER_ADV_SYNC_TIMEOUT(interval_us) * PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO; /* Enforce restraints */ timeout = CLAMP(timeout, BT_GAP_PER_ADV_MIN_TIMEOUT, BT_GAP_PER_ADV_MAX_TIMEOUT); diff --git a/subsys/bluetooth/audio/shell/bap.c b/subsys/bluetooth/audio/shell/bap.c index 71d795cc071e7..d06d055318d4f 100644 --- a/subsys/bluetooth/audio/shell/bap.c +++ b/subsys/bluetooth/audio/shell/bap.c @@ -2371,12 +2371,13 @@ static void clear_auto_scan(void) static uint16_t interval_to_sync_timeout(uint16_t interval) { - uint32_t interval_ms; + uint32_t interval_us; uint32_t timeout; /* Add retries and convert to unit in 10's of ms */ - interval_ms = BT_GAP_PER_ADV_INTERVAL_TO_MS(interval); - timeout = (interval_ms * PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO) / 10; + interval_us = BT_GAP_PER_ADV_INTERVAL_TO_US(interval); + timeout = + BT_GAP_US_TO_PER_ADV_SYNC_TIMEOUT(interval_us) * PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO; /* Enforce restraints */ timeout = CLAMP(timeout, BT_GAP_PER_ADV_MIN_TIMEOUT, BT_GAP_PER_ADV_MAX_TIMEOUT); diff --git a/subsys/bluetooth/audio/shell/bap_broadcast_assistant.c b/subsys/bluetooth/audio/shell/bap_broadcast_assistant.c index 52e562ca37c25..d492330b5ead8 100644 --- a/subsys/bluetooth/audio/shell/bap_broadcast_assistant.c +++ b/subsys/bluetooth/audio/shell/bap_broadcast_assistant.c @@ -107,10 +107,11 @@ static void bap_broadcast_assistant_scan_cb(const struct bt_le_scan_recv_info *i char le_addr[BT_ADDR_LE_STR_LEN]; bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr)); - shell_print(ctx_shell, - "[DEVICE]: %s, broadcast_id 0x%06X, interval (ms) %u), SID 0x%x, RSSI %i", - le_addr, broadcast_id, BT_GAP_PER_ADV_INTERVAL_TO_MS(info->interval), info->sid, - info->rssi); + shell_print( + ctx_shell, + "[DEVICE]: %s, broadcast_id 0x%06X, interval (ms) %u (0x%04x)), SID 0x%x, RSSI %i", + le_addr, broadcast_id, BT_GAP_PER_ADV_INTERVAL_TO_MS(info->interval), + info->interval, info->sid, info->rssi); } static bool metadata_entry(struct bt_data *data, void *user_data) diff --git a/subsys/bluetooth/audio/shell/bap_scan_delegator.c b/subsys/bluetooth/audio/shell/bap_scan_delegator.c index 676c5a5143647..a4a515a0db508 100644 --- a/subsys/bluetooth/audio/shell/bap_scan_delegator.c +++ b/subsys/bluetooth/audio/shell/bap_scan_delegator.c @@ -151,12 +151,13 @@ static uint16_t interval_to_sync_timeout(uint16_t pa_interval) /* Use maximum value to maximize chance of success */ pa_timeout = BT_GAP_PER_ADV_MAX_TIMEOUT; } else { - uint32_t interval_ms; + uint32_t interval_us; uint32_t timeout; /* Add retries and convert to unit in 10's of ms */ - interval_ms = BT_GAP_PER_ADV_INTERVAL_TO_MS(pa_interval); - timeout = (interval_ms * PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO) / 10; + interval_us = BT_GAP_PER_ADV_INTERVAL_TO_US(pa_interval); + timeout = BT_GAP_US_TO_PER_ADV_SYNC_TIMEOUT(interval_us) * + PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO; /* Enforce restraints */ pa_timeout = CLAMP(timeout, BT_GAP_PER_ADV_MIN_TIMEOUT, BT_GAP_PER_ADV_MAX_TIMEOUT); diff --git a/tests/bluetooth/gap/CMakeLists.txt b/tests/bluetooth/gap/CMakeLists.txt new file mode 100644 index 0000000000000..d4840d68a8772 --- /dev/null +++ b/tests/bluetooth/gap/CMakeLists.txt @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +project(bt_gap) + +target_sources(testbinary + PRIVATE + src/main.c +) diff --git a/tests/bluetooth/gap/prj.conf b/tests/bluetooth/gap/prj.conf new file mode 100644 index 0000000000000..4fa075fb74159 --- /dev/null +++ b/tests/bluetooth/gap/prj.conf @@ -0,0 +1,3 @@ +CONFIG_ZTEST=y + +CONFIG_BT=y diff --git a/tests/bluetooth/gap/src/main.c b/tests/bluetooth/gap/src/main.c new file mode 100644 index 0000000000000..1c4e48393be3b --- /dev/null +++ b/tests/bluetooth/gap/src/main.c @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include +#include +#include + +ZTEST_SUITE(gap_test_suite, NULL, NULL, NULL, NULL, NULL); + +static ZTEST(gap_test_suite, test_bt_gap_conversion_macros) +{ + zassert_equal(BT_GAP_ADV_INTERVAL_TO_US(0x0020U), 20000U); + zassert_equal(BT_GAP_ADV_INTERVAL_TO_US(0x0021U), 20625U); + zassert_equal(BT_GAP_ADV_INTERVAL_TO_US(0x0022U), 21250U); + + zassert_equal(BT_GAP_ADV_INTERVAL_TO_MS(0x0020U), 20U); + /* Round down expected from 20.625 */ + zassert_equal(BT_GAP_ADV_INTERVAL_TO_MS(0x0021U), 20U); + /* Round down expected from 21.250 */ + zassert_equal(BT_GAP_ADV_INTERVAL_TO_MS(0x0022U), 21U); + + zassert_equal(BT_GAP_ISO_INTERVAL_TO_US(0x0004U), 5000U); + zassert_equal(BT_GAP_ISO_INTERVAL_TO_US(0x0005U), 6250U); + zassert_equal(BT_GAP_ISO_INTERVAL_TO_US(0x0006U), 7500U); + + zassert_equal(BT_GAP_ISO_INTERVAL_TO_MS(0x0004U), 5U); + /* Round down expected from 6.25 */ + zassert_equal(BT_GAP_ISO_INTERVAL_TO_MS(0x0005U), 6U); + /* Round down expected from 7.50 */ + zassert_equal(BT_GAP_ISO_INTERVAL_TO_MS(0x0006U), 7U); + + zassert_equal(BT_GAP_PER_ADV_INTERVAL_TO_US(0x0008U), 10000U); + zassert_equal(BT_GAP_PER_ADV_INTERVAL_TO_US(0x0009U), 11250U); + zassert_equal(BT_GAP_PER_ADV_INTERVAL_TO_US(0x000aU), 12500U); + + zassert_equal(BT_GAP_PER_ADV_INTERVAL_TO_MS(0x0008U), 10U); + /* Round down expected from 11.25 */ + zassert_equal(BT_GAP_PER_ADV_INTERVAL_TO_MS(0x0009U), 11U); + /* Round down expected from 12.50 */ + zassert_equal(BT_GAP_PER_ADV_INTERVAL_TO_MS(0x000aU), 12U); + + zassert_equal(BT_GAP_US_TO_ADV_INTERVAL(20000U), 0x0020U); + /* Round down expected from 33.60 */ + zassert_equal(BT_GAP_US_TO_ADV_INTERVAL(21000U), 0x0021U); + /* Round down expected from 35.20 */ + zassert_equal(BT_GAP_US_TO_ADV_INTERVAL(22000U), 0x0023U); + + zassert_equal(BT_GAP_MS_TO_ADV_INTERVAL(20U), 0x0020U); + /* Round down expected from 33.60 */ + zassert_equal(BT_GAP_MS_TO_ADV_INTERVAL(21U), 0x0021U); + /* Round down expected from 35.20 */ + zassert_equal(BT_GAP_MS_TO_ADV_INTERVAL(22U), 0x0023U); + + zassert_equal(BT_GAP_US_TO_PER_ADV_INTERVAL(10000U), 0x0008U); + /* Round down expected from 8.8 */ + zassert_equal(BT_GAP_US_TO_PER_ADV_INTERVAL(11000U), 0x0008U); + /* Round down expected from 9.6 */ + zassert_equal(BT_GAP_US_TO_PER_ADV_INTERVAL(12000U), 0x0009U); + + zassert_equal(BT_GAP_MS_TO_PER_ADV_INTERVAL(10U), 0x0008U); + /* Round down expected from 8.8 */ + zassert_equal(BT_GAP_MS_TO_PER_ADV_INTERVAL(11U), 0x0008U); + /* Round down expected from 9.6 */ + zassert_equal(BT_GAP_MS_TO_PER_ADV_INTERVAL(12U), 0x0009U); + + zassert_equal(BT_GAP_MS_TO_PER_ADV_SYNC_TIMEOUT(4000U), 0x0190U); + /* Round down expected from 400.5 */ + zassert_equal(BT_GAP_MS_TO_PER_ADV_SYNC_TIMEOUT(4005U), 0x0190U); + + zassert_equal(BT_GAP_US_TO_PER_ADV_SYNC_TIMEOUT(4000000U), 0x0190U); + /* Round down expected from 400.5 */ + zassert_equal(BT_GAP_US_TO_PER_ADV_SYNC_TIMEOUT(4005000U), 0x0190U); + + zassert_equal(BT_GAP_US_TO_SCAN_INTERVAL(20000U), 0x0020U); + /* Round down expected from 33.60 */ + zassert_equal(BT_GAP_US_TO_SCAN_INTERVAL(21000U), 0x0021U); + /* Round down expected from 35.20 */ + zassert_equal(BT_GAP_US_TO_SCAN_INTERVAL(22000U), 0x0023U); + + zassert_equal(BT_GAP_MS_TO_SCAN_INTERVAL(20U), 0x0020U); + /* Round down expected from 33.60 */ + zassert_equal(BT_GAP_MS_TO_SCAN_INTERVAL(21U), 0x0021U); + /* Round down expected from 35.20 */ + zassert_equal(BT_GAP_MS_TO_SCAN_INTERVAL(22U), 0x0023U); + + zassert_equal(BT_GAP_US_TO_SCAN_WINDOW(20000U), 0x0020U); + /* Round down expected from 33.60 */ + zassert_equal(BT_GAP_US_TO_SCAN_WINDOW(21000U), 0x0021U); + /* Round down expected from 35.20 */ + zassert_equal(BT_GAP_US_TO_SCAN_WINDOW(22000U), 0x0023U); + + zassert_equal(BT_GAP_MS_TO_SCAN_WINDOW(20U), 0x0020U); + /* Round down expected from 33.60 */ + zassert_equal(BT_GAP_MS_TO_SCAN_WINDOW(21U), 0x0021U); + /* Round down expected from 35.20 */ + zassert_equal(BT_GAP_MS_TO_SCAN_WINDOW(22U), 0x0023U); + + zassert_equal(BT_GAP_US_TO_CONN_INTERVAL(10000U), 0x0008U); + /* Round down expected from 8.8 */ + zassert_equal(BT_GAP_US_TO_CONN_INTERVAL(11000U), 0x0008U); + /* Round down expected from 9.6 */ + zassert_equal(BT_GAP_US_TO_CONN_INTERVAL(12000U), 0x0009U); + + zassert_equal(BT_GAP_MS_TO_CONN_INTERVAL(10U), 0x0008U); + /* Round down expected from 8.8 */ + zassert_equal(BT_GAP_MS_TO_CONN_INTERVAL(11U), 0x0008U); + /* Round down expected from 9.6 */ + zassert_equal(BT_GAP_MS_TO_CONN_INTERVAL(12U), 0x0009U); + + zassert_equal(BT_GAP_MS_TO_CONN_TIMEOUT(4000U), 0x0190U); + /* Round down expected from 400.5 */ + zassert_equal(BT_GAP_MS_TO_CONN_TIMEOUT(4005U), 0x0190U); + + zassert_equal(BT_GAP_US_TO_CONN_TIMEOUT(4000000U), 0x0190U); + /* Round down expected from 400.5 */ + zassert_equal(BT_GAP_US_TO_CONN_TIMEOUT(4005000U), 0x0190U); + + zassert_equal(BT_GAP_US_TO_CONN_EVENT_LEN(20000U), 0x0020U); + /* Round down expected from 33.60 */ + zassert_equal(BT_GAP_US_TO_CONN_EVENT_LEN(21000U), 0x0021U); + /* Round down expected from 35.20 */ + zassert_equal(BT_GAP_US_TO_CONN_EVENT_LEN(22000U), 0x0023U); + + zassert_equal(BT_GAP_MS_TO_CONN_EVENT_LEN(20U), 0x0020U); + /* Round down expected from 33.60 */ + zassert_equal(BT_GAP_MS_TO_CONN_EVENT_LEN(21U), 0x0021U); + /* Round down expected from 35.20 */ + zassert_equal(BT_GAP_MS_TO_CONN_EVENT_LEN(22U), 0x0023U); +} diff --git a/tests/bluetooth/gap/testcase.yaml b/tests/bluetooth/gap/testcase.yaml new file mode 100644 index 0000000000000..863ae5978869c --- /dev/null +++ b/tests/bluetooth/gap/testcase.yaml @@ -0,0 +1,7 @@ +common: + tags: + - bluetooth + - host +tests: + bluetooth.gap.test: + type: unit diff --git a/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c b/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c index 4a93c343a95fe..01ffe5b901614 100644 --- a/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c +++ b/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "bap_endpoint.h" #include @@ -1261,8 +1262,9 @@ static void bap_broadcast_assistant_scan_cb(const struct bt_le_scan_recv_info *i char le_addr[BT_ADDR_LE_STR_LEN]; bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr)); - LOG_DBG("[DEVICE]: %s, broadcast_id 0x%06X, interval (ms) %u), SID 0x%x, RSSI %i", le_addr, - broadcast_id, BT_GAP_PER_ADV_INTERVAL_TO_MS(info->interval), info->sid, info->rssi); + LOG_DBG("[DEVICE]: %s, broadcast_id 0x%06X, interval (ms) %u (0x%04x)), SID 0x%x, RSSI %i", + le_addr, broadcast_id, BT_GAP_PER_ADV_INTERVAL_TO_MS(info->interval), + info->interval, info->sid, info->rssi); } static void bap_broadcast_assistant_recv_state_cb(struct bt_conn *conn, int err, diff --git a/tests/bluetooth/tester/src/btp_gap.c b/tests/bluetooth/tester/src/btp_gap.c index d4cfa91ca6848..f08269570e51c 100644 --- a/tests/bluetooth/tester/src/btp_gap.c +++ b/tests/bluetooth/tester/src/btp_gap.c @@ -989,7 +989,8 @@ static uint8_t connect(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len) { const struct bt_le_conn_param *conn_param = - BT_LE_CONN_PARAM(BT_GAP_INIT_CONN_INT_MIN, BT_GAP_INIT_CONN_INT_MIN, 0, 400); + BT_LE_CONN_PARAM(BT_GAP_INIT_CONN_INT_MIN, BT_GAP_INIT_CONN_INT_MIN, 0, + BT_GAP_MS_TO_CONN_TIMEOUT(4000)); const struct btp_gap_connect_cmd *cp = cmd; int err; diff --git a/tests/bsim/bluetooth/audio/src/cap_commander_test.c b/tests/bsim/bluetooth/audio/src/cap_commander_test.c index e35aa6ec92def..0b2c1f48ab6f5 100644 --- a/tests/bsim/bluetooth/audio/src/cap_commander_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_commander_test.c @@ -607,10 +607,10 @@ static void cap_device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type return; } - err = bt_conn_le_create( - addr, BT_CONN_LE_CREATE_CONN, - BT_LE_CONN_PARAM(BT_GAP_INIT_CONN_INT_MIN, BT_GAP_INIT_CONN_INT_MIN, 0, 400), - &connected_conns[connected_conn_cnt]); + err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, + BT_LE_CONN_PARAM(BT_GAP_INIT_CONN_INT_MIN, BT_GAP_INIT_CONN_INT_MIN, + 0, BT_GAP_MS_TO_CONN_TIMEOUT(4000)), + &connected_conns[connected_conn_cnt]); if (err) { FAIL("Could not connect to peer: %d", err); } diff --git a/tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c b/tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c index 9b9ad2d335490..b81b1cfe18d4f 100644 --- a/tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c @@ -38,14 +38,13 @@ * required to place the AUX_ADV_IND PDUs in a non-overlapping interval with the * Broadcast ISO radio events. */ -#define BT_LE_EXT_ADV_CUSTOM \ - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV, \ - 0x0080, 0x0080, NULL) - -#define BT_LE_PER_ADV_CUSTOM \ - BT_LE_PER_ADV_PARAM(0x0048, \ - 0x0048, \ - BT_LE_PER_ADV_OPT_NONE) +#define BT_LE_EXT_ADV_CUSTOM \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV, BT_GAP_MS_TO_ADV_INTERVAL(80), \ + BT_GAP_MS_TO_ADV_INTERVAL(80), NULL) + +#define BT_LE_PER_ADV_CUSTOM \ + BT_LE_PER_ADV_PARAM(BT_GAP_MS_TO_PER_ADV_INTERVAL(90), BT_GAP_MS_TO_PER_ADV_INTERVAL(90), \ + BT_LE_PER_ADV_OPT_NONE) #define BROADCAST_STREMT_CNT CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT #define BROADCAST_ENQUEUE_COUNT 2U diff --git a/tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c b/tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c index bd98e6a5c0928..920d4b6631778 100644 --- a/tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c @@ -438,10 +438,10 @@ static void cap_device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type return; } - err = bt_conn_le_create( - addr, BT_CONN_LE_CREATE_CONN, - BT_LE_CONN_PARAM(BT_GAP_INIT_CONN_INT_MIN, BT_GAP_INIT_CONN_INT_MIN, 0, 400), - &connected_conns[connected_conn_cnt]); + err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, + BT_LE_CONN_PARAM(BT_GAP_INIT_CONN_INT_MIN, BT_GAP_INIT_CONN_INT_MIN, + 0, BT_GAP_MS_TO_CONN_TIMEOUT(4000)), + &connected_conns[connected_conn_cnt]); if (err) { FAIL("Could not connect to peer: %d", err); } diff --git a/tests/bsim/bluetooth/audio/src/common.c b/tests/bsim/bluetooth/audio/src/common.c index ea4f781dda4a6..7931ed1adb8f9 100644 --- a/tests/bsim/bluetooth/audio/src/common.c +++ b/tests/bsim/bluetooth/audio/src/common.c @@ -231,12 +231,13 @@ uint16_t interval_to_sync_timeout(uint16_t pa_interval) /* Use maximum value to maximize chance of success */ pa_timeout = BT_GAP_PER_ADV_MAX_TIMEOUT; } else { - uint32_t interval_ms; + uint32_t interval_us; uint32_t timeout; /* Add retries and convert to unit in 10's of ms */ - interval_ms = BT_GAP_PER_ADV_INTERVAL_TO_MS(pa_interval); - timeout = (interval_ms * PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO) / 10; + interval_us = BT_GAP_PER_ADV_INTERVAL_TO_US(pa_interval); + timeout = BT_GAP_US_TO_PER_ADV_SYNC_TIMEOUT(interval_us) * + PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO; /* Enforce restraints */ pa_timeout = CLAMP(timeout, BT_GAP_PER_ADV_MIN_TIMEOUT, BT_GAP_PER_ADV_MAX_TIMEOUT); diff --git a/tests/bsim/bluetooth/audio/src/gmap_ugg_test.c b/tests/bsim/bluetooth/audio/src/gmap_ugg_test.c index c50f5104f0ddf..a151293612885 100644 --- a/tests/bsim/bluetooth/audio/src/gmap_ugg_test.c +++ b/tests/bsim/bluetooth/audio/src/gmap_ugg_test.c @@ -44,14 +44,13 @@ * required to place the AUX_ADV_IND PDUs in a non-overlapping interval with the * Broadcast ISO radio events. */ -#define BT_LE_EXT_ADV_CUSTOM \ - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV, \ - 0x0080, 0x0080, NULL) +#define BT_LE_EXT_ADV_CUSTOM \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV, BT_GAP_MS_TO_ADV_INTERVAL(80), \ + BT_GAP_MS_TO_ADV_INTERVAL(80), NULL) -#define BT_LE_PER_ADV_CUSTOM \ - BT_LE_PER_ADV_PARAM(0x0048, \ - 0x0048, \ - BT_LE_PER_ADV_OPT_NONE) +#define BT_LE_PER_ADV_CUSTOM \ + BT_LE_PER_ADV_PARAM(BT_GAP_MS_TO_PER_ADV_INTERVAL(90), BT_GAP_MS_TO_PER_ADV_INTERVAL(90), \ + BT_LE_PER_ADV_OPT_NONE) #define UNICAST_SINK_SUPPORTED (CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT > 0) #define UNICAST_SRC_SUPPORTED (CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT > 0) @@ -546,10 +545,10 @@ static void gmap_device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t typ return; } - err = bt_conn_le_create( - addr, BT_CONN_LE_CREATE_CONN, - BT_LE_CONN_PARAM(BT_GAP_INIT_CONN_INT_MIN, BT_GAP_INIT_CONN_INT_MIN, 0, 400), - &connected_conns[connected_conn_cnt]); + err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, + BT_LE_CONN_PARAM(BT_GAP_INIT_CONN_INT_MIN, BT_GAP_INIT_CONN_INT_MIN, + 0, BT_GAP_MS_TO_CONN_TIMEOUT(4000)), + &connected_conns[connected_conn_cnt]); if (err) { FAIL("Could not connect to peer: %d", err); } diff --git a/tests/bsim/bluetooth/audio/src/mcc_test.c b/tests/bsim/bluetooth/audio/src/mcc_test.c index b6c0fedf5228b..6c098e3922ea5 100644 --- a/tests/bsim/bluetooth/audio/src/mcc_test.c +++ b/tests/bsim/bluetooth/audio/src/mcc_test.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -2462,7 +2463,10 @@ void test_main(void) bt_addr_le_to_str(bt_conn_get_dst(default_conn), addr, sizeof(addr)); printk("Connected: %s\n", addr); - bt_conn_le_param_update(default_conn, BT_LE_CONN_PARAM(0x06U, 0x10U, 0U, 400U)); + bt_conn_le_param_update(default_conn, + BT_LE_CONN_PARAM(BT_GAP_US_TO_CONN_INTERVAL(7500), + BT_GAP_US_TO_CONN_INTERVAL(20000), 0U, + BT_GAP_MS_TO_CONN_TIMEOUT(4000U))); WAIT_FOR_FLAG(flag_conn_updated); test_discover(); diff --git a/tests/bsim/bluetooth/host/iso/bis/src/bis_receiver.c b/tests/bsim/bluetooth/host/iso/bis/src/bis_receiver.c index 7e6876064ac51..ac72cd26694c0 100644 --- a/tests/bsim/bluetooth/host/iso/bis/src/bis_receiver.c +++ b/tests/bsim/bluetooth/host/iso/bis/src/bis_receiver.c @@ -4,11 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include "common.h" #include +#include #include #include +#include #include "babblekit/flags.h" #include "babblekit/sync.h" @@ -176,18 +179,18 @@ static void init(void) static uint16_t interval_to_sync_timeout(uint16_t pa_interval) { - uint32_t interval_ms; - uint16_t pa_timeout; + uint32_t interval_us; uint32_t timeout; /* Add retries and convert to unit in 10's of ms */ - interval_ms = BT_GAP_PER_ADV_INTERVAL_TO_MS(pa_interval); - timeout = (interval_ms * PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO) / 10U; + interval_us = BT_GAP_PER_ADV_INTERVAL_TO_US(pa_interval); + timeout = + BT_GAP_US_TO_PER_ADV_SYNC_TIMEOUT(interval_us) * PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO; /* Enforce restraints */ - pa_timeout = CLAMP(timeout, BT_GAP_PER_ADV_MIN_TIMEOUT, BT_GAP_PER_ADV_MAX_TIMEOUT); + timeout = CLAMP(timeout, BT_GAP_PER_ADV_MIN_TIMEOUT, BT_GAP_PER_ADV_MAX_TIMEOUT); - return pa_timeout; + return timeout; } static void scan_and_sync_pa(struct bt_le_per_adv_sync **out_sync) diff --git a/tests/bsim/bluetooth/ll/cis/src/main.c b/tests/bsim/bluetooth/ll/cis/src/main.c index 2e5e8eeebf394..a3a8b0c91697c 100644 --- a/tests/bsim/bluetooth/ll/cis/src/main.c +++ b/tests/bsim/bluetooth/ll/cis/src/main.c @@ -6,6 +6,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include #include #include @@ -14,6 +15,8 @@ #include #include #include +#include +#include #include "bs_types.h" #include "bs_tracing.h" @@ -52,19 +55,20 @@ static bt_addr_le_t peer_addr; #define ISO_LATENCY_MS DIV_ROUND_UP(ISO_INTERVAL_US, USEC_PER_MSEC) #define ISO_LATENCY_FT_MS 20U -#define BT_CONN_US_TO_INTERVAL(t) ((uint16_t)((t) * 4U / 5U / USEC_PER_MSEC)) - #if (CONFIG_BT_CTLR_CENTRAL_SPACING == 0) -#define CONN_INTERVAL_MIN BT_CONN_US_TO_INTERVAL(ISO_INTERVAL_US) +#define CONN_INTERVAL_MIN_US ISO_INTERVAL_US #else /* CONFIG_BT_CTLR_CENTRAL_SPACING > 0 */ -#define CONN_INTERVAL_MIN BT_CONN_US_TO_INTERVAL(ISO_INTERVAL_US * CONFIG_BT_MAX_CONN) +#define CONN_INTERVAL_MIN_US (ISO_INTERVAL_US * CONFIG_BT_MAX_CONN) #endif /* CONFIG_BT_CTLR_CENTRAL_SPACING > 0 */ +#define CONN_INTERVAL_MAX_US CONN_INTERVAL_MIN_US -#define CONN_INTERVAL_MAX CONN_INTERVAL_MIN -#define CONN_TIMEOUT MAX((BT_CONN_INTERVAL_TO_MS(CONN_INTERVAL_MAX) * 6U / 10U), 10U) +#define CONN_INTERVAL_MIN BT_GAP_US_TO_CONN_INTERVAL(CONN_INTERVAL_MIN_US) +#define CONN_INTERVAL_MAX BT_GAP_US_TO_CONN_INTERVAL(CONN_INTERVAL_MAX_US) +#define CONN_TIMEOUT \ + MAX(BT_GAP_US_TO_CONN_TIMEOUT(CONN_INTERVAL_MAX_US * 6U), BT_GAP_MS_TO_CONN_TIMEOUT(100U)) -#define ADV_INTERVAL_MIN 0x0020 -#define ADV_INTERVAL_MAX 0x0020 +#define ADV_INTERVAL_MIN BT_GAP_MS_TO_ADV_INTERVAL(20) +#define ADV_INTERVAL_MAX BT_GAP_MS_TO_ADV_INTERVAL(20) #define BT_CONN_LE_CREATE_CONN_CUSTOM \ BT_CONN_LE_CREATE_PARAM(BT_CONN_LE_OPT_NONE, \ From 2ee5a24417f9231e643df99bdcf927aa8440db57 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Thu, 7 Nov 2024 10:59:30 +0100 Subject: [PATCH 2505/4482] scripts: ci: check_compliance: Simplify line number in loop Use the builtin enumerate function rather than a manual variable. Signed-off-by: Pieter De Gendt --- scripts/ci/check_compliance.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 63e7fb948b73c..5a3f1deda2522 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -346,9 +346,7 @@ def parse_dt_bindings(self): def required_false_check(self, dts_binding): with open(dts_binding) as file: - line_number = 0 - for line in file: - line_number += 1 + for line_number, line in enumerate(file, 1): if 'required: false' in line: self.fmtd_failure( 'warning', 'Devicetree Bindings', dts_binding, From 4a94a331646b0c38a320ee1ceba4505f8621f7c3 Mon Sep 17 00:00:00 2001 From: Erwan Gouriou Date: Thu, 7 Nov 2024 10:49:52 +0100 Subject: [PATCH 2506/4482] drivers: i2c: stm32: LL API C filers are not required From some reason, STM32 I2C drivers selected the compilation of C files of the I2C LL API. This is actually not required, so remove this dependency. Signed-off-by: Erwan Gouriou --- drivers/i2c/Kconfig.stm32 | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/i2c/Kconfig.stm32 b/drivers/i2c/Kconfig.stm32 index 9ebe684c1d3bf..b07dc5ca589c7 100644 --- a/drivers/i2c/Kconfig.stm32 +++ b/drivers/i2c/Kconfig.stm32 @@ -15,7 +15,6 @@ config I2C_STM32_V1 bool default y depends on DT_HAS_ST_STM32_I2C_V1_ENABLED - select USE_STM32_LL_I2C select I2C_STM32_INTERRUPT if I2C_TARGET help Driver variant matching `st,stm32-i2c-v1` compatible. @@ -24,8 +23,6 @@ config I2C_STM32_V2 bool default y depends on DT_HAS_ST_STM32_I2C_V2_ENABLED - select USE_STM32_LL_I2C - select USE_STM32_LL_RCC if SOC_SERIES_STM32F0X || SOC_SERIES_STM32F3X select I2C_STM32_INTERRUPT if I2C_TARGET help Driver variant matching `st,stm32-i2c-v2` compatible. From bedb7e16c3b0c091f90ff64de760ec7dc9580a3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Thu, 7 Nov 2024 10:39:24 +0100 Subject: [PATCH 2507/4482] tests: kernel: timer: timer_behavior: Adjust TIMER_TEST_SAMPLES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adjust default number of test samples which is based on SRAM size. Test is using 8*TIMER_TEST_SAMPLES and with previous defaults for the device with 64k RAM it was using 56k of test data leaving only 8k RAM and that was easily not enough. Adjust conditions to take less samples when SRAM_SIZE is equal to the threshold. Signed-off-by: Krzysztof Chruściński --- tests/kernel/timer/timer_behavior/Kconfig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/kernel/timer/timer_behavior/Kconfig b/tests/kernel/timer/timer_behavior/Kconfig index fa954f000a12d..5203544167626 100644 --- a/tests/kernel/timer/timer_behavior/Kconfig +++ b/tests/kernel/timer/timer_behavior/Kconfig @@ -10,11 +10,11 @@ source "Kconfig.zephyr" config TIMER_TEST_SAMPLES int "The number of timer samples to gather for statistics" - default 1000 if (SRAM_SIZE < 24) - default 2000 if (SRAM_SIZE < 32) - default 3000 if (SRAM_SIZE < 48) - default 5000 if (SRAM_SIZE < 64) - default 7000 if (SRAM_SIZE < 96) + default 1000 if (SRAM_SIZE <= 24) + default 2000 if (SRAM_SIZE <= 32) + default 3000 if (SRAM_SIZE <= 48) + default 5000 if (SRAM_SIZE <= 64) + default 7000 if (SRAM_SIZE <= 96) default 10000 config TIMER_TEST_PERIOD From 6bc6e4e5c2f7578ab141c10097eea66bef994575 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 7 Nov 2024 08:35:43 +0000 Subject: [PATCH 2508/4482] soc: mediatek: mtk_adsp: Fix wrong hwmv2 Kconfigs Fixes Kconfigs for hwmv2 being defined in the wrong files Signed-off-by: Jamie McCrae --- soc/mediatek/mtk_adsp/Kconfig | 13 ------------- soc/mediatek/mtk_adsp/Kconfig.defconfig | 3 --- soc/mediatek/mtk_adsp/Kconfig.soc | 18 ++++++++++++++++++ .../mtk_adsp/mt8195_adsp/Kconfig.defconfig | 6 ------ 4 files changed, 18 insertions(+), 22 deletions(-) diff --git a/soc/mediatek/mtk_adsp/Kconfig b/soc/mediatek/mtk_adsp/Kconfig index 21e4c1adaa33f..a2887dff32851 100644 --- a/soc/mediatek/mtk_adsp/Kconfig +++ b/soc/mediatek/mtk_adsp/Kconfig @@ -2,18 +2,5 @@ # SPDX-License-Identifier: Apache-2.0 config SOC_FAMILY_MTK_ADSP - bool select XTENSA select XTENSA_GEN_HANDLERS - help - Mediatek MT8xxx Series Audio DSPs - -config SOC_SERIES_MT8195_ADSP - bool - select SOC_FAMILY_MTK_ADSP - help - Mediatek MT8195 Audio DSP - -config SOC_MT8195_ADSP - bool - select SOC_SERIES_MT8195_ADSP diff --git a/soc/mediatek/mtk_adsp/Kconfig.defconfig b/soc/mediatek/mtk_adsp/Kconfig.defconfig index 84452a9be8d80..b25781651b4b0 100644 --- a/soc/mediatek/mtk_adsp/Kconfig.defconfig +++ b/soc/mediatek/mtk_adsp/Kconfig.defconfig @@ -5,9 +5,6 @@ orsource "*/Kconfig.defconfig" if SOC_FAMILY_MTK_ADSP -config SOC_FAMILY - default "mtk_adsp" - config INTC_MTK_ADSP default y diff --git a/soc/mediatek/mtk_adsp/Kconfig.soc b/soc/mediatek/mtk_adsp/Kconfig.soc index 8d0a6cd0ac273..37e4f45228795 100644 --- a/soc/mediatek/mtk_adsp/Kconfig.soc +++ b/soc/mediatek/mtk_adsp/Kconfig.soc @@ -1,8 +1,26 @@ # Copyright 2024 The ChromiumOS Authors # SPDX-License-Identifier: Apache-2.0 +config SOC_FAMILY_MTK_ADSP + bool + help + Mediatek MT8xxx Series Audio DSPs + +config SOC_SERIES_MT8195_ADSP + bool + select SOC_FAMILY_MTK_ADSP + help + Mediatek MT8195 Audio DSP + config SOC_MT8195_ADSP bool + select SOC_SERIES_MT8195_ADSP + +config SOC_FAMILY + default "mtk_adsp" if SOC_FAMILY_MTK_ADSP + +config SOC_SERIES + default "mt8195_adsp" if SOC_SERIES_MT8195_ADSP config SOC default "mt8195_adsp" if SOC_MT8195_ADSP diff --git a/soc/mediatek/mtk_adsp/mt8195_adsp/Kconfig.defconfig b/soc/mediatek/mtk_adsp/mt8195_adsp/Kconfig.defconfig index 6d834a20fb89c..e50e98f004c3d 100644 --- a/soc/mediatek/mtk_adsp/mt8195_adsp/Kconfig.defconfig +++ b/soc/mediatek/mtk_adsp/mt8195_adsp/Kconfig.defconfig @@ -3,12 +3,6 @@ if SOC_SERIES_MT8195_ADSP -config SOC - default "mt8195_adsp" - -config SOC_SERIES - default "mt8195_adsp" - config NUM_2ND_LEVEL_AGGREGATORS default 2 config 2ND_LVL_INTR_00_OFFSET From 557a2c6cbd9da8b13b21d3148a42e1513e654d5d Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 7 Nov 2024 08:37:09 +0000 Subject: [PATCH 2509/4482] soc: nxp: imx: imx8m: Remove wrong Kconfig setting Removes setting a Kconfig in the wrong place Signed-off-by: Jamie McCrae --- soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8ml8_m7 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8ml8_m7 b/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8ml8_m7 index dec2384897c32..b35dc400e6017 100644 --- a/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8ml8_m7 +++ b/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8ml8_m7 @@ -6,10 +6,6 @@ if SOC_MIMX8ML8_M7 -config SOC - string - default "mimx8ml8" - config SYS_CLOCK_HW_CYCLES_PER_SEC int default 800000000 From 73f3f7dbefbfb8cc749045239401f5974b2e274d Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 7 Nov 2024 08:39:22 +0000 Subject: [PATCH 2510/4482] soc: gd: gd32: Remove setting Kconfig in wrong place This Kconfig should not be set from here Signed-off-by: Jamie McCrae --- soc/gd/gd32/gd32a50x/Kconfig.defconfig.series | 3 --- soc/gd/gd32/gd32e10x/Kconfig.defconfig.series | 3 --- soc/gd/gd32/gd32e50x/Kconfig.defconfig.series | 3 --- soc/gd/gd32/gd32f3x0/Kconfig.defconfig.series | 3 --- soc/gd/gd32/gd32f4xx/Kconfig.defconfig.series | 3 --- soc/gd/gd32/gd32l23x/Kconfig.defconfig.series | 3 --- 6 files changed, 18 deletions(-) diff --git a/soc/gd/gd32/gd32a50x/Kconfig.defconfig.series b/soc/gd/gd32/gd32a50x/Kconfig.defconfig.series index f54d52b13c9cd..9d07bc634d3e6 100644 --- a/soc/gd/gd32/gd32a50x/Kconfig.defconfig.series +++ b/soc/gd/gd32/gd32a50x/Kconfig.defconfig.series @@ -3,9 +3,6 @@ if SOC_SERIES_GD32A50X -config SOC_SERIES - default "gd32a50x" - rsource "Kconfig.defconfig.gd32*" endif # SOC_SERIES_GD32A50X diff --git a/soc/gd/gd32/gd32e10x/Kconfig.defconfig.series b/soc/gd/gd32/gd32e10x/Kconfig.defconfig.series index 2aec533c23ccd..3cdbfc07643f2 100644 --- a/soc/gd/gd32/gd32e10x/Kconfig.defconfig.series +++ b/soc/gd/gd32/gd32e10x/Kconfig.defconfig.series @@ -3,9 +3,6 @@ if SOC_SERIES_GD32E10X -config SOC_SERIES - default "gd32e10x" - rsource "Kconfig.defconfig.gd32*" endif # SOC_SERIES_GD32E10X diff --git a/soc/gd/gd32/gd32e50x/Kconfig.defconfig.series b/soc/gd/gd32/gd32e50x/Kconfig.defconfig.series index 1b9f8b981502b..8a17573d8fbbf 100644 --- a/soc/gd/gd32/gd32e50x/Kconfig.defconfig.series +++ b/soc/gd/gd32/gd32e50x/Kconfig.defconfig.series @@ -3,9 +3,6 @@ if SOC_SERIES_GD32E50X -config SOC_SERIES - default "gd32e50x" - rsource "Kconfig.defconfig.gd32*" endif # SOC_SERIES_GD32E50X diff --git a/soc/gd/gd32/gd32f3x0/Kconfig.defconfig.series b/soc/gd/gd32/gd32f3x0/Kconfig.defconfig.series index 0bb139d227fe8..d84b9051515d4 100644 --- a/soc/gd/gd32/gd32f3x0/Kconfig.defconfig.series +++ b/soc/gd/gd32/gd32f3x0/Kconfig.defconfig.series @@ -3,9 +3,6 @@ if SOC_SERIES_GD32F3X0 -config SOC_SERIES - default "gd32f3x0" - rsource "Kconfig.defconfig.gd32*" endif # SOC_SERIES_GD32F3X0 diff --git a/soc/gd/gd32/gd32f4xx/Kconfig.defconfig.series b/soc/gd/gd32/gd32f4xx/Kconfig.defconfig.series index aa626c9523f9b..fe2356d8d5acb 100644 --- a/soc/gd/gd32/gd32f4xx/Kconfig.defconfig.series +++ b/soc/gd/gd32/gd32f4xx/Kconfig.defconfig.series @@ -3,9 +3,6 @@ if SOC_SERIES_GD32F4XX -config SOC_SERIES - default "gd32f4xx" - rsource "Kconfig.defconfig.gd32*" endif # SOC_SERIES_GD32F4XX diff --git a/soc/gd/gd32/gd32l23x/Kconfig.defconfig.series b/soc/gd/gd32/gd32l23x/Kconfig.defconfig.series index bc8b2aa4cde86..31f2afa40b630 100644 --- a/soc/gd/gd32/gd32l23x/Kconfig.defconfig.series +++ b/soc/gd/gd32/gd32l23x/Kconfig.defconfig.series @@ -3,9 +3,6 @@ if SOC_SERIES_GD32L23X -config SOC_SERIES - default "gd32l23x" - rsource "Kconfig.defconfig.gd32*" endif # SOC_SERIES_GD32L23X From b77c50d7b8c0941c491fd2f8445658d9d79f8e09 Mon Sep 17 00:00:00 2001 From: Maxime Vincent Date: Thu, 7 Nov 2024 09:08:56 +0100 Subject: [PATCH 2511/4482] soc: arm: nxp: lpc55xx flexcomm 3->7 clock init Add clock init for FlexComm 3,4,5,6,7 in case they are enabled in DeviceTree Signed-off-by: Maxime Vincent --- soc/nxp/lpc/lpc55xxx/soc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/soc/nxp/lpc/lpc55xxx/soc.c b/soc/nxp/lpc/lpc55xxx/soc.c index 1959b525e92e4..7b7332d0b61bc 100644 --- a/soc/nxp/lpc/lpc55xxx/soc.c +++ b/soc/nxp/lpc/lpc55xxx/soc.c @@ -184,6 +184,10 @@ static ALWAYS_INLINE void clock_init(void) CLOCK_AttachClk(kFRO12M_to_FLEXCOMM2); #endif +#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm3), nxp_lpc_usart, okay) + CLOCK_AttachClk(kFRO_HF_DIV_to_FLEXCOMM3); +#endif + #if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm4), nxp_lpc_i2c, okay) #if defined(CONFIG_SOC_LPC55S36) CLOCK_SetClkDiv(kCLOCK_DivFlexcom4Clk, 0U, true); @@ -193,6 +197,22 @@ static ALWAYS_INLINE void clock_init(void) CLOCK_AttachClk(kFRO12M_to_FLEXCOMM4); #endif +#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm4), nxp_lpc_usart, okay) + CLOCK_AttachClk(kFRO_HF_DIV_to_FLEXCOMM4); +#endif + +#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm5), nxp_lpc_usart, okay) + CLOCK_AttachClk(kFRO_HF_DIV_to_FLEXCOMM5); +#endif + +#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm6), nxp_lpc_usart, okay) + CLOCK_AttachClk(kFRO_HF_DIV_to_FLEXCOMM6); +#endif + +#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm7), nxp_lpc_usart, okay) + CLOCK_AttachClk(kFRO_HF_DIV_to_FLEXCOMM7); +#endif + #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(hs_lspi)) /* Attach 12 MHz clock to HSLSPI */ CLOCK_AttachClk(kFRO_HF_DIV_to_HSLSPI); From 927420a42359ea69655093a001fe4ccfdf7835f1 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Thu, 7 Nov 2024 15:08:31 +0800 Subject: [PATCH 2512/4482] tests: sched: Add busy threads for SMP The sched benchmark is designed for systems with a single CPU. Otherwise, the timestamps would be wrong when the partner thread is scheduled on another CPU, i.e. negative values: ``` unpend 63 ready 62 switch -16562 pend 18937 tot 2500 (avg 928) ``` When the system allows for multiple CPUs, spawn a non-preemptible thread to keep the other CPUs busy. Signed-off-by: Yong Cong Sin --- tests/benchmarks/sched/src/main.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/benchmarks/sched/src/main.c b/tests/benchmarks/sched/src/main.c index a372ba3c1a835..e40b6a1afd095 100644 --- a/tests/benchmarks/sched/src/main.c +++ b/tests/benchmarks/sched/src/main.c @@ -36,6 +36,15 @@ static K_THREAD_STACK_DEFINE(partner_stack, 1024); static struct k_thread partner_thread; +#if (CONFIG_MP_MAX_NUM_CPUS > 1) +static struct k_thread busy_thread[CONFIG_MP_MAX_NUM_CPUS - 1]; + +#define BUSY_THREAD_STACK_SIZE (1024 + CONFIG_TEST_EXTRA_STACK_SIZE) + +static K_THREAD_STACK_ARRAY_DEFINE(busy_thread_stack, CONFIG_MP_MAX_NUM_CPUS - 1, + BUSY_THREAD_STACK_SIZE); +#endif /* (CONFIG_MP_MAX_NUM_CPUS > 1) */ + _wait_q_t waitq; enum { @@ -88,8 +97,26 @@ static void partner_fn(void *arg1, void *arg2, void *arg3) } } +#if (CONFIG_MP_MAX_NUM_CPUS > 1) +static void busy_thread_entry(void *arg1, void *arg2, void *arg3) +{ + while (true) { + } +} +#endif /* (CONFIG_MP_MAX_NUM_CPUS > 1) */ + int main(void) { +#if (CONFIG_MP_MAX_NUM_CPUS > 1) + /* Spawn busy threads that will execute on the other cores */ + for (uint32_t i = 0; i < CONFIG_MP_MAX_NUM_CPUS - 1; i++) { + k_thread_create(&busy_thread[i], busy_thread_stack[i], + BUSY_THREAD_STACK_SIZE, busy_thread_entry, + NULL, NULL, NULL, + K_HIGHEST_THREAD_PRIO, 0, K_NO_WAIT); + } +#endif /* (CONFIG_MP_MAX_NUM_CPUS > 1) */ + z_waitq_init(&waitq); int main_prio = k_thread_priority_get(k_current_get()); From e0ce096b91271992ad7535f47fbf38fd141f56e6 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Fri, 8 Nov 2024 13:04:16 +0800 Subject: [PATCH 2513/4482] tests: benchmarks/sched: limit CPU to 1 for Intel ADSP ACE Due to addition of busy threads running on other cores, and the simulator runs in single thread bouncing through all cores, we are wasting quite a bit of time just busy waiting. This makes each simulator run too long for CI. So limit CPU number to 1. Signed-off-by: Daniel Leung Signed-off-by: Yong Cong Sin --- .../benchmarks/sched/boards/intel_adsp_ace15_mtpm_sim.conf | 6 ++++++ tests/benchmarks/sched/boards/intel_adsp_ace20_lnl_sim.conf | 6 ++++++ tests/benchmarks/sched/boards/intel_adsp_ace30_ptl_sim.conf | 6 ++++++ 3 files changed, 18 insertions(+) create mode 100644 tests/benchmarks/sched/boards/intel_adsp_ace15_mtpm_sim.conf create mode 100644 tests/benchmarks/sched/boards/intel_adsp_ace20_lnl_sim.conf create mode 100644 tests/benchmarks/sched/boards/intel_adsp_ace30_ptl_sim.conf diff --git a/tests/benchmarks/sched/boards/intel_adsp_ace15_mtpm_sim.conf b/tests/benchmarks/sched/boards/intel_adsp_ace15_mtpm_sim.conf new file mode 100644 index 0000000000000..bad81b9ffbfa5 --- /dev/null +++ b/tests/benchmarks/sched/boards/intel_adsp_ace15_mtpm_sim.conf @@ -0,0 +1,6 @@ +# Due to addition of busy threads running on other cores, +# and the simulator runs in single thread bouncing through +# all cores, we are wasting quite a bit of time just busy +# waiting. This makes each simulator run too long for CI. +# So limit CPU number to 1. +CONFIG_MP_MAX_NUM_CPUS=1 diff --git a/tests/benchmarks/sched/boards/intel_adsp_ace20_lnl_sim.conf b/tests/benchmarks/sched/boards/intel_adsp_ace20_lnl_sim.conf new file mode 100644 index 0000000000000..bad81b9ffbfa5 --- /dev/null +++ b/tests/benchmarks/sched/boards/intel_adsp_ace20_lnl_sim.conf @@ -0,0 +1,6 @@ +# Due to addition of busy threads running on other cores, +# and the simulator runs in single thread bouncing through +# all cores, we are wasting quite a bit of time just busy +# waiting. This makes each simulator run too long for CI. +# So limit CPU number to 1. +CONFIG_MP_MAX_NUM_CPUS=1 diff --git a/tests/benchmarks/sched/boards/intel_adsp_ace30_ptl_sim.conf b/tests/benchmarks/sched/boards/intel_adsp_ace30_ptl_sim.conf new file mode 100644 index 0000000000000..bad81b9ffbfa5 --- /dev/null +++ b/tests/benchmarks/sched/boards/intel_adsp_ace30_ptl_sim.conf @@ -0,0 +1,6 @@ +# Due to addition of busy threads running on other cores, +# and the simulator runs in single thread bouncing through +# all cores, we are wasting quite a bit of time just busy +# waiting. This makes each simulator run too long for CI. +# So limit CPU number to 1. +CONFIG_MP_MAX_NUM_CPUS=1 From 2de5e601a70281b5c1ccb94a2602a7a80fa97435 Mon Sep 17 00:00:00 2001 From: Neil Chen Date: Thu, 7 Nov 2024 14:09:16 +0800 Subject: [PATCH 2514/4482] boards: frdm_mcxc444: Add lptmr support Support lptmr for NXP frdm_mcxc444 board Signed-off-by: Neil Chen --- boards/nxp/frdm_mcxc444/doc/index.rst | 2 ++ boards/nxp/frdm_mcxc444/frdm_mcxc444.dts | 4 ++++ boards/nxp/frdm_mcxc444/frdm_mcxc444.yaml | 1 + 3 files changed, 7 insertions(+) diff --git a/boards/nxp/frdm_mcxc444/doc/index.rst b/boards/nxp/frdm_mcxc444/doc/index.rst index 277a5a6495c26..254b4c1fd6ad8 100644 --- a/boards/nxp/frdm_mcxc444/doc/index.rst +++ b/boards/nxp/frdm_mcxc444/doc/index.rst @@ -55,6 +55,8 @@ The ``frdm_mcxc444`` board target supports the following hardware features: +-----------+------------+-------------------------------------+ | FLASH | on-chip | soc flash | +-----------+------------+-------------------------------------+ +| LPTMR | on-chip | counter | ++-----------+------------+-------------------------------------+ Targets available diff --git a/boards/nxp/frdm_mcxc444/frdm_mcxc444.dts b/boards/nxp/frdm_mcxc444/frdm_mcxc444.dts index 7e771a6072517..f574fdc13a103 100644 --- a/boards/nxp/frdm_mcxc444/frdm_mcxc444.dts +++ b/boards/nxp/frdm_mcxc444/frdm_mcxc444.dts @@ -96,3 +96,7 @@ pinctrl-0 = <&pinmux_lpuart0>; pinctrl-names = "default"; }; + +&lptmr0 { + status = "okay"; +}; diff --git a/boards/nxp/frdm_mcxc444/frdm_mcxc444.yaml b/boards/nxp/frdm_mcxc444/frdm_mcxc444.yaml index dc92b7dfeb293..1fe20ef5ccd88 100644 --- a/boards/nxp/frdm_mcxc444/frdm_mcxc444.yaml +++ b/boards/nxp/frdm_mcxc444/frdm_mcxc444.yaml @@ -16,6 +16,7 @@ toolchain: - xtools supported: - gpio + - counter testing: ignore_tags: - net From c9d6c4c744fc932d8b848c30250eeead9d1fd8c4 Mon Sep 17 00:00:00 2001 From: Mark Inderhees Date: Wed, 6 Nov 2024 16:47:26 -0800 Subject: [PATCH 2515/4482] compiler: for xtensa add libgcc support In order to compile with C++ exception handling for xtensa, the libgcc location needs to be known. This change uses the same logic from gcc's target.cmake to query the compiler for libgcc location and add the lib to the include list. Signed-off-by: Mark Inderhees --- cmake/compiler/xcc/target.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmake/compiler/xcc/target.cmake b/cmake/compiler/xcc/target.cmake index db965e715a839..f9e9c721a15e4 100644 --- a/cmake/compiler/xcc/target.cmake +++ b/cmake/compiler/xcc/target.cmake @@ -40,6 +40,17 @@ foreach(file_name include/stddef.h include-fixed/limits.h) list(APPEND NOSTDINC ${_OUTPUT}) endforeach() +# This libgcc code is partially duplicated in compiler/*/target.cmake +execute_process( + COMMAND ${CMAKE_C_COMPILER} ${TOOLCHAIN_C_FLAGS} --print-libgcc-file-name + OUTPUT_VARIABLE LIBGCC_FILE_NAME + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + +get_filename_component(LIBGCC_DIR ${LIBGCC_FILE_NAME} DIRECTORY) + +list(APPEND LIB_INCLUDE_DIR "-L\"${LIBGCC_DIR}\"") + # For CMake to be able to test if a compiler flag is supported by the # toolchain we need to give CMake the necessary flags to compile and # link a dummy C file. From a995d9d76f9876595c9e7736f48b673767c3a35a Mon Sep 17 00:00:00 2001 From: Mikhail Kushnerov Date: Wed, 6 Nov 2024 11:26:36 +0300 Subject: [PATCH 2516/4482] kernel: fix k_sleep in no multi-threading mode Fix k_sleep implementation for no multi-threading mode. Absolute value of timeout expiration was fed to the k_busy_wait() function instead of delta value. That caused bug like incrementing of sleep time in geometric progression (while actual function argument is constant) during program running. Signed-off-by: Mikhail Kushnerov --- kernel/nothread.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/kernel/nothread.c b/kernel/nothread.c index e4d7e095a2bdd..3e590e714b246 100644 --- a/kernel/nothread.c +++ b/kernel/nothread.c @@ -20,7 +20,7 @@ bool k_is_in_isr(void) int32_t z_impl_k_sleep(k_timeout_t timeout) { k_ticks_t ticks; - uint32_t expected_wakeup_ticks; + uint32_t ticks_to_wait; __ASSERT(!arch_is_in_isr(), ""); @@ -37,12 +37,20 @@ int32_t z_impl_k_sleep(k_timeout_t timeout) ticks = timeout.ticks; if (Z_TICK_ABS(ticks) <= 0) { - expected_wakeup_ticks = ticks + sys_clock_tick_get_32(); + /* ticks is delta timeout */ + ticks_to_wait = ticks; } else { - expected_wakeup_ticks = Z_TICK_ABS(ticks); + /* ticks is absolute timeout expiration */ + uint32_t curr_ticks = sys_clock_tick_get_32(); + + if (Z_TICK_ABS(ticks) > curr_ticks) { + ticks_to_wait = Z_TICK_ABS(ticks) - curr_ticks; + } else { + ticks_to_wait = 0; + } } /* busy wait to be time coherent since subsystems may depend on it */ - z_impl_k_busy_wait(k_ticks_to_us_ceil32(expected_wakeup_ticks)); + z_impl_k_busy_wait(k_ticks_to_us_ceil32(ticks_to_wait)); int32_t ret = k_ticks_to_ms_ceil64(0); From ab601ae05c041fb4e45c27a3f80097535dd2a597 Mon Sep 17 00:00:00 2001 From: Marvin Ouma Date: Wed, 6 Nov 2024 11:08:05 +0300 Subject: [PATCH 2517/4482] tests: posix: common: separate posix single process into a standalone test posix.common contains testsuites that can be separated into smaller groups of tests. This change moves confstr, sysconf and uname into a singular testsuite at tests/posix/single_process app directory. Signed-off-by: Marvin Ouma --- tests/posix/single_process/CMakeLists.txt | 11 ++++++++ tests/posix/single_process/prj.conf | 5 ++++ .../{common => single_process}/src/confstr.c | 4 +-- tests/posix/single_process/src/main.c | 10 ++++++++ .../{common => single_process}/src/sysconf.c | 7 ++---- .../{common => single_process}/src/uname.c | 4 +-- tests/posix/single_process/testcase.yaml | 25 +++++++++++++++++++ 7 files changed, 55 insertions(+), 11 deletions(-) create mode 100644 tests/posix/single_process/CMakeLists.txt create mode 100644 tests/posix/single_process/prj.conf rename tests/posix/{common => single_process}/src/confstr.c (93%) create mode 100644 tests/posix/single_process/src/main.c rename tests/posix/{common => single_process}/src/sysconf.c (82%) rename tests/posix/{common => single_process}/src/uname.c (81%) create mode 100644 tests/posix/single_process/testcase.yaml diff --git a/tests/posix/single_process/CMakeLists.txt b/tests/posix/single_process/CMakeLists.txt new file mode 100644 index 0000000000000..b7f056b2bbc30 --- /dev/null +++ b/tests/posix/single_process/CMakeLists.txt @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(posix_single_process) + +FILE(GLOB app_sources src/*.c) + +target_sources(app PRIVATE ${app_sources}) + +target_compile_options(app PRIVATE -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L) diff --git a/tests/posix/single_process/prj.conf b/tests/posix/single_process/prj.conf new file mode 100644 index 0000000000000..472780a18063a --- /dev/null +++ b/tests/posix/single_process/prj.conf @@ -0,0 +1,5 @@ +CONFIG_POSIX_API=y +CONFIG_ZTEST=y + +CONFIG_POSIX_AEP_CHOICE_BASE=y +CONFIG_POSIX_SINGLE_PROCESS=y diff --git a/tests/posix/common/src/confstr.c b/tests/posix/single_process/src/confstr.c similarity index 93% rename from tests/posix/common/src/confstr.c rename to tests/posix/single_process/src/confstr.c index c1926faf60bab..f11ccf1ba89ab 100644 --- a/tests/posix/common/src/confstr.c +++ b/tests/posix/single_process/src/confstr.c @@ -10,7 +10,7 @@ #include #include -ZTEST(confstr, test_confstr) +ZTEST(posix_single_process, test_confstr) { char buf[1]; @@ -63,5 +63,3 @@ ZTEST(confstr, test_confstr) zassert_true(confstr(_CS_PATH, buf, sizeof(buf) > 0)); zassert_equal(buf[0], '\0'); } - -ZTEST_SUITE(confstr, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/posix/single_process/src/main.c b/tests/posix/single_process/src/main.c new file mode 100644 index 0000000000000..421af54891d40 --- /dev/null +++ b/tests/posix/single_process/src/main.c @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2023, Meta + * Copyright (c) 2024, Marvin Ouma + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +ZTEST_SUITE(posix_single_process, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/posix/common/src/sysconf.c b/tests/posix/single_process/src/sysconf.c similarity index 82% rename from tests/posix/common/src/sysconf.c rename to tests/posix/single_process/src/sysconf.c index 363d93be36549..7689ff04600ab 100644 --- a/tests/posix/common/src/sysconf.c +++ b/tests/posix/single_process/src/sysconf.c @@ -8,7 +8,7 @@ #include #include -ZTEST(posix_apis, test_posix_sysconf) +ZTEST(posix_single_process, test_posix_sysconf) { long ret; @@ -23,10 +23,7 @@ ZTEST(posix_apis, test_posix_sysconf) /* SC that value depends on target's configuration */ ret = sysconf(_SC_SEMAPHORES); if (IS_ENABLED(CONFIG_POSIX_THREADS)) { - zassert_equal(ret, - _POSIX_VERSION, - "sysconf returned unexpected value %d", - ret); + zassert_equal(ret, _POSIX_VERSION, "sysconf returned unexpected value %d", ret); } else { zassert_equal(ret, -1L, "sysconf returned unexpected value %d", ret); } diff --git a/tests/posix/common/src/uname.c b/tests/posix/single_process/src/uname.c similarity index 81% rename from tests/posix/common/src/uname.c rename to tests/posix/single_process/src/uname.c index 9b1e76d6b5357..1d6b09d8c7ee7 100644 --- a/tests/posix/common/src/uname.c +++ b/tests/posix/single_process/src/uname.c @@ -9,7 +9,7 @@ #include -ZTEST(uname, test_uname) +ZTEST(posix_single_process, test_uname) { struct utsname info; @@ -17,5 +17,3 @@ ZTEST(uname, test_uname) zassert_ok(strncmp(info.sysname, "Zephyr", sizeof(info.sysname))); zassert_ok(strncmp(info.machine, CONFIG_ARCH, sizeof(info.machine))); } - -ZTEST_SUITE(uname, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/posix/single_process/testcase.yaml b/tests/posix/single_process/testcase.yaml new file mode 100644 index 0000000000000..a8f8a54c1406c --- /dev/null +++ b/tests/posix/single_process/testcase.yaml @@ -0,0 +1,25 @@ +common: + filter: not CONFIG_NATIVE_LIBC + tags: + - posix + - single_process + # 1 tier0 platform per supported architecture + platform_key: + - arch + - simulation +tests: + portability.single_process.rwlocks: + min_flash: 64 + min_ram: 32 + portability.posix.single_process.minimal: + extra_configs: + - CONFIG_MINIMAL_LIBC=y + portability.posix.single_process.newlib: + filter: TOOLCHAIN_HAS_NEWLIB == 1 + extra_configs: + - CONFIG_NEWLIB_LIBC=y + portability.posix.single_process.picolibc: + tags: picolibc + filter: CONFIG_PICOLIBC_SUPPORTED + extra_configs: + - CONFIG_PICOLIBC=y From b7fe2a0bf92b25bc49c157e7f03f0dbce32bf5a5 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Wed, 6 Nov 2024 14:11:13 +0700 Subject: [PATCH 2518/4482] fb: cfb: avoid multiple `strlen` calls in `draw_text` Added `len` to store the result of `strlen(str)` to avoid multiple calls to `strlen` in the `for-loop`. Signed-off-by: Pisit Sawangvonganan --- subsys/fb/cfb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/subsys/fb/cfb.c b/subsys/fb/cfb.c index 7ba0882c90bca..803d12d99a3d1 100644 --- a/subsys/fb/cfb.c +++ b/subsys/fb/cfb.c @@ -278,7 +278,9 @@ static int draw_text(const struct device *dev, const char *const str, int16_t x, } if ((fb->screen_info & SCREEN_INFO_MONO_VTILED)) { - for (size_t i = 0; i < strlen(str); i++) { + const size_t len = strlen(str); + + for (size_t i = 0; i < len; i++) { if ((x + fptr->width > fb->x_res) && wrap) { x = 0U; y += fptr->height; From 06e0b2d1d6ea3ce79768442b8c737c411f5d4746 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Wed, 6 Nov 2024 14:21:33 +0700 Subject: [PATCH 2519/4482] fb: cfb: remove unnecessary `NULL` check and `NULL` assignment Since the `fb` pointer is always assigned to `char_fb`, there is no need for a `NULL` check. Additionally, removed setting `fb->buf` to `NULL` in `cfb_framebuffer_init` as it will be overwritten by subsequent operations. Signed-off-by: Pisit Sawangvonganan --- subsys/fb/cfb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/subsys/fb/cfb.c b/subsys/fb/cfb.c index 803d12d99a3d1..185ed1542d4d6 100644 --- a/subsys/fb/cfb.c +++ b/subsys/fb/cfb.c @@ -436,7 +436,7 @@ int cfb_framebuffer_clear(const struct device *dev, bool clear_display) { const struct char_framebuffer *fb = &char_fb; - if (!fb || !fb->buf) { + if (!fb->buf) { return -ENODEV; } @@ -464,7 +464,7 @@ int cfb_framebuffer_finalize(const struct device *dev) const struct char_framebuffer *fb = &char_fb; int err; - if (!fb || !fb->buf) { + if (!fb->buf) { return -ENODEV; } @@ -575,7 +575,6 @@ int cfb_framebuffer_init(const struct device *dev) fb->ppt = 8U; fb->pixel_format = cfg.current_pixel_format; fb->screen_info = cfg.screen_info; - fb->buf = NULL; fb->kerning = 0; fb->inverted = false; From cff8b6092e481224cbef174ef7f4a5a37b143977 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Wed, 6 Nov 2024 14:40:05 +0700 Subject: [PATCH 2520/4482] fb: cfb_shell: use `shell_strtol` in `cmd_set_kerning` Switch from using direct `strtol` calls to `shell_strtol`. This change leverages the extensive error handling provided by `shell_strtol`. Signed-off-by: Pisit Sawangvonganan --- subsys/fb/cfb_shell.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/subsys/fb/cfb_shell.c b/subsys/fb/cfb_shell.c index b6d246f78fb39..fb8cf7447676e 100644 --- a/subsys/fb/cfb_shell.c +++ b/subsys/fb/cfb_shell.c @@ -340,8 +340,7 @@ static int cmd_set_font(const struct shell *sh, size_t argc, char *argv[]) static int cmd_set_kerning(const struct shell *sh, size_t argc, char *argv[]) { - int err; - char *ep = NULL; + int err = 0; long kerning; if (!dev) { @@ -349,9 +348,8 @@ static int cmd_set_kerning(const struct shell *sh, size_t argc, char *argv[]) return -ENODEV; } - errno = 0; - kerning = strtol(argv[1], &ep, 10); - if (errno || ep == argv[1]) { + kerning = shell_strtol(argv[1], 10, &err); + if (err) { shell_error(sh, HELP_INIT); return -EINVAL; } From effe4bbf95c386f5e0e9dfd7ed206a08dc269db8 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Wed, 6 Nov 2024 14:55:10 +0700 Subject: [PATCH 2521/4482] fb: cfb_shell: remove `dev` null check Remove `dev` null check as `DEVICE_DT_GET` ensures compile-time initialization. Refer to commit 6eb371f (fb: initialize devices at compile time) Signed-off-by: Pisit Sawangvonganan --- subsys/fb/cfb_shell.c | 100 ------------------------------------------ 1 file changed, 100 deletions(-) diff --git a/subsys/fb/cfb_shell.c b/subsys/fb/cfb_shell.c index fb8cf7447676e..571c4dc3c582b 100644 --- a/subsys/fb/cfb_shell.c +++ b/subsys/fb/cfb_shell.c @@ -35,11 +35,6 @@ static int cmd_clear(const struct shell *sh, size_t argc, char *argv[]) ARG_UNUSED(argc); ARG_UNUSED(argv); - if (!dev) { - shell_error(sh, HELP_INIT); - return -ENODEV; - } - err = cfb_framebuffer_clear(dev, true); if (err) { shell_error(sh, "Framebuffer clear error=%d", err); @@ -62,11 +57,6 @@ static int cmd_cfb_print(const struct shell *sh, int col, int row, char *str) int err; uint8_t ppt; - if (!dev) { - shell_error(sh, HELP_INIT); - return -ENODEV; - } - ppt = cfb_get_display_parameter(dev, CFB_DISPLAY_PPT); err = cfb_framebuffer_clear(dev, false); @@ -97,11 +87,6 @@ static int cmd_print(const struct shell *sh, size_t argc, char *argv[]) int err; int col, row; - if (!dev) { - shell_error(sh, HELP_INIT); - return -ENODEV; - } - col = strtol(argv[1], NULL, 10); if (col > cfb_get_display_parameter(dev, CFB_DISPLAY_COLS)) { shell_error(sh, "Invalid col=%d position", col); @@ -128,11 +113,6 @@ static int cmd_draw_text(const struct shell *sh, size_t argc, char *argv[]) int err; int x, y; - if (!dev) { - shell_error(sh, HELP_INIT); - return -ENODEV; - } - x = strtol(argv[1], NULL, 10); y = strtol(argv[2], NULL, 10); err = cfb_draw_text(dev, argv[3], x, y); @@ -151,11 +131,6 @@ static int cmd_draw_point(const struct shell *sh, size_t argc, char *argv[]) int err; struct cfb_position pos; - if (!dev) { - shell_error(sh, HELP_INIT); - return -ENODEV; - } - pos.x = strtol(argv[1], NULL, 10); pos.y = strtol(argv[2], NULL, 10); @@ -175,11 +150,6 @@ static int cmd_draw_line(const struct shell *sh, size_t argc, char *argv[]) int err; struct cfb_position start, end; - if (!dev) { - shell_error(sh, HELP_INIT); - return -ENODEV; - } - start.x = strtol(argv[1], NULL, 10); start.y = strtol(argv[2], NULL, 10); end.x = strtol(argv[3], NULL, 10); @@ -201,11 +171,6 @@ static int cmd_draw_rect(const struct shell *sh, size_t argc, char *argv[]) int err; struct cfb_position start, end; - if (!dev) { - shell_error(sh, HELP_INIT); - return -ENODEV; - } - start.x = strtol(argv[1], NULL, 10); start.y = strtol(argv[2], NULL, 10); end.x = strtol(argv[3], NULL, 10); @@ -228,11 +193,6 @@ static int cmd_scroll_vert(const struct shell *sh, size_t argc, char *argv[]) int col, row; int boundary; - if (!dev) { - shell_error(sh, HELP_INIT); - return -ENODEV; - } - col = strtol(argv[1], NULL, 10); if (col > cfb_get_display_parameter(dev, CFB_DISPLAY_COLS)) { shell_error(sh, "Invalid col=%d position", col); @@ -269,11 +229,6 @@ static int cmd_scroll_horz(const struct shell *sh, size_t argc, char *argv[]) int col, row; int boundary; - if (!dev) { - shell_error(sh, HELP_INIT); - return -ENODEV; - } - col = strtol(argv[1], NULL, 10); if (col > cfb_get_display_parameter(dev, CFB_DISPLAY_COLS)) { shell_error(sh, "Invalid col=%d position", col); @@ -312,11 +267,6 @@ static int cmd_set_font(const struct shell *sh, size_t argc, char *argv[]) uint8_t height; uint8_t width; - if (!dev) { - shell_error(sh, HELP_INIT); - return -ENODEV; - } - idx = strtol(argv[1], NULL, 10); err = cfb_get_font_size(dev, idx, &width, &height); @@ -343,11 +293,6 @@ static int cmd_set_kerning(const struct shell *sh, size_t argc, char *argv[]) int err = 0; long kerning; - if (!dev) { - shell_error(sh, HELP_INIT); - return -ENODEV; - } - kerning = shell_strtol(argv[1], 10, &err); if (err) { shell_error(sh, HELP_INIT); @@ -367,11 +312,6 @@ static int cmd_invert(const struct shell *sh, size_t argc, char *argv[]) { int err; - if (!dev) { - shell_error(sh, HELP_INIT); - return -ENODEV; - } - if (argc == 1) { err = cfb_framebuffer_invert(dev); if (err) { @@ -412,11 +352,6 @@ static int cmd_get_fonts(const struct shell *sh, size_t argc, char *argv[]) ARG_UNUSED(argc); ARG_UNUSED(argv); - if (!dev) { - shell_error(sh, HELP_INIT); - return -ENODEV; - } - for (int idx = 0; idx < cfb_get_numof_fonts(dev); idx++) { if (cfb_get_font_size(dev, idx, &font_width, &font_height)) { break; @@ -435,11 +370,6 @@ static int cmd_get_device(const struct shell *sh, size_t argc, char *argv[]) ARG_UNUSED(argc); ARG_UNUSED(argv); - if (!dev) { - shell_error(sh, HELP_INIT); - return -ENODEV; - } - shell_print(sh, "Framebuffer Device: %s", dev->name); return err; @@ -451,11 +381,6 @@ static int cmd_get_param_all(const struct shell *sh, size_t argc, ARG_UNUSED(argc); ARG_UNUSED(argv); - if (!dev) { - shell_error(sh, HELP_INIT); - return -ENODEV; - } - for (unsigned int i = 0; i <= CFB_DISPLAY_COLS; i++) { shell_print(sh, "param: %s=%d", param_name[i], cfb_get_display_parameter(dev, i)); @@ -471,11 +396,6 @@ static int cmd_get_param_height(const struct shell *sh, size_t argc, ARG_UNUSED(argc); ARG_UNUSED(argv); - if (!dev) { - shell_error(sh, HELP_INIT); - return -ENODEV; - } - shell_print(sh, "param: %s=%d", param_name[CFB_DISPLAY_HEIGH], cfb_get_display_parameter(dev, CFB_DISPLAY_HEIGH)); @@ -488,11 +408,6 @@ static int cmd_get_param_width(const struct shell *sh, size_t argc, ARG_UNUSED(argc); ARG_UNUSED(argv); - if (!dev) { - shell_error(sh, HELP_INIT); - return -ENODEV; - } - shell_print(sh, "param: %s=%d", param_name[CFB_DISPLAY_WIDTH], cfb_get_display_parameter(dev, CFB_DISPLAY_WIDTH)); @@ -505,11 +420,6 @@ static int cmd_get_param_ppt(const struct shell *sh, size_t argc, ARG_UNUSED(argc); ARG_UNUSED(argv); - if (!dev) { - shell_error(sh, HELP_INIT); - return -ENODEV; - } - shell_print(sh, "param: %s=%d", param_name[CFB_DISPLAY_PPT], cfb_get_display_parameter(dev, CFB_DISPLAY_PPT)); @@ -522,11 +432,6 @@ static int cmd_get_param_rows(const struct shell *sh, size_t argc, ARG_UNUSED(argc); ARG_UNUSED(argv); - if (!dev) { - shell_error(sh, HELP_INIT); - return -ENODEV; - } - shell_print(sh, "param: %s=%d", param_name[CFB_DISPLAY_ROWS], cfb_get_display_parameter(dev, CFB_DISPLAY_ROWS)); @@ -539,11 +444,6 @@ static int cmd_get_param_cols(const struct shell *sh, size_t argc, ARG_UNUSED(argc); ARG_UNUSED(argv); - if (!dev) { - shell_error(sh, HELP_INIT); - return -ENODEV; - } - shell_print(sh, "param: %s=%d", param_name[CFB_DISPLAY_COLS], cfb_get_display_parameter(dev, CFB_DISPLAY_COLS)); From ed5ce47437bb2de8814375d41b38db3a5a175379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 6 Nov 2024 08:05:22 +0100 Subject: [PATCH 2522/4482] drivers: serial: nrfx_uarte: Fix RX path without low power modes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RX FIFO flushing on RXTO event should only be performed when UARTE peripheral might be disable during inactivity and that happens when low power modes is enabled or when device runtime PM is used. Flushing was incrementing flush_cnt which was not used (flushed data is not copied to the next buffer) which was causing data loss and invalid RX data length reporting. Signed-off-by: Krzysztof Chruściński --- drivers/serial/uart_nrfx_uarte.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index e1af63b7993e7..452307acaa833 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -1521,7 +1521,7 @@ static void rxto_isr(const struct device *dev) async_rx->total_user_byte_cnt += rx_flush(dev); } #endif - } else { + } else if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || LOW_POWER_ENABLED(config)) { async_rx->flush_cnt = rx_flush(dev); } From f7633a55aa098de8409724f3a6211af4a4687101 Mon Sep 17 00:00:00 2001 From: Marvin Ouma Date: Tue, 5 Nov 2024 20:27:37 +0300 Subject: [PATCH 2523/4482] tests: posix: common: separate posix semaphores tests into standalone test posix.common contains testsuites that can be separated into smaller groups of tests. This change moves semaphore into a singular testsuite at tests/posix/semaphores app directory. Signed-off-by: Marvin Ouma --- tests/posix/semaphores/CMakeLists.txt | 9 +++++++ tests/posix/semaphores/Kconfig | 11 ++++++++ tests/posix/semaphores/prj.conf | 5 ++++ .../src/semaphore.c => semaphores/src/main.c} | 21 ++++++++-------- tests/posix/semaphores/testcase.yaml | 25 +++++++++++++++++++ 5 files changed, 61 insertions(+), 10 deletions(-) create mode 100644 tests/posix/semaphores/CMakeLists.txt create mode 100644 tests/posix/semaphores/Kconfig create mode 100644 tests/posix/semaphores/prj.conf rename tests/posix/{common/src/semaphore.c => semaphores/src/main.c} (95%) create mode 100644 tests/posix/semaphores/testcase.yaml diff --git a/tests/posix/semaphores/CMakeLists.txt b/tests/posix/semaphores/CMakeLists.txt new file mode 100644 index 0000000000000..b43570e197d78 --- /dev/null +++ b/tests/posix/semaphores/CMakeLists.txt @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(posix_semaphores) + +target_sources(app PRIVATE src/main.c) + +target_compile_options(app PRIVATE -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L) diff --git a/tests/posix/semaphores/Kconfig b/tests/posix/semaphores/Kconfig new file mode 100644 index 0000000000000..8da58b911388d --- /dev/null +++ b/tests/posix/semaphores/Kconfig @@ -0,0 +1,11 @@ +# Copyright (c) 2023, Meta +# SPDX-License-Identifier: Apache-2.0 + +config TEST_SEM_N_LOOPS + int "Number of loops in semaphore test" + range 16 1024 + default 32 + help + This option is specific to semaphore.test_named_semaphore in semaphore.c + +source "Kconfig.zephyr" diff --git a/tests/posix/semaphores/prj.conf b/tests/posix/semaphores/prj.conf new file mode 100644 index 0000000000000..5376678d6a907 --- /dev/null +++ b/tests/posix/semaphores/prj.conf @@ -0,0 +1,5 @@ +CONFIG_POSIX_API=y +CONFIG_ZTEST=y + +CONFIG_POSIX_AEP_CHOICE_BASE=y +CONFIG_POSIX_SEMAPHORES=y diff --git a/tests/posix/common/src/semaphore.c b/tests/posix/semaphores/src/main.c similarity index 95% rename from tests/posix/common/src/semaphore.c rename to tests/posix/semaphores/src/main.c index f9cfe8e8c9460..228165fb131f0 100644 --- a/tests/posix/common/src/semaphore.c +++ b/tests/posix/semaphores/src/main.c @@ -49,8 +49,7 @@ static void semaphore_test(sem_t *sem) ret = pthread_create(&thread1, NULL, child_func, sem); zassert_equal(ret, 0, "Thread creation failed"); - zassert_equal(clock_gettime(CLOCK_REALTIME, &abstime), 0, - "clock_gettime failed"); + zassert_equal(clock_gettime(CLOCK_REALTIME, &abstime), 0, "clock_gettime failed"); abstime.tv_sec += 5; @@ -72,15 +71,15 @@ static void semaphore_test(sem_t *sem) zassert_equal(sem_getvalue(sem, &val), 0); zassert_equal(val, 1); - zassert_equal(sem_destroy(sem), -1, "acquired semaphore" + zassert_equal(sem_destroy(sem), -1, + "acquired semaphore" " is destroyed"); zassert_equal(errno, EBUSY); /* TESTPOINT: take semaphore which is initialized with 1 */ zassert_equal(sem_trywait(sem), 0); - zassert_equal(pthread_create(&thread2, NULL, child_func, sem), 0, - "Thread creation failed"); + zassert_equal(pthread_create(&thread2, NULL, child_func, sem), 0, "Thread creation failed"); /* TESTPOINT: Wait and acquire semaphore till thread2 gives */ zassert_equal(sem_wait(sem), 0, "sem_wait failed"); @@ -90,17 +89,19 @@ static void semaphore_test(sem_t *sem) zassert_ok(pthread_join(thread2, NULL)); } -ZTEST(semaphore, test_semaphore) +ZTEST(posix_semaphores, test_semaphore) { sem_t sema; /* TESTPOINT: Call sem_post with invalid kobject */ - zassert_equal(sem_post(NULL), -1, "sem_post of" + zassert_equal(sem_post(NULL), -1, + "sem_post of" " invalid semaphore object didn't fail"); zassert_equal(errno, EINVAL); /* TESTPOINT: sem_destroy with invalid kobject */ - zassert_equal(sem_destroy(NULL), -1, "invalid" + zassert_equal(sem_destroy(NULL), -1, + "invalid" " semaphore is destroyed"); zassert_equal(errno, EINVAL); @@ -141,7 +142,7 @@ static void *nsem_close_func(void *p) return NULL; } -ZTEST(semaphore, test_named_semaphore) +ZTEST(posix_semaphores, test_named_semaphore) { pthread_t thread1, thread2; sem_t *sem1, *sem2, *different_sem1; @@ -321,4 +322,4 @@ static void before(void *arg) } } -ZTEST_SUITE(semaphore, NULL, NULL, before, NULL, NULL); +ZTEST_SUITE(posix_semaphores, NULL, NULL, before, NULL, NULL); diff --git a/tests/posix/semaphores/testcase.yaml b/tests/posix/semaphores/testcase.yaml new file mode 100644 index 0000000000000..92fdebbd9922e --- /dev/null +++ b/tests/posix/semaphores/testcase.yaml @@ -0,0 +1,25 @@ +common: + filter: not CONFIG_NATIVE_LIBC + tags: + - posix + - semaphores + # 1 tier0 platform per supported architecture + platform_key: + - arch + - simulation + min_flash: 64 + min_ram: 32 +tests: + portability.posix.semaphores: {} + portability.posix.semaphores.minimal: + extra_configs: + - CONFIG_MINIMAL_LIBC=y + portability.posix.semaphores.newlib: + filter: TOOLCHAIN_HAS_NEWLIB == 1 + extra_configs: + - CONFIG_NEWLIB_LIBC=y + portability.posix.semaphores.picolibc: + tags: picolibc + filter: CONFIG_PICOLIBC_SUPPORTED + extra_configs: + - CONFIG_PICOLIBC=y From 7e8ee254797917ff3d89c628f821cf10260c4034 Mon Sep 17 00:00:00 2001 From: Marvin Ouma Date: Tue, 5 Nov 2024 19:33:31 +0300 Subject: [PATCH 2524/4482] tests: posix: common: separate posix rwlocks tests into a standalone test posix.common contains testsuites that can be separated into smaller groups of tests. This change moves rwlocks into a singular testsuite at tests/posix/rwlocks app directory. Signed-off-by: Marvin Ouma --- tests/posix/rwlocks/CMakeLists.txt | 9 +++++++ tests/posix/rwlocks/prj.conf | 5 ++++ .../src/rwlock.c => rwlocks/src/main.c} | 8 +++--- tests/posix/rwlocks/testcase.yaml | 26 +++++++++++++++++++ 4 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 tests/posix/rwlocks/CMakeLists.txt create mode 100644 tests/posix/rwlocks/prj.conf rename tests/posix/{common/src/rwlock.c => rwlocks/src/main.c} (95%) create mode 100644 tests/posix/rwlocks/testcase.yaml diff --git a/tests/posix/rwlocks/CMakeLists.txt b/tests/posix/rwlocks/CMakeLists.txt new file mode 100644 index 0000000000000..5043854b6bd23 --- /dev/null +++ b/tests/posix/rwlocks/CMakeLists.txt @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(posix_rw_locks) + +target_sources(app PRIVATE src/main.c) + +target_compile_options(app PRIVATE -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L) diff --git a/tests/posix/rwlocks/prj.conf b/tests/posix/rwlocks/prj.conf new file mode 100644 index 0000000000000..e55d87a7ad143 --- /dev/null +++ b/tests/posix/rwlocks/prj.conf @@ -0,0 +1,5 @@ +CONFIG_POSIX_API=y +CONFIG_ZTEST=y + +CONFIG_POSIX_AEP_CHOICE_BASE=y +CONFIG_POSIX_READER_WRITER_LOCKS=y diff --git a/tests/posix/common/src/rwlock.c b/tests/posix/rwlocks/src/main.c similarity index 95% rename from tests/posix/common/src/rwlock.c rename to tests/posix/rwlocks/src/main.c index a7012fc58327a..450180aff6f8d 100644 --- a/tests/posix/common/src/rwlock.c +++ b/tests/posix/rwlocks/src/main.c @@ -47,7 +47,7 @@ static void *thread_top(void *p1) return NULL; } -ZTEST(rwlock, test_rw_lock) +ZTEST(posix_rw_locks, test_rw_lock) { int ret; pthread_t newthread[N_THR]; @@ -133,12 +133,12 @@ static void test_pthread_rwlockattr_pshared_common(bool set, int pshared) zassert_ok(pthread_rwlockattr_destroy(&attr)); } -ZTEST(rwlock, test_pthread_rwlockattr_getpshared) +ZTEST(posix_rw_locks, test_pthread_rwlockattr_getpshared) { test_pthread_rwlockattr_pshared_common(false, 0); } -ZTEST(rwlock, test_pthread_rwlockattr_setpshared) +ZTEST(posix_rw_locks, test_pthread_rwlockattr_setpshared) { test_pthread_rwlockattr_pshared_common(true, PTHREAD_PROCESS_PRIVATE); test_pthread_rwlockattr_pshared_common(true, PTHREAD_PROCESS_SHARED); @@ -154,4 +154,4 @@ static void before(void *arg) } } -ZTEST_SUITE(rwlock, NULL, NULL, before, NULL, NULL); +ZTEST_SUITE(posix_rw_locks, NULL, NULL, before, NULL, NULL); diff --git a/tests/posix/rwlocks/testcase.yaml b/tests/posix/rwlocks/testcase.yaml new file mode 100644 index 0000000000000..cee1a2300d7f4 --- /dev/null +++ b/tests/posix/rwlocks/testcase.yaml @@ -0,0 +1,26 @@ +common: + filter: not CONFIG_NATIVE_LIBC + tags: + - posix + - rwlocks + # 1 tier0 platform per supported architecture + platform_key: + - arch + - simulation +tests: + portability.posix.rwlocks: + min_flash: 64 + min_ram: 32 + portability.posix.rwlocks.minimal: + extra_configs: + - CONFIG_MINIMAL_LIBC=y + portability.posix.rwlocks.newlib: + filter: TOOLCHAIN_HAS_NEWLIB == 1 + extra_configs: + - CONFIG_NEWLIB_LIBC=y + - CONFIG_NEWLIB_LIBC_MIN_REQUIRED_HEAP_SIZE=8192 + portability.posix.rwlocks.picolibc: + tags: picolibc + filter: CONFIG_PICOLIBC_SUPPORTED + extra_configs: + - CONFIG_PICOLIBC=y From ae8c3733148b2e4a14de3e5d6bb96b635bcf9a52 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 5 Nov 2024 17:02:38 +0100 Subject: [PATCH 2525/4482] LLEXT: fix a needless allocation When CONFIG_LLEXT_STORAGE_WRITABLE is selected and .pre_located is set, the BSS section is allocated by the user too, no need to allocate it internally. Signed-off-by: Guennadi Liakhovetski --- include/zephyr/llext/llext.h | 5 ++++- subsys/llext/llext_load.c | 2 +- subsys/llext/llext_mem.c | 38 ++++++++++++++++++++++++------------ subsys/llext/llext_priv.h | 3 ++- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/include/zephyr/llext/llext.h b/include/zephyr/llext/llext.h index 569ffd4746c4a..0ad1e591fb703 100644 --- a/include/zephyr/llext/llext.h +++ b/include/zephyr/llext/llext.h @@ -132,7 +132,10 @@ struct llext_load_param { bool relocate_local; /** * Use the virtual symbol addresses from the ELF, not addresses within - * the memory buffer, when calculating relocation targets. + * the memory buffer, when calculating relocation targets. It also + * means, that the application will take care to place the extension at + * those pre-defined addresses, so the LLEXT core doesn't have to do any + * allocation and copying internally. */ bool pre_located; /** diff --git a/subsys/llext/llext_load.c b/subsys/llext/llext_load.c index d433f6668fe40..643f9b18461d7 100644 --- a/subsys/llext/llext_load.c +++ b/subsys/llext/llext_load.c @@ -684,7 +684,7 @@ int do_llext_load(struct llext_loader *ldr, struct llext *ext, } LOG_DBG("Allocate and copy regions..."); - ret = llext_copy_regions(ldr, ext); + ret = llext_copy_regions(ldr, ext, ldr_parm); if (ret != 0) { LOG_ERR("Failed to copy regions, ret %d", ret); goto out; diff --git a/subsys/llext/llext_mem.c b/subsys/llext/llext_mem.c index 35a4960c2c04e..7ce804147e749 100644 --- a/subsys/llext/llext_mem.c +++ b/subsys/llext/llext_mem.c @@ -59,7 +59,7 @@ static void llext_init_mem_part(struct llext *ext, enum llext_mem mem_idx, } static int llext_copy_section(struct llext_loader *ldr, struct llext *ext, - enum llext_mem mem_idx) + enum llext_mem mem_idx, const struct llext_load_param *ldr_parm) { int ret; @@ -68,18 +68,31 @@ static int llext_copy_section(struct llext_loader *ldr, struct llext *ext, } ext->mem_size[mem_idx] = ldr->sects[mem_idx].sh_size; - if (ldr->sects[mem_idx].sh_type != SHT_NOBITS && - IS_ENABLED(CONFIG_LLEXT_STORAGE_WRITABLE)) { - /* Directly use data from the ELF buffer if peek() is supported */ - ext->mem[mem_idx] = llext_peek(ldr, ldr->sects[mem_idx].sh_offset); - if (ext->mem[mem_idx]) { - llext_init_mem_part(ext, mem_idx, (uintptr_t)ext->mem[mem_idx], - ldr->sects[mem_idx].sh_size); + if (IS_ENABLED(CONFIG_LLEXT_STORAGE_WRITABLE)) { + if (ldr->sects[mem_idx].sh_type != SHT_NOBITS) { + /* Directly use data from the ELF buffer if peek() is supported */ + ext->mem[mem_idx] = llext_peek(ldr, ldr->sects[mem_idx].sh_offset); + if (ext->mem[mem_idx]) { + llext_init_mem_part(ext, mem_idx, (uintptr_t)ext->mem[mem_idx], + ldr->sects[mem_idx].sh_size); + ext->mem_on_heap[mem_idx] = false; + return 0; + } + } else if (ldr_parm && ldr_parm->pre_located) { + /* + * ldr_parm cannot be NULL here with the current flow, but + * we add a check to make it future-proof + */ + ext->mem[mem_idx] = NULL; ext->mem_on_heap[mem_idx] = false; return 0; } } + if (ldr_parm && ldr_parm->pre_located) { + return -EFAULT; + } + /* On ARM with an MPU a pow(2, N)*32 sized and aligned region is needed, * otherwise its typically an mmu page (sized and aligned memory region) * we are after that we can assign memory permission bits on. @@ -132,16 +145,17 @@ static int llext_copy_section(struct llext_loader *ldr, struct llext *ext, int llext_copy_strings(struct llext_loader *ldr, struct llext *ext) { - int ret = llext_copy_section(ldr, ext, LLEXT_MEM_SHSTRTAB); + int ret = llext_copy_section(ldr, ext, LLEXT_MEM_SHSTRTAB, NULL); if (!ret) { - ret = llext_copy_section(ldr, ext, LLEXT_MEM_STRTAB); + ret = llext_copy_section(ldr, ext, LLEXT_MEM_STRTAB, NULL); } return ret; } -int llext_copy_regions(struct llext_loader *ldr, struct llext *ext) +int llext_copy_regions(struct llext_loader *ldr, struct llext *ext, + const struct llext_load_param *ldr_parm) { for (enum llext_mem mem_idx = 0; mem_idx < LLEXT_MEM_COUNT; mem_idx++) { /* strings have already been copied */ @@ -149,7 +163,7 @@ int llext_copy_regions(struct llext_loader *ldr, struct llext *ext) continue; } - int ret = llext_copy_section(ldr, ext, mem_idx); + int ret = llext_copy_section(ldr, ext, mem_idx, ldr_parm); if (ret < 0) { return ret; diff --git a/subsys/llext/llext_priv.h b/subsys/llext/llext_priv.h index ed63c20bc16a9..e3b9fd282a64b 100644 --- a/subsys/llext/llext_priv.h +++ b/subsys/llext/llext_priv.h @@ -20,7 +20,8 @@ struct llext_elf_sect_map { */ int llext_copy_strings(struct llext_loader *ldr, struct llext *ext); -int llext_copy_regions(struct llext_loader *ldr, struct llext *ext); +int llext_copy_regions(struct llext_loader *ldr, struct llext *ext, + const struct llext_load_param *ldr_parm); void llext_free_regions(struct llext *ext); void llext_adjust_mmu_permissions(struct llext *ext); From dc6630d5f53a0a24f961c9723d5fa4fb83c852b0 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Tue, 5 Nov 2024 15:19:12 +0100 Subject: [PATCH 2526/4482] samples: Bluetooth: PBP: Source: Fix advertising data The sample had a few off-by-ones in the code, which caused access to invalid data. Fixed by setting the right buffer sizes and the right AD length fields. Signed-off-by: Emil Gydesen --- samples/bluetooth/pbp_public_broadcast_source/src/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/bluetooth/pbp_public_broadcast_source/src/main.c b/samples/bluetooth/pbp_public_broadcast_source/src/main.c index a365ecbfb9431..364adf0454f32 100644 --- a/samples/bluetooth/pbp_public_broadcast_source/src/main.c +++ b/samples/bluetooth/pbp_public_broadcast_source/src/main.c @@ -182,7 +182,7 @@ static int setup_extended_adv_data(struct bt_cap_broadcast_source *source, NET_BUF_SIMPLE_DEFINE(ad_buf, BT_UUID_SIZE_16 + BT_AUDIO_BROADCAST_ID_SIZE); NET_BUF_SIMPLE_DEFINE(base_buf, 128); - NET_BUF_SIMPLE_DEFINE(pbp_ad_buf, BT_UUID_SIZE_16 + 1 + ARRAY_SIZE(pba_metadata)); + NET_BUF_SIMPLE_DEFINE(pbp_ad_buf, BT_PBP_MIN_PBA_SIZE + ARRAY_SIZE(pba_metadata)); static enum bt_pbp_announcement_feature pba_params; struct bt_data ext_ad[4]; struct bt_data per_ad; @@ -211,7 +211,7 @@ static int setup_extended_adv_data(struct bt_cap_broadcast_source *source, net_buf_simple_add_le16(&ad_buf, BT_UUID_BROADCAST_AUDIO_VAL); net_buf_simple_add_le24(&ad_buf, broadcast_id); ext_ad[2].type = BT_DATA_SVC_DATA16; - ext_ad[2].data_len = ad_buf.len + sizeof(ext_ad[2].type); + ext_ad[2].data_len = ad_buf.len; ext_ad[2].data = ad_buf.data; /** @@ -227,8 +227,8 @@ static int setup_extended_adv_data(struct bt_cap_broadcast_source *source, pba_params |= BT_PBP_ANNOUNCEMENT_FEATURE_HIGH_QUALITY; printk("Starting stream with high quality!\n"); } - err = bt_pbp_get_announcement(&pba_metadata[1], ARRAY_SIZE(pba_metadata) - 1, - pba_params, &pbp_ad_buf); + err = bt_pbp_get_announcement(pba_metadata, ARRAY_SIZE(pba_metadata), pba_params, + &pbp_ad_buf); if (err != 0) { printk("Failed to create public broadcast announcement!: %d\n", err); From 4c8ee78b7600a95b2aec4d48ac345c92a50c2b01 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Tue, 5 Nov 2024 14:24:56 +0100 Subject: [PATCH 2527/4482] tests/bsim/bluetooth/audio: Increase EXECUTION_TIMEOUT where needed Increase the EXECUTION_TIMEOUT (real time timeout at which the test will be killed), so we have more margin for CI. Signed-off-by: Alberto Escolar Piedras --- tests/bsim/bluetooth/audio/test_scripts/bap_bass_client_sync.sh | 1 + tests/bsim/bluetooth/audio/test_scripts/bap_broadcast_audio.sh | 2 +- .../audio/test_scripts/bap_broadcast_audio_assistant.sh | 2 +- tests/bsim/bluetooth/audio/test_scripts/cap_broadcast.sh | 1 + .../bsim/bluetooth/audio/test_scripts/cap_capture_and_render.sh | 1 + tests/bsim/bluetooth/audio/test_scripts/cap_unicast.sh | 1 + .../bsim/bluetooth/audio/test_scripts/cap_unicast_ase_error.sh | 1 + tests/bsim/bluetooth/audio/test_scripts/cap_unicast_inval.sh | 1 + tests/bsim/bluetooth/audio/test_scripts/cap_unicast_timeout.sh | 1 + tests/bsim/bluetooth/audio/test_scripts/csip_encrypted_sirk.sh | 1 + tests/bsim/bluetooth/audio/test_scripts/csip_forced_release.sh | 1 + tests/bsim/bluetooth/audio/test_scripts/csip_new_sirk.sh | 1 + tests/bsim/bluetooth/audio/test_scripts/csip_no_lock.sh | 1 + tests/bsim/bluetooth/audio/test_scripts/csip_no_rank.sh | 1 + tests/bsim/bluetooth/audio/test_scripts/csip_no_size.sh | 2 +- tests/bsim/bluetooth/audio/test_scripts/tbs.sh | 1 + .../bluetooth/audio_samples/cap/tests_scripts/cap_broadcast.sh | 1 + .../bluetooth/audio_samples/cap/tests_scripts/cap_unicast.sh | 1 + 18 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/bsim/bluetooth/audio/test_scripts/bap_bass_client_sync.sh b/tests/bsim/bluetooth/audio/test_scripts/bap_bass_client_sync.sh index 8491ec5427de8..4abb84f870d4a 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/bap_bass_client_sync.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/bap_bass_client_sync.sh @@ -6,6 +6,7 @@ SIMULATION_ID="bass_client_sync" VERBOSITY_LEVEL=2 +EXECUTE_TIMEOUT=120 source ${ZEPHYR_BASE}/tests/bsim/sh_common.source diff --git a/tests/bsim/bluetooth/audio/test_scripts/bap_broadcast_audio.sh b/tests/bsim/bluetooth/audio/test_scripts/bap_broadcast_audio.sh index 4988a86e36fce..5b722cac84b4b 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/bap_broadcast_audio.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/bap_broadcast_audio.sh @@ -5,7 +5,7 @@ # SPDX-License-Identifier: Apache-2.0 VERBOSITY_LEVEL=2 -EXECUTE_TIMEOUT=100 +EXECUTE_TIMEOUT=240 source ${ZEPHYR_BASE}/tests/bsim/sh_common.source diff --git a/tests/bsim/bluetooth/audio/test_scripts/bap_broadcast_audio_assistant.sh b/tests/bsim/bluetooth/audio/test_scripts/bap_broadcast_audio_assistant.sh index 497a21a5f740a..f6333809f424f 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/bap_broadcast_audio_assistant.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/bap_broadcast_audio_assistant.sh @@ -6,7 +6,7 @@ SIMULATION_ID="bap_broadcast_audio_assistant" VERBOSITY_LEVEL=2 -EXECUTE_TIMEOUT=100 +EXECUTE_TIMEOUT=240 source ${ZEPHYR_BASE}/tests/bsim/sh_common.source diff --git a/tests/bsim/bluetooth/audio/test_scripts/cap_broadcast.sh b/tests/bsim/bluetooth/audio/test_scripts/cap_broadcast.sh index ffda4da2a4dc7..16fb153a5747b 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/cap_broadcast.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/cap_broadcast.sh @@ -6,6 +6,7 @@ SIMULATION_ID="cap_broadcast" VERBOSITY_LEVEL=2 +EXECUTE_TIMEOUT=120 source ${ZEPHYR_BASE}/tests/bsim/sh_common.source diff --git a/tests/bsim/bluetooth/audio/test_scripts/cap_capture_and_render.sh b/tests/bsim/bluetooth/audio/test_scripts/cap_capture_and_render.sh index fd65092254a68..7e33c7cfbf2ad 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/cap_capture_and_render.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/cap_capture_and_render.sh @@ -6,6 +6,7 @@ SIMULATION_ID="cap_capture_and_render" VERBOSITY_LEVEL=2 +EXECUTE_TIMEOUT=120 source ${ZEPHYR_BASE}/tests/bsim/sh_common.source diff --git a/tests/bsim/bluetooth/audio/test_scripts/cap_unicast.sh b/tests/bsim/bluetooth/audio/test_scripts/cap_unicast.sh index e833ecad1acb4..7a097943a6788 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/cap_unicast.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/cap_unicast.sh @@ -6,6 +6,7 @@ SIMULATION_ID="cap_unicast" VERBOSITY_LEVEL=2 +EXECUTE_TIMEOUT=240 source ${ZEPHYR_BASE}/tests/bsim/sh_common.source diff --git a/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_ase_error.sh b/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_ase_error.sh index b6faaddfd6e03..7ad23e2863a00 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_ase_error.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_ase_error.sh @@ -6,6 +6,7 @@ SIMULATION_ID="cap_unicast_ase_error" VERBOSITY_LEVEL=2 +EXECUTE_TIMEOUT=120 source ${ZEPHYR_BASE}/tests/bsim/sh_common.source diff --git a/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_inval.sh b/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_inval.sh index 6915fe23dd8e4..e45fb8a27a8ce 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_inval.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_inval.sh @@ -6,6 +6,7 @@ SIMULATION_ID="cap_unicast_inval" VERBOSITY_LEVEL=2 +EXECUTE_TIMEOUT=120 source ${ZEPHYR_BASE}/tests/bsim/sh_common.source diff --git a/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_timeout.sh b/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_timeout.sh index cdfec80253671..e1716cad2ae4b 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_timeout.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_timeout.sh @@ -6,6 +6,7 @@ SIMULATION_ID="cap_unicast_timeout" VERBOSITY_LEVEL=2 +EXECUTE_TIMEOUT=240 source ${ZEPHYR_BASE}/tests/bsim/sh_common.source diff --git a/tests/bsim/bluetooth/audio/test_scripts/csip_encrypted_sirk.sh b/tests/bsim/bluetooth/audio/test_scripts/csip_encrypted_sirk.sh index a33113e381a42..08e5ed82d6279 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/csip_encrypted_sirk.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/csip_encrypted_sirk.sh @@ -9,6 +9,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source VERBOSITY_LEVEL=2 +EXECUTE_TIMEOUT=120 cd ${BSIM_OUT_PATH}/bin diff --git a/tests/bsim/bluetooth/audio/test_scripts/csip_forced_release.sh b/tests/bsim/bluetooth/audio/test_scripts/csip_forced_release.sh index 380278f2bddab..d7cd32365e82a 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/csip_forced_release.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/csip_forced_release.sh @@ -9,6 +9,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source VERBOSITY_LEVEL=2 +EXECUTE_TIMEOUT=120 cd ${BSIM_OUT_PATH}/bin diff --git a/tests/bsim/bluetooth/audio/test_scripts/csip_new_sirk.sh b/tests/bsim/bluetooth/audio/test_scripts/csip_new_sirk.sh index 74d88e4848f8a..84c36fc674fb2 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/csip_new_sirk.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/csip_new_sirk.sh @@ -10,6 +10,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source VERBOSITY_LEVEL=2 +EXECUTE_TIMEOUT=120 cd ${BSIM_OUT_PATH}/bin diff --git a/tests/bsim/bluetooth/audio/test_scripts/csip_no_lock.sh b/tests/bsim/bluetooth/audio/test_scripts/csip_no_lock.sh index 4ee30c0901071..17fe61052a7fd 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/csip_no_lock.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/csip_no_lock.sh @@ -9,6 +9,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source VERBOSITY_LEVEL=2 +EXECUTE_TIMEOUT=120 cd ${BSIM_OUT_PATH}/bin diff --git a/tests/bsim/bluetooth/audio/test_scripts/csip_no_rank.sh b/tests/bsim/bluetooth/audio/test_scripts/csip_no_rank.sh index 8666d5fb5d442..54adbad569294 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/csip_no_rank.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/csip_no_rank.sh @@ -9,6 +9,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source VERBOSITY_LEVEL=2 +EXECUTE_TIMEOUT=120 cd ${BSIM_OUT_PATH}/bin diff --git a/tests/bsim/bluetooth/audio/test_scripts/csip_no_size.sh b/tests/bsim/bluetooth/audio/test_scripts/csip_no_size.sh index a566cec1f210b..bd04c4c39683e 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/csip_no_size.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/csip_no_size.sh @@ -9,7 +9,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source VERBOSITY_LEVEL=2 -EXECUTE_TIMEOUT=60 +EXECUTE_TIMEOUT=180 cd ${BSIM_OUT_PATH}/bin diff --git a/tests/bsim/bluetooth/audio/test_scripts/tbs.sh b/tests/bsim/bluetooth/audio/test_scripts/tbs.sh index 0662346a5355d..6344ff2aaed30 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/tbs.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/tbs.sh @@ -9,6 +9,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source SIMULATION_ID="tbs_ccp" VERBOSITY_LEVEL=2 +EXECUTE_TIMEOUT=120 cd ${BSIM_OUT_PATH}/bin diff --git a/tests/bsim/bluetooth/audio_samples/cap/tests_scripts/cap_broadcast.sh b/tests/bsim/bluetooth/audio_samples/cap/tests_scripts/cap_broadcast.sh index 7dcdc23c8595e..1791b48ed67f5 100755 --- a/tests/bsim/bluetooth/audio_samples/cap/tests_scripts/cap_broadcast.sh +++ b/tests/bsim/bluetooth/audio_samples/cap/tests_scripts/cap_broadcast.sh @@ -9,6 +9,7 @@ simulation_id="cap_broadcast_test" verbosity_level=2 +EXECUTE_TIMEOUT=120 source ${ZEPHYR_BASE}/tests/bsim/sh_common.source diff --git a/tests/bsim/bluetooth/audio_samples/cap/tests_scripts/cap_unicast.sh b/tests/bsim/bluetooth/audio_samples/cap/tests_scripts/cap_unicast.sh index aac786f791b2d..cc9d9fc9c83e5 100755 --- a/tests/bsim/bluetooth/audio_samples/cap/tests_scripts/cap_unicast.sh +++ b/tests/bsim/bluetooth/audio_samples/cap/tests_scripts/cap_unicast.sh @@ -9,6 +9,7 @@ simulation_id="cap_unicast_test" verbosity_level=2 +EXECUTE_TIMEOUT=120 source ${ZEPHYR_BASE}/tests/bsim/sh_common.source From 5da8eb3e9f03797550f33d3d3d21fe5f38082cfb Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Tue, 5 Nov 2024 14:28:02 +0100 Subject: [PATCH 2528/4482] tests/bsim/bluetooth/host: Increase EXECUTION_TIMEOUT where needed Increase the EXECUTION_TIMEOUT (real time timeout at which the test will be killed), so we have more margin for CI. Signed-off-by: Alberto Escolar Piedras --- tests/bsim/bluetooth/host/att/pipeline/test_scripts/run.sh | 1 + .../run_test_tolerate_pipeline_variant_rx_tx_prio_invert.sh | 1 + tests/bsim/bluetooth/host/att/timeout/test_scripts/run.sh | 1 + .../bluetooth/host/gatt/ccc_store/test_scripts/ccc_store.sh | 1 + .../bluetooth/host/gatt/ccc_store/test_scripts/ccc_store_2.sh | 1 + tests/bsim/bluetooth/host/iso/cis/tests_scripts/cis_disable.sh | 1 + tests/bsim/bluetooth/host/misc/acl_tx_frag/test_scripts/run.sh | 1 + .../bluetooth/host/privacy/peripheral/test_scripts/run_test.sh | 2 +- .../privacy/peripheral/test_scripts/run_test_rpa_expired.sh | 2 +- .../privacy/peripheral/test_scripts/run_test_rpa_sharing.sh | 2 +- 10 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/bsim/bluetooth/host/att/pipeline/test_scripts/run.sh b/tests/bsim/bluetooth/host/att/pipeline/test_scripts/run.sh index a31fa94d7da5c..dba6867a3aabb 100755 --- a/tests/bsim/bluetooth/host/att/pipeline/test_scripts/run.sh +++ b/tests/bsim/bluetooth/host/att/pipeline/test_scripts/run.sh @@ -10,6 +10,7 @@ tester_exe="bs_${BOARD_TS}_tests_bsim_bluetooth_host_att_pipeline_tester_prj_con simulation_id="att_pipeline" verbosity_level=2 sim_length_us=100e6 +EXECUTE_TIMEOUT=240 cd ${BSIM_OUT_PATH}/bin diff --git a/tests/bsim/bluetooth/host/att/pipeline/test_scripts/run_test_tolerate_pipeline_variant_rx_tx_prio_invert.sh b/tests/bsim/bluetooth/host/att/pipeline/test_scripts/run_test_tolerate_pipeline_variant_rx_tx_prio_invert.sh index bc7928e349f52..d5d90c645d34e 100755 --- a/tests/bsim/bluetooth/host/att/pipeline/test_scripts/run_test_tolerate_pipeline_variant_rx_tx_prio_invert.sh +++ b/tests/bsim/bluetooth/host/att/pipeline/test_scripts/run_test_tolerate_pipeline_variant_rx_tx_prio_invert.sh @@ -37,6 +37,7 @@ tester_exe="bs_${BOARD_TS}_tests_bsim_bluetooth_host_att_pipeline_tester_prj_con simulation_id="att_pipeline_test_tolerate_pipeline_variant_rx_tx_prio_invert" verbosity_level=2 sim_length_us=100e6 +EXECUTE_TIMEOUT=240 cd ${BSIM_OUT_PATH}/bin diff --git a/tests/bsim/bluetooth/host/att/timeout/test_scripts/run.sh b/tests/bsim/bluetooth/host/att/timeout/test_scripts/run.sh index bda0787f0746c..1a28986ba6b1d 100755 --- a/tests/bsim/bluetooth/host/att/timeout/test_scripts/run.sh +++ b/tests/bsim/bluetooth/host/att/timeout/test_scripts/run.sh @@ -5,6 +5,7 @@ set -eu -x source ${ZEPHYR_BASE}/tests/bsim/sh_common.source +EXECUTE_TIMEOUT=120 simulation_id="timeout" dev_exe=bs_${BOARD_TS}_$(guess_test_long_name)_prj_conf diff --git a/tests/bsim/bluetooth/host/gatt/ccc_store/test_scripts/ccc_store.sh b/tests/bsim/bluetooth/host/gatt/ccc_store/test_scripts/ccc_store.sh index c1bc4469739ab..e09177ef122ee 100755 --- a/tests/bsim/bluetooth/host/gatt/ccc_store/test_scripts/ccc_store.sh +++ b/tests/bsim/bluetooth/host/gatt/ccc_store/test_scripts/ccc_store.sh @@ -7,6 +7,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source test_exe="bs_${BOARD_TS}_$(guess_test_long_name)_prj_conf" simulation_id="ccc_store" verbosity_level=2 +EXECUTE_TIMEOUT=60 cd ${BSIM_OUT_PATH}/bin diff --git a/tests/bsim/bluetooth/host/gatt/ccc_store/test_scripts/ccc_store_2.sh b/tests/bsim/bluetooth/host/gatt/ccc_store/test_scripts/ccc_store_2.sh index 5eb1219913da1..29befb8660265 100755 --- a/tests/bsim/bluetooth/host/gatt/ccc_store/test_scripts/ccc_store_2.sh +++ b/tests/bsim/bluetooth/host/gatt/ccc_store/test_scripts/ccc_store_2.sh @@ -7,6 +7,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source test_exe="bs_${BOARD_TS}_$(guess_test_long_name)_prj_2_conf" simulation_id="ccc_store_2" verbosity_level=2 +EXECUTE_TIMEOUT=60 cd ${BSIM_OUT_PATH}/bin diff --git a/tests/bsim/bluetooth/host/iso/cis/tests_scripts/cis_disable.sh b/tests/bsim/bluetooth/host/iso/cis/tests_scripts/cis_disable.sh index dfd2d8d11e224..cb20190d668fb 100755 --- a/tests/bsim/bluetooth/host/iso/cis/tests_scripts/cis_disable.sh +++ b/tests/bsim/bluetooth/host/iso/cis/tests_scripts/cis_disable.sh @@ -6,6 +6,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source simulation_id="iso_cis_disable" verbosity_level=2 +EXECUTE_TIMEOUT=120 cd ${BSIM_OUT_PATH}/bin diff --git a/tests/bsim/bluetooth/host/misc/acl_tx_frag/test_scripts/run.sh b/tests/bsim/bluetooth/host/misc/acl_tx_frag/test_scripts/run.sh index 91eee9a078e07..e742f59b18f00 100755 --- a/tests/bsim/bluetooth/host/misc/acl_tx_frag/test_scripts/run.sh +++ b/tests/bsim/bluetooth/host/misc/acl_tx_frag/test_scripts/run.sh @@ -9,6 +9,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source test_name="$(guess_test_long_name)" simulation_id=${test_name} verbosity_level=2 +EXECUTE_TIMEOUT=120 # sixty-second (maximum) sim time. # The test will exit simulation as soon as it has passed. diff --git a/tests/bsim/bluetooth/host/privacy/peripheral/test_scripts/run_test.sh b/tests/bsim/bluetooth/host/privacy/peripheral/test_scripts/run_test.sh index d63d3da3eb878..f813bf1d86f59 100755 --- a/tests/bsim/bluetooth/host/privacy/peripheral/test_scripts/run_test.sh +++ b/tests/bsim/bluetooth/host/privacy/peripheral/test_scripts/run_test.sh @@ -7,7 +7,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source verbosity_level=2 simulation_id="host_privacy_peripheral" -EXECUTE_TIMEOUT=100 +EXECUTE_TIMEOUT=240 central_exe="${BSIM_OUT_PATH}/bin/bs_${BOARD_TS}_$(guess_test_long_name)_prj_conf" peripheral_exe="${central_exe}" diff --git a/tests/bsim/bluetooth/host/privacy/peripheral/test_scripts/run_test_rpa_expired.sh b/tests/bsim/bluetooth/host/privacy/peripheral/test_scripts/run_test_rpa_expired.sh index 0560dd562b170..90cb146fe798f 100755 --- a/tests/bsim/bluetooth/host/privacy/peripheral/test_scripts/run_test_rpa_expired.sh +++ b/tests/bsim/bluetooth/host/privacy/peripheral/test_scripts/run_test_rpa_expired.sh @@ -7,7 +7,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source verbosity_level=2 simulation_id="rpa_expired" -EXECUTE_TIMEOUT=100 +EXECUTE_TIMEOUT=240 central_exe_rpa_expired="\ ${BSIM_OUT_PATH}/bin/bs_${BOARD_TS}_$(guess_test_long_name)_prj_rpa_expired_conf" diff --git a/tests/bsim/bluetooth/host/privacy/peripheral/test_scripts/run_test_rpa_sharing.sh b/tests/bsim/bluetooth/host/privacy/peripheral/test_scripts/run_test_rpa_sharing.sh index 2f08758dc34f8..49daf4e5a86db 100755 --- a/tests/bsim/bluetooth/host/privacy/peripheral/test_scripts/run_test_rpa_sharing.sh +++ b/tests/bsim/bluetooth/host/privacy/peripheral/test_scripts/run_test_rpa_sharing.sh @@ -7,7 +7,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source verbosity_level=2 simulation_id="$(guess_test_long_name)_rpa_sharing" -EXECUTE_TIMEOUT=60 +EXECUTE_TIMEOUT=240 central_exe_rpa_sharing="\ ${BSIM_OUT_PATH}/bin/bs_${BOARD_TS}_$(guess_test_long_name)_prj_rpa_sharing_conf" From 6d53e376cbe80eeec04f6c65e3998bfd3e9420a1 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Tue, 5 Nov 2024 14:28:30 +0100 Subject: [PATCH 2529/4482] tests/bsim/bluetooth/ll: Increase EXECUTION_TIMEOUT where needed Increase the EXECUTION_TIMEOUT (real time timeout at which the test will be killed), so we have more margin for CI. Signed-off-by: Alberto Escolar Piedras --- tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso.sh | 1 + .../ll/bis/tests_scripts/broadcast_iso_scan_aux_use_chains.sh | 1 + .../ll/bis/tests_scripts/broadcast_iso_ticker_expire_info.sh | 1 + tests/bsim/bluetooth/ll/cis/tests_scripts/connected_iso.sh | 2 +- .../bluetooth/ll/cis/tests_scripts/connected_iso_legacy_adv.sh | 2 +- .../ll/cis/tests_scripts/connected_iso_peripheral_cis.sh | 2 +- .../bluetooth/ll/conn/tests_scripts/basic_conn_split_1ms.sh | 1 + tests/bsim/bluetooth/ll/throughput/tests_scripts/gatt_write.sh | 2 +- 8 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso.sh b/tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso.sh index b9177ed58179f..97f8f4636c68d 100755 --- a/tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso.sh +++ b/tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso.sh @@ -8,6 +8,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source # to the BIS. simulation_id="broadcast_iso" verbosity_level=2 +EXECUTE_TIMEOUT=120 cd ${BSIM_OUT_PATH}/bin diff --git a/tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso_scan_aux_use_chains.sh b/tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso_scan_aux_use_chains.sh index 310a98d082ab8..40c3fa00aad6d 100755 --- a/tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso_scan_aux_use_chains.sh +++ b/tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso_scan_aux_use_chains.sh @@ -8,6 +8,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source # to the BIS. simulation_id="broadcast_iso_scan_aux_use_chains" verbosity_level=2 +EXECUTE_TIMEOUT=120 cd ${BSIM_OUT_PATH}/bin diff --git a/tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso_ticker_expire_info.sh b/tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso_ticker_expire_info.sh index 8c9daf10bb99d..fd558598b1dae 100755 --- a/tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso_ticker_expire_info.sh +++ b/tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso_ticker_expire_info.sh @@ -8,6 +8,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source # to the BIS. simulation_id="broadcast_iso_ticker_expire_info" verbosity_level=2 +EXECUTE_TIMEOUT=120 cd ${BSIM_OUT_PATH}/bin diff --git a/tests/bsim/bluetooth/ll/cis/tests_scripts/connected_iso.sh b/tests/bsim/bluetooth/ll/cis/tests_scripts/connected_iso.sh index fe8e118560872..c6f4345a7f886 100755 --- a/tests/bsim/bluetooth/ll/cis/tests_scripts/connected_iso.sh +++ b/tests/bsim/bluetooth/ll/cis/tests_scripts/connected_iso.sh @@ -8,7 +8,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source # 1 CIS each to 9 Peripherals (9 CIS in a CIG) simulation_id="connected_iso" verbosity_level=2 -EXECUTE_TIMEOUT=200 +EXECUTE_TIMEOUT=600 cd ${BSIM_OUT_PATH}/bin diff --git a/tests/bsim/bluetooth/ll/cis/tests_scripts/connected_iso_legacy_adv.sh b/tests/bsim/bluetooth/ll/cis/tests_scripts/connected_iso_legacy_adv.sh index 5574a0cbecf25..d8925ed616d40 100755 --- a/tests/bsim/bluetooth/ll/cis/tests_scripts/connected_iso_legacy_adv.sh +++ b/tests/bsim/bluetooth/ll/cis/tests_scripts/connected_iso_legacy_adv.sh @@ -8,7 +8,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source # 1 CIS each to 9 Peripherals (9 CIS in a CIG) simulation_id="connected_iso_legacy_adv" verbosity_level=2 -EXECUTE_TIMEOUT=200 +EXECUTE_TIMEOUT=500 cd ${BSIM_OUT_PATH}/bin diff --git a/tests/bsim/bluetooth/ll/cis/tests_scripts/connected_iso_peripheral_cis.sh b/tests/bsim/bluetooth/ll/cis/tests_scripts/connected_iso_peripheral_cis.sh index ab1e5c723927e..63bf63ce11f3d 100755 --- a/tests/bsim/bluetooth/ll/cis/tests_scripts/connected_iso_peripheral_cis.sh +++ b/tests/bsim/bluetooth/ll/cis/tests_scripts/connected_iso_peripheral_cis.sh @@ -7,7 +7,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source # Basic Connected ISO test: multiple peripheral CIS establishment simulation_id="connected_iso_peripheral_cis" verbosity_level=2 -EXECUTE_TIMEOUT=100 +EXECUTE_TIMEOUT=240 cd ${BSIM_OUT_PATH}/bin diff --git a/tests/bsim/bluetooth/ll/conn/tests_scripts/basic_conn_split_1ms.sh b/tests/bsim/bluetooth/ll/conn/tests_scripts/basic_conn_split_1ms.sh index 0be845f12d67f..3636ed90380f0 100755 --- a/tests/bsim/bluetooth/ll/conn/tests_scripts/basic_conn_split_1ms.sh +++ b/tests/bsim/bluetooth/ll/conn/tests_scripts/basic_conn_split_1ms.sh @@ -9,6 +9,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source # interval simulation_id="basic_conn_split_1ms" verbosity_level=2 +EXECUTE_TIMEOUT=120 cd ${BSIM_OUT_PATH}/bin diff --git a/tests/bsim/bluetooth/ll/throughput/tests_scripts/gatt_write.sh b/tests/bsim/bluetooth/ll/throughput/tests_scripts/gatt_write.sh index ff79071857f0c..12881ee88c075 100755 --- a/tests/bsim/bluetooth/ll/throughput/tests_scripts/gatt_write.sh +++ b/tests/bsim/bluetooth/ll/throughput/tests_scripts/gatt_write.sh @@ -6,7 +6,7 @@ source ${ZEPHYR_BASE}/tests/bsim/sh_common.source simulation_id="ll-throughput" verbosity_level=2 -EXECUTE_TIMEOUT=60 +EXECUTE_TIMEOUT=240 cd ${BSIM_OUT_PATH}/bin From 8386929944fcee760418e503b879dd0e086b3b05 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Tue, 5 Nov 2024 14:20:45 +0100 Subject: [PATCH 2530/4482] tests: Bluetooth: Tester: Log conn changes Log the address and the err/reason values in the connected and disconnect callbacks. Since these values are not part of the BTP events it is difficult to follow the order and reason why disconnects happen when debugging. Signed-off-by: Emil Gydesen --- tests/bluetooth/tester/src/btp_gap.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/bluetooth/tester/src/btp_gap.c b/tests/bluetooth/tester/src/btp_gap.c index f08269570e51c..029e15f17681a 100644 --- a/tests/bluetooth/tester/src/btp_gap.c +++ b/tests/bluetooth/tester/src/btp_gap.c @@ -6,6 +6,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include #include #include @@ -103,8 +104,12 @@ static uint8_t read_car_cb(struct bt_conn *conn, uint8_t err, static void le_connected(struct bt_conn *conn, uint8_t err) { struct btp_gap_device_connected_ev ev; + char addr_str[BT_ADDR_LE_STR_LEN]; struct bt_conn_info info; + (void)bt_addr_le_to_str(bt_conn_get_dst(conn), addr_str, sizeof(addr_str)); + LOG_DBG("%s: 0x%02x", addr_str, err); + if (err) { return; } @@ -131,6 +136,10 @@ static void le_disconnected(struct bt_conn *conn, uint8_t reason) { struct btp_gap_device_disconnected_ev ev; const bt_addr_le_t *addr = bt_conn_get_dst(conn); + char addr_str[BT_ADDR_LE_STR_LEN]; + + (void)bt_addr_le_to_str(bt_conn_get_dst(conn), addr_str, sizeof(addr_str)); + LOG_DBG("%s: 0x%02x", addr_str, reason); bt_addr_le_copy(&ev.address, addr); From 8646a6c289dadc3391c9e7f8a02a831950cb3bd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Tue, 5 Nov 2024 10:10:23 +0100 Subject: [PATCH 2531/4482] net: ethernet: arp: extend error log MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a gateway is not set for a interface, also log the destination address. Also print the interface index instead of the interface pointer. Signed-off-by: Fin Maaß --- subsys/net/l2/ethernet/arp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/subsys/net/l2/ethernet/arp.c b/subsys/net/l2/ethernet/arp.c index 07066472da964..7d87f78e938e0 100644 --- a/subsys/net/l2/ethernet/arp.c +++ b/subsys/net/l2/ethernet/arp.c @@ -377,8 +377,10 @@ struct net_pkt *net_arp_prepare(struct net_pkt *pkt, if (ipv4) { addr = &ipv4->gw; if (net_ipv4_is_addr_unspecified(addr)) { - NET_ERR("Gateway not set for iface %p", - net_pkt_iface(pkt)); + NET_ERR("Gateway not set for iface %d, could not " + "send ARP request for %s", + net_if_get_by_iface(net_pkt_iface(pkt)), + net_sprint_ipv4_addr(request_ip)); return NULL; } From 0439cbc29c132a69eaee4de4629da071a30fdddb Mon Sep 17 00:00:00 2001 From: Aaron Ye Date: Tue, 5 Nov 2024 15:16:39 +0800 Subject: [PATCH 2532/4482] drivers: bluetooth: hci: add close function for Ambiq Apollo3x This commit adds the bt_hci_driver.close function for Ambiq Apollo3x SoC. Also update the hal_ambiq revision including the necessary support. Signed-off-by: Aaron Ye --- drivers/bluetooth/hci/apollox_blue.c | 19 +++++++++++++++++++ drivers/bluetooth/hci/apollox_blue.h | 7 +++++++ drivers/bluetooth/hci/hci_ambiq.c | 16 ++++++++++++++++ west.yml | 2 +- 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/hci/apollox_blue.c b/drivers/bluetooth/hci/apollox_blue.c index 7994069a5a2a4..ab9abd07d4aa3 100644 --- a/drivers/bluetooth/hci/apollox_blue.c +++ b/drivers/bluetooth/hci/apollox_blue.c @@ -341,6 +341,25 @@ int bt_apollo_controller_init(spi_transmit_fun transmit) return ret; } +int bt_apollo_controller_deinit(void) +{ + int ret = -ENOTSUP; + +#if (CONFIG_SOC_SERIES_APOLLO3X) + irq_disable(DT_IRQN(SPI_DEV_NODE)); + + ret = am_apollo3_bt_controller_deinit(); + if (ret == AM_HAL_STATUS_SUCCESS) { + LOG_INF("BT controller deinitialized"); + } else { + ret = -EPERM; + LOG_ERR("BT controller deinitialization fails"); + } +#endif /* CONFIG_SOC_SERIES_APOLLO3X */ + + return ret; +} + #if (CONFIG_SOC_SERIES_APOLLO4X) static int bt_apollo_set_nvds(void) { diff --git a/drivers/bluetooth/hci/apollox_blue.h b/drivers/bluetooth/hci/apollox_blue.h index 85e586d790856..dbc497b0dcda3 100644 --- a/drivers/bluetooth/hci/apollox_blue.h +++ b/drivers/bluetooth/hci/apollox_blue.h @@ -81,6 +81,13 @@ int bt_apollo_spi_rcv(uint8_t *data, uint16_t *len, bt_spi_transceive_fun transc */ int bt_apollo_controller_init(spi_transmit_fun transmit); +/** + * @brief Deinitialize the BLE controller. + * + * @return 0 on success or negative error number on failure. + */ +int bt_apollo_controller_deinit(void); + /** * @brief Vendor specific setup before general HCI command sequence for * Bluetooth application. diff --git a/drivers/bluetooth/hci/hci_ambiq.c b/drivers/bluetooth/hci/hci_ambiq.c index 622b400ba8adf..a00139094492d 100644 --- a/drivers/bluetooth/hci/hci_ambiq.c +++ b/drivers/bluetooth/hci/hci_ambiq.c @@ -396,6 +396,21 @@ static int bt_apollo_open(const struct device *dev, bt_hci_recv_t recv) return ret; } +static int bt_apollo_close(const struct device *dev) +{ + int ret; + struct bt_apollo_data *hci = dev->data; + + ret = bt_apollo_controller_deinit(); + if (ret) { + return ret; + } + + hci->recv = NULL; + + return ret; +} + static int bt_apollo_setup(const struct device *dev, const struct bt_hci_setup_params *params) { ARG_UNUSED(params); @@ -409,6 +424,7 @@ static int bt_apollo_setup(const struct device *dev, const struct bt_hci_setup_p static const struct bt_hci_driver_api drv = { .open = bt_apollo_open, + .close = bt_apollo_close, .send = bt_apollo_send, .setup = bt_apollo_setup, }; diff --git a/west.yml b/west.yml index 100234bda0620..720932219f44f 100644 --- a/west.yml +++ b/west.yml @@ -147,7 +147,7 @@ manifest: groups: - hal - name: hal_ambiq - revision: d3092f9b82874a1791baa3ac41c3795d108fbbdb + revision: 87a188b91aca22ce3ce7deb4a1cbf7780d784673 path: modules/hal/ambiq groups: - hal From e7c74e8f3034a33b879620026b3acb51a34b0892 Mon Sep 17 00:00:00 2001 From: Lars-Ove Karlsson Date: Tue, 5 Nov 2024 08:54:07 +0100 Subject: [PATCH 2533/4482] tests: kernel: fpu_sharing Fixed missing struct defs for ARM Added empty fp register structs for ARM combinations not handled, i.e. any ARM without a fpu. Signed-off-by: Lars-Ove Karlsson --- tests/kernel/fpu_sharing/generic/src/float_context.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/kernel/fpu_sharing/generic/src/float_context.h b/tests/kernel/fpu_sharing/generic/src/float_context.h index 304057e7538a4..43964af460230 100644 --- a/tests/kernel/fpu_sharing/generic/src/float_context.h +++ b/tests/kernel/fpu_sharing/generic/src/float_context.h @@ -96,6 +96,16 @@ struct fp_non_volatile_register_set { float s[16]; }; +#else + +struct fp_volatile_register_set { + /* No volatile floating point registers */ +}; + +struct fp_non_volatile_register_set { + /* No non-volatile floating point registers */ +}; + #endif #define SIZEOF_FP_VOLATILE_REGISTER_SET \ From 834fa11e6bdc2ab732014497049b1110b496c1d7 Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Mon, 4 Nov 2024 15:56:20 -0300 Subject: [PATCH 2534/4482] drivers: gpio: esp32: Add input/output enable flags Flags added allow keeping a pin as input/output by not disabling the output buffer when configuring it as an input and by not disabling input enable when configuring it as output. This can be useful to implement signal diagnosis or for testing purposes. Signed-off-by: Raffael Rostagno --- drivers/gpio/gpio_esp32.c | 8 ++++++-- .../dt-bindings/gpio/espressif-esp32-gpio.h | 20 +++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio_esp32.c b/drivers/gpio/gpio_esp32.c index d0c933ca37df1..e7e243e75cd07 100644 --- a/drivers/gpio/gpio_esp32.c +++ b/drivers/gpio/gpio_esp32.c @@ -263,13 +263,17 @@ static int gpio_esp32_config(const struct device *dev, gpio_ll_set_level(cfg->gpio_base, io_pin, 0); } } else { - gpio_ll_output_disable(&GPIO, io_pin); + if (!(flags & ESP32_GPIO_PIN_OUT_EN)) { + gpio_ll_output_disable(&GPIO, io_pin); + } } if (flags & GPIO_INPUT) { gpio_ll_input_enable(&GPIO, io_pin); } else { - gpio_ll_input_disable(&GPIO, io_pin); + if (!(flags & ESP32_GPIO_PIN_IN_EN)) { + gpio_ll_input_disable(&GPIO, io_pin); + } } end: diff --git a/include/zephyr/dt-bindings/gpio/espressif-esp32-gpio.h b/include/zephyr/dt-bindings/gpio/espressif-esp32-gpio.h index 36f824cd2ad58..cbea44cdfb2dd 100644 --- a/include/zephyr/dt-bindings/gpio/espressif-esp32-gpio.h +++ b/include/zephyr/dt-bindings/gpio/espressif-esp32-gpio.h @@ -32,4 +32,24 @@ /** @} */ +/** + * @name GPIO pin input/output enable flags + * + * These flags allow configuring a pin as input or output while keeping untouched + * its complementary configuration. By instance, if we configure a GPIO pin as an + * input and pass the flag ESP32_GPIO_PIN_OUT_EN, the driver will not disable the + * pin's output buffer. This functionality can be useful to render a pin both an + * input and output, for diagnose or testing purposes. + * + * @{ + */ + +/** Keep GPIO pin enabled as output */ +#define ESP32_GPIO_PIN_OUT_EN (1 << 12) + +/** Keep GPIO pin enabled as input */ +#define ESP32_GPIO_PIN_IN_EN (1 << 13) + +/** @} */ + #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_ESPRESSIF_ESP32_GPIO_H_ */ From 5aa835c66b7611bfeb7ccb4d94b0b832f00294dc Mon Sep 17 00:00:00 2001 From: Benedikt Schmidt Date: Mon, 4 Nov 2024 14:14:04 +0100 Subject: [PATCH 2535/4482] drivers: fpga: simplify load mode selection of iCE40 Replace the enum for load modes for the iCE40 with a boolean flag, as there are only two options: - SPI: default, which should be used whenever possible - GPIO bitbang: workarorund, in case a low-end microcontroller is used Signed-off-by: Benedikt Schmidt --- drivers/fpga/fpga_ice40.c | 17 ++--------------- dts/bindings/fpga/lattice,ice40-fpga.yaml | 20 +++++++------------- tests/drivers/build_all/fpga/spi.dtsi | 3 +-- 3 files changed, 10 insertions(+), 30 deletions(-) diff --git a/drivers/fpga/fpga_ice40.c b/drivers/fpga/fpga_ice40.c index 16512a9260761..47d4e2b487f72 100644 --- a/drivers/fpga/fpga_ice40.c +++ b/drivers/fpga/fpga_ice40.c @@ -42,14 +42,7 @@ * achieve the minimum 1 MHz clock rate for loading the iCE40 bistream. So * in order to bitbang on lower-end microcontrollers, we actually require * direct register access to the set and clear registers. - * - * With that, this driver is left with 2 possible modes of operation which - * are: - * - FPGA_ICE40_LOAD_MODE_SPI (for higher-end microcontrollers) - * - FPGA_ICE40_LOAD_MODE_GPIO (for lower-end microcontrollers) */ -#define FPGA_ICE40_LOAD_MODE_SPI 0 -#define FPGA_ICE40_LOAD_MODE_GPIO 1 /* * Values in Hz, intentionally to be comparable with the spi-max-frequency @@ -111,7 +104,7 @@ static void fpga_ice40_crc_to_str(uint32_t crc, char *s) /* * This is a calibrated delay loop used to achieve a 1 MHz SPI_CLK frequency - * with FPGA_ICE40_LOAD_MODE_GPIO. It is used both in fpga_ice40_send_clocks() + * with the bitbang mode. It is used both in fpga_ice40_send_clocks() * and fpga_ice40_spi_send_data(). * * Calibration is achieved via the mhz_delay_count device tree parameter. See @@ -573,12 +566,8 @@ static int fpga_ice40_init(const struct device *dev) #define FPGA_ICE40_GPIO_PINS(inst, name) (volatile gpio_port_pins_t *)DT_INST_PROP_OR(inst, name, 0) -#define FPGA_ICE40_LOAD_MODE(inst) DT_INST_PROP(inst, load_mode) #define FPGA_ICE40_LOAD_FUNC(inst) \ - (FPGA_ICE40_LOAD_MODE(inst) == FPGA_ICE40_LOAD_MODE_SPI \ - ? fpga_ice40_load_spi \ - : (FPGA_ICE40_LOAD_MODE(inst) == FPGA_ICE40_LOAD_MODE_GPIO ? fpga_ice40_load_gpio \ - : NULL)) + (DT_INST_PROP(inst, load_mode_bitbang) ? fpga_ice40_load_gpio : fpga_ice40_load_spi) #ifdef CONFIG_PINCTRL #define FPGA_ICE40_PINCTRL_CONFIG(inst) .pincfg = PINCTRL_DT_DEV_CONFIG_GET(DT_INST_PARENT(inst)), @@ -589,8 +578,6 @@ static int fpga_ice40_init(const struct device *dev) #endif #define FPGA_ICE40_DEFINE(inst) \ - BUILD_ASSERT(FPGA_ICE40_LOAD_MODE(inst) == FPGA_ICE40_LOAD_MODE_SPI || \ - FPGA_ICE40_LOAD_MODE(inst) == FPGA_ICE40_LOAD_MODE_GPIO); \ BUILD_ASSERT(FPGA_ICE40_BUS_FREQ(inst) >= FPGA_ICE40_SPI_HZ_MIN); \ BUILD_ASSERT(FPGA_ICE40_BUS_FREQ(inst) <= FPGA_ICE40_SPI_HZ_MAX); \ BUILD_ASSERT(FPGA_ICE40_CONFIG_DELAY_US(inst) >= FPGA_ICE40_CONFIG_DELAY_US_MIN); \ diff --git a/dts/bindings/fpga/lattice,ice40-fpga.yaml b/dts/bindings/fpga/lattice,ice40-fpga.yaml index 530f99e679cc3..2e8cb010d271c 100644 --- a/dts/bindings/fpga/lattice,ice40-fpga.yaml +++ b/dts/bindings/fpga/lattice,ice40-fpga.yaml @@ -8,20 +8,14 @@ compatible: "lattice,ice40-fpga" include: spi-device.yaml properties: - load-mode: - type: int - required: true + load-mode-bitbang: + type: boolean description: | - Configure the method used to load the bitstream. - The bitstream may be loaded via 2 separate methods: - 0 := load the FPGA via SPI transfer - 1 := load the FPGA via bit-banged GPIO - Option 0 may be suitable for some high-end microcontrollers. - Option 1 is suitable for low-end microcontrollers. This option - requires clk-gpios, pico-gpios, gpios-set-reg, and gpios-clear-reg - to be defined. - Example usage: - load-mode = <0>; + Select the bitbang mode for loading the bitstream into the FPGA. + This is a workaround to meet the timing requirements fo the iCE40 + on low-end microcontrollers. + This option requires clk-gpios, pico-gpios, gpios-set-reg, and + gpios-clear-reg to be defined. cdone-gpios: type: phandle-array required: true diff --git a/tests/drivers/build_all/fpga/spi.dtsi b/tests/drivers/build_all/fpga/spi.dtsi index c5b439d97e9b1..008b51b01a8a7 100644 --- a/tests/drivers/build_all/fpga/spi.dtsi +++ b/tests/drivers/build_all/fpga/spi.dtsi @@ -13,7 +13,7 @@ test_spi_fpga_ice40_gpio: ice40@0 { reg = <0>; spi-max-frequency = <1000000>; - load-mode = <0>; + load-mode-bitbang; cdone-gpios = <&test_gpio 0 0>; creset-gpios = <&test_gpio 0 0>; config-delay-us = <3900>; @@ -26,7 +26,6 @@ test_spi_fpga_ice40_spi: ice40@1 { reg = <1>; spi-max-frequency = <1000000>; - load-mode = <1>; cdone-gpios = <&test_gpio 0 0>; creset-gpios = <&test_gpio 0 0>; clk-gpios = <&test_gpio 0 0>; From 2506d599a38c8720970a7e6c212a5dc68eecee8f Mon Sep 17 00:00:00 2001 From: Nils Bosbach Date: Mon, 4 Nov 2024 13:58:00 +0100 Subject: [PATCH 2536/4482] drivers: interrupt_controller: do not set sgi type The GICD_ICFGR0 register is read only because SGIs are always edge-triggered. Signed-off-by: Nils Bosbach --- drivers/interrupt_controller/intc_gic.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/interrupt_controller/intc_gic.c b/drivers/interrupt_controller/intc_gic.c index 61f73a52623e4..0b3050cf1af62 100644 --- a/drivers/interrupt_controller/intc_gic.c +++ b/drivers/interrupt_controller/intc_gic.c @@ -113,13 +113,16 @@ void arm_gic_irq_set_priority( int_grp = (irq / 16) * 4; int_off = (irq % 16) * 2; - val = sys_read32(GICD_ICFGRn + int_grp); - val &= ~(GICD_ICFGR_MASK << int_off); - if (flags & IRQ_TYPE_EDGE) { - val |= (GICD_ICFGR_TYPE << int_off); + /* GICD_ICFGR0 is read-only; SGIs are always edge-triggered */ + if (int_grp != 0) { + val = sys_read32(GICD_ICFGRn + int_grp); + val &= ~(GICD_ICFGR_MASK << int_off); + if (flags & IRQ_TYPE_EDGE) { + val |= (GICD_ICFGR_TYPE << int_off); + } + + sys_write32(val, GICD_ICFGRn + int_grp); } - - sys_write32(val, GICD_ICFGRn + int_grp); } unsigned int arm_gic_get_active(void) From 59126aca7ec6fc5e8d688e2962187339f2910014 Mon Sep 17 00:00:00 2001 From: Timothy Keys Date: Mon, 4 Nov 2024 12:21:05 +0000 Subject: [PATCH 2537/4482] Bluetooth: Host: Fix spelling mistakes in cs.h Fix a spelling mistake in the enum bt_le_cs_procedure_phy, and various mistakes in comments. Signed-off-by: Timothy Keys --- include/zephyr/bluetooth/cs.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/zephyr/bluetooth/cs.h b/include/zephyr/bluetooth/cs.h index e7043f667629d..aaa410da2d27c 100644 --- a/include/zephyr/bluetooth/cs.h +++ b/include/zephyr/bluetooth/cs.h @@ -215,7 +215,7 @@ enum bt_le_cs_test_override_4_tone_antenna_permutation { BT_LE_CS_TEST_OVERRIDE_4_ANTENNA_PERMUTATION_INDEX_21 = BT_HCI_OP_LE_CS_TEST_AP_INDEX_21, BT_LE_CS_TEST_OVERRIDE_4_ANTENNA_PERMUTATION_INDEX_22 = BT_HCI_OP_LE_CS_TEST_AP_INDEX_22, BT_LE_CS_TEST_OVERRIDE_4_ANTENNA_PERMUTATION_INDEX_23 = BT_HCI_OP_LE_CS_TEST_AP_INDEX_23, - /** Loop through all valid Antenna Permuation Indices starting + /** Loop through all valid Antenna Permutation Indices starting * from the lowest index. */ BT_LE_CS_TEST_OVERRIDE_4_ANTENNA_PERMUTATION_INDEX_LOOP = @@ -638,7 +638,7 @@ int bt_le_cs_test_cb_register(struct bt_le_cs_test_cb cs_test_cb); * of either the initiator or reflector. * * The first mode-0 channel in the list is used as the starting channel for - * the test. At the beginning of any test, the IUT in the flector role shall + * the test. At the beginning of any test, the IUT in the reflector role shall * listen on the first mode-0 channel until it receives the first transmission * from the initiator. Similarly, with the IUT in the initiator role, the tester * will start by listening on the first mode-0 channel and the IUT shall transmit @@ -718,7 +718,7 @@ void bt_le_cs_step_data_parse(struct net_buf_simple *step_data_buf, /** @brief CS Security Enable * - * This commmand is used to start or restart the Channel Sounding Security + * This command is used to start or restart the Channel Sounding Security * Start procedure in the local Controller for the ACL connection identified * in the conn parameter. * @@ -753,7 +753,7 @@ int bt_le_cs_procedure_enable(struct bt_conn *conn, enum bt_le_cs_procedure_phy { BT_LE_CS_PROCEDURE_PHY_1M = BT_HCI_OP_LE_CS_PROCEDURE_PHY_1M, - BT_LE_CS_PROCEUDRE_PHY_2M = BT_HCI_OP_LE_CS_PROCEDURE_PHY_2M, + BT_LE_CS_PROCEDURE_PHY_2M = BT_HCI_OP_LE_CS_PROCEDURE_PHY_2M, BT_LE_CS_PROCEDURE_PHY_CODED_S8 = BT_HCI_OP_LE_CS_PROCEDURE_PHY_CODED_S8, BT_LE_CS_PROCEDURE_PHY_CODED_S2 = BT_HCI_OP_LE_CS_PROCEDURE_PHY_CODED_S2, }; From 97399d4027ccd027b3c8756405c7a3fb9cc30f32 Mon Sep 17 00:00:00 2001 From: Timothy Keys Date: Mon, 4 Nov 2024 12:29:43 +0000 Subject: [PATCH 2538/4482] Bluetooth: Host: Remove code causing build error This code is redundant and causes a build error if called more than once. Signed-off-by: Timothy Keys --- tests/bluetooth/host/cs/mocks/hci_core.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/bluetooth/host/cs/mocks/hci_core.c b/tests/bluetooth/host/cs/mocks/hci_core.c index 34ae77164cc19..5830c302a4755 100644 --- a/tests/bluetooth/host/cs/mocks/hci_core.c +++ b/tests/bluetooth/host/cs/mocks/hci_core.c @@ -9,11 +9,5 @@ #include #include -#include - -struct bt_dev bt_dev = { - .manufacturer = 0x1234, -}; - DEFINE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_create, uint16_t, uint8_t); DEFINE_FAKE_VALUE_FUNC(int, bt_hci_cmd_send_sync, uint16_t, struct net_buf *, struct net_buf **); From e976a01bedff4ef4c122c2d7e63cb480784a5dde Mon Sep 17 00:00:00 2001 From: Timothy Keys Date: Thu, 31 Oct 2024 15:08:18 +0000 Subject: [PATCH 2539/4482] Bluetooth: Host: Unit test for bt_le_cs_set_valid_chmap_bits Add coverage of the bt_le_cs_set_valid_chmap_bits function to unit tests Signed-off-by: Timothy Keys --- .../CMakeLists.txt | 26 ++++++++++++++++ .../cs/bt_le_cs_set_valid_chmap_bits/prj.conf | 10 +++++++ .../bt_le_cs_set_valid_chmap_bits/src/main.c | 30 +++++++++++++++++++ .../testcase.yaml | 7 +++++ 4 files changed, 73 insertions(+) create mode 100644 tests/bluetooth/host/cs/bt_le_cs_set_valid_chmap_bits/CMakeLists.txt create mode 100644 tests/bluetooth/host/cs/bt_le_cs_set_valid_chmap_bits/prj.conf create mode 100644 tests/bluetooth/host/cs/bt_le_cs_set_valid_chmap_bits/src/main.c create mode 100644 tests/bluetooth/host/cs/bt_le_cs_set_valid_chmap_bits/testcase.yaml diff --git a/tests/bluetooth/host/cs/bt_le_cs_set_valid_chmap_bits/CMakeLists.txt b/tests/bluetooth/host/cs/bt_le_cs_set_valid_chmap_bits/CMakeLists.txt new file mode 100644 index 0000000000000..aee0c445f6b2d --- /dev/null +++ b/tests/bluetooth/host/cs/bt_le_cs_set_valid_chmap_bits/CMakeLists.txt @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +get_filename_component(project_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) +project(${project_name}) + +include_directories(BEFORE + ${ZEPHYR_BASE}/tests/bluetooth/host/cs/mocks +) + +add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/host host_mocks) +add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/host/cs/mocks mocks) + +target_link_libraries(testbinary PRIVATE mocks host_mocks) + +target_sources(testbinary + PRIVATE + src/main.c + + ${ZEPHYR_BASE}/subsys/bluetooth/host/cs.c + ${ZEPHYR_BASE}/lib/net_buf/buf_simple.c + ${ZEPHYR_BASE}/subsys/logging/log_minimal.c +) diff --git a/tests/bluetooth/host/cs/bt_le_cs_set_valid_chmap_bits/prj.conf b/tests/bluetooth/host/cs/bt_le_cs_set_valid_chmap_bits/prj.conf new file mode 100644 index 0000000000000..8ff995b6f0405 --- /dev/null +++ b/tests/bluetooth/host/cs/bt_le_cs_set_valid_chmap_bits/prj.conf @@ -0,0 +1,10 @@ +CONFIG_ZTEST=y +CONFIG_BT=y +CONFIG_BT_HCI=y +CONFIG_BT_CENTRAL=y +CONFIG_BT_CHANNEL_SOUNDING=y +CONFIG_ASSERT=y +CONFIG_ASSERT_LEVEL=2 +CONFIG_ASSERT_VERBOSE=y +CONFIG_ASSERT_ON_ERRORS=y +CONFIG_NET_BUF=y diff --git a/tests/bluetooth/host/cs/bt_le_cs_set_valid_chmap_bits/src/main.c b/tests/bluetooth/host/cs/bt_le_cs_set_valid_chmap_bits/src/main.c new file mode 100644 index 0000000000000..72784fba71dbe --- /dev/null +++ b/tests/bluetooth/host/cs/bt_le_cs_set_valid_chmap_bits/src/main.c @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +DEFINE_FFF_GLOBALS; + +ZTEST_SUITE(bt_le_cs_set_valid_chmap_bits, NULL, NULL, NULL, NULL, NULL); + +/* + * Test uninitialized chmap buffer is populated correctly + * + * Expected behaviour: + * - test_chmap matches correct_chmap + */ +ZTEST(bt_le_cs_set_valid_chmap_bits, test_uninitialized_chmap) +{ + uint8_t test_chmap[10]; + + bt_le_cs_set_valid_chmap_bits(test_chmap); + + uint8_t correct_chmap[10] = {0xFC, 0xFF, 0x7F, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F}; + + zassert_mem_equal(test_chmap, correct_chmap, 10); +} diff --git a/tests/bluetooth/host/cs/bt_le_cs_set_valid_chmap_bits/testcase.yaml b/tests/bluetooth/host/cs/bt_le_cs_set_valid_chmap_bits/testcase.yaml new file mode 100644 index 0000000000000..b040e50155924 --- /dev/null +++ b/tests/bluetooth/host/cs/bt_le_cs_set_valid_chmap_bits/testcase.yaml @@ -0,0 +1,7 @@ +common: + tags: + - bluetooth + - host +tests: + bluetooth.host.cs.bt_le_cs_set_valid_chmap_bits: + type: unit From a505078c603b6802a51ce923244f6c2edb5ba077 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 15 Nov 2024 07:47:23 -0500 Subject: [PATCH 2540/4482] tests: cmsis_dsp: reduce architecture scope Filters already only allow arm and native, so exclude everything else very early and reduce churn and build time. Signed-off-by: Anas Nashif --- tests/lib/cmsis_dsp/bayes/testcase.yaml | 4 ++++ tests/lib/cmsis_dsp/complexmath/testcase.yaml | 4 ++++ tests/lib/cmsis_dsp/distance/testcase.yaml | 4 ++++ tests/lib/cmsis_dsp/fastmath/testcase.yaml | 4 ++++ tests/lib/cmsis_dsp/filtering/testcase.yaml | 4 +++- tests/lib/cmsis_dsp/interpolation/testcase.yaml | 4 ++++ tests/lib/cmsis_dsp/matrix/testcase.yaml | 4 ++++ tests/lib/cmsis_dsp/quaternionmath/testcase.yaml | 4 ++++ tests/lib/cmsis_dsp/statistics/testcase.yaml | 4 ++++ tests/lib/cmsis_dsp/support/testcase.yaml | 4 ++++ tests/lib/cmsis_dsp/svm/testcase.yaml | 4 ++++ tests/lib/cmsis_dsp/transform/testcase.yaml | 4 ++++ 12 files changed, 47 insertions(+), 1 deletion(-) diff --git a/tests/lib/cmsis_dsp/bayes/testcase.yaml b/tests/lib/cmsis_dsp/bayes/testcase.yaml index dd02226fc5a2f..31eb41cf6a0aa 100644 --- a/tests/lib/cmsis_dsp/bayes/testcase.yaml +++ b/tests/lib/cmsis_dsp/bayes/testcase.yaml @@ -1,3 +1,7 @@ +common: + arch_allow: + - arm + - posix tests: libraries.cmsis_dsp.bayes: filter: ((CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_FULL_LIBC_SUPPORTED diff --git a/tests/lib/cmsis_dsp/complexmath/testcase.yaml b/tests/lib/cmsis_dsp/complexmath/testcase.yaml index c287a8a113aa2..4efeb77815a67 100644 --- a/tests/lib/cmsis_dsp/complexmath/testcase.yaml +++ b/tests/lib/cmsis_dsp/complexmath/testcase.yaml @@ -1,3 +1,7 @@ +common: + arch_allow: + - arm + - posix tests: libraries.cmsis_dsp.complexmath: filter: ((CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_FULL_LIBC_SUPPORTED diff --git a/tests/lib/cmsis_dsp/distance/testcase.yaml b/tests/lib/cmsis_dsp/distance/testcase.yaml index 00c7ab8c7f4aa..90b01e2daf0d5 100644 --- a/tests/lib/cmsis_dsp/distance/testcase.yaml +++ b/tests/lib/cmsis_dsp/distance/testcase.yaml @@ -1,3 +1,7 @@ +common: + arch_allow: + - arm + - posix tests: libraries.cmsis_dsp.distance: filter: ((CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_FULL_LIBC_SUPPORTED diff --git a/tests/lib/cmsis_dsp/fastmath/testcase.yaml b/tests/lib/cmsis_dsp/fastmath/testcase.yaml index d3da7020f3656..7303be487d4ec 100644 --- a/tests/lib/cmsis_dsp/fastmath/testcase.yaml +++ b/tests/lib/cmsis_dsp/fastmath/testcase.yaml @@ -1,3 +1,7 @@ +common: + arch_allow: + - arm + - posix tests: libraries.cmsis_dsp.fastmath: filter: ((CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_FULL_LIBC_SUPPORTED diff --git a/tests/lib/cmsis_dsp/filtering/testcase.yaml b/tests/lib/cmsis_dsp/filtering/testcase.yaml index 89af8c52cfb4d..ad12446b9911c 100644 --- a/tests/lib/cmsis_dsp/filtering/testcase.yaml +++ b/tests/lib/cmsis_dsp/filtering/testcase.yaml @@ -1,6 +1,8 @@ common: toolchain_exclude: llvm - + arch_allow: + - arm + - posix tests: libraries.cmsis_dsp.filtering: filter: ((CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_FULL_LIBC_SUPPORTED diff --git a/tests/lib/cmsis_dsp/interpolation/testcase.yaml b/tests/lib/cmsis_dsp/interpolation/testcase.yaml index d99111037f84f..1577b9958d6c3 100644 --- a/tests/lib/cmsis_dsp/interpolation/testcase.yaml +++ b/tests/lib/cmsis_dsp/interpolation/testcase.yaml @@ -1,3 +1,7 @@ +common: + arch_allow: + - arm + - posix tests: libraries.cmsis_dsp.interpolation: filter: ((CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_FULL_LIBC_SUPPORTED diff --git a/tests/lib/cmsis_dsp/matrix/testcase.yaml b/tests/lib/cmsis_dsp/matrix/testcase.yaml index 47d84ea36fe76..63965b0797434 100644 --- a/tests/lib/cmsis_dsp/matrix/testcase.yaml +++ b/tests/lib/cmsis_dsp/matrix/testcase.yaml @@ -1,3 +1,7 @@ +common: + arch_allow: + - arm + - posix tests: libraries.cmsis_dsp.matrix: filter: ((CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_FULL_LIBC_SUPPORTED diff --git a/tests/lib/cmsis_dsp/quaternionmath/testcase.yaml b/tests/lib/cmsis_dsp/quaternionmath/testcase.yaml index 97346ea4e772e..f6e7c00f37f14 100644 --- a/tests/lib/cmsis_dsp/quaternionmath/testcase.yaml +++ b/tests/lib/cmsis_dsp/quaternionmath/testcase.yaml @@ -1,3 +1,7 @@ +common: + arch_allow: + - arm + - posix tests: libraries.cmsis_dsp.quaternionmath: filter: ((CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_FULL_LIBC_SUPPORTED diff --git a/tests/lib/cmsis_dsp/statistics/testcase.yaml b/tests/lib/cmsis_dsp/statistics/testcase.yaml index 33f7a001ed620..954f8a93a05fa 100644 --- a/tests/lib/cmsis_dsp/statistics/testcase.yaml +++ b/tests/lib/cmsis_dsp/statistics/testcase.yaml @@ -1,3 +1,7 @@ +common: + arch_allow: + - arm + - posix tests: libraries.cmsis_dsp.statistics: filter: ((CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) diff --git a/tests/lib/cmsis_dsp/support/testcase.yaml b/tests/lib/cmsis_dsp/support/testcase.yaml index 51c64939c5848..fdcbe71307205 100644 --- a/tests/lib/cmsis_dsp/support/testcase.yaml +++ b/tests/lib/cmsis_dsp/support/testcase.yaml @@ -1,3 +1,7 @@ +common: + arch_allow: + - arm + - posix tests: libraries.cmsis_dsp.support: filter: ((CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_FULL_LIBC_SUPPORTED diff --git a/tests/lib/cmsis_dsp/svm/testcase.yaml b/tests/lib/cmsis_dsp/svm/testcase.yaml index 6052ffed8d627..fd85cc6696650 100644 --- a/tests/lib/cmsis_dsp/svm/testcase.yaml +++ b/tests/lib/cmsis_dsp/svm/testcase.yaml @@ -1,3 +1,7 @@ +common: + arch_allow: + - arm + - posix tests: libraries.cmsis_dsp.svm: filter: ((CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_FULL_LIBC_SUPPORTED diff --git a/tests/lib/cmsis_dsp/transform/testcase.yaml b/tests/lib/cmsis_dsp/transform/testcase.yaml index 61689aa43a696..ecd4a67f8dd44 100644 --- a/tests/lib/cmsis_dsp/transform/testcase.yaml +++ b/tests/lib/cmsis_dsp/transform/testcase.yaml @@ -1,3 +1,7 @@ +common: + arch_allow: + - arm + - posix tests: libraries.cmsis_dsp.transform: filter: ((CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_FULL_LIBC_SUPPORTED From dfa170e90955ff5fdf30f8076cee933eb9d72bf1 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 15 Nov 2024 07:49:45 -0500 Subject: [PATCH 2541/4482] tests: cmsis_nn: reduce architecture scope Filters already only allow arm and native, so exclude everything else very early and reduce churn and build time. Signed-off-by: Anas Nashif --- tests/lib/cmsis_nn/testcase.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/lib/cmsis_nn/testcase.yaml b/tests/lib/cmsis_nn/testcase.yaml index 3952266880e5d..f528df245096e 100644 --- a/tests/lib/cmsis_nn/testcase.yaml +++ b/tests/lib/cmsis_nn/testcase.yaml @@ -1,5 +1,7 @@ tests: libraries.cmsis_nn: + arch_allow: + - arm filter: CONFIG_CPU_CORTEX_M and CONFIG_FULL_LIBC_SUPPORTED integration_platforms: - frdm_k64f From 27bb4961b331d742dc03426db3da38a8fa5ed653 Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Mon, 19 Feb 2024 10:21:02 +0100 Subject: [PATCH 2542/4482] drivers: stm32 lptim driver with a exact LPTIM timeout value With this change, the LPTIM counter will be able to set its timeout to the st,timeout value. So that system can sleep for that period without interruption. Signed-off-by: Francois Ramu --- drivers/timer/stm32_lptim_timer.c | 22 ++++++++++++++++++++++ dts/bindings/timer/st,stm32-lptim.yaml | 7 +++++++ 2 files changed, 29 insertions(+) diff --git a/drivers/timer/stm32_lptim_timer.c b/drivers/timer/stm32_lptim_timer.c index ba67c2d7b462e..2a1d49b87bf46 100644 --- a/drivers/timer/stm32_lptim_timer.c +++ b/drivers/timer/stm32_lptim_timer.c @@ -450,6 +450,26 @@ static int sys_clock_driver_init(void) } #endif +#if DT_INST_NODE_HAS_PROP(0, st_timeout) + /* + * Check if prescaler corresponding to the DT_INST_PROP(0, st_timeout) + * is matching the lptim_clock_presc calculated one from the lptim_clock_freq + * max lptim period is 0xFFFF/(lptim_clock_freq/lptim_clock_presc) + */ + if (DT_INST_PROP(0, st_timeout) > + (lptim_clock_presc / lptim_clock_freq) * 0xFFFF) { + return -EIO; + } + + /* + * LPTIM is counting DT_INST_PROP(0, st_timeout), + * seconds at lptim_clock_freq divided lptim_clock_presc) Hz", + * lptim_time_base is the autoreload counter + */ + lptim_time_base = 2 * (lptim_clock_freq * + (uint32_t)DT_INST_PROP(0, st_timeout)) + / lptim_clock_presc; +#else /* Set LPTIM time base based on clock source freq */ if (lptim_clock_freq == KHZ(32)) { lptim_time_base = 0xF9FF; @@ -459,6 +479,8 @@ static int sys_clock_driver_init(void) return -EIO; } +#endif /* st_timeout */ + #if !defined(CONFIG_STM32_LPTIM_TICK_FREQ_RATIO_OVERRIDE) /* * Check coherency between CONFIG_SYS_CLOCK_TICKS_PER_SEC diff --git a/dts/bindings/timer/st,stm32-lptim.yaml b/dts/bindings/timer/st,stm32-lptim.yaml index 5792e38ef8de5..159d8bdff0038 100644 --- a/dts/bindings/timer/st,stm32-lptim.yaml +++ b/dts/bindings/timer/st,stm32-lptim.yaml @@ -45,3 +45,10 @@ properties: - 32 - 64 - 128 + + st,timeout: + type: int + description: | + Gives the LPTIM an exact counting value (s) for timeout expiration. + Valid range is [1, 256] and should be consistent with st,prescaler + pre-defined setting. If not, an error is raised. From abfd712cec03c94018d197fe73a8fef5a5a37113 Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Mon, 19 Feb 2024 10:22:15 +0100 Subject: [PATCH 2543/4482] samples: boards: stm32 power lptim adjusted to 15 seconds Gives an example where the timeout value is 15seconds, the prescaler of 8 can let the LPTIM count from 0 to 16 seconds with LSE Signed-off-by: Francois Ramu --- .../st/power_mgmt/blinky/boards/nucleo_wb55rg.overlay | 3 ++- .../st/power_mgmt/blinky/boards/nucleo_wba55cg.overlay | 10 ++++++++++ samples/boards/st/power_mgmt/blinky/src/main.c | 5 +++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 samples/boards/st/power_mgmt/blinky/boards/nucleo_wba55cg.overlay diff --git a/samples/boards/st/power_mgmt/blinky/boards/nucleo_wb55rg.overlay b/samples/boards/st/power_mgmt/blinky/boards/nucleo_wb55rg.overlay index 11767aa004b91..10b8b310a9ade 100644 --- a/samples/boards/st/power_mgmt/blinky/boards/nucleo_wb55rg.overlay +++ b/samples/boards/st/power_mgmt/blinky/boards/nucleo_wb55rg.overlay @@ -5,5 +5,6 @@ * with a LPTIM1 prescaler >= <16>, CONFIG_SYS_CLOCK_TICKS_PER_SEC is LSE / prescaler */ &stm32_lp_tick_source { - st,prescaler = <32>; + st,timeout = <15>; + st,prescaler = <8>; }; diff --git a/samples/boards/st/power_mgmt/blinky/boards/nucleo_wba55cg.overlay b/samples/boards/st/power_mgmt/blinky/boards/nucleo_wba55cg.overlay new file mode 100644 index 0000000000000..10b8b310a9ade --- /dev/null +++ b/samples/boards/st/power_mgmt/blinky/boards/nucleo_wba55cg.overlay @@ -0,0 +1,10 @@ + /* + * give a prescaler to the lptim clock : LSE / 32 = 1024Hz + * so that the sleep period is of 64s in the sample application + * with a LPTIM1 prescaler of <1> to <8>, CONFIG_SYS_CLOCK_TICKS_PER_SEC is 4096 + * with a LPTIM1 prescaler >= <16>, CONFIG_SYS_CLOCK_TICKS_PER_SEC is LSE / prescaler + */ +&stm32_lp_tick_source { + st,timeout = <15>; + st,prescaler = <8>; +}; diff --git a/samples/boards/st/power_mgmt/blinky/src/main.c b/samples/boards/st/power_mgmt/blinky/src/main.c index f4546ac0632a9..1574da94765bf 100644 --- a/samples/boards/st/power_mgmt/blinky/src/main.c +++ b/samples/boards/st/power_mgmt/blinky/src/main.c @@ -10,7 +10,12 @@ #include #include +/* define SLEEP_TIME_MS higher than in ms */ +#if DT_PROP(DT_NODELABEL(stm32_lp_tick_source), st_counter_value) +#define SLEEP_TIME_MS (DT_PROP(DT_NODELABEL(stm32_lp_tick_source), st_counter_value) * 1400) +#else #define SLEEP_TIME_MS 2000 +#endif static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios); From 95421665893de25f60063a3f6a62bfa2450ed9d7 Mon Sep 17 00:00:00 2001 From: Felipe Neves Date: Mon, 16 Sep 2024 20:05:01 -0300 Subject: [PATCH 2544/4482] drivers: mbox: add IVSHMEM based mbox driver Add initial support of the mailbox driver based on the inter VM shared memory mechanism similar as the existing IPM driver. Signed-off-by: Felipe Neves --- drivers/mbox/CMakeLists.txt | 1 + drivers/mbox/Kconfig | 2 +- drivers/mbox/Kconfig.ivshmem | 27 ++++ drivers/mbox/mbox_ivshmem.c | 155 +++++++++++++++++++++ dts/bindings/mbox/linaro,ivshmem-mbox.yaml | 15 ++ 5 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 drivers/mbox/Kconfig.ivshmem create mode 100644 drivers/mbox/mbox_ivshmem.c create mode 100644 dts/bindings/mbox/linaro,ivshmem-mbox.yaml diff --git a/drivers/mbox/CMakeLists.txt b/drivers/mbox/CMakeLists.txt index 4b594da6bfaf9..1a862e6375a53 100644 --- a/drivers/mbox/CMakeLists.txt +++ b/drivers/mbox/CMakeLists.txt @@ -18,3 +18,4 @@ zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_VEVIF_EVENT_TX mbox_nrf_vevif_event zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_BELLBOARD_RX mbox_nrf_bellboard_rx.c) zephyr_library_sources_ifdef(CONFIG_MBOX_NRF_BELLBOARD_TX mbox_nrf_bellboard_tx.c) zephyr_library_sources_ifdef(CONFIG_MBOX_STM32_HSEM mbox_stm32_hsem.c) +zephyr_library_sources_ifdef(CONFIG_MBOX_IVSHMEM mbox_ivshmem.c) diff --git a/drivers/mbox/Kconfig b/drivers/mbox/Kconfig index 2e598b4a01906..660297801285b 100644 --- a/drivers/mbox/Kconfig +++ b/drivers/mbox/Kconfig @@ -22,7 +22,7 @@ source "drivers/mbox/Kconfig.nrf_vevif_event" source "drivers/mbox/Kconfig.nrf_bellboard" source "drivers/mbox/Kconfig.stm32_hsem" source "drivers/mbox/Kconfig.esp32" - +source "drivers/mbox/Kconfig.ivshmem" config MBOX_INIT_PRIORITY int "MBOX init priority" diff --git a/drivers/mbox/Kconfig.ivshmem b/drivers/mbox/Kconfig.ivshmem new file mode 100644 index 0000000000000..956d0a764ae9d --- /dev/null +++ b/drivers/mbox/Kconfig.ivshmem @@ -0,0 +1,27 @@ +# Copyright (c) 2024, Felipe Neves +# SPDX-License-Identifier: Apache-2.0 + +config MBOX_IVSHMEM + bool "MBOX driver based on IVSHMEM-Doorbell" + default y + depends on DT_HAS_LINARO_IVSHMEM_MBOX_ENABLED + depends on IVSHMEM + depends on IVSHMEM_DOORBELL + help + Mailbox driver using IVSHMEM Doorbell mechanism. + +if MBOX_IVSHMEM + +config MBOX_IVSHMEM_EVENT_LOOP_STACK_SIZE + int "Stack size in bytes of IVSHMEM MBOX Event loop task" + default 8192 + help + Adjust the stack size, in bytes of the ivshmem event loop task. + +config MBOX_IVSHMEM_EVENT_LOOP_PRIO + int "Priority of IVSHMEM MBOX Event loop task" + default 2 + help + Adjust the priority of the ivshmem event loop task. + +endif diff --git a/drivers/mbox/mbox_ivshmem.c b/drivers/mbox/mbox_ivshmem.c new file mode 100644 index 0000000000000..39b30087a7589 --- /dev/null +++ b/drivers/mbox/mbox_ivshmem.c @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2024 Felipe Neves. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT linaro_ivshmem_mbox + +#include +#include +#include +#include +#include +#include +LOG_MODULE_REGISTER(mbox_ivshmem, CONFIG_MBOX_LOG_LEVEL); + +K_THREAD_STACK_DEFINE(ivshmem_ev_loop_stack, CONFIG_MBOX_IVSHMEM_EVENT_LOOP_STACK_SIZE); +static struct k_thread ivshmem_ev_loop_thread; + +struct ivshmem_mbox_data { + mbox_callback_t cb; + void *user_data; +}; + +struct ivshmem_mbox_config { + const struct device *ivshmem_dev; + int peer_id; +}; + +static void ivshmem_mbox_event_loop_thread(void *arg, void *p2, void *p3) +{ + ARG_UNUSED(p2); + ARG_UNUSED(p3); + + unsigned int poll_signaled; + int ivshmem_vector_rx; + struct k_poll_signal sig; + struct k_poll_event events[] = { + K_POLL_EVENT_INITIALIZER(K_POLL_TYPE_SIGNAL, K_POLL_MODE_NOTIFY_ONLY, &sig), + }; + + const struct device *dev = (const struct device *)arg; + struct ivshmem_mbox_data *dev_data = (struct ivshmem_mbox_data *)dev->data; + struct ivshmem_mbox_config *dev_cfg = (struct ivshmem_mbox_config *)dev->config; + + k_poll_signal_init(&sig); + int ret = ivshmem_register_handler(dev_cfg->ivshmem_dev, &sig, 0); + + if (ret < 0) { + LOG_ERR("registering handlers must be supported: %d\n", ret); + k_panic(); + } + + while (1) { + LOG_DBG("%s: waiting interrupt from client...\n", __func__); + ret = k_poll(events, ARRAY_SIZE(events), K_FOREVER); + + k_poll_signal_check(&sig, &poll_signaled, &ivshmem_vector_rx); + /* get ready for next signal */ + k_poll_signal_reset(&sig); + + if (dev_data->cb) { + dev_data->cb(dev, 0, dev_data->user_data, NULL); + } + } +} + +static int ivshmem_mbox_send(const struct device *dev, mbox_channel_id_t channel, + const struct mbox_msg *msg) +{ + ARG_UNUSED(msg); + ARG_UNUSED(channel); + + struct ivshmem_mbox_config *dev_cfg = (struct ivshmem_mbox_config *)dev->config; + + LOG_DBG("sending notification to the peer id 0x%x\n", (int)channel); + return ivshmem_int_peer(dev_cfg->ivshmem_dev, (int)channel, 0); +} + +static int ivshmem_mbox_register_callback(const struct device *dev, mbox_channel_id_t channel, + mbox_callback_t cb, void *user_data) +{ + ARG_UNUSED(channel); + + struct ivshmem_mbox_data *dev_data = (struct ivshmem_mbox_data *)dev->data; + + if (!cb) { + LOG_ERR("Must provide a callback"); + return -EINVAL; + } + + dev_data->cb = cb; + dev_data->user_data = user_data; + + return 0; +} + +/* some subsystems needs those functions to be at least implemented, + * returning some valid values instead of errors, just provide them. + */ + +static int ivshmem_mbox_mtu_get(const struct device *dev) +{ + ARG_UNUSED(dev); + + return 0; +} + +static uint32_t ivshmem_mbox_max_channels_get(const struct device *dev) +{ + ARG_UNUSED(dev); + + return UINT16_MAX; +} + +static int ivshmem_mbox_set_enabled(const struct device *dev, mbox_channel_id_t channel, + bool enable) +{ + ARG_UNUSED(dev); + ARG_UNUSED(channel); + ARG_UNUSED(enable); + + return 0; +} + +static int ivshmem_mbox_init(const struct device *dev) +{ + k_thread_create(&ivshmem_ev_loop_thread, ivshmem_ev_loop_stack, + CONFIG_MBOX_IVSHMEM_EVENT_LOOP_STACK_SIZE, ivshmem_mbox_event_loop_thread, + (void *)dev, NULL, NULL, CONFIG_MBOX_IVSHMEM_EVENT_LOOP_PRIO, 0, K_NO_WAIT); + + return 0; +} + +static const struct mbox_driver_api ivshmem_mbox_driver_api = { + .send = ivshmem_mbox_send, + .register_callback = ivshmem_mbox_register_callback, + .mtu_get = ivshmem_mbox_mtu_get, + .max_channels_get = ivshmem_mbox_max_channels_get, + .set_enabled = ivshmem_mbox_set_enabled, +}; + +#define MBOX_IVSHMEM_INIT(inst) \ + static const struct ivshmem_mbox_config ivshmem_mbox_cfg_##inst = { \ + .ivshmem_dev = DEVICE_DT_GET(DT_INST_PHANDLE(inst, ivshmem)), \ + }; \ + static struct ivshmem_mbox_data ivshmem_mbox_data_##inst = { \ + .cb = NULL, \ + .user_data = NULL, \ + }; \ + DEVICE_DT_INST_DEFINE(inst, ivshmem_mbox_init, NULL, &ivshmem_mbox_data_##inst, \ + &ivshmem_mbox_cfg_##inst, POST_KERNEL, \ + CONFIG_APPLICATION_INIT_PRIORITY, &ivshmem_mbox_driver_api); + +DT_INST_FOREACH_STATUS_OKAY(MBOX_IVSHMEM_INIT); diff --git a/dts/bindings/mbox/linaro,ivshmem-mbox.yaml b/dts/bindings/mbox/linaro,ivshmem-mbox.yaml new file mode 100644 index 0000000000000..d3b42c597db06 --- /dev/null +++ b/dts/bindings/mbox/linaro,ivshmem-mbox.yaml @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Felipe Neves +# SPDX-License-Identifier: Apache-2.0 + +description: Inter VM shared memory based mailbox binding + +compatible: "linaro,ivshmem-mbox" + +include: base.yaml + +properties: + + ivshmem: + type: phandle + required: true + description: ivshmem device node From bfa1e36789610895a532d527a5119415d9183372 Mon Sep 17 00:00:00 2001 From: James Chiang Date: Wed, 22 May 2024 19:39:21 -0700 Subject: [PATCH 2545/4482] drivers: clock_control: add npcm clock control driver Add npcm clock control driver. Signed-off-by: James Chiang Signed-off-by: Joseph Liu Signed-off-by: Alan Yang --- drivers/clock_control/CMakeLists.txt | 1 + drivers/clock_control/Kconfig | 2 + drivers/clock_control/Kconfig.npcm | 11 + drivers/clock_control/clock_control_npcm.c | 365 ++++++++++++++++++ include/zephyr/dt-bindings/clock/npcm_clock.h | 72 ++++ 5 files changed, 451 insertions(+) create mode 100644 drivers/clock_control/Kconfig.npcm create mode 100644 drivers/clock_control/clock_control_npcm.c create mode 100644 include/zephyr/dt-bindings/clock/npcm_clock.h diff --git a/drivers/clock_control/CMakeLists.txt b/drivers/clock_control/CMakeLists.txt index 79079867e5dd8..861ab48c13fa2 100644 --- a/drivers/clock_control/CMakeLists.txt +++ b/drivers/clock_control/CMakeLists.txt @@ -19,6 +19,7 @@ zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_MCUX_SCG clock_cont zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_MCUX_SCG_K4 clock_control_mcux_scg_k4.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_MCUX_SIM clock_control_mcux_sim.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_MCUX_SYSCON clock_control_mcux_syscon.c) +zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NPCM clock_control_npcm.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NPCX clock_control_npcx.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF clock_control_nrf.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF_DRIVER_CALIBRATION nrf_clock_calibration.c) diff --git a/drivers/clock_control/Kconfig b/drivers/clock_control/Kconfig index ca4db637014a3..efae3e1194107 100644 --- a/drivers/clock_control/Kconfig +++ b/drivers/clock_control/Kconfig @@ -50,6 +50,8 @@ source "drivers/clock_control/Kconfig.mcux_sim" source "drivers/clock_control/Kconfig.mcux_syscon" +source "drivers/clock_control/Kconfig.npcm" + source "drivers/clock_control/Kconfig.npcx" source "drivers/clock_control/Kconfig.rv32m1" diff --git a/drivers/clock_control/Kconfig.npcm b/drivers/clock_control/Kconfig.npcm new file mode 100644 index 0000000000000..cdf96bfb02f82 --- /dev/null +++ b/drivers/clock_control/Kconfig.npcm @@ -0,0 +1,11 @@ +# NPCM Clock controller driver configuration options + +# Copyright (c) 2024 Nuvoton Technology Corporation. +# SPDX-License-Identifier: Apache-2.0 + +config CLOCK_CONTROL_NPCM + bool "NPCM clock controller driver" + default y + depends on DT_HAS_NUVOTON_NPCM_PCC_ENABLED + help + Enable support for NPCM clock controller driver. diff --git a/drivers/clock_control/clock_control_npcm.c b/drivers/clock_control/clock_control_npcm.c new file mode 100644 index 0000000000000..ffe1ba8b47995 --- /dev/null +++ b/drivers/clock_control/clock_control_npcm.c @@ -0,0 +1,365 @@ +/* + * Copyright (c) 2024 Nuvoton Technology Corporation. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT nuvoton_npcm_pcc + +#include +#include +#include + +#include +LOG_MODULE_REGISTER(clock_control_npcm, LOG_LEVEL_ERR); + +/* Driver config */ +struct npcm_pcc_config { + /* cdcg device base address */ + uintptr_t base_cdcg; + /* pmc device base address */ + uintptr_t base_pmc; +}; + +/* + * Core Domain Clock Generator (CDCG) device registers + */ +struct cdcg_reg { + /* High Frequency Clock Generator (HFCG) registers */ + /* 0x000: HFCG Control */ + volatile uint8_t hfcgctrl; + volatile uint8_t reserved1; + /* 0x002: HFCG M Low Byte Value */ + volatile uint8_t hfcgml; + volatile uint8_t reserved2; + /* 0x004: HFCG M High Byte Value */ + volatile uint8_t hfcgmh; + volatile uint8_t reserved3; + /* 0x006: HFCG N Value */ + volatile uint8_t hfcgn; + volatile uint8_t reserved4; + /* 0x008: HFCG Prescaler */ + volatile uint8_t hfcgp; + volatile uint8_t reserved5[7]; + /* 0x010: HFCG Bus Clock Dividers */ + volatile uint8_t hfcbcd; + volatile uint8_t reserved6; + /* 0x012: HFCG Bus Clock Dividers */ + volatile uint8_t hfcbcd1; + volatile uint8_t reserved7; + /* 0x014: HFCG Bus Clock Dividers */ + volatile uint8_t hfcbcd2; + volatile uint8_t reserved12[8]; + /* 0x01d: HFCG Bus Clock Dividers */ + volatile uint8_t hfcbcd3; +}; + +/* clock bus references */ +#define NPCM_CLOCK_BUS_LFCLK 0 +#define NPCM_CLOCK_BUS_OSC 1 +#define NPCM_CLOCK_BUS_FIU 2 +#define NPCM_CLOCK_BUS_I3C 3 +#define NPCM_CLOCK_BUS_CORE 4 +#define NPCM_CLOCK_BUS_APB1 5 +#define NPCM_CLOCK_BUS_APB2 6 +#define NPCM_CLOCK_BUS_APB3 7 +#define NPCM_CLOCK_BUS_APB4 8 +#define NPCM_CLOCK_BUS_AHB6 9 +#define NPCM_CLOCK_BUS_FMCLK 10 +#define NPCM_CLOCK_BUS_USB20_CLK 11 +#define NPCM_CLOCK_BUS_SIO_CLK 12 + +/* clock enable/disable references */ +#define NPCM_PWDWN_CTL0 0 +#define NPCM_PWDWN_CTL1 1 +#define NPCM_PWDWN_CTL2 2 +#define NPCM_PWDWN_CTL3 3 +#define NPCM_PWDWN_CTL4 4 +#define NPCM_PWDWN_CTL5 5 +#define NPCM_PWDWN_CTL6 6 +#define NPCM_PWDWN_CTL7 7 + +/* CDCG register fields */ +#define NPCM_HFCGCTRL_LOAD 0 +#define NPCM_HFCGCTRL_LOCK 2 +#define NPCM_HFCGCTRL_CLK_CHNG 7 + +/* Clock settings from pcc node */ +/* Target OFMCLK freq */ +#define OFMCLK DT_PROP(DT_NODELABEL(pcc), clock_frequency) +/* Core clock prescaler */ +#define FPRED_VAL (DT_PROP(DT_NODELABEL(pcc), core_prescaler) - 1) +/* APB1 clock divider */ +#define APB1DIV_VAL (DT_PROP(DT_NODELABEL(pcc), apb1_prescaler) - 1) +/* APB2 clock divider */ +#define APB2DIV_VAL (DT_PROP(DT_NODELABEL(pcc), apb2_prescaler) - 1) +/* APB3 clock divider */ +#define APB3DIV_VAL (DT_PROP(DT_NODELABEL(pcc), apb3_prescaler) - 1) +/* AHB6 clock divider*/ +#define AHB6DIV_VAL (DT_PROP(DT_NODELABEL(pcc), ahb6_prescaler) - 1) +/* FIU clock divider */ +#define FIUDIV_VAL (DT_PROP(DT_NODELABEL(pcc), fiu_prescaler) - 1) +/* I3C clock divider */ +#define I3CDIV_VAL (DT_PROP(DT_NODELABEL(pcc), i3c_prescaler) - 1) + +/* Core domain clock */ +#define CORE_CLK (OFMCLK / DT_PROP(DT_NODELABEL(pcc), core_prescaler)) +/* Low Frequency clock */ +#define LFCLK 32768 +/* FMUL clock */ +#define FMCLK OFMCLK /* FMUL clock = OFMCLK */ +/* APBs source clock */ +#define APBSRC_CLK OFMCLK +/* USB2.0 clock */ +#define USB20_CLK 12000000 +/* SIO clock */ +#define SIO_CLK 48000000 +/* Get APB clock freq */ +#define NPCM_APB_CLOCK(no) (APBSRC_CLK / (APB##no##DIV_VAL + 1)) + +struct freq_multiplier_t { + uint32_t ofmclk; + uint8_t hfcgn; + uint8_t hfcgmh; + uint8_t hfcgml; +}; + +static struct freq_multiplier_t freq_multiplier[] = { + {.ofmclk = 100000000, .hfcgn = 0x82, .hfcgmh = 0x0B, .hfcgml = 0xEC}, + {.ofmclk = 96000000, .hfcgn = 0x82, .hfcgmh = 0x0B, .hfcgml = 0x72}, + {.ofmclk = 80000000, .hfcgn = 0x82, .hfcgmh = 0x09, .hfcgml = 0x89}, + {.ofmclk = 66000000, .hfcgn = 0x82, .hfcgmh = 0x07, .hfcgml = 0xDE}, + {.ofmclk = 50000000, .hfcgn = 0x02, .hfcgmh = 0x0B, .hfcgml = 0xEC}, + {.ofmclk = 48000000, .hfcgn = 0x02, .hfcgmh = 0x0B, .hfcgml = 0x72}, + {.ofmclk = 40000000, .hfcgn = 0x02, .hfcgmh = 0x09, .hfcgml = 0x89}, + {.ofmclk = 33000000, .hfcgn = 0x02, .hfcgmh = 0x07, .hfcgml = 0xDE}}; + +struct clk_cfg_t { + uint32_t clock_id; + uint16_t bus; +}; + +static struct clk_cfg_t clk_cfg[] = { + {.clock_id = NPCM_CLOCK_PWM_I, .bus = NPCM_CLOCK_BUS_LFCLK}, + {.clock_id = NPCM_CLOCK_PWM_J, .bus = NPCM_CLOCK_BUS_LFCLK}, + {.clock_id = NPCM_CLOCK_I3CI, .bus = NPCM_CLOCK_BUS_APB3}, + {.clock_id = NPCM_CLOCK_UART3, .bus = NPCM_CLOCK_BUS_APB2}, + {.clock_id = NPCM_CLOCK_UART2, .bus = NPCM_CLOCK_BUS_APB2}, + + {.clock_id = NPCM_CLOCK_FIU, .bus = NPCM_CLOCK_BUS_FIU}, + {.clock_id = NPCM_CLOCK_USB20, .bus = NPCM_CLOCK_BUS_USB20_CLK}, + {.clock_id = NPCM_CLOCK_UART, .bus = NPCM_CLOCK_BUS_APB2}, + + {.clock_id = NPCM_CLOCK_PWM_A, .bus = NPCM_CLOCK_BUS_LFCLK}, + {.clock_id = NPCM_CLOCK_PWM_B, .bus = NPCM_CLOCK_BUS_LFCLK}, + {.clock_id = NPCM_CLOCK_PWM_C, .bus = NPCM_CLOCK_BUS_LFCLK}, + {.clock_id = NPCM_CLOCK_PWM_D, .bus = NPCM_CLOCK_BUS_LFCLK}, + {.clock_id = NPCM_CLOCK_PWM_E, .bus = NPCM_CLOCK_BUS_LFCLK}, + {.clock_id = NPCM_CLOCK_PWM_F, .bus = NPCM_CLOCK_BUS_LFCLK}, + {.clock_id = NPCM_CLOCK_PWM_G, .bus = NPCM_CLOCK_BUS_LFCLK}, + {.clock_id = NPCM_CLOCK_PWM_H, .bus = NPCM_CLOCK_BUS_LFCLK}, + + {.clock_id = NPCM_CLOCK_SMB1, .bus = NPCM_CLOCK_BUS_APB3}, + {.clock_id = NPCM_CLOCK_SMB2, .bus = NPCM_CLOCK_BUS_APB3}, + {.clock_id = NPCM_CLOCK_SMB3, .bus = NPCM_CLOCK_BUS_APB3}, + {.clock_id = NPCM_CLOCK_SMB4, .bus = NPCM_CLOCK_BUS_APB3}, + {.clock_id = NPCM_CLOCK_SMB5, .bus = NPCM_CLOCK_BUS_APB3}, + {.clock_id = NPCM_CLOCK_SMB6, .bus = NPCM_CLOCK_BUS_APB3}, + + {.clock_id = NPCM_CLOCK_ITIM1, .bus = NPCM_CLOCK_BUS_LFCLK}, + {.clock_id = NPCM_CLOCK_ITIM2, .bus = NPCM_CLOCK_BUS_LFCLK}, + {.clock_id = NPCM_CLOCK_ITIM3, .bus = NPCM_CLOCK_BUS_LFCLK}, + {.clock_id = NPCM_CLOCK_ADC, .bus = NPCM_CLOCK_BUS_APB1}, + {.clock_id = NPCM_CLOCK_PECI, .bus = NPCM_CLOCK_BUS_FMCLK}, + + {.clock_id = NPCM_CLOCK_UART4, .bus = NPCM_CLOCK_BUS_APB2}, + + {.clock_id = NPCM_CLOCK_ESPI, .bus = NPCM_CLOCK_BUS_APB3}, + + {.clock_id = NPCM_CLOCK_SMB7, .bus = NPCM_CLOCK_BUS_APB3}, + {.clock_id = NPCM_CLOCK_SMB8, .bus = NPCM_CLOCK_BUS_APB3}, + {.clock_id = NPCM_CLOCK_SMB9, .bus = NPCM_CLOCK_BUS_APB3}, + {.clock_id = NPCM_CLOCK_SMB10, .bus = NPCM_CLOCK_BUS_APB3}, + {.clock_id = NPCM_CLOCK_SMB11, .bus = NPCM_CLOCK_BUS_APB3}, + {.clock_id = NPCM_CLOCK_SMB12, .bus = NPCM_CLOCK_BUS_APB3}, +}; + +/* PMC multi-registers */ +#define NPCM_PWDWN_CTL_OFFSET(n) (((n) < 7) ? (0x07 + n) : (0x15 + (n - 7))) +#define NPCM_PWDWN_CTL(base, n) (*(volatile uint8_t *)(base + NPCM_PWDWN_CTL_OFFSET(n))) +#define NPCM_CLOCK_REG_OFFSET(n) ((n) >> 3) +#define NPCM_CLOCK_REG_BIT_OFFSET(n) ((n) & 0x7) + +#define DRV_CONFIG(dev) ((const struct npcm_pcc_config *)(dev)->config) + +/* Clock controller local functions */ +static struct clk_cfg_t *npcm_get_cfg(clock_control_subsys_t sub_system) +{ + uint32_t clk_id = (uint32_t)sub_system; + uint32_t i; + + for (i = 0; i < ARRAY_SIZE(clk_cfg); i++) { + if (clk_cfg[i].clock_id == clk_id) { + return &clk_cfg[i]; + } + } + + return NULL; +} + +static inline int npcm_clock_control_on(const struct device *dev, clock_control_subsys_t sub_system) +{ + uint32_t clk_id = (uint32_t)sub_system; + struct clk_cfg_t *priv; + const uint32_t pmc_base = DRV_CONFIG(dev)->base_pmc; + + priv = npcm_get_cfg(sub_system); + if (!priv) { + LOG_ERR("Unsupported clock id %d", clk_id); + return -EINVAL; + } + + /* Clear related PD (Power-Down) bit of module to turn on clock */ + NPCM_PWDWN_CTL(pmc_base, NPCM_CLOCK_REG_OFFSET(priv->clock_id)) &= + ~(BIT(NPCM_CLOCK_REG_BIT_OFFSET(priv->clock_id))); + return 0; +} + +static inline int npcm_clock_control_off(const struct device *dev, + clock_control_subsys_t sub_system) +{ + uint32_t clk_id = (uint32_t)sub_system; + struct clk_cfg_t *priv; + const uint32_t pmc_base = DRV_CONFIG(dev)->base_pmc; + + priv = npcm_get_cfg(sub_system); + if (!priv) { + LOG_ERR("Unsupported clock id %d", clk_id); + return -EINVAL; + } + + /* Set related PD (Power-Down) bit of module to turn off clock */ + NPCM_PWDWN_CTL(pmc_base, NPCM_CLOCK_REG_OFFSET(priv->clock_id)) |= + ~(BIT(NPCM_CLOCK_REG_BIT_OFFSET(priv->clock_id))); + return 0; +} + +static int npcm_clock_control_get_subsys_rate(const struct device *dev, + clock_control_subsys_t sub_system, uint32_t *rate) +{ + ARG_UNUSED(dev); + uint32_t clk_id = (uint32_t)sub_system; + struct clk_cfg_t *priv; + + priv = npcm_get_cfg(sub_system); + if (!priv) { + LOG_ERR("Unsupported clock id %d", clk_id); + return -EINVAL; + } + + switch (priv->bus) { + case NPCM_CLOCK_BUS_APB1: + *rate = NPCM_APB_CLOCK(1); + break; + case NPCM_CLOCK_BUS_APB2: + *rate = NPCM_APB_CLOCK(2); + break; + case NPCM_CLOCK_BUS_APB3: + *rate = NPCM_APB_CLOCK(3); + break; + case NPCM_CLOCK_BUS_AHB6: + *rate = CORE_CLK / (AHB6DIV_VAL + 1); + break; + case NPCM_CLOCK_BUS_FIU: + *rate = CORE_CLK / (FIUDIV_VAL + 1); + break; + case NPCM_CLOCK_BUS_I3C: + *rate = CORE_CLK / (I3CDIV_VAL + 1); + break; + case NPCM_CLOCK_BUS_CORE: + *rate = CORE_CLK; + break; + case NPCM_CLOCK_BUS_LFCLK: + *rate = LFCLK; + break; + case NPCM_CLOCK_BUS_FMCLK: + *rate = FMCLK; + break; + case NPCM_CLOCK_BUS_USB20_CLK: + *rate = USB20_CLK; + break; + case NPCM_CLOCK_BUS_SIO_CLK: + *rate = SIO_CLK; + break; + default: + *rate = 0U; + /* Invalid parameters */ + return -EINVAL; + } + + return 0; +} + +/* Clock controller driver registration */ +static struct clock_control_driver_api npcm_clock_control_api = { + .on = npcm_clock_control_on, + .off = npcm_clock_control_off, + .get_rate = npcm_clock_control_get_subsys_rate, +}; + +static int npcm_clock_control_init(const struct device *dev) +{ + struct cdcg_reg *const priv = (struct cdcg_reg *)(DRV_CONFIG(dev)->base_cdcg); + struct freq_multiplier_t *freq_p; + int i; + + for (i = 0; i < ARRAY_SIZE(freq_multiplier); i++) { + if (freq_multiplier[i].ofmclk == OFMCLK) { + freq_p = &freq_multiplier[i]; + break; + } + } + + if (i >= ARRAY_SIZE(freq_multiplier)) { + LOG_ERR("Unsupported OFMCLK frequency %d", OFMCLK); + return -EINVAL; + } + + /* + * Resetting the OFMCLK (even to the same value) will make the clock + * unstable for a little which can affect peripheral communication like + * eSPI. Skip this if not needed. + */ + if (priv->hfcgn != freq_p->hfcgn || priv->hfcgml != freq_p->hfcgml || + priv->hfcgmh != freq_p->hfcgmh) { + /* + * Configure frequency multiplier M/N values according to + * the requested OFMCLK (Unit:Hz). + */ + priv->hfcgn = freq_p->hfcgn; + priv->hfcgml = freq_p->hfcgml; + priv->hfcgmh = freq_p->hfcgmh; + + /* Load M and N values into the frequency multiplier */ + priv->hfcgctrl |= BIT(NPCM_HFCGCTRL_LOAD); + /* Wait for stable */ + while (sys_test_bit(priv->hfcgctrl, NPCM_HFCGCTRL_CLK_CHNG)) + ; + } + + /* Set all clock prescalers of core and peripherals. */ + priv->hfcgp = (FPRED_VAL << 4) | AHB6DIV_VAL; + priv->hfcbcd = APB1DIV_VAL | (APB2DIV_VAL << 4); + priv->hfcbcd1 = (I3CDIV_VAL << 2) | FIUDIV_VAL; + priv->hfcbcd2 = APB3DIV_VAL; + + return 0; +} + +const struct npcm_pcc_config pcc_config = { + .base_cdcg = DT_INST_REG_ADDR_BY_NAME(0, cdcg), + .base_pmc = DT_INST_REG_ADDR_BY_NAME(0, pmc), +}; + +DEVICE_DT_INST_DEFINE(0, &npcm_clock_control_init, NULL, NULL, &pcc_config, PRE_KERNEL_1, + CONFIG_KERNEL_INIT_PRIORITY_OBJECTS, &npcm_clock_control_api); diff --git a/include/zephyr/dt-bindings/clock/npcm_clock.h b/include/zephyr/dt-bindings/clock/npcm_clock.h new file mode 100644 index 0000000000000..d4a1b0c374ab4 --- /dev/null +++ b/include/zephyr/dt-bindings/clock/npcm_clock.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2024 Nuvoton Technology Corporation. + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_NPCM_CLOCK_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_NPCM_CLOCK_H_ + +/* clock bus references */ +#define NPCM_CLOCK_GROUP_OFFSET(N) ((N) << 3) + +#define NPCM_CLOCK_PWM_I (NPCM_CLOCK_GROUP_OFFSET(0) + 0) +#define NPCM_CLOCK_PWM_J (NPCM_CLOCK_GROUP_OFFSET(0) + 1) +#define NPCM_CLOCK_I3CI (NPCM_CLOCK_GROUP_OFFSET(0) + 2) +#define NPCM_CLOCK_UART3 (NPCM_CLOCK_GROUP_OFFSET(0) + 5) +#define NPCM_CLOCK_UART2 (NPCM_CLOCK_GROUP_OFFSET(0) + 6) +#define NPCM_CLOCK_SPIM (NPCM_CLOCK_GROUP_OFFSET(1) + 0) +#define NPCM_CLOCK_FIU (NPCM_CLOCK_GROUP_OFFSET(1) + 2) +#define NPCM_CLOCK_USB20 (NPCM_CLOCK_GROUP_OFFSET(1) + 3) +#define NPCM_CLOCK_UART (NPCM_CLOCK_GROUP_OFFSET(1) + 4) +#define NPCM_CLOCK_MFT1 (NPCM_CLOCK_GROUP_OFFSET(1) + 5) +#define NPCM_CLOCK_MFT2 (NPCM_CLOCK_GROUP_OFFSET(1) + 6) +#define NPCM_CLOCK_MFT3 (NPCM_CLOCK_GROUP_OFFSET(1) + 7) +#define NPCM_CLOCK_PWM_A (NPCM_CLOCK_GROUP_OFFSET(2) + 0) +#define NPCM_CLOCK_PWM_B (NPCM_CLOCK_GROUP_OFFSET(2) + 1) +#define NPCM_CLOCK_PWM_C (NPCM_CLOCK_GROUP_OFFSET(2) + 2) +#define NPCM_CLOCK_PWM_D (NPCM_CLOCK_GROUP_OFFSET(2) + 3) +#define NPCM_CLOCK_PWM_E (NPCM_CLOCK_GROUP_OFFSET(2) + 4) +#define NPCM_CLOCK_PWM_F (NPCM_CLOCK_GROUP_OFFSET(2) + 5) +#define NPCM_CLOCK_PWM_G (NPCM_CLOCK_GROUP_OFFSET(2) + 6) +#define NPCM_CLOCK_PWM_H (NPCM_CLOCK_GROUP_OFFSET(2) + 7) +#define NPCM_CLOCK_SMB1 (NPCM_CLOCK_GROUP_OFFSET(3) + 0) +#define NPCM_CLOCK_SMB2 (NPCM_CLOCK_GROUP_OFFSET(3) + 1) +#define NPCM_CLOCK_SMB3 (NPCM_CLOCK_GROUP_OFFSET(3) + 2) +#define NPCM_CLOCK_SMB4 (NPCM_CLOCK_GROUP_OFFSET(3) + 3) +#define NPCM_CLOCK_SMB5 (NPCM_CLOCK_GROUP_OFFSET(3) + 4) +#define NPCM_CLOCK_SMB6 (NPCM_CLOCK_GROUP_OFFSET(3) + 5) +#define NPCM_CLOCK_GDMA (NPCM_CLOCK_GROUP_OFFSET(3) + 7) +#define NPCM_CLOCK_ITIM1 (NPCM_CLOCK_GROUP_OFFSET(4) + 0) +#define NPCM_CLOCK_ITIM2 (NPCM_CLOCK_GROUP_OFFSET(4) + 1) +#define NPCM_CLOCK_ITIM3 (NPCM_CLOCK_GROUP_OFFSET(4) + 2) +#define NPCM_CLOCK_SMB_DMA (NPCM_CLOCK_GROUP_OFFSET(4) + 3) +#define NPCM_CLOCK_ADC (NPCM_CLOCK_GROUP_OFFSET(4) + 4) +#define NPCM_CLOCK_PECI (NPCM_CLOCK_GROUP_OFFSET(4) + 5) +#define NPCM_CLOCK_SPIP1 (NPCM_CLOCK_GROUP_OFFSET(4) + 7) +#define NPCM_CLOCK_UART4 (NPCM_CLOCK_GROUP_OFFSET(5) + 0) +#define NPCM_CLOCK_C2HACC (NPCM_CLOCK_GROUP_OFFSET(5) + 3) +#define NPCM_CLOCK_SHM_REG (NPCM_CLOCK_GROUP_OFFSET(5) + 4) +#define NPCM_CLOCK_SHM (NPCM_CLOCK_GROUP_OFFSET(5) + 5) +#define NPCM_CLOCK_DP80 (NPCM_CLOCK_GROUP_OFFSET(5) + 6) +#define NPCM_CLOCK_MSWC (NPCM_CLOCK_GROUP_OFFSET(5) + 7) +#define NPCM_CLOCK_ITIM4 (NPCM_CLOCK_GROUP_OFFSET(6) + 0) +#define NPCM_CLOCK_ITIM5 (NPCM_CLOCK_GROUP_OFFSET(6) + 1) +#define NPCM_CLOCK_ITIM6 (NPCM_CLOCK_GROUP_OFFSET(6) + 2) +#define NPCM_CLOCK_RNG (NPCM_CLOCK_GROUP_OFFSET(6) + 3) +#define NPCM_CLOCK_SHA (NPCM_CLOCK_GROUP_OFFSET(6) + 5) +#define NPCM_CLOCK_ESPI (NPCM_CLOCK_GROUP_OFFSET(6) + 7) +#define NPCM_CLOCK_SMB7 (NPCM_CLOCK_GROUP_OFFSET(7) + 0) +#define NPCM_CLOCK_SMB8 (NPCM_CLOCK_GROUP_OFFSET(7) + 1) +#define NPCM_CLOCK_SMB9 (NPCM_CLOCK_GROUP_OFFSET(7) + 2) +#define NPCM_CLOCK_SMB10 (NPCM_CLOCK_GROUP_OFFSET(7) + 3) +#define NPCM_CLOCK_SMB11 (NPCM_CLOCK_GROUP_OFFSET(7) + 4) +#define NPCM_CLOCK_SMB12 (NPCM_CLOCK_GROUP_OFFSET(7) + 5) +#define NPCM_CLOCK_SIOX2 (NPCM_CLOCK_GROUP_OFFSET(7) + 6) +#define NPCM_CLOCK_SIOX1 (NPCM_CLOCK_GROUP_OFFSET(7) + 7) +#define NPCM_CLOCK_I3CI2 (NPCM_CLOCK_GROUP_OFFSET(8) + 0) +#define NPCM_CLOCK_I3CI3 (NPCM_CLOCK_GROUP_OFFSET(8) + 1) +#define NPCM_CLOCK_I3CI4 (NPCM_CLOCK_GROUP_OFFSET(8) + 2) +#define NPCM_CLOCK_I3CI5 (NPCM_CLOCK_GROUP_OFFSET(8) + 3) +#define NPCM_CLOCK_I3CI6 (NPCM_CLOCK_GROUP_OFFSET(8) + 4) + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_NPCM_CLOCK_H_ */ From af5794fec2907de80b5e0e9ba919fc6f05989f55 Mon Sep 17 00:00:00 2001 From: Alan Yang Date: Fri, 20 Sep 2024 09:53:47 +0800 Subject: [PATCH 2546/4482] dts: arm: nuvoton: add npcm mdc and pcc instances Add npcm miscellaneous device control and power and clock control instances. Add device tree bindings for npcm power and clock control. Signed-off-by: Alan Yang --- dts/arm/nuvoton/npcm/npcm.dtsi | 29 +++ dts/arm/nuvoton/npcm/npcm4.dtsi | 12 ++ dts/bindings/clock/nuvoton,npcm-pcc.yaml | 222 +++++++++++++++++++++++ 3 files changed, 263 insertions(+) create mode 100644 dts/bindings/clock/nuvoton,npcm-pcc.yaml diff --git a/dts/arm/nuvoton/npcm/npcm.dtsi b/dts/arm/nuvoton/npcm/npcm.dtsi index c16607be9a72c..a8ab1b059cbc5 100644 --- a/dts/arm/nuvoton/npcm/npcm.dtsi +++ b/dts/arm/nuvoton/npcm/npcm.dtsi @@ -6,6 +6,10 @@ #include +/* Macros for device tree declarations of npcm soc family */ +#include +#include + / { cpus { #address-cells = <1>; @@ -17,6 +21,31 @@ reg = <0>; }; }; + + soc { + mdc: mdc@4000c000 { + compatible = "syscon"; + reg = <0x4000c000 0xa>; + reg-io-width = <1>; + }; + + mdc_header: mdc@4000c00a { + compatible = "syscon"; + reg = <0x4000c00a 0x4>; + reg-io-width = <2>; + }; + + pcc: clock-controller@4000d000 { + compatible = "nuvoton,npcm-pcc"; + /* Cells for clock id */ + #clock-cells = <1>; + /* First reg region is Power Management Controller */ + /* Second reg region is Core Domain Clock Generator */ + reg = <0x4000d000 0x2000 + 0x400b5000 0x2000>; + reg-names = "pmc", "cdcg"; + }; + }; }; &nvic { diff --git a/dts/arm/nuvoton/npcm/npcm4.dtsi b/dts/arm/nuvoton/npcm/npcm4.dtsi index b23a80a966b60..1b994dfc671ea 100644 --- a/dts/arm/nuvoton/npcm/npcm4.dtsi +++ b/dts/arm/nuvoton/npcm/npcm4.dtsi @@ -6,6 +6,7 @@ /* Device tree declarations of npcm soc family */ #include "npcm.dtsi" +#include / { soc { @@ -21,6 +22,17 @@ reg = <0x4000c00a 0x4>; reg-io-width = <2>; }; + + pcc: clock-controller@4000d000 { + clock-frequency = ; /* OFMCLK runs at 96MHz */ + core-prescaler = <1>; /* CORE_CLK runs at 96MHz */ + apb1-prescaler = <8>; /* APB1_CLK runs at 12MHz */ + apb2-prescaler = <1>; /* APB2_CLK runs at 96MHz */ + apb3-prescaler = <1>; /* APB3_CLK runs at 96MHz */ + ahb6-prescaler = <1>; /* APB6_CLK runs at 96MHz */ + fiu-prescaler = <1>; /* FIU_CLK runs at 96MHz */ + i3c-prescaler = <1>; /* I3C_CLK runs at 96MHz */ + }; }; soc-if { diff --git a/dts/bindings/clock/nuvoton,npcm-pcc.yaml b/dts/bindings/clock/nuvoton,npcm-pcc.yaml new file mode 100644 index 0000000000000..58042c163270b --- /dev/null +++ b/dts/bindings/clock/nuvoton,npcm-pcc.yaml @@ -0,0 +1,222 @@ +# Copyright (c) 2024 Nuvoton Technology Corporation. +# SPDX-License-Identifier: Apache-2.0 + +description: | + Nuvoton, NPCM PCC (Power and Clock Controller) node. + Besides power management, this node is also in charge of configuring the + Oscillator Frequency Multiplier Clock (OFMCLK), which is derived from + High-Frequency Clock Generator (HFCG), is the source clock of Cortex-M4 core + and most of NPCM hardware modules. + + Here is an example of configuring OFMCLK and the other clock sources derived + from it in board dts file. + &pcc { + clock-frequency = ; /* OFMCLK runs at 96MHz */ + core-prescaler = <1>; /* CORE_CLK runs at 96MHz */ + apb1-prescaler = <8>; /* APB1_CLK runs at 12MHz */ + apb2-prescaler = <1>; /* APB2_CLK runs at 96MHz */ + apb3-prescaler = <1>; /* APB3_CLK runs at 96MHz */ + apb6-prescaler = <1>; /* APB6_CLK runs at 96MHz */ + fiu-prescaler = <1>; /* FIU_CLK runs at 96MHz */ + i3c-prescaler = <1>; /* I3C_CLK runs at 96MHz */ + }; + +compatible: "nuvoton,npcm-pcc" + +include: [clock-controller.yaml, base.yaml] + +properties: + reg: + required: true + + clock-frequency: + required: true + type: int + description: | + Default frequency in Hz for HFCG output clock (OFMCLK). Currently, + only the following values are allowed: + 100000000, 100 MHz + 96000000, 96 MHz + 80000000, 80 MHz + 66000000, 66 MHz + 50000000, 50 MHz + 48000000, 48 MHz + 40000000, 40 MHz + 33000000, 33 MHz + enum: + - 100000000 + - 96000000 + - 80000000 + - 66000000 + - 50000000 + - 48000000 + - 40000000 + - 33000000 + + core-prescaler: + type: int + required: true + description: | + Core clock prescaler (FPRED). It sets the Core frequency, CORE_CLK, by + dividing OFMCLK(MCLK) and needs to meet the following requirements. + - The maximum CLK frequency is either the MCLK frequency divided by 1 or 100 MHz. + - Only the following values are allowed: + 1, CORE_CLK = OFMCLK + 2, CORE_CLK = OFMCLK / 2 + 3, CORE_CLK = OFMCLK / 3 + 4, CORE_CLK = OFMCLK / 4 + 5, CORE_CLK = OFMCLK / 5 + 6, CORE_CLK = OFMCLK / 6 + 7, CORE_CLK = OFMCLK / 7 + 8, CORE_CLK = OFMCLK / 8 + 9, CORE_CLK = OFMCLK / 9 + 10, CORE_CLK = OFMCLK / 10 + enum: + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + - 7 + - 8 + - 9 + - 10 + + apb1-prescaler: + type: int + required: true + description: | + APB1 prescaler. It sets the APB1 bus frequency, APB1_CLK, by dividing + OFMCLK(MCLK) and needs to meet the following requirements. + - The maximum APB1_CLK frequency is either the MCLK frequency divided by 1 or 100 MHz. + - Only the following values are allowed: + 1, APB1_CLK = OFMCLK + 2, APB1_CLK = OFMCLK / 2 + 3, APB1_CLK = OFMCLK / 3 + 4, APB1_CLK = OFMCLK / 4 + 5, APB1_CLK = OFMCLK / 5 + 6, APB1_CLK = OFMCLK / 6 + 7, APB1_CLK = OFMCLK / 7 + 8, APB1_CLK = OFMCLK / 8 + 9, APB1_CLK = OFMCLK / 9 + 10, APB1_CLK = OFMCLK / 10 + enum: + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + - 7 + - 8 + - 9 + - 10 + + apb2-prescaler: + type: int + required: true + description: | + APB2 prescaler. It sets the APB2 bus frequency, APB2_CLK, by dividing + OFMCLK(MCLK) and needs to meet the following requirements. + - The maximum APB2_CLK frequency is either the MCLK frequency divided by 1 or 100 MHz. + - Only the following values are allowed: + 1, APB2_CLK = OFMCLK + 2, APB2_CLK = OFMCLK / 2 + 3, APB2_CLK = OFMCLK / 3 + 4, APB2_CLK = OFMCLK / 4 + 5, APB2_CLK = OFMCLK / 5 + 6, APB2_CLK = OFMCLK / 6 + 7, APB2_CLK = OFMCLK / 7 + 8, APB2_CLK = OFMCLK / 8 + 9, APB2_CLK = OFMCLK / 9 + 10, APB2_CLK = OFMCLK / 10 + enum: + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + - 7 + - 8 + - 9 + - 10 + + apb3-prescaler: + type: int + required: true + description: | + APB3 prescaler. It sets the APB3 bus frequency, APB3_CLK, by dividing + OFMCLK(MCLK) and needs to meet the following requirements. + - The maximum APB3_CLK frequency is either the MCLK frequency divided by 1 or 100 MHz. + - Only the following values are allowed: + 1, APB3_CLK = OFMCLK + 2, APB3_CLK = OFMCLK / 2 + 3, APB3_CLK = OFMCLK / 3 + 4, APB3_CLK = OFMCLK / 4 + 5, APB3_CLK = OFMCLK / 5 + 6, APB3_CLK = OFMCLK / 6 + 7, APB3_CLK = OFMCLK / 7 + 8, APB3_CLK = OFMCLK / 8 + 9, APB3_CLK = OFMCLK / 9 + 10, APB3_CLK = OFMCLK / 10 + enum: + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + - 7 + - 8 + - 9 + - 10 + + ahb6-prescaler: + type: int + required: true + description: | + AHB6 prescaler. The AHB6 bus clock (AHB6_CLK) is derived from the Core clock (CLK) via a + programmable divider controlled by the AHB6DIV field in HFCGP register. + Its frequency must be set according to the following rules: + - The maximum AHB6_CLK frequency is either the CLK frequency divided by 1 or 100 MHz. + - Only the following values are allowed: + 1, AHB6_CLK = CORE_CLK + 2, AHB6_CLK = CORE_CLK / 2 + 4, AHB6_CLK = CORE_CLK / 4 + enum: + - 1 + - 2 + - 4 + + fiu-prescaler: + type: int + required: true + description: | + FIU prescaler. The FIU clock (FIUCLK) is derived from the Core clock (CLK) via a + programmable divider controlled by the FIUDIV field in HFCBCD1 register. + Its frequency must be set according to the following rules: + - The maximum FIUCLK frequency is either the CLK frequency divided by 1 or 100MHz. + - Only the following values are allowed: + 1, FIU_CLK = CORE_CLK + 2, FIU_CLK = CORE_CLK / 2 + 4, FIU_CLK = CORE_CLK / 4 + enum: + - 1 + - 2 + - 4 + + i3c-prescaler: + type: int + required: true + description: | + I3C prescaler. It sets the I3C clk_slow_tc frequency, by dividing + APB3_CLK and it can be up to 100 MHz. + enum: + - 1 + - 2 + - 4 + +clock-cells: + - clk_id From cae35c2a1ececf0430ebbd81fb189e19e3c3eb79 Mon Sep 17 00:00:00 2001 From: Alan Yang Date: Fri, 20 Sep 2024 09:54:42 +0800 Subject: [PATCH 2547/4482] boards: nuvoton: support npcm clock driver Support npcm clock driver on npcm400_evb. Signed-off-by: Alan Yang --- boards/nuvoton/npcm400_evb/npcm400_evb.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boards/nuvoton/npcm400_evb/npcm400_evb.yaml b/boards/nuvoton/npcm400_evb/npcm400_evb.yaml index c9628e4553df3..f940445ff6012 100644 --- a/boards/nuvoton/npcm400_evb/npcm400_evb.yaml +++ b/boards/nuvoton/npcm400_evb/npcm400_evb.yaml @@ -14,3 +14,5 @@ toolchain: ram: 768 flash: 1024 vendor: nuvoton +supported: + - clock From bf8181bbb122f9b325be7842cd56794ef4107b1c Mon Sep 17 00:00:00 2001 From: Alan Yang Date: Thu, 26 Sep 2024 09:28:26 +0800 Subject: [PATCH 2548/4482] soc: nuvoton: Enable npcm clock control driver Enable npcm clock control driver in npcm4. Signed-off-by: Alan Yang --- soc/nuvoton/npcm/npcm4/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/soc/nuvoton/npcm/npcm4/Kconfig b/soc/nuvoton/npcm/npcm4/Kconfig index a393fad27f95a..8db9cd34775d7 100644 --- a/soc/nuvoton/npcm/npcm4/Kconfig +++ b/soc/nuvoton/npcm/npcm4/Kconfig @@ -8,3 +8,4 @@ config SOC_SERIES_NPCM4 select CPU_CORTEX_M_HAS_DWT select CORTEX_M_SYSTICK select CPU_HAS_ARM_MPU + select CLOCK_CONTROL From 795644f8f367771fb57cd74b584d12dac08fdb86 Mon Sep 17 00:00:00 2001 From: Alan Yang Date: Thu, 19 Sep 2024 14:52:51 +0800 Subject: [PATCH 2549/4482] MAINTAINERS: update information of Nuvoton NPCM Platform Update 'Nuvoton NPCM Platform': 'files' section. Signed-off-by: Alan Yang --- MAINTAINERS.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index cfae0a0898ec7..68f105d431fc6 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -3489,6 +3489,8 @@ Nuvoton NPCM Platforms: - soc/nuvoton/npcm/ - boards/nuvoton/npcm*/ - dts/arm/nuvoton/ + - drivers/*/*_npcm* + - include/zephyr/dt-bindings/*/npcm_* labels: - "platform: Nuvoton NPCM" From fe4215462d108f14e7caf1a571188007e76ae87b Mon Sep 17 00:00:00 2001 From: Sven Ginka Date: Mon, 23 Sep 2024 16:31:20 +0200 Subject: [PATCH 2550/4482] soc: sensry: udma, pad renaming Before that fix the names for UDMA could be misleading. With that fix the namespace is clear and easy to follow. Same applies for peripheral addresses and pad config. Signed-off-by: Sven Ginka --- drivers/serial/uart_sy1xx.c | 96 ++++++------ drivers/timer/sy1xx_sys_timer.c | 102 ++++++------- soc/sensry/ganymed/sy1xx/common/pad_ctrl.h | 44 +++--- soc/sensry/ganymed/sy1xx/common/soc.c | 45 +++--- soc/sensry/ganymed/sy1xx/common/soc.h | 55 +++---- soc/sensry/ganymed/sy1xx/common/udma.c | 98 +++++++------ soc/sensry/ganymed/sy1xx/common/udma.h | 163 ++++++++++----------- 7 files changed, 307 insertions(+), 296 deletions(-) diff --git a/drivers/serial/uart_sy1xx.c b/drivers/serial/uart_sy1xx.c index a91b93937524b..b0552719b52c5 100644 --- a/drivers/serial/uart_sy1xx.c +++ b/drivers/serial/uart_sy1xx.c @@ -20,13 +20,13 @@ struct sy1xx_uart_config { typedef struct { uint16_t data_len; uint8_t *data; -} uartTransfer_t; +} sy1xx_uartTransfer_t; typedef enum { DRIVERS_UART_STOP_1, DRIVERS_UART_STOP_1_5, DRIVERS_UART_STOP_2 -} uart_stop_t; +} sy1xx_uart_stop_t; typedef enum { DRIVERS_UART_PAR_NONE, @@ -34,13 +34,13 @@ typedef enum { DRIVERS_UART_PAR_ODD, DRIVERS_UART_PAR_MARK, DRIVERS_UART_PAR_SPACE -} uart_parity_t; +} sy1xx_uart_parity_t; typedef struct { uint32_t baudrate; - uart_stop_t stopbits; - uart_parity_t parity; -} uartConfig_t; + sy1xx_uart_stop_t stopbits; + sy1xx_uart_parity_t parity; +} sy1xx_uartConfig_t; #define DEVICE_MAX_BUFFER_SIZE (512) @@ -50,10 +50,10 @@ struct sy1xx_uart_data { }; /* prototypes */ -static int32_t drivers_uart_read(const struct device *dev, uartTransfer_t *request); -static int32_t drivers_uart_write(const struct device *dev, uartTransfer_t *request); +static int32_t sy1xx_uart_read(const struct device *dev, sy1xx_uartTransfer_t *request); +static int32_t sy1xx_uart_write(const struct device *dev, sy1xx_uartTransfer_t *request); -static int32_t drivers_uart_configure(const struct device *dev, uartConfig_t *uart_cfg) +static int32_t sy1xx_uart_configure(const struct device *dev, sy1xx_uartConfig_t *uart_cfg) { struct sy1xx_uart_config *config = (struct sy1xx_uart_config *)dev->config; @@ -66,7 +66,7 @@ static int32_t drivers_uart_configure(const struct device *dev, uartConfig_t *ua * and then will restart from 0, so we must give div - 1 as * divider */ - int32_t divider = soc_get_peripheral_clock() / uart_cfg->baudrate - 1; + uint32_t divider = sy1xx_soc_get_peripheral_clock() / uart_cfg->baudrate - 1; /* * [31:16]: clock divider (from SoC clock) @@ -85,17 +85,17 @@ static int32_t drivers_uart_configure(const struct device *dev, uartConfig_t *ua volatile uint32_t setup = 0x0306 | uart_cfg->parity; setup |= ((divider) << 16); - UDMA_WRITE_REG(config->base, UDMA_SETUP_REG, setup); + SY1XX_UDMA_WRITE_REG(config->base, SY1XX_UDMA_SETUP_REG, setup); /* start initial reading request to get the dma running */ uint8_t dummy_data[10]; - uartTransfer_t dummy_request = { + sy1xx_uartTransfer_t dummy_request = { .data_len = 10, .data = (uint8_t *)dummy_data, }; - drivers_uart_read(dev, &dummy_request); + sy1xx_uart_read(dev, &dummy_request); return 0; } @@ -105,7 +105,7 @@ static int32_t drivers_uart_configure(const struct device *dev, uartConfig_t *ua * - 0: OK * - > 0: Busy */ -int32_t drivers_uart_read(const struct device *dev, uartTransfer_t *request) +int32_t sy1xx_uart_read(const struct device *dev, sy1xx_uartTransfer_t *request) { struct sy1xx_uart_config *config = (struct sy1xx_uart_config *)dev->config; struct sy1xx_uart_data *data = (struct sy1xx_uart_data *)dev->data; @@ -125,7 +125,7 @@ int32_t drivers_uart_read(const struct device *dev, uartTransfer_t *request) int32_t ret = 0; /* rx is ready */ - int32_t remaining_bytes = UDMA_READ_REG(config->base, UDMA_RX_SIZE_REG); + int32_t remaining_bytes = SY1XX_UDMA_READ_REG(config->base, SY1XX_UDMA_RX_SIZE_REG); int32_t bytes_transferred = (DEVICE_MAX_BUFFER_SIZE - remaining_bytes); if (bytes_transferred > 0) { @@ -140,10 +140,10 @@ int32_t drivers_uart_read(const struct device *dev, uartTransfer_t *request) request->data_len = bytes_transferred; /* stop and restart receiving */ - UDMA_CANCEL_RX(config->base); + SY1XX_UDMA_CANCEL_RX(config->base); /* start another read request, with maximum buffer size */ - UDMA_START_RX(config->base, (int32_t)data->read, DEVICE_MAX_BUFFER_SIZE, 0); + SY1XX_UDMA_START_RX(config->base, (int32_t)data->read, DEVICE_MAX_BUFFER_SIZE, 0); /* return: some data received */ ret = 0; @@ -162,7 +162,7 @@ int32_t drivers_uart_read(const struct device *dev, uartTransfer_t *request) * - 0: OK * - > 0: Busy */ -int32_t drivers_uart_write(const struct device *dev, uartTransfer_t *request) +int32_t sy1xx_uart_write(const struct device *dev, sy1xx_uartTransfer_t *request) { struct sy1xx_uart_config *config = (struct sy1xx_uart_config *)dev->config; struct sy1xx_uart_data *data = (struct sy1xx_uart_data *)dev->data; @@ -180,15 +180,15 @@ int32_t drivers_uart_write(const struct device *dev, uartTransfer_t *request) return -2; } - if (0 == UDMA_IS_FINISHED_TX(config->base)) { + if (0 == SY1XX_UDMA_IS_FINISHED_TX(config->base)) { /* writing not finished => busy */ return 1; } - uint32_t remaining_bytes = UDMA_GET_REMAINING_TX(config->base); + uint32_t remaining_bytes = SY1XX_UDMA_GET_REMAINING_TX(config->base); if (remaining_bytes != 0) { - UDMA_CANCEL_TX(config->base); + SY1XX_UDMA_CANCEL_TX(config->base); return -3; } @@ -198,7 +198,7 @@ int32_t drivers_uart_write(const struct device *dev, uartTransfer_t *request) } /* start new transmission */ - UDMA_START_TX(config->base, (uint32_t)data->write, request->data_len, 0); + SY1XX_UDMA_START_TX(config->base, (uint32_t)data->write, request->data_len, 0); /* success */ return 0; @@ -207,14 +207,14 @@ int32_t drivers_uart_write(const struct device *dev, uartTransfer_t *request) /* * it should be avoided to read single characters only */ -static int sensry_uart_poll_in(const struct device *dev, unsigned char *c) +static int sy1xx_uart_poll_in(const struct device *dev, unsigned char *c) { - uartTransfer_t request = { + sy1xx_uartTransfer_t request = { .data_len = 1, .data = c, }; - if (0 == drivers_uart_read(dev, &request)) { + if (0 == sy1xx_uart_read(dev, &request)) { return 0; } @@ -224,21 +224,21 @@ static int sensry_uart_poll_in(const struct device *dev, unsigned char *c) /* * it should be avoided to write single characters only */ -static void sensry_uart_poll_out(const struct device *dev, unsigned char c) +static void sy1xx_uart_poll_out(const struct device *dev, unsigned char c) { - uartTransfer_t request = { + sy1xx_uartTransfer_t request = { .data_len = 1, .data = &c, }; while (1) { - if (0 == drivers_uart_write(dev, &request)) { + if (0 == sy1xx_uart_write(dev, &request)) { break; } } } -static int sensry_uart_err_check(const struct device *dev) +static int sy1xx_uart_err_check(const struct device *dev) { int err = 0; @@ -256,47 +256,51 @@ static int sy1xx_uart_init(const struct device *dev) } /* UDMA clock enable */ - drivers_udma_enable_clock(DRIVERS_UDMA_UART, config->inst); + sy1xx_udma_enable_clock(SY1XX_UDMA_MODULE_UART, config->inst); /* PAD config */ uint32_t pad_config_tx = - PAD_CONFIG(0, PAD_SMT_DISABLE, PAD_SLEW_LOW, PAD_PULLUP_DIS, PAD_PULLDOWN_DIS, - PAD_DRIVE_2PF, PAD_PMOD_NORMAL, PAD_DIR_OUTPUT); + SY1XX_PAD_CONFIG(0, SY1XX_PAD_SMT_DISABLE, SY1XX_PAD_SLEW_LOW, SY1XX_PAD_PULLUP_DIS, + SY1XX_PAD_PULLDOWN_DIS, SY1XX_PAD_DRIVE_2PF, SY1XX_PAD_PMOD_NORMAL, + SY1XX_PAD_DIR_OUTPUT); uint32_t pad_config_rx = - PAD_CONFIG(8, PAD_SMT_DISABLE, PAD_SLEW_LOW, PAD_PULLUP_DIS, PAD_PULLDOWN_DIS, - PAD_DRIVE_2PF, PAD_PMOD_NORMAL, PAD_DIR_INPUT); + SY1XX_PAD_CONFIG(8, SY1XX_PAD_SMT_DISABLE, SY1XX_PAD_SLEW_LOW, SY1XX_PAD_PULLUP_DIS, + SY1XX_PAD_PULLDOWN_DIS, SY1XX_PAD_DRIVE_2PF, SY1XX_PAD_PMOD_NORMAL, + SY1XX_PAD_DIR_INPUT); uint32_t pad_config_cts = - PAD_CONFIG(16, PAD_SMT_DISABLE, PAD_SLEW_LOW, PAD_PULLUP_EN, PAD_PULLDOWN_DIS, - PAD_DRIVE_2PF, PAD_PMOD_NORMAL, PAD_DIR_INPUT); + SY1XX_PAD_CONFIG(16, SY1XX_PAD_SMT_DISABLE, SY1XX_PAD_SLEW_LOW, SY1XX_PAD_PULLUP_EN, + SY1XX_PAD_PULLDOWN_DIS, SY1XX_PAD_DRIVE_2PF, SY1XX_PAD_PMOD_NORMAL, + SY1XX_PAD_DIR_INPUT); uint32_t pad_config_rts = - PAD_CONFIG(24, PAD_SMT_DISABLE, PAD_SLEW_LOW, PAD_PULLUP_DIS, PAD_PULLDOWN_DIS, - PAD_DRIVE_2PF, PAD_PMOD_NORMAL, PAD_DIR_OUTPUT); + SY1XX_PAD_CONFIG(24, SY1XX_PAD_SMT_DISABLE, SY1XX_PAD_SLEW_LOW, + SY1XX_PAD_PULLUP_DIS, SY1XX_PAD_PULLDOWN_DIS, SY1XX_PAD_DRIVE_2PF, + SY1XX_PAD_PMOD_NORMAL, SY1XX_PAD_DIR_OUTPUT); sys_write32((pad_config_tx | pad_config_rx | pad_config_cts | pad_config_rts), - PAD_CONFIG_ADDR_UART + (config->inst * 4 + 0)); + SY1XX_PAD_CONFIG_ADDR_UART + (config->inst * 4 + 0)); - uartConfig_t default_config = { + sy1xx_uartConfig_t default_config = { .baudrate = 1000000, .parity = DRIVERS_UART_PAR_NONE, .stopbits = DRIVERS_UART_STOP_1, }; - UDMA_CANCEL_RX(config->base); - UDMA_CANCEL_TX(config->base); + SY1XX_UDMA_CANCEL_RX(config->base); + SY1XX_UDMA_CANCEL_TX(config->base); - drivers_uart_configure(dev, &default_config); + sy1xx_uart_configure(dev, &default_config); return 0; } static const struct uart_driver_api sy1xx_uart_driver_api = { - .poll_in = sensry_uart_poll_in, - .poll_out = sensry_uart_poll_out, - .err_check = sensry_uart_err_check, + .poll_in = sy1xx_uart_poll_in, + .poll_out = sy1xx_uart_poll_out, + .err_check = sy1xx_uart_err_check, }; diff --git a/drivers/timer/sy1xx_sys_timer.c b/drivers/timer/sy1xx_sys_timer.c index 524b54ae2e786..52507ecd96085 100644 --- a/drivers/timer/sy1xx_sys_timer.c +++ b/drivers/timer/sy1xx_sys_timer.c @@ -17,80 +17,81 @@ #define SY1XX_MINIMUM_ALLOWED_TICK 1000 -#define REG_TIMER_CMP_LO_OFFS 0x10 +#define SY1XX_REG_TIMER_CMP_LO_OFFS 0x10 /* config bits */ -#define PLP_TIMER_ENABLE_BIT 0 -#define PLP_TIMER_RESET_BIT 1 -#define PLP_TIMER_IRQ_ENABLE_BIT 2 -#define PLP_TIMER_IEM_BIT 3 -#define PLP_TIMER_CMP_CLR_BIT 4 -#define PLP_TIMER_ONE_SHOT_BIT 5 -#define PLP_TIMER_PRESCALER_ENABLE_BIT 6 -#define PLP_TIMER_CLOCK_SOURCE_BIT 7 -#define PLP_TIMER_PRESCALER_VALUE_BIT 8 -#define PLP_TIMER_PRESCALER_VALUE_BITS 8 -#define PLP_TIMER_64_BIT 31 +#define SY1XX_TIMER_ENABLE_BIT 0 +#define SY1XX_TIMER_RESET_BIT 1 +#define SY1XX_TIMER_IRQ_ENABLE_BIT 2 +#define SY1XX_TIMER_IEM_BIT 3 +#define SY1XX_TIMER_CMP_CLR_BIT 4 +#define SY1XX_TIMER_ONE_SHOT_BIT 5 +#define SY1XX_TIMER_PRESCALER_ENABLE_BIT 6 +#define SY1XX_TIMER_CLOCK_SOURCE_BIT 7 +#define SY1XX_TIMER_PRESCALER_VALUE_BIT 8 +#define SY1XX_TIMER_PRESCALER_VALUE_BITS 8 +#define SY1XX_TIMER_64_BIT 31 /* config flags */ -#define PLP_TIMER_ACTIVE 1 -#define PLP_TIMER_IDLE 0 +#define SY1XX_TIMER_ACTIVE 1 +#define SY1XX_TIMER_IDLE 0 -#define PLP_TIMER_RESET_ENABLED 1 -#define PLP_TIMER_RESET_DISABLED 0 +#define SY1XX_TIMER_RESET_ENABLED 1 +#define SY1XX_TIMER_RESET_DISABLED 0 -#define PLP_TIMER_IRQ_ENABLED 1 -#define PLP_TIMER_IRQ_DISABLED 0 +#define SY1XX_TIMER_IRQ_ENABLED 1 +#define SY1XX_TIMER_IRQ_DISABLED 0 -#define PLP_TIMER_IEM_ENABLED 1 -#define PLP_TIMER_IEM_DISABLED 0 +#define SY1XX_TIMER_IEM_ENABLED 1 +#define SY1XX_TIMER_IEM_DISABLED 0 -#define PLP_TIMER_CMPCLR_ENABLED 1 -#define PLP_TIMER_CMPCLR_DISABLED 0 +#define SY1XX_TIMER_CMPCLR_ENABLED 1 +#define SY1XX_TIMER_CMPCLR_DISABLED 0 -#define PLP_TIMER_ONE_SHOT_ENABLED 1 -#define PLP_TIMER_ONE_SHOT_DISABLED 0 +#define SY1XX_TIMER_ONE_SHOT_ENABLED 1 +#define SY1XX_TIMER_ONE_SHOT_DISABLED 0 -#define PLP_TIMER_REFCLK_ENABLED 1 -#define PLP_TIMER_REFCLK_DISABLED 0 +#define SY1XX_TIMER_REFCLK_ENABLED 1 +#define SY1XX_TIMER_REFCLK_DISABLED 0 -#define PLP_TIMER_PRESCALER_ENABLED 1 -#define PLP_TIMER_PRESCALER_DISABLED 0 +#define SY1XX_TIMER_PRESCALER_ENABLED 1 +#define SY1XX_TIMER_PRESCALER_DISABLED 0 -#define PLP_TIMER_MODE_64_ENABLED 1 -#define PLP_TIMER_MODE_64_DISABLED 0 +#define SY1XX_TIMER_MODE_64_ENABLED 1 +#define SY1XX_TIMER_MODE_64_DISABLED 0 static volatile uint32_t current_sys_clock; -struct timer_cfg { +struct sy1xx_timer_cfg { uint32_t tick_us; }; -static inline unsigned int timer_conf_prep(int enable, int reset, int irq_enable, int event_mask, - int cmp_clr, int one_shot, int clk_source, - int prescaler_enable, int prescaler, int mode_64) +static inline unsigned int sy1xx_timer_conf_prep(int enable, int reset, int irq_enable, + int event_mask, int cmp_clr, int one_shot, + int clk_source, int prescaler_enable, + int prescaler, int mode_64) { - return (enable << PLP_TIMER_ENABLE_BIT) | (reset << PLP_TIMER_RESET_BIT) | - (irq_enable << PLP_TIMER_IRQ_ENABLE_BIT) | (event_mask << PLP_TIMER_IEM_BIT) | - (cmp_clr << PLP_TIMER_CMP_CLR_BIT) | (one_shot << PLP_TIMER_ONE_SHOT_BIT) | - (clk_source << PLP_TIMER_CLOCK_SOURCE_BIT) | - (prescaler_enable << PLP_TIMER_PRESCALER_ENABLE_BIT) | - (prescaler << PLP_TIMER_PRESCALER_VALUE_BIT) | (mode_64 << PLP_TIMER_64_BIT); + return (enable << SY1XX_TIMER_ENABLE_BIT) | (reset << SY1XX_TIMER_RESET_BIT) | + (irq_enable << SY1XX_TIMER_IRQ_ENABLE_BIT) | (event_mask << SY1XX_TIMER_IEM_BIT) | + (cmp_clr << SY1XX_TIMER_CMP_CLR_BIT) | (one_shot << SY1XX_TIMER_ONE_SHOT_BIT) | + (clk_source << SY1XX_TIMER_CLOCK_SOURCE_BIT) | + (prescaler_enable << SY1XX_TIMER_PRESCALER_ENABLE_BIT) | + (prescaler << SY1XX_TIMER_PRESCALER_VALUE_BIT) | (mode_64 << SY1XX_TIMER_64_BIT); } static void sy1xx_sys_timer_reload(uint32_t base, uint32_t reload_timer_ticks) { - sys_write32(reload_timer_ticks, (base + REG_TIMER_CMP_LO_OFFS)); + sys_write32(reload_timer_ticks, (base + SY1XX_REG_TIMER_CMP_LO_OFFS)); } static void sy1xx_sys_timer_cfg_auto_reload(uint32_t base) { - uint32_t conf = - timer_conf_prep(PLP_TIMER_ACTIVE, PLP_TIMER_RESET_ENABLED, PLP_TIMER_IRQ_ENABLED, - PLP_TIMER_IEM_DISABLED, PLP_TIMER_CMPCLR_ENABLED, - PLP_TIMER_ONE_SHOT_DISABLED, PLP_TIMER_REFCLK_ENABLED, - PLP_TIMER_PRESCALER_DISABLED, 0, PLP_TIMER_MODE_64_DISABLED); + uint32_t conf = sy1xx_timer_conf_prep( + SY1XX_TIMER_ACTIVE, SY1XX_TIMER_RESET_ENABLED, SY1XX_TIMER_IRQ_ENABLED, + SY1XX_TIMER_IEM_DISABLED, SY1XX_TIMER_CMPCLR_ENABLED, SY1XX_TIMER_ONE_SHOT_DISABLED, + SY1XX_TIMER_REFCLK_ENABLED, SY1XX_TIMER_PRESCALER_DISABLED, 0, + SY1XX_TIMER_MODE_64_DISABLED); sys_write32(conf, base); } @@ -105,7 +106,7 @@ static void sy1xx_sys_timer_irq_disable(void) soc_disable_irq(DT_IRQN(SY1XX_SYS_TIMER_NODE)); } -static int32_t sy1xx_sys_timer_config(uint32_t base, struct timer_cfg *cfg) +static int32_t sy1xx_sys_timer_config(uint32_t base, struct sy1xx_timer_cfg *cfg) { /* global irq disable */ @@ -118,11 +119,12 @@ static int32_t sy1xx_sys_timer_config(uint32_t base, struct timer_cfg *cfg) /* expect 1.0ms resolution => tick_us = 1000 */ uint32_t us = cfg->tick_us; volatile double ticks_f = - (((double)us / (double)1000000) * (double)soc_get_rts_clock_frequency()) + 1.0; + (((double)us / (double)1000000) * (double)sy1xx_soc_get_rts_clock_frequency()) + + 1.0; volatile uint32_t timer_ticks = (uint32_t)ticks_f; - printk("timer [%d] expected %u (%d)\n", soc_get_rts_clock_frequency(), cfg->tick_us, + printk("timer [%d] expected %u (%d)\n", sy1xx_soc_get_rts_clock_frequency(), cfg->tick_us, timer_ticks); sy1xx_sys_timer_reload(base, timer_ticks); @@ -159,7 +161,7 @@ static int sy1xx_sys_timer_init(void) { printk("starting sys_timer\n"); - struct timer_cfg timerCfg0 = { + struct sy1xx_timer_cfg timerCfg0 = { .tick_us = DT_PROP(SY1XX_SYS_TIMER_NODE, ticks_us), }; diff --git a/soc/sensry/ganymed/sy1xx/common/pad_ctrl.h b/soc/sensry/ganymed/sy1xx/common/pad_ctrl.h index 2fa2656c83d6b..6edf5a5d6fee4 100644 --- a/soc/sensry/ganymed/sy1xx/common/pad_ctrl.h +++ b/soc/sensry/ganymed/sy1xx/common/pad_ctrl.h @@ -6,39 +6,39 @@ #ifndef GANYMED_SY1XX_PAD_CTRL_H #define GANYMED_SY1XX_PAD_CTRL_H -#define PAD_CONFIG(pin_offset, SMT, SLEW, PULLUP, PULLDOWN, DRV, PMOD, DIR) \ +#define SY1XX_PAD_CONFIG(pin_offset, SMT, SLEW, PULLUP, PULLDOWN, DRV, PMOD, DIR) \ (((SMT << 7) | (SLEW << 6) | (PULLUP << 5) | (PULLDOWN << 4) | (DRV << 2) | (PMOD << 1) | \ DIR) \ << pin_offset) -#define PAD_CONFIG_ADDR (ARCHI_SOC_PERIPHERALS_ADDR + ARCHI_APB_SOC_CTRL_OFFSET) +#define SY1XX_PAD_CONFIG_ADDR (SY1XX_ARCHI_SOC_PERIPHERALS_ADDR + SY1XX_ARCHI_APB_SOC_CTRL_OFFSET) -#define PAD_CONFIG_ADDR_UART (PAD_CONFIG_ADDR + 0x020) -#define PAD_CONFIG_ADDR_SPI (PAD_CONFIG_ADDR + 0x02c) -#define PAD_CONFIG_ADDR_I2C (PAD_CONFIG_ADDR + 0x100) -#define PAD_CONFIG_ADDR_MAC (PAD_CONFIG_ADDR + 0x130) +#define SY1XX_PAD_CONFIG_ADDR_UART (SY1XX_PAD_CONFIG_ADDR + 0x020) +#define SY1XX_PAD_CONFIG_ADDR_SPI (SY1XX_PAD_CONFIG_ADDR + 0x02c) +#define SY1XX_PAD_CONFIG_ADDR_I2C (SY1XX_PAD_CONFIG_ADDR + 0x100) +#define SY1XX_PAD_CONFIG_ADDR_MAC (SY1XX_PAD_CONFIG_ADDR + 0x130) -#define PAD_SMT_DISABLE 0 -#define PAD_SMT_ENABLE 1 +#define SY1XX_PAD_SMT_DISABLE 0 +#define SY1XX_PAD_SMT_ENABLE 1 -#define PAD_SLEW_LOW 0 -#define PAD_SLEW_HIGH 1 +#define SY1XX_PAD_SLEW_LOW 0 +#define SY1XX_PAD_SLEW_HIGH 1 -#define PAD_PULLUP_DIS 0 -#define PAD_PULLUP_EN 1 +#define SY1XX_PAD_PULLUP_DIS 0 +#define SY1XX_PAD_PULLUP_EN 1 -#define PAD_PULLDOWN_DIS 0 -#define PAD_PULLDOWN_EN 1 +#define SY1XX_PAD_PULLDOWN_DIS 0 +#define SY1XX_PAD_PULLDOWN_EN 1 -#define PAD_DRIVE_2PF 0 -#define PAD_DRIVE_4PF 1 -#define PAD_DRIVE_8PF 2 -#define PAD_DRIVE_16PF 3 +#define SY1XX_PAD_DRIVE_2PF 0 +#define SY1XX_PAD_DRIVE_4PF 1 +#define SY1XX_PAD_DRIVE_8PF 2 +#define SY1XX_PAD_DRIVE_16PF 3 -#define PAD_PMOD_NORMAL 0 -#define PAD_PMOD_TRISTATE 1 +#define SY1XX_PAD_PMOD_NORMAL 0 +#define SY1XX_PAD_PMOD_TRISTATE 1 -#define PAD_DIR_OUTPUT 0 -#define PAD_DIR_INPUT 1 +#define SY1XX_PAD_DIR_OUTPUT 0 +#define SY1XX_PAD_DIR_INPUT 1 #endif /* GANYMED_SY1XX_PAD_CTRL_H */ diff --git a/soc/sensry/ganymed/sy1xx/common/soc.c b/soc/sensry/ganymed/sy1xx/common/soc.c index 5f1ccb9ee8621..5ad1100efb012 100644 --- a/soc/sensry/ganymed/sy1xx/common/soc.c +++ b/soc/sensry/ganymed/sy1xx/common/soc.c @@ -15,33 +15,33 @@ LOG_MODULE_REGISTER(soc); #include "soc.h" /* ITC */ -#define ARCHI_ITC_MASK_OFFSET 0x0 -#define ARCHI_ITC_MASK_SET_OFFSET 0x4 -#define ARCHI_ITC_MASK_CLR_OFFSET 0x8 -#define ARCHI_ITC_STATUS_OFFSET 0xc -#define ARCHI_ITC_STATUS_SET_OFFSET 0x10 -#define ARCHI_ITC_STATUS_CLR_OFFSET 0x14 -#define ARCHI_ITC_ACK_OFFSET 0x18 -#define ARCHI_ITC_ACK_SET_OFFSET 0x1c -#define ARCHI_ITC_ACK_CLR_OFFSET 0x20 -#define ARCHI_ITC_FIFO_OFFSET 0x24 +#define SY1XX_ARCHI_ITC_MASK_OFFSET 0x0 +#define SY1XX_ARCHI_ITC_MASK_SET_OFFSET 0x4 +#define SY1XX_ARCHI_ITC_MASK_CLR_OFFSET 0x8 +#define SY1XX_ARCHI_ITC_STATUS_OFFSET 0xc +#define SY1XX_ARCHI_ITC_STATUS_SET_OFFSET 0x10 +#define SY1XX_ARCHI_ITC_STATUS_CLR_OFFSET 0x14 +#define SY1XX_ARCHI_ITC_ACK_OFFSET 0x18 +#define SY1XX_ARCHI_ITC_ACK_SET_OFFSET 0x1c +#define SY1XX_ARCHI_ITC_ACK_CLR_OFFSET 0x20 +#define SY1XX_ARCHI_ITC_FIFO_OFFSET 0x24 void sys_arch_reboot(int type) { ARG_UNUSED(type); } -#define ARCHI_REF_CLOCK (32768) -#define ARCHI_PER_CLOCK (125000000) +#define SY1XX_ARCHI_REF_CLOCK (32768) +#define SY1XX_ARCHI_PER_CLOCK (125000000) -uint32_t soc_get_rts_clock_frequency(void) +uint32_t sy1xx_soc_get_rts_clock_frequency(void) { - return ARCHI_REF_CLOCK; + return SY1XX_ARCHI_REF_CLOCK; } -uint32_t soc_get_peripheral_clock(void) +uint32_t sy1xx_soc_get_peripheral_clock(void) { - return ARCHI_PER_CLOCK; + return SY1XX_ARCHI_PER_CLOCK; } void riscv_clic_irq_priority_set(uint32_t irq, uint32_t prio, uint32_t flags) @@ -51,17 +51,18 @@ void riscv_clic_irq_priority_set(uint32_t irq, uint32_t prio, uint32_t flags) void soc_enable_irq(uint32_t idx) { - uint32_t current = sys_read32(ARCHI_FC_ITC_ADDR + ARCHI_ITC_MASK_SET_OFFSET); + uint32_t current = sys_read32(SY1XX_ARCHI_FC_ITC_ADDR + SY1XX_ARCHI_ITC_MASK_SET_OFFSET); - sys_write32(current | (1 << (idx & 0x1f)), ARCHI_FC_ITC_ADDR + ARCHI_ITC_MASK_SET_OFFSET); + sys_write32(current | (1 << (idx & 0x1f)), + SY1XX_ARCHI_FC_ITC_ADDR + SY1XX_ARCHI_ITC_MASK_SET_OFFSET); } void soc_disable_irq(uint32_t idx) { - uint32_t current = sys_read32(ARCHI_FC_ITC_ADDR + ARCHI_ITC_MASK_CLR_OFFSET); + uint32_t current = sys_read32(SY1XX_ARCHI_FC_ITC_ADDR + SY1XX_ARCHI_ITC_MASK_CLR_OFFSET); sys_write32(current & (~(1 << (idx & 0x1f))), - ARCHI_FC_ITC_ADDR + ARCHI_ITC_MASK_CLR_OFFSET); + SY1XX_ARCHI_FC_ITC_ADDR + SY1XX_ARCHI_ITC_MASK_CLR_OFFSET); } /* @@ -82,10 +83,10 @@ void soc_interrupt_init(void) * * @return 0 */ -static int soc_sy1xx_init(void) +static int sy1xx_soc_init(void) { return 0; } -SYS_INIT(soc_sy1xx_init, PRE_KERNEL_1, 0); +SYS_INIT(sy1xx_soc_init, PRE_KERNEL_1, 0); diff --git a/soc/sensry/ganymed/sy1xx/common/soc.h b/soc/sensry/ganymed/sy1xx/common/soc.h index fc47a3125f88a..b079dcd4fa54d 100644 --- a/soc/sensry/ganymed/sy1xx/common/soc.h +++ b/soc/sensry/ganymed/sy1xx/common/soc.h @@ -12,33 +12,34 @@ /* SOC PERIPHERALS */ -#define ARCHI_SOC_PERIPHERALS_ADDR 0x1A100000 - -#define ARCHI_GPIO_OFFSET 0x00001000 -#define ARCHI_UDMA_OFFSET 0x00002000 -#define ARCHI_APB_SOC_CTRL_OFFSET 0x00004000 -#define ARCHI_SOC_EU_OFFSET 0x00006000 -#define ARCHI_FC_ITC_OFFSET 0x00009800 -#define ARCHI_FC_TIMER_OFFSET 0x0000B000 -#define ARCHI_STDOUT_OFFSET 0x0000F000 - -#define ARCHI_GPIO_ADDR (ARCHI_SOC_PERIPHERALS_ADDR + ARCHI_GPIO_OFFSET) -#define ARCHI_UDMA_ADDR (ARCHI_SOC_PERIPHERALS_ADDR + ARCHI_UDMA_OFFSET) -#define ARCHI_APB_SOC_CTRL_ADDR (ARCHI_SOC_PERIPHERALS_ADDR + ARCHI_APB_SOC_CTRL_OFFSET) -#define ARCHI_SOC_EU_ADDR (ARCHI_SOC_PERIPHERALS_ADDR + ARCHI_SOC_EU_OFFSET) -#define ARCHI_FC_ITC_ADDR (ARCHI_SOC_PERIPHERALS_ADDR + ARCHI_FC_ITC_OFFSET) -#define ARCHI_FC_TIMER_ADDR (ARCHI_SOC_PERIPHERALS_ADDR + ARCHI_FC_TIMER_OFFSET) -#define ARCHI_STDOUT_ADDR (ARCHI_SOC_PERIPHERALS_ADDR + ARCHI_STDOUT_OFFSET) - -#define ARCHI_PLL_ADDR (ARCHI_SOC_PERIPHERALS_ADDR) -#define ARCHI_SECURE_MRAM_CTRL_ADDR 0x1D180000 -#define ARCHI_GLOBAL_MRAM_CTRL_ADDR 0x1E080000 -#define ARCHI_MRAM_EFUSE_ADDR 0x1D070100 -#define ARCHI_TSN_ADDR 0x1A120000 -#define ARCHI_CAN_ADDR 0x1A130000 - -uint32_t soc_get_rts_clock_frequency(void); -uint32_t soc_get_peripheral_clock(void); +#define SY1XX_ARCHI_SOC_PERIPHERALS_ADDR 0x1A100000 + +#define SY1XX_ARCHI_GPIO_OFFSET 0x00001000 +#define SY1XX_ARCHI_UDMA_OFFSET 0x00002000 +#define SY1XX_ARCHI_APB_SOC_CTRL_OFFSET 0x00004000 +#define SY1XX_ARCHI_SOC_EU_OFFSET 0x00006000 +#define SY1XX_ARCHI_FC_ITC_OFFSET 0x00009800 +#define SY1XX_ARCHI_FC_TIMER_OFFSET 0x0000B000 +#define SY1XX_ARCHI_STDOUT_OFFSET 0x0000F000 + +#define SY1XX_ARCHI_GPIO_ADDR (SY1XX_ARCHI_SOC_PERIPHERALS_ADDR + SY1XX_ARCHI_GPIO_OFFSET) +#define SY1XX_ARCHI_UDMA_ADDR (SY1XX_ARCHI_SOC_PERIPHERALS_ADDR + SY1XX_ARCHI_UDMA_OFFSET) +#define SY1XX_ARCHI_APB_SOC_CTRL_ADDR \ + (SY1XX_ARCHI_SOC_PERIPHERALS_ADDR + SY1XX_ARCHI_APB_SOC_CTRL_OFFSET) +#define SY1XX_ARCHI_SOC_EU_ADDR (SY1XX_ARCHI_SOC_PERIPHERALS_ADDR + SY1XX_ARCHI_SOC_EU_OFFSET) +#define SY1XX_ARCHI_FC_ITC_ADDR (SY1XX_ARCHI_SOC_PERIPHERALS_ADDR + SY1XX_ARCHI_FC_ITC_OFFSET) +#define SY1XX_ARCHI_FC_TIMER_ADDR (SY1XX_ARCHI_SOC_PERIPHERALS_ADDR + SY1XX_ARCHI_FC_TIMER_OFFSET) +#define SY1XX_ARCHI_STDOUT_ADDR (SY1XX_ARCHI_SOC_PERIPHERALS_ADDR + SY1XX_ARCHI_STDOUT_OFFSET) + +#define SY1XX_ARCHI_PLL_ADDR (SY1XX_ARCHI_SOC_PERIPHERALS_ADDR) +#define SY1XX_ARCHI_SECURE_MRAM_CTRL_ADDR 0x1D180000 +#define SY1XX_ARCHI_GLOBAL_MRAM_CTRL_ADDR 0x1E080000 +#define SY1XX_ARCHI_MRAM_EFUSE_ADDR 0x1D070100 +#define SY1XX_ARCHI_TSN_ADDR 0x1A120000 +#define SY1XX_ARCHI_CAN_ADDR 0x1A130000 + +uint32_t sy1xx_soc_get_rts_clock_frequency(void); +uint32_t sy1xx_soc_get_peripheral_clock(void); void soc_enable_irq(uint32_t idx); void soc_disable_irq(uint32_t idx); diff --git a/soc/sensry/ganymed/sy1xx/common/udma.c b/soc/sensry/ganymed/sy1xx/common/udma.c index 752c84b91ce1a..16f399f91b28a 100644 --- a/soc/sensry/ganymed/sy1xx/common/udma.c +++ b/soc/sensry/ganymed/sy1xx/common/udma.c @@ -6,98 +6,98 @@ #include "soc.h" #include "udma.h" -#define UDMA_CTRL_PER_CG (ARCHI_UDMA_ADDR + UDMA_CONF_OFFSET) +#define SY1XX_UDMA_CTRL_PER_CG (SY1XX_ARCHI_UDMA_ADDR + SY1XX_UDMA_CONF_OFFSET) -#define DRIVERS_MAX_UART_COUNT 3 -#define DRIVERS_MAX_I2C_COUNT 4 -#define DRIVERS_MAX_SPI_COUNT 7 -#define DEVICE_MAX_ETH_COUNT 1 +#define SY1XX_MAX_UART_COUNT 3 +#define SY1XX_MAX_I2C_COUNT 4 +#define SY1XX_MAX_SPI_COUNT 7 +#define SY1XX_MAX_ETH_COUNT 1 -void drivers_udma_enable_clock(udma_module_t module, uint32_t instance) +void sy1xx_udma_enable_clock(sy1xx_udma_module_t module, uint32_t instance) { - uint32_t udma_ctrl_per_cg = sys_read32(UDMA_CTRL_PER_CG); + uint32_t udma_ctrl_per_cg = sys_read32(SY1XX_UDMA_CTRL_PER_CG); switch (module) { - case DRIVERS_UDMA_UART: - if (instance >= DRIVERS_MAX_UART_COUNT) { + case SY1XX_UDMA_MODULE_UART: + if (instance >= SY1XX_MAX_UART_COUNT) { return; } udma_ctrl_per_cg |= 1 << (instance + 0); break; - case DRIVERS_UDMA_I2C: - if (instance >= DRIVERS_MAX_I2C_COUNT) { + case SY1XX_UDMA_MODULE_I2C: + if (instance >= SY1XX_MAX_I2C_COUNT) { return; } udma_ctrl_per_cg |= 1 << (instance + 10); break; - case DRIVERS_UDMA_SPI: - if (instance >= DRIVERS_MAX_SPI_COUNT) { + case SY1XX_UDMA_MODULE_SPI: + if (instance >= SY1XX_MAX_SPI_COUNT) { return; } udma_ctrl_per_cg |= 1 << (instance + 3); break; - case DRIVERS_UDMA_MAC: - if (instance >= DEVICE_MAX_ETH_COUNT) { + case SY1XX_UDMA_MODULE_MAC: + if (instance >= SY1XX_MAX_ETH_COUNT) { return; } udma_ctrl_per_cg |= 1 << (instance + 20); break; - case DRIVERS_MAX_UDMA_COUNT: + case SY1XX_UDMA_MAX_MODULE_COUNT: break; } - sys_write32(udma_ctrl_per_cg, UDMA_CTRL_PER_CG); + sys_write32(udma_ctrl_per_cg, SY1XX_UDMA_CTRL_PER_CG); } -void drivers_udma_disable_clock(udma_module_t module, uint32_t instance) +void sy1xx_udma_disable_clock(sy1xx_udma_module_t module, uint32_t instance) { - uint32_t udma_ctrl_per_cg = sys_read32(UDMA_CTRL_PER_CG); + uint32_t udma_ctrl_per_cg = sys_read32(SY1XX_UDMA_CTRL_PER_CG); switch (module) { - case DRIVERS_UDMA_UART: - if (instance >= DRIVERS_MAX_UART_COUNT) { + case SY1XX_UDMA_MODULE_UART: + if (instance >= SY1XX_MAX_UART_COUNT) { return; } udma_ctrl_per_cg &= ~(1 << (instance + 0)); break; - case DRIVERS_UDMA_I2C: - if (instance >= DRIVERS_MAX_I2C_COUNT) { + case SY1XX_UDMA_MODULE_I2C: + if (instance >= SY1XX_MAX_I2C_COUNT) { return; } udma_ctrl_per_cg &= ~(1 << (instance + 10)); break; - case DRIVERS_UDMA_SPI: - if (instance >= DRIVERS_MAX_SPI_COUNT) { + case SY1XX_UDMA_MODULE_SPI: + if (instance >= SY1XX_MAX_SPI_COUNT) { return; } udma_ctrl_per_cg &= ~(1 << (instance + 3)); break; - case DRIVERS_UDMA_MAC: - if (instance >= DEVICE_MAX_ETH_COUNT) { + case SY1XX_UDMA_MODULE_MAC: + if (instance >= SY1XX_MAX_ETH_COUNT) { return; } udma_ctrl_per_cg &= ~(1 << (instance + 20)); break; - case DRIVERS_MAX_UDMA_COUNT: + case SY1XX_UDMA_MAX_MODULE_COUNT: break; } - sys_write32(udma_ctrl_per_cg, UDMA_CTRL_PER_CG); + sys_write32(udma_ctrl_per_cg, SY1XX_UDMA_CTRL_PER_CG); } -void drivers_udma_busy_delay(uint32_t msec) +void sy1xx_udma_busy_delay(uint32_t msec) { uint32_t sec = 250000000; uint32_t millis = (sec / 1000) * msec; @@ -107,32 +107,35 @@ void drivers_udma_busy_delay(uint32_t msec) } } -int32_t drivers_udma_cancel(uint32_t base, uint32_t channel) +int32_t sy1xx_udma_cancel(uint32_t base, uint32_t channel) { uint32_t channel_offset = channel == 0 ? 0x00 : 0x10; /* clear existing */ - UDMA_WRITE_REG(base, UDMA_CFG_REG + channel_offset, UDMA_CHANNEL_CFG_CLEAR); + SY1XX_UDMA_WRITE_REG(base, SY1XX_UDMA_CFG_REG + channel_offset, + SY1XX_UDMA_CHANNEL_CFG_CLEAR); return 0; } -int32_t drivers_udma_is_ready(uint32_t base, uint32_t channel) +int32_t sy1xx_udma_is_ready(uint32_t base, uint32_t channel) { uint32_t channel_offset = channel == 0 ? 0x00 : 0x10; - int32_t isBusy = UDMA_READ_REG(base, UDMA_CFG_REG + channel_offset) & (UDMA_CHANNEL_CFG_EN); + int32_t isBusy = SY1XX_UDMA_READ_REG(base, SY1XX_UDMA_CFG_REG + channel_offset) & + (SY1XX_UDMA_CHANNEL_CFG_EN); return isBusy ? 0 : 1; } -int32_t drivers_udma_wait_for_finished(uint32_t base, uint32_t channel) +int32_t sy1xx_udma_wait_for_finished(uint32_t base, uint32_t channel) { uint32_t channel_offset = channel == 0 ? 0x00 : 0x10; volatile uint32_t timeout = 200; - while (UDMA_READ_REG(base, UDMA_CFG_REG + channel_offset) & (UDMA_CHANNEL_CFG_EN)) { - drivers_udma_busy_delay(1); + while (SY1XX_UDMA_READ_REG(base, SY1XX_UDMA_CFG_REG + channel_offset) & + (SY1XX_UDMA_CHANNEL_CFG_EN)) { + sy1xx_udma_busy_delay(1); timeout--; if (timeout == 0) { return -1; @@ -142,13 +145,13 @@ int32_t drivers_udma_wait_for_finished(uint32_t base, uint32_t channel) return 0; } -int32_t drivers_udma_wait_for_status(uint32_t base) +int32_t sy1xx_udma_wait_for_status(uint32_t base) { volatile uint32_t timeout = 200; - while (UDMA_READ_REG(base, UDMA_STATUS) & (0x3)) { - drivers_udma_busy_delay(1); + while (SY1XX_UDMA_READ_REG(base, SY1XX_UDMA_STATUS) & (0x3)) { + sy1xx_udma_busy_delay(1); timeout--; if (timeout == 0) { return -1; @@ -158,23 +161,24 @@ int32_t drivers_udma_wait_for_status(uint32_t base) return 0; } -int32_t drivers_udma_start(uint32_t base, uint32_t channel, uint32_t saddr, uint32_t size, - uint32_t optional_cfg) +int32_t sy1xx_udma_start(uint32_t base, uint32_t channel, uint32_t saddr, uint32_t size, + uint32_t optional_cfg) { uint32_t channel_offset = channel == 0 ? 0x00 : 0x10; - UDMA_WRITE_REG(base, UDMA_SADDR_REG + channel_offset, saddr); - UDMA_WRITE_REG(base, UDMA_SIZE_REG + channel_offset, size); - UDMA_WRITE_REG(base, UDMA_CFG_REG + channel_offset, UDMA_CHANNEL_CFG_EN | optional_cfg); + SY1XX_UDMA_WRITE_REG(base, SY1XX_UDMA_SADDR_REG + channel_offset, saddr); + SY1XX_UDMA_WRITE_REG(base, SY1XX_UDMA_SIZE_REG + channel_offset, size); + SY1XX_UDMA_WRITE_REG(base, SY1XX_UDMA_CFG_REG + channel_offset, + SY1XX_UDMA_CHANNEL_CFG_EN | optional_cfg); return 0; } -int32_t drivers_udma_get_remaining(uint32_t base, uint32_t channel) +int32_t sy1xx_udma_get_remaining(uint32_t base, uint32_t channel) { uint32_t channel_offset = channel == 0 ? 0x00 : 0x10; - int32_t size = UDMA_READ_REG(base, UDMA_SIZE_REG + channel_offset); + int32_t size = SY1XX_UDMA_READ_REG(base, SY1XX_UDMA_SIZE_REG + channel_offset); return size; } diff --git a/soc/sensry/ganymed/sy1xx/common/udma.h b/soc/sensry/ganymed/sy1xx/common/udma.h index cbb36b172cc20..fff06de21745a 100644 --- a/soc/sensry/ganymed/sy1xx/common/udma.h +++ b/soc/sensry/ganymed/sy1xx/common/udma.h @@ -11,21 +11,20 @@ #include /* UDMA */ -#define ARCHI_UDMA_ADDR (ARCHI_SOC_PERIPHERALS_ADDR + ARCHI_UDMA_OFFSET) -#define UDMA_PERIPH_AREA_SIZE_LOG2 7 -#define UDMA_PERIPH_OFFSET(id) (((id) << UDMA_PERIPH_AREA_SIZE_LOG2)) +#define SY1XX_UDMA_PERIPH_AREA_SIZE_LOG2 7 +#define SY1XX_UDMA_PERIPH_OFFSET(id) (((id) << SY1XX_UDMA_PERIPH_AREA_SIZE_LOG2)) -#define ARCHI_UDMA_UART_ID(id) (0 + (id)) -#define ARCHI_UDMA_SPIM_ID(id) (3 + (id)) -#define ARCHI_UDMA_I2C_ID(id) (10 + (id)) -#define ARCHI_UDMA_I2S_ID(id) (14 + (id)) -#define ARCHI_UDMA_HYPER_ID(id) (19 + (id)) -#define ARCHI_UDMA_TSN_ID(id) (20 + (id)) +#define SY1XX_ARCHI_UDMA_UART_ID(id) (0 + (id)) +#define SY1XX_ARCHI_UDMA_SPIM_ID(id) (3 + (id)) +#define SY1XX_ARCHI_UDMA_I2C_ID(id) (10 + (id)) +#define SY1XX_ARCHI_UDMA_I2S_ID(id) (14 + (id)) +#define SY1XX_ARCHI_UDMA_HYPER_ID(id) (19 + (id)) +#define SY1XX_ARCHI_UDMA_TSN_ID(id) (20 + (id)) -#define UDMA_CHANNEL_RX_OFFSET 0x00 -#define UDMA_CHANNEL_TX_OFFSET 0x10 -#define UDMA_CHANNEL_CUSTOM_OFFSET 0x20 +#define SY1XX_UDMA_CHANNEL_RX_OFFSET 0x00 +#define SY1XX_UDMA_CHANNEL_TX_OFFSET 0x10 +#define SY1XX_UDMA_CHANNEL_CUSTOM_OFFSET 0x20 /* * For each channel, the RX and TX part have the following registers @@ -33,119 +32,119 @@ */ /* Start address register */ -#define UDMA_CHANNEL_SADDR_OFFSET 0x0 +#define SY1XX_UDMA_CHANNEL_SADDR_OFFSET 0x0 /* Size register */ -#define UDMA_CHANNEL_SIZE_OFFSET 0x4 +#define SY1XX_UDMA_CHANNEL_SIZE_OFFSET 0x4 /* Configuration register */ -#define UDMA_CHANNEL_CFG_OFFSET 0x8 +#define SY1XX_UDMA_CHANNEL_CFG_OFFSET 0x8 /* Int configuration register */ -#define UDMA_CHANNEL_INTCFG_OFFSET 0xC +#define SY1XX_UDMA_CHANNEL_INTCFG_OFFSET 0xC /* * The configuration register of the RX and TX parts for each channel can be accessed using the * following bits */ -#define UDMA_CHANNEL_CFG_SHADOW_BIT (5) -#define UDMA_CHANNEL_CFG_CLEAR_BIT (5) -#define UDMA_CHANNEL_CFG_EN_BIT (4) -#define UDMA_CHANNEL_CFG_SIZE_BIT (1) -#define UDMA_CHANNEL_CFG_CONT_BIT (0) +#define SY1XX_UDMA_CHANNEL_CFG_SHADOW_BIT (5) +#define SY1XX_UDMA_CHANNEL_CFG_CLEAR_BIT (5) +#define SY1XX_UDMA_CHANNEL_CFG_EN_BIT (4) +#define SY1XX_UDMA_CHANNEL_CFG_SIZE_BIT (1) +#define SY1XX_UDMA_CHANNEL_CFG_CONT_BIT (0) /* Indicates if a shadow transfer is there */ -#define UDMA_CHANNEL_CFG_SHADOW (1 << UDMA_CHANNEL_CFG_SHADOW_BIT) +#define SY1XX_UDMA_CHANNEL_CFG_SHADOW (1 << SY1XX_UDMA_CHANNEL_CFG_SHADOW_BIT) /* Stop and clear all pending transfers */ -#define UDMA_CHANNEL_CFG_CLEAR (1 << UDMA_CHANNEL_CFG_CLEAR_BIT) +#define SY1XX_UDMA_CHANNEL_CFG_CLEAR (1 << SY1XX_UDMA_CHANNEL_CFG_CLEAR_BIT) /* Start a transfer */ -#define UDMA_CHANNEL_CFG_EN (1 << UDMA_CHANNEL_CFG_EN_BIT) +#define SY1XX_UDMA_CHANNEL_CFG_EN (1 << SY1XX_UDMA_CHANNEL_CFG_EN_BIT) /* Configure for 8-bits transfer */ -#define UDMA_CHANNEL_CFG_SIZE_8 (0 << UDMA_CHANNEL_CFG_SIZE_BIT) +#define SY1XX_UDMA_CHANNEL_CFG_SIZE_8 (0 << SY1XX_UDMA_CHANNEL_CFG_SIZE_BIT) /* Configure for 16-bits transfer */ -#define UDMA_CHANNEL_CFG_SIZE_16 (1 << UDMA_CHANNEL_CFG_SIZE_BIT) +#define SY1XX_UDMA_CHANNEL_CFG_SIZE_16 (1 << SY1XX_UDMA_CHANNEL_CFG_SIZE_BIT) /* Configure for 32-bits transfer */ -#define UDMA_CHANNEL_CFG_SIZE_32 (2 << UDMA_CHANNEL_CFG_SIZE_BIT) +#define SY1XX_UDMA_CHANNEL_CFG_SIZE_32 (2 << SY1XX_UDMA_CHANNEL_CFG_SIZE_BIT) /* Configure for continuous mode */ -#define UDMA_CHANNEL_CFG_CONT (1 << UDMA_CHANNEL_CFG_CONT_BIT) +#define SY1XX_UDMA_CHANNEL_CFG_CONT (1 << SY1XX_UDMA_CHANNEL_CFG_CONT_BIT) /* Configuration area offset */ -#define UDMA_CONF_OFFSET 0xF80 +#define SY1XX_UDMA_CONF_OFFSET 0xF80 /* Clock-gating control register */ -#define UDMA_CONF_CG_OFFSET 0x00 +#define SY1XX_UDMA_CONF_CG_OFFSET 0x00 static inline void plp_udma_cg_set(unsigned int value) { - sys_write32(value, ARCHI_SOC_PERIPHERALS_ADDR + ARCHI_UDMA_OFFSET + UDMA_CONF_OFFSET + - UDMA_CONF_CG_OFFSET); + sys_write32(value, SY1XX_ARCHI_SOC_PERIPHERALS_ADDR + SY1XX_ARCHI_UDMA_OFFSET + + SY1XX_UDMA_CONF_OFFSET + SY1XX_UDMA_CONF_CG_OFFSET); } typedef enum { - DRIVERS_UDMA_UART, - DRIVERS_UDMA_I2C, - DRIVERS_UDMA_SPI, - DRIVERS_UDMA_MAC, - DRIVERS_MAX_UDMA_COUNT -} udma_module_t; - -void drivers_udma_enable_clock(udma_module_t module, uint32_t instance); -void drivers_udma_disable_clock(udma_module_t module, uint32_t instance); - -int32_t drivers_udma_cancel(uint32_t base, uint32_t channel); -int32_t drivers_udma_is_ready(uint32_t base, uint32_t channel); -int32_t drivers_udma_wait_for_finished(uint32_t base, uint32_t channel); -int32_t drivers_udma_wait_for_status(uint32_t base); -int32_t drivers_udma_start(uint32_t base, uint32_t channel, uint32_t saddr, uint32_t size, - uint32_t optional_cfg); -int32_t drivers_udma_get_remaining(uint32_t base, uint32_t channel); + SY1XX_UDMA_MODULE_UART, + SY1XX_UDMA_MODULE_I2C, + SY1XX_UDMA_MODULE_SPI, + SY1XX_UDMA_MODULE_MAC, + SY1XX_UDMA_MAX_MODULE_COUNT +} sy1xx_udma_module_t; + +void sy1xx_udma_enable_clock(sy1xx_udma_module_t module, uint32_t instance); +void sy1xx_drivers_udma_disable_clock(sy1xx_udma_module_t module, uint32_t instance); + +int32_t sy1xx_udma_cancel(uint32_t base, uint32_t channel); +int32_t sy1xx_udma_is_ready(uint32_t base, uint32_t channel); +int32_t sy1xx_udma_wait_for_finished(uint32_t base, uint32_t channel); +int32_t sy1xx_udma_wait_for_status(uint32_t base); +int32_t sy1xx_udma_start(uint32_t base, uint32_t channel, uint32_t saddr, uint32_t size, + uint32_t optional_cfg); +int32_t sy1xx_udma_get_remaining(uint32_t base, uint32_t channel); typedef enum { - UDMA_SADDR_REG = 0x00, - UDMA_SIZE_REG = 0x04, - UDMA_CFG_REG = 0x08, + SY1XX_UDMA_SADDR_REG = 0x00, + SY1XX_UDMA_SIZE_REG = 0x04, + SY1XX_UDMA_CFG_REG = 0x08, } udma_regs_t; typedef enum { - UDMA_RX_SADDR_REG = 0x00, - UDMA_RX_SIZE_REG = 0x04, - UDMA_RX_CFG_REG = 0x08, + SY1XX_UDMA_RX_SADDR_REG = 0x00, + SY1XX_UDMA_RX_SIZE_REG = 0x04, + SY1XX_UDMA_RX_CFG_REG = 0x08, - UDMA_TX_SADDR_REG = 0x10, - UDMA_TX_SIZE_REG = 0x14, - UDMA_TX_CFG_REG = 0x18, + SY1XX_UDMA_TX_SADDR_REG = 0x10, + SY1XX_UDMA_TX_SIZE_REG = 0x14, + SY1XX_UDMA_TX_CFG_REG = 0x18, - UDMA_STATUS = 0x20, - UDMA_SETUP_REG = 0x24, + SY1XX_UDMA_STATUS = 0x20, + SY1XX_UDMA_SETUP_REG = 0x24, } udma_reg_t; -#define UDMA_RX_DATA_ADDR_INC_SIZE_8 (0x0 << 1) -#define UDMA_RX_DATA_ADDR_INC_SIZE_16 (0x1 << 1) -#define UDMA_RX_DATA_ADDR_INC_SIZE_32 (0x2 << 1) +#define SY1XX_UDMA_RX_DATA_ADDR_INC_SIZE_8 (0x0 << 1) +#define SY1XX_UDMA_RX_DATA_ADDR_INC_SIZE_16 (0x1 << 1) +#define SY1XX_UDMA_RX_DATA_ADDR_INC_SIZE_32 (0x2 << 1) -#define UDMA_RX_CHANNEL 0 -#define UDMA_TX_CHANNEL 1 +#define SY1XX_UDMA_RX_CHANNEL 0 +#define SY1XX_UDMA_TX_CHANNEL 1 -#define UDMA_READ_REG(udma_base, reg) sys_read32(udma_base + reg) -#define UDMA_WRITE_REG(udma_base, reg, value) sys_write32(value, udma_base + reg) +#define SY1XX_UDMA_READ_REG(udma_base, reg) sys_read32(udma_base + reg) +#define SY1XX_UDMA_WRITE_REG(udma_base, reg, value) sys_write32(value, udma_base + reg) -#define UDMA_CANCEL_RX(udma_base) drivers_udma_cancel(udma_base, UDMA_RX_CHANNEL) -#define UDMA_CANCEL_TX(udma_base) drivers_udma_cancel(udma_base, UDMA_TX_CHANNEL) +#define SY1XX_UDMA_CANCEL_RX(udma_base) sy1xx_udma_cancel(udma_base, SY1XX_UDMA_RX_CHANNEL) +#define SY1XX_UDMA_CANCEL_TX(udma_base) sy1xx_udma_cancel(udma_base, SY1XX_UDMA_TX_CHANNEL) -#define UDMA_IS_FINISHED_RX(udma_base) drivers_udma_is_ready(udma_base, UDMA_RX_CHANNEL) -#define UDMA_IS_FINISHED_TX(udma_base) drivers_udma_is_ready(udma_base, UDMA_TX_CHANNEL) +#define SY1XX_UDMA_IS_FINISHED_RX(udma_base) sy1xx_udma_is_ready(udma_base, SY1XX_UDMA_RX_CHANNEL) +#define SY1XX_UDMA_IS_FINISHED_TX(udma_base) sy1xx_udma_is_ready(udma_base, SY1XX_UDMA_TX_CHANNEL) -#define UDMA_WAIT_FOR_FINISHED_RX(udma_base) \ - drivers_udma_wait_for_finished(udma_base, UDMA_RX_CHANNEL) -#define UDMA_WAIT_FOR_FINISHED_TX(udma_base) \ - drivers_udma_wait_for_finished(udma_base, UDMA_TX_CHANNEL) +#define SY1XX_UDMA_WAIT_FOR_FINISHED_RX(udma_base) \ + sy1xx_udma_wait_for_finished(udma_base, SY1XX_UDMA_RX_CHANNEL) +#define SY1XX_UDMA_WAIT_FOR_FINISHED_TX(udma_base) \ + sy1xx_udma_wait_for_finished(udma_base, SY1XX_UDMA_TX_CHANNEL) -#define UDMA_START_RX(base, addr, size, cfg) \ - drivers_udma_start(base, UDMA_RX_CHANNEL, addr, size, cfg) -#define UDMA_START_TX(base, addr, size, cfg) \ - drivers_udma_start(base, UDMA_TX_CHANNEL, addr, size, cfg) +#define SY1XX_UDMA_START_RX(base, addr, size, cfg) \ + sy1xx_udma_start(base, SY1XX_UDMA_RX_CHANNEL, addr, size, cfg) +#define SY1XX_UDMA_START_TX(base, addr, size, cfg) \ + sy1xx_udma_start(base, SY1XX_UDMA_TX_CHANNEL, addr, size, cfg) -#define UDMA_GET_REMAINING_RX(base) drivers_udma_get_remaining(base, UDMA_RX_CHANNEL) -#define UDMA_GET_REMAINING_TX(base) drivers_udma_get_remaining(base, UDMA_TX_CHANNEL) +#define SY1XX_UDMA_GET_REMAINING_RX(base) sy1xx_udma_get_remaining(base, SY1XX_UDMA_RX_CHANNEL) +#define SY1XX_UDMA_GET_REMAINING_TX(base) sy1xx_udma_get_remaining(base, SY1XX_UDMA_TX_CHANNEL) -#define UDMA_WAIT_FOR_STATUS_IDLE(udma_base) drivers_udma_wait_for_status(udma_base) +#define SY1XX_UDMA_WAIT_FOR_STATUS_IDLE(udma_base) sy1xx_udma_wait_for_status(udma_base) #endif /* GANYMED_SY1XX_UDMA_H */ From 42889628a95a70afd295191cb644dc3a3f2aeb48 Mon Sep 17 00:00:00 2001 From: Jan Kowalewski Date: Wed, 2 Oct 2024 12:32:17 +0200 Subject: [PATCH 2551/4482] drivers: i2c: Introduce I2C timeout for SAM0 Adds configurable timeout for I2C transactions for SAM0 SoCs. Signed-off-by: Jan Kowalewski --- drivers/i2c/Kconfig.sam0 | 8 ++++++++ drivers/i2c/i2c_sam0.c | 13 ++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/Kconfig.sam0 b/drivers/i2c/Kconfig.sam0 index c7c62e0d95489..2096dbf4627b0 100644 --- a/drivers/i2c/Kconfig.sam0 +++ b/drivers/i2c/Kconfig.sam0 @@ -18,3 +18,11 @@ config I2C_SAM0_DMA_DRIVEN DMA driven mode requires fewer interrupts to handle the transaction and ensures that high speed modes are not delayed by data reloading. + +config I2C_SAM0_TRANSFER_TIMEOUT + int "Transfer timeout [ms]" + default 500 + help + Timeout in milliseconds used for each I2C transfer. + 0 means that the driver should use the K_FOREVER value, + i.e. it should wait as long as necessary. diff --git a/drivers/i2c/i2c_sam0.c b/drivers/i2c/i2c_sam0.c index 9c9c5350cf369..ff0b6c67fb652 100644 --- a/drivers/i2c/i2c_sam0.c +++ b/drivers/i2c/i2c_sam0.c @@ -24,6 +24,12 @@ LOG_MODULE_REGISTER(i2c_sam0, CONFIG_I2C_LOG_LEVEL); #define SERCOM_I2CM_CTRLA_MODE_I2C_MASTER SERCOM_I2CM_CTRLA_MODE(5) #endif +#if CONFIG_I2C_SAM0_TRANSFER_TIMEOUT +#define I2C_TRANSFER_TIMEOUT_MSEC K_MSEC(CONFIG_I2C_SAM0_TRANSFER_TIMEOUT) +#else +#define I2C_TRANSFER_TIMEOUT_MSEC K_FOREVER +#endif + struct i2c_sam0_dev_config { SercomI2cm *regs; const struct pinctrl_dev_config *pcfg; @@ -504,7 +510,12 @@ static int i2c_sam0_transfer(const struct device *dev, struct i2c_msg *msgs, irq_unlock(key); /* Now wait for the ISR to handle everything */ - k_sem_take(&data->sem, K_FOREVER); + ret = k_sem_take(&data->sem, I2C_TRANSFER_TIMEOUT_MSEC); + + if (ret != 0) { + ret = -EIO; + goto unlock; + } if (data->msg.status) { if (data->msg.status & SERCOM_I2CM_STATUS_ARBLOST) { From fc8d9425c1e44df03903026e4e7f92dbbdf5b4f7 Mon Sep 17 00:00:00 2001 From: Olivier Lesage Date: Fri, 25 Oct 2024 14:50:17 +0200 Subject: [PATCH 2552/4482] bluetooth: samples: Add samples showing basic channel sounding features These samples demonstrate how to use the bluetooth 6.0 channel sounding APIs. A basic distance estimation algorithm is included. Signed-off-by: Olivier Lesage --- samples/bluetooth/channel_sounding/README.rst | 133 +++++++ .../connected_cs/initiator/CMakeLists.txt | 11 + .../connected_cs/initiator/prj.conf | 16 + .../connected_cs/initiator/sample.yaml | 11 + .../connected_cs/reflector/CMakeLists.txt | 11 + .../connected_cs/reflector/prj.conf | 14 + .../connected_cs/reflector/sample.yaml | 11 + .../cs_test/initiator/CMakeLists.txt | 11 + .../cs_test/initiator/prj.conf | 15 + .../cs_test/initiator/sample.yaml | 11 + .../cs_test/reflector/CMakeLists.txt | 11 + .../cs_test/reflector/prj.conf | 13 + .../cs_test/reflector/sample.yaml | 11 + .../channel_sounding/include/common.h | 15 + .../channel_sounding/include/cs_test_params.h | 58 +++ .../include/distance_estimation.h | 11 + .../src/connected_cs_initiator.c | 356 ++++++++++++++++++ .../src/connected_cs_reflector.c | 248 ++++++++++++ .../channel_sounding/src/cs_test_initiator.c | 276 ++++++++++++++ .../channel_sounding/src/cs_test_reflector.c | 247 ++++++++++++ .../src/distance_estimation.c | 304 +++++++++++++++ 21 files changed, 1794 insertions(+) create mode 100644 samples/bluetooth/channel_sounding/README.rst create mode 100644 samples/bluetooth/channel_sounding/connected_cs/initiator/CMakeLists.txt create mode 100644 samples/bluetooth/channel_sounding/connected_cs/initiator/prj.conf create mode 100644 samples/bluetooth/channel_sounding/connected_cs/initiator/sample.yaml create mode 100644 samples/bluetooth/channel_sounding/connected_cs/reflector/CMakeLists.txt create mode 100644 samples/bluetooth/channel_sounding/connected_cs/reflector/prj.conf create mode 100644 samples/bluetooth/channel_sounding/connected_cs/reflector/sample.yaml create mode 100644 samples/bluetooth/channel_sounding/cs_test/initiator/CMakeLists.txt create mode 100644 samples/bluetooth/channel_sounding/cs_test/initiator/prj.conf create mode 100644 samples/bluetooth/channel_sounding/cs_test/initiator/sample.yaml create mode 100644 samples/bluetooth/channel_sounding/cs_test/reflector/CMakeLists.txt create mode 100644 samples/bluetooth/channel_sounding/cs_test/reflector/prj.conf create mode 100644 samples/bluetooth/channel_sounding/cs_test/reflector/sample.yaml create mode 100644 samples/bluetooth/channel_sounding/include/common.h create mode 100644 samples/bluetooth/channel_sounding/include/cs_test_params.h create mode 100644 samples/bluetooth/channel_sounding/include/distance_estimation.h create mode 100644 samples/bluetooth/channel_sounding/src/connected_cs_initiator.c create mode 100644 samples/bluetooth/channel_sounding/src/connected_cs_reflector.c create mode 100644 samples/bluetooth/channel_sounding/src/cs_test_initiator.c create mode 100644 samples/bluetooth/channel_sounding/src/cs_test_reflector.c create mode 100644 samples/bluetooth/channel_sounding/src/distance_estimation.c diff --git a/samples/bluetooth/channel_sounding/README.rst b/samples/bluetooth/channel_sounding/README.rst new file mode 100644 index 0000000000000..8f94a00b78cf7 --- /dev/null +++ b/samples/bluetooth/channel_sounding/README.rst @@ -0,0 +1,133 @@ +.. zephyr:code-sample:: ble_cs + :name: Channel Sounding + :relevant-api: bt_gap bluetooth + + Use Channel Sounding functionality. + +Overview +******** + +These samples demonstrates how to use the Bluetooth Channel Sounding feature. + +The CS Test sample shows how to us the CS test command to override randomization of certain channel +sounding parameters, experiment with different configurations, or evaluate the RF medium. It can +be found under :zephyr_file:`samples/bluetooth/channel_sounding/cs_test`. + +The connected CS sample shows how to set up regular channel sounding procedures on a connection +between two devices. +It can be found under :zephyr_file:`samples/bluetooth/channel_sounding/connected_cs` + +A basic distance estimation algorithm is included in both. +The Channel Sounding feature does not mandate a specific algorithm for computing distance estimates, +but the mathematical representation described in [#phase_and_amplitude]_ and [#rtt_packets]_ is used +as a starting point for these samples. + +Distance estimation using channel sounding requires data from two devices, and for that reason +the channel sounding results in the sample are exchanged in a simple way using a GATT characteristic. +This limits the amount of data that can be processed at once to about 512 bytes from each device, +which is enough to estimate distance using a handful of RTT timings and PBR phase samples across +about 35-40 channels, assuming a single antenna path. + +Both samples will perform channel sounding procedures repeatedly and print regular distance estimates to +the console. They are designed assuming a single subevent per procedure. + +Diagrams illustrating the steps involved in setting up channel sounding procedures between two +connected devices are available in [#cs_setup_phase]_ and [#cs_start]_. + +Requirements +************ + +* Two boards with Bluetooth LE and Channel Sounding support (such as an :ref:`nRF54L15 `) +* A controller that supports the Channel Sounding feature + +Building and Running +******************** + +These samples can be found under :zephyr_file:`samples/bluetooth/channel_sounding` in +the Zephyr tree. + +See :zephyr:code-sample-category:`bluetooth` samples for details. + +These sample use two applications, so two devices need to be setup. +Flash one device with the initiator application, and another device with the +reflector application. + +The devices should perform distance estimations repeatedly every few seconds if they are close enough. + +Here is an example output from the connected CS sample: + +Reflector: + +.. code-block:: console + + *** Using Zephyr OS v3.7.99-585fbd2e318c *** + Starting Channel Sounding Demo + Connected to EC:E7:DB:66:14:86 (random) (err 0x00) + MTU exchange success (247) + Discovery: attr 0x20006a2c + UUID 87654321-4567-2389-1254-f67f9fedcba8 + Found expected UUID + CS capability exchange completed. + CS config creation complete. ID: 0 + CS security enabled. + CS procedures enabled. + + +Initiator: + +.. code-block:: console + + *** Using Zephyr OS v3.7.99-585fbd2e318c *** + Starting Channel Sounding Demo + Found device with name CS Sample, connecting... + Connected to C7:78:79:CD:16:B9 (random) (err 0x00) + MTU exchange success (247) + CS capability exchange completed. + CS config creation complete. ID: 0 + CS security enabled. + CS procedures enabled. + Estimated distance to reflector: + - Round-Trip Timing method: 2.633891 meters (derived from 7 samples) + - Phase-Based Ranging method: 0.511853 meters (derived from 38 samples) + + +Here is an example output from the CS Test sample: + +Reflector: + +.. code-block:: console + + *** Using Zephyr OS v3.7.99-585fbd2e318c *** + Starting Channel Sounding Demo + Connected to C7:78:79:CD:16:B9 (random) (err 0x00) + MTU exchange success (247) + Discovery: attr 0x20006544 + UUID 87654321-4567-2389-1254-f67f9fedcba8 + Found expected UUID + Disconnected (reason 0x13) + Re-running CS test... + + +Initiator: + +.. code-block:: console + + *** Using Zephyr OS v3.7.99-585fbd2e318c *** + Starting Channel Sounding Demo + Found device with name CS Test Sample, connecting... + Connected to EC:E7:DB:66:14:86 (random) (err 0x00) + MTU exchange success (247) + Estimated distance to reflector: + - Round-Trip Timing method: 0.374741 meters (derived from 4 samples) + - Phase-Based Ranging method: 0.588290 meters (derived from 35 samples) + Disconnected (reason 0x16) + Re-running CS test... + + +References +********** + +.. [#phase_and_amplitude] `Bluetooth Core Specification v. 6.0: Vol. 1, Part A, 9.2 `_ +.. [#rtt_packets] `Bluetooth Core Specification v. 6.0: Vol. 1, Part A, 9.3 `_ +.. [#cs_setup_phase] `Bluetooth Core Specification v. 6.0: Vol. 6, Part D, 6.34 `_ +.. [#cs_start] `Bluetooth Core Specification v. 6.0: Vol. 6, Part D, 6.35 `_ diff --git a/samples/bluetooth/channel_sounding/connected_cs/initiator/CMakeLists.txt b/samples/bluetooth/channel_sounding/connected_cs/initiator/CMakeLists.txt new file mode 100644 index 0000000000000..f64168ed87488 --- /dev/null +++ b/samples/bluetooth/channel_sounding/connected_cs/initiator/CMakeLists.txt @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(connected_cs_initiator) + +target_sources(app PRIVATE ../../src/connected_cs_initiator.c ../../src/distance_estimation.c) + +zephyr_library_include_directories( + ${CMAKE_CURRENT_LIST_DIR}/../../include +) diff --git a/samples/bluetooth/channel_sounding/connected_cs/initiator/prj.conf b/samples/bluetooth/channel_sounding/connected_cs/initiator/prj.conf new file mode 100644 index 0000000000000..2ed92de59e86c --- /dev/null +++ b/samples/bluetooth/channel_sounding/connected_cs/initiator/prj.conf @@ -0,0 +1,16 @@ +CONFIG_BT=y +CONFIG_BT_SMP=y +CONFIG_BT_CENTRAL=y +CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n +CONFIG_BT_GATT_CLIENT=y +CONFIG_BT_GATT_DYNAMIC_DB=y +CONFIG_BT_ATT_PREPARE_COUNT=3 +CONFIG_BT_CHANNEL_SOUNDING=y + +CONFIG_BT_BUF_ACL_RX_SIZE=251 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_L2CAP_TX_MTU=247 + +CONFIG_MAIN_STACK_SIZE=4096 + +CONFIG_CBPRINTF_FP_SUPPORT=y diff --git a/samples/bluetooth/channel_sounding/connected_cs/initiator/sample.yaml b/samples/bluetooth/channel_sounding/connected_cs/initiator/sample.yaml new file mode 100644 index 0000000000000..05e0a484345c4 --- /dev/null +++ b/samples/bluetooth/channel_sounding/connected_cs/initiator/sample.yaml @@ -0,0 +1,11 @@ +sample: + name: Bluetooth Channel Sounding - Initiator +tests: + sample.bluetooth.channel_sounding.connected_cs.initiator: + harness: bluetooth + platform_allow: + - qemu_cortex_m3 + - qemu_x86 + tags: bluetooth + integration_platforms: + - qemu_cortex_m3 diff --git a/samples/bluetooth/channel_sounding/connected_cs/reflector/CMakeLists.txt b/samples/bluetooth/channel_sounding/connected_cs/reflector/CMakeLists.txt new file mode 100644 index 0000000000000..6d455df7733ef --- /dev/null +++ b/samples/bluetooth/channel_sounding/connected_cs/reflector/CMakeLists.txt @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(connected_cs_reflector) + +target_sources(app PRIVATE ../../src/connected_cs_reflector.c ../../src/distance_estimation.c) + +zephyr_library_include_directories( + ${CMAKE_CURRENT_LIST_DIR}/../../include +) diff --git a/samples/bluetooth/channel_sounding/connected_cs/reflector/prj.conf b/samples/bluetooth/channel_sounding/connected_cs/reflector/prj.conf new file mode 100644 index 0000000000000..016d0de98c2b2 --- /dev/null +++ b/samples/bluetooth/channel_sounding/connected_cs/reflector/prj.conf @@ -0,0 +1,14 @@ +CONFIG_BT=y +CONFIG_BT_SMP=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n +CONFIG_BT_GATT_CLIENT=y +CONFIG_BT_CHANNEL_SOUNDING=y + +CONFIG_BT_BUF_ACL_RX_SIZE=251 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_L2CAP_TX_MTU=247 + +CONFIG_MAIN_STACK_SIZE=4096 + +CONFIG_CBPRINTF_FP_SUPPORT=y diff --git a/samples/bluetooth/channel_sounding/connected_cs/reflector/sample.yaml b/samples/bluetooth/channel_sounding/connected_cs/reflector/sample.yaml new file mode 100644 index 0000000000000..5495b7ba545c8 --- /dev/null +++ b/samples/bluetooth/channel_sounding/connected_cs/reflector/sample.yaml @@ -0,0 +1,11 @@ +sample: + name: Bluetooth Channel Sounding - Reflector +tests: + sample.bluetooth.channel_sounding.connected_cs.reflector: + harness: bluetooth + platform_allow: + - qemu_cortex_m3 + - qemu_x86 + tags: bluetooth + integration_platforms: + - qemu_cortex_m3 diff --git a/samples/bluetooth/channel_sounding/cs_test/initiator/CMakeLists.txt b/samples/bluetooth/channel_sounding/cs_test/initiator/CMakeLists.txt new file mode 100644 index 0000000000000..6053ffaf4b953 --- /dev/null +++ b/samples/bluetooth/channel_sounding/cs_test/initiator/CMakeLists.txt @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(cs_test_initiator) + +target_sources(app PRIVATE ../../src/cs_test_initiator.c ../../src/distance_estimation.c) + +zephyr_library_include_directories( + ${CMAKE_CURRENT_LIST_DIR}/../../include +) diff --git a/samples/bluetooth/channel_sounding/cs_test/initiator/prj.conf b/samples/bluetooth/channel_sounding/cs_test/initiator/prj.conf new file mode 100644 index 0000000000000..1e1e8d3c99da1 --- /dev/null +++ b/samples/bluetooth/channel_sounding/cs_test/initiator/prj.conf @@ -0,0 +1,15 @@ +CONFIG_BT=y +CONFIG_BT_CENTRAL=y +CONFIG_BT_GATT_CLIENT=y +CONFIG_BT_GATT_DYNAMIC_DB=y +CONFIG_BT_ATT_PREPARE_COUNT=3 +CONFIG_BT_CHANNEL_SOUNDING=y +CONFIG_BT_CHANNEL_SOUNDING_TEST=y + +CONFIG_BT_BUF_ACL_RX_SIZE=251 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_L2CAP_TX_MTU=247 + +CONFIG_MAIN_STACK_SIZE=4096 + +CONFIG_CBPRINTF_FP_SUPPORT=y diff --git a/samples/bluetooth/channel_sounding/cs_test/initiator/sample.yaml b/samples/bluetooth/channel_sounding/cs_test/initiator/sample.yaml new file mode 100644 index 0000000000000..71d5ee81d63e2 --- /dev/null +++ b/samples/bluetooth/channel_sounding/cs_test/initiator/sample.yaml @@ -0,0 +1,11 @@ +sample: + name: Bluetooth Channel Sounding Test - Initiator +tests: + sample.bluetooth.channel_sounding.cs_test.initiator: + harness: bluetooth + platform_allow: + - qemu_cortex_m3 + - qemu_x86 + tags: bluetooth + integration_platforms: + - qemu_cortex_m3 diff --git a/samples/bluetooth/channel_sounding/cs_test/reflector/CMakeLists.txt b/samples/bluetooth/channel_sounding/cs_test/reflector/CMakeLists.txt new file mode 100644 index 0000000000000..67304f165972c --- /dev/null +++ b/samples/bluetooth/channel_sounding/cs_test/reflector/CMakeLists.txt @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(cs_test_reflector) + +target_sources(app PRIVATE ../../src/cs_test_reflector.c ../../src/distance_estimation.c) + +zephyr_library_include_directories( + ${CMAKE_CURRENT_LIST_DIR}/../../include +) diff --git a/samples/bluetooth/channel_sounding/cs_test/reflector/prj.conf b/samples/bluetooth/channel_sounding/cs_test/reflector/prj.conf new file mode 100644 index 0000000000000..37c3d79685f7c --- /dev/null +++ b/samples/bluetooth/channel_sounding/cs_test/reflector/prj.conf @@ -0,0 +1,13 @@ +CONFIG_BT=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_GATT_CLIENT=y +CONFIG_BT_CHANNEL_SOUNDING=y +CONFIG_BT_CHANNEL_SOUNDING_TEST=y + +CONFIG_BT_BUF_ACL_RX_SIZE=251 +CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_L2CAP_TX_MTU=247 + +CONFIG_MAIN_STACK_SIZE=4096 + +CONFIG_CBPRINTF_FP_SUPPORT=y diff --git a/samples/bluetooth/channel_sounding/cs_test/reflector/sample.yaml b/samples/bluetooth/channel_sounding/cs_test/reflector/sample.yaml new file mode 100644 index 0000000000000..ee0933a9e337c --- /dev/null +++ b/samples/bluetooth/channel_sounding/cs_test/reflector/sample.yaml @@ -0,0 +1,11 @@ +sample: + name: Bluetooth Channel Sounding Test - Reflector +tests: + sample.bluetooth.channel_sounding.cs_test.reflector: + harness: bluetooth + platform_allow: + - qemu_cortex_m3 + - qemu_x86 + tags: bluetooth + integration_platforms: + - qemu_cortex_m3 diff --git a/samples/bluetooth/channel_sounding/include/common.h b/samples/bluetooth/channel_sounding/include/common.h new file mode 100644 index 0000000000000..940dd76a19ee9 --- /dev/null +++ b/samples/bluetooth/channel_sounding/include/common.h @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#define NAME_LEN 30 +#define STEP_DATA_BUF_LEN 512 /* Maximum GATT characteristic length */ + +static struct bt_uuid_128 step_data_char_uuid = + BT_UUID_INIT_128(BT_UUID_128_ENCODE(0x87654321, 0x4567, 0x2389, 0x1254, 0xf67f9fedcba8)); +static const struct bt_uuid_128 step_data_svc_uuid = + BT_UUID_INIT_128(BT_UUID_128_ENCODE(0x87654321, 0x4567, 0x2389, 0x1254, 0xf67f9fedcba9)); diff --git a/samples/bluetooth/channel_sounding/include/cs_test_params.h b/samples/bluetooth/channel_sounding/include/cs_test_params.h new file mode 100644 index 0000000000000..dc141167b98c8 --- /dev/null +++ b/samples/bluetooth/channel_sounding/include/cs_test_params.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#define INITIATOR_ACCESS_ADDRESS 0x4D7B8A2F +#define REFLECTOR_ACCESS_ADDRESS 0x96F93DB1 +#define NUM_MODE_0_STEPS 3 + +static struct bt_le_cs_test_param test_params_get(enum bt_conn_le_cs_role role) +{ + struct bt_le_cs_test_param params; + + params.role = role; + params.main_mode = BT_CONN_LE_CS_MAIN_MODE_2; + params.sub_mode = BT_CONN_LE_CS_SUB_MODE_1; + params.main_mode_repetition = 1; + params.mode_0_steps = NUM_MODE_0_STEPS; + params.rtt_type = BT_CONN_LE_CS_RTT_TYPE_AA_ONLY; + params.cs_sync_phy = BT_CONN_LE_CS_SYNC_1M_PHY; + params.cs_sync_antenna_selection = BT_LE_CS_TEST_CS_SYNC_ANTENNA_SELECTION_ONE; + params.subevent_len = 5000; + params.subevent_interval = 0; + params.max_num_subevents = 1; + params.transmit_power_level = BT_HCI_OP_LE_CS_TEST_MAXIMIZE_TX_POWER; + params.t_ip1_time = 145; + params.t_ip2_time = 145; + params.t_fcs_time = 150; + params.t_pm_time = 40; + params.t_sw_time = 0; + params.tone_antenna_config_selection = BT_LE_CS_TONE_ANTENNA_CONFIGURATION_INDEX_ONE; + + params.initiator_snr_control = BT_LE_CS_INITIATOR_SNR_CONTROL_NOT_USED; + params.reflector_snr_control = BT_LE_CS_REFLECTOR_SNR_CONTROL_NOT_USED; + + params.drbg_nonce = 0x1234; + + params.override_config = BIT(2) | BIT(5); + params.override_config_0.channel_map_repetition = 1; + + memset(params.override_config_0.not_set.channel_map, 0, 10); + + for (uint8_t i = 40; i < 75; i++) { + BT_LE_CS_CHANNEL_BIT_SET_VAL(params.override_config_0.not_set.channel_map, i, 1); + } + + params.override_config_0.not_set.channel_selection_type = BT_CONN_LE_CS_CHSEL_TYPE_3B; + params.override_config_0.not_set.ch3c_shape = BT_CONN_LE_CS_CH3C_SHAPE_HAT; + params.override_config_0.not_set.ch3c_jump = 2; + params.override_config_2.main_mode_steps = 8; + params.override_config_5.cs_sync_aa_initiator = INITIATOR_ACCESS_ADDRESS; + params.override_config_5.cs_sync_aa_reflector = REFLECTOR_ACCESS_ADDRESS; + + return params; +} diff --git a/samples/bluetooth/channel_sounding/include/distance_estimation.h b/samples/bluetooth/channel_sounding/include/distance_estimation.h new file mode 100644 index 0000000000000..56f67f85736f6 --- /dev/null +++ b/samples/bluetooth/channel_sounding/include/distance_estimation.h @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +void estimate_distance(uint8_t *local_steps, uint16_t local_steps_len, uint8_t *peer_steps, + uint16_t peer_steps_len, uint8_t n_ap, enum bt_conn_le_cs_role role); diff --git a/samples/bluetooth/channel_sounding/src/connected_cs_initiator.c b/samples/bluetooth/channel_sounding/src/connected_cs_initiator.c new file mode 100644 index 0000000000000..a6fb5c2ce88b7 --- /dev/null +++ b/samples/bluetooth/channel_sounding/src/connected_cs_initiator.c @@ -0,0 +1,356 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include "distance_estimation.h" +#include "common.h" + +#define CS_CONFIG_ID 0 +#define NUM_MODE_0_STEPS 1 + +static K_SEM_DEFINE(sem_remote_capabilities_obtained, 0, 1); +static K_SEM_DEFINE(sem_config_created, 0, 1); +static K_SEM_DEFINE(sem_cs_security_enabled, 0, 1); +static K_SEM_DEFINE(sem_procedure_done, 0, 1); +static K_SEM_DEFINE(sem_connected, 0, 1); +static K_SEM_DEFINE(sem_data_received, 0, 1); + +static ssize_t on_attr_write_cb(struct bt_conn *conn, const struct bt_gatt_attr *attr, + const void *buf, uint16_t len, uint16_t offset, uint8_t flags); +static struct bt_conn *connection; +static uint8_t n_ap; +static uint8_t latest_num_steps_reported; +static uint16_t latest_step_data_len; +static uint8_t latest_local_steps[STEP_DATA_BUF_LEN]; +static uint8_t latest_peer_steps[STEP_DATA_BUF_LEN]; + +static struct bt_gatt_attr gatt_attributes[] = { + BT_GATT_PRIMARY_SERVICE(&step_data_svc_uuid), + BT_GATT_CHARACTERISTIC(&step_data_char_uuid.uuid, BT_GATT_CHRC_WRITE, + BT_GATT_PERM_WRITE | BT_GATT_PERM_PREPARE_WRITE, NULL, + on_attr_write_cb, NULL), +}; +static struct bt_gatt_service step_data_gatt_service = BT_GATT_SERVICE(gatt_attributes); +static const char sample_str[] = "CS Sample"; + +static ssize_t on_attr_write_cb(struct bt_conn *conn, const struct bt_gatt_attr *attr, + const void *buf, uint16_t len, uint16_t offset, uint8_t flags) +{ + if (flags & BT_GATT_WRITE_FLAG_PREPARE) { + return 0; + } + + if (offset) { + return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); + } + + if (len != sizeof(latest_local_steps)) { + return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); + } + + if (flags & BT_GATT_WRITE_FLAG_EXECUTE) { + uint8_t *data = (uint8_t *)buf; + + memcpy(latest_peer_steps, &data[offset], len); + k_sem_give(&sem_data_received); + } + + return len; +} + +static void subevent_result_cb(struct bt_conn *conn, struct bt_conn_le_cs_subevent_result *result) +{ + latest_num_steps_reported = result->header.num_steps_reported; + n_ap = result->header.num_antenna_paths; + + if (result->step_data_buf) { + if (result->step_data_buf->len <= STEP_DATA_BUF_LEN) { + memcpy(latest_local_steps, result->step_data_buf->data, + result->step_data_buf->len); + latest_step_data_len = result->step_data_buf->len; + } else { + printk("Not enough memory to store step data. (%d > %d)\n", + result->step_data_buf->len, STEP_DATA_BUF_LEN); + latest_num_steps_reported = 0; + } + } + + if (result->header.procedure_done_status == BT_CONN_LE_CS_PROCEDURE_COMPLETE) { + k_sem_give(&sem_procedure_done); + } +} + +static void mtu_exchange_cb(struct bt_conn *conn, uint8_t err, + struct bt_gatt_exchange_params *params) +{ + printk("MTU exchange %s (%u)\n", err == 0U ? "success" : "failed", bt_gatt_get_mtu(conn)); +} + +static void connected_cb(struct bt_conn *conn, uint8_t err) +{ + char addr[BT_ADDR_LE_STR_LEN]; + + (void)bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); + printk("Connected to %s (err 0x%02X)\n", addr, err); + + __ASSERT(connection == conn, "Unexpected connected callback"); + + if (err) { + bt_conn_unref(conn); + connection = NULL; + } + + static struct bt_gatt_exchange_params mtu_exchange_params = {.func = mtu_exchange_cb}; + + err = bt_gatt_exchange_mtu(connection, &mtu_exchange_params); + if (err) { + printk("%s: MTU exchange failed (err %d)\n", __func__, err); + } + + k_sem_give(&sem_connected); +} + +static void disconnected_cb(struct bt_conn *conn, uint8_t reason) +{ + printk("Disconnected (reason 0x%02X)\n", reason); + + bt_conn_unref(conn); + connection = NULL; +} + +static void remote_capabilities_cb(struct bt_conn *conn, struct bt_conn_le_cs_capabilities *params) +{ + ARG_UNUSED(params); + printk("CS capability exchange completed.\n"); + k_sem_give(&sem_remote_capabilities_obtained); +} + +static void config_created_cb(struct bt_conn *conn, struct bt_conn_le_cs_config *config) +{ + printk("CS config creation complete. ID: %d\n", config->id); + k_sem_give(&sem_config_created); +} + +static void security_enabled_cb(struct bt_conn *conn) +{ + printk("CS security enabled.\n"); + k_sem_give(&sem_cs_security_enabled); +} + +static void procedure_enabled_cb(struct bt_conn *conn, + struct bt_conn_le_cs_procedure_enable_complete *params) +{ + if (params->state == 1) { + printk("CS procedures enabled.\n"); + } else { + printk("CS procedures disabled.\n"); + } +} + +static bool data_cb(struct bt_data *data, void *user_data) +{ + char *name = user_data; + uint8_t len; + + switch (data->type) { + case BT_DATA_NAME_SHORTENED: + case BT_DATA_NAME_COMPLETE: + len = MIN(data->data_len, NAME_LEN - 1); + memcpy(name, data->data, len); + name[len] = '\0'; + return false; + default: + return true; + } +} + +static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, + struct net_buf_simple *ad) +{ + char addr_str[BT_ADDR_LE_STR_LEN]; + char name[NAME_LEN] = {}; + int err; + + if (connection) { + return; + } + + /* We're only interested in connectable events */ + if (type != BT_GAP_ADV_TYPE_ADV_IND && type != BT_GAP_ADV_TYPE_ADV_DIRECT_IND) { + return; + } + + bt_data_parse(ad, data_cb, name); + + if (strcmp(name, sample_str)) { + return; + } + + if (bt_le_scan_stop()) { + return; + } + + printk("Found device with name %s, connecting...\n", name); + + err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, BT_LE_CONN_PARAM_DEFAULT, + &connection); + if (err) { + printk("Create conn to %s failed (%u)\n", addr_str, err); + } +} + +BT_CONN_CB_DEFINE(conn_cb) = { + .connected = connected_cb, + .disconnected = disconnected_cb, + .le_cs_remote_capabilities_available = remote_capabilities_cb, + .le_cs_config_created = config_created_cb, + .le_cs_security_enabled = security_enabled_cb, + .le_cs_procedure_enabled = procedure_enabled_cb, + .le_cs_subevent_data_available = subevent_result_cb, +}; + +int main(void) +{ + int err; + + printk("Starting Channel Sounding Demo\n"); + + /* Initialize the Bluetooth Subsystem */ + err = bt_enable(NULL); + if (err) { + printk("Bluetooth init failed (err %d)\n", err); + return 0; + } + + err = bt_gatt_service_register(&step_data_gatt_service); + if (err) { + printk("bt_gatt_service_register() returned err %d\n", err); + return 0; + } + + err = bt_le_scan_start(BT_LE_SCAN_ACTIVE_CONTINUOUS, device_found); + if (err) { + printk("Scanning failed to start (err %d)\n", err); + return 0; + } + + k_sem_take(&sem_connected, K_FOREVER); + + const struct bt_le_cs_set_default_settings_param default_settings = { + .enable_initiator_role = true, + .enable_reflector_role = false, + .cs_sync_antenna_selection = BT_LE_CS_ANTENNA_SELECTION_OPT_REPETITIVE, + .max_tx_power = BT_HCI_OP_LE_CS_MAX_MAX_TX_POWER, + }; + + err = bt_le_cs_set_default_settings(connection, &default_settings); + if (err) { + printk("Failed to configure default CS settings (err %d)\n", err); + } + + err = bt_conn_set_security(connection, BT_SECURITY_L2); + if (err) { + printk("Failed to encrypt connection (err %d)\n", err); + return 0; + } + + err = bt_le_cs_read_remote_supported_capabilities(connection); + if (err) { + printk("Failed to exchange CS capabilities (err %d)\n", err); + return 0; + } + + k_sem_take(&sem_remote_capabilities_obtained, K_FOREVER); + + struct bt_le_cs_create_config_params config_params = { + .id = CS_CONFIG_ID, + .main_mode_type = BT_CONN_LE_CS_MAIN_MODE_2, + .sub_mode_type = BT_CONN_LE_CS_SUB_MODE_1, + .min_main_mode_steps = 2, + .max_main_mode_steps = 10, + .main_mode_repetition = 0, + .mode_0_steps = NUM_MODE_0_STEPS, + .role = BT_CONN_LE_CS_ROLE_INITIATOR, + .rtt_type = BT_CONN_LE_CS_RTT_TYPE_AA_ONLY, + .cs_sync_phy = BT_CONN_LE_CS_SYNC_1M_PHY, + .channel_map_repetition = 1, + .channel_selection_type = BT_CONN_LE_CS_CHSEL_TYPE_3B, + .ch3c_shape = BT_CONN_LE_CS_CH3C_SHAPE_HAT, + .ch3c_jump = 2, + }; + + bt_le_cs_set_valid_chmap_bits(config_params.channel_map); + + err = bt_le_cs_create_config(connection, &config_params, + BT_LE_CS_CREATE_CONFIG_CONTEXT_LOCAL_AND_REMOTE); + if (err) { + printk("Failed to create CS config (err %d)\n", err); + return 0; + } + + k_sem_take(&sem_config_created, K_FOREVER); + + err = bt_le_cs_security_enable(connection); + if (err) { + printk("Failed to start CS Security (err %d)\n", err); + return 0; + } + + k_sem_take(&sem_cs_security_enabled, K_FOREVER); + + const struct bt_le_cs_set_procedure_parameters_param procedure_params = { + .config_id = CS_CONFIG_ID, + .max_procedure_len = 12, + .min_procedure_interval = 100, + .max_procedure_interval = 100, + .max_procedure_count = 0, + .min_subevent_len = 6750, + .max_subevent_len = 6750, + .tone_antenna_config_selection = BT_LE_CS_TONE_ANTENNA_CONFIGURATION_INDEX_ONE, + .phy = BT_LE_CS_PROCEDURE_PHY_1M, + .tx_power_delta = 0x80, + .preferred_peer_antenna = BT_LE_CS_PROCEDURE_PREFERRED_PEER_ANTENNA_1, + .snr_control_initiator = BT_LE_CS_INITIATOR_SNR_CONTROL_NOT_USED, + .snr_control_reflector = BT_LE_CS_REFLECTOR_SNR_CONTROL_NOT_USED, + }; + + err = bt_le_cs_set_procedure_parameters(connection, &procedure_params); + if (err) { + printk("Failed to set procedure parameters (err %d)\n", err); + return 0; + } + + struct bt_le_cs_procedure_enable_param params = { + .config_id = CS_CONFIG_ID, + .enable = 1, + }; + + err = bt_le_cs_procedure_enable(connection, ¶ms); + if (err) { + printk("Failed to enable CS procedures (err %d)\n", err); + return 0; + } + + while (true) { + k_sem_take(&sem_procedure_done, K_FOREVER); + k_sem_take(&sem_data_received, K_FOREVER); + + estimate_distance( + latest_local_steps, latest_step_data_len, latest_peer_steps, + latest_step_data_len - + NUM_MODE_0_STEPS * + (sizeof(struct bt_hci_le_cs_step_data_mode_0_initiator) - + sizeof(struct bt_hci_le_cs_step_data_mode_0_reflector)), + n_ap, BT_CONN_LE_CS_ROLE_INITIATOR); + } + + return 0; +} diff --git a/samples/bluetooth/channel_sounding/src/connected_cs_reflector.c b/samples/bluetooth/channel_sounding/src/connected_cs_reflector.c new file mode 100644 index 0000000000000..2563d6043871f --- /dev/null +++ b/samples/bluetooth/channel_sounding/src/connected_cs_reflector.c @@ -0,0 +1,248 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include "common.h" + +#define CS_CONFIG_ID 0 +#define NUM_MODE_0_STEPS 1 + +static K_SEM_DEFINE(sem_remote_capabilities_obtained, 0, 1); +static K_SEM_DEFINE(sem_config_created, 0, 1); +static K_SEM_DEFINE(sem_cs_security_enabled, 0, 1); +static K_SEM_DEFINE(sem_procedure_done, 0, 1); +static K_SEM_DEFINE(sem_connected, 0, 1); +static K_SEM_DEFINE(sem_discovered, 0, 1); +static K_SEM_DEFINE(sem_written, 0, 1); + +static uint16_t step_data_attr_handle; +static struct bt_conn *connection; +static uint8_t latest_local_steps[STEP_DATA_BUF_LEN]; + +static const char sample_str[] = "CS Sample"; +static const struct bt_data ad[] = { + BT_DATA(BT_DATA_NAME_COMPLETE, "CS Sample", sizeof(sample_str) - 1), +}; + +static void subevent_result_cb(struct bt_conn *conn, struct bt_conn_le_cs_subevent_result *result) +{ + if (result->step_data_buf) { + if (result->step_data_buf->len <= STEP_DATA_BUF_LEN) { + memcpy(latest_local_steps, result->step_data_buf->data, + result->step_data_buf->len); + } else { + printk("Not enough memory to store step data. (%d > %d)\n", + result->step_data_buf->len, STEP_DATA_BUF_LEN); + } + } + + if (result->header.procedure_done_status == BT_CONN_LE_CS_PROCEDURE_COMPLETE) { + k_sem_give(&sem_procedure_done); + } +} + +static void mtu_exchange_cb(struct bt_conn *conn, uint8_t err, + struct bt_gatt_exchange_params *params) +{ + printk("MTU exchange %s (%u)\n", err == 0U ? "success" : "failed", bt_gatt_get_mtu(conn)); +} + +static void connected_cb(struct bt_conn *conn, uint8_t err) +{ + char addr[BT_ADDR_LE_STR_LEN]; + + (void)bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); + printk("Connected to %s (err 0x%02X)\n", addr, err); + + __ASSERT(connection == conn, "Unexpected connected callback"); + + if (err) { + bt_conn_unref(conn); + connection = NULL; + } + + connection = bt_conn_ref(conn); + + static struct bt_gatt_exchange_params mtu_exchange_params = {.func = mtu_exchange_cb}; + + err = bt_gatt_exchange_mtu(connection, &mtu_exchange_params); + if (err) { + printk("%s: MTU exchange failed (err %d)\n", __func__, err); + } + + k_sem_give(&sem_connected); +} + +static void disconnected_cb(struct bt_conn *conn, uint8_t reason) +{ + printk("Disconnected (reason 0x%02X)\n", reason); + + bt_conn_unref(conn); + connection = NULL; +} + +static void remote_capabilities_cb(struct bt_conn *conn, struct bt_conn_le_cs_capabilities *params) +{ + ARG_UNUSED(params); + printk("CS capability exchange completed.\n"); + k_sem_give(&sem_remote_capabilities_obtained); +} + +static void config_created_cb(struct bt_conn *conn, struct bt_conn_le_cs_config *config) +{ + printk("CS config creation complete. ID: %d\n", config->id); + k_sem_give(&sem_config_created); +} + +static void security_enabled_cb(struct bt_conn *conn) +{ + printk("CS security enabled.\n"); + k_sem_give(&sem_cs_security_enabled); +} + +static void procedure_enabled_cb(struct bt_conn *conn, + struct bt_conn_le_cs_procedure_enable_complete *params) +{ + if (params->state == 1) { + printk("CS procedures enabled.\n"); + } else { + printk("CS procedures disabled.\n"); + } +} + +static uint8_t discover_func(struct bt_conn *conn, const struct bt_gatt_attr *attr, + struct bt_gatt_discover_params *params) +{ + struct bt_gatt_chrc *chrc; + char str[BT_UUID_STR_LEN]; + + printk("Discovery: attr %p\n", attr); + + if (!attr) { + return BT_GATT_ITER_STOP; + } + + chrc = (struct bt_gatt_chrc *)attr->user_data; + + bt_uuid_to_str(chrc->uuid, str, sizeof(str)); + printk("UUID %s\n", str); + + if (!bt_uuid_cmp(chrc->uuid, &step_data_char_uuid.uuid)) { + step_data_attr_handle = chrc->value_handle; + + printk("Found expected UUID\n"); + + k_sem_give(&sem_discovered); + } + + return BT_GATT_ITER_STOP; +} + +static void write_func(struct bt_conn *conn, uint8_t err, struct bt_gatt_write_params *params) +{ + if (err) { + printk("Write failed (err %d)\n", err); + + return; + } + + k_sem_give(&sem_written); +} + +BT_CONN_CB_DEFINE(conn_cb) = { + .connected = connected_cb, + .disconnected = disconnected_cb, + .le_cs_remote_capabilities_available = remote_capabilities_cb, + .le_cs_config_created = config_created_cb, + .le_cs_security_enabled = security_enabled_cb, + .le_cs_procedure_enabled = procedure_enabled_cb, + .le_cs_subevent_data_available = subevent_result_cb, +}; + +int main(void) +{ + int err; + struct bt_gatt_discover_params discover_params; + struct bt_gatt_write_params write_params; + + printk("Starting Channel Sounding Demo\n"); + + /* Initialize the Bluetooth Subsystem */ + err = bt_enable(NULL); + if (err) { + printk("Bluetooth init failed (err %d)\n", err); + return 0; + } + + err = bt_le_adv_start(BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, BT_GAP_ADV_FAST_INT_MIN_1, + BT_GAP_ADV_FAST_INT_MAX_1, NULL), + ad, ARRAY_SIZE(ad), NULL, 0); + if (err) { + printk("Advertising failed to start (err %d)\n", err); + return 0; + } + + k_sem_take(&sem_connected, K_FOREVER); + + const struct bt_le_cs_set_default_settings_param default_settings = { + .enable_initiator_role = false, + .enable_reflector_role = true, + .cs_sync_antenna_selection = BT_LE_CS_ANTENNA_SELECTION_OPT_REPETITIVE, + .max_tx_power = BT_HCI_OP_LE_CS_MAX_MAX_TX_POWER, + }; + + err = bt_le_cs_set_default_settings(connection, &default_settings); + if (err) { + printk("Failed to configure default CS settings (err %d)\n", err); + } + + discover_params.uuid = &step_data_char_uuid.uuid; + discover_params.func = discover_func; + discover_params.start_handle = BT_ATT_FIRST_ATTRIBUTE_HANDLE; + discover_params.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE; + discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC; + + err = bt_gatt_discover(connection, &discover_params); + if (err) { + printk("Discovery failed (err %d)\n", err); + return 0; + } + + err = k_sem_take(&sem_discovered, K_SECONDS(10)); + if (err) { + printk("Timed out during GATT discovery\n"); + return 0; + } + + while (true) { + k_sem_take(&sem_procedure_done, K_FOREVER); + + write_params.func = write_func; + write_params.handle = step_data_attr_handle; + write_params.length = STEP_DATA_BUF_LEN; + write_params.data = &latest_local_steps[0]; + write_params.offset = 0; + + err = bt_gatt_write(connection, &write_params); + if (err) { + printk("Write failed (err %d)\n", err); + return 0; + } + + err = k_sem_take(&sem_written, K_SECONDS(10)); + if (err) { + printk("Timed out during GATT write\n"); + return 0; + } + } + + return 0; +} diff --git a/samples/bluetooth/channel_sounding/src/cs_test_initiator.c b/samples/bluetooth/channel_sounding/src/cs_test_initiator.c new file mode 100644 index 0000000000000..c733df18657ce --- /dev/null +++ b/samples/bluetooth/channel_sounding/src/cs_test_initiator.c @@ -0,0 +1,276 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include +#include "distance_estimation.h" +#include "common.h" +#include "cs_test_params.h" + +static K_SEM_DEFINE(sem_results_available, 0, 1); +static K_SEM_DEFINE(sem_test_complete, 0, 1); +static K_SEM_DEFINE(sem_connected, 0, 1); +static K_SEM_DEFINE(sem_disconnected, 0, 1); +static K_SEM_DEFINE(sem_data_received, 0, 1); + +static ssize_t on_attr_write_cb(struct bt_conn *conn, const struct bt_gatt_attr *attr, + const void *buf, uint16_t len, uint16_t offset, uint8_t flags); +static struct bt_conn *connection; +static uint8_t n_ap; +static uint8_t latest_num_steps_reported; +static uint16_t latest_step_data_len; +static uint8_t latest_local_steps[STEP_DATA_BUF_LEN]; +static uint8_t latest_peer_steps[STEP_DATA_BUF_LEN]; + +static struct bt_gatt_attr gatt_attributes[] = { + BT_GATT_PRIMARY_SERVICE(&step_data_svc_uuid), + BT_GATT_CHARACTERISTIC(&step_data_char_uuid.uuid, BT_GATT_CHRC_WRITE, + BT_GATT_PERM_WRITE | BT_GATT_PERM_READ, NULL, on_attr_write_cb, + NULL), +}; +static struct bt_gatt_service step_data_gatt_service = BT_GATT_SERVICE(gatt_attributes); +static const char sample_str[] = "CS Test Sample"; + +static ssize_t on_attr_write_cb(struct bt_conn *conn, const struct bt_gatt_attr *attr, + const void *buf, uint16_t len, uint16_t offset, uint8_t flags) +{ + if (flags & BT_GATT_WRITE_FLAG_PREPARE) { + return 0; + } + + if (offset) { + return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); + } + + if (len != sizeof(latest_local_steps)) { + return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); + } + + if (flags & BT_GATT_WRITE_FLAG_EXECUTE) { + uint8_t *data = (uint8_t *)buf; + + memcpy(latest_peer_steps, &data[offset], len); + k_sem_give(&sem_data_received); + } + + return len; +} + +static void subevent_result_cb(struct bt_conn_le_cs_subevent_result *result) +{ + latest_num_steps_reported = result->header.num_steps_reported; + n_ap = result->header.num_antenna_paths; + + if (result->step_data_buf) { + if (result->step_data_buf->len <= STEP_DATA_BUF_LEN) { + memcpy(latest_local_steps, result->step_data_buf->data, + result->step_data_buf->len); + latest_step_data_len = result->step_data_buf->len; + } else { + printk("Not enough memory to store step data. (%d > %d)\n", + result->step_data_buf->len, STEP_DATA_BUF_LEN); + latest_num_steps_reported = 0; + } + } + + if (result->header.procedure_done_status == BT_CONN_LE_CS_PROCEDURE_COMPLETE || + result->header.procedure_done_status == BT_CONN_LE_CS_PROCEDURE_ABORTED) { + k_sem_give(&sem_results_available); + } +} + +static void end_cb(void) +{ + k_sem_give(&sem_test_complete); +} + +static void mtu_exchange_cb(struct bt_conn *conn, uint8_t err, + struct bt_gatt_exchange_params *params) +{ + printk("MTU exchange %s (%u)\n", err == 0U ? "success" : "failed", bt_gatt_get_mtu(conn)); +} + +static void connected_cb(struct bt_conn *conn, uint8_t err) +{ + char addr[BT_ADDR_LE_STR_LEN]; + + (void)bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); + printk("Connected to %s (err 0x%02X)\n", addr, err); + + __ASSERT(connection == conn, "Unexpected connected callback"); + + if (err) { + bt_conn_unref(conn); + connection = NULL; + } + + static struct bt_gatt_exchange_params mtu_exchange_params = {.func = mtu_exchange_cb}; + + err = bt_gatt_exchange_mtu(connection, &mtu_exchange_params); + if (err) { + printk("%s: MTU exchange failed (err %d)\n", __func__, err); + } + + k_sem_give(&sem_connected); +} + +static void disconnected_cb(struct bt_conn *conn, uint8_t reason) +{ + printk("Disconnected (reason 0x%02X)\n", reason); + + bt_conn_unref(conn); + connection = NULL; + + k_sem_give(&sem_disconnected); +} + +static bool data_cb(struct bt_data *data, void *user_data) +{ + char *name = user_data; + uint8_t len; + + switch (data->type) { + case BT_DATA_NAME_SHORTENED: + case BT_DATA_NAME_COMPLETE: + len = MIN(data->data_len, NAME_LEN - 1); + memcpy(name, data->data, len); + name[len] = '\0'; + return false; + default: + return true; + } +} + +static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type, + struct net_buf_simple *ad) +{ + char addr_str[BT_ADDR_LE_STR_LEN]; + char name[NAME_LEN] = {}; + int err; + + if (connection) { + return; + } + + /* We're only interested in connectable events */ + if (type != BT_GAP_ADV_TYPE_ADV_IND && type != BT_GAP_ADV_TYPE_ADV_DIRECT_IND) { + return; + } + + bt_data_parse(ad, data_cb, name); + + if (strcmp(name, sample_str)) { + return; + } + + if (bt_le_scan_stop()) { + return; + } + + printk("Found device with name %s, connecting...\n", name); + + err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, BT_LE_CONN_PARAM_DEFAULT, + &connection); + if (err) { + printk("Create conn to %s failed (%u)\n", addr_str, err); + } +} + +BT_CONN_CB_DEFINE(conn_cb) = { + .connected = connected_cb, + .disconnected = disconnected_cb, +}; + +int main(void) +{ + int err; + struct bt_le_cs_test_param test_params; + + printk("Starting Channel Sounding Demo\n"); + + /* Initialize the Bluetooth Subsystem */ + err = bt_enable(NULL); + if (err) { + printk("Bluetooth init failed (err %d)\n", err); + return 0; + } + + struct bt_le_cs_test_cb cs_test_cb = { + .le_cs_test_subevent_data_available = subevent_result_cb, + .le_cs_test_end_complete = end_cb, + }; + + err = bt_le_cs_test_cb_register(cs_test_cb); + if (err) { + printk("Failed to register callbacks (err %d)\n", err); + return 0; + } + + err = bt_gatt_service_register(&step_data_gatt_service); + if (err) { + printk("bt_gatt_service_register() returned err %d\n", err); + return 0; + } + + while (true) { + while (true) { + k_sleep(K_SECONDS(2)); + + test_params = test_params_get(BT_CONN_LE_CS_ROLE_INITIATOR); + + err = bt_le_cs_start_test(&test_params); + if (err) { + printk("Failed to start CS test (err %d)\n", err); + return 0; + } + + k_sem_take(&sem_results_available, K_SECONDS(5)); + + err = bt_le_cs_stop_test(); + if (err) { + printk("Failed to stop CS test (err %d)\n", err); + return 0; + } + + k_sem_take(&sem_test_complete, K_FOREVER); + + if (latest_num_steps_reported > NUM_MODE_0_STEPS) { + break; + } + } + + err = bt_le_scan_start(BT_LE_SCAN_ACTIVE_CONTINUOUS, device_found); + if (err) { + printk("Scanning failed to start (err %d)\n", err); + return 0; + } + + k_sem_take(&sem_connected, K_FOREVER); + + k_sem_take(&sem_data_received, K_FOREVER); + + estimate_distance( + latest_local_steps, latest_step_data_len, latest_peer_steps, + latest_step_data_len - + NUM_MODE_0_STEPS * + (sizeof(struct bt_hci_le_cs_step_data_mode_0_initiator) - + sizeof(struct bt_hci_le_cs_step_data_mode_0_reflector)), + n_ap, BT_CONN_LE_CS_ROLE_INITIATOR); + + bt_conn_disconnect(connection, BT_HCI_ERR_REMOTE_USER_TERM_CONN); + + k_sem_take(&sem_disconnected, K_FOREVER); + + printk("Re-running CS test...\n"); + } + + return 0; +} diff --git a/samples/bluetooth/channel_sounding/src/cs_test_reflector.c b/samples/bluetooth/channel_sounding/src/cs_test_reflector.c new file mode 100644 index 0000000000000..6f8352bc90322 --- /dev/null +++ b/samples/bluetooth/channel_sounding/src/cs_test_reflector.c @@ -0,0 +1,247 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include +#include "distance_estimation.h" +#include "common.h" +#include "cs_test_params.h" + +static K_SEM_DEFINE(sem_results_available, 0, 1); +static K_SEM_DEFINE(sem_test_complete, 0, 1); +static K_SEM_DEFINE(sem_connected, 0, 1); +static K_SEM_DEFINE(sem_disconnected, 0, 1); +static K_SEM_DEFINE(sem_discovered, 0, 1); +static K_SEM_DEFINE(sem_written, 0, 1); + +static uint16_t step_data_attr_handle; +static struct bt_conn *connection; +static uint8_t latest_num_steps_reported; +static uint8_t latest_local_steps[STEP_DATA_BUF_LEN]; + +static const char sample_str[] = "CS Test Sample"; +static const struct bt_data ad[] = { + BT_DATA(BT_DATA_NAME_COMPLETE, "CS Test Sample", sizeof(sample_str) - 1), +}; + +static void subevent_result_cb(struct bt_conn_le_cs_subevent_result *result) +{ + latest_num_steps_reported = result->header.num_steps_reported; + + if (result->step_data_buf) { + if (result->step_data_buf->len <= STEP_DATA_BUF_LEN) { + memcpy(latest_local_steps, result->step_data_buf->data, + result->step_data_buf->len); + } else { + printk("Not enough memory to store step data. (%d > %d)\n", + result->step_data_buf->len, STEP_DATA_BUF_LEN); + latest_num_steps_reported = 0; + } + } + + if (result->header.procedure_done_status == BT_CONN_LE_CS_PROCEDURE_COMPLETE || + result->header.procedure_done_status == BT_CONN_LE_CS_PROCEDURE_ABORTED) { + k_sem_give(&sem_results_available); + } +} + +static void end_cb(void) +{ + k_sem_give(&sem_test_complete); +} + +static void mtu_exchange_cb(struct bt_conn *conn, uint8_t err, + struct bt_gatt_exchange_params *params) +{ + printk("MTU exchange %s (%u)\n", err == 0U ? "success" : "failed", bt_gatt_get_mtu(conn)); +} + +static void connected_cb(struct bt_conn *conn, uint8_t err) +{ + char addr[BT_ADDR_LE_STR_LEN]; + + (void)bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr)); + printk("Connected to %s (err 0x%02X)\n", addr, err); + + __ASSERT(connection == conn, "Unexpected connected callback"); + + if (err) { + bt_conn_unref(conn); + connection = NULL; + } + + connection = bt_conn_ref(conn); + + static struct bt_gatt_exchange_params mtu_exchange_params = {.func = mtu_exchange_cb}; + + err = bt_gatt_exchange_mtu(connection, &mtu_exchange_params); + if (err) { + printk("%s: MTU exchange failed (err %d)\n", __func__, err); + } + + k_sem_give(&sem_connected); +} + +static void disconnected_cb(struct bt_conn *conn, uint8_t reason) +{ + printk("Disconnected (reason 0x%02X)\n", reason); + + bt_conn_unref(conn); + connection = NULL; + + k_sem_give(&sem_disconnected); +} + +static uint8_t discover_func(struct bt_conn *conn, const struct bt_gatt_attr *attr, + struct bt_gatt_discover_params *params) +{ + struct bt_gatt_chrc *chrc; + char str[BT_UUID_STR_LEN]; + + printk("Discovery: attr %p\n", attr); + + if (!attr) { + return BT_GATT_ITER_STOP; + } + + chrc = (struct bt_gatt_chrc *)attr->user_data; + + bt_uuid_to_str(chrc->uuid, str, sizeof(str)); + printk("UUID %s\n", str); + + if (!bt_uuid_cmp(chrc->uuid, &step_data_char_uuid.uuid)) { + step_data_attr_handle = chrc->value_handle; + + printk("Found expected UUID\n"); + + k_sem_give(&sem_discovered); + } + + return BT_GATT_ITER_STOP; +} + +static void write_func(struct bt_conn *conn, uint8_t err, struct bt_gatt_write_params *params) +{ + if (err) { + printk("Write failed (err %d)\n", err); + + return; + } + + k_sem_give(&sem_written); +} + +BT_CONN_CB_DEFINE(conn_cb) = { + .connected = connected_cb, + .disconnected = disconnected_cb, +}; + +int main(void) +{ + int err; + struct bt_le_cs_test_param test_params; + struct bt_gatt_discover_params discover_params; + struct bt_gatt_write_params write_params; + + printk("Starting Channel Sounding Demo\n"); + + /* Initialize the Bluetooth Subsystem */ + err = bt_enable(NULL); + if (err) { + printk("Bluetooth init failed (err %d)\n", err); + return 0; + } + + struct bt_le_cs_test_cb cs_test_cb = { + .le_cs_test_subevent_data_available = subevent_result_cb, + .le_cs_test_end_complete = end_cb, + }; + + err = bt_le_cs_test_cb_register(cs_test_cb); + if (err) { + printk("Failed to register callbacks (err %d)\n", err); + return 0; + } + + while (true) { + while (true) { + k_sleep(K_SECONDS(2)); + + test_params = test_params_get(BT_CONN_LE_CS_ROLE_REFLECTOR); + + err = bt_le_cs_start_test(&test_params); + if (err) { + printk("Failed to start CS test (err %d)\n", err); + return 0; + } + + k_sem_take(&sem_results_available, K_SECONDS(5)); + + err = bt_le_cs_stop_test(); + if (err) { + printk("Failed to stop CS test (err %d)\n", err); + return 0; + } + + k_sem_take(&sem_test_complete, K_FOREVER); + + if (latest_num_steps_reported > NUM_MODE_0_STEPS) { + break; + } + } + + err = bt_le_adv_start(BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, BT_GAP_ADV_FAST_INT_MIN_1, + BT_GAP_ADV_FAST_INT_MAX_1, NULL), + ad, ARRAY_SIZE(ad), NULL, 0); + if (err) { + printk("Advertising failed to start (err %d)\n", err); + return 0; + } + + k_sem_take(&sem_connected, K_FOREVER); + + discover_params.uuid = &step_data_char_uuid.uuid; + discover_params.func = discover_func; + discover_params.start_handle = BT_ATT_FIRST_ATTRIBUTE_HANDLE; + discover_params.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE; + discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC; + + err = bt_gatt_discover(connection, &discover_params); + if (err) { + printk("Discovery failed (err %d)\n", err); + return 0; + } + + err = k_sem_take(&sem_discovered, K_SECONDS(10)); + if (err) { + printk("Timed out during GATT discovery\n"); + return 0; + } + + write_params.func = write_func; + write_params.handle = step_data_attr_handle; + write_params.length = STEP_DATA_BUF_LEN; + write_params.data = latest_local_steps; + write_params.offset = 0; + + err = bt_gatt_write(connection, &write_params); + if (err) { + printk("Write failed (err %d)\n", err); + return 0; + } + + k_sem_take(&sem_disconnected, K_FOREVER); + + printk("Re-running CS test...\n"); + } + + return 0; +} diff --git a/samples/bluetooth/channel_sounding/src/distance_estimation.c b/samples/bluetooth/channel_sounding/src/distance_estimation.c new file mode 100644 index 0000000000000..8d1fb0b4a9c08 --- /dev/null +++ b/samples/bluetooth/channel_sounding/src/distance_estimation.c @@ -0,0 +1,304 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include "distance_estimation.h" + +#define CS_FREQUENCY_MHZ(ch) (2402u + 1u * (ch)) +#define CS_FREQUENCY_HZ(ch) (CS_FREQUENCY_MHZ(ch) * 1000000.0f) +#define SPEED_OF_LIGHT_M_PER_S (299792458.0f) +#define SPEED_OF_LIGHT_NM_PER_S (SPEED_OF_LIGHT_M_PER_S / 1000000000.0f) +#define PI 3.14159265358979323846f +#define MAX_NUM_SAMPLES 256 + +struct iq_sample_and_channel { + bool failed; + uint8_t channel; + uint8_t antenna_permutation; + struct bt_le_cs_iq_sample local_iq_sample; + struct bt_le_cs_iq_sample peer_iq_sample; +}; + +struct rtt_timing { + bool failed; + int16_t toa_tod_initiator; + int16_t tod_toa_reflector; +}; + +static struct iq_sample_and_channel mode_2_data[MAX_NUM_SAMPLES]; +static struct rtt_timing mode_1_data[MAX_NUM_SAMPLES]; + +struct processing_context { + bool local_steps; + uint8_t mode_1_data_index; + uint8_t mode_2_data_index; + uint8_t n_ap; + enum bt_conn_le_cs_role role; +}; + +static void calc_complex_product(int32_t z_a_real, int32_t z_a_imag, int32_t z_b_real, + int32_t z_b_imag, int32_t *z_out_real, int32_t *z_out_imag) +{ + *z_out_real = z_a_real * z_b_real - z_a_imag * z_b_imag; + *z_out_imag = z_a_real * z_b_imag + z_a_imag * z_b_real; +} + +static float linear_regression(float *x_values, float *y_values, uint8_t n_samples) +{ + if (n_samples == 0) { + return 0.0; + } + + /* Estimates b in y = a + b x */ + + float y_mean = 0.0; + float x_mean = 0.0; + + for (uint8_t i = 0; i < n_samples; i++) { + y_mean += (y_values[i] - y_mean) / (i + 1); + x_mean += (x_values[i] - x_mean) / (i + 1); + } + + float b_est_upper = 0.0; + float b_est_lower = 0.0; + + for (uint8_t i = 0; i < n_samples; i++) { + b_est_upper += (x_values[i] - x_mean) * (y_values[i] - y_mean); + b_est_lower += (x_values[i] - x_mean) * (x_values[i] - x_mean); + } + + return b_est_upper / b_est_lower; +} + +static void bubblesort_2(float *array1, float *array2, uint16_t len) +{ + bool swapped; + float temp; + + for (uint16_t i = 0; i < len - 1; i++) { + swapped = false; + for (uint16_t j = 0; j < len - i - 1; j++) { + if (array1[j] > array1[j + 1]) { + temp = array1[j]; + array1[j] = array1[j + 1]; + array1[j + 1] = temp; + temp = array2[j]; + array2[j] = array2[j + 1]; + array2[j + 1] = temp; + swapped = true; + } + } + + if (!swapped) { + break; + } + } +} + +static float estimate_distance_using_phase_slope(struct iq_sample_and_channel *data, uint8_t len) +{ + int32_t combined_i; + int32_t combined_q; + uint16_t num_angles = 0; + static float theta[MAX_NUM_SAMPLES]; + static float frequencies[MAX_NUM_SAMPLES]; + + for (uint8_t i = 0; i < len; i++) { + if (!data[i].failed) { + calc_complex_product(data[i].local_iq_sample.i, data[i].local_iq_sample.q, + data[i].peer_iq_sample.i, data[i].peer_iq_sample.q, + &combined_i, &combined_q); + + theta[num_angles] = atan2(1.0 * combined_q, 1.0 * combined_i); + frequencies[num_angles] = 1.0 * CS_FREQUENCY_MHZ(data[i].channel); + num_angles++; + } + } + + if (num_angles < 2) { + return 0.0; + } + + /* Sort phases by tone frequency */ + bubblesort_2(frequencies, theta, num_angles); + + /* One-dimensional phase unwrapping */ + for (uint8_t i = 1; i < num_angles; i++) { + float difference = theta[i] - theta[i - 1]; + + if (difference > PI) { + for (uint8_t j = i; j < num_angles; j++) { + theta[j] -= 2.0f * PI; + } + } else if (difference < -PI) { + for (uint8_t j = i; j < num_angles; j++) { + theta[j] += 2.0f * PI; + } + } + } + + float phase_slope = linear_regression(frequencies, theta, num_angles); + + float distance = -phase_slope * (SPEED_OF_LIGHT_M_PER_S / (4 * PI)); + + return distance / 1000000.0f; /* Scale to meters. */ +} + +static float estimate_distance_using_time_of_flight(uint8_t n_samples) +{ + float tof; + float tof_mean = 0.0; + + /* Cumulative Moving Average */ + for (uint8_t i = 0; i < n_samples; i++) { + if (!mode_1_data[i].failed) { + tof = (mode_1_data[i].toa_tod_initiator - + mode_1_data[i].tod_toa_reflector) / + 2; + tof_mean += (tof - tof_mean) / (i + 1); + } + } + + float tof_mean_ns = tof_mean / 2.0f; + + return tof_mean_ns * SPEED_OF_LIGHT_NM_PER_S; +} + +static bool process_step_data(struct bt_le_cs_subevent_step *step, void *user_data) +{ + struct processing_context *context = (struct processing_context *)user_data; + + if (step->mode == BT_CONN_LE_CS_MAIN_MODE_2) { + struct bt_hci_le_cs_step_data_mode_2 *step_data = + (struct bt_hci_le_cs_step_data_mode_2 *)step->data; + + if (context->local_steps) { + for (uint8_t i = 0; i < (context->n_ap + 1); i++) { + if (step_data->tone_info[i].extension_indicator != + BT_HCI_LE_CS_NOT_TONE_EXT_SLOT) { + continue; + } + + mode_2_data[context->mode_2_data_index].channel = step->channel; + mode_2_data[context->mode_2_data_index].antenna_permutation = + step_data->antenna_permutation_index; + mode_2_data[context->mode_2_data_index].local_iq_sample = + bt_le_cs_parse_pct( + step_data->tone_info[i].phase_correction_term); + if (step_data->tone_info[i].quality_indicator == + BT_HCI_LE_CS_TONE_QUALITY_LOW || + step_data->tone_info[i].quality_indicator == + BT_HCI_LE_CS_TONE_QUALITY_UNAVAILABLE) { + mode_2_data[context->mode_2_data_index].failed = true; + } + + context->mode_2_data_index++; + } + } else { + for (uint8_t i = 0; i < (context->n_ap + 1); i++) { + if (step_data->tone_info[i].extension_indicator != + BT_HCI_LE_CS_NOT_TONE_EXT_SLOT) { + continue; + } + + mode_2_data[context->mode_2_data_index].peer_iq_sample = + bt_le_cs_parse_pct( + step_data->tone_info[i].phase_correction_term); + if (step_data->tone_info[i].quality_indicator == + BT_HCI_LE_CS_TONE_QUALITY_LOW || + step_data->tone_info[i].quality_indicator == + BT_HCI_LE_CS_TONE_QUALITY_UNAVAILABLE) { + mode_2_data[context->mode_2_data_index].failed = true; + } + + context->mode_2_data_index++; + } + } + } else if (step->mode == BT_HCI_OP_LE_CS_MAIN_MODE_1) { + struct bt_hci_le_cs_step_data_mode_1 *step_data = + (struct bt_hci_le_cs_step_data_mode_1 *)step->data; + + if (step_data->packet_quality_aa_check != + BT_HCI_LE_CS_PACKET_QUALITY_AA_CHECK_SUCCESSFUL || + step_data->packet_rssi == BT_HCI_LE_CS_PACKET_RSSI_NOT_AVAILABLE || + step_data->tod_toa_reflector == BT_HCI_LE_CS_TIME_DIFFERENCE_NOT_AVAILABLE) { + mode_1_data[context->mode_1_data_index].failed = true; + } + + if (context->local_steps) { + if (context->role == BT_CONN_LE_CS_ROLE_INITIATOR) { + mode_1_data[context->mode_1_data_index].toa_tod_initiator = + step_data->toa_tod_initiator; + } else if (context->role == BT_CONN_LE_CS_ROLE_REFLECTOR) { + mode_1_data[context->mode_1_data_index].tod_toa_reflector = + step_data->tod_toa_reflector; + } + } else { + if (context->role == BT_CONN_LE_CS_ROLE_INITIATOR) { + mode_1_data[context->mode_1_data_index].tod_toa_reflector = + step_data->tod_toa_reflector; + } else if (context->role == BT_CONN_LE_CS_ROLE_REFLECTOR) { + mode_1_data[context->mode_1_data_index].toa_tod_initiator = + step_data->toa_tod_initiator; + } + } + + context->mode_1_data_index++; + } + + return true; +} + +void estimate_distance(uint8_t *local_steps, uint16_t local_steps_len, uint8_t *peer_steps, + uint16_t peer_steps_len, uint8_t n_ap, enum bt_conn_le_cs_role role) +{ + struct net_buf_simple buf; + + struct processing_context context = { + .local_steps = true, + .mode_1_data_index = 0, + .mode_2_data_index = 0, + .n_ap = n_ap, + .role = role, + }; + + memset(mode_1_data, 0, sizeof(mode_1_data)); + memset(mode_2_data, 0, sizeof(mode_2_data)); + + net_buf_simple_init_with_data(&buf, local_steps, local_steps_len); + + bt_le_cs_step_data_parse(&buf, process_step_data, &context); + + context.mode_1_data_index = 0; + context.mode_2_data_index = 0; + context.local_steps = false; + + net_buf_simple_init_with_data(&buf, peer_steps, peer_steps_len); + + bt_le_cs_step_data_parse(&buf, process_step_data, &context); + + float phase_slope_based_distance = + estimate_distance_using_phase_slope(mode_2_data, context.mode_2_data_index); + + float rtt_based_distance = + estimate_distance_using_time_of_flight(context.mode_1_data_index); + + if (rtt_based_distance == 0.0f && phase_slope_based_distance == 0.0f) { + printk("A reliable distance estimate could not be computed.\n"); + } else { + printk("Estimated distance to reflector:\n"); + } + + if (rtt_based_distance != 0.0f) { + printk("- Round-Trip Timing method: %f meters (derived from %d samples)\n", + (double)rtt_based_distance, context.mode_1_data_index); + } + if (phase_slope_based_distance != 0.0f) { + printk("- Phase-Based Ranging method: %f meters (derived from %d samples)\n", + (double)phase_slope_based_distance, context.mode_2_data_index); + } +} From b0f4cf65114f12f76dfb629cf56c29b4b4f4e71f Mon Sep 17 00:00:00 2001 From: Chew Zeh Yang Date: Wed, 23 Oct 2024 12:00:57 +0800 Subject: [PATCH 2553/4482] boards: ambiq: add user button Added user button for apollo4p_blue_kxr_evb and apollo4p_evb Signed-off-by: Chew Zeh Yang --- .../ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts | 6 ++++++ boards/ambiq/apollo4p_evb/apollo4p_evb.dts | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts b/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts index b1ac04f91ce89..9f74b65ea34ae 100644 --- a/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts +++ b/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts @@ -1,5 +1,6 @@ /dts-v1/; #include +#include #include "apollo4p_blue_kxr_evb-pinctrl.dtsi" @@ -45,13 +46,18 @@ buttons { compatible = "gpio-keys"; + polling-mode; button0: button_0 { gpios = <&gpio0_31 17 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; label = "BTN0"; + zephyr,code = ; + status = "okay"; }; button1: button_1 { gpios = <&gpio0_31 19 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; label = "BTN1"; + zephyr,code = ; + status = "okay"; }; }; }; diff --git a/boards/ambiq/apollo4p_evb/apollo4p_evb.dts b/boards/ambiq/apollo4p_evb/apollo4p_evb.dts index 43769da5ad341..4ef4d94534869 100644 --- a/boards/ambiq/apollo4p_evb/apollo4p_evb.dts +++ b/boards/ambiq/apollo4p_evb/apollo4p_evb.dts @@ -1,5 +1,6 @@ /dts-v1/; #include +#include #include "apollo4p_evb-pinctrl.dtsi" @@ -45,13 +46,18 @@ buttons { compatible = "gpio-keys"; + polling-mode; button0: button_0 { gpios = <&gpio0_31 18 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; label = "BTN0"; + zephyr,code = ; + status = "okay"; }; button1: button_1 { gpios = <&gpio0_31 19 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; label = "BTN1"; + zephyr,code = ; + status = "okay"; }; }; }; From 97187bee6ab2ee5a8381073fd1c346d13581fb3b Mon Sep 17 00:00:00 2001 From: Chew Zeh Yang Date: Wed, 23 Oct 2024 12:17:25 +0800 Subject: [PATCH 2554/4482] dt-bindings: apollo4p: add ambiq usb binding Added ambiq-usb bindings needed by udc_ambiq. Signed-off-by: Chew Zeh Yang --- dts/bindings/usb/ambiq,usb.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 dts/bindings/usb/ambiq,usb.yaml diff --git a/dts/bindings/usb/ambiq,usb.yaml b/dts/bindings/usb/ambiq,usb.yaml new file mode 100644 index 0000000000000..f460e7257cf7d --- /dev/null +++ b/dts/bindings/usb/ambiq,usb.yaml @@ -0,0 +1,28 @@ +# Copyright (c) 2023 Antmicro +# SPDX-License-Identifier: Apache-2.0 + +description: Ambiq USB + +compatible: "ambiq,usb" + +include: [usb-ep.yaml, pinctrl-device.yaml, ambiq-pwrcfg.yaml] + +properties: + reg: + required: true + + interrupts: + required: true + + ambiq,pwrcfg: + required: true + + vddusb33-gpios: + type: phandle-array + description: | + Control VDDUSB33 via GPIO pin. + + vddusb0p9-gpios: + type: phandle-array + description: | + Control VDDUSB0P9 via GPIO pin. From 659582b06f93633eb7ba07a97505a97898d3cb55 Mon Sep 17 00:00:00 2001 From: Chew Zeh Yang Date: Thu, 19 Sep 2024 10:08:37 +0800 Subject: [PATCH 2555/4482] drivers: udc_ambiq: Implemented UDC driver for apollo4p Added implementation for udc_ambiq with its required Kconfig and CMakelist updates. Signed-off-by: Chew Zeh Yang --- drivers/usb/udc/CMakeLists.txt | 1 + drivers/usb/udc/Kconfig | 1 + drivers/usb/udc/Kconfig.ambiq | 34 ++ drivers/usb/udc/udc_ambiq.c | 968 +++++++++++++++++++++++++++++++++ modules/hal_ambiq/Kconfig | 5 + 5 files changed, 1009 insertions(+) create mode 100644 drivers/usb/udc/Kconfig.ambiq create mode 100644 drivers/usb/udc/udc_ambiq.c diff --git a/drivers/usb/udc/CMakeLists.txt b/drivers/usb/udc/CMakeLists.txt index 488269af99a0a..883b8fc13d813 100644 --- a/drivers/usb/udc/CMakeLists.txt +++ b/drivers/usb/udc/CMakeLists.txt @@ -18,3 +18,4 @@ zephyr_library_sources_ifdef(CONFIG_UDC_NXP_EHCI udc_mcux_ehci.c) zephyr_library_sources_ifdef(CONFIG_UDC_NXP_IP3511 udc_mcux_ip3511.c) zephyr_library_sources_ifdef(CONFIG_UDC_NUMAKER udc_numaker.c) zephyr_library_sources_ifdef(CONFIG_UDC_RPI_PICO udc_rpi_pico.c) +zephyr_library_sources_ifdef(CONFIG_UDC_AMBIQ udc_ambiq.c) diff --git a/drivers/usb/udc/Kconfig b/drivers/usb/udc/Kconfig index 39fcf3e4c950b..a88c5a1ddd94f 100644 --- a/drivers/usb/udc/Kconfig +++ b/drivers/usb/udc/Kconfig @@ -65,5 +65,6 @@ source "drivers/usb/udc/Kconfig.it82xx2" source "drivers/usb/udc/Kconfig.mcux" source "drivers/usb/udc/Kconfig.numaker" source "drivers/usb/udc/Kconfig.rpi_pico" +source "drivers/usb/udc/Kconfig.ambiq" endif # UDC_DRIVER diff --git a/drivers/usb/udc/Kconfig.ambiq b/drivers/usb/udc/Kconfig.ambiq new file mode 100644 index 0000000000000..93566cfbf5df5 --- /dev/null +++ b/drivers/usb/udc/Kconfig.ambiq @@ -0,0 +1,34 @@ +# Copyright (c) 2024 Ambiq Micro Inc. +# SPDX-License-Identifier: Apache-2.0 + +config UDC_AMBIQ + bool "USB device controller driver for ambiq devices" + default y + depends on DT_HAS_AMBIQ_USB_ENABLED + select GPIO + select AMBIQ_HAL + select AMBIQ_HAL_USE_USB + help + Enable USB Device Controller Driver. + +config UDC_AMBIQ_STACK_SIZE + int "UDC AMBIQ driver internal thread stack size" + depends on UDC_AMBIQ + default 2048 + help + AMBIQ driver internal thread stack size. + +config UDC_AMBIQ_THREAD_PRIORITY + int "UDC AMBIQ driver thread priority" + depends on UDC_AMBIQ + default 8 + help + AMBIQ driver thread priority. + + +config UDC_AMBIQ_MAX_QMESSAGES + int "UDC AMBIQ maximum number of ISR event messages" + range 4 64 + default 8 + help + AMBIQ maximum number of ISR event messages. diff --git a/drivers/usb/udc/udc_ambiq.c b/drivers/usb/udc/udc_ambiq.c new file mode 100644 index 0000000000000..887cb64cf6b3c --- /dev/null +++ b/drivers/usb/udc/udc_ambiq.c @@ -0,0 +1,968 @@ +/* + * Copyright 2024 Ambiq Micro Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include "am_mcu_apollo.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "udc_common.h" +#include + +LOG_MODULE_REGISTER(udc_ambiq, CONFIG_UDC_DRIVER_LOG_LEVEL); + +enum udc_ambiq_event_type { + /* SETUP packet received at Control Endpoint */ + UDC_AMBIQ_EVT_HAL_SETUP, + /* OUT transaction completed */ + UDC_AMBIQ_EVT_HAL_OUT_CMP, + /* IN transaction completed */ + UDC_AMBIQ_EVT_HAL_IN_CMP, + /* Xfer request received via udc_ambiq_ep_enqueue API */ + UDC_AMBIQ_EVT_XFER, +}; + +struct udc_ambiq_event { + const struct device *dev; + enum udc_ambiq_event_type type; + uint8_t ep; +}; + +K_MSGQ_DEFINE(drv_msgq, sizeof(struct udc_ambiq_event), CONFIG_UDC_AMBIQ_MAX_QMESSAGES, + sizeof(void *)); + +/* USB device controller access from devicetree */ +#define DT_DRV_COMPAT ambiq_usb + +#define EP0_MPS 64U +#define EP_FS_MPS 64U +#define EP_HS_MPS 512U + +struct udc_ambiq_data { + struct k_thread thread_data; + void *usb_handle; + am_hal_usb_dev_speed_e usb_speed; + uint8_t setup[8]; + uint8_t ctrl_pending_setup_buffer[8]; + bool ctrl_pending_in_ack; + bool ctrl_pending_setup; + bool ctrl_setup_recv_at_status_in; +}; + +struct udc_ambiq_config { + uint32_t num_endpoints; + int speed_idx; + struct udc_ep_config *ep_cfg_in; + struct udc_ep_config *ep_cfg_out; + struct gpio_dt_spec vddusb33_gpio; + struct gpio_dt_spec vddusb0p9_gpio; + void (*make_thread)(const struct device *dev); + void (*irq_enable_func)(const struct device *dev); + void (*irq_disable_func)(const struct device *dev); + void (*callback_register_func)(const struct device *dev); +}; + +static int udc_ambiq_rx(const struct device *dev, uint8_t ep, struct net_buf *buf); + +static int usbd_ctrl_feed_dout(const struct device *dev, const size_t length) +{ + struct udc_ep_config *cfg = udc_get_ep_cfg(dev, USB_CONTROL_EP_OUT); + struct net_buf *buf; + + buf = udc_ctrl_alloc(dev, USB_CONTROL_EP_OUT, length); + if (buf == NULL) { + return -ENOMEM; + } + + k_fifo_put(&cfg->fifo, buf); + if (length) { + udc_ambiq_rx(dev, cfg->addr, buf); + } + + return 0; +} + +static int udc_ambiq_tx(const struct device *dev, uint8_t ep, struct net_buf *buf) +{ + const struct udc_ambiq_data *priv = udc_get_private(dev); + uint32_t status; + + if (udc_ep_is_busy(dev, ep)) { + LOG_WRN("ep 0x%02x is busy!", ep); + return 0; + } + udc_ep_set_busy(dev, ep, true); + + /* buf equals NULL is used as indication of ZLP request */ + if (buf == NULL) { + status = am_hal_usb_ep_xfer(priv->usb_handle, ep, NULL, 0); + } else { + status = am_hal_usb_ep_xfer(priv->usb_handle, ep, buf->data, buf->len); + } + + if (status != AM_HAL_STATUS_SUCCESS) { + udc_ep_set_busy(dev, ep, false); + LOG_ERR("am_hal_usb_ep_xfer write failed(0x%02x), %d", ep, (int)status); + return -EIO; + } + + return 0; +} + +static int udc_ambiq_rx(const struct device *dev, uint8_t ep, struct net_buf *buf) +{ + struct udc_ambiq_data *priv = udc_get_private(dev); + struct udc_ep_config *cfg = udc_get_ep_cfg(dev, USB_CONTROL_EP_OUT); + uint32_t status; + uint16_t rx_size = buf->size; + + if (udc_ep_is_busy(dev, ep)) { + LOG_WRN("ep 0x%02x is busy!", ep); + return 0; + } + udc_ep_set_busy(dev, ep, true); + + /* Make sure that OUT transaction size triggered doesn't exceed EP's MPS */ + if ((ep != USB_CONTROL_EP_OUT) && (cfg->mps < rx_size)) { + rx_size = cfg->mps; + } + + status = am_hal_usb_ep_xfer(priv->usb_handle, ep, buf->data, rx_size); + if (status != AM_HAL_STATUS_SUCCESS) { + udc_ep_set_busy(dev, ep, false); + LOG_ERR("am_hal_usb_ep_xfer read(rx) failed(0x%02x), %d", ep, (int)status); + return -EIO; + } + + return 0; +} + +static void udc_ambiq_evt_callback(const struct device *dev, am_hal_usb_dev_event_e dev_state) +{ + struct udc_ambiq_data *priv = udc_get_private(dev); + + switch (dev_state) { + case AM_HAL_USB_DEV_EVT_BUS_RESET: + /* enable usb bus interrupts */ + am_hal_usb_intr_usb_enable(priv->usb_handle, + USB_CFG2_SOFE_Msk | USB_CFG2_ResumeE_Msk | + USB_CFG2_SuspendE_Msk | USB_CFG2_ResetE_Msk); + /* init the endpoint */ + am_hal_usb_ep_init(priv->usb_handle, 0, 0, EP0_MPS); + /* Set USB device speed to HAL */ + am_hal_usb_set_dev_speed(priv->usb_handle, priv->usb_speed); + LOG_INF("USB Reset event"); + /* Submit USB reset event to UDC */ + udc_submit_event(dev, UDC_EVT_RESET, 0); + break; + case AM_HAL_USB_DEV_EVT_RESUME: + /* Handle USB Resume event, then set device state to active */ + am_hal_usb_set_dev_state(priv->usb_handle, AM_HAL_USB_DEV_STATE_ACTIVE); + LOG_INF("RESUMING from suspend"); + udc_set_suspended(dev, false); + udc_submit_event(dev, UDC_EVT_RESUME, 0); + break; + case AM_HAL_USB_DEV_EVT_SOF: + udc_submit_event(dev, UDC_EVT_SOF, 0); + break; + case AM_HAL_USB_DEV_EVT_SUSPEND: + /* Handle USB Suspend event, then set device state to suspended */ + am_hal_usb_set_dev_state(priv->usb_handle, AM_HAL_USB_DEV_STATE_SUSPENDED); + udc_set_suspended(dev, true); + udc_submit_event(dev, UDC_EVT_SUSPEND, 0); + break; + default: + /* Unreachable case */ + break; + } +} + +static void udc_ambiq_ep0_setup_callback(const struct device *dev, uint8_t *usb_setup) +{ + struct udc_ambiq_event evt = {.type = UDC_AMBIQ_EVT_HAL_SETUP}; + struct udc_ambiq_data *priv = udc_get_private(dev); + + /* Defer Setup Packet that arrives when we are waiting for + * status stage for OUT data control transfer to be completed + */ + if (priv->ctrl_pending_in_ack) { + priv->ctrl_pending_setup = true; + memcpy(priv->ctrl_pending_setup_buffer, usb_setup, 8); + return; + } + + /* Check whether we received SETUP packet during OUT_ACK (a.k.a STATUS_IN) + * state. If so, it might be inversion caused by register reading sequence. + * Raise flag accordingly and handle later. + */ + priv->ctrl_setup_recv_at_status_in = udc_ctrl_stage_is_status_in(dev); + memcpy(priv->setup, usb_setup, sizeof(struct usb_setup_packet)); + k_msgq_put(&drv_msgq, &evt, K_NO_WAIT); +} + +static void udc_ambiq_ep_xfer_complete_callback(const struct device *dev, uint8_t ep_addr, + uint16_t xfer_len, am_hal_usb_xfer_code_e code, + void *param) +{ + struct net_buf *buf; + struct udc_ambiq_event evt; + + /* Extract EP information and queue event */ + evt.ep = ep_addr; + if (USB_EP_DIR_IS_IN(ep_addr)) { + evt.type = UDC_AMBIQ_EVT_HAL_IN_CMP; + } else { + buf = udc_buf_peek(dev, ep_addr); + if (buf == NULL) { + LOG_ERR("No buffer for ep 0x%02x", ep_addr); + udc_submit_event(dev, UDC_EVT_ERROR, -ENOBUFS); + return; + } + + net_buf_add(buf, xfer_len); + evt.type = UDC_AMBIQ_EVT_HAL_OUT_CMP; + } + + k_msgq_put(&drv_msgq, &evt, K_NO_WAIT); +} + +static enum udc_bus_speed udc_ambiq_device_speed(const struct device *dev) +{ + struct udc_ambiq_data *priv = udc_get_private(dev); + am_hal_usb_dev_speed_e e_speed = am_hal_get_usb_dev_speed(priv->usb_handle); + + if (e_speed == AM_HAL_USB_SPEED_HIGH) { + return UDC_BUS_SPEED_HS; + } else { + return UDC_BUS_SPEED_FS; + } +} + +static int udc_ambiq_ep_enqueue(const struct device *dev, struct udc_ep_config *ep_cfg, + struct net_buf *buf) +{ + struct udc_ambiq_data *priv = udc_get_private(dev); + struct udc_ambiq_event evt = { + .ep = ep_cfg->addr, + .type = UDC_AMBIQ_EVT_XFER, + }; + + LOG_DBG("%p enqueue %x %p", dev, ep_cfg->addr, buf); + udc_buf_put(ep_cfg, buf); + if (ep_cfg->addr == USB_CONTROL_EP_IN && buf->len == 0 && priv->ctrl_pending_in_ack) { + priv->ctrl_pending_in_ack = false; + udc_ambiq_ep_xfer_complete_callback(dev, USB_CONTROL_EP_IN, 0, 0, NULL); + return 0; + } + k_msgq_put(&drv_msgq, &evt, K_NO_WAIT); + + return 0; +} + +static int udc_ambiq_ep_dequeue(const struct device *dev, struct udc_ep_config *ep_cfg) +{ + unsigned int lock_key; + struct udc_ambiq_data *priv = udc_get_private(dev); + struct net_buf *buf; + + lock_key = irq_lock(); + + buf = udc_buf_get_all(dev, ep_cfg->addr); + if (buf) { + udc_submit_ep_event(dev, buf, -ECONNABORTED); + } + + udc_ep_set_busy(dev, ep_cfg->addr, false); + am_hal_usb_ep_state_reset(priv->usb_handle, ep_cfg->addr); + irq_unlock(lock_key); + + LOG_DBG("dequeue ep 0x%02x", ep_cfg->addr); + + return 0; +} + +static int udc_ambiq_ep_set_halt(const struct device *dev, struct udc_ep_config *ep_cfg) +{ + struct udc_ambiq_data *priv = udc_get_private(dev); + + LOG_DBG("Halt ep 0x%02x", ep_cfg->addr); + + am_hal_usb_ep_stall(priv->usb_handle, ep_cfg->addr); + + return 0; +} + +static int udc_ambiq_ep_clear_halt(const struct device *dev, struct udc_ep_config *ep_cfg) +{ + struct udc_ambiq_data *priv = udc_get_private(dev); + + LOG_DBG("Clear halt ep 0x%02x", ep_cfg->addr); + + am_hal_usb_ep_clear_stall(priv->usb_handle, ep_cfg->addr); + + return 0; +} + +static int udc_ambiq_ep_enable(const struct device *dev, struct udc_ep_config *ep_cfg) +{ + struct udc_ambiq_data *priv = udc_get_private(dev); + uint8_t endpoint_type; + uint32_t status; + + __ASSERT_NO_MSG(ep_cfg); + + switch (ep_cfg->attributes) { + case USB_EP_TYPE_CONTROL: + endpoint_type = 0; /* AM_HAL_USB_EP_XFER_CONTROL */ + break; + case USB_EP_TYPE_ISO: + endpoint_type = 1; /* AM_HAL_USB_EP_XFER_ISOCHRONOUS */ + break; + case USB_EP_TYPE_BULK: + endpoint_type = 2; /* AM_HAL_USB_EP_XFER_BULK */ + break; + case USB_EP_TYPE_INTERRUPT: + endpoint_type = 3; /* AM_HAL_USB_EP_XFER_INTERRUPT */ + break; + default: + return -EINVAL; + } + + status = am_hal_usb_ep_init(priv->usb_handle, ep_cfg->addr, endpoint_type, ep_cfg->mps); + if (status != AM_HAL_STATUS_SUCCESS) { + LOG_ERR("am_hal_usb_ep_init failed(0x%02x), %d", ep_cfg->addr, (int)status); + return -EIO; + } + + LOG_DBG("Enable ep 0x%02x", ep_cfg->addr); + + return 0; +} + +static int udc_ambiq_ep_disable(const struct device *dev, struct udc_ep_config *ep_cfg) +{ + struct udc_ambiq_data *priv = udc_get_private(dev); + + __ASSERT_NO_MSG(ep_cfg); + am_hal_usb_ep_state_reset(priv->usb_handle, ep_cfg->addr); + LOG_DBG("Disable ep 0x%02x", ep_cfg->addr); + + return 0; +} + +static int udc_ambiq_host_wakeup(const struct device *dev) +{ + struct udc_ambiq_data *priv = udc_get_private(dev); + + am_hal_usb_start_remote_wakeup(priv->usb_handle); + + return 0; +} + +static int udc_ambiq_set_address(const struct device *dev, const uint8_t addr) +{ + struct udc_ambiq_data *priv = udc_get_private(dev); + + LOG_DBG("addr %u (0x%02x)", addr, addr); + am_hal_usb_set_addr(priv->usb_handle, addr); + am_hal_usb_set_dev_state(priv->usb_handle, AM_HAL_USB_DEV_STATE_ADDRESSED); + + return 0; +} + +static int udc_ambiq_test_mode(const struct device *dev, const uint8_t mode, const bool dryrun) +{ + am_hal_usb_test_mode_e am_usb_test_mode; + struct udc_ambiq_data *priv = udc_get_private(dev); + + switch (mode) { + case USB_DWC2_DCTL_TSTCTL_TESTJ: + am_usb_test_mode = AM_HAL_USB_TEST_J; + break; + case USB_DWC2_DCTL_TSTCTL_TESTK: + am_usb_test_mode = AM_HAL_USB_TEST_K; + break; + case USB_DWC2_DCTL_TSTCTL_TESTSN: + am_usb_test_mode = AM_HAL_USB_TEST_SE0_NAK; + break; + case USB_DWC2_DCTL_TSTCTL_TESTPM: + am_usb_test_mode = AM_HAL_USB_TEST_PACKET; + break; + default: + return -EINVAL; + } + + if (dryrun) { + LOG_DBG("Test Mode %u supported", mode); + return 0; + } + + am_hal_usb_enter_test_mode(priv->usb_handle); + am_hal_usb_test_mode(priv->usb_handle, am_usb_test_mode); + + return 0; +} + +static int udc_ambiq_enable(const struct device *dev) +{ + struct udc_ambiq_data *priv = udc_get_private(dev); + + /* USB soft connect */ + am_hal_usb_attach(priv->usb_handle); + LOG_DBG("Enable UDC"); + + return 0; +} + +static int udc_ambiq_disable(const struct device *dev) +{ + unsigned int lock_key; + struct udc_ambiq_data *priv = udc_get_private(dev); + const struct udc_ambiq_config *cfg = dev->config; + + /* Disable USB interrupt */ + lock_key = irq_lock(); + cfg->irq_disable_func(dev); + irq_unlock(lock_key); + + /* Disable soft disconnect */ + am_hal_usb_detach(priv->usb_handle); + am_hal_usb_intr_usb_disable(priv->usb_handle, USB_CFG2_SOFE_Msk | USB_CFG2_ResumeE_Msk | + USB_CFG2_SuspendE_Msk | + USB_CFG2_ResetE_Msk); + am_hal_usb_intr_usb_clear(priv->usb_handle); + for (unsigned int i = 0; i < cfg->num_endpoints; i++) { + am_hal_usb_ep_state_reset(priv->usb_handle, i); + am_hal_usb_ep_state_reset(priv->usb_handle, BIT(7) | i); + } + LOG_DBG("Disable UDC"); + + return 0; +} + +static void udc_ambiq_usb_isr(const struct device *dev) +{ + struct udc_ambiq_data *priv = udc_get_private(dev); + uint32_t int_status[3]; + + am_hal_usb_intr_status_get(priv->usb_handle, &int_status[0], &int_status[1], + &int_status[2]); + am_hal_usb_interrupt_service(priv->usb_handle, int_status[0], int_status[1], int_status[2]); +} + +static int usb_power_rails_set(const struct device *dev, bool on) +{ + int ret = 0; + const struct udc_ambiq_config *cfg = dev->config; + + /* Check that both power control GPIO is defined */ + if ((cfg->vddusb33_gpio.port == NULL) || (cfg->vddusb0p9_gpio.port == NULL)) { + LOG_WRN("vddusb control gpio not defined"); + return -EINVAL; + } + + /* Enable USB IO */ + ret = gpio_pin_configure_dt(&cfg->vddusb33_gpio, GPIO_OUTPUT); + if (ret) { + return ret; + } + + ret = gpio_pin_configure_dt(&cfg->vddusb0p9_gpio, GPIO_OUTPUT); + if (ret) { + return ret; + } + + /* power rails set */ + ret = gpio_pin_set_dt(&cfg->vddusb33_gpio, on); + if (ret) { + return ret; + } + ret = gpio_pin_set_dt(&cfg->vddusb0p9_gpio, on); + if (ret) { + return ret; + } + am_hal_delay_us(50000); + + return 0; +} + +static int udc_ambiq_init(const struct device *dev) +{ + struct udc_ambiq_data *priv = udc_get_private(dev); + const struct udc_ambiq_config *cfg = dev->config; + uint32_t ret = 0; + + /* Create USB */ + if (am_hal_usb_initialize(0, (void *)&priv->usb_handle) != AM_HAL_STATUS_SUCCESS) { + return -EIO; + } + + /* Register callback functions */ + cfg->callback_register_func(dev); + /* enable internal power rail */ + am_hal_usb_power_control(priv->usb_handle, AM_HAL_SYSCTRL_WAKE, false); + /* Assert USB PHY reset in MCU control registers */ + am_hal_usb_enable_phy_reset_override(); + /* Enable the USB power rails */ + ret = usb_power_rails_set(dev, true); + if (ret) { + return ret; + } + /* Disable BC detection voltage source */ + am_hal_usb_hardware_unreset(); + /* Release USB PHY reset */ + am_hal_usb_disable_phy_reset_override(); + /* Set USB Speed */ + am_hal_usb_set_dev_speed(priv->usb_handle, priv->usb_speed); + /* Enable USB interrupt */ + am_hal_usb_intr_usb_enable(priv->usb_handle, USB_INTRUSB_Reset_Msk); + /* Enable Control Endpoints */ + if (udc_ep_enable_internal(dev, USB_CONTROL_EP_OUT, USB_EP_TYPE_CONTROL, EP0_MPS, 0)) { + LOG_ERR("Failed to enable control endpoint"); + return -EIO; + } + if (udc_ep_enable_internal(dev, USB_CONTROL_EP_IN, USB_EP_TYPE_CONTROL, EP0_MPS, 0)) { + LOG_ERR("Failed to enable control endpoint"); + return -EIO; + } + /* Connect and enable USB interrupt */ + cfg->irq_enable_func(dev); + + return 0; +} + +static int udc_ambiq_shutdown(const struct device *dev) +{ + struct udc_ambiq_data *priv = udc_get_private(dev); + const struct udc_ambiq_config *cfg = dev->config; + int ret = 0; + + LOG_INF("shutdown"); + + /* Disable Control Endpoints */ + if (udc_ep_disable_internal(dev, USB_CONTROL_EP_OUT)) { + LOG_ERR("Failed to disable control endpoint"); + return -EIO; + } + if (udc_ep_disable_internal(dev, USB_CONTROL_EP_IN)) { + LOG_ERR("Failed to disable control endpoint"); + return -EIO; + } + /* Disable USB interrupt */ + cfg->irq_disable_func(dev); + /* Assert USB PHY reset */ + am_hal_usb_enable_phy_reset_override(); + /* Disable the USB power rails */ + ret = usb_power_rails_set(dev, false); + if (ret) { + return ret; + } + /* Power down USB HAL */ + am_hal_usb_power_control(priv->usb_handle, AM_HAL_SYSCTRL_DEEPSLEEP, false); + /* Deinitialize USB instance */ + am_hal_usb_deinitialize(priv->usb_handle); + priv->usb_handle = NULL; + + return 0; +} + +static int udc_ambiq_lock(const struct device *dev) +{ + return udc_lock_internal(dev, K_FOREVER); +} + +static int udc_ambiq_unlock(const struct device *dev) +{ + return udc_unlock_internal(dev); +} + +static void ambiq_handle_evt_setup(const struct device *dev) +{ + struct udc_ambiq_data *priv = udc_get_private(dev); + struct net_buf *buf; + int err; + + /* Create network buffer for SETUP packet and pass into UDC framework */ + buf = udc_ctrl_alloc(dev, USB_CONTROL_EP_OUT, sizeof(struct usb_setup_packet)); + if (buf == NULL) { + LOG_ERR("Failed to allocate for setup"); + return; + } + net_buf_add_mem(buf, priv->setup, sizeof(priv->setup)); + udc_ep_buf_set_setup(buf); + LOG_HEXDUMP_DBG(buf->data, buf->len, "setup"); + + /* Update to next stage of control transfer */ + udc_ctrl_update_stage(dev, buf); + + if (udc_ctrl_stage_is_data_out(dev)) { + /* Allocate and feed buffer for data OUT stage */ + LOG_DBG("s:%p|feed for -out-", buf); + err = usbd_ctrl_feed_dout(dev, udc_data_stage_length(buf)); + priv->ctrl_pending_in_ack = true; + if (err == -ENOMEM) { + udc_submit_ep_event(dev, buf, err); + } + } else if (udc_ctrl_stage_is_data_in(dev)) { + /* Submit event for data IN stage */ + LOG_DBG("s:%p|feed for -in-status", buf); + udc_ctrl_submit_s_in_status(dev); + } else { + /* Submit event for no-data stage */ + LOG_DBG("s:%p|feed >setup", buf); + udc_ctrl_submit_s_status(dev); + } +} + +static inline void ambiq_handle_evt_dout(const struct device *dev, struct udc_ep_config *const cfg) +{ + struct net_buf *buf; + + /* retrieve endpoint buffer */ + buf = udc_buf_get(dev, cfg->addr); + if (buf == NULL) { + LOG_ERR("No buffer queued for control ep"); + return; + } + + /* Clear endpoint busy status */ + udc_ep_set_busy(dev, cfg->addr, false); + + /* Handle transfer complete event */ + if (cfg->addr == USB_CONTROL_EP_OUT) { + if (udc_ctrl_stage_is_status_out(dev)) { + udc_ctrl_update_stage(dev, buf); + udc_ctrl_submit_status(dev, buf); + } else { + udc_ctrl_update_stage(dev, buf); + } + + if (udc_ctrl_stage_is_status_in(dev)) { + udc_ctrl_submit_s_out_status(dev, buf); + } + } else { + udc_submit_ep_event(dev, buf, 0); + } +} + +static void ambiq_handle_zlp_tx(const struct device *dev, struct udc_ep_config *const cfg) +{ + udc_ambiq_tx(dev, cfg->addr, NULL); +} + +static void ambiq_handle_evt_din(const struct device *dev, struct udc_ep_config *const cfg) +{ + struct udc_ambiq_data *priv = udc_get_private(dev); + struct udc_data *data = dev->data; + struct net_buf *buf; + bool udc_ambiq_rx_status_in_completed = false; + + /* Clear endpoint busy status */ + udc_ep_set_busy(dev, cfg->addr, false); + /* Check and Handle ZLP flag */ + buf = udc_buf_peek(dev, cfg->addr); + if (cfg->addr != USB_CONTROL_EP_IN) { + if (udc_ep_buf_has_zlp(buf)) { + udc_ep_buf_clear_zlp(buf); + udc_ambiq_tx(dev, cfg->addr, NULL); + ambiq_handle_zlp_tx(dev, cfg); + return; + } + } + + /* retrieve endpoint buffer */ + buf = udc_buf_get(dev, cfg->addr); + if (buf == NULL) { + LOG_ERR("No buffer queued for control ep"); + return; + } + LOG_DBG("DataIn ep 0x%02x len %u", cfg->addr, buf->size); + + /* Handle transfer complete event */ + if (cfg->addr == USB_CONTROL_EP_IN) { + if (udc_ctrl_stage_is_status_in(dev) || udc_ctrl_stage_is_no_data(dev)) { + if (data->caps.out_ack == 0) { + /* Status stage finished, notify upper layer */ + udc_ctrl_submit_status(dev, buf); + } + + if (udc_ctrl_stage_is_status_in(dev)) { + udc_ambiq_rx_status_in_completed = true; + } + } + + if (priv->ctrl_setup_recv_at_status_in && (buf->len == 0)) { + priv->ctrl_setup_recv_at_status_in = false; + net_buf_unref(buf); + return; + } + priv->ctrl_setup_recv_at_status_in = false; + /* Update to next stage of control transfer */ + udc_ctrl_update_stage(dev, buf); + + if (((data->caps.out_ack == false) && udc_ctrl_stage_is_status_out(dev)) || + ((data->caps.out_ack == true) && (data->stage == CTRL_PIPE_STAGE_SETUP))) { + /* + * IN transfer finished, release buffer, + * control OUT buffer should be already fed. + */ + net_buf_unref(buf); + } + + /* + * Trigger deferred SETUP that was hold back if we are + * waiting for DATA_OUT status stage to be completed + */ + if (udc_ambiq_rx_status_in_completed && priv->ctrl_pending_setup) { + priv->ctrl_pending_setup = false; + udc_ambiq_ep0_setup_callback(dev, priv->ctrl_pending_setup_buffer); + } + } else { + udc_submit_ep_event(dev, buf, 0); + } +} + +static void udc_event_xfer(const struct device *dev, struct udc_ep_config *const cfg) +{ + struct net_buf *buf; + + buf = udc_buf_peek(dev, cfg->addr); + if (buf == NULL) { + LOG_ERR("No buffer for ep 0x%02x", cfg->addr); + return; + } + + if (USB_EP_DIR_IS_IN(cfg->addr)) { + udc_ambiq_tx(dev, cfg->addr, buf); + } else { + udc_ambiq_rx(dev, cfg->addr, buf); + } +} + +static ALWAYS_INLINE void ambiq_thread_handler(void *const arg) +{ + const struct device *dev = (const struct device *)arg; + struct udc_ep_config *ep_cfg; + struct udc_ambiq_event evt; + + while (true) { + k_msgq_get(&drv_msgq, &evt, K_FOREVER); + ep_cfg = udc_get_ep_cfg(dev, evt.ep); + + switch (evt.type) { + case UDC_AMBIQ_EVT_XFER: + udc_event_xfer(dev, ep_cfg); + break; + case UDC_AMBIQ_EVT_HAL_SETUP: + LOG_DBG("SETUP event"); + ambiq_handle_evt_setup(dev); + break; + case UDC_AMBIQ_EVT_HAL_OUT_CMP: + LOG_DBG("DOUT event ep 0x%02x", ep_cfg->addr); + ambiq_handle_evt_dout(dev, ep_cfg); + break; + case UDC_AMBIQ_EVT_HAL_IN_CMP: + LOG_DBG("DIN event"); + ambiq_handle_evt_din(dev, ep_cfg); + break; + default: + __ASSERT_NO_MSG(false); + break; + } + } +} + +/* + * This is called once to initialize the controller and endpoints + * capabilities, and register endpoint structures. + */ +static int udc_ambiq_driver_init(const struct device *dev) +{ + struct udc_ambiq_data *priv = udc_get_private(dev); + const struct udc_ambiq_config *cfg = dev->config; + struct udc_data *data = dev->data; + int ep_mps = 0; + int err; + + if (cfg->speed_idx == 1) { + data->caps.hs = false; + priv->usb_speed = AM_HAL_USB_SPEED_FULL; + ep_mps = EP_FS_MPS; + } else if ((cfg->speed_idx == 2)) { + data->caps.hs = true; + priv->usb_speed = AM_HAL_USB_SPEED_HIGH; + ep_mps = EP_HS_MPS; + } + + for (unsigned int i = 0; i < cfg->num_endpoints; i++) { + cfg->ep_cfg_out[i].caps.out = 1; + if (i == 0) { + cfg->ep_cfg_out[i].caps.control = 1; + cfg->ep_cfg_out[i].caps.mps = EP0_MPS; + } else { + cfg->ep_cfg_out[i].caps.bulk = 1; + cfg->ep_cfg_out[i].caps.interrupt = 1; + cfg->ep_cfg_out[i].caps.iso = 1; + cfg->ep_cfg_out[i].caps.mps = ep_mps; + } + + cfg->ep_cfg_out[i].addr = USB_EP_DIR_OUT | i; + err = udc_register_ep(dev, &cfg->ep_cfg_out[i]); + if (err != 0) { + LOG_ERR("Failed to register endpoint"); + return err; + } + } + + for (unsigned int i = 0; i < cfg->num_endpoints; i++) { + cfg->ep_cfg_in[i].caps.in = 1; + if (i == 0) { + cfg->ep_cfg_in[i].caps.control = 1; + cfg->ep_cfg_in[i].caps.mps = EP0_MPS; + } else { + cfg->ep_cfg_in[i].caps.bulk = 1; + cfg->ep_cfg_in[i].caps.interrupt = 1; + cfg->ep_cfg_in[i].caps.iso = 1; + cfg->ep_cfg_in[i].caps.mps = ep_mps; + } + + cfg->ep_cfg_in[i].addr = USB_EP_DIR_IN | i; + err = udc_register_ep(dev, &cfg->ep_cfg_in[i]); + if (err != 0) { + LOG_ERR("Failed to register endpoint"); + return err; + } + } + data->caps.addr_before_status = true; + data->caps.rwup = true; + data->caps.out_ack = true; + data->caps.mps0 = UDC_MPS0_64; + + cfg->make_thread(dev); + + return 0; +} + +static const struct udc_api udc_ambiq_api = { + .device_speed = udc_ambiq_device_speed, + .ep_enqueue = udc_ambiq_ep_enqueue, + .ep_dequeue = udc_ambiq_ep_dequeue, + .ep_set_halt = udc_ambiq_ep_set_halt, + .ep_clear_halt = udc_ambiq_ep_clear_halt, + .ep_try_config = NULL, + .ep_enable = udc_ambiq_ep_enable, + .ep_disable = udc_ambiq_ep_disable, + .host_wakeup = udc_ambiq_host_wakeup, + .set_address = udc_ambiq_set_address, + .test_mode = udc_ambiq_test_mode, + .enable = udc_ambiq_enable, + .disable = udc_ambiq_disable, + .init = udc_ambiq_init, + .shutdown = udc_ambiq_shutdown, + .lock = udc_ambiq_lock, + .unlock = udc_ambiq_unlock, +}; + +/* + * A UDC driver should always be implemented as a multi-instance + * driver, even if your platform does not require it. + */ +#define UDC_AMBIQ_DEVICE_DEFINE(n) \ + K_THREAD_STACK_DEFINE(udc_ambiq_stack_##n, CONFIG_UDC_AMBIQ_STACK_SIZE); \ + \ + static void udc_ambiq_evt_callback_##n(am_hal_usb_dev_event_e dev_state) \ + { \ + udc_ambiq_evt_callback(DEVICE_DT_INST_GET(n), dev_state); \ + } \ + \ + static void udc_ambiq_ep0_setup_callback_##n(uint8_t *usb_setup) \ + { \ + udc_ambiq_ep0_setup_callback(DEVICE_DT_INST_GET(n), usb_setup); \ + } \ + \ + static void udc_ambiq_ep_xfer_complete_callback_##n( \ + uint8_t ep_addr, uint16_t xfer_len, am_hal_usb_xfer_code_e code, void *param) \ + { \ + udc_ambiq_ep_xfer_complete_callback(DEVICE_DT_INST_GET(n), ep_addr, xfer_len, \ + code, param); \ + } \ + \ + static void udc_ambiq_register_callback_##n(const struct device *dev) \ + { \ + struct udc_ambiq_data *priv = udc_get_private(dev); \ + \ + am_hal_usb_register_dev_evt_callback(priv->usb_handle, \ + udc_ambiq_evt_callback_##n); \ + am_hal_usb_register_ep0_setup_received_callback(priv->usb_handle, \ + udc_ambiq_ep0_setup_callback_##n); \ + am_hal_usb_register_ep_xfer_complete_callback( \ + priv->usb_handle, udc_ambiq_ep_xfer_complete_callback_##n); \ + } \ + static void udc_ambiq_thread_##n(void *dev, void *arg1, void *arg2) \ + { \ + ambiq_thread_handler(dev); \ + } \ + \ + static void udc_ambiq_make_thread_##n(const struct device *dev) \ + { \ + struct udc_ambiq_data *priv = udc_get_private(dev); \ + \ + k_thread_create(&priv->thread_data, udc_ambiq_stack_##n, \ + K_THREAD_STACK_SIZEOF(udc_ambiq_stack_##n), udc_ambiq_thread_##n, \ + (void *)dev, NULL, NULL, \ + K_PRIO_COOP(CONFIG_UDC_AMBIQ_THREAD_PRIORITY), K_ESSENTIAL, \ + K_NO_WAIT); \ + k_thread_name_set(&priv->thread_data, dev->name); \ + } \ + \ + static void udc_ambiq_irq_enable_func_##n(const struct device *dev) \ + { \ + IRQ_CONNECT(DT_INST_IRQN(n), DT_INST_IRQ(n, priority), udc_ambiq_usb_isr, \ + DEVICE_DT_INST_GET(n), 0); \ + \ + irq_enable(DT_INST_IRQN(n)); \ + } \ + \ + static void udc_ambiq_irq_disable_func_##n(const struct device *dev) \ + { \ + irq_disable(DT_INST_IRQN(n)); \ + } \ + static struct udc_ep_config ep_cfg_out[DT_INST_PROP(n, num_bidir_endpoints)]; \ + static struct udc_ep_config ep_cfg_in[DT_INST_PROP(n, num_bidir_endpoints)]; \ + \ + static const struct udc_ambiq_config udc_ambiq_config_##n = { \ + .num_endpoints = DT_INST_PROP(n, num_bidir_endpoints), \ + .ep_cfg_in = ep_cfg_out, \ + .ep_cfg_out = ep_cfg_in, \ + .speed_idx = DT_ENUM_IDX(DT_DRV_INST(n), maximum_speed), \ + .vddusb33_gpio = GPIO_DT_SPEC_GET_OR(DT_DRV_INST(n), vddusb33_gpios, {0}), \ + .vddusb0p9_gpio = GPIO_DT_SPEC_GET_OR(DT_DRV_INST(n), vddusb0p9_gpios, {0}), \ + .irq_enable_func = udc_ambiq_irq_enable_func_##n, \ + .irq_disable_func = udc_ambiq_irq_disable_func_##n, \ + .make_thread = udc_ambiq_make_thread_##n, \ + .callback_register_func = udc_ambiq_register_callback_##n, \ + }; \ + \ + static struct udc_ambiq_data udc_priv_##n = {}; \ + \ + static struct udc_data udc_data_##n = { \ + .mutex = Z_MUTEX_INITIALIZER(udc_data_##n.mutex), \ + .priv = &udc_priv_##n, \ + }; \ + \ + DEVICE_DT_INST_DEFINE(n, udc_ambiq_driver_init, NULL, &udc_data_##n, \ + &udc_ambiq_config_##n, POST_KERNEL, \ + CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &udc_ambiq_api); + +DT_INST_FOREACH_STATUS_OKAY(UDC_AMBIQ_DEVICE_DEFINE) diff --git a/modules/hal_ambiq/Kconfig b/modules/hal_ambiq/Kconfig index e5932b474f4c3..1f48cbb4f7644 100644 --- a/modules/hal_ambiq/Kconfig +++ b/modules/hal_ambiq/Kconfig @@ -70,4 +70,9 @@ config AMBIQ_HAL_USE_ADC help Use the ADC driver from Ambiq HAL +config AMBIQ_HAL_USE_USB + bool + help + Use the USB driver from Ambiq HAL + endif # AMBIQ_HAL From 0facdd834fa7a8e2e92b95ec48ac99ff4a49ab94 Mon Sep 17 00:00:00 2001 From: Chew Zeh Yang Date: Wed, 23 Oct 2024 12:17:25 +0800 Subject: [PATCH 2556/4482] boards: ambiq: apollo4p: Add USB nodes Add USB node to apollo4p and apollo4p_blue qualifier, and apollo4p_evb and apollo4p_blue_kxr_evb board to enableUSB support on the MCU and its EVB. Signed-off-by: Chew Zeh Yang --- .../apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts | 6 ++++++ .../apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.yaml | 1 + boards/ambiq/apollo4p_evb/apollo4p_evb.dts | 6 ++++++ boards/ambiq/apollo4p_evb/apollo4p_evb.yaml | 1 + dts/arm/ambiq/ambiq_apollo4p.dtsi | 10 ++++++++++ dts/arm/ambiq/ambiq_apollo4p_blue.dtsi | 10 ++++++++++ 6 files changed, 34 insertions(+) diff --git a/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts b/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts index 9f74b65ea34ae..02a6aa55c7413 100644 --- a/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts +++ b/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts @@ -137,6 +137,12 @@ status = "okay"; }; +zephyr_udc0: &usb { + vddusb33-gpios = <&gpio0_31 13 (GPIO_PULL_UP)>; + vddusb0p9-gpios = <&gpio0_31 15 (GPIO_PULL_UP)>; + status = "okay"; +}; + &gpio0_31 { status = "okay"; }; diff --git a/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.yaml b/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.yaml index d9e9f244d861a..a1e0378d592cb 100644 --- a/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.yaml +++ b/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.yaml @@ -16,6 +16,7 @@ supported: - i2c - clock_control - ble + - usbd testing: ignore_tags: - net diff --git a/boards/ambiq/apollo4p_evb/apollo4p_evb.dts b/boards/ambiq/apollo4p_evb/apollo4p_evb.dts index 4ef4d94534869..7710eb287e890 100644 --- a/boards/ambiq/apollo4p_evb/apollo4p_evb.dts +++ b/boards/ambiq/apollo4p_evb/apollo4p_evb.dts @@ -143,6 +143,12 @@ compatible = "ambiq,adc"; }; }; +zephyr_udc0: &usb { + vddusb33-gpios = <&gpio96_127 7 (GPIO_PULL_UP)>; + vddusb0p9-gpios = <&gpio96_127 5 (GPIO_PULL_UP)>; + status = "okay"; +}; + &gpio0_31 { status = "okay"; }; diff --git a/boards/ambiq/apollo4p_evb/apollo4p_evb.yaml b/boards/ambiq/apollo4p_evb/apollo4p_evb.yaml index 1b7b54a71e652..b54f5d4150c0b 100644 --- a/boards/ambiq/apollo4p_evb/apollo4p_evb.yaml +++ b/boards/ambiq/apollo4p_evb/apollo4p_evb.yaml @@ -17,6 +17,7 @@ supported: - rtc - adc - hwinfo + - usbd testing: ignore_tags: - net diff --git a/dts/arm/ambiq/ambiq_apollo4p.dtsi b/dts/arm/ambiq/ambiq_apollo4p.dtsi index bfd25825fa0dd..0688913cc20a8 100644 --- a/dts/arm/ambiq/ambiq_apollo4p.dtsi +++ b/dts/arm/ambiq/ambiq_apollo4p.dtsi @@ -338,6 +338,16 @@ status = "disabled"; }; + usb: usb@400b0000 { + compatible = "ambiq,usb"; + reg = <0x400B0000 0x4100>; + interrupts = <27 0>; + num-bidir-endpoints = <6>; + maximum-speed = "full-speed"; + status = "disabled"; + ambiq,pwrcfg = <&pwrcfg 0x4 0x400000>; + }; + pinctrl: pin-controller@40010000 { compatible = "ambiq,apollo4-pinctrl"; reg = <0x40010000 0x800>; diff --git a/dts/arm/ambiq/ambiq_apollo4p_blue.dtsi b/dts/arm/ambiq/ambiq_apollo4p_blue.dtsi index 2e438a2940a7a..9fd6beacfad20 100644 --- a/dts/arm/ambiq/ambiq_apollo4p_blue.dtsi +++ b/dts/arm/ambiq/ambiq_apollo4p_blue.dtsi @@ -313,6 +313,16 @@ ambiq,pwrcfg = <&pwrcfg 0x4 0x10000>; }; + usb: usb@400b0000 { + compatible = "ambiq,usb"; + reg = <0x400B0000 0x4100>; + interrupts = <27 0>; + num-bidir-endpoints = <6>; + maximum-speed = "full-speed"; + status = "disabled"; + ambiq,pwrcfg = <&pwrcfg 0x4 0x400000>; + }; + pinctrl: pin-controller@40010000 { compatible = "ambiq,apollo4-pinctrl"; reg = <0x40010000 0x800>; From 7c2478e547cf6fe3efd0d7140420d9f565a7e9a8 Mon Sep 17 00:00:00 2001 From: Dino Li Date: Mon, 7 Oct 2024 13:52:45 +0800 Subject: [PATCH 2557/4482] espi/it8xxx2: supports host command interrupt requested by custom opcode Enables or disables host command interrupt when ECUSTOM_HOST_SUBS_INTERRUPT_EN opcode is requested. Signed-off-by: Dino Li --- drivers/espi/espi_it8xxx2.c | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/drivers/espi/espi_it8xxx2.c b/drivers/espi/espi_it8xxx2.c index 3af7293a87927..6135086e3bd2e 100644 --- a/drivers/espi/espi_it8xxx2.c +++ b/drivers/espi/espi_it8xxx2.c @@ -503,7 +503,9 @@ static void pmc1_it8xxx2_init(const struct device *dev) pmc_reg->PM1CTL |= PMC_PM1CTL_IBFIE; IRQ_CONNECT(IT8XXX2_PMC1_IBF_IRQ, 0, pmc1_it8xxx2_ibf_isr, DEVICE_DT_INST_GET(0), 0); - irq_enable(IT8XXX2_PMC1_IBF_IRQ); + if (!IS_ENABLED(CONFIG_ESPI_PERIPHERAL_CUSTOM_OPCODE)) { + irq_enable(IT8XXX2_PMC1_IBF_IRQ); + } } #endif @@ -579,7 +581,9 @@ static void pmc2_it8xxx2_init(const struct device *dev) pmc_reg->PM2CTL |= PMC_PM2CTL_IBFIE; IRQ_CONNECT(IT8XXX2_PMC2_IBF_IRQ, 0, pmc2_it8xxx2_ibf_isr, DEVICE_DT_INST_GET(0), 0); - irq_enable(IT8XXX2_PMC2_IBF_IRQ); + if (!IS_ENABLED(CONFIG_ESPI_PERIPHERAL_CUSTOM_OPCODE)) { + irq_enable(IT8XXX2_PMC2_IBF_IRQ); + } } #endif @@ -744,6 +748,28 @@ static int espi_it8xxx2_receive_vwire(const struct device *dev, return 0; } +#ifdef CONFIG_ESPI_PERIPHERAL_CUSTOM_OPCODE +static void host_custom_opcode_enable_interrupts(void) +{ + if (IS_ENABLED(CONFIG_ESPI_PERIPHERAL_HOST_IO)) { + irq_enable(IT8XXX2_PMC1_IBF_IRQ); + } + if (IS_ENABLED(CONFIG_ESPI_PERIPHERAL_EC_HOST_CMD)) { + irq_enable(IT8XXX2_PMC2_IBF_IRQ); + } +} + +static void host_custom_opcode_disable_interrupts(void) +{ + if (IS_ENABLED(CONFIG_ESPI_PERIPHERAL_HOST_IO)) { + irq_disable(IT8XXX2_PMC1_IBF_IRQ); + } + if (IS_ENABLED(CONFIG_ESPI_PERIPHERAL_EC_HOST_CMD)) { + irq_disable(IT8XXX2_PMC2_IBF_IRQ); + } +} +#endif /* CONFIG_ESPI_PERIPHERAL_CUSTOM_OPCODE */ + static int espi_it8xxx2_manage_callback(const struct device *dev, struct espi_callback *callback, bool set) { @@ -921,12 +947,12 @@ static int espi_it8xxx2_write_lpc_request(const struct device *dev, (struct pmc_regs *)config->base_pmc; switch (op) { - /* Enable/Disable PMC1 (port 62h/66h) interrupt */ + /* Enable/Disable PMCx interrupt */ case ECUSTOM_HOST_SUBS_INTERRUPT_EN: if (*data) { - irq_enable(IT8XXX2_PMC1_IBF_IRQ); + host_custom_opcode_enable_interrupts(); } else { - irq_disable(IT8XXX2_PMC1_IBF_IRQ); + host_custom_opcode_disable_interrupts(); } break; case ECUSTOM_HOST_CMD_SEND_RESULT: From f754e09dcd14a2edffc7ffb72cd65bdf0ed17b57 Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Wed, 16 Oct 2024 11:18:24 +0300 Subject: [PATCH 2558/4482] dma: dma_nxp_edma: drop the `hal-cfg-index` property The HAL configuration binding can be done dynamically based on the IP's address space. The `hal-cfg-index` property is more tied to software rather than hardware so remove it as an attempt to clean up the binding. Signed-off-by: Laurentiu Mihalcea --- drivers/dma/dma_nxp_edma.c | 19 ++++++++++++++++++- drivers/dma/dma_nxp_edma.h | 5 ----- dts/arm64/nxp/nxp_mimx93_a55.dtsi | 1 - dts/bindings/dma/nxp,edma.yaml | 16 ---------------- 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/drivers/dma/dma_nxp_edma.c b/drivers/dma/dma_nxp_edma.c index 93484bd5e7342..7d4f6e8b44958 100644 --- a/drivers/dma/dma_nxp_edma.c +++ b/drivers/dma/dma_nxp_edma.c @@ -604,6 +604,19 @@ static const struct dma_driver_api edma_api = { .chan_filter = edma_channel_filter, }; +static edma_config_t *edma_hal_cfg_get(const struct edma_config *cfg) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(s_edmaConfigs); i++) { + if (cfg->regmap_phys == s_edmaConfigs[i].regmap) { + return s_edmaConfigs + i; + } + } + + return NULL; +} + static int edma_init(const struct device *dev) { const struct edma_config *cfg; @@ -613,6 +626,11 @@ static int edma_init(const struct device *dev) data = dev->data; cfg = dev->config; + data->hal_cfg = edma_hal_cfg_get(cfg); + if (!data->hal_cfg) { + return -ENODEV; + } + /* map instance MMIO */ device_map(®map, cfg->regmap_phys, cfg->regmap_size, K_MEM_CACHE_NONE); @@ -678,7 +696,6 @@ static struct edma_config edma_config_##inst = { \ static struct edma_data edma_data_##inst = { \ .channels = channels_##inst, \ .ctx.magic = DMA_MAGIC, \ - .hal_cfg = &EDMA_HAL_CFG_GET(inst), \ }; \ \ DEVICE_DT_INST_DEFINE(inst, &edma_init, NULL, \ diff --git a/drivers/dma/dma_nxp_edma.h b/drivers/dma/dma_nxp_edma.h index ca345ad3fbe1e..f45740d981d21 100644 --- a/drivers/dma/dma_nxp_edma.h +++ b/drivers/dma/dma_nxp_edma.h @@ -88,11 +88,6 @@ LOG_MODULE_REGISTER(nxp_edma); (_EDMA_CHANNEL_ARRAY_EXPLICIT(inst)), \ (_EDMA_CHANNEL_ARRAY(inst))) -#define EDMA_HAL_CFG_GET(inst) \ - COND_CODE_1(DT_NODE_HAS_PROP(DT_INST(inst, DT_DRV_COMPAT), hal_cfg_index), \ - (s_edmaConfigs[DT_INST_PROP(inst, hal_cfg_index)]), \ - (s_edmaConfigs[0])) - /* used to register edma_isr for all specified interrupts */ #define EDMA_CONNECT_INTERRUPTS(inst) \ FOR_EACH_FIXED_ARG(_EDMA_INT_CONNECT, (;), \ diff --git a/dts/arm64/nxp/nxp_mimx93_a55.dtsi b/dts/arm64/nxp/nxp_mimx93_a55.dtsi index abc12cffee688..cedba4ebdc380 100644 --- a/dts/arm64/nxp/nxp_mimx93_a55.dtsi +++ b/dts/arm64/nxp/nxp_mimx93_a55.dtsi @@ -359,7 +359,6 @@ interrupts = , ; #dma-cells = <2>; - hal-cfg-index = <1>; status = "disabled"; }; diff --git a/dts/bindings/dma/nxp,edma.yaml b/dts/bindings/dma/nxp,edma.yaml index 37a5bcc3cac38..d5c58f624adc3 100644 --- a/dts/bindings/dma/nxp,edma.yaml +++ b/dts/bindings/dma/nxp,edma.yaml @@ -23,22 +23,6 @@ properties: and "dma-channels" are mutually exclusive, meaning you can't specify both properties as this will lead to a BUILD_ASSERT() failure. - hal-cfg-index: - type: int - description: | - Use this property to specify which HAL configuration - should be used. In the case of some SoCs (e.g: i.MX93), - there can be multiple eDMA variants, each of them having - different configurations (e.g: i.MX93 eDMA3 has 31 channels, - i.MX93 eDMA4 has 64 channels and both of them have slightly - different register layouts). To overcome this issue, the HAL - exposes an array of configurations called "edma_hal_configs". - To perform various operations, the HAL uses an eDMA configuration - which will tell it what register layout the IP has, the number of - channels, various flags and offsets. As such, if there's multiple - configurations available, the user will have to specify which - configuration to use through this property. If missing, the - configuration found at index 0 will be used. "#dma-cells": const: 2 From cfdaa91ff6bbf6904b1f7f61eabe204acfa5612c Mon Sep 17 00:00:00 2001 From: Jakub Wasilewski Date: Wed, 21 Aug 2024 18:19:21 +0200 Subject: [PATCH 2559/4482] drivers: eeprom: add mb85rsm1t fram support Add a driver for the MB85RSM1T FRAM chip. Signed-off-by: Jakub Wasilewski Signed-off-by: Filip Kokosinski --- drivers/eeprom/CMakeLists.txt | 2 + drivers/eeprom/Kconfig | 1 + drivers/eeprom/Kconfig.mb85rsxx | 10 + drivers/eeprom/eeprom_mb85rsxx.c | 318 +++++++++++++++++++++ dts/bindings/mtd/fujitsu,mb85rsxx.yaml | 13 + tests/drivers/build_all/eeprom/app.overlay | 10 + 6 files changed, 354 insertions(+) create mode 100644 drivers/eeprom/Kconfig.mb85rsxx create mode 100644 drivers/eeprom/eeprom_mb85rsxx.c create mode 100644 dts/bindings/mtd/fujitsu,mb85rsxx.yaml diff --git a/drivers/eeprom/CMakeLists.txt b/drivers/eeprom/CMakeLists.txt index 4b148e9f1a23b..c7b5f65c21ff1 100644 --- a/drivers/eeprom/CMakeLists.txt +++ b/drivers/eeprom/CMakeLists.txt @@ -26,3 +26,5 @@ zephyr_library_sources_ifdef(CONFIG_EEPROM_FAKE eeprom_fake.c) zephyr_library_sources_ifdef(CONFIG_EEPROM_AT2X_EMUL eeprom_at2x_emul.c) zephyr_library_sources_ifdef(CONFIG_EEPROM_MB85RCXX eeprom_mb85rcxx.c) + +zephyr_library_sources_ifdef(CONFIG_EEPROM_MB85RSXX eeprom_mb85rsxx.c) diff --git a/drivers/eeprom/Kconfig b/drivers/eeprom/Kconfig index 87733d2c2e1ce..cf1cefb550540 100644 --- a/drivers/eeprom/Kconfig +++ b/drivers/eeprom/Kconfig @@ -99,6 +99,7 @@ source "drivers/eeprom/Kconfig.eeprom_emu" source "drivers/eeprom/Kconfig.tmp116" source "drivers/eeprom/Kconfig.xec" source "drivers/eeprom/Kconfig.mb85rcxx" +source "drivers/eeprom/Kconfig.mb85rsxx" config EEPROM_SIMULATOR bool "Simulated EEPROM driver" diff --git a/drivers/eeprom/Kconfig.mb85rsxx b/drivers/eeprom/Kconfig.mb85rsxx new file mode 100644 index 0000000000000..53bef99a1a8a5 --- /dev/null +++ b/drivers/eeprom/Kconfig.mb85rsxx @@ -0,0 +1,10 @@ +# Copyright (c) 2024 Antmicro +# SPDX-License-Identifier: Apache-2.0 + +config EEPROM_MB85RSXX + bool "FUJITSU MB85RSXX SPI FRAM" + default y + depends on DT_HAS_FUJITSU_MB85RSXX_ENABLED + select SPI + help + Enable FUJITSU mb85rsxx SPI FRAM diff --git a/drivers/eeprom/eeprom_mb85rsxx.c b/drivers/eeprom/eeprom_mb85rsxx.c new file mode 100644 index 0000000000000..70891a28e92a7 --- /dev/null +++ b/drivers/eeprom/eeprom_mb85rsxx.c @@ -0,0 +1,318 @@ +/* + * Copyright (c) 2024 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file + * @brief Driver for Fujitsu MB85RSXX FRAM over SPI. + */ + +#define DT_DRV_COMPAT fujitsu_mb85rsxx + +#include +#include +#include +#include +#include + +#include +LOG_MODULE_REGISTER(mb85rsxx, CONFIG_EEPROM_LOG_LEVEL); + +/* MB85RSXX instruction set */ +#define EEPROM_MB85RSXX_WREN 0x06U /* Set Write Enable Latch */ +#define EEPROM_MB85RSXX_WRDI 0x04U /* Reset Write Enable Latch */ +#define EEPROM_MB85RSXX_RDSR 0x05U /* Read Status Register */ +#define EEPROM_MB85RSXX_WRSR 0x01U /* Write Status Register */ +#define EEPROM_MB85RSXX_READ 0x03U /* Read Memory Code */ +#define EEPROM_MB85RSXX_WRITE 0x02U /* Write Memory Code */ +#define EEPROM_MB85RSXX_RDID 0x9FU /* Read Device ID */ +#define EEPROM_MB85RSXX_FSTRD 0x0BU /* Fast Read Memory Code */ +#define EEPROM_MB85RSXX_SLEEP 0xB9U /* Sleep Mode */ + +/* MB85RSXX status register bits */ +#define EEPROM_MB85RSXX_STATUS_WPEN BIT(7) /* Status Register Write Protect (RW) */ +#define EEPROM_MB85RSXX_STATUS_BP1 BIT(3) /* Block protection 1 (RW) */ +#define EEPROM_MB85RSXX_STATUS_BP0 BIT(2) /* Block protection 2 (RW) */ +#define EEPROM_MB85RSXX_STATUS_WEL BIT(1) /* Write Enable Latch (RO) */ + +/* Fujitsu manufacturer ID (2 bytes) */ +#define EEPROM_MB85RSXX_MAN_ID 0x04U +#define EEPROM_MB85RSXX_CON_CODE 0x7FU + +/* + * MB85RSXX product ID (2 bytes); first byte provides memory size, so let's use a mask later when + * checking it + */ +#define EEPROM_MB85RSXX_PROD_ID 0x20U +#define EEPROM_MB85RSXX_PROD_ID2 0x03U +#define EEPROM_MB85RSXX_PROD_MASK GENMASK(7, 5) + +struct eeprom_mb85rsxx_config { + struct spi_dt_spec spi; + size_t size; + bool readonly; +}; + +struct eeprom_mb85rsxx_data { + struct k_mutex lock; +}; + +static int eeprom_mb85rsxx_read(const struct device *dev, off_t offset, void *buf, size_t len) +{ + const struct eeprom_mb85rsxx_config *config = dev->config; + struct eeprom_mb85rsxx_data *data = dev->data; + uint8_t cmd[4] = {EEPROM_MB85RSXX_READ, 0, 0, 0}; + uint8_t *paddr = &cmd[1]; + int err; + + if (offset + len > config->size) { + LOG_ERR("attempt to read past device boundary"); + return -EINVAL; + } + + if (!len) { + return 0; + } + + /* Populate address in command */ + *paddr++ = (offset >> 16); + *paddr++ = (offset >> 8); + *paddr++ = offset; + + const struct spi_buf tx_buf = { + .buf = cmd, + .len = sizeof(cmd), + }; + const struct spi_buf_set tx = { + .buffers = &tx_buf, + .count = 1, + }; + const struct spi_buf rx_bufs[2] = { + { + .buf = NULL, + .len = sizeof(cmd), + }, + { + .buf = buf, + .len = len, + }, + }; + const struct spi_buf_set rx = { + .buffers = rx_bufs, + .count = ARRAY_SIZE(rx_bufs), + }; + + k_mutex_lock(&data->lock, K_FOREVER); + + err = spi_transceive_dt(&config->spi, &tx, &rx); + + k_mutex_unlock(&data->lock); + + if (err < 0) { + LOG_ERR("failed to read FRAM (err %d)", err); + } + + return err; +} + +static int eeprom_mb85rsxx_wren(const struct device *dev) +{ + const struct eeprom_mb85rsxx_config *config = dev->config; + uint8_t cmd = EEPROM_MB85RSXX_WREN; + const struct spi_buf tx_buf = { + .buf = &cmd, + .len = sizeof(cmd), + }; + const struct spi_buf_set tx = { + .buffers = &tx_buf, + .count = 1, + }; + + return spi_write_dt(&config->spi, &tx); +} + +static int eeprom_mb85rsxx_wrdi(const struct device *dev) +{ + const struct eeprom_mb85rsxx_config *config = dev->config; + uint8_t cmd = EEPROM_MB85RSXX_WRDI; + const struct spi_buf tx_buf = { + .buf = &cmd, + .len = sizeof(cmd), + }; + const struct spi_buf_set tx = { + .buffers = &tx_buf, + .count = 1, + }; + + return spi_write_dt(&config->spi, &tx); +} + +static int eeprom_mb85rsxx_write(const struct device *dev, off_t offset, const void *buf, + size_t len) +{ + const struct eeprom_mb85rsxx_config *config = dev->config; + struct eeprom_mb85rsxx_data *data = dev->data; + uint8_t cmd[4] = {EEPROM_MB85RSXX_WRITE, 0, 0, 0}; + uint8_t *paddr = &cmd[1]; + int err; + + if (config->readonly) { + LOG_ERR("attempt to write to read-only device"); + return -EACCES; + } + + if (offset + len > config->size) { + LOG_ERR("attempt to write past device boundary"); + return -EINVAL; + } + + /* Populate address in command */ + *paddr++ = (offset >> 16) & 0xFF; + *paddr++ = (offset >> 8) & 0xFF; + *paddr++ = offset & 0xFF; + + const struct spi_buf tx_bufs[2] = { + { + .buf = cmd, + .len = sizeof(cmd), + }, + { + .buf = (void *)buf, + .len = len, + }, + }; + const struct spi_buf_set tx = { + .buffers = tx_bufs, + .count = ARRAY_SIZE(tx_bufs), + }; + + k_mutex_lock(&data->lock, K_FOREVER); + + err = eeprom_mb85rsxx_wren(dev); + if (err < 0) { + LOG_ERR("failed to disable write protection (err %d)", err); + k_mutex_unlock(&data->lock); + return err; + } + + err = spi_write_dt(&config->spi, &tx); + if (err < 0) { + LOG_ERR("failed to write to FRAM (err %d)", err); + k_mutex_unlock(&data->lock); + return err; + } + + err = eeprom_mb85rsxx_wrdi(dev); + if (err < 0) { + LOG_ERR("failed to disable write (err %d)", err); + } + + k_mutex_unlock(&data->lock); + + return err; +} + +static size_t eeprom_mb85rsxx_size(const struct device *dev) +{ + const struct eeprom_mb85rsxx_config *config = dev->config; + + return config->size; +} + +static int eeprom_mb85rsxx_rdid(const struct device *dev) +{ + const struct eeprom_mb85rsxx_config *config = dev->config; + struct eeprom_mb85rsxx_data *data = dev->data; + uint8_t id[4]; + uint8_t cmd = EEPROM_MB85RSXX_RDID; + int err; + + const struct spi_buf tx_buf = { + .buf = &cmd, + .len = sizeof(cmd), + }; + const struct spi_buf_set tx = { + .buffers = &tx_buf, + .count = 1, + }; + const struct spi_buf rx_bufs[2] = { + { + .buf = NULL, + .len = sizeof(cmd), + }, + { + .buf = id, + .len = sizeof(id), + }, + }; + const struct spi_buf_set rx = { + .buffers = rx_bufs, + .count = ARRAY_SIZE(rx_bufs), + }; + k_mutex_lock(&data->lock, K_FOREVER); + err = spi_transceive_dt(&config->spi, &tx, &rx); + k_mutex_unlock(&data->lock); + + if (err < 0) { + LOG_ERR("failed to read RDID (err %d)", err); + return err; + } + + /* Validate Manufacturer ID and Product ID */ + if (id[0] != EEPROM_MB85RSXX_MAN_ID + || id[1] != EEPROM_MB85RSXX_CON_CODE + || (id[2] & EEPROM_MB85RSXX_PROD_MASK) != EEPROM_MB85RSXX_PROD_ID + || id[3] != EEPROM_MB85RSXX_PROD_ID2) { + LOG_ERR("invalid device ID: %02X %02X %02X %02X", id[0], id[1], id[2], id[3]); + return -EIO; + } + + LOG_INF("device ID read successfully: %02X %02X %02X %02X", id[0], id[1], id[2], id[3]); + return 0; +} + +static int eeprom_mb85rsxx_init(const struct device *dev) +{ + const struct eeprom_mb85rsxx_config *config = dev->config; + struct eeprom_mb85rsxx_data *data = dev->data; + int err; + + k_mutex_init(&data->lock); + + if (!spi_is_ready_dt(&config->spi)) { + LOG_ERR("SPI bus not ready"); + return -EINVAL; + } + + err = eeprom_mb85rsxx_rdid(dev); + if (err < 0) { + LOG_ERR("Failed to initialize device, RDID check failed (err %d)", err); + return err; + } + + return 0; +} + +static const struct eeprom_driver_api mb85rsxx_driver_api = { + .read = &eeprom_mb85rsxx_read, + .write = &eeprom_mb85rsxx_write, + .size = &eeprom_mb85rsxx_size, +}; + +#define MB85RSXX_INIT(inst) \ + static struct eeprom_mb85rsxx_data eeprom_mb85rsxx_data_##inst; \ + \ + static const struct eeprom_mb85rsxx_config eeprom_mb85rsxx_config_##inst = { \ + .spi = SPI_DT_SPEC_INST_GET( \ + inst, SPI_OP_MODE_MASTER | SPI_TRANSFER_MSB | SPI_WORD_SET(8), 0), \ + .size = DT_INST_PROP(inst, size), \ + .readonly = DT_INST_PROP(inst, read_only), \ + }; \ + \ + DEVICE_DT_INST_DEFINE(inst, eeprom_mb85rsxx_init, NULL, &eeprom_mb85rsxx_data_##inst, \ + &eeprom_mb85rsxx_config_##inst, POST_KERNEL, \ + CONFIG_EEPROM_INIT_PRIORITY, &mb85rsxx_driver_api); + +DT_INST_FOREACH_STATUS_OKAY(MB85RSXX_INIT) diff --git a/dts/bindings/mtd/fujitsu,mb85rsxx.yaml b/dts/bindings/mtd/fujitsu,mb85rsxx.yaml new file mode 100644 index 0000000000000..0c41ce174c2c7 --- /dev/null +++ b/dts/bindings/mtd/fujitsu,mb85rsxx.yaml @@ -0,0 +1,13 @@ +# Copyright (c) 2024 Antmicro +# SPDX-License-Identifier: Apache-2.0 + +description: Fujitsu MB85RSXX SPI FRAM + +compatible: "fujitsu,mb85rsxx" + +include: ["eeprom-base.yaml", spi-device.yaml] + +properties: + size: + required: true + description: Total FRAM size in bytes. diff --git a/tests/drivers/build_all/eeprom/app.overlay b/tests/drivers/build_all/eeprom/app.overlay index b861c382ff4da..97b39a66664fc 100644 --- a/tests/drivers/build_all/eeprom/app.overlay +++ b/tests/drivers/build_all/eeprom/app.overlay @@ -10,6 +10,9 @@ * (and be extended to test) real hardware. */ + #include + #include + / { test { #address-cells = <1>; @@ -89,6 +92,13 @@ wp-gpios = <&test_gpio 0 0>; /* read-only; */ }; + + test_spi_mb85rsxx: mb85rsxx@0 { + compatible = "fujitsu,mb85rsxx"; + reg = <0x0>; + spi-max-frequency = ; + size = ; + }; }; }; }; From 05529584a967862e18d9fa17e21bbe407b5017e9 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Thu, 24 Oct 2024 17:05:11 +0200 Subject: [PATCH 2560/4482] dts: common: nordic: nrf54l15: add power peripheral Add power peripheral to nrf54l15. Signed-off-by: Bjarki Arge Andreasen --- dts/common/nordic/nrf54l15.dtsi | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/dts/common/nordic/nrf54l15.dtsi b/dts/common/nordic/nrf54l15.dtsi index 4c07c34560efd..7dfa6a314b226 100644 --- a/dts/common/nordic/nrf54l15.dtsi +++ b/dts/common/nordic/nrf54l15.dtsi @@ -616,6 +616,32 @@ status = "disabled"; }; + power: power@10e000 { + compatible = "nordic,nrf-power"; + reg = <0x10e000 0x1000>; + ranges = <0x0 0x10e000 0x1000>; + interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <1>; + + gpregret1: gpregret1@51c { + #address-cells = <1>; + #size-cells = <1>; + compatible = "nordic,nrf-gpregret"; + reg = <0x51c 0x1>; + status = "disabled"; + }; + + gpregret2: gpregret2@520 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "nordic,nrf-gpregret"; + reg = <0x520 0x1>; + status = "disabled"; + }; + }; + regulators: regulator@120000 { compatible = "nordic,nrf54l-regulators"; reg = <0x120000 0x1000>; From 3e6d6033bbd21432b41ad5a0463bc47ae6fcf0df Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 16 Oct 2024 15:36:50 +0200 Subject: [PATCH 2561/4482] soc: nordic: add fn for setting constlat mode Nordic SoCs implement an event system, for which the system can optimize for low latency/high power or low power. Add soc level implementation of reference counted API which will optimize for low latency if any part of the system requires it. Signed-off-by: Bjarki Arge Andreasen --- soc/nordic/common/CMakeLists.txt | 2 + soc/nordic/common/Kconfig | 4 ++ soc/nordic/common/nrf_sys_event.c | 95 +++++++++++++++++++++++++++++++ soc/nordic/common/nrf_sys_event.h | 30 ++++++++++ 4 files changed, 131 insertions(+) create mode 100644 soc/nordic/common/nrf_sys_event.c create mode 100644 soc/nordic/common/nrf_sys_event.h diff --git a/soc/nordic/common/CMakeLists.txt b/soc/nordic/common/CMakeLists.txt index 38c55c614e9e5..1a4e17c20d1ca 100644 --- a/soc/nordic/common/CMakeLists.txt +++ b/soc/nordic/common/CMakeLists.txt @@ -29,3 +29,5 @@ if(CONFIG_TFM_PARTITION_PLATFORM) $/api_ns/interface/include ) endif() + +zephyr_library_sources_ifdef(CONFIG_NRF_SYS_EVENT nrf_sys_event.c) diff --git a/soc/nordic/common/Kconfig b/soc/nordic/common/Kconfig index 8de20c37dd4d2..ef32e7403c127 100644 --- a/soc/nordic/common/Kconfig +++ b/soc/nordic/common/Kconfig @@ -4,4 +4,8 @@ config HAS_NORDIC_DMM bool +config NRF_SYS_EVENT + bool "nRF system event support" + select NRFX_POWER if !NRF_PLATFORM_HALTIUM + rsource "vpr/Kconfig" diff --git a/soc/nordic/common/nrf_sys_event.c b/soc/nordic/common/nrf_sys_event.c new file mode 100644 index 0000000000000..47c02eadb9618 --- /dev/null +++ b/soc/nordic/common/nrf_sys_event.c @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#if CONFIG_SOC_SERIES_NRF54HX + +/* + * The 54HX is not yet supported by an nrfx driver nor the system controller so + * we implement an ISR and concurrent access safe reference counting implementation + * here using the nrfx hal. + */ + +#include + +static struct k_spinlock global_constlat_lock; +static uint16_t global_constlat_count; + +int nrf_sys_event_request_global_constlat(void) +{ + K_SPINLOCK(&global_constlat_lock) { + if (global_constlat_count == 0) { +#if CONFIG_SOC_NRF54H20_CPUAPP + nrf_lrcconf_task_trigger(NRF_LRCCONF010, + NRF_LRCCONF_TASK_CONSTLAT_ENABLE); +#elif CONFIG_SOC_NRF54H20_CPURAD + nrf_lrcconf_task_trigger(NRF_LRCCONF000, + NRF_LRCCONF_TASK_CONSTLAT_ENABLE); + nrf_lrcconf_task_trigger(NRF_LRCCONF020, + NRF_LRCCONF_TASK_CONSTLAT_ENABLE); +#else +#error "unsupported" +#endif + } + + global_constlat_count++; + } + + return 0; +} + +int nrf_sys_event_release_global_constlat(void) +{ + K_SPINLOCK(&global_constlat_lock) { + if (global_constlat_count == 1) { +#if CONFIG_SOC_NRF54H20_CPUAPP + nrf_lrcconf_task_trigger(NRF_LRCCONF010, + NRF_LRCCONF_TASK_CONSTLAT_DISABLE); +#elif CONFIG_SOC_NRF54H20_CPURAD + nrf_lrcconf_task_trigger(NRF_LRCCONF000, + NRF_LRCCONF_TASK_CONSTLAT_DISABLE); + nrf_lrcconf_task_trigger(NRF_LRCCONF020, + NRF_LRCCONF_TASK_CONSTLAT_DISABLE); +#else +#error "unsupported" +#endif + } + + global_constlat_count--; + } + + return 0; +} + +#else + +/* + * The nrfx power driver already contains an ISR and concurrent access safe reference + * counting API so we just use it directly when available. + */ + +#include + +int nrf_sys_event_request_global_constlat(void) +{ + nrfx_err_t err; + + err = nrfx_power_constlat_mode_request(); + + return (err == NRFX_SUCCESS || err == NRFX_ERROR_ALREADY) ? 0 : -EAGAIN; +} + +int nrf_sys_event_release_global_constlat(void) +{ + nrfx_err_t err; + + err = nrfx_power_constlat_mode_free(); + + return (err == NRFX_SUCCESS || err == NRFX_ERROR_BUSY) ? 0 : -EAGAIN; +} + +#endif diff --git a/soc/nordic/common/nrf_sys_event.h b/soc/nordic/common/nrf_sys_event.h new file mode 100644 index 0000000000000..a4d6d8050f057 --- /dev/null +++ b/soc/nordic/common/nrf_sys_event.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/** + * @brief Request lowest latency for system events + * + * @details System will be configured for lowest latency after first + * call to nrf_sys_event_request_global_constlat() and will remain + * configured for lowest latency until matching number of calls to + * nrf_sys_event_release_global_constlat() occur. + * + * @retval 0 if successful + * @retval -errno code otherwise + */ +int nrf_sys_event_request_global_constlat(void); + +/** + * @brief Release low latency request + * + * @see nrf_sys_event_request_global_constlat() + * + * @retval 0 if successful + * @retval -errno code otherwise + */ +int nrf_sys_event_release_global_constlat(void); From 9df88e62fc4a69f5a3873aa82c856728d7dc11c5 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Wed, 16 Oct 2024 16:31:10 +0200 Subject: [PATCH 2562/4482] samples: boards: nordic: add nrf_sys_event sample Add sample for nrf system events. Signed-off-by: Bjarki Arge Andreasen --- .../nordic/nrf_sys_event/CMakeLists.txt | 9 ++++ samples/boards/nordic/nrf_sys_event/prj.conf | 4 ++ .../boards/nordic/nrf_sys_event/sample.yaml | 28 +++++++++++++ .../boards/nordic/nrf_sys_event/src/main.c | 41 +++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 samples/boards/nordic/nrf_sys_event/CMakeLists.txt create mode 100644 samples/boards/nordic/nrf_sys_event/prj.conf create mode 100644 samples/boards/nordic/nrf_sys_event/sample.yaml create mode 100644 samples/boards/nordic/nrf_sys_event/src/main.c diff --git a/samples/boards/nordic/nrf_sys_event/CMakeLists.txt b/samples/boards/nordic/nrf_sys_event/CMakeLists.txt new file mode 100644 index 0000000000000..5f7335b260e7c --- /dev/null +++ b/samples/boards/nordic/nrf_sys_event/CMakeLists.txt @@ -0,0 +1,9 @@ +# Copyright 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(soc_sys_event) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/boards/nordic/nrf_sys_event/prj.conf b/samples/boards/nordic/nrf_sys_event/prj.conf new file mode 100644 index 0000000000000..28f655a7e24eb --- /dev/null +++ b/samples/boards/nordic/nrf_sys_event/prj.conf @@ -0,0 +1,4 @@ +# Copyright 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_NRF_SYS_EVENT=y diff --git a/samples/boards/nordic/nrf_sys_event/sample.yaml b/samples/boards/nordic/nrf_sys_event/sample.yaml new file mode 100644 index 0000000000000..c5ea3d8a23de8 --- /dev/null +++ b/samples/boards/nordic/nrf_sys_event/sample.yaml @@ -0,0 +1,28 @@ +sample: + name: nRF System events +tests: + sample.boards.nordic.nrf_sys_event: + harness: console + harness_config: + type: one_line + regex: + - "constant latency mode disabled" + platform_allow: + - nrf52dk/nrf52810 + - nrf52dk/nrf52832 + - nrf52833dk/nrf52820 + - nrf52833dk/nrf52833 + - nrf52840dk/nrf52811 + - nrf52840dk/nrf52840 + - nrf5340dk/nrf5340/cpuapp + - nrf5340dk/nrf5340/cpunet + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad + - nrf54l15dk/nrf54l15/cpuapp + integration_platforms: + - nrf52840dk/nrf52840 + - nrf5340dk/nrf5340/cpuapp + - nrf5340dk/nrf5340/cpunet + - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk/nrf54h20/cpurad + - nrf54l15dk/nrf54l15/cpuapp diff --git a/samples/boards/nordic/nrf_sys_event/src/main.c b/samples/boards/nordic/nrf_sys_event/src/main.c new file mode 100644 index 0000000000000..e97d3c821f780 --- /dev/null +++ b/samples/boards/nordic/nrf_sys_event/src/main.c @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +int main(void) +{ + printf("request global constant latency mode\n"); + if (nrf_sys_event_request_global_constlat()) { + printf("failed to request global constant latency mode\n"); + return 0; + } + printf("constant latency mode enabled\n"); + + printf("request global constant latency mode again\n"); + if (nrf_sys_event_request_global_constlat()) { + printf("failed to request global constant latency mode\n"); + return 0; + } + + printf("release global constant latency mode\n"); + printf("constant latency mode will remain enabled\n"); + if (nrf_sys_event_release_global_constlat()) { + printf("failed to release global constant latency mode\n"); + return 0; + } + + printf("release global constant latency mode again\n"); + printf("constant latency mode will be disabled\n"); + if (nrf_sys_event_release_global_constlat()) { + printf("failed to release global constant latency mode\n"); + return 0; + } + + printf("constant latency mode disabled\n"); + return 0; +} From d716f54bbf38a7de9fdcda8d81727fb3462b3254 Mon Sep 17 00:00:00 2001 From: Chun-Chieh Li Date: Thu, 17 Oct 2024 09:42:35 +0800 Subject: [PATCH 2563/4482] drivers: usb_c: numaker: update UTCPD.VBSCALE register field This follows update of UTCPD.VBSCALE register field. It supports: - "divide-20": External VBUS voltage divider circuit should be 1/20 for EPR application. The divided voltage compares with 200mV to set or clean VBUS Present bit. - "divide-10": External VBUS voltage divider circuit should be 1/10 for SPR application. The divided voltage compares with 400mV to set or clean VBUS Present bit. Signed-off-by: Chun-Chieh Li --- drivers/usb_c/tcpc/ucpd_numaker.c | 16 ++++++---------- dts/bindings/tcpc/nuvoton,numaker-tcpc.yaml | 11 ++++++++--- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/usb_c/tcpc/ucpd_numaker.c b/drivers/usb_c/tcpc/ucpd_numaker.c index e50c3acf2e3fc..c628b8604df1c 100644 --- a/drivers/usb_c/tcpc/ucpd_numaker.c +++ b/drivers/usb_c/tcpc/ucpd_numaker.c @@ -2374,21 +2374,17 @@ static const struct tcpc_driver_api numaker_tcpc_driver_api = { : 0) /* UTCPD.VBVOL.VBSCALE cast */ -#define NUMAKER_UTCPD_VBUS_DIVIDE_CAST(inst) NUMAKER_UTCPD_VBUS_DIVIDE_CAST_NO_DIVIDE(inst) -/* no_divide */ -#define NUMAKER_UTCPD_VBUS_DIVIDE_CAST_NO_DIVIDE(inst) \ - COND_CODE_1(DT_ENUM_HAS_VALUE(DT_DRV_INST(inst), vbus_divide, no_divice), \ - ({.bit = (0 << UTCPD_VBVOL_VBSCALE_Pos), .value = 1}), \ +#define NUMAKER_UTCPD_VBUS_DIVIDE_CAST(inst) NUMAKER_UTCPD_VBUS_DIVIDE_CAST_DIVIDE_20(inst) +/* divide_20 */ +#define NUMAKER_UTCPD_VBUS_DIVIDE_CAST_DIVIDE_20(inst) \ + COND_CODE_1(DT_ENUM_HAS_VALUE(DT_DRV_INST(inst), vbus_divide, divide_20), \ + ({.bit = (0 << UTCPD_VBVOL_VBSCALE_Pos), .value = 20}), \ (NUMAKER_UTCPD_VBUS_DIVIDE_CAST_DIVIDE_10(inst))) /* divide_10 */ #define NUMAKER_UTCPD_VBUS_DIVIDE_CAST_DIVIDE_10(inst) \ COND_CODE_1(DT_ENUM_HAS_VALUE(DT_DRV_INST(inst), vbus_divide, divide_10), \ ({.bit = (1 << UTCPD_VBVOL_VBSCALE_Pos), .value = 10}), \ - (NUMAKER_UTCPD_VBUS_DIVIDE_CAST_DIVIDE_20(inst))) -/* divide_20 */ -#define NUMAKER_UTCPD_VBUS_DIVIDE_CAST_DIVIDE_20(inst) \ - COND_CODE_1(DT_ENUM_HAS_VALUE(DT_DRV_INST(inst), vbus_divide, divide_20), \ - ({.bit = (2 << UTCPD_VBVOL_VBSCALE_Pos), .value = 20}), (no_divide error)) + (vbus-divide error)) /* UTCPD.PINPL */ #define NUMAKER_UTCPD_PINPL_INIT(inst) \ diff --git a/dts/bindings/tcpc/nuvoton,numaker-tcpc.yaml b/dts/bindings/tcpc/nuvoton,numaker-tcpc.yaml index e248ae8ddc7df..4480f4496c60b 100644 --- a/dts/bindings/tcpc/nuvoton,numaker-tcpc.yaml +++ b/dts/bindings/tcpc/nuvoton,numaker-tcpc.yaml @@ -96,11 +96,16 @@ properties: type: string required: true description: | - VBUS measurement divider + VBUS measurement divider: + "divide-20": External VBUS voltage divider circuit should be 1/20 + for EPR application. The divided voltage compares with + 200mV to set or clean VBUS Present bit. + "divide-10": External VBUS voltage divider circuit should be 1/10 + for SPR application. The divided voltage compares with + 400mV to set or clean VBUS Present bit. enum: - - "no-divide" - - "divide-10" - "divide-20" + - "divide-10" dead-battery: type: boolean From aa9c9228d48a0e4041138cf264a26fc5edd7c03c Mon Sep 17 00:00:00 2001 From: Kenneth Witham Date: Mon, 28 Oct 2024 08:09:49 -0700 Subject: [PATCH 2564/4482] net: mqtt-sn: Add Gateway Advertisement and Discovery process support Fixes: #78010 This commit implements the "Gateway Advertisement and Discovery" process defined in section 6.1 of the MQTT-SN specification. This includes breaking changes to the transport interface and the default included UDP interface implementation as support for UDP multicast messages is added as implemented by the Paho MQTT-SN Gateway. Signed-off-by: Kenneth Witham --- doc/connectivity/networking/api/mqtt_sn.rst | 51 ++- include/zephyr/net/mqtt_sn.h | 88 +++- subsys/net/lib/mqtt_sn/Kconfig | 41 ++ subsys/net/lib/mqtt_sn/mqtt_sn.c | 396 ++++++++++++++++-- subsys/net/lib/mqtt_sn/mqtt_sn_decoder.c | 15 + .../net/lib/mqtt_sn/mqtt_sn_transport_udp.c | 146 ++++++- 6 files changed, 638 insertions(+), 99 deletions(-) diff --git a/doc/connectivity/networking/api/mqtt_sn.rst b/doc/connectivity/networking/api/mqtt_sn.rst index a244021395806..28af667b9b33e 100644 --- a/doc/connectivity/networking/api/mqtt_sn.rst +++ b/doc/connectivity/networking/api/mqtt_sn.rst @@ -84,17 +84,33 @@ used. An example configuration for UDP transport is shown below: mqtt_sn_client_init(&client, &client_id, &tp.tp, evt_cb, tx_buf, sizeof(tx_buf), rx_buf, sizeof(rx_buf)); -After the configuration is set up, the MQTT-SN client can connect to the gateway. -While the MQTT-SN protocol offers functionality to discover gateways through an -advertisement mechanism, this is not implemented yet in the library. - -Call the ``mqtt_sn_connect`` function, which will send a ``CONNECT`` message. -The application should periodically call the ``mqtt_sn_input`` function to process -the response received. The application does not have to call ``mqtt_sn_input`` if it -knows that no data has been received (e.g. when using Bluetooth). Note that -``mqtt_sn_input`` is a non-blocking function, if the transport struct contains a -``poll`` compatible function pointer. -If the connection was successful, ``MQTT_SN_EVT_CONNECTED`` will be notified to the +After the configuration is set up, the network address for the gateway to +connect to must be defined. The MQTT-SN protocol offers functionality to +discover gateways through an advertisement or a search mechanism. A user +should do at least one of the following steps to define a Gateway for the library: + +* Call the :c:func:`mqtt_sn_add_gw` function to manually define a Gateway address. +* Wait for an :c:enumerator:`MQTT_SN_EVT_ADVERTISE`. +* Call the :c:func:`mqtt_sn_search` function and wait for an :c:enumerator:`MQTT_SN_EVT_GWINFO` callback. + Make sure to call the :c:func:`mqtt_sn_input` function periodically to process incoming messages. + +Example :c:func:`mqtt_sn_search` function call: + +.. code-block:: c + + err = mqtt_sn_search(&mqtt_client, 1); + k_sleep(K_SECONDS(10)); + err = mqtt_sn_input(&mqtt_client); + __ASSERT(err == 0, "mqtt_sn_search() failed %d", err); + +After the Gateway address has been defined or found, the MQTT-SN client can +connect to the gateway. Call the :c:func:`mqtt_sn_connect` function, which will send a +``CONNECT`` MQTT-SN message. The application should periodically call the :c:func:`mqtt_sn_input` +function to process the response received. The application does not have to call +:c:func:`mqtt_sn_input` if it knows that no data has been received (e.g. when using Bluetooth). +Note that :c:func:`mqtt_sn_input` is a non-blocking function, if the transport struct contains a +:c:func:`poll` compatible function pointer. +If the connection was successful, :c:enumerator:`MQTT_SN_EVT_CONNECTED` will be notified to the application through the callback function. .. code-block:: c @@ -110,19 +126,19 @@ application through the callback function. k_sleep(K_MSEC(500)); } -In the above code snippet, the event handler function should set the ``connected`` -flag upon a successful connection. If the connection fails at the MQTT level -or a timeout occurs, the connection will be aborted. +In the above code snippet, the gateway is connected to before publishing messages. +If the connection fails at the MQTT level or a timeout occurs, the connection will be aborted and +an error returned. -After the connection is established, an application needs to call ``mqtt_input`` +After the connection is established, an application needs to call :c:func:`mqtt_input` function periodically to process incoming data. Connection upkeep, on the other hand, is done automatically using a k_work item. If a MQTT message is received, an MQTT callback function will be called and an appropriate event notified. -The connection can be closed by calling the ``mqtt_sn_disconnect`` function. This +The connection can be closed by calling the :c:func:`mqtt_sn_disconnect` function. This has no effect on the transport, however. If you want to close the transport (e.g. -the socket), call ``mqtt_sn_client_deinit``, which will deinit the transport as well. +the socket), call :c:func:`mqtt_sn_client_deinit`, which will deinit the transport as well. Zephyr provides sample code utilizing the MQTT-SN client API. See :zephyr:code-sample:`mqtt-sn-publisher` for more information. @@ -134,7 +150,6 @@ Certain parts of the protocol are not yet supported in the library. * Pre-defined topic IDs * QoS -1 - it's most useful with predefined topics -* Gateway discovery using ADVERTISE, SEARCHGW and GWINFO messages. * Setting the will topic and message after the initial connect * Forwarder Encapsulation diff --git a/include/zephyr/net/mqtt_sn.h b/include/zephyr/net/mqtt_sn.h index ec3f76e966ed2..cc4b042a1fac8 100644 --- a/include/zephyr/net/mqtt_sn.h +++ b/include/zephyr/net/mqtt_sn.h @@ -75,16 +75,16 @@ enum mqtt_sn_topic_type { * MQTT-SN return codes. */ enum mqtt_sn_return_code { - MQTT_SN_CODE_ACCEPTED = 0x00, /**< Accepted */ + MQTT_SN_CODE_ACCEPTED = 0x00, /**< Accepted */ MQTT_SN_CODE_REJECTED_CONGESTION = 0x01, /**< Rejected: congestion */ - MQTT_SN_CODE_REJECTED_TOPIC_ID = 0x02, /**< Rejected: Invalid Topic ID */ - MQTT_SN_CODE_REJECTED_NOTSUP = 0x03, /**< Rejected: Not Supported */ + MQTT_SN_CODE_REJECTED_TOPIC_ID = 0x02, /**< Rejected: Invalid Topic ID */ + MQTT_SN_CODE_REJECTED_NOTSUP = 0x03, /**< Rejected: Not Supported */ }; /** @brief Abstracts memory buffers. */ struct mqtt_sn_data { const uint8_t *data; /**< Pointer to data. */ - uint16_t size; /**< Size of data, in bytes. */ + size_t size; /**< Size of data, in bytes. */ }; /** @@ -105,19 +105,22 @@ struct mqtt_sn_data { * * struct mqtt_sn_data data = MQTT_SN_DATA_BYTES(0x13, 0x37); */ -#define MQTT_SN_DATA_BYTES(...) \ - ((struct mqtt_sn_data) { (uint8_t[]){ __VA_ARGS__ }, sizeof((uint8_t[]){ __VA_ARGS__ })}) +#define MQTT_SN_DATA_BYTES(...) \ + ((struct mqtt_sn_data){(uint8_t[]){__VA_ARGS__}, sizeof((uint8_t[]){__VA_ARGS__})}) /** * Event types that can be emitted by the library. */ enum mqtt_sn_evt_type { - MQTT_SN_EVT_CONNECTED, /**< Connected to a gateway */ + MQTT_SN_EVT_CONNECTED, /**< Connected to a gateway */ MQTT_SN_EVT_DISCONNECTED, /**< Disconnected */ - MQTT_SN_EVT_ASLEEP, /**< Entered ASLEEP state */ - MQTT_SN_EVT_AWAKE, /**< Entered AWAKE state */ - MQTT_SN_EVT_PUBLISH, /**< Received a PUBLISH message */ - MQTT_SN_EVT_PINGRESP /**< Received a PINGRESP */ + MQTT_SN_EVT_ASLEEP, /**< Entered ASLEEP state */ + MQTT_SN_EVT_AWAKE, /**< Entered AWAKE state */ + MQTT_SN_EVT_PUBLISH, /**< Received a PUBLISH message */ + MQTT_SN_EVT_PINGRESP, /**< Received a PINGRESP */ + MQTT_SN_EVT_ADVERTISE, /**< Received a ADVERTISE */ + MQTT_SN_EVT_GWINFO, /**< Received a GWINFO */ + MQTT_SN_EVT_SEARCHGW /**< Received a SEARCHGW */ }; /** @@ -180,16 +183,27 @@ struct mqtt_sn_transport { void (*deinit)(struct mqtt_sn_transport *transport); /** - * Will be called by the library when it wants to send a message. + * @brief Will be called by the library when it wants to send a message. + * + * Implementations should follow sendto conventions with exceptions. + * When dest_addr == NULL, message should be broadcast with addrlen being + * the broadcast radius. This should also handle setting up/destroying + * connections as required when the address changes. + * + * @return ENOERR on connection+transmission success, Negative values + * signal errors. */ - int (*msg_send)(struct mqtt_sn_client *client, void *buf, size_t sz); + int (*sendto)(struct mqtt_sn_client *client, void *buf, size_t sz, const void *dest_addr, + size_t addrlen); /** * @brief Will be called by the library when it wants to receive a message. * - * Implementations should follow recv conventions. + * Implementations should follow recvfrom conventions with the exception + * of a NULL src_addr being a broadcast message. */ - ssize_t (*recv)(struct mqtt_sn_client *client, void *buffer, size_t length); + ssize_t (*recvfrom)(struct mqtt_sn_client *client, void *rx_buf, size_t rx_len, + void *src_addr, size_t *addrlen); /** * @brief Check if incoming data is available. @@ -215,9 +229,9 @@ struct mqtt_sn_transport_udp { /** Socket FD */ int sock; - /** Address of the gateway */ - struct sockaddr gwaddr; - socklen_t gwaddrlen; + /** Address of broadcasts */ + struct sockaddr bcaddr; + socklen_t bcaddrlen; }; #define UDP_TRANSPORT(transport) CONTAINER_OF(transport, struct mqtt_sn_transport_udp, tp) @@ -265,6 +279,9 @@ struct mqtt_sn_client { /** Buffer for incoming data */ struct net_buf_simple rx; + /** Buffer for incoming data sender address */ + struct net_buf_simple rx_addr; + /** Event callback */ mqtt_sn_evt_cb_t evt_cb; @@ -277,6 +294,9 @@ struct mqtt_sn_client { /** List of registered topics */ sys_slist_t topic; + /** List of found gateways */ + sys_slist_t gateway; + /** Current state of the MQTT-SN client */ int state; @@ -286,6 +306,15 @@ struct mqtt_sn_client { /** Number of retries for failed ping attempts */ uint8_t ping_retries; + /** Timestamp of the next SEARCHGW transmission */ + int64_t ts_searchgw; + + /** Timestamp of the next GWINFO transmission */ + int64_t ts_gwinfo; + + /** Radius of the next GWINFO transmission */ + int64_t radius_gwinfo; + /** Delayable work structure for processing MQTT-SN events */ struct k_work_delayable process_work; }; @@ -317,6 +346,29 @@ int mqtt_sn_client_init(struct mqtt_sn_client *client, const struct mqtt_sn_data */ void mqtt_sn_client_deinit(struct mqtt_sn_client *client); +/** + * @brief Manually add a Gateway, bypasing the normal search process. + * + * This function manually creates a gateway that is stored internal to the library. + * + * @param client The MQTT-SN client to connect. + * @param gw_id Single byte Gateway Identifier + * @param gw_addr Address data structure to be used by the transport layer. + * + * @return 0 or a negative error code (errno.h) indicating reason of failure. + */ +int mqtt_sn_add_gw(struct mqtt_sn_client *client, uint8_t gw_id, struct mqtt_sn_data gw_addr); + +/** + * @brief Initiate the MQTT-SN GW Search process. + * + * @param client The MQTT-SN client to connect. + * @param radius Broadcast radius for the search message. + * + * @return 0 or a negative error code (errno.h) indicating reason of failure. + */ +int mqtt_sn_search(struct mqtt_sn_client *client, uint8_t radius); + /** * @brief Connect the client. * diff --git a/subsys/net/lib/mqtt_sn/Kconfig b/subsys/net/lib/mqtt_sn/Kconfig index ffac23d907de9..cc4ac19395cd5 100644 --- a/subsys/net/lib/mqtt_sn/Kconfig +++ b/subsys/net/lib/mqtt_sn/Kconfig @@ -14,26 +14,51 @@ if MQTT_SN_LIB config MQTT_SN_LIB_MAX_PAYLOAD_SIZE int "Maximum payload size of an MQTT-SN message" default $(UINT8_MAX) + range $(UINT8_MAX) $(UINT16_MAX) config MQTT_SN_LIB_MAX_MSGS int "Number of preallocated messages" default 10 + range 1 $(UINT8_MAX) config MQTT_SN_LIB_MAX_TOPICS int "Number of topics that can be managed" default 20 + range 1 $(UINT8_MAX) config MQTT_SN_LIB_MAX_TOPIC_SIZE int "Maximum topic length" default 64 + range 1 $(UINT16_MAX) + +config MQTT_SN_LIB_MAX_GATEWAYS + int "Maximum number of gateways to store internally" + default 2 + range 1 $(UINT8_MAX) + +config MQTT_SN_LIB_MAX_ADDR_SIZE + int "Maximum address size for the transport" + default 21 + range 1 $(UINT8_MAX) + help + The MQTT_SN library stores addresses internally and thus + needs to know how long your addresses are. Set this to the maximum + length in bytes of the address data structure for your implemented transport. + +config MQTT_SN_LIB_BROADCAST_RADIUS + int "Radius for broadcast messages" + default 1 + range 1 $(UINT8_MAX) config MQTT_SN_LIB_MAX_PUBLISH int "Number of publishes that can be in-flight at the same time" default 5 + range 1 $(UINT8_MAX) config MQTT_SN_KEEPALIVE int "Maximum number of clients Keep alive time for MQTT-SN (in seconds)" default 60 + range 1 $(UINT8_MAX) help Keep alive time for MQTT-SN (in seconds). Sending of Ping Requests to keep the connection alive are governed by this value. @@ -50,6 +75,22 @@ config MQTT_SN_LIB_N_RETRY config MQTT_SN_LIB_T_RETRY int "Time (seconds) to wait for responses" default 10 + range 0 $(UINT8_MAX) + +config MQTT_SN_LIB_T_SEARCHGW + int "Max time (seconds) to wait before sending SEARCHGW" + default 10 + range 0 $(UINT8_MAX) + +config MQTT_SN_LIB_T_GWINFO + int "Max time (seconds) to wait before sending GWINFO" + default 10 + range 0 $(UINT8_MAX) + +config MQTT_SN_LIB_N_ADV + int "Number of missed Advertise messages before considering GW lost" + default 2 + range 1 $(UINT8_MAX) module=MQTT_SN module-dep=NET_LOG diff --git a/subsys/net/lib/mqtt_sn/mqtt_sn.c b/subsys/net/lib/mqtt_sn/mqtt_sn.c index 2a7b71ae05554..22d810d47e3d4 100644 --- a/subsys/net/lib/mqtt_sn/mqtt_sn.c +++ b/subsys/net/lib/mqtt_sn/mqtt_sn.c @@ -12,6 +12,7 @@ #include "mqtt_sn_msg.h" #include +#include #include LOG_MODULE_REGISTER(net_mqtt_sn, CONFIG_MQTT_SN_LOG_LEVEL); @@ -55,9 +56,19 @@ struct mqtt_sn_topic { enum mqtt_sn_topic_state state; }; -K_MEM_SLAB_DEFINE_STATIC(publishes, sizeof(struct mqtt_sn_publish), - CONFIG_MQTT_SN_LIB_MAX_PUBLISH, 4); +struct mqtt_sn_gateway { + sys_snode_t next; + char gw_id; + int64_t adv_timer; + char addr[CONFIG_MQTT_SN_LIB_MAX_ADDR_SIZE]; + size_t addr_len; +}; + +K_MEM_SLAB_DEFINE_STATIC(publishes, sizeof(struct mqtt_sn_publish), CONFIG_MQTT_SN_LIB_MAX_PUBLISH, + 4); K_MEM_SLAB_DEFINE_STATIC(topics, sizeof(struct mqtt_sn_topic), CONFIG_MQTT_SN_LIB_MAX_TOPICS, 4); +K_MEM_SLAB_DEFINE_STATIC(gateways, sizeof(struct mqtt_sn_gateway), CONFIG_MQTT_SN_LIB_MAX_GATEWAYS, + 4); enum mqtt_sn_client_state { MQTT_SN_CLIENT_DISCONNECTED, @@ -74,8 +85,10 @@ static void mqtt_sn_set_state(struct mqtt_sn_client *client, enum mqtt_sn_client LOG_DBG("Client %p state (%d) -> (%d)", client, prev_state, state); } -#define T_RETRY_MSEC (CONFIG_MQTT_SN_LIB_T_RETRY * MSEC_PER_SEC) -#define N_RETRY (CONFIG_MQTT_SN_LIB_N_RETRY) +#define T_SEARCHGW_MSEC (CONFIG_MQTT_SN_LIB_T_SEARCHGW * MSEC_PER_SEC) +#define T_GWINFO_MSEC (CONFIG_MQTT_SN_LIB_T_GWINFO * MSEC_PER_SEC) +#define T_RETRY_MSEC (CONFIG_MQTT_SN_LIB_T_RETRY * MSEC_PER_SEC) +#define N_RETRY (CONFIG_MQTT_SN_LIB_N_RETRY) #define T_KEEPALIVE_MSEC (CONFIG_MQTT_SN_KEEPALIVE * MSEC_PER_SEC) static uint16_t next_msg_id(void) @@ -85,7 +98,8 @@ static uint16_t next_msg_id(void) return ++msg_id; } -static int encode_and_send(struct mqtt_sn_client *client, struct mqtt_sn_param *p) +static int encode_and_send(struct mqtt_sn_client *client, struct mqtt_sn_param *p, + uint8_t broadcast_radius) { int err; @@ -96,7 +110,7 @@ static int encode_and_send(struct mqtt_sn_client *client, struct mqtt_sn_param * LOG_HEXDUMP_DBG(client->tx.data, client->tx.len, "Send message"); - if (!client->transport->msg_send) { + if (!client->transport->sendto) { LOG_ERR("Can't send: no callback"); err = -ENOTSUP; goto end; @@ -108,13 +122,26 @@ static int encode_and_send(struct mqtt_sn_client *client, struct mqtt_sn_param * goto end; } - err = client->transport->msg_send(client, client->tx.data, client->tx.len); - if (err) { - LOG_ERR("Error during send: %d", err); - goto end; + if (broadcast_radius) { + err = client->transport->sendto(client, client->tx.data, client->tx.len, NULL, + broadcast_radius); + } else { + struct mqtt_sn_gateway *gw; + + gw = SYS_SLIST_PEEK_HEAD_CONTAINER(&client->gateway, gw, next); + if (gw == NULL || gw->addr_len == 0) { + LOG_WRN("No Gateway Address"); + err = -ENXIO; + goto end; + } + err = client->transport->sendto(client, client->tx.data, client->tx.len, gw->addr, + gw->addr_len); } end: + if (err) { + LOG_ERR("Error during send: %d", err); + } net_buf_simple_reset(&client->tx); return err; @@ -228,13 +255,13 @@ static struct mqtt_sn_topic *mqtt_sn_topic_create(struct mqtt_sn_data *name) } static struct mqtt_sn_topic *mqtt_sn_topic_find_name(struct mqtt_sn_client *client, - struct mqtt_sn_data *topic_name) + struct mqtt_sn_data *topic_name) { struct mqtt_sn_topic *topic; SYS_SLIST_FOR_EACH_CONTAINER(&client->topic, topic, next) { if (topic->namelen == topic_name->size && - memcmp(topic->name, topic_name->data, topic_name->size) == 0) { + memcmp(topic->name, topic_name->data, topic_name->size) == 0) { return topic; } } @@ -243,7 +270,7 @@ static struct mqtt_sn_topic *mqtt_sn_topic_find_name(struct mqtt_sn_client *clie } static struct mqtt_sn_topic *mqtt_sn_topic_find_msg_id(struct mqtt_sn_client *client, - uint16_t msg_id) + uint16_t msg_id) { struct mqtt_sn_topic *topic; @@ -287,6 +314,66 @@ static void mqtt_sn_topic_destroy_all(struct mqtt_sn_client *client) } } +static void mqtt_sn_gw_destroy(struct mqtt_sn_client *client, struct mqtt_sn_gateway *gw) +{ + LOG_DBG("Destroying gateway %d", gw->gw_id); + sys_slist_find_and_remove(&client->gateway, &gw->next); + k_mem_slab_free(&gateways, (void *)gw); +} + +static void mqtt_sn_gw_destroy_all(struct mqtt_sn_client *client) +{ + struct mqtt_sn_gateway *gw; + sys_snode_t *next; + + while ((next = sys_slist_get(&client->gateway)) != NULL) { + gw = SYS_SLIST_CONTAINER(next, gw, next); + sys_slist_find_and_remove(&client->gateway, next); + k_mem_slab_free(&gateways, (void *)gw); + } +} + +static struct mqtt_sn_gateway *mqtt_sn_gw_create(uint8_t gw_id, short duration, + struct mqtt_sn_data gw_addr) +{ + struct mqtt_sn_gateway *gw; + + LOG_DBG("Free GW slots: %d", k_mem_slab_num_free_get(&gateways)); + if (k_mem_slab_alloc(&gateways, (void **)&gw, K_NO_WAIT)) { + LOG_WRN("Can't create GW: no free slot"); + return NULL; + } + + __ASSERT(gw_addr.size < CONFIG_MQTT_SN_LIB_MAX_ADDR_SIZE, + "Gateway address is larger than allowed by CONFIG_MQTT_SN_LIB_MAX_ADDR_SIZE"); + + memset(gw, 0, sizeof(*gw)); + memcpy(gw->addr, gw_addr.data, gw_addr.size); + gw->addr_len = gw_addr.size; + gw->gw_id = gw_id; + if (duration == -1) { + gw->adv_timer = duration; + } else { + gw->adv_timer = + k_uptime_get() + (duration * CONFIG_MQTT_SN_LIB_N_ADV * MSEC_PER_SEC); + } + + return gw; +} + +static struct mqtt_sn_gateway *mqtt_sn_gw_find_id(struct mqtt_sn_client *client, uint16_t gw_id) +{ + struct mqtt_sn_gateway *gw; + + SYS_SLIST_FOR_EACH_CONTAINER(&client->gateway, gw, next) { + if (gw->gw_id == gw_id) { + return gw; + } + } + + return NULL; +} + static void mqtt_sn_disconnect_internal(struct mqtt_sn_client *client) { struct mqtt_sn_evt evt = {.type = MQTT_SN_EVT_DISCONNECTED}; @@ -348,7 +435,7 @@ static void mqtt_sn_do_subscribe(struct mqtt_sn_client *client, struct mqtt_sn_t return; } - encode_and_send(client, &p); + encode_and_send(client, &p, 0); } static void mqtt_sn_do_unsubscribe(struct mqtt_sn_client *client, struct mqtt_sn_topic *topic) @@ -380,7 +467,7 @@ static void mqtt_sn_do_unsubscribe(struct mqtt_sn_client *client, struct mqtt_sn return; } - encode_and_send(client, &p); + encode_and_send(client, &p, 0); } static void mqtt_sn_do_register(struct mqtt_sn_client *client, struct mqtt_sn_topic *topic) @@ -408,7 +495,7 @@ static void mqtt_sn_do_register(struct mqtt_sn_client *client, struct mqtt_sn_to return; } - encode_and_send(client, &p); + encode_and_send(client, &p, 0); } static void mqtt_sn_do_publish(struct mqtt_sn_client *client, struct mqtt_sn_publish *pub, bool dup) @@ -435,7 +522,37 @@ static void mqtt_sn_do_publish(struct mqtt_sn_client *client, struct mqtt_sn_pub p.params.publish.qos = pub->qos; p.params.publish.dup = dup; - encode_and_send(client, &p); + encode_and_send(client, &p, 0); +} + +static void mqtt_sn_do_searchgw(struct mqtt_sn_client *client) +{ + struct mqtt_sn_param p = {.type = MQTT_SN_MSG_TYPE_SEARCHGW}; + + p.params.searchgw.radius = CONFIG_MQTT_SN_LIB_BROADCAST_RADIUS; + + encode_and_send(client, &p, CONFIG_MQTT_SN_LIB_BROADCAST_RADIUS); +} + +static void mqtt_sn_do_gwinfo(struct mqtt_sn_client *client) +{ + struct mqtt_sn_param response = {.type = MQTT_SN_MSG_TYPE_GWINFO}; + struct mqtt_sn_gateway *gw; + struct mqtt_sn_data addr; + + gw = SYS_SLIST_PEEK_HEAD_CONTAINER(&client->gateway, gw, next); + + if (gw == NULL || gw->addr_len == 0) { + LOG_WRN("No Gateway Address"); + return; + } + + response.params.gwinfo.gw_id = gw->gw_id; + addr.data = gw->addr; + addr.size = gw->addr_len; + response.params.gwinfo.gw_add = addr; + + encode_and_send(client, &response, client->radius_gwinfo); } static void mqtt_sn_do_ping(struct mqtt_sn_client *client) @@ -454,7 +571,7 @@ static void mqtt_sn_do_ping(struct mqtt_sn_client *client) p.params.pingreq.client_id.data = client->client_id.data; p.params.pingreq.client_id.size = client->client_id.size; case MQTT_SN_CLIENT_ACTIVE: - encode_and_send(client, &p); + encode_and_send(client, &p, 0); break; default: LOG_WRN("Can't ping in state %d", client->state); @@ -469,8 +586,6 @@ static int process_pubs(struct mqtt_sn_client *client, int64_t *next_cycle) int64_t next_attempt; bool dup; - *next_cycle = 0; - SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&client->publish, pub, pubs, next) { LOG_HEXDUMP_DBG(pub->topic->name, pub->topic->namelen, "Processing publish for topic"); @@ -517,6 +632,8 @@ static int process_pubs(struct mqtt_sn_client *client, int64_t *next_cycle) } } + LOG_DBG("next_cycle: %lld", *next_cycle); + return 0; } @@ -583,12 +700,15 @@ static int process_topics(struct mqtt_sn_client *client, int64_t *next_cycle) } } + LOG_DBG("next_cycle: %lld", *next_cycle); + return 0; } static int process_ping(struct mqtt_sn_client *client, int64_t *next_cycle) { const int64_t now = k_uptime_get(); + struct mqtt_sn_gateway *gw = NULL; int64_t next_ping; if (client->ping_retries == N_RETRY) { @@ -602,6 +722,9 @@ static int process_ping(struct mqtt_sn_client *client, int64_t *next_cycle) if (!client->ping_retries--) { LOG_WRN("Ping ran out of retries"); mqtt_sn_disconnect_internal(client); + SYS_SLIST_PEEK_HEAD_CONTAINER(&client->gateway, gw, next); + LOG_DBG("Removing non-responsive GW 0x%08x", gw->gw_id); + mqtt_sn_gw_destroy(client, gw); return -ETIMEDOUT; } @@ -615,6 +738,63 @@ static int process_ping(struct mqtt_sn_client *client, int64_t *next_cycle) *next_cycle = next_ping; } + LOG_DBG("next_cycle: %lld", *next_cycle); + + return 0; +} + +static int process_search(struct mqtt_sn_client *client, int64_t *next_cycle) +{ + const int64_t now = k_uptime_get(); + + LOG_DBG("ts_searchgw: %lld", client->ts_searchgw); + LOG_DBG("ts_gwinfo: %lld", client->ts_gwinfo); + + if (client->ts_searchgw != 0 && client->ts_searchgw <= now) { + LOG_DBG("Sending SEARCHGW"); + mqtt_sn_do_searchgw(client); + client->ts_searchgw = 0; + } + + if (client->ts_gwinfo != 0 && client->ts_gwinfo <= now) { + LOG_DBG("Sending GWINFO"); + mqtt_sn_do_gwinfo(client); + client->ts_gwinfo = 0; + } + + if (*next_cycle == 0 || (client->ts_searchgw != 0 && client->ts_searchgw < *next_cycle)) { + *next_cycle = client->ts_searchgw; + } + if (*next_cycle == 0 || (client->ts_gwinfo != 0 && client->ts_gwinfo < *next_cycle)) { + *next_cycle = client->ts_gwinfo; + } + + LOG_DBG("next_cycle: %lld", *next_cycle); + + return 0; +} + +static int process_advertise(struct mqtt_sn_client *client, int64_t *next_cycle) +{ + const int64_t now = k_uptime_get(); + struct mqtt_sn_gateway *gw; + struct mqtt_sn_gateway *gw_next; + + SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&client->gateway, gw, gw_next, next) { + LOG_DBG("Checking if GW 0x%02x is old", gw->gw_id); + if (gw->adv_timer != -1 && gw->adv_timer <= now) { + LOG_DBG("Removing non-responsive GW 0x%08x", gw->gw_id); + if (client->gateway.head == &gw->next) { + mqtt_sn_disconnect(client); + } + mqtt_sn_gw_destroy(client, gw); + } + if (gw->adv_timer != -1 && (*next_cycle == 0 || gw->adv_timer < *next_cycle)) { + *next_cycle = gw->adv_timer; + } + } + LOG_DBG("next_cycle: %lld", *next_cycle); + return 0; } @@ -628,10 +808,18 @@ static void process_work(struct k_work *wrk) dwork = k_work_delayable_from_work(wrk); client = CONTAINER_OF(dwork, struct mqtt_sn_client, process_work); - LOG_DBG("Executing work of client %p in state %d", client, client->state); + LOG_DBG("Executing work of client %p in state %d at time %lld", client, client->state, + k_uptime_get()); + + /* Clean up old advertised gateways from list */ + err = process_advertise(client, &next_cycle); + if (err) { + return; + } - if (client->state == MQTT_SN_CLIENT_DISCONNECTED) { - LOG_WRN("%s called while disconnected: Nothing to do", __func__); + /* Handle GW search process timers */ + err = process_search(client, &next_cycle); + if (err) { return; } @@ -653,6 +841,7 @@ static void process_work(struct k_work *wrk) } if (next_cycle > 0) { + LOG_DBG("next_cycle: %lld", next_cycle); k_work_schedule(dwork, K_MSEC(next_cycle - k_uptime_get())); } } @@ -695,6 +884,7 @@ void mqtt_sn_client_deinit(struct mqtt_sn_client *client) mqtt_sn_publish_destroy_all(client); mqtt_sn_topic_destroy_all(client); + mqtt_sn_gw_destroy_all(client); if (client->transport && client->transport->deinit) { client->transport->deinit(client->transport); @@ -703,6 +893,40 @@ void mqtt_sn_client_deinit(struct mqtt_sn_client *client) k_work_cancel_delayable(&client->process_work); } +int mqtt_sn_add_gw(struct mqtt_sn_client *client, uint8_t gw_id, struct mqtt_sn_data gw_addr) +{ + struct mqtt_sn_gateway *gw; + + gw = mqtt_sn_gw_find_id(client, gw_id); + + if (gw != NULL) { + mqtt_sn_gw_destroy(client, gw); + } + + gw = mqtt_sn_gw_create(gw_id, -1, gw_addr); + if (!gw) { + return -ENOMEM; + } + + sys_slist_append(&client->gateway, &gw->next); + + return 0; +} + +int mqtt_sn_search(struct mqtt_sn_client *client, uint8_t radius) +{ + if (!client) { + return -EINVAL; + } + /* Set SEARCHGW transmission timer */ + client->ts_searchgw = k_uptime_get() + (T_SEARCHGW_MSEC * sys_rand8_get() / 255); + k_work_schedule(&client->process_work, K_NO_WAIT); + LOG_DBG("Requested SEARCHGW for time %lld at time %lld", client->ts_searchgw, + k_uptime_get()); + + return 0; +} + int mqtt_sn_connect(struct mqtt_sn_client *client, bool will, bool clean_session) { struct mqtt_sn_param p = {.type = MQTT_SN_MSG_TYPE_CONNECT}; @@ -728,7 +952,7 @@ int mqtt_sn_connect(struct mqtt_sn_client *client, bool will, bool clean_session client->last_ping = k_uptime_get(); - return encode_and_send(client, &p); + return encode_and_send(client, &p, 0); } int mqtt_sn_disconnect(struct mqtt_sn_client *client) @@ -742,7 +966,7 @@ int mqtt_sn_disconnect(struct mqtt_sn_client *client) p.params.disconnect.duration = 0; - err = encode_and_send(client, &p); + err = encode_and_send(client, &p, 0); mqtt_sn_disconnect_internal(client); return err; @@ -759,14 +983,14 @@ int mqtt_sn_sleep(struct mqtt_sn_client *client, uint16_t duration) p.params.disconnect.duration = duration; - err = encode_and_send(client, &p); + err = encode_and_send(client, &p, 0); mqtt_sn_sleep_internal(client); return err; } int mqtt_sn_subscribe(struct mqtt_sn_client *client, enum mqtt_sn_qos qos, - struct mqtt_sn_data *topic_name) + struct mqtt_sn_data *topic_name) { struct mqtt_sn_topic *topic; int err; @@ -833,7 +1057,7 @@ int mqtt_sn_unsubscribe(struct mqtt_sn_client *client, enum mqtt_sn_qos qos, } int mqtt_sn_publish(struct mqtt_sn_client *client, enum mqtt_sn_qos qos, - struct mqtt_sn_data *topic_name, bool retain, struct mqtt_sn_data *data) + struct mqtt_sn_data *topic_name, bool retain, struct mqtt_sn_data *data) { struct mqtt_sn_publish *pub; struct mqtt_sn_topic *topic; @@ -885,6 +1109,84 @@ int mqtt_sn_publish(struct mqtt_sn_client *client, enum mqtt_sn_qos qos, return 0; } +static void handle_advertise(struct mqtt_sn_client *client, struct mqtt_sn_param_advertise *p, + struct mqtt_sn_data rx_addr) +{ + struct mqtt_sn_evt evt = {.type = MQTT_SN_EVT_ADVERTISE}; + struct mqtt_sn_gateway *gw; + + gw = mqtt_sn_gw_find_id(client, p->gw_id); + + if (gw == NULL) { + LOG_DBG("Creating GW 0x%02x with duration %d", p->gw_id, p->duration); + gw = mqtt_sn_gw_create(p->gw_id, p->duration, rx_addr); + if (!gw) { + return; + } + sys_slist_append(&client->gateway, &gw->next); + } else { + LOG_DBG("Updating timer for GW 0x%02x with duration %d", p->gw_id, p->duration); + gw->adv_timer = + k_uptime_get() + (p->duration * CONFIG_MQTT_SN_LIB_N_ADV * MSEC_PER_SEC); + } + + k_work_schedule(&client->process_work, K_NO_WAIT); + if (client->evt_cb) { + client->evt_cb(client, &evt); + } +} + +static void handle_searchgw(struct mqtt_sn_client *client, struct mqtt_sn_param_searchgw *p) +{ + struct mqtt_sn_evt evt = {.type = MQTT_SN_EVT_SEARCHGW}; + + /* Increment SEARCHGW transmission timestamp if waiting */ + if (client->ts_searchgw != 0) { + client->ts_searchgw = k_uptime_get() + (T_SEARCHGW_MSEC * sys_rand8_get() / 255); + } + + /* Set transmission timestamp to respond to SEARCHGW if we have a GW */ + if (sys_slist_len(&client->gateway) > 0) { + client->ts_gwinfo = k_uptime_get() + (T_GWINFO_MSEC * sys_rand8_get() / 255); + } + client->radius_gwinfo = p->radius; + k_work_schedule(&client->process_work, K_NO_WAIT); + + if (client->evt_cb) { + client->evt_cb(client, &evt); + } +} + +static void handle_gwinfo(struct mqtt_sn_client *client, struct mqtt_sn_param_gwinfo *p, + struct mqtt_sn_data rx_addr) +{ + struct mqtt_sn_evt evt = {.type = MQTT_SN_EVT_GWINFO}; + struct mqtt_sn_gateway *gw; + + /* Clear SEARCHGW and GWINFO transmission if waiting */ + client->ts_searchgw = 0; + client->ts_gwinfo = 0; + k_work_schedule(&client->process_work, K_NO_WAIT); + + /* Extract GW info and store */ + if (p->gw_add.size > 0) { + rx_addr.data = p->gw_add.data; + rx_addr.size = p->gw_add.size; + } else { + } + gw = mqtt_sn_gw_create(p->gw_id, -1, rx_addr); + + if (!gw) { + return; + } + + sys_slist_append(&client->gateway, &gw->next); + + if (client->evt_cb) { + client->evt_cb(client, &evt); + } +} + static void handle_connack(struct mqtt_sn_client *client, struct mqtt_sn_param_connack *p) { struct mqtt_sn_evt evt = {.type = MQTT_SN_EVT_CONNECTED}; @@ -922,7 +1224,7 @@ static void handle_willtopicreq(struct mqtt_sn_client *client) response.params.willtopic.topic.data = client->will_topic.data; response.params.willtopic.topic.size = client->will_topic.size; - encode_and_send(client, &response); + encode_and_send(client, &response, 0); } static void handle_willmsgreq(struct mqtt_sn_client *client) @@ -932,7 +1234,7 @@ static void handle_willmsgreq(struct mqtt_sn_client *client) response.params.willmsg.msg.data = client->will_msg.data; response.params.willmsg.msg.size = client->will_msg.size; - encode_and_send(client, &response); + encode_and_send(client, &response, 0); } static void handle_register(struct mqtt_sn_client *client, struct mqtt_sn_param_register *p) @@ -955,7 +1257,7 @@ static void handle_register(struct mqtt_sn_client *client, struct mqtt_sn_param_ response.params.regack.topic_id = p->topic_id; response.params.regack.msg_id = p->msg_id; - encode_and_send(client, &response); + encode_and_send(client, &response, 0); } static void handle_regack(struct mqtt_sn_client *client, struct mqtt_sn_param_regack *p) @@ -980,8 +1282,8 @@ static void handle_publish(struct mqtt_sn_client *client, struct mqtt_sn_param_p { struct mqtt_sn_param response; struct mqtt_sn_evt evt = {.param.publish = {.data = p->data, - .topic_id = p->topic_id, - .topic_type = p->topic_type}, + .topic_id = p->topic_id, + .topic_type = p->topic_type}, .type = MQTT_SN_EVT_PUBLISH}; if (p->qos == MQTT_SN_QOS_1) { @@ -990,12 +1292,12 @@ static void handle_publish(struct mqtt_sn_client *client, struct mqtt_sn_param_p response.params.puback.msg_id = p->msg_id; response.params.puback.ret_code = MQTT_SN_CODE_ACCEPTED; - encode_and_send(client, &response); + encode_and_send(client, &response, 0); } else if (p->qos == MQTT_SN_QOS_2) { response.type = MQTT_SN_MSG_TYPE_PUBREC; response.params.pubrec.msg_id = p->msg_id; - encode_and_send(client, &response); + encode_and_send(client, &response, 0); } if (client->evt_cb) { @@ -1030,7 +1332,7 @@ static void handle_pubrec(struct mqtt_sn_client *client, struct mqtt_sn_param_pu response.params.pubrel.msg_id = p->msg_id; - encode_and_send(client, &response); + encode_and_send(client, &response, 0); } static void handle_pubrel(struct mqtt_sn_client *client, struct mqtt_sn_param_pubrel *p) @@ -1039,7 +1341,7 @@ static void handle_pubrel(struct mqtt_sn_client *client, struct mqtt_sn_param_pu response.params.pubcomp.msg_id = p->msg_id; - encode_and_send(client, &response); + encode_and_send(client, &response, 0); } static void handle_pubcomp(struct mqtt_sn_client *client, struct mqtt_sn_param_pubcomp *p) @@ -1088,7 +1390,7 @@ static void handle_pingreq(struct mqtt_sn_client *client) { struct mqtt_sn_param response = {.type = MQTT_SN_MSG_TYPE_PINGRESP}; - encode_and_send(client, &response); + encode_and_send(client, &response, 0); } static void handle_pingresp(struct mqtt_sn_client *client) @@ -1112,7 +1414,7 @@ static void handle_disconnect(struct mqtt_sn_client *client, struct mqtt_sn_para mqtt_sn_disconnect_internal(client); } -static int handle_msg(struct mqtt_sn_client *client) +static int handle_msg(struct mqtt_sn_client *client, struct mqtt_sn_data rx_addr) { int err; struct mqtt_sn_param p; @@ -1125,7 +1427,14 @@ static int handle_msg(struct mqtt_sn_client *client) LOG_INF("Got message of type %d", p.type); switch (p.type) { + case MQTT_SN_MSG_TYPE_ADVERTISE: + handle_advertise(client, &p.params.advertise, rx_addr); + break; + case MQTT_SN_MSG_TYPE_SEARCHGW: + handle_searchgw(client, &p.params.searchgw); + break; case MQTT_SN_MSG_TYPE_GWINFO: + handle_gwinfo(client, &p.params.gwinfo, rx_addr); break; case MQTT_SN_MSG_TYPE_CONNACK: handle_connack(client, &p.params.connack); @@ -1189,9 +1498,11 @@ static int handle_msg(struct mqtt_sn_client *client) int mqtt_sn_input(struct mqtt_sn_client *client) { ssize_t next_frame_size; + char addr[CONFIG_MQTT_SN_LIB_MAX_ADDR_SIZE]; + struct mqtt_sn_data rx_addr = {.data = addr, .size = CONFIG_MQTT_SN_LIB_MAX_ADDR_SIZE}; int err; - if (!client || !client->transport || !client->transport->recv) { + if (!client || !client->transport || !client->transport->recvfrom) { return -EINVAL; } @@ -1204,7 +1515,8 @@ int mqtt_sn_input(struct mqtt_sn_client *client) net_buf_simple_reset(&client->rx); - next_frame_size = client->transport->recv(client, client->rx.data, client->rx.size); + next_frame_size = client->transport->recvfrom(client, client->rx.data, client->rx.size, + (void *)rx_addr.data, &rx_addr.size); if (next_frame_size <= 0) { return next_frame_size; } @@ -1217,7 +1529,7 @@ int mqtt_sn_input(struct mqtt_sn_client *client) LOG_HEXDUMP_DBG(client->rx.data, client->rx.len, "Received data"); - err = handle_msg(client); + err = handle_msg(client, rx_addr); if (err) { return err; diff --git a/subsys/net/lib/mqtt_sn/mqtt_sn_decoder.c b/subsys/net/lib/mqtt_sn/mqtt_sn_decoder.c index 17cf7de0839ee..2c44c6befa0e2 100644 --- a/subsys/net/lib/mqtt_sn/mqtt_sn_decoder.c +++ b/subsys/net/lib/mqtt_sn/mqtt_sn_decoder.c @@ -111,6 +111,17 @@ static int decode_msg_advertise(struct net_buf_simple *buf, struct mqtt_sn_param return 0; } +static int decode_msg_searchgw(struct net_buf_simple *buf, struct mqtt_sn_param_searchgw *params) +{ + if (buf->len != 1) { + return -EPROTO; + } + + params->radius = net_buf_simple_pull_u8(buf); + + return 0; +} + static int decode_msg_gwinfo(struct net_buf_simple *buf, struct mqtt_sn_param_gwinfo *params) { if (buf->len < 1) { @@ -121,6 +132,8 @@ static int decode_msg_gwinfo(struct net_buf_simple *buf, struct mqtt_sn_param_gw if (buf->len) { decode_data(buf, ¶ms->gw_add); + } else { + params->gw_add.size = 0; } return 0; @@ -332,6 +345,8 @@ int mqtt_sn_decode_msg(struct net_buf_simple *buf, struct mqtt_sn_param *params) switch (params->type) { case MQTT_SN_MSG_TYPE_ADVERTISE: return decode_msg_advertise(buf, ¶ms->params.advertise); + case MQTT_SN_MSG_TYPE_SEARCHGW: + return decode_msg_searchgw(buf, ¶ms->params.searchgw); case MQTT_SN_MSG_TYPE_GWINFO: return decode_msg_gwinfo(buf, ¶ms->params.gwinfo); case MQTT_SN_MSG_TYPE_CONNACK: diff --git a/subsys/net/lib/mqtt_sn/mqtt_sn_transport_udp.c b/subsys/net/lib/mqtt_sn/mqtt_sn_transport_udp.c index 2104e8b0ac907..61d8e030cfee9 100644 --- a/subsys/net/lib/mqtt_sn/mqtt_sn_transport_udp.c +++ b/subsys/net/lib/mqtt_sn/mqtt_sn_transport_udp.c @@ -14,6 +14,7 @@ #include #include #include +#include #include @@ -43,25 +44,93 @@ static int tp_udp_init(struct mqtt_sn_transport *transport) { struct mqtt_sn_transport_udp *udp = UDP_TRANSPORT(transport); int err; + struct sockaddr addrm; + struct ip_mreqn mreqn; + int optval; + struct net_if *iface; - udp->sock = zsock_socket(udp->gwaddr.sa_family, SOCK_DGRAM, 0); + udp->sock = zsock_socket(udp->bcaddr.sa_family, SOCK_DGRAM, 0); if (udp->sock < 0) { return errno; } LOG_DBG("Socket %d", udp->sock); -#ifdef LOG_DBG - char ip[30], *out; + optval = 1; + err = zsock_setsockopt(udp->sock, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)); + if (err < 0) { + return errno; + } + + if (IS_ENABLED(CONFIG_MQTT_SN_LOG_LEVEL_DBG)) { + char ip[30], *out; + uint16_t port; + + out = get_ip_str((struct sockaddr *)&udp->bcaddr, ip, sizeof(ip)); + switch (udp->bcaddr.sa_family) { + case AF_INET: + port = ntohs(((struct sockaddr_in *)&udp->bcaddr)->sin_port); + break; + case AF_INET6: + port = ntohs(((struct sockaddr_in6 *)&udp->bcaddr)->sin6_port); + break; + default: + break; + } + + if (out != NULL) { + LOG_DBG("Binding to Brodcast IP %s:%u", out, port); + } + } + + switch (udp->bcaddr.sa_family) { + case AF_INET: + if (IS_ENABLED(CONFIG_NET_IPV4)) { + addrm.sa_family = AF_INET; + ((struct sockaddr_in *)&addrm)->sin_port = + ((struct sockaddr_in *)&udp->bcaddr)->sin_port; + ((struct sockaddr_in *)&addrm)->sin_addr.s_addr = INADDR_ANY; + } + break; + case AF_INET6: + if (IS_ENABLED(CONFIG_NET_IPV6)) { + addrm.sa_family = AF_INET6; + ((struct sockaddr_in6 *)&addrm)->sin6_port = + ((struct sockaddr_in6 *)&udp->bcaddr)->sin6_port; + memcpy(&((struct sockaddr_in6 *)&addrm)->sin6_addr, &in6addr_any, + sizeof(struct in6_addr)); + break; + } + default: + LOG_ERR("Unknown AF"); + return -EINVAL; + } + + err = zsock_bind(udp->sock, &addrm, sizeof(addrm)); + if (err) { + LOG_ERR("Error during bind: %d", errno); + return errno; + } - out = get_ip_str((struct sockaddr *)&udp->gwaddr, ip, sizeof(ip)); - if (out != NULL) { - LOG_DBG("Connecting to IP %s:%u", out, - ntohs(((struct sockaddr_in *)&udp->gwaddr)->sin_port)); + memcpy(&mreqn.imr_multiaddr, &udp->bcaddr.data[2], sizeof(udp->bcaddr.data) - 2); + if (udp->bcaddr.sa_family == AF_INET && IS_ENABLED(CONFIG_NET_IPV4)) { + iface = net_if_ipv4_select_src_iface( + &((struct sockaddr_in *)&udp->bcaddr)->sin_addr); + } else if (udp->bcaddr.sa_family == AF_INET6 && IS_ENABLED(CONFIG_NET_IPV6)) { + iface = net_if_ipv6_select_src_iface(&((struct sockaddr_in6 *)&addrm)->sin6_addr); + } else { + LOG_ERR("Unknown AF"); + return -EINVAL; } -#endif + mreqn.imr_ifindex = net_if_get_by_iface(iface); - err = zsock_connect(udp->sock, (struct sockaddr *)&udp->gwaddr, udp->gwaddrlen); + err = zsock_setsockopt(udp->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreqn, sizeof(mreqn)); + if (err < 0) { + return errno; + } + + optval = CONFIG_MQTT_SN_LIB_BROADCAST_RADIUS; + err = zsock_setsockopt(udp->sock, IPPROTO_IP, IP_MULTICAST_TTL, &optval, sizeof(optval)); if (err < 0) { return errno; } @@ -76,14 +145,37 @@ static void tp_udp_deinit(struct mqtt_sn_transport *transport) zsock_close(udp->sock); } -static int tp_udp_msg_send(struct mqtt_sn_client *client, void *buf, size_t sz) +static int tp_udp_sendto(struct mqtt_sn_client *client, void *buf, size_t sz, const void *dest_addr, + size_t addrlen) { struct mqtt_sn_transport_udp *udp = UDP_TRANSPORT(client->transport); int rc; + int ttl; + socklen_t ttl_len; + + if (dest_addr == NULL) { + LOG_HEXDUMP_DBG(buf, sz, "Sending Broadcast UDP packet"); + + /* Set ttl if requested value does not match existing*/ + rc = zsock_getsockopt(udp->sock, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, &ttl_len); + if (rc < 0) { + return -errno; + } + if (ttl != addrlen) { + ttl = addrlen; + rc = zsock_setsockopt(udp->sock, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, + sizeof(ttl)); + if (rc < 0) { + return -errno; + } + } + + rc = zsock_sendto(udp->sock, buf, sz, 0, &udp->bcaddr, udp->bcaddrlen); + } else { + LOG_HEXDUMP_DBG(buf, sz, "Sending Addressed UDP packet"); + rc = zsock_sendto(udp->sock, buf, sz, 0, dest_addr, addrlen); + } - LOG_HEXDUMP_DBG(buf, sz, "Sending UDP packet"); - - rc = zsock_send(udp->sock, buf, sz, 0); if (rc < 0) { return -errno; } @@ -95,12 +187,14 @@ static int tp_udp_msg_send(struct mqtt_sn_client *client, void *buf, size_t sz) return 0; } -static ssize_t tp_udp_recv(struct mqtt_sn_client *client, void *buffer, size_t length) +static ssize_t tp_udp_recvfrom(struct mqtt_sn_client *client, void *buffer, size_t length, + void *src_addr, size_t *addrlen) { struct mqtt_sn_transport_udp *udp = UDP_TRANSPORT(client->transport); int rc; + struct sockaddr *srcaddr = src_addr; - rc = zsock_recv(udp->sock, buffer, length, 0); + rc = zsock_recvfrom(udp->sock, buffer, length, 0, src_addr, addrlen); LOG_DBG("recv %d", rc); if (rc < 0) { return -errno; @@ -108,6 +202,16 @@ static ssize_t tp_udp_recv(struct mqtt_sn_client *client, void *buffer, size_t l LOG_HEXDUMP_DBG(buffer, rc, "recv"); + if (*addrlen != udp->bcaddrlen) { + return rc; + } + + if (memcmp(srcaddr->data, udp->bcaddr.data, *addrlen) != 0) { + return rc; + } + + src_addr = NULL; + *addrlen = 1; return rc; } @@ -131,10 +235,10 @@ static int tp_udp_poll(struct mqtt_sn_client *client) return pollfd.revents & ZSOCK_POLLIN; } -int mqtt_sn_transport_udp_init(struct mqtt_sn_transport_udp *udp, struct sockaddr *gwaddr, +int mqtt_sn_transport_udp_init(struct mqtt_sn_transport_udp *udp, struct sockaddr *bcaddr, socklen_t addrlen) { - if (!udp || !gwaddr || !addrlen) { + if (!udp || !bcaddr || !addrlen) { return -EINVAL; } @@ -142,14 +246,14 @@ int mqtt_sn_transport_udp_init(struct mqtt_sn_transport_udp *udp, struct sockadd udp->tp = (struct mqtt_sn_transport){.init = tp_udp_init, .deinit = tp_udp_deinit, - .msg_send = tp_udp_msg_send, + .sendto = tp_udp_sendto, .poll = tp_udp_poll, - .recv = tp_udp_recv}; + .recvfrom = tp_udp_recvfrom}; udp->sock = 0; - memcpy(&udp->gwaddr, gwaddr, addrlen); - udp->gwaddrlen = addrlen; + memcpy(&udp->bcaddr, bcaddr, addrlen); + udp->bcaddrlen = addrlen; return 0; } From cc33fd685f022797865f8597a43ad270c106f52a Mon Sep 17 00:00:00 2001 From: Kenneth Witham Date: Mon, 28 Oct 2024 08:10:25 -0700 Subject: [PATCH 2565/4482] net: mqtt-sn: Update MQTT-SN Unit Tests Fixes: #78010 This commit adds tests for the "Gateway Advertisement and Discovery" process. This includes tests for handling SEARCHGW, GWINFO, and ADVERTISE as well as manually adding a Gateway for use. Gateway pruning when missing ADVERTISE messages is also tested. Signed-off-by: Kenneth Witham --- tests/net/lib/mqtt_sn_client/prj.conf | 5 + .../lib/mqtt_sn_client/src/mqtt_sn_client.c | 279 ++++++++++++++++-- 2 files changed, 252 insertions(+), 32 deletions(-) diff --git a/tests/net/lib/mqtt_sn_client/prj.conf b/tests/net/lib/mqtt_sn_client/prj.conf index 636d6248748f6..f6b4f339f7abf 100644 --- a/tests/net/lib/mqtt_sn_client/prj.conf +++ b/tests/net/lib/mqtt_sn_client/prj.conf @@ -18,3 +18,8 @@ CONFIG_ZTEST_STACK_SIZE=8192 CONFIG_STACK_USAGE=y CONFIG_STACK_SENTINEL=y CONFIG_DEBUG=y + +# Reduce MQTT_SN delay times for testing +CONFIG_MQTT_SN_LIB_T_SEARCHGW=0 +CONFIG_MQTT_SN_LIB_T_GWINFO=0 +CONFIG_MQTT_SN_LIB_N_ADV=1 diff --git a/tests/net/lib/mqtt_sn_client/src/mqtt_sn_client.c b/tests/net/lib/mqtt_sn_client/src/mqtt_sn_client.c index 2ae8fd88e9b8a..ad01459373222 100644 --- a/tests/net/lib/mqtt_sn_client/src/mqtt_sn_client.c +++ b/tests/net/lib/mqtt_sn_client/src/mqtt_sn_client.c @@ -15,6 +15,9 @@ LOG_MODULE_REGISTER(test); static const struct mqtt_sn_data client_id = MQTT_SN_DATA_STRING_LITERAL("zephyr"); +static const struct mqtt_sn_data client2_id = MQTT_SN_DATA_STRING_LITERAL("zephyr2"); +static const uint8_t gw_id = 12; +static const struct mqtt_sn_data gw_addr = MQTT_SN_DATA_STRING_LITERAL("gw1"); static uint8_t tx[255]; static uint8_t rx[255]; @@ -23,24 +26,45 @@ static struct msg_send_data { int called; size_t msg_sz; int ret; + const void *dest_addr; + size_t addrlen; struct mqtt_sn_client *client; } msg_send_data; -static int msg_send(struct mqtt_sn_client *client, void *buf, size_t sz) +struct k_sem mqtt_sn_tx_sem; +struct k_sem mqtt_sn_rx_sem; +struct k_sem mqtt_sn_cb_sem; + +int mqtt_sn_data_cmp(struct mqtt_sn_data data1, struct mqtt_sn_data data2) +{ + return data1.size == data2.size && strncmp(data1.data, data2.data, data1.size); +} + +static int msg_sendto(struct mqtt_sn_client *client, void *buf, size_t sz, const void *dest_addr, + size_t addrlen) { msg_send_data.called++; msg_send_data.msg_sz = sz; msg_send_data.client = client; + msg_send_data.dest_addr = dest_addr; + msg_send_data.addrlen = addrlen; + + k_sem_give(&mqtt_sn_tx_sem); return msg_send_data.ret; } -static void assert_msg_send(int called, size_t msg_sz) +static void assert_msg_send(int called, size_t msg_sz, const struct mqtt_sn_data *dest_addr) { zassert_equal(msg_send_data.called, called, "msg_send called %d times instead of %d", msg_send_data.called, called); zassert_equal(msg_send_data.msg_sz, msg_sz, "msg_sz is %zu instead of %zu", msg_send_data.msg_sz, msg_sz); + if (dest_addr != NULL) { + zassert_equal(mqtt_sn_data_cmp(*dest_addr, + *((struct mqtt_sn_data *)msg_send_data.dest_addr)), + 0, "Addresses incorrect"); + } memset(&msg_send_data, 0, sizeof(msg_send_data)); } @@ -54,6 +78,8 @@ static void evt_cb(struct mqtt_sn_client *client, const struct mqtt_sn_evt *evt) { memcpy(&evt_cb_data.last_evt, evt, sizeof(*evt)); evt_cb_data.called++; + + k_sem_give(&mqtt_sn_cb_sem); } static bool tp_initialized; @@ -68,23 +94,30 @@ static int tp_init(struct mqtt_sn_transport *tp) static struct { void *data; ssize_t sz; -} recv_data; + const void *src_addr; + size_t addrlen; +} recvfrom_data; -static ssize_t tp_recv(struct mqtt_sn_client *client, void *buffer, size_t length) +static ssize_t tp_recvfrom(struct mqtt_sn_client *client, void *buffer, size_t length, + void *src_addr, size_t *addrlen) { - if (recv_data.data && recv_data.sz > 0 && length >= recv_data.sz) { - memcpy(buffer, recv_data.data, recv_data.sz); + if (recvfrom_data.data && recvfrom_data.sz > 0 && length >= recvfrom_data.sz) { + memcpy(buffer, recvfrom_data.data, recvfrom_data.sz); + memcpy(src_addr, recvfrom_data.src_addr, recvfrom_data.addrlen); + *addrlen = recvfrom_data.addrlen; + + k_sem_give(&mqtt_sn_rx_sem); } - return recv_data.sz; + return recvfrom_data.sz; } int tp_poll(struct mqtt_sn_client *client) { - return recv_data.sz; + return recvfrom_data.sz; } -static ZTEST_BMEM struct mqtt_sn_client mqtt_clients[3]; +static ZTEST_BMEM struct mqtt_sn_client mqtt_clients[8]; static ZTEST_BMEM struct mqtt_sn_client *mqtt_client; static void setup(void *f) @@ -95,18 +128,24 @@ static void setup(void *f) mqtt_client = &mqtt_clients[i++]; transport = (struct mqtt_sn_transport){ - .init = tp_init, .msg_send = msg_send, .recv = tp_recv, .poll = tp_poll}; + .init = tp_init, .sendto = msg_sendto, .recvfrom = tp_recvfrom, .poll = tp_poll}; tp_initialized = false; memset(&evt_cb_data, 0, sizeof(evt_cb_data)); memset(&msg_send_data, 0, sizeof(msg_send_data)); - memset(&recv_data, 0, sizeof(recv_data)); + memset(&recvfrom_data, 0, sizeof(recvfrom_data)); + k_sem_init(&mqtt_sn_tx_sem, 0, 1); + k_sem_init(&mqtt_sn_rx_sem, 0, 1); + k_sem_init(&mqtt_sn_cb_sem, 0, 1); } -static int input(struct mqtt_sn_client *client, void *buf, size_t sz) +static int input(struct mqtt_sn_client *client, void *buf, size_t sz, + const struct mqtt_sn_data *src_addr) { - recv_data.data = buf; - recv_data.sz = sz; + recvfrom_data.data = buf; + recvfrom_data.sz = sz; + recvfrom_data.src_addr = src_addr->data; + recvfrom_data.addrlen = src_addr->size; return mqtt_sn_input(client); } @@ -122,24 +161,187 @@ static void mqtt_sn_connect_no_will(struct mqtt_sn_client *client) zassert_equal(err, 0, "unexpected error %d"); zassert_true(tp_initialized, "Transport not initialized"); + err = mqtt_sn_add_gw(client, gw_id, gw_addr); + zassert_equal(err, 0, "unexpected error %d"); + zassert_equal(evt_cb_data.called, 0, "Unexpected event"); + zassert_false(sys_slist_is_empty(&client->gateway), "GW not saved."); + err = mqtt_sn_connect(client, false, false); zassert_equal(err, 0, "unexpected error %d"); - assert_msg_send(1, 12); + assert_msg_send(1, 12, &gw_addr); zassert_equal(client->state, 0, "Wrong state"); zassert_equal(evt_cb_data.called, 0, "Unexpected event"); - err = input(client, connack, sizeof(connack)); + err = input(client, connack, sizeof(connack), &gw_addr); zassert_equal(err, 0, "unexpected error %d"); zassert_equal(client->state, 1, "Wrong state"); zassert_equal(evt_cb_data.called, 1, "NO event"); zassert_equal(evt_cb_data.last_evt.type, MQTT_SN_EVT_CONNECTED, "Wrong event"); - k_sleep(K_MSEC(10)); } -static ZTEST(mqtt_sn_client, test_mqtt_sn_connect_no_will) +static ZTEST(mqtt_sn_client, test_mqtt_sn_handle_advertise) { + static uint8_t advertise[] = {5, 0x00, 0x0c, 0, 1}; + static uint8_t connack[] = {3, 0x05, 0x00}; + int err; + + err = mqtt_sn_client_init(mqtt_client, &client_id, &transport, evt_cb, tx, sizeof(tx), rx, + sizeof(rx)); + zassert_equal(err, 0, "unexpected error %d"); + + err = input(mqtt_client, advertise, sizeof(advertise), &gw_addr); + zassert_equal(err, 0, "unexpected error %d"); + zassert_false(sys_slist_is_empty(&mqtt_client->gateway), "GW not saved."); + zassert_equal(evt_cb_data.called, 1, "NO event"); + zassert_equal(evt_cb_data.last_evt.type, MQTT_SN_EVT_ADVERTISE, "Wrong event"); + + err = input(mqtt_client, advertise, sizeof(advertise), &gw_addr); + zassert_equal(err, 0, "unexpected error %d"); + zassert_false(sys_slist_is_empty(&mqtt_client->gateway), "GW not saved."); + zassert_equal(sys_slist_len(&mqtt_client->gateway), 1, "Too many Gateways stored."); + zassert_equal(evt_cb_data.called, 2, "Unexpected event"); + zassert_equal(evt_cb_data.last_evt.type, MQTT_SN_EVT_ADVERTISE, "Wrong event"); + + err = mqtt_sn_connect(mqtt_client, false, false); + zassert_equal(err, 0, "unexpected error %d"); + assert_msg_send(1, 12, &gw_addr); + zassert_equal(mqtt_client->state, 0, "Wrong state"); + zassert_equal(evt_cb_data.called, 2, "Unexpected event"); + + err = input(mqtt_client, connack, sizeof(connack), &gw_addr); + zassert_equal(err, 0, "unexpected error %d"); + zassert_equal(mqtt_client->state, 1, "Wrong state"); + zassert_equal(evt_cb_data.called, 3, "NO event"); + zassert_equal(evt_cb_data.last_evt.type, MQTT_SN_EVT_CONNECTED, "Wrong event"); + + err = k_sem_take(&mqtt_sn_cb_sem, K_NO_WAIT); + err = k_sem_take(&mqtt_sn_cb_sem, K_SECONDS(10)); + zassert_equal(err, 0, "Timed out waiting for callback."); + + zassert_true(sys_slist_is_empty(&mqtt_client->gateway), "GW not cleared on timeout"); + zassert_equal(evt_cb_data.called, 4, "NO event"); + zassert_equal(evt_cb_data.last_evt.type, MQTT_SN_EVT_DISCONNECTED, "Wrong event"); + zassert_equal(mqtt_client->state, 0, "Wrong state"); + + mqtt_sn_client_deinit(mqtt_client); +} + +static ZTEST(mqtt_sn_client, test_mqtt_sn_add_gw) +{ + int err; + + err = mqtt_sn_client_init(mqtt_client, &client_id, &transport, evt_cb, tx, sizeof(tx), rx, + sizeof(rx)); + zassert_equal(err, 0, "unexpected error %d"); + + err = mqtt_sn_add_gw(mqtt_client, gw_id, gw_addr); + zassert_equal(err, 0, "unexpected error %d"); + zassert_false(sys_slist_is_empty(&mqtt_client->gateway), "GW not saved."); + zassert_equal(evt_cb_data.called, 0, "Unexpected event"); + + mqtt_sn_client_deinit(mqtt_client); +} + +/* Test send SEARCHGW and GW response */ +static ZTEST(mqtt_sn_client, test_mqtt_sn_search_gw) +{ + int err; + static uint8_t gwinfo[3]; + + gwinfo[0] = 3; + gwinfo[1] = 0x02; + gwinfo[2] = gw_id; + + err = mqtt_sn_client_init(mqtt_client, &client_id, &transport, evt_cb, tx, sizeof(tx), rx, + sizeof(rx)); + zassert_equal(err, 0, "unexpected error %d"); + err = k_sem_take(&mqtt_sn_tx_sem, K_NO_WAIT); + err = mqtt_sn_search(mqtt_client, 1); + zassert_equal(err, 0, "unexpected error %d"); + + err = k_sem_take(&mqtt_sn_tx_sem, K_SECONDS(10)); + zassert_equal(err, 0, "Timed out waiting for callback."); + + assert_msg_send(1, 3, NULL); + zassert_equal(mqtt_client->state, 0, "Wrong state"); + zassert_equal(evt_cb_data.called, 0, "Unexpected event"); + + err = input(mqtt_client, gwinfo, sizeof(gwinfo), &gw_addr); + zassert_equal(err, 0, "unexpected error %d"); + zassert_false(sys_slist_is_empty(&mqtt_client->gateway), "GW not saved."); + zassert_equal(evt_cb_data.last_evt.type, MQTT_SN_EVT_GWINFO, "Wrong event"); + + mqtt_sn_client_deinit(mqtt_client); +} + +/* Test send SEARCHGW and peer response */ +static ZTEST(mqtt_sn_client, test_mqtt_sn_search_peer) +{ + int err; + static uint8_t gwinfo[3 + 3]; + + gwinfo[0] = 3 + gw_addr.size; + gwinfo[1] = 0x02; + gwinfo[2] = gw_id; + memcpy(&gwinfo[3], gw_addr.data, 3); + + err = mqtt_sn_client_init(mqtt_client, &client_id, &transport, evt_cb, tx, sizeof(tx), rx, + sizeof(rx)); + zassert_equal(err, 0, "unexpected error %d"); + + err = k_sem_take(&mqtt_sn_tx_sem, K_NO_WAIT); + err = mqtt_sn_search(mqtt_client, 1); + zassert_equal(err, 0, "unexpected error %d"); + + err = k_sem_take(&mqtt_sn_tx_sem, K_SECONDS(10)); + zassert_equal(err, 0, "Timed out waiting for callback."); + + assert_msg_send(1, 3, NULL); + zassert_equal(mqtt_client->state, 0, "Wrong state"); + zassert_equal(evt_cb_data.called, 0, "Unexpected event"); + + err = input(mqtt_client, gwinfo, sizeof(gwinfo), &gw_addr); + zassert_equal(err, 0, "unexpected error %d"); + zassert_false(sys_slist_is_empty(&mqtt_client->gateway), "GW not saved."); + zassert_equal(evt_cb_data.called, 1, "NO event"); + zassert_equal(evt_cb_data.last_evt.type, MQTT_SN_EVT_GWINFO, "Wrong event"); + + mqtt_sn_client_deinit(mqtt_client); +} + +static ZTEST(mqtt_sn_client, test_mqtt_sn_respond_searchgw) +{ + int err; + static uint8_t searchgw[] = {3, 0x01, 1}; + + err = mqtt_sn_client_init(mqtt_client, &client_id, &transport, evt_cb, tx, sizeof(tx), rx, + sizeof(rx)); + zassert_equal(err, 0, "unexpected error %d"); + + err = mqtt_sn_add_gw(mqtt_client, gw_id, gw_addr); + zassert_equal(err, 0, "unexpected error %d"); + zassert_false(sys_slist_is_empty(&mqtt_client->gateway), "GW not saved."); + zassert_equal(evt_cb_data.called, 0, "Unexpected event"); + + err = k_sem_take(&mqtt_sn_tx_sem, K_NO_WAIT); + err = input(mqtt_client, searchgw, sizeof(searchgw), &client2_id); + zassert_equal(err, 0, "unexpected error %d"); + + err = k_sem_take(&mqtt_sn_tx_sem, K_SECONDS(10)); + zassert_equal(err, 0, "Timed out waiting for callback."); + + zassert_equal(evt_cb_data.called, 1, "NO event"); + zassert_equal(evt_cb_data.last_evt.type, MQTT_SN_EVT_SEARCHGW, "Wrong event"); + assert_msg_send(1, 3 + gw_addr.size, NULL); + + mqtt_sn_client_deinit(mqtt_client); +} + +static ZTEST(mqtt_sn_client, test_mqtt_sn_connect_no_will) +{ mqtt_sn_connect_no_will(mqtt_client); + mqtt_sn_client_deinit(mqtt_client); } static ZTEST(mqtt_sn_client, test_mqtt_sn_connect_will) @@ -154,31 +356,37 @@ static ZTEST(mqtt_sn_client, test_mqtt_sn_connect_will) sizeof(rx)); zassert_equal(err, 0, "unexpected error %d"); + err = mqtt_sn_add_gw(mqtt_client, gw_id, gw_addr); + zassert_equal(err, 0, "unexpected error %d"); + zassert_false(sys_slist_is_empty(&mqtt_client->gateway), "GW not saved."); + zassert_equal(evt_cb_data.called, 0, "Unexpected event"); + mqtt_client->will_topic = MQTT_SN_DATA_STRING_LITERAL("topic"); mqtt_client->will_msg = MQTT_SN_DATA_STRING_LITERAL("msg"); err = mqtt_sn_connect(mqtt_client, true, false); zassert_equal(err, 0, "unexpected error %d"); - assert_msg_send(1, 12); + assert_msg_send(1, 12, &gw_addr); zassert_equal(mqtt_client->state, 0, "Wrong state"); - err = input(mqtt_client, willtopicreq, sizeof(willtopicreq)); + err = input(mqtt_client, willtopicreq, sizeof(willtopicreq), &gw_addr); zassert_equal(err, 0, "unexpected error %d"); zassert_equal(mqtt_client->state, 0, "Wrong state"); - assert_msg_send(1, 8); + assert_msg_send(1, 8, &gw_addr); - err = input(mqtt_client, willmsgreq, sizeof(willmsgreq)); + err = input(mqtt_client, willmsgreq, sizeof(willmsgreq), &gw_addr); zassert_equal(err, 0, "unexpected error %d"); zassert_equal(mqtt_client->state, 0, "Wrong state"); zassert_equal(evt_cb_data.called, 0, "Unexpected event"); - assert_msg_send(1, 5); + assert_msg_send(1, 5, &gw_addr); - err = input(mqtt_client, connack, sizeof(connack)); + err = input(mqtt_client, connack, sizeof(connack), &gw_addr); zassert_equal(err, 0, "unexpected error %d"); zassert_equal(mqtt_client->state, 1, "Wrong state"); zassert_equal(evt_cb_data.called, 1, "NO event"); zassert_equal(evt_cb_data.last_evt.type, MQTT_SN_EVT_CONNECTED, "Wrong event"); - k_sleep(K_MSEC(10)); + + mqtt_sn_client_deinit(mqtt_client); } static ZTEST(mqtt_sn_client, test_mqtt_sn_publish_qos0) @@ -190,21 +398,28 @@ static ZTEST(mqtt_sn_client, test_mqtt_sn_publish_qos0) int err; mqtt_sn_connect_no_will(mqtt_client); + err = k_sem_take(&mqtt_sn_tx_sem, K_NO_WAIT); err = mqtt_sn_publish(mqtt_client, MQTT_SN_QOS_0, &topic, false, &data); zassert_equal(err, 0, "Unexpected error %d", err); - assert_msg_send(0, 0); - k_sleep(K_MSEC(10)); + assert_msg_send(0, 0, NULL); + /* Expect a REGISTER to be sent */ - assert_msg_send(1, 12); - err = input(mqtt_client, regack, sizeof(regack)); + err = k_sem_take(&mqtt_sn_tx_sem, K_SECONDS(10)); + zassert_equal(err, 0, "Timed out waiting for callback."); + assert_msg_send(1, 12, &gw_addr); + err = input(mqtt_client, regack, sizeof(regack), &gw_addr); zassert_equal(err, 0, "unexpected error %d"); - assert_msg_send(0, 0); - k_sleep(K_MSEC(10)); - assert_msg_send(1, 20); + err = k_sem_take(&mqtt_sn_tx_sem, K_NO_WAIT); + assert_msg_send(0, 0, NULL); + err = k_sem_take(&mqtt_sn_tx_sem, K_SECONDS(10)); + zassert_equal(err, 0, "Timed out waiting for callback."); + assert_msg_send(1, 20, &gw_addr); zassert_true(sys_slist_is_empty(&mqtt_client->publish), "Publish not empty"); zassert_false(sys_slist_is_empty(&mqtt_client->topic), "Topic empty"); + + mqtt_sn_client_deinit(mqtt_client); } ZTEST_SUITE(mqtt_sn_client, NULL, NULL, setup, NULL, NULL); From e19838d157fab2f05068395fb5d2fa7cab71d6cb Mon Sep 17 00:00:00 2001 From: Kenneth Witham Date: Mon, 28 Oct 2024 08:10:47 -0700 Subject: [PATCH 2566/4482] net: mqtt-sn: Update MQTT-SN Publisher Sample with Gateway Discovery Fixes: #78010 This commit adds the "Gateway Advertisement and Discovery" process to the MQTT-SN Publisher Sample application. Signed-off-by: Kenneth Witham --- samples/net/mqtt_sn_publisher/Kconfig | 12 +- samples/net/mqtt_sn_publisher/README.rst | 29 +- .../mqtt_sn_publisher/compose/compose.yaml | 21 + .../mqtt_sn_publisher/compose/gateway.conf | 107 +++ .../mqtt_sn_publisher/compose/mosquitto.conf | 904 ++++++++++++++++++ samples/net/mqtt_sn_publisher/prj.conf | 5 + samples/net/mqtt_sn_publisher/src/udp.c | 58 +- 7 files changed, 1119 insertions(+), 17 deletions(-) create mode 100644 samples/net/mqtt_sn_publisher/compose/compose.yaml create mode 100644 samples/net/mqtt_sn_publisher/compose/gateway.conf create mode 100644 samples/net/mqtt_sn_publisher/compose/mosquitto.conf diff --git a/samples/net/mqtt_sn_publisher/Kconfig b/samples/net/mqtt_sn_publisher/Kconfig index 8c8a92b22f1a9..2b3bd145792d5 100644 --- a/samples/net/mqtt_sn_publisher/Kconfig +++ b/samples/net/mqtt_sn_publisher/Kconfig @@ -5,12 +5,22 @@ mainmenu "MQTT-SN sample application" +config NET_SAMPLE_MQTT_SN_STATIC_GATEWAY + bool "Whether to statically define the Gateway. Will use Search procedure if False." + config NET_SAMPLE_MQTT_SN_GATEWAY_IP - string "IP of the MQTT-SN gateway" + string "IP of the MQTT-SN gateway. Only used if NET_SAMPLE_MQTT_SN_STATIC_GATEWAY=n." + depends on NET_SAMPLE_MQTT_SN_STATIC_GATEWAY config NET_SAMPLE_MQTT_SN_GATEWAY_PORT int "Port of the MQTT-SN gateway" +config NET_SAMPLE_MQTT_SN_BROADCAST_IP + string "IP of the Broadcast address" + +config NET_SAMPLE_MQTT_SN_BROADCAST_PORT + int "Port of the MQTT-SN broadcast" + config NET_SAMPLE_MQTT_SN_BUFFER_SIZE int "Size of the TX and RX buffers" default 255 diff --git a/samples/net/mqtt_sn_publisher/README.rst b/samples/net/mqtt_sn_publisher/README.rst index 6701ab7e77728..a039014774115 100644 --- a/samples/net/mqtt_sn_publisher/README.rst +++ b/samples/net/mqtt_sn_publisher/README.rst @@ -40,13 +40,30 @@ Requirements Build and Running ***************** -Currently, this sample application only supports static IP addresses. -Open the :file:`prj.conf` file and set the IP addresses according -to the LAN environment. +This sample application supports both static IP addresses and the Gateway Discovery process. +Open the :zephyr_file:`samples/net/mqtt_sn_publisher/prj.conf` file and set the IP addresses according +to the LAN environment. CONFIG_NET_SAMPLE_MQTT_SN_STATIC_GATEWAY can be used to select the +static IP or Gateway discovery process. -You will also need to start an MQTT-SN gateway. With Paho, you can either -build it from source - see `PAHO MQTT-SN Gateway`_ - or run an unofficial -docker image, like `kyberpunk/paho`_. +You will also need to start an MQTT-SN gateway. A convenience Docker Compose specification file +is provided in :zephyr_file:`samples/net/mqtt_sn_publisher/compose/compose.yaml`. +First, Start the net-tools configuration from[here](https://github.com/zephyrproject-rtos/net-tools) +with: + +.. code-block:: console + + $ ./net-setup.sh --config docker.conf + +Then bring up the Docker environment in a separate terminal window with: + +.. code-block:: console + + $ cd ./compose + $ docker compose up + +You can also set up this environment manually.With Paho, you can either build it +from source - see `PAHO MQTT-SN Gateway`_ - or run an unofficial docker image, l +ike `kyberpunk/paho`_. .. _PAHO MQTT-SN Gateway: https://www.eclipse.org/paho/index.php?page=components/mqtt-sn-transparent-gateway/index.php .. _kyberpunk/paho: https://hub.docker.com/r/kyberpunk/paho diff --git a/samples/net/mqtt_sn_publisher/compose/compose.yaml b/samples/net/mqtt_sn_publisher/compose/compose.yaml new file mode 100644 index 0000000000000..e0d8836fb2f99 --- /dev/null +++ b/samples/net/mqtt_sn_publisher/compose/compose.yaml @@ -0,0 +1,21 @@ +services: + mosquitto: + image: eclipse-mosquitto:latest + volumes: + - ./mosquitto.conf:/mosquitto/config/mosquitto.conf:ro + restart: unless-stopped + networks: + net-tools: + ipv4_address: 192.0.2.3 + mqttsn-gateway: + image: kyberpunk/paho + volumes: + - ./gateway.conf:/etc/paho/gateway.conf:ro + restart: unless-stopped + networks: + net-tools: + ipv4_address: 192.0.2.2 +networks: + net-tools: + name: net-tools0 + external: true diff --git a/samples/net/mqtt_sn_publisher/compose/gateway.conf b/samples/net/mqtt_sn_publisher/compose/gateway.conf new file mode 100644 index 0000000000000..9f7b196df6f57 --- /dev/null +++ b/samples/net/mqtt_sn_publisher/compose/gateway.conf @@ -0,0 +1,107 @@ +#************************************************************************** +# Copyright (c) 2016-2021, Tomoaki Yamaguchi +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# and Eclipse Distribution License v1.0 which accompany this distribution. +# +# The Eclipse Public License is available at +# http://www.eclipse.org/legal/epl-v10.html +# and the Eclipse Distribution License is available at +# http://www.eclipse.org/org/documents/edl-v10.php. +#*************************************************************************** +# +# config file of MQTT-SN Gateway +# + +GatewayID=1 +GatewayName=PahoGateway-01 +MaxNumberOfClients=30 +KeepAlive=60 +#LoginID=your_ID +#Password=your_Password + +BrokerName=mosquitto +BrokerPortNo=1883 +BrokerSecurePortNo=8883 + +# +# CertsKey for TLS connections to a broker +# + +#RootCAfile=/etc/ssl/certs/ca-certificates.crt +#RootCApath=/etc/ssl/certs/ +#CertKey=/path/to/certKey.pem +#PrivateKey=/path/to/privateKey.pem + +# +# When AggregatingGateway=YES or ClientAuthentication=YES, +# All clients must be specified by the ClientList File +# + +AggregatingGateway=NO +QoS-1=NO +Forwarder=NO +PredefinedTopic=NO +ClientAuthentication=NO + +ClientsList=/path/to/your_clients.conf +PredefinedTopicList=/path/to/your_predefinedTopic.conf + + +#============================== +# SensorNetworks parameters +#============================== +# +# UDP | DTLS +# + +GatewayPortNo=10000 +MulticastPortNo=1883 +MulticastIP=225.1.1.1 +MulticastTTL=1 + +# +# UDP6 | DTLS6 +# + +GatewayIPv6PortNo=10000 +MulticastIPv6PortNo=1883 +MulticastIPv6=ff1e:feed:caca:dead::1 +MulticastIPv6If=wlp4s0 +MulticastHops=1 + +# +# DTLS | DTLS6 +# + +DtlsCertsKey=/etc/ssl/certs/gateway.pem +DtlsPrivKey=/etc/ssl/private/privkey.pem + +# +# XBee +# + +Baudrate=38400 +SerialDevice=/dev/ttyUSB0 +ApiMode=2 + +# +# LoRaLink +# + +BaudrateLoRaLink=115200 +DeviceRxLoRaLink=/dev/loralinkRx +DeviceTxLoRaLink=/dev/loralinkTx + +# +# Bluetooth RFCOMM +# + +RFCOMMAddress=60:57:18:06:8B:72.* + +# +# LOG +# + +ShearedMemory=NO diff --git a/samples/net/mqtt_sn_publisher/compose/mosquitto.conf b/samples/net/mqtt_sn_publisher/compose/mosquitto.conf new file mode 100644 index 0000000000000..329ae66524102 --- /dev/null +++ b/samples/net/mqtt_sn_publisher/compose/mosquitto.conf @@ -0,0 +1,904 @@ +# Config file for mosquitto +# +# See mosquitto.conf(5) for more information. +# +# Default values are shown, uncomment to change. +# +# Use the # character to indicate a comment, but only if it is the +# very first character on the line. + +# ================================================================= +# General configuration +# ================================================================= + +# Use per listener security settings. +# +# It is recommended this option be set before any other options. +# +# If this option is set to true, then all authentication and access control +# options are controlled on a per listener basis. The following options are +# affected: +# +# acl_file +# allow_anonymous +# allow_zero_length_clientid +# auto_id_prefix +# password_file +# plugin +# plugin_opt_* +# psk_file +# +# Note that if set to true, then a durable client (i.e. with clean session set +# to false) that has disconnected will use the ACL settings defined for the +# listener that it was most recently connected to. +# +# The default behaviour is for this to be set to false, which maintains the +# setting behaviour from previous versions of mosquitto. +#per_listener_settings false + + +# This option controls whether a client is allowed to connect with a zero +# length client id or not. This option only affects clients using MQTT v3.1.1 +# and later. If set to false, clients connecting with a zero length client id +# are disconnected. If set to true, clients will be allocated a client id by +# the broker. This means it is only useful for clients with clean session set +# to true. +#allow_zero_length_clientid true + +# If allow_zero_length_clientid is true, this option allows you to set a prefix +# to automatically generated client ids to aid visibility in logs. +# Defaults to 'auto-' +#auto_id_prefix auto- + +# This option affects the scenario when a client subscribes to a topic that has +# retained messages. It is possible that the client that published the retained +# message to the topic had access at the time they published, but that access +# has been subsequently removed. If check_retain_source is set to true, the +# default, the source of a retained message will be checked for access rights +# before it is republished. When set to false, no check will be made and the +# retained message will always be published. This affects all listeners. +#check_retain_source true + +# QoS 1 and 2 messages will be allowed inflight per client until this limit +# is exceeded. Defaults to 0. (No maximum) +# See also max_inflight_messages +#max_inflight_bytes 0 + +# The maximum number of QoS 1 and 2 messages currently inflight per +# client. +# This includes messages that are partway through handshakes and +# those that are being retried. Defaults to 20. Set to 0 for no +# maximum. Setting to 1 will guarantee in-order delivery of QoS 1 +# and 2 messages. +#max_inflight_messages 20 + +# For MQTT v5 clients, it is possible to have the server send a "server +# keepalive" value that will override the keepalive value set by the client. +# This is intended to be used as a mechanism to say that the server will +# disconnect the client earlier than it anticipated, and that the client should +# use the new keepalive value. The max_keepalive option allows you to specify +# that clients may only connect with keepalive less than or equal to this +# value, otherwise they will be sent a server keepalive telling them to use +# max_keepalive. This only applies to MQTT v5 clients. The default, and maximum +# value allowable, is 65535. +# +# Set to 0 to allow clients to set keepalive = 0, which means no keepalive +# checks are made and the client will never be disconnected by the broker if no +# messages are received. You should be very sure this is the behaviour that you +# want. +# +# For MQTT v3.1.1 and v3.1 clients, there is no mechanism to tell the client +# what keepalive value they should use. If an MQTT v3.1.1 or v3.1 client +# specifies a keepalive time greater than max_keepalive they will be sent a +# CONNACK message with the "identifier rejected" reason code, and disconnected. +# +#max_keepalive 65535 + +# For MQTT v5 clients, it is possible to have the server send a "maximum packet +# size" value that will instruct the client it will not accept MQTT packets +# with size greater than max_packet_size bytes. This applies to the full MQTT +# packet, not just the payload. Setting this option to a positive value will +# set the maximum packet size to that number of bytes. If a client sends a +# packet which is larger than this value, it will be disconnected. This applies +# to all clients regardless of the protocol version they are using, but v3.1.1 +# and earlier clients will of course not have received the maximum packet size +# information. Defaults to no limit. Setting below 20 bytes is forbidden +# because it is likely to interfere with ordinary client operation, even with +# very small payloads. +#max_packet_size 0 + +# QoS 1 and 2 messages above those currently in-flight will be queued per +# client until this limit is exceeded. Defaults to 0. (No maximum) +# See also max_queued_messages. +# If both max_queued_messages and max_queued_bytes are specified, packets will +# be queued until the first limit is reached. +#max_queued_bytes 0 + +# Set the maximum QoS supported. Clients publishing at a QoS higher than +# specified here will be disconnected. +#max_qos 2 + +# The maximum number of QoS 1 and 2 messages to hold in a queue per client +# above those that are currently in-flight. Defaults to 1000. Set +# to 0 for no maximum (not recommended). +# See also queue_qos0_messages. +# See also max_queued_bytes. +#max_queued_messages 1000 +# +# This option sets the maximum number of heap memory bytes that the broker will +# allocate, and hence sets a hard limit on memory use by the broker. Memory +# requests that exceed this value will be denied. The effect will vary +# depending on what has been denied. If an incoming message is being processed, +# then the message will be dropped and the publishing client will be +# disconnected. If an outgoing message is being sent, then the individual +# message will be dropped and the receiving client will be disconnected. +# Defaults to no limit. +#memory_limit 0 + +# This option sets the maximum publish payload size that the broker will allow. +# Received messages that exceed this size will not be accepted by the broker. +# The default value is 0, which means that all valid MQTT messages are +# accepted. MQTT imposes a maximum payload size of 268435455 bytes. +#message_size_limit 0 + +# This option allows the session of persistent clients (those with clean +# session set to false) that are not currently connected to be removed if they +# do not reconnect within a certain time frame. This is a non-standard option +# in MQTT v3.1. MQTT v3.1.1 and v5.0 allow brokers to remove client sessions. +# +# Badly designed clients may set clean session to false whilst using a randomly +# generated client id. This leads to persistent clients that connect once and +# never reconnect. This option allows these clients to be removed. This option +# allows persistent clients (those with clean session set to false) to be +# removed if they do not reconnect within a certain time frame. +# +# The expiration period should be an integer followed by one of h d w m y for +# hour, day, week, month and year respectively. For example +# +# persistent_client_expiration 2m +# persistent_client_expiration 14d +# persistent_client_expiration 1y +# +# The default if not set is to never expire persistent clients. +#persistent_client_expiration + +# Write process id to a file. Default is a blank string which means +# a pid file shouldn't be written. +# This should be set to /var/run/mosquitto/mosquitto.pid if mosquitto is +# being run automatically on boot with an init script and +# start-stop-daemon or similar. +#pid_file + +# Set to true to queue messages with QoS 0 when a persistent client is +# disconnected. These messages are included in the limit imposed by +# max_queued_messages and max_queued_bytes +# Defaults to false. +# This is a non-standard option for the MQTT v3.1 spec but is allowed in +# v3.1.1. +#queue_qos0_messages false + +# Set to false to disable retained message support. If a client publishes a +# message with the retain bit set, it will be disconnected if this is set to +# false. +#retain_available true + +# Disable Nagle's algorithm on client sockets. This has the effect of reducing +# latency of individual messages at the potential cost of increasing the number +# of packets being sent. +#set_tcp_nodelay false + +# Time in seconds between updates of the $SYS tree. +# Set to 0 to disable the publishing of the $SYS tree. +#sys_interval 10 + +# The MQTT specification requires that the QoS of a message delivered to a +# subscriber is never upgraded to match the QoS of the subscription. Enabling +# this option changes this behaviour. If upgrade_outgoing_qos is set true, +# messages sent to a subscriber will always match the QoS of its subscription. +# This is a non-standard option explicitly disallowed by the spec. +#upgrade_outgoing_qos false + +# When run as root, drop privileges to this user and its primary +# group. +# Set to root to stay as root, but this is not recommended. +# If set to "mosquitto", or left unset, and the "mosquitto" user does not exist +# then it will drop privileges to the "nobody" user instead. +# If run as a non-root user, this setting has no effect. +# Note that on Windows this has no effect and so mosquitto should be started by +# the user you wish it to run as. +#user mosquitto + +# ================================================================= +# Listeners +# ================================================================= + +# Listen on a port/ip address combination. By using this variable +# multiple times, mosquitto can listen on more than one port. If +# this variable is used and neither bind_address nor port given, +# then the default listener will not be started. +# The port number to listen on must be given. Optionally, an ip +# address or host name may be supplied as a second argument. In +# this case, mosquitto will attempt to bind the listener to that +# address and so restrict access to the associated network and +# interface. By default, mosquitto will listen on all interfaces. +# Note that for a websockets listener it is not possible to bind to a host +# name. +# +# On systems that support Unix Domain Sockets, it is also possible +# to create a # Unix socket rather than opening a TCP socket. In +# this case, the port number should be set to 0 and a unix socket +# path must be provided, e.g. +# listener 0 /tmp/mosquitto.sock +# +# listener port-number [ip address/host name/unix socket path] +listener 1883 + +# By default, a listener will attempt to listen on all supported IP protocol +# versions. If you do not have an IPv4 or IPv6 interface you may wish to +# disable support for either of those protocol versions. In particular, note +# that due to the limitations of the websockets library, it will only ever +# attempt to open IPv6 sockets if IPv6 support is compiled in, and so will fail +# if IPv6 is not available. +# +# Set to `ipv4` to force the listener to only use IPv4, or set to `ipv6` to +# force the listener to only use IPv6. If you want support for both IPv4 and +# IPv6, then do not use the socket_domain option. +# +#socket_domain + +# Bind the listener to a specific interface. This is similar to +# the [ip address/host name] part of the listener definition, but is useful +# when an interface has multiple addresses or the address may change. If used +# with the [ip address/host name] part of the listener definition, then the +# bind_interface option will take priority. +# Not available on Windows. +# +# Example: bind_interface eth0 +#bind_interface + +# When a listener is using the websockets protocol, it is possible to serve +# http data as well. Set http_dir to a directory which contains the files you +# wish to serve. If this option is not specified, then no normal http +# connections will be possible. +#http_dir + +# The maximum number of client connections to allow. This is +# a per listener setting. +# Default is -1, which means unlimited connections. +# Note that other process limits mean that unlimited connections +# are not really possible. Typically the default maximum number of +# connections possible is around 1024. +#max_connections -1 + +# The listener can be restricted to operating within a topic hierarchy using +# the mount_point option. This is achieved be prefixing the mount_point string +# to all topics for any clients connected to this listener. This prefixing only +# happens internally to the broker; the client will not see the prefix. +#mount_point + +# Choose the protocol to use when listening. +# This can be either mqtt or websockets. +# Certificate based TLS may be used with websockets, except that only the +# cafile, certfile, keyfile, ciphers, and ciphers_tls13 options are supported. +#protocol mqtt + +# Set use_username_as_clientid to true to replace the clientid that a client +# connected with its username. This allows authentication to be tied to +# the clientid, which means that it is possible to prevent one client +# disconnecting another by using the same clientid. +# If a client connects with no username it will be disconnected as not +# authorised when this option is set to true. +# Do not use in conjunction with clientid_prefixes. +# See also use_identity_as_username. +# This does not apply globally, but on a per-listener basis. +#use_username_as_clientid + +# Change the websockets headers size. This is a global option, it is not +# possible to set per listener. This option sets the size of the buffer used in +# the libwebsockets library when reading HTTP headers. If you are passing large +# header data such as cookies then you may need to increase this value. If left +# unset, or set to 0, then the default of 1024 bytes will be used. +#websockets_headers_size + +# ----------------------------------------------------------------- +# Certificate based SSL/TLS support +# ----------------------------------------------------------------- +# The following options can be used to enable certificate based SSL/TLS support +# for this listener. Note that the recommended port for MQTT over TLS is 8883, +# but this must be set manually. +# +# See also the mosquitto-tls man page and the "Pre-shared-key based SSL/TLS +# support" section. Only one of certificate or PSK encryption support can be +# enabled for any listener. + +# Both of certfile and keyfile must be defined to enable certificate based +# TLS encryption. + +# Path to the PEM encoded server certificate. +#certfile + +# Path to the PEM encoded keyfile. +#keyfile + +# If you wish to control which encryption ciphers are used, use the ciphers +# option. The list of available ciphers can be optained using the "openssl +# ciphers" command and should be provided in the same format as the output of +# that command. This applies to TLS 1.2 and earlier versions only. Use +# ciphers_tls1.3 for TLS v1.3. +#ciphers + +# Choose which TLS v1.3 ciphersuites are used for this listener. +# Defaults to "TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256" +#ciphers_tls1.3 + +# If you have require_certificate set to true, you can create a certificate +# revocation list file to revoke access to particular client certificates. If +# you have done this, use crlfile to point to the PEM encoded revocation file. +#crlfile + +# To allow the use of ephemeral DH key exchange, which provides forward +# security, the listener must load DH parameters. This can be specified with +# the dhparamfile option. The dhparamfile can be generated with the command +# e.g. "openssl dhparam -out dhparam.pem 2048" +#dhparamfile + +# By default an TLS enabled listener will operate in a similar fashion to a +# https enabled web server, in that the server has a certificate signed by a CA +# and the client will verify that it is a trusted certificate. The overall aim +# is encryption of the network traffic. By setting require_certificate to true, +# the client must provide a valid certificate in order for the network +# connection to proceed. This allows access to the broker to be controlled +# outside of the mechanisms provided by MQTT. +#require_certificate false + +# cafile and capath define methods of accessing the PEM encoded +# Certificate Authority certificates that will be considered trusted when +# checking incoming client certificates. +# cafile defines the path to a file containing the CA certificates. +# capath defines a directory that will be searched for files +# containing the CA certificates. For capath to work correctly, the +# certificate files must have ".crt" as the file ending and you must run +# "openssl rehash " each time you add/remove a certificate. +#cafile +#capath + + +# If require_certificate is true, you may set use_identity_as_username to true +# to use the CN value from the client certificate as a username. If this is +# true, the password_file option will not be used for this listener. +#use_identity_as_username false + +# ----------------------------------------------------------------- +# Pre-shared-key based SSL/TLS support +# ----------------------------------------------------------------- +# The following options can be used to enable PSK based SSL/TLS support for +# this listener. Note that the recommended port for MQTT over TLS is 8883, but +# this must be set manually. +# +# See also the mosquitto-tls man page and the "Certificate based SSL/TLS +# support" section. Only one of certificate or PSK encryption support can be +# enabled for any listener. + +# The psk_hint option enables pre-shared-key support for this listener and also +# acts as an identifier for this listener. The hint is sent to clients and may +# be used locally to aid authentication. The hint is a free form string that +# doesn't have much meaning in itself, so feel free to be creative. +# If this option is provided, see psk_file to define the pre-shared keys to be +# used or create a security plugin to handle them. +#psk_hint + +# When using PSK, the encryption ciphers used will be chosen from the list of +# available PSK ciphers. If you want to control which ciphers are available, +# use the "ciphers" option. The list of available ciphers can be optained +# using the "openssl ciphers" command and should be provided in the same format +# as the output of that command. +#ciphers + +# Set use_identity_as_username to have the psk identity sent by the client used +# as its username. Authentication will be carried out using the PSK rather than +# the MQTT username/password and so password_file will not be used for this +# listener. +#use_identity_as_username false + + +# ================================================================= +# Persistence +# ================================================================= + +# If persistence is enabled, save the in-memory database to disk +# every autosave_interval seconds. If set to 0, the persistence +# database will only be written when mosquitto exits. See also +# autosave_on_changes. +# Note that writing of the persistence database can be forced by +# sending mosquitto a SIGUSR1 signal. +#autosave_interval 1800 + +# If true, mosquitto will count the number of subscription changes, retained +# messages received and queued messages and if the total exceeds +# autosave_interval then the in-memory database will be saved to disk. +# If false, mosquitto will save the in-memory database to disk by treating +# autosave_interval as a time in seconds. +#autosave_on_changes false + +# Save persistent message data to disk (true/false). +# This saves information about all messages, including +# subscriptions, currently in-flight messages and retained +# messages. +# retained_persistence is a synonym for this option. +#persistence false + +# The filename to use for the persistent database, not including +# the path. +#persistence_file mosquitto.db + +# Location for persistent database. +# Default is an empty string (current directory). +# Set to e.g. /var/lib/mosquitto if running as a proper service on Linux or +# similar. +#persistence_location + + +# ================================================================= +# Logging +# ================================================================= + +# Places to log to. Use multiple log_dest lines for multiple +# logging destinations. +# Possible destinations are: stdout stderr syslog topic file dlt +# +# stdout and stderr log to the console on the named output. +# +# syslog uses the userspace syslog facility which usually ends up +# in /var/log/messages or similar. +# +# topic logs to the broker topic '$SYS/broker/log/', +# where severity is one of D, E, W, N, I, M which are debug, error, +# warning, notice, information and message. Message type severity is used by +# the subscribe/unsubscribe log_types and publishes log messages to +# $SYS/broker/log/M/susbcribe or $SYS/broker/log/M/unsubscribe. +# +# The file destination requires an additional parameter which is the file to be +# logged to, e.g. "log_dest file /var/log/mosquitto.log". The file will be +# closed and reopened when the broker receives a HUP signal. Only a single file +# destination may be configured. +# +# The dlt destination is for the automotive `Diagnostic Log and Trace` tool. +# This requires that Mosquitto has been compiled with DLT support. +# +# Note that if the broker is running as a Windows service it will default to +# "log_dest none" and neither stdout nor stderr logging is available. +# Use "log_dest none" if you wish to disable logging. +#log_dest stderr + +# Types of messages to log. Use multiple log_type lines for logging +# multiple types of messages. +# Possible types are: debug, error, warning, notice, information, +# none, subscribe, unsubscribe, websockets, all. +# Note that debug type messages are for decoding the incoming/outgoing +# network packets. They are not logged in "topics". +#log_type error +#log_type warning +#log_type notice +#log_type information + + +# If set to true, client connection and disconnection messages will be included +# in the log. +#connection_messages true + +# If using syslog logging (not on Windows), messages will be logged to the +# "daemon" facility by default. Use the log_facility option to choose which of +# local0 to local7 to log to instead. The option value should be an integer +# value, e.g. "log_facility 5" to use local5. +#log_facility + +# If set to true, add a timestamp value to each log message. +#log_timestamp true + +# Set the format of the log timestamp. If left unset, this is the number of +# seconds since the Unix epoch. +# This is a free text string which will be passed to the strftime function. To +# get an ISO 8601 datetime, for example: +# log_timestamp_format %Y-%m-%dT%H:%M:%S +#log_timestamp_format + +# Change the websockets logging level. This is a global option, it is not +# possible to set per listener. This is an integer that is interpreted by +# libwebsockets as a bit mask for its lws_log_levels enum. See the +# libwebsockets documentation for more details. "log_type websockets" must also +# be enabled. +#websockets_log_level 0 + + +# ================================================================= +# Security +# ================================================================= + +# If set, only clients that have a matching prefix on their +# clientid will be allowed to connect to the broker. By default, +# all clients may connect. +# For example, setting "secure-" here would mean a client "secure- +# client" could connect but another with clientid "mqtt" couldn't. +#clientid_prefixes + +# Boolean value that determines whether clients that connect +# without providing a username are allowed to connect. If set to +# false then a password file should be created (see the +# password_file option) to control authenticated client access. +# +# Defaults to false, unless there are no listeners defined in the configuration +# file, in which case it is set to true, but connections are only allowed from +# the local machine. +allow_anonymous true + +# ----------------------------------------------------------------- +# Default authentication and topic access control +# ----------------------------------------------------------------- + +# Control access to the broker using a password file. This file can be +# generated using the mosquitto_passwd utility. If TLS support is not compiled +# into mosquitto (it is recommended that TLS support should be included) then +# plain text passwords are used, in which case the file should be a text file +# with lines in the format: +# username:password +# The password (and colon) may be omitted if desired, although this +# offers very little in the way of security. +# +# See the TLS client require_certificate and use_identity_as_username options +# for alternative authentication options. If a plugin is used as well as +# password_file, the plugin check will be made first. +#password_file + +# Access may also be controlled using a pre-shared-key file. This requires +# TLS-PSK support and a listener configured to use it. The file should be text +# lines in the format: +# identity:key +# The key should be in hexadecimal format without a leading "0x". +# If an plugin is used as well, the plugin check will be made first. +#psk_file + +# Control access to topics on the broker using an access control list +# file. If this parameter is defined then only the topics listed will +# have access. +# If the first character of a line of the ACL file is a # it is treated as a +# comment. +# Topic access is added with lines of the format: +# +# topic [read|write|readwrite|deny] +# +# The access type is controlled using "read", "write", "readwrite" or "deny". +# This parameter is optional (unless contains a space character) - if +# not given then the access is read/write. can contain the + or # +# wildcards as in subscriptions. +# +# The "deny" option can used to explicity deny access to a topic that would +# otherwise be granted by a broader read/write/readwrite statement. Any "deny" +# topics are handled before topics that grant read/write access. +# +# The first set of topics are applied to anonymous clients, assuming +# allow_anonymous is true. User specific topic ACLs are added after a +# user line as follows: +# +# user +# +# The username referred to here is the same as in password_file. It is +# not the clientid. +# +# +# If is also possible to define ACLs based on pattern substitution within the +# topic. The patterns available for substition are: +# +# %c to match the client id of the client +# %u to match the username of the client +# +# The substitution pattern must be the only text for that level of hierarchy. +# +# The form is the same as for the topic keyword, but using pattern as the +# keyword. +# Pattern ACLs apply to all users even if the "user" keyword has previously +# been given. +# +# If using bridges with usernames and ACLs, connection messages can be allowed +# with the following pattern: +# pattern write $SYS/broker/connection/%c/state +# +# pattern [read|write|readwrite] +# +# Example: +# +# pattern write sensor/%u/data +# +# If an plugin is used as well as acl_file, the plugin check will be +# made first. +#acl_file + +# ----------------------------------------------------------------- +# External authentication and topic access plugin options +# ----------------------------------------------------------------- + +# External authentication and access control can be supported with the +# plugin option. This is a path to a loadable plugin. See also the +# plugin_opt_* options described below. +# +# The plugin option can be specified multiple times to load multiple +# plugins. The plugins will be processed in the order that they are specified +# here. If the plugin option is specified alongside either of +# password_file or acl_file then the plugin checks will be made first. +# +# If the per_listener_settings option is false, the plugin will be apply to all +# listeners. If per_listener_settings is true, then the plugin will apply to +# the current listener being defined only. +# +# This option is also available as `auth_plugin`, but this use is deprecated +# and will be removed in the future. +# +#plugin + +# If the plugin option above is used, define options to pass to the +# plugin here as described by the plugin instructions. All options named +# using the format plugin_opt_* will be passed to the plugin, for example: +# +# This option is also available as `auth_opt_*`, but this use is deprecated +# and will be removed in the future. +# +# plugin_opt_db_host +# plugin_opt_db_port +# plugin_opt_db_username +# plugin_opt_db_password + + +# ================================================================= +# Bridges +# ================================================================= + +# A bridge is a way of connecting multiple MQTT brokers together. +# Create a new bridge using the "connection" option as described below. Set +# options for the bridges using the remaining parameters. You must specify the +# address and at least one topic to subscribe to. +# +# Each connection must have a unique name. +# +# The address line may have multiple host address and ports specified. See +# below in the round_robin description for more details on bridge behaviour if +# multiple addresses are used. Note that if you use an IPv6 address, then you +# are required to specify a port. +# +# The direction that the topic will be shared can be chosen by +# specifying out, in or both, where the default value is out. +# The QoS level of the bridged communication can be specified with the next +# topic option. The default QoS level is 0, to change the QoS the topic +# direction must also be given. +# +# The local and remote prefix options allow a topic to be remapped when it is +# bridged to/from the remote broker. This provides the ability to place a topic +# tree in an appropriate location. +# +# For more details see the mosquitto.conf man page. +# +# Multiple topics can be specified per connection, but be careful +# not to create any loops. +# +# If you are using bridges with cleansession set to false (the default), then +# you may get unexpected behaviour from incoming topics if you change what +# topics you are subscribing to. This is because the remote broker keeps the +# subscription for the old topic. If you have this problem, connect your bridge +# with cleansession set to true, then reconnect with cleansession set to false +# as normal. +#connection +#address [:] [[:]] +#topic [[[out | in | both] qos-level] local-prefix remote-prefix] + +# If you need to have the bridge connect over a particular network interface, +# use bridge_bind_address to tell the bridge which local IP address the socket +# should bind to, e.g. `bridge_bind_address 192.168.1.10` +#bridge_bind_address + +# If a bridge has topics that have "out" direction, the default behaviour is to +# send an unsubscribe request to the remote broker on that topic. This means +# that changing a topic direction from "in" to "out" will not keep receiving +# incoming messages. Sending these unsubscribe requests is not always +# desirable, setting bridge_attempt_unsubscribe to false will disable sending +# the unsubscribe request. +#bridge_attempt_unsubscribe true + +# Set the version of the MQTT protocol to use with for this bridge. Can be one +# of mqttv50, mqttv311 or mqttv31. Defaults to mqttv311. +#bridge_protocol_version mqttv311 + +# Set the clean session variable for this bridge. +# When set to true, when the bridge disconnects for any reason, all +# messages and subscriptions will be cleaned up on the remote +# broker. Note that with cleansession set to true, there may be a +# significant amount of retained messages sent when the bridge +# reconnects after losing its connection. +# When set to false, the subscriptions and messages are kept on the +# remote broker, and delivered when the bridge reconnects. +#cleansession false + +# Set the amount of time a bridge using the lazy start type must be idle before +# it will be stopped. Defaults to 60 seconds. +#idle_timeout 60 + +# Set the keepalive interval for this bridge connection, in +# seconds. +#keepalive_interval 60 + +# Set the clientid to use on the local broker. If not defined, this defaults to +# 'local.'. If you are bridging a broker to itself, it is important +# that local_clientid and clientid do not match. +#local_clientid + +# If set to true, publish notification messages to the local and remote brokers +# giving information about the state of the bridge connection. Retained +# messages are published to the topic $SYS/broker/connection//state +# unless the notification_topic option is used. +# If the message is 1 then the connection is active, or 0 if the connection has +# failed. +# This uses the last will and testament feature. +#notifications true + +# Choose the topic on which notification messages for this bridge are +# published. If not set, messages are published on the topic +# $SYS/broker/connection//state +#notification_topic + +# Set the client id to use on the remote end of this bridge connection. If not +# defined, this defaults to 'name.hostname' where name is the connection name +# and hostname is the hostname of this computer. +# This replaces the old "clientid" option to avoid confusion. "clientid" +# remains valid for the time being. +#remote_clientid + +# Set the password to use when connecting to a broker that requires +# authentication. This option is only used if remote_username is also set. +# This replaces the old "password" option to avoid confusion. "password" +# remains valid for the time being. +#remote_password + +# Set the username to use when connecting to a broker that requires +# authentication. +# This replaces the old "username" option to avoid confusion. "username" +# remains valid for the time being. +#remote_username + +# Set the amount of time a bridge using the automatic start type will wait +# until attempting to reconnect. +# This option can be configured to use a constant delay time in seconds, or to +# use a backoff mechanism based on "Decorrelated Jitter", which adds a degree +# of randomness to when the restart occurs. +# +# Set a constant timeout of 20 seconds: +# restart_timeout 20 +# +# Set backoff with a base (start value) of 10 seconds and a cap (upper limit) of +# 60 seconds: +# restart_timeout 10 30 +# +# Defaults to jitter with a base of 5 and cap of 30 +#restart_timeout 5 30 + +# If the bridge has more than one address given in the address/addresses +# configuration, the round_robin option defines the behaviour of the bridge on +# a failure of the bridge connection. If round_robin is false, the default +# value, then the first address is treated as the main bridge connection. If +# the connection fails, the other secondary addresses will be attempted in +# turn. Whilst connected to a secondary bridge, the bridge will periodically +# attempt to reconnect to the main bridge until successful. +# If round_robin is true, then all addresses are treated as equals. If a +# connection fails, the next address will be tried and if successful will +# remain connected until it fails +#round_robin false + +# Set the start type of the bridge. This controls how the bridge starts and +# can be one of three types: automatic, lazy and once. Note that RSMB provides +# a fourth start type "manual" which isn't currently supported by mosquitto. +# +# "automatic" is the default start type and means that the bridge connection +# will be started automatically when the broker starts and also restarted +# after a short delay (30 seconds) if the connection fails. +# +# Bridges using the "lazy" start type will be started automatically when the +# number of queued messages exceeds the number set with the "threshold" +# parameter. It will be stopped automatically after the time set by the +# "idle_timeout" parameter. Use this start type if you wish the connection to +# only be active when it is needed. +# +# A bridge using the "once" start type will be started automatically when the +# broker starts but will not be restarted if the connection fails. +#start_type automatic + +# Set the number of messages that need to be queued for a bridge with lazy +# start type to be restarted. Defaults to 10 messages. +# Must be less than max_queued_messages. +#threshold 10 + +# If try_private is set to true, the bridge will attempt to indicate to the +# remote broker that it is a bridge not an ordinary client. If successful, this +# means that loop detection will be more effective and that retained messages +# will be propagated correctly. Not all brokers support this feature so it may +# be necessary to set try_private to false if your bridge does not connect +# properly. +#try_private true + +# Some MQTT brokers do not allow retained messages. MQTT v5 gives a mechanism +# for brokers to tell clients that they do not support retained messages, but +# this is not possible for MQTT v3.1.1 or v3.1. If you need to bridge to a +# v3.1.1 or v3.1 broker that does not support retained messages, set the +# bridge_outgoing_retain option to false. This will remove the retain bit on +# all outgoing messages to that bridge, regardless of any other setting. +#bridge_outgoing_retain true + +# If you wish to restrict the size of messages sent to a remote bridge, use the +# bridge_max_packet_size option. This sets the maximum number of bytes for +# the total message, including headers and payload. +# Note that MQTT v5 brokers may provide their own maximum-packet-size property. +# In this case, the smaller of the two limits will be used. +# Set to 0 for "unlimited". +#bridge_max_packet_size 0 + + +# ----------------------------------------------------------------- +# Certificate based SSL/TLS support +# ----------------------------------------------------------------- +# Either bridge_cafile or bridge_capath must be defined to enable TLS support +# for this bridge. +# bridge_cafile defines the path to a file containing the +# Certificate Authority certificates that have signed the remote broker +# certificate. +# bridge_capath defines a directory that will be searched for files containing +# the CA certificates. For bridge_capath to work correctly, the certificate +# files must have ".crt" as the file ending and you must run "openssl rehash +# " each time you add/remove a certificate. +#bridge_cafile +#bridge_capath + + +# If the remote broker has more than one protocol available on its port, e.g. +# MQTT and WebSockets, then use bridge_alpn to configure which protocol is +# requested. Note that WebSockets support for bridges is not yet available. +#bridge_alpn + +# When using certificate based encryption, bridge_insecure disables +# verification of the server hostname in the server certificate. This can be +# useful when testing initial server configurations, but makes it possible for +# a malicious third party to impersonate your server through DNS spoofing, for +# example. Use this option in testing only. If you need to resort to using this +# option in a production environment, your setup is at fault and there is no +# point using encryption. +#bridge_insecure false + +# Path to the PEM encoded client certificate, if required by the remote broker. +#bridge_certfile + +# Path to the PEM encoded client private key, if required by the remote broker. +#bridge_keyfile + +# ----------------------------------------------------------------- +# PSK based SSL/TLS support +# ----------------------------------------------------------------- +# Pre-shared-key encryption provides an alternative to certificate based +# encryption. A bridge can be configured to use PSK with the bridge_identity +# and bridge_psk options. These are the client PSK identity, and pre-shared-key +# in hexadecimal format with no "0x". Only one of certificate and PSK based +# encryption can be used on one +# bridge at once. +#bridge_identity +#bridge_psk + + +# ================================================================= +# External config files +# ================================================================= + +# External configuration files may be included by using the +# include_dir option. This defines a directory that will be searched +# for config files. All files that end in '.conf' will be loaded as +# a configuration file. It is best to have this as the last option +# in the main file. This option will only be processed from the main +# configuration file. The directory specified must not contain the +# main configuration file. +# Files within include_dir will be loaded sorted in case-sensitive +# alphabetical order, with capital letters ordered first. If this option is +# given multiple times, all of the files from the first instance will be +# processed before the next instance. See the man page for examples. +#include_dir diff --git a/samples/net/mqtt_sn_publisher/prj.conf b/samples/net/mqtt_sn_publisher/prj.conf index efe1a8f3e207e..4138b38ce219a 100644 --- a/samples/net/mqtt_sn_publisher/prj.conf +++ b/samples/net/mqtt_sn_publisher/prj.conf @@ -32,10 +32,15 @@ CONFIG_NET_MAX_CONTEXTS=10 # Network application options and configuration CONFIG_NET_CONFIG_SETTINGS=y CONFIG_NET_CONFIG_NEED_IPV4=y +CONFIG_NET_IPV4_IGMP=y CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1" # MQTT-SN CONFIG_MQTT_SN_LIB=y CONFIG_MQTT_SN_TRANSPORT_UDP=y +CONFIG_MQTT_SN_LIB_BROADCAST_RADIUS=1 +CONFIG_NET_SAMPLE_MQTT_SN_STATIC_GATEWAY=y CONFIG_NET_SAMPLE_MQTT_SN_GATEWAY_IP="192.0.2.2" CONFIG_NET_SAMPLE_MQTT_SN_GATEWAY_PORT=10000 +CONFIG_NET_SAMPLE_MQTT_SN_BROADCAST_IP="225.1.1.1" +CONFIG_NET_SAMPLE_MQTT_SN_BROADCAST_PORT=1883 diff --git a/samples/net/mqtt_sn_publisher/src/udp.c b/samples/net/mqtt_sn_publisher/src/udp.c index 045a676dbd1e4..4f1dd74231ac9 100644 --- a/samples/net/mqtt_sn_publisher/src/udp.c +++ b/samples/net/mqtt_sn_publisher/src/udp.c @@ -17,6 +17,12 @@ #include LOG_MODULE_DECLARE(mqtt_sn_publisher_sample); +#ifdef CONFIG_NET_SAMPLE_MQTT_SN_STATIC_GATEWAY +#define SAMPLE_GW_IP CONFIG_NET_SAMPLE_MQTT_SN_GATEWAY_IP +#else +#define SAMPLE_GW_IP "" +#endif + static void process_thread(void); K_THREAD_DEFINE(udp_thread_id, STACK_SIZE, process_thread, NULL, NULL, NULL, THREAD_PRIORITY, @@ -56,6 +62,17 @@ static void evt_cb(struct mqtt_sn_client *client, const struct mqtt_sn_evt *evt) case MQTT_SN_EVT_PINGRESP: /* Received a PINGRESP */ LOG_INF("MQTT-SN event EVT_PINGRESP"); break; + case MQTT_SN_EVT_ADVERTISE: /* Received a ADVERTISE */ + LOG_INF("MQTT-SN event EVT_ADVERTISE"); + break; + case MQTT_SN_EVT_GWINFO: /* Received a GWINFO */ + LOG_INF("MQTT-SN event EVT_GWINFO"); + break; + case MQTT_SN_EVT_SEARCHGW: /* Received a SEARCHGW */ + LOG_INF("MQTT-SN event EVT_SEARCHGW"); + break; + default: + break; } } @@ -109,27 +126,48 @@ static int do_work(void) static void process_thread(void) { - struct sockaddr_in gateway = {0}; + struct sockaddr_in bcaddr = {0}; int err; - - LOG_DBG("Parsing MQTT host IP " CONFIG_NET_SAMPLE_MQTT_SN_GATEWAY_IP); - gateway.sin_family = AF_INET; - gateway.sin_port = htons(CONFIG_NET_SAMPLE_MQTT_SN_GATEWAY_PORT); - err = inet_pton(AF_INET, CONFIG_NET_SAMPLE_MQTT_SN_GATEWAY_IP, &gateway.sin_addr); + LOG_DBG("Parsing Broadcast IP " CONFIG_NET_SAMPLE_MQTT_SN_BROADCAST_IP); + bcaddr.sin_family = AF_INET; + bcaddr.sin_port = htons(CONFIG_NET_SAMPLE_MQTT_SN_BROADCAST_PORT); + err = inet_pton(AF_INET, CONFIG_NET_SAMPLE_MQTT_SN_BROADCAST_IP, &bcaddr.sin_addr); __ASSERT(err == 1, "inet_pton() failed %d", err); LOG_INF("Waiting for connection..."); - LOG_HEXDUMP_DBG(&gateway, sizeof(gateway), "gateway"); - - LOG_INF("Connecting client"); + LOG_HEXDUMP_DBG(&bcaddr, sizeof(bcaddr), " broadcast address"); - err = mqtt_sn_transport_udp_init(&tp, (struct sockaddr *)&gateway, sizeof((gateway))); + err = mqtt_sn_transport_udp_init(&tp, (struct sockaddr *)&bcaddr, sizeof((bcaddr))); __ASSERT(err == 0, "mqtt_sn_transport_udp_init() failed %d", err); err = mqtt_sn_client_init(&mqtt_client, &client_id, &tp.tp, evt_cb, tx_buf, sizeof(tx_buf), rx_buf, sizeof(rx_buf)); __ASSERT(err == 0, "mqtt_sn_client_init() failed %d", err); + if (IS_ENABLED(CONFIG_NET_SAMPLE_MQTT_SN_STATIC_GATEWAY)) { + LOG_INF("Adding predefined Gateway"); + struct sockaddr_in gwaddr = {0}; + int err; + + LOG_DBG("Parsing Broadcast IP %s", SAMPLE_GW_IP); + gwaddr.sin_family = AF_INET; + gwaddr.sin_port = htons(CONFIG_NET_SAMPLE_MQTT_SN_GATEWAY_PORT); + err = inet_pton(AF_INET, SAMPLE_GW_IP, &gwaddr.sin_addr); + __ASSERT(err == 1, "inet_pton() failed %d", err); + struct mqtt_sn_data gwaddr_data = {.data = (uint8_t *)&bcaddr, + .size = sizeof(struct sockaddr)}; + + err = mqtt_sn_add_gw(&mqtt_client, 0x1f, gwaddr_data); + __ASSERT(err == 0, "mqtt_sn_add_gw() failed %d", err); + } else { + LOG_INF("Searching for Gateway"); + err = mqtt_sn_search(&mqtt_client, 1); + k_sleep(K_SECONDS(10)); + err = mqtt_sn_input(&mqtt_client); + __ASSERT(err == 0, "mqtt_sn_search() failed %d", err); + } + + LOG_INF("Connecting client"); err = mqtt_sn_connect(&mqtt_client, false, true); __ASSERT(err == 0, "mqtt_sn_connect() failed %d", err); From fd96edcd2861bd4b3bbfe03656dde6ce729d161a Mon Sep 17 00:00:00 2001 From: Ian Morris Date: Wed, 2 Oct 2024 16:53:53 -0700 Subject: [PATCH 2567/4482] boards: renesas: ek_ra8m1: added pmod node labels Added pmod_serial and pmod_header node labels to EK-RA8M1 device tree board definition, allowing compatible shield boards to be used. Signed-off-by: Ian Morris --- boards/renesas/ek_ra8m1/ek_ra8m1-pinctrl.dtsi | 24 +++++++ boards/renesas/ek_ra8m1/ek_ra8m1.dts | 64 +++++++++++++++++++ 2 files changed, 88 insertions(+) diff --git a/boards/renesas/ek_ra8m1/ek_ra8m1-pinctrl.dtsi b/boards/renesas/ek_ra8m1/ek_ra8m1-pinctrl.dtsi index 89899dfa6a2b6..e1cf5623feccf 100644 --- a/boards/renesas/ek_ra8m1/ek_ra8m1-pinctrl.dtsi +++ b/boards/renesas/ek_ra8m1/ek_ra8m1-pinctrl.dtsi @@ -4,6 +4,30 @@ */ &pinctrl { + sci0_default: sci0_default { + group1 { + /* tx */ + psels = ; + drive-strength = "medium"; + }; + group2 { + /* rx */ + psels = ; + }; + }; + + sci2_default: sci2_default { + group1 { + /* tx */ + psels = ; + drive-strength = "medium"; + }; + group2 { + /* rx */ + psels = ; + }; + }; + sci3_default: sci3_default { group1 { /* tx */ diff --git a/boards/renesas/ek_ra8m1/ek_ra8m1.dts b/boards/renesas/ek_ra8m1/ek_ra8m1.dts index fbfbe483b4b45..354e53298f8a1 100644 --- a/boards/renesas/ek_ra8m1/ek_ra8m1.dts +++ b/boards/renesas/ek_ra8m1/ek_ra8m1.dts @@ -63,6 +63,36 @@ /* GND */ }; + pmod1_header: pmod-connector-1 { + compatible = "digilent,pmod"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map = <0 0 &ioport6 12 0>, /* IO1 */ + <1 0 &ioport6 9 0>, /* IO2 */ + <2 0 &ioport6 10 0>, /* IO3 */ + <3 0 &ioport6 11 0>, /* IO4 */ + <4 0 &ioport0 6 0>, /* IO5 */ + <5 0 &ioporta 8 0>, /* IO6 */ + <6 0 &ioport6 14 0>, /* IO7 */ + <7 0 &ioport6 15 0>; /* IO8 */ + }; + + pmod2_header: pmod-connector-2 { + compatible = "digilent,pmod"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map = <0 0 &ioporta 5 0>, /* IO1 */ + <1 0 &ioporta 3 0>, /* IO2 */ + <2 0 &ioporta 2 0>, /* IO3 */ + <3 0 &ioporta 4 0>, /* IO4 */ + <4 0 &ioport5 8 0>, /* IO5 */ + <5 0 &ioport8 9 0>, /* IO6 */ + <6 0 &ioport8 10 0>, /* IO7 */ + <7 0 &ioport8 11 0>; /* IO8 */ + }; + aliases { led0 = &led1; }; @@ -142,10 +172,38 @@ status = "okay"; }; +&ioport8 { + status = "okay"; +}; + &ioport9 { status = "okay"; }; +&ioporta { + status = "okay"; +}; + +&sci0 { + pinctrl-0 = <&sci0_default>; + pinctrl-names = "default"; + status = "okay"; + uart0: uart { + current-speed = <115200>; + status = "okay"; + }; +}; + +&sci2 { + pinctrl-0 = <&sci2_default>; + pinctrl-names = "default"; + status = "okay"; + uart2: uart { + current-speed = <115200>; + status = "okay"; + }; +}; + &sci3 { pinctrl-0 = <&sci3_default>; pinctrl-names = "default"; @@ -221,3 +279,9 @@ mikrobus_serial: &uart3 {}; status = "okay"; }; }; + +pmod1_serial: &uart0 {}; +pmod2_serial: &uart2 {}; + +pmod_serial: &pmod1_serial {}; +pmod_header: &pmod1_header {}; From b4d1076ab2e3bdbffe034597daadd8f479c20a26 Mon Sep 17 00:00:00 2001 From: Okan Sahin Date: Wed, 1 Nov 2023 11:44:06 +0300 Subject: [PATCH 2568/4482] dts: arm: adi: Add counter RTC instance to MAX32xxx This commit instantiates counter RTC on MAX32xxx MCUs. Co-authored-by: Sadik Ozer Signed-off-by: Okan Sahin --- dts/arm/adi/max32/max32xxx.dtsi | 7 +++++++ dts/bindings/counter/adi,max32-rtc-counter.yaml | 9 +++++++++ 2 files changed, 16 insertions(+) create mode 100644 dts/bindings/counter/adi,max32-rtc-counter.yaml diff --git a/dts/arm/adi/max32/max32xxx.dtsi b/dts/arm/adi/max32/max32xxx.dtsi index 781e4bab5301a..10f9630eb841f 100644 --- a/dts/arm/adi/max32/max32xxx.dtsi +++ b/dts/arm/adi/max32/max32xxx.dtsi @@ -294,6 +294,13 @@ #pwm-cells = <3>; }; }; + + rtc_counter: rtc_counter@40006000 { + compatible = "adi,max32-rtc-counter"; + reg = <0x40006000 0x400>; + interrupts = <3 0>; + status = "disabled"; + }; }; }; diff --git a/dts/bindings/counter/adi,max32-rtc-counter.yaml b/dts/bindings/counter/adi,max32-rtc-counter.yaml new file mode 100644 index 0000000000000..9b1058545fb93 --- /dev/null +++ b/dts/bindings/counter/adi,max32-rtc-counter.yaml @@ -0,0 +1,9 @@ +# Copyright (c) 2024 Analog Devices, Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +description: ADI MAX32 compatible Counter RTC + +compatible: "adi,max32-rtc-counter" + +include: [base.yaml] From 5e38168f0cd11a678bfacd448df07e16de71243d Mon Sep 17 00:00:00 2001 From: Sadik Ozer Date: Mon, 18 Mar 2024 14:54:25 +0300 Subject: [PATCH 2569/4482] drivers: counter: Add MAX32xxx counter RTC driver Common RTC counter driver for MAX32xxx MCUs. Time of day alarm is used to generate interrupt. The resolution of time of day interrupt is 1Hz. Subsecond alarm interrupt not works it does not meet zephyr counter driver requirement, so that not used. To use as wakeup source wakeup-source parameter shall be defined as below &rtc_counter { status = "okay"; wakeup-source; }; Co-authored-by: Okan Sahin Signed-off-by: Sadik Ozer --- drivers/counter/CMakeLists.txt | 1 + drivers/counter/Kconfig | 2 + drivers/counter/Kconfig.max32_rtc | 9 + drivers/counter/counter_max32_rtc.c | 266 ++++++++++++++++++++++++++++ 4 files changed, 278 insertions(+) create mode 100644 drivers/counter/Kconfig.max32_rtc create mode 100644 drivers/counter/counter_max32_rtc.c diff --git a/drivers/counter/CMakeLists.txt b/drivers/counter/CMakeLists.txt index 157d55060408f..d406f7e2d625f 100644 --- a/drivers/counter/CMakeLists.txt +++ b/drivers/counter/CMakeLists.txt @@ -50,5 +50,6 @@ zephyr_library_sources_ifdef(CONFIG_COUNTER_SNPS_DW counter_dw_timer zephyr_library_sources_ifdef(CONFIG_COUNTER_SHELL counter_timer_shell.c) zephyr_library_sources_ifdef(CONFIG_COUNTER_TIMER_RPI_PICO counter_rpi_pico_timer.c) zephyr_library_sources_ifdef(CONFIG_COUNTER_TIMER_MAX32 counter_max32_timer.c) +zephyr_library_sources_ifdef(CONFIG_COUNTER_RTC_MAX32 counter_max32_rtc.c) zephyr_library_sources_ifdef(CONFIG_COUNTER_NXP_MRT counter_nxp_mrt.c) zephyr_library_sources_ifdef(CONFIG_COUNTER_RA_AGT counter_renesas_ra_agt.c) diff --git a/drivers/counter/Kconfig b/drivers/counter/Kconfig index c801b413d86d7..32baf8255ce82 100644 --- a/drivers/counter/Kconfig +++ b/drivers/counter/Kconfig @@ -98,6 +98,8 @@ source "drivers/counter/Kconfig.rpi_pico" source "drivers/counter/Kconfig.max32_timer" +source "drivers/counter/Kconfig.max32_rtc" + source "drivers/counter/Kconfig.nxp_mrt" source "drivers/counter/Kconfig.renesas_ra" diff --git a/drivers/counter/Kconfig.max32_rtc b/drivers/counter/Kconfig.max32_rtc new file mode 100644 index 0000000000000..19dbfd453dfa4 --- /dev/null +++ b/drivers/counter/Kconfig.max32_rtc @@ -0,0 +1,9 @@ +# Copyright (c) 2024 Analog Devices, Inc. +# SPDX-License-Identifier: Apache-2.0 + +config COUNTER_RTC_MAX32 + bool "MAX32xxx counter rtc driver" + default y + depends on DT_HAS_ADI_MAX32_RTC_COUNTER_ENABLED + help + Enable the counter rtc driver for MAX32 MCUs. diff --git a/drivers/counter/counter_max32_rtc.c b/drivers/counter/counter_max32_rtc.c new file mode 100644 index 0000000000000..b1e3b217381e5 --- /dev/null +++ b/drivers/counter/counter_max32_rtc.c @@ -0,0 +1,266 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT adi_max32_rtc_counter + +#include +#include +#include +#include + +#include +#include + +/* Resoultion is 1sec for time of day alarm*/ +#define MAX32_RTC_COUNTER_FREQ 1 + +/* 20bits used for time of day alarm */ +#define MAX32_RTC_COUNTER_MAX_VALUE ((1 << 21) - 1) + +#define MAX32_RTC_COUNTER_INT_FL MXC_RTC_INT_FL_LONG +#define MAX32_RTC_COUNTER_INT_EN MXC_RTC_INT_EN_LONG + +struct max32_rtc_data { + counter_alarm_callback_t alarm_callback; + counter_top_callback_t top_callback; + void *alarm_user_data; + void *top_user_data; +}; + +struct max32_rtc_config { + struct counter_config_info info; + mxc_rtc_regs_t *regs; + void (*irq_func)(void); +}; + +static int api_start(const struct device *dev) +{ + /* Ensure that both sec and subsec are reset to 0 */ + while (MXC_RTC_Init(0, 0) == E_BUSY) { + ; + } + + while (MXC_RTC_Start() == E_BUSY) { + ; + } + + while (MXC_RTC_EnableInt(MAX32_RTC_COUNTER_INT_EN) == E_BUSY) { + ; + } + + return 0; +} + +static int api_stop(const struct device *dev) +{ + ARG_UNUSED(dev); + + while (MXC_RTC_DisableInt(MAX32_RTC_COUNTER_INT_EN) == E_BUSY) { + ; + } + MXC_RTC_Stop(); + + return 0; +} + +static int api_get_value(const struct device *dev, uint32_t *ticks) +{ + const struct max32_rtc_config *cfg = dev->config; + mxc_rtc_regs_t *regs = cfg->regs; + uint32_t sec = 0, subsec = 0; + + /* Read twice incase of glitch */ + sec = regs->sec; + if (regs->sec != sec) { + sec = regs->sec; + } + + /* Read twice incase of glitch */ + subsec = regs->ssec; + if (regs->ssec != subsec) { + subsec = regs->ssec; + } + + *ticks = sec; + if (subsec >= (MXC_RTC_MAX_SSEC / 2)) { + *ticks += 1; + } + + return 0; +} + +static int api_set_top_value(const struct device *dev, const struct counter_top_cfg *counter_cfg) +{ + const struct max32_rtc_config *cfg = dev->config; + struct max32_rtc_data *const data = dev->data; + + if (counter_cfg->ticks == 0) { + return -EINVAL; + } + + if (counter_cfg->ticks != cfg->info.max_top_value) { + return -ENOTSUP; + } + + data->top_callback = counter_cfg->callback; + data->top_user_data = counter_cfg->user_data; + + return 0; +} + +static uint32_t api_get_pending_int(const struct device *dev) +{ + ARG_UNUSED(dev); + int flags = MXC_RTC_GetFlags(); + + if (flags & MAX32_RTC_COUNTER_INT_FL) { + return 1; + } + + return 0; +} + +static uint32_t api_get_top_value(const struct device *dev) +{ + const struct max32_rtc_config *cfg = dev->config; + + return cfg->info.max_top_value; +} + +static int api_set_alarm(const struct device *dev, uint8_t chan, + const struct counter_alarm_cfg *alarm_cfg) +{ + int ret; + struct max32_rtc_data *data = dev->data; + uint32_t ticks = alarm_cfg->ticks; + uint32_t current; + + /* Alarm frequenct is 1Hz so that it seems ticks becomes 0 + * some times, in that case system being blocked. + * Set it to 1 if ticks is 0 + */ + if (ticks == 0) { + ticks = 1; + } + + if (alarm_cfg->ticks > api_get_top_value(dev)) { + return -EINVAL; + } + + if (data->alarm_callback != NULL) { + return -EBUSY; + } + + api_stop(dev); + + api_get_value(dev, ¤t); + if ((alarm_cfg->flags & COUNTER_ALARM_CFG_ABSOLUTE) == 0) { + ticks += current; + } + + ret = MXC_RTC_SetTimeofdayAlarm(ticks); + if (ret == E_BUSY) { + ret = -EBUSY; + } + + if (ret == 0) { + data->alarm_callback = alarm_cfg->callback; + data->alarm_user_data = alarm_cfg->user_data; + } + + api_start(dev); + + return ret; +} + +static int api_cancel_alarm(const struct device *dev, uint8_t chan) +{ + struct max32_rtc_data *data = dev->data; + + while (MXC_RTC_DisableInt(MAX32_RTC_COUNTER_INT_EN) == E_BUSY) { + ; + } + data->alarm_callback = NULL; + + return 0; +} + +static void rtc_max32_isr(const struct device *dev) +{ + struct max32_rtc_data *const data = dev->data; + int flags = MXC_RTC_GetFlags(); + + if (flags & MAX32_RTC_COUNTER_INT_FL) { + if (data->alarm_callback) { + counter_alarm_callback_t cb; + uint32_t current; + + api_get_value(dev, ¤t); + + cb = data->alarm_callback; + data->alarm_callback = NULL; + cb(dev, 0, current, data->alarm_user_data); + } + } + + /* Clear all flags */ + MXC_RTC_ClearFlags(flags); +} + +static int rtc_max32_init(const struct device *dev) +{ + const struct max32_rtc_config *cfg = dev->config; + + while (MXC_RTC_Init(0, 0) == E_BUSY) { + ; + } + + api_stop(dev); + + cfg->irq_func(); + + return 0; +} + +static const struct counter_driver_api counter_rtc_max32_driver_api = { + .start = api_start, + .stop = api_stop, + .get_value = api_get_value, + .set_top_value = api_set_top_value, + .get_pending_int = api_get_pending_int, + .get_top_value = api_get_top_value, + .set_alarm = api_set_alarm, + .cancel_alarm = api_cancel_alarm, +}; + +#define COUNTER_RTC_MAX32_INIT(_num) \ + static struct max32_rtc_data rtc_max32_data_##_num; \ + static void max32_rtc_irq_init_##_num(void) \ + { \ + IRQ_CONNECT(DT_INST_IRQN(_num), DT_INST_IRQ(_num, priority), rtc_max32_isr, \ + DEVICE_DT_INST_GET(_num), 0); \ + irq_enable(DT_INST_IRQN(_num)); \ + if (DT_INST_PROP(_num, wakeup_source)) { \ + MXC_LP_EnableRTCAlarmWakeup(); \ + } \ + }; \ + static const struct max32_rtc_config rtc_max32_config_##_num = { \ + .info = \ + { \ + .max_top_value = MAX32_RTC_COUNTER_MAX_VALUE, \ + .freq = MAX32_RTC_COUNTER_FREQ, \ + .flags = COUNTER_CONFIG_INFO_COUNT_UP, \ + .channels = 1, \ + }, \ + .regs = (mxc_rtc_regs_t *)DT_INST_REG_ADDR(_num), \ + .irq_func = max32_rtc_irq_init_##_num, \ + }; \ + \ + DEVICE_DT_INST_DEFINE(_num, &rtc_max32_init, NULL, &rtc_max32_data_##_num, \ + &rtc_max32_config_##_num, PRE_KERNEL_1, \ + CONFIG_COUNTER_INIT_PRIORITY, &counter_rtc_max32_driver_api); + +DT_INST_FOREACH_STATUS_OKAY(COUNTER_RTC_MAX32_INIT) From 0253a1054c36fe7ea64f1ae8f30457790f0639af Mon Sep 17 00:00:00 2001 From: Okan Sahin Date: Wed, 1 Nov 2023 11:44:33 +0300 Subject: [PATCH 2570/4482] boards: adi: max32: Enable counter RTC This commit enables counter RTC for following boards - MAX32662 EVKIT - MAX32655 EVKIT - MAX32655 FTHR - MAX32666 FTHR - MAX32666 EVKIT - MAX32670 EVKIT - MAX32672 FTHR - MAX32672 EVKIT - MAX32690 EVKIT Co-authored-by: Sadik Ozer Co-authored-by: Maureen Helm Signed-off-by: Okan Sahin --- .../adi/max32655evkit/max32655evkit_max32655_m4.dts | 11 +++++++++++ .../adi/max32655evkit/max32655evkit_max32655_m4.yaml | 1 + boards/adi/max32655fthr/max32655fthr_max32655_m4.dts | 11 +++++++++++ boards/adi/max32655fthr/max32655fthr_max32655_m4.yaml | 1 + boards/adi/max32662evkit/max32662evkit.dts | 11 +++++++++++ boards/adi/max32662evkit/max32662evkit.yaml | 1 + .../adi/max32666evkit/max32666evkit_max32666_cpu0.dts | 4 ++++ .../max32666evkit/max32666evkit_max32666_cpu0.yaml | 1 + .../adi/max32666fthr/max32666fthr_max32666_cpu0.dts | 4 ++++ .../adi/max32666fthr/max32666fthr_max32666_cpu0.yaml | 1 + boards/adi/max32670evkit/max32670evkit.dts | 11 +++++++++++ boards/adi/max32670evkit/max32670evkit.yaml | 1 + boards/adi/max32672evkit/max32672evkit.dts | 11 +++++++++++ boards/adi/max32672evkit/max32672evkit.yaml | 1 + boards/adi/max32672fthr/max32672fthr.dts | 11 +++++++++++ boards/adi/max32672fthr/max32672fthr.yaml | 1 + .../adi/max32690evkit/max32690evkit_max32690_m4.dts | 4 ++++ .../adi/max32690evkit/max32690evkit_max32690_m4.yaml | 1 + 18 files changed, 87 insertions(+) diff --git a/boards/adi/max32655evkit/max32655evkit_max32655_m4.dts b/boards/adi/max32655evkit/max32655evkit_max32655_m4.dts index 555ef0f66d565..a14953606ea19 100644 --- a/boards/adi/max32655evkit/max32655evkit_max32655_m4.dts +++ b/boards/adi/max32655evkit/max32655evkit_max32655_m4.dts @@ -78,6 +78,13 @@ status = "okay"; }; +/* + * ERTCO is required for counter RTC + */ +&clk_ertco { + status = "okay"; +}; + &gpio0 { status = "okay"; }; @@ -122,3 +129,7 @@ pinctrl-0 = <&owm_io_p0_6 &owm_pe_p0_7>; pinctrl-names = "default"; }; + +&rtc_counter { + status = "okay"; +}; diff --git a/boards/adi/max32655evkit/max32655evkit_max32655_m4.yaml b/boards/adi/max32655evkit/max32655evkit_max32655_m4.yaml index b65bda513bb9a..f3a7fac43baa8 100644 --- a/boards/adi/max32655evkit/max32655evkit_max32655_m4.yaml +++ b/boards/adi/max32655evkit/max32655evkit_max32655_m4.yaml @@ -17,6 +17,7 @@ supported: - spi - adc - counter + - rtc_counter - pwm - w1 - flash diff --git a/boards/adi/max32655fthr/max32655fthr_max32655_m4.dts b/boards/adi/max32655fthr/max32655fthr_max32655_m4.dts index f5df5e5260acf..2f82dc09022e9 100644 --- a/boards/adi/max32655fthr/max32655fthr_max32655_m4.dts +++ b/boards/adi/max32655fthr/max32655fthr_max32655_m4.dts @@ -112,6 +112,13 @@ status = "okay"; }; +/* + * ERTCO is required for counter RTC + */ +&clk_ertco { + status = "okay"; +}; + &gpio0 { status = "okay"; }; @@ -151,3 +158,7 @@ pinctrl-0 = <&spi1_mosi_p0_21 &spi1_miso_p0_22 &spi1_sck_p0_23 &spi1_ss0_p0_20>; pinctrl-names = "default"; }; + +&rtc_counter { + status = "okay"; +}; diff --git a/boards/adi/max32655fthr/max32655fthr_max32655_m4.yaml b/boards/adi/max32655fthr/max32655fthr_max32655_m4.yaml index 080662f2bea33..37c8b01e02eb5 100644 --- a/boards/adi/max32655fthr/max32655fthr_max32655_m4.yaml +++ b/boards/adi/max32655fthr/max32655fthr_max32655_m4.yaml @@ -17,6 +17,7 @@ supported: - spi - adc - counter + - rtc_counter - pwm - flash ram: 128 diff --git a/boards/adi/max32662evkit/max32662evkit.dts b/boards/adi/max32662evkit/max32662evkit.dts index 25a9e35177f2d..cf9096ff09c52 100644 --- a/boards/adi/max32662evkit/max32662evkit.dts +++ b/boards/adi/max32662evkit/max32662evkit.dts @@ -102,6 +102,13 @@ status = "okay"; }; +/* + * ERTCO is required for counter RTC + */ +&clk_ertco { + status = "okay"; +}; + &gpio0 { status = "okay"; }; @@ -120,6 +127,10 @@ status = "okay"; }; +&rtc_counter { + status = "okay"; +}; + &spi0 { status = "okay"; pinctrl-0 = <&spi0a_copi_p0_3 &spi0a_cito_p0_2 &spi0a_sck_p0_4 &spi0a_ts0_p0_5>; diff --git a/boards/adi/max32662evkit/max32662evkit.yaml b/boards/adi/max32662evkit/max32662evkit.yaml index df3a6da24bb6b..eebab96b6766d 100644 --- a/boards/adi/max32662evkit/max32662evkit.yaml +++ b/boards/adi/max32662evkit/max32662evkit.yaml @@ -17,6 +17,7 @@ supported: - spi - adc - counter + - rtc_counter - pwm - flash ram: 80 diff --git a/boards/adi/max32666evkit/max32666evkit_max32666_cpu0.dts b/boards/adi/max32666evkit/max32666evkit_max32666_cpu0.dts index 49c9a06e9de5c..a04fcd6a4e897 100644 --- a/boards/adi/max32666evkit/max32666evkit_max32666_cpu0.dts +++ b/boards/adi/max32666evkit/max32666evkit_max32666_cpu0.dts @@ -110,3 +110,7 @@ pinctrl-0 = <&owm_io_p0_4 &owm_pe_p0_5>; pinctrl-names = "default"; }; + +&rtc_counter { + status = "okay"; +}; diff --git a/boards/adi/max32666evkit/max32666evkit_max32666_cpu0.yaml b/boards/adi/max32666evkit/max32666evkit_max32666_cpu0.yaml index 782b21a273ed7..7d5f86999702e 100644 --- a/boards/adi/max32666evkit/max32666evkit_max32666_cpu0.yaml +++ b/boards/adi/max32666evkit/max32666evkit_max32666_cpu0.yaml @@ -16,6 +16,7 @@ supported: - watchdog - adc - counter + - rtc_counter - pwm - w1 - flash diff --git a/boards/adi/max32666fthr/max32666fthr_max32666_cpu0.dts b/boards/adi/max32666fthr/max32666fthr_max32666_cpu0.dts index bfa31f6f91e37..02b45bda3db55 100644 --- a/boards/adi/max32666fthr/max32666fthr_max32666_cpu0.dts +++ b/boards/adi/max32666fthr/max32666fthr_max32666_cpu0.dts @@ -120,6 +120,10 @@ status = "okay"; }; +&rtc_counter { + status = "okay"; +}; + &spi1 { status = "okay"; pinctrl-0 = <&spi1_mosi_p0_17 &spi1_miso_p0_18 &spi1_sck_p0_19 &spi1_ss0_p0_16>; diff --git a/boards/adi/max32666fthr/max32666fthr_max32666_cpu0.yaml b/boards/adi/max32666fthr/max32666fthr_max32666_cpu0.yaml index 8c674288dc51a..c40294e0ae33c 100644 --- a/boards/adi/max32666fthr/max32666fthr_max32666_cpu0.yaml +++ b/boards/adi/max32666fthr/max32666fthr_max32666_cpu0.yaml @@ -17,6 +17,7 @@ supported: - spi - adc - counter + - rtc_counter - pwm - w1 - flash diff --git a/boards/adi/max32670evkit/max32670evkit.dts b/boards/adi/max32670evkit/max32670evkit.dts index 98c6076374b83..ed8a3f4760154 100644 --- a/boards/adi/max32670evkit/max32670evkit.dts +++ b/boards/adi/max32670evkit/max32670evkit.dts @@ -65,6 +65,13 @@ status = "okay"; }; +/* + * ERTCO is required for counter RTC + */ +&clk_ertco { + status = "okay"; +}; + &gpio0 { status = "okay"; }; @@ -96,3 +103,7 @@ pinctrl-0 = <&spi0_mosi_p0_3 &spi0_miso_p0_2 &spi0_sck_p0_4 &spi0_ss0_p0_5>; pinctrl-names = "default"; }; + +&rtc_counter { + status = "okay"; +}; diff --git a/boards/adi/max32670evkit/max32670evkit.yaml b/boards/adi/max32670evkit/max32670evkit.yaml index 4541501514868..d040a09de49db 100644 --- a/boards/adi/max32670evkit/max32670evkit.yaml +++ b/boards/adi/max32670evkit/max32670evkit.yaml @@ -16,6 +16,7 @@ supported: - watchdog - spi - counter + - rtc_counter - pwm - flash ram: 160 diff --git a/boards/adi/max32672evkit/max32672evkit.dts b/boards/adi/max32672evkit/max32672evkit.dts index d1d97f78af266..d0af6e69c2898 100644 --- a/boards/adi/max32672evkit/max32672evkit.dts +++ b/boards/adi/max32672evkit/max32672evkit.dts @@ -103,6 +103,13 @@ status = "okay"; }; +/* + * ERTCO is required for counter RTC + */ +&clk_ertco { + status = "okay"; +}; + &gpio0 { status = "okay"; }; @@ -149,3 +156,7 @@ pinctrl-names = "default"; cs-gpios = <&gpio0 5 (GPIO_ACTIVE_LOW | MAX32_VSEL_VDDIOH)>; }; + +&rtc_counter { + status = "okay"; +}; diff --git a/boards/adi/max32672evkit/max32672evkit.yaml b/boards/adi/max32672evkit/max32672evkit.yaml index 2ba0a764b1e29..e6dae70435c80 100644 --- a/boards/adi/max32672evkit/max32672evkit.yaml +++ b/boards/adi/max32672evkit/max32672evkit.yaml @@ -17,6 +17,7 @@ supported: - spi - adc - counter + - rtc_counter - pwm - flash ram: 200 diff --git a/boards/adi/max32672fthr/max32672fthr.dts b/boards/adi/max32672fthr/max32672fthr.dts index b2287cf77080f..7690d03424a14 100644 --- a/boards/adi/max32672fthr/max32672fthr.dts +++ b/boards/adi/max32672fthr/max32672fthr.dts @@ -100,6 +100,13 @@ status = "okay"; }; +/* + * ERTCO is required for counter RTC + */ +&clk_ertco { + status = "okay"; +}; + &gpio0 { status = "okay"; }; @@ -148,3 +155,7 @@ pinctrl-0 = <&spi1a_mosi_p0_15 &spi1a_miso_p0_14 &spi1a_sck_p0_16 &spi1a_ss0_p0_17>; pinctrl-names = "default"; }; + +&rtc_counter { + status = "okay"; +}; diff --git a/boards/adi/max32672fthr/max32672fthr.yaml b/boards/adi/max32672fthr/max32672fthr.yaml index 29560ebbe6610..f98839246c8b3 100644 --- a/boards/adi/max32672fthr/max32672fthr.yaml +++ b/boards/adi/max32672fthr/max32672fthr.yaml @@ -17,6 +17,7 @@ supported: - spi - adc - counter + - rtc_counter - pwm - flash ram: 200 diff --git a/boards/adi/max32690evkit/max32690evkit_max32690_m4.dts b/boards/adi/max32690evkit/max32690evkit_max32690_m4.dts index 26f646f3da840..df709945d7461 100644 --- a/boards/adi/max32690evkit/max32690evkit_max32690_m4.dts +++ b/boards/adi/max32690evkit/max32690evkit_max32690_m4.dts @@ -163,3 +163,7 @@ pinctrl-0 = <&owm_io_p0_8 &owm_pe_p0_7>; pinctrl-names = "default"; }; + +&rtc_counter { + status = "okay"; +}; diff --git a/boards/adi/max32690evkit/max32690evkit_max32690_m4.yaml b/boards/adi/max32690evkit/max32690evkit_max32690_m4.yaml index 4c9d188777e83..b6a5a9a5d7a55 100644 --- a/boards/adi/max32690evkit/max32690evkit_max32690_m4.yaml +++ b/boards/adi/max32690evkit/max32690evkit_max32690_m4.yaml @@ -17,6 +17,7 @@ supported: - watchdog - adc - counter + - rtc_counter - pwm - w1 - flash From 18853d026a5e15e1f274a1d0f72b8154e73892af Mon Sep 17 00:00:00 2001 From: Sadik Ozer Date: Mon, 18 Mar 2024 14:57:04 +0300 Subject: [PATCH 2571/4482] tests: drivers: counter: Enable counter RTC test for MAX32 MCUs This commit enables counter RTC test for MAX32 MCUs. Co-authored-by: Okan Sahin Signed-off-by: Sadik Ozer --- tests/drivers/counter/counter_basic_api/src/test_counter.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/drivers/counter/counter_basic_api/src/test_counter.c b/tests/drivers/counter/counter_basic_api/src/test_counter.c index 82c70b5ac9c56..59236f9a91497 100644 --- a/tests/drivers/counter/counter_basic_api/src/test_counter.c +++ b/tests/drivers/counter/counter_basic_api/src/test_counter.c @@ -117,6 +117,9 @@ static const struct device *const devices[] = { #ifdef CONFIG_COUNTER_TIMER_RPI_PICO DEVS_FOR_DT_COMPAT(raspberrypi_pico_timer) #endif +#ifdef CONFIG_COUNTER_RTC_MAX32 + DEVS_FOR_DT_COMPAT(adi_max32_rtc_counter) +#endif #ifdef CONFIG_COUNTER_AMBIQ DEVS_FOR_DT_COMPAT(ambiq_counter) #endif @@ -135,6 +138,9 @@ static const struct device *const period_devs[] = { #ifdef CONFIG_COUNTER_RTC_STM32 DEVS_FOR_DT_COMPAT(st_stm32_rtc) #endif +#ifdef CONFIG_COUNTER_RTC_MAX32 + DEVS_FOR_DT_COMPAT(adi_max32_rtc_counter) +#endif }; typedef void (*counter_test_func_t)(const struct device *dev); From 99a5236b4025557ff76f9106febfdbdbae883c95 Mon Sep 17 00:00:00 2001 From: Lauren Murphy Date: Wed, 11 Sep 2024 14:26:22 -0700 Subject: [PATCH 2572/4482] llext: add support for arc Adds compiler flag(s) and some architecture-specific relocations for ARC. No userspace support, doesn't support all relocations. Signed-off-by: Lauren Murphy --- arch/arc/core/CMakeLists.txt | 2 + arch/arc/core/elf.c | 79 +++++++++++++++++++ cmake/compiler/gcc/target_arc.cmake | 11 +++ doc/services/llext/index.rst | 2 +- .../simple/boards/qemu_arc_qemu_arc_em.conf | 6 ++ .../boards/qemu_arc_qemu_arc_em.overlay | 28 +++++++ .../llext/simple/no_mem_protection.conf | 1 + tests/subsys/llext/simple/testcase.yaml | 19 +++-- 8 files changed, 137 insertions(+), 11 deletions(-) create mode 100644 arch/arc/core/elf.c create mode 100644 tests/subsys/llext/simple/boards/qemu_arc_qemu_arc_em.conf create mode 100644 tests/subsys/llext/simple/boards/qemu_arc_qemu_arc_em.overlay diff --git a/arch/arc/core/CMakeLists.txt b/arch/arc/core/CMakeLists.txt index 00c9f77503824..5b81f52748085 100644 --- a/arch/arc/core/CMakeLists.txt +++ b/arch/arc/core/CMakeLists.txt @@ -34,3 +34,5 @@ add_subdirectory_ifdef(CONFIG_ARC_CORE_MPU mpu) add_subdirectory_ifdef(CONFIG_ARC_SECURE_FIRMWARE secureshield) zephyr_linker_sources(ROM_START SORT_KEY 0x0vectors vector_table.ld) + +zephyr_library_sources_ifdef(CONFIG_LLEXT elf.c) diff --git a/arch/arc/core/elf.c b/arch/arc/core/elf.c new file mode 100644 index 0000000000000..7bdb5b08fcfa8 --- /dev/null +++ b/arch/arc/core/elf.c @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2024 Intel Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +LOG_MODULE_REGISTER(elf, CONFIG_LLEXT_LOG_LEVEL); + +#define R_ARC_32 4 +#define R_ARC_B26 5 /* AKA R_ARC_64 */ +#define R_ARC_S25W_PCREL 17 +#define R_ARC_32_ME 27 + +/* ARCompact insns packed in memory have Middle Endian encoding */ +#define ME(x) ((x & 0xffff0000) >> 16) | ((x & 0xffff) << 16); + +/** + * @brief Architecture specific function for relocating shared elf + * + * Elf files contain a series of relocations described in multiple sections. + * These relocation instructions are architecture specific and each architecture + * supporting modules must implement this. + * + * The relocation codes are well documented: + * https://github.com/foss-for-synopsys-dwc-arc-processors/arc-ABI-manual/blob/master/ARCv2_ABI.pdf + * https://github.com/zephyrproject-rtos/binutils-gdb + */ +int arch_elf_relocate(elf_rela_t *rel, uintptr_t loc, uintptr_t sym_base_addr, const char *sym_name, + uintptr_t load_bias) +{ + int ret = 0; + uint32_t insn = *(uint32_t *)loc; + uint32_t value; + + sym_base_addr += rel->r_addend; + + int reloc_type = ELF32_R_TYPE(rel->r_info); + + switch (reloc_type) { + case R_ARC_32: + case R_ARC_B26: + *(uint32_t *)loc = sym_base_addr; + break; + case R_ARC_S25W_PCREL: + /* ((S + A) - P) >> 2 + * S = symbol address + * A = addend + * P = relative offset to PCL + */ + value = (sym_base_addr + rel->r_addend - (loc & ~0x3)) >> 2; + + insn = ME(insn); + + /* disp25w */ + insn = insn & ~0x7fcffcf; + insn |= ((value >> 0) & 0x01ff) << 18; + insn |= ((value >> 9) & 0x03ff) << 6; + insn |= ((value >> 19) & 0x000f) << 0; + + insn = ME(insn); + + *(uint32_t *)loc = insn; + break; + case R_ARC_32_ME: + *(uint32_t *)loc = ME(sym_base_addr); + break; + default: + LOG_ERR("unknown relocation: %u\n", reloc_type); + ret = -ENOEXEC; + break; + } + + return ret; +} diff --git a/cmake/compiler/gcc/target_arc.cmake b/cmake/compiler/gcc/target_arc.cmake index e18fa468f1600..d306fe1550f10 100644 --- a/cmake/compiler/gcc/target_arc.cmake +++ b/cmake/compiler/gcc/target_arc.cmake @@ -8,5 +8,16 @@ if(NOT DEFINED GCC_ARC_TUNED_CPU) set(GCC_ARC_TUNED_CPU ${GCC_M_CPU}) endif() +# Flags not supported by llext linker +# (regexps are supported and match whole word) +set(LLEXT_REMOVE_FLAGS + -fno-pic + -fno-pie + -ffunction-sections + -fdata-sections + -g.* + -Os +) + list(APPEND TOOLCHAIN_C_FLAGS -mcpu=${GCC_ARC_TUNED_CPU}) list(APPEND TOOLCHAIN_LD_FLAGS -mcpu=${GCC_ARC_TUNED_CPU}) diff --git a/doc/services/llext/index.rst b/doc/services/llext/index.rst index f626f1df1daa0..ebae211d16db0 100644 --- a/doc/services/llext/index.rst +++ b/doc/services/llext/index.rst @@ -21,4 +21,4 @@ and introspected to some degree, as well as unloaded when no longer needed. .. note:: The LLEXT subsystem requires architecture-specific support. It is currently - available only on RISC-V, ARM, ARM64 and Xtensa cores. + available only on RISC-V, ARM, ARM64, ARC (experimental) and Xtensa cores. diff --git a/tests/subsys/llext/simple/boards/qemu_arc_qemu_arc_em.conf b/tests/subsys/llext/simple/boards/qemu_arc_qemu_arc_em.conf new file mode 100644 index 0000000000000..85f52f8051357 --- /dev/null +++ b/tests/subsys/llext/simple/boards/qemu_arc_qemu_arc_em.conf @@ -0,0 +1,6 @@ +CONFIG_FILE_SYSTEM=y +CONFIG_FILE_SYSTEM_LITTLEFS=y +CONFIG_FS_LITTLEFS_FMP_DEV=y +CONFIG_FLASH_MAP=y +CONFIG_FLASH=y +CONFIG_FLASH_SIMULATOR=y diff --git a/tests/subsys/llext/simple/boards/qemu_arc_qemu_arc_em.overlay b/tests/subsys/llext/simple/boards/qemu_arc_qemu_arc_em.overlay new file mode 100644 index 0000000000000..3ec42970a9eb6 --- /dev/null +++ b/tests/subsys/llext/simple/boards/qemu_arc_qemu_arc_em.overlay @@ -0,0 +1,28 @@ +/ { + sim_flash_controller: sim_flash_controller { + compatible = "zephyr,sim-flash"; + + #address-cells = <1>; + #size-cells = <1>; + erase-value = <0x00>; + + flash_sim0: flash_sim@0 { + compatible = "soc-nv-flash"; + reg = <0x00000000 0x2000>; + + erase-block-size = <1024>; + write-block-size = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + storage_partition: partition@0 { + label = "storage_partition"; + reg = <0x00000000 0x2000>; + }; + }; + }; + }; +}; diff --git a/tests/subsys/llext/simple/no_mem_protection.conf b/tests/subsys/llext/simple/no_mem_protection.conf index d45d7836d4d1f..6fbaeac79bbaf 100644 --- a/tests/subsys/llext/simple/no_mem_protection.conf +++ b/tests/subsys/llext/simple/no_mem_protection.conf @@ -6,3 +6,4 @@ CONFIG_ARM_MPU=n CONFIG_ARM_AARCH32_MMU=n CONFIG_RISCV_PMP=n +CONFIG_ARC_MPU_ENABLE=n diff --git a/tests/subsys/llext/simple/testcase.yaml b/tests/subsys/llext/simple/testcase.yaml index 901bd3d06ad6f..db84e7a129af6 100644 --- a/tests/subsys/llext/simple/testcase.yaml +++ b/tests/subsys/llext/simple/testcase.yaml @@ -6,11 +6,6 @@ common: - s32z2xxdc2/s32z270/rtu0 # See commit 18a0660 - s32z2xxdc2/s32z270/rtu1 # See commit 18a0660 # platforms that are always skipped by the runtime filter - - qemu_arc/qemu_arc_em - - qemu_arc/qemu_arc_hs - - qemu_arc/qemu_arc_hs/xip - - qemu_arc/qemu_arc_hs5x - - qemu_arc/qemu_arc_hs6x - qemu_cortex_m0 - qemu_xtensa/dc233c/mmu integration_platforms: @@ -36,7 +31,7 @@ tests: # most tests include no_mem_protection.conf, which disables memory protection # hardware completely. llext.simple.readonly: - arch_allow: arm riscv # Xtensa needs writable storage + arch_allow: arm riscv arc # Xtensa needs writable storage filter: not CONFIG_MPU and not CONFIG_MMU extra_conf_files: ['no_mem_protection.conf'] extra_configs: @@ -57,7 +52,7 @@ tests: - CONFIG_LLEXT_HEAP_SIZE=128 # qemu_cortex_a9 requires larger heap - CONFIG_LLEXT_STORAGE_WRITABLE=n llext.simple.writable: - arch_allow: arm xtensa riscv + arch_allow: arm xtensa riscv arc integration_platforms: - qemu_xtensa/dc233c # Xtensa ISA filter: not CONFIG_MPU and not CONFIG_MMU @@ -65,7 +60,9 @@ tests: extra_configs: - CONFIG_LLEXT_STORAGE_WRITABLE=y llext.simple.writable_relocatable: - arch_allow: arm xtensa riscv + arch_allow: arm xtensa riscv arc + platform_exclude: + - qemu_arc/qemu_arc_hs5x # See #80949 integration_platforms: - qemu_xtensa/dc233c # Xtensa ISA filter: not CONFIG_MPU and not CONFIG_MMU @@ -77,7 +74,7 @@ tests: # Test the Symbol Link Identifier (SLID) linking feature on writable # storage to cover both ARM and Xtensa architectures on the same test. llext.simple.writable_slid_linking: - arch_allow: arm xtensa riscv + arch_allow: arm xtensa riscv arc integration_platforms: - qemu_xtensa/dc233c # Xtensa ISA filter: not CONFIG_MPU and not CONFIG_MMU @@ -86,7 +83,9 @@ tests: - CONFIG_LLEXT_STORAGE_WRITABLE=y - CONFIG_LLEXT_EXPORT_BUILTINS_BY_SLID=y llext.simple.writable_relocatable_slid_linking: - arch_allow: arm xtensa riscv + arch_allow: arm xtensa riscv arc + platform_exclude: + - qemu_arc/qemu_arc_hs5x # See #80949 integration_platforms: - qemu_xtensa/dc233c # Xtensa ISA filter: not CONFIG_MPU and not CONFIG_MMU From fa3bfa545328257c5c6319390f5cae9ea08d1789 Mon Sep 17 00:00:00 2001 From: Troels Nilsson Date: Tue, 10 Sep 2024 16:06:09 +0200 Subject: [PATCH 2573/4482] Bluetooth: Controller: Add margin to ISOALs time offset To ensure payloads are delivered in time for the first subevent in framed BIS, ISOAL now enforces a (configurable) margin of the calculated time offset Without this margin, it has been observed that a broadcaster can end up consistently missing the first subevent in every third event in a 7.5 ms ISO with a 10 ms SDU interval The margin is a conservative 2 ms by default, but can likely be set a lot lower for most implementations and HWs Signed-off-by: Troels Nilsson --- .../bluetooth/controller/Kconfig.ll_sw_split | 19 +++++++++++++++++++ subsys/bluetooth/controller/ll_sw/isoal.c | 10 +++++++--- subsys/bluetooth/controller/ll_sw/isoal.h | 3 ++- tests/bluetooth/controller/ctrl_isoal/Kconfig | 19 +++++++++++++++++++ 4 files changed, 47 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/controller/Kconfig.ll_sw_split b/subsys/bluetooth/controller/Kconfig.ll_sw_split index 90d5413a05be6..9399545b42ce9 100644 --- a/subsys/bluetooth/controller/Kconfig.ll_sw_split +++ b/subsys/bluetooth/controller/Kconfig.ll_sw_split @@ -616,6 +616,25 @@ config BT_CTLR_ISOAL_PSN_IGNORE help Ignore the use of Tx ISO Data Packet Sequence Number. +config BT_CTLR_ISOAL_FRAMED_BIS_OFFSET_MARGIN + int "Margin (in microseconds) to be used in framed time offset for BIS" + depends on BT_CTLR_ADV_ISO || BT_CTLR_CONN_ISO + default 2000 + range 0 10000 + help + Needed margin for reliable delivery of payloads will vary, but should + generally be EVENT_OVERHEAD_START_US + a small margin to cover ISOAL + processing overhead + +config BT_CTLR_ISOAL_FRAMED_CIS_OFFSET_MARGIN + int "Margin (in microseconds) to be used in framed time offset for CIS" + depends on BT_CTLR_ADV_ISO || BT_CTLR_CONN_ISO + default 0 + range 0 10000 + help + Note: Usually no margin is needed for CIS as null PDUs can be used if a payload + is too late for the first subevent + config BT_CTLR_ZLI bool "Use Zero Latency IRQs" depends on ZERO_LATENCY_IRQS diff --git a/subsys/bluetooth/controller/ll_sw/isoal.c b/subsys/bluetooth/controller/ll_sw/isoal.c index 0d8c31f0538a4..c71053cb34aa8 100644 --- a/subsys/bluetooth/controller/ll_sw/isoal.c +++ b/subsys/bluetooth/controller/ll_sw/isoal.c @@ -1519,7 +1519,7 @@ static isoal_status_t isoal_check_source_hdl_valid(isoal_source_handle_t hdl) * @param pdu_release[in] Callback of PDU deallocator * @param hdl[out] Handle to new source * - * @return ISOAL_STATUS_OK if we could create a new sink; otherwise ISOAL_STATUS_ERR_SOURCE_ALLOC + * @return ISOAL_STATUS_OK if we could create a new source; otherwise ISOAL_STATUS_ERR_SOURCE_ALLOC */ isoal_status_t isoal_source_create( uint16_t handle, @@ -1550,6 +1550,7 @@ isoal_status_t isoal_source_create( session->handle = handle; session->framed = framed; + session->bis = role == ISOAL_ROLE_BROADCAST_SOURCE; session->burst_number = burst_number; session->iso_interval = iso_interval; session->sdu_interval = sdu_interval; @@ -2343,6 +2344,9 @@ static uint16_t isoal_tx_framed_find_correct_tx_event(const struct isoal_source const bool time_stamp_is_valid = isoal_is_time_stamp_valid(source_ctx, tx_sdu->cntr_time_stamp, tx_sdu->time_stamp); + const uint16_t offset_margin = session->bis ? + CONFIG_BT_CTLR_ISOAL_FRAMED_BIS_OFFSET_MARGIN : + CONFIG_BT_CTLR_ISOAL_FRAMED_CIS_OFFSET_MARGIN; /* Adjust payload number */ if (pp->initialized) { @@ -2437,7 +2441,7 @@ static uint16_t isoal_tx_framed_find_correct_tx_event(const struct isoal_source * The Time_Offset shall be a positive value. */ while (!isoal_get_time_diff(time_stamp_selected, actual_grp_ref_point, &time_diff) - || time_diff == 0) { + || time_diff <= offset_margin) { /* Advance target to next event */ actual_event++; actual_grp_ref_point = isoal_get_wrapped_time_us(actual_grp_ref_point, @@ -2525,7 +2529,7 @@ static isoal_status_t isoal_tx_framed_produce(isoal_source_handle_t source_hdl, uint64_t next_payload_number; uint16_t sdus_skipped; bool time_diff_valid; - uint32_t time_diff; + uint32_t time_diff = 0U; /* Start of a new SDU */ time_diff_valid = isoal_get_time_diff(session->last_input_time_stamp, diff --git a/subsys/bluetooth/controller/ll_sw/isoal.h b/subsys/bluetooth/controller/ll_sw/isoal.h index 0e50bea63be17..f57cdd121c157 100644 --- a/subsys/bluetooth/controller/ll_sw/isoal.h +++ b/subsys/bluetooth/controller/ll_sw/isoal.h @@ -376,7 +376,8 @@ struct isoal_source_session { uint32_t sdu_interval; uint16_t handle; uint16_t iso_interval; - uint8_t framed; + uint8_t framed: 1; + uint8_t bis: 1; uint8_t burst_number; uint8_t pdus_per_sdu; uint8_t max_pdu_size; diff --git a/tests/bluetooth/controller/ctrl_isoal/Kconfig b/tests/bluetooth/controller/ctrl_isoal/Kconfig index 0ebff8c230c6b..ecd7501f1ad09 100644 --- a/tests/bluetooth/controller/ctrl_isoal/Kconfig +++ b/tests/bluetooth/controller/ctrl_isoal/Kconfig @@ -57,6 +57,25 @@ config BT_CTLR_ISOAL_SN_STRICT depends on BT_CTLR_ADV_ISO || BT_CTLR_CONN_ISO default y +config BT_CTLR_ISOAL_FRAMED_BIS_OFFSET_MARGIN + int "Margin (in microseconds) to be used in framed time offset for BIS" + depends on BT_CTLR_ADV_ISO || BT_CTLR_CONN_ISO + default 2000 + range 0 10000 + help + Needed margin for reliable delivery of payloads will vary, but should + generally be EVENT_OVERHEAD_START_US + a small margin to cover ISOAL + processing overhead + +config BT_CTLR_ISOAL_FRAMED_CIS_OFFSET_MARGIN + int "Margin (in microseconds) to be used in framed time offset for CIS" + depends on BT_CTLR_ADV_ISO || BT_CTLR_CONN_ISO + default 0 + range 0 10000 + help + Note: Usually no margin is needed for CIS as Null PDUs can be used if a payload + is too late for the first subevent + source "tests/bluetooth/controller/common/Kconfig" source "Kconfig.zephyr" From 242498e6be686adc13c75bdf0a8cf03f57f79d27 Mon Sep 17 00:00:00 2001 From: Damian Krolik Date: Mon, 21 Oct 2024 10:34:55 +0200 Subject: [PATCH 2574/4482] net: openthread: add capability IEEE802154_OPENTHREAD_HW_CST MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The new capability `IEEE802154_OPENTHREAD_HW_CST` is added. The option MAY be implemented as an extension to IEEE 802.15.4 drivers allowing to inject CST related Information Elements. Signed-off-by: Damian Krolik Co-authored-by: Andrzej Kuroś --- .../zephyr/net/ieee802154_radio_openthread.h | 64 ++++++++++++++++++- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/include/zephyr/net/ieee802154_radio_openthread.h b/include/zephyr/net/ieee802154_radio_openthread.h index 3606c7a2b78be..0890d1009e56c 100644 --- a/include/zephyr/net/ieee802154_radio_openthread.h +++ b/include/zephyr/net/ieee802154_radio_openthread.h @@ -14,6 +14,9 @@ #include +/** Bit number starting the OpenThread specific capabilities of ieee802154 driver. */ +#define IEEE802154_OPENTHREAD_HW_CAPS_BITS_START IEEE802154_HW_CAPS_BITS_PRIV_START + /** * OpenThread specific capabilities of ieee802154 driver. * This type extends @ref ieee802154_hw_caps. @@ -22,7 +25,26 @@ enum ieee802154_openthread_hw_caps { /** Capability to transmit with @ref IEEE802154_OPENTHREAD_TX_MODE_TXTIME_MULTIPLE_CCA * mode. */ - IEEE802154_OPENTHREAD_HW_MULTIPLE_CCA = BIT(IEEE802154_HW_CAPS_BITS_PRIV_START), + IEEE802154_OPENTHREAD_HW_MULTIPLE_CCA = BIT(IEEE802154_OPENTHREAD_HW_CAPS_BITS_START), + + /** Capability to support CST-related features. + * + * The CST-related features are described by "Specification changes for Thread-in-Mobile" + * Draft version 1, July 11, 2024. The CST allows to transmit a frame with CST Phase and + * CST Period IEs as described by chapter 4.6.6.1 of the Thread-in-Mobile specification + * change. The upper layer implementation (OpenThread) is responsible for preparing + * a frame to be transmitted that contains placeholders where the CST Phase and CST Period + * are to be placed. The implementation of a driver is responsible for injecting + * correct value for CST Phase IE and CST Period IE based on configuration parameters + * @ref IEEE802154_OPENTHREAD_CONFIG_CST_PERIOD and + * @ref IEEE802154_OPENTHREAD_CONFIG_EXPECTED_TX_TIME. + * + * @note The CST transmission in its design is very similar to CSL reception. + * In the CSL reception the receiver side informs its peer about the moment in time + * when it will be able to receive. In the CST transmission the transmitter side informs + * its peer about the moment in time when the next transmission will occur. + */ + IEEE802154_OPENTHREAD_HW_CST = BIT(IEEE802154_OPENTHREAD_HW_CAPS_BITS_START + 1), }; /** @brief TX mode */ @@ -80,7 +102,33 @@ enum ieee802154_openthread_config_type { * @ref IEEE802154_OPENTHREAD_TX_MODE_TXTIME_MULTIPLE_CCA. * Requires IEEE802154_OPENTHREAD_HW_MULTIPLE_CCA capability. */ - IEEE802154_OPENTHREAD_CONFIG_MAX_EXTRA_CCA_ATTEMPTS = IEEE802154_CONFIG_PRIV_START + IEEE802154_OPENTHREAD_CONFIG_MAX_EXTRA_CCA_ATTEMPTS = IEEE802154_CONFIG_PRIV_START, + + /** Configures the CST period of a device. + * + * When a frame containing CST Period IE is about to be transmitted by a driver, + * the driver SHALL inject the CST Period value to the CST Period IE based on + * the value of this configuration parameter. + * + * Requires IEEE802154_OPENTHREAD_HW_CST capability. + */ + IEEE802154_OPENTHREAD_CONFIG_CST_PERIOD, + + /** Configure a point in time at which a TX frame is expected to be transmitted. + * + * When a frame containing CST Phase IE is about to be transmitted by a driver, + * the driver SHALL inject the CST Phase IE value to the CST Phase IE based on + * the value of this configuration parameter parameter, the time of transmission + * and the CST Period value. + * + * This parameter configures the nanosecond resolution timepoint relative to + * the network subsystem's local clock at which a TX frame's end of SFD + * (i.e. equivalently its end of SHR, start of PHR) is expected to be transmitted + * at the local antenna. + * + * Requires IEEE802154_OPENTHREAD_HW_CST capability. + */ + IEEE802154_OPENTHREAD_CONFIG_EXPECTED_TX_TIME, }; /** @@ -106,6 +154,18 @@ struct ieee802154_openthread_config { * requested with mode @ref IEEE802154_OPENTHREAD_TX_MODE_TXTIME_MULTIPLE_CCA. */ uint8_t max_extra_cca_attempts; + + /** ``IEEE802154_OPENTHREAD_CONFIG_CST_PERIOD`` + * + * The CST period (in CPU byte order). + */ + uint32_t cst_period; + + /** ``IEEE802154_OPENTHREAD_CONFIG_EXPECTED_TX_TIME`` + * + * A point in time at which a TX frame is expected to be transmitted. + */ + net_time_t expected_tx_time; }; }; From c9dbce36c07c487c2e66a4e08390eda15b1563e4 Mon Sep 17 00:00:00 2001 From: Damian Krolik Date: Mon, 21 Oct 2024 10:41:35 +0200 Subject: [PATCH 2575/4482] drivers: ieee802154_nrf5: cabability IEE802154_OPENTHREAD_HW_CST MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The new Kconfig option `IEEE802154_NRF5_CST_ENDPOINT` is added. When it is enabled, then capability `IEE802154_OPENTHREAD_HW_CST` is supported by the ieee802154_nrf5 driver and allows to set the CST period and CST expected transmission time point. This feature is an OpenThread-specific extention to the ieee802154_nrf5 driver. Signed-off-by: Damian Krolik Co-authored-by: Andrzej Kuroś --- drivers/ieee802154/Kconfig.nrf5 | 8 ++++++++ drivers/ieee802154/ieee802154_nrf5.c | 14 ++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/drivers/ieee802154/Kconfig.nrf5 b/drivers/ieee802154/Kconfig.nrf5 index 0a3b350309334..1705ccd420395 100644 --- a/drivers/ieee802154/Kconfig.nrf5 +++ b/drivers/ieee802154/Kconfig.nrf5 @@ -94,4 +94,12 @@ config IEEE802154_NRF5_MULTIPLE_CCA When this option is enabled the OpenThread capability IEEE802154_OPENTHREAD_HW_MULTIPLE_CCA is supported by the ieee802154_nrf5. +config IEEE802154_NRF5_CST_ENDPOINT + bool "Support for OpenThread CST Endpoint extension in the ieee802154_nrf5." + help + Enable support for OpenThread CST (Coordinated Sampled Transmitter) Endpoint + with CST IE injection as an extension to ieee802154_nrf5 driver. + When this option is enabled, the ieee802154_nrf5 driver supports the + IEEE802154_OPENTHREAD_HW_CST capability. + endif diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 19df76c7d0786..e9a0433d3b591 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -258,6 +258,9 @@ static void nrf5_get_capabilities_at_boot(void) #endif #if defined(CONFIG_IEEE802154_SELECTIVE_TXCHANNEL) | IEEE802154_HW_SELECTIVE_TXCHANNEL +#endif +#if defined(CONFIG_IEEE802154_NRF5_CST_ENDPOINT) + | IEEE802154_OPENTHREAD_HW_CST #endif ; } @@ -1028,6 +1031,17 @@ static int nrf5_configure(const struct device *dev, } break; +#if defined(CONFIG_IEEE802154_NRF5_CST_ENDPOINT) + case IEEE802154_OPENTHREAD_CONFIG_CST_PERIOD: + nrf_802154_cst_writer_period_set(config->cst_period); + break; + + case IEEE802154_OPENTHREAD_CONFIG_EXPECTED_TX_TIME: + nrf_802154_cst_writer_anchor_time_set(nrf_802154_timestamp_phr_to_mhr_convert( + config->expected_tx_time / NSEC_PER_USEC)); + break; +#endif /* CONFIG_IEEE802154_NRF5_CST_ENDPOINT */ + default: return -EINVAL; } From 8ce12aaa046cf89e534ab32d07eca1e19ed1b9ad Mon Sep 17 00:00:00 2001 From: Damian Krolik Date: Mon, 21 Oct 2024 12:01:56 +0200 Subject: [PATCH 2576/4482] net: openthread: add wake-up coordinator support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Kconfig option `OPENTHREAD_WAKEUP_COORDINATOR` to enable the Wake-up Coordinator role. Implement API to set Coordinated Sampled Transmitting sample time and period for a driver that supports `IEE802154_OPENTHREAD_HW_CST` capability. The feature is be enabled on with ieee802154_nrf5 driver with option by setting default value of CONFIG_IEEE802154_NRF5_CST_ENDPOINT. Signed-off-by: Damian Krolik Co-authored-by: Andrzej Kuroś --- drivers/ieee802154/Kconfig.nrf5 | 1 + modules/openthread/CMakeLists.txt | 1 + modules/openthread/Kconfig.features | 4 ++ modules/openthread/platform/radio.c | 59 +++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+) diff --git a/drivers/ieee802154/Kconfig.nrf5 b/drivers/ieee802154/Kconfig.nrf5 index 1705ccd420395..bf4bcd1be8cf4 100644 --- a/drivers/ieee802154/Kconfig.nrf5 +++ b/drivers/ieee802154/Kconfig.nrf5 @@ -96,6 +96,7 @@ config IEEE802154_NRF5_MULTIPLE_CCA config IEEE802154_NRF5_CST_ENDPOINT bool "Support for OpenThread CST Endpoint extension in the ieee802154_nrf5." + default y if OPENTHREAD_WAKEUP_COORDINATOR help Enable support for OpenThread CST (Coordinated Sampled Transmitter) Endpoint with CST IE injection as an extension to ieee802154_nrf5 driver. diff --git a/modules/openthread/CMakeLists.txt b/modules/openthread/CMakeLists.txt index 977b7e5921f1e..b0dfd8baf18a6 100644 --- a/modules/openthread/CMakeLists.txt +++ b/modules/openthread/CMakeLists.txt @@ -128,6 +128,7 @@ kconfig_to_ot_option(CONFIG_OPENTHREAD_TX_QUEUE_STATISTICS OT_TX_QUEUE_STATS "En kconfig_to_ot_option(CONFIG_OPENTHREAD_UDP_FORWARD OT_UDP_FORWARD "Enable UDP forward feature") kconfig_to_ot_option(CONFIG_OPENTHREAD_UPTIME OT_UPTIME "Enable support for tracking OpenThread instance's uptime") kconfig_to_ot_option(CONFIG_OPENTHREAD_VERHOEFF_CHECKSUM OT_VERHOEFF_CHECKSUM "Verhoeff checksum") +kconfig_to_ot_option(CONFIG_OPENTHREAD_WAKEUP_COORDINATOR OT_WAKEUP_COORDINATOR "Enable Wake-up Coordinator role") if(CONFIG_OPENTHREAD_COPROCESSOR_VENDOR_HOOK_SOURCE) set(OT_NCP_VENDOR_HOOK_SOURCE ${CONFIG_OPENTHREAD_COPROCESSOR_VENDOR_HOOK_SOURCE} CACHE STRING "NCP vendor hook source file name" FORCE) diff --git a/modules/openthread/Kconfig.features b/modules/openthread/Kconfig.features index f4cbfb3551a2a..44cd3cc7adaf9 100644 --- a/modules/openthread/Kconfig.features +++ b/modules/openthread/Kconfig.features @@ -128,6 +128,10 @@ config OPENTHREAD_DEVICE_PROP_LEADER_WEIGHT config OPENTHREAD_DATASET_UPDATER bool "Dataset updater" +config OPENTHREAD_WAKEUP_COORDINATOR + bool "Wake-up Coordinator support" + select OPENTHREAD_CSL_RECEIVER + config OPENTHREAD_DHCP6_CLIENT bool "DHCPv6 client support" diff --git a/modules/openthread/platform/radio.c b/modules/openthread/platform/radio.c index 70b17e7708e40..34725f70dbac8 100644 --- a/modules/openthread/platform/radio.c +++ b/modules/openthread/platform/radio.c @@ -1396,6 +1396,65 @@ void otPlatRadioUpdateCslSampleTime(otInstance *aInstance, uint32_t aCslSampleTi } #endif /* CONFIG_OPENTHREAD_CSL_RECEIVER */ +#if defined(CONFIG_OPENTHREAD_WAKEUP_COORDINATOR) +otError otPlatRadioEnableCst(otInstance *aInstance, uint32_t aCstPeriod, otShortAddress aShortAddr, + const otExtAddress *aExtAddr) +{ + struct ieee802154_config config; + int result; + uint8_t header_ie[OT_IE_HEADER_SIZE + OT_THREAD_IE_SIZE + OT_CST_IE_SIZE] = { 0 }; + size_t index = 0; + + ARG_UNUSED(aInstance); + + /* Configure the CST period first to give drivers a chance to validate + * the IE for consistency if they wish to. + */ + config.cst_period = aCstPeriod; + result = radio_api->configure(radio_dev, IEEE802154_OPENTHREAD_CONFIG_CST_PERIOD, &config); + if (result) { + return OT_ERROR_FAILED; + } + + /* Configure the CST IE. */ + header_ie[index++] = OT_THREAD_IE_SIZE + OT_CST_IE_SIZE; + header_ie[index++] = 0; + sys_put_le24(THREAD_IE_VENDOR_OUI, &header_ie[index]); + index += 3; + header_ie[index++] = THREAD_IE_SUBTYPE_CST; + /* Leave CST Phase empty intentionally */ + index += 2; + sys_put_le16(aCstPeriod, &header_ie[index]); + index += 2; + + config.ack_ie.header_ie = aCstPeriod > 0 ? (struct ieee802154_header_ie *)header_ie : NULL; + config.ack_ie.short_addr = aShortAddr; + config.ack_ie.ext_addr = aExtAddr != NULL ? aExtAddr->m8 : NULL; + config.ack_ie.purge_ie = false; + + result = radio_api->configure(radio_dev, IEEE802154_CONFIG_ENH_ACK_HEADER_IE, &config); + + return result ? OT_ERROR_FAILED : OT_ERROR_NONE; +} + +void otPlatRadioUpdateCstSampleTime(otInstance *aInstance, uint32_t aCstSampleTime) +{ + int result; + + ARG_UNUSED(aInstance); + + struct ieee802154_config config = { + .expected_tx_time = convert_32bit_us_wrapped_to_64bit_ns( + aCstSampleTime - PHR_DURATION_US), + }; + + result = radio_api->configure(radio_dev, IEEE802154_OPENTHREAD_CONFIG_EXPECTED_TX_TIME, + &config); + __ASSERT_NO_MSG(result == 0); + (void)result; +} +#endif /* CONFIG_OPENTHREAD_WAKEUP_COORDINATOR */ + uint8_t otPlatRadioGetCslAccuracy(otInstance *aInstance) { ARG_UNUSED(aInstance); From de9519127bdaef92197839e4bec3618b5f02c6f4 Mon Sep 17 00:00:00 2001 From: Damian Krolik Date: Mon, 21 Oct 2024 12:10:54 +0200 Subject: [PATCH 2577/4482] net: openthread: add wake-up end device support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Kconfig option to enable the Wake-up End Device role. Signed-off-by: Eduardo Montoya Signed-off-by: Damian Krolik Co-authored-by: Andrzej Kuroś --- modules/openthread/CMakeLists.txt | 1 + modules/openthread/Kconfig.features | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/modules/openthread/CMakeLists.txt b/modules/openthread/CMakeLists.txt index b0dfd8baf18a6..3900521ad8502 100644 --- a/modules/openthread/CMakeLists.txt +++ b/modules/openthread/CMakeLists.txt @@ -129,6 +129,7 @@ kconfig_to_ot_option(CONFIG_OPENTHREAD_UDP_FORWARD OT_UDP_FORWARD "Enable UDP fo kconfig_to_ot_option(CONFIG_OPENTHREAD_UPTIME OT_UPTIME "Enable support for tracking OpenThread instance's uptime") kconfig_to_ot_option(CONFIG_OPENTHREAD_VERHOEFF_CHECKSUM OT_VERHOEFF_CHECKSUM "Verhoeff checksum") kconfig_to_ot_option(CONFIG_OPENTHREAD_WAKEUP_COORDINATOR OT_WAKEUP_COORDINATOR "Enable Wake-up Coordinator role") +kconfig_to_ot_option(CONFIG_OPENTHREAD_WAKEUP_END_DEVICE OT_WAKEUP_END_DEVICE "Enable Wake-up End Device role") if(CONFIG_OPENTHREAD_COPROCESSOR_VENDOR_HOOK_SOURCE) set(OT_NCP_VENDOR_HOOK_SOURCE ${CONFIG_OPENTHREAD_COPROCESSOR_VENDOR_HOOK_SOURCE} CACHE STRING "NCP vendor hook source file name" FORCE) diff --git a/modules/openthread/Kconfig.features b/modules/openthread/Kconfig.features index 44cd3cc7adaf9..17031467b7c55 100644 --- a/modules/openthread/Kconfig.features +++ b/modules/openthread/Kconfig.features @@ -132,6 +132,10 @@ config OPENTHREAD_WAKEUP_COORDINATOR bool "Wake-up Coordinator support" select OPENTHREAD_CSL_RECEIVER +config OPENTHREAD_WAKEUP_END_DEVICE + bool "Wake-up End Device support" + imply OPENTHREAD_CSL_RECEIVER + config OPENTHREAD_DHCP6_CLIENT bool "DHCPv6 client support" From 11b6bd0ab1a2a455c1b47df47e12becfd4170e5a Mon Sep 17 00:00:00 2001 From: Damian Krolik Date: Tue, 4 Apr 2023 13:50:32 +0200 Subject: [PATCH 2578/4482] net: openthread: support Wake-up End Device without CSL receiver Make it possible to enable Wake-up End Device feature with CSL receiver disabled (to receive wake-up frames on MED). Signed-off-by: Damian Krolik --- modules/openthread/platform/openthread-core-zephyr-config.h | 5 +++-- modules/openthread/platform/radio.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/openthread/platform/openthread-core-zephyr-config.h b/modules/openthread/platform/openthread-core-zephyr-config.h index f4f414fa96bf8..901e08cf84156 100644 --- a/modules/openthread/platform/openthread-core-zephyr-config.h +++ b/modules/openthread/platform/openthread-core-zephyr-config.h @@ -211,8 +211,9 @@ * */ #define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE \ - (CONFIG_OPENTHREAD_CSL_RECEIVER && \ - (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)) + ((CONFIG_OPENTHREAD_CSL_RECEIVER && \ + (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)) || \ + CONFIG_OPENTHREAD_WAKEUP_END_DEVICE) /* Zephyr does not use OpenThread's heap. mbedTLS will use heap memory allocated * by Zephyr. Here, we use some dummy values to prevent OpenThread warnings. diff --git a/modules/openthread/platform/radio.c b/modules/openthread/platform/radio.c index 34725f70dbac8..72f25eedc1d72 100644 --- a/modules/openthread/platform/radio.c +++ b/modules/openthread/platform/radio.c @@ -802,7 +802,7 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) return OT_ERROR_NONE; } -#if defined(CONFIG_OPENTHREAD_CSL_RECEIVER) +#if defined(CONFIG_OPENTHREAD_CSL_RECEIVER) || defined(CONFIG_OPENTHREAD_WAKEUP_END_DEVICE) otError otPlatRadioReceiveAt(otInstance *aInstance, uint8_t aChannel, uint32_t aStart, uint32_t aDuration) { From 5cb8d6c5b4f960d27233c25244aca4f2b47a25ec Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Mon, 21 Oct 2024 17:22:37 +0200 Subject: [PATCH 2579/4482] boards: nordic: Remove v0.8.0 of the nRF54H20 DK The nRF54H20 Development Kit version 0.8.0 is no longer supported, given that they should have all been replaced by 0.9.x. Signed-off-by: Carles Cufi --- boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk | 14 ++++------- boards/nordic/nrf54h20dk/board.yml | 1 - .../nrf54h20dk/nrf54h20dk_nrf54h20_0_8_0.dtsi | 15 ------------ .../nrf54h20dk_nrf54h20_cpuapp_0_8_0.overlay | 7 ------ .../nrf54h20dk_nrf54h20_cpuapp_0_8_0.yaml | 24 ------------------- .../nrf54h20dk_nrf54h20_cpuflpr_0_8_0.overlay | 7 ------ .../nrf54h20dk_nrf54h20_cpuflpr_0_8_0.yaml | 18 -------------- ...nrf54h20dk_nrf54h20_cpuflpr_xip_0_8_0.yaml | 14 ----------- .../nrf54h20dk_nrf54h20_cpuppr_0_8_0.overlay | 7 ------ .../nrf54h20dk_nrf54h20_cpuppr_0_8_0.yaml | 18 -------------- .../nrf54h20dk_nrf54h20_cpuppr_xip_0_8_0.yaml | 14 ----------- .../nrf54h20dk_nrf54h20_cpurad_0_8_0.overlay | 7 ------ .../nrf54h20dk_nrf54h20_cpurad_0_8_0.yaml | 19 --------------- 13 files changed, 4 insertions(+), 161 deletions(-) delete mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_0_8_0.dtsi delete mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_8_0.overlay delete mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_8_0.yaml delete mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_8_0.overlay delete mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_8_0.yaml delete mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_xip_0_8_0.yaml delete mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_8_0.overlay delete mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_8_0.yaml delete mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_xip_0_8_0.yaml delete mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_8_0.overlay delete mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_8_0.yaml diff --git a/boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk b/boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk index af29072fbd5ff..62ad7a0d21c19 100644 --- a/boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk +++ b/boards/nordic/nrf54h20dk/Kconfig.nrf54h20dk @@ -2,15 +2,9 @@ # SPDX-License-Identifier: Apache-2.0 config BOARD_NRF54H20DK - select SOC_NRF54H20_ENGB_CPUAPP if BOARD_NRF54H20DK_NRF54H20_CPUAPP && BOARD_REVISION = "0.8.0" - select SOC_NRF54H20_ENGB_CPURAD if BOARD_NRF54H20DK_NRF54H20_CPURAD && BOARD_REVISION = "0.8.0" - select SOC_NRF54H20_ENGB_CPUPPR if (BOARD_NRF54H20DK_NRF54H20_CPUPPR || \ - BOARD_NRF54H20DK_NRF54H20_CPUPPR_XIP) && BOARD_REVISION = "0.8.0" - select SOC_NRF54H20_ENGB_CPUFLPR if (BOARD_NRF54H20DK_NRF54H20_CPUFLPR || \ - BOARD_NRF54H20DK_NRF54H20_CPUFLPR_XIP) && BOARD_REVISION = "0.8.0" - select SOC_NRF54H20_CPUAPP if BOARD_NRF54H20DK_NRF54H20_CPUAPP && BOARD_REVISION = "0.9.0" - select SOC_NRF54H20_CPURAD if BOARD_NRF54H20DK_NRF54H20_CPURAD && BOARD_REVISION = "0.9.0" + select SOC_NRF54H20_CPUAPP if BOARD_NRF54H20DK_NRF54H20_CPUAPP + select SOC_NRF54H20_CPURAD if BOARD_NRF54H20DK_NRF54H20_CPURAD select SOC_NRF54H20_CPUPPR if (BOARD_NRF54H20DK_NRF54H20_CPUPPR || \ - BOARD_NRF54H20DK_NRF54H20_CPUPPR_XIP) && BOARD_REVISION = "0.9.0" + BOARD_NRF54H20DK_NRF54H20_CPUPPR_XIP) select SOC_NRF54H20_CPUFLPR if (BOARD_NRF54H20DK_NRF54H20_CPUFLPR || \ - BOARD_NRF54H20DK_NRF54H20_CPUFLPR_XIP) && BOARD_REVISION = "0.9.0" + BOARD_NRF54H20DK_NRF54H20_CPUFLPR_XIP) diff --git a/boards/nordic/nrf54h20dk/board.yml b/boards/nordic/nrf54h20dk/board.yml index 82a738d8b0310..2d3d40c20e0bb 100644 --- a/boards/nordic/nrf54h20dk/board.yml +++ b/boards/nordic/nrf54h20dk/board.yml @@ -13,5 +13,4 @@ board: format: major.minor.patch default: "0.9.0" revisions: - - name: "0.8.0" - name: "0.9.0" diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_0_8_0.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_0_8_0.dtsi deleted file mode 100644 index 940ac4d239167..0000000000000 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_0_8_0.dtsi +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/delete-node/ &suit_storage_partition; - -/ { - reserved-memory { - suit_storage_partition: memory@e1eb000 { - reg = <0xe1eb000 DT_SIZE_K(24)>; - }; - }; -}; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_8_0.overlay b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_8_0.overlay deleted file mode 100644 index dfee18c5b6f00..0000000000000 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_8_0.overlay +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf54h20dk_nrf54h20_0_8_0.dtsi" diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_8_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_8_0.yaml deleted file mode 100644 index 01c44b515777c..0000000000000 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_8_0.yaml +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54h20dk@0.8.0/nrf54h20/cpuapp -name: nRF54H20-DK-nRF54H20-Application (revision 0.8.0) -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -sysbuild: true -ram: 256 -flash: 296 -supported: - - adc - - can - - counter - - gpio - - i2c - - pwm - - spi - - watchdog - - usbd diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_8_0.overlay b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_8_0.overlay deleted file mode 100644 index dfee18c5b6f00..0000000000000 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_8_0.overlay +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf54h20dk_nrf54h20_0_8_0.dtsi" diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_8_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_8_0.yaml deleted file mode 100644 index bd60b8d2af34b..0000000000000 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_8_0.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54h20dk@0.8.0/nrf54h20/cpuflpr -name: nRF54H20-DK-nRF54H20-FLPR (revision 0.8.0) -type: mcu -arch: riscv -toolchain: - - zephyr -sysbuild: true -ram: 46 -flash: 46 -supported: - - counter - - gpio - - i2c - - pwm - - spi diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_xip_0_8_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_xip_0_8_0.yaml deleted file mode 100644 index 7deaf20135fd8..0000000000000 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_xip_0_8_0.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54h20dk@0.8.0/nrf54h20/cpuflpr/xip -name: nRF54H20-DK-nRF54H20-FLPR (MRAM XIP) (revision 0.8.0) -type: mcu -arch: riscv -toolchain: - - zephyr -sysbuild: true -ram: 46 -flash: 48 -supported: - - gpio diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_8_0.overlay b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_8_0.overlay deleted file mode 100644 index dfee18c5b6f00..0000000000000 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_8_0.overlay +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf54h20dk_nrf54h20_0_8_0.dtsi" diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_8_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_8_0.yaml deleted file mode 100644 index 264126570702c..0000000000000 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_8_0.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54h20dk@0.8.0/nrf54h20/cpuppr -name: nRF54H20-DK-nRF54H20-PPR (revision 0.8.0) -type: mcu -arch: riscv -toolchain: - - zephyr -sysbuild: true -ram: 62 -flash: 62 -supported: - - counter - - gpio - - i2c - - pwm - - spi diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_xip_0_8_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_xip_0_8_0.yaml deleted file mode 100644 index 0ce1718cb60cb..0000000000000 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_xip_0_8_0.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54h20dk@0.8.0/nrf54h20/cpuppr/xip -name: nRF54H20-DK-nRF54H20-PPR (MRAM XIP) (revision 0.8.0) -type: mcu -arch: riscv -toolchain: - - zephyr -sysbuild: true -ram: 62 -flash: 64 -supported: - - gpio diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_8_0.overlay b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_8_0.overlay deleted file mode 100644 index dfee18c5b6f00..0000000000000 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_8_0.overlay +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "nrf54h20dk_nrf54h20_0_8_0.dtsi" diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_8_0.yaml b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_8_0.yaml deleted file mode 100644 index 26df539a80376..0000000000000 --- a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_8_0.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -identifier: nrf54h20dk@0.8.0/nrf54h20/cpurad -name: nRF54H20-DK-nRF54H20-Radio (revision 0.8.0) -type: mcu -arch: arm -toolchain: - - gnuarmemb - - xtools - - zephyr -sysbuild: true -ram: 192 -flash: 256 -supported: - - counter - - gpio - - pwm - - spi From 9643ca20e9bc8df28c02aac923c3a794bbef6f5f Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Mon, 21 Oct 2024 17:13:13 +0200 Subject: [PATCH 2580/4482] nordic: Remove the nRF54H20 Engineering B The production version of the nRF54H20 SoC is now available, so remove the initial Engineering B (EngB) preview version. Signed-off-by: Carles Cufi --- drivers/cache/Kconfig.nrf | 2 +- modules/hal_nordic/Kconfig | 2 +- modules/hal_nordic/nrfs/Kconfig | 4 +-- modules/hal_nordic/nrfx/CMakeLists.txt | 12 ------- modules/hal_nordic/nrfx/nrfx_config.h | 8 ++--- scripts/west_commands/runners/nrf_common.py | 2 -- soc/nordic/common/vpr/Kconfig.sysbuild | 2 +- soc/nordic/nrf54h/Kconfig | 12 ------- .../nrf54h/Kconfig.defconfig.nrf54h20_cpuapp | 4 +-- .../nrf54h/Kconfig.defconfig.nrf54h20_cpuflpr | 4 +-- .../nrf54h/Kconfig.defconfig.nrf54h20_cpuppr | 4 +-- .../nrf54h/Kconfig.defconfig.nrf54h20_cpurad | 4 +-- soc/nordic/nrf54h/Kconfig.soc | 32 +------------------ soc/nordic/nrf54h/gpd/Kconfig | 3 +- soc/nordic/nrf54h/soc.h | 4 +-- subsys/logging/frontends/Kconfig | 3 +- 16 files changed, 21 insertions(+), 81 deletions(-) diff --git a/drivers/cache/Kconfig.nrf b/drivers/cache/Kconfig.nrf index ffcbfe66d1957..c1cfc2c8c582c 100644 --- a/drivers/cache/Kconfig.nrf +++ b/drivers/cache/Kconfig.nrf @@ -10,6 +10,6 @@ config CACHE_NRF_CACHE config CACHE_NRF_PATCH_LINEADDR bool "Patch lineaddr" - default y if SOC_NRF54H20 || SOC_NRF54H20_ENGB + default y if SOC_NRF54H20 help Manually set 28th bit in the LINEADDR in Trustzone Secure build. diff --git a/modules/hal_nordic/Kconfig b/modules/hal_nordic/Kconfig index 9d54c15d71590..dd4e0a0859b1f 100644 --- a/modules/hal_nordic/Kconfig +++ b/modules/hal_nordic/Kconfig @@ -55,7 +55,7 @@ endchoice config NRF_802154_TEMPERATURE_UPDATE bool "nRF 802.15.4 temperature update" - default y if !SOC_NRF54H20 && !SOC_NRF54H20_ENGB + default y if !SOC_NRF54H20 help Enable temperature update for nRF 802.15.4 driver diff --git a/modules/hal_nordic/nrfs/Kconfig b/modules/hal_nordic/nrfs/Kconfig index eafe06167646d..8c5b61bb11f35 100644 --- a/modules/hal_nordic/nrfs/Kconfig +++ b/modules/hal_nordic/nrfs/Kconfig @@ -40,9 +40,7 @@ config NRFS_HAS_VBUS_DETECTOR_SERVICE config NRFS bool "nRF Services Support" select NRFS_LOCAL_DOMAIN if SOC_NRF54H20_CPUAPP || \ - SOC_NRF54H20_ENGB_CPUAPP || \ SOC_NRF54H20_CPURAD || \ - SOC_NRF54H20_ENGB_CPURAD || \ SOC_NRF9280_CPUAPP || \ SOC_NRF9280_CPURAD depends on HAS_NRFS @@ -103,7 +101,7 @@ config NRFS_PMIC_SERVICE_ENABLED config NRFS_DVFS_SERVICE_ENABLED bool "DVFS service" depends on NRFS_HAS_DVFS_SERVICE - default y if SOC_NRF54H20_CPUAPP || SOC_NRF54H20_ENGB_CPUAPP || SOC_NRF9280_CPUAPP + default y if SOC_NRF54H20_CPUAPP || SOC_NRF9280_CPUAPP config NRFS_DIAG_SERVICE_ENABLED bool "System Diagnostics service (only for development purposes)" diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 6abbaa79dbae7..51c613f0104e5 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -44,14 +44,6 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_CPUPPR NRF54H20_XXAA NRF_PPR) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_CPUFLPR NRF54H20_XXAA NRF_FLPR) -zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGB_CPUAPP NRF54H20_ENGB_XXAA - NRF_APPLICATION) -zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGB_CPURAD NRF54H20_ENGB_XXAA - NRF_RADIOCORE) -zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGB_CPUPPR NRF54H20_ENGB_XXAA - NRF_PPR) -zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_ENGB_CPUFLPR NRF54H20_ENGB_XXAA - NRF_FLPR) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L15 NRF54L15_XXAA) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L15_CPUAPP NRF_APPLICATION) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L15_CPUFLPR NRF_FLPR) @@ -226,10 +218,6 @@ mdk_svd_ifdef(CONFIG_SOC_NRF54H20_CPUAPP nrf54h20_application.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54H20_CPUPPR nrf54h20_ppr.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54H20_CPUFLPR nrf54h20_flpr.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54H20_CPURAD nrf54h20_radiocore.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGB_CPUAPP nrf54h20_engb_application.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGB_CPUPPR nrf54h20_engb_ppr.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGB_CPUFLPR nrf54h20_engb_flpr.svd) -mdk_svd_ifdef(CONFIG_SOC_NRF54H20_ENGB_CPURAD nrf54h20_engb_radiocore.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54L15_CPUAPP nrf54l15_application.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54L15_CPUFLPR nrf54l15_flpr.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54L20_ENGA_CPUAPP nrf54l20_enga_application.svd) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index e52adda9e1c7a..58e938492ffbd 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -1048,13 +1048,13 @@ #include #elif defined(NRF5340_XXAA_NETWORK) #include -#elif (defined(NRF54H20_XXAA) || defined(NRF54H20_ENGB_XXAA)) && defined(NRF_APPLICATION) +#elif defined(NRF54H20_XXAA) && defined(NRF_APPLICATION) #include -#elif (defined(NRF54H20_XXAA) || defined(NRF54H20_ENGB_XXAA)) && defined(NRF_RADIOCORE) +#elif defined(NRF54H20_XXAA) && defined(NRF_RADIOCORE) #include -#elif (defined(NRF54H20_XXAA) || defined(NRF54H20_ENGB_XXAA)) && defined(NRF_PPR) +#elif defined(NRF54H20_XXAA) && defined(NRF_PPR) #include -#elif (defined(NRF54H20_XXAA) || defined(NRF54H20_ENGB_XXAA)) && defined(NRF_FLPR) +#elif defined(NRF54H20_XXAA) && defined(NRF_FLPR) #include #elif defined(NRF54L15_XXAA) && defined(NRF_APPLICATION) #include diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index 81aaaf73bf257..220bd204249a7 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -307,12 +307,10 @@ def program_hex(self): cpuapp = ( self.build_conf.getboolean('CONFIG_SOC_NRF54H20_CPUAPP') or - self.build_conf.getboolean('CONFIG_SOC_NRF54H20_ENGB_CPUAPP') or self.build_conf.getboolean('CONFIG_SOC_NRF9280_CPUAPP') ) cpurad = ( self.build_conf.getboolean('CONFIG_SOC_NRF54H20_CPURAD') or - self.build_conf.getboolean('CONFIG_SOC_NRF54H20_ENGB_CPURAD') or self.build_conf.getboolean('CONFIG_SOC_NRF9280_CPURAD') ) generated_uicr = self.build_conf.getboolean('CONFIG_NRF_REGTOOL_GENERATE_UICR') diff --git a/soc/nordic/common/vpr/Kconfig.sysbuild b/soc/nordic/common/vpr/Kconfig.sysbuild index 8821810d63d78..cfbd619f623f6 100644 --- a/soc/nordic/common/vpr/Kconfig.sysbuild +++ b/soc/nordic/common/vpr/Kconfig.sysbuild @@ -4,7 +4,7 @@ config VPR_LAUNCHER bool "VPR launcher" default y - depends on (SOC_NRF54H20_CPUPPR || SOC_NRF54H20_ENGB_CPUPPR || SOC_NRF54H20_CPUFLPR || SOC_NRF54H20_ENGB_CPUFLPR || SOC_NRF54L15_CPUFLPR || SOC_NRF9280_CPUPPR) + depends on (SOC_NRF54H20_CPUPPR || SOC_NRF54H20_CPUFLPR || SOC_NRF54L15_CPUFLPR || SOC_NRF9280_CPUPPR) help Include VPR launcher in build. VPR launcher is a minimal sample built for an ARM core that starts given VPR core. diff --git a/soc/nordic/nrf54h/Kconfig b/soc/nordic/nrf54h/Kconfig index 1b667e259853c..0baab4121ad40 100644 --- a/soc/nordic/nrf54h/Kconfig +++ b/soc/nordic/nrf54h/Kconfig @@ -34,9 +34,6 @@ config SOC_NRF54H20_CPUAPP_COMMON config SOC_NRF54H20_CPUAPP select SOC_NRF54H20_CPUAPP_COMMON -config SOC_NRF54H20_ENGB_CPUAPP - select SOC_NRF54H20_CPUAPP_COMMON - config SOC_NRF54H20_CPURAD_COMMON bool select ARM @@ -61,19 +58,10 @@ config SOC_NRF54H20_CPURAD_COMMON config SOC_NRF54H20_CPURAD select SOC_NRF54H20_CPURAD_COMMON -config SOC_NRF54H20_ENGB_CPURAD - select SOC_NRF54H20_CPURAD_COMMON - config SOC_NRF54H20_CPUPPR depends on RISCV_CORE_NORDIC_VPR -config SOC_NRF54H20_ENGB_CPUPPR - depends on RISCV_CORE_NORDIC_VPR - config SOC_NRF54H20_CPUFLPR depends on RISCV_CORE_NORDIC_VPR -config SOC_NRF54H20_ENGB_CPUFLPR - depends on RISCV_CORE_NORDIC_VPR - rsource "gpd/Kconfig" diff --git a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp index 43aed154ecbe6..595cc2d388602 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp +++ b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp @@ -3,7 +3,7 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if SOC_NRF54H20_CPUAPP || SOC_NRF54H20_ENGB_CPUAPP +if SOC_NRF54H20_CPUAPP config NUM_IRQS default 471 @@ -14,4 +14,4 @@ config NRF_REGTOOL_GENERATE_UICR config SHELL_BACKEND_SERIAL default n if NRF_ETR_SHELL -endif # SOC_NRF54H20_CPUAPP || SOC_NRF54H20_ENGB_CPUAPP +endif # SOC_NRF54H20_CPUAPP diff --git a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuflpr b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuflpr index 97b1e89a9c16d..2b792e9f1b93f 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuflpr +++ b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuflpr @@ -1,7 +1,7 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if SOC_NRF54H20_CPUFLPR || SOC_NRF54H20_ENGB_CPUFLPR +if SOC_NRF54H20_CPUFLPR config NUM_IRQS default 496 @@ -10,4 +10,4 @@ config NUM_IRQS config ASSERT default n -endif # SOC_NRF54H20_CPUFLPR || SOC_NRF54H20_ENGB_CPUFLPR +endif # SOC_NRF54H20_CPUFLPR diff --git a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr index 02649146ad770..bf7c12a3a694d 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr +++ b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuppr @@ -1,7 +1,7 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if SOC_NRF54H20_CPUPPR || SOC_NRF54H20_ENGB_CPUPPR +if SOC_NRF54H20_CPUPPR config NUM_IRQS default 496 @@ -13,4 +13,4 @@ config SYS_CLOCK_TICKS_PER_SEC config ASSERT default n -endif # SOC_NRF54H20_CPUPPR || SOC_NRF54H20_ENGB_CPUPPR +endif # SOC_NRF54H20_CPUPPR diff --git a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpurad b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpurad index 9ad0b30e1c831..4437e7aadc441 100644 --- a/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpurad +++ b/soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpurad @@ -3,7 +3,7 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if SOC_NRF54H20_CPURAD || SOC_NRF54H20_ENGB_CPURAD +if SOC_NRF54H20_CPURAD config NUM_IRQS default 471 @@ -11,4 +11,4 @@ config NUM_IRQS config NRF_REGTOOL_GENERATE_UICR default y -endif # SOC_NRF54H20_CPURAD || SOC_NRF54H20_ENGB_CPURAD +endif # SOC_NRF54H20_CPURAD diff --git a/soc/nordic/nrf54h/Kconfig.soc b/soc/nordic/nrf54h/Kconfig.soc index 852e92bb138e4..459854e13b2dc 100644 --- a/soc/nordic/nrf54h/Kconfig.soc +++ b/soc/nordic/nrf54h/Kconfig.soc @@ -9,59 +9,29 @@ config SOC_NRF54H20 help nRF54H20 -config SOC_NRF54H20_ENGB - bool - select SOC_SERIES_NRF54HX - help - nRF54H20 (EngB) - config SOC_NRF54H20_CPUAPP bool select SOC_NRF54H20 help nRF54H20 CPUAPP -config SOC_NRF54H20_ENGB_CPUAPP - bool - select SOC_NRF54H20_ENGB - help - nRF54H20 (EngB) CPUAPP - config SOC_NRF54H20_CPURAD bool select SOC_NRF54H20 help nRF54H20 CPURAD -config SOC_NRF54H20_ENGB_CPURAD - bool - select SOC_NRF54H20_ENGB - help - nRF54H20 (EngB) CPURAD - config SOC_NRF54H20_CPUPPR bool select SOC_NRF54H20 help nRF54H20 CPUPPR -config SOC_NRF54H20_ENGB_CPUPPR - bool - select SOC_NRF54H20_ENGB - help - nRF54H20 (EngB) CPUPPR - config SOC_NRF54H20_CPUFLPR bool select SOC_NRF54H20 help nRF54H20 CPUFLPR -config SOC_NRF54H20_ENGB_CPUFLPR - bool - select SOC_NRF54H20_ENGB - help - nRF54H20 (EngB) CPUFLPR - config SOC - default "nrf54h20" if SOC_NRF54H20 || SOC_NRF54H20_ENGB + default "nrf54h20" if SOC_NRF54H20 diff --git a/soc/nordic/nrf54h/gpd/Kconfig b/soc/nordic/nrf54h/gpd/Kconfig index b9bd568cda630..98b374f6de9f2 100644 --- a/soc/nordic/nrf54h/gpd/Kconfig +++ b/soc/nordic/nrf54h/gpd/Kconfig @@ -6,7 +6,6 @@ config SOC_NRF54H20_GPD imply NRFS imply NRFS_GDPWR_SERVICE_ENABLED select ONOFF - default y if SOC_NRF54H20_CPUAPP || SOC_NRF54H20_ENGB_CPUAPP || \ - SOC_NRF54H20_CPURAD || SOC_NRF54H20_ENGB_CPURAD + default y if SOC_NRF54H20_CPUAPP || SOC_NRF54H20_CPURAD help This option enables the Global Power Domain service. diff --git a/soc/nordic/nrf54h/soc.h b/soc/nordic/nrf54h/soc.h index db79e2c8c720a..566c07a8c2cbf 100644 --- a/soc/nordic/nrf54h/soc.h +++ b/soc/nordic/nrf54h/soc.h @@ -9,7 +9,7 @@ #include -#if defined(CONFIG_SOC_NRF54H20_CPUAPP) || defined(CONFIG_SOC_NRF54H20_ENGB_CPUAPP) +#if defined(CONFIG_SOC_NRF54H20_CPUAPP) #define RAMBLOCK_CONTROL_BIT_ICACHE MEMCONF_POWER_CONTROL_MEM1_Pos #define RAMBLOCK_CONTROL_BIT_DCACHE MEMCONF_POWER_CONTROL_MEM2_Pos #define RAMBLOCK_POWER_ID 0 @@ -17,7 +17,7 @@ #define RAMBLOCK_RET_MASK (MEMCONF_POWER_RET_MEM0_Msk) #define RAMBLOCK_RET_BIT_ICACHE MEMCONF_POWER_RET_MEM1_Pos #define RAMBLOCK_RET_BIT_DCACHE MEMCONF_POWER_RET_MEM2_Pos -#elif defined(CONFIG_SOC_NRF54H20_CPURAD) || defined(CONFIG_SOC_NRF54H20_ENGB_CPURAD) +#elif defined(CONFIG_SOC_NRF54H20_CPURAD) #define RAMBLOCK_CONTROL_BIT_ICACHE MEMCONF_POWER_CONTROL_MEM6_Pos #define RAMBLOCK_CONTROL_BIT_DCACHE MEMCONF_POWER_CONTROL_MEM7_Pos #define RAMBLOCK_POWER_ID 0 diff --git a/subsys/logging/frontends/Kconfig b/subsys/logging/frontends/Kconfig index ec3945fa1ffd4..ec04584680698 100644 --- a/subsys/logging/frontends/Kconfig +++ b/subsys/logging/frontends/Kconfig @@ -47,8 +47,7 @@ config LOG_FRONTEND_STMESP_DICT config LOG_FRONTEND_STMESP_FSC bool "Send fully self-contained messages" select LOG_MSG_APPEND_RO_STRING_LOC if !(NRF_ETR || \ - SOC_NRF54H20_CPUPPR || SOC_NRF54H20_ENGB_CPUPPR || \ - SOC_NRF54H20_CPUFLPR || SOC_NRF54H20_ENGB_CPUFLPR) + SOC_NRF54H20_CPUPPR || SOC_NRF54H20_CPUFLPR) config LOG_FRONTEND_STMESP_FLUSH_COUNT int "Number of flushing words" From f8acf35ddc4d327bf984f91abfb64da94132e9ed Mon Sep 17 00:00:00 2001 From: Gang Li Date: Tue, 22 Oct 2024 11:25:03 +0900 Subject: [PATCH 2581/4482] drivers: wifi: nxp: fix build failure after disabling 802.11ax Fixed build error, when disabling 802.11ax, if-else does not match. Fixes #81117 Signed-off-by: Gang Li --- drivers/wifi/nxp/nxp_wifi_drv.c | 34 ++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/wifi/nxp/nxp_wifi_drv.c b/drivers/wifi/nxp/nxp_wifi_drv.c index 48f440831b4d7..4434263953837 100644 --- a/drivers/wifi/nxp/nxp_wifi_drv.c +++ b/drivers/wifi/nxp/nxp_wifi_drv.c @@ -276,20 +276,20 @@ int nxp_wifi_wlan_event_callback(enum wlan_event_reason reason, void *data) case WLAN_REASON_UAP_CLIENT_CONN: wlan_get_current_uap_network(&nxp_wlan_network); #ifdef CONFIG_NXP_WIFI_11AX - if (nxp_wlan_network.dot11ax) { - ap_sta_info.link_mode = WIFI_6; - } + if (nxp_wlan_network.dot11ax) { + ap_sta_info.link_mode = WIFI_6; + } else #endif #ifdef CONFIG_NXP_WIFI_11AC - else if (nxp_wlan_network.dot11ac) { + if (nxp_wlan_network.dot11ac) { ap_sta_info.link_mode = WIFI_5; - } + } else #endif - else if (nxp_wlan_network.dot11n) { + if (nxp_wlan_network.dot11n) { ap_sta_info.link_mode = WIFI_4; - } else { - ap_sta_info.link_mode = WIFI_3; - } + } else { + ap_sta_info.link_mode = WIFI_3; + } memcpy(ap_sta_info.mac, data, WIFI_MAC_ADDR_LEN); ap_sta_info.mac_length = WIFI_MAC_ADDR_LEN; @@ -968,15 +968,15 @@ static int nxp_wifi_status(const struct device *dev, struct wifi_iface_status *s #ifdef CONFIG_NXP_WIFI_11AX if (nxp_wlan_network.dot11ax) { status->link_mode = WIFI_6; - } + } else #endif #ifdef CONFIG_NXP_WIFI_11AC - else if (nxp_wlan_network.dot11ac) { - status->link_mode = WIFI_5; - } + if (nxp_wlan_network.dot11ac) { + status->link_mode = WIFI_5; + } else #endif - else if (nxp_wlan_network.dot11n) { - status->link_mode = WIFI_4; + if (nxp_wlan_network.dot11n) { + status->link_mode = WIFI_4; } else { status->link_mode = WIFI_3; } @@ -1335,6 +1335,7 @@ static int nxp_wifi_reg_domain(const struct device *dev, struct wifi_reg_domain return 0; } +#ifdef CONFIG_NXP_WIFI_11AX_TWT static int nxp_wifi_set_twt(const struct device *dev, struct wifi_twt_params *params) { wlan_twt_setup_config_t twt_setup_conf; @@ -1367,6 +1368,7 @@ static int nxp_wifi_set_twt(const struct device *dev, struct wifi_twt_params *pa return ret; } +#endif static void nxp_wifi_sta_init(struct net_if *iface) { @@ -1654,7 +1656,9 @@ static const struct wifi_mgmt_ops nxp_wifi_sta_mgmt = { .cfg_11k = nxp_wifi_11k_cfg, .set_power_save = nxp_wifi_power_save, .get_power_save_config = nxp_wifi_get_power_save, +#ifdef CONFIG_NXP_WIFI_11AX_TWT .set_twt = nxp_wifi_set_twt, +#endif }; #if defined(CONFIG_WIFI_NM_WPA_SUPPLICANT) From 7c31369f5153ab4e5290a418ee8d8d87836923fd Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Tue, 22 Oct 2024 10:10:03 +0200 Subject: [PATCH 2582/4482] MAINTAINERS: Cover Si32 pinctrl dt binding header Without this change, `get_maintainer.py path ...` did not return a SiM3U specific maintainer information when querying for include/zephyr/dt-bindings/pinctrl/si32-pinctrl.h. Signed-off-by: Reto Schneider --- MAINTAINERS.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 68f105d431fc6..58f56d28d72d7 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -3546,6 +3546,7 @@ Silabs SiM3U Platforms: - drivers/*/Kconfig.si32 - dts/arm/silabs/sim3u* - dts/bindings/*/*silabs,si32* + - include/zephyr/dt-bindings/pinctrl/*si32* - soc/silabs/silabs_sim3/ labels: - "platform: Silabs SiM3U" From c47523c1c44c6ea1e0d176b86700cce13dd236a1 Mon Sep 17 00:00:00 2001 From: Furkan Akkiz Date: Tue, 22 Oct 2024 19:14:37 +0300 Subject: [PATCH 2583/4482] manifest: Update hal_adi to add MAX78002 SoC Added MAX78002 SoCs' files to the hal_adi repository. This commit fetches it. Signed-off-by: Furkan Akkiz --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 720932219f44f..30e2bce894db8 100644 --- a/west.yml +++ b/west.yml @@ -137,7 +137,7 @@ manifest: groups: - fs - name: hal_adi - revision: a3eecfde1c76d38312b94fd346c7ba9fe2661992 + revision: b1a10239e1001502c3089e0cf938e938f99b1f30 path: modules/hal/adi groups: - hal From 1b194393ceefd58d96657886bc3c41ef2a4ef463 Mon Sep 17 00:00:00 2001 From: Furkan Akkiz Date: Tue, 20 Aug 2024 14:54:27 +0300 Subject: [PATCH 2584/4482] drivers: clock control: Add IPLL and EBO clocks for MAX32 MCUs MAX78002 SoC has IPLL and EBO clocks. Added these clocks for MAX78002. Updated ERFO clock with '_OR' option because MAX78002 doesn't have it. Signed-off-by: Furkan Akkiz --- .../clock_control/adi_max32_clock_control.h | 16 +++++++++++++++- .../zephyr/dt-bindings/clock/adi_max32_clock.h | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/zephyr/drivers/clock_control/adi_max32_clock_control.h b/include/zephyr/drivers/clock_control/adi_max32_clock_control.h index 2922b5e2c8861..cd889d370b252 100644 --- a/include/zephyr/drivers/clock_control/adi_max32_clock_control.h +++ b/include/zephyr/drivers/clock_control/adi_max32_clock_control.h @@ -30,6 +30,8 @@ struct max32_perclk { * ADI_MAX32_PRPH_CLK_SRC_INRO * ADI_MAX32_PRPH_CLK_SRC_ISO * ADI_MAX32_PRPH_CLK_SRC_IBRO_DIV8 + * ADI_MAX32_PRPH_CLK_SRC_IPLL + * ADI_MAX32_PRPH_CLK_SRC_EBO */ uint32_t clk_src; }; @@ -38,11 +40,13 @@ struct max32_perclk { #define ADI_MAX32_SYSCLK_PRESCALER DT_PROP_OR(DT_NODELABEL(gcr), sysclk_prescaler, 1) #define ADI_MAX32_CLK_IPO_FREQ DT_PROP(DT_NODELABEL(clk_ipo), clock_frequency) -#define ADI_MAX32_CLK_ERFO_FREQ DT_PROP(DT_NODELABEL(clk_erfo), clock_frequency) +#define ADI_MAX32_CLK_ERFO_FREQ DT_PROP_OR(DT_NODELABEL(clk_erfo), clock_frequency, 0) #define ADI_MAX32_CLK_IBRO_FREQ DT_PROP(DT_NODELABEL(clk_ibro), clock_frequency) #define ADI_MAX32_CLK_ISO_FREQ DT_PROP_OR(DT_NODELABEL(clk_iso), clock_frequency, 0) #define ADI_MAX32_CLK_INRO_FREQ DT_PROP(DT_NODELABEL(clk_inro), clock_frequency) #define ADI_MAX32_CLK_ERTCO_FREQ DT_PROP(DT_NODELABEL(clk_ertco), clock_frequency) +#define ADI_MAX32_CLK_IPLL_FREQ DT_PROP_OR(DT_NODELABEL(clk_ipll), clock_frequency, 0) +#define ADI_MAX32_CLK_EBO_FREQ DT_PROP_OR(DT_NODELABEL(clk_ebo), clock_frequency, 0) /* External clock may not be defined so _OR is used */ #define ADI_MAX32_CLK_EXTCLK_FREQ DT_PROP_OR(DT_NODELABEL(clk_extclk), clock_frequency, 0) @@ -76,6 +80,14 @@ struct max32_perclk { #define ADI_MAX32_SYSCLK_SRC ADI_MAX32_CLK_EXTCLK #define ADI_MAX32_SYSCLK_FREQ (ADI_MAX32_CLK_EXTCLK_FREQ / ADI_MAX32_SYSCLK_PRESCALER) #endif +#if DT_SAME_NODE(DT_GCR_CLOCKS_CTRL, DT_NODELABEL(clk_ipll)) +#define ADI_MAX32_SYSCLK_SRC ADI_MAX32_CLK_IPLL +#define ADI_MAX32_SYSCLK_FREQ (ADI_MAX32_CLK_IPLL_FREQ / ADI_MAX32_SYSCLK_PRESCALER) +#endif +#if DT_SAME_NODE(DT_GCR_CLOCKS_CTRL, DT_NODELABEL(clk_ebo)) +#define ADI_MAX32_SYSCLK_SRC ADI_MAX32_CLK_EBO +#define ADI_MAX32_SYSCLK_FREQ (ADI_MAX32_CLK_EBO_FREQ / ADI_MAX32_SYSCLK_PRESCALER) +#endif #ifndef ADI_MAX32_SYSCLK_SRC #define ADI_MAX32_SYSCLK_SRC ADI_MAX32_CLK_IPO @@ -93,6 +105,8 @@ struct max32_perclk { : (clk_src) == ADI_MAX32_PRPH_CLK_SRC_ISO ? ADI_MAX32_CLK_ISO_FREQ \ : (clk_src) == ADI_MAX32_PRPH_CLK_SRC_IBRO_DIV8 ? (ADI_MAX32_CLK_IBRO_FREQ / 8) \ : (clk_src) == ADI_MAX32_PRPH_CLK_SRC_EXTCLK ? ADI_MAX32_CLK_EXTCLK_FREQ \ + : (clk_src) == ADI_MAX32_PRPH_CLK_SRC_IPLL ? ADI_MAX32_CLK_IPLL_FREQ \ + : (clk_src) == ADI_MAX32_PRPH_CLK_SRC_EBO ? ADI_MAX32_CLK_EBO_FREQ \ : 0) #endif /* ZEPHYR_INCLUDE_DRIVERS_CLOCK_CONTROL_ADI_MAX32_CLOCK_CONTROL_H_ */ diff --git a/include/zephyr/dt-bindings/clock/adi_max32_clock.h b/include/zephyr/dt-bindings/clock/adi_max32_clock.h index 44fb918c22e9b..e0cd17c2ca702 100644 --- a/include/zephyr/dt-bindings/clock/adi_max32_clock.h +++ b/include/zephyr/dt-bindings/clock/adi_max32_clock.h @@ -21,5 +21,7 @@ #define ADI_MAX32_PRPH_CLK_SRC_INRO 5 /* Internal Nano Ring Oscillator */ #define ADI_MAX32_PRPH_CLK_SRC_ISO 6 /* Internal Secondary Oscillator */ #define ADI_MAX32_PRPH_CLK_SRC_IBRO_DIV8 7 /* IBRO/8 */ +#define ADI_MAX32_PRPH_CLK_SRC_IPLL 8 /* Internal Phase Lock Loop Oscillator */ +#define ADI_MAX32_PRPH_CLK_SRC_EBO 9 /* External Base Oscillator */ #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_ADI_MAX32_CLOCK_H_ */ From f42568ca7b5e5f426376ed1b37f5bb9325f4f339 Mon Sep 17 00:00:00 2001 From: Furkan Akkiz Date: Mon, 12 Aug 2024 13:39:53 +0300 Subject: [PATCH 2585/4482] soc: adi: Add the MAX78002 SoC Added MAX78002 Kconfig and dts files. Signed-off-by: Furkan Akkiz --- dts/arm/adi/max32/max78002-pinctrl.dtsi | 455 +++++++++++++++++++++++ dts/arm/adi/max32/max78002.dtsi | 211 +++++++++++ soc/adi/max32/CMakeLists.txt | 1 + soc/adi/max32/Kconfig | 3 + soc/adi/max32/Kconfig.defconfig | 2 +- soc/adi/max32/Kconfig.defconfig.max78002 | 14 + soc/adi/max32/Kconfig.soc | 9 + soc/adi/max32/max78002.ld | 13 + soc/adi/max32/soc.yml | 3 + 9 files changed, 710 insertions(+), 1 deletion(-) create mode 100644 dts/arm/adi/max32/max78002-pinctrl.dtsi create mode 100644 dts/arm/adi/max32/max78002.dtsi create mode 100644 soc/adi/max32/Kconfig.defconfig.max78002 create mode 100644 soc/adi/max32/max78002.ld diff --git a/dts/arm/adi/max32/max78002-pinctrl.dtsi b/dts/arm/adi/max32/max78002-pinctrl.dtsi new file mode 100644 index 0000000000000..7951d42dbcd80 --- /dev/null +++ b/dts/arm/adi/max32/max78002-pinctrl.dtsi @@ -0,0 +1,455 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/ { + soc { + pinctrl: pin-controller@40008000 { + + /omit-if-no-ref/ uart0a_rx_p0_0: uart0a_rx_p0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ uart0a_tx_p0_1: uart0a_tx_p0_1 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr0a_ioa_p0_2: tmr0a_ioa_p0_2 { + pinmux = ; + }; + + /omit-if-no-ref/ uart0b_cts_p0_2: uart0b_cts_p0_2 { + pinmux = ; + }; + + /omit-if-no-ref/ ext_clk_p0_3: ext_clk_p0_3 { + pinmux = ; + }; + + /omit-if-no-ref/ uart0b_rts_p0_3: uart0b_rts_p0_3 { + pinmux = ; + }; + + /omit-if-no-ref/ spi0_ss0_p0_4: spi0_ss0_p0_4 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr0b_ioan_p0_4: tmr0b_ioan_p0_4 { + pinmux = ; + }; + + /omit-if-no-ref/ spi0_mosi_p0_5: spi0_mosi_p0_5 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr0b_iobn_p0_5: tmr0b_iobn_p0_5 { + pinmux = ; + }; + + /omit-if-no-ref/ spi0_miso_p0_6: spi0_miso_p0_6 { + pinmux = ; + }; + + /omit-if-no-ref/ owm_io_p0_6: owm_io_p0_6 { + pinmux = ; + }; + + /omit-if-no-ref/ spi0_sck_p0_7: spi0_sck_p0_7 { + pinmux = ; + }; + + /omit-if-no-ref/ owm_pe_p0_7: owm_pe_p0_7 { + pinmux = ; + }; + + /omit-if-no-ref/ spi0_sdio2_p0_8: spi0_sdio2_p0_8 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr0b_ioa_p0_8: tmr0b_ioa_p0_8 { + pinmux = ; + }; + + /omit-if-no-ref/ spi0_sdio3_p0_9: spi0_sdio3_p0_9 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr0b_iob_p0_9: tmr0b_iob_p0_9 { + pinmux = ; + }; + + /omit-if-no-ref/ i2c0_scl_p0_10: i2c0_scl_p0_10 { + pinmux = ; + }; + + /omit-if-no-ref/ spi0_ss2_p0_10: spi0_ss2_p0_10 { + pinmux = ; + }; + + /omit-if-no-ref/ i2c0_sda_p0_11: i2c0_sda_p0_11 { + pinmux = ; + }; + + /omit-if-no-ref/ spi0_ss1_p0_11: spi0_ss1_p0_11 { + pinmux = ; + }; + + /omit-if-no-ref/ uart1_rx_p0_12: uart1_rx_p0_12 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr1b_ioan_p0_12: tmr1b_ioan_p0_12 { + pinmux = ; + }; + + /omit-if-no-ref/ uart1_tx_p0_13: uart1_tx_p0_13 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr1b_iobn_p0_13: tmr1b_iobn_p0_13 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr1a_ioa_p0_14: tmr1a_ioa_p0_14 { + pinmux = ; + }; + + /omit-if-no-ref/ i2s_clkext_p0_14: i2s_clkext_p0_14 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr1a_iob_p0_15: tmr1a_iob_p0_15 { + pinmux = ; + }; + + /omit-if-no-ref/ pcif_vsync_p0_15: pcif_vsync_p0_15 { + pinmux = ; + }; + + /omit-if-no-ref/ i2c1_scl_p0_16: i2c1_scl_p0_16 { + pinmux = ; + }; + + /omit-if-no-ref/ pt2_p0_16: pt2_p0_16 { + pinmux = ; + }; + + /omit-if-no-ref/ i2c1_sda_p0_17: i2c1_sda_p0_17 { + pinmux = ; + }; + + /omit-if-no-ref/ pt3_p0_17: pt3_p0_17 { + pinmux = ; + }; + + /omit-if-no-ref/ pt0_p0_18: pt0_p0_18 { + pinmux = ; + }; + + /omit-if-no-ref/ owm_io_p0_18: owm_io_p0_18 { + pinmux = ; + }; + + /omit-if-no-ref/ pt1_p0_19: pt1_p0_19 { + pinmux = ; + }; + + /omit-if-no-ref/ owm_pe_p0_19: owm_pe_p0_19 { + pinmux = ; + }; + + /omit-if-no-ref/ spi1_ss0_p0_20: spi1_ss0_p0_20 { + pinmux = ; + }; + + /omit-if-no-ref/ pcif_d0_p0_20: pcif_d0_p0_20 { + pinmux = ; + }; + + /omit-if-no-ref/ spi1_mosi_p0_21: spi1_mosi_p0_21 { + pinmux = ; + }; + + /omit-if-no-ref/ pcif_d1_p0_21: pcif_d1_p0_21 { + pinmux = ; + }; + + /omit-if-no-ref/ spi1_miso_p0_22: spi1_miso_p0_22 { + pinmux = ; + }; + + /omit-if-no-ref/ pcif_d2_p0_22: pcif_d2_p0_22 { + pinmux = ; + }; + + /omit-if-no-ref/ spi1_sck_p0_23: spi1_sck_p0_23 { + pinmux = ; + }; + + /omit-if-no-ref/ pcif_d3_p0_23: pcif_d3_p0_23 { + pinmux = ; + }; + + /omit-if-no-ref/ spi1_sdio2_p0_24: spi1_sdio2_p0_24 { + pinmux = ; + }; + + /omit-if-no-ref/ pcif_d4_p0_24: pcif_d4_p0_24 { + pinmux = ; + }; + + /omit-if-no-ref/ spi1_sdio3_p0_25: spi1_sdio3_p0_25 { + pinmux = ; + }; + + /omit-if-no-ref/ pcif_d5_p0_25: pcif_d5_p0_25 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr2_ioa_p0_26: tmr2_ioa_p0_26 { + pinmux = ; + }; + + /omit-if-no-ref/ pcif_d6_p0_26: pcif_d6_p0_26 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr2_iob_p0_27: tmr2_iob_p0_27 { + pinmux = ; + }; + + /omit-if-no-ref/ pcif_d7_p0_27: pcif_d7_p0_27 { + pinmux = ; + }; + + /omit-if-no-ref/ swdio_p0_28: swdio_p0_28 { + pinmux = ; + }; + + /omit-if-no-ref/ swclk_p0_29: swclk_p0_29 { + pinmux = ; + }; + + /omit-if-no-ref/ i2c2_scl_p0_30: i2c2_scl_p0_30 { + pinmux = ; + }; + + /omit-if-no-ref/ pcif_d8_p0_30: pcif_d8_p0_30 { + pinmux = ; + }; + + /omit-if-no-ref/ i2c2_sda_p0_31: i2c2_sda_p0_31 { + pinmux = ; + }; + + /omit-if-no-ref/ pcif_d9_p0_31: pcif_d9_p0_31 { + pinmux = ; + }; + + /omit-if-no-ref/ uart2_rx_p1_0: uart2_rx_p1_0 { + pinmux = ; + }; + + /omit-if-no-ref/ rv_tck_p1_0: rv_tck_p1_0 { + pinmux = ; + }; + + /omit-if-no-ref/ uart2_tx_p1_1: uart2_tx_p1_1 { + pinmux = ; + }; + + /omit-if-no-ref/ rv_tms_p1_1: rv_tms_p1_1 { + pinmux = ; + }; + + /omit-if-no-ref/ i2s_sck_p1_2: i2s_sck_p1_2 { + pinmux = ; + }; + + /omit-if-no-ref/ rv_tdi_p1_2: rv_tdi_p1_2 { + pinmux = ; + }; + + /omit-if-no-ref/ i2s_ws_p1_3: i2s_ws_p1_3 { + pinmux = ; + }; + + /omit-if-no-ref/ rv_tdo_p1_3: rv_tdo_p1_3 { + pinmux = ; + }; + + /omit-if-no-ref/ i2s_sdi_p1_4: i2s_sdi_p1_4 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr3b_ioa_p1_4: tmr3b_ioa_p1_4 { + pinmux = ; + }; + + /omit-if-no-ref/ i2s_sdo_p1_5: i2s_sdo_p1_5 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr3b_iob_p1_5: tmr3b_iob_p1_5 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr3a_ioa_p1_6: tmr3a_ioa_p1_6 { + pinmux = ; + }; + + /omit-if-no-ref/ pcif_d10_p1_6: pcif_d10_p1_6 { + pinmux = ; + }; + + /omit-if-no-ref/ tmr3a_iob_p1_7: tmr3a_iob_p1_7 { + pinmux = ; + }; + + /omit-if-no-ref/ pcif_d11_p1_7: pcif_d11_p1_7 { + pinmux = ; + }; + + /omit-if-no-ref/ pcif_hsync_p1_8: pcif_hsync_p1_8 { + pinmux = ; + }; + + /omit-if-no-ref/ rxev0_p1_8: rxev0_p1_8 { + pinmux = ; + }; + + /omit-if-no-ref/ pcif_pclk_p1_9: pcif_pclk_p1_9 { + pinmux = ; + }; + + /omit-if-no-ref/ txev0_p1_9: txev0_p1_9 { + pinmux = ; + }; + + /omit-if-no-ref/ sdhc_cdn_p1_10: sdhc_cdn_p1_10 { + pinmux = ; + }; + + /omit-if-no-ref/ adc_clk_ext_p1_10: adc_clk_ext_p1_10 { + pinmux = ; + }; + + /omit-if-no-ref/ sdhc_dat3_p1_11: sdhc_dat3_p1_11 { + pinmux = ; + }; + + /omit-if-no-ref/ sdhc_dat2_p1_12: sdhc_dat2_p1_12 { + pinmux = ; + }; + + /omit-if-no-ref/ adc_hw_trig_a_p1_12: adc_hw_trig_a_p1_12 { + pinmux = ; + }; + + /omit-if-no-ref/ sdhc_dat1_p1_13: sdhc_dat1_p1_13 { + pinmux = ; + }; + + /omit-if-no-ref/ adc_hw_trig_b_p1_13: adc_hw_trig_b_p1_13 { + pinmux = ; + }; + + /omit-if-no-ref/ sdhc_dat0_p1_14: sdhc_dat0_p1_14 { + pinmux = ; + }; + + /omit-if-no-ref/ adc_hw_trig_c_p1_14: adc_hw_trig_c_p1_14 { + pinmux = ; + }; + + /omit-if-no-ref/ sdhc_wp_p1_15: sdhc_wp_p1_15 { + pinmux = ; + }; + + /omit-if-no-ref/ sdhc_cmd_p1_16: sdhc_cmd_p1_16 { + pinmux = ; + }; + + /omit-if-no-ref/ sdhc_clk_p1_17: sdhc_clk_p1_17 { + pinmux = ; + }; + + /omit-if-no-ref/ ain0_p2_0: ain0_p2_0 { + pinmux = ; + }; + + /omit-if-no-ref/ ain1_p2_1: ain1_p2_1 { + pinmux = ; + }; + + /omit-if-no-ref/ ain2_p2_2: ain2_p2_2 { + pinmux = ; + }; + + /omit-if-no-ref/ ain3_p2_3: ain3_p2_3 { + pinmux = ; + }; + + /omit-if-no-ref/ ain4_p2_4: ain4_p2_4 { + pinmux = ; + }; + + /omit-if-no-ref/ lptmr0b_ioa_p2_4: lptmr0b_ioa_p2_4 { + pinmux = ; + }; + + /omit-if-no-ref/ ain5_p2_5: ain5_p2_5 { + pinmux = ; + }; + + /omit-if-no-ref/ lptmr1b_ioa_p2_5: lptmr1b_ioa_p2_5 { + pinmux = ; + }; + + /omit-if-no-ref/ ain6_p2_6: ain6_p2_6 { + pinmux = ; + }; + + /omit-if-no-ref/ lptmr0_clk_p2_6: lptmr0_clk_p2_6 { + pinmux = ; + }; + + /omit-if-no-ref/ lpuartb_rx_p2_6: lpuartb_rx_p2_6 { + pinmux = ; + }; + + /omit-if-no-ref/ ain7_p2_7: ain7_p2_7 { + pinmux = ; + }; + + /omit-if-no-ref/ lptmr1_clk_p2_7: lptmr1_clk_p2_7 { + pinmux = ; + }; + + /omit-if-no-ref/ lpuartb_tx_p2_7: lpuartb_tx_p2_7 { + pinmux = ; + }; + + /omit-if-no-ref/ pdown_p3_0: pdown_p3_0 { + pinmux = ; + }; + + /omit-if-no-ref/ wakeup_p3_0: wakeup_p3_0 { + pinmux = ; + }; + + /omit-if-no-ref/ sqwout_p3_1: sqwout_p3_1 { + pinmux = ; + }; + + /omit-if-no-ref/ wakeup_p3_1: wakeup_p3_1 { + pinmux = ; + }; + + }; + }; +}; diff --git a/dts/arm/adi/max32/max78002.dtsi b/dts/arm/adi/max32/max78002.dtsi new file mode 100644 index 0000000000000..0809d1b062ce5 --- /dev/null +++ b/dts/arm/adi/max32/max78002.dtsi @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +&clk_ipo { + clock-frequency = ; +}; + +&clk_inro { + clock-frequency = ; +}; + +/delete-node/ &clk_erfo; + +/* MAX78002 extra clocks. */ +/ { + clocks { + clk_ipll: clk_ipll { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + status = "disabled"; + }; + + clk_ebo: clk_ebo { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = ; + status = "disabled"; + }; + }; +}; + +&flash0 { + reg = <0x10000000 DT_SIZE_K(2560)>; + erase-block-size = <16384>; +}; + +&pinctrl { + reg = <0x40008000 0x2200>; + + gpio2: gpio@40080400 { + reg = <0x40080400 0x200>; + compatible = "adi,max32-gpio"; + gpio-controller; + #gpio-cells = <2>; + interrupts = <26 0>; + clocks = <&gcr ADI_MAX32_CLOCK_BUS2 0>; + status = "disabled"; + }; + + gpio3: gpio@40080600 { + reg = <0x40080600 0x200>; // Address and size are dummy. + compatible = "adi,max32-gpio"; + gpio-controller; + #gpio-cells = <2>; + interrupts = <54 0>; + status = "disabled"; + }; +}; + +&adc { + compatible = "adi,max32-adc-sar", "adi,max32-adc"; + clock-source = ; + clock-divider = <16>; + channel-count = <17>; + track-count = <4>; + idle-count = <0>; + vref-mv = <1250>; + resolution = <12>; +}; + +/* MAX78002 extra peripherals. */ +/ { + soc { + sram1: memory@20008000 { + compatible = "mmio-sram"; + reg = <0x20008000 DT_SIZE_K(32)>; + }; + + sram2: memory@20010000 { + compatible = "mmio-sram"; + reg = <0x20010000 DT_SIZE_K(64)>; + }; + + sram3: memory@20020000 { + compatible = "mmio-sram"; + reg = <0x20020000 DT_SIZE_K(64)>; + }; + + sram4: memory@20030000 { + compatible = "mmio-sram"; + reg = <0x20030000 DT_SIZE_K(64)>; + }; + + sram5: memory@20040000 { + compatible = "mmio-sram"; + reg = <0x20040000 DT_SIZE_K(64)>; + }; + + sram6: memory@20050000 { + compatible = "mmio-sram"; + reg = <0x20050000 DT_SIZE_K(48)>; + }; + + sram7: memory@2005c000 { + compatible = "mmio-sram"; + reg = <0x2005c000 DT_SIZE_K(16)>; + }; + + uart3: serial@40081400 { + compatible = "adi,max32-uart"; + reg = <0x40081400 0x400>; + clocks = <&gcr ADI_MAX32_CLOCK_BUS2 4>; + clock-source = ; + interrupts = <88 0>; + status = "disabled"; + }; + + spi0: spi@400be000 { + compatible = "adi,max32-spi"; + reg = <0x400be000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&gcr ADI_MAX32_CLOCK_BUS1 16>; + interrupts = <56 0>; + status = "disabled"; + }; + + spi1: spi@40046000 { + compatible = "adi,max32-spi"; + reg = <0x40046000 0x2000>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&gcr ADI_MAX32_CLOCK_BUS0 6>; + interrupts = <16 0>; + status = "disabled"; + }; + + dma0: dma@40028000 { + compatible = "adi,max32-dma"; + reg = <0x40028000 0x1000>; + clocks = <&gcr ADI_MAX32_CLOCK_BUS0 5>; + interrupts = <28 0>, <29 0>, <30 0>, <31 0>; + dma-channels = <4>; + status = "disabled"; + #dma-cells = <2>; + }; + + wdt1: watchdog@40080800 { + compatible = "adi,max32-watchdog"; + reg = <0x40080800 0x400>; + interrupts = <57 0>; + clocks = <&gcr ADI_MAX32_CLOCK_BUS2 1>; + clock-source = ; + status = "disabled"; + }; + + lptimer0: timer@40080c00 { + compatible = "adi,max32-timer"; + reg = <0x40080c00 0x400>; + interrupts = <9 0>; + status = "disabled"; + clocks = <&gcr ADI_MAX32_CLOCK_BUS2 2>; + clock-source = ; + prescaler = <1>; + pwm { + compatible = "adi,max32-pwm"; + status = "disabled"; + #pwm-cells = <3>; + }; + counter { + compatible = "adi,max32-counter"; + status = "disabled"; + }; + }; + + lptimer1: timer@40081000 { + compatible = "adi,max32-timer"; + reg = <0x40081000 0x400>; + interrupts = <10 0>; + status = "disabled"; + clocks = <&gcr ADI_MAX32_CLOCK_BUS2 3>; + clock-source = ; + prescaler = <1>; + pwm { + compatible = "adi,max32-pwm"; + status = "disabled"; + #pwm-cells = <3>; + }; + counter { + compatible = "adi,max32-counter"; + status = "disabled"; + }; + }; + + w1: w1@4003d000 { + compatible = "adi,max32-w1"; + reg = <0x4003d000 0x1000>; + clocks = <&gcr ADI_MAX32_CLOCK_BUS1 13>; + interrupts = <67 0>; + status = "disabled"; + }; + }; +}; diff --git a/soc/adi/max32/CMakeLists.txt b/soc/adi/max32/CMakeLists.txt index 9761cdcf0b33c..41041da7e08c4 100644 --- a/soc/adi/max32/CMakeLists.txt +++ b/soc/adi/max32/CMakeLists.txt @@ -6,5 +6,6 @@ zephyr_include_directories(common) zephyr_sources(soc.c) zephyr_linker_sources_ifdef(CONFIG_SOC_FLASH_MAX32 SECTIONS flash.ld) +zephyr_linker_sources_ifdef(CONFIG_SOC_MAX78002 SECTIONS max78002.ld) set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") diff --git a/soc/adi/max32/Kconfig b/soc/adi/max32/Kconfig index 8f1b8d9eb2d9e..b2bdc351518f6 100644 --- a/soc/adi/max32/Kconfig +++ b/soc/adi/max32/Kconfig @@ -37,6 +37,9 @@ config SOC_MAX32680 config SOC_MAX32690 select CPU_CORTEX_M4 +config SOC_MAX78002_M4 + select CPU_CORTEX_M4 + if SOC_FAMILY_MAX32 config MAX32_ON_ENTER_CPU_IDLE_HOOK diff --git a/soc/adi/max32/Kconfig.defconfig b/soc/adi/max32/Kconfig.defconfig index eb33fc2daa95d..5a5fd567fc842 100644 --- a/soc/adi/max32/Kconfig.defconfig +++ b/soc/adi/max32/Kconfig.defconfig @@ -5,7 +5,7 @@ if SOC_FAMILY_MAX32 -rsource "Kconfig.defconfig.max32*" +rsource "Kconfig.defconfig.max*" config SRAM_VECTOR_TABLE default y diff --git a/soc/adi/max32/Kconfig.defconfig.max78002 b/soc/adi/max32/Kconfig.defconfig.max78002 new file mode 100644 index 0000000000000..307a757088804 --- /dev/null +++ b/soc/adi/max32/Kconfig.defconfig.max78002 @@ -0,0 +1,14 @@ +# Analog Devices MAX78002 MCU + +# Copyright (c) 2024 Analog Devices, Inc. +# SPDX-License-Identifier: Apache-2.0 + +if SOC_MAX78002 + +config SYS_CLOCK_HW_CYCLES_PER_SEC + default $(dt_node_int_prop_int,/clocks/clk_ipo,clock-frequency) + +config NUM_IRQS + default 105 + +endif # SOC_MAX78002 diff --git a/soc/adi/max32/Kconfig.soc b/soc/adi/max32/Kconfig.soc index e56456047fb29..130d9b88b1f10 100644 --- a/soc/adi/max32/Kconfig.soc +++ b/soc/adi/max32/Kconfig.soc @@ -57,6 +57,14 @@ config SOC_MAX32690_M4 bool select SOC_MAX32690 +config SOC_MAX78002 + bool + select SOC_FAMILY_MAX32 + +config SOC_MAX78002_M4 + bool + select SOC_MAX78002 + config SOC default "max32655" if SOC_MAX32655 default "max32662" if SOC_MAX32662 @@ -66,3 +74,4 @@ config SOC default "max32675" if SOC_MAX32675 default "max32680" if SOC_MAX32680 default "max32690" if SOC_MAX32690 + default "max78002" if SOC_MAX78002 diff --git a/soc/adi/max32/max78002.ld b/soc/adi/max32/max78002.ld new file mode 100644 index 0000000000000..5dd693c0f5849 --- /dev/null +++ b/soc/adi/max32/max78002.ld @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +SECTION_PROLOGUE(.shared,, SUBALIGN(4)) +{ + _shared = .; + *(.mailbox*) + *(.shared*) + _eshared = .; +} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) diff --git a/soc/adi/max32/soc.yml b/soc/adi/max32/soc.yml index 701509dc15cfd..3f164890071da 100644 --- a/soc/adi/max32/soc.yml +++ b/soc/adi/max32/soc.yml @@ -20,3 +20,6 @@ family: - name: max32690 cpuclusters: - name: m4 + - name: max78002 + cpuclusters: + - name: m4 From 9c98ab7b73f27cfbe7ed683d107bee85d996a886 Mon Sep 17 00:00:00 2001 From: Furkan Akkiz Date: Tue, 27 Aug 2024 16:25:53 +0300 Subject: [PATCH 2586/4482] dt-bindings: dma: Add MAX78002 DMA binding file Add MAX78002 binding file for DMA slots. Signed-off-by: Furkan Akkiz --- include/zephyr/dt-bindings/dma/max78002_dma.h | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 include/zephyr/dt-bindings/dma/max78002_dma.h diff --git a/include/zephyr/dt-bindings/dma/max78002_dma.h b/include/zephyr/dt-bindings/dma/max78002_dma.h new file mode 100644 index 0000000000000..cb5592b358885 --- /dev/null +++ b/include/zephyr/dt-bindings/dma/max78002_dma.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_DMA_MAX78002_DMA_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_DMA_MAX78002_DMA_H_ + +#define MAX78_DMA_SLOT_MEMTOMEM 0x00U +#define MAX78_DMA_SLOT_SPI1_RX 0x01U +#define MAX78_DMA_SLOT_UART0_RX 0x04U +#define MAX78_DMA_SLOT_UART1_RX 0x05U +#define MAX78_DMA_SLOT_I2C0_RX 0x07U +#define MAX78_DMA_SLOT_I2C1_RX 0x08U +#define MAX78_DMA_SLOT_ADC 0x09U +#define MAX78_DMA_SLOT_I2C2_RX 0x0AU +#define MAX78_DMA_SLOT_UART2_RX 0x0EU +#define MAX78_DMA_SLOT_SPI0_RX 0x0FU +#define MAX78_DMA_SLOT_AES_RX 0x10U +#define MAX78_DMA_SLOT_I2S_RX 0x1EU +#define MAX78_DMA_SLOT_SPI1_TX 0x21U +#define MAX78_DMA_SLOT_UART0_TX 0x24U +#define MAX78_DMA_SLOT_UART1_TX 0x25U +#define MAX78_DMA_SLOT_I2C0_TX 0x27U +#define MAX78_DMA_SLOT_I2C1_TX 0x28U +#define MAX78_DMA_SLOT_I2C2_TX 0x2AU +#define MAX78_DMA_SLOT_CRC 0x2CU +#define MAX78_DMA_SLOT_UART2_TX 0x2EU +#define MAX78_DMA_SLOT_SPI0_TX 0x2FU +#define MAX78_DMA_SLOT_AES_TX 0x30U +#define MAX78_DMA_SLOT_I2S_TX 0x3EU + +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_DMA_MAX78002_DMA_H_ */ From 448872882285d365b4a6466bf72b9b3b705a8b5a Mon Sep 17 00:00:00 2001 From: Furkan Akkiz Date: Mon, 12 Aug 2024 15:02:55 +0300 Subject: [PATCH 2587/4482] boards: adi: Add MAX78002EVKIT board Add MAX78002EVKIT board. For more information about this board please check https://www.analog.com/ Signed-off-by: Furkan Akkiz --- .../adi/max78002evkit/Kconfig.max78002evkit | 7 + boards/adi/max78002evkit/board.cmake | 7 + boards/adi/max78002evkit/board.yml | 9 + .../max78002evkit/doc/img/max78002evkit.webp | Bin 0 -> 34760 bytes .../doc/img/max78002evkit_back.webp | Bin 0 -> 31208 bytes boards/adi/max78002evkit/doc/index.rst | 295 ++++++++++++++++++ .../max78002evkit_max78002_m4.dts | 127 ++++++++ .../max78002evkit_max78002_m4.yaml | 24 ++ .../max78002evkit_max78002_m4_defconfig | 13 + 9 files changed, 482 insertions(+) create mode 100644 boards/adi/max78002evkit/Kconfig.max78002evkit create mode 100644 boards/adi/max78002evkit/board.cmake create mode 100644 boards/adi/max78002evkit/board.yml create mode 100644 boards/adi/max78002evkit/doc/img/max78002evkit.webp create mode 100644 boards/adi/max78002evkit/doc/img/max78002evkit_back.webp create mode 100644 boards/adi/max78002evkit/doc/index.rst create mode 100644 boards/adi/max78002evkit/max78002evkit_max78002_m4.dts create mode 100644 boards/adi/max78002evkit/max78002evkit_max78002_m4.yaml create mode 100644 boards/adi/max78002evkit/max78002evkit_max78002_m4_defconfig diff --git a/boards/adi/max78002evkit/Kconfig.max78002evkit b/boards/adi/max78002evkit/Kconfig.max78002evkit new file mode 100644 index 0000000000000..a18aa6b97d954 --- /dev/null +++ b/boards/adi/max78002evkit/Kconfig.max78002evkit @@ -0,0 +1,7 @@ +# MAX78002EVKIT board configuration + +# Copyright (c) 2024 Analog Devices, Inc. +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_MAX78002EVKIT + select SOC_MAX78002_M4 if BOARD_MAX78002EVKIT_MAX78002_M4 diff --git a/boards/adi/max78002evkit/board.cmake b/boards/adi/max78002evkit/board.cmake new file mode 100644 index 0000000000000..b7d321b2f84f0 --- /dev/null +++ b/boards/adi/max78002evkit/board.cmake @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Analog Devices, Inc. +# SPDX-License-Identifier: Apache-2.0 + +board_runner_args(openocd --cmd-pre-init "source [find interface/cmsis-dap.cfg]") +board_runner_args(openocd --cmd-pre-init "source [find target/max78002.cfg]") + +include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/adi/max78002evkit/board.yml b/boards/adi/max78002evkit/board.yml new file mode 100644 index 0000000000000..f995c7199f05f --- /dev/null +++ b/boards/adi/max78002evkit/board.yml @@ -0,0 +1,9 @@ +# Copyright (c) 2024 Analog Devices, Inc. +# SPDX-License-Identifier: Apache-2.0 + +board: + name: max78002evkit + full_name: MAX78002EVKIT + vendor: adi + socs: + - name: max78002 diff --git a/boards/adi/max78002evkit/doc/img/max78002evkit.webp b/boards/adi/max78002evkit/doc/img/max78002evkit.webp new file mode 100644 index 0000000000000000000000000000000000000000..f3452168a630556653385ccdde2366291ae64482 GIT binary patch literal 34760 zcmV(&K;geqNk&G%hX4RqMM6+kP&gp8hX4Rj)B&9VDpdk+0Y05Xn@OrBq@%0UtZ=Xs ziDf#2ZZk^%B^}D>)+V9uAROOGTx<6G-|^nl>oWe>-ND1J>Apz5hxVhv|I7ZN{V(^= z-S6_BIlrak58*$$^C#=~@qfkpbN*}o*ZB|1FGv1If0h0#*dz0Q>7THk%pZIEY2Hz~ zf2;q;{>#`S+JCnG$NIv3KmITE9;SY?{!jlmxEJ$p?qB%5Z2y`0vYH!>HITQxxTt_zGM1oQJ3J4mWUM&4sEnGB!iVaLP2VJ5ruW-@z zKqxZz0Ael4rzIo}9^Di`^z5R4i$0@yM0Xkj3Lf(e<8Ce+!x7JaCNyta~g!tf~?gE}8W~;55?^6COPqxIi+t<|GmmCzMz*8QDxO||x z|CwxzgR!0*?a~CkoPw$Go#@m|XF?}4KC10v-XU7OgY3X%`g$pRJvaIaDP2vFS9b8` z37eP?ZIPfI+5>InbZOrgdaVrtB+9>&k>=sW*src1@Ntnme3-G<<%8-$GHMCf*~>3(a3jm`l!N53}em7La1q2Z9@{n1PtWX{Js`JG2{(s#~Bd zVt@T`1}Qu0H&FUQ8?iMjkiR4HqIL|tL#oi*T;4#+XH`Fcq06TPh9Gt%T@pfsQRz9MIVLQi&v-wjI5ZfgIOcNlTkN*i(<(7*d=& z$U%1aydmDaBQoQxSo2{%+k`*+XyH5*4+f52JsnE|ho z1}b}zuIqf97(sylq1mL%y$60`ws?IEGt?*-5-U>NjxH*Rv6m$)(WTD&FV;eTMvlyw zDp@G^AP(0}V7)O=Li0hOZ917*3Rv!&_Vre8Inpb77*+zyiHl`6d?nyhqxUZ*>oF(J z#1rp3$yJ9OzFi#hCrvS~W9F&CdZI+Ps4Eo>O|NdUxbm>_ez%5yY#COL2Q}oD!?jKg z9HYC^BW>I6(iQq^1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(Puoq7Abt*3z*yTdXP%MsJa{!?tHqPbPA-L0mfLHwzFn9AI$)+Ept>hsV s99+sR>-tN_i2`S-zHxhDRByxLpgGyvMf$G||F}Oob8rEoP_4iK05Qo#pa1{> literal 0 HcmV?d00001 diff --git a/boards/adi/max78002evkit/doc/img/max78002evkit_back.webp b/boards/adi/max78002evkit/doc/img/max78002evkit_back.webp new file mode 100644 index 0000000000000000000000000000000000000000..ae0c1b99ed6a41278c22fbad8e4ef8c901552f5e GIT binary patch literal 31208 zcmV(}K+wNZNk&HCc>n-cMM6+kP&gpec>n+~;{lxkDzXBn0Y05Zo=d1EC8QDm9^{=dQR-S7XO_&yf@X#fA1+doX7b^85MYH&0n#1=_19l?q5-&HeVu-I%i z8x4l7!Dej+P{+TXO^BZ^FonEfA9vk;v2($ROu(9{n+=A;VX##bQ3#VSdk;FJG;_iN zsQm5@1}0hfT2}c5M%N~cpP85UMfoDYS+&Y4U*%Ye6asA)WD02+12}q%t~&iEs1&#Y z#@R|kU=eYOToxTJiaN(iJS7}!Nwq#)>IfX&2qQqoRL(b4=2mQP+y5v55U3?&ye65b zrNx$0Rb;h3Vi(@dQ0I$$m8>!Ohuw~32GM~Q2VX(YsKVpH}=X0Y%i=D_47ftc!hn@2?IC) zPwV1gJiB5nGbi1A#r5J#W#`aH)hsZEZ+>o>nW}|-29W2iN6$Ud<}C08@IE~n;<5Ko*}9e!=RkGp@bM+?fQz`|F!0IOUhgOkoDHT#r+B$^HCs?=Jm+EK&HWlm z4}WRksk_*>y0>6XjSM_na%MTLt{H9map-#e`-;V01t# zJQ^Gk4RwA4Dm@a9)h?a5c&=fU26e={*PnlLalqv=_!pPy6{-71{YHA11^qZQLJ{rH z$c~%{1j0v}=y=@qV55Nq04*U^PAWou69`H`5szO#bbpi7UJ=@ezT2Y1ZoF|uKw-rI zEd0K15~zncrZc+f*@w;Dp3;1G?{)=!?dsC|PYNa6asOTkqZVDCJYhkR`zv?z#S_j& zQV0I?FK}-Pjr}KtV-E^X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%W`9T(Tc_Q)RnATT-bnDu2`ua8<=Wov!4R?ID4t0FRa?U_$4JUJSgbK9seHN zY)ESX2Of1yJFk-KX5E6$tvm%X@5n{cP{tDo{V-8^>i0c%hWvOx!$LPCqt+%HOT)V^UGokEG$B@83AKeoZhmCN8`<<{`TDcRqBl6`1FN?Ra zQ)b*|hgJLcm7zW$GY$pe(H;gq;4KgAhs~#?PA?ZgfsuwM;Fo0H<^TZt)74OgTGCKRo8sWWs2h_v*6=mb*7CTn=n4j-aC-Xq*xQut3v%9-oNSG)T=Q;P38(EEX8%zNDxbsDa!=l8f%WyT=KD zd)rhs_);hfj-t}G9x*SrVm1X~{-#k-7Uv;Y=Yj}pNc>>k3h!5q_akqYI0y*>&4`|% zg5yC*k1oJ2chLpQk>6eTwNBt3MZW8*jmI~#|tN1 z3=V2*nM449DLDOrCDnr?L%Wh>05Mw8e(n(Q`V^gk4lDkN7l^Wip^}sK`*7oRHiHco zRF*?p?A+-b8o2UsECjavfr)+O^UQK2#$J$Ou!4;3kjCi&@6t?)vH$=8000000002H X^AG?400000000000000000000X}hqx literal 0 HcmV?d00001 diff --git a/boards/adi/max78002evkit/doc/index.rst b/boards/adi/max78002evkit/doc/index.rst new file mode 100644 index 0000000000000..a5bd4acf09bb0 --- /dev/null +++ b/boards/adi/max78002evkit/doc/index.rst @@ -0,0 +1,295 @@ +.. zephyr:board:: max78002evkit + +Overview +******** +The MAX78002 evaluation kit (EV kit) provides a platform and tools for leveraging device capabilities to build new +generations of artificial intelligence (AI) products. + +The kit provides optimal versatility with a modular peripheral architecture, allowing a variety of input and output +devices to be remotely located. DVP and CSI cameras, I2S audio peripherals, digital microphones, and analog sensors +are supported, while a pair of industry-standard QWIIC connectors supports a large and growing array of aftermarket +development boards. An onboard stereo audio codec offers line-level audio input and output, and tactile input is +provided by a touch-enabled 2.4in TFT display. The MAX78002 energy consumption is tracked by a power accumulator, +with four channels of formatted results presented on a secondary TFT display. All device GPIOs are accessible on +0.1in pin headers. A standard coaxial power jack serves as power input, using the included 5V, 3A wall-mount +adapter. Two USB connectors provide serial access to the MAX78002, one directly and the other through a USB to UART +bridge. A third USB connector allows access to the MAX78002 energy consumption data. Rounding out the features, a +microSD connector provides the capability for inexpensive highdensity portable data storage. + +The Zephyr port is running on the MAX78002 MCU. + +.. image:: img/max78002evkit.webp + :align: center + :alt: MAX78002 EVKIT Front + +.. image:: img/max78002evkit_back.webp + :align: center + :alt: MAX78002 EVKIT Back + +Hardware +******** + +- MAX78002 MCU: + + - Dual-Core, Low-Power Microcontroller + + - Arm Cortex-M4 Processor with FPU up to 120MHz + - 2.5MB Flash, 64KB ROM, and 384KB SRAM + - Optimized Performance with 16KB Instruction Cache + - Optional Error Correction Code (ECC SEC-DED) for SRAM + - 32-Bit RISC-V Coprocessor up to 60MHz + - Up to 60 General-Purpose I/O Pins + - MIPI Camera Serial Interface 2 (MIPI CSI-2) Controller V2.1 + - Support for Two Data Lanes + - 12-Bit Parallel Camera Interface + - I 2S Controller/Target for Digital Audio Interface + - Secure Digital Interface Supports SD 3.0/SDIO 3.0/eMMC 4.51 + + - Convolutional Neural Network (CNN) Accelerator + + - Highly Optimized for Deep CNNs + - 2 Million 8-Bit Weight Capacity with 1-, 2-, 4-, and 8-bit Weights + - 1.3MB CNN Data Memory + - Programmable Input Image Size up to 2048 x 2048 Pixels + - Programmable Network Depth up to 128 Layers + - Programmable per Layer Network Channel Widths up to 1024 Channels + - 1- and 2-Dimensional Convolution Processing + - Capable of Processing VGA Images at 30fps + + - Power Management for Extending Battery Life + + - Integrated Single-Inductor Multiple-Output (SIMO) Switch-Mode Power Supply (SMPS) + - 2.85V to 3.6V Supply Voltage Range + - Support of Optional External Auxiliary CNN Power Supply + - Dynamic Voltage Scaling Minimizes Active Core Power Consumption + - 23.9μA/MHz While Loop Execution at 3.3V from Cache (CM4 only) + - Selectable SRAM Retention in Low-Power Modes with Real-Time Clock (RTC) Enabled + + - Security and Integrity + + - Available Secure Boot + - AES 128/192/256 Hardware Acceleration Engine + - True Random Number Generator (TRNG) Seed Generator + + - Ultra-Low-Power Wireless Microcontroller + + - Internal 100MHz Oscillator + - Flexible Low-Power Modes with 7.3728MHz System Clock Option + - 512KB Flash and 128KB SRAM (Optional ECC on One 32KB SRAM Bank) + - 16KB Instruction Cache + + - Bluetooth 5.2 LE Radio + + - Dedicated, Ultra-Low-Power, 32-Bit RISC-V Coprocessor to Offload Timing-Critical Bluetooth Processing + - Fully Open-Source Bluetooth 5.2 Stack Available + - Supports AoA, AoD, LE Audio, and Mesh + - High-Throughput (2Mbps) Mode + - Long-Range (125kbps and 500kbps) Modes + - Rx Sensitivity: -97.5dBm; Tx Power: +4.5dBm + - Single-Ended Antenna Connection (50Ω) + + - Power Management Maximizes Battery Life + + - 2.0V to 3.6V Supply Voltage Range + - Integrated SIMO Power Regulator + - Dynamic Voltage Scaling (DVS) + - 23.8μA/MHz Active Current at 3.0V + - 4.4μA at 3.0V Retention Current for 32KB + - Selectable SRAM Retention + RTC in Low-Power Modes + + - Multiple Peripherals for System Control + + - Up to Two High-Speed SPI Master/Slave + - Up to Three High-Speed I2C Master/Slave (3.4Mbps) + - Up to Four UART, One I2S Master/Slave + - Up to 8-Input, 10-Bit Sigma-Delta ADC 7.8ksps + - Up to Four Micro-Power Comparators + - Timers: Up to Two Four 32-Bit, Two LP, TwoWatchdog Timers + - 1-Wire® Master + - Up to Four Pulse Train (PWM) Engines + - RTC with Wake-Up Timer + - Up to 52 GPIOs + + - Security and Integrity​ + + - Available Secure Boot + - TRNG Seed Generator + - AES 128/192/256 Hardware Acceleration Engine + +- External devices connected to the MAX78002 EVKIT: + + - Color TFT Display + - Audio Stereo Codec Interface + - Digital Microphone + - A 8Mb QSPI ram + +Supported Features +================== + +The ``max78002evkit/max78002/m4`` board target supports the following interfaces: + ++-----------+------------+-------------------------------------+ +| Interface | Controller | Driver/Component | ++===========+============+=====================================+ +| NVIC | on-chip | nested vector interrupt controller | ++-----------+------------+-------------------------------------+ +| SYSTICK | on-chip | systick | ++-----------+------------+-------------------------------------+ +| CLOCK | on-chip | clock and reset control | ++-----------+------------+-------------------------------------+ +| GPIO | on-chip | gpio | ++-----------+------------+-------------------------------------+ +| UART | on-chip | serial | ++-----------+------------+-------------------------------------+ +| TRNG | on-chip | entropy | ++-----------+------------+-------------------------------------+ +| I2C | on-chip | i2c | ++-----------+------------+-------------------------------------+ +| DMA | on-chip | dma controller | ++-----------+------------+-------------------------------------+ +| Watchdog | on-chip | watchdog | ++-----------+------------+-------------------------------------+ +| SPI | on-chip | spi | ++-----------+------------+-------------------------------------+ +| ADC | on-chip | adc | ++-----------+------------+-------------------------------------+ +| Timer | on-chip | counter | ++-----------+------------+-------------------------------------+ +| PWM | on-chip | pwm | ++-----------+------------+-------------------------------------+ +| W1 | on-chip | one wire master | ++-----------+------------+-------------------------------------+ +| Flash | on-chip | flash | ++-----------+------------+-------------------------------------+ + +Connections and IOs +=================== + ++-----------+-------------------+----------------------------------------------------------------------------------+ +| Name | Signal | Usage | ++===========+===================+==================================================================================+ +| JP1 | 3V3 MON | Normal operation in conjunction with JP3 jumpered 1-2 | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP2 | 3V3 SW PM BYPASS | Power monitor shunts for main 3.3 V system power are bypassed | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP3 | CNN MON | Normal operation in conjunction with JP6 jumpered 1-2 | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP4 | VCOREA PM BYPASS | Power monitor shunts for U4's share of VCOREA + CNN loads are bypassed | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP5 | VCOREB PM BYPASS | Power monitor shunts for VCOREB are bypassed | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP6 | VREGO_A PM BYPASS | Power monitor shunts for VREGO_A are bypassed | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP7 | VBAT | Enable/Disable 3V3 VBAT power | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP8 | VREGI | Enable/Disable 3V3 VREGI power | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP9 | VREGI/VBAT | Onboard 3V3_PM / external source at TP10 supplies VREGI/VBAT | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP10 | VDDIOH | Onboard 3V3_PM/3V3_SW supplies VDDIOH | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP11 | VDDA | VREGO_A_PM powers VDDA | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP12 | VDDIO | VREGO_A_PM powers VDDIO | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP13 | VCOREB | VREGO_B powers VCOREB | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP14 | VCOREA | VREGO_C ties to net VCOREA | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP15 | VREF | DUT ADC VREF is supplied by precision external reference | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP16 | I2C1 SDA | I2C1 DATA pull-up | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP17 | I2C1 SCL | I2C1 CLOCK pull-up | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP18 | TRIG1 | PWR accumulator trigger signal 1 ties to port 1.6 | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP19 | TRIG2 | PWR accumulator trigger signal 2 ties to port 1.7 | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP20 | UART0 EN | Connect/Disconnect USB-UART bridge to UART0 | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP21 | I2C0_SDA | I2C0 DATA pull-up | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP22 | I2C0_SCL | I2C0 CLOCK pull-up | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP23 | UART1 EN | Connect/Disconnect USB-UART bridge to UART1 | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP24 | EXT I2C0 EN | Enable/Disable QWIIC interface for I2C0 | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP25 | PB1 PU | Enable/Disable 100kΩ pull-up for pushbutton mode, port 2.6 | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP26 | PB2 PU | Enable/Disable 100kΩ pull-up for pushbutton mode, port 2.7 | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP27 | I2C2 SDA | I2C2 DATA pull-up | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP28 | I2C2 SCL | I2C2 CLOCK pull-up | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP29 | VDDB | USB XCVR VDDB powered from VBUS / powered full time by system 3V3_PM | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP30 | EXT I2C2 EN | Enable/Disable QWIIC interface for I2C2 | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP31 | L/R SEL | Select MIC ON R/L CH, I2S microphone data stream | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP32 | MIC-I2S I/O | External I2S/MIC data from I2S I/O / MIC header connected to I2S SDI | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP33 | MIC-I2S/CODEC | Onboard CODEC data / external I2S data from header connects to I2S SDI | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP34 | I2S VDD | Select 1.8V/3.3V for external MIC and DATA I2S interface | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP35 | I2C1 SDA | I2C1 DATA pull-up | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP36 | I2C1 SCL | I2C1 CLOCK pull-up | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP37 | I2S CK SEL | Select SMA connector J6 / onboard crystal oscillator for I2S master clock source | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP38 | DVP CAM PWR | Enable/Disable OVM7692 for DVP camera PWDN input | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP39 | SW CAM PWUP | Camera reset and power up under port pin control | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP40 | HW PWUP / SW PWUP | Camera will reset and power up as soon as 3.3V reaches a valid level | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP41 | CSI CAM I2C EN | Connect/Disconnect I2C1 to CSI camera Digilent P5C I2C | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP42 | TFT DC | TFT data/command select connects to port 2.2 | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP43 | TFT CS | Select port 0.3 / port 1.7 to drive TFT CS | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP44 | LED1 EN | Enable/Disable LED1 | ++-----------+-------------------+----------------------------------------------------------------------------------+ +| JP45 | LED2 EN | Enable/Disable LED2 | ++-----------+-------------------+----------------------------------------------------------------------------------+ + +Programming and Debugging +************************* + +Flashing +======== + +The MAX78002 MCU can be flashed by connecting an external debug probe to the +SWD port. SWD debug can be accessed through the Cortex 10-pin connector, JH8. +Logic levels are fixed to VDDIO (1.8V). + +Once the debug probe is connected to your host computer, then you can simply run the +``west flash`` command to write a firmware image into flash. + +.. note:: + + This board uses OpenOCD as the default debug interface. You can also use + a Segger J-Link with Segger's native tooling by overriding the runner, + appending ``--runner jlink`` to your ``west`` command(s). The J-Link should + be connected to the standard 2*5 pin debug connector (JH8) using an + appropriate adapter board and cable. + +Debugging +========= + +Please refer to the `Flashing`_ section and run the ``west debug`` command +instead of ``west flash``. + +References +********** + +- `MAX78002EVKIT web page`_ + +.. _MAX78002EVKIT web page: + https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max78002evkit.html diff --git a/boards/adi/max78002evkit/max78002evkit_max78002_m4.dts b/boards/adi/max78002evkit/max78002evkit_max78002_m4.dts new file mode 100644 index 0000000000000..8b6df6c28c10a --- /dev/null +++ b/boards/adi/max78002evkit/max78002evkit_max78002_m4.dts @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include +#include +#include + +/ { + model = "Analog Devices MAX78002EVKIT"; + compatible = "adi,max78002evkit"; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,sram = &sram2; + zephyr,flash = &flash0; + }; + + leds { + compatible = "gpio-leds"; + led1: led_1 { + gpios = <&gpio2 4 GPIO_ACTIVE_HIGH>; + label = "Green LED"; + }; + led2: led_2 { + gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>; + label = "Red LED"; + }; + }; + + buttons { + compatible = "gpio-keys"; + pb1: pb1 { + gpios = <&gpio2 6 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "SW2"; + zephyr,code = ; + }; + pb2: pb2 { + gpios = <&gpio2 7 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "SW3"; + zephyr,code = ; + }; + pb_wakeup: pb_wakeup { + gpios = <&gpio3 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW + | MAX32_GPIO_VSEL_VDDIOH)>; + label = "Wakeup"; + zephyr,code = ; + }; + }; + + /* These aliases are provided for compatibility with samples */ + aliases { + led0 = &led1; + led1 = &led2; + sw0 = &pb1; + sw1 = &pb2; + watchdog0 = &wdt0; + }; +}; + +&uart0 { + pinctrl-0 = <&uart0a_tx_p0_1 &uart0a_rx_p0_0>; + pinctrl-names = "default"; + current-speed = <115200>; + data-bits = <8>; + parity = "none"; + status = "okay"; +}; + +&clk_ipo { + status = "okay"; +}; + +&clk_ibro { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&trng { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + pinctrl-0 = <&i2c0_scl_p0_10 &i2c0_sda_p0_11>; + pinctrl-names = "default"; +}; + +&dma0 { + status = "okay"; +}; + +&wdt0 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + pinctrl-0 = <&spi0_mosi_p0_5 &spi0_miso_p0_6 &spi0_sck_p0_7 &spi0_ss0_p0_4>; + pinctrl-names = "default"; +}; + +&w1 { + pinctrl-0 = <&owm_io_p0_6 &owm_pe_p0_7>; + pinctrl-names = "default"; +}; diff --git a/boards/adi/max78002evkit/max78002evkit_max78002_m4.yaml b/boards/adi/max78002evkit/max78002evkit_max78002_m4.yaml new file mode 100644 index 0000000000000..4631e4e276b55 --- /dev/null +++ b/boards/adi/max78002evkit/max78002evkit_max78002_m4.yaml @@ -0,0 +1,24 @@ +identifier: max78002evkit/max78002/m4 +name: max78002evkit m4 +vendor: adi +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - gpio + - serial + - trng + - i2c + - dma + - watchdog + - spi + - adc + - counter + - pwm + - w1 + - flash +ram: 384 +flash: 2560 diff --git a/boards/adi/max78002evkit/max78002evkit_max78002_m4_defconfig b/boards/adi/max78002evkit/max78002evkit_max78002_m4_defconfig new file mode 100644 index 0000000000000..a048ab2608ff0 --- /dev/null +++ b/boards/adi/max78002evkit/max78002evkit_max78002_m4_defconfig @@ -0,0 +1,13 @@ +# Copyright (c) 2024 Analog Devices, Inc. +# SPDX-License-Identifier: Apache-2.0 + +# Enable GPIO +CONFIG_GPIO=y + +# Console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# Enable UART +CONFIG_SERIAL=y +CONFIG_UART_INTERRUPT_DRIVEN=y From ee1d4da864261de60fa4e7a7998e6ea75678135c Mon Sep 17 00:00:00 2001 From: Furkan Akkiz Date: Fri, 23 Aug 2024 11:58:42 +0300 Subject: [PATCH 2588/4482] tests: Add MAX78002EVKIT test overlay files Enable following tests for MAX78002EVKIT: - tests/drivers/adc/adc_api - tests/drivers/counter/counter_basic_api - tests/drivers/dma/chan_blen_transfer - tests/drivers/dma/loop_transfer - tests/drivers/flash/common - tests/drivers/gpio/gpio_basic_api - tests/drivers/i2c/i2c_target_api - tests/drivers/pwm/pwm_api - tests/drivers/spi/spi_loopback - tests/drivers/w1/w1_api Signed-off-by: Furkan Akkiz --- .../boards/max78002evkit_max78002_m4.overlay | 36 +++++++++++ .../boards/max78002evkit_max78002_m4.overlay | 61 +++++++++++++++++++ .../boards/max78002evkit_max78002_m4.conf | 4 ++ .../boards/max78002evkit_max78002_m4.overlay | 7 +++ .../boards/max78002evkit_max78002_m4.overlay | 7 +++ .../boards/max78002evkit_max78002_m4.overlay | 23 +++++++ .../boards/max78002evkit_max78002_m4.overlay | 13 ++++ .../boards/max78002evkit_max78002_m4.conf | 7 +++ .../boards/max78002evkit_max78002_m4.overlay | 33 ++++++++++ .../boards/max78002evkit_max78002_m4.overlay | 24 ++++++++ .../boards/max78002evkit_max78002_m4.conf | 7 +++ .../boards/max78002evkit_max78002_m4.overlay | 21 +++++++ .../boards/max78002evkit_max78002_m4.overlay | 12 ++++ tests/drivers/w1/w1_api/testcase.yaml | 1 + 14 files changed, 256 insertions(+) create mode 100644 tests/drivers/adc/adc_api/boards/max78002evkit_max78002_m4.overlay create mode 100644 tests/drivers/counter/counter_basic_api/boards/max78002evkit_max78002_m4.overlay create mode 100644 tests/drivers/dma/chan_blen_transfer/boards/max78002evkit_max78002_m4.conf create mode 100644 tests/drivers/dma/chan_blen_transfer/boards/max78002evkit_max78002_m4.overlay create mode 100644 tests/drivers/dma/loop_transfer/boards/max78002evkit_max78002_m4.overlay create mode 100644 tests/drivers/flash/common/boards/max78002evkit_max78002_m4.overlay create mode 100644 tests/drivers/gpio/gpio_basic_api/boards/max78002evkit_max78002_m4.overlay create mode 100644 tests/drivers/i2c/i2c_target_api/boards/max78002evkit_max78002_m4.conf create mode 100644 tests/drivers/i2c/i2c_target_api/boards/max78002evkit_max78002_m4.overlay create mode 100644 tests/drivers/pwm/pwm_api/boards/max78002evkit_max78002_m4.overlay create mode 100644 tests/drivers/spi/spi_loopback/boards/max78002evkit_max78002_m4.conf create mode 100644 tests/drivers/spi/spi_loopback/boards/max78002evkit_max78002_m4.overlay create mode 100644 tests/drivers/w1/w1_api/boards/max78002evkit_max78002_m4.overlay diff --git a/tests/drivers/adc/adc_api/boards/max78002evkit_max78002_m4.overlay b/tests/drivers/adc/adc_api/boards/max78002evkit_max78002_m4.overlay new file mode 100644 index 0000000000000..26881418eaa42 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/max78002evkit_max78002_m4.overlay @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + zephyr,user { + /* adjust channel number according to pinmux in board.dts */ + io-channels = <&adc 0>, <&adc 1>; + }; +}; + +&adc { + status = "okay"; + pinctrl-0 = <&ain0_p2_0 &ain1_p2_1>; + pinctrl-names = "default"; + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; + + channel@1 { + reg = <1>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; +}; diff --git a/tests/drivers/counter/counter_basic_api/boards/max78002evkit_max78002_m4.overlay b/tests/drivers/counter/counter_basic_api/boards/max78002evkit_max78002_m4.overlay new file mode 100644 index 0000000000000..0a04d38eb10e7 --- /dev/null +++ b/tests/drivers/counter/counter_basic_api/boards/max78002evkit_max78002_m4.overlay @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&timer0 { + status = "okay"; + prescaler = <2>; + counter { + status = "okay"; + }; +}; + +&timer1 { + status = "okay"; + prescaler = <2>; + counter { + status = "okay"; + }; +}; + +&timer2 { + status = "okay"; + prescaler = <2>; + counter { + status = "okay"; + }; +}; + +&timer3 { + status = "okay"; + prescaler = <2>; + counter { + status = "okay"; + }; +}; + +&lptimer0 { + status = "okay"; + clock-source = ; + counter { + status = "okay"; + }; +}; + +&lptimer1 { + status = "okay"; + clock-source = ; + counter { + status = "okay"; + }; +}; + +&clk_ertco { + status = "okay"; +}; + +&clk_inro { + status = "okay"; +}; diff --git a/tests/drivers/dma/chan_blen_transfer/boards/max78002evkit_max78002_m4.conf b/tests/drivers/dma/chan_blen_transfer/boards/max78002evkit_max78002_m4.conf new file mode 100644 index 0000000000000..aac6b231720cb --- /dev/null +++ b/tests/drivers/dma/chan_blen_transfer/boards/max78002evkit_max78002_m4.conf @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Analog Devices, Inc. +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_CODE_DATA_RELOCATION=y diff --git a/tests/drivers/dma/chan_blen_transfer/boards/max78002evkit_max78002_m4.overlay b/tests/drivers/dma/chan_blen_transfer/boards/max78002evkit_max78002_m4.overlay new file mode 100644 index 0000000000000..63d2081230924 --- /dev/null +++ b/tests/drivers/dma/chan_blen_transfer/boards/max78002evkit_max78002_m4.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +tst_dma0: &dma0 { }; diff --git a/tests/drivers/dma/loop_transfer/boards/max78002evkit_max78002_m4.overlay b/tests/drivers/dma/loop_transfer/boards/max78002evkit_max78002_m4.overlay new file mode 100644 index 0000000000000..63d2081230924 --- /dev/null +++ b/tests/drivers/dma/loop_transfer/boards/max78002evkit_max78002_m4.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +tst_dma0: &dma0 { }; diff --git a/tests/drivers/flash/common/boards/max78002evkit_max78002_m4.overlay b/tests/drivers/flash/common/boards/max78002evkit_max78002_m4.overlay new file mode 100644 index 0000000000000..08546f0fbcc0e --- /dev/null +++ b/tests/drivers/flash/common/boards/max78002evkit_max78002_m4.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + code_partition: partition@0 { + reg = <0x0 DT_SIZE_M(2)>; + read-only; + }; + + storage_partition: partition@200000 { + label = "storage"; + reg = <0x200000 DT_SIZE_K(512)>; + }; + }; +}; diff --git a/tests/drivers/gpio/gpio_basic_api/boards/max78002evkit_max78002_m4.overlay b/tests/drivers/gpio/gpio_basic_api/boards/max78002evkit_max78002_m4.overlay new file mode 100644 index 0000000000000..79684b32850b4 --- /dev/null +++ b/tests/drivers/gpio/gpio_basic_api/boards/max78002evkit_max78002_m4.overlay @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + resources { + compatible = "test-gpio-basic-api"; + out-gpios = <&gpio0 8 0>; + in-gpios = <&gpio0 9 0>; + }; +}; diff --git a/tests/drivers/i2c/i2c_target_api/boards/max78002evkit_max78002_m4.conf b/tests/drivers/i2c/i2c_target_api/boards/max78002evkit_max78002_m4.conf new file mode 100644 index 0000000000000..e0db436dce49c --- /dev/null +++ b/tests/drivers/i2c/i2c_target_api/boards/max78002evkit_max78002_m4.conf @@ -0,0 +1,7 @@ +# +# Copyright (c) 2024 Analog Devices, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +CONFIG_I2C_VIRTUAL=n +CONFIG_I2C_MAX32_DMA=y diff --git a/tests/drivers/i2c/i2c_target_api/boards/max78002evkit_max78002_m4.overlay b/tests/drivers/i2c/i2c_target_api/boards/max78002evkit_max78002_m4.overlay new file mode 100644 index 0000000000000..a9f92661ab2bc --- /dev/null +++ b/tests/drivers/i2c/i2c_target_api/boards/max78002evkit_max78002_m4.overlay @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&i2c0 { + dmas = <&dma0 0 MAX78_DMA_SLOT_I2C0_TX>, <&dma0 1 MAX78_DMA_SLOT_I2C0_RX>; + dma-names = "tx", "rx"; + + eeprom0: eeprom@54 { + compatible = "zephyr,i2c-target-eeprom"; + reg = <0x54>; + address-width = <16>; + size = <1024>; + }; +}; + +&i2c1 { + status = "okay"; + pinctrl-0 = <&i2c1_scl_p0_16 &i2c1_sda_p0_17>; + pinctrl-names = "default"; + + dmas = <&dma0 2 MAX78_DMA_SLOT_I2C1_TX>, <&dma0 3 MAX78_DMA_SLOT_I2C1_RX>; + dma-names = "tx", "rx"; + + eeprom1: eeprom@56 { + compatible = "zephyr,i2c-target-eeprom"; + reg = <0x56>; + address-width = <16>; + size = <1024>; + }; +}; diff --git a/tests/drivers/pwm/pwm_api/boards/max78002evkit_max78002_m4.overlay b/tests/drivers/pwm/pwm_api/boards/max78002evkit_max78002_m4.overlay new file mode 100644 index 0000000000000..ce8d1f3596427 --- /dev/null +++ b/tests/drivers/pwm/pwm_api/boards/max78002evkit_max78002_m4.overlay @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + aliases { + pwm-0 = &pwm0; + }; +}; + +&tmr0a_ioa_p0_2 { + power-source=; +}; + +&timer0 { + status = "okay"; + pwm0: pwm { + status = "okay"; + pinctrl-0 = <&tmr0a_ioa_p0_2>; + pinctrl-names = "default"; + }; +}; diff --git a/tests/drivers/spi/spi_loopback/boards/max78002evkit_max78002_m4.conf b/tests/drivers/spi/spi_loopback/boards/max78002evkit_max78002_m4.conf new file mode 100644 index 0000000000000..b407e37588528 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/max78002evkit_max78002_m4.conf @@ -0,0 +1,7 @@ +# +# Copyright (c) 2024 Analog Devices, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +CONFIG_SPI_ASYNC=y +CONFIG_SPI_MAX32_INTERRUPT=y diff --git a/tests/drivers/spi/spi_loopback/boards/max78002evkit_max78002_m4.overlay b/tests/drivers/spi/spi_loopback/boards/max78002evkit_max78002_m4.overlay new file mode 100644 index 0000000000000..fa8cacb2dc5f4 --- /dev/null +++ b/tests/drivers/spi/spi_loopback/boards/max78002evkit_max78002_m4.overlay @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&spi0 { + dmas = <&dma0 1 MAX78_DMA_SLOT_SPI0_TX>, <&dma0 2 MAX78_DMA_SLOT_SPI0_RX>; + dma-names = "tx", "rx"; + + slow@0 { + compatible = "test-spi-loopback-slow"; + reg = <0>; + spi-max-frequency = <128000>; + }; + fast@0 { + compatible = "test-spi-loopback-fast"; + reg = <0>; + spi-max-frequency = <500000>; + }; +}; diff --git a/tests/drivers/w1/w1_api/boards/max78002evkit_max78002_m4.overlay b/tests/drivers/w1/w1_api/boards/max78002evkit_max78002_m4.overlay new file mode 100644 index 0000000000000..5682981dc4a23 --- /dev/null +++ b/tests/drivers/w1/w1_api/boards/max78002evkit_max78002_m4.overlay @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +w1_0: &w1 { + status = "okay"; + internal-pullup = <1>; +}; + +#include "../w1_devices.dtsi" diff --git a/tests/drivers/w1/w1_api/testcase.yaml b/tests/drivers/w1/w1_api/testcase.yaml index 8c46280e60c7c..cc5e510f5e3cf 100644 --- a/tests/drivers/w1/w1_api/testcase.yaml +++ b/tests/drivers/w1/w1_api/testcase.yaml @@ -46,3 +46,4 @@ tests: - max32666evkit/max32666/cpu0 - max32680evkit/max32680/m4 - max32690evkit/max32690/m4 + - max78002evkit/max78002/m4 From 9bb46e64171147e7326ebb3938efd1a4175e59f7 Mon Sep 17 00:00:00 2001 From: Furkan Akkiz Date: Tue, 3 Sep 2024 11:29:40 +0300 Subject: [PATCH 2589/4482] samples: drivers: Add MAX78002EVKIT sample overlay files Enable counter/alarm sample for MAX780002EVKIT. Signed-off-by: Furkan Akkiz --- .../alarm/boards/max78002evkit_max78002_m4.overlay | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 samples/drivers/counter/alarm/boards/max78002evkit_max78002_m4.overlay diff --git a/samples/drivers/counter/alarm/boards/max78002evkit_max78002_m4.overlay b/samples/drivers/counter/alarm/boards/max78002evkit_max78002_m4.overlay new file mode 100644 index 0000000000000..c06949da83768 --- /dev/null +++ b/samples/drivers/counter/alarm/boards/max78002evkit_max78002_m4.overlay @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2024 Analog Devices, Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&timer0 { + status = "okay"; + counter0: counter { + status = "okay"; + }; +}; From 4c7d86a8b5c70a3d2670b110dc281e7b0485f105 Mon Sep 17 00:00:00 2001 From: Simon Hein Date: Fri, 19 Jan 2024 09:17:12 +0100 Subject: [PATCH 2590/4482] sca: Add ECLAIR SCA configuration files. Add the Eclair configuration files, which are needed to configure the static code analysis tool for the zephyr coding guidelines. Signed-off-by: Simon Hein --- cmake/sca/eclair/ECL/adopted_code.ecl | 7 + cmake/sca/eclair/ECL/adopted_deviations.ecl | 43 +++++++ cmake/sca/eclair/ECL/analysis.ecl | 13 ++ cmake/sca/eclair/ECL/analysis_HIS.ecl | 21 +++ cmake/sca/eclair/ECL/analysis_STU.ecl | 115 +++++++++++++++++ cmake/sca/eclair/ECL/analysis_WP.ecl | 32 +++++ .../eclair/ECL/analysis_first_analysis.ecl | 21 +++ cmake/sca/eclair/ECL/analysis_heavy_STU.ecl | 23 ++++ cmake/sca/eclair/ECL/analysis_std_lib.ecl | 28 ++++ cmake/sca/eclair/ECL/call_properties.ecl | 81 ++++++++++++ cmake/sca/eclair/ECL/extra.ecl | 74 +++++++++++ cmake/sca/eclair/ECL/language_extensions.ecl | 7 + cmake/sca/eclair/ECL/out_of_initial_scope.ecl | 12 ++ cmake/sca/eclair/ECL/reports.ecl | 57 +++++++++ cmake/sca/eclair/ECL/toolchain.ecl | 85 ++++++++++++ cmake/sca/eclair/ECL/zephyr_common_config.ecl | 121 ++++++++++++++++++ 16 files changed, 740 insertions(+) create mode 100644 cmake/sca/eclair/ECL/adopted_code.ecl create mode 100644 cmake/sca/eclair/ECL/adopted_deviations.ecl create mode 100644 cmake/sca/eclair/ECL/analysis.ecl create mode 100644 cmake/sca/eclair/ECL/analysis_HIS.ecl create mode 100644 cmake/sca/eclair/ECL/analysis_STU.ecl create mode 100644 cmake/sca/eclair/ECL/analysis_WP.ecl create mode 100644 cmake/sca/eclair/ECL/analysis_first_analysis.ecl create mode 100644 cmake/sca/eclair/ECL/analysis_heavy_STU.ecl create mode 100644 cmake/sca/eclair/ECL/analysis_std_lib.ecl create mode 100644 cmake/sca/eclair/ECL/call_properties.ecl create mode 100644 cmake/sca/eclair/ECL/extra.ecl create mode 100644 cmake/sca/eclair/ECL/language_extensions.ecl create mode 100644 cmake/sca/eclair/ECL/out_of_initial_scope.ecl create mode 100644 cmake/sca/eclair/ECL/reports.ecl create mode 100644 cmake/sca/eclair/ECL/toolchain.ecl create mode 100644 cmake/sca/eclair/ECL/zephyr_common_config.ecl diff --git a/cmake/sca/eclair/ECL/adopted_code.ecl b/cmake/sca/eclair/ECL/adopted_code.ecl new file mode 100644 index 0000000000000..efd884e844f4c --- /dev/null +++ b/cmake/sca/eclair/ECL/adopted_code.ecl @@ -0,0 +1,7 @@ +-doc_begin="This header file is automatically generated by Autoconf." +-file_tag+={adopted,"^zephyr/build/zephyr/include/generated/autoconf\\.h$"} +-doc_end + +-doc_begin="These files are automatically generated by gperf." +-file_tag+={adopted,"^zephyr/build/zephyr/kobject_.*\\.c$"} +-doc_end diff --git a/cmake/sca/eclair/ECL/adopted_deviations.ecl b/cmake/sca/eclair/ECL/adopted_deviations.ecl new file mode 100644 index 0000000000000..7279c2de3bd36 --- /dev/null +++ b/cmake/sca/eclair/ECL/adopted_deviations.ecl @@ -0,0 +1,43 @@ +-setq=CPP_MANUAL,"https://gcc.gnu.org/onlinedocs/gcc-10.3.0/cpp.pdf" + +-doc="Selection for reports that are fully contained in adopted code." +-report_selector+={adopted_report,"all_area(!kind(culprit||evidence)||all_loc(all_exp(adopted||pseudo)))"} + +-doc_begin="Adopted code is not meant to be read, reviewed or modified by human programmers:no developers' confusion is not possible. In addition, adopted code is assumed to work as is. Reports that are fully contained in adopted code are hidden/tagged with the 'adopted' tag." +-config=MC3R1.R7.2,reports+={relied,adopted_report} +-config=MC3R1.R10.3,reports+={relied,adopted_report} +-config=MC3R1.R10.6,reports+={relied,adopted_report} +-config=MC3R1.R12.1,reports+={relied,adopted_report} +-doc_end + +-doc_begin="Macro LOAPIC_BASE_ADDRESS, automatically generated by Autoconf, expands to an implicitly unsigned literal lacking the 'u' or 'U' suffix." +-config=MC3R1.R7.2,reports+={safe,"all_area(all_loc(any_exp(macro(^assert$))))"} +-doc_end + +-doc="#include_next is a documented GNU preprocessing directive. See section \"2.7 Wrapper Headers\" of "CPP_MANUAL"" +-config=STD.prepdirc,directives+={safe,"^include_next$"} +-doc="#warning is a documented GNU preprocessing directive. See section \"5 Diagnostics\" of "CPP_MANUAL"" +-config=STD.prepdirc,directives+={safe,"^warning$"} + +-doc="The declarations in files tagged with api:public define a public API of Zephyr. +Declarations in these files not necessarily have to be referenced." +-config=MC3R1.R2.3,declarations+={safe,"loc(top(public()))"} + +-doc="Library entry points not necessarily have to be referenced." +-config=MC3R1.R2.1,declarations+={safe,"loc(top(public()))"} + +-doc="Library entry points not necessarily have to be referenced in more than one translation units." +-config=MC3R1.R8.7,declarations+={safe,"loc(top(public()))"} + +-doc="Syscall declarations are automatically generated all with the extern qualifier. For the ones with internal linkage the use of the extern qualifier is a violation of rule 8.8." +-config=MC3R1.R8.8,declarations={relied, "^z_vrfy_.*$||^z_impl_.*$"} + +-doc="Function hash, that is automatically generated, does not use the parameter \"len\" in all its definitions." +-config=MC3R1.R2.7,declarations+={relied,"context(^hash\\(const char\\*, size_t\\)$)&&name(len)"} + +-doc="Function \"z_object_lookup\", that is automatically generated, uses single-statement bodies not enclosed in braces." +-config=MC3R1.R15.6,reports={relied, "all_area(context(^z_object_lookup\\(const char\\*, size_t\\)$))"} + +-doc="The following declarations are in generated files: not in all configuration they are implemented. + Chainging the generators could be dangerous and the advantages in enforcing the rule do not outweight these dangers." +-config=MC3R1.R8.6,declarations+={safe, "loc(top(file(^zephyr/build/zephyr/include/generated/.*$)))"} diff --git a/cmake/sca/eclair/ECL/analysis.ecl b/cmake/sca/eclair/ECL/analysis.ecl new file mode 100644 index 0000000000000..118c069ca42c5 --- /dev/null +++ b/cmake/sca/eclair/ECL/analysis.ecl @@ -0,0 +1,13 @@ +-project_name=getenv("ECLAIR_PROJECT_NAME") +-project_root=getenv("ECLAIR_PROJECT_ROOT") +-setq=data_dir,getenv("ECLAIR_DATA_DIR") +-setq=set,getenv("ECLAIR_RULESET") + +-enable=B.REPORT.ECB +-config=B.REPORT.ECB,output=join_paths(data_dir,"FRAME.@FRAME@.ecb") +-config=B.REPORT.ECB,preprocessed=show +-config=B.REPORT.ECB,macros=10 + +-enable=B.EXPLAIN + +-eval_file=toolchain.ecl diff --git a/cmake/sca/eclair/ECL/analysis_HIS.ecl b/cmake/sca/eclair/ECL/analysis_HIS.ecl new file mode 100644 index 0000000000000..9ef829f8b92ce --- /dev/null +++ b/cmake/sca/eclair/ECL/analysis_HIS.ecl @@ -0,0 +1,21 @@ +# This file must be named analyze_.ecl, where is the first +# argument of analyze.sh. +# +# The aim of this file is to define the analysis configuration for . +# +# The essential portions of this file are marked with "# NEEDED": +# they may be adapted of course. + +# Enable the desired metrics. +-enable=MET.HIS.COMF +-enable=MET.HIS.PATH +-enable=MET.HIS.GOTO +-enable=MET.HIS.v_G +-enable=MET.HIS.CALLING +-enable=MET.HIS.CALLS +-enable=MET.HIS.PARAM +-enable=MET.HIS.STMT +-enable=MET.HIS.LEVEL +-enable=MET.HIS.RETURN +-enable=MET.HIS.VOCF +-enable=MET.HIS.ap_cg_cycle diff --git a/cmake/sca/eclair/ECL/analysis_STU.ecl b/cmake/sca/eclair/ECL/analysis_STU.ecl new file mode 100644 index 0000000000000..ce205b0c8c156 --- /dev/null +++ b/cmake/sca/eclair/ECL/analysis_STU.ecl @@ -0,0 +1,115 @@ +# This file must be named analyze_.ecl, where is the first +# argument of analyze.sh. +# +# The aim of this file is to define the analysis configuration for . +# +# The essential portions of this file are marked with "# NEEDED": +# they may be adapted of course. + +-eval_file=zephyr_common_config.ecl + +-doc_begin="Selection of guidelines from +https://docs.zephyrproject.org/latest/guides/coding_guidelines/index.html" +-enable=MC3R1.D4.13 +-enable=MC3R1.D4.2 +-enable=MC3R1.D4.4 +-enable=MC3R1.D4.5 +-enable=MC3R1.D4.8 +-enable=MC3R1.D4.11 +-enable=MC3R1.D4.12 +-enable=MC3R1.D4.14 +-enable=MC3R1.D4.7 +-enable=MC3R1.R10.5 +-enable=MC3R1.R10.2 +-enable=MC3R1.R10.6 +-enable=MC3R1.R10.7 +-enable=MC3R1.R10.8 +-enable=MC3R1.R1.2 +-enable=MC3R1.R1.3 +-enable=MC3R1.R12.4 +-enable=MC3R1.R12.5 +-enable=MC3R1.R12.2 +-enable=MC3R1.R13.4 +-enable=MC3R1.R13.1 +-enable=MC3R1.R13.2 +-enable=MC3R1.R13.5 +-enable=MC3R1.R13.6 +-enable=MC3R1.R18.5 +-enable=MC3R1.R18.1 +-enable=MC3R1.R18.2 +-enable=MC3R1.R18.3 +-enable=MC3R1.R18.6 +-enable=MC3R1.R18.8 +-enable=MC3R1.R21.11 +-enable=MC3R1.R21.13 +-enable=MC3R1.R21.17 +-enable=MC3R1.R21.18 +-enable=MC3R1.R21.19 +-enable=MC3R1.R21.20 +-enable=MC3R1.R2.7 +-enable=MC3R1.R2.2 +-enable=MC3R1.R4.2 +-enable=MC3R1.R4.1 +-enable=MC3R1.R17.3 +-enable=MC3R1.R17.4 +-enable=MC3R1.R17.6 +-enable=MC3R1.R17.1 +-enable=MC3R1.R17.5 +-enable=MC3R1.R19.1 +-enable=MC3R1.R22.2 +-enable=MC3R1.R22.5 +-enable=MC3R1.R22.6 +-enable=MC3R1.R9.1 +-enable=MC3R1.R9.2 +-enable=MC3R1.R9.3 +-enable=MC3R1.R9.4 +-enable=MC3R1.R9.5 +-enable=MC3R1.D2.1 +-enable=MC3R1.R11.2 +-enable=MC3R1.R11.6 +-enable=MC3R1.R11.7 +-enable=MC3R1.R11.8 +-enable=MC3R1.R11.9 +-enable=MC3R1.R14.1 +-enable=MC3R1.R14.2 +-enable=MC3R1.R14.3 +-enable=MC3R1.R15.2 +-enable=MC3R1.R15.3 +-enable=MC3R1.R15.6 +-enable=MC3R1.R15.7 +-enable=MC3R1.R16.1 +-enable=MC3R1.R16.2 +-enable=MC3R1.R16.3 +-enable=MC3R1.R16.4 +-enable=MC3R1.R16.5 +-enable=MC3R1.R16.6 +-enable=MC3R1.R16.7 +-enable=MC3R1.R20.11 +-enable=MC3R1.R20.12 +-enable=MC3R1.R20.13 +-enable=MC3R1.R20.14 +-enable=MC3R1.R20.2 +-enable=MC3R1.R20.3 +-enable=MC3R1.R20.4 +-enable=MC3R1.R20.8 +-enable=MC3R1.R20.9 +-enable=MC3R1.R3.1 +-enable=MC3R1.R3.2 +-enable=MC3R1.R5.2 +-enable=MC3R1.R5.3 +-enable=MC3R1.R5.4 +-enable=MC3R1.R5.5 +-enable=MC3R1.R6.1 +-enable=MC3R1.R6.2 +-enable=MC3R1.R7.1 +-enable=MC3R1.R7.2 +-enable=MC3R1.R7.3 +-enable=MC3R1.R7.4 +-enable=MC3R1.R8.1 +-enable=MC3R1.R8.10 +-enable=MC3R1.R8.12 +-enable=MC3R1.R8.14 +-enable=MC3R1.R8.2 +-enable=MC3R1.R8.4 +-enable=MC3R1.R8.8 +-doc_end diff --git a/cmake/sca/eclair/ECL/analysis_WP.ecl b/cmake/sca/eclair/ECL/analysis_WP.ecl new file mode 100644 index 0000000000000..eec57e979f70d --- /dev/null +++ b/cmake/sca/eclair/ECL/analysis_WP.ecl @@ -0,0 +1,32 @@ +# This file must be named analyze_.ecl, where is the first +# argument of analyze.sh. +# +# The aim of this file is to define the analysis configuration for . +# +# The essential portions of this file are marked with "# NEEDED": +# they may be adapted of course. + +-eval_file=zephyr_common_config.ecl + +-doc_begin="Selection of guidelines from +https://docs.zephyrproject.org/latest/guides/coding_guidelines/index.html" +-enable=MC3R1.R2.3 +-enable=MC3R1.R2.1 +-enable=MC3R1.R5.9 +-enable=MC3R1.R5.1 +-enable=MC3R1.R5.6 +-enable=MC3R1.R5.7 +-enable=MC3R1.R5.8 +-enable=MC3R1.R8.9 +-enable=MC3R1.R8.3 +-enable=MC3R1.R8.5 +-enable=MC3R1.R8.6 +-enable=MC3R1.R22.4 +-enable=MC3R1.R22.3 +-enable=MC3R1.D1.1 +-enable=MC3R1.D3.1 +-enable=MC3R1.D4.1 +-enable=MC3R1.D4.10 +-enable=MC3R1.R17.2 +-enable=MC3R1.R17.7 +-doc_end diff --git a/cmake/sca/eclair/ECL/analysis_first_analysis.ecl b/cmake/sca/eclair/ECL/analysis_first_analysis.ecl new file mode 100644 index 0000000000000..cab0da1225e12 --- /dev/null +++ b/cmake/sca/eclair/ECL/analysis_first_analysis.ecl @@ -0,0 +1,21 @@ +# This file must be named analyze_.ecl, where is the first +# argument of analyze.sh. +# +# The aim of this file is to define the analysis configuration for . +# +# The essential portions of this file are marked with "# NEEDED": +# they may be adapted of course. + +-eval_file=zephyr_common_config.ecl + +-doc_begin="Selection of guidelines from +https://docs.zephyrproject.org/latest/guides/coding_guidelines/index.html" +-enable=MC3R1.R8.2 +-enable=MC3R1.R10.2 +-enable=MC3R1.R10.5 +-enable=MC3R1.R10.6 +-enable=MC3R1.R11.2 +-enable=MC3R1.R12.4 +-enable=MC3R1.R13.4 +-enable=MC3R1.R16.1 +-doc_end diff --git a/cmake/sca/eclair/ECL/analysis_heavy_STU.ecl b/cmake/sca/eclair/ECL/analysis_heavy_STU.ecl new file mode 100644 index 0000000000000..126becb391f4c --- /dev/null +++ b/cmake/sca/eclair/ECL/analysis_heavy_STU.ecl @@ -0,0 +1,23 @@ +# This file must be named analyze_.ecl, where is the first +# argument of analyze.sh. +# +# The aim of this file is to define the analysis configuration for . +# +# The essential portions of this file are marked with "# NEEDED": +# they may be adapted of course. + +-eval_file=zephyr_common_config.ecl + +-doc_begin="Selection of guidelines from +https://docs.zephyrproject.org/latest/guides/coding_guidelines/index.html" +-enable=MC3R1.D4.6 +-enable=MC3R1.D4.9 +-enable=MC3R1.R12.1 +-enable=MC3R1.R13.3 +-enable=MC3R1.R2.6 +-enable=MC3R1.R10.1 +-enable=MC3R1.R10.3 +-enable=MC3R1.R10.4 +-enable=MC3R1.R14.4 +-enable=MC3R1.R20.7 +-doc_end diff --git a/cmake/sca/eclair/ECL/analysis_std_lib.ecl b/cmake/sca/eclair/ECL/analysis_std_lib.ecl new file mode 100644 index 0000000000000..5fb6263910b83 --- /dev/null +++ b/cmake/sca/eclair/ECL/analysis_std_lib.ecl @@ -0,0 +1,28 @@ +# This file must be named analyze_.ecl, where is the first +# argument of analyze.sh. +# +# The aim of this file is to define the analysis configuration for . +# +# The essential portions of this file are marked with "# NEEDED": +# they may be adapted of course. +-eval_file=zephyr_common_config.ecl + +-doc_begin="Selection of guidelines from +https://docs.zephyrproject.org/latest/guides/coding_guidelines/index.html" +-enable=MC3R1.R21.1 +-enable=MC3R1.R21.12 +-enable=MC3R1.R21.14 +-enable=MC3R1.R21.15 +-enable=MC3R1.R21.16 +-enable=MC3R1.R21.2 +-enable=MC3R1.R21.3 +-enable=MC3R1.R21.4 +-enable=MC3R1.R21.6 +-enable=MC3R1.R21.7 +-enable=MC3R1.R21.9 +-enable=MC3R1.R22.1 +-enable=MC3R1.R22.10 +-enable=MC3R1.R22.7 +-enable=MC3R1.R22.8 +-enable=MC3R1.R22.9 +-doc_end diff --git a/cmake/sca/eclair/ECL/call_properties.ecl b/cmake/sca/eclair/ECL/call_properties.ecl new file mode 100644 index 0000000000000..8e1c7a2e5dd0b --- /dev/null +++ b/cmake/sca/eclair/ECL/call_properties.ecl @@ -0,0 +1,81 @@ + +-call_properties+={"name(z_phys_map)", {"pointee_read(1=never)","pointee_write(1=always)","taken()"}} +-call_properties+={"name(pcie_get_mbar)", {"pointee_read(3=never)","pointee_write(3=maybe)","taken()"}} +-call_properties+={"name(k_mem_region_align)", { + "pointee_read(1..2=never)", + "pointee_write(1..2=always)","taken()" + }} +-call_properties+={"name(pentry_get)", { + "pointee_read(1..2=never&&3..4=always)", + "pointee_write(1..2=maybe&&3..4=never)" + }} +-call_properties+={"name(z_phys_unmap)", {"pointee_read(1=never)","pointee_write(1=never)"}} +-call_properties+={"name(check_sum)", {"pointee_read(1=always)","pointee_write(1=never)"}} +-call_properties+={"name(z_impl_device_get_binding)", {"pointee_read(1=maybe)","pointee_write(1=maybe)","taken()"}} +-call_properties+={"name(z_setup_new_thread)", {"pointee_read(10=maybe)","pointee_write(10=never)","taken()"}} +-call_properties+={"name(mbox_message_put)", {"pointee_read(3=always)","pointee_write(3=always)"}} +-doc_begin="The functions can be implemented using the GCC built-in functions. + See Section \"6.62.13 6.56 Built-in Functions to Perform Arithmetic with Overflow Checking\" of "GCC_MANUAL"." +-call_properties+={"name(size_mul_overflow)", {"pointee_read(3=never)","pointee_write(3=always)","taken()"}} +-call_properties+={"name(size_add_overflow)", {"pointee_read(3=never)","pointee_write(3=always)","taken()"}} +-call_properties+={"name(__builtin_mul_overflow)", {"pointee_read(3=never)","pointee_write(3=always)","taken()"}} +-call_properties+={"name(__builtin_add_overflow)", {"pointee_read(3=never)","pointee_write(3=always)","taken()"}} +-doc_end + +-call_properties+={"name(__builtin_va_end)", {"taken()"}} # Not documented in gcc.pdf +-call_properties+={"name(arch_page_phys_get)", {"pointee_read(2=never)","pointee_write(2=maybe)","taken()"}} +-call_properties+={"name(cbvprintf)", {"taken()"}} +-call_properties+={"name(cbvprintf)", {"taken()"}} +-call_properties+={"name(char2hex)", {"pointee_read(2=never)","pointee_write(2=maybe)"}} +-call_properties+={"name(find_and_stack)", {"pointee_read(3=never)","pointee_write(3=always)"}} +-call_properties+={"name(fix_missing_black)", {"pointee_read(1=always)","pointee_write(1=maybe)"}} +-call_properties+={"name(__get_cpuid)", {"pointee_read(2..5=never)","pointee_write(2..5=always)"}} +-call_properties+={"name(k_mutex_init)", {"pointee_read(1=never)","pointee_write(1=always)"}} +-call_properties+={"name(k_sem_init)", {"pointee_read(1=never)","pointee_write(1=maybe)"}} +-call_properties+={"name(k_work_init)", {"pointee_read(1=never)","pointee_write(1=always)"}} +-call_properties+={"name(k_work_init_delayable)", {"pointee_read(1=never)","pointee_write(1=always)"}} +-call_properties+={"name(k_work_queue_start)", {"taken()"}} +-call_properties+={"name(log_from_user)", {"pointee_write(1..=never)", "taken()"}} +-call_properties+={"name(log_n)", {"taken()"}} +-call_properties+={"name(log_string_sync)", {"pointee_write(1..=never)", "taken()"}} +-call_properties+={"name(match_region)", {"pointee_read(5..6=never)","pointee_write(5=always&&6=maybe)"}} +-call_properties+={"name(mbox_async_alloc)", {"pointee_read(1=never)","pointee_write(1=maybe)"}} +-call_properties+={"name(pipe_xfer_prepare)", {"pointee_read(2=never)","pointee_write(2=always)"}} +-call_properties+={"name(printk)", {"pointee_write(1..=never)", "taken()"}} +-call_properties+={"name(snprintk)", {"pointee_read(1=never)","pointee_write(1=always)", "taken()"}} # to check +-call_properties+={"name(snprintk)", {"taken()"}} +-call_properties+={"name(sys_bitarray_alloc)", {"pointee_read(3=never)","pointee_write(3=maybe)","taken()"}} +-call_properties+={"name(sys_slist_init)", {"pointee_read(1=never)","pointee_write(1=always)"}} +-call_properties+={"name(vprintk)", {"taken()"}} +-call_properties+={"name(z_dummy_thread_init)", {"pointee_read(1=never)","pointee_write(1=always)"}} # the function does not initialize all the fields +-call_properties+={"name(z_impl_k_stack_pop)", {"taken()"}} +-call_properties+={"name(z_impl_z_log_msg2_runtime_vcreate)", {"taken()"}} +-call_properties+={"name(z_log_minimal_printk)", {"pointee_write(1..=never)", "taken()"}} +-call_properties+={"name(z_log_msg2_runtime_create)", {"pointee_write(1..=never)", "taken()"}} +-call_properties+={"name(z_log_printk)", {"taken()"}} +-call_properties+={"name(z_log_printf_arg_checker)", {"pointee_write(1..=never)", "taken()"}} +-call_properties+={"name(z_log_strdup)", {"taken()"}} +-call_properties+={"name(z_rb_foreach_next)", {"taken()"}} +-call_properties+={"name(z_user_string_copy)", {"pointee_read(1=never)","pointee_write(1=maybe)","taken()"}} + +-doc_begin="These macros are designed to evaluate to either 0 or 1." +-call_properties+={"macro(name(UTIL_NOT))",{"data_kind(0=int_bool)"}} +-call_properties+={"macro(name(IS_ENABLED))",{"data_kind(0=int_bool)"}} +-call_properties+={"decl(name(isspace))",{"data_kind(0=int_bool)"}} +-call_properties+={"macro(name(isdigit))",{"data_kind(0=int_bool)"}} +-call_properties+={"decl(name(isdigit))",{"data_kind(0=int_bool)"}} +-call_properties+={"macro(name(isalpha))",{"data_kind(0=int_bool)"}} +-call_properties+={"decl(name(isalpha))",{"data_kind(0=int_bool)"}} +-call_properties+={"macro(name(isupper))",{"data_kind(0=int_bool)"}} +-call_properties+={"decl(name(isupper))",{"data_kind(0=int_bool)"}} +-doc_end + +-doc="__builtin_alloca cannot interfere with other effects." +-call_properties+={"decl(name(__builtin_alloca))",{"noeffect"}} + +-doc="log_strdup cannot interfere with other effects." +-call_properties+={"decl(name(log_strdup))",{"noeffect"}} + + +# Not documented functions +# device_map diff --git a/cmake/sca/eclair/ECL/extra.ecl b/cmake/sca/eclair/ECL/extra.ecl new file mode 100644 index 0000000000000..cab2a4e723600 --- /dev/null +++ b/cmake/sca/eclair/ECL/extra.ecl @@ -0,0 +1,74 @@ +-doc_begin="The following entities are defined in assembly files" +-extra_definitions+="name(x86_ap_start)" +-extra_definitions+="^z_x86_(exception|nmi|trampoline)_stack[1-3]?$" +-extra_definitions+="name(x86_sse_init)" +-extra_definitions+="name(z_x86_kernel_ptables)" +-extra_definitions+="name(z_x86_switch)" +-extra_definitions+="name(z_x86_syscall_entry_stub)" +-extra_definitions+="^(z_x86_user_string_nlen)_(fault_start|fault_end|fixup)\\(void\\)$" +-extra_definitions+="name(z_x86_userspace_enter)" +-extra_definitions+="name(arch_user_string_nlen)" +-doc_end + +-doc_begin="The following entities are defined from the linker." +-extra_definitions+="name(_locore_start)" +-extra_definitions+="name(_locore_end)" +-extra_definitions+="name(__kernel_ram_start)" +-extra_definitions+="name(__kernel_ram_end)" +-extra_definitions+="name(__kernel_ram_size)" +-extra_definitions+="name(_app_smem_start)" +-extra_definitions+="name(_app_smem_end)" +-extra_definitions+="name(_app_smem_size)" +-extra_definitions+="name(_app_smem_rom_start)" +-extra_definitions+="name(_app_smem_num_words)" +-extra_definitions+="name(__bss_start)" +-extra_definitions+="name(__bss_end)" +-extra_definitions+="name(__rom_region_start)" +-extra_definitions+="name(__rom_region_end)" +-extra_definitions+="name(__rom_region_size)" +-extra_definitions+="name(_flash_used)" +-extra_definitions+="name(_image_ram_start)" +-extra_definitions+="name(_image_ram_end)" +-extra_definitions+="name(__text_region_start)" +-extra_definitions+="name(__text_region_end)" +-extra_definitions+="name(__text_region_size)" +-extra_definitions+="name(__rodata_region_start)" +-extra_definitions+="name(__rodata_region_end)" +-extra_definitions+="name(__rodata_region_size)" +-extra_definitions+="name(_vector_start)" +-extra_definitions+="name(_vector_end)" +-extra_definitions+="name(_end)" +-extra_definitions+="name(__log_backends_start)" +-extra_definitions+="name(__log_backends_end)" +-extra_definitions+="name(__log_const_start)" +-extra_definitions+="name(__log_const_end)" +-extra_definitions+="name(__log_dynamic_start)" +-extra_definitions+="name(__log_dynamic_end)" +-extra_definitions+="name(__device_start)" +-extra_definitions+="name(__device_end)" +-extra_definitions+="name(__init_start)" +-extra_definitions+="name(__init_end)" +-extra_definitions+="name(z_shared_kernel_page_start)" +-extra_definitions+="name(z_priv_stacks_ram_start)" +-extra_definitions+="name(z_priv_stacks_ram_end)" +-extra_definitions+="name(z_user_stacks_start)" +-extra_definitions+="name(z_user_stacks_end)" +-extra_definitions+="name(z_kobject_data_begin)" +-extra_definitions+="name(__app_shmem_regions_start)" +-extra_definitions+="name(__app_shmem_regions_end)" +-extra_definitions+="name(_thread_idx_map)" +-extra_definitions+="name(z_data_smem_footprint_mem_partition_part_start)" +-extra_definitions+="name(z_data_smem_footprint_mem_partition_part_size)" +-extra_definitions+="name(z_data_smem_footprint_mem_partition_bss_start)" +-extra_definitions+="name(z_data_smem_footprint_mem_partition_bss_size)" +-extra_definitions+="name(z_object_gperf_find)" +-extra_definitions+="name(z_object_gperf_wordlist_foreach)" +-extra_definitions+="name(_z_object_assignment_list_start)" +-extra_definitions+="name(_z_object_assignment_list_end)" +-doc_end + +-doc="Entities created with Z_LINK_ITERABLE in linker.ld" +-extra_definitions+="^_(_static_thread_data|k_timer|k_mem_slab|k_mem_pool|k_heap|k_mutex|k_stack|k_msgq|k_mbox|k_pipe|k_sem|k_queue)_list_(start|end)$" + +-extra_definitions+="^z_mapped_(start|end)$" +-extra_definitions+="^__init_(PRE_KERNEL_[12]|POST_KERNEL|APPLICATION|SMP)_start$" diff --git a/cmake/sca/eclair/ECL/language_extensions.ecl b/cmake/sca/eclair/ECL/language_extensions.ecl new file mode 100644 index 0000000000000..f00bfca7c6ab6 --- /dev/null +++ b/cmake/sca/eclair/ECL/language_extensions.ecl @@ -0,0 +1,7 @@ +-doc_begin="The following extension have been approved." +-config=MC3R1.R1.2,behaviors+={hide,"service(STD.tokenext)&&category(^(__asm__|__attribute__|__typeof__|__builtin_types_compatible_p|__volatile__|__alignof|__alignof__|__const__|__inline|_Generic|_Static_assert|__auto_type)$)"} +-config=MC3R1.R1.2,behaviors+={hide,"service(^STD.(stmtexpr|vptrarth|emptinit|emptrecd|arayzero|funojptr)$)"} +-config=MC3R1.R1.2,behaviors+={hide,"service(STD.nonstdc)&&category(^GCC diagnostic (push|pop|ignored \"-W.*\")$)"} +-config=MC3R1.R1.2,behaviors+={hide,"service(STD.freestlb)&&category(^(string|fcntl|time|errno|ctype|stdio|inttypes|stdlib).h$)"} +-config=MC3R1.R1.2,behaviors+={hide,"service(STD.diag)&&category(^(ext_missing_varargs_arg|ext_paste_comma|ext_flexible_array_in_array|ext_auto_type)$)"} +-doc_end diff --git a/cmake/sca/eclair/ECL/out_of_initial_scope.ecl b/cmake/sca/eclair/ECL/out_of_initial_scope.ecl new file mode 100644 index 0000000000000..637d09522569d --- /dev/null +++ b/cmake/sca/eclair/ECL/out_of_initial_scope.ecl @@ -0,0 +1,12 @@ +-doc_begin="Derived from Flavio Ceolin email of July 23rd, 2021." +-file_tag+={out_of_initial_scope, "^zephyr/samples/.*$"} +-file_tag+={out_of_initial_scope, "^.*\\.cpp$"} +-file_tag+={out_of_initial_scope, "^zephyr/tests/.*$"} +-file_tag+={out_of_initial_scope, "^zephyr/build/zephyr/include/generated/autoconf\\.h$"} +-file_tag+={out_of_initial_scope, "^zephyr/drivers/.*/.*$"} +-file_tag+={out_of_initial_scope, "^zephyr/lib/libc/.*$"} +-file_tag+={out_of_initial_scope, "^zephyr/lib/crc/.*$"} +-file_tag+={out_of_initial_scope, "^zephyr/subsys/(fb|fs|app_memory|fs|blueooth|console|cpp|debug|dfu|disk|fb|fs|mgmt|net|random|settings|shell|stats|storage|usb)/.*$"} +-file_tag+={out_of_initial_scope, "^zephyr/build/CMakeFiles/.*$"} +-file_tag+={external,out_of_initial_scope} +-doc_end diff --git a/cmake/sca/eclair/ECL/reports.ecl b/cmake/sca/eclair/ECL/reports.ecl new file mode 100644 index 0000000000000..cd386322ed837 --- /dev/null +++ b/cmake/sca/eclair/ECL/reports.ecl @@ -0,0 +1,57 @@ +# eclair_report + +# This file must not be renamed: it is referenced by eclair-make.sh +# +# The aim of this file is to define the eclair_report configuration +# common to IDE analyses. + +quiet() + +# NEEDED: set the variable for the binary output directory from the environment +# variable. +setq(data_dir,getenv("ECLAIR_DATA_DIR")) + +# NEEDED: set the variable for the ECLAIR project database from the environment +# variable. +setq(ecd_file,getenv("ECLAIR_PROJECT_ECD")) + +# NEEDED: set the variable for the output directory from the environment +# variable. +setq(output_dir,getenv("ECLAIR_OUTPUT_DIR")) + +if(file_exists(ecd_file), + db(ecd_file), + create_db(ecd_file)) + +server_root("") +server("changing") + +setq(loaded_dir,join_paths(data_dir,"loaded")) +make_dirs(loaded_dir) + +# NEEDED: generate the ecd from frame files +strings_map("load_ecb",500,"",".+\\.ecb",0,setq(ecb,join_paths(data_dir,$0)),load(ecb),rename(ecb,join_paths(loaded_dir,$0))) +strings_map("load_ecb",500,"",".*",0) + +loading() +map_strings("load_ecb", dir_entries(data_dir)) +loaded() + +if(string_equal(or(getenv("TEXTUAL_REPORTS"),"false"),"true") + eval_file("report__textual.ecl")) + + +# Output report summaries in ODT format. +#-summary_odt=join_paths(output_dir,"odt") +# Output report summaries in ODT format. +#-summary_doc=join_paths(output_dir,"doc") +# Output report summaries in pure text format. +#-summary_txt=join_paths(output_dir,"txt") +# Output full report in pure text format. +#-full_txt=join_paths(output_dir,"txt") +# Output metrics for use with spreadsheet applications (if enabled). +#-metrics_tab=join_paths(output_dir,"metrics") +# Output reports for use with spreadsheet applications +#-reports_tab=join_paths(output_dir,"reports") + +server("changed") diff --git a/cmake/sca/eclair/ECL/toolchain.ecl b/cmake/sca/eclair/ECL/toolchain.ecl new file mode 100644 index 0000000000000..9b8393e30a3ae --- /dev/null +++ b/cmake/sca/eclair/ECL/toolchain.ecl @@ -0,0 +1,85 @@ +# get the toolchain compiler and version from the environment +-setq=used_compiler,getenv("CC_ALIASES") + +# Compilers. +-file_tag+={GCC,"^used_compiler$"} +# -file_tag+={GXX,"^/opt/zephyr-sdk-0\\.13\\.2/arm-zephyr-eabi/bin/arm-zephyr-eabi-g\\+\\+$"} + +# Manuals. +-setq=GCC_MANUAL,"https://gcc.gnu.org/onlinedocs/gcc-10.3.0/gcc.pdf" +-setq=CPP_MANUAL,"https://gcc.gnu.org/onlinedocs/gcc-10.3.0/cpp.pdf" +-setq=C99_STD,"ISO/IEC 9899:1999" + +-doc_begin=" + See Chapter \"6 Extensions to the C Language Family\" of "GCC_MANUAL": + __auto_type: see \"6.7 Referring to a Type with typeof\"; + __asm__: see \"6.48 Alternate Keywords\", and \"6.47 How to Use Inline Assembly Language in C Code\"; + __attribute__: see \"6.39 Attribute Syntax\"; + __typeof__: see \"6.7 Referring to a Type with typeof\"; + __builtin_types_compatible_p: see \"6.59 Other Built-in Functions Provided by GCC\"; + __volatile__: see \"6.48 Alternate Keywords\" and \"6.47.2.1 Volatile\"; + __alignof: see \"6.48 Alternate Keywords\" and \"6.44 Determining the Alignment of Functions, Types or +Variables\"; + __alignof__: see \"6.48 Alternate Keywords\" and \"6.44 Determining the Alignment of Functions, Types or +Variables\"; + __const__: see \"6.48 Alternate Keywords\"; + __inline: see \"6.48 Alternate Keywords\"; + _Generic: see description of option \"-Wc99-c11-compat\" in \"3.8 Options to Request or Suppress Warnings\". The compiler allows to C11 features in C99 mode; + _Static_assert: see descriptions of options \"-Wc99-c11-compat\" and \"-Wc99-c2x-compat\" in \"3.8 Options to Request or Suppress Warnings\". The compiler allows to use C11 and C2x features in C99 mode. +" +-config=STD.tokenext,behavior+={c99, GCC, "^(__auto_type|__asm__|__attribute__|__typeof__|__builtin_types_compatible_p|__volatile__|__alignof|__alignof__|__const__|__inline|_Generic|_Static_assert)$"} +-config=STD.tokenext,behavior+={c18, GCC, "^(__attribute__|__asm__|__const__|__volatile__|__inline)$"} +-doc_end + +-doc="See Chapter \"6.7 Referring to a Type with typeof\". of "GCC_MANUAL"." +-config=STD.diag,diagnostics={safe,"^ext_auto_type$"} +-doc="See Chapter \"6.1 Statements and Declarations in Expressions\" of "GCC_MANUAL"." +-config=STD.stmtexpr,behavior+={c99,GCC,specified} +-doc="See Chapter \"6.24 Arithmetic on void- and Function-Pointers\" of "GCC_MANUAL"." +-config=STD.vptrarth,behavior={c99,GCC,specified} +-doc_begin=" + ext_missing_varargs_arg: non-documented GCC extension. + ext_paste_comma: see Chapter \"6.21 Macros with a Variable Number of Arguments.\" of "GCC_MANUAL". + ext_flexible_array_in_array: see Chapter \"6.18 Arrays of Length Zero\" of "GCC_MANUAL". +" +-config=STD.diag,behavior+={c99,GCC,"^(ext_missing_varargs_arg|ext_paste_comma|ext_flexible_array_in_array)$"} +-config=STD.diag,behavior+={c18,GCC,"^(ext_missing_varargs_arg)$"} +-doc_end +-doc_begin="Non-documented GCC extension" +-config=STD.emptinit,behavior={c99,GCC,specified} +-config=STD.emptinit,behavior={c18,GCC,specified} +-doc_end +-doc_begin="See Chapter \"6.19 Structures with No Members\" of "GCC_MANUAL"." +-config=STD.emptrecd,behavior={c99,GCC,specified} +-config=STD.emptrecd,behavior={c18,GCC,specified} +-doc_end +-doc="See Chapter \"6.18 Arrays of Length Zero\" of "GCC_MANUAL"." +-config=STD.arayzero,behavior={c99,GCC,specified} + +-config=STD.inclnest,behavior+={c99, GCC, 24} +-config=STD.ppifnest,behavior+={c99, GCC, 32} +-config=STD.macident,behavior+={c99, GCC, 4096} + +-doc_begin="Allowed headers in freestanding mode." +-config=STD.freestlb,behavior+={c99,GCC,"^(string|fcntl|time|errno|ctype|stdio|inttypes|stdlib).h$"} +-config=STD.freestlb,behavior+={c18,GCC,"^(string|errno|inttypes).h$"} +-doc_end + +-doc_begin="See Annex \"J.5.7 Function pointer casts\" of "C99_STD"." +-config=STD.funojptr,behavior={c99,GCC,specified} +-doc_end + +-doc_begin="The maximum size of an object is defined in the MAX_SIZE macro, and for a 32 bit architecture is 8MB. + The maximum size for an array is defined in the PTRDIFF_MAX and in a 32 bit architecture is 2^30-1." +-config=STD.byteobjt,behavior={c99, GCC, 8388608} +-doc_end + +-doc_begin="See Section \"6.62.13 Diagnostic Pragmas\" of "GCC_MANUAL"." +-config=STD.nonstdc,behavior+={c99, GCC, "^GCC diagnostic (push|pop|ignored \"-W.*\")$"} +-config=STD.nonstdc,behavior+={c18, GCC, "^GCC diagnostic (push|pop|ignored \"-W.*\")$"} +-doc_end + +-doc_begin="See Section \"4.9 Structures, Unions, Enumerations, and Bit-Fields\" of "GCC_MANUAL". Other integer types, such as long int, and enumerated types are permitted even in strictly conforming mode." +-config=STD.bitfldtp,behavior+={c99, GCC, "unsigned char||unsigned short"} +-config=STD.bitfldtp,behavior+={c18, GCC, "unsigned char||unsigned short"} +-doc_end diff --git a/cmake/sca/eclair/ECL/zephyr_common_config.ecl b/cmake/sca/eclair/ECL/zephyr_common_config.ecl new file mode 100644 index 0000000000000..38168274cdf6a --- /dev/null +++ b/cmake/sca/eclair/ECL/zephyr_common_config.ecl @@ -0,0 +1,121 @@ +-eval_file=out_of_initial_scope.ecl +-eval_file=language_extensions.ecl +-eval_file=call_properties.ecl +-eval_file=extra.ecl + +-doc="Hides all reports that have all areas out of scope." +-reports+={hide,all_exp_external} + +-doc="The API interface files are allowed to contain unused macros." +-config=MC3R1.R2.5,reports+={hide, "any_area(macro(loc(top(public()||kind(pseudo)))))"} + +-doc="Several header files are meant to be included in C as well as in C++ translation units." +-config=MC3R1.R20.1,exception=extern_C + +-default_call_properties+="pointee_read(1..=never)" +-default_call_properties+="pointee_write(1..=always)" +-default_call_properties+="taken()" + +-doc_begin="These macros pass its first argument in a safe way to related compiler intrinsics." +-config=MC3R1.R20.7,macros={safe,"^(va_start||va_arg)$"} +-doc_end + +-doc_begin="The value-preserving conversions of integer constants are safe" +-config=MC3R1.R10.1,etypes={safe,"any()","preserved_integer_constant()"} +-config=MC3R1.R10.3,etypes={safe,"any()","preserved_integer_constant()"} +-config=MC3R1.R10.4,etypes={safe,"any()","preserved_integer_constant()||sibling(rhs,preserved_integer_constant())"} +-doc_end + +-doc_begin="Some macros are deliberately compile-time constants due to project configurability." +-macro_selector={const_wrapper_macros,"name(CONSTEXPR)"} +-config=MC3R1.R14.3,statements={safe, "node(if_stmt||conditional_operator)&&child(cond,wrapped(node(paren_expr)&&!macro(const_wrapper_macros), macro(const_wrapper_macros)))"} +-doc_end + +-doc="Casts to log_arg_t in logging macros are safe and expected." +-config=MC3R1.R11.6,reports+={deliberate,"any_area(any_loc(any_exp(macro(name(__LOG_ARG_CAST)))))"} + +-doc_begin="The following function-like macros are not writable as inline functions." +-config=MC3R1.D4.9,macros+={deliberate,"name(ARG_UNUSED)"} +-config=MC3R1.D4.9,macros+={deliberate,"name(CONSTEXPR)"} +-config=MC3R1.D4.9,macros+={deliberate,"name(compiler_barrier)"} +-config=MC3R1.D4.9,macros+={deliberate,"name(likely)"} +-config=MC3R1.D4.9,macros+={deliberate,"name(unlikely)"} +-doc_end + +-doc_begin="For the following function-like macros it should be decided whether substitution with equivalent static inline functions is wanted and feasible." +-config=MC3R1.D4.9,macros+={questionable,"name(ATOMIC_ELEM)"} +-config=MC3R1.D4.9,macros+={questionable,"name(ATOMIC_MASK)"} +-config=MC3R1.D4.9,macros+={questionable,"name(BIT32)"} +-config=MC3R1.D4.9,macros+={questionable,"name(BIT64)"} +-config=MC3R1.D4.9,macros+={questionable,"name(BIT64_MASK)"} +-config=MC3R1.D4.9,macros+={questionable,"name(BIT_MASK)"} +-config=MC3R1.D4.9,macros+={questionable,"name(DEVICE_MMIO_GET)"} +-config=MC3R1.D4.9,macros+={questionable,"name(DEVICE_MMIO_MAP)"} +-config=MC3R1.D4.9,macros+={questionable,"name(DEVICE_MMIO_RAM_PTR)"} +-config=MC3R1.D4.9,macros+={questionable,"name(IN)"} +-config=MC3R1.D4.9,macros+={questionable,"name(LOG_CORE_INIT)"} +-config=MC3R1.D4.9,macros+={questionable,"name(MAX)"} +-config=MC3R1.D4.9,macros+={questionable,"name(MB)"} +-config=MC3R1.D4.9,macros+={questionable,"name(MIN)"} +-config=MC3R1.D4.9,macros+={questionable,"name(OUT)"} +-config=MC3R1.D4.9,macros+={questionable,"name(PCIE_BDF)"} +-config=MC3R1.D4.9,macros+={questionable,"name(PCIE_BDF_TO_BUS)"} +-config=MC3R1.D4.9,macros+={questionable,"name(PCIE_CONF_BAR_64)"} +-config=MC3R1.D4.9,macros+={questionable,"name(PCIE_CONF_BAR_ADDR)"} +-config=MC3R1.D4.9,macros+={questionable,"name(PCIE_CONF_BAR_INVAL_FLAGS)"} +-config=MC3R1.D4.9,macros+={questionable,"name(PCIE_CONF_BAR_IO)"} +-config=MC3R1.D4.9,macros+={questionable,"name(PCIE_CONF_BAR_MEM)"} +-config=MC3R1.D4.9,macros+={questionable,"name(PCIE_CONF_CAPPTR_FIRST)"} +-config=MC3R1.D4.9,macros+={questionable,"name(PCIE_CONF_CAP_ID)"} +-config=MC3R1.D4.9,macros+={questionable,"name(PCIE_CONF_CAP_NEXT)"} +-config=MC3R1.D4.9,macros+={questionable,"name(PCIE_CONF_EXT_CAP_ID)"} +-config=MC3R1.D4.9,macros+={questionable,"name(PCIE_CONF_EXT_CAP_NEXT)"} +-config=MC3R1.D4.9,macros+={questionable,"name(PCIE_CONF_INTR_IRQ)"} +-config=MC3R1.D4.9,macros+={questionable,"name(POINTER_TO_UINT)"} +-config=MC3R1.D4.9,macros+={questionable,"name(ROUND_DOWN)"} +-config=MC3R1.D4.9,macros+={questionable,"name(ROUND_UP)"} +-config=MC3R1.D4.9,macros+={questionable,"name(UINT_TO_POINTER)"} +-config=MC3R1.D4.9,macros+={questionable,"name(Z_BOOT_VIRT_TO_PHYS)"} +-config=MC3R1.D4.9,macros+={questionable,"name(Z_IRQ_TO_INTERRUPT_VECTOR)"} +-config=MC3R1.D4.9,macros+={questionable,"name(Z_KERNEL_STACK_SIZE_ADJUST)"} +-config=MC3R1.D4.9,macros+={questionable,"name(Z_LOG_MSG2_ALIGNED_WLEN)"} +-config=MC3R1.D4.9,macros+={questionable,"name(Z_MEM_PHYS_ADDR)"} +-config=MC3R1.D4.9,macros+={questionable,"name(Z_MEM_VIRT_ADDR)"} +-config=MC3R1.D4.9,macros+={questionable,"name(Z_STACK_PTR_ALIGN)"} +-config=MC3R1.D4.9,macros+={questionable,"name(Z_THREAD_STACK_SIZE_ADJUST)"} +-config=MC3R1.D4.9,macros+={questionable,"name(Z_TICK_ABS)"} +-config=MC3R1.D4.9,macros+={questionable,"name(ceiling_fraction)"} +-config=MC3R1.D4.9,macros+={questionable,"name(irq_enable)"} +-config=MC3R1.D4.9,macros+={questionable,"name(irq_lock)"} +-config=MC3R1.D4.9,macros+={questionable,"name(irq_unlock)"} +-config=MC3R1.D4.9,macros+={questionable,"name(k_panic)"} +-doc_end + +-doc="Use of CODE_UNREACHABLE is defensive programming." +-config=MC3R1.R2.1,reports+={safe,"any_area(any_loc(any_exp(macro(name(CODE_UNREACHABLE)))))"} + +-doc_begin="Identifers beginning with _ are tolerated." +-config=MC3R1.R21.1,macros={relied,"^_.*$"} +-config=MC3R1.R21.2,declarations={relied,"^(.*::)?_.*$"} +-doc_end + +-eval_file=adopted_code.ecl +-eval_file=adopted_deviations.ecl + +-doc="Hide reports marked as compliant." +-remap_rtag={compliant,hide} + +-doc="Hide reports marked as safe." +-remap_rtag={safe,hide} + +-doc="Hide reports marked as relied." +-remap_rtag={relied,hide} + +-doc="Hide reports marked as questionable." +-remap_rtag={questionable,hide} + +-doc="Hide reports marked as deliberate." +-remap_rtag={deliberate,hide} + +-doc="Hide reports marked as disapplied." +-remap_rtag={disapplied,hide} From e0db9ce948b93eaf57356543fb28f46518471792 Mon Sep 17 00:00:00 2001 From: Simon Hein Date: Fri, 19 Jan 2024 14:02:59 +0100 Subject: [PATCH 2591/4482] sca: Add ECLAIR sca cmake implementation Add the ECLAIR calls for the zephyr cmake environment to call ECLAIR while the firmware is build by replacing the actual compiler call and setup the eclair environment and call the compiler through the eclair. The Integration accepts a kconfig file for configuring the analysis and the generation of the reports. The path of the kconfig file should be provided via the variable ECLAIR_CONFIG. db_generation.ecl has be created and introduced instead of reports.ecl because the report generation is handled by the sca.cmake directly. Signed-off-by: Simon Hein --- cmake/sca/eclair/ECL/analysis.ecl | 2 - cmake/sca/eclair/ECL/db_generation.ecl | 28 ++++++ cmake/sca/eclair/ECL/reports.ecl | 57 ----------- cmake/sca/eclair/eclair.template | 37 +++++++ cmake/sca/eclair/sca.cmake | 131 +++++++++++++++++++++++++ 5 files changed, 196 insertions(+), 59 deletions(-) create mode 100644 cmake/sca/eclair/ECL/db_generation.ecl delete mode 100644 cmake/sca/eclair/ECL/reports.ecl create mode 100644 cmake/sca/eclair/eclair.template create mode 100644 cmake/sca/eclair/sca.cmake diff --git a/cmake/sca/eclair/ECL/analysis.ecl b/cmake/sca/eclair/ECL/analysis.ecl index 118c069ca42c5..ddca224e2b024 100644 --- a/cmake/sca/eclair/ECL/analysis.ecl +++ b/cmake/sca/eclair/ECL/analysis.ecl @@ -1,5 +1,3 @@ --project_name=getenv("ECLAIR_PROJECT_NAME") --project_root=getenv("ECLAIR_PROJECT_ROOT") -setq=data_dir,getenv("ECLAIR_DATA_DIR") -setq=set,getenv("ECLAIR_RULESET") diff --git a/cmake/sca/eclair/ECL/db_generation.ecl b/cmake/sca/eclair/ECL/db_generation.ecl new file mode 100644 index 0000000000000..e10fa67448105 --- /dev/null +++ b/cmake/sca/eclair/ECL/db_generation.ecl @@ -0,0 +1,28 @@ +# eclair_report + +# NEEDED: set the variable for the binary output directory from the environment +# variable. +setq(data_dir,getenv("ECLAIR_DATA_DIR")) + +# NEEDED: set the variable for the ECLAIR project database from the environment +# variable. +setq(ecd_file,getenv("ECLAIR_PROJECT_ECD")) + +# NEEDED: set the variable for the output directory from the environment +# variable. +setq(output_dir,getenv("ECLAIR_OUTPUT_DIR")) + +if(file_exists(ecd_file), + db(ecd_file), + create_db(ecd_file)) + +setq(loaded_dir,join_paths(data_dir,"loaded")) +make_dirs(loaded_dir) + +# NEEDED: generate the ecd from frame files +strings_map("load_ecb",500,"",".+\\.ecb",0,setq(ecb,join_paths(data_dir,$0)),load(ecb),rename(ecb,join_paths(loaded_dir,$0))) +strings_map("load_ecb",500,"",".*",0) + +loading() +map_strings("load_ecb", dir_entries(data_dir)) +loaded() diff --git a/cmake/sca/eclair/ECL/reports.ecl b/cmake/sca/eclair/ECL/reports.ecl deleted file mode 100644 index cd386322ed837..0000000000000 --- a/cmake/sca/eclair/ECL/reports.ecl +++ /dev/null @@ -1,57 +0,0 @@ -# eclair_report - -# This file must not be renamed: it is referenced by eclair-make.sh -# -# The aim of this file is to define the eclair_report configuration -# common to IDE analyses. - -quiet() - -# NEEDED: set the variable for the binary output directory from the environment -# variable. -setq(data_dir,getenv("ECLAIR_DATA_DIR")) - -# NEEDED: set the variable for the ECLAIR project database from the environment -# variable. -setq(ecd_file,getenv("ECLAIR_PROJECT_ECD")) - -# NEEDED: set the variable for the output directory from the environment -# variable. -setq(output_dir,getenv("ECLAIR_OUTPUT_DIR")) - -if(file_exists(ecd_file), - db(ecd_file), - create_db(ecd_file)) - -server_root("") -server("changing") - -setq(loaded_dir,join_paths(data_dir,"loaded")) -make_dirs(loaded_dir) - -# NEEDED: generate the ecd from frame files -strings_map("load_ecb",500,"",".+\\.ecb",0,setq(ecb,join_paths(data_dir,$0)),load(ecb),rename(ecb,join_paths(loaded_dir,$0))) -strings_map("load_ecb",500,"",".*",0) - -loading() -map_strings("load_ecb", dir_entries(data_dir)) -loaded() - -if(string_equal(or(getenv("TEXTUAL_REPORTS"),"false"),"true") - eval_file("report__textual.ecl")) - - -# Output report summaries in ODT format. -#-summary_odt=join_paths(output_dir,"odt") -# Output report summaries in ODT format. -#-summary_doc=join_paths(output_dir,"doc") -# Output report summaries in pure text format. -#-summary_txt=join_paths(output_dir,"txt") -# Output full report in pure text format. -#-full_txt=join_paths(output_dir,"txt") -# Output metrics for use with spreadsheet applications (if enabled). -#-metrics_tab=join_paths(output_dir,"metrics") -# Output reports for use with spreadsheet applications -#-reports_tab=join_paths(output_dir,"reports") - -server("changed") diff --git a/cmake/sca/eclair/eclair.template b/cmake/sca/eclair/eclair.template new file mode 100644 index 0000000000000..fd7b0fe8b77d3 --- /dev/null +++ b/cmake/sca/eclair/eclair.template @@ -0,0 +1,37 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2024, Baumer (www.baumer.com) + +# Everything before `--` are arguments for cmake invocation, those must be ignored. +# The first argument after `--` is the start of the compiler call, which is +# what we want to get to invoke ECLAIR with the compiler call which is used in the zephyr +# environment +foreach(i RANGE ${CMAKE_ARGC}) + if("${CMAKE_ARGV${i}}" STREQUAL "--") + math(EXPR end_of_options "${i} + 1") + break() + endif() +endforeach() + +foreach(i RANGE ${end_of_options} ${CMAKE_ARGC}) + list(APPEND ZEPHYR_COMPILER_CALL ${CMAKE_ARGV${i}}) +endforeach() + +list(APPEND ECLAIR_ARGS +incremental + -project_name=@ECLAIR_PROJECT_NAME@ -project_root=@ZEPHYR_BASE@ + -eval_file=@ECLAIR_ECL_DIR@/analysis.ecl + -eval_file=@ECLAIR_ANALYSIS_ECL_DIR@/analysis_@ECLAIR_RULESET@.ecl + @ECLAIR_ENV_ADDITIONAL_OPTIONS@) + +execute_process( + COMMAND @CMAKE_COMMAND@ -E env + ECLAIR_DIAGNOSTICS_OUTPUT=@ECLAIR_DIAGNOSTICS_OUTPUT@ + ECLAIR_DATA_DIR=@ECLAIR_ANALYSIS_DATA_DIR@ + CC_ALIASES=@CC_ALIASES@ + CXX_ALIASES=@CXX_ALIASES@ + AS_ALIASES=@AS_ALIASES@ + LD_ALIASES=@LD_ALIASES@ + AR_ALIASES=@AR_ALIASES@ + @ECLAIR_ENV@ ${ECLAIR_ARGS} -- ${ZEPHYR_COMPILER_CALL} + COMMAND_ERROR_IS_FATAL ANY +) diff --git a/cmake/sca/eclair/sca.cmake b/cmake/sca/eclair/sca.cmake new file mode 100644 index 0000000000000..9eb828c67b465 --- /dev/null +++ b/cmake/sca/eclair/sca.cmake @@ -0,0 +1,131 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2023, BUGSENG Srl + +find_program(ECLAIR_ENV eclair_env REQUIRED) +message(STATUS "Found eclair_env: ${ECLAIR_ENV}") + +find_program(ECLAIR_REPORT eclair_report REQUIRED) +message(STATUS "Found eclair_report: ${ECLAIR_REPORT}") + + +# ECLAIR Settings +set(ECLAIR_PROJECT_NAME "Zephyr-${BOARD}${BOARD_QUALIFIERS}") +set(ECLAIR_OUTPUT_DIR "${CMAKE_BINARY_DIR}/sca/eclair") +set(ECLAIR_ECL_DIR "${ZEPHYR_BASE}/cmake/sca/eclair/ECL") +set(ECLAIR_ANALYSIS_ECL_DIR "${ZEPHYR_BASE}/cmake/sca/eclair/ECL") +set(ECLAIR_DIAGNOSTICS_OUTPUT "${ECLAIR_OUTPUT_DIR}/DIAGNOSTIC.txt") +set(ECLAIR_ANALYSIS_DATA_DIR "${ECLAIR_OUTPUT_DIR}/analysis_data") +set(ECLAIR_PROJECT_ECD "${ECLAIR_OUTPUT_DIR}/PROJECT.ecd") +set(CC_ALIASES "${CMAKE_C_COMPILER}") +set(CXX_ALIASES "${CMAKE_CXX_COMPILER}") +set(AS_ALIASES "${CMAKE_AS}") +set(LD_ALIASES "${CMAKE_LINKER}") +set(AR_ALIASES "${CMAKE_ASM_COMPILER_AR} ${CMAKE_C_COMPILER_AR} ${CMAKE_CXX_COMPILER_AR}") + +set(ECLAIR_ENV_ADDITIONAL_OPTIONS "") +set(ECLAIR_REPORT_ADDITIONAL_OPTIONS "") + +# Default value +set(ECLAIR_RULESET first_analysis) + +# ECLAIR env +if(ECLAIR_RULESET_FIRST_ANALYSIS) + set(ECLAIR_RULESET first_analysis) +elseif(ECLAIR_RULESET_STU) + set(ECLAIR_RULESET STU) +elseif(ECLAIR_RULESET_STU_HEAVY) + set(ECLAIR_RULESET STU_heavy) +elseif(ECLAIR_RULESET_WP) + set(ECLAIR_RULESET WP) +elseif(ECLAIR_RULESET_STD_LIB) + set(ECLAIR_RULESET std_lib) +elseif(ECLAIR_RULESET_USER) + set(ECLAIR_RULESET ${ECLAIR_USER_RULESET_NAME}) + if(IS_ABSOLUTE ${ECLAIR_USER_RULESET_PATH}) + set(ECLAIR_ANALYSIS_ECL_DIR ${ECLAIR_USER_RULESET_PATH}) + else() + set(ECLAIR_ANALYSIS_ECL_DIR ${APPLICATION_CONFIG_DIR}/${ECLAIR_USER_RULESET_PATH}) + endif() +endif() + +# ECLAIR report +if (ECLAIR_METRICS_TAB) + list(APPEND ECLAIR_REPORT_ADDITIONAL_OPTIONS "-metrics_tab=${ECLAIR_OUTPUT_DIR}/metrics") +endif() +if (ECLAIR_REPORTS_TAB) + list(APPEND ECLAIR_REPORT_ADDITIONAL_OPTIONS "-reports_tab=${ECLAIR_OUTPUT_DIR}/reports") +endif() +if (ECLAIR_REPORTS_SARIF) + list(APPEND ECLAIR_REPORT_ADDITIONAL_OPTIONS "-reports_sarif=${ECLAIR_OUTPUT_DIR}/reports.sarif") +endif() +if (ECLAIR_SUMMARY_TXT) + list(APPEND ECLAIR_REPORT_ADDITIONAL_OPTIONS "-summary_txt=${ECLAIR_OUTPUT_DIR}/summary_txt") +endif() +if (ECLAIR_SUMMARY_DOC) + list(APPEND ECLAIR_REPORT_ADDITIONAL_OPTIONS "-summary_doc=${ECLAIR_OUTPUT_DIR}/summary_doc") +endif() +if (ECLAIR_SUMMARY_ODT) + list(APPEND ECLAIR_REPORT_ADDITIONAL_OPTIONS "-summary_odt=${ECLAIR_OUTPUT_DIR}/summary_odt") +endif() +if (ECLAIR_FULL_TXT_ALL_AREAS) + list(APPEND ECLAIR_REPORT_ADDITIONAL_OPTIONS "-setq=report_areas,areas") +endif() +if (ECLAIR_FULL_TXT_FIRST_AREA) + list(APPEND ECLAIR_REPORT_ADDITIONAL_OPTIONS "-setq=report_areas,first_area") +endif() +if (ECLAIR_FULL_TXT) + list(APPEND ECLAIR_REPORT_ADDITIONAL_OPTIONS "-full_txt=${ECLAIR_OUTPUT_DIR}/report_full_txt") +endif() +if (ECLAIR_FULL_DOC_ALL_AREAS) + list(APPEND ECLAIR_REPORT_ADDITIONAL_OPTIONS "-setq=report_areas,areas") +endif() +if (ECLAIR_FULL_DOC_FIRST_AREA) + list(APPEND ECLAIR_REPORT_ADDITIONAL_OPTIONS "-setq=report_areas,first_area") +endif() +if (ECLAIR_FULL_DOC) + list(APPEND ECLAIR_REPORT_ADDITIONAL_OPTIONS "-full_doc=${ECLAIR_OUTPUT_DIR}/report_full_doc") +endif() +if (ECLAIR_FULL_ODT) + list(APPEND ECLAIR_REPORT_ADDITIONAL_OPTIONS "-full_odt=${ECLAIR_OUTPUT_DIR}/report_full_odt") +endif() + +message(STATUS "ECLAIR outputs have been written to: ${ECLAIR_OUTPUT_DIR}") +message(STATUS "ECLAIR ECB files have been written to: ${ECLAIR_ANALYSIS_DATA_DIR}") + +add_custom_target(eclair_setup_analysis_dir ALL + COMMAND ${CMAKE_COMMAND} -E remove_directory ${ECLAIR_ANALYSIS_DATA_DIR} + COMMAND ${CMAKE_COMMAND} -E make_directory ${ECLAIR_ANALYSIS_DATA_DIR} + VERBATIM + USES_TERMINAL +) + +# configure the camke script which will be used to replace the compiler call with the eclair_env +# call which calls the compiler and to generate analysis files. +configure_file(${CMAKE_CURRENT_LIST_DIR}/eclair.template ${ECLAIR_OUTPUT_DIR}/eclair.cmake @ONLY) + +set(launch_environment ${CMAKE_COMMAND} -P ${ECLAIR_OUTPUT_DIR}/eclair.cmake --) +set(CMAKE_C_COMPILER_LAUNCHER ${launch_environment} CACHE INTERNAL "") + +# This target is used to generate the ECLAIR database when all the compilation is done and the +# elf file was generated with this we cane make sure that the analysis is completed. +add_custom_target(eclair_report ALL + COMMAND ${CMAKE_COMMAND} -E env + ECLAIR_DATA_DIR=${ECLAIR_ANALYSIS_DATA_DIR} + ECLAIR_OUTPUT_DIR=${ECLAIR_OUTPUT_DIR} + ECLAIR_PROJECT_ECD=${ECLAIR_PROJECT_ECD} + ${ECLAIR_REPORT} -quiet -eval_file=${ECLAIR_ECL_DIR}/db_generation.ecl + DEPENDS ${CMAKE_BINARY_DIR}/zephyr/zephyr.elf + VERBATIM + USES_TERMINAL + COMMAND_EXPAND_LISTS +) + +# This command is used to generate the final reports from the database and print the overall results +add_custom_target(eclair_summary_print ALL + COMMAND ${ECLAIR_REPORT} + -db=${ECLAIR_PROJECT_ECD} ${ECLAIR_REPORT_ADDITIONAL_OPTIONS} + -overall_txt=${ECLAIR_OUTPUT_DIR}/summary_overall.txt + COMMAND ${CMAKE_COMMAND} -E cat ${ECLAIR_OUTPUT_DIR}/summary_overall.txt +) +add_dependencies(eclair_summary_print eclair_report) From 22ce16d17bd458436cb29a0f008c406e09e9221c Mon Sep 17 00:00:00 2001 From: Simon Hein Date: Tue, 30 Jan 2024 16:50:49 +0100 Subject: [PATCH 2592/4482] doc: sca: Add Bugseng eclair documentation Add the documentation for the eclair from Bugseng with the pre configuration for the zephyr project. Signed-off-by: Simon Hein --- doc/develop/sca/eclair.rst | 155 +++++++++++++++++++++++++++++++++++++ doc/develop/sca/index.rst | 1 + 2 files changed, 156 insertions(+) create mode 100644 doc/develop/sca/eclair.rst diff --git a/doc/develop/sca/eclair.rst b/doc/develop/sca/eclair.rst new file mode 100644 index 0000000000000..f47d861d7650a --- /dev/null +++ b/doc/develop/sca/eclair.rst @@ -0,0 +1,155 @@ +.. _eclair: + +ECLAIR support +############## + +Bugseng `ECLAIR `__ is a certified +static analysis tool and platform for software verification. +Applications range from coding rule validation, with a +particular emphasis on the MISRA and BARR-C coding standards, to the +computation of software metrics, to the checking of independence and +freedom from interference among software components, to the automatic +detection of important classes of software errors. + +.. important:: + + ECLAIR is a commercial tool, and it is not free software. + You need to have a valid license to use it. + +Running ECLAIR +************** + +To run ECLAIR, :ref:`west build ` should be +called with a ``-DZEPHYR_SCA_VARIANT=eclair`` parameter. + +.. code-block:: shell + + west build -b mimxrt1064_evk samples/basic/blinky -- -DZEPHYR_SCA_VARIANT=eclair + +.. note:: + This will only invoke the ECLAIR analysis with the predefined ruleset ``first_analysis``. If you + want to use a different ruleset, you need to provide a configuration file. See the next section + for more information. + +Configurations +************** + +The configure of the ECLAIR SCA environment can either be done via a cmake options file or with +adapted options as command line arguments. + +To invoke a cmake options file into the ECLAIR call, you can define the ``ECLAIR_OPTIONS_FILE`` +variable, for example: + +.. code-block:: shell + + west build -b mimxrt1064_evk samples/basic/blinky -- -DZEPHYR_SCA_VARIANT=eclair -DECLAIR_OPTIONS_FILE=my_options.cmake + +The default (if no config file is given) configuration is always ``first_analysis``, +which is a tiny selection of rules to verify that everything is correctly working. + +If the default configuration wants to be overwritten via the command line and not via a options +file, that can be achived by giving the argument ``-DOption=ON|OFF``. + +For example: + +.. code-block:: shell + + west build -b mimxrt1064_evk samples/basic/blinky -- -DZEPHYR_SCA_VARIANT=eclair -DECLAIR_REPORTS_SARIF=ON + +Zephyr is a large and complex project, so the configuration sets are split the +Zephyr's guidelines selection +(taken from https://docs.zephyrproject.org/latest/contribute/coding_guidelines/index.html) +in five sets to make it more digestible to use on a private machine: + +* first_analysis (default): a tiny selection of the projects coding guidelines to verify that + everything is correctly working. + +* STU: Selection of the projects coding guidelines, which can be verified by analysing the single + translation units independently. + +* STU_heavy: Selection of complex STU project coding guidelines that require a significant amount + of time. + +* WP: All whole program project coding guidelines ("system" in MISRA's parlance). + +* std_lib: Project coding guidelines about the C Standard Library. + +Related cmake options: + +* ``ECLAIR_RULESET_FIRST_ANALYSIS`` +* ``ECLAIR_RULESET_STU`` +* ``ECLAIR_RULESET_STU_HEAVY`` +* ``ECLAIR_RULESET_WP`` +* ``ECLAIR_RULESET_STD_LIB`` + +User defined ruleset +==================== + +If you want to use your own defined ruleset instead of the predefined zephyr coding guidelines +rulesets. You can do so by setting :code:`ECLAIR_RULESET_USER=ON`. +Created your own rulset file for ECLAIR with the following naming format: +``analysis_.ecl``. After creating the file define the name of the ruleset for ECLAIR +with the cmake variable :code:`ECLAIR_USER_RULESET_NAME`. +If the ruleset file is not in the application source directory, you can define the path to the +ruleset file with the cmake variable :code:`ECLAIR_USER_RULESET_PATH`. This configuration takes +relative paths and absolute paths. + +Related cmake options and variables: + +* ``ECLAIR_RULESET_USER`` +* ``ECLAIR_USER_RULESET_NAME`` +* ``ECLAIR_USER_RULESET_PATH`` + +Generate additional report formats +********************************** + +ECLAIR can generate additional report formats (e.g. DOC, ODT, XLSX) and +different variants of repots in addition to the +default ecd file. Following additional reports and report formats can be generated: + +* Metrics in spreadsheet format. + +* Findings in spreadsheet format. + +* Findings in SARIF format. + +* Summary report in plain textual format. + +* Summary report in DOC format. + +* Summary report in ODT format. + +* Detailed reports in txt format. + +* Detailed report in DOC format. + +* Detailed report in ODT format. + +Related cmake options: + +* ``ECLAIR_METRICS_TAB`` +* ``ECLAIR_REPORTS_TAB`` +* ``ECLAIR_REPORTS_SARIF`` +* ``ECLAIR_SUMMARY_TXT`` +* ``ECLAIR_SUMMARY_DOC`` +* ``ECLAIR_SUMMARY_ODT`` +* ``ECLAIR_FULL_TXT`` +* ``ECLAIR_FULL_DOC`` +* ``ECLAIR_FULL_ODT`` + +Detail level of full reports +============================ + +The detail level of the txt and doc full reports can also be adapted by a configuration. +In this case the following configurations are avilable: + +* Show all areas + +* Show only the first area + +Related cmake options: + +* ``ECLAIR_FULL_DOC_ALL_AREAS`` +* ``ECLAIR_FULL_DOC_FIRST_AREA`` +* ``ECLAIR_FULL_TXT_ALL_AREAS`` +* ``ECLAIR_FULL_TXT_FIRST_AREA`` diff --git a/doc/develop/sca/index.rst b/doc/develop/sca/index.rst index 0a47b23f52f55..37c30827d27c0 100644 --- a/doc/develop/sca/index.rst +++ b/doc/develop/sca/index.rst @@ -65,3 +65,4 @@ The following is a list of SCA tools natively supported by Zephyr build system. sparse gcc cpptest + eclair From d4da23e3c355bce789f7309f0b6184bb80bfbc0f Mon Sep 17 00:00:00 2001 From: Simon Hein Date: Wed, 23 Oct 2024 15:08:11 +0200 Subject: [PATCH 2593/4482] sca: Add cmake options file for tool configuration Add a cmake file which uses the cmake options feature and include it inot the sca.cmake file to set up and describe the options for the ECLAIR tool. Signed-off-by: Simon Hein --- cmake/sca/eclair/sca.cmake | 10 +++++++++ cmake/sca/eclair/sca_options.cmake | 34 ++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 cmake/sca/eclair/sca_options.cmake diff --git a/cmake/sca/eclair/sca.cmake b/cmake/sca/eclair/sca.cmake index 9eb828c67b465..8dbc8a42f976a 100644 --- a/cmake/sca/eclair/sca.cmake +++ b/cmake/sca/eclair/sca.cmake @@ -8,6 +8,16 @@ message(STATUS "Found eclair_env: ${ECLAIR_ENV}") find_program(ECLAIR_REPORT eclair_report REQUIRED) message(STATUS "Found eclair_report: ${ECLAIR_REPORT}") +if(ECLAIR_OPTIONS_FILE) + if(IS_ABSOLUTE ${ECLAIR_OPTIONS_FILE}) + set(ECLAIR_OPTIONS ${ECLAIR_OPTIONS_FILE}) + else() + set(ECLAIR_OPTIONS ${APPLICATION_CONFIG_DIR}/${ECLAIR_OPTIONS_FILE}) + endif() + include(${ECLAIR_OPTIONS}) +else() + include(${CMAKE_CURRENT_LIST_DIR}/sca_options.cmake) +endif() # ECLAIR Settings set(ECLAIR_PROJECT_NAME "Zephyr-${BOARD}${BOARD_QUALIFIERS}") diff --git a/cmake/sca/eclair/sca_options.cmake b/cmake/sca/eclair/sca_options.cmake new file mode 100644 index 0000000000000..2402b0e8446c8 --- /dev/null +++ b/cmake/sca/eclair/sca_options.cmake @@ -0,0 +1,34 @@ +include(CMakeDependentOption) + +option(ECLAIR_RULESET_FIRST_ANALYSIS "A tiny selection of the projects coding guideline rules to + verify that everything is correctly working" ON) + +option(ECLAIR_RULESET_STU "Selection of the projects coding guidelines, which can be verified + by analysing the single translation units independently." OFF) + +option(ECLAIR_RULESET_STU_HEAVY "Selection of complex STU project coding guidelines that + require a significant amount of time" OFF) +option(ECLAIR_RULESET_WP "All whole program project coding guidelines ('system' in MISRA's + parlance)." OFF) +option(ECLAIR_RULESET_STD_LIB "Project coding guidelines about the C Standard Library" OFF) +option(ECLAIR_RULESET_USER "User defined ruleset" OFF) + +option(ECLAIR_METRICS_TAB "Metrics in a spreadsheet format" OFF) +option(ECLAIR_REPORTS_TAB "Findings in a spreadsheet format" OFF) +option(ECLAIR_REPORTS_SARIF "Findings in sarif JSON format" ON) +option(ECLAIR_SUMMARY_TXT "Plain textual summary format" OFF) +option(ECLAIR_SUMMARY_DOC "DOC summary format" OFF) +option(ECLAIR_SUMMARY_ODT "ODT summary format" OFF) +option(ECLAIR_FULL_TXT "Detailed plain textual format" ON) +option(ECLAIR_FULL_DOC "Detailed DOC format" OFF) +option(ECLAIR_FULL_ODT "Detailed ODT format" OFF) + +cmake_dependent_option(ECLAIR_FULL_DOC_ALL_AREAS "Show all areas in a full doc report" + OFF "ECLAIR_FULL_DOC OR ECLAIR_FULL_ODT" OFF) +cmake_dependent_option(ECLAIR_FULL_DOC_FIRST_AREA "Show only the first area in a full doc report" + ON "ECLAIR_FULL_DOC OR ECLAIR_FULL_ODT" OFF) + +cmake_dependent_option(ECLAIR_FULL_TXT_ALL_AREAS "Show all areas in a full text report" + OFF "ECLAIR_FULL_TXT" OFF) +cmake_dependent_option(ECLAIR_FULL_TXT_FIRST_AREA "Show only the first area in a full text report" + ON "ECLAIR_FULL_TXT" OFF) From 2eda6df48a214e03b2e211df8966683f69262990 Mon Sep 17 00:00:00 2001 From: Matt Rodgers Date: Fri, 30 Aug 2024 11:11:11 +0100 Subject: [PATCH 2594/4482] net: lib: http_server: add option to use ALPN Web browsers don't support HTTP Upgrade mechanism to upgrade to HTTP2. Instead, HTTP2 is supported only over TLS, and ALPN is used to negotiate the protocol to be used. This commit adds the supported HTTP protocols to the ALPN list, so that web browsers can use HTTP2 with the server. Signed-off-by: Matt Rodgers --- subsys/net/lib/http/Kconfig | 9 +++++++++ subsys/net/lib/http/http_server_core.c | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/subsys/net/lib/http/Kconfig b/subsys/net/lib/http/Kconfig index 98d8f72f0ded7..2cce0f5c45b4b 100644 --- a/subsys/net/lib/http/Kconfig +++ b/subsys/net/lib/http/Kconfig @@ -179,6 +179,15 @@ config HTTP_SERVER_RESTART_DELAY allow any existing connections to finalize to avoid binding errors during initialization. +config HTTP_SERVER_TLS_USE_ALPN + bool "ALPN support for HTTPS server" + depends on NET_SOCKETS_SOCKOPT_TLS + depends on MBEDTLS_SSL_ALPN + help + Use ALPN (application layer protocol negotiation) to negotiate HTTP2 + protocol for TLS connections. Web browsers use this mechanism to determine + whether HTTP2 is supported. + config WEBSOCKET_CONSOLE bool default y if HTTP_SERVER_WEBSOCKET && SHELL_BACKEND_WEBSOCKET diff --git a/subsys/net/lib/http/http_server_core.c b/subsys/net/lib/http/http_server_core.c index 9b41d76d98339..f090254ff44d5 100644 --- a/subsys/net/lib/http/http_server_core.c +++ b/subsys/net/lib/http/http_server_core.c @@ -58,6 +58,10 @@ static struct http_server_ctx server_ctx; static K_SEM_DEFINE(server_start, 0, 1); static bool server_running; +#if defined(CONFIG_HTTP_SERVER_TLS_USE_ALPN) +static const char *const alpn_list[] = {"h2", "http/1.1"}; +#endif + static void close_client_connection(struct http_client_ctx *client); HTTP_SERVER_CONTENT_TYPE(html, "text/html") @@ -185,8 +189,17 @@ int http_server_init(struct http_server_ctx *ctx) zsock_close(fd); continue; } + +#if defined(CONFIG_HTTP_SERVER_TLS_USE_ALPN) + if (zsock_setsockopt(fd, SOL_TLS, TLS_ALPN_LIST, alpn_list, + sizeof(alpn_list)) < 0) { + LOG_ERR("setsockopt: %d", errno); + zsock_close(fd); + continue; + } +#endif /* defined(CONFIG_HTTP_SERVER_TLS_USE_ALPN) */ } -#endif +#endif /* defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS) */ if (zsock_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &(int){1}, sizeof(int)) < 0) { From 8e4dc4e7fa74fd46221a11450281e0c5eae5bb6a Mon Sep 17 00:00:00 2001 From: Hakan Jansson Date: Mon, 21 Oct 2024 15:47:57 +0200 Subject: [PATCH 2595/4482] boards: infineon: cyw920829m2evk_02: set openocd target handle Openocd target cyw20829 does not define _TARGETNAME which is used by default by the openocd west runner when using CONFIG_DEBUG_THREAD_INFO. This is similar to the issue previously addressed for STM32H7: Link: https://github.com/zephyrproject-rtos/zephyr/issues/45778 Signed-off-by: Hakan Jansson --- boards/infineon/cyw920829m2evk_02/board.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/infineon/cyw920829m2evk_02/board.cmake b/boards/infineon/cyw920829m2evk_02/board.cmake index 0c9bf12801be9..be95fa715a3f5 100644 --- a/boards/infineon/cyw920829m2evk_02/board.cmake +++ b/boards/infineon/cyw920829m2evk_02/board.cmake @@ -1,6 +1,7 @@ # Copyright (c) 2024 Cypress Semiconductor Corporation. # SPDX-License-Identifier: Apache-2.0 +board_runner_args(openocd "--target-handle=TARGET.cm33") include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) board_runner_args(jlink "--device=CYW20829_tm") include (${ZEPHYR_BASE}/boards/common/jlink.board.cmake) From 5d49d5c00c32715e451804a030dceda3cc23347a Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Fri, 25 Oct 2024 14:33:50 +0200 Subject: [PATCH 2596/4482] scripts: ci: check_compliancy: Add zephyr-keep-sorted regex support To support checking for sorted blocks of multi-line text add an optional regex pattern for the KeepSorted compliance check. Signed-off-by: Pieter De Gendt --- scripts/ci/check_compliance.py | 59 +++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 5a3f1deda2522..a1db8bc7c5473 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -7,6 +7,7 @@ import argparse import collections from email.utils import parseaddr +from itertools import takewhile import json import logging import os @@ -1543,20 +1544,39 @@ class KeepSorted(ComplianceTest): MARKER = "zephyr-keep-sorted" - def block_is_sorted(self, block_data): - lines = [] + def block_check_sorted(self, block_data, regex): + def _test_indent(txt: str): + return txt.startswith((" ", "\t")) - for line in textwrap.dedent(block_data).splitlines(): - if len(lines) > 0 and line.startswith((" ", "\t")): - # Fold back indented lines - lines[-1] += line.strip() + if regex is None: + block_data = textwrap.dedent(block_data) + + lines = block_data.splitlines() + last = '' + + for idx, line in enumerate(lines): + if not line.strip(): + # Ignore blank lines + continue + + if regex: + # check for regex + if not re.match(regex, line): + continue else: - lines.append(line.strip()) + if _test_indent(line): + continue + + # Fold back indented lines after the current one + for cont in takewhile(_test_indent, lines[idx + 1:]): + line += cont.strip() + + if line < last: + return idx - if lines != sorted(lines): - return False + last = line - return True + return -1 def check_file(self, file, fp): mime_type = magic.from_file(file, mime=True) @@ -1569,8 +1589,9 @@ def check_file(self, file, fp): start_marker = f"{self.MARKER}-start" stop_marker = f"{self.MARKER}-stop" - start_line = None - stop_line = None + regex_marker = r"re\((.+)\)" + start_line = 0 + regex = None for line_num, line in enumerate(fp.readlines(), start=1): if start_marker in line: @@ -1581,22 +1602,22 @@ def check_file(self, file, fp): in_block = True block_data = "" start_line = line_num + 1 + + # Test for a regex block + match = re.search(regex_marker, line) + regex = match.group(1) if match else None elif stop_marker in line: if not in_block: desc = f"{stop_marker} without {start_marker}" self.fmtd_failure("error", "KeepSorted", file, line_num, desc=desc) in_block = False - stop_line = line_num - 1 - if not self.block_is_sorted(block_data): - desc = (f"sorted block is not sorted, sort by running: " + - f"\"ex -s -c '{start_line},{stop_line} sort i|x' {file}\"") + idx = self.block_check_sorted(block_data, regex) + if idx >= 0: + desc = f"sorted block has out-of-order line at {start_line + idx}" self.fmtd_failure("error", "KeepSorted", file, line_num, desc=desc) - elif not line.strip() or line.startswith("#"): - # Ignore comments and blank lines - continue elif in_block: block_data += line From 794dd05459236e25c9be184d36f9c0bb70b86f4a Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Fri, 25 Oct 2024 15:02:54 +0200 Subject: [PATCH 2597/4482] scripts: ci: check_compliance: Keep UNDEF list sorted Keep the UNDEF_KCONFIG_ALLOWLIST list sorted, as mentioned in the comment. Signed-off-by: Pieter De Gendt --- scripts/ci/check_compliance.py | 52 ++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index a1db8bc7c5473..5de6a81e44b83 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -909,6 +909,7 @@ def check_no_undef_outside_kconfig(self, kconf): # Many of these are symbols used as examples. Note that the list is sorted # alphabetically, and skips the CONFIG_ prefix. UNDEF_KCONFIG_ALLOWLIST = { + # zephyr-keep-sorted-start re(^\s+") "ALSO_MISSING", "APP_LINK_WITH_", "APP_LOG_LEVEL", # Application log level is not detected correctly as @@ -919,51 +920,52 @@ def check_no_undef_outside_kconfig(self, kconf): # toolchain Kconfig which is sourced based on # Zephyr toolchain variant and therefore not # visible to compliance. + "BINDESC_", # Used in documentation as a prefix "BOARD_", # Used as regex in scripts/utils/board_v1_to_v2.py "BOARD_MPS2_AN521_CPUTEST", # Used for board and SoC extension feature tests "BOARD_NATIVE_SIM_NATIVE_64_TWO", # Used for board and SoC extension feature tests "BOARD_NATIVE_SIM_NATIVE_ONE", # Used for board and SoC extension feature tests "BOOT_DIRECT_XIP", # Used in sysbuild for MCUboot configuration "BOOT_DIRECT_XIP_REVERT", # Used in sysbuild for MCUboot configuration - "BOOT_FIRMWARE_LOADER", # Used in sysbuild for MCUboot configuration - "BOOT_RAM_LOAD", # Used in sysbuild for MCUboot configuration - "BOOT_SWAP_USING_MOVE", # Used in sysbuild for MCUboot configuration - "BOOT_SWAP_USING_SCRATCH", # Used in sysbuild for MCUboot configuration "BOOT_ENCRYPTION_KEY_FILE", # Used in sysbuild "BOOT_ENCRYPT_IMAGE", # Used in sysbuild + "BOOT_FIRMWARE_LOADER", # Used in sysbuild for MCUboot configuration "BOOT_MAX_IMG_SECTORS_AUTO", # Used in sysbuild - "BINDESC_", # Used in documentation as a prefix - "BOOT_UPGRADE_ONLY", # Used in example adjusting MCUboot config, but - # symbol is defined in MCUboot itself. + "BOOT_RAM_LOAD", # Used in sysbuild for MCUboot configuration "BOOT_SERIAL_BOOT_MODE", # Used in (sysbuild-based) test/ # documentation "BOOT_SERIAL_CDC_ACM", # Used in (sysbuild-based) test "BOOT_SERIAL_ENTRANCE_GPIO", # Used in (sysbuild-based) test "BOOT_SERIAL_IMG_GRP_HASH", # Used in documentation + "BOOT_SHARE_BACKEND_RETENTION", # Used in Kconfig text "BOOT_SHARE_DATA", # Used in Kconfig text "BOOT_SHARE_DATA_BOOTINFO", # Used in (sysbuild-based) test - "BOOT_SHARE_BACKEND_RETENTION", # Used in Kconfig text "BOOT_SIGNATURE_KEY_FILE", # MCUboot setting used by sysbuild "BOOT_SIGNATURE_TYPE_ECDSA_P256", # MCUboot setting used by sysbuild "BOOT_SIGNATURE_TYPE_ED25519", # MCUboot setting used by sysbuild "BOOT_SIGNATURE_TYPE_NONE", # MCUboot setting used by sysbuild "BOOT_SIGNATURE_TYPE_RSA", # MCUboot setting used by sysbuild + "BOOT_SWAP_USING_MOVE", # Used in sysbuild for MCUboot configuration + "BOOT_SWAP_USING_SCRATCH", # Used in sysbuild for MCUboot configuration + "BOOT_UPGRADE_ONLY", # Used in example adjusting MCUboot config, but + # symbol is defined in MCUboot itself. "BOOT_VALIDATE_SLOT0", # Used in (sysbuild-based) test "BOOT_WATCHDOG_FEED", # Used in (sysbuild-based) test + "BT_6LOWPAN", # Defined in Linux, mentioned in docs "CDC_ACM_PORT_NAME_", "CHRE", # Optional module "CHRE_LOG_LEVEL_DBG", # Optional module "CLOCK_STM32_SYSCLK_SRC_", + "CMD_CACHE", # Defined in U-Boot, mentioned in docs "CMU", "COMPILER_RT_RTLIB", - "BT_6LOWPAN", # Defined in Linux, mentioned in docs - "CMD_CACHE", # Defined in U-Boot, mentioned in docs "CRC", # Used in TI CC13x2 / CC26x2 SDK comment "DEEP_SLEEP", # #defined by RV32M1 in ext/ "DESCRIPTION", "ERR", "ESP_DIF_LIBRARY", # Referenced in CMake comment "EXPERIMENTAL", + "EXTRA_FIRMWARE_DIR", # Linux, in boards/xtensa/intel_adsp_cavs25/doc "FFT", # Used as an example in cmake/extensions.cmake "FLAG", # Used as an example "FOO", @@ -971,24 +973,28 @@ def check_no_undef_outside_kconfig(self, kconf): "FOO_SETTING_1", "FOO_SETTING_2", "HEAP_MEM_POOL_ADD_SIZE_", # Used as an option matching prefix - "LSM6DSO_INT_PIN", + "HUGETLBFS", # Linux, in boards/xtensa/intel_adsp_cavs25/doc "LIBGCC_RTLIB", "LLVM_USE_LD", # Both LLVM_USE_* are in cmake/toolchain/llvm/Kconfig "LLVM_USE_LLD", # which are only included if LLVM is selected but # not other toolchains. Compliance check would complain, # for example, if you are using GCC. - "MCUBOOT_LOG_LEVEL_WRN", # Used in example adjusting MCUboot - # config, - "MCUBOOT_LOG_LEVEL_INF", - "MCUBOOT_DOWNGRADE_PREVENTION", # but symbols are defined in MCUboot - # itself. + "LOG_BACKEND_MOCK_OUTPUT_DEFAULT", #Referenced in tests/subsys/logging/log_syst + "LOG_BACKEND_MOCK_OUTPUT_SYST", #Referenced in testcase.yaml of log_syst test + "LSM6DSO_INT_PIN", "MCUBOOT_ACTION_HOOKS", # Used in (sysbuild-based) test "MCUBOOT_CLEANUP_ARM_CORE", # Used in (sysbuild-based) test + "MCUBOOT_DOWNGRADE_PREVENTION", # but symbols are defined in MCUboot + # itself. + "MCUBOOT_LOG_LEVEL_INF", + "MCUBOOT_LOG_LEVEL_WRN", # Used in example adjusting MCUboot + # config, "MCUBOOT_SERIAL", # Used in (sysbuild-based) test/ # documentation "MCUMGR_GRP_EXAMPLE_OTHER_HOOK", # Used in documentation "MISSING", "MODULES", + "MODVERSIONS", # Linux, in boards/xtensa/intel_adsp_cavs25/doc "MYFEATURE", "MY_DRIVER_0", "NORMAL_SLEEP", # #defined by RV32M1 in ext/ @@ -1000,8 +1006,7 @@ def check_no_undef_outside_kconfig(self, kconf): "REG1", "REG2", "RIMAGE_SIGNING_SCHEMA", # Optional module - "LOG_BACKEND_MOCK_OUTPUT_DEFAULT", #Referenced in tests/subsys/logging/log_syst - "LOG_BACKEND_MOCK_OUTPUT_SYST", #Referenced in testcase.yaml of log_syst test + "SECURITY_LOADPIN", # Linux, in boards/xtensa/intel_adsp_cavs25/doc "SEL", "SHIFT", "SINGLE_APPLICATION_SLOT", # Used in sysbuild for MCUboot configuration @@ -1014,6 +1019,9 @@ def check_no_undef_outside_kconfig(self, kconf): "SRAM2", # Referenced in a comment in samples/application_development "STACK_SIZE", # Used as an example in the Kconfig docs "STD_CPP", # Referenced in CMake comment + "SUIT_MPI_APP_AREA_PATH", # Used by nRF runners to program provisioning data, based on build configuration + "SUIT_MPI_GENERATE", # Used by nRF runners to program provisioning data, based on build configuration + "SUIT_MPI_RAD_AREA_PATH", # Used by nRF runners to program provisioning data, based on build configuration "TEST1", "TOOLCHAIN_ARCMWDT_SUPPORTS_THREAD_LOCAL_STORAGE", # The symbol is defined in the toolchain # Kconfig which is sourced based on Zephyr @@ -1023,16 +1031,10 @@ def check_no_undef_outside_kconfig(self, kconf): "USB_CONSOLE", "USE_STDC_", "WHATEVER", - "EXTRA_FIRMWARE_DIR", # Linux, in boards/xtensa/intel_adsp_cavs25/doc - "HUGETLBFS", # Linux, in boards/xtensa/intel_adsp_cavs25/doc - "MODVERSIONS", # Linux, in boards/xtensa/intel_adsp_cavs25/doc - "SECURITY_LOADPIN", # Linux, in boards/xtensa/intel_adsp_cavs25/doc "ZEPHYR_TRY_MASS_ERASE", # MCUBoot setting described in sysbuild # documentation "ZTEST_FAIL_TEST_", # regex in tests/ztest/fail/CMakeLists.txt - "SUIT_MPI_GENERATE", # Used by nRF runners to program provisioning data, based on build configuration - "SUIT_MPI_APP_AREA_PATH", # Used by nRF runners to program provisioning data, based on build configuration - "SUIT_MPI_RAD_AREA_PATH", # Used by nRF runners to program provisioning data, based on build configuration + # zephyr-keep-sorted-stop } From 2b5012a5d9f0faa7d323bd64f2b412289046bfb0 Mon Sep 17 00:00:00 2001 From: Tom Burdick Date: Fri, 25 Oct 2024 12:45:38 -0500 Subject: [PATCH 2598/4482] kernel: Move run queue initialization Move the initialization of the priority q for running out of sched.c to remove one more ifdef from sched.c. No change in functionality but better matches the rest of sched.c and priority_q.h such that the ifdefry needed is done in in priority_q.h. Signed-off-by: Tom Burdick --- kernel/include/priority_q.h | 25 ++++++++++++++++++++++++- kernel/sched.c | 14 +------------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/kernel/include/priority_q.h b/kernel/include/priority_q.h index a2edc26088fa8..679e3f9dbdc64 100644 --- a/kernel/include/priority_q.h +++ b/kernel/include/priority_q.h @@ -17,6 +17,7 @@ bool z_priq_rb_lessthan(struct rbnode *a, struct rbnode *b); /* Dumb Scheduling */ #if defined(CONFIG_SCHED_DUMB) +#define _priq_run_init z_priq_dumb_init #define _priq_run_add z_priq_dumb_add #define _priq_run_remove z_priq_dumb_remove # if defined(CONFIG_SCHED_CPU_MASK) @@ -26,6 +27,7 @@ bool z_priq_rb_lessthan(struct rbnode *a, struct rbnode *b); # endif /* CONFIG_SCHED_CPU_MASK */ /* Scalable Scheduling */ #elif defined(CONFIG_SCHED_SCALABLE) +#define _priq_run_init z_priq_rb_init #define _priq_run_add z_priq_rb_add #define _priq_run_remove z_priq_rb_remove #define _priq_run_best z_priq_rb_best @@ -37,7 +39,7 @@ bool z_priq_rb_lessthan(struct rbnode *a, struct rbnode *b); #else #define NBITS 32 #endif /* CONFIG_64BIT */ - +#define _priq_run_init z_priq_mq_init #define _priq_run_add z_priq_mq_add #define _priq_run_remove z_priq_mq_remove #define _priq_run_best z_priq_mq_best @@ -57,6 +59,11 @@ static ALWAYS_INLINE void z_priq_mq_remove(struct _priq_mq *pq, struct k_thread #define _priq_wait_best z_priq_dumb_best #endif +static ALWAYS_INLINE void z_priq_dumb_init(sys_dlist_t *pq) +{ + sys_dlist_init(pq); +} + static ALWAYS_INLINE void z_priq_dumb_remove(sys_dlist_t *pq, struct k_thread *thread) { ARG_UNUSED(pq); @@ -75,6 +82,15 @@ static ALWAYS_INLINE struct k_thread *z_priq_dumb_best(sys_dlist_t *pq) return thread; } +static ALWAYS_INLINE void z_priq_rb_init(struct _priq_rb *pq) +{ + *pq = (struct _priq_rb) { + .tree = { + .lessthan_fn = z_priq_rb_lessthan, + } + }; +} + static ALWAYS_INLINE void z_priq_rb_add(struct _priq_rb *pq, struct k_thread *thread) { struct k_thread *t; @@ -163,6 +179,13 @@ static ALWAYS_INLINE struct prio_info get_prio_info(int8_t old_prio) return ret; } +static ALWAYS_INLINE void z_priq_mq_init(struct _priq_mq *q) +{ + for (int i = 0; i < ARRAY_SIZE(q->queues); i++) { + sys_dlist_init(&q->queues[i]); + } +} + static ALWAYS_INLINE void z_priq_mq_add(struct _priq_mq *pq, struct k_thread *thread) { diff --git a/kernel/sched.c b/kernel/sched.c index 7db9c1b59fd06..eda1a3e0908ff 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -968,19 +968,7 @@ int z_unpend_all(_wait_q_t *wait_q) void init_ready_q(struct _ready_q *ready_q) { -#if defined(CONFIG_SCHED_SCALABLE) - ready_q->runq = (struct _priq_rb) { - .tree = { - .lessthan_fn = z_priq_rb_lessthan, - } - }; -#elif defined(CONFIG_SCHED_MULTIQ) - for (int i = 0; i < ARRAY_SIZE(_kernel.ready_q.runq.queues); i++) { - sys_dlist_init(&ready_q->runq.queues[i]); - } -#else - sys_dlist_init(&ready_q->runq); -#endif + _priq_run_init(&ready_q->runq); } void z_sched_init(void) From b44ab89c4cc540fd7d9e8e19d1abd32b43518e64 Mon Sep 17 00:00:00 2001 From: Yishai Jaffe Date: Sun, 27 Oct 2024 17:27:47 +0200 Subject: [PATCH 2599/4482] samples: sensor: die temperature polling: remove redundant configuration rpi_pico.conf only adds CONFIG_ADC=y which already exists in the prj.conf so it's redundant and can be removed. Signed-off-by: Yishai Jaffe --- samples/sensor/die_temp_polling/boards/rpi_pico.conf | 1 - 1 file changed, 1 deletion(-) delete mode 100644 samples/sensor/die_temp_polling/boards/rpi_pico.conf diff --git a/samples/sensor/die_temp_polling/boards/rpi_pico.conf b/samples/sensor/die_temp_polling/boards/rpi_pico.conf deleted file mode 100644 index 488a81dca5204..0000000000000 --- a/samples/sensor/die_temp_polling/boards/rpi_pico.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_ADC=y From 7e1f754f02a46625fea8eaa1fd4d88d461f98ebf Mon Sep 17 00:00:00 2001 From: Neil Chen Date: Mon, 28 Oct 2024 11:06:16 +0800 Subject: [PATCH 2600/4482] dts: arm/nxp: Add mrt nodes to NXP MCXN23x dtsi file Add mrt nodes to NXP MCXN23x dtsi file Signed-off-by: Neil Chen --- dts/arm/nxp/nxp_mcxn23x_common.dtsi | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/dts/arm/nxp/nxp_mcxn23x_common.dtsi b/dts/arm/nxp/nxp_mcxn23x_common.dtsi index 698f83bd75d2e..9f24c3b3b5e93 100644 --- a/dts/arm/nxp/nxp_mcxn23x_common.dtsi +++ b/dts/arm/nxp/nxp_mcxn23x_common.dtsi @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -66,6 +67,10 @@ compatible = "nxp,lpc-syscon"; reg = <0x0 0x4000>; #clock-cells = <1>; + reset: reset { + compatible = "nxp,lpc-syscon-reset"; + #reset-cells = <1>; + }; }; porta: pinmux@116000 { @@ -789,6 +794,39 @@ clk-source = <1>; resolution = <32>; }; + + mrt0: mrt@13000 { + compatible = "nxp,mrt"; + reg = <0x13000 0x1000>; + interrupts = <30 0>; + num-channels = <4>; + num-bits = <24>; + clocks = <&syscon MCUX_MRT_CLK>; + resets = <&reset NXP_SYSCON_RESET(1, 0)>; + #address-cells = <1>; + #size-cells = <0>; + + mrt0_channel0: mrt0_channel@0 { + compatible = "nxp,mrt-channel"; + reg = <0>; + status = "disabled"; + }; + mrt0_channel1: mrt0_channel@1 { + compatible = "nxp,mrt-channel"; + reg = <1>; + status = "disabled"; + }; + mrt0_channel2: mrt0_channel@2 { + compatible = "nxp,mrt-channel"; + reg = <2>; + status = "disabled"; + }; + mrt0_channel3: mrt0_channel@3 { + compatible = "nxp,mrt-channel"; + reg = <3>; + status = "disabled"; + }; + }; }; &systick { From 02027365f15686fd72fef959ef1531c6a723fd6d Mon Sep 17 00:00:00 2001 From: Neil Chen Date: Mon, 28 Oct 2024 11:06:44 +0800 Subject: [PATCH 2601/4482] boards: nxp/frdm_mcxn236: Support MRT for NXP frdm_mcxn236 board Enabled the MRT at the board level for mcxn236. Signed-off-by: Neil Chen --- boards/nxp/frdm_mcxn236/doc/index.rst | 2 ++ boards/nxp/frdm_mcxn236/frdm_mcxn236.dts | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/boards/nxp/frdm_mcxn236/doc/index.rst b/boards/nxp/frdm_mcxn236/doc/index.rst index 066cdaeeb3abf..92147c0399cfd 100644 --- a/boards/nxp/frdm_mcxn236/doc/index.rst +++ b/boards/nxp/frdm_mcxn236/doc/index.rst @@ -76,6 +76,8 @@ The FRDM-MCXN236 board configuration supports the following hardware features: +-----------+------------+-------------------------------------+ | LPTMR | on-chip | counter | +-----------+------------+-------------------------------------+ +| MRT | on-chip | counter | ++-----------+------------+-------------------------------------+ Targets available ================== diff --git a/boards/nxp/frdm_mcxn236/frdm_mcxn236.dts b/boards/nxp/frdm_mcxn236/frdm_mcxn236.dts index 6eef74a0a7421..9910f7b413a44 100644 --- a/boards/nxp/frdm_mcxn236/frdm_mcxn236.dts +++ b/boards/nxp/frdm_mcxn236/frdm_mcxn236.dts @@ -138,3 +138,7 @@ &lptmr0 { status = "okay"; }; + +&mrt0_channel0 { + status = "okay"; +}; From 06f4213e6bc107d8dfdfcd81d2b8df5ed896497d Mon Sep 17 00:00:00 2001 From: Ren Chen Date: Fri, 1 Nov 2024 13:01:03 +0800 Subject: [PATCH 2602/4482] driver: spi: support it8xxx2 spi driver This commit adds the it8xxx2 spi driver support. Tested with: - west build -p always -b it8xxx2_evb samples/drivers/spi_flash Signed-off-by: Ren Chen --- drivers/spi/CMakeLists.txt | 1 + drivers/spi/Kconfig | 2 + drivers/spi/Kconfig.it8xxx2 | 11 + drivers/spi/spi_it8xxx2.c | 531 +++++++++++++++++++++++++ dts/bindings/spi/ite,it8xxx2-spi.yaml | 22 + dts/bindings/spi/ite,it8xxx2-sspi.yaml | 15 - dts/riscv/ite/it81xx2.dtsi | 10 + dts/riscv/ite/it82xx2.dtsi | 10 + dts/riscv/ite/it8xxx2-pinctrl-map.dtsi | 23 ++ dts/riscv/ite/it8xxx2.dtsi | 18 - 10 files changed, 610 insertions(+), 33 deletions(-) create mode 100644 drivers/spi/Kconfig.it8xxx2 create mode 100644 drivers/spi/spi_it8xxx2.c create mode 100644 dts/bindings/spi/ite,it8xxx2-spi.yaml delete mode 100644 dts/bindings/spi/ite,it8xxx2-sspi.yaml diff --git a/drivers/spi/CMakeLists.txt b/drivers/spi/CMakeLists.txt index d89ac3f9555f7..36c21ba530a64 100644 --- a/drivers/spi/CMakeLists.txt +++ b/drivers/spi/CMakeLists.txt @@ -54,6 +54,7 @@ zephyr_library_sources_ifdef(CONFIG_SPI_MCHP_MSS spi_mchp_mss.c) zephyr_library_sources_ifdef(CONFIG_SPI_RENESAS_RA8 spi_b_renesas_ra8.c) zephyr_library_sources_ifdef(CONFIG_SPI_RTIO spi_rtio.c) zephyr_library_sources_ifdef(CONFIG_SPI_ASYNC spi_signal.c) +zephyr_library_sources_ifdef(CONFIG_SPI_ITE_IT8XXX2 spi_it8xxx2.c) zephyr_library_sources_ifdef(CONFIG_USERSPACE spi_handlers.c) zephyr_library_sources_ifdef(CONFIG_SPI_INFINEON_CAT1 spi_ifx_cat1.c) zephyr_library_sources_ifdef(CONFIG_SPI_SEDI spi_sedi.c) diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 1c4aaac2013a2..18345365b25e7 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -163,4 +163,6 @@ source "drivers/spi/Kconfig.max32" source "drivers/spi/Kconfig.renesas_ra8" +source "drivers/spi/Kconfig.it8xxx2" + endif # SPI diff --git a/drivers/spi/Kconfig.it8xxx2 b/drivers/spi/Kconfig.it8xxx2 new file mode 100644 index 0000000000000..e0d04f03d7d3d --- /dev/null +++ b/drivers/spi/Kconfig.it8xxx2 @@ -0,0 +1,11 @@ +# Copyright (c) 2024 ITE Corporation. +# SPDX-License-Identifier: Apache-2.0 + +config SPI_ITE_IT8XXX2 + bool "ITE IT8XXX2 SPI Driver" + default y + depends on DT_HAS_ITE_IT8XXX2_SPI_ENABLED + select PINCTRL + select SOC_IT8XXX2_CPU_IDLE_GATING + help + Enable support for the ITE IT8XXX2 SPI host(SSPI) driver. diff --git a/drivers/spi/spi_it8xxx2.c b/drivers/spi/spi_it8xxx2.c new file mode 100644 index 0000000000000..7bdd3ea3aa4aa --- /dev/null +++ b/drivers/spi/spi_it8xxx2.c @@ -0,0 +1,531 @@ +/* + * Copyright (c) 2024 ITE Technology Inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT ite_it8xxx2_spi + +#include +LOG_MODULE_REGISTER(spi_it8xxx2, CONFIG_SPI_LOG_LEVEL); + +#include +#include +#include +#include +#include + +#include "spi_context.h" + +#define BYTE_0(x) (uint8_t)(((x) >> 0) & 0xFF) +#define BYTE_1(x) (uint8_t)(((x) >> 8) & 0xFF) +#define BYTE_2(x) (uint8_t)(((x) >> 16) & 0xFF) + +#define SRAM_BASE_ADDR DT_REG_ADDR(DT_NODELABEL(sram0)) + +#define SPI_CHIP_SELECT_COUNT 2 +#define SPI_CMDQ_WR_CMD_LEN_MAX 16 +#define SPI_CMDQ_DATA_LEN_MAX 0xFFFF + +/* IT8xxx2 SSPI Registers Definition */ +#define SPI01_CTRL1 0x01 +#define CLOCK_POLARTY BIT(6) +#define SSCK_FREQ_MASK (BIT(2) | BIT(3) | BIT(4)) +#define INTERRUPT_EN BIT(1) + +#define SPI04_CTRL3 0x04 +#define AUTO_MODE BIT(5) + +#define SPI05_CH0_CMD_ADDR_LB 0x05 +#define SPI06_CH0_CMD_ADDR_HB 0x06 +#define SPI0C_INT_STS 0x0C +#define SPI_CMDQ_BUS_END_INT_MASK BIT(4) +#define SPI_DMA_RBUF_1_FULL BIT(2) +#define SPI_DMA_RBUF_0_FULL BIT(1) +#define SPI_CMDQ_BUS_END BIT(0) + +#define SPI0D_CTRL5 0x0D +#define CH1_SEL_CMDQ BIT(5) +#define CH0_SEL_CMDQ BIT(4) +#define SCK_FREQ_DIV_1_EN BIT(1) +#define CMDQ_MODE_EN BIT(0) + +#define SPI0E_CH0_WR_MEM_ADDR_LB 0x0E +#define SPI0F_CH0_WR_MEM_ADDR_HB 0x0F +#define SPI12_CH1_CMD_ADDR_LB 0x12 +#define SPI13_CH1_CMD_ADDR_HB 0x13 +#define SPI14_CH1_WR_MEM_ADDR_LB 0x14 +#define SPI15_CH1_WR_MEM_ADDR_HB 0x15 +#define SPI21_CH0_CMD_ADDR_HB2 0x21 +#define SPI23_CH0_WR_MEM_ADDR_HB2 0x23 +#define SPI25_CH1_CMD_ADDR_HB2 0x25 +#define SPI27_CH1_WR_MEM_ADDR_HB2 0x27 + +struct spi_it8xxx2_cmdq_data { + uint8_t spi_write_cmd_length; + + union { + uint8_t value; + struct { + uint8_t cmd_end: 1; + uint8_t read_write: 1; + uint8_t auto_check_sts: 1; + uint8_t cs_active: 1; + uint8_t reserved: 1; + uint8_t cmd_mode: 2; + uint8_t dtr: 1; + } __packed fields; + } __packed command; + + uint8_t data_length_lb; + uint8_t data_length_hb; + uint8_t data_addr_lb; + uint8_t data_addr_hb; + uint8_t check_bit_mask; + uint8_t check_bit_value; + + uint8_t write_data[SPI_CMDQ_WR_CMD_LEN_MAX]; +}; + +struct spi_it8xxx2_config { + mm_reg_t base; + const struct pinctrl_dev_config *pcfg; + uint8_t spi_irq; +}; + +struct spi_it8xxx2_data { + struct spi_context ctx; + struct spi_it8xxx2_cmdq_data cmdq_data; + size_t transfer_len; + size_t receive_len; +}; + +static inline int spi_it8xxx2_set_freq(const struct device *dev, const uint32_t frequency) +{ + const struct spi_it8xxx2_config *cfg = dev->config; + uint8_t freq_div[8] = {2, 4, 6, 8, 10, 12, 14, 16}; + uint32_t clk_pll, clk_sspi; + uint8_t reg_val; + + clk_pll = chip_get_pll_freq(); + clk_sspi = clk_pll / (((IT8XXX2_ECPM_SCDCR2 & 0xF0) >> 4) + 1U); + if (frequency < (clk_sspi / 16) || frequency > clk_sspi) { + LOG_ERR("Unsupported frequency %d", frequency); + return -ENOTSUP; + } + + if (frequency == clk_sspi) { + sys_write8(sys_read8(cfg->base + SPI0D_CTRL5) | SCK_FREQ_DIV_1_EN, + cfg->base + SPI0D_CTRL5); + } else { + for (int i = 0; i <= ARRAY_SIZE(freq_div); i++) { + if (i == ARRAY_SIZE(freq_div)) { + LOG_ERR("Unknown frequency %d", frequency); + return -ENOTSUP; + } + if (frequency == (clk_sspi / freq_div[i])) { + sys_write8(sys_read8(cfg->base + SPI0D_CTRL5) & ~SCK_FREQ_DIV_1_EN, + cfg->base + SPI0D_CTRL5); + reg_val = sys_read8(cfg->base + SPI01_CTRL1); + reg_val = (reg_val & (~SSCK_FREQ_MASK)) | (i << 2); + sys_write8(reg_val, cfg->base + SPI01_CTRL1); + break; + } + } + } + + LOG_DBG("freq: pll %dHz, sspi %dHz, ssck %dHz", clk_pll, clk_sspi, frequency); + return 0; +} + +static int spi_it8xxx2_configure(const struct device *dev, const struct spi_config *spi_cfg) +{ + const struct spi_it8xxx2_config *cfg = dev->config; + struct spi_it8xxx2_data *data = dev->data; + struct spi_context *ctx = &data->ctx; + int ret; + uint8_t reg_val; + + if (spi_cfg->slave > (SPI_CHIP_SELECT_COUNT - 1)) { + LOG_ERR("Slave %d is greater than %d", spi_cfg->slave, SPI_CHIP_SELECT_COUNT - 1); + return -EINVAL; + } + + LOG_DBG("chip select: %d, operation: 0x%x", spi_cfg->slave, spi_cfg->operation); + + if (SPI_OP_MODE_GET(spi_cfg->operation) == SPI_OP_MODE_SLAVE) { + LOG_ERR("Unsupported SPI slave mode"); + return -ENOTSUP; + } + + if (SPI_MODE_GET(spi_cfg->operation) & SPI_MODE_LOOP) { + LOG_ERR("Unsupported loopback mode"); + return -ENOTSUP; + } + + if (SPI_MODE_GET(spi_cfg->operation) & SPI_MODE_CPHA) { + LOG_ERR("Unsupported cpha mode"); + return -ENOTSUP; + } + + reg_val = sys_read8(cfg->base + SPI01_CTRL1); + if (SPI_MODE_GET(spi_cfg->operation) & SPI_MODE_CPOL) { + reg_val |= CLOCK_POLARTY; + } else { + reg_val &= ~CLOCK_POLARTY; + } + sys_write8(reg_val, cfg->base + SPI01_CTRL1); + + if (SPI_WORD_SIZE_GET(spi_cfg->operation) != 8) { + return -ENOTSUP; + } + + if (IS_ENABLED(CONFIG_SPI_EXTENDED_MODES) && + (spi_cfg->operation & SPI_LINES_MASK) != SPI_LINES_SINGLE) { + LOG_ERR("Only single line mode is supported"); + return -EINVAL; + } + + ret = spi_it8xxx2_set_freq(dev, spi_cfg->frequency); + if (ret) { + return ret; + } + + reg_val = sys_read8(cfg->base + SPI0C_INT_STS); + reg_val = (reg_val & (~SPI_CMDQ_BUS_END_INT_MASK)); + sys_write8(reg_val, cfg->base + SPI0C_INT_STS); + + ctx->config = spi_cfg; + return 0; +} + +static inline bool spi_it8xxx2_transfer_done(struct spi_context *ctx) +{ + return !spi_context_tx_buf_on(ctx) && !spi_context_rx_buf_on(ctx); +} + +static void spi_it8xxx2_complete(const struct device *dev, const int status) +{ + struct spi_it8xxx2_data *data = dev->data; + struct spi_context *ctx = &data->ctx; + + spi_context_complete(ctx, dev, status); + if (spi_cs_is_gpio(ctx->config)) { + spi_context_cs_control(ctx, false); + } + /* Permit to enter power policy and idle mode. */ + pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES); + chip_permit_idle(); +} + +static inline void spi_it8xxx2_tx(const struct device *dev) +{ + struct spi_it8xxx2_data *data = dev->data; + struct spi_context *ctx = &data->ctx; + uint32_t mem_address; + + if (ctx->tx_count > 1) { + data->cmdq_data.command.fields.cs_active = 1; + } else { + data->cmdq_data.command.fields.cs_active = 0; + } + data->cmdq_data.command.fields.cmd_end = 1; + data->cmdq_data.command.fields.read_write = 0; + if (ctx->tx_len <= SPI_CMDQ_WR_CMD_LEN_MAX) { + data->cmdq_data.spi_write_cmd_length = ctx->tx_len; + memcpy(data->cmdq_data.write_data, ctx->tx_buf, ctx->tx_len); + data->cmdq_data.data_length_lb = 0; + data->cmdq_data.data_length_hb = 0; + data->cmdq_data.data_addr_lb = 0; + data->cmdq_data.data_addr_hb = 0; + } else { + data->cmdq_data.spi_write_cmd_length = SPI_CMDQ_WR_CMD_LEN_MAX; + memcpy(data->cmdq_data.write_data, ctx->tx_buf, SPI_CMDQ_WR_CMD_LEN_MAX); + data->cmdq_data.data_length_lb = BYTE_0(ctx->tx_len - SPI_CMDQ_WR_CMD_LEN_MAX); + data->cmdq_data.data_length_hb = BYTE_1(ctx->tx_len - SPI_CMDQ_WR_CMD_LEN_MAX); + mem_address = (uint32_t)(ctx->tx_buf + SPI_CMDQ_WR_CMD_LEN_MAX) - SRAM_BASE_ADDR; + data->cmdq_data.data_addr_lb = BYTE_0(mem_address); + data->cmdq_data.data_addr_hb = BYTE_1(mem_address); + data->cmdq_data.check_bit_mask |= ((BYTE_2(mem_address)) & 0x03); + } + data->transfer_len = ctx->tx_len; +} + +static inline void spi_it8xxx2_rx(const struct device *dev) +{ + struct spi_it8xxx2_data *data = dev->data; + struct spi_context *ctx = &data->ctx; + + if (ctx->rx_count > 1) { + data->cmdq_data.command.fields.cs_active = 1; + } else { + data->cmdq_data.command.fields.cs_active = 0; + } + data->cmdq_data.command.fields.cmd_end = 1; + data->cmdq_data.command.fields.read_write = 1; + data->cmdq_data.spi_write_cmd_length = 0; + data->cmdq_data.data_length_lb = BYTE_0(ctx->rx_len); + data->cmdq_data.data_length_hb = BYTE_1(ctx->rx_len); + data->cmdq_data.data_addr_lb = 0; + data->cmdq_data.data_addr_hb = 0; + data->receive_len = ctx->rx_len; +} + +static inline void spi_it8xxx2_tx_rx(const struct device *dev) +{ + struct spi_it8xxx2_data *data = dev->data; + struct spi_context *ctx = &data->ctx; + uint32_t mem_address; + + data->cmdq_data.command.fields.cmd_end = 1; + if (ctx->tx_len <= SPI_CMDQ_WR_CMD_LEN_MAX) { + data->cmdq_data.command.fields.cs_active = 0; + data->cmdq_data.command.fields.read_write = 1; + data->cmdq_data.spi_write_cmd_length = ctx->tx_len; + memcpy(data->cmdq_data.write_data, ctx->tx_buf, ctx->tx_len); + if (ctx->rx_buf == ctx->tx_buf) { + spi_context_update_tx(ctx, 1, ctx->tx_len); + spi_context_update_rx(ctx, 1, ctx->rx_len); + } + + data->cmdq_data.data_length_lb = BYTE_0(ctx->rx_len); + data->cmdq_data.data_length_hb = BYTE_1(ctx->rx_len); + data->cmdq_data.data_addr_lb = 0; + data->cmdq_data.data_addr_hb = 0; + data->transfer_len = ctx->tx_len; + data->receive_len = ctx->rx_len; + } else { + data->cmdq_data.command.fields.cs_active = 1; + data->cmdq_data.command.fields.read_write = 0; + data->cmdq_data.spi_write_cmd_length = SPI_CMDQ_WR_CMD_LEN_MAX; + memcpy(data->cmdq_data.write_data, ctx->tx_buf, SPI_CMDQ_WR_CMD_LEN_MAX); + data->cmdq_data.data_length_lb = BYTE_0(ctx->tx_len - SPI_CMDQ_WR_CMD_LEN_MAX); + data->cmdq_data.data_length_hb = BYTE_1(ctx->tx_len - SPI_CMDQ_WR_CMD_LEN_MAX); + + mem_address = (uint32_t)(ctx->tx_buf + SPI_CMDQ_WR_CMD_LEN_MAX) - SRAM_BASE_ADDR; + data->cmdq_data.data_addr_lb = BYTE_0(mem_address); + data->cmdq_data.data_addr_hb = BYTE_1(mem_address); + data->cmdq_data.check_bit_mask |= ((BYTE_2(mem_address)) & 0x03); + if (ctx->rx_buf == ctx->tx_buf) { + spi_context_update_tx(ctx, 1, ctx->tx_len); + spi_context_update_rx(ctx, 1, ctx->rx_len); + } + data->transfer_len = ctx->tx_len; + data->receive_len = 0; + } +} + +static int spi_it8xxx2_next_xfer(const struct device *dev) +{ + const struct spi_it8xxx2_config *cfg = dev->config; + struct spi_it8xxx2_data *data = dev->data; + struct spi_context *ctx = &data->ctx; + uint8_t reg_val; + uint32_t cmd_address, mem_address; + + if (spi_it8xxx2_transfer_done(ctx)) { + spi_it8xxx2_complete(dev, 0); + return 0; + } + + if (spi_cs_is_gpio(ctx->config)) { + spi_context_cs_control(ctx, true); + } + + if (spi_context_longest_current_buf(ctx) > SPI_CMDQ_DATA_LEN_MAX) { + return -EINVAL; + } + + memset(&data->cmdq_data, 0, sizeof(struct spi_it8xxx2_cmdq_data)); + + /* Prepare command queue data */ + if (!spi_context_tx_on(ctx)) { + /* rx only, nothing to tx */ + spi_it8xxx2_rx(dev); + } else if (!spi_context_rx_on(ctx)) { + /* tx only, nothing to rx */ + spi_it8xxx2_tx(dev); + } else { + spi_it8xxx2_tx_rx(dev); + } + + cmd_address = (uint32_t)(&data->cmdq_data) - SRAM_BASE_ADDR; + mem_address = (uint32_t)ctx->rx_buf - SRAM_BASE_ADDR; + if (ctx->config->slave == 0) { + sys_write8(BYTE_0(cmd_address), cfg->base + SPI05_CH0_CMD_ADDR_LB); + sys_write8(BYTE_1(cmd_address), cfg->base + SPI06_CH0_CMD_ADDR_HB); + sys_write8(BYTE_2(cmd_address), cfg->base + SPI21_CH0_CMD_ADDR_HB2); + + if (spi_context_rx_on(ctx)) { + sys_write8(BYTE_0(mem_address), cfg->base + SPI0E_CH0_WR_MEM_ADDR_LB); + sys_write8(BYTE_1(mem_address), cfg->base + SPI0F_CH0_WR_MEM_ADDR_HB); + sys_write8(BYTE_2(mem_address), cfg->base + SPI23_CH0_WR_MEM_ADDR_HB2); + } + } else { + sys_write8(BYTE_0(cmd_address), cfg->base + SPI12_CH1_CMD_ADDR_LB); + sys_write8(BYTE_1(cmd_address), cfg->base + SPI13_CH1_CMD_ADDR_HB); + sys_write8(BYTE_2(cmd_address), cfg->base + SPI25_CH1_CMD_ADDR_HB2); + + if (spi_context_rx_on(ctx)) { + sys_write8(BYTE_0(mem_address), cfg->base + SPI14_CH1_WR_MEM_ADDR_LB); + sys_write8(BYTE_1(mem_address), cfg->base + SPI15_CH1_WR_MEM_ADDR_HB); + sys_write8(BYTE_2(mem_address), cfg->base + SPI27_CH1_WR_MEM_ADDR_HB2); + } + } + + sys_write8(sys_read8(cfg->base + SPI01_CTRL1) | INTERRUPT_EN, cfg->base + SPI01_CTRL1); + + reg_val = sys_read8(cfg->base + SPI0D_CTRL5); + reg_val |= (ctx->config->slave == 0) ? CH0_SEL_CMDQ : CH1_SEL_CMDQ; + sys_write8(reg_val | CMDQ_MODE_EN, cfg->base + SPI0D_CTRL5); + return 0; +} + +static int transceive(const struct device *dev, const struct spi_config *config, + const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs, + bool asynchronous, spi_callback_t cb, void *userdata) +{ + struct spi_it8xxx2_data *data = dev->data; + struct spi_context *ctx = &data->ctx; + int ret; + + spi_context_lock(ctx, asynchronous, cb, userdata, config); + + /* Configure spi */ + ret = spi_it8xxx2_configure(dev, config); + if (ret) { + spi_context_release(ctx, ret); + return ret; + } + + /* + * The EC processor(CPU) cannot be in the k_cpu_idle() and power + * policy during the transactions with the CQ mode. + * Otherwise, the EC processor would be clock gated. + */ + chip_block_idle(); + pm_policy_state_lock_get(PM_STATE_STANDBY, PM_ALL_SUBSTATES); + + spi_context_buffers_setup(ctx, tx_bufs, rx_bufs, 1); + ret = spi_it8xxx2_next_xfer(dev); + if (!ret) { + ret = spi_context_wait_for_completion(ctx); + } else { + spi_it8xxx2_complete(dev, ret); + } + + spi_context_release(ctx, ret); + return ret; +} + +static int it8xxx2_transceive(const struct device *dev, const struct spi_config *config, + const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs) +{ + return transceive(dev, config, tx_bufs, rx_bufs, false, NULL, NULL); +} + +#ifdef CONFIG_SPI_ASYNC +static int it8xxx2_transceive_async(const struct device *dev, const struct spi_config *config, + const struct spi_buf_set *tx_bufs, + const struct spi_buf_set *rx_bufs, spi_callback_t cb, + void *userdata) +{ + return transceive(dev, config, tx_bufs, rx_bufs, true, cb, userdata); +} +#endif /* CONFIG_SPI_ASYNC */ + +static int it8xxx2_release(const struct device *dev, const struct spi_config *config) +{ + struct spi_it8xxx2_data *data = dev->data; + + spi_context_unlock_unconditionally(&data->ctx); + return 0; +} + +static void it8xxx2_spi_isr(const void *arg) +{ + const struct device *dev = arg; + const struct spi_it8xxx2_config *cfg = dev->config; + struct spi_it8xxx2_data *data = dev->data; + struct spi_context *ctx = &data->ctx; + uint8_t reg_val; + int ret; + + reg_val = sys_read8(cfg->base + SPI0C_INT_STS); + sys_write8(reg_val, cfg->base + SPI0C_INT_STS); + if (reg_val & (SPI_DMA_RBUF_0_FULL | SPI_DMA_RBUF_1_FULL)) { + LOG_INF("Triggered dma ring buffer full interrupt, status: 0x%x", reg_val); + } + + if (reg_val & SPI_CMDQ_BUS_END) { + reg_val = sys_read8(cfg->base + SPI0D_CTRL5); + if (ctx->config->slave == 0) { + reg_val &= ~CH0_SEL_CMDQ; + } else { + reg_val &= ~CH1_SEL_CMDQ; + } + sys_write8(reg_val, cfg->base + SPI0D_CTRL5); + + spi_context_update_tx(ctx, 1, data->transfer_len); + spi_context_update_rx(ctx, 1, data->receive_len); + ret = spi_it8xxx2_next_xfer(dev); + if (ret) { + spi_it8xxx2_complete(dev, ret); + } + } +} + +static int spi_it8xxx2_init(const struct device *dev) +{ + const struct spi_it8xxx2_config *cfg = dev->config; + struct spi_it8xxx2_data *data = dev->data; + int ret; + + ret = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT); + if (ret) { + LOG_ERR("Failed to set default pinctrl"); + return ret; + } + + /* Enable one-shot mode */ + sys_write8(sys_read8(cfg->base + SPI04_CTRL3) & ~AUTO_MODE, cfg->base + SPI04_CTRL3); + + irq_connect_dynamic(cfg->spi_irq, 0, it8xxx2_spi_isr, dev, 0); + irq_enable(cfg->spi_irq); + + ret = spi_context_cs_configure_all(&data->ctx); + if (ret) { + return ret; + } + + spi_context_unlock_unconditionally(&data->ctx); + return 0; +} + +static const struct spi_driver_api spi_it8xxx2_driver_api = { + .transceive = it8xxx2_transceive, + .release = it8xxx2_release, + +#ifdef CONFIG_SPI_ASYNC + .transceive_async = it8xxx2_transceive_async, +#endif +}; + +#define SPI_IT8XXX2_INIT(n) \ + PINCTRL_DT_INST_DEFINE(n); \ + static const struct spi_it8xxx2_config spi_it8xxx2_cfg_##n = { \ + .base = DT_INST_REG_ADDR(n), \ + .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ + .spi_irq = DT_INST_IRQ(n, irq), \ + }; \ + \ + static struct spi_it8xxx2_data spi_it8xxx2_data_##n = { \ + SPI_CONTEXT_INIT_LOCK(spi_it8xxx2_data_##n, ctx), \ + SPI_CONTEXT_INIT_SYNC(spi_it8xxx2_data_##n, ctx), \ + SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(n), ctx)}; \ + \ + DEVICE_DT_INST_DEFINE(n, &spi_it8xxx2_init, NULL, &spi_it8xxx2_data_##n, \ + &spi_it8xxx2_cfg_##n, POST_KERNEL, \ + CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &spi_it8xxx2_driver_api); + +DT_INST_FOREACH_STATUS_OKAY(SPI_IT8XXX2_INIT) diff --git a/dts/bindings/spi/ite,it8xxx2-spi.yaml b/dts/bindings/spi/ite,it8xxx2-spi.yaml new file mode 100644 index 0000000000000..66701925b5b78 --- /dev/null +++ b/dts/bindings/spi/ite,it8xxx2-spi.yaml @@ -0,0 +1,22 @@ +# Copyright (c) 2024 ITE Corporation. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +description: IT8XXX2 SPI + +compatible: "ite,it8xxx2-spi" + +include: [spi-controller.yaml, pinctrl-device.yaml] + +properties: + reg: + required: true + + interrupts: + required: true + + pinctrl-names: + required: true + + pinctrl-0: + type: phandles + required: true diff --git a/dts/bindings/spi/ite,it8xxx2-sspi.yaml b/dts/bindings/spi/ite,it8xxx2-sspi.yaml deleted file mode 100644 index e214d8fdb798e..0000000000000 --- a/dts/bindings/spi/ite,it8xxx2-sspi.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2020 ITE Corporation. All Rights Reserved. -# SPDX-License-Identifier: Apache-2.0 - -description: IT8XXX2 SPI - -compatible: "ite,it8xxx2-sspi" - -include: spi-controller.yaml - -properties: - reg: - required: true - - interrupts: - required: true diff --git a/dts/riscv/ite/it81xx2.dtsi b/dts/riscv/ite/it81xx2.dtsi index 53dd3b0cdc935..f85489dcab27e 100644 --- a/dts/riscv/ite/it81xx2.dtsi +++ b/dts/riscv/ite/it81xx2.dtsi @@ -627,6 +627,16 @@ reg = <0x00f0202d 0x3>; status = "disabled"; }; + + spi0: spi@f02600 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "ite,it8xxx2-spi"; + reg = <0x00f02600 0x34>; + interrupt-parent = <&intc>; + interrupts = <37 IRQ_TYPE_EDGE_RISING>; + status = "disabled"; + }; }; }; diff --git a/dts/riscv/ite/it82xx2.dtsi b/dts/riscv/ite/it82xx2.dtsi index 4e5bae980b6b7..5a087682f2717 100644 --- a/dts/riscv/ite/it82xx2.dtsi +++ b/dts/riscv/ite/it82xx2.dtsi @@ -1017,5 +1017,15 @@ reg = <0x00f03c00 0x5>; status = "disabled"; }; + + spi0: spi@f02600 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "ite,it8xxx2-spi"; + reg = <0x00f02600 0x34>; + interrupt-parent = <&intc>; + interrupts = <37 IRQ_TYPE_EDGE_RISING>; + status = "disabled"; + }; }; }; diff --git a/dts/riscv/ite/it8xxx2-pinctrl-map.dtsi b/dts/riscv/ite/it8xxx2-pinctrl-map.dtsi index b553c4fee8adc..5492f19610a00 100644 --- a/dts/riscv/ite/it8xxx2-pinctrl-map.dtsi +++ b/dts/riscv/ite/it8xxx2-pinctrl-map.dtsi @@ -404,4 +404,27 @@ pinmuxs = <&pinctrlh 6 IT8XXX2_ALT_DEFAULT>; }; + /* SPI alternate function */ + spi_ssce0_default: spi_ssce0_default { + pinmuxs = <&pinctrlg 2 IT8XXX2_ALT_FUNC_3>; + }; + spi_ssce1_default: spi_ssce1_default { + pinmuxs = <&pinctrlg 0 IT8XXX2_ALT_FUNC_3>; + }; + spi_ssck_default: spi_ssck_default { + pinmuxs = <&pinctrla 6 IT8XXX2_ALT_FUNC_3>; + }; + spi_smosi_default: spi_smosi_default { + pinmuxs = <&pinctrlc 3 IT8XXX2_ALT_FUNC_3>; + }; + spi_smiso_default: spi_smiso_default { + pinmuxs = <&pinctrlc 5 IT8XXX2_ALT_FUNC_3>; + }; + spi_sio2_default: spi_sio2_default { + pinmuxs = <&pinctrlc 0 IT8XXX2_ALT_FUNC_1>; + }; + spi_sio3_default: spi_sio3_default { + pinmuxs = <&pinctrlc 6 IT8XXX2_ALT_FUNC_1>; + }; + }; diff --git a/dts/riscv/ite/it8xxx2.dtsi b/dts/riscv/ite/it8xxx2.dtsi index a780558e92896..dfbebc7d61560 100644 --- a/dts/riscv/ite/it8xxx2.dtsi +++ b/dts/riscv/ite/it8xxx2.dtsi @@ -440,24 +440,6 @@ status = "disabled"; }; - spi0: spi@f02600 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "ite,it8xxx2-sspi"; - reg = <0x00f02600 0x40>; - interrupt-parent = <&intc>; - interrupts = <37 IRQ_TYPE_EDGE_RISING>; - clock-frequency = <115200>; - }; - spi1: spi@f02640 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "ite,it8xxx2-sspi"; - reg = <0x00f02640 0x40>; - interrupts = <37 IRQ_TYPE_EDGE_RISING>; - interrupt-parent = <&intc>; - status = "okay"; - }; shi0: shi@f03a00 { compatible = "ite,it8xxx2-shi"; reg = <0x00f03a00 0x30>; From ce4ce9986a81427d0996bc240d3a8bd4525d5e10 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 28 Oct 2024 09:01:25 +0100 Subject: [PATCH 2603/4482] snippets: rtt-console: do not disable SERIAL There's no point in disabling serial when enabling RTT. They are not incompatible between each other. Signed-off-by: Gerard Marull-Paretas --- snippets/rtt-console/rtt-console.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/snippets/rtt-console/rtt-console.conf b/snippets/rtt-console/rtt-console.conf index f05db56d94aa6..b5777654c096b 100644 --- a/snippets/rtt-console/rtt-console.conf +++ b/snippets/rtt-console/rtt-console.conf @@ -1,4 +1,3 @@ CONFIG_USE_SEGGER_RTT=y CONFIG_CONSOLE=y CONFIG_RTT_CONSOLE=y -CONFIG_UART_CONSOLE=n From 40a73ec96e7eb2fd6b5c9f1070bf1a43f378c6d5 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 28 Oct 2024 09:02:17 +0100 Subject: [PATCH 2604/4482] snippets: rtt-console: fix README issues - Title underline too long - Remove redundant how-to-use snippet bit, this can be documented generically for all snippets instead of repeating it everywhere. - Snippet does not redirect anything. - RTT does not require HW support for console. Signed-off-by: Gerard Marull-Paretas --- snippets/rtt-console/README.rst | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/snippets/rtt-console/README.rst b/snippets/rtt-console/README.rst index 68a1f1baf5a03..ec53ea694cbd7 100644 --- a/snippets/rtt-console/README.rst +++ b/snippets/rtt-console/README.rst @@ -1,21 +1,16 @@ .. _snippet-rtt-console: RTT Console Snippet (rtt-console) -######################################### - -.. code-block:: console - - west build -S rtt-console [...] +################################# Overview ******** -This snippet redirects serial console output to SEGGER RTT. +This snippet enables console output to SEGGER RTT. Requirements ************ -Hardware support for: +Support for: - :kconfig:option:`CONFIG_HAS_SEGGER_RTT` -- :kconfig:option:`CONFIG_CONSOLE` From a706461ea9469a74ee8b92074424f049c794a404 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 28 Oct 2024 09:11:47 +0100 Subject: [PATCH 2605/4482] snippets: add serial-console Add a new snippet to enable serial console. Even though most Zephyr boards enable this by default, the same is not true for many real boards, where enabling UART can increase power consumption. Having this snippet may become handy on such scenarios. We could also consider cleaning up upstream boards by just enabling this snippet by default. Signed-off-by: Gerard Marull-Paretas --- snippets/serial-console/README.rst | 9 +++++++++ snippets/serial-console/serial-console.conf | 3 +++ snippets/serial-console/snippet.yml | 3 +++ 3 files changed, 15 insertions(+) create mode 100644 snippets/serial-console/README.rst create mode 100644 snippets/serial-console/serial-console.conf create mode 100644 snippets/serial-console/snippet.yml diff --git a/snippets/serial-console/README.rst b/snippets/serial-console/README.rst new file mode 100644 index 0000000000000..0978aa0892af9 --- /dev/null +++ b/snippets/serial-console/README.rst @@ -0,0 +1,9 @@ +.. _snippet-uart-console: + +UART Console Snippet (uart-console) +################################### + +Overview +******** + +This snippet enables console output the chosen UART in ``zephyr,console``. diff --git a/snippets/serial-console/serial-console.conf b/snippets/serial-console/serial-console.conf new file mode 100644 index 0000000000000..076ca5b7b16fd --- /dev/null +++ b/snippets/serial-console/serial-console.conf @@ -0,0 +1,3 @@ +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y diff --git a/snippets/serial-console/snippet.yml b/snippets/serial-console/snippet.yml new file mode 100644 index 0000000000000..c6e2c70c26017 --- /dev/null +++ b/snippets/serial-console/snippet.yml @@ -0,0 +1,3 @@ +name: serial-console +append: + EXTRA_CONF_FILE: serial-console.conf From 9fd9e231df238c4f76e64289ac18901b7a8050e4 Mon Sep 17 00:00:00 2001 From: Adrian Gielniewski Date: Fri, 25 Oct 2024 10:23:07 +0200 Subject: [PATCH 2606/4482] net: openthread: Add platform message management * Add CONFIG_OPENTHREAD_PLATFORM_MESSAGE_MANAGEMENT to allow enabling message management by the platform. * Add implementation of `otPlatMessagePoolInit`, `otPlatMessagePoolNew` and `otPlatMessagePoolFree`. Signed-off-by: Adrian Gielniewski --- modules/openthread/platform/CMakeLists.txt | 1 + modules/openthread/platform/messagepool.c | 68 +++++++++++++++++++ .../platform/openthread-core-zephyr-config.h | 10 +++ subsys/net/l2/openthread/Kconfig | 5 ++ 4 files changed, 84 insertions(+) create mode 100644 modules/openthread/platform/messagepool.c diff --git a/modules/openthread/platform/CMakeLists.txt b/modules/openthread/platform/CMakeLists.txt index 542aa5186ea24..29e827c158491 100644 --- a/modules/openthread/platform/CMakeLists.txt +++ b/modules/openthread/platform/CMakeLists.txt @@ -16,6 +16,7 @@ zephyr_library_sources_ifdef(CONFIG_OPENTHREAD_COPROCESSOR uart.c) zephyr_library_sources_ifdef(CONFIG_OPENTHREAD_CRYPTO_PSA crypto_psa.c) zephyr_library_sources_ifdef(CONFIG_OPENTHREAD_SHELL shell.c) zephyr_library_sources_ifdef(CONFIG_OPENTHREAD_EXTERNAL_HEAP memory.c) +zephyr_library_sources_ifdef(CONFIG_OPENTHREAD_PLATFORM_MESSAGE_MANAGEMENT messagepool.c) zephyr_library_sources_ifdef(CONFIG_SETTINGS settings.c) zephyr_library_sources_ifndef(CONFIG_LOG_BACKEND_SPINEL logging.c) diff --git a/modules/openthread/platform/messagepool.c b/modules/openthread/platform/messagepool.c new file mode 100644 index 0000000000000..cb9a64674c424 --- /dev/null +++ b/modules/openthread/platform/messagepool.c @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include + +#define LOG_MODULE_NAME net_otPlat_messagepool +#define LOG_LEVEL CONFIG_OPENTHREAD_LOG_LEVEL + +LOG_MODULE_REGISTER(LOG_MODULE_NAME); + +#define BUF_TIMEOUT K_MSEC(50) + +#define MESSAGE_POOL_SIZE \ + (CONFIG_OPENTHREAD_NUM_MESSAGE_BUFFERS * CONFIG_OPENTHREAD_MESSAGE_BUFFER_SIZE) +#define MAX_ALIGNMENT __alignof__(z_max_align_t) + +BUILD_ASSERT(CONFIG_OPENTHREAD_MESSAGE_BUFFER_SIZE % MAX_ALIGNMENT == 0, + "Invalid message buffer size"); + +static struct k_mem_slab message_pool; +__aligned(MAX_ALIGNMENT) static uint8_t message_pool_buffer[MESSAGE_POOL_SIZE]; + +void otPlatMessagePoolInit(otInstance *aInstance, uint16_t aMinNumFreeBuffers, size_t aBufferSize) +{ + ARG_UNUSED(aInstance); + + __ASSERT(aBufferSize == CONFIG_OPENTHREAD_MESSAGE_BUFFER_SIZE, + "Message buffer size does not match configuration"); + + if (aMinNumFreeBuffers > CONFIG_OPENTHREAD_NUM_MESSAGE_BUFFERS) { + LOG_WRN("Minimum number of free buffers (%d) is greater than number of allocated " + "buffers (%d)", + aMinNumFreeBuffers, CONFIG_OPENTHREAD_NUM_MESSAGE_BUFFERS); + } + + if (k_mem_slab_init(&message_pool, message_pool_buffer, aBufferSize, + CONFIG_OPENTHREAD_NUM_MESSAGE_BUFFERS) != 0) { + __ASSERT(false, "Failed to initialize message pool"); + } +} + +otMessageBuffer *otPlatMessagePoolNew(otInstance *aInstance) +{ + ARG_UNUSED(aInstance); + + otMessageBuffer *buffer; + + if (k_mem_slab_alloc(&message_pool, (void **)&buffer, BUF_TIMEOUT) != 0) { + LOG_ERR("Failed to allocate message buffer"); + return NULL; + } + + buffer->mNext = NULL; + return buffer; +} + +void otPlatMessagePoolFree(otInstance *aInstance, otMessageBuffer *aBuffer) +{ + ARG_UNUSED(aInstance); + + k_mem_slab_free(&message_pool, (void *)aBuffer); +} diff --git a/modules/openthread/platform/openthread-core-zephyr-config.h b/modules/openthread/platform/openthread-core-zephyr-config.h index 901e08cf84156..b2848da5b7ad3 100644 --- a/modules/openthread/platform/openthread-core-zephyr-config.h +++ b/modules/openthread/platform/openthread-core-zephyr-config.h @@ -427,6 +427,16 @@ #define OPENTHREAD_CONFIG_MESSAGE_BUFFER_SIZE CONFIG_OPENTHREAD_MESSAGE_BUFFER_SIZE #endif +/** + * @def OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT + * + * The message pool is managed by platform defined logic. + * + */ +#ifdef CONFIG_OPENTHREAD_PLATFORM_MESSAGE_MANAGEMENT +#define OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT CONFIG_OPENTHREAD_PLATFORM_MESSAGE_MANAGEMENT +#endif + /** * @def OPENTHREAD_CONFIG_MAC_STAY_AWAKE_BETWEEN_FRAGMENTS * diff --git a/subsys/net/l2/openthread/Kconfig b/subsys/net/l2/openthread/Kconfig index 958de6f817912..0f3c83ef76387 100644 --- a/subsys/net/l2/openthread/Kconfig +++ b/subsys/net/l2/openthread/Kconfig @@ -273,6 +273,11 @@ config OPENTHREAD_MESSAGE_BUFFER_SIZE help "The size of a message buffer in bytes" +config OPENTHREAD_PLATFORM_MESSAGE_MANAGEMENT + bool "Use platform message management" + help + The message pool is managed by platform defined logic. + config OPENTHREAD_MAX_STATECHANGE_HANDLERS int "The maximum number of state-changed callback handlers" default 2 From 7f5351bc4537397b653b833ac3d77b5a33e5c6ae Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Sun, 3 Nov 2024 16:29:06 +0000 Subject: [PATCH 2607/4482] dts: bindings: vendor-prefixes: add fysetc Add Shenzhen Fuyuansheng Electronic Technology Co., Ltd. devicetree vendor prefix (https://www.fysetc.com/). Signed-off-by: Henrik Brix Andersen --- dts/bindings/vendor-prefixes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/dts/bindings/vendor-prefixes.txt b/dts/bindings/vendor-prefixes.txt index 5ad47d5969b67..3e2f4c9123f7a 100644 --- a/dts/bindings/vendor-prefixes.txt +++ b/dts/bindings/vendor-prefixes.txt @@ -248,6 +248,7 @@ fsl Freescale Semiconductor ftdi Future Technology Devices International Ltd. fujitsu Fujitsu Ltd. futaba Futaba Corporation +fysetc Shenzhen Fuyuansheng Electronic Technology Co., Ltd. gaisler Gaisler galaxycore Galaxycore, Inc. gardena GARDENA GmbH From 3825c852e873a36d31710dd710e79f622768a327 Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Sat, 2 Nov 2024 20:32:03 +0000 Subject: [PATCH 2608/4482] boards: fysetc: add FYSETC UCAN USB to CAN 2.0B adapter board Add support for the open-source FYSETC UCAN USB to CAN 2.0B board. Signed-off-by: Henrik Brix Andersen --- boards/fysetc/index.rst | 10 ++++ boards/fysetc/ucan/Kconfig.ucan | 5 ++ boards/fysetc/ucan/board.cmake | 8 +++ boards/fysetc/ucan/board.yml | 6 ++ boards/fysetc/ucan/doc/index.rst | 71 ++++++++++++++++++++++ boards/fysetc/ucan/doc/ucan.webp | Bin 0 -> 38116 bytes boards/fysetc/ucan/ucan.dts | 96 ++++++++++++++++++++++++++++++ boards/fysetc/ucan/ucan.yaml | 15 +++++ boards/fysetc/ucan/ucan_defconfig | 1 + 9 files changed, 212 insertions(+) create mode 100644 boards/fysetc/index.rst create mode 100644 boards/fysetc/ucan/Kconfig.ucan create mode 100644 boards/fysetc/ucan/board.cmake create mode 100644 boards/fysetc/ucan/board.yml create mode 100644 boards/fysetc/ucan/doc/index.rst create mode 100644 boards/fysetc/ucan/doc/ucan.webp create mode 100644 boards/fysetc/ucan/ucan.dts create mode 100644 boards/fysetc/ucan/ucan.yaml create mode 100644 boards/fysetc/ucan/ucan_defconfig diff --git a/boards/fysetc/index.rst b/boards/fysetc/index.rst new file mode 100644 index 0000000000000..546023ba7b001 --- /dev/null +++ b/boards/fysetc/index.rst @@ -0,0 +1,10 @@ +.. _boards-fysetc: + +FYSETC +###### + +.. toctree:: + :maxdepth: 1 + :glob: + + **/* diff --git a/boards/fysetc/ucan/Kconfig.ucan b/boards/fysetc/ucan/Kconfig.ucan new file mode 100644 index 0000000000000..c88f895ea01b3 --- /dev/null +++ b/boards/fysetc/ucan/Kconfig.ucan @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Henrik Brix Andersen +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_UCAN + select SOC_STM32F072XB diff --git a/boards/fysetc/ucan/board.cmake b/boards/fysetc/ucan/board.cmake new file mode 100644 index 0000000000000..c383530f74c8a --- /dev/null +++ b/boards/fysetc/ucan/board.cmake @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Henrik Brix Andersen +# SPDX-License-Identifier: Apache-2.0 + +board_runner_args(dfu-util "--pid=0483:df11" "--alt=0" "--dfuse") +board_runner_args(jlink "--device=STM32F072CB") + +include(${ZEPHYR_BASE}/boards/common/dfu-util.board.cmake) +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/fysetc/ucan/board.yml b/boards/fysetc/ucan/board.yml new file mode 100644 index 0000000000000..3e9b1d3b09289 --- /dev/null +++ b/boards/fysetc/ucan/board.yml @@ -0,0 +1,6 @@ +board: + name: ucan + full_name: UCAN + vendor: fysetc + socs: + - name: stm32f072xb diff --git a/boards/fysetc/ucan/doc/index.rst b/boards/fysetc/ucan/doc/index.rst new file mode 100644 index 0000000000000..f9b4b53809f84 --- /dev/null +++ b/boards/fysetc/ucan/doc/index.rst @@ -0,0 +1,71 @@ +.. zephyr:board:: ucan + +Overview +******** + +The FYSETC UCAN is an open-source USB to CAN 2.0B adapter board. More information can be found on +the `UCAN website`_ and in the `UCAN wiki`_. + +Hardware +******** + +The UCAN board is equipped with a STM32F072CB microcontroller and features an USB-C connector, a +terminal block for connecting to the CAN bus, and two user LEDs. Schematics and component placement +drawings are available in the `UCAN GitHub repository`_. + +Supported Features +================== + +The ``ucan`` board configuration supports the following hardware features: + ++-----------+------------+-------------------------------------+ +| Interface | Controller | Driver/Component | ++===========+============+=====================================+ +| NVIC | on-chip | nested vector interrupt controller | ++-----------+------------+-------------------------------------+ +| PINMUX | on-chip | pinmux | ++-----------+------------+-------------------------------------+ +| FLASH | on-chip | flash memory | ++-----------+------------+-------------------------------------+ +| GPIO | on-chip | gpio | ++-----------+------------+-------------------------------------+ +| USB | on-chip | USB | ++-----------+------------+-------------------------------------+ +| CAN1 | on-chip | CAN controller | ++-----------+------------+-------------------------------------+ + +The default configuration can be found in the defconfig file: +:zephyr_file:`boards/fysetc/ucan/ucan_defconfig`. + +Other hardware features are not currently supported by the port. + +System Clock +============ + +The STM32F072CB PLL is driven by an external crystal oscillator (HSE) running at 8 MHz and +configured to provide a system clock of 48 MHz. + +Programming and Debugging +************************* + +Build and flash applications as usual (see :ref:`build_an_application` and +:ref:`application_run` for more details). + +If flashing via USB DFU, short pins ``B0`` and ``3V3`` when applying power to the UCAN board in +order to enter the built-in DFU mode. + +Here is an example for the :zephyr:code-sample:`blinky` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: ucan + :goals: flash + +.. _UCAN website: + https://www.fysetc.com/products/fysetc-ucan-board + +.. _UCAN wiki: + https://wiki.fysetc.com/UCAN/ + +.. _UCAN GitHub repository: + https://github.com/FYSETC/UCAN/ diff --git a/boards/fysetc/ucan/doc/ucan.webp b/boards/fysetc/ucan/doc/ucan.webp new file mode 100644 index 0000000000000000000000000000000000000000..427747f429695acc5db885263535ee255e95d407 GIT binary patch literal 38116 zcmeFXWpE_RvL;w!Y)LI?cX(< zuu7}XqdYUBJUr9gzeojf5s~#o06+?{0YIge z238Kh2mpYUwWGa)r~tm2`cHg_bpQ|m0{{Y`0C4CTIN0*b$w~dC{Xe(I#Xs7A+8oVa z*ZQAz{*S#-hDHtse}29GbLbe@+B^Q4(_dr3x;WbYh1LFGWcxpp`hzY1!Y2R1zJFo; zf8js>^N)^_g5Vz=*gu%hGhj3@`wRT9X5eJ+{9hRJ&-WP62#5h# zJfsE8BLXjqJQg#-4Mi*?I#;|1n7oVDg@vsGj_7A^U49Hs<$N>R0sV*;~UW+Fr~p z*Wfe!Q+JDYAJ581%cswC&287>R@zs{`%$eHyfAct{ehXXsC{m!11uHEwWcn}TisufU1c9w5HpY9J`QJk6Z? zlilVl#>}Sth{3{ioOweLqF?_1u=Fn9z!p}1?k>L+gSmD*(S(mbp6+Q*P`EBsWiBH-{K)AFEL=<= z#QD8o9pcinsOR}G1_X{KZ8{A) z4oy!}0o8 zaB1P9+g&u7*dkgaV+@nzRRrsiCrsof8# z9581fi6xa;ESi>a4Z(0kti^t}f;`R25kKxjK(PF>j#dRv%zf=w(Ow76PHr{btP)Q4 zE50F37^Qg%vB>-!%~!_?>dmeG8k8EQv9Y_)3yj0*MEqxSqJe4x9UL1igTn4fuxS6T znJSI}?%xKfa3b}?fwPZyHqxeEsIZYe)+7UTE!rj!^jPl6&*+hj94PcHf3sZ3wCQQ6 zzNQQ!l#&y@9OOrpHChhR50wcvfIb|zX_IoH@(`Gr0prA6{Y~OfKj@h>Hz(Jo@X#WH z+Sik|=*J-I>v-tT88(~Ejx+g=ck#Z28h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P7NoP!f6IIONIh4A%zjiim%)LQTCw&9nZhuwsmz~GpAp6Ee^z{1q%;ANS z(^t$fM8sSxsF=}A`k4H?Dmqh>4CTW2MJw}B8R>0tt9ND_Oi&PKQP(tSS36EP zsgl3H!aQ;pLgVqcH_o209et%iy^kLh;E@ii*(7^@06eM;%qUb1I(MU;JylUS(G{$u zT>sPg|0$G>)m57DOyvM)2LM1_T@XNue-Q&{fP?@b9{o8?z#D&OLp)~w7bEbP|6dLP z9@7&1Ki~N!(cgT$;NPK!zyIj`UnT|sP$U2%d<7~Dg94NP!9ctM0P}Ah289AK|0rHx S<2#S}M{x^JA^b1=NB%$C9%Z!v literal 0 HcmV?d00001 diff --git a/boards/fysetc/ucan/ucan.dts b/boards/fysetc/ucan/ucan.dts new file mode 100644 index 0000000000000..a0f47da9256e8 --- /dev/null +++ b/boards/fysetc/ucan/ucan.dts @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2024 Henrik Brix Andersen + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include + +/ { + model = "FYSETC UCAN board"; + compatible = "fysetc,ucan"; + + chosen { + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_partition; + zephyr,canbus = &can1; + }; + + aliases { + led0 = &led_rx; + led1 = &led_tx; + }; + + leds { + compatible = "gpio-leds"; + led_rx: led_rx { + gpios = <&gpioa 0 GPIO_ACTIVE_HIGH>; + label = "LED RX"; + }; + led_tx: led_tx { + gpios = <&gpioa 1 GPIO_ACTIVE_HIGH>; + label = "LED TX"; + }; + }; + + transceiver0: can-phy0 { + compatible = "can-transceiver-gpio"; + enable-gpios = <&gpioc 13 GPIO_ACTIVE_LOW>; + max-bitrate = <1000000>; + #phy-cells = <0>; + }; +}; + +&clk_hse { + status = "okay"; + clock-frequency = ; +}; + +&pll { + prediv = <1>; + mul = <6>; + clocks = <&clk_hse>; + status = "okay"; +}; + +&rcc { + clocks = <&pll>; + clock-frequency = ; + ahb-prescaler = <1>; + apb1-prescaler = <1>; +}; + +zephyr_udc0: &usb { + pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>; + pinctrl-names = "default"; + status = "okay"; +}; + +&can1 { + pinctrl-0 = <&can_rx_pb8 &can_tx_pb9>; + pinctrl-names = "default"; + phys = <&transceiver0>; + status = "okay"; +}; + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 DT_SIZE_K(48)>; + read-only; + }; + slot0_partition: partition@c000 { + label = "image-0"; + reg = <0x0000c000 DT_SIZE_K(80)>; + }; + }; +}; diff --git a/boards/fysetc/ucan/ucan.yaml b/boards/fysetc/ucan/ucan.yaml new file mode 100644 index 0000000000000..cd65a21e1fd41 --- /dev/null +++ b/boards/fysetc/ucan/ucan.yaml @@ -0,0 +1,15 @@ +identifier: ucan +name: FYSETC UCAN +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb +ram: 16 +flash: 128 +supported: + - can + - gpio + - usb_device + - usbd +vendor: fysetc diff --git a/boards/fysetc/ucan/ucan_defconfig b/boards/fysetc/ucan/ucan_defconfig new file mode 100644 index 0000000000000..91c3c15b37d1e --- /dev/null +++ b/boards/fysetc/ucan/ucan_defconfig @@ -0,0 +1 @@ +CONFIG_GPIO=y From 5032d8ede8d9a3f00af183678b494a46e588c28e Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Sun, 3 Nov 2024 16:18:06 +0100 Subject: [PATCH 2609/4482] drivers: stepper: add common helper header for tmc5xxx functions This commit adds a common helper header for tmc5xxx driver Signed-off-by: Jilay Pandya --- .../adi_tmc/adi_tmc5041_stepper_controller.c | 23 ++++----- drivers/stepper/adi_tmc/adi_tmc5xxx_common.h | 51 +++++++++++++++++++ drivers/stepper/adi_tmc/adi_tmc_reg.h | 9 +++- 3 files changed, 67 insertions(+), 16 deletions(-) create mode 100644 drivers/stepper/adi_tmc/adi_tmc5xxx_common.h diff --git a/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c b/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c index bd9857b95cf1a..c5433c1a83591 100644 --- a/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c +++ b/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c @@ -1,5 +1,6 @@ /* * SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG + * SPDX-FileCopyrightText: Copyright (c) 2024 Jilay Sandeep Pandya * SPDX-License-Identifier: Apache-2.0 */ @@ -10,8 +11,8 @@ #include #include -#include "adi_tmc_reg.h" #include "adi_tmc_spi.h" +#include "adi_tmc5xxx_common.h" #include @@ -93,17 +94,6 @@ static int tmc5041_read(const struct device *dev, const uint8_t reg_addr, uint32 return 0; } -static void calculate_velocity_from_hz_to_fclk(const struct device *dev, const uint32_t velocity_hz, - uint32_t *const velocity_fclk) -{ - const struct tmc5041_config *config = dev->config; - - *velocity_fclk = - ((uint64_t)(velocity_hz) << TMC5041_CLOCK_FREQ_SHIFT) / config->clock_frequency; - LOG_DBG("Stepper motor controller %s velocity: %d Hz, velocity_fclk: %d", dev->name, - velocity_hz, *velocity_fclk); -} - static int tmc5041_stepper_set_event_callback(const struct device *dev, stepper_event_callback_t callback, void *user_data) { @@ -356,10 +346,13 @@ static int tmc5041_stepper_move(const struct device *dev, const int32_t steps) static int tmc5041_stepper_set_max_velocity(const struct device *dev, uint32_t velocity) { const struct tmc5041_stepper_config *config = dev->config; + const struct tmc5041_config *tmc5041_config = config->controller->config; + const uint32_t clock_frequency = tmc5041_config->clock_frequency; uint32_t velocity_fclk; int err; - calculate_velocity_from_hz_to_fclk(config->controller, velocity, &velocity_fclk); + velocity_fclk = tmc5xxx_calculate_velocity_from_hz_to_fclk(velocity, clock_frequency); + err = tmc5041_write(config->controller, TMC5041_VMAX(config->index), velocity_fclk); if (err != 0) { LOG_ERR("%s: Failed to set max velocity", dev->name); @@ -482,11 +475,13 @@ static int tmc5041_stepper_enable_constant_velocity_mode(const struct device *de { LOG_DBG("Stepper motor controller %s enable constant velocity mode", dev->name); const struct tmc5041_stepper_config *config = dev->config; + const struct tmc5041_config *tmc5041_config = config->controller->config; struct tmc5041_stepper_data *data = dev->data; + const uint32_t clock_frequency = tmc5041_config->clock_frequency; uint32_t velocity_fclk; int err; - calculate_velocity_from_hz_to_fclk(config->controller, velocity, &velocity_fclk); + velocity_fclk = tmc5xxx_calculate_velocity_from_hz_to_fclk(velocity, clock_frequency); if (config->is_sg_enabled) { err = stallguard_enable(dev, false); diff --git a/drivers/stepper/adi_tmc/adi_tmc5xxx_common.h b/drivers/stepper/adi_tmc/adi_tmc5xxx_common.h new file mode 100644 index 0000000000000..7eafe62326eb8 --- /dev/null +++ b/drivers/stepper/adi_tmc/adi_tmc5xxx_common.h @@ -0,0 +1,51 @@ +/** + * @file drivers/stepper/adi_tmc/adi_tmc5xxx_common.h + * + * @brief Common TMC5xxx stepper controller driver definitions + */ + +/** + * SPDX-FileCopyrightText: Copyright (c) 2024 Jilay Sandeep Pandya + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_DRIVERS_STEPPER_ADI_TMC_ADI_TMC5XXX_COMMON_H_ +#define ZEPHYR_DRIVERS_STEPPER_ADI_TMC_ADI_TMC5XXX_COMMON_H_ + +#include "adi_tmc_reg.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @name TMC5xxx module functions + * @anchor TMC5XXX_FUNCTIONS + * + * @{ + */ + +/** + * @brief Calculate the velocity in full clock cycles from the velocity in Hz + * + * @param velocity_hz Velocity in Hz + * @param clock_frequency Clock frequency in Hz + * + * @return Calculated velocity in full clock cycles + */ +static inline uint32_t tmc5xxx_calculate_velocity_from_hz_to_fclk(uint64_t velocity_hz, + uint32_t clock_frequency) +{ + __ASSERT_NO_MSG(clock_frequency); + return (velocity_hz << TMC5XXX_CLOCK_FREQ_SHIFT) / clock_frequency; +} + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_DRIVERS_STEPPER_ADI_TMC_ADI_TMC5XXX_COMMON_H_ */ diff --git a/drivers/stepper/adi_tmc/adi_tmc_reg.h b/drivers/stepper/adi_tmc/adi_tmc_reg.h index 1c88020c352a4..ebf0de57ed168 100644 --- a/drivers/stepper/adi_tmc/adi_tmc_reg.h +++ b/drivers/stepper/adi_tmc/adi_tmc_reg.h @@ -17,6 +17,13 @@ extern "C" { #endif +/** Common Registers for TMC5041 and TMC51XX */ +#if defined(CONFIG_STEPPER_ADI_TMC5041) + +#define TMC5XXX_CLOCK_FREQ_SHIFT 24 + +#endif + #ifdef CONFIG_STEPPER_ADI_TMC5041 #define TMC5041_MOTOR_ADDR(m) (0x20 << (m)) @@ -133,8 +140,6 @@ extern "C" { #define TMC5041_CHOPCONF_MRES_MASK GENMASK(27, 24) #define TMC5041_CHOPCONF_MRES_SHIFT 24 -#define TMC5041_CLOCK_FREQ_SHIFT 24 - #endif /** From 9504034733fb7bff12ec0ecdc73c1a8d38bae82d Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Sun, 3 Nov 2024 10:08:19 -0500 Subject: [PATCH 2610/4482] sys: util: use BITS_PER_BYTE macro instead of the magic number 8 Obviously, everyone knows that there are 8 bits per byte, so there isn't a lot of magic happening, per se, but it's also helpful to clearly denote where the magic number 8 is referring to the number of bits in a byte. Occasionally, 8 will refer to a field size or offset in a structure, MMR, or word. Occasionally, the number 8 will refer to the number of bytes in a 64-bit value (which should probably be replaced with `sizeof(uint64_t)`). For converting bits to bytes, or vice-versa, let's use `BITS_PER_BYTE` for clarity (or other appropriate `BITS_PER_*` macros). Signed-off-by: Chris Friedt --- drivers/display/display_mcux_dcnano_lcdif.c | 4 ++-- drivers/display/display_mcux_elcdif.c | 2 +- drivers/display/display_renesas_lcdc.c | 4 ++-- drivers/mipi_dbi/mipi_dbi_smartbond.c | 4 ++-- include/zephyr/sys/atomic.h | 2 +- include/zephyr/sys/rb.h | 4 ++-- include/zephyr/sys/util.h | 2 +- kernel/userspace.c | 3 ++- samples/subsys/input/draw_touch_events/src/main.c | 3 ++- subsys/bluetooth/host/gatt.c | 2 +- subsys/demand_paging/eviction/lru.c | 3 ++- subsys/testsuite/ztest/src/ztest_mock.c | 9 ++++----- tests/kernel/mem_protect/mem_protect/src/kobject.c | 2 +- tests/subsys/secure_storage/psa/crypto/src/main.c | 3 ++- 14 files changed, 25 insertions(+), 22 deletions(-) diff --git a/drivers/display/display_mcux_dcnano_lcdif.c b/drivers/display/display_mcux_dcnano_lcdif.c index a6ff62412c45c..27a357fa64cca 100644 --- a/drivers/display/display_mcux_dcnano_lcdif.c +++ b/drivers/display/display_mcux_dcnano_lcdif.c @@ -256,8 +256,8 @@ static const struct display_driver_api mcux_dcnano_lcdif_api = { .get_framebuffer = mcux_dcnano_lcdif_get_framebuffer, }; -#define MCUX_DCNANO_LCDIF_PIXEL_BYTES(n) \ - (DISPLAY_BITS_PER_PIXEL(DT_INST_PROP(n, pixel_format)) / 8) +#define MCUX_DCNANO_LCDIF_PIXEL_BYTES(n) \ + (DISPLAY_BITS_PER_PIXEL(DT_INST_PROP(n, pixel_format)) / BITS_PER_BYTE) #define MCUX_DCNANO_LCDIF_FB_SIZE(n) DT_INST_PROP(n, width) * \ DT_INST_PROP(n, height) * MCUX_DCNANO_LCDIF_PIXEL_BYTES(n) diff --git a/drivers/display/display_mcux_elcdif.c b/drivers/display/display_mcux_elcdif.c index d082ac1996409..b38a1f65b2f23 100644 --- a/drivers/display/display_mcux_elcdif.c +++ b/drivers/display/display_mcux_elcdif.c @@ -247,7 +247,7 @@ static int mcux_elcdif_set_pixel_format(const struct device *dev, } dev_data->pixel_format = pixel_format; - dev_data->pixel_bytes = DISPLAY_BITS_PER_PIXEL(pixel_format) / 8; + dev_data->pixel_bytes = DISPLAY_BITS_PER_PIXEL(pixel_format) / BITS_PER_BYTE; dev_data->fb_bytes = config->rgb_mode.panelWidth * config->rgb_mode.panelHeight * dev_data->pixel_bytes; diff --git a/drivers/display/display_renesas_lcdc.c b/drivers/display/display_renesas_lcdc.c index 6121f68347682..b51ba33585abe 100644 --- a/drivers/display/display_renesas_lcdc.c +++ b/drivers/display/display_renesas_lcdc.c @@ -44,8 +44,8 @@ LOG_MODULE_REGISTER(smartbond_display, CONFIG_DISPLAY_LOG_LEVEL); (((_val) << LCDC_LCDC_LAYER0_OFFSETX_REG_ ## _field ## _Pos) & \ LCDC_LCDC_LAYER0_OFFSETX_REG_ ## _field ## _Msk) -#define DISPLAY_SMARTBOND_PIXEL_SIZE(inst) \ - (DISPLAY_BITS_PER_PIXEL(DT_INST_PROP(inst, pixel_format)) / 8) +#define DISPLAY_SMARTBOND_PIXEL_SIZE(inst) \ + (DISPLAY_BITS_PER_PIXEL(DT_INST_PROP(inst, pixel_format)) / BITS_PER_BYTE) #if CONFIG_DISPLAY_RENESAS_LCDC_BUFFER_PSRAM #define DISPLAY_BUFFER_LINKER_SECTION \ diff --git a/drivers/mipi_dbi/mipi_dbi_smartbond.c b/drivers/mipi_dbi/mipi_dbi_smartbond.c index 5a5cc279a479d..24e5189ab715b 100644 --- a/drivers/mipi_dbi/mipi_dbi_smartbond.c +++ b/drivers/mipi_dbi/mipi_dbi_smartbond.c @@ -338,8 +338,8 @@ static int mipi_dbi_smartbond_write_display(const struct device *dev, lcdc_smartbond_mipi_dbi_cfg mipi_dbi_cfg; uint8_t layer_color = lcdc_smartbond_pixel_to_lcm(pixfmt); - if (desc->width * desc->height * (DISPLAY_BITS_PER_PIXEL(pixfmt) / 8) != - desc->buf_size) { + if (desc->width * desc->height * (DISPLAY_BITS_PER_PIXEL(pixfmt) / BITS_PER_BYTE) != + desc->buf_size) { LOG_ERR("Incorrect buffer size for given width and height"); return -EINVAL; } diff --git a/include/zephyr/sys/atomic.h b/include/zephyr/sys/atomic.h index 31324b13d57a7..078be968467e0 100644 --- a/include/zephyr/sys/atomic.h +++ b/include/zephyr/sys/atomic.h @@ -73,7 +73,7 @@ extern "C" { * @cond INTERNAL_HIDDEN */ -#define ATOMIC_BITS (sizeof(atomic_val_t) * 8) +#define ATOMIC_BITS (sizeof(atomic_val_t) * BITS_PER_BYTE) #define ATOMIC_MASK(bit) BIT((unsigned long)(bit) & (ATOMIC_BITS - 1U)) #define ATOMIC_ELEM(addr, bit) ((addr) + ((bit) / ATOMIC_BITS)) diff --git a/include/zephyr/sys/rb.h b/include/zephyr/sys/rb.h index 66003ef10b585..2ce368a9f3341 100644 --- a/include/zephyr/sys/rb.h +++ b/include/zephyr/sys/rb.h @@ -66,8 +66,8 @@ struct rbnode { * packed binary tree, plus root... Works out to 59 entries for 32 * bit pointers and 121 at 64 bits. */ -#define Z_TBITS(t) ((sizeof(t)) < 8 ? 2 : 3) -#define Z_PBITS(t) (8 * sizeof(t)) +#define Z_TBITS(t) ((sizeof(t)) < sizeof(uint64_t) ? 2 : 3) +#define Z_PBITS(t) (BITS_PER_BYTE * sizeof(t)) #define Z_MAX_RBTREE_DEPTH (2 * (Z_PBITS(int *) - Z_TBITS(int *) - 1) + 1) /** diff --git a/include/zephyr/sys/util.h b/include/zephyr/sys/util.h index c0c69b3143341..8c648c777e402 100644 --- a/include/zephyr/sys/util.h +++ b/include/zephyr/sys/util.h @@ -30,7 +30,7 @@ #include /** @brief Number of bits that make up a type */ -#define NUM_BITS(t) (sizeof(t) * 8) +#define NUM_BITS(t) (sizeof(t) * BITS_PER_BYTE) #ifdef __cplusplus extern "C" { diff --git a/kernel/userspace.c b/kernel/userspace.c index 89f126e4eb4d9..7a66513c03e5a 100644 --- a/kernel/userspace.c +++ b/kernel/userspace.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -71,7 +72,7 @@ static struct k_spinlock objfree_lock; /* k_object_free */ #endif /* CONFIG_DYNAMIC_OBJECTS */ static struct k_spinlock obj_lock; /* kobj struct data */ -#define MAX_THREAD_BITS (CONFIG_MAX_THREAD_BYTES * 8) +#define MAX_THREAD_BITS (CONFIG_MAX_THREAD_BYTES * BITS_PER_BYTE) #ifdef CONFIG_DYNAMIC_OBJECTS extern uint8_t _thread_idx_map[CONFIG_MAX_THREAD_BYTES]; diff --git a/samples/subsys/input/draw_touch_events/src/main.c b/samples/subsys/input/draw_touch_events/src/main.c index 13a364fe09194..ed232de08624a 100644 --- a/samples/subsys/input/draw_touch_events/src/main.c +++ b/samples/subsys/input/draw_touch_events/src/main.c @@ -9,6 +9,7 @@ #include #include #include +#include LOG_MODULE_REGISTER(sample, LOG_LEVEL_INF); @@ -25,7 +26,7 @@ LOG_MODULE_REGISTER(sample, LOG_LEVEL_INF); #define CROSS_DIM (WIDTH / CONFIG_SCREEN_WIDTH_TO_CROSS_DIM) #define PIXEL_FORMAT (DT_PROP_OR(DT_CHOSEN(zephyr_display), pixel_format, PIXEL_FORMAT_ARGB_8888)) -#define BPP ((DISPLAY_BITS_PER_PIXEL(PIXEL_FORMAT)) / 8) +#define BPP ((DISPLAY_BITS_PER_PIXEL(PIXEL_FORMAT)) / BITS_PER_BYTE) #define BUFFER_SIZE (CROSS_DIM * CROSS_DIM * BPP) #define REFRESH_RATE 100 diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index 118af2097afe0..23f158bdf2fa2 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -655,7 +655,7 @@ static bool cf_set_value(struct gatt_cf_cfg *cfg, const uint8_t *value, uint16_t /* Set the bits for each octet */ for (i = 0U; i < len && i < CF_NUM_BYTES; i++) { if (i == (CF_NUM_BYTES - 1)) { - cfg->data[i] |= value[i] & BIT_MASK(CF_NUM_BITS % 8); + cfg->data[i] |= value[i] & BIT_MASK(CF_NUM_BITS % BITS_PER_BYTE); } else { cfg->data[i] |= value[i]; } diff --git a/subsys/demand_paging/eviction/lru.c b/subsys/demand_paging/eviction/lru.c index 1156fa1a549ad..9781fbe280ff6 100644 --- a/subsys/demand_paging/eviction/lru.c +++ b/subsys/demand_paging/eviction/lru.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -51,7 +52,7 @@ * boundary for best compromize between code performance and space saving. * The extra entry is used to store head and tail indexes. */ -#define PF_IDX_BITS ROUND_UP(LOG2CEIL(K_MEM_NUM_PAGE_FRAMES + 1), 8) +#define PF_IDX_BITS ROUND_UP(LOG2CEIL(K_MEM_NUM_PAGE_FRAMES + 1), BITS_PER_BYTE) /* For each page frame, track the previous and next page frame in the queue. */ struct lru_pf_idx { diff --git a/subsys/testsuite/ztest/src/ztest_mock.c b/subsys/testsuite/ztest/src/ztest_mock.c index 29eb70a972e8c..1147807b2e578 100644 --- a/subsys/testsuite/ztest/src/ztest_mock.c +++ b/subsys/testsuite/ztest/src/ztest_mock.c @@ -76,13 +76,12 @@ int snprintk(char *str, size_t size, const char *fmt, ...) * FIXME: move to sys_io.h once the argument signature for bitmap has * been fixed to void* or similar GH-2825 */ -#define BITS_PER_UL (8 * sizeof(unsigned long)) -#define DEFINE_BITFIELD(name, bits) unsigned long(name)[DIV_ROUND_UP(bits, BITS_PER_UL)] +#define DEFINE_BITFIELD(name, bits) unsigned long(name)[DIV_ROUND_UP(bits, BITS_PER_LONG)] static inline int sys_bitfield_find_first_clear(const unsigned long *bitmap, const unsigned int bits) { - const size_t words = DIV_ROUND_UP(bits, BITS_PER_UL); + const size_t words = DIV_ROUND_UP(bits, BITS_PER_LONG); size_t cnt; unsigned int long neg_bitmap; @@ -97,10 +96,10 @@ static inline int sys_bitfield_find_first_clear(const unsigned long *bitmap, continue; } else if (neg_bitmap == ~0UL) { /* First bit is free */ - return cnt * BITS_PER_UL; + return cnt * BITS_PER_LONG; } else { const unsigned int bit = - (cnt * BITS_PER_UL) + __builtin_ffsl(neg_bitmap) - 1; + (cnt * BITS_PER_LONG) + __builtin_ffsl(neg_bitmap) - 1; /* Ensure first free bit is within total bits count */ if (bit < bits) { return bit; diff --git a/tests/kernel/mem_protect/mem_protect/src/kobject.c b/tests/kernel/mem_protect/mem_protect/src/kobject.c index 79bd0549b0902..6a3bfc154c130 100644 --- a/tests/kernel/mem_protect/mem_protect/src/kobject.c +++ b/tests/kernel/mem_protect/mem_protect/src/kobject.c @@ -1183,7 +1183,7 @@ ZTEST(mem_protect_kobj, test_kobj_create_out_of_memory) #ifdef CONFIG_DYNAMIC_OBJECTS extern uint8_t _thread_idx_map[CONFIG_MAX_THREAD_BYTES]; -#define MAX_THREAD_BITS (CONFIG_MAX_THREAD_BYTES * 8) +#define MAX_THREAD_BITS (CONFIG_MAX_THREAD_BYTES * BITS_PER_BYTE) #endif /* @brief Test alloc thread object until out of idex diff --git a/tests/subsys/secure_storage/psa/crypto/src/main.c b/tests/subsys/secure_storage/psa/crypto/src/main.c index d41fbadc9f372..1a59f0027964a 100644 --- a/tests/subsys/secure_storage/psa/crypto/src/main.c +++ b/tests/subsys/secure_storage/psa/crypto/src/main.c @@ -2,6 +2,7 @@ * SPDX-License-Identifier: Apache-2.0 */ #include +#include #include #include #include @@ -87,7 +88,7 @@ ZTEST(secure_storage_psa_crypto, test_persistent_key_usage) psa_status_t ret; psa_key_attributes_t key_attributes; psa_key_id_t key_id; - uint8_t key_material[KEY_BITS / 8]; + uint8_t key_material[KEY_BITS / BITS_PER_BYTE]; fill_key_attributes(&key_attributes); fill_data(key_material, sizeof(key_material)); From 44477ad7322b762923a18540ad6473a038f3e748 Mon Sep 17 00:00:00 2001 From: Ian Morris Date: Fri, 1 Nov 2024 12:58:58 -0700 Subject: [PATCH 2611/4482] drivers: serial: fix renesas ra8 sci_b uart hardware flow control enable Fixed typo in Renesas RA8 SCI_B UART configuration that was preventing hardware flow control from being enabled. Signed-off-by: Ian Morris --- drivers/serial/uart_renesas_ra8_sci_b.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/serial/uart_renesas_ra8_sci_b.c b/drivers/serial/uart_renesas_ra8_sci_b.c index 8922dd0fbb3d0..78b870e3f08e8 100644 --- a/drivers/serial/uart_renesas_ra8_sci_b.c +++ b/drivers/serial/uart_renesas_ra8_sci_b.c @@ -1123,7 +1123,7 @@ static void uart_ra_sci_b_eri_isr(const struct device *dev) .parity = UART_CFG_PARITY_NONE, \ .stop_bits = UART_CFG_STOP_BITS_1, \ .data_bits = UART_CFG_DATA_BITS_8, \ - .flow_ctrl = COND_CODE_1(DT_NODE_HAS_PROP(idx, hw_flow_control), \ + .flow_ctrl = COND_CODE_1(DT_INST_PROP(index, hw_flow_control), \ (UART_CFG_FLOW_CTRL_RTS_CTS), \ (UART_CFG_FLOW_CTRL_NONE)), \ }, \ From 9a5fa367baf1c0d406ff899152c0841383a8cd1d Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Fri, 1 Nov 2024 15:03:18 +0100 Subject: [PATCH 2612/4482] tests: Bluetooth: Tester: Format BTP cmd/evt/rsp logs as hex Since the values are defined as hex, e.g. 0x82, it is easier to compare with the log if they also log them as such. Signed-off-by: Emil Gydesen --- tests/bluetooth/tester/src/btp.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/bluetooth/tester/src/btp.c b/tests/bluetooth/tester/src/btp.c index 9ce8e44a726be..ea7dea81595da 100644 --- a/tests/bluetooth/tester/src/btp.c +++ b/tests/bluetooth/tester/src/btp.c @@ -96,8 +96,8 @@ static void cmd_handler(void *p1, void *p2, void *p3) cmd = k_fifo_get(&cmds_queue, K_FOREVER); - LOG_DBG("cmd service %u opcode %u index %u", cmd->hdr.service, cmd->hdr.opcode, - cmd->hdr.index); + LOG_DBG("cmd service %u opcode 0x%02x index 0x%02x", cmd->hdr.service, + cmd->hdr.opcode, cmd->hdr.index); len = sys_le16_to_cpu(cmd->hdr.len); @@ -296,7 +296,8 @@ static void tester_rsp_with_index(uint8_t service, uint8_t opcode, uint8_t index { struct btp_status s; - LOG_DBG("service %u opcode %u index %u status %u", service, opcode, index, status); + LOG_DBG("service %u opcode 0x%02x index 0x%02x status 0x%02x", service, opcode, index, + status); if (status == BTP_STATUS_SUCCESS) { tester_send_with_index(service, opcode, index, NULL, 0); @@ -311,7 +312,7 @@ void tester_event(uint8_t service, uint8_t opcode, const void *data, size_t len) { __ASSERT_NO_MSG(opcode >= 0x80); - LOG_DBG("service %u opcode %u", service, opcode); + LOG_DBG("service %u opcode 0x%02x", service, opcode); tester_send_with_index(service, opcode, BTP_INDEX, data, len); } @@ -323,7 +324,7 @@ void tester_rsp_full(uint8_t service, uint8_t opcode, const void *rsp, size_t le __ASSERT_NO_MSG(opcode < 0x80); __ASSERT_NO_MSG(delayed_cmd != NULL); - LOG_DBG("service %u opcode %u", service, opcode); + LOG_DBG("service %u opcode 0x%02x", service, opcode); tester_send_with_index(service, opcode, BTP_INDEX, rsp, len); @@ -341,7 +342,7 @@ void tester_rsp(uint8_t service, uint8_t opcode, uint8_t status) __ASSERT_NO_MSG(opcode < 0x80); __ASSERT_NO_MSG(delayed_cmd != NULL); - LOG_DBG("service %u opcode %u status %u", service, opcode, status); + LOG_DBG("service %u opcode 0x%02x status 0x%02x", service, opcode, status); tester_rsp_with_index(service, opcode, BTP_INDEX, status); From 75f5f712005fb01cbf90bc0a7356da3ec0382054 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Mon, 4 Nov 2024 13:36:16 +0100 Subject: [PATCH 2613/4482] tests: Bluetooth: Tester: Redefine service IDs as hex Everything else is defined as hex, so it makes sense to be consistent. This will also make it easier to find the service IDs in the logs that primarily already log commands and events as hex. Signed-off-by: Emil Gydesen --- tests/bluetooth/tester/src/btp.c | 10 ++--- tests/bluetooth/tester/src/btp/btp.h | 60 ++++++++++++++-------------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/tests/bluetooth/tester/src/btp.c b/tests/bluetooth/tester/src/btp.c index ea7dea81595da..6bc7a4d5e3afb 100644 --- a/tests/bluetooth/tester/src/btp.c +++ b/tests/bluetooth/tester/src/btp.c @@ -96,7 +96,7 @@ static void cmd_handler(void *p1, void *p2, void *p3) cmd = k_fifo_get(&cmds_queue, K_FOREVER); - LOG_DBG("cmd service %u opcode 0x%02x index 0x%02x", cmd->hdr.service, + LOG_DBG("cmd service 0x%02x opcode 0x%02x index 0x%02x", cmd->hdr.service, cmd->hdr.opcode, cmd->hdr.index); len = sys_le16_to_cpu(cmd->hdr.len); @@ -296,7 +296,7 @@ static void tester_rsp_with_index(uint8_t service, uint8_t opcode, uint8_t index { struct btp_status s; - LOG_DBG("service %u opcode 0x%02x index 0x%02x status 0x%02x", service, opcode, index, + LOG_DBG("service 0x%02x opcode 0x%02x index 0x%02x status 0x%02x", service, opcode, index, status); if (status == BTP_STATUS_SUCCESS) { @@ -312,7 +312,7 @@ void tester_event(uint8_t service, uint8_t opcode, const void *data, size_t len) { __ASSERT_NO_MSG(opcode >= 0x80); - LOG_DBG("service %u opcode 0x%02x", service, opcode); + LOG_DBG("service 0x%02x opcode 0x%02x", service, opcode); tester_send_with_index(service, opcode, BTP_INDEX, data, len); } @@ -324,7 +324,7 @@ void tester_rsp_full(uint8_t service, uint8_t opcode, const void *rsp, size_t le __ASSERT_NO_MSG(opcode < 0x80); __ASSERT_NO_MSG(delayed_cmd != NULL); - LOG_DBG("service %u opcode 0x%02x", service, opcode); + LOG_DBG("service 0x%02x opcode 0x%02x", service, opcode); tester_send_with_index(service, opcode, BTP_INDEX, rsp, len); @@ -342,7 +342,7 @@ void tester_rsp(uint8_t service, uint8_t opcode, uint8_t status) __ASSERT_NO_MSG(opcode < 0x80); __ASSERT_NO_MSG(delayed_cmd != NULL); - LOG_DBG("service %u opcode 0x%02x status 0x%02x", service, opcode, status); + LOG_DBG("service 0x%02x opcode 0x%02x status 0x%02x", service, opcode, status); tester_rsp_with_index(service, opcode, BTP_INDEX, status); diff --git a/tests/bluetooth/tester/src/btp/btp.h b/tests/bluetooth/tester/src/btp/btp.h index 5044346399734..c74d7bec45252 100644 --- a/tests/bluetooth/tester/src/btp/btp.h +++ b/tests/bluetooth/tester/src/btp/btp.h @@ -45,36 +45,36 @@ #define BTP_INDEX_NONE 0xff #define BTP_INDEX 0x00 -#define BTP_SERVICE_ID_CORE 0 -#define BTP_SERVICE_ID_GAP 1 -#define BTP_SERVICE_ID_GATT 2 -#define BTP_SERVICE_ID_L2CAP 3 -#define BTP_SERVICE_ID_MESH 4 -#define BTP_SERVICE_ID_MESH_MDL 5 -#define BTP_SERVICE_GATT_CLIENT 6 -#define BTP_SERVICE_GATT_SERVER 7 -#define BTP_SERVICE_ID_VCS 8 -#define BTP_SERVICE_ID_IAS 9 -#define BTP_SERVICE_ID_AICS 10 -#define BTP_SERVICE_ID_VOCS 11 -#define BTP_SERVICE_ID_PACS 12 -#define BTP_SERVICE_ID_ASCS 13 -#define BTP_SERVICE_ID_BAP 14 -#define BTP_SERVICE_ID_HAS 15 -#define BTP_SERVICE_ID_MICP 16 -#define BTP_SERVICE_ID_CSIS 17 -#define BTP_SERVICE_ID_MICS 18 -#define BTP_SERVICE_ID_CCP 19 -#define BTP_SERVICE_ID_VCP 20 -#define BTP_SERVICE_ID_CAS 21 -#define BTP_SERVICE_ID_MCP 22 -#define BTP_SERVICE_ID_GMCS 23 -#define BTP_SERVICE_ID_HAP 24 -#define BTP_SERVICE_ID_CSIP 25 -#define BTP_SERVICE_ID_CAP 26 -#define BTP_SERVICE_ID_TBS 27 -#define BTP_SERVICE_ID_TMAP 28 -#define BTP_SERVICE_ID_OTS 29 +#define BTP_SERVICE_ID_CORE 0x00 +#define BTP_SERVICE_ID_GAP 0x01 +#define BTP_SERVICE_ID_GATT 0x02 +#define BTP_SERVICE_ID_L2CAP 0x03 +#define BTP_SERVICE_ID_MESH 0x04 +#define BTP_SERVICE_ID_MESH_MDL 0x05 +#define BTP_SERVICE_GATT_CLIENT 0x06 +#define BTP_SERVICE_GATT_SERVER 0x07 +#define BTP_SERVICE_ID_VCS 0x08 +#define BTP_SERVICE_ID_IAS 0x09 +#define BTP_SERVICE_ID_AICS 0x0a +#define BTP_SERVICE_ID_VOCS 0x0b +#define BTP_SERVICE_ID_PACS 0x0c +#define BTP_SERVICE_ID_ASCS 0x0d +#define BTP_SERVICE_ID_BAP 0x0e +#define BTP_SERVICE_ID_HAS 0x0f +#define BTP_SERVICE_ID_MICP 0x10 +#define BTP_SERVICE_ID_CSIS 0x11 +#define BTP_SERVICE_ID_MICS 0x12 +#define BTP_SERVICE_ID_CCP 0x13 +#define BTP_SERVICE_ID_VCP 0x14 +#define BTP_SERVICE_ID_CAS 0x15 +#define BTP_SERVICE_ID_MCP 0x16 +#define BTP_SERVICE_ID_GMCS 0x17 +#define BTP_SERVICE_ID_HAP 0x18 +#define BTP_SERVICE_ID_CSIP 0x19 +#define BTP_SERVICE_ID_CAP 0x1a +#define BTP_SERVICE_ID_TBS 0x1b +#define BTP_SERVICE_ID_TMAP 0x1c +#define BTP_SERVICE_ID_OTS 0x1d #define BTP_SERVICE_ID_MAX BTP_SERVICE_ID_OTS From 92273c575440cd8a3f2bf88733586882d37128e5 Mon Sep 17 00:00:00 2001 From: Andrej Butok Date: Fri, 1 Nov 2024 13:51:20 +0100 Subject: [PATCH 2614/4482] samples: smp_svr: add common sysbuild true Adds sysbuild: true to the common section, to build the project using sysbuild. Signed-off-by: Andrej Butok --- samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml index d9e39abed602d..058a5c581e87b 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml @@ -2,6 +2,7 @@ sample: description: Simple Management Protocol sample name: smp svr common: + sysbuild: true harness: bluetooth tags: bluetooth tests: @@ -159,14 +160,12 @@ tests: integration_platforms: - nrf52840dk/nrf52840 sample.mcumgr.smp_svr.ram_load: - sysbuild: true extra_args: FILE_SUFFIX="ram_load" platform_allow: - nrf52840dk/nrf52840 integration_platforms: - nrf52840dk/nrf52840 sample.mcumgr.smp_svr.ram_load.serial: - sysbuild: true extra_args: FILE_SUFFIX="ram_load" EXTRA_CONF_FILE="overlay-serial.conf" platform_allow: @@ -174,7 +173,6 @@ tests: integration_platforms: - nrf52840dk/nrf52840 sample.mcumgr.smp_svr.ram_load.serial.fs.shell: - sysbuild: true extra_args: FILE_SUFFIX="ram_load" EXTRA_CONF_FILE="overlay-serial.conf;overlay-fs.conf;overlay-shell.conf" platform_allow: From f9b5de2d0a8bdfb8823735e0f501402763e32628 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Fri, 1 Nov 2024 11:25:09 +0100 Subject: [PATCH 2615/4482] tests: Bluetooth: Tester: Set conn = NULL in btp_gap bt_conn_le_create logs an error if the provided conn is not NULL. This small change cleans up the log a bit to avoid the warning. Signed-off-by: Emil Gydesen --- tests/bluetooth/tester/src/btp_gap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/bluetooth/tester/src/btp_gap.c b/tests/bluetooth/tester/src/btp_gap.c index 029e15f17681a..d783aaa770716 100644 --- a/tests/bluetooth/tester/src/btp_gap.c +++ b/tests/bluetooth/tester/src/btp_gap.c @@ -1004,7 +1004,7 @@ static uint8_t connect(const void *cmd, uint16_t cmd_len, int err; if (!bt_addr_le_eq(&cp->address, BT_ADDR_LE_ANY)) { - struct bt_conn *conn; + struct bt_conn *conn = NULL; err = bt_conn_le_create(&cp->address, BT_CONN_LE_CREATE_CONN, conn_param, &conn); if (err) { From df24d0114ca2392368bdf39c840cac386bddb634 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Fri, 1 Nov 2024 13:30:02 +0700 Subject: [PATCH 2616/4482] drivers: can: sja1000: reduce number of `frame->id` pointer dereferences Refined `can_sja1000_read_frame` and `can_sja1000_write_frame` by reducing `frame->id` pointer dereferences. Using a local `id` variable aims to improve efficiency, given the frequent execution of this code in CAN applications. Signed-off-by: Pisit Sawangvonganan --- drivers/can/can_sja1000.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/drivers/can/can_sja1000.c b/drivers/can/can_sja1000.c index dcdb22d6f6bc1..bdc6b9e3956fa 100644 --- a/drivers/can/can_sja1000.c +++ b/drivers/can/can_sja1000.c @@ -273,6 +273,7 @@ int can_sja1000_set_mode(const struct device *dev, can_mode_t mode) static void can_sja1000_read_frame(const struct device *dev, struct can_frame *frame) { + uint32_t id; uint8_t info; int i; @@ -293,14 +294,15 @@ static void can_sja1000_read_frame(const struct device *dev, struct can_frame *f if ((info & CAN_SJA1000_FRAME_INFO_FF) != 0) { frame->flags |= CAN_FRAME_IDE; - frame->id = FIELD_PREP(GENMASK(28, 21), + id = FIELD_PREP(GENMASK(28, 21), can_sja1000_read_reg(dev, CAN_SJA1000_XFF_ID1)); - frame->id |= FIELD_PREP(GENMASK(20, 13), - can_sja1000_read_reg(dev, CAN_SJA1000_XFF_ID2)); - frame->id |= FIELD_PREP(GENMASK(12, 5), - can_sja1000_read_reg(dev, CAN_SJA1000_EFF_ID3)); - frame->id |= FIELD_PREP(GENMASK(4, 0), - can_sja1000_read_reg(dev, CAN_SJA1000_EFF_ID4) >> 3); + id |= FIELD_PREP(GENMASK(20, 13), + can_sja1000_read_reg(dev, CAN_SJA1000_XFF_ID2)); + id |= FIELD_PREP(GENMASK(12, 5), + can_sja1000_read_reg(dev, CAN_SJA1000_EFF_ID3)); + id |= FIELD_PREP(GENMASK(4, 0), + can_sja1000_read_reg(dev, CAN_SJA1000_EFF_ID4) >> 3); + frame->id = id; if ((frame->flags & CAN_FRAME_RTR) == 0U) { for (i = 0; i < frame->dlc; i++) { @@ -309,10 +311,11 @@ static void can_sja1000_read_frame(const struct device *dev, struct can_frame *f } } } else { - frame->id = FIELD_PREP(GENMASK(10, 3), + id = FIELD_PREP(GENMASK(10, 3), can_sja1000_read_reg(dev, CAN_SJA1000_XFF_ID1)); - frame->id |= FIELD_PREP(GENMASK(2, 0), - can_sja1000_read_reg(dev, CAN_SJA1000_XFF_ID2) >> 5); + id |= FIELD_PREP(GENMASK(2, 0), + can_sja1000_read_reg(dev, CAN_SJA1000_XFF_ID2) >> 5); + frame->id = id; if ((frame->flags & CAN_FRAME_RTR) == 0U) { for (i = 0; i < frame->dlc; i++) { @@ -325,6 +328,7 @@ static void can_sja1000_read_frame(const struct device *dev, struct can_frame *f void can_sja1000_write_frame(const struct device *dev, const struct can_frame *frame) { + uint32_t id; uint8_t info; int i; @@ -341,14 +345,15 @@ void can_sja1000_write_frame(const struct device *dev, const struct can_frame *f can_sja1000_write_reg(dev, CAN_SJA1000_FRAME_INFO, info); if ((frame->flags & CAN_FRAME_IDE) != 0) { + id = frame->id; can_sja1000_write_reg(dev, CAN_SJA1000_XFF_ID1, - FIELD_GET(GENMASK(28, 21), frame->id)); + FIELD_GET(GENMASK(28, 21), id)); can_sja1000_write_reg(dev, CAN_SJA1000_XFF_ID2, - FIELD_GET(GENMASK(20, 13), frame->id)); + FIELD_GET(GENMASK(20, 13), id)); can_sja1000_write_reg(dev, CAN_SJA1000_EFF_ID3, - FIELD_GET(GENMASK(12, 5), frame->id)); + FIELD_GET(GENMASK(12, 5), id)); can_sja1000_write_reg(dev, CAN_SJA1000_EFF_ID4, - FIELD_GET(GENMASK(4, 0), frame->id) << 3); + FIELD_GET(GENMASK(4, 0), id) << 3); if ((frame->flags & CAN_FRAME_RTR) == 0U) { for (i = 0; i < frame->dlc; i++) { @@ -357,10 +362,11 @@ void can_sja1000_write_frame(const struct device *dev, const struct can_frame *f } } } else { + id = frame->id; can_sja1000_write_reg(dev, CAN_SJA1000_XFF_ID1, - FIELD_GET(GENMASK(10, 3), frame->id)); + FIELD_GET(GENMASK(10, 3), id)); can_sja1000_write_reg(dev, CAN_SJA1000_XFF_ID2, - FIELD_GET(GENMASK(2, 0), frame->id) << 5); + FIELD_GET(GENMASK(2, 0), id) << 5); if ((frame->flags & CAN_FRAME_RTR) == 0U) { for (i = 0; i < frame->dlc; i++) { From 36772a88898d8ed75e91374ab2651c7678968b20 Mon Sep 17 00:00:00 2001 From: Ryan McClelland Date: Thu, 31 Oct 2024 11:21:53 -0700 Subject: [PATCH 2617/4482] drivers: serial: cdns: fix interrupt driven uart The tx fifo empty interrupt is a edge driven interrupt, so if it is already empty then and the interrupt is enabled, it will not fire so the isr needs to be triggered manually for the callback. This also removes the unnecessary interrupt locking in the isr and removes the receiver timeout interrupt. Signed-off-by: Ryan McClelland --- drivers/serial/uart_cdns.c | 58 ++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/drivers/serial/uart_cdns.c b/drivers/serial/uart_cdns.c index 9a807edf43a33..9e50052a9d866 100644 --- a/drivers/serial/uart_cdns.c +++ b/drivers/serial/uart_cdns.c @@ -75,6 +75,19 @@ int uart_cdns_poll_in(const struct device *dev, unsigned char *p_char) } #ifdef CONFIG_UART_INTERRUPT_DRIVEN +static void uart_cdns_irq_handler(const struct device *dev) +{ + struct uart_cdns_regs *uart_regs = DEV_UART(dev); + struct uart_cdns_data *data = dev->data; + + if (data->callback) { + data->callback(dev, data->cb_data); + } + + /* clear events by reading the status */ + (void)uart_regs->channel_intr_status; +} + static int uart_cdns_fill_fifo(const struct device *dev, const uint8_t *tx_data, int len) { struct uart_cdns_regs *uart_regs = DEV_UART(dev); @@ -105,21 +118,27 @@ static int uart_cdns_read_fifo(const struct device *dev, uint8_t *rx_data, const void uart_cdns_enable_tx_irq(const struct device *dev) { struct uart_cdns_regs *uart_regs = DEV_UART(dev); - + struct uart_cdns_data *data = dev->data; + unsigned int key; /* * TX empty interrupt only triggered when TX removes the last byte from the - * TX FIFO. We need another way generate the first interrupt. This is why - * we have the timer involved here + * TX FIFO. We need another way generate the first interrupt. If the TX FIFO + * is already empty, we need to trigger the callback manually. */ - uart_regs->rx_timeout = DEFAULT_RTO_PERIODS_FACTOR; - uart_regs->intr_enable = CSR_TEMPTY_MASK | CSR_TOUT_MASK; + uart_regs->intr_enable = CSR_TEMPTY_MASK; + key = irq_lock(); + if (data->callback) { + data->callback(dev, data->cb_data); + } + irq_unlock(key); + } void uart_cdns_disable_tx_irq(const struct device *dev) { struct uart_cdns_regs *uart_regs = DEV_UART(dev); - uart_regs->intr_disable = CSR_TEMPTY_MASK | CSR_TOUT_MASK; + uart_regs->intr_disable = CSR_TEMPTY_MASK; } static int uart_cdns_irq_tx_ready(const struct device *dev) @@ -158,7 +177,7 @@ static void uart_cdns_enable_irq_err(const struct device *dev) struct uart_cdns_regs *uart_regs = DEV_UART(dev); uart_regs->intr_enable |= - (CSR_TOVR_MASK | CSR_TOUT_MASK | CSR_PARE_MASK | CSR_FRAME_MASK | CSR_ROVR_MASK); + (CSR_TOVR_MASK | CSR_PARE_MASK | CSR_FRAME_MASK | CSR_ROVR_MASK); } static void uart_cdns_disable_irq_err(const struct device *dev) @@ -166,7 +185,7 @@ static void uart_cdns_disable_irq_err(const struct device *dev) struct uart_cdns_regs *uart_regs = DEV_UART(dev); uart_regs->intr_disable |= - (CSR_TOVR_MASK | CSR_TOUT_MASK | CSR_PARE_MASK | CSR_FRAME_MASK | CSR_ROVR_MASK); + (CSR_TOVR_MASK | CSR_PARE_MASK | CSR_FRAME_MASK | CSR_ROVR_MASK); } static int uart_cdns_is_irq_pending(const struct device *dev) @@ -192,29 +211,6 @@ void uart_cdns_set_irq_callback(const struct device *dev, uart_irq_callback_user data->callback = cb; data->cb_data = cb_data; } - -static void uart_cdns_irq_handler(const struct device *dev) -{ - struct uart_cdns_regs *uart_regs = DEV_UART(dev); - uint32_t key = irq_lock(); - uint32_t isr_status; - struct uart_cdns_data *data = dev->data; - - if (data->callback) { - data->callback(dev, data->cb_data); - } - - /* clear events */ - /* need to make local copy of the status */ - isr_status = uart_regs->channel_intr_status; - - if (isr_status & CSR_TOUT_MASK) { - uart_regs->intr_disable = CSR_TOUT_MASK; - } - - irq_unlock(key); -} - #endif static const struct uart_driver_api uart_cdns_driver_api = { From 37784442f8d663337cb0aa02dbef34813f74eb21 Mon Sep 17 00:00:00 2001 From: Ryan McClelland Date: Thu, 31 Oct 2024 21:01:26 -0700 Subject: [PATCH 2618/4482] tests: drivers: build_all: uart: add uart interrupt driven Add CONFIG_UART_INTERRUPT_DRIVEN for building the uart driver Signed-off-by: Ryan McClelland --- tests/drivers/build_all/uart/prj.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/drivers/build_all/uart/prj.conf b/tests/drivers/build_all/uart/prj.conf index bb5ccbec1bab8..cef7598cf1048 100644 --- a/tests/drivers/build_all/uart/prj.conf +++ b/tests/drivers/build_all/uart/prj.conf @@ -1,3 +1,4 @@ CONFIG_TEST=y CONFIG_TEST_USERSPACE=y CONFIG_SERIAL=y +CONFIG_UART_INTERRUPT_DRIVEN=y From a214ddb2c95b576da5f08af505c63009c38fdc2a Mon Sep 17 00:00:00 2001 From: Noemie Gillet Date: Mon, 4 Nov 2024 17:45:06 +0100 Subject: [PATCH 2619/4482] posix: fix one-time timer for SIGEV_SIGNAL For SIGEV_SIGNAL, the function zephyr_timer_wrapper() is the handler between kernel and posix layer. Here, for one-time timer, reload is equal to 0 and function returns. As a consequence, handler function was never called. Signed-off-by: Noemie Gillet --- lib/posix/options/timer.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/posix/options/timer.c b/lib/posix/options/timer.c index 1493be7b20694..3c14a01a3add3 100644 --- a/lib/posix/options/timer.c +++ b/lib/posix/options/timer.c @@ -43,7 +43,6 @@ static void zephyr_timer_wrapper(struct k_timer *ztimer) if (timer->reload == 0U) { timer->status = NOT_ACTIVE; LOG_DBG("timer %p not active", timer); - return; } if (timer->evp.sigev_notify == SIGEV_NONE) { From cbec9a342bca6ec83d240127a3b608a96260f2f6 Mon Sep 17 00:00:00 2001 From: Noemie Gillet Date: Mon, 4 Nov 2024 17:47:15 +0100 Subject: [PATCH 2620/4482] test: posix: add test_one_shot__SIGEV_SIGNAL testcase increase test coverage for newly added code Signed-off-by: Noemie Gillet --- tests/posix/common/src/timer.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/posix/common/src/timer.c b/tests/posix/common/src/timer.c index e4903839f8d39..5f1e788b67f3e 100644 --- a/tests/posix/common/src/timer.c +++ b/tests/posix/common/src/timer.c @@ -122,6 +122,29 @@ ZTEST(timer, test_timer_overrun) zassert_equal(timer_getoverrun(timerid), 4, "Number of overruns is incorrect"); } +ZTEST(timer, test_one_shot__SIGEV_SIGNAL) +{ + struct sigevent sig = {0}; + struct itimerspec value; + + exp_count = 0; + sig.sigev_notify = SIGEV_SIGNAL; + sig.sigev_notify_function = handler; + sig.sigev_value.sival_int = TEST_SIGNAL_VAL; + + zassert_ok(timer_create(CLOCK_MONOTONIC, &sig, &timerid)); + + /*Set the timer to expire only once*/ + value.it_interval.tv_sec = 0; + value.it_interval.tv_nsec = 0; + value.it_value.tv_sec = 0; + value.it_value.tv_nsec = 100 * NSEC_PER_MSEC; + zassert_ok(timer_settime(timerid, 0, &value, NULL)); + k_sleep(K_MSEC(300)); + + zassert_equal(exp_count, 1, "Number of expiry is incorrect"); +} + static void after(void *arg) { ARG_UNUSED(arg); From 4355d07fcd36e4bf9637a6f55a0f6cf8ae33a681 Mon Sep 17 00:00:00 2001 From: Noemie Gillet Date: Mon, 4 Nov 2024 17:49:50 +0100 Subject: [PATCH 2621/4482] test: posix: timer: fix format change { 0 } to {0} Signed-off-by: Noemie Gillet --- tests/posix/common/src/timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/posix/common/src/timer.c b/tests/posix/common/src/timer.c index 5f1e788b67f3e..55a69e1ee71d6 100644 --- a/tests/posix/common/src/timer.c +++ b/tests/posix/common/src/timer.c @@ -104,7 +104,7 @@ ZTEST(timer, test_CLOCK_MONOTONIC__SIGEV_THREAD) ZTEST(timer, test_timer_overrun) { - struct sigevent sig = { 0 }; + struct sigevent sig = {0}; struct itimerspec value; sig.sigev_notify = SIGEV_NONE; From d6013e70440a6d3d073209f93c5d681a94287277 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Thu, 31 Oct 2024 12:39:59 +0000 Subject: [PATCH 2622/4482] input: it8xxx2_kbd: add a kso-ignore-mask property The it8xxx2_kbd KSO pins can be used as both keyboard scan and GPIO. By default the keyboard scanning driver controls the output level of all the KSO signals from 0 to (col-size - 1), meaning that any line in between used as GPIO is going to have its output value overridden. Add a kso-ignore-mask property to the keyboard scan driver to allow specifiying extra pins that should not be controlled by the driver. Signed-off-by: Fabio Baltieri --- drivers/input/input_ite_it8xxx2_kbd.c | 16 ++++++++-------- dts/bindings/input/ite,it8xxx2-kbd.yaml | 8 ++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/input/input_ite_it8xxx2_kbd.c b/drivers/input/input_ite_it8xxx2_kbd.c index ba5b03afa0a1f..c7ff590f3c9ee 100644 --- a/drivers/input/input_ite_it8xxx2_kbd.c +++ b/drivers/input/input_ite_it8xxx2_kbd.c @@ -44,6 +44,8 @@ struct it8xxx2_kbd_config { struct gpio_dt_spec kso16_gpios; /* KSO17 GPIO cells */ struct gpio_dt_spec kso17_gpios; + /* Mask of signals to ignore */ + uint32_t kso_ignore_mask; }; struct it8xxx2_kbd_data { @@ -59,7 +61,7 @@ static void it8xxx2_kbd_drive_column(const struct device *dev, int col) const struct it8xxx2_kbd_config *const config = dev->config; const struct input_kbd_matrix_common_config *common = &config->common; struct kscan_it8xxx2_regs *const inst = config->base; - const uint32_t kso_mask = BIT_MASK(common->col_size); + const uint32_t kso_mask = BIT_MASK(common->col_size) & ~config->kso_ignore_mask; const uint8_t ksol_mask = kso_mask & 0xff; const uint8_t ksoh1_mask = (kso_mask >> 8) & 0xff; uint32_t kso_val; @@ -76,17 +78,14 @@ static void it8xxx2_kbd_drive_column(const struct device *dev, int col) kso_val = kso_mask ^ BIT(col); } - /* Set KSO[17:0] output data */ - inst->KBS_KSOL = (inst->KBS_KSOL & ~ksol_mask) | (kso_val & ksol_mask); - /* - * Disable global interrupts for critical section - * The KBS_KSOH1 register contains both keyboard and GPIO output settings. + /* Set KSO[17:0] output data, disable global interrupts for critical section. + * The KBS_KSO* registers contains both keyboard and GPIO output settings. * Not all bits are for the keyboard will be driven, so a critical section * is needed to avoid race conditions. */ key = irq_lock(); + inst->KBS_KSOL = (inst->KBS_KSOL & ~ksol_mask) | (kso_val & ksol_mask); inst->KBS_KSOH1 = (inst->KBS_KSOH1 & ~ksoh1_mask) | ((kso_val >> 8) & ksoh1_mask); - /* Restore interrupts */ irq_unlock(key); if (common->col_size > 16) { @@ -153,7 +152,7 @@ static int it8xxx2_kbd_init(const struct device *dev) const struct input_kbd_matrix_common_config *common = &config->common; struct it8xxx2_kbd_data *data = dev->data; struct kscan_it8xxx2_regs *const inst = config->base; - const uint32_t kso_mask = BIT_MASK(common->col_size); + const uint32_t kso_mask = BIT_MASK(common->col_size) & ~config->kso_ignore_mask; const uint8_t ksol_mask = kso_mask & 0xff; const uint8_t ksoh1_mask = (kso_mask >> 8) & 0xff; int status; @@ -248,6 +247,7 @@ static const struct it8xxx2_kbd_config it8xxx2_kbd_cfg_0 = { .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0), .kso16_gpios = GPIO_DT_SPEC_INST_GET(0, kso16_gpios), .kso17_gpios = GPIO_DT_SPEC_INST_GET(0, kso17_gpios), + .kso_ignore_mask = DT_INST_PROP(0, kso_ignore_mask), }; static struct it8xxx2_kbd_data it8xxx2_kbd_data_0; diff --git a/dts/bindings/input/ite,it8xxx2-kbd.yaml b/dts/bindings/input/ite,it8xxx2-kbd.yaml index d809f41fbbc97..896a50295bb69 100644 --- a/dts/bindings/input/ite,it8xxx2-kbd.yaml +++ b/dts/bindings/input/ite,it8xxx2-kbd.yaml @@ -35,6 +35,14 @@ properties: description: | The KSO17 pin for the selected port. + kso-ignore-mask: + type: int + default: 0 + description: | + Bitmask of KSO signals to ignore, this can be used to instruct the driver + to skip KSO signals between 0 and (col-size - 1) that are used as GPIOs. + Default to 0 (no signals masked). + pinctrl-0: required: true From 3231b993ae9dedd4870f046231797be3cdb0093a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Fri, 25 Oct 2024 11:22:05 +0200 Subject: [PATCH 2623/4482] samples: net: cloud: aws_iot_mqtt: use auto init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit use auto init for networking, dhcp and sntp. This simplifys the code of this sample by using the auto init feature of the networking stack. Signed-off-by: Fin Maaß --- samples/net/cloud/aws_iot_mqtt/CMakeLists.txt | 1 - .../aws_iot_mqtt/boards/nucleo_f429zi.conf | 3 - .../cloud/aws_iot_mqtt/boards/qemu_x86.conf | 3 +- samples/net/cloud/aws_iot_mqtt/prj.conf | 12 +++- samples/net/cloud/aws_iot_mqtt/src/dhcp.c | 66 ------------------- samples/net/cloud/aws_iot_mqtt/src/dhcp.h | 15 ----- samples/net/cloud/aws_iot_mqtt/src/main.c | 29 -------- 7 files changed, 12 insertions(+), 117 deletions(-) delete mode 100644 samples/net/cloud/aws_iot_mqtt/src/dhcp.c delete mode 100644 samples/net/cloud/aws_iot_mqtt/src/dhcp.h diff --git a/samples/net/cloud/aws_iot_mqtt/CMakeLists.txt b/samples/net/cloud/aws_iot_mqtt/CMakeLists.txt index 1d29ecd2b54d4..7ee0400ba7cac 100644 --- a/samples/net/cloud/aws_iot_mqtt/CMakeLists.txt +++ b/samples/net/cloud/aws_iot_mqtt/CMakeLists.txt @@ -21,4 +21,3 @@ else() endif() target_sources(app PRIVATE "src/main.c" ${creds}) -target_sources_ifdef(CONFIG_NET_DHCPV4 app PRIVATE "src/dhcp.c") diff --git a/samples/net/cloud/aws_iot_mqtt/boards/nucleo_f429zi.conf b/samples/net/cloud/aws_iot_mqtt/boards/nucleo_f429zi.conf index f444080776a45..9d04586cc42d7 100644 --- a/samples/net/cloud/aws_iot_mqtt/boards/nucleo_f429zi.conf +++ b/samples/net/cloud/aws_iot_mqtt/boards/nucleo_f429zi.conf @@ -1,4 +1 @@ CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR=y - -CONFIG_NET_DHCPV4=y -CONFIG_NET_DHCPV4_INITIAL_DELAY_MAX=2 diff --git a/samples/net/cloud/aws_iot_mqtt/boards/qemu_x86.conf b/samples/net/cloud/aws_iot_mqtt/boards/qemu_x86.conf index 702fad8bbc216..d3b34d7e07441 100644 --- a/samples/net/cloud/aws_iot_mqtt/boards/qemu_x86.conf +++ b/samples/net/cloud/aws_iot_mqtt/boards/qemu_x86.conf @@ -1,11 +1,10 @@ CONFIG_QEMU_ICOUNT=n # QEMU networking configuration -CONFIG_NET_CONFIG_SETTINGS=y CONFIG_NET_CONFIG_NEED_IPV6=y CONFIG_NET_CONFIG_MY_IPV6_ADDR="2001:db8::1" CONFIG_NET_CONFIG_PEER_IPV6_ADDR="2001:db8::2" -CONFIG_NET_CONFIG_NEED_IPV4=y +CONFIG_NET_DHCPV4=n CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1" CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.2" CONFIG_NET_CONFIG_MY_IPV4_GW="192.0.2.2" diff --git a/samples/net/cloud/aws_iot_mqtt/prj.conf b/samples/net/cloud/aws_iot_mqtt/prj.conf index fbede2f3bf946..fa0a5202a5dce 100644 --- a/samples/net/cloud/aws_iot_mqtt/prj.conf +++ b/samples/net/cloud/aws_iot_mqtt/prj.conf @@ -11,7 +11,6 @@ CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_INIT_STACKS=y CONFIG_HW_STACK_PROTECTION=y CONFIG_REQUIRES_FULL_LIBC=y -CONFIG_SNTP=y CONFIG_JSON_LIBRARY=y CONFIG_POSIX_API=y @@ -33,6 +32,17 @@ CONFIG_NET_IPV4=y CONFIG_NET_SOCKETS=y CONFIG_NET_SOCKETS_SOCKOPT_TLS=y +# Network configuration +CONFIG_NET_CONFIG_SETTINGS=y +CONFIG_NET_CONFIG_NEED_IPV4=y +CONFIG_NET_DHCPV4=y + +# SNTP +CONFIG_SNTP=y +CONFIG_POSIX_TIMERS=y +CONFIG_NET_CONFIG_CLOCK_SNTP_INIT=y +CONFIG_NET_CONFIG_SNTP_INIT_SERVER="0.pool.ntp.org" + # Logging CONFIG_LOG=y diff --git a/samples/net/cloud/aws_iot_mqtt/src/dhcp.c b/samples/net/cloud/aws_iot_mqtt/src/dhcp.c deleted file mode 100644 index 26e95bcff0061..0000000000000 --- a/samples/net/cloud/aws_iot_mqtt/src/dhcp.c +++ /dev/null @@ -1,66 +0,0 @@ -/* DHCPv4 client startup. */ - -/* - * Copyright (c) 2018 Linaro Ltd - * Copyright (c) 2023 Lucas Dietrich - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -LOG_MODULE_DECLARE(aws, LOG_LEVEL_DBG); - -#include - -#include -#include -#include -#include - -static struct net_mgmt_event_callback mgmt_cb; - -/* Semaphore to indicate a lease has been acquired. */ -static K_SEM_DEFINE(got_address, 0, 1); - -static void handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, - struct net_if *iface) -{ - int i; - bool notified = false; - - if (mgmt_event != NET_EVENT_IPV4_ADDR_ADD) { - return; - } - - for (i = 0; i < NET_IF_MAX_IPV4_ADDR; i++) { - if (iface->config.ip.ipv4->unicast[i].ipv4.addr_type != - NET_ADDR_DHCP) { - continue; - } - - if (!notified) { - k_sem_give(&got_address); - notified = true; - } - break; - } -} - -/** - * Start a DHCP client, and wait for a lease to be acquired. - */ -void app_dhcpv4_startup(void) -{ - LOG_INF("starting DHCPv4"); - - net_mgmt_init_event_callback(&mgmt_cb, handler, - NET_EVENT_IPV4_ADDR_ADD); - net_mgmt_add_event_callback(&mgmt_cb); - - net_dhcpv4_start(net_if_get_default()); - - /* Wait for a lease. */ - k_sem_take(&got_address, K_FOREVER); -} diff --git a/samples/net/cloud/aws_iot_mqtt/src/dhcp.h b/samples/net/cloud/aws_iot_mqtt/src/dhcp.h deleted file mode 100644 index 99eb983f344a8..0000000000000 --- a/samples/net/cloud/aws_iot_mqtt/src/dhcp.h +++ /dev/null @@ -1,15 +0,0 @@ -/* DHCPv4 client startup. */ - -/* - * Copyright (c) 2018 Linaro Ltd - * Copyright (c) 2023 Lucas Dietrich - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef __DHCP_H__ -#define __DHCP_H__ - -void app_dhcpv4_startup(void); - -#endif diff --git a/samples/net/cloud/aws_iot_mqtt/src/main.c b/samples/net/cloud/aws_iot_mqtt/src/main.c index f911f429f2f47..5e52d70187f30 100644 --- a/samples/net/cloud/aws_iot_mqtt/src/main.c +++ b/samples/net/cloud/aws_iot_mqtt/src/main.c @@ -5,7 +5,6 @@ */ #include "creds/creds.h" -#include "dhcp.h" #include #include @@ -14,11 +13,9 @@ #include #include #include -#include #include #include #include -#include #include @@ -421,26 +418,6 @@ void aws_client_loop(void) fds.fd = -1; } -int sntp_sync_time(void) -{ - int rc; - struct sntp_time now; - struct timespec tspec; - - rc = sntp_simple(SNTP_SERVER, SYS_FOREVER_MS, &now); - if (rc == 0) { - tspec.tv_sec = now.seconds; - tspec.tv_nsec = ((uint64_t)now.fraction * (1000lu * 1000lu * 1000lu)) >> 32; - - clock_settime(CLOCK_REALTIME, &tspec); - - LOG_DBG("Acquired time from NTP server: %u", (uint32_t)tspec.tv_sec); - } else { - LOG_ERR("Failed to acquire SNTP, code %d\n", rc); - } - return rc; -} - static int resolve_broker_addr(struct sockaddr_in *broker) { int ret; @@ -473,12 +450,6 @@ static int resolve_broker_addr(struct sockaddr_in *broker) int main(void) { -#if defined(CONFIG_NET_DHCPV4) - app_dhcpv4_startup(); -#endif - - sntp_sync_time(); - setup_credentials(); for (;;) { From fbea2ceba3edfb308087623412e4b29b96c87a42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Thu, 31 Oct 2024 15:05:40 +0100 Subject: [PATCH 2624/4482] samples: net: cloud: aws_iot_mqtt: remove redundant kconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR is on by default, if the device supports that, so there is no need to enable it explicit. Signed-off-by: Fin Maaß --- samples/net/cloud/aws_iot_mqtt/boards/nucleo_f429zi.conf | 1 - 1 file changed, 1 deletion(-) delete mode 100644 samples/net/cloud/aws_iot_mqtt/boards/nucleo_f429zi.conf diff --git a/samples/net/cloud/aws_iot_mqtt/boards/nucleo_f429zi.conf b/samples/net/cloud/aws_iot_mqtt/boards/nucleo_f429zi.conf deleted file mode 100644 index 9d04586cc42d7..0000000000000 --- a/samples/net/cloud/aws_iot_mqtt/boards/nucleo_f429zi.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR=y From a68a0a4a5b7fda82971cb7d5005757103d3473bf Mon Sep 17 00:00:00 2001 From: Adam Cavender Date: Thu, 31 Oct 2024 10:48:02 +0000 Subject: [PATCH 2625/4482] bluetooth: host: Update FAE table type for HCI commands Update FAE table type from array of uint8_t to int8_t. From Vol 6.0, Part B, section 2.4.2.52: "The ChFAE field contains the per-channel mode-0 FAE table of the local Controller. Every per-channel mode-0 FAE value is represented by an 8-bit signed integer" Signed-off-by: Adam Cavender --- include/zephyr/bluetooth/conn.h | 2 +- include/zephyr/bluetooth/cs.h | 2 +- include/zephyr/bluetooth/hci_types.h | 4 ++-- subsys/bluetooth/host/cs.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/zephyr/bluetooth/conn.h b/include/zephyr/bluetooth/conn.h index 5ef3628172690..83b87588c08b4 100644 --- a/include/zephyr/bluetooth/conn.h +++ b/include/zephyr/bluetooth/conn.h @@ -410,7 +410,7 @@ struct bt_conn_le_cs_capabilities { /** Remote FAE Table for LE connections supporting CS */ struct bt_conn_le_cs_fae_table { - uint8_t *remote_fae_table; + int8_t *remote_fae_table; }; /** Channel sounding main mode */ diff --git a/include/zephyr/bluetooth/cs.h b/include/zephyr/bluetooth/cs.h index aaa410da2d27c..2c661c09c57fa 100644 --- a/include/zephyr/bluetooth/cs.h +++ b/include/zephyr/bluetooth/cs.h @@ -886,7 +886,7 @@ int bt_le_cs_write_cached_remote_supported_capabilities( * * @return Zero on success or (negative) error code on failure. */ -int bt_le_cs_write_cached_remote_fae_table(struct bt_conn *conn, uint8_t remote_fae_table[72]); +int bt_le_cs_write_cached_remote_fae_table(struct bt_conn *conn, int8_t remote_fae_table[72]); #ifdef __cplusplus } diff --git a/include/zephyr/bluetooth/hci_types.h b/include/zephyr/bluetooth/hci_types.h index 08be96bd2ff38..15bc303bf9ee7 100644 --- a/include/zephyr/bluetooth/hci_types.h +++ b/include/zephyr/bluetooth/hci_types.h @@ -2500,7 +2500,7 @@ struct bt_hci_cp_le_read_remote_fae_table { struct bt_hci_cp_le_write_cached_remote_fae_table { uint16_t handle; - uint8_t remote_fae_table[72]; + int8_t remote_fae_table[72]; } __packed; #define BT_HCI_OP_LE_CS_SET_CHANNEL_CLASSIFICATION BT_OP(BT_OGF_LE, 0x0092) /* 0x2092 */ @@ -3547,7 +3547,7 @@ struct bt_hci_evt_le_cs_read_remote_supported_capabilities_complete { struct bt_hci_evt_le_cs_read_remote_fae_table_complete { uint8_t status; uint16_t conn_handle; - uint8_t remote_fae_table[72]; + int8_t remote_fae_table[72]; } __packed; #define BT_HCI_LE_CS_CONFIG_ACTION_REMOVED 0x00 diff --git a/subsys/bluetooth/host/cs.c b/subsys/bluetooth/host/cs.c index c11f262b5d226..03cc3a8e95f17 100644 --- a/subsys/bluetooth/host/cs.c +++ b/subsys/bluetooth/host/cs.c @@ -1171,7 +1171,7 @@ int bt_le_cs_write_cached_remote_supported_capabilities( NULL); } -int bt_le_cs_write_cached_remote_fae_table(struct bt_conn *conn, uint8_t remote_fae_table[72]) +int bt_le_cs_write_cached_remote_fae_table(struct bt_conn *conn, int8_t remote_fae_table[72]) { struct bt_hci_cp_le_write_cached_remote_fae_table *cp; struct net_buf *buf; From f1f78682d94267616779fd891206485e6468ae88 Mon Sep 17 00:00:00 2001 From: Andries Kruithof Date: Thu, 31 Oct 2024 10:53:47 +0100 Subject: [PATCH 2626/4482] Bluetooth: Audio: API for the distribute broadcast code procedure Define the API for the distribute broadcast code CAP procedure Signed-off-by: Andries Kruithof --- include/zephyr/bluetooth/audio/cap.h | 44 +++++++++++++++++++++++++- subsys/bluetooth/audio/cap_commander.c | 6 ++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/include/zephyr/bluetooth/audio/cap.h b/include/zephyr/bluetooth/audio/cap.h index 359aa45632bff..ee50a978aa9a0 100644 --- a/include/zephyr/bluetooth/audio/cap.h +++ b/include/zephyr/bluetooth/audio/cap.h @@ -948,7 +948,6 @@ int bt_cap_commander_broadcast_reception_start( const struct bt_cap_commander_broadcast_reception_start_param *param); /** Parameters for stopping broadcast reception */ - struct bt_cap_commander_broadcast_reception_stop_member_param { /** Coordinated or ad-hoc set member. */ union bt_cap_set_member member; @@ -982,6 +981,49 @@ struct bt_cap_commander_broadcast_reception_stop_param { int bt_cap_commander_broadcast_reception_stop( const struct bt_cap_commander_broadcast_reception_stop_param *param); +/** Parameters for distributing broadcast code */ +struct bt_cap_commander_distribute_broadcast_code_member_param { + /** Coordinated or ad-hoc set member. */ + union bt_cap_set_member member; + + /** Source ID of the receive state. */ + uint8_t src_id; +}; + +struct bt_cap_commander_distribute_broadcast_code_param { + /** The type of the set. */ + enum bt_cap_set_type type; + + /** The set of devices for this procedure */ + struct bt_cap_commander_distribute_broadcast_code_member_param *param; + + /** The number of parameters in @p param */ + size_t count; + + /** + * @brief 16-octet broadcast code. + * + * If the value is a string or a the value is less than 16 octets, + * the remaining octets shall be 0. + * + * Example: + * The string "Broadcast Code" shall be + * [42 72 6F 61 64 63 61 73 74 20 43 6F 64 65 00 00] + */ + uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]; +}; + +/** + * @brief Distributes the broadcast code on one or more remote Common Audio Profile + * Acceptors + * + * @param param The parameters for distributing the broadcast code + * + * @return 0 on success or negative error value on failure. + */ +int bt_cap_commander_distribute_broadcast_code( + const struct bt_cap_commander_distribute_broadcast_code_param *param); + /** Parameters for changing absolute volume */ struct bt_cap_commander_change_volume_param { /** The type of the set. */ diff --git a/subsys/bluetooth/audio/cap_commander.c b/subsys/bluetooth/audio/cap_commander.c index d8e40007eb79d..6725bb478633d 100644 --- a/subsys/bluetooth/audio/cap_commander.c +++ b/subsys/bluetooth/audio/cap_commander.c @@ -671,6 +671,12 @@ int bt_cap_commander_broadcast_reception_stop( return 0; } +int bt_cap_commander_distribute_broadcast_code( + const struct bt_cap_commander_distribute_broadcast_code_param *param) +{ + return -ENOSYS; +} + #endif /* CONFIG_BT_BAP_BROADCAST_ASSISTANT */ static void cap_commander_proc_complete(void) From 0c7433dcaabc71a8c4159872fdb4017387fade7f Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 31 Oct 2024 08:15:32 +0000 Subject: [PATCH 2627/4482] boards: Remove PINCTRL from some boards Removes lines from defconfig files having PINCTRL in them Signed-off-by: Jamie McCrae --- boards/96boards/meerkat96/96b_meerkat96_mcimx7d_m4_defconfig | 3 --- boards/arduino/nicla_sense_me/arduino_nicla_sense_me_defconfig | 3 --- boards/element14/warp7/warp7_mcimx7d_m4_defconfig | 1 - boards/madmachine/mm_feather/mm_feather_defconfig | 1 - boards/madmachine/mm_swiftio/mm_swiftio_defconfig | 1 - .../phyboard_electra/phyboard_electra_am6442_m4_defconfig | 3 --- boards/phytec/phyboard_lyra/phyboard_lyra_am6234_m4_defconfig | 3 --- .../phytec/phyboard_polis/phyboard_polis_mimx8mm6_m4_defconfig | 1 - .../phyboard_pollux/phyboard_pollux_mimx8ml8_m7_defconfig | 2 -- boards/pjrc/teensy4/teensy40_defconfig | 1 - boards/pjrc/teensy4/teensy41_defconfig | 1 - boards/segger/ip_k66f/ip_k66f_defconfig | 1 - boards/technexion/pico_pi/pico_pi_mcimx7d_m4_defconfig | 1 - .../toradex/colibri_imx7d/colibri_imx7d_mcimx7d_m4_defconfig | 1 - .../verdin_imx8mp/verdin_imx8mp_mimx8ml8_m7_ddr_defconfig | 1 - .../toradex/verdin_imx8mp/verdin_imx8mp_mimx8ml8_m7_defconfig | 1 - boards/udoo/udoo_neo_full/udoo_neo_full_mcimx6x_m4_defconfig | 1 - 17 files changed, 26 deletions(-) diff --git a/boards/96boards/meerkat96/96b_meerkat96_mcimx7d_m4_defconfig b/boards/96boards/meerkat96/96b_meerkat96_mcimx7d_m4_defconfig index 90dfb85138a02..d421425ca1910 100644 --- a/boards/96boards/meerkat96/96b_meerkat96_mcimx7d_m4_defconfig +++ b/boards/96boards/meerkat96/96b_meerkat96_mcimx7d_m4_defconfig @@ -12,7 +12,4 @@ CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y -# pinctrl -CONFIG_PINCTRL=y - CONFIG_XIP=y diff --git a/boards/arduino/nicla_sense_me/arduino_nicla_sense_me_defconfig b/boards/arduino/nicla_sense_me/arduino_nicla_sense_me_defconfig index f8691d1c1cefe..8c35a59f63c45 100644 --- a/boards/arduino/nicla_sense_me/arduino_nicla_sense_me_defconfig +++ b/boards/arduino/nicla_sense_me/arduino_nicla_sense_me_defconfig @@ -13,6 +13,3 @@ CONFIG_SERIAL=y # enable console CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y - -# enable pin controller -CONFIG_PINCTRL=y diff --git a/boards/element14/warp7/warp7_mcimx7d_m4_defconfig b/boards/element14/warp7/warp7_mcimx7d_m4_defconfig index b62210da43e09..90df69ee07b9e 100644 --- a/boards/element14/warp7/warp7_mcimx7d_m4_defconfig +++ b/boards/element14/warp7/warp7_mcimx7d_m4_defconfig @@ -9,4 +9,3 @@ CONFIG_SERIAL=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_CONSOLE=y CONFIG_XIP=y -CONFIG_PINCTRL=y diff --git a/boards/madmachine/mm_feather/mm_feather_defconfig b/boards/madmachine/mm_feather/mm_feather_defconfig index 65cb3610d48c3..da5dded1e40ab 100644 --- a/boards/madmachine/mm_feather/mm_feather_defconfig +++ b/boards/madmachine/mm_feather/mm_feather_defconfig @@ -11,4 +11,3 @@ CONFIG_GPIO=y CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=600000000 CONFIG_ARM_MPU=y CONFIG_HW_STACK_PROTECTION=y -CONFIG_PINCTRL=y diff --git a/boards/madmachine/mm_swiftio/mm_swiftio_defconfig b/boards/madmachine/mm_swiftio/mm_swiftio_defconfig index 0aee57c3625b4..4767b1fe6ce76 100644 --- a/boards/madmachine/mm_swiftio/mm_swiftio_defconfig +++ b/boards/madmachine/mm_swiftio/mm_swiftio_defconfig @@ -11,4 +11,3 @@ CONFIG_GPIO=y CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=600000000 CONFIG_ARM_MPU=y CONFIG_HW_STACK_PROTECTION=y -CONFIG_PINCTRL=y diff --git a/boards/phytec/phyboard_electra/phyboard_electra_am6442_m4_defconfig b/boards/phytec/phyboard_electra/phyboard_electra_am6442_m4_defconfig index 1e4d69df6a014..fb0c6223e41c1 100644 --- a/boards/phytec/phyboard_electra/phyboard_electra_am6442_m4_defconfig +++ b/boards/phytec/phyboard_electra/phyboard_electra_am6442_m4_defconfig @@ -11,9 +11,6 @@ CONFIG_CORTEX_M_SYSTICK=y # Zephyr Kernel Configuration CONFIG_XIP=n -# Enable Pinctrl -CONFIG_PINCTRL=y - # Serial Driver CONFIG_SERIAL=y diff --git a/boards/phytec/phyboard_lyra/phyboard_lyra_am6234_m4_defconfig b/boards/phytec/phyboard_lyra/phyboard_lyra_am6234_m4_defconfig index a54f04a25e157..f309fdf6a80f7 100644 --- a/boards/phytec/phyboard_lyra/phyboard_lyra_am6234_m4_defconfig +++ b/boards/phytec/phyboard_lyra/phyboard_lyra_am6234_m4_defconfig @@ -11,9 +11,6 @@ CONFIG_CORTEX_M_SYSTICK=y # Zephyr Kernel Configuration CONFIG_XIP=n -# Enable Pinctrl -CONFIG_PINCTRL=y - # Serial Driver CONFIG_SERIAL=y diff --git a/boards/phytec/phyboard_polis/phyboard_polis_mimx8mm6_m4_defconfig b/boards/phytec/phyboard_polis/phyboard_polis_mimx8mm6_m4_defconfig index 9fad86a42a7fe..533730db043f0 100644 --- a/boards/phytec/phyboard_polis/phyboard_polis_mimx8mm6_m4_defconfig +++ b/boards/phytec/phyboard_polis/phyboard_polis_mimx8mm6_m4_defconfig @@ -10,5 +10,4 @@ CONFIG_UART_CONSOLE=y CONFIG_SERIAL=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_CONSOLE=y -CONFIG_PINCTRL=y CONFIG_GPIO=y diff --git a/boards/phytec/phyboard_pollux/phyboard_pollux_mimx8ml8_m7_defconfig b/boards/phytec/phyboard_pollux/phyboard_pollux_mimx8ml8_m7_defconfig index 4926fdbe4e1e9..23f5e9cd9a1cb 100644 --- a/boards/phytec/phyboard_pollux/phyboard_pollux_mimx8ml8_m7_defconfig +++ b/boards/phytec/phyboard_pollux/phyboard_pollux_mimx8ml8_m7_defconfig @@ -16,5 +16,3 @@ CONFIG_CODE_ITCM=y # y for DDR memory space CONFIG_CODE_DDR=n - -CONFIG_PINCTRL=y diff --git a/boards/pjrc/teensy4/teensy40_defconfig b/boards/pjrc/teensy4/teensy40_defconfig index 1d186d986c48a..e73b48be0a3aa 100644 --- a/boards/pjrc/teensy4/teensy40_defconfig +++ b/boards/pjrc/teensy4/teensy40_defconfig @@ -12,4 +12,3 @@ CONFIG_GPIO=y CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=600000000 CONFIG_ARM_MPU=y CONFIG_HW_STACK_PROTECTION=y -CONFIG_PINCTRL=y diff --git a/boards/pjrc/teensy4/teensy41_defconfig b/boards/pjrc/teensy4/teensy41_defconfig index 1d186d986c48a..e73b48be0a3aa 100644 --- a/boards/pjrc/teensy4/teensy41_defconfig +++ b/boards/pjrc/teensy4/teensy41_defconfig @@ -12,4 +12,3 @@ CONFIG_GPIO=y CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=600000000 CONFIG_ARM_MPU=y CONFIG_HW_STACK_PROTECTION=y -CONFIG_PINCTRL=y diff --git a/boards/segger/ip_k66f/ip_k66f_defconfig b/boards/segger/ip_k66f/ip_k66f_defconfig index 3a283228fafe6..873d457d15b0e 100644 --- a/boards/segger/ip_k66f/ip_k66f_defconfig +++ b/boards/segger/ip_k66f/ip_k66f_defconfig @@ -1,7 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 CONFIG_GPIO=y -CONFIG_PINCTRL=y CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=180000000 CONFIG_OSC_LOW_POWER=y CONFIG_USE_SEGGER_RTT=y diff --git a/boards/technexion/pico_pi/pico_pi_mcimx7d_m4_defconfig b/boards/technexion/pico_pi/pico_pi_mcimx7d_m4_defconfig index a9f1db5c8a767..78568d4528eb5 100644 --- a/boards/technexion/pico_pi/pico_pi_mcimx7d_m4_defconfig +++ b/boards/technexion/pico_pi/pico_pi_mcimx7d_m4_defconfig @@ -10,4 +10,3 @@ CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_CONSOLE=y CONFIG_XIP=y CONFIG_GPIO=n -CONFIG_PINCTRL=y diff --git a/boards/toradex/colibri_imx7d/colibri_imx7d_mcimx7d_m4_defconfig b/boards/toradex/colibri_imx7d/colibri_imx7d_mcimx7d_m4_defconfig index a55e01a9fa748..647353168677f 100644 --- a/boards/toradex/colibri_imx7d/colibri_imx7d_mcimx7d_m4_defconfig +++ b/boards/toradex/colibri_imx7d/colibri_imx7d_mcimx7d_m4_defconfig @@ -9,4 +9,3 @@ CONFIG_SERIAL=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_CONSOLE=y CONFIG_XIP=y -CONFIG_PINCTRL=y diff --git a/boards/toradex/verdin_imx8mp/verdin_imx8mp_mimx8ml8_m7_ddr_defconfig b/boards/toradex/verdin_imx8mp/verdin_imx8mp_mimx8ml8_m7_ddr_defconfig index 0f2a48bcc79c1..850c9bdc905f7 100644 --- a/boards/toradex/verdin_imx8mp/verdin_imx8mp_mimx8ml8_m7_ddr_defconfig +++ b/boards/toradex/verdin_imx8mp/verdin_imx8mp_mimx8ml8_m7_ddr_defconfig @@ -11,4 +11,3 @@ CONFIG_SERIAL=y CONFIG_CONSOLE=y CONFIG_XIP=y CONFIG_CODE_DDR=y -CONFIG_PINCTRL=y diff --git a/boards/toradex/verdin_imx8mp/verdin_imx8mp_mimx8ml8_m7_defconfig b/boards/toradex/verdin_imx8mp/verdin_imx8mp_mimx8ml8_m7_defconfig index c7f1110e266cd..2df7198927da6 100644 --- a/boards/toradex/verdin_imx8mp/verdin_imx8mp_mimx8ml8_m7_defconfig +++ b/boards/toradex/verdin_imx8mp/verdin_imx8mp_mimx8ml8_m7_defconfig @@ -11,4 +11,3 @@ CONFIG_SERIAL=y CONFIG_CONSOLE=y CONFIG_XIP=y CONFIG_CODE_ITCM=y -CONFIG_PINCTRL=y diff --git a/boards/udoo/udoo_neo_full/udoo_neo_full_mcimx6x_m4_defconfig b/boards/udoo/udoo_neo_full/udoo_neo_full_mcimx6x_m4_defconfig index 140679e50c3f5..3cbbb4d6f67c6 100644 --- a/boards/udoo/udoo_neo_full/udoo_neo_full_mcimx6x_m4_defconfig +++ b/boards/udoo/udoo_neo_full/udoo_neo_full_mcimx6x_m4_defconfig @@ -10,4 +10,3 @@ CONFIG_SERIAL=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_GPIO=y CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=227000000 -CONFIG_PINCTRL=y From 04dee0025f541ec48e3b246800d3aa8284868190 Mon Sep 17 00:00:00 2001 From: Yves Vandervennet Date: Wed, 30 Oct 2024 15:26:24 -0500 Subject: [PATCH 2628/4482] boards: frdm_k22f: enable linkserver` - add linkserver arguments in board.cmake - update documentation Signed-off-by: Yves Vandervennet --- boards/nxp/frdm_k22f/board.cmake | 2 ++ boards/nxp/frdm_k22f/doc/index.rst | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/boards/nxp/frdm_k22f/board.cmake b/boards/nxp/frdm_k22f/board.cmake index debe44fba369c..06434c613bb67 100644 --- a/boards/nxp/frdm_k22f/board.cmake +++ b/boards/nxp/frdm_k22f/board.cmake @@ -2,7 +2,9 @@ board_runner_args(jlink "--device=MK22FN512xxx12") board_runner_args(pyocd "--target=k22f") +board_runner_args(linkserver "--device=MK22FN512xxx12:FRDM-K22F") +include(${ZEPHYR_BASE}/boards/common/linkserver.board.cmake) include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/nxp/frdm_k22f/doc/index.rst b/boards/nxp/frdm_k22f/doc/index.rst index c150d83dcf036..ef2420ac0f48b 100644 --- a/boards/nxp/frdm_k22f/doc/index.rst +++ b/boards/nxp/frdm_k22f/doc/index.rst @@ -184,12 +184,26 @@ instructions to update from the CMSIS-DAP bootloader to the DAPLink bootloader. Option 1: :ref:`opensda-daplink-onboard-debug-probe` (Recommended) ------------------------------------------------------------------ -Install the :ref:`pyocd-debug-host-tools` and make sure they are in your search -path. - Follow the instructions in :ref:`opensda-daplink-onboard-debug-probe` to program the `OpenSDA DAPLink FRDM-K22F Firmware`_. +Install the :ref:`linkserver-debug-host-tools` and make sure they are in your +search path. LinkServer works with the default CMSIS-DAP firmware included in +the on-board debugger. + +Linkserver is the default for this board, ``west flash`` and ``west debug`` will +call the linkserver runner. + +.. code-block:: console + + west flash + +Alternatively, pyOCD can be used to flash and debug the board by using the +``-r pyocd`` option with West. pyOCD is installed when you complete the +:ref:`gs_python_deps` step in the Getting Started Guide. The runners supported +by NXP are LinkServer and JLink. pyOCD is another potential option, but NXP +does not test or support the pyOCD runner. + Option 2: :ref:`opensda-jlink-onboard-debug-probe` -------------------------------------------------- From 3ea491cb1c23911b779d557bd7b55f4b0083974c Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Tue, 29 Oct 2024 17:22:03 +0100 Subject: [PATCH 2629/4482] drivers: ethernet: lan865x: Update initial setup guidelines (from AN1760) This patch brings update of the procedure to initially configure the LAN865x devices. It follows setup guidelines from newest AN1760 [*]. The values from "TABLE1" on the [*] must be written to the device in the indicated order with recommended values. This was not the case previously, as first values from in-flash allocated (const) table were written and only afterwards calculated configuration parameters (cfgparams) were updated. With this patch the lan865x_conf[] table is allocated in-RAM, so placeholder values can be updated and it can be written at once at the end of configuration process. Its single entry has been reduced from 8B to only 4B. Moreover, moving it out of flash saves 512B of flash memory. Note: [*] - AN1760 Revision F (DS60001760G - June 2024) Signed-off-by: Lukasz Majewski --- drivers/ethernet/eth_lan865x.c | 179 ++++++++++++++-------------- drivers/ethernet/eth_lan865x_priv.h | 10 ++ drivers/ethernet/oa_tc6.h | 5 +- 3 files changed, 100 insertions(+), 94 deletions(-) diff --git a/drivers/ethernet/eth_lan865x.c b/drivers/ethernet/eth_lan865x.c index 870d6ab82cbaf..a9a3673ed9903 100644 --- a/drivers/ethernet/eth_lan865x.c +++ b/drivers/ethernet/eth_lan865x.c @@ -179,65 +179,109 @@ static uint8_t lan865x_read_indirect_reg(const struct device *dev, uint8_t addr, return (uint8_t) val & mask; } +/* + * Values in the below table for LAN865x rev. B0 and B1 (with place + * holders for cfgparamX. + */ +static oa_mem_map_t lan865x_conf[] = { + { .mms = 0x1, .address = 0x00, .value = 0x0000 }, + { .mms = 0x4, .address = 0xD0, .value = 0x3F31 }, + { .mms = 0x4, .address = 0xE0, .value = 0xC000 }, + { .mms = 0x4, .address = 0x84, .value = 0x0000 }, /* cfgparam1 */ + { .mms = 0x4, .address = 0x8A, .value = 0x0000 }, /* cfgparam2 */ + { .mms = 0x4, .address = 0xE9, .value = 0x9E50 }, + { .mms = 0x4, .address = 0xF5, .value = 0x1CF8 }, + { .mms = 0x4, .address = 0xF4, .value = 0xC020 }, + { .mms = 0x4, .address = 0xF8, .value = 0xB900 }, + { .mms = 0x4, .address = 0xF9, .value = 0x4E53 }, + { .mms = 0x4, .address = 0x91, .value = 0x9660 }, + { .mms = 0x4, .address = 0x77, .value = 0x0028 }, + { .mms = 0x4, .address = 0x43, .value = 0x00FF }, + { .mms = 0x4, .address = 0x44, .value = 0xFFFF }, + { .mms = 0x4, .address = 0x45, .value = 0x0000 }, + { .mms = 0x4, .address = 0x53, .value = 0x00FF }, + { .mms = 0x4, .address = 0x54, .value = 0xFFFF }, + { .mms = 0x4, .address = 0x55, .value = 0x0000 }, + { .mms = 0x4, .address = 0x40, .value = 0x0002 }, + { .mms = 0x4, .address = 0x50, .value = 0x0002 }, + { .mms = 0x4, .address = 0xAD, .value = 0x0000 }, /* cfgparam3 */ + { .mms = 0x4, .address = 0xAE, .value = 0x0000 }, /* cfgparam4 */ + { .mms = 0x4, .address = 0xAF, .value = 0x0000 }, /* cfgparam5 */ + { .mms = 0x4, .address = 0xB0, .value = 0x0103 }, + { .mms = 0x4, .address = 0xB1, .value = 0x0910 }, + { .mms = 0x4, .address = 0xB2, .value = 0x1D26 }, + { .mms = 0x4, .address = 0xB3, .value = 0x002A }, + { .mms = 0x4, .address = 0xB4, .value = 0x0103 }, + { .mms = 0x4, .address = 0xB5, .value = 0x070D }, + { .mms = 0x4, .address = 0xB6, .value = 0x1720 }, + { .mms = 0x4, .address = 0xB7, .value = 0x0027 }, + { .mms = 0x4, .address = 0xB8, .value = 0x0509 }, + { .mms = 0x4, .address = 0xB9, .value = 0x0E13 }, + { .mms = 0x4, .address = 0xBA, .value = 0x1C25 }, + { .mms = 0x4, .address = 0xBB, .value = 0x002B }, + { .mms = 0x4, .address = 0x0C, .value = 0x0100 }, + { .mms = 0x4, .address = 0x81, .value = 0x00E0 }, +}; + +/* Based on AN1760 DS60001760G pseudo code */ static int lan865x_init_chip(const struct device *dev, uint8_t silicon_rev) { + uint16_t cfgparam1, cfgparam2, cfgparam3, cfgparam4, cfgparam5; + uint8_t i, size = ARRAY_SIZE(lan865x_conf); struct lan865x_data *ctx = dev->data; + int8_t offset1 = 0, offset2 = 0; uint8_t value1, value2; - int8_t offset1 = 0, offset2 = 0, ret; - uint16_t value3, value4, value5, value6, value7; - uint16_t cfgparam1, cfgparam2, cfgparam3, cfgparam4, cfgparam5; - uint32_t val; - ret = lan865x_read_indirect_reg(dev, 0x05, 0x40); - if (ret == 0) { - LOG_ERR("LAN865x error! Please contact microchip support for replacement."); - return -EIO; - } + /* Enable protected control RW */ + oa_tc6_set_protected_ctrl(ctx->tc6, true); value1 = lan865x_read_indirect_reg(dev, 0x04, 0x1F); if ((value1 & 0x10) != 0) { /* Convert uint8_t to int8_t */ - offset1 = value1 | 0xE0; - if (offset1 < -5) { - LOG_ERR("LAN865x internal error!"); - return -EIO; - } + offset1 = (int8_t)((uint8_t)value1 - 0x20); } else { - offset1 = value1; + offset1 = (int8_t)value1; } value2 = lan865x_read_indirect_reg(dev, 0x08, 0x1F); if ((value2 & 0x10) != 0) { /* Convert uint8_t to int8_t */ - offset2 = value2 | 0xE0; + offset2 = (int8_t)((uint8_t)value2 - 0x20); } else { - offset2 = value2; - } - - oa_tc6_reg_read(ctx->tc6, 0x00040084, &val); - value3 = (uint16_t)val; - - oa_tc6_reg_read(ctx->tc6, 0x0004008A, &val); - value4 = (uint16_t)val; - - oa_tc6_reg_read(ctx->tc6, 0x000400AD, &val); - value5 = (uint16_t)val; - - oa_tc6_reg_read(ctx->tc6, 0x000400AE, &val); - value6 = (uint8_t)val; - - oa_tc6_reg_read(ctx->tc6, 0x000400AF, &val); - value7 = (uint8_t)val; + offset2 = (int8_t)value2; + } + + cfgparam1 = (uint16_t) (((9 + offset1) & 0x3F) << 10) | + (uint16_t) (((14 + offset1) & 0x3F) << 4) | 0x03; + cfgparam2 = (uint16_t) (((40 + offset2) & 0x3F) << 10); + cfgparam3 = (uint16_t) (((5 + offset1) & 0x3F) << 8) | + (uint16_t) ((9 + offset1) & 0x3F); + cfgparam4 = (uint16_t) (((9 + offset1) & 0x3F) << 8) | + (uint16_t) ((14 + offset1) & 0x3F); + cfgparam5 = (uint16_t) (((17 + offset1) & 0x3F) << 8) | + (uint16_t) ((22 + offset1) & 0x3F); + + lan865x_update_dev_cfg_array(lan865x_conf, size, + MMS_REG(0x4, 0x84), cfgparam1); + lan865x_update_dev_cfg_array(lan865x_conf, size, + MMS_REG(0x4, 0x8A), cfgparam2); + lan865x_update_dev_cfg_array(lan865x_conf, size, + MMS_REG(0x4, 0xAD), cfgparam3); + lan865x_update_dev_cfg_array(lan865x_conf, size, + MMS_REG(0x4, 0xAE), cfgparam4); + lan865x_update_dev_cfg_array(lan865x_conf, size, + MMS_REG(0x4, 0xAF), cfgparam5); - cfgparam1 = (value3 & 0xF) | (((9 + offset1) << 10) | ((14 + offset1) << 4)); - cfgparam2 = (value4 & 0x3FF) | ((40 + offset2) << 10); - cfgparam3 = (value5 & 0xC0C0) | (((5 + offset1) << 8) | (9 + offset1)); - cfgparam4 = (value6 & 0xC0C0) | (((9 + offset1) << 8) | (14 + offset1)); - cfgparam5 = (value7 & 0xC0C0) | (((17 + offset1) << 8) | (22 + offset1)); + if (silicon_rev == 1) { + /* For silicon rev 1 (B0): (bit [3..0] from 0x0A0084 */ + lan865x_update_dev_cfg_array(lan865x_conf, size, + MMS_REG(0x4, 0xD0), 0x5F21); + } - oa_tc6_reg_write(ctx->tc6, 0x00040084, (uint32_t) cfgparam1); - oa_tc6_reg_write(ctx->tc6, 0x0004008A, (uint32_t) cfgparam2); - oa_tc6_reg_write(ctx->tc6, 0x000400AD, (uint32_t) cfgparam3); - oa_tc6_reg_write(ctx->tc6, 0x000400AE, (uint32_t) cfgparam4); - oa_tc6_reg_write(ctx->tc6, 0x000400AF, (uint32_t) cfgparam5); + /* Write LAN865x config with correct order */ + for (i = 0; i < size; i++) { + oa_tc6_reg_write(ctx->tc6, MMS_REG(lan865x_conf[i].mms, + lan865x_conf[i].address), + (uint32_t)lan865x_conf[i].value); + } return 0; } @@ -312,58 +356,9 @@ static int lan865x_set_specific_multicast_addr(const struct device *dev) static int lan865x_default_config(const struct device *dev, uint8_t silicon_rev) { - /* Values in the below table are the same for LAN865x rev. B0 and B1 */ - static const oa_mem_map_t lan865x_conf[] = { - { .address = 0x00010000, .value = 0x00000000 }, - { .address = 0x00040091, .value = 0x00009660 }, - { .address = 0x00040081, .value = 0x00000080 }, - { .address = 0x00010077, .value = 0x00000028 }, - { .address = 0x00040043, .value = 0x000000FF }, - { .address = 0x00040044, .value = 0x0000FFFF }, - { .address = 0x00040045, .value = 0x00000000 }, - { .address = 0x00040053, .value = 0x000000FF }, - { .address = 0x00040054, .value = 0x0000FFFF }, - { .address = 0x00040055, .value = 0x00000000 }, - { .address = 0x00040040, .value = 0x00000002 }, - { .address = 0x00040050, .value = 0x00000002 }, - { .address = 0x000400E9, .value = 0x00009E50 }, - { .address = 0x000400F5, .value = 0x00001CF8 }, - { .address = 0x000400F4, .value = 0x0000C020 }, - { .address = 0x000400F8, .value = 0x00009B00 }, - { .address = 0x000400F9, .value = 0x00004E53 }, - { .address = 0x000400B0, .value = 0x00000103 }, - { .address = 0x000400B1, .value = 0x00000910 }, - { .address = 0x000400B2, .value = 0x00001D26 }, - { .address = 0x000400B3, .value = 0x0000002A }, - { .address = 0x000400B4, .value = 0x00000103 }, - { .address = 0x000400B5, .value = 0x0000070D }, - { .address = 0x000400B6, .value = 0x00001720 }, - { .address = 0x000400B7, .value = 0x00000027 }, - { .address = 0x000400B8, .value = 0x00000509 }, - { .address = 0x000400B9, .value = 0x00000E13 }, - { .address = 0x000400BA, .value = 0x00001C25 }, - { .address = 0x000400BB, .value = 0x0000002B }, - { .address = 0x0000000C, .value = 0x00000100 }, - { .address = 0x00040081, .value = 0x000000E0 }, - }; const struct lan865x_config *cfg = dev->config; - uint8_t i, size = ARRAY_SIZE(lan865x_conf); - struct lan865x_data *ctx = dev->data; int ret; - /* Enable protected control RW */ - oa_tc6_set_protected_ctrl(ctx->tc6, true); - - for (i = 0; i < size; i++) { - oa_tc6_reg_write(ctx->tc6, lan865x_conf[i].address, - lan865x_conf[i].value); - } - - if (silicon_rev == 1) { - /* For silicon rev 1 (B0): (bit [3..0] from 0x0A0084 */ - oa_tc6_reg_write(ctx->tc6, 0x000400D0, 0x5F21); - } - lan865x_write_macaddress(dev); lan865x_set_specific_multicast_addr(dev); diff --git a/drivers/ethernet/eth_lan865x_priv.h b/drivers/ethernet/eth_lan865x_priv.h index 1de2c6c7ca133..1ba84bd9ff728 100644 --- a/drivers/ethernet/eth_lan865x_priv.h +++ b/drivers/ethernet/eth_lan865x_priv.h @@ -81,4 +81,14 @@ struct lan865x_data { k_tid_t tid_int; }; +static inline void lan865x_update_dev_cfg_array(oa_mem_map_t *cfg, uint8_t size, + uint32_t addr, uint16_t val) +{ + for (uint8_t i = 0; i < size; i++) { + if (cfg[i].address == addr) { + cfg[i].value = val; + } + } +} + #endif /* ETH_LAN865X_PRIV_H__ */ diff --git a/drivers/ethernet/oa_tc6.h b/drivers/ethernet/oa_tc6.h index 0918e1382fa06..c61e0359d99b3 100644 --- a/drivers/ethernet/oa_tc6.h +++ b/drivers/ethernet/oa_tc6.h @@ -113,8 +113,9 @@ struct oa_tc6 { }; typedef struct { - uint32_t address; - uint32_t value; + uint8_t mms; + uint8_t address; + uint16_t value; } oa_mem_map_t; /** From 835cbad6cce90c86cbe3c99c609e0d073230c6a3 Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Wed, 30 Oct 2024 16:55:55 +0100 Subject: [PATCH 2630/4482] drivers: ethernet: lan865x: Avoid writing PLCA node count when nodeID not 0 The newest AN1760 application note - Revision F (DS60001760G - June 2024) is recommending to not write the node count to PLCA_CTRL1 register when the node is not the PLCA coordinator (i.e. its ID is not zero). Signed-off-by: Lukasz Majewski --- drivers/ethernet/eth_lan865x.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/ethernet/eth_lan865x.c b/drivers/ethernet/eth_lan865x.c index a9a3673ed9903..0ced9732928af 100644 --- a/drivers/ethernet/eth_lan865x.c +++ b/drivers/ethernet/eth_lan865x.c @@ -296,8 +296,12 @@ static int lan865x_config_plca(const struct device *dev, uint8_t node_id, /* Collision Detection */ oa_tc6_reg_write(ctx->tc6, 0x00040087, 0x0083u); /* COL_DET_CTRL0 */ - /* T1S Phy Node Id and Max Node Count */ - val = ((uint32_t)node_cnt << 8) | node_id; + /* T1S Phy Node ID and Max Node Count */ + if (node_id == 0) { + val = (uint32_t)node_cnt << 8; + } else { + val = (uint32_t)node_id; + } oa_tc6_reg_write(ctx->tc6, 0x0004CA02, val); /* PLCA_CONTROL_1_REGISTER */ /* PLCA Burst Count and Burst Timer */ From ec02b815a7e54fc05f73e3185d33bd16d2ce14fc Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 30 Oct 2024 13:20:34 +0200 Subject: [PATCH 2631/4482] LLEXT: (cosmetic) reduce the scope of a variable Move a variable calculation inside the block, where it is actually used. Signed-off-by: Guennadi Liakhovetski --- subsys/llext/llext_load.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/subsys/llext/llext_load.c b/subsys/llext/llext_load.c index 643f9b18461d7..3e8d7f9767782 100644 --- a/subsys/llext/llext_load.c +++ b/subsys/llext/llext_load.c @@ -587,28 +587,29 @@ static int llext_copy_symbols(struct llext_loader *ldr, struct llext *ext, elf_shdr_t *shdr = ldr->sect_hdrs + shndx; uintptr_t section_addr = shdr->sh_addr; - const void *base; - - base = llext_loaded_sect_ptr(ldr, ext, shndx); - if (!base) { - /* If the section is not mapped, try to peek. - * Be noisy about it, since this is addressing - * data that was missed by llext_map_sections. - */ - base = llext_peek(ldr, shdr->sh_offset); - if (base) { - LOG_DBG("section %d peeked at %p", shndx, base); - } else { - LOG_ERR("No data for section %d", shndx); - return -ENOTSUP; - } - } if (ldr_parm->pre_located && (!ldr_parm->section_detached || !ldr_parm->section_detached(shdr))) { sym_tab->syms[j].addr = (uint8_t *)sym.st_value + (ldr->hdr.e_type == ET_REL ? section_addr : 0); } else { + const void *base; + + base = llext_loaded_sect_ptr(ldr, ext, shndx); + if (!base) { + /* If the section is not mapped, try to peek. + * Be noisy about it, since this is addressing + * data that was missed by llext_map_sections. + */ + base = llext_peek(ldr, shdr->sh_offset); + if (base) { + LOG_DBG("section %d peeked at %p", shndx, base); + } else { + LOG_ERR("No data for section %d", shndx); + return -ENOTSUP; + } + } + sym_tab->syms[j].addr = (uint8_t *)base + sym.st_value - (ldr->hdr.e_type == ET_REL ? 0 : section_addr); } From ce32eea24a3f7c88c1cb837f6e7da4bd0b530db9 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 30 Oct 2024 13:22:51 +0200 Subject: [PATCH 2632/4482] LLEXT: Xtensa: fix logging level Use the same logging level as in the rest of LLEXT. Signed-off-by: Guennadi Liakhovetski --- arch/xtensa/core/elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/xtensa/core/elf.c b/arch/xtensa/core/elf.c index cd021b950406b..653cfc499aff8 100644 --- a/arch/xtensa/core/elf.c +++ b/arch/xtensa/core/elf.c @@ -10,7 +10,7 @@ #include #include -LOG_MODULE_DECLARE(llext); +LOG_MODULE_DECLARE(llext, CONFIG_LLEXT_LOG_LEVEL); #define R_XTENSA_NONE 0 #define R_XTENSA_32 1 From 2b3666109ed1842b1478b4cfb80e5c4b4d32e454 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 30 Oct 2024 13:25:53 +0200 Subject: [PATCH 2633/4482] LLEXT: fix detached section cache synchronisation Detached sections are used in situ without being copied to or referenced from ext->mem[] LLEXT region arrays. Their caches must be synchronised accordingly. Signed-off-by: Guennadi Liakhovetski --- subsys/llext/llext_link.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/subsys/llext/llext_link.c b/subsys/llext/llext_link.c index 0049360c4954f..7bac8f4c304e9 100644 --- a/subsys/llext/llext_link.c +++ b/subsys/llext/llext_link.c @@ -465,6 +465,20 @@ int llext_link(struct llext_loader *ldr, struct llext *ext, const struct llext_l sys_cache_instr_invd_range(ext->mem[i], ext->mem_size[i]); } } + + /* Detached section caches should be synchronized in place */ + if (ldr_parm->section_detached) { + for (i = 0; i < ldr->sect_cnt; ++i) { + elf_shdr_t *shdr = ldr->sect_hdrs + i; + + if (ldr_parm->section_detached(shdr)) { + void *base = llext_peek(ldr, shdr->sh_offset); + + sys_cache_data_flush_range(base, shdr->sh_size); + sys_cache_instr_invd_range(base, shdr->sh_size); + } + } + } #endif return 0; From 4f0cb90c59f9a7da47b1b0579bbed2daf33e551a Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 30 Oct 2024 13:45:20 +0200 Subject: [PATCH 2634/4482] LLEXT: fix advanced uses of detached sections When detached sections are used, STB_GLOBAL relocations also have to be processed depending on the relocation type. This commit unified STB_GLOBAL and STB_LOCAL flows by making them use the same relocation type parser, adds support for R_XTENSA_GLOB_DAT and R_XTENSA_JMP_SLOT type relocations on Xtensa and fixes STT_SECTION address calculation for such sections. Signed-off-by: Guennadi Liakhovetski --- arch/xtensa/core/elf.c | 139 +++++++++++++++++++++++++---------- include/zephyr/llext/llext.h | 23 +++++- subsys/llext/llext_link.c | 19 ++++- 3 files changed, 137 insertions(+), 44 deletions(-) diff --git a/arch/xtensa/core/elf.c b/arch/xtensa/core/elf.c index 653cfc499aff8..0ce9885eed66c 100644 --- a/arch/xtensa/core/elf.c +++ b/arch/xtensa/core/elf.c @@ -12,6 +12,16 @@ LOG_MODULE_DECLARE(llext, CONFIG_LLEXT_LOG_LEVEL); +/* + * ELF relocation tables on Xtensa contain relocations of different types. They + * specify how the relocation should be performed. Which relocations are used + * depends on the type of the ELF object (e.g. shared or partially linked + * object), structure of the object (single or multiple source files), compiler + * flags used (e.g. -fPIC), etc. Also not all relocation table entries should be + * acted upon. Some of them describe relocations that have already been + * resolved by the linker. We have to distinguish them from actionable + * relocations and only need to handle the latter ones. + */ #define R_XTENSA_NONE 0 #define R_XTENSA_32 1 #define R_XTENSA_RTLD 2 @@ -19,71 +29,126 @@ LOG_MODULE_DECLARE(llext, CONFIG_LLEXT_LOG_LEVEL); #define R_XTENSA_JMP_SLOT 4 #define R_XTENSA_RELATIVE 5 #define R_XTENSA_PLT 6 +#define R_XTENSA_ASM_EXPAND 11 #define R_XTENSA_SLOT0_OP 20 -/** - * @brief Architecture specific function for relocating shared elf - * - * Elf files contain a series of relocations described in multiple sections. - * These relocation instructions are architecture specific and each architecture - * supporting modules must implement this. - */ -void arch_elf_relocate_local(struct llext_loader *ldr, struct llext *ext, - const elf_rela_t *rel, const elf_sym_t *sym, size_t got_offset) +static void xtensa_elf_relocate(struct llext_loader *ldr, struct llext *ext, + const elf_rela_t *rel, uint8_t *text, uintptr_t addr, + uint8_t *loc, int type, uint32_t stb) { - uint8_t *text = ext->mem[LLEXT_MEM_TEXT]; - int type = ELF32_R_TYPE(rel->r_info); - elf_word *got_entry = (elf_word *)(text + got_offset); - uintptr_t sh_addr; - - if (ELF_ST_TYPE(sym->st_info) == STT_SECTION) { - elf_shdr_t *shdr = llext_peek(ldr, ldr->hdr.e_shoff + - sym->st_shndx * ldr->hdr.e_shentsize); - sh_addr = shdr->sh_addr ? : (uintptr_t)llext_peek(ldr, shdr->sh_offset); - } else { - sh_addr = ldr->sects[LLEXT_MEM_TEXT].sh_addr; - } + elf_word *got_entry = (elf_word *)loc; switch (type) { case R_XTENSA_RELATIVE: - /* Relocate a local symbol: Xtensa specific */ - *got_entry += (uintptr_t)text - sh_addr; + /* Relocate a local symbol: Xtensa specific. Seems to only be used with PIC */ + *got_entry += (uintptr_t)text - addr; + break; + case R_XTENSA_GLOB_DAT: + case R_XTENSA_JMP_SLOT: + if (stb == STB_GLOBAL) { + *got_entry = addr; + } break; case R_XTENSA_32: - *got_entry += sh_addr; + /* Used for both LOCAL and GLOBAL bindings */ + *got_entry += addr; break; case R_XTENSA_SLOT0_OP: + /* Apparently only actionable with LOCAL bindings */ ; - uint8_t *opc = (uint8_t *)got_entry; - - /* Check the opcode: is this an L32R? And does it have to be relocated? */ - if ((opc[0] & 0xf) != 1 || opc[1] || opc[2]) - break; - elf_sym_t rsym; - int ret = llext_seek(ldr, ldr->sects[LLEXT_MEM_SYMTAB].sh_offset + ELF_R_SYM(rel->r_info) * sizeof(elf_sym_t)); + if (!ret) { ret = llext_read(ldr, &rsym, sizeof(elf_sym_t)); } - if (ret) + if (ret) { + LOG_ERR("Failed to read a symbol table entry, LLEXT linking might fail."); return; + } + /* + * So far in all observed use-cases + * llext_loaded_sect_ptr(ldr, ext, rsym.st_shndx) was already + * available as the "addr" argument of this function, supplied + * by arch_elf_relocate_local() from its non-STT_SECTION branch. + */ uintptr_t link_addr = (uintptr_t)llext_loaded_sect_ptr(ldr, ext, rsym.st_shndx) + rsym.st_value + rel->r_addend; - ssize_t value = (link_addr - (((uintptr_t)got_entry + 3) & ~3)) >> 2; - opc[1] = value & 0xff; - opc[2] = (value >> 8) & 0xff; + /* Check the opcode */ + if ((loc[0] & 0xf) == 1 && !loc[1] && !loc[2]) { + /* L32R: low nibble is 1 */ + loc[1] = value & 0xff; + loc[2] = (value >> 8) & 0xff; + } else if ((loc[0] & 0xf) == 5 && !(loc[0] & 0xc0) && !loc[1] && !loc[2]) { + /* CALLn: low nibble is 5 */ + loc[0] = (loc[0] & 0x3f) | ((value << 6) & 0xc0); + loc[1] = (value >> 2) & 0xff; + loc[2] = (value >> 10) & 0xff; + } else { + LOG_DBG("%p: unhandled OPC or no relocation %02x%02x%02x inf %#x offs %#x", + (void *)loc, loc[2], loc[1], loc[0], + rel->r_info, rel->r_offset); + break; + } + break; + case R_XTENSA_ASM_EXPAND: + /* Nothing to do */ break; default: - LOG_DBG("unsupported relocation type %u", type); + LOG_DBG("Unsupported relocation type %u", type); return; } - LOG_DBG("relocation to %#x type %u at %p", *got_entry, type, (void *)got_entry); + LOG_DBG("Applied relocation to %#x type %u at %p", + *(uint32_t *)((uintptr_t)got_entry & ~3), type, (void *)got_entry); +} + +/** + * @brief Architecture specific function for STB_LOCAL ELF relocations + */ +void arch_elf_relocate_local(struct llext_loader *ldr, struct llext *ext, const elf_rela_t *rel, + const elf_sym_t *sym, size_t got_offset, + const struct llext_load_param *ldr_parm) +{ + uint8_t *text = ext->mem[LLEXT_MEM_TEXT]; + uint8_t *loc = text + got_offset; + int type = ELF32_R_TYPE(rel->r_info); + uintptr_t sh_addr; + + if (ELF_ST_TYPE(sym->st_info) == STT_SECTION) { + elf_shdr_t *shdr = llext_peek(ldr, ldr->hdr.e_shoff + + sym->st_shndx * ldr->hdr.e_shentsize); + sh_addr = shdr->sh_addr && + (!ldr_parm->section_detached || !ldr_parm->section_detached(shdr)) ? + shdr->sh_addr : (uintptr_t)llext_peek(ldr, shdr->sh_offset); + } else { + sh_addr = ldr->sects[LLEXT_MEM_TEXT].sh_addr; + } + + xtensa_elf_relocate(ldr, ext, rel, text, sh_addr, loc, type, ELF_ST_BIND(sym->st_info)); +} + +/** + * @brief Architecture specific function for STB_GLOBAL ELF relocations + */ +void arch_elf_relocate_global(struct llext_loader *ldr, struct llext *ext, const elf_rela_t *rel, + const elf_sym_t *sym, size_t got_offset, const void *link_addr) +{ + uint8_t *text = ext->mem[LLEXT_MEM_TEXT]; + elf_word *got_entry = (elf_word *)(text + got_offset); + int type = ELF32_R_TYPE(rel->r_info); + + /* For global relocations we expect the initial value for R_XTENSA_RELATIVE to be zero */ + if (type == R_XTENSA_RELATIVE && *got_entry) { + LOG_WRN("global: non-zero relative value %#x", *got_entry); + } + + xtensa_elf_relocate(ldr, ext, rel, text, (uintptr_t)link_addr, (uint8_t *)got_entry, type, + ELF_ST_BIND(sym->st_info)); } diff --git a/include/zephyr/llext/llext.h b/include/zephyr/llext/llext.h index 0ad1e591fb703..181df1630852d 100644 --- a/include/zephyr/llext/llext.h +++ b/include/zephyr/llext/llext.h @@ -339,16 +339,31 @@ int arch_elf_relocate(elf_rela_t *rel, uintptr_t loc, ssize_t llext_find_section(struct llext_loader *loader, const char *search_name); /** - * @brief Architecture specific function for updating addresses via relocation table + * @brief Architecture specific function for local binding relocations * * @param[in] loader Extension loader data and context * @param[in] ext Extension to call function in * @param[in] rel Relocation data provided by elf * @param[in] sym Corresponding symbol table entry - * @param[in] got_offset Offset within a relocation table + * @param[in] got_offset Offset within a relocation table or in the code + * @param[in] ldr_parm Loader parameters */ -void arch_elf_relocate_local(struct llext_loader *loader, struct llext *ext, - const elf_rela_t *rel, const elf_sym_t *sym, size_t got_offset); +void arch_elf_relocate_local(struct llext_loader *loader, struct llext *ext, const elf_rela_t *rel, + const elf_sym_t *sym, size_t got_offset, + const struct llext_load_param *ldr_parm); + +/** + * @brief Architecture specific function for global binding relocations + * + * @param[in] loader Extension loader data and context + * @param[in] ext Extension to call function in + * @param[in] rel Relocation data provided by elf + * @param[in] sym Corresponding symbol table entry + * @param[in] got_offset Offset within a relocation table or in the code + * @param[in] link_addr target address for table-based relocations + */ +void arch_elf_relocate_global(struct llext_loader *loader, struct llext *ext, const elf_rela_t *rel, + const elf_sym_t *sym, size_t got_offset, const void *link_addr); /** * @} diff --git a/subsys/llext/llext_link.c b/subsys/llext/llext_link.c index 7bac8f4c304e9..f3eae9f7f761b 100644 --- a/subsys/llext/llext_link.c +++ b/subsys/llext/llext_link.c @@ -33,7 +33,14 @@ __weak int arch_elf_relocate(elf_rela_t *rel, uintptr_t loc, } __weak void arch_elf_relocate_local(struct llext_loader *ldr, struct llext *ext, - const elf_rela_t *rel, const elf_sym_t *sym, size_t got_offset) + const elf_rela_t *rel, const elf_sym_t *sym, size_t got_offset, + const struct llext_load_param *ldr_parm) +{ +} + +__weak void arch_elf_relocate_global(struct llext_loader *ldr, struct llext *ext, + const elf_rela_t *rel, const elf_sym_t *sym, size_t got_offset, + const void *link_addr) { } @@ -249,11 +256,12 @@ static void llext_link_plt(struct llext_loader *ldr, struct llext *ext, elf_shdr } /* Resolve the symbol */ - *(const void **)(text + got_offset) = link_addr; + arch_elf_relocate_global(ldr, ext, &rela, &sym, got_offset, link_addr); break; case STB_LOCAL: if (ldr_parm->relocate_local) { - arch_elf_relocate_local(ldr, ext, &rela, &sym, got_offset); + arch_elf_relocate_local(ldr, ext, &rela, &sym, got_offset, + ldr_parm); } } @@ -327,6 +335,11 @@ int llext_link(struct llext_loader *ldr, struct llext *ext, const struct llext_l strcmp(name, ".rela.dyn") == 0) { tgt = NULL; } else { + /* + * Entries in .rel.X and .rela.X sections describe references in + * section .X to local or global symbols. They point to entries + * in the symbol table, describing respective symbols + */ tgt = ldr->sect_hdrs + shdr->sh_info; } From e2d8daae1616f1dd84adb625098a9796b448f471 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 30 Oct 2024 14:49:16 +0200 Subject: [PATCH 2635/4482] LLEXT: Xtensa: add a Kconfig option to enable -fPIC Currently when building LLEXT for Xtensa we use the -fPIC compiler option, but this cannot be used when using detached sections in extensions. Add a Kconfig option to switch between the two compilation modes and switch -fPIC off when building relocatable (partially linked) ELF binaries. Signed-off-by: Guennadi Liakhovetski --- cmake/compiler/gcc/target_xtensa.cmake | 17 ++++++++++++++--- cmake/compiler/xt-clang/target.cmake | 17 ++++++++++++++--- subsys/llext/Kconfig | 10 ++++++++++ 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/cmake/compiler/gcc/target_xtensa.cmake b/cmake/compiler/gcc/target_xtensa.cmake index 5321204c2df5e..0b398023f67bd 100644 --- a/cmake/compiler/gcc/target_xtensa.cmake +++ b/cmake/compiler/gcc/target_xtensa.cmake @@ -3,8 +3,6 @@ # Flags not supported by llext linker # (regexps are supported and match whole word) set(LLEXT_REMOVE_FLAGS - -fno-pic - -fno-pie -ffunction-sections -fdata-sections -g.* @@ -14,7 +12,20 @@ set(LLEXT_REMOVE_FLAGS # Flags to be added to llext code compilation set(LLEXT_APPEND_FLAGS - -fPIC -nostdlib -nodefaultlibs ) + +if(CONFIG_LLEXT_BUILD_PIC) +set(LLEXT_REMOVE_FLAGS ${LLEXT_REMOVE_FLAGS} + -fno-pic + -fno-pie +) +set(LLEXT_APPEND_FLAGS ${LLEXT_APPEND_FLAGS} + -fPIC +) +else() +set(LLEXT_APPEND_FLAGS ${LLEXT_APPEND_FLAGS} + -ffreestanding +) +endif() diff --git a/cmake/compiler/xt-clang/target.cmake b/cmake/compiler/xt-clang/target.cmake index 41a72aa782e90..32def2e5b8fe6 100644 --- a/cmake/compiler/xt-clang/target.cmake +++ b/cmake/compiler/xt-clang/target.cmake @@ -5,8 +5,6 @@ include(${ZEPHYR_BASE}/cmake/compiler/xcc/target.cmake) # Flags not supported by llext linker # (regexps are supported and match whole word) set(LLEXT_REMOVE_FLAGS - -fno-pic - -fno-pie -ffunction-sections -fdata-sections -g.* @@ -16,7 +14,20 @@ set(LLEXT_REMOVE_FLAGS # Flags to be added to llext code compilation set(LLEXT_APPEND_FLAGS - -fPIC -nostdlib -nodefaultlibs ) + +if(CONFIG_LLEXT_BUILD_PIC) +set(LLEXT_REMOVE_FLAGS ${LLEXT_REMOVE_FLAGS} + -fno-pic + -fno-pie +) +set(LLEXT_APPEND_FLAGS ${LLEXT_APPEND_FLAGS} + -fPIC +) +else() +set(LLEXT_APPEND_FLAGS ${LLEXT_APPEND_FLAGS} + -ffreestanding +) +endif() diff --git a/subsys/llext/Kconfig b/subsys/llext/Kconfig index 696620b16d888..55800dcd0cf10 100644 --- a/subsys/llext/Kconfig +++ b/subsys/llext/Kconfig @@ -49,6 +49,16 @@ config LLEXT_HEAP_SIZE help Heap size in kilobytes available to llext for dynamic allocation +config LLEXT_BUILD_PIC + bool "Use -fPIC when building LLEXT" + depends on XTENSA + default y if LLEXT_TYPE_ELF_SHAREDLIB + help + By default LLEXT compilation is performed with -fno-pic -fno-pie compiler + flags. Some platforms can benefit from using -fPIC instead, in which case + most internal linking is performed by the linker at build time. Select "y" + to make use of that advantage. + config LLEXT_SHELL bool "llext shell commands" depends on SHELL From c714f0e1482ece7a293d3c0fa65e14f9ed07040e Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 30 Oct 2024 14:59:19 +0200 Subject: [PATCH 2636/4482] LLEXT: preserve section headers Move cached section headers to struct llext from struct llext_loader to preserve them after llext_load() returns. Signed-off-by: Guennadi Liakhovetski --- include/zephyr/llext/llext.h | 16 +++++++++++++ include/zephyr/llext/loader.h | 3 --- subsys/llext/llext.c | 8 +++---- subsys/llext/llext_link.c | 12 +++++----- subsys/llext/llext_load.c | 45 ++++++++++++++++------------------- 5 files changed, 46 insertions(+), 38 deletions(-) diff --git a/include/zephyr/llext/llext.h b/include/zephyr/llext/llext.h index 181df1630852d..1e026178327f4 100644 --- a/include/zephyr/llext/llext.h +++ b/include/zephyr/llext/llext.h @@ -120,8 +120,24 @@ struct llext { /** Array of extensions, whose symbols this extension accesses */ struct llext *dependency[LLEXT_MAX_DEPENDENCIES]; + + /** @cond ignore */ + unsigned int sect_cnt; + elf_shdr_t *sect_hdrs; + bool sect_hdrs_on_heap; + /** @endcond */ }; +static inline const elf_shdr_t *llext_section_headers(const struct llext *ext) +{ + return ext->sect_hdrs; +} + +static inline unsigned int llext_section_count(const struct llext *ext) +{ + return ext->sect_cnt; +} + /** * @brief Advanced llext_load parameters * diff --git a/include/zephyr/llext/loader.h b/include/zephyr/llext/loader.h index 6684d98a747bf..3d043806ef737 100644 --- a/include/zephyr/llext/loader.h +++ b/include/zephyr/llext/loader.h @@ -98,10 +98,7 @@ struct llext_loader { /** @cond ignore */ elf_ehdr_t hdr; elf_shdr_t sects[LLEXT_MEM_COUNT]; - elf_shdr_t *sect_hdrs; - bool sect_hdrs_on_heap; struct llext_elf_sect_map *sect_map; - uint32_t sect_cnt; /** @endcond */ }; diff --git a/subsys/llext/llext.c b/subsys/llext/llext.c index 4e0ff98c13af3..ba1bb0325de7a 100644 --- a/subsys/llext/llext.c +++ b/subsys/llext/llext.c @@ -25,10 +25,6 @@ static struct k_mutex llext_lock = Z_MUTEX_INITIALIZER(llext_lock); ssize_t llext_find_section(struct llext_loader *ldr, const char *search_name) { - /* Note that this API is used after llext_load(), so the ldr->sect_hdrs - * cache is already freed. A direct search covers all situations. - */ - elf_shdr_t *shdr; unsigned int i; size_t pos; @@ -253,6 +249,10 @@ int llext_unload(struct llext **ext) *ext = NULL; k_mutex_unlock(&llext_lock); + if (tmp->sect_hdrs_on_heap) { + llext_free(tmp->sect_hdrs); + } + llext_free_regions(tmp); llext_free(tmp->sym_tab.syms); llext_free(tmp->exp_tab.syms); diff --git a/subsys/llext/llext_link.c b/subsys/llext/llext_link.c index f3eae9f7f761b..6d5e2ff23bc75 100644 --- a/subsys/llext/llext_link.c +++ b/subsys/llext/llext_link.c @@ -280,8 +280,8 @@ int llext_link(struct llext_loader *ldr, struct llext *ext, const struct llext_l const char *name; int i, ret; - for (i = 0; i < ldr->sect_cnt; ++i) { - elf_shdr_t *shdr = ldr->sect_hdrs + i; + for (i = 0; i < ext->sect_cnt; ++i) { + elf_shdr_t *shdr = ext->sect_hdrs + i; /* find proper relocation sections */ switch (shdr->sh_type) { @@ -308,7 +308,7 @@ int llext_link(struct llext_loader *ldr, struct llext *ext, const struct llext_l continue; } - if (shdr->sh_info >= ldr->sect_cnt || + if (shdr->sh_info >= ext->sect_cnt || shdr->sh_size % shdr->sh_entsize != 0) { LOG_ERR("Sanity checks failed for section %d " "(info %zd, size %zd, entsize %zd)", i, @@ -340,7 +340,7 @@ int llext_link(struct llext_loader *ldr, struct llext *ext, const struct llext_l * section .X to local or global symbols. They point to entries * in the symbol table, describing respective symbols */ - tgt = ldr->sect_hdrs + shdr->sh_info; + tgt = ext->sect_hdrs + shdr->sh_info; } llext_link_plt(ldr, ext, shdr, ldr_parm, tgt); @@ -481,8 +481,8 @@ int llext_link(struct llext_loader *ldr, struct llext *ext, const struct llext_l /* Detached section caches should be synchronized in place */ if (ldr_parm->section_detached) { - for (i = 0; i < ldr->sect_cnt; ++i) { - elf_shdr_t *shdr = ldr->sect_hdrs + i; + for (i = 0; i < ext->sect_cnt; ++i) { + elf_shdr_t *shdr = ext->sect_hdrs + i; if (ldr_parm->section_detached(shdr)) { void *base = llext_peek(ldr, shdr->sh_offset); diff --git a/subsys/llext/llext_load.c b/subsys/llext/llext_load.c index 3e8d7f9767782..bd73312c085e2 100644 --- a/subsys/llext/llext_load.c +++ b/subsys/llext/llext_load.c @@ -103,29 +103,29 @@ static int llext_load_elf_data(struct llext_loader *ldr, struct llext *ext) return -ENOEXEC; } - ldr->sect_cnt = ldr->hdr.e_shnum; + ext->sect_cnt = ldr->hdr.e_shnum; - size_t sect_map_sz = ldr->sect_cnt * sizeof(ldr->sect_map[0]); + size_t sect_map_sz = ext->sect_cnt * sizeof(ldr->sect_map[0]); ldr->sect_map = llext_alloc(sect_map_sz); if (!ldr->sect_map) { LOG_ERR("Failed to allocate section map, size %zu", sect_map_sz); return -ENOMEM; } - for (int i = 0; i < ldr->sect_cnt; i++) { + for (int i = 0; i < ext->sect_cnt; i++) { ldr->sect_map[i].mem_idx = LLEXT_MEM_COUNT; ldr->sect_map[i].offset = 0; } - ldr->sect_hdrs = (elf_shdr_t *) llext_peek(ldr, ldr->hdr.e_shoff); - if (ldr->sect_hdrs) { - ldr->sect_hdrs_on_heap = false; + ext->sect_hdrs = (elf_shdr_t *)llext_peek(ldr, ldr->hdr.e_shoff); + if (ext->sect_hdrs) { + ext->sect_hdrs_on_heap = false; } else { - size_t sect_hdrs_sz = ldr->sect_cnt * sizeof(ldr->sect_hdrs[0]); + size_t sect_hdrs_sz = ext->sect_cnt * sizeof(ext->sect_hdrs[0]); - ldr->sect_hdrs_on_heap = true; - ldr->sect_hdrs = llext_alloc(sect_hdrs_sz); - if (!ldr->sect_hdrs) { + ext->sect_hdrs_on_heap = true; + ext->sect_hdrs = llext_alloc(sect_hdrs_sz); + if (!ext->sect_hdrs) { LOG_ERR("Failed to allocate section headers, size %zu", sect_hdrs_sz); return -ENOMEM; } @@ -136,7 +136,7 @@ static int llext_load_elf_data(struct llext_loader *ldr, struct llext *ext) return ret; } - ret = llext_read(ldr, ldr->sect_hdrs, sect_hdrs_sz); + ret = llext_read(ldr, ext->sect_hdrs, sect_hdrs_sz); if (ret != 0) { LOG_ERR("Failed to read section headers"); return ret; @@ -149,15 +149,15 @@ static int llext_load_elf_data(struct llext_loader *ldr, struct llext *ext) /* * Find all relevant string and symbol tables */ -static int llext_find_tables(struct llext_loader *ldr) +static int llext_find_tables(struct llext_loader *ldr, struct llext *ext) { int table_cnt, i; memset(ldr->sects, 0, sizeof(ldr->sects)); /* Find symbol and string tables */ - for (i = 0, table_cnt = 0; i < ldr->sect_cnt && table_cnt < 3; ++i) { - elf_shdr_t *shdr = ldr->sect_hdrs + i; + for (i = 0, table_cnt = 0; i < ext->sect_cnt && table_cnt < 3; ++i) { + elf_shdr_t *shdr = ext->sect_hdrs + i; LOG_DBG("section %d at 0x%zx: name %d, type %d, flags 0x%zx, " "addr 0x%zx, size %zd, link %d, info %d", @@ -216,8 +216,8 @@ static int llext_map_sections(struct llext_loader *ldr, struct llext *ext, int i, j; const char *name; - for (i = 0; i < ldr->sect_cnt; ++i) { - elf_shdr_t *shdr = ldr->sect_hdrs + i; + for (i = 0; i < ext->sect_cnt; ++i) { + elf_shdr_t *shdr = ext->sect_hdrs + i; name = llext_string(ldr, ext, LLEXT_MEM_SHSTRTAB, shdr->sh_name); @@ -437,8 +437,8 @@ static int llext_map_sections(struct llext_loader *ldr, struct llext *ext, * Calculate each ELF section's offset inside its memory region. This * is done as a separate pass so the final regions are already defined. */ - for (i = 0; i < ldr->sect_cnt; ++i) { - elf_shdr_t *shdr = ldr->sect_hdrs + i; + for (i = 0; i < ext->sect_cnt; ++i) { + elf_shdr_t *shdr = ext->sect_hdrs + i; enum llext_mem mem_idx = ldr->sect_map[i].mem_idx; if (mem_idx != LLEXT_MEM_COUNT) { @@ -585,7 +585,7 @@ static int llext_copy_symbols(struct llext_loader *ldr, struct llext *ext, sym_tab->syms[j].name = name; - elf_shdr_t *shdr = ldr->sect_hdrs + shndx; + elf_shdr_t *shdr = ext->sect_hdrs + shndx; uintptr_t section_addr = shdr->sh_addr; if (ldr_parm->pre_located && @@ -664,7 +664,7 @@ int do_llext_load(struct llext_loader *ldr, struct llext *ext, #endif LOG_DBG("Finding ELF tables..."); - ret = llext_find_tables(ldr); + ret = llext_find_tables(ldr, ext); if (ret != 0) { LOG_ERR("Failed to find important ELF tables, ret %d", ret); goto out; @@ -736,11 +736,6 @@ int do_llext_load(struct llext_loader *ldr, struct llext *ext, llext_free(ldr->sect_map); ldr->sect_map = NULL; - if (ldr->sect_hdrs_on_heap) { - llext_free(ldr->sect_hdrs); - } - ldr->sect_hdrs = NULL; - /* Until proper inter-llext linking is implemented, the symbol table is * not useful outside of the loading process; keep it only if debugging * is enabled and no error is detected. From 44d96a2668094daef6286e795bb2e7283e959645 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 5 Nov 2024 10:38:24 +0100 Subject: [PATCH 2637/4482] LLEXT: add llext_section_offset() to replace llext_find_section() Now that section header cache is persistent, it can be used for finding sections. Add a new function, similar to llext_find_section() to use it and deprecate llext_find_section(). Signed-off-by: Guennadi Liakhovetski --- include/zephyr/llext/llext.h | 16 ++++++++++++ subsys/llext/llext.c | 26 +++++++++++++++++++ .../llext/simple/src/test_llext_simple.c | 7 +++++ 3 files changed, 49 insertions(+) diff --git a/include/zephyr/llext/llext.h b/include/zephyr/llext/llext.h index 1e026178327f4..5bd16ea33564d 100644 --- a/include/zephyr/llext/llext.h +++ b/include/zephyr/llext/llext.h @@ -354,6 +354,22 @@ int arch_elf_relocate(elf_rela_t *rel, uintptr_t loc, */ ssize_t llext_find_section(struct llext_loader *loader, const char *search_name); +/** + * @brief Extract ELF section header by name. + * + * Searches for a section by name in the ELF file and retrieves its full header. + * + * @param[in] loader Extension loader data and context + * @param[in] ext Extension to be searched + * @param[in] search_name Section name to search for + * @param[out] shdr Buffer for the section header + * @retval 0 Success + * @retval -ENOTSUP "peek" method not supported + * @retval -ENOENT section not found + */ +int llext_get_section_header(struct llext_loader *loader, struct llext *ext, + const char *search_name, elf_shdr_t *shdr); + /** * @brief Architecture specific function for local binding relocations * diff --git a/subsys/llext/llext.c b/subsys/llext/llext.c index ba1bb0325de7a..c1871a0c6f07a 100644 --- a/subsys/llext/llext.c +++ b/subsys/llext/llext.c @@ -23,6 +23,32 @@ static sys_slist_t _llext_list = SYS_SLIST_STATIC_INIT(&_llext_list); static struct k_mutex llext_lock = Z_MUTEX_INITIALIZER(llext_lock); +int llext_get_section_header(struct llext_loader *ldr, struct llext *ext, const char *search_name, + elf_shdr_t *shdr) +{ + const elf_shdr_t *tmp; + unsigned int i; + + for (i = 0, tmp = ext->sect_hdrs; + i < ext->sect_cnt; + i++, tmp++) { + const char *name = llext_peek(ldr, + ldr->sects[LLEXT_MEM_SHSTRTAB].sh_offset + + tmp->sh_name); + + if (!name) { + return -ENOTSUP; + } + + if (!strcmp(name, search_name)) { + *shdr = *tmp; + return 0; + } + } + + return -ENOENT; +} + ssize_t llext_find_section(struct llext_loader *ldr, const char *search_name) { elf_shdr_t *shdr; diff --git a/tests/subsys/llext/simple/src/test_llext_simple.c b/tests/subsys/llext/simple/src/test_llext_simple.c index 6368a1b60ad12..025a715ddbf0f 100644 --- a/tests/subsys/llext/simple/src/test_llext_simple.c +++ b/tests/subsys/llext/simple/src/test_llext_simple.c @@ -11,6 +11,7 @@ #if defined(CONFIG_FILE_SYSTEM_LITTLEFS) #include #endif +#include #include #include #include @@ -411,6 +412,7 @@ ZTEST(llext, test_find_section) struct llext_loader *loader = &buf_loader.loader; struct llext_load_param ldr_parm = LLEXT_LOAD_PARAM_DEFAULT; struct llext *ext = NULL; + elf_shdr_t shdr; res = llext_load(loader, "find_section", &ext, &ldr_parm); zassert_ok(res, "load should succeed"); @@ -418,6 +420,11 @@ ZTEST(llext, test_find_section) section_ofs = llext_find_section(loader, ".data"); zassert_true(section_ofs > 0, "find_section returned %zd", section_ofs); + res = llext_get_section_header(loader, ext, ".data", &shdr); + zassert_ok(res, "get_section_header() should succeed"); + zassert_equal(shdr.sh_offset, section_ofs, + "different section offset %zd from get_section_header", shdr.sh_offset); + uintptr_t symbol_ptr = (uintptr_t)llext_find_sym(&ext->exp_tab, "number"); uintptr_t section_ptr = (uintptr_t)find_section_ext + section_ofs; From d2896df82133797c77fd41cfff330e17e024f940 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Wed, 30 Oct 2024 11:56:14 +0100 Subject: [PATCH 2638/4482] cmake: set minimal C++ linker properties in minimal C++ CMake impl The property based toolchain integration allows a cleaner design by letting the toolchain define its properties and values and let CMake implementation of Zephyr provided C and C++ libraries adjust those properties when minimal C or C++ libraries are used. This commit moves handling of C++ linker library properties into the minimal C++ CMake implementation. Signed-off-by: Torsten Rasmussen --- cmake/linker/ld/linker_libraries.cmake | 1 - cmake/linker/lld/linker_flags.cmake | 2 +- cmake/linker/lld/linker_libraries.cmake | 1 - cmake/linker/xt-ld/linker_flags.cmake | 2 +- lib/cpp/minimal/CMakeLists.txt | 4 ++++ 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cmake/linker/ld/linker_libraries.cmake b/cmake/linker/ld/linker_libraries.cmake index 1305d682ab5aa..489f1f3859bdc 100644 --- a/cmake/linker/ld/linker_libraries.cmake +++ b/cmake/linker/ld/linker_libraries.cmake @@ -16,7 +16,6 @@ if(NOT CONFIG_NATIVE_BUILD) endif() if(CONFIG_CPP - AND NOT CONFIG_MINIMAL_LIBCPP AND NOT CONFIG_NATIVE_LIBRARY # When new link principle is fully introduced, then the below condition can # be removed, and instead the external module c++ should use: diff --git a/cmake/linker/lld/linker_flags.cmake b/cmake/linker/lld/linker_flags.cmake index f11139aa1e234..48085df44438c 100644 --- a/cmake/linker/lld/linker_flags.cmake +++ b/cmake/linker/lld/linker_flags.cmake @@ -7,7 +7,7 @@ # and adjust for lld specifics afterwards. include(${ZEPHYR_BASE}/cmake/linker/ld/linker_flags.cmake OPTIONAL) -if(NOT CONFIG_MINIMAL_LIBCPP AND NOT CONFIG_NATIVE_LIBRARY AND NOT CONFIG_EXTERNAL_MODULE_LIBCPP) +if(NOT CONFIG_NATIVE_LIBRARY AND NOT CONFIG_EXTERNAL_MODULE_LIBCPP) set_property(TARGET linker PROPERTY cpp_base ${LINKERFLAGPREFIX},-z,norelro) endif() diff --git a/cmake/linker/lld/linker_libraries.cmake b/cmake/linker/lld/linker_libraries.cmake index 2347898ad6422..69690d2a05117 100644 --- a/cmake/linker/lld/linker_libraries.cmake +++ b/cmake/linker/lld/linker_libraries.cmake @@ -8,7 +8,6 @@ set_linker_property(NO_CREATE TARGET linker PROPERTY rt_library "") set_linker_property(TARGET linker PROPERTY c++_library "-lc++;-lc++abi") if(CONFIG_CPP - AND NOT CONFIG_MINIMAL_LIBCPP AND NOT CONFIG_NATIVE_LIBRARY # When new link principle is fully introduced, then the below condition can # be removed, and instead the external module c++ should use: diff --git a/cmake/linker/xt-ld/linker_flags.cmake b/cmake/linker/xt-ld/linker_flags.cmake index af464509b8789..ab66461e4522d 100644 --- a/cmake/linker/xt-ld/linker_flags.cmake +++ b/cmake/linker/xt-ld/linker_flags.cmake @@ -7,7 +7,7 @@ check_set_linker_property(TARGET linker PROPERTY base ${LINKERFLAGPREFIX},--build-id=none ) -if(NOT CONFIG_MINIMAL_LIBCPP AND NOT CONFIG_NATIVE_LIBRARY AND NOT CONFIG_EXTERNAL_MODULE_LIBCPP) +if(NOT CONFIG_NATIVE_LIBRARY AND NOT CONFIG_EXTERNAL_MODULE_LIBCPP) set_property(TARGET linker PROPERTY cpp_base -lstdc++) endif() diff --git a/lib/cpp/minimal/CMakeLists.txt b/lib/cpp/minimal/CMakeLists.txt index a79ca36d5e166..850087bcafabc 100644 --- a/lib/cpp/minimal/CMakeLists.txt +++ b/lib/cpp/minimal/CMakeLists.txt @@ -1,5 +1,9 @@ # SPDX-License-Identifier: Apache-2.0 +# Clear the toolchain defined C++ library property when using minimal C++ lib. +set_linker_property(PROPERTY c++_library "") +set_linker_property(PROPERTY cpp_base "") + zephyr_system_include_directories(include) zephyr_sources( From cc488787eae7add5cb5e26abdf0c921504da61a2 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Wed, 30 Oct 2024 12:26:13 +0100 Subject: [PATCH 2639/4482] cmake: source dedicated linker library properties for native builds Native builds uses system libraries per default. Instead of handling this in each linker_libraries.cmake files, then the check for native build is moved one level up and for native build a dedicated linker_libraries_native.cmake is sourced. This simplifies the linker_libraries.cmake files as they no longer need to check for native builds. Signed-off-by: Torsten Rasmussen --- cmake/linker/ld/linker_libraries.cmake | 22 +++++++++------------- cmake/linker/linker_libraries_native.cmake | 21 +++++++++++++++++++++ cmake/linker/lld/linker_libraries.cmake | 1 - cmake/target_toolchain_flags.cmake | 7 ++++++- 4 files changed, 36 insertions(+), 15 deletions(-) create mode 100644 cmake/linker/linker_libraries_native.cmake diff --git a/cmake/linker/ld/linker_libraries.cmake b/cmake/linker/ld/linker_libraries.cmake index 489f1f3859bdc..999420164aa8f 100644 --- a/cmake/linker/ld/linker_libraries.cmake +++ b/cmake/linker/ld/linker_libraries.cmake @@ -2,21 +2,17 @@ # # SPDX-License-Identifier: Apache-2.0 -# Do not specify default link libraries when targeting host (native build). -if(NOT CONFIG_NATIVE_BUILD) - set_linker_property(NO_CREATE PROPERTY c_library "-lc") - set_linker_property(NO_CREATE PROPERTY rt_library "-lgcc") - set_linker_property(NO_CREATE PROPERTY c++_library "-lstdc++") - set_linker_property(NO_CREATE PROPERTY math_library "-lm") - # Keeping default include dir empty. The linker will then select libraries - # from its default search path. The toolchain may adjust the value to a - # specific location, for example gcc infrastructure will set the value based - # on output from --print-libgcc-file-name. - set_linker_property(NO_CREATE PROPERTY lib_include_dir "") -endif() +set_linker_property(NO_CREATE PROPERTY c_library "-lc") +set_linker_property(NO_CREATE PROPERTY rt_library "-lgcc") +set_linker_property(NO_CREATE PROPERTY c++_library "-lstdc++") +set_linker_property(NO_CREATE PROPERTY math_library "-lm") +# Keeping default include dir empty. The linker will then select libraries +# from its default search path. The toolchain may adjust the value to a +# specific location, for example gcc infrastructure will set the value based +# on output from --print-libgcc-file-name. +set_linker_property(NO_CREATE PROPERTY lib_include_dir "") if(CONFIG_CPP - AND NOT CONFIG_NATIVE_LIBRARY # When new link principle is fully introduced, then the below condition can # be removed, and instead the external module c++ should use: # set_property(TARGET linker PROPERTY c++_library "") diff --git a/cmake/linker/linker_libraries_native.cmake b/cmake/linker/linker_libraries_native.cmake new file mode 100644 index 0000000000000..f3e852bc629f6 --- /dev/null +++ b/cmake/linker/linker_libraries_native.cmake @@ -0,0 +1,21 @@ +# Copyright (c) 2024 Nordic Semiconductor +# +# SPDX-License-Identifier: Apache-2.0 + +# When doing native builds, then we default to host libraries. +# No reason for loading linker libraries properties in this case, however we do +# define link order because that allows the build system to hook in alternative +# C library implementations, such as minimal libc or picolibc. + +# Empty on purpose as we default to host libraries selected by the linker. +set_linker_property(PROPERTY c_library "") +set_linker_property(PROPERTY rt_library "") +set_linker_property(PROPERTY c++_library "") + +# Although library properties are empty per default, then we still define link +# order as this allows to update libraries in use elsewhere. +if(CONFIG_CPP) + set_property(TARGET linker PROPERTY link_order_library "c++") +endif() + +set_property(TARGET linker APPEND PROPERTY link_order_library "c;rt") diff --git a/cmake/linker/lld/linker_libraries.cmake b/cmake/linker/lld/linker_libraries.cmake index 69690d2a05117..8275d779337fd 100644 --- a/cmake/linker/lld/linker_libraries.cmake +++ b/cmake/linker/lld/linker_libraries.cmake @@ -8,7 +8,6 @@ set_linker_property(NO_CREATE TARGET linker PROPERTY rt_library "") set_linker_property(TARGET linker PROPERTY c++_library "-lc++;-lc++abi") if(CONFIG_CPP - AND NOT CONFIG_NATIVE_LIBRARY # When new link principle is fully introduced, then the below condition can # be removed, and instead the external module c++ should use: # set_property(TARGET linker PROPERTY c++_library "") diff --git a/cmake/target_toolchain_flags.cmake b/cmake/target_toolchain_flags.cmake index 716cc8f55e7e9..7783b72941f46 100644 --- a/cmake/target_toolchain_flags.cmake +++ b/cmake/target_toolchain_flags.cmake @@ -41,4 +41,9 @@ include(${CMAKE_CURRENT_LIST_DIR}/linker/linker_libraries_template.cmake) # (gcc, host-gcc etc.) include(${TOOLCHAIN_ROOT}/cmake/compiler/${COMPILER}/compiler_flags.cmake OPTIONAL) include(${TOOLCHAIN_ROOT}/cmake/linker/${LINKER}/linker_flags.cmake OPTIONAL) -include(${TOOLCHAIN_ROOT}/cmake/linker/${LINKER}/linker_libraries.cmake OPTIONAL) + +if(CONFIG_NATIVE_LIBRARY) + include(${TOOLCHAIN_ROOT}/cmake/linker/linker_libraries_native.cmake) +else() + include(${TOOLCHAIN_ROOT}/cmake/linker/${LINKER}/linker_libraries.cmake OPTIONAL) +endif() From e68c7f2f73a36405ad8d15b57380f53cabcc2fcd Mon Sep 17 00:00:00 2001 From: Alexander Kozhinov Date: Sun, 30 Jun 2024 16:25:37 +0200 Subject: [PATCH 2640/4482] boards: arm: nucleo_h745zi_q add fdcan1, fdcan2 and usb_fs DT configurations Signed-off-by: Alexander Kozhinov --- boards/st/nucleo_h745zi_q/doc/index.rst | 2 ++ .../nucleo_h745zi_q_stm32h745xx_m7.dts | 11 +++++++++++ .../nucleo_h745zi_q_stm32h745xx_m7.yaml | 1 + 3 files changed, 14 insertions(+) diff --git a/boards/st/nucleo_h745zi_q/doc/index.rst b/boards/st/nucleo_h745zi_q/doc/index.rst index ba3f5627a6f76..39a74a81ab734 100644 --- a/boards/st/nucleo_h745zi_q/doc/index.rst +++ b/boards/st/nucleo_h745zi_q/doc/index.rst @@ -112,6 +112,8 @@ features: +-------------+------------+-------------------------------------+ | SPI | on-chip | spi | +-------------+------------+-------------------------------------+ +| FDCAN | on-chip | CAN-FD Control Area Network | ++-------------+------------+-------------------------------------+ Other hardware features are not yet supported on this Zephyr port. diff --git a/boards/st/nucleo_h745zi_q/nucleo_h745zi_q_stm32h745xx_m7.dts b/boards/st/nucleo_h745zi_q/nucleo_h745zi_q_stm32h745xx_m7.dts index bce218ae37da1..b9ddb37cb7962 100644 --- a/boards/st/nucleo_h745zi_q/nucleo_h745zi_q_stm32h745xx_m7.dts +++ b/boards/st/nucleo_h745zi_q/nucleo_h745zi_q_stm32h745xx_m7.dts @@ -144,3 +144,14 @@ zephyr_udc0: &usbotg_fs { pinctrl-names = "default"; status = "okay"; }; + +&fdcan1 { + pinctrl-0 = <&fdcan1_rx_pd0 &fdcan1_tx_pd1>; + /* HSE will be used by default. Uncomment below to enable APB1.2 120MHz clock */ + /* + * clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000100>, + * <&rcc STM32_SRC_PLL1_Q FDCAN_SEL(1)>; + */ + pinctrl-names = "default"; + status = "okay"; +}; diff --git a/boards/st/nucleo_h745zi_q/nucleo_h745zi_q_stm32h745xx_m7.yaml b/boards/st/nucleo_h745zi_q/nucleo_h745zi_q_stm32h745xx_m7.yaml index ff551e718374a..259cd29438b66 100644 --- a/boards/st/nucleo_h745zi_q/nucleo_h745zi_q_stm32h745xx_m7.yaml +++ b/boards/st/nucleo_h745zi_q/nucleo_h745zi_q_stm32h745xx_m7.yaml @@ -16,6 +16,7 @@ supported: - counter - i2c - pwm + - can - netif:eth - spi - usb_device From a6c1f80f46c30c90192f7fae94839addb964254f Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Tue, 1 Oct 2024 11:12:28 -0700 Subject: [PATCH 2641/4482] tests: benchmarks/latency: limit CPU to 1 for Intel ADSP ACE Due to addition of busy threads running on other cores, and the simulator runs in single thread bouncing through all cores, we are wasting quite a bit of time just busy waiting. This makes each simulator run too long for CI. So limit CPU number to 1. Signed-off-by: Daniel Leung --- .../latency_measure/boards/intel_adsp_ace15_mtpm_sim.conf | 6 ++++++ .../latency_measure/boards/intel_adsp_ace20_lnl_sim.conf | 6 ++++++ .../latency_measure/boards/intel_adsp_ace30_ptl_sim.conf | 6 ++++++ 3 files changed, 18 insertions(+) create mode 100644 tests/benchmarks/latency_measure/boards/intel_adsp_ace15_mtpm_sim.conf create mode 100644 tests/benchmarks/latency_measure/boards/intel_adsp_ace20_lnl_sim.conf create mode 100644 tests/benchmarks/latency_measure/boards/intel_adsp_ace30_ptl_sim.conf diff --git a/tests/benchmarks/latency_measure/boards/intel_adsp_ace15_mtpm_sim.conf b/tests/benchmarks/latency_measure/boards/intel_adsp_ace15_mtpm_sim.conf new file mode 100644 index 0000000000000..bad81b9ffbfa5 --- /dev/null +++ b/tests/benchmarks/latency_measure/boards/intel_adsp_ace15_mtpm_sim.conf @@ -0,0 +1,6 @@ +# Due to addition of busy threads running on other cores, +# and the simulator runs in single thread bouncing through +# all cores, we are wasting quite a bit of time just busy +# waiting. This makes each simulator run too long for CI. +# So limit CPU number to 1. +CONFIG_MP_MAX_NUM_CPUS=1 diff --git a/tests/benchmarks/latency_measure/boards/intel_adsp_ace20_lnl_sim.conf b/tests/benchmarks/latency_measure/boards/intel_adsp_ace20_lnl_sim.conf new file mode 100644 index 0000000000000..bad81b9ffbfa5 --- /dev/null +++ b/tests/benchmarks/latency_measure/boards/intel_adsp_ace20_lnl_sim.conf @@ -0,0 +1,6 @@ +# Due to addition of busy threads running on other cores, +# and the simulator runs in single thread bouncing through +# all cores, we are wasting quite a bit of time just busy +# waiting. This makes each simulator run too long for CI. +# So limit CPU number to 1. +CONFIG_MP_MAX_NUM_CPUS=1 diff --git a/tests/benchmarks/latency_measure/boards/intel_adsp_ace30_ptl_sim.conf b/tests/benchmarks/latency_measure/boards/intel_adsp_ace30_ptl_sim.conf new file mode 100644 index 0000000000000..bad81b9ffbfa5 --- /dev/null +++ b/tests/benchmarks/latency_measure/boards/intel_adsp_ace30_ptl_sim.conf @@ -0,0 +1,6 @@ +# Due to addition of busy threads running on other cores, +# and the simulator runs in single thread bouncing through +# all cores, we are wasting quite a bit of time just busy +# waiting. This makes each simulator run too long for CI. +# So limit CPU number to 1. +CONFIG_MP_MAX_NUM_CPUS=1 From e330b55f811e58c821f9ca8676e829b65de4a099 Mon Sep 17 00:00:00 2001 From: Ioannis Damigos Date: Wed, 23 Oct 2024 16:44:28 +0300 Subject: [PATCH 2642/4482] soc/da1469x: Update sys_arch_reboot() function Update sys_arch_reboot() function Signed-off-by: Ioannis Damigos --- soc/renesas/smartbond/da1469x/soc.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/soc/renesas/smartbond/da1469x/soc.c b/soc/renesas/smartbond/da1469x/soc.c index 79b191cb5968e..4186dab86e3db 100644 --- a/soc/renesas/smartbond/da1469x/soc.c +++ b/soc/renesas/smartbond/da1469x/soc.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -36,9 +37,26 @@ static uint32_t z_renesas_cache_configured; void sys_arch_reboot(int type) { - ARG_UNUSED(type); - - NVIC_SystemReset(); + if (type == SYS_REBOOT_WARM) { + NVIC_SystemReset(); + } else if (type == SYS_REBOOT_COLD) { + if ((SYS_WDOG->WATCHDOG_REG & SYS_WDOG_WATCHDOG_REG_WDOG_VAL_NEG_Msk) == 0) { + /* Cannot write WATCHDOG_REG while WRITE_BUSY */ + while ((SYS_WDOG->WATCHDOG_REG & + SYS_WDOG_WATCHDOG_CTRL_REG_WRITE_BUSY_Msk) != 0) { + } + /* Write WATCHDOG_REG */ + SYS_WDOG->WATCHDOG_REG = BIT(SYS_WDOG_WATCHDOG_REG_WDOG_VAL_Pos); + + GPREG->RESET_FREEZE_REG = GPREG_SET_FREEZE_REG_FRZ_SYS_WDOG_Msk; + SYS_WDOG->WATCHDOG_CTRL_REG &= + ~SYS_WDOG_WATCHDOG_CTRL_REG_WDOG_FREEZE_EN_Msk; + } + /* Wait */ + for (;;) { + __NOP(); + } + } } #if defined(CONFIG_BOOTLOADER_MCUBOOT) From 76bceb9ed29d669be978cef7c85b5864f73fbd33 Mon Sep 17 00:00:00 2001 From: Corey Wharton Date: Wed, 23 Oct 2024 14:36:25 -0700 Subject: [PATCH 2643/4482] kernel: mem_slab: always validate memory address on free Allowing an invalid address to be "freed" when asserts are disabled is dangerous and can lead to a very hard class of bugs (and potential security issues) to troubleshoot. This change always validates the address before adding it to the free list and calls k_panic() if asserts are not enabled. Signed-off-by: Corey Wharton --- kernel/mem_slab.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/kernel/mem_slab.c b/kernel/mem_slab.c index 80710d063d915..e64359174c5ab 100644 --- a/kernel/mem_slab.c +++ b/kernel/mem_slab.c @@ -204,7 +204,6 @@ int k_mem_slab_init(struct k_mem_slab *slab, void *buffer, return rc; } -#if __ASSERT_ON static bool slab_ptr_is_good(struct k_mem_slab *slab, const void *ptr) { const char *p = ptr; @@ -214,7 +213,6 @@ static bool slab_ptr_is_good(struct k_mem_slab *slab, const void *ptr) (offset < (slab->info.block_size * slab->info.num_blocks)) && ((offset % slab->info.block_size) == 0); } -#endif int k_mem_slab_alloc(struct k_mem_slab *slab, void **mem, k_timeout_t timeout) { @@ -267,9 +265,13 @@ int k_mem_slab_alloc(struct k_mem_slab *slab, void **mem, k_timeout_t timeout) void k_mem_slab_free(struct k_mem_slab *slab, void *mem) { - k_spinlock_key_t key = k_spin_lock(&slab->lock); + if (!slab_ptr_is_good(slab, mem)) { + __ASSERT(false, "Invalid memory pointer provided"); + k_panic(); + return; + } - __ASSERT(slab_ptr_is_good(slab, mem), "Invalid memory pointer provided"); + k_spinlock_key_t key = k_spin_lock(&slab->lock); SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_mem_slab, free, slab); if ((slab->free_list == NULL) && IS_ENABLED(CONFIG_MULTITHREADING)) { From 3734268f90a17406fc139fbef54c3ef04bfbbb9a Mon Sep 17 00:00:00 2001 From: Aleksander Wasaznik Date: Fri, 25 Oct 2024 14:40:46 +0200 Subject: [PATCH 2644/4482] Bluetooth: host: Remove useless alloc_buf_cb in test The alloc_buf callback is not used when `seg_recv` is set, so it is never called in this test. Remove it. Signed-off-by: Aleksander Wasaznik --- tests/bsim/bluetooth/host/l2cap/credits_seg_recv/src/main.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/bsim/bluetooth/host/l2cap/credits_seg_recv/src/main.c b/tests/bsim/bluetooth/host/l2cap/credits_seg_recv/src/main.c index b98a79e355576..1ee69d76585b4 100644 --- a/tests/bsim/bluetooth/host/l2cap/credits_seg_recv/src/main.c +++ b/tests/bsim/bluetooth/host/l2cap/credits_seg_recv/src/main.c @@ -59,11 +59,6 @@ int l2cap_chan_send(struct bt_l2cap_chan *chan, uint8_t *data, size_t len) return ret; } -struct net_buf *alloc_buf_cb(struct bt_l2cap_chan *chan) -{ - return net_buf_alloc(&sdu_pool, K_NO_WAIT); -} - void continue_sending(struct test_ctx *ctx) { struct bt_l2cap_chan *chan = &ctx->le_chan.chan; @@ -137,7 +132,6 @@ void l2cap_chan_disconnected_cb(struct bt_l2cap_chan *chan) static struct bt_l2cap_chan_ops ops = { .connected = l2cap_chan_connected_cb, .disconnected = l2cap_chan_disconnected_cb, - .alloc_buf = alloc_buf_cb, .seg_recv = recv_cb, .sent = sent_cb, }; From 28238d03ad156eb3f31c27849c94d0aa5b5619b6 Mon Sep 17 00:00:00 2001 From: James Roy Date: Wed, 6 Nov 2024 21:02:21 +0800 Subject: [PATCH 2645/4482] devicetree: Add DT_HAS_ALIAS macro Add 'DT_HAS_ALIAS' macro to verify node alias existence. Signed-off-by: James Roy --- doc/build/dts/api-usage.rst | 2 ++ include/zephyr/devicetree.h | 7 +++++++ tests/lib/devicetree/api/src/main.c | 2 ++ 3 files changed, 11 insertions(+) diff --git a/doc/build/dts/api-usage.rst b/doc/build/dts/api-usage.rst index c53ece8ee6a70..5b96349590afb 100644 --- a/doc/build/dts/api-usage.rst +++ b/doc/build/dts/api-usage.rst @@ -50,6 +50,8 @@ By alias :zephyr:code-sample:`blinky`, which uses the ``led0`` alias) that need to refer to *some* device of a particular type ("the board's user LED") but don't care which one is used. + You may also use :c:macro:`DT_HAS_ALIAS()` to verify whether an alias + node exists. By instance number This is done primarily by device drivers, as instance numbers are a way to diff --git a/include/zephyr/devicetree.h b/include/zephyr/devicetree.h index 3a26a1dd355c4..1adc7602f10ff 100644 --- a/include/zephyr/devicetree.h +++ b/include/zephyr/devicetree.h @@ -235,6 +235,13 @@ */ #define DT_ALIAS(alias) DT_CAT(DT_N_ALIAS_, alias) +/** + * @brief Test if the devicetree has a given alias + * @param alias_name lowercase-and-underscores devicetree alias name + * @return 1 if the alias exists and refers to a node, 0 otherwise + */ +#define DT_HAS_ALIAS(alias_name) DT_NODE_EXISTS(DT_ALIAS(alias_name)) + /** * @brief Get a node identifier for an instance of a compatible * diff --git a/tests/lib/devicetree/api/src/main.c b/tests/lib/devicetree/api/src/main.c index d4dd12cf733be..4b39c4571a871 100644 --- a/tests/lib/devicetree/api/src/main.c +++ b/tests/lib/devicetree/api/src/main.c @@ -127,6 +127,8 @@ ZTEST(devicetree_api, test_path_props) ZTEST(devicetree_api, test_alias_props) { + zassert_equal(DT_HAS_ALIAS(test_alias), 1, ""); + zassert_equal(DT_HAS_ALIAS(test_alias_none), 0, ""); zassert_equal(DT_NUM_REGS(TEST_ALIAS), 1, ""); zassert_equal(DT_REG_ADDR(TEST_ALIAS), 0xdeadbeef, ""); zassert_equal(DT_REG_SIZE(TEST_ALIAS), 0x1000, ""); From 26973bd0549c47f53e51161d94cf52389e2dda42 Mon Sep 17 00:00:00 2001 From: Marcin Szymczyk Date: Mon, 28 Oct 2024 15:46:12 +0100 Subject: [PATCH 2646/4482] snippets: nordic-*: support custom boards Apply overlays for custom boards, based on already supported SoCs. Fixes #77639. Signed-off-by: Marcin Szymczyk --- snippets/nordic-flpr-xip/snippet.yml | 8 ++++---- .../nrf54h20_cpuapp.overlay} | 0 .../nrf54l15_cpuapp.overlay} | 0 snippets/nordic-flpr/snippet.yml | 8 ++++---- .../nrf54h20_cpuapp.overlay} | 0 .../nrf54l15_cpuapp.overlay} | 0 snippets/nordic-ppr-xip/snippet.yml | 8 ++++---- .../nrf54h20_cpuapp.overlay} | 0 .../nrf9280_cpuapp.overlay} | 0 snippets/nordic-ppr/snippet.yml | 8 ++++---- .../nrf54h20_cpuapp.overlay} | 0 .../nrf9280_cpuapp.overlay} | 0 12 files changed, 16 insertions(+), 16 deletions(-) rename snippets/nordic-flpr-xip/{boards/nrf54h20dk_nrf54h20_cpuapp.overlay => soc/nrf54h20_cpuapp.overlay} (100%) rename snippets/nordic-flpr-xip/{boards/nrf54l15dk_nrf54l15_cpuapp.overlay => soc/nrf54l15_cpuapp.overlay} (100%) rename snippets/nordic-flpr/{boards/nrf54h20dk_nrf54h20_cpuapp.overlay => soc/nrf54h20_cpuapp.overlay} (100%) rename snippets/nordic-flpr/{boards/nrf54l15dk_nrf54l15_cpuapp.overlay => soc/nrf54l15_cpuapp.overlay} (100%) rename snippets/nordic-ppr-xip/{boards/nrf54h20dk_nrf54h20_cpuapp.overlay => soc/nrf54h20_cpuapp.overlay} (100%) rename snippets/nordic-ppr-xip/{boards/nrf9280pdk_nrf9280_cpuapp.overlay => soc/nrf9280_cpuapp.overlay} (100%) rename snippets/nordic-ppr/{boards/nrf54h20dk_nrf54h20_cpuapp.overlay => soc/nrf54h20_cpuapp.overlay} (100%) rename snippets/nordic-ppr/{boards/nrf9280pdk_nrf9280_cpuapp.overlay => soc/nrf9280_cpuapp.overlay} (100%) diff --git a/snippets/nordic-flpr-xip/snippet.yml b/snippets/nordic-flpr-xip/snippet.yml index 921b186b039e6..8ddfd71e5300e 100644 --- a/snippets/nordic-flpr-xip/snippet.yml +++ b/snippets/nordic-flpr-xip/snippet.yml @@ -3,9 +3,9 @@ append: EXTRA_DTC_OVERLAY_FILE: nordic-flpr-xip.overlay boards: - nrf54l15dk/nrf54l15/cpuapp: + /.*/nrf54l15/cpuapp/: append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf54l15dk_nrf54l15_cpuapp.overlay - nrf54h20dk/nrf54h20/cpuapp: + EXTRA_DTC_OVERLAY_FILE: soc/nrf54l15_cpuapp.overlay + /.*/nrf54h20/cpuapp/: append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20dk_nrf54h20_cpuapp.overlay + EXTRA_DTC_OVERLAY_FILE: soc/nrf54h20_cpuapp.overlay diff --git a/snippets/nordic-flpr-xip/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/snippets/nordic-flpr-xip/soc/nrf54h20_cpuapp.overlay similarity index 100% rename from snippets/nordic-flpr-xip/boards/nrf54h20dk_nrf54h20_cpuapp.overlay rename to snippets/nordic-flpr-xip/soc/nrf54h20_cpuapp.overlay diff --git a/snippets/nordic-flpr-xip/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/snippets/nordic-flpr-xip/soc/nrf54l15_cpuapp.overlay similarity index 100% rename from snippets/nordic-flpr-xip/boards/nrf54l15dk_nrf54l15_cpuapp.overlay rename to snippets/nordic-flpr-xip/soc/nrf54l15_cpuapp.overlay diff --git a/snippets/nordic-flpr/snippet.yml b/snippets/nordic-flpr/snippet.yml index 17f99b8400f1e..f7578eccaacea 100644 --- a/snippets/nordic-flpr/snippet.yml +++ b/snippets/nordic-flpr/snippet.yml @@ -3,9 +3,9 @@ append: EXTRA_DTC_OVERLAY_FILE: nordic-flpr.overlay boards: - nrf54l15dk/nrf54l15/cpuapp: + /.*/nrf54l15/cpuapp/: append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf54l15dk_nrf54l15_cpuapp.overlay - nrf54h20dk/nrf54h20/cpuapp: + EXTRA_DTC_OVERLAY_FILE: soc/nrf54l15_cpuapp.overlay + /.*/nrf54h20/cpuapp/: append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20dk_nrf54h20_cpuapp.overlay + EXTRA_DTC_OVERLAY_FILE: soc/nrf54h20_cpuapp.overlay diff --git a/snippets/nordic-flpr/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/snippets/nordic-flpr/soc/nrf54h20_cpuapp.overlay similarity index 100% rename from snippets/nordic-flpr/boards/nrf54h20dk_nrf54h20_cpuapp.overlay rename to snippets/nordic-flpr/soc/nrf54h20_cpuapp.overlay diff --git a/snippets/nordic-flpr/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/snippets/nordic-flpr/soc/nrf54l15_cpuapp.overlay similarity index 100% rename from snippets/nordic-flpr/boards/nrf54l15dk_nrf54l15_cpuapp.overlay rename to snippets/nordic-flpr/soc/nrf54l15_cpuapp.overlay diff --git a/snippets/nordic-ppr-xip/snippet.yml b/snippets/nordic-ppr-xip/snippet.yml index 09b42719c47b7..f24101052e59e 100644 --- a/snippets/nordic-ppr-xip/snippet.yml +++ b/snippets/nordic-ppr-xip/snippet.yml @@ -3,9 +3,9 @@ append: EXTRA_DTC_OVERLAY_FILE: nordic-ppr-xip.overlay boards: - nrf54h20dk/nrf54h20/cpuapp: + /.*/nrf54h20/cpuapp/: append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20dk_nrf54h20_cpuapp.overlay - nrf9280pdk/nrf9280/cpuapp: + EXTRA_DTC_OVERLAY_FILE: soc/nrf54h20_cpuapp.overlay + /.*/nrf9280/cpuapp/: append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf9280pdk_nrf9280_cpuapp.overlay + EXTRA_DTC_OVERLAY_FILE: soc/nrf9280_cpuapp.overlay diff --git a/snippets/nordic-ppr-xip/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/snippets/nordic-ppr-xip/soc/nrf54h20_cpuapp.overlay similarity index 100% rename from snippets/nordic-ppr-xip/boards/nrf54h20dk_nrf54h20_cpuapp.overlay rename to snippets/nordic-ppr-xip/soc/nrf54h20_cpuapp.overlay diff --git a/snippets/nordic-ppr-xip/boards/nrf9280pdk_nrf9280_cpuapp.overlay b/snippets/nordic-ppr-xip/soc/nrf9280_cpuapp.overlay similarity index 100% rename from snippets/nordic-ppr-xip/boards/nrf9280pdk_nrf9280_cpuapp.overlay rename to snippets/nordic-ppr-xip/soc/nrf9280_cpuapp.overlay diff --git a/snippets/nordic-ppr/snippet.yml b/snippets/nordic-ppr/snippet.yml index 48caac253a8b7..160bd876c2940 100644 --- a/snippets/nordic-ppr/snippet.yml +++ b/snippets/nordic-ppr/snippet.yml @@ -3,9 +3,9 @@ append: EXTRA_DTC_OVERLAY_FILE: nordic-ppr.overlay boards: - nrf54h20dk/nrf54h20/cpuapp: + /.*/nrf54h20/cpuapp/: append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20dk_nrf54h20_cpuapp.overlay - nrf9280pdk/nrf9280/cpuapp: + EXTRA_DTC_OVERLAY_FILE: soc/nrf54h20_cpuapp.overlay + /.*/nrf9280/cpuapp/: append: - EXTRA_DTC_OVERLAY_FILE: boards/nrf9280pdk_nrf9280_cpuapp.overlay + EXTRA_DTC_OVERLAY_FILE: soc/nrf9280_cpuapp.overlay diff --git a/snippets/nordic-ppr/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/snippets/nordic-ppr/soc/nrf54h20_cpuapp.overlay similarity index 100% rename from snippets/nordic-ppr/boards/nrf54h20dk_nrf54h20_cpuapp.overlay rename to snippets/nordic-ppr/soc/nrf54h20_cpuapp.overlay diff --git a/snippets/nordic-ppr/boards/nrf9280pdk_nrf9280_cpuapp.overlay b/snippets/nordic-ppr/soc/nrf9280_cpuapp.overlay similarity index 100% rename from snippets/nordic-ppr/boards/nrf9280pdk_nrf9280_cpuapp.overlay rename to snippets/nordic-ppr/soc/nrf9280_cpuapp.overlay From 7b29b66bd5ff3370409444b36865c9fea7450dfe Mon Sep 17 00:00:00 2001 From: Yves Vandervennet Date: Mon, 28 Oct 2024 16:09:36 -0400 Subject: [PATCH 2647/4482] west: linkserver: change the default port number for semihost LinkServer manages port numbers for gdb and semihost as separate linear sequences when invoked to debug multi-core applications, e.g the gdb-server instance for cpu0 will have the default GDB port 3333 and the next gdb-server instance will be assigned the port 3334. The latter will conflict with the default port for semihost which is 3334. This patch changes the default port for semihost to 8888. Port numbers can be changed when invoking the linkserver runner. Signed-off-by: Yves Vandervennet --- scripts/west_commands/runners/linkserver.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/west_commands/runners/linkserver.py b/scripts/west_commands/runners/linkserver.py index 3e0baf9f60576..f1a4630dd8798 100644 --- a/scripts/west_commands/runners/linkserver.py +++ b/scripts/west_commands/runners/linkserver.py @@ -18,7 +18,7 @@ DEFAULT_LINKSERVER_EXE = 'Linkserver.exe' if sys.platform == 'win32' else 'LinkServer' DEFAULT_LINKSERVER_GDB_PORT = 3333 -DEFAULT_LINKSERVER_SEMIHOST_PORT = 3334 +DEFAULT_LINKSERVER_SEMIHOST_PORT = 8888 class LinkServerBinaryRunner(ZephyrBinaryRunner): '''Runner front-end for NXP Linkserver''' @@ -95,6 +95,7 @@ def do_add_parser(cls, parser): @classmethod def do_create(cls, cfg, args): + print("RUNNER - gdb_port = " + str(args.gdb_port) + ", semih port = " + str(args.semihost_port)) return LinkServerBinaryRunner(cfg, args.device, args.core, linkserver=args.linkserver, dt_flash=args.dt_flash, From 11f18c7340522351e63d374826928f06f0bf6b62 Mon Sep 17 00:00:00 2001 From: Yves Vandervennet Date: Wed, 16 Oct 2024 10:34:38 -0500 Subject: [PATCH 2648/4482] boards: lpcxpresso55s69: enable multicore debugging - Refactoring of the cmake code so LinkServer can be invoked with the correct switches. - Documentation update Signed-off-by: Yves Vandervennet --- boards/nxp/lpcxpresso55s69/board.cmake | 14 +++++++++----- boards/nxp/lpcxpresso55s69/doc/index.rst | 7 ++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/boards/nxp/lpcxpresso55s69/board.cmake b/boards/nxp/lpcxpresso55s69/board.cmake index 137b2e614f3aa..554ff716de3d3 100644 --- a/boards/nxp/lpcxpresso55s69/board.cmake +++ b/boards/nxp/lpcxpresso55s69/board.cmake @@ -8,15 +8,19 @@ ## DAP Link implementation in pyocd is underway, ## until then jlink can be used or copy image to storage -if(CONFIG_BOARD_LPCXPRESSO55S69_LPC55S69_CPU0 OR - CONFIG_BOARD_LPCXPRESSO55S69_LPC55S69_CPU0_NS OR - CONFIG_SECOND_CORE_MCUX) +board_runner_args(linkserver "--device=LPC55S69:LPCXpresso55S69") + +if(CONFIG_SECOND_CORE_MCUX) + board_runner_args(linkserver "--core=all") +elseif(CONFIG_BOARD_LPCXPRESSO55S69_LPC55S69_CPU0 OR + CONFIG_BOARD_LPCXPRESSO55S69_LPC55S69_CPU0_NS) board_runner_args(jlink "--device=LPC55S69_M33_0") - board_runner_args(linkserver "--device=LPC55S69:LPCXpresso55S69") board_runner_args(linkserver "--override=/device/memory/0/flash-driver=LPC55xx_S.cfx") board_runner_args(linkserver "--override=/device/memory/0/location=0x10000000") + board_runner_args(linkserver "--core=cm33_core0") elseif(CONFIG_BOARD_LPCXPRESSO55S69_LPC55S69_CPU1) board_runner_args(jlink "--device=LPC55S69_M33_1") + board_runner_args(linkserver "--core=cm33_core1") endif() board_runner_args(pyocd "--target=lpc55s69") @@ -25,6 +29,6 @@ if(CONFIG_BUILD_WITH_TFM) set_property(TARGET runners_yaml_props_target PROPERTY hex_file tfm_merged.hex) endif() +include(${ZEPHYR_BASE}/boards/common/linkserver.board.cmake) include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) -include(${ZEPHYR_BASE}/boards/common/linkserver.board.cmake) diff --git a/boards/nxp/lpcxpresso55s69/doc/index.rst b/boards/nxp/lpcxpresso55s69/doc/index.rst index b4a7328af318a..8e1a41e11fc6b 100644 --- a/boards/nxp/lpcxpresso55s69/doc/index.rst +++ b/boards/nxp/lpcxpresso55s69/doc/index.rst @@ -273,6 +273,7 @@ Build and flash applications as usual (see :ref:`build_an_application` and Configuring a Debug Probe ========================= +LinkServer is the default runner for this board. A debug probe is used for both flashing and debugging the board. This board is configured by default to use the LPC-Link2 CMSIS-DAP Onboard Debug Probe, however the :ref:`pyocd-debug-host-tools` does not yet support this probe so you @@ -316,7 +317,7 @@ Flashing ======== Here is an example for the :zephyr:code-sample:`hello_world` application. This example uses the -:ref:`jlink-debug-host-tools` as default. +:ref:`linkserver-debug-host-tools` as default. .. zephyr-app-commands:: :zephyr-app: samples/hello_world @@ -328,8 +329,8 @@ see the following message in the terminal: .. code-block:: console - ***** Booting Zephyr OS v1.14.0 ***** - Hello World! lpcxpresso55s69 + ***** Booting Zephyr OS v3.7.0 ***** + Hello World! lpcxpresso55s69/lpc55s69/cpu0 Building and flashing secure/non-secure with Arm |reg| TrustZone |reg| ---------------------------------------------------------------------- From c9f3690ed48ed5cc190fb64d1247362cf8d116ad Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 29 Oct 2024 14:50:21 +0000 Subject: [PATCH 2649/4482] kconfig: Remove deprecated option BOOTLOADER_SRAM_SIZE Removes BOOTLOADER_SRAM_SIZE which was deprecated with Zephyr 3.6 Signed-off-by: Jamie McCrae --- Kconfig.zephyr | 26 ------------------- .../arch/arm/cortex_a_r/scripts/linker.ld | 15 ++--------- .../arch/arm/cortex_m/scripts/linker.ld | 11 -------- soc/infineon/cat1b/cyw20829/linker.ld | 11 -------- 4 files changed, 2 insertions(+), 61 deletions(-) diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 68abf89b42fc4..77821c359c79f 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -1021,32 +1021,6 @@ config IS_BOOTLOADER This option indicates that Zephyr will act as a bootloader to execute a separate Zephyr image payload. -config BOOTLOADER_SRAM_SIZE - int "SRAM reserved for bootloader [DEPRECATED]" - default 0 - depends on !XIP || IS_BOOTLOADER - depends on ARM || XTENSA - help - This option specifies the amount of SRAM (measure in kB) reserved for - a bootloader image, when either: - - the Zephyr image itself is to act as the bootloader, or - - Zephyr is a !XIP image, which implicitly assumes existence of a - bootloader that loads the Zephyr !XIP image onto SRAM. - - This option is deprecated, users should transition to using DTS to set this, if needed. - To be removed after Zephyr 3.7 release. - -config BOOTLOADER_SRAM_SIZE_DEPRECATED - bool - default y - select DEPRECATED - depends on BOOTLOADER_SRAM_SIZE != 0 - depends on !XIP || IS_BOOTLOADER - depends on ARM || XTENSA - help - Non-prompt symbol to indicate that the deprecated BOOTLOADER_SRAM_SIZE Kconfig has a - non-0 value. Please transition to using devicetree. - config BOOTLOADER_BOSSA bool "BOSSA bootloader support" select USE_DT_CODE_PARTITION diff --git a/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld b/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld index 239ab62129371..1d2744e253b86 100644 --- a/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_a_r/scripts/linker.ld @@ -52,19 +52,8 @@ #define ROM_SIZE (CONFIG_FLASH_SIZE*1K - CONFIG_FLASH_LOAD_OFFSET - ROM_END_OFFSET) #endif -#if defined(CONFIG_XIP) - #if defined(CONFIG_IS_BOOTLOADER) - #define RAM_SIZE (CONFIG_BOOTLOADER_SRAM_SIZE * 1K) - #define RAM_ADDR (CONFIG_SRAM_BASE_ADDRESS + \ - (CONFIG_SRAM_SIZE * 1K - RAM_SIZE)) - #else - #define RAM_SIZE (CONFIG_SRAM_SIZE * 1K) - #define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS - #endif -#else - #define RAM_SIZE (CONFIG_SRAM_SIZE * 1K - CONFIG_BOOTLOADER_SRAM_SIZE * 1K) - #define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS -#endif +#define RAM_SIZE (CONFIG_SRAM_SIZE * 1K) +#define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS /* Set alignment to CONFIG_ARM_MPU_REGION_MIN_ALIGN_AND_SIZE * to make linker section alignment comply with MPU granularity. diff --git a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld index 9e123b120de7c..03dc59e1f50dc 100644 --- a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld @@ -52,19 +52,8 @@ #define ROM_SIZE (CONFIG_FLASH_SIZE * 1024 - CONFIG_FLASH_LOAD_OFFSET - ROM_END_OFFSET) #endif -#if defined(CONFIG_XIP) -#if defined(CONFIG_IS_BOOTLOADER) -#define RAM_SIZE (CONFIG_BOOTLOADER_SRAM_SIZE * 1K) -#define RAM_ADDR (CONFIG_SRAM_BASE_ADDRESS + \ - (CONFIG_SRAM_SIZE * 1K - RAM_SIZE)) -#else #define RAM_SIZE (CONFIG_SRAM_SIZE * 1K) #define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS -#endif -#else -#define RAM_SIZE (CONFIG_SRAM_SIZE * 1K - CONFIG_BOOTLOADER_SRAM_SIZE * 1K) -#define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS -#endif #if defined(CONFIG_CUSTOM_SECTION_ALIGN) _region_min_align = CONFIG_CUSTOM_SECTION_MIN_ALIGN_SIZE; diff --git a/soc/infineon/cat1b/cyw20829/linker.ld b/soc/infineon/cat1b/cyw20829/linker.ld index bcbf53c63994c..2395740c8a5fd 100644 --- a/soc/infineon/cat1b/cyw20829/linker.ld +++ b/soc/infineon/cat1b/cyw20829/linker.ld @@ -45,19 +45,8 @@ #define ROM_SIZE (CONFIG_FLASH_SIZE * 1024 - CONFIG_FLASH_LOAD_OFFSET - ROM_END_OFFSET) #endif -#if defined(CONFIG_XIP) -#if defined(CONFIG_IS_BOOTLOADER) -#define RAM_SIZE (CONFIG_BOOTLOADER_SRAM_SIZE * 1K) -#define RAM_ADDR (CONFIG_SRAM_BASE_ADDRESS + \ - (CONFIG_SRAM_SIZE * 1K - RAM_SIZE)) -#else #define RAM_SIZE (CONFIG_SRAM_SIZE * 1K) #define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS -#endif -#else -#define RAM_SIZE (CONFIG_SRAM_SIZE * 1K - CONFIG_BOOTLOADER_SRAM_SIZE * 1K) -#define RAM_ADDR CONFIG_SRAM_BASE_ADDRESS -#endif #if defined(CONFIG_CUSTOM_SECTION_ALIGN) _region_min_align = CONFIG_CUSTOM_SECTION_MIN_ALIGN_SIZE; From 94177a200ecda852e0eb64f1354cc5460f721410 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 26 Aug 2024 15:05:01 +0300 Subject: [PATCH 2650/4482] net: ipv6: Add support for stable IID addresses This implements support for RFC 7217 which describes a method to have stable IPv6 Interface Identifiers to be used with IPv6 Stateless Address Autoconfiguration (SLAAC). The stable IIDs are used to provide enhanced privacy so that an IPv6 address configured using this method is stable within each subnet, but the corresponding Interface Identifier changes when the host moves from one network to another. This method is meant to be an alternative to generating Interface Identifiers based on hardware (MAC) addresses, such that the benefits of stable addresses can be achieved without sacrificing the security and privacy of users. Signed-off-by: Jukka Rissanen --- include/zephyr/net/net_if.h | 10 ++ include/zephyr/net/net_ip.h | 65 ++++----- subsys/net/ip/CMakeLists.txt | 2 +- subsys/net/ip/Kconfig.ipv6 | 40 +++++ subsys/net/ip/ipv6.c | 194 +++++++++++++++++++++++++ subsys/net/ip/ipv6_nbr.c | 21 ++- subsys/net/ip/net_if.c | 44 +++++- subsys/net/l2/ethernet/ethernet_mgmt.c | 3 +- subsys/net/l2/virtual/ipip/ipip.c | 15 +- 9 files changed, 342 insertions(+), 52 deletions(-) diff --git a/include/zephyr/net/net_if.h b/include/zephyr/net/net_if.h index 7795f56597662..c44d73144808a 100644 --- a/include/zephyr/net/net_if.h +++ b/include/zephyr/net/net_if.h @@ -331,6 +331,16 @@ struct net_if_ipv6 { /** Retransmit timer (RFC 4861, page 52) */ uint32_t retrans_timer; +#if defined(CONFIG_NET_IPV6_IID_STABLE) + /** IID (Interface Identifier) pointer used for link local address */ + struct net_if_addr *iid; + + /** Incremented when network interface goes down so that we can + * generate new stable addresses when interface comes back up. + */ + uint32_t network_counter; +#endif /* CONFIG_NET_IPV6_IID_STABLE */ + #if defined(CONFIG_NET_IPV6_PE) /** Privacy extension DESYNC_FACTOR value from RFC 8981 ch 3.4. * "DESYNC_FACTOR is a random value within the range 0 - MAX_DESYNC_FACTOR. diff --git a/include/zephyr/net/net_ip.h b/include/zephyr/net/net_ip.h index 499d5a4f3131d..c60498b7f5af0 100644 --- a/include/zephyr/net/net_ip.h +++ b/include/zephyr/net/net_ip.h @@ -1439,7 +1439,32 @@ static inline bool net_ipv6_addr_is_v4_mapped(const struct in6_addr *addr) } /** - * @brief Create IPv6 address interface identifier + * @brief Generate IPv6 address using a prefix and interface identifier. + * Interface identifier is either generated from EUI-64 (MAC) defined + * in RFC 4291 or from randomized value defined in RFC 7217. + * + * @param iface Network interface + * @param prefix IPv6 prefix, can be left out in which case fe80::/64 is used + * @param network_id Network identifier (for example SSID in WLAN), this is + * optional can be set to NULL + * @param network_id_len Network identifier length, if set to 0 then the + * network id is ignored. + * @param dad_counter Duplicate Address Detection counter value, can be set to 0 + * if it is not known. + * @param addr IPv6 address + * @param lladdr Link local address + * + * @return 0 if ok, < 0 if error + */ +int net_ipv6_addr_generate_iid(struct net_if *iface, + const struct in6_addr *prefix, + uint8_t *network_id, size_t network_id_len, + uint8_t dad_counter, + struct in6_addr *addr, + struct net_linkaddr *lladdr); + +/** + * @brief Create IPv6 address interface identifier. * * @param addr IPv6 address * @param lladdr Link local address @@ -1447,43 +1472,7 @@ static inline bool net_ipv6_addr_is_v4_mapped(const struct in6_addr *addr) static inline void net_ipv6_addr_create_iid(struct in6_addr *addr, struct net_linkaddr *lladdr) { - UNALIGNED_PUT(htonl(0xfe800000), &addr->s6_addr32[0]); - UNALIGNED_PUT(0, &addr->s6_addr32[1]); - - switch (lladdr->len) { - case 2: - /* The generated IPv6 shall not toggle the - * Universal/Local bit. RFC 6282 ch 3.2.2 - */ - if (lladdr->type == NET_LINK_IEEE802154) { - UNALIGNED_PUT(0, &addr->s6_addr32[2]); - addr->s6_addr[11] = 0xff; - addr->s6_addr[12] = 0xfe; - addr->s6_addr[13] = 0U; - addr->s6_addr[14] = lladdr->addr[0]; - addr->s6_addr[15] = lladdr->addr[1]; - } - - break; - case 6: - /* We do not toggle the Universal/Local bit - * in Bluetooth. See RFC 7668 ch 3.2.2 - */ - memcpy(&addr->s6_addr[8], lladdr->addr, 3); - addr->s6_addr[11] = 0xff; - addr->s6_addr[12] = 0xfe; - memcpy(&addr->s6_addr[13], lladdr->addr + 3, 3); - - if (lladdr->type == NET_LINK_ETHERNET) { - addr->s6_addr[8] ^= 0x02; - } - - break; - case 8: - memcpy(&addr->s6_addr[8], lladdr->addr, lladdr->len); - addr->s6_addr[8] ^= 0x02; - break; - } + (void)net_ipv6_addr_generate_iid(NULL, NULL, NULL, 0, 0, addr, lladdr); } /** diff --git a/subsys/net/ip/CMakeLists.txt b/subsys/net/ip/CMakeLists.txt index 23d433930b1f7..d9bd7b1c780d9 100644 --- a/subsys/net/ip/CMakeLists.txt +++ b/subsys/net/ip/CMakeLists.txt @@ -54,7 +54,7 @@ zephyr_library_sources_ifdef(CONFIG_NET_CONNECTION_SOCKETS connection.c) zephyr_library_sources_ifdef(CONFIG_NET_SOCKETS_PACKET packet_socket.c) zephyr_library_sources_ifdef(CONFIG_NET_SOCKETS_CAN canbus_socket.c) -if(CONFIG_NET_TCP_ISN_RFC6528 OR CONFIG_NET_IPV6_PE) +if(CONFIG_NET_TCP_ISN_RFC6528 OR CONFIG_NET_IPV6_PE OR CONFIG_NET_IPV6_IID_STABLE) zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS) endif() endif() diff --git a/subsys/net/ip/Kconfig.ipv6 b/subsys/net/ip/Kconfig.ipv6 index 33e493d2a237d..286fbf4f195e2 100644 --- a/subsys/net/ip/Kconfig.ipv6 +++ b/subsys/net/ip/Kconfig.ipv6 @@ -174,6 +174,46 @@ config NET_IPV6_RA_RDNSS Support Router Advertisement Recursive DNS Server option. See RFC 6106 for details. The value depends on your network needs. +choice NET_IPV6_IID_GENERATION + prompt "IPv6 Interface Identifier (IID) generation" + default NET_IPV6_IID_EUI_64 + help + Determines how the IPv6 Interface Identifier (IID) is generated. + By default the legacy format using EUI-64 (MAC address) specified in + RFC 4291 chapter 2.5.1 is used. + User can also choose to use stable IID specified in RFC 7217 in which + case a randomized IID is generated for each network interface. + The stable IID enhances privacy by having a different IID for each + network interface. + +config NET_IPV6_IID_EUI_64 + bool "Generate IID using EUI-64" + help + Generate IID from modified EUI-64 a.k.a MAC address. This is the + legacy way described in RFC 4291 chapter 2.5.1 + +config NET_IPV6_IID_STABLE + bool "Generate stable IID [EXPERIMENTAL]" + select MBEDTLS + select MBEDTLS_MD + select EXPERIMENTAL + depends on !NET_6LO + help + Generate a stable IID described in RFC 7217. This option specifies a + method for generating IPv6 Interface Identifiers to be used with + IPv6 Stateless Address Autoconfiguration (SLAAC), such that an IPv6 + address configured using this method is stable within each subnet, + but the corresponding Interface Identifier changes when the host + moves from one network to another. This method is meant to be an + alternative to generating Interface Identifiers based on hardware + addresses (e.g., IEEE LAN Media Access Control (MAC) addresses), + such that the benefits of stable addresses can be achieved without + sacrificing the security and privacy of users. + Currently the stable IID generation is disabled for 6lo networks + because of header compression. + +endchoice + config NET_IPV6_PE bool "Privacy extension (RFC 8981) support [EXPERIMENTAL]" select MBEDTLS diff --git a/subsys/net/ip/ipv6.c b/subsys/net/ip/ipv6.c index 032794a76680d..34e4616f79cb7 100644 --- a/subsys/net/ip/ipv6.c +++ b/subsys/net/ip/ipv6.c @@ -18,6 +18,12 @@ LOG_MODULE_REGISTER(net_ipv6, CONFIG_NET_IPV6_LOG_LEVEL); #include #include + +#if defined(CONFIG_NET_IPV6_IID_STABLE) +#include +#include +#endif /* CONFIG_NET_IPV6_IID_STABLE */ + #include #include #include @@ -815,6 +821,194 @@ enum net_verdict net_ipv6_input(struct net_pkt *pkt, bool is_loopback) return NET_DROP; } +#if defined(CONFIG_NET_IPV6_IID_STABLE) +static bool check_reserved(const uint8_t *buf, size_t len) +{ + /* Subnet-Router Anycast (RFC 4291) */ + if (memcmp(buf, (uint8_t *)&(struct in6_addr)IN6ADDR_ANY_INIT, len) == 0) { + return true; + } + + /* Reserved Subnet Anycast Addresses (RFC 2526) + * FDFF:FFFF:FFFF:FF80 - FDFF:FFFF:FFFF:FFFF + */ + if (buf[0] == 0xFD && buf[1] == 0xFF && buf[2] == 0xFF && + buf[3] == 0xFF && buf[4] == 0xFF && buf[5] == 0xFF && + buf[6] == 0xFF && buf[7] >= 0x80) { + return true; + } + + return false; +} +#endif /* CONFIG_NET_IPV6_IID_STABLE */ + +static int gen_stable_iid(uint8_t if_index, + const struct in6_addr *prefix, + uint8_t *network_id, size_t network_id_len, + uint8_t dad_counter, + uint8_t *stable_iid, + size_t stable_iid_len) +{ +#if defined(CONFIG_NET_IPV6_IID_STABLE) + const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type(MBEDTLS_MD_SHA256); + mbedtls_md_context_t ctx; + uint8_t digest[32]; + int ret; + static bool once; + static uint8_t secret_key[16]; /* Min 128 bits, RFC 7217 ch 5 */ + struct { + struct in6_addr prefix; + uint8_t if_index; + uint8_t network_id[16]; + uint8_t dad_counter; + } buf = { + .dad_counter = dad_counter, + }; + + if (prefix == NULL) { + NET_ERR("IPv6 prefix must be set for generating a stable IID"); + return -EINVAL; + } + + memcpy(&buf.prefix, prefix, sizeof(struct in6_addr)); + + buf.if_index = if_index; + + if (network_id != NULL && network_id_len > 0) { + memcpy(buf.network_id, network_id, + MIN(network_id_len, sizeof(buf.network_id))); + } + + if (!once) { + sys_rand_get(&secret_key, sizeof(secret_key)); + once = true; + } + + mbedtls_md_init(&ctx); + mbedtls_md_setup(&ctx, md_info, true); + ret = mbedtls_md_hmac_starts(&ctx, secret_key, sizeof(secret_key)); + if (ret != 0) { + NET_DBG("Cannot %s hmac (%d)", "start", ret); + goto err; + } + + ret = mbedtls_md_hmac_update(&ctx, (uint8_t *)&buf, sizeof(buf)); + if (ret != 0) { + NET_DBG("Cannot %s hmac (%d)", "update", ret); + goto err; + } + + ret = mbedtls_md_hmac_finish(&ctx, digest); + if (ret != 0) { + NET_DBG("Cannot %s hmac (%d)", "finish", ret); + goto err; + } + + memcpy(stable_iid, digest, MIN(sizeof(digest), stable_iid_len)); + + /* Check reserved addresses, RFC 5453 ch 3 */ + if (unlikely(check_reserved(stable_iid, stable_iid_len))) { + LOG_HEXDUMP_DBG(stable_iid, stable_iid_len, + "Generated IID is reserved"); + ret = -EINVAL; + goto err; + } + +err: + mbedtls_md_free(&ctx); + + return ret; +#else + return -ENOTSUP; +#endif +} + +int net_ipv6_addr_generate_iid(struct net_if *iface, + const struct in6_addr *prefix, + uint8_t *network_id, + size_t network_id_len, + uint8_t dad_counter, + struct in6_addr *addr, + struct net_linkaddr *lladdr) +{ + struct in6_addr tmp_addr; + uint8_t if_index; + + if_index = (iface == NULL) ? net_if_get_by_iface(net_if_get_default()) + : net_if_get_by_iface(iface); + + if (IS_ENABLED(CONFIG_NET_IPV6_IID_STABLE)) { + struct in6_addr tmp_prefix = { 0 }; + int ret; + + if (prefix == NULL) { + UNALIGNED_PUT(htonl(0xfe800000), &tmp_prefix.s6_addr32[0]); + } else { + UNALIGNED_PUT(prefix->s6_addr32[0], &tmp_prefix.s6_addr32[0]); + UNALIGNED_PUT(prefix->s6_addr32[1], &tmp_prefix.s6_addr32[1]); + } + + ret = gen_stable_iid(if_index, &tmp_prefix, network_id, network_id_len, + dad_counter, (uint8_t *)&tmp_addr + 8, + sizeof(tmp_addr) / 2); + if (ret < 0) { + return ret; + } + } + + if (prefix == NULL) { + UNALIGNED_PUT(htonl(0xfe800000), &tmp_addr.s6_addr32[0]); + UNALIGNED_PUT(0, &tmp_addr.s6_addr32[1]); + } else { + UNALIGNED_PUT(prefix->s6_addr32[0], &tmp_addr.s6_addr32[0]); + UNALIGNED_PUT(prefix->s6_addr32[1], &tmp_addr.s6_addr32[1]); + } + + if (IS_ENABLED(CONFIG_NET_IPV6_IID_EUI_64)) { + switch (lladdr->len) { + case 2: + /* The generated IPv6 shall not toggle the + * Universal/Local bit. RFC 6282 ch 3.2.2 + */ + if (lladdr->type == NET_LINK_IEEE802154) { + UNALIGNED_PUT(0, &tmp_addr.s6_addr32[2]); + tmp_addr.s6_addr[11] = 0xff; + tmp_addr.s6_addr[12] = 0xfe; + tmp_addr.s6_addr[13] = 0U; + tmp_addr.s6_addr[14] = lladdr->addr[0]; + tmp_addr.s6_addr[15] = lladdr->addr[1]; + } + + break; + case 6: + /* We do not toggle the Universal/Local bit + * in Bluetooth. See RFC 7668 ch 3.2.2 + */ + memcpy(&tmp_addr.s6_addr[8], lladdr->addr, 3); + tmp_addr.s6_addr[11] = 0xff; + tmp_addr.s6_addr[12] = 0xfe; + memcpy(&tmp_addr.s6_addr[13], lladdr->addr + 3, 3); + + if (lladdr->type == NET_LINK_ETHERNET) { + tmp_addr.s6_addr[8] ^= 0x02; + } + + break; + case 8: + memcpy(&tmp_addr.s6_addr[8], lladdr->addr, lladdr->len); + tmp_addr.s6_addr[8] ^= 0x02; + break; + } + } + + NET_DBG("%s IID for iface %d %s", + IS_ENABLED(CONFIG_NET_IPV6_IID_STABLE) ? "Stable" : "EUI-64", + if_index, net_sprint_ipv6_addr(&tmp_addr)); + + memcpy(addr, &tmp_addr, sizeof(*addr)); + return 0; +} + void net_ipv6_init(void) { net_ipv6_nbr_init(); diff --git a/subsys/net/ip/ipv6_nbr.c b/subsys/net/ip/ipv6_nbr.c index 86e6b1f2173b1..8102da13c2f16 100644 --- a/subsys/net/ip/ipv6_nbr.c +++ b/subsys/net/ip/ipv6_nbr.c @@ -2237,13 +2237,24 @@ static inline void handle_prefix_autonomous(struct net_pkt *pkt, struct net_if *iface = net_pkt_iface(pkt); struct in6_addr addr = { }; struct net_if_addr *ifaddr; + int ret; - /* Create IPv6 address using the given prefix and iid. We first - * setup link local address, and then copy prefix over first 8 - * bytes of that address. + /* Create IPv6 address using the given prefix and iid. */ - net_ipv6_addr_create_iid(&addr, net_if_get_link_addr(iface)); - memcpy(&addr, prefix_info->prefix, sizeof(struct in6_addr) / 2); + ret = net_ipv6_addr_generate_iid(iface, + (struct in6_addr *)prefix_info->prefix, + COND_CODE_1(CONFIG_NET_IPV6_IID_STABLE, + ((uint8_t *)&iface->config.ip.ipv6->network_counter), + (NULL)), + COND_CODE_1(CONFIG_NET_IPV6_IID_STABLE, + (sizeof(iface->config.ip.ipv6->network_counter)), + (0U)), + 0U, + &addr, + net_if_get_link_addr(iface)); + if (ret < 0) { + NET_WARN("IPv6 IID generation issue (%d)", ret); + } ifaddr = net_if_ipv6_addr_lookup(&addr, NULL); if (ifaddr && ifaddr->addr_type == NET_ADDR_AUTOCONF) { diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c index f9f7f68b41428..684637e7f9154 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -1342,14 +1342,32 @@ void net_if_start_dad(struct net_if *iface) goto out; } - net_ipv6_addr_create_iid(&addr, net_if_get_link_addr(iface)); + ret = net_ipv6_addr_generate_iid(iface, NULL, + COND_CODE_1(CONFIG_NET_IPV6_IID_STABLE, + ((uint8_t *)&ipv6->network_counter), + (NULL)), + COND_CODE_1(CONFIG_NET_IPV6_IID_STABLE, + (sizeof(ipv6->network_counter)), + (0U)), + COND_CODE_1(CONFIG_NET_IPV6_IID_STABLE, + (ipv6->iid ? ipv6->iid->dad_count : 0U), + (0U)), + &addr, + net_if_get_link_addr(iface)); + if (ret < 0) { + NET_WARN("IPv6 IID generation issue (%d)", ret); + goto out; + } ifaddr = net_if_ipv6_addr_add(iface, &addr, NET_ADDR_AUTOCONF, 0); if (!ifaddr) { NET_ERR("Cannot add %s address to interface %p, DAD fails", net_sprint_ipv6_addr(&addr), iface); + goto out; } + IF_ENABLED(CONFIG_NET_IPV6_IID_STABLE, (ipv6->iid = ifaddr)); + /* Start DAD for all the addresses that were added earlier when * the interface was down. */ @@ -1383,10 +1401,11 @@ void net_if_ipv6_dad_failed(struct net_if *iface, const struct in6_addr *addr) goto out; } - - if (IS_ENABLED(CONFIG_NET_IPV6_PE)) { + if (IS_ENABLED(CONFIG_NET_IPV6_IID_STABLE) || IS_ENABLED(CONFIG_NET_IPV6_PE)) { ifaddr->dad_count++; + } + if (IS_ENABLED(CONFIG_NET_IPV6_PE)) { timeout = COND_CODE_1(CONFIG_NET_IPV6_PE, (ifaddr->addr_timeout), (0)); preferred_lifetime = COND_CODE_1(CONFIG_NET_IPV6_PE, @@ -3251,16 +3270,29 @@ static void iface_ipv6_start(struct net_if *iface) static void iface_ipv6_stop(struct net_if *iface) { - struct in6_addr addr = { }; + struct net_if_ipv6 *ipv6 = iface->config.ip.ipv6; if (!net_if_flag_is_set(iface, NET_IF_IPV6) || net_if_flag_is_set(iface, NET_IF_IPV6_NO_ND)) { return; } - net_ipv6_addr_create_iid(&addr, net_if_get_link_addr(iface)); + if (ipv6 == NULL) { + return; + } - (void)net_if_ipv6_addr_rm(iface, &addr); + IF_ENABLED(CONFIG_NET_IPV6_IID_STABLE, (ipv6->network_counter++)); + IF_ENABLED(CONFIG_NET_IPV6_IID_STABLE, (ipv6->iid = NULL)); + + /* Remove all autoconf addresses */ + ARRAY_FOR_EACH(ipv6->unicast, i) { + if (ipv6->unicast[i].is_used && + ipv6->unicast[i].address.family == AF_INET6 && + ipv6->unicast[i].addr_type == NET_ADDR_AUTOCONF) { + (void)net_if_ipv6_addr_rm(iface, + &ipv6->unicast[i].address.in6_addr); + } + } } static void iface_ipv6_init(int if_count) diff --git a/subsys/net/l2/ethernet/ethernet_mgmt.c b/subsys/net/l2/ethernet/ethernet_mgmt.c index 703dbbccb6de9..93183c3b10dfd 100644 --- a/subsys/net/l2/ethernet/ethernet_mgmt.c +++ b/subsys/net/l2/ethernet/ethernet_mgmt.c @@ -98,7 +98,8 @@ static int ethernet_set_config(uint32_t mgmt_request, * generated from old MAC address, from network interface if * needed. */ - if (IS_ENABLED(CONFIG_NET_NATIVE_IPV6)) { + if (IS_ENABLED(CONFIG_NET_NATIVE_IPV6) && + IS_ENABLED(CONFIG_NET_IPV6_IID_EUI_64)) { struct in6_addr iid; net_ipv6_addr_create_iid(&iid, diff --git a/subsys/net/l2/virtual/ipip/ipip.c b/subsys/net/l2/virtual/ipip/ipip.c index 52e595a7358e3..44b7c51c8c478 100644 --- a/subsys/net/l2/virtual/ipip/ipip.c +++ b/subsys/net/l2/virtual/ipip/ipip.c @@ -449,9 +449,22 @@ static int interface_attach(struct net_if *iface, struct net_if *lower_iface) if (IS_ENABLED(CONFIG_NET_IPV6) && ctx->family == AF_INET6) { struct net_if_addr *ifaddr; struct in6_addr iid; + int ret; /* RFC4213 chapter 3.7 */ - net_ipv6_addr_create_iid(&iid, net_if_get_link_addr(iface)); + ret = net_ipv6_addr_generate_iid(iface, NULL, + COND_CODE_1(CONFIG_NET_IPV6_IID_STABLE, + ((uint8_t *)&iface->config.ip.ipv6->network_counter), + (NULL)), + COND_CODE_1(CONFIG_NET_IPV6_IID_STABLE, + (sizeof(iface->config.ip.ipv6->network_counter)), + (0U)), + 0, + &iid, + net_if_get_link_addr(iface)); + if (ret < 0) { + NET_WARN("IPv6 IID generation issue (%d)", ret); + } ifaddr = net_if_ipv6_addr_add(iface, &iid, NET_ADDR_AUTOCONF, 0); if (!ifaddr) { From 3a5c6c54c16cec07b74dffedd7c72440de9ec36d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 26 Aug 2024 15:09:38 +0300 Subject: [PATCH 2651/4482] tests: net: ipv6: Add tests for stable IIDs Add tests that verify that stable IIDs generate a proper IPv6 interface identifier described in RFC 7217. Signed-off-by: Jukka Rissanen --- tests/net/iface/src/main.c | 63 +++++++++++++++++++++++++++++++++++ tests/net/iface/testcase.yaml | 15 ++++++--- 2 files changed, 73 insertions(+), 5 deletions(-) diff --git a/tests/net/iface/src/main.c b/tests/net/iface/src/main.c index b4928d2d7825d..e47318288646b 100644 --- a/tests/net/iface/src/main.c +++ b/tests/net/iface/src/main.c @@ -63,6 +63,7 @@ static struct net_if *iface1; static struct net_if *iface2; static struct net_if *iface3; static struct net_if *iface4; +static struct net_if *eth_iface; static bool test_failed; static bool test_started; @@ -303,6 +304,7 @@ static void iface_cb(struct net_if *iface, void *user_data) if (api->get_capabilities == eth_fake_api_funcs.get_capabilities) { iface4 = iface; + eth_iface = iface; } } else { switch (if_count) { @@ -1332,4 +1334,65 @@ ZTEST(net_iface, test_interface_name) #endif } +static void generate_iid(struct net_if *iface, + struct in6_addr *expected_addr, + struct in6_addr *iid_addr) +{ + const struct in6_addr prefix = { { { 0x20, 0x01, 0x1b, 0x98, 0x24, 0xb8, 0x7e, 0xbb, + 0, 0, 0, 0, 0, 0, 0, 0 } } }; + struct net_linkaddr *lladdr = net_if_get_link_addr(iface); + uint8_t *mac; + int ret; + + (void)net_iface_get_mac(net_if_get_device(iface)); + + lladdr = net_if_get_link_addr(eth_iface); + mac = lladdr->addr; + + memcpy(expected_addr, &prefix, sizeof(struct in6_addr)); + memcpy(&expected_addr->s6_addr[8], &mac[0], 3); + expected_addr->s6_addr[11] = 0xff; + expected_addr->s6_addr[12] = 0xfe; + memcpy(&expected_addr->s6_addr[13], &mac[3], 3); + + expected_addr->s6_addr[8] ^= 0x02; /* Universal bit toggle */ + + ret = net_ipv6_addr_generate_iid(iface, &prefix, NULL, 0, 0, iid_addr, + net_if_get_link_addr(eth_iface)); + zassert_equal(ret, 0, "Unexpected value (%d) returned", ret); +} + +ZTEST(net_iface, test_ipv6_iid_eui64) +{ +#if defined(CONFIG_NET_IPV6_IID_EUI_64) + struct in6_addr iid_addr = { }; + struct in6_addr expected_addr = { }; + + generate_iid(eth_iface, &expected_addr, &iid_addr); + + zassert_mem_equal(&expected_addr, &iid_addr, sizeof(struct in6_addr)); +#else + ztest_test_skip(); +#endif +} + +ZTEST(net_iface, test_ipv6_iid_stable) +{ +#if defined(CONFIG_NET_IPV6_IID_STABLE) + struct in6_addr iid_addr = { }; + struct in6_addr expected_addr = { }; + + generate_iid(eth_iface, &expected_addr, &iid_addr); + + /* Make sure that EUI-64 bytes are not there */ + zassert_not_equal(iid_addr.s6_addr[11], 0xff); + zassert_not_equal(iid_addr.s6_addr[12], 0xfe); + + zassert_true(memcmp(&expected_addr, &iid_addr, sizeof(struct in6_addr)) != 0, + "IID is EUI-64 instead of randomized"); +#else + ztest_test_skip(); +#endif +} + ZTEST_SUITE(net_iface, NULL, iface_setup, NULL, NULL, iface_teardown); diff --git a/tests/net/iface/testcase.yaml b/tests/net/iface/testcase.yaml index 7ef0785212793..a7953ca7e1849 100644 --- a/tests/net/iface/testcase.yaml +++ b/tests/net/iface/testcase.yaml @@ -1,9 +1,14 @@ common: min_ram: 16 depends_on: netif + tags: + - net + - iface + - userspace tests: - net.iface: - tags: - - net - - iface - - userspace + net.iface.iid.eui64: + extra_configs: + - CONFIG_NET_IPV6_IID_EUI_64=y + net.iface.iid.stable: + extra_configs: + - CONFIG_NET_IPV6_IID_STABLE=y From 185269d86eabf9fb35acc581e4aa55e93d6f2e0a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 29 Oct 2024 13:41:40 +0200 Subject: [PATCH 2652/4482] net: shell: ipv6: Print information about SLAAC addresses Print information in "net ipv6" command how the SLAAC addresses are generated. There is the default legacy EUI-64 method (RFC 4862) or the stable method described in RFC 7217. Signed-off-by: Jukka Rissanen --- subsys/net/lib/shell/ipv6.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/subsys/net/lib/shell/ipv6.c b/subsys/net/lib/shell/ipv6.c index eb65185c03ca1..bf0cf904ba5a8 100644 --- a/subsys/net/lib/shell/ipv6.c +++ b/subsys/net/lib/shell/ipv6.c @@ -188,6 +188,9 @@ static int cmd_net_ipv6(const struct shell *sh, size_t argc, char *argv[]) PR("Privacy extension support : %s\n", IS_ENABLED(CONFIG_NET_IPV6_PE) ? "enabled" : "disabled"); + PR("SLAAC IID generation method : %s\n", + IS_ENABLED(CONFIG_NET_IPV6_IID_STABLE) ? + "stable (RFC 7217)" : "EUI-64 (RFC 4862)"); #if defined(CONFIG_NET_IPV6_PE) PR("Max number of IPv6 privacy extension filters " From 8070e7ca6d85ab97e3772894d3b0378b80c59b41 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 30 Oct 2024 11:17:14 +0200 Subject: [PATCH 2653/4482] tests: net: conn_mgr_monitor: Increase the sleep between states The short sleep (10ms) was not enough any more. Increase the sleep to 100ms so that system stabilizes between checks. Signed-off-by: Jukka Rissanen --- tests/net/conn_mgr_monitor/src/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/net/conn_mgr_monitor/src/main.c b/tests/net/conn_mgr_monitor/src/main.c index 522a9d50b9219..cd8242c10d157 100644 --- a/tests/net/conn_mgr_monitor/src/main.c +++ b/tests/net/conn_mgr_monitor/src/main.c @@ -24,8 +24,9 @@ #include /* Time to wait for NET_MGMT events to finish firing */ -#define EVENT_WAIT_TIME_SHORT K_MSEC(10) -#define EVENT_WAIT_TIME K_MSEC(200) +#define EVENT_WAIT_TIME_SHORT K_MSEC(10) +#define EVENT_WAIT_TIME_MEDIUM K_MSEC(100) +#define EVENT_WAIT_TIME K_MSEC(200) /* Time to wait for IPv6 DAD-gated events to finish. @@ -622,7 +623,7 @@ static void cycle_iface_states(struct net_if *iface, enum ip_order ifa_ipm) zassert_equal(net_if_up(iface), 0, "net_if_up should succeed."); /* Verify that no events have been fired yet */ - k_sleep(EVENT_WAIT_TIME_SHORT); + k_sleep(EVENT_WAIT_TIME_MEDIUM); stats = get_reset_stats(); zassert_equal(stats.event_count_gen, 0, "No events should be fired if connectivity availability did not change."); @@ -653,7 +654,6 @@ static void cycle_iface_states(struct net_if *iface, enum ip_order ifa_ipm) zassert_equal(stats.conn_iface_gen, iface, "The test iface should be blamed."); zassert_equal(stats.conn_iface_ipv4, iface, "The test iface should be blamed."); - /* Add IPv6 */ net_if_ipv6_addr_add(iface, &test_ipv6_a, NET_ADDR_MANUAL, 0); From 14117b453d44cc91b74365f9c7d624b8778b8c10 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Tue, 29 Oct 2024 15:59:09 +0100 Subject: [PATCH 2654/4482] pm: policy: separate default policy and events The default policy currently directly references the private variable next_event from policy_events.c to then convert the cycle of said event (if exists) to a kernel tick in the future, something policy_events.c already implements and exposes through pm_policy_next_event_ticks(). Additionally, the implementation of pm_policy_next_state() in policy_default.c already gets the nearest kernel tick, wherein the next event has already been accounted for in, see implementation of pm_system_suspend(). This commit removes the redundant and layer violating computation if the tick of the next event from policy_default.c and updates the test test_pm_policy_events to not use default policy to determine if pm_policy_next_event_ticks() is correct. Signed-off-by: Bjarki Arge Andreasen --- subsys/pm/policy/policy_default.c | 22 ------- tests/subsys/pm/policy_api/src/main.c | 82 ++++++++------------------- 2 files changed, 25 insertions(+), 79 deletions(-) diff --git a/subsys/pm/policy/policy_default.c b/subsys/pm/policy/policy_default.c index 74a0443e6cdb1..eaf317d24cf46 100644 --- a/subsys/pm/policy/policy_default.c +++ b/subsys/pm/policy/policy_default.c @@ -9,7 +9,6 @@ #include #include -extern struct pm_policy_event *next_event; extern int32_t max_latency_cyc; const struct pm_state_info *pm_policy_next_state(uint8_t cpu, int32_t ticks) @@ -30,27 +29,6 @@ const struct pm_state_info *pm_policy_next_state(uint8_t cpu, int32_t ticks) num_cpu_states = pm_state_cpu_get_all(cpu, &cpu_states); - if ((next_event) && (next_event->value_cyc >= 0)) { - uint32_t cyc_curr = k_cycle_get_32(); - int64_t cyc_evt = next_event->value_cyc - cyc_curr; - - /* event happening after cycle counter max value, pad */ - if (next_event->value_cyc <= cyc_curr) { - cyc_evt += UINT32_MAX; - } - - if (cyc_evt > 0) { - /* if there's no system wakeup event always wins, - * otherwise, who comes earlier wins - */ - if (cyc < 0) { - cyc = cyc_evt; - } else { - cyc = MIN(cyc, cyc_evt); - } - } - } - for (int16_t i = (int16_t)num_cpu_states - 1; i >= 0; i--) { const struct pm_state_info *state = &cpu_states[i]; uint32_t min_residency_cyc, exit_latency_cyc; diff --git a/tests/subsys/pm/policy_api/src/main.c b/tests/subsys/pm/policy_api/src/main.c index bc3564bee8a28..e61f44a8b36b3 100644 --- a/tests/subsys/pm/policy_api/src/main.c +++ b/tests/subsys/pm/policy_api/src/main.c @@ -304,68 +304,36 @@ ZTEST(policy_api, test_pm_policy_next_state_custom) } #endif /* CONFIG_PM_POLICY_CUSTOM */ -#ifdef CONFIG_PM_POLICY_DEFAULT -/* note: we can't easily mock k_cycle_get_32(), so test is not ideal */ ZTEST(policy_api, test_pm_policy_events) { - struct pm_policy_event evt1, evt2; - const struct pm_state_info *next; - uint32_t now; - - now = k_cyc_to_ticks_ceil32(k_cycle_get_32()); - - /* events: - * - 10ms from now (time < runtime idle latency) - * - 200ms from now (time > runtime idle, < suspend to ram latencies) - * - * system wakeup: - * - 2s from now (time > suspend to ram latency) - * - * first event wins, so we must stay active - */ - pm_policy_event_register(&evt1, k_ms_to_cyc_floor32(10) + k_cycle_get_32()); - pm_policy_event_register(&evt2, k_ms_to_cyc_floor32(200) + k_cycle_get_32()); - next = pm_policy_next_state(0U, now + k_sec_to_ticks_floor32(2)); - zassert_is_null(next); - - /* remove first event so second event now wins, meaning we can now enter - * runtime idle - */ + struct pm_policy_event evt1; + struct pm_policy_event evt2; + uint32_t now_cycle; + uint32_t evt1_1_cycle; + uint32_t evt1_2_cycle; + uint32_t evt2_cycle; + + now_cycle = k_cycle_get_32(); + evt1_1_cycle = now_cycle + k_ticks_to_cyc_floor32(100); + evt1_2_cycle = now_cycle + k_ticks_to_cyc_floor32(200); + evt2_cycle = now_cycle + k_ticks_to_cyc_floor32(2000); + + zassert_equal(pm_policy_next_event_ticks(), -1); + pm_policy_event_register(&evt1, evt1_1_cycle); + pm_policy_event_register(&evt2, evt2_cycle); + zassert_within(pm_policy_next_event_ticks(), 100, 50); pm_policy_event_unregister(&evt1); - next = pm_policy_next_state(0U, now + k_sec_to_ticks_floor32(2)); - zassert_equal(next->state, PM_STATE_RUNTIME_IDLE); - - /* remove second event, now we can enter deepest state */ + zassert_within(pm_policy_next_event_ticks(), 2000, 50); pm_policy_event_unregister(&evt2); - next = pm_policy_next_state(0U, now + k_sec_to_ticks_floor32(2)); - zassert_equal(next->state, PM_STATE_SUSPEND_TO_RAM); - - /* events: - * - 2s from now (time > suspend to ram latency) - * - * system wakeup: - * - 200ms from now (time > runtime idle, < suspend to ram latencies) - * - * system wakeup wins, so we can go up to runtime idle. - */ - pm_policy_event_register(&evt1, k_sec_to_cyc_floor32(2) + k_cycle_get_32()); - next = pm_policy_next_state(0U, now + k_ms_to_ticks_floor32(200)); - zassert_equal(next->state, PM_STATE_RUNTIME_IDLE); - - /* modify event to occur in 10ms, so it now wins system wakeup and - * requires to stay awake - */ - pm_policy_event_update(&evt1, k_ms_to_cyc_floor32(10) + k_cycle_get_32()); - next = pm_policy_next_state(0U, now + k_ms_to_ticks_floor32(200)); - zassert_is_null(next); - + zassert_equal(pm_policy_next_event_ticks(), -1); + pm_policy_event_register(&evt2, evt2_cycle); + zassert_within(pm_policy_next_event_ticks(), 2000, 50); + pm_policy_event_register(&evt1, evt1_1_cycle); + zassert_within(pm_policy_next_event_ticks(), 100, 50); + pm_policy_event_update(&evt1, evt1_2_cycle); + zassert_within(pm_policy_next_event_ticks(), 200, 50); pm_policy_event_unregister(&evt1); + pm_policy_event_unregister(&evt2); } -#else -ZTEST(policy_api, test_pm_policy_events) -{ - ztest_test_skip(); -} -#endif /* CONFIG_PM_POLICY_CUSTOM */ ZTEST_SUITE(policy_api, NULL, NULL, NULL, NULL, NULL); From c99243c8cef17484911b4760c91c00667696b9be Mon Sep 17 00:00:00 2001 From: Sudan Landge Date: Mon, 28 Oct 2024 16:08:30 +0000 Subject: [PATCH 2655/4482] arch: arm: cleanup of soc flags in arch What is changed? Use CMSIS SystemCoreClock via a dedicated flag instead of using soc flags. Why do we need this change? This change is part of cleaning soc specific code out of arch folder. Signed-off-by: Sudan Landge --- arch/arm/core/cortex_m/timing.c | 3 +-- modules/cmsis/Kconfig | 5 +++++ soc/nordic/Kconfig | 1 + soc/nxp/imxrt/imxrt6xx/Kconfig.defconfig | 4 ++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/arm/core/cortex_m/timing.c b/arch/arm/core/cortex_m/timing.c index d56ef8780a421..6cb157552ace2 100644 --- a/arch/arm/core/cortex_m/timing.c +++ b/arch/arm/core/cortex_m/timing.c @@ -28,8 +28,7 @@ */ static inline uint64_t z_arm_dwt_freq_get(void) { -#if defined(CONFIG_SOC_FAMILY_NORDIC_NRF) || \ - defined(CONFIG_SOC_SERIES_IMXRT6XX) +#if defined(CONFIG_CMSIS_CORE_HAS_SYSTEM_CORE_CLOCK) /* * DWT frequency is taken directly from the * System Core clock (CPU) frequency, if the diff --git a/modules/cmsis/Kconfig b/modules/cmsis/Kconfig index eff0be6f40c29..aba63d35e1a86 100644 --- a/modules/cmsis/Kconfig +++ b/modules/cmsis/Kconfig @@ -28,4 +28,9 @@ config CMSIS_M_CHECK_DEVICE_DEFINES help This options enables the validation of CMSIS configuration flags. +config CMSIS_CORE_HAS_SYSTEM_CORE_CLOCK + bool + help + Enable this option if CMSIS SystemCoreClock symbols is available. + endif diff --git a/soc/nordic/Kconfig b/soc/nordic/Kconfig index e0063b858eda7..a13642172aa7b 100644 --- a/soc/nordic/Kconfig +++ b/soc/nordic/Kconfig @@ -9,6 +9,7 @@ config SOC_FAMILY_NORDIC_NRF select SOC_COMPATIBLE_NRF select SOC_RESET_HOOK if ARM + select CMSIS_CORE_HAS_SYSTEM_CORE_CLOCK if ARM if SOC_FAMILY_NORDIC_NRF diff --git a/soc/nxp/imxrt/imxrt6xx/Kconfig.defconfig b/soc/nxp/imxrt/imxrt6xx/Kconfig.defconfig index cd2b03f8eb078..9fb1afff72dd0 100644 --- a/soc/nxp/imxrt/imxrt6xx/Kconfig.defconfig +++ b/soc/nxp/imxrt/imxrt6xx/Kconfig.defconfig @@ -5,6 +5,10 @@ if SOC_SERIES_IMXRT6XX +config CMSIS_CORE_HAS_SYSTEM_CORE_CLOCK + bool + default y + # alias for hal config SOC_SERIES_IMX_RT6XX bool From 2493123758a44cd612d3c40660580264c2109454 Mon Sep 17 00:00:00 2001 From: Jonathon Penix Date: Tue, 29 Oct 2024 14:24:43 -0700 Subject: [PATCH 2656/4482] cmake: lld: Remove duplicate -fuse-ld=lld -fuse-ld=lld is currently specified twice through the baremetal property (in cmake/linker/lld/linker_flags.cmake) and TOOLCHAIN_LD_FLAGS (in cmake/linker/lld/target.cmake). This doesn't really harm anything as it isn't duplicated on the link line (and specifying it multiple times wouldn't hurt even if it was), but it also doesn't really help anything. -fuse-ld isn't baremetal-specific and setting it via TOOLCHAIN_LD_FLAGS will cover this case anyway, so remove this duplicate. Signed-off-by: Jonathon Penix --- cmake/linker/lld/linker_flags.cmake | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cmake/linker/lld/linker_flags.cmake b/cmake/linker/lld/linker_flags.cmake index 48085df44438c..6997f865d28d4 100644 --- a/cmake/linker/lld/linker_flags.cmake +++ b/cmake/linker/lld/linker_flags.cmake @@ -11,11 +11,6 @@ if(NOT CONFIG_NATIVE_LIBRARY AND NOT CONFIG_EXTERNAL_MODULE_LIBCPP) set_property(TARGET linker PROPERTY cpp_base ${LINKERFLAGPREFIX},-z,norelro) endif() -# Force LLVM to use built-in lld linker -if(NOT CONFIG_LLVM_USE_LD) - check_set_linker_property(TARGET linker APPEND PROPERTY baremetal -fuse-ld=lld) -endif() - set_property(TARGET linker PROPERTY no_position_independent "${LINKERFLAGPREFIX},--no-pie") set_property(TARGET linker PROPERTY lto_arguments) From 390f8329b44b441eed62bd34e8ddcdf38669fb33 Mon Sep 17 00:00:00 2001 From: Aaron Ye Date: Wed, 30 Oct 2024 16:54:35 +0800 Subject: [PATCH 2657/4482] dts: arm: ambiq: add ITM node for Apollo series This commit adds the ITM node for Ambiq Apollo3 and Apollo4 series devicetree. Signed-off-by: Aaron Ye --- dts/arm/ambiq/ambiq_apollo3_blue.dtsi | 8 ++++++++ dts/arm/ambiq/ambiq_apollo3p_blue.dtsi | 8 ++++++++ dts/arm/ambiq/ambiq_apollo4p.dtsi | 8 ++++++++ dts/arm/ambiq/ambiq_apollo4p_blue.dtsi | 8 ++++++++ 4 files changed, 32 insertions(+) diff --git a/dts/arm/ambiq/ambiq_apollo3_blue.dtsi b/dts/arm/ambiq/ambiq_apollo3_blue.dtsi index 14760d737b169..bc936a37040da 100644 --- a/dts/arm/ambiq/ambiq_apollo3_blue.dtsi +++ b/dts/arm/ambiq/ambiq_apollo3_blue.dtsi @@ -24,6 +24,14 @@ compatible = "arm,cortex-m4f"; reg = <0>; cpu-power-states = <&idle &suspend_to_ram>; + #address-cells = <1>; + #size-cells = <1>; + + itm: itm@e0000000 { + compatible = "arm,armv7m-itm"; + reg = <0xe0000000 0x1000>; + swo-ref-frequency = ; + }; }; power-states { diff --git a/dts/arm/ambiq/ambiq_apollo3p_blue.dtsi b/dts/arm/ambiq/ambiq_apollo3p_blue.dtsi index ef0f680c75b50..35656ac898dbb 100644 --- a/dts/arm/ambiq/ambiq_apollo3p_blue.dtsi +++ b/dts/arm/ambiq/ambiq_apollo3p_blue.dtsi @@ -24,6 +24,14 @@ compatible = "arm,cortex-m4f"; reg = <0>; cpu-power-states = <&idle &suspend_to_ram>; + #address-cells = <1>; + #size-cells = <1>; + + itm: itm@e0000000 { + compatible = "arm,armv7m-itm"; + reg = <0xe0000000 0x1000>; + swo-ref-frequency = ; + }; }; power-states { diff --git a/dts/arm/ambiq/ambiq_apollo4p.dtsi b/dts/arm/ambiq/ambiq_apollo4p.dtsi index 0688913cc20a8..c5641cfd352dc 100644 --- a/dts/arm/ambiq/ambiq_apollo4p.dtsi +++ b/dts/arm/ambiq/ambiq_apollo4p.dtsi @@ -24,6 +24,14 @@ compatible = "arm,cortex-m4f"; reg = <0>; cpu-power-states = <&idle &suspend_to_ram>; + #address-cells = <1>; + #size-cells = <1>; + + itm: itm@e0000000 { + compatible = "arm,armv7m-itm"; + reg = <0xe0000000 0x1000>; + swo-ref-frequency = ; + }; }; power-states { idle: idle { diff --git a/dts/arm/ambiq/ambiq_apollo4p_blue.dtsi b/dts/arm/ambiq/ambiq_apollo4p_blue.dtsi index 9fd6beacfad20..70f13bda5e94f 100644 --- a/dts/arm/ambiq/ambiq_apollo4p_blue.dtsi +++ b/dts/arm/ambiq/ambiq_apollo4p_blue.dtsi @@ -32,6 +32,14 @@ cpu0: cpu@0 { compatible = "arm,cortex-m4f"; reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + + itm: itm@e0000000 { + compatible = "arm,armv7m-itm"; + reg = <0xe0000000 0x1000>; + swo-ref-frequency = ; + }; }; }; From fe3c0ecb5330ec0fb13708159c2fccf0056963bb Mon Sep 17 00:00:00 2001 From: Aaron Ye Date: Wed, 30 Oct 2024 15:15:38 +0800 Subject: [PATCH 2658/4482] boards: ambiq: enable the ITM in Ambiq boards This commit defines the default pinctrl of ITM for Apollo3 and Apollo4 EVB. Also configures the default SWO frequency. Signed-off-by: Aaron Ye --- boards/ambiq/apollo3_evb/Kconfig.defconfig | 11 +++++++++++ boards/ambiq/apollo3_evb/apollo3_evb-pinctrl.dtsi | 5 +++++ boards/ambiq/apollo3_evb/apollo3_evb.dts | 6 ++++++ boards/ambiq/apollo3p_evb/Kconfig.defconfig | 11 +++++++++++ boards/ambiq/apollo3p_evb/apollo3p_evb-pinctrl.dtsi | 5 +++++ boards/ambiq/apollo3p_evb/apollo3p_evb.dts | 6 ++++++ boards/ambiq/apollo4p_blue_kxr_evb/Kconfig.defconfig | 4 ++++ .../apollo4p_blue_kxr_evb-pinctrl.dtsi | 5 +++++ .../apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts | 6 ++++++ boards/ambiq/apollo4p_evb/Kconfig.defconfig | 11 +++++++++++ boards/ambiq/apollo4p_evb/apollo4p_evb-pinctrl.dtsi | 5 +++++ boards/ambiq/apollo4p_evb/apollo4p_evb.dts | 6 ++++++ 12 files changed, 81 insertions(+) create mode 100644 boards/ambiq/apollo3_evb/Kconfig.defconfig create mode 100644 boards/ambiq/apollo3p_evb/Kconfig.defconfig create mode 100644 boards/ambiq/apollo4p_evb/Kconfig.defconfig diff --git a/boards/ambiq/apollo3_evb/Kconfig.defconfig b/boards/ambiq/apollo3_evb/Kconfig.defconfig new file mode 100644 index 0000000000000..b878e32dc36da --- /dev/null +++ b/boards/ambiq/apollo3_evb/Kconfig.defconfig @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2024 Ambiq Micro Inc. + +if BOARD_APOLLO3_EVB + +config LOG_BACKEND_SWO_FREQ_HZ + default 1000000 + depends on LOG_BACKEND_SWO + +endif # BOARD_APOLLO3_EVB diff --git a/boards/ambiq/apollo3_evb/apollo3_evb-pinctrl.dtsi b/boards/ambiq/apollo3_evb/apollo3_evb-pinctrl.dtsi index 366e914cc423d..26cf5e58063ea 100644 --- a/boards/ambiq/apollo3_evb/apollo3_evb-pinctrl.dtsi +++ b/boards/ambiq/apollo3_evb/apollo3_evb-pinctrl.dtsi @@ -17,6 +17,11 @@ input-enable; }; }; + itm_default: itm_default { + group1 { + pinmux = ; + }; + }; i2c0_default: i2c0_default { group1 { pinmux = , ; diff --git a/boards/ambiq/apollo3_evb/apollo3_evb.dts b/boards/ambiq/apollo3_evb/apollo3_evb.dts index dc8a110b9c0f5..90d5f3d7176f4 100644 --- a/boards/ambiq/apollo3_evb/apollo3_evb.dts +++ b/boards/ambiq/apollo3_evb/apollo3_evb.dts @@ -98,6 +98,12 @@ status = "okay"; }; +&itm { + pinctrl-0 = <&itm_default>; + pinctrl-names = "default"; + status = "okay"; +}; + &wdt0 { status = "okay"; }; diff --git a/boards/ambiq/apollo3p_evb/Kconfig.defconfig b/boards/ambiq/apollo3p_evb/Kconfig.defconfig new file mode 100644 index 0000000000000..1d3f4f6fe3291 --- /dev/null +++ b/boards/ambiq/apollo3p_evb/Kconfig.defconfig @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2024 Ambiq Micro Inc. + +if BOARD_APOLLO3P_EVB + +config LOG_BACKEND_SWO_FREQ_HZ + default 1000000 + depends on LOG_BACKEND_SWO + +endif # BOARD_APOLLO3P_EVB diff --git a/boards/ambiq/apollo3p_evb/apollo3p_evb-pinctrl.dtsi b/boards/ambiq/apollo3p_evb/apollo3p_evb-pinctrl.dtsi index 3dfd7227dac5e..3eea582a37248 100644 --- a/boards/ambiq/apollo3p_evb/apollo3p_evb-pinctrl.dtsi +++ b/boards/ambiq/apollo3p_evb/apollo3p_evb-pinctrl.dtsi @@ -17,6 +17,11 @@ input-enable; }; }; + itm_default: itm_default { + group1 { + pinmux = ; + }; + }; i2c0_default: i2c0_default { group1 { pinmux = , ; diff --git a/boards/ambiq/apollo3p_evb/apollo3p_evb.dts b/boards/ambiq/apollo3p_evb/apollo3p_evb.dts index ed463af3d6e49..0232c7f87d7b1 100644 --- a/boards/ambiq/apollo3p_evb/apollo3p_evb.dts +++ b/boards/ambiq/apollo3p_evb/apollo3p_evb.dts @@ -98,6 +98,12 @@ status = "okay"; }; +&itm { + pinctrl-0 = <&itm_default>; + pinctrl-names = "default"; + status = "okay"; +}; + &wdt0 { status = "okay"; }; diff --git a/boards/ambiq/apollo4p_blue_kxr_evb/Kconfig.defconfig b/boards/ambiq/apollo4p_blue_kxr_evb/Kconfig.defconfig index 5d16de3a1ca0d..d2ff34a02d9bd 100644 --- a/boards/ambiq/apollo4p_blue_kxr_evb/Kconfig.defconfig +++ b/boards/ambiq/apollo4p_blue_kxr_evb/Kconfig.defconfig @@ -4,6 +4,10 @@ if BOARD_APOLLO4P_BLUE_KXR_EVB +config LOG_BACKEND_SWO_FREQ_HZ + default 1000000 + depends on LOG_BACKEND_SWO + if BT config MAIN_STACK_SIZE diff --git a/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb-pinctrl.dtsi b/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb-pinctrl.dtsi index 1d64b010f6065..f8c20b0fad982 100644 --- a/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb-pinctrl.dtsi +++ b/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb-pinctrl.dtsi @@ -16,6 +16,11 @@ input-enable; }; }; + itm_default: itm_default { + group1 { + pinmux = ; + }; + }; i2c0_default: i2c0_default { group1 { pinmux = , ; diff --git a/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts b/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts index 02a6aa55c7413..4df01cb5a6d69 100644 --- a/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts +++ b/boards/ambiq/apollo4p_blue_kxr_evb/apollo4p_blue_kxr_evb.dts @@ -69,6 +69,12 @@ status = "okay"; }; +&itm { + pinctrl-0 = <&itm_default>; + pinctrl-names = "default"; + status = "okay"; +}; + &counter0 { status = "okay"; }; diff --git a/boards/ambiq/apollo4p_evb/Kconfig.defconfig b/boards/ambiq/apollo4p_evb/Kconfig.defconfig new file mode 100644 index 0000000000000..61533f15f90c5 --- /dev/null +++ b/boards/ambiq/apollo4p_evb/Kconfig.defconfig @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2024 Ambiq Micro Inc. + +if BOARD_APOLLO4P_EVB + +config LOG_BACKEND_SWO_FREQ_HZ + default 1000000 + depends on LOG_BACKEND_SWO + +endif # BOARD_APOLLO4P_EVB diff --git a/boards/ambiq/apollo4p_evb/apollo4p_evb-pinctrl.dtsi b/boards/ambiq/apollo4p_evb/apollo4p_evb-pinctrl.dtsi index 125e1a7d238c7..dbbb233485e9f 100644 --- a/boards/ambiq/apollo4p_evb/apollo4p_evb-pinctrl.dtsi +++ b/boards/ambiq/apollo4p_evb/apollo4p_evb-pinctrl.dtsi @@ -17,6 +17,11 @@ input-enable; }; }; + itm_default: itm_default { + group1 { + pinmux = ; + }; + }; adc0_default: adc0_default{ group1 { pinmux = , ; diff --git a/boards/ambiq/apollo4p_evb/apollo4p_evb.dts b/boards/ambiq/apollo4p_evb/apollo4p_evb.dts index 7710eb287e890..4a35a3de86eb7 100644 --- a/boards/ambiq/apollo4p_evb/apollo4p_evb.dts +++ b/boards/ambiq/apollo4p_evb/apollo4p_evb.dts @@ -69,6 +69,12 @@ status = "okay"; }; +&itm { + pinctrl-0 = <&itm_default>; + pinctrl-names = "default"; + status = "okay"; +}; + &adc0 { compatible = "ambiq,adc"; pinctrl-0 = <&adc0_default>; From f7b26381651320ad8e5ce212b46a668e6b8ed8fd Mon Sep 17 00:00:00 2001 From: Aaron Ye Date: Wed, 30 Oct 2024 14:48:15 +0800 Subject: [PATCH 2659/4482] soc: ambiq: enable the TPIU clock source This commit enables the TPIU clock source in Apollo3 and Apollo4 soc initialization if LOG_BACKEND_SWO is used. Signed-off-by: Aaron Ye --- soc/ambiq/apollo3x/soc.c | 6 ++++++ soc/ambiq/apollo4x/soc.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/soc/ambiq/apollo3x/soc.c b/soc/ambiq/apollo3x/soc.c index bae475e814fd5..33bf6568d37eb 100644 --- a/soc/ambiq/apollo3x/soc.c +++ b/soc/ambiq/apollo3x/soc.c @@ -28,4 +28,10 @@ void soc_early_init_hook(void) #ifdef CONFIG_PM ambiq_power_init(); #endif + +#ifdef CONFIG_LOG_BACKEND_SWO + /* Select HFRC/8 (6MHz) for the TPIU clock source */ + MCUCTRL->TPIUCTRL_b.CLKSEL = MCUCTRL_TPIUCTRL_CLKSEL_HFRCDIV8; + MCUCTRL->TPIUCTRL_b.ENABLE = MCUCTRL_TPIUCTRL_ENABLE_EN; +#endif } diff --git a/soc/ambiq/apollo4x/soc.c b/soc/ambiq/apollo4x/soc.c index b434e20f0ee56..5338a2e2f5f82 100644 --- a/soc/ambiq/apollo4x/soc.c +++ b/soc/ambiq/apollo4x/soc.c @@ -23,4 +23,10 @@ void soc_early_init_hook(void) #ifdef CONFIG_PM ambiq_power_init(); #endif + +#ifdef CONFIG_LOG_BACKEND_SWO + /* Select HFRC 48MHz for the TPIU clock source */ + MCUCTRL->DBGCTRL_b.CM4CLKSEL = MCUCTRL_DBGCTRL_CM4CLKSEL_HFRC48; + MCUCTRL->DBGCTRL_b.CM4TPIUENABLE = MCUCTRL_DBGCTRL_CM4TPIUENABLE_EN; +#endif } From 43149c1056ea33220686bdcd238f7a2595cfb45c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Mon, 4 Nov 2024 12:26:33 +0100 Subject: [PATCH 2660/4482] Bluetooth: host: refactor bt_gatt_is_subscribed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactors `bt_gatt_is_subscribed` by changing a CHECKIF to an if statement to avoid undefined behavior if CHECKIFs are "disabled". Uses sizeof(a uint8_t) instead of 1 to avoid magic numbers. Initializes `properties` to 0 to avoid undefined behavior. Signed-off-by: Håvard Reierstad --- subsys/bluetooth/host/gatt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index 23f158bdf2fa2..ca92e6786d994 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -3484,19 +3484,19 @@ bool bt_gatt_is_subscribed(struct bt_conn *conn, /* Check if attribute is a characteristic declaration */ if (!bt_uuid_cmp(attr->uuid, BT_UUID_GATT_CHRC)) { - uint8_t properties; + uint8_t properties = 0; ssize_t len; - CHECKIF(!attr->read) { + if (!attr->read) { LOG_ERR("Read method not set"); return false; } /* The charactestic properties is the first byte of the attribute value */ - len = attr->read(NULL, attr, &properties, 1, 0); + len = attr->read(NULL, attr, &properties, sizeof(properties), 0); if (len < 0) { LOG_ERR("Failed to read attribute (err %zd)", len); return false; - } else if (len != 1) { + } else if (len != sizeof(properties)) { LOG_ERR("Invalid read length: %zd", len); return false; } From 68361eacfa0da01e5feb32b8efd9c378029ee801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Mon, 4 Nov 2024 12:41:00 +0100 Subject: [PATCH 2661/4482] Bluetooth: Host: Fix unsafe ccc cast MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes the implementation of `bt_gatt_is_subscribed` to use the attribute read method instead of casting the user data pointer when extracting the CCC Attribute Value. Signed-off-by: Håvard Reierstad --- subsys/bluetooth/host/gatt.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index ca92e6786d994..926337dd76133 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -3473,7 +3473,9 @@ static uint8_t disconnected_cb(const struct bt_gatt_attr *attr, uint16_t handle, bool bt_gatt_is_subscribed(struct bt_conn *conn, const struct bt_gatt_attr *attr, uint16_t ccc_type) { - const struct _bt_gatt_ccc *ccc; + uint16_t ccc_bits; + uint8_t ccc_bits_encoded[sizeof(ccc_bits)]; + ssize_t len; __ASSERT(conn, "invalid parameter\n"); __ASSERT(attr, "invalid parameter\n"); @@ -3484,8 +3486,7 @@ bool bt_gatt_is_subscribed(struct bt_conn *conn, /* Check if attribute is a characteristic declaration */ if (!bt_uuid_cmp(attr->uuid, BT_UUID_GATT_CHRC)) { - uint8_t properties = 0; - ssize_t len; + uint8_t properties; if (!attr->read) { LOG_ERR("Read method not set"); @@ -3494,7 +3495,7 @@ bool bt_gatt_is_subscribed(struct bt_conn *conn, /* The charactestic properties is the first byte of the attribute value */ len = attr->read(NULL, attr, &properties, sizeof(properties), 0); if (len < 0) { - LOG_ERR("Failed to read attribute (err %zd)", len); + LOG_ERR("Failed to read attribute %p (err %zd)", attr, len); return false; } else if (len != sizeof(properties)) { LOG_ERR("Invalid read length: %zd", len); @@ -3532,16 +3533,25 @@ bool bt_gatt_is_subscribed(struct bt_conn *conn, return false; } - ccc = attr->user_data; + if (!attr->read) { + LOG_ERR("Read method not set"); + return false; + } - /* Check if the connection is subscribed */ - for (size_t i = 0; i < BT_GATT_CCC_MAX; i++) { - const struct bt_gatt_ccc_cfg *cfg = &ccc->cfg[i]; + len = attr->read(conn, attr, ccc_bits_encoded, sizeof(ccc_bits_encoded), 0); + if (len < 0) { + LOG_ERR("Failed to read attribute %p (err %zd)", attr, len); + return false; + } else if (len != sizeof(ccc_bits_encoded)) { + LOG_ERR("Invalid read length: %zd", len); + return false; + } - if (bt_conn_is_peer_addr_le(conn, cfg->id, &cfg->peer) && - (ccc_type & ccc->cfg[i].value)) { - return true; - } + ccc_bits = sys_get_le16(ccc_bits_encoded); + + /* Check if the CCC bits match the subscription type */ + if (ccc_bits & ccc_type) { + return true; } return false; From a6cca606dbf44683cffecf135b211f85809ab68d Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Sun, 17 Nov 2024 14:44:41 +0000 Subject: [PATCH 2662/4482] mgmt: mcumgr: transport: smp_lorawan: Update downlink function Updates the function to account for a change in the arguments Signed-off-by: Jamie McCrae --- subsys/mgmt/mcumgr/transport/src/smp_lorawan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/mgmt/mcumgr/transport/src/smp_lorawan.c b/subsys/mgmt/mcumgr/transport/src/smp_lorawan.c index 7e5864500f1b1..e6d330d01bbdf 100644 --- a/subsys/mgmt/mcumgr/transport/src/smp_lorawan.c +++ b/subsys/mgmt/mcumgr/transport/src/smp_lorawan.c @@ -16,7 +16,7 @@ LOG_MODULE_REGISTER(smp_lorawan, CONFIG_MCUMGR_TRANSPORT_LORAWAN_LOG_LEVEL); -static void smp_lorawan_downlink(uint8_t port, bool data_pending, int16_t rssi, int8_t snr, +static void smp_lorawan_downlink(uint8_t port, uint8_t flags, int16_t rssi, int8_t snr, uint8_t len, const uint8_t *hex_data); static int smp_lorawan_uplink(struct net_buf *nb); @@ -122,10 +122,10 @@ static void smp_lorawan_uplink_thread(void *p1, void *p2, void *p3) } #endif -static void smp_lorawan_downlink(uint8_t port, bool data_pending, int16_t rssi, int8_t snr, +static void smp_lorawan_downlink(uint8_t port, uint8_t flags, int16_t rssi, int8_t snr, uint8_t len, const uint8_t *hex_data) { - ARG_UNUSED(data_pending); + ARG_UNUSED(flags); ARG_UNUSED(rssi); ARG_UNUSED(snr); From 410c8a57e09df46751ca616eae2bf4ed80b7a1f1 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Sun, 17 Nov 2024 19:04:16 -0500 Subject: [PATCH 2663/4482] boards: m5stack/m5stack_cores3: disable in twister Do not run this board with twister. Temporary fix while we wait for a fix. Signed-off-by: Anas Nashif --- boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.yaml | 1 + boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.yaml b/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.yaml index 19e6b770c68f3..fcf856b1fa4cb 100644 --- a/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.yaml +++ b/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.yaml @@ -1,6 +1,7 @@ identifier: m5stack_cores3/esp32s3/appcpu name: M5Stack CoreS3 APPCPU type: mcu +twister: false arch: xtensa toolchain: - zephyr diff --git a/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.yaml b/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.yaml index e0e1f9c32cb7d..15da2ed086727 100644 --- a/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.yaml +++ b/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.yaml @@ -1,6 +1,7 @@ identifier: m5stack_cores3/esp32s3/procpu name: M5Stack CoreS3 PROCPU type: mcu +twister: false arch: xtensa toolchain: - zephyr From 13a2f42d50d79272a55c4b54202fe4ee3032e25a Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Wed, 23 Oct 2024 18:06:00 +0100 Subject: [PATCH 2664/4482] input: kbd_matrix: implement stable poll period support Implement a new stable-poll-period-ms property to specify a new (slower) polling rate for when the matrix is stable. The keyboard thread can eat up a surprisingly high amount of cpu cycles in busy waiting if the specific hardware implementation happen to have a particularly slow settle time, but high frequency polling is really only needed when debouncing. The new property allow slowing down the polling rate when the matrix is stable (either key pressed but none to be debounced or idle in the case of the gpio implementation with no interrupts), this allows reducing the overall cpu time taken by the keyboard scanning thread when keys are persistently pressed. Signed-off-by: Fabio Baltieri --- drivers/input/input_gpio_kbd_matrix.c | 4 ++-- drivers/input/input_kbd_matrix.c | 24 ++++++++++++++++++++--- dts/bindings/input/kbd-matrix-common.yaml | 6 ++++++ include/zephyr/input/input_kbd_matrix.h | 4 ++++ 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/drivers/input/input_gpio_kbd_matrix.c b/drivers/input/input_gpio_kbd_matrix.c index 2ad1a08a033ea..3671b9de4d835 100644 --- a/drivers/input/input_gpio_kbd_matrix.c +++ b/drivers/input/input_gpio_kbd_matrix.c @@ -121,7 +121,7 @@ static __maybe_unused void gpio_kbd_matrix_idle_poll_handler(const struct device if (gpio_kbd_matrix_read_row(dev) == 0) { k_work_reschedule(cfg->idle_poll_dwork, - K_USEC(common->poll_period_us)); + K_USEC(common->stable_poll_period_us)); return; } @@ -137,7 +137,7 @@ static void gpio_kbd_matrix_set_detect_mode(const struct device *dev, bool enabl if (cfg->idle_poll_dwork != NULL) { if (enabled) { k_work_reschedule(cfg->idle_poll_dwork, - K_USEC(common->poll_period_us)); + K_USEC(common->stable_poll_period_us)); } return; } diff --git a/drivers/input/input_kbd_matrix.c b/drivers/input/input_kbd_matrix.c index ae96c49f4474a..747749a958b94 100644 --- a/drivers/input/input_kbd_matrix.c +++ b/drivers/input/input_kbd_matrix.c @@ -264,6 +264,19 @@ static k_timepoint_t input_kbd_matrix_poll_timeout(const struct device *dev) return sys_timepoint_calc(K_MSEC(cfg->poll_timeout_ms)); } +static bool input_kbd_matrix_is_unstable(const struct device *dev) +{ + const struct input_kbd_matrix_common_config *cfg = dev->config; + + for (uint8_t c = 0; c < cfg->col_size; c++) { + if (cfg->matrix_unstable_state[c] != 0) { + return true; + } + } + + return false; +} + static void input_kbd_matrix_poll(const struct device *dev) { const struct input_kbd_matrix_common_config *cfg = dev->config; @@ -271,6 +284,7 @@ static void input_kbd_matrix_poll(const struct device *dev) uint32_t current_cycles; uint32_t cycles_diff; uint32_t wait_period_us; + uint32_t poll_period_us; poll_time_end = input_kbd_matrix_poll_timeout(dev); @@ -289,10 +303,14 @@ static void input_kbd_matrix_poll(const struct device *dev) */ current_cycles = k_cycle_get_32(); cycles_diff = current_cycles - start_period_cycles; - wait_period_us = cfg->poll_period_us - k_cyc_to_us_floor32(cycles_diff); - wait_period_us = CLAMP(wait_period_us, - USEC_PER_MSEC, cfg->poll_period_us); + if (input_kbd_matrix_is_unstable(dev)) { + poll_period_us = cfg->poll_period_us; + } else { + poll_period_us = cfg->stable_poll_period_us; + } + wait_period_us = CLAMP(poll_period_us - k_cyc_to_us_floor32(cycles_diff), + USEC_PER_MSEC, poll_period_us); LOG_DBG("wait_period_us: %d", wait_period_us); diff --git a/dts/bindings/input/kbd-matrix-common.yaml b/dts/bindings/input/kbd-matrix-common.yaml index 075c217fe4d85..b5f4988a16850 100644 --- a/dts/bindings/input/kbd-matrix-common.yaml +++ b/dts/bindings/input/kbd-matrix-common.yaml @@ -23,6 +23,12 @@ properties: Defines the poll period in msecs between between matrix scans, set to 0 to never exit poll mode. Defaults to 5ms if unspecified. + stable-poll-period-ms: + type: int + description: | + Defines the poll period in msecs between matrix scans when the matrix is + stable, defaults to poll-period-ms value if unspecified. + poll-timeout-ms: type: int default: 100 diff --git a/include/zephyr/input/input_kbd_matrix.h b/include/zephyr/input/input_kbd_matrix.h index 001bd8d965c7a..16391d8fa16e1 100644 --- a/include/zephyr/input/input_kbd_matrix.h +++ b/include/zephyr/input/input_kbd_matrix.h @@ -113,6 +113,7 @@ struct input_kbd_matrix_common_config { uint8_t row_size; uint8_t col_size; uint32_t poll_period_us; + uint32_t stable_poll_period_us; uint32_t poll_timeout_ms; uint32_t debounce_down_us; uint32_t debounce_up_us; @@ -192,6 +193,9 @@ struct input_kbd_matrix_common_config { .row_size = _row_size, \ .col_size = _col_size, \ .poll_period_us = DT_PROP(node_id, poll_period_ms) * USEC_PER_MSEC, \ + .stable_poll_period_us = DT_PROP_OR(node_id, stable_poll_period_ms, \ + DT_PROP(node_id, poll_period_ms)) * \ + USEC_PER_MSEC, \ .poll_timeout_ms = DT_PROP(node_id, poll_timeout_ms), \ .debounce_down_us = DT_PROP(node_id, debounce_down_ms) * USEC_PER_MSEC, \ .debounce_up_us = DT_PROP(node_id, debounce_up_ms) * USEC_PER_MSEC, \ From 62e06a50729a4890725716341743cb9e74df476f Mon Sep 17 00:00:00 2001 From: Kapil Bhatt Date: Wed, 23 Oct 2024 18:02:32 +0530 Subject: [PATCH 2665/4482] drivers: wifi: Fix offloaded raw TX feature flags Pass passive scan and offloaded raw tx feature flags to OSAL. Signed-off-by: Kapil Bhatt --- drivers/wifi/nrfwifi/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/wifi/nrfwifi/CMakeLists.txt b/drivers/wifi/nrfwifi/CMakeLists.txt index 17ec7176cb269..2e04398c892a9 100644 --- a/drivers/wifi/nrfwifi/CMakeLists.txt +++ b/drivers/wifi/nrfwifi/CMakeLists.txt @@ -305,6 +305,14 @@ zephyr_compile_definitions_ifdef(CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS -DWIFI_MGMT_RAW_SCAN_RESULTS=${CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS} ) +zephyr_compile_definitions_ifdef(CONFIG_NRF70_OFFLOADED_RAW_TX + -DNRF_NRF70_OFFLOADED_RAW_TX +) + +zephyr_compile_definitions_ifdef(CONFIG_NRF70_PASSIVE_SCAN_ONLY + -DNRF70_PASSIVE_SCAN_ONLY +) + zephyr_compile_definitions( -DNRF70_RX_NUM_BUFS=${CONFIG_NRF70_RX_NUM_BUFS} -DNRF70_MAX_TX_TOKENS=${CONFIG_NRF70_MAX_TX_TOKENS} From f537cf311d7ad19ba00221f9022b7dc4c2daef43 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 28 Oct 2024 14:05:58 +0530 Subject: [PATCH 2666/4482] drivers: nrfwifi: Remove passing unused flag This flag is now unused in OSAL as it takes the input via the API. Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/wifi/nrfwifi/CMakeLists.txt b/drivers/wifi/nrfwifi/CMakeLists.txt index 2e04398c892a9..439263ec6151e 100644 --- a/drivers/wifi/nrfwifi/CMakeLists.txt +++ b/drivers/wifi/nrfwifi/CMakeLists.txt @@ -319,7 +319,6 @@ zephyr_compile_definitions( -DNRF70_RX_MAX_DATA_SIZE=${CONFIG_NRF70_RX_MAX_DATA_SIZE} -DNRF70_MAX_TX_PENDING_QLEN=${CONFIG_NRF70_MAX_TX_PENDING_QLEN} -DNRF70_RPU_PS_IDLE_TIMEOUT_MS=${CONFIG_NRF70_RPU_PS_IDLE_TIMEOUT_MS} - -DNRF70_REG_DOMAIN=${CONFIG_NRF70_REG_DOMAIN} -DNRF70_BAND_2G_LOWER_EDGE_BACKOFF_DSSS=${CONFIG_NRF70_BAND_2G_LOWER_EDGE_BACKOFF_DSSS} -DNRF70_BAND_2G_LOWER_EDGE_BACKOFF_HT=${CONFIG_NRF70_BAND_2G_LOWER_EDGE_BACKOFF_HT} -DNRF70_BAND_2G_LOWER_EDGE_BACKOFF_HE=${CONFIG_NRF70_BAND_2G_LOWER_EDGE_BACKOFF_HE} From a732379d62d9033cdbce37362c32314c5c0c3c75 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 14 Nov 2024 07:12:51 -0500 Subject: [PATCH 2667/4482] tests: display: cfb: fix filtering Test was marked build only with filters in each scenario looking for sdl-dc which is only available on native_sim, so cut the chase and use platform_only to narrow things down to native_sim directly instead of building the world to get information we already know. reduces build/run time from 78s to 17s on invocation of twister with default options, saves a ton more when running twister with --all. Signed-off-by: Anas Nashif --- tests/subsys/display/cfb/basic/testcase.yaml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tests/subsys/display/cfb/basic/testcase.yaml b/tests/subsys/display/cfb/basic/testcase.yaml index 21cf13c54931e..6d4b2e1f3b661 100644 --- a/tests/subsys/display/cfb/basic/testcase.yaml +++ b/tests/subsys/display/cfb/basic/testcase.yaml @@ -6,52 +6,45 @@ common: - display - drivers - cfb - filter: dt_chosen_enabled("zephyr,display") - build_only: true # The CI environment has no display device + harness: display + platform_allow: + - native_sim tests: display.cfb.basic.mono01: - filter: dt_compat_enabled("zephyr,sdl-dc") extra_configs: - CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_MONO01=y - CONFIG_SDL_DISPLAY_USE_HARDWARE_ACCELERATOR=n display.cfb.basic.mono10: - filter: dt_compat_enabled("zephyr,sdl-dc") extra_configs: - CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_MONO10=y - CONFIG_SDL_DISPLAY_USE_HARDWARE_ACCELERATOR=n display.cfb.basic.mono01.lsbfirst: - filter: dt_compat_enabled("zephyr,sdl-dc") extra_configs: - CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_MONO01=y - CONFIG_SDL_DISPLAY_USE_HARDWARE_ACCELERATOR=n - CONFIG_SDL_DISPLAY_MONO_MSB_FIRST=n display.cfb.basic.mono10.lsbfirst: - filter: dt_compat_enabled("zephyr,sdl-dc") extra_configs: - CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_MONO10=y - CONFIG_SDL_DISPLAY_USE_HARDWARE_ACCELERATOR=n - CONFIG_SDL_DISPLAY_MONO_MSB_FIRST=n display.cfb.basic.mono01.msbfirst_font: - filter: dt_compat_enabled("zephyr,sdl-dc") extra_configs: - CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_MONO01=y - CONFIG_SDL_DISPLAY_USE_HARDWARE_ACCELERATOR=n - CONFIG_TEST_MSB_FIRST_FONT=y display.cfb.basic.mono10.msbfirst_font: - filter: dt_compat_enabled("zephyr,sdl-dc") extra_configs: - CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_MONO10=y - CONFIG_SDL_DISPLAY_USE_HARDWARE_ACCELERATOR=n - CONFIG_TEST_MSB_FIRST_FONT=y display.cfb.basic.mono01.lsbfirst.msbfirst_font: - filter: dt_compat_enabled("zephyr,sdl-dc") extra_configs: - CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_MONO01=y - CONFIG_SDL_DISPLAY_USE_HARDWARE_ACCELERATOR=n - CONFIG_SDL_DISPLAY_MONO_MSB_FIRST=n - CONFIG_TEST_MSB_FIRST_FONT=y display.cfb.basic.mono10.lsbfirst.msbfirst_font: - filter: dt_compat_enabled("zephyr,sdl-dc") extra_configs: - CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_MONO10=y - CONFIG_SDL_DISPLAY_USE_HARDWARE_ACCELERATOR=n From 93a9a0966ea78b119d6b6fcd7814ffcef6f2113b Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Sun, 17 Nov 2024 22:55:18 -0500 Subject: [PATCH 2668/4482] tests: posix: common: mitigate warning for qemu_arc_em Previously, twister would fail due to a warning being escalated to an error because CONFIG_NET_TEST was set. Signed-off-by: Chris Friedt --- tests/posix/common/prj.conf | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/posix/common/prj.conf b/tests/posix/common/prj.conf index 94f671badcfb6..130e950f754c6 100644 --- a/tests/posix/common/prj.conf +++ b/tests/posix/common/prj.conf @@ -24,7 +24,3 @@ CONFIG_XSI_SYSTEM_LOGGING=y # for sched_get_priority_min(), sched_get_priority_max() CONFIG_POSIX_PRIORITY_SCHEDULING=y - -# for networking -CONFIG_NET_TEST=y -CONFIG_TEST_RANDOM_GENERATOR=y From ea23856336f4744448afa212109e5d747b437ea4 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Thu, 14 Nov 2024 11:57:36 +0800 Subject: [PATCH 2669/4482] drivers: intc: plic: remove incorrect arch_proc_id() usage The `arch_proc_id()` returns the hartid of a CPU, which may not start from zero. The way that it's used as an index to access `save_irq[]` array is wrong, use `arch_curr_cpu()->id` instead. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- drivers/interrupt_controller/intc_plic.c | 6 +++--- include/zephyr/drivers/interrupt_controller/riscv_plic.h | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/interrupt_controller/intc_plic.c b/drivers/interrupt_controller/intc_plic.c index 1b958ce0eb5a1..af16592d982a7 100644 --- a/drivers/interrupt_controller/intc_plic.c +++ b/drivers/interrupt_controller/intc_plic.c @@ -388,7 +388,7 @@ void riscv_plic_irq_set_pending(uint32_t irq) */ unsigned int riscv_plic_get_irq(void) { - return save_irq[arch_proc_id()]; + return save_irq[arch_curr_cpu()->id]; } /** @@ -400,7 +400,7 @@ unsigned int riscv_plic_get_irq(void) */ const struct device *riscv_plic_get_dev(void) { - return save_dev[arch_proc_id()]; + return save_dev[arch_curr_cpu()->id]; } #ifdef CONFIG_PLIC_IRQ_AFFINITY @@ -485,7 +485,7 @@ static void plic_irq_handler(const struct device *dev) const struct plic_config *config = dev->config; mem_addr_t claim_complete_addr = get_claim_complete_addr(dev); struct _isr_table_entry *ite; - uint32_t cpu_id = arch_proc_id(); + uint32_t cpu_id = arch_curr_cpu()->id; /* Get the IRQ number generating the interrupt */ const uint32_t local_irq = sys_read32(claim_complete_addr); diff --git a/include/zephyr/drivers/interrupt_controller/riscv_plic.h b/include/zephyr/drivers/interrupt_controller/riscv_plic.h index 3bd7be3afc5b9..ff273d9fbbf45 100644 --- a/include/zephyr/drivers/interrupt_controller/riscv_plic.h +++ b/include/zephyr/drivers/interrupt_controller/riscv_plic.h @@ -64,6 +64,8 @@ void riscv_plic_irq_set_pending(uint32_t irq); /** * @brief Get active interrupt ID * + * @note Should be called with interrupt locked + * * @return Returns the ID of an active interrupt */ unsigned int riscv_plic_get_irq(void); @@ -71,6 +73,8 @@ unsigned int riscv_plic_get_irq(void); /** * @brief Get active interrupt controller device * + * @note Should be called with interrupt locked + * * @return Returns device pointer of the active interrupt device */ const struct device *riscv_plic_get_dev(void); From 15d357df87e4635b3d01f5c38adfddc71f69f9e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Arg=C3=BCelles?= Date: Thu, 14 Nov 2024 09:42:21 +0700 Subject: [PATCH 2670/4482] soc: nxp: s32k: make the SoCs SEGGER RTT capable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SEGGER RTT is supported for NXP S32K1 and S32K3 devices. Fixes #74702 Signed-off-by: Manuel Argüelles --- soc/nxp/s32/s32k1/Kconfig | 1 + soc/nxp/s32/s32k3/Kconfig | 1 + 2 files changed, 2 insertions(+) diff --git a/soc/nxp/s32/s32k1/Kconfig b/soc/nxp/s32/s32k1/Kconfig index 2bb3a2719046b..f405124f03e3c 100644 --- a/soc/nxp/s32/s32k1/Kconfig +++ b/soc/nxp/s32/s32k1/Kconfig @@ -20,6 +20,7 @@ config SOC_SERIES_S32K1 select HAS_MCUX_RTC select HAS_MCUX_ADC12 select SOC_EARLY_INIT_HOOK + select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE config SOC_S32K116 select CPU_CORTEX_M0PLUS diff --git a/soc/nxp/s32/s32k3/Kconfig b/soc/nxp/s32/s32k3/Kconfig index 627898f7231ab..4dd0a9a29a46b 100644 --- a/soc/nxp/s32/s32k3/Kconfig +++ b/soc/nxp/s32/s32k3/Kconfig @@ -23,6 +23,7 @@ config SOC_SERIES_S32K3 select HAS_MCUX_CACHE select HAS_MCUX_EDMA select SOC_EARLY_INIT_HOOK + select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE if SOC_SERIES_S32K3 From 3da2629715b5e68e9ff9b6f6cad3d58d39cd4727 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 1 Nov 2024 15:56:52 +0200 Subject: [PATCH 2671/4482] net: ip: pmtu: Add generic IP PMTU Discovery support This adds generic code that can be used by both IPv4 and IPv6 Path MTU Discovery mechanism. The actual PMTU support for each protocol family is in subsequent commits. Signed-off-by: Jukka Rissanen --- subsys/net/ip/CMakeLists.txt | 1 + subsys/net/ip/Kconfig | 13 ++ subsys/net/ip/Kconfig.ipv4 | 12 ++ subsys/net/ip/Kconfig.ipv6 | 12 ++ subsys/net/ip/net_core.c | 3 + subsys/net/ip/pmtu.c | 249 +++++++++++++++++++++++++++++++++++ subsys/net/ip/pmtu.h | 144 ++++++++++++++++++++ 7 files changed, 434 insertions(+) create mode 100644 subsys/net/ip/pmtu.c create mode 100644 subsys/net/ip/pmtu.h diff --git a/subsys/net/ip/CMakeLists.txt b/subsys/net/ip/CMakeLists.txt index d9bd7b1c780d9..b3003f566919b 100644 --- a/subsys/net/ip/CMakeLists.txt +++ b/subsys/net/ip/CMakeLists.txt @@ -42,6 +42,7 @@ zephyr_library_sources_ifdef(CONFIG_NET_IPV6_PE ipv6_pe.c) zephyr_library_sources_ifdef(CONFIG_NET_IPV6_FRAGMENT ipv6_fragment.c) zephyr_library_sources_ifdef(CONFIG_NET_IPV4_FRAGMENT ipv4_fragment.c) zephyr_library_sources_ifdef(CONFIG_NET_MGMT_EVENT net_mgmt.c) +zephyr_library_sources_ifdef(CONFIG_NET_PMTU pmtu.c) zephyr_library_sources_ifdef(CONFIG_NET_ROUTE route.c) zephyr_library_sources_ifdef(CONFIG_NET_STATISTICS net_stats.c) zephyr_library_sources_ifdef(CONFIG_NET_TCP tcp.c) diff --git a/subsys/net/ip/Kconfig b/subsys/net/ip/Kconfig index b61e2dd74c3cc..70155b82f847c 100644 --- a/subsys/net/ip/Kconfig +++ b/subsys/net/ip/Kconfig @@ -48,6 +48,19 @@ config NET_NATIVE_IPV4 depends on NET_NATIVE default y if NET_IPV4 +config NET_PMTU + bool + default y + depends on NET_IPV6_PMTU || NET_IPV4_PMTU + +if NET_PMTU +module = NET_PMTU +module-dep = NET_LOG +module-str = Log level for PMTU +module-help = Enables PMTU to output debug messages. +source "subsys/net/Kconfig.template.log_config.net" +endif # NET_PMTU + config NET_NATIVE_TCP bool depends on NET_NATIVE diff --git a/subsys/net/ip/Kconfig.ipv4 b/subsys/net/ip/Kconfig.ipv4 index 77c29c8966ced..e2456557caab3 100644 --- a/subsys/net/ip/Kconfig.ipv4 +++ b/subsys/net/ip/Kconfig.ipv4 @@ -151,6 +151,18 @@ config NET_IPV4_FRAGMENT_TIMEOUT How long to wait for IPv4 fragment to arrive before the reassembly will timeout. This value is in seconds. +config NET_IPV4_PMTU + bool "IPv4 Path MTU Discovery" + help + Enables IPv4 Path MTU Discovery (see RFC 1191) + +config NET_IPV4_PMTU_DESTINATION_CACHE_ENTRIES + int "Number of IPv4 PMTU destination cache entries" + default 3 + depends on NET_IPV4_PMTU + help + How many PMTU entries we can track for each destination address. + module = NET_IPV4 module-dep = NET_LOG module-str = Log level for core IPv4 diff --git a/subsys/net/ip/Kconfig.ipv6 b/subsys/net/ip/Kconfig.ipv6 index 286fbf4f195e2..653fef97fdf5d 100644 --- a/subsys/net/ip/Kconfig.ipv6 +++ b/subsys/net/ip/Kconfig.ipv6 @@ -46,6 +46,18 @@ config NET_IPV6_MTU The value should normally be 1280 which is the minimum IPv6 packet size that implementations need to support without fragmentation. +config NET_IPV6_PMTU + bool "IPv6 Path MTU Discovery" + help + Enables IPv6 Path MTU Discovery (see RFC 8201) + +config NET_IPV6_PMTU_DESTINATION_CACHE_ENTRIES + int "Number of IPv6 PMTU destination cache entries" + default 3 + depends on NET_IPV6_PMTU + help + How many PMTU entries we can track for each destination address. + config NET_INITIAL_HOP_LIMIT int "Initial IPv6 hop limit value for unicast packets" default 64 diff --git a/subsys/net/ip/net_core.c b/subsys/net/ip/net_core.c index 5259f9c6e6d70..facc4c8ecc7d1 100644 --- a/subsys/net/ip/net_core.c +++ b/subsys/net/ip/net_core.c @@ -40,6 +40,8 @@ LOG_MODULE_REGISTER(net_core, CONFIG_NET_CORE_LOG_LEVEL); #include "net_private.h" #include "shell/net_shell.h" +#include "pmtu.h" + #include "icmpv6.h" #include "ipv6.h" @@ -536,6 +538,7 @@ int net_recv_data(struct net_if *iface, struct net_pkt *pkt) static inline void l3_init(void) { + net_pmtu_init(); net_icmpv4_init(); net_icmpv6_init(); net_ipv4_init(); diff --git a/subsys/net/ip/pmtu.c b/subsys/net/ip/pmtu.c new file mode 100644 index 0000000000000..e1f9d748f5f42 --- /dev/null +++ b/subsys/net/ip/pmtu.c @@ -0,0 +1,249 @@ +/** @file + * @brief IPv4/6 PMTU related functions + */ + +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +LOG_MODULE_REGISTER(net_pmtu, CONFIG_NET_PMTU_LOG_LEVEL); + +#include + +#include "pmtu.h" + +#if defined(CONFIG_NET_IPV4_PMTU) +#define NET_IPV4_PMTU_ENTRIES CONFIG_NET_IPV4_PMTU_DESTINATION_CACHE_ENTRIES +#else +#define NET_IPV4_PMTU_ENTRIES 0 +#endif + +#if defined(CONFIG_NET_IPV6_PMTU) +#define NET_IPV6_PMTU_ENTRIES CONFIG_NET_IPV6_PMTU_DESTINATION_CACHE_ENTRIES +#else +#define NET_IPV6_PMTU_ENTRIES 0 +#endif + +#define NET_PMTU_MAX_ENTRIES (NET_IPV4_PMTU_ENTRIES + NET_IPV6_PMTU_ENTRIES) + +static struct net_pmtu_entry pmtu_entries[NET_PMTU_MAX_ENTRIES]; + +static K_MUTEX_DEFINE(lock); + +static struct net_pmtu_entry *get_pmtu_entry(const struct sockaddr *dst) +{ + struct net_pmtu_entry *entry = NULL; + int i; + + k_mutex_lock(&lock, K_FOREVER); + + for (i = 0; i < ARRAY_SIZE(pmtu_entries); i++) { + switch (dst->sa_family) { + case AF_INET: + if (IS_ENABLED(CONFIG_NET_IPV4_PMTU) && + pmtu_entries[i].dst.family == AF_INET && + net_ipv4_addr_cmp(&pmtu_entries[i].dst.in_addr, + &net_sin(dst)->sin_addr)) { + entry = &pmtu_entries[i]; + goto out; + } + break; + + case AF_INET6: + if (IS_ENABLED(CONFIG_NET_IPV6_PMTU) && + pmtu_entries[i].dst.family == AF_INET6 && + net_ipv6_addr_cmp(&pmtu_entries[i].dst.in6_addr, + &net_sin6(dst)->sin6_addr)) { + entry = &pmtu_entries[i]; + goto out; + } + break; + + default: + break; + } + } + +out: + k_mutex_unlock(&lock); + + return entry; +} + +static struct net_pmtu_entry *get_free_pmtu_entry(void) +{ + struct net_pmtu_entry *entry = NULL; + uint32_t oldest = 0U; + int i; + + k_mutex_lock(&lock, K_FOREVER); + + for (i = 0; i < ARRAY_SIZE(pmtu_entries); i++) { + if (!pmtu_entries[i].in_use) { + pmtu_entries[i].in_use = true; + pmtu_entries[i].last_update = k_uptime_get_32(); + + entry = &pmtu_entries[i]; + goto out; + } + + if (oldest == 0U || pmtu_entries[i].last_update < oldest) { + oldest = pmtu_entries[i].last_update; + entry = &pmtu_entries[i]; + } + } + +out: + k_mutex_unlock(&lock); + + return entry; +} + +static void update_pmtu_entry(struct net_pmtu_entry *entry, uint16_t mtu) +{ + entry->mtu = mtu; + entry->last_update = k_uptime_get_32(); +} + +struct net_pmtu_entry *net_pmtu_get_entry(const struct sockaddr *dst) +{ + struct net_pmtu_entry *entry; + + entry = get_pmtu_entry(dst); + + return entry; +} + +int net_pmtu_get_mtu(const struct sockaddr *dst) +{ + struct net_pmtu_entry *entry; + + entry = get_pmtu_entry(dst); + if (entry == NULL) { + return -ENOENT; + } + + return entry->mtu; +} + +static struct net_pmtu_entry *add_entry(const struct sockaddr *dst, bool *old_entry) +{ + struct net_pmtu_entry *entry; + + entry = get_pmtu_entry(dst); + if (entry != NULL) { + *old_entry = true; + return entry; + } + + entry = get_free_pmtu_entry(); + if (entry == NULL) { + return NULL; + } + + k_mutex_lock(&lock, K_FOREVER); + + switch (dst->sa_family) { + case AF_INET: + if (IS_ENABLED(CONFIG_NET_IPV4_PMTU)) { + entry->dst.family = AF_INET; + net_ipaddr_copy(&entry->dst.in_addr, &net_sin(dst)->sin_addr); + } else { + entry->in_use = false; + goto unlock_fail; + } + break; + + case AF_INET6: + if (IS_ENABLED(CONFIG_NET_IPV6_PMTU)) { + entry->dst.family = AF_INET6; + net_ipaddr_copy(&entry->dst.in6_addr, &net_sin6(dst)->sin6_addr); + } else { + entry->in_use = false; + goto unlock_fail; + } + break; + + default: + entry->in_use = false; + goto unlock_fail; + } + + k_mutex_unlock(&lock); + return entry; + +unlock_fail: + *old_entry = false; + + k_mutex_unlock(&lock); + return NULL; +} + +int net_pmtu_update_mtu(const struct sockaddr *dst, uint16_t mtu) +{ + struct net_pmtu_entry *entry; + uint16_t old_mtu = 0U; + bool updated = false; + + entry = add_entry(dst, &updated); + if (entry == NULL) { + return -ENOMEM; + } + + if (updated) { + old_mtu = entry->mtu; + } + + update_pmtu_entry(entry, mtu); + + return (int)old_mtu; +} + +int net_pmtu_update_entry(struct net_pmtu_entry *entry, uint16_t mtu) +{ + uint16_t old_mtu; + + if (entry == NULL) { + return -EINVAL; + } + + if (entry->mtu == mtu) { + return -EALREADY; + } + + old_mtu = entry->mtu; + + update_pmtu_entry(entry, mtu); + + return (int)old_mtu; +} + +int net_pmtu_foreach(net_pmtu_cb_t cb, void *user_data) +{ + int ret = 0; + + k_mutex_lock(&lock, K_FOREVER); + + ARRAY_FOR_EACH(pmtu_entries, i) { + ret++; + cb(&pmtu_entries[i], user_data); + } + + k_mutex_unlock(&lock); + + return ret; +} + +void net_pmtu_init(void) +{ + k_mutex_lock(&lock, K_FOREVER); + + ARRAY_FOR_EACH(pmtu_entries, i) { + pmtu_entries[i].in_use = false; + } + + k_mutex_unlock(&lock); +} diff --git a/subsys/net/ip/pmtu.h b/subsys/net/ip/pmtu.h new file mode 100644 index 0000000000000..bce20a7762c70 --- /dev/null +++ b/subsys/net/ip/pmtu.h @@ -0,0 +1,144 @@ +/** @file + * @brief IPv4/6 PMTU related functions + */ + +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef __NET_PMTU_H +#define __NET_PMTU_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** PTMU destination cache entry */ +struct net_pmtu_entry { + /** Destination address */ + struct net_addr dst; + /** Last time the PMTU was updated */ + uint32_t last_update; + /** MTU for this destination address */ + uint16_t mtu; + /** In use flag */ + bool in_use : 1; +}; + +/** Get PMTU entry for the given destination address + * + * @param dst Destination address + * + * @return PMTU entry if found, NULL otherwise + */ +#if defined(CONFIG_NET_PMTU) +struct net_pmtu_entry *net_pmtu_get_entry(const struct sockaddr *dst); +#else +static inline struct net_pmtu_entry *net_pmtu_get_entry(const struct sockaddr *dst) +{ + ARG_UNUSED(dst); + + return NULL; +} +#endif /* CONFIG_NET_PMTU */ + +/** Get MTU value for the given destination address + * + * @param dst Destination address + * + * @return MTU value (> 0) if found, <0 otherwise + */ +#if defined(CONFIG_NET_PMTU) +int net_pmtu_get_mtu(const struct sockaddr *dst); +#else +static inline int net_pmtu_get_mtu(const struct sockaddr *dst) +{ + ARG_UNUSED(dst); + + return -ENOTSUP; +} +#endif /* CONFIG_NET_PMTU */ + +/** Update PMTU value for the given destination address + * + * @param dst Destination address + * @param mtu New MTU value + * + * @return >0 previous MTU, <0 if error + */ +#if defined(CONFIG_NET_PMTU) +int net_pmtu_update_mtu(const struct sockaddr *dst, uint16_t mtu); +#else +static inline int net_pmtu_update_mtu(const struct sockaddr *dst, uint16_t mtu) +{ + ARG_UNUSED(dst); + ARG_UNUSED(mtu); + + return -ENOTSUP; +} +#endif /* CONFIG_NET_PMTU */ + +/** Update PMTU entry for the given destination address + * + * @param entry PMTU entry + * @param mtu New MTU value + * + * @return >0 previous MTU, <0 if error + */ +#if defined(CONFIG_NET_PMTU) +int net_pmtu_update_entry(struct net_pmtu_entry *entry, uint16_t mtu); +#else +static inline int net_pmtu_update_entry(struct net_pmtu_entry *entry, + uint16_t mtu) +{ + ARG_UNUSED(entry); + ARG_UNUSED(mtu); + + return -ENOTSUP; +} +#endif /* CONFIG_NET_PMTU */ + +/** + * @typedef net_pmtu_cb_t + * @brief Callback used when traversing PMTU destination cache. + * + * @param entry PMTU entry + * @param user_data User specified data + */ +typedef void (*net_pmtu_cb_t)(struct net_pmtu_entry *entry, + void *user_data); + +/** Get PMTU destination cache contents + * + * @param cb PMTU callback to be called for each cache entry. + * @param user_data User specific data. + * + * @return >=0 number of entries in the PMTU destination cache, <0 if error + */ +#if defined(CONFIG_NET_PMTU) +int net_pmtu_foreach(net_pmtu_cb_t cb, void *user_data); +#else +static inline int net_pmtu_foreach(net_pmtu_cb_t cb, void *user_data) +{ + ARG_UNUSED(cb); + ARG_UNUSED(user_data); + + return -ENOTSUP; +} +#endif /* CONFIG_NET_PMTU */ + +/** Initialize PMTU module */ +#if defined(CONFIG_NET_PMTU) +void net_pmtu_init(void); +#else +#define net_pmtu_init(...) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __NET_PMTU_H */ From 67c004d7070d667061a6b9943aa82013788759d8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 1 Nov 2024 15:59:07 +0200 Subject: [PATCH 2672/4482] tests: net: pmtu: Add tests for path MTU discovery Add initial tests for generic part of PMTU discovery code. Signed-off-by: Jukka Rissanen --- tests/net/pmtu/CMakeLists.txt | 9 + tests/net/pmtu/prj.conf | 20 ++ tests/net/pmtu/src/main.c | 352 ++++++++++++++++++++++++++++++++++ tests/net/pmtu/testcase.yaml | 17 ++ 4 files changed, 398 insertions(+) create mode 100644 tests/net/pmtu/CMakeLists.txt create mode 100644 tests/net/pmtu/prj.conf create mode 100644 tests/net/pmtu/src/main.c create mode 100644 tests/net/pmtu/testcase.yaml diff --git a/tests/net/pmtu/CMakeLists.txt b/tests/net/pmtu/CMakeLists.txt new file mode 100644 index 0000000000000..44c347478ef73 --- /dev/null +++ b/tests/net/pmtu/CMakeLists.txt @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(mld) + +target_include_directories(app PRIVATE ${ZEPHYR_BASE}/subsys/net/ip) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/net/pmtu/prj.conf b/tests/net/pmtu/prj.conf new file mode 100644 index 0000000000000..1006a8ccc03d2 --- /dev/null +++ b/tests/net/pmtu/prj.conf @@ -0,0 +1,20 @@ +CONFIG_ZTEST=y +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_NET_TEST=y +CONFIG_NETWORKING=y +CONFIG_NET_UDP=y +CONFIG_NET_TCP=n +CONFIG_NET_IPV6=y +CONFIG_NET_IPV6_PMTU=y +CONFIG_NET_IPV4=y +CONFIG_NET_IPV4_PMTU=y +CONFIG_NET_L2_ETHERNET=y +CONFIG_NET_LOG=y +CONFIG_ENTROPY_GENERATOR=y +CONFIG_TEST_RANDOM_GENERATOR=y +CONFIG_NET_PKT_TX_COUNT=20 +CONFIG_NET_PKT_RX_COUNT=20 +CONFIG_NET_BUF_RX_COUNT=20 +CONFIG_NET_BUF_TX_COUNT=20 +CONFIG_NET_MGMT=y +CONFIG_NET_MGMT_EVENT=y diff --git a/tests/net/pmtu/src/main.c b/tests/net/pmtu/src/main.c new file mode 100644 index 0000000000000..006101e684c74 --- /dev/null +++ b/tests/net/pmtu/src/main.c @@ -0,0 +1,352 @@ +/* main.c - Application main entry point */ + +/* + * Copyright (c) 2024 Nordic Semiconductor + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +LOG_MODULE_REGISTER(net_test, CONFIG_NET_PMTU_LOG_LEVEL); + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "pmtu.h" + +#define NET_LOG_ENABLED 1 +#include "net_private.h" + +#if defined(CONFIG_NET_PMTU_LOG_LEVEL_DBG) +#define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) +#else +#define DBG(fmt, ...) +#endif + +/* Small sleep between tests makes sure that the PMTU destination + * cache entries are separated from each other. + */ +#define SMALL_SLEEP K_MSEC(5) + +static struct in_addr my_ipv4_addr = { { { 192, 0, 2, 1 } } }; +static struct in_addr dest_ipv4_addr1 = { { { 198, 51, 100, 1 } } }; +static struct in_addr dest_ipv4_addr2 = { { { 198, 51, 100, 2 } } }; +static struct in_addr dest_ipv4_addr3 = { { { 198, 51, 100, 3 } } }; +static struct in_addr dest_ipv4_addr4 = { { { 198, 51, 100, 4 } } }; +static struct in_addr any_ipv4_addr = INADDR_ANY_INIT; + +static struct in6_addr my_ipv6_addr = { { { 0x20, 0x01, 0x0d, 0xb8, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0x1 } } }; +static struct in6_addr dest_ipv6_addr1 = { { { 0x20, 0x01, 0x0d, 0xb8, 0x01, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0x1 } } }; +static struct in6_addr dest_ipv6_addr2 = { { { 0x20, 0x01, 0x0d, 0xb8, 0x01, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0x2 } } }; +static struct in6_addr dest_ipv6_addr3 = { { { 0x20, 0x01, 0x0d, 0xb8, 0x01, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0x3 } } }; +static struct in6_addr dest_ipv6_addr4 = { { { 0x20, 0x01, 0x0d, 0xb8, 0x01, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0x4 } } }; +static struct in6_addr any_ipv6_addr = IN6ADDR_ANY_INIT; + +K_SEM_DEFINE(wait_data, 0, UINT_MAX); + +#define WAIT_TIME 500 +#define WAIT_TIME_LONG MSEC_PER_SEC +#define MY_PORT 1969 +#define PEER_PORT 13856 + +struct net_test_pmtu { + uint8_t mac_addr[sizeof(struct net_eth_addr)]; + struct net_linkaddr ll_addr; +}; + +int net_test_dev_init(const struct device *dev) +{ + return 0; +} + +static uint8_t *net_test_get_mac(const struct device *dev) +{ + struct net_test_pmtu *context = dev->data; + + if (context->mac_addr[2] == 0x00) { + /* 00-00-5E-00-53-xx Documentation RFC 7042 */ + context->mac_addr[0] = 0x00; + context->mac_addr[1] = 0x00; + context->mac_addr[2] = 0x5E; + context->mac_addr[3] = 0x00; + context->mac_addr[4] = 0x53; + context->mac_addr[5] = sys_rand8_get(); + } + + return context->mac_addr; +} + +static void net_test_iface_init(struct net_if *iface) +{ + uint8_t *mac = net_test_get_mac(net_if_get_device(iface)); + + net_if_set_link_addr(iface, mac, sizeof(struct net_eth_addr), + NET_LINK_ETHERNET); +} + +static int tester_send(const struct device *dev, struct net_pkt *pkt) +{ + if (!pkt->buffer) { + TC_ERROR("No data to send!\n"); + return -ENODATA; + } + + return 0; +} + +struct net_test_pmtu net_test_data; + +static struct ethernet_api net_test_if_api = { + .iface_api.init = net_test_iface_init, + .send = tester_send, +}; + +#define _ETH_L2_LAYER ETHERNET_L2 +#define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(ETHERNET_L2) + +NET_DEVICE_INIT(net_test_pmtu, "net_test_pmtu", + net_test_dev_init, NULL, &net_test_data, NULL, + CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, + &net_test_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, + 127); + +ZTEST(net_pmtu_test_suite, test_pmtu_01_ipv4_get_entry) +{ +#if defined(CONFIG_NET_IPV4_PMTU) + struct net_pmtu_entry *entry; + struct sockaddr_in dest_ipv4; + + net_ipaddr_copy(&dest_ipv4.sin_addr, &dest_ipv4_addr1); + dest_ipv4.sin_family = AF_INET; + + entry = net_pmtu_get_entry((struct sockaddr *)&dest_ipv4); + zassert_is_null(entry, "PMTU IPv4 entry is not NULL"); + + k_sleep(SMALL_SLEEP); +#else + ztest_test_skip(); +#endif +} + +ZTEST(net_pmtu_test_suite, test_pmtu_01_ipv6_get_entry) +{ +#if defined(CONFIG_NET_IPV6_PMTU) + struct net_pmtu_entry *entry; + struct sockaddr_in6 dest_ipv6; + + net_ipaddr_copy(&dest_ipv6.sin6_addr, &dest_ipv6_addr1); + dest_ipv6.sin6_family = AF_INET6; + + entry = net_pmtu_get_entry((struct sockaddr *)&dest_ipv6); + zassert_is_null(entry, "PMTU IPv6 entry is not NULL"); + + k_sleep(SMALL_SLEEP); +#else + ztest_test_skip(); +#endif +} + +ZTEST(net_pmtu_test_suite, test_pmtu_02_ipv4_update_entry) +{ +#if defined(CONFIG_NET_IPV4_PMTU) + struct sockaddr_in dest_ipv4; + int ret; + + net_ipaddr_copy(&dest_ipv4.sin_addr, &dest_ipv4_addr1); + dest_ipv4.sin_family = AF_INET; + + ret = net_pmtu_update_mtu((struct sockaddr *)&dest_ipv4, 1300); + zassert_equal(ret, 0, "PMTU IPv4 MTU update failed (%d)", ret); + + k_sleep(SMALL_SLEEP); +#else + ztest_test_skip(); +#endif +} + +ZTEST(net_pmtu_test_suite, test_pmtu_02_ipv6_update_entry) +{ +#if defined(CONFIG_NET_IPV6_PMTU) + struct sockaddr_in6 dest_ipv6; + int ret; + + net_ipaddr_copy(&dest_ipv6.sin6_addr, &dest_ipv6_addr1); + dest_ipv6.sin6_family = AF_INET6; + + ret = net_pmtu_update_mtu((struct sockaddr *)&dest_ipv6, 1600); + zassert_equal(ret, 0, "PMTU IPv6 MTU update failed (%d)", ret); + + k_sleep(SMALL_SLEEP); +#else + ztest_test_skip(); +#endif +} + +ZTEST(net_pmtu_test_suite, test_pmtu_03_ipv4_create_more_entries) +{ +#if defined(CONFIG_NET_IPV4_PMTU) + struct sockaddr_in dest_ipv4; + struct net_pmtu_entry *entry; + int ret; + + dest_ipv4.sin_family = AF_INET; + + net_ipaddr_copy(&dest_ipv4.sin_addr, &dest_ipv4_addr1); + ret = net_pmtu_update_mtu((struct sockaddr *)&dest_ipv4, 1300); + zassert_equal(ret, 1300, "PMTU IPv4 MTU update failed (%d)", ret); + entry = net_pmtu_get_entry((struct sockaddr *)&dest_ipv4); + zassert_equal(entry->mtu, 1300, "PMTU IPv4 MTU is not correct (%d)", + entry->mtu); + + k_sleep(SMALL_SLEEP); + + net_ipaddr_copy(&dest_ipv4.sin_addr, &dest_ipv4_addr2); + ret = net_pmtu_update_mtu((struct sockaddr *)&dest_ipv4, 1400); + zassert_equal(ret, 0, "PMTU IPv4 MTU update failed (%d)", ret); + entry = net_pmtu_get_entry((struct sockaddr *)&dest_ipv4); + zassert_equal(entry->mtu, 1400, "PMTU IPv4 MTU is not correct (%d)", + entry->mtu); + + + k_sleep(SMALL_SLEEP); + + net_ipaddr_copy(&dest_ipv4.sin_addr, &dest_ipv4_addr3); + ret = net_pmtu_update_mtu((struct sockaddr *)&dest_ipv4, 1500); + zassert_equal(ret, 0, "PMTU IPv4 MTU update failed (%d)", ret); + entry = net_pmtu_get_entry((struct sockaddr *)&dest_ipv4); + zassert_equal(entry->mtu, 1500, "PMTU IPv4 MTU is not correct (%d)", + entry->mtu); +#else + ztest_test_skip(); +#endif +} + +ZTEST(net_pmtu_test_suite, test_pmtu_03_ipv6_create_more_entries) +{ +#if defined(CONFIG_NET_IPV6_PMTU) + struct sockaddr_in6 dest_ipv6; + struct net_pmtu_entry *entry; + int ret; + + dest_ipv6.sin6_family = AF_INET6; + + net_ipaddr_copy(&dest_ipv6.sin6_addr, &dest_ipv6_addr1); + ret = net_pmtu_update_mtu((struct sockaddr *)&dest_ipv6, 1600); + zassert_equal(ret, 1600, "PMTU IPv6 MTU update failed (%d)", ret); + entry = net_pmtu_get_entry((struct sockaddr *)&dest_ipv6); + zassert_equal(entry->mtu, 1600, "PMTU IPv6 MTU is not correct (%d)", + entry->mtu); + + k_sleep(SMALL_SLEEP); + + net_ipaddr_copy(&dest_ipv6.sin6_addr, &dest_ipv6_addr2); + ret = net_pmtu_update_mtu((struct sockaddr *)&dest_ipv6, 1700); + zassert_equal(ret, 0, "PMTU IPv6 MTU update failed (%d)", ret); + entry = net_pmtu_get_entry((struct sockaddr *)&dest_ipv6); + zassert_equal(entry->mtu, 1700, "PMTU IPv6 MTU is not correct (%d)", + entry->mtu); + + k_sleep(SMALL_SLEEP); + + net_ipaddr_copy(&dest_ipv6.sin6_addr, &dest_ipv6_addr3); + ret = net_pmtu_update_mtu((struct sockaddr *)&dest_ipv6, 1800); + zassert_equal(ret, 0, "PMTU IPv6 MTU update failed (%d)", ret); + entry = net_pmtu_get_entry((struct sockaddr *)&dest_ipv6); + zassert_equal(entry->mtu, 1800, "PMTU IPv6 MTU is not correct (%d)", + entry->mtu); +#else + ztest_test_skip(); +#endif +} + +ZTEST(net_pmtu_test_suite, test_pmtu_04_ipv4_overflow) +{ +#if defined(CONFIG_NET_IPV4_PMTU) + struct sockaddr_in dest_ipv4; + struct net_pmtu_entry *entry; + int ret; + + dest_ipv4.sin_family = AF_INET; + + /* Create more entries than we have space */ + net_ipaddr_copy(&dest_ipv4.sin_addr, &dest_ipv4_addr4); + ret = net_pmtu_update_mtu((struct sockaddr *)&dest_ipv4, 1450); + zassert_equal(ret, 0, "PMTU IPv4 MTU update failed (%d)", ret); + + entry = net_pmtu_get_entry((struct sockaddr *)&dest_ipv4); + zassert_equal(entry->mtu, 1450, "PMTU IPv4 MTU is not correct (%d)", + entry->mtu); + + k_sleep(SMALL_SLEEP); + + net_ipaddr_copy(&dest_ipv4.sin_addr, &dest_ipv4_addr1); + entry = net_pmtu_get_entry((struct sockaddr *)&dest_ipv4); + zassert_is_null(entry, "PMTU IPv4 MTU found when it should not be"); +#else + ztest_test_skip(); +#endif +} + +ZTEST(net_pmtu_test_suite, test_pmtu_04_ipv6_overflow) +{ +#if defined(CONFIG_NET_IPV6_PMTU) + struct sockaddr_in6 dest_ipv6; + struct net_pmtu_entry *entry; + int ret; + + dest_ipv6.sin6_family = AF_INET6; + + /* Create more entries than we have space */ + net_ipaddr_copy(&dest_ipv6.sin6_addr, &dest_ipv6_addr4); + ret = net_pmtu_update_mtu((struct sockaddr *)&dest_ipv6, 1650); + zassert_equal(ret, 0, "PMTU IPv6 MTU update failed (%d)", ret); + + entry = net_pmtu_get_entry((struct sockaddr *)&dest_ipv6); + zassert_equal(entry->mtu, 1650, "PMTU IPv6 MTU is not correct (%d)", + entry->mtu); + + k_sleep(SMALL_SLEEP); + + /* If we have IPv4 PMTU enabled, then the oldest one is an IPv4 entry. + */ + if (IS_ENABLED(CONFIG_NET_IPV4_PMTU)) { + struct sockaddr_in dest_ipv4; + + dest_ipv4.sin_family = AF_INET; + + net_ipaddr_copy(&dest_ipv4.sin_addr, &dest_ipv4_addr2); + entry = net_pmtu_get_entry((struct sockaddr *)&dest_ipv4); + } else { + net_ipaddr_copy(&dest_ipv6.sin6_addr, &dest_ipv6_addr1); + entry = net_pmtu_get_entry((struct sockaddr *)&dest_ipv6); + } + + zassert_is_null(entry, "PMTU IPv6 MTU found when it should not be"); +#else + ztest_test_skip(); +#endif +} + +ZTEST_SUITE(net_pmtu_test_suite, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/net/pmtu/testcase.yaml b/tests/net/pmtu/testcase.yaml new file mode 100644 index 0000000000000..6b0da0a2dfdbd --- /dev/null +++ b/tests/net/pmtu/testcase.yaml @@ -0,0 +1,17 @@ +common: + tags: + - net + - pmtu + depends_on: netif + platform_allow: qemu_x86 +tests: + net.pmtu.ipv4: + extra_configs: + - CONFIG_NET_IPV4_PMTU=y + net.pmtu.ipv6: + extra_configs: + - CONFIG_NET_IPV6_PMTU=y + net.pmtu.all: + extra_configs: + - CONFIG_NET_IPV4_PMTU=y + - CONFIG_NET_IPV6_PMTU=y From 026f88481d655b8d5fa000b3cd11cb36e2ad92d3 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 1 Nov 2024 16:44:09 +0200 Subject: [PATCH 2673/4482] net: stats: ipv6: pmtu: Add Path MTU Discovery statistics Add information about PMTU related packets received/sent/dropped for IPv6. Signed-off-by: Jukka Rissanen --- include/zephyr/net/net_stats.h | 30 ++++++++++++++++++++++++++++++ samples/net/stats/src/main.c | 6 ++++++ subsys/net/ip/Kconfig.stats | 7 +++++++ subsys/net/ip/net_stats.c | 17 +++++++++++++++++ subsys/net/ip/net_stats.h | 23 +++++++++++++++++++++++ subsys/net/lib/shell/stats.c | 6 ++++++ 6 files changed, 89 insertions(+) diff --git a/include/zephyr/net/net_stats.h b/include/zephyr/net/net_stats.h index f41bf204e9682..93f34da6236fe 100644 --- a/include/zephyr/net/net_stats.h +++ b/include/zephyr/net/net_stats.h @@ -198,6 +198,20 @@ struct net_stats_ipv6_nd { net_stats_t sent; }; +/** + * @brief IPv6 Path MTU Discovery statistics + */ +struct net_stats_ipv6_pmtu { + /** Number of dropped IPv6 PMTU packets. */ + net_stats_t drop; + + /** Number of received IPv6 PMTU packets. */ + net_stats_t recv; + + /** Number of sent IPv6 PMTU packets. */ + net_stats_t sent; +}; + /** * @brief IPv6 multicast listener daemon statistics */ @@ -379,6 +393,11 @@ struct net_stats { struct net_stats_ipv6_nd ipv6_nd; #endif +#if defined(CONFIG_NET_STATISTICS_IPV6_PMTU) + /** IPv6 Path MTU Discovery statistics */ + struct net_stats_ipv6_pmtu ipv6_pmtu; +#endif + #if defined(CONFIG_NET_STATISTICS_MLD) /** IPv6 MLD statistics */ struct net_stats_ipv6_mld ipv6_mld; @@ -665,6 +684,7 @@ enum net_request_stats_cmd { NET_REQUEST_STATS_CMD_GET_IPV4, NET_REQUEST_STATS_CMD_GET_IPV6, NET_REQUEST_STATS_CMD_GET_IPV6_ND, + NET_REQUEST_STATS_CMD_GET_IPV6_PMTU, NET_REQUEST_STATS_CMD_GET_ICMP, NET_REQUEST_STATS_CMD_GET_UDP, NET_REQUEST_STATS_CMD_GET_TCP, @@ -732,6 +752,16 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_IPV6_ND); /** @endcond */ #endif /* CONFIG_NET_STATISTICS_IPV6_ND */ +#if defined(CONFIG_NET_STATISTICS_IPV6_PMTU) +/** Request IPv6 Path MTU Discovery statistics */ +#define NET_REQUEST_STATS_GET_IPV6_PMTU \ + (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_IPV6_PMTU) + +/** @cond INTERNAL_HIDDEN */ +NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_IPV6_PMTU); +/** @endcond */ +#endif /* CONFIG_NET_STATISTICS_IPV6_PMTU */ + #if defined(CONFIG_NET_STATISTICS_ICMP) /** Request ICMPv4 and ICMPv6 statistics */ #define NET_REQUEST_STATS_GET_ICMP \ diff --git a/samples/net/stats/src/main.c b/samples/net/stats/src/main.c index 171757cac853c..f6e35a89e904e 100644 --- a/samples/net/stats/src/main.c +++ b/samples/net/stats/src/main.c @@ -43,6 +43,12 @@ static void print_stats(struct net_if *iface, struct net_stats *data) GET_STAT(iface, ipv6_nd.sent), GET_STAT(iface, ipv6_nd.drop)); #endif /* CONFIG_NET_IPV6_ND */ +#if defined(CONFIG_NET_IPV6_PMTU) + printk("IPv6 PMTU recv %d\tsent\t%d\tdrop\t%d\n", + GET_STAT(iface, ipv6_pmtu.recv), + GET_STAT(iface, ipv6_pmtu.sent), + GET_STAT(iface, ipv6_pmtu.drop)); +#endif /* CONFIG_NET_IPV6_PMTU */ #if defined(CONFIG_NET_STATISTICS_MLD) printk("IPv6 MLD recv %d\tsent\t%d\tdrop\t%d\n", GET_STAT(iface, ipv6_mld.recv), diff --git a/subsys/net/ip/Kconfig.stats b/subsys/net/ip/Kconfig.stats index ae0d6e95e46b0..9851e5063fd06 100644 --- a/subsys/net/ip/Kconfig.stats +++ b/subsys/net/ip/Kconfig.stats @@ -57,6 +57,13 @@ config NET_STATISTICS_IPV6_ND help Keep track of IPv6 Neighbor Discovery related statistics +config NET_STATISTICS_IPV6_PMTU + bool "IPv6 PMTU statistics" + depends on NET_IPV6_PMTU + default y + help + Keep track of IPv6 Path MTU Discovery related statistics + config NET_STATISTICS_ICMP bool "ICMP statistics" depends on NET_IPV6 || NET_IPV4 diff --git a/subsys/net/ip/net_stats.c b/subsys/net/ip/net_stats.c index 4fe68933a061b..ab6d7855ee0eb 100644 --- a/subsys/net/ip/net_stats.c +++ b/subsys/net/ip/net_stats.c @@ -91,6 +91,12 @@ static inline void stats(struct net_if *iface) GET_STAT(iface, ipv6_nd.sent), GET_STAT(iface, ipv6_nd.drop)); #endif /* CONFIG_NET_STATISTICS_IPV6_ND */ +#if defined(CONFIG_NET_STATISTICS_IPV6_PMTU) + NET_INFO("IPv6 PMTU recv %d\tsent\t%d\tdrop\t%d", + GET_STAT(iface, ipv6_pmtu.recv), + GET_STAT(iface, ipv6_pmtu.sent), + GET_STAT(iface, ipv6_pmtu.drop)); +#endif /* CONFIG_NET_STATISTICS_IPV6_PMTU */ #if defined(CONFIG_NET_STATISTICS_MLD) NET_INFO("IPv6 MLD recv %d\tsent\t%d\tdrop\t%d", GET_STAT(iface, ipv6_mld.recv), @@ -279,6 +285,12 @@ static int net_stats_get(uint32_t mgmt_request, struct net_if *iface, src = GET_STAT_ADDR(iface, ipv6_nd); break; #endif +#if defined(CONFIG_NET_STATISTICS_IPV6_PMTU) + case NET_REQUEST_STATS_CMD_GET_IPV6_PMTU: + len_chk = sizeof(struct net_stats_ipv6_pmtu); + src = GET_STAT_ADDR(iface, ipv6_pmtu); + break; +#endif #if defined(CONFIG_NET_STATISTICS_ICMP) case NET_REQUEST_STATS_CMD_GET_ICMP: len_chk = sizeof(struct net_stats_icmp); @@ -341,6 +353,11 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_STATS_GET_IPV6_ND, net_stats_get); #endif +#if defined(CONFIG_NET_STATISTICS_IPV6_PMTU) +NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_STATS_GET_IPV6_PMTU, + net_stats_get); +#endif + #if defined(CONFIG_NET_STATISTICS_ICMP) NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_STATS_GET_ICMP, net_stats_get); diff --git a/subsys/net/ip/net_stats.h b/subsys/net/ip/net_stats.h index 431461b497eee..54ae8ff3773ee 100644 --- a/subsys/net/ip/net_stats.h +++ b/subsys/net/ip/net_stats.h @@ -113,6 +113,29 @@ static inline void net_stats_update_ipv6_nd_drop(struct net_if *iface) #define net_stats_update_ipv6_nd_drop(iface) #endif /* CONFIG_NET_STATISTICS_IPV6_ND */ +#if defined(CONFIG_NET_STATISTICS_IPV6_PMTU) && defined(CONFIG_NET_NATIVE_IPV6) +/* IPv6 Path MTU Discovery stats */ + +static inline void net_stats_update_ipv6_pmtu_sent(struct net_if *iface) +{ + UPDATE_STAT(iface, stats.ipv6_pmtu.sent++); +} + +static inline void net_stats_update_ipv6_pmtu_recv(struct net_if *iface) +{ + UPDATE_STAT(iface, stats.ipv6_pmtu.recv++); +} + +static inline void net_stats_update_ipv6_pmtu_drop(struct net_if *iface) +{ + UPDATE_STAT(iface, stats.ipv6_pmtu.drop++); +} +#else +#define net_stats_update_ipv6_pmtu_sent(iface) +#define net_stats_update_ipv6_pmtu_recv(iface) +#define net_stats_update_ipv6_pmtu_drop(iface) +#endif /* CONFIG_NET_STATISTICS_IPV6_PMTU */ + #if defined(CONFIG_NET_STATISTICS_IPV4) && defined(CONFIG_NET_NATIVE_IPV4) /* IPv4 stats */ diff --git a/subsys/net/lib/shell/stats.c b/subsys/net/lib/shell/stats.c index 0896add25f997..3bd7f09a6d80a 100644 --- a/subsys/net/lib/shell/stats.c +++ b/subsys/net/lib/shell/stats.c @@ -467,6 +467,12 @@ static void net_shell_print_statistics(struct net_if *iface, void *user_data) GET_STAT(iface, ipv6_nd.sent), GET_STAT(iface, ipv6_nd.drop)); #endif /* CONFIG_NET_STATISTICS_IPV6_ND */ +#if defined(CONFIG_NET_STATISTICS_IPV6_PMTU) + PR("IPv6 PMTU recv %d\tsent\t%d\tdrop\t%d\n", + GET_STAT(iface, ipv6_pmtu.recv), + GET_STAT(iface, ipv6_pmtu.sent), + GET_STAT(iface, ipv6_pmtu.drop)); +#endif /* CONFIG_NET_STATISTICS_IPV6_PMTU */ #if defined(CONFIG_NET_STATISTICS_MLD) PR("IPv6 MLD recv %d\tsent\t%d\tdrop\t%d\n", GET_STAT(iface, ipv6_mld.recv), From 84b135e226265e9615354d053f8c4f79fb5bc4aa Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 5 Nov 2024 10:33:03 +0200 Subject: [PATCH 2674/4482] net: ipv6: Print verdict information Print more cases when the packet is dropped, and also print the upper layer verdict for the packet. Signed-off-by: Jukka Rissanen --- subsys/net/ip/ipv6.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/subsys/net/ip/ipv6.c b/subsys/net/ip/ipv6.c index 34e4616f79cb7..4eac56d065d9e 100644 --- a/subsys/net/ip/ipv6.c +++ b/subsys/net/ip/ipv6.c @@ -580,6 +580,7 @@ enum net_verdict net_ipv6_input(struct net_pkt *pkt, bool is_loopback) if (!net_pkt_filter_ip_recv_ok(pkt)) { /* drop the packet */ + NET_DBG("DROP: pkt filter"); return NET_DROP; } @@ -593,6 +594,7 @@ enum net_verdict net_ipv6_input(struct net_pkt *pkt, bool is_loopback) * layer. */ if (ipv6_forward_mcast_packet(pkt, hdr) == NET_DROP) { + NET_DBG("DROP: forward mcast"); goto drop; } } @@ -603,6 +605,9 @@ enum net_verdict net_ipv6_input(struct net_pkt *pkt, bool is_loopback) return NET_OK; } + NET_DBG("DROP: no such address %s in iface %d", + net_sprint_ipv6_addr((struct in6_addr *)hdr->dst), + net_if_get_by_iface(pkt_iface)); goto drop; } @@ -617,6 +622,7 @@ enum net_verdict net_ipv6_input(struct net_pkt *pkt, bool is_loopback) pkt_iface, (struct in6_addr *)hdr->dst)) { ipv6_no_route_info(pkt, (struct in6_addr *)hdr->src, (struct in6_addr *)hdr->dst); + NET_DBG("DROP: cross interface boundary"); goto drop; } } @@ -670,6 +676,7 @@ enum net_verdict net_ipv6_input(struct net_pkt *pkt, bool is_loopback) * This is not an error case so do not update drop * statistics. */ + NET_DBG("DROP: none nexthdr"); return NET_DROP; } @@ -677,6 +684,7 @@ enum net_verdict net_ipv6_input(struct net_pkt *pkt, bool is_loopback) prev_hdr_offset = net_pkt_get_current_offset(pkt); if (net_pkt_read_u8(pkt, &nexthdr)) { + NET_DBG("DROP: pkt invalid read"); goto drop; } @@ -737,6 +745,7 @@ enum net_verdict net_ipv6_input(struct net_pkt *pkt, bool is_loopback) exthdr_len = ipv6_handle_ext_hdr_options(pkt, hdr, pkt_len); if (exthdr_len < 0) { + NET_DBG("DROP: extension hdr len (%d)", exthdr_len); goto drop; } @@ -759,12 +768,16 @@ enum net_verdict net_ipv6_input(struct net_pkt *pkt, bool is_loopback) if (proto_hdr.tcp) { verdict = NET_OK; } + + NET_DBG("%s verdict %s", "TCP", net_verdict2str(verdict)); break; case IPPROTO_UDP: proto_hdr.udp = net_udp_input(pkt, &udp_access); if (proto_hdr.udp) { verdict = NET_OK; } + + NET_DBG("%s verdict %s", "UDP", net_verdict2str(verdict)); break; #if defined(CONFIG_NET_L2_IPIP) @@ -793,14 +806,19 @@ enum net_verdict net_ipv6_input(struct net_pkt *pkt, bool is_loopback) } if (verdict == NET_DROP) { + NET_DBG("DROP: because verdict"); goto drop; } else if (current_hdr == IPPROTO_ICMPV6) { + NET_DBG("%s verdict %s", "ICMPv6", net_verdict2str(verdict)); return verdict; } ip.ipv6 = hdr; verdict = net_conn_input(pkt, &ip, current_hdr, &proto_hdr); + + NET_DBG("%s verdict %s", "Connection", net_verdict2str(verdict)); + if (verdict != NET_DROP) { return verdict; } From e7e3afcd0102ecf2c58c061bc33a2bc4e12331cf Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 5 Nov 2024 10:38:26 +0200 Subject: [PATCH 2675/4482] net: ipv6: Add PMTU support Catch "Packet Too Big" ICMPv6 messages and update PMTU for a given destination IPv6 address. Use that PMTU when sending data to the destination. Signed-off-by: Jukka Rissanen --- subsys/net/ip/icmpv6.h | 3 + subsys/net/ip/ipv6_nbr.c | 125 +++++++++++++++++++++++++++++++++++++++ subsys/net/ip/tcp.c | 49 ++++++++++----- 3 files changed, 161 insertions(+), 16 deletions(-) diff --git a/subsys/net/ip/icmpv6.h b/subsys/net/ip/icmpv6.h index 64ee1dfaa7bcb..2b68ae8bfaeda 100644 --- a/subsys/net/ip/icmpv6.h +++ b/subsys/net/ip/icmpv6.h @@ -117,6 +117,9 @@ struct net_icmpv6_mld_mcast_record { uint8_t mcast_address[NET_IPV6_ADDR_SIZE]; } __packed; +struct net_icmpv6_ptb { + uint32_t mtu; +} __packed; #define NET_ICMPV6_ND_O_FLAG(flag) ((flag) & 0x40) #define NET_ICMPV6_ND_M_FLAG(flag) ((flag) & 0x80) diff --git a/subsys/net/ip/ipv6_nbr.c b/subsys/net/ip/ipv6_nbr.c index 8102da13c2f16..5ad332c3dec0a 100644 --- a/subsys/net/ip/ipv6_nbr.c +++ b/subsys/net/ip/ipv6_nbr.c @@ -35,6 +35,7 @@ LOG_MODULE_REGISTER(net_ipv6_nd, CONFIG_NET_IPV6_ND_LOG_LEVEL); #include "6lo.h" #include "route.h" #include "net_stats.h" +#include "pmtu.h" /* Timeout value to be used when allocating net buffer during various * neighbor discovery procedures. @@ -903,6 +904,26 @@ enum net_verdict net_ipv6_prepare_for_send(struct net_pkt *pkt) } try_send: + if (IS_ENABLED(CONFIG_NET_IPV6_PMTU)) { + struct net_pmtu_entry *entry; + struct sockaddr_in6 dst = { + .sin6_family = AF_INET6, + }; + + net_ipaddr_copy(&dst.sin6_addr, (struct in6_addr *)ip_hdr->dst); + + entry = net_pmtu_get_entry((struct sockaddr *)&dst); + if (entry == NULL) { + ret = net_pmtu_update_mtu((struct sockaddr *)&dst, + net_if_get_mtu(iface)); + if (ret < 0) { + NET_DBG("Cannot update PMTU for %s (%d)", + net_sprint_ipv6_addr(&dst.sin6_addr), + ret); + } + } + } + net_ipv6_nbr_lock(); nbr = nbr_lookup(&net_neighbor.table, iface, nexthop); @@ -2727,6 +2748,98 @@ static int handle_ra_input(struct net_icmp_ctx *ctx, } #endif /* CONFIG_NET_IPV6_ND */ +#if defined(CONFIG_NET_IPV6_PMTU) +/* Packet format described in RFC 4443 ch 3.2. Packet Too Big Message */ +static int handle_ptb_input(struct net_icmp_ctx *ctx, + struct net_pkt *pkt, + struct net_icmp_ip_hdr *hdr, + struct net_icmp_hdr *icmp_hdr, + void *user_data) +{ + NET_PKT_DATA_ACCESS_CONTIGUOUS_DEFINE(ptb_access, struct net_icmpv6_ptb); + struct net_ipv6_hdr *ip_hdr = hdr->ipv6; + uint16_t length = net_pkt_get_len(pkt); + struct net_icmpv6_ptb *ptb_hdr; + struct sockaddr_in6 sockaddr_src = { + .sin6_family = AF_INET6, + }; + struct net_pmtu_entry *entry; + uint32_t mtu; + int ret; + + ARG_UNUSED(user_data); + + ptb_hdr = (struct net_icmpv6_ptb *)net_pkt_get_data(pkt, &ptb_access); + if (!ptb_hdr) { + NET_DBG("DROP: NULL PTB header"); + goto drop; + } + + dbg_addr_recv("Packet Too Big", &ip_hdr->src, &ip_hdr->dst, pkt); + + net_stats_update_ipv6_pmtu_recv(net_pkt_iface(pkt)); + + if (length < (sizeof(struct net_ipv6_hdr) + + sizeof(struct net_icmp_hdr) + + sizeof(struct net_icmpv6_ptb))) { + NET_DBG("DROP: length %d too big %zd", + length, sizeof(struct net_ipv6_hdr) + + sizeof(struct net_icmp_hdr) + + sizeof(struct net_icmpv6_ptb)); + goto drop; + } + + net_pkt_acknowledge_data(pkt, &ptb_access); + + mtu = ntohl(ptb_hdr->mtu); + + if (mtu < MIN_IPV6_MTU || mtu > MAX_IPV6_MTU) { + NET_DBG("DROP: Unsupported MTU %u, min is %u, max is %u", + mtu, MIN_IPV6_MTU, MAX_IPV6_MTU); + goto drop; + } + + net_ipaddr_copy(&sockaddr_src.sin6_addr, (struct in6_addr *)&ip_hdr->src); + + entry = net_pmtu_get_entry((struct sockaddr *)&sockaddr_src); + if (entry == NULL) { + NET_DBG("DROP: Cannot find PMTU entry for %s", + net_sprint_ipv6_addr(&ip_hdr->src)); + goto silent_drop; + } + + /* We must not accept larger PMTU value than what we already know. + * RFC 8201 chapter 4 page 8. + */ + if (entry->mtu > 0 && entry->mtu < mtu) { + NET_DBG("DROP: PMTU for %s %u larger than %u", + net_sprint_ipv6_addr(&ip_hdr->src), mtu, + entry->mtu); + goto silent_drop; + } + + ret = net_pmtu_update_entry(entry, mtu); + if (ret > 0) { + NET_DBG("PMTU for %s changed from %u to %u", + net_sprint_ipv6_addr(&ip_hdr->src), ret, mtu); + } + + return 0; +drop: + net_stats_update_ipv6_pmtu_drop(net_pkt_iface(pkt)); + + return -EIO; + +silent_drop: + /* If the event is not really an error then just ignore it and + * return 0 so that icmpv6 module will not complain about it. + */ + net_stats_update_ipv6_pmtu_drop(net_pkt_iface(pkt)); + + return 0; +} +#endif /* CONFIG_NET_IPV6_PMTU */ + #if defined(CONFIG_NET_IPV6_NBR_CACHE) static struct net_icmp_ctx ns_ctx; static struct net_icmp_ctx na_ctx; @@ -2736,6 +2849,10 @@ static struct net_icmp_ctx na_ctx; static struct net_icmp_ctx ra_ctx; #endif /* CONFIG_NET_IPV6_ND */ +#if defined(CONFIG_NET_IPV6_PMTU) +static struct net_icmp_ctx ptb_ctx; +#endif /* CONFIG_NET_IPV6_PMTU */ + void net_ipv6_nbr_init(void) { int ret; @@ -2766,5 +2883,13 @@ void net_ipv6_nbr_init(void) ipv6_nd_reachable_timeout); #endif +#if defined(CONFIG_NET_IPV6_PMTU) + ret = net_icmp_init_ctx(&ptb_ctx, NET_ICMPV6_PACKET_TOO_BIG, 0, handle_ptb_input); + if (ret < 0) { + NET_ERR("Cannot register %s handler (%d)", STRINGIFY(NET_ICMPV6_PACKET_TOO_BIG), + ret); + } +#endif + ARG_UNUSED(ret); } diff --git a/subsys/net/ip/tcp.c b/subsys/net/ip/tcp.c index b7dd20d3ffdf8..094990109c2a8 100644 --- a/subsys/net/ip/tcp.c +++ b/subsys/net/ip/tcp.c @@ -25,6 +25,7 @@ LOG_MODULE_REGISTER(net_tcp, CONFIG_NET_TCP_LOG_LEVEL); #include "net_stats.h" #include "net_private.h" #include "tcp_internal.h" +#include "pmtu.h" #define ACK_TIMEOUT_MS tcp_max_timeout_ms #define ACK_TIMEOUT K_MSEC(ACK_TIMEOUT_MS) @@ -4392,6 +4393,32 @@ void net_tcp_foreach(net_tcp_cb_t cb, void *user_data) k_mutex_unlock(&tcp_lock); } +static uint16_t get_ipv6_destination_mtu(struct net_if *iface, + const struct in6_addr *dest) +{ +#if defined(CONFIG_NET_IPV6_PMTU) + int mtu = net_pmtu_get_mtu((struct sockaddr *)&(struct sockaddr_in6){ + .sin6_family = AF_INET6, + .sin6_addr = *dest }); + + if (mtu < 0) { + if (iface != NULL) { + return net_if_get_mtu(iface); + } + + return NET_IPV6_MTU; + } + + return (uint16_t)mtu; +#else + if (iface != NULL) { + return net_if_get_mtu(iface); + } + + return NET_IPV6_MTU; +#endif /* CONFIG_NET_IPV6_PMTU */ +} + uint16_t net_tcp_get_supported_mss(const struct tcp *conn) { sa_family_t family = net_context_get_family(conn->context); @@ -4416,26 +4443,16 @@ uint16_t net_tcp_get_supported_mss(const struct tcp *conn) #else return 0; #endif /* CONFIG_NET_IPV4 */ - } -#if defined(CONFIG_NET_IPV6) - else if (family == AF_INET6) { - struct net_if *iface = net_context_get_iface(conn->context); - int mss = 0; - if (iface && net_if_get_mtu(iface) >= NET_IPV6TCPH_LEN) { - /* Detect MSS based on interface MTU minus "TCP,IP - * header size" - */ - mss = net_if_get_mtu(iface) - NET_IPV6TCPH_LEN; - } + } else if (IS_ENABLED(CONFIG_NET_IPV6) && family == AF_INET6) { + struct net_if *iface = net_context_get_iface(conn->context); + uint16_t dest_mtu; - if (mss == 0) { - mss = NET_IPV6_MTU - NET_IPV6TCPH_LEN; - } + dest_mtu = get_ipv6_destination_mtu(iface, &conn->dst.sin6.sin6_addr); - return mss; + /* Detect MSS based on interface MTU minus "TCP,IP header size" */ + return dest_mtu - NET_IPV6TCPH_LEN; } -#endif /* CONFIG_NET_IPV6 */ return 0; } From 281c4ac742f44ec80e28ad3b5bdb8f1617a7ab48 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 5 Nov 2024 10:45:12 +0200 Subject: [PATCH 2676/4482] tests: net: pmtu: Add IPv6 specific PMTU TCP tests Allow tests to check whether a IPv6 TCP connection MTU is changed. Signed-off-by: Jukka Rissanen --- subsys/net/ip/tcp.c | 38 +++++ tests/net/pmtu/prj.conf | 9 +- tests/net/pmtu/src/main.c | 283 ++++++++++++++++++++++++++++++-------- 3 files changed, 268 insertions(+), 62 deletions(-) diff --git a/subsys/net/ip/tcp.c b/subsys/net/ip/tcp.c index 094990109c2a8..47f3f4b4104aa 100644 --- a/subsys/net/ip/tcp.c +++ b/subsys/net/ip/tcp.c @@ -4457,6 +4457,44 @@ uint16_t net_tcp_get_supported_mss(const struct tcp *conn) return 0; } +#if defined(CONFIG_NET_TEST) +struct testing_user_data { + struct sockaddr remote; + uint16_t mtu; +}; + +static void testing_find_conn(struct tcp *conn, void *user_data) +{ + struct testing_user_data *data = user_data; + + if (IS_ENABLED(CONFIG_NET_IPV6) && data->remote.sa_family == AF_INET6 && + net_ipv6_addr_cmp(&conn->dst.sin6.sin6_addr, + &net_sin6(&data->remote)->sin6_addr)) { + if (data->mtu > 0) { + /* Set it only once */ + return; + } + + NET_DBG("Found connection %p mtu %u", conn, + net_tcp_get_supported_mss(conn) + NET_IPV6TCPH_LEN); + data->mtu = net_tcp_get_supported_mss(conn) + NET_IPV6TCPH_LEN; + return; + } +} + +uint16_t net_tcp_get_mtu(struct sockaddr *dst) +{ + struct testing_user_data data = { + .remote = *dst, + .mtu = 0, + }; + + net_tcp_foreach(testing_find_conn, &data); + + return data.mtu; +} +#endif /* CONFIG_NET_TEST */ + int net_tcp_set_option(struct net_context *context, enum tcp_conn_option option, const void *value, size_t len) diff --git a/tests/net/pmtu/prj.conf b/tests/net/pmtu/prj.conf index 1006a8ccc03d2..48d1ac83464be 100644 --- a/tests/net/pmtu/prj.conf +++ b/tests/net/pmtu/prj.conf @@ -2,13 +2,15 @@ CONFIG_ZTEST=y CONFIG_MAIN_STACK_SIZE=2048 CONFIG_NET_TEST=y CONFIG_NETWORKING=y -CONFIG_NET_UDP=y -CONFIG_NET_TCP=n +CONFIG_NET_UDP=n +CONFIG_NET_TCP=y CONFIG_NET_IPV6=y CONFIG_NET_IPV6_PMTU=y CONFIG_NET_IPV4=y CONFIG_NET_IPV4_PMTU=y -CONFIG_NET_L2_ETHERNET=y +CONFIG_NET_L2_DUMMY=y +CONFIG_NET_LOOPBACK=y +CONFIG_NET_DRIVERS=y CONFIG_NET_LOG=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y @@ -18,3 +20,4 @@ CONFIG_NET_BUF_RX_COUNT=20 CONFIG_NET_BUF_TX_COUNT=20 CONFIG_NET_MGMT=y CONFIG_NET_MGMT_EVENT=y +CONFIG_NET_SOCKETS=y diff --git a/tests/net/pmtu/src/main.c b/tests/net/pmtu/src/main.c index 006101e684c74..7f3dbd8c18907 100644 --- a/tests/net/pmtu/src/main.c +++ b/tests/net/pmtu/src/main.c @@ -23,12 +23,19 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_PMTU_LOG_LEVEL); #include #include #include +#include +#include #include #include #include #include +#include "../../socket/socket_helpers.h" + +#include "route.h" +#include "icmpv6.h" +#include "ipv6.h" #include "pmtu.h" #define NET_LOG_ENABLED 1 @@ -40,20 +47,22 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_PMTU_LOG_LEVEL); #define DBG(fmt, ...) #endif +/* This is a helper function to get the MTU value for the given destination. + * It is implemented in tcp.c file. + */ +extern uint16_t net_tcp_get_mtu(struct sockaddr *dst); + /* Small sleep between tests makes sure that the PMTU destination * cache entries are separated from each other. */ #define SMALL_SLEEP K_MSEC(5) -static struct in_addr my_ipv4_addr = { { { 192, 0, 2, 1 } } }; static struct in_addr dest_ipv4_addr1 = { { { 198, 51, 100, 1 } } }; static struct in_addr dest_ipv4_addr2 = { { { 198, 51, 100, 2 } } }; static struct in_addr dest_ipv4_addr3 = { { { 198, 51, 100, 3 } } }; static struct in_addr dest_ipv4_addr4 = { { { 198, 51, 100, 4 } } }; -static struct in_addr any_ipv4_addr = INADDR_ANY_INIT; +static struct in_addr dest_ipv4_addr_not_found = { { { 1, 2, 3, 4 } } }; -static struct in6_addr my_ipv6_addr = { { { 0x20, 0x01, 0x0d, 0xb8, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0x1 } } }; static struct in6_addr dest_ipv6_addr1 = { { { 0x20, 0x01, 0x0d, 0xb8, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1 } } }; static struct in6_addr dest_ipv6_addr2 = { { { 0x20, 0x01, 0x0d, 0xb8, 0x01, 0, 0, 0, @@ -62,75 +71,61 @@ static struct in6_addr dest_ipv6_addr3 = { { { 0x20, 0x01, 0x0d, 0xb8, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0x3 } } }; static struct in6_addr dest_ipv6_addr4 = { { { 0x20, 0x01, 0x0d, 0xb8, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x4 } } }; -static struct in6_addr any_ipv6_addr = IN6ADDR_ANY_INIT; +static struct in6_addr dest_ipv6_addr_not_found = { { { 0x20, 0x01, 0x0d, 0xb8, 0xde, + 0xad, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x4 } } }; + +static struct net_if *target_iface; +static char target_iface_name[CONFIG_NET_INTERFACE_NAME_LEN + 1]; K_SEM_DEFINE(wait_data, 0, UINT_MAX); +#define PKT_WAIT_TIME K_MSEC(500) #define WAIT_TIME 500 #define WAIT_TIME_LONG MSEC_PER_SEC #define MY_PORT 1969 -#define PEER_PORT 13856 +#define PEER_PORT 2024 +#define PEER_IPV6_ADDR "::1" +#define MY_IPV6_ADDR "::1" +#define MY_IPV4_ADDR "127.0.0.1" +#define PEER_IPV4_ADDR "127.0.0.1" -struct net_test_pmtu { - uint8_t mac_addr[sizeof(struct net_eth_addr)]; - struct net_linkaddr ll_addr; -}; +#define THREAD_SLEEP 50 /* ms */ -int net_test_dev_init(const struct device *dev) +static const char *iface2str(struct net_if *iface) { - return 0; -} - -static uint8_t *net_test_get_mac(const struct device *dev) -{ - struct net_test_pmtu *context = dev->data; - - if (context->mac_addr[2] == 0x00) { - /* 00-00-5E-00-53-xx Documentation RFC 7042 */ - context->mac_addr[0] = 0x00; - context->mac_addr[1] = 0x00; - context->mac_addr[2] = 0x5E; - context->mac_addr[3] = 0x00; - context->mac_addr[4] = 0x53; - context->mac_addr[5] = sys_rand8_get(); + if (net_if_l2(iface) == &NET_L2_GET_NAME(DUMMY)) { + return "No L2"; } - return context->mac_addr; + return ""; } -static void net_test_iface_init(struct net_if *iface) +static void iface_cb(struct net_if *iface, void *user_data) { - uint8_t *mac = net_test_get_mac(net_if_get_device(iface)); + static int if_count; - net_if_set_link_addr(iface, mac, sizeof(struct net_eth_addr), - NET_LINK_ETHERNET); -} + NET_DBG("Interface %p (%s) [%d]", iface, iface2str(iface), + net_if_get_by_iface(iface)); -static int tester_send(const struct device *dev, struct net_pkt *pkt) -{ - if (!pkt->buffer) { - TC_ERROR("No data to send!\n"); - return -ENODATA; + switch (if_count) { + case 0: + target_iface = iface; + (void)net_if_get_name(iface, target_iface_name, + CONFIG_NET_INTERFACE_NAME_LEN); + break; } - return 0; + if_count++; } -struct net_test_pmtu net_test_data; - -static struct ethernet_api net_test_if_api = { - .iface_api.init = net_test_iface_init, - .send = tester_send, -}; +static void *test_setup(void) +{ + net_if_foreach(iface_cb, NULL); -#define _ETH_L2_LAYER ETHERNET_L2 -#define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(ETHERNET_L2) + zassert_not_null(target_iface, "Interface is NULL"); -NET_DEVICE_INIT(net_test_pmtu, "net_test_pmtu", - net_test_dev_init, NULL, &net_test_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &net_test_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, - 127); + return NULL; +} ZTEST(net_pmtu_test_suite, test_pmtu_01_ipv4_get_entry) { @@ -209,6 +204,7 @@ ZTEST(net_pmtu_test_suite, test_pmtu_03_ipv4_create_more_entries) #if defined(CONFIG_NET_IPV4_PMTU) struct sockaddr_in dest_ipv4; struct net_pmtu_entry *entry; + uint16_t mtu; int ret; dest_ipv4.sin_family = AF_INET; @@ -225,10 +221,8 @@ ZTEST(net_pmtu_test_suite, test_pmtu_03_ipv4_create_more_entries) net_ipaddr_copy(&dest_ipv4.sin_addr, &dest_ipv4_addr2); ret = net_pmtu_update_mtu((struct sockaddr *)&dest_ipv4, 1400); zassert_equal(ret, 0, "PMTU IPv4 MTU update failed (%d)", ret); - entry = net_pmtu_get_entry((struct sockaddr *)&dest_ipv4); - zassert_equal(entry->mtu, 1400, "PMTU IPv4 MTU is not correct (%d)", - entry->mtu); - + mtu = net_pmtu_get_mtu((struct sockaddr *)&dest_ipv4); + zassert_equal(mtu, 1400, "PMTU IPv4 MTU is not correct (%d)", mtu); k_sleep(SMALL_SLEEP); @@ -238,6 +232,12 @@ ZTEST(net_pmtu_test_suite, test_pmtu_03_ipv4_create_more_entries) entry = net_pmtu_get_entry((struct sockaddr *)&dest_ipv4); zassert_equal(entry->mtu, 1500, "PMTU IPv4 MTU is not correct (%d)", entry->mtu); + + net_ipaddr_copy(&dest_ipv4.sin_addr, &dest_ipv4_addr_not_found); + ret = net_pmtu_get_mtu((struct sockaddr *)&dest_ipv4); + zassert_equal(ret, -ENOENT, "PMTU IPv4 MTU update succeed (%d)", ret); + entry = net_pmtu_get_entry((struct sockaddr *)&dest_ipv4); + zassert_equal(entry, NULL, "PMTU IPv4 MTU update succeed"); #else ztest_test_skip(); #endif @@ -248,6 +248,7 @@ ZTEST(net_pmtu_test_suite, test_pmtu_03_ipv6_create_more_entries) #if defined(CONFIG_NET_IPV6_PMTU) struct sockaddr_in6 dest_ipv6; struct net_pmtu_entry *entry; + uint16_t mtu; int ret; dest_ipv6.sin6_family = AF_INET6; @@ -264,9 +265,8 @@ ZTEST(net_pmtu_test_suite, test_pmtu_03_ipv6_create_more_entries) net_ipaddr_copy(&dest_ipv6.sin6_addr, &dest_ipv6_addr2); ret = net_pmtu_update_mtu((struct sockaddr *)&dest_ipv6, 1700); zassert_equal(ret, 0, "PMTU IPv6 MTU update failed (%d)", ret); - entry = net_pmtu_get_entry((struct sockaddr *)&dest_ipv6); - zassert_equal(entry->mtu, 1700, "PMTU IPv6 MTU is not correct (%d)", - entry->mtu); + mtu = net_pmtu_get_mtu((struct sockaddr *)&dest_ipv6); + zassert_equal(mtu, 1700, "PMTU IPv6 MTU is not correct (%d)", mtu); k_sleep(SMALL_SLEEP); @@ -276,6 +276,12 @@ ZTEST(net_pmtu_test_suite, test_pmtu_03_ipv6_create_more_entries) entry = net_pmtu_get_entry((struct sockaddr *)&dest_ipv6); zassert_equal(entry->mtu, 1800, "PMTU IPv6 MTU is not correct (%d)", entry->mtu); + + net_ipaddr_copy(&dest_ipv6.sin6_addr, &dest_ipv6_addr_not_found); + ret = net_pmtu_get_mtu((struct sockaddr *)&dest_ipv6); + zassert_equal(ret, -ENOENT, "PMTU IPv6 MTU update succeed (%d)", ret); + entry = net_pmtu_get_entry((struct sockaddr *)&dest_ipv6); + zassert_equal(entry, NULL, "PMTU IPv6 MTU update succeed"); #else ztest_test_skip(); #endif @@ -349,4 +355,163 @@ ZTEST(net_pmtu_test_suite, test_pmtu_04_ipv6_overflow) #endif } -ZTEST_SUITE(net_pmtu_test_suite, NULL, NULL, NULL, NULL, NULL); +static void test_bind(int sock, struct sockaddr *addr, socklen_t addrlen) +{ + int ret; + + ret = zsock_bind(sock, addr, addrlen); + zassert_equal(ret, 0, "bind failed with error %d", errno); +} + +static void test_listen(int sock) +{ + zassert_equal(zsock_listen(sock, 1), + 0, + "listen failed with error %d", errno); +} + +static void test_connect(int sock, struct sockaddr *addr, socklen_t addrlen) +{ + zassert_equal(zsock_connect(sock, addr, addrlen), + 0, + "connect failed with error %d", errno); + + if (IS_ENABLED(CONFIG_NET_TC_THREAD_PREEMPTIVE)) { + /* Let the connection proceed */ + k_msleep(THREAD_SLEEP); + } +} + +static void test_accept(int sock, int *new_sock, struct sockaddr *addr, + socklen_t *addrlen) +{ + zassert_not_null(new_sock, "null newsock"); + + *new_sock = zsock_accept(sock, addr, addrlen); + zassert_true(*new_sock >= 0, "accept failed"); +} + +#if defined(CONFIG_NET_IPV6_PMTU) +static int get_v6_send_recv_sock(int *srv_sock, + struct sockaddr_in6 *my_saddr, + struct sockaddr_in6 *peer_saddr) +{ + struct sockaddr addr; + socklen_t addrlen = sizeof(addr); + int new_sock; + int c_sock; + int s_sock; + + prepare_sock_tcp_v6(PEER_IPV6_ADDR, PEER_PORT, &s_sock, peer_saddr); + test_bind(s_sock, (struct sockaddr *)peer_saddr, sizeof(*peer_saddr)); + test_listen(s_sock); + + prepare_sock_tcp_v6(MY_IPV6_ADDR, MY_PORT, &c_sock, my_saddr); + test_bind(c_sock, (struct sockaddr *)my_saddr, sizeof(*my_saddr)); + test_connect(c_sock, (struct sockaddr *)peer_saddr, sizeof(*peer_saddr)); + + test_accept(s_sock, &new_sock, &addr, &addrlen); + zassert_equal(addrlen, sizeof(struct sockaddr_in6), "wrong addrlen"); + + *srv_sock = new_sock; + + return c_sock; +} + +static int create_icmpv6_ptb(struct net_if *iface, + struct sockaddr_in6 *src, + struct sockaddr_in6 *dst, + uint32_t mtu, + struct net_pkt **pkt) +{ + struct net_icmpv6_ptb ptb_hdr; + struct net_pkt *ptb_pkt; + struct in6_addr *dest6; + struct in6_addr *src6; + int ret; + + ptb_pkt = net_pkt_alloc_with_buffer(iface, sizeof(struct net_ipv6_hdr) + + sizeof(struct net_icmp_hdr) + + sizeof(struct net_icmpv6_ptb), + AF_INET6, IPPROTO_ICMPV6, + PKT_WAIT_TIME); + if (ptb_pkt == NULL) { + NET_DBG("No buffer"); + return -ENOMEM; + } + + dest6 = &dst->sin6_addr; + src6 = &src->sin6_addr; + + ret = net_ipv6_create(ptb_pkt, src6, dest6); + if (ret < 0) { + LOG_ERR("Cannot create IPv6 pkt (%d)", ret); + return ret; + } + + ret = net_icmpv6_create(ptb_pkt, NET_ICMPV6_PACKET_TOO_BIG, 0); + if (ret < 0) { + LOG_ERR("Cannot create ICMPv6 pkt (%d)", ret); + return ret; + } + + ptb_hdr.mtu = htonl(mtu); + + ret = net_pkt_write(ptb_pkt, &ptb_hdr, sizeof(ptb_hdr)); + if (ret < 0) { + LOG_ERR("Cannot write payload (%d)", ret); + return ret; + } + + net_pkt_cursor_init(ptb_pkt); + net_ipv6_finalize(ptb_pkt, IPPROTO_ICMPV6); + + net_pkt_set_iface(ptb_pkt, iface); + + *pkt = ptb_pkt; + + return 0; +} +#endif + +ZTEST(net_pmtu_test_suite, test_pmtu_05_ipv6_tcp) +{ +#if defined(CONFIG_NET_IPV6_PMTU) + struct sockaddr_in6 dest_ipv6; + struct sockaddr_in6 s_saddr = { 0 }; /* peer */ + struct sockaddr_in6 c_saddr = { 0 }; /* this host */ + struct net_pkt *pkt = NULL; + int client_sock, server_sock; + uint16_t mtu; + int ret; + + dest_ipv6.sin6_family = AF_INET6; + + client_sock = get_v6_send_recv_sock(&server_sock, &c_saddr, &s_saddr); + zassert_true(client_sock >= 0, "Failed to create client socket"); + + /* Set initial MTU for the destination */ + ret = net_pmtu_update_mtu((struct sockaddr *)&c_saddr, 4096); + zassert_true(ret >= 0, "PMTU IPv6 MTU update failed (%d)", ret); + + /* Send an ICMPv6 "Packet too big" message from server to client which + * will update the PMTU entry. + */ + ret = create_icmpv6_ptb(target_iface, &s_saddr, &c_saddr, 2048, &pkt); + zassert_equal(ret, 0, "Failed to create ICMPv6 PTB message"); + + ret = net_send_data(pkt); + zassert_equal(ret, 0, "Failed to send PTB message"); + + /* Check that the PMTU entry has been updated */ + mtu = net_tcp_get_mtu((struct sockaddr *)&s_saddr); + zassert_equal(mtu, 2048, "PMTU IPv6 MTU is not correct (%d)", mtu); + + (void)zsock_close(client_sock); + (void)zsock_close(server_sock); +#else + ztest_test_skip(); +#endif /* CONFIG_NET_IPV6_PMTU */ +} + +ZTEST_SUITE(net_pmtu_test_suite, NULL, test_setup, NULL, NULL, NULL); From ab0ddc0bbee3f1f5e12acbb2792770f626a0e8ca Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 5 Nov 2024 14:47:48 +0200 Subject: [PATCH 2677/4482] net: shell: Add pmtu command to the net-shell Show information whether PMTU is enabled or not. Show pmtu destination cache content with "net pmtu" command. The "net pmtu flush" can be used to clear the cache. Signed-off-by: Jukka Rissanen --- subsys/net/ip/Kconfig | 5 ++ subsys/net/lib/shell/CMakeLists.txt | 1 + subsys/net/lib/shell/ipv4.c | 2 + subsys/net/lib/shell/ipv6.c | 4 + subsys/net/lib/shell/pmtu.c | 112 ++++++++++++++++++++++++++++ 5 files changed, 124 insertions(+) create mode 100644 subsys/net/lib/shell/pmtu.c diff --git a/subsys/net/ip/Kconfig b/subsys/net/ip/Kconfig index 70155b82f847c..387c352e8d59b 100644 --- a/subsys/net/ip/Kconfig +++ b/subsys/net/ip/Kconfig @@ -265,6 +265,11 @@ config NET_SHELL_PKT_ALLOC_SUPPORTED default y depends on NET_SHELL_SHOW_DISABLED_COMMANDS || NET_DEBUG_NET_PKT_ALLOC +config NET_SHELL_PMTU_SUPPORTED + bool "PMTU config" + default y + depends on NET_SHELL_SHOW_DISABLED_COMMANDS || NET_PMTU + config NET_SHELL_PPP_SUPPORTED bool "PPP config" default y diff --git a/subsys/net/lib/shell/CMakeLists.txt b/subsys/net/lib/shell/CMakeLists.txt index 05c92897403e0..02e9dde5e283c 100644 --- a/subsys/net/lib/shell/CMakeLists.txt +++ b/subsys/net/lib/shell/CMakeLists.txt @@ -24,6 +24,7 @@ zephyr_library_sources(mem.c) zephyr_library_sources_ifdef(CONFIG_NET_SHELL_IPV6_SUPPORTED nbr.c) zephyr_library_sources_ifdef(CONFIG_NET_SHELL_IP_SUPPORTED ping.c) zephyr_library_sources(pkt.c) +zephyr_library_sources_ifdef(CONFIG_NET_SHELL_PMTU_SUPPORTED pmtu.c) zephyr_library_sources_ifdef(CONFIG_NET_SHELL_PPP_SUPPORTED ppp.c) zephyr_library_sources_ifdef(CONFIG_NET_SHELL_POWER_MANAGEMENT_SUPPORTED resume.c) zephyr_library_sources_ifdef(CONFIG_NET_SHELL_ROUTE_SUPPORTED route.c) diff --git a/subsys/net/lib/shell/ipv4.c b/subsys/net/lib/shell/ipv4.c index d70dc786828be..966783182a657 100644 --- a/subsys/net/lib/shell/ipv4.c +++ b/subsys/net/lib/shell/ipv4.c @@ -68,6 +68,8 @@ static int cmd_net_ipv4(const struct shell *sh, size_t argc, char *argv[]) PR("IPv4 conflict detection support : %s\n", IS_ENABLED(CONFIG_NET_IPV4_ACD) ? "enabled" : "disabled"); + PR("Path MTU Discovery (PMTU) : %s\n", + IS_ENABLED(CONFIG_NET_IPV4_PMTU) ? "enabled" : "disabled"); #endif /* CONFIG_NET_NATIVE_IPV4 */ #if defined(CONFIG_NET_IPV4) diff --git a/subsys/net/lib/shell/ipv6.c b/subsys/net/lib/shell/ipv6.c index bf0cf904ba5a8..744ea6a07043d 100644 --- a/subsys/net/lib/shell/ipv6.c +++ b/subsys/net/lib/shell/ipv6.c @@ -197,6 +197,10 @@ static int cmd_net_ipv6(const struct shell *sh, size_t argc, char *argv[]) " : %d\n", CONFIG_NET_IPV6_PE_FILTER_PREFIX_COUNT); #endif /* CONFIG_NET_IPV6_PE */ + + PR("Path MTU Discovery (PMTU) : %s\n", + IS_ENABLED(CONFIG_NET_IPV6_PMTU) ? "enabled" : "disabled"); + #endif /* CONFIG_NET_NATIVE_IPV6 */ #if defined(CONFIG_NET_IPV6) diff --git a/subsys/net/lib/shell/pmtu.c b/subsys/net/lib/shell/pmtu.c new file mode 100644 index 0000000000000..bf8eca403ce84 --- /dev/null +++ b/subsys/net/lib/shell/pmtu.c @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +LOG_MODULE_DECLARE(net_shell); + +#include "net_shell_private.h" + +#include "pmtu.h" + +#if !defined(CONFIG_NET_PMTU) +static void print_pmtu_error(const struct shell *sh) +{ + PR_INFO("Set %s to enable %s support.\n", + "CONFIG_NET_IPV6_PMTU or CONFIG_NET_IPV4_PMTU", "PMTU"); +} +#endif + +#if defined(CONFIG_NET_PMTU) +static void pmtu_cb(struct net_pmtu_entry *entry, void *user_data) +{ + struct net_shell_user_data *data = user_data; + const struct shell *sh = data->sh; + int *count = data->user_data; + +#if defined(CONFIG_NET_IPV4) && defined(CONFIG_NET_IPV6) +/* Use the value of NET_IPV6_ADDR_LEN */ +#define ADDR_STR_LEN 40 +#elif defined(CONFIG_NET_IPV4) +#define ADDR_STR_LEN INET_ADDRSTRLEN +#elif defined(CONFIG_NET_IPV6) +#define ADDR_STR_LEN 40 +#else +#define ADDR_STR_LEN INET_ADDRSTRLEN +#endif + + if (!entry->in_use) { + return; + } + + if (*count == 0) { + PR(" %" STRINGIFY(ADDR_STR_LEN) "s MTU Age (sec)\n", + "Destination Address"); + } + + PR("[%2d] %" STRINGIFY(ADDR_STR_LEN) "s %5d %d\n", *count + 1, + net_sprint_addr(entry->dst.family, (void *)&entry->dst.in_addr), + entry->mtu, + (k_uptime_get_32() - entry->last_update) / 1000U); + + (*count)++; +} +#endif /* CONFIG_NET_PMTU */ + +static int cmd_net_pmtu(const struct shell *sh, size_t argc, char *argv[]) +{ +#if defined(CONFIG_NET_PMTU) + struct net_shell_user_data user_data; + int arg = 1; +#endif + + ARG_UNUSED(argc); + +#if defined(CONFIG_NET_PMTU) + if (!argv[arg]) { + /* PMTU destination cache content */ + int count = 0; + + user_data.sh = sh; + user_data.user_data = &count; + + (void)net_pmtu_foreach(pmtu_cb, &user_data); + + if (count == 0) { + PR("PMTU destination cache is empty.\n"); + } + } +#else + print_pmtu_error(sh); +#endif + + return 0; +} + +static int cmd_net_pmtu_flush(const struct shell *sh, size_t argc, char *argv[]) +{ + ARG_UNUSED(argc); + ARG_UNUSED(argv); + +#if defined(CONFIG_NET_PMTU) + PR("Flushing PMTU destination cache.\n"); + net_pmtu_init(); +#else + print_pmtu_error(sh); +#endif + + return 0; +} + +SHELL_STATIC_SUBCMD_SET_CREATE(net_cmd_pmtu, + SHELL_CMD(flush, NULL, + "Remove all entries from PMTU destination cache.", + cmd_net_pmtu_flush), + SHELL_SUBCMD_SET_END +); + +SHELL_SUBCMD_ADD((net), pmtu, &net_cmd_pmtu, + "Show PMTU information.", + cmd_net_pmtu, 1, 0); From d178eb2908f898319fb5d2791280086901092dba Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 5 Nov 2024 16:53:24 +0200 Subject: [PATCH 2678/4482] net: stats: ipv4: pmtu: Add Path MTU Discovery statistics Add information about PMTU related packets received/sent/dropped for IPv4. Signed-off-by: Jukka Rissanen --- include/zephyr/net/net_stats.h | 30 ++++++++++++++++++++++++++++++ samples/net/stats/src/main.c | 7 +++++++ subsys/net/ip/Kconfig.stats | 7 +++++++ subsys/net/ip/net_stats.c | 18 ++++++++++++++++++ subsys/net/ip/net_stats.h | 23 +++++++++++++++++++++++ subsys/net/lib/shell/stats.c | 7 +++++++ 6 files changed, 92 insertions(+) diff --git a/include/zephyr/net/net_stats.h b/include/zephyr/net/net_stats.h index 93f34da6236fe..2fb28b6104c71 100644 --- a/include/zephyr/net/net_stats.h +++ b/include/zephyr/net/net_stats.h @@ -212,6 +212,20 @@ struct net_stats_ipv6_pmtu { net_stats_t sent; }; +/** + * @brief IPv4 Path MTU Discovery statistics + */ +struct net_stats_ipv4_pmtu { + /** Number of dropped IPv4 PMTU packets. */ + net_stats_t drop; + + /** Number of received IPv4 PMTU packets. */ + net_stats_t recv; + + /** Number of sent IPv4 PMTU packets. */ + net_stats_t sent; +}; + /** * @brief IPv6 multicast listener daemon statistics */ @@ -398,6 +412,11 @@ struct net_stats { struct net_stats_ipv6_pmtu ipv6_pmtu; #endif +#if defined(CONFIG_NET_STATISTICS_IPV4_PMTU) + /** IPv4 Path MTU Discovery statistics */ + struct net_stats_ipv4_pmtu ipv4_pmtu; +#endif + #if defined(CONFIG_NET_STATISTICS_MLD) /** IPv6 MLD statistics */ struct net_stats_ipv6_mld ipv6_mld; @@ -685,6 +704,7 @@ enum net_request_stats_cmd { NET_REQUEST_STATS_CMD_GET_IPV6, NET_REQUEST_STATS_CMD_GET_IPV6_ND, NET_REQUEST_STATS_CMD_GET_IPV6_PMTU, + NET_REQUEST_STATS_CMD_GET_IPV4_PMTU, NET_REQUEST_STATS_CMD_GET_ICMP, NET_REQUEST_STATS_CMD_GET_UDP, NET_REQUEST_STATS_CMD_GET_TCP, @@ -762,6 +782,16 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_IPV6_PMTU); /** @endcond */ #endif /* CONFIG_NET_STATISTICS_IPV6_PMTU */ +#if defined(CONFIG_NET_STATISTICS_IPV4_PMTU) +/** Request IPv4 Path MTU Discovery statistics */ +#define NET_REQUEST_STATS_GET_IPV4_PMTU \ + (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_IPV4_PMTU) + +/** @cond INTERNAL_HIDDEN */ +NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_IPV4_PMTU); +/** @endcond */ +#endif /* CONFIG_NET_STATISTICS_IPV4_PMTU */ + #if defined(CONFIG_NET_STATISTICS_ICMP) /** Request ICMPv4 and ICMPv6 statistics */ #define NET_REQUEST_STATS_GET_ICMP \ diff --git a/samples/net/stats/src/main.c b/samples/net/stats/src/main.c index f6e35a89e904e..fdfb7e4339c18 100644 --- a/samples/net/stats/src/main.c +++ b/samples/net/stats/src/main.c @@ -74,6 +74,13 @@ static void print_stats(struct net_if *iface, struct net_stats *data) GET_STAT(iface, ip_errors.chkerr), GET_STAT(iface, ip_errors.protoerr)); +#if defined(CONFIG_NET_IPV4_PMTU) + printk("IPv4 PMTU recv %d\tsent\t%d\tdrop\t%d\n", + GET_STAT(iface, ipv4_pmtu.recv), + GET_STAT(iface, ipv4_pmtu.sent), + GET_STAT(iface, ipv4_pmtu.drop)); +#endif /* CONFIG_NET_IPV4_PMTU */ + printk("ICMP recv %d\tsent\t%d\tdrop\t%d\n", GET_STAT(iface, icmp.recv), GET_STAT(iface, icmp.sent), diff --git a/subsys/net/ip/Kconfig.stats b/subsys/net/ip/Kconfig.stats index 9851e5063fd06..cdd59c11685f1 100644 --- a/subsys/net/ip/Kconfig.stats +++ b/subsys/net/ip/Kconfig.stats @@ -64,6 +64,13 @@ config NET_STATISTICS_IPV6_PMTU help Keep track of IPv6 Path MTU Discovery related statistics +config NET_STATISTICS_IPV4_PMTU + bool "IPv4 PMTU statistics" + depends on NET_IPV4_PMTU + default y + help + Keep track of IPv4 Path MTU Discovery related statistics + config NET_STATISTICS_ICMP bool "ICMP statistics" depends on NET_IPV6 || NET_IPV4 diff --git a/subsys/net/ip/net_stats.c b/subsys/net/ip/net_stats.c index ab6d7855ee0eb..69579b9ec6fb5 100644 --- a/subsys/net/ip/net_stats.c +++ b/subsys/net/ip/net_stats.c @@ -122,6 +122,13 @@ static inline void stats(struct net_if *iface) GET_STAT(iface, ip_errors.chkerr), GET_STAT(iface, ip_errors.protoerr)); +#if defined(CONFIG_NET_STATISTICS_IPV4_PMTU) + NET_INFO("IPv4 PMTU recv %d\tsent\t%d\tdrop\t%d", + GET_STAT(iface, ipv4_pmtu.recv), + GET_STAT(iface, ipv4_pmtu.sent), + GET_STAT(iface, ipv4_pmtu.drop)); +#endif /* CONFIG_NET_STATISTICS_IPV4_PMTU */ + NET_INFO("ICMP recv %d\tsent\t%d\tdrop\t%d", GET_STAT(iface, icmp.recv), GET_STAT(iface, icmp.sent), @@ -291,6 +298,12 @@ static int net_stats_get(uint32_t mgmt_request, struct net_if *iface, src = GET_STAT_ADDR(iface, ipv6_pmtu); break; #endif +#if defined(CONFIG_NET_STATISTICS_IPV4_PMTU) + case NET_REQUEST_STATS_CMD_GET_IPV4_PMTU: + len_chk = sizeof(struct net_stats_ipv4_pmtu); + src = GET_STAT_ADDR(iface, ipv4_pmtu); + break; +#endif #if defined(CONFIG_NET_STATISTICS_ICMP) case NET_REQUEST_STATS_CMD_GET_ICMP: len_chk = sizeof(struct net_stats_icmp); @@ -358,6 +371,11 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_STATS_GET_IPV6_PMTU, net_stats_get); #endif +#if defined(CONFIG_NET_STATISTICS_IPV4_PMTU) +NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_STATS_GET_IPV4_PMTU, + net_stats_get); +#endif + #if defined(CONFIG_NET_STATISTICS_ICMP) NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_STATS_GET_ICMP, net_stats_get); diff --git a/subsys/net/ip/net_stats.h b/subsys/net/ip/net_stats.h index 54ae8ff3773ee..60777d06f1e4f 100644 --- a/subsys/net/ip/net_stats.h +++ b/subsys/net/ip/net_stats.h @@ -136,6 +136,29 @@ static inline void net_stats_update_ipv6_pmtu_drop(struct net_if *iface) #define net_stats_update_ipv6_pmtu_drop(iface) #endif /* CONFIG_NET_STATISTICS_IPV6_PMTU */ +#if defined(CONFIG_NET_STATISTICS_IPV4_PMTU) && defined(CONFIG_NET_NATIVE_IPV4) +/* IPv4 Path MTU Discovery stats */ + +static inline void net_stats_update_ipv4_pmtu_sent(struct net_if *iface) +{ + UPDATE_STAT(iface, stats.ipv4_pmtu.sent++); +} + +static inline void net_stats_update_ipv4_pmtu_recv(struct net_if *iface) +{ + UPDATE_STAT(iface, stats.ipv4_pmtu.recv++); +} + +static inline void net_stats_update_ipv4_pmtu_drop(struct net_if *iface) +{ + UPDATE_STAT(iface, stats.ipv4_pmtu.drop++); +} +#else +#define net_stats_update_ipv4_pmtu_sent(iface) +#define net_stats_update_ipv4_pmtu_recv(iface) +#define net_stats_update_ipv4_pmtu_drop(iface) +#endif /* CONFIG_NET_STATISTICS_IPV4_PMTU */ + #if defined(CONFIG_NET_STATISTICS_IPV4) && defined(CONFIG_NET_NATIVE_IPV4) /* IPv4 stats */ diff --git a/subsys/net/lib/shell/stats.c b/subsys/net/lib/shell/stats.c index 3bd7f09a6d80a..3556ec0269a4e 100644 --- a/subsys/net/lib/shell/stats.c +++ b/subsys/net/lib/shell/stats.c @@ -498,6 +498,13 @@ static void net_shell_print_statistics(struct net_if *iface, void *user_data) GET_STAT(iface, ip_errors.chkerr), GET_STAT(iface, ip_errors.protoerr)); +#if defined(CONFIG_NET_STATISTICS_IPV4_PMTU) + PR("IPv4 PMTU recv %d\tsent\t%d\tdrop\t%d\n", + GET_STAT(iface, ipv4_pmtu.recv), + GET_STAT(iface, ipv4_pmtu.sent), + GET_STAT(iface, ipv4_pmtu.drop)); +#endif /* CONFIG_NET_STATISTICS_IPV4_PMTU */ + #if defined(CONFIG_NET_STATISTICS_ICMP) && defined(CONFIG_NET_NATIVE_IPV4) PR("ICMP recv %d\tsent\t%d\tdrop\t%d\n", GET_STAT(iface, icmp.recv), From 9dba02f8f4febcc8a55d8acd007f92e179080880 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 5 Nov 2024 17:50:11 +0200 Subject: [PATCH 2679/4482] net: ipv4: Add PMTU support Catch "Destination Unreachable" ICMPv4 messages and update PMTU for a given destination IPv4 address. Use that PMTU when sending data to the destination. Signed-off-by: Jukka Rissanen --- include/zephyr/net/net_pkt.h | 30 +++++++++ subsys/net/ip/icmpv4.c | 112 ++++++++++++++++++++++++++++++++++ subsys/net/ip/icmpv4.h | 5 ++ subsys/net/ip/ipv4.c | 38 +++++++++++- subsys/net/ip/ipv4.h | 28 ++++----- subsys/net/ip/ipv4_fragment.c | 2 +- subsys/net/ip/net_context.c | 17 ++++++ subsys/net/ip/net_if.c | 4 +- subsys/net/ip/tcp.c | 48 +++++++++------ 9 files changed, 247 insertions(+), 37 deletions(-) diff --git a/include/zephyr/net/net_pkt.h b/include/zephyr/net/net_pkt.h index 7693f9a79734b..1a3b4a042aeec 100644 --- a/include/zephyr/net/net_pkt.h +++ b/include/zephyr/net/net_pkt.h @@ -342,6 +342,11 @@ struct net_pkt { uint8_t cooked_mode_pkt : 1; #endif /* CONFIG_NET_CAPTURE_COOKED_MODE */ +#if defined(CONFIG_NET_IPV4_PMTU) + /* Path MTU needed for this destination address */ + uint8_t ipv4_pmtu : 1; +#endif /* CONFIG_NET_IPV4_PMTU */ + /* @endcond */ }; @@ -783,6 +788,31 @@ static inline uint16_t net_pkt_ip_opts_len(struct net_pkt *pkt) #endif } +#if defined(CONFIG_NET_IPV4_PMTU) +static inline bool net_pkt_ipv4_pmtu(struct net_pkt *pkt) +{ + return !!pkt->ipv4_pmtu; +} + +static inline void net_pkt_set_ipv4_pmtu(struct net_pkt *pkt, bool value) +{ + pkt->ipv4_pmtu = value; +} +#else +static inline bool net_pkt_ipv4_pmtu(struct net_pkt *pkt) +{ + ARG_UNUSED(pkt); + + return false; +} + +static inline void net_pkt_set_ipv4_pmtu(struct net_pkt *pkt, bool value) +{ + ARG_UNUSED(pkt); + ARG_UNUSED(value); +} +#endif /* CONFIG_NET_IPV4_PMTU */ + #if defined(CONFIG_NET_IPV4_FRAGMENT) static inline uint16_t net_pkt_ipv4_fragment_offset(struct net_pkt *pkt) { diff --git a/subsys/net/ip/icmpv4.c b/subsys/net/ip/icmpv4.c index 5e1cb35566c57..cc25e572dd4cf 100644 --- a/subsys/net/ip/icmpv4.c +++ b/subsys/net/ip/icmpv4.c @@ -21,6 +21,7 @@ LOG_MODULE_REGISTER(net_icmpv4, CONFIG_NET_ICMPV4_LOG_LEVEL); #include "ipv4.h" #include "icmpv4.h" #include "net_stats.h" +#include "pmtu.h" #define PKT_WAIT_TIME K_SECONDS(1) @@ -654,6 +655,108 @@ enum net_verdict net_icmpv4_input(struct net_pkt *pkt, return NET_DROP; } +#if defined(CONFIG_NET_IPV4_PMTU) +/* The RFC 1191 chapter 3 says the minimum MTU size is 68 octets. + * This is way too small in modern world, so make the minimum 576 octets. + */ +#define MIN_IPV4_MTU NET_IPV4_MTU + +static int icmpv4_handle_dst_unreach(struct net_icmp_ctx *ctx, + struct net_pkt *pkt, + struct net_icmp_ip_hdr *hdr, + struct net_icmp_hdr *icmp_hdr, + void *user_data) +{ + NET_PKT_DATA_ACCESS_CONTIGUOUS_DEFINE(dst_unreach_access, + struct net_icmpv4_dest_unreach); + struct net_icmpv4_dest_unreach *dest_unreach_hdr; + struct net_ipv4_hdr *ip_hdr = hdr->ipv4; + uint16_t length = net_pkt_get_len(pkt); + struct net_pmtu_entry *entry; + struct sockaddr_in sockaddr_src = { + .sin_family = AF_INET, + }; + uint16_t mtu; + int ret; + + ARG_UNUSED(user_data); + + dest_unreach_hdr = (struct net_icmpv4_dest_unreach *) + net_pkt_get_data(pkt, &dst_unreach_access); + if (dest_unreach_hdr == NULL) { + NET_DBG("DROP: NULL ICMPv4 Destination Unreachable header"); + goto drop; + } + + net_stats_update_ipv4_pmtu_recv(net_pkt_iface(pkt)); + + NET_DBG("Received Destination Unreachable from %s to %s", + net_sprint_ipv4_addr(&ip_hdr->src), + net_sprint_ipv4_addr(&ip_hdr->dst)); + + if (length < (sizeof(struct net_ipv4_hdr) + + sizeof(struct net_icmp_hdr) + + sizeof(struct net_icmpv4_dest_unreach))) { + NET_DBG("DROP: length %d too big %zd", + length, sizeof(struct net_ipv4_hdr) + + sizeof(struct net_icmp_hdr) + + sizeof(struct net_icmpv4_dest_unreach)); + goto drop; + } + + net_pkt_acknowledge_data(pkt, &dst_unreach_access); + + mtu = ntohs(dest_unreach_hdr->mtu); + + if (mtu < MIN_IPV4_MTU) { + NET_DBG("DROP: Unsupported MTU %u, min is %u", + mtu, MIN_IPV4_MTU); + goto drop; + } + + net_ipaddr_copy(&sockaddr_src.sin_addr, (struct in_addr *)&ip_hdr->src); + + entry = net_pmtu_get_entry((struct sockaddr *)&sockaddr_src); + if (entry == NULL) { + NET_DBG("DROP: Cannot find PMTU entry for %s", + net_sprint_ipv4_addr(&ip_hdr->src)); + goto silent_drop; + } + + /* We must not accept larger PMTU value than what we already know. + * RFC 1191 chapter 3 page 5. + */ + if (entry->mtu > 0 && entry->mtu < mtu) { + NET_DBG("DROP: PMTU for %s %u larger than %u", + net_sprint_ipv4_addr(&ip_hdr->src), mtu, + entry->mtu); + goto silent_drop; + } + + ret = net_pmtu_update_entry(entry, mtu); + if (ret > 0) { + NET_DBG("PMTU for %s changed from %u to %u", + net_sprint_ipv4_addr(&ip_hdr->src), ret, mtu); + } + + return 0; +drop: + net_stats_update_ipv4_pmtu_drop(net_pkt_iface(pkt)); + + return -EIO; + +silent_drop: + /* If the event is not really an error then just ignore it and + * return 0 so that icmpv4 module will not complain about it. + */ + net_stats_update_ipv4_pmtu_drop(net_pkt_iface(pkt)); + + return 0; +} + +static struct net_icmp_ctx dst_unreach_ctx; +#endif /* CONFIG_NET_IPV4_PMTU */ + void net_icmpv4_init(void) { static struct net_icmp_ctx ctx; @@ -664,4 +767,13 @@ void net_icmpv4_init(void) NET_ERR("Cannot register %s handler (%d)", STRINGIFY(NET_ICMPV4_ECHO_REQUEST), ret); } + +#if defined(CONFIG_NET_IPV4_PMTU) + ret = net_icmp_init_ctx(&dst_unreach_ctx, NET_ICMPV4_DST_UNREACH, 0, + icmpv4_handle_dst_unreach); + if (ret < 0) { + NET_ERR("Cannot register %s handler (%d)", STRINGIFY(NET_ICMPV4_DST_UNREACH), + ret); + } +#endif } diff --git a/subsys/net/ip/icmpv4.h b/subsys/net/ip/icmpv4.h index ae848c9d96415..88f13971c9ca2 100644 --- a/subsys/net/ip/icmpv4.h +++ b/subsys/net/ip/icmpv4.h @@ -34,6 +34,11 @@ struct net_icmpv4_echo_req { uint16_t sequence; } __packed; +struct net_icmpv4_dest_unreach { + uint16_t unused; + uint16_t mtu; +} __packed; + /** * @brief Send ICMPv4 error message. * @param pkt Network packet that this error is related to. diff --git a/subsys/net/ip/ipv4.c b/subsys/net/ip/ipv4.c index a7d74d74a2fd4..7178ba1d1dbb4 100644 --- a/subsys/net/ip/ipv4.c +++ b/subsys/net/ip/ipv4.c @@ -25,6 +25,7 @@ LOG_MODULE_REGISTER(net_ipv4, CONFIG_NET_IPV4_LOG_LEVEL); #include "tcp_internal.h" #include "dhcpv4/dhcpv4_internal.h" #include "ipv4.h" +#include "pmtu.h" BUILD_ASSERT(sizeof(struct in_addr) == NET_IPV4_ADDR_SIZE); @@ -90,13 +91,18 @@ int net_ipv4_create(struct net_pkt *pkt, const struct in_addr *dst) { uint8_t tos = 0; + uint8_t flags = 0U; if (IS_ENABLED(CONFIG_NET_IP_DSCP_ECN)) { net_ipv4_set_dscp(&tos, net_pkt_ip_dscp(pkt)); net_ipv4_set_ecn(&tos, net_pkt_ip_ecn(pkt)); } - return net_ipv4_create_full(pkt, src, dst, tos, 0U, 0U, 0U); + if (IS_ENABLED(CONFIG_NET_IPV4_PMTU) && net_pkt_ipv4_pmtu(pkt)) { + flags = NET_IPV4_DF; + } + + return net_ipv4_create_full(pkt, src, dst, tos, 0U, flags, 0U); } int net_ipv4_finalize(struct net_pkt *pkt, uint8_t next_header_proto) @@ -444,6 +450,36 @@ enum net_verdict net_ipv4_input(struct net_pkt *pkt, bool is_loopback) return NET_DROP; } +enum net_verdict net_ipv4_prepare_for_send(struct net_pkt *pkt) +{ + if (IS_ENABLED(CONFIG_NET_IPV4_PMTU)) { + struct net_pmtu_entry *entry; + struct sockaddr_in dst = { + .sin_family = AF_INET, + }; + int ret; + + net_ipv4_addr_copy_raw((uint8_t *)&dst.sin_addr, + NET_IPV4_HDR(pkt)->dst); + entry = net_pmtu_get_entry((struct sockaddr *)&dst); + if (entry == NULL) { + ret = net_pmtu_update_mtu((struct sockaddr *)&dst, + net_if_get_mtu(net_pkt_iface(pkt))); + if (ret < 0) { + NET_DBG("Cannot update PMTU for %s (%d)", + net_sprint_ipv4_addr(&dst.sin_addr), + ret); + } + } + } + +#if defined(CONFIG_NET_IPV4_FRAGMENT) + return net_ipv4_prepare_for_send_fragment(pkt); +#else + return NET_OK; +#endif +} + void net_ipv4_init(void) { if (IS_ENABLED(CONFIG_NET_IPV4_FRAGMENT)) { diff --git a/subsys/net/ip/ipv4.h b/subsys/net/ip/ipv4.h index 8c063952e9fff..e70fae3ff1f7c 100644 --- a/subsys/net/ip/ipv4.h +++ b/subsys/net/ip/ipv4.h @@ -357,6 +357,17 @@ typedef void (*net_ipv4_frag_cb_t)(struct net_ipv4_reassembly *reass, void *user */ void net_ipv4_frag_foreach(net_ipv4_frag_cb_t cb, void *user_data); +/** + * @brief Prepare packet for sending, this will split up a packet that is too large to send into + * multiple fragments so that it can be sent. It will also update PMTU destination cache if it + * is enabled. + * + * @param pkt Network packet + * + * @return Return verdict about the packet. + */ +enum net_verdict net_ipv4_prepare_for_send(struct net_pkt *pkt); + #if defined(CONFIG_NET_NATIVE_IPV4) /** * @brief Initialises IPv4 @@ -384,22 +395,9 @@ static inline enum net_verdict net_ipv4_handle_fragment_hdr(struct net_pkt *pkt, } #endif /* CONFIG_NET_IPV4_FRAGMENT */ -/** - * @brief Prepare packet for sending, this will split up a packet that is too large to send into - * multiple fragments so that it can be sent. - * - * @param pkt Network packet - * - * @return Return verdict about the packet. - */ #if defined(CONFIG_NET_IPV4_FRAGMENT) -enum net_verdict net_ipv4_prepare_for_send(struct net_pkt *pkt); -#else -static inline enum net_verdict net_ipv4_prepare_for_send(struct net_pkt *pkt) -{ - return NET_OK; -} -#endif /* CONFIG_NET_IPV4_FRAGMENT */ +enum net_verdict net_ipv4_prepare_for_send_fragment(struct net_pkt *pkt); +#endif /** * @brief Sets up fragment buffers for usage, should only be called by the SYS_INIT() handler in diff --git a/subsys/net/ip/ipv4_fragment.c b/subsys/net/ip/ipv4_fragment.c index 2fe6fb2033dd3..c095efc4c2d45 100644 --- a/subsys/net/ip/ipv4_fragment.c +++ b/subsys/net/ip/ipv4_fragment.c @@ -607,7 +607,7 @@ int net_ipv4_send_fragmented_pkt(struct net_if *iface, struct net_pkt *pkt, return 0; } -enum net_verdict net_ipv4_prepare_for_send(struct net_pkt *pkt) +enum net_verdict net_ipv4_prepare_for_send_fragment(struct net_pkt *pkt) { NET_PKT_DATA_ACCESS_CONTIGUOUS_DEFINE(ipv4_access, struct net_ipv4_hdr); struct net_ipv4_hdr *ip_hdr; diff --git a/subsys/net/ip/net_context.c b/subsys/net/ip/net_context.c index e6a13874bdef4..357e95061e550 100644 --- a/subsys/net/ip/net_context.c +++ b/subsys/net/ip/net_context.c @@ -37,6 +37,7 @@ LOG_MODULE_REGISTER(net_ctx, CONFIG_NET_CONTEXT_LOG_LEVEL); #include "udp_internal.h" #include "tcp_internal.h" #include "net_stats.h" +#include "pmtu.h" #if defined(CONFIG_NET_TCP) #include "tcp.h" @@ -1139,6 +1140,22 @@ int net_context_create_ipv4_new(struct net_context *context, } #endif + if (IS_ENABLED(CONFIG_NET_IPV4_PMTU)) { + struct net_pmtu_entry *entry; + struct sockaddr_in dst_addr = { + .sin_family = AF_INET, + .sin_addr = *dst, + }; + + entry = net_pmtu_get_entry((struct sockaddr *)&dst_addr); + if (entry == NULL) { + /* Try to figure out the MTU of the path */ + net_pkt_set_ipv4_pmtu(pkt, true); + } else { + net_pkt_set_ipv4_pmtu(pkt, false); + } + } + return net_ipv4_create(pkt, src, dst); } #endif /* CONFIG_NET_IPV4 */ diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c index 684637e7f9154..4033fe99ceade 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -520,11 +520,9 @@ enum net_verdict net_if_send_data(struct net_if *iface, struct net_pkt *pkt) verdict = net_ipv6_prepare_for_send(pkt); } -#if defined(CONFIG_NET_IPV4_FRAGMENT) - if (net_pkt_family(pkt) == AF_INET) { + if (IS_ENABLED(CONFIG_NET_IPV4) && net_pkt_family(pkt) == AF_INET) { verdict = net_ipv4_prepare_for_send(pkt); } -#endif done: /* NET_OK in which case packet has checked successfully. In this case diff --git a/subsys/net/ip/tcp.c b/subsys/net/ip/tcp.c index 47f3f4b4104aa..e7f5c7d7c95b8 100644 --- a/subsys/net/ip/tcp.c +++ b/subsys/net/ip/tcp.c @@ -4419,30 +4419,44 @@ static uint16_t get_ipv6_destination_mtu(struct net_if *iface, #endif /* CONFIG_NET_IPV6_PMTU */ } +static uint16_t get_ipv4_destination_mtu(struct net_if *iface, + const struct in_addr *dest) +{ +#if defined(CONFIG_NET_IPV4_PMTU) + int mtu = net_pmtu_get_mtu((struct sockaddr *)&(struct sockaddr_in){ + .sin_family = AF_INET, + .sin_addr = *dest }); + + if (mtu < 0) { + if (iface != NULL) { + return net_if_get_mtu(iface); + } + + return NET_IPV4_MTU; + } + + return (uint16_t)mtu; +#else + if (iface != NULL) { + return net_if_get_mtu(iface); + } + + return NET_IPV4_MTU; +#endif /* CONFIG_NET_IPV4_PMTU */ +} + uint16_t net_tcp_get_supported_mss(const struct tcp *conn) { sa_family_t family = net_context_get_family(conn->context); - if (family == AF_INET) { -#if defined(CONFIG_NET_IPV4) + if (IS_ENABLED(CONFIG_NET_IPV4) && family == AF_INET) { struct net_if *iface = net_context_get_iface(conn->context); - int mss = 0; - - if (iface && net_if_get_mtu(iface) >= NET_IPV4TCPH_LEN) { - /* Detect MSS based on interface MTU minus "TCP,IP - * header size" - */ - mss = net_if_get_mtu(iface) - NET_IPV4TCPH_LEN; - } + uint16_t dest_mtu; - if (mss == 0) { - mss = NET_IPV4_MTU - NET_IPV4TCPH_LEN; - } + dest_mtu = get_ipv4_destination_mtu(iface, &conn->dst.sin.sin_addr); - return mss; -#else - return 0; -#endif /* CONFIG_NET_IPV4 */ + /* Detect MSS based on interface MTU minus "TCP,IP header size" */ + return dest_mtu - NET_IPV4TCPH_LEN; } else if (IS_ENABLED(CONFIG_NET_IPV6) && family == AF_INET6) { struct net_if *iface = net_context_get_iface(conn->context); From 55e582635fc75f0c502959c1cdd51b86f80cd934 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 5 Nov 2024 18:10:00 +0200 Subject: [PATCH 2680/4482] tests: net: pmtu: Add IPv4 specific PMTU TCP tests Allow tests to check whether a IPv4 TCP connection MTU is changed. Signed-off-by: Jukka Rissanen --- subsys/net/ip/tcp.c | 14 +++++ tests/net/pmtu/src/main.c | 125 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) diff --git a/subsys/net/ip/tcp.c b/subsys/net/ip/tcp.c index e7f5c7d7c95b8..14da3f0cc349b 100644 --- a/subsys/net/ip/tcp.c +++ b/subsys/net/ip/tcp.c @@ -4494,6 +4494,20 @@ static void testing_find_conn(struct tcp *conn, void *user_data) data->mtu = net_tcp_get_supported_mss(conn) + NET_IPV6TCPH_LEN; return; } + + if (IS_ENABLED(CONFIG_NET_IPV4) && data->remote.sa_family == AF_INET && + net_ipv4_addr_cmp(&conn->dst.sin.sin_addr, + &net_sin(&data->remote)->sin_addr)) { + if (data->mtu > 0) { + /* Set it only once */ + return; + } + + NET_DBG("Found connection %p mtu %u", conn, + net_tcp_get_supported_mss(conn) + NET_IPV4TCPH_LEN); + data->mtu = net_tcp_get_supported_mss(conn) + NET_IPV4TCPH_LEN; + return; + } } uint16_t net_tcp_get_mtu(struct sockaddr *dst) diff --git a/tests/net/pmtu/src/main.c b/tests/net/pmtu/src/main.c index 7f3dbd8c18907..542c89519d84d 100644 --- a/tests/net/pmtu/src/main.c +++ b/tests/net/pmtu/src/main.c @@ -35,7 +35,9 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_PMTU_LOG_LEVEL); #include "route.h" #include "icmpv6.h" +#include "icmpv4.h" #include "ipv6.h" +#include "ipv4.h" #include "pmtu.h" #define NET_LOG_ENABLED 1 @@ -514,4 +516,127 @@ ZTEST(net_pmtu_test_suite, test_pmtu_05_ipv6_tcp) #endif /* CONFIG_NET_IPV6_PMTU */ } +#if defined(CONFIG_NET_IPV4_PMTU) +static int get_v4_send_recv_sock(int *srv_sock, + struct sockaddr_in *my_saddr, + struct sockaddr_in *peer_saddr) +{ + struct sockaddr addr; + socklen_t addrlen = sizeof(addr); + int new_sock; + int c_sock; + int s_sock; + + prepare_sock_tcp_v4(PEER_IPV4_ADDR, PEER_PORT, &s_sock, peer_saddr); + test_bind(s_sock, (struct sockaddr *)peer_saddr, sizeof(*peer_saddr)); + test_listen(s_sock); + + prepare_sock_tcp_v4(MY_IPV4_ADDR, MY_PORT, &c_sock, my_saddr); + test_bind(c_sock, (struct sockaddr *)my_saddr, sizeof(*my_saddr)); + test_connect(c_sock, (struct sockaddr *)peer_saddr, sizeof(*peer_saddr)); + + test_accept(s_sock, &new_sock, &addr, &addrlen); + zassert_equal(addrlen, sizeof(struct sockaddr_in), "wrong addrlen"); + + *srv_sock = new_sock; + + return c_sock; +} + +static int create_icmpv4_dest_unreach(struct net_if *iface, + struct sockaddr_in *src, + struct sockaddr_in *dst, + uint32_t mtu, + struct net_pkt **pkt) +{ + struct net_icmpv4_dest_unreach du_hdr; + struct net_pkt *du_pkt; + struct in_addr *dest4; + struct in_addr *src4; + int ret; + + du_pkt = net_pkt_alloc_with_buffer(iface, sizeof(struct net_ipv4_hdr) + + sizeof(struct net_icmp_hdr) + + sizeof(struct net_icmpv4_dest_unreach), + AF_INET, IPPROTO_ICMP, + PKT_WAIT_TIME); + if (du_pkt == NULL) { + NET_DBG("No buffer"); + return -ENOMEM; + } + + dest4 = &dst->sin_addr; + src4 = &src->sin_addr; + + ret = net_ipv4_create(du_pkt, src4, dest4); + if (ret < 0) { + LOG_ERR("Cannot create IPv4 pkt (%d)", ret); + return ret; + } + + ret = net_icmpv4_create(du_pkt, NET_ICMPV4_DST_UNREACH, 0); + if (ret < 0) { + LOG_ERR("Cannot create ICMPv4 pkt (%d)", ret); + return ret; + } + + du_hdr.mtu = htons(mtu); + + ret = net_pkt_write(du_pkt, &du_hdr, sizeof(du_hdr)); + if (ret < 0) { + LOG_ERR("Cannot write payload (%d)", ret); + return ret; + } + + net_pkt_cursor_init(du_pkt); + net_ipv4_finalize(du_pkt, IPPROTO_ICMP); + + net_pkt_set_iface(du_pkt, iface); + + *pkt = du_pkt; + + return 0; +} +#endif + +ZTEST(net_pmtu_test_suite, test_pmtu_05_ipv4_tcp) +{ +#if defined(CONFIG_NET_IPV4_PMTU) + struct sockaddr_in dest_ipv4; + struct sockaddr_in s_saddr = { 0 }; /* peer */ + struct sockaddr_in c_saddr = { 0 }; /* this host */ + struct net_pkt *pkt = NULL; + int client_sock, server_sock; + uint16_t mtu; + int ret; + + dest_ipv4.sin_family = AF_INET; + + client_sock = get_v4_send_recv_sock(&server_sock, &c_saddr, &s_saddr); + zassert_true(client_sock >= 0, "Failed to create client socket"); + + /* Set initial MTU for the destination */ + ret = net_pmtu_update_mtu((struct sockaddr *)&c_saddr, 4096); + zassert_true(ret >= 0, "PMTU IPv6 MTU update failed (%d)", ret); + + /* Send an ICMPv4 "Destination Unreachable" message from server to client which + * will update the PMTU entry. + */ + ret = create_icmpv4_dest_unreach(target_iface, &s_saddr, &c_saddr, 2048, &pkt); + zassert_equal(ret, 0, "Failed to create ICMPv4 Destination Unrechable message"); + + ret = net_send_data(pkt); + zassert_equal(ret, 0, "Failed to send Destination Unreachable message"); + + /* Check that the PMTU entry has been updated */ + mtu = net_tcp_get_mtu((struct sockaddr *)&s_saddr); + zassert_equal(mtu, 2048, "PMTU IPv4 MTU is not correct (%d)", mtu); + + (void)zsock_close(client_sock); + (void)zsock_close(server_sock); +#else + ztest_test_skip(); +#endif /* CONFIG_NET_IPV4_PMTU */ +} + ZTEST_SUITE(net_pmtu_test_suite, NULL, test_setup, NULL, NULL, NULL); From 02ccb0e523b9891c5b35c48d1d5c39be9db94d44 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 6 Nov 2024 14:27:28 +0200 Subject: [PATCH 2681/4482] net: pmtu: Send net_mgmt event for changed path MTU Send a network management event for a changed path MTU value. Both IPv4 and IPv6 have their own events as we cannot mix these because how the network event numbering space is implemented. Signed-off-by: Jukka Rissanen --- include/zephyr/net/net_event.h | 38 ++++++++++++++++++++++++++++++ subsys/net/ip/Kconfig | 3 +++ subsys/net/ip/pmtu.c | 43 ++++++++++++++++++++++++++++++++-- 3 files changed, 82 insertions(+), 2 deletions(-) diff --git a/include/zephyr/net/net_event.h b/include/zephyr/net/net_event.h index 9bcba06be76eb..f0f8545a713a7 100644 --- a/include/zephyr/net/net_event.h +++ b/include/zephyr/net/net_event.h @@ -74,6 +74,7 @@ enum net_event_ipv6_cmd { NET_EVENT_IPV6_CMD_PE_DISABLED, NET_EVENT_IPV6_CMD_PE_FILTER_ADD, NET_EVENT_IPV6_CMD_PE_FILTER_DEL, + NET_EVENT_IPV6_CMD_PMTU_CHANGED, }; /* IPv4 Events*/ @@ -99,6 +100,7 @@ enum net_event_ipv4_cmd { NET_EVENT_IPV4_CMD_ACD_SUCCEED, NET_EVENT_IPV4_CMD_ACD_FAILED, NET_EVENT_IPV4_CMD_ACD_CONFLICT, + NET_EVENT_IPV4_CMD_PMTU_CHANGED, }; /* L4 network events */ @@ -237,6 +239,10 @@ enum net_event_l4_cmd { #define NET_EVENT_IPV6_PE_FILTER_DEL \ (_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_PE_FILTER_DEL) +/** IPv6 Path MTU is changed. */ +#define NET_EVENT_IPV6_PMTU_CHANGED \ + (_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_PMTU_CHANGED) + /** Event emitted when an IPv4 address is added to the system. */ #define NET_EVENT_IPV4_ADDR_ADD \ (_NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ADDR_ADD) @@ -296,6 +302,10 @@ enum net_event_l4_cmd { #define NET_EVENT_IPV4_ACD_CONFLICT \ (_NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ACD_CONFLICT) +/** IPv4 Path MTU is changed. */ +#define NET_EVENT_IPV4_PMTU_CHANGED \ + (_NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_PMTU_CHANGED) + /** Event emitted when the system is considered to be connected. * The connected in this context means that the network interface is up, * and the interface has either IPv4 or IPv6 address assigned to it. @@ -441,6 +451,34 @@ struct net_event_ipv6_pe_filter { bool is_deny_list; }; +/** + * @brief Network Management event information structure + * Used to pass information on network event + * NET_EVENT_IPV4_PMTU_CHANGED + * when CONFIG_NET_MGMT_EVENT_INFO enabled and event generator pass the + * information. + */ +struct net_event_ipv4_pmtu_info { + /** IPv4 address */ + struct in_addr dst; + /** New MTU */ + uint16_t mtu; +}; + +/** + * @brief Network Management event information structure + * Used to pass information on network event + * NET_EVENT_IPV6_PMTU_CHANGED + * when CONFIG_NET_MGMT_EVENT_INFO enabled and event generator pass the + * information. + */ +struct net_event_ipv6_pmtu_info { + /** IPv6 address */ + struct in6_addr dst; + /** New MTU */ + uint32_t mtu; +}; + #ifdef __cplusplus } #endif diff --git a/subsys/net/ip/Kconfig b/subsys/net/ip/Kconfig index 387c352e8d59b..f123854a7a32c 100644 --- a/subsys/net/ip/Kconfig +++ b/subsys/net/ip/Kconfig @@ -50,6 +50,9 @@ config NET_NATIVE_IPV4 config NET_PMTU bool + select NET_MGMT + select NET_MGMT_EVENT + select NET_MGMT_EVENT_INFO default y depends on NET_IPV6_PMTU || NET_IPV4_PMTU diff --git a/subsys/net/ip/pmtu.c b/subsys/net/ip/pmtu.c index e1f9d748f5f42..be2c3355a6b40 100644 --- a/subsys/net/ip/pmtu.c +++ b/subsys/net/ip/pmtu.c @@ -12,7 +12,9 @@ LOG_MODULE_REGISTER(net_pmtu, CONFIG_NET_PMTU_LOG_LEVEL); #include - +#include +#include +#include #include "pmtu.h" #if defined(CONFIG_NET_IPV4_PMTU) @@ -104,8 +106,45 @@ static struct net_pmtu_entry *get_free_pmtu_entry(void) static void update_pmtu_entry(struct net_pmtu_entry *entry, uint16_t mtu) { - entry->mtu = mtu; + bool changed = false; + + if (entry->mtu != mtu) { + changed = true; + entry->mtu = mtu; + } + entry->last_update = k_uptime_get_32(); + + if (changed) { + struct net_if *iface; + + if (IS_ENABLED(CONFIG_NET_IPV4_PMTU) && entry->dst.family == AF_INET) { + struct net_event_ipv4_pmtu_info info; + + net_ipaddr_copy(&info.dst, &entry->dst.in_addr); + info.mtu = mtu; + + iface = net_if_ipv4_select_src_iface(&info.dst); + + net_mgmt_event_notify_with_info(NET_EVENT_IPV4_PMTU_CHANGED, + iface, + (const void *)&info, + sizeof(struct net_event_ipv4_pmtu_info)); + + } else if (IS_ENABLED(CONFIG_NET_IPV6_PMTU) && entry->dst.family == AF_INET6) { + struct net_event_ipv6_pmtu_info info; + + net_ipaddr_copy(&info.dst, &entry->dst.in6_addr); + info.mtu = mtu; + + iface = net_if_ipv6_select_src_iface(&info.dst); + + net_mgmt_event_notify_with_info(NET_EVENT_IPV6_PMTU_CHANGED, + iface, + (const void *)&info, + sizeof(struct net_event_ipv6_pmtu_info)); + } + } } struct net_pmtu_entry *net_pmtu_get_entry(const struct sockaddr *dst) From ee497c3108b9b6d139833cd697380c42b2e76d4a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 6 Nov 2024 14:29:53 +0200 Subject: [PATCH 2682/4482] tests: net: pmtu: Add network event tests for pmtu Verify that the PMTU changed events are generated and we can catch them. Signed-off-by: Jukka Rissanen --- tests/net/pmtu/src/main.c | 133 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/tests/net/pmtu/src/main.c b/tests/net/pmtu/src/main.c index 542c89519d84d..30b09a2e8a622 100644 --- a/tests/net/pmtu/src/main.c +++ b/tests/net/pmtu/src/main.c @@ -43,6 +43,12 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_PMTU_LOG_LEVEL); #define NET_LOG_ENABLED 1 #include "net_private.h" +#if defined(CONFIG_BOARD_NATIVE_SIM) || defined(CONFIG_BOARD_NATIVE_SIM_NATIVE_64) +#define WAIT_PROPERLY 0 +#else +#define WAIT_PROPERLY 1 +#endif + #if defined(CONFIG_NET_PMTU_LOG_LEVEL_DBG) #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__) #else @@ -93,6 +99,58 @@ K_SEM_DEFINE(wait_data, 0, UINT_MAX); #define THREAD_SLEEP 50 /* ms */ +static K_SEM_DEFINE(wait_pmtu_changed, 0, UINT_MAX); +static bool is_pmtu_changed; + +static void ipv6_pmtu_changed(struct net_mgmt_event_callback *cb, + uint32_t mgmt_event, + struct net_if *iface) +{ + ARG_UNUSED(cb); + ARG_UNUSED(iface); + + if (mgmt_event != NET_EVENT_IPV6_PMTU_CHANGED) { + return; + } + + NET_DBG("IPv6 PMTU changed event received"); + + k_sem_give(&wait_pmtu_changed); + is_pmtu_changed = true; + + /* Let the network stack to proceed */ + k_msleep(THREAD_SLEEP); +} + +static void ipv4_pmtu_changed(struct net_mgmt_event_callback *cb, + uint32_t mgmt_event, + struct net_if *iface) +{ + ARG_UNUSED(cb); + ARG_UNUSED(iface); + + if (mgmt_event != NET_EVENT_IPV4_PMTU_CHANGED) { + return; + } + + NET_DBG("IPv4 PMTU changed event received"); + + k_sem_give(&wait_pmtu_changed); + is_pmtu_changed = true; + + /* Let the network stack to proceed */ + k_msleep(THREAD_SLEEP); +} + +static struct mgmt_events { + uint32_t event; + net_mgmt_event_handler_t handler; + struct net_mgmt_event_callback cb; +} mgmt_events[] = { + { .event = NET_EVENT_IPV6_PMTU_CHANGED, .handler = ipv6_pmtu_changed }, + { .event = NET_EVENT_IPV4_PMTU_CHANGED, .handler = ipv4_pmtu_changed }, +}; + static const char *iface2str(struct net_if *iface) { if (net_if_l2(iface) == &NET_L2_GET_NAME(DUMMY)) { @@ -120,6 +178,25 @@ static void iface_cb(struct net_if *iface, void *user_data) if_count++; } +static void setup_mgmt_events(void) +{ + static bool setup_done; + + if (setup_done) { + return; + } + + setup_done = true; + + ARRAY_FOR_EACH(mgmt_events, i) { + net_mgmt_init_event_callback(&mgmt_events[i].cb, + mgmt_events[i].handler, + mgmt_events[i].event); + + net_mgmt_add_event_callback(&mgmt_events[i].cb); + } +} + static void *test_setup(void) { net_if_foreach(iface_cb, NULL); @@ -639,4 +716,60 @@ ZTEST(net_pmtu_test_suite, test_pmtu_05_ipv4_tcp) #endif /* CONFIG_NET_IPV4_PMTU */ } +ZTEST(net_pmtu_test_suite, test_pmtu_06_ipv4_event) +{ +#if defined(CONFIG_NET_IPV4_PMTU) && WAIT_PROPERLY + struct sockaddr_in dest_ipv4; + int ret; + + setup_mgmt_events(); + + is_pmtu_changed = false; + + net_ipaddr_copy(&dest_ipv4.sin_addr, &dest_ipv4_addr1); + dest_ipv4.sin_family = AF_INET; + + ret = net_pmtu_update_mtu((struct sockaddr *)&dest_ipv4, 1200); + zassert_equal(ret, 0, "PMTU IPv4 MTU update failed (%d)", ret); + + if (k_sem_take(&wait_pmtu_changed, K_MSEC(WAIT_TIME))) { + zassert_true(0, "Timeout while waiting pmtu changed event"); + } + + zassert_true(is_pmtu_changed, "Did not catch pmtu changed event"); + + is_pmtu_changed = false; +#else + ztest_test_skip(); +#endif /* CONFIG_NET_IPV4_PMTU */ +} + +ZTEST(net_pmtu_test_suite, test_pmtu_06_ipv6_event) +{ +#if defined(CONFIG_NET_IPV6_PMTU) && WAIT_PROPERLY + struct sockaddr_in6 dest_ipv6; + int ret; + + setup_mgmt_events(); + + is_pmtu_changed = false; + + net_ipaddr_copy(&dest_ipv6.sin6_addr, &dest_ipv6_addr1); + dest_ipv6.sin6_family = AF_INET6; + + ret = net_pmtu_update_mtu((struct sockaddr *)&dest_ipv6, 1500); + zassert_equal(ret, 0, "PMTU IPv6 MTU update failed (%d)", ret); + + if (k_sem_take(&wait_pmtu_changed, K_MSEC(WAIT_TIME))) { + zassert_true(0, "Timeout while waiting pmtu changed event"); + } + + zassert_true(is_pmtu_changed, "Did not catch pmtu changed event"); + + is_pmtu_changed = false; +#else + ztest_test_skip(); +#endif /* CONFIG_NET_IPV6_PMTU */ +} + ZTEST_SUITE(net_pmtu_test_suite, NULL, test_setup, NULL, NULL, NULL); From f0172e7fce5f448a7a593da7184e900e2ef1312f Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 6 Nov 2024 14:31:10 +0200 Subject: [PATCH 2683/4482] net: shell: events: Print PMTU event values Print the changed PMTU value and IP address in the event monitor. Signed-off-by: Jukka Rissanen --- subsys/net/lib/shell/events.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/subsys/net/lib/shell/events.c b/subsys/net/lib/shell/events.c index 687e136e7cb33..66d3acb190cab 100644 --- a/subsys/net/lib/shell/events.c +++ b/subsys/net/lib/shell/events.c @@ -88,6 +88,11 @@ static char *get_l3_desc(struct event_msg *msg, static const char *desc_unknown = ""; char *info = NULL; +#if defined(CONFIG_NET_PMTU) +#define MAX_PMTU_INFO_STR_LEN sizeof("changed MTU xxxxx for") + static char pmtu_buf[MAX_PMTU_INFO_STR_LEN + 1]; +#endif + *desc = desc_unknown; switch (msg->event) { @@ -267,6 +272,34 @@ static char *get_l3_desc(struct event_msg *msg, info = net_addr_ntop(AF_INET, msg->data, extra_info, extra_info_len); break; + case NET_EVENT_IPV4_PMTU_CHANGED: { +#if defined(CONFIG_NET_IPV4_PMTU) + struct net_event_ipv4_pmtu_info *pmtu_info = + (struct net_event_ipv4_pmtu_info *)msg->data; + + *desc = "IPV4 PMTU"; + *desc2 = pmtu_buf; + snprintk(pmtu_buf, MAX_PMTU_INFO_STR_LEN, + "changed MTU %u for", (uint16_t)pmtu_info->mtu); + info = net_addr_ntop(AF_INET, &pmtu_info->dst, extra_info, + extra_info_len); +#endif + break; + } + case NET_EVENT_IPV6_PMTU_CHANGED: { +#if defined(CONFIG_NET_IPV6_PMTU) + struct net_event_ipv6_pmtu_info *pmtu_info = + (struct net_event_ipv6_pmtu_info *)msg->data; + + *desc = "IPV6 PMTU"; + *desc2 = pmtu_buf; + snprintk(pmtu_buf, MAX_PMTU_INFO_STR_LEN, + "changed MTU %u for", (uint16_t)pmtu_info->mtu); + info = net_addr_ntop(AF_INET6, &pmtu_info->dst, extra_info, + extra_info_len); +#endif + break; + } } return info; From fad10f73705f40fd65d6d230f28a3ecaec910c64 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 6 Nov 2024 14:39:09 +0200 Subject: [PATCH 2684/4482] net: shell: events: Set the command mask correctly Set the commands to monitor correctly. Before this change some events were missed. Signed-off-by: Jukka Rissanen --- subsys/net/lib/shell/events.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/net/lib/shell/events.c b/subsys/net/lib/shell/events.c index 66d3acb190cab..699db20ef534b 100644 --- a/subsys/net/lib/shell/events.c +++ b/subsys/net/lib/shell/events.c @@ -20,9 +20,9 @@ LOG_MODULE_DECLARE(net_shell); #define THREAD_PRIORITY K_PRIO_COOP(2) #define MAX_EVENT_INFO_SIZE NET_EVENT_INFO_MAX_SIZE #define MONITOR_L2_MASK (_NET_EVENT_IF_BASE) -#define MONITOR_L3_IPV4_MASK (_NET_EVENT_IPV4_BASE) -#define MONITOR_L3_IPV6_MASK (_NET_EVENT_IPV6_BASE) -#define MONITOR_L4_MASK (_NET_EVENT_L4_BASE) +#define MONITOR_L3_IPV4_MASK (_NET_EVENT_IPV4_BASE | NET_MGMT_COMMAND_MASK) +#define MONITOR_L3_IPV6_MASK (_NET_EVENT_IPV6_BASE | NET_MGMT_COMMAND_MASK) +#define MONITOR_L4_MASK (_NET_EVENT_L4_BASE | NET_MGMT_COMMAND_MASK) static bool net_event_monitoring; static bool net_event_shutting_down; From a8188391866b7a5742a7caa5a7519be23d17d777 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 12 Nov 2024 18:18:44 +0200 Subject: [PATCH 2685/4482] net: Add support for IP_MTU IPv4 socket option Add IP_MTU IPv4 socket option and implement getsockopt() call for the option. The IP_MTU option does not support setsockopt() call. Signed-off-by: Jukka Rissanen --- include/zephyr/net/net_context.h | 1 + include/zephyr/net/socket.h | 6 +++ subsys/net/ip/net_context.c | 53 +++++++++++++++++++++++++++ subsys/net/lib/sockets/sockets_inet.c | 12 ++++++ 4 files changed, 72 insertions(+) diff --git a/include/zephyr/net/net_context.h b/include/zephyr/net/net_context.h index 430c1164f4047..6b7e2a7e233e8 100644 --- a/include/zephyr/net/net_context.h +++ b/include/zephyr/net/net_context.h @@ -1292,6 +1292,7 @@ enum net_context_option { NET_OPT_TTL = 16, /**< IPv4 unicast TTL */ NET_OPT_ADDR_PREFERENCES = 17, /**< IPv6 address preference */ NET_OPT_TIMESTAMPING = 18, /**< Packet timestamping */ + NET_OPT_MTU = 20, /**< IPv4 socket path MTU */ }; /** diff --git a/include/zephyr/net/socket.h b/include/zephyr/net/socket.h index fb1865b1296a5..94fc5efda92d5 100644 --- a/include/zephyr/net/socket.h +++ b/include/zephyr/net/socket.h @@ -1190,6 +1190,12 @@ struct in_pktinfo { struct in_addr ipi_addr; /**< Header Destination address */ }; +/** Retrieve the current known path MTU of the current socket. Returns an + * integer. IP_MTU is valid only for getsockopt and can be employed only when + * the socket has been connected. + */ +#define IP_MTU 14 + /** Set IPv4 multicast TTL value. */ #define IP_MULTICAST_TTL 33 /** Join IPv4 multicast group. */ diff --git a/subsys/net/ip/net_context.c b/subsys/net/ip/net_context.c index 357e95061e550..173000fad0d67 100644 --- a/subsys/net/ip/net_context.c +++ b/subsys/net/ip/net_context.c @@ -1788,6 +1788,48 @@ static int get_context_timestamping(struct net_context *context, #endif } +static int get_context_mtu(struct net_context *context, + void *value, size_t *len) +{ + sa_family_t family = net_context_get_family(context); + struct net_if *iface = NULL; + int mtu; + + if (IS_ENABLED(CONFIG_NET_PMTU)) { + mtu = net_pmtu_get_mtu(&context->remote); + if (mtu > 0) { + goto out; + } + } + + if (net_context_is_bound_to_iface(context)) { + iface = net_context_get_iface(context); + + mtu = net_if_get_mtu(iface); + } else { + if (IS_ENABLED(CONFIG_NET_IPV6) && family == AF_INET6) { + iface = net_if_ipv6_select_src_iface( + &net_sin6(&context->remote)->sin6_addr); + } else if (IS_ENABLED(CONFIG_NET_IPV4) && family == AF_INET) { + iface = net_if_ipv4_select_src_iface( + &net_sin(&context->remote)->sin_addr); + } else { + return -EAFNOSUPPORT; + } + + mtu = net_if_get_mtu(iface); + } + +out: + *((int *)value) = mtu; + + if (len) { + *len = sizeof(int); + } + + return 0; +} + /* If buf is not NULL, then use it. Otherwise read the data to be written * to net_pkt from msghdr. */ @@ -3188,6 +3230,14 @@ int net_context_set_option(struct net_context *context, break; case NET_OPT_TIMESTAMPING: ret = set_context_timestamping(context, value, len); + break; + case NET_OPT_MTU: + /* IPv4 only supports getting the MTU */ + if (IS_ENABLED(CONFIG_NET_IPV4) && + net_context_get_family(context) == AF_INET) { + ret = -EOPNOTSUPP; + } + break; } @@ -3265,6 +3315,9 @@ int net_context_get_option(struct net_context *context, case NET_OPT_TIMESTAMPING: ret = get_context_timestamping(context, value, len); break; + case NET_OPT_MTU: + ret = get_context_mtu(context, value, len); + break; } k_mutex_unlock(&context->lock); diff --git a/subsys/net/lib/sockets/sockets_inet.c b/subsys/net/lib/sockets/sockets_inet.c index acb9d470a5ea9..af57c40e5bc2d 100644 --- a/subsys/net/lib/sockets/sockets_inet.c +++ b/subsys/net/lib/sockets/sockets_inet.c @@ -1840,6 +1840,18 @@ int zsock_getsockopt_ctx(struct net_context *ctx, int level, int optname, } return 0; + + case IP_MTU: + if (IS_ENABLED(CONFIG_NET_IPV4)) { + ret = net_context_get_option(ctx, NET_OPT_MTU, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } } break; From 74fc23872dbe445a0bd9ab5492079f0bfd8a9e02 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 12 Nov 2024 18:20:06 +0200 Subject: [PATCH 2686/4482] tests: net: pmtu: Add IP_MTU socket option tests Make sure we can use IP_MTU socket option from application. Signed-off-by: Jukka Rissanen --- tests/net/pmtu/prj.conf | 3 ++ tests/net/pmtu/src/main.c | 61 ++++++++++++++++++++++++++++++++++----- 2 files changed, 56 insertions(+), 8 deletions(-) diff --git a/tests/net/pmtu/prj.conf b/tests/net/pmtu/prj.conf index 48d1ac83464be..1253c5c7c1c85 100644 --- a/tests/net/pmtu/prj.conf +++ b/tests/net/pmtu/prj.conf @@ -21,3 +21,6 @@ CONFIG_NET_BUF_TX_COUNT=20 CONFIG_NET_MGMT=y CONFIG_NET_MGMT_EVENT=y CONFIG_NET_SOCKETS=y +CONFIG_ZVFS_OPEN_MAX=32 +CONFIG_NET_MAX_CONTEXTS=32 +CONFIG_NET_MAX_CONN=32 diff --git a/tests/net/pmtu/src/main.c b/tests/net/pmtu/src/main.c index 30b09a2e8a622..9c41e8ae5a35b 100644 --- a/tests/net/pmtu/src/main.c +++ b/tests/net/pmtu/src/main.c @@ -473,7 +473,9 @@ static void test_accept(int sock, int *new_sock, struct sockaddr *addr, #if defined(CONFIG_NET_IPV6_PMTU) static int get_v6_send_recv_sock(int *srv_sock, struct sockaddr_in6 *my_saddr, - struct sockaddr_in6 *peer_saddr) + struct sockaddr_in6 *peer_saddr, + uint16_t my_port, + uint16_t peer_port) { struct sockaddr addr; socklen_t addrlen = sizeof(addr); @@ -481,11 +483,11 @@ static int get_v6_send_recv_sock(int *srv_sock, int c_sock; int s_sock; - prepare_sock_tcp_v6(PEER_IPV6_ADDR, PEER_PORT, &s_sock, peer_saddr); + prepare_sock_tcp_v6(PEER_IPV6_ADDR, peer_port, &s_sock, peer_saddr); test_bind(s_sock, (struct sockaddr *)peer_saddr, sizeof(*peer_saddr)); test_listen(s_sock); - prepare_sock_tcp_v6(MY_IPV6_ADDR, MY_PORT, &c_sock, my_saddr); + prepare_sock_tcp_v6(MY_IPV6_ADDR, my_port, &c_sock, my_saddr); test_bind(c_sock, (struct sockaddr *)my_saddr, sizeof(*my_saddr)); test_connect(c_sock, (struct sockaddr *)peer_saddr, sizeof(*peer_saddr)); @@ -566,7 +568,8 @@ ZTEST(net_pmtu_test_suite, test_pmtu_05_ipv6_tcp) dest_ipv6.sin6_family = AF_INET6; - client_sock = get_v6_send_recv_sock(&server_sock, &c_saddr, &s_saddr); + client_sock = get_v6_send_recv_sock(&server_sock, &c_saddr, &s_saddr, + MY_PORT, PEER_PORT); zassert_true(client_sock >= 0, "Failed to create client socket"); /* Set initial MTU for the destination */ @@ -596,7 +599,9 @@ ZTEST(net_pmtu_test_suite, test_pmtu_05_ipv6_tcp) #if defined(CONFIG_NET_IPV4_PMTU) static int get_v4_send_recv_sock(int *srv_sock, struct sockaddr_in *my_saddr, - struct sockaddr_in *peer_saddr) + struct sockaddr_in *peer_saddr, + uint16_t my_port, + uint16_t peer_port) { struct sockaddr addr; socklen_t addrlen = sizeof(addr); @@ -604,11 +609,11 @@ static int get_v4_send_recv_sock(int *srv_sock, int c_sock; int s_sock; - prepare_sock_tcp_v4(PEER_IPV4_ADDR, PEER_PORT, &s_sock, peer_saddr); + prepare_sock_tcp_v4(PEER_IPV4_ADDR, peer_port, &s_sock, peer_saddr); test_bind(s_sock, (struct sockaddr *)peer_saddr, sizeof(*peer_saddr)); test_listen(s_sock); - prepare_sock_tcp_v4(MY_IPV4_ADDR, MY_PORT, &c_sock, my_saddr); + prepare_sock_tcp_v4(MY_IPV4_ADDR, my_port, &c_sock, my_saddr); test_bind(c_sock, (struct sockaddr *)my_saddr, sizeof(*my_saddr)); test_connect(c_sock, (struct sockaddr *)peer_saddr, sizeof(*peer_saddr)); @@ -689,7 +694,8 @@ ZTEST(net_pmtu_test_suite, test_pmtu_05_ipv4_tcp) dest_ipv4.sin_family = AF_INET; - client_sock = get_v4_send_recv_sock(&server_sock, &c_saddr, &s_saddr); + client_sock = get_v4_send_recv_sock(&server_sock, &c_saddr, &s_saddr, + MY_PORT, PEER_PORT); zassert_true(client_sock >= 0, "Failed to create client socket"); /* Set initial MTU for the destination */ @@ -772,4 +778,43 @@ ZTEST(net_pmtu_test_suite, test_pmtu_06_ipv6_event) #endif /* CONFIG_NET_IPV6_PMTU */ } +ZTEST(net_pmtu_test_suite, test_pmtu_07_socket_api_ipv4) +{ +#if defined(CONFIG_NET_IPV4_PMTU) + struct sockaddr_in s_saddr = { 0 }; /* peer */ + struct sockaddr_in c_saddr = { 0 }; /* this host */ + int ret, client_sock, server_sock; + size_t optlen; + int optval; + int err; + + client_sock = get_v4_send_recv_sock(&server_sock, &c_saddr, &s_saddr, + MY_PORT + 1, PEER_PORT + 1); + zassert_true(client_sock >= 0, "Failed to create client socket"); + + /* Set initial MTU for the destination */ + ret = net_pmtu_update_mtu((struct sockaddr *)&c_saddr, 4096); + zassert_true(ret >= 0, "PMTU IPv4 MTU update failed (%d)", ret); + + optval = 0; optlen = sizeof(int); + ret = zsock_getsockopt(client_sock, IPPROTO_IP, IP_MTU, &optval, &optlen); + err = -errno; + zexpect_equal(ret, 0, "setsockopt failed (%d)", err); + zexpect_equal(optlen, sizeof(int), "setsockopt optlen (%d)", optlen); + zexpect_equal(optval, 4096, "setsockopt mtu (%d)", optval); + + optval = 0; optlen = sizeof(int); + ret = zsock_setsockopt(client_sock, IPPROTO_IP, IP_MTU, &optval, optlen); + err = -errno; + zexpect_equal(ret, -1, "setsockopt failed (%d)", err); + zexpect_equal(optlen, sizeof(int), "setsockopt optlen (%d)", optlen); + zexpect_equal(optval, 0, "setsockopt mtu (%d)", optval); + + (void)zsock_close(client_sock); + (void)zsock_close(server_sock); +#else + ztest_test_skip(); +#endif /* CONFIG_NET_IPV4_PMTU */ +} + ZTEST_SUITE(net_pmtu_test_suite, NULL, test_setup, NULL, NULL, NULL); From 9fb09da21a4080e921f9fc7bb2f77baf5085b2cb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 13 Nov 2024 09:26:53 +0200 Subject: [PATCH 2687/4482] net: Add support for IPV6_MTU IPv6 socket option Add IPV6_MTU IPv6 socket option and implement getsockopt() and setsockopt() calls for the option. Signed-off-by: Jukka Rissanen --- include/zephyr/net/socket.h | 7 ++++ subsys/net/ip/net_context.c | 52 +++++++++++++++++++++++++++ subsys/net/lib/sockets/sockets_inet.c | 28 +++++++++++++++ 3 files changed, 87 insertions(+) diff --git a/include/zephyr/net/socket.h b/include/zephyr/net/socket.h index 94fc5efda92d5..06fd0be5ffacd 100644 --- a/include/zephyr/net/socket.h +++ b/include/zephyr/net/socket.h @@ -1248,6 +1248,13 @@ struct ipv6_mreq { int ipv6mr_ifindex; }; +/** For getsockopt(), retrieve the current known IPv6 path MTU of the given socket. + * Valid only when the socket has been connected. + * For setsockopt(), set the MTU to be used for the socket. The MTU is limited by + * the device MTU or the path MTU when path MTU discovery is enabled. + */ +#define IPV6_MTU 24 + /** Don't support IPv4 access */ #define IPV6_V6ONLY 26 diff --git a/subsys/net/ip/net_context.c b/subsys/net/ip/net_context.c index 173000fad0d67..0d304e624eb1c 100644 --- a/subsys/net/ip/net_context.c +++ b/subsys/net/ip/net_context.c @@ -3102,6 +3102,55 @@ static int set_context_reuseport(struct net_context *context, #endif } +static int set_context_ipv6_mtu(struct net_context *context, + const void *value, size_t len) +{ +#if defined(CONFIG_NET_IPV6) + struct net_if *iface; + uint16_t mtu; + + if (len != sizeof(int)) { + return -EINVAL; + } + + mtu = *((int *)value); + + if (IS_ENABLED(CONFIG_NET_IPV6_PMTU)) { + int ret; + + ret = net_pmtu_update_mtu(&context->remote, mtu); + if (ret < 0) { + return ret; + } + + return 0; + } + + if (net_context_is_bound_to_iface(context)) { + iface = net_context_get_iface(context); + } else { + sa_family_t family = net_context_get_family(context); + + if (IS_ENABLED(CONFIG_NET_IPV6) && family == AF_INET6) { + iface = net_if_ipv6_select_src_iface( + &net_sin6(&context->remote)->sin6_addr); + } else { + return -EAFNOSUPPORT; + } + } + + net_if_set_mtu(iface, (uint16_t)mtu); + + return 0; +#else + ARG_UNUSED(context); + ARG_UNUSED(value); + ARG_UNUSED(len); + + return -ENOTSUP; +#endif +} + static int set_context_ipv6_v6only(struct net_context *context, const void *value, size_t len) { @@ -3236,6 +3285,9 @@ int net_context_set_option(struct net_context *context, if (IS_ENABLED(CONFIG_NET_IPV4) && net_context_get_family(context) == AF_INET) { ret = -EOPNOTSUPP; + } else if (IS_ENABLED(CONFIG_NET_IPV6) && + net_context_get_family(context) == AF_INET6) { + ret = set_context_ipv6_mtu(context, value, len); } break; diff --git a/subsys/net/lib/sockets/sockets_inet.c b/subsys/net/lib/sockets/sockets_inet.c index af57c40e5bc2d..8e5673208aa3e 100644 --- a/subsys/net/lib/sockets/sockets_inet.c +++ b/subsys/net/lib/sockets/sockets_inet.c @@ -1858,6 +1858,20 @@ int zsock_getsockopt_ctx(struct net_context *ctx, int level, int optname, case IPPROTO_IPV6: switch (optname) { + case IPV6_MTU: + if (IS_ENABLED(CONFIG_NET_IPV6)) { + ret = net_context_get_option(ctx, NET_OPT_MTU, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + case IPV6_V6ONLY: if (IS_ENABLED(CONFIG_NET_IPV4_MAPPING_TO_IPV6)) { ret = net_context_get_option(ctx, @@ -2422,6 +2436,20 @@ int zsock_setsockopt_ctx(struct net_context *ctx, int level, int optname, case IPPROTO_IPV6: switch (optname) { + case IPV6_MTU: + if (IS_ENABLED(CONFIG_NET_IPV6)) { + ret = net_context_set_option(ctx, NET_OPT_MTU, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } + + break; + case IPV6_V6ONLY: if (IS_ENABLED(CONFIG_NET_IPV4_MAPPING_TO_IPV6)) { ret = net_context_set_option(ctx, From 3d39cbd24d0b975b9b83342a27d92590d18b0aa2 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 13 Nov 2024 09:28:02 +0200 Subject: [PATCH 2688/4482] tests: net: pmtu: Add IPV6_MTU socket option tests Make sure we can use IPV6_MTU socket option from application. Signed-off-by: Jukka Rissanen --- tests/net/pmtu/src/main.c | 46 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/tests/net/pmtu/src/main.c b/tests/net/pmtu/src/main.c index 9c41e8ae5a35b..54d225a259e25 100644 --- a/tests/net/pmtu/src/main.c +++ b/tests/net/pmtu/src/main.c @@ -817,4 +817,50 @@ ZTEST(net_pmtu_test_suite, test_pmtu_07_socket_api_ipv4) #endif /* CONFIG_NET_IPV4_PMTU */ } +ZTEST(net_pmtu_test_suite, test_pmtu_08_socket_api_ipv6) +{ +#if defined(CONFIG_NET_IPV6_PMTU) + struct sockaddr_in6 s_saddr = { 0 }; /* peer */ + struct sockaddr_in6 c_saddr = { 0 }; /* this host */ + int ret, client_sock, server_sock; + size_t optlen; + int optval; + int err; + + client_sock = get_v6_send_recv_sock(&server_sock, &c_saddr, &s_saddr, + MY_PORT + 2, PEER_PORT + 2); + zassert_true(client_sock >= 0, "Failed to create client socket"); + + /* Set initial MTU for the destination */ + ret = net_pmtu_update_mtu((struct sockaddr *)&c_saddr, 2048); + zassert_true(ret >= 0, "PMTU IPv6 MTU update failed (%d)", ret); + + optval = 0; optlen = sizeof(int); + ret = zsock_getsockopt(client_sock, IPPROTO_IPV6, IPV6_MTU, &optval, &optlen); + err = -errno; + zexpect_equal(ret, 0, "getsockopt failed (%d)", err); + zexpect_equal(optlen, sizeof(int), "getsockopt optlen (%d)", optlen); + zexpect_equal(optval, 2048, "getsockopt mtu (%d)", optval); + + optval = 1500; optlen = sizeof(int); + ret = zsock_setsockopt(client_sock, IPPROTO_IPV6, IPV6_MTU, &optval, optlen); + err = -errno; + zexpect_equal(ret, 0, "setsockopt failed (%d)", err); + zexpect_equal(optlen, sizeof(int), "setsockopt optlen (%d)", optlen); + zexpect_equal(optval, 1500, "setsockopt mtu (%d)", optval); + + optval = 0; optlen = sizeof(int); + ret = zsock_getsockopt(client_sock, IPPROTO_IPV6, IPV6_MTU, &optval, &optlen); + err = -errno; + zexpect_equal(ret, 0, "getsockopt failed (%d)", err); + zexpect_equal(optlen, sizeof(int), "getsockopt optlen (%d)", optlen); + zexpect_equal(optval, 1500, "getsockopt mtu (%d)", optval); + + (void)zsock_close(client_sock); + (void)zsock_close(server_sock); +#else + ztest_test_skip(); +#endif /* CONFIG_NET_IPV6_PMTU */ +} + ZTEST_SUITE(net_pmtu_test_suite, NULL, test_setup, NULL, NULL, NULL); From b6618e8a53e3be32dadc3189415685f20209e0cb Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 13 Nov 2024 10:38:13 +0200 Subject: [PATCH 2689/4482] net: ipv4_fragment: Add PMTU support If PMTU is enabled, then use the MTU value from it instead of always using network interface MTU. Signed-off-by: Jukka Rissanen --- subsys/net/ip/ipv4_fragment.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/subsys/net/ip/ipv4_fragment.c b/subsys/net/ip/ipv4_fragment.c index c095efc4c2d45..69fe952215989 100644 --- a/subsys/net/ip/ipv4_fragment.c +++ b/subsys/net/ip/ipv4_fragment.c @@ -23,6 +23,7 @@ LOG_MODULE_DECLARE(net_ipv4, CONFIG_NET_IPV4_LOG_LEVEL); #include "ipv4.h" #include "route.h" #include "net_stats.h" +#include "pmtu.h" /* Timeout for various buffer allocations in this file. */ #define NET_BUF_TIMEOUT K_MSEC(100) @@ -624,10 +625,26 @@ enum net_verdict net_ipv4_prepare_for_send_fragment(struct net_pkt *pkt) * and we can skip other checks. */ if (ip_hdr->id[0] == 0 && ip_hdr->id[1] == 0) { - uint16_t mtu = net_if_get_mtu(net_pkt_iface(pkt)); size_t pkt_len = net_pkt_get_len(pkt); + uint16_t mtu; - mtu = MAX(NET_IPV4_MTU, mtu); + if (IS_ENABLED(CONFIG_NET_IPV4_PMTU)) { + struct sockaddr_in dst = { + .sin_family = AF_INET, + .sin_addr = *((struct in_addr *)ip_hdr->dst), + }; + + ret = net_pmtu_get_mtu((struct sockaddr *)&dst); + if (ret <= 0) { + goto use_interface_mtu; + } + + mtu = ret; + } else { +use_interface_mtu: + mtu = net_if_get_mtu(net_pkt_iface(pkt)); + mtu = MAX(NET_IPV4_MTU, mtu); + } if (pkt_len > mtu) { ret = net_ipv4_send_fragmented_pkt(net_pkt_iface(pkt), pkt, pkt_len, mtu); From bdd5001e5bb4cc04adc690eed600c1c761d18eab Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 13 Nov 2024 10:39:00 +0200 Subject: [PATCH 2690/4482] tests: net: ipv4_fragment: Add PMTU testing Enable PMTU so that we test it with IPv4 fragmentation code. Signed-off-by: Jukka Rissanen --- tests/net/ipv4_fragment/testcase.yaml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/net/ipv4_fragment/testcase.yaml b/tests/net/ipv4_fragment/testcase.yaml index 30e18231e4941..c45d22699d50a 100644 --- a/tests/net/ipv4_fragment/testcase.yaml +++ b/tests/net/ipv4_fragment/testcase.yaml @@ -5,9 +5,14 @@ # common: depends_on: netif + tags: + - net + - ipv4 + - fragment tests: net.ipv4.fragment: - tags: - - net - - ipv4 - - fragment + extra_configs: + - CONFIG_NET_IPV4_PMTU=n + net.ipv4.fragment.with_pmtu: + extra_configs: + - CONFIG_NET_IPV4_PMTU=y From 265828634d203a38a6afb75f071fc363c7205f9a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 13 Nov 2024 10:35:32 +0200 Subject: [PATCH 2691/4482] tests: net: ipv4_fragment: Make test to run faster Shorten the timeouts so that the tests are run in 6 second instead of 15 seconds. Use only native_sim for the tests so that the tests are run without any extra delays. Signed-off-by: Jukka Rissanen --- tests/net/ipv4_fragment/prj.conf | 2 ++ tests/net/ipv4_fragment/src/main.c | 8 ++++---- tests/net/ipv4_fragment/testcase.yaml | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/net/ipv4_fragment/prj.conf b/tests/net/ipv4_fragment/prj.conf index d8c4d1ff5348e..2cd57fc788160 100644 --- a/tests/net/ipv4_fragment/prj.conf +++ b/tests/net/ipv4_fragment/prj.conf @@ -26,3 +26,5 @@ CONFIG_ZTEST_STACK_SIZE=2048 CONFIG_INIT_STACKS=y CONFIG_NET_STATISTICS=n + +CONFIG_NET_IPV4_FRAGMENT_TIMEOUT=1 diff --git a/tests/net/ipv4_fragment/src/main.c b/tests/net/ipv4_fragment/src/main.c index 9379af361a18c..8e496e8097d1e 100644 --- a/tests/net/ipv4_fragment/src/main.c +++ b/tests/net/ipv4_fragment/src/main.c @@ -31,7 +31,7 @@ LOG_MODULE_REGISTER(net_ipv4_test, CONFIG_NET_IPV4_LOG_LEVEL); #define IPV4_TEST_PACKET_SIZE 2048 /* Wait times for semaphores and buffers */ -#define WAIT_TIME K_SECONDS(2) +#define WAIT_TIME K_MSEC(1100) #define ALLOC_TIMEOUT K_MSEC(500) /* Dummy network addresses, 192.168.8.1 and 192.168.8.2 */ @@ -776,7 +776,7 @@ ZTEST(net_ipv4_fragment, test_fragment_timeout) zassert_equal(packets, 1, "Expected fragment to be present in buffer"); /* Delay briefly and re-check number of pending reassembly packets */ - k_sleep(K_SECONDS(6)); + k_sleep(K_MSEC(1100)); packets = 0; net_ipv4_frag_foreach(reassembly_foreach_cb, &packets); zassert_equal(packets, 0, "Expected fragment to be dropped after timeout"); @@ -790,7 +790,7 @@ ZTEST(net_ipv4_fragment, test_fragment_timeout) zassert_equal(sem_count, 0, "Expected no complete upper-layer packets"); /* Check packet counts are valid */ - k_sleep(K_SECONDS(1)); + k_sleep(K_MSEC(500)); zassert_equal(lower_layer_packet_count, 1, "Expected 1 packet at lower layers"); zassert_equal(upper_layer_packet_count, 0, "Expected no packets at upper layers"); zassert_equal(last_packet_received, 1, "Expected last packet"); @@ -862,7 +862,7 @@ ZTEST(net_ipv4_fragment, test_do_not_fragment) "Expected timeout waiting for packet to be received"); /* Check packet counts are valid */ - k_sleep(K_SECONDS(1)); + k_sleep(K_MSEC(100)); zassert_equal(lower_layer_packet_count, 0, "Expected no packets at lower layers"); zassert_equal(upper_layer_packet_count, 0, "Expected no packets at upper layers"); zassert_equal(last_packet_received, 0, "Did not expect last packet"); diff --git a/tests/net/ipv4_fragment/testcase.yaml b/tests/net/ipv4_fragment/testcase.yaml index c45d22699d50a..34822465bef22 100644 --- a/tests/net/ipv4_fragment/testcase.yaml +++ b/tests/net/ipv4_fragment/testcase.yaml @@ -9,6 +9,7 @@ common: - net - ipv4 - fragment + platform_allow: native_sim tests: net.ipv4.fragment: extra_configs: From 19f9ce56226f1bca8702f93677bc4a06b4b2ad49 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 13 Nov 2024 11:05:31 +0200 Subject: [PATCH 2692/4482] net: ipv6_fragment: Add PMTU support If PMTU is enabled, then use the MTU value from it instead of always using network interface MTU. Signed-off-by: Jukka Rissanen --- subsys/net/ip/ipv6_fragment.c | 6 +++--- subsys/net/ip/ipv6_nbr.c | 24 +++++++++++++++++++++--- subsys/net/ip/net_private.h | 2 +- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/subsys/net/ip/ipv6_fragment.c b/subsys/net/ip/ipv6_fragment.c index fda00c59f0390..2915f4c374ee6 100644 --- a/subsys/net/ip/ipv6_fragment.c +++ b/subsys/net/ip/ipv6_fragment.c @@ -686,7 +686,7 @@ static int send_ipv6_fragment(struct net_pkt *pkt, } int net_ipv6_send_fragmented_pkt(struct net_if *iface, struct net_pkt *pkt, - uint16_t pkt_len) + uint16_t pkt_len, uint16_t mtu) { uint16_t next_hdr_off; uint16_t last_hdr_off; @@ -713,12 +713,12 @@ int net_ipv6_send_fragmented_pkt(struct net_if *iface, struct net_pkt *pkt, /* The Maximum payload can fit into each packet after IPv6 header, * Extension headers and Fragmentation header. */ - fit_len = NET_IPV6_MTU - NET_IPV6_FRAGH_LEN - + fit_len = (int)mtu - NET_IPV6_FRAGH_LEN - (net_pkt_ip_hdr_len(pkt) + net_pkt_ipv6_ext_len(pkt)); if (fit_len <= 0) { /* Must be invalid extension headers length */ NET_DBG("No room for IPv6 payload MTU %d hdrs_len %d", - NET_IPV6_MTU, NET_IPV6_FRAGH_LEN + + mtu, NET_IPV6_FRAGH_LEN + net_pkt_ip_hdr_len(pkt) + net_pkt_ipv6_ext_len(pkt)); return -EINVAL; } diff --git a/subsys/net/ip/ipv6_nbr.c b/subsys/net/ip/ipv6_nbr.c index 5ad332c3dec0a..e09fa0cba2dd7 100644 --- a/subsys/net/ip/ipv6_nbr.c +++ b/subsys/net/ip/ipv6_nbr.c @@ -810,13 +810,31 @@ enum net_verdict net_ipv6_prepare_for_send(struct net_pkt *pkt) * contain a proper value and we can skip other checks. */ if (net_pkt_ipv6_fragment_id(pkt) == 0U) { - uint16_t mtu = net_if_get_mtu(net_pkt_iface(pkt)); size_t pkt_len = net_pkt_get_len(pkt); + uint16_t mtu; + + if (IS_ENABLED(CONFIG_NET_IPV6_PMTU)) { + struct sockaddr_in6 dst = { + .sin6_family = AF_INET6, + }; + + net_ipv6_addr_copy_raw((uint8_t *)&dst.sin6_addr, ip_hdr->dst); + + ret = net_pmtu_get_mtu((struct sockaddr *)&dst); + if (ret <= 0) { + goto use_interface_mtu; + } + + mtu = ret; + } else { +use_interface_mtu: + mtu = net_if_get_mtu(net_pkt_iface(pkt)); + mtu = MAX(NET_IPV6_MTU, mtu); + } - mtu = MAX(NET_IPV6_MTU, mtu); if (mtu < pkt_len) { ret = net_ipv6_send_fragmented_pkt(net_pkt_iface(pkt), - pkt, pkt_len); + pkt, pkt_len, mtu); if (ret < 0) { NET_DBG("Cannot fragment IPv6 pkt (%d)", ret); return NET_DROP; diff --git a/subsys/net/ip/net_private.h b/subsys/net/ip/net_private.h index 04c3205f5aece..9e3878c1d8e24 100644 --- a/subsys/net/ip/net_private.h +++ b/subsys/net/ip/net_private.h @@ -245,7 +245,7 @@ int net_ipv4_send_fragmented_pkt(struct net_if *iface, struct net_pkt *pkt, #if defined(CONFIG_NET_IPV6_FRAGMENT) int net_ipv6_send_fragmented_pkt(struct net_if *iface, struct net_pkt *pkt, - uint16_t pkt_len); + uint16_t pkt_len, uint16_t mtu); #endif extern const char *net_verdict2str(enum net_verdict verdict); From 4c37d5a7bdf1025455dc1f1400160345d820de38 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 13 Nov 2024 11:06:15 +0200 Subject: [PATCH 2693/4482] tests: net: ipv6_fragment: Add PMTU testing Enable PMTU so that we test it with IPv6 fragmentation code. Signed-off-by: Jukka Rissanen --- tests/net/ipv6_fragment/testcase.yaml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/net/ipv6_fragment/testcase.yaml b/tests/net/ipv6_fragment/testcase.yaml index c5cfd98ada2d5..6095af5f02dd5 100644 --- a/tests/net/ipv6_fragment/testcase.yaml +++ b/tests/net/ipv6_fragment/testcase.yaml @@ -1,8 +1,13 @@ common: depends_on: netif + tags: + - net + - ipv6 + - fragment tests: net.ipv6.fragment: - tags: - - net - - ipv6 - - fragment + extra_configs: + - CONFIG_NET_IPV6_PMTU=n + net.ipv6.fragment.with_pmtu: + extra_configs: + - CONFIG_NET_IPV6_PMTU=y From 247941f79dc9f8a33ef497a171a86995d3e68b3a Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 14 Nov 2024 13:51:14 +0200 Subject: [PATCH 2694/4482] net: ipv6_fragment: Data in one frag must be multiple of 8 After we take the true MTU into account, we need to send proper number of bytes (multiple of 8) in one IPv6 fragment. Signed-off-by: Jukka Rissanen --- subsys/net/ip/ipv6_fragment.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subsys/net/ip/ipv6_fragment.c b/subsys/net/ip/ipv6_fragment.c index 2915f4c374ee6..f50e5f9e4e21b 100644 --- a/subsys/net/ip/ipv6_fragment.c +++ b/subsys/net/ip/ipv6_fragment.c @@ -715,6 +715,10 @@ int net_ipv6_send_fragmented_pkt(struct net_if *iface, struct net_pkt *pkt, */ fit_len = (int)mtu - NET_IPV6_FRAGH_LEN - (net_pkt_ip_hdr_len(pkt) + net_pkt_ipv6_ext_len(pkt)); + + /* The data we want to sent in one fragment must be multiple of 8 */ + fit_len = ROUND_DOWN(fit_len, 8); + if (fit_len <= 0) { /* Must be invalid extension headers length */ NET_DBG("No room for IPv6 payload MTU %d hdrs_len %d", From 7bca40cceda41716689fddf417dc87abf67ac8c3 Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Mon, 4 Nov 2024 10:42:13 +0100 Subject: [PATCH 2695/4482] boards: st: stm32f429i_disc1: doc: fix flashing info The commit e17e54c48f64 ("boards: stm32: add flashing with stm32cubeprog for all") did not update the documentation regarding the flashing section, which no longer uses the OpenOCD runner by default. Fixes: e17e54c48f643dd0fdd79b754e8df6bbd662cb88 Signed-off-by: Dario Binacchi --- boards/st/stm32f429i_disc1/doc/index.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/boards/st/stm32f429i_disc1/doc/index.rst b/boards/st/stm32f429i_disc1/doc/index.rst index c547996ab27aa..4ab7b1f7cd81b 100644 --- a/boards/st/stm32f429i_disc1/doc/index.rst +++ b/boards/st/stm32f429i_disc1/doc/index.rst @@ -164,13 +164,17 @@ This interface is supported by the openocd version included in Zephyr SDK. Flashing an application to STM32F429I-DISC1 ------------------------------------------- -The board is configured to be flashed using west OpenOCD runner. -Alternatively, you can use `STM32CubeProgrammer`_ (after installing it) using the ``--runner`` -(or ``-r``) option: +The board is configured to be flashed using west `STM32CubeProgrammer`_ runner, +so its :ref:`installation ` is required. + +Alternatively, OpenOCD, JLink, or pyOCD can also be used to flash the board using +the ``--runner`` (or ``-r``) option: .. code-block:: console - $ west flash --runner stm32cubeprogrammer + $ west flash --runner openocd + $ west flash --runner jlink + $ west flash --runner pyocd First, connect the STM32F429I-DISC1 Discovery kit to your host computer using the USB port to prepare it for flashing. Then build and flash your application. From 3f6978e913ffabebccb386bf13b6763760b1b655 Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Mon, 4 Nov 2024 10:58:50 +0100 Subject: [PATCH 2696/4482] boards: st: stm32f429i_disc1: doc: support LTDC hardware The building and flashing of the drivers/display and subsys/display/lvgl examples confirmed that the LTDC peripheral is supported. Signed-off-by: Dario Binacchi --- boards/st/stm32f429i_disc1/doc/index.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boards/st/stm32f429i_disc1/doc/index.rst b/boards/st/stm32f429i_disc1/doc/index.rst index 4ab7b1f7cd81b..7fffda0a2959c 100644 --- a/boards/st/stm32f429i_disc1/doc/index.rst +++ b/boards/st/stm32f429i_disc1/doc/index.rst @@ -92,6 +92,8 @@ The Zephyr stm32f429i_disc1 board configuration supports the following hardware +-----------+------------+-------------------------------------+ | OTG_HS | on-chip | usbotg_hs | +-----------+------------+-------------------------------------+ +| LTDC | on-chip | display | ++-----------+------------+-------------------------------------+ Other hardware features are not yet supported on Zephyr porting. From ed48de2583af28e5a861032bb59bc4312c825949 Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Mon, 4 Nov 2024 14:35:11 +0100 Subject: [PATCH 2697/4482] boards: st: stm32f429i_disc1: doc: re-work flashing section The patch modifies the "Programming and Debugging" and "Flashing" sections to make the documentation clearer and consistent with what is reported for other ST boards. Suggested-by: Abderrahmane Jarmouni Signed-off-by: Dario Binacchi --- boards/st/stm32f429i_disc1/doc/index.rst | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/boards/st/stm32f429i_disc1/doc/index.rst b/boards/st/stm32f429i_disc1/doc/index.rst index 7fffda0a2959c..24780fb6cc091 100644 --- a/boards/st/stm32f429i_disc1/doc/index.rst +++ b/boards/st/stm32f429i_disc1/doc/index.rst @@ -153,6 +153,7 @@ and host OTG operation, but only device mode has been tested with Zephyr at this Programming and Debugging ************************* +The STM32F429I-DISC1 Discovery kit includes a ST-LINK/V2-B embedded debug tool interface. Applications for the ``stm32f429i_disc1`` board configuration can be built and flashed in the usual way (see :ref:`build_an_application` and :ref:`application_run` for more details). @@ -160,12 +161,6 @@ and flashed in the usual way (see :ref:`build_an_application` and Flashing ======== -The STM32F429I-DISC1 Discovery kit includes a ST-LINK/V2-B embedded debug tool interface. -This interface is supported by the openocd version included in Zephyr SDK. - -Flashing an application to STM32F429I-DISC1 -------------------------------------------- - The board is configured to be flashed using west `STM32CubeProgrammer`_ runner, so its :ref:`installation ` is required. From 2f800cea8fdf48f8e58add5b9ebd12aed96a6113 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 7 Nov 2024 08:31:10 +0000 Subject: [PATCH 2698/4482] soc: Remove re-defining some defined types Removes re-defining some Kconfigs that are already defined e.g. in arch Signed-off-by: Jamie McCrae --- soc/atmel/sam0/samd51/Kconfig.defconfig | 1 - soc/brcm/bcm2711/Kconfig.defconfig | 2 -- soc/brcm/bcm2712/Kconfig.defconfig | 2 -- soc/brcm/bcmvk/valkyrie/Kconfig.defconfig | 2 -- soc/brcm/bcmvk/viper/Kconfig.defconfig.viper_bcm58402_a72 | 2 -- soc/brcm/bcmvk/viper/Kconfig.defconfig.viper_bcm58402_m7 | 2 -- soc/efinix/sapphire/Kconfig.defconfig | 2 -- soc/gaisler/gr716a/Kconfig.defconfig | 1 - soc/intel/intel_socfpga/agilex/Kconfig.defconfig.agilex | 2 -- soc/intel/intel_socfpga/agilex5/Kconfig.defconfig.agilex5 | 2 -- .../intel_socfpga_std/cyclonev/Kconfig.defconfig.cyclonev | 2 -- soc/nordic/nrf52/Kconfig.defconfig.nrf52820_QDAA | 1 - soc/nordic/nrf52/Kconfig.defconfig.nrf52833_QDAA | 1 - soc/nordic/nrf52/Kconfig.defconfig.nrf52833_QIAA | 1 - soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8ml8_a53 | 2 -- soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8ml8_m7 | 2 -- soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8mm6_a53 | 2 -- soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8mm6_m4 | 2 -- soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8mn6_a53 | 2 -- soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8mq6_m4 | 2 -- soc/nxp/imx/imx9/imx93/Kconfig.defconfig.mimx93.a55 | 2 -- soc/nxp/imx/imx9/imx93/Kconfig.defconfig.mimx93.m33 | 2 -- soc/nxp/imx/imx9/imx95/Kconfig.defconfig.mimx95.a55 | 2 -- soc/nxp/imx/imx9/imx95/Kconfig.defconfig.mimx95.m7 | 2 -- soc/nxp/imxrt/Kconfig.defconfig | 1 - soc/nxp/imxrt/imxrt5xx/Kconfig.defconfig | 1 - soc/nxp/imxrt/imxrt6xx/Kconfig.defconfig | 1 - soc/nxp/layerscape/ls1046a/Kconfig.defconfig | 1 - soc/rockchip/rk3399/Kconfig.defconfig.rk3399 | 1 - soc/rockchip/rk3568/Kconfig.defconfig.rk3568 | 2 -- soc/silabs/silabs_s1/efm32gg11b/Kconfig.defconfig | 1 - soc/silabs/silabs_s1/efm32gg12b/Kconfig.defconfig | 1 - soc/silabs/silabs_s2/efr32mg21/Kconfig.defconfig | 1 - soc/silabs/silabs_sim3/sim3u/Kconfig.defconfig | 1 - soc/snps/qemu_arc/Kconfig.defconfig | 1 - soc/st/stm32/stm32f1x/Kconfig.defconfig.stm32f105xx | 1 - soc/st/stm32/stm32l1x/Kconfig.defconfig.stm32l152xc | 1 - soc/st/stm32/stm32l1x/Kconfig.defconfig.stm32l152xe | 1 - soc/telink/tlsr/tlsr951x/Kconfig.defconfig | 8 -------- soc/ti/k3/am6x/Kconfig.defconfig | 2 -- soc/xen/Kconfig.defconfig | 2 -- soc/xlnx/zynq7000/Kconfig.defconfig | 1 - 42 files changed, 71 deletions(-) diff --git a/soc/atmel/sam0/samd51/Kconfig.defconfig b/soc/atmel/sam0/samd51/Kconfig.defconfig index c37eb407f4d83..beb89ec33fd4f 100644 --- a/soc/atmel/sam0/samd51/Kconfig.defconfig +++ b/soc/atmel/sam0/samd51/Kconfig.defconfig @@ -7,7 +7,6 @@ if SOC_SERIES_SAMD51 config NUM_IRQS - int default 137 config ROM_START_OFFSET diff --git a/soc/brcm/bcm2711/Kconfig.defconfig b/soc/brcm/bcm2711/Kconfig.defconfig index 21776e5ef160d..66b749fdedb68 100644 --- a/soc/brcm/bcm2711/Kconfig.defconfig +++ b/soc/brcm/bcm2711/Kconfig.defconfig @@ -4,11 +4,9 @@ if SOC_BCM2711 config NUM_IRQS - int default 260 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 54000000 endif diff --git a/soc/brcm/bcm2712/Kconfig.defconfig b/soc/brcm/bcm2712/Kconfig.defconfig index e408b20271ad7..88db7f97b6ad7 100644 --- a/soc/brcm/bcm2712/Kconfig.defconfig +++ b/soc/brcm/bcm2712/Kconfig.defconfig @@ -4,11 +4,9 @@ if SOC_BCM2712 config NUM_IRQS - int default 280 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 54000000 endif diff --git a/soc/brcm/bcmvk/valkyrie/Kconfig.defconfig b/soc/brcm/bcmvk/valkyrie/Kconfig.defconfig index 5312999e21431..1d9e0655139e2 100644 --- a/soc/brcm/bcmvk/valkyrie/Kconfig.defconfig +++ b/soc/brcm/bcmvk/valkyrie/Kconfig.defconfig @@ -6,11 +6,9 @@ if SOC_SERIES_VALKYRIE config NUM_IRQS - int default 240 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 500000000 endif # SOC_SERIES_VALKYRIE diff --git a/soc/brcm/bcmvk/viper/Kconfig.defconfig.viper_bcm58402_a72 b/soc/brcm/bcmvk/viper/Kconfig.defconfig.viper_bcm58402_a72 index dba58d12f853b..292c8d83a2c4d 100644 --- a/soc/brcm/bcmvk/viper/Kconfig.defconfig.viper_bcm58402_a72 +++ b/soc/brcm/bcmvk/viper/Kconfig.defconfig.viper_bcm58402_a72 @@ -4,11 +4,9 @@ if SOC_BCM58402_A72 config NUM_IRQS - int default 260 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 25000000 endif diff --git a/soc/brcm/bcmvk/viper/Kconfig.defconfig.viper_bcm58402_m7 b/soc/brcm/bcmvk/viper/Kconfig.defconfig.viper_bcm58402_m7 index 16acf0d29b78d..95a26d73acea7 100644 --- a/soc/brcm/bcmvk/viper/Kconfig.defconfig.viper_bcm58402_m7 +++ b/soc/brcm/bcmvk/viper/Kconfig.defconfig.viper_bcm58402_m7 @@ -4,11 +4,9 @@ if SOC_BCM58402_M7 config NUM_IRQS - int default 240 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 500000000 endif diff --git a/soc/efinix/sapphire/Kconfig.defconfig b/soc/efinix/sapphire/Kconfig.defconfig index 75325b2fa55b4..62a888c0a9bca 100644 --- a/soc/efinix/sapphire/Kconfig.defconfig +++ b/soc/efinix/sapphire/Kconfig.defconfig @@ -7,11 +7,9 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC default 100000000 config RISCV_SOC_INTERRUPT_INIT - bool default y config NUM_IRQS - int default 36 config 2ND_LVL_INTR_00_OFFSET diff --git a/soc/gaisler/gr716a/Kconfig.defconfig b/soc/gaisler/gr716a/Kconfig.defconfig index c6913964fd806..e33e477df69ed 100644 --- a/soc/gaisler/gr716a/Kconfig.defconfig +++ b/soc/gaisler/gr716a/Kconfig.defconfig @@ -7,7 +7,6 @@ config SPARC_NWIN default 31 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 50000000 if FLASH diff --git a/soc/intel/intel_socfpga/agilex/Kconfig.defconfig.agilex b/soc/intel/intel_socfpga/agilex/Kconfig.defconfig.agilex index 4b147ff0df3d4..b0c768c5d4169 100644 --- a/soc/intel/intel_socfpga/agilex/Kconfig.defconfig.agilex +++ b/soc/intel/intel_socfpga/agilex/Kconfig.defconfig.agilex @@ -6,11 +6,9 @@ if SOC_AGILEX # must be >= the highest interrupt number used # - include the UART interrupts 173 or 204 config NUM_IRQS - int default 205 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 25000000 config KERNEL_VM_SIZE diff --git a/soc/intel/intel_socfpga/agilex5/Kconfig.defconfig.agilex5 b/soc/intel/intel_socfpga/agilex5/Kconfig.defconfig.agilex5 index 44d0701370404..2950622a50b1a 100644 --- a/soc/intel/intel_socfpga/agilex5/Kconfig.defconfig.agilex5 +++ b/soc/intel/intel_socfpga/agilex5/Kconfig.defconfig.agilex5 @@ -6,11 +6,9 @@ if SOC_AGILEX5 # must be >= the highest interrupt number used # - include the UART interrupts 173 or 274 config NUM_IRQS - int default 274 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 400000000 config KERNEL_VM_SIZE diff --git a/soc/intel/intel_socfpga_std/cyclonev/Kconfig.defconfig.cyclonev b/soc/intel/intel_socfpga_std/cyclonev/Kconfig.defconfig.cyclonev index c127406f62836..3c7a6c886918d 100644 --- a/soc/intel/intel_socfpga_std/cyclonev/Kconfig.defconfig.cyclonev +++ b/soc/intel/intel_socfpga_std/cyclonev/Kconfig.defconfig.cyclonev @@ -4,11 +4,9 @@ if SOC_CYCLONEV config NUM_IRQS - int default 211 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 231250000 endif diff --git a/soc/nordic/nrf52/Kconfig.defconfig.nrf52820_QDAA b/soc/nordic/nrf52/Kconfig.defconfig.nrf52820_QDAA index 2db0291afad8d..045e711177d05 100644 --- a/soc/nordic/nrf52/Kconfig.defconfig.nrf52820_QDAA +++ b/soc/nordic/nrf52/Kconfig.defconfig.nrf52820_QDAA @@ -6,7 +6,6 @@ if SOC_NRF52820_QDAA config NUM_IRQS - int default 40 endif # SOC_NRF52820_QDAA diff --git a/soc/nordic/nrf52/Kconfig.defconfig.nrf52833_QDAA b/soc/nordic/nrf52/Kconfig.defconfig.nrf52833_QDAA index 055544288e4f2..2284d03cbcd05 100644 --- a/soc/nordic/nrf52/Kconfig.defconfig.nrf52833_QDAA +++ b/soc/nordic/nrf52/Kconfig.defconfig.nrf52833_QDAA @@ -6,7 +6,6 @@ if SOC_NRF52833_QDAA config NUM_IRQS - int default 48 endif # SOC_NRF52833_QDAA diff --git a/soc/nordic/nrf52/Kconfig.defconfig.nrf52833_QIAA b/soc/nordic/nrf52/Kconfig.defconfig.nrf52833_QIAA index add0c89503b4f..a3f9a64e04fd4 100644 --- a/soc/nordic/nrf52/Kconfig.defconfig.nrf52833_QIAA +++ b/soc/nordic/nrf52/Kconfig.defconfig.nrf52833_QIAA @@ -6,7 +6,6 @@ if SOC_NRF52833_QIAA config NUM_IRQS - int default 48 endif # SOC_NRF52833_QIAA diff --git a/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8ml8_a53 b/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8ml8_a53 index 23edb44e9dd39..a6d75083a796f 100644 --- a/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8ml8_a53 +++ b/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8ml8_a53 @@ -13,11 +13,9 @@ config FLASH_BASE_ADDRESS default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH)) config NUM_IRQS - int default 240 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 8000000 config PINCTRL_IMX diff --git a/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8ml8_m7 b/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8ml8_m7 index b35dc400e6017..357439979c701 100644 --- a/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8ml8_m7 +++ b/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8ml8_m7 @@ -7,7 +7,6 @@ if SOC_MIMX8ML8_M7 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 800000000 config GPIO @@ -38,7 +37,6 @@ config FLASH_BASE_ADDRESS endif # CODE_DDR config NUM_IRQS - int # must be >= the highest interrupt number used default 159 diff --git a/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8mm6_a53 b/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8mm6_a53 index 39ce520f5ab6c..e6e72f91b4fc4 100644 --- a/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8mm6_a53 +++ b/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8mm6_a53 @@ -13,11 +13,9 @@ config FLASH_BASE_ADDRESS default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH)) config NUM_IRQS - int default 240 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 8000000 config PINCTRL_IMX diff --git a/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8mm6_m4 b/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8mm6_m4 index 02f068af04f16..7bfa617159ec2 100644 --- a/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8mm6_m4 +++ b/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8mm6_m4 @@ -7,7 +7,6 @@ if SOC_MIMX8MM6_M4 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 400000000 config IPM_IMX @@ -15,7 +14,6 @@ config IPM_IMX depends on IPM config NUM_IRQS - int # must be >= the highest interrupt number used default 127 diff --git a/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8mn6_a53 b/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8mn6_a53 index f48c3187b1951..fd276a61e0ca0 100644 --- a/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8mn6_a53 +++ b/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8mn6_a53 @@ -13,11 +13,9 @@ config FLASH_BASE_ADDRESS default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH)) config NUM_IRQS - int default 240 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 8000000 config PINCTRL_IMX diff --git a/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8mq6_m4 b/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8mq6_m4 index 0f9e144bfdedf..9cd67adf565cc 100644 --- a/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8mq6_m4 +++ b/soc/nxp/imx/imx8m/Kconfig.defconfig.mimx8mq6_m4 @@ -7,7 +7,6 @@ if SOC_MIMX8MQ6_M4 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 266000000 config PINCTRL_IMX @@ -15,7 +14,6 @@ config PINCTRL_IMX depends on PINCTRL config NUM_IRQS - int # must be >= the highest interrupt number used default 127 diff --git a/soc/nxp/imx/imx9/imx93/Kconfig.defconfig.mimx93.a55 b/soc/nxp/imx/imx9/imx93/Kconfig.defconfig.mimx93.a55 index f53cc12c0f099..bd0d20c53b37b 100644 --- a/soc/nxp/imx/imx9/imx93/Kconfig.defconfig.mimx93.a55 +++ b/soc/nxp/imx/imx9/imx93/Kconfig.defconfig.mimx93.a55 @@ -13,11 +13,9 @@ config FLASH_BASE_ADDRESS default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH)) config NUM_IRQS - int default 240 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 24000000 config PINCTRL_IMX diff --git a/soc/nxp/imx/imx9/imx93/Kconfig.defconfig.mimx93.m33 b/soc/nxp/imx/imx9/imx93/Kconfig.defconfig.mimx93.m33 index 977b74833a54a..c4d70534a28e1 100644 --- a/soc/nxp/imx/imx9/imx93/Kconfig.defconfig.mimx93.m33 +++ b/soc/nxp/imx/imx9/imx93/Kconfig.defconfig.mimx93.m33 @@ -12,11 +12,9 @@ config FLASH_BASE_ADDRESS default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH)) config NUM_IRQS - int default 268 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 200000000 endif diff --git a/soc/nxp/imx/imx9/imx95/Kconfig.defconfig.mimx95.a55 b/soc/nxp/imx/imx9/imx95/Kconfig.defconfig.mimx95.a55 index 3ee33dacf219c..603b1b826dd9c 100644 --- a/soc/nxp/imx/imx9/imx95/Kconfig.defconfig.mimx95.a55 +++ b/soc/nxp/imx/imx9/imx95/Kconfig.defconfig.mimx95.a55 @@ -13,11 +13,9 @@ config FLASH_BASE_ADDRESS default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH)) config NUM_IRQS - int default 320 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 24000000 endif diff --git a/soc/nxp/imx/imx9/imx95/Kconfig.defconfig.mimx95.m7 b/soc/nxp/imx/imx9/imx95/Kconfig.defconfig.mimx95.m7 index d808258ce9704..4265f5233b4c8 100644 --- a/soc/nxp/imx/imx9/imx95/Kconfig.defconfig.mimx95.m7 +++ b/soc/nxp/imx/imx9/imx95/Kconfig.defconfig.mimx95.m7 @@ -12,11 +12,9 @@ config FLASH_BASE_ADDRESS default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH)) config NUM_IRQS - int default 230 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 800000000 config CACHE_MANAGEMENT diff --git a/soc/nxp/imxrt/Kconfig.defconfig b/soc/nxp/imxrt/Kconfig.defconfig index caf637260d7c4..f0d98e83ea62e 100644 --- a/soc/nxp/imxrt/Kconfig.defconfig +++ b/soc/nxp/imxrt/Kconfig.defconfig @@ -95,7 +95,6 @@ if MBEDTLS # what the ztest_thread_stack defaults to. # config TEST_EXTRA_STACK_SIZE - int default 1024 endif # MBEDTLS diff --git a/soc/nxp/imxrt/imxrt5xx/Kconfig.defconfig b/soc/nxp/imxrt/imxrt5xx/Kconfig.defconfig index 3c803947269c4..dba7c8831fb75 100644 --- a/soc/nxp/imxrt/imxrt5xx/Kconfig.defconfig +++ b/soc/nxp/imxrt/imxrt5xx/Kconfig.defconfig @@ -30,7 +30,6 @@ if MBEDTLS # what the ztest_thread_stack defaults to. # config TEST_EXTRA_STACK_SIZE - int default 1024 endif # MBEDTLS diff --git a/soc/nxp/imxrt/imxrt6xx/Kconfig.defconfig b/soc/nxp/imxrt/imxrt6xx/Kconfig.defconfig index 9fb1afff72dd0..f934bd9136376 100644 --- a/soc/nxp/imxrt/imxrt6xx/Kconfig.defconfig +++ b/soc/nxp/imxrt/imxrt6xx/Kconfig.defconfig @@ -48,7 +48,6 @@ if MBEDTLS # what the ztest_thread_stack defaults to. # config TEST_EXTRA_STACK_SIZE - int default 1024 endif # MBEDTLS diff --git a/soc/nxp/layerscape/ls1046a/Kconfig.defconfig b/soc/nxp/layerscape/ls1046a/Kconfig.defconfig index f22b14b4e26c8..40ee8e44e67e4 100644 --- a/soc/nxp/layerscape/ls1046a/Kconfig.defconfig +++ b/soc/nxp/layerscape/ls1046a/Kconfig.defconfig @@ -7,7 +7,6 @@ if SOC_LS1046A config NUM_IRQS - int default 240 config FLASH_SIZE diff --git a/soc/rockchip/rk3399/Kconfig.defconfig.rk3399 b/soc/rockchip/rk3399/Kconfig.defconfig.rk3399 index 07751909f3209..9df2c38f1ccbd 100644 --- a/soc/rockchip/rk3399/Kconfig.defconfig.rk3399 +++ b/soc/rockchip/rk3399/Kconfig.defconfig.rk3399 @@ -7,7 +7,6 @@ if SOC_RK3399 config NUM_IRQS - int default 240 config FLASH_SIZE diff --git a/soc/rockchip/rk3568/Kconfig.defconfig.rk3568 b/soc/rockchip/rk3568/Kconfig.defconfig.rk3568 index 58cf932996f56..b59a8a2924995 100644 --- a/soc/rockchip/rk3568/Kconfig.defconfig.rk3568 +++ b/soc/rockchip/rk3568/Kconfig.defconfig.rk3568 @@ -11,11 +11,9 @@ config FLASH_BASE_ADDRESS default 0 config NUM_IRQS - int default 240 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 24000000 endif diff --git a/soc/silabs/silabs_s1/efm32gg11b/Kconfig.defconfig b/soc/silabs/silabs_s1/efm32gg11b/Kconfig.defconfig index 6f57e5c23a211..27946d0f1e9e7 100644 --- a/soc/silabs/silabs_s1/efm32gg11b/Kconfig.defconfig +++ b/soc/silabs/silabs_s1/efm32gg11b/Kconfig.defconfig @@ -5,7 +5,6 @@ if SOC_SERIES_EFM32GG11B config NUM_IRQS - int # must be >= the highest interrupt number used default 68 diff --git a/soc/silabs/silabs_s1/efm32gg12b/Kconfig.defconfig b/soc/silabs/silabs_s1/efm32gg12b/Kconfig.defconfig index 203f56e57b727..a2605d34b99c3 100644 --- a/soc/silabs/silabs_s1/efm32gg12b/Kconfig.defconfig +++ b/soc/silabs/silabs_s1/efm32gg12b/Kconfig.defconfig @@ -4,7 +4,6 @@ if SOC_SERIES_EFM32GG12B config NUM_IRQS - int # must be >= the highest interrupt number used default 68 diff --git a/soc/silabs/silabs_s2/efr32mg21/Kconfig.defconfig b/soc/silabs/silabs_s2/efr32mg21/Kconfig.defconfig index f7b286bd73baf..1bfda561e4ae4 100644 --- a/soc/silabs/silabs_s2/efr32mg21/Kconfig.defconfig +++ b/soc/silabs/silabs_s2/efr32mg21/Kconfig.defconfig @@ -4,7 +4,6 @@ if SOC_SERIES_EFR32MG21 config NUM_IRQS - int # must be >= the highest interrupt number used default 61 diff --git a/soc/silabs/silabs_sim3/sim3u/Kconfig.defconfig b/soc/silabs/silabs_sim3/sim3u/Kconfig.defconfig index 8091a25d3615b..67a086605c521 100644 --- a/soc/silabs/silabs_sim3/sim3u/Kconfig.defconfig +++ b/soc/silabs/silabs_sim3/sim3u/Kconfig.defconfig @@ -10,7 +10,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency) config NUM_IRQS - int # must be >= the highest interrupt number used default 53 diff --git a/soc/snps/qemu_arc/Kconfig.defconfig b/soc/snps/qemu_arc/Kconfig.defconfig index a8a7550ef5359..9ec43504cbf5c 100644 --- a/soc/snps/qemu_arc/Kconfig.defconfig +++ b/soc/snps/qemu_arc/Kconfig.defconfig @@ -4,7 +4,6 @@ if SOC_QEMU_ARC config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 10000000 config RGF_NUM_BANKS diff --git a/soc/st/stm32/stm32f1x/Kconfig.defconfig.stm32f105xx b/soc/st/stm32/stm32f1x/Kconfig.defconfig.stm32f105xx index ac031d653d144..796cb532ff274 100644 --- a/soc/st/stm32/stm32f1x/Kconfig.defconfig.stm32f105xx +++ b/soc/st/stm32/stm32f1x/Kconfig.defconfig.stm32f105xx @@ -6,7 +6,6 @@ if SOC_STM32F105XC || SOC_STM32F105XB config NUM_IRQS - int default 68 endif # SOC_STM32F105XC || STM32F105XB diff --git a/soc/st/stm32/stm32l1x/Kconfig.defconfig.stm32l152xc b/soc/st/stm32/stm32l1x/Kconfig.defconfig.stm32l152xc index 661ce869a45b0..b817d5a3c06ce 100644 --- a/soc/st/stm32/stm32l1x/Kconfig.defconfig.stm32l152xc +++ b/soc/st/stm32/stm32l1x/Kconfig.defconfig.stm32l152xc @@ -6,7 +6,6 @@ if SOC_STM32L152XC config NUM_IRQS - int default 57 endif # SOC_STM32L152XC diff --git a/soc/st/stm32/stm32l1x/Kconfig.defconfig.stm32l152xe b/soc/st/stm32/stm32l1x/Kconfig.defconfig.stm32l152xe index 604cad7aaf584..51197442f0421 100644 --- a/soc/st/stm32/stm32l1x/Kconfig.defconfig.stm32l152xe +++ b/soc/st/stm32/stm32l1x/Kconfig.defconfig.stm32l152xe @@ -6,7 +6,6 @@ if SOC_STM32L152XE config NUM_IRQS - int default 57 endif # SOC_STM32L152XE diff --git a/soc/telink/tlsr/tlsr951x/Kconfig.defconfig b/soc/telink/tlsr/tlsr951x/Kconfig.defconfig index 7ad94f134304e..6cd3c6a26b816 100644 --- a/soc/telink/tlsr/tlsr951x/Kconfig.defconfig +++ b/soc/telink/tlsr/tlsr951x/Kconfig.defconfig @@ -4,38 +4,30 @@ if SOC_SERIES_TLSR951X config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 32000 config RISCV_SOC_INTERRUPT_INIT - bool default y config RISCV_GP - bool default y config NUM_IRQS - int default 64 config PINCTRL default y config XIP - bool default n config MAIN_STACK_SIZE - int default 2048 config IDLE_STACK_SIZE - int default 1536 config TEST_EXTRA_STACK_SIZE - int default 1024 config 2ND_LVL_INTR_00_OFFSET diff --git a/soc/ti/k3/am6x/Kconfig.defconfig b/soc/ti/k3/am6x/Kconfig.defconfig index 3183487e2e375..f99a578996f9f 100644 --- a/soc/ti/k3/am6x/Kconfig.defconfig +++ b/soc/ti/k3/am6x/Kconfig.defconfig @@ -16,13 +16,11 @@ config FLASH_BASE_ADDRESS default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH)) config NUM_IRQS - int default 64 if SOC_SERIES_AM6X_M4 default 280 if SOC_SERIES_AM6X_A53 default 512 if SOC_SERIES_AM6X_R5 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 400000000 if SOC_SERIES_AM6X_M4 default 200000000 if SOC_SERIES_AM6X_A53 default 19200000 if SOC_SERIES_AM6X_R5 diff --git a/soc/xen/Kconfig.defconfig b/soc/xen/Kconfig.defconfig index eeb2cf9aa0e49..f0f76898426f4 100644 --- a/soc/xen/Kconfig.defconfig +++ b/soc/xen/Kconfig.defconfig @@ -4,11 +4,9 @@ if SOC_XENVM config NUM_IRQS - int default 500 config SYS_CLOCK_HW_CYCLES_PER_SEC - int default 8320000 # We need at least 16M of virtual address space to map memory of Xen node diff --git a/soc/xlnx/zynq7000/Kconfig.defconfig b/soc/xlnx/zynq7000/Kconfig.defconfig index f675bd07f32ae..b867109d35e53 100644 --- a/soc/xlnx/zynq7000/Kconfig.defconfig +++ b/soc/xlnx/zynq7000/Kconfig.defconfig @@ -8,7 +8,6 @@ if SOC_FAMILY_XILINX_ZYNQ7000 rsource "*/Kconfig.defconfig" config NUM_IRQS - int # must be >= the highest interrupt number used default 96 From 1f9baa3ac3838ce04ccc47b71fdec3267c569438 Mon Sep 17 00:00:00 2001 From: Ludvig Jordet Date: Thu, 14 Nov 2024 13:40:28 +0100 Subject: [PATCH 2699/4482] Bluetooth: Host: Refactor legacy adv creation This fixes #78721 which was introduced in PR #44686, which changed (and renamed) `adv_new_legacy`/`adv_get_legacy` to return an existing `bt_dev.adv` if it existed. This caused a problem, where the existing adv then would be used to start advertising, and if this fails (because the adv is already advertising, for instance), `bt_le_adv_start` would erroneously delete the adv, making the host lose the context for the adv which still is advertising. Before PR #44686, this would not happen, because `bt_le_adv_start` would return early when `adv_new_legacy` returned `NULL` and never reach the delete call. I have refactored this to make responsibilities a bit more clear: `adv_create_legacy` now does 1 thing: create an ext adv and assign as the legacy advertiser. This mirrors `bt_le_adv_delete_legacy` which does the opposite. I have implemented error codes to match the behavior that PR #44686 was made to implement. Signed-off-by: Ludvig Jordet --- subsys/bluetooth/host/adv.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/subsys/bluetooth/host/adv.c b/subsys/bluetooth/host/adv.c index 39b0a6beedb0f..423a88e4cf4e3 100644 --- a/subsys/bluetooth/host/adv.c +++ b/subsys/bluetooth/host/adv.c @@ -281,18 +281,19 @@ void bt_adv_reset_adv_pool(void) (void)memset(&bt_dev.adv, 0, sizeof(bt_dev.adv)); } -static struct bt_le_ext_adv *adv_get_legacy(void) +static int adv_create_legacy(void) { #if defined(CONFIG_BT_EXT_ADV) if (bt_dev.adv) { - return bt_dev.adv; + return -EALREADY; } bt_dev.adv = adv_new(); - return bt_dev.adv; -#else - return &bt_dev.adv; + if (bt_dev.adv == NULL) { + return -ENOMEM; + } #endif + return 0; } void bt_le_adv_delete_legacy(void) @@ -1363,13 +1364,16 @@ int bt_le_adv_start(const struct bt_le_adv_param *param, const struct bt_data *ad, size_t ad_len, const struct bt_data *sd, size_t sd_len) { - struct bt_le_ext_adv *adv = adv_get_legacy(); + struct bt_le_ext_adv *adv; int err; - if (!adv) { - return -ENOMEM; + err = adv_create_legacy(); + if (err) { + return err; } + adv = bt_le_adv_lookup_legacy(); + if (IS_ENABLED(CONFIG_BT_EXT_ADV) && BT_DEV_FEAT_LE_EXT_ADV(bt_dev.le.features)) { err = bt_le_adv_start_ext(adv, param, ad, ad_len, sd, sd_len); From eb249200936ccf780946db5d561e15290add5eab Mon Sep 17 00:00:00 2001 From: Franciszek Pindel Date: Thu, 14 Nov 2024 08:52:25 +0100 Subject: [PATCH 2700/4482] dts: x86: intel: alder_lake: Add second core Alder Lake have at least 2 cores. Both boards using this SoC (up_squared_pro_7000 and adl) are configured with MP_MAX_NUM_CPUS=2, so dts should contain at least one more core. Signed-off-by: Franciszek Pindel --- dts/x86/intel/alder_lake.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dts/x86/intel/alder_lake.dtsi b/dts/x86/intel/alder_lake.dtsi index 6f33e2a44d1bd..78df9c3cc52da 100644 --- a/dts/x86/intel/alder_lake.dtsi +++ b/dts/x86/intel/alder_lake.dtsi @@ -23,6 +23,13 @@ reg = <0>; }; + cpu@1 { + device_type = "cpu"; + compatible = "intel,alder-lake"; + d-cache-line-size = <64>; + reg = <1>; + }; + }; dram0: memory@0 { From 01f8e0fa2daa50ddd710300d769dc9ac9dfac681 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Tue, 12 Nov 2024 14:06:11 -0800 Subject: [PATCH 2701/4482] demand_paging: eviction: add kconfig CONFIG_EVICTION_TRACKING This adds a new kconfig for eviction algorithm which needs page tracking. When enabled, k_mem_paging_eviction_add()/_remove() and k_mem_paging_eviction_accessed() must be implemented. If an algorithm does not do page tracking, there is no need to implement these functions, and no need for the kernel MMU code to call into empty functions. This should save a few function calls and some CPU cycles. Note that arm64 unconditionally calls those functions so forces CONFIG_EVICTION_TRACKING to be enabled there. Signed-off-by: Daniel Leung --- arch/Kconfig | 8 +++++ .../memory_management/demand_paging.rst | 8 +++-- include/zephyr/kernel/mm/demand_paging.h | 21 +++++++++++ kernel/mmu.c | 35 +++++++++++++------ subsys/demand_paging/eviction/Kconfig | 10 ++++++ subsys/demand_paging/eviction/nru.c | 7 +++- 6 files changed, 75 insertions(+), 14 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index 355a6247af383..774840dda0f92 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -55,6 +55,8 @@ config ARM64 select ARCH_HAS_DIRECTED_IPIS select ARCH_HAS_DEMAND_PAGING select ARCH_HAS_DEMAND_MAPPING + select ARCH_SUPPORTS_EVICTION_TRACKING + select EVICTION_TRACKING if DEMAND_PAGING help ARM64 (AArch64) architecture @@ -694,6 +696,12 @@ config ARCH_SUPPORTS_ROM_START config ARCH_SUPPORTS_EMPTY_IRQ_SPURIOUS bool +config ARCH_SUPPORTS_EVICTION_TRACKING + bool + help + Architecture code supports page tracking for eviction algorithms + when demand paging is enabled. + config ARCH_HAS_EXTRA_EXCEPTION_INFO bool diff --git a/doc/kernel/memory_management/demand_paging.rst b/doc/kernel/memory_management/demand_paging.rst index db068397a1423..76e962bd8e8b0 100644 --- a/doc/kernel/memory_management/demand_paging.rst +++ b/doc/kernel/memory_management/demand_paging.rst @@ -156,8 +156,12 @@ Two eviction algorithms are currently available: to the NRU code but also considerably more efficient. This is recommended for production use. -To implement a new eviction algorithm, the five functions mentioned -above must be implemented. +To implement a new eviction algorithm, :c:func:`k_mem_paging_eviction_init()` +and :c:func:`k_mem_paging_eviction_select()` must be implemented. +If :kconfig:option:`CONFIG_EVICTION_TRACKING` is enabled for an algorithm, +these additional functions must also be implemented, +:c:func:`k_mem_paging_eviction_add()`, :c:func:`k_mem_paging_eviction_remove()`, +:c:func:`k_mem_paging_eviction_accessed()`. Backing Store ************* diff --git a/include/zephyr/kernel/mm/demand_paging.h b/include/zephyr/kernel/mm/demand_paging.h index 120ee3299a349..10a2e7918acec 100644 --- a/include/zephyr/kernel/mm/demand_paging.h +++ b/include/zephyr/kernel/mm/demand_paging.h @@ -217,6 +217,8 @@ __syscall void k_mem_paging_histogram_backing_store_page_out_get( * @{ */ +#if defined(CONFIG_EVICTION_TRACKING) || defined(__DOXYGEN__) + /** * Submit a page frame for eviction candidate tracking * @@ -261,6 +263,25 @@ void k_mem_paging_eviction_remove(struct k_mem_page_frame *pf); */ void k_mem_paging_eviction_accessed(uintptr_t phys); +#else /* CONFIG_EVICTION_TRACKING || __DOXYGEN__ */ + +static inline void k_mem_paging_eviction_add(struct k_mem_page_frame *pf) +{ + ARG_UNUSED(pf); +} + +static inline void k_mem_paging_eviction_remove(struct k_mem_page_frame *pf) +{ + ARG_UNUSED(pf); +} + +static inline void k_mem_paging_eviction_accessed(uintptr_t phys) +{ + ARG_UNUSED(phys); +} + +#endif /* CONFIG_EVICTION_TRACKING || __DOXYGEN__ */ + /** * Select a page frame for eviction * diff --git a/kernel/mmu.c b/kernel/mmu.c index b03ff978786a4..788f30ff730ef 100644 --- a/kernel/mmu.c +++ b/kernel/mmu.c @@ -556,7 +556,7 @@ static int map_anon_page(void *addr, uint32_t flags) } frame_mapped_set(pf, addr); #ifdef CONFIG_DEMAND_PAGING - if (!lock) { + if (IS_ENABLED(CONFIG_EVICTION_TRACKING) && (!lock)) { k_mem_paging_eviction_add(pf); } #endif @@ -784,7 +784,8 @@ void k_mem_unmap_phys_guard(void *addr, size_t size, bool is_anon) arch_mem_unmap(pos, CONFIG_MMU_PAGE_SIZE); #ifdef CONFIG_DEMAND_PAGING - if (!k_mem_page_frame_is_pinned(pf)) { + if (IS_ENABLED(CONFIG_EVICTION_TRACKING) && + (!k_mem_page_frame_is_pinned(pf))) { k_mem_paging_eviction_remove(pf); } #endif @@ -1041,7 +1042,8 @@ static void mark_linker_section_pinned(void *start_addr, void *end_addr, } else { k_mem_page_frame_clear(pf, K_MEM_PAGE_FRAME_PINNED); #ifdef CONFIG_DEMAND_PAGING - if (k_mem_page_frame_is_evictable(pf)) { + if (IS_ENABLED(CONFIG_EVICTION_TRACKING) && + k_mem_page_frame_is_evictable(pf)) { k_mem_paging_eviction_add(pf); } #endif @@ -1147,10 +1149,13 @@ void z_mem_manage_init(void) #endif /* CONFIG_DEMAND_PAGING_TIMING_HISTOGRAM */ k_mem_paging_backing_store_init(); k_mem_paging_eviction_init(); - /* start tracking evictable page installed above if any */ - K_MEM_PAGE_FRAME_FOREACH(phys, pf) { - if (k_mem_page_frame_is_evictable(pf)) { - k_mem_paging_eviction_add(pf); + + if (IS_ENABLED(CONFIG_EVICTION_TRACKING)) { + /* start tracking evictable page installed above if any */ + K_MEM_PAGE_FRAME_FOREACH(phys, pf) { + if (k_mem_page_frame_is_evictable(pf)) { + k_mem_paging_eviction_add(pf); + } } } #endif /* CONFIG_DEMAND_PAGING */ @@ -1347,7 +1352,10 @@ static int page_frame_prepare_locked(struct k_mem_page_frame *pf, bool *dirty_pt return -ENOMEM; } arch_mem_page_out(k_mem_page_frame_to_virt(pf), *location_ptr); - k_mem_paging_eviction_remove(pf); + + if (IS_ENABLED(CONFIG_EVICTION_TRACKING)) { + k_mem_paging_eviction_remove(pf); + } } else { /* Shouldn't happen unless this function is mis-used */ __ASSERT(!dirty, "un-mapped page determined to be dirty"); @@ -1683,7 +1691,9 @@ static bool do_page_fault(void *addr, bool pin) pf = k_mem_phys_to_page_frame(phys); if (!k_mem_page_frame_is_pinned(pf)) { - k_mem_paging_eviction_remove(pf); + if (IS_ENABLED(CONFIG_EVICTION_TRACKING)) { + k_mem_paging_eviction_remove(pf); + } k_mem_page_frame_set(pf, K_MEM_PAGE_FRAME_PINNED); } } @@ -1738,7 +1748,7 @@ static bool do_page_fault(void *addr, bool pin) arch_mem_page_in(addr, k_mem_page_frame_to_phys(pf)); k_mem_paging_backing_store_page_finalize(pf, page_in_location); - if (!pin) { + if (IS_ENABLED(CONFIG_EVICTION_TRACKING) && (!pin)) { k_mem_paging_eviction_add(pf); } out: @@ -1807,7 +1817,10 @@ static void do_mem_unpin(void *addr) pf = k_mem_phys_to_page_frame(phys); if (k_mem_page_frame_is_pinned(pf)) { k_mem_page_frame_clear(pf, K_MEM_PAGE_FRAME_PINNED); - k_mem_paging_eviction_add(pf); + + if (IS_ENABLED(CONFIG_EVICTION_TRACKING)) { + k_mem_paging_eviction_add(pf); + } } } k_spin_unlock(&z_mm_lock, key); diff --git a/subsys/demand_paging/eviction/Kconfig b/subsys/demand_paging/eviction/Kconfig index 3d4044b1fff35..d920f814a0e93 100644 --- a/subsys/demand_paging/eviction/Kconfig +++ b/subsys/demand_paging/eviction/Kconfig @@ -11,6 +11,7 @@ choice EVICTION_CHOICE config EVICTION_CUSTOM bool "Custom eviction algorithm" + imply EVICTION_TRACKING help This option is chosen when the eviction algorithm will be implemented by the application, instead of using one included in Zephyr. @@ -30,6 +31,7 @@ config EVICTION_NRU config EVICTION_LRU bool "Least Recently Used (LRU) page eviction algorithm" + select EVICTION_TRACKING help This implements a Least Recently Used page eviction algorithm. Usage is tracked based on MMU protection making pages unaccessible @@ -49,3 +51,11 @@ config EVICTION_NRU_PERIOD pages that are capable of being paged out. At eviction time, if a page still has the accessed property, it will be considered as recently used. endif # EVICTION_NRU + +config EVICTION_TRACKING + bool + depends on ARCH_SUPPORTS_EVICTION_TRACKING + help + Selected by eviction algorithms which needs page tracking and need to + implement the following functions: k_mem_paging_eviction_add(), + k_mem_paging_eviction_remove() and k_mem_paging_eviction_accessed(). diff --git a/subsys/demand_paging/eviction/nru.c b/subsys/demand_paging/eviction/nru.c index 2fd92ccb884a2..246d2d12300ce 100644 --- a/subsys/demand_paging/eviction/nru.c +++ b/subsys/demand_paging/eviction/nru.c @@ -111,8 +111,11 @@ void k_mem_paging_eviction_init(void) K_MSEC(CONFIG_EVICTION_NRU_PERIOD)); } +#ifdef CONFIG_EVICTION_TRACKING /* - * unused interfaces + * Empty functions defined here so that architectures unconditionally + * implement eviction tracking can still use this algorithm for + * testing. */ void k_mem_paging_eviction_add(struct k_mem_page_frame *pf) @@ -129,3 +132,5 @@ void k_mem_paging_eviction_accessed(uintptr_t phys) { ARG_UNUSED(phys); } + +#endif /* CONFIG_EVICTION_TRACKING */ From 8ac483fdd4da0cc36985dad45c46504d086d0e08 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Sun, 10 Nov 2024 09:23:26 -0500 Subject: [PATCH 2702/4482] scripts: west_commands: core: run netcat with check_call() Netcat (nc) does not handle SIGINT. It silently ignores it. We cannot use run_client(), given that the pydoc for run_client() specifically contains "Run a client that handles SIGINT". Instead, use check_call(), which correctly handles Ctrl+C. Signed-off-by: Chris Friedt --- scripts/west_commands/runners/core.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/west_commands/runners/core.py b/scripts/west_commands/runners/core.py index db5408c8f5164..69491f1990df0 100644 --- a/scripts/west_commands/runners/core.py +++ b/scripts/west_commands/runners/core.py @@ -923,7 +923,8 @@ def run_telnet_client(self, host: str, port: int) -> None: # CONFIG_SHELL_VT100_COMMANDS etc. if shutil.which('nc') is not None: client_cmd = ['nc', host, str(port)] - self.run_client(client_cmd) + # Note: netcat (nc) does not handle sigint, so cannot use run_client() + self.check_call(client_cmd) return # Otherwise, use a pure python implementation. This will work well for logging, From ded2e0ba4ab89cdfb4b48b7dcd9578cd6edb9252 Mon Sep 17 00:00:00 2001 From: David Schneider Date: Wed, 13 Nov 2024 16:33:16 +0100 Subject: [PATCH 2703/4482] drivers: udc_stm32: set address only for standard device requests Any request 5 did set the address even if it's a non standard request like vendor specific requests. Signed-off-by: David Schneider --- drivers/usb/udc/udc_stm32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/udc/udc_stm32.c b/drivers/usb/udc/udc_stm32.c index 845f461ea96d9..627d229975600 100644 --- a/drivers/usb/udc/udc_stm32.c +++ b/drivers/usb/udc/udc_stm32.c @@ -168,7 +168,8 @@ void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd) return; } - if (setup->bRequest == USB_SREQ_SET_ADDRESS) { + if ((setup->bmRequestType == 0) && + (setup->bRequest == USB_SREQ_SET_ADDRESS)) { /* HAL requires we set the address before submitting status */ HAL_PCD_SetAddress(&priv->pcd, setup->wValue); } From 3eae0201c8de0f9b91d1df016319464c2b418b5f Mon Sep 17 00:00:00 2001 From: Martin Stumpf Date: Sat, 9 Nov 2024 10:24:31 +0100 Subject: [PATCH 2704/4482] samples: modules: lvgl: add `screen_transparency` sample Adds a sample that renders the simple `hello world` LVGL demo with a transparent background, to demonstrate ARGB8888 framebuffer capabilities. Signed-off-by: Martin Stumpf --- .../lvgl/screen_transparency/CMakeLists.txt | 9 +++ .../modules/lvgl/screen_transparency/Kconfig | 4 + .../lvgl/screen_transparency/README.rst | 30 ++++++++ .../modules/lvgl/screen_transparency/prj.conf | 9 +++ .../lvgl/screen_transparency/sample.yaml | 18 +++++ .../lvgl/screen_transparency/src/main.c | 73 +++++++++++++++++++ 6 files changed, 143 insertions(+) create mode 100644 samples/modules/lvgl/screen_transparency/CMakeLists.txt create mode 100644 samples/modules/lvgl/screen_transparency/Kconfig create mode 100644 samples/modules/lvgl/screen_transparency/README.rst create mode 100644 samples/modules/lvgl/screen_transparency/prj.conf create mode 100644 samples/modules/lvgl/screen_transparency/sample.yaml create mode 100644 samples/modules/lvgl/screen_transparency/src/main.c diff --git a/samples/modules/lvgl/screen_transparency/CMakeLists.txt b/samples/modules/lvgl/screen_transparency/CMakeLists.txt new file mode 100644 index 0000000000000..eb9fd20c1c157 --- /dev/null +++ b/samples/modules/lvgl/screen_transparency/CMakeLists.txt @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(screen_transparency) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/modules/lvgl/screen_transparency/Kconfig b/samples/modules/lvgl/screen_transparency/Kconfig new file mode 100644 index 0000000000000..0229ee90c8965 --- /dev/null +++ b/samples/modules/lvgl/screen_transparency/Kconfig @@ -0,0 +1,4 @@ +# Copyright (c) 2024 Martin Stumpf +# SPDX-License-Identifier: Apache-2.0 + +source "Kconfig.zephyr" diff --git a/samples/modules/lvgl/screen_transparency/README.rst b/samples/modules/lvgl/screen_transparency/README.rst new file mode 100644 index 0000000000000..fdfd80478d23c --- /dev/null +++ b/samples/modules/lvgl/screen_transparency/README.rst @@ -0,0 +1,30 @@ +.. zephyr:code-sample:: lvgl-screen-transparency + :name: LVGL screen transparency + :relevant-api: display_interface + + Rendering to screens with transparency support using LVGL. + +Overview +******** + +A sample application that demonstrates how to use LVGL to render to +screens that support transparency, like OSD overlays. + +Requirements +************ + +* A board with a display that supports ``ARGB8888`` color. + +.. _lvgl_screen_transparency_building_and_running: + +Building and Running +******************** + +The demo can be built as follows: + +.. zephyr-app-commands:: + :zephyr-app: samples/modules/lvgl/screen_transparency + :host-os: unix + :board: native_sim + :goals: run + :compact: diff --git a/samples/modules/lvgl/screen_transparency/prj.conf b/samples/modules/lvgl/screen_transparency/prj.conf new file mode 100644 index 0000000000000..7c857deba03f5 --- /dev/null +++ b/samples/modules/lvgl/screen_transparency/prj.conf @@ -0,0 +1,9 @@ +CONFIG_MAIN_STACK_SIZE=4096 +CONFIG_LOG=y + +CONFIG_LVGL=y +CONFIG_LV_Z_MEM_POOL_SIZE=16384 +CONFIG_LV_COLOR_DEPTH_32=y +CONFIG_LV_COLOR_SCREEN_TRANSP=y + +CONFIG_DISPLAY=y diff --git a/samples/modules/lvgl/screen_transparency/sample.yaml b/samples/modules/lvgl/screen_transparency/sample.yaml new file mode 100644 index 0000000000000..9f4f571868a77 --- /dev/null +++ b/samples/modules/lvgl/screen_transparency/sample.yaml @@ -0,0 +1,18 @@ +sample: + description: Demonstrating Screen Transparency using LVGL + name: LVGL screen transparency +tests: + sample.modules.lvgl.screen_transparency: + filter: dt_chosen_enabled("zephyr,display") + min_flash: 250 + min_ram: 32 + harness: none + tags: + - samples + - display + - gui + - lvgl + modules: + - lvgl + integration_platforms: + - native_sim/native/64 diff --git a/samples/modules/lvgl/screen_transparency/src/main.c b/samples/modules/lvgl/screen_transparency/src/main.c new file mode 100644 index 0000000000000..64494ffdaed18 --- /dev/null +++ b/samples/modules/lvgl/screen_transparency/src/main.c @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2024 Martin Stumpf + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#include +#include +#include +#include + +#include +LOG_MODULE_REGISTER(app, CONFIG_LOG_DEFAULT_LEVEL); + +static void initialize_gui(void) +{ + lv_obj_t *label; + + /* Configure screen and background for transparency */ + lv_obj_set_style_bg_opa(lv_scr_act(), LV_OPA_TRANSP, LV_PART_MAIN); + lv_disp_set_bg_opa(NULL, LV_OPA_TRANSP); + lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0x000000), LV_PART_MAIN); + + /* Create a label, set its text and align it to the center */ + label = lv_label_create(lv_scr_act()); + lv_label_set_text(label, "Hello, world!"); + lv_obj_set_style_text_color(lv_scr_act(), lv_color_hex(0xff00ff), LV_PART_MAIN); + lv_obj_align(label, LV_ALIGN_CENTER, 0, 0); +} + +int main(void) +{ + int err; + const struct device *display_dev; + struct display_capabilities display_caps; + + display_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_display)); + if (!device_is_ready(display_dev)) { + LOG_ERR("Device not ready, aborting test"); + return -ENODEV; + } + + display_get_capabilities(display_dev, &display_caps); + if (!(display_caps.supported_pixel_formats | PIXEL_FORMAT_ARGB_8888)) { + LOG_ERR("Display does not support ARGB8888 mode"); + return -ENOTSUP; + } + + if (PIXEL_FORMAT_ARGB_8888 != display_caps.current_pixel_format) { + err = display_set_pixel_format(display_dev, PIXEL_FORMAT_ARGB_8888); + if (err != 0) { + LOG_ERR("Failed to set ARGB8888 pixel format"); + return err; + } + } + + initialize_gui(); + + lv_task_handler(); + display_blanking_off(display_dev); + + while (1) { + uint32_t sleep_ms = lv_task_handler(); + + k_msleep(MIN(sleep_ms, INT32_MAX)); + } + + return 0; +} From 86a126dba4ed5c722ea815dc5fe44009426f82f5 Mon Sep 17 00:00:00 2001 From: Martin Stumpf Date: Sun, 10 Nov 2024 10:16:05 +0100 Subject: [PATCH 2705/4482] samples: modules: lvgl: fix integer overflow `lv_task_handler()` returns a `uint32_t`, but `k_msleep` takes a `int32_t`. If no timer exists, `lv_task_handler()` returns `UINT32_MAX` to indicate that we should wait forever. However, this gets auto-cast to `-1`, indicating to `k_msleep` to not wait at all, creating a busy loop. Hence, a clamping to `[0, INT32_MAX]` is required. Signed-off-by: Martin Stumpf --- samples/modules/lvgl/accelerometer_chart/src/main.c | 4 +++- samples/modules/lvgl/demos/src/main.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/samples/modules/lvgl/accelerometer_chart/src/main.c b/samples/modules/lvgl/accelerometer_chart/src/main.c index 2aaee9fad0d43..937f4690e79fe 100644 --- a/samples/modules/lvgl/accelerometer_chart/src/main.c +++ b/samples/modules/lvgl/accelerometer_chart/src/main.c @@ -89,7 +89,9 @@ int main(void) display_blanking_off(display_dev); while (1) { - k_msleep(lv_task_handler()); + uint32_t sleep_ms = lv_task_handler(); + + k_msleep(MIN(sleep_ms, INT32_MAX)); } return 0; diff --git a/samples/modules/lvgl/demos/src/main.c b/samples/modules/lvgl/demos/src/main.c index 2e3785d82984a..8aa2ffa3aed85 100644 --- a/samples/modules/lvgl/demos/src/main.c +++ b/samples/modules/lvgl/demos/src/main.c @@ -40,7 +40,9 @@ int main(void) display_blanking_off(display_dev); while (1) { - k_msleep(lv_task_handler()); + uint32_t sleep_ms = lv_task_handler(); + + k_msleep(MIN(sleep_ms, INT32_MAX)); } return 0; From 02d562e9b846b9d4ee18d0e9dfe81b79f2384688 Mon Sep 17 00:00:00 2001 From: Martin Stumpf Date: Sun, 10 Nov 2024 09:49:32 +0100 Subject: [PATCH 2706/4482] drivers: display_sdl: add alpha support While the driver was already capable of processing `ARGB8888` data, it did not actually show the alpha value in any way. This change adds a checkerboard background that shows transparent regions. Signed-off-by: Martin Stumpf --- drivers/display/Kconfig.sdl | 18 ++++++++++ drivers/display/display_sdl.c | 15 +++++--- drivers/display/display_sdl_bottom.c | 52 +++++++++++++++++++++++++--- drivers/display/display_sdl_bottom.h | 11 +++--- 4 files changed, 84 insertions(+), 12 deletions(-) diff --git a/drivers/display/Kconfig.sdl b/drivers/display/Kconfig.sdl index bfa1f07c48e3b..d1ed25bf53750 100644 --- a/drivers/display/Kconfig.sdl +++ b/drivers/display/Kconfig.sdl @@ -59,4 +59,22 @@ config SDL_DISPLAY_MONO_MSB_FIRST If selected, set the MSB to represent the first pixel. This applies when the pixel format is MONO01/MONO10. +config SDL_DISPLAY_TRANSPARENCY_GRID_CELL_SIZE + int "Transparency grid cell size" + default 8 + help + The size of the checkerboard pattern squares, in pixels. + +config SDL_DISPLAY_TRANSPARENCY_GRID_CELL_COLOR_1 + hex "Transparency grid cell color 1" + default 0xcccccc + help + The color of the odd cells in the transparency grid. + +config SDL_DISPLAY_TRANSPARENCY_GRID_CELL_COLOR_2 + hex "Transparency grid cell color 2" + default 0xbbbbbb + help + The color of the even cells in the transparency grid. + endif # SDL_DISPLAY diff --git a/drivers/display/display_sdl.c b/drivers/display/display_sdl.c index 2c88e16bd7514..799bf6bb564b6 100644 --- a/drivers/display/display_sdl.c +++ b/drivers/display/display_sdl.c @@ -33,6 +33,7 @@ struct sdl_display_data { void *mutex; void *texture; void *read_texture; + void *background_texture; bool display_on; enum display_pixel_format current_pixel_format; uint8_t *buf; @@ -80,7 +81,10 @@ static int sdl_display_init(const struct device *dev) int rc = sdl_display_init_bottom(config->height, config->width, sdl_display_zoom_pct, use_accelerator, &disp_data->window, &disp_data->renderer, &disp_data->mutex, &disp_data->texture, - &disp_data->read_texture); + &disp_data->read_texture, &disp_data->background_texture, + CONFIG_SDL_DISPLAY_TRANSPARENCY_GRID_CELL_COLOR_1, + CONFIG_SDL_DISPLAY_TRANSPARENCY_GRID_CELL_COLOR_2, + CONFIG_SDL_DISPLAY_TRANSPARENCY_GRID_CELL_SIZE); if (rc != 0) { LOG_ERR("Failed to create SDL display"); @@ -261,7 +265,8 @@ static int sdl_display_write(const struct device *dev, const uint16_t x, } sdl_display_write_bottom(desc->height, desc->width, x, y, disp_data->renderer, - disp_data->mutex, disp_data->texture, disp_data->buf, + disp_data->mutex, disp_data->texture, + disp_data->background_texture, disp_data->buf, disp_data->display_on, desc->frame_incomplete); return 0; @@ -431,7 +436,8 @@ static int sdl_display_blanking_off(const struct device *dev) disp_data->display_on = true; - sdl_display_blanking_off_bottom(disp_data->renderer, disp_data->texture); + sdl_display_blanking_off_bottom(disp_data->renderer, disp_data->texture, + disp_data->background_texture); return 0; } @@ -491,7 +497,8 @@ static int sdl_display_set_pixel_format(const struct device *dev, static void sdl_display_cleanup(struct sdl_display_data *disp_data) { sdl_display_cleanup_bottom(&disp_data->window, &disp_data->renderer, &disp_data->mutex, - &disp_data->texture, &disp_data->read_texture); + &disp_data->texture, &disp_data->read_texture, + &disp_data->background_texture); } static const struct display_driver_api sdl_display_api = { diff --git a/drivers/display/display_sdl_bottom.c b/drivers/display/display_sdl_bottom.c index e0fbd4a5fbb5f..e7b259cda095b 100644 --- a/drivers/display/display_sdl_bottom.c +++ b/drivers/display/display_sdl_bottom.c @@ -15,7 +15,9 @@ int sdl_display_init_bottom(uint16_t height, uint16_t width, uint16_t zoom_pct, bool use_accelerator, void **window, void **renderer, void **mutex, - void **texture, void **read_texture) + void **texture, void **read_texture, void **background_texture, + uint32_t transparency_grid_color1, uint32_t transparency_grid_color2, + uint16_t transparency_grid_cell_size) { *window = SDL_CreateWindow("Zephyr Display", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width * zoom_pct / 100, @@ -51,6 +53,7 @@ int sdl_display_init_bottom(uint16_t height, uint16_t width, uint16_t zoom_pct, nsi_print_warning("Failed to create SDL texture: %s", SDL_GetError()); return -1; } + SDL_SetTextureBlendMode(*texture, SDL_BLENDMODE_BLEND); *read_texture = SDL_CreateTexture(*renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, width, height); @@ -59,8 +62,41 @@ int sdl_display_init_bottom(uint16_t height, uint16_t width, uint16_t zoom_pct, return -1; } + *background_texture = SDL_CreateTexture(*renderer, SDL_PIXELFORMAT_ARGB8888, + SDL_TEXTUREACCESS_STREAMING, width, height); + if (*background_texture == NULL) { + nsi_print_warning("Failed to create SDL texture: %s", SDL_GetError()); + return -1; + } + + void *background_data; + int background_pitch; + int err; + + err = SDL_LockTexture(*background_texture, NULL, &background_data, &background_pitch); + if (err != 0) { + nsi_print_warning("Failed to lock background texture: %d", err); + return -1; + } + for (int y = 0; y < height; y++) { + uint32_t *row = (uint32_t *)((uint8_t *)background_data + background_pitch * y); + + for (int x = 0; x < width; x++) { + bool x_cell_even = ((x / transparency_grid_cell_size) % 2) == 0; + bool y_cell_even = ((y / transparency_grid_cell_size) % 2) == 0; + + if (x_cell_even == y_cell_even) { + row[x] = transparency_grid_color1 | 0xff000000; + } else { + row[x] = transparency_grid_color2 | 0xff000000; + } + } + } + SDL_UnlockTexture(*background_texture); + SDL_SetRenderDrawColor(*renderer, 0, 0, 0, 0xFF); SDL_RenderClear(*renderer); + SDL_RenderCopy(*renderer, *background_texture, NULL, NULL); SDL_RenderPresent(*renderer); return 0; @@ -68,7 +104,8 @@ int sdl_display_init_bottom(uint16_t height, uint16_t width, uint16_t zoom_pct, void sdl_display_write_bottom(const uint16_t height, const uint16_t width, const uint16_t x, const uint16_t y, void *renderer, void *mutex, void *texture, - uint8_t *buf, bool display_on, bool frame_incomplete) + void *background_texture, uint8_t *buf, bool display_on, + bool frame_incomplete) { SDL_Rect rect; int err; @@ -88,6 +125,7 @@ void sdl_display_write_bottom(const uint16_t height, const uint16_t width, const if (display_on && !frame_incomplete) { SDL_RenderClear(renderer); + SDL_RenderCopy(renderer, background_texture, NULL, NULL); SDL_RenderCopy(renderer, texture, NULL, NULL); SDL_RenderPresent(renderer); } @@ -127,9 +165,10 @@ int sdl_display_read_bottom(const uint16_t height, const uint16_t width, return err; } -void sdl_display_blanking_off_bottom(void *renderer, void *texture) +void sdl_display_blanking_off_bottom(void *renderer, void *texture, void *background_texture) { SDL_RenderClear(renderer); + SDL_RenderCopy(renderer, background_texture, NULL, NULL); SDL_RenderCopy(renderer, texture, NULL, NULL); SDL_RenderPresent(renderer); } @@ -141,8 +180,13 @@ void sdl_display_blanking_on_bottom(void *renderer) } void sdl_display_cleanup_bottom(void **window, void **renderer, void **mutex, void **texture, - void **read_texture) + void **read_texture, void **background_texture) { + if (*background_texture != NULL) { + SDL_DestroyTexture(*background_texture); + *background_texture = NULL; + } + if (*read_texture != NULL) { SDL_DestroyTexture(*read_texture); *read_texture = NULL; diff --git a/drivers/display/display_sdl_bottom.h b/drivers/display/display_sdl_bottom.h index 721cfa2b5a81e..16a6a2ce603f3 100644 --- a/drivers/display/display_sdl_bottom.h +++ b/drivers/display/display_sdl_bottom.h @@ -22,17 +22,20 @@ extern "C" { int sdl_display_init_bottom(uint16_t height, uint16_t width, uint16_t zoom_pct, bool use_accelerator, void **window, void **renderer, void **mutex, - void **texture, void **read_texture); + void **texture, void **read_texture, void **background_texture, + uint32_t transparency_grid_color1, uint32_t transparency_grid_color2, + uint16_t transparency_grid_cell_size); void sdl_display_write_bottom(const uint16_t height, const uint16_t width, const uint16_t x, const uint16_t y, void *renderer, void *mutex, void *texture, - uint8_t *buf, bool display_on, bool frame_incomplete); + void *background_texture, uint8_t *buf, bool display_on, + bool frame_incomplete); int sdl_display_read_bottom(const uint16_t height, const uint16_t width, const uint16_t x, const uint16_t y, void *renderer, void *buf, uint16_t pitch, void *mutex, void *texture, void *read_texture); -void sdl_display_blanking_off_bottom(void *renderer, void *texture); +void sdl_display_blanking_off_bottom(void *renderer, void *texture, void *background_texture); void sdl_display_blanking_on_bottom(void *renderer); void sdl_display_cleanup_bottom(void **window, void **renderer, void **mutex, void **texture, - void **read_texture); + void **read_texture, void **background_texture); #ifdef __cplusplus } From b816a2926dac45efa4445a7134a79e0bcc042e16 Mon Sep 17 00:00:00 2001 From: Martin Stumpf Date: Sun, 10 Nov 2024 10:55:30 +0100 Subject: [PATCH 2707/4482] drivers: display_sdl: fix incorrect color conversion Non-alpha colors were converted to colors with `0x00` alpha, which makes them fully transparent. The correct way would be to add a `0xff` alpha, which this change does. Signed-off-by: Martin Stumpf --- drivers/display/display_sdl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/display/display_sdl.c b/drivers/display/display_sdl.c index 799bf6bb564b6..125c5624ef02e 100644 --- a/drivers/display/display_sdl.c +++ b/drivers/display/display_sdl.c @@ -123,7 +123,7 @@ static void sdl_display_write_rgb888(uint8_t *disp_buf, pixel = *byte_ptr << 16; pixel |= *(byte_ptr + 1) << 8; pixel |= *(byte_ptr + 2); - *((uint32_t *)disp_buf) = pixel; + *((uint32_t *)disp_buf) = pixel | 0xFF000000; disp_buf += 4; } } @@ -149,7 +149,7 @@ static void sdl_display_write_rgb565(uint8_t *disp_buf, pixel = (((rgb565 >> 11) & 0x1F) * 255 / 31) << 16; pixel |= (((rgb565 >> 5) & 0x3F) * 255 / 63) << 8; pixel |= (rgb565 & 0x1F) * 255 / 31; - *((uint32_t *)disp_buf) = pixel; + *((uint32_t *)disp_buf) = pixel | 0xFF000000; disp_buf += 4; } } @@ -173,7 +173,7 @@ static void sdl_display_write_bgr565(uint8_t *disp_buf, pixel = (((*pix_ptr >> 11) & 0x1F) * 255 / 31) << 16; pixel |= (((*pix_ptr >> 5) & 0x3F) * 255 / 63) << 8; pixel |= (*pix_ptr & 0x1F) * 255 / 31; - *((uint32_t *)disp_buf) = pixel; + *((uint32_t *)disp_buf) = pixel | 0xFF000000; disp_buf += 4; } } @@ -211,9 +211,9 @@ static void sdl_display_write_mono(uint8_t *disp_buf, if ((*byte_ptr & mono_pixel_order(h_idx)) != 0U) { pixel = one_color; } else { - pixel = (~one_color) & 0x00FFFFFF; + pixel = ~one_color; } - *((uint32_t *)disp_buf) = pixel; + *((uint32_t *)disp_buf) = pixel | 0xFF000000; disp_buf += (desc->width * 4U); } disp_buf = disp_buf_start; From 7c24bd852006fae5f553905d497df414726c9e50 Mon Sep 17 00:00:00 2001 From: Martin Stumpf Date: Sun, 10 Nov 2024 11:31:35 +0100 Subject: [PATCH 2708/4482] samples: drivers: display: adjust alpha handling ARGB8888 values all had alpha '0x00' (=transparent). Changed them to '0xFF' and added a transparency test patch in the middle of the screen. Signed-off-by: Martin Stumpf --- samples/drivers/display/src/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/samples/drivers/display/src/main.c b/samples/drivers/display/src/main.c index 8cbfb64040ac1..09c8f86acd49a 100644 --- a/samples/drivers/display/src/main.c +++ b/samples/drivers/display/src/main.c @@ -50,16 +50,16 @@ static void fill_buffer_argb8888(enum corner corner, uint8_t grey, uint8_t *buf, switch (corner) { case TOP_LEFT: - color = 0x00FF0000u; + color = 0xFFFF0000u; break; case TOP_RIGHT: - color = 0x0000FF00u; + color = 0xFF00FF00u; break; case BOTTOM_RIGHT: - color = 0x000000FFu; + color = 0xFF0000FFu; break; case BOTTOM_LEFT: - color = grey << 16 | grey << 8 | grey; + color = 0xFF000000u | grey << 16 | grey << 8 | grey; break; } @@ -239,7 +239,7 @@ int main(void) switch (capabilities.current_pixel_format) { case PIXEL_FORMAT_ARGB_8888: - bg_color = 0xFFu; + bg_color = 0x00u; fill_buffer_fnc = fill_buffer_argb8888; buf_size *= 4; break; From 5d4f4acc7d6d065ea843186408f4458c0b1ee12e Mon Sep 17 00:00:00 2001 From: Martin Stumpf Date: Sun, 10 Nov 2024 13:50:18 +0100 Subject: [PATCH 2709/4482] docs: add release notes for #81184 Added release notes for PR #81184. Signed-off-by: Martin Stumpf --- doc/releases/release-notes-4.1.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/releases/release-notes-4.1.rst b/doc/releases/release-notes-4.1.rst index 2e734c7f8197b..40b3dfedfed5a 100644 --- a/doc/releases/release-notes-4.1.rst +++ b/doc/releases/release-notes-4.1.rst @@ -97,6 +97,7 @@ Drivers and Sensors signal handling (:github:`81250`) * Added ``frame_incomplete`` handling to SDL display driver (:dtcompatible:`zephyr,sdl-dc`) (:github:`81250`) + * Added transparency support to SDL display driver (:dtcompatible:`zephyr,sdl-dc`) (:github:`81184`) * Ethernet @@ -292,6 +293,9 @@ LVGL Tests and Samples ***************** +* Fixed incorrect alpha values in :zephyr_file:`samples/drivers/display`. (:github:`81184`) +* Added :zephyr_file:`samples/modules/lvgl/screen_transparency`. (:github:`81184`) + Issue Related Items ******************* From c7a592b3e09b50ff1e8fe49643a38018eb4ffae9 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Sat, 2 Nov 2024 23:33:37 -0300 Subject: [PATCH 2710/4482] soc: esp32c6: add Wi-Fi support Enables Wi-Fi support. Signed-off-by: Sylvio Alves --- boards/espressif/esp32c6_devkitc/doc/index.rst | 2 ++ drivers/clock_control/clock_control_esp32.c | 15 +++++++++++++++ dts/riscv/espressif/esp32c6/esp32c6_common.dtsi | 5 +++++ samples/net/wifi/shell/socs/esp32c6.conf | 11 +++++++++++ samples/net/wifi/shell/socs/esp32c6.overlay | 9 +++++++++ soc/espressif/esp32c6/default.ld | 9 +++++---- west.yml | 2 +- 7 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 samples/net/wifi/shell/socs/esp32c6.conf create mode 100644 samples/net/wifi/shell/socs/esp32c6.overlay diff --git a/boards/espressif/esp32c6_devkitc/doc/index.rst b/boards/espressif/esp32c6_devkitc/doc/index.rst index 5bae95abe8d83..4ba1e0c7d949a 100644 --- a/boards/espressif/esp32c6_devkitc/doc/index.rst +++ b/boards/espressif/esp32c6_devkitc/doc/index.rst @@ -111,6 +111,8 @@ Current Zephyr's ESP32-C6-DevKitC board supports the following features: +------------+------------+-------------------------------------+ | USB-CDC | on-chip | serial | +------------+------------+-------------------------------------+ +| Wi-Fi | on-chip | | ++------------+------------+-------------------------------------+ System requirements ******************* diff --git a/drivers/clock_control/clock_control_esp32.c b/drivers/clock_control/clock_control_esp32.c index 5a2157cf9a12d..98762b6813f6c 100644 --- a/drivers/clock_control/clock_control_esp32.c +++ b/drivers/clock_control/clock_control_esp32.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #endif @@ -87,6 +88,20 @@ static bool reset_reason_is_cpu_reset(void) #if defined(CONFIG_SOC_SERIES_ESP32C6) static void esp32_clock_perip_init(void) { + soc_rtc_slow_clk_src_t rtc_slow_clk_src = rtc_clk_slow_src_get(); + modem_clock_lpclk_src_t modem_lpclk_src = + (modem_clock_lpclk_src_t)((rtc_slow_clk_src == SOC_RTC_SLOW_CLK_SRC_RC_SLOW) + ? MODEM_CLOCK_LPCLK_SRC_RC_SLOW + : (rtc_slow_clk_src == SOC_RTC_SLOW_CLK_SRC_XTAL32K) + ? MODEM_CLOCK_LPCLK_SRC_XTAL32K + : (rtc_slow_clk_src == SOC_RTC_SLOW_CLK_SRC_RC32K) + ? MODEM_CLOCK_LPCLK_SRC_RC32K + : (rtc_slow_clk_src == SOC_RTC_SLOW_CLK_SRC_OSC_SLOW) + ? MODEM_CLOCK_LPCLK_SRC_EXT32K + : SOC_RTC_SLOW_CLK_SRC_RC_SLOW); + + modem_clock_select_lp_clock_source(PERIPH_WIFI_MODULE, modem_lpclk_src, 0); + soc_reset_reason_t rst_reason = esp_rom_get_reset_reason(0); if ((rst_reason != RESET_REASON_CPU0_MWDT0) && (rst_reason != RESET_REASON_CPU0_MWDT1) && diff --git a/dts/riscv/espressif/esp32c6/esp32c6_common.dtsi b/dts/riscv/espressif/esp32c6/esp32c6_common.dtsi index 232e2bb061d9d..c0b9872d9356f 100644 --- a/dts/riscv/espressif/esp32c6/esp32c6_common.dtsi +++ b/dts/riscv/espressif/esp32c6/esp32c6_common.dtsi @@ -56,6 +56,11 @@ status = "okay"; }; + wifi: wifi { + compatible = "espressif,esp32-wifi"; + status = "disabled"; + }; + soc { #address-cells = <1>; #size-cells = <1>; diff --git a/samples/net/wifi/shell/socs/esp32c6.conf b/samples/net/wifi/shell/socs/esp32c6.conf new file mode 100644 index 0000000000000..a72fdf39efa24 --- /dev/null +++ b/samples/net/wifi/shell/socs/esp32c6.conf @@ -0,0 +1,11 @@ +CONFIG_WIFI=y + +CONFIG_NETWORKING=y +CONFIG_NET_L2_ETHERNET=y + +CONFIG_NET_IPV6=n +CONFIG_NET_IPV4=y +CONFIG_NET_DHCPV4=y +CONFIG_ESP32_WIFI_STA_AUTO_DHCPV4=y + +CONFIG_NET_LOG=y diff --git a/samples/net/wifi/shell/socs/esp32c6.overlay b/samples/net/wifi/shell/socs/esp32c6.overlay new file mode 100644 index 0000000000000..872f2dfe2eaba --- /dev/null +++ b/samples/net/wifi/shell/socs/esp32c6.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wifi { + status = "okay"; +}; diff --git a/soc/espressif/esp32c6/default.ld b/soc/espressif/esp32c6/default.ld index 9cd69db8e3a4b..39bdac633aee8 100644 --- a/soc/espressif/esp32c6/default.ld +++ b/soc/espressif/esp32c6/default.ld @@ -388,8 +388,9 @@ SECTIONS *libzephyr.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable) #if defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.* .wifi_extra_iram.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.* .wifi_extra_iram.*) + *libcoexist.a:(.wifi_slp_iram .wifi_slp_iram.*) /* [mapping:esp_wifi] */ *(.literal.wifi_clock_enable_wrapper .text.wifi_clock_enable_wrapper) @@ -737,8 +738,8 @@ SECTIONS __rom_region_start = ABSOLUTE(.); #if !defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.* .wifi_extra_iram.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.* .wifi_extra_iram.*) #endif /* CONFIG_ESP32_WIFI_IRAM_OPT */ #if !defined(CONFIG_ESP32_WIFI_RX_IRAM_OPT) diff --git a/west.yml b/west.yml index 30e2bce894db8..6edfccef606c3 100644 --- a/west.yml +++ b/west.yml @@ -157,7 +157,7 @@ manifest: groups: - hal - name: hal_espressif - revision: 07ff57e8d197765652b7819b297415d859ed7815 + revision: 8d7054f34e6d05e2917410ff0630ee88f553521d path: modules/hal/espressif west-commands: west/west-commands.yml groups: From 1f55b8d8a4cec9b4bd4ea4fe95407b0d2458d3e7 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Fri, 1 Nov 2024 15:01:27 +0100 Subject: [PATCH 2711/4482] tests: Bluetooth: Tester: Increase conn interval Increase the conn interval from 30 to 60 for more stability in test with multiple lower testers (up to 3). Signed-off-by: Emil Gydesen --- tests/bluetooth/tester/src/btp_gap.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/bluetooth/tester/src/btp_gap.c b/tests/bluetooth/tester/src/btp_gap.c index d783aaa770716..4c9b4ff7f34b7 100644 --- a/tests/bluetooth/tester/src/btp_gap.c +++ b/tests/bluetooth/tester/src/btp_gap.c @@ -5,6 +5,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ +#include #include #include @@ -997,9 +998,13 @@ static uint8_t stop_discovery(const void *cmd, uint16_t cmd_len, static uint8_t connect(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len) { + /* The conn interval is set to 60ms (0x30). This is to better support test cases where we + * need to connect to multiple peripherals (up to 3). The connection interval should also be + * a multiple of 30ms, as that is ideal to support both 7.5ms and 10ms ISO intervals + */ + const uint16_t interval = BT_GAP_MS_TO_CONN_INTERVAL(60U); const struct bt_le_conn_param *conn_param = - BT_LE_CONN_PARAM(BT_GAP_INIT_CONN_INT_MIN, BT_GAP_INIT_CONN_INT_MIN, 0, - BT_GAP_MS_TO_CONN_TIMEOUT(4000)); + BT_LE_CONN_PARAM(interval, interval, 0U, BT_GAP_MS_TO_CONN_TIMEOUT(4000U)); const struct btp_gap_connect_cmd *cp = cmd; int err; From cf4a398477920a9df8cf1892e9ae05cd6b1b5b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Thu, 24 Oct 2024 14:24:57 +0200 Subject: [PATCH 2712/4482] drivers: flash: spi_nor: add option for 4byte opcodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit some flashes support special opcodes for 4-byte addressing, that can be used without switching to 4-byte mode. Signed-off-by: Fin Maaß --- drivers/flash/spi_nor.c | 111 ++++++++++++++++++++- drivers/flash/spi_nor.h | 1 + dts/bindings/mtd/jedec,spi-nor-common.yaml | 11 ++ 3 files changed, 118 insertions(+), 5 deletions(-) diff --git a/drivers/flash/spi_nor.c b/drivers/flash/spi_nor.c index 9f849a4780bd2..f064f4179de98 100644 --- a/drivers/flash/spi_nor.c +++ b/drivers/flash/spi_nor.c @@ -43,7 +43,7 @@ LOG_MODULE_REGISTER(spi_nor, CONFIG_FLASH_LOG_LEVEL); */ #define SPI_NOR_MAX_ADDR_WIDTH 4 - +#define SPI_NOR_3B_ADDR_MAX 0xFFFFFF #define ANY_INST_HAS_TRUE_(idx, bool_prop) \ COND_CODE_1(DT_INST_PROP(idx, bool_prop), (1,), ()) @@ -65,6 +65,7 @@ LOG_MODULE_REGISTER(spi_nor, CONFIG_FLASH_LOG_LEVEL); #define ANY_INST_HAS_RESET_GPIOS ANY_INST_HAS_PROP(reset_gpios) #define ANY_INST_HAS_WP_GPIOS ANY_INST_HAS_PROP(wp_gpios) #define ANY_INST_HAS_HOLD_GPIOS ANY_INST_HAS_PROP(hold_gpios) +#define ANY_INST_USE_4B_ADDR_OPCODES ANY_INST_HAS_TRUE(use_4b_addr_opcodes) #ifdef CONFIG_SPI_NOR_ACTIVE_DWELL_MS #define ACTIVE_DWELL_MS CONFIG_SPI_NOR_ACTIVE_DWELL_MS @@ -152,6 +153,7 @@ struct spi_nor_config { #if ANY_INST_HAS_MXICY_MX25R_POWER_MODE bool mxicy_mx25r_power_mode; #endif + bool use_4b_addr_opcodes:1; /* exist flags for dts opt-ins */ bool dpd_exist:1; @@ -220,6 +222,16 @@ static const struct jesd216_erase_type minimal_erase_types[JESD216_NUM_ERASE_TYP .exp = 12, }, }; +static const struct jesd216_erase_type minimal_erase_types_4b[JESD216_NUM_ERASE_TYPES] = { + { + .cmd = SPI_NOR_CMD_BE_4B, + .exp = 16, + }, + { + .cmd = SPI_NOR_CMD_SE_4B, + .exp = 12, + }, +}; #endif /* CONFIG_SPI_NOR_SFDP_MINIMAL */ /* Register writes should be ready extremely quickly */ @@ -239,6 +251,9 @@ static inline const struct jesd216_erase_type * dev_erase_types(const struct device *dev) { #ifdef CONFIG_SPI_NOR_SFDP_MINIMAL + if (IS_ENABLED(ANY_INST_USE_4B_ADDR_OPCODES) && DEV_CFG(dev)->use_4b_addr_opcodes) { + return minimal_erase_types_4b; + } return minimal_erase_types; #else /* CONFIG_SPI_NOR_SFDP_MINIMAL */ const struct spi_nor_data *data = dev->data; @@ -432,11 +447,25 @@ static int spi_nor_access(const struct device *const dev, spi_nor_access(dev, opcode, 0, 0, dest, length) #define spi_nor_cmd_addr_read(dev, opcode, addr, dest, length) \ spi_nor_access(dev, opcode, NOR_ACCESS_ADDRESSED, addr, dest, length) +#define spi_nor_cmd_addr_read_3b(dev, opcode, addr, dest, length) \ + spi_nor_access(dev, opcode, NOR_ACCESS_24BIT_ADDR | NOR_ACCESS_ADDRESSED, addr, dest, \ + length) +#define spi_nor_cmd_addr_read_4b(dev, opcode, addr, dest, length) \ + spi_nor_access(dev, opcode, NOR_ACCESS_32BIT_ADDR | NOR_ACCESS_ADDRESSED, addr, dest, \ + length) #define spi_nor_cmd_write(dev, opcode) \ spi_nor_access(dev, opcode, NOR_ACCESS_WRITE, 0, NULL, 0) #define spi_nor_cmd_addr_write(dev, opcode, addr, src, length) \ spi_nor_access(dev, opcode, NOR_ACCESS_WRITE | NOR_ACCESS_ADDRESSED, \ addr, (void *)src, length) +#define spi_nor_cmd_addr_write_3b(dev, opcode, addr, src, length) \ + spi_nor_access(dev, opcode, \ + NOR_ACCESS_24BIT_ADDR | NOR_ACCESS_WRITE | NOR_ACCESS_ADDRESSED, addr, \ + (void *)src, length) +#define spi_nor_cmd_addr_write_4b(dev, opcode, addr, src, length) \ + spi_nor_access(dev, opcode, \ + NOR_ACCESS_32BIT_ADDR | NOR_ACCESS_WRITE | NOR_ACCESS_ADDRESSED, addr, \ + (void *)src, length) /** * @brief Wait until the flash is ready @@ -784,7 +813,15 @@ static int spi_nor_read(const struct device *dev, off_t addr, void *dest, acquire_device(dev); - ret = spi_nor_cmd_addr_read(dev, SPI_NOR_CMD_READ, addr, dest, size); + if (IS_ENABLED(ANY_INST_USE_4B_ADDR_OPCODES) && DEV_CFG(dev)->use_4b_addr_opcodes) { + if (addr > SPI_NOR_3B_ADDR_MAX) { + ret = spi_nor_cmd_addr_read_4b(dev, SPI_NOR_CMD_READ_4B, addr, dest, size); + } else { + ret = spi_nor_cmd_addr_read_3b(dev, SPI_NOR_CMD_READ, addr, dest, size); + } + } else { + ret = spi_nor_cmd_addr_read(dev, SPI_NOR_CMD_READ, addr, dest, size); + } release_device(dev); @@ -867,8 +904,20 @@ static int spi_nor_write(const struct device *dev, off_t addr, break; } - ret = spi_nor_cmd_addr_write(dev, SPI_NOR_CMD_PP, addr, - src, to_write); + if (IS_ENABLED(ANY_INST_USE_4B_ADDR_OPCODES) && + DEV_CFG(dev)->use_4b_addr_opcodes) { + if (addr > SPI_NOR_3B_ADDR_MAX) { + ret = spi_nor_cmd_addr_write_4b(dev, SPI_NOR_CMD_PP_4B, + addr, src, to_write); + } else { + ret = spi_nor_cmd_addr_write_3b(dev, SPI_NOR_CMD_PP, addr, + src, to_write); + } + } else { + ret = spi_nor_cmd_addr_write(dev, SPI_NOR_CMD_PP, addr, src, + to_write); + } + if (ret != 0) { break; } @@ -953,7 +1002,13 @@ static int spi_nor_erase(const struct device *dev, off_t addr, size_t size) } } if (bet != NULL) { - ret = spi_nor_cmd_addr_write(dev, bet->cmd, addr, NULL, 0); + if (IS_ENABLED(ANY_INST_USE_4B_ADDR_OPCODES) && + DEV_CFG(dev)->use_4b_addr_opcodes) { + ret = spi_nor_cmd_addr_write_4b(dev, bet->cmd, addr, NULL, + 0); + } else { + ret = spi_nor_cmd_addr_write(dev, bet->cmd, addr, NULL, 0); + } addr += BIT(bet->exp); size -= BIT(bet->exp); } else { @@ -1164,6 +1219,11 @@ static int spi_nor_process_bfp(const struct device *dev, struct jesd216_bfp_dw16 dw16; int rc = 0; + if (IS_ENABLED(ANY_INST_USE_4B_ADDR_OPCODES) && DEV_CFG(dev)->use_4b_addr_opcodes) { + LOG_DBG("4-byte addressing supported, using it via specific opcodes"); + return 0; + } + if (jesd216_bfp_decode_dw16(php, bfp, &dw16) == 0) { rc = spi_nor_set_address_mode(dev, dw16.enter_4ba); } @@ -1181,6 +1241,7 @@ static int spi_nor_process_sfdp(const struct device *dev) int rc; #if defined(CONFIG_SPI_NOR_SFDP_RUNTIME) + struct spi_nor_data *dev_data = dev->data; /* For runtime we need to read the SFDP table, identify the * BFP block, and process it. */ @@ -1236,6 +1297,45 @@ static int spi_nor_process_sfdp(const struct device *dev) break; } } + if (id == JESD216_SFDP_PARAM_ID_4B_ADDR_INSTR) { + if (IS_ENABLED(ANY_INST_USE_4B_ADDR_OPCODES) && + DEV_CFG(dev)->use_4b_addr_opcodes) { + /* + * Check table 4 byte address instruction table to get supported + * erase opcodes when running in 4 byte address mode + */ + union { + uint32_t dw[2]; + struct { + uint32_t dummy; + uint8_t type[4]; + } types; + } u2; + rc = spi_nor_sfdp_read( + dev, jesd216_param_addr(php), (uint8_t *)u2.dw, + MIN(sizeof(uint32_t) * php->len_dw, sizeof(u2.dw))); + if (rc != 0) { + break; + } + for (uint8_t ei = 0; ei < JESD216_NUM_ERASE_TYPES; ++ei) { + struct jesd216_erase_type *etp = &dev_data->erase_types[ei]; + const uint8_t cmd = u2.types.type[ei]; + /* 0xff means not supported */ + if (cmd == 0xff) { + etp->exp = 0; + etp->cmd = 0; + } else { + etp->cmd = cmd; + }; + } + + if (!((sys_le32_to_cpu(u2.dw[0]) & BIT(0)) && + (sys_le32_to_cpu(u2.dw[1]) & BIT(6)))) { + LOG_ERR("4-byte addressing not supported"); + return -ENOTSUP; + } + } + } ++php; } #elif defined(CONFIG_SPI_NOR_SFDP_DEVICETREE) @@ -1692,6 +1792,7 @@ static const struct flash_driver_api spi_nor_api = { .requires_ulbpr_exist = DT_INST_PROP(idx, requires_ulbpr), \ .wp_gpios_exist = DT_INST_NODE_HAS_PROP(idx, wp_gpios), \ .hold_gpios_exist = DT_INST_NODE_HAS_PROP(idx, hold_gpios), \ + .use_4b_addr_opcodes = DT_INST_PROP(idx, use_4b_addr_opcodes), \ IF_ENABLED(INST_HAS_LOCK(idx), (.has_lock = DT_INST_PROP(idx, has_lock),)) \ IF_ENABLED(ANY_INST_HAS_DPD, (INIT_T_ENTER_DPD(idx),)) \ IF_ENABLED(UTIL_AND(ANY_INST_HAS_DPD, ANY_INST_HAS_T_EXIT_DPD), \ diff --git a/drivers/flash/spi_nor.h b/drivers/flash/spi_nor.h index 5f38c98289f88..a918e0a99d053 100644 --- a/drivers/flash/spi_nor.h +++ b/drivers/flash/spi_nor.h @@ -39,6 +39,7 @@ #define SPI_NOR_CMD_SE_4B 0x21 /* Sector erase 4 byte address*/ #define SPI_NOR_CMD_BE_32K 0x52 /* Block erase 32KB */ #define SPI_NOR_CMD_BE 0xD8 /* Block erase */ +#define SPI_NOR_CMD_BE_4B 0xDC /* Block erase 4 byte address*/ #define SPI_NOR_CMD_CE 0xC7 /* Chip erase */ #define SPI_NOR_CMD_RDID 0x9F /* Read JEDEC ID */ #define SPI_NOR_CMD_ULBPR 0x98 /* Global Block Protection Unlock */ diff --git a/dts/bindings/mtd/jedec,spi-nor-common.yaml b/dts/bindings/mtd/jedec,spi-nor-common.yaml index 3e39c967097b5..7ef04f24929cc 100644 --- a/dts/bindings/mtd/jedec,spi-nor-common.yaml +++ b/dts/bindings/mtd/jedec,spi-nor-common.yaml @@ -102,3 +102,14 @@ properties: low power mode. Only supported on Macronix MX25R Ultra Low Power series. + + use-4b-addr-opcodes: + type: boolean + description: | + Indicates the device uses special 4-byte address opcodes. + Instead of switching to 4-byte addressing mode, the device uses + special opcodes for 4-byte addressing. + + Some devices support 4-byte address opcodes for read/write/erase + operations. Use this property to indicate that the device supports + 4-byte address opcodes. From 06e6a84b1d779c3c2d3cf7c783c98a3c239c88c2 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Tue, 15 Oct 2024 09:17:09 -0700 Subject: [PATCH 2713/4482] tests: copy intel_adsp_ace30_ptl.conf to *_sim.conf With the rename of intel_adsp/ace30_ptl to intel_adsp/ace30/ptl, the "sim" variant no longer inherit the base configuration. So make a copy of the .conf file to explicitly target the sim variant. Signed-off-by: Daniel Leung --- .../mem_protect/sys_sem/boards/intel_adsp_ace30_ptl_sim.conf | 1 + .../kernel/mutex/sys_mutex/boards/intel_adsp_ace30_ptl_sim.conf | 1 + tests/kernel/queue/boards/intel_adsp_ace30_ptl_sim.conf | 1 + tests/lib/c_lib/thrd/boards/intel_adsp_ace30_ptl_sim.conf | 1 + 4 files changed, 4 insertions(+) create mode 100644 tests/kernel/mem_protect/sys_sem/boards/intel_adsp_ace30_ptl_sim.conf create mode 100644 tests/kernel/mutex/sys_mutex/boards/intel_adsp_ace30_ptl_sim.conf create mode 100644 tests/kernel/queue/boards/intel_adsp_ace30_ptl_sim.conf create mode 100644 tests/lib/c_lib/thrd/boards/intel_adsp_ace30_ptl_sim.conf diff --git a/tests/kernel/mem_protect/sys_sem/boards/intel_adsp_ace30_ptl_sim.conf b/tests/kernel/mem_protect/sys_sem/boards/intel_adsp_ace30_ptl_sim.conf new file mode 100644 index 0000000000000..922c1e4b05f34 --- /dev/null +++ b/tests/kernel/mem_protect/sys_sem/boards/intel_adsp_ace30_ptl_sim.conf @@ -0,0 +1 @@ +CONFIG_MAX_THREAD_BYTES=3 diff --git a/tests/kernel/mutex/sys_mutex/boards/intel_adsp_ace30_ptl_sim.conf b/tests/kernel/mutex/sys_mutex/boards/intel_adsp_ace30_ptl_sim.conf new file mode 100644 index 0000000000000..922c1e4b05f34 --- /dev/null +++ b/tests/kernel/mutex/sys_mutex/boards/intel_adsp_ace30_ptl_sim.conf @@ -0,0 +1 @@ +CONFIG_MAX_THREAD_BYTES=3 diff --git a/tests/kernel/queue/boards/intel_adsp_ace30_ptl_sim.conf b/tests/kernel/queue/boards/intel_adsp_ace30_ptl_sim.conf new file mode 100644 index 0000000000000..922c1e4b05f34 --- /dev/null +++ b/tests/kernel/queue/boards/intel_adsp_ace30_ptl_sim.conf @@ -0,0 +1 @@ +CONFIG_MAX_THREAD_BYTES=3 diff --git a/tests/lib/c_lib/thrd/boards/intel_adsp_ace30_ptl_sim.conf b/tests/lib/c_lib/thrd/boards/intel_adsp_ace30_ptl_sim.conf new file mode 100644 index 0000000000000..922c1e4b05f34 --- /dev/null +++ b/tests/lib/c_lib/thrd/boards/intel_adsp_ace30_ptl_sim.conf @@ -0,0 +1 @@ +CONFIG_MAX_THREAD_BYTES=3 From 74817cbc2c3d4cc03067f356a54c246d7a924662 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Tue, 8 Nov 2022 14:32:56 -0800 Subject: [PATCH 2714/4482] tests: mem_map: do not run on Intel Audio DSP SoCs Amend the filtering so that the normal mem_map (with exec) test is not going to run on Intel Audio DSP SoCs. Signed-off-by: Daniel Leung --- tests/kernel/mem_protect/mem_map/testcase.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/kernel/mem_protect/mem_map/testcase.yaml b/tests/kernel/mem_protect/mem_map/testcase.yaml index 186e60faf029e..aaf41156113d8 100644 --- a/tests/kernel/mem_protect/mem_map/testcase.yaml +++ b/tests/kernel/mem_protect/mem_map/testcase.yaml @@ -5,7 +5,7 @@ common: - mmu tests: kernel.memory_protection.mem_map: - filter: CONFIG_MMU and not CONFIG_X86_64 + filter: CONFIG_MMU and not CONFIG_X86_64 and not CONFIG_SOC_FAMILY_INTEL_ADSP extra_sections: _TRANSPLANTED_FUNC extra_configs: - CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=0 @@ -43,3 +43,4 @@ tests: extra_args: EXTRA_CFLAGS=-DSKIP_EXECUTE_TESTS platform_allow: - intel_adsp/ace30/ptl + - intel_adsp/ace30/ptl/sim From b889360b369d37b81f077b1fbf12f7de7faf3f9d Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Mon, 21 Oct 2024 13:24:36 -0700 Subject: [PATCH 2715/4482] tests: posix/common: set CONFIG_MAX_THREAD_BYTES=3 Boards intel_adsp/ace30/ptl* needs more for thread objects. Signed-off-by: Daniel Leung --- tests/posix/common/boards/intel_adsp_ace30_ptl.conf | 1 + tests/posix/common/boards/intel_adsp_ace30_ptl_sim.conf | 1 + 2 files changed, 2 insertions(+) create mode 100644 tests/posix/common/boards/intel_adsp_ace30_ptl.conf create mode 100644 tests/posix/common/boards/intel_adsp_ace30_ptl_sim.conf diff --git a/tests/posix/common/boards/intel_adsp_ace30_ptl.conf b/tests/posix/common/boards/intel_adsp_ace30_ptl.conf new file mode 100644 index 0000000000000..922c1e4b05f34 --- /dev/null +++ b/tests/posix/common/boards/intel_adsp_ace30_ptl.conf @@ -0,0 +1 @@ +CONFIG_MAX_THREAD_BYTES=3 diff --git a/tests/posix/common/boards/intel_adsp_ace30_ptl_sim.conf b/tests/posix/common/boards/intel_adsp_ace30_ptl_sim.conf new file mode 100644 index 0000000000000..922c1e4b05f34 --- /dev/null +++ b/tests/posix/common/boards/intel_adsp_ace30_ptl_sim.conf @@ -0,0 +1 @@ +CONFIG_MAX_THREAD_BYTES=3 From 7ea6da052136862a474c648d404f21ae22bee3fe Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Mon, 21 Oct 2024 13:02:29 -0700 Subject: [PATCH 2716/4482] boards: intel_adsp/ace30: enable building with Zephyr SDK 0.17.0 Zephyr SDK 0.17.0 adds the toolchain for the Intel Audio DSP ACE 3.0 platforms. We can now add the bits to enable building the boards with SDK 0.17. Signed-off-by: Daniel Leung --- boards/intel/adsp/twister.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boards/intel/adsp/twister.yaml b/boards/intel/adsp/twister.yaml index fa49433b40d46..1bef7d267ad4f 100644 --- a/boards/intel/adsp/twister.yaml +++ b/boards/intel/adsp/twister.yaml @@ -15,6 +15,7 @@ variants: intel_adsp/ace30/ptl: toolchain: - xt-clang + - zephyr intel_adsp/ace30: twister: false intel_adsp/ace20_lnl/sim: @@ -35,6 +36,7 @@ variants: simulation_exec: acesim toolchain: - xt-clang + - zephyr testing: timeout_multiplier: 8 intel_adsp/cavs25: From 0fa9701a260d49f946e46841a607b14065b715c3 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 10 Oct 2024 21:03:33 +0200 Subject: [PATCH 2717/4482] Bluetooth: Tester: Added flag parameter to CAP stop cmd Added a flag parameter so that it is possible to use the bt_cap_initiator_unicast_audio_stop to perform disable+stop without releasing the streams by setting the RELEASE flag. This allows us to use the bt_cap_initiator_unicast_audio_stop function to just disable streams without releasing them, as that is requested by some PTS tests such as CAP/INI/UST/BV-40-C. Signed-off-by: Emil Gydesen --- tests/bluetooth/tester/src/audio/btp/btp_cap.h | 2 ++ tests/bluetooth/tester/src/audio/btp_cap.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/bluetooth/tester/src/audio/btp/btp_cap.h b/tests/bluetooth/tester/src/audio/btp/btp_cap.h index 303f793003338..ca6714bca6011 100644 --- a/tests/bluetooth/tester/src/audio/btp/btp_cap.h +++ b/tests/bluetooth/tester/src/audio/btp/btp_cap.h @@ -60,7 +60,9 @@ struct btp_cap_unicast_audio_update_data { #define BTP_CAP_UNICAST_AUDIO_STOP 0x06 struct btp_cap_unicast_audio_stop_cmd { uint8_t cig_id; + uint8_t flags; } __packed; +#define BTP_CAP_UNICAST_AUDIO_STOP_FLAG_RELEASE BIT(0) #define BTP_CAP_BROADCAST_SOURCE_SETUP_STREAM 0x07 struct btp_cap_broadcast_source_setup_stream_cmd { diff --git a/tests/bluetooth/tester/src/audio/btp_cap.c b/tests/bluetooth/tester/src/audio/btp_cap.c index 9316db7c62bba..f8da879ae103d 100644 --- a/tests/bluetooth/tester/src/audio/btp_cap.c +++ b/tests/bluetooth/tester/src/audio/btp_cap.c @@ -438,7 +438,7 @@ static uint8_t btp_cap_unicast_audio_stop(const void *cmd, uint16_t cmd_len, param.streams = streams; param.count = stream_cnt; param.type = BT_CAP_SET_TYPE_AD_HOC; - param.release = true; + param.release = (cp->flags & BTP_CAP_UNICAST_AUDIO_STOP_FLAG_RELEASE) != 0; err = bt_cap_initiator_unicast_audio_stop(¶m); if (err != 0) { From 45a3b6b7318a987ecdc5a66489b35c6f3e79169d Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Sun, 29 Sep 2024 16:19:07 +0200 Subject: [PATCH 2718/4482] doc: develop: west: Remove deprecated west.log The global state west.log is deprecated, replace with WestCommand logging. Signed-off-by: Pieter De Gendt --- doc/develop/west/extensions.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/develop/west/extensions.rst b/doc/develop/west/extensions.rst index 520e0ec4a4a11..923d86619d75f 100644 --- a/doc/develop/west/extensions.rst +++ b/doc/develop/west/extensions.rst @@ -87,7 +87,6 @@ details on the west APIs you can use, see :ref:`west-apis`. from textwrap import dedent # just for nicer code indentation from west.commands import WestCommand # your extension must subclass this - from west import log # use this for user output class MyCommand(WestCommand): @@ -125,8 +124,8 @@ details on the west APIs you can use, see :ref:`west-apis`. # $ west my-command-name -o FOO BAR # --optional is FOO # required is BAR - log.inf('--optional is', args.optional) - log.inf('required is', args.required) + self.inf('--optional is', args.optional) + self.inf('required is', args.required) You can ignore the second argument to ``do_run()`` (``unknown_args`` above), as ``WestCommand`` will reject unknown arguments by default. If you want to be From efe3d465310bce1f96cc6e16673273448cfc715e Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Sun, 29 Sep 2024 15:26:01 +0200 Subject: [PATCH 2719/4482] scripts: west_commands: bindesc: Remove deprecated west.log The global state west.log is deprecated, replace with WestCommand logging. Signed-off-by: Pieter De Gendt --- scripts/west_commands/bindesc.py | 37 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/scripts/west_commands/bindesc.py b/scripts/west_commands/bindesc.py index 64aacded4c629..5298138fcbc0e 100644 --- a/scripts/west_commands/bindesc.py +++ b/scripts/west_commands/bindesc.py @@ -6,7 +6,6 @@ import struct from west.commands import WestCommand -from west import log try: @@ -18,7 +17,7 @@ # Based on scripts/build/uf2conv.py -def convert_from_uf2(buf): +def convert_from_uf2(cmd, buf): UF2_MAGIC_START0 = 0x0A324655 # First magic number ('UF2\n') UF2_MAGIC_START1 = 0x9E5D5157 # Second magic number numblocks = len(buf) // 512 @@ -29,24 +28,24 @@ def convert_from_uf2(buf): block = buf[ptr:ptr + 512] hd = struct.unpack(b' 476: - log.die(f'Invalid UF2 data size at {ptr}') + cmd.die(f'Invalid UF2 data size at {ptr}') newaddr = hd[3] if curraddr is None: curraddr = newaddr padding = newaddr - curraddr if padding < 0: - log.die(f'Block out of order at {ptr}') + cmd.die(f'Block out of order at {ptr}') if padding > 10*1024*1024: - log.die(f'More than 10M of padding needed at {ptr}') + cmd.die(f'More than 10M of padding needed at {ptr}') if padding % 4 != 0: - log.die(f'Non-word padding size at {ptr}') + cmd.die(f'Non-word padding size at {ptr}') while padding > 0: padding -= 4 outp += b'\x00\x00\x00\x00' @@ -161,11 +160,11 @@ def dump(self, args): for tag, value in descriptors.items(): if tag in self.TAG_TO_NAME: tag = self.TAG_TO_NAME[tag] - log.inf(f'{tag}', self.bindesc_repr(value)) + self.inf(f'{tag}', self.bindesc_repr(value)) def list(self, args): for tag in self.TAG_TO_NAME.values(): - log.inf(f'{tag}') + self.inf(f'{tag}') def common_search(self, args, search_term): image = self.get_image_data(args.file) @@ -174,15 +173,15 @@ def common_search(self, args, search_term): if search_term in descriptors: value = descriptors[search_term] - log.inf(self.bindesc_repr(value)) + self.inf(self.bindesc_repr(value)) else: - log.die('Descriptor not found') + self.die('Descriptor not found') def search(self, args): try: search_term = self.NAME_TO_TAG[args.descriptor] except KeyError: - log.die(f'Descriptor {args.descriptor} is invalid') + self.die(f'Descriptor {args.descriptor} is invalid') self.common_search(args, search_term) @@ -201,8 +200,8 @@ def get_offset(self, args): magic = struct.pack('>Q' if self.is_big_endian else 'Q', self.MAGIC) index = image.find(magic) if index == -1: - log.die('Could not find binary descriptor magic') - log.inf(f'{index} {hex(index)}') + self.die('Could not find binary descriptor magic') + self.inf(f'{index} {hex(index)}') def do_run(self, args, _): if MISSING_REQUIREMENTS: @@ -224,7 +223,7 @@ def get_image_data(self, file_name): if self.file_type == 'uf2': with open(file_name, 'rb') as uf2_file: - return convert_from_uf2(uf2_file.read()) + return convert_from_uf2(self, uf2_file.read()) if self.file_type == 'elf': with open(file_name, 'rb') as f: @@ -238,15 +237,15 @@ def get_image_data(self, file_name): if section: return section.data() - log.die('No "rom_start" or "text" section found') + self.die('No "rom_start" or "text" section found') - log.die('Unknown file type') + self.die('Unknown file type') def parse_descriptors(self, image): magic = struct.pack('>Q' if self.is_big_endian else 'Q', self.MAGIC) index = image.find(magic) if index == -1: - log.die('Could not find binary descriptor magic') + self.die('Could not find binary descriptor magic') descriptors = {} @@ -266,7 +265,7 @@ def parse_descriptors(self, image): elif tag_type == self.TYPE_BYTES: decoded_data = data else: - log.die(f'Unknown type for tag 0x{current_tag:04x}') + self.die(f'Unknown type for tag 0x{current_tag:04x}') key = f'0x{current_tag:04x}' descriptors[key] = decoded_data From d3ecdd9b5becca9bcc05c5a612190c1270ba6a83 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Sun, 29 Sep 2024 15:28:14 +0200 Subject: [PATCH 2720/4482] scripts: west_commands: blobs: Remove deprecated west.log The global state west.log is deprecated, replace with WestCommand logging. Signed-off-by: Pieter De Gendt --- scripts/west_commands/blobs.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/scripts/west_commands/blobs.py b/scripts/west_commands/blobs.py index 2574b26056dbb..fd124eccc7834 100644 --- a/scripts/west_commands/blobs.py +++ b/scripts/west_commands/blobs.py @@ -9,7 +9,6 @@ import textwrap from urllib.parse import urlparse -from west import log from west.commands import WestCommand from zephyr_ext_common import ZEPHYR_BASE @@ -87,7 +86,7 @@ def get_blobs(self, args): unknown = set(modules) - set(all_names) if len(unknown): - log.die(f'Unknown module(s): {unknown}') + self.die(f'Unknown module(s): {unknown}') for module in all_modules: # Filter by module @@ -103,18 +102,18 @@ def list(self, args): blobs = self.get_blobs(args) fmt = args.format or self.DEFAULT_LIST_FMT for blob in blobs: - log.inf(fmt.format(**blob)) + self.inf(fmt.format(**blob)) def ensure_folder(self, path): path.parent.mkdir(parents=True, exist_ok=True) def fetch_blob(self, url, path): scheme = urlparse(url).scheme - log.dbg(f'Fetching {path} with {scheme}') + self.dbg(f'Fetching {path} with {scheme}') import fetchers fetcher = fetchers.get_fetcher_cls(scheme) - log.dbg(f'Found fetcher: {fetcher}') + self.dbg(f'Found fetcher: {fetcher}') inst = fetcher() self.ensure_folder(path) inst.fetch(url, path) @@ -122,11 +121,11 @@ def fetch_blob(self, url, path): # Compare the checksum of a file we've just downloaded # to the digest in blob metadata, warn user if they differ. def verify_blob(self, blob): - log.dbg('Verifying blob {module}: {abspath}'.format(**blob)) + self.dbg('Verifying blob {module}: {abspath}'.format(**blob)) status = zephyr_module.get_blob_status(blob['abspath'], blob['sha256']) if status == zephyr_module.BLOB_OUTDATED: - log.err(textwrap.dedent( + self.err(textwrap.dedent( f'''\ The checksum of the downloaded file does not match that in the blob metadata: @@ -146,9 +145,9 @@ def fetch(self, args): blobs = self.get_blobs(args) for blob in blobs: if blob['status'] == zephyr_module.BLOB_PRESENT: - log.dbg('Blob {module}: {abspath} is up to date'.format(**blob)) + self.dbg('Blob {module}: {abspath} is up to date'.format(**blob)) continue - log.inf('Fetching blob {module}: {abspath}'.format(**blob)) + self.inf('Fetching blob {module}: {abspath}'.format(**blob)) self.fetch_blob(blob['url'], blob['abspath']) self.verify_blob(blob) @@ -156,17 +155,17 @@ def clean(self, args): blobs = self.get_blobs(args) for blob in blobs: if blob['status'] == zephyr_module.BLOB_NOT_PRESENT: - log.dbg('Blob {module}: {abspath} not in filesystem'.format(**blob)) + self.dbg('Blob {module}: {abspath} not in filesystem'.format(**blob)) continue - log.inf('Deleting blob {module}: {status} {abspath}'.format(**blob)) + self.inf('Deleting blob {module}: {status} {abspath}'.format(**blob)) blob['abspath'].unlink() def do_run(self, args, _): - log.dbg(f'subcmd: \'{args.subcmd[0]}\' modules: {args.modules}') + self.dbg(f'subcmd: \'{args.subcmd[0]}\' modules: {args.modules}') subcmd = getattr(self, args.subcmd[0]) if args.subcmd[0] != 'list' and args.format is not None: - log.die(f'unexpected --format argument; this is a "west blobs list" option') + self.die(f'unexpected --format argument; this is a "west blobs list" option') subcmd(args) From a74c9be593a1b18b90b87f08e4b928f46bf583d8 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Sun, 29 Sep 2024 15:29:22 +0200 Subject: [PATCH 2721/4482] scripts: west_commands: boards: Remove deprecated west.log The global state west.log is deprecated, replace with WestCommand logging. Signed-off-by: Pieter De Gendt --- scripts/west_commands/boards.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/west_commands/boards.py b/scripts/west_commands/boards.py index 6c4ee16846604..5117fd1fd08a8 100644 --- a/scripts/west_commands/boards.py +++ b/scripts/west_commands/boards.py @@ -9,7 +9,6 @@ import sys import textwrap -from west import log from west.commands import WestCommand from zephyr_ext_common import ZEPHYR_BASE @@ -94,13 +93,13 @@ def do_run(self, args, _): for board in list_boards.find_boards(args): if name_re is not None and not name_re.search(board.name): continue - log.inf(args.format.format(name=board.name, arch=board.arch, - dir=board.dir, hwm=board.hwm, qualifiers='')) + self.inf(args.format.format(name=board.name, arch=board.arch, + dir=board.dir, hwm=board.hwm, qualifiers='')) for board in list_boards.find_v2_boards(args).values(): if name_re is not None and not name_re.search(board.name): continue - log.inf( + self.inf( args.format.format( name=board.name, full_name=board.full_name, From f8ec1c8a007e85cd03bb0574115d4b797e0ef9f3 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Sun, 29 Sep 2024 15:30:31 +0200 Subject: [PATCH 2722/4482] scripts: west_commands: completion: Remove deprecated west.log The global state west.log is deprecated, replace with WestCommand logging. Signed-off-by: Pieter De Gendt --- scripts/west_commands/completion.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/west_commands/completion.py b/scripts/west_commands/completion.py index 470d9a8b5f80c..11b9aa44653fa 100644 --- a/scripts/west_commands/completion.py +++ b/scripts/west_commands/completion.py @@ -5,7 +5,6 @@ import argparse import os -from west import log from west.commands import WestCommand # Relative to the folder where this script lives @@ -78,4 +77,4 @@ def do_run(self, args, unknown_args): with open(cf, 'r') as f: print(f.read()) except FileNotFoundError as e: - log.die('Unable to find completion file: {}'.format(e)) + self.die('Unable to find completion file: {}'.format(e)) From dd4747ff32a103e9fb150c8ba57eaf2b738673a0 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Sun, 29 Sep 2024 15:31:17 +0200 Subject: [PATCH 2723/4482] scripts: west_commands: shields: Remove deprecated west.log The global state west.log is deprecated, replace with WestCommand logging. Signed-off-by: Pieter De Gendt --- scripts/west_commands/shields.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/west_commands/shields.py b/scripts/west_commands/shields.py index c091646039536..9b9e7010af7a0 100644 --- a/scripts/west_commands/shields.py +++ b/scripts/west_commands/shields.py @@ -10,7 +10,6 @@ import sys import textwrap -from west import log from west.commands import WestCommand from zephyr_ext_common import ZEPHYR_BASE @@ -83,4 +82,4 @@ def do_run(self, args, _): for shield in list_shields.find_shields(args): if name_re is not None and not name_re.search(shield.name): continue - log.inf(args.format.format(name=shield.name, dir=shield.dir)) + self.inf(args.format.format(name=shield.name, dir=shield.dir)) From 14f9164ee1c406b5fbd0e6a33cba1694027d70f4 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Sun, 29 Sep 2024 15:31:55 +0200 Subject: [PATCH 2724/4482] scripts: west_commands: twister_cmd: Remove deprecated west.log The global state west.log is deprecated, replace with WestCommand logging. Signed-off-by: Pieter De Gendt --- scripts/west_commands/twister_cmd.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/west_commands/twister_cmd.py b/scripts/west_commands/twister_cmd.py index d9616c4e614d8..603ea3536829a 100644 --- a/scripts/west_commands/twister_cmd.py +++ b/scripts/west_commands/twister_cmd.py @@ -6,8 +6,7 @@ import os import sys -from west import log -from west.commands import WestCommand +from west.commands import Verbosity, WestCommand from zephyr_ext_common import ZEPHYR_SCRIPTS @@ -53,8 +52,8 @@ def do_add_parser(self, parser_adder): return parser def do_run(self, args, remainder): - log.dbg( - "args: {} remainder: {}".format(args, remainder), level=log.VERBOSE_EXTREME + self.dbg( + "args: {} remainder: {}".format(args, remainder), level=Verbosity.DBG_EXTREME ) options = parse_arguments(self.parser, args=remainder, options=args) From 76864957fd326a4be74fb37051342741778bdf89 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Sun, 29 Sep 2024 15:36:34 +0200 Subject: [PATCH 2725/4482] scripts: west_commands: export: Remove deprecated west.log The global state west.log is deprecated, replace with WestCommand logging. Signed-off-by: Pieter De Gendt --- scripts/west_commands/export.py | 34 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/scripts/west_commands/export.py b/scripts/west_commands/export.py index b650ed2b55ce5..5088598198c36 100644 --- a/scripts/west_commands/export.py +++ b/scripts/west_commands/export.py @@ -4,10 +4,8 @@ import argparse from pathlib import Path -from shutil import rmtree from west.commands import WestCommand -from west import log from zcmake import run_cmake @@ -44,25 +42,17 @@ def do_run(self, args, unknown_args): # The 'share' subdirectory of the top level zephyr repository. share = Path(__file__).parents[2] / 'share' - run_cmake_export(share / 'zephyr-package' / 'cmake') - run_cmake_export(share / 'zephyrunittest-package' / 'cmake') + self.run_cmake_export(share / 'zephyr-package' / 'cmake') + self.run_cmake_export(share / 'zephyrunittest-package' / 'cmake') -def run_cmake_export(path): - # Run a package installation script. - # - # Filtering out lines that start with -- ignores the normal - # CMake status messages and instead only prints the important - # information. + def run_cmake_export(self, path): + # Run a package installation script. + # + # Filtering out lines that start with -- ignores the normal + # CMake status messages and instead only prints the important + # information. - lines = run_cmake(['-P', str(path / 'zephyr_export.cmake')], - capture_output=True) - msg = [line for line in lines if not line.startswith('-- ')] - log.inf('\n'.join(msg)) - -def remove_if_exists(pathobj): - if pathobj.is_file(): - log.inf(f'- removing: {pathobj}') - pathobj.unlink() - elif pathobj.is_dir(): - log.inf(f'- removing: {pathobj}') - rmtree(pathobj) + lines = run_cmake(['-P', str(path / 'zephyr_export.cmake')], + capture_output=True) + msg = [line for line in lines if not line.startswith('-- ')] + self.inf('\n'.join(msg)) From d37ae60751afca65b84d66da8e62a8ece22055c1 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Sun, 29 Sep 2024 16:22:48 +0200 Subject: [PATCH 2726/4482] scripts: west_commands: zephyr_ext_common: Remove deprecated west.log The global state west.log is deprecated, replace with WestCommand logging. Signed-off-by: Pieter De Gendt --- scripts/west_commands/zephyr_ext_common.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/west_commands/zephyr_ext_common.py b/scripts/west_commands/zephyr_ext_common.py index d2d31a620d1b3..81ca73af2922c 100644 --- a/scripts/west_commands/zephyr_ext_common.py +++ b/scripts/west_commands/zephyr_ext_common.py @@ -12,7 +12,6 @@ import shlex from pathlib import Path -from west import log from west.commands import WestCommand # This relies on this file being zephyr/scripts/foo/bar.py. @@ -44,8 +43,8 @@ def check_force(self, cond, msg): self.args.force being True can allow execution to proceed. ''' if not (cond or self.args.force): - log.err(msg) - log.die('refusing to proceed without --force due to above error') + self.err(msg) + self.die('refusing to proceed without --force due to above error') def config_get_words(self, section_key, fallback=None): unparsed = self.config.get(section_key) From 0edc89c63bf81099082cb1a697b9ae7e21eb479b Mon Sep 17 00:00:00 2001 From: Filip Kokosinski Date: Thu, 26 Sep 2024 10:36:00 +0200 Subject: [PATCH 2727/4482] dts/x86: use proper unit-address values This commit changes the way some x86 devicetree set the unit-address values of memory nodes. Before the change, they were always set to `0`. After the change, they are derived from the `DT_DRAM_BASE` macro to match the first address specified by the reg property. Signed-off-by: Filip Kokosinski --- boards/qemu/x86/qemu_x86_lakemont.dts | 4 ++-- boards/qemu/x86/qemu_x86_tiny.dts | 3 ++- dts/x86/intel/atom.dtsi | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/boards/qemu/x86/qemu_x86_lakemont.dts b/boards/qemu/x86/qemu_x86_lakemont.dts index 87056f9cf6575..b07937726310d 100644 --- a/boards/qemu/x86/qemu_x86_lakemont.dts +++ b/boards/qemu/x86/qemu_x86_lakemont.dts @@ -31,9 +31,9 @@ zephyr,shell-uart = &uart0; }; - dram0: memory@0 { + dram0: memory@DT_DRAM_BASE { device_type = "memory"; - reg = ; + reg = ; }; soc { diff --git a/boards/qemu/x86/qemu_x86_tiny.dts b/boards/qemu/x86/qemu_x86_tiny.dts index 9ce52b60d88f5..54d30c2188ca6 100644 --- a/boards/qemu/x86/qemu_x86_tiny.dts +++ b/boards/qemu/x86/qemu_x86_tiny.dts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#define DT_DRAM_BASE 0x100000 +/* Note: this is the unit-address (in hex) of the node */ +#define DT_DRAM_BASE 100000 #define DT_DRAM_SIZE DT_SIZE_K(256) #include "qemu_x86.dts" diff --git a/dts/x86/intel/atom.dtsi b/dts/x86/intel/atom.dtsi index f5a815766c116..d1d4758c3cd5a 100644 --- a/dts/x86/intel/atom.dtsi +++ b/dts/x86/intel/atom.dtsi @@ -36,9 +36,9 @@ #address-cells = <1>; }; - dram0: memory@0 { + dram0: memory@DT_DRAM_BASE { device_type = "memory"; - reg = ; + reg = ; }; soc { From d52438f43533cb9bc0e3268ba7a3b8081e64b9ba Mon Sep 17 00:00:00 2001 From: Georgij Cernysiov Date: Tue, 9 Jul 2024 12:44:14 +0200 Subject: [PATCH 2728/4482] drivers: clock_control: stm32h7: disable PLLs before configuration Disable every PLL before configuration. That allows an application to reconfigure PLLs after a bootloader configuration. Don't disable the PLL clock if it is used by (Q|O)SPI when executing from external memory. That will lead to a stall. Note: when (Q|O)SPI runs from PLL, the bootloader dictates the clock configuration. There is no clock reconfiguration support for memory map mode in (Q|O)SPI drivers. Signed-off-by: Georgij Cernysiov --- drivers/clock_control/clock_stm32_ll_h7.c | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/clock_control/clock_stm32_ll_h7.c b/drivers/clock_control/clock_stm32_ll_h7.c index a8d177dd59fb9..8c1cc884dd3b9 100644 --- a/drivers/clock_control/clock_stm32_ll_h7.c +++ b/drivers/clock_control/clock_stm32_ll_h7.c @@ -772,7 +772,36 @@ static int set_up_plls(void) stm32_clock_switch_to_hsi(); LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1); } + +#if defined(CONFIG_STM32_MEMMAP) && defined(CONFIG_BOOTLOADER_MCUBOOT) + /* + * Don't disable PLL during application initialization + * that runs in memmap mode when (Q/O)SPI uses PLL + * as its clock source. + */ +#if defined(OCTOSPI1) || defined(OCTOSPI2) + if (LL_RCC_GetOSPIClockSource(LL_RCC_OSPI_CLKSOURCE) != LL_RCC_OSPI_CLKSOURCE_PLL1Q) { + LL_RCC_PLL1_Disable(); + } + if (LL_RCC_GetOSPIClockSource(LL_RCC_OSPI_CLKSOURCE) != LL_RCC_OSPI_CLKSOURCE_PLL2R) { + LL_RCC_PLL2_Disable(); + } +#elif defined(QUADSPI) + if (LL_RCC_GetQSPIClockSource(LL_RCC_QSPI_CLKSOURCE) != LL_RCC_QSPI_CLKSOURCE_PLL1Q) { + LL_RCC_PLL1_Disable(); + } + if (LL_RCC_GetQSPIClockSource(LL_RCC_QSPI_CLKSOURCE) != LL_RCC_QSPI_CLKSOURCE_PLL2R) { + LL_RCC_PLL2_Disable(); + } +#else + LL_RCC_PLL1_Disable(); + LL_RCC_PLL2_Disable(); +#endif +#else LL_RCC_PLL1_Disable(); + LL_RCC_PLL2_Disable(); +#endif + LL_RCC_PLL3_Disable(); /* Configure PLL source */ From 27f71b044a0f5b1fa7e867bb43ad43964d5532f8 Mon Sep 17 00:00:00 2001 From: Zihao Gao Date: Wed, 30 Oct 2024 10:45:01 +0800 Subject: [PATCH 2729/4482] Bluetooth: AVCTP: Implementation of AVCTP. This patch implementing avctp.c New Kconfig BT_AVCTP is provided to enable this layer. avctp_internal.h shows the APIs for the upper layer, i.e., AVRCP. Only connection and disconnection interfaces are provided in this patch. Signed-off-by: Zihao Gao --- include/zephyr/bluetooth/uuid.h | 2 + subsys/bluetooth/Kconfig.logging | 4 + subsys/bluetooth/host/classic/CMakeLists.txt | 1 + subsys/bluetooth/host/classic/Kconfig | 6 + subsys/bluetooth/host/classic/avctp.c | 155 ++++++++++++++++++ .../bluetooth/host/classic/avctp_internal.h | 40 +++++ subsys/bluetooth/host/classic/l2cap_br.c | 5 + 7 files changed, 213 insertions(+) create mode 100644 subsys/bluetooth/host/classic/avctp.c create mode 100644 subsys/bluetooth/host/classic/avctp_internal.h diff --git a/include/zephyr/bluetooth/uuid.h b/include/zephyr/bluetooth/uuid.h index df1af452a3d21..aa0413dc13a3f 100644 --- a/include/zephyr/bluetooth/uuid.h +++ b/include/zephyr/bluetooth/uuid.h @@ -5195,6 +5195,8 @@ struct bt_uuid_128 { #define BT_UUID_HCRP_NOTE BT_UUID_DECLARE_16(BT_UUID_HCRP_NOTE_VAL) #define BT_UUID_AVCTP_VAL 0x0017 #define BT_UUID_AVCTP BT_UUID_DECLARE_16(BT_UUID_AVCTP_VAL) +#define BT_UUID_AVCTP_BROWSING_VAL 0x0018 +#define BT_UUID_AVCTP_BROWSING BT_UUID_DECLARE_16(BT_UUID_AVCTP_BROWSING_VAL) #define BT_UUID_AVDTP_VAL 0x0019 #define BT_UUID_AVDTP BT_UUID_DECLARE_16(BT_UUID_AVDTP_VAL) #define BT_UUID_CMTP_VAL 0x001b diff --git a/subsys/bluetooth/Kconfig.logging b/subsys/bluetooth/Kconfig.logging index d1a20362f7f6c..aacd3059c698f 100644 --- a/subsys/bluetooth/Kconfig.logging +++ b/subsys/bluetooth/Kconfig.logging @@ -387,6 +387,10 @@ module = BT_A2DP module-str = "Bluetooth A2DP" source "subsys/logging/Kconfig.template.log_config_inherit" +module = BT_AVCTP +module-str = "Bluetooth AVCTP" +source "subsys/logging/Kconfig.template.log_config_inherit" + module = BT_SDP module-str = "Bluetooth Service Discovery Protocol (SDP)" source "subsys/logging/Kconfig.template.log_config_inherit" diff --git a/subsys/bluetooth/host/classic/CMakeLists.txt b/subsys/bluetooth/host/classic/CMakeLists.txt index 2b70e3c6e6447..6b0934f02d8a6 100644 --- a/subsys/bluetooth/host/classic/CMakeLists.txt +++ b/subsys/bluetooth/host/classic/CMakeLists.txt @@ -7,6 +7,7 @@ zephyr_library_link_libraries(subsys__bluetooth) zephyr_library_sources_ifdef(CONFIG_BT_A2DP a2dp.c a2dp_codec_sbc.c) zephyr_library_sources_ifdef(CONFIG_BT_AVDTP avdtp.c) +zephyr_library_sources_ifdef(CONFIG_BT_AVCTP avctp.c) zephyr_library_sources_ifdef(CONFIG_BT_RFCOMM rfcomm.c) zephyr_library_sources_ifdef( diff --git a/subsys/bluetooth/host/classic/Kconfig b/subsys/bluetooth/host/classic/Kconfig index 5eb08ba3e77a4..da2b4d7428fcc 100644 --- a/subsys/bluetooth/host/classic/Kconfig +++ b/subsys/bluetooth/host/classic/Kconfig @@ -178,6 +178,12 @@ config BT_A2DP_SINK endif # BT_A2DP +config BT_AVCTP + bool "Bluetooth AVCTP protocol support [EXPERIMENTAL]" + select EXPERIMENTAL + help + This option enables Bluetooth AVCTP support + config BT_PAGE_TIMEOUT hex "Bluetooth Page Timeout" default 0x2000 diff --git a/subsys/bluetooth/host/classic/avctp.c b/subsys/bluetooth/host/classic/avctp.c new file mode 100644 index 0000000000000..ff04fb54539c9 --- /dev/null +++ b/subsys/bluetooth/host/classic/avctp.c @@ -0,0 +1,155 @@ +/** @file + * @brief Audio Video Control Transport Protocol + */ + +/* + * Copyright (c) 2015-2016 Intel Corporation + * Copyright (C) 2024 Xiaomi Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "avctp_internal.h" +#include "host/hci_core.h" +#include "host/conn_internal.h" +#include "l2cap_br_internal.h" + +#define LOG_LEVEL CONFIG_BT_AVCTP_LOG_LEVEL +#include +LOG_MODULE_REGISTER(bt_avctp); + +#define AVCTP_CHAN(_ch) CONTAINER_OF(_ch, struct bt_avctp, br_chan.chan) + +static const struct bt_avctp_event_cb *event_cb; + +static void avctp_l2cap_connected(struct bt_l2cap_chan *chan) +{ + struct bt_avctp *session; + + if (!chan) { + LOG_ERR("Invalid AVCTP chan"); + return; + } + + session = AVCTP_CHAN(chan); + LOG_DBG("chan %p session %p", chan, session); + + if (session->ops && session->ops->connected) { + session->ops->connected(session); + } +} + +static void avctp_l2cap_disconnected(struct bt_l2cap_chan *chan) +{ + struct bt_avctp *session; + + if (!chan) { + LOG_ERR("Invalid AVCTP chan"); + return; + } + + session = AVCTP_CHAN(chan); + LOG_DBG("chan %p session %p", chan, session); + session->br_chan.chan.conn = NULL; + + if (session->ops && session->ops->disconnected) { + session->ops->disconnected(session); + } +} + +static void avctp_l2cap_encrypt_changed(struct bt_l2cap_chan *chan, uint8_t status) +{ + LOG_DBG(""); +} + +static int avctp_l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) +{ + LOG_DBG(""); + + /* TODO */ + + return -ENOTSUP; +} + +int bt_avctp_connect(struct bt_conn *conn, struct bt_avctp *session) +{ + static const struct bt_l2cap_chan_ops ops = { + .connected = avctp_l2cap_connected, + .disconnected = avctp_l2cap_disconnected, + .encrypt_change = avctp_l2cap_encrypt_changed, + .recv = avctp_l2cap_recv, + }; + + if (!session) { + return -EINVAL; + } + + session->br_chan.rx.mtu = BT_L2CAP_RX_MTU; + session->br_chan.chan.ops = &ops; + session->br_chan.required_sec_level = BT_SECURITY_L2; + + return bt_l2cap_chan_connect(conn, &session->br_chan.chan, BT_L2CAP_PSM_AVCTP); +} + +int bt_avctp_disconnect(struct bt_avctp *session) +{ + if (!session) { + return -EINVAL; + } + + LOG_DBG("session %p", session); + + return bt_l2cap_chan_disconnect(&session->br_chan.chan); +} + +int bt_avctp_register(const struct bt_avctp_event_cb *cb) +{ + LOG_DBG(""); + + if (event_cb) { + return -EALREADY; + } + + event_cb = cb; + + return 0; +} + +static int avctp_l2cap_accept(struct bt_conn *conn, struct bt_l2cap_server *server, + struct bt_l2cap_chan **chan) +{ + /* TODO */ + + return -ENOTSUP; +} + +int bt_avctp_init(void) +{ + int err; + static struct bt_l2cap_server avctp_l2cap = { + .psm = BT_L2CAP_PSM_AVCTP, + .sec_level = BT_SECURITY_L2, + .accept = avctp_l2cap_accept, + }; + + LOG_DBG(""); + + /* Register AVCTP PSM with L2CAP */ + err = bt_l2cap_br_server_register(&avctp_l2cap); + if (err < 0) { + LOG_ERR("AVCTP L2CAP registration failed %d", err); + } + + return err; +} diff --git a/subsys/bluetooth/host/classic/avctp_internal.h b/subsys/bluetooth/host/classic/avctp_internal.h new file mode 100644 index 0000000000000..10f14044c1d9f --- /dev/null +++ b/subsys/bluetooth/host/classic/avctp_internal.h @@ -0,0 +1,40 @@ +/** @file + * @brief Audio Video Control Transport Protocol internal header. + */ + +/* + * Copyright (c) 2015-2016 Intel Corporation + * Copyright (C) 2024 Xiaomi Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define BT_L2CAP_PSM_AVCTP 0x0017 + +struct bt_avctp; + +struct bt_avctp_ops_cb { + void (*connected)(struct bt_avctp *session); + void (*disconnected)(struct bt_avctp *session); +}; + +struct bt_avctp { + struct bt_l2cap_br_chan br_chan; + const struct bt_avctp_ops_cb *ops; +}; + +struct bt_avctp_event_cb { + int (*accept)(struct bt_conn *conn, struct bt_avctp **session); +}; + +/* Initialize AVCTP layer*/ +int bt_avctp_init(void); + +/* Application register with AVCTP layer */ +int bt_avctp_register(const struct bt_avctp_event_cb *cb); + +/* AVCTP connect */ +int bt_avctp_connect(struct bt_conn *conn, struct bt_avctp *session); + +/* AVCTP disconnect */ +int bt_avctp_disconnect(struct bt_avctp *session); diff --git a/subsys/bluetooth/host/classic/l2cap_br.c b/subsys/bluetooth/host/classic/l2cap_br.c index e5c52d6e208fe..76c33e027049e 100644 --- a/subsys/bluetooth/host/classic/l2cap_br.c +++ b/subsys/bluetooth/host/classic/l2cap_br.c @@ -25,6 +25,7 @@ #include "l2cap_br_internal.h" #include "avdtp_internal.h" #include "a2dp_internal.h" +#include "avctp_internal.h" #include "rfcomm_internal.h" #include "sdp_internal.h" @@ -2074,6 +2075,10 @@ void bt_l2cap_br_init(void) bt_avdtp_init(); } + if (IS_ENABLED(CONFIG_BT_AVCTP)) { + bt_avctp_init(); + } + bt_sdp_init(); if (IS_ENABLED(CONFIG_BT_A2DP)) { From 70b415dab60a0acb00877b4ca88bedae15d8cd8c Mon Sep 17 00:00:00 2001 From: Zihao Gao Date: Wed, 30 Oct 2024 10:45:02 +0800 Subject: [PATCH 2730/4482] Bluetooth: AVRCP: Implemation of AVRCP. This patch implementing avrcp.c New Kconfig BT_AVRCP is provided to enable this layer. BT_AVRCP_TARGET and BT_AVRCP_CONTROLLER are then provided to enable one of the two roles independently. avrcp.h shows the APIs for the upper layer. Only connection and disconnection interfaces are provided in this patch. Signed-off-by: Zihao Gao --- include/zephyr/bluetooth/classic/avrcp.h | 78 +++++++++ subsys/bluetooth/Kconfig.logging | 4 + subsys/bluetooth/host/classic/CMakeLists.txt | 1 + subsys/bluetooth/host/classic/Kconfig | 21 +++ subsys/bluetooth/host/classic/avrcp.c | 158 ++++++++++++++++++ .../bluetooth/host/classic/avrcp_internal.h | 12 ++ subsys/bluetooth/host/classic/l2cap_br.c | 5 + 7 files changed, 279 insertions(+) create mode 100644 include/zephyr/bluetooth/classic/avrcp.h create mode 100644 subsys/bluetooth/host/classic/avrcp.c create mode 100644 subsys/bluetooth/host/classic/avrcp_internal.h diff --git a/include/zephyr/bluetooth/classic/avrcp.h b/include/zephyr/bluetooth/classic/avrcp.h new file mode 100644 index 0000000000000..b9087bb01131b --- /dev/null +++ b/include/zephyr/bluetooth/classic/avrcp.h @@ -0,0 +1,78 @@ +/** @file + * @brief Audio Video Remote Control Profile header. + */ + +/* + * Copyright (c) 2015-2016 Intel Corporation + * Copyright (C) 2024 Xiaomi Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_BLUETOOTH_AVRCP_H_ +#define ZEPHYR_INCLUDE_BLUETOOTH_AVRCP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @brief AVRCP structure */ +struct bt_avrcp; + +struct bt_avrcp_cb { + /** @brief An AVRCP connection has been established. + * + * This callback notifies the application of an avrcp connection, + * i.e., an AVCTP L2CAP connection. + * + * @param avrcp AVRCP connection object. + */ + void (*connected)(struct bt_avrcp *avrcp); + /** @brief An AVRCP connection has been disconnected. + * + * This callback notifies the application that an avrcp connection + * has been disconnected. + * + * @param avrcp AVRCP connection object. + */ + void (*disconnected)(struct bt_avrcp *avrcp); +}; + +/** @brief Connect AVRCP. + * + * This function is to be called after the conn parameter is obtained by + * performing a GAP procedure. The API is to be used to establish AVRCP + * connection between devices. + * + * @param conn Pointer to bt_conn structure. + * + * @return pointer to struct bt_avrcp in case of success or NULL in case + * of error. + */ +struct bt_avrcp *bt_avrcp_connect(struct bt_conn *conn); + +/** @brief Disconnect AVRCP. + * + * This function close AVCTP L2CAP connection. + * + * @param avrcp The AVRCP instance. + * + * @return 0 in case of success or error code in case of error. + */ +int bt_avrcp_disconnect(struct bt_avrcp *avrcp); + +/** @brief Register callback. + * + * Register AVRCP callbacks to monitor the state and interact with the remote device. + * + * @param cb The callback function. + * + * @return 0 in case of success or error code in case of error. + */ +int bt_avrcp_register_cb(const struct bt_avrcp_cb *cb); + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_BLUETOOTH_AVRCP_H_ */ diff --git a/subsys/bluetooth/Kconfig.logging b/subsys/bluetooth/Kconfig.logging index aacd3059c698f..7ccaf55c2d6be 100644 --- a/subsys/bluetooth/Kconfig.logging +++ b/subsys/bluetooth/Kconfig.logging @@ -391,6 +391,10 @@ module = BT_AVCTP module-str = "Bluetooth AVCTP" source "subsys/logging/Kconfig.template.log_config_inherit" +module = BT_AVRCP +module-str = "Bluetooth AVRCP" +source "subsys/logging/Kconfig.template.log_config_inherit" + module = BT_SDP module-str = "Bluetooth Service Discovery Protocol (SDP)" source "subsys/logging/Kconfig.template.log_config_inherit" diff --git a/subsys/bluetooth/host/classic/CMakeLists.txt b/subsys/bluetooth/host/classic/CMakeLists.txt index 6b0934f02d8a6..0f7f01d5c00b5 100644 --- a/subsys/bluetooth/host/classic/CMakeLists.txt +++ b/subsys/bluetooth/host/classic/CMakeLists.txt @@ -7,6 +7,7 @@ zephyr_library_link_libraries(subsys__bluetooth) zephyr_library_sources_ifdef(CONFIG_BT_A2DP a2dp.c a2dp_codec_sbc.c) zephyr_library_sources_ifdef(CONFIG_BT_AVDTP avdtp.c) +zephyr_library_sources_ifdef(CONFIG_BT_AVRCP avrcp.c) zephyr_library_sources_ifdef(CONFIG_BT_AVCTP avctp.c) zephyr_library_sources_ifdef(CONFIG_BT_RFCOMM rfcomm.c) diff --git a/subsys/bluetooth/host/classic/Kconfig b/subsys/bluetooth/host/classic/Kconfig index da2b4d7428fcc..5c084f0360913 100644 --- a/subsys/bluetooth/host/classic/Kconfig +++ b/subsys/bluetooth/host/classic/Kconfig @@ -184,6 +184,27 @@ config BT_AVCTP help This option enables Bluetooth AVCTP support +config BT_AVRCP + bool "Bluetooth AVRCP Profile [EXPERIMENTAL]" + select BT_AVCTP + select EXPERIMENTAL + help + This option enables the AVRCP profile + +if BT_AVRCP + +config BT_AVRCP_TARGET + bool "Bluetooth AVRCP Profile Target Function" + help + This option enables the AVRCP profile target function + +config BT_AVRCP_CONTROLLER + bool "Bluetooth AVRCP Profile Controller Function" + help + This option enables the AVRCP profile controller function + +endif # BT_AVRCP + config BT_PAGE_TIMEOUT hex "Bluetooth Page Timeout" default 0x2000 diff --git a/subsys/bluetooth/host/classic/avrcp.c b/subsys/bluetooth/host/classic/avrcp.c new file mode 100644 index 0000000000000..b6474b3786712 --- /dev/null +++ b/subsys/bluetooth/host/classic/avrcp.c @@ -0,0 +1,158 @@ +/** @file + * @brief Audio Video Remote Control Profile + */ + +/* + * Copyright (c) 2015-2016 Intel Corporation + * Copyright (C) 2024 Xiaomi Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "host/hci_core.h" +#include "host/conn_internal.h" +#include "host/l2cap_internal.h" +#include "avctp_internal.h" +#include "avrcp_internal.h" + +#define LOG_LEVEL CONFIG_BT_AVRCP_LOG_LEVEL +#include +LOG_MODULE_REGISTER(bt_avrcp); + +struct bt_avrcp { + struct bt_avctp session; +}; + +#define AVRCP_AVCTP(_avctp) CONTAINER_OF(_avctp, struct bt_avrcp, session) + +static const struct bt_avrcp_cb *avrcp_cb; +static struct bt_avrcp avrcp_connection[CONFIG_BT_MAX_CONN]; + +static struct bt_avrcp *get_new_connection(struct bt_conn *conn) +{ + struct bt_avrcp *avrcp; + + if (!conn) { + LOG_ERR("Invalid Input (err: %d)", -EINVAL); + return NULL; + } + + avrcp = &avrcp_connection[bt_conn_index(conn)]; + memset(avrcp, 0, sizeof(struct bt_avrcp)); + return avrcp; +} + +/* The AVCTP L2CAP channel established */ +static void avrcp_connected(struct bt_avctp *session) +{ + struct bt_avrcp *avrcp = AVRCP_AVCTP(session); + + if ((avrcp_cb != NULL) && (avrcp_cb->connected != NULL)) { + avrcp_cb->connected(avrcp); + } +} + +/* The AVCTP L2CAP channel released */ +static void avrcp_disconnected(struct bt_avctp *session) +{ + struct bt_avrcp *avrcp = AVRCP_AVCTP(session); + + if ((avrcp_cb != NULL) && (avrcp_cb->disconnected != NULL)) { + avrcp_cb->disconnected(avrcp); + } +} + +static const struct bt_avctp_ops_cb avctp_ops = { + .connected = avrcp_connected, + .disconnected = avrcp_disconnected, +}; + +static int avrcp_accept(struct bt_conn *conn, struct bt_avctp **session) +{ + struct bt_avrcp *avrcp; + + avrcp = get_new_connection(conn); + if (!avrcp) { + return -ENOMEM; + } + + *session = &(avrcp->session); + avrcp->session.ops = &avctp_ops; + + LOG_DBG("session: %p", &(avrcp->session)); + + return 0; +} + +static struct bt_avctp_event_cb avctp_cb = { + .accept = avrcp_accept, +}; + +int bt_avrcp_init(void) +{ + int err; + + /* Register event handlers with AVCTP */ + err = bt_avctp_register(&avctp_cb); + if (err < 0) { + LOG_ERR("AVRCP registration failed"); + return err; + } + + LOG_DBG("AVRCP Initialized successfully."); + return 0; +} + +struct bt_avrcp *bt_avrcp_connect(struct bt_conn *conn) +{ + struct bt_avrcp *avrcp; + int err; + + avrcp = get_new_connection(conn); + if (!avrcp) { + LOG_ERR("Cannot allocate memory"); + return NULL; + } + + avrcp->session.ops = &avctp_ops; + err = bt_avctp_connect(conn, &(avrcp->session)); + if (err < 0) { + /* If error occurs, undo the saving and return the error */ + memset(avrcp, 0, sizeof(struct bt_avrcp)); + LOG_DBG("AVCTP Connect failed"); + return NULL; + } + + LOG_DBG("Connection request sent"); + return avrcp; +} + +int bt_avrcp_disconnect(struct bt_avrcp *avrcp) +{ + int err; + + err = bt_avctp_disconnect(&(avrcp->session)); + if (err < 0) { + LOG_DBG("AVCTP Disconnect failed"); + return err; + } + + return err; +} + +int bt_avrcp_register_cb(const struct bt_avrcp_cb *cb) +{ + avrcp_cb = cb; + return 0; +} diff --git a/subsys/bluetooth/host/classic/avrcp_internal.h b/subsys/bluetooth/host/classic/avrcp_internal.h new file mode 100644 index 0000000000000..8e2454a6e237d --- /dev/null +++ b/subsys/bluetooth/host/classic/avrcp_internal.h @@ -0,0 +1,12 @@ +/** @file + * @brief Audio Video Remote Control Profile internal header. + */ + +/* + * Copyright (c) 2015-2016 Intel Corporation + * Copyright (C) 2024 Xiaomi Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +int bt_avrcp_init(void); diff --git a/subsys/bluetooth/host/classic/l2cap_br.c b/subsys/bluetooth/host/classic/l2cap_br.c index 76c33e027049e..d1e558a7b3d66 100644 --- a/subsys/bluetooth/host/classic/l2cap_br.c +++ b/subsys/bluetooth/host/classic/l2cap_br.c @@ -26,6 +26,7 @@ #include "avdtp_internal.h" #include "a2dp_internal.h" #include "avctp_internal.h" +#include "avrcp_internal.h" #include "rfcomm_internal.h" #include "sdp_internal.h" @@ -2084,4 +2085,8 @@ void bt_l2cap_br_init(void) if (IS_ENABLED(CONFIG_BT_A2DP)) { bt_a2dp_init(); } + + if (IS_ENABLED(CONFIG_BT_AVRCP)) { + bt_avrcp_init(); + } } From 4e0dc39e71c1d3d9c0472eb0df60432d9dec04fd Mon Sep 17 00:00:00 2001 From: Zihao Gao Date: Wed, 30 Oct 2024 10:45:02 +0800 Subject: [PATCH 2731/4482] Bluetooth: AVRCP: Add SDP attributes. This patch add SDP records for both CT and TG role. The SDP attribute would be registered according to the configuration. OBEX and Browsing commands are optional and yet not supported. SDP registration is implemented at AVRCP level to simplify the workload of the upper layer. We assume the App can have limited knowledge on SDP structures. Signed-off-by: Zihao Gao --- subsys/bluetooth/host/classic/avrcp.c | 157 ++++++++++++++++++ .../bluetooth/host/classic/avrcp_internal.h | 8 + 2 files changed, 165 insertions(+) diff --git a/subsys/bluetooth/host/classic/avrcp.c b/subsys/bluetooth/host/classic/avrcp.c index b6474b3786712..0c4bf271db828 100644 --- a/subsys/bluetooth/host/classic/avrcp.c +++ b/subsys/bluetooth/host/classic/avrcp.c @@ -18,6 +18,7 @@ #include #include +#include #include #include "host/hci_core.h" @@ -39,6 +40,154 @@ struct bt_avrcp { static const struct bt_avrcp_cb *avrcp_cb; static struct bt_avrcp avrcp_connection[CONFIG_BT_MAX_CONN]; +#if defined(CONFIG_BT_AVRCP_TARGET) +static struct bt_sdp_attribute avrcp_tg_attrs[] = { + BT_SDP_NEW_SERVICE, + BT_SDP_LIST( + BT_SDP_ATTR_SVCLASS_ID_LIST, + BT_SDP_TYPE_SIZE_VAR(BT_SDP_SEQ8, 3), + BT_SDP_DATA_ELEM_LIST( + { + BT_SDP_TYPE_SIZE(BT_SDP_UUID16), + BT_SDP_ARRAY_16(BT_SDP_AV_REMOTE_TARGET_SVCLASS) + }, + ) + ), + BT_SDP_LIST( + BT_SDP_ATTR_PROTO_DESC_LIST, + BT_SDP_TYPE_SIZE_VAR(BT_SDP_SEQ8, 16), + BT_SDP_DATA_ELEM_LIST( + { + BT_SDP_TYPE_SIZE_VAR(BT_SDP_SEQ8, 6), + BT_SDP_DATA_ELEM_LIST({BT_SDP_TYPE_SIZE(BT_SDP_UUID16), + BT_SDP_ARRAY_16(BT_SDP_PROTO_L2CAP)}, + { + BT_SDP_TYPE_SIZE(BT_SDP_UINT16), + BT_SDP_ARRAY_16(BT_UUID_AVCTP_VAL) + }, + ) + }, + { + BT_SDP_TYPE_SIZE_VAR(BT_SDP_SEQ8, 6), + BT_SDP_DATA_ELEM_LIST( + { + BT_SDP_TYPE_SIZE(BT_SDP_UUID16), + BT_SDP_ARRAY_16(BT_UUID_AVCTP_VAL) + }, + { + BT_SDP_TYPE_SIZE(BT_SDP_UINT16), + BT_SDP_ARRAY_16(AVCTP_VER_1_4) + }, + ) + }, + ) + ), + /* C1: Browsing not supported */ + /* C2: Cover Art not supported */ + BT_SDP_LIST( + BT_SDP_ATTR_PROFILE_DESC_LIST, + BT_SDP_TYPE_SIZE_VAR(BT_SDP_SEQ8, 8), + BT_SDP_DATA_ELEM_LIST( + { + BT_SDP_TYPE_SIZE_VAR(BT_SDP_SEQ8, 6), + BT_SDP_DATA_ELEM_LIST( + { + BT_SDP_TYPE_SIZE(BT_SDP_UUID16), + BT_SDP_ARRAY_16(BT_SDP_AV_REMOTE_SVCLASS) + }, + { + BT_SDP_TYPE_SIZE(BT_SDP_UINT16), + BT_SDP_ARRAY_16(AVRCP_VER_1_6) + }, + ) + }, + ) + ), + BT_SDP_SUPPORTED_FEATURES(AVRCP_CAT_1 | AVRCP_CAT_2), + /* O: Provider Name not presented */ + BT_SDP_SERVICE_NAME("AVRCP Target"), +}; + +static struct bt_sdp_record avrcp_tg_rec = BT_SDP_RECORD(avrcp_tg_attrs); +#endif /* CONFIG_BT_AVRCP_TARGET */ + +#if defined(CONFIG_BT_AVRCP_CONTROLLER) +static struct bt_sdp_attribute avrcp_ct_attrs[] = { + BT_SDP_NEW_SERVICE, + BT_SDP_LIST( + BT_SDP_ATTR_SVCLASS_ID_LIST, + BT_SDP_TYPE_SIZE_VAR(BT_SDP_SEQ8, 6), + BT_SDP_DATA_ELEM_LIST( + { + BT_SDP_TYPE_SIZE(BT_SDP_UUID16), + BT_SDP_ARRAY_16(BT_SDP_AV_REMOTE_SVCLASS) + }, + { + BT_SDP_TYPE_SIZE(BT_SDP_UUID16), + BT_SDP_ARRAY_16(BT_SDP_AV_REMOTE_CONTROLLER_SVCLASS) + }, + ) + ), + BT_SDP_LIST( + BT_SDP_ATTR_PROTO_DESC_LIST, + BT_SDP_TYPE_SIZE_VAR(BT_SDP_SEQ8, 16), + BT_SDP_DATA_ELEM_LIST( + { + BT_SDP_TYPE_SIZE_VAR(BT_SDP_SEQ8, 6), + BT_SDP_DATA_ELEM_LIST( + { + BT_SDP_TYPE_SIZE(BT_SDP_UUID16), + BT_SDP_ARRAY_16(BT_SDP_PROTO_L2CAP) + }, + { + BT_SDP_TYPE_SIZE(BT_SDP_UINT16), + BT_SDP_ARRAY_16(BT_UUID_AVCTP_VAL) + }, + ) + }, + { + BT_SDP_TYPE_SIZE_VAR(BT_SDP_SEQ8, 6), + BT_SDP_DATA_ELEM_LIST( + { + BT_SDP_TYPE_SIZE(BT_SDP_UUID16), + BT_SDP_ARRAY_16(BT_UUID_AVCTP_VAL) + }, + { + BT_SDP_TYPE_SIZE(BT_SDP_UINT16), + BT_SDP_ARRAY_16(AVCTP_VER_1_4) + }, + ) + }, + ) + ), + /* C1: Browsing not supported */ + BT_SDP_LIST( + BT_SDP_ATTR_PROFILE_DESC_LIST, + BT_SDP_TYPE_SIZE_VAR(BT_SDP_SEQ8, 8), + BT_SDP_DATA_ELEM_LIST( + { + BT_SDP_TYPE_SIZE_VAR(BT_SDP_SEQ8, 6), + BT_SDP_DATA_ELEM_LIST( + { + BT_SDP_TYPE_SIZE(BT_SDP_UUID16), + BT_SDP_ARRAY_16(BT_SDP_AV_REMOTE_SVCLASS) + }, + { + BT_SDP_TYPE_SIZE(BT_SDP_UINT16), + BT_SDP_ARRAY_16(AVRCP_VER_1_6) + }, + ) + }, + ) + ), + BT_SDP_SUPPORTED_FEATURES(AVRCP_CAT_1 | AVRCP_CAT_2), + /* O: Provider Name not presented */ + BT_SDP_SERVICE_NAME("AVRCP Controller"), +}; + +static struct bt_sdp_record avrcp_ct_rec = BT_SDP_RECORD(avrcp_ct_attrs); +#endif /* CONFIG_BT_AVRCP_CONTROLLER */ + static struct bt_avrcp *get_new_connection(struct bt_conn *conn) { struct bt_avrcp *avrcp; @@ -110,6 +259,14 @@ int bt_avrcp_init(void) return err; } +#if defined(CONFIG_BT_AVRCP_TARGET) + bt_sdp_register_service(&avrcp_tg_rec); +#endif /* CONFIG_BT_AVRCP_CONTROLLER */ + +#if defined(CONFIG_BT_AVRCP_CONTROLLER) + bt_sdp_register_service(&avrcp_ct_rec); +#endif /* CONFIG_BT_AVRCP_CONTROLLER */ + LOG_DBG("AVRCP Initialized successfully."); return 0; } diff --git a/subsys/bluetooth/host/classic/avrcp_internal.h b/subsys/bluetooth/host/classic/avrcp_internal.h index 8e2454a6e237d..ed378283c07b4 100644 --- a/subsys/bluetooth/host/classic/avrcp_internal.h +++ b/subsys/bluetooth/host/classic/avrcp_internal.h @@ -9,4 +9,12 @@ * SPDX-License-Identifier: Apache-2.0 */ +#define AVCTP_VER_1_4 (0x0104u) +#define AVRCP_VER_1_6 (0x0106u) + +#define AVRCP_CAT_1 BIT(0) /* Player/Recorder */ +#define AVRCP_CAT_2 BIT(1) /* Monitor/Amplifier */ +#define AVRCP_CAT_3 BIT(2) /* Tuner */ +#define AVRCP_CAT_4 BIT(3) /* Menu */ + int bt_avrcp_init(void); From 36acb8980353b041d345881a471cb21fe02b68d5 Mon Sep 17 00:00:00 2001 From: Zihao Gao Date: Wed, 30 Oct 2024 10:45:02 +0800 Subject: [PATCH 2732/4482] Bluetooth: AVRCP: add shell tools for AVRCP functions. Only the basic functions for establishing an AVCTP connection are provided at this stage. An BR/EDR ACL connection is necessary before AVRCP function. Register callbacks before utilizing AVRCP. Signed-off-by: Zihao Gao --- .../host/classic/shell/CMakeLists.txt | 1 + subsys/bluetooth/host/classic/shell/avrcp.c | 140 ++++++++++++++++++ 2 files changed, 141 insertions(+) create mode 100644 subsys/bluetooth/host/classic/shell/avrcp.c diff --git a/subsys/bluetooth/host/classic/shell/CMakeLists.txt b/subsys/bluetooth/host/classic/shell/CMakeLists.txt index 7710f36e5bd3d..dbf42a44cb1ac 100644 --- a/subsys/bluetooth/host/classic/shell/CMakeLists.txt +++ b/subsys/bluetooth/host/classic/shell/CMakeLists.txt @@ -4,3 +4,4 @@ zephyr_library() zephyr_library_sources(bredr.c) zephyr_library_sources_ifdef(CONFIG_BT_RFCOMM rfcomm.c) zephyr_library_sources_ifdef(CONFIG_BT_A2DP a2dp.c) +zephyr_library_sources_ifdef(CONFIG_BT_AVRCP avrcp.c) diff --git a/subsys/bluetooth/host/classic/shell/avrcp.c b/subsys/bluetooth/host/classic/shell/avrcp.c new file mode 100644 index 0000000000000..c6624df2a44e7 --- /dev/null +++ b/subsys/bluetooth/host/classic/shell/avrcp.c @@ -0,0 +1,140 @@ +/** @file + * @brief Audio Video Remote Control Profile shell functions. + */ + +/* + * Copyright (c) 2024 Xiaomi InC. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include + +#include "host/shell/bt.h" + +struct bt_avrcp *default_avrcp; +static uint8_t avrcp_registered; +static void avrcp_connected(struct bt_avrcp *avrcp) +{ + default_avrcp = avrcp; + shell_print(ctx_shell, "AVRCP connected"); +} + +static void avrcp_disconnected(struct bt_avrcp *avrcp) +{ + shell_print(ctx_shell, "AVRCP disconnected"); +} + +static struct bt_avrcp_cb avrcp_cb = { + .connected = avrcp_connected, + .disconnected = avrcp_disconnected, +}; + +static int register_cb(const struct shell *sh) +{ + int err; + + if (avrcp_registered) { + return 0; + } + + err = bt_avrcp_register_cb(&avrcp_cb); + if (!err) { + avrcp_registered = 1; + shell_print(sh, "AVRCP callbacks registered"); + } else { + shell_print(sh, "failed to register callbacks"); + } + + return err; +} + +static int cmd_register_cb(const struct shell *sh, int32_t argc, char *argv[]) +{ + if (avrcp_registered) { + shell_print(sh, "already registered"); + return 0; + } + + register_cb(sh); + + return 0; +} + +static int cmd_connect(const struct shell *sh, int32_t argc, char *argv[]) +{ + if (avrcp_registered == 0) { + if (register_cb(sh) != 0) { + return -ENOEXEC; + } + } + + if (!default_conn) { + shell_error(sh, "BR/EDR not connected"); + return -ENOEXEC; + } + + default_avrcp = bt_avrcp_connect(default_conn); + if (NULL == default_avrcp) { + shell_error(sh, "fail to connect AVRCP"); + } + + return 0; +} + +static int cmd_disconnect(const struct shell *sh, int32_t argc, char *argv[]) +{ + if (avrcp_registered == 0) { + if (register_cb(sh) != 0) { + return -ENOEXEC; + } + } + + if (default_avrcp != NULL) { + bt_avrcp_disconnect(default_avrcp); + default_avrcp = NULL; + } else { + shell_error(sh, "AVRCP is not connected"); + } + + return 0; +} + +SHELL_STATIC_SUBCMD_SET_CREATE(avrcp_cmds, + SHELL_CMD_ARG(register_cb, NULL, "register avrcp callbacks", + cmd_register_cb, 1, 0), + SHELL_CMD_ARG(connect, NULL, "

", cmd_connect, 2, 0), + SHELL_CMD_ARG(disconnect, NULL, "
", cmd_disconnect, 2, 0), + SHELL_SUBCMD_SET_END); + +static int cmd_avrcp(const struct shell *sh, size_t argc, char **argv) +{ + if (argc == 1) { + shell_help(sh); + /* sh returns 1 when help is printed */ + return 1; + } + + shell_error(sh, "%s unknown parameter: %s", argv[0], argv[1]); + + return -ENOEXEC; +} + +SHELL_CMD_ARG_REGISTER(avrcp, &avrcp_cmds, "Bluetooth AVRCP sh commands", + cmd_avrcp, 1, 1); From 3a045fbeea560a3b3ddd14ea8e92dd7e6768ec0f Mon Sep 17 00:00:00 2001 From: Zihao Gao Date: Wed, 30 Oct 2024 10:45:02 +0800 Subject: [PATCH 2733/4482] Bluetooth: AVCTP: allow to create and send AVCTP message This patch defines the message format for general AVCTP. They would be further called by AVRCP layer. Signed-off-by: Zihao Gao --- subsys/bluetooth/host/classic/avctp.c | 45 ++++++++++++++++++- .../bluetooth/host/classic/avctp_internal.h | 29 ++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/classic/avctp.c b/subsys/bluetooth/host/classic/avctp.c index ff04fb54539c9..1f437e6c1cc26 100644 --- a/subsys/bluetooth/host/classic/avctp.c +++ b/subsys/bluetooth/host/classic/avctp.c @@ -113,6 +113,49 @@ int bt_avctp_disconnect(struct bt_avctp *session) return bt_l2cap_chan_disconnect(&session->br_chan.chan); } +struct net_buf *bt_avctp_create_pdu(struct bt_avctp *session, bt_avctp_cr_t cr, + bt_avctp_ipid_t ipid, uint8_t *tid, uint16_t pid) +{ + struct net_buf *buf; + struct bt_avctp_header *hdr; + + LOG_DBG(""); + + buf = bt_l2cap_create_pdu(NULL, 0); + if (!buf) { + LOG_ERR("No buff available"); + return buf; + } + + hdr = net_buf_add(buf, sizeof(*hdr)); + hdr->cr = cr; + hdr->ipid = ipid; + hdr->pkt_type = BT_AVCTP_PKT_TYPE_SINGLE; + hdr->tid = *tid; + hdr->pid = pid; + + if (cr == BT_AVCTP_CMD) { + *tid = (*tid + 1) & 0x0F; /* Incremented by one */ + } + + LOG_DBG("cr:0x%X, tid:0x%02X", hdr->cr, hdr->tid); + return buf; +} + +int bt_avctp_send(struct bt_avctp *session, struct net_buf *buf) +{ + int err; + + err = bt_l2cap_chan_send(&session->br_chan.chan, buf); + if (err < 0) { + net_buf_unref(buf); + LOG_ERR("L2CAP send fail err = %d", err); + return err; + } + + return err; +} + int bt_avctp_register(const struct bt_avctp_event_cb *cb) { LOG_DBG(""); @@ -127,7 +170,7 @@ int bt_avctp_register(const struct bt_avctp_event_cb *cb) } static int avctp_l2cap_accept(struct bt_conn *conn, struct bt_l2cap_server *server, - struct bt_l2cap_chan **chan) + struct bt_l2cap_chan **chan) { /* TODO */ diff --git a/subsys/bluetooth/host/classic/avctp_internal.h b/subsys/bluetooth/host/classic/avctp_internal.h index 10f14044c1d9f..4e25dc1d23dae 100644 --- a/subsys/bluetooth/host/classic/avctp_internal.h +++ b/subsys/bluetooth/host/classic/avctp_internal.h @@ -11,6 +11,28 @@ #define BT_L2CAP_PSM_AVCTP 0x0017 +typedef enum __packed { + BT_AVCTP_IPID_NONE = 0b0, + BT_AVCTP_IPID_INVALID = 0b1, +} bt_avctp_ipid_t; + +typedef enum __packed { + BT_AVCTP_CMD = 0b0, + BT_AVCTP_RESPONSE = 0b1, +} bt_avctp_cr_t; + +typedef enum __packed { + BT_AVCTP_PKT_TYPE_SINGLE = 0b00, +} bt_avctp_pkt_type_t; + +struct bt_avctp_header { + uint8_t ipid: 1; /* Invalid Profile Identifier (1), otherwise zero (0) */ + uint8_t cr: 1; /* Command(0) or Respone(1) */ + uint8_t pkt_type: 2; /* Set to zero (00) for single L2CAP packet */ + uint8_t tid: 4; /* Transaction label */ + uint16_t pid; /* Profile Identifier */ +} __packed; + struct bt_avctp; struct bt_avctp_ops_cb { @@ -38,3 +60,10 @@ int bt_avctp_connect(struct bt_conn *conn, struct bt_avctp *session); /* AVCTP disconnect */ int bt_avctp_disconnect(struct bt_avctp *session); + +/* Create AVCTP PDU */ +struct net_buf *bt_avctp_create_pdu(struct bt_avctp *session, bt_avctp_cr_t cr, + bt_avctp_ipid_t ipid, uint8_t *tid, uint16_t pid); + +/* Send AVCTP PDU */ +int bt_avctp_send(struct bt_avctp *session, struct net_buf *buf); From 3d9cf59fdd788e3ca056aef72e29fe30de185353 Mon Sep 17 00:00:00 2001 From: Zihao Gao Date: Wed, 30 Oct 2024 10:45:02 +0800 Subject: [PATCH 2734/4482] Bluetooth: AVRCP: allow to create and send AVRCP unit message This patch defines the message format for AVCTP unit message. This is the first out of the four types of commands and can be used by the CT to obtain the unit info from the TG device. Signed-off-by: Zihao Gao --- include/zephyr/bluetooth/classic/avrcp.h | 10 ++ subsys/bluetooth/host/classic/avrcp.c | 93 +++++++++++++++++++ .../bluetooth/host/classic/avrcp_internal.h | 51 ++++++++++ 3 files changed, 154 insertions(+) diff --git a/include/zephyr/bluetooth/classic/avrcp.h b/include/zephyr/bluetooth/classic/avrcp.h index b9087bb01131b..92ff71f392e58 100644 --- a/include/zephyr/bluetooth/classic/avrcp.h +++ b/include/zephyr/bluetooth/classic/avrcp.h @@ -71,6 +71,16 @@ int bt_avrcp_disconnect(struct bt_avrcp *avrcp); */ int bt_avrcp_register_cb(const struct bt_avrcp_cb *cb); +/** @brief Get AVRCP Unit Info. + * + * This function obtains information that pertains to the unit as a whole. + * + * @param avrcp The AVRCP instance. + * + * @return 0 in case of success or error code in case of error. + */ +int bt_avrcp_get_unit_info(struct bt_avrcp *avrcp); + #ifdef __cplusplus } #endif diff --git a/subsys/bluetooth/host/classic/avrcp.c b/subsys/bluetooth/host/classic/avrcp.c index 0c4bf271db828..a852d8910eee9 100644 --- a/subsys/bluetooth/host/classic/avrcp.c +++ b/subsys/bluetooth/host/classic/avrcp.c @@ -33,9 +33,18 @@ LOG_MODULE_REGISTER(bt_avrcp); struct bt_avrcp { struct bt_avctp session; + struct bt_avrcp_req req; + struct k_work_delayable timeout_work; + uint8_t local_tid; }; +static struct bt_avrcp_cb *avrcp_cb; + +#define AVRCP_TIMEOUT K_SECONDS(3) /* Shell be greater than TMTP (1000ms) */ #define AVRCP_AVCTP(_avctp) CONTAINER_OF(_avctp, struct bt_avrcp, session) +#define AVRCP_KWORK(_work) \ + CONTAINER_OF(CONTAINER_OF(_work, struct k_work_delayable, work), struct bt_avrcp, \ + timeout_work) static const struct bt_avrcp_cb *avrcp_cb; static struct bt_avrcp avrcp_connection[CONFIG_BT_MAX_CONN]; @@ -202,6 +211,13 @@ static struct bt_avrcp *get_new_connection(struct bt_conn *conn) return avrcp; } +static void avrcp_timeout(struct k_work *work) +{ + struct bt_avrcp *avrcp = AVRCP_KWORK(work); + + LOG_WRN("Timeout: tid 0x%X, opc 0x%02X", avrcp->req.tid, avrcp->req.opcode); +} + /* The AVCTP L2CAP channel established */ static void avrcp_connected(struct bt_avctp *session) { @@ -210,6 +226,8 @@ static void avrcp_connected(struct bt_avctp *session) if ((avrcp_cb != NULL) && (avrcp_cb->connected != NULL)) { avrcp_cb->connected(avrcp); } + + k_work_init_delayable(&avrcp->timeout_work, avrcp_timeout); } /* The AVCTP L2CAP channel released */ @@ -308,6 +326,81 @@ int bt_avrcp_disconnect(struct bt_avrcp *avrcp) return err; } +static struct net_buf *avrcp_create_pdu(struct bt_avrcp *avrcp, bt_avctp_cr_t cr) +{ + struct net_buf *buf; + + buf = bt_avctp_create_pdu(&(avrcp->session), cr, BT_AVCTP_IPID_NONE, &avrcp->local_tid, + sys_cpu_to_be16(BT_SDP_AV_REMOTE_SVCLASS)); + + return buf; +} + +static struct net_buf *avrcp_create_unit_pdu(struct bt_avrcp *avrcp, bt_avctp_cr_t cr) +{ + struct net_buf *buf; + struct bt_avrcp_unit_info_cmd *cmd; + + buf = avrcp_create_pdu(avrcp, cr); + if (!buf) { + return buf; + } + + cmd = net_buf_add(buf, sizeof(*cmd)); + memset(cmd, 0, sizeof(*cmd)); + cmd->hdr.ctype = + (cr == BT_AVCTP_CMD) ? BT_AVRCP_CTYPE_STATUS : BT_AVRCP_CTYPE_IMPLEMENTED_STABLE; + cmd->hdr.subunit_id = BT_AVRCP_SUBUNIT_ID_IGNORE; + cmd->hdr.subunit_type = BT_AVRCP_SUBUNIT_TYPE_UNIT; + cmd->hdr.opcode = BT_AVRCP_OPC_UNIT_INFO; + + return buf; +} + +static int avrcp_send(struct bt_avrcp *avrcp, struct net_buf *buf) +{ + int err; + struct bt_avctp_header avctp_hdr; + struct bt_avrcp_header avrcp_hdr; + + memcpy(&avctp_hdr, buf->data, sizeof(avctp_hdr)); + memcpy(&avrcp_hdr, buf->data + sizeof(avctp_hdr), sizeof(avrcp_hdr)); + + LOG_DBG("AVRCP send cr:0x%X, tid:0x%X, ctype: 0x%X, opc:0x%02X\n", avctp_hdr.cr, + avctp_hdr.tid, avrcp_hdr.ctype, avrcp_hdr.opcode); + err = bt_avctp_send(&(avrcp->session), buf); + if (err < 0) { + return err; + } + + if (avctp_hdr.cr == BT_AVCTP_CMD && avrcp_hdr.opcode != BT_AVRCP_OPC_PASS_THROUGH) { + avrcp->req.tid = avctp_hdr.tid; + avrcp->req.subunit = avrcp_hdr.subunit_id; + avrcp->req.opcode = avrcp_hdr.opcode; + + k_work_reschedule(&avrcp->timeout_work, AVRCP_TIMEOUT); + /* TODO: k_work_cancel_delayable(&avrcp->timeout_work); when response received */ + } + + return 0; +} + +int bt_avrcp_get_unit_info(struct bt_avrcp *avrcp) +{ + struct net_buf *buf; + uint8_t param[5]; + + buf = avrcp_create_unit_pdu(avrcp, BT_AVCTP_CMD); + if (!buf) { + return -ENOMEM; + } + + memset(param, 0xFF, ARRAY_SIZE(param)); + net_buf_add_mem(buf, param, sizeof(param)); + + return avrcp_send(avrcp, buf); +} + int bt_avrcp_register_cb(const struct bt_avrcp_cb *cb) { avrcp_cb = cb; diff --git a/subsys/bluetooth/host/classic/avrcp_internal.h b/subsys/bluetooth/host/classic/avrcp_internal.h index ed378283c07b4..b6ea8416df0aa 100644 --- a/subsys/bluetooth/host/classic/avrcp_internal.h +++ b/subsys/bluetooth/host/classic/avrcp_internal.h @@ -17,4 +17,55 @@ #define AVRCP_CAT_3 BIT(2) /* Tuner */ #define AVRCP_CAT_4 BIT(3) /* Menu */ +typedef enum __packed { + BT_AVRCP_CTYPE_CONTROL = 0x0, + BT_AVRCP_CTYPE_STATUS = 0x1, + BT_AVRCP_CTYPE_SPECIFIC_INQUIRY = 0x2, + BT_AVRCP_CTYPE_NOTIFY = 0x3, + BT_AVRCP_CTYPE_GENERAL_INQUIRY = 0x4, + BT_AVRCP_CTYPE_NOT_IMPLEMENTED = 0x8, + BT_AVRCP_CTYPE_ACCEPTED = 0x9, + BT_AVRCP_CTYPE_REJECTED = 0xA, + BT_AVRCP_CTYPE_IN_TRANSITION = 0xB, + BT_AVRCP_CTYPE_IMPLEMENTED_STABLE = 0xC, + BT_AVRCP_CTYPE_CHANGED = 0xD, + BT_AVRCP_CTYPE_INTERIM = 0xF, +} bt_avrcp_ctype_t; + +typedef enum __packed { + BT_AVRCP_SUBUNIT_ID_ZERO = 0x0, + BT_AVRCP_SUBUNIT_ID_IGNORE = 0x7, +} bt_avrcp_subunit_id_t; + +typedef enum __packed { + BT_AVRCP_SUBUNIT_TYPE_PANEL = 0x9, + BT_AVRCP_SUBUNIT_TYPE_UNIT = 0x1F, +} bt_avrcp_subunit_type_t; + +typedef enum __packed { + BT_AVRCP_OPC_VENDOR_DEPENDENT = 0x0, + BT_AVRCP_OPC_UNIT_INFO = 0x30, + BT_AVRCP_OPC_SUBUNIT_INFO = 0x31, + BT_AVRCP_OPC_PASS_THROUGH = 0x7c, +} bt_avrcp_opcode_t; + +struct bt_avrcp_req { + uint8_t tid; + uint8_t subunit; + uint8_t opcode; +}; + +struct bt_avrcp_header { + uint8_t ctype: 4; /* Command type codes */ + uint8_t rfa: 4; /* Zero according to AV/C command frame */ + uint8_t subunit_id: 3; /* Zero (0x0) or Ignore (0x7) according to AVRCP */ + uint8_t subunit_type: 5; /* Unit (0x1F) or Panel (0x9) according to AVRCP */ + uint8_t opcode; /* Unit Info, Subunit Info, Vendor Dependent, or Pass Through */ +} __packed; + +struct bt_avrcp_unit_info_cmd { + struct bt_avrcp_header hdr; + uint8_t data[0]; +} __packed; + int bt_avrcp_init(void); From e0f1fb0bb6ee4ee1b565ccf6c1a4a0357d7d767f Mon Sep 17 00:00:00 2001 From: Zihao Gao Date: Wed, 30 Oct 2024 10:45:02 +0800 Subject: [PATCH 2735/4482] Bluetooth: Shell: add command to obtain unit info This patch allow to acquire the unit info of the remote device. Signed-off-by: Zihao Gao --- subsys/bluetooth/host/classic/shell/avrcp.c | 39 ++++++++++++++------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/subsys/bluetooth/host/classic/shell/avrcp.c b/subsys/bluetooth/host/classic/shell/avrcp.c index c6624df2a44e7..46e87e8795a67 100644 --- a/subsys/bluetooth/host/classic/shell/avrcp.c +++ b/subsys/bluetooth/host/classic/shell/avrcp.c @@ -29,7 +29,16 @@ #include "host/shell/bt.h" struct bt_avrcp *default_avrcp; -static uint8_t avrcp_registered; +static bool avrcp_registered; + +#define CHECK_REGISTER_CALLBACKS(_sh, _errno) \ + do { \ + if (!avrcp_registered) { \ + if (register_cb(_sh) != 0) \ + return _errno; \ + } \ + } while (0) + static void avrcp_connected(struct bt_avrcp *avrcp) { default_avrcp = avrcp; @@ -56,7 +65,7 @@ static int register_cb(const struct shell *sh) err = bt_avrcp_register_cb(&avrcp_cb); if (!err) { - avrcp_registered = 1; + avrcp_registered = true; shell_print(sh, "AVRCP callbacks registered"); } else { shell_print(sh, "failed to register callbacks"); @@ -79,11 +88,7 @@ static int cmd_register_cb(const struct shell *sh, int32_t argc, char *argv[]) static int cmd_connect(const struct shell *sh, int32_t argc, char *argv[]) { - if (avrcp_registered == 0) { - if (register_cb(sh) != 0) { - return -ENOEXEC; - } - } + CHECK_REGISTER_CALLBACKS(sh, -ENOEXEC); if (!default_conn) { shell_error(sh, "BR/EDR not connected"); @@ -100,11 +105,7 @@ static int cmd_connect(const struct shell *sh, int32_t argc, char *argv[]) static int cmd_disconnect(const struct shell *sh, int32_t argc, char *argv[]) { - if (avrcp_registered == 0) { - if (register_cb(sh) != 0) { - return -ENOEXEC; - } - } + CHECK_REGISTER_CALLBACKS(sh, -ENOEXEC); if (default_avrcp != NULL) { bt_avrcp_disconnect(default_avrcp); @@ -116,11 +117,25 @@ static int cmd_disconnect(const struct shell *sh, int32_t argc, char *argv[]) return 0; } +static int cmd_get_unit_info(const struct shell *sh, int32_t argc, char *argv[]) +{ + CHECK_REGISTER_CALLBACKS(sh, -ENOEXEC); + + if (default_avrcp != NULL) { + bt_avrcp_get_unit_info(default_avrcp); + } else { + shell_error(sh, "AVRCP is not connected"); + } + + return 0; +} + SHELL_STATIC_SUBCMD_SET_CREATE(avrcp_cmds, SHELL_CMD_ARG(register_cb, NULL, "register avrcp callbacks", cmd_register_cb, 1, 0), SHELL_CMD_ARG(connect, NULL, "
", cmd_connect, 2, 0), SHELL_CMD_ARG(disconnect, NULL, "
", cmd_disconnect, 2, 0), + SHELL_CMD_ARG(get_unit, NULL, "
", cmd_get_unit_info, 2, 0), SHELL_SUBCMD_SET_END); static int cmd_avrcp(const struct shell *sh, size_t argc, char **argv) From 4c932b4b80e703423845f3e6a0af512bb7fa8cc4 Mon Sep 17 00:00:00 2001 From: Zihao Gao Date: Wed, 30 Oct 2024 10:45:02 +0800 Subject: [PATCH 2736/4482] Bluetooth: AVCTP: allow to receive an AVCTP message. This patch received an AVCTP message and forward to the upper layer, e.g., AVRCP. Signed-off-by: Zihao Gao --- subsys/bluetooth/host/classic/avctp.c | 30 +++++++++++++++++-- .../bluetooth/host/classic/avctp_internal.h | 1 + 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/host/classic/avctp.c b/subsys/bluetooth/host/classic/avctp.c index 1f437e6c1cc26..7fddda2d2809e 100644 --- a/subsys/bluetooth/host/classic/avctp.c +++ b/subsys/bluetooth/host/classic/avctp.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "avctp_internal.h" #include "host/hci_core.h" @@ -75,11 +76,34 @@ static void avctp_l2cap_encrypt_changed(struct bt_l2cap_chan *chan, uint8_t stat static int avctp_l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) { - LOG_DBG(""); + struct net_buf *rsp; + struct bt_avctp *session = AVCTP_CHAN(chan); + struct bt_avctp_header *hdr = (void *)buf->data; - /* TODO */ + if (buf->len < sizeof(*hdr)) { + LOG_ERR("invalid AVCTP header received"); + return -EINVAL; + } - return -ENOTSUP; + switch (hdr->pid) { +#if defined(CONFIG_BT_AVRCP) + case sys_cpu_to_be16(BT_SDP_AV_REMOTE_SVCLASS): + break; +#endif + default: + LOG_ERR("unsupported AVCTP PID received: 0x%04x", sys_be16_to_cpu(hdr->pid)); + if (hdr->cr == BT_AVCTP_CMD) { + rsp = bt_avctp_create_pdu(session, BT_AVCTP_RESPONSE, + BT_AVCTP_IPID_INVALID, &hdr->tid, hdr->pid); + if (!rsp) { + return -ENOMEM; + } + return bt_avctp_send(session, rsp); + } + return 0; /* No need to report to the upper layer */ + } + + return session->ops->recv(session, buf); } int bt_avctp_connect(struct bt_conn *conn, struct bt_avctp *session) diff --git a/subsys/bluetooth/host/classic/avctp_internal.h b/subsys/bluetooth/host/classic/avctp_internal.h index 4e25dc1d23dae..385ec29b016a1 100644 --- a/subsys/bluetooth/host/classic/avctp_internal.h +++ b/subsys/bluetooth/host/classic/avctp_internal.h @@ -38,6 +38,7 @@ struct bt_avctp; struct bt_avctp_ops_cb { void (*connected)(struct bt_avctp *session); void (*disconnected)(struct bt_avctp *session); + int (*recv)(struct bt_avctp *session, struct net_buf *buf); }; struct bt_avctp { From 9af026dcbf4abc2000aa3e229cf8f9dc198c7af4 Mon Sep 17 00:00:00 2001 From: Zihao Gao Date: Wed, 30 Oct 2024 10:45:02 +0800 Subject: [PATCH 2737/4482] Bluetooth : AVRCP: allow to receive an AVRCP message. This patch received an AVRCP message and remove timeout timers. Signed-off-by: Zihao Gao --- subsys/bluetooth/host/classic/avctp.c | 4 +- subsys/bluetooth/host/classic/avrcp.c | 41 ++++++++++++++++++++- subsys/bluetooth/host/classic/shell/avrcp.c | 41 +++++++++++---------- 3 files changed, 64 insertions(+), 22 deletions(-) diff --git a/subsys/bluetooth/host/classic/avctp.c b/subsys/bluetooth/host/classic/avctp.c index 7fddda2d2809e..5d71a3a407263 100644 --- a/subsys/bluetooth/host/classic/avctp.c +++ b/subsys/bluetooth/host/classic/avctp.c @@ -93,8 +93,8 @@ static int avctp_l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) default: LOG_ERR("unsupported AVCTP PID received: 0x%04x", sys_be16_to_cpu(hdr->pid)); if (hdr->cr == BT_AVCTP_CMD) { - rsp = bt_avctp_create_pdu(session, BT_AVCTP_RESPONSE, - BT_AVCTP_IPID_INVALID, &hdr->tid, hdr->pid); + rsp = bt_avctp_create_pdu(session, BT_AVCTP_RESPONSE, BT_AVCTP_IPID_INVALID, + &hdr->tid, hdr->pid); if (!rsp) { return -ENOMEM; } diff --git a/subsys/bluetooth/host/classic/avrcp.c b/subsys/bluetooth/host/classic/avrcp.c index a852d8910eee9..b36fa9d428f27 100644 --- a/subsys/bluetooth/host/classic/avrcp.c +++ b/subsys/bluetooth/host/classic/avrcp.c @@ -240,9 +240,49 @@ static void avrcp_disconnected(struct bt_avctp *session) } } +/* An AVRCP message received */ +static int avrcp_recv(struct bt_avctp *session, struct net_buf *buf) +{ + struct bt_avrcp *avrcp = AVRCP_AVCTP(session); + struct bt_avctp_header *avctp_hdr; + struct bt_avrcp_header *avrcp_hdr; + + avctp_hdr = (void *)buf->data; + net_buf_pull(buf, sizeof(*avctp_hdr)); + avrcp_hdr = (void *)buf->data; + + if (avctp_hdr->pid != sys_cpu_to_be16(BT_SDP_AV_REMOTE_SVCLASS)) { + return -EINVAL; /* Ignore other profile */ + } + + LOG_DBG("AVRCP msg received, cr:0x%X, tid:0x%X, ctype: 0x%X, opc:0x%02X,", avctp_hdr->cr, + avctp_hdr->tid, avrcp_hdr->ctype, avrcp_hdr->opcode); + if (avctp_hdr->cr == BT_AVCTP_RESPONSE) { + if (avrcp_hdr->opcode == BT_AVRCP_OPC_VENDOR_DEPENDENT && + avrcp_hdr->ctype == BT_AVRCP_CTYPE_CHANGED) { + /* Status changed notifiation, do not reset timer */ + } else if (avrcp_hdr->opcode == BT_AVRCP_OPC_PASS_THROUGH) { + /* No max response time for pass through commands */ + } else if (avrcp->req.tid != avctp_hdr->tid || + avrcp->req.subunit != avrcp_hdr->subunit_id || + avrcp->req.opcode != avrcp_hdr->opcode) { + LOG_WRN("unexpected AVRCP response, expected tid:0x%X, subunit:0x%X, " + "opc:0x%02X", + avrcp->req.tid, avrcp->req.subunit, avrcp->req.opcode); + } else { + k_work_cancel_delayable(&avrcp->timeout_work); + } + } + + /* TODO: add handlers */ + + return 0; +} + static const struct bt_avctp_ops_cb avctp_ops = { .connected = avrcp_connected, .disconnected = avrcp_disconnected, + .recv = avrcp_recv, }; static int avrcp_accept(struct bt_conn *conn, struct bt_avctp **session) @@ -379,7 +419,6 @@ static int avrcp_send(struct bt_avrcp *avrcp, struct net_buf *buf) avrcp->req.opcode = avrcp_hdr.opcode; k_work_reschedule(&avrcp->timeout_work, AVRCP_TIMEOUT); - /* TODO: k_work_cancel_delayable(&avrcp->timeout_work); when response received */ } return 0; diff --git a/subsys/bluetooth/host/classic/shell/avrcp.c b/subsys/bluetooth/host/classic/shell/avrcp.c index 46e87e8795a67..4bf758f617896 100644 --- a/subsys/bluetooth/host/classic/shell/avrcp.c +++ b/subsys/bluetooth/host/classic/shell/avrcp.c @@ -31,14 +31,6 @@ struct bt_avrcp *default_avrcp; static bool avrcp_registered; -#define CHECK_REGISTER_CALLBACKS(_sh, _errno) \ - do { \ - if (!avrcp_registered) { \ - if (register_cb(_sh) != 0) \ - return _errno; \ - } \ - } while (0) - static void avrcp_connected(struct bt_avrcp *avrcp) { default_avrcp = avrcp; @@ -88,7 +80,11 @@ static int cmd_register_cb(const struct shell *sh, int32_t argc, char *argv[]) static int cmd_connect(const struct shell *sh, int32_t argc, char *argv[]) { - CHECK_REGISTER_CALLBACKS(sh, -ENOEXEC); + if (!avrcp_registered) { + if (register_cb(sh) != 0) { + return -ENOEXEC; + } + } if (!default_conn) { shell_error(sh, "BR/EDR not connected"); @@ -105,7 +101,11 @@ static int cmd_connect(const struct shell *sh, int32_t argc, char *argv[]) static int cmd_disconnect(const struct shell *sh, int32_t argc, char *argv[]) { - CHECK_REGISTER_CALLBACKS(sh, -ENOEXEC); + if (!avrcp_registered) { + if (register_cb(sh) != 0) { + return -ENOEXEC; + } + } if (default_avrcp != NULL) { bt_avrcp_disconnect(default_avrcp); @@ -119,7 +119,11 @@ static int cmd_disconnect(const struct shell *sh, int32_t argc, char *argv[]) static int cmd_get_unit_info(const struct shell *sh, int32_t argc, char *argv[]) { - CHECK_REGISTER_CALLBACKS(sh, -ENOEXEC); + if (!avrcp_registered) { + if (register_cb(sh) != 0) { + return -ENOEXEC; + } + } if (default_avrcp != NULL) { bt_avrcp_get_unit_info(default_avrcp); @@ -131,12 +135,12 @@ static int cmd_get_unit_info(const struct shell *sh, int32_t argc, char *argv[]) } SHELL_STATIC_SUBCMD_SET_CREATE(avrcp_cmds, - SHELL_CMD_ARG(register_cb, NULL, "register avrcp callbacks", - cmd_register_cb, 1, 0), - SHELL_CMD_ARG(connect, NULL, "
", cmd_connect, 2, 0), - SHELL_CMD_ARG(disconnect, NULL, "
", cmd_disconnect, 2, 0), - SHELL_CMD_ARG(get_unit, NULL, "
", cmd_get_unit_info, 2, 0), - SHELL_SUBCMD_SET_END); + SHELL_CMD_ARG(register_cb, NULL, "register avrcp callbacks", + cmd_register_cb, 1, 0), + SHELL_CMD_ARG(connect, NULL, "
", cmd_connect, 2, 0), + SHELL_CMD_ARG(disconnect, NULL, "
", cmd_disconnect, 2, 0), + SHELL_CMD_ARG(get_unit, NULL, "
", cmd_get_unit_info, 2, 0), + SHELL_SUBCMD_SET_END); static int cmd_avrcp(const struct shell *sh, size_t argc, char **argv) { @@ -151,5 +155,4 @@ static int cmd_avrcp(const struct shell *sh, size_t argc, char **argv) return -ENOEXEC; } -SHELL_CMD_ARG_REGISTER(avrcp, &avrcp_cmds, "Bluetooth AVRCP sh commands", - cmd_avrcp, 1, 1); +SHELL_CMD_ARG_REGISTER(avrcp, &avrcp_cmds, "Bluetooth AVRCP sh commands", cmd_avrcp, 1, 1); From 3e2244d6346c46cadc8f0e8321716015bca4971a Mon Sep 17 00:00:00 2001 From: Zihao Gao Date: Wed, 30 Oct 2024 10:45:03 +0800 Subject: [PATCH 2738/4482] Bluetooth: AVRCP: fix bitfield issue. The bit order can be incorrect when use bit field definition. Signed-off-by: Zihao Gao --- subsys/bluetooth/host/classic/avctp.c | 23 ++++--- .../bluetooth/host/classic/avctp_internal.h | 51 ++++++++++++++-- subsys/bluetooth/host/classic/avrcp.c | 61 +++++++++++-------- .../bluetooth/host/classic/avrcp_internal.h | 41 +++++++++++-- 4 files changed, 132 insertions(+), 44 deletions(-) diff --git a/subsys/bluetooth/host/classic/avctp.c b/subsys/bluetooth/host/classic/avctp.c index 5d71a3a407263..57d07125ecb66 100644 --- a/subsys/bluetooth/host/classic/avctp.c +++ b/subsys/bluetooth/host/classic/avctp.c @@ -79,6 +79,8 @@ static int avctp_l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) struct net_buf *rsp; struct bt_avctp *session = AVCTP_CHAN(chan); struct bt_avctp_header *hdr = (void *)buf->data; + uint8_t tid = BT_AVCTP_HDR_GET_TRANSACTION_LABLE(hdr); + bt_avctp_cr_t cr = BT_AVCTP_HDR_GET_CR(hdr); if (buf->len < sizeof(*hdr)) { LOG_ERR("invalid AVCTP header received"); @@ -92,9 +94,10 @@ static int avctp_l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) #endif default: LOG_ERR("unsupported AVCTP PID received: 0x%04x", sys_be16_to_cpu(hdr->pid)); - if (hdr->cr == BT_AVCTP_CMD) { - rsp = bt_avctp_create_pdu(session, BT_AVCTP_RESPONSE, BT_AVCTP_IPID_INVALID, - &hdr->tid, hdr->pid); + if (cr == BT_AVCTP_CMD) { + rsp = bt_avctp_create_pdu(session, BT_AVCTP_RESPONSE, + BT_AVCTP_PKT_TYPE_SINGLE, BT_AVCTP_IPID_INVALID, + &tid, hdr->pid); if (!rsp) { return -ENOMEM; } @@ -138,7 +141,8 @@ int bt_avctp_disconnect(struct bt_avctp *session) } struct net_buf *bt_avctp_create_pdu(struct bt_avctp *session, bt_avctp_cr_t cr, - bt_avctp_ipid_t ipid, uint8_t *tid, uint16_t pid) + bt_avctp_pkt_type_t pkt_type, bt_avctp_ipid_t ipid, + uint8_t *tid, uint16_t pid) { struct net_buf *buf; struct bt_avctp_header *hdr; @@ -152,17 +156,18 @@ struct net_buf *bt_avctp_create_pdu(struct bt_avctp *session, bt_avctp_cr_t cr, } hdr = net_buf_add(buf, sizeof(*hdr)); - hdr->cr = cr; - hdr->ipid = ipid; - hdr->pkt_type = BT_AVCTP_PKT_TYPE_SINGLE; - hdr->tid = *tid; + BT_AVCTP_HDR_SET_TRANSACTION_LABLE(hdr, *tid); + BT_AVCTP_HDR_SET_PACKET_TYPE(hdr, pkt_type); + BT_AVCTP_HDR_SET_CR(hdr, cr); + BT_AVCTP_HDR_SET_IPID(hdr, ipid); hdr->pid = pid; if (cr == BT_AVCTP_CMD) { *tid = (*tid + 1) & 0x0F; /* Incremented by one */ } - LOG_DBG("cr:0x%X, tid:0x%02X", hdr->cr, hdr->tid); + LOG_DBG("cr:0x%lX, tid:0x%02lX", BT_AVCTP_HDR_GET_CR(hdr), + BT_AVCTP_HDR_GET_TRANSACTION_LABLE(hdr)); return buf; } diff --git a/subsys/bluetooth/host/classic/avctp_internal.h b/subsys/bluetooth/host/classic/avctp_internal.h index 385ec29b016a1..a0ec073a71acf 100644 --- a/subsys/bluetooth/host/classic/avctp_internal.h +++ b/subsys/bluetooth/host/classic/avctp_internal.h @@ -23,16 +23,54 @@ typedef enum __packed { typedef enum __packed { BT_AVCTP_PKT_TYPE_SINGLE = 0b00, + BT_AVCTP_PKT_TYPE_START = 0b01, + BT_AVCTP_PKT_TYPE_CONTINUE = 0b10, + BT_AVCTP_PKT_TYPE_END = 0b11, } bt_avctp_pkt_type_t; struct bt_avctp_header { - uint8_t ipid: 1; /* Invalid Profile Identifier (1), otherwise zero (0) */ - uint8_t cr: 1; /* Command(0) or Respone(1) */ - uint8_t pkt_type: 2; /* Set to zero (00) for single L2CAP packet */ - uint8_t tid: 4; /* Transaction label */ - uint16_t pid; /* Profile Identifier */ + uint8_t byte0; /** [7:4]: Transaction label, [3:2]: Packet_type, [1]: C/R, [0]: IPID */ + uint16_t pid; /** Profile Identifier */ } __packed; +/** Transaction label provided by the application and is replicated by the sender of the message in + * each packet of the sequence. It isused at the receiver side to identify packets that belong to + * the same message. + */ +#define BT_AVCTP_HDR_GET_TRANSACTION_LABLE(hdr) FIELD_GET(GENMASK(7, 4), ((hdr)->byte0)) +/** Set to zero (00) to indicate that the command/response message is transmitted in a single L2CAP + * packet. Alternatively, set to (01) for start, (10) for continue, or (11) for end packet. + */ +#define BT_AVCTP_HDR_GET_PACKET_TYPE(hdr) FIELD_GET(GENMASK(3, 2), ((hdr)->byte0)) +/** Indicates whether the messageconveys a command frame (0) or a response frame (1). */ +#define BT_AVCTP_HDR_GET_CR(hdr) FIELD_GET(BIT(1), ((hdr)->byte0)) +/** The IPID bit is set in a response message to indicate an invalid Profile Identifier received in + * the command message of the same transaction; otherwise this bit is set to zero. In command + * messages this bit is set to zero. This field is only present in the start packet of the message. + */ +#define BT_AVCTP_HDR_GET_IPID(hdr) FIELD_GET(BIT(0), ((hdr)->byte0)) + +/** Transaction label provided by the application and is replicated by the sender of the message in + * each packet of the sequence. It isused at the receiver side to identify packets that belong to + * the same message. + */ +#define BT_AVCTP_HDR_SET_TRANSACTION_LABLE(hdr, tl) \ + (hdr)->byte0 = (((hdr)->byte0) & ~GENMASK(7, 4)) | FIELD_PREP(GENMASK(7, 4), (tl)) +/** Set to zero (00) to indicate that the command/response message is transmitted in a single L2CAP + * packet. Alternatively, set to (01) for start, (10) for continue, or (11) for end packet. + */ +#define BT_AVCTP_HDR_SET_PACKET_TYPE(hdr, packet_type) \ + (hdr)->byte0 = (((hdr)->byte0) & ~GENMASK(3, 2)) | FIELD_PREP(GENMASK(3, 2), (packet_type)) +/** Indicates whether the messageconveys a command frame (0) or a response frame (1). */ +#define BT_AVCTP_HDR_SET_CR(hdr, cr) \ + (hdr)->byte0 = (((hdr)->byte0) & ~BIT(1)) | FIELD_PREP(BIT(1), (cr)) +/** The IPID bit is set in a response message to indicate an invalid Profile Identifier received in + * the command message of the same transaction; otherwise this bit is set to zero. In command + * messages this bit is set to zero. This field is only present in the start packet of the message. + */ +#define BT_AVCTP_HDR_SET_IPID(hdr, ipid) \ + (hdr)->byte0 = (((hdr)->byte0) & ~BIT(0)) | FIELD_PREP(BIT(0), (ipid)) + struct bt_avctp; struct bt_avctp_ops_cb { @@ -64,7 +102,8 @@ int bt_avctp_disconnect(struct bt_avctp *session); /* Create AVCTP PDU */ struct net_buf *bt_avctp_create_pdu(struct bt_avctp *session, bt_avctp_cr_t cr, - bt_avctp_ipid_t ipid, uint8_t *tid, uint16_t pid); + bt_avctp_pkt_type_t pkt_type, bt_avctp_ipid_t ipid, + uint8_t *tid, uint16_t pid); /* Send AVCTP PDU */ int bt_avctp_send(struct bt_avctp *session, struct net_buf *buf); diff --git a/subsys/bluetooth/host/classic/avrcp.c b/subsys/bluetooth/host/classic/avrcp.c index b36fa9d428f27..edc3ba8e8408c 100644 --- a/subsys/bluetooth/host/classic/avrcp.c +++ b/subsys/bluetooth/host/classic/avrcp.c @@ -246,26 +246,36 @@ static int avrcp_recv(struct bt_avctp *session, struct net_buf *buf) struct bt_avrcp *avrcp = AVRCP_AVCTP(session); struct bt_avctp_header *avctp_hdr; struct bt_avrcp_header *avrcp_hdr; + uint8_t tid; + bt_avctp_cr_t cr; + bt_avrcp_ctype_t ctype; + bt_avrcp_subunit_id_t subunit_id; + bt_avrcp_subunit_type_t subunit_type; avctp_hdr = (void *)buf->data; net_buf_pull(buf, sizeof(*avctp_hdr)); avrcp_hdr = (void *)buf->data; + tid = BT_AVCTP_HDR_GET_TRANSACTION_LABLE(avctp_hdr); + cr = BT_AVCTP_HDR_GET_CR(avctp_hdr); + ctype = BT_AVRCP_HDR_GET_CTYPE(avrcp_hdr); + subunit_id = BT_AVRCP_HDR_GET_SUBUNIT_ID(avrcp_hdr); + subunit_type = BT_AVRCP_HDR_GET_SUBUNIT_TYPE(avrcp_hdr); + if (avctp_hdr->pid != sys_cpu_to_be16(BT_SDP_AV_REMOTE_SVCLASS)) { return -EINVAL; /* Ignore other profile */ } - LOG_DBG("AVRCP msg received, cr:0x%X, tid:0x%X, ctype: 0x%X, opc:0x%02X,", avctp_hdr->cr, - avctp_hdr->tid, avrcp_hdr->ctype, avrcp_hdr->opcode); - if (avctp_hdr->cr == BT_AVCTP_RESPONSE) { + LOG_DBG("AVRCP msg received, cr:0x%X, tid:0x%X, ctype: 0x%X, opc:0x%02X,", cr, tid, ctype, + avrcp_hdr->opcode); + if (cr == BT_AVCTP_RESPONSE) { if (avrcp_hdr->opcode == BT_AVRCP_OPC_VENDOR_DEPENDENT && - avrcp_hdr->ctype == BT_AVRCP_CTYPE_CHANGED) { + ctype == BT_AVRCP_CTYPE_CHANGED) { /* Status changed notifiation, do not reset timer */ } else if (avrcp_hdr->opcode == BT_AVRCP_OPC_PASS_THROUGH) { /* No max response time for pass through commands */ - } else if (avrcp->req.tid != avctp_hdr->tid || - avrcp->req.subunit != avrcp_hdr->subunit_id || - avrcp->req.opcode != avrcp_hdr->opcode) { + } else if (tid != avrcp->req.tid || subunit_id != avrcp->req.subunit || + avrcp_hdr->opcode != avrcp->req.opcode) { LOG_WRN("unexpected AVRCP response, expected tid:0x%X, subunit:0x%X, " "opc:0x%02X", avrcp->req.tid, avrcp->req.subunit, avrcp->req.opcode); @@ -370,7 +380,8 @@ static struct net_buf *avrcp_create_pdu(struct bt_avrcp *avrcp, bt_avctp_cr_t cr { struct net_buf *buf; - buf = bt_avctp_create_pdu(&(avrcp->session), cr, BT_AVCTP_IPID_NONE, &avrcp->local_tid, + buf = bt_avctp_create_pdu(&(avrcp->session), cr, BT_AVCTP_PKT_TYPE_SINGLE, + BT_AVCTP_IPID_NONE, &avrcp->local_tid, sys_cpu_to_be16(BT_SDP_AV_REMOTE_SVCLASS)); return buf; @@ -388,10 +399,10 @@ static struct net_buf *avrcp_create_unit_pdu(struct bt_avrcp *avrcp, bt_avctp_cr cmd = net_buf_add(buf, sizeof(*cmd)); memset(cmd, 0, sizeof(*cmd)); - cmd->hdr.ctype = - (cr == BT_AVCTP_CMD) ? BT_AVRCP_CTYPE_STATUS : BT_AVRCP_CTYPE_IMPLEMENTED_STABLE; - cmd->hdr.subunit_id = BT_AVRCP_SUBUNIT_ID_IGNORE; - cmd->hdr.subunit_type = BT_AVRCP_SUBUNIT_TYPE_UNIT; + BT_AVRCP_HDR_SET_CTYPE(&cmd->hdr, cr == BT_AVCTP_CMD ? BT_AVRCP_CTYPE_STATUS + : BT_AVRCP_CTYPE_IMPLEMENTED_STABLE); + BT_AVRCP_HDR_SET_SUBUNIT_ID(&cmd->hdr, BT_AVRCP_SUBUNIT_ID_IGNORE); + BT_AVRCP_HDR_SET_SUBUNIT_TYPE(&cmd->hdr, BT_AVRCP_SUBUNIT_TYPE_UNIT); cmd->hdr.opcode = BT_AVRCP_OPC_UNIT_INFO; return buf; @@ -400,23 +411,25 @@ static struct net_buf *avrcp_create_unit_pdu(struct bt_avrcp *avrcp, bt_avctp_cr static int avrcp_send(struct bt_avrcp *avrcp, struct net_buf *buf) { int err; - struct bt_avctp_header avctp_hdr; - struct bt_avrcp_header avrcp_hdr; - - memcpy(&avctp_hdr, buf->data, sizeof(avctp_hdr)); - memcpy(&avrcp_hdr, buf->data + sizeof(avctp_hdr), sizeof(avrcp_hdr)); - - LOG_DBG("AVRCP send cr:0x%X, tid:0x%X, ctype: 0x%X, opc:0x%02X\n", avctp_hdr.cr, - avctp_hdr.tid, avrcp_hdr.ctype, avrcp_hdr.opcode); + struct bt_avctp_header *avctp_hdr = (struct bt_avctp_header *)(buf->data); + struct bt_avrcp_header *avrcp_hdr = + (struct bt_avrcp_header *)(buf->data + sizeof(*avctp_hdr)); + uint8_t tid = BT_AVCTP_HDR_GET_TRANSACTION_LABLE(avctp_hdr); + bt_avctp_cr_t cr = BT_AVCTP_HDR_GET_CR(avctp_hdr); + bt_avrcp_ctype_t ctype = BT_AVRCP_HDR_GET_CTYPE(avrcp_hdr); + bt_avrcp_subunit_type_t subunit_id = BT_AVRCP_HDR_GET_SUBUNIT_ID(avrcp_hdr); + + LOG_DBG("AVRCP send cr:0x%X, tid:0x%X, ctype: 0x%X, opc:0x%02X\n", cr, tid, ctype, + avrcp_hdr->opcode); err = bt_avctp_send(&(avrcp->session), buf); if (err < 0) { return err; } - if (avctp_hdr.cr == BT_AVCTP_CMD && avrcp_hdr.opcode != BT_AVRCP_OPC_PASS_THROUGH) { - avrcp->req.tid = avctp_hdr.tid; - avrcp->req.subunit = avrcp_hdr.subunit_id; - avrcp->req.opcode = avrcp_hdr.opcode; + if (cr == BT_AVCTP_CMD && avrcp_hdr->opcode != BT_AVRCP_OPC_PASS_THROUGH) { + avrcp->req.tid = tid; + avrcp->req.subunit = subunit_id; + avrcp->req.opcode = avrcp_hdr->opcode; k_work_reschedule(&avrcp->timeout_work, AVRCP_TIMEOUT); } diff --git a/subsys/bluetooth/host/classic/avrcp_internal.h b/subsys/bluetooth/host/classic/avrcp_internal.h index b6ea8416df0aa..a82279d73f364 100644 --- a/subsys/bluetooth/host/classic/avrcp_internal.h +++ b/subsys/bluetooth/host/classic/avrcp_internal.h @@ -56,13 +56,44 @@ struct bt_avrcp_req { }; struct bt_avrcp_header { - uint8_t ctype: 4; /* Command type codes */ - uint8_t rfa: 4; /* Zero according to AV/C command frame */ - uint8_t subunit_id: 3; /* Zero (0x0) or Ignore (0x7) according to AVRCP */ - uint8_t subunit_type: 5; /* Unit (0x1F) or Panel (0x9) according to AVRCP */ - uint8_t opcode; /* Unit Info, Subunit Info, Vendor Dependent, or Pass Through */ + uint8_t byte0; /** [7:4]: RFA, [3:0]: Ctype */ + uint8_t byte1; /** [7:3]: Subunit_type, [2:0]: Subunit_ID */ + uint8_t opcode; /** Unit Info, Subunit Info, Vendor Dependent, or Pass Through */ } __packed; +/** The 4-bit command type or the 4-bit response code. */ +#define BT_AVRCP_HDR_GET_CTYPE(hdr) FIELD_GET(GENMASK(3, 0), ((hdr)->byte0)) +/** Taken together, the subunit_type and subunit_ID fields define the command recipient’s address + * within the target. These fields enable the target to determine whether the command is + * addressed to the target unit, or to a specific subunit within the target. The values in these + * fields remain unchanged in the response frame. + */ +#define BT_AVRCP_HDR_GET_SUBUNIT_ID(hdr) FIELD_GET(GENMASK(2, 0), ((hdr)->byte1)) +/** Taken together, the subunit_type and subunit_ID fields define the command recipient’s address + * within the target. These fields enable the target to determine whether the command is + * addressed to the target unit, or to a specific subunit within the target. The values in these + * fields remain unchanged in the response frame. + */ +#define BT_AVRCP_HDR_GET_SUBUNIT_TYPE(hdr) FIELD_GET(GENMASK(7, 3), ((hdr)->byte1)) + +/** The 4-bit command type or the 4-bit response code. */ +#define BT_AVRCP_HDR_SET_CTYPE(hdr, ctype) \ + (hdr)->byte0 = (((hdr)->byte0) & ~GENMASK(3, 0)) | FIELD_PREP(GENMASK(3, 0), (ctype)) +/** Taken together, the subunit_type and subunit_ID fields define the command recipient’s address + * within the target. These fields enable the target to determine whether the command is + * addressed to the target unit, or to a specific subunit within the target. The values in these + * fields remain unchanged in the response frame. + */ +#define BT_AVRCP_HDR_SET_SUBUNIT_ID(hdr, subunit_id) \ + (hdr)->byte1 = (((hdr)->byte1) & ~GENMASK(2, 0)) | FIELD_PREP(GENMASK(2, 0), (subunit_id)) +/** Taken together, the subunit_type and subunit_ID fields define the command recipient’s address + * within the target. These fields enable the target to determine whether the command is + * addressed to the target unit, or to a specific subunit within the target. The values in these + * fields remain unchanged in the response frame. + */ +#define BT_AVRCP_HDR_SET_SUBUNIT_TYPE(hdr, subunit_type) \ + (hdr)->byte1 = (((hdr)->byte1) & ~GENMASK(7, 3)) | FIELD_PREP(GENMASK(7, 3), (subunit_type)) + struct bt_avrcp_unit_info_cmd { struct bt_avrcp_header hdr; uint8_t data[0]; From 5d322350b49f44cd0a52772001949ac1e8961678 Mon Sep 17 00:00:00 2001 From: Zihao Gao Date: Wed, 30 Oct 2024 10:45:03 +0800 Subject: [PATCH 2739/4482] Bluetooth: AVCTP: check buffer length before use. The buffer length shall be validated before extracting Transaction ID and C/R field. Signed-off-by: Zihao Gao --- subsys/bluetooth/host/classic/avctp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/classic/avctp.c b/subsys/bluetooth/host/classic/avctp.c index 57d07125ecb66..fca58f2bbd6bb 100644 --- a/subsys/bluetooth/host/classic/avctp.c +++ b/subsys/bluetooth/host/classic/avctp.c @@ -79,14 +79,17 @@ static int avctp_l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) struct net_buf *rsp; struct bt_avctp *session = AVCTP_CHAN(chan); struct bt_avctp_header *hdr = (void *)buf->data; - uint8_t tid = BT_AVCTP_HDR_GET_TRANSACTION_LABLE(hdr); - bt_avctp_cr_t cr = BT_AVCTP_HDR_GET_CR(hdr); + uint8_t tid; + bt_avctp_cr_t cr; if (buf->len < sizeof(*hdr)) { LOG_ERR("invalid AVCTP header received"); return -EINVAL; } + tid = BT_AVCTP_HDR_GET_TRANSACTION_LABLE(hdr); + cr = BT_AVCTP_HDR_GET_CR(hdr); + switch (hdr->pid) { #if defined(CONFIG_BT_AVRCP) case sys_cpu_to_be16(BT_SDP_AV_REMOTE_SVCLASS): From 498f81e45f8f515c61e3c94232a906e1be45c0dc Mon Sep 17 00:00:00 2001 From: Zihao Gao Date: Wed, 30 Oct 2024 10:45:03 +0800 Subject: [PATCH 2740/4482] Bluetooth: AVCTP: add error handling for fragmented message. Fragmented AVCTP message is not supported now. Therefore A error message is printed. Signed-off-by: Zihao Gao --- subsys/bluetooth/host/classic/avctp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/subsys/bluetooth/host/classic/avctp.c b/subsys/bluetooth/host/classic/avctp.c index fca58f2bbd6bb..330b22ad9b827 100644 --- a/subsys/bluetooth/host/classic/avctp.c +++ b/subsys/bluetooth/host/classic/avctp.c @@ -80,6 +80,7 @@ static int avctp_l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) struct bt_avctp *session = AVCTP_CHAN(chan); struct bt_avctp_header *hdr = (void *)buf->data; uint8_t tid; + bt_avctp_pkt_type_t pkt_type; bt_avctp_cr_t cr; if (buf->len < sizeof(*hdr)) { @@ -88,8 +89,20 @@ static int avctp_l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) } tid = BT_AVCTP_HDR_GET_TRANSACTION_LABLE(hdr); + pkt_type = BT_AVCTP_HDR_GET_PACKET_TYPE(hdr); cr = BT_AVCTP_HDR_GET_CR(hdr); + switch (pkt_type) { + case BT_AVCTP_PKT_TYPE_SINGLE: + break; + case BT_AVCTP_PKT_TYPE_START: + case BT_AVCTP_PKT_TYPE_CONTINUE: + case BT_AVCTP_PKT_TYPE_END: + default: + LOG_ERR("fragmented AVCTP message is not supported, pkt_type = %d", pkt_type); + return -EINVAL; + } + switch (hdr->pid) { #if defined(CONFIG_BT_AVRCP) case sys_cpu_to_be16(BT_SDP_AV_REMOTE_SVCLASS): From 1b8ad2cf40453a61efdbc40dc3c9ba5b4036d7be Mon Sep 17 00:00:00 2001 From: Zihao Gao Date: Wed, 30 Oct 2024 10:45:03 +0800 Subject: [PATCH 2741/4482] Bluetooth: AVRCP: allow to parse unit info resposne. Add AVRCP handler for UNIT INFO responses. Signed-off-by: Zihao Gao --- include/zephyr/bluetooth/classic/avrcp.h | 13 +++++ subsys/bluetooth/host/classic/avrcp.c | 57 +++++++++++++++++++-- subsys/bluetooth/host/classic/shell/avrcp.c | 7 +++ 3 files changed, 74 insertions(+), 3 deletions(-) diff --git a/include/zephyr/bluetooth/classic/avrcp.h b/include/zephyr/bluetooth/classic/avrcp.h index 92ff71f392e58..24b5fdfe2f8f1 100644 --- a/include/zephyr/bluetooth/classic/avrcp.h +++ b/include/zephyr/bluetooth/classic/avrcp.h @@ -19,6 +19,11 @@ extern "C" { /** @brief AVRCP structure */ struct bt_avrcp; +struct bt_avrcp_unit_info_rsp { + uint8_t unit_type; + uint32_t company_id; +}; + struct bt_avrcp_cb { /** @brief An AVRCP connection has been established. * @@ -36,6 +41,14 @@ struct bt_avrcp_cb { * @param avrcp AVRCP connection object. */ void (*disconnected)(struct bt_avrcp *avrcp); + /** @brief Callback function for bt_avrcp_get_unit_info() + * + * Called when the get unit info process is completed. + * + * @param avrcp AVRCP connection object. + * @param rsp The response for UNIT INFO command. + */ + void (*unit_info_rsp)(struct bt_avrcp *avrcp, struct bt_avrcp_unit_info_rsp *rsp); }; /** @brief Connect AVRCP. diff --git a/subsys/bluetooth/host/classic/avrcp.c b/subsys/bluetooth/host/classic/avrcp.c index edc3ba8e8408c..ba8d8d063718d 100644 --- a/subsys/bluetooth/host/classic/avrcp.c +++ b/subsys/bluetooth/host/classic/avrcp.c @@ -38,7 +38,10 @@ struct bt_avrcp { uint8_t local_tid; }; -static struct bt_avrcp_cb *avrcp_cb; +struct avrcp_handler { + bt_avrcp_opcode_t opcode; + void (*func)(struct bt_avrcp *avrcp, struct net_buf *buf, bt_avctp_cr_t cr); +}; #define AVRCP_TIMEOUT K_SECONDS(3) /* Shell be greater than TMTP (1000ms) */ #define AVRCP_AVCTP(_avctp) CONTAINER_OF(_avctp, struct bt_avrcp, session) @@ -240,13 +243,56 @@ static void avrcp_disconnected(struct bt_avctp *session) } } +static void avrcp_vendor_dependent_handler(struct bt_avrcp *avrcp, struct net_buf *buf, + bt_avctp_cr_t cr) +{ + /* ToDo */ +} + +static void avrcp_unit_info_handler(struct bt_avrcp *avrcp, struct net_buf *buf, bt_avctp_cr_t cr) +{ + struct bt_avrcp_header *avrcp_hdr; + struct bt_avrcp_unit_info_rsp rsp; + + if (cr == BT_AVCTP_CMD) { + /* ToDo */ + } else { /* BT_AVCTP_RESPONSE */ + if ((avrcp_cb != NULL) && (avrcp_cb->unit_info_rsp != NULL)) { + net_buf_pull(buf, sizeof(*avrcp_hdr)); + net_buf_pull_u8(buf); /* Always 0x07 */ + rsp.unit_type = (net_buf_pull_u8(buf) >> 3); /* Bit [8:4] Shall be 0x09 */ + rsp.company_id = net_buf_pull_be24(buf); + avrcp_cb->unit_info_rsp(avrcp, &rsp); + } + } +} + +static void avrcp_subunit_info_handler(struct bt_avrcp *avrcp, struct net_buf *buf, + bt_avctp_cr_t cr) +{ + /* ToDo */ +} + +static void avrcp_pass_through_handler(struct bt_avrcp *avrcp, struct net_buf *buf, + bt_avctp_cr_t cr) +{ + /* ToDo */ +} + +static const struct avrcp_handler handler[] = { + { BT_AVRCP_OPC_VENDOR_DEPENDENT, avrcp_vendor_dependent_handler }, + { BT_AVRCP_OPC_UNIT_INFO, avrcp_unit_info_handler }, + { BT_AVRCP_OPC_SUBUNIT_INFO, avrcp_subunit_info_handler }, + { BT_AVRCP_OPC_PASS_THROUGH, avrcp_pass_through_handler }, +}; + /* An AVRCP message received */ static int avrcp_recv(struct bt_avctp *session, struct net_buf *buf) { struct bt_avrcp *avrcp = AVRCP_AVCTP(session); struct bt_avctp_header *avctp_hdr; struct bt_avrcp_header *avrcp_hdr; - uint8_t tid; + uint8_t tid, i; bt_avctp_cr_t cr; bt_avrcp_ctype_t ctype; bt_avrcp_subunit_id_t subunit_id; @@ -284,7 +330,12 @@ static int avrcp_recv(struct bt_avctp *session, struct net_buf *buf) } } - /* TODO: add handlers */ + for (i = 0U; i < ARRAY_SIZE(handler); i++) { + if (avrcp_hdr->opcode == handler[i].opcode) { + handler[i].func(avrcp, buf, cr); + return 0; + } + } return 0; } diff --git a/subsys/bluetooth/host/classic/shell/avrcp.c b/subsys/bluetooth/host/classic/shell/avrcp.c index 4bf758f617896..080f60fe5b2dc 100644 --- a/subsys/bluetooth/host/classic/shell/avrcp.c +++ b/subsys/bluetooth/host/classic/shell/avrcp.c @@ -42,9 +42,16 @@ static void avrcp_disconnected(struct bt_avrcp *avrcp) shell_print(ctx_shell, "AVRCP disconnected"); } +static void avrcp_unit_info_rsp(struct bt_avrcp *avrcp, struct bt_avrcp_unit_info_rsp *rsp) +{ + shell_print(ctx_shell, "AVRCP unit info received, unit type = 0x%02x, company_id = 0x%06x", + rsp->unit_type, rsp->company_id); +} + static struct bt_avrcp_cb avrcp_cb = { .connected = avrcp_connected, .disconnected = avrcp_disconnected, + .unit_info_rsp = avrcp_unit_info_rsp, }; static int register_cb(const struct shell *sh) From 27d918e69974744f5a4dcf7ea498e0d062bb989e Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 18 Nov 2024 09:07:47 -0500 Subject: [PATCH 2742/4482] tests: cpp: remove non-existing target nrf54h20dk@0.8.0/nrf54h20/cpurad was recently removed. Signed-off-by: Anas Nashif --- tests/lib/cpp/cxx/testcase.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/lib/cpp/cxx/testcase.yaml b/tests/lib/cpp/cxx/testcase.yaml index bd14285146d52..c6dbb68337d60 100644 --- a/tests/lib/cpp/cxx/testcase.yaml +++ b/tests/lib/cpp/cxx/testcase.yaml @@ -42,7 +42,6 @@ tests: - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad - nrf54h20dk@0.8.0/nrf54h20/cpuapp - - nrf54h20dk@0.8.0/nrf54h20/cpurad - nrf9280pdk/nrf9280/cpuapp - nrf9280pdk/nrf9280/cpurad filter: not CONFIG_HAS_RENESAS_RA_FSP From 6532c2f0bb4dc4d9365ec38a0170019adf7be316 Mon Sep 17 00:00:00 2001 From: Robin Kastberg Date: Thu, 14 Nov 2024 19:28:28 +0100 Subject: [PATCH 2743/4482] kernel: make z_is_idle_thread_entry take code ptr This is causing errors on IAR toolchain. Signed-off-by: Robin Kastberg --- kernel/include/kthread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/include/kthread.h b/kernel/include/kthread.h index d6d1b629b99d3..e2505f65b3b96 100644 --- a/kernel/include/kthread.h +++ b/kernel/include/kthread.h @@ -225,7 +225,7 @@ static ALWAYS_INLINE bool should_preempt(struct k_thread *thread, } -static inline bool z_is_idle_thread_entry(void *entry_point) +static inline bool z_is_idle_thread_entry(k_thread_entry_t entry_point) { return entry_point == idle; } From 7d63646d3573222b05c56bc19fd30882af82de6c Mon Sep 17 00:00:00 2001 From: Marcin Niestroj Date: Sat, 9 Nov 2024 15:09:15 +0100 Subject: [PATCH 2744/4482] shields: seeed_w5500: new shield Support "W5500 Ethernet Shield" manufactured by Seeed Studio. [1] https://www.seeedstudio.com/W5500-Ethernet-Shield.html Signed-off-by: Marcin Niestroj --- boards/shields/seeed_w5500/Kconfig.defconfig | 13 ++++ boards/shields/seeed_w5500/Kconfig.shield | 5 ++ boards/shields/seeed_w5500/doc/index.rst | 70 ++++++++++++++++++ .../shields/seeed_w5500/doc/seeed_w5500.webp | Bin 0 -> 15112 bytes .../shields/seeed_w5500/seeed_w5500.overlay | 15 ++++ 5 files changed, 103 insertions(+) create mode 100644 boards/shields/seeed_w5500/Kconfig.defconfig create mode 100644 boards/shields/seeed_w5500/Kconfig.shield create mode 100644 boards/shields/seeed_w5500/doc/index.rst create mode 100644 boards/shields/seeed_w5500/doc/seeed_w5500.webp create mode 100644 boards/shields/seeed_w5500/seeed_w5500.overlay diff --git a/boards/shields/seeed_w5500/Kconfig.defconfig b/boards/shields/seeed_w5500/Kconfig.defconfig new file mode 100644 index 0000000000000..72924f7ec8d31 --- /dev/null +++ b/boards/shields/seeed_w5500/Kconfig.defconfig @@ -0,0 +1,13 @@ +# Copyright (c) 2024 Marcin Niestroj +# SPDX-License-Identifier: Apache-2.0 + +if SHIELD_SEEED_W5500 + +if NETWORKING + +config NET_L2_ETHERNET + default y + +endif # NETWORKING + +endif # SHIELD_SEEED_W5500 diff --git a/boards/shields/seeed_w5500/Kconfig.shield b/boards/shields/seeed_w5500/Kconfig.shield new file mode 100644 index 0000000000000..cb5de82d457a0 --- /dev/null +++ b/boards/shields/seeed_w5500/Kconfig.shield @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Marcin Niestroj +# SPDX-License-Identifier: Apache-2.0 + +config SHIELD_SEEED_W5500 + def_bool $(shields_list_contains,seeed_w5500) diff --git a/boards/shields/seeed_w5500/doc/index.rst b/boards/shields/seeed_w5500/doc/index.rst new file mode 100644 index 0000000000000..3ba095ce0f721 --- /dev/null +++ b/boards/shields/seeed_w5500/doc/index.rst @@ -0,0 +1,70 @@ +.. _seeed_w5500: + +Seeed W5500 Ethernet Shield +########################### + +Overview +******** + +Seeed `W5500 Ethernet Shield`_ is an Arduino connector shield with: + +- `W5500`_ 10/100 MBPS stand alone Ethernet controller with on-board MAC & PHY + and 16 KiloBytes for FIFO buffer, +- SPI serial interface, +- Grove UART connector, +- Grove I2C connector, +- SD card slot. + +.. figure:: seeed_w5500.webp + :align: center + :alt: Seeed W5500 Ethernet Shield + + Seeed W5500 Ethernet Shield + +Pins Assignment of the W5500 Shield +=================================== + ++-----------------------+---------------------------------------------+ +| Shield Connector Pin | Function | ++=======================+=============================================+ +| RST | Ethernet Controller's Reset | ++-----------------------+---------------------------------------------+ +| D2 | Ethernet Controller's Interrupt Output | ++-----------------------+---------------------------------------------+ +| D10 | SPI's Chip Select | ++-----------------------+---------------------------------------------+ +| D11 | SPI's Master Output Slave Input (MOSI) | ++-----------------------+---------------------------------------------+ +| D12 | SPI's Master Input Slave Output (MISO) | ++-----------------------+---------------------------------------------+ +| D13 | SPI's Clock | ++-----------------------+---------------------------------------------+ + +Requirements +************ + +This shield can only be used with a board that provides a configuration +for Arduino connectors and defines node aliases for SPI and GPIO interfaces +(see :ref:`shields` for more details). + +Programming +*********** + +Set ``--shield seeed_w5500`` when you invoke ``west build``. For example: + +.. zephyr-app-commands:: + :zephyr-app: samples/net/dhcpv4_client + :board: nrf52840dk/nrf52840 + :shield: seeed_w5500 + :goals: build + +References +********** + +.. target-notes:: + +.. _W5500: + https://wiznet.io/products/iethernet-chips/w5500 + +.. _W5500 Ethernet Shield: + https://wiki.seeedstudio.com/W5500_Ethernet_Shield_v1.0 diff --git a/boards/shields/seeed_w5500/doc/seeed_w5500.webp b/boards/shields/seeed_w5500/doc/seeed_w5500.webp new file mode 100644 index 0000000000000000000000000000000000000000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BV-P!O}BP0cJN$i39(C6HgXdVx>!R3X)DIcw;01~@gZiGYp7ihDmJanMV@U;0T zAVd8FV2CzFHm%118jNqrTvLg+ZS?Lp7}rNQhS7qAeSt+!5R#1M;XW7=@~(C>{|?)x z+XyV+bVl_9;+nPN+zjy ztM;?Q>IMVt7o;XfMet6`&d1%I;D$Y9h|FVsL|i87?)+TnqQuNtb(rHZR<1jpHwFbco+lef@(kEN6F8$qHtm zKeRa8kBR<+Y+QS%uG2X!yoO0`8VZ5b2q4V*YfoR`1+l0|CW+3+pX0h@KVVm@d`5LhbaVJ_&2z+nBOajg;|GweQkfSyv`Utbe+5Llz}(PYan7K? zCKNGY86X=oZ6r<#qs*GNhf{DDEO>z#?#W@s`y3_V?1^+kcKO+_-GPNpvPr_6>EprJ zRpd}8N`By&p|xOsj+FvgMtM9x$a_phsC_1_aYTL2=-C%UwbDZ}K05}3Vg;oZIj$We qn?V3f&lz#bpxjTGrA^kcX|NnE2t;)svWuW%$`>;M6UFZv{D1(d3NBLs literal 0 HcmV?d00001 diff --git a/boards/shields/seeed_w5500/seeed_w5500.overlay b/boards/shields/seeed_w5500/seeed_w5500.overlay new file mode 100644 index 0000000000000..9551c0f0e3ae7 --- /dev/null +++ b/boards/shields/seeed_w5500/seeed_w5500.overlay @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2024 Marcin Niestroj + * SPDX-License-Identifier: Apache-2.0 + */ + +&arduino_spi { + status = "okay"; + + eth_w5500: eth-w5500@0 { + compatible = "wiznet,w5500"; + reg = <0x0>; + spi-max-frequency = ; + int-gpios = <&arduino_header 8 GPIO_ACTIVE_LOW>; /* D2 */ + }; +}; From 4a2f89bcc668f253f1c28b5dfcb654797ea842af Mon Sep 17 00:00:00 2001 From: Jianxiong Gu Date: Tue, 5 Nov 2024 04:18:31 +0800 Subject: [PATCH 2745/4482] drivers: tcpc: ps8xxx: Remove unreachable return Remove unreachable return in ps8xxx_tcpc_vconn_discharge. Signed-off-by: Jianxiong Gu --- drivers/usb_c/tcpc/ps8xxx.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/usb_c/tcpc/ps8xxx.c b/drivers/usb_c/tcpc/ps8xxx.c index ff78f22779f96..933764865e638 100644 --- a/drivers/usb_c/tcpc/ps8xxx.c +++ b/drivers/usb_c/tcpc/ps8xxx.c @@ -189,8 +189,6 @@ int ps8xxx_tcpc_vconn_discharge(const struct device *dev, bool enable) return tcpci_update_reg8(&cfg->bus, TCPC_REG_POWER_CTRL, TCPC_REG_POWER_CTRL_AUTO_DISCHARGE_DISCONNECT, (enable) ? TCPC_REG_POWER_CTRL_AUTO_DISCHARGE_DISCONNECT : 0); - - return -EIO; } int ps8xxx_tcpc_set_vconn(const struct device *dev, bool enable) From 513aa787a4de39648512b7e179270129eee4670d Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Fri, 1 Nov 2024 16:38:44 +0200 Subject: [PATCH 2746/4482] dma: add channel release callback This is useful for releasing channel resources "allocated" during channel request. These resources can refer to enabled IRQs, PDs, etc... Signed-off-by: Laurentiu Mihalcea --- include/zephyr/drivers/dma.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/include/zephyr/drivers/dma.h b/include/zephyr/drivers/dma.h index b7853ed8badea..bebe88a130875 100644 --- a/include/zephyr/drivers/dma.h +++ b/include/zephyr/drivers/dma.h @@ -352,6 +352,20 @@ typedef int (*dma_api_get_attribute)(const struct device *dev, uint32_t type, ui typedef bool (*dma_api_chan_filter)(const struct device *dev, int channel, void *filter_param); +/** + * @typedef dma_chan_release + * @brief channel release function call + * + * used to release channel resources "allocated" during the + * request phase. These resources can refer to enabled PDs, IRQs + * etc... + * + * @param dev Pointer to the DMA device instance + * @param channel channel id to use + */ +typedef void (*dma_api_chan_release)(const struct device *dev, + uint32_t channel); + __subsystem struct dma_driver_api { dma_api_config config; dma_api_reload reload; @@ -362,6 +376,7 @@ __subsystem struct dma_driver_api { dma_api_get_status get_status; dma_api_get_attribute get_attribute; dma_api_chan_filter chan_filter; + dma_api_chan_release chan_release; }; /** * @endcond @@ -595,6 +610,8 @@ __syscall void dma_release_channel(const struct device *dev, static inline void z_impl_dma_release_channel(const struct device *dev, uint32_t channel) { + const struct dma_driver_api *api = + (const struct dma_driver_api *)dev->api; struct dma_context *dma_ctx = (struct dma_context *)dev->data; if (dma_ctx->magic != DMA_MAGIC) { @@ -602,6 +619,10 @@ static inline void z_impl_dma_release_channel(const struct device *dev, } if ((int)channel < dma_ctx->dma_channels) { + if (api->chan_release) { + api->chan_release(dev, channel); + } + atomic_clear_bit(dma_ctx->atomic, channel); } From 4789820722f36d523830daa540524ef0a4230dce Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Fri, 1 Nov 2024 16:27:59 +0200 Subject: [PATCH 2747/4482] dma: remove isr-ok tag from channel request and release The channel filter and release functions can be used by some DMA drivers to perform blocking operations (i.e: allocating, de-allocating channel resources). In such scenarios, the channel request and release functions become unsuitable for usage inside ISRs. Drop the `isr-ok` tag and add comments regarding this behavior being driver-dependent. Signed-off-by: Laurentiu Mihalcea --- include/zephyr/drivers/dma.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/zephyr/drivers/dma.h b/include/zephyr/drivers/dma.h index bebe88a130875..5237f78b70d3a 100644 --- a/include/zephyr/drivers/dma.h +++ b/include/zephyr/drivers/dma.h @@ -553,7 +553,9 @@ static inline int z_impl_dma_resume(const struct device *dev, uint32_t channel) * request DMA channel resources * return -EINVAL if there is no valid channel available. * - * @funcprops \isr_ok + * @note It is safe to use this function in contexts where blocking + * is not allowed, e.g. ISR, provided the implementation of the filter + * function does not block. * * @param dev Pointer to the device structure for the driver instance. * @param filter_param filter function parameter @@ -598,7 +600,9 @@ static inline int z_impl_dma_request_channel(const struct device *dev, * * release DMA channel resources * - * @funcprops \isr_ok + * @note It is safe to use this function in contexts where blocking + * is not allowed, e.g. ISR, provided the implementation of the release + * function does not block. * * @param dev Pointer to the device structure for the driver instance. * @param channel channel number From a785548df6353dafe362579af6859d3d02458dbb Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 14 Nov 2024 19:47:42 +0100 Subject: [PATCH 2748/4482] bluetooth: CTS: Fix includes to avoid build error with some libCs Remove unnecessary include in header and source file. gmtime_r() is an extension to the C library, and therefore one needs to explicitly ask for its prototype to have it exposed. This is done by defining _POSIX_C_SOURCE so let's do so. These two changes fix build errors with some libCs. Tested with pico, newlib, minimal and the host glibc. Signed-off-by: Alberto Escolar Piedras --- include/zephyr/bluetooth/services/cts.h | 1 - subsys/bluetooth/services/cts.c | 13 +++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/zephyr/bluetooth/services/cts.h b/include/zephyr/bluetooth/services/cts.h index 46fb7808cc4ee..5b1c780f68615 100644 --- a/include/zephyr/bluetooth/services/cts.h +++ b/include/zephyr/bluetooth/services/cts.h @@ -16,7 +16,6 @@ */ #include -#include #ifdef __cplusplus extern "C" { diff --git a/subsys/bluetooth/services/cts.c b/subsys/bluetooth/services/cts.c index ce72f7728e019..d5744bc5a2480 100644 --- a/subsys/bluetooth/services/cts.c +++ b/subsys/bluetooth/services/cts.c @@ -7,9 +7,17 @@ * * SPDX-License-Identifier: Apache-2.0 */ + +#undef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 200809L /* To get gmtime_r()'s prototype */ + +#ifdef CONFIG_BT_CTS_HELPER_API +#include +#include +#endif + #include #include -#include #include #include @@ -26,9 +34,6 @@ static const struct bt_cts_cb *cts_cb; #ifdef CONFIG_BT_CTS_HELPER_API -#include -#include - int bt_cts_time_to_unix_ms(const struct bt_cts_time_format *ct_time, int64_t *unix_ms) { struct tm date_time; From 2f3a70ea4eb21f248e353500fe3e8563560e8eab Mon Sep 17 00:00:00 2001 From: Dane Wagner Date: Wed, 13 Nov 2024 12:36:28 -0600 Subject: [PATCH 2749/4482] drivers: i2c: Call correct I2C device definition macros If CONFIG_I2C_STATS is enabled, the device state for all I2C controller drivers must contain the I2C stats. This space is allocated by calling Z_I2C_INIT_FN as part of the device definition; this is done automatically when using I2C_DEVICE_DT_DEFINE instead of DEVICE_DT_DEFINE. If space for statistics is not properly allocated but CONFIG_I2C_STATS is enabled, an unexpected write to memory outside of the stats region may occur on an I2C transfer. This commit uses I2C_DEVICE_DT_DEFINE or I2C_DEVICE_DT_INST_DEFINE for all in-tree SPI controller drivers that do not already. Signed-off-by: Dane Wagner --- drivers/i2c/gpio_i2c_switch.c | 2 +- drivers/i2c/i2c_ene_kb1200.c | 2 +- drivers/i2c/i2c_mchp_mss.c | 5 +++-- drivers/i2c/i2c_sc18im704.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/gpio_i2c_switch.c b/drivers/i2c/gpio_i2c_switch.c index 5276beb084d01..1564f37006679 100644 --- a/drivers/i2c/gpio_i2c_switch.c +++ b/drivers/i2c/gpio_i2c_switch.c @@ -91,7 +91,7 @@ static int gpio_i2c_switch_init(const struct device *dev) .gpio = GPIO_DT_SPEC_GET(DT_DRV_INST(inst), gpios), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, gpio_i2c_switch_init, device_pm_control_nop, \ + I2C_DEVICE_DT_INST_DEFINE(inst, gpio_i2c_switch_init, device_pm_control_nop, \ &gpio_i2c_switch_dev_data_##inst, &gpio_i2c_switch_dev_cfg_##inst, \ POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, &gpio_i2c_switch_api_funcs); diff --git a/drivers/i2c/i2c_ene_kb1200.c b/drivers/i2c/i2c_ene_kb1200.c index 021c123fe98f8..322efd2e30c51 100644 --- a/drivers/i2c/i2c_ene_kb1200.c +++ b/drivers/i2c/i2c_ene_kb1200.c @@ -352,7 +352,7 @@ static int i2c_kb1200_init(const struct device *dev) .fsmbm = (struct fsmbm_regs *)DT_INST_REG_ADDR(inst), \ .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ }; \ - DEVICE_DT_INST_DEFINE(inst, &i2c_kb1200_init, NULL, &i2c_kb1200_data_##inst, \ + I2C_DEVICE_DT_INST_DEFINE(inst, &i2c_kb1200_init, NULL, &i2c_kb1200_data_##inst, \ &i2c_kb1200_config_##inst, PRE_KERNEL_1, \ CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &i2c_kb1200_api); diff --git a/drivers/i2c/i2c_mchp_mss.c b/drivers/i2c/i2c_mchp_mss.c index 721192e281ab7..ef132c6182cbf 100644 --- a/drivers/i2c/i2c_mchp_mss.c +++ b/drivers/i2c/i2c_mchp_mss.c @@ -382,7 +382,8 @@ static void mss_i2c_irq_handler(const struct device *dev) .clock_freq = DT_INST_PROP(n, clock_frequency), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, mss_i2c_init_##n, NULL, &mss_i2c_data_##n, &mss_i2c_config_##n, \ - PRE_KERNEL_1, CONFIG_I2C_INIT_PRIORITY, &mss_i2c_driver_api); + I2C_DEVICE_DT_INST_DEFINE(n, mss_i2c_init_##n, NULL, &mss_i2c_data_##n, \ + &mss_i2c_config_##n, PRE_KERNEL_1, CONFIG_I2C_INIT_PRIORITY, \ + &mss_i2c_driver_api); DT_INST_FOREACH_STATUS_OKAY(MSS_I2C_INIT) diff --git a/drivers/i2c/i2c_sc18im704.c b/drivers/i2c/i2c_sc18im704.c index 5bee2c546aae5..64ea3482b28af 100644 --- a/drivers/i2c/i2c_sc18im704.c +++ b/drivers/i2c/i2c_sc18im704.c @@ -340,7 +340,7 @@ static const struct i2c_driver_api i2c_sc18im_driver_api = { .i2c_config = I2C_MODE_CONTROLLER | (I2C_SPEED_STANDARD << I2C_SPEED_SHIFT), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, i2c_sc18im_init, NULL, \ + I2C_DEVICE_DT_INST_DEFINE(n, i2c_sc18im_init, NULL, \ &i2c_sc18im_data_##n, &i2c_sc18im_config_##n, \ POST_KERNEL, CONFIG_I2C_SC18IM704_INIT_PRIORITY, \ &i2c_sc18im_driver_api); From 96d4f84a5269fb3216fb7aab45693f8f3dcc38ca Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 11 Nov 2024 16:40:15 +0200 Subject: [PATCH 2750/4482] net: socket: Add support for IPV6_MULTICAST_IF option Allow user to set the network interface for multicast sockets of type SOCK_DGRAM. Signed-off-by: Jukka Rissanen --- include/zephyr/net/net_context.h | 7 ++ include/zephyr/net/socket.h | 3 + subsys/net/ip/net_context.c | 143 ++++++++++++++++++++++++-- subsys/net/lib/sockets/sockets_inet.c | 22 ++++ 4 files changed, 169 insertions(+), 6 deletions(-) diff --git a/include/zephyr/net/net_context.h b/include/zephyr/net/net_context.h index 6b7e2a7e233e8..6da6adefc55e5 100644 --- a/include/zephyr/net/net_context.h +++ b/include/zephyr/net/net_context.h @@ -361,6 +361,12 @@ __net_socket struct net_context { * see RFC 5014 for details. */ uint16_t addr_preferences; + + /** + * IPv6 multicast output network interface for this context/socket. + * Only allowed for SOCK_DGRAM or SOCK_RAW type sockets. + */ + uint8_t ipv6_mcast_ifindex; #endif #if defined(CONFIG_NET_CONTEXT_TIMESTAMPING) /** Enable RX, TX or both timestamps of packets send through sockets. */ @@ -1292,6 +1298,7 @@ enum net_context_option { NET_OPT_TTL = 16, /**< IPv4 unicast TTL */ NET_OPT_ADDR_PREFERENCES = 17, /**< IPv6 address preference */ NET_OPT_TIMESTAMPING = 18, /**< Packet timestamping */ + NET_OPT_MCAST_IFINDEX = 19, /**< IPv6 multicast output network interface index */ NET_OPT_MTU = 20, /**< IPv4 socket path MTU */ }; diff --git a/include/zephyr/net/socket.h b/include/zephyr/net/socket.h index 06fd0be5ffacd..19850d0163154 100644 --- a/include/zephyr/net/socket.h +++ b/include/zephyr/net/socket.h @@ -1222,6 +1222,9 @@ struct ip_mreqn { /** Set the unicast hop limit for the socket. */ #define IPV6_UNICAST_HOPS 16 +/** Set multicast output network interface index for the socket. */ +#define IPV6_MULTICAST_IF 17 + /** Set the multicast hop limit for the socket. */ #define IPV6_MULTICAST_HOPS 18 diff --git a/subsys/net/ip/net_context.c b/subsys/net/ip/net_context.c index 0d304e624eb1c..9ba4d21b2c4a0 100644 --- a/subsys/net/ip/net_context.c +++ b/subsys/net/ip/net_context.c @@ -767,6 +767,17 @@ int net_context_bind(struct net_context *context, const struct sockaddr *addr, if (net_ipv6_is_addr_mcast(&addr6->sin6_addr)) { struct net_if_mcast_addr *maddr; + if (IS_ENABLED(CONFIG_NET_UDP) && + net_context_get_type(context) == SOCK_DGRAM) { + if (COND_CODE_1(CONFIG_NET_IPV6, + (context->options.ipv6_mcast_ifindex > 0), + (false))) { + IF_ENABLED(CONFIG_NET_IPV6, + (iface = net_if_get_by_index( + context->options.ipv6_mcast_ifindex))); + } + } + maddr = net_if_ipv6_maddr_lookup(&addr6->sin6_addr, &iface); if (!maddr) { @@ -1830,6 +1841,55 @@ static int get_context_mtu(struct net_context *context, return 0; } +static int get_context_mcast_ifindex(struct net_context *context, + void *value, size_t *len) +{ +#if defined(CONFIG_NET_IPV6) + if (net_context_get_family(context) != AF_INET6) { + return -EAFNOSUPPORT; + } + + /* If user has not set the ifindex, then get the interface + * that this socket is bound to. + */ + if (context->options.ipv6_mcast_ifindex == 0) { + struct net_if *iface; + int ifindex; + + if (net_context_is_bound_to_iface(context)) { + iface = net_context_get_iface(context); + } else { + iface = net_if_get_default(); + } + + if (!net_if_flag_is_set(iface, NET_IF_IPV6)) { + return -EPROTOTYPE; + } + + ifindex = net_if_get_by_iface(iface); + if (ifindex < 1) { + return -ENOENT; + } + + *((int *)value) = ifindex; + } else { + *((int *)value) = context->options.ipv6_mcast_ifindex; + } + + if (len) { + *len = sizeof(int); + } + + return 0; +#else + ARG_UNUSED(context); + ARG_UNUSED(value); + ARG_UNUSED(len); + + return -ENOTSUP; +#endif +} + /* If buf is not NULL, then use it. Otherwise read the data to be written * to net_pkt from msghdr. */ @@ -2007,7 +2067,7 @@ static int context_sendto(struct net_context *context, bool sendto) { const struct msghdr *msghdr = NULL; - struct net_if *iface; + struct net_if *iface = NULL; struct net_pkt *pkt = NULL; sa_family_t family; size_t tmp_len; @@ -2067,6 +2127,17 @@ static int context_sendto(struct net_context *context, return -EDESTADDRREQ; } + if (IS_ENABLED(CONFIG_NET_UDP) && + net_context_get_type(context) == SOCK_DGRAM) { + if (net_ipv6_is_addr_mcast(&addr6->sin6_addr) && + COND_CODE_1(CONFIG_NET_IPV6, + (context->options.ipv6_mcast_ifindex > 0), (false))) { + IF_ENABLED(CONFIG_NET_IPV6, + (iface = net_if_get_by_index( + context->options.ipv6_mcast_ifindex))); + } + } + /* If application has not yet set the destination address * i.e., by not calling connect(), then set the interface * here so that the packet gets sent to the correct network @@ -2074,11 +2145,13 @@ static int context_sendto(struct net_context *context, * network interfaces and we are trying to send data to * second or later network interface. */ - if (net_ipv6_is_addr_unspecified( - &net_sin6(&context->remote)->sin6_addr) && - !net_context_is_bound_to_iface(context)) { - iface = net_if_ipv6_select_src_iface(&addr6->sin6_addr); - net_context_set_iface(context, iface); + if (iface == NULL) { + if (net_ipv6_is_addr_unspecified( + &net_sin6(&context->remote)->sin6_addr) && + !net_context_is_bound_to_iface(context)) { + iface = net_if_ipv6_select_src_iface(&addr6->sin6_addr); + net_context_set_iface(context, iface); + } } } else if (IS_ENABLED(CONFIG_NET_IPV4) && family == AF_INET) { @@ -3211,6 +3284,58 @@ static int set_context_timestamping(struct net_context *context, #endif } +static int set_context_mcast_ifindex(struct net_context *context, + const void *value, size_t len) +{ +#if defined(CONFIG_NET_IPV6) + int mcast_ifindex = *((int *)value); + enum net_sock_type type; + struct net_if *iface; + + if (net_context_get_family(context) != AF_INET6) { + return -EAFNOSUPPORT; + } + + if (len != sizeof(int)) { + return -EINVAL; + } + + type = net_context_get_type(context); + if (type != SOCK_DGRAM && type != SOCK_RAW) { + return -EINVAL; + } + + /* optlen equal to 0 then remove the binding */ + if (mcast_ifindex == 0) { + context->options.ipv6_mcast_ifindex = 0; + return 0; + } + + if (mcast_ifindex < 1 || mcast_ifindex > 255) { + return -EINVAL; + } + + iface = net_if_get_by_index(mcast_ifindex); + if (iface == NULL) { + return -ENOENT; + } + + if (!net_if_flag_is_set(iface, NET_IF_IPV6)) { + return -EPROTOTYPE; + } + + context->options.ipv6_mcast_ifindex = mcast_ifindex; + + return 0; +#else + ARG_UNUSED(context); + ARG_UNUSED(value); + ARG_UNUSED(len); + + return -ENOTSUP; +#endif +} + int net_context_set_option(struct net_context *context, enum net_context_option option, const void *value, size_t len) @@ -3290,6 +3415,9 @@ int net_context_set_option(struct net_context *context, ret = set_context_ipv6_mtu(context, value, len); } + break; + case NET_OPT_MCAST_IFINDEX: + ret = set_context_mcast_ifindex(context, value, len); break; } @@ -3370,6 +3498,9 @@ int net_context_get_option(struct net_context *context, case NET_OPT_MTU: ret = get_context_mtu(context, value, len); break; + case NET_OPT_MCAST_IFINDEX: + ret = get_context_mcast_ifindex(context, value, len); + break; } k_mutex_unlock(&context->lock); diff --git a/subsys/net/lib/sockets/sockets_inet.c b/subsys/net/lib/sockets/sockets_inet.c index 8e5673208aa3e..28103d5bad2dc 100644 --- a/subsys/net/lib/sockets/sockets_inet.c +++ b/subsys/net/lib/sockets/sockets_inet.c @@ -1931,6 +1931,17 @@ int zsock_getsockopt_ctx(struct net_context *ctx, int level, int optname, return 0; + case IPV6_MULTICAST_IF: + ret = net_context_get_option(ctx, + NET_OPT_MCAST_IFINDEX, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + case IPV6_MULTICAST_HOPS: ret = net_context_get_option(ctx, NET_OPT_MCAST_HOP_LIMIT, @@ -2524,6 +2535,17 @@ int zsock_setsockopt_ctx(struct net_context *ctx, int level, int optname, return 0; + case IPV6_MULTICAST_IF: + ret = net_context_set_option(ctx, + NET_OPT_MCAST_IFINDEX, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + case IPV6_MULTICAST_HOPS: ret = net_context_set_option(ctx, NET_OPT_MCAST_HOP_LIMIT, From 7bf9f599b189eba8c01eed2d7c1277891534cf8d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 12 Nov 2024 15:43:38 +0200 Subject: [PATCH 2751/4482] drivers: net: loopback: Allow tests to control address swapping Some of the network tests require that source and destination addresses are not swapped so allow test to control the address swapping from the test. Signed-off-by: Jukka Rissanen --- drivers/net/loopback.c | 35 +++++++++++++++++++++++++---------- subsys/net/ip/net_private.h | 4 ++++ 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 4340c07df2b30..7a47ab577d8c7 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c @@ -25,6 +25,16 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include +/* Allow network tests to control the IP addresses swapping */ +#if defined(CONFIG_NET_TEST) +static bool loopback_dont_swap_addresses; + +void loopback_enable_address_swap(bool swap_addresses) +{ + loopback_dont_swap_addresses = !swap_addresses; +} +#endif /* CONFIG_NET_TEST */ + int loopback_dev_init(const struct device *dev) { ARG_UNUSED(dev); @@ -123,17 +133,22 @@ static int loopback_send(const struct device *dev, struct net_pkt *pkt) /* We need to swap the IP addresses because otherwise * the packet will be dropped. + * + * Some of the network tests require that addresses are not swapped so allow + * the test to control this remotely. */ - if (net_pkt_family(pkt) == AF_INET6) { - net_ipv6_addr_copy_raw(NET_IPV6_HDR(cloned)->src, - NET_IPV6_HDR(pkt)->dst); - net_ipv6_addr_copy_raw(NET_IPV6_HDR(cloned)->dst, - NET_IPV6_HDR(pkt)->src); - } else { - net_ipv4_addr_copy_raw(NET_IPV4_HDR(cloned)->src, - NET_IPV4_HDR(pkt)->dst); - net_ipv4_addr_copy_raw(NET_IPV4_HDR(cloned)->dst, - NET_IPV4_HDR(pkt)->src); + if (!COND_CODE_1(CONFIG_NET_TEST, (loopback_dont_swap_addresses), (false))) { + if (net_pkt_family(pkt) == AF_INET6) { + net_ipv6_addr_copy_raw(NET_IPV6_HDR(cloned)->src, + NET_IPV6_HDR(pkt)->dst); + net_ipv6_addr_copy_raw(NET_IPV6_HDR(cloned)->dst, + NET_IPV6_HDR(pkt)->src); + } else { + net_ipv4_addr_copy_raw(NET_IPV4_HDR(cloned)->src, + NET_IPV4_HDR(pkt)->dst); + net_ipv4_addr_copy_raw(NET_IPV4_HDR(cloned)->dst, + NET_IPV4_HDR(pkt)->src); + } } res = net_recv_data(net_pkt_iface(cloned), cloned); diff --git a/subsys/net/ip/net_private.h b/subsys/net/ip/net_private.h index 9e3878c1d8e24..a9f075322c580 100644 --- a/subsys/net/ip/net_private.h +++ b/subsys/net/ip/net_private.h @@ -142,6 +142,10 @@ extern void mdns_init_responder(void); static inline void mdns_init_responder(void) { } #endif /* CONFIG_MDNS_RESPONDER */ +#if defined(CONFIG_NET_TEST) +extern void loopback_enable_address_swap(bool swap_addresses); +#endif /* CONFIG_NET_TEST */ + #if defined(CONFIG_NET_NATIVE) enum net_verdict net_ipv4_input(struct net_pkt *pkt, bool is_loopback); enum net_verdict net_ipv6_input(struct net_pkt *pkt, bool is_loopback); From 51763d834be21786b7aacd8ea9477760ca02e66d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 11 Nov 2024 17:29:45 +0200 Subject: [PATCH 2752/4482] tests: net: socket: udp: Add IPV6_MULTICAST_IF set/get testing Add tests that verify that IPV6_MULTICAST_IF socket option set/get works as expected. Signed-off-by: Jukka Rissanen --- tests/net/socket/udp/src/main.c | 142 +++++++++++++++++++++++++++++++- 1 file changed, 141 insertions(+), 1 deletion(-) diff --git a/tests/net/socket/udp/src/main.c b/tests/net/socket/udp/src/main.c index 5874ed9f6e4d9..313111e2a7c6d 100644 --- a/tests/net/socket/udp/src/main.c +++ b/tests/net/socket/udp/src/main.c @@ -47,7 +47,7 @@ static const char test_str_all_tx_bufs[] = #define MY_IPV4_ADDR "127.0.0.1" #define MY_IPV6_ADDR "::1" #define MY_MCAST_IPV4_ADDR "224.0.0.1" -#define MY_MCAST_IPV6_ADDR "ff00::1" +#define MY_MCAST_IPV6_ADDR "ff01::1" #define ANY_PORT 0 #define SERVER_PORT 4242 @@ -947,6 +947,8 @@ static struct in6_addr my_addr1 = { { { 0x20, 0x01, 0x0d, 0xb8, 1, 0, 0, 0, static struct in_addr my_addr2 = { { { 192, 0, 2, 2 } } }; static struct in6_addr my_addr3 = { { { 0x20, 0x01, 0x0d, 0xb8, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x3 } } }; +static struct in6_addr my_mcast_addr1 = { { { 0xff, 0x01, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0x1 } } }; static uint8_t server_lladdr[] = { 0x01, 0x02, 0x03, 0xff, 0xfe, 0x04, 0x05, 0x06 }; static struct net_linkaddr server_link_addr = { @@ -957,6 +959,7 @@ static struct net_linkaddr server_link_addr = { #define PEER_IPV6_ADDR_ETH "2001:db8:100::2" #define TEST_TXTIME INT64_MAX #define WAIT_TIME K_MSEC(250) +#define WAIT_TIME_LONG K_MSEC(1000) static void eth_fake_iface_init(struct net_if *iface) { @@ -1015,6 +1018,7 @@ static void iface_cb(struct net_if *iface, void *user_data) if (net_if_l2(iface) == &NET_L2_GET_NAME(DUMMY)) { lo0 = iface; + net_if_set_default(iface); } } @@ -2531,6 +2535,142 @@ ZTEST(net_socket_udp, test_37_ipv6_src_addr_select) &my_addr3, &dest); } +ZTEST(net_socket_udp, test_38_ipv6_multicast_ifindex) +{ + struct sockaddr_in6 saddr6 = { + .sin6_family = AF_INET6, + .sin6_port = htons(SERVER_PORT), + .sin6_addr = my_mcast_addr1, + }; + struct net_if_mcast_addr *ifmaddr; + struct net_if_addr *ifaddr; + int server_sock; + size_t addrlen; + size_t optlen; + int ifindex; + int optval; + int sock; + int ret; + int err; + + net_if_foreach(iface_cb, ð_iface); + zassert_not_null(eth_iface, "No ethernet interface found"); + + ifmaddr = net_if_ipv6_maddr_add(eth_iface, &my_mcast_addr1); + if (!ifmaddr) { + DBG("Cannot add IPv6 multicast address %s\n", + net_sprint_ipv6_addr(&my_mcast_addr1)); + zassert_not_null(ifmaddr, "mcast_addr1"); + } + + ifaddr = net_if_ipv6_addr_add(eth_iface, &my_addr3, + NET_ADDR_AUTOCONF, 0); + if (!ifaddr) { + DBG("Cannot add IPv6 address %s\n", + net_sprint_ipv6_addr(&my_addr3)); + zassert_not_null(ifaddr, "addr1"); + } + + net_if_up(eth_iface); + + /* Check that we get the default interface */ + sock = zsock_socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); + zassert_true(sock >= 0, "Cannot create socket (%d)", -errno); + + optval = 0; optlen = 0U; + ret = zsock_getsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_IF, + &optval, &optlen); + zexpect_equal(ret, 0, "setsockopt failed (%d)", errno); + zexpect_equal(optlen, sizeof(optval), "invalid optlen %d vs %d", + optlen, sizeof(optval)); + ifindex = net_if_get_by_iface(net_if_get_default()); + zexpect_equal(optval, ifindex, + "getsockopt multicast ifindex (expected %d got %d)", + ifindex, optval); + + ret = zsock_close(sock); + zassert_equal(sock, 0, "Cannot close socket (%d)", -errno); + + /* Check failure for IPv4 socket */ + sock = zsock_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + zassert_true(sock >= 0, "Cannot create socket (%d)", -errno); + + optval = 0; optlen = 0U; + ret = zsock_getsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_IF, + &optval, &optlen); + err = -errno; + zexpect_equal(ret, -1, "setsockopt failed (%d)", errno); + zexpect_equal(err, -EAFNOSUPPORT, "setsockopt failed (%d)", errno); + zexpect_equal(optlen, 0U, "setsockopt optlen (%d)", optlen); + + ret = zsock_close(sock); + zassert_equal(sock, 0, "Cannot close socket (%d)", -errno); + + /* Check that we can set the interface */ + sock = zsock_socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); + zassert_true(sock >= 0, "Cannot create socket (%d)", -errno); + + /* Clear any existing interface value by setting it to 0 */ + optval = 0; optlen = sizeof(int); + ret = zsock_setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_IF, + &optval, optlen); + err = -errno; + zexpect_equal(ret, 0, "setsockopt failed (%d)", err); + zexpect_equal(optlen, sizeof(optval), "invalid optlen %d vs %d", + optlen, sizeof(optval)); + + /* Set the output multicast packet interface to the default interface */ + optval = net_if_get_by_iface(net_if_get_default()); optlen = sizeof(int); + ret = zsock_setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_IF, + &optval, optlen); + zexpect_equal(ret, 0, "setsockopt failed (%d)", errno); + zexpect_equal(optlen, sizeof(optval), "invalid optlen %d vs %d", + optlen, sizeof(optval)); + + optval = 0; optlen = 0U; + ret = zsock_getsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_IF, + &optval, &optlen); + err = -errno; + zexpect_equal(ret, 0, "setsockopt failed (%d)", err); + zexpect_equal(optlen, sizeof(int), "setsockopt optlen (%d)", optlen); + zexpect_equal(optval, net_if_get_by_iface(net_if_get_default()), + "getsockopt multicast ifindex (expected %d got %d)", + net_if_get_by_iface(net_if_get_default()), optval); + + server_sock = prepare_listen_sock_udp_v6(&saddr6); + zassert_not_equal(server_sock, -1, "Cannot create server socket (%d)", -errno); + + test_started = true; + loopback_enable_address_swap(false); + + ret = zsock_sendto(sock, TEST_STR_SMALL, sizeof(TEST_STR_SMALL) - 1, 0, + (struct sockaddr *)&saddr6, sizeof(saddr6)); + zexpect_equal(ret, STRLEN(TEST_STR_SMALL), + "invalid send len (was %d expected %d) (%d)", + ret, STRLEN(TEST_STR_SMALL), -errno); + + /* Test that the sent data is received from default interface and + * not the Ethernet one. + */ + addrlen = sizeof(saddr6); + ret = zsock_recvfrom(server_sock, rx_buf, sizeof(rx_buf), + 0, (struct sockaddr *)&saddr6, &addrlen); + zexpect_true(ret >= 0, "recvfrom fail"); + zexpect_equal(ret, strlen(TEST_STR_SMALL), + "unexpected received bytes"); + zexpect_mem_equal(rx_buf, TEST_STR_SMALL, sizeof(TEST_STR_SMALL) - 1, + "wrong data"); + + ret = zsock_close(sock); + zassert_equal(ret, 0, "Cannot close socket (%d)", -errno); + + ret = zsock_close(server_sock); + zassert_equal(ret, 0, "Cannot close socket (%d)", -errno); + + test_started = false; + loopback_enable_address_swap(true); +} + static void after(void *arg) { ARG_UNUSED(arg); From 0bd6f3b3f0de7a8c6dc75760b009610d2581107d Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 15 Nov 2024 13:03:58 +0200 Subject: [PATCH 2753/4482] net: if: Fix source interface select for IPv4 address Do the selection same way as in IPv6 so that if user supplies unspecified destination address, the default interface is selected the same way. Signed-off-by: Jukka Rissanen --- subsys/net/ip/net_if.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c index 4033fe99ceade..95254a1ca09dc 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -3538,22 +3538,17 @@ bool net_if_ipv4_is_addr_bcast(struct net_if *iface, struct net_if *net_if_ipv4_select_src_iface(const struct in_addr *dst) { struct net_if *selected = NULL; + const struct in_addr *src; - STRUCT_SECTION_FOREACH(net_if, iface) { - bool ret; - - ret = net_if_ipv4_addr_mask_cmp(iface, dst); - if (ret) { - selected = iface; - goto out; - } + src = net_if_ipv4_select_src_addr(NULL, dst); + if (src != net_ipv4_unspecified_address()) { + net_if_ipv4_addr_lookup(src, &selected); } if (selected == NULL) { selected = net_if_get_default(); } -out: return selected; } From 056a3d32420a3efd826bac43be31f2349bf822f6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 15 Nov 2024 13:08:25 +0200 Subject: [PATCH 2754/4482] net: if: Add helper to return the first IPv4 address for iface This is helper is only needed in socket multicast interface selection where we need to get one address from the interface so that it will tell (when getsockopt() is used), the interface IPv4 address where multicast packets will be sent. This is private function which is not needed in public headers so place the prototype to net_private.h file. Signed-off-by: Jukka Rissanen --- subsys/net/ip/net_if.c | 34 ++++++++++++++++++++++++++++++++++ subsys/net/ip/net_private.h | 2 ++ 2 files changed, 36 insertions(+) diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c index 95254a1ca09dc..002bae2b3a86d 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -3728,6 +3728,40 @@ const struct in_addr *net_if_ipv4_select_src_addr(struct net_if *dst_iface, return src; } +/* Internal function to get the first IPv4 address of the interface */ +struct net_if_addr *net_if_ipv4_addr_get_first_by_index(int ifindex) +{ + struct net_if *iface = net_if_get_by_index(ifindex); + struct net_if_addr *ifaddr = NULL; + struct net_if_ipv4 *ipv4; + + if (!iface) { + return NULL; + } + + net_if_lock(iface); + + ipv4 = iface->config.ip.ipv4; + if (!ipv4) { + goto out; + } + + ARRAY_FOR_EACH(ipv4->unicast, i) { + if (!ipv4->unicast[i].ipv4.is_used || + ipv4->unicast[i].ipv4.address.family != AF_INET) { + continue; + } + + ifaddr = &ipv4->unicast[i].ipv4; + break; + } + +out: + net_if_unlock(iface); + + return ifaddr; +} + struct net_if_addr *net_if_ipv4_addr_lookup(const struct in_addr *addr, struct net_if **ret) { diff --git a/subsys/net/ip/net_private.h b/subsys/net/ip/net_private.h index a9f075322c580..6bb626a5cbcd8 100644 --- a/subsys/net/ip/net_private.h +++ b/subsys/net/ip/net_private.h @@ -62,6 +62,8 @@ extern void net_if_stats_reset_all(void); extern void net_process_rx_packet(struct net_pkt *pkt); extern void net_process_tx_packet(struct net_pkt *pkt); +extern struct net_if_addr *net_if_ipv4_addr_get_first_by_index(int ifindex); + extern int net_icmp_call_ipv4_handlers(struct net_pkt *pkt, struct net_ipv4_hdr *ipv4_hdr, struct net_icmp_hdr *icmp_hdr); From d3bac7047d324840118c9b4c59085162626e5f33 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 15 Nov 2024 17:01:41 +0200 Subject: [PATCH 2755/4482] net: socket: Add support for IP_MULTICAST_IF option Allow user to set the network interface for multicast sockets of type SOCK_DGRAM. Signed-off-by: Jukka Rissanen --- include/zephyr/net/net_context.h | 22 +++- include/zephyr/net/socket.h | 10 ++ subsys/net/ip/net_context.c | 162 ++++++++++++++++---------- subsys/net/lib/sockets/sockets_inet.c | 135 +++++++++++++++++++-- 4 files changed, 255 insertions(+), 74 deletions(-) diff --git a/include/zephyr/net/net_context.h b/include/zephyr/net/net_context.h index 6da6adefc55e5..275496d91b20f 100644 --- a/include/zephyr/net/net_context.h +++ b/include/zephyr/net/net_context.h @@ -361,13 +361,23 @@ __net_socket struct net_context { * see RFC 5014 for details. */ uint16_t addr_preferences; - - /** - * IPv6 multicast output network interface for this context/socket. - * Only allowed for SOCK_DGRAM or SOCK_RAW type sockets. - */ - uint8_t ipv6_mcast_ifindex; #endif +#if defined(CONFIG_NET_IPV6) || defined(CONFIG_NET_IPV4) + union { + /** + * IPv6 multicast output network interface for this context/socket. + * Only allowed for SOCK_DGRAM or SOCK_RAW type sockets. + */ + uint8_t ipv6_mcast_ifindex; + + /** + * IPv4 multicast output network interface for this context/socket. + * Only allowed for SOCK_DGRAM type sockets. + */ + uint8_t ipv4_mcast_ifindex; + }; +#endif /* CONFIG_NET_IPV6 || CONFIG_NET_IPV4 */ + #if defined(CONFIG_NET_CONTEXT_TIMESTAMPING) /** Enable RX, TX or both timestamps of packets send through sockets. */ uint8_t timestamping; diff --git a/include/zephyr/net/socket.h b/include/zephyr/net/socket.h index 19850d0163154..c5282fdde3792 100644 --- a/include/zephyr/net/socket.h +++ b/include/zephyr/net/socket.h @@ -1196,6 +1196,8 @@ struct in_pktinfo { */ #define IP_MTU 14 +/** Set IPv4 multicast datagram network interface. */ +#define IP_MULTICAST_IF 32 /** Set IPv4 multicast TTL value. */ #define IP_MULTICAST_TTL 33 /** Join IPv4 multicast group. */ @@ -1212,6 +1214,14 @@ struct ip_mreqn { int imr_ifindex; /**< Network interface index */ }; +/** + * @brief Struct used when setting a IPv4 multicast network interface. + */ +struct ip_mreq { + struct in_addr imr_multiaddr; /**< IP multicast group address */ + struct in_addr imr_interface; /**< IP address of local interface */ +}; + /** @} */ /** diff --git a/subsys/net/ip/net_context.c b/subsys/net/ip/net_context.c index 9ba4d21b2c4a0..c012b08abfa7a 100644 --- a/subsys/net/ip/net_context.c +++ b/subsys/net/ip/net_context.c @@ -880,6 +880,17 @@ int net_context_bind(struct net_context *context, const struct sockaddr *addr, if (net_ipv4_is_addr_mcast(&addr4->sin_addr)) { struct net_if_mcast_addr *maddr; + if (IS_ENABLED(CONFIG_NET_UDP) && + net_context_get_type(context) == SOCK_DGRAM) { + if (COND_CODE_1(CONFIG_NET_IPV4, + (context->options.ipv4_mcast_ifindex > 0), + (false))) { + IF_ENABLED(CONFIG_NET_IPV4, + (iface = net_if_get_by_index( + context->options.ipv4_mcast_ifindex))); + } + } + maddr = net_if_ipv4_maddr_lookup(&addr4->sin_addr, &iface); if (!maddr) { @@ -1844,43 +1855,52 @@ static int get_context_mtu(struct net_context *context, static int get_context_mcast_ifindex(struct net_context *context, void *value, size_t *len) { -#if defined(CONFIG_NET_IPV6) - if (net_context_get_family(context) != AF_INET6) { - return -EAFNOSUPPORT; - } +#if defined(CONFIG_NET_IPV6) || defined(CONFIG_NET_IPV4) + sa_family_t family = net_context_get_family(context); - /* If user has not set the ifindex, then get the interface - * that this socket is bound to. - */ - if (context->options.ipv6_mcast_ifindex == 0) { - struct net_if *iface; - int ifindex; + if ((IS_ENABLED(CONFIG_NET_IPV6) && family == AF_INET6) || + (IS_ENABLED(CONFIG_NET_IPV4) && family == AF_INET)) { + /* If user has not set the ifindex, then get the interface + * that this socket is bound to. + */ + if (context->options.ipv6_mcast_ifindex == 0) { + struct net_if *iface; + int ifindex; - if (net_context_is_bound_to_iface(context)) { - iface = net_context_get_iface(context); - } else { - iface = net_if_get_default(); - } + if (net_context_is_bound_to_iface(context)) { + iface = net_context_get_iface(context); + } else { + iface = net_if_get_default(); + } - if (!net_if_flag_is_set(iface, NET_IF_IPV6)) { - return -EPROTOTYPE; - } + if (IS_ENABLED(CONFIG_NET_IPV6) && family == AF_INET6) { + if (!net_if_flag_is_set(iface, NET_IF_IPV6)) { + return -EPROTOTYPE; + } + } else if (IS_ENABLED(CONFIG_NET_IPV4) && family == AF_INET) { + if (!net_if_flag_is_set(iface, NET_IF_IPV4)) { + return -EPROTOTYPE; + } + } - ifindex = net_if_get_by_iface(iface); - if (ifindex < 1) { - return -ENOENT; + ifindex = net_if_get_by_iface(iface); + if (ifindex < 1) { + return -ENOENT; + } + + *((int *)value) = ifindex; + } else { + *((int *)value) = context->options.ipv6_mcast_ifindex; } - *((int *)value) = ifindex; - } else { - *((int *)value) = context->options.ipv6_mcast_ifindex; - } + if (len) { + *len = sizeof(int); + } - if (len) { - *len = sizeof(int); + return 0; } - return 0; + return -EAFNOSUPPORT; #else ARG_UNUSED(context); ARG_UNUSED(value); @@ -2193,6 +2213,17 @@ static int context_sendto(struct net_context *context, return -EDESTADDRREQ; } + if (IS_ENABLED(CONFIG_NET_UDP) && + net_context_get_type(context) == SOCK_DGRAM) { + if (net_ipv4_is_addr_mcast(&addr4->sin_addr) && + COND_CODE_1(CONFIG_NET_IPV4, + (context->options.ipv4_mcast_ifindex > 0), (false))) { + IF_ENABLED(CONFIG_NET_IPV4, + (iface = net_if_get_by_index( + context->options.ipv4_mcast_ifindex))); + } + } + /* If application has not yet set the destination address * i.e., by not calling connect(), then set the interface * here so that the packet gets sent to the correct network @@ -2200,10 +2231,12 @@ static int context_sendto(struct net_context *context, * network interfaces and we are trying to send data to * second or later network interface. */ - if (net_sin(&context->remote)->sin_addr.s_addr == 0U && - !net_context_is_bound_to_iface(context)) { - iface = net_if_ipv4_select_src_iface(&addr4->sin_addr); - net_context_set_iface(context, iface); + if (iface == NULL) { + if (net_sin(&context->remote)->sin_addr.s_addr == 0U && + !net_context_is_bound_to_iface(context)) { + iface = net_if_ipv4_select_src_iface(&addr4->sin_addr); + net_context_set_iface(context, iface); + } } } else if (IS_ENABLED(CONFIG_NET_SOCKETS_PACKET) && family == AF_PACKET) { @@ -3287,46 +3320,55 @@ static int set_context_timestamping(struct net_context *context, static int set_context_mcast_ifindex(struct net_context *context, const void *value, size_t len) { -#if defined(CONFIG_NET_IPV6) +#if defined(CONFIG_NET_IPV6) || defined(CONFIG_NET_IPV4) + sa_family_t family = net_context_get_family(context); int mcast_ifindex = *((int *)value); enum net_sock_type type; struct net_if *iface; - if (net_context_get_family(context) != AF_INET6) { - return -EAFNOSUPPORT; - } + if ((IS_ENABLED(CONFIG_NET_IPV6) && family == AF_INET6) || + (IS_ENABLED(CONFIG_NET_IPV4) && family == AF_INET)) { - if (len != sizeof(int)) { - return -EINVAL; - } + if (len != sizeof(int)) { + return -EINVAL; + } - type = net_context_get_type(context); - if (type != SOCK_DGRAM && type != SOCK_RAW) { - return -EINVAL; - } + type = net_context_get_type(context); + if (type != SOCK_DGRAM) { + return -EINVAL; + } - /* optlen equal to 0 then remove the binding */ - if (mcast_ifindex == 0) { - context->options.ipv6_mcast_ifindex = 0; - return 0; - } + /* optlen equal to 0 then remove the binding */ + if (mcast_ifindex == 0) { + context->options.ipv6_mcast_ifindex = 0; + return 0; + } - if (mcast_ifindex < 1 || mcast_ifindex > 255) { - return -EINVAL; - } + if (mcast_ifindex < 1 || mcast_ifindex > 255) { + return -EINVAL; + } - iface = net_if_get_by_index(mcast_ifindex); - if (iface == NULL) { - return -ENOENT; - } + iface = net_if_get_by_index(mcast_ifindex); + if (iface == NULL) { + return -ENOENT; + } - if (!net_if_flag_is_set(iface, NET_IF_IPV6)) { - return -EPROTOTYPE; - } + if (IS_ENABLED(CONFIG_NET_IPV6) && family == AF_INET6) { + if (!net_if_flag_is_set(iface, NET_IF_IPV6)) { + return -EPROTOTYPE; + } + } else if (IS_ENABLED(CONFIG_NET_IPV4) && family == AF_INET) { + if (!net_if_flag_is_set(iface, NET_IF_IPV4)) { + return -EPROTOTYPE; + } + } - context->options.ipv6_mcast_ifindex = mcast_ifindex; + context->options.ipv6_mcast_ifindex = mcast_ifindex; - return 0; + return 0; + } + + return -EAFNOSUPPORT; #else ARG_UNUSED(context); ARG_UNUSED(value); diff --git a/subsys/net/lib/sockets/sockets_inet.c b/subsys/net/lib/sockets/sockets_inet.c index 28103d5bad2dc..e88a6daa7f807 100644 --- a/subsys/net/lib/sockets/sockets_inet.c +++ b/subsys/net/lib/sockets/sockets_inet.c @@ -1612,6 +1612,99 @@ static enum tcp_conn_option get_tcp_option(int optname) return -EINVAL; } +static int ipv4_multicast_if(struct net_context *ctx, const void *optval, + socklen_t optlen, bool do_get) +{ + struct net_if *iface = NULL; + int ifindex, ret; + + if (do_get) { + struct net_if_addr *ifaddr; + size_t len = sizeof(ifindex); + + if (optval == NULL || (optlen != sizeof(struct in_addr))) { + errno = EINVAL; + return -1; + } + + ret = net_context_get_option(ctx, NET_OPT_MCAST_IFINDEX, + &ifindex, &len); + if (ret < 0) { + errno = -ret; + return -1; + } + + if (ifindex == 0) { + /* No interface set */ + ((struct in_addr *)optval)->s_addr = INADDR_ANY; + return 0; + } + + ifaddr = net_if_ipv4_addr_get_first_by_index(ifindex); + if (ifaddr == NULL) { + errno = ENOENT; + return -1; + } + + net_ipaddr_copy((struct in_addr *)optval, &ifaddr->address.in_addr); + + return 0; + } + + /* setsockopt() can accept either struct ip_mreqn or + * struct ip_mreq. We need to handle both cases. + */ + if (optval == NULL || (optlen != sizeof(struct ip_mreqn) && + optlen != sizeof(struct ip_mreq))) { + errno = EINVAL; + return -1; + } + + if (optlen == sizeof(struct ip_mreqn)) { + struct ip_mreqn *mreqn = (struct ip_mreqn *)optval; + + if (mreqn->imr_ifindex != 0) { + iface = net_if_get_by_index(mreqn->imr_ifindex); + + } else if (mreqn->imr_address.s_addr != INADDR_ANY) { + struct net_if_addr *ifaddr; + + ifaddr = net_if_ipv4_addr_lookup(&mreqn->imr_address, &iface); + if (ifaddr == NULL) { + errno = ENOENT; + return -1; + } + } + } else { + struct ip_mreq *mreq = (struct ip_mreq *)optval; + + if (mreq->imr_interface.s_addr != INADDR_ANY) { + struct net_if_addr *ifaddr; + + ifaddr = net_if_ipv4_addr_lookup(&mreq->imr_interface, &iface); + if (ifaddr == NULL) { + errno = ENOENT; + return -1; + } + } + } + + if (iface == NULL) { + ifindex = 0; + } else { + ifindex = net_if_get_by_iface(iface); + } + + ret = net_context_set_option(ctx, NET_OPT_MCAST_IFINDEX, + &ifindex, sizeof(ifindex)); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; +} + int zsock_getsockopt_ctx(struct net_context *ctx, int level, int optname, void *optval, socklen_t *optlen) { @@ -1831,6 +1924,18 @@ int zsock_getsockopt_ctx(struct net_context *ctx, int level, int optname, return 0; + case IP_MULTICAST_IF: + if (IS_ENABLED(CONFIG_NET_IPV4)) { + if (net_context_get_family(ctx) != AF_INET) { + errno = EAFNOSUPPORT; + return -1; + } + + return ipv4_multicast_if(ctx, optval, *optlen, true); + } + + break; + case IP_MULTICAST_TTL: ret = net_context_get_option(ctx, NET_OPT_MCAST_TTL, optval, optlen); @@ -1932,15 +2037,22 @@ int zsock_getsockopt_ctx(struct net_context *ctx, int level, int optname, return 0; case IPV6_MULTICAST_IF: - ret = net_context_get_option(ctx, - NET_OPT_MCAST_IFINDEX, - optval, optlen); - if (ret < 0) { - errno = -ret; - return -1; - } + if (IS_ENABLED(CONFIG_NET_IPV6)) { + if (net_context_get_family(ctx) != AF_INET6) { + errno = EAFNOSUPPORT; + return -1; + } - return 0; + ret = net_context_get_option(ctx, + NET_OPT_MCAST_IFINDEX, + optval, optlen); + if (ret < 0) { + errno = -ret; + return -1; + } + + return 0; + } case IPV6_MULTICAST_HOPS: ret = net_context_get_option(ctx, @@ -2406,6 +2518,13 @@ int zsock_setsockopt_ctx(struct net_context *ctx, int level, int optname, break; + case IP_MULTICAST_IF: + if (IS_ENABLED(CONFIG_NET_IPV4)) { + return ipv4_multicast_if(ctx, optval, optlen, false); + } + + break; + case IP_MULTICAST_TTL: ret = net_context_set_option(ctx, NET_OPT_MCAST_TTL, optval, optlen); From 624f28cb65197018ff8d6b249c94d317b902ce14 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 15 Nov 2024 17:05:07 +0200 Subject: [PATCH 2756/4482] tests: net: socket: udp: Add IP_MULTICAST_IF set/get testing Add tests that verify that IP_MULTICAST_IF socket option set/get works as expected. Signed-off-by: Jukka Rissanen --- tests/net/socket/udp/src/main.c | 254 ++++++++++++++++++++++++++++++++ 1 file changed, 254 insertions(+) diff --git a/tests/net/socket/udp/src/main.c b/tests/net/socket/udp/src/main.c index 313111e2a7c6d..c98714e5f3365 100644 --- a/tests/net/socket/udp/src/main.c +++ b/tests/net/socket/udp/src/main.c @@ -949,6 +949,7 @@ static struct in6_addr my_addr3 = { { { 0x20, 0x01, 0x0d, 0xb8, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x3 } } }; static struct in6_addr my_mcast_addr1 = { { { 0xff, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1 } } }; +static struct in_addr my_mcast_addr2 = { { { 224, 0, 0, 2 } } }; static uint8_t server_lladdr[] = { 0x01, 0x02, 0x03, 0xff, 0xfe, 0x04, 0x05, 0x06 }; static struct net_linkaddr server_link_addr = { @@ -2671,6 +2672,259 @@ ZTEST(net_socket_udp, test_38_ipv6_multicast_ifindex) loopback_enable_address_swap(true); } +ZTEST(net_socket_udp, test_39_ipv4_multicast_ifindex) +{ + struct sockaddr_in saddr4 = { + .sin_family = AF_INET, + .sin_port = htons(SERVER_PORT), + .sin_addr = my_mcast_addr2, + }; + struct sockaddr_in dst_addr = { + .sin_family = AF_INET, + .sin_port = htons(SERVER_PORT), + .sin_addr = my_mcast_addr2, + }; + struct net_if_mcast_addr *ifmaddr; + struct net_if_addr *ifaddr; + struct in_addr addr = { 0 }; + struct ip_mreqn mreqn; + struct ip_mreq mreq; + struct net_if *iface; + int server_sock; + size_t addrlen; + size_t optlen; + int ifindex; + int sock; + int ret; + int err; + + net_if_foreach(iface_cb, ð_iface); + zassert_not_null(eth_iface, "No ethernet interface found"); + + ifmaddr = net_if_ipv4_maddr_add(eth_iface, &my_mcast_addr2); + if (!ifmaddr) { + DBG("Cannot add IPv4 multicast address %s\n", + net_sprint_ipv4_addr(&my_mcast_addr2)); + zassert_not_null(ifmaddr, "mcast_addr2"); + } + + ifaddr = net_if_ipv4_addr_add(eth_iface, &my_addr2, + NET_ADDR_MANUAL, 0); + if (!ifaddr) { + DBG("Cannot add IPv4 address %s\n", + net_sprint_ipv4_addr(&my_addr2)); + zassert_not_null(ifaddr, "addr2"); + } + + net_if_up(eth_iface); + + /* Check that we get the default interface */ + sock = zsock_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + zassert_true(sock >= 0, "Cannot create socket (%d)", -errno); + + optlen = sizeof(addr); + ret = zsock_getsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, + &addr, &optlen); + zexpect_equal(ret, 0, "setsockopt failed (%d)", errno); + zexpect_equal(optlen, sizeof(addr), "invalid optlen %d vs %d", + optlen, sizeof(addr)); + ifindex = net_if_get_by_iface(net_if_get_default()); + ret = net_if_ipv4_addr_lookup_by_index(&addr); + zexpect_equal(ret, ifindex, + "getsockopt multicast ifindex (expected %d got %d)", + ifindex, ret); + + ret = zsock_close(sock); + zassert_equal(sock, 0, "Cannot close socket (%d)", -errno); + + /* Check failure for IPv6 socket */ + sock = zsock_socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); + zassert_true(sock >= 0, "Cannot create socket (%d)", -errno); + + optlen = 0U; + ret = zsock_getsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, + &addr, &optlen); + err = -errno; + zexpect_equal(ret, -1, "setsockopt failed (%d)", errno); + zexpect_equal(err, -EAFNOSUPPORT, "setsockopt failed (%d)", errno); + zexpect_equal(optlen, 0U, "setsockopt optlen (%d)", optlen); + + ret = zsock_close(sock); + zassert_equal(sock, 0, "Cannot close socket (%d)", -errno); + + /* Check that we can set the interface */ + sock = zsock_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + zassert_true(sock >= 0, "Cannot create socket (%d)", -errno); + + /* Clear any existing interface value by setting it to 0 */ + optlen = sizeof(mreqn); + mreqn.imr_ifindex = 0; + mreqn.imr_address.s_addr = 0; + + ret = zsock_setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, + &mreqn, optlen); + err = -errno; + zexpect_equal(ret, 0, "setsockopt failed (%d)", err); + + /* Verify that we get the empty value */ + optlen = sizeof(addr); + ret = zsock_getsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, + &addr, &optlen); + err = -errno; + zexpect_equal(ret, 0, "setsockopt failed (%d)", err); + zexpect_equal(optlen, sizeof(addr), "setsockopt optlen (%d)", optlen); + + /* Set the output multicast packet interface to the default interface */ + optlen = sizeof(mreqn); + mreqn.imr_ifindex = net_if_get_by_iface(net_if_get_default()); + mreqn.imr_address.s_addr = 0; + + ret = zsock_setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, + &mreqn, optlen); + err = -errno; + zexpect_equal(ret, 0, "setsockopt failed (%d)", err); + + /* Verify that we get the default interface */ + optlen = sizeof(addr); + memset(&addr, 0, sizeof(addr)); + ret = zsock_getsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, + &addr, &optlen); + err = -errno; + zexpect_equal(ret, 0, "setsockopt failed (%d)", err); + zexpect_equal(optlen, sizeof(addr), "setsockopt optlen (%d)", optlen); + + ifaddr = net_if_ipv4_addr_lookup(&addr, &iface); + zexpect_not_null(ifaddr, "Address %s not found", + net_sprint_ipv4_addr(&addr)); + zexpect_equal(net_if_get_by_iface(iface), + net_if_get_by_iface(net_if_get_default()), + "Invalid interface %d vs %d", + net_if_get_by_iface(iface), + net_if_get_by_iface(net_if_get_default())); + + /* Now send a packet and verify that it is sent via the default + * interface instead of the Ethernet interface. + */ + server_sock = prepare_listen_sock_udp_v4(&saddr4); + zassert_not_equal(server_sock, -1, "Cannot create server socket (%d)", -errno); + + test_started = true; + loopback_enable_address_swap(false); + + ret = zsock_sendto(sock, TEST_STR_SMALL, sizeof(TEST_STR_SMALL) - 1, 0, + (struct sockaddr *)&dst_addr, sizeof(dst_addr)); + zexpect_equal(ret, STRLEN(TEST_STR_SMALL), + "invalid send len (was %d expected %d) (%d)", + ret, STRLEN(TEST_STR_SMALL), -errno); + + /* Test that the sent data is received from Ethernet interface. */ + addrlen = sizeof(saddr4); + ret = zsock_recvfrom(server_sock, rx_buf, sizeof(rx_buf), + 0, (struct sockaddr *)&saddr4, &addrlen); + zexpect_true(ret >= 0, "recvfrom fail"); + zexpect_equal(ret, strlen(TEST_STR_SMALL), + "unexpected received bytes"); + zexpect_mem_equal(rx_buf, TEST_STR_SMALL, sizeof(TEST_STR_SMALL) - 1, + "wrong data"); + + /* Clear the old interface value by setting it to 0 */ + optlen = sizeof(mreqn); + mreqn.imr_ifindex = 0; + mreqn.imr_address.s_addr = 0; + + ret = zsock_setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, + &mreqn, optlen); + err = -errno; + zexpect_equal(ret, 0, "setsockopt failed (%d)", err); + + /* Then do it the other way around, set the address but leave the + * interface number unassigned. + */ + optlen = sizeof(mreqn); + mreqn.imr_ifindex = 0; + + /* Get the address of default interface and set it as a target + * interface. + */ + ifaddr = net_if_ipv4_addr_get_first_by_index(net_if_get_by_iface(net_if_get_default())); + zexpect_not_null(ifaddr, "No address found for interface %d", + net_if_get_by_iface(net_if_get_default())); + mreqn.imr_address.s_addr = ifaddr->address.in_addr.s_addr; + + ret = zsock_setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, + &mreqn, optlen); + zexpect_equal(ret, 0, "setsockopt failed (%d)", errno); + + /* Verify that we get the default interface address */ + optlen = sizeof(struct in_addr); + ret = zsock_getsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, + &addr, &optlen); + err = -errno; + zexpect_equal(ret, 0, "setsockopt failed (%d)", err); + zexpect_equal(optlen, sizeof(struct in_addr), "setsockopt optlen (%d)", optlen); + ret = net_if_ipv4_addr_lookup_by_index(&addr); + zexpect_equal(ret, net_if_get_by_iface(net_if_get_default()), + "getsockopt multicast ifindex (expected %d got %d)", + net_if_get_by_iface(net_if_get_default()), ret); + zexpect_equal(ifaddr->address.in_addr.s_addr, + addr.s_addr, + "getsockopt iface address mismatch (expected %s got %s)", + net_sprint_ipv4_addr(&ifaddr->address.in_addr), + net_sprint_ipv4_addr(&addr)); + + ret = zsock_sendto(sock, TEST_STR_SMALL, sizeof(TEST_STR_SMALL) - 1, 0, + (struct sockaddr *)&dst_addr, sizeof(dst_addr)); + zexpect_equal(ret, STRLEN(TEST_STR_SMALL), + "invalid send len (was %d expected %d) (%d)", + ret, STRLEN(TEST_STR_SMALL), -errno); + + /* Test that the sent data is received from default interface. */ + addrlen = sizeof(saddr4); + ret = zsock_recvfrom(server_sock, rx_buf, sizeof(rx_buf), + 0, (struct sockaddr *)&saddr4, &addrlen); + zexpect_true(ret >= 0, "recvfrom fail"); + zexpect_equal(ret, strlen(TEST_STR_SMALL), + "unexpected received bytes"); + zexpect_mem_equal(rx_buf, TEST_STR_SMALL, sizeof(TEST_STR_SMALL) - 1, + "wrong data"); + + /* Then use mreq structure to set the interface */ + optlen = sizeof(mreq); + ifaddr = net_if_ipv4_addr_get_first_by_index(net_if_get_by_iface(net_if_get_default())); + zexpect_not_null(ifaddr, "No address found for interface %d", + net_if_get_by_iface(net_if_get_default())); + mreq.imr_interface.s_addr = ifaddr->address.in_addr.s_addr; + + ret = zsock_setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, + &mreq, optlen); + zexpect_equal(ret, 0, "setsockopt failed (%d)", errno); + + ret = zsock_sendto(sock, TEST_STR_SMALL, sizeof(TEST_STR_SMALL) - 1, 0, + (struct sockaddr *)&dst_addr, sizeof(dst_addr)); + zexpect_equal(ret, STRLEN(TEST_STR_SMALL), + "invalid send len (was %d expected %d) (%d)", + ret, STRLEN(TEST_STR_SMALL), -errno); + + /* Test that the sent data is received from default interface. */ + addrlen = sizeof(saddr4); + ret = zsock_recvfrom(server_sock, rx_buf, sizeof(rx_buf), + 0, (struct sockaddr *)&saddr4, &addrlen); + zexpect_true(ret >= 0, "recvfrom fail"); + zexpect_equal(ret, strlen(TEST_STR_SMALL), + "unexpected received bytes"); + zexpect_mem_equal(rx_buf, TEST_STR_SMALL, sizeof(TEST_STR_SMALL) - 1, + "wrong data"); + + ret = zsock_close(sock); + zassert_equal(ret, 0, "Cannot close socket (%d)", -errno); + + ret = zsock_close(server_sock); + zassert_equal(ret, 0, "Cannot close socket (%d)", -errno); + + test_started = false; + loopback_enable_address_swap(true); +} + static void after(void *arg) { ARG_UNUSED(arg); From bffa312ea600c8e6b611b8bdecd8e3ec652649ee Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 15 Nov 2024 17:05:37 +0200 Subject: [PATCH 2757/4482] net: context: Fix the connect check for IPv4 Make sure that we cannot connect to IPv4 multicast or broadcast destination address for a TCP socket. Signed-off-by: Jukka Rissanen --- subsys/net/ip/net_context.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/subsys/net/ip/net_context.c b/subsys/net/ip/net_context.c index c012b08abfa7a..8ad8a2ad5a3ec 100644 --- a/subsys/net/ip/net_context.c +++ b/subsys/net/ip/net_context.c @@ -1324,7 +1324,13 @@ int net_context_connect(struct net_context *context, goto unlock; } - /* FIXME - Add multicast and broadcast address check */ + if (net_context_get_proto(context) == IPPROTO_TCP && + (net_ipv4_is_addr_mcast(&addr4->sin_addr) || + net_ipv4_is_addr_bcast(net_context_get_iface(context), + &addr4->sin_addr))) { + ret = -EADDRNOTAVAIL; + goto unlock; + } memcpy(&addr4->sin_addr, &net_sin(addr)->sin_addr, sizeof(struct in_addr)); From 3a6e36d548d0f0e014e6058737d5031c7224ca98 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Sun, 10 Nov 2024 00:03:03 +0700 Subject: [PATCH 2758/4482] drivers: serial: stm32: make poll-out function to pass data by value Passing data by value is more efficient in this context. As such, revise `poll_out_fn` and `uart_stm32_poll_out_visitor` to accept the `out` argument by value instead of by address. Signed-off-by: Pisit Sawangvonganan --- drivers/serial/uart_stm32.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/serial/uart_stm32.c b/drivers/serial/uart_stm32.c index 1f9e7abe01271..97c0bbdf85314 100644 --- a/drivers/serial/uart_stm32.c +++ b/drivers/serial/uart_stm32.c @@ -652,9 +652,9 @@ static int uart_stm32_poll_in_visitor(const struct device *dev, void *in, poll_i } typedef void (*poll_out_fn)( - USART_TypeDef *usart, void *out); + USART_TypeDef *usart, uint16_t out); -static void uart_stm32_poll_out_visitor(const struct device *dev, void *out, poll_out_fn set_fn) +static void uart_stm32_poll_out_visitor(const struct device *dev, uint16_t out, poll_out_fn set_fn) { const struct uart_stm32_config *config = dev->config; USART_TypeDef *usart = config->usart; @@ -707,9 +707,9 @@ static void poll_in_u8(USART_TypeDef *usart, void *in) *((unsigned char *)in) = (unsigned char)LL_USART_ReceiveData8(usart); } -static void poll_out_u8(USART_TypeDef *usart, void *out) +static void poll_out_u8(USART_TypeDef *usart, uint16_t out) { - LL_USART_TransmitData8(usart, *((uint8_t *)out)); + LL_USART_TransmitData8(usart, (uint8_t)out); } static int uart_stm32_poll_in(const struct device *dev, unsigned char *c) @@ -719,14 +719,14 @@ static int uart_stm32_poll_in(const struct device *dev, unsigned char *c) static void uart_stm32_poll_out(const struct device *dev, unsigned char c) { - uart_stm32_poll_out_visitor(dev, (void *)&c, poll_out_u8); + uart_stm32_poll_out_visitor(dev, c, poll_out_u8); } #ifdef CONFIG_UART_WIDE_DATA -static void poll_out_u9(USART_TypeDef *usart, void *out) +static void poll_out_u9(USART_TypeDef *usart, uint16_t out) { - LL_USART_TransmitData9(usart, *((uint16_t *)out)); + LL_USART_TransmitData9(usart, out); } static void poll_in_u9(USART_TypeDef *usart, void *in) @@ -741,7 +741,7 @@ static int uart_stm32_poll_in_u16(const struct device *dev, uint16_t *in_u16) static void uart_stm32_poll_out_u16(const struct device *dev, uint16_t out_u16) { - uart_stm32_poll_out_visitor(dev, (void *)&out_u16, poll_out_u9); + uart_stm32_poll_out_visitor(dev, out_u16, poll_out_u9); } #endif From 3f870b316feab5cd9c903ca2d10de5d1cbd45d5d Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 9 Nov 2024 14:03:08 +0900 Subject: [PATCH 2759/4482] include: dma: smartbond: Correct include-guard Both `include/zephyr/drivers/dma/dma_smartbond.h` and `include/zephyr/dt-bindings/dma/dma_smartbond.h` define `DMA_SMARTBOND_H_` to prevent duplicate inclusion, so it cannot be properly prevented. Change to a file path name-based definition. Signed-off-by: TOKITA Hiroshi --- include/zephyr/drivers/dma/dma_smartbond.h | 6 +++--- include/zephyr/dt-bindings/dma/dma_smartbond.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/zephyr/drivers/dma/dma_smartbond.h b/include/zephyr/drivers/dma/dma_smartbond.h index c154488039d87..fba98aae53dd6 100644 --- a/include/zephyr/drivers/dma/dma_smartbond.h +++ b/include/zephyr/drivers/dma/dma_smartbond.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef DMA_SMARTBOND_H_ -#define DMA_SMARTBOND_H_ +#ifndef ZEPHYR_INCLUDE_DRIVERS_DMA_DMA_SMARTBOND_H_ +#define ZEPHYR_INCLUDE_DRIVERS_DMA_DMA_SMARTBOND_H_ /** * @brief Vendror-specific DMA peripheral triggering sources. @@ -30,4 +30,4 @@ enum dma_smartbond_trig_mux { DMA_SMARTBOND_TRIG_MUX_NONE = 0xF }; -#endif /* DMA_SMARTBOND_H_ */ +#endif /* ZEPHYR_INCLUDE_DRIVERS_DMA_DMA_SMARTBOND_H_ */ diff --git a/include/zephyr/dt-bindings/dma/dma_smartbond.h b/include/zephyr/dt-bindings/dma/dma_smartbond.h index 4240801c9756a..abbaad11ce103 100644 --- a/include/zephyr/dt-bindings/dma/dma_smartbond.h +++ b/include/zephyr/dt-bindings/dma/dma_smartbond.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef DMA_SMARTBOND_H_ -#define DMA_SMARTBOND_H_ +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_DMA_DMA_SMARTBOND_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_DMA_DMA_SMARTBOND_H_ /** * @brief Vendror-specific DMA peripheral triggering sources. @@ -28,4 +28,4 @@ #define DMA_SMARTBOND_TRIG_MUX_SDADC 0xD #define DMA_SMARTBOND_TRIG_MUX_NONE 0xF -#endif /* DMA_SMARTBOND_H_ */ +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_DMA_DMA_SMARTBOND_H_ */ From c144ebf723cf6168893ed50e4e49819dbc73d40b Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 9 Nov 2024 14:05:16 +0900 Subject: [PATCH 2760/4482] include: intertupt_controller: esp32: Correct include-guard Both `include/zephyr/drivers/interrupt_controller/intc_esp32.h` and `include/zephyr/drivers/interrupt_controller/intc_esp32c3.h` define `ZEPHYR_INCLUDE_DRIVERS_ESP_INTR_ALLOC_H__` to prevent duplicate inclusion, so it cannot be properly prevented. Change to a file path name-based definition. Signed-off-by: TOKITA Hiroshi --- include/zephyr/drivers/interrupt_controller/intc_esp32.h | 6 +++--- include/zephyr/drivers/interrupt_controller/intc_esp32c3.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/zephyr/drivers/interrupt_controller/intc_esp32.h b/include/zephyr/drivers/interrupt_controller/intc_esp32.h index 7ebe7fd8bed95..5b5ce8d94bbb8 100644 --- a/include/zephyr/drivers/interrupt_controller/intc_esp32.h +++ b/include/zephyr/drivers/interrupt_controller/intc_esp32.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_DRIVERS_ESP_INTR_ALLOC_H__ -#define ZEPHYR_INCLUDE_DRIVERS_ESP_INTR_ALLOC_H__ +#ifndef ZEPHYR_INCLUDE_DRIVERS_INTERRUPT_CONTROLLER_INTC_ESP32_H_ +#define ZEPHYR_INCLUDE_DRIVERS_INTERRUPT_CONTROLLER_INTC_ESP32_H_ #include #include @@ -311,4 +311,4 @@ void esp_intr_noniram_disable(void); */ void esp_intr_noniram_enable(void); -#endif +#endif /* ZEPHYR_INCLUDE_DRIVERS_INTERRUPT_CONTROLLER_INTC_ESP32_H_ */ diff --git a/include/zephyr/drivers/interrupt_controller/intc_esp32c3.h b/include/zephyr/drivers/interrupt_controller/intc_esp32c3.h index 6ca5eda24ec71..a30dc16ed0fd0 100644 --- a/include/zephyr/drivers/interrupt_controller/intc_esp32c3.h +++ b/include/zephyr/drivers/interrupt_controller/intc_esp32c3.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_DRIVERS_ESP_INTR_ALLOC_H__ -#define ZEPHYR_INCLUDE_DRIVERS_ESP_INTR_ALLOC_H__ +#ifndef ZEPHYR_INCLUDE_DRIVERS_INTERRUPT_CONTROLLER_INTC_ESP32C3_H_ +#define ZEPHYR_INCLUDE_DRIVERS_INTERRUPT_CONTROLLER_INTC_ESP32C3_H_ #include #include @@ -118,4 +118,4 @@ int esp_intr_enable(int source); */ uint32_t esp_intr_get_enabled_intmask(int status_mask_number); -#endif +#endif /* ZEPHYR_INCLUDE_DRIVERS_INTERRUPT_CONTROLLER_INTC_ESP32C3_H_ */ From 2bb0a504a773c0562f2f399e96719d9cac22b701 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 9 Nov 2024 14:07:38 +0900 Subject: [PATCH 2761/4482] include: dt-bindings: gecko: Correct include-guard Both `include/zephyr/dt-bindings/pinctrl/gecko-pinctrl.h` and `include/zephyr/dt-bindings/pinctrl/gecko-pinctrl-s1.h` define `ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_GECKO_PINCTRL_H_` to prevent duplicate inclusion. Changed it to `ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_GECKO_PINCTRL_S1_H_` in `include/zephyr/dt-bindings/pinctrl/gecko-pinctrl-s1.h` side. Signed-off-by: TOKITA Hiroshi --- include/zephyr/dt-bindings/pinctrl/gecko-pinctrl-s1.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/zephyr/dt-bindings/pinctrl/gecko-pinctrl-s1.h b/include/zephyr/dt-bindings/pinctrl/gecko-pinctrl-s1.h index 38b8f6e42db80..885c8d5747c6e 100644 --- a/include/zephyr/dt-bindings/pinctrl/gecko-pinctrl-s1.h +++ b/include/zephyr/dt-bindings/pinctrl/gecko-pinctrl-s1.h @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_GECKO_PINCTRL_H_ -#define ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_GECKO_PINCTRL_H_ +#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_GECKO_PINCTRL_S1_H_ +#define ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_GECKO_PINCTRL_S1_H_ /* * The whole GECKO_pin configuration information is encoded in a 32-bit bitfield @@ -115,4 +115,4 @@ (((GECKO_LOCATION(##loc##) & GECKO_LOC_MSK) << GECKO_LOC_POS) | \ ((GECKO_FUN_##fun##_LOC & GECKO_FUN_MSK) << GECKO_FUN_POS)) -#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_GECKO_PINCTRL_H_ */ +#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_GECKO_PINCTRL_S1_H_ */ From d3695c3284f0e48c913590ae88522ed2b1bcd79b Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Tue, 5 Nov 2024 10:29:48 -0800 Subject: [PATCH 2762/4482] tests: CONFIG_TEST_USERSPACE selects CONFIG_USERSPACE CONFIG_TEST_USERSPACE should select CONFIG_USERSPACE as they should be enabled together. It is no use to enable userspace tests without enabling userspace. Signed-off-by: Daniel Leung --- subsys/testsuite/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/testsuite/Kconfig b/subsys/testsuite/Kconfig index 490fec5cdce88..dd1aff5b62513 100644 --- a/subsys/testsuite/Kconfig +++ b/subsys/testsuite/Kconfig @@ -132,7 +132,7 @@ config TEST_ENABLE_USERSPACE bool depends on TEST_USERSPACE depends on ARCH_HAS_USERSPACE - imply USERSPACE + select USERSPACE imply DYNAMIC_OBJECTS default y help From 4bd584cf21934549ab442decc005871fd48f3ad4 Mon Sep 17 00:00:00 2001 From: Florian Grandel Date: Fri, 6 Sep 2024 10:34:17 +0200 Subject: [PATCH 2763/4482] scripts: dts: edtlib: improve Node encapsulation Moves several node-specific operations inside the Node class to improve its encapsulation, remove a monkey patch and access to internal methods and fields. Signed-off-by: Florian Grandel --- .../src/devicetree/edtlib.py | 77 ++++++++++++------- 1 file changed, 51 insertions(+), 26 deletions(-) diff --git a/scripts/dts/python-devicetree/src/devicetree/edtlib.py b/scripts/dts/python-devicetree/src/devicetree/edtlib.py index 61db1c8af3437..58b5abfcec692 100644 --- a/scripts/dts/python-devicetree/src/devicetree/edtlib.py +++ b/scripts/dts/python-devicetree/src/devicetree/edtlib.py @@ -994,13 +994,26 @@ class Node: True if the node is a PCI device. """ - def __init__(self, - dt_node: dtlib_Node, - edt: 'EDT', - compats: List[str]): + def __init__( + self, + dt_node: dtlib_Node, + edt: "EDT", + support_fixed_partitions_on_any_bus: bool = True, + ): ''' For internal use only; not meant to be used outside edtlib itself. ''' + + compats = ( + dt_node.props["compatible"].to_strings() + if "compatible" in dt_node.props + else [] + ) + + # Private, don't touch outside the class: + self._node: dtlib_Node = dt_node + self._binding: Optional[Binding] = None + # Public, some of which are initialized properly later: self.edt: 'EDT' = edt self.dep_ordinal: int = -1 @@ -1012,11 +1025,11 @@ def __init__(self, self.props: Dict[str, Property] = {} self.interrupts: List[ControllerAndData] = [] self.pinctrls: List[PinCtrl] = [] - self.bus_node: Optional['Node'] = None + self.bus_node = self._bus_node(support_fixed_partitions_on_any_bus) - # Private, don't touch outside the class: - self._node: dtlib_Node = dt_node - self._binding: Optional[Binding] = None + self._init_binding() + self._init_regs() + self._init_ranges() @property def name(self) -> str: @@ -1222,6 +1235,14 @@ def gpio_hogs(self) -> List[ControllerAndData]: return res + @property + def has_child_binding(self) -> bool: + """ + True if the node's binding contains a child-binding definition, False + otherwise + """ + return bool(self._binding and self._binding.child_binding) + @property def is_pci_device(self) -> bool: "See the class docstring" @@ -1376,6 +1397,18 @@ def _bus_node(self, support_fixed_partitions_on_any_bus: bool = True # Same bus node as parent (possibly None) return self.parent.bus_node + def _init_crossrefs( + self, default_prop_types: bool = False, err_on_deprecated: bool = False + ) -> None: + # Initializes all properties that require cross-references to other + # nodes, like 'phandle' and 'phandles'. This is done after all nodes + # have been initialized. + self._init_props( + default_prop_types=default_prop_types, err_on_deprecated=err_on_deprecated + ) + self._init_interrupts() + self._init_pinctrls() + def _init_props(self, default_prop_types: bool = False, err_on_deprecated: bool = False) -> None: # Creates self.props. See the class docstring. Also checks that all @@ -2100,7 +2133,7 @@ def _process_properties_r(self, root_node, props_node): # If the binding defines child bindings, link the child properties to # the root_node as well. - if props_node._binding and props_node._binding.child_binding: + if props_node.has_child_binding: for child in props_node.children.values(): if "compatible" in child.props: # Not a child node, normal node on a different binding. @@ -2239,27 +2272,19 @@ def _init_nodes(self) -> None: for dt_node in self._dt.node_iter(): # Warning: We depend on parent Nodes being created before their # children. This is guaranteed by node_iter(). - if "compatible" in dt_node.props: - compats = dt_node.props["compatible"].to_strings() - else: - compats = [] - node = Node(dt_node, self, compats) - node.bus_node = node._bus_node(self._fixed_partitions_no_bus) - node._init_binding() - node._init_regs() - node._init_ranges() - + node = Node(dt_node, self, self._fixed_partitions_no_bus) self.nodes.append(node) self._node2enode[dt_node] = node for node in self.nodes: - # These depend on all Node objects having been created, because - # they (either always or sometimes) reference other nodes, so we - # run them separately - node._init_props(default_prop_types=self._default_prop_types, - err_on_deprecated=self._werror) - node._init_interrupts() - node._init_pinctrls() + # Initialize properties that may depend on other Node objects having + # been created, because they (either always or sometimes) reference + # other nodes. Must be called separately after all nodes have been + # created. + node._init_crossrefs( + default_prop_types=self._default_prop_types, + err_on_deprecated=self._werror, + ) if self._warn_reg_unit_address_mismatch: # This warning matches the simple_bus_reg warning in dtc From 0f1549c575d5875d5c90a8a1bda431b433557cf8 Mon Sep 17 00:00:00 2001 From: Florian Grandel Date: Fri, 6 Sep 2024 10:53:35 +0200 Subject: [PATCH 2764/4482] scripts: dts: edtlib: simplification Small refactorings to simplify code and improve method encapsulation. Signed-off-by: Florian Grandel --- .../src/devicetree/edtlib.py | 64 +++++++++---------- 1 file changed, 30 insertions(+), 34 deletions(-) diff --git a/scripts/dts/python-devicetree/src/devicetree/edtlib.py b/scripts/dts/python-devicetree/src/devicetree/edtlib.py index 58b5abfcec692..471f8b42acc87 100644 --- a/scripts/dts/python-devicetree/src/devicetree/edtlib.py +++ b/scripts/dts/python-devicetree/src/devicetree/edtlib.py @@ -1416,7 +1416,6 @@ def _init_props(self, default_prop_types: bool = False, self.props = {} - node = self._node if self._binding: prop2specs = self._binding.prop2specs else: @@ -1428,12 +1427,11 @@ def _init_props(self, default_prop_types: bool = False, self._init_prop(prop_spec, err_on_deprecated) self._check_undeclared_props() elif default_prop_types: - for name in node.props: + for name in self._node.props: if name not in _DEFAULT_PROP_SPECS: continue prop_spec = _DEFAULT_PROP_SPECS[name] - val = self._prop_val(name, prop_spec.type, False, False, None, - None, err_on_deprecated) + val = self._prop_val(name, prop_spec, err_on_deprecated) self.props[name] = Property(prop_spec, val, self) def _init_prop(self, prop_spec: PropertySpec, @@ -1446,9 +1444,7 @@ def _init_prop(self, prop_spec: PropertySpec, if not prop_type: _err(f"'{name}' in {self.binding_path} lacks 'type'") - val = self._prop_val(name, prop_type, prop_spec.deprecated, - prop_spec.required, prop_spec.default, - prop_spec.specifier_space, err_on_deprecated) + val = self._prop_val(name, prop_spec, err_on_deprecated) if val is None: # 'required: false' property that wasn't there, or a property type @@ -1476,41 +1472,37 @@ def _init_prop(self, prop_spec: PropertySpec, self.props[name] = Property(prop_spec, val, self) - def _prop_val(self, name: str, prop_type: str, - deprecated: bool, required: bool, - default: PropertyValType, - specifier_space: Optional[str], - err_on_deprecated: bool) -> PropertyValType: + def _prop_val( + self, + name: str, + prop_spec: PropertySpec, + err_on_deprecated: bool, + ) -> PropertyValType: # _init_prop() helper for getting the property's value # # name: # Property name from binding # - # prop_type: - # Property type from binding (a string like "int") - # - # deprecated: - # True if the property is deprecated - # - # required: - # True if the property is required to exist - # - # default: - # Default value to use when the property doesn't exist, or None if - # the binding doesn't give a default value - # - # specifier_space: - # Property specifier-space from binding (if prop_type is "phandle-array") + # prop_spec: + # PropertySpec from binding # # err_on_deprecated: # If True, a deprecated property is an error instead of warning. node = self._node prop = node.props.get(name) + binding_path = prop_spec.binding.path + prop_type = prop_spec.type + deprecated = prop_spec.deprecated + required = prop_spec.required + default = prop_spec.default + specifier_space = prop_spec.specifier_space if prop and deprecated: - msg = (f"'{name}' is marked as deprecated in 'properties:' " - f"in {self.binding_path} for node {node.path}.") + msg = ( + f"'{name}' is marked as deprecated in 'properties:' " + f"in {binding_path} for node {node.path}." + ) if err_on_deprecated: _err(msg) else: @@ -1518,8 +1510,10 @@ def _prop_val(self, name: str, prop_type: str, if not prop: if required and self.status == "okay": - _err(f"'{name}' is marked as required in 'properties:' in " - f"{self.binding_path}, but does not appear in {node!r}") + _err( + f"'{name}' is marked as required in 'properties:' in " + f"{binding_path}, but does not appear in {node!r}" + ) if default is not None: # YAML doesn't have a native format for byte arrays. We need to @@ -1534,9 +1528,11 @@ def _prop_val(self, name: str, prop_type: str, if prop_type == "boolean": if prop.type != Type.EMPTY: - _err("'{0}' in {1!r} is defined with 'type: boolean' in {2}, " - "but is assigned a value ('{3}') instead of being empty " - "('{0};')".format(name, node, self.binding_path, prop)) + _err( + "'{0}' in {1!r} is defined with 'type: boolean' in {2}, " + "but is assigned a value ('{3}') instead of being empty " + "('{0};')".format(name, node, binding_path, prop) + ) return True if prop_type == "int": From be4acee09a174c5678e62c598a0ba97623cf615a Mon Sep 17 00:00:00 2001 From: Florian Grandel Date: Fri, 6 Sep 2024 10:57:03 +0200 Subject: [PATCH 2765/4482] scripts: dts: edtlib: type hints Adds type hints to functions that were not yet typed. Signed-off-by: Florian Grandel --- scripts/dts/python-devicetree/src/devicetree/edtlib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/dts/python-devicetree/src/devicetree/edtlib.py b/scripts/dts/python-devicetree/src/devicetree/edtlib.py index 471f8b42acc87..feea40d2f6cd7 100644 --- a/scripts/dts/python-devicetree/src/devicetree/edtlib.py +++ b/scripts/dts/python-devicetree/src/devicetree/edtlib.py @@ -2093,7 +2093,7 @@ def scc_order(self) -> List[List[Node]]: except Exception as e: raise EDTError(e) - def _process_properties_r(self, root_node, props_node): + def _process_properties_r(self, root_node: Node, props_node: Node) -> None: """ Process props_node properties for dependencies, and add those as dependencies of root_node. Then walk through all the props_node @@ -2136,7 +2136,7 @@ def _process_properties_r(self, root_node, props_node): continue self._process_properties_r(root_node, child) - def _process_properties(self, node): + def _process_properties(self, node: Node) -> None: """ Add node dependencies based on own as well as child node properties, start from the node itself. From becd9e5b9208a924ca2699e50aa3c450685dafa6 Mon Sep 17 00:00:00 2001 From: Florian Grandel Date: Wed, 25 Sep 2024 11:31:15 +0200 Subject: [PATCH 2766/4482] scripts: dts: edtlib: fix type docs The return type of 'uint8-array' properties was not yet documented. Signed-off-by: Florian Grandel --- scripts/dts/python-devicetree/src/devicetree/edtlib.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/dts/python-devicetree/src/devicetree/edtlib.py b/scripts/dts/python-devicetree/src/devicetree/edtlib.py index feea40d2f6cd7..46c18ce52624e 100644 --- a/scripts/dts/python-devicetree/src/devicetree/edtlib.py +++ b/scripts/dts/python-devicetree/src/devicetree/edtlib.py @@ -642,6 +642,8 @@ class Property: - For 'type: int/array/string/string-array', 'val' is what you'd expect (a Python integer or string, or a list of them) + - For 'type: uint8-array', 'val' is a bytes object + - For 'type: phandle' and 'type: path', 'val' is the pointed-to Node instance From 0841bcff78d60c9681fc3103751f3b4f8170fc2b Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Tue, 22 Oct 2024 10:53:40 +0200 Subject: [PATCH 2767/4482] docs: dma: Explicitly allow reconfiguration This explicitly documents that a configured DMA channel can be reconfigured. Signed-off-by: Reto Schneider --- doc/hardware/peripherals/dma.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/hardware/peripherals/dma.rst b/doc/hardware/peripherals/dma.rst index 53fd18a1aa70d..3e5ee43bb26ae 100644 --- a/doc/hardware/peripherals/dma.rst +++ b/doc/hardware/peripherals/dma.rst @@ -61,7 +61,8 @@ for reference. init -> CONFIGURED [label=dma_config]; CONFIGURED -> RUNNING [label=dma_start]; - CONFIGURED -> CONFIGURED [label=dma_stop]; + CONFIGURED -> CONFIGURED [label=dma_stop, headport=c, tailport=e]; + CONFIGURED -> CONFIGURED [label=dma_config, headport=c, tailport=w]; RUNNING -> CONFIGURED [label=dma_stop]; RUNNING -> RUNNING [label=dma_start]; From 057528b894be3b4acd17d8c2dfd26c53fc5f4df3 Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Tue, 22 Oct 2024 22:49:57 +0200 Subject: [PATCH 2768/4482] docs: dma: Fix typo and grammar This fixes the spelling of the word expected, ads a missing comma. Signed-off-by: Reto Schneider --- doc/hardware/peripherals/dma.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/hardware/peripherals/dma.rst b/doc/hardware/peripherals/dma.rst index 3e5ee43bb26ae..f2b998aaeda94 100644 --- a/doc/hardware/peripherals/dma.rst +++ b/doc/hardware/peripherals/dma.rst @@ -43,7 +43,7 @@ DMA channels should be viewed as state machines that the DMA API provides transi the form of API calls. Every driver is expected to maintain its own channel state tracking. The busy state of the channel should be inspectable at any time with :c:func:`dma_get_status()`. -A diagram showing those expectated possible state transitions and their API calls is provided here +A diagram, showing those expected possible state transitions and their API calls is provided here for reference. .. graphviz:: From c9ce311aaac2d66f62b4e8dbeb88879055776a56 Mon Sep 17 00:00:00 2001 From: Eric Ackermann Date: Thu, 29 Aug 2024 15:13:31 +0200 Subject: [PATCH 2769/4482] drivers: dma: Add Xilinx AXI DMA driver The Xilinx AXI DMA Controller is commonly used in FPGA designs. For example, it is a part of the 1G/2.5G AXI Ethernet subsystem. This patch adds a driver for the Xilinx AXI DMA that supports single MM2S and S2MM channels as well as the control and status streams used by the AXI Ethernet subsystem. Signed-off-by: Eric Ackermann --- drivers/dma/CMakeLists.txt | 1 + drivers/dma/Kconfig | 1 + drivers/dma/Kconfig.xilinx_axi_dma | 105 ++ drivers/dma/dma_xilinx_axi_dma.c | 1132 +++++++++++++++++++++ drivers/dma/dma_xilinx_axi_dma.h | 28 + dts/bindings/dma/xilinx,axi-dma-base.yaml | 58 ++ dts/bindings/dma/xilinx,axi-dma.yaml | 12 + dts/bindings/dma/xilinx,eth-dma.yaml | 13 + 8 files changed, 1350 insertions(+) create mode 100644 drivers/dma/Kconfig.xilinx_axi_dma create mode 100644 drivers/dma/dma_xilinx_axi_dma.c create mode 100644 drivers/dma/dma_xilinx_axi_dma.h create mode 100644 dts/bindings/dma/xilinx,axi-dma-base.yaml create mode 100644 dts/bindings/dma/xilinx,axi-dma.yaml create mode 100644 dts/bindings/dma/xilinx,eth-dma.yaml diff --git a/drivers/dma/CMakeLists.txt b/drivers/dma/CMakeLists.txt index e36c3a042a45c..00b424a37b680 100644 --- a/drivers/dma/CMakeLists.txt +++ b/drivers/dma/CMakeLists.txt @@ -44,3 +44,4 @@ zephyr_library_sources_ifdef(CONFIG_DMA_NXP_SOF_HOST_DMA dma_nxp_sof_host_dma.c) zephyr_library_sources_ifdef(CONFIG_DMA_EMUL dma_emul.c) zephyr_library_sources_ifdef(CONFIG_DMA_NXP_EDMA dma_nxp_edma.c) zephyr_library_sources_ifdef(CONFIG_DMA_DW_AXI dma_dw_axi.c) +zephyr_library_sources_ifdef(CONFIG_DMA_XILINX_AXI_DMA dma_xilinx_axi_dma.c) diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 0a939d5632b62..964727e61cd6b 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -81,5 +81,6 @@ source "drivers/dma/Kconfig.emul" source "drivers/dma/Kconfig.nxp_edma" source "drivers/dma/Kconfig.dw_axi_dmac" +source "drivers/dma/Kconfig.xilinx_axi_dma" endif # DMA diff --git a/drivers/dma/Kconfig.xilinx_axi_dma b/drivers/dma/Kconfig.xilinx_axi_dma new file mode 100644 index 0000000000000..1326ba500cb74 --- /dev/null +++ b/drivers/dma/Kconfig.xilinx_axi_dma @@ -0,0 +1,105 @@ +# Xilinx AXI DMA configuration options + +# Copyright (c) 2023 CISPA Helmholtz Center for Information Security gGmbH +# SPDX-License-Identifier: Apache-2.0 + +config DMA_XILINX_AXI_DMA + bool "Xilinx AXI DMA LogiCORE IP driver" + default y + depends on DT_HAS_XLNX_AXI_DMA_1_00_A_ENABLED || DT_HAS_XLNX_ETH_DMA_ENABLED + help + DMA driver for Xilinx AXI DMAs, usually found on FPGAs. + + +config DMA_XILINX_AXI_DMA_DISABLE_CACHE_WHEN_ACCESSING_SG_DESCRIPTORS + bool "Disable data cache while accessing Scatter-Gather Descriptors." + depends on DMA_XILINX_AXI_DMA + default n + help + Disable dcache while operating on Scatter-Gather descriptors. + This allows the DMA to be used on architectures that do not provide + coherency for DMA accesses. If you are unsure whether you need this feature, + you should select n here. + +config DMA_XILINX_AXI_DMA_SG_DESCRIPTOR_NUM_TX + int "Number of transfer descriptors allocated for transmission (TX)." + depends on DMA_XILINX_AXI_DMA + default 16 + help + The Xilinx AXI DMA uses a ring of in-memory DMA descriptors which reference + the buffers containing the network packets and control and status information. + Increasing the number of descriptors increases the amount of packets in flight, + which benefits performance, while increasing memory usage. + +config DMA_XILINX_AXI_DMA_SG_DESCRIPTOR_NUM_RX + int "Number of transfer descriptors allocated for reception (RX)." + depends on DMA_XILINX_AXI_DMA + default 16 + help + The AXI DMA driver currently allocates a single DMA descriptor for each RX transfer, + because transfers need to be started by the upstream driver. + +choice + prompt "IRQs to lock when manipulating per-channel data structures during dma_start." + depends on DMA_XILINX_AXI_DMA + default DMA_XILINX_AXI_DMA_LOCK_ALL_IRQS + +config DMA_XILINX_AXI_DMA_LOCK_ALL_IRQS + bool "Lock all IRQs" + help + Lock all interrupts (including, e.g., timers and scheduler) when modifying channel data + during dma_start. + This is required when calling dma_start outside of the TX/RX callbacks. + This is the safest option and the default, select this if you are unsure. + +config DMA_XILINX_AXI_DMA_LOCK_DMA_IRQS + bool "Lock TX and RX IRQs" + help + Lock all interrupts of this DMA device when modifying channel data during dma_start. + This is only safe when dma_start is only called from the TX/RX callbacks (and possibly + once directly after initialization of the DMA). + +config DMA_XILINX_AXI_DMA_LOCK_CHANNEL_IRQ + bool "Lock IRQs of the DMA channel" + help + Only lock the interrupt of the DMA channel whose data are to be modified during dma_start. + Only select this when you can guarantee that dma_start is only called from the callback + registered for the same channel. + +endchoice + +config DMA_XILINX_AXI_DMA_POLL_INTERVAL + int "Period of the timer used for polling the DMA in milliseconds" + depends on DMA_XILINX_AXI_DMA + default 100 + help + On certain platforms (e.g., RISC-V), the DMA driver can sometimes miss interrupts. + This can cause the DMA driver to stop processing completed transactions. + In order to prevent this, the DMA driver periodically polls the DMA's registers and + determines whether it needs to handle outstanding transactions. + This configuration controls how often this happens. + Choose a larger value to minimize overhead and a smaller value to minimize + worst-case latency. + +config DMA_XILINX_AXI_DMA_INTERRUPT_THRESHOLD + int "Number of completed transactions after which to trigger an interrupt" + depends on DMA_XILINX_AXI_DMA + range 1 255 + default 8 + help + Number of completed transactions after which to trigger an interrupt. + Decrease to minimize latency, increase to minimize overhead introduced by interrupts. + +config DMA_XILINX_AXI_DMA_INTERRUPT_TIMEOUT + int "Timeout for triggering an interrupt" + depends on DMA_XILINX_AXI_DMA + range 0 255 + default 16 + help + Trigger an interrupt at the latest after + CONFIG_DMA_XILINX_AXI_DMA_INTERRUPT_TIMEOUT * 125 * DMA_CLOCK_PERIOD cycles. + This is useful in conjunction with DMA_XILINX_AXI_DMA_INTERRUPT_THRESHOLD - the DMA + can raise an interrupt before the threshold is reached, minimizing latency in scenarios + where only few transactions per second are completed. + Set to 0 to disable this feature, i.e., interrupts will only be raised when the threshold + has been reached. diff --git a/drivers/dma/dma_xilinx_axi_dma.c b/drivers/dma/dma_xilinx_axi_dma.c new file mode 100644 index 0000000000000..7138fbe212764 --- /dev/null +++ b/drivers/dma/dma_xilinx_axi_dma.c @@ -0,0 +1,1132 @@ +/** @file + *@brief Driver for Xilinx AXI DMA. + */ +/* + * Copyright (c) 2024 CISPA Helmholtz Center for Information Security gGmbH + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +#include "dma_xilinx_axi_dma.h" + +#define XILINX_AXI_DMA_SG_DESCRIPTOR_ADDRESS_MASK 0x3f + +LOG_MODULE_REGISTER(dma_xilinx_axi_dma, CONFIG_DMA_LOG_LEVEL); + +/* masks for control field in SG descriptor */ +#define XILINX_AXI_DMA_SG_DESCRIPTOR_CTRL_RESERVED_MASK 0xF0000000 +/* descriptor is for start of transfer */ +#define XILINX_AXI_DMA_SG_DESCRIPTOR_CTRL_SOF_MASK 0x08000000 +/* descriptor is for end of transfer */ +#define XILINX_AXI_DMA_SG_DESCRIPTOR_CTRL_EOF_MASK 0x04000000 +/* length of the associated buffer in main memory */ +#define XILINX_AXI_DMA_SG_DESCRIPTOR_CTRL_LENGTH_MASK 0x03FFFFFF +#define XILINX_AXI_DMA_SG_DESCRIPTOR_STATUS_LENGTH_MASK 0x03FFFFFF + +/* masks for status field in SG descriptor */ +/* transfer completed */ +#define XILINX_AXI_DMA_SG_DESCRIPTOR_STATUS_COMPLETE_MASK 0x80000000 +/* decode error, i.e., DECERR on AXI bus from memory */ +#define XILINX_AXI_DMA_SG_DESCRIPTOR_STATUS_DEC_ERR_MASK 0x40000000 +/* slave error, i.e., SLVERR on AXI bus from memory */ +#define XILINX_AXI_DMA_SG_DESCRIPTOR_STATUS_SLV_ERR_MASK 0x20000000 +/* internal DMA error, e.g., 0-length transfer */ +#define XILINX_AXI_DMA_SG_DESCRIPTOR_STATUS_INT_ERR_MASK 0x10000000 +/* reserved */ +#define XILINX_AXI_DMA_SG_DESCRIPTOR_STATUS_INT_RES_MASK 0x0C000000 +/* number of transferred bytes */ +#define XILINX_AXI_DMA_SG_DESCRIPTOR_STATUS_TRANSFERRED_MASK 0x03FFFFFF + +#define XILINX_AXI_DMA_SG_DESCRIPTOR_APP0_CHECKSUM_OFFLOAD_FULL 0x00000002 +#define XILINX_AXI_DMA_SG_DESCRIPTOR_APP0_CHECKSUM_OFFLOAD_NONE 0x00000000 +#define XILINX_AXI_DMA_SG_DESCRIPTOR_APP2_FCS_ERR_MASK 0x00000100 +#define XILINX_AXI_DMA_SG_DESCRIPTOR_APP2_IP_ERR_MASK 0x00000028 +#define XILINX_AXI_DMA_SG_DESCRIPTOR_APP2_UDP_ERR_MASK 0x00000030 +#define XILINX_AXI_DMA_SG_DESCRIPTOR_APP2_TCP_ERR_MASK 0x00000038 + +/* masks for DMA registers */ + +#define XILINX_AXI_DMA_REGS_DMACR_IRQTHRESH_SHIFT_BITS 16 +#define XILINX_AXI_DMA_REGS_DMACR_IRQDELAY_SHIFT_BITS 24 +/* masks for DMACR register */ +/* interrupt timeout - trigger interrupt after X cycles when no transfer. Unit is 125 * */ +/* clock_period. */ +#define XILINX_AXI_DMA_REGS_DMACR_IRQDELAY 0xFF000000 +/* irqthreshold - this can be used to generate interrupts after X completed packets */ +/* instead of after every packet */ +#define XILINX_AXI_DMA_REGS_DMACR_IRQTHRESH 0x00FF0000 +#define XILINX_AXI_DMA_REGS_DMACR_RESERVED1 0x00008000 +/* interrupt on error enable */ +#define XILINX_AXI_DMA_REGS_DMACR_ERR_IRQEN 0x00004000 +/* interrupt on delay timer interrupt enable */ +#define XILINX_AXI_DMA_REGS_DMACR_DLY_IRQEN 0x00002000 +/* interrupt on complete enable */ +#define XILINX_AXI_DMA_REGS_DMACR_IOC_IRQEN 0x00001000 +#define XILINX_AXI_DMA_REGS_DMACR_ALL_IRQEN \ + (XILINX_AXI_DMA_REGS_DMACR_ERR_IRQEN | XILINX_AXI_DMA_REGS_DMACR_DLY_IRQEN | \ + XILINX_AXI_DMA_REGS_DMACR_IOC_IRQEN) +#define XILINX_AXI_DMA_REGS_DMACR_RESERVED2 0x00000FE0 +/* DMA ignores completed bit in SG descriptor and overwrites descriptors */ +#define XILINX_AXI_DMA_REGS_DMACR_CYC_BD_EN 0x00000010 +/* use AXI fixed burst instead of incrementing burst for TX transfers, e.g., useful for reading a */ +/* FIFO */ +#define XILINX_AXI_DMA_REGS_DMACR_KEYHOLE 0x00000008 +/* soft reset */ +#define XILINX_AXI_DMA_REGS_DMACR_RESET 0x00000004 +#define XILINX_AXI_DMA_REGS_DMACR_RESERVED3 0x00000002 +/* run-stop */ +#define XILINX_AXI_DMA_REGS_DMACR_RS 0x00000001 + +/* masks for DMASR register */ +/* interrupt delay time status */ +#define XILINX_AXI_DMA_REGS_DMASR_IRQDELAYSTS 0xFF000000 +/* interrupt threshold status */ +#define XILINX_AXI_DMA_REGS_DMASR_IRQTHRESHSTS 0x00FF0000 +#define XILINX_AXI_DMA_REGS_DMASR_RESERVED1 0x00008000 +/* current interrupt was generated on error */ +#define XILINX_AXI_DMA_REGS_DMASR_ERR_IRQ 0x00004000 +/* current interrupt was generated by timoeout */ +#define XILINX_AXI_DMA_REGS_DMASR_DLY_IRQ 0x00002000 +/* current interrupt was generated by completion of a transfer */ +#define XILINX_AXI_DMA_REGS_DMASR_IOC_IRQ 0x00001000 +#define XILINX_AXI_DMA_REGS_DMASR_RESERVED2 0x00000800 +/* scatter gather decode error */ +#define XILINX_AXI_DMA_REGS_DMASR_SGDECERR 0x00000400 +/* scatter gather slave error */ +#define XILINX_AXI_DMA_REGS_DMASR_SGSLVERR 0x00000200 +/* scatter gather internal error, i.e., fetched a descriptor with complete bit already set */ +#define XILINX_AXI_DMA_REGS_DMASR_SGINTERR 0x00000100 +#define XILINX_AXI_DMA_REGS_DMASR_RESERVED3 0x00000080 +/* DMA decode error */ +#define XILINX_AXI_DMA_REGS_DMASR_DMADECERR 0x00000040 +/* DMA slave error */ +#define XILINX_AXI_DMA_REGS_DMASR_SLVERR 0x00000020 +/* DMA internal error */ +#define XILINX_AXI_DMA_REGS_DMASR_INTERR 0x00000010 +/* scatter/gather support enabled at build time */ +#define XILINX_AXI_DMA_REGS_DMASR_SGINCL 0x00000008 +#define XILINX_AXI_DMA_REGS_DMASR_RESERVED4 0x00000004 +/* DMA channel is idle, i.e., DMA operations completed; writing tail restarts operation */ +#define XILINX_AXI_DMA_REGS_DMASR_IDLE 0x00000002 +/* RS (run-stop) in DMACR is 0 and operations completed; writing tail does nothing */ +#define XILINX_AXI_DMA_REGS_DMASR_HALTED 0x00000001 + +#define XILINX_AXI_DMA_REGS_SG_CTRL_CACHE_MASK 0x0000000F +#define XILINX_AXI_DMA_REGS_SG_CTRL_RES1_MASK 0x000000F0 +#define XILINX_AXI_DMA_REGS_SG_CTRL_USER_MASK 0x00000F00 +#define XILINX_AXI_DMA_REGS_SG_CTRL_RES2_MASK 0xFFFFF000 + +#ifdef CONFIG_DMA_XILINX_AXI_DMA_DISABLE_CACHE_WHEN_ACCESSING_SG_DESCRIPTORS +#include +static inline void dma_xilinx_axi_dma_disable_cache(void) +{ + cache_data_disable(); +} +static inline void dma_xilinx_axi_dma_enable_cache(void) +{ + cache_data_enable(); +} +#else +static inline void dma_xilinx_axi_dma_disable_cache(void) +{ + /* do nothing */ +} +static inline void dma_xilinx_axi_dma_enable_cache(void) +{ + /* do nothing */ +} +#endif + +/* in-memory descriptor, read by the DMA, that instructs it how many bits to transfer from which */ +/* buffer */ +struct __attribute__((__packed__)) dma_xilinx_axi_dma_sg_descriptor { + /* next descriptor[31:6], bits 5-0 reserved */ + uint32_t nxtdesc; + /* next descriptor[63:32] */ + uint32_t nxtdesc_msb; + /* address of buffer to transfer[31:0] */ + uint32_t buffer_address; + /* address of buffer to transfer[63:32] */ + uint32_t buffer_address_msb; + uint32_t reserved1; + uint32_t reserved2; + + /* bitfield, masks for access defined above */ + uint32_t control; + /* bitfield, masks for access defined above */ + uint32_t status; + + /* application-specific fields used, e.g., to enable checksum offloading */ + /* for the Ethernet Subsystem */ + uint32_t app0; + uint32_t app1; + uint32_t app2; + uint32_t app3; + uint32_t app4; +} __aligned(64); + +__aligned(64) static struct dma_xilinx_axi_dma_sg_descriptor + descriptors_tx[CONFIG_DMA_XILINX_AXI_DMA_SG_DESCRIPTOR_NUM_TX] = {0}; +__aligned(64) static struct dma_xilinx_axi_dma_sg_descriptor + descriptors_rx[CONFIG_DMA_XILINX_AXI_DMA_SG_DESCRIPTOR_NUM_RX] = {0}; +/* registers are the same with different name */ +struct __attribute__((__packed__)) dma_xilinx_axi_dma_mm2s_s2mm_registers { + /* DMA control register */ + /* bitfield, masks defined above */ + uint32_t dmacr; + /* DMA status register */ + /* bitfield, masks defined above */ + uint32_t dmasr; + /* current descriptor address[31:0] */ + uint32_t curdesc; + /* current descriptor address[63:0] */ + uint32_t curdesc_msb; + /* current descriptor address[31:0] */ + uint32_t taildesc; + /* current descriptor address[63:0] */ + uint32_t taildesc_msb; + /* transfer source address for "direct register mode"[31:0] */ + uint32_t sa; + /* transfer source address for "direct register mode"[63:32] */ + uint32_t sa_msb; + uint32_t reserved1; + uint32_t reserved2; + /* transfer length for "direct register mode" */ + uint32_t length; +}; + +struct __attribute__((__packed__)) dma_xilinx_axi_dma_register_space { + struct dma_xilinx_axi_dma_mm2s_s2mm_registers mm2s_registers; + /* scatter/gather user and cache register or reserved */ + /* controls arcache/awcache and aruser/awuser of generated transactions */ + uint32_t sg_ctl; + struct dma_xilinx_axi_dma_mm2s_s2mm_registers s2mm_registers; +}; + +/* global configuration per DMA device */ +struct dma_xilinx_axi_dma_config { + void *reg; + /* this should always be 2 - one for TX, one for RX */ + uint32_t channels; + void (*irq_configure)(); + uint32_t *irq0_channels; + size_t irq0_channels_size; +}; + +typedef void (*dma_xilinx_axi_dma_isr_t)(const struct device *dev); + +/* parameters for polling timer */ +struct dma_xilinx_axi_dma_timer_params { + /* back reference for the device */ + const struct device *dev; + /* number of this channel's IRQ */ + unsigned int irq_number; + /* ISR that normally handles the channel's interrupts */ + dma_xilinx_axi_dma_isr_t isr; +}; + +/* per-channel state */ +struct dma_xilinx_axi_dma_channel { + volatile struct dma_xilinx_axi_dma_sg_descriptor *descriptors; + + struct k_timer polling_timer; + + struct dma_xilinx_axi_dma_timer_params polling_timer_params; + + size_t num_descriptors; + + size_t current_transfer_start_index, current_transfer_end_index; + + volatile struct dma_xilinx_axi_dma_mm2s_s2mm_registers *channel_regs; + + enum dma_channel_direction last_transfer_direction; + + /* call this when the transfer is complete */ + dma_callback_t completion_callback; + void *completion_callback_user_data; + + uint32_t last_rx_size; + + uint32_t sg_desc_app0; + bool check_csum_in_isr; +}; + +/* global state for device and array of per-channel states */ +struct dma_xilinx_axi_dma_data { + struct dma_context ctx; + struct dma_xilinx_axi_dma_channel *channels; + bool device_has_been_reset; +}; + +#ifdef CONFIG_DMA_XILINX_AXI_DMA_LOCK_ALL_IRQS +static inline int dma_xilinx_axi_dma_lock_irq(const struct dma_xilinx_axi_dma_config *cfg, + const uint32_t channel_num) +{ + (void)cfg; + (void)channel_num; + return irq_lock(); +} + +static inline void dma_xilinx_axi_dma_unlock_irq(const struct dma_xilinx_axi_dma_config *cfg, + const uint32_t channel_num, int key) +{ + (void)cfg; + (void)channel_num; + return irq_unlock(key); +} +#elif defined(CONFIG_DMA_XILINX_AXI_DMA_LOCK_DMA_IRQS) +static inline int dma_xilinx_axi_dma_lock_irq(const struct dma_xilinx_axi_dma_config *cfg, + const uint32_t channel_num) +{ + int ret; + (void)channel_num; + + /* TX is 0, RX is 1 */ + ret = irq_is_enabled(cfg->irq0_channels[0]) ? 1 : 0; + ret |= (irq_is_enabled(cfg->irq0_channels[1]) ? 1 : 0) << 1; + + LOG_DBG("DMA IRQ state: %x TX IRQN: %" PRIu32 " RX IRQN: %" PRIu32, ret, + cfg->irq0_channels[0], cfg->irq0_channels[1]); + + irq_disable(cfg->irq0_channels[0]); + irq_disable(cfg->irq0_channels[1]); + + return ret; +} + +static inline void dma_xilinx_axi_dma_unlock_irq(const struct dma_xilinx_axi_dma_config *cfg, + const uint32_t channel_num, int key) +{ + (void)channel_num; + + if (key & 0x1) { + /* TX was enabled */ + irq_enable(cfg->irq0_channels[0]); + } + if (key & 0x2) { + /* RX was enabled */ + irq_enable(cfg->irq0_channels[1]); + } +} +#elif defined(CONFIG_DMA_XILINX_AXI_DMA_LOCK_CHANNEL_IRQ) +static inline int dma_xilinx_axi_dma_lock_irq(const struct dma_xilinx_axi_dma_config *cfg, + const uint32_t channel_num) +{ + int ret; + + ret = irq_is_enabled(cfg->irq0_channels[channel_num]); + + LOG_DBG("DMA IRQ state: %x ", ret); + + irq_disable(cfg->irq0_channels[channel_num]); + + return ret; +} + +static inline void dma_xilinx_axi_dma_unlock_irq(const struct dma_xilinx_axi_dma_config *cfg, + const uint32_t channel_num, int key) +{ + if (key) { + /* was enabled */ + irq_enable(cfg->irq0_channels[channel_num]); + } +} +#else +#error "No IRQ strategy selected in Kconfig!" +#endif + +static inline void dma_xilinx_axi_dma_write_reg(volatile uint32_t *reg, uint32_t val) +{ + sys_write32(val, (mem_addr_t)(uintptr_t)reg); +} + +static inline uint32_t dma_xilinx_axi_dma_read_reg(volatile uint32_t *reg) +{ + return sys_read32((mem_addr_t)(uintptr_t)reg); +} + +uint32_t dma_xilinx_axi_dma_last_received_frame_length(const struct device *dev) +{ + const struct dma_xilinx_axi_dma_data *data = dev->data; + + return data->channels[XILINX_AXI_DMA_RX_CHANNEL_NUM].last_rx_size; +} + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" +static inline void +dma_xilinx_axi_dma_acknowledge_interrupt(struct dma_xilinx_axi_dma_channel *channel_data) +{ + /* interrupt handler might have called dma_start */ + /* this overwrites the DMA control register */ + /* so we cannot just write the old value back */ + uint32_t dmacr = dma_xilinx_axi_dma_read_reg(&channel_data->channel_regs->dmacr); + + dma_xilinx_axi_dma_write_reg(&channel_data->channel_regs->dmacr, dmacr); +} +#pragma GCC diagnostic pop + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" +static bool dma_xilinx_axi_dma_channel_has_error( + const struct dma_xilinx_axi_dma_channel *channel_data, + volatile const struct dma_xilinx_axi_dma_sg_descriptor *descriptor) +{ + bool error = false; + + /* check register errors first, as the SG descriptor might not be valid */ + if (dma_xilinx_axi_dma_read_reg(&channel_data->channel_regs->dmasr) & + XILINX_AXI_DMA_REGS_DMASR_INTERR) { + LOG_ERR("DMA has internal error, DMASR = %" PRIx32, + dma_xilinx_axi_dma_read_reg(&channel_data->channel_regs->dmasr)); + error = true; + } + + if (dma_xilinx_axi_dma_read_reg(&channel_data->channel_regs->dmasr) & + XILINX_AXI_DMA_REGS_DMASR_SLVERR) { + LOG_ERR("DMA has slave error, DMASR = %" PRIx32, + dma_xilinx_axi_dma_read_reg(&channel_data->channel_regs->dmasr)); + error = true; + } + + if (dma_xilinx_axi_dma_read_reg(&channel_data->channel_regs->dmasr) & + XILINX_AXI_DMA_REGS_DMASR_DMADECERR) { + LOG_ERR("DMA has decode error, DMASR = %" PRIx32, + dma_xilinx_axi_dma_read_reg(&channel_data->channel_regs->dmasr)); + error = true; + } + + if (dma_xilinx_axi_dma_read_reg(&channel_data->channel_regs->dmasr) & + XILINX_AXI_DMA_REGS_DMASR_SGINTERR) { + LOG_ERR("DMA has SG internal error, DMASR = %" PRIx32, + dma_xilinx_axi_dma_read_reg(&channel_data->channel_regs->dmasr)); + error = true; + } + + if (dma_xilinx_axi_dma_read_reg(&channel_data->channel_regs->dmasr) & + XILINX_AXI_DMA_REGS_DMASR_SGSLVERR) { + LOG_ERR("DMA has SG slave error, DMASR = %" PRIx32, + dma_xilinx_axi_dma_read_reg(&channel_data->channel_regs->dmasr)); + error = true; + } + + if (dma_xilinx_axi_dma_read_reg(&channel_data->channel_regs->dmasr) & + XILINX_AXI_DMA_REGS_DMASR_SGDECERR) { + LOG_ERR("DMA has SG decode error, DMASR = %" PRIx32, + dma_xilinx_axi_dma_read_reg(&channel_data->channel_regs->dmasr)); + error = true; + } + + if (descriptor->status & XILINX_AXI_DMA_SG_DESCRIPTOR_STATUS_DEC_ERR_MASK) { + LOG_ERR("Descriptor has SG decode error, status=%" PRIx32, descriptor->status); + error = true; + } + + if (descriptor->status & XILINX_AXI_DMA_SG_DESCRIPTOR_STATUS_SLV_ERR_MASK) { + LOG_ERR("Descriptor has SG slave error, status=%" PRIx32, descriptor->status); + error = true; + } + + if (descriptor->status & XILINX_AXI_DMA_SG_DESCRIPTOR_STATUS_INT_ERR_MASK) { + LOG_ERR("Descriptor has SG internal error, status=%" PRIx32, descriptor->status); + error = true; + } + + return error; +} +#pragma GCC diagnostic pop + +static int +dma_xilinx_axi_dma_clean_up_sg_descriptors(const struct device *dev, + struct dma_xilinx_axi_dma_channel *channel_data, + const char *chan_name) +{ + volatile struct dma_xilinx_axi_dma_sg_descriptor *current_descriptor = + &channel_data->descriptors[channel_data->current_transfer_end_index]; + unsigned int processed_packets = 0; + + while (current_descriptor->status & XILINX_AXI_DMA_SG_DESCRIPTOR_STATUS_COMPLETE_MASK || + current_descriptor->status & ~XILINX_AXI_DMA_SG_DESCRIPTOR_STATUS_TRANSFERRED_MASK) { + /* descriptor completed or errored out - need to call callback */ + int retval = DMA_STATUS_COMPLETE; + + /* this is meaningless / ignored for TX channel */ + channel_data->last_rx_size = current_descriptor->status & + XILINX_AXI_DMA_SG_DESCRIPTOR_STATUS_LENGTH_MASK; + + if (dma_xilinx_axi_dma_channel_has_error(channel_data, current_descriptor)) { + LOG_ERR("Channel / descriptor error on %s chan!", chan_name); + retval = -EFAULT; + } + + if (channel_data->check_csum_in_isr) { + uint32_t checksum_status = current_descriptor->app2; + + if (checksum_status & XILINX_AXI_DMA_SG_DESCRIPTOR_APP2_FCS_ERR_MASK) { + LOG_ERR("Checksum offloading has FCS error status %" PRIx32 "!", + checksum_status); + retval = -EFAULT; + } + + if ((checksum_status & XILINX_AXI_DMA_SG_DESCRIPTOR_APP2_IP_ERR_MASK) == + XILINX_AXI_DMA_SG_DESCRIPTOR_APP2_IP_ERR_MASK) { + LOG_ERR("Checksum offloading has IP error status %" PRIx32 "!", + checksum_status); + retval = -EFAULT; + } + + if ((checksum_status & XILINX_AXI_DMA_SG_DESCRIPTOR_APP2_UDP_ERR_MASK) == + XILINX_AXI_DMA_SG_DESCRIPTOR_APP2_UDP_ERR_MASK) { + LOG_ERR("Checksum offloading has UDP error status %" PRIx32 "!", + checksum_status); + retval = -EFAULT; + } + + if ((checksum_status & XILINX_AXI_DMA_SG_DESCRIPTOR_APP2_TCP_ERR_MASK) == + XILINX_AXI_DMA_SG_DESCRIPTOR_APP2_TCP_ERR_MASK) { + LOG_ERR("Checksum offloading has TCP error status %" PRIx32 "!", + checksum_status); + retval = -EFAULT; + } + /* FIXME in some corner cases, the hardware cannot check the checksum */ + /* in this case, we cannot let the Zephyr network stack know, */ + /* as we do not have per-skb flags for checksum status */ + } + + /* clears the flags such that the DMA does not transfer it twice or errors */ + current_descriptor->control = current_descriptor->status = 0; + + /* callback might start new transfer */ + /* hence, the transfer end needs to be updated */ + channel_data->current_transfer_end_index++; + if (channel_data->current_transfer_end_index >= channel_data->num_descriptors) { + channel_data->current_transfer_end_index = 0; + } + + if (channel_data->completion_callback) { + LOG_DBG("Received packet with %u bytes!", channel_data->last_rx_size); + channel_data->completion_callback( + dev, channel_data->completion_callback_user_data, + XILINX_AXI_DMA_TX_CHANNEL_NUM, retval); + } + + current_descriptor = + &channel_data->descriptors[channel_data->current_transfer_end_index]; + processed_packets++; + } + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" + /* this clears the IRQ */ + /* FIXME write the same value back... */ + dma_xilinx_axi_dma_write_reg(&channel_data->channel_regs->dmasr, 0xffffffff); +#pragma GCC diagnostic pop + + /* writes must commit before returning from ISR */ + barrier_dmem_fence_full(); + + return processed_packets; +} + +static void dma_xilinx_axi_dma_tx_isr(const struct device *dev) +{ + struct dma_xilinx_axi_dma_data *data = dev->data; + struct dma_xilinx_axi_dma_channel *channel_data = + &data->channels[XILINX_AXI_DMA_TX_CHANNEL_NUM]; + int processed_packets; + + dma_xilinx_axi_dma_disable_cache(); + + processed_packets = dma_xilinx_axi_dma_clean_up_sg_descriptors(dev, channel_data, "TX"); + + dma_xilinx_axi_dma_enable_cache(); + + LOG_DBG("Received %u RX packets in this ISR!\n", processed_packets); + + dma_xilinx_axi_dma_acknowledge_interrupt(channel_data); +} + +static void dma_xilinx_axi_dma_rx_isr(const struct device *dev) +{ + struct dma_xilinx_axi_dma_data *data = dev->data; + struct dma_xilinx_axi_dma_channel *channel_data = + &data->channels[XILINX_AXI_DMA_RX_CHANNEL_NUM]; + int processed_packets; + + dma_xilinx_axi_dma_disable_cache(); + + processed_packets = dma_xilinx_axi_dma_clean_up_sg_descriptors(dev, channel_data, "RX"); + + dma_xilinx_axi_dma_enable_cache(); + + LOG_DBG("Cleaned up %u TX packets in this ISR!\n", processed_packets); + + dma_xilinx_axi_dma_acknowledge_interrupt(channel_data); +} + +#ifdef CONFIG_DMA_64BIT +typedef uint64_t dma_addr_t; +#else +typedef uint32_t dma_addr_t; +#endif + +static int dma_xilinx_axi_dma_start(const struct device *dev, uint32_t channel) +{ + const struct dma_xilinx_axi_dma_config *cfg = dev->config; + struct dma_xilinx_axi_dma_data *data = dev->data; + struct dma_xilinx_axi_dma_channel *channel_data = &data->channels[channel]; + volatile struct dma_xilinx_axi_dma_sg_descriptor *current_descriptor; + volatile struct dma_xilinx_axi_dma_sg_descriptor *first_unprocessed_descriptor; + size_t tail_descriptor; + + bool halted = false; + + /* running ISR in parallel could cause issues with the metadata */ + const int irq_key = dma_xilinx_axi_dma_lock_irq(cfg, channel); + + if (channel >= cfg->channels) { + LOG_ERR("Invalid channel %" PRIu32 " - must be < %" PRIu32 "!", channel, + cfg->channels); + dma_xilinx_axi_dma_unlock_irq(cfg, channel, irq_key); + return -EINVAL; + } + + tail_descriptor = channel_data->current_transfer_start_index++; + + if (channel_data->current_transfer_start_index >= channel_data->num_descriptors) { + LOG_DBG("Wrapping tail descriptor on %s chan!", + channel == XILINX_AXI_DMA_TX_CHANNEL_NUM ? "TX" : "RX"); + channel_data->current_transfer_start_index = 0; + } + + dma_xilinx_axi_dma_disable_cache(); + current_descriptor = &channel_data->descriptors[tail_descriptor]; + first_unprocessed_descriptor = + &channel_data->descriptors[channel_data->current_transfer_end_index]; + + LOG_DBG("Starting DMA on %s channel with tail ptr %zu start ptr %zu", + channel == XILINX_AXI_DMA_TX_CHANNEL_NUM ? "TX" : "RX", tail_descriptor, + channel_data->current_transfer_end_index); + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" + if (dma_xilinx_axi_dma_read_reg(&channel_data->channel_regs->dmasr) & + XILINX_AXI_DMA_REGS_DMASR_HALTED) { + + halted = true; + + LOG_DBG("AXI DMA is halted - restart operation!"); + +#ifdef CONFIG_DMA_64BIT + dma_xilinx_axi_dma_write_reg( + &channel_data->channel_regs->curdesc, + (uint32_t)(((uintptr_t)first_unprocessed_descriptor) & 0xffffffff)); + dma_xilinx_axi_dma_write_reg( + &channel_data->channel_regs->curdesc_msb, + (uint32_t)(((uintptr_t)first_unprocessed_descriptor) >> 32)); +#else + dma_xilinx_axi_dma_write_reg(&channel_data->channel_regs->curdesc, + (uint32_t)(uintptr_t)first_unprocessed_descriptor); +#endif + } +#pragma GCC diagnostic pop + + /* current descriptor MUST be set before tail descriptor */ + barrier_dmem_fence_full(); + + if (halted) { + uint32_t new_control = 0; + + new_control |= XILINX_AXI_DMA_REGS_DMACR_RS; + /* no reset */ + new_control &= ~XILINX_AXI_DMA_REGS_DMACR_RESET; + /* TODO make this a DT parameter */ + /* for Eth DMA, this should never be used */ + new_control &= ~XILINX_AXI_DMA_REGS_DMACR_KEYHOLE; + /* no cyclic mode - we use completed bit to control which */ + /* transfers where completed */ + new_control &= ~XILINX_AXI_DMA_REGS_DMACR_CYC_BD_EN; + /* we want interrupts on complete */ + new_control |= XILINX_AXI_DMA_REGS_DMACR_IOC_IRQEN; + /* we do want timeout IRQs */ + /* they are used to catch cases where we missed interrupts */ + new_control |= XILINX_AXI_DMA_REGS_DMACR_DLY_IRQEN; + /* we want IRQs on error */ + new_control |= XILINX_AXI_DMA_REGS_DMACR_ERR_IRQEN; + /* interrupt after every completed transfer */ + new_control |= CONFIG_DMA_XILINX_AXI_DMA_INTERRUPT_THRESHOLD + << XILINX_AXI_DMA_REGS_DMACR_IRQTHRESH_SHIFT_BITS; + /* timeout after config * 125 * clock period */ + new_control |= CONFIG_DMA_XILINX_AXI_DMA_INTERRUPT_TIMEOUT + << XILINX_AXI_DMA_REGS_DMACR_IRQDELAY_SHIFT_BITS; + + LOG_DBG("New DMACR value: %" PRIx32, new_control); + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" + dma_xilinx_axi_dma_write_reg(&channel_data->channel_regs->dmacr, new_control); + /* need to make sure start was committed before writing tail */ + barrier_dmem_fence_full(); + } + +#ifdef CONFIG_DMA_64BIT + dma_xilinx_axi_dma_write_reg(&channel_data->channel_regs->taildesc, + (uint32_t)(((uintptr_t)current_descriptor) & 0xffffffff)); + dma_xilinx_axi_dma_write_reg(&channel_data->channel_regs->taildesc_msb, + (uint32_t)(((uintptr_t)current_descriptor) >> 32)); +#else + dma_xilinx_axi_dma_write_reg(&channel_data->channel_regs->taildesc, + (uint32_t)(uintptr_t)current_descriptor); +#endif +#pragma GCC diagnostic pop + + dma_xilinx_axi_dma_enable_cache(); + + dma_xilinx_axi_dma_unlock_irq(cfg, channel, irq_key); + + /* commit stores before returning to caller */ + barrier_dmem_fence_full(); + + return 0; +} + +static int dma_xilinx_axi_dma_stop(const struct device *dev, uint32_t channel) +{ + const struct dma_xilinx_axi_dma_config *cfg = dev->config; + struct dma_xilinx_axi_dma_data *data = dev->data; + struct dma_xilinx_axi_dma_channel *channel_data = &data->channels[channel]; + + uint32_t new_control; + + if (channel >= cfg->channels) { + LOG_ERR("Invalid channel %" PRIu32 " - must be < %" PRIu32 "!", channel, + cfg->channels); + return -EINVAL; + } + + k_timer_stop(&channel_data->polling_timer); + + new_control = channel_data->channel_regs->dmacr; + /* RS = 0 --> DMA will complete ongoing transactions and then go into hold */ + new_control = new_control & ~XILINX_AXI_DMA_REGS_DMACR_RS; + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" + dma_xilinx_axi_dma_write_reg(&channel_data->channel_regs->dmacr, new_control); +#pragma GCC diagnostic pop + + /* commit before returning to caller */ + barrier_dmem_fence_full(); + + return 0; +} + +static int dma_xilinx_axi_dma_get_status(const struct device *dev, uint32_t channel, + struct dma_status *stat) +{ + const struct dma_xilinx_axi_dma_config *cfg = dev->config; + struct dma_xilinx_axi_dma_data *data = dev->data; + struct dma_xilinx_axi_dma_channel *channel_data = &data->channels[channel]; + + if (channel >= cfg->channels) { + LOG_ERR("Invalid channel %" PRIu32 " - must be < %" PRIu32 "!", channel, + cfg->channels); + return -EINVAL; + } + + memset(stat, 0, sizeof(*stat)); + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" + stat->busy = !(dma_xilinx_axi_dma_read_reg(&channel_data->channel_regs->dmasr) & + XILINX_AXI_DMA_REGS_DMASR_IDLE) && + !(dma_xilinx_axi_dma_read_reg(&channel_data->channel_regs->dmasr) & + XILINX_AXI_DMA_REGS_DMASR_HALTED); +#pragma GCC diagnostic pop + stat->dir = channel_data->last_transfer_direction; + + /* FIXME fill hardware-specific fields */ + + return 0; +} +/** + * Transfers a single buffer through the DMA + * If is_first or is_last are NOT set, the buffer is considered part of a SG transfer consisting of + * multiple blocks. Otherwise, the block is one transfer. + */ +static inline int dma_xilinx_axi_dma_transfer_block(const struct dma_xilinx_axi_dma_config *cfg, + uint32_t channel, + struct dma_xilinx_axi_dma_channel *channel_data, + dma_addr_t buffer_addr, size_t block_size, + bool is_first, bool is_last) +{ + volatile struct dma_xilinx_axi_dma_sg_descriptor *current_descriptor; + + /* running ISR in parallel could cause issues with the metadata */ + const int irq_key = dma_xilinx_axi_dma_lock_irq(cfg, channel); + + current_descriptor = &channel_data->descriptors[channel_data->current_transfer_start_index]; + + dma_xilinx_axi_dma_disable_cache(); + +#ifdef CONFIG_DMA_64BIT + current_descriptor->buffer_address = (uint32_t)buffer_addr & 0xffffffff; + current_descriptor->buffer_address_msb = (uint32_t)(buffer_addr >> 32); +#else + current_descriptor->buffer_address = buffer_addr; +#endif + current_descriptor->app0 = channel_data->sg_desc_app0; + + if (block_size > UINT32_MAX) { + LOG_ERR("Too large block: %zu bytes!", block_size); + + dma_xilinx_axi_dma_enable_cache(); + dma_xilinx_axi_dma_unlock_irq(cfg, channel, irq_key); + + return -EINVAL; + } + /* clears the start of frame / end of frame flags as well */ + current_descriptor->control = (uint32_t)block_size; + + if (is_first) { + current_descriptor->control = + current_descriptor->control | XILINX_AXI_DMA_SG_DESCRIPTOR_CTRL_SOF_MASK; + } + if (is_last) { + current_descriptor->control = + current_descriptor->control | XILINX_AXI_DMA_SG_DESCRIPTOR_CTRL_EOF_MASK; + } + + /* SG descriptor must be completed BEFORE hardware is made aware of it */ + barrier_dmem_fence_full(); + + dma_xilinx_axi_dma_enable_cache(); + + dma_xilinx_axi_dma_unlock_irq(cfg, channel, irq_key); + + return 0; +} + +#ifdef CONFIG_DMA_64BIT +static inline int dma_xilinx_axi_dma_config_reload(const struct device *dev, uint32_t channel, + uint64_t src, uint64_t dst, size_t size) +#else +static inline int dma_xilinx_axi_dma_config_reload(const struct device *dev, uint32_t channel, + uint32_t src, uint32_t dst, size_t size) +#endif +{ + const struct dma_xilinx_axi_dma_config *cfg = dev->config; + struct dma_xilinx_axi_dma_data *data = dev->data; + struct dma_xilinx_axi_dma_channel *channel_data = &data->channels[channel]; + + if (channel >= cfg->channels) { + LOG_ERR("Invalid channel %" PRIu32 " - must be < %" PRIu32 "!", channel, + cfg->channels); + return -EINVAL; + } + /* one-block-at-a-time transfer */ + return dma_xilinx_axi_dma_transfer_block( + cfg, channel, channel_data, channel == XILINX_AXI_DMA_TX_CHANNEL_NUM ? src : dst, + size, true, true); +} + +/* regularly check if we missed an interrupt from the device */ +/* as interrupts are level-sensitive, this can happen on certain platforms */ +static void polling_timer_handler(struct k_timer *timer) +{ + struct dma_xilinx_axi_dma_channel *channel = + CONTAINER_OF(timer, struct dma_xilinx_axi_dma_channel, polling_timer); + const struct device *dev = channel->polling_timer_params.dev; + const unsigned int irq_number = channel->polling_timer_params.irq_number; + const int was_enabled = irq_is_enabled(irq_number); + + irq_disable(irq_number); + + LOG_DBG("Polling ISR!"); + + channel->polling_timer_params.isr(dev); + + if (was_enabled) { + irq_enable(irq_number); + } +} + +static int dma_xilinx_axi_dma_configure(const struct device *dev, uint32_t channel, + struct dma_config *dma_cfg) +{ + const struct dma_xilinx_axi_dma_config *cfg = dev->config; + struct dma_xilinx_axi_dma_data *data = dev->data; + struct dma_block_config *current_block = dma_cfg->head_block; + int ret = 0; + int block_count = 0; + + struct dma_xilinx_axi_dma_register_space *regs = + (struct dma_xilinx_axi_dma_register_space *)cfg->reg; + + if (channel >= cfg->channels) { + LOG_ERR("Invalid channel %" PRIu32 " - must be < %" PRIu32 "!", channel, + cfg->channels); + return -EINVAL; + } + + if (cfg->channels != XILINX_AXI_DMA_NUM_CHANNELS) { + LOG_ERR("Invalid number of configured channels (%" PRIu32 + ") - Xilinx AXI DMA must have %" PRIu32 " channels!", + cfg->channels, XILINX_AXI_DMA_NUM_CHANNELS); + return -EINVAL; + } + + if (dma_cfg->head_block->source_addr_adj == DMA_ADDR_ADJ_DECREMENT) { + LOG_ERR("Xilinx AXI DMA only supports incrementing addresses!"); + return -ENOTSUP; + } + + if (dma_cfg->head_block->dest_addr_adj == DMA_ADDR_ADJ_DECREMENT) { + LOG_ERR("Xilinx AXI DMA only supports incrementing addresses!"); + return -ENOTSUP; + } + + if (dma_cfg->head_block->source_addr_adj != DMA_ADDR_ADJ_INCREMENT && + dma_cfg->head_block->source_addr_adj != DMA_ADDR_ADJ_NO_CHANGE) { + LOG_ERR("invalid source_addr_adj %" PRIu16, dma_cfg->head_block->source_addr_adj); + return -ENOTSUP; + } + if (dma_cfg->head_block->dest_addr_adj != DMA_ADDR_ADJ_INCREMENT && + dma_cfg->head_block->dest_addr_adj != DMA_ADDR_ADJ_NO_CHANGE) { + LOG_ERR("invalid dest_addr_adj %" PRIu16, dma_cfg->head_block->dest_addr_adj); + return -ENOTSUP; + } + + if (channel == XILINX_AXI_DMA_TX_CHANNEL_NUM && + dma_cfg->channel_direction != MEMORY_TO_PERIPHERAL) { + LOG_ERR("TX channel must be used with MEMORY_TO_PERIPHERAL!"); + return -ENOTSUP; + } + + if (channel == XILINX_AXI_DMA_RX_CHANNEL_NUM && + dma_cfg->channel_direction != PERIPHERAL_TO_MEMORY) { + LOG_ERR("RX channel must be used with PERIPHERAL_TO_MEMORY!"); + return -ENOTSUP; + } + + k_timer_init(&data->channels[channel].polling_timer, polling_timer_handler, NULL); + + data->channels[channel].polling_timer_params.dev = dev; + data->channels[channel].polling_timer_params.irq_number = cfg->irq0_channels[channel]; + data->channels[channel].polling_timer_params.isr = + (channel == XILINX_AXI_DMA_TX_CHANNEL_NUM) ? dma_xilinx_axi_dma_tx_isr + : dma_xilinx_axi_dma_rx_isr; + + data->channels[channel].last_transfer_direction = dma_cfg->channel_direction; + + dma_xilinx_axi_dma_disable_cache(); + + if (channel == XILINX_AXI_DMA_TX_CHANNEL_NUM) { + data->channels[channel].descriptors = descriptors_tx; + data->channels[channel].num_descriptors = ARRAY_SIZE(descriptors_tx); + + data->channels[channel].channel_regs = ®s->mm2s_registers; + } else { + data->channels[channel].descriptors = descriptors_rx; + data->channels[channel].num_descriptors = ARRAY_SIZE(descriptors_rx); + + data->channels[channel].channel_regs = ®s->s2mm_registers; + } + + LOG_DBG("Resetting DMA channel!"); + + if (!data->device_has_been_reset) { + LOG_INF("Soft-resetting the DMA core!"); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" + /* this resets BOTH RX and TX channels, although it is triggered in per-channel + * DMACR + */ + dma_xilinx_axi_dma_write_reg(&data->channels[channel].channel_regs->dmacr, + XILINX_AXI_DMA_REGS_DMACR_RESET); +#pragma GCC diagnostic pop + data->device_has_been_reset = true; + } + + LOG_DBG("Configuring %zu DMA descriptors for %s", data->channels[channel].num_descriptors, + channel == XILINX_AXI_DMA_TX_CHANNEL_NUM ? "TX" : "RX"); + + /* only configures fields whos default is not 0, as descriptors are in zero-initialized */ + /* segment */ + data->channels[channel].current_transfer_start_index = + data->channels[channel].current_transfer_end_index = 0; + for (int i = 0; i < data->channels[channel].num_descriptors; i++) { + uintptr_t nextdesc; + uint32_t low_bytes; +#ifdef CONFIG_DMA_64BIT + uint32_t high_bytes; +#endif + if (i + 1 < data->channels[channel].num_descriptors) { + nextdesc = (uintptr_t)&data->channels[channel].descriptors[i + 1]; + } else { + nextdesc = (uintptr_t)&data->channels[channel].descriptors[0]; + } + /* SG descriptors have 64-byte alignment requirements */ + /* we check this here, for each descriptor */ + __ASSERT( + nextdesc & XILINX_AXI_DMA_SG_DESCRIPTOR_ADDRESS_MASK == 0, + "SG descriptor address %p (offset %u) was not aligned to 64-byte boundary!", + (void *)nextdesc, i); + + low_bytes = (uint32_t)(((uint64_t)nextdesc) & 0xffffffff); + data->channels[channel].descriptors[i].nxtdesc = low_bytes; + +#ifdef CONFIG_DMA_64BIT + high_bytes = (uint32_t)(((uint64_t)nextdesc >> 32) & 0xffffffff); + data->channels[channel].descriptors[i].nxtdesc_msb = high_bytes; +#endif + } + + dma_xilinx_axi_dma_enable_cache(); + + data->channels[channel].check_csum_in_isr = false; + + /* the DMA passes the app fields through to the AXIStream-connected device */ + /* whether the connected device understands these flags needs to be determined by the */ + /* caller! */ + switch (dma_cfg->linked_channel) { + case XILINX_AXI_DMA_LINKED_CHANNEL_FULL_CSUM_OFFLOAD: + if (channel == XILINX_AXI_DMA_TX_CHANNEL_NUM) { + /* for the TX channel, we need to indicate that we would like to use */ + /* checksum offloading */ + data->channels[channel].sg_desc_app0 = + XILINX_AXI_DMA_SG_DESCRIPTOR_APP0_CHECKSUM_OFFLOAD_FULL; + } else { + /* for the RX channel, the Ethernet core will indicate to us that it has */ + /* computed a checksum and whether it is valid we need to check this in */ + /* the ISR and report it upstream */ + data->channels[channel].check_csum_in_isr = true; + } + break; + case XILINX_AXI_DMA_LINKED_CHANNEL_NO_CSUM_OFFLOAD: + data->channels[channel].sg_desc_app0 = + XILINX_AXI_DMA_SG_DESCRIPTOR_APP0_CHECKSUM_OFFLOAD_NONE; + break; + default: + LOG_ERR("Linked channel invalid! Valid values: %u for full ethernt checksum " + "offloading %u for no checksum offloading!", + XILINX_AXI_DMA_LINKED_CHANNEL_FULL_CSUM_OFFLOAD, + XILINX_AXI_DMA_LINKED_CHANNEL_NO_CSUM_OFFLOAD); + return -EINVAL; + } + + data->channels[channel].completion_callback = dma_cfg->dma_callback; + data->channels[channel].completion_callback_user_data = dma_cfg->user_data; + + LOG_INF("Completed configuration of AXI DMA - Starting transfer!"); + + do { + ret = ret || + dma_xilinx_axi_dma_transfer_block(cfg, channel, &data->channels[channel], + channel == XILINX_AXI_DMA_TX_CHANNEL_NUM + ? current_block->source_address + : current_block->dest_address, + current_block->block_size, block_count == 0, + current_block->next_block == NULL); + block_count++; + } while ((current_block = current_block->next_block) && ret == 0); + + k_timer_start(&data->channels[channel].polling_timer, + K_MSEC(CONFIG_DMA_XILINX_AXI_DMA_POLL_INTERVAL), + K_MSEC(CONFIG_DMA_XILINX_AXI_DMA_POLL_INTERVAL)); + + return ret; +} + +static bool dma_xilinx_axi_dma_chan_filter(const struct device *dev, int channel, + void *filter_param) +{ + const char *filter_str = (const char *)filter_param; + + if (strcmp(filter_str, "tx") == 0) { + return channel == XILINX_AXI_DMA_TX_CHANNEL_NUM; + } + if (strcmp(filter_str, "rx") == 0) { + return channel == XILINX_AXI_DMA_RX_CHANNEL_NUM; + } + + return false; +} + +/* DMA API callbacks */ +static const struct dma_driver_api dma_xilinx_axi_dma_driver_api = { + .config = dma_xilinx_axi_dma_configure, + .reload = dma_xilinx_axi_dma_config_reload, + .start = dma_xilinx_axi_dma_start, + .stop = dma_xilinx_axi_dma_stop, + .suspend = NULL, + .resume = NULL, + .get_status = dma_xilinx_axi_dma_get_status, + .chan_filter = dma_xilinx_axi_dma_chan_filter, +}; + +static int dma_xilinx_axi_dma_init(const struct device *dev) +{ + const struct dma_xilinx_axi_dma_config *cfg = dev->config; + + cfg->irq_configure(); + return 0; +} + +/* first IRQ is TX */ +#define TX_IRQ_CONFIGURE(inst) \ + IRQ_CONNECT(DT_INST_IRQN_BY_IDX(inst, 0), DT_INST_IRQ_BY_IDX(inst, 0, priority), \ + dma_xilinx_axi_dma_tx_isr, DEVICE_DT_INST_GET(inst), 0); \ + irq_enable(DT_INST_IRQN_BY_IDX(inst, 0)); +/* second IRQ is RX */ +#define RX_IRQ_CONFIGURE(inst) \ + IRQ_CONNECT(DT_INST_IRQN_BY_IDX(inst, 1), DT_INST_IRQ_BY_IDX(inst, 1, priority), \ + dma_xilinx_axi_dma_rx_isr, DEVICE_DT_INST_GET(inst), 0); \ + irq_enable(DT_INST_IRQN_BY_IDX(inst, 1)); + +#define CONFIGURE_ALL_IRQS(inst) \ + TX_IRQ_CONFIGURE(inst); \ + RX_IRQ_CONFIGURE(inst); + +#define XILINX_AXI_DMA_INIT(inst) \ + static void dma_xilinx_axi_dma##inst##_irq_configure(void) \ + { \ + CONFIGURE_ALL_IRQS(inst); \ + } \ + static uint32_t dma_xilinx_axi_dma##inst##_irq0_channels[] = \ + DT_INST_PROP_OR(inst, interrupts, {0}); \ + static const struct dma_xilinx_axi_dma_config dma_xilinx_axi_dma##inst##_config = { \ + .reg = (void *)(uintptr_t)DT_INST_REG_ADDR(inst), \ + .channels = DT_INST_PROP(inst, dma_channels), \ + .irq_configure = dma_xilinx_axi_dma##inst##_irq_configure, \ + .irq0_channels = dma_xilinx_axi_dma##inst##_irq0_channels, \ + .irq0_channels_size = ARRAY_SIZE(dma_xilinx_axi_dma##inst##_irq0_channels), \ + }; \ + static struct dma_xilinx_axi_dma_channel \ + dma_xilinx_axi_dma##inst##_channels[DT_INST_PROP(inst, dma_channels)]; \ + ATOMIC_DEFINE(dma_xilinx_axi_dma_atomic##inst, DT_INST_PROP(inst, dma_channels)); \ + static struct dma_xilinx_axi_dma_data dma_xilinx_axi_dma##inst##_data = { \ + .ctx = {.magic = DMA_MAGIC, .atomic = NULL}, \ + .channels = dma_xilinx_axi_dma##inst##_channels, \ + }; \ + \ + DEVICE_DT_INST_DEFINE(inst, &dma_xilinx_axi_dma_init, NULL, \ + &dma_xilinx_axi_dma##inst##_data, \ + &dma_xilinx_axi_dma##inst##_config, POST_KERNEL, \ + CONFIG_DMA_INIT_PRIORITY, &dma_xilinx_axi_dma_driver_api); + +/* two different compatibles match the very same Xilinx AXI DMA, */ +/* depending on if it is used in the AXI Ethernet subsystem or not */ +#define DT_DRV_COMPAT xlnx_eth_dma +DT_INST_FOREACH_STATUS_OKAY(XILINX_AXI_DMA_INIT) + +#undef DT_DRV_COMPAT +#define DT_DRV_COMPAT xlnx_axi_dma_1_00_a +DT_INST_FOREACH_STATUS_OKAY(XILINX_AXI_DMA_INIT) diff --git a/drivers/dma/dma_xilinx_axi_dma.h b/drivers/dma/dma_xilinx_axi_dma.h new file mode 100644 index 0000000000000..05d3356637024 --- /dev/null +++ b/drivers/dma/dma_xilinx_axi_dma.h @@ -0,0 +1,28 @@ +/** @file + * @brief Definitions and non-standard functions for Xilinx AXI DMA. + */ +/* + * Copyright (c) 2024 CISPA Helmholtz Center for Information Security gGmbH + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef DMA_XILINX_AXI_DMA_H +#define DMA_XILINX_AXI_DMA_H + +#define XILINX_AXI_DMA_NUM_CHANNELS 2 +#define XILINX_AXI_DMA_TX_CHANNEL_NUM 0 +#define XILINX_AXI_DMA_RX_CHANNEL_NUM 1 + +#define XILINX_AXI_DMA_LINKED_CHANNEL_NO_CSUM_OFFLOAD 0x0 +#define XILINX_AXI_DMA_LINKED_CHANNEL_FULL_CSUM_OFFLOAD 0x1 + +#include +#include + +/** + * @brief Returns the size of the last RX transfer conducted by the DMA, based on the descriptor + * status. + */ +extern uint32_t dma_xilinx_axi_dma_last_received_frame_length(const struct device *dev); + +#endif diff --git a/dts/bindings/dma/xilinx,axi-dma-base.yaml b/dts/bindings/dma/xilinx,axi-dma-base.yaml new file mode 100644 index 0000000000000..41e7ee1dcbb30 --- /dev/null +++ b/dts/bindings/dma/xilinx,axi-dma-base.yaml @@ -0,0 +1,58 @@ +# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH +# SPDX-License-Identifier: Apache-2.0 + +description: Xilinx AXI DMA LogiCORE IP controller + +include: dma-controller.yaml + +# multiple "compatible" properties match the same driver and options + +properties: + reg: + type: array + description: DMA Control registers + required: true + + interrupts: + type: array + description: TX IRQ number followed by RX IRQ number + required: true + + interrupt-parent: + type: phandle + description: Interrupt controller that the DMA is connected to + + clocks: + type: phandle-array + + clock-frequency: + type: int + + xlnx,addrwidth: + type: int + required: true + description: DMA address width (64 or 32 bit) + enum: + - 32 + - 64 + + axistream-connected: + type: phandle + description: | + Handle to connected node, e.g., AXI Ethernet controller. + The axistream-connected and axistream-control-connected properties can easily cause circular + dependencies, if they are provided at the second device as well. + In this case, the python device tree script fails to assign ordinals, causing build failure. + I suggest you do not provide them at the DMA. + + axistream-control-connected: + type: phandle + description: Handle to connected control node, e.g., AXI Ethernet controller + + xlnx,include-dre: + type: boolean + description: Data realignment engine activated. This enables unaligned DMA transfers. + + xlnx,num-queues: + type: int + description: Number of queues per channel. diff --git a/dts/bindings/dma/xilinx,axi-dma.yaml b/dts/bindings/dma/xilinx,axi-dma.yaml new file mode 100644 index 0000000000000..ed6820a32cced --- /dev/null +++ b/dts/bindings/dma/xilinx,axi-dma.yaml @@ -0,0 +1,12 @@ +# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH +# SPDX-License-Identifier: Apache-2.0 + +description: | + Xilinx AXI DMA LogiCORE IP controller with compatibility string + generated for use of the DMA outside of the AXI Ethernet subsystem. + +include: xilinx,axi-dma-base.yaml + +compatible: "xlnx,axi-dma-1.00.a" + +# no custom properties, just different compatible diff --git a/dts/bindings/dma/xilinx,eth-dma.yaml b/dts/bindings/dma/xilinx,eth-dma.yaml new file mode 100644 index 0000000000000..60b95a8c36bd5 --- /dev/null +++ b/dts/bindings/dma/xilinx,eth-dma.yaml @@ -0,0 +1,13 @@ +# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH +# SPDX-License-Identifier: Apache-2.0 + +description: | + Xilinx AXI DMA LogiCORE IP controller with compatibility string + generated in use with the AXI Ethernet subsystem. + +include: xilinx,axi-dma-base.yaml + +# this is the compatible generated by Vitis for the AXI Ethernet subsystem +compatible: "xlnx,eth-dma" + +# no custom properties, just different compatible From 95a97fd287c2f909f1043eafcd7e96908102a6ea Mon Sep 17 00:00:00 2001 From: Peter Mitsis Date: Fri, 27 Sep 2024 10:32:25 -0700 Subject: [PATCH 2770/4482] tests: Port Thread-Metric benchmark from ThreadX Ports the Thread-Metric suite of benchmarks from ThreadX to Zephyr. This makes it easier for others to run these benchmarks with the best set of configuration options for their board so that they can better compare Zephyr performance to another RTOS. Signed-off-by: Peter Mitsis --- tests/benchmarks/thread_metric/CMakeLists.txt | 16 + tests/benchmarks/thread_metric/Kconfig | 83 ++++++ tests/benchmarks/thread_metric/prj.conf | 25 ++ tests/benchmarks/thread_metric/src/tm_api.h | 103 +++++++ .../src/tm_basic_processing_test.c | 169 +++++++++++ .../src/tm_cooperative_scheduling_test.c | 250 ++++++++++++++++ .../tm_interrupt_preemption_processing_test.c | 218 ++++++++++++++ .../src/tm_interrupt_processing_test.c | 202 +++++++++++++ .../src/tm_memory_allocation_test.c | 150 ++++++++++ .../src/tm_message_processing_test.c | 161 ++++++++++ .../thread_metric/src/tm_porting_layer.h | 20 ++ .../src/tm_porting_layer_zephyr.c | 223 ++++++++++++++ .../src/tm_preemptive_scheduling_test.c | 281 ++++++++++++++++++ .../src/tm_synchronization_processing_test.c | 152 ++++++++++ tests/benchmarks/thread_metric/testcase.yaml | 52 ++++ .../thread_metric/thread_metric_readme.txt | 248 ++++++++++++++++ 16 files changed, 2353 insertions(+) create mode 100644 tests/benchmarks/thread_metric/CMakeLists.txt create mode 100644 tests/benchmarks/thread_metric/Kconfig create mode 100644 tests/benchmarks/thread_metric/prj.conf create mode 100644 tests/benchmarks/thread_metric/src/tm_api.h create mode 100644 tests/benchmarks/thread_metric/src/tm_basic_processing_test.c create mode 100644 tests/benchmarks/thread_metric/src/tm_cooperative_scheduling_test.c create mode 100644 tests/benchmarks/thread_metric/src/tm_interrupt_preemption_processing_test.c create mode 100644 tests/benchmarks/thread_metric/src/tm_interrupt_processing_test.c create mode 100644 tests/benchmarks/thread_metric/src/tm_memory_allocation_test.c create mode 100644 tests/benchmarks/thread_metric/src/tm_message_processing_test.c create mode 100644 tests/benchmarks/thread_metric/src/tm_porting_layer.h create mode 100644 tests/benchmarks/thread_metric/src/tm_porting_layer_zephyr.c create mode 100644 tests/benchmarks/thread_metric/src/tm_preemptive_scheduling_test.c create mode 100644 tests/benchmarks/thread_metric/src/tm_synchronization_processing_test.c create mode 100644 tests/benchmarks/thread_metric/testcase.yaml create mode 100644 tests/benchmarks/thread_metric/thread_metric_readme.txt diff --git a/tests/benchmarks/thread_metric/CMakeLists.txt b/tests/benchmarks/thread_metric/CMakeLists.txt new file mode 100644 index 0000000000000..defd60de073f7 --- /dev/null +++ b/tests/benchmarks/thread_metric/CMakeLists.txt @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(thread_metric) + +FILE(GLOB app_sources src/tm_porting_layer_zephyr.c) +target_sources(app PRIVATE ${app_sources}) +target_sources_ifdef(CONFIG_TM_BASIC app PRIVATE src/tm_basic_processing_test.c) +target_sources_ifdef(CONFIG_TM_COOPERATIVE app PRIVATE src/tm_cooperative_scheduling_test.c) +target_sources_ifdef(CONFIG_TM_INTERRUPT app PRIVATE src/tm_interrupt_processing_test.c) +target_sources_ifdef(CONFIG_TM_INTERRUPT_PREEMPTION app PRIVATE src/tm_interrupt_preemption_processing_test.c) +target_sources_ifdef(CONFIG_TM_MEMORY_ALLOCATION app PRIVATE src/tm_memory_allocation_test.c) +target_sources_ifdef(CONFIG_TM_MESSAGE app PRIVATE src/tm_message_processing_test.c) +target_sources_ifdef(CONFIG_TM_PREEMPTIVE app PRIVATE src/tm_preemptive_scheduling_test.c) +target_sources_ifdef(CONFIG_TM_SYNCHRONIZATION app PRIVATE src/tm_synchronization_processing_test.c) diff --git a/tests/benchmarks/thread_metric/Kconfig b/tests/benchmarks/thread_metric/Kconfig new file mode 100644 index 0000000000000..37ecca6cd0e5e --- /dev/null +++ b/tests/benchmarks/thread_metric/Kconfig @@ -0,0 +1,83 @@ +# Copyright (c) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +mainmenu "Eclipse ThreadX Thread-Metric RTOS Test Suite" + +source "Kconfig.zephyr" + +choice TM_TEST + prompt "Select a Thread-Metric test to execute" + default TM_PREEMPTIVE + help + The Thread-Metric benchmark suite consists of eight RTOS tests. + These tests measure the total number of RTOS events that can be + processed during a 30 second time interval. + +config TM_BASIC + bool "Baseline basic benchmark" + help + The baseline basic benchmark consists of a single thread that counts + the number of times it performs a set of calculations. This number + is reported every 30 seconds. + +config TM_COOPERATIVE + bool "Cooperative context switching" + help + The cooperative context switching benchmark spawns five (5) threads + of equal priority that yield to each other and increment counters + on each context switch. The sum total of the counters is reported + every 30 seconds. + +config TM_INTERRUPT + bool "Interrupt processing" + select TEST + select IRQ_OFFLOAD + select IRQ_OFFLOAD_NESTED + help + The interrupt processing benchmark has a single thread that causes + an interrupt which results in its ISR incrementing a counter and then + posting a semaphore. The thread then increments its own counter and + takes that semaphore. The sum total of the counters is reported + every 30 seconds. + +config TM_INTERRUPT_PREEMPTION + bool "Interrupt processing preemption" + select TEST + select IRQ_OFFLOAD + select IRQ_OFFLOAD_NESTED + help + The interrupt preemption benchmark counts the number of times that + an ISR from a software generated interrupt results in the preemption + of a thread. The total number of context switches is reported every + 30 seconds. + +config TM_MEMORY_ALLOCATION + bool "Memory allocation" + help + The memory allocation benchmark counts the number of times a thread + is able to allocate and then release a 128-byte block. This number + is reported every 30 seconds. + +config TM_MESSAGE + bool "Message processing" + help + The message processing benchmark counts the number of times that a + thread can send and receive a 16-byte message from a message queue. + This number is reported every 30 seconds. + +config TM_PREEMPTIVE + bool "Preemptive context switching" + help + The preemptive context switching benchmark creates five (5) threads + of different priorities that suspend and resume each other in a + cyclical pattern. The total number of context switches is reported + every 30 seconds. + +config TM_SYNCHRONIZATION + bool "Synchronization" + help + The synchronization benchmark counts the number of times that a + thread can give and take a semaphore without blocking. This number + is reported every 30 seconds. + +endchoice diff --git a/tests/benchmarks/thread_metric/prj.conf b/tests/benchmarks/thread_metric/prj.conf new file mode 100644 index 0000000000000..186535cdeca8b --- /dev/null +++ b/tests/benchmarks/thread_metric/prj.conf @@ -0,0 +1,25 @@ +# Default base configuration file + +# Use a tickless kernel to minimize the number of timer interrupts +CONFIG_TICKLESS_KERNEL=y +CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 + +# Optimize for speed +CONFIG_SPEED_OPTIMIZATIONS=y + +# Disable time slicing +CONFIG_TIMESLICING=n + +# Test is only designed for a single CPU +CONFIG_MP_MAX_NUM_CPUS=1 + +# Disabling hardware stack protection can greatly +# improve system performance. +CONFIG_HW_STACK_PROTECTION=n + +# Picolibc is faster than Zephyr's minimal libc memcpy +CONFIG_PICOLIBC_SPEED_OPTIMIZATIONS=y +CONFIG_PICOLIBC_USE_MODULE=y + +# Disable Thread Local Storage for better context switching times +CONFIG_THREAD_LOCAL_STORAGE=n diff --git a/tests/benchmarks/thread_metric/src/tm_api.h b/tests/benchmarks/thread_metric/src/tm_api.h new file mode 100644 index 0000000000000..b11a182b24b87 --- /dev/null +++ b/tests/benchmarks/thread_metric/src/tm_api.h @@ -0,0 +1,103 @@ +/*************************************************************************** + * Copyright (c) 2024 Microsoft Corporation + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * SPDX-License-Identifier: MIT + **************************************************************************/ + +/**************************************************************************/ +/**************************************************************************/ +/** */ +/** Thread-Metric Component */ +/** */ +/** Application Interface (API) */ +/** */ +/**************************************************************************/ +/**************************************************************************/ + +/**************************************************************************/ +/* */ +/* APPLICATION INTERFACE DEFINITION RELEASE */ +/* */ +/* tm_api.h PORTABLE C */ +/* 6.1.7 */ +/* AUTHOR */ +/* */ +/* William E. Lamie, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This file defines the basic Application Interface (API) */ +/* implementation source code for the Thread-Metrics performance */ +/* test suite. All service prototypes and data structure definitions */ +/* are defined in this file. */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* 10-15-2021 William E. Lamie Initial Version 6.1.7 */ +/* */ +/**************************************************************************/ + +#ifndef TM_API_H +#define TM_API_H + +#include "tm_porting_layer.h" + +/* + * Determine if a C++ compiler is being used. If so, ensure that standard + * C is used to process the API information. + */ + +#ifdef __cplusplus + +/* Yes, C++ compiler is present. Use standard C. */ +extern "C" { + +#endif + +/* Define API constants. */ + +#define TM_SUCCESS 0 +#define TM_ERROR 1 + +/* Define the time interval in seconds. This can be changed with a -D compiler option. */ + +#ifndef TM_TEST_DURATION +#define TM_TEST_DURATION 30 +#endif + +/* + * Define RTOS Neutral APIs. RTOS vendors should fill in the guts of the following + * API. Once this is done the Thread-Metric tests can be successfully run. + */ + +void tm_initialize(void (*test_initialization_function)(void)); +int tm_thread_create(int thread_id, int priority, void (*entry_function)(void *, void *, void *)); +int tm_thread_resume(int thread_id); +int tm_thread_suspend(int thread_id); +void tm_thread_relinquish(void); +void tm_thread_sleep(int seconds); +int tm_queue_create(int queue_id); +int tm_queue_send(int queue_id, unsigned long *message_ptr); +int tm_queue_receive(int queue_id, unsigned long *message_ptr); +int tm_semaphore_create(int semaphore_id); +int tm_semaphore_get(int semaphore_id); +int tm_semaphore_put(int semaphore_id); +int tm_memory_pool_create(int pool_id); +int tm_memory_pool_allocate(int pool_id, unsigned char **memory_ptr); +int tm_memory_pool_deallocate(int pool_id, unsigned char *memory_ptr); + +/* + * Determine if a C++ compiler is being used. If so, complete the standard + * C conditional started above. + */ +#ifdef __cplusplus +} +#endif + +#endif diff --git a/tests/benchmarks/thread_metric/src/tm_basic_processing_test.c b/tests/benchmarks/thread_metric/src/tm_basic_processing_test.c new file mode 100644 index 0000000000000..7b0399de2e9a1 --- /dev/null +++ b/tests/benchmarks/thread_metric/src/tm_basic_processing_test.c @@ -0,0 +1,169 @@ +/*************************************************************************** + * Copyright (c) 2024 Microsoft Corporation + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * SPDX-License-Identifier: MIT + **************************************************************************/ + +/**************************************************************************/ +/**************************************************************************/ +/** */ +/** Thread-Metric Component */ +/** */ +/** Basic Processing Test */ +/** */ +/**************************************************************************/ +/**************************************************************************/ + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* tm_basic_processing_test PORTABLE C */ +/* 6.1.7 */ +/* AUTHOR */ +/* */ +/* William E. Lamie, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This file defines the basic test for determining board processing */ +/* capabilities */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* 10-15-2021 William E. Lamie Initial Version 6.1.7 */ +/* */ +/**************************************************************************/ +#include "tm_api.h" + +/* Define the counters used in the demo application... */ + +volatile unsigned long tm_basic_processing_counter; + +/* + * Test array. We will just do a series of calculations on the + * test array to eat up processing bandwidth. The idea is that + * all RTOSes should produce the same metric here if everything + * else is equal, e.g. processor speed, memory speed, etc. + */ + +volatile unsigned long tm_basic_processing_array[1024]; + +/* Define the test thread prototypes. */ + +void tm_basic_processing_thread_0_entry(void *p1, void *p2, void *p3); + +/* Define the reporting function prototype. */ + +void tm_basic_processing_thread_report(void); + +/* Define the initialization prototype. */ + +void tm_basic_processing_initialize(void); + +/* Define main entry point. */ + +int main(void) +{ + /* Initialize the test. */ + tm_initialize(tm_basic_processing_initialize); + + return 0; +} + +/* Define the basic processing test initialization. */ + +void tm_basic_processing_initialize(void) +{ + /* Create thread 0 at priority 10. */ + tm_thread_create(0, 10, tm_basic_processing_thread_0_entry); + + /* Resume thread 0. */ + tm_thread_resume(0); + + tm_basic_processing_thread_report(); +} + +/* Define the basic processing thread. */ +void tm_basic_processing_thread_0_entry(void *p1, void *p2, void *p3) +{ + int i; + + (void)p1; + (void)p2; + (void)p3; + + /* Initialize the test array. */ + for (i = 0; i < 1024; i++) { + + /* Clear the basic processing array. */ + tm_basic_processing_array[i] = 0; + } + + while (1) { + + /* + * Loop through the basic processing array, add the previous + * contents with the contents of the tm_basic_processing_counter + * and xor the result with the previous value... just to eat + * up some time. + */ + + for (i = 0; i < 1024; i++) { + + /* Update each array entry. */ + tm_basic_processing_array[i] = + (tm_basic_processing_array[i] + tm_basic_processing_counter) ^ + tm_basic_processing_array[i]; + } + + /* Increment the basic processing counter. */ + tm_basic_processing_counter++; + } +} + +/* Define the basic processing reporting function. */ +void tm_basic_processing_thread_report(void) +{ + + unsigned long last_counter; + unsigned long relative_time; + + /* Initialize the last counter. */ + last_counter = 0; + + /* Initialize the relative time. */ + relative_time = 0; + + while (1) { + + /* Sleep to allow the test to run. */ + tm_thread_sleep(TM_TEST_DURATION); + + /* Increment the relative time. */ + relative_time = relative_time + TM_TEST_DURATION; + + /* Print results to the stdio window. */ + printf("**** Thread-Metric Basic Single Thread Processing Test **** Relative Time: " + "%lu\n", + relative_time); + + /* See if there are any errors. */ + if (tm_basic_processing_counter == last_counter) { + + printf("ERROR: Invalid counter value(s). Basic processing thread died!\n"); + } + + /* Show the time period total. */ + printf("Time Period Total: %lu\n\n", tm_basic_processing_counter - last_counter); + + /* Save the last counter. */ + last_counter = tm_basic_processing_counter; + } +} diff --git a/tests/benchmarks/thread_metric/src/tm_cooperative_scheduling_test.c b/tests/benchmarks/thread_metric/src/tm_cooperative_scheduling_test.c new file mode 100644 index 0000000000000..179c30f85da6e --- /dev/null +++ b/tests/benchmarks/thread_metric/src/tm_cooperative_scheduling_test.c @@ -0,0 +1,250 @@ +/*************************************************************************** + * Copyright (c) 2024 Microsoft Corporation + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * SPDX-License-Identifier: MIT + **************************************************************************/ + +/**************************************************************************/ +/**************************************************************************/ +/** */ +/** Thread-Metric Component */ +/** */ +/** Cooperative Scheduling Test */ +/** */ +/**************************************************************************/ +/**************************************************************************/ + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* tm_cooperative_scheduling_test PORTABLE C */ +/* 6.1.7 */ +/* AUTHOR */ +/* */ +/* William E. Lamie, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This file defines the cooperative scheduling test. */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* 10-15-2021 William E. Lamie Initial Version 6.1.7 */ +/* */ +/**************************************************************************/ +#include "tm_api.h" + +/* Define the counters used in the demo application... */ + +unsigned long tm_cooperative_thread_0_counter; +unsigned long tm_cooperative_thread_1_counter; +unsigned long tm_cooperative_thread_2_counter; +unsigned long tm_cooperative_thread_3_counter; +unsigned long tm_cooperative_thread_4_counter; + +/* Define the test thread prototypes. */ + +void tm_cooperative_thread_0_entry(void *p1, void *p2, void *p3); +void tm_cooperative_thread_1_entry(void *p1, void *p2, void *p3); +void tm_cooperative_thread_2_entry(void *p1, void *p2, void *p3); +void tm_cooperative_thread_3_entry(void *p1, void *p2, void *p3); +void tm_cooperative_thread_4_entry(void *p1, void *p2, void *p3); + +/* Define the reporting function prototype. */ + +void tm_cooperative_thread_report(void); + +/* Define the initialization prototype. */ + +void tm_cooperative_scheduling_initialize(void); + +/* Define main entry point. */ + +int main(void) +{ + + /* Initialize the test. */ + tm_initialize(tm_cooperative_scheduling_initialize); + + return 0; +} + +/* Define the cooperative scheduling test initialization. */ + +void tm_cooperative_scheduling_initialize(void) +{ + + /* Create all 5 threads at priority 3. */ + tm_thread_create(0, 3, tm_cooperative_thread_0_entry); + tm_thread_create(1, 3, tm_cooperative_thread_1_entry); + tm_thread_create(2, 3, tm_cooperative_thread_2_entry); + tm_thread_create(3, 3, tm_cooperative_thread_3_entry); + tm_thread_create(4, 3, tm_cooperative_thread_4_entry); + + /* Resume all 5 threads. */ + tm_thread_resume(0); + tm_thread_resume(1); + tm_thread_resume(2); + tm_thread_resume(3); + tm_thread_resume(4); + + tm_cooperative_thread_report(); +} + +/* Define the first cooperative thread. */ +void tm_cooperative_thread_0_entry(void *p1, void *p2, void *p3) +{ + (void)p1; + (void)p2; + (void)p3; + + while (1) { + + /* Relinquish to all other threads at same priority. */ + tm_thread_relinquish(); + + /* Increment this thread's counter. */ + tm_cooperative_thread_0_counter++; + } +} + +/* Define the second cooperative thread. */ +void tm_cooperative_thread_1_entry(void *p1, void *p2, void *p3) +{ + (void)p1; + (void)p2; + (void)p3; + + while (1) { + + /* Relinquish to all other threads at same priority. */ + tm_thread_relinquish(); + + /* Increment this thread's counter. */ + tm_cooperative_thread_1_counter++; + } +} + +/* Define the third cooperative thread. */ +void tm_cooperative_thread_2_entry(void *p1, void *p2, void *p3) +{ + (void)p1; + (void)p2; + (void)p3; + + while (1) { + + /* Relinquish to all other threads at same priority. */ + tm_thread_relinquish(); + + /* Increment this thread's counter. */ + tm_cooperative_thread_2_counter++; + } +} + +/* Define the fourth cooperative thread. */ +void tm_cooperative_thread_3_entry(void *p1, void *p2, void *p3) +{ + (void)p1; + (void)p2; + (void)p3; + + while (1) { + + /* Relinquish to all other threads at same priority. */ + tm_thread_relinquish(); + + /* Increment this thread's counter. */ + tm_cooperative_thread_3_counter++; + } +} + +/* Define the fifth cooperative thread. */ +void tm_cooperative_thread_4_entry(void *p1, void *p2, void *p3) +{ + (void)p1; + (void)p2; + (void)p3; + + while (1) { + + /* Relinquish to all other threads at same priority. */ + tm_thread_relinquish(); + + /* Increment this thread's counter. */ + tm_cooperative_thread_4_counter++; + } +} + +/* Define the cooperative test reporting function. */ +void tm_cooperative_thread_report(void) +{ + + unsigned long total; + unsigned long relative_time; + unsigned long last_total; + unsigned long average; + + /* Initialize the last total. */ + last_total = 0; + + /* Initialize the relative time. */ + relative_time = 0; + + while (1) { + + /* Sleep to allow the test to run. */ + tm_thread_sleep(TM_TEST_DURATION); + + /* Increment the relative time. */ + relative_time = relative_time + TM_TEST_DURATION; + + /* Print results to the stdio window. */ + printf("**** Thread-Metric Cooperative Scheduling Test **** Relative Time: %lu\n", + relative_time); + + /* Calculate the total of all the counters. */ + total = tm_cooperative_thread_0_counter + tm_cooperative_thread_1_counter + + tm_cooperative_thread_2_counter + tm_cooperative_thread_3_counter + + tm_cooperative_thread_4_counter; + + /* Calculate the average of all the counters. */ + average = total / 5; + + /* WCC - integrity check */ + printf("tm_cooperative_thread_0_counter: %lu\n", tm_cooperative_thread_0_counter); + printf("tm_cooperative_thread_1_counter: %lu\n", tm_cooperative_thread_1_counter); + printf("tm_cooperative_thread_2_counter: %lu\n", tm_cooperative_thread_2_counter); + printf("tm_cooperative_thread_3_counter: %lu\n", tm_cooperative_thread_3_counter); + printf("tm_cooperative_thread_4_counter: %lu\n", tm_cooperative_thread_4_counter); + + /* See if there are any errors. */ + if ((tm_cooperative_thread_0_counter < (average - 1)) || + (tm_cooperative_thread_0_counter > (average + 1)) || + (tm_cooperative_thread_1_counter < (average - 1)) || + (tm_cooperative_thread_1_counter > (average + 1)) || + (tm_cooperative_thread_2_counter < (average - 1)) || + (tm_cooperative_thread_2_counter > (average + 1)) || + (tm_cooperative_thread_3_counter < (average - 1)) || + (tm_cooperative_thread_3_counter > (average + 1)) || + (tm_cooperative_thread_4_counter < (average - 1)) || + (tm_cooperative_thread_4_counter > (average + 1))) { + + printf("ERROR: Invalid counter value(s). Cooperative counters should not " + "be more that 1 different than the average!\n"); + } + + /* Show the time period total. */ + printf("Time Period Total: %lu\n\n", total - last_total); + + /* Save the last total. */ + last_total = total; + } +} diff --git a/tests/benchmarks/thread_metric/src/tm_interrupt_preemption_processing_test.c b/tests/benchmarks/thread_metric/src/tm_interrupt_preemption_processing_test.c new file mode 100644 index 0000000000000..38b6b29835d0b --- /dev/null +++ b/tests/benchmarks/thread_metric/src/tm_interrupt_preemption_processing_test.c @@ -0,0 +1,218 @@ +/*************************************************************************** + * Copyright (c) 2024 Microsoft Corporation + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * SPDX-License-Identifier: MIT + **************************************************************************/ + +/**************************************************************************/ +/**************************************************************************/ +/** */ +/** Thread-Metric Component */ +/** */ +/** Interrupt Preemption Processing Test */ +/** */ +/**************************************************************************/ +/**************************************************************************/ + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* tm_interrupt_preemption_processing_test PORTABLE C */ +/* 6.1.7 */ +/* AUTHOR */ +/* */ +/* William E. Lamie, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This file defines the preemptive scheduling test. */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* 10-15-2021 William E. Lamie Initial Version 6.1.7 */ +/* */ +/**************************************************************************/ + +#include "tm_api.h" + +/* Define the counters used in the demo application... */ + +unsigned long tm_interrupt_preemption_thread_0_counter; +unsigned long tm_interrupt_preemption_thread_1_counter; +unsigned long tm_interrupt_preemption_handler_counter; + +/* Define the test thread prototypes. */ + +void tm_interrupt_preemption_thread_0_entry(void *p1, void *p2, void *p3); +void tm_interrupt_preemption_thread_1_entry(void *p1, void *p2, void *p3); + +/* Define the interrupt handler. This must be called from the RTOS. */ + +void tm_interrupt_handler(void); + +/* Define the initialization prototype. */ + +void tm_interrupt_preemption_processing_initialize(void); + +/* Define the reporting function */ + +void tm_interrupt_preemption_thread_report(void); + +/* Define main entry point. */ + +int main(void) +{ + + /* Initialize the test. */ + tm_initialize(tm_interrupt_preemption_processing_initialize); + + return 0; +} + +/* Define the interrupt processing test initialization. */ + +void tm_interrupt_preemption_processing_initialize(void) +{ + + /* Create interrupt thread at priority 3. */ + tm_thread_create(0, 3, tm_interrupt_preemption_thread_0_entry); + + /* Create thread that generates the interrupt at priority 10. */ + tm_thread_create(1, 10, tm_interrupt_preemption_thread_1_entry); + + /* Resume just thread 1. */ + tm_thread_resume(1); + + tm_interrupt_preemption_thread_report(); +} + +/* + * Define the interrupt thread. This thread is resumed from the + * interrupt handler. It runs and suspends. + */ +void tm_interrupt_preemption_thread_0_entry(void *p1, void *p2, void *p3) +{ + + (void)p1; + (void)p2; + (void)p3; + + while (1) { + + /* Increment this thread's counter. */ + tm_interrupt_preemption_thread_0_counter++; + + /* + * Suspend. This will allow the thread generating the + * interrupt to run again. + */ + tm_thread_suspend(0); + } +} + +/* Define the thread that generates the interrupt. */ +void tm_interrupt_preemption_thread_1_entry(void *p1, void *p2, void *p3) +{ + + (void)p1; + (void)p2; + (void)p3; + + while (1) { + + /* + * Force an interrupt. The underlying RTOS must see that the + * the interrupt handler is called from the appropriate software + * interrupt or trap. + */ + TM_CAUSE_INTERRUPT; + + /* + * We won't get back here until the interrupt processing is complete, + * including the execution of the higher priority thread made ready + * by the interrupt. + */ + + /* Increment this thread's counter. */ + tm_interrupt_preemption_thread_1_counter++; + } +} + +/* + * Define the interrupt handler. This must be called from the RTOS trap handler. + * To be fair, it must behave just like a processor interrupt, i.e. it must save + * the full context of the interrupted thread during the preemption processing. + */ +void tm_interrupt_handler(void) +{ + + /* Increment the interrupt count. */ + tm_interrupt_preemption_handler_counter++; + + /* Resume the higher priority thread from the ISR. */ + tm_thread_resume(0); +} + +/* Define the interrupt test reporting function. */ +void tm_interrupt_preemption_thread_report(void) +{ + + unsigned long total; + unsigned long relative_time; + unsigned long last_total; + unsigned long average; + + /* Initialize the last total. */ + last_total = 0; + + /* Initialize the relative time. */ + relative_time = 0; + + while (1) { + + /* Sleep to allow the test to run. */ + tm_thread_sleep(TM_TEST_DURATION); + + /* Increment the relative time. */ + relative_time = relative_time + TM_TEST_DURATION; + + /* Print results to the stdio window. */ + printf("**** Thread-Metric Interrupt Preemption Processing Test **** Relative " + "Time: %lu\n", + relative_time); + + /* Calculate the total of all the counters. */ + total = tm_interrupt_preemption_thread_0_counter + + tm_interrupt_preemption_thread_1_counter + + tm_interrupt_preemption_handler_counter; + + /* Calculate the average of all the counters. */ + average = total / 3; + + /* See if there are any errors. */ + if ((tm_interrupt_preemption_thread_0_counter < (average - 1)) || + (tm_interrupt_preemption_thread_0_counter > (average + 1)) || + (tm_interrupt_preemption_thread_1_counter < (average - 1)) || + (tm_interrupt_preemption_thread_1_counter > (average + 1)) || + (tm_interrupt_preemption_handler_counter < (average - 1)) || + (tm_interrupt_preemption_handler_counter > (average + 1))) { + + printf("ERROR: Invalid counter value(s). Interrupt processing test has " + "failed!\n"); + } + + /* Show the total interrupts for the time period. */ + printf("Time Period Total: %lu\n\n", + tm_interrupt_preemption_handler_counter - last_total); + + /* Save the last total number of interrupts. */ + last_total = tm_interrupt_preemption_handler_counter; + } +} diff --git a/tests/benchmarks/thread_metric/src/tm_interrupt_processing_test.c b/tests/benchmarks/thread_metric/src/tm_interrupt_processing_test.c new file mode 100644 index 0000000000000..2d1a14aad8f3c --- /dev/null +++ b/tests/benchmarks/thread_metric/src/tm_interrupt_processing_test.c @@ -0,0 +1,202 @@ +/*************************************************************************** + * Copyright (c) 2024 Microsoft Corporation + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * SPDX-License-Identifier: MIT + **************************************************************************/ + +/**************************************************************************/ +/**************************************************************************/ +/** */ +/** Thread-Metric Component */ +/** */ +/** Interrupt Processing Test */ +/** */ +/**************************************************************************/ +/**************************************************************************/ + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* tm_interrupt_processing_test PORTABLE C */ +/* 6.1.7 */ +/* AUTHOR */ +/* */ +/* William E. Lamie, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This file defines the No-preemption interrupt processing test. */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* 10-15-2021 William E. Lamie Initial Version 6.1.7 */ +/* */ +/**************************************************************************/ +#include "tm_api.h" + +/* Define the counters used in the demo application... */ + +unsigned long tm_interrupt_thread_0_counter; +unsigned long tm_interrupt_handler_counter; + +/* Define the test thread prototypes. */ + +void tm_interrupt_thread_0_entry(void *p1, void *p2, void *p3); + +/* Define the reporting function prototype. */ + +void tm_interrupt_thread_report(void); + +/* Define the interrupt handler. This must be called from the RTOS. */ + +void tm_interrupt_handler(void); + +/* Define the initialization prototype. */ + +void tm_interrupt_processing_initialize(void); + +/* Define main entry point. */ + +int main(void) +{ + + /* Initialize the test. */ + tm_initialize(tm_interrupt_processing_initialize); + + return 0; +} + +/* Define the interrupt processing test initialization. */ + +void tm_interrupt_processing_initialize(void) +{ + + /* Create thread that generates the interrupt at priority 10. */ + tm_thread_create(0, 10, tm_interrupt_thread_0_entry); + + /* + * Create a semaphore that will be posted from the interrupt + * handler. + */ + tm_semaphore_create(0); + + /* Resume just thread 0. */ + tm_thread_resume(0); + + tm_interrupt_thread_report(); +} + +/* Define the thread that generates the interrupt. */ +void tm_interrupt_thread_0_entry(void *p1, void *p2, void *p3) +{ + + int status; + + /* Pickup the semaphore since it is initialized to 1 by default. */ + status = tm_semaphore_get(0); + + /* Check for good status. */ + if (status != TM_SUCCESS) { + return; + } + + while (1) { + + /* + * Force an interrupt. The underlying RTOS must see that the + * the interrupt handler is called from the appropriate software + * interrupt or trap. + */ + + TM_CAUSE_INTERRUPT; + + /* + * We won't get back here until the interrupt processing is + * complete, including the setting of the semaphore from the + * interrupt handler. + */ + + /* Pickup the semaphore set by the interrupt handler. */ + status = tm_semaphore_get(0); + + /* Check for good status. */ + if (status != TM_SUCCESS) { + return; + } + + /* Increment this thread's counter. */ + tm_interrupt_thread_0_counter++; + } +} + +/* + * Define the interrupt handler. This must be called from the RTOS trap handler. + * To be fair, it must behave just like a processor interrupt, i.e. it must save + * the full context of the interrupted thread during the preemption processing. + */ +void tm_interrupt_handler(void) +{ + /* Increment the interrupt count. */ + tm_interrupt_handler_counter++; + + /* Put the semaphore from the interrupt handler. */ + tm_semaphore_put(0); +} + +/* Define the interrupt test reporting function. */ +void tm_interrupt_thread_report(void) +{ + + unsigned long total; + unsigned long last_total; + unsigned long relative_time; + unsigned long average; + + /* Initialize the last total. */ + last_total = 0; + + /* Initialize the relative time. */ + relative_time = 0; + + while (1) { + + /* Sleep to allow the test to run. */ + tm_thread_sleep(TM_TEST_DURATION); + + /* Increment the relative time. */ + relative_time = relative_time + TM_TEST_DURATION; + + /* Print results to the stdio window. */ + printf("**** Thread-Metric Interrupt Processing Test **** Relative Time: %lu\n", + relative_time); + + /* Calculate the total of all the counters. */ + total = tm_interrupt_thread_0_counter + tm_interrupt_handler_counter; + + /* Calculate the average of all the counters. */ + average = total / 2; + + /* See if there are any errors. */ + if ((tm_interrupt_thread_0_counter < (average - 1)) || + (tm_interrupt_thread_0_counter > (average + 1)) || + (tm_interrupt_handler_counter < (average - 1)) || + (tm_interrupt_handler_counter > (average + 1))) { + + printf("ERROR: Invalid counter value(s). Interrupt processing test has " + "failed!\n"); + } + + /* Show the total interrupts for the time period. */ + printf("Time Period Total: %lu\n\n", tm_interrupt_handler_counter - last_total); + + /* Save the last total number of interrupts. */ + last_total = tm_interrupt_handler_counter; + } +} diff --git a/tests/benchmarks/thread_metric/src/tm_memory_allocation_test.c b/tests/benchmarks/thread_metric/src/tm_memory_allocation_test.c new file mode 100644 index 0000000000000..9dbe26c86789c --- /dev/null +++ b/tests/benchmarks/thread_metric/src/tm_memory_allocation_test.c @@ -0,0 +1,150 @@ +/*************************************************************************** + * Copyright (c) 2024 Microsoft Corporation + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * SPDX-License-Identifier: MIT + **************************************************************************/ + +/**************************************************************************/ +/**************************************************************************/ +/** */ +/** Thread-Metric Component */ +/** */ +/** Memory Allocation Test */ +/** */ +/**************************************************************************/ +/**************************************************************************/ + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* tm_memory_allocation_test PORTABLE C */ +/* 6.1.7 */ +/* AUTHOR */ +/* */ +/* William E. Lamie, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This file defines the Message exchange processing test. */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* 10-15-2021 William E. Lamie Initial Version 6.1.7 */ +/* */ +/**************************************************************************/ +#include "tm_api.h" + +/* Define the counters used in the demo application... */ + +unsigned long tm_memory_allocation_counter; + +/* Define the test thread prototypes. */ + +void tm_memory_allocation_thread_0_entry(void *p1, void *p2, void *p3); + +/* Define the reporting function prototype. */ + +void tm_memory_allocation_thread_report(void); + +/* Define the initialization prototype. */ + +void tm_memory_allocation_initialize(void); + +/* Define main entry point. */ + +int main(void) +{ + + /* Initialize the test. */ + tm_initialize(tm_memory_allocation_initialize); + + return 0; +} + +/* Define the memory allocation processing test initialization. */ + +void tm_memory_allocation_initialize(void) +{ + /* Create a memory pool. */ + tm_memory_pool_create(0); + + /* Create thread 0 at priority 10. */ + tm_thread_create(0, 10, tm_memory_allocation_thread_0_entry); + + /* Resume thread 0. */ + tm_thread_resume(0); + + tm_memory_allocation_thread_report(); +} + +/* Define the memory allocation processing thread. */ +void tm_memory_allocation_thread_0_entry(void *p1, void *p2, void *p3) +{ + + int status; + unsigned char *memory_ptr; + + while (1) { + + /* Allocate memory from pool. */ + tm_memory_pool_allocate(0, &memory_ptr); + + /* Release the memory back to the pool. */ + status = tm_memory_pool_deallocate(0, memory_ptr); + + /* Check for invalid memory allocation/deallocation. */ + if (status != TM_SUCCESS) { + break; + } + + /* Increment the number of memory allocations sent and received. */ + tm_memory_allocation_counter++; + } +} + +/* Define the memory allocation test reporting function. */ +void tm_memory_allocation_thread_report(void) +{ + + unsigned long last_counter; + unsigned long relative_time; + + /* Initialize the last counter. */ + last_counter = 0; + + /* Initialize the relative time. */ + relative_time = 0; + + while (1) { + + /* Sleep to allow the test to run. */ + tm_thread_sleep(TM_TEST_DURATION); + + /* Increment the relative time. */ + relative_time = relative_time + TM_TEST_DURATION; + + /* Print results to the stdio window. */ + printf("**** Thread-Metric Memory Allocation Test **** Relative Time: %lu\n", + relative_time); + + /* See if there are any errors. */ + if (tm_memory_allocation_counter == last_counter) { + + printf("ERROR: Invalid counter value(s). Error allocating/deallocating " + "memory!\n"); + } + + /* Show the time period total. */ + printf("Time Period Total: %lu\n\n", tm_memory_allocation_counter - last_counter); + + /* Save the last counter. */ + last_counter = tm_memory_allocation_counter; + } +} diff --git a/tests/benchmarks/thread_metric/src/tm_message_processing_test.c b/tests/benchmarks/thread_metric/src/tm_message_processing_test.c new file mode 100644 index 0000000000000..4a6d3c0ae1ec8 --- /dev/null +++ b/tests/benchmarks/thread_metric/src/tm_message_processing_test.c @@ -0,0 +1,161 @@ +/*************************************************************************** + * Copyright (c) 2024 Microsoft Corporation + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * SPDX-License-Identifier: MIT + **************************************************************************/ + +/**************************************************************************/ +/**************************************************************************/ +/** */ +/** Thread-Metric Component */ +/** */ +/** Message Processing Test */ +/** */ +/**************************************************************************/ +/**************************************************************************/ + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* tm_message_processing_test PORTABLE C */ +/* 6.1.7 */ +/* AUTHOR */ +/* */ +/* William E. Lamie, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* Basic test for message exchange processing. */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* 10-15-2021 William E. Lamie Initial Version 6.1.7 */ +/* */ +/**************************************************************************/ +#include "tm_api.h" + +/* Define the counters used in the demo application... */ + +unsigned long tm_message_processing_counter; +unsigned long tm_message_sent[4]; +unsigned long tm_message_received[4]; + +/* Define the test thread prototypes. */ + +void tm_message_processing_thread_0_entry(void *p1, void *p2, void *p3); + +/* Define the reporting function prototype. */ + +void tm_message_processing_thread_report(void); + +/* Define the initialization prototype. */ + +void tm_message_processing_initialize(void); + +/* Define main entry point. */ + +int main(void) +{ + + /* Initialize the test. */ + tm_initialize(tm_message_processing_initialize); + + return 0; +} + +/* Define the message processing test initialization. */ + +void tm_message_processing_initialize(void) +{ + + /* Create thread 0 at priority 10. */ + tm_thread_create(0, 10, tm_message_processing_thread_0_entry); + + /* Resume thread 0. */ + tm_thread_resume(0); + + /* Create a queue for the message passing. */ + tm_queue_create(0); + + tm_message_processing_thread_report(); +} + +/* Define the message processing thread. */ +void tm_message_processing_thread_0_entry(void *p1, void *p2, void *p3) +{ + (void)p1; + (void)p2; + (void)p3; + + /* Initialize the source message. */ + tm_message_sent[0] = 0x11112222; + tm_message_sent[1] = 0x33334444; + tm_message_sent[2] = 0x55556666; + tm_message_sent[3] = 0x77778888; + + while (1) { + /* Send a message to the queue. */ + tm_queue_send(0, tm_message_sent); + + /* Receive a message from the queue. */ + tm_queue_receive(0, tm_message_received); + + /* Check for invalid message. */ + if (tm_message_received[3] != tm_message_sent[3]) { + break; + } + + /* Increment the last word of the 16-byte message. */ + tm_message_sent[3]++; + + /* Increment the number of messages sent and received. */ + tm_message_processing_counter++; + } +} + +/* Define the message test reporting function. */ +void tm_message_processing_thread_report(void) +{ + + unsigned long last_counter; + unsigned long relative_time; + + /* Initialize the last counter. */ + last_counter = 0; + + /* Initialize the relative time. */ + relative_time = 0; + + while (1) { + + /* Sleep to allow the test to run. */ + tm_thread_sleep(TM_TEST_DURATION); + + /* Increment the relative time. */ + relative_time = relative_time + TM_TEST_DURATION; + + /* Print results to the stdio window. */ + printf("**** Thread-Metric Message Processing Test **** Relative Time: %lu\n", + relative_time); + + /* See if there are any errors. */ + if (tm_message_processing_counter == last_counter) { + + printf("ERROR: Invalid counter value(s). Error sending/receiving " + "messages!\n"); + } + + /* Show the time period total. */ + printf("Time Period Total: %lu\n\n", tm_message_processing_counter - last_counter); + + /* Save the last counter. */ + last_counter = tm_message_processing_counter; + } +} diff --git a/tests/benchmarks/thread_metric/src/tm_porting_layer.h b/tests/benchmarks/thread_metric/src/tm_porting_layer.h new file mode 100644 index 0000000000000..6b819e3d52b4e --- /dev/null +++ b/tests/benchmarks/thread_metric/src/tm_porting_layer.h @@ -0,0 +1,20 @@ +/*************************************************************************** + * Copyright (c) 2024 Microsoft Corporation + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * SPDX-License-Identifier: MIT + **************************************************************************/ + +#ifndef TM_PORTING_LAYER_H +#define TM_PORTING_LAYER_H + +#include + +extern void tm_cause_interrupt(void); + +#define TM_CAUSE_INTERRUPT tm_cause_interrupt() + +#endif diff --git a/tests/benchmarks/thread_metric/src/tm_porting_layer_zephyr.c b/tests/benchmarks/thread_metric/src/tm_porting_layer_zephyr.c new file mode 100644 index 0000000000000..fc03f25c46639 --- /dev/null +++ b/tests/benchmarks/thread_metric/src/tm_porting_layer_zephyr.c @@ -0,0 +1,223 @@ +/*************************************************************************** + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2024 Intel Corporation + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * SPDX-License-Identifier: MIT + **************************************************************************/ + +/**************************************************************************/ +/**************************************************************************/ +/** */ +/** Thread-Metric Component */ +/** */ +/** Porting Layer (Must be completed with RTOS specifics) */ +/** */ +/**************************************************************************/ +/**************************************************************************/ + +/* Include necessary files. */ + +#include "tm_api.h" + +#include + +#define TM_TEST_NUM_THREADS 10 +#define TM_TEST_STACK_SIZE 1024 +#define TM_TEST_NUM_SEMAPHORES 4 +#define TM_TEST_NUM_MESSAGE_QUEUES 4 +#define TM_TEST_NUM_SLABS 4 + +#if (CONFIG_MP_MAX_NUM_CPUS > 1) +#error "*** Tests are only designed for single processor systems! ***" +#endif + +static struct k_thread test_thread[TM_TEST_NUM_THREADS]; +static K_THREAD_STACK_ARRAY_DEFINE(test_stack, TM_TEST_NUM_THREADS, TM_TEST_STACK_SIZE); + +static struct k_sem test_sem[TM_TEST_NUM_SEMAPHORES]; + +static struct k_msgq test_msgq[TM_TEST_NUM_MESSAGE_QUEUES]; +static char test_msgq_buffer[TM_TEST_NUM_MESSAGE_QUEUES][8][16]; + +static struct k_mem_slab test_slab[TM_TEST_NUM_SLABS]; +static char __aligned(4) test_slab_buffer[TM_TEST_NUM_SLABS][8 * 128]; + +/* + * This function called from main performs basic RTOS initialization, + * calls the test initialization function, and then starts the RTOS function. + */ +void tm_initialize(void (*test_initialization_function)(void)) +{ + test_initialization_function(); +} + +/* + * This function takes a thread ID and priority and attempts to create the + * file in the underlying RTOS. Valid priorities range from 1 through 31, + * where 1 is the highest priority and 31 is the lowest. If successful, + * the function should return TM_SUCCESS. Otherwise, TM_ERROR should be returned. + */ +int tm_thread_create(int thread_id, int priority, void (*entry_function)(void *, void *, void *)) +{ + k_tid_t tid; + + tid = k_thread_create(&test_thread[thread_id], test_stack[thread_id], + TM_TEST_STACK_SIZE, entry_function, + NULL, NULL, NULL, priority, 0, K_FOREVER); + + return (tid == &test_thread[thread_id]) ? TM_SUCCESS : TM_ERROR; +} + +/* + * This function resumes the specified thread. If successful, the function should + * return TM_SUCCESS. Otherwise, TM_ERROR should be returned. + */ +int tm_thread_resume(int thread_id) +{ + if (test_thread[thread_id].base.thread_state & _THREAD_PRESTART) { + k_thread_start(&test_thread[thread_id]); + } else { + k_thread_resume(&test_thread[thread_id]); + } + + return TM_SUCCESS; +} + +/* + * This function suspends the specified thread. If successful, the function should + * return TM_SUCCESS. Otherwise, TM_ERROR should be returned. + */ +int tm_thread_suspend(int thread_id) +{ + k_thread_suspend(&test_thread[thread_id]); + + return TM_SUCCESS; +} + +/* + * This function relinquishes to other ready threads at the same + * priority. + */ +void tm_thread_relinquish(void) +{ + k_yield(); +} + +/* + * This function suspends the specified thread for the specified number + * of seconds. + */ +void tm_thread_sleep(int seconds) +{ + k_sleep(K_SECONDS(seconds)); +} + +/* + * This function creates the specified queue. If successful, the function should + * return TM_SUCCESS. Otherwise, TM_ERROR should be returned. + */ +int tm_queue_create(int queue_id) +{ + k_msgq_init(&test_msgq[queue_id], &test_msgq_buffer[queue_id][0][0], 16, 8); + + return TM_SUCCESS; +} + +/* + * This function sends a 16-byte message to the specified queue. If successful, + * the function should return TM_SUCCESS. Otherwise, TM_ERROR should be returned. + */ +int tm_queue_send(int queue_id, unsigned long *message_ptr) +{ + return k_msgq_put(&test_msgq[queue_id], message_ptr, K_FOREVER); +} + +/* + * This function receives a 16-byte message from the specified queue. If successful, + * the function should return TM_SUCCESS. Otherwise, TM_ERROR should be returned. + */ +int tm_queue_receive(int queue_id, unsigned long *message_ptr) +{ + return k_msgq_get(&test_msgq[queue_id], message_ptr, K_FOREVER); +} + +/* + * This function creates the specified semaphore. If successful, the function should + * return TM_SUCCESS. Otherwise, TM_ERROR should be returned. + */ +int tm_semaphore_create(int semaphore_id) +{ + /* Create an available semaphore with max count of 1 */ + return k_sem_init(&test_sem[semaphore_id], 1, 1); +} + +/* + * This function gets the specified semaphore. If successful, the function should + * return TM_SUCCESS. Otherwise, TM_ERROR should be returned. + */ +int tm_semaphore_get(int semaphore_id) +{ + return k_sem_take(&test_sem[semaphore_id], K_NO_WAIT); +} + +/* + * This function puts the specified semaphore. If successful, the function should + * return TM_SUCCESS. Otherwise, TM_ERROR should be returned. + */ +int tm_semaphore_put(int semaphore_id) +{ + k_sem_give(&test_sem[semaphore_id]); + return TM_SUCCESS; +} + +/* This function is defined by the benchmark. */ +extern void tm_interrupt_handler(const void *); + +void tm_cause_interrupt(void) +{ + irq_offload(tm_interrupt_handler, NULL); +} + +/* + * This function creates the specified memory pool that can support one or more + * allocations of 128 bytes. If successful, the function should + * return TM_SUCCESS. Otherwise, TM_ERROR should be returned. + */ +int tm_memory_pool_create(int pool_id) +{ + int status; + + status = k_mem_slab_init(&test_slab[pool_id], &test_slab_buffer[pool_id][0], 128, 8); + + return (status == 0) ? TM_SUCCESS : TM_ERROR; +} + +/* + * This function allocates a 128 byte block from the specified memory pool. + * If successful, the function should return TM_SUCCESS. Otherwise, TM_ERROR + * should be returned. + */ +int tm_memory_pool_allocate(int pool_id, unsigned char **memory_ptr) +{ + int status; + + status = k_mem_slab_alloc(&test_slab[pool_id], (void **)memory_ptr, K_NO_WAIT); + + return (status == 0) ? TM_SUCCESS : TM_ERROR; +} + +/* + * This function releases a previously allocated 128 byte block from the specified + * memory pool. If successful, the function should return TM_SUCCESS. Otherwise, TM_ERROR + * should be returned. + */ +int tm_memory_pool_deallocate(int pool_id, unsigned char *memory_ptr) +{ + k_mem_slab_free(&test_slab[pool_id], (void *)memory_ptr); + + return TM_SUCCESS; +} diff --git a/tests/benchmarks/thread_metric/src/tm_preemptive_scheduling_test.c b/tests/benchmarks/thread_metric/src/tm_preemptive_scheduling_test.c new file mode 100644 index 0000000000000..9a24384e695e5 --- /dev/null +++ b/tests/benchmarks/thread_metric/src/tm_preemptive_scheduling_test.c @@ -0,0 +1,281 @@ +/*************************************************************************** + * Copyright (c) 2024 Microsoft Corporation + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * SPDX-License-Identifier: MIT + **************************************************************************/ + +/**************************************************************************/ +/**************************************************************************/ +/** */ +/** Thread-Metric Component */ +/** */ +/** Preemptive Scheduling Test */ +/** */ +/**************************************************************************/ +/**************************************************************************/ + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* tm_preemptive_scheduling_test PORTABLE C */ +/* 6.1.7 */ +/* AUTHOR */ +/* */ +/* William E. Lamie, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This file defines the preemptive scheduling test. */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* 10-15-2021 William E. Lamie Initial Version 6.1.7 */ +/* */ +/**************************************************************************/ +#include "tm_api.h" + +/* Define the counters used in the demo application... */ + +unsigned long tm_preemptive_thread_0_counter; +unsigned long tm_preemptive_thread_1_counter; +unsigned long tm_preemptive_thread_2_counter; +unsigned long tm_preemptive_thread_3_counter; +unsigned long tm_preemptive_thread_4_counter; + +/* Define the test thread prototypes. */ + +void tm_preemptive_thread_0_entry(void *p1, void *p2, void *p3); +void tm_preemptive_thread_1_entry(void *p1, void *p2, void *p3); +void tm_preemptive_thread_2_entry(void *p1, void *p2, void *p3); +void tm_preemptive_thread_3_entry(void *p1, void *p2, void *p3); +void tm_preemptive_thread_4_entry(void *p1, void *p2, void *p3); + +/* Define the reporting function prototype. */ + +void tm_preemptive_thread_report(void); + +/* Define the initialization prototype. */ + +void tm_preemptive_scheduling_initialize(void); + +/* Define main entry point. */ + +int main(void) +{ + + /* Initialize the test. */ + tm_initialize(tm_preemptive_scheduling_initialize); + + return 0; +} + +/* Define the preemptive scheduling test initialization. */ + +void tm_preemptive_scheduling_initialize(void) +{ + + /* Create thread 0 at priority 10. */ + tm_thread_create(0, 10, tm_preemptive_thread_0_entry); + + /* Create thread 1 at priority 9. */ + tm_thread_create(1, 9, tm_preemptive_thread_1_entry); + + /* Create thread 2 at priority 8. */ + tm_thread_create(2, 8, tm_preemptive_thread_2_entry); + + /* Create thread 3 at priority 7. */ + tm_thread_create(3, 7, tm_preemptive_thread_3_entry); + + /* Create thread 4 at priority 6. */ + tm_thread_create(4, 6, tm_preemptive_thread_4_entry); + + /* Resume just thread 0. */ + tm_thread_resume(0); + + tm_preemptive_thread_report(); +} + +/* Define the first preemptive thread. */ +void tm_preemptive_thread_0_entry(void *p1, void *p2, void *p3) +{ + (void)p1; + (void)p2; + (void)p3; + + while (1) { + /* Resume thread 1. */ + tm_thread_resume(1); + + /* + * We won't get back here until threads 1, 2, 3, and 4 all execute and + * self-suspend. + */ + + /* Increment this thread's counter. */ + tm_preemptive_thread_0_counter++; + } +} + +/* Define the second preemptive thread. */ +void tm_preemptive_thread_1_entry(void *p1, void *p2, void *p3) +{ + (void)p1; + (void)p2; + (void)p3; + + while (1) { + + /* Resume thread 2. */ + tm_thread_resume(2); + + /* + * We won't get back here until threads 2, 3, and 4 all execute and + * self-suspend. + */ + + /* Increment this thread's counter. */ + tm_preemptive_thread_1_counter++; + + /* Suspend self! */ + tm_thread_suspend(1); + } +} + +/* Define the third preemptive thread. */ +void tm_preemptive_thread_2_entry(void *p1, void *p2, void *p3) +{ + (void)p1; + (void)p2; + (void)p3; + + while (1) { + + /* Resume thread 3. */ + tm_thread_resume(3); + + /* + * We won't get back here until threads 3 and 4 execute and + * self-suspend. + */ + + /* Increment this thread's counter. */ + tm_preemptive_thread_2_counter++; + + /* Suspend self! */ + tm_thread_suspend(2); + } +} + +/* Define the fourth preemptive thread. */ +void tm_preemptive_thread_3_entry(void *p1, void *p2, void *p3) +{ + (void)p1; + (void)p2; + (void)p3; + + while (1) { + + /* Resume thread 4. */ + tm_thread_resume(4); + + /* + * We won't get back here until thread 4 executes and + * self-suspends. + */ + + /* Increment this thread's counter. */ + tm_preemptive_thread_3_counter++; + + /* Suspend self! */ + tm_thread_suspend(3); + } +} + +/* Define the fifth preemptive thread. */ +void tm_preemptive_thread_4_entry(void *p1, void *p2, void *p3) +{ + (void)p1; + (void)p2; + (void)p3; + + while (1) { + + /* Increment this thread's counter. */ + tm_preemptive_thread_4_counter++; + + /* Self suspend thread 4. */ + tm_thread_suspend(4); + } +} + +/* Define the preemptive test reporting function. */ +void tm_preemptive_thread_report(void) +{ + + unsigned long total; + unsigned long relative_time; + unsigned long last_total; + unsigned long average; + + /* Initialize the last total. */ + last_total = 0; + + /* Initialize the relative time. */ + relative_time = 0; + + while (1) { + + /* Sleep to allow the test to run. */ + tm_thread_sleep(TM_TEST_DURATION); + + /* Increment the relative time. */ + relative_time = relative_time + TM_TEST_DURATION; + + /* Print results to the stdio window. */ + printf("**** Thread-Metric Preemptive Scheduling Test **** Relative Time: %lu\n", + relative_time); + + /* Calculate the total of all the counters. */ + total = tm_preemptive_thread_0_counter + tm_preemptive_thread_1_counter + + tm_preemptive_thread_2_counter + tm_preemptive_thread_3_counter + + tm_preemptive_thread_4_counter; + + /* Calculate the average of all the counters. */ + average = total / 5; + + /* See if there are any errors. */ + if ((tm_preemptive_thread_0_counter < (average - 1)) || + (tm_preemptive_thread_0_counter > (average + 1)) || + (tm_preemptive_thread_1_counter < (average - 1)) || + (tm_preemptive_thread_1_counter > (average + 1)) || + (tm_preemptive_thread_2_counter < (average - 1)) || + (tm_preemptive_thread_2_counter > (average + 1)) || + (tm_preemptive_thread_3_counter < (average - 1)) || + (tm_preemptive_thread_3_counter > (average + 1)) || + (tm_preemptive_thread_4_counter < (average - 1)) || + (tm_preemptive_thread_4_counter > (average + 1))) { + + printf("ERROR: Invalid counter value(s). Preemptive counters should not be " + "more that 1 different than the average!\n"); + printf(" Average: %lu, 0: %lu, 1: %lu, 2: %lu, 3: %lu, 4: %lu\n", + average, tm_preemptive_thread_0_counter, + tm_preemptive_thread_1_counter, + tm_preemptive_thread_2_counter, + tm_preemptive_thread_3_counter, + tm_preemptive_thread_4_counter); + } + + /* Show the time period total. */ + printf("Time Period Total: %lu\n\n", total - last_total); + + /* Save the last total. */ + last_total = total; + } +} diff --git a/tests/benchmarks/thread_metric/src/tm_synchronization_processing_test.c b/tests/benchmarks/thread_metric/src/tm_synchronization_processing_test.c new file mode 100644 index 0000000000000..a8bad536a54cb --- /dev/null +++ b/tests/benchmarks/thread_metric/src/tm_synchronization_processing_test.c @@ -0,0 +1,152 @@ +/*************************************************************************** + * Copyright (c) 2024 Microsoft Corporation + * + * This program and the accompanying materials are made available under the + * terms of the MIT License which is available at + * https://opensource.org/licenses/MIT. + * + * SPDX-License-Identifier: MIT + **************************************************************************/ + +/**************************************************************************/ +/**************************************************************************/ +/** */ +/** Thread-Metric Component */ +/** */ +/** Synchronization Processing Test */ +/** */ +/**************************************************************************/ +/**************************************************************************/ + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* tm_synchronization_processing_test PORTABLE C */ +/* 6.1.7 */ +/* AUTHOR */ +/* */ +/* William E. Lamie, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This file defines the Semaphore get/put processing test. */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* 10-15-2021 William E. Lamie Initial Version 6.1.7 */ +/* */ +/**************************************************************************/ +#include "tm_api.h" + +/* Define the counters used in the demo application... */ + +unsigned long tm_synchronization_processing_counter; + +/* Define the test thread prototypes. */ + +void tm_synchronization_processing_thread_0_entry(void *p1, void *p2, void *p3); + +/* Define the reporting function prototype. */ + +void tm_synchronization_processing_thread_report(void); + +/* Define the initialization prototype. */ + +void tm_synchronization_processing_initialize(void); + +/* Define main entry point. */ + +int main(void) +{ + + /* Initialize the test. */ + tm_initialize(tm_synchronization_processing_initialize); + + return 0; +} + +/* Define the synchronization processing test initialization. */ + +void tm_synchronization_processing_initialize(void) +{ + + /* Create thread 0 at priority 10. */ + tm_thread_create(0, 10, tm_synchronization_processing_thread_0_entry); + + /* Resume thread 0. */ + tm_thread_resume(0); + + /* Create a semaphore for the test. */ + tm_semaphore_create(0); + + tm_synchronization_processing_thread_report(); +} + +/* Define the synchronization processing thread. */ +void tm_synchronization_processing_thread_0_entry(void *p1, void *p2, void *p3) +{ + + int status; + + while (1) { + + /* Get the semaphore. */ + tm_semaphore_get(0); + + /* Release the semaphore. */ + status = tm_semaphore_put(0); + + /* Check for semaphore put error. */ + if (status != TM_SUCCESS) { + break; + } + + /* Increment the number of semaphore get/puts. */ + tm_synchronization_processing_counter++; + } +} + +/* Define the synchronization test reporting function. */ +void tm_synchronization_processing_thread_report(void) +{ + + unsigned long last_counter; + unsigned long relative_time; + + /* Initialize the last counter. */ + last_counter = 0; + + /* Initialize the relative time. */ + relative_time = 0; + + while (1) { + + /* Sleep to allow the test to run. */ + tm_thread_sleep(TM_TEST_DURATION); + + /* Increment the relative time. */ + relative_time = relative_time + TM_TEST_DURATION; + + /* Print results to the stdio window. */ + printf("**** Thread-Metric Synchronization Processing Test **** Relative Time: " + "%lu\n", + relative_time); + + /* See if there are any errors. */ + if (tm_synchronization_processing_counter == last_counter) { + + printf("ERROR: Invalid counter value(s). Error getting/putting " + "semaphore!\n"); + } + + /* Show the time period total. */ + printf("Time Period Total: %lu\n\n", + tm_synchronization_processing_counter - last_counter); + + /* Save the last counter. */ + last_counter = tm_synchronization_processing_counter; + } +} diff --git a/tests/benchmarks/thread_metric/testcase.yaml b/tests/benchmarks/thread_metric/testcase.yaml new file mode 100644 index 0000000000000..7cefcb9d98b26 --- /dev/null +++ b/tests/benchmarks/thread_metric/testcase.yaml @@ -0,0 +1,52 @@ +common: + tags: + - kernel + - benchmark + # Native platforms excluded as timer interrupts may not be detected + # qemu_nios2 excluded as it is slow + platform_exclude: + - native_posix + - native_sim + - qemu_nios2 + integration_platforms: + - qemu_x86 + - qemu_cortex_a53 + timeout: 300 + harness: console + harness_config: + type: one_line + regex: + - "(.*) Relative Time: (.*)" + +tests: + benchmark.thread_metric.basic: + extra_configs: + - CONFIG_TM_BASIC=y + + benchmark.thread_metric.cooperative: + extra_configs: + - CONFIG_TM_COOPERATIVE=y + + benchmark.thread_metric.interrupt: + extra_configs: + - CONFIG_TM_INTERRUPT=y + + benchmark.thread_metric.interrupt_preemption: + extra_configs: + - CONFIG_TM_INTERRUPT_PREEMPTION=y + + benchmark.thread_metric.memory_allocation: + extra_configs: + - CONFIG_TM_MEMORY_ALLOCATION=y + + benchmark.thread_metric.message: + extra_configs: + - CONFIG_TM_MESSAGE=y + + benchmark.thread_metric.preemptive: + extra_configs: + - CONFIG_TM_PREEMPTIVE=y + + benchmark.thread_metric.synchronization: + extra_configs: + - CONFIG_TM_SYNCHRONIZATION=y diff --git a/tests/benchmarks/thread_metric/thread_metric_readme.txt b/tests/benchmarks/thread_metric/thread_metric_readme.txt new file mode 100644 index 0000000000000..c2216ddb9b7c3 --- /dev/null +++ b/tests/benchmarks/thread_metric/thread_metric_readme.txt @@ -0,0 +1,248 @@ + Thread-Metric RTOS Test Suite + + +1. Thread-Metric Test Suite + +The Thread-Metric test suite consists of 8 distinct RTOS +tests that are designed to highlight commonly used aspects +of an RTOS. The test measures the total number of RTOS events +that can be processed during a specific timer interval. A 30 +second time interval is recommended. + +1.1. Basic Processing Test + +This is the baseline test consisting of a single thread. This +should execute the same on every operating system. Test values +from testing with different RTOS products should be scaled +relative to the difference between the values of this test. + +1.2. Cooperative Scheduling Test + +This test consists of 5 threads created at the same priority that +voluntarily release control to each other in a round-robin fashion. +Each thread will increment its run counter and then relinquish to +the next thread. At the end of the test the counters will be verified +to make sure they are valid (should all be within 1 of the same +value). If valid, the numbers will be summed and presented as the +result of the cooperative scheduling test. + +1.3. Preemptive Scheduling Test + +This test consists of 5 threads that each have a unique priority. +In this test, all threads except the lowest priority thread are +left in a suspended state. The lowest priority thread will resume +the next highest priority thread. That thread will resume the +next highest priority thread and so on until the highest priority +thread executes. Each thread will increment its run count and then +call thread suspend. Eventually the processing will return to the +lowest priority thread, which is still in the middle of the thread +resume call. Once processing returns to the lowest priority thread, +it will increment its run counter and once again resume the next +highest priority thread - starting the whole process over once again. + +1.4. Interrupt Processing Test + +This test consists of a single thread. The thread will cause an +interrupt (typically implemented as a trap), which will result in +a call to the interrupt handler. The interrupt handler will +increment a counter and then post to a semaphore. After the +interrupt handler completes, processing returns to the test +thread that initiated the interrupt. The thread then retrieves +the semaphore set by the interrupt handler, increments a counter +and then generates another interrupt. + +1.5. Interrupt Preemption Processing Test + +This test is similar to the previous interrupt test. The big +difference is the interrupt handler in this test resumes a +higher priority thread, which causes thread preemption. + +1.6. Message Processing Test + +This test consists of a thread sending a 16 byte message to a +queue and retrieving the same 16 byte message from the queue. +After the send/receive sequence is complete, the thread will +increment its run counter. + +1.7. Synchronization Processing Test + +This test consists of a thread getting a semaphore and then +immediately releasing it. After the get/put cycle completes, +the thread will increment its run counter. + +1.8. RTOS Memory allocation + +This test consists of a thread allocating a 128-byte block and +releasing the same block. After the block is released, the thread +will increment its run counter. + +2. Zephyr Modifications + +A few minor modifications have been made to the Thread-Metric source +code to resolve some minor issues found during porting. + +2.1. tm_main() -> main() + +Zephyr's version of this benchmark has modified the original tm_main() +to become main(). + +2.2. Thread entry points + +Thread entry points used by Zephyr have a different function signature +than that used by the original Thread-Metric code. These functions +have been updated to match Zephyr's. + +2.3. Reporting thread + +Zephyr's version does not spawn a reporting thread. Instead it calls +the reporting function directly. This helps ensure that the test +operates correctly on QEMU platorms. + +2.4. Directory structure + +Each test has been converted to its own project. This has necessitated +some minor changes to the directory structure as compared to the +original version of this benchmark. + +The source code to the Thread-Metric test suite is organized into +the following files: + + File Meaning + +tm_basic_processing_test.c Basic test for determining board + processing capabilities +tm_cooperative_scheduling_test.c Cooperative scheduling test +tm_preemptive_scheduling_test.c Preemptive scheduling test +tm_interrupt_processing_test.c No-preemption interrupt processing + test +tm_interrupt_preemption_processing_test.c Interrupt preemption processing + test +tm_message_processing_test.c Message exchange processing test +tm_synchronization_processing_test.c Semaphore get/put processing test +tm_memory_allocation_test.c Basic memory allocation test +tm_porting_layer_zephyr.c Specific porting layer source + code for Zephyr + +3 Porting + +3.1 Porting Layer + +As for the porting layer defined in tm_porting_layer_template.c, this file contain +shell services of the generic RTOS services used by the actual tests. The +shell services provide the mapping between the tests and the underlying RTOS. +The following generic API's are required to map any RTOS to the performance +measurement tests: + + + void tm_initialize(void (*test_initialization_function)(void)); + + This function is typically called by the application from its + main() function. It is responsible for providing all the RTOS + initialization, calling the test initialization function as + specified, and then starting the RTOS. + + int tm_thread_create(int thread_id, int priority, void (*entry_function)(void)); + + This function creates a thread of the specified priority where 1 is + the highest and 16 is the lowest. If successful, TM_SUCCESS + returned. If an error occurs, TM_ERROR is returned. The created thread + is not started. + + int tm_thread_resume(int thread_id); + + This function resumes the previously created thread specified by + thread_id. If successful, a TM_SUCCESS is returned. + + int tm_thread_suspend(int thread_id); + + This function suspend the previously created thread specified by + thread_id. If successful, a TM_SUCCESS is returned. + + void tm_thread_relinquish(void); + + This function lets all other threads of same priority execute + before the calling thread runs again. + + void tm_thread_sleep(int seconds); + + This function suspends the calling thread for the specified + number of seconds. + + int tm_queue_create(int queue_id); + + This function creates a queue with a capacity to hold at least + one 16-byte message. If successful, a TM_SUCCESS is returned. + + int tm_queue_send(int queue_id, unsigned long *message_ptr); + + This function sends a message to the previously created queue. + If successful, a TM_SUCCESS is returned. + + int tm_queue_receive(int queue_id, unsigned long *message_ptr); + + This function receives a message from the previously created + queue. If successful, a TM_SUCCESS is returned. + + int tm_semaphore_create(int semaphore_id); + + This function creates a binary semaphore. If successful, a + TM_SUCCESS is returned. + + int tm_semaphore_get(int semaphore_id); + + This function gets the previously created binary semaphore. + If successful, a TM_SUCCESS is returned. + + int tm_semaphore_put(int semaphore_id); + + This function puts the previously created binary semaphore. + If successful, a TM_SUCCESS is returned. + + int tm_memory_pool_create(int pool_id); + + This function creates a memory pool able to satisfy at least one + 128-byte block of memory. If successful, a TM_SUCCESS is returned. + + int tm_memory_pool_allocate(int pool_id, unsigned char **memory_ptr); + + This function allocates a 128-byte block of memory from the + previously created memory pool. If successful, a TM_SUCCESS + is returned along with the pointer to the allocated memory + in the "memory_ptr" variable. + + int tm_memory_pool_deallocate(int pool_id, unsigned char *memory_ptr); + + This function releases the previously allocated 128-byte block + of memory. If successful, a TM_SUCCESS is returned. + + +2.2 Porting Requirements Checklist + +The following requirements are made in order to ensure fair benchmarks +are achieved on each RTOS performing the test: + + 1. Time period should be 30 seconds. This will ensure the printf + processing in the reporting thread is insignificant. + + * Zephyr : Requirement met. + + 2. The porting layer services are implemented inside of + tm_porting_layer_[RTOS].c and NOT as macros. + + * Zephyr : Requirements met. + + 3. The tm_thread_sleep service is implemented by a 10ms RTOS + periodic interrupt source. + + * Zephyr : Requirement met. System tick rate = 100 Hz. + + 4. Locking regions of the tests and/or the RTOS in cache is + not allowed. + + * Zephyr : Requirement met. + + 5. The Interrupt Processing and Interrupt Preemption Processing tests + require an instruction that generates an interrupt. Please refer + to tm_porting_layer.h for an example implementation. + + * Zephyr : Requirement met. See irq_offload(). From 9e7d182375205031884e95b5729117cd1b446fab Mon Sep 17 00:00:00 2001 From: Peter Mitsis Date: Thu, 31 Oct 2024 10:19:21 -0700 Subject: [PATCH 2771/4482] doc: Update licensing page Updates the licensing page to indicate that the thread_metric benchmark uses the MIT license. Signed-off-by: Peter Mitsis --- doc/LICENSING.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/LICENSING.rst b/doc/LICENSING.rst index 9f8f1d8c427b0..6585581e9f59f 100644 --- a/doc/LICENSING.rst +++ b/doc/LICENSING.rst @@ -33,3 +33,11 @@ licensing in this document. *boards/ene/kb1200_evb/support/openocd.cfg* *Licensing:* `GPLv2 License`_ + +.. _MIT License: + https://opensource.org/licenses/MIT + +*tests/benchmarks/thread_metric/{thread_metric_readme.txt,src/\*}* + *Origin:* ThreadX + + *Licensing:* `MIT License`_ From df3b76b55abd6415dff4d90c6bffb483ee3613c6 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Fri, 15 Nov 2024 20:34:28 +0100 Subject: [PATCH 2772/4482] drivers: stepper: gpio: introduce power down coils function power down coils when gpio stepper is disabled Signed-off-by: Jilay Pandya --- drivers/stepper/gpio_stepper_controller.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/stepper/gpio_stepper_controller.c b/drivers/stepper/gpio_stepper_controller.c index ad59b734db16f..32d3940fdba35 100644 --- a/drivers/stepper/gpio_stepper_controller.c +++ b/drivers/stepper/gpio_stepper_controller.c @@ -77,6 +77,21 @@ static void decrement_coil_charge(const struct device *dev) } } +static int power_down_coils(const struct device *dev) +{ + const struct gpio_stepper_config *config = dev->config; + + for (int i = 0; i < NUM_CONTROL_PINS; i++) { + const int err = gpio_pin_set_dt(&config->control_pins[i], 0u); + + if (err != 0) { + LOG_ERR("Failed to power down coil %d", i); + return err; + } + } + return 0; +} + static void update_coil_charge(const struct device *dev) { const struct gpio_stepper_config *config = dev->config; @@ -313,6 +328,11 @@ static int gpio_stepper_enable(const struct device *dev, bool enable) (void)k_work_reschedule(&data->stepper_dwork, K_NO_WAIT); } else { (void)k_work_cancel_delayable(&data->stepper_dwork); + const int err = power_down_coils(dev); + + if (err != 0) { + return -EIO; + } } } return 0; From 843625a29bbd2e992479dc958eb805a6a3755ac3 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Tue, 5 Nov 2024 21:05:54 +0100 Subject: [PATCH 2773/4482] drivers: stepper: change gpio-stepper dt-compatible This commit changes compatible of gpio-stepper in driver Signed-off-by: Jilay Pandya --- doc/hardware/peripherals/stepper.rst | 1 + drivers/stepper/Kconfig.gpio | 2 +- drivers/stepper/gpio_stepper_controller.c | 84 ++++++++----------- dts/bindings/stepper/adi/adi,tmc5041.yaml | 5 +- dts/bindings/stepper/stepper-controller.yaml | 2 - dts/bindings/stepper/zephyr,gpio-stepper.yaml | 38 ++++----- .../stepper/stepper_api/CMakeLists.txt | 8 +- .../stepper_api/boards/nucleo_g071rb.conf | 2 +- .../stepper_api/boards/nucleo_g071rb.overlay | 16 ++-- .../stepper_api/boards/qemu_x86_64.conf | 2 +- .../stepper_api/boards/qemu_x86_64.overlay | 17 ++-- tests/drivers/stepper/stepper_api/prj.conf | 2 +- .../drivers/stepper/stepper_api/testcase.yaml | 2 +- 13 files changed, 75 insertions(+), 106 deletions(-) diff --git a/doc/hardware/peripherals/stepper.rst b/doc/hardware/peripherals/stepper.rst index e689de3dac2f2..1790740cd5853 100644 --- a/doc/hardware/peripherals/stepper.rst +++ b/doc/hardware/peripherals/stepper.rst @@ -36,6 +36,7 @@ be used in a boards devicetree to configure a stepper driver to its initial stat See examples in: +- :dtcompatible:`zephyr,gpio-stepper` - :dtcompatible:`adi,tmc5041` Discord diff --git a/drivers/stepper/Kconfig.gpio b/drivers/stepper/Kconfig.gpio index 126ebf179fcd5..99e3505789598 100644 --- a/drivers/stepper/Kconfig.gpio +++ b/drivers/stepper/Kconfig.gpio @@ -6,7 +6,7 @@ menu "GPIO stepper driver" config GPIO_STEPPER bool "Activate driver for gpio stepper control" - depends on DT_HAS_ZEPHYR_GPIO_STEPPERS_ENABLED + depends on DT_HAS_ZEPHYR_GPIO_STEPPER_ENABLED default y help GPIO Stepper driver for stepper motor control with darlington arrays or dual H-bridge. diff --git a/drivers/stepper/gpio_stepper_controller.c b/drivers/stepper/gpio_stepper_controller.c index 32d3940fdba35..c3e635cb03643 100644 --- a/drivers/stepper/gpio_stepper_controller.c +++ b/drivers/stepper/gpio_stepper_controller.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#define DT_DRV_COMPAT zephyr_gpio_steppers +#define DT_DRV_COMPAT zephyr_gpio_stepper #include #include @@ -338,14 +338,13 @@ static int gpio_stepper_enable(const struct device *dev, bool enable) return 0; } -static int gpio_stepper_motor_controller_init(const struct device *dev) +static int gpio_stepper_init(const struct device *dev) { struct gpio_stepper_data *data = dev->data; const struct gpio_stepper_config *config = dev->config; data->dev = dev; - LOG_DBG("Initializing %s gpio_stepper_motor_controller with %d pin", dev->name, - NUM_CONTROL_PINS); + LOG_DBG("Initializing %s gpio_stepper with %d pin", dev->name, NUM_CONTROL_PINS); for (uint8_t n_pin = 0; n_pin < NUM_CONTROL_PINS; n_pin++) { (void)gpio_pin_configure_dt(&config->control_pins[n_pin], GPIO_OUTPUT_INACTIVE); } @@ -353,47 +352,36 @@ static int gpio_stepper_motor_controller_init(const struct device *dev) return 0; } -#define GPIO_STEPPER_DEVICE_DATA_DEFINE(child) \ - static struct gpio_stepper_data gpio_stepper_data_##child = { \ - .step_gap = MAX_MICRO_STEP_RES >> (DT_PROP(child, micro_step_res) - 1), \ - }; \ - BUILD_ASSERT(DT_PROP(child, micro_step_res) <= STEPPER_MICRO_STEP_2, \ - "gpio_stepper_controller driver supports up to 2 micro steps"); - -#define GPIO_STEPPER_DEVICE_CONFIG_DEFINE(child) \ - static const struct gpio_dt_spec gpio_stepper_motor_control_pins_##child[] = { \ - DT_FOREACH_PROP_ELEM_SEP(child, gpios, GPIO_DT_SPEC_GET_BY_IDX, (,)), \ - }; \ - BUILD_ASSERT( \ - ARRAY_SIZE(gpio_stepper_motor_control_pins_##child) == 4, \ - "gpio_stepper_controller driver currently supports only 4 wire configuration"); \ - static const struct gpio_stepper_config gpio_stepper_config_##child = { \ - .invert_direction = DT_PROP(child, invert_direction), \ - .control_pins = gpio_stepper_motor_control_pins_##child}; - -#define GPIO_STEPPER_API_DEFINE(child) \ - static const struct stepper_driver_api gpio_stepper_api_##child = { \ - .enable = gpio_stepper_enable, \ - .move = gpio_stepper_move, \ - .is_moving = gpio_stepper_is_moving, \ - .set_actual_position = gpio_stepper_set_actual_position, \ - .get_actual_position = gpio_stepper_get_actual_position, \ - .set_target_position = gpio_stepper_set_target_position, \ - .set_max_velocity = gpio_stepper_set_max_velocity, \ - .enable_constant_velocity_mode = gpio_stepper_enable_constant_velocity_mode, \ - .set_micro_step_res = gpio_stepper_set_micro_step_res, \ - .get_micro_step_res = gpio_stepper_get_micro_step_res, \ - .set_event_callback = gpio_stepper_set_event_callback, }; - -#define GPIO_STEPPER_DEVICE_DEFINE(child) \ - DEVICE_DT_DEFINE(child, gpio_stepper_motor_controller_init, NULL, \ - &gpio_stepper_data_##child, &gpio_stepper_config_##child, POST_KERNEL, \ - CONFIG_STEPPER_INIT_PRIORITY, &gpio_stepper_api_##child); - -#define GPIO_STEPPER_CONTROLLER_DEFINE(inst) \ - DT_INST_FOREACH_CHILD(inst, GPIO_STEPPER_DEVICE_CONFIG_DEFINE); \ - DT_INST_FOREACH_CHILD(inst, GPIO_STEPPER_DEVICE_DATA_DEFINE); \ - DT_INST_FOREACH_CHILD(inst, GPIO_STEPPER_API_DEFINE); \ - DT_INST_FOREACH_CHILD(inst, GPIO_STEPPER_DEVICE_DEFINE); - -DT_INST_FOREACH_STATUS_OKAY(GPIO_STEPPER_CONTROLLER_DEFINE) +static const struct stepper_driver_api gpio_stepper_api = { + .enable = gpio_stepper_enable, + .move = gpio_stepper_move, + .is_moving = gpio_stepper_is_moving, + .set_actual_position = gpio_stepper_set_actual_position, + .get_actual_position = gpio_stepper_get_actual_position, + .set_target_position = gpio_stepper_set_target_position, + .set_max_velocity = gpio_stepper_set_max_velocity, + .enable_constant_velocity_mode = gpio_stepper_enable_constant_velocity_mode, + .set_micro_step_res = gpio_stepper_set_micro_step_res, + .get_micro_step_res = gpio_stepper_get_micro_step_res, + .set_event_callback = gpio_stepper_set_event_callback, +}; + +#define GPIO_STEPPER_DEFINE(inst) \ + static const struct gpio_dt_spec gpio_stepper_motor_control_pins_##inst[] = { \ + DT_INST_FOREACH_PROP_ELEM_SEP(inst, gpios, GPIO_DT_SPEC_GET_BY_IDX, (,)), \ + }; \ + BUILD_ASSERT(ARRAY_SIZE(gpio_stepper_motor_control_pins_##inst) == 4, \ + "gpio_stepper_controller driver currently supports only 4 wire configuration"); \ + static const struct gpio_stepper_config gpio_stepper_config_##inst = { \ + .invert_direction = DT_INST_PROP(inst, invert_direction), \ + .control_pins = gpio_stepper_motor_control_pins_##inst}; \ + static struct gpio_stepper_data gpio_stepper_data_##inst = { \ + .step_gap = MAX_MICRO_STEP_RES >> (DT_INST_PROP(inst, micro_step_res) - 1), \ + }; \ + BUILD_ASSERT(DT_INST_PROP(inst, micro_step_res) <= STEPPER_MICRO_STEP_2, \ + "gpio_stepper_controller driver supports up to 2 micro steps"); \ + DEVICE_DT_INST_DEFINE(inst, gpio_stepper_init, NULL, &gpio_stepper_data_##inst, \ + &gpio_stepper_config_##inst, POST_KERNEL, \ + CONFIG_STEPPER_INIT_PRIORITY, &gpio_stepper_api); + +DT_INST_FOREACH_STATUS_OKAY(GPIO_STEPPER_DEFINE) diff --git a/dts/bindings/stepper/adi/adi,tmc5041.yaml b/dts/bindings/stepper/adi/adi,tmc5041.yaml index c944cb9bca633..ba856b7fa65b8 100644 --- a/dts/bindings/stepper/adi/adi,tmc5041.yaml +++ b/dts/bindings/stepper/adi/adi,tmc5041.yaml @@ -89,13 +89,10 @@ properties: child-binding: include: + - name: stepper-controller.yaml - name: base.yaml property-allowlist: - reg - - name: stepper-controller.yaml - property-allowlist: - - invert-direction - - micro-step-res - name: adi,trinamic-ramp-generator.yaml property-allowlist: - vstart diff --git a/dts/bindings/stepper/stepper-controller.yaml b/dts/bindings/stepper/stepper-controller.yaml index 48b4ec7225a6f..2607fc6f9915e 100644 --- a/dts/bindings/stepper/stepper-controller.yaml +++ b/dts/bindings/stepper/stepper-controller.yaml @@ -3,8 +3,6 @@ description: Stepper Controller -include: base.yaml - properties: invert-direction: type: boolean diff --git a/dts/bindings/stepper/zephyr,gpio-stepper.yaml b/dts/bindings/stepper/zephyr,gpio-stepper.yaml index 58c6e029b9f37..95477d213998b 100644 --- a/dts/bindings/stepper/zephyr,gpio-stepper.yaml +++ b/dts/bindings/stepper/zephyr,gpio-stepper.yaml @@ -3,33 +3,25 @@ # SPDX-License-Identifier: Apache-2.0 description: | - GPIO Stepper Controller cluster for darlington transistor arrays or dual H-bridge + GPIO Stepper Controller for darlington transistor arrays or dual H-bridge Example: /* Lead A is connected Lead C and Lead B is connected to Lead D*/ - stepper { - compatible = "zephyr,gpio-steppers"; - motor: motor { - gpios = <&gpioa 9 GPIO_ACTIVE_HIGH>, /* Lead A1/A */ - <&gpioc 7 GPIO_ACTIVE_HIGH>, /* Lead B1/B */ - <&gpiob 0 GPIO_ACTIVE_HIGH>, /* Lead A2/C */ - <&gpioa 7 GPIO_ACTIVE_HIGH>; /* Lead B2/D */ - }; + stepper: stepper { + compatible = "zephyr,gpio-stepper"; + gpios = <&gpioa 9 GPIO_ACTIVE_HIGH>, /* Lead A1/A */ + <&gpioc 7 GPIO_ACTIVE_HIGH>, /* Lead B1/B */ + <&gpiob 0 GPIO_ACTIVE_HIGH>, /* Lead A2/C */ + <&gpioa 7 GPIO_ACTIVE_HIGH>; /* Lead B2/D */ }; -compatible: "zephyr,gpio-steppers" +compatible: "zephyr,gpio-stepper" -child-binding: - description: GPIO Controller for stepper motor - include: - - name: stepper-controller.yaml - property-allowlist: - - micro-step-res - - invert-direction +include: stepper-controller.yaml - properties: - gpios: - type: phandle-array - required: true - description: | - The gpio pin array on which the stepper inputs are to be connected +properties: + gpios: + type: phandle-array + required: true + description: | + The gpio pin array on which the stepper inputs are to be connected diff --git a/tests/drivers/stepper/stepper_api/CMakeLists.txt b/tests/drivers/stepper/stepper_api/CMakeLists.txt index 16260e70c04cb..a1ebdab059bd3 100644 --- a/tests/drivers/stepper/stepper_api/CMakeLists.txt +++ b/tests/drivers/stepper/stepper_api/CMakeLists.txt @@ -1,10 +1,8 @@ -# Copyright (c) 2024 Jilay Sandeep Pandya +# SPDX-FileCopyrightText: Copyright (c) 2024 Jilay Sandeep Pandya # SPDX-License-Identifier: Apache-2.0 cmake_minimum_required(VERSION 3.20.0) - find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(stepper_api) -target_sources(app PRIVATE - src/main.c -) + +target_sources(app PRIVATE src/main.c) diff --git a/tests/drivers/stepper/stepper_api/boards/nucleo_g071rb.conf b/tests/drivers/stepper/stepper_api/boards/nucleo_g071rb.conf index 0b747611a176f..ed533e324c74a 100644 --- a/tests/drivers/stepper/stepper_api/boards/nucleo_g071rb.conf +++ b/tests/drivers/stepper/stepper_api/boards/nucleo_g071rb.conf @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Jilay Sandeep Pandya +# SPDX-FileCopyrightText: Copyright (c) 2024 Jilay Sandeep Pandya # SPDX-License-Identifier: Apache-2.0 CONFIG_GPIO=y diff --git a/tests/drivers/stepper/stepper_api/boards/nucleo_g071rb.overlay b/tests/drivers/stepper/stepper_api/boards/nucleo_g071rb.overlay index 80b58d3fd5e1b..afd285e9262d8 100644 --- a/tests/drivers/stepper/stepper_api/boards/nucleo_g071rb.overlay +++ b/tests/drivers/stepper/stepper_api/boards/nucleo_g071rb.overlay @@ -4,15 +4,13 @@ */ / { - uln2003_motor: uln2003_1 { - compatible = "zephyr,gpio-steppers"; + motor_1: motor_1 { + compatible = "zephyr,gpio-stepper"; status = "okay"; - motor_1: motor_1 { - micro-step-res = <1>; - gpios = <&gpioa 9 GPIO_ACTIVE_HIGH>, - <&gpioc 7 GPIO_ACTIVE_HIGH>, - <&gpiob 0 GPIO_ACTIVE_HIGH>, - <&gpioa 7 GPIO_ACTIVE_HIGH>; - }; + micro-step-res = <1>; + gpios = <&gpioa 9 GPIO_ACTIVE_HIGH>, + <&gpioc 7 GPIO_ACTIVE_HIGH>, + <&gpiob 0 GPIO_ACTIVE_HIGH>, + <&gpioa 7 GPIO_ACTIVE_HIGH>; }; }; diff --git a/tests/drivers/stepper/stepper_api/boards/qemu_x86_64.conf b/tests/drivers/stepper/stepper_api/boards/qemu_x86_64.conf index 0b747611a176f..ed533e324c74a 100644 --- a/tests/drivers/stepper/stepper_api/boards/qemu_x86_64.conf +++ b/tests/drivers/stepper/stepper_api/boards/qemu_x86_64.conf @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Jilay Sandeep Pandya +# SPDX-FileCopyrightText: Copyright (c) 2024 Jilay Sandeep Pandya # SPDX-License-Identifier: Apache-2.0 CONFIG_GPIO=y diff --git a/tests/drivers/stepper/stepper_api/boards/qemu_x86_64.overlay b/tests/drivers/stepper/stepper_api/boards/qemu_x86_64.overlay index 72de2d2ecc7ac..c38d1128bed83 100644 --- a/tests/drivers/stepper/stepper_api/boards/qemu_x86_64.overlay +++ b/tests/drivers/stepper/stepper_api/boards/qemu_x86_64.overlay @@ -19,16 +19,13 @@ }; / { - test_uln2003_motor_cluster: uln2003_motor_cluster { - compatible = "zephyr,gpio-steppers"; + motor_1: motor_1 { + compatible = "zephyr,gpio-stepper"; status = "okay"; - - motor_1: motor_1 { - micro-step-res = <1>; - gpios = <&test_gpio 0 0>, - <&test_gpio 0 0>, - <&test_gpio 0 0>, - <&test_gpio 0 0>; - }; + micro-step-res = <1>; + gpios = <&test_gpio 0 0>, + <&test_gpio 0 0>, + <&test_gpio 0 0>, + <&test_gpio 0 0>; }; }; diff --git a/tests/drivers/stepper/stepper_api/prj.conf b/tests/drivers/stepper/stepper_api/prj.conf index fc4240bf03703..cf8974229b3fc 100644 --- a/tests/drivers/stepper/stepper_api/prj.conf +++ b/tests/drivers/stepper/stepper_api/prj.conf @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Jilay Sandeep Pandya +# SPDX-FileCopyrightText: Copyright (c) 2024 Jilay Sandeep Pandya # SPDX-License-Identifier: Apache-2.0 CONFIG_ZTEST=y diff --git a/tests/drivers/stepper/stepper_api/testcase.yaml b/tests/drivers/stepper/stepper_api/testcase.yaml index 36fc4d9b3fb27..d38ed845b0a86 100644 --- a/tests/drivers/stepper/stepper_api/testcase.yaml +++ b/tests/drivers/stepper/stepper_api/testcase.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Jilay Sandeep Pandya +# SPDX-FileCopyrightText: Copyright (c) 2024 Jilay Sandeep Pandya # SPDX-License-Identifier: Apache-2.0 tests: From 195c2c1360f4dbd1c2e5e0ccf2237396de78ca50 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Tue, 5 Nov 2024 21:09:16 +0100 Subject: [PATCH 2774/4482] drivers: stepper: fix stepper_set_event_callback c prototype and definition This commit fixes incorrect c prototype and defintion of stepper_set_callback to stepper_set_event_callback Signed-off-by: Jilay Pandya --- doc/hardware/peripherals/stepper.rst | 1 + drivers/stepper/stepper_shell.c | 6 +++--- include/zephyr/drivers/stepper.h | 11 ++++++----- tests/drivers/stepper/stepper_api/src/main.c | 6 +++--- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/doc/hardware/peripherals/stepper.rst b/doc/hardware/peripherals/stepper.rst index 1790740cd5853..be95b8a1c5322 100644 --- a/doc/hardware/peripherals/stepper.rst +++ b/doc/hardware/peripherals/stepper.rst @@ -24,6 +24,7 @@ Control Stepper - Run continuously with a **constant velocity** in a specific direction until a stop is detected using :c:func:`stepper_enable_constant_velocity_mode`. - Check if the stepper is **moving** using :c:func:`stepper_is_moving`. +- Register an **event callback** using :c:func:`stepper_set_event_callback`. Device Tree =========== diff --git a/drivers/stepper/stepper_shell.c b/drivers/stepper/stepper_shell.c index 3f9d0523294ee..05ad237038286 100644 --- a/drivers/stepper/stepper_shell.c +++ b/drivers/stepper/stepper_shell.c @@ -203,7 +203,7 @@ static int cmd_stepper_move(const struct shell *sh, size_t argc, char **argv) return err; } - err = stepper_set_callback(dev, print_callback, (void *)sh); + err = stepper_set_event_callback(dev, print_callback, (void *)sh); if (err != 0) { shell_error(sh, "Failed to set callback: %d", err); } @@ -350,7 +350,7 @@ static int cmd_stepper_set_target_position(const struct shell *sh, size_t argc, return err; } - err = stepper_set_callback(dev, print_callback, NULL); + err = stepper_set_event_callback(dev, print_callback, (void *)sh); if (err != 0) { shell_error(sh, "Failed to set callback: %d", err); } @@ -393,7 +393,7 @@ static int cmd_stepper_enable_constant_velocity_mode(const struct shell *sh, siz return err; } - err = stepper_set_callback(dev, print_callback, NULL); + err = stepper_set_event_callback(dev, print_callback, (void *)sh); if (err != 0) { shell_error(sh, "Failed to set callback: %d", err); } diff --git a/include/zephyr/drivers/stepper.h b/include/zephyr/drivers/stepper.h index 39171513aa8bd..df78484006797 100644 --- a/include/zephyr/drivers/stepper.h +++ b/include/zephyr/drivers/stepper.h @@ -180,7 +180,7 @@ typedef void (*stepper_event_callback_t)(const struct device *dev, const enum st /** * @brief Set the callback function to be called when a stepper event occurs * - * @see stepper_set_callback() for details. + * @see stepper_set_event_callback() for details. */ typedef int (*stepper_set_event_callback_t)(const struct device *dev, stepper_event_callback_t callback, void *user_data); @@ -449,11 +449,12 @@ static inline int z_impl_stepper_enable_constant_velocity_mode( * @retval -ENOSYS If not implemented by device driver * @retval 0 Success */ -__syscall int stepper_set_callback(const struct device *dev, stepper_event_callback_t callback, - void *user_data); +__syscall int stepper_set_event_callback(const struct device *dev, + stepper_event_callback_t callback, void *user_data); -static inline int z_impl_stepper_set_callback(const struct device *dev, - stepper_event_callback_t callback, void *user_data) +static inline int z_impl_stepper_set_event_callback(const struct device *dev, + stepper_event_callback_t callback, + void *user_data) { const struct stepper_driver_api *api = (const struct stepper_driver_api *)dev->api; diff --git a/tests/drivers/stepper/stepper_api/src/main.c b/tests/drivers/stepper/stepper_api/src/main.c index 8aaf468c0e137..773578801c585 100644 --- a/tests/drivers/stepper/stepper_api/src/main.c +++ b/tests/drivers/stepper/stepper_api/src/main.c @@ -1,5 +1,5 @@ /* - * Copyright 2024 Jilay Sandeep Pandya + * SPDX-FileCopyrightText: Copyright (c) 2024 Jilay Sandeep Pandya * * SPDX-License-Identifier: Apache-2.0 */ @@ -17,7 +17,7 @@ struct k_poll_event stepper_event; void *user_data_received; static void stepper_print_event_callback(const struct device *dev, enum stepper_event event, - void *user_data) + void *user_data) { user_data_received = user_data; switch (event) { @@ -85,7 +85,7 @@ ZTEST_F(stepper, test_target_position) (void)stepper_set_max_velocity(fixture->dev, 100u); /* Pass the function name as user data */ - (void)stepper_set_callback(fixture->dev, fixture->callback, &fixture); + (void)stepper_set_event_callback(fixture->dev, fixture->callback, &fixture); (void)stepper_set_target_position(fixture->dev, pos); From 1e142b000116639432a072ca80ebec13c1866977 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Tue, 5 Nov 2024 21:11:02 +0100 Subject: [PATCH 2775/4482] drivers: stepper: shell: fix null pointer check This commit introduces null pointer check in print_callback Signed-off-by: Jilay Pandya --- drivers/stepper/stepper_shell.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/stepper/stepper_shell.c b/drivers/stepper/stepper_shell.c index 05ad237038286..7483d7af4ab23 100644 --- a/drivers/stepper/stepper_shell.c +++ b/drivers/stepper/stepper_shell.c @@ -44,6 +44,9 @@ static void print_callback(const struct device *dev, const enum stepper_event ev void *user_data) { const struct shell *sh = user_data; + if (!sh) { + return; + } switch (event) { case STEPPER_EVENT_STEPS_COMPLETED: From f04f924d52259eba61266b6911b2ce0e0e46fcf6 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Wed, 30 Oct 2024 20:06:07 +0100 Subject: [PATCH 2776/4482] MAINTAINERS: Add collaborators in stepper drivers - bjarki-andreasen - dipakgmx - fabiobaltieri - faxe1008 This commit adds dipakgmx as collaborator in stepper drivers Signed-off-by: Jilay Pandya --- MAINTAINERS.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 58f56d28d72d7..27724795cde48 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -2077,6 +2077,11 @@ Release Notes: status: maintained maintainers: - jilaypandya + collaborators: + - bjarki-andreasen + - dipakgmx + - fabiobaltieri + - faxe1008 files: - drivers/stepper/ - include/zephyr/drivers/stepper.h From 428db04fd52190c14893cff2350435c5042972c8 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Sat, 16 Nov 2024 21:55:29 +0100 Subject: [PATCH 2777/4482] doc: migration-guide: 4.1: rename gpio-stepper compatible add entry in migration guide 4.1 about renaming of compatible from zephyr,gpio-steppers to zephyr,gpio-stepper Signed-off-by: Jilay Pandya --- doc/releases/migration-guide-4.1.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/releases/migration-guide-4.1.rst b/doc/releases/migration-guide-4.1.rst index d35ab96073c73..8712b6cc9a987 100644 --- a/doc/releases/migration-guide-4.1.rst +++ b/doc/releases/migration-guide-4.1.rst @@ -66,6 +66,11 @@ Sensors Serial ====== +Stepper +======= + + * Renamed the ``compatible`` from ``zephyr,gpio-steppers`` to :dtcompatible:`zephyr,gpio-stepper`. + Regulator ========= From 2efc8598e39f6b4f78605221223c051e316e481f Mon Sep 17 00:00:00 2001 From: Jan Faeh Date: Wed, 28 Aug 2024 10:21:04 +0200 Subject: [PATCH 2778/4482] drivers: sensor: SCD4x Add driver This adds support for Sensirion's SCD4x co2 sensor. Signed-off-by: Jan Faeh --- drivers/sensor/sensirion/CMakeLists.txt | 1 + drivers/sensor/sensirion/Kconfig | 1 + drivers/sensor/sensirion/scd4x/CMakeLists.txt | 5 + drivers/sensor/sensirion/scd4x/Kconfig | 13 + drivers/sensor/sensirion/scd4x/scd4x.c | 908 ++++++++++++++++++ drivers/sensor/sensirion/scd4x/scd4x.h | 88 ++ dts/bindings/sensor/sensirion,scd40.yaml | 8 + dts/bindings/sensor/sensirion,scd41.yaml | 21 + include/zephyr/drivers/sensor/scd4x.h | 92 ++ tests/drivers/build_all/sensor/i2c.dtsi | 6 + 10 files changed, 1143 insertions(+) create mode 100644 drivers/sensor/sensirion/scd4x/CMakeLists.txt create mode 100644 drivers/sensor/sensirion/scd4x/Kconfig create mode 100644 drivers/sensor/sensirion/scd4x/scd4x.c create mode 100644 drivers/sensor/sensirion/scd4x/scd4x.h create mode 100644 dts/bindings/sensor/sensirion,scd40.yaml create mode 100644 dts/bindings/sensor/sensirion,scd41.yaml create mode 100644 include/zephyr/drivers/sensor/scd4x.h diff --git a/drivers/sensor/sensirion/CMakeLists.txt b/drivers/sensor/sensirion/CMakeLists.txt index 2ef59c627dc0a..08d20a61ed87a 100644 --- a/drivers/sensor/sensirion/CMakeLists.txt +++ b/drivers/sensor/sensirion/CMakeLists.txt @@ -2,6 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # zephyr-keep-sorted-start +add_subdirectory_ifdef(CONFIG_SCD4X scd4x) add_subdirectory_ifdef(CONFIG_SGP40 sgp40) add_subdirectory_ifdef(CONFIG_SHT3XD sht3xd) add_subdirectory_ifdef(CONFIG_SHT4X sht4x) diff --git a/drivers/sensor/sensirion/Kconfig b/drivers/sensor/sensirion/Kconfig index 6d1f48dbe959e..2b70b2e731d8a 100644 --- a/drivers/sensor/sensirion/Kconfig +++ b/drivers/sensor/sensirion/Kconfig @@ -2,6 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # zephyr-keep-sorted-start +source "drivers/sensor/sensirion/scd4x/Kconfig" source "drivers/sensor/sensirion/sgp40/Kconfig" source "drivers/sensor/sensirion/sht3xd/Kconfig" source "drivers/sensor/sensirion/sht4x/Kconfig" diff --git a/drivers/sensor/sensirion/scd4x/CMakeLists.txt b/drivers/sensor/sensirion/scd4x/CMakeLists.txt new file mode 100644 index 0000000000000..69f348fc202fa --- /dev/null +++ b/drivers/sensor/sensirion/scd4x/CMakeLists.txt @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library() + +zephyr_library_sources(scd4x.c) diff --git a/drivers/sensor/sensirion/scd4x/Kconfig b/drivers/sensor/sensirion/scd4x/Kconfig new file mode 100644 index 0000000000000..09012fe6f5fc7 --- /dev/null +++ b/drivers/sensor/sensirion/scd4x/Kconfig @@ -0,0 +1,13 @@ +# Drivers configuration options for Sensirion SCD4x + +# Copyright (c) 2024 Jan Fäh +# SPDX-License-Identifier: Apache-2.0 + +config SCD4X + bool "SCD4x Carbon Dioxide Sensor" + default y + depends on DT_HAS_SENSIRION_SCD41_ENABLED || DT_HAS_SENSIRION_SCD40_ENABLED + select I2C + select CRC + help + Enable driver for the Sensirion SCD4x carbon dioxide sensors. diff --git a/drivers/sensor/sensirion/scd4x/scd4x.c b/drivers/sensor/sensirion/scd4x/scd4x.c new file mode 100644 index 0000000000000..0d1281af12a8e --- /dev/null +++ b/drivers/sensor/sensirion/scd4x/scd4x.c @@ -0,0 +1,908 @@ +/* + * Copyright (c) 2024 Jan Fäh + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "scd4x.h" + +LOG_MODULE_REGISTER(SCD4X, CONFIG_SENSOR_LOG_LEVEL); + +static uint8_t scd4x_calc_crc(uint16_t value) +{ + uint8_t buf[2]; + + sys_put_be16(value, buf); + + return crc8(buf, 2, SCD4X_CRC_POLY, SCD4X_CRC_INIT, false); +} + +static int scd4x_write_command(const struct device *dev, uint8_t cmd) +{ + const struct scd4x_config *cfg = dev->config; + uint8_t tx_buf[2]; + int ret; + + sys_put_be16(scd4x_cmds[cmd].cmd, tx_buf); + + ret = i2c_write_dt(&cfg->bus, tx_buf, sizeof(tx_buf)); + + if (scd4x_cmds[cmd].cmd_duration_ms) { + k_msleep(scd4x_cmds[cmd].cmd_duration_ms); + } + + return ret; +} + +static int scd4x_read_reg(const struct device *dev, uint8_t *rx_buf, uint8_t rx_buf_size) +{ + const struct scd4x_config *cfg = dev->config; + int ret; + + ret = i2c_read_dt(&cfg->bus, rx_buf, rx_buf_size); + if (ret < 0) { + LOG_ERR("Failed to read i2c data."); + return ret; + } + + for (uint8_t i = 0; i < (rx_buf_size / 3); i++) { + ret = scd4x_calc_crc(sys_get_be16(&rx_buf[i * 3])); + if (ret != rx_buf[(i * 3) + 2]) { + LOG_ERR("Invalid CRC."); + return -EIO; + } + } + + return 0; +} + +static int scd4x_write_reg(const struct device *dev, uint8_t cmd, uint16_t *data, uint8_t data_size) +{ + const struct scd4x_config *cfg = dev->config; + int ret; + uint8_t tx_buf[((data_size * 3) + 2)]; + + sys_put_be16(scd4x_cmds[cmd].cmd, tx_buf); + + uint8_t tx_buf_pos = 2; + + for (uint8_t i = 0; i < data_size; i++) { + sys_put_be16(data[i], &tx_buf[tx_buf_pos]); + tx_buf_pos += 2; + tx_buf[tx_buf_pos++] = scd4x_calc_crc(data[i]); + } + + ret = i2c_write_dt(&cfg->bus, tx_buf, sizeof(tx_buf)); + if (ret < 0) { + LOG_ERR("Failed to write i2c data."); + return ret; + } + + if (scd4x_cmds[cmd].cmd_duration_ms) { + k_msleep(scd4x_cmds[cmd].cmd_duration_ms); + } + return 0; +} + +static int scd4x_data_ready(const struct device *dev, bool *is_data_ready) +{ + uint8_t rx_data[3]; + int ret; + *is_data_ready = false; + + ret = scd4x_write_command(dev, SCD4X_CMD_GET_DATA_READY_STATUS); + if (ret < 0) { + LOG_ERR("Failed to write get_data_ready_status command."); + return ret; + } + + ret = scd4x_read_reg(dev, rx_data, sizeof(rx_data)); + if (ret < 0) { + LOG_ERR("Failed to read get_data_ready_status register."); + return ret; + } + + uint16_t word = sys_get_be16(rx_data); + /* Least significant 11 bits = 0 --> data not ready */ + if ((word & 0x07FF) > 0) { + *is_data_ready = true; + } + + return 0; +} + +static int scd4x_read_sample(const struct device *dev) +{ + struct scd4x_data *data = dev->data; + uint8_t rx_data[9]; + int ret; + + ret = scd4x_write_command(dev, SCD4X_CMD_READ_MEASUREMENT); + if (ret < 0) { + LOG_ERR("Failed to write read_measurement command."); + return ret; + } + + ret = scd4x_read_reg(dev, rx_data, sizeof(rx_data)); + if (ret < 0) { + LOG_ERR("Failed to read read_measurement register."); + return ret; + } + + data->co2_sample = sys_get_be16(rx_data); + data->temp_sample = sys_get_be16(&rx_data[3]); + data->humi_sample = sys_get_be16(&rx_data[6]); + + return 0; +} + +static int scd4x_setup_measurement(const struct device *dev) +{ + const struct scd4x_config *cfg = dev->config; + int ret; + + switch ((enum scd4x_mode_t)cfg->mode) { + case SCD4X_MODE_NORMAL: + ret = scd4x_write_command(dev, SCD4X_CMD_START_PERIODIC_MEASUREMENT); + if (ret < 0) { + LOG_ERR("Failed to write start_periodic_measurement command."); + return ret; + } + break; + case SCD4X_MODE_LOW_POWER: + ret = scd4x_write_command(dev, SCD4X_CMD_LOW_POWER_PERIODIC_MEASUREMENT); + if (ret < 0) { + LOG_ERR("Failed to write start_low_power_periodic_measurement command."); + return ret; + } + break; + case SCD4X_MODE_SINGLE_SHOT: + ret = scd4x_write_command(dev, SCD4X_CMD_POWER_DOWN); + if (ret < 0) { + LOG_ERR("Failed to write power_down command."); + return ret; + } + break; + default: + return -EINVAL; + } + return 0; +} + +static int scd4x_set_idle_mode(const struct device *dev) +{ + const struct scd4x_config *cfg = dev->config; + int ret; + + if (cfg->mode == SCD4X_MODE_SINGLE_SHOT) { + /*send wake up command twice because of an expected nack return in power down mode*/ + scd4x_write_command(dev, SCD4X_CMD_WAKE_UP); + ret = scd4x_write_command(dev, SCD4X_CMD_WAKE_UP); + if (ret < 0) { + LOG_ERR("Failed write wake_up command."); + return ret; + } + } else { + ret = scd4x_write_command(dev, SCD4X_CMD_STOP_PERIODIC_MEASUREMENT); + if (ret < 0) { + LOG_ERR("Failed to write stop_periodic_measurement command."); + return ret; + } + } + + return 0; +} + +static int scd4x_set_temperature_offset(const struct device *dev, const struct sensor_value *val) +{ + int ret; + /*Calculation from Datasheet*/ + uint16_t offset_temp = + (float)(val->val1 + (val->val2 / 1000000.0)) * 0xFFFF / SCD4X_MAX_TEMP; + + ret = scd4x_write_reg(dev, SCD4X_CMD_SET_TEMPERATURE_OFFSET, &offset_temp, 1); + if (ret < 0) { + LOG_ERR("Failed to write set_temperature_offset register."); + return ret; + } + + return 0; +} + +static int scd4x_set_sensor_altitude(const struct device *dev, const struct sensor_value *val) +{ + int ret; + uint16_t altitude = val->val1; + + ret = scd4x_write_reg(dev, SCD4X_CMD_SET_SENSOR_ALTITUDE, &altitude, 1); + if (ret < 0) { + LOG_ERR("Failed to write set_sensor_altitude register."); + return ret; + } + return 0; +} + +static int scd4x_set_ambient_pressure(const struct device *dev, const struct sensor_value *val) +{ + int ret; + + uint16_t ambient_pressure = val->val1; + + ret = scd4x_write_reg(dev, SCD4X_CMD_SET_AMBIENT_PRESSURE, &ambient_pressure, 1); + if (ret < 0) { + LOG_ERR("Failed to write set_ambient_pressure register."); + return ret; + } + + return 0; +} + +static int scd4x_set_automatic_calib_enable(const struct device *dev, + const struct sensor_value *val) +{ + int ret; + uint16_t automatic_calib_enable = val->val1; + + ret = scd4x_write_reg(dev, SCD4X_CMD_SET_AUTOMATIC_CALIB_ENABLE, &automatic_calib_enable, + 1); + if (ret < 0) { + LOG_ERR("Failed to write set_automatic_calibration_enable register."); + return ret; + } + + return 0; +} + +static int scd4x_set_self_calib_initial_period(const struct device *dev, + const struct sensor_value *val) +{ + int ret; + uint16_t initial_period = val->val1; + + ret = scd4x_write_reg(dev, SCD4X_CMD_SET_SELF_CALIB_INITIAL_PERIOD, &initial_period, 1); + if (ret < 0) { + LOG_ERR("Failed to write set_automatic_self_calibration_initial_period register."); + return ret; + } + + return 0; +} + +static int scd4x_set_self_calib_standard_period(const struct device *dev, + const struct sensor_value *val) +{ + int ret; + uint16_t standard_period = val->val1; + + ret = scd4x_write_reg(dev, SCD4X_CMD_SET_SELF_CALIB_STANDARD_PERIOD, &standard_period, 1); + if (ret < 0) { + LOG_ERR("Failed to write set_automatic_self_calibration_standard_period register."); + return ret; + } + + return 0; +} + +static int scd4x_get_temperature_offset(const struct device *dev, struct sensor_value *val) +{ + int ret; + uint8_t rx_buf[3]; + + ret = scd4x_write_command(dev, SCD4X_CMD_GET_TEMPERATURE_OFFSET); + if (ret < 0) { + LOG_ERR("Failed to write get_temperature_offset command."); + return ret; + } + + ret = scd4x_read_reg(dev, rx_buf, sizeof(rx_buf)); + if (ret < 0) { + LOG_ERR("Failed to read get_temperature_offset register."); + return ret; + } + + int32_t temp; + + /*Calculation from Datasheet*/ + temp = sys_get_be16(rx_buf) * SCD4X_MAX_TEMP; + val->val1 = (int32_t)(temp / 0xFFFF); + val->val2 = ((temp % 0xFFFF) * 1000000) / 0xFFFF; + + return 0; +} + +static int scd4x_get_sensor_altitude(const struct device *dev, struct sensor_value *val) +{ + int ret; + uint8_t rx_buf[3]; + + ret = scd4x_write_command(dev, SCD4X_CMD_GET_SENSOR_ALTITUDE); + if (ret < 0) { + LOG_ERR("Failed to write get_sensor_altitude command."); + return ret; + } + + ret = scd4x_read_reg(dev, rx_buf, sizeof(rx_buf)); + if (ret < 0) { + LOG_ERR("Failed to read get_sensor_altitude register."); + return ret; + } + + val->val1 = sys_get_be16(rx_buf); + val->val2 = 0; + + return 0; +} + +static int scd4x_get_ambient_pressure(const struct device *dev, struct sensor_value *val) +{ + int ret; + uint8_t rx_buf[3]; + + ret = scd4x_write_command(dev, SCD4X_CMD_GET_AMBIENT_PRESSURE); + if (ret < 0) { + LOG_ERR("Failed to write get_ambient_pressure command."); + return ret; + } + + ret = scd4x_read_reg(dev, rx_buf, sizeof(rx_buf)); + if (ret < 0) { + LOG_ERR("Failed to read get_ambient_pressure register."); + return ret; + } + + val->val1 = sys_get_be16(rx_buf); + val->val2 = 0; + + return 0; +} + +static int scd4x_get_automatic_calib_enable(const struct device *dev, struct sensor_value *val) +{ + int ret; + uint8_t rx_buf[3]; + + ret = scd4x_write_command(dev, SCD4X_CMD_GET_AUTOMATIC_CALIB_ENABLE); + if (ret < 0) { + LOG_ERR("Failed to write get_automatic_calibration_enable command."); + return ret; + } + + ret = scd4x_read_reg(dev, rx_buf, sizeof(rx_buf)); + if (ret < 0) { + LOG_ERR("Failed to read get_automatic_calibration_enabled register."); + return ret; + } + + val->val1 = sys_get_be16(rx_buf); + val->val2 = 0; + + return 0; +} + +static int scd4x_get_self_calib_initial_period(const struct device *dev, struct sensor_value *val) +{ + int ret; + uint8_t rx_buf[3]; + + ret = scd4x_write_command(dev, SCD4X_CMD_GET_SELF_CALIB_INITIAL_PERIOD); + if (ret < 0) { + LOG_ERR("Failed to write get_automati_calibration_initial_period command."); + return ret; + } + + ret = scd4x_read_reg(dev, rx_buf, sizeof(rx_buf)); + if (ret < 0) { + LOG_ERR("Failed to read get_automatic_calibration_initial_period register."); + return ret; + } + + val->val1 = sys_get_be16(rx_buf); + val->val2 = 0; + + return 0; +} + +static int scd4x_get_self_calib_standard_period(const struct device *dev, struct sensor_value *val) +{ + int ret; + uint8_t rx_buf[3]; + + ret = scd4x_write_command(dev, SCD4X_CMD_GET_SELF_CALIB_STANDARD_PERIOD); + if (ret < 0) { + LOG_ERR("Failed to write get_automatic_self_calibration_standard_period command."); + return ret; + } + + ret = scd4x_read_reg(dev, rx_buf, sizeof(rx_buf)); + if (ret < 0) { + LOG_ERR("Failed to read get_automatic_self_calibration_standard_period register."); + return ret; + } + + val->val1 = sys_get_be16(rx_buf); + val->val2 = 0; + + return 0; +} + +int scd4x_forced_recalibration(const struct device *dev, uint16_t target_concentration, + uint16_t *frc_correction) +{ + uint8_t rx_buf[3]; + int ret; + + ret = scd4x_set_idle_mode(dev); + if (ret < 0) { + LOG_ERR("Failed to set idle mode."); + return ret; + } + + ret = scd4x_write_reg(dev, SCD4X_CMD_FORCED_RECALIB, &target_concentration, 1); + if (ret < 0) { + LOG_ERR("Failed to write perform_forced_recalibration register."); + return ret; + } + + ret = scd4x_read_reg(dev, rx_buf, sizeof(rx_buf)); + if (ret < 0) { + LOG_ERR("Failed to read perform_forced_recalibration register."); + return ret; + } + + *frc_correction = sys_get_be16(rx_buf); + + /*from datasheet*/ + if (*frc_correction == 0xFFFF) { + LOG_ERR("FRC failed. Returned 0xFFFF."); + return -EIO; + } + + *frc_correction -= 0x8000; + + ret = scd4x_setup_measurement(dev); + if (ret < 0) { + LOG_ERR("Failed to setup measurement."); + return ret; + } + + return 0; +} + +int scd4x_self_test(const struct device *dev) +{ + int ret; + uint8_t rx_buf[3]; + + ret = scd4x_set_idle_mode(dev); + if (ret < 0) { + LOG_ERR("Failed to set idle mode."); + return ret; + } + + ret = scd4x_write_command(dev, SCD4X_CMD_SELF_TEST); + if (ret < 0) { + LOG_ERR("Failed to write perform_self_test command."); + return ret; + } + + ret = scd4x_read_reg(dev, rx_buf, sizeof(rx_buf)); + if (ret < 0) { + LOG_ERR("Failed to read perform_self_test register."); + return ret; + } + + uint16_t is_malfunction = sys_get_be16(rx_buf); + + if (is_malfunction) { + LOG_ERR("malfunction detected."); + return -EIO; + } + + ret = scd4x_setup_measurement(dev); + if (ret < 0) { + LOG_ERR("Failed to setup measurement."); + return ret; + } + + return 0; +} + +int scd4x_persist_settings(const struct device *dev) +{ + int ret; + + ret = scd4x_set_idle_mode(dev); + if (ret < 0) { + LOG_ERR("Failed to set idle mode."); + return ret; + } + + ret = scd4x_write_command(dev, SCD4X_CMD_PERSIST_SETTINGS); + if (ret < 0) { + LOG_ERR("Failed to write persist_settings command."); + return ret; + } + + ret = scd4x_setup_measurement(dev); + if (ret < 0) { + LOG_ERR("Failed to setup measurement."); + return ret; + } + + return 0; +} + +int scd4x_factory_reset(const struct device *dev) +{ + int ret; + + ret = scd4x_set_idle_mode(dev); + if (ret < 0) { + LOG_ERR("Failed to set idle mode."); + return ret; + } + + ret = scd4x_write_command(dev, SCD4X_CMD_FACTORY_RESET); + if (ret < 0) { + LOG_ERR("Failed to write perfom_factory_reset command."); + return ret; + } + + ret = scd4x_setup_measurement(dev); + if (ret < 0) { + LOG_ERR("Failed to setup measurement."); + return ret; + } + + return 0; +} + +static int scd4x_sample_fetch(const struct device *dev, enum sensor_channel chan) +{ + const struct scd4x_config *cfg = dev->config; + bool is_data_ready; + int ret; + + if (chan != SENSOR_CHAN_ALL && chan != SENSOR_CHAN_AMBIENT_TEMP && + chan != SENSOR_CHAN_HUMIDITY && chan != SENSOR_CHAN_CO2) { + return -ENOTSUP; + } + + if (cfg->mode == SCD4X_MODE_SINGLE_SHOT) { + ret = scd4x_set_idle_mode(dev); + if (ret < 0) { + LOG_ERR("Failed to set idle mode."); + return ret; + } + + if (chan == SENSOR_CHAN_HUMIDITY || chan == SENSOR_CHAN_AMBIENT_TEMP) { + ret = scd4x_write_command(dev, SCD4X_CMD_MEASURE_SINGLE_SHOT_RHT); + if (ret < 0) { + LOG_ERR("Failed to write measure_single_shot_rht_only command."); + return ret; + } + } else { + ret = scd4x_write_command(dev, SCD4X_CMD_MEASURE_SINGLE_SHOT); + if (ret < 0) { + LOG_ERR("Failed to write measure_single_shot command."); + return ret; + } + } + } else { + ret = scd4x_data_ready(dev, &is_data_ready); + if (ret < 0) { + LOG_ERR("Failed to check data ready."); + return ret; + } + if (!is_data_ready) { + return 0; + } + } + + ret = scd4x_read_sample(dev); + if (ret < 0) { + LOG_ERR("Failed to get sample data."); + return ret; + } + + if (cfg->mode == SCD4X_MODE_SINGLE_SHOT) { + ret = scd4x_setup_measurement(dev); + if (ret < 0) { + LOG_ERR("Failed to setup measurement."); + return ret; + } + } + return 0; +} + +static int scd4x_channel_get(const struct device *dev, enum sensor_channel chan, + struct sensor_value *val) +{ + const struct scd4x_data *data = dev->data; + int32_t tmp_val; + + switch ((enum sensor_channel)chan) { + case SENSOR_CHAN_AMBIENT_TEMP: + /*Calculation from Datasheet*/ + tmp_val = data->temp_sample * SCD4X_MAX_TEMP; + val->val1 = (int32_t)(tmp_val / 0xFFFF) + SCD4X_MIN_TEMP; + val->val2 = ((tmp_val % 0xFFFF) * 1000000) / 0xFFFF; + break; + case SENSOR_CHAN_HUMIDITY: + /*Calculation from Datasheet*/ + tmp_val = data->humi_sample * 100; + val->val1 = (int32_t)(tmp_val / 0xFFFF); + val->val2 = ((tmp_val % 0xFFFF) * 1000000) / 0xFFFF; + break; + case SENSOR_CHAN_CO2: + val->val1 = data->co2_sample; + val->val2 = 0; + break; + default: + return -ENOTSUP; + } + return 0; +} + +int scd4x_attr_set(const struct device *dev, enum sensor_channel chan, enum sensor_attribute attr, + const struct sensor_value *val) +{ + const struct scd4x_config *cfg = dev->config; + int ret; + + if (chan != SENSOR_CHAN_ALL && chan != SENSOR_CHAN_AMBIENT_TEMP && + chan != SENSOR_CHAN_HUMIDITY && chan != SENSOR_CHAN_CO2) { + return -ENOTSUP; + } + + if ((enum sensor_attribute_scd4x)attr != SENSOR_ATTR_SCD4X_AMBIENT_PRESSURE) { + ret = scd4x_set_idle_mode(dev); + if (ret < 0) { + LOG_ERR("Failed to set idle mode."); + return ret; + } + } + + if (val->val1 < 0 || val->val2 < 0) { + return -EINVAL; + } + + switch ((enum sensor_attribute_scd4x)attr) { + case SENSOR_ATTR_SCD4X_TEMPERATURE_OFFSET: + if (val->val1 > SCD4X_TEMPERATURE_OFFSET_IDX_MAX) { + return -EINVAL; + } + ret = scd4x_set_temperature_offset(dev, val); + if (ret < 0) { + LOG_ERR("Failed to set temperature offset."); + return ret; + } + break; + case SENSOR_ATTR_SCD4X_SENSOR_ALTITUDE: + if (val->val1 > SCD4X_SENSOR_ALTITUDE_IDX_MAX) { + return -EINVAL; + } + ret = scd4x_set_sensor_altitude(dev, val); + if (ret < 0) { + LOG_ERR("Failed to set sensor altitude."); + return ret; + } + break; + case SENSOR_ATTR_SCD4X_AMBIENT_PRESSURE: + if (val->val1 > SCD4X_AMBIENT_PRESSURE_IDX_MAX || val->val1 < 700) { + return -EINVAL; + } + ret = scd4x_set_ambient_pressure(dev, val); + if (ret < 0) { + LOG_ERR("Failed to set ambient pressure."); + return ret; + } + /* return 0 to not call scd4x_start_measurement */ + return 0; + case SENSOR_ATTR_SCD4X_AUTOMATIC_CALIB_ENABLE: + if (val->val1 > SCD4X_BOOL_IDX_MAX) { + return -EINVAL; + } + ret = scd4x_set_automatic_calib_enable(dev, val); + if (ret < 0) { + LOG_ERR("Failed to set automatic calib enable."); + return ret; + } + break; + case SENSOR_ATTR_SCD4X_SELF_CALIB_INITIAL_PERIOD: + if (val->val1 % 4) { + return -EINVAL; + } + if (cfg->model == SCD4X_MODEL_SCD40) { + LOG_ERR("SELF_CALIB_INITIAL_PERIOD not available for SCD40."); + return -ENOTSUP; + } + ret = scd4x_set_self_calib_initial_period(dev, val); + if (ret < 0) { + LOG_ERR("Failed to set self calib initial period."); + return ret; + } + break; + case SENSOR_ATTR_SCD4X_SELF_CALIB_STANDARD_PERIOD: + if (val->val1 % 4) { + return -EINVAL; + } + if (cfg->model == SCD4X_MODEL_SCD40) { + LOG_ERR("SELF_CALIB_STANDARD_PERIOD not available for SCD40."); + return -ENOTSUP; + } + ret = scd4x_set_self_calib_standard_period(dev, val); + if (ret < 0) { + LOG_ERR("Failed to set self calib standard period."); + return ret; + } + break; + default: + return -ENOTSUP; + } + + ret = scd4x_setup_measurement(dev); + if (ret < 0) { + LOG_ERR("Failed to setup measurement."); + return ret; + } + + return 0; +} + +static int scd4x_attr_get(const struct device *dev, enum sensor_channel chan, + enum sensor_attribute attr, struct sensor_value *val) +{ + const struct scd4x_config *cfg = dev->config; + int ret; + + if (chan != SENSOR_CHAN_ALL && chan != SENSOR_CHAN_AMBIENT_TEMP && + chan != SENSOR_CHAN_HUMIDITY && chan != SENSOR_CHAN_CO2) { + return -ENOTSUP; + } + + if ((enum sensor_attribute_scd4x)attr != SENSOR_ATTR_SCD4X_AMBIENT_PRESSURE || + cfg->mode == SCD4X_MODE_SINGLE_SHOT) { + ret = scd4x_set_idle_mode(dev); + if (ret < 0) { + LOG_ERR("Failed to set idle mode."); + return ret; + } + } + + switch ((enum sensor_attribute_scd4x)attr) { + case SENSOR_ATTR_SCD4X_TEMPERATURE_OFFSET: + ret = scd4x_get_temperature_offset(dev, val); + if (ret < 0) { + LOG_ERR("Failed to get temperature offset."); + return ret; + } + break; + case SENSOR_ATTR_SCD4X_SENSOR_ALTITUDE: + ret = scd4x_get_sensor_altitude(dev, val); + if (ret < 0) { + LOG_ERR("Failed to get sensor altitude."); + return ret; + } + break; + case SENSOR_ATTR_SCD4X_AMBIENT_PRESSURE: + ret = scd4x_get_ambient_pressure(dev, val); + if (ret < 0) { + LOG_ERR("Failed to get ambient pressure."); + return ret; + } + /* return 0 to not call scd4x_setup_measurement */ + return 0; + case SENSOR_ATTR_SCD4X_AUTOMATIC_CALIB_ENABLE: + ret = scd4x_get_automatic_calib_enable(dev, val); + if (ret < 0) { + LOG_ERR("Failed to get automatic calib."); + return ret; + } + break; + case SENSOR_ATTR_SCD4X_SELF_CALIB_INITIAL_PERIOD: + if (cfg->model == SCD4X_MODEL_SCD40) { + LOG_ERR("SELF_CALIB_INITIAL_PERIOD not available for SCD40."); + return -ENOTSUP; + } + ret = scd4x_get_self_calib_initial_period(dev, val); + if (ret < 0) { + LOG_ERR("Failed to set get self calib initial period."); + return ret; + } + break; + case SENSOR_ATTR_SCD4X_SELF_CALIB_STANDARD_PERIOD: + if (cfg->model == SCD4X_MODEL_SCD40) { + LOG_ERR("SELF_CALIB_STANDARD_PERIOD not available for SCD40."); + return -ENOTSUP; + } + ret = scd4x_get_self_calib_standard_period(dev, val); + if (ret < 0) { + LOG_ERR("Failed to set get self calib standard period."); + return ret; + } + break; + default: + return -ENOTSUP; + } + + ret = scd4x_setup_measurement(dev); + if (ret < 0) { + LOG_ERR("Failed to setup measurement."); + return ret; + } + + return 0; +} + +static int scd4x_init(const struct device *dev) +{ + const struct scd4x_config *cfg = dev->config; + int ret; + + if (!i2c_is_ready_dt(&cfg->bus)) { + LOG_ERR("Device not ready."); + return -ENODEV; + } + + ret = scd4x_write_command(dev, SCD4X_CMD_STOP_PERIODIC_MEASUREMENT); + if (ret < 0) { + /*send wake up command twice because of an expected nack return in power down mode*/ + scd4x_write_command(dev, SCD4X_CMD_WAKE_UP); + ret = scd4x_write_command(dev, SCD4X_CMD_WAKE_UP); + if (ret < 0) { + LOG_ERR("Failed to put the device in idle mode."); + return ret; + } + } + + ret = scd4x_write_command(dev, SCD4X_CMD_REINIT); + if (ret < 0) { + LOG_ERR("Failed to reset the device."); + return ret; + } + + ret = scd4x_setup_measurement(dev); + if (ret < 0) { + LOG_ERR("Failed to setup measurement."); + return ret; + } + return 0; +} + +static const struct sensor_driver_api scd4x_api_funcs = { + .sample_fetch = scd4x_sample_fetch, + .channel_get = scd4x_channel_get, + .attr_set = scd4x_attr_set, + .attr_get = scd4x_attr_get, +}; + +#define SCD4X_INIT(inst, scd4x_model) \ + static struct scd4x_data scd4x_data_##inst; \ + static const struct scd4x_config scd4x_config_##inst = { \ + .bus = I2C_DT_SPEC_INST_GET(inst), \ + .model = scd4x_model, \ + .mode = DT_INST_ENUM_IDX_OR(inst, mode, SCD4X_MODE_NORMAL), \ + }; \ + SENSOR_DEVICE_DT_INST_DEFINE(inst, scd4x_init, NULL, &scd4x_data_##inst, \ + &scd4x_config_##inst, POST_KERNEL, \ + CONFIG_SENSOR_INIT_PRIORITY, &scd4x_api_funcs); + +#define DT_DRV_COMPAT sensirion_scd40 +DT_INST_FOREACH_STATUS_OKAY_VARGS(SCD4X_INIT, SCD4X_MODEL_SCD40) +#undef DT_DRV_COMPAT + +#define DT_DRV_COMPAT sensirion_scd41 +DT_INST_FOREACH_STATUS_OKAY_VARGS(SCD4X_INIT, SCD4X_MODEL_SCD41) +#undef DT_DRV_COMPAT diff --git a/drivers/sensor/sensirion/scd4x/scd4x.h b/drivers/sensor/sensirion/scd4x/scd4x.h new file mode 100644 index 0000000000000..3955d2021990f --- /dev/null +++ b/drivers/sensor/sensirion/scd4x/scd4x.h @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2024 Jan Fäh + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_DRIVERS_SENSOR_SCD4X_SCD4X_H_ +#define ZEPHYR_DRIVERS_SENSOR_SCD4X_SCD4X_H_ + +#include + +#define SCD4X_CMD_REINIT 0 +#define SCD4X_CMD_START_PERIODIC_MEASUREMENT 1 +#define SCD4X_CMD_STOP_PERIODIC_MEASUREMENT 2 +#define SCD4X_CMD_READ_MEASUREMENT 3 +#define SCD4X_CMD_SET_TEMPERATURE_OFFSET 4 +#define SCD4X_CMD_GET_TEMPERATURE_OFFSET 5 +#define SCD4X_CMD_SET_SENSOR_ALTITUDE 6 +#define SCD4X_CMD_GET_SENSOR_ALTITUDE 7 +#define SCD4X_CMD_SET_AMBIENT_PRESSURE 8 +#define SCD4X_CMD_GET_AMBIENT_PRESSURE 9 +#define SCD4X_CMD_FORCED_RECALIB 10 +#define SCD4X_CMD_SET_AUTOMATIC_CALIB_ENABLE 11 +#define SCD4X_CMD_GET_AUTOMATIC_CALIB_ENABLE 12 +#define SCD4X_CMD_LOW_POWER_PERIODIC_MEASUREMENT 13 +#define SCD4X_CMD_GET_DATA_READY_STATUS 14 +#define SCD4X_CMD_PERSIST_SETTINGS 15 +#define SCD4X_CMD_SELF_TEST 16 +#define SCD4X_CMD_FACTORY_RESET 17 +#define SCD4X_CMD_MEASURE_SINGLE_SHOT 18 +#define SCD4X_CMD_MEASURE_SINGLE_SHOT_RHT 19 +#define SCD4X_CMD_POWER_DOWN 10 +#define SCD4X_CMD_WAKE_UP 21 +#define SCD4X_CMD_SET_SELF_CALIB_INITIAL_PERIOD 22 +#define SCD4X_CMD_GET_SELF_CALIB_INITIAL_PERIOD 23 +#define SCD4X_CMD_SET_SELF_CALIB_STANDARD_PERIOD 24 +#define SCD4X_CMD_GET_SELF_CALIB_STANDARD_PERIOD 25 + +#define SCD4X_CRC_POLY 0x31 +#define SCD4X_CRC_INIT 0xFF + +#define SCD4X_STARTUP_TIME_MS 30 + +#define SCD4X_TEMPERATURE_OFFSET_IDX_MAX 20 +#define SCD4X_SENSOR_ALTITUDE_IDX_MAX 3000 +#define SCD4X_AMBIENT_PRESSURE_IDX_MAX 1200 +#define SCD4X_BOOL_IDX_MAX 1 + +#define SCD4X_MAX_TEMP 175 +#define SCD4X_MIN_TEMP -45 + +enum scd4x_model_t { + SCD4X_MODEL_SCD40, + SCD4X_MODEL_SCD41, +}; + +enum scd4x_mode_t { + SCD4X_MODE_NORMAL, + SCD4X_MODE_LOW_POWER, + SCD4X_MODE_SINGLE_SHOT, +}; + +struct scd4x_config { + struct i2c_dt_spec bus; + enum scd4x_model_t model; + enum scd4x_mode_t mode; +}; + +struct scd4x_data { + uint16_t temp_sample; + uint16_t humi_sample; + uint16_t co2_sample; +}; + +struct cmds_t { + uint16_t cmd; + uint16_t cmd_duration_ms; +}; + +const struct cmds_t scd4x_cmds[] = { + {0x3646, 30}, {0x21B1, 0}, {0x3F86, 500}, {0xEC05, 1}, {0x241D, 1}, {0x2318, 1}, + {0x2427, 1}, {0x2322, 1}, {0xE000, 1}, {0xE000, 1}, {0x362F, 400}, {0x2416, 1}, + {0x2313, 1}, {0x21AC, 0}, {0xE4B8, 1}, {0x3615, 800}, {0x3639, 10000}, {0x3632, 1200}, + {0x219D, 5000}, {0x2196, 50}, {0x36E0, 1}, {0x36F6, 30}, {0x2445, 1}, {0x2340, 1}, + {0x244E, 1}, {0x234B, 1}, +}; + +#endif /* ZEPHYR_DRIVERS_SENSOR_SCD4X_SCD4X_H_ */ diff --git a/dts/bindings/sensor/sensirion,scd40.yaml b/dts/bindings/sensor/sensirion,scd40.yaml new file mode 100644 index 0000000000000..7f6bcaaff5d2f --- /dev/null +++ b/dts/bindings/sensor/sensirion,scd40.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2024, Jan Fäh +# SPDX-License-Identifier: Apache-2.0 + +description: Sensirion SCD4x temperature sensor + +compatible: "sensirion,scd40" + +include: [sensor-device.yaml, i2c-device.yaml] diff --git a/dts/bindings/sensor/sensirion,scd41.yaml b/dts/bindings/sensor/sensirion,scd41.yaml new file mode 100644 index 0000000000000..e5a955d196b6f --- /dev/null +++ b/dts/bindings/sensor/sensirion,scd41.yaml @@ -0,0 +1,21 @@ +# Copyright (c) 2024, Jan Fäh +# SPDX-License-Identifier: Apache-2.0 + +description: Sensirion SCD4x temperature sensor + +compatible: "sensirion,scd41" + +include: [sensor-device.yaml, i2c-device.yaml] + +properties: + mode: + type: int + required: true + description: | + - 0: Normal periodic measurement. Default interval of 5sec + - 1: Low power periodic measurement. Interval of 30sec + - 2: Singleshot measurement for low power usage. + enum: + - 0 + - 1 + - 2 diff --git a/include/zephyr/drivers/sensor/scd4x.h b/include/zephyr/drivers/sensor/scd4x.h new file mode 100644 index 0000000000000..edae9693d7ef5 --- /dev/null +++ b/include/zephyr/drivers/sensor/scd4x.h @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2024 Jan Fäh + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_SCD4X_H_ +#define ZEPHYR_INCLUDE_DRIVERS_SENSOR_SCD4X_H_ + +#include + +enum sensor_attribute_scd4x { + /* Offset temperature: Toffset_actual = Tscd4x – Treference + Toffset_previous + * 0 - 20°C + */ + SENSOR_ATTR_SCD4X_TEMPERATURE_OFFSET = SENSOR_ATTR_PRIV_START, + /* Altidude of the sensor; + * 0 - 3000m + */ + SENSOR_ATTR_SCD4X_SENSOR_ALTITUDE, + /* Ambient pressure in hPa + * 700 - 1200hPa + */ + SENSOR_ATTR_SCD4X_AMBIENT_PRESSURE, + /* Set the current state (enabled: 1 / disabled: 0). + * Default: enabled. + */ + SENSOR_ATTR_SCD4X_AUTOMATIC_CALIB_ENABLE, + /* Set the initial period for automatic self calibration correction in hours. Allowed values + * are integer multiples of 4 hours. + * Default: 44 + */ + SENSOR_ATTR_SCD4X_SELF_CALIB_INITIAL_PERIOD, + /* Set the standard period for automatic self calibration correction in hours. Allowed + * values are integer multiples of 4 hours. Default: 156 + */ + SENSOR_ATTR_SCD4X_SELF_CALIB_STANDARD_PERIOD, +}; + +/** + * @brief Performs a forced recalibration. + * + * Operate the SCD4x in the operation mode for at least 3 minutes in an environment with a + * homogeneous and constant CO2 concentration. Otherwise the recalibratioin will fail. The sensor + * must be operated at the voltage desired for the application when performing the FRC sequence. + * + * @param dev Pointer to the sensor device + * @param target_concentration Reference CO2 concentration. + * @param frc_correction Previous differences from the target concentration + * + * @return 0 if successful, negative errno code if failure. + */ +int scd4x_forced_recalibration(const struct device *dev, uint16_t target_concentration, + uint16_t *frc_correction); + +/** + * @brief Performs a self test. + * + * The self_test command can be used as an end-of-line test to check the sensor functionality + * + * @param dev Pointer to the sensor device + * + * @return 0 if successful, negative errno code if failure. + */ +int scd4x_self_test(const struct device *dev); + +/** + * @brief Performs a self test. + * + * The persist_settings command can be used to save the actual configuration. This command + * should only be sent when persistence is required and if actual changes to the configuration have + * been made. The EEPROM is guaranteed to withstand at least 2000 write cycles + * + * @param dev Pointer to the sensor device + * + * @return 0 if successful, negative errno code if failure. + */ +int scd4x_persist_settings(const struct device *dev); + +/** + * @brief Performs a factory reset. + * + * The perform_factory_reset command resets all configuration settings stored in the EEPROM and + * erases the FRC and ASC algorithm history. + * + * @param dev Pointer to the sensor device + * + * @return 0 if successful, negative errno code if failure. + */ +int scd4x_factory_reset(const struct device *dev); + +#endif /* ZEPHYR_INCLUDE_DRIVERS_SENSOR_SCD4X_H_ */ diff --git a/tests/drivers/build_all/sensor/i2c.dtsi b/tests/drivers/build_all/sensor/i2c.dtsi index 9b1a5cd1f95a2..7b5ef3e9294bf 100644 --- a/tests/drivers/build_all/sensor/i2c.dtsi +++ b/tests/drivers/build_all/sensor/i2c.dtsi @@ -1131,3 +1131,9 @@ test_i2c_sts4x: sts4x@9d { reg = <0x99>; repeatability = <2>; }; + +test_i2c_scd4x: scd4x@9e { + compatible = "sensirion,scd41"; + reg = <0x9e>; + mode = <0>; +}; From 93c03214fa463acbce7e748e833222f41be760cc Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Tue, 19 Nov 2024 14:33:16 +0100 Subject: [PATCH 2779/4482] tests: Thread-Metric: Filter properly native targets There is more native targets than native_sim and native_posix. Let's exclude them all by architecture. Signed-off-by: Alberto Escolar Piedras --- tests/benchmarks/thread_metric/testcase.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/benchmarks/thread_metric/testcase.yaml b/tests/benchmarks/thread_metric/testcase.yaml index 7cefcb9d98b26..e86a5a18ac9f3 100644 --- a/tests/benchmarks/thread_metric/testcase.yaml +++ b/tests/benchmarks/thread_metric/testcase.yaml @@ -4,9 +4,9 @@ common: - benchmark # Native platforms excluded as timer interrupts may not be detected # qemu_nios2 excluded as it is slow + arch_exclude: + - posix platform_exclude: - - native_posix - - native_sim - qemu_nios2 integration_platforms: - qemu_x86 From 2cef2781bed2691e8a2ab4c01170a51afff69f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 18 Nov 2024 16:08:40 +0100 Subject: [PATCH 2780/4482] doc: releases: expose draft 4.1 release notes + migration guide in toc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update toctrees to show 4.1 documents in the release page Signed-off-by: Benjamin Cabé --- doc/releases/index.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/releases/index.rst b/doc/releases/index.rst index 89678b2515818..f5e143d02308c 100644 --- a/doc/releases/index.rst +++ b/doc/releases/index.rst @@ -85,7 +85,7 @@ needs to be changed are to be detailed in the release's migration guide. release-notes-2.7 release-notes-3.[6-7] - release-notes-4.0 + release-notes-4.[0-1] Migration Guides **************** @@ -117,7 +117,7 @@ to be able to understand the context of the change. :reversed: migration-guide-3.[6-7] - migration-guide-4.[0] + migration-guide-4.[0-1] End-of-life Releases ******************** From f3a868ad900c15bfba2db5244be479b7c83d35e7 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Sun, 17 Nov 2024 15:47:43 +0100 Subject: [PATCH 2781/4482] drivers: stepper: tmc5xxx: generalized macros for tmc5xxx This commit generalizes macros which are common to tmc5xxx drivers Signed-off-by: Jilay Pandya --- drivers/stepper/adi_tmc/adi_tmc_reg.h | 118 +++++++++++++------------- 1 file changed, 58 insertions(+), 60 deletions(-) diff --git a/drivers/stepper/adi_tmc/adi_tmc_reg.h b/drivers/stepper/adi_tmc/adi_tmc_reg.h index ebf0de57ed168..eff9f86cea8d0 100644 --- a/drivers/stepper/adi_tmc/adi_tmc_reg.h +++ b/drivers/stepper/adi_tmc/adi_tmc_reg.h @@ -20,7 +20,64 @@ extern "C" { /** Common Registers for TMC5041 and TMC51XX */ #if defined(CONFIG_STEPPER_ADI_TMC5041) -#define TMC5XXX_CLOCK_FREQ_SHIFT 24 +#define TMC5XXX_WRITE_BIT 0x80U +#define TMC5XXX_ADDRESS_MASK 0x7FU + + #define TMC5XXX_CLOCK_FREQ_SHIFT 24 + +#define TMC5XXX_GCONF 0x00 +#define TMC5XXX_GSTAT 0x01 + +#define TMC5XXX_RAMPMODE_POSITIONING_MODE 0 +#define TMC5XXX_RAMPMODE_POSITIVE_VELOCITY_MODE 1 +#define TMC5XXX_RAMPMODE_NEGATIVE_VELOCITY_MODE 2 +#define TMC5XXX_RAMPMODE_HOLD_MODE 3 + +#define TMC5XXX_SG_MIN_VALUE -64 +#define TMC5XXX_SG_MAX_VALUE 63 +#define TMC5XXX_SW_MODE_SG_STOP_ENABLE BIT(10) + +#define TMC5XXX_COOLCONF_SG2_THRESHOLD_VALUE_SHIFT 16 + +#define TMC5XXX_IHOLD_MASK GENMASK(4, 0) +#define TMC5XXX_IHOLD_SHIFT 0 +#define TMC5XXX_IHOLD(n) (((n) << TMC5XXX_IHOLD_SHIFT) & TMC5XXX_IHOLD_MASK) + +#define TMC5XXX_IRUN_MASK GENMASK(12, 8) +#define TMC5XXX_IRUN_SHIFT 8 +#define TMC5XXX_IRUN(n) (((n) << TMC5XXX_IRUN_SHIFT) & TMC5XXX_IRUN_MASK) + +#define TMC5XXX_IHOLDDELAY_MASK GENMASK(19, 16) +#define TMC5XXX_IHOLDDELAY_SHIFT 16 +#define TMC5XXX_IHOLDDELAY(n) (((n) << TMC5XXX_IHOLDDELAY_SHIFT) & TMC5XXX_IHOLDDELAY_MASK) + +#define TMC5XXX_CHOPCONF_DRV_ENABLE_MASK GENMASK(3, 0) +#define TMC5XXX_CHOPCONF_MRES_MASK GENMASK(27, 24) +#define TMC5XXX_CHOPCONF_MRES_SHIFT 24 + +#define TMC5XXX_RAMPSTAT_INT_MASK GENMASK(7, 4) +#define TMC5XXX_RAMPSTAT_INT_SHIFT 4 + +#define TMC5XXX_RAMPSTAT_POS_REACHED_EVENT_MASK BIT(7) +#define TMC5XXX_POS_REACHED_EVENT \ + (TMC5XXX_RAMPSTAT_POS_REACHED_EVENT_MASK >> TMC5XXX_RAMPSTAT_INT_SHIFT) + +#define TMC5XXX_RAMPSTAT_STOP_SG_EVENT_MASK BIT(6) +#define TMC5XXX_STOP_SG_EVENT \ + (TMC5XXX_RAMPSTAT_STOP_SG_EVENT_MASK >> TMC5XXX_RAMPSTAT_INT_SHIFT) + +#define TMC5XXX_RAMPSTAT_STOP_RIGHT_EVENT_MASK BIT(5) +#define TMC5XXX_STOP_RIGHT_EVENT \ + (TMC5XXX_RAMPSTAT_STOP_RIGHT_EVENT_MASK >> TMC5XXX_RAMPSTAT_INT_SHIFT) + +#define TMC5XXX_RAMPSTAT_STOP_LEFT_EVENT_MASK BIT(4) +#define TMC5XXX_STOP_LEFT_EVENT \ + (TMC5XXX_RAMPSTAT_STOP_LEFT_EVENT_MASK >> TMC5XXX_RAMPSTAT_INT_SHIFT) + +#define TMC5XXX_DRV_STATUS_STST_BIT BIT(31) +#define TMC5XXX_DRV_STATUS_SG_RESULT_MASK GENMASK(9, 0) +#define TMC5XXX_DRV_STATUS_SG_STATUS_MASK BIT(24) +#define TMC5XXX_DRV_STATUS_SG_STATUS_SHIFT 24 #endif @@ -37,19 +94,11 @@ extern "C" { * @{ */ -#define TMC5041_WRITE_BIT 0x80U -#define TMC5041_ADDRESS_MASK 0x7FU - #define TMC5041_GCONF_POSCMP_ENABLE_SHIFT 3 #define TMC5041_GCONF_TEST_MODE_SHIFT 7 #define TMC5041_GCONF_SHAFT_SHIFT(n) ((n) ? 8 : 9) #define TMC5041_LOCK_GCONF_SHIFT 10 -#define TMC5041_GCONF 0x00 -#define TMC5041_GSTAT 0x01 -#define TMC5041_INPUT 0x04 -#define TMC5041_X_COMPARE 0x05 - #define TMC5041_PWMCONF(motor) (0x10 | TMC5041_MOTOR_ADDR_PWM(motor)) #define TMC5041_PWM_STATUS(motor) (0x11 | TMC5041_MOTOR_ADDR_PWM(motor)) @@ -89,57 +138,6 @@ extern "C" { #define TMC5041_COOLCONF(motor) (0x6D | TMC5041_MOTOR_ADDR_DRV(motor)) #define TMC5041_DRVSTATUS(motor) (0x6F | TMC5041_MOTOR_ADDR_DRV(motor)) -#define TMC5041_RAMPMODE_POSITIONING_MODE 0 -#define TMC5041_RAMPMODE_POSITIVE_VELOCITY_MODE 1 -#define TMC5041_RAMPMODE_NEGATIVE_VELOCITY_MODE 2 -#define TMC5041_RAMPMODE_HOLD_MODE 3 - -#define TMC5041_SW_MODE_SG_STOP_ENABLE BIT(10) - -#define TMC5041_RAMPSTAT_INT_MASK GENMASK(7, 4) -#define TMC5041_RAMPSTAT_INT_SHIFT 4 - -#define TMC5041_RAMPSTAT_POS_REACHED_EVENT_MASK BIT(7) -#define TMC5041_POS_REACHED_EVENT \ - (TMC5041_RAMPSTAT_POS_REACHED_EVENT_MASK >> TMC5041_RAMPSTAT_INT_SHIFT) - -#define TMC5041_RAMPSTAT_STOP_SG_EVENT_MASK BIT(6) -#define TMC5041_STOP_SG_EVENT (TMC5041_RAMPSTAT_STOP_SG_EVENT_MASK >> TMC5041_RAMPSTAT_INT_SHIFT) - -#define TMC5041_RAMPSTAT_STOP_RIGHT_EVENT_MASK BIT(5) -#define TMC5041_STOP_RIGHT_EVENT \ - (TMC5041_RAMPSTAT_STOP_RIGHT_EVENT_MASK >> TMC5041_RAMPSTAT_INT_SHIFT) - -#define TMC5041_RAMPSTAT_STOP_LEFT_EVENT_MASK BIT(4) -#define TMC5041_STOP_LEFT_EVENT \ - (TMC5041_RAMPSTAT_STOP_LEFT_EVENT_MASK >> TMC5041_RAMPSTAT_INT_SHIFT) - -#define TMC5041_DRV_STATUS_STST_BIT BIT(31) -#define TMC5041_DRV_STATUS_SG_RESULT_MASK GENMASK(9, 0) -#define TMC5041_DRV_STATUS_SG_STATUS_MASK BIT(24) -#define TMC5041_DRV_STATUS_SG_STATUS_SHIFT 24 - -#define TMC5041_SG_MIN_VALUE -64 -#define TMC5041_SG_MAX_VALUE 63 - -#define TMC5041_COOLCONF_SG2_THRESHOLD_VALUE_SHIFT 16 - -#define TMC5041_IHOLD_MASK GENMASK(4, 0) -#define TMC5041_IHOLD_SHIFT 0 -#define TMC5041_IHOLD(n) (((n) << TMC5041_IHOLD_SHIFT) & TMC5041_IHOLD_MASK) - -#define TMC5041_IRUN_MASK GENMASK(12, 8) -#define TMC5041_IRUN_SHIFT 8 -#define TMC5041_IRUN(n) (((n) << TMC5041_IRUN_SHIFT) & TMC5041_IRUN_MASK) - -#define TMC5041_IHOLDDELAY_MASK GENMASK(19, 16) -#define TMC5041_IHOLDDELAY_SHIFT 16 -#define TMC5041_IHOLDDELAY(n) (((n) << TMC5041_IHOLDDELAY_SHIFT) & TMC5041_IHOLDDELAY_MASK) - -#define TMC5041_CHOPCONF_DRV_ENABLE_MASK GENMASK(3, 0) -#define TMC5041_CHOPCONF_MRES_MASK GENMASK(27, 24) -#define TMC5041_CHOPCONF_MRES_SHIFT 24 - #endif /** From 6098b2f67303dbc2ea761b425d191fd2c2159fb5 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Sun, 17 Nov 2024 15:56:23 +0100 Subject: [PATCH 2782/4482] drivers: stepper: tmc5041: use tmc5xxx generalized macros This commit refactors tmc5041 driver to use tmc5xxx generalized macros Signed-off-by: Jilay Pandya --- .../adi_tmc/adi_tmc5041_stepper_controller.c | 56 +++++++++---------- .../zephyr/drivers/stepper/stepper_trinamic.h | 6 +- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c b/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c index c5433c1a83591..0fa7ab19e6d69 100644 --- a/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c +++ b/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c @@ -63,7 +63,7 @@ static int tmc5041_write(const struct device *dev, const uint8_t reg_addr, const k_sem_take(&data->sem, K_FOREVER); - err = tmc_spi_write_register(&bus, TMC5041_WRITE_BIT, reg_addr, reg_val); + err = tmc_spi_write_register(&bus, TMC5XXX_WRITE_BIT, reg_addr, reg_val); k_sem_give(&data->sem); @@ -83,7 +83,7 @@ static int tmc5041_read(const struct device *dev, const uint8_t reg_addr, uint32 k_sem_take(&data->sem, K_FOREVER); - err = tmc_spi_read_register(&bus, TMC5041_ADDRESS_MASK, reg_addr, reg_val); + err = tmc_spi_read_register(&bus, TMC5XXX_ADDRESS_MASK, reg_addr, reg_val); k_sem_give(&data->sem); @@ -117,7 +117,7 @@ static int stallguard_enable(const struct device *dev, const bool enable) } if (enable) { - reg_value |= TMC5041_SW_MODE_SG_STOP_ENABLE; + reg_value |= TMC5XXX_SW_MODE_SG_STOP_ENABLE; int32_t actual_velocity; @@ -136,7 +136,7 @@ static int stallguard_enable(const struct device *dev, const bool enable) return -EAGAIN; } } else { - reg_value &= ~TMC5041_SW_MODE_SG_STOP_ENABLE; + reg_value &= ~TMC5XXX_SW_MODE_SG_STOP_ENABLE; } err = tmc5041_write(config->controller, TMC5041_SWMODE(config->index), reg_value); if (err) { @@ -193,11 +193,11 @@ static void rampstat_work_handler(struct k_work *work) tmc5041_read(stepper_config->controller, TMC5041_DRVSTATUS(stepper_config->index), &drv_status); - if (FIELD_GET(TMC5041_DRV_STATUS_SG_STATUS_MASK, drv_status) == 1U) { + if (FIELD_GET(TMC5XXX_DRV_STATUS_SG_STATUS_MASK, drv_status) == 1U) { LOG_INF("%s: Stall detected", stepper_data->stepper->name); err = tmc5041_write(stepper_config->controller, TMC5041_RAMPMODE(stepper_config->index), - TMC5041_RAMPMODE_HOLD_MODE); + TMC5XXX_RAMPMODE_HOLD_MODE); if (err != 0) { LOG_ERR("%s: Failed to stop motor", stepper_data->stepper->name); return; @@ -213,29 +213,29 @@ static void rampstat_work_handler(struct k_work *work) return; } - const uint8_t ramp_stat_values = FIELD_GET(TMC5041_RAMPSTAT_INT_MASK, rampstat_value); + const uint8_t ramp_stat_values = FIELD_GET(TMC5XXX_RAMPSTAT_INT_MASK, rampstat_value); if (ramp_stat_values > 0) { switch (ramp_stat_values) { - case TMC5041_STOP_LEFT_EVENT: + case TMC5XXX_STOP_LEFT_EVENT: LOG_DBG("RAMPSTAT %s:Left end-stop detected", stepper_data->stepper->name); execute_callback(stepper_data->stepper, STEPPER_EVENT_LEFT_END_STOP_DETECTED); break; - case TMC5041_STOP_RIGHT_EVENT: + case TMC5XXX_STOP_RIGHT_EVENT: LOG_DBG("RAMPSTAT %s:Right end-stop detected", stepper_data->stepper->name); execute_callback(stepper_data->stepper, STEPPER_EVENT_RIGHT_END_STOP_DETECTED); break; - case TMC5041_POS_REACHED_EVENT: + case TMC5XXX_POS_REACHED_EVENT: LOG_DBG("RAMPSTAT %s:Position reached", stepper_data->stepper->name); execute_callback(stepper_data->stepper, STEPPER_EVENT_STEPS_COMPLETED); break; - case TMC5041_STOP_SG_EVENT: + case TMC5XXX_STOP_SG_EVENT: LOG_DBG("RAMPSTAT %s:Stall detected", stepper_data->stepper->name); stallguard_enable(stepper_data->stepper, false); execute_callback(stepper_data->stepper, STEPPER_EVENT_STALL_DETECTED); @@ -266,9 +266,9 @@ static int tmc5041_stepper_enable(const struct device *dev, const bool enable) } if (enable) { - reg_value |= TMC5041_CHOPCONF_DRV_ENABLE_MASK; + reg_value |= TMC5XXX_CHOPCONF_DRV_ENABLE_MASK; } else { - reg_value &= ~TMC5041_CHOPCONF_DRV_ENABLE_MASK; + reg_value &= ~TMC5XXX_CHOPCONF_DRV_ENABLE_MASK; } err = tmc5041_write(config->controller, TMC5041_CHOPCONF(config->index), reg_value); @@ -291,7 +291,7 @@ static int tmc5041_stepper_is_moving(const struct device *dev, bool *is_moving) return -EIO; } - *is_moving = (FIELD_GET(TMC5041_DRV_STATUS_STST_BIT, reg_value) != 1U); + *is_moving = (FIELD_GET(TMC5XXX_DRV_STATUS_STST_BIT, reg_value) != 1U); LOG_DBG("Stepper motor controller %s is moving: %d", dev->name, *is_moving); return 0; } @@ -318,7 +318,7 @@ static int tmc5041_stepper_move(const struct device *dev, const int32_t steps) int32_t target_position = position + steps; err = tmc5041_write(config->controller, TMC5041_RAMPMODE(config->index), - TMC5041_RAMPMODE_POSITIONING_MODE); + TMC5XXX_RAMPMODE_POSITIONING_MODE); if (err != 0) { return -EIO; } @@ -373,9 +373,9 @@ static int tmc5041_stepper_set_micro_step_res(const struct device *dev, return -EIO; } - reg_value &= ~TMC5041_CHOPCONF_MRES_MASK; + reg_value &= ~TMC5XXX_CHOPCONF_MRES_MASK; reg_value |= ((MICRO_STEP_RES_INDEX(STEPPER_MICRO_STEP_256) - LOG2(res)) - << TMC5041_CHOPCONF_MRES_SHIFT); + << TMC5XXX_CHOPCONF_MRES_SHIFT); err = tmc5041_write(config->controller, TMC5041_CHOPCONF(config->index), reg_value); if (err != 0) { @@ -398,8 +398,8 @@ static int tmc5041_stepper_get_micro_step_res(const struct device *dev, if (err != 0) { return -EIO; } - reg_value &= TMC5041_CHOPCONF_MRES_MASK; - reg_value >>= TMC5041_CHOPCONF_MRES_SHIFT; + reg_value &= TMC5XXX_CHOPCONF_MRES_MASK; + reg_value >>= TMC5XXX_CHOPCONF_MRES_SHIFT; *res = (1 << (MICRO_STEP_RES_INDEX(STEPPER_MICRO_STEP_256) - reg_value)); LOG_DBG("Stepper motor controller %s get micro step resolution: %d", dev->name, *res); return 0; @@ -411,7 +411,7 @@ static int tmc5041_stepper_set_actual_position(const struct device *dev, const i int err; err = tmc5041_write(config->controller, TMC5041_RAMPMODE(config->index), - TMC5041_RAMPMODE_HOLD_MODE); + TMC5XXX_RAMPMODE_HOLD_MODE); if (err != 0) { return -EIO; } @@ -449,7 +449,7 @@ static int tmc5041_stepper_set_target_position(const struct device *dev, const i } err = tmc5041_write(config->controller, TMC5041_RAMPMODE(config->index), - TMC5041_RAMPMODE_POSITIONING_MODE); + TMC5XXX_RAMPMODE_POSITIONING_MODE); if (err != 0) { return -EIO; } @@ -493,7 +493,7 @@ static int tmc5041_stepper_enable_constant_velocity_mode(const struct device *de switch (direction) { case STEPPER_DIRECTION_POSITIVE: err = tmc5041_write(config->controller, TMC5041_RAMPMODE(config->index), - TMC5041_RAMPMODE_POSITIVE_VELOCITY_MODE); + TMC5XXX_RAMPMODE_POSITIVE_VELOCITY_MODE); if (err != 0) { return -EIO; } @@ -505,7 +505,7 @@ static int tmc5041_stepper_enable_constant_velocity_mode(const struct device *de case STEPPER_DIRECTION_NEGATIVE: err = tmc5041_write(config->controller, TMC5041_RAMPMODE(config->index), - TMC5041_RAMPMODE_NEGATIVE_VELOCITY_MODE); + TMC5XXX_RAMPMODE_NEGATIVE_VELOCITY_MODE); if (err != 0) { return -EIO; } @@ -611,7 +611,7 @@ static int tmc5041_init(const struct device *dev) /* Init non motor-index specific registers here. */ LOG_DBG("GCONF: %d", config->gconf); - err = tmc5041_write(dev, TMC5041_GCONF, config->gconf); + err = tmc5041_write(dev, TMC5XXX_GCONF, config->gconf); if (err != 0) { return -EIO; } @@ -619,7 +619,7 @@ static int tmc5041_init(const struct device *dev) /* Read GSTAT register values to clear any errors SPI Datagram. */ uint32_t gstat_value; - err = tmc5041_read(dev, TMC5041_GSTAT, &gstat_value); + err = tmc5041_read(dev, TMC5XXX_GSTAT, &gstat_value); if (err != 0) { return -EIO; } @@ -647,8 +647,8 @@ static int tmc5041_stepper_init(const struct device *dev) LOG_DBG("Setting stall guard to %d with delay %d ms", stepper_config->sg_threshold, stepper_config->sg_velocity_check_interval_ms); - if (!IN_RANGE(stepper_config->sg_threshold, TMC5041_SG_MIN_VALUE, - TMC5041_SG_MAX_VALUE)) { + if (!IN_RANGE(stepper_config->sg_threshold, TMC5XXX_SG_MIN_VALUE, + TMC5XXX_SG_MAX_VALUE)) { LOG_ERR("Stallguard threshold out of range"); return -EINVAL; } @@ -657,7 +657,7 @@ static int tmc5041_stepper_init(const struct device *dev) err = tmc5041_write( stepper_config->controller, TMC5041_COOLCONF(stepper_config->index), - stall_guard_threshold << TMC5041_COOLCONF_SG2_THRESHOLD_VALUE_SHIFT); + stall_guard_threshold << TMC5XXX_COOLCONF_SG2_THRESHOLD_VALUE_SHIFT); if (err != 0) { return -EIO; } diff --git a/include/zephyr/drivers/stepper/stepper_trinamic.h b/include/zephyr/drivers/stepper/stepper_trinamic.h index d36707c14b0b0..6afe8c9292fdb 100644 --- a/include/zephyr/drivers/stepper/stepper_trinamic.h +++ b/include/zephyr/drivers/stepper/stepper_trinamic.h @@ -144,9 +144,9 @@ struct tmc_ramp_generator_data { .tzerowait = DT_PROP(node, tzerowait), \ .vcoolthrs = DT_PROP(node, vcoolthrs), \ .vhigh = DT_PROP(node, vhigh), \ - .iholdrun = (TMC5041_IRUN(DT_PROP(node, irun)) | \ - TMC5041_IHOLD(DT_PROP(node, ihold)) | \ - TMC5041_IHOLDDELAY(DT_PROP(node, iholddelay))), \ + .iholdrun = (TMC5XXX_IRUN(DT_PROP(node, irun)) | \ + TMC5XXX_IHOLD(DT_PROP(node, ihold)) | \ + TMC5XXX_IHOLDDELAY(DT_PROP(node, iholddelay))), \ } /** From 94a6ed68a19b23a86a328c793d4f13f76bad679b Mon Sep 17 00:00:00 2001 From: Fabrice DJIATSA Date: Fri, 15 Nov 2024 11:46:09 +0100 Subject: [PATCH 2783/4482] dts: arm: st: c0: add spi node in dtsi file - stm32cO11/31 share the same spi peripheral - include stm32_dma header to be able to configure spi with dma config macros (STM32_DMA_PERIPH_TX,...) in dts Signed-off-by: Fabrice DJIATSA --- dts/arm/st/c0/stm32c0.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dts/arm/st/c0/stm32c0.dtsi b/dts/arm/st/c0/stm32c0.dtsi index b605b7674e0f5..5c474e4a04986 100644 --- a/dts/arm/st/c0/stm32c0.dtsi +++ b/dts/arm/st/c0/stm32c0.dtsi @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -301,6 +302,16 @@ status = "disabled"; }; + spi1: spi@40013000 { + compatible = "st,stm32-spi-fifo", "st,stm32-spi"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x40013000 0x400>; + clocks = <&rcc STM32_CLOCK(APB1_2, 12U)>; + interrupts = <25 0>; + status = "disabled"; + }; + adc1: adc@40012400 { compatible = "st,stm32-adc"; reg = <0x40012400 0x400>; From 5b28751bf43337dff08635a32fdfb1e16855f976 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 15 Nov 2024 10:42:57 +0000 Subject: [PATCH 2784/4482] west.yml: MCUboot synchronization from upstream Update Zephyr fork of MCUboot to revision: eb942067989569f9cf319b087d0bb16b16effd86 Brings following Zephyr relevant fixes: - eb942067 Allow bootstrapping for multiple images - d59ae346 boot_serial: Support sha256, sha384 and sha512 - bcffc62c boot: bootutil: boot_record: Fix issue with saving image data - 099f4284 boot: zephyr: Add fallback for overhead calculation when auto fails - ab014436 boards: mcxn947_qspi: fix mcuboot partition allocation - bd7423d1 boot: zephyr: Add warning on default key file usage - a03c95f6 doc: remove repetition - 040fc42a boot/zephyr: Load image to RAM on single loader - 84c68ace boot/zephyr: Add CONFIG_SINGLE_APPLICATION_SLOT_RAM_LOAD - 77d911f4 boot/bootutil: Add MCUBOOT_SINGLE_APPLICATION_SLOT_RAM_LOAD mode - 0c721da7 boot/bootutil: Split RAM load code to its own file Signed-off-by: Jamie McCrae --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 6edfccef606c3..9d3e7c6ff0f00 100644 --- a/west.yml +++ b/west.yml @@ -285,7 +285,7 @@ manifest: groups: - crypto - name: mcuboot - revision: f74b77cf7808919837c0ed14c2ead3918c546349 + revision: eb942067989569f9cf319b087d0bb16b16effd86 path: bootloader/mcuboot groups: - bootloader From b478ffe2ef736930a64dda53ea0aa0a6f658a1a9 Mon Sep 17 00:00:00 2001 From: Jens Rehhoff Thomsen Date: Fri, 15 Nov 2024 10:47:22 +0100 Subject: [PATCH 2785/4482] Bluetooth: host: Fix bug in disconnected handling When disconnected only the first empty slot in the disconnected_handles array should be updated. Signed-off-by: Jens Rehhoff Thomsen --- subsys/bluetooth/host/hci_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 4606c8c9b1f1c..88eac980f0103 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -933,6 +933,8 @@ static void conn_handle_disconnected(uint16_t handle, uint8_t disconnect_reason) */ disconnected_handles[i] = ~BT_ACL_HANDLE_MASK | handle; disconnected_handles_reason[i] = disconnect_reason; + + return; } } } From 581c55496df13214ce08c9acb396bf52ebeab418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 15 Nov 2024 09:26:37 +0100 Subject: [PATCH 2786/4482] pm: device_runtime: Fix bitfields misuse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PM_DEVICE_FLAG_ISR_SAFE is an enum and it must be converted to a bit mask before masking with flags. Signed-off-by: Krzysztof Chruściński --- subsys/pm/device_runtime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/pm/device_runtime.c b/subsys/pm/device_runtime.c index c0c2ba79efb06..f719b4772eb2a 100644 --- a/subsys/pm/device_runtime.c +++ b/subsys/pm/device_runtime.c @@ -139,7 +139,7 @@ static int get_sync_locked(const struct device *dev) if (flags & BIT(PM_DEVICE_FLAG_PD_CLAIMED)) { const struct device *domain = PM_DOMAIN(&pm->base); - if (domain->pm_base->flags & PM_DEVICE_FLAG_ISR_SAFE) { + if (domain->pm_base->flags & BIT(PM_DEVICE_FLAG_ISR_SAFE)) { ret = pm_device_runtime_get(domain); if (ret < 0) { return ret; @@ -300,7 +300,7 @@ static int put_sync_locked(const struct device *dev) if (flags & BIT(PM_DEVICE_FLAG_PD_CLAIMED)) { const struct device *domain = PM_DOMAIN(&pm->base); - if (domain->pm_base->flags & PM_DEVICE_FLAG_ISR_SAFE) { + if (domain->pm_base->flags & BIT(PM_DEVICE_FLAG_ISR_SAFE)) { ret = put_sync_locked(domain); } else { ret = -EWOULDBLOCK; From 6056a9237f07986633dc48ac8bc9dac81001cdfc Mon Sep 17 00:00:00 2001 From: Piotr Kosycarz Date: Fri, 15 Nov 2024 07:39:00 +0100 Subject: [PATCH 2787/4482] soc: nordic: add configuration for nrf54h20 flpr core To properly execute erase, recover and reset. Signed-off-by: Piotr Kosycarz --- soc/nordic/soc.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/soc/nordic/soc.yml b/soc/nordic/soc.yml index 27db57b90995d..9879f82f61aa2 100644 --- a/soc/nordic/soc.yml +++ b/soc/nordic/soc.yml @@ -103,6 +103,7 @@ runners: - nrf54h20/cpuapp - nrf54h20/cpurad - nrf54h20/cpuppr + - nrf54h20/cpuflpr - qualifiers: - nrf9280/cpuapp - nrf9280/cpurad @@ -156,6 +157,7 @@ runners: - nrf54h20/cpuapp - nrf54h20/cpurad - nrf54h20/cpuppr + - nrf54h20/cpuflpr - qualifiers: - nrf9280/cpuapp - nrf9280/cpurad @@ -207,6 +209,7 @@ runners: - nrf54h20/cpuapp - nrf54h20/cpurad - nrf54h20/cpuppr + - nrf54h20/cpuflpr - qualifiers: - nrf9280/cpuapp - nrf9280/cpurad From b54f49cb8c1c6155859100d9af2106be0bea7fc4 Mon Sep 17 00:00:00 2001 From: Lingao Meng Date: Wed, 13 Nov 2024 16:08:42 +0800 Subject: [PATCH 2788/4482] Bluetooth: Mesh: Fix proxy advertising set sending Mesh messages When start to sending proxy advertising, will also process in send_pending_adv, but the bt_mesh_adv_get_by_tag will directly return buffer from bt_mesh_adv_queue or bt_mesh_relay_queue, which case mesh messages sent on different sets, can cause peer replay attack. Signed-off-by: Lingao Meng --- subsys/bluetooth/mesh/adv.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/subsys/bluetooth/mesh/adv.c b/subsys/bluetooth/mesh/adv.c index 7cc163ba8f8d0..2f406e52f9ac9 100644 --- a/subsys/bluetooth/mesh/adv.c +++ b/subsys/bluetooth/mesh/adv.c @@ -233,6 +233,11 @@ struct bt_mesh_adv *bt_mesh_adv_get_by_tag(enum bt_mesh_adv_tag_bit tags, k_time return k_fifo_get(&bt_mesh_relay_queue, timeout); } + if (IS_ENABLED(CONFIG_BT_MESH_ADV_EXT_GATT_SEPARATE) && + tags & BT_MESH_ADV_TAG_BIT_PROXY) { + return NULL; + } + return bt_mesh_adv_get(timeout); } From 918cbc5146bbb736e66c36db4ae8d2c6a3f15596 Mon Sep 17 00:00:00 2001 From: Djordje Nedic Date: Tue, 12 Nov 2024 00:49:55 +0100 Subject: [PATCH 2789/4482] soc: Move up SRAM definitions for stm32h56/7x This moves the SRAM definitions for STM32H56/7x chips up to the top level since they are common to all of them. Signed-off-by: Djordje Nedic --- dts/arm/st/h5/stm32h562.dtsi | 18 ++++++++++++++++++ dts/arm/st/h5/stm32h563Xi.dtsi | 18 ------------------ dts/arm/st/h5/stm32h573Xi.dtsi | 18 ------------------ 3 files changed, 18 insertions(+), 36 deletions(-) diff --git a/dts/arm/st/h5/stm32h562.dtsi b/dts/arm/st/h5/stm32h562.dtsi index ffdbc50638689..6ffb287593e39 100644 --- a/dts/arm/st/h5/stm32h562.dtsi +++ b/dts/arm/st/h5/stm32h562.dtsi @@ -57,6 +57,24 @@ }; }; + sram1: memory@20000000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x20000000 DT_SIZE_K(256)>; + zephyr,memory-region = "SRAM1"; + }; + + sram2: memory@20040000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x20040000 DT_SIZE_K(64)>; + zephyr,memory-region = "SRAM2"; + }; + + sram3: memory@20050000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x20050000 DT_SIZE_K(320)>; + zephyr,memory-region = "SRAM3"; + }; + backup_sram: memory@40036400 { reg = <0x40036400 DT_SIZE_K(4)>; }; diff --git a/dts/arm/st/h5/stm32h563Xi.dtsi b/dts/arm/st/h5/stm32h563Xi.dtsi index fa80a94828ac4..d6908b65e8ef1 100644 --- a/dts/arm/st/h5/stm32h563Xi.dtsi +++ b/dts/arm/st/h5/stm32h563Xi.dtsi @@ -8,24 +8,6 @@ #include / { - sram1: memory@20000000 { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x20000000 DT_SIZE_K(256)>; - zephyr,memory-region = "SRAM1"; - }; - - sram2: memory@20040000 { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x20040000 DT_SIZE_K(64)>; - zephyr,memory-region = "SRAM2"; - }; - - sram3: memory@20050000 { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x20050000 DT_SIZE_K(320)>; - zephyr,memory-region = "SRAM3"; - }; - soc { flash-controller@40022000 { flash0: flash@8000000 { diff --git a/dts/arm/st/h5/stm32h573Xi.dtsi b/dts/arm/st/h5/stm32h573Xi.dtsi index 3e4a8b0efcf06..1a61321a82aaa 100644 --- a/dts/arm/st/h5/stm32h573Xi.dtsi +++ b/dts/arm/st/h5/stm32h573Xi.dtsi @@ -7,24 +7,6 @@ #include / { - sram1: memory@20000000 { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x20000000 DT_SIZE_K(256)>; - zephyr,memory-region = "SRAM1"; - }; - - sram2: memory@20040000 { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x20040000 DT_SIZE_K(64)>; - zephyr,memory-region = "SRAM2"; - }; - - sram3: memory@20050000 { - compatible = "zephyr,memory-region", "mmio-sram"; - reg = <0x20050000 DT_SIZE_K(320)>; - zephyr,memory-region = "SRAM3"; - }; - soc { flash-controller@40022000 { flash0: flash@8000000 { From a40e9009703d4501ce645cd4ee39440299e9ac4a Mon Sep 17 00:00:00 2001 From: Yishai Jaffe Date: Mon, 11 Nov 2024 15:07:52 +0200 Subject: [PATCH 2790/4482] boards: stm32f4_disco: Add pwm leds Add four PWM leds for stm32f4_disco in order to run the samples/basic/fade_led application. Signed-off-by: Yishai Jaffe --- boards/st/stm32f4_disco/stm32f4_disco.dts | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/boards/st/stm32f4_disco/stm32f4_disco.dts b/boards/st/stm32f4_disco/stm32f4_disco.dts index 163612aaf0759..fdc52ed97842c 100644 --- a/boards/st/stm32f4_disco/stm32f4_disco.dts +++ b/boards/st/stm32f4_disco/stm32f4_disco.dts @@ -51,6 +51,26 @@ }; }; + pwmleds: pwmleds { + compatible = "pwm-leds"; + + orange_pwm_led: orange_pwm_led { + pwms = <&pwm4 2 PWM_USEC(100) PWM_POLARITY_NORMAL>; + }; + + green_pwm_led: green_pwm_led { + pwms = <&pwm4 1 PWM_USEC(100) PWM_POLARITY_NORMAL>; + }; + + red_pwm_led: red_pwm_led { + pwms = <&pwm4 3 PWM_USEC(100) PWM_POLARITY_NORMAL>; + }; + + blue_pwm_led: blue_pwm_led { + pwms = <&pwm4 4 PWM_USEC(100) PWM_POLARITY_NORMAL>; + }; + }; + aliases { led0 = &green_led_4; led1 = &orange_led_3; @@ -110,6 +130,16 @@ }; }; +&timers4 { + status = "okay"; + + pwm4: pwm { + status = "okay"; + pinctrl-0 = <&tim4_ch1_pd12 &tim4_ch2_pd13 &tim4_ch3_pd14 &tim4_ch4_pd15>; + pinctrl-names = "default"; + }; +}; + &rtc { clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>, <&rcc STM32_SRC_LSI RTC_SEL(2)>; From 8e017ebff3358d7e8f8ab405e2835c01f4d339e4 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Fri, 8 Nov 2024 17:59:42 +0100 Subject: [PATCH 2791/4482] tests: Bluetooth: Audio: Increase RX buf count for bsim The tests were using the default of 1 which is very low, especially when we might have multiple RX streams. Signed-off-by: Emil Gydesen --- tests/bsim/bluetooth/audio/prj.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/bsim/bluetooth/audio/prj.conf b/tests/bsim/bluetooth/audio/prj.conf index 87e99c270a9ae..9ca0a167b6182 100644 --- a/tests/bsim/bluetooth/audio/prj.conf +++ b/tests/bsim/bluetooth/audio/prj.conf @@ -42,10 +42,11 @@ CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT=1 CONFIG_BT_BAP_BROADCAST_SNK_SUBGROUP_COUNT=1 CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT=2 CONFIG_BT_ISO_PERIPHERAL=y -CONFIG_BT_ISO_TX_BUF_COUNT=4 CONFIG_BT_ISO_MAX_CHAN=4 CONFIG_BT_ISO_TX_MTU=310 +CONFIG_BT_ISO_TX_BUF_COUNT=4 CONFIG_BT_ISO_RX_MTU=310 +CONFIG_BT_ISO_RX_BUF_COUNT=4 CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n From 110c81f2f7a9fbd8e82781ed0be3373416e7d6f4 Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Tue, 5 Nov 2024 21:15:36 +0000 Subject: [PATCH 2792/4482] boards: others: add candleLight USB to CAN 2.0B adapter board Add support for the open-hardware candleLight USB to CAN 2.0B board. Signed-off-by: Henrik Brix Andersen --- boards/others/candlelight/Kconfig.candlelight | 5 + boards/others/candlelight/board.cmake | 8 ++ boards/others/candlelight/board.yml | 6 ++ boards/others/candlelight/candlelight.dts | 96 ++++++++++++++++++ boards/others/candlelight/candlelight.yaml | 15 +++ .../others/candlelight/candlelight_defconfig | 1 + .../others/candlelight/doc/candlelight.webp | Bin 0 -> 36286 bytes boards/others/candlelight/doc/index.rst | 65 ++++++++++++ 8 files changed, 196 insertions(+) create mode 100644 boards/others/candlelight/Kconfig.candlelight create mode 100644 boards/others/candlelight/board.cmake create mode 100644 boards/others/candlelight/board.yml create mode 100644 boards/others/candlelight/candlelight.dts create mode 100644 boards/others/candlelight/candlelight.yaml create mode 100644 boards/others/candlelight/candlelight_defconfig create mode 100644 boards/others/candlelight/doc/candlelight.webp create mode 100644 boards/others/candlelight/doc/index.rst diff --git a/boards/others/candlelight/Kconfig.candlelight b/boards/others/candlelight/Kconfig.candlelight new file mode 100644 index 0000000000000..e941cb7a47318 --- /dev/null +++ b/boards/others/candlelight/Kconfig.candlelight @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Henrik Brix Andersen +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_CANDLELIGHT + select SOC_STM32F072XB diff --git a/boards/others/candlelight/board.cmake b/boards/others/candlelight/board.cmake new file mode 100644 index 0000000000000..c383530f74c8a --- /dev/null +++ b/boards/others/candlelight/board.cmake @@ -0,0 +1,8 @@ +# Copyright (c) 2024 Henrik Brix Andersen +# SPDX-License-Identifier: Apache-2.0 + +board_runner_args(dfu-util "--pid=0483:df11" "--alt=0" "--dfuse") +board_runner_args(jlink "--device=STM32F072CB") + +include(${ZEPHYR_BASE}/boards/common/dfu-util.board.cmake) +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/others/candlelight/board.yml b/boards/others/candlelight/board.yml new file mode 100644 index 0000000000000..aaea4c39edbb5 --- /dev/null +++ b/boards/others/candlelight/board.yml @@ -0,0 +1,6 @@ +board: + name: candlelight + full_name: candleLight + vendor: others + socs: + - name: stm32f072xb diff --git a/boards/others/candlelight/candlelight.dts b/boards/others/candlelight/candlelight.dts new file mode 100644 index 0000000000000..ae1d7208615b9 --- /dev/null +++ b/boards/others/candlelight/candlelight.dts @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2024 Henrik Brix Andersen + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include + +/ { + model = "candleLight"; + compatible = "candlelight"; + + chosen { + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_partition; + zephyr,canbus = &can1; + }; + + aliases { + led0 = &led_rx; + led1 = &led_tx; + }; + + leds { + compatible = "gpio-leds"; + led_rx: led_rx { + gpios = <&gpioa 0 GPIO_ACTIVE_LOW>; + label = "LED RX"; + }; + led_tx: led_tx { + gpios = <&gpioa 1 GPIO_ACTIVE_LOW>; + label = "LED TX"; + }; + }; + + transceiver0: can-phy0 { + compatible = "nxp,tja1051", "can-transceiver-gpio"; + enable-gpios = <&gpioc 13 GPIO_ACTIVE_LOW>; + max-bitrate = <1000000>; + #phy-cells = <0>; + }; +}; + +&clk_hsi { + status = "okay"; + clock-frequency = ; +}; + +&pll { + prediv = <1>; + mul = <6>; + clocks = <&clk_hsi>; + status = "okay"; +}; + +&rcc { + clocks = <&pll>; + clock-frequency = ; + ahb-prescaler = <1>; + apb1-prescaler = <1>; +}; + +zephyr_udc0: &usb { + pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>; + pinctrl-names = "default"; + status = "okay"; +}; + +&can1 { + pinctrl-0 = <&can_rx_pb8 &can_tx_pb9>; + pinctrl-names = "default"; + phys = <&transceiver0>; + status = "okay"; +}; + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 DT_SIZE_K(48)>; + read-only; + }; + slot0_partition: partition@c000 { + label = "image-0"; + reg = <0x0000c000 DT_SIZE_K(80)>; + }; + }; +}; diff --git a/boards/others/candlelight/candlelight.yaml b/boards/others/candlelight/candlelight.yaml new file mode 100644 index 0000000000000..aaf11b3f9773d --- /dev/null +++ b/boards/others/candlelight/candlelight.yaml @@ -0,0 +1,15 @@ +identifier: candlelight +name: candleLight +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb +ram: 16 +flash: 128 +supported: + - can + - gpio + - usb_device + - usbd +vendor: others diff --git a/boards/others/candlelight/candlelight_defconfig b/boards/others/candlelight/candlelight_defconfig new file mode 100644 index 0000000000000..91c3c15b37d1e --- /dev/null +++ b/boards/others/candlelight/candlelight_defconfig @@ -0,0 +1 @@ +CONFIG_GPIO=y diff --git a/boards/others/candlelight/doc/candlelight.webp b/boards/others/candlelight/doc/candlelight.webp new file mode 100644 index 0000000000000000000000000000000000000000..e54d14a48314a3f082e1f5e0e60392d8c0292a74 GIT binary patch literal 36286 zcmaHR1CS=o*5=#hv^CSV?P=S#ZQFLwwC!ozc2C>3ZQJkmckk|h|Jc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Gdh@TagHuTfI3{2r~-kokhv zWWqi#^ub*oC(V)02Zqp5Y{6~#C815N?o?|^!F}0?x~58ysf>_hWLMsETQ#&if3f{E z)5zNc(0~AH%eS}eCZuAsIL=3QoB=^7B~%k3C>bFX2%vCc4zUzJ!}M$4gul3>n>cfA fPLEj{i9jNd2qXfDKqBz}2z*^{_>7~@jLXX>#s7HT literal 0 HcmV?d00001 diff --git a/boards/others/candlelight/doc/index.rst b/boards/others/candlelight/doc/index.rst new file mode 100644 index 0000000000000..ac61b2a5eed92 --- /dev/null +++ b/boards/others/candlelight/doc/index.rst @@ -0,0 +1,65 @@ +.. zephyr:board:: candlelight + +Overview +******** + +The candleLight is an open-hardware USB to CAN 2.0B adapter board available from a number of +sources. + +Hardware +******** + +The candleLight board is equipped with a STM32F072CB microcontroller and features an USB connector, +a DB-9M connector for the CAN bus, and two user LEDs. Schematics and component placement drawings +are available in the `candleLight GitHub repository`_. + +Supported Features +================== + +The ``candlelight`` board configuration supports the following hardware features: + ++-----------+------------+-------------------------------------+ +| Interface | Controller | Driver/Component | ++===========+============+=====================================+ +| NVIC | on-chip | nested vector interrupt controller | ++-----------+------------+-------------------------------------+ +| PINMUX | on-chip | pinmux | ++-----------+------------+-------------------------------------+ +| FLASH | on-chip | flash memory | ++-----------+------------+-------------------------------------+ +| GPIO | on-chip | gpio | ++-----------+------------+-------------------------------------+ +| USB | on-chip | USB | ++-----------+------------+-------------------------------------+ +| CAN1 | on-chip | CAN controller | ++-----------+------------+-------------------------------------+ + +The default configuration can be found in the defconfig file: +:zephyr_file:`boards/others/candlelight/candlelight_defconfig`. + +Other hardware features are not currently supported by the port. + +System Clock +============ + +The STM32F072CB PLL is driven by the internal RC oscillator (HSI) running at 8 MHz and +configured to provide a system clock of 48 MHz. + +Programming and Debugging +************************* + +Build and flash applications as usual (see :ref:`build_an_application` and +:ref:`application_run` for more details). + +If flashing via USB DFU, short resistor ``R203`` when applying power to the candleLight in order to +enter the built-in DFU mode. + +Here is an example for the :zephyr:code-sample:`blinky` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: candlelight + :goals: flash + +.. _candleLight GitHub repository: + https://github.com/HubertD/candleLight From c8938737c0d3d846cb304a0732b64a9dda0a26b9 Mon Sep 17 00:00:00 2001 From: Tri Nguyen Date: Fri, 18 Oct 2024 09:42:43 +0700 Subject: [PATCH 2793/4482] drivers: i2c: Support for RA6 devices Add devices node that support I2C for RA6 boards Signed-off-by: Tri Nguyen --- boards/renesas/ek_ra6m1/doc/index.rst | 2 ++ boards/renesas/ek_ra6m1/ek_ra6m1-pinctrl.dtsi | 9 +++++++++ boards/renesas/ek_ra6m1/ek_ra6m1.dts | 11 +++++++++++ boards/renesas/ek_ra6m2/doc/index.rst | 2 ++ boards/renesas/ek_ra6m2/ek_ra6m2-pinctrl.dtsi | 9 +++++++++ boards/renesas/ek_ra6m2/ek_ra6m2.dts | 11 +++++++++++ boards/renesas/ek_ra6m3/doc/index.rst | 2 ++ boards/renesas/ek_ra6m3/ek_ra6m3-pinctrl.dtsi | 9 +++++++++ boards/renesas/ek_ra6m3/ek_ra6m3.dts | 11 +++++++++++ boards/renesas/ek_ra6m4/doc/index.rst | 2 ++ boards/renesas/ek_ra6m4/ek_ra6m4-pinctrl.dtsi | 9 +++++++++ boards/renesas/ek_ra6m4/ek_ra6m4.dts | 11 +++++++++++ boards/renesas/ek_ra6m5/doc/index.rst | 2 ++ boards/renesas/ek_ra6m5/ek_ra6m5-pinctrl.dtsi | 9 +++++++++ boards/renesas/ek_ra6m5/ek_ra6m5.dts | 11 +++++++++++ boards/renesas/fpb_ra6e1/doc/index.rst | 2 ++ boards/renesas/fpb_ra6e1/fpb_ra6e1-pinctrl.dtsi | 9 +++++++++ boards/renesas/fpb_ra6e1/fpb_ra6e1.dts | 11 +++++++++++ dts/arm/renesas/ra/ra6/r7fa6m2ax.dtsi | 7 +++++++ dts/arm/renesas/ra/ra6/r7fa6m3ax.dtsi | 7 +++++++ dts/arm/renesas/ra/ra6/r7fa6m5xh.dtsi | 7 +++++++ dts/arm/renesas/ra/ra6/ra6-cm33-common.dtsi | 14 ++++++++++++++ dts/arm/renesas/ra/ra6/ra6-cm4-common.dtsi | 14 ++++++++++++++ tests/drivers/i2c/i2c_api/boards/ek_ra6m1.conf | 1 + tests/drivers/i2c/i2c_api/boards/ek_ra6m1.overlay | 6 ++++++ tests/drivers/i2c/i2c_api/boards/ek_ra6m2.conf | 1 + tests/drivers/i2c/i2c_api/boards/ek_ra6m2.overlay | 6 ++++++ tests/drivers/i2c/i2c_api/boards/ek_ra6m3.conf | 1 + tests/drivers/i2c/i2c_api/boards/ek_ra6m3.overlay | 6 ++++++ tests/drivers/i2c/i2c_api/boards/ek_ra6m4.conf | 1 + tests/drivers/i2c/i2c_api/boards/ek_ra6m4.overlay | 6 ++++++ tests/drivers/i2c/i2c_api/boards/ek_ra6m5.conf | 1 + tests/drivers/i2c/i2c_api/boards/ek_ra6m5.overlay | 6 ++++++ tests/drivers/i2c/i2c_api/boards/fpb_ra6e1.conf | 1 + tests/drivers/i2c/i2c_api/boards/fpb_ra6e1.overlay | 6 ++++++ 35 files changed, 223 insertions(+) create mode 100644 tests/drivers/i2c/i2c_api/boards/ek_ra6m1.conf create mode 100644 tests/drivers/i2c/i2c_api/boards/ek_ra6m1.overlay create mode 100644 tests/drivers/i2c/i2c_api/boards/ek_ra6m2.conf create mode 100644 tests/drivers/i2c/i2c_api/boards/ek_ra6m2.overlay create mode 100644 tests/drivers/i2c/i2c_api/boards/ek_ra6m3.conf create mode 100644 tests/drivers/i2c/i2c_api/boards/ek_ra6m3.overlay create mode 100644 tests/drivers/i2c/i2c_api/boards/ek_ra6m4.conf create mode 100644 tests/drivers/i2c/i2c_api/boards/ek_ra6m4.overlay create mode 100644 tests/drivers/i2c/i2c_api/boards/ek_ra6m5.conf create mode 100644 tests/drivers/i2c/i2c_api/boards/ek_ra6m5.overlay create mode 100644 tests/drivers/i2c/i2c_api/boards/fpb_ra6e1.conf create mode 100644 tests/drivers/i2c/i2c_api/boards/fpb_ra6e1.overlay diff --git a/boards/renesas/ek_ra6m1/doc/index.rst b/boards/renesas/ek_ra6m1/doc/index.rst index cb48f4f0c44f3..4682963502093 100644 --- a/boards/renesas/ek_ra6m1/doc/index.rst +++ b/boards/renesas/ek_ra6m1/doc/index.rst @@ -94,6 +94,8 @@ The below features are currently supported on Zephyr OS for EK-RA6M1 board: +-----------+------------+----------------------+ | CLOCK | on-chip | clock control | +-----------+------------+----------------------+ +| I2C | on-chip | i2c | ++-----------+------------+----------------------+ Other hardware features are currently not supported by the port. diff --git a/boards/renesas/ek_ra6m1/ek_ra6m1-pinctrl.dtsi b/boards/renesas/ek_ra6m1/ek_ra6m1-pinctrl.dtsi index 56fa3e26b6abb..6253efac01d1c 100644 --- a/boards/renesas/ek_ra6m1/ek_ra6m1-pinctrl.dtsi +++ b/boards/renesas/ek_ra6m1/ek_ra6m1-pinctrl.dtsi @@ -11,4 +11,13 @@ ; }; }; + + iic0_default: iic0_default { + group1 { + /* SCL0 SDA0 */ + psels = , + ; + drive-strength = "medium"; + }; + }; }; diff --git a/boards/renesas/ek_ra6m1/ek_ra6m1.dts b/boards/renesas/ek_ra6m1/ek_ra6m1.dts index 53fc329b0481f..3289a2dd69bec 100644 --- a/boards/renesas/ek_ra6m1/ek_ra6m1.dts +++ b/boards/renesas/ek_ra6m1/ek_ra6m1.dts @@ -44,6 +44,17 @@ }; }; +&iic0 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + interrupts = <91 1>, <92 1>, <93 1>, <94 1>; + interrupt-names = "rxi", "txi", "tei", "eri"; + clock-frequency = ; + pinctrl-0 = <&iic0_default>; + pinctrl-names = "default"; +}; + &ioport1 { status = "okay"; }; diff --git a/boards/renesas/ek_ra6m2/doc/index.rst b/boards/renesas/ek_ra6m2/doc/index.rst index a77b472c9fc6f..1324b155e9d7b 100644 --- a/boards/renesas/ek_ra6m2/doc/index.rst +++ b/boards/renesas/ek_ra6m2/doc/index.rst @@ -88,6 +88,8 @@ The below features are currently supported on Zephyr OS for EK-RA6M2 board: +-----------+------------+----------------------+ | CLOCK | on-chip | clock control | +-----------+------------+----------------------+ +| I2C | on-chip | i2c | ++-----------+------------+----------------------+ Other hardware features are currently not supported by the port. diff --git a/boards/renesas/ek_ra6m2/ek_ra6m2-pinctrl.dtsi b/boards/renesas/ek_ra6m2/ek_ra6m2-pinctrl.dtsi index 69d920e7edab6..42958e5da30f3 100644 --- a/boards/renesas/ek_ra6m2/ek_ra6m2-pinctrl.dtsi +++ b/boards/renesas/ek_ra6m2/ek_ra6m2-pinctrl.dtsi @@ -11,4 +11,13 @@ ; }; }; + + iic2_default: iic2_default { + group1 { + /* SCL2 SDA2 */ + psels = , + ; + drive-strength = "medium"; + }; + }; }; diff --git a/boards/renesas/ek_ra6m2/ek_ra6m2.dts b/boards/renesas/ek_ra6m2/ek_ra6m2.dts index d498d6448e5fc..5f3d1bcd17918 100644 --- a/boards/renesas/ek_ra6m2/ek_ra6m2.dts +++ b/boards/renesas/ek_ra6m2/ek_ra6m2.dts @@ -44,6 +44,17 @@ }; }; +&iic2 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + interrupts = <91 1>, <92 1>, <93 1>, <94 1>; + interrupt-names = "rxi", "txi", "tei", "eri"; + clock-frequency = ; + pinctrl-0 = <&iic2_default>; + pinctrl-names = "default"; +}; + &ioport1 { status = "okay"; }; diff --git a/boards/renesas/ek_ra6m3/doc/index.rst b/boards/renesas/ek_ra6m3/doc/index.rst index ff6661ba05d71..223314ac795ac 100644 --- a/boards/renesas/ek_ra6m3/doc/index.rst +++ b/boards/renesas/ek_ra6m3/doc/index.rst @@ -96,6 +96,8 @@ The below features are currently supported on Zephyr OS for EK-RA6M3 board: +-----------+------------+----------------------+ | CLOCK | on-chip | clock control | +-----------+------------+----------------------+ +| I2C | on-chip | i2c | ++-----------+------------+----------------------+ Other hardware features are currently not supported by the port. diff --git a/boards/renesas/ek_ra6m3/ek_ra6m3-pinctrl.dtsi b/boards/renesas/ek_ra6m3/ek_ra6m3-pinctrl.dtsi index 56fa3e26b6abb..15881d0409639 100644 --- a/boards/renesas/ek_ra6m3/ek_ra6m3-pinctrl.dtsi +++ b/boards/renesas/ek_ra6m3/ek_ra6m3-pinctrl.dtsi @@ -11,4 +11,13 @@ ; }; }; + + iic2_default: iic2_default { + group1 { + /* SCL2 SDA2 */ + psels = , + ; + drive-strength = "medium"; + }; + }; }; diff --git a/boards/renesas/ek_ra6m3/ek_ra6m3.dts b/boards/renesas/ek_ra6m3/ek_ra6m3.dts index 141292d9f7e06..a1150cd3a668c 100644 --- a/boards/renesas/ek_ra6m3/ek_ra6m3.dts +++ b/boards/renesas/ek_ra6m3/ek_ra6m3.dts @@ -60,6 +60,17 @@ }; }; +&iic2 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + interrupts = <91 1>, <92 1>, <93 1>, <94 1>; + interrupt-names = "rxi", "txi", "tei", "eri"; + clock-frequency = ; + pinctrl-0 = <&iic2_default>; + pinctrl-names = "default"; +}; + &xtal { clock-frequency = ; mosel = <0>; diff --git a/boards/renesas/ek_ra6m4/doc/index.rst b/boards/renesas/ek_ra6m4/doc/index.rst index 6c849762c07a1..0256eec806db0 100644 --- a/boards/renesas/ek_ra6m4/doc/index.rst +++ b/boards/renesas/ek_ra6m4/doc/index.rst @@ -101,6 +101,8 @@ The below features are currently supported on Zephyr OS for EK-RA6M4 board: +-----------+------------+----------------------+ | CLOCK | on-chip | clock control | +-----------+------------+----------------------+ +| I2C | on-chip | i2c | ++-----------+------------+----------------------+ Other hardware features are currently not supported by the port. diff --git a/boards/renesas/ek_ra6m4/ek_ra6m4-pinctrl.dtsi b/boards/renesas/ek_ra6m4/ek_ra6m4-pinctrl.dtsi index 851d8543beea0..e7501c7dcbcfd 100644 --- a/boards/renesas/ek_ra6m4/ek_ra6m4-pinctrl.dtsi +++ b/boards/renesas/ek_ra6m4/ek_ra6m4-pinctrl.dtsi @@ -11,4 +11,13 @@ ; }; }; + + iic1_default: iic1_default { + group1 { + /* SCL1 SDA1 */ + psels = , + ; + drive-strength = "medium"; + }; + }; }; diff --git a/boards/renesas/ek_ra6m4/ek_ra6m4.dts b/boards/renesas/ek_ra6m4/ek_ra6m4.dts index 866232d5c7fab..10ed42ab5eac7 100644 --- a/boards/renesas/ek_ra6m4/ek_ra6m4.dts +++ b/boards/renesas/ek_ra6m4/ek_ra6m4.dts @@ -52,6 +52,17 @@ }; }; +&iic1 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + interrupts = <91 1>, <92 1>, <93 1>, <94 1>; + interrupt-names = "rxi", "txi", "tei", "eri"; + clock-frequency = ; + pinctrl-0 = <&iic1_default>; + pinctrl-names = "default"; +}; + &ioport4 { status = "okay"; }; diff --git a/boards/renesas/ek_ra6m5/doc/index.rst b/boards/renesas/ek_ra6m5/doc/index.rst index 9612de9c1a2cf..45269bda8eef4 100644 --- a/boards/renesas/ek_ra6m5/doc/index.rst +++ b/boards/renesas/ek_ra6m5/doc/index.rst @@ -99,6 +99,8 @@ The below features are currently supported on Zephyr OS for EK-RA6M5 board: +-----------+------------+----------------------+ | CLOCK | on-chip | clock control | +-----------+------------+----------------------+ +| I2C | on-chip | i2c | ++-----------+------------+----------------------+ Other hardware features are currently not supported by the port. diff --git a/boards/renesas/ek_ra6m5/ek_ra6m5-pinctrl.dtsi b/boards/renesas/ek_ra6m5/ek_ra6m5-pinctrl.dtsi index 851d8543beea0..e7501c7dcbcfd 100644 --- a/boards/renesas/ek_ra6m5/ek_ra6m5-pinctrl.dtsi +++ b/boards/renesas/ek_ra6m5/ek_ra6m5-pinctrl.dtsi @@ -11,4 +11,13 @@ ; }; }; + + iic1_default: iic1_default { + group1 { + /* SCL1 SDA1 */ + psels = , + ; + drive-strength = "medium"; + }; + }; }; diff --git a/boards/renesas/ek_ra6m5/ek_ra6m5.dts b/boards/renesas/ek_ra6m5/ek_ra6m5.dts index 3cb4ebe3ba59c..bd8245701d6a0 100644 --- a/boards/renesas/ek_ra6m5/ek_ra6m5.dts +++ b/boards/renesas/ek_ra6m5/ek_ra6m5.dts @@ -52,6 +52,17 @@ }; }; +&iic1 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + interrupts = <91 1>, <92 1>, <93 1>, <94 1>; + interrupt-names = "rxi", "txi", "tei", "eri"; + clock-frequency = ; + pinctrl-0 = <&iic1_default>; + pinctrl-names = "default"; +}; + &ioport0 { status = "okay"; }; diff --git a/boards/renesas/fpb_ra6e1/doc/index.rst b/boards/renesas/fpb_ra6e1/doc/index.rst index 193429976b99d..8f5849b6b1c97 100644 --- a/boards/renesas/fpb_ra6e1/doc/index.rst +++ b/boards/renesas/fpb_ra6e1/doc/index.rst @@ -83,6 +83,8 @@ The below features are currently supported on Zephyr OS for FPB-RA6E1 board: +-----------+------------+----------------------+ | FLASH | on-chip | flash | +-----------+------------+----------------------+ +| I2C | on-chip | i2c | ++-----------+------------+----------------------+ Other hardware features are currently not supported by the port. diff --git a/boards/renesas/fpb_ra6e1/fpb_ra6e1-pinctrl.dtsi b/boards/renesas/fpb_ra6e1/fpb_ra6e1-pinctrl.dtsi index 3c01cb6bec4cf..ee5bb639c5d4b 100644 --- a/boards/renesas/fpb_ra6e1/fpb_ra6e1-pinctrl.dtsi +++ b/boards/renesas/fpb_ra6e1/fpb_ra6e1-pinctrl.dtsi @@ -11,4 +11,13 @@ ; }; }; + + iic0_default: iic0_default { + group1 { + /* SCL0 SDA0 */ + psels = , + ; + drive-strength = "medium"; + }; + }; }; diff --git a/boards/renesas/fpb_ra6e1/fpb_ra6e1.dts b/boards/renesas/fpb_ra6e1/fpb_ra6e1.dts index 2efab7438b50d..8eb971a83864a 100644 --- a/boards/renesas/fpb_ra6e1/fpb_ra6e1.dts +++ b/boards/renesas/fpb_ra6e1/fpb_ra6e1.dts @@ -48,6 +48,17 @@ }; }; +&iic0 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + interrupts = <91 1>, <92 1>, <93 1>, <94 1>; + interrupt-names = "rxi", "txi", "tei", "eri"; + clock-frequency = ; + pinctrl-0 = <&iic0_default>; + pinctrl-names = "default"; +}; + &ioport4 { status = "okay"; }; diff --git a/dts/arm/renesas/ra/ra6/r7fa6m2ax.dtsi b/dts/arm/renesas/ra/ra6/r7fa6m2ax.dtsi index db5488f79f2a0..b1f93eed62e40 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6m2ax.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6m2ax.dtsi @@ -55,6 +55,13 @@ status = "disabled"; }; }; + + iic2: iic2@40053200 { + compatible = "renesas,ra-iic"; + channel = <2>; + reg = <0x40053200 0x100>; + status = "disabled"; + }; }; clocks: clocks { diff --git a/dts/arm/renesas/ra/ra6/r7fa6m3ax.dtsi b/dts/arm/renesas/ra/ra6/r7fa6m3ax.dtsi index 0e233cd7d6fe4..1dbb4385519c6 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6m3ax.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6m3ax.dtsi @@ -95,6 +95,13 @@ status = "disabled"; }; }; + + iic2: iic2@40053200 { + compatible = "renesas,ra-iic"; + channel = <2>; + reg = <0x40053200 0x100>; + status = "disabled"; + }; }; clocks: clocks { diff --git a/dts/arm/renesas/ra/ra6/r7fa6m5xh.dtsi b/dts/arm/renesas/ra/ra6/r7fa6m5xh.dtsi index e266560fb5ff1..742d8cfc23468 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6m5xh.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6m5xh.dtsi @@ -185,6 +185,13 @@ status = "disabled"; }; }; + + iic2: iic2@4009f200 { + compatible = "renesas,ra-iic"; + channel = <2>; + reg = <0x4009f200 0x100>; + status = "disabled"; + }; }; clocks: clocks { diff --git a/dts/arm/renesas/ra/ra6/ra6-cm33-common.dtsi b/dts/arm/renesas/ra/ra6/ra6-cm33-common.dtsi index 2f9a4f0364029..cef49abbb2f05 100644 --- a/dts/arm/renesas/ra/ra6/ra6-cm33-common.dtsi +++ b/dts/arm/renesas/ra/ra6/ra6-cm33-common.dtsi @@ -132,6 +132,20 @@ }; }; + iic0: iic0@4009f000 { + compatible = "renesas,ra-iic"; + channel = <0>; + reg = <0x4009f000 0x100>; + status = "disabled"; + }; + + iic1: iic1@4009f100 { + compatible = "renesas,ra-iic"; + channel = <1>; + reg = <0x4009f100 0x100>; + status = "disabled"; + }; + option_setting_ofs: option_setting_ofs@100a100 { compatible = "zephyr,memory-region"; reg = <0x0100a100 0x18>; diff --git a/dts/arm/renesas/ra/ra6/ra6-cm4-common.dtsi b/dts/arm/renesas/ra/ra6/ra6-cm4-common.dtsi index f28cbaafa6ecd..6b90846268e4b 100644 --- a/dts/arm/renesas/ra/ra6/ra6-cm4-common.dtsi +++ b/dts/arm/renesas/ra/ra6/ra6-cm4-common.dtsi @@ -221,6 +221,20 @@ }; }; + iic0: iic0@40053000 { + compatible = "renesas,ra-iic"; + channel = <0>; + reg = <0x40053000 0x100>; + status = "disabled"; + }; + + iic1: iic1@40053100 { + compatible = "renesas,ra-iic"; + channel = <1>; + reg = <0x40053100 0x100>; + status = "disabled"; + }; + id_code: id_code@100a150 { compatible = "zephyr,memory-region"; reg = <0x0100a150 0x10>; diff --git a/tests/drivers/i2c/i2c_api/boards/ek_ra6m1.conf b/tests/drivers/i2c/i2c_api/boards/ek_ra6m1.conf new file mode 100644 index 0000000000000..83547b4fe7250 --- /dev/null +++ b/tests/drivers/i2c/i2c_api/boards/ek_ra6m1.conf @@ -0,0 +1 @@ +CONFIG_SENSOR_GY271_QMC=y diff --git a/tests/drivers/i2c/i2c_api/boards/ek_ra6m1.overlay b/tests/drivers/i2c/i2c_api/boards/ek_ra6m1.overlay new file mode 100644 index 0000000000000..cce5441d28ee7 --- /dev/null +++ b/tests/drivers/i2c/i2c_api/boards/ek_ra6m1.overlay @@ -0,0 +1,6 @@ +/ { + aliases { + i2c-0 = &iic0; + gy271 = &iic0; + }; +}; diff --git a/tests/drivers/i2c/i2c_api/boards/ek_ra6m2.conf b/tests/drivers/i2c/i2c_api/boards/ek_ra6m2.conf new file mode 100644 index 0000000000000..83547b4fe7250 --- /dev/null +++ b/tests/drivers/i2c/i2c_api/boards/ek_ra6m2.conf @@ -0,0 +1 @@ +CONFIG_SENSOR_GY271_QMC=y diff --git a/tests/drivers/i2c/i2c_api/boards/ek_ra6m2.overlay b/tests/drivers/i2c/i2c_api/boards/ek_ra6m2.overlay new file mode 100644 index 0000000000000..76dd12b4be75e --- /dev/null +++ b/tests/drivers/i2c/i2c_api/boards/ek_ra6m2.overlay @@ -0,0 +1,6 @@ +/ { + aliases { + i2c-0 = &iic2; + gy271 = &iic2; + }; +}; diff --git a/tests/drivers/i2c/i2c_api/boards/ek_ra6m3.conf b/tests/drivers/i2c/i2c_api/boards/ek_ra6m3.conf new file mode 100644 index 0000000000000..83547b4fe7250 --- /dev/null +++ b/tests/drivers/i2c/i2c_api/boards/ek_ra6m3.conf @@ -0,0 +1 @@ +CONFIG_SENSOR_GY271_QMC=y diff --git a/tests/drivers/i2c/i2c_api/boards/ek_ra6m3.overlay b/tests/drivers/i2c/i2c_api/boards/ek_ra6m3.overlay new file mode 100644 index 0000000000000..76dd12b4be75e --- /dev/null +++ b/tests/drivers/i2c/i2c_api/boards/ek_ra6m3.overlay @@ -0,0 +1,6 @@ +/ { + aliases { + i2c-0 = &iic2; + gy271 = &iic2; + }; +}; diff --git a/tests/drivers/i2c/i2c_api/boards/ek_ra6m4.conf b/tests/drivers/i2c/i2c_api/boards/ek_ra6m4.conf new file mode 100644 index 0000000000000..83547b4fe7250 --- /dev/null +++ b/tests/drivers/i2c/i2c_api/boards/ek_ra6m4.conf @@ -0,0 +1 @@ +CONFIG_SENSOR_GY271_QMC=y diff --git a/tests/drivers/i2c/i2c_api/boards/ek_ra6m4.overlay b/tests/drivers/i2c/i2c_api/boards/ek_ra6m4.overlay new file mode 100644 index 0000000000000..a78cf1911b810 --- /dev/null +++ b/tests/drivers/i2c/i2c_api/boards/ek_ra6m4.overlay @@ -0,0 +1,6 @@ +/ { + aliases { + i2c-0 = &iic1; + gy271 = &iic1; + }; +}; diff --git a/tests/drivers/i2c/i2c_api/boards/ek_ra6m5.conf b/tests/drivers/i2c/i2c_api/boards/ek_ra6m5.conf new file mode 100644 index 0000000000000..83547b4fe7250 --- /dev/null +++ b/tests/drivers/i2c/i2c_api/boards/ek_ra6m5.conf @@ -0,0 +1 @@ +CONFIG_SENSOR_GY271_QMC=y diff --git a/tests/drivers/i2c/i2c_api/boards/ek_ra6m5.overlay b/tests/drivers/i2c/i2c_api/boards/ek_ra6m5.overlay new file mode 100644 index 0000000000000..a78cf1911b810 --- /dev/null +++ b/tests/drivers/i2c/i2c_api/boards/ek_ra6m5.overlay @@ -0,0 +1,6 @@ +/ { + aliases { + i2c-0 = &iic1; + gy271 = &iic1; + }; +}; diff --git a/tests/drivers/i2c/i2c_api/boards/fpb_ra6e1.conf b/tests/drivers/i2c/i2c_api/boards/fpb_ra6e1.conf new file mode 100644 index 0000000000000..83547b4fe7250 --- /dev/null +++ b/tests/drivers/i2c/i2c_api/boards/fpb_ra6e1.conf @@ -0,0 +1 @@ +CONFIG_SENSOR_GY271_QMC=y diff --git a/tests/drivers/i2c/i2c_api/boards/fpb_ra6e1.overlay b/tests/drivers/i2c/i2c_api/boards/fpb_ra6e1.overlay new file mode 100644 index 0000000000000..cce5441d28ee7 --- /dev/null +++ b/tests/drivers/i2c/i2c_api/boards/fpb_ra6e1.overlay @@ -0,0 +1,6 @@ +/ { + aliases { + i2c-0 = &iic0; + gy271 = &iic0; + }; +}; From 8e46d261061fcaf899a26b351f62026b5c8f5c16 Mon Sep 17 00:00:00 2001 From: Khoa Nguyen Date: Mon, 26 Aug 2024 14:56:13 +0700 Subject: [PATCH 2794/4482] drivers: i2c: Add config I2C for EK-RA8D1 and MCK-RA8T1 Add config support I2C for EK-RA8D1 and MCK-RA8T1. Signed-off-by: Khoa Nguyen --- boards/renesas/ek_ra8d1/doc/index.rst | 2 ++ boards/renesas/ek_ra8d1/ek_ra8d1-pinctrl.dtsi | 8 ++++++++ boards/renesas/ek_ra8d1/ek_ra8d1.dts | 8 ++++++++ boards/renesas/mck_ra8t1/doc/index.rst | 2 ++ boards/renesas/mck_ra8t1/mck_ra8t1-pinctrl.dtsi | 8 ++++++++ boards/renesas/mck_ra8t1/mck_ra8t1.dts | 8 ++++++++ tests/drivers/i2c/i2c_api/boards/ek_ra8d1.conf | 1 + tests/drivers/i2c/i2c_api/boards/ek_ra8d1.overlay | 15 +++++++++++++++ tests/drivers/i2c/i2c_api/boards/mck_ra8t1.conf | 1 + .../drivers/i2c/i2c_api/boards/mck_ra8t1.overlay | 15 +++++++++++++++ 10 files changed, 68 insertions(+) create mode 100644 tests/drivers/i2c/i2c_api/boards/ek_ra8d1.conf create mode 100644 tests/drivers/i2c/i2c_api/boards/ek_ra8d1.overlay create mode 100644 tests/drivers/i2c/i2c_api/boards/mck_ra8t1.conf create mode 100644 tests/drivers/i2c/i2c_api/boards/mck_ra8t1.overlay diff --git a/boards/renesas/ek_ra8d1/doc/index.rst b/boards/renesas/ek_ra8d1/doc/index.rst index a56e8869c334d..20c887373c8ee 100644 --- a/boards/renesas/ek_ra8d1/doc/index.rst +++ b/boards/renesas/ek_ra8d1/doc/index.rst @@ -110,6 +110,8 @@ The below features are currently supported on Zephyr OS for EK-RA8D1 board: +--------------+------------+------------------+ | CAN | on-chip | canfd | +--------------+------------+------------------+ +| I2C | on-chip | i2c | ++--------------+------------+------------------+ Other hardware features are currently not supported by the port. diff --git a/boards/renesas/ek_ra8d1/ek_ra8d1-pinctrl.dtsi b/boards/renesas/ek_ra8d1/ek_ra8d1-pinctrl.dtsi index 7893b7df6ce73..b450f9c339319 100644 --- a/boards/renesas/ek_ra8d1/ek_ra8d1-pinctrl.dtsi +++ b/boards/renesas/ek_ra8d1/ek_ra8d1-pinctrl.dtsi @@ -45,4 +45,12 @@ drive-strength = "high"; }; }; + + iic1_default: iic1_default { + group1 { + /* SCL1 SDA1*/ + psels = ,; + drive-strength = "medium"; + }; + }; }; diff --git a/boards/renesas/ek_ra8d1/ek_ra8d1.dts b/boards/renesas/ek_ra8d1/ek_ra8d1.dts index 6f189fe7d1138..82eb5f3b43e5b 100644 --- a/boards/renesas/ek_ra8d1/ek_ra8d1.dts +++ b/boards/renesas/ek_ra8d1/ek_ra8d1.dts @@ -152,3 +152,11 @@ status = "okay"; }; }; + +&iic1 { + #address-cells = <1>; + #size-cells = <0>; + clock-frequency = ; + pinctrl-0 = <&iic1_default>; + pinctrl-names = "default"; +}; diff --git a/boards/renesas/mck_ra8t1/doc/index.rst b/boards/renesas/mck_ra8t1/doc/index.rst index 4e24da06e38d2..eeda35fceaf01 100644 --- a/boards/renesas/mck_ra8t1/doc/index.rst +++ b/boards/renesas/mck_ra8t1/doc/index.rst @@ -108,6 +108,8 @@ The below features are currently supported on Zephyr OS for MCB-RA8T1 board: +--------------+------------+----------------------+ | CAN | on-chip | canfd | +--------------+------------+----------------------+ +| I2C | on-chip | i2c | ++--------------+------------+----------------------+ Other hardware features are currently not supported by the port. diff --git a/boards/renesas/mck_ra8t1/mck_ra8t1-pinctrl.dtsi b/boards/renesas/mck_ra8t1/mck_ra8t1-pinctrl.dtsi index b5528917be5c3..63903204f4481 100644 --- a/boards/renesas/mck_ra8t1/mck_ra8t1-pinctrl.dtsi +++ b/boards/renesas/mck_ra8t1/mck_ra8t1-pinctrl.dtsi @@ -45,4 +45,12 @@ drive-strength = "high"; }; }; + + iic1_default: iic1_default { + group1 { + /* SCL1 SDA1*/ + psels = ,; + drive-strength = "medium"; + }; + }; }; diff --git a/boards/renesas/mck_ra8t1/mck_ra8t1.dts b/boards/renesas/mck_ra8t1/mck_ra8t1.dts index 1866767f6748c..19f46abcddce4 100644 --- a/boards/renesas/mck_ra8t1/mck_ra8t1.dts +++ b/boards/renesas/mck_ra8t1/mck_ra8t1.dts @@ -145,3 +145,11 @@ status = "okay"; }; }; + +&iic1 { + #address-cells = <1>; + #size-cells = <0>; + clock-frequency = ; + pinctrl-0 = <&iic1_default>; + pinctrl-names = "default"; +}; diff --git a/tests/drivers/i2c/i2c_api/boards/ek_ra8d1.conf b/tests/drivers/i2c/i2c_api/boards/ek_ra8d1.conf new file mode 100644 index 0000000000000..83547b4fe7250 --- /dev/null +++ b/tests/drivers/i2c/i2c_api/boards/ek_ra8d1.conf @@ -0,0 +1 @@ +CONFIG_SENSOR_GY271_QMC=y diff --git a/tests/drivers/i2c/i2c_api/boards/ek_ra8d1.overlay b/tests/drivers/i2c/i2c_api/boards/ek_ra8d1.overlay new file mode 100644 index 0000000000000..c310c97d70bfa --- /dev/null +++ b/tests/drivers/i2c/i2c_api/boards/ek_ra8d1.overlay @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2024 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + aliases { + i2c-0 = &iic1; + gy271 = &iic1; + }; +}; + +&iic1 { + status = "okay"; +}; diff --git a/tests/drivers/i2c/i2c_api/boards/mck_ra8t1.conf b/tests/drivers/i2c/i2c_api/boards/mck_ra8t1.conf new file mode 100644 index 0000000000000..83547b4fe7250 --- /dev/null +++ b/tests/drivers/i2c/i2c_api/boards/mck_ra8t1.conf @@ -0,0 +1 @@ +CONFIG_SENSOR_GY271_QMC=y diff --git a/tests/drivers/i2c/i2c_api/boards/mck_ra8t1.overlay b/tests/drivers/i2c/i2c_api/boards/mck_ra8t1.overlay new file mode 100644 index 0000000000000..c310c97d70bfa --- /dev/null +++ b/tests/drivers/i2c/i2c_api/boards/mck_ra8t1.overlay @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2024 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + aliases { + i2c-0 = &iic1; + gy271 = &iic1; + }; +}; + +&iic1 { + status = "okay"; +}; From b070da7c33f31fcc52446e127a1717db4cf2eb10 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Mon, 14 Oct 2024 20:28:51 -0500 Subject: [PATCH 2795/4482] dts: nxp,mcux-edma: Convert compats to prop Convert the numerous revision compatibles to a DT property for the revision called nxp,version (inspired from a linux DT property from st called st,version on their DMA). Signed-off-by: Declan Snyder --- drivers/dma/Kconfig.mcux_edma | 9 ++++++--- drivers/dma/dma_mcux_edma.c | 10 ++-------- dts/arm/nxp/nxp_k6x.dtsi | 1 + dts/arm/nxp/nxp_k8x.dtsi | 1 + dts/arm/nxp/nxp_ke1xf.dtsi | 1 + dts/arm/nxp/nxp_ke1xz.dtsi | 1 + dts/arm/nxp/nxp_mcxn23x_common.dtsi | 6 ++++-- dts/arm/nxp/nxp_mcxn94x_common.dtsi | 6 ++++-- dts/arm/nxp/nxp_rt10xx.dtsi | 1 + dts/arm/nxp/nxp_rt11xx.dtsi | 2 ++ dts/arm/nxp/nxp_s32k344_m7.dtsi | 3 ++- dts/bindings/dma/nxp,mcux-edma-v3.yaml | 14 -------------- dts/bindings/dma/nxp,mcux-edma-v4.yaml | 14 -------------- dts/bindings/dma/nxp,mcux-edma.yaml | 14 ++++++++++++++ 14 files changed, 39 insertions(+), 44 deletions(-) delete mode 100644 dts/bindings/dma/nxp,mcux-edma-v3.yaml delete mode 100644 dts/bindings/dma/nxp,mcux-edma-v4.yaml diff --git a/drivers/dma/Kconfig.mcux_edma b/drivers/dma/Kconfig.mcux_edma index 4a618aa9f7ac7..d6bd7b42cdfb4 100644 --- a/drivers/dma/Kconfig.mcux_edma +++ b/drivers/dma/Kconfig.mcux_edma @@ -3,10 +3,13 @@ # Copyright (c) 2020, NXP # SPDX-License-Identifier: Apache-2.0 +EDMA_COMPAT := $(DT_COMPAT_NXP_MCUX_EDMA) +REV_PROP := nxp,version + config DMA_MCUX_EDMA bool "MCUX DMA driver" default y - depends on DT_HAS_NXP_MCUX_EDMA_ENABLED + depends on $(dt_compat_any_has_prop,$(EDMA_COMPAT),$(REV_PROP),2) imply NOCACHE_MEMORY if HAS_MCUX_CACHE help DMA driver for MCUX series SoCs. @@ -14,14 +17,14 @@ config DMA_MCUX_EDMA config DMA_MCUX_EDMA_V3 bool "MCUX DMA v3 driver" default y - depends on DT_HAS_NXP_MCUX_EDMA_V3_ENABLED + depends on $(dt_compat_any_has_prop,$(EDMA_COMPAT),$(REV_PROP),3) help DMA version 3 driver for MCUX series SoCs. config DMA_MCUX_EDMA_V4 bool "MCUX DMA v4 driver" default y - depends on DT_HAS_NXP_MCUX_EDMA_V4_ENABLED + depends on $(dt_compat_any_has_prop,$(EDMA_COMPAT),$(REV_PROP),4) help DMA version 4 driver for MCUX series SoCs. diff --git a/drivers/dma/dma_mcux_edma.c b/drivers/dma/dma_mcux_edma.c index 432a913e6fa97..5c9cbcf40df7a 100644 --- a/drivers/dma/dma_mcux_edma.c +++ b/drivers/dma/dma_mcux_edma.c @@ -8,6 +8,8 @@ * @brief Common part of DMA drivers for imx rt series. */ +#define DT_DRV_COMPAT nxp_mcux_edma + #include #include #include @@ -23,14 +25,6 @@ #include #include -#ifdef CONFIG_DMA_MCUX_EDMA -#define DT_DRV_COMPAT nxp_mcux_edma -#elif CONFIG_DMA_MCUX_EDMA_V3 -#define DT_DRV_COMPAT nxp_mcux_edma_v3 -#elif CONFIG_DMA_MCUX_EDMA_V4 -#define DT_DRV_COMPAT nxp_mcux_edma_v4 -#endif - LOG_MODULE_REGISTER(dma_mcux_edma, CONFIG_DMA_LOG_LEVEL); #define HAS_CHANNEL_GAP(n) DT_INST_NODE_HAS_PROP(n, channel_gap) || diff --git a/dts/arm/nxp/nxp_k6x.dtsi b/dts/arm/nxp/nxp_k6x.dtsi index bd77e437487c4..38c8dfe0517a0 100644 --- a/dts/arm/nxp/nxp_k6x.dtsi +++ b/dts/arm/nxp/nxp_k6x.dtsi @@ -522,6 +522,7 @@ edma0: dma-controller@40008000 { #dma-cells = <2>; compatible = "nxp,mcux-edma"; + nxp,version = <2>; dma-channels = <16>; dma-requests = <64>; nxp,mem2mem; diff --git a/dts/arm/nxp/nxp_k8x.dtsi b/dts/arm/nxp/nxp_k8x.dtsi index a510710f51968..aeb747add09c5 100644 --- a/dts/arm/nxp/nxp_k8x.dtsi +++ b/dts/arm/nxp/nxp_k8x.dtsi @@ -427,6 +427,7 @@ edma0: dma-controller@40008000 { #dma-cells = <2>; compatible = "nxp,mcux-edma"; + nxp,version = <2>; dma-channels = <16>; dma-requests = <64>; nxp,mem2mem; diff --git a/dts/arm/nxp/nxp_ke1xf.dtsi b/dts/arm/nxp/nxp_ke1xf.dtsi index 8c880c06dafdc..c6280351ca36f 100644 --- a/dts/arm/nxp/nxp_ke1xf.dtsi +++ b/dts/arm/nxp/nxp_ke1xf.dtsi @@ -99,6 +99,7 @@ soc { edma: dma-controller@40008000 { compatible = "nxp,mcux-edma"; + nxp,version = <2>; dma-channels = <16>; dma-requests = <64>; nxp,mem2mem; diff --git a/dts/arm/nxp/nxp_ke1xz.dtsi b/dts/arm/nxp/nxp_ke1xz.dtsi index 8e34d56484570..6268ffb9aa464 100644 --- a/dts/arm/nxp/nxp_ke1xz.dtsi +++ b/dts/arm/nxp/nxp_ke1xz.dtsi @@ -443,6 +443,7 @@ edma: dma-controller@40008000 { compatible = "nxp,mcux-edma"; + nxp,version = <2>; dma-channels = <8>; dma-requests = <64>; nxp,mem2mem; diff --git a/dts/arm/nxp/nxp_mcxn23x_common.dtsi b/dts/arm/nxp/nxp_mcxn23x_common.dtsi index 9f24c3b3b5e93..3857b30af8dc9 100644 --- a/dts/arm/nxp/nxp_mcxn23x_common.dtsi +++ b/dts/arm/nxp/nxp_mcxn23x_common.dtsi @@ -461,7 +461,8 @@ edma0: dma-controller@80000 { #dma-cells = <2>; - compatible = "nxp,mcux-edma-v4"; + compatible = "nxp,mcux-edma"; + nxp,version = <4>; dma-channels = <16>; dma-requests = <120>; @@ -476,7 +477,8 @@ edma1: dma-controller@a0000 { #dma-cells = <2>; - compatible = "nxp,mcux-edma-v4"; + compatible = "nxp,mcux-edma"; + nxp,version = <4>; dma-channels = <16>; dma-requests = <120>; diff --git a/dts/arm/nxp/nxp_mcxn94x_common.dtsi b/dts/arm/nxp/nxp_mcxn94x_common.dtsi index 3a4548f4d1b7b..72b3177f082dc 100644 --- a/dts/arm/nxp/nxp_mcxn94x_common.dtsi +++ b/dts/arm/nxp/nxp_mcxn94x_common.dtsi @@ -536,7 +536,8 @@ edma0: dma-controller@80000 { #dma-cells = <2>; - compatible = "nxp,mcux-edma-v4"; + compatible = "nxp,mcux-edma"; + nxp,version = <4>; dma-channels = <16>; dma-requests = <120>; @@ -551,7 +552,8 @@ edma1: dma-controller@a0000 { #dma-cells = <2>; - compatible = "nxp,mcux-edma-v4"; + compatible = "nxp,mcux-edma"; + nxp,version = <4>; dma-channels = <16>; dma-requests = <120>; diff --git a/dts/arm/nxp/nxp_rt10xx.dtsi b/dts/arm/nxp/nxp_rt10xx.dtsi index df04eff6841bd..6a4aa316220bd 100644 --- a/dts/arm/nxp/nxp_rt10xx.dtsi +++ b/dts/arm/nxp/nxp_rt10xx.dtsi @@ -881,6 +881,7 @@ edma0: dma-controller@400e8000 { #dma-cells = <2>; compatible = "nxp,mcux-edma"; + nxp,version = <2>; dma-channels = <32>; dma-requests = <128>; nxp,mem2mem; diff --git a/dts/arm/nxp/nxp_rt11xx.dtsi b/dts/arm/nxp/nxp_rt11xx.dtsi index 04016dc040259..c0f4c38d5852e 100644 --- a/dts/arm/nxp/nxp_rt11xx.dtsi +++ b/dts/arm/nxp/nxp_rt11xx.dtsi @@ -1044,6 +1044,7 @@ edma0: dma-controller@40070000 { #dma-cells = <2>; compatible = "nxp,mcux-edma"; + nxp,version = <2>; dma-channels = <32>; dma-requests = <208>; nxp,mem2mem; @@ -1063,6 +1064,7 @@ edma_lpsr0: dma-controller@40c14000 { #dma-cells = <2>; compatible = "nxp,mcux-edma"; + nxp,version = <2>; dma-channels = <32>; dma-requests = <208>; nxp,mem2mem; diff --git a/dts/arm/nxp/nxp_s32k344_m7.dtsi b/dts/arm/nxp/nxp_s32k344_m7.dtsi index 2aa870e0766d2..4373c41309c1b 100644 --- a/dts/arm/nxp/nxp_s32k344_m7.dtsi +++ b/dts/arm/nxp/nxp_s32k344_m7.dtsi @@ -641,7 +641,8 @@ }; edma0: dma-controller@4020c000 { - compatible = "nxp,mcux-edma-v3"; + compatible = "nxp,mcux-edma"; + nxp,version = <3>; reg = <0x4020c000 0x3000>, <0x40280000 0x4000>, <0x40284000 0x4000>; dma-channels = <32>; dma-requests = <64>; diff --git a/dts/bindings/dma/nxp,mcux-edma-v3.yaml b/dts/bindings/dma/nxp,mcux-edma-v3.yaml deleted file mode 100644 index 2711c3be12498..0000000000000 --- a/dts/bindings/dma/nxp,mcux-edma-v3.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2023 NXP -# SPDX-License-Identifier: Apache-2.0 - -description: NXP MCUX EDMA version 3 controller - -compatible: "nxp,mcux-edma-v3" - -include: nxp,mcux-edma.yaml - -properties: - no-error-irq: - type: boolean - description: | - If the SoCs don't have a separate interrupt id for error IRQ. diff --git a/dts/bindings/dma/nxp,mcux-edma-v4.yaml b/dts/bindings/dma/nxp,mcux-edma-v4.yaml deleted file mode 100644 index 440f325c612c5..0000000000000 --- a/dts/bindings/dma/nxp,mcux-edma-v4.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2024 NXP -# SPDX-License-Identifier: Apache-2.0 - -description: NXP MCUX EDMA version 4 controller - -compatible: "nxp,mcux-edma-v4" - -include: nxp,mcux-edma.yaml - -properties: - no-error-irq: - type: boolean - description: | - If the SoCs don't have a separate interrupt id for error IRQ. diff --git a/dts/bindings/dma/nxp,mcux-edma.yaml b/dts/bindings/dma/nxp,mcux-edma.yaml index 50df791ebf71c..57e79378c0450 100644 --- a/dts/bindings/dma/nxp,mcux-edma.yaml +++ b/dts/bindings/dma/nxp,mcux-edma.yaml @@ -51,6 +51,20 @@ properties: Describes an offset between two channels share the same interrupt entry. Default value means each channel has separate interrupt entry. + no-error-irq: + type: boolean + description: | + If the SoCs don't have a separate interrupt id for error IRQ. + + nxp,version: + type: int + enum: + - 2 + - 3 + - 4 + description: | + eDMA IP revision number. + "#dma-cells": type: int required: true From d6007690de71a1364797de088806b1e642619c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Tue, 15 Oct 2024 11:48:32 +0200 Subject: [PATCH 2796/4482] manifest: update hal_nordic revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The hal_nordic revision was updated to bring in NRFX v3.8.0. Aligned the uses of single-instance API to use multi-instance instead. Signed-off-by: Rafał Kuźnia --- drivers/counter/counter_nrfx_rtc.c | 11 +-- modules/hal_nordic/nrfx/Kconfig | 73 +++++++++++++++++++- modules/hal_nordic/nrfx/nrfx_config.h | 42 +++++++++++ modules/hal_nordic/nrfx/nrfx_config_common.h | 2 +- soc/nordic/nrf53/sync_rtc.c | 8 ++- west.yml | 2 +- 6 files changed, 127 insertions(+), 11 deletions(-) diff --git a/drivers/counter/counter_nrfx_rtc.c b/drivers/counter/counter_nrfx_rtc.c index 203f980e78dbe..f6d7a936dba1f 100644 --- a/drivers/counter/counter_nrfx_rtc.c +++ b/drivers/counter/counter_nrfx_rtc.c @@ -387,7 +387,9 @@ static int ppi_setup(const struct device *dev, uint8_t chan) nrfy_rtc_event_enable(rtc, NRF_RTC_CHANNEL_INT_MASK(chan)); #ifdef DPPI_PRESENT - result = nrfx_dppi_channel_alloc(&data->ppi_ch); + nrfx_dppi_t dppi = NRFX_DPPI_INSTANCE(0); + + result = nrfx_dppi_channel_alloc(&dppi, &data->ppi_ch); if (result != NRFX_SUCCESS) { ERR("Failed to allocate PPI channel."); return -ENODEV; @@ -395,7 +397,7 @@ static int ppi_setup(const struct device *dev, uint8_t chan) nrfy_rtc_subscribe_set(rtc, NRF_RTC_TASK_CLEAR, data->ppi_ch); nrfy_rtc_publish_set(rtc, evt, data->ppi_ch); - (void)nrfx_dppi_channel_enable(data->ppi_ch); + (void)nrfx_dppi_channel_enable(&dppi, data->ppi_ch); #else /* DPPI_PRESENT */ uint32_t evt_addr; uint32_t task_addr; @@ -429,11 +431,12 @@ static void ppi_free(const struct device *dev, uint8_t chan) nrfy_rtc_event_disable(rtc, NRF_RTC_CHANNEL_INT_MASK(chan)); #ifdef DPPI_PRESENT nrf_rtc_event_t evt = NRF_RTC_CHANNEL_EVENT_ADDR(chan); + nrfx_dppi_t dppi = NRFX_DPPI_INSTANCE(0); - (void)nrfx_dppi_channel_disable(ppi_ch); + (void)nrfx_dppi_channel_disable(&dppi, ppi_ch); nrfy_rtc_subscribe_clear(rtc, NRF_RTC_TASK_CLEAR); nrfy_rtc_publish_clear(rtc, evt); - (void)nrfx_dppi_channel_free(ppi_ch); + (void)nrfx_dppi_channel_free(&dppi, ppi_ch); #else /* DPPI_PRESENT */ (void)nrfx_ppi_channel_disable(ppi_ch); (void)nrfx_ppi_channel_free(ppi_ch); diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 83ce3f157ccae..16729bf68aeb9 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -26,8 +26,77 @@ config NRFX_COMP depends on $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF_COMP)) config NRFX_DPPI - bool "DPPI allocator" - depends on $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF_DPPIC)) + bool + +config NRFX_DPPI0 + bool "DPPI0 driver instance" + depends on $(dt_nodelabel_has_compat,dppic,$(DT_COMPAT_NORDIC_NRF_DPPIC)) + select NRFX_DPPI + +config NRFX_DPPI00 + bool "DPPI00 driver instance" + depends on $(dt_nodelabel_has_compat,dppic00,$(DT_COMPAT_NORDIC_NRF_DPPIC)) + select NRFX_DPPI + +config NRFX_DPPI10 + bool "DPPI10 driver instance" + depends on $(dt_nodelabel_has_compat,dppic10,$(DT_COMPAT_NORDIC_NRF_DPPIC)) + select NRFX_DPPI + +config NRFX_DPPI20 + bool "DPPI20 driver instance" + depends on $(dt_nodelabel_has_compat,dppic20,$(DT_COMPAT_NORDIC_NRF_DPPIC)) + select NRFX_DPPI + +config NRFX_DPPI30 + bool "DPPI30 driver instance" + depends on $(dt_nodelabel_has_compat,dppic30,$(DT_COMPAT_NORDIC_NRF_DPPIC)) + select NRFX_DPPI + +config NRFX_DPPI020 + bool "DPPI020 driver instance" + depends on $(dt_nodelabel_has_compat,dppic020,$(DT_COMPAT_NORDIC_NRF_DPPIC_LOCAL)) + select NRFX_DPPI + +config NRFX_DPPI120 + bool "DPPI120 driver instance" + depends on $(dt_nodelabel_has_compat,dppic120,$(DT_COMPAT_NORDIC_NRF_DPPIC_GLOBAL)) + select NRFX_DPPI + +config NRFX_DPPI130 + bool "DPPI130 driver instance" + depends on $(dt_nodelabel_has_compat,dppic130,$(DT_COMPAT_NORDIC_NRF_DPPIC_GLOBAL)) + select NRFX_DPPI + +config NRFX_DPPI131 + bool "DPPI131 driver instance" + depends on $(dt_nodelabel_has_compat,dppic131,$(DT_COMPAT_NORDIC_NRF_DPPIC_GLOBAL)) + select NRFX_DPPI + +config NRFX_DPPI132 + bool "DPPI132 driver instance" + depends on $(dt_nodelabel_has_compat,dppic132,$(DT_COMPAT_NORDIC_NRF_DPPIC_GLOBAL)) + select NRFX_DPPI + +config NRFX_DPPI133 + bool "DPPI133 driver instance" + depends on $(dt_nodelabel_has_compat,dppic133,$(DT_COMPAT_NORDIC_NRF_DPPIC_GLOBAL)) + select NRFX_DPPI + +config NRFX_DPPI134 + bool "DPPI134 driver instance" + depends on $(dt_nodelabel_has_compat,dppic134,$(DT_COMPAT_NORDIC_NRF_DPPIC_GLOBAL)) + select NRFX_DPPI + +config NRFX_DPPI135 + bool "DPPI135 driver instance" + depends on $(dt_nodelabel_has_compat,dppic135,$(DT_COMPAT_NORDIC_NRF_DPPIC_GLOBAL)) + select NRFX_DPPI + +config NRFX_DPPI136 + bool "DPPI136 driver instance" + depends on $(dt_nodelabel_has_compat,dppic136,$(DT_COMPAT_NORDIC_NRF_DPPIC_GLOBAL)) + select NRFX_DPPI config NRFX_EGU bool diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 58e938492ffbd..92e5c71ee9230 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -84,6 +84,48 @@ #ifdef CONFIG_NRFX_DPPI_LOG #define NRFX_DPPI_CONFIG_LOG_ENABLED 1 #endif +#ifdef CONFIG_NRFX_DPPI0 +#define NRFX_DPPI0_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_DPPI00 +#define NRFX_DPPI00_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_DPPI10 +#define NRFX_DPPI10_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_DPPI20 +#define NRFX_DPPI20_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_DPPI30 +#define NRFX_DPPI30_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_DPPI020 +#define NRFX_DPPI020_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_DPPI120 +#define NRFX_DPPI120_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_DPPI130 +#define NRFX_DPPI130_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_DPPI131 +#define NRFX_DPPI131_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_DPPI132 +#define NRFX_DPPI132_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_DPPI133 +#define NRFX_DPPI133_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_DPPI134 +#define NRFX_DPPI134_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_DPPI135 +#define NRFX_DPPI135_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_DPPI136 +#define NRFX_DPPI136_ENABLED 1 +#endif #ifdef CONFIG_NRFX_EGU #define NRFX_EGU_ENABLED 1 diff --git a/modules/hal_nordic/nrfx/nrfx_config_common.h b/modules/hal_nordic/nrfx/nrfx_config_common.h index e04a11c6df8ba..0cf800680381a 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_common.h +++ b/modules/hal_nordic/nrfx/nrfx_config_common.h @@ -18,7 +18,7 @@ /** @brief Symbol specifying minor version of the nrfx API to be used. */ #ifndef NRFX_CONFIG_API_VER_MINOR -#define NRFX_CONFIG_API_VER_MINOR 7 +#define NRFX_CONFIG_API_VER_MINOR 8 #endif /** @brief Symbol specifying micro version of the nrfx API to be used. */ diff --git a/soc/nordic/nrf53/sync_rtc.c b/soc/nordic/nrf53/sync_rtc.c index 94616ee3a0c80..724453583b353 100644 --- a/soc/nordic/nrf53/sync_rtc.c +++ b/soc/nordic/nrf53/sync_rtc.c @@ -107,13 +107,14 @@ static void ppi_rtc_to_ipc(union rtc_sync_channels channels, bool setup) /* Free DPPI and RTC channels */ static void free_resources(union rtc_sync_channels channels) { + nrfx_dppi_t dppi = NRFX_DPPI_INSTANCE(0); nrfx_err_t err; nrfx_gppi_channels_disable(BIT(channels.ch.ppi)); z_nrf_rtc_timer_chan_free(channels.ch.rtc); - err = nrfx_dppi_channel_free(channels.ch.ppi); + err = nrfx_dppi_channel_free(&dppi, channels.ch.ppi); __ASSERT_NO_MSG(err == NRFX_SUCCESS); } @@ -224,12 +225,13 @@ static int mbox_rx_init(void *user_data) /* Setup RTC synchronization. */ static int sync_rtc_setup(void) { + nrfx_dppi_t dppi = NRFX_DPPI_INSTANCE(0); nrfx_err_t err; union rtc_sync_channels channels; int32_t sync_rtc_ch; int rv; - err = nrfx_dppi_channel_alloc(&channels.ch.ppi); + err = nrfx_dppi_channel_alloc(&dppi, &channels.ch.ppi); if (err != NRFX_SUCCESS) { rv = -ENODEV; goto bail; @@ -237,7 +239,7 @@ static int sync_rtc_setup(void) sync_rtc_ch = z_nrf_rtc_timer_chan_alloc(); if (sync_rtc_ch < 0) { - nrfx_dppi_channel_free(channels.ch.ppi); + nrfx_dppi_channel_free(&dppi, channels.ch.ppi); rv = sync_rtc_ch; goto bail; } diff --git a/west.yml b/west.yml index 9d3e7c6ff0f00..e3c82b4482152 100644 --- a/west.yml +++ b/west.yml @@ -188,7 +188,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 5c8d109371ebb740fbef1f440a3b59e488a36717 + revision: 2dbb2ed6cf461062bbac59a65b6e9d4576656350 path: modules/hal/nordic groups: - hal From 61d72936cb9072d8435a9450f4b0edcb4cb168fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Tue, 15 Oct 2024 13:13:36 +0200 Subject: [PATCH 2797/4482] dts: nordic: 54l: Add PPIB device tree nodes and bindings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added a binding description for the PPIB peripheral and added the device tree nodes of the PPIB instances to the nRF54L15 and nRF54L20. Signed-off-by: Rafał Kuźnia --- dts/bindings/misc/nordic,nrf-ppib.yaml | 13 +++++++ dts/common/nordic/nrf54l15.dtsi | 48 ++++++++++++++++++++++++++ dts/common/nordic/nrf54l20.dtsi | 48 ++++++++++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 dts/bindings/misc/nordic,nrf-ppib.yaml diff --git a/dts/bindings/misc/nordic,nrf-ppib.yaml b/dts/bindings/misc/nordic,nrf-ppib.yaml new file mode 100644 index 0000000000000..2bacbf286756c --- /dev/null +++ b/dts/bindings/misc/nordic,nrf-ppib.yaml @@ -0,0 +1,13 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +description: | + Nordic PPIB (Programmable Peripheral Interconnect Bridge) + +compatible: "nordic,nrf-ppib" + +include: base.yaml + +properties: + reg: + required: true diff --git a/dts/common/nordic/nrf54l15.dtsi b/dts/common/nordic/nrf54l15.dtsi index 7dfa6a314b226..5a49efd468d33 100644 --- a/dts/common/nordic/nrf54l15.dtsi +++ b/dts/common/nordic/nrf54l15.dtsi @@ -113,6 +113,18 @@ status = "disabled"; }; + ppib00: ppib@43000 { + compatible = "nordic,nrf-ppib"; + reg = <0x43000 0x1000>; + status = "disabled"; + }; + + ppib01: ppib@44000 { + compatible = "nordic,nrf-ppib"; + reg = <0x44000 0x1000>; + status = "disabled"; + }; + spi00: spi@4a000 { /* * This spi node can be either SPIM or SPIS, @@ -186,6 +198,18 @@ status = "disabled"; }; + ppib10: ppib@83000 { + compatible = "nordic,nrf-ppib"; + reg = <0x83000 0x1000>; + status = "disabled"; + }; + + ppib11: ppib@84000 { + compatible = "nordic,nrf-ppib"; + reg = <0x84000 0x1000>; + status = "disabled"; + }; + timer10: timer@85000 { compatible = "nordic,nrf-timer"; status = "disabled"; @@ -235,6 +259,24 @@ status = "disabled"; }; + ppib20: ppib@c3000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc3000 0x1000>; + status = "disabled"; + }; + + ppib21: ppib@c4000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc4000 0x1000>; + status = "disabled"; + }; + + ppib22: ppib@c5000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc5000 0x1000>; + status = "disabled"; + }; + i2c20: i2c@c6000 { compatible = "nordic,nrf-twim"; #address-cells = <1>; @@ -523,6 +565,12 @@ status = "disabled"; }; + ppib30: ppib@103000 { + compatible = "nordic,nrf-ppib"; + reg = <0x103000 0x1000>; + status = "disabled"; + }; + i2c30: i2c@104000 { compatible = "nordic,nrf-twim"; #address-cells = <1>; diff --git a/dts/common/nordic/nrf54l20.dtsi b/dts/common/nordic/nrf54l20.dtsi index d0e64a19b4d70..fda87fd2d1496 100644 --- a/dts/common/nordic/nrf54l20.dtsi +++ b/dts/common/nordic/nrf54l20.dtsi @@ -82,6 +82,18 @@ status = "disabled"; }; + ppib00: ppib@44000 { + compatible = "nordic,nrf-ppib"; + reg = <0x44000 0x1000>; + status = "disabled"; + }; + + ppib01: ppib@45000 { + compatible = "nordic,nrf-ppib"; + reg = <0x45000 0x1000>; + status = "disabled"; + }; + spi00: spi@4d000 { /* * This spi node can be either SPIM or SPIS, @@ -137,6 +149,18 @@ status = "disabled"; }; + ppib10: ppib@83000 { + compatible = "nordic,nrf-ppib"; + reg = <0x83000 0x1000>; + status = "disabled"; + }; + + ppib11: ppib@84000 { + compatible = "nordic,nrf-ppib"; + reg = <0x84000 0x1000>; + status = "disabled"; + }; + timer10: timer@85000 { compatible = "nordic,nrf-timer"; status = "disabled"; @@ -185,6 +209,24 @@ status = "disabled"; }; + ppib20: ppib@c3000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc3000 0x1000>; + status = "disabled"; + }; + + ppib21: ppib@c4000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc4000 0x1000>; + status = "disabled"; + }; + + ppib22: ppib@c5000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc5000 0x1000>; + status = "disabled"; + }; + i2c20: i2c@c6000 { compatible = "nordic,nrf-twim"; #address-cells = <1>; @@ -464,6 +506,12 @@ status = "disabled"; }; + ppib30: ppib@103000 { + compatible = "nordic,nrf-ppib"; + reg = <0x103000 0x1000>; + status = "disabled"; + }; + i2c30: i2c@104000 { compatible = "nordic,nrf-twim"; #address-cells = <1>; From bf66012544a9d1ceb9f7046409592ef39264507a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Tue, 15 Oct 2024 13:07:20 +0200 Subject: [PATCH 2798/4482] modules: hal_nordic: Enable nrfx_ppib drivers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The new nrfx_ppib driver can now be enabled, when the corrensponding device tree node has the okay status. Signed-off-by: Rafał Kuźnia --- modules/hal_nordic/nrfx/CMakeLists.txt | 1 + modules/hal_nordic/nrfx/Kconfig | 43 +++++++++++++++++++++++++ modules/hal_nordic/nrfx/Kconfig.logging | 4 +++ modules/hal_nordic/nrfx/nrfx_config.h | 31 ++++++++++++++++++ 4 files changed, 79 insertions(+) diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index 51c613f0104e5..cd58b3c6ef072 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -121,6 +121,7 @@ zephyr_library_sources_ifdef(CONFIG_NRFX_NVMC ${SRC_DIR}/nrfx_nvmc.c) zephyr_library_sources_ifdef(CONFIG_NRFX_PDM ${SRC_DIR}/nrfx_pdm.c) zephyr_library_sources_ifdef(CONFIG_NRFX_POWER ${SRC_DIR}/nrfx_power.c) zephyr_library_sources_ifdef(CONFIG_NRFX_PPI ${SRC_DIR}/nrfx_ppi.c) +zephyr_library_sources_ifdef(CONFIG_NRFX_PPIB ${SRC_DIR}/nrfx_ppib.c) zephyr_library_sources_ifdef(CONFIG_NRFX_PWM ${SRC_DIR}/nrfx_pwm.c) zephyr_library_sources_ifdef(CONFIG_NRFX_QDEC ${SRC_DIR}/nrfx_qdec.c) zephyr_library_sources_ifdef(CONFIG_NRFX_QSPI ${SRC_DIR}/nrfx_qspi.c) diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 16729bf68aeb9..f374e028b93a7 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -259,6 +259,49 @@ config NRFX_PPI bool "PPI allocator" depends on $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF_PPI)) +config NRFX_PPIB + bool + +config NRFX_PPIB00 + bool "PPIB00 driver instance" + depends on $(dt_nodelabel_has_compat,ppib00,$(DT_COMPAT_NORDIC_NRF_PPIB)) + select NRFX_PPIB + +config NRFX_PPIB01 + bool "PPIB01 driver instance" + depends on $(dt_nodelabel_has_compat,ppib01,$(DT_COMPAT_NORDIC_NRF_PPIB)) + select NRFX_PPIB + +config NRFX_PPIB10 + bool "PPIB10 driver instance" + depends on $(dt_nodelabel_has_compat,ppib10,$(DT_COMPAT_NORDIC_NRF_PPIB)) + select NRFX_PPIB + +config NRFX_PPIB11 + bool "PPIB11 driver instance" + depends on $(dt_nodelabel_has_compat,ppib11,$(DT_COMPAT_NORDIC_NRF_PPIB)) + select NRFX_PPIB + +config NRFX_PPIB20 + bool "PPIB20 driver instance" + depends on $(dt_nodelabel_has_compat,ppib20,$(DT_COMPAT_NORDIC_NRF_PPIB)) + select NRFX_PPIB + +config NRFX_PPIB21 + bool "PPIB21 driver instance" + depends on $(dt_nodelabel_has_compat,ppib21,$(DT_COMPAT_NORDIC_NRF_PPIB)) + select NRFX_PPIB + +config NRFX_PPIB22 + bool "PPIB22 driver instance" + depends on $(dt_nodelabel_has_compat,ppib22,$(DT_COMPAT_NORDIC_NRF_PPIB)) + select NRFX_PPIB + +config NRFX_PPIB30 + bool "PPIB30 driver instance" + depends on $(dt_nodelabel_has_compat,ppib30,$(DT_COMPAT_NORDIC_NRF_PPIB)) + select NRFX_PPIB + config NRFX_PWM bool diff --git a/modules/hal_nordic/nrfx/Kconfig.logging b/modules/hal_nordic/nrfx/Kconfig.logging index b24d683d3de19..2bf247218807a 100644 --- a/modules/hal_nordic/nrfx/Kconfig.logging +++ b/modules/hal_nordic/nrfx/Kconfig.logging @@ -64,6 +64,10 @@ config NRFX_PPI_LOG bool "PPI driver logging" depends on NRFX_PPI +config NRFX_PPIB_LOG + bool "PPIB driver logging" + depends on NRFX_PPIB + config NRFX_PRS_LOG bool "PRS driver logging" depends on NRFX_PRS diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 92e5c71ee9230..48b3b8226fb52 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -278,6 +278,37 @@ #define NRFX_PPI_CONFIG_LOG_ENABLED 1 #endif +#ifdef CONFIG_NRFX_PPIB +#define NRFX_PPIB_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_PPIB_LOG +#define NRFX_PPIB_CONFIG_LOG_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_PPIB00 +#define NRFX_PPIB00_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_PPIB01 +#define NRFX_PPIB01_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_PPIB10 +#define NRFX_PPIB10_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_PPIB11 +#define NRFX_PPIB11_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_PPIB20 +#define NRFX_PPIB20_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_PPIB21 +#define NRFX_PPIB21_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_PPIB22 +#define NRFX_PPIB22_ENABLED 1 +#endif +#ifdef CONFIG_NRFX_PPIB30 +#define NRFX_PPIB30_ENABLED 1 +#endif + #ifdef CONFIG_NRFX_PRS #define NRFX_PRS_ENABLED 1 #endif From 40d9dae867dfe66fa21f1adae55e8505c4d6ae72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Mon, 21 Oct 2024 08:16:07 +0200 Subject: [PATCH 2799/4482] modules: hal_nordic: rework resource reservations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The resource reservation definitions were moved to a separate header file. The PPIB and DPPI channel and group resources can now be statically allocated for each individual instance. Signed-off-by: Rafał Kuźnia --- .../nrfx/nrfx_config_reserved_resources.h | 710 ++++++++++++++++++ modules/hal_nordic/nrfx/nrfx_glue.h | 99 +-- 2 files changed, 711 insertions(+), 98 deletions(-) create mode 100644 modules/hal_nordic/nrfx/nrfx_config_reserved_resources.h diff --git a/modules/hal_nordic/nrfx/nrfx_config_reserved_resources.h b/modules/hal_nordic/nrfx/nrfx_config_reserved_resources.h new file mode 100644 index 0000000000000..132ba4cd89ad3 --- /dev/null +++ b/modules/hal_nordic/nrfx/nrfx_config_reserved_resources.h @@ -0,0 +1,710 @@ +/* + * Copyright (c) 2024, Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef NRFX_CONFIG_RESERVED_RESOURCES_H__ +#define NRFX_CONFIG_RESERVED_RESOURCES_H__ + +/** @brief Bitmask that defines GPIOTE130 channels reserved for use outside + * of the nrfx library. + */ +#define NRFX_GPIOTE130_CHANNELS_USED \ + (~NRFX_CONFIG_MASK_DT(DT_NODELABEL(gpiote130), owned_channels) | \ + NRFX_CONFIG_MASK_DT(DT_NODELABEL(gpiote130), child_owned_channels)) + +/** @brief Bitmask that defines GPIOTE131 channels reserved for use outside + * of the nrfx library. + */ +#define NRFX_GPIOTE131_CHANNELS_USED \ + (~NRFX_CONFIG_MASK_DT(DT_NODELABEL(gpiote131), owned_channels) | \ + NRFX_CONFIG_MASK_DT(DT_NODELABEL(gpiote131), child_owned_channels)) + +/** @brief Bitmask that defines EGU instances that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_EGUS_USED 0 + +/** @brief Bitmask that defines TIMER instances that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_TIMERS_USED 0 + +/* + * The enabled Bluetooth controller subsystem is responsible for providing + * definitions of the BT_CTLR_USED_* symbols used below in a file named + * bt_ctlr_used_resources.h and for adding its location to global include + * paths so that the file can be included here for all Zephyr libraries that + * are to be built. + */ +#if defined(CONFIG_BT_LL_SW_SPLIT) +#include +#if defined(DPPI_PRESENT) +#if defined(NRF53_SERIES) +#define NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_CHANNELS +#define NRFX_DPPI0_GROUPS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_GROUPS +#elif defined(LUMOS_XXAA) +#define NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_CHANNELS +#define NRFX_DPPI10_GROUPS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_GROUPS +#endif +#else /* defined(DPPI_PRESENT) */ +#define NRFX_PPI_CHANNELS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_CHANNELS +#define NRFX_PPI_GROUPS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_GROUPS +#endif /* defined(DPPI_PRESENT) */ +#endif /* defined(CONFIG_BT_LL_SW_SPLIT) */ + +#if defined(CONFIG_NRF_802154_RADIO_DRIVER) +#if defined(NRF52_SERIES) +#include <../src/nrf_802154_peripherals_nrf52.h> +#define NRFX_PPI_CHANNELS_USED_BY_802154_DRV NRF_802154_PPI_CHANNELS_USED_MASK +#define NRFX_PPI_GROUPS_USED_BY_802154_DRV NRF_802154_PPI_GROUPS_USED_MASK +#elif defined(NRF53_SERIES) +#include <../src/nrf_802154_peripherals_nrf53.h> +#define NRFX_DPPI0_CHANNELS_USED_BY_802154_DRV NRF_802154_DPPI_CHANNELS_USED_MASK +#define NRFX_DPPI0_GROUPS_USED_BY_802154_DRV NRF_802154_DPPI_GROUPS_USED_MASK +#elif defined(NRF54L_SERIES) +#include <../src/nrf_802154_peripherals_nrf54l.h> +#define NRFX_DPPI10_CHANNELS_USED_BY_802154_DRV NRF_802154_DPPI_CHANNELS_USED_MASK +#define NRFX_DPPI10_GROUPS_USED_BY_802154_DRV NRF_802154_DPPI_GROUPS_USED_MASK +#elif defined(NRF54H_SERIES) +#include <../src/nrf_802154_peripherals_nrf54h.h> +#define NRFX_DPPI020_CHANNELS_USED_BY_802154_DRV NRF_802154_DPPI_CHANNELS_USED_MASK +#define NRFX_DPPI020_GROUPS_USED_BY_802154_DRV NRF_802154_DPPI_GROUPS_USED_MASK +#else +#error Unsupported chip family +#endif +#endif /* CONFIG_NRF_802154_RADIO_DRIVER */ + +#ifndef NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI0_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI0_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI0_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI0_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI0_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI0_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI0_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI0_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI0_GROUPS_USED_BY_MPSL +#define NRFX_DPPI0_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI00_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI00_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI00_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI00_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI00_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI00_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI00_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI00_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI00_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI00_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI00_GROUPS_USED_BY_MPSL +#define NRFX_DPPI00_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI10_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI10_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI10_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI10_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI10_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI10_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI10_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI10_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI10_GROUPS_USED_BY_MPSL +#define NRFX_DPPI10_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI20_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI20_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI20_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI20_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI20_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI20_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI20_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI20_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI20_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI20_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI20_GROUPS_USED_BY_MPSL +#define NRFX_DPPI20_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI30_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI30_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI30_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI30_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI30_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI30_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI30_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI30_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI30_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI30_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI30_GROUPS_USED_BY_MPSL +#define NRFX_DPPI30_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI020_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI020_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI020_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI020_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI020_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI020_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI020_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI020_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI020_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI020_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI020_GROUPS_USED_BY_MPSL +#define NRFX_DPPI020_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI030_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI030_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI030_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI030_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI030_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI030_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI030_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI030_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI030_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI030_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI030_GROUPS_USED_BY_MPSL +#define NRFX_DPPI030_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI120_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI120_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI120_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI120_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI120_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI120_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI120_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI120_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI120_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI120_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI120_GROUPS_USED_BY_MPSL +#define NRFX_DPPI120_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI130_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI130_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI130_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI130_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI130_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI130_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI130_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI130_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI130_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI130_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI130_GROUPS_USED_BY_MPSL +#define NRFX_DPPI130_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI131_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI131_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI131_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI131_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI131_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI131_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI131_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI131_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI131_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI131_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI131_GROUPS_USED_BY_MPSL +#define NRFX_DPPI131_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI132_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI132_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI132_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI132_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI132_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI132_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI132_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI132_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI132_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI132_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI132_GROUPS_USED_BY_MPSL +#define NRFX_DPPI132_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI133_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI133_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI133_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI133_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI133_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI133_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI133_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI133_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI133_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI133_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI133_GROUPS_USED_BY_MPSL +#define NRFX_DPPI133_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI134_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI134_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI134_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI134_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI134_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI134_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI134_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI134_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI134_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI134_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI134_GROUPS_USED_BY_MPSL +#define NRFX_DPPI134_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI135_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI135_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI135_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI135_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI135_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI135_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI135_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI135_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI135_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI135_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI135_GROUPS_USED_BY_MPSL +#define NRFX_DPPI135_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_DPPI136_CHANNELS_USED_BY_BT_CTLR +#define NRFX_DPPI136_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI136_GROUPS_USED_BY_BT_CTLR +#define NRFX_DPPI136_GROUPS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_DPPI136_CHANNELS_USED_BY_802154_DRV +#define NRFX_DPPI136_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI136_GROUPS_USED_BY_802154_DRV +#define NRFX_DPPI136_GROUPS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_DPPI136_CHANNELS_USED_BY_MPSL +#define NRFX_DPPI136_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_DPPI136_GROUPS_USED_BY_MPSL +#define NRFX_DPPI136_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPI_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPI_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPI_GROUPS_USED_BY_BT_CTLR +#define NRFX_PPI_GROUPS_USED_BY_BT_CTLR 0 +#endif + +#ifndef NRFX_PPI_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPI_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPI_GROUPS_USED_BY_802154_DRV +#define NRFX_PPI_GROUPS_USED_BY_802154_DRV 0 +#endif + +#ifndef NRFX_PPI_CHANNELS_USED_BY_MPSL +#define NRFX_PPI_CHANNELS_USED_BY_MPSL 0 +#endif +#ifndef NRFX_PPI_GROUPS_USED_BY_MPSL +#define NRFX_PPI_GROUPS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_00_10_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_00_10_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_00_10_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_00_10_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_00_10_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_00_10_CHANNELS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_01_20_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_01_20_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_01_20_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_01_20_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_01_20_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_01_20_CHANNELS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_11_21_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_11_21_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_11_21_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_11_21_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_11_21_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_11_21_CHANNELS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_22_30_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_22_30_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_22_30_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_22_30_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_22_30_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_22_30_CHANNELS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_02_03_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_02_03_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_02_03_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_02_03_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_02_03_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_02_03_CHANNELS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_04_12_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_04_12_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_04_12_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_04_12_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_04_12_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_04_12_CHANNELS_USED_BY_MPSL 0 +#endif + +#ifndef NRFX_PPIB_020_030_CHANNELS_USED_BY_BT_CTLR +#define NRFX_PPIB_020_030_CHANNELS_USED_BY_BT_CTLR 0 +#endif +#ifndef NRFX_PPIB_020_030_CHANNELS_USED_BY_802154_DRV +#define NRFX_PPIB_020_030_CHANNELS_USED_BY_802154_DRV 0 +#endif +#ifndef NRFX_PPIB_020_030_CHANNELS_USED_BY_MPSL +#define NRFX_PPIB_020_030_CHANNELS_USED_BY_MPSL 0 +#endif + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI0_CHANNELS_USED \ + (NRFX_DPPI0_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI0_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI0_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI0_GROUPS_USED \ + (NRFX_DPPI0_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI0_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI0_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI00_CHANNELS_USED \ + (NRFX_DPPI00_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI00_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI00_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI00_GROUPS_USED \ + (NRFX_DPPI00_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI00_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI00_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI10_CHANNELS_USED \ + (NRFX_DPPI10_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI10_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI10_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI10_GROUPS_USED \ + (NRFX_DPPI10_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI10_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI10_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI20_CHANNELS_USED \ + (NRFX_DPPI20_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI20_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI20_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI20_GROUPS_USED \ + (NRFX_DPPI20_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI20_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI20_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI30_CHANNELS_USED \ + (NRFX_DPPI30_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI30_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI30_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI30_GROUPS_USED \ + (NRFX_DPPI30_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI30_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI30_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI020_CHANNELS_USED \ + (NRFX_DPPI020_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI020_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI020_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI020_GROUPS_USED \ + (NRFX_DPPI020_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI020_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI020_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI030_CHANNELS_USED \ + (NRFX_DPPI030_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI030_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI030_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI030_GROUPS_USED \ + (NRFX_DPPI030_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI030_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI030_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI120_CHANNELS_USED \ + (NRFX_DPPI120_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI120_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI120_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI120_GROUPS_USED \ + (NRFX_DPPI120_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI120_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI120_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI130_CHANNELS_USED \ + (NRFX_DPPI130_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI130_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI130_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI130_GROUPS_USED \ + (NRFX_DPPI130_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI130_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI130_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI131_CHANNELS_USED \ + (NRFX_DPPI131_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI131_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI131_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI131_GROUPS_USED \ + (NRFX_DPPI131_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI131_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI131_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI132_CHANNELS_USED \ + (NRFX_DPPI132_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI132_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI132_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI132_GROUPS_USED \ + (NRFX_DPPI132_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI132_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI132_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI133_CHANNELS_USED \ + (NRFX_DPPI133_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI133_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI133_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI133_GROUPS_USED \ + (NRFX_DPPI133_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI133_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI133_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI134_CHANNELS_USED \ + (NRFX_DPPI134_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI134_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI134_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI134_GROUPS_USED \ + (NRFX_DPPI134_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI134_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI134_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI135_CHANNELS_USED \ + (NRFX_DPPI135_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI135_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI135_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI135_GROUPS_USED \ + (NRFX_DPPI135_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI135_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI135_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI136_CHANNELS_USED \ + (NRFX_DPPI136_CHANNELS_USED_BY_BT_CTLR | NRFX_DPPI136_CHANNELS_USED_BY_802154_DRV | \ + NRFX_DPPI136_CHANNELS_USED_BY_MPSL) + +/** @brief Bitmask that defines DPPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_DPPI136_GROUPS_USED \ + (NRFX_DPPI136_GROUPS_USED_BY_BT_CTLR | NRFX_DPPI136_GROUPS_USED_BY_802154_DRV | \ + NRFX_DPPI136_GROUPS_USED_BY_MPSL) + +/** @brief Bitmask that defines PPI channels that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_PPI_CHANNELS_USED \ + (NRFX_PPI_CHANNELS_USED_BY_BT_CTLR | NRFX_PPI_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPI_CHANNELS_USED_BY_MPSL) + +#define NRFX_DPPI_CHANNELS_USED NRFX_DPPI0_CHANNELS_USED +#define NRFX_DPPI_GROUPS_USED NRFX_DPPI0_GROUPS_USED + +/** @brief Bitmask that defines PPI groups that are reserved for use outside + * of the nrfx library. + */ +#define NRFX_PPI_GROUPS_USED \ + (NRFX_PPI_GROUPS_USED_BY_BT_CTLR | NRFX_PPI_GROUPS_USED_BY_802154_DRV | \ + NRFX_PPI_GROUPS_USED_BY_MPSL) + +#define NRFX_PPIB_INTERCONNECT_00_10_CHANNELS_USED \ + (NRFX_PPIB_00_10_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_00_10_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPIB_00_10_CHANNELS_USED_BY_MPSL) + +#define NRFX_PPIB_INTERCONNECT_01_20_CHANNELS_USED \ + (NRFX_PPIB_01_20_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_01_20_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPIB_01_20_CHANNELS_USED_BY_MPSL) + +#define NRFX_PPIB_INTERCONNECT_11_21_CHANNELS_USED \ + (NRFX_PPIB_11_21_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_11_21_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPIB_11_21_CHANNELS_USED_BY_MPSL) + +#define NRFX_PPIB_INTERCONNECT_22_30_CHANNELS_USED \ + (NRFX_PPIB_22_30_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_22_30_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPIB_22_30_CHANNELS_USED_BY_MPSL) + +#define NRFX_PPIB_INTERCONNECT_02_03_CHANNELS_USED \ + (NRFX_PPIB_02_03_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_02_03_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPIB_02_03_CHANNELS_USED_BY_MPSL) + +#define NRFX_PPIB_INTERCONNECT_04_12_CHANNELS_USED \ + (NRFX_PPIB_04_12_CHANNELS_USED_BY_BT_CTLR | NRFX_PPIB_04_12_CHANNELS_USED_BY_802154_DRV | \ + NRFX_PPIB_04_12_CHANNELS_USED_BY_MPSL) + +#define NRFX_PPIB_INTERCONNECT_020_030_CHANNELS_USED \ + (NRFX_PPIB_020_030_CHANNELS_USED_BY_BT_CTLR | \ + NRFX_PPIB_020_030_CHANNELS_USED_BY_802154_DRV | NRFX_PPIB_020_030_CHANNELS_USED_BY_MPSL) + +#endif /* NRFX_CONFIG_RESERVED_RESOURCES_H__ */ diff --git a/modules/hal_nordic/nrfx/nrfx_glue.h b/modules/hal_nordic/nrfx/nrfx_glue.h index b7365e5163ac5..c65318f1fe368 100644 --- a/modules/hal_nordic/nrfx/nrfx_glue.h +++ b/modules/hal_nordic/nrfx/nrfx_glue.h @@ -314,104 +314,7 @@ void nrfx_busy_wait(uint32_t usec_to_wait); /*------------------------------------------------------------------------------*/ -/** @brief Bitmask that defines DPPI channels that are reserved for use outside of the nrfx library. */ -#define NRFX_DPPI_CHANNELS_USED (NRFX_PPI_CHANNELS_USED_BY_BT_CTLR | \ - NRFX_PPI_CHANNELS_USED_BY_802154_DRV | \ - NRFX_PPI_CHANNELS_USED_BY_MPSL) - -/** @brief Bitmask that defines DPPI groups that are reserved for use outside of the nrfx library. */ -#define NRFX_DPPI_GROUPS_USED (NRFX_PPI_GROUPS_USED_BY_BT_CTLR | \ - NRFX_PPI_GROUPS_USED_BY_802154_DRV | \ - NRFX_PPI_GROUPS_USED_BY_MPSL) - -/** @brief Bitmask that defines PPI channels that are reserved for use outside of the nrfx library. */ -#define NRFX_PPI_CHANNELS_USED (NRFX_PPI_CHANNELS_USED_BY_BT_CTLR | \ - NRFX_PPI_CHANNELS_USED_BY_802154_DRV | \ - NRFX_PPI_CHANNELS_USED_BY_MPSL) - -/** @brief Bitmask that defines PPI groups that are reserved for use outside of the nrfx library. */ -#define NRFX_PPI_GROUPS_USED (NRFX_PPI_GROUPS_USED_BY_BT_CTLR | \ - NRFX_PPI_GROUPS_USED_BY_802154_DRV | \ - NRFX_PPI_GROUPS_USED_BY_MPSL) - -/** @brief Bitmask that defines GPIOTE130 channels reserved for use outside of the nrfx library. */ -#define NRFX_GPIOTE130_CHANNELS_USED \ - (~NRFX_CONFIG_MASK_DT(DT_NODELABEL(gpiote130), owned_channels) | \ - NRFX_CONFIG_MASK_DT(DT_NODELABEL(gpiote130), child_owned_channels)) - -/** @brief Bitmask that defines GPIOTE131 channels reserved for use outside of the nrfx library. */ -#define NRFX_GPIOTE131_CHANNELS_USED \ - (~NRFX_CONFIG_MASK_DT(DT_NODELABEL(gpiote131), owned_channels) | \ - NRFX_CONFIG_MASK_DT(DT_NODELABEL(gpiote131), child_owned_channels)) - - -#if defined(CONFIG_BT_CTLR) -/* - * The enabled Bluetooth controller subsystem is responsible for providing - * definitions of the BT_CTLR_USED_* symbols used below in a file named - * bt_ctlr_used_resources.h and for adding its location to global include - * paths so that the file can be included here for all Zephyr libraries that - * are to be built. - */ -#include -#define NRFX_PPI_CHANNELS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_CHANNELS -#define NRFX_PPI_GROUPS_USED_BY_BT_CTLR BT_CTLR_USED_PPI_GROUPS -#else -#define NRFX_PPI_CHANNELS_USED_BY_BT_CTLR 0 -#define NRFX_PPI_GROUPS_USED_BY_BT_CTLR 0 -#endif - -#if defined(CONFIG_NRF_802154_RADIO_DRIVER) -#if defined(NRF52_SERIES) -#include <../src/nrf_802154_peripherals_nrf52.h> -#define NRFX_PPI_CHANNELS_USED_BY_802154_DRV NRF_802154_PPI_CHANNELS_USED_MASK -#define NRFX_PPI_GROUPS_USED_BY_802154_DRV NRF_802154_PPI_GROUPS_USED_MASK -#elif defined(NRF53_SERIES) -#include <../src/nrf_802154_peripherals_nrf53.h> -#define NRFX_PPI_CHANNELS_USED_BY_802154_DRV NRF_802154_DPPI_CHANNELS_USED_MASK -#define NRFX_PPI_GROUPS_USED_BY_802154_DRV NRF_802154_DPPI_GROUPS_USED_MASK -#elif defined(NRF54L_SERIES) -#include <../src/nrf_802154_peripherals_nrf54l.h> -#define NRFX_PPI_CHANNELS_USED_BY_802154_DRV NRF_802154_DPPI_CHANNELS_USED_MASK -#define NRFX_PPI_GROUPS_USED_BY_802154_DRV NRF_802154_DPPI_GROUPS_USED_MASK -#elif defined(NRF54H_SERIES) -#include <../src/nrf_802154_peripherals_nrf54h.h> -#define NRFX_PPI_CHANNELS_USED_BY_802154_DRV NRF_802154_DPPI_CHANNELS_USED_MASK -#define NRFX_PPI_GROUPS_USED_BY_802154_DRV NRF_802154_DPPI_GROUPS_USED_MASK -#else -#error Unsupported chip family -#endif -#else // CONFIG_NRF_802154_RADIO_DRIVER -#define NRFX_PPI_CHANNELS_USED_BY_802154_DRV 0 -#define NRFX_PPI_GROUPS_USED_BY_802154_DRV 0 -#endif // CONFIG_NRF_802154_RADIO_DRIVER - -#if defined(CONFIG_NRF_802154_RADIO_DRIVER) && !defined(CONFIG_NRF_802154_SL_OPENSOURCE) -#include -#define NRFX_PPI_CHANNELS_USED_BY_MPSL MPSL_RESERVED_PPI_CHANNELS -#define NRFX_PPI_GROUPS_USED_BY_MPSL 0 -#else -#define NRFX_PPI_CHANNELS_USED_BY_MPSL 0 -#define NRFX_PPI_GROUPS_USED_BY_MPSL 0 -#endif - -#if defined(NRF_802154_VERIFY_PERIPHS_ALLOC_AGAINST_MPSL) -BUILD_ASSERT( - (NRFX_PPI_CHANNELS_USED_BY_802154_DRV & NRFX_PPI_CHANNELS_USED_BY_MPSL) == 0, - "PPI channels used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); - -BUILD_ASSERT( - (NRFX_PPI_GROUPS_USED_BY_802154_DRV & NRFX_PPI_GROUPS_USED_BY_MPSL) == 0, - "PPI groups used by the IEEE802.15.4 radio driver overlap with those " - "assigned to the MPSL."); -#endif // NRF_802154_VERIFY_PERIPHS_ALLOC_AGAINST_MPSL - -/** @brief Bitmask that defines EGU instances that are reserved for use outside of the nrfx library. */ -#define NRFX_EGUS_USED 0 - -/** @brief Bitmask that defines TIMER instances that are reserved for use outside of the nrfx library. */ -#define NRFX_TIMERS_USED 0 +#include "nrfx_config_reserved_resources.h" //------------------------------------------------------------------------------ From e18410944ed32bc31642a2659f8ac6086133d5f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Wed, 23 Oct 2024 00:35:45 +0200 Subject: [PATCH 2800/4482] modules: hal_nordic: add NRFX_GPPI config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The nrfx_gppi module is an abstraction over nrfx_ppi and nrfx_dppi drivers. It now has a Kconfig option that is separate from nrfx_dppi and by default it enables all PPI/DPPI instances, if available. Signed-off-by: Rafał Kuźnia --- drivers/pwm/Kconfig.nrf_sw | 3 +-- drivers/serial/Kconfig.nrfx_uart_instance | 6 ++--- modules/hal_nordic/nrfx/CMakeLists.txt | 4 ++-- modules/hal_nordic/nrfx/Kconfig | 29 +++++++++++++++++++++++ samples/boards/nordic/nrfx/Kconfig | 6 ----- samples/boards/nordic/nrfx/prj.conf | 1 + soc/nordic/nrf53/Kconfig | 2 +- soc/nordic/nrf53/Kconfig.sync_rtc | 2 +- 8 files changed, 37 insertions(+), 16 deletions(-) diff --git a/drivers/pwm/Kconfig.nrf_sw b/drivers/pwm/Kconfig.nrf_sw index 7fc492c56f58e..6bd6d563f305e 100644 --- a/drivers/pwm/Kconfig.nrf_sw +++ b/drivers/pwm/Kconfig.nrf_sw @@ -8,8 +8,7 @@ config PWM_NRF_SW default y depends on DT_HAS_NORDIC_NRF_SW_PWM_ENABLED select NRFX_GPIOTE - select NRFX_PPI if HAS_HW_NRF_PPI - select NRFX_DPPI if HAS_HW_NRF_DPPIC + select NRFX_GPPI help Enable driver to utilize PWM on the Nordic Semiconductor nRF SoCs. diff --git a/drivers/serial/Kconfig.nrfx_uart_instance b/drivers/serial/Kconfig.nrfx_uart_instance index d44c1ab7e0261..8bc3f6c5e2cdc 100644 --- a/drivers/serial/Kconfig.nrfx_uart_instance +++ b/drivers/serial/Kconfig.nrfx_uart_instance @@ -24,8 +24,7 @@ config UART_$(nrfx_uart_num)_ENHANCED_POLL_OUT default y depends on HAS_HW_NRF_UARTE$(nrfx_uart_num) depends on HAS_HW_NRF_PPI || HAS_HW_NRF_DPPIC - select NRFX_PPI if HAS_HW_NRF_PPI - select NRFX_DPPI if HAS_HW_NRF_DPPIC + select NRFX_GPPI help When enabled, polling out does not trigger interrupt which stops TX. Feature uses a PPI channel. @@ -55,8 +54,7 @@ config UART_$(nrfx_uart_num)_NRF_HW_ASYNC depends on UART_ASYNC_API depends on UART_NRFX_UARTE_LEGACY_SHIM depends on HAS_HW_NRF_PPI || HAS_HW_NRF_DPPIC - select NRFX_PPI if HAS_HW_NRF_PPI - select NRFX_DPPI if HAS_HW_NRF_DPPIC + select NRFX_GPPI help If default driver uses interrupts to count incoming bytes, it is possible that with higher speeds and/or high cpu load some data can be lost. diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index cd58b3c6ef072..b807520ec5464 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -101,7 +101,7 @@ zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_NRF92X ${MDK_DIR}/system_nrf92.c zephyr_library_sources(nrfx_glue.c) zephyr_library_sources(${HELPERS_DIR}/nrfx_flag32_allocator.c) zephyr_library_sources_ifdef(CONFIG_RETAINED_MEM_NRF_RAM_CTRL ${HELPERS_DIR}/nrfx_ram_ctrl.c) -zephyr_library_sources_ifdef(CONFIG_NRFX_DPPI ${HELPERS_DIR}/nrfx_gppi_dppi.c) +zephyr_library_sources_ifdef(CONFIG_NRFX_GPPI ${HELPERS_DIR}/nrfx_gppi_dppi.c) zephyr_library_sources_ifdef(CONFIG_NRFX_PPI ${HELPERS_DIR}/nrfx_gppi_ppi.c) zephyr_library_sources_ifdef(CONFIG_NRFX_PRS ${SRC_DIR}/prs/nrfx_prs.c) @@ -185,7 +185,7 @@ if(CONFIG_SOC_NRF54L20_ENGA_CPUAPP) zephyr_compile_definitions(NRF_SKIP_TAMPC_SETUP) endif() -if(CONFIG_SOC_SERIES_NRF54LX AND CONFIG_NRFX_DPPI) +if(CONFIG_SOC_SERIES_NRF54LX AND CONFIG_NRFX_GPPI) zephyr_library_sources(${HELPERS_DIR}/nrfx_gppi_dppi_ppib_lumos.c) zephyr_library_sources(${NRFX_DIR}/soc/interconnect/dppic_ppib/nrfx_interconnect_dppic_ppib.c) endif() diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index f374e028b93a7..1ffff73b3566f 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -30,71 +30,85 @@ config NRFX_DPPI config NRFX_DPPI0 bool "DPPI0 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,dppic,$(DT_COMPAT_NORDIC_NRF_DPPIC)) select NRFX_DPPI config NRFX_DPPI00 bool "DPPI00 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,dppic00,$(DT_COMPAT_NORDIC_NRF_DPPIC)) select NRFX_DPPI config NRFX_DPPI10 bool "DPPI10 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,dppic10,$(DT_COMPAT_NORDIC_NRF_DPPIC)) select NRFX_DPPI config NRFX_DPPI20 bool "DPPI20 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,dppic20,$(DT_COMPAT_NORDIC_NRF_DPPIC)) select NRFX_DPPI config NRFX_DPPI30 bool "DPPI30 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,dppic30,$(DT_COMPAT_NORDIC_NRF_DPPIC)) select NRFX_DPPI config NRFX_DPPI020 bool "DPPI020 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,dppic020,$(DT_COMPAT_NORDIC_NRF_DPPIC_LOCAL)) select NRFX_DPPI config NRFX_DPPI120 bool "DPPI120 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,dppic120,$(DT_COMPAT_NORDIC_NRF_DPPIC_GLOBAL)) select NRFX_DPPI config NRFX_DPPI130 bool "DPPI130 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,dppic130,$(DT_COMPAT_NORDIC_NRF_DPPIC_GLOBAL)) select NRFX_DPPI config NRFX_DPPI131 bool "DPPI131 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,dppic131,$(DT_COMPAT_NORDIC_NRF_DPPIC_GLOBAL)) select NRFX_DPPI config NRFX_DPPI132 bool "DPPI132 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,dppic132,$(DT_COMPAT_NORDIC_NRF_DPPIC_GLOBAL)) select NRFX_DPPI config NRFX_DPPI133 bool "DPPI133 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,dppic133,$(DT_COMPAT_NORDIC_NRF_DPPIC_GLOBAL)) select NRFX_DPPI config NRFX_DPPI134 bool "DPPI134 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,dppic134,$(DT_COMPAT_NORDIC_NRF_DPPIC_GLOBAL)) select NRFX_DPPI config NRFX_DPPI135 bool "DPPI135 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,dppic135,$(DT_COMPAT_NORDIC_NRF_DPPIC_GLOBAL)) select NRFX_DPPI config NRFX_DPPI136 bool "DPPI136 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,dppic136,$(DT_COMPAT_NORDIC_NRF_DPPIC_GLOBAL)) select NRFX_DPPI @@ -192,6 +206,12 @@ config NRFX_GPIOTE_NUM_OF_EVT_HANDLERS Specifies number of handlers that can be registered to nrfx_gpiote driver by the user. +config NRFX_GPPI + bool "Generic PPI layer" + help + Enable the nrfx_gppi utilities providing unified API for creating PPI + connections across SoC families. + config NRFX_GRTC bool "GRTC driver" depends on $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF_GRTC)) @@ -257,6 +277,7 @@ config NRFX_POWER config NRFX_PPI bool "PPI allocator" + default y if NRFX_GPPI depends on $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF_PPI)) config NRFX_PPIB @@ -264,41 +285,49 @@ config NRFX_PPIB config NRFX_PPIB00 bool "PPIB00 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,ppib00,$(DT_COMPAT_NORDIC_NRF_PPIB)) select NRFX_PPIB config NRFX_PPIB01 bool "PPIB01 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,ppib01,$(DT_COMPAT_NORDIC_NRF_PPIB)) select NRFX_PPIB config NRFX_PPIB10 bool "PPIB10 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,ppib10,$(DT_COMPAT_NORDIC_NRF_PPIB)) select NRFX_PPIB config NRFX_PPIB11 bool "PPIB11 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,ppib11,$(DT_COMPAT_NORDIC_NRF_PPIB)) select NRFX_PPIB config NRFX_PPIB20 bool "PPIB20 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,ppib20,$(DT_COMPAT_NORDIC_NRF_PPIB)) select NRFX_PPIB config NRFX_PPIB21 bool "PPIB21 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,ppib21,$(DT_COMPAT_NORDIC_NRF_PPIB)) select NRFX_PPIB config NRFX_PPIB22 bool "PPIB22 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,ppib22,$(DT_COMPAT_NORDIC_NRF_PPIB)) select NRFX_PPIB config NRFX_PPIB30 bool "PPIB30 driver instance" + default y if NRFX_GPPI depends on $(dt_nodelabel_has_compat,ppib30,$(DT_COMPAT_NORDIC_NRF_PPIB)) select NRFX_PPIB diff --git a/samples/boards/nordic/nrfx/Kconfig b/samples/boards/nordic/nrfx/Kconfig index 67d02ef981bfc..776090f5bd23d 100644 --- a/samples/boards/nordic/nrfx/Kconfig +++ b/samples/boards/nordic/nrfx/Kconfig @@ -3,12 +3,6 @@ source "Kconfig.zephyr" -config NRFX_DPPI - default $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF_DPPIC)) - -config NRFX_PPI - default $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF_PPI)) - config NRFX_GPIOTE0 default y if SOC_SERIES_NRF51X || \ SOC_SERIES_NRF52X || \ diff --git a/samples/boards/nordic/nrfx/prj.conf b/samples/boards/nordic/nrfx/prj.conf index d4f0c29699f88..224fa224132ab 100644 --- a/samples/boards/nordic/nrfx/prj.conf +++ b/samples/boards/nordic/nrfx/prj.conf @@ -1,3 +1,4 @@ CONFIG_GPIO=n CONFIG_LOG=y CONFIG_LOG_PROCESS_THREAD_SLEEP_MS=100 +CONFIG_NRFX_GPPI=y diff --git a/soc/nordic/nrf53/Kconfig b/soc/nordic/nrf53/Kconfig index ecf7c112e82f0..9fc9d7a9df09c 100644 --- a/soc/nordic/nrf53/Kconfig +++ b/soc/nordic/nrf53/Kconfig @@ -82,7 +82,7 @@ config SOC_NRF53_ANOMALY_168_WORKAROUND_FOR_EXECUTION_FROM_RAM config SOC_NRF53_RTC_PRETICK bool "Pre-tick workaround for nRF5340 anomaly 165" depends on (SYS_CLOCK_EXISTS && SOC_NRF5340_CPUNET) || SOC_NRF5340_CPUAPP - select NRFX_DPPI + select NRFX_GPPI select ARM_ON_ENTER_CPU_IDLE_HOOK if SOC_NRF5340_CPUNET select ARM_ON_ENTER_CPU_IDLE_PREPARE_HOOK if SOC_NRF5340_CPUNET help diff --git a/soc/nordic/nrf53/Kconfig.sync_rtc b/soc/nordic/nrf53/Kconfig.sync_rtc index 475db911c6727..b960465e44275 100644 --- a/soc/nordic/nrf53/Kconfig.sync_rtc +++ b/soc/nordic/nrf53/Kconfig.sync_rtc @@ -5,7 +5,7 @@ config NRF53_SYNC_RTC bool "RTC clock synchronization" default y if LOG && !LOG_MODE_MINIMAL depends on NRF_RTC_TIMER - select NRFX_DPPI + select NRFX_GPPI select MBOX if !IPM if NRF53_SYNC_RTC From a1474a98685e8b6d393c25cfbed4522205c8263f Mon Sep 17 00:00:00 2001 From: Anthony Wertz Date: Mon, 16 Sep 2024 17:10:18 -0400 Subject: [PATCH 2801/4482] drivers: audio: dmic_nrfx_pdm: change log level in PDM read Currently the dmic_nrfx_pdm read implementation treats a timeout as an error, in that a logging error message is produced when no PDM data is available. However, for non-(or minimally-)blocking applications this is normal behavior. Classified this way, the logger is flooded with error messages unnecessarily, unless the log level is changed for the dmic module, which is not desirable. This modification simply changes the log-level to debug so the application user can then decide whether or not a failed read needs to produce an error message. Signed-off-by: Anthony Wertz --- drivers/audio/dmic_nrfx_pdm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/audio/dmic_nrfx_pdm.c b/drivers/audio/dmic_nrfx_pdm.c index 971fd9026651d..4ffd00f49099e 100644 --- a/drivers/audio/dmic_nrfx_pdm.c +++ b/drivers/audio/dmic_nrfx_pdm.c @@ -552,7 +552,7 @@ static int dmic_nrfx_pdm_read(const struct device *dev, ret = k_msgq_get(&drv_data->rx_queue, buffer, SYS_TIMEOUT_MS(timeout)); if (ret != 0) { - LOG_ERR("No audio data to be read"); + LOG_DBG("No audio data to be read"); } else { LOG_DBG("Released buffer %p", *buffer); From 2d90df407f0c77b25dacc0537dd70d0eac0170d7 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Thu, 25 Jul 2024 18:25:10 +0200 Subject: [PATCH 2802/4482] samples: usb: add samples function to setup USB device only Add a function similar to sample_usbd_init_device(), but one that does not initialize the device. It allows the application to set additional features, such as additional descriptors. Signed-off-by: Johann Fischer --- samples/subsys/usb/common/sample_usbd.h | 7 +++++++ samples/subsys/usb/common/sample_usbd_init.c | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/samples/subsys/usb/common/sample_usbd.h b/samples/subsys/usb/common/sample_usbd.h index 11779fef3f5e9..b12a62323d70c 100644 --- a/samples/subsys/usb/common/sample_usbd.h +++ b/samples/subsys/usb/common/sample_usbd.h @@ -29,4 +29,11 @@ */ struct usbd_context *sample_usbd_init_device(usbd_msg_cb_t msg_cb); +/* + * This function is similar to sample_usbd_init_device(), but does not + * initialize the device. It allows the application to set additional features, + * such as additional descriptors. + */ +struct usbd_context *sample_usbd_setup_device(usbd_msg_cb_t msg_cb); + #endif /* ZEPHYR_SAMPLES_SUBSYS_USB_COMMON_SAMPLE_USBD_H */ diff --git a/samples/subsys/usb/common/sample_usbd_init.c b/samples/subsys/usb/common/sample_usbd_init.c index 1428a95652dae..fb5b8e0dc3246 100644 --- a/samples/subsys/usb/common/sample_usbd_init.c +++ b/samples/subsys/usb/common/sample_usbd_init.c @@ -86,7 +86,7 @@ static void sample_fix_code_triple(struct usbd_context *uds_ctx, } } -struct usbd_context *sample_usbd_init_device(usbd_msg_cb_t msg_cb) +struct usbd_context *sample_usbd_setup_device(usbd_msg_cb_t msg_cb) { int err; @@ -173,6 +173,17 @@ struct usbd_context *sample_usbd_init_device(usbd_msg_cb_t msg_cb) } } + return &sample_usbd; +} + +struct usbd_context *sample_usbd_init_device(usbd_msg_cb_t msg_cb) +{ + int err; + + if (sample_usbd_setup_device(msg_cb) == NULL) { + return NULL; + } + /* doc device init start */ err = usbd_init(&sample_usbd); if (err) { From 34f42d6c7161013e58d19f1857b0fa6f14aa7243 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Thu, 25 Jul 2024 10:56:18 +0200 Subject: [PATCH 2803/4482] usb: device_next: support vendor request with recipient device Allow the user to register a vendor request node identified by the vendor code (bRequest) and containing two callbacks to handle the vendor request. The device stack uses the vendor request node to call the vendor request callbacks when it receives a request of type Vendor, recipient Device, and bRequest value equal to the vendor code. Signed-off-by: Johann Fischer --- include/zephyr/usb/usbd.h | 83 +++++++++++++++++++++++++++- subsys/usb/device_next/usbd_ch9.c | 30 +++++++++- subsys/usb/device_next/usbd_core.c | 2 + subsys/usb/device_next/usbd_device.c | 64 +++++++++++++++++++++ subsys/usb/device_next/usbd_device.h | 20 +++++++ 5 files changed, 196 insertions(+), 3 deletions(-) diff --git a/include/zephyr/usb/usbd.h b/include/zephyr/usb/usbd.h index 7fc022c30019a..143a3e46ddf77 100644 --- a/include/zephyr/usb/usbd.h +++ b/include/zephyr/usb/usbd.h @@ -61,6 +61,8 @@ extern "C" { */ #define USB_STRING_DESCRIPTOR_LENGTH(s) (sizeof(s) * 2) +struct usbd_context; + /** Used internally to keep descriptors in order * @cond INTERNAL_HIDDEN */ @@ -92,6 +94,54 @@ struct usbd_str_desc_data { unsigned int use_hwinfo : 1; }; +/** + * USBD vendor request node + * + * Vendor request node is identified by the vendor code and is used to register + * callbacks to handle the vendor request with the receiving device. + * When the device stack receives a request with type Vendor and recipient + * Device, and bRequest value equal to the vendor request code, it will call + * the vendor callbacks depending on the direction of the request. + * + * Example callback code fragment: + * + * @code{.c} + * static int foo_to_host_cb(const struct usbd_context *const ctx, + * const struct usb_setup_packet *const setup, + * struct net_buf *const buf) + * { + * if (setup->wIndex == WEBUSB_REQ_GET_URL) { + * uint8_t index = USB_GET_DESCRIPTOR_INDEX(setup->wValue); + * + * if (index != SAMPLE_WEBUSB_LANDING_PAGE) { + * return -ENOTSUP; + * } + * + * net_buf_add_mem(buf, &webusb_origin_url, + * MIN(net_buf_tailroom(buf), sizeof(webusb_origin_url))); + * + * return 0; + * } + * + * return -ENOTSUP; + * } + * @endcode + */ +struct usbd_vreq_node { + /** Node information for the dlist */ + sys_dnode_t node; + /** Vendor code (bRequest value) */ + const uint8_t code; + /** Vendor request callback for device-to-host direction */ + int (*to_host)(const struct usbd_context *const ctx, + const struct usb_setup_packet *const setup, + struct net_buf *const buf); + /** Vendor request callback for host-to-device direction */ + int (*to_dev)(const struct usbd_context *const ctx, + const struct usb_setup_packet *const setup, + const struct net_buf *const buf); +}; + /** * USBD BOS Device Capability descriptor data */ @@ -204,8 +254,6 @@ struct usbd_status { enum usbd_speed speed : 2; }; -struct usbd_context; - /** * @brief Callback type definition for USB device message delivery * @@ -243,6 +291,8 @@ struct usbd_context { sys_slist_t fs_configs; /** slist to manage High-Speed device configurations */ sys_slist_t hs_configs; + /** dlist to manage vendor requests with recipient device */ + sys_dlist_t vreqs; /** Status of the USB device support */ struct usbd_status status; /** Pointer to Full-Speed device descriptor */ @@ -618,6 +668,21 @@ static inline void *usbd_class_get_private(const struct usbd_class_data *const c .bDescriptorType = USB_DESC_BOS, \ } +/** + * @brief Define a vendor request with recipient device + * + * @param name Vendor request identifier + * @param vcode Vendor request code + * @param vto_host Vendor callback for to-host direction request + * @param vto_dev Vendor callback for to-device direction request + */ +#define USBD_VREQUEST_DEFINE(name, vcode, vto_host, vto_dev) \ + static struct usbd_vreq_node name = { \ + .code = vcode, \ + .to_host = vto_host, \ + .to_dev = vto_dev, \ + } + /** * @brief Define USB device support class data * @@ -1088,6 +1153,20 @@ int usbd_config_maxpower(struct usbd_context *const uds_ctx, */ bool usbd_can_detect_vbus(struct usbd_context *const uds_ctx); +/** + * @brief Register an USB vendor request with recipient device + * + * The vendor request with the recipient device applies to all configurations + * within the device. + * + * @param[in] uds_ctx Pointer to USB device support context + * @param[in] vreq_nd Pointer to vendor request node + * + * @return 0 on success, other values on fail. + */ +int usbd_device_register_vreq(struct usbd_context *const uds_ctx, + struct usbd_vreq_node *const vreq_nd); + /** * @} */ diff --git a/subsys/usb/device_next/usbd_ch9.c b/subsys/usb/device_next/usbd_ch9.c index 45775e88c532a..0203e08675bce 100644 --- a/subsys/usb/device_next/usbd_ch9.c +++ b/subsys/usb/device_next/usbd_ch9.c @@ -918,6 +918,34 @@ static int std_request_to_host(struct usbd_context *const uds_ctx, return ret; } +static int vendor_device_request(struct usbd_context *const uds_ctx, + struct net_buf *const buf) +{ + struct usb_setup_packet *setup = usbd_get_setup_pkt(uds_ctx); + struct usbd_vreq_node *vreq_nd; + + vreq_nd = usbd_device_get_vreq(uds_ctx, setup->bRequest); + if (vreq_nd == NULL) { + errno = -ENOTSUP; + return 0; + } + + if (reqtype_is_to_device(setup) && vreq_nd->to_dev != NULL) { + LOG_ERR("Vendor request 0x%02x to device", setup->bRequest); + errno = vreq_nd->to_dev(uds_ctx, setup, buf); + return 0; + } + + if (reqtype_is_to_host(setup) && vreq_nd->to_host != NULL) { + LOG_ERR("Vendor request 0x%02x to host", setup->bRequest); + errno = vreq_nd->to_host(uds_ctx, setup, buf); + return 0; + } + + errno = -ENOTSUP; + return 0; +} + static int nonstd_request(struct usbd_context *const uds_ctx, struct net_buf *const dbuf) { @@ -946,7 +974,7 @@ static int nonstd_request(struct usbd_context *const uds_ctx, ret = usbd_class_control_to_host(c_nd->c_data, setup, dbuf); } } else { - errno = -ENOTSUP; + return vendor_device_request(uds_ctx, dbuf); } return ret; diff --git a/subsys/usb/device_next/usbd_core.c b/subsys/usb/device_next/usbd_core.c index 2502357bf8c6f..64c0a0ab654cd 100644 --- a/subsys/usb/device_next/usbd_core.c +++ b/subsys/usb/device_next/usbd_core.c @@ -251,6 +251,8 @@ int usbd_device_shutdown_core(struct usbd_context *const uds_ctx) LOG_ERR("Failed to cleanup descriptors, %d", ret); } + usbd_device_unregister_all_vreq(uds_ctx); + return udc_shutdown(uds_ctx->dev); } diff --git a/subsys/usb/device_next/usbd_device.c b/subsys/usb/device_next/usbd_device.c index 8fa18d9a1f066..282dadfd6997b 100644 --- a/subsys/usb/device_next/usbd_device.c +++ b/subsys/usb/device_next/usbd_device.c @@ -334,3 +334,67 @@ bool usbd_can_detect_vbus(struct usbd_context *const uds_ctx) return caps.can_detect_vbus; } + +struct usbd_vreq_node *usbd_device_get_vreq(struct usbd_context *const uds_ctx, + const uint8_t code) +{ + struct usbd_vreq_node *vreq_nd; + + SYS_DLIST_FOR_EACH_CONTAINER(&uds_ctx->vreqs, vreq_nd, node) { + if (vreq_nd->code == code) { + return vreq_nd; + } + } + + return NULL; +} + +int usbd_device_register_vreq(struct usbd_context *const uds_ctx, + struct usbd_vreq_node *const vreq_nd) +{ + int ret = 0; + + usbd_device_lock(uds_ctx); + + if (usbd_is_initialized(uds_ctx)) { + ret = -EPERM; + goto error; + } + + if (vreq_nd->to_dev == NULL && vreq_nd->to_host == NULL) { + ret = -EINVAL; + goto error; + } + + if (!sys_dnode_is_linked(&uds_ctx->vreqs)) { + LOG_DBG("Initialize vendor request list"); + sys_dlist_init(&uds_ctx->vreqs); + } + + if (sys_dnode_is_linked(&vreq_nd->node)) { + ret = -EALREADY; + goto error; + } + + sys_dlist_append(&uds_ctx->vreqs, &vreq_nd->node); + LOG_DBG("Registered vendor request 0x%02x", vreq_nd->code); + +error: + usbd_device_unlock(uds_ctx); + return ret; +} + +void usbd_device_unregister_all_vreq(struct usbd_context *const uds_ctx) +{ + struct usbd_vreq_node *tmp; + sys_dnode_t *node; + + if (!sys_dnode_is_linked(&uds_ctx->vreqs)) { + return; + } + + while ((node = sys_dlist_get(&uds_ctx->vreqs))) { + tmp = CONTAINER_OF(node, struct usbd_vreq_node, node); + LOG_DBG("Remove vendor request 0x%02x", tmp->code); + } +} diff --git a/subsys/usb/device_next/usbd_device.h b/subsys/usb/device_next/usbd_device.h index 76c7ed7ee9aaf..e2f0d98ab8b4e 100644 --- a/subsys/usb/device_next/usbd_device.h +++ b/subsys/usb/device_next/usbd_device.h @@ -10,6 +10,26 @@ #include #include +/** + * @brief Get vendor request node + * + * Get vendor request node from internal vendor request list. + * + * @param[in] ctx Pointer to USB device support context + * @param[in] code Vendor request code + * + * @return pointer to vendor request node or NULL if not found. + */ +struct usbd_vreq_node *usbd_device_get_vreq(struct usbd_context *const uds_ctx, + const uint8_t code); + +/** + * @brief Unregister all registered vendor request + * + * @param[in] uds_ctx Pointer to a device context + */ +void usbd_device_unregister_all_vreq(struct usbd_context *const uds_ctx); + /** * @brief Get device descriptor bNumConfigurations value * From 6ee1358519d5dfb4114d2f9be21b07ff57499615 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Sat, 19 Oct 2024 00:04:08 +0200 Subject: [PATCH 2804/4482] usb: device_next: support BOS descriptor with vendor request code Platform capability descriptors such as MSOSv2 or WebUSB BOS have a vendor request code that is used by the host to perform vendor-specific requests. Add a convenient way to define and register a platform capability descriptor with a vendor request node. Signed-off-by: Johann Fischer --- include/zephyr/usb/usbd.h | 32 ++++++++++++++++++++++++++++++ subsys/usb/device_next/usbd_desc.c | 7 +++++++ 2 files changed, 39 insertions(+) diff --git a/include/zephyr/usb/usbd.h b/include/zephyr/usb/usbd.h index 143a3e46ddf77..b588d7087d282 100644 --- a/include/zephyr/usb/usbd.h +++ b/include/zephyr/usb/usbd.h @@ -77,6 +77,7 @@ enum usbd_str_desc_utype { enum usbd_bos_desc_utype { USBD_DUT_BOS_NONE, + USBD_DUT_BOS_VREQ, }; /** @endcond */ @@ -148,6 +149,9 @@ struct usbd_vreq_node { struct usbd_bos_desc_data { /** Descriptor usage type (not bDescriptorType) */ enum usbd_bos_desc_utype utype : 8; + union { + struct usbd_vreq_node *const vreq_nd; + }; }; /** @@ -683,6 +687,34 @@ static inline void *usbd_class_get_private(const struct usbd_class_data *const c .to_dev = vto_dev, \ } +/** + * @brief Define BOS Device Capability descriptor node with vendor request + * + * This macro defines a BOS descriptor, usually a platform capability, with a + * vendor request node. + * + * USBD_DESC_BOS_VREQ_DEFINE(bos_vreq_webusb, sizeof(bos_cap_webusb), &bos_cap_webusb, + * SAMPLE_WEBUSB_VENDOR_CODE, webusb_to_host_cb, NULL); + * + * @param name Descriptor node identifier + * @param len Device Capability descriptor length + * @param subset Pointer to a Device Capability descriptor + * @param vcode Vendor request code + * @param vto_host Vendor callback for to-host direction request + * @param vto_dev Vendor callback for to-device direction request + */ +#define USBD_DESC_BOS_VREQ_DEFINE(name, len, subset, vcode, vto_host, vto_dev) \ + USBD_VREQUEST_DEFINE(vreq_nd_##name, vcode, vto_host, vto_dev); \ + static struct usbd_desc_node name = { \ + .bos = { \ + .utype = USBD_DUT_BOS_VREQ, \ + .vreq_nd = &vreq_nd_##name, \ + }, \ + .ptr = subset, \ + .bLength = len, \ + .bDescriptorType = USB_DESC_BOS, \ + } + /** * @brief Define USB device support class data * diff --git a/subsys/usb/device_next/usbd_desc.c b/subsys/usb/device_next/usbd_desc.c index 469953d1d2751..79fee838461fc 100644 --- a/subsys/usb/device_next/usbd_desc.c +++ b/subsys/usb/device_next/usbd_desc.c @@ -143,6 +143,13 @@ int usbd_add_descriptor(struct usbd_context *const uds_ctx, } if (desc_nd->bDescriptorType == USB_DESC_BOS) { + if (desc_nd->bos.utype == USBD_DUT_BOS_VREQ) { + ret = usbd_device_register_vreq(uds_ctx, desc_nd->bos.vreq_nd); + if (ret) { + goto add_descriptor_error; + } + } + sys_dlist_append(&uds_ctx->descriptors, &desc_nd->node); } From 1687e192b5f4bc1f8640fe826553afd16cffee88 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Thu, 25 Jul 2024 18:28:28 +0200 Subject: [PATCH 2805/4482] samples: usb: add new WebUSB sample Add a WebUSB sample that uses the new USB device support. Signed-off-by: Johann Fischer --- samples/subsys/usb/webusb-next/CMakeLists.txt | 9 + samples/subsys/usb/webusb-next/Kconfig | 9 + samples/subsys/usb/webusb-next/README.rst | 73 +++++ samples/subsys/usb/webusb-next/demo.rst | 7 + samples/subsys/usb/webusb-next/index.html | 126 ++++++++ samples/subsys/usb/webusb-next/prj.conf | 7 + samples/subsys/usb/webusb-next/sample.yaml | 15 + samples/subsys/usb/webusb-next/src/main.c | 83 ++++++ samples/subsys/usb/webusb-next/src/msosv2.h | 138 +++++++++ samples/subsys/usb/webusb-next/src/sfunc.c | 274 ++++++++++++++++++ samples/subsys/usb/webusb-next/src/webusb.h | 90 ++++++ 11 files changed, 831 insertions(+) create mode 100644 samples/subsys/usb/webusb-next/CMakeLists.txt create mode 100644 samples/subsys/usb/webusb-next/Kconfig create mode 100644 samples/subsys/usb/webusb-next/README.rst create mode 100644 samples/subsys/usb/webusb-next/demo.rst create mode 100644 samples/subsys/usb/webusb-next/index.html create mode 100644 samples/subsys/usb/webusb-next/prj.conf create mode 100644 samples/subsys/usb/webusb-next/sample.yaml create mode 100644 samples/subsys/usb/webusb-next/src/main.c create mode 100644 samples/subsys/usb/webusb-next/src/msosv2.h create mode 100644 samples/subsys/usb/webusb-next/src/sfunc.c create mode 100644 samples/subsys/usb/webusb-next/src/webusb.h diff --git a/samples/subsys/usb/webusb-next/CMakeLists.txt b/samples/subsys/usb/webusb-next/CMakeLists.txt new file mode 100644 index 0000000000000..97a240805ee9e --- /dev/null +++ b/samples/subsys/usb/webusb-next/CMakeLists.txt @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(webusb) + +include(${ZEPHYR_BASE}/samples/subsys/usb/common/common.cmake) +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/subsys/usb/webusb-next/Kconfig b/samples/subsys/usb/webusb-next/Kconfig new file mode 100644 index 0000000000000..96c5455894806 --- /dev/null +++ b/samples/subsys/usb/webusb-next/Kconfig @@ -0,0 +1,9 @@ +# Copyright (c) 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +# Source common USB sample options used to initialize new experimental USB +# device stack. The scope of these options is limited to USB samples in project +# tree, you cannot use them in your own application. +source "samples/subsys/usb/common/Kconfig.sample_usbd" + +source "Kconfig.zephyr" diff --git a/samples/subsys/usb/webusb-next/README.rst b/samples/subsys/usb/webusb-next/README.rst new file mode 100644 index 0000000000000..262c6ee62722a --- /dev/null +++ b/samples/subsys/usb/webusb-next/README.rst @@ -0,0 +1,73 @@ +.. zephyr:code-sample:: webusb-next + :name: WebUSB-next + :relevant-api: usbd_api + + Receive and echo data from a web page using WebUSB API. + +Overview +******** + +This sample demonstrates how to use the Binary Device Object Store (BOS), +Microsoft OS 2.0 descriptors, and WebUSB descriptors to implement a WebUSB +sample application. The sample USB function receives the data and echoes back +to the WebUSB API based application running in the browser on your local host. +This sample can be found at :zephyr_file:`samples/subsys/usb/webusb-next` in the +Zephyr project tree. + +Requirements +************ + +This project requires a USB device controller driver using the UDC API. +On your host computer, this project requires a web browser that supports the +WebUSB API, such as Chromium or a Chromium-based browser. + +Building and Running +******************** + +Build and flash webusb sample with: + +.. zephyr-app-commands:: + :zephyr-app: samples/subsys/usb/webusb-next + :board: + :goals: flash + :compact: + +Demonstration +************* + +The sample includes a simple WebUSB API application and can be found in the +sample directory: :zephyr_file:`samples/subsys/usb/webusb-next/index.html`. + +There are two ways to access this sample page: + +* Using browser go to :doc:`demo` + +* Start a web server in the sample directory: + + .. code-block:: console + + $ python -m http.server + +Then follow these steps: + +#. Connect the board to your host. + +#. Once the device has booted, you may see a notification from the browser: "Go + to localhost to connect". Click on the notification to open the demo page. If + there is no notification from the browser, open the URL http://localhost:8001/ + in your browser. + +#. Click on the :guilabel:`Connect` button to connect to the device. + +#. Send some text to the device by clicking on the :guilabel:`Send` button. + The demo application will receive the same text from the device and display + it in the text area. + +References +*********** + +WebUSB API Specification: +https://wicg.github.io/webusb/ + +Chrome for Developers, "Access USB Devices on the Web": +https://developer.chrome.com/docs/capabilities/usb diff --git a/samples/subsys/usb/webusb-next/demo.rst b/samples/subsys/usb/webusb-next/demo.rst new file mode 100644 index 0000000000000..6925a80258093 --- /dev/null +++ b/samples/subsys/usb/webusb-next/demo.rst @@ -0,0 +1,7 @@ +:orphan: + +WebUSB HTML Demo App +==================== + +.. raw:: html + :file: index.html diff --git a/samples/subsys/usb/webusb-next/index.html b/samples/subsys/usb/webusb-next/index.html new file mode 100644 index 0000000000000..b6cfc96d447eb --- /dev/null +++ b/samples/subsys/usb/webusb-next/index.html @@ -0,0 +1,126 @@ + + + + WebUSB Serial Sample Application + + + + + +


+ +
+

+
+ + + diff --git a/samples/subsys/usb/webusb-next/prj.conf b/samples/subsys/usb/webusb-next/prj.conf new file mode 100644 index 0000000000000..1c730a0ec56a3 --- /dev/null +++ b/samples/subsys/usb/webusb-next/prj.conf @@ -0,0 +1,7 @@ +CONFIG_USB_DEVICE_STACK_NEXT=y + +CONFIG_LOG=y +CONFIG_USBD_LOG_LEVEL_WRN=y +CONFIG_UDC_DRIVER_LOG_LEVEL_WRN=y +CONFIG_SAMPLE_USBD_PID=0x000A +CONFIG_SAMPLE_USBD_20_EXTENSION_DESC=y diff --git a/samples/subsys/usb/webusb-next/sample.yaml b/samples/subsys/usb/webusb-next/sample.yaml new file mode 100644 index 0000000000000..d3beb068981cc --- /dev/null +++ b/samples/subsys/usb/webusb-next/sample.yaml @@ -0,0 +1,15 @@ +sample: + name: WebUSB +tests: + sample.usb.webusb-next: + depends_on: usbd + tags: usb + integration_platforms: + - nrf52840dk/nrf52840 + - nrf54h20dk/nrf54h20/cpuapp + - frdm_k64f + - stm32f723e_disco + - nucleo_f413zh + - mimxrt685_evk/mimxrt685s/cm33 + - mimxrt1060_evk + harness: TBD diff --git a/samples/subsys/usb/webusb-next/src/main.c b/samples/subsys/usb/webusb-next/src/main.c new file mode 100644 index 0000000000000..fe600e9d08d11 --- /dev/null +++ b/samples/subsys/usb/webusb-next/src/main.c @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2023-2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include +#include +#include + +#include +LOG_MODULE_REGISTER(main, LOG_LEVEL_INF); + +/* + * There are three BOS descriptors used in the sample, a USB 2.0 EXTENSION from + * the USB samples common code, a Microsoft OS 2.0 platform capability + * descriptor, and a WebUSB platform capability descriptor. + */ +#include "webusb.h" +#include "msosv2.h" + +static void msg_cb(struct usbd_context *const usbd_ctx, + const struct usbd_msg *const msg) +{ + LOG_INF("USBD message: %s", usbd_msg_type_string(msg->type)); + + if (usbd_can_detect_vbus(usbd_ctx)) { + if (msg->type == USBD_MSG_VBUS_READY) { + if (usbd_enable(usbd_ctx)) { + LOG_ERR("Failed to enable device support"); + } + } + + if (msg->type == USBD_MSG_VBUS_REMOVED) { + if (usbd_disable(usbd_ctx)) { + LOG_ERR("Failed to disable device support"); + } + } + } +} + +int main(void) +{ + struct usbd_context *sample_usbd; + int ret; + + sample_usbd = sample_usbd_setup_device(msg_cb); + if (sample_usbd == NULL) { + LOG_ERR("Failed to setup USB device"); + return -ENODEV; + } + + ret = usbd_add_descriptor(sample_usbd, &bos_vreq_msosv2); + if (ret) { + LOG_ERR("Failed to add MSOSv2 capability descriptor"); + return ret; + } + + ret = usbd_add_descriptor(sample_usbd, &bos_vreq_webusb); + if (ret) { + LOG_ERR("Failed to add WebUSB capability descriptor"); + return ret; + } + + ret = usbd_init(sample_usbd); + if (ret) { + LOG_ERR("Failed to initialize device support"); + return ret; + } + + if (!usbd_can_detect_vbus(sample_usbd)) { + ret = usbd_enable(sample_usbd); + if (ret) { + LOG_ERR("Failed to enable device support"); + return ret; + } + } + + return 0; +} diff --git a/samples/subsys/usb/webusb-next/src/msosv2.h b/samples/subsys/usb/webusb-next/src/msosv2.h new file mode 100644 index 0000000000000..88fc592737fa4 --- /dev/null +++ b/samples/subsys/usb/webusb-next/src/msosv2.h @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2016-2019 Intel Corporation + * Copyright (c) 2023-2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_MSOSV2_DESCRIPTOR_H +#define ZEPHYR_INCLUDE_MSOSV2_DESCRIPTOR_H + +/* + * Microsoft OS 2.0 platform capability and Microsoft OS 2.0 descriptor set. + * See Microsoft OS 2.0 Descriptors Specification for reference. + */ + +#define SAMPLE_MSOS2_VENDOR_CODE 0x02U +/* Windows version (10)*/ +#define SAMPLE_MSOS2_OS_VERSION 0x0A000000UL + +/* random GUID {FA611CC3-7057-42EE-9D82-4919639562B3} */ +#define WEBUSB_DEVICE_INTERFACE_GUID \ + '{', 0x00, 'F', 0x00, 'A', 0x00, '6', 0x00, '1', 0x00, '1', 0x00, \ + 'C', 0x00, 'C', 0x00, '3', 0x00, '-', 0x00, '7', 0x00, '0', 0x00, \ + '5', 0x00, '7', 0x00, '-', 0x00, '4', 0x00, '2', 0x00, 'E', 0x00, \ + 'E', 0x00, '-', 0x00, '9', 0x00, 'D', 0x00, '8', 0x00, '2', 0x00, \ + '-', 0x00, '4', 0x00, '9', 0x00, '1', 0x00, '9', 0x00, '6', 0x00, \ + '3', 0x00, '9', 0x00, '5', 0x00, '6', 0x00, '2', 0x00, 'B', 0x00, \ + '3', 0x00, '}', 0x00, 0x00, 0x00, 0x00, 0x00 + +#define CDC_ACM_DESCRIPTOR_LENGTH 160 + +struct msosv2_descriptor { + struct msosv2_descriptor_set_header header; +#if defined(CONFIG_USBD_CDC_ACM_CLASS) + /* + * The composition of this descriptor is specific to the WebUSB example + * in its default configuration. If you use it for your application or + * change the configuration, you may need to modify this descriptor for + * your USB device. The following only covers the case where the CDC + * ACM implementation is enabled, and there is only one CDC ACM UART + * instance, and the CDC ACM communication interface is the first in + * the configuration. + */ + struct msosv2_function_subset_header subset_header; +#endif + struct msosv2_compatible_id compatible_id; + struct msosv2_guids_property guids_property; +} __packed; + +static struct msosv2_descriptor msosv2_desc = { + .header = { + .wLength = sizeof(struct msosv2_descriptor_set_header), + .wDescriptorType = MS_OS_20_SET_HEADER_DESCRIPTOR, + .dwWindowsVersion = sys_cpu_to_le32(SAMPLE_MSOS2_OS_VERSION), + .wTotalLength = sizeof(msosv2_desc), + }, +#if defined(CONFIG_USBD_CDC_ACM_CLASS) + .subset_header = { + .wLength = sizeof(struct msosv2_function_subset_header), + .wDescriptorType = MS_OS_20_SUBSET_HEADER_FUNCTION, + .bFirstInterface = 0, + .wSubsetLength = CDC_ACM_DESCRIPTOR_LENGTH, + }, +#endif + .compatible_id = { + .wLength = sizeof(struct msosv2_compatible_id), + .wDescriptorType = MS_OS_20_FEATURE_COMPATIBLE_ID, + .CompatibleID = {'W', 'I', 'N', 'U', 'S', 'B', 0x00, 0x00}, + }, + .guids_property = { + .wLength = sizeof(struct msosv2_guids_property), + .wDescriptorType = MS_OS_20_FEATURE_REG_PROPERTY, + .wPropertyDataType = MS_OS_20_PROPERTY_DATA_REG_MULTI_SZ, + .wPropertyNameLength = 42, + .PropertyName = {DEVICE_INTERFACE_GUIDS_PROPERTY_NAME}, + .wPropertyDataLength = 80, + .bPropertyData = {WEBUSB_DEVICE_INTERFACE_GUID}, + }, +}; + +struct bos_msosv2_descriptor { + struct usb_bos_platform_descriptor platform; + struct usb_bos_capability_msos cap; +} __packed; + +struct bos_msosv2_descriptor bos_msosv2_desc = { + /* + * Microsoft OS 2.0 Platform Capability Descriptor, + * see Microsoft OS 2.0 Descriptors Specification + */ + .platform = { + .bLength = sizeof(struct usb_bos_platform_descriptor) + + sizeof(struct usb_bos_capability_msos), + .bDescriptorType = USB_DESC_DEVICE_CAPABILITY, + .bDevCapabilityType = USB_BOS_CAPABILITY_PLATFORM, + .bReserved = 0, + /* Microsoft OS 2.0 descriptor platform capability UUID + * D8DD60DF-4589-4CC7-9CD2-659D9E648A9F + */ + .PlatformCapabilityUUID = { + 0xDF, 0x60, 0xDD, 0xD8, + 0x89, 0x45, + 0xC7, 0x4C, + 0x9C, 0xD2, + 0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F, + }, + }, + .cap = { + .dwWindowsVersion = sys_cpu_to_le32(SAMPLE_MSOS2_OS_VERSION), + .wMSOSDescriptorSetTotalLength = sys_cpu_to_le16(sizeof(msosv2_desc)), + .bMS_VendorCode = SAMPLE_MSOS2_VENDOR_CODE, + .bAltEnumCode = 0x00 + }, +}; + +static int msosv2_to_host_cb(const struct usbd_context *const ctx, + const struct usb_setup_packet *const setup, + struct net_buf *const buf) +{ + LOG_INF("Vendor callback to host"); + + if (setup->bRequest == SAMPLE_MSOS2_VENDOR_CODE && + setup->wIndex == MS_OS_20_DESCRIPTOR_INDEX) { + LOG_INF("Get MS OS 2.0 Descriptor Set"); + + net_buf_add_mem(buf, &msosv2_desc, + MIN(net_buf_tailroom(buf), sizeof(msosv2_desc))); + + return 0; + } + + return -ENOTSUP; +} + +USBD_DESC_BOS_VREQ_DEFINE(bos_vreq_msosv2, sizeof(bos_msosv2_desc), &bos_msosv2_desc, + SAMPLE_MSOS2_VENDOR_CODE, msosv2_to_host_cb, NULL); + +#endif /* ZEPHYR_INCLUDE_MSOSV2_DESCRIPTOR_H */ diff --git a/samples/subsys/usb/webusb-next/src/sfunc.c b/samples/subsys/usb/webusb-next/src/sfunc.c new file mode 100644 index 0000000000000..d20482e429ad0 --- /dev/null +++ b/samples/subsys/usb/webusb-next/src/sfunc.c @@ -0,0 +1,274 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +LOG_MODULE_REGISTER(sfunc, LOG_LEVEL_INF); + +#include +#include +#include + +/* + * This file implements a simple USB function that echoes received data back to + * the host using bulk endpoints. + */ + +NET_BUF_POOL_FIXED_DEFINE(sfunc_pool, + 1, 0, sizeof(struct udc_buf_info), NULL); + +static uint8_t __aligned(sizeof(void *)) sfunc_buf[512]; + +struct sfunc_desc { + struct usb_if_descriptor if0; + struct usb_ep_descriptor if0_out_ep; + struct usb_ep_descriptor if0_in_ep; + struct usb_ep_descriptor if0_hs_out_ep; + struct usb_ep_descriptor if0_hs_in_ep; + struct usb_desc_header nil_desc; +}; + +#define SAMPLE_FUNCTION_ENABLED 0 + +struct sfunc_data { + struct sfunc_desc *const desc; + const struct usb_desc_header **const fs_desc; + const struct usb_desc_header **const hs_desc; + atomic_t state; +}; + +static uint8_t sfunc_get_bulk_out(struct usbd_class_data *const c_data) +{ + struct sfunc_data *data = usbd_class_get_private(c_data); + struct usbd_context *uds_ctx = usbd_class_get_ctx(c_data); + struct sfunc_desc *desc = data->desc; + + if (usbd_bus_speed(uds_ctx) == USBD_SPEED_HS) { + return desc->if0_hs_out_ep.bEndpointAddress; + } + + return desc->if0_out_ep.bEndpointAddress; +} + +static uint8_t sfunc_get_bulk_in(struct usbd_class_data *const c_data) +{ + struct sfunc_data *data = usbd_class_get_private(c_data); + struct usbd_context *uds_ctx = usbd_class_get_ctx(c_data); + struct sfunc_desc *desc = data->desc; + + if (usbd_bus_speed(uds_ctx) == USBD_SPEED_HS) { + return desc->if0_hs_in_ep.bEndpointAddress; + } + + return desc->if0_in_ep.bEndpointAddress; +} + +static int sfunc_request_handler(struct usbd_class_data *c_data, + struct net_buf *buf, int err) +{ + struct usbd_context *uds_ctx = usbd_class_get_ctx(c_data); + struct sfunc_data *data = usbd_class_get_private(c_data); + struct udc_buf_info *bi = NULL; + + bi = (struct udc_buf_info *)net_buf_user_data(buf); + LOG_INF("Transfer finished %p -> ep 0x%02x, len %u, err %d", + (void *)c_data, bi->ep, buf->len, err); + + if (atomic_test_bit(&data->state, SAMPLE_FUNCTION_ENABLED) && err == 0) { + uint8_t ep = bi->ep; + + memset(bi, 0, sizeof(struct udc_buf_info)); + + if (ep == sfunc_get_bulk_in(c_data)) { + bi->ep = sfunc_get_bulk_out(c_data); + net_buf_reset(buf); + } else { + bi->ep = sfunc_get_bulk_in(c_data); + } + + if (usbd_ep_enqueue(c_data, buf)) { + LOG_ERR("Failed to enqueue buffer"); + usbd_ep_buf_free(uds_ctx, buf); + } + } else { + LOG_ERR("Function is disabled or transfer failed"); + usbd_ep_buf_free(uds_ctx, buf); + } + + return 0; +} + +static void *sfunc_get_desc(struct usbd_class_data *const c_data, + const enum usbd_speed speed) +{ + struct sfunc_data *data = usbd_class_get_private(c_data); + + if (speed == USBD_SPEED_HS) { + return data->hs_desc; + } + + return data->fs_desc; +} + +struct net_buf *sfunc_buf_alloc(struct usbd_class_data *const c_data, + const uint8_t ep) +{ + struct usbd_context *uds_ctx = usbd_class_get_ctx(c_data); + struct net_buf *buf = NULL; + struct udc_buf_info *bi; + size_t size; + + if (usbd_bus_speed(uds_ctx) == USBD_SPEED_HS) { + size = 512U; + } else { + size = 64U; + } + + buf = net_buf_alloc_with_data(&sfunc_pool, sfunc_buf, size, K_NO_WAIT); + net_buf_reset(buf); + if (!buf) { + return NULL; + } + + bi = udc_get_buf_info(buf); + memset(bi, 0, sizeof(struct udc_buf_info)); + bi->ep = ep; + + return buf; +} + +static void sfunc_enable(struct usbd_class_data *const c_data) +{ + struct sfunc_data *data = usbd_class_get_private(c_data); + struct usbd_context *uds_ctx = usbd_class_get_ctx(c_data); + struct net_buf *buf; + + LOG_INF("Configuration enabled"); + + if (!atomic_test_and_set_bit(&data->state, SAMPLE_FUNCTION_ENABLED)) { + buf = sfunc_buf_alloc(c_data, sfunc_get_bulk_out(c_data)); + if (buf == NULL) { + LOG_ERR("Failed to allocate buffer"); + return; + } + + if (usbd_ep_enqueue(c_data, buf)) { + LOG_ERR("Failed to enqueue buffer"); + usbd_ep_buf_free(uds_ctx, buf); + } + } +} + +static void sfunc_disable(struct usbd_class_data *const c_data) +{ + struct sfunc_data *data = usbd_class_get_private(c_data); + + atomic_clear_bit(&data->state, SAMPLE_FUNCTION_ENABLED); + LOG_INF("Configuration disabled"); +} + +static int sfunc_init(struct usbd_class_data *c_data) +{ + LOG_DBG("Init class instance %p", (void *)c_data); + + return 0; +} + +struct usbd_class_api sfunc_api = { + .request = sfunc_request_handler, + .get_desc = sfunc_get_desc, + .enable = sfunc_enable, + .disable = sfunc_disable, + .init = sfunc_init, +}; + +#define SFUNC_DESCRIPTOR_DEFINE(n, _) \ +static struct sfunc_desc sfunc_desc_##n = { \ + /* Interface descriptor 0 */ \ + .if0 = { \ + .bLength = sizeof(struct usb_if_descriptor), \ + .bDescriptorType = USB_DESC_INTERFACE, \ + .bInterfaceNumber = 0, \ + .bAlternateSetting = 0, \ + .bNumEndpoints = 2, \ + .bInterfaceClass = USB_BCC_VENDOR, \ + .bInterfaceSubClass = 0, \ + .bInterfaceProtocol = 0, \ + .iInterface = 0, \ + }, \ + \ + /* Endpoint OUT */ \ + .if0_out_ep = { \ + .bLength = sizeof(struct usb_ep_descriptor), \ + .bDescriptorType = USB_DESC_ENDPOINT, \ + .bEndpointAddress = 0x01, \ + .bmAttributes = USB_EP_TYPE_BULK, \ + .wMaxPacketSize = sys_cpu_to_le16(64U), \ + .bInterval = 0x00, \ + }, \ + \ + /* Endpoint IN */ \ + .if0_in_ep = { \ + .bLength = sizeof(struct usb_ep_descriptor), \ + .bDescriptorType = USB_DESC_ENDPOINT, \ + .bEndpointAddress = 0x81, \ + .bmAttributes = USB_EP_TYPE_BULK, \ + .wMaxPacketSize = sys_cpu_to_le16(64U), \ + .bInterval = 0x00, \ + }, \ + \ + /* High-speed Endpoint OUT */ \ + .if0_hs_out_ep = { \ + .bLength = sizeof(struct usb_ep_descriptor), \ + .bDescriptorType = USB_DESC_ENDPOINT, \ + .bEndpointAddress = 0x01, \ + .bmAttributes = USB_EP_TYPE_BULK, \ + .wMaxPacketSize = sys_cpu_to_le16(512), \ + .bInterval = 0x00, \ + }, \ + \ + /* High-speed Endpoint IN */ \ + .if0_hs_in_ep = { \ + .bLength = sizeof(struct usb_ep_descriptor), \ + .bDescriptorType = USB_DESC_ENDPOINT, \ + .bEndpointAddress = 0x81, \ + .bmAttributes = USB_EP_TYPE_BULK, \ + .wMaxPacketSize = sys_cpu_to_le16(512), \ + .bInterval = 0x00, \ + }, \ + \ + /* Termination descriptor */ \ + .nil_desc = { \ + .bLength = 0, \ + .bDescriptorType = 0, \ + }, \ +}; \ + \ +const static struct usb_desc_header *sfunc_fs_desc_##n[] = { \ + (struct usb_desc_header *) &sfunc_desc_##n.if0, \ + (struct usb_desc_header *) &sfunc_desc_##n.if0_in_ep, \ + (struct usb_desc_header *) &sfunc_desc_##n.if0_out_ep, \ + (struct usb_desc_header *) &sfunc_desc_##n.nil_desc, \ +}; \ + \ +const static struct usb_desc_header *sfunc_hs_desc_##n[] = { \ + (struct usb_desc_header *) &sfunc_desc_##n.if0, \ + (struct usb_desc_header *) &sfunc_desc_##n.if0_hs_in_ep, \ + (struct usb_desc_header *) &sfunc_desc_##n.if0_hs_out_ep, \ + (struct usb_desc_header *) &sfunc_desc_##n.nil_desc, \ +}; + + +#define SFUNC_FUNCTION_DATA_DEFINE(n, _) \ + static struct sfunc_data sfunc_data_##n = { \ + .desc = &sfunc_desc_##n, \ + .fs_desc = sfunc_fs_desc_##n, \ + .hs_desc = sfunc_hs_desc_##n, \ + }; \ + \ + USBD_DEFINE_CLASS(sfunc_##n, &sfunc_api, &sfunc_data_##n, NULL); + +LISTIFY(1, SFUNC_DESCRIPTOR_DEFINE, ()) +LISTIFY(1, SFUNC_FUNCTION_DATA_DEFINE, ()) diff --git a/samples/subsys/usb/webusb-next/src/webusb.h b/samples/subsys/usb/webusb-next/src/webusb.h new file mode 100644 index 0000000000000..329626d4587b6 --- /dev/null +++ b/samples/subsys/usb/webusb-next/src/webusb.h @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2016-2019 Intel Corporation + * Copyright (c) 2023-2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_WEBUSB_DESCRIPTOR_H +#define ZEPHYR_INCLUDE_WEBUSB_DESCRIPTOR_H + +/* + * WebUSB platform capability and WebUSB URL descriptor. + * See https://wicg.github.io/webusb for reference. + */ + +#define WEBUSB_REQ_GET_URL 0x02U +#define WEBUSB_DESC_TYPE_URL 0x03U +#define WEBUSB_URL_PREFIX_HTTP 0x00U +#define WEBUSB_URL_PREFIX_HTTPS 0x01U + +#define SAMPLE_WEBUSB_VENDOR_CODE 0x01U +#define SAMPLE_WEBUSB_LANDING_PAGE 0x01U + +struct usb_bos_webusb_desc { + struct usb_bos_platform_descriptor platform; + struct usb_bos_capability_webusb cap; +} __packed; + +static const struct usb_bos_webusb_desc bos_cap_webusb = { + /* WebUSB Platform Capability Descriptor: + * https://wicg.github.io/webusb/#webusb-platform-capability-descriptor + */ + .platform = { + .bLength = sizeof(struct usb_bos_platform_descriptor) + + sizeof(struct usb_bos_capability_webusb), + .bDescriptorType = USB_DESC_DEVICE_CAPABILITY, + .bDevCapabilityType = USB_BOS_CAPABILITY_PLATFORM, + .bReserved = 0, + /* WebUSB Platform Capability UUID + * 3408b638-09a9-47a0-8bfd-a0768815b665 + */ + .PlatformCapabilityUUID = { + 0x38, 0xB6, 0x08, 0x34, + 0xA9, 0x09, + 0xA0, 0x47, + 0x8B, 0xFD, + 0xA0, 0x76, 0x88, 0x15, 0xB6, 0x65, + }, + }, + .cap = { + .bcdVersion = sys_cpu_to_le16(0x0100), + .bVendorCode = SAMPLE_WEBUSB_VENDOR_CODE, + .iLandingPage = SAMPLE_WEBUSB_LANDING_PAGE + } +}; + +/* WebUSB URL Descriptor, see https://wicg.github.io/webusb/#webusb-descriptors */ +static const uint8_t webusb_origin_url[] = { + /* bLength, bDescriptorType, bScheme, UTF-8 encoded URL */ + 0x11, WEBUSB_DESC_TYPE_URL, WEBUSB_URL_PREFIX_HTTP, + 'l', 'o', 'c', 'a', 'l', 'h', 'o', 's', 't', ':', '8', '0', '0', '0' +}; + +static int webusb_to_host_cb(const struct usbd_context *const ctx, + const struct usb_setup_packet *const setup, + struct net_buf *const buf) +{ + LOG_INF("Vendor callback to host"); + + if (setup->wIndex == WEBUSB_REQ_GET_URL) { + uint8_t index = USB_GET_DESCRIPTOR_INDEX(setup->wValue); + + if (index != SAMPLE_WEBUSB_LANDING_PAGE) { + return -ENOTSUP; + } + + LOG_INF("Get URL request, index %u", index); + net_buf_add_mem(buf, &webusb_origin_url, + MIN(net_buf_tailroom(buf), sizeof(webusb_origin_url))); + + return 0; + } + + return -ENOTSUP; +} + +USBD_DESC_BOS_VREQ_DEFINE(bos_vreq_webusb, sizeof(bos_cap_webusb), &bos_cap_webusb, + SAMPLE_WEBUSB_VENDOR_CODE, webusb_to_host_cb, NULL); + +#endif /* ZEPHYR_INCLUDE_WEBUSB_DESCRIPTOR_H */ From 01ff1de91a24543d33bbf7dbf2801db2fb2527df Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 18 Nov 2024 19:51:49 -0500 Subject: [PATCH 2806/4482] ci: testplan: resolve board files when testing with targets When using the -p option, changes to boards are irrelevant. This is true in the clang workflow. Signed-off-by: Anas Nashif --- scripts/ci/test_plan.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/ci/test_plan.py b/scripts/ci/test_plan.py index dfc8736819878..14fe54fdd3589 100755 --- a/scripts/ci/test_plan.py +++ b/scripts/ci/test_plan.py @@ -125,6 +125,11 @@ def process(self): if not self.platforms: self.find_archs() self.find_boards() + else: + for file in self.modified_files: + if file.startswith(("boards/", "dts/")): + self.resolved_files.append(file) + self.find_excludes() def get_plan(self, options, integration=False, use_testsuite_root=True): From cfd5469dc14316e1f80940447b0689b108bc94d2 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 19 Nov 2024 08:05:30 -0500 Subject: [PATCH 2807/4482] ci: do not pull babblesim in twister test workflow No need to pull babblesim and nrf_hw_models when doing twister testing. Signed-off-by: Anas Nashif --- .github/workflows/twister_tests_blackbox.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/twister_tests_blackbox.yml b/.github/workflows/twister_tests_blackbox.yml index f2f64e66a8997..cd24a2a39aea6 100644 --- a/.github/workflows/twister_tests_blackbox.yml +++ b/.github/workflows/twister_tests_blackbox.yml @@ -44,7 +44,8 @@ jobs: west init -l . || true # we do not depend on any hals, tools or bootloader, save some time and space... - west config manifest.group-filter -- -hal,-tools,-bootloader + west config manifest.group-filter -- -hal,-tools,-bootloader,-babblesim + west config manifest.project-filter -- -nrf_hw_models west config --global update.narrow true west update --path-cache /github/cache/zephyrproject 2>&1 1> west.update.log || west update --path-cache /github/cache/zephyrproject 2>&1 1> west.update.log || ( rm -rf ../modules ../bootloader ../tools && west update --path-cache /github/cache/zephyrproject) west forall -c 'git reset --hard HEAD' From 17a81280b2e237ba8d2becb673d0dd731642cb2d Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Thu, 24 Oct 2024 14:16:00 +0200 Subject: [PATCH 2808/4482] soc: nordic: nrf54l15: fix APPROTECT handling To configure APPROTECT on nRF54L15 different set of MDK symbols must be used. Additionally, nRF54L15 does not support loading APPROTECT configuration from the UICR in runtime. Signed-off-by: Nikodem Kastelik --- modules/hal_nordic/nrfx/CMakeLists.txt | 9 ++++++--- soc/nordic/Kconfig | 24 +++++++++++++++++++++--- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index b807520ec5464..f9abcd0a0c2da 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -64,11 +64,14 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9230_ENGB_CPUPPR NRF9230_ENGB_XXA zephyr_compile_definitions_ifdef(CONFIG_NRF_APPROTECT_LOCK ENABLE_APPROTECT) zephyr_compile_definitions_ifdef(CONFIG_NRF_APPROTECT_USER_HANDLING - ENABLE_APPROTECT_USER_HANDLING) + ENABLE_APPROTECT_USER_HANDLING + ENABLE_AUTHENTICATED_APPROTECT) zephyr_compile_definitions_ifdef(CONFIG_NRF_SECURE_APPROTECT_LOCK - ENABLE_SECURE_APPROTECT) + ENABLE_SECURE_APPROTECT + ENABLE_SECUREAPPROTECT) zephyr_compile_definitions_ifdef(CONFIG_NRF_SECURE_APPROTECT_USER_HANDLING - ENABLE_SECURE_APPROTECT_USER_HANDLING) + ENABLE_SECURE_APPROTECT_USER_HANDLING + ENABLE_AUTHENTICATED_SECUREAPPROTECT) zephyr_library_compile_definitions_ifdef(CONFIG_NRF_TRACE_PORT ENABLE_TRACE) diff --git a/soc/nordic/Kconfig b/soc/nordic/Kconfig index a13642172aa7b..a3cc7381cb404 100644 --- a/soc/nordic/Kconfig +++ b/soc/nordic/Kconfig @@ -99,15 +99,24 @@ config NFCT_PINS_AS_GPIOS choice NRF_APPROTECT_HANDLING bool "APPROTECT handling" - depends on SOC_SERIES_NRF52X || SOC_NRF5340_CPUNET || \ - SOC_NRF5340_CPUAPP || SOC_SERIES_NRF91X + depends on SOC_SERIES_NRF52X || SOC_SERIES_NRF53X || SOC_NRF54L15_CPUAPP || \ + SOC_SERIES_NRF91X + default NRF_APPROTECT_DISABLE if SOC_NRF54L15_CPUAPP default NRF_APPROTECT_USE_UICR help Specifies how the SystemInit() function should handle the APPROTECT mechanism. +config NRF_APPROTECT_DISABLE + bool "Disable" + depends on SOC_NRF54L15_CPUAPP + help + When this option is selected, the SystemInit() disables + the APPROTECT mechanism. + config NRF_APPROTECT_USE_UICR bool "Use UICR" + depends on SOC_SERIES_NRF52X || SOC_SERIES_NRF53X || SOC_SERIES_NRF91X help When this option is selected, the SystemInit() function loads the firmware branch state of the APPROTECT mechanism from UICR, so if @@ -132,14 +141,23 @@ endchoice choice NRF_SECURE_APPROTECT_HANDLING bool "Secure APPROTECT handling" - depends on SOC_NRF5340_CPUAPP || SOC_SERIES_NRF91X + depends on SOC_NRF5340_CPUAPP || SOC_NRF54L15_CPUAPP || SOC_SERIES_NRF91X + default NRF_SECURE_APPROTECT_DISABLE if SOC_NRF54L15_CPUAPP default NRF_SECURE_APPROTECT_USE_UICR help Specifies how the SystemInit() function should handle the secure APPROTECT mechanism. +config NRF_SECURE_APPROTECT_DISABLE + bool "Disable" + depends on SOC_NRF54L15_CPUAPP + help + When this option is selected, the SystemInit() disables + the secure APPROTECT mechanism. + config NRF_SECURE_APPROTECT_USE_UICR bool "Use UICR" + depends on SOC_NRF5340_CPUAPP || SOC_SERIES_NRF91X help When this option is selected, the SystemInit() function loads the firmware branch state of the secure APPROTECT mechanism from UICR, From b7fb1012b02aeb74db34e36d4446664e5922b663 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Wed, 30 Oct 2024 16:11:11 +0100 Subject: [PATCH 2809/4482] soc: nordic: nrf54l: fix configuration of DCDC regulator DCDC regulator on nRF54L may not always works as intended. Apply a fix addressing that. Signed-off-by: Nikodem Kastelik --- soc/nordic/nrf54l/soc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/soc/nordic/nrf54l/soc.c b/soc/nordic/nrf54l/soc.c index f70675517b8ea..840d767f7982e 100644 --- a/soc/nordic/nrf54l/soc.c +++ b/soc/nordic/nrf54l/soc.c @@ -153,6 +153,11 @@ static int nordicsemi_nrf54l_init(void) } #if (DT_PROP(DT_NODELABEL(vregmain), regulator_initial_mode) == NRF5X_REG_MODE_DCDC) +#if defined(__CORTEX_M) && !defined(NRF_TRUSTZONE_NONSECURE) && defined(__ARM_FEATURE_CMSE) + if (*(uint32_t *)0x00FFC334 <= 0x180A1D00) { + *(uint32_t *)0x50120640 = 0x1FAAE85C; + } +#endif nrf_regulators_vreg_enable_set(NRF_REGULATORS, NRF_REGULATORS_VREG_MAIN, true); #endif From 5f6fc8ad5d050dfd0c0e2b32d3f85ef5127267b0 Mon Sep 17 00:00:00 2001 From: Nikodem Kastelik Date: Mon, 4 Nov 2024 10:56:54 +0100 Subject: [PATCH 2810/4482] soc: nordic: nrf54l: tune configuration of DCDC regulator DCDC regulator on nRF54L may not always works as intended. Tune the fix addressing that. Signed-off-by: Nikodem Kastelik --- soc/nordic/nrf54l/soc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soc/nordic/nrf54l/soc.c b/soc/nordic/nrf54l/soc.c index 840d767f7982e..b0ed4ba0ef79b 100644 --- a/soc/nordic/nrf54l/soc.c +++ b/soc/nordic/nrf54l/soc.c @@ -154,8 +154,8 @@ static int nordicsemi_nrf54l_init(void) #if (DT_PROP(DT_NODELABEL(vregmain), regulator_initial_mode) == NRF5X_REG_MODE_DCDC) #if defined(__CORTEX_M) && !defined(NRF_TRUSTZONE_NONSECURE) && defined(__ARM_FEATURE_CMSE) - if (*(uint32_t *)0x00FFC334 <= 0x180A1D00) { - *(uint32_t *)0x50120640 = 0x1FAAE85C; + if (*(uint32_t volatile *)0x00FFC334 <= 0x180A1D00) { + *(uint32_t volatile *)0x50120640 = 0x1EA9E040; } #endif nrf_regulators_vreg_enable_set(NRF_REGULATORS, NRF_REGULATORS_VREG_MAIN, true); From c6b663e50bb3906d5c84ba7a88ad4cdaa16d034b Mon Sep 17 00:00:00 2001 From: Fabian Kainka Date: Fri, 15 Nov 2024 10:56:25 +0100 Subject: [PATCH 2811/4482] drivers: modem: initialize variables to avoid warn The variables 'first' and 'next' in function 'stats_buffer_list_first()' and 'stats_buffer_list_next()' were potentially used uninitialized. Depending on the compiler and target architecture, this can lead to different behavior, including warnings or errors when using strict warning flags. By initializing these pointers to 'NULL', we ensure consistent and expected behavior across all toolchains and configurations. Signed-off-by: Fabian Kainka --- subsys/modem/modem_stats.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/modem/modem_stats.c b/subsys/modem/modem_stats.c index 2ab90d3be6ee4..e1790cb815a3c 100644 --- a/subsys/modem/modem_stats.c +++ b/subsys/modem/modem_stats.c @@ -32,7 +32,7 @@ static void stats_buffer_list_append(struct modem_stats_buffer *buffer) static struct modem_stats_buffer *stats_buffer_list_first(void) { - struct modem_stats_buffer *first; + struct modem_stats_buffer *first = NULL; K_SPINLOCK(&stats_buffer_lock) { first = stats_buffer_from_node(sys_slist_peek_head(&stats_buffer_list)); @@ -43,7 +43,7 @@ static struct modem_stats_buffer *stats_buffer_list_first(void) static struct modem_stats_buffer *stats_buffer_list_next(struct modem_stats_buffer *buffer) { - struct modem_stats_buffer *next; + struct modem_stats_buffer *next = NULL; K_SPINLOCK(&stats_buffer_lock) { next = stats_buffer_from_node(sys_slist_peek_next(&buffer->node)); From 9917ea4fe6b4a74d3cf262c159893c0bfa32c013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 15 Nov 2024 15:38:25 +0100 Subject: [PATCH 2812/4482] logging: formatting: Allow coloring in custom cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to support error and warning message coloring LOG_BACKEND_SHOW_COLOR must be set. Allow setting it for customized cases. Signed-off-by: Krzysztof Chruściński --- subsys/logging/Kconfig.formatting | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/subsys/logging/Kconfig.formatting b/subsys/logging/Kconfig.formatting index 58ca9bbeccae3..609b3c4178607 100644 --- a/subsys/logging/Kconfig.formatting +++ b/subsys/logging/Kconfig.formatting @@ -134,9 +134,8 @@ config LOG_IMMEDIATE_CLEAN_OUTPUT config LOG_BACKEND_SHOW_COLOR bool "Colors in the backend" - depends on LOG_BACKEND_UART || LOG_BACKEND_NATIVE_POSIX || LOG_BACKEND_RTT \ + default y if LOG_BACKEND_UART || LOG_BACKEND_NATIVE_POSIX || LOG_BACKEND_RTT \ || LOG_BACKEND_SWO || LOG_BACKEND_XTENSA_SIM || SHELL_LOG_BACKEND - default y help When enabled selected backend prints errors in red and warning in yellow. From d231b459dfd09110fc5185dbc917c5ad3576e112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 15 Nov 2024 15:55:03 +0100 Subject: [PATCH 2813/4482] drivers: misc: coresight: Enable log colors for STMESP logging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow coloring of error and warning messages decoded by the ETR decoder. Signed-off-by: Krzysztof Chruściński --- drivers/misc/coresight/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/coresight/Kconfig b/drivers/misc/coresight/Kconfig index 17741114e849e..997d0c23c0a54 100644 --- a/drivers/misc/coresight/Kconfig +++ b/drivers/misc/coresight/Kconfig @@ -23,6 +23,7 @@ config NRF_ETR_DECODE select CS_TRACE_DEFMT select LOG_FRONTEND_STMESP_DEMUX select LOG_OUTPUT + imply LOG_BACKEND_SHOW_COLOR imply CBPRINTF_FP_SUPPORT help In this mode, log messages stored by Coresight STM logging frontends are From 665a555e756a953abf90723b1591f04bedf721bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Tue, 19 Nov 2024 09:49:55 +0100 Subject: [PATCH 2814/4482] Bluetooth: Mesh: Use relay bufs/pool for brg_cfg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds support for using relay buffers and advertising set for the subnet bridge feature, even if the relay feature is disabled. Signed-off-by: Håvard Reierstad --- doc/connectivity/bluetooth/api/mesh/brg_cfg.rst | 15 +++++++++------ subsys/bluetooth/mesh/Kconfig | 11 +++++++++-- subsys/bluetooth/mesh/adv.c | 12 ++++++------ subsys/bluetooth/mesh/adv_ext.c | 4 ++-- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/doc/connectivity/bluetooth/api/mesh/brg_cfg.rst b/doc/connectivity/bluetooth/api/mesh/brg_cfg.rst index d6e7462c546d2..8cac03ded6afd 100644 --- a/doc/connectivity/bluetooth/api/mesh/brg_cfg.rst +++ b/doc/connectivity/bluetooth/api/mesh/brg_cfg.rst @@ -113,13 +113,16 @@ protection to ensure network security. Key considerations to take into account a Relay buffer considerations =========================== -When a message is relayed between subnets by a Subnet Bridge, it is allocated from the relay buffer. -To ensure that messages can be retransmitted to all subnetworks, -the :kconfig:option:`CONFIG_BT_MESH_RELAY_BUF_COUNT` option should be increased accordingly. +When a message is relayed between subnets by a Subnet Bridge, it is allocated from the relay buffer +pool. The number of relay buffers are configurable using the +:kconfig:option:`CONFIG_BT_MESH_RELAY_BUF_COUNT` Kconfig option. -However, if the :kconfig:option:`CONFIG_BT_MESH_RELAY` feature is disabled, the messages will be -allocated from the advertising buffer instead. In this case, increase the -:kconfig:option:`CONFIG_BT_MESH_ADV_BUF_COUNT` option to allow for sufficient buffer space. +When :kconfig:option:`CONFIG_BT_MESH_ADV_EXT` is enabled, messages will be transmitted using the +relay advertising sets. The number of advertising sets are configurable using the +:kconfig:option:`CONFIG_BT_MESH_RELAY_ADV_SETS` Kconfig option. + +Both the relay buffer pool and advertising sets can be used even if the relay feature +:kconfig:option:`CONFIG_BT_MESH_RELAY` is disabled. Replay protection and Bridging Table ==================================== diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index e300e18d799ea..530f3a4fdb401 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -165,11 +165,13 @@ config BT_MESH_RELAY_ADV_SETS int "Maximum of simultaneous relay message support" default 0 range 0 BT_EXT_ADV_MAX_ADV_SET - depends on BT_MESH_RELAY + depends on BT_MESH_RELAY || BT_MESH_BRG_CFG_SRV help Maximum of simultaneous relay message support. Requires controller support multiple advertising sets. + Note that: The Subnet Bridge feature uses the relay advertising sets. + config BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET bool "Use the main advertising set to relay messages" depends on BT_MESH_RELAY_ADV_SETS > 0 @@ -471,8 +473,11 @@ config BT_MESH_RELAY_RETRANSMIT_INTERVAL messages, in milliseconds. Can be changed through runtime configuration. +endif # BT_MESH_RELAY + config BT_MESH_RELAY_BUF_COUNT int "Number of advertising buffers for relayed messages" + depends on BT_MESH_RELAY || BT_MESH_BRG_CFG_SRV default 32 range 1 256 help @@ -486,7 +491,9 @@ config BT_MESH_RELAY_BUF_COUNT BT_MESH_RELAY_ADV_SETS allows the increase in the number of buffers while maintaining the latency. -endif # BT_MESH_RELAY + Note that: The Subnet Bridge feature uses the relay advertising buffers. If both the Relay + feature and the Subnet Bridge feature is enabled, the added load should be taken into + account. endmenu # Network layer diff --git a/subsys/bluetooth/mesh/adv.c b/subsys/bluetooth/mesh/adv.c index 2f406e52f9ac9..8637aef349253 100644 --- a/subsys/bluetooth/mesh/adv.c +++ b/subsys/bluetooth/mesh/adv.c @@ -137,7 +137,7 @@ void bt_mesh_adv_unref(struct bt_mesh_adv *adv) struct k_mem_slab *slab = &local_adv_pool; -#if defined(CONFIG_BT_MESH_RELAY) +#if (defined(CONFIG_BT_MESH_RELAY) || defined(CONFIG_BT_MESH_BRG_CFG_SRV)) if (adv->ctx.tag == BT_MESH_ADV_TAG_RELAY) { slab = &relay_adv_pool; } @@ -156,7 +156,7 @@ struct bt_mesh_adv *bt_mesh_adv_create(enum bt_mesh_adv_type type, enum bt_mesh_adv_tag tag, uint8_t xmit, k_timeout_t timeout) { -#if defined(CONFIG_BT_MESH_RELAY) +#if (defined(CONFIG_BT_MESH_RELAY) || defined(CONFIG_BT_MESH_BRG_CFG_SRV)) if (tag == BT_MESH_ADV_TAG_RELAY) { return adv_create_from_pool(&relay_adv_pool, type, tag, xmit, timeout); @@ -202,7 +202,7 @@ struct bt_mesh_adv *bt_mesh_adv_get(k_timeout_t timeout) K_POLL_MODE_NOTIFY_ONLY, &bt_mesh_adv_queue, 0), -#if defined(CONFIG_BT_MESH_RELAY) && \ +#if (defined(CONFIG_BT_MESH_RELAY) || defined(CONFIG_BT_MESH_BRG_CFG_SRV)) && \ (defined(CONFIG_BT_MESH_ADV_LEGACY) || \ defined(CONFIG_BT_MESH_ADV_EXT_RELAY_USING_MAIN_ADV_SET) || \ !(CONFIG_BT_MESH_RELAY_ADV_SETS)) @@ -228,7 +228,7 @@ struct bt_mesh_adv *bt_mesh_adv_get_by_tag(enum bt_mesh_adv_tag_bit tags, k_time return k_fifo_get(&bt_mesh_friend_queue, timeout); } - if (IS_ENABLED(CONFIG_BT_MESH_RELAY) && + if ((IS_ENABLED(CONFIG_BT_MESH_RELAY) || IS_ENABLED(CONFIG_BT_MESH_BRG_CFG_SRV)) && !(tags & BT_MESH_ADV_TAG_BIT_LOCAL)) { return k_fifo_get(&bt_mesh_relay_queue, timeout); } @@ -247,7 +247,7 @@ void bt_mesh_adv_get_cancel(void) k_fifo_cancel_wait(&bt_mesh_adv_queue); - if (IS_ENABLED(CONFIG_BT_MESH_RELAY)) { + if ((IS_ENABLED(CONFIG_BT_MESH_RELAY) || IS_ENABLED(CONFIG_BT_MESH_BRG_CFG_SRV))) { k_fifo_cancel_wait(&bt_mesh_relay_queue); } @@ -281,7 +281,7 @@ void bt_mesh_adv_send(struct bt_mesh_adv *adv, const struct bt_mesh_send_cb *cb, return; } - if ((IS_ENABLED(CONFIG_BT_MESH_RELAY) && + if (((IS_ENABLED(CONFIG_BT_MESH_RELAY) || IS_ENABLED(CONFIG_BT_MESH_BRG_CFG_SRV)) && adv->ctx.tag == BT_MESH_ADV_TAG_RELAY) || (IS_ENABLED(CONFIG_BT_MESH_PB_ADV_USE_RELAY_SETS) && adv->ctx.tag == BT_MESH_ADV_TAG_PROV)) { diff --git a/subsys/bluetooth/mesh/adv_ext.c b/subsys/bluetooth/mesh/adv_ext.c index 2f790f5bc162e..367d42ee28bc5 100644 --- a/subsys/bluetooth/mesh/adv_ext.c +++ b/subsys/bluetooth/mesh/adv_ext.c @@ -108,9 +108,9 @@ static struct bt_mesh_ext_adv advs[] = { #if CONFIG_BT_MESH_RELAY_ADV_SETS [1 ... CONFIG_BT_MESH_RELAY_ADV_SETS] = { .tags = ( -#if defined(CONFIG_BT_MESH_RELAY) +#if (defined(CONFIG_BT_MESH_RELAY) || defined(CONFIG_BT_MESH_BRG_CFG_SRV)) BT_MESH_ADV_TAG_BIT_RELAY | -#endif /* CONFIG_BT_MESH_RELAY */ +#endif /* CONFIG_BT_MESH_RELAY || CONFIG_BT_MESH_BRG_CFG_SRV */ #if defined(CONFIG_BT_MESH_PB_ADV_USE_RELAY_SETS) BT_MESH_ADV_TAG_BIT_PROV | #endif /* CONFIG_BT_MESH_PB_ADV_USE_RELAY_SETS */ From b38773f14b90c63c2da0d980ef4c725aefb4a140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Tue, 19 Nov 2024 09:49:55 +0100 Subject: [PATCH 2815/4482] Bluetooth: Mesh: Use net xmit params for bridge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Makes sure that the Network Transmit state is used when using a Subnet Bridge. Signed-off-by: Håvard Reierstad --- subsys/bluetooth/mesh/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/mesh/net.c b/subsys/bluetooth/mesh/net.c index 25d0551a2ee27..cf95884fd5ac7 100644 --- a/subsys/bluetooth/mesh/net.c +++ b/subsys/bluetooth/mesh/net.c @@ -705,7 +705,7 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf, struct bt_mesh_net_rx * Anything else (like GATT to adv, or locally originated packets) * use the Network Transmit state. */ - if (rx->net_if == BT_MESH_NET_IF_ADV && !rx->friend_cred) { + if (rx->net_if == BT_MESH_NET_IF_ADV && !rx->friend_cred && !bridge) { transmit = bt_mesh_relay_retransmit_get(); } else { transmit = bt_mesh_net_transmit_get(); From 750212c2a9bd5c1add02bb991bc3f30a8d106dae Mon Sep 17 00:00:00 2001 From: Adrian Warecki Date: Wed, 30 Oct 2024 15:17:55 +0100 Subject: [PATCH 2816/4482] mm: tlb: Remove ARG_UNUSED macro invocation The flags parameter in the sys_mm_drv_map_page function is used, so the ARG_UNUSED macro invocation is unnecessary. Remove this macro usage to clean up the code and improvs code readability and maintainability. Signed-off-by: Adrian Warecki --- drivers/mm/mm_drv_intel_adsp_mtl_tlb.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c b/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c index 67210505cb9c2..b7f423153f892 100644 --- a/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c +++ b/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c @@ -187,8 +187,6 @@ int sys_mm_drv_map_page(void *virt, uintptr_t phys, uint32_t flags) uintptr_t pa = POINTER_TO_UINT(sys_cache_cached_ptr_get(UINT_TO_POINTER(phys))); uintptr_t va = POINTER_TO_UINT(sys_cache_cached_ptr_get(virt)); - ARG_UNUSED(flags); - /* Make sure VA is page-aligned */ CHECKIF(!sys_mm_drv_is_addr_aligned(va)) { ret = -EINVAL; From e4a950370668804482997deefbf230010472fb7b Mon Sep 17 00:00:00 2001 From: Adrian Warecki Date: Wed, 30 Oct 2024 15:18:11 +0100 Subject: [PATCH 2817/4482] mm: tlb: Improve the context saving function Attempt to invalidate cache for an unmapped address results in cpu exception for the ptl platform. Perform cache invalidation after translation activation in tlb. Add address mapping in mmu for platforms that have it. Signed-off-by: Adrian Warecki --- drivers/mm/mm_drv_intel_adsp_mtl_tlb.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c b/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c index b7f423153f892..3eef62f208d12 100644 --- a/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c +++ b/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c @@ -836,18 +836,25 @@ static void adsp_mm_save_context(void *storage_buffer) if (((tlb_entries[entry_idx] & TLB_PADDR_MASK) != entry) || ((tlb_entries[entry_idx] & TLB_ENABLE_BIT) != TLB_ENABLE_BIT)) { - /* this page needs remapping, invalidate cache to avoid stalled data - * all cache data has been flushed before - * do this for pages to remap only - */ - sys_cache_data_invd_range(UINT_TO_POINTER(phys_addr), - CONFIG_MM_DRV_PAGE_SIZE); + /* This page needs remapping */ /* Enable the translation in the TLB entry */ entry |= TLB_ENABLE_BIT; /* map the page 1:1 virtual to physical */ tlb_entries[entry_idx] = entry; + +#ifdef CONFIG_MMU + arch_mem_map(UINT_TO_POINTER(phys_addr), phys_addr, CONFIG_MM_DRV_PAGE_SIZE, + K_MEM_CACHE_WB); +#endif + + /* Invalidate cache to avoid stalled data + * all cache data has been flushed before + * do this for pages to remap only + */ + sys_cache_data_invd_range(UINT_TO_POINTER(phys_addr), + CONFIG_MM_DRV_PAGE_SIZE); } /* save physical address */ From 903b7cf9b62a261abf807d3b0fb9e15cf6497d7f Mon Sep 17 00:00:00 2001 From: Adrian Warecki Date: Wed, 30 Oct 2024 16:26:02 +0100 Subject: [PATCH 2818/4482] mm: tlb: Add a mmu support in update page flags function Platforms that support mmu require memory page access flags to be set in both tlb and mmu. Add mmu flag update in sys_mm_drv_update_page_flags function. Signed-off-by: Adrian Warecki --- drivers/mm/mm_drv_intel_adsp_mtl_tlb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c b/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c index 3eef62f208d12..b7b046f3b9542 100644 --- a/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c +++ b/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c @@ -461,6 +461,10 @@ int sys_mm_drv_update_page_flags(void *virt, uint32_t flags) tlb_entries[entry_idx] = entry; +#ifdef CONFIG_MMU + arch_mem_map(virt, tlb_entry_to_pa(entry), CONFIG_MM_DRV_PAGE_SIZE, flags); +#endif + out: k_spin_unlock(&tlb_lock, key); return ret; From 0a8b16693f5bb16f465176a9cce023d3a4f76b9c Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Sat, 16 Nov 2024 11:51:03 -0500 Subject: [PATCH 2819/4482] ci: twister: split publishing results out of main workflow Move publishing data to ES to a workflow_run step. This way we can change the main workflow to use pull_request instead of pull_request_target. Signed-off-by: Anas Nashif --- .github/workflows/twister-publish.yaml | 47 ++++++++++++++++++++++++++ .github/workflows/twister.yaml | 31 +++-------------- 2 files changed, 52 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/twister-publish.yaml diff --git a/.github/workflows/twister-publish.yaml b/.github/workflows/twister-publish.yaml new file mode 100644 index 0000000000000..36c6d4bdde404 --- /dev/null +++ b/.github/workflows/twister-publish.yaml @@ -0,0 +1,47 @@ +name: Publish Twister Test Results + +on: + workflow_run: + workflows: ["Run tests with twister"] + branches: + - main + - v* + types: + - completed + +jobs: + upload-to-elasticsearch: + if: github.repository == 'zephyrproject-rtos/zephyr' + env: + ELASTICSEARCH_KEY: ${{ secrets.ELASTICSEARCH_KEY }} + ELASTICSEARCH_SERVER: "https://elasticsearch.zephyrproject.io:443" + runs-on: ubuntu-22.04 + steps: + # Needed for elasticearch and upload script + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Download Artifacts + uses: dawidd6/action-download-artifact@v6 + with: + path: artifacts + workflow: twister.yml + run_id: ${{ github.event.workflow_run.id }} + + - name: Upload to elasticsearch + run: | + pip3 install elasticsearch + # set run date on upload to get consistent and unified data across the matrix. + run_date=`date --iso-8601=minutes` + if [ "${{github.event_name}}" = "push" ]; then + python3 ./scripts/ci/upload_test_results_es.py -r ${run_date} \ + --run-attempt ${{github.run_attempt}} \ + --index zephyr-main-ci-push-1 artifacts/*/*/twister.json + elif [ "${{github.event_name}}" = "schedule" ]; then + python3 ./scripts/ci/upload_test_results_es.py -r ${run_date} \ + --run-attempt ${{github.run_attempt}} \ + --index zephyr-main-ci-weekly-1 artifacts/*/*/twister.json + fi diff --git a/.github/workflows/twister.yaml b/.github/workflows/twister.yaml index e893e2fa2f015..57cedfd156370 100644 --- a/.github/workflows/twister.yaml +++ b/.github/workflows/twister.yaml @@ -230,6 +230,7 @@ jobs: - if: github.event_name == 'push' name: Run Tests with Twister (Push) + id: run_twister run: | export ZEPHYR_BASE=${PWD} export ZEPHYR_TOOLCHAIN_VARIANT=zephyr @@ -243,6 +244,7 @@ jobs: - if: github.event_name == 'pull_request_target' name: Run Tests with Twister (Pull Request) + id: run_twister_pr run: | rm -f testplan.json export ZEPHYR_BASE=${PWD} @@ -258,6 +260,7 @@ jobs: - if: github.event_name == 'schedule' name: Run Tests with Twister (Daily) + id: run_twister_sched run: | export ZEPHYR_BASE=${PWD} export ZEPHYR_TOOLCHAIN_VARIANT=zephyr @@ -306,42 +309,18 @@ jobs: twister-test-results: name: "Publish Unit Tests Results" - env: - ELASTICSEARCH_KEY: ${{ secrets.ELASTICSEARCH_KEY }} - ELASTICSEARCH_SERVER: "https://elasticsearch.zephyrproject.io:443" - needs: twister-build + needs: + - twister-build runs-on: ubuntu-22.04 # the build-and-test job might be skipped, we don't need to run this job then if: success() || failure() steps: - # Needed for elasticearch and upload script - - if: github.event_name == 'push' || github.event_name == 'schedule' - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - persist-credentials: false - - name: Download Artifacts uses: actions/download-artifact@v4 with: path: artifacts - - if: github.event_name == 'push' || github.event_name == 'schedule' - name: Upload to elasticsearch - run: | - pip3 install elasticsearch - # set run date on upload to get consistent and unified data across the matrix. - run_date=`date --iso-8601=minutes` - if [ "${{github.event_name}}" = "push" ]; then - python3 ./scripts/ci/upload_test_results_es.py -r ${run_date} \ - --index zephyr-main-ci-push-1 artifacts/*/*/twister.json - elif [ "${{github.event_name}}" = "schedule" ]; then - python3 ./scripts/ci/upload_test_results_es.py -r ${run_date} \ - --index zephyr-main-ci-weekly-1 artifacts/*/*/twister.json - fi - - name: Merge Test Results run: | pip3 install junitparser junit2html From ac08acafdde69dba9b1fe715899a4aabae75a9ef Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 18 Nov 2024 11:06:07 -0500 Subject: [PATCH 2820/4482] ci: twister: use workflow_call for prep job Use workflow_call to allow for different type of nodes depending on event. On push, we do not need to use zephyr runners, GH runners are enough and are much faster to deploy and start. This resolves an issue where push jobs will have to be queued for a longer time waiting for the prep step, once the prep step is done, we will have to wait one more time in the queue for requested nodes. This should speed up execution of push events in CI. Signed-off-by: Anas Nashif --- .github/workflows/twister-prep.yaml | 150 ++++++++++++++++++++++++++++ .github/workflows/twister.yaml | 103 +------------------ 2 files changed, 151 insertions(+), 102 deletions(-) create mode 100644 .github/workflows/twister-prep.yaml diff --git a/.github/workflows/twister-prep.yaml b/.github/workflows/twister-prep.yaml new file mode 100644 index 0000000000000..97f44f68a9e13 --- /dev/null +++ b/.github/workflows/twister-prep.yaml @@ -0,0 +1,150 @@ +name: Prep + +on: + workflow_call: + outputs: + subset: + description: subset + value: ${{ jobs.prep_push.outputs.subset }} || ${{ jobs.prep_pr.outputs.subset }} + size: + description: size + value: ${{ jobs.prep_push.outputs.size }} || ${{ jobs.prep_pr.outputs.size }} + fullrun: + description: fullrun + value: ${{ jobs.prep_push.outputs.fullrun }} || ${{ jobs.prep_pr.outputs.size }} + +jobs: + prep_pr: + if: github.repository_owner == 'zephyrproject-rtos' && github.event_name == 'pull_request_target' + runs-on: + group: zephyr-runner-v2-linux-x64-4xlarge + container: + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.4.20241026 + options: '--entrypoint /bin/bash' + outputs: + subset: ${{ steps.output-services.outputs.subset }} + size: ${{ steps.output-services.outputs.size }} + fullrun: ${{ steps.output-services.outputs.fullrun }} + env: + MATRIX_SIZE: 10 + PUSH_MATRIX_SIZE: 20 + DAILY_MATRIX_SIZE: 80 + BSIM_OUT_PATH: /opt/bsim/ + BSIM_COMPONENTS_PATH: /opt/bsim/components + TESTS_PER_BUILDER: 700 + COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} + BASE_REF: ${{ github.base_ref }} + steps: + - name: Apply container owner mismatch workaround + run: | + # FIXME: The owner UID of the GITHUB_WORKSPACE directory may not + # match the container user UID because of the way GitHub + # Actions runner is implemented. Remove this workaround when + # GitHub comes up with a fundamental fix for this problem. + git config --global --add safe.directory ${GITHUB_WORKSPACE} + + - name: Print cloud service information + run: | + echo "ZEPHYR_RUNNER_CLOUD_PROVIDER = ${ZEPHYR_RUNNER_CLOUD_PROVIDER}" + echo "ZEPHYR_RUNNER_CLOUD_NODE = ${ZEPHYR_RUNNER_CLOUD_NODE}" + echo "ZEPHYR_RUNNER_CLOUD_POD = ${ZEPHYR_RUNNER_CLOUD_POD}" + + - name: Clone cached Zephyr repository + if: github.event_name == 'pull_request_target' + continue-on-error: true + run: | + git clone --shared /repo-cache/zephyrproject/zephyr . + git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} + + - name: Checkout + if: github.event_name == 'pull_request_target' + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + persist-credentials: false + + - name: Environment Setup + if: github.event_name == 'pull_request_target' + run: | + git config --global user.email "bot@zephyrproject.org" + git config --global user.name "Zephyr Bot" + rm -fr ".git/rebase-apply" + git rebase origin/${BASE_REF} + git clean -f -d + git log --pretty=oneline | head -n 10 + west init -l . || true + west config manifest.group-filter -- +ci,+optional + west config --global update.narrow true + west update --path-cache /repo-cache/zephyrproject 2>&1 1> west.update.log || west update --path-cache /repo-cache/zephyrproject 2>&1 1> west.update.log || ( rm -rf ../modules ../bootloader ../tools && west update --path-cache /repo-cache/zephyrproject) + west forall -c 'git reset --hard HEAD' + + echo "ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/zephyr-sdk-$( cat SDK_VERSION )" >> $GITHUB_ENV + + - name: Generate Test Plan with Twister + if: github.event_name == 'pull_request_target' + id: test-plan + run: | + export ZEPHYR_BASE=${PWD} + export ZEPHYR_TOOLCHAIN_VARIANT=zephyr + python3 ./scripts/ci/test_plan.py -c origin/${BASE_REF}.. --pull-request -t $TESTS_PER_BUILDER + if [ -s .testplan ]; then + cat .testplan >> $GITHUB_ENV + else + echo "TWISTER_NODES=${MATRIX_SIZE}" >> $GITHUB_ENV + fi + rm -f testplan.json .testplan + + - name: Determine matrix size + id: output-services + run: | + if [ -n "${TWISTER_NODES}" ]; then + subset="[$(seq -s',' 1 ${TWISTER_NODES})]" + else + subset="[$(seq -s',' 1 ${MATRIX_SIZE})]" + fi + size=${TWISTER_NODES} + + echo "subset=${subset}" >> $GITHUB_OUTPUT + echo "size=${size}" >> $GITHUB_OUTPUT + echo "fullrun=${TWISTER_FULL}" >> $GITHUB_OUTPUT + + prep_push: + if: github.repository_owner == 'zephyrproject-rtos' && (github.event_name == 'push' || github.event_name == 'schedule') + runs-on: ubuntu-22.04 + outputs: + subset: ${{ steps.output-services.outputs.subset }} + size: ${{ steps.output-services.outputs.size }} + fullrun: ${{ steps.output-services.outputs.fullrun }} + env: + MATRIX_SIZE: 10 + PUSH_MATRIX_SIZE: 20 + DAILY_MATRIX_SIZE: 80 + BSIM_OUT_PATH: /opt/bsim/ + BSIM_COMPONENTS_PATH: /opt/bsim/components + TESTS_PER_BUILDER: 700 + COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} + BASE_REF: ${{ github.base_ref }} + steps: + - name: Print cloud service information + run: | + echo "ZEPHYR_RUNNER_CLOUD_PROVIDER = ${ZEPHYR_RUNNER_CLOUD_PROVIDER}" + echo "ZEPHYR_RUNNER_CLOUD_NODE = ${ZEPHYR_RUNNER_CLOUD_NODE}" + echo "ZEPHYR_RUNNER_CLOUD_POD = ${ZEPHYR_RUNNER_CLOUD_POD}" + + - name: Determine matrix size + id: output-services + run: | + if [ "${{github.event_name}}" = "push" ]; then + subset="[$(seq -s',' 1 ${PUSH_MATRIX_SIZE})]" + size=${MATRIX_SIZE} + elif [ "${{github.event_name}}" = "schedule" -a "${{github.repository}}" = "zephyrproject-rtos/zephyr" ]; then + subset="[$(seq -s',' 1 ${DAILY_MATRIX_SIZE})]" + size=${DAILY_MATRIX_SIZE} + else + size=0 + fi + + echo "subset=${subset}" >> $GITHUB_OUTPUT + echo "size=${size}" >> $GITHUB_OUTPUT + echo "fullrun=${TWISTER_FULL}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/twister.yaml b/.github/workflows/twister.yaml index 57cedfd156370..1d863c7c69080 100644 --- a/.github/workflows/twister.yaml +++ b/.github/workflows/twister.yaml @@ -21,108 +21,7 @@ concurrency: jobs: twister-build-prep: - if: github.repository_owner == 'zephyrproject-rtos' - runs-on: - group: zephyr-runner-v2-linux-x64-4xlarge - container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.4.20241026 - options: '--entrypoint /bin/bash' - outputs: - subset: ${{ steps.output-services.outputs.subset }} - size: ${{ steps.output-services.outputs.size }} - fullrun: ${{ steps.output-services.outputs.fullrun }} - env: - MATRIX_SIZE: 10 - PUSH_MATRIX_SIZE: 20 - DAILY_MATRIX_SIZE: 80 - BSIM_OUT_PATH: /opt/bsim/ - BSIM_COMPONENTS_PATH: /opt/bsim/components - TESTS_PER_BUILDER: 700 - COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} - BASE_REF: ${{ github.base_ref }} - steps: - - name: Apply container owner mismatch workaround - run: | - # FIXME: The owner UID of the GITHUB_WORKSPACE directory may not - # match the container user UID because of the way GitHub - # Actions runner is implemented. Remove this workaround when - # GitHub comes up with a fundamental fix for this problem. - git config --global --add safe.directory ${GITHUB_WORKSPACE} - - - name: Print cloud service information - run: | - echo "ZEPHYR_RUNNER_CLOUD_PROVIDER = ${ZEPHYR_RUNNER_CLOUD_PROVIDER}" - echo "ZEPHYR_RUNNER_CLOUD_NODE = ${ZEPHYR_RUNNER_CLOUD_NODE}" - echo "ZEPHYR_RUNNER_CLOUD_POD = ${ZEPHYR_RUNNER_CLOUD_POD}" - - - name: Clone cached Zephyr repository - if: github.event_name == 'pull_request_target' - continue-on-error: true - run: | - git clone --shared /repo-cache/zephyrproject/zephyr . - git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} - - - name: Checkout - if: github.event_name == 'pull_request_target' - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - persist-credentials: false - - - name: Environment Setup - if: github.event_name == 'pull_request_target' - run: | - git config --global user.email "bot@zephyrproject.org" - git config --global user.name "Zephyr Bot" - rm -fr ".git/rebase-apply" - git rebase origin/${BASE_REF} - git clean -f -d - git log --pretty=oneline | head -n 10 - west init -l . || true - west config manifest.group-filter -- +ci,+optional - west config --global update.narrow true - west update --path-cache /repo-cache/zephyrproject 2>&1 1> west.update.log || west update --path-cache /repo-cache/zephyrproject 2>&1 1> west.update.log || ( rm -rf ../modules ../bootloader ../tools && west update --path-cache /repo-cache/zephyrproject) - west forall -c 'git reset --hard HEAD' - - echo "ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/zephyr-sdk-$( cat SDK_VERSION )" >> $GITHUB_ENV - - - name: Generate Test Plan with Twister - if: github.event_name == 'pull_request_target' - id: test-plan - run: | - export ZEPHYR_BASE=${PWD} - export ZEPHYR_TOOLCHAIN_VARIANT=zephyr - python3 ./scripts/ci/test_plan.py -c origin/${BASE_REF}.. --pull-request -t $TESTS_PER_BUILDER - if [ -s .testplan ]; then - cat .testplan >> $GITHUB_ENV - else - echo "TWISTER_NODES=${MATRIX_SIZE}" >> $GITHUB_ENV - fi - rm -f testplan.json .testplan - - - name: Determine matrix size - id: output-services - run: | - if [ "${{github.event_name}}" = "pull_request_target" ]; then - if [ -n "${TWISTER_NODES}" ]; then - subset="[$(seq -s',' 1 ${TWISTER_NODES})]" - else - subset="[$(seq -s',' 1 ${MATRIX_SIZE})]" - fi - size=${TWISTER_NODES} - elif [ "${{github.event_name}}" = "push" ]; then - subset="[$(seq -s',' 1 ${PUSH_MATRIX_SIZE})]" - size=${MATRIX_SIZE} - elif [ "${{github.event_name}}" = "schedule" -a "${{github.repository}}" = "zephyrproject-rtos/zephyr" ]; then - subset="[$(seq -s',' 1 ${DAILY_MATRIX_SIZE})]" - size=${DAILY_MATRIX_SIZE} - else - size=0 - fi - echo "subset=${subset}" >> $GITHUB_OUTPUT - echo "size=${size}" >> $GITHUB_OUTPUT - echo "fullrun=${TWISTER_FULL}" >> $GITHUB_OUTPUT + uses: ./.github/workflows/twister-prep.yaml twister-build: runs-on: From 35f6c4922efe6c6df8e81d96947227a6de4d4599 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Fri, 15 Nov 2024 16:21:14 -0600 Subject: [PATCH 2821/4482] dts: bindings: timer: move a few counter bindings to correct location A few bindings in the timer directory (for kernel timing sources) were being used for counters (which can have alarms set, and have a distinct API). Move these bindings to the counters directory. Signed-off-by: Daniel DeGrasse --- dts/bindings/{timer => counter}/andestech,atcpit100.yaml | 0 dts/bindings/{timer => counter}/arm,cmsdk-dtimer.yaml | 0 dts/bindings/{timer => counter}/arm,cmsdk-timer.yaml | 0 dts/bindings/{timer => counter}/atmel,sam-tc.yaml | 0 dts/bindings/{timer => counter}/atmel,sam0-tc32.yaml | 0 dts/bindings/{timer => counter}/gd,gd32-timer.yaml | 0 dts/bindings/{timer => counter}/nordic,nrf-timer.yaml | 0 dts/bindings/{timer => counter}/nxp,lpc-ctimer.yaml | 0 dts/bindings/{timer => counter}/nxp,s32-sys-timer.yaml | 0 dts/bindings/{timer => counter}/nxp,tpm-timer.yaml | 0 dts/bindings/{timer => counter}/raspberrypi,pico-timer.yaml | 0 dts/bindings/{timer => counter}/renesas,smartbond-timer.yaml | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename dts/bindings/{timer => counter}/andestech,atcpit100.yaml (100%) rename dts/bindings/{timer => counter}/arm,cmsdk-dtimer.yaml (100%) rename dts/bindings/{timer => counter}/arm,cmsdk-timer.yaml (100%) rename dts/bindings/{timer => counter}/atmel,sam-tc.yaml (100%) rename dts/bindings/{timer => counter}/atmel,sam0-tc32.yaml (100%) rename dts/bindings/{timer => counter}/gd,gd32-timer.yaml (100%) rename dts/bindings/{timer => counter}/nordic,nrf-timer.yaml (100%) rename dts/bindings/{timer => counter}/nxp,lpc-ctimer.yaml (100%) rename dts/bindings/{timer => counter}/nxp,s32-sys-timer.yaml (100%) rename dts/bindings/{timer => counter}/nxp,tpm-timer.yaml (100%) rename dts/bindings/{timer => counter}/raspberrypi,pico-timer.yaml (100%) rename dts/bindings/{timer => counter}/renesas,smartbond-timer.yaml (100%) diff --git a/dts/bindings/timer/andestech,atcpit100.yaml b/dts/bindings/counter/andestech,atcpit100.yaml similarity index 100% rename from dts/bindings/timer/andestech,atcpit100.yaml rename to dts/bindings/counter/andestech,atcpit100.yaml diff --git a/dts/bindings/timer/arm,cmsdk-dtimer.yaml b/dts/bindings/counter/arm,cmsdk-dtimer.yaml similarity index 100% rename from dts/bindings/timer/arm,cmsdk-dtimer.yaml rename to dts/bindings/counter/arm,cmsdk-dtimer.yaml diff --git a/dts/bindings/timer/arm,cmsdk-timer.yaml b/dts/bindings/counter/arm,cmsdk-timer.yaml similarity index 100% rename from dts/bindings/timer/arm,cmsdk-timer.yaml rename to dts/bindings/counter/arm,cmsdk-timer.yaml diff --git a/dts/bindings/timer/atmel,sam-tc.yaml b/dts/bindings/counter/atmel,sam-tc.yaml similarity index 100% rename from dts/bindings/timer/atmel,sam-tc.yaml rename to dts/bindings/counter/atmel,sam-tc.yaml diff --git a/dts/bindings/timer/atmel,sam0-tc32.yaml b/dts/bindings/counter/atmel,sam0-tc32.yaml similarity index 100% rename from dts/bindings/timer/atmel,sam0-tc32.yaml rename to dts/bindings/counter/atmel,sam0-tc32.yaml diff --git a/dts/bindings/timer/gd,gd32-timer.yaml b/dts/bindings/counter/gd,gd32-timer.yaml similarity index 100% rename from dts/bindings/timer/gd,gd32-timer.yaml rename to dts/bindings/counter/gd,gd32-timer.yaml diff --git a/dts/bindings/timer/nordic,nrf-timer.yaml b/dts/bindings/counter/nordic,nrf-timer.yaml similarity index 100% rename from dts/bindings/timer/nordic,nrf-timer.yaml rename to dts/bindings/counter/nordic,nrf-timer.yaml diff --git a/dts/bindings/timer/nxp,lpc-ctimer.yaml b/dts/bindings/counter/nxp,lpc-ctimer.yaml similarity index 100% rename from dts/bindings/timer/nxp,lpc-ctimer.yaml rename to dts/bindings/counter/nxp,lpc-ctimer.yaml diff --git a/dts/bindings/timer/nxp,s32-sys-timer.yaml b/dts/bindings/counter/nxp,s32-sys-timer.yaml similarity index 100% rename from dts/bindings/timer/nxp,s32-sys-timer.yaml rename to dts/bindings/counter/nxp,s32-sys-timer.yaml diff --git a/dts/bindings/timer/nxp,tpm-timer.yaml b/dts/bindings/counter/nxp,tpm-timer.yaml similarity index 100% rename from dts/bindings/timer/nxp,tpm-timer.yaml rename to dts/bindings/counter/nxp,tpm-timer.yaml diff --git a/dts/bindings/timer/raspberrypi,pico-timer.yaml b/dts/bindings/counter/raspberrypi,pico-timer.yaml similarity index 100% rename from dts/bindings/timer/raspberrypi,pico-timer.yaml rename to dts/bindings/counter/raspberrypi,pico-timer.yaml diff --git a/dts/bindings/timer/renesas,smartbond-timer.yaml b/dts/bindings/counter/renesas,smartbond-timer.yaml similarity index 100% rename from dts/bindings/timer/renesas,smartbond-timer.yaml rename to dts/bindings/counter/renesas,smartbond-timer.yaml From 697efe8b5054a98010835a1b49384dfe06467549 Mon Sep 17 00:00:00 2001 From: Nazar Palamar Date: Fri, 15 Nov 2024 21:04:34 +0200 Subject: [PATCH 2822/4482] Infineon: board: Add CONFIG_GPIO to defconfigs Add CONFIG_GPIO from defconfigs for Infineon boards. Revert pull/81377, which affect some ble samples which used GPIO. Signed-off-by: Nazar Palamar --- .../infineon/cy8cproto_062_4343w/cy8cproto_062_4343w_defconfig | 3 +++ boards/infineon/cy8cproto_063_ble/cy8cproto_063_ble_defconfig | 3 +++ boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02_defconfig | 3 +++ 3 files changed, 9 insertions(+) diff --git a/boards/infineon/cy8cproto_062_4343w/cy8cproto_062_4343w_defconfig b/boards/infineon/cy8cproto_062_4343w/cy8cproto_062_4343w_defconfig index 2bda7847628ab..221643eca2791 100644 --- a/boards/infineon/cy8cproto_062_4343w/cy8cproto_062_4343w_defconfig +++ b/boards/infineon/cy8cproto_062_4343w/cy8cproto_062_4343w_defconfig @@ -17,6 +17,9 @@ CONFIG_UART_CONSOLE=y # Enable UART driver CONFIG_SERIAL=y +# Enable GPIO driver +CONFIG_GPIO=y + # Enable clock controller CONFIG_CLOCK_CONTROL=y diff --git a/boards/infineon/cy8cproto_063_ble/cy8cproto_063_ble_defconfig b/boards/infineon/cy8cproto_063_ble/cy8cproto_063_ble_defconfig index 98136255552ab..7d0d29ea39cc9 100644 --- a/boards/infineon/cy8cproto_063_ble/cy8cproto_063_ble_defconfig +++ b/boards/infineon/cy8cproto_063_ble/cy8cproto_063_ble_defconfig @@ -18,6 +18,9 @@ CONFIG_UART_CONSOLE=y # Enable UART driver CONFIG_SERIAL=y +# Enable GPIO +CONFIG_GPIO=y + # Enable clock controller CONFIG_CLOCK_CONTROL=y diff --git a/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02_defconfig b/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02_defconfig index 11ac9fb5c324c..e50b5462babe1 100644 --- a/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02_defconfig +++ b/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02_defconfig @@ -17,6 +17,9 @@ CONFIG_UART_CONSOLE=y # Enable UART driver CONFIG_SERIAL=y +# Enable GPIO driver +CONFIG_GPIO=y + # Enable clock controller CONFIG_CLOCK_CONTROL=y From 6172092730a88f93696f48983e65a18a9cabff00 Mon Sep 17 00:00:00 2001 From: Nazar Palamar Date: Fri, 15 Nov 2024 21:12:13 +0200 Subject: [PATCH 2823/4482] test: arm: irq: Add overlays files for Infineon boards Changed interrupt priority for GPIO, default 6 is not suitable for for the ZERO_LATENCY_IRQS function used in this test. used in this test. Signed-off-by: Nazar Palamar --- .../boards/cy8cproto_062_4343w.overlay | 37 +++++++++++++++++++ .../boards/cy8cproto_063_ble.overlay | 33 +++++++++++++++++ .../boards/cyw920829m2evk_02.overlay | 21 +++++++++++ .../boards/cy8cproto_062_4343w.overlay | 37 +++++++++++++++++++ .../boards/cy8cproto_063_ble.overlay | 33 +++++++++++++++++ .../boards/cyw920829m2evk_02.overlay | 21 +++++++++++ 6 files changed, 182 insertions(+) create mode 100644 tests/arch/arm/arm_irq_advanced_features/boards/cy8cproto_062_4343w.overlay create mode 100644 tests/arch/arm/arm_irq_advanced_features/boards/cy8cproto_063_ble.overlay create mode 100644 tests/arch/arm/arm_irq_advanced_features/boards/cyw920829m2evk_02.overlay create mode 100644 tests/arch/arm/arm_irq_zero_latency_levels/boards/cy8cproto_062_4343w.overlay create mode 100644 tests/arch/arm/arm_irq_zero_latency_levels/boards/cy8cproto_063_ble.overlay create mode 100644 tests/arch/arm/arm_irq_zero_latency_levels/boards/cyw920829m2evk_02.overlay diff --git a/tests/arch/arm/arm_irq_advanced_features/boards/cy8cproto_062_4343w.overlay b/tests/arch/arm/arm_irq_advanced_features/boards/cy8cproto_062_4343w.overlay new file mode 100644 index 0000000000000..bd164a6bf2885 --- /dev/null +++ b/tests/arch/arm/arm_irq_advanced_features/boards/cy8cproto_062_4343w.overlay @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + */ + +/* Changed default interrupts priority for GPIO to 4 */ +&gpio_prt0 { + interrupts = <0 4>; +}; + +&gpio_prt2 { + interrupts = <2 4>; +}; + +&gpio_prt3 { + interrupts = <3 4>; +}; + +&gpio_prt5 { + interrupts = <5 4>; +}; + +&gpio_prt6 { + interrupts = <6 4>; +}; + +&gpio_prt9 { + interrupts = <9 4>; +}; + +&gpio_prt12 { + interrupts = <12 4>; +}; + +&gpio_prt13 { + interrupts = <13 4>; +}; diff --git a/tests/arch/arm/arm_irq_advanced_features/boards/cy8cproto_063_ble.overlay b/tests/arch/arm/arm_irq_advanced_features/boards/cy8cproto_063_ble.overlay new file mode 100644 index 0000000000000..155992e9cc52f --- /dev/null +++ b/tests/arch/arm/arm_irq_advanced_features/boards/cy8cproto_063_ble.overlay @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + */ + +/* Changed default interrupts priority for GPIO to 4 */ +&gpio_prt0 { + interrupts = <0 4>; +}; + +&gpio_prt5 { + interrupts = <5 4>; +}; + +&gpio_prt6 { + interrupts = <6 4>; +}; + +&gpio_prt7 { + interrupts = <7 4>; +}; + +&gpio_prt9 { + interrupts = <9 4>; +}; + +&gpio_prt10 { + interrupts = <10 4>; +}; + +&gpio_prt12 { + interrupts = <12 4>; +}; diff --git a/tests/arch/arm/arm_irq_advanced_features/boards/cyw920829m2evk_02.overlay b/tests/arch/arm/arm_irq_advanced_features/boards/cyw920829m2evk_02.overlay new file mode 100644 index 0000000000000..6ddd801888659 --- /dev/null +++ b/tests/arch/arm/arm_irq_advanced_features/boards/cyw920829m2evk_02.overlay @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024 Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + */ + +/* Changed default interrupts priority for GPIO to 4 */ +&gpio_prt0 { + interrupts = <0 4>; +}; + +&gpio_prt1 { + interrupts = <1 4>; +}; + +&gpio_prt3 { + interrupts = <3 4>; +}; + +&gpio_prt5 { + interrupts = <5 4>; +}; diff --git a/tests/arch/arm/arm_irq_zero_latency_levels/boards/cy8cproto_062_4343w.overlay b/tests/arch/arm/arm_irq_zero_latency_levels/boards/cy8cproto_062_4343w.overlay new file mode 100644 index 0000000000000..bd164a6bf2885 --- /dev/null +++ b/tests/arch/arm/arm_irq_zero_latency_levels/boards/cy8cproto_062_4343w.overlay @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + */ + +/* Changed default interrupts priority for GPIO to 4 */ +&gpio_prt0 { + interrupts = <0 4>; +}; + +&gpio_prt2 { + interrupts = <2 4>; +}; + +&gpio_prt3 { + interrupts = <3 4>; +}; + +&gpio_prt5 { + interrupts = <5 4>; +}; + +&gpio_prt6 { + interrupts = <6 4>; +}; + +&gpio_prt9 { + interrupts = <9 4>; +}; + +&gpio_prt12 { + interrupts = <12 4>; +}; + +&gpio_prt13 { + interrupts = <13 4>; +}; diff --git a/tests/arch/arm/arm_irq_zero_latency_levels/boards/cy8cproto_063_ble.overlay b/tests/arch/arm/arm_irq_zero_latency_levels/boards/cy8cproto_063_ble.overlay new file mode 100644 index 0000000000000..155992e9cc52f --- /dev/null +++ b/tests/arch/arm/arm_irq_zero_latency_levels/boards/cy8cproto_063_ble.overlay @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + */ + +/* Changed default interrupts priority for GPIO to 4 */ +&gpio_prt0 { + interrupts = <0 4>; +}; + +&gpio_prt5 { + interrupts = <5 4>; +}; + +&gpio_prt6 { + interrupts = <6 4>; +}; + +&gpio_prt7 { + interrupts = <7 4>; +}; + +&gpio_prt9 { + interrupts = <9 4>; +}; + +&gpio_prt10 { + interrupts = <10 4>; +}; + +&gpio_prt12 { + interrupts = <12 4>; +}; diff --git a/tests/arch/arm/arm_irq_zero_latency_levels/boards/cyw920829m2evk_02.overlay b/tests/arch/arm/arm_irq_zero_latency_levels/boards/cyw920829m2evk_02.overlay new file mode 100644 index 0000000000000..6ddd801888659 --- /dev/null +++ b/tests/arch/arm/arm_irq_zero_latency_levels/boards/cyw920829m2evk_02.overlay @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024 Cypress Semiconductor Corporation. + * SPDX-License-Identifier: Apache-2.0 + */ + +/* Changed default interrupts priority for GPIO to 4 */ +&gpio_prt0 { + interrupts = <0 4>; +}; + +&gpio_prt1 { + interrupts = <1 4>; +}; + +&gpio_prt3 { + interrupts = <3 4>; +}; + +&gpio_prt5 { + interrupts = <5 4>; +}; From 82e2709ed82567a236eb94f36a7b87455bbca3ba Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Sat, 16 Nov 2024 00:29:44 +0700 Subject: [PATCH 2824/4482] drivers: ethernet: w5500: make `ethernet_api` as `const` This change marks `w5500_api_funcs`, an instance of the `ethernet_api`, as `const`. By using `const`, we ensure immutability, leading to usage of only `.rodata` and a reduction in the `.data` area. Signed-off-by: Pisit Sawangvonganan --- drivers/ethernet/eth_w5500.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ethernet/eth_w5500.c b/drivers/ethernet/eth_w5500.c index 6f726c1c1ebc5..9f093cf30371e 100644 --- a/drivers/ethernet/eth_w5500.c +++ b/drivers/ethernet/eth_w5500.c @@ -459,7 +459,7 @@ static int w5500_hw_stop(const struct device *dev) return 0; } -static struct ethernet_api w5500_api_funcs = { +static const struct ethernet_api w5500_api_funcs = { .iface_api.init = w5500_iface_init, .get_capabilities = w5500_get_capabilities, .set_config = w5500_set_config, From d81a8d452e5aad7375585f308e4b1c271d731eb3 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Sat, 16 Nov 2024 00:52:19 +0700 Subject: [PATCH 2825/4482] drivers: ethernet: w5500: improve type consistency Improve type safety and consistency by adjusting variable and parameter types to avoid signed/unsigned comparisons and implicit casts. Moreover, explicit casts were applied when converting from `size_t` to `uint16_t`. Signed-off-by: Pisit Sawangvonganan --- drivers/ethernet/eth_w5500.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/ethernet/eth_w5500.c b/drivers/ethernet/eth_w5500.c index 9f093cf30371e..d7a06b6ec5c14 100644 --- a/drivers/ethernet/eth_w5500.c +++ b/drivers/ethernet/eth_w5500.c @@ -35,7 +35,7 @@ LOG_MODULE_REGISTER(eth_w5500, CONFIG_ETHERNET_LOG_LEVEL); ((W5500_SPI_BLOCK_SELECT(addr) << 3) | BIT(2)) static int w5500_spi_read(const struct device *dev, uint32_t addr, - uint8_t *data, uint32_t len) + uint8_t *data, size_t len) { const struct w5500_config *cfg = dev->config; int ret; @@ -75,7 +75,7 @@ static int w5500_spi_read(const struct device *dev, uint32_t addr, } static int w5500_spi_write(const struct device *dev, uint32_t addr, - uint8_t *data, uint32_t len) + uint8_t *data, size_t len) { const struct w5500_config *cfg = dev->config; int ret; @@ -105,13 +105,13 @@ static int w5500_spi_write(const struct device *dev, uint32_t addr, } static int w5500_readbuf(const struct device *dev, uint16_t offset, uint8_t *buf, - int len) + size_t len) { uint32_t addr; - int remain = 0; + size_t remain = 0; int ret; const uint32_t mem_start = W5500_Sn_RX_MEM_START; - const uint16_t mem_size = W5500_RX_MEM_SIZE; + const uint32_t mem_size = W5500_RX_MEM_SIZE; offset %= mem_size; addr = mem_start + offset; @@ -130,11 +130,11 @@ static int w5500_readbuf(const struct device *dev, uint16_t offset, uint8_t *buf } static int w5500_writebuf(const struct device *dev, uint16_t offset, uint8_t *buf, - int len) + size_t len) { uint32_t addr; - int ret = 0; - int remain = 0; + size_t remain = 0; + int ret; const uint32_t mem_start = W5500_Sn_TX_MEM_START; const uint32_t mem_size = W5500_TX_MEM_SIZE; @@ -160,7 +160,7 @@ static int w5500_command(const struct device *dev, uint8_t cmd) k_timepoint_t end = sys_timepoint_calc(K_MSEC(100)); w5500_spi_write(dev, W5500_S0_CR, &cmd, 1); - while (1) { + while (true) { w5500_spi_read(dev, W5500_S0_CR, ®, 1); if (!reg) { break; @@ -176,7 +176,7 @@ static int w5500_command(const struct device *dev, uint8_t cmd) static int w5500_tx(const struct device *dev, struct net_pkt *pkt) { struct w5500_runtime *ctx = dev->data; - uint16_t len = net_pkt_get_len(pkt); + uint16_t len = (uint16_t)net_pkt_get_len(pkt); uint16_t offset; uint8_t off[2]; int ret; @@ -260,9 +260,9 @@ static void w5500_rx(const struct device *dev) w5500_readbuf(dev, reader, data_ptr, frame_len); net_buf_add(pkt_buf, frame_len); - reader += frame_len; + reader += (uint16_t)frame_len; - read_len -= frame_len; + read_len -= (uint16_t)frame_len; pkt_buf = pkt_buf->frags; } while (read_len > 0); From 55c6a0eaa57572caaf3d694f2d8f068014d4a29e Mon Sep 17 00:00:00 2001 From: Sergei Ovchinnikov Date: Thu, 14 Nov 2024 10:48:42 +0100 Subject: [PATCH 2826/4482] drivers: sensor: npm1300_charger: expose VBUS status Add possibility to retrieve VBUS status of the nPM1300 charger through its sensor APIs. Updated shields/npm1300_ek sample to use the new API. Signed-off-by: Sergei Ovchinnikov --- .../nordic/npm1300_charger/npm1300_charger.c | 45 ++++++++++++++++++- .../zephyr/drivers/sensor/npm1300_charger.h | 11 +++++ samples/shields/npm1300_ek/prj.conf | 1 + samples/shields/npm1300_ek/src/main.c | 12 +++-- 4 files changed, 65 insertions(+), 4 deletions(-) diff --git a/drivers/sensor/nordic/npm1300_charger/npm1300_charger.c b/drivers/sensor/nordic/npm1300_charger/npm1300_charger.c index ac19616045e08..869f8f5848fc7 100644 --- a/drivers/sensor/nordic/npm1300_charger/npm1300_charger.c +++ b/drivers/sensor/nordic/npm1300_charger/npm1300_charger.c @@ -117,11 +117,19 @@ struct adc_results_t { #define DIETEMP_MSB_SHIFT 2U #define DIETEMP_LSB_MASK 0x03U -/* VBUS masks */ +/* VBUS detect masks */ #define DETECT_HI_MASK 0x0AU #define DETECT_HI_CURRENT 1500000 #define DETECT_LO_CURRENT 500000 +/* VBUS status masks */ +#define STATUS_PRESENT_MASK 0x01U +#define STATUS_CUR_LIMIT_MASK 0x02U +#define STATUS_OVERVLT_PROT_MASK 0x04U +#define STATUS_UNDERVLT_MASK 0x08U +#define STATUS_SUSPENDED_MASK 0x10U +#define STATUS_BUSOUT_MASK 0x20U + /* Dietemp calculation constants */ #define DIETEMP_OFFSET_MDEGC 394670 #define DIETEMP_FACTOR_MUL 3963000 @@ -250,6 +258,10 @@ int npm1300_charger_channel_get(const struct device *dev, enum sensor_channel ch case SENSOR_CHAN_DIE_TEMP: calc_dietemp(config, data->dietemp, valp); break; + case SENSOR_CHAN_NPM1300_CHARGER_VBUS_STATUS: + valp->val1 = data->vbus_stat; + valp->val2 = 0; + break; default: return -ENOTSUP; } @@ -399,6 +411,37 @@ static int npm1300_charger_attr_get(const struct device *dev, enum sensor_channe return 0; + case SENSOR_CHAN_NPM1300_CHARGER_VBUS_STATUS: + ret = mfd_npm1300_reg_read(config->mfd, VBUS_BASE, VBUS_OFFSET_STATUS, &data); + if (ret < 0) { + return ret; + } + + switch ((enum sensor_attribute_npm1300_charger)attr) { + case SENSOR_ATTR_NPM1300_CHARGER_VBUS_PRESENT: + val->val1 = (data & STATUS_PRESENT_MASK) != 0; + break; + case SENSOR_ATTR_NPM1300_CHARGER_VBUS_CUR_LIMIT: + val->val1 = (data & STATUS_CUR_LIMIT_MASK) != 0; + break; + case SENSOR_ATTR_NPM1300_CHARGER_VBUS_OVERVLT_PROT: + val->val1 = (data & STATUS_OVERVLT_PROT_MASK) != 0; + break; + case SENSOR_ATTR_NPM1300_CHARGER_VBUS_UNDERVLT: + val->val1 = (data & STATUS_UNDERVLT_MASK) != 0; + break; + case SENSOR_ATTR_NPM1300_CHARGER_VBUS_SUSPENDED: + val->val1 = (data & STATUS_SUSPENDED_MASK) != 0; + break; + case SENSOR_ATTR_NPM1300_CHARGER_VBUS_BUSOUT: + val->val1 = (data & STATUS_BUSOUT_MASK) != 0; + break; + default: + return -ENOTSUP; + } + val->val2 = 0; + return 0; + default: return -ENOTSUP; } diff --git a/include/zephyr/drivers/sensor/npm1300_charger.h b/include/zephyr/drivers/sensor/npm1300_charger.h index eb13f959a4664..d2a166340d154 100644 --- a/include/zephyr/drivers/sensor/npm1300_charger.h +++ b/include/zephyr/drivers/sensor/npm1300_charger.h @@ -12,6 +12,17 @@ enum sensor_channel_npm1300_charger { SENSOR_CHAN_NPM1300_CHARGER_STATUS = SENSOR_CHAN_PRIV_START, SENSOR_CHAN_NPM1300_CHARGER_ERROR, + SENSOR_CHAN_NPM1300_CHARGER_VBUS_STATUS, +}; + +/* NPM1300 charger specific attributes */ +enum sensor_attribute_npm1300_charger { + SENSOR_ATTR_NPM1300_CHARGER_VBUS_PRESENT = SENSOR_ATTR_PRIV_START, + SENSOR_ATTR_NPM1300_CHARGER_VBUS_CUR_LIMIT, + SENSOR_ATTR_NPM1300_CHARGER_VBUS_OVERVLT_PROT, + SENSOR_ATTR_NPM1300_CHARGER_VBUS_UNDERVLT, + SENSOR_ATTR_NPM1300_CHARGER_VBUS_SUSPENDED, + SENSOR_ATTR_NPM1300_CHARGER_VBUS_BUSOUT, }; #endif diff --git a/samples/shields/npm1300_ek/prj.conf b/samples/shields/npm1300_ek/prj.conf index 975d56d4e509d..3562f9d5c937c 100644 --- a/samples/shields/npm1300_ek/prj.conf +++ b/samples/shields/npm1300_ek/prj.conf @@ -2,6 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 CONFIG_SHELL=y +CONFIG_LOG_CMDS=y CONFIG_LOG=y CONFIG_GPIO=y CONFIG_GPIO_SHELL=y diff --git a/samples/shields/npm1300_ek/src/main.c b/samples/shields/npm1300_ek/src/main.c index 47ed6214677be..7ced01456628e 100644 --- a/samples/shields/npm1300_ek/src/main.c +++ b/samples/shields/npm1300_ek/src/main.c @@ -80,13 +80,18 @@ void read_sensors(void) struct sensor_value temp; struct sensor_value error; struct sensor_value status; + struct sensor_value vbus_present; sensor_sample_fetch(charger); sensor_channel_get(charger, SENSOR_CHAN_GAUGE_VOLTAGE, &volt); sensor_channel_get(charger, SENSOR_CHAN_GAUGE_AVG_CURRENT, ¤t); sensor_channel_get(charger, SENSOR_CHAN_GAUGE_TEMP, &temp); - sensor_channel_get(charger, SENSOR_CHAN_NPM1300_CHARGER_STATUS, &status); - sensor_channel_get(charger, SENSOR_CHAN_NPM1300_CHARGER_ERROR, &error); + sensor_channel_get(charger, (enum sensor_channel)SENSOR_CHAN_NPM1300_CHARGER_STATUS, + &status); + sensor_channel_get(charger, (enum sensor_channel)SENSOR_CHAN_NPM1300_CHARGER_ERROR, &error); + sensor_attr_get(charger, (enum sensor_channel)SENSOR_CHAN_NPM1300_CHARGER_VBUS_STATUS, + (enum sensor_attribute)SENSOR_ATTR_NPM1300_CHARGER_VBUS_PRESENT, + &vbus_present); printk("V: %d.%03d ", volt.val1, volt.val2 / 1000); @@ -96,7 +101,8 @@ void read_sensors(void) printk("T: %s%d.%02d\n", ((temp.val1 < 0) || (temp.val2 < 0)) ? "-" : "", abs(temp.val1), abs(temp.val2) / 10000); - printk("Charger Status: %d, Error: %d\n", status.val1, error.val1); + printk("Charger Status: %d, Error: %d, VBUS: %s\n", status.val1, error.val1, + vbus_present.val1 ? "connected" : "disconnected"); } int main(void) From e5f0075dc65eb0bf37e1a92266be91961943d647 Mon Sep 17 00:00:00 2001 From: Neil Chen Date: Tue, 19 Nov 2024 16:32:11 +0800 Subject: [PATCH 2827/4482] board: frdmmcxc444: Add uart support Add UART configuration and pin control. Set state to disabled, as it serves as alternative to default LPUART0 or as second uart only. Signed-off-by: Neil Chen --- boards/nxp/frdm_mcxc444/frdm_mcxc444-pinctrl.dtsi | 8 ++++++++ boards/nxp/frdm_mcxc444/frdm_mcxc444.dts | 7 +++++++ boards/nxp/frdm_mcxc444/frdm_mcxc444.yaml | 1 + 3 files changed, 16 insertions(+) diff --git a/boards/nxp/frdm_mcxc444/frdm_mcxc444-pinctrl.dtsi b/boards/nxp/frdm_mcxc444/frdm_mcxc444-pinctrl.dtsi index 7f0010c3cbea7..87552988ff852 100644 --- a/boards/nxp/frdm_mcxc444/frdm_mcxc444-pinctrl.dtsi +++ b/boards/nxp/frdm_mcxc444/frdm_mcxc444-pinctrl.dtsi @@ -16,4 +16,12 @@ slew-rate = "slow"; }; }; + pinmux_uart2: pinmux_uart2 { + group0 { + pinmux = , + ; + drive-strength = "low"; + slew-rate = "slow"; + }; + }; }; diff --git a/boards/nxp/frdm_mcxc444/frdm_mcxc444.dts b/boards/nxp/frdm_mcxc444/frdm_mcxc444.dts index f574fdc13a103..0a0c55f730ee0 100644 --- a/boards/nxp/frdm_mcxc444/frdm_mcxc444.dts +++ b/boards/nxp/frdm_mcxc444/frdm_mcxc444.dts @@ -100,3 +100,10 @@ &lptmr0 { status = "okay"; }; + +&uart2 { + status = "disabled"; + current-speed = <115200>; + pinctrl-0 = <&pinmux_uart2>; + pinctrl-names = "default"; +}; diff --git a/boards/nxp/frdm_mcxc444/frdm_mcxc444.yaml b/boards/nxp/frdm_mcxc444/frdm_mcxc444.yaml index 1fe20ef5ccd88..c32022e2b1618 100644 --- a/boards/nxp/frdm_mcxc444/frdm_mcxc444.yaml +++ b/boards/nxp/frdm_mcxc444/frdm_mcxc444.yaml @@ -16,6 +16,7 @@ toolchain: - xtools supported: - gpio + - uart - counter testing: ignore_tags: From 662f412a3591f1b7a41136ef910aa67a4fa5e5e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 26 Jun 2024 15:44:09 +0200 Subject: [PATCH 2828/4482] tests: drivers: uart: async_api: Add nrf54h20 cpuppr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add configuration for nrf54h20dk/nrf54h20/cpuppr. Signed-off-by: Krzysztof Chruściński --- .../boards/nrf54h20dk_nrf54h20_cpuppr.overlay | 3 +++ .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 8 ++++++++ .../uart/uart_async_api/sysbuild/vpr_launcher/prj.conf | 1 + 3 files changed, 12 insertions(+) create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuppr.overlay create mode 100644 tests/drivers/uart/uart_async_api/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay create mode 100644 tests/drivers/uart/uart_async_api/sysbuild/vpr_launcher/prj.conf diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuppr.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuppr.overlay new file mode 100644 index 0000000000000..f65b4dd3b0ba0 --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuppr.overlay @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54h20dk_nrf54h20_common.dtsi" diff --git a/tests/drivers/uart/uart_async_api/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/uart/uart_async_api/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay new file mode 100644 index 0000000000000..64c14d2c492d0 --- /dev/null +++ b/tests/drivers/uart/uart_async_api/sysbuild/vpr_launcher/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "../../../boards/nrf54h20dk_nrf54h20_common.dtsi" + +&dut { + status = "reserved"; + interrupt-parent = <&cpuppr_clic>; +}; diff --git a/tests/drivers/uart/uart_async_api/sysbuild/vpr_launcher/prj.conf b/tests/drivers/uart/uart_async_api/sysbuild/vpr_launcher/prj.conf new file mode 100644 index 0000000000000..b2a4ba591044e --- /dev/null +++ b/tests/drivers/uart/uart_async_api/sysbuild/vpr_launcher/prj.conf @@ -0,0 +1 @@ +# nothing here From f64f36cb01ce5e00aee78b96c722ca4ea96a89c1 Mon Sep 17 00:00:00 2001 From: DineshKumar Kalva Date: Thu, 17 Oct 2024 10:49:57 +0530 Subject: [PATCH 2829/4482] CODEOWNERS: add codeowner for SOF with Zephyr on AMD ACP_6_0. Add myself and basavaraj as codeowners for ACP_6_0 related files for SOF with Zephyr OS. Signed-off-by: DineshKumar Kalva --- CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/CODEOWNERS b/CODEOWNERS index 4c737dc9642dd..2438a5385296a 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -133,6 +133,7 @@ /boards/arm64/intel_socfpga_agilex_socdk/ @siclim @ngboonkhai /boards/arm64/intel_socfpga_agilex5_socdk/ @teikheng @gdengi /boards/arm64/rcar_*/ @lorc @xakep-amatop +/boards/amd/acp_6_0_adsp/ @dineshkumar.kalva @basavaraj.hiregoudar # All cmake related files /doc/develop/tools/coccinelle.rst @himanshujha199640 @JuliaLawall /doc/services/device_mgmt/smp_protocol.rst @de-nordic @nordicjm From eb9eff70185d0c3d1fd0901f539530a21782bbe5 Mon Sep 17 00:00:00 2001 From: DineshKumar Kalva Date: Mon, 14 Oct 2024 15:03:27 +0530 Subject: [PATCH 2830/4482] west: sign: add support for AMD acp_6_0_adsp board. Add support for signing acp_6_0 SOF with Zephyr images with rimage. Signed-off-by: DineshKumar Kalva --- scripts/west_commands/sign.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/west_commands/sign.py b/scripts/west_commands/sign.py index 8aa7ff2435f6d..6f11e673a1782 100644 --- a/scripts/west_commands/sign.py +++ b/scripts/west_commands/sign.py @@ -470,7 +470,7 @@ def sign(self, command, build_dir, build_conf, formats): kernel_name = build_conf.get('CONFIG_KERNEL_BIN_NAME', 'zephyr') # TODO: make this a new sign.py --bootloader option. - if target in ('imx8', 'imx8m', 'imx8ulp', 'imx95'): + if target in ('imx8', 'imx8m', 'imx8ulp', 'imx95', 'rmb'): bootloader = None kernel = str(b / 'zephyr' / f'{kernel_name}.elf') out_bin = str(b / 'zephyr' / f'{kernel_name}.ri') From 173cc387a0fe742b806cac98d4d1917acccecc60 Mon Sep 17 00:00:00 2001 From: DineshKumar Kalva Date: Mon, 14 Oct 2024 15:02:35 +0530 Subject: [PATCH 2831/4482] soc: amd: acp_6_0: add support for AMD ACP_6_0 soc. Add a common part for AMD board ACP_6_0_ADSP. Add support for ACP_6_0_ADSP BOARD, which represents ACP_6_0 soc. This has a 1 Xtensa HiFi5 core, with 200-800MHz 1.75 MB HP SRAM / 512 KB IRAM/DRAM, 1 x SP (I2S, PCM), 1 x BT (I2S, PCM), 1 x HS(I2S, PCM), DMIC as audio interfaces. Signed-off-by: DineshKumar Kalva --- dts/xtensa/amd/acp_6_0.dtsi | 21 + soc/amd/acp_6_0/CMakeLists.txt | 15 + soc/amd/acp_6_0/Kconfig | 7 + soc/amd/acp_6_0/Kconfig.defconfig | 28 ++ soc/amd/acp_6_0/Kconfig.soc | 13 + soc/amd/acp_6_0/adsp/CMakeLists.txt | 4 + soc/amd/acp_6_0/adsp/_soc_inthandlers.h | 165 ++++++ soc/amd/acp_6_0/adsp/include/adsp/cache.h | 10 + soc/amd/acp_6_0/adsp/include/adsp/io.h | 40 ++ soc/amd/acp_6_0/adsp/linker.ld | 584 ++++++++++++++++++++++ soc/amd/acp_6_0/adsp/memory.h | 160 ++++++ soc/amd/acp_6_0/soc.yml | 2 + 12 files changed, 1049 insertions(+) create mode 100644 dts/xtensa/amd/acp_6_0.dtsi create mode 100644 soc/amd/acp_6_0/CMakeLists.txt create mode 100644 soc/amd/acp_6_0/Kconfig create mode 100644 soc/amd/acp_6_0/Kconfig.defconfig create mode 100644 soc/amd/acp_6_0/Kconfig.soc create mode 100644 soc/amd/acp_6_0/adsp/CMakeLists.txt create mode 100644 soc/amd/acp_6_0/adsp/_soc_inthandlers.h create mode 100644 soc/amd/acp_6_0/adsp/include/adsp/cache.h create mode 100644 soc/amd/acp_6_0/adsp/include/adsp/io.h create mode 100644 soc/amd/acp_6_0/adsp/linker.ld create mode 100644 soc/amd/acp_6_0/adsp/memory.h create mode 100644 soc/amd/acp_6_0/soc.yml diff --git a/dts/xtensa/amd/acp_6_0.dtsi b/dts/xtensa/amd/acp_6_0.dtsi new file mode 100644 index 0000000000000..3833b2f530e05 --- /dev/null +++ b/dts/xtensa/amd/acp_6_0.dtsi @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024 AMD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +/ { + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + device_type = "cpu"; + compatible = "cdns,tensilica-xtensa-lx7"; + reg = <0>; + }; + }; +}; diff --git a/soc/amd/acp_6_0/CMakeLists.txt b/soc/amd/acp_6_0/CMakeLists.txt new file mode 100644 index 0000000000000..d8ade87e26c66 --- /dev/null +++ b/soc/amd/acp_6_0/CMakeLists.txt @@ -0,0 +1,15 @@ +if(CONFIG_SOC_ACP_6_0) + zephyr_include_directories(adsp) + add_subdirectory(adsp) +# See detailed comments in soc/xtensa/intel_adsp/common/CMakeLists.txt +add_custom_target(zephyr.ri ALL + DEPENDS ${CMAKE_BINARY_DIR}/zephyr/zephyr.ri +) +add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/zephyr/zephyr.ri + COMMENT "west sign --if-tool-available --tool rimage ..." + COMMAND west sign --if-tool-available --tool rimage --build-dir ${CMAKE_BINARY_DIR} ${WEST_SIGN_OPTS} + DEPENDS ${CMAKE_BINARY_DIR}/zephyr/${KERNEL_ELF_NAME} +) +set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/adsp/linker.ld CACHE INTERNAL "") +endif() diff --git a/soc/amd/acp_6_0/Kconfig b/soc/amd/acp_6_0/Kconfig new file mode 100644 index 0000000000000..2aef8893d3a48 --- /dev/null +++ b/soc/amd/acp_6_0/Kconfig @@ -0,0 +1,7 @@ +# Copyright 2024 AMD +# SPDX-License-Identifier: Apache-2.0 +config SOC_ACP_6_0 + select XTENSA + select XTENSA_HAL if ("$(ZEPHYR_TOOLCHAIN_VARIANT)" != "xcc" && "$(ZEPHYR_TOOLCHAIN_VARIANT)" != "xt-clang") + select XTENSA_RESET_VECTOR + select ATOMIC_OPERATIONS_BUILTIN diff --git a/soc/amd/acp_6_0/Kconfig.defconfig b/soc/amd/acp_6_0/Kconfig.defconfig new file mode 100644 index 0000000000000..9cb6f2353221a --- /dev/null +++ b/soc/amd/acp_6_0/Kconfig.defconfig @@ -0,0 +1,28 @@ +# Copyright (c) 2024 AMD +# SPDX-License-Identifier: Apache-2.0 + +if SOC_ACP_6_0 +config DCACHE_LINE_SIZE +default 128 + +config CACHE_MANAGEMENT +default n + +config XTENSA_TIMER +default y + +config SYS_CLOCK_HW_CYCLES_PER_SEC +default 600000000 if XTENSA_TIMER + +config KERNEL_ENTRY +default "__start" + +config MULTI_LEVEL_INTERRUPTS +default n + +config 2ND_LEVEL_INTERRUPTS +default n + +config KERNEL_ENTRY +default "__start" +endif diff --git a/soc/amd/acp_6_0/Kconfig.soc b/soc/amd/acp_6_0/Kconfig.soc new file mode 100644 index 0000000000000..89f5a09f2f7d0 --- /dev/null +++ b/soc/amd/acp_6_0/Kconfig.soc @@ -0,0 +1,13 @@ +# Copyright (c) 2024 AMD +# SPDX-License-Identifier: Apache-2.0 + +config SOC_ACP_6_0 + bool + default "BOARD_ACP_6_0_ADSP" + +config SOC + default "acp_6_0" if SOC_ACP_6_0 + +config SOC_TOOLCHAIN_NAME + string + default "amd_acp_6_0_adsp" diff --git a/soc/amd/acp_6_0/adsp/CMakeLists.txt b/soc/amd/acp_6_0/adsp/CMakeLists.txt new file mode 100644 index 0000000000000..af69108b9b865 --- /dev/null +++ b/soc/amd/acp_6_0/adsp/CMakeLists.txt @@ -0,0 +1,4 @@ +# Copyright (c) 2024 AMD +# SPDX-License-Identifier: Apache-2.0 + +zephyr_include_directories(include) diff --git a/soc/amd/acp_6_0/adsp/_soc_inthandlers.h b/soc/amd/acp_6_0/adsp/_soc_inthandlers.h new file mode 100644 index 0000000000000..ab632d1bc1df3 --- /dev/null +++ b/soc/amd/acp_6_0/adsp/_soc_inthandlers.h @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2024 AMD + * + * SPDX-License-Identifier: Apache-2.0 + */ +/* + * THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT. + * + * Functions here are designed to produce efficient code to + * search an Xtensa bitmask of interrupts, inspecting only those bits + * declared to be associated with a given interrupt level. Each + * dispatcher will handle exactly one flagged interrupt, in numerical + * order (low bits first) and will return a mask of that bit that can + * then be cleared by the calling code. Unrecognized bits for the + * level will invoke an error handler. + */ + +#include +#include +#include + +#if !defined(XCHAL_INT0_LEVEL) || XCHAL_INT0_LEVEL != 1 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT1_LEVEL) || XCHAL_INT1_LEVEL != 1 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT6_LEVEL) || XCHAL_INT6_LEVEL != 1 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT8_LEVEL) || XCHAL_INT8_LEVEL != 1 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT2_LEVEL) || XCHAL_INT2_LEVEL != 2 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT3_LEVEL) || XCHAL_INT3_LEVEL != 3 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT4_LEVEL) || XCHAL_INT4_LEVEL != 4 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT5_LEVEL) || XCHAL_INT5_LEVEL != 5 +#error core-isa.h interrupt level does not match dispatcher! +#endif +#if !defined(XCHAL_INT7_LEVEL) || XCHAL_INT7_LEVEL != 7 +#error core-isa.h interrupt level does not match dispatcher! +#endif + +static inline int _xtensa_handle_one_int1(unsigned int mask) +{ + int irq; + + if (mask & 0x3) { + if (mask & BIT(0)) { + mask = BIT(0); + irq = 0; + goto handle_irq; + } + if (mask & BIT(1)) { + mask = BIT(1); + irq = 1; + goto handle_irq; + } + } else { + if (mask & BIT(6)) { + mask = BIT(6); + irq = 6; + goto handle_irq; + } + if (mask & BIT(8)) { + mask = BIT(8); + irq = 8; + goto handle_irq; + } + } + return 0; +handle_irq: + _sw_isr_table[irq].isr(_sw_isr_table[irq].arg); + return mask; +} + +static inline int _xtensa_handle_one_int2(unsigned int mask) +{ + int irq; + + if (mask & BIT(2)) { + mask = BIT(2); + irq = 2; + goto handle_irq; + } + return 0; +handle_irq: + _sw_isr_table[irq].isr(_sw_isr_table[irq].arg); + return mask; +} + +static inline int _xtensa_handle_one_int3(unsigned int mask) +{ + int irq; + + if (mask & BIT(3)) { + mask = BIT(3); + irq = 3; + goto handle_irq; + } + return 0; +handle_irq: + _sw_isr_table[irq].isr(_sw_isr_table[irq].arg); + return mask; +} + +static inline int _xtensa_handle_one_int4(unsigned int mask) +{ + int irq; + + if (mask & BIT(4)) { + mask = BIT(4); + irq = 4; + goto handle_irq; + } + return 0; +handle_irq: + _sw_isr_table[irq].isr(_sw_isr_table[irq].arg); + return mask; +} + +static inline int _xtensa_handle_one_int5(unsigned int mask) +{ + int irq; + + if (mask & BIT(5)) { + mask = BIT(5); + irq = 5; + goto handle_irq; + } + return 0; +handle_irq: + _sw_isr_table[irq].isr(_sw_isr_table[irq].arg); + return mask; +} + +static inline int _xtensa_handle_one_int7(unsigned int mask) +{ + int irq; + + if (mask & BIT(7)) { + mask = BIT(7); + irq = 7; + goto handle_irq; + } + return 0; +handle_irq: + _sw_isr_table[irq].isr(_sw_isr_table[irq].arg); + return mask; +} + +static inline int _xtensa_handle_one_int0(unsigned int mask) +{ + return 0; +} +static inline int _xtensa_handle_one_int6(unsigned int mask) +{ + return 0; +} diff --git a/soc/amd/acp_6_0/adsp/include/adsp/cache.h b/soc/amd/acp_6_0/adsp/include/adsp/cache.h new file mode 100644 index 0000000000000..9f0ab28039583 --- /dev/null +++ b/soc/amd/acp_6_0/adsp/include/adsp/cache.h @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2024 AMD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef __COMMON_ADSP_CACHE_H__ +#define __COMMON_ADSP_CACHE_H__ +#include +#endif diff --git a/soc/amd/acp_6_0/adsp/include/adsp/io.h b/soc/amd/acp_6_0/adsp/include/adsp/io.h new file mode 100644 index 0000000000000..dd8949fecc87c --- /dev/null +++ b/soc/amd/acp_6_0/adsp/include/adsp/io.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 AMD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef __INCLUDE_IO__ +#define __INCLUDE_IO__ + +#include +#include +#include +#include + +static inline uint32_t io_reg_read(uint32_t reg) +{ + return sys_read32(reg); +} + +static inline void io_reg_write(uint32_t reg, uint32_t val) +{ + sys_write32(val, reg); +} + +static inline void io_reg_update_bits(uint32_t reg, uint32_t mask, uint32_t value) +{ + io_reg_write(reg, (io_reg_read(reg) & (~mask)) | (value & mask)); +} + +static inline uint16_t io_reg_read16(uint32_t reg) +{ + return sys_read16(reg); +} + +static inline void io_reg_write16(uint32_t reg, uint16_t val) +{ + sys_write16(val, reg); +} + +#endif diff --git a/soc/amd/acp_6_0/adsp/linker.ld b/soc/amd/acp_6_0/adsp/linker.ld new file mode 100644 index 0000000000000..8a16d331d7f15 --- /dev/null +++ b/soc/amd/acp_6_0/adsp/linker.ld @@ -0,0 +1,584 @@ +/* + * Copyright (c) 2022,2024 AMD + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * @file + * @brief Linker command/script file + * + * Linker script for the AMD acp_6_0 platform + */ + +OUTPUT_ARCH(xtensa) + +#include +#include +#include +#include + +#include +#include + +PROVIDE(__memctl_default = 0x00000000); +PROVIDE(_MemErrorHandler = 0x00000000); + +#define RAMABLE_REGION sdram0 :sdram0_phdr +#define ROMABLE_REGION sdram0 :sdram0_phdr + +MEMORY +{ + vector_reset_text : + org = XCHAL_RESET_VECTOR_PADDR_IRAM, + len = MEM_RESET_TEXT_SIZE + vector_reset_lit : + org = XCHAL_RESET_VECTOR_PADDR_IRAM + MEM_RESET_TEXT_SIZE, + len = MEM_RESET_LIT_SIZE + vector_base_text : + org = XCHAL_WINDOW_VECTORS_PADDR_IRAM, //XCHAL_VECBASE_RESET_PADDR, + len = MEM_VECBASE_LIT_SIZE + vector_int2_lit : + org = XCHAL_INTLEVEL2_VECTOR_PADDR_IRAM - MEM_VECT_LIT_SIZE, + len = MEM_VECT_LIT_SIZE + vector_int2_text : + org = XCHAL_INTLEVEL2_VECTOR_PADDR_IRAM, + len = MEM_VECT_TEXT_SIZE + vector_int3_lit : + org = XCHAL_INTLEVEL3_VECTOR_PADDR_IRAM - MEM_VECT_LIT_SIZE, + len = MEM_VECT_LIT_SIZE + vector_int3_text : + org = XCHAL_INTLEVEL3_VECTOR_PADDR_IRAM, + len = MEM_VECT_TEXT_SIZE + vector_int4_lit : + org = XCHAL_INTLEVEL4_VECTOR_PADDR_IRAM - MEM_VECT_LIT_SIZE, + len = MEM_VECT_LIT_SIZE + vector_int4_text : + org = XCHAL_INTLEVEL4_VECTOR_PADDR_IRAM, + len = MEM_VECT_TEXT_SIZE + vector_int5_lit : + org = XCHAL_INTLEVEL5_VECTOR_PADDR_IRAM - MEM_VECT_LIT_SIZE, + len = MEM_VECT_LIT_SIZE + vector_int5_text : + org = XCHAL_INTLEVEL5_VECTOR_PADDR_IRAM, + len = MEM_VECT_TEXT_SIZE + vector_int6_lit : + org = XCHAL_INTLEVEL6_VECTOR_PADDR_IRAM - MEM_VECT_LIT_SIZE, + len = MEM_VECT_LIT_SIZE + vector_int6_text : + org = XCHAL_INTLEVEL6_VECTOR_PADDR_IRAM, + len = MEM_VECT_TEXT_SIZE + + vector_int7_lit : + org = XCHAL_INTLEVEL7_VECTOR_PADDR_IRAM - MEM_VECT_LIT_SIZE, + len = MEM_VECT_LIT_SIZE + vector_int7_text : + org = XCHAL_INTLEVEL7_VECTOR_PADDR_IRAM, + len = MEM_VECT_TEXT_SIZE + vector_kernel_lit : + org = XCHAL_KERNEL_VECTOR_PADDR_IRAM - MEM_VECT_LIT_SIZE, + len = MEM_VECT_LIT_SIZE + vector_kernel_text : + org = XCHAL_KERNEL_VECTOR_PADDR_IRAM, + len = MEM_VECT_TEXT_SIZE + vector_user_lit : + org = XCHAL_USER_VECTOR_PADDR_IRAM - MEM_VECT_LIT_SIZE, + len = MEM_VECT_LIT_SIZE + vector_user_text : + org = XCHAL_USER_VECTOR_PADDR_IRAM, + len = MEM_VECT_TEXT_SIZE + vector_double_lit : + org = XCHAL_DOUBLEEXC_VECTOR_PADDR_IRAM - MEM_VECT_LIT_SIZE, + len = MEM_VECT_LIT_SIZE + vector_double_text : + org = XCHAL_DOUBLEEXC_VECTOR_PADDR_IRAM, + len = MEM_VECT_TEXT_SIZE + iram_text_start : + org = XCHAL_DOUBLEEXC_VECTOR_PADDR_IRAM + MEM_VECT_TEXT_SIZE, + len = (IRAM_BASE + IRAM_SIZE) - (XCHAL_DOUBLEEXC_VECTOR_PADDR_IRAM + MEM_VECT_TEXT_SIZE) + + sdram0 : + org = DRAM0_BASE, + len = DRAM0_SIZE + sdram1 : + org = SRAM1_BASE, + len = SRAM1_SIZE + +#ifdef CONFIG_GEN_ISR_TABLES + IDT_LIST : + org = IDT_BASE, + len = IDT_SIZE +#endif + + static_uuid_entries_seg (!ari) : + org = UUID_ENTRY_ELF_BASE, + len = UUID_ENTRY_ELF_SIZE + static_log_entries_seg (!ari) : + org = LOG_ENTRY_ELF_BASE, + len = LOG_ENTRY_ELF_SIZE + fw_metadata_seg (!ari) : + org = EXT_MANIFEST_ELF_BASE, + len = EXT_MANIFEST_ELF_SIZE +} + +PHDRS +{ + vector_reset_text_phdr PT_LOAD; + vector_reset_lit_phdr PT_LOAD; + vector_base_text_phdr PT_LOAD; + vector_base_lit_phdr PT_LOAD; + vector_int2_text_phdr PT_LOAD; + vector_int2_lit_phdr PT_LOAD; + vector_int3_text_phdr PT_LOAD; + vector_int3_lit_phdr PT_LOAD; + vector_int4_text_phdr PT_LOAD; + vector_int4_lit_phdr PT_LOAD; + vector_int5_text_phdr PT_LOAD; + vector_int5_lit_phdr PT_LOAD; + vector_int6_text_phdr PT_LOAD; + vector_int6_lit_phdr PT_LOAD; + vector_int7_text_phdr PT_LOAD; + vector_int7_lit_phdr PT_LOAD; + vector_kernel_text_phdr PT_LOAD; + vector_kernel_lit_phdr PT_LOAD; + vector_user_text_phdr PT_LOAD; + vector_user_lit_phdr PT_LOAD; + vector_double_text_phdr PT_LOAD; + vector_double_lit_phdr PT_LOAD; + iram_text_start_phdr PT_LOAD; + sdram0_phdr PT_LOAD; + sdram1_phdr PT_LOAD; + static_uuid_entries_phdr PT_NOTE; + static_log_entries_phdr PT_NOTE; + metadata_entries_phdr PT_NOTE; +} + +/* Default entry point: */ +/*ENTRY(_ResetVector)*/ +_rom_store_table = 0; + +/* ABI0 does not use Window base */ +PROVIDE(_memmap_vecbase_reset = XCHAL_WINDOW_VECTORS_PADDR); + +ENTRY(CONFIG_KERNEL_ENTRY) + +/* Various memory-map dependent cache attribute settings: */ +_memmap_cacheattr_wb_base = 0x44024000; +_memmap_cacheattr_wt_base = 0x11021000; +_memmap_cacheattr_bp_base = 0x22022000; +_memmap_cacheattr_unused_mask = 0x00F00FFF; +_memmap_cacheattr_wb_trapnull = 0x4422422F; +_memmap_cacheattr_wba_trapnull = 0x4422422F; +_memmap_cacheattr_wbna_trapnull = 0x25222222; +_memmap_cacheattr_wt_trapnull = 0x1122122F; +_memmap_cacheattr_bp_trapnull = 0x2222222F; +_memmap_cacheattr_wb_strict = 0x44F24FFF; +_memmap_cacheattr_wt_strict = 0x11F21FFF; +_memmap_cacheattr_bp_strict = 0x22F22FFF; +_memmap_cacheattr_wb_allvalid = 0x44224222; +_memmap_cacheattr_wt_allvalid = 0x11221222; +_memmap_cacheattr_bp_allvalid = 0x22222222; +PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wbna_trapnull); +_EXT_MAN_ALIGN_ = 16; +EXTERN(ext_man_fw_ver) + +SECTIONS +{ + + #include +#ifdef CONFIG_LLEXT +#include +#endif + .ResetVector.text : ALIGN(4) + { + _ResetVector_text_start = ABSOLUTE(.); + KEEP (*(.ResetVector.text)) + _ResetVector_text_end = ABSOLUTE(.); + } >vector_reset_text :vector_reset_text_phdr + + .ResetVector.literal : ALIGN(4) + { + _ResetVector_literal_start = ABSOLUTE(.); + *(.ResetVector.literal) + _ResetVector_literal_end = ABSOLUTE(.); + } >vector_reset_lit :vector_reset_lit_phdr + + .WindowVectors.text : ALIGN(4) + { + _WindowVectors_text_start = ABSOLUTE(.); + KEEP (*(.WindowVectors.text)) + _WindowVectors_text_end = ABSOLUTE(.); + } >vector_base_text :vector_base_text_phdr + + .Level2InterruptVector.literal : ALIGN(4) + { + _Level2InterruptVector_literal_start = ABSOLUTE(.); + *(.Level2InterruptVector.literal) + _Level2InterruptVector_literal_end = ABSOLUTE(.); + } >vector_int2_lit :vector_int2_lit_phdr + + .Level2InterruptVector.text : ALIGN(4) + { + _Level2InterruptVector_text_start = ABSOLUTE(.); + KEEP (*(.Level2InterruptVector.text)) + _Level2InterruptVector_text_end = ABSOLUTE(.); + } >vector_int2_text :vector_int2_text_phdr + + .Level3InterruptVector.literal : ALIGN(4) + { + _Level3InterruptVector_literal_start = ABSOLUTE(.); + *(.Level3InterruptVector.literal) + _Level3InterruptVector_literal_end = ABSOLUTE(.); + } >vector_int3_lit :vector_int3_lit_phdr + + .Level3InterruptVector.text : ALIGN(4) + { + _Level3InterruptVector_text_start = ABSOLUTE(.); + KEEP (*(.Level3InterruptVector.text)) + _Level3InterruptVector_text_end = ABSOLUTE(.); + } >vector_int3_text :vector_int3_text_phdr + + .Level4InterruptVector.literal : ALIGN(4) + { + _Level4InterruptVector_literal_start = ABSOLUTE(.); + *(.Level4InterruptVector.literal) + _Level4InterruptVector_literal_end = ABSOLUTE(.); + } >vector_int4_lit :vector_int4_lit_phdr + + .Level4InterruptVector.text : ALIGN(4) + { + _Level4InterruptVector_text_start = ABSOLUTE(.); + KEEP (*(.Level4InterruptVector.text)) + _Level4InterruptVector_text_end = ABSOLUTE(.); + } >vector_int4_text :vector_int4_text_phdr + + .Level5InterruptVector.literal : ALIGN(4) + { + _Level5InterruptVector_literal_start = ABSOLUTE(.); + *(.Level5InterruptVector.literal) + _Level5InterruptVector_literal_end = ABSOLUTE(.); + } >vector_int5_lit :vector_int5_lit_phdr + + .Level5InterruptVector.text : ALIGN(4) + { + _Level5InterruptVector_text_start = ABSOLUTE(.); + KEEP (*(.Level5InterruptVector.text)) + _Level5InterruptVector_text_end = ABSOLUTE(.); + } >vector_int5_text :vector_int5_text_phdr + + .DebugExceptionVector.literal : ALIGN(4) + { + _DebugExceptionVector_literal_start = ABSOLUTE(.); + *(.DebugExceptionVector.literal) + _DebugExceptionVector_literal_end = ABSOLUTE(.); + } >vector_int6_lit :vector_int6_lit_phdr + + .DebugExceptionVector.text : ALIGN(4) + { + _DebugExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.DebugExceptionVector.text)) + _DebugExceptionVector_text_end = ABSOLUTE(.); + } >vector_int6_text :vector_int6_text_phdr + + .NMIExceptionVector.literal : ALIGN(4) + { + _NMIExceptionVector_literal_start = ABSOLUTE(.); + *(.NMIExceptionVector.literal) + _NMIExceptionVector_literal_end = ABSOLUTE(.); + } >vector_int7_lit :vector_int5_lit_phdr + + .NMIExceptionVector.text : ALIGN(4) + { + _NMIExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.NMIExceptionVector.text)) + _NMIExceptionVector_text_end = ABSOLUTE(.); + } >vector_int7_text :vector_int5_text_phdr + + .KernelExceptionVector.literal : ALIGN(4) + { + _KernelExceptionVector_literal_start = ABSOLUTE(.); + *(.KernelExceptionVector.literal) + _KernelExceptionVector_literal_end = ABSOLUTE(.); + } >vector_kernel_lit :vector_kernel_lit_phdr + + .KernelExceptionVector.text : ALIGN(4) + { + _KernelExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.KernelExceptionVector.text)) + _KernelExceptionVector_text_end = ABSOLUTE(.); + } >vector_kernel_text :vector_kernel_text_phdr + + .UserExceptionVector.literal : ALIGN(4) + { + _UserExceptionVector_literal_start = ABSOLUTE(.); + *(.UserExceptionVector.literal) + _UserExceptionVector_literal_end = ABSOLUTE(.); + } >vector_user_lit :vector_user_lit_phdr + + .UserExceptionVector.text : ALIGN(4) + { + _UserExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.UserExceptionVector.text)) + _UserExceptionVector_text_end = ABSOLUTE(.); + } >vector_user_text :vector_user_text_phdr + + .DoubleExceptionVector.literal : ALIGN(4) + { + _DoubleExceptionVector_literal_start = ABSOLUTE(.); + *(.DoubleExceptionVector.literal) + _DoubleExceptionVector_literal_end = ABSOLUTE(.); + } >vector_double_lit :vector_double_lit_phdr + + .DoubleExceptionVector.text : ALIGN(4) + { + _DoubleExceptionVector_text_start = ABSOLUTE(.); + KEEP (*(.DoubleExceptionVector.text)) + _DoubleExceptionVector_text_end = ABSOLUTE(.); + } >vector_double_text :vector_double_text_phdr + + .iram.text : ALIGN(4) + { + _stext = .; + _iram_text_start = ABSOLUTE(.); + *(.iram0.literal .iram.literal .iram.text.literal .iram0.text .iram.text) + _iram_text_end = ABSOLUTE(.); + } >iram_text_start :iram_text_start_phdr +/* stack */ + _end = SOF_STACK_END; + PROVIDE(end = SOF_STACK_END); + _stack_sentry = SOF_STACK_END; + __stack = SOF_STACK_BASE; + + .text : ALIGN(4) + { + _stext = .; + __text_region_start = ABSOLUTE(.); + KEEP (*(.ResetVector.text)) + *(.ResetVector.literal) /* default is _start in zephyr, set it to reset vector as in sof */ + *(.entry.text) + *(.init.literal) + KEEP(*(.init)) + *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) + *(.fini.literal) + KEEP(*(.fini)) + *(.gnu.version) + __text_region_end = ABSOLUTE(.); + _etext = .; + } >iram_text_start :iram_text_start_phdr + + + .rodata : ALIGN(4) + { + __rodata_region_start = ABSOLUTE(.); + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r.*) + *(.rodata1) + __XT_EXCEPTION_TABLE__ = ABSOLUTE(.); + KEEP (*(.xt_except_table)) + KEEP (*(.gcc_except_table .gcc_except_table.*)) + *(.gnu.linkonce.e.*) + *(.gnu.version_r) + KEEP (*(.eh_frame)) + /* C++ constructor and destructor tables, properly ordered: */ + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + /* C++ exception handlers table: */ + __XT_EXCEPTION_DESCS__ = ABSOLUTE(.); + *(.xt_except_desc) + *(.gnu.linkonce.h.*) + __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.); + *(.xt_except_desc_end) + *(.dynamic) + *(.gnu.version_d) + . = ALIGN(4); /* this table MUST be 4-byte aligned */ + _bss_table_start = ABSOLUTE(.); + LONG(_bss_start) + LONG(_bss_end) + _bss_table_end = ABSOLUTE(.); + __rodata_region_end = ABSOLUTE(.); + } >sdram0 :sdram0_phdr + + .module_init : ALIGN(4) + { + _module_init_start = ABSOLUTE(.); + *(*.initcall) + _module_init_end = ABSOLUTE(.); + } >sdram0 :sdram0_phdr + + + + #include + + + .fw_ready : ALIGN(4) + { + KEEP (*(.fw_ready)) + } >sdram0 :sdram0_phdr + + .noinit : ALIGN(4) + { + *(.noinit) + *(.noinit.*) + } >sdram0 :sdram0_phdr + + + .data : ALIGN(4) + { + __data_start = ABSOLUTE(.); + *(.data) + *(.data.*) + *(.gnu.linkonce.d.*) + KEEP(*(.gnu.linkonce.d.*personality*)) + *(.data1) + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s.*) + *(.sdata2) + *(.sdata2.*) + *(.gnu.linkonce.s2.*) + KEEP(*(.jcr)) + _trace_ctx_start = ABSOLUTE(.); + *(.trace_ctx) + _trace_ctx_end = ABSOLUTE(.); + + . = ALIGN(4); + *(.gna_model) + __data_end = ABSOLUTE(.); + . = ALIGN(4096); + + } >sdram0 :sdram0_phdr + + .lit4 : ALIGN(4) + { + _lit4_start = ABSOLUTE(.); + *(*.lit4) + *(.lit4.*) + *(.gnu.linkonce.lit4.*) + _lit4_end = ABSOLUTE(.); + } >sdram0 :sdram0_phdr + + + #include +/* Located in generated directory. This file is populated by calling + * zephyr_linker_sources(ROM_SECTIONS ...). Useful for grouping iterable RO structs. + */ +#include + + .bss (NOLOAD) : ALIGN(8) + { + . = ALIGN (8); + _bss_start = ABSOLUTE(.); + *(.dynsbss) + *(.sbss) + *(.sbss.*) + *(.gnu.linkonce.sb.*) + *(.scommon) + *(.sbss2) + *(.sbss2.*) + *(.gnu.linkonce.sb2.*) + *(.dynbss) + *(.bss) + *(.bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + . = ALIGN (8); + _bss_end = ABSOLUTE(.); + } >sdram0 :sdram0_phdr + + .heap_mem (NOLOAD) : ALIGN(8) + { + . = ALIGN (8); + _heap_mem_start = ABSOLUTE(.); + *(*.heap_mem) + _heap_mem_end = ABSOLUTE(.); + } >sdram1 :sdram1_phdr + + /* stack */ + _end = ALIGN (8); + PROVIDE(end = ALIGN (8)); + + __stack = DRAM0_BASE + DRAM0_SIZE; + .comment 0 : { *(.comment) } /* stack */ + + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + .debug_ranges 0 : { *(.debug_ranges) } + .xtensa.info 0 : { *(.xtensa.info) } + + .xt.insn 0 : + { + KEEP (*(.xt.insn)) + KEEP (*(.gnu.linkonce.x.*)) + } + .xt.prop 0 : + { + KEEP (*(.xt.prop)) + KEEP (*(.xt.prop.*)) + KEEP (*(.gnu.linkonce.prop.*)) + } + .xt.lit 0 : + { + KEEP (*(.xt.lit)) + KEEP (*(.xt.lit.*)) + KEEP (*(.gnu.linkonce.p.*)) + } + .xt.profile_range 0 : + { + KEEP (*(.xt.profile_range)) + KEEP (*(.gnu.linkonce.profile_range.*)) + } + .xt.profile_ranges 0 : + { + KEEP (*(.xt.profile_ranges)) + KEEP (*(.gnu.linkonce.xt.profile_ranges.*)) + } + .xt.profile_files 0 : + { + KEEP (*(.xt.profile_files)) + KEEP (*(.gnu.linkonce.xt.profile_files.*)) + } + +#ifdef CONFIG_GEN_ISR_TABLES +#include +#endif + + + .static_uuid_entries (COPY) : ALIGN(1024) + { + *(*.static_uuids) + } > static_uuid_entries_seg :static_uuid_entries_phdr + + .static_log_entries (COPY) : ALIGN(1024) + { + *(*.static_log*) + } > static_log_entries_seg :static_log_entries_phdr + + .fw_metadata (COPY) : ALIGN(1024) + { + KEEP (*(.fw_metadata)) + . = ALIGN(_EXT_MAN_ALIGN_); + } >fw_metadata_seg :metadata_entries_phdr + + /DISCARD/ : { *(.note.GNU-stack) } +} diff --git a/soc/amd/acp_6_0/adsp/memory.h b/soc/amd/acp_6_0/adsp/memory.h new file mode 100644 index 0000000000000..53b2530362b39 --- /dev/null +++ b/soc/amd/acp_6_0/adsp/memory.h @@ -0,0 +1,160 @@ +/* + * Copyright(c) 2022 AMD + * SPDX-License-Identifier: Apache-2.0 + * + * Author: Basavaraj Hiregoudar + * DineshKumar Kalva + */ +#ifndef ZEPHYR_SOC_AMD_ADSP_MEMORY_H_ +#define ZEPHYR_SOC_AMD_ADSP_MEMORY_H_ + +#define PLATFORM_CORE_COUNT 1 +#define PLATFORM_PRIMARY_CORE_ID 0 + +#define IRAM_BASE 0x7F000000 +#define IRAM_SIZE 0x60000 + +#define IRAM_RESERVE_HEADER_SPACE 0x400 + +#define MEM_RESET_TEXT_SIZE 0x400 +#define MEM_RESET_LIT_SIZE 0x8 +#define XCHAL_RESET_VECTOR_PADDR_IRAM 0x7F000000 +#define XCHAL_WINDOW_VECTORS_PADDR_IRAM 0x7F000400 + +#define XCHAL_VECBASE_RESET_PADDR_IRAM (IRAM_BASE + IRAM_RESERVE_HEADER_SPACE) + +#define MEM_VECBASE_LIT_SIZE 0x178 +#define MEM_WIN_TEXT_SIZE 0x178 + +/* Vector and literal sizes - not in core-isa.h */ +#define MEM_VECT_LIT_SIZE 0x7 +#define MEM_VECT_TEXT_SIZE 0x37 + +#define XCHAL_INTLEVEL2_VECTOR_PADDR_IRAM (XCHAL_VECBASE_RESET_PADDR_IRAM + 0x180) + +#define XCHAL_INTLEVEL3_VECTOR_PADDR_IRAM (XCHAL_VECBASE_RESET_PADDR_IRAM + 0x1C0) + +#define XCHAL_INTLEVEL4_VECTOR_PADDR_IRAM (XCHAL_VECBASE_RESET_PADDR_IRAM + 0x200) + +#define XCHAL_INTLEVEL5_VECTOR_PADDR_IRAM (XCHAL_VECBASE_RESET_PADDR_IRAM + 0x240) + +#define XCHAL_INTLEVEL6_VECTOR_PADDR_IRAM (XCHAL_VECBASE_RESET_PADDR_IRAM + 0x280) + +#define XCHAL_INTLEVEL7_VECTOR_PADDR_IRAM (XCHAL_VECBASE_RESET_PADDR_IRAM + 0x2C0) + +#define XCHAL_KERNEL_VECTOR_PADDR_IRAM (XCHAL_VECBASE_RESET_PADDR_IRAM + 0x300) + +#define XCHAL_USER_VECTOR_PADDR_IRAM (XCHAL_VECBASE_RESET_PADDR_IRAM + 0x340) + +#define XCHAL_DOUBLEEXC_VECTOR_PADDR_IRAM (XCHAL_VECBASE_RESET_PADDR_IRAM + 0x3C0) + +/* Location for the intList section which is later used to construct the + * Interrupt Descriptor Table (IDT). This is a bogus address as this + * section will be stripped off in the final image. + */ +#define IDT_BASE (IRAM_BASE + IRAM_SIZE) +/* size of the Interrupt Descriptor Table (IDT) */ +#define IDT_SIZE 0x2000 +/* physical DSP addresses */ +#define IRAM_BASE 0x7F000000 +#define IRAM_SIZE 0x60000 /* 384K */ +#define SRAM0_BASE 0x9FF00000 /* Scratch mem */ +#define SRAM1_BASE 0x60006000 +#define SRAM1_SIZE 0x80000 /* 256K Data Mem */ +#define DRAM0_BASE 0xE0000000 +#define DRAM0_SIZE 0x20000 /* 128K ,to use for heap mem */ +#define DMA0_BASE PU_REGISTER_BASE +#define DMA0_SIZE 0x4 +#define PU_REGISTER_BASE (0x9FD00000 - 0x01240000) +#define ACP_I2S_RX_RINGBUFADDR 0x1242000 +/* DAI DMA register base address */ +#define DAI_BASE (PU_REGISTER_BASE + ACP_I2S_RX_RINGBUFADDR) +#define DAI_BASE_REM (PU_REGISTER_BASE + ACP_P1_I2S_RX_RINGBUFADDR) +#define DAI_SIZE 0x4 +#define BT_TX_FIFO_OFFST (ACP_P1_BT_TX_FIFOADDR - ACP_P1_I2S_RX_RINGBUFADDR) +#define BT_RX_FIFO_OFFST (ACP_P1_BT_RX_FIFOADDR - ACP_P1_I2S_RX_RINGBUFADDR) +#define HS_TX_FIFO_OFFST (ACP_P1_HS_TX_FIFOADDR - ACP_P1_I2S_RX_RINGBUFADDR) +#define HS_RX_FIFO_OFFST (ACP_P1_HS_TX_FIFOADDR - ACP_P1_I2S_RX_RINGBUFADDR) +#define UUID_ENTRY_ELF_BASE 0x1FFFA000 +#define UUID_ENTRY_ELF_SIZE \ + 0x6000 /* Log buffer base need to be updated properly, these are used in linker scripts \ + */ +#define LOG_ENTRY_ELF_BASE 0x20000000 +#define LOG_ENTRY_ELF_SIZE 0x2000000 +#define EXT_MANIFEST_ELF_BASE (LOG_ENTRY_ELF_BASE + LOG_ENTRY_ELF_SIZE) +#define EXT_MANIFEST_ELF_SIZE 0x2000000 /* Stack configuration */ +#define SOF_STACK_SIZE 0x1000 +#define SOF_STACK_TOTAL_SIZE SOF_STACK_SIZE +#define SOF_STACK_END (DRAM0_BASE + DRAM0_SIZE) +#define SOF_STACK_BASE (SOF_STACK_END + SOF_STACK_SIZE) /* Mailbox configuration */ +#define SRAM_OUTBOX_BASE SRAM0_BASE +#define SRAM_OUTBOX_SIZE 0x400 +#define SRAM_OUTBOX_OFFSET 0 +#define SRAM_INBOX_BASE (SRAM_OUTBOX_BASE + SRAM_OUTBOX_SIZE) +#define SRAM_INBOX_SIZE 0x400 +#define SRAM_INBOX_OFFSET SRAM_OUTBOX_SIZE +#define SRAM_DEBUG_BASE (SRAM_INBOX_BASE + SRAM_INBOX_SIZE) +#define SRAM_DEBUG_SIZE 0x400 +#define SRAM_DEBUG_OFFSET (SRAM_INBOX_OFFSET + SRAM_INBOX_SIZE) +#define SRAM_EXCEPT_BASE (SRAM_DEBUG_BASE + SRAM_DEBUG_SIZE) +#define SRAM_EXCEPT_SIZE 0x400 +#define SRAM_EXCEPT_OFFSET (SRAM_DEBUG_OFFSET + SRAM_DEBUG_SIZE) +#define SRAM_STREAM_BASE (SRAM_EXCEPT_BASE + SRAM_EXCEPT_SIZE) +#define SRAM_STREAM_SIZE 0x400 +#define SRAM_STREAM_OFFSET (SRAM_EXCEPT_OFFSET + SRAM_EXCEPT_SIZE) +#define SRAM_TRACE_BASE (SRAM_STREAM_BASE + SRAM_STREAM_SIZE) +#define SRAM_TRACE_SIZE 0x400 +#define SRAM_TRACE_OFFSET (SRAM_STREAM_OFFSET + SRAM_STREAM_SIZE) +#define SOF_MAILBOX_SIZE \ + (SRAM_INBOX_SIZE + SRAM_OUTBOX_SIZE + SRAM_DEBUG_SIZE + SRAM_EXCEPT_SIZE + \ + SRAM_STREAM_SIZE + SRAM_TRACE_SIZE) +/* Heap section sizes for module pool */ +#define HEAP_RT_COUNT8 0 +#define HEAP_RT_COUNT16 48 +#define HEAP_RT_COUNT32 48 +#define HEAP_RT_COUNT64 32 +#define HEAP_RT_COUNT128 60 +#define HEAP_RT_COUNT256 32 +#define HEAP_RT_COUNT512 4 +#define HEAP_RT_COUNT1024 12 +#define HEAP_RT_COUNT2048 12 +/* Heap section sizes for system runtime heap */ +#define HEAP_SYS_RT_COUNT64 64 +#define HEAP_SYS_RT_COUNT512 20 /*rembrandt-arch*/ +#define HEAP_SYS_RT_COUNT1024 6 +/* Heap configuration */ +#define HEAP_SYSTEM_BASE DRAM0_BASE /* SRAM1_BASE */ +#define HEAP_SYSTEM_SIZE 0xE000 +#define HEAP_SYSTEM_0_BASE HEAP_SYSTEM_BASE +#define HEAP_SYS_RUNTIME_BASE (HEAP_SYSTEM_BASE + HEAP_SYSTEM_SIZE) +#define HEAP_SYS_RUNTIME_SIZE \ + (HEAP_SYS_RT_COUNT64 * 64 + HEAP_SYS_RT_COUNT512 * 512 + HEAP_SYS_RT_COUNT1024 * 1024) +#define HEAP_RUNTIME_BASE (HEAP_SYS_RUNTIME_BASE + HEAP_SYS_RUNTIME_SIZE) +#define HEAP_RUNTIME_SIZE \ + (HEAP_RT_COUNT8 * 8 + HEAP_RT_COUNT16 * 16 + HEAP_RT_COUNT32 * 32 + HEAP_RT_COUNT64 * 64 + \ + HEAP_RT_COUNT128 * 128 + HEAP_RT_COUNT256 * 256 + HEAP_RT_COUNT512 * 512 + \ + HEAP_RT_COUNT1024 * 1024 + HEAP_RT_COUNT2048 * 2048) +#define HEAP_BUFFER_BASE (HEAP_RUNTIME_BASE + HEAP_RUNTIME_SIZE) +#define HEAP_BUFFER_SIZE (0xF000) +#define HEAP_BUFFER_BLOCK_SIZE 0x180 +#define HEAP_BUFFER_COUNT (HEAP_BUFFER_SIZE / HEAP_BUFFER_BLOCK_SIZE) +#define PLATFORM_HEAP_SYSTEM 1 +#define PLATFORM_HEAP_SYSTEM_RUNTIME 1 +#define PLATFORM_HEAP_RUNTIME 1 +#define PLATFORM_HEAP_BUFFER 1 +/* Vector and literal sizes - not in core-isa.h */ +#define SOF_MEM_VECT_LIT_SIZE 0x7 +#define SOF_MEM_VECT_TEXT_SIZE 0x37 +#define SOF_MEM_VECT_SIZE (SOF_MEM_VECT_TEXT_SIZE + SOF_MEM_VECT_LIT_SIZE) +#define SOF_MEM_RESET_TEXT_SIZE 0x400 +#define SOF_MEM_RESET_LIT_SIZE 0x8 +#define SOF_MEM_VECBASE_LIT_SIZE 0x178 +#define SOF_MEM_WIN_TEXT_SIZE 0x178 +#define SOF_MEM_RO_SIZE 0x8 +#define uncache_to_cache(address) address +#define cache_to_uncache(address) address +#define is_uncached(address) 0 +#define HEAP_BUF_ALIGNMENT PLATFORM_DCACHE_ALIGN +/* brief EDF task's default stack size in bytes */ +#define PLATFORM_TASK_DEFAULT_STACK_SIZE 3072 +#endif /* ZEPHYR_SOC_AMD_ADSP_MEMORY_H_ */ diff --git a/soc/amd/acp_6_0/soc.yml b/soc/amd/acp_6_0/soc.yml new file mode 100644 index 0000000000000..52bde8304da9d --- /dev/null +++ b/soc/amd/acp_6_0/soc.yml @@ -0,0 +1,2 @@ +socs: + - name: acp_6_0 From 749192a9fb154c3f2286eea636a47b6a908df6a8 Mon Sep 17 00:00:00 2001 From: DineshKumar Kalva Date: Mon, 14 Oct 2024 14:50:40 +0530 Subject: [PATCH 2832/4482] Board: amd : add board support for the Audio DSP on ACP_6_0 soc. Create a acp_6_0_adsp board support for the Audio DSP on ACP soc. Signed-off-by: DineshKumar Kalva --- .../amd/acp_6_0_adsp/Kconfig.acp_6_0_adsp | 3 +- boards/amd/acp_6_0_adsp/acp_6_0_acp_adsp.dts | 14 ++ boards/amd/acp_6_0_adsp/acp_6_0_adsp.yml | 14 ++ .../amd/acp_6_0_adsp/acp_6_0_adsp_defconfig | 10 ++ boards/amd/acp_6_0_adsp/board.cmake | 4 + boards/amd/acp_6_0_adsp/board.yml | 6 + boards/amd/acp_6_0_adsp/doc/index.rst | 109 ++++++++++++ soc/amd/acp_6_0/CMakeLists.txt | 4 - soc/amd/acp_6_0/Kconfig | 1 + soc/amd/acp_6_0/Kconfig.defconfig | 17 +- soc/amd/acp_6_0/adsp/_soc_inthandlers.h | 165 ------------------ soc/amd/acp_6_0/adsp/include/adsp/cache.h | 10 -- soc/amd/acp_6_0/adsp/include/adsp/io.h | 40 ----- 13 files changed, 167 insertions(+), 230 deletions(-) rename soc/amd/acp_6_0/adsp/CMakeLists.txt => boards/amd/acp_6_0_adsp/Kconfig.acp_6_0_adsp (58%) create mode 100644 boards/amd/acp_6_0_adsp/acp_6_0_acp_adsp.dts create mode 100644 boards/amd/acp_6_0_adsp/acp_6_0_adsp.yml create mode 100644 boards/amd/acp_6_0_adsp/acp_6_0_adsp_defconfig create mode 100644 boards/amd/acp_6_0_adsp/board.cmake create mode 100644 boards/amd/acp_6_0_adsp/board.yml create mode 100644 boards/amd/acp_6_0_adsp/doc/index.rst delete mode 100644 soc/amd/acp_6_0/adsp/_soc_inthandlers.h delete mode 100644 soc/amd/acp_6_0/adsp/include/adsp/cache.h delete mode 100644 soc/amd/acp_6_0/adsp/include/adsp/io.h diff --git a/soc/amd/acp_6_0/adsp/CMakeLists.txt b/boards/amd/acp_6_0_adsp/Kconfig.acp_6_0_adsp similarity index 58% rename from soc/amd/acp_6_0/adsp/CMakeLists.txt rename to boards/amd/acp_6_0_adsp/Kconfig.acp_6_0_adsp index af69108b9b865..265e6dcf0c655 100644 --- a/soc/amd/acp_6_0/adsp/CMakeLists.txt +++ b/boards/amd/acp_6_0_adsp/Kconfig.acp_6_0_adsp @@ -1,4 +1,5 @@ # Copyright (c) 2024 AMD # SPDX-License-Identifier: Apache-2.0 -zephyr_include_directories(include) +config BOARD_ACP_6_0_ADSP +select SOC_ACP_6_0 diff --git a/boards/amd/acp_6_0_adsp/acp_6_0_acp_adsp.dts b/boards/amd/acp_6_0_adsp/acp_6_0_acp_adsp.dts new file mode 100644 index 0000000000000..e54f613b9e244 --- /dev/null +++ b/boards/amd/acp_6_0_adsp/acp_6_0_acp_adsp.dts @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2024 AMD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include + +/ { + model = "AMD ACP_6_0 Audio DSP"; + compatible = "acp_6_0"; +}; diff --git a/boards/amd/acp_6_0_adsp/acp_6_0_adsp.yml b/boards/amd/acp_6_0_adsp/acp_6_0_adsp.yml new file mode 100644 index 0000000000000..a93795d3c0045 --- /dev/null +++ b/boards/amd/acp_6_0_adsp/acp_6_0_adsp.yml @@ -0,0 +1,14 @@ +# +# Copyright 2024 AMD +# +# SPDX-License-Identifier: Apache-2.0 +# + +identifier: acp_6_0_adsp/acp_6_0 +name: AMD ACP6.0 Audio DSP +type: mcu +arch: xtensa +toolchain: + - zephyr + - xcc +vendor: amd diff --git a/boards/amd/acp_6_0_adsp/acp_6_0_adsp_defconfig b/boards/amd/acp_6_0_adsp/acp_6_0_adsp_defconfig new file mode 100644 index 0000000000000..34c4fb56f28d5 --- /dev/null +++ b/boards/amd/acp_6_0_adsp/acp_6_0_adsp_defconfig @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_GEN_ISR_TABLES=y +CONFIG_GEN_IRQ_VECTOR_TABLE=y +CONFIG_XTENSA_RESET_VECTOR=y +CONFIG_OUTPUT_SYMBOLS=y +CONFIG_MULTI_LEVEL_INTERRUPTS=n +CONFIG_2ND_LEVEL_INTERRUPTS=n +CONFIG_DCACHE_LINE_SIZE_DETECT=n +CONFIG_DCACHE_LINE_SIZE=128 diff --git a/boards/amd/acp_6_0_adsp/board.cmake b/boards/amd/acp_6_0_adsp/board.cmake new file mode 100644 index 0000000000000..7032982c61771 --- /dev/null +++ b/boards/amd/acp_6_0_adsp/board.cmake @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 +board_set_flasher_ifnset(misc-flasher) +board_finalize_runner_args(misc-flasher) +board_set_rimage_target(rmb) diff --git a/boards/amd/acp_6_0_adsp/board.yml b/boards/amd/acp_6_0_adsp/board.yml new file mode 100644 index 0000000000000..53ae8b3c87118 --- /dev/null +++ b/boards/amd/acp_6_0_adsp/board.yml @@ -0,0 +1,6 @@ +board: + name: acp_6_0_adsp + full_name: ACP 6.0 Xtensa Audio DSP + vendor: amd + socs: + - name: acp_6_0 diff --git a/boards/amd/acp_6_0_adsp/doc/index.rst b/boards/amd/acp_6_0_adsp/doc/index.rst new file mode 100644 index 0000000000000..fcc9221eafc27 --- /dev/null +++ b/boards/amd/acp_6_0_adsp/doc/index.rst @@ -0,0 +1,109 @@ +.. zephyr:board:: acp_6_0_adsp + +Overview +******** + +ACP 6.0 is Audio co-processor in AMD SoC based on HiFi5 DSP Xtensa Architecture, +Zephyr OS is ported to run various audio and speech use cases on +the SOF based framework. + +SOF can be built with either Zephyr or Cadence's proprietary +Xtensa OS (XTOS) and run on a ACP 6.0 AMD platforms. + +Hardware +******** + +- Board features: + + - RAM: 1.75MB HP SRAM & 512KB configurable IRAM/DRAM + - Audio Interfaces: + + - 1 x SP (I2S, PCM), + - 1 x BT (I2S, PCM), + - 1 x HS (I2S, PCM), + - DMIC + +Supported Features +================== + +The following hardware features are supported: + ++-----------+------------+-------------------------------------+ +| Interface | Controller | Driver/Component | ++===========+============+=====================================+ +| I2S | on-chip | I2S controller | ++-----------+------------+-------------------------------------+ +| DMIC(PDM) | on-chip | PDM controller | ++-----------+------------+-------------------------------------+ + +System Clock +============ + +The ACP 6.0 SoC operates with an audio clock frequency ranging from 200 to 800 MHz. + +System requirements +******************* + +Xtensa Toolchain (optional) +=========================== + +The Zephyr SDK provides GCC-based toolchains necessary to build Zephyr for +the AMD ACP boards. For users looking for higher optimization levels, +building with the proprietary Xtensa toolchain from Cadence +might be preferable. + +The following instructions assume you have purchased and +installed the toolchain(s) and core(s) for your board following +instructions from Xtensa documentation. + +If you choose to build with the Xtensa toolchain instead of the Zephyr SDK, set +the following environment variables specific to the board in addition to the +Xtensa toolchain environment variable listed below. + +First, make sure, the necessary license is available from +Cadence and set the license variables as per the instruction from Cadence. +Next, set the following environment variables: + +The bottom three variables are specific to acp_6_0. + +.. code-block:: shell + + export XTENSA_TOOLCHAIN_PATH="tools installed path" + export XTENSA_BUILDS_DIR="user build directory path" + export ZEPHYR_TOOLCHAIN_VARIANT=xcc + export TOOLCHAIN_VER=RI-2019.1-linux + export XTENSA_CORE=LX7_HiFi5_PROD + +Programming and Debugging +************************* + +Building +======== + +Build as usual. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: acp_6_0_adsp/acp_6_0 + :goals: build + +Flashing +======== + +AMD supports only signed images flashing on ACP 6.0 platforms +through ACP Linux Driver. + +The following boot sequence messages can be observed in dmesg + + - booting DSP firmware + - ACP_DSP0_RUNSTALL : 0x0 + - ipc rx: 0x70000000 + - Firmware info: version 2:11:99-03a9d + - Firmware: ABI 3:29:1 Kernel ABI 3:23:0 + - mailbox upstream 0x0 - size 0x400 + - mailbox downstream 0x400 - size 0x400 + - stream region 0x1000 - size 0x400 + - debug region 0x800 - size 0x400 + - fw_state change: 3 -> 6 + - ipc rx done: 0x70000000 + - firmware boot complete diff --git a/soc/amd/acp_6_0/CMakeLists.txt b/soc/amd/acp_6_0/CMakeLists.txt index d8ade87e26c66..3a25e76edd3e8 100644 --- a/soc/amd/acp_6_0/CMakeLists.txt +++ b/soc/amd/acp_6_0/CMakeLists.txt @@ -1,6 +1,3 @@ -if(CONFIG_SOC_ACP_6_0) - zephyr_include_directories(adsp) - add_subdirectory(adsp) # See detailed comments in soc/xtensa/intel_adsp/common/CMakeLists.txt add_custom_target(zephyr.ri ALL DEPENDS ${CMAKE_BINARY_DIR}/zephyr/zephyr.ri @@ -12,4 +9,3 @@ add_custom_command( DEPENDS ${CMAKE_BINARY_DIR}/zephyr/${KERNEL_ELF_NAME} ) set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/adsp/linker.ld CACHE INTERNAL "") -endif() diff --git a/soc/amd/acp_6_0/Kconfig b/soc/amd/acp_6_0/Kconfig index 2aef8893d3a48..b2f1bd87f8541 100644 --- a/soc/amd/acp_6_0/Kconfig +++ b/soc/amd/acp_6_0/Kconfig @@ -2,6 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 config SOC_ACP_6_0 select XTENSA + select XTENSA_GEN_HANDLERS select XTENSA_HAL if ("$(ZEPHYR_TOOLCHAIN_VARIANT)" != "xcc" && "$(ZEPHYR_TOOLCHAIN_VARIANT)" != "xt-clang") select XTENSA_RESET_VECTOR select ATOMIC_OPERATIONS_BUILTIN diff --git a/soc/amd/acp_6_0/Kconfig.defconfig b/soc/amd/acp_6_0/Kconfig.defconfig index 9cb6f2353221a..852a0c329ca25 100644 --- a/soc/amd/acp_6_0/Kconfig.defconfig +++ b/soc/amd/acp_6_0/Kconfig.defconfig @@ -3,26 +3,23 @@ if SOC_ACP_6_0 config DCACHE_LINE_SIZE -default 128 + default 128 config CACHE_MANAGEMENT -default n + default n config XTENSA_TIMER -default y + default y config SYS_CLOCK_HW_CYCLES_PER_SEC -default 600000000 if XTENSA_TIMER - -config KERNEL_ENTRY -default "__start" + default 600000000 if XTENSA_TIMER config MULTI_LEVEL_INTERRUPTS -default n + default n config 2ND_LEVEL_INTERRUPTS -default n + default n config KERNEL_ENTRY -default "__start" + default "__start" endif diff --git a/soc/amd/acp_6_0/adsp/_soc_inthandlers.h b/soc/amd/acp_6_0/adsp/_soc_inthandlers.h deleted file mode 100644 index ab632d1bc1df3..0000000000000 --- a/soc/amd/acp_6_0/adsp/_soc_inthandlers.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2024 AMD - * - * SPDX-License-Identifier: Apache-2.0 - */ -/* - * THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT. - * - * Functions here are designed to produce efficient code to - * search an Xtensa bitmask of interrupts, inspecting only those bits - * declared to be associated with a given interrupt level. Each - * dispatcher will handle exactly one flagged interrupt, in numerical - * order (low bits first) and will return a mask of that bit that can - * then be cleared by the calling code. Unrecognized bits for the - * level will invoke an error handler. - */ - -#include -#include -#include - -#if !defined(XCHAL_INT0_LEVEL) || XCHAL_INT0_LEVEL != 1 -#error core-isa.h interrupt level does not match dispatcher! -#endif -#if !defined(XCHAL_INT1_LEVEL) || XCHAL_INT1_LEVEL != 1 -#error core-isa.h interrupt level does not match dispatcher! -#endif -#if !defined(XCHAL_INT6_LEVEL) || XCHAL_INT6_LEVEL != 1 -#error core-isa.h interrupt level does not match dispatcher! -#endif -#if !defined(XCHAL_INT8_LEVEL) || XCHAL_INT8_LEVEL != 1 -#error core-isa.h interrupt level does not match dispatcher! -#endif -#if !defined(XCHAL_INT2_LEVEL) || XCHAL_INT2_LEVEL != 2 -#error core-isa.h interrupt level does not match dispatcher! -#endif -#if !defined(XCHAL_INT3_LEVEL) || XCHAL_INT3_LEVEL != 3 -#error core-isa.h interrupt level does not match dispatcher! -#endif -#if !defined(XCHAL_INT4_LEVEL) || XCHAL_INT4_LEVEL != 4 -#error core-isa.h interrupt level does not match dispatcher! -#endif -#if !defined(XCHAL_INT5_LEVEL) || XCHAL_INT5_LEVEL != 5 -#error core-isa.h interrupt level does not match dispatcher! -#endif -#if !defined(XCHAL_INT7_LEVEL) || XCHAL_INT7_LEVEL != 7 -#error core-isa.h interrupt level does not match dispatcher! -#endif - -static inline int _xtensa_handle_one_int1(unsigned int mask) -{ - int irq; - - if (mask & 0x3) { - if (mask & BIT(0)) { - mask = BIT(0); - irq = 0; - goto handle_irq; - } - if (mask & BIT(1)) { - mask = BIT(1); - irq = 1; - goto handle_irq; - } - } else { - if (mask & BIT(6)) { - mask = BIT(6); - irq = 6; - goto handle_irq; - } - if (mask & BIT(8)) { - mask = BIT(8); - irq = 8; - goto handle_irq; - } - } - return 0; -handle_irq: - _sw_isr_table[irq].isr(_sw_isr_table[irq].arg); - return mask; -} - -static inline int _xtensa_handle_one_int2(unsigned int mask) -{ - int irq; - - if (mask & BIT(2)) { - mask = BIT(2); - irq = 2; - goto handle_irq; - } - return 0; -handle_irq: - _sw_isr_table[irq].isr(_sw_isr_table[irq].arg); - return mask; -} - -static inline int _xtensa_handle_one_int3(unsigned int mask) -{ - int irq; - - if (mask & BIT(3)) { - mask = BIT(3); - irq = 3; - goto handle_irq; - } - return 0; -handle_irq: - _sw_isr_table[irq].isr(_sw_isr_table[irq].arg); - return mask; -} - -static inline int _xtensa_handle_one_int4(unsigned int mask) -{ - int irq; - - if (mask & BIT(4)) { - mask = BIT(4); - irq = 4; - goto handle_irq; - } - return 0; -handle_irq: - _sw_isr_table[irq].isr(_sw_isr_table[irq].arg); - return mask; -} - -static inline int _xtensa_handle_one_int5(unsigned int mask) -{ - int irq; - - if (mask & BIT(5)) { - mask = BIT(5); - irq = 5; - goto handle_irq; - } - return 0; -handle_irq: - _sw_isr_table[irq].isr(_sw_isr_table[irq].arg); - return mask; -} - -static inline int _xtensa_handle_one_int7(unsigned int mask) -{ - int irq; - - if (mask & BIT(7)) { - mask = BIT(7); - irq = 7; - goto handle_irq; - } - return 0; -handle_irq: - _sw_isr_table[irq].isr(_sw_isr_table[irq].arg); - return mask; -} - -static inline int _xtensa_handle_one_int0(unsigned int mask) -{ - return 0; -} -static inline int _xtensa_handle_one_int6(unsigned int mask) -{ - return 0; -} diff --git a/soc/amd/acp_6_0/adsp/include/adsp/cache.h b/soc/amd/acp_6_0/adsp/include/adsp/cache.h deleted file mode 100644 index 9f0ab28039583..0000000000000 --- a/soc/amd/acp_6_0/adsp/include/adsp/cache.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (c) 2024 AMD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef __COMMON_ADSP_CACHE_H__ -#define __COMMON_ADSP_CACHE_H__ -#include -#endif diff --git a/soc/amd/acp_6_0/adsp/include/adsp/io.h b/soc/amd/acp_6_0/adsp/include/adsp/io.h deleted file mode 100644 index dd8949fecc87c..0000000000000 --- a/soc/amd/acp_6_0/adsp/include/adsp/io.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2024 AMD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef __INCLUDE_IO__ -#define __INCLUDE_IO__ - -#include -#include -#include -#include - -static inline uint32_t io_reg_read(uint32_t reg) -{ - return sys_read32(reg); -} - -static inline void io_reg_write(uint32_t reg, uint32_t val) -{ - sys_write32(val, reg); -} - -static inline void io_reg_update_bits(uint32_t reg, uint32_t mask, uint32_t value) -{ - io_reg_write(reg, (io_reg_read(reg) & (~mask)) | (value & mask)); -} - -static inline uint16_t io_reg_read16(uint32_t reg) -{ - return sys_read16(reg); -} - -static inline void io_reg_write16(uint32_t reg, uint16_t val) -{ - sys_write16(val, reg); -} - -#endif From 0852af215b6178b8b8a44c77f2bf0575e0427ef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 15 Nov 2024 15:25:05 +0100 Subject: [PATCH 2833/4482] drivers: pinctrl: nrf: Optimize access to gpd service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Request and release global power domain only once during setup of pins. Request and release involves communication over IPC and it should be avoided if possible. For example if there are 4 pins (like in UART) where GPD is requested we can limit number of request/release operations fourfold. Signed-off-by: Krzysztof Chruściński --- drivers/pinctrl/pinctrl_nrf.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index 1e80de8fe67c3..1e587d08b629b 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -97,6 +97,10 @@ static const nrf_gpio_pin_drive_t drive_modes[NRF_DRIVE_COUNT] = { int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintptr_t reg) { +#ifdef CONFIG_SOC_NRF54H20_GPD + bool gpd_requested = false; +#endif + for (uint8_t i = 0U; i < pin_cnt; i++) { nrf_gpio_pin_drive_t drive; uint8_t drive_idx = NRF_GET_DRIVE(pins[i]); @@ -357,13 +361,17 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, #ifdef CONFIG_SOC_NRF54H20_GPD if (NRF_GET_GPD_FAST_ACTIVE1(pins[i]) == 1U) { - int ret; uint32_t d_pin = pin; NRF_GPIO_Type *port = nrf_gpio_pin_port_decode(&d_pin); - ret = nrf_gpd_request(NRF_GPD_SLOW_ACTIVE); - if (ret < 0) { - return ret; + if (!gpd_requested) { + int ret; + + ret = nrf_gpd_request(NRF_GPD_SLOW_ACTIVE); + if (ret < 0) { + return ret; + } + gpd_requested = true; } port->RETAINCLR = BIT(d_pin); @@ -387,20 +395,26 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, #endif #ifdef CONFIG_SOC_NRF54H20_GPD if (NRF_GET_GPD_FAST_ACTIVE1(pins[i]) == 1U) { - int ret; uint32_t d_pin = pin; NRF_GPIO_Type *port = nrf_gpio_pin_port_decode(&d_pin); port->RETAINSET = BIT(d_pin); - ret = nrf_gpd_release(NRF_GPD_SLOW_ACTIVE); - if (ret < 0) { - return ret; - } } #endif /* CONFIG_SOC_NRF54H20_GPD */ } } +#ifdef CONFIG_SOC_NRF54H20_GPD + if (gpd_requested) { + int ret; + + ret = nrf_gpd_release(NRF_GPD_SLOW_ACTIVE); + if (ret < 0) { + return ret; + } + } +#endif + return 0; } From e569dfe1759397c0b40cac64a163fe64265e4778 Mon Sep 17 00:00:00 2001 From: James Roy Date: Fri, 15 Nov 2024 22:57:47 +0800 Subject: [PATCH 2834/4482] doc: build: dts: Fix incorrect rst tag Replaced incorrect ':c:func:' tag for devicetree macro with ':c:macro' tag. Signed-off-by: James Roy --- doc/build/dts/api/api.rst | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/build/dts/api/api.rst b/doc/build/dts/api/api.rst index 7e47f2c1ed9da..189c3a3dadfa6 100644 --- a/doc/build/dts/api/api.rst +++ b/doc/build/dts/api/api.rst @@ -33,10 +33,10 @@ devicetree data in C rvalue form using, for example, the :ref:`devicetree-property-access` API. The root node ``/`` has node identifier ``DT_ROOT``. You can create node -identifiers for other devicetree nodes using :c:func:`DT_PATH`, -:c:func:`DT_NODELABEL`, :c:func:`DT_ALIAS`, and :c:func:`DT_INST`. +identifiers for other devicetree nodes using :c:macro:`DT_PATH`, +:c:macro:`DT_NODELABEL`, :c:macro:`DT_ALIAS`, and :c:macro:`DT_INST`. -There are also :c:func:`DT_PARENT` and :c:func:`DT_CHILD` macros which can be +There are also :c:macro:`DT_PARENT` and :c:macro:`DT_CHILD` macros which can be used to create node identifiers for a given node's parent node or a particular child node, respectively. @@ -105,11 +105,11 @@ For-each macros =============== There is currently only one "generic" for-each macro, -:c:func:`DT_FOREACH_CHILD`, which allows iterating over the children of a +:c:macro:`DT_FOREACH_CHILD`, which allows iterating over the children of a devicetree node. There are special-purpose for-each macros, like -:c:func:`DT_INST_FOREACH_STATUS_OKAY`, but these require ``DT_DRV_COMPAT`` to +:c:macro:`DT_INST_FOREACH_STATUS_OKAY`, but these require ``DT_DRV_COMPAT`` to be defined before use. .. doxygengroup:: devicetree-generic-foreach @@ -120,7 +120,7 @@ Existence checks This section documents miscellaneous macros that can be used to test if a node exists, how many nodes of a certain type exist, whether a node has certain properties, etc. Some macros used for special purposes (such as -:c:func:`DT_IRQ_HAS_IDX` and all macros which require ``DT_DRV_COMPAT``) are +:c:macro:`DT_IRQ_HAS_IDX` and all macros which require ``DT_DRV_COMPAT``) are documented elsewhere on this page. .. doxygengroup:: devicetree-generic-exist @@ -159,7 +159,7 @@ chosen is an implementation detail, but cyclic dependencies are detected and cause errors, so it's safe to assume there are none when using these macros. There are instance number-based conveniences as well; see -:c:func:`DT_INST_DEP_ORD` and subsequent documentation. +:c:macro:`DT_INST_DEP_ORD` and subsequent documentation. .. doxygengroup:: devicetree-dep-ord @@ -201,7 +201,7 @@ with compatible ``vnd,serial``: .. warning:: - Be careful making assumptions about instance numbers. See :c:func:`DT_INST` + Be careful making assumptions about instance numbers. See :c:macro:`DT_INST` for the API guarantees. As shown above, the ``DT_INST_*`` APIs are conveniences for addressing nodes by @@ -210,8 +210,8 @@ instance number. They are almost all defined in terms of one of the removing ``INST_`` from the macro name. For example, ``DT_INST_PROP(inst, prop)`` is equivalent to ``DT_PROP(DT_DRV_INST(inst), prop)``. Similarly, ``DT_INST_REG_ADDR(inst)`` is equivalent to ``DT_REG_ADDR(DT_DRV_INST(inst))``, -and so on. There are some exceptions: :c:func:`DT_ANY_INST_ON_BUS_STATUS_OKAY` -and :c:func:`DT_INST_FOREACH_STATUS_OKAY` are special-purpose helpers without +and so on. There are some exceptions: :c:macro:`DT_ANY_INST_ON_BUS_STATUS_OKAY` +and :c:macro:`DT_INST_FOREACH_STATUS_OKAY` are special-purpose helpers without straightforward generic equivalents. Since ``DT_DRV_INST()`` requires ``DT_DRV_COMPAT`` to be defined, it's an error @@ -355,7 +355,7 @@ Chosen nodes ************ The special ``/chosen`` node contains properties whose values describe -system-wide settings. The :c:func:`DT_CHOSEN()` macro can be used to get a node +system-wide settings. The :c:macro:`DT_CHOSEN()` macro can be used to get a node identifier for a chosen node. .. doxygengroup:: devicetree-generic-chosen From 54dc01153caa38de6f6065b74768bcc766879a82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Wed, 30 Oct 2024 13:14:58 +0100 Subject: [PATCH 2835/4482] usb: device_next: check wIndex on Set Address MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Set Address behavior is not specified when wValue is greater than 127, or if wIndex or wLength are non-zero. USB stack did check wValue and wLength but didn't care about wIndex value. Extend the check so non-zero wIndex also results in STALL response. Signed-off-by: Tomasz Moń --- subsys/usb/device_next/usbd_ch9.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/usb/device_next/usbd_ch9.c b/subsys/usb/device_next/usbd_ch9.c index 0203e08675bce..1b7986ed623b1 100644 --- a/subsys/usb/device_next/usbd_ch9.c +++ b/subsys/usb/device_next/usbd_ch9.c @@ -86,8 +86,8 @@ static int sreq_set_address(struct usbd_context *const uds_ctx) struct usb_setup_packet *setup = usbd_get_setup_pkt(uds_ctx); struct udc_device_caps caps = udc_caps(uds_ctx->dev); - /* Not specified if wLength is non-zero, treat as error */ - if (setup->wValue > 127 || setup->wLength) { + /* Not specified if wIndex or wLength is non-zero, treat as error */ + if (setup->wValue > 127 || setup->wIndex || setup->wLength) { errno = -ENOTSUP; return 0; } From e3acf5fa043af0e8ac9cc911b224be6fc58613dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Wed, 30 Oct 2024 06:33:09 +0100 Subject: [PATCH 2836/4482] drivers: udc_nrf: handle overwritten Set Address commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit USBD peripheral automatically handles Set Address command which can lead to state mismatch between USB stack and the host. Keep track of device address and issue fake Set Address commands on mismatch. This fixes default vs addressed state mismatch that can occur due to sufficently high SETUP handling latency. The state mismatch was most commonly seen as SET CONFIGURATION failure when the enumeration happened during periods with increased latency. Signed-off-by: Tomasz Moń --- drivers/usb/udc/udc_nrf.c | 119 +++++++++++++++++++++++++++++++++++--- 1 file changed, 110 insertions(+), 9 deletions(-) diff --git a/drivers/usb/udc/udc_nrf.c b/drivers/usb/udc/udc_nrf.c index 2d1eb17d47231..bf04a274ad692 100644 --- a/drivers/usb/udc/udc_nrf.c +++ b/drivers/usb/udc/udc_nrf.c @@ -70,7 +70,8 @@ static struct k_thread drv_stack_data; static struct udc_ep_config ep_cfg_out[CFG_EPOUT_CNT + CFG_EP_ISOOUT_CNT + 1]; static struct udc_ep_config ep_cfg_in[CFG_EPIN_CNT + CFG_EP_ISOIN_CNT + 1]; -static bool udc_nrf_setup_rcvd; +static bool udc_nrf_setup_rcvd, udc_nrf_setup_set_addr, udc_nrf_fake_setup; +static uint8_t udc_nrf_address; const static struct device *udc_nrf_dev; struct udc_nrf_config { @@ -143,7 +144,9 @@ static void udc_event_xfer_ctrl_in(const struct device *dev, /* Update to next stage of control transfer */ udc_ctrl_update_stage(dev, buf); - nrf_usbd_common_setup_clear(); + if (!udc_nrf_setup_set_addr) { + nrf_usbd_common_setup_clear(); + } } static void udc_event_fake_status_in(const struct device *dev) @@ -317,6 +320,7 @@ static int usbd_ctrl_feed_dout(const struct device *dev, static int udc_event_xfer_setup(const struct device *dev) { + nrf_usbd_common_setup_t *setup; struct net_buf *buf; int err; @@ -328,7 +332,77 @@ static int udc_event_xfer_setup(const struct device *dev) } udc_ep_buf_set_setup(buf); - nrf_usbd_common_setup_get((nrf_usbd_common_setup_t *)buf->data); + setup = (nrf_usbd_common_setup_t *)buf->data; + nrf_usbd_common_setup_get(setup); + + /* USBD peripheral automatically handles Set Address in slightly + * different manner than the USB stack. + * + * USBD peripheral doesn't care about wLength, but the peripheral + * switches to new address only after status stage. The device won't + * automatically accept Data Stage packets. + * + * However, in the case the host: + * * sends SETUP Set Address with non-zero wLength + * * does not send corresponding OUT DATA packets (to match wLength) + * or sends the packets but disregards NAK + * or sends the packets that device ACKs + * * sends IN token (either incorrectly proceeds to status stage, or + * manages to send IN before SW sets STALL) + * then the USBD peripheral will accept the address and USB stack won't. + * This will lead to state mismatch between the stack and peripheral. + * + * In cases where the USB stack would like to STALL the request there is + * a race condition between host issuing Set Address status stage (IN + * token) and SW setting STALL bit. If host wins the race, the device + * ACKs status stage and use new address. If device wins the race, the + * device STALLs status stage and address remains unchanged. + */ + udc_nrf_setup_set_addr = + setup->bmRequestType == 0 && + setup->bRequest == USB_SREQ_SET_ADDRESS; + if (udc_nrf_setup_set_addr) { + if (setup->wLength) { + /* Currently USB stack only STALLs OUT Data Stage when + * buffer allocation fails. To prevent the device from + * ACKing the Data Stage, simply ignore the request + * completely. + * + * If host incorrectly proceeds to status stage there + * will be address mismatch (unless the new address is + * equal to current device address). If host does not + * issue IN token then the mismatch will be avoided. + */ + net_buf_unref(buf); + return 0; + } + + /* nRF52/nRF53 USBD doesn't care about wValue bits 8..15 and + * wIndex value but USB device stack does. + * + * Just clear the bits so stack will handle the request in the + * same way as USBD peripheral does, avoiding the mismatch. + */ + setup->wValue &= 0x7F; + setup->wIndex = 0; + } + + if (!udc_nrf_setup_set_addr && udc_nrf_address != NRF_USBD->USBADDR) { + /* Address mismatch detected. Fake Set Address handling to + * correct the situation, then repeat handling. + */ + udc_nrf_fake_setup = true; + udc_nrf_setup_set_addr = true; + + setup->bmRequestType = 0; + setup->bRequest = USB_SREQ_SET_ADDRESS; + setup->wValue = NRF_USBD->USBADDR; + setup->wIndex = 0; + setup->wLength = 0; + } else { + udc_nrf_fake_setup = false; + } + net_buf_add(buf, sizeof(nrf_usbd_common_setup_t)); udc_nrf_setup_rcvd = true; @@ -494,7 +568,8 @@ static bool udc_nrf_fake_status_in(const struct device *dev) .ep = USB_CONTROL_EP_IN, }; - if (nrf_usbd_common_last_setup_dir_get() == USB_CONTROL_EP_OUT) { + if (nrf_usbd_common_last_setup_dir_get() == USB_CONTROL_EP_OUT || + udc_nrf_fake_setup) { /* Let controller perform status IN stage */ k_msgq_put(&drv_msgq, &evt, K_NO_WAIT); return true; @@ -612,12 +687,38 @@ static int udc_nrf_ep_clear_halt(const struct device *dev, static int udc_nrf_set_address(const struct device *dev, const uint8_t addr) { - /** - * Nothing to do here. The USBD HW already takes care of initiating - * STATUS stage. Just double check the address for sanity. + /* + * If the status stage already finished (which depends entirely on when + * the host sends IN token) then NRF_USBD->USBADDR will have the same + * address, otherwise it won't (unless new address is unchanged). + * + * Store the address so the driver can detect address mismatches + * between USB stack and USBD peripheral. The mismatches can occur if: + * * SW has high enough latency in SETUP handling, or + * * Host did not issue Status Stage after Set Address request + * + * The SETUP handling latency is a problem because the Set Address is + * automatically handled by device. Because whole Set Address handling + * can finish in less than 21 us, the latency required (with perfect + * timing) to hit the issue is relatively short (2 ms Set Address + * recovery interval + negligible Set Address handling time). If host + * sends new SETUP before SW had a chance to read the Set Address one, + * the Set Address one will be overwritten without a trace. */ - if (addr != (uint8_t)NRF_USBD->USBADDR) { - LOG_WRN("USB Address incorrect 0x%02x", addr); + udc_nrf_address = addr; + + if (udc_nrf_fake_setup) { + struct udc_nrf_evt evt = { + .type = UDC_NRF_EVT_HAL, + .hal_evt = { + .type = NRF_USBD_COMMON_EVT_SETUP, + }, + }; + + /* Finished handling lost Set Address, now handle the pending + * SETUP transfer. + */ + k_msgq_put(&drv_msgq, &evt, K_NO_WAIT); } return 0; From 71bb88222121627e888990817259cd7e364a003e Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 19 Nov 2024 10:26:17 -0500 Subject: [PATCH 2837/4482] tests: cpp: remove obsolete target nrf54h20dk@0.8.0/nrf54h20/cpuapp was dropped. Signed-off-by: Anas Nashif --- tests/lib/cpp/cxx/testcase.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/lib/cpp/cxx/testcase.yaml b/tests/lib/cpp/cxx/testcase.yaml index c6dbb68337d60..06bbcfd5baefb 100644 --- a/tests/lib/cpp/cxx/testcase.yaml +++ b/tests/lib/cpp/cxx/testcase.yaml @@ -41,7 +41,6 @@ tests: - nrf54l20pdk/nrf54l20/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad - - nrf54h20dk@0.8.0/nrf54h20/cpuapp - nrf9280pdk/nrf9280/cpuapp - nrf9280pdk/nrf9280/cpurad filter: not CONFIG_HAS_RENESAS_RA_FSP From 83356e924a6e7f7d83c79b2942e66b855451dc6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Tue, 19 Nov 2024 18:08:06 +0100 Subject: [PATCH 2838/4482] doc: doxygen: improve formatting for kconfig alias MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit \verbatim is not giving the right output as we need an inline literal. Switch to \c instead. Fixes #81595. Signed-off-by: Benjamin Cabé --- doc/zephyr.doxyfile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/zephyr.doxyfile.in b/doc/zephyr.doxyfile.in index abd4440f5aa16..8e452493cf0b5 100644 --- a/doc/zephyr.doxyfile.in +++ b/doc/zephyr.doxyfile.in @@ -279,7 +279,7 @@ TAB_SIZE = 8 # with the commands \{ and \} for these it is advised to use the version @{ and # @} or use a double escape (\\{ and \\}) -ALIASES = "kconfig{1}=\verbatim \1 \endverbatim" \ +ALIASES = "kconfig{1}=\c \1" \ "req{1}=\ref ZEPH_\1 \"ZEPH-\1\"" \ "satisfy{1}=\xrefitem satisfy \"Satisfies requirement\" \"Requirement Implementation\" \1" \ "verify{1}=\xrefitem verify \"Verifies requirement\" \"Requirement Verification\" \1" \ From 71c80932a90e897afcc184aa41c58a563a1fb2c1 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Mon, 18 Nov 2024 09:31:25 -0600 Subject: [PATCH 2839/4482] tests: drivers: build_all: display: fix conflicting nodelabels Some nodelabels in the display build_all test overlay lacked a "test" prefix, causing test failures on boards that also define displays with this nodelabel. Prefix these nodes with "test" to resolve this issue. Fixes #81610 Signed-off-by: Daniel DeGrasse --- tests/drivers/build_all/display/app.overlay | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/drivers/build_all/display/app.overlay b/tests/drivers/build_all/display/app.overlay index 2ff3deb342414..d28c554ce07d2 100644 --- a/tests/drivers/build_all/display/app.overlay +++ b/tests/drivers/build_all/display/app.overlay @@ -71,7 +71,7 @@ height = <128>; }; - st7789v: st7789v@3 { + test_st7789v: st7789v@3 { compatible = "sitronix,st7789v"; reg = <3>; mipi-max-frequency = <25000000>; @@ -108,7 +108,7 @@ busy-gpios = <&test_gpio 0 0>; }; - uc8176_waveshare_epaper_gdew042t2: uc8176@5 { + test_uc8176_waveshare_epaper_gdew042t2: uc8176@5 { compatible = "ultrachip,uc8176"; mipi-max-frequency = <4000000>; reg = <5>; From dacc462bbdbe833cb0af5406a875acd444070bd6 Mon Sep 17 00:00:00 2001 From: Bryce Wilkins Date: Fri, 15 Nov 2024 00:07:51 -0800 Subject: [PATCH 2840/4482] west.yml: segger: RTT control block init mode Kconfigs Kconfig options for RTT control block initialization and linker section were added in #53569, however the Zephyr west.yml was not updated to incorporate the Segger repository changes to make use of the new Kconfig options. This fixes that. Signed-off-by: Bryce Wilkins --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index e3c82b4482152..87287fb39ac7c 100644 --- a/west.yml +++ b/west.yml @@ -317,7 +317,7 @@ manifest: path: modules/lib/picolibc revision: d492d5fa7c96918e37653f303028346bb0dd51a2 - name: segger - revision: 798f95ea9304e5ed8165a661081443051f210733 + revision: 1a607e8718171cfbc1ee6b2a5ec00f619d1cc7fc path: modules/debug/segger groups: - debug From e5ee95893c7012c943f5c75620f28ae7049001fa Mon Sep 17 00:00:00 2001 From: Lucien Zhao Date: Fri, 6 Sep 2024 15:48:28 +0800 Subject: [PATCH 2841/4482] dts: arm: nxp: rt118x: add lptmr instances Config/Enable lptmr1/2/3 clock Add 3 lptmr instances for RT118X Signed-off-by: Lucien Zhao --- dts/arm/nxp/nxp_rt118x.dtsi | 33 +++++++++++++++++++++++++++++++++ soc/nxp/imxrt/imxrt118x/soc.c | 25 +++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/dts/arm/nxp/nxp_rt118x.dtsi b/dts/arm/nxp/nxp_rt118x.dtsi index 10a18ebd4a80f..6060fc62c5149 100644 --- a/dts/arm/nxp/nxp_rt118x.dtsi +++ b/dts/arm/nxp/nxp_rt118x.dtsi @@ -630,6 +630,39 @@ clk-source = <0>; status = "disabled"; }; + + lptmr1: lptmr@4300000 { + compatible = "nxp,lptmr"; + reg = <0x4300000 0x1000>; + interrupts = <18 0>; + clock-frequency = <80000000>; + prescaler = <1>; + clk-source = <0>; + resolution = <32>; + status = "disabled"; + }; + + lptmr2: lptmr@24d0000 { + compatible = "nxp,lptmr"; + reg = <0x24d0000 0x1000>; + interrupts = <67 0>; + clock-frequency = <80000000>; + prescaler = <1>; + clk-source = <0>; + resolution = <32>; + status = "disabled"; + }; + + lptmr3: lptmr@2cd0000 { + compatible = "nxp,lptmr"; + reg = <0x2cd0000 0x1000>; + interrupts = <150 0>; + clock-frequency = <80000000>; + prescaler = <1>; + clk-source = <0>; + resolution = <32>; + status = "disabled"; + }; }; &flexspi1 { diff --git a/soc/nxp/imxrt/imxrt118x/soc.c b/soc/nxp/imxrt/imxrt118x/soc.c index 633b9ebe2057b..f170b94184078 100644 --- a/soc/nxp/imxrt/imxrt118x/soc.c +++ b/soc/nxp/imxrt/imxrt118x/soc.c @@ -366,6 +366,31 @@ static ALWAYS_INLINE void clock_init(void) #endif /* CONFIG_CAN_MCUX_FLEXCAN */ +#if defined(CONFIG_MCUX_LPTMR_TIMER) || defined(CONFIG_COUNTER_MCUX_LPTMR) + +#if DT_NODE_HAS_STATUS(DT_NODELABEL(lptmr1), okay) + /* Configure LPTIMER1 using SYS_PLL3_DIV2_CLK */ + rootCfg.mux = kCLOCK_LPTIMER1_ClockRoot_MuxSysPll3Div2; + rootCfg.div = 3; + CLOCK_SetRootClock(kCLOCK_Root_Lptimer1, &rootCfg); +#endif + +#if DT_NODE_HAS_STATUS(DT_NODELABEL(lptmr2), okay) + /* Configure LPTIMER2 using SYS_PLL3_DIV2_CLK */ + rootCfg.mux = kCLOCK_LPTIMER2_ClockRoot_MuxSysPll3Div2; + rootCfg.div = 3; + CLOCK_SetRootClock(kCLOCK_Root_Lptimer2, &rootCfg); +#endif + +#if DT_NODE_HAS_STATUS(DT_NODELABEL(lptmr3), okay) + /* Configure LPTIMER3 using SYS_PLL3_DIV2_CLK */ + rootCfg.mux = kCLOCK_LPTIMER3_ClockRoot_MuxSysPll3Div2; + rootCfg.div = 3; + CLOCK_SetRootClock(kCLOCK_Root_Lptimer3, &rootCfg); +#endif + +#endif /* CONFIG_MCUX_LPTMR_TIMER || CONFIG_COUNTER_MCUX_LPTMR */ + /* Keep core clock ungated during WFI */ CCM->LPCG[1].LPM0 = 0x33333333; CCM->LPCG[1].LPM1 = 0x33333333; From 95448ba21d0f8bef94e59087632a92959fe0415b Mon Sep 17 00:00:00 2001 From: Lucien Zhao Date: Fri, 6 Sep 2024 15:50:24 +0800 Subject: [PATCH 2842/4482] boards: nxp: mimxrt1180_evk: set lptmr1 status as OK set lptmr1 status as OK test counter_basic_api passed on cm33/cm7 cores Signed-off-by: Lucien Zhao --- boards/nxp/mimxrt1180_evk/doc/index.rst | 2 ++ boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm33.dts | 4 ++++ boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm7.dts | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/boards/nxp/mimxrt1180_evk/doc/index.rst b/boards/nxp/mimxrt1180_evk/doc/index.rst index 459f071943638..f5ad3fae8c1e6 100644 --- a/boards/nxp/mimxrt1180_evk/doc/index.rst +++ b/boards/nxp/mimxrt1180_evk/doc/index.rst @@ -110,6 +110,8 @@ configuration supports the following hardware features: +-----------+------------+-------------------------------------+ | CAN | on-chip | can | +-----------+------------+-------------------------------------+ +| LPTMR | on-chip | counter | ++-----------+------------+-------------------------------------+ The default configuration can be found in the defconfig file: :zephyr_file:`boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm33_defconfig` diff --git a/boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm33.dts b/boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm33.dts index 583ce398cfacf..331f85b5bf8fa 100644 --- a/boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm33.dts +++ b/boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm33.dts @@ -71,3 +71,7 @@ &flexcan3 { status = "okay"; }; + +&lptmr1 { + status = "okay"; +}; diff --git a/boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm7.dts b/boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm7.dts index aaa0b19e3a628..84c2245eae911 100644 --- a/boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm7.dts +++ b/boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm7.dts @@ -43,3 +43,7 @@ &flexcan3 { status = "okay"; }; + +&lptmr1 { + status = "okay"; +}; From 05c6517fc9f1c5cb5ae623c41aa6d22d09252cf4 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Thu, 7 Nov 2024 09:20:43 +0100 Subject: [PATCH 2843/4482] scripts: ci: check_compliance: Add support for end line and column Reporting or annotating issues can be done on a range rather than a single line. Add support for end line and end column. Signed-off-by: Pieter De Gendt --- scripts/ci/check_compliance.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 5de6a81e44b83..47edd292e4175 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -82,20 +82,25 @@ def get_files(filter=None, paths=None): return files class FmtdFailure(Failure): - - def __init__(self, severity, title, file, line=None, col=None, desc=""): + def __init__( + self, severity, title, file, line=None, col=None, desc="", end_line=None, end_col=None + ): self.severity = severity self.title = title self.file = file self.line = line self.col = col + self.end_line = end_line + self.end_col = end_col self.desc = desc description = f':{desc}' if desc else '' msg_body = desc or title txt = f'\n{title}{description}\nFile:{file}' + \ (f'\nLine:{line}' if line else '') + \ - (f'\nColumn:{col}' if col else '') + (f'\nColumn:{col}' if col else '') + \ + (f'\nEndLine:{end_line}' if end_line else '') + \ + (f'\nEndColumn:{end_col}' if end_col else '') msg = f'{file}' + (f':{line}' if line else '') + f' {msg_body}' typ = severity.lower() @@ -172,13 +177,15 @@ def failure(self, text, msg=None, type_="failure"): fail = Failure(msg or f'{type(self).name} issues', type_) self._result(fail, text) - def fmtd_failure(self, severity, title, file, line=None, col=None, desc=""): + def fmtd_failure( + self, severity, title, file, line=None, col=None, desc="", end_line=None, end_col=None + ): """ Signals that the test failed, and store the information in a formatted standardized manner. Can be called many times within the same test to report multiple failures. """ - fail = FmtdFailure(severity, title, file, line, col, desc) + fail = FmtdFailure(severity, title, file, line, col, desc, end_line, end_col) self._result(fail, fail.text) self.fmtd_failures.append(fail) @@ -1696,6 +1703,8 @@ def annotate(res): notice = f'::{res.severity} file={res.file}' + \ (f',line={res.line}' if res.line else '') + \ (f',col={res.col}' if res.col else '') + \ + (f',endLine={res.end_line}' if res.end_line else '') + \ + (f',endColumn={res.end_col}' if res.end_col else '') + \ f',title={res.title}::{msg}' print(notice) From 4db97b5bb6b0fd936219835f8bb780e3ae017881 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Thu, 7 Nov 2024 21:09:05 +0100 Subject: [PATCH 2844/4482] scripts: Add helper scripts for ruff baseline excludes Add simple scripts to convert ruff check and ruff format output to toml exclude sections. These sections can be used to ignore baseline violations for an existing codebase. Signed-off-by: Pieter De Gendt --- scripts/ruff/gen_format_exclude.py | 18 +++++++++++++ scripts/ruff/gen_lint_exclude.py | 42 ++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100755 scripts/ruff/gen_format_exclude.py create mode 100755 scripts/ruff/gen_lint_exclude.py diff --git a/scripts/ruff/gen_format_exclude.py b/scripts/ruff/gen_format_exclude.py new file mode 100755 index 0000000000000..6f3b093e70f53 --- /dev/null +++ b/scripts/ruff/gen_format_exclude.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2024 Basalte bv +# SPDX-License-Identifier: Apache-2.0 + +import sys + +# A very simple script to convert ruff format output to toml +# For example: +# ruff format --check | ./scripts/ruff/gen_format_exclude.py >> .ruff-excludes.toml + +if __name__ == "__main__": + sys.stdout.write("[format]\n") + sys.stdout.write("exclude = [\n") + for line in sys.stdin: + if line.startswith("Would reformat: "): + sys.stdout.write(f' "./{line[16:-1]}",\n') + sys.stdout.write("]\n") diff --git a/scripts/ruff/gen_lint_exclude.py b/scripts/ruff/gen_lint_exclude.py new file mode 100755 index 0000000000000..af627cf82ceb3 --- /dev/null +++ b/scripts/ruff/gen_lint_exclude.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2024 Basalte bv +# SPDX-License-Identifier: Apache-2.0 + +import json +import sys +from pathlib import Path, PurePosixPath + +# A very simple script to convert ruff lint output from json to toml +# For example: +# ruff check --output-format=json | ./scripts/ruff/gen_lint_exclude.py >> .ruff-excludes.toml + + +class RuffRule: + def __init__(self, code: str, url: str) -> None: + self.code = code + self.url = url + + def __eq__(self, other: object) -> bool: + if not isinstance(other, type(self)): + return NotImplemented + return self.code.__eq__(other.code) + + def __hash__(self) -> int: + return self.code.__hash__() + + +if __name__ == "__main__": + violations = json.load(sys.stdin) + sys.stdout.write("[lint.per-file-ignores]\n") + + rules: dict[str, set[RuffRule]] = {} + for v in violations: + rules.setdefault(v["filename"], set()).add(RuffRule(v["code"], v["url"])) + + for f, rs in rules.items(): + path = PurePosixPath(f) + sys.stdout.write(f'"./{path.relative_to(Path.cwd())}" = [\n') + for r in sorted(rs, key=lambda x: x.code): + sys.stdout.write(f' "{r.code}",\t# {r.url}\n'.expandtabs()) + sys.stdout.write("]\n") From 973eaff5a2631223ff0e564be92a5b419836c13c Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Thu, 7 Nov 2024 21:49:24 +0100 Subject: [PATCH 2845/4482] scripts: ci: Add ruff configuration files Add a baseline toml file for current rule violations, and a default configuration file. Signed-off-by: Pieter De Gendt --- .ruff-excludes.toml | 2432 +++++++++++++++++++++++++++++++++++++++++++ .ruff.toml | 31 + 2 files changed, 2463 insertions(+) create mode 100644 .ruff-excludes.toml create mode 100644 .ruff.toml diff --git a/.ruff-excludes.toml b/.ruff-excludes.toml new file mode 100644 index 0000000000000..49f0f35bbc9e2 --- /dev/null +++ b/.ruff-excludes.toml @@ -0,0 +1,2432 @@ +# SPDX-License-Identifier: Apache-2.0 + +# This list is generated, it contains all python scripts that existed before ruff was introduced, +# remove entries for files that pass CI compliance testing. + +[lint.per-file-ignores] +"./arch/x86/gen_gdt.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./arch/x86/gen_idt.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP030", # https://docs.astral.sh/ruff/rules/format-literals + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./arch/x86/gen_mmu.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting + "UP034", # https://docs.astral.sh/ruff/rules/extraneous-parentheses + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./arch/x86/zefi/zefi.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./arch/xtensa/core/gen_vectors.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./arch/xtensa/core/gen_zsr.py" = [ + "SIM401", # https://docs.astral.sh/ruff/rules/if-else-block-instead-of-dict-get +] +"./arch/xtensa/core/xtensa_intgen.py" = [ + "E713", # https://docs.astral.sh/ruff/rules/not-in-test + "E741", # https://docs.astral.sh/ruff/rules/ambiguous-variable-name + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./boards/microchip/mec172xevb_assy6906/support/mec172x_remote_flasher.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./doc/_extensions/zephyr/api_overview.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./doc/_extensions/zephyr/application.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./doc/_extensions/zephyr/domain/__init__.py" = [ + "B023", # https://docs.astral.sh/ruff/rules/function-uses-loop-variable + "B026", # https://docs.astral.sh/ruff/rules/star-arg-unpacking-after-keyword-arg + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F401", # https://docs.astral.sh/ruff/rules/unused-import + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./doc/_extensions/zephyr/doxybridge.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./doc/_extensions/zephyr/doxyrunner.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation + "UP024", # https://docs.astral.sh/ruff/rules/os-error-alias + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./doc/_extensions/zephyr/doxytooltip/__init__.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./doc/_extensions/zephyr/external_content.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./doc/_extensions/zephyr/gh_utils.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./doc/_extensions/zephyr/kconfig/__init__.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "SIM112", # https://docs.astral.sh/ruff/rules/uncapitalized-environment-variables + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation + "UP028", # https://docs.astral.sh/ruff/rules/yield-in-for-loop + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./doc/_extensions/zephyr/link-roles.py" = [ + "B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import +] +"./doc/_extensions/zephyr/manifest_projects_table.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM114", # https://docs.astral.sh/ruff/rules/if-with-same-arms + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./doc/_scripts/gen_boards_catalog.py" = [ + "E401", # https://docs.astral.sh/ruff/rules/multiple-imports-on-one-line + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./doc/_scripts/gen_devicetree_rest.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP034", # https://docs.astral.sh/ruff/rules/extraneous-parentheses +] +"./doc/_scripts/gen_helpers.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./doc/_scripts/redirects.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long +] +"./doc/conf.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "F821", # https://docs.astral.sh/ruff/rules/undefined-name + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler +] +"./doc/develop/test/twister/sample_blackbox_test.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./modules/mbedtls/create_psa_files.py" = [ + "E101", # https://docs.astral.sh/ruff/rules/mixed-spaces-and-tabs + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP032", # https://docs.astral.sh/ruff/rules/f-string + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./samples/modules/tflite-micro/magic_wand/train/data_augmentation.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import +] +"./samples/modules/tflite-micro/magic_wand/train/data_augmentation_test.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import +] +"./samples/modules/tflite-micro/magic_wand/train/data_load.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "B020", # https://docs.astral.sh/ruff/rules/loop-variable-overrides-iterator + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP004", # https://docs.astral.sh/ruff/rules/useless-object-inheritance + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./samples/modules/tflite-micro/magic_wand/train/data_load_test.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import +] +"./samples/modules/tflite-micro/magic_wand/train/data_prepare.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP009", # https://docs.astral.sh/ruff/rules/utf8-encoding-declaration + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./samples/modules/tflite-micro/magic_wand/train/data_prepare_test.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "F821", # https://docs.astral.sh/ruff/rules/undefined-name + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./samples/modules/tflite-micro/magic_wand/train/data_split.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP009", # https://docs.astral.sh/ruff/rules/utf8-encoding-declaration + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./samples/modules/tflite-micro/magic_wand/train/data_split_person.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP009", # https://docs.astral.sh/ruff/rules/utf8-encoding-declaration + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import +] +"./samples/modules/tflite-micro/magic_wand/train/data_split_person_test.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import +] +"./samples/modules/tflite-micro/magic_wand/train/data_split_test.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./samples/modules/tflite-micro/magic_wand/train/train.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM113", # https://docs.astral.sh/ruff/rules/enumerate-for-loop + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./samples/modules/tflite-micro/magic_wand/train/train_test.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import +] +"./samples/modules/thrift/hello/client/hello_client.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./samples/net/cellular_modem/server/te.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./samples/net/cellular_modem/server/te_udp_echo.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./samples/net/cellular_modem/server/te_udp_receive.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./samples/net/cloud/aws_iot_mqtt/src/creds/convert_keys.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./samples/sensor/sensor_shell/pytest/test_sensor_shell.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long +] +"./samples/subsys/profiling/perf/pytest/test_perf.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./samples/subsys/testsuite/pytest/basic/pytest/conftest.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./samples/subsys/testsuite/pytest/basic/pytest/test_sample.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM112", # https://docs.astral.sh/ruff/rules/uncapitalized-environment-variables +] +"./samples/subsys/zbus/remote_mock/remote_mock.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./samples/subsys/zbus/uart_bridge/decoder.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/build/check_init_priorities.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F401", # https://docs.astral.sh/ruff/rules/unused-import + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./scripts/build/check_init_priorities_test.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/build/dir_is_writeable.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/build/elf_parser.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/build/file2hex.py" = [ + "B023", # https://docs.astral.sh/ruff/rules/function-uses-loop-variable + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict +] +"./scripts/build/gen_app_partitions.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP030", # https://docs.astral.sh/ruff/rules/format-literals + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/build/gen_cfb_font_header.py" = [ + "E101", # https://docs.astral.sh/ruff/rules/mixed-spaces-and-tabs + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/build/gen_device_deps.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/build/gen_image_info.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler +] +"./scripts/build/gen_isr_tables.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/build/gen_isr_tables_parser_carrays.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP030", # https://docs.astral.sh/ruff/rules/format-literals + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/build/gen_isr_tables_parser_local.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP030", # https://docs.astral.sh/ruff/rules/format-literals + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/build/gen_kobject_list.py" = [ + "E101", # https://docs.astral.sh/ruff/rules/mixed-spaces-and-tabs + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "SIM401", # https://docs.astral.sh/ruff/rules/if-else-block-instead-of-dict-get + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting + "UP032", # https://docs.astral.sh/ruff/rules/f-string + "W191", # https://docs.astral.sh/ruff/rules/tab-indentation +] +"./scripts/build/gen_kobject_placeholders.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler +] +"./scripts/build/gen_offset_header.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/build/gen_relocate_app.py" = [ + "B028", # https://docs.astral.sh/ruff/rules/no-explicit-stacklevel + "E101", # https://docs.astral.sh/ruff/rules/mixed-spaces-and-tabs + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "SIM401", # https://docs.astral.sh/ruff/rules/if-else-block-instead-of-dict-get + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import + "UP037", # https://docs.astral.sh/ruff/rules/quoted-annotation +] +"./scripts/build/gen_strerror_table.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "SIM105", # https://docs.astral.sh/ruff/rules/suppressible-exception + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/build/gen_strsignal_table.py" = [ + "SIM105", # https://docs.astral.sh/ruff/rules/suppressible-exception + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/build/gen_symtab.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/build/gen_syscalls.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E713", # https://docs.astral.sh/ruff/rules/not-in-test + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/build/llext_inject_slids.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM113", # https://docs.astral.sh/ruff/rules/enumerate-for-loop + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./scripts/build/llext_prepare_exptab.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM113", # https://docs.astral.sh/ruff/rules/enumerate-for-loop + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./scripts/build/llext_slidlib.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/build/mergehex.py" = [ + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/build/parse_syscalls.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/build/process_gperf.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/build/subfolder_list.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/build/uf2conv.py" = [ + "B011", # https://docs.astral.sh/ruff/rules/assert-false + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E711", # https://docs.astral.sh/ruff/rules/none-comparison + "E722", # https://docs.astral.sh/ruff/rules/bare-except + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "SIM103", # https://docs.astral.sh/ruff/rules/needless-bool + "SIM118", # https://docs.astral.sh/ruff/rules/in-dict-keys + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/build/user_wordsize.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/check_maintainers.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/ci/check_compliance.py" = [ + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E741", # https://docs.astral.sh/ruff/rules/ambiguous-variable-name + "F401", # https://docs.astral.sh/ruff/rules/unused-import + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM112", # https://docs.astral.sh/ruff/rules/uncapitalized-environment-variables + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/ci/coverage/coverage_analysis.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/ci/errno.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/ci/guideline_check.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/ci/stats/merged_prs.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/ci/test_plan.py" = [ + "B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default + "E401", # https://docs.astral.sh/ruff/rules/multiple-imports-on-one-line + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/ci/upload_test_results_es.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E713", # https://docs.astral.sh/ruff/rules/not-in-test + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/ci/version_mgr.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/coredump/coredump_gdbserver.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/coredump/coredump_parser/elf_parser.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./scripts/coredump/coredump_parser/log_parser.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP030", # https://docs.astral.sh/ruff/rules/format-literals + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/coredump/coredump_serial_log_parser.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/coredump/gdbstubs/__init__.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/coredump/gdbstubs/arch/arm64.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./scripts/coredump/gdbstubs/arch/arm_cortex_m.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./scripts/coredump/gdbstubs/arch/risc_v.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./scripts/coredump/gdbstubs/arch/x86.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./scripts/coredump/gdbstubs/arch/x86_64.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./scripts/coredump/gdbstubs/arch/xtensa.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM113", # https://docs.astral.sh/ruff/rules/enumerate-for-loop + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/coredump/gdbstubs/gdbstub.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/dts/gen_defines.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E741", # https://docs.astral.sh/ruff/rules/ambiguous-variable-name + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/dts/gen_driver_kconfig_dts.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/dts/gen_dts_cmake.py" = [ + "SIM118", # https://docs.astral.sh/ruff/rules/in-dict-keys +] +"./scripts/dts/python-devicetree/src/devicetree/_private.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/dts/python-devicetree/src/devicetree/dtlib.py" = [ + "E701", # https://docs.astral.sh/ruff/rules/multiple-statements-on-one-line-colon + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM201", # https://docs.astral.sh/ruff/rules/negate-equal-op + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation + "UP032", # https://docs.astral.sh/ruff/rules/f-string + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import + "UP037", # https://docs.astral.sh/ruff/rules/quoted-annotation +] +"./scripts/dts/python-devicetree/src/devicetree/edtlib.py" = [ + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E713", # https://docs.astral.sh/ruff/rules/not-in-test + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "SIM118", # https://docs.astral.sh/ruff/rules/in-dict-keys + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP032", # https://docs.astral.sh/ruff/rules/f-string + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import + "UP037", # https://docs.astral.sh/ruff/rules/quoted-annotation +] +"./scripts/dts/python-devicetree/src/devicetree/grutils.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/dts/python-devicetree/tests/test_dtlib.py" = [ + "B011", # https://docs.astral.sh/ruff/rules/assert-false + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E101", # https://docs.astral.sh/ruff/rules/mixed-spaces-and-tabs + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation +] +"./scripts/dts/python-devicetree/tests/test_edtlib.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E701", # https://docs.astral.sh/ruff/rules/multiple-statements-on-one-line-colon + "E731", # https://docs.astral.sh/ruff/rules/lambda-assignment + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM117", # https://docs.astral.sh/ruff/rules/multiple-with-statements +] +"./scripts/dump_bugs_pickle.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM110", # https://docs.astral.sh/ruff/rules/reimplemented-builtin + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/footprint/fpdiff.py" = [ + "B023", # https://docs.astral.sh/ruff/rules/function-uses-loop-variable + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/footprint/pack_as_twister.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM401", # https://docs.astral.sh/ruff/rules/if-else-block-instead-of-dict-get + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/footprint/track.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/footprint/upload_data.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM118", # https://docs.astral.sh/ruff/rules/in-dict-keys + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/gen_gcov_files.py" = [ + "SIM105", # https://docs.astral.sh/ruff/rules/suppressible-exception + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/generate_usb_vif/constants/xml_constants.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/generate_usb_vif/generate_vif.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM103", # https://docs.astral.sh/ruff/rules/needless-bool + "UP038", # https://docs.astral.sh/ruff/rules/non-pep604-isinstance +] +"./scripts/get_maintainer.py" = [ + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/github_helpers.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/gitlint/zephyr_commit_rules.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP030", # https://docs.astral.sh/ruff/rules/format-literals + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/kconfig/guiconfig.py" = [ + "B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F403", # https://docs.astral.sh/ruff/rules/undefined-local-with-import-star + "F405", # https://docs.astral.sh/ruff/rules/undefined-local-with-import-star-usage + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP024", # https://docs.astral.sh/ruff/rules/os-error-alias + "UP032", # https://docs.astral.sh/ruff/rules/f-string + "UP038", # https://docs.astral.sh/ruff/rules/non-pep604-isinstance +] +"./scripts/kconfig/hardenconfig.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/kconfig/kconfig.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/kconfig/kconfigfunctions.py" = [ + "B011", # https://docs.astral.sh/ruff/rules/assert-false + "SIM114", # https://docs.astral.sh/ruff/rules/if-with-same-arms + "SIM118", # https://docs.astral.sh/ruff/rules/in-dict-keys + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/kconfig/kconfiglib.py" = [ + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F841", # https://docs.astral.sh/ruff/rules/unused-variable + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "SIM105", # https://docs.astral.sh/ruff/rules/suppressible-exception + "SIM112", # https://docs.astral.sh/ruff/rules/uncapitalized-environment-variables + "UP004", # https://docs.astral.sh/ruff/rules/useless-object-inheritance + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters + "UP024", # https://docs.astral.sh/ruff/rules/os-error-alias + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/kconfig/lint.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/kconfig/menuconfig.py" = [ + "B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM105", # https://docs.astral.sh/ruff/rules/suppressible-exception + "UP010", # https://docs.astral.sh/ruff/rules/unnecessary-future-import + "UP024", # https://docs.astral.sh/ruff/rules/os-error-alias + "UP032", # https://docs.astral.sh/ruff/rules/f-string + "UP036", # https://docs.astral.sh/ruff/rules/outdated-version-block + "UP038", # https://docs.astral.sh/ruff/rules/non-pep604-isinstance +] +"./scripts/list_boards.py" = [ + "E731", # https://docs.astral.sh/ruff/rules/lambda-assignment + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP032", # https://docs.astral.sh/ruff/rules/f-string + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/list_hardware.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP032", # https://docs.astral.sh/ruff/rules/f-string + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/logging/dictionary/database_gen.py" = [ + "E713", # https://docs.astral.sh/ruff/rules/not-in-test + "E741", # https://docs.astral.sh/ruff/rules/ambiguous-variable-name + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "SIM103", # https://docs.astral.sh/ruff/rules/needless-bool + "SIM113", # https://docs.astral.sh/ruff/rules/enumerate-for-loop + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler +] +"./scripts/logging/dictionary/dictionary_parser/data_types.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./scripts/logging/dictionary/dictionary_parser/log_database.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM103", # https://docs.astral.sh/ruff/rules/needless-bool + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./scripts/logging/dictionary/dictionary_parser/log_parser.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/logging/dictionary/dictionary_parser/log_parser_v1.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP030", # https://docs.astral.sh/ruff/rules/format-literals + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/logging/dictionary/dictionary_parser/log_parser_v3.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM401", # https://docs.astral.sh/ruff/rules/if-else-block-instead-of-dict-get +] +"./scripts/logging/dictionary/dictionary_parser/mipi_syst.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/logging/dictionary/dictionary_parser/utils.py" = [ + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/logging/dictionary/log_parser.py" = [ + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/logging/dictionary/log_parser_uart.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/logging/dictionary/parserlib.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/make_bugs_pickle.py" = [ + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/net/enumerate_http_status.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/profiling/stackcollapse.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP033", # https://docs.astral.sh/ruff/rules/lru-cache-with-maxsize-none +] +"./scripts/pylib/build_helpers/domains.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/pylib/pytest-twister-harness/src/twister_harness/device/binary_adapter.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "SIM103", # https://docs.astral.sh/ruff/rules/needless-bool +] +"./scripts/pylib/pytest-twister-harness/src/twister_harness/device/device_adapter.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/pylib/pytest-twister-harness/src/twister_harness/device/factory.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/pylib/pytest-twister-harness/src/twister_harness/device/fifo_handler.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler +] +"./scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP024", # https://docs.astral.sh/ruff/rules/os-error-alias +] +"./scripts/pylib/pytest-twister-harness/src/twister_harness/device/qemu_adapter.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/pylib/pytest-twister-harness/src/twister_harness/device/utils.py" = [ + "SIM105", # https://docs.astral.sh/ruff/rules/suppressible-exception +] +"./scripts/pylib/pytest-twister-harness/src/twister_harness/fixtures.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/pylib/pytest-twister-harness/src/twister_harness/helpers/domains_helper.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/pylib/pytest-twister-harness/src/twister_harness/helpers/mcumgr.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/pylib/pytest-twister-harness/src/twister_harness/helpers/shell.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E741", # https://docs.astral.sh/ruff/rules/ambiguous-variable-name + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if +] +"./scripts/pylib/pytest-twister-harness/src/twister_harness/helpers/utils.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/pylib/pytest-twister-harness/src/twister_harness/twister_harness_config.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/pylib/pytest-twister-harness/tests/conftest.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/pylib/pytest-twister-harness/tests/device/binary_adapter_test.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/pylib/pytest-twister-harness/tests/device/hardware_adapter_test.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/pylib/pytest-twister-harness/tests/device/qemu_adapter_test.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/pylib/pytest-twister-harness/tests/fixtures/mcumgr_fixture_test.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/pylib/pytest-twister-harness/tests/helpers/shell_mcuboot_command_parser_test.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/pylib/pytest-twister-harness/tests/helpers/shell_test.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long +] +"./scripts/pylib/pytest-twister-harness/tests/resources/fifo_mock.py" = [ + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP012", # https://docs.astral.sh/ruff/rules/unnecessary-encode-utf8 +] +"./scripts/pylib/twister/expr_parser.py" = [ + "SIM103", # https://docs.astral.sh/ruff/rules/needless-bool + "SIM110", # https://docs.astral.sh/ruff/rules/reimplemented-builtin + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/pylib/twister/scl.py" = [ + "F401", # https://docs.astral.sh/ruff/rules/unused-import + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/pylib/twister/twisterlib/cmakecache.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "SIM114", # https://docs.astral.sh/ruff/rules/if-with-same-arms + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/pylib/twister/twisterlib/config_parser.py" = [ + "B028", # https://docs.astral.sh/ruff/rules/no-explicit-stacklevel + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM401", # https://docs.astral.sh/ruff/rules/if-else-block-instead-of-dict-get + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/pylib/twister/twisterlib/coverage.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM105", # https://docs.astral.sh/ruff/rules/suppressible-exception + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP022", # https://docs.astral.sh/ruff/rules/replace-stdout-stderr + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/pylib/twister/twisterlib/environment.py" = [ + "B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "SIM118", # https://docs.astral.sh/ruff/rules/in-dict-keys + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP021", # https://docs.astral.sh/ruff/rules/replace-universal-newlines + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/pylib/twister/twisterlib/handlers.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "SIM105", # https://docs.astral.sh/ruff/rules/suppressible-exception + "SIM114", # https://docs.astral.sh/ruff/rules/if-with-same-arms + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "SIM201", # https://docs.astral.sh/ruff/rules/negate-equal-op + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP030", # https://docs.astral.sh/ruff/rules/format-literals + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/pylib/twister/twisterlib/hardwaremap.py" = [ + "B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM118", # https://docs.astral.sh/ruff/rules/in-dict-keys + "UP004", # https://docs.astral.sh/ruff/rules/useless-object-inheritance + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/pylib/twister/twisterlib/harness.py" = [ + "B009", # https://docs.astral.sh/ruff/rules/get-attr-with-constant + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E713", # https://docs.astral.sh/ruff/rules/not-in-test + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "F811", # https://docs.astral.sh/ruff/rules/redefined-while-unused + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "SIM300", # https://docs.astral.sh/ruff/rules/yoda-conditions + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/pylib/twister/twisterlib/jobserver.py" = [ + "SIM201", # https://docs.astral.sh/ruff/rules/negate-equal-op +] +"./scripts/pylib/twister/twisterlib/mixins.py" = [ + "UP004", # https://docs.astral.sh/ruff/rules/useless-object-inheritance +] +"./scripts/pylib/twister/twisterlib/package.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/pylib/twister/twisterlib/platform.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/pylib/twister/twisterlib/quarantine.py" = [ + "B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM110", # https://docs.astral.sh/ruff/rules/reimplemented-builtin + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/pylib/twister/twisterlib/reports.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/pylib/twister/twisterlib/runner.py" = [ + "B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E713", # https://docs.astral.sh/ruff/rules/not-in-test + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "SIM201", # https://docs.astral.sh/ruff/rules/negate-equal-op + "UP004", # https://docs.astral.sh/ruff/rules/useless-object-inheritance + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting + "UP032", # https://docs.astral.sh/ruff/rules/f-string + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/pylib/twister/twisterlib/size_calc.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/pylib/twister/twisterlib/statuses.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM401", # https://docs.astral.sh/ruff/rules/if-else-block-instead-of-dict-get +] +"./scripts/pylib/twister/twisterlib/testinstance.py" = [ + "B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/pylib/twister/twisterlib/testplan.py" = [ + "B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default + "B023", # https://docs.astral.sh/ruff/rules/function-uses-loop-variable + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E713", # https://docs.astral.sh/ruff/rules/not-in-test + "E741", # https://docs.astral.sh/ruff/rules/ambiguous-variable-name + "F401", # https://docs.astral.sh/ruff/rules/unused-import + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "SIM110", # https://docs.astral.sh/ruff/rules/reimplemented-builtin + "SIM118", # https://docs.astral.sh/ruff/rules/in-dict-keys + "SIM202", # https://docs.astral.sh/ruff/rules/negate-not-equal-op + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/pylib/twister/twisterlib/testsuite.py" = [ + "B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting + "UP032", # https://docs.astral.sh/ruff/rules/f-string + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/pylib/twister/twisterlib/twister_main.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/pylint/checkers/argparse-checker.py" = [ + "F821", # https://docs.astral.sh/ruff/rules/undefined-name + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/release/bug_bash.py" = [ + "B010", # https://docs.astral.sh/ruff/rules/set-attr-with-constant + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP004", # https://docs.astral.sh/ruff/rules/useless-object-inheritance + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP030", # https://docs.astral.sh/ruff/rules/format-literals + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/release/list_backports.py" = [ + "B009", # https://docs.astral.sh/ruff/rules/get-attr-with-constant + "B010", # https://docs.astral.sh/ruff/rules/set-attr-with-constant + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP004", # https://docs.astral.sh/ruff/rules/useless-object-inheritance + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP030", # https://docs.astral.sh/ruff/rules/format-literals + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/release/list_devicetree_bindings_changes.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM117", # https://docs.astral.sh/ruff/rules/multiple-with-statements + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/set_assignees.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E741", # https://docs.astral.sh/ruff/rules/ambiguous-variable-name + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM113", # https://docs.astral.sh/ruff/rules/enumerate-for-loop +] +"./scripts/snippets.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/support/quartus-flash.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler +] +"./scripts/tests/twister/conftest.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister/pytest_integration/test_harness_pytest.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister/test_cmakecache.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister/test_config_parser.py" = [ + "B017", # https://docs.astral.sh/ruff/rules/assert-raises-exception + "B033", # https://docs.astral.sh/ruff/rules/duplicate-value + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM117", # https://docs.astral.sh/ruff/rules/multiple-with-statements + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister/test_data/mixins/test_to_ignore.py" = [ + "B011", # https://docs.astral.sh/ruff/rules/assert-false + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister/test_environment.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM117", # https://docs.astral.sh/ruff/rules/multiple-with-statements + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister/test_errors.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister/test_handlers.py" = [ + "B011", # https://docs.astral.sh/ruff/rules/assert-false + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP012", # https://docs.astral.sh/ruff/rules/unnecessary-encode-utf8 + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister/test_hardwaremap.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./scripts/tests/twister/test_harness.py" = [ + "B017", # https://docs.astral.sh/ruff/rules/assert-raises-exception + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E713", # https://docs.astral.sh/ruff/rules/not-in-test + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister/test_jobserver.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister/test_log_helper.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister/test_mixins.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister/test_platform.py" = [ + "B011", # https://docs.astral.sh/ruff/rules/assert-false + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister/test_quarantine.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister/test_runner.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/tests/twister/test_scl.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM117", # https://docs.astral.sh/ruff/rules/multiple-with-statements + "UP025", # https://docs.astral.sh/ruff/rules/unicode-kind-prefix + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister/test_testinstance.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister/test_testplan.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E101", # https://docs.astral.sh/ruff/rules/mixed-spaces-and-tabs + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM118", # https://docs.astral.sh/ruff/rules/in-dict-keys + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import + "W191", # https://docs.astral.sh/ruff/rules/tab-indentation +] +"./scripts/tests/twister/test_testsuite.py" = [ + "B011", # https://docs.astral.sh/ruff/rules/assert-false + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister/test_twister.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister_blackbox/conftest.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister_blackbox/test_addon.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister_blackbox/test_config.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister_blackbox/test_coverage.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister_blackbox/test_data/tests/pytest/pytest/conftest.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tests/twister_blackbox/test_data/tests/pytest/pytest/test_sample.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM112", # https://docs.astral.sh/ruff/rules/uncapitalized-environment-variables +] +"./scripts/tests/twister_blackbox/test_device.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/tests/twister_blackbox/test_disable.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister_blackbox/test_error.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E721", # https://docs.astral.sh/ruff/rules/type-comparison + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister_blackbox/test_filter.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister_blackbox/test_footprint.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister_blackbox/test_hardwaremap.py" = [ + "B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister_blackbox/test_outfile.py" = [ + "B011", # https://docs.astral.sh/ruff/rules/assert-false + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister_blackbox/test_output.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister_blackbox/test_platform.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister_blackbox/test_printouts.py" = [ + "B011", # https://docs.astral.sh/ruff/rules/assert-false + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister_blackbox/test_quarantine.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister_blackbox/test_report.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E701", # https://docs.astral.sh/ruff/rules/multiple-statements-on-one-line-colon + "E713", # https://docs.astral.sh/ruff/rules/not-in-test + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister_blackbox/test_runner.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister_blackbox/test_shuffle.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister_blackbox/test_testlist.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister_blackbox/test_testplan.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E721", # https://docs.astral.sh/ruff/rules/type-comparison + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tests/twister_blackbox/test_tooling.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP026", # https://docs.astral.sh/ruff/rules/deprecated-mock-import +] +"./scripts/tracing/parse_ctf.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/tracing/trace_capture_uart.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP012", # https://docs.astral.sh/ruff/rules/unnecessary-encode-utf8 + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/tracing/trace_capture_usb.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/utils/board_v1_to_v2.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/utils/convert_guidelines.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/utils/gen_util_macros.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/utils/migrate_includes.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/utils/migrate_mcumgr_kconfigs.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/utils/migrate_posix_kconfigs.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/utils/migrate_sys_init.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/utils/ntc_thermistor_table.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/utils/pinctrl_nrf_migrate.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP004", # https://docs.astral.sh/ruff/rules/useless-object-inheritance + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/utils/twister_to_list.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/bindesc.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP038", # https://docs.astral.sh/ruff/rules/non-pep604-isinstance +] +"./scripts/west_commands/blobs.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/boards.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/build.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM105", # https://docs.astral.sh/ruff/rules/suppressible-exception + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/build_helpers.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/completion.py" = [ + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/debug.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters +] +"./scripts/west_commands/export.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/fetchers/__init__.py" = [ + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/fetchers/core.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/west_commands/fetchers/http.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler +] +"./scripts/west_commands/flash.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters +] +"./scripts/west_commands/robot.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters +] +"./scripts/west_commands/run_common.py" = [ + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E741", # https://docs.astral.sh/ruff/rules/ambiguous-variable-name + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "SIM114", # https://docs.astral.sh/ruff/rules/if-with-same-arms + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/runners/__init__.py" = [ + "F401", # https://docs.astral.sh/ruff/rules/unused-import + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/runners/blackmagicprobe.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/runners/bossac.py" = [ + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "E101", # https://docs.astral.sh/ruff/rules/mixed-spaces-and-tabs + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM110", # https://docs.astral.sh/ruff/rules/reimplemented-builtin + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting + "W191", # https://docs.astral.sh/ruff/rules/tab-indentation +] +"./scripts/west_commands/runners/canopen_program.py" = [ + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E722", # https://docs.astral.sh/ruff/rules/bare-except + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP004", # https://docs.astral.sh/ruff/rules/useless-object-inheritance + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/runners/core.py" = [ + "B010", # https://docs.astral.sh/ruff/rules/set-attr-with-constant + "B027", # https://docs.astral.sh/ruff/rules/empty-method-without-abstract-decorator + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP032", # https://docs.astral.sh/ruff/rules/f-string + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/west_commands/runners/dediprog.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/runners/dfu.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/runners/esp32.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/runners/ezflashcli.py" = [ + "B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/runners/gd32isp.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/runners/hifive1.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/runners/intel_adsp.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/runners/intel_cyclonev.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E714", # https://docs.astral.sh/ruff/rules/not-is-test + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM114", # https://docs.astral.sh/ruff/rules/if-with-same-arms + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/runners/jlink.py" = [ + "B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/runners/linkserver.py" = [ + "B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/runners/mdb.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E701", # https://docs.astral.sh/ruff/rules/multiple-statements-on-one-line-colon + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM103", # https://docs.astral.sh/ruff/rules/needless-bool + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/runners/misc.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/runners/native.py" = [ + "B011", # https://docs.astral.sh/ruff/rules/assert-false + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/runners/nios2.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/runners/nrf_common.py" = [ + "B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "SIM105", # https://docs.astral.sh/ruff/rules/suppressible-exception + "SIM114", # https://docs.astral.sh/ruff/rules/if-with-same-arms + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/runners/nrfjprog.py" = [ + "B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/runners/nrfutil.py" = [ + "B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/runners/nsim.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/runners/nxp_s32dbg.py" = [ + "B904", # https://docs.astral.sh/ruff/rules/raise-without-from-inside-except + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/west_commands/runners/openocd.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E714", # https://docs.astral.sh/ruff/rules/not-is-test + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM105", # https://docs.astral.sh/ruff/rules/suppressible-exception +] +"./scripts/west_commands/runners/probe_rs.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/runners/pyocd.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/runners/qemu.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/runners/renode-robot.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/runners/renode.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/runners/silabs_commander.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/runners/spi_burn.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/runners/stm32cubeprogrammer.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/west_commands/runners/stm32flash.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/runners/teensy.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/runners/trace32.py" = [ + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./scripts/west_commands/runners/uf2.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/runners/xsdb.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters +] +"./scripts/west_commands/runners/xtensa.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/sdk.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E713", # https://docs.astral.sh/ruff/rules/not-in-test + "E741", # https://docs.astral.sh/ruff/rules/ambiguous-variable-name + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "SIM300", # https://docs.astral.sh/ruff/rules/yoda-conditions +] +"./scripts/west_commands/shields.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/sign.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/simulate.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters +] +"./scripts/west_commands/spdx.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/tests/conftest.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/tests/test_blackmagicprobe.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/tests/test_bossac.py" = [ + "E101", # https://docs.astral.sh/ruff/rules/mixed-spaces-and-tabs + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM117", # https://docs.astral.sh/ruff/rules/multiple-with-statements + "W191", # https://docs.astral.sh/ruff/rules/tab-indentation +] +"./scripts/west_commands/tests/test_build.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/tests/test_canopen_program.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/tests/test_dediprog.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/tests/test_dfu_util.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/tests/test_gd32isp.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/tests/test_imports.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/tests/test_mdb.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/tests/test_nrf.py" = [ + "B011", # https://docs.astral.sh/ruff/rules/assert-false + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation +] +"./scripts/west_commands/tests/test_nxp_s32dbg.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders +] +"./scripts/west_commands/tests/test_pyocd.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/tests/test_stm32cubeprogrammer.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/tests/test_stm32flash.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM117", # https://docs.astral.sh/ruff/rules/multiple-with-statements +] +"./scripts/west_commands/tests/test_twister.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/tests/test_xsdb.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/twister_cmd.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/zcmake.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM102", # https://docs.astral.sh/ruff/rules/collapsible-if + "SIM114", # https://docs.astral.sh/ruff/rules/if-with-same-arms + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./scripts/west_commands/zspdx/cmakecache.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/west_commands/zspdx/cmakefileapi.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters +] +"./scripts/west_commands/zspdx/cmakefileapijson.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM116", # https://docs.astral.sh/ruff/rules/if-else-block-instead-of-dict-lookup + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/west_commands/zspdx/datatypes.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters +] +"./scripts/west_commands/zspdx/getincludes.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP021", # https://docs.astral.sh/ruff/rules/replace-universal-newlines + "UP022", # https://docs.astral.sh/ruff/rules/replace-stdout-stderr +] +"./scripts/west_commands/zspdx/sbom.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters +] +"./scripts/west_commands/zspdx/scanner.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM113", # https://docs.astral.sh/ruff/rules/enumerate-for-loop + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./scripts/west_commands/zspdx/spdxids.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/zspdx/util.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/west_commands/zspdx/walker.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP008", # https://docs.astral.sh/ruff/rules/super-call-with-parameters +] +"./scripts/west_commands/zspdx/writer.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./scripts/zephyr_module.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./soc/intel/intel_adsp/tools/acetool.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./soc/intel/intel_adsp/tools/cavstool.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "E701", # https://docs.astral.sh/ruff/rules/multiple-statements-on-one-line-colon + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./soc/intel/intel_adsp/tools/cavstool_client.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler + "SIM201", # https://docs.astral.sh/ruff/rules/negate-equal-op + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./soc/intel/intel_adsp/tools/remote-fw-service.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP012", # https://docs.astral.sh/ruff/rules/unnecessary-encode-utf8 + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./soc/intel/intel_ish/utils/build_ish_firmware.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP009", # https://docs.astral.sh/ruff/rules/utf8-encoding-declaration +] +"./soc/mediatek/mtk_adsp/gen_img.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler +] +"./soc/mediatek/mtk_adsp/mtk_adsp_load.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler +] +"./soc/microchip/mec/common/spigen/mec_spi_gen.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP030", # https://docs.astral.sh/ruff/rules/format-literals + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./soc/nuvoton/npcm/common/esiost/esiost.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./soc/nuvoton/npcm/common/esiost/esiost_args.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./soc/nuvoton/npcx/common/ecst/ecst.py" = [ + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./soc/nuvoton/npcx/common/ecst/ecst_args.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM110", # https://docs.astral.sh/ruff/rules/reimplemented-builtin + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./soc/silabs/silabs_sim3/sim3u/gen_crossbar_config.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long +] +"./tests/boot/with_mcumgr/pytest/test_downgrade_prevention.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/boot/with_mcumgr/pytest/test_upgrade.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/boot/with_mcumgr/pytest/utils.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/boot/with_mcumgr/pytest/west_sign_wrapper.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting +] +"./tests/drivers/can/host/pytest/can_shell.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM401", # https://docs.astral.sh/ruff/rules/if-else-block-instead-of-dict-get + "UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation + "UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation + "UP035", # https://docs.astral.sh/ruff/rules/deprecated-import +] +"./tests/drivers/can/host/pytest/conftest.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/drivers/can/host/pytest/test_can.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses +] +"./tests/kernel/timer/timer_behavior/pytest/conftest.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/kernel/timer/timer_behavior/pytest/saleae_logic2.py" = [ + "B905", # https://docs.astral.sh/ruff/rules/zip-without-explicit-strict + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/kernel/timer/timer_behavior/pytest/test_timer.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./tests/misc/check_init_priorities/validate_check_init_priorities_output.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "UP015", # https://docs.astral.sh/ruff/rules/redundant-open-modes +] +"./tests/misc/llext-edk/pytest/test_edk.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/net/lib/lwm2m/interop/pytest/conftest.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/net/lib/lwm2m/interop/pytest/leshan.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/net/lib/lwm2m/interop/pytest/test_blockwise.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/net/lib/lwm2m/interop/pytest/test_bootstrap.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM118", # https://docs.astral.sh/ruff/rules/in-dict-keys + "UP018", # https://docs.astral.sh/ruff/rules/native-literals +] +"./tests/net/lib/lwm2m/interop/pytest/test_nosec.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/net/lib/lwm2m/interop/pytest/test_portfolio.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "SIM118", # https://docs.astral.sh/ruff/rules/in-dict-keys +] +"./tests/net/socket/tls_configurations/pytest/conftest.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/net/socket/tls_configurations/pytest/test_app_vs_openssl.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports + "UP032", # https://docs.astral.sh/ruff/rules/f-string +] +"./tests/net/socket/udp/generate-c-string.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/subsys/debug/gdbstub/pytest/conftest.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/subsys/debug/gdbstub/pytest/test_gdbstub.py" = [ + "E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/subsys/logging/dictionary/pytest/conftest.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/subsys/logging/dictionary/pytest/test_logging_dictionary.py" = [ + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] +"./tests/ztest/ztest_param/pytest/test_parameters.py" = [ + "E501", # https://docs.astral.sh/ruff/rules/line-too-long + "I001", # https://docs.astral.sh/ruff/rules/unsorted-imports +] + +[format] +exclude = [ + "./arch/x86/gen_gdt.py", + "./arch/x86/gen_idt.py", + "./arch/x86/gen_mmu.py", + "./arch/x86/zefi/zefi.py", + "./arch/xtensa/core/gen_vectors.py", + "./arch/xtensa/core/gen_zsr.py", + "./arch/xtensa/core/xtensa_intgen.py", + "./boards/microchip/mec172xevb_assy6906/support/mec172x_remote_flasher.py", + "./doc/_extensions/zephyr/api_overview.py", + "./doc/_extensions/zephyr/application.py", + "./doc/_extensions/zephyr/doxybridge.py", + "./doc/_extensions/zephyr/doxyrunner.py", + "./doc/_extensions/zephyr/doxytooltip/__init__.py", + "./doc/_extensions/zephyr/dtcompatible-role.py", + "./doc/_extensions/zephyr/external_content.py", + "./doc/_extensions/zephyr/gh_utils.py", + "./doc/_extensions/zephyr/html_redirects.py", + "./doc/_extensions/zephyr/kconfig/__init__.py", + "./doc/_extensions/zephyr/link-roles.py", + "./doc/_scripts/gen_boards_catalog.py", + "./doc/_scripts/gen_devicetree_rest.py", + "./doc/_scripts/gen_helpers.py", + "./doc/_scripts/redirects.py", + "./doc/conf.py", + "./doc/develop/test/twister/sample_blackbox_test.py", + "./modules/mbedtls/create_psa_files.py", + "./samples/modules/tflite-micro/magic_wand/train/data_augmentation.py", + "./samples/modules/tflite-micro/magic_wand/train/data_augmentation_test.py", + "./samples/modules/tflite-micro/magic_wand/train/data_load.py", + "./samples/modules/tflite-micro/magic_wand/train/data_load_test.py", + "./samples/modules/tflite-micro/magic_wand/train/data_prepare.py", + "./samples/modules/tflite-micro/magic_wand/train/data_prepare_test.py", + "./samples/modules/tflite-micro/magic_wand/train/data_split.py", + "./samples/modules/tflite-micro/magic_wand/train/data_split_person.py", + "./samples/modules/tflite-micro/magic_wand/train/data_split_person_test.py", + "./samples/modules/tflite-micro/magic_wand/train/data_split_test.py", + "./samples/modules/tflite-micro/magic_wand/train/train.py", + "./samples/modules/tflite-micro/magic_wand/train/train_test.py", + "./samples/modules/thrift/hello/client/hello_client.py", + "./samples/net/cellular_modem/server/te.py", + "./samples/net/cellular_modem/server/te_udp_echo.py", + "./samples/net/cellular_modem/server/te_udp_receive.py", + "./samples/net/cloud/aws_iot_mqtt/src/creds/convert_keys.py", + "./samples/sensor/sensor_shell/pytest/test_sensor_shell.py", + "./samples/subsys/profiling/perf/pytest/test_perf.py", + "./samples/subsys/testsuite/pytest/basic/pytest/conftest.py", + "./samples/subsys/testsuite/pytest/basic/pytest/test_sample.py", + "./samples/subsys/zbus/remote_mock/remote_mock.py", + "./scripts/build/check_init_priorities.py", + "./scripts/build/check_init_priorities_test.py", + "./scripts/build/dir_is_writeable.py", + "./scripts/build/elf_parser.py", + "./scripts/build/file2hex.py", + "./scripts/build/gen_app_partitions.py", + "./scripts/build/gen_cfb_font_header.py", + "./scripts/build/gen_device_deps.py", + "./scripts/build/gen_image_info.py", + "./scripts/build/gen_isr_tables.py", + "./scripts/build/gen_isr_tables_parser_carrays.py", + "./scripts/build/gen_isr_tables_parser_local.py", + "./scripts/build/gen_kobject_list.py", + "./scripts/build/gen_kobject_placeholders.py", + "./scripts/build/gen_offset_header.py", + "./scripts/build/gen_relocate_app.py", + "./scripts/build/gen_strerror_table.py", + "./scripts/build/gen_strsignal_table.py", + "./scripts/build/gen_symtab.py", + "./scripts/build/gen_syscalls.py", + "./scripts/build/llext_inject_slids.py", + "./scripts/build/llext_prepare_exptab.py", + "./scripts/build/llext_slidlib.py", + "./scripts/build/mergehex.py", + "./scripts/build/parse_syscalls.py", + "./scripts/build/process_gperf.py", + "./scripts/build/subfolder_list.py", + "./scripts/build/uf2conv.py", + "./scripts/build/user_wordsize.py", + "./scripts/check_maintainers.py", + "./scripts/ci/check_compliance.py", + "./scripts/ci/coverage/coverage_analysis.py", + "./scripts/ci/errno.py", + "./scripts/ci/guideline_check.py", + "./scripts/ci/stats/merged_prs.py", + "./scripts/ci/test_plan.py", + "./scripts/ci/upload_test_results_es.py", + "./scripts/ci/version_mgr.py", + "./scripts/coredump/coredump_gdbserver.py", + "./scripts/coredump/coredump_parser/elf_parser.py", + "./scripts/coredump/coredump_parser/log_parser.py", + "./scripts/coredump/coredump_serial_log_parser.py", + "./scripts/coredump/gdbstubs/__init__.py", + "./scripts/coredump/gdbstubs/arch/arm64.py", + "./scripts/coredump/gdbstubs/arch/arm_cortex_m.py", + "./scripts/coredump/gdbstubs/arch/risc_v.py", + "./scripts/coredump/gdbstubs/arch/x86.py", + "./scripts/coredump/gdbstubs/arch/x86_64.py", + "./scripts/coredump/gdbstubs/arch/xtensa.py", + "./scripts/coredump/gdbstubs/gdbstub.py", + "./scripts/dts/gen_defines.py", + "./scripts/dts/gen_driver_kconfig_dts.py", + "./scripts/dts/gen_dts_cmake.py", + "./scripts/dts/gen_edt.py", + "./scripts/dts/python-devicetree/setup.py", + "./scripts/dts/python-devicetree/src/devicetree/_private.py", + "./scripts/dts/python-devicetree/src/devicetree/dtlib.py", + "./scripts/dts/python-devicetree/src/devicetree/edtlib.py", + "./scripts/dts/python-devicetree/src/devicetree/grutils.py", + "./scripts/dts/python-devicetree/tests/test_dtlib.py", + "./scripts/dts/python-devicetree/tests/test_edtlib.py", + "./scripts/dump_bugs_pickle.py", + "./scripts/footprint/fpdiff.py", + "./scripts/footprint/pack_as_twister.py", + "./scripts/footprint/track.py", + "./scripts/footprint/upload_data.py", + "./scripts/gen_gcov_files.py", + "./scripts/generate_usb_vif/constants/xml_constants.py", + "./scripts/generate_usb_vif/generate_vif.py", + "./scripts/get_maintainer.py", + "./scripts/github_helpers.py", + "./scripts/gitlint/zephyr_commit_rules.py", + "./scripts/kconfig/guiconfig.py", + "./scripts/kconfig/hardenconfig.py", + "./scripts/kconfig/kconfig.py", + "./scripts/kconfig/kconfigfunctions.py", + "./scripts/kconfig/kconfiglib.py", + "./scripts/kconfig/lint.py", + "./scripts/kconfig/menuconfig.py", + "./scripts/list_boards.py", + "./scripts/list_hardware.py", + "./scripts/list_shields.py", + "./scripts/logging/dictionary/database_gen.py", + "./scripts/logging/dictionary/dictionary_parser/data_types.py", + "./scripts/logging/dictionary/dictionary_parser/log_database.py", + "./scripts/logging/dictionary/dictionary_parser/log_parser.py", + "./scripts/logging/dictionary/dictionary_parser/log_parser_v1.py", + "./scripts/logging/dictionary/dictionary_parser/log_parser_v3.py", + "./scripts/logging/dictionary/dictionary_parser/utils.py", + "./scripts/logging/dictionary/log_parser.py", + "./scripts/logging/dictionary/log_parser_uart.py", + "./scripts/logging/dictionary/parserlib.py", + "./scripts/make_bugs_pickle.py", + "./scripts/net/enumerate_http_status.py", + "./scripts/profiling/stackcollapse.py", + "./scripts/pylib/build_helpers/domains.py", + "./scripts/pylib/pytest-twister-harness/src/twister_harness/device/binary_adapter.py", + "./scripts/pylib/pytest-twister-harness/src/twister_harness/device/device_adapter.py", + "./scripts/pylib/pytest-twister-harness/src/twister_harness/device/fifo_handler.py", + "./scripts/pylib/pytest-twister-harness/src/twister_harness/device/hardware_adapter.py", + "./scripts/pylib/pytest-twister-harness/src/twister_harness/device/qemu_adapter.py", + "./scripts/pylib/pytest-twister-harness/src/twister_harness/fixtures.py", + "./scripts/pylib/pytest-twister-harness/src/twister_harness/helpers/mcumgr.py", + "./scripts/pylib/pytest-twister-harness/src/twister_harness/helpers/shell.py", + "./scripts/pylib/pytest-twister-harness/src/twister_harness/plugin.py", + "./scripts/pylib/pytest-twister-harness/src/twister_harness/twister_harness_config.py", + "./scripts/pylib/pytest-twister-harness/tests/conftest.py", + "./scripts/pylib/pytest-twister-harness/tests/device/binary_adapter_test.py", + "./scripts/pylib/pytest-twister-harness/tests/device/hardware_adapter_test.py", + "./scripts/pylib/pytest-twister-harness/tests/device/qemu_adapter_test.py", + "./scripts/pylib/pytest-twister-harness/tests/helpers/shell_test.py", + "./scripts/pylib/pytest-twister-harness/tests/plugin_test.py", + "./scripts/pylib/pytest-twister-harness/tests/resources/mock_script.py", + "./scripts/pylib/pytest-twister-harness/tests/resources/shell_simulator.py", + "./scripts/pylib/twister/expr_parser.py", + "./scripts/pylib/twister/scl.py", + "./scripts/pylib/twister/twisterlib/cmakecache.py", + "./scripts/pylib/twister/twisterlib/config_parser.py", + "./scripts/pylib/twister/twisterlib/coverage.py", + "./scripts/pylib/twister/twisterlib/environment.py", + "./scripts/pylib/twister/twisterlib/error.py", + "./scripts/pylib/twister/twisterlib/handlers.py", + "./scripts/pylib/twister/twisterlib/hardwaremap.py", + "./scripts/pylib/twister/twisterlib/harness.py", + "./scripts/pylib/twister/twisterlib/jobserver.py", + "./scripts/pylib/twister/twisterlib/log_helper.py", + "./scripts/pylib/twister/twisterlib/mixins.py", + "./scripts/pylib/twister/twisterlib/package.py", + "./scripts/pylib/twister/twisterlib/platform.py", + "./scripts/pylib/twister/twisterlib/quarantine.py", + "./scripts/pylib/twister/twisterlib/reports.py", + "./scripts/pylib/twister/twisterlib/runner.py", + "./scripts/pylib/twister/twisterlib/size_calc.py", + "./scripts/pylib/twister/twisterlib/statuses.py", + "./scripts/pylib/twister/twisterlib/testinstance.py", + "./scripts/pylib/twister/twisterlib/testplan.py", + "./scripts/pylib/twister/twisterlib/testsuite.py", + "./scripts/pylib/twister/twisterlib/twister_main.py", + "./scripts/pylint/checkers/argparse-checker.py", + "./scripts/release/bug_bash.py", + "./scripts/release/list_backports.py", + "./scripts/release/list_devicetree_bindings_changes.py", + "./scripts/set_assignees.py", + "./scripts/snippets.py", + "./scripts/support/quartus-flash.py", + "./scripts/tests/twister/conftest.py", + "./scripts/tests/twister/pytest_integration/test_harness_pytest.py", + "./scripts/tests/twister/test_cmakecache.py", + "./scripts/tests/twister/test_config_parser.py", + "./scripts/tests/twister/test_data/mixins/test_to_ignore.py", + "./scripts/tests/twister/test_environment.py", + "./scripts/tests/twister/test_errors.py", + "./scripts/tests/twister/test_handlers.py", + "./scripts/tests/twister/test_hardwaremap.py", + "./scripts/tests/twister/test_harness.py", + "./scripts/tests/twister/test_jobserver.py", + "./scripts/tests/twister/test_log_helper.py", + "./scripts/tests/twister/test_platform.py", + "./scripts/tests/twister/test_quarantine.py", + "./scripts/tests/twister/test_runner.py", + "./scripts/tests/twister/test_scl.py", + "./scripts/tests/twister/test_testinstance.py", + "./scripts/tests/twister/test_testplan.py", + "./scripts/tests/twister/test_testsuite.py", + "./scripts/tests/twister/test_twister.py", + "./scripts/tests/twister_blackbox/conftest.py", + "./scripts/tests/twister_blackbox/test_addon.py", + "./scripts/tests/twister_blackbox/test_config.py", + "./scripts/tests/twister_blackbox/test_coverage.py", + "./scripts/tests/twister_blackbox/test_data/tests/pytest/pytest/conftest.py", + "./scripts/tests/twister_blackbox/test_data/tests/pytest/pytest/test_sample.py", + "./scripts/tests/twister_blackbox/test_device.py", + "./scripts/tests/twister_blackbox/test_disable.py", + "./scripts/tests/twister_blackbox/test_error.py", + "./scripts/tests/twister_blackbox/test_filter.py", + "./scripts/tests/twister_blackbox/test_footprint.py", + "./scripts/tests/twister_blackbox/test_hardwaremap.py", + "./scripts/tests/twister_blackbox/test_outfile.py", + "./scripts/tests/twister_blackbox/test_output.py", + "./scripts/tests/twister_blackbox/test_platform.py", + "./scripts/tests/twister_blackbox/test_printouts.py", + "./scripts/tests/twister_blackbox/test_quarantine.py", + "./scripts/tests/twister_blackbox/test_report.py", + "./scripts/tests/twister_blackbox/test_runner.py", + "./scripts/tests/twister_blackbox/test_shuffle.py", + "./scripts/tests/twister_blackbox/test_testlist.py", + "./scripts/tests/twister_blackbox/test_testplan.py", + "./scripts/tests/twister_blackbox/test_tooling.py", + "./scripts/tracing/parse_ctf.py", + "./scripts/tracing/trace_capture_uart.py", + "./scripts/tracing/trace_capture_usb.py", + "./scripts/utils/board_v1_to_v2.py", + "./scripts/utils/convert_guidelines.py", + "./scripts/utils/gen_util_macros.py", + "./scripts/utils/migrate_includes.py", + "./scripts/utils/migrate_mcumgr_kconfigs.py", + "./scripts/utils/migrate_posix_kconfigs.py", + "./scripts/utils/ntc_thermistor_table.py", + "./scripts/utils/pinctrl_nrf_migrate.py", + "./scripts/utils/twister_to_list.py", + "./scripts/west_commands/bindesc.py", + "./scripts/west_commands/blobs.py", + "./scripts/west_commands/boards.py", + "./scripts/west_commands/build.py", + "./scripts/west_commands/build_helpers.py", + "./scripts/west_commands/completion.py", + "./scripts/west_commands/debug.py", + "./scripts/west_commands/export.py", + "./scripts/west_commands/fetchers/__init__.py", + "./scripts/west_commands/fetchers/core.py", + "./scripts/west_commands/fetchers/http.py", + "./scripts/west_commands/flash.py", + "./scripts/west_commands/robot.py", + "./scripts/west_commands/run_common.py", + "./scripts/west_commands/run_tests.py", + "./scripts/west_commands/runners/__init__.py", + "./scripts/west_commands/runners/blackmagicprobe.py", + "./scripts/west_commands/runners/bossac.py", + "./scripts/west_commands/runners/canopen_program.py", + "./scripts/west_commands/runners/core.py", + "./scripts/west_commands/runners/dediprog.py", + "./scripts/west_commands/runners/dfu.py", + "./scripts/west_commands/runners/esp32.py", + "./scripts/west_commands/runners/ezflashcli.py", + "./scripts/west_commands/runners/gd32isp.py", + "./scripts/west_commands/runners/hifive1.py", + "./scripts/west_commands/runners/intel_adsp.py", + "./scripts/west_commands/runners/intel_cyclonev.py", + "./scripts/west_commands/runners/jlink.py", + "./scripts/west_commands/runners/linkserver.py", + "./scripts/west_commands/runners/mdb.py", + "./scripts/west_commands/runners/misc.py", + "./scripts/west_commands/runners/native.py", + "./scripts/west_commands/runners/nios2.py", + "./scripts/west_commands/runners/nrf_common.py", + "./scripts/west_commands/runners/nrfjprog.py", + "./scripts/west_commands/runners/nrfutil.py", + "./scripts/west_commands/runners/nsim.py", + "./scripts/west_commands/runners/nxp_s32dbg.py", + "./scripts/west_commands/runners/openocd.py", + "./scripts/west_commands/runners/probe_rs.py", + "./scripts/west_commands/runners/pyocd.py", + "./scripts/west_commands/runners/qemu.py", + "./scripts/west_commands/runners/renode-robot.py", + "./scripts/west_commands/runners/renode.py", + "./scripts/west_commands/runners/silabs_commander.py", + "./scripts/west_commands/runners/spi_burn.py", + "./scripts/west_commands/runners/stm32cubeprogrammer.py", + "./scripts/west_commands/runners/stm32flash.py", + "./scripts/west_commands/runners/teensy.py", + "./scripts/west_commands/runners/trace32.py", + "./scripts/west_commands/runners/uf2.py", + "./scripts/west_commands/runners/xsdb.py", + "./scripts/west_commands/runners/xtensa.py", + "./scripts/west_commands/sdk.py", + "./scripts/west_commands/shields.py", + "./scripts/west_commands/sign.py", + "./scripts/west_commands/simulate.py", + "./scripts/west_commands/spdx.py", + "./scripts/west_commands/tests/conftest.py", + "./scripts/west_commands/tests/test_blackmagicprobe.py", + "./scripts/west_commands/tests/test_bossac.py", + "./scripts/west_commands/tests/test_build.py", + "./scripts/west_commands/tests/test_canopen_program.py", + "./scripts/west_commands/tests/test_dediprog.py", + "./scripts/west_commands/tests/test_dfu_util.py", + "./scripts/west_commands/tests/test_gd32isp.py", + "./scripts/west_commands/tests/test_imports.py", + "./scripts/west_commands/tests/test_mdb.py", + "./scripts/west_commands/tests/test_nrf.py", + "./scripts/west_commands/tests/test_nxp_s32dbg.py", + "./scripts/west_commands/tests/test_pyocd.py", + "./scripts/west_commands/tests/test_stm32cubeprogrammer.py", + "./scripts/west_commands/tests/test_stm32flash.py", + "./scripts/west_commands/tests/test_twister.py", + "./scripts/west_commands/tests/test_xsdb.py", + "./scripts/west_commands/twister_cmd.py", + "./scripts/west_commands/zcmake.py", + "./scripts/west_commands/zephyr_ext_common.py", + "./scripts/west_commands/zspdx/cmakecache.py", + "./scripts/west_commands/zspdx/cmakefileapi.py", + "./scripts/west_commands/zspdx/cmakefileapijson.py", + "./scripts/west_commands/zspdx/datatypes.py", + "./scripts/west_commands/zspdx/getincludes.py", + "./scripts/west_commands/zspdx/licenses.py", + "./scripts/west_commands/zspdx/sbom.py", + "./scripts/west_commands/zspdx/scanner.py", + "./scripts/west_commands/zspdx/spdxids.py", + "./scripts/west_commands/zspdx/util.py", + "./scripts/west_commands/zspdx/walker.py", + "./scripts/west_commands/zspdx/writer.py", + "./scripts/zephyr_module.py", + "./soc/aspeed/ast10x0/tools/gen_uart_booting_image.py", + "./soc/intel/intel_adsp/tools/cavstool.py", + "./soc/intel/intel_adsp/tools/cavstool_client.py", + "./soc/intel/intel_adsp/tools/remote-fw-service.py", + "./soc/intel/intel_ish/utils/build_ish_firmware.py", + "./soc/mediatek/mtk_adsp/gen_img.py", + "./soc/mediatek/mtk_adsp/mtk_adsp_load.py", + "./soc/microchip/mec/common/spigen/mec_spi_gen.py", + "./soc/nuvoton/npcm/common/esiost/esiost.py", + "./soc/nuvoton/npcm/common/esiost/esiost_args.py", + "./soc/nuvoton/npcx/common/ecst/ecst.py", + "./soc/nuvoton/npcx/common/ecst/ecst_args.py", + "./soc/silabs/silabs_sim3/sim3u/gen_crossbar_config.py", + "./tests/boot/with_mcumgr/pytest/test_downgrade_prevention.py", + "./tests/boot/with_mcumgr/pytest/test_upgrade.py", + "./tests/boot/with_mcumgr/pytest/west_sign_wrapper.py", + "./tests/drivers/can/host/pytest/can_shell.py", + "./tests/drivers/can/host/pytest/conftest.py", + "./tests/drivers/can/host/pytest/test_can.py", + "./tests/kernel/timer/timer_behavior/pytest/conftest.py", + "./tests/kernel/timer/timer_behavior/pytest/saleae_logic2.py", + "./tests/kernel/timer/timer_behavior/pytest/test_timer.py", + "./tests/misc/check_init_priorities/validate_check_init_priorities_output.py", + "./tests/misc/llext-edk/pytest/test_edk.py", + "./tests/net/lib/lwm2m/interop/pytest/conftest.py", + "./tests/net/lib/lwm2m/interop/pytest/leshan.py", + "./tests/net/lib/lwm2m/interop/pytest/test_blockwise.py", + "./tests/net/lib/lwm2m/interop/pytest/test_bootstrap.py", + "./tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py", + "./tests/net/lib/lwm2m/interop/pytest/test_nosec.py", + "./tests/net/lib/lwm2m/interop/pytest/test_portfolio.py", + "./tests/net/socket/tls_configurations/pytest/conftest.py", + "./tests/net/socket/tls_configurations/pytest/test_app_vs_openssl.py", + "./tests/net/socket/udp/generate-c-string.py", + "./tests/subsys/debug/gdbstub/pytest/conftest.py", + "./tests/subsys/debug/gdbstub/pytest/test_gdbstub.py", + "./tests/subsys/logging/dictionary/pytest/conftest.py", + "./tests/subsys/logging/dictionary/pytest/test_logging_dictionary.py", + "./tests/ztest/ztest_param/pytest/test_parameters.py", +] diff --git a/.ruff.toml b/.ruff.toml new file mode 100644 index 0000000000000..63593b21feca8 --- /dev/null +++ b/.ruff.toml @@ -0,0 +1,31 @@ +# Copyright (c) 2024 Basalte bv +# SPDX-License-Identifier: Apache-2.0 + +extend = ".ruff-excludes.toml" + +line-length = 100 +target-version = "py310" + +[lint] +select = [ + # zephyr-keep-sorted-start + "B", # flake8-bugbear + "E", # pycodestyle + "F", # pyflakes + "I", # isort + "SIM", # flake8-simplify + "UP", # pyupgrade + "W", # pycodestyle warnings + # zephyr-keep-sorted-stop +] + +ignore = [ + # zephyr-keep-sorted-start + "SIM108", # Allow if-else blocks instead of forcing ternary operator + "UP027", # deprecated pyupgrade rule + # zephyr-keep-sorted-stop +] + +[format] +quote-style = "preserve" +line-ending = "lf" From 1be5c157d9bf409ce43405d6c66cd41a60d9282f Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 6 Nov 2024 13:54:35 +0100 Subject: [PATCH 2846/4482] scripts: ci: check_compliance: Add python lint/format check Add a compliance test using ruff, for both linting and formatting of newly added python files. Signed-off-by: Pieter De Gendt --- .github/workflows/compliance.yml | 2 +- .gitignore | 1 + scripts/ci/check_compliance.py | 48 +++++++++++++++++++++++++++++ scripts/requirements-compliance.txt | 1 + 4 files changed, 51 insertions(+), 1 deletion(-) diff --git a/.github/workflows/compliance.yml b/.github/workflows/compliance.yml index 48dfa237aca94..a91a8e534cc29 100644 --- a/.github/workflows/compliance.yml +++ b/.github/workflows/compliance.yml @@ -38,7 +38,7 @@ jobs: run: | pip3 install setuptools pip3 install wheel - pip3 install python-magic lxml junitparser gitlint pylint pykwalify yamllint clang-format unidiff sphinx-lint + pip3 install python-magic lxml junitparser gitlint pylint pykwalify yamllint clang-format unidiff sphinx-lint ruff pip3 install west - name: west setup diff --git a/.gitignore b/.gitignore index c33e2d9374705..b545443db310f 100644 --- a/.gitignore +++ b/.gitignore @@ -102,6 +102,7 @@ MaintainersFormat.txt ModulesMaintainers.txt Nits.txt Pylint.txt +Ruff.txt SphinxLint.txt TextEncoding.txt YAMLLint.txt diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index 47edd292e4175..40b90e2aa3920 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1639,6 +1639,54 @@ def run(self): self.check_file(file, fp) +class Ruff(ComplianceTest): + """ + Ruff + """ + name = "Ruff" + doc = "Check python files with ruff." + path_hint = "" + + def run(self): + for file in get_files(filter="d"): + if not file.endswith(".py"): + continue + + try: + subprocess.run( + f"ruff check --force-exclude --output-format=json {file}", + check=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + shell=True, + cwd=GIT_TOP, + ) + except subprocess.CalledProcessError as ex: + output = ex.output.decode("utf-8") + messages = json.loads(output) + for m in messages: + self.fmtd_failure( + "error", + f'Python lint error ({m.get("code")}) see {m.get("url")}', + file, + line=m.get("location", {}).get("row"), + col=m.get("location", {}).get("column"), + end_line=m.get("end_location", {}).get("row"), + end_col=m.get("end_location", {}).get("column"), + desc=m.get("message"), + ) + try: + subprocess.run( + f"ruff format --force-exclude --diff {file}", + check=True, + shell=True, + cwd=GIT_TOP, + ) + except subprocess.CalledProcessError: + desc = f"Run 'ruff format {file}'" + self.fmtd_failure("error", "Python format error", file, desc=desc) + + class TextEncoding(ComplianceTest): """ Check that any text file is encoded in ascii or utf-8. diff --git a/scripts/requirements-compliance.txt b/scripts/requirements-compliance.txt index a439698693447..273b4f37dc521 100644 --- a/scripts/requirements-compliance.txt +++ b/scripts/requirements-compliance.txt @@ -10,3 +10,4 @@ pylint>=3 unidiff yamllint sphinx-lint +ruff From 2f0fcdf81cc4c1bc2abdb1deac768911ae513b66 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 19 Nov 2024 18:33:29 -0500 Subject: [PATCH 2847/4482] ci: twister: do not fail if there are no artifacts Do not fail if we can't download any artifacts, i.e. when job is cancelled. Only publish on push/schedule Signed-off-by: Anas Nashif --- .github/workflows/twister-publish.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/twister-publish.yaml b/.github/workflows/twister-publish.yaml index 36c6d4bdde404..9dc80ec17bf1f 100644 --- a/.github/workflows/twister-publish.yaml +++ b/.github/workflows/twister-publish.yaml @@ -11,7 +11,9 @@ on: jobs: upload-to-elasticsearch: - if: github.repository == 'zephyrproject-rtos/zephyr' + if: | + github.repository == 'zephyrproject-rtos/zephyr' && + github.event.workflow_run.event != 'pull_request_target' env: ELASTICSEARCH_KEY: ${{ secrets.ELASTICSEARCH_KEY }} ELASTICSEARCH_SERVER: "https://elasticsearch.zephyrproject.io:443" @@ -25,13 +27,16 @@ jobs: persist-credentials: false - name: Download Artifacts + id: download-artifacts uses: dawidd6/action-download-artifact@v6 with: path: artifacts workflow: twister.yml run_id: ${{ github.event.workflow_run.id }} + if_no_artifact_found: ignore - name: Upload to elasticsearch + if: steps.download-artifacts.outputs.found_artifact == 'true' run: | pip3 install elasticsearch # set run date on upload to get consistent and unified data across the matrix. From fd4c7bbbc2782ac1e6e40d9843f448f921d0f6ea Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 19 Nov 2024 19:44:56 -0500 Subject: [PATCH 2848/4482] Revert "ci: twister: use workflow_call for prep job" This reverts commit ac08acafdde69dba9b1fe715899a4aabae75a9ef. Pull requests not working as expected. Signed-off-by: Anas Nashif --- .github/workflows/twister-prep.yaml | 150 ---------------------------- .github/workflows/twister.yaml | 103 ++++++++++++++++++- 2 files changed, 102 insertions(+), 151 deletions(-) delete mode 100644 .github/workflows/twister-prep.yaml diff --git a/.github/workflows/twister-prep.yaml b/.github/workflows/twister-prep.yaml deleted file mode 100644 index 97f44f68a9e13..0000000000000 --- a/.github/workflows/twister-prep.yaml +++ /dev/null @@ -1,150 +0,0 @@ -name: Prep - -on: - workflow_call: - outputs: - subset: - description: subset - value: ${{ jobs.prep_push.outputs.subset }} || ${{ jobs.prep_pr.outputs.subset }} - size: - description: size - value: ${{ jobs.prep_push.outputs.size }} || ${{ jobs.prep_pr.outputs.size }} - fullrun: - description: fullrun - value: ${{ jobs.prep_push.outputs.fullrun }} || ${{ jobs.prep_pr.outputs.size }} - -jobs: - prep_pr: - if: github.repository_owner == 'zephyrproject-rtos' && github.event_name == 'pull_request_target' - runs-on: - group: zephyr-runner-v2-linux-x64-4xlarge - container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.4.20241026 - options: '--entrypoint /bin/bash' - outputs: - subset: ${{ steps.output-services.outputs.subset }} - size: ${{ steps.output-services.outputs.size }} - fullrun: ${{ steps.output-services.outputs.fullrun }} - env: - MATRIX_SIZE: 10 - PUSH_MATRIX_SIZE: 20 - DAILY_MATRIX_SIZE: 80 - BSIM_OUT_PATH: /opt/bsim/ - BSIM_COMPONENTS_PATH: /opt/bsim/components - TESTS_PER_BUILDER: 700 - COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} - BASE_REF: ${{ github.base_ref }} - steps: - - name: Apply container owner mismatch workaround - run: | - # FIXME: The owner UID of the GITHUB_WORKSPACE directory may not - # match the container user UID because of the way GitHub - # Actions runner is implemented. Remove this workaround when - # GitHub comes up with a fundamental fix for this problem. - git config --global --add safe.directory ${GITHUB_WORKSPACE} - - - name: Print cloud service information - run: | - echo "ZEPHYR_RUNNER_CLOUD_PROVIDER = ${ZEPHYR_RUNNER_CLOUD_PROVIDER}" - echo "ZEPHYR_RUNNER_CLOUD_NODE = ${ZEPHYR_RUNNER_CLOUD_NODE}" - echo "ZEPHYR_RUNNER_CLOUD_POD = ${ZEPHYR_RUNNER_CLOUD_POD}" - - - name: Clone cached Zephyr repository - if: github.event_name == 'pull_request_target' - continue-on-error: true - run: | - git clone --shared /repo-cache/zephyrproject/zephyr . - git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} - - - name: Checkout - if: github.event_name == 'pull_request_target' - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - persist-credentials: false - - - name: Environment Setup - if: github.event_name == 'pull_request_target' - run: | - git config --global user.email "bot@zephyrproject.org" - git config --global user.name "Zephyr Bot" - rm -fr ".git/rebase-apply" - git rebase origin/${BASE_REF} - git clean -f -d - git log --pretty=oneline | head -n 10 - west init -l . || true - west config manifest.group-filter -- +ci,+optional - west config --global update.narrow true - west update --path-cache /repo-cache/zephyrproject 2>&1 1> west.update.log || west update --path-cache /repo-cache/zephyrproject 2>&1 1> west.update.log || ( rm -rf ../modules ../bootloader ../tools && west update --path-cache /repo-cache/zephyrproject) - west forall -c 'git reset --hard HEAD' - - echo "ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/zephyr-sdk-$( cat SDK_VERSION )" >> $GITHUB_ENV - - - name: Generate Test Plan with Twister - if: github.event_name == 'pull_request_target' - id: test-plan - run: | - export ZEPHYR_BASE=${PWD} - export ZEPHYR_TOOLCHAIN_VARIANT=zephyr - python3 ./scripts/ci/test_plan.py -c origin/${BASE_REF}.. --pull-request -t $TESTS_PER_BUILDER - if [ -s .testplan ]; then - cat .testplan >> $GITHUB_ENV - else - echo "TWISTER_NODES=${MATRIX_SIZE}" >> $GITHUB_ENV - fi - rm -f testplan.json .testplan - - - name: Determine matrix size - id: output-services - run: | - if [ -n "${TWISTER_NODES}" ]; then - subset="[$(seq -s',' 1 ${TWISTER_NODES})]" - else - subset="[$(seq -s',' 1 ${MATRIX_SIZE})]" - fi - size=${TWISTER_NODES} - - echo "subset=${subset}" >> $GITHUB_OUTPUT - echo "size=${size}" >> $GITHUB_OUTPUT - echo "fullrun=${TWISTER_FULL}" >> $GITHUB_OUTPUT - - prep_push: - if: github.repository_owner == 'zephyrproject-rtos' && (github.event_name == 'push' || github.event_name == 'schedule') - runs-on: ubuntu-22.04 - outputs: - subset: ${{ steps.output-services.outputs.subset }} - size: ${{ steps.output-services.outputs.size }} - fullrun: ${{ steps.output-services.outputs.fullrun }} - env: - MATRIX_SIZE: 10 - PUSH_MATRIX_SIZE: 20 - DAILY_MATRIX_SIZE: 80 - BSIM_OUT_PATH: /opt/bsim/ - BSIM_COMPONENTS_PATH: /opt/bsim/components - TESTS_PER_BUILDER: 700 - COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} - BASE_REF: ${{ github.base_ref }} - steps: - - name: Print cloud service information - run: | - echo "ZEPHYR_RUNNER_CLOUD_PROVIDER = ${ZEPHYR_RUNNER_CLOUD_PROVIDER}" - echo "ZEPHYR_RUNNER_CLOUD_NODE = ${ZEPHYR_RUNNER_CLOUD_NODE}" - echo "ZEPHYR_RUNNER_CLOUD_POD = ${ZEPHYR_RUNNER_CLOUD_POD}" - - - name: Determine matrix size - id: output-services - run: | - if [ "${{github.event_name}}" = "push" ]; then - subset="[$(seq -s',' 1 ${PUSH_MATRIX_SIZE})]" - size=${MATRIX_SIZE} - elif [ "${{github.event_name}}" = "schedule" -a "${{github.repository}}" = "zephyrproject-rtos/zephyr" ]; then - subset="[$(seq -s',' 1 ${DAILY_MATRIX_SIZE})]" - size=${DAILY_MATRIX_SIZE} - else - size=0 - fi - - echo "subset=${subset}" >> $GITHUB_OUTPUT - echo "size=${size}" >> $GITHUB_OUTPUT - echo "fullrun=${TWISTER_FULL}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/twister.yaml b/.github/workflows/twister.yaml index 1d863c7c69080..57cedfd156370 100644 --- a/.github/workflows/twister.yaml +++ b/.github/workflows/twister.yaml @@ -21,7 +21,108 @@ concurrency: jobs: twister-build-prep: - uses: ./.github/workflows/twister-prep.yaml + if: github.repository_owner == 'zephyrproject-rtos' + runs-on: + group: zephyr-runner-v2-linux-x64-4xlarge + container: + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.4.20241026 + options: '--entrypoint /bin/bash' + outputs: + subset: ${{ steps.output-services.outputs.subset }} + size: ${{ steps.output-services.outputs.size }} + fullrun: ${{ steps.output-services.outputs.fullrun }} + env: + MATRIX_SIZE: 10 + PUSH_MATRIX_SIZE: 20 + DAILY_MATRIX_SIZE: 80 + BSIM_OUT_PATH: /opt/bsim/ + BSIM_COMPONENTS_PATH: /opt/bsim/components + TESTS_PER_BUILDER: 700 + COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} + BASE_REF: ${{ github.base_ref }} + steps: + - name: Apply container owner mismatch workaround + run: | + # FIXME: The owner UID of the GITHUB_WORKSPACE directory may not + # match the container user UID because of the way GitHub + # Actions runner is implemented. Remove this workaround when + # GitHub comes up with a fundamental fix for this problem. + git config --global --add safe.directory ${GITHUB_WORKSPACE} + + - name: Print cloud service information + run: | + echo "ZEPHYR_RUNNER_CLOUD_PROVIDER = ${ZEPHYR_RUNNER_CLOUD_PROVIDER}" + echo "ZEPHYR_RUNNER_CLOUD_NODE = ${ZEPHYR_RUNNER_CLOUD_NODE}" + echo "ZEPHYR_RUNNER_CLOUD_POD = ${ZEPHYR_RUNNER_CLOUD_POD}" + + - name: Clone cached Zephyr repository + if: github.event_name == 'pull_request_target' + continue-on-error: true + run: | + git clone --shared /repo-cache/zephyrproject/zephyr . + git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} + + - name: Checkout + if: github.event_name == 'pull_request_target' + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + persist-credentials: false + + - name: Environment Setup + if: github.event_name == 'pull_request_target' + run: | + git config --global user.email "bot@zephyrproject.org" + git config --global user.name "Zephyr Bot" + rm -fr ".git/rebase-apply" + git rebase origin/${BASE_REF} + git clean -f -d + git log --pretty=oneline | head -n 10 + west init -l . || true + west config manifest.group-filter -- +ci,+optional + west config --global update.narrow true + west update --path-cache /repo-cache/zephyrproject 2>&1 1> west.update.log || west update --path-cache /repo-cache/zephyrproject 2>&1 1> west.update.log || ( rm -rf ../modules ../bootloader ../tools && west update --path-cache /repo-cache/zephyrproject) + west forall -c 'git reset --hard HEAD' + + echo "ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/zephyr-sdk-$( cat SDK_VERSION )" >> $GITHUB_ENV + + - name: Generate Test Plan with Twister + if: github.event_name == 'pull_request_target' + id: test-plan + run: | + export ZEPHYR_BASE=${PWD} + export ZEPHYR_TOOLCHAIN_VARIANT=zephyr + python3 ./scripts/ci/test_plan.py -c origin/${BASE_REF}.. --pull-request -t $TESTS_PER_BUILDER + if [ -s .testplan ]; then + cat .testplan >> $GITHUB_ENV + else + echo "TWISTER_NODES=${MATRIX_SIZE}" >> $GITHUB_ENV + fi + rm -f testplan.json .testplan + + - name: Determine matrix size + id: output-services + run: | + if [ "${{github.event_name}}" = "pull_request_target" ]; then + if [ -n "${TWISTER_NODES}" ]; then + subset="[$(seq -s',' 1 ${TWISTER_NODES})]" + else + subset="[$(seq -s',' 1 ${MATRIX_SIZE})]" + fi + size=${TWISTER_NODES} + elif [ "${{github.event_name}}" = "push" ]; then + subset="[$(seq -s',' 1 ${PUSH_MATRIX_SIZE})]" + size=${MATRIX_SIZE} + elif [ "${{github.event_name}}" = "schedule" -a "${{github.repository}}" = "zephyrproject-rtos/zephyr" ]; then + subset="[$(seq -s',' 1 ${DAILY_MATRIX_SIZE})]" + size=${DAILY_MATRIX_SIZE} + else + size=0 + fi + echo "subset=${subset}" >> $GITHUB_OUTPUT + echo "size=${size}" >> $GITHUB_OUTPUT + echo "fullrun=${TWISTER_FULL}" >> $GITHUB_OUTPUT twister-build: runs-on: From 6672e673b3261238b3494c43b8e6a9047d7e85a3 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Sun, 17 Nov 2024 21:14:39 -0300 Subject: [PATCH 2849/4482] boards: m5stack_cores3: fix board configuration This board has a few issues handled by this PR: - Fix DTS entries to meet necessary flash partitions - Fix wrong kconfig entries realted to SoC model Signed-off-by: Sylvio Alves --- boards/m5stack/m5stack_cores3/Kconfig | 18 +------- .../m5stack/m5stack_cores3/Kconfig.sysbuild | 10 +++++ .../m5stack_cores3/m5stack_cores3_appcpu.dts | 43 ++----------------- .../m5stack_cores3/m5stack_cores3_procpu.dts | 40 +---------------- 4 files changed, 18 insertions(+), 93 deletions(-) create mode 100644 boards/m5stack/m5stack_cores3/Kconfig.sysbuild diff --git a/boards/m5stack/m5stack_cores3/Kconfig b/boards/m5stack/m5stack_cores3/Kconfig index 0fa82611253a5..26f6eed3551af 100644 --- a/boards/m5stack/m5stack_cores3/Kconfig +++ b/boards/m5stack/m5stack_cores3/Kconfig @@ -1,21 +1,7 @@ # Copyright (c) 2024 Zhang Xingtao # SPDX-License-Identifier: Apache-2.0 -if BOARD_M5STACK_CORES3_ESP32S3_PROCPU - config HEAP_MEM_POOL_ADD_SIZE_BOARD int - default $(UINT16_MAX) if WIFI && BT - default 51200 if WIFI - default 40960 if BT - default 4096 - -endif # BOARD_M5STACK_CORES3_ESP32S3_PROCPU - -if BOARD_M5STACK_CORES3_ESP32S3_APPCPU - -config HEAP_MEM_POOL_ADD_SIZE_BOARD - int - default 256 - -endif # BOARD_M5STACK_CORES3_ESP32S3_APPCPU + default 4096 if BOARD_M5STACK_CORES3_ESP32S3_PROCPU + default 256 if BOARD_M5STACK_CORES3_ESP32S3_APPCPU diff --git a/boards/m5stack/m5stack_cores3/Kconfig.sysbuild b/boards/m5stack/m5stack_cores3/Kconfig.sysbuild new file mode 100644 index 0000000000000..3a2d17ac5cfd0 --- /dev/null +++ b/boards/m5stack/m5stack_cores3/Kconfig.sysbuild @@ -0,0 +1,10 @@ +# Copyright (c) 2023 Espressif Systems (Shanghai) Co., Ltd. +# SPDX-License-Identifier: Apache-2.0 + +choice BOOTLOADER + default BOOTLOADER_MCUBOOT +endchoice + +choice BOOT_SIGNATURE_TYPE + default BOOT_SIGNATURE_TYPE_NONE +endchoice diff --git a/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.dts b/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.dts index 02b85a6934278..236ffd0a3a85d 100644 --- a/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.dts +++ b/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.dts @@ -6,6 +6,8 @@ /dts-v1/; #include +#include +#include "m5stack_cores3-pinctrl.dtsi" / { model = "M5Stack CoreS3 APPCPU"; @@ -15,6 +17,8 @@ zephyr,sram = &sram0; zephyr,ipc_shm = &shm0; zephyr,ipc = &ipm0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_appcpu_partition; }; }; @@ -25,42 +29,3 @@ &trng0 { status = "okay"; }; - -&flash0 { - status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - /* Reserve 60kB for the bootloader */ - boot_partition: partition@1000 { - label = "mcuboot"; - reg = <0x00001000 0x0000F000>; - read-only; - }; - - /* Reserve 1024kB for the application in slot 0 */ - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - /* Reserve 1024kB for the application in slot 1 */ - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - /* Reserve 256kB for the scratch partition */ - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; diff --git a/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.dts b/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.dts index 9ac36cb8a86f0..2042ca2422a49 100644 --- a/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.dts +++ b/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.dts @@ -6,7 +6,8 @@ /dts-v1/; -#include +#include +#include #include "m5stack_cores3-pinctrl.dtsi" / { @@ -76,43 +77,6 @@ status = "okay"; }; -&flash0 { - status = "okay"; - reg = <0x0 DT_SIZE_M(16)>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x0000F000>; - read-only; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; - &esp32_bt_hci { status = "okay"; }; From d2a0c3315ee0d11f67453e88fa42f32c707e2207 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Sun, 17 Nov 2024 21:17:23 -0300 Subject: [PATCH 2850/4482] boards: m5stack_cores3: update documentation Modify this board docs to meet latest changes. Signed-off-by: Sylvio Alves --- boards/m5stack/m5stack_cores3/doc/index.rst | 29 +++++++-------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/boards/m5stack/m5stack_cores3/doc/index.rst b/boards/m5stack/m5stack_cores3/doc/index.rst index f1b1290d16c73..4ee0d8461b697 100644 --- a/boards/m5stack/m5stack_cores3/doc/index.rst +++ b/boards/m5stack/m5stack_cores3/doc/index.rst @@ -1,7 +1,4 @@ -.. _m5stack_cores3: - -M5Stack CoreS3 -############## +.. zephyr:board:: m5stack_cores3 Overview ******** @@ -27,13 +24,6 @@ M5Stack CoreS3 features consist of: - PMIC AXP2101 - Battery 500mAh 3.7 V -.. figure:: img/m5stack_cores3.webp - :align: center - :alt: M5Stack-CoreS3 - :width: 400 px - - M5Stack CoreS3 module - Start Application Development ***************************** @@ -99,19 +89,18 @@ message in the monitor: Debugging --------- -ESP32-S3 support on OpenOCD is available upstream as of version 0.12.0. -Download and install OpenOCD from `OpenOCD`_. +ESP32-S3 support on OpenOCD is available at `OpenOCD ESP32`_. ESP32-S3 has a built-in JTAG circuitry and can be debugged without any additional chip. Only an USB cable connected to the D+/D- pins is necessary. Further documentation can be obtained from the SoC vendor in `JTAG debugging for ESP32-S3`_. -.. _`OpenOCD`: https://github.com/openocd-org/openocd -.. _`JTAG debugging for ESP32-S3`: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/jtag-debugging/ - +References +********** -Related Documents -***************** +.. target-notes:: -- `M5Stack CoreS3 official docs `_ -- `M5Stack CoreS3 schematic `_ (PDF) +.. _`M5Stack CoreS3 Documentation`: http://docs.m5stack.com/en/core/CoreS3 +.. _`M5Stack CoreS3 Schematic`: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/K128%20CoreS3/Sch_M5_CoreS3_v1.0.pdf +.. _`OpenOCD ESP32`: https://github.com/espressif/openocd-esp32/releases +.. _`JTAG debugging for ESP32-S3`: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/jtag-debugging/ From fecf909a2a6f9c6d220168d697efc8245c01f43e Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Sun, 17 Nov 2024 21:46:21 -0300 Subject: [PATCH 2851/4482] revert "boards: m5stack/m5stack_cores3: disable in twister" This reverts commit 410c8a57e09df46751ca616eae2bf4ed80b7a1f1 so that m5stack_cores3 can be tested properly. Signed-off-by: Sylvio Alves --- boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.yaml | 1 - boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.yaml b/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.yaml index fcf856b1fa4cb..19e6b770c68f3 100644 --- a/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.yaml +++ b/boards/m5stack/m5stack_cores3/m5stack_cores3_appcpu.yaml @@ -1,7 +1,6 @@ identifier: m5stack_cores3/esp32s3/appcpu name: M5Stack CoreS3 APPCPU type: mcu -twister: false arch: xtensa toolchain: - zephyr diff --git a/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.yaml b/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.yaml index 15da2ed086727..e0e1f9c32cb7d 100644 --- a/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.yaml +++ b/boards/m5stack/m5stack_cores3/m5stack_cores3_procpu.yaml @@ -1,7 +1,6 @@ identifier: m5stack_cores3/esp32s3/procpu name: M5Stack CoreS3 PROCPU type: mcu -twister: false arch: xtensa toolchain: - zephyr From 2152b8e41403d0abf31709f61041fde86e89adef Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Wed, 30 Oct 2024 11:15:07 +0800 Subject: [PATCH 2852/4482] irq: multilevel: compile 3rd level IRQ APIs only when enabled This revert the idea of 3fa7d78 from #78845. The 3rd level IRQ APIs won't compile when CONFIG_3RD_LEVEL_INTERRUPT_BITS=0. Updated testcase accordingly. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- include/zephyr/irq_multilevel.h | 54 ++++++++++++++---- tests/kernel/interrupt/src/multilevel_irq.c | 61 ++++++++++++++++----- tests/kernel/interrupt/testcase.yaml | 8 +++ 3 files changed, 98 insertions(+), 25 deletions(-) diff --git a/include/zephyr/irq_multilevel.h b/include/zephyr/irq_multilevel.h index dc18c3049b6b4..adb0ffefc917a 100644 --- a/include/zephyr/irq_multilevel.h +++ b/include/zephyr/irq_multilevel.h @@ -32,15 +32,19 @@ typedef union _z_irq { uint32_t l1: CONFIG_1ST_LEVEL_INTERRUPT_BITS; /* Second level interrupt bits */ uint32_t l2: CONFIG_2ND_LEVEL_INTERRUPT_BITS; +#ifdef CONFIG_3RD_LEVEL_INTERRUPTS /* Third level interrupt bits */ uint32_t l3: CONFIG_3RD_LEVEL_INTERRUPT_BITS; +#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ } bits; +#ifdef CONFIG_3RD_LEVEL_INTERRUPTS /* Third level IRQ's interrupt controller */ struct { /* IRQ of the third level interrupt aggregator */ uint32_t irq: CONFIG_1ST_LEVEL_INTERRUPT_BITS + CONFIG_2ND_LEVEL_INTERRUPT_BITS; } l3_intc; +#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ /* Second level IRQ's interrupt controller */ struct { @@ -61,16 +65,20 @@ static inline uint32_t _z_l2_irq(_z_irq_t irq) return irq.bits.l2 - 1; } +#ifdef CONFIG_3RD_LEVEL_INTERRUPTS static inline uint32_t _z_l3_irq(_z_irq_t irq) { return irq.bits.l3 - 1; } +#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ static inline unsigned int _z_irq_get_level(_z_irq_t z_irq) { +#ifdef CONFIG_3RD_LEVEL_INTERRUPTS if (z_irq.bits.l3 != 0) { return 3; } +#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ if (z_irq.bits.l2 != 0) { return 2; @@ -142,7 +150,9 @@ static inline unsigned int irq_to_level_2(unsigned int irq) .bits = { .l1 = 0, .l2 = irq + 1, +#ifdef CONFIG_3RD_LEVEL_INTERRUPTS .l3 = 0, +#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ }, }; @@ -168,6 +178,7 @@ static inline unsigned int irq_parent_level_2(unsigned int irq) return _z_l1_irq(z_irq); } +#ifdef CONFIG_3RD_LEVEL_INTERRUPTS /** * @brief Return the 3rd level interrupt number * @@ -241,6 +252,7 @@ static inline unsigned int irq_parent_level_3(unsigned int irq) return _z_l2_irq(z_irq); } +#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ /** * @brief Return the interrupt number for a given level @@ -256,11 +268,14 @@ static inline unsigned int irq_from_level(unsigned int irq, unsigned int level) return irq; } else if (level == 2) { return irq_from_level_2(irq); - } else if (level == 3) { + } +#ifdef CONFIG_3RD_LEVEL_INTERRUPTS + else if (level == 3) { return irq_from_level_3(irq); } +#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ - /* level is higher than 3 */ + /* level is higher than what's supported */ __ASSERT_NO_MSG(false); return irq; } @@ -279,11 +294,14 @@ static inline unsigned int irq_to_level(unsigned int irq, unsigned int level) return irq; } else if (level == 2) { return irq_to_level_2(irq); - } else if (level == 3) { + } +#ifdef CONFIG_3RD_LEVEL_INTERRUPTS + else if (level == 3) { return irq_to_level_3(irq); } +#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ - /* level is higher than 3 */ + /* level is higher than what's supported */ __ASSERT_NO_MSG(false); return irq; } @@ -303,11 +321,14 @@ static inline unsigned int irq_parent_level(unsigned int irq, unsigned int level return irq; } else if (level == 2) { return irq_parent_level_2(irq); - } else if (level == 3) { + } +#ifdef CONFIG_3RD_LEVEL_INTERRUPTS + else if (level == 3) { return irq_parent_level_3(irq); } +#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ - /* level is higher than 3 */ + /* level is higher than what's supported */ __ASSERT_NO_MSG(false); return irq; } @@ -322,19 +343,24 @@ static inline unsigned int irq_parent_level(unsigned int irq, unsigned int level static inline unsigned int irq_get_intc_irq(unsigned int irq) { const unsigned int level = irq_get_level(irq); - - __ASSERT_NO_MSG(level <= 3); _z_irq_t z_irq = { .irq = irq, }; +#ifdef CONFIG_3RD_LEVEL_INTERRUPTS + __ASSERT_NO_MSG(level <= 3); if (level == 3) { return z_irq.l3_intc.irq; - } else if (level == 2) { + } +#else + __ASSERT_NO_MSG(level <= 2); +#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ + + if (level == 2) { return z_irq.l2_intc.irq; - } else { - return irq; } + + return irq; } /** @@ -351,8 +377,12 @@ static inline unsigned int irq_increment(unsigned int irq, unsigned int val) .irq = irq, }; - if (z_irq.bits.l3 != 0) { + if (false) { + /* so that it evaluates the next condition */ +#ifdef CONFIG_3RD_LEVEL_INTERRUPTS + } else if (z_irq.bits.l3 != 0) { z_irq.bits.l3 += val; +#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ } else if (z_irq.bits.l2 != 0) { z_irq.bits.l2 += val; } else { diff --git a/tests/kernel/interrupt/src/multilevel_irq.c b/tests/kernel/interrupt/src/multilevel_irq.c index 76dbd29b4543a..b73626bc1aa73 100644 --- a/tests/kernel/interrupt/src/multilevel_irq.c +++ b/tests/kernel/interrupt/src/multilevel_irq.c @@ -12,18 +12,15 @@ ZTEST(interrupt_feature, test_multi_level_api) { /* Zephyr multilevel-encoded IRQ */ - const uint32_t irqn_l3 = DT_IRQN(DT_NODELABEL(test_l3_irq)); const uint32_t irqn_l2 = DT_IRQN(DT_NODELABEL(test_l2_irq)); const uint32_t irqn_l1 = DT_IRQN(DT_NODELABEL(test_l1_irq)); /* Raw IRQ specified in the devicetree */ - const uint32_t raw_l3 = DT_IRQ(DT_NODELABEL(test_l3_irq), irq); const uint32_t raw_l2 = DT_IRQ(DT_NODELABEL(test_l2_irq), irq); const uint32_t raw_l1 = DT_IRQ(DT_NODELABEL(test_l1_irq), irq); /** * - irq_get_level() */ - zassert_equal(3, irq_get_level(irqn_l3)); zassert_equal(2, irq_get_level(irqn_l2)); zassert_equal(1, irq_get_level(irqn_l1)); @@ -32,13 +29,59 @@ ZTEST(interrupt_feature, test_multi_level_api) * - irq_to_level_2() * - irq_parent_level_2() */ - zassert_equal(irq_from_level_2(irqn_l3), raw_l2); zassert_equal(irq_from_level_2(irqn_l2), raw_l2); zassert_equal(irq_to_level_2(raw_l2) & irqn_l2, irq_to_level_2(raw_l2)); zassert_equal(irq_parent_level_2(irqn_l2), raw_l1); + /** + * - irq_from_level() + * - irq_to_level() + * - irq_parent_level() + */ + zassert_equal(irq_from_level(irqn_l2, 2), raw_l2); + + zassert_equal(irq_to_level(raw_l2, 2) & irqn_l2, irq_to_level(raw_l2, 2)); + + zassert_equal(irq_parent_level(irqn_l2, 2), raw_l1); + + /** + * - irq_get_intc_irq() + */ + zassert_equal(irq_get_intc_irq(irqn_l2), irqn_l1); + zassert_equal(irq_get_intc_irq(irqn_l1), irqn_l1); + + const uint32_t irqn_l2_inc = DT_IRQN(DT_NODELABEL(test_l2_irq_inc)); + const uint32_t irqn_l1_inc = DT_IRQN(DT_NODELABEL(test_l1_irq_inc)); + + /** + * - irq_increment() + */ + zassert_equal(irq_increment(irqn_l1, 1), irqn_l1_inc); + zassert_equal(irq_increment(irqn_l2, 2), irqn_l2_inc); +} + +#ifdef CONFIG_3RD_LEVEL_INTERRUPTS +ZTEST(interrupt_feature, test_multi_level_api_l3) +{ + /* Zephyr multilevel-encoded IRQ */ + const uint32_t irqn_l2 = DT_IRQN(DT_NODELABEL(test_l2_irq)); + const uint32_t irqn_l3 = DT_IRQN(DT_NODELABEL(test_l3_irq)); + /* Raw IRQ specified in the devicetree */ + const uint32_t raw_l2 = DT_IRQ(DT_NODELABEL(test_l2_irq), irq); + const uint32_t raw_l3 = DT_IRQ(DT_NODELABEL(test_l3_irq), irq); + + /** + * - irq_get_level() + */ + zassert_equal(3, irq_get_level(irqn_l3)); + + /** + * - irq_from_level_2() + */ + zassert_equal(irq_from_level_2(irqn_l3), raw_l2); + /** * - irq_from_level_3() * - irq_to_level_3() @@ -56,32 +99,24 @@ ZTEST(interrupt_feature, test_multi_level_api) * - irq_parent_level() */ zassert_equal(irq_from_level(irqn_l3, 2), raw_l2); - zassert_equal(irq_from_level(irqn_l2, 2), raw_l2); zassert_equal(irq_from_level(irqn_l3, 3), raw_l3); - zassert_equal(irq_to_level(raw_l2, 2) & irqn_l2, irq_to_level(raw_l2, 2)); zassert_equal(irq_to_level(raw_l3, 3) & irqn_l3, irq_to_level(raw_l3, 3)); - zassert_equal(irq_parent_level(irqn_l2, 2), raw_l1); zassert_equal(irq_parent_level(irqn_l3, 3), raw_l2); /** * - irq_get_intc_irq() */ zassert_equal(irq_get_intc_irq(irqn_l3), irqn_l2); - zassert_equal(irq_get_intc_irq(irqn_l2), irqn_l1); - zassert_equal(irq_get_intc_irq(irqn_l1), irqn_l1); const uint32_t irqn_l3_inc = DT_IRQN(DT_NODELABEL(test_l3_irq_inc)); - const uint32_t irqn_l2_inc = DT_IRQN(DT_NODELABEL(test_l2_irq_inc)); - const uint32_t irqn_l1_inc = DT_IRQN(DT_NODELABEL(test_l1_irq_inc)); /** * - irq_increment() */ - zassert_equal(irq_increment(irqn_l1, 1), irqn_l1_inc); - zassert_equal(irq_increment(irqn_l2, 2), irqn_l2_inc); zassert_equal(irq_increment(irqn_l3, 3), irqn_l3_inc); } +#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ ZTEST_SUITE(gen_isr_table_multilevel, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/kernel/interrupt/testcase.yaml b/tests/kernel/interrupt/testcase.yaml index 1ed995c0baa18..ec4afb7ab9361 100644 --- a/tests/kernel/interrupt/testcase.yaml +++ b/tests/kernel/interrupt/testcase.yaml @@ -85,3 +85,11 @@ tests: - EXTRA_DTC_OVERLAY_FILE="multilevel_irq.overlay" extra_configs: - CONFIG_TEST_MULTILEVEL_IRQ=y + arch.interrupt.multilevel_l3: + filter: CONFIG_MULTI_LEVEL_INTERRUPTS + extra_args: + - EXTRA_DTC_OVERLAY_FILE="multilevel_irq.overlay" + extra_configs: + - CONFIG_TEST_MULTILEVEL_IRQ=y + - CONFIG_3RD_LEVEL_INTERRUPTS=y + - CONFIG_3RD_LEVEL_INTERRUPT_BITS=11 From c4b7b684dc5caa7805f8267499f43cc0c5bc56fd Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 11 Nov 2024 16:17:01 +0100 Subject: [PATCH 2853/4482] boards native: Deprecate CONFIG_NATIVE_APPLICATION This option is used in tree only by native_posix, which is deprecated and being replaced by native_sim. But may be used also in out of tree targets. As part of the native_posix deprecation, and therefore the lack of testing this feature would have in the future, we are also deprecating this option. Signed-off-by: Alberto Escolar Piedras --- Kconfig.zephyr | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 77821c359c79f..51ef697f9c530 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -470,9 +470,11 @@ config NATIVE_APPLICATION default y if ARCH_POSIX depends on !NATIVE_LIBRARY select NATIVE_BUILD + select DEPRECATED help Build as a native application that can run on the host and using - resources and libraries provided by the host. + resources and libraries provided by the host. This option is deprecated + and will be removed in Zephyr v4.3 config NATIVE_LIBRARY bool From b77d896ff62e9f6aa0beab732edda1d2a15a1528 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 11 Nov 2024 16:20:01 +0100 Subject: [PATCH 2854/4482] boards native_sim: Deprecate CONFIG_NATIVE_SIM_NATIVE_POSIX_COMPAT This option existed only to make the transition from native_posix to native_sim easier. As native_posix is going to be removed in v4.2 we deprecate this option now, so it will also be removed. We also switch this option to default to false already now. Signed-off-by: Alberto Escolar Piedras --- boards/native/native_sim/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/boards/native/native_sim/Kconfig b/boards/native/native_sim/Kconfig index c2610e840e784..fc84adda149f9 100644 --- a/boards/native/native_sim/Kconfig +++ b/boards/native/native_sim/Kconfig @@ -18,12 +18,13 @@ comment "Native Simular (Single Core) options" config NATIVE_SIM_NATIVE_POSIX_COMPAT bool "Pretend to be a native_posix board" - default y + select DEPRECATED help When this option is set the native_sim board will pretend to be a native_posix board from kconfig point of view, to allow using it directly with code which was meant for the native_posix board and checks for the macro CONFIG_BOARD_NATIVE_POSIX, or requires other kconfig options which depend on it. + This option is deprecated and will be removed in Zephyr v4.3 config NATIVE_SIM_SLOWDOWN_TO_REAL_TIME bool "Slow down execution to real time" From d703d9077fd62d3965f0ea477e0e907a53ea94b7 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 11 Nov 2024 16:29:54 +0100 Subject: [PATCH 2855/4482] doc: 4.1 release & migration guide: Add native deprecation Mention that CONFIG_NATIVE_APPLICATION & CONFIG_NATIVE_SIM_NATIVE_POSIX_COMPAT have been deprecated. Signed-off-by: Alberto Escolar Piedras --- doc/releases/migration-guide-4.1.rst | 9 +++++++++ doc/releases/release-notes-4.1.rst | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/doc/releases/migration-guide-4.1.rst b/doc/releases/migration-guide-4.1.rst index 8712b6cc9a987..04eabfdcd340d 100644 --- a/doc/releases/migration-guide-4.1.rst +++ b/doc/releases/migration-guide-4.1.rst @@ -115,3 +115,12 @@ Modem Architectures ************* + +* native/POSIX + + * :kconfig:option:`CONFIG_NATIVE_APPLICATION` has been deprecated. Out-of-tree boards using this + option should migrate to the native_simulator runner (:github:`81232`). + For an example of how this was done with a board in-tree check :github:`61481`. + * For the native_sim target :kconfig:option:`CONFIG_NATIVE_SIM_NATIVE_POSIX_COMPAT` has been + switched to ``n`` by default, and this option has been deprecated. Ensure your code does not + use the :kconfig:option:`CONFIG_BOARD_NATIVE_POSIX` option anymore (:github:`81232`). diff --git a/doc/releases/release-notes-4.1.rst b/doc/releases/release-notes-4.1.rst index 40b3dfedfed5a..dff3f100c2c51 100644 --- a/doc/releases/release-notes-4.1.rst +++ b/doc/releases/release-notes-4.1.rst @@ -43,6 +43,12 @@ Architectures * Xtensa +* native/POSIX + + * :kconfig:option:`CONFIG_NATIVE_APPLICATION` has been deprecated. + * For the native_sim target :kconfig:option:`CONFIG_NATIVE_SIM_NATIVE_POSIX_COMPAT` has been + switched to ``n`` by default, and this option has been deprecated. + Kernel ****** From b8360ad5ee2f180966685ff729f955c2e7ebe355 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Sat, 19 Oct 2024 22:06:27 +1000 Subject: [PATCH 2856/4482] sys_clock: extra time defines Add additional time defines to round out the `SEC_PER_*` family. These are easier to type than `SEC_PER_MIN * MIN_PER_HOUR` and `SEC_PER_MIN * MIN_PER_HOUR * HOUR_PER_DAY`. Signed-off-by: Jordan Yates --- include/zephyr/sys_clock.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/zephyr/sys_clock.h b/include/zephyr/sys_clock.h index 56d67446af0b3..36abcff9f874c 100644 --- a/include/zephyr/sys_clock.h +++ b/include/zephyr/sys_clock.h @@ -94,6 +94,12 @@ typedef struct { /** number of seconds per minute */ #define SEC_PER_MIN 60U +/** number of seconds per hour */ +#define SEC_PER_HOUR 3600U + +/** number of seconds per day */ +#define SEC_PER_DAY 86400U + /** number of minutes per hour */ #define MIN_PER_HOUR 60U From c3b2f44173350fafd494950a1467d368d7977824 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 19 Nov 2024 18:24:25 -0500 Subject: [PATCH 2857/4482] ci: testplan: do not deal with arch changes This is generating lots of duplication and unnecessary builds when multiple arches are being changed. Let's stick to basic coverage which should be enough for PRs. Signed-off-by: Anas Nashif --- scripts/ci/test_plan.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/ci/test_plan.py b/scripts/ci/test_plan.py index 14fe54fdd3589..9e6c5b66dec17 100755 --- a/scripts/ci/test_plan.py +++ b/scripts/ci/test_plan.py @@ -123,7 +123,9 @@ def process(self): self.find_tags() self.find_tests() if not self.platforms: - self.find_archs() + # disable for now, this is generating lots of churn when changing + # architectures that is otherwise covered elsewhere. + #self.find_archs() self.find_boards() else: for file in self.modified_files: From 3364a35f05475a947dfd0bfc4f7b8984504caee4 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 19 Nov 2024 22:37:58 -0500 Subject: [PATCH 2858/4482] Revert "irq: multilevel: compile 3rd level IRQ APIs only when enabled" This reverts commit 2152b8e41403d0abf31709f61041fde86e89adef. This commit is breaking CI. Signed-off-by: Anas Nashif --- include/zephyr/irq_multilevel.h | 54 ++++-------------- tests/kernel/interrupt/src/multilevel_irq.c | 61 +++++---------------- tests/kernel/interrupt/testcase.yaml | 8 --- 3 files changed, 25 insertions(+), 98 deletions(-) diff --git a/include/zephyr/irq_multilevel.h b/include/zephyr/irq_multilevel.h index adb0ffefc917a..dc18c3049b6b4 100644 --- a/include/zephyr/irq_multilevel.h +++ b/include/zephyr/irq_multilevel.h @@ -32,19 +32,15 @@ typedef union _z_irq { uint32_t l1: CONFIG_1ST_LEVEL_INTERRUPT_BITS; /* Second level interrupt bits */ uint32_t l2: CONFIG_2ND_LEVEL_INTERRUPT_BITS; -#ifdef CONFIG_3RD_LEVEL_INTERRUPTS /* Third level interrupt bits */ uint32_t l3: CONFIG_3RD_LEVEL_INTERRUPT_BITS; -#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ } bits; -#ifdef CONFIG_3RD_LEVEL_INTERRUPTS /* Third level IRQ's interrupt controller */ struct { /* IRQ of the third level interrupt aggregator */ uint32_t irq: CONFIG_1ST_LEVEL_INTERRUPT_BITS + CONFIG_2ND_LEVEL_INTERRUPT_BITS; } l3_intc; -#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ /* Second level IRQ's interrupt controller */ struct { @@ -65,20 +61,16 @@ static inline uint32_t _z_l2_irq(_z_irq_t irq) return irq.bits.l2 - 1; } -#ifdef CONFIG_3RD_LEVEL_INTERRUPTS static inline uint32_t _z_l3_irq(_z_irq_t irq) { return irq.bits.l3 - 1; } -#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ static inline unsigned int _z_irq_get_level(_z_irq_t z_irq) { -#ifdef CONFIG_3RD_LEVEL_INTERRUPTS if (z_irq.bits.l3 != 0) { return 3; } -#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ if (z_irq.bits.l2 != 0) { return 2; @@ -150,9 +142,7 @@ static inline unsigned int irq_to_level_2(unsigned int irq) .bits = { .l1 = 0, .l2 = irq + 1, -#ifdef CONFIG_3RD_LEVEL_INTERRUPTS .l3 = 0, -#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ }, }; @@ -178,7 +168,6 @@ static inline unsigned int irq_parent_level_2(unsigned int irq) return _z_l1_irq(z_irq); } -#ifdef CONFIG_3RD_LEVEL_INTERRUPTS /** * @brief Return the 3rd level interrupt number * @@ -252,7 +241,6 @@ static inline unsigned int irq_parent_level_3(unsigned int irq) return _z_l2_irq(z_irq); } -#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ /** * @brief Return the interrupt number for a given level @@ -268,14 +256,11 @@ static inline unsigned int irq_from_level(unsigned int irq, unsigned int level) return irq; } else if (level == 2) { return irq_from_level_2(irq); - } -#ifdef CONFIG_3RD_LEVEL_INTERRUPTS - else if (level == 3) { + } else if (level == 3) { return irq_from_level_3(irq); } -#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ - /* level is higher than what's supported */ + /* level is higher than 3 */ __ASSERT_NO_MSG(false); return irq; } @@ -294,14 +279,11 @@ static inline unsigned int irq_to_level(unsigned int irq, unsigned int level) return irq; } else if (level == 2) { return irq_to_level_2(irq); - } -#ifdef CONFIG_3RD_LEVEL_INTERRUPTS - else if (level == 3) { + } else if (level == 3) { return irq_to_level_3(irq); } -#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ - /* level is higher than what's supported */ + /* level is higher than 3 */ __ASSERT_NO_MSG(false); return irq; } @@ -321,14 +303,11 @@ static inline unsigned int irq_parent_level(unsigned int irq, unsigned int level return irq; } else if (level == 2) { return irq_parent_level_2(irq); - } -#ifdef CONFIG_3RD_LEVEL_INTERRUPTS - else if (level == 3) { + } else if (level == 3) { return irq_parent_level_3(irq); } -#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ - /* level is higher than what's supported */ + /* level is higher than 3 */ __ASSERT_NO_MSG(false); return irq; } @@ -343,24 +322,19 @@ static inline unsigned int irq_parent_level(unsigned int irq, unsigned int level static inline unsigned int irq_get_intc_irq(unsigned int irq) { const unsigned int level = irq_get_level(irq); + + __ASSERT_NO_MSG(level <= 3); _z_irq_t z_irq = { .irq = irq, }; -#ifdef CONFIG_3RD_LEVEL_INTERRUPTS - __ASSERT_NO_MSG(level <= 3); if (level == 3) { return z_irq.l3_intc.irq; - } -#else - __ASSERT_NO_MSG(level <= 2); -#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ - - if (level == 2) { + } else if (level == 2) { return z_irq.l2_intc.irq; + } else { + return irq; } - - return irq; } /** @@ -377,12 +351,8 @@ static inline unsigned int irq_increment(unsigned int irq, unsigned int val) .irq = irq, }; - if (false) { - /* so that it evaluates the next condition */ -#ifdef CONFIG_3RD_LEVEL_INTERRUPTS - } else if (z_irq.bits.l3 != 0) { + if (z_irq.bits.l3 != 0) { z_irq.bits.l3 += val; -#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ } else if (z_irq.bits.l2 != 0) { z_irq.bits.l2 += val; } else { diff --git a/tests/kernel/interrupt/src/multilevel_irq.c b/tests/kernel/interrupt/src/multilevel_irq.c index b73626bc1aa73..76dbd29b4543a 100644 --- a/tests/kernel/interrupt/src/multilevel_irq.c +++ b/tests/kernel/interrupt/src/multilevel_irq.c @@ -12,15 +12,18 @@ ZTEST(interrupt_feature, test_multi_level_api) { /* Zephyr multilevel-encoded IRQ */ + const uint32_t irqn_l3 = DT_IRQN(DT_NODELABEL(test_l3_irq)); const uint32_t irqn_l2 = DT_IRQN(DT_NODELABEL(test_l2_irq)); const uint32_t irqn_l1 = DT_IRQN(DT_NODELABEL(test_l1_irq)); /* Raw IRQ specified in the devicetree */ + const uint32_t raw_l3 = DT_IRQ(DT_NODELABEL(test_l3_irq), irq); const uint32_t raw_l2 = DT_IRQ(DT_NODELABEL(test_l2_irq), irq); const uint32_t raw_l1 = DT_IRQ(DT_NODELABEL(test_l1_irq), irq); /** * - irq_get_level() */ + zassert_equal(3, irq_get_level(irqn_l3)); zassert_equal(2, irq_get_level(irqn_l2)); zassert_equal(1, irq_get_level(irqn_l1)); @@ -29,59 +32,13 @@ ZTEST(interrupt_feature, test_multi_level_api) * - irq_to_level_2() * - irq_parent_level_2() */ + zassert_equal(irq_from_level_2(irqn_l3), raw_l2); zassert_equal(irq_from_level_2(irqn_l2), raw_l2); zassert_equal(irq_to_level_2(raw_l2) & irqn_l2, irq_to_level_2(raw_l2)); zassert_equal(irq_parent_level_2(irqn_l2), raw_l1); - /** - * - irq_from_level() - * - irq_to_level() - * - irq_parent_level() - */ - zassert_equal(irq_from_level(irqn_l2, 2), raw_l2); - - zassert_equal(irq_to_level(raw_l2, 2) & irqn_l2, irq_to_level(raw_l2, 2)); - - zassert_equal(irq_parent_level(irqn_l2, 2), raw_l1); - - /** - * - irq_get_intc_irq() - */ - zassert_equal(irq_get_intc_irq(irqn_l2), irqn_l1); - zassert_equal(irq_get_intc_irq(irqn_l1), irqn_l1); - - const uint32_t irqn_l2_inc = DT_IRQN(DT_NODELABEL(test_l2_irq_inc)); - const uint32_t irqn_l1_inc = DT_IRQN(DT_NODELABEL(test_l1_irq_inc)); - - /** - * - irq_increment() - */ - zassert_equal(irq_increment(irqn_l1, 1), irqn_l1_inc); - zassert_equal(irq_increment(irqn_l2, 2), irqn_l2_inc); -} - -#ifdef CONFIG_3RD_LEVEL_INTERRUPTS -ZTEST(interrupt_feature, test_multi_level_api_l3) -{ - /* Zephyr multilevel-encoded IRQ */ - const uint32_t irqn_l2 = DT_IRQN(DT_NODELABEL(test_l2_irq)); - const uint32_t irqn_l3 = DT_IRQN(DT_NODELABEL(test_l3_irq)); - /* Raw IRQ specified in the devicetree */ - const uint32_t raw_l2 = DT_IRQ(DT_NODELABEL(test_l2_irq), irq); - const uint32_t raw_l3 = DT_IRQ(DT_NODELABEL(test_l3_irq), irq); - - /** - * - irq_get_level() - */ - zassert_equal(3, irq_get_level(irqn_l3)); - - /** - * - irq_from_level_2() - */ - zassert_equal(irq_from_level_2(irqn_l3), raw_l2); - /** * - irq_from_level_3() * - irq_to_level_3() @@ -99,24 +56,32 @@ ZTEST(interrupt_feature, test_multi_level_api_l3) * - irq_parent_level() */ zassert_equal(irq_from_level(irqn_l3, 2), raw_l2); + zassert_equal(irq_from_level(irqn_l2, 2), raw_l2); zassert_equal(irq_from_level(irqn_l3, 3), raw_l3); + zassert_equal(irq_to_level(raw_l2, 2) & irqn_l2, irq_to_level(raw_l2, 2)); zassert_equal(irq_to_level(raw_l3, 3) & irqn_l3, irq_to_level(raw_l3, 3)); + zassert_equal(irq_parent_level(irqn_l2, 2), raw_l1); zassert_equal(irq_parent_level(irqn_l3, 3), raw_l2); /** * - irq_get_intc_irq() */ zassert_equal(irq_get_intc_irq(irqn_l3), irqn_l2); + zassert_equal(irq_get_intc_irq(irqn_l2), irqn_l1); + zassert_equal(irq_get_intc_irq(irqn_l1), irqn_l1); const uint32_t irqn_l3_inc = DT_IRQN(DT_NODELABEL(test_l3_irq_inc)); + const uint32_t irqn_l2_inc = DT_IRQN(DT_NODELABEL(test_l2_irq_inc)); + const uint32_t irqn_l1_inc = DT_IRQN(DT_NODELABEL(test_l1_irq_inc)); /** * - irq_increment() */ + zassert_equal(irq_increment(irqn_l1, 1), irqn_l1_inc); + zassert_equal(irq_increment(irqn_l2, 2), irqn_l2_inc); zassert_equal(irq_increment(irqn_l3, 3), irqn_l3_inc); } -#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */ ZTEST_SUITE(gen_isr_table_multilevel, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/kernel/interrupt/testcase.yaml b/tests/kernel/interrupt/testcase.yaml index ec4afb7ab9361..1ed995c0baa18 100644 --- a/tests/kernel/interrupt/testcase.yaml +++ b/tests/kernel/interrupt/testcase.yaml @@ -85,11 +85,3 @@ tests: - EXTRA_DTC_OVERLAY_FILE="multilevel_irq.overlay" extra_configs: - CONFIG_TEST_MULTILEVEL_IRQ=y - arch.interrupt.multilevel_l3: - filter: CONFIG_MULTI_LEVEL_INTERRUPTS - extra_args: - - EXTRA_DTC_OVERLAY_FILE="multilevel_irq.overlay" - extra_configs: - - CONFIG_TEST_MULTILEVEL_IRQ=y - - CONFIG_3RD_LEVEL_INTERRUPTS=y - - CONFIG_3RD_LEVEL_INTERRUPT_BITS=11 From c968d4eb818594489a20bd30e55ede89cc2cdd53 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 3 Aug 2024 21:00:04 +0900 Subject: [PATCH 2859/4482] soc: renesas: ra: ra4m1: Migrate to FSP-based configuration Change to use FSP to integrate with other Renesas RA series. Signed-off-by: TOKITA Hiroshi --- soc/renesas/ra/common/ra_common_soc.h | 20 ----- soc/renesas/ra/ra4m1/CMakeLists.txt | 9 +- soc/renesas/ra/ra4m1/Kconfig | 11 ++- soc/renesas/ra/ra4m1/Kconfig.soc | 2 +- soc/renesas/ra/ra4m1/data_sections.ld | 13 +++ soc/renesas/ra/ra4m1/ram_sections.ld | 12 +++ soc/renesas/ra/ra4m1/rom_start.ld | 11 +++ soc/renesas/ra/ra4m1/sections.ld | 116 ++++++++++++++++++++++++++ soc/renesas/ra/ra4m1/soc.c | 39 +++++++++ soc/renesas/ra/ra4m1/soc.h | 11 ++- 10 files changed, 216 insertions(+), 28 deletions(-) delete mode 100644 soc/renesas/ra/common/ra_common_soc.h create mode 100644 soc/renesas/ra/ra4m1/data_sections.ld create mode 100644 soc/renesas/ra/ra4m1/ram_sections.ld create mode 100644 soc/renesas/ra/ra4m1/rom_start.ld create mode 100644 soc/renesas/ra/ra4m1/sections.ld diff --git a/soc/renesas/ra/common/ra_common_soc.h b/soc/renesas/ra/common/ra_common_soc.h deleted file mode 100644 index f76c4c26fc0d4..0000000000000 --- a/soc/renesas/ra/common/ra_common_soc.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2023 TOKITA Hiroshi - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_SOC_ARM_RENESAS_RA_COMMON_RA_COMMON_SOC_H_ -#define ZEPHYR_SOC_ARM_RENESAS_RA_COMMON_RA_COMMON_SOC_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#ifdef __cplusplus -} -#endif - -#endif /* ZEPHYR_SOC_ARM_RENESAS_RA_COMMON_RA_COMMON_SOC_H_ */ diff --git a/soc/renesas/ra/ra4m1/CMakeLists.txt b/soc/renesas/ra/ra4m1/CMakeLists.txt index 00cdd96aa1876..a64de7c09137e 100644 --- a/soc/renesas/ra/ra4m1/CMakeLists.txt +++ b/soc/renesas/ra/ra4m1/CMakeLists.txt @@ -3,13 +3,16 @@ zephyr_include_directories(.) -zephyr_library_sources_ifdef(CONFIG_SOC_OPTION_SETTING_MEMORY - soc.c -) +zephyr_library_sources(soc.c) zephyr_linker_sources_ifdef(CONFIG_SOC_OPTION_SETTING_MEMORY ROM_START ${CMAKE_CURRENT_SOURCE_DIR}/opt_set_mem.ld ) +zephyr_linker_sources(SECTIONS sections.ld) +zephyr_linker_sources(DATA_SECTIONS data_sections.ld) +zephyr_linker_sources(RAM_SECTIONS ram_sections.ld) +zephyr_linker_sources(ROM_START rom_start.ld) + set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") diff --git a/soc/renesas/ra/ra4m1/Kconfig b/soc/renesas/ra/ra4m1/Kconfig index 9096855e987b6..798725677bbd9 100644 --- a/soc/renesas/ra/ra4m1/Kconfig +++ b/soc/renesas/ra/ra4m1/Kconfig @@ -5,10 +5,15 @@ config SOC_SERIES_RA4M1 select ARM select CPU_CORTEX_M4 select CPU_HAS_ARM_MPU - select CPU_CORTEX_M_HAS_SYSTICK - select DYNAMIC_INTERRUPTS - select TIMER_READS_ITS_FREQUENCY_AT_RUNTIME + select HAS_RENESAS_RA_FSP + select CLOCK_CONTROL_RENESAS_RA_CGC if CLOCK_CONTROL + select CPU_CORTEX_M_HAS_DWT + select CPU_HAS_FPU + select FPU + select HAS_SWO select XIP + select SOC_EARLY_INIT_HOOK + select DYNAMIC_INTERRUPTS if SOC_SERIES_RA4M1 diff --git a/soc/renesas/ra/ra4m1/Kconfig.soc b/soc/renesas/ra/ra4m1/Kconfig.soc index e83c7bf3629ab..cb3cbe60a8f58 100644 --- a/soc/renesas/ra/ra4m1/Kconfig.soc +++ b/soc/renesas/ra/ra4m1/Kconfig.soc @@ -5,7 +5,7 @@ config SOC_SERIES_RA4M1 bool select SOC_FAMILY_RENESAS_RA help - Renesas RA4M1 + Renesas RA4M1 series config SOC_R7FA4M1AB3CFM bool diff --git a/soc/renesas/ra/ra4m1/data_sections.ld b/soc/renesas/ra/ra4m1/data_sections.ld new file mode 100644 index 0000000000000..84cb7c088e838 --- /dev/null +++ b/soc/renesas/ra/ra4m1/data_sections.ld @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +.code_in_ram : +{ + . = ALIGN(4); + __Code_In_RAM_Start = .; + KEEP(*(.code_in_ram*)) + __Code_In_RAM_End = .; +} > RAMABLE_REGION diff --git a/soc/renesas/ra/ra4m1/ram_sections.ld b/soc/renesas/ra/ra4m1/ram_sections.ld new file mode 100644 index 0000000000000..46ad2cc8b9339 --- /dev/null +++ b/soc/renesas/ra/ra4m1/ram_sections.ld @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +SECTION_DATA_PROLOGUE(.fsp_dtc_vector_table,(NOLOAD),) +{ + /* If DTC is used, put the DTC vector table at the start of SRAM. + This avoids memory holes due to 1K alignment required by it. */ + *(.fsp_dtc_vector_table) +} GROUP_DATA_LINK_IN(RAMABLE_REGION, RAMABLE_REGION) diff --git a/soc/renesas/ra/ra4m1/rom_start.ld b/soc/renesas/ra/ra4m1/rom_start.ld new file mode 100644 index 0000000000000..64eb3c891e043 --- /dev/null +++ b/soc/renesas/ra/ra4m1/rom_start.ld @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* ROM Registers start at address 0x00000400 */ +. = 0x400; +KEEP(*(.rom_registers*)) +/* Reserving 0x100 bytes of space for ROM registers. */ +. = 0x500; diff --git a/soc/renesas/ra/ra4m1/sections.ld b/soc/renesas/ra/ra4m1/sections.ld new file mode 100644 index 0000000000000..e3034adb244ea --- /dev/null +++ b/soc/renesas/ra/ra4m1/sections.ld @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#if DT_NODE_HAS_STATUS(DT_NODELABEL(id_code), okay) + +SECTION_PROLOGUE(.id_code,,) +{ + KEEP(*(.id_code*)) +} GROUP_LINK_IN(ID_CODE) + +#endif + +#if DT_NODE_HAS_STATUS(DT_NODELABEL(option_setting_ofs), okay) + +SECTION_PROLOGUE(.option_setting_ofs,,) +{ + __OPTION_SETTING_OFS_Start = .; + KEEP(*(.option_setting_ofs0)) + . = __OPTION_SETTING_OFS_Start + 0x04; + KEEP(*(.option_setting_ofs2)) + . = __OPTION_SETTING_OFS_Start + 0x10; + KEEP(*(.option_setting_dualsel)) + __OPTION_SETTING_OFS_End = .; +} GROUP_LINK_IN(OPTION_SETTING_OFS) = 0xFF + +#endif + +#if DT_NODE_HAS_STATUS(DT_NODELABEL(option_setting_sas), okay) + +SECTION_PROLOGUE(.option_setting_sas,,) +{ + __OPTION_SETTING_SAS_Start = .; + KEEP(*(.option_setting_sas)) + __OPTION_SETTING_SAS_End = .; +} GROUP_LINK_IN(OPTION_SETTING_SAS) = 0xFF + +#endif + +#if DT_NODE_HAS_STATUS(DT_NODELABEL(option_setting_ns), okay) + +SECTION_PROLOGUE(.option_setting_ns,,) +{ + __OPTION_SETTING_NS_Start = .; + KEEP(*(.option_setting_ofs1)) + . = __OPTION_SETTING_NS_Start + 0x04; + KEEP(*(.option_setting_ofs3)) + . = __OPTION_SETTING_NS_Start + 0x10; + KEEP(*(.option_setting_banksel)) + . = __OPTION_SETTING_NS_Start + 0x40; + KEEP(*(.option_setting_bps0)) + . = __OPTION_SETTING_NS_Start + 0x44; + KEEP(*(.option_setting_bps1)) + . = __OPTION_SETTING_NS_Start + 0x48; + KEEP(*(.option_setting_bps2)) + . = __OPTION_SETTING_NS_Start + 0x4C; + KEEP(*(.option_setting_bps3)) + . = __OPTION_SETTING_NS_Start + 0x60; + KEEP(*(.option_setting_pbps0)) + . = __OPTION_SETTING_NS_Start + 0x64; + KEEP(*(.option_setting_pbps1)) + . = __OPTION_SETTING_NS_Start + 0x68; + KEEP(*(.option_setting_pbps2)) + . = __OPTION_SETTING_NS_Start + 0x6C; + KEEP(*(.option_setting_pbps3)) + __OPTION_SETTING_NS_End = .; +} GROUP_LINK_IN(OPTION_SETTING) = 0xFF + +#endif + +#if DT_NODE_HAS_STATUS(DT_NODELABEL(option_setting_s), okay) + +SECTION_PROLOGUE(.option_setting_s,,) +{ + __OPTION_SETTING_S_Start = .; + KEEP(*(.option_setting_ofs1_sec)) + . = __OPTION_SETTING_S_Start + 0x04; + KEEP(*(.option_setting_ofs3_sec)) + . = __OPTION_SETTING_S_Start + 0x10; + KEEP(*(.option_setting_banksel_sec)) + . = __OPTION_SETTING_S_Start + 0x40; + KEEP(*(.option_setting_bps_sec0)) + . = __OPTION_SETTING_S_Start + 0x44; + KEEP(*(.option_setting_bps_sec1)) + . = __OPTION_SETTING_S_Start + 0x48; + KEEP(*(.option_setting_bps_sec2)) + . = __OPTION_SETTING_S_Start + 0x4C; + KEEP(*(.option_setting_bps_sec3)) + . = __OPTION_SETTING_S_Start + 0x60; + KEEP(*(.option_setting_pbps_sec0)) + . = __OPTION_SETTING_S_Start + 0x64; + KEEP(*(.option_setting_pbps_sec1)) + . = __OPTION_SETTING_S_Start + 0x68; + KEEP(*(.option_setting_pbps_sec2)) + . = __OPTION_SETTING_S_Start + 0x6C; + KEEP(*(.option_setting_pbps_sec3)) + . = __OPTION_SETTING_S_Start + 0x80; + KEEP(*(.option_setting_ofs1_sel)) + . = __OPTION_SETTING_S_Start + 0x84; + KEEP(*(.option_setting_ofs3_sel)) + . = __OPTION_SETTING_S_Start + 0x90; + KEEP(*(.option_setting_banksel_sel)) + . = __OPTION_SETTING_S_Start + 0xC0; + KEEP(*(.option_setting_bps_sel0)) + . = __OPTION_SETTING_S_Start + 0xC4; + KEEP(*(.option_setting_bps_sel1)) + . = __OPTION_SETTING_S_Start + 0xC8; + KEEP(*(.option_setting_bps_sel2)) + . = __OPTION_SETTING_S_Start + 0xCC; + KEEP(*(.option_setting_bps_sel3)) + __OPTION_SETTING_S_End = .; +} GROUP_LINK_IN(OPTION_SETTING_S) = 0xFF + +#endif diff --git a/soc/renesas/ra/ra4m1/soc.c b/soc/renesas/ra/ra4m1/soc.c index 7d8f27449141a..58b2a2fb76738 100644 --- a/soc/renesas/ra/ra4m1/soc.c +++ b/soc/renesas/ra/ra4m1/soc.c @@ -1,9 +1,27 @@ /* * Copyright (c) 2024 Ian Morris + * Copyright (c) 2024 TOKITA Hiroshi * * SPDX-License-Identifier: Apache-2.0 */ + +/** + * @file + * @brief System/hardware module for Renesas RA4M1 family processor + */ + +#include +#include #include +#include +#include +#include +#include +#include +LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); + +#include "bsp_cfg.h" +#include #define HOCO_FREQ DT_PROP(DT_PATH(clocks, hoco), clock_frequency) @@ -134,3 +152,24 @@ const struct opt_set_mem ops __attribute__((section(".opt_set_mem"))) = { } }; #endif + +uint32_t SystemCoreClock BSP_SECTION_EARLY_INIT; + +volatile uint32_t g_protect_pfswe_counter BSP_SECTION_EARLY_INIT; + +/** + * @brief Perform basic hardware initialization at boot. + * + * This needs to be run from the very beginning. + */ +void soc_early_init_hook(void) +{ + uint32_t key; + + key = irq_lock(); + + SystemCoreClock = BSP_MOCO_HZ; + g_protect_pfswe_counter = 0; + + irq_unlock(key); +} diff --git a/soc/renesas/ra/ra4m1/soc.h b/soc/renesas/ra/ra4m1/soc.h index 127ee9ab44477..0476e2ba816ac 100644 --- a/soc/renesas/ra/ra4m1/soc.h +++ b/soc/renesas/ra/ra4m1/soc.h @@ -4,4 +4,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "../common/ra_common_soc.h" +/** + * @file SoC configuration macros for the Renesas RA4M1 family MCU + */ + +#ifndef ZEPHYR_SOC_RENESAS_RA4M1_SOC_H_ +#define ZEPHYR_SOC_RENESAS_RA4M1_SOC_H_ + +#include + +#endif /* ZEPHYR_SOC_RENESAS_RA4M1_SOC_H_ */ From af2021ea4cf89148434946c605db4ed13b9e95bf Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Wed, 21 Aug 2024 23:12:51 +0900 Subject: [PATCH 2860/4482] soc: renesas: ra: ra4m1: Adapts the Option Setting Memory to FSP. Since the Option Setting Memory area is set in FSP, the Kconfig value switches between using the FSP implementation or the existing Option Setting Memory implementation. Signed-off-by: TOKITA Hiroshi --- soc/renesas/ra/ra4m1/CMakeLists.txt | 5 --- soc/renesas/ra/ra4m1/opt_set_mem.ld | 11 ----- soc/renesas/ra/ra4m1/soc.c | 63 ++++++++++++----------------- 3 files changed, 25 insertions(+), 54 deletions(-) delete mode 100644 soc/renesas/ra/ra4m1/opt_set_mem.ld diff --git a/soc/renesas/ra/ra4m1/CMakeLists.txt b/soc/renesas/ra/ra4m1/CMakeLists.txt index a64de7c09137e..e9637ecd9e69b 100644 --- a/soc/renesas/ra/ra4m1/CMakeLists.txt +++ b/soc/renesas/ra/ra4m1/CMakeLists.txt @@ -5,11 +5,6 @@ zephyr_include_directories(.) zephyr_library_sources(soc.c) -zephyr_linker_sources_ifdef(CONFIG_SOC_OPTION_SETTING_MEMORY - ROM_START - ${CMAKE_CURRENT_SOURCE_DIR}/opt_set_mem.ld -) - zephyr_linker_sources(SECTIONS sections.ld) zephyr_linker_sources(DATA_SECTIONS data_sections.ld) zephyr_linker_sources(RAM_SECTIONS ram_sections.ld) diff --git a/soc/renesas/ra/ra4m1/opt_set_mem.ld b/soc/renesas/ra/ra4m1/opt_set_mem.ld deleted file mode 100644 index c05238789af71..0000000000000 --- a/soc/renesas/ra/ra4m1/opt_set_mem.ld +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright (c) 2024 Ian Morris - * - * SPDX-License-Identifier: Apache-2.0 - * - */ - -. = 0x400; -FILL(0xFF) -KEEP(*(.opt_set_mem*)) -. = 0x500; diff --git a/soc/renesas/ra/ra4m1/soc.c b/soc/renesas/ra/ra4m1/soc.c index 58b2a2fb76738..06202352c518d 100644 --- a/soc/renesas/ra/ra4m1/soc.c +++ b/soc/renesas/ra/ra4m1/soc.c @@ -23,7 +23,7 @@ LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); #include "bsp_cfg.h" #include -#define HOCO_FREQ DT_PROP(DT_PATH(clocks, hoco), clock_frequency) +#define HOCO_FREQ DT_PROP(DT_PATH(clocks, clock_hoco), clock_frequency) #if HOCO_FREQ == MHZ(24) #define OFS1_HOCO_FREQ 0 @@ -93,43 +93,31 @@ struct opt_set_mem { }; #ifdef CONFIG_SOC_OPTION_SETTING_MEMORY -const struct opt_set_mem ops __attribute__((section(".opt_set_mem"))) = { +const struct opt_set_mem ops __attribute__((section(".rom_registers"))) = { .ofs0 = { - /* - * Initial settings for watchdog timers. Set all fields to 1, - * disabling watchdog functionality as config options have not - * yet been implemented. - */ - .RSVD1 = 0x1, - .IWDTSTRT = 0x1, /* Disable independent watchdog timer */ - .IWDTTOPS = 0x3, - .IWDTCKS = 0xf, - .IWDTRPES = 0x3, - .IWDTRPSS = 0x3, - .IWDTRSTIRQS = 0x1, - .RSVD2 = 0x1, - .IWDTSTPCTL = 0x1, - .RSVD3 = 0x3, - .WDTSTRT = 0x1, /* Stop watchdog timer following reset */ - .WDTTOPS = 0x3, - .WDTCKS = 0xf, - .WDTRPES = 0x3, - .WDTRPSS = 0x3, - .WDTRSTIRQS = 0x1, - .RSVD4 = 0x1, - .WDTSTPCTL = 0x1, - .RSVD5 = 0x1, - }, + /* + * Initial settings for watchdog timers. Set all fields to 1, + * disabling watchdog functionality as config options have not + * yet been implemented. + */ + .RSVD1 = 0x1, .IWDTSTRT = 0x1, /* Disable independent watchdog timer + */ + .IWDTTOPS = 0x3, .IWDTCKS = 0xf, .IWDTRPES = 0x3, .IWDTRPSS = 0x3, + .IWDTRSTIRQS = 0x1, .RSVD2 = 0x1, .IWDTSTPCTL = 0x1, .RSVD3 = 0x3, + .WDTSTRT = 0x1, /* Stop watchdog timer following reset */ + .WDTTOPS = 0x3, .WDTCKS = 0xf, .WDTRPES = 0x3, .WDTRPSS = 0x3, + .WDTRSTIRQS = 0x1, .RSVD4 = 0x1, .WDTSTPCTL = 0x1, .RSVD5 = 0x1, + }, .ofs1 = { - .RSVD1 = 0x3, - .LVDAS = 0x1, /* Disable voltage monitor 0 following reset */ - .VDSEL1 = 0x3, - .RSVD2 = 0x3, - .HOCOEN = !DT_NODE_HAS_STATUS_OKAY(DT_PATH(clocks, hoco)), - .RSVD3 = 0x7, - .HOCOFRQ1 = OFS1_HOCO_FREQ, - .RSVD4 = 0x1ffff, - }, + .RSVD1 = 0x3, + .LVDAS = 0x1, /* Disable voltage monitor 0 following reset */ + .VDSEL1 = 0x3, + .RSVD2 = 0x3, + .HOCOEN = !DT_NODE_HAS_STATUS(DT_PATH(clocks, clock_hoco), okay), + .RSVD3 = 0x7, + .HOCOFRQ1 = OFS1_HOCO_FREQ, + .RSVD4 = 0x1ffff, + }, .mpu = { /* * Initial settings for MPU. Set all areas to maximum values @@ -149,8 +137,7 @@ const struct opt_set_mem ops __attribute__((section(".opt_set_mem"))) = { .SECMPUS3 = 0x40dffffc, .SECMPUE3 = 0x40dfffff, .SECMPUAC = 0xffffffff, - } -}; + }}; #endif uint32_t SystemCoreClock BSP_SECTION_EARLY_INIT; From 397c48a13e92cac8daaa7d1cd463b60e401eb13b Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Wed, 7 Aug 2024 20:01:52 +0900 Subject: [PATCH 2861/4482] dts: arm: renesas: ra4: Use renesas,ra-pinctrl-pfs driver Switch the pinctrl driver to renesas,ra-pinctrl-pfs which can be used with FSP. Signed-off-by: TOKITA Hiroshi --- drivers/gpio/gpio_renesas_ra.c | 26 ++++++++++++------------- drivers/pinctrl/renesas/ra/pinctrl_ra.c | 13 +++++++++++++ dts/arm/renesas/ra/ra-cm4-common.dtsi | 2 +- soc/renesas/ra/common_fsp/pinctrl_soc.h | 4 ++++ 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/drivers/gpio/gpio_renesas_ra.c b/drivers/gpio/gpio_renesas_ra.c index 9f4fe59c83b1f..8da6f593e667c 100644 --- a/drivers/gpio/gpio_renesas_ra.c +++ b/drivers/gpio/gpio_renesas_ra.c @@ -144,7 +144,7 @@ static int gpio_ra_pin_configure(const struct device *dev, gpio_pin_t pin, gpio_ const enum gpio_int_trig trig = flags & (GPIO_INT_LOW_0 | GPIO_INT_HIGH_1); const struct gpio_ra_config *config = dev->config; struct gpio_ra_data *data = dev->data; - struct pinctrl_ra_pin pincfg = {0}; + struct ra_pinctrl_soc_pin pincfg = {0}; if ((flags & GPIO_OUTPUT) && (flags & GPIO_INPUT)) { /* Pin cannot be configured as input and output */ @@ -155,25 +155,25 @@ static int gpio_ra_pin_configure(const struct device *dev, gpio_pin_t pin, gpio_ } if (flags & GPIO_OUTPUT) { - pincfg.config |= BIT(PmnPFS_PDR_POS); + pincfg.cfg |= BIT(R_PFS_PORT_PIN_PmnPFS_PDR_Pos); } if (flags & GPIO_PULL_UP) { - pincfg.config |= BIT(PmnPFS_PCR_POS); + pincfg.cfg |= BIT(R_PFS_PORT_PIN_PmnPFS_PCR_Pos); } if ((flags & GPIO_SINGLE_ENDED) && (flags & GPIO_LINE_OPEN_DRAIN)) { - pincfg.config |= BIT(PmnPFS_NCODR_POS); + pincfg.cfg |= BIT(R_PFS_PORT_PIN_PmnPFS_NCODR_Pos); } if (flags & GPIO_INT_ENABLE) { - pincfg.config |= BIT(PmnPFS_ISEL_POS); + pincfg.cfg |= BIT(R_PFS_PORT_PIN_PmnPFS_ISEL_Pos); } - pincfg.config &= ~BIT(PmnPFS_PMR_POS); + pincfg.cfg &= ~BIT(R_PFS_PORT_PIN_PmnPFS_PMR_Pos); - pincfg.pin = pin; - pincfg.port = config->port; + pincfg.pin_num = pin; + pincfg.port_num = config->port; if (flags & GPIO_INT_ENABLE) { const struct gpio_ra_irq_info *irq_info; @@ -230,7 +230,7 @@ static int gpio_ra_pin_get_config(const struct device *dev, gpio_pin_t pin, gpio { const struct gpio_ra_config *config = dev->config; const struct gpio_ra_irq_info *irq_info; - struct pinctrl_ra_pin pincfg; + struct ra_pinctrl_soc_pin pincfg; ra_isr_handler cb; const void *cbarg; uint32_t intcfg; @@ -239,22 +239,22 @@ static int gpio_ra_pin_get_config(const struct device *dev, gpio_pin_t pin, gpio memset(flags, 0, sizeof(gpio_flags_t)); - err = pinctrl_ra_query_config(config->port, pin, &pincfg); + err = ra_pinctrl_query_config(config->port, pin, &pincfg); if (err < 0) { return err; } - if (pincfg.config & BIT(PmnPFS_PDR_POS)) { + if (pincfg.cfg & BIT(R_PFS_PORT_PIN_PmnPFS_PDR_Pos)) { *flags |= GPIO_OUTPUT; } else { *flags |= GPIO_INPUT; } - if (pincfg.config & BIT(PmnPFS_ISEL_POS)) { + if (pincfg.cfg & BIT(R_PFS_PORT_PIN_PmnPFS_ISEL_Pos)) { *flags |= GPIO_INT_ENABLE; } - if (pincfg.config & BIT(PmnPFS_PCR_POS)) { + if (pincfg.cfg & BIT(R_PFS_PORT_PIN_PmnPFS_PCR_Pos)) { *flags |= GPIO_PULL_UP; } diff --git a/drivers/pinctrl/renesas/ra/pinctrl_ra.c b/drivers/pinctrl/renesas/ra/pinctrl_ra.c index efaac2f34f740..0f2bc85bd6005 100644 --- a/drivers/pinctrl/renesas/ra/pinctrl_ra.c +++ b/drivers/pinctrl/renesas/ra/pinctrl_ra.c @@ -26,3 +26,16 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintp return 0; } + +int ra_pinctrl_query_config(uint32_t port, uint32_t pin, pinctrl_soc_pin_t *pincfg) +{ + if (port >= RA_PINCTRL_PORT_NUM || pin >= RA_PINCTRL_PIN_NUM) { + return -EINVAL; + } + + pincfg->port_num = port; + pincfg->pin_num = pin; + + pincfg->cfg = R_PFS->PORT[port].PIN[pin].PmnPFS; + return 0; +} diff --git a/dts/arm/renesas/ra/ra-cm4-common.dtsi b/dts/arm/renesas/ra/ra-cm4-common.dtsi index 4ef18141e6c44..88fe55932b048 100644 --- a/dts/arm/renesas/ra/ra-cm4-common.dtsi +++ b/dts/arm/renesas/ra/ra-cm4-common.dtsi @@ -240,7 +240,7 @@ }; pinctrl: pinctrl@40040800 { - compatible = "renesas,ra-pinctrl"; + compatible = "renesas,ra-pinctrl-pfs"; reg = <0x40040800 0x500 0x40040d03 0x1>; reg-names = "pfs", "pmisc_pwpr"; status = "okay"; diff --git a/soc/renesas/ra/common_fsp/pinctrl_soc.h b/soc/renesas/ra/common_fsp/pinctrl_soc.h index 0df9ec39111cb..dc08dc3db10f5 100644 --- a/soc/renesas/ra/common_fsp/pinctrl_soc.h +++ b/soc/renesas/ra/common_fsp/pinctrl_soc.h @@ -12,6 +12,8 @@ #include +#define RA_PINCTRL_PORT_NUM ARRAY_SIZE(((R_PFS_Type *)0)->PORT) +#define RA_PINCTRL_PIN_NUM ARRAY_SIZE(((R_PFS_PORT_Type *)0)->PIN) /** * @brief Type to hold a renesas ra pin's pinctrl configuration. */ @@ -26,6 +28,8 @@ struct ra_pinctrl_soc_pin { typedef struct ra_pinctrl_soc_pin pinctrl_soc_pin_t; +int ra_pinctrl_query_config(uint32_t port, uint32_t pin, pinctrl_soc_pin_t *pincfg); + /** * @brief Utility macro to initialize each pin. * From 183273ed3f48c5f3fdf98a92af51a5d827431416 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Wed, 21 Aug 2024 19:14:20 +0900 Subject: [PATCH 2862/4482] dts: arm: renesas: ra4: Use renesas,ra-cgc-pclkblock driver Switch the clock controller driver to renesas,ra-cgc-pclkblock which can be used with FSP. Signed-off-by: TOKITA Hiroshi --- drivers/serial/uart_renesas_ra.c | 19 +++-- dts/arm/renesas/ra/r7fa4m1ab3cfm.dtsi | 1 - dts/arm/renesas/ra/ra-cm4-common.dtsi | 104 ++++++++++++++++++------- dts/arm/renesas/ra/ra4-cm4-common.dtsi | 2 +- 4 files changed, 88 insertions(+), 38 deletions(-) diff --git a/drivers/serial/uart_renesas_ra.c b/drivers/serial/uart_renesas_ra.c index 81f6c567c84cd..269a26a59f515 100644 --- a/drivers/serial/uart_renesas_ra.c +++ b/drivers/serial/uart_renesas_ra.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -27,7 +28,7 @@ enum { struct uart_ra_cfg { mem_addr_t regs; const struct device *clock_dev; - clock_control_subsys_t clock_id; + const struct clock_control_ra_subsys_cfg clock_id; const struct pinctrl_dev_config *pcfg; #ifdef CONFIG_UART_INTERRUPT_DRIVEN int (*irq_config_func)(const struct device *dev); @@ -389,12 +390,13 @@ static int uart_ra_init(const struct device *dev) return -ENODEV; } - ret = clock_control_on(config->clock_dev, config->clock_id); + ret = clock_control_on(config->clock_dev, (clock_control_subsys_t)&config->clock_id); if (ret < 0) { return ret; } - ret = clock_control_get_rate(config->clock_dev, config->clock_id, &data->clk_rate); + ret = clock_control_get_rate(config->clock_dev, (clock_control_subsys_t)&config->clock_id, + &data->clk_rate); if (ret < 0) { return ret; } @@ -659,12 +661,13 @@ static const struct uart_driver_api uart_ra_driver_api = { .regs = DT_REG_ADDR(DT_INST_PARENT(n)), \ .clock_dev = DEVICE_DT_GET(DT_CLOCKS_CTLR(DT_INST_PARENT(n))), \ .clock_id = \ - (clock_control_subsys_t)DT_CLOCKS_CELL_BY_IDX(DT_INST_PARENT(n), 0, id), \ + { \ + .mstp = DT_CLOCKS_CELL_BY_IDX(DT_INST_PARENT(n), 0, mstp), \ + .stop_bit = DT_CLOCKS_CELL_BY_IDX(DT_INST_PARENT(n), 0, stop_bit), \ + }, \ .pcfg = PINCTRL_DT_DEV_CONFIG_GET(DT_INST_PARENT(n)), \ - IF_ENABLED(CONFIG_UART_INTERRUPT_DRIVEN, ( \ - .irq_config_func = irq_config_func_##n, \ - )) \ - } + IF_ENABLED(CONFIG_UART_INTERRUPT_DRIVEN, \ + (.irq_config_func = irq_config_func_##n,))} #ifdef CONFIG_UART_INTERRUPT_DRIVEN diff --git a/dts/arm/renesas/ra/r7fa4m1ab3cfm.dtsi b/dts/arm/renesas/ra/r7fa4m1ab3cfm.dtsi index 4836a58a0afe6..8a1702d785afc 100644 --- a/dts/arm/renesas/ra/r7fa4m1ab3cfm.dtsi +++ b/dts/arm/renesas/ra/r7fa4m1ab3cfm.dtsi @@ -8,5 +8,4 @@ #define RA_SOC_HAS_MSTPCRE 1 #define RA_SOC_MSTPD5_CHANNELS 1 -#include #include diff --git a/dts/arm/renesas/ra/ra-cm4-common.dtsi b/dts/arm/renesas/ra/ra-cm4-common.dtsi index 88fe55932b048..8be1fc555618c 100644 --- a/dts/arm/renesas/ra/ra-cm4-common.dtsi +++ b/dts/arm/renesas/ra/ra-cm4-common.dtsi @@ -8,6 +8,7 @@ #include #include #include +#include / { cpus { @@ -21,36 +22,36 @@ }; }; - clocks { - mosc: mosc { - compatible = "fixed-clock"; + clocks: clocks { + xtal: clock-main-osc { + compatible = "renesas,ra-cgc-external-clock"; clock-frequency = <1200000>; status = "disabled"; #clock-cells = <0>; }; - sosc: sosc { - compatible = "fixed-clock"; + subclk: clock-subclk { + compatible = "renesas,ra-cgc-subclk"; clock-frequency = <32768>; status = "disabled"; #clock-cells = <0>; }; - hoco: hoco { + hoco: clock-hoco { compatible = "fixed-clock"; clock-frequency = <24000000>; status = "okay"; #clock-cells = <0>; }; - moco: moco { + moco: clock-moco { compatible = "fixed-clock"; clock-frequency = <8000000>; status = "okay"; #clock-cells = <0>; }; - loco: loco { + loco: clock-loco { compatible = "fixed-clock"; clock-frequency = <32768>; status = "okay"; @@ -58,12 +59,14 @@ }; pll: pll { - compatible = "fixed-factor-clock"; - status = "disabled"; - clocks = <&mosc>; - clock-div = <2>; - clock-mult = <8>; + compatible = "renesas,ra-cgc-pll"; #clock-cells = <0>; + + /* PLL */ + clocks = <&xtal>; + div = <2>; + mul = <8 0>; + status = "disabled"; }; }; @@ -82,19 +85,64 @@ #interrupt-cells = <3>; }; - cgc: cgc@4001e000 { - compatible = "renesas,ra-clock-generation-circuit"; - reg = <0x4001e000 0x40 0x40047000 0x10>; - reg-names = "system", "mstp"; - #clock-cells = <1>; + pclkblock: pclkblock@4001e01c { + compatible = "renesas,ra-cgc-pclk-block"; + reg = <0x4001e01c 4>, <0x40047000 4>, <0x40047004 4>, + <0x40047008 4>; + reg-names = "MSTPA", "MSTPB","MSTPC", + "MSTPD"; + compatible = "renesas,ra-cgc-pclk-block"; + #clock-cells = <0>; + clocks = <&moco>; + status = "okay"; + + iclk: iclk { + compatible = "renesas,ra-cgc-pclk"; + div = <16>; + #clock-cells = <2>; + status = "okay"; + }; + + pclka: pclka { + compatible = "renesas,ra-cgc-pclk"; + div = <16>; + #clock-cells = <2>; + status = "okay"; + }; + + pclkb: pclkb { + compatible = "renesas,ra-cgc-pclk"; + div = <16>; + #clock-cells = <2>; + status = "okay"; + }; - clock-source = <&moco>; - iclk-div = <16>; - pclka-div = <16>; - pclkb-div = <16>; - pclkc-div = <16>; - pclkd-div = <16>; - fclk-div = <16>; + pclkc: pclkc { + compatible = "renesas,ra-cgc-pclk"; + div = <1>; + #clock-cells = <2>; + status = "okay"; + }; + + pclkd: pclkd { + compatible = "renesas,ra-cgc-pclk"; + div = <16>; + #clock-cells = <2>; + status = "okay"; + }; + + fclk: fclk { + compatible = "renesas,ra-cgc-pclk"; + div = <16>; + #clock-cells = <2>; + status = "okay"; + }; + + clkout: clkout { + compatible = "renesas,ra-cgc-pclk"; + #clock-cells = <2>; + status = "disabled"; + }; }; fcu: flash-controller@4001c000 { @@ -256,7 +304,7 @@ , ; interrupt-names = "rxi", "txi", "tei", "eri", "am", "rxi-or-eri"; - clocks = <&cgc RA_CLOCK_SCI(0)>; + clocks = <&pclka MSTPB 31>; #clock-cells = <1>; status = "disabled"; uart { @@ -274,7 +322,7 @@ , ; interrupt-names = "rxi", "txi", "tei", "eri", "am"; - clocks = <&cgc RA_CLOCK_SCI(1)>; + clocks = <&pclka MSTPB 30>; #clock-cells = <1>; status = "disabled"; uart { @@ -292,7 +340,7 @@ , ; interrupt-names = "rxi", "txi", "tei", "eri", "am"; - clocks = <&cgc RA_CLOCK_SCI(9)>; + clocks = <&pclka MSTPB 22>; #clock-cells = <1>; status = "disabled"; uart { diff --git a/dts/arm/renesas/ra/ra4-cm4-common.dtsi b/dts/arm/renesas/ra/ra4-cm4-common.dtsi index 1d2397f85dec1..e49b9bc766e2d 100644 --- a/dts/arm/renesas/ra/ra4-cm4-common.dtsi +++ b/dts/arm/renesas/ra/ra4-cm4-common.dtsi @@ -53,7 +53,7 @@ , ; interrupt-names = "rxi", "txi", "tei", "eri", "am"; - clocks = <&cgc RA_CLOCK_SCI(2)>; + clocks = <&pclka MSTPB 29>; #clock-cells = <1>; status = "disabled"; uart { From 6376ee15be12bbf6f365ef606519b9691d29657f Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Wed, 21 Aug 2024 23:59:20 +0900 Subject: [PATCH 2863/4482] boards: mikroe: clicker_ra4m1: Migrate to FSP Update configuration for migrate to FSP Signed-off-by: TOKITA Hiroshi --- .../clicker_ra4m1/mikroe_clicker_ra4m1.dts | 45 ++++++++++++++----- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/boards/mikroe/clicker_ra4m1/mikroe_clicker_ra4m1.dts b/boards/mikroe/clicker_ra4m1/mikroe_clicker_ra4m1.dts index b15242c5fea89..cd71c38f14c02 100644 --- a/boards/mikroe/clicker_ra4m1/mikroe_clicker_ra4m1.dts +++ b/boards/mikroe/clicker_ra4m1/mikroe_clicker_ra4m1.dts @@ -6,9 +6,9 @@ /dts-v1/; #include -#include #include #include +#include / { model = "Mikroe Clicker RA4M1"; @@ -52,7 +52,12 @@ &pinctrl { sci0_default: sci0_default { group1 { - pinmux = , ; + /* tx */ + psels = ; + }; + group2 { + /* rx */ + psels = ; }; }; }; @@ -79,17 +84,35 @@ status = "okay"; }; -&mosc { +&xtal { status = "okay"; clock-frequency = <12000000>; }; -&cgc { - clock-source = <&mosc>; - iclk-div = <1>; - pclka-div = <1>; - pclkb-div = <2>; - pclkc-div = <1>; - pclkd-div = <1>; - fclk-div = <2>; +&pclkblock { + clocks = <&xtal>; +}; + +&iclk { + div = <1>; +}; + +&pclka { + div = <1>; +}; + +&pclkb { + div = <2>; +}; + +&pclkc { + div = <1>; +}; + +&pclkd { + div = <1>; +}; + +&fclk { + div = <2>; }; From ffe6099fed345534bf6ea70e6f166da0180f68d6 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Thu, 22 Aug 2024 00:32:35 +0900 Subject: [PATCH 2864/4482] boards: arduino: uno_r4: Migrate to FSP Update configuration for migrate to FSP Signed-off-by: TOKITA Hiroshi --- .../arduino/uno_r4/arduino_uno_r4_common.dtsi | 34 ++++++++++++++----- .../uno_r4/arduino_uno_r4_minima-pinctrl.dtsi | 10 ++++-- .../uno_r4/arduino_uno_r4_wifi-pinctrl.dtsi | 10 ++++-- 3 files changed, 42 insertions(+), 12 deletions(-) diff --git a/boards/arduino/uno_r4/arduino_uno_r4_common.dtsi b/boards/arduino/uno_r4/arduino_uno_r4_common.dtsi index 6a81cec8b7d58..f9fff37eaabfa 100644 --- a/boards/arduino/uno_r4/arduino_uno_r4_common.dtsi +++ b/boards/arduino/uno_r4/arduino_uno_r4_common.dtsi @@ -64,12 +64,30 @@ clock-frequency = <48000000>; }; -&cgc { - clock-source = <&hoco>; - iclk-div = <1>; - pclka-div = <1>; - pclkb-div = <2>; - pclkc-div = <1>; - pclkd-div = <1>; - fclk-div = <2>; +&pclkblock { + clocks = <&hoco>; +}; + +&iclk { + div = <1>; +}; + +&pclka { + div = <1>; +}; + +&pclkb { + div = <2>; +}; + +&pclkc { + div = <1>; +}; + +&pclkd { + div = <1>; +}; + +&fclk { + div = <2>; }; diff --git a/boards/arduino/uno_r4/arduino_uno_r4_minima-pinctrl.dtsi b/boards/arduino/uno_r4/arduino_uno_r4_minima-pinctrl.dtsi index c9538829a480b..863d9e6030af4 100644 --- a/boards/arduino/uno_r4/arduino_uno_r4_minima-pinctrl.dtsi +++ b/boards/arduino/uno_r4/arduino_uno_r4_minima-pinctrl.dtsi @@ -4,12 +4,18 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include +#include &pinctrl { sci2_default: sci2_default { group1 { - pinmux = , ; + /* tx */ + psels = ; + drive-strength = "medium"; + }; + group2 { + /* rx */ + psels = ; }; }; }; diff --git a/boards/arduino/uno_r4/arduino_uno_r4_wifi-pinctrl.dtsi b/boards/arduino/uno_r4/arduino_uno_r4_wifi-pinctrl.dtsi index 093d4e4cdf989..9add47e472363 100644 --- a/boards/arduino/uno_r4/arduino_uno_r4_wifi-pinctrl.dtsi +++ b/boards/arduino/uno_r4/arduino_uno_r4_wifi-pinctrl.dtsi @@ -4,12 +4,18 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include +#include &pinctrl { sci2_default: sci2_default { group1 { - pinmux = , ; + /* tx */ + psels = ; + drive-strength = "medium"; + }; + group2 { + /* rx */ + psels = ; }; }; }; From 8fe5544948612d204276260f94dd38271635f538 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Wed, 9 Oct 2024 22:25:13 +0900 Subject: [PATCH 2865/4482] boards: arduino: uno_r4: remove CONFIG_PINCTRL from defconfig of uno_r4 This PR fixes #78619 for the Arduino UNO R4 Minima/Wifi board. Signed-off-by: TOKITA Hiroshi --- boards/arduino/uno_r4/arduino_uno_r4_minima_defconfig | 2 -- boards/arduino/uno_r4/arduino_uno_r4_wifi_defconfig | 2 -- drivers/gpio/Kconfig.renesas_ra | 1 + 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/boards/arduino/uno_r4/arduino_uno_r4_minima_defconfig b/boards/arduino/uno_r4/arduino_uno_r4_minima_defconfig index bcd05338d4445..3c655ea376e89 100644 --- a/boards/arduino/uno_r4/arduino_uno_r4_minima_defconfig +++ b/boards/arduino/uno_r4/arduino_uno_r4_minima_defconfig @@ -16,8 +16,6 @@ CONFIG_UART_CONSOLE=y # Enable GPIO CONFIG_GPIO=y -CONFIG_PINCTRL=y - CONFIG_CLOCK_CONTROL=y CONFIG_USE_DT_CODE_PARTITION=y diff --git a/boards/arduino/uno_r4/arduino_uno_r4_wifi_defconfig b/boards/arduino/uno_r4/arduino_uno_r4_wifi_defconfig index 76f5a5fb85446..48137e86d7ac2 100644 --- a/boards/arduino/uno_r4/arduino_uno_r4_wifi_defconfig +++ b/boards/arduino/uno_r4/arduino_uno_r4_wifi_defconfig @@ -16,8 +16,6 @@ CONFIG_UART_CONSOLE=y # Enable GPIO CONFIG_GPIO=y -CONFIG_PINCTRL=y - CONFIG_CLOCK_CONTROL=y CONFIG_USE_DT_CODE_PARTITION=y diff --git a/drivers/gpio/Kconfig.renesas_ra b/drivers/gpio/Kconfig.renesas_ra index bd6f536ee80f1..2f6fb3c38c44e 100644 --- a/drivers/gpio/Kconfig.renesas_ra +++ b/drivers/gpio/Kconfig.renesas_ra @@ -5,6 +5,7 @@ config GPIO_RENESAS_RA bool "Renesas RA Series GPIO driver" default y select GPIO_GET_CONFIG + select PINCTRL depends on DT_HAS_RENESAS_RA_GPIO_ENABLED help Enable Renesas RA series GPIO driver. From f0219c35daedef7878a73c508c053e4bec636d82 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Wed, 7 Aug 2024 20:03:24 +0900 Subject: [PATCH 2866/4482] drivers: pinctrl: Remove renesas,ra-pinctrl driver Remove the renesas,ra-pinctrl driver, which is no longer needed after migrating to the FSP-based implementation. Signed-off-by: TOKITA Hiroshi --- drivers/pinctrl/renesas/CMakeLists.txt | 1 - drivers/pinctrl/renesas/ra/Kconfig | 7 - .../pinctrl/renesas/ra/pinctrl_renesas_ra.c | 83 ---- dts/bindings/pinctrl/renesas,ra-pinctrl.yaml | 23 - .../pinctrl/renesas/pinctrl-r7fa4m1xxxxxx.h | 437 ------------------ soc/renesas/ra/common/pinctrl_ra.h | 94 ---- 6 files changed, 645 deletions(-) delete mode 100644 drivers/pinctrl/renesas/ra/pinctrl_renesas_ra.c delete mode 100644 dts/bindings/pinctrl/renesas,ra-pinctrl.yaml delete mode 100644 include/zephyr/dt-bindings/pinctrl/renesas/pinctrl-r7fa4m1xxxxxx.h delete mode 100644 soc/renesas/ra/common/pinctrl_ra.h diff --git a/drivers/pinctrl/renesas/CMakeLists.txt b/drivers/pinctrl/renesas/CMakeLists.txt index f53523415baf9..80e4c95ec14ea 100644 --- a/drivers/pinctrl/renesas/CMakeLists.txt +++ b/drivers/pinctrl/renesas/CMakeLists.txt @@ -2,7 +2,6 @@ # Copyright (c) 2024 Renesas Electronics Corporation # SPDX-License-Identifier: Apache-2.0 -zephyr_library_sources_ifdef(CONFIG_PINCTRL_RENESAS_RA ra/pinctrl_renesas_ra.c) zephyr_library_sources_ifdef(CONFIG_PINCTRL_RENESAS_RA_PFS ra/pinctrl_ra.c) zephyr_library_sources_ifdef(CONFIG_PINCTRL_RZT2M rz/pinctrl_rzt2m.c) zephyr_library_sources_ifdef(CONFIG_PINCTRL_SMARTBOND smartbond/pinctrl_smartbond.c) diff --git a/drivers/pinctrl/renesas/ra/Kconfig b/drivers/pinctrl/renesas/ra/Kconfig index 3ca03057982a8..4c0077d3b84f3 100644 --- a/drivers/pinctrl/renesas/ra/Kconfig +++ b/drivers/pinctrl/renesas/ra/Kconfig @@ -2,13 +2,6 @@ # Copyright (c) 2024 Renesas Electronics Corporation # SPDX-License-Identifier: Apache-2.0 -config PINCTRL_RENESAS_RA - bool "Renesas RA series pin controller driver" - default y - depends on DT_HAS_RENESAS_RA_PINCTRL_ENABLED - help - Enable Renesas RA series pin controller driver. - config PINCTRL_RENESAS_RA_PFS bool "Renesas RA pinctrl driver" default y diff --git a/drivers/pinctrl/renesas/ra/pinctrl_renesas_ra.c b/drivers/pinctrl/renesas/ra/pinctrl_renesas_ra.c deleted file mode 100644 index 89f8a41d51982..0000000000000 --- a/drivers/pinctrl/renesas/ra/pinctrl_renesas_ra.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2023 TOKITA Hiroshi - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -#define DT_DRV_COMPAT renesas_ra_pinctrl - -#define PORT_NUM 15 -#define PIN_NUM 16 - -enum { - PWPR_PFSWE_POS = 6, - PWPR_B0WI_POS = 7, -}; - -static inline uint32_t pinctrl_ra_read_PmnFPS(size_t port, size_t pin) -{ - return sys_read32(DT_INST_REG_ADDR_BY_NAME(0, pfs) + (port * PIN_NUM + pin) * 4); -} - -static inline void pinctrl_ra_write_PmnFPS(size_t port, size_t pin, uint32_t value) -{ - sys_write32(value, DT_INST_REG_ADDR_BY_NAME(0, pfs) + (port * PIN_NUM + pin) * 4); -} - -static inline uint8_t pinctrl_ra_read_PMISC_PWPR(size_t port, size_t pin) -{ - return sys_read8(DT_INST_REG_ADDR_BY_NAME(0, pmisc_pwpr)); -} - -static inline void pinctrl_ra_write_PMISC_PWPR(uint8_t value) -{ - sys_write8(value, DT_INST_REG_ADDR_BY_NAME(0, pmisc_pwpr)); -} - -static void pinctrl_ra_configure_pfs(const pinctrl_soc_pin_t *pinc) -{ - pinctrl_soc_pin_t pincfg; - - memcpy(&pincfg, pinc, sizeof(pinctrl_soc_pin_t)); - pincfg.pin = 0; - pincfg.port = 0; - - /* Clear PMR bits before configuring */ - if ((pincfg.config & PmnPFS_PMR_POS)) { - uint32_t val = pinctrl_ra_read_PmnFPS(pinc->port, pinc->pin); - - pinctrl_ra_write_PmnFPS(pinc->port, pinc->pin, val & ~(BIT(PmnPFS_PMR_POS))); - pinctrl_ra_write_PmnFPS(pinc->port, pinc->pin, pincfg.config & ~PmnPFS_PMR_POS); - } - - pinctrl_ra_write_PmnFPS(pinc->port, pinc->pin, pincfg.config); -} - -int pinctrl_ra_query_config(uint32_t port, uint32_t pin, struct pinctrl_ra_pin *const pincfg) -{ - if (port >= PORT_NUM || pin >= PIN_NUM) { - return -EINVAL; - } - - pincfg->config = pinctrl_ra_read_PmnFPS(port, pin); - return 0; -} - -int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintptr_t reg) -{ - pinctrl_ra_write_PMISC_PWPR(0); - pinctrl_ra_write_PMISC_PWPR(BIT(PWPR_PFSWE_POS)); - - for (int i = 0; i < pin_cnt; i++) { - pinctrl_ra_configure_pfs(&pins[i]); - } - - pinctrl_ra_write_PMISC_PWPR(0); - pinctrl_ra_write_PMISC_PWPR(BIT(PWPR_B0WI_POS)); - - return 0; -} diff --git a/dts/bindings/pinctrl/renesas,ra-pinctrl.yaml b/dts/bindings/pinctrl/renesas,ra-pinctrl.yaml deleted file mode 100644 index 6a48dedf37e77..0000000000000 --- a/dts/bindings/pinctrl/renesas,ra-pinctrl.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2023 TOKITA Hiroshi -# SPDX-License-Identifier: Apache-2.0 - -description: | - Renesas RA series pin controller - -compatible: "renesas,ra-pinctrl" - -include: base.yaml - -child-binding: - description: | - Definitions for a pinctrl state. - child-binding: - - properties: - pinmux: - required: true - type: array - description: | - An array of pins sharing the same group properties. Each - element of the array is an integer constructed from the - pin number and the alternative function of the pin. diff --git a/include/zephyr/dt-bindings/pinctrl/renesas/pinctrl-r7fa4m1xxxxxx.h b/include/zephyr/dt-bindings/pinctrl/renesas/pinctrl-r7fa4m1xxxxxx.h deleted file mode 100644 index e54667576533d..0000000000000 --- a/include/zephyr/dt-bindings/pinctrl/renesas/pinctrl-r7fa4m1xxxxxx.h +++ /dev/null @@ -1,437 +0,0 @@ -/* - * Copyright (c) 2023 TOKITA Hiroshi - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_DT_BINDINGS_PINCTRL_RENESAS_PINCTRL_R7FA4M1XXXXXX_H_ -#define ZEPHYR_DT_BINDINGS_PINCTRL_RENESAS_PINCTRL_R7FA4M1XXXXXX_H_ - -#include - -#define P000_AMP0P RA_PINCFG__40(0, 0, 0x02, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P000_AN000 RA_PINCFG__40(0, 0, 0x01, RA_PINCFG_ANALOG) -#define P000_TS21 RA_PINCFG__40(0, 0, 0x0C, RA_PINCFG_FUNC) -#define P001_AMP0M RA_PINCFG__40(0, 1, 0x02, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P001_AN001 RA_PINCFG__40(0, 1, 0x01, RA_PINCFG_ANALOG) -#define P001_TS22 RA_PINCFG__40(0, 1, 0x0C, RA_PINCFG_FUNC) -#define P002_AMP0O RA_PINCFG__48(0, 2, 0x02, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P002_AN002 RA_PINCFG__48(0, 2, 0x01, RA_PINCFG_ANALOG) -#define P003_AMP1O RA_PINCFG__64(0, 3, 0x02, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P003_AN003 RA_PINCFG__64(0, 3, 0x01, RA_PINCFG_ANALOG) -#define P004_AMP2O RA_PINCFG__64(0, 4, 0x02, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P004_AN004 RA_PINCFG__64(0, 4, 0x01, RA_PINCFG_ANALOG) -#define P005_AMP3P RA_PINCFG_100(0, 5, 0x02, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P005_AN011 RA_PINCFG_100(0, 5, 0x01, RA_PINCFG_ANALOG) -#define P006_AMP3M RA_PINCFG_100(0, 6, 0x02, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P006_AN012 RA_PINCFG_100(0, 6, 0x01, RA_PINCFG_ANALOG) -#define P007_AMP3O RA_PINCFG_100(0, 7, 0x02, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P007_AN013 RA_PINCFG_100(0, 7, 0x01, RA_PINCFG_ANALOG) -#define P008_AN014 RA_PINCFG_100(0, 8, 0x01, RA_PINCFG_ANALOG) -#define P010_AMP2M RA_PINCFG__40(0, 10, 0x02, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P010_AN005 RA_PINCFG__40(0, 10, 0x01, RA_PINCFG_ANALOG) -#define P010_TS30 RA_PINCFG__40(0, 10, 0x0C, RA_PINCFG_FUNC) -#define P010_VREFH0 RA_PINCFG__40(0, 10, 0x03, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P011_AN006 RA_PINCFG__40(0, 11, 0x01, RA_PINCFG_ANALOG) -#define P011_TS31 RA_PINCFG__40(0, 11, 0x0C, RA_PINCFG_FUNC) -#define P011_VREFL0 RA_PINCFG__40(0, 11, 0x03, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P012_AN007 RA_PINCFG__40(0, 12, 0x01, RA_PINCFG_ANALOG) -#define P012_VREFH RA_PINCFG__40(0, 12, 0x03, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P013_AN008 RA_PINCFG__40(0, 13, 0x01, RA_PINCFG_ANALOG) -#define P013_VREFL RA_PINCFG__40(0, 13, 0x03, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P014_AN009 RA_PINCFG__40(0, 14, 0x01, RA_PINCFG_ANALOG) -#define P014_DA0 RA_PINCFG__40(0, 14, 0x02, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P015_AN010 RA_PINCFG__40(0, 15, 0x01, RA_PINCFG_ANALOG) -#define P015_TS28 RA_PINCFG__40(0, 15, 0x0C, RA_PINCFG_FUNC) -#define P100_AGTIO0 RA_PINCFG__40(1, 0, 0x01, RA_PINCFG_FUNC) -#define P100_AN022 RA_PINCFG__40(1, 0, 0x01, RA_PINCFG_ANALOG) -#define P100_CMPIN0 RA_PINCFG__40(1, 0, 0x02, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P100_GTETRGA RA_PINCFG__40(1, 0, 0x02, RA_PINCFG_FUNC) -#define P100_GTIOC5B RA_PINCFG__40(1, 0, 0x03, RA_PINCFG_FUNC) -#define P100_KR00 RA_PINCFG__40(1, 0, 0x08, RA_PINCFG_FUNC) -#define P100_MISO0 RA_PINCFG__40(1, 0, 0x04, RA_PINCFG_FUNC) -#define P100_MISOA RA_PINCFG__40(1, 0, 0x06, RA_PINCFG_FUNC) -#define P100_RXD0 RA_PINCFG__40(1, 0, 0x04, RA_PINCFG_FUNC) -#define P100_SCK1 RA_PINCFG__40(1, 0, 0x05, RA_PINCFG_FUNC) -#define P100_SCL0 RA_PINCFG__40(1, 0, 0x04, RA_PINCFG_FUNC) -#define P100_SCL1 RA_PINCFG__40(1, 0, 0x07, RA_PINCFG_FUNC) -#define P100_VL1 RA_PINCFG__40(1, 0, 0x0D, RA_PINCFG_FUNC) -#define P101_AGTEE0 RA_PINCFG__40(1, 1, 0x01, RA_PINCFG_FUNC) -#define P101_AN021 RA_PINCFG__40(1, 1, 0x01, RA_PINCFG_ANALOG) -#define P101_CMPREF0 RA_PINCFG__40(1, 1, 0x02, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P101_CTS1_RTS1 RA_PINCFG__40(1, 1, 0x05, RA_PINCFG_FUNC) -#define P101_GTETRGB RA_PINCFG__40(1, 1, 0x02, RA_PINCFG_FUNC) -#define P101_GTIOC5A RA_PINCFG__40(1, 1, 0x03, RA_PINCFG_FUNC) -#define P101_KR01 RA_PINCFG__40(1, 1, 0x08, RA_PINCFG_FUNC) -#define P101_MOSI0 RA_PINCFG__40(1, 1, 0x04, RA_PINCFG_FUNC) -#define P101_MOSIA RA_PINCFG__40(1, 1, 0x06, RA_PINCFG_FUNC) -#define P101_SDA0 RA_PINCFG__40(1, 1, 0x04, RA_PINCFG_FUNC) -#define P101_SDA1 RA_PINCFG__40(1, 1, 0x07, RA_PINCFG_FUNC) -#define P101_SS1 RA_PINCFG__40(1, 1, 0x05, RA_PINCFG_FUNC) -#define P101_TXD0 RA_PINCFG__40(1, 1, 0x04, RA_PINCFG_FUNC) -#define P101_VL2 RA_PINCFG__40(1, 1, 0x0D, RA_PINCFG_FUNC) -#define P102_ADTRG0 RA_PINCFG__40(1, 2, 0x0A, RA_PINCFG_FUNC) -#define P102_AGTO0 RA_PINCFG__40(1, 2, 0x01, RA_PINCFG_FUNC) -#define P102_AN020 RA_PINCFG__40(1, 2, 0x01, RA_PINCFG_ANALOG) -#define P102_CMPIN1 RA_PINCFG__40(1, 2, 0x02, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P102_CRX0 RA_PINCFG__40(1, 2, 0x10, RA_PINCFG_FUNC) -#define P102_GTIOC2B RA_PINCFG__40(1, 2, 0x03, RA_PINCFG_FUNC) -#define P102_GTOWLO RA_PINCFG__40(1, 2, 0x02, RA_PINCFG_FUNC) -#define P102_KR02 RA_PINCFG__40(1, 2, 0x08, RA_PINCFG_FUNC) -#define P102_MOSI2 RA_PINCFG__40(1, 2, 0x05, RA_PINCFG_FUNC) -#define P102_RSPCKA RA_PINCFG__40(1, 2, 0x06, RA_PINCFG_FUNC) -#define P102_SCK0 RA_PINCFG__40(1, 2, 0x04, RA_PINCFG_FUNC) -#define P102_SDA2 RA_PINCFG__40(1, 2, 0x05, RA_PINCFG_FUNC) -#define P102_TXD2 RA_PINCFG__40(1, 2, 0x05, RA_PINCFG_FUNC) -#define P102_VL3 RA_PINCFG__40(1, 2, 0x0D, RA_PINCFG_FUNC) -#define P103_AN019 RA_PINCFG__48(1, 3, 0x01, RA_PINCFG_ANALOG) -#define P103_CMPREF1 RA_PINCFG__48(1, 3, 0x02, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P103_CTS0_RTS0 RA_PINCFG__48(1, 3, 0x04, RA_PINCFG_FUNC) -#define P103_CTX0 RA_PINCFG__48(1, 3, 0x10, RA_PINCFG_FUNC) -#define P103_GTIOC2A RA_PINCFG__48(1, 3, 0x03, RA_PINCFG_FUNC) -#define P103_GTOWUP RA_PINCFG__48(1, 3, 0x02, RA_PINCFG_FUNC) -#define P103_KR03 RA_PINCFG__48(1, 3, 0x08, RA_PINCFG_FUNC) -#define P103_SS0 RA_PINCFG__48(1, 3, 0x04, RA_PINCFG_FUNC) -#define P103_SSLA0 RA_PINCFG__48(1, 3, 0x06, RA_PINCFG_FUNC) -#define P103_VL4 RA_PINCFG__48(1, 3, 0x0D, RA_PINCFG_FUNC) -#define P104_COM0 RA_PINCFG__48(1, 4, 0x0D, RA_PINCFG_FUNC) -#define P104_GTETRGB RA_PINCFG__48(1, 4, 0x02, RA_PINCFG_FUNC) -#define P104_GTIOC1B RA_PINCFG__48(1, 4, 0x03, RA_PINCFG_FUNC) -#define P104_KR04 RA_PINCFG__48(1, 4, 0x08, RA_PINCFG_FUNC) -#define P104_MISO0 RA_PINCFG__48(1, 4, 0x04, RA_PINCFG_FUNC) -#define P104_RXD0 RA_PINCFG__48(1, 4, 0x04, RA_PINCFG_FUNC) -#define P104_SCL0 RA_PINCFG__48(1, 4, 0x04, RA_PINCFG_FUNC) -#define P104_SSLA1 RA_PINCFG__48(1, 4, 0x06, RA_PINCFG_FUNC) -#define P104_TS13 RA_PINCFG__48(1, 4, 0x0C, RA_PINCFG_FUNC) -#define P105_COM1 RA_PINCFG__64(1, 5, 0x0D, RA_PINCFG_FUNC) -#define P105_GTETRGA RA_PINCFG__64(1, 5, 0x02, RA_PINCFG_FUNC) -#define P105_GTIOC1A RA_PINCFG__64(1, 5, 0x03, RA_PINCFG_FUNC) -#define P105_KR05 RA_PINCFG__64(1, 5, 0x08, RA_PINCFG_FUNC) -#define P105_SSLA2 RA_PINCFG__64(1, 5, 0x06, RA_PINCFG_FUNC) -#define P105_TS34 RA_PINCFG__64(1, 5, 0x0C, RA_PINCFG_FUNC) -#define P106_COM2 RA_PINCFG__64(1, 6, 0x0D, RA_PINCFG_FUNC) -#define P106_GTIOC0B RA_PINCFG__64(1, 6, 0x03, RA_PINCFG_FUNC) -#define P106_KR06 RA_PINCFG__64(1, 6, 0x08, RA_PINCFG_FUNC) -#define P106_SSLA3 RA_PINCFG__64(1, 6, 0x06, RA_PINCFG_FUNC) -#define P107_COM3 RA_PINCFG__64(1, 7, 0x0D, RA_PINCFG_FUNC) -#define P107_GTIOC0A RA_PINCFG__64(1, 7, 0x03, RA_PINCFG_FUNC) -#define P107_KR07 RA_PINCFG__64(1, 7, 0x08, RA_PINCFG_FUNC) -#define P108_CTS9_RTS9 RA_PINCFG__40(1, 8, 0x05, RA_PINCFG_FUNC) -#define P108_GTIOC0B RA_PINCFG__40(1, 8, 0x03, RA_PINCFG_FUNC) -#define P108_GTOULO RA_PINCFG__40(1, 8, 0x02, RA_PINCFG_FUNC) -#define P108_SS9 RA_PINCFG__40(1, 8, 0x05, RA_PINCFG_FUNC) -#define P108_SSLB0 RA_PINCFG__40(1, 8, 0x06, RA_PINCFG_FUNC) -#define P109_CLKOUT RA_PINCFG__40(1, 9, 0x09, RA_PINCFG_FUNC) -#define P109_CTX0 RA_PINCFG__40(1, 9, 0x10, RA_PINCFG_FUNC) -#define P109_GTIOC1A RA_PINCFG__40(1, 9, 0x03, RA_PINCFG_FUNC) -#define P109_GTOVUP RA_PINCFG__40(1, 9, 0x02, RA_PINCFG_FUNC) -#define P109_MOSI9 RA_PINCFG__40(1, 9, 0x05, RA_PINCFG_FUNC) -#define P109_MOSIB RA_PINCFG__40(1, 9, 0x06, RA_PINCFG_FUNC) -#define P109_SCK1 RA_PINCFG__40(1, 9, 0x04, RA_PINCFG_FUNC) -#define P109_SDA9 RA_PINCFG__40(1, 9, 0x05, RA_PINCFG_FUNC) -#define P109_SEG23 RA_PINCFG__40(1, 9, 0x0D, RA_PINCFG_FUNC) -#define P109_TS10 RA_PINCFG__40(1, 9, 0x0C, RA_PINCFG_FUNC) -#define P109_TXD9 RA_PINCFG__40(1, 9, 0x05, RA_PINCFG_FUNC) -#define P110_CRX0 RA_PINCFG__40(1, 10, 0x10, RA_PINCFG_FUNC) -#define P110_CTS2_RTS2 RA_PINCFG__40(1, 10, 0x04, RA_PINCFG_FUNC) -#define P110_GTIOC1B RA_PINCFG__40(1, 10, 0x03, RA_PINCFG_FUNC) -#define P110_GTOVLO RA_PINCFG__40(1, 10, 0x02, RA_PINCFG_FUNC) -#define P110_MISO9 RA_PINCFG__40(1, 10, 0x05, RA_PINCFG_FUNC) -#define P110_MISOB RA_PINCFG__40(1, 10, 0x06, RA_PINCFG_FUNC) -#define P110_RXD9 RA_PINCFG__40(1, 10, 0x05, RA_PINCFG_FUNC) -#define P110_SCL9 RA_PINCFG__40(1, 10, 0x05, RA_PINCFG_FUNC) -#define P110_SEG24 RA_PINCFG__40(1, 10, 0x0D, RA_PINCFG_FUNC) -#define P110_SS2 RA_PINCFG__40(1, 10, 0x04, RA_PINCFG_FUNC) -#define P110_VCOUT RA_PINCFG__40(1, 10, 0x09, RA_PINCFG_FUNC) -#define P111_CAPH RA_PINCFG__40(1, 11, 0x0D, RA_PINCFG_FUNC) -#define P111_GTIOC3A RA_PINCFG__40(1, 11, 0x03, RA_PINCFG_FUNC) -#define P111_RSPCKB RA_PINCFG__40(1, 11, 0x06, RA_PINCFG_FUNC) -#define P111_SCK2 RA_PINCFG__40(1, 11, 0x04, RA_PINCFG_FUNC) -#define P111_SCK9 RA_PINCFG__40(1, 11, 0x05, RA_PINCFG_FUNC) -#define P111_TS12 RA_PINCFG__40(1, 11, 0x0C, RA_PINCFG_FUNC) -#define P112_CAPL RA_PINCFG__40(1, 12, 0x0D, RA_PINCFG_FUNC) -#define P112_GTIOC3B RA_PINCFG__40(1, 12, 0x03, RA_PINCFG_FUNC) -#define P112_MOSI2 RA_PINCFG__40(1, 12, 0x04, RA_PINCFG_FUNC) -#define P112_SCK1 RA_PINCFG__40(1, 12, 0x05, RA_PINCFG_FUNC) -#define P112_SDA2 RA_PINCFG__40(1, 12, 0x04, RA_PINCFG_FUNC) -#define P112_SSIBCK0 RA_PINCFG__40(1, 12, 0x12, RA_PINCFG_FUNC) -#define P112_SSLB0 RA_PINCFG__40(1, 12, 0x06, RA_PINCFG_FUNC) -#define P112_TSCAP RA_PINCFG__40(1, 12, 0x0C, RA_PINCFG_FUNC) -#define P112_TXD2 RA_PINCFG__40(1, 12, 0x04, RA_PINCFG_FUNC) -#define P113_GTIOC2A RA_PINCFG__64(1, 13, 0x03, RA_PINCFG_FUNC) -#define P113_SEG00COM4 RA_PINCFG__64(1, 13, 0x0D, RA_PINCFG_FUNC) -#define P113_SSIFS0 RA_PINCFG__64(1, 13, 0x12, RA_PINCFG_FUNC) -#define P113_SSILRCK0 RA_PINCFG__64(1, 13, 0x12, RA_PINCFG_FUNC) -#define P113_TS27 RA_PINCFG__64(1, 13, 0x0C, RA_PINCFG_FUNC) -#define P114_GTIOC2B RA_PINCFG_100(1, 14, 0x03, RA_PINCFG_FUNC) -#define P114_SEG25 RA_PINCFG_100(1, 14, 0x0D, RA_PINCFG_FUNC) -#define P114_SSIRXD0 RA_PINCFG_100(1, 14, 0x12, RA_PINCFG_FUNC) -#define P114_TS29 RA_PINCFG_100(1, 14, 0x0C, RA_PINCFG_FUNC) -#define P115_GTIOC4A RA_PINCFG_100(1, 15, 0x03, RA_PINCFG_FUNC) -#define P115_SEG26 RA_PINCFG_100(1, 15, 0x0D, RA_PINCFG_FUNC) -#define P115_SSITXD0 RA_PINCFG_100(1, 15, 0x12, RA_PINCFG_FUNC) -#define P115_TS35 RA_PINCFG_100(1, 15, 0x0C, RA_PINCFG_FUNC) -#define P202_GTIOC5B RA_PINCFG_100(2, 2, 0x03, RA_PINCFG_FUNC) -#define P202_MISO9 RA_PINCFG_100(2, 2, 0x05, RA_PINCFG_FUNC) -#define P202_MISOB RA_PINCFG_100(2, 2, 0x06, RA_PINCFG_FUNC) -#define P202_RXD9 RA_PINCFG_100(2, 2, 0x05, RA_PINCFG_FUNC) -#define P202_SCK2 RA_PINCFG_100(2, 2, 0x04, RA_PINCFG_FUNC) -#define P202_SCL9 RA_PINCFG_100(2, 2, 0x05, RA_PINCFG_FUNC) -#define P202_SEG16 RA_PINCFG_100(2, 2, 0x0D, RA_PINCFG_FUNC) -#define P203_CTS2_RTS2 RA_PINCFG_100(2, 3, 0x04, RA_PINCFG_FUNC) -#define P203_GTIOC5A RA_PINCFG_100(2, 3, 0x03, RA_PINCFG_FUNC) -#define P203_MOSI9 RA_PINCFG_100(2, 3, 0x05, RA_PINCFG_FUNC) -#define P203_MOSIB RA_PINCFG_100(2, 3, 0x06, RA_PINCFG_FUNC) -#define P203_SDA9 RA_PINCFG_100(2, 3, 0x05, RA_PINCFG_FUNC) -#define P203_SEG15 RA_PINCFG_100(2, 3, 0x0D, RA_PINCFG_FUNC) -#define P203_SS2 RA_PINCFG_100(2, 3, 0x04, RA_PINCFG_FUNC) -#define P203_TSCAP RA_PINCFG_100(2, 3, 0x0C, RA_PINCFG_FUNC) -#define P203_TXD9 RA_PINCFG_100(2, 3, 0x05, RA_PINCFG_FUNC) -#define P204_AGTIO1 RA_PINCFG__64(2, 4, 0x01, RA_PINCFG_FUNC) -#define P204_CACREF RA_PINCFG__64(2, 4, 0x0A, RA_PINCFG_FUNC) -#define P204_GTIOC4B RA_PINCFG__64(2, 4, 0x03, RA_PINCFG_FUNC) -#define P204_GTIW RA_PINCFG__64(2, 4, 0x02, RA_PINCFG_FUNC) -#define P204_RSPCKB RA_PINCFG__64(2, 4, 0x06, RA_PINCFG_FUNC) -#define P204_SCK0 RA_PINCFG__64(2, 4, 0x04, RA_PINCFG_FUNC) -#define P204_SCK9 RA_PINCFG__64(2, 4, 0x05, RA_PINCFG_FUNC) -#define P204_SCL0 RA_PINCFG__64(2, 4, 0x07, RA_PINCFG_FUNC) -#define P204_SEG14 RA_PINCFG__64(2, 4, 0x0D, RA_PINCFG_FUNC) -#define P204_TS00 RA_PINCFG__64(2, 4, 0x0C, RA_PINCFG_FUNC) -#define P204_USB_OVRCUR_B RA_PINCFG__64(2, 4, 0x13, RA_PINCFG_FUNC) -#define P205_AGTO1 RA_PINCFG__64(2, 5, 0x01, RA_PINCFG_FUNC) -#define P205_CLKOUT RA_PINCFG__64(2, 5, 0x09, RA_PINCFG_FUNC) -#define P205_CTS9_RTS9 RA_PINCFG__64(2, 5, 0x05, RA_PINCFG_FUNC) -#define P205_GTIOC4A RA_PINCFG__64(2, 5, 0x03, RA_PINCFG_FUNC) -#define P205_GTIV RA_PINCFG__64(2, 5, 0x02, RA_PINCFG_FUNC) -#define P205_MOSI0 RA_PINCFG__64(2, 5, 0x04, RA_PINCFG_FUNC) -#define P205_SCL1 RA_PINCFG__64(2, 5, 0x07, RA_PINCFG_FUNC) -#define P205_SDA0 RA_PINCFG__64(2, 5, 0x04, RA_PINCFG_FUNC) -#define P205_SEG13 RA_PINCFG__64(2, 5, 0x0D, RA_PINCFG_FUNC) -#define P205_SS9 RA_PINCFG__64(2, 5, 0x05, RA_PINCFG_FUNC) -#define P205_SSLB0 RA_PINCFG__64(2, 5, 0x06, RA_PINCFG_FUNC) -#define P205_TSCAP RA_PINCFG__64(2, 5, 0x0C, RA_PINCFG_FUNC) -#define P205_TXD0 RA_PINCFG__64(2, 5, 0x04, RA_PINCFG_FUNC) -#define P205_USB_OVRCUR_A RA_PINCFG__64(2, 5, 0x13, RA_PINCFG_FUNC) -#define P206_GTIU RA_PINCFG__48(2, 6, 0x02, RA_PINCFG_FUNC) -#define P206_MISO0 RA_PINCFG__48(2, 6, 0x04, RA_PINCFG_FUNC) -#define P206_RXD0 RA_PINCFG__48(2, 6, 0x04, RA_PINCFG_FUNC) -#define P206_SCL0 RA_PINCFG__48(2, 6, 0x04, RA_PINCFG_FUNC) -#define P206_SDA1 RA_PINCFG__48(2, 6, 0x07, RA_PINCFG_FUNC) -#define P206_SEG12 RA_PINCFG__48(2, 6, 0x0D, RA_PINCFG_FUNC) -#define P206_SSLB1 RA_PINCFG__48(2, 6, 0x06, RA_PINCFG_FUNC) -#define P206_TS01 RA_PINCFG__48(2, 6, 0x0C, RA_PINCFG_FUNC) -#define P206_USB_VBUSEN RA_PINCFG__48(2, 6, 0x13, RA_PINCFG_FUNC) -#define P212_AGTEE1 RA_PINCFG__40(2, 12, 0x01, RA_PINCFG_FUNC) -#define P212_GTETRGB RA_PINCFG__40(2, 12, 0x02, RA_PINCFG_FUNC) -#define P212_GTIOC0B RA_PINCFG__40(2, 12, 0x03, RA_PINCFG_FUNC) -#define P212_MISO1 RA_PINCFG__40(2, 12, 0x05, RA_PINCFG_FUNC) -#define P212_RXD1 RA_PINCFG__40(2, 12, 0x05, RA_PINCFG_FUNC) -#define P212_SCL1 RA_PINCFG__40(2, 12, 0x05, RA_PINCFG_FUNC) -#define P213_GTETRGA RA_PINCFG__40(2, 13, 0x02, RA_PINCFG_FUNC) -#define P213_GTIOC0A RA_PINCFG__40(2, 13, 0x03, RA_PINCFG_FUNC) -#define P213_MOSI1 RA_PINCFG__40(2, 13, 0x05, RA_PINCFG_FUNC) -#define P213_SDA1 RA_PINCFG__40(2, 13, 0x05, RA_PINCFG_FUNC) -#define P213_TXD1 RA_PINCFG__40(2, 13, 0x05, RA_PINCFG_FUNC) -#define P300_GTIOC0A RA_PINCFG__40(3, 0, 0x03, RA_PINCFG_FUNC) -#define P300_GTOUUP RA_PINCFG__40(3, 0, 0x02, RA_PINCFG_FUNC) -#define P300_SSLB1 RA_PINCFG__40(3, 0, 0x06, RA_PINCFG_FUNC) -#define P301_AGTIO0 RA_PINCFG__40(3, 1, 0x01, RA_PINCFG_FUNC) -#define P301_COM5 RA_PINCFG__40(3, 1, 0x10, RA_PINCFG_FUNC) -#define P301_CTS9_RTS9 RA_PINCFG__40(3, 1, 0x05, RA_PINCFG_FUNC) -#define P301_GTIOC4B RA_PINCFG__40(3, 1, 0x03, RA_PINCFG_FUNC) -#define P301_GTOULO RA_PINCFG__40(3, 1, 0x02, RA_PINCFG_FUNC) -#define P301_MISO2 RA_PINCFG__40(3, 1, 0x04, RA_PINCFG_FUNC) -#define P301_RXD2 RA_PINCFG__40(3, 1, 0x04, RA_PINCFG_FUNC) -#define P301_SCL2 RA_PINCFG__40(3, 1, 0x04, RA_PINCFG_FUNC) -#define P301_SEG01 RA_PINCFG__40(3, 1, 0x0D, RA_PINCFG_FUNC) -#define P301_SS9 RA_PINCFG__40(3, 1, 0x05, RA_PINCFG_FUNC) -#define P301_SSLB2 RA_PINCFG__40(3, 1, 0x06, RA_PINCFG_FUNC) -#define P301_TS09 RA_PINCFG__40(3, 1, 0x0C, RA_PINCFG_FUNC) -#define P302_COM6 RA_PINCFG__48(3, 2, 0x10, RA_PINCFG_FUNC) -#define P302_GTIOC4A RA_PINCFG__48(3, 2, 0x03, RA_PINCFG_FUNC) -#define P302_GTOUUP RA_PINCFG__48(3, 2, 0x02, RA_PINCFG_FUNC) -#define P302_MOSI2 RA_PINCFG__48(3, 2, 0x04, RA_PINCFG_FUNC) -#define P302_SDA2 RA_PINCFG__48(3, 2, 0x04, RA_PINCFG_FUNC) -#define P302_SEG02 RA_PINCFG__48(3, 2, 0x0D, RA_PINCFG_FUNC) -#define P302_SSLB3 RA_PINCFG__48(3, 2, 0x06, RA_PINCFG_FUNC) -#define P302_TS08 RA_PINCFG__48(3, 2, 0x0C, RA_PINCFG_FUNC) -#define P302_TXD2 RA_PINCFG__48(3, 2, 0x04, RA_PINCFG_FUNC) -#define P303_COM7 RA_PINCFG__64(3, 3, 0x10, RA_PINCFG_FUNC) -#define P303_GTIOC7B RA_PINCFG__64(3, 3, 0x03, RA_PINCFG_FUNC) -#define P303_SEG03 RA_PINCFG__64(3, 3, 0x0D, RA_PINCFG_FUNC) -#define P303_TS02 RA_PINCFG__64(3, 3, 0x0C, RA_PINCFG_FUNC) -#define P304_GTIOC7A RA_PINCFG__64(3, 4, 0x03, RA_PINCFG_FUNC) -#define P304_SEG20 RA_PINCFG__64(3, 4, 0x0D, RA_PINCFG_FUNC) -#define P304_TS11 RA_PINCFG__64(3, 4, 0x0C, RA_PINCFG_FUNC) -#define P305_SEG19 RA_PINCFG_100(3, 5, 0x0D, RA_PINCFG_FUNC) -#define P306_SEG18 RA_PINCFG_100(3, 6, 0x0D, RA_PINCFG_FUNC) -#define P307_SEG17 RA_PINCFG_100(3, 7, 0x0D, RA_PINCFG_FUNC) -#define P400_AGTIO1 RA_PINCFG__48(4, 0, 0x01, RA_PINCFG_FUNC) -#define P400_AUDIO_CLK RA_PINCFG__48(4, 0, 0x12, RA_PINCFG_FUNC) -#define P400_CACREF RA_PINCFG__48(4, 0, 0x0A, RA_PINCFG_FUNC) -#define P400_GTIOC6A RA_PINCFG__48(4, 0, 0x04, RA_PINCFG_FUNC) -#define P400_SCK0 RA_PINCFG__48(4, 0, 0x04, RA_PINCFG_FUNC) -#define P400_SCK1 RA_PINCFG__48(4, 0, 0x05, RA_PINCFG_FUNC) -#define P400_SCL0 RA_PINCFG__48(4, 0, 0x07, RA_PINCFG_FUNC) -#define P400_SEG04 RA_PINCFG__48(4, 0, 0x0D, RA_PINCFG_FUNC) -#define P400_TS20 RA_PINCFG__48(4, 0, 0x0C, RA_PINCFG_FUNC) -#define P401_CTS0_RTS0 RA_PINCFG__64(4, 1, 0x04, RA_PINCFG_FUNC) -#define P401_CTX0 RA_PINCFG__64(4, 1, 0x10, RA_PINCFG_FUNC) -#define P401_GTETRGA RA_PINCFG__64(4, 1, 0x03, RA_PINCFG_FUNC) -#define P401_GTIOC6B RA_PINCFG__64(4, 1, 0x04, RA_PINCFG_FUNC) -#define P401_MOSI1 RA_PINCFG__64(4, 1, 0x05, RA_PINCFG_FUNC) -#define P401_SDA0 RA_PINCFG__64(4, 1, 0x07, RA_PINCFG_FUNC) -#define P401_SDA1 RA_PINCFG__64(4, 1, 0x05, RA_PINCFG_FUNC) -#define P401_SEG05 RA_PINCFG__64(4, 1, 0x0D, RA_PINCFG_FUNC) -#define P401_SS0 RA_PINCFG__64(4, 1, 0x04, RA_PINCFG_FUNC) -#define P401_TS19 RA_PINCFG__64(4, 1, 0x0C, RA_PINCFG_FUNC) -#define P401_TXD1 RA_PINCFG__64(4, 1, 0x05, RA_PINCFG_FUNC) -#define P402_AGTIO0 RA_PINCFG__64(4, 2, 0x01, RA_PINCFG_FUNC) -#define P402_AGTIO1 RA_PINCFG__64(4, 2, 0x02, RA_PINCFG_FUNC) -#define P402_CRX0 RA_PINCFG__64(4, 2, 0x10, RA_PINCFG_FUNC) -#define P402_MISO1 RA_PINCFG__64(4, 2, 0x05, RA_PINCFG_FUNC) -#define P402_RTCIC0 RA_PINCFG__64(4, 2, 0x00, RA_PINCFG_GPIO) -#define P402_RXD1 RA_PINCFG__64(4, 2, 0x05, RA_PINCFG_FUNC) -#define P402_SCL1 RA_PINCFG__64(4, 2, 0x05, RA_PINCFG_FUNC) -#define P402_SEG06 RA_PINCFG__64(4, 2, 0x0D, RA_PINCFG_FUNC) -#define P402_TS18 RA_PINCFG__64(4, 2, 0x0C, RA_PINCFG_FUNC) -#define P403_AGTIO0 RA_PINCFG_100(4, 3, 0x01, RA_PINCFG_FUNC) -#define P403_AGTIO1 RA_PINCFG_100(4, 3, 0x02, RA_PINCFG_FUNC) -#define P403_CTS1_RTS1 RA_PINCFG_100(4, 3, 0x05, RA_PINCFG_FUNC) -#define P403_GTIOC3A RA_PINCFG_100(4, 3, 0x04, RA_PINCFG_FUNC) -#define P403_RTCIC1 RA_PINCFG_100(4, 3, 0x00, RA_PINCFG_GPIO) -#define P403_SS1 RA_PINCFG_100(4, 3, 0x05, RA_PINCFG_FUNC) -#define P403_SSIBCK0 RA_PINCFG_100(4, 3, 0x12, RA_PINCFG_FUNC) -#define P403_TS17 RA_PINCFG_100(4, 3, 0x0C, RA_PINCFG_FUNC) -#define P404_GTIOC3B RA_PINCFG_100(4, 4, 0x04, RA_PINCFG_FUNC) -#define P404_RTCIC2 RA_PINCFG_100(4, 4, 0x00, RA_PINCFG_GPIO) -#define P404_SSIFS0 RA_PINCFG_100(4, 4, 0x12, RA_PINCFG_FUNC) -#define P404_SSILRCK0 RA_PINCFG_100(4, 4, 0x12, RA_PINCFG_FUNC) -#define P405_GTIOC1A RA_PINCFG_100(4, 5, 0x04, RA_PINCFG_FUNC) -#define P405_SSITXD0 RA_PINCFG_100(4, 5, 0x12, RA_PINCFG_FUNC) -#define P406_GTIOC1B RA_PINCFG_100(4, 6, 0x04, RA_PINCFG_FUNC) -#define P406_SSIRXD0 RA_PINCFG_100(4, 6, 0x12, RA_PINCFG_FUNC) -#define P407_ADTRG0 RA_PINCFG__40(4, 7, 0x0A, RA_PINCFG_FUNC) -#define P407_AGTIO0 RA_PINCFG__40(4, 7, 0x01, RA_PINCFG_FUNC) -#define P407_CTS0_RTS0 RA_PINCFG__40(4, 7, 0x04, RA_PINCFG_FUNC) -#define P407_RTCOUT RA_PINCFG__40(4, 7, 0x09, RA_PINCFG_FUNC) -#define P407_SDA0 RA_PINCFG__40(4, 7, 0x07, RA_PINCFG_FUNC) -#define P407_SEG11 RA_PINCFG__40(4, 7, 0x0D, RA_PINCFG_FUNC) -#define P407_SS0 RA_PINCFG__40(4, 7, 0x04, RA_PINCFG_FUNC) -#define P407_SSLB3 RA_PINCFG__40(4, 7, 0x06, RA_PINCFG_FUNC) -#define P407_TS03 RA_PINCFG__40(4, 7, 0x0C, RA_PINCFG_FUNC) -#define P407_USB_VBUS RA_PINCFG__40(4, 7, 0x13, RA_PINCFG_FUNC) -#define P408_CTS1_RTS1 RA_PINCFG__40(4, 8, 0x04, RA_PINCFG_FUNC) -#define P408_GTIOC5B RA_PINCFG__40(4, 8, 0x04, RA_PINCFG_FUNC) -#define P408_GTOWLO RA_PINCFG__40(4, 8, 0x03, RA_PINCFG_FUNC) -#define P408_MISO9 RA_PINCFG__40(4, 8, 0x05, RA_PINCFG_FUNC) -#define P408_RXD9 RA_PINCFG__40(4, 8, 0x05, RA_PINCFG_FUNC) -#define P408_SCL0 RA_PINCFG__40(4, 8, 0x07, RA_PINCFG_FUNC) -#define P408_SCL9 RA_PINCFG__40(4, 8, 0x05, RA_PINCFG_FUNC) -#define P408_SEG10 RA_PINCFG__40(4, 8, 0x0D, RA_PINCFG_FUNC) -#define P408_SS1 RA_PINCFG__40(4, 8, 0x04, RA_PINCFG_FUNC) -#define P408_TS04 RA_PINCFG__40(4, 8, 0x0C, RA_PINCFG_FUNC) -#define P408_USB_ID RA_PINCFG__40(4, 8, 0x13, RA_PINCFG_FUNC) -#define P409_GTIOC5A RA_PINCFG__48(4, 9, 0x04, RA_PINCFG_FUNC) -#define P409_GTOWUP RA_PINCFG__48(4, 9, 0x03, RA_PINCFG_FUNC) -#define P409_MOSI9 RA_PINCFG__48(4, 9, 0x05, RA_PINCFG_FUNC) -#define P409_SDA9 RA_PINCFG__48(4, 9, 0x05, RA_PINCFG_FUNC) -#define P409_SEG09 RA_PINCFG__48(4, 9, 0x0D, RA_PINCFG_FUNC) -#define P409_TS05 RA_PINCFG__48(4, 9, 0x0C, RA_PINCFG_FUNC) -#define P409_TXD9 RA_PINCFG__48(4, 9, 0x05, RA_PINCFG_FUNC) -#define P409_USB_EXICEN RA_PINCFG__48(4, 9, 0x13, RA_PINCFG_FUNC) -#define P410_AGTOB1 RA_PINCFG__64(4, 10, 0x01, RA_PINCFG_FUNC) -#define P410_GTIOC6B RA_PINCFG__64(4, 10, 0x04, RA_PINCFG_FUNC) -#define P410_GTOVLO RA_PINCFG__64(4, 10, 0x03, RA_PINCFG_FUNC) -#define P410_MISO0 RA_PINCFG__64(4, 10, 0x04, RA_PINCFG_FUNC) -#define P410_MISOA RA_PINCFG__64(4, 10, 0x06, RA_PINCFG_FUNC) -#define P410_RXD0 RA_PINCFG__64(4, 10, 0x04, RA_PINCFG_FUNC) -#define P410_SCL0 RA_PINCFG__64(4, 10, 0x04, RA_PINCFG_FUNC) -#define P410_SEG08 RA_PINCFG__64(4, 10, 0x0D, RA_PINCFG_FUNC) -#define P410_TS06 RA_PINCFG__64(4, 10, 0x0C, RA_PINCFG_FUNC) -#define P411_AGTOA1 RA_PINCFG__64(4, 11, 0x01, RA_PINCFG_FUNC) -#define P411_GTIOC6A RA_PINCFG__64(4, 11, 0x04, RA_PINCFG_FUNC) -#define P411_GTOVUP RA_PINCFG__64(4, 11, 0x03, RA_PINCFG_FUNC) -#define P411_MOSI0 RA_PINCFG__64(4, 11, 0x04, RA_PINCFG_FUNC) -#define P411_MOSIA RA_PINCFG__64(4, 11, 0x06, RA_PINCFG_FUNC) -#define P411_SDA0 RA_PINCFG__64(4, 11, 0x04, RA_PINCFG_FUNC) -#define P411_SEG07 RA_PINCFG__64(4, 11, 0x0D, RA_PINCFG_FUNC) -#define P411_TS07 RA_PINCFG__64(4, 11, 0x0C, RA_PINCFG_FUNC) -#define P411_TXD0 RA_PINCFG__64(4, 11, 0x04, RA_PINCFG_FUNC) -#define P412_RSPCKA RA_PINCFG_100(4, 12, 0x06, RA_PINCFG_FUNC) -#define P412_SCK0 RA_PINCFG_100(4, 12, 0x04, RA_PINCFG_FUNC) -#define P413_CTS0_RTS0 RA_PINCFG_100(4, 13, 0x04, RA_PINCFG_FUNC) -#define P413_SS0 RA_PINCFG_100(4, 13, 0x04, RA_PINCFG_FUNC) -#define P413_SSLA0 RA_PINCFG_100(4, 13, 0x06, RA_PINCFG_FUNC) -#define P414_GTIOC0B RA_PINCFG_100(4, 14, 0x04, RA_PINCFG_FUNC) -#define P414_SSLA1 RA_PINCFG_100(4, 14, 0x06, RA_PINCFG_FUNC) -#define P415_GTIOC0A RA_PINCFG_100(4, 15, 0x04, RA_PINCFG_FUNC) -#define P415_SSLA2 RA_PINCFG_100(4, 15, 0x06, RA_PINCFG_FUNC) -#define P500_AGTOA0 RA_PINCFG__48(5, 0, 0x01, RA_PINCFG_FUNC) -#define P500_AN016 RA_PINCFG__48(5, 0, 0x01, RA_PINCFG_ANALOG) -#define P500_CMPREF1 RA_PINCFG__48(5, 0, 0x02, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P500_GTIOC2A RA_PINCFG__48(5, 0, 0x04, RA_PINCFG_FUNC) -#define P500_GTIU RA_PINCFG__48(5, 0, 0x03, RA_PINCFG_FUNC) -#define P500_SEG34 RA_PINCFG__48(5, 0, 0x0D, RA_PINCFG_FUNC) -#define P500_USB_VBUSEN RA_PINCFG__48(5, 0, 0x13, RA_PINCFG_FUNC) -#define P501_AGTOB0 RA_PINCFG__64(5, 1, 0x01, RA_PINCFG_FUNC) -#define P501_AN017 RA_PINCFG__64(5, 1, 0x01, RA_PINCFG_ANALOG) -#define P501_CMPIN1 RA_PINCFG__64(5, 1, 0x02, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P501_GTIOC2B RA_PINCFG__64(5, 1, 0x04, RA_PINCFG_FUNC) -#define P501_GTIV RA_PINCFG__64(5, 1, 0x03, RA_PINCFG_FUNC) -#define P501_MOSI1 RA_PINCFG__64(5, 1, 0x05, RA_PINCFG_FUNC) -#define P501_SDA1 RA_PINCFG__64(5, 1, 0x05, RA_PINCFG_FUNC) -#define P501_SEG35 RA_PINCFG__64(5, 1, 0x0D, RA_PINCFG_FUNC) -#define P501_TXD1 RA_PINCFG__64(5, 1, 0x05, RA_PINCFG_FUNC) -#define P501_USB_OVRCUR_A RA_PINCFG__64(5, 1, 0x13, RA_PINCFG_FUNC) -#define P502_AN018 RA_PINCFG__64(5, 2, 0x01, RA_PINCFG_ANALOG) -#define P502_CMPREF0 RA_PINCFG__64(5, 2, 0x02, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P502_GTIOC3B RA_PINCFG__64(5, 2, 0x04, RA_PINCFG_FUNC) -#define P502_GTIW RA_PINCFG__64(5, 2, 0x03, RA_PINCFG_FUNC) -#define P502_MISO1 RA_PINCFG__64(5, 2, 0x05, RA_PINCFG_FUNC) -#define P502_RXD1 RA_PINCFG__64(5, 2, 0x05, RA_PINCFG_FUNC) -#define P502_SCL1 RA_PINCFG__64(5, 2, 0x05, RA_PINCFG_FUNC) -#define P502_SEG36 RA_PINCFG__64(5, 2, 0x0D, RA_PINCFG_FUNC) -#define P502_USB_OVRCUR_B RA_PINCFG__64(5, 2, 0x13, RA_PINCFG_FUNC) -#define P503_AN023 RA_PINCFG_100(5, 3, 0x01, RA_PINCFG_ANALOG) -#define P503_CMPIN0 RA_PINCFG_100(5, 3, 0x02, RA_PINCFG_FUNC | RA_PINCFG_ANALOG) -#define P503_SCK1 RA_PINCFG_100(5, 3, 0x05, RA_PINCFG_FUNC) -#define P503_SEG37 RA_PINCFG_100(5, 3, 0x0D, RA_PINCFG_FUNC) -#define P503_USB_EXICEN RA_PINCFG_100(5, 3, 0x13, RA_PINCFG_FUNC) -#define P504_AN024 RA_PINCFG_100(5, 4, 0x01, RA_PINCFG_ANALOG) -#define P504_CTS1_RTS1 RA_PINCFG_100(5, 4, 0x05, RA_PINCFG_FUNC) -#define P504_SS1 RA_PINCFG_100(5, 4, 0x05, RA_PINCFG_FUNC) -#define P504_USB_ID RA_PINCFG_100(5, 4, 0x13, RA_PINCFG_FUNC) -#define P505_AN025 RA_PINCFG_100(5, 5, 0x01, RA_PINCFG_ANALOG) -#define P600_GTIOC6B RA_PINCFG_100(6, 0, 0x01, RA_PINCFG_FUNC) -#define P600_SCK9 RA_PINCFG_100(6, 0, 0x05, RA_PINCFG_FUNC) -#define P600_SEG33 RA_PINCFG_100(6, 0, 0x0D, RA_PINCFG_FUNC) -#define P601_GTIOC6A RA_PINCFG_100(6, 1, 0x01, RA_PINCFG_FUNC) -#define P601_MISO9 RA_PINCFG_100(6, 1, 0x05, RA_PINCFG_FUNC) -#define P601_RXD9 RA_PINCFG_100(6, 1, 0x05, RA_PINCFG_FUNC) -#define P601_SCL9 RA_PINCFG_100(6, 1, 0x05, RA_PINCFG_FUNC) -#define P601_SEG32 RA_PINCFG_100(6, 1, 0x0D, RA_PINCFG_FUNC) -#define P602_GTIOC7B RA_PINCFG_100(6, 2, 0x01, RA_PINCFG_FUNC) -#define P602_MOSI9 RA_PINCFG_100(6, 2, 0x05, RA_PINCFG_FUNC) -#define P602_SDA9 RA_PINCFG_100(6, 2, 0x05, RA_PINCFG_FUNC) -#define P602_SEG31 RA_PINCFG_100(6, 2, 0x0D, RA_PINCFG_FUNC) -#define P602_TXD9 RA_PINCFG_100(6, 2, 0x05, RA_PINCFG_FUNC) -#define P603_CTS9_RTS9 RA_PINCFG_100(6, 3, 0x05, RA_PINCFG_FUNC) -#define P603_GTIOC7A RA_PINCFG_100(6, 3, 0x01, RA_PINCFG_FUNC) -#define P603_SEG30 RA_PINCFG_100(6, 3, 0x0D, RA_PINCFG_FUNC) -#define P603_SS9 RA_PINCFG_100(6, 3, 0x05, RA_PINCFG_FUNC) -#define P608_GTIOC4B RA_PINCFG_100(6, 8, 0x01, RA_PINCFG_FUNC) -#define P608_SEG27 RA_PINCFG_100(6, 8, 0x0D, RA_PINCFG_FUNC) -#define P609_GTIOC5A RA_PINCFG_100(6, 9, 0x01, RA_PINCFG_FUNC) -#define P609_SEG28 RA_PINCFG_100(6, 9, 0x0D, RA_PINCFG_FUNC) -#define P610_GTIOC5B RA_PINCFG_100(6, 10, 0x01, RA_PINCFG_FUNC) -#define P610_SEG29 RA_PINCFG_100(6, 10, 0x0D, RA_PINCFG_FUNC) -#define P708_MISO1 RA_PINCFG_100(7, 8, 0x05, RA_PINCFG_FUNC) -#define P708_RXD1 RA_PINCFG_100(7, 8, 0x05, RA_PINCFG_FUNC) -#define P708_SCL1 RA_PINCFG_100(7, 8, 0x05, RA_PINCFG_FUNC) -#define P708_SSLA3 RA_PINCFG_100(7, 8, 0x06, RA_PINCFG_FUNC) -#define P808_SEG21 RA_PINCFG_100(8, 8, 0x0D, RA_PINCFG_FUNC) -#define P809_SEG22 RA_PINCFG_100(8, 9, 0x0D, RA_PINCFG_FUNC) -#define P914_USB_DP RA_PINCFG__40(9, 14, 0x00, RA_PINCFG_GPIO) -#define P915_USB_DM RA_PINCFG__40(9, 15, 0x00, RA_PINCFG_GPIO) -#endif diff --git a/soc/renesas/ra/common/pinctrl_ra.h b/soc/renesas/ra/common/pinctrl_ra.h deleted file mode 100644 index ed80b3fda1856..0000000000000 --- a/soc/renesas/ra/common/pinctrl_ra.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2023 TOKITA Hiroshi - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_SOC_ARM_RENESAS_RA_COMMON_RA_PINCTRL_SOC_H_ -#define ZEPHYR_SOC_ARM_RENESAS_RA_COMMON_RA_PINCTRL_SOC_H_ - -enum { - PmnPFS_PODR_POS, - PmnPFS_PIDR_POS, - PmnPFS_PDR_POS, - PmnPFS_RSV3_POS, - PmnPFS_PCR_POS, - PmnPFS_RSV5_POS, - PmnPFS_NCODR_POS, - PmnPFS_RSV7_POS, - PmnPFS_RSV8_POS, - PmnPFS_RSV9_POS, - PmnPFS_DSCR_POS, - PmnPFS_DSCR1_POS, - PmnPFS_EOR_POS, - PmnPFS_EOF_POS, - PmnPFS_ISEL_POS, - PmnPFS_ASEL_POS, - PmnPFS_PMR_POS, -}; - -struct pinctrl_ra_pin { - union { - uint32_t config; - struct { - uint8_t PODR: 1; - uint8_t PIDR: 1; - uint8_t PDR: 1; - uint8_t RESERVED3: 1; - uint8_t PCR: 1; - uint8_t RESERVED5: 1; - uint8_t NCODR: 1; - uint8_t RESERVED7: 1; - uint8_t RESERVED8: 1; - uint8_t RESERVED9: 1; - uint8_t DSCR: 2; - uint8_t EOFR: 2; - uint8_t ISEL: 1; - uint8_t ASEL: 1; - uint8_t PMR: 1; - uint8_t RESERVED17: 7; - uint8_t PSEL: 5; - uint8_t RESERVED29: 3; - }; - /* Using RESERVED fields for store pin and port info. */ - struct { - uint32_t UNUSED0: 17; - uint8_t pin: 4; - uint8_t port: 3; - uint32_t UNUSED24: 5; - uint8_t port4: 1; - uint32_t UNUSED30: 2; - }; - }; -}; - -typedef struct pinctrl_ra_pin pinctrl_soc_pin_t; - -extern int pinctrl_ra_query_config(uint32_t port, uint32_t pin, - struct pinctrl_ra_pin *const pincfg); - -/** - * @brief Utility macro to initialize each pin. - * - * @param node_id Node identifier. - * @param prop Property name. - * @param idx Property entry index. - */ -#define Z_PINCTRL_STATE_PIN_INIT(node_id, prop, idx) \ - { \ - .config = DT_PROP_BY_IDX(node_id, prop, idx), \ - }, - -/** - * @brief Utility macro to initialize state pins contained in a given property. - * - * @param node_id Node identifier. - * @param prop Property name describing state pins. - */ -#define Z_PINCTRL_STATE_PINS_INIT(node_id, prop) \ - { \ - DT_FOREACH_CHILD_VARGS(DT_PHANDLE(node_id, prop), DT_FOREACH_PROP_ELEM, pinmux, \ - Z_PINCTRL_STATE_PIN_INIT) \ - } - -#endif /* ZEPHYR_SOC_ARM_RENESAS_RA_COMMON_RA_PINCTRL_SOC_H_ */ From 43db55a79b8ff63ee9ec868b669cffbd07b6e94b Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Wed, 7 Aug 2024 20:00:47 +0900 Subject: [PATCH 2867/4482] drivers: clock_contrl: Remove renesas,ra-clock-generation-circuit driver Remove the renesas,ra-clock-generation-circuit driver, which is no longer needed after migrating to the FSP-based implementation. Signed-off-by: TOKITA Hiroshi --- drivers/clock_control/CMakeLists.txt | 1 - drivers/clock_control/Kconfig | 2 - drivers/clock_control/Kconfig.renesas_ra | 9 - .../clock_control/clock_control_renesas_ra.c | 309 ------------------ .../renesas,ra-clock-generation-circuit.yaml | 46 --- .../zephyr/dt-bindings/clock/renesas-ra-cgc.h | 64 ---- 6 files changed, 431 deletions(-) delete mode 100644 drivers/clock_control/Kconfig.renesas_ra delete mode 100644 drivers/clock_control/clock_control_renesas_ra.c delete mode 100644 dts/bindings/clock/renesas,ra-clock-generation-circuit.yaml delete mode 100644 include/zephyr/dt-bindings/clock/renesas-ra-cgc.h diff --git a/drivers/clock_control/CMakeLists.txt b/drivers/clock_control/CMakeLists.txt index 861ab48c13fa2..c9f0657dc4599 100644 --- a/drivers/clock_control/CMakeLists.txt +++ b/drivers/clock_control/CMakeLists.txt @@ -33,7 +33,6 @@ zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_SI32_APB clock_cont zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_SMARTBOND clock_control_smartbond.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NUMAKER_SCC clock_control_numaker_scc.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NXP_S32 clock_control_nxp_s32.c) -zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_RENESAS_RA clock_control_renesas_ra.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_RENESAS_RA_CGC clock_control_renesas_ra_cgc.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_AMBIQ clock_control_ambiq.c) zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_PWM clock_control_pwm.c) diff --git a/drivers/clock_control/Kconfig b/drivers/clock_control/Kconfig index efae3e1194107..de13e421e5c97 100644 --- a/drivers/clock_control/Kconfig +++ b/drivers/clock_control/Kconfig @@ -84,8 +84,6 @@ source "drivers/clock_control/Kconfig.nxp_s32" source "drivers/clock_control/Kconfig.agilex5" -source "drivers/clock_control/Kconfig.renesas_ra" - source "drivers/clock_control/Kconfig.renesas_ra_cgc" source "drivers/clock_control/Kconfig.max32" diff --git a/drivers/clock_control/Kconfig.renesas_ra b/drivers/clock_control/Kconfig.renesas_ra deleted file mode 100644 index 5a14f593f9b40..0000000000000 --- a/drivers/clock_control/Kconfig.renesas_ra +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 TOKITA Hiroshi -# SPDX-License-Identifier: Apache-2.0 - -config CLOCK_CONTROL_RENESAS_RA - bool "Renesas RA series clock generation circuit driver" - default y - depends on DT_HAS_RENESAS_RA_CLOCK_GENERATION_CIRCUIT_ENABLED - help - Enable Renesas RA series clock generation circuit driver. diff --git a/drivers/clock_control/clock_control_renesas_ra.c b/drivers/clock_control/clock_control_renesas_ra.c deleted file mode 100644 index 3065c94e785a9..0000000000000 --- a/drivers/clock_control/clock_control_renesas_ra.c +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Copyright (c) 2023 TOKITA Hiroshi - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -#define DT_DRV_COMPAT renesas_ra_clock_generation_circuit - -#include -#include -#include -#include - -#if DT_SAME_NODE(DT_INST_PROP(0, clock_source), DT_PATH(clocks, pll)) -#define SYSCLK_SRC pll -#elif DT_SAME_NODE(DT_INST_PROP(0, clock_source), DT_PATH(clocks, mosc)) -#define SYSCLK_SRC mosc -#elif DT_SAME_NODE(DT_INST_PROP(0, clock_source), DT_PATH(clocks, sosc)) -#define SYSCLK_SRC sosc -#elif DT_SAME_NODE(DT_INST_PROP(0, clock_source), DT_PATH(clocks, hoco)) -#define SYSCLK_SRC hoco -#elif DT_SAME_NODE(DT_INST_PROP(0, clock_source), DT_PATH(clocks, moco)) -#define SYSCLK_SRC moco -#elif DT_SAME_NODE(DT_INST_PROP(0, clock_source), DT_PATH(clocks, loco)) -#define SYSCLK_SRC loco -#else -#error Unknown clock source -#endif - -#define FREQ_iclk (clock_freqs[_CONCAT(SCRSCK_, SYSCLK_SRC)] / DT_INST_PROP(0, iclk_div)) -#define FREQ_pclka (clock_freqs[_CONCAT(SCRSCK_, SYSCLK_SRC)] / DT_INST_PROP(0, pclka_div)) -#define FREQ_pclkb (clock_freqs[_CONCAT(SCRSCK_, SYSCLK_SRC)] / DT_INST_PROP(0, pclkb_div)) -#define FREQ_pclkc (clock_freqs[_CONCAT(SCRSCK_, SYSCLK_SRC)] / DT_INST_PROP(0, pclkc_div)) -#define FREQ_pclkd (clock_freqs[_CONCAT(SCRSCK_, SYSCLK_SRC)] / DT_INST_PROP(0, pclkd_div)) -#define FREQ_fclk (clock_freqs[_CONCAT(SCRSCK_, SYSCLK_SRC)] / DT_INST_PROP(0, fclk_div)) - -#define CLKSRC_FREQ(clk) DT_PROP(DT_PATH(clocks, clk), clock_frequency) - -#define IS_CLKSRC_ENABLED(clk) DT_NODE_HAS_STATUS_OKAY(DT_PATH(clocks, clk)) - -#define SCKSCR_INIT_VALUE _CONCAT(CLKSRC_, SYSCLK_SRC) - -#define SCKDIV_ENABLED(clk) DT_INST_NODE_HAS_PROP(0, clk##_div) -#define SCKDIV_VAL(clk) _CONCAT(SCKDIV_, DT_INST_PROP(0, clk##_div)) -#define SCKDIV_POS(clk) _CONCAT(SCKDIV_POS_, clk) - -#define SCKDIVCR_BITS(clk) \ - COND_CODE_1(SCKDIV_ENABLED(clk), ((SCKDIV_VAL(clk) & 0xFU) << SCKDIV_POS(clk)), (0U)) - -#define SCKDIVCR_INIT_VALUE \ - (SCKDIVCR_BITS(iclk) | SCKDIVCR_BITS(pclka) | SCKDIVCR_BITS(pclkb) | \ - SCKDIVCR_BITS(pclkc) | SCKDIVCR_BITS(pclkd) | SCKDIVCR_BITS(bclk) | SCKDIVCR_BITS(fclk)) - -#define HOCOWTCR_INIT_VALUE (6) - -/* - * Required cycles for sub-clokc stabilizing. - */ -#define SUBCLK_STABILIZE_CYCLES 5 - -extern int z_clock_hw_cycles_per_sec; - -enum { - CLKSRC_hoco = 0, - CLKSRC_moco, - CLKSRC_loco, - CLKSRC_mosc, - CLKSRC_sosc, - CLKSRC_pll, -}; - -enum { - SCKDIV_1 = 0, - SCKDIV_2, - SCKDIV_4, - SCKDIV_8, - SCKDIV_16, - SCKDIV_32, - SCKDIV_64, - SCKDIV_128, - SCKDIV_3, - SCKDIV_6, - SCKDIV_12 -}; - -enum { - SCKDIV_POS_pclkd = 0x0U, - SCKDIV_POS_pclkc = 0x4U, - SCKDIV_POS_pclkb = 0x8U, - SCKDIV_POS_pclka = 0xcU, - SCKDIV_POS_bclk = 0x10U, - SCKDIV_POS_pclke = 0x14U, - SCKDIV_POS_iclk = 0x18U, - SCKDIV_POS_fclk = 0x1cU -}; - -enum { - OSCSF_HOCOSF_POS = 0, - OSCSF_MOSCSF_POS = 3, - OSCSF_PLLSF_POS = 5, -}; - -enum { - OPCCR_OPCMTSF_POS = 4, -}; - -static const uint32_t PRCR_KEY = 0xA500U; -static const uint32_t PRCR_CLOCKS = 0x1U; -static const uint32_t PRCR_LOW_POWER = 0x2U; - -enum { -#if DT_INST_REG_SIZE_BY_NAME(0, mstp) == 16 - MSTPCRA_OFFSET = -0x4, -#else - MSTPCRA_OFFSET = 0x0, -#endif - MSTPCRB_OFFSET = (MSTPCRA_OFFSET + 0x4), - MSTPCRC_OFFSET = (MSTPCRB_OFFSET + 0x4), - MSTPCRD_OFFSET = (MSTPCRC_OFFSET + 0x4), - MSTPCRE_OFFSET = (MSTPCRD_OFFSET + 0x4), -}; - -enum { - SCKDIVCR_OFFSET = 0x020, - SCKSCR_OFFSET = 0x026, - MEMWAIT_OFFSET = 0x031, - MOSCCR_OFFSET = 0x032, - HOCOCR_OFFSET = 0x036, - OSCSF_OFFSET = 0x03C, - CKOCR_OFFSET = 0x03E, - OPCCR_OFFSET = 0x0A0, - HOCOWTCR_OFFSET = 0x0A5, - PRCR_OFFSET = 0x3FE, - SOSCCR_OFFSET = 0x480, -}; - -enum { - SCRSCK_hoco, - SCRSCK_moco, - SCRSCK_loco, - SCRSCK_mosc, - SCRSCK_sosc, - SCRSCK_pll, -}; - -static const int clock_freqs[] = { - COND_CODE_1(IS_CLKSRC_ENABLED(hoco), (CLKSRC_FREQ(hoco)), (0)), - COND_CODE_1(IS_CLKSRC_ENABLED(moco), (CLKSRC_FREQ(moco)), (0)), - COND_CODE_1(IS_CLKSRC_ENABLED(loco), (CLKSRC_FREQ(loco)), (0)), - COND_CODE_1(IS_CLKSRC_ENABLED(mosc), (CLKSRC_FREQ(mosc)), (0)), - COND_CODE_1(IS_CLKSRC_ENABLED(sosc), (CLKSRC_FREQ(sosc)), (0)), - COND_CODE_1(IS_CLKSRC_ENABLED(pll), - (DT_PROP(DT_PHANDLE_BY_IDX(DT_PATH(clocks, pll), clocks, 0), clock_frequency) * - DT_PROP(DT_PATH(clocks, pll), clock_mult) / - DT_PROP(DT_PATH(clocks, pll), clock_div)), - (0)), -}; - -static uint32_t MSTP_read(size_t offset) -{ - return sys_read32(DT_INST_REG_ADDR_BY_NAME(0, mstp) + offset); -} - -static void MSTP_write(size_t offset, uint32_t value) -{ - sys_write32(value, DT_INST_REG_ADDR_BY_NAME(0, mstp) + offset); -} - -static uint8_t SYSTEM_read8(size_t offset) -{ - return sys_read8(DT_INST_REG_ADDR_BY_NAME(0, system) + offset); -} - -static void SYSTEM_write8(size_t offset, uint8_t value) -{ - sys_write8(value, DT_INST_REG_ADDR_BY_NAME(0, system) + offset); -} - -static void SYSTEM_write16(size_t offset, uint16_t value) -{ - sys_write16(value, DT_INST_REG_ADDR_BY_NAME(0, system) + offset); -} - -static void SYSTEM_write32(size_t offset, uint32_t value) -{ - sys_write32(value, DT_INST_REG_ADDR_BY_NAME(0, system) + offset); -} - -static int clock_control_ra_on(const struct device *dev, clock_control_subsys_t subsys) -{ - uint32_t clkid = (uint32_t)subsys; - int lock = irq_lock(); - - MSTP_write(MSTPCRA_OFFSET + RA_CLOCK_GROUP(clkid), - MSTP_read(MSTPCRB_OFFSET) & ~RA_CLOCK_BIT(clkid)); - irq_unlock(lock); - - return 0; -} - -static int clock_control_ra_off(const struct device *dev, clock_control_subsys_t subsys) -{ - uint32_t clkid = (uint32_t)subsys; - int lock = irq_lock(); - - MSTP_write(MSTPCRA_OFFSET + RA_CLOCK_GROUP(clkid), - MSTP_read(MSTPCRB_OFFSET) | RA_CLOCK_BIT(clkid)); - irq_unlock(lock); - - return 0; -} - -static int clock_control_ra_get_rate(const struct device *dev, clock_control_subsys_t subsys, - uint32_t *rate) -{ - uint32_t clkid = (uint32_t)subsys; - - switch (clkid & 0xFFFFFF00) { - case RA_CLOCK_SCI(0): - *rate = FREQ_pclka; - break; - default: - return -EINVAL; - } - - return 0; -} - -static const struct clock_control_driver_api ra_clock_control_driver_api = { - .on = clock_control_ra_on, - .off = clock_control_ra_off, - .get_rate = clock_control_ra_get_rate, -}; - -static void crude_busy_loop_impl(uint32_t cycles) -{ - __asm__ volatile(".align 8\n" - "busy_loop:\n" - " sub r0, r0, #1\n" - " cmp r0, #0\n" - " bne.n busy_loop\n"); -} - -static inline void crude_busy_loop(uint32_t wait_us) -{ - static const uint64_t cycles_per_loop = 4; - - crude_busy_loop_impl(sys_clock_hw_cycles_per_sec() * wait_us / USEC_PER_SEC / - cycles_per_loop); -} - -static int clock_control_ra_init(const struct device *dev) -{ - uint8_t sysclk = SYSTEM_read8(SCKSCR_OFFSET); - - z_clock_hw_cycles_per_sec = clock_freqs[sysclk]; - - SYSTEM_write16(PRCR_OFFSET, PRCR_KEY | PRCR_CLOCKS | PRCR_LOW_POWER); - - if (clock_freqs[SCRSCK_hoco] == 64000000) { - SYSTEM_write8(HOCOWTCR_OFFSET, HOCOWTCR_INIT_VALUE); - } - - SYSTEM_write8(SOSCCR_OFFSET, !IS_CLKSRC_ENABLED(sosc)); - SYSTEM_write8(MOSCCR_OFFSET, !IS_CLKSRC_ENABLED(mosc)); - SYSTEM_write8(HOCOCR_OFFSET, !IS_CLKSRC_ENABLED(hoco)); - - if (IS_CLKSRC_ENABLED(sosc)) { - crude_busy_loop(z_clock_hw_cycles_per_sec / clock_freqs[CLKSRC_sosc] * - SUBCLK_STABILIZE_CYCLES); - } - - if (IS_CLKSRC_ENABLED(mosc)) { - while ((SYSTEM_read8(OSCSF_OFFSET) & BIT(OSCSF_MOSCSF_POS)) != - BIT(OSCSF_MOSCSF_POS)) { - ; - } - } - - if (IS_CLKSRC_ENABLED(hoco)) { - while ((SYSTEM_read8(OSCSF_OFFSET) & BIT(OSCSF_HOCOSF_POS)) != - BIT(OSCSF_HOCOSF_POS)) { - ; - } - } - - SYSTEM_write8(OPCCR_OFFSET, 0); - while ((SYSTEM_read8(OPCCR_OFFSET) & BIT(OPCCR_OPCMTSF_POS)) != 0) { - ; - } - - SYSTEM_write8(MEMWAIT_OFFSET, 1); - - SYSTEM_write32(SCKDIVCR_OFFSET, SCKDIVCR_INIT_VALUE); - SYSTEM_write8(SCKSCR_OFFSET, SCKSCR_INIT_VALUE); - - /* re-read system clock setting and apply to hw_cycles */ - sysclk = SYSTEM_read8(SCKSCR_OFFSET); - z_clock_hw_cycles_per_sec = clock_freqs[sysclk]; - - SYSTEM_write16(PRCR_OFFSET, PRCR_KEY); - - return 0; -} - -DEVICE_DT_INST_DEFINE(0, clock_control_ra_init, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &ra_clock_control_driver_api); diff --git a/dts/bindings/clock/renesas,ra-clock-generation-circuit.yaml b/dts/bindings/clock/renesas,ra-clock-generation-circuit.yaml deleted file mode 100644 index 2769a02ce2dfb..0000000000000 --- a/dts/bindings/clock/renesas,ra-clock-generation-circuit.yaml +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (c) 2023 TOKITA Hiroshi -# SPDX-License-Identifier: Apache-2.0 - -description: Renesas RA series Clock Generation Circuit - -compatible: "renesas,ra-clock-generation-circuit" - -include: [clock-controller.yaml, base.yaml] - -properties: - reg: - required: true - - iclk-div: - type: int - description: Division factor for ICLK - - fclk-div: - type: int - description: Division factor for FCLK - - pclka-div: - type: int - description: Division factor for PCLKA - - pclkb-div: - type: int - description: Division factor for PCLKB - - pclkc-div: - type: int - description: Division factor for PCLKC - - pclkd-div: - type: int - description: Division factor for PCLKD - - clock-source: - type: phandle - description: System clock source - - "#clock-cells": - const: 1 - -clock-cells: - - id diff --git a/include/zephyr/dt-bindings/clock/renesas-ra-cgc.h b/include/zephyr/dt-bindings/clock/renesas-ra-cgc.h deleted file mode 100644 index 31bb65ecc4593..0000000000000 --- a/include/zephyr/dt-bindings/clock/renesas-ra-cgc.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2023 TOKITA Hiroshi - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef ZEPHYR_DT_BINDINGS_CLOCK_RENESAS_RA_CGC_H_ -#define ZEPHYR_DT_BINDINGS_CLOCK_RENESAS_RA_CGC_H_ - -#define RA_CLOCK(grp, func, ch) ((grp << 28) | (func << 20) | ch) - -#define RA_CLOCK_GROUP(mod) (((mod >> 28) & 0xF) * 4) -#define RA_CLOCK_BIT(mod) BIT(((mod >> 20) & 0xFF) - ((mod >> 0) & 0xF)) - -#define RA_CLOCK_DMAC(channel) RA_CLOCK(0, 22, channel) -#define RA_CLOCK_DTC(channel) RA_CLOCK(0, 22, channel) -#define RA_CLOCK_CAN(channel) RA_CLOCK(1, 2, channel) -#define RA_CLOCK_CEC(channel) RA_CLOCK(1, 3U, channel) -#define RA_CLOCK_I3C(channel) RA_CLOCK(1, 4U, channel) -#define RA_CLOCK_IRDA(channel) RA_CLOCK(1, 5U, channel) -#define RA_CLOCK_QSPI(channel) RA_CLOCK(1, 6U, channel) -#define RA_CLOCK_IIC(channel) RA_CLOCK(1, 9U, channel) -#define RA_CLOCK_USBFS(channel) RA_CLOCK(1, 11U, channel) -#define RA_CLOCK_USBHS(channel) RA_CLOCK(1, 12U, channel) -#define RA_CLOCK_EPTPC(channel) RA_CLOCK(1, 13U, channel) -#define RA_CLOCK_ETHER(channel) RA_CLOCK(1, 15U, channel) -#define RA_CLOCK_OSPI(channel) RA_CLOCK(1, 16U, channel) -#define RA_CLOCK_SPI(channel) RA_CLOCK(1, 19U, channel) -#define RA_CLOCK_SCI(channel) RA_CLOCK(1, 31U, channel) -#define RA_CLOCK_CAC(channel) RA_CLOCK(2, 0U, channel) -#define RA_CLOCK_CRC(channel) RA_CLOCK(2, 1U, channel) -#define RA_CLOCK_PDC(channel) RA_CLOCK(2, 2U, channel) -#define RA_CLOCK_CTSU(channel) RA_CLOCK(2, 3U, channel) -#define RA_CLOCK_SLCDC(channel) RA_CLOCK(2, 4U, channel) -#define RA_CLOCK_GLCDC(channel) RA_CLOCK(2, 4U, channel) -#define RA_CLOCK_JPEG(channel) RA_CLOCK(2, 5U, channel) -#define RA_CLOCK_DRW(channel) RA_CLOCK(2, 6U, channel) -#define RA_CLOCK_SSI(channel) RA_CLOCK(2, 8U, channel) -#define RA_CLOCK_SRC(channel) RA_CLOCK(2, 9U, channel) -#define RA_CLOCK_SDHIMMC(channel) RA_CLOCK(2, 12U, channel) -#define RA_CLOCK_DOC(channel) RA_CLOCK(2, 13U, channel) -#define RA_CLOCK_ELC(channel) RA_CLOCK(2, 14U, channel) -#define RA_CLOCK_CEU(channel) RA_CLOCK(2, 16U, channel) -#define RA_CLOCK_TFU(channel) RA_CLOCK(2, 20U, channel) -#define RA_CLOCK_IIRFA(channel) RA_CLOCK(2, 21U, channel) -#define RA_CLOCK_CANFD(channel) RA_CLOCK(2, 27U, channel) -#define RA_CLOCK_TRNG(channel) RA_CLOCK(2, 28U, channel) -#define RA_CLOCK_SCE(channel) RA_CLOCK(2, 31U, channel) -#define RA_CLOCK_AES(channel) RA_CLOCK(2, 31U, channel) -#define RA_CLOCK_POEG(channel) RA_CLOCK(3, 14U, channel) -#define RA_CLOCK_ADC(channel) RA_CLOCK(3, 16U, channel) -#define RA_CLOCK_SDADC(channel) RA_CLOCK(3, 17U, channel) -#define RA_CLOCK_DAC8(channel) RA_CLOCK(3, 19U, channel) -#define RA_CLOCK_DAC(channel) RA_CLOCK(3, 20U, channel) -#define RA_CLOCK_TSN(channel) RA_CLOCK(3, 22U, channel) -#define RA_CLOCK_ACMPHS(channel) RA_CLOCK(3, 28U, channel) -#define RA_CLOCK_ACMPLP(channel) RA_CLOCK(3, 29U, channel) -#define RA_CLOCK_OPAMP(channel) RA_CLOCK(3, 31U, channel) -#define RA_CLOCK_AGT(channel) RA_CLOCK(4, 3U, channel) -#define RA_CLOCK_KEY(channel) RA_CLOCK(4, 4U, channel) -#define RA_CLOCK_ULPT(channel) RA_CLOCK(4, 9U, channel) -#define RA_CLOCK_GPT(channel) RA_CLOCK(5, 31U, channel) - -#endif /* ZEPHYR_DT_BINDINGS_CLOCK_RENESAS_RA_CGC_H_ */ From 939e94076d5ecbd151cc1753d22763eb593a8771 Mon Sep 17 00:00:00 2001 From: Jakub Wasilewski Date: Wed, 5 Jun 2024 12:40:50 +0200 Subject: [PATCH 2868/4482] boards: hifive_unleashed: switch zephyr SRAM region from DDR to L2LIM Switch from `ram0` to `l2lim` in `zephyr, sram` in board DTS Add `l2lim` in `support/hifive_unleashed.resc` and targets l2lim as a work-area in `openocd_hifive_unleashed.cfg` Signed-off-by: Jakub Wasilewski Signed-off-by: Filip Kokosinski --- boards/sifive/hifive_unleashed/hifive_unleashed.dts | 2 +- boards/sifive/hifive_unleashed/support/hifive_unleashed.resc | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/boards/sifive/hifive_unleashed/hifive_unleashed.dts b/boards/sifive/hifive_unleashed/hifive_unleashed.dts index 321ca13a964a4..8465265f388d6 100644 --- a/boards/sifive/hifive_unleashed/hifive_unleashed.dts +++ b/boards/sifive/hifive_unleashed/hifive_unleashed.dts @@ -12,7 +12,7 @@ chosen { zephyr,console = &uart0; zephyr,shell-uart = &uart0; - zephyr,sram = &ram0; + zephyr,sram = &l2lim; }; ram0: ram0@80000000 { diff --git a/boards/sifive/hifive_unleashed/support/hifive_unleashed.resc b/boards/sifive/hifive_unleashed/support/hifive_unleashed.resc index 4d06081c5c946..fbb0ddeb9a225 100644 --- a/boards/sifive/hifive_unleashed/support/hifive_unleashed.resc +++ b/boards/sifive/hifive_unleashed/support/hifive_unleashed.resc @@ -10,6 +10,9 @@ set platform """ using "platforms/cpus/sifive-fu540.repl" +l2lim: Memory.MappedMemory @ sysbus 0x08000000 + size: 0x2000000 + clint: frequency: 10000000 """ From 84434ba006dacd748fdab9a17a9821763fea1086 Mon Sep 17 00:00:00 2001 From: Jakub Wasilewski Date: Tue, 9 Jul 2024 13:25:46 +0200 Subject: [PATCH 2869/4482] arch: riscv: add Kconfig option for imprecise FPU state tracking According to the RISC-V Instruction Set Manual: Volume II, Version 20240411 (Section 3.1.6.6), some implementations may choose to track the dirtiness of the floating-point register state imprecisely by reporting the state to be dirty even when it has not been modified. This option reflects that. Also add a filter in `tests/arch/riscv/fpu_sharing/` based on imprecise FPU state tracking Signed-off-by: Jakub Wasilewski Signed-off-by: Filip Kokosinski --- arch/riscv/Kconfig | 10 ++++++++++ tests/arch/riscv/fpu_sharing/testcase.yaml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index a783247282199..8f426d09d3f03 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -1,4 +1,5 @@ # Copyright (c) 2016 Jean-Paul Etienne +# Copyright (c) 2024 Antmicro # SPDX-License-Identifier: Apache-2.0 menu "RISCV Options" @@ -375,6 +376,15 @@ config NULL_POINTER_EXCEPTION_REGION_SIZE endif # NULL_POINTER_EXCEPTION_DETECTION_PMP +config RISCV_IMPRECISE_FPU_STATE_TRACKING + bool "Imprecise implementation of FPU state tracking" + depends on FPU + help + According to the RISC-V Instruction Set Manual: Volume II, Version 20240411 + (Section 3.1.6.6), some implementations may choose to track the dirtiness of + the floating-point register state imprecisely by reporting the state to be + dirty even when it has not been modified. This option reflects that. + endmenu config MAIN_STACK_SIZE diff --git a/tests/arch/riscv/fpu_sharing/testcase.yaml b/tests/arch/riscv/fpu_sharing/testcase.yaml index 2ec10f2aa2616..797f750f893f5 100644 --- a/tests/arch/riscv/fpu_sharing/testcase.yaml +++ b/tests/arch/riscv/fpu_sharing/testcase.yaml @@ -1,4 +1,4 @@ tests: arch.riscv.fpu_sharing: arch_allow: riscv - filter: CONFIG_CPU_HAS_FPU + filter: CONFIG_CPU_HAS_FPU and not CONFIG_RISCV_IMPRECISE_FPU_STATE_TRACKING From 2423c87d543a13ec28d66a1e758d3bb7ab24bf74 Mon Sep 17 00:00:00 2001 From: Jakub Wasilewski Date: Tue, 14 May 2024 16:20:00 +0200 Subject: [PATCH 2870/4482] boards: hifive_unleashed: add support for E51 and U54 targets Add `hifive_unleashed//e51` (earlier selected by default, using `hifive_unleashed`) and `hifive_unleashed//u54` targets. Define work-area for other 4 cores in openocd.cfg Update twister platform white/black lists, to support new targets Signed-off-by: Jakub Wasilewski Signed-off-by: Filip Kokosinski --- .../hifive_unleashed/Kconfig.hifive_unleashed | 3 +- boards/sifive/hifive_unleashed/doc/index.rst | 18 +++- ...ve_unleashed.dts => hifive_unleashed.dtsi} | 0 .../hifive_unleashed/hifive_unleashed_e51.dts | 30 ++++++ ...leashed.yaml => hifive_unleashed_e51.yaml} | 6 +- ...fconfig => hifive_unleashed_e51_defconfig} | 0 .../hifive_unleashed/hifive_unleashed_u54.dts | 17 ++++ .../hifive_unleashed_u54.yaml | 23 +++++ .../hifive_unleashed_u54_defconfig | 10 ++ .../support/openocd_hifive_unleashed.cfg | 4 + dts/riscv/sifive/riscv64-fu540.dtsi | 92 +++++++++++++++++-- samples/drivers/jesd216/sample.yaml | 3 +- soc/sifive/sifive_freedom/fu500/Kconfig | 5 + .../sifive_freedom/fu500/Kconfig.defconfig | 6 ++ soc/sifive/sifive_freedom/fu500/Kconfig.soc | 16 +++- soc/sifive/sifive_freedom/soc.yml | 3 + .../console/line_splitting/testcase.yaml | 2 +- tests/subsys/zbus/integration/testcase.yaml | 3 +- 18 files changed, 220 insertions(+), 21 deletions(-) rename boards/sifive/hifive_unleashed/{hifive_unleashed.dts => hifive_unleashed.dtsi} (100%) create mode 100644 boards/sifive/hifive_unleashed/hifive_unleashed_e51.dts rename boards/sifive/hifive_unleashed/{hifive_unleashed.yaml => hifive_unleashed_e51.yaml} (76%) rename boards/sifive/hifive_unleashed/{hifive_unleashed_defconfig => hifive_unleashed_e51_defconfig} (100%) create mode 100644 boards/sifive/hifive_unleashed/hifive_unleashed_u54.dts create mode 100644 boards/sifive/hifive_unleashed/hifive_unleashed_u54.yaml create mode 100644 boards/sifive/hifive_unleashed/hifive_unleashed_u54_defconfig diff --git a/boards/sifive/hifive_unleashed/Kconfig.hifive_unleashed b/boards/sifive/hifive_unleashed/Kconfig.hifive_unleashed index 2fc2f15d50f6a..da445a39155d9 100644 --- a/boards/sifive/hifive_unleashed/Kconfig.hifive_unleashed +++ b/boards/sifive/hifive_unleashed/Kconfig.hifive_unleashed @@ -2,4 +2,5 @@ # SPDX-License-Identifier: Apache-2.0 config BOARD_HIFIVE_UNLEASHED - select SOC_SIFIVE_FREEDOM_FU540 + select SOC_SIFIVE_FREEDOM_FU540_E51 if BOARD_HIFIVE_UNLEASHED_FU540_E51 + select SOC_SIFIVE_FREEDOM_FU540_U54 if BOARD_HIFIVE_UNLEASHED_FU540_U54 diff --git a/boards/sifive/hifive_unleashed/doc/index.rst b/boards/sifive/hifive_unleashed/doc/index.rst index 647911746fc19..e6450ac1f6c75 100644 --- a/boards/sifive/hifive_unleashed/doc/index.rst +++ b/boards/sifive/hifive_unleashed/doc/index.rst @@ -15,9 +15,21 @@ Building Applications for the ``hifive_unleashed`` board configuration can be built as usual (see :ref:`build_an_application`) using the corresponding board name: -.. zephyr-app-commands:: - :board: hifive_unleashed - :goals: build +.. tabs:: + + .. group-tab:: E51 + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: hifive_unleashed/fu540/e51 + :goals: build + + .. group-tab:: U54 + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: hifive_unleashed/fu540/u54 + :goals: build Flashing ======== diff --git a/boards/sifive/hifive_unleashed/hifive_unleashed.dts b/boards/sifive/hifive_unleashed/hifive_unleashed.dtsi similarity index 100% rename from boards/sifive/hifive_unleashed/hifive_unleashed.dts rename to boards/sifive/hifive_unleashed/hifive_unleashed.dtsi diff --git a/boards/sifive/hifive_unleashed/hifive_unleashed_e51.dts b/boards/sifive/hifive_unleashed/hifive_unleashed_e51.dts new file mode 100644 index 0000000000000..567fb97e9ea84 --- /dev/null +++ b/boards/sifive/hifive_unleashed/hifive_unleashed_e51.dts @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + */ +/dts-v1/; + +#include "hifive_unleashed.dtsi" + +/ { + + cpus { + cpu@1 { + status = "disabled"; + }; + + cpu@2 { + status = "disabled"; + }; + + cpu@3 { + status = "disabled"; + }; + + cpu@4 { + status = "disabled"; + }; + }; + +}; diff --git a/boards/sifive/hifive_unleashed/hifive_unleashed.yaml b/boards/sifive/hifive_unleashed/hifive_unleashed_e51.yaml similarity index 76% rename from boards/sifive/hifive_unleashed/hifive_unleashed.yaml rename to boards/sifive/hifive_unleashed/hifive_unleashed_e51.yaml index 1fb91e4c2e0ed..74d01617336b4 100644 --- a/boards/sifive/hifive_unleashed/hifive_unleashed.yaml +++ b/boards/sifive/hifive_unleashed/hifive_unleashed_e51.yaml @@ -1,5 +1,5 @@ -identifier: hifive_unleashed -name: SiFive HiFive Unleashed +identifier: hifive_unleashed/fu540/e51 +name: SiFive HiFive Unleashed (E51) type: mcu arch: riscv toolchain: @@ -8,11 +8,11 @@ ram: 3840 simulation: renode simulation_exec: renode testing: + timeout_multiplier: 6 ignore_tags: - net - bluetooth - flash - - newlib - crypto renode: uart: sysbus.uart0 diff --git a/boards/sifive/hifive_unleashed/hifive_unleashed_defconfig b/boards/sifive/hifive_unleashed/hifive_unleashed_e51_defconfig similarity index 100% rename from boards/sifive/hifive_unleashed/hifive_unleashed_defconfig rename to boards/sifive/hifive_unleashed/hifive_unleashed_e51_defconfig diff --git a/boards/sifive/hifive_unleashed/hifive_unleashed_u54.dts b/boards/sifive/hifive_unleashed/hifive_unleashed_u54.dts new file mode 100644 index 0000000000000..53af3e2e92e75 --- /dev/null +++ b/boards/sifive/hifive_unleashed/hifive_unleashed_u54.dts @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2024 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include "hifive_unleashed.dtsi" + +/ { + cpus { + cpu@0 { + status = "disabled"; + }; + }; +}; diff --git a/boards/sifive/hifive_unleashed/hifive_unleashed_u54.yaml b/boards/sifive/hifive_unleashed/hifive_unleashed_u54.yaml new file mode 100644 index 0000000000000..54b15bbd660be --- /dev/null +++ b/boards/sifive/hifive_unleashed/hifive_unleashed_u54.yaml @@ -0,0 +1,23 @@ +identifier: hifive_unleashed/fu540/u54 +name: SiFive HiFive Unleashed (U54) +type: mcu +arch: riscv +toolchain: + - zephyr +ram: 3840 +simulation: renode +simulation_exec: renode +testing: + timeout_multiplier: 6 + ignore_tags: + - net + - bluetooth + - flash + - crypto + renode: + uart: sysbus.uart0 + resc: boards/sifive/hifive_unleashed/support/hifive_unleashed.resc +supported: + - gpio + - spi +vendor: sifive diff --git a/boards/sifive/hifive_unleashed/hifive_unleashed_u54_defconfig b/boards/sifive/hifive_unleashed/hifive_unleashed_u54_defconfig new file mode 100644 index 0000000000000..21f7ae226ae79 --- /dev/null +++ b/boards/sifive/hifive_unleashed/hifive_unleashed_u54_defconfig @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_CONSOLE=y +CONFIG_GPIO=y +CONFIG_SERIAL=y +CONFIG_UART_SIFIVE_PORT_0=y +CONFIG_UART_CONSOLE=y +CONFIG_XIP=n +CONFIG_RV_BOOT_HART=1 +CONFIG_FLOAT_HARD=y diff --git a/boards/sifive/hifive_unleashed/support/openocd_hifive_unleashed.cfg b/boards/sifive/hifive_unleashed/support/openocd_hifive_unleashed.cfg index 1620f6cbd39c6..f809228616387 100644 --- a/boards/sifive/hifive_unleashed/support/openocd_hifive_unleashed.cfg +++ b/boards/sifive/hifive_unleashed/support/openocd_hifive_unleashed.cfg @@ -18,5 +18,9 @@ target create $_TARGETNAME.3 riscv -chain-position $_TARGETNAME -coreid 3 target create $_TARGETNAME.4 riscv -chain-position $_TARGETNAME -coreid 4 target smp $_TARGETNAME.0 $_TARGETNAME.1 $_TARGETNAME.2 $_TARGETNAME.3 $_TARGETNAME.4 $_TARGETNAME.0 configure -work-area-phys 0x80000000 -work-area-size 0x4000 -work-area-backup 1 +$_TARGETNAME.1 configure -work-area-phys 0x80000000 -work-area-size 0x4000 -work-area-backup 1 +$_TARGETNAME.2 configure -work-area-phys 0x80000000 -work-area-size 0x4000 -work-area-backup 1 +$_TARGETNAME.3 configure -work-area-phys 0x80000000 -work-area-size 0x4000 -work-area-backup 1 +$_TARGETNAME.4 configure -work-area-phys 0x80000000 -work-area-size 0x4000 -work-area-backup 1 flash bank onboard_spi_flash0 fespi 0x20000000 0 0 0 $_TARGETNAME.0 0x10040000 diff --git a/dts/riscv/sifive/riscv64-fu540.dtsi b/dts/riscv/sifive/riscv64-fu540.dtsi index bc9c14ebb5969..065870fac61bf 100644 --- a/dts/riscv/sifive/riscv64-fu540.dtsi +++ b/dts/riscv/sifive/riscv64-fu540.dtsi @@ -32,14 +32,80 @@ #address-cells = <1>; #size-cells = <0>; - cpu: cpu@0 { + cpu@0 { compatible = "sifive,e51", "riscv"; device_type = "cpu"; - reg = <0>; + i-cache-line-size = <0x4000>; + reg = <0x0>; riscv,isa = "rv64imac_zicsr_zifencei"; - status = "okay"; + hlic0: interrupt-controller { + compatible = "riscv,cpu-intc"; + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + }; + }; - hlic: interrupt-controller { + cpu@1 { + compatible = "sifive,u54", "riscv"; + device_type = "cpu"; + mmu-type = "riscv,sv39"; + i-cache-line-size = <0x8000>; + d-cache-line-size = <0x8000>; + reg = <0x1>; + riscv,isa = "rv64gc"; + hlic1: interrupt-controller { + compatible = "riscv,cpu-intc"; + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + }; + }; + + cpu@2 { + clock-frequency = <0>; + compatible = "sifive,u54", "riscv"; + device_type = "cpu"; + mmu-type = "riscv,sv39"; + i-cache-line-size = <0x8000>; + d-cache-line-size = <0x8000>; + reg = <0x2>; + riscv,isa = "rv64gc"; + hlic2: interrupt-controller { + compatible = "riscv,cpu-intc"; + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + }; + }; + + cpu@3 { + clock-frequency = <0>; + compatible = "sifive,u54", "riscv"; + device_type = "cpu"; + mmu-type = "riscv,sv39"; + i-cache-line-size = <0x8000>; + d-cache-line-size = <0x8000>; + reg = <0x3>; + riscv,isa = "rv64gc"; + hlic3: interrupt-controller { + compatible = "riscv,cpu-intc"; + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + }; + }; + + cpu@4 { + clock-frequency = <0>; + compatible = "sifive,u54", "riscv"; + device_type = "cpu"; + mmu-type = "riscv,sv39"; + i-cache-line-size = <0x8000>; + d-cache-line-size = <0x8000>; + reg = <0x4>; + riscv,isa = "rv64gc"; + hlic4: interrupt-controller { compatible = "riscv,cpu-intc"; #address-cells = <0>; #interrupt-cells = <1>; @@ -102,9 +168,17 @@ reg-names = "mem"; }; + clint: clint@2000000 { compatible = "sifive,clint0"; - interrupts-extended = <&hlic 3 &hlic 7>; + interrupts-extended = <&hlic0 3 &hlic0 7 + &hlic1 3 &hlic1 7 + &hlic2 3 &hlic2 7 + &hlic3 3 &hlic3 7 + &hlic4 3 &hlic4 7>; + interrupt-names = "soft0", "timer0", "soft1", "timer1", + "soft2", "timer2", "soft3", "timer3", + "soft4", "timer4"; reg = <0x2000000 0x10000>; }; @@ -116,10 +190,14 @@ plic: interrupt-controller@c000000 { compatible = "sifive,plic-1.0.0"; - #address-cells = <0>; #interrupt-cells = <2>; + #address-cells = <1>; interrupt-controller; - interrupts-extended = <&hlic 11>; + interrupts-extended = <&hlic0 11 + &hlic1 11 &hlic1 9 + &hlic2 11 &hlic2 9 + &hlic3 11 &hlic3 9 + &hlic4 11 &hlic4 9>; reg = <0x0c000000 0x04000000>; riscv,max-priority = <7>; riscv,ndev = <52>; diff --git a/samples/drivers/jesd216/sample.yaml b/samples/drivers/jesd216/sample.yaml index afc3b200554bb..85f6c07dd92cc 100644 --- a/samples/drivers/jesd216/sample.yaml +++ b/samples/drivers/jesd216/sample.yaml @@ -15,7 +15,8 @@ tests: sample.drivers.jesd216: platform_exclude: - hifive1 - - hifive_unleashed + - hifive_unleashed/fu540/e51 + - hifive_unleashed/fu540/u54 - hifive_unmatched - mimxrt1170_evk/mimxrt1176/cm7 - mimxrt1170_evk/mimxrt1176/cm4 diff --git a/soc/sifive/sifive_freedom/fu500/Kconfig b/soc/sifive/sifive_freedom/fu500/Kconfig index 9e399231dbede..fb54b7451bb8b 100644 --- a/soc/sifive/sifive_freedom/fu500/Kconfig +++ b/soc/sifive/sifive_freedom/fu500/Kconfig @@ -23,3 +23,8 @@ config SOC_SERIES_SIFIVE_FREEDOM_FU500 select SOC_EARLY_INIT_HOOK select INCLUDE_RESET_VECTOR imply XIP + +config SOC_SIFIVE_FREEDOM_FU540_U54 + bool + select RISCV_ISA_EXT_G + select CPU_HAS_FPU_DOUBLE_PRECISION diff --git a/soc/sifive/sifive_freedom/fu500/Kconfig.defconfig b/soc/sifive/sifive_freedom/fu500/Kconfig.defconfig index 4db8701beb2d9..e7aafaae73b37 100644 --- a/soc/sifive/sifive_freedom/fu500/Kconfig.defconfig +++ b/soc/sifive/sifive_freedom/fu500/Kconfig.defconfig @@ -25,4 +25,10 @@ config MAX_IRQ_PER_AGGREGATOR config NUM_IRQS default 64 +config FPU + default y if CPU_HAS_FPU + +config RISCV_IMPRECISE_FPU_STATE_TRACKING + default y if FPU + endif # SOC_SERIES_SIFIVE_FREEDOM_FU500 diff --git a/soc/sifive/sifive_freedom/fu500/Kconfig.soc b/soc/sifive/sifive_freedom/fu500/Kconfig.soc index 87a9e6d6edb77..08eb6ac366071 100644 --- a/soc/sifive/sifive_freedom/fu500/Kconfig.soc +++ b/soc/sifive/sifive_freedom/fu500/Kconfig.soc @@ -5,12 +5,20 @@ config SOC_SERIES_SIFIVE_FREEDOM_FU500 bool select SOC_FAMILY_SIFIVE_FREEDOM -config SOC_SERIES - default "fu500" if SOC_SERIES_SIFIVE_FREEDOM_FU500 - config SOC_SIFIVE_FREEDOM_FU540 bool select SOC_SERIES_SIFIVE_FREEDOM_FU500 +config SOC_SIFIVE_FREEDOM_FU540_E51 + bool + select SOC_SIFIVE_FREEDOM_FU540 + +config SOC_SIFIVE_FREEDOM_FU540_U54 + bool + select SOC_SIFIVE_FREEDOM_FU540 + +config SOC_SERIES + default "fu500" if SOC_SERIES_SIFIVE_FREEDOM_FU500 + config SOC - default "fu540" if SOC_SIFIVE_FREEDOM_FU540 + default "fu540" if SOC_SIFIVE_FREEDOM_FU540_E51 || SOC_SIFIVE_FREEDOM_FU540_U54 diff --git a/soc/sifive/sifive_freedom/soc.yml b/soc/sifive/sifive_freedom/soc.yml index 1590d495d15bc..9f0d3f193e85a 100644 --- a/soc/sifive/sifive_freedom/soc.yml +++ b/soc/sifive/sifive_freedom/soc.yml @@ -7,6 +7,9 @@ family: - name: fu500 socs: - name: fu540 + cpuclusters: + - name: e51 + - name: u54 - name: fu700 socs: - name: fu740 diff --git a/tests/drivers/console/line_splitting/testcase.yaml b/tests/drivers/console/line_splitting/testcase.yaml index 05567a76c344b..a0c74f3e3ca25 100644 --- a/tests/drivers/console/line_splitting/testcase.yaml +++ b/tests/drivers/console/line_splitting/testcase.yaml @@ -2,7 +2,7 @@ common: tags: - drivers - console - platform_allow: hifive1 hifive_unleashed + platform_allow: hifive1 hifive_unleashed/fu540/e51 harness: robot tests: diff --git a/tests/subsys/zbus/integration/testcase.yaml b/tests/subsys/zbus/integration/testcase.yaml index e856b41667207..9443c61b2f868 100644 --- a/tests/subsys/zbus/integration/testcase.yaml +++ b/tests/subsys/zbus/integration/testcase.yaml @@ -3,7 +3,8 @@ tests: platform_exclude: - m2gl025_miv - qemu_cortex_a9 - - hifive_unleashed + - hifive_unleashed/fu540/e51 + - hifive_unleashed/fu540/u54 - fvp_base_revc_2xaemv8a/fvp_base_revc_2xaemv8a/smp/ns tags: zbus integration_platforms: From 8e881959a49467e70c786a30987a367e22bb4014 Mon Sep 17 00:00:00 2001 From: Jakub Wasilewski Date: Tue, 28 May 2024 10:51:38 +0200 Subject: [PATCH 2871/4482] boards: hifive_unmatched: add support for S7 and U74 targets Add `hifive_unmatched//s7` (earlier selected by default, using `hifive_unmatched`) and `hifive_unmatched//u74` targets. Define work-area for other 4 cores in openocd.cfg Update twister platform white/black lists, to support new targets Signed-off-by: Jakub Wasilewski Signed-off-by: Filip Kokosinski --- .../hifive_unmatched/Kconfig.hifive_unmatched | 3 +- boards/sifive/hifive_unmatched/doc/index.rst | 18 +++- ...ve_unmatched.dts => hifive_unmatched.dtsi} | 0 .../hifive_unmatched/hifive_unmatched_s7.dts | 29 +++++++ ...nmatched.yaml => hifive_unmatched_s7.yaml} | 5 +- ...efconfig => hifive_unmatched_s7_defconfig} | 0 .../hifive_unmatched/hifive_unmatched_u74.dts | 17 ++++ .../hifive_unmatched_u74.yaml | 21 +++++ .../hifive_unmatched_u74_defconfig | 9 ++ .../support/openocd_hifive_unmatched.cfg | 4 + dts/riscv/sifive/riscv64-fu740.dtsi | 26 ++++-- samples/drivers/jesd216/sample.yaml | 3 +- samples/drivers/mspi/mspi_async/sample.yaml | 2 +- samples/drivers/mspi/mspi_flash/sample.yaml | 2 +- samples/drivers/spi_flash/sample.yaml | 2 +- samples/subsys/fs/fs_sample/README.rst | 4 +- samples/subsys/fs/fs_sample/sample.yaml | 2 +- soc/sifive/sifive_freedom/fu700/Kconfig | 5 ++ .../sifive_freedom/fu700/Kconfig.defconfig | 7 ++ soc/sifive/sifive_freedom/fu700/Kconfig.soc | 16 +++- soc/sifive/sifive_freedom/soc.yml | 3 + .../drivers/charger/sbs_charger/testcase.yaml | 3 +- .../fuel_gauge/sbs_gauge/testcase.yaml | 5 +- tests/drivers/memc/ram/testcase.yaml | 2 +- ...rlay => hifive_unmatched_fu740_s7.overlay} | 0 .../boards/hifive_unmatched_fu740_u74.overlay | 85 +++++++++++++++++++ ...rlay => hifive_unmatched_fu740_s7.overlay} | 0 .../boards/hifive_unmatched_fu740_u74.overlay | 21 +++++ tests/subsys/fs/ext2/testcase.yaml | 6 +- 29 files changed, 270 insertions(+), 30 deletions(-) rename boards/sifive/hifive_unmatched/{hifive_unmatched.dts => hifive_unmatched.dtsi} (100%) create mode 100644 boards/sifive/hifive_unmatched/hifive_unmatched_s7.dts rename boards/sifive/hifive_unmatched/{hifive_unmatched.yaml => hifive_unmatched_s7.yaml} (75%) rename boards/sifive/hifive_unmatched/{hifive_unmatched_defconfig => hifive_unmatched_s7_defconfig} (100%) create mode 100644 boards/sifive/hifive_unmatched/hifive_unmatched_u74.dts create mode 100644 boards/sifive/hifive_unmatched/hifive_unmatched_u74.yaml create mode 100644 boards/sifive/hifive_unmatched/hifive_unmatched_u74_defconfig rename tests/kernel/device/boards/{hifive_unmatched.overlay => hifive_unmatched_fu740_s7.overlay} (100%) create mode 100644 tests/kernel/device/boards/hifive_unmatched_fu740_u74.overlay rename tests/subsys/fs/ext2/boards/{hifive_unmatched.overlay => hifive_unmatched_fu740_s7.overlay} (100%) create mode 100644 tests/subsys/fs/ext2/boards/hifive_unmatched_fu740_u74.overlay diff --git a/boards/sifive/hifive_unmatched/Kconfig.hifive_unmatched b/boards/sifive/hifive_unmatched/Kconfig.hifive_unmatched index 87911f3ccb3cc..77ea79eb29d4a 100644 --- a/boards/sifive/hifive_unmatched/Kconfig.hifive_unmatched +++ b/boards/sifive/hifive_unmatched/Kconfig.hifive_unmatched @@ -2,4 +2,5 @@ # SPDX-License-Identifier: Apache-2.0 config BOARD_HIFIVE_UNMATCHED - select SOC_SIFIVE_FREEDOM_FU740 + select SOC_SIFIVE_FREEDOM_FU740_S7 if BOARD_HIFIVE_UNMATCHED_FU740_S7 + select SOC_SIFIVE_FREEDOM_FU740_U74 if BOARD_HIFIVE_UNMATCHED_FU740_U74 diff --git a/boards/sifive/hifive_unmatched/doc/index.rst b/boards/sifive/hifive_unmatched/doc/index.rst index 2ff4d5de6e3e4..bc2447104b2ba 100644 --- a/boards/sifive/hifive_unmatched/doc/index.rst +++ b/boards/sifive/hifive_unmatched/doc/index.rst @@ -15,9 +15,21 @@ Building Applications for the ``hifive_unmatched`` board configuration can be built as usual (see :ref:`build_an_application`) using the corresponding board name: -.. zephyr-app-commands:: - :board: hifive_unmatched - :goals: build +.. tabs:: + + .. group-tab:: S7 + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: hifive_unmatched/fu740/s7 + :goals: build + + .. group-tab:: U74 + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: hifive_unmatched/fu740/u74 + :goals: build Flashing ======== diff --git a/boards/sifive/hifive_unmatched/hifive_unmatched.dts b/boards/sifive/hifive_unmatched/hifive_unmatched.dtsi similarity index 100% rename from boards/sifive/hifive_unmatched/hifive_unmatched.dts rename to boards/sifive/hifive_unmatched/hifive_unmatched.dtsi diff --git a/boards/sifive/hifive_unmatched/hifive_unmatched_s7.dts b/boards/sifive/hifive_unmatched/hifive_unmatched_s7.dts new file mode 100644 index 0000000000000..a850910b368fe --- /dev/null +++ b/boards/sifive/hifive_unmatched/hifive_unmatched_s7.dts @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2024 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include "hifive_unmatched.dtsi" + +/ { + cpus { + cpu@1 { + status = "disabled"; + }; + + cpu@2 { + status = "disabled"; + }; + + cpu@3 { + status = "disabled"; + }; + + cpu@4 { + status = "disabled"; + }; + }; +}; diff --git a/boards/sifive/hifive_unmatched/hifive_unmatched.yaml b/boards/sifive/hifive_unmatched/hifive_unmatched_s7.yaml similarity index 75% rename from boards/sifive/hifive_unmatched/hifive_unmatched.yaml rename to boards/sifive/hifive_unmatched/hifive_unmatched_s7.yaml index 6fbfb696ce153..171d8577d2049 100644 --- a/boards/sifive/hifive_unmatched/hifive_unmatched.yaml +++ b/boards/sifive/hifive_unmatched/hifive_unmatched_s7.yaml @@ -1,5 +1,5 @@ -identifier: hifive_unmatched -name: SiFive HiFive Unmatched +identifier: hifive_unmatched/fu740/s7 +name: SiFive HiFive Unmatched (S7) type: mcu arch: riscv toolchain: @@ -8,6 +8,7 @@ ram: 3840 simulation: renode simulation_exec: renode testing: + timeout_multiplier: 6 ignore_tags: - net - bluetooth diff --git a/boards/sifive/hifive_unmatched/hifive_unmatched_defconfig b/boards/sifive/hifive_unmatched/hifive_unmatched_s7_defconfig similarity index 100% rename from boards/sifive/hifive_unmatched/hifive_unmatched_defconfig rename to boards/sifive/hifive_unmatched/hifive_unmatched_s7_defconfig diff --git a/boards/sifive/hifive_unmatched/hifive_unmatched_u74.dts b/boards/sifive/hifive_unmatched/hifive_unmatched_u74.dts new file mode 100644 index 0000000000000..e8adf2bd1271a --- /dev/null +++ b/boards/sifive/hifive_unmatched/hifive_unmatched_u74.dts @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2024 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include "hifive_unmatched.dtsi" + +/ { + cpus { + cpu@0 { + status = "disabled"; + }; + }; +}; diff --git a/boards/sifive/hifive_unmatched/hifive_unmatched_u74.yaml b/boards/sifive/hifive_unmatched/hifive_unmatched_u74.yaml new file mode 100644 index 0000000000000..09dd76d34c640 --- /dev/null +++ b/boards/sifive/hifive_unmatched/hifive_unmatched_u74.yaml @@ -0,0 +1,21 @@ +identifier: hifive_unmatched/fu740/u74 +name: SiFive HiFive Unmatched (U74) +type: mcu +arch: riscv +toolchain: + - zephyr +ram: 3840 +simulation: renode +simulation_exec: renode +testing: + timeout_multiplier: 6 + ignore_tags: + - net + - bluetooth + renode: + uart: sysbus.uart0 + resc: boards/sifive/hifive_unmatched/support/hifive_unmatched.resc +supported: + - spi + - memc +vendor: sifive diff --git a/boards/sifive/hifive_unmatched/hifive_unmatched_u74_defconfig b/boards/sifive/hifive_unmatched/hifive_unmatched_u74_defconfig new file mode 100644 index 0000000000000..b63433284cbba --- /dev/null +++ b/boards/sifive/hifive_unmatched/hifive_unmatched_u74_defconfig @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_UART_SIFIVE_PORT_0=y +CONFIG_UART_CONSOLE=y +CONFIG_XIP=n +CONFIG_RV_BOOT_HART=1 +CONFIG_FLOAT_HARD=y diff --git a/boards/sifive/hifive_unmatched/support/openocd_hifive_unmatched.cfg b/boards/sifive/hifive_unmatched/support/openocd_hifive_unmatched.cfg index 1620f6cbd39c6..f809228616387 100644 --- a/boards/sifive/hifive_unmatched/support/openocd_hifive_unmatched.cfg +++ b/boards/sifive/hifive_unmatched/support/openocd_hifive_unmatched.cfg @@ -18,5 +18,9 @@ target create $_TARGETNAME.3 riscv -chain-position $_TARGETNAME -coreid 3 target create $_TARGETNAME.4 riscv -chain-position $_TARGETNAME -coreid 4 target smp $_TARGETNAME.0 $_TARGETNAME.1 $_TARGETNAME.2 $_TARGETNAME.3 $_TARGETNAME.4 $_TARGETNAME.0 configure -work-area-phys 0x80000000 -work-area-size 0x4000 -work-area-backup 1 +$_TARGETNAME.1 configure -work-area-phys 0x80000000 -work-area-size 0x4000 -work-area-backup 1 +$_TARGETNAME.2 configure -work-area-phys 0x80000000 -work-area-size 0x4000 -work-area-backup 1 +$_TARGETNAME.3 configure -work-area-phys 0x80000000 -work-area-size 0x4000 -work-area-backup 1 +$_TARGETNAME.4 configure -work-area-phys 0x80000000 -work-area-size 0x4000 -work-area-backup 1 flash bank onboard_spi_flash0 fespi 0x20000000 0 0 0 $_TARGETNAME.0 0x10040000 diff --git a/dts/riscv/sifive/riscv64-fu740.dtsi b/dts/riscv/sifive/riscv64-fu740.dtsi index 314cc175eedce..4b82d6338bc55 100644 --- a/dts/riscv/sifive/riscv64-fu740.dtsi +++ b/dts/riscv/sifive/riscv64-fu740.dtsi @@ -38,7 +38,7 @@ riscv,isa = "rv64imac_zicsr_zifencei"; status = "okay"; - hlic: interrupt-controller { + hlic0: interrupt-controller { compatible = "riscv,cpu-intc"; #address-cells = <0>; #interrupt-cells = <1>; @@ -52,8 +52,9 @@ reg = <0x1>; riscv,isa = "rv64gc"; - cpu1_intc: interrupt-controller { + hlic1: interrupt-controller { compatible = "riscv,cpu-intc"; + #address-cells = <0>; #interrupt-cells = <1>; interrupt-controller; }; @@ -65,8 +66,9 @@ reg = <0x2>; riscv,isa = "rv64gc"; - cpu2_intc: interrupt-controller { + hlic2: interrupt-controller { compatible = "riscv,cpu-intc"; + #address-cells = <0>; #interrupt-cells = <1>; interrupt-controller; }; @@ -78,8 +80,9 @@ reg = <0x3>; riscv,isa = "rv64gc"; - cpu3_intc: interrupt-controller { + hlic3: interrupt-controller { compatible = "riscv,cpu-intc"; + #address-cells = <0>; #interrupt-cells = <1>; interrupt-controller; }; @@ -91,8 +94,9 @@ reg = <0x4>; riscv,isa = "rv64gc"; - cpu4_intc: interrupt-controller { + hlic4: interrupt-controller { compatible = "riscv,cpu-intc"; + #address-cells = <0>; #interrupt-cells = <1>; interrupt-controller; }; @@ -125,7 +129,11 @@ clint: clint@2000000 { compatible = "sifive,clint0"; - interrupts-extended = <&hlic 3 &hlic 7>; + interrupts-extended = <&hlic0 3 &hlic0 7 + &hlic1 3 &hlic1 7 + &hlic2 3 &hlic2 7 + &hlic3 3 &hlic3 7 + &hlic4 3 &hlic4 7>; reg = <0x0 0x2000000 0x0 0x10000>; }; @@ -141,7 +149,11 @@ #address-cells = <0>; #interrupt-cells = <2>; interrupt-controller; - interrupts-extended = <&hlic 11>; + interrupts-extended = <&hlic0 11 + &hlic1 11 + &hlic2 11 + &hlic3 11 + &hlic4 11>; reg = <0x0 0x0c000000 0x0 0x04000000>; riscv,max-priority = <7>; riscv,ndev = <52>; diff --git a/samples/drivers/jesd216/sample.yaml b/samples/drivers/jesd216/sample.yaml index 85f6c07dd92cc..5dcdc6678dc4c 100644 --- a/samples/drivers/jesd216/sample.yaml +++ b/samples/drivers/jesd216/sample.yaml @@ -17,7 +17,8 @@ tests: - hifive1 - hifive_unleashed/fu540/e51 - hifive_unleashed/fu540/u54 - - hifive_unmatched + - hifive_unmatched/fu740/s7 + - hifive_unmatched/fu740/u74 - mimxrt1170_evk/mimxrt1176/cm7 - mimxrt1170_evk/mimxrt1176/cm4 filter: dt_compat_enabled("jedec,spi-nor") diff --git a/samples/drivers/mspi/mspi_async/sample.yaml b/samples/drivers/mspi/mspi_async/sample.yaml index 73b5985ea5797..3510408365e87 100644 --- a/samples/drivers/mspi/mspi_async/sample.yaml +++ b/samples/drivers/mspi/mspi_async/sample.yaml @@ -5,7 +5,7 @@ tests: tags: - mspi filter: dt_compat_enabled("mspi-aps6404l") - platform_exclude: hifive_unmatched + platform_exclude: hifive_unmatched/fu740/s7 hifive_unmatched/fu740/u74 harness: console harness_config: type: multi_line diff --git a/samples/drivers/mspi/mspi_flash/sample.yaml b/samples/drivers/mspi/mspi_flash/sample.yaml index 33645362297f1..6f71269f9ff9e 100644 --- a/samples/drivers/mspi/mspi_flash/sample.yaml +++ b/samples/drivers/mspi/mspi_flash/sample.yaml @@ -6,7 +6,7 @@ tests: - mspi - flash filter: dt_compat_enabled("jedec,spi-nor") or dt_compat_enabled("mspi-atxp032") - platform_exclude: hifive_unmatched + platform_exclude: hifive_unmatched/fu740/s7 hifive_unmatched/fu740/u74 harness: console harness_config: type: multi_line diff --git a/samples/drivers/spi_flash/sample.yaml b/samples/drivers/spi_flash/sample.yaml index 377c5ccec6ef3..3e9bffa6a48b3 100644 --- a/samples/drivers/spi_flash/sample.yaml +++ b/samples/drivers/spi_flash/sample.yaml @@ -8,7 +8,7 @@ tests: filter: dt_compat_enabled("jedec,spi-nor") or dt_compat_enabled("st,stm32-qspi-nor") or dt_compat_enabled("st,stm32-ospi-nor") or dt_compat_enabled("st,stm32-xspi-nor") or (dt_compat_enabled("nordic,qspi-nor") and CONFIG_NORDIC_QSPI_NOR) - platform_exclude: hifive_unmatched + platform_exclude: hifive_unmatched/fu740/s7 hifive_unmatched/fu740/u74 harness: console harness_config: type: multi_line diff --git a/samples/subsys/fs/fs_sample/README.rst b/samples/subsys/fs/fs_sample/README.rst index d4da8d8d9beff..963172b4f25c2 100644 --- a/samples/subsys/fs/fs_sample/README.rst +++ b/samples/subsys/fs/fs_sample/README.rst @@ -73,13 +73,13 @@ sample lists them out on the debug serial output. Building and Running EXT2 samples ********************************* -Ext2 sample can be built for ``hifive_unmatched`` or ``bl5340_dvk/nrf5340/cpuapp``. Because +Ext2 sample can be built for ``hifive_unmatched/fu740/s7`` or ``bl5340_dvk/nrf5340/cpuapp``. Because FAT is default file system for this sample, additional flags must be passed to build the sample. .. zephyr-app-commands:: :zephyr-app: samples/subsys/fs/fs_sample - :board: hifive_unmatched + :board: hifive_unmatched/fu740/s7 hifive_unmatched/fu740/u74 :gen-args: -DCONF_FILE=prj_ext.conf :goals: build :compact: diff --git a/samples/subsys/fs/fs_sample/sample.yaml b/samples/subsys/fs/fs_sample/sample.yaml index 91c0fe100b4bc..3b670ba84925c 100644 --- a/samples/subsys/fs/fs_sample/sample.yaml +++ b/samples/subsys/fs/fs_sample/sample.yaml @@ -73,7 +73,7 @@ tests: simulation_exclude: - renode extra_args: CONF_FILE="prj_ext.conf" - platform_allow: hifive_unmatched bl5340_dvk/nrf5340/cpuapp + platform_allow: hifive_unmatched/fu740/s7 bl5340_dvk/nrf5340/cpuapp sample.filesystem.fat_fs.stm32h747i_disco_m7_sdmmc: build_only: true platform_allow: stm32h747i_disco/stm32h747xx/m7 diff --git a/soc/sifive/sifive_freedom/fu700/Kconfig b/soc/sifive/sifive_freedom/fu700/Kconfig index 7179342dc1539..5644ea390abad 100644 --- a/soc/sifive/sifive_freedom/fu700/Kconfig +++ b/soc/sifive/sifive_freedom/fu700/Kconfig @@ -22,3 +22,8 @@ config SOC_SERIES_SIFIVE_FREEDOM_FU700 select SOC_EARLY_INIT_HOOK select INCLUDE_RESET_VECTOR imply XIP + +config SOC_SIFIVE_FREEDOM_FU740_U74 + bool + select RISCV_ISA_EXT_G + select CPU_HAS_FPU_DOUBLE_PRECISION diff --git a/soc/sifive/sifive_freedom/fu700/Kconfig.defconfig b/soc/sifive/sifive_freedom/fu700/Kconfig.defconfig index 56aab7e3df879..c990500fcf377 100644 --- a/soc/sifive/sifive_freedom/fu700/Kconfig.defconfig +++ b/soc/sifive/sifive_freedom/fu700/Kconfig.defconfig @@ -1,4 +1,5 @@ # Copyright (c) 2017 Jean-Paul Etienne +# Copyright (c) 2024 Antmicro # SPDX-License-Identifier: Apache-2.0 if SOC_SERIES_SIFIVE_FREEDOM_FU700 @@ -24,4 +25,10 @@ config MAX_IRQ_PER_AGGREGATOR config NUM_IRQS default 64 +config FPU + default y if CPU_HAS_FPU + +config RISCV_IMPRECISE_FPU_STATE_TRACKING + default y if FPU + endif # SOC_SERIES_SIFIVE_FREEDOM_FU700 diff --git a/soc/sifive/sifive_freedom/fu700/Kconfig.soc b/soc/sifive/sifive_freedom/fu700/Kconfig.soc index db58d77a2c364..a46673c768cba 100644 --- a/soc/sifive/sifive_freedom/fu700/Kconfig.soc +++ b/soc/sifive/sifive_freedom/fu700/Kconfig.soc @@ -5,12 +5,20 @@ config SOC_SERIES_SIFIVE_FREEDOM_FU700 bool select SOC_FAMILY_SIFIVE_FREEDOM -config SOC_SERIES - default "fu700" if SOC_SERIES_SIFIVE_FREEDOM_FU700 - config SOC_SIFIVE_FREEDOM_FU740 bool select SOC_SERIES_SIFIVE_FREEDOM_FU700 +config SOC_SIFIVE_FREEDOM_FU740_S7 + bool + select SOC_SIFIVE_FREEDOM_FU740 + +config SOC_SIFIVE_FREEDOM_FU740_U74 + bool + select SOC_SIFIVE_FREEDOM_FU740 + +config SOC_SERIES + default "fu700" if SOC_SERIES_SIFIVE_FREEDOM_FU700 + config SOC - default "fu740" if SOC_SIFIVE_FREEDOM_FU740 + default "fu740" if SOC_SIFIVE_FREEDOM_FU740_S7 || SOC_SIFIVE_FREEDOM_FU740_U74 diff --git a/soc/sifive/sifive_freedom/soc.yml b/soc/sifive/sifive_freedom/soc.yml index 9f0d3f193e85a..2f5ebd1524e19 100644 --- a/soc/sifive/sifive_freedom/soc.yml +++ b/soc/sifive/sifive_freedom/soc.yml @@ -13,3 +13,6 @@ family: - name: fu700 socs: - name: fu740 + cpuclusters: + - name: s7 + - name: u74 diff --git a/tests/drivers/charger/sbs_charger/testcase.yaml b/tests/drivers/charger/sbs_charger/testcase.yaml index 18d5d30987633..c49772944b7cf 100644 --- a/tests/drivers/charger/sbs_charger/testcase.yaml +++ b/tests/drivers/charger/sbs_charger/testcase.yaml @@ -18,7 +18,8 @@ tests: - qemu_kvm_arm64 - xenvm - xenvm/xenvm/gicv3 - - hifive_unmatched + - hifive_unmatched/fu740/s7 + - hifive_unmatched/fu740/u74 - rcar_h3ulcb/r8a77951/a57 - rcar_salvator_xs - numaker_pfm_m467 diff --git a/tests/drivers/fuel_gauge/sbs_gauge/testcase.yaml b/tests/drivers/fuel_gauge/sbs_gauge/testcase.yaml index 4c295cdf7c47c..3081e8b7b159b 100644 --- a/tests/drivers/fuel_gauge/sbs_gauge/testcase.yaml +++ b/tests/drivers/fuel_gauge/sbs_gauge/testcase.yaml @@ -11,7 +11,8 @@ tests: - CONF_FILE="prj.conf;boards/emulated_board.conf" - DTC_OVERLAY_FILE="boards/emulated_board.overlay" platform_exclude: - - hifive_unmatched + - hifive_unmatched/fu740/s7 + - hifive_unmatched/fu740/u74 - qemu_cortex_a53 - qemu_cortex_a53/qemu_cortex_a53/smp - qemu_kvm_arm64 @@ -30,7 +31,7 @@ tests: - simulation filter: dt_compat_enabled("sbs,sbs-gauge-new-api") platform_allow: - - hifive_unmatched + - hifive_unmatched/fu740/s7 - qemu_cortex_a53 - qemu_cortex_a53/qemu_cortex_a53/smp - qemu_kvm_arm64 diff --git a/tests/drivers/memc/ram/testcase.yaml b/tests/drivers/memc/ram/testcase.yaml index 5d9f768b8bbf8..7af8417c9e105 100644 --- a/tests/drivers/memc/ram/testcase.yaml +++ b/tests/drivers/memc/ram/testcase.yaml @@ -26,4 +26,4 @@ tests: tags: - drivers - memc - platform_allow: hifive_unmatched + platform_allow: hifive_unmatched/fu740/s7 diff --git a/tests/kernel/device/boards/hifive_unmatched.overlay b/tests/kernel/device/boards/hifive_unmatched_fu740_s7.overlay similarity index 100% rename from tests/kernel/device/boards/hifive_unmatched.overlay rename to tests/kernel/device/boards/hifive_unmatched_fu740_s7.overlay diff --git a/tests/kernel/device/boards/hifive_unmatched_fu740_u74.overlay b/tests/kernel/device/boards/hifive_unmatched_fu740_u74.overlay new file mode 100644 index 0000000000000..b5f5176ec541b --- /dev/null +++ b/tests/kernel/device/boards/hifive_unmatched_fu740_u74.overlay @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2020 Nordic Semiconductor ASA + * Copyright (c) 2020 Intel Corporation + * + * SPDX-License-Identifier: Apache-2.0 + * + * Application overlay for creating a fake device instance we + * can use to test DEVICE_MMIO APIs, which get raw data about + * memory ranges from DTS instances. + * + * Names in this file should be chosen in a way that won't conflict + * with real-world devicetree nodes, to allow these tests to run on + * (and be extended to test) real hardware. + */ + +/ { + fakedriver@E0000000 { + compatible = "fakedriver"; + reg = <0x0 0xE0000000 0x0 0x2000>; + status = "okay"; + }; + fakedriver@E1000000 { + compatible = "fakedriver"; + reg = <0x0 0xE1000000 0x0 0x2000>; + status = "okay"; + }; + fakedriver@E2000000 { + compatible = "fakedriver"; + reg = <0x0 0xE2000000 0x0 0x2000>; + status = "okay"; + }; + fakedriver@E3000000 { + compatible = "fakedriver"; + reg = <0x0 0xE3000000 0x0 0x2000>; + status = "okay"; + }; + fakedriver@E4000000 { + compatible = "fakedriver"; + reg = <0x0 0xE4000000 0x0 0x2000>; + status = "okay"; + }; + + fakedriver_multireg@E5000000 { + compatible = "fakedriver_multireg"; + reg = <0x0 0xE5000000 0x0 0x1000>, + <0x0 0xE6000000 0x0 0x1000>; + reg-names = "chip", + "dale"; + status = "okay"; + }; + + fakedeferdriver@E7000000 { + compatible = "fakedeferdriver"; + reg = <0x0 0xE7000000 0x0 0x2000>; + status = "okay"; + zephyr,deferred-init; + }; + + fakedeferdriver@E8000000 { + compatible = "fakedeferdriver"; + reg = <0x0 0xE8000000 0x0 0x2000>; + status = "okay"; + zephyr,deferred-init; + }; + + fakedomain_0: fakedomain_0 { + compatible = "fakedomain"; + status = "okay"; + #power-domain-cells = <0>; + power-domains = <&fakedomain_2>; + }; + + fakedomain_1: fakedomain_1 { + compatible = "fakedomain"; + status = "okay"; + #power-domain-cells = <0>; + power-domains = <&fakedomain_0>; + }; + + fakedomain_2: fakedomain_2 { + compatible = "fakedomain"; + status = "okay"; + #power-domain-cells = <0>; + }; +}; diff --git a/tests/subsys/fs/ext2/boards/hifive_unmatched.overlay b/tests/subsys/fs/ext2/boards/hifive_unmatched_fu740_s7.overlay similarity index 100% rename from tests/subsys/fs/ext2/boards/hifive_unmatched.overlay rename to tests/subsys/fs/ext2/boards/hifive_unmatched_fu740_s7.overlay diff --git a/tests/subsys/fs/ext2/boards/hifive_unmatched_fu740_u74.overlay b/tests/subsys/fs/ext2/boards/hifive_unmatched_fu740_u74.overlay new file mode 100644 index 0000000000000..45f299c3ecfbb --- /dev/null +++ b/tests/subsys/fs/ext2/boards/hifive_unmatched_fu740_u74.overlay @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2023 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&spi2 { + status = "okay"; + + sdhc0: sdhc@0 { + compatible = "zephyr,sdhc-spi-slot"; + reg = <0>; + status = "okay"; + mmc { + compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; + status = "okay"; + }; + spi-max-frequency = <20000000>; + }; +}; diff --git a/tests/subsys/fs/ext2/testcase.yaml b/tests/subsys/fs/ext2/testcase.yaml index bfe58c979f603..5c6c6df41203b 100644 --- a/tests/subsys/fs/ext2/testcase.yaml +++ b/tests/subsys/fs/ext2/testcase.yaml @@ -5,7 +5,8 @@ tests: platform_allow: - native_sim - native_sim/native/64 - - hifive_unmatched + - hifive_unmatched/fu740/s7 + - hifive_unmatched/fu740/u74 - bl5340_dvk/nrf5340/cpuapp extra_args: - EXTRA_DTC_OVERLAY_FILE="ramdisk_small.overlay" @@ -22,7 +23,8 @@ tests: simulation_exclude: - renode platform_allow: - - hifive_unmatched + - hifive_unmatched/fu740/s7 + - hifive_unmatched/fu740/u74 - bl5340_dvk/nrf5340/cpuapp extra_args: CONF_FILE=prj_sdcard.conf From 2a3b28a3f50440438ce6a81fa5aae17763b68029 Mon Sep 17 00:00:00 2001 From: Lingao Meng Date: Tue, 24 Sep 2024 10:50:59 +0800 Subject: [PATCH 2872/4482] kernel: work: Remove meanless foreach for work Since call this function both in ```C k_spinlock_key_t key = k_spin_lock(&lock); bool need_flush = work_flush_locked(work, flusher); k_spin_unlock(&lock, key); ``` So, there are no flag_get change. Signed-off-by: Lingao Meng --- kernel/work.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/kernel/work.c b/kernel/work.c index 994d6d74e8041..1163db9f0b86c 100644 --- a/kernel/work.c +++ b/kernel/work.c @@ -188,19 +188,9 @@ static void queue_flusher_locked(struct k_work_q *queue, struct k_work *work, struct z_work_flusher *flusher) { - bool in_list = false; - struct k_work *wn; - - /* Determine whether the work item is still queued. */ - SYS_SLIST_FOR_EACH_CONTAINER(&queue->pending, wn, node) { - if (wn == work) { - in_list = true; - break; - } - } - init_flusher(flusher); - if (in_list) { + + if ((flags_get(&work->flags) & K_WORK_QUEUED) != 0U) { sys_slist_insert(&queue->pending, &work->node, &flusher->work.node); } else { From 836fa88cbd45ca8cb7694ee9aeadc2b65063d2ef Mon Sep 17 00:00:00 2001 From: Lingao Meng Date: Tue, 24 Sep 2024 12:07:21 +0800 Subject: [PATCH 2873/4482] kernel: work: Add missing ASSERT for args Add missing ASSERT for dwork & queue. Signed-off-by: Lingao Meng --- kernel/work.c | 4 ++++ tests/kernel/workq/work/src/main.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/work.c b/kernel/work.c index 1163db9f0b86c..9573f139b1ad7 100644 --- a/kernel/work.c +++ b/kernel/work.c @@ -867,6 +867,8 @@ static inline int work_delayable_busy_get_locked(const struct k_work_delayable * int k_work_delayable_busy_get(const struct k_work_delayable *dwork) { + __ASSERT_NO_MSG(dwork != NULL); + k_spinlock_key_t key = k_spin_lock(&lock); int ret = work_delayable_busy_get_locked(dwork); @@ -968,6 +970,7 @@ int k_work_schedule_for_queue(struct k_work_q *queue, struct k_work_delayable *dwork, k_timeout_t delay) { + __ASSERT_NO_MSG(queue != NULL); __ASSERT_NO_MSG(dwork != NULL); SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_work, schedule_for_queue, queue, dwork, delay); @@ -1004,6 +1007,7 @@ int k_work_reschedule_for_queue(struct k_work_q *queue, struct k_work_delayable *dwork, k_timeout_t delay) { + __ASSERT_NO_MSG(queue != NULL); __ASSERT_NO_MSG(dwork != NULL); SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_work, reschedule_for_queue, queue, dwork, delay); diff --git a/tests/kernel/workq/work/src/main.c b/tests/kernel/workq/work/src/main.c index 7776db2a7d5a6..504e695b99638 100644 --- a/tests/kernel/workq/work/src/main.c +++ b/tests/kernel/workq/work/src/main.c @@ -1038,7 +1038,7 @@ static void handle_1cpu_basic_schedule_running(struct k_work *work) */ if (atomic_dec(&resubmits_left) > 0) { /* Schedule again on current queue */ - state->schedule_res = k_work_schedule_for_queue(NULL, one_dwork, + state->schedule_res = k_work_schedule_for_queue(one_dwork->work.queue, one_dwork, K_MSEC(DELAY_MS)); } else { /* Flag that it didn't schedule */ From 6d6d4565d322ad8d1aff4bf938385c3fe765d89e Mon Sep 17 00:00:00 2001 From: Lingao Meng Date: Thu, 10 Oct 2024 16:08:19 +0800 Subject: [PATCH 2874/4482] kernel: workq: Fix function format to avoid CI Warning formating Signed-off-by: Lingao Meng --- kernel/work.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/kernel/work.c b/kernel/work.c index 9573f139b1ad7..0871fad0eb92b 100644 --- a/kernel/work.c +++ b/kernel/work.c @@ -966,9 +966,8 @@ static int cancel_delayable_async_locked(struct k_work_delayable *dwork) return cancel_async_locked(&dwork->work); } -int k_work_schedule_for_queue(struct k_work_q *queue, - struct k_work_delayable *dwork, - k_timeout_t delay) +int k_work_schedule_for_queue(struct k_work_q *queue, struct k_work_delayable *dwork, + k_timeout_t delay) { __ASSERT_NO_MSG(queue != NULL); __ASSERT_NO_MSG(dwork != NULL); @@ -991,8 +990,7 @@ int k_work_schedule_for_queue(struct k_work_q *queue, return ret; } -int k_work_schedule(struct k_work_delayable *dwork, - k_timeout_t delay) +int k_work_schedule(struct k_work_delayable *dwork, k_timeout_t delay) { SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_work, schedule, dwork, delay); @@ -1003,9 +1001,8 @@ int k_work_schedule(struct k_work_delayable *dwork, return ret; } -int k_work_reschedule_for_queue(struct k_work_q *queue, - struct k_work_delayable *dwork, - k_timeout_t delay) +int k_work_reschedule_for_queue(struct k_work_q *queue, struct k_work_delayable *dwork, + k_timeout_t delay) { __ASSERT_NO_MSG(queue != NULL); __ASSERT_NO_MSG(dwork != NULL); @@ -1028,8 +1025,7 @@ int k_work_reschedule_for_queue(struct k_work_q *queue, return ret; } -int k_work_reschedule(struct k_work_delayable *dwork, - k_timeout_t delay) +int k_work_reschedule(struct k_work_delayable *dwork, k_timeout_t delay) { SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_work, reschedule, dwork, delay); From 30fa48558e1e8070b38517e31b37080f45068902 Mon Sep 17 00:00:00 2001 From: Mara Furland Date: Wed, 25 Sep 2024 12:40:56 -0400 Subject: [PATCH 2875/4482] boards: qorvo: add DWM3001CDK support Add support for the decawave DWM3001C board from qorvo Signed-off-by: Mara Furland --- boards/qorvo/decawave_dwm3001cdk/Kconfig | 12 ++ .../Kconfig.decawave_dwm3001cdk | 7 + .../decawave_dwm3001cdk/Kconfig.defconfig | 70 ++++++++ boards/qorvo/decawave_dwm3001cdk/board.cmake | 9 + boards/qorvo/decawave_dwm3001cdk/board.yml | 5 + .../decawave_dwm3001cdk-pinctrl.dtsi | 39 +++++ .../decawave_dwm3001cdk.dts | 160 ++++++++++++++++++ .../decawave_dwm3001cdk.yaml | 20 +++ .../decawave_dwm3001cdk_defconfig | 10 ++ .../qorvo/decawave_dwm3001cdk/doc/index.rst | 65 +++++++ .../decawave_dwm3001cdk/pre_dt_board.cmake | 7 + .../boards/decawave_dwm3001cdk.overlay | 7 + 12 files changed, 411 insertions(+) create mode 100644 boards/qorvo/decawave_dwm3001cdk/Kconfig create mode 100644 boards/qorvo/decawave_dwm3001cdk/Kconfig.decawave_dwm3001cdk create mode 100644 boards/qorvo/decawave_dwm3001cdk/Kconfig.defconfig create mode 100644 boards/qorvo/decawave_dwm3001cdk/board.cmake create mode 100644 boards/qorvo/decawave_dwm3001cdk/board.yml create mode 100644 boards/qorvo/decawave_dwm3001cdk/decawave_dwm3001cdk-pinctrl.dtsi create mode 100644 boards/qorvo/decawave_dwm3001cdk/decawave_dwm3001cdk.dts create mode 100644 boards/qorvo/decawave_dwm3001cdk/decawave_dwm3001cdk.yaml create mode 100644 boards/qorvo/decawave_dwm3001cdk/decawave_dwm3001cdk_defconfig create mode 100644 boards/qorvo/decawave_dwm3001cdk/doc/index.rst create mode 100644 boards/qorvo/decawave_dwm3001cdk/pre_dt_board.cmake create mode 100644 tests/drivers/adc/adc_api/boards/decawave_dwm3001cdk.overlay diff --git a/boards/qorvo/decawave_dwm3001cdk/Kconfig b/boards/qorvo/decawave_dwm3001cdk/Kconfig new file mode 100644 index 0000000000000..b7e308ed70dce --- /dev/null +++ b/boards/qorvo/decawave_dwm3001cdk/Kconfig @@ -0,0 +1,12 @@ +# DecaWave DWM3001CDK board configuration + +# Copyright (c) 2024 The Zephyr Project Contributors +# # SPDX-License-Identifier: Apache-2.0 + +if BOARD_DECAWAVE_DWM3001CDK + +config BOARD_SERIAL_BACKEND_CDC_ACM + bool "Use USB CDC as serial console backend" + default y + +endif # BOARD_DECAWAVE_DWM3001CDK diff --git a/boards/qorvo/decawave_dwm3001cdk/Kconfig.decawave_dwm3001cdk b/boards/qorvo/decawave_dwm3001cdk/Kconfig.decawave_dwm3001cdk new file mode 100644 index 0000000000000..b731a794befd7 --- /dev/null +++ b/boards/qorvo/decawave_dwm3001cdk/Kconfig.decawave_dwm3001cdk @@ -0,0 +1,7 @@ +# DecaWave DWM3001CDK board configuration + +# Copyright (c) 2019 Stéphane D'Alu +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_DECAWAVE_DWM3001CDK + select SOC_NRF52833_QDAA diff --git a/boards/qorvo/decawave_dwm3001cdk/Kconfig.defconfig b/boards/qorvo/decawave_dwm3001cdk/Kconfig.defconfig new file mode 100644 index 0000000000000..93c1b48a213cf --- /dev/null +++ b/boards/qorvo/decawave_dwm3001cdk/Kconfig.defconfig @@ -0,0 +1,70 @@ +# DecaWave DWM3001CDK board configuration + +# Copyright (c) 2019 Stéphane D'Alu +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_DECAWAVE_DWM3001CDK + +config BT_CTLR + default BT + +config I2C + default SENSOR + +if BOARD_SERIAL_BACKEND_CDC_ACM + +config USB_DEVICE_STACK + default y + +config USB_CDC_ACM + default SERIAL + +config CONSOLE + default y + +config UART_CONSOLE + default CONSOLE + +config USB_DEVICE_INITIALIZE_AT_BOOT + default y if !MCUBOOT && CONSOLE + +config SHELL_BACKEND_SERIAL_CHECK_DTR + default SHELL + depends on UART_LINE_CTRL + +config UART_LINE_CTRL + default y + +config USB_DEVICE_REMOTE_WAKEUP + default n + +if LOG + +# Logger cannot use itself to log +choice USB_CDC_ACM_LOG_LEVEL_CHOICE + default USB_CDC_ACM_LOG_LEVEL_OFF +endchoice + +# Set USB log level to error only +choice USB_DEVICE_LOG_LEVEL_CHOICE + default USB_DEVICE_LOG_LEVEL_ERR +endchoice + +endif # LOG + +if USB_DEVICE_STACK + +# Enable UART driver, needed for CDC ACM +config SERIAL + default y + +endif # USB_DEVICE_STACK + +endif # BOARD_SERIAL_BACKEND_CDC_ACM + +DT_CHOSEN_ZEPHYR_CONSOLE := zephyr,console + +config UART_CONSOLE + default y if $(dt_chosen_enabled,$(DT_CHOSEN_ZEPHYR_CONSOLE)) && CONSOLE + +endif # BOARD_DECAWAVE_DWM3001CDK diff --git a/boards/qorvo/decawave_dwm3001cdk/board.cmake b/boards/qorvo/decawave_dwm3001cdk/board.cmake new file mode 100644 index 0000000000000..f8c71dc56944b --- /dev/null +++ b/boards/qorvo/decawave_dwm3001cdk/board.cmake @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +board_runner_args(jlink "--device=nRF52833_xxAA" "--speed=4000") +board_runner_args(pyocd "--target=nrf52833" "--frequency=4000000") +include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) +include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake) +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) +include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) +include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake) diff --git a/boards/qorvo/decawave_dwm3001cdk/board.yml b/boards/qorvo/decawave_dwm3001cdk/board.yml new file mode 100644 index 0000000000000..e62aeef178990 --- /dev/null +++ b/boards/qorvo/decawave_dwm3001cdk/board.yml @@ -0,0 +1,5 @@ +board: + name: decawave_dwm3001cdk + vendor: qorvo + socs: + - name: nrf52833 diff --git a/boards/qorvo/decawave_dwm3001cdk/decawave_dwm3001cdk-pinctrl.dtsi b/boards/qorvo/decawave_dwm3001cdk/decawave_dwm3001cdk-pinctrl.dtsi new file mode 100644 index 0000000000000..4bbfe0554977b --- /dev/null +++ b/boards/qorvo/decawave_dwm3001cdk/decawave_dwm3001cdk-pinctrl.dtsi @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022 Nordic Semiconductor + * SPDX-License-Identifier: Apache-2.0 + */ + +&pinctrl { + i2c0_default: i2c0_default { + group1 { + psels = , + ; + bias-pull-up; + }; + }; + + i2c0_sleep: i2c0_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; + + spi3_default: spi3_default { + group1 { + psels = , + , + ; + }; + }; + + spi3_sleep: spi3_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; +}; diff --git a/boards/qorvo/decawave_dwm3001cdk/decawave_dwm3001cdk.dts b/boards/qorvo/decawave_dwm3001cdk/decawave_dwm3001cdk.dts new file mode 100644 index 0000000000000..a616dbf2be711 --- /dev/null +++ b/boards/qorvo/decawave_dwm3001cdk/decawave_dwm3001cdk.dts @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2019 Stéphane D'Alu + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include "decawave_dwm3001cdk-pinctrl.dtsi" +#include + +/ { + model = "Decawave DWM3001CDK"; + compatible = "decawave,dwm3001"; + + chosen { + zephyr,console = &cdc_acm_uart0; + zephyr,shell-uart = &cdc_acm_uart0; + zephyr,uart-mcumgr = &cdc_acm_uart0; + zephyr,bt-mon-uart = &cdc_acm_uart0; + zephyr,bt-c2h-uart = &cdc_acm_uart0; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_partition; + zephyr,ieee802154 = &ieee802154; + }; + + leds { + compatible = "gpio-leds"; + // led from top of board down + // D20: something related to jlink, red + // D13: DW3000 tx(red)/rx(green) + led0: led_0 { + gpios = <&gpio0 04 GPIO_ACTIVE_LOW>; + label = "D9 green LED"; + }; + led1: led_1 { + gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; + label = "D12 red LED"; + }; + led2: led_2 { + gpios = <&gpio0 22 GPIO_ACTIVE_LOW>; + label = "D11 red LED"; + }; + led3: led_3 { + gpios = <&gpio0 05 GPIO_ACTIVE_LOW>; + label = "D10 blue LED"; + }; + }; + + buttons { + compatible = "gpio-keys"; + // SW1 is connected to P0.18, which by default is nRESET and + // will reset the board + button2: button_2 { + gpios = <&gpio0 2 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "Push button switch 2"; + zephyr,code = ; + }; + }; + + /* These aliases are provided for compatibility with samples */ + aliases { + sw0 = &button2; + led0 = &led0; + led1 = &led1; + led2 = &led2; + led3 = &led3; + watchdog0 = &wdt0; + accel0 = &lis2dh12; + }; + +}; + +&uicr { + gpio-as-nreset; +}; + +&gpiote { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&i2c0 { + compatible = "nordic,nrf-twim"; + status = "okay"; + clock-frequency = ; + + pinctrl-0 = <&i2c0_default>; + pinctrl-1 = <&i2c0_sleep>; + pinctrl-names = "default", "sleep"; + lis2dh12: lis2dh12@19 { + compatible = "st,lis2dh12", "st,lis2dh"; + reg = <0x19>; + irq-gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>; + }; +}; + +&spi3 { + compatible = "nordic,nrf-spim"; + status = "okay"; + cs-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; + + pinctrl-0 = <&spi3_default>; + pinctrl-1 = <&spi3_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&ieee802154 { + status = "okay"; +}; + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 0xC000>; + }; + slot0_partition: partition@c000 { + label = "image-0"; + reg = <0x0000C000 0x38000>; + }; + slot1_partition: partition@44000 { + label = "image-1"; + reg = <0x00044000 0x36000>; + }; + storage_partition: partition@7a000 { + label = "storage"; + reg = <0x0007A000 0x00006000>; + }; + }; +}; + +zephyr_udc0: &usbd { + compatible = "nordic,nrf-usbd"; + status = "okay"; + + cdc_acm_uart0: cdc_acm_uart0 { + compatible = "zephyr,cdc-acm-uart"; + }; +}; + +®1 { + regulator-initial-mode = ; +}; + +&adc { + status = "okay"; +}; diff --git a/boards/qorvo/decawave_dwm3001cdk/decawave_dwm3001cdk.yaml b/boards/qorvo/decawave_dwm3001cdk/decawave_dwm3001cdk.yaml new file mode 100644 index 0000000000000..50fdad0ba878e --- /dev/null +++ b/boards/qorvo/decawave_dwm3001cdk/decawave_dwm3001cdk.yaml @@ -0,0 +1,20 @@ +identifier: decawave_dwm3001cdk +name: Decawave-DWM3001CDK +type: mcu +arch: arm +ram: 128 +flash: 512 +vendor: decawave +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - adc + - usb_device + - ble + - gpio + - pwm + - watchdog + - counter + - netif:openthread diff --git a/boards/qorvo/decawave_dwm3001cdk/decawave_dwm3001cdk_defconfig b/boards/qorvo/decawave_dwm3001cdk/decawave_dwm3001cdk_defconfig new file mode 100644 index 0000000000000..c115d16a9d051 --- /dev/null +++ b/boards/qorvo/decawave_dwm3001cdk/decawave_dwm3001cdk_defconfig @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + +# Enable GPIO +CONFIG_GPIO=y diff --git a/boards/qorvo/decawave_dwm3001cdk/doc/index.rst b/boards/qorvo/decawave_dwm3001cdk/doc/index.rst new file mode 100644 index 0000000000000..278699aa1b1c7 --- /dev/null +++ b/boards/qorvo/decawave_dwm3001cdk/doc/index.rst @@ -0,0 +1,65 @@ +.. _decawave_dwm3001cdk: + +Decawave DWM3001CDK +################### + +Overview +******** + +The DWM3001CDK development board includes the DWM3001C module, battery connector +and charging circuit, LEDs, buttons, Raspberry Pi connector, and USB connector. +In addition, the board comes with J-Link OB adding debugging and Virtual COM +Port capabilities. + +See `Qorvo (Decawave) DWM3001CDK website`_ for more information about the +development board, `Qorvo (Decawave) DWM3001C website`_ about the module +itself, and `nRF52833 website`_ for the official reference on the IC itself. + +Programming and Debugging +************************* + +Applications for the ``decawave_dwm3001cdk`` board target can be built, flashed, +and debugged in the usual way. See :ref:`build_an_application` and +:ref:`application_run` for more details on building and running. + +Flashing +======== + +Follow the instructions in the :ref:`nordic_segger` page to install +and configure all the necessary software. Further information can be +found in :ref:`nordic_segger_flashing`. Then build and flash +applications as usual (see :ref:`build_an_application` and +:ref:`application_run` for more details). + +There are two USB ports, the one farthest from the DWM3001C is connected to the +J-Link debugger and the closer one is connected to the nRF52833, though you need +to use CDC ACM USB to get output over it + +Here is an example for the :zephyr:code-sample:`usb-cdc-acm` application. + +Connect to the bottom USB port, and flash the sample + +.. zephyr-app-commands:: + :zephyr-app: samples/subsys/usb/console + :board: decawave_dwm3001cdk + :goals: build flash + + +Then, connect the top USB port and open run your favorite terminal program to +listen for output. + +.. code-block:: console + + $ minicom -D -b 115200 + +Replace :code:`` with the port where the board nRF52 DK +can be found. For example, under Linux, :code:`/dev/ttyACM0`. + + +References +********** +.. target-notes:: + +.. _nRF52833 website: https://www.nordicsemi.com/products/nrf52833 +.. _Qorvo (Decawave) DWM3001C website: https://www.qorvo.com/products/p/DWM3001C +.. _Qorvo (Decawave) DWM3001CDK website: https://www.qorvo.com/products/p/DWM3001CDK diff --git a/boards/qorvo/decawave_dwm3001cdk/pre_dt_board.cmake b/boards/qorvo/decawave_dwm3001cdk/pre_dt_board.cmake new file mode 100644 index 0000000000000..3369c21d3af5b --- /dev/null +++ b/boards/qorvo/decawave_dwm3001cdk/pre_dt_board.cmake @@ -0,0 +1,7 @@ +# Copyright (c) 2022 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +# Suppress "unique_unit_address_if_enabled" to handle the following overlaps: +# - power@40000000 & clock@40000000 & bprot@40000000 +# - acl@4001e000 & flash-controller@4001e000 +list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") diff --git a/tests/drivers/adc/adc_api/boards/decawave_dwm3001cdk.overlay b/tests/drivers/adc/adc_api/boards/decawave_dwm3001cdk.overlay new file mode 100644 index 0000000000000..df935d86af827 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/decawave_dwm3001cdk.overlay @@ -0,0 +1,7 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 The Zephyr Project Contributors + */ + +#include "nordic,nrf-saadc-common.dtsi" From 827909b7b9d5730aca497e138762be3c3c2f3413 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 8 Nov 2024 17:23:12 +0100 Subject: [PATCH 2876/4482] LLEXT: Xtensa: don't generate FLIX commands The LLEXT linker for Xtensa cannot relocate FLIX commands, disable them in extensions only until we have a solution. Note, that this only affects extensions, the main Zephyr binary is still built with FLIX commands. Signed-off-by: Guennadi Liakhovetski --- cmake/compiler/xt-clang/target.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/compiler/xt-clang/target.cmake b/cmake/compiler/xt-clang/target.cmake index 32def2e5b8fe6..978bc7c7860f4 100644 --- a/cmake/compiler/xt-clang/target.cmake +++ b/cmake/compiler/xt-clang/target.cmake @@ -29,5 +29,6 @@ set(LLEXT_APPEND_FLAGS ${LLEXT_APPEND_FLAGS} else() set(LLEXT_APPEND_FLAGS ${LLEXT_APPEND_FLAGS} -ffreestanding + -mno-generate-flix ) endif() From cbb6199e679c50c75d3ed090852b4993e8b06a8a Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Mon, 11 Nov 2024 16:19:08 +0100 Subject: [PATCH 2877/4482] LLEXT: no repeated linking with inline relocations When linking and relocations are performed on the ELF object itself with no copying, also global binding linking can break references. Disable linking globally for such cases. Signed-off-by: Guennadi Liakhovetski --- subsys/llext/llext_link.c | 5 +---- subsys/llext/llext_load.c | 12 +++++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/subsys/llext/llext_link.c b/subsys/llext/llext_link.c index 6d5e2ff23bc75..7dacb112a006a 100644 --- a/subsys/llext/llext_link.c +++ b/subsys/llext/llext_link.c @@ -259,10 +259,7 @@ static void llext_link_plt(struct llext_loader *ldr, struct llext *ext, elf_shdr arch_elf_relocate_global(ldr, ext, &rela, &sym, got_offset, link_addr); break; case STB_LOCAL: - if (ldr_parm->relocate_local) { - arch_elf_relocate_local(ldr, ext, &rela, &sym, got_offset, - ldr_parm); - } + arch_elf_relocate_local(ldr, ext, &rela, &sym, got_offset, ldr_parm); } LOG_DBG("symbol %s offset %#zx r-offset %#zx .text offset %#zx stb %u", diff --git a/subsys/llext/llext_load.c b/subsys/llext/llext_load.c index bd73312c085e2..06f4b9a2f97c4 100644 --- a/subsys/llext/llext_load.c +++ b/subsys/llext/llext_load.c @@ -712,11 +712,13 @@ int do_llext_load(struct llext_loader *ldr, struct llext *ext, goto out; } - LOG_DBG("Linking ELF..."); - ret = llext_link(ldr, ext, ldr_parm); - if (ret != 0) { - LOG_ERR("Failed to link, ret %d", ret); - goto out; + if (ldr_parm->relocate_local) { + LOG_DBG("Linking ELF..."); + ret = llext_link(ldr, ext, ldr_parm); + if (ret != 0) { + LOG_ERR("Failed to link, ret %d", ret); + goto out; + } } ret = llext_export_symbols(ldr, ext); From 1c596b8b7771a65b46788038e66b93f7905d3ecb Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Wed, 20 Nov 2024 07:19:50 -0500 Subject: [PATCH 2878/4482] boards: mps3_corstone300_fvp_ns: disable twister Disable board temporarily as it fetches code from external repositories. Related issue #81656 Signed-off-by: Anas Nashif --- boards/arm/mps3/mps3_corstone300_fvp_ns.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boards/arm/mps3/mps3_corstone300_fvp_ns.yaml b/boards/arm/mps3/mps3_corstone300_fvp_ns.yaml index 1c05bb561d65b..0802a12943425 100644 --- a/boards/arm/mps3/mps3_corstone300_fvp_ns.yaml +++ b/boards/arm/mps3/mps3_corstone300_fvp_ns.yaml @@ -7,6 +7,8 @@ type: mcu arch: arm ram: 2048 flash: 512 +# Related issue #81656 +twister: false toolchain: - gnuarmemb - zephyr From 2894c765a2b2a277f85a016fa05550c2bc9723a3 Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Tue, 19 Nov 2024 11:10:05 -0600 Subject: [PATCH 2879/4482] github: Update security page for v4.0.0 release Updates the GitHub security page with the current supported versions after the v4.0.0 release. Signed-off-by: Mahesh Mahadevan --- .github/SECURITY.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/SECURITY.md b/.github/SECURITY.md index 42354f627cf02..709a2b9cf9412 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -8,9 +8,10 @@ updates: - The most recent release, and the release prior to that. - Active LTS releases. -At this time, with the latest release of v3.6, the supported +At this time, with the latest release of v4.0, the supported versions are: + - v4.0: Current release - v3.7: Current LTS - v3.6: Prior release - v2.7: Prior LTS From e6c9e9a2dde2e038b6b81140ee27556d4b36dc78 Mon Sep 17 00:00:00 2001 From: Jerzy Kasenberg Date: Mon, 18 Nov 2024 11:30:23 +0100 Subject: [PATCH 2880/4482] i2c: target: eeprom_target: Fix buffer write When larger buffer index was introduced only function: eeprom_target_write_received() was updated to handle address-width = 16 This adds the same functionality when buffered API is used, enabled by CONFIG_I2C_TARGET_BUFFER_MODE. Signed-off-by: Jerzy Kasenberg --- drivers/i2c/target/eeprom_target.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/target/eeprom_target.c b/drivers/i2c/target/eeprom_target.c index e2820749b206b..69ae35cfcd8d0 100644 --- a/drivers/i2c/target/eeprom_target.c +++ b/drivers/i2c/target/eeprom_target.c @@ -179,9 +179,19 @@ static void eeprom_target_buf_write_received(struct i2c_target_config *config, struct i2c_eeprom_target_data *data = CONTAINER_OF(config, struct i2c_eeprom_target_data, config); - /* The first byte is offset */ - data->buffer_idx = *ptr; - memcpy(&data->buffer[data->buffer_idx], ptr + 1, len - 1); + /* The first byte(s) is offset */ + uint32_t idx_write_cnt = 0; + + data->buffer_idx = 0; + while (idx_write_cnt < (data->address_width >> 3)) { + data->buffer_idx = (data->buffer_idx << 8) | *ptr++; + len--; + idx_write_cnt++; + } + + if (len > 0) { + memcpy(&data->buffer[data->buffer_idx], ptr, len); + } } static int eeprom_target_buf_read_requested(struct i2c_target_config *config, From 9c2421444ba51c812eaa579e8f7a859e73b78bfa Mon Sep 17 00:00:00 2001 From: Andi Gerl Date: Fri, 8 Nov 2024 15:23:28 -0500 Subject: [PATCH 2881/4482] net: lwm2m: add set_socketoptions cb to pull context LwM2M context The pull context LwM2M client's set_socketoptions callback is currently unused and can't be set by a user. Add a public API to set the pull context's client's set_socketoptions callback. Signed-off-by: Andi Gerl --- include/zephyr/net/lwm2m.h | 14 +++++++++++++- subsys/net/lib/lwm2m/lwm2m_pull_context.c | 6 +++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/include/zephyr/net/lwm2m.h b/include/zephyr/net/lwm2m.h index 9c4590a276790..4aa81a8bcf6ed 100644 --- a/include/zephyr/net/lwm2m.h +++ b/include/zephyr/net/lwm2m.h @@ -182,6 +182,7 @@ enum lwm2m_rd_client_event { typedef void (*lwm2m_ctx_event_cb_t)(struct lwm2m_ctx *ctx, enum lwm2m_rd_client_event event); +typedef int (*lwm2m_set_sockopt_cb_t)(struct lwm2m_ctx *client_ctx); /** * @brief Different traffic states of the LwM2M socket. @@ -259,7 +260,7 @@ struct lwm2m_ctx { * a callback that is called after a socket is created and before * connect. */ - int (*set_socketoptions)(struct lwm2m_ctx *client_ctx); + lwm2m_set_sockopt_cb_t set_socketoptions; /** Flag to indicate if context should use DTLS. * Enabled via the use of coaps:// protocol prefix in connection @@ -1622,6 +1623,17 @@ int lwm2m_security_mode(struct lwm2m_ctx *ctx); */ int lwm2m_set_default_sockopt(struct lwm2m_ctx *ctx); +/** + * @brief Set the @ref lwm2m_ctx::set_socketoptions callback for the pull context's client. + * + * This allows setting specific socket options on the socket that is used to pull + * firmware updates. The callback will be called after the pull context socket has been + * created and before it will connect. + * + * @param[in] set_sockopt_cb A callback function to set sockopts for the pull context client. + */ +void lwm2m_pull_context_set_sockopt_callback(lwm2m_set_sockopt_cb_t set_sockopt_cb); + #ifdef __cplusplus } #endif diff --git a/subsys/net/lib/lwm2m/lwm2m_pull_context.c b/subsys/net/lib/lwm2m/lwm2m_pull_context.c index 356f19705f512..8081c3793edaf 100644 --- a/subsys/net/lib/lwm2m/lwm2m_pull_context.c +++ b/subsys/net/lib/lwm2m/lwm2m_pull_context.c @@ -446,7 +446,6 @@ int lwm2m_pull_context_start_transfer(char *uri, struct requesting_object req, k context.result_cb = req.result_cb; context.write_cb = req.write_cb; - (void)memset(&context.firmware_ctx, 0, sizeof(struct lwm2m_ctx)); (void)memset(&context.block_ctx, 0, sizeof(struct coap_block_context)); context.firmware_ctx.sock_fd = -1; @@ -454,3 +453,8 @@ int lwm2m_pull_context_start_transfer(char *uri, struct requesting_object req, k return 0; } + +void lwm2m_pull_context_set_sockopt_callback(lwm2m_set_sockopt_cb_t set_sockopt_cb) +{ + context.firmware_ctx.set_socketoptions = set_sockopt_cb; +} From 355d032baacab7febccdfff44eac65af951a33b5 Mon Sep 17 00:00:00 2001 From: cyliang tw Date: Tue, 5 Nov 2024 19:01:11 +0800 Subject: [PATCH 2882/4482] boards: nuvoton: numaker: Drop PINCTRL from board defconfig To remove CONFIG_PINCTRL from board side for numaker boards. The Drivers using Pinctrl should be turning Pinctrl on instead of the responsibility of the board. Fixes #78619 Signed-off-by: cyliang tw --- boards/nuvoton/numaker_m2l31ki/numaker_m2l31ki_defconfig | 1 - boards/nuvoton/numaker_pfm_m467/numaker_pfm_m467_defconfig | 1 - boards/nuvoton/numaker_pfm_m487/numaker_pfm_m487_defconfig | 3 +-- drivers/adc/Kconfig.numaker | 1 + drivers/ethernet/Kconfig.numaker | 1 + drivers/gpio/Kconfig.numaker | 1 + drivers/gpio/Kconfig.numicro | 1 + drivers/i2c/Kconfig.numaker | 1 + drivers/pwm/Kconfig.numaker | 1 + drivers/serial/Kconfig.numaker | 1 + drivers/serial/Kconfig.numicro | 1 + drivers/spi/Kconfig.numaker | 1 + drivers/usb/device/Kconfig | 1 + drivers/usb/udc/Kconfig.numaker | 1 + drivers/usb_c/ppc/Kconfig.numaker | 1 + drivers/usb_c/tcpc/Kconfig.tcpc_numaker | 1 + drivers/usb_c/vbus/Kconfig.numaker | 1 + 17 files changed, 15 insertions(+), 4 deletions(-) diff --git a/boards/nuvoton/numaker_m2l31ki/numaker_m2l31ki_defconfig b/boards/nuvoton/numaker_m2l31ki/numaker_m2l31ki_defconfig index e59234cb73c74..a1da5acdf5646 100644 --- a/boards/nuvoton/numaker_m2l31ki/numaker_m2l31ki_defconfig +++ b/boards/nuvoton/numaker_m2l31ki/numaker_m2l31ki_defconfig @@ -1,6 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -CONFIG_PINCTRL=y CONFIG_GPIO=y # Enable system clock controller driver diff --git a/boards/nuvoton/numaker_pfm_m467/numaker_pfm_m467_defconfig b/boards/nuvoton/numaker_pfm_m467/numaker_pfm_m467_defconfig index a5396d157c3cb..921d54e4934b4 100644 --- a/boards/nuvoton/numaker_pfm_m467/numaker_pfm_m467_defconfig +++ b/boards/nuvoton/numaker_pfm_m467/numaker_pfm_m467_defconfig @@ -1,6 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -CONFIG_PINCTRL=y CONFIG_GPIO=y # Enable system clock controller driver diff --git a/boards/nuvoton/numaker_pfm_m487/numaker_pfm_m487_defconfig b/boards/nuvoton/numaker_pfm_m487/numaker_pfm_m487_defconfig index bd250a1e0605a..0873db33cf343 100644 --- a/boards/nuvoton/numaker_pfm_m487/numaker_pfm_m487_defconfig +++ b/boards/nuvoton/numaker_pfm_m487/numaker_pfm_m487_defconfig @@ -4,9 +4,8 @@ CONFIG_ARM_MPU=y CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=192000000 -# Enable GPIO and pinctrl drivers +# Enable GPIO driver CONFIG_GPIO=y -CONFIG_PINCTRL=y # Enable UART driver CONFIG_SERIAL=y diff --git a/drivers/adc/Kconfig.numaker b/drivers/adc/Kconfig.numaker index ea5f1288beba7..b2455843e9f28 100644 --- a/drivers/adc/Kconfig.numaker +++ b/drivers/adc/Kconfig.numaker @@ -7,6 +7,7 @@ config ADC_NUMAKER bool "Nuvoton NuMaker MCU ADC driver" default y select HAS_NUMAKER_ADC + select PINCTRL depends on DT_HAS_NUVOTON_NUMAKER_ADC_ENABLED help This option enables the ADC driver for Nuvoton NuMaker family of diff --git a/drivers/ethernet/Kconfig.numaker b/drivers/ethernet/Kconfig.numaker index eb757870d7b50..a21462bac746e 100644 --- a/drivers/ethernet/Kconfig.numaker +++ b/drivers/ethernet/Kconfig.numaker @@ -7,6 +7,7 @@ config ETH_NUMAKER bool "Nuvoton NUMAKER MCU Ethernet driver" default y select HAS_NUMAKER_ETH + select PINCTRL depends on DT_HAS_NUVOTON_NUMAKER_ETHERNET_ENABLED help This option enables the Ethernet driver for Nuvoton NuMaker family of diff --git a/drivers/gpio/Kconfig.numaker b/drivers/gpio/Kconfig.numaker index 8c1615fbff35c..59f08cc7b4780 100644 --- a/drivers/gpio/Kconfig.numaker +++ b/drivers/gpio/Kconfig.numaker @@ -7,6 +7,7 @@ config GPIO_NUMAKER bool "Nuvoton NUMAKER MCU gpio driver" default y select HAS_NUMAKER_GPIO + select PINCTRL depends on DT_HAS_NUVOTON_NUMAKER_GPIO_ENABLED help This option enables the GPIO driver for Nuvoton NUMAKER family of diff --git a/drivers/gpio/Kconfig.numicro b/drivers/gpio/Kconfig.numicro index d410d77047f5f..f706357aa9148 100644 --- a/drivers/gpio/Kconfig.numicro +++ b/drivers/gpio/Kconfig.numicro @@ -6,6 +6,7 @@ config GPIO_NUMICRO bool "Nuvoton NuMicro GPIO driver" default y + select PINCTRL depends on DT_HAS_NUVOTON_NUMICRO_GPIO_ENABLED help Enable the GPIO driver for the NuMicro family of processors. diff --git a/drivers/i2c/Kconfig.numaker b/drivers/i2c/Kconfig.numaker index 622592cd020d1..32462565ea262 100644 --- a/drivers/i2c/Kconfig.numaker +++ b/drivers/i2c/Kconfig.numaker @@ -7,6 +7,7 @@ config I2C_NUMAKER bool "Nuvoton NuMaker I2C driver" default y select HAS_NUMAKER_I2C + select PINCTRL depends on DT_HAS_NUVOTON_NUMAKER_I2C_ENABLED help This option enables I2C driver for Nuvoton NuMaker family of diff --git a/drivers/pwm/Kconfig.numaker b/drivers/pwm/Kconfig.numaker index ae3d5f1b00924..c338a0ea5aaea 100644 --- a/drivers/pwm/Kconfig.numaker +++ b/drivers/pwm/Kconfig.numaker @@ -7,6 +7,7 @@ config PWM_NUMAKER bool "Nuvoton NuMaker MCU PWM driver" default y select HAS_NUMAKER_PWM + select PINCTRL depends on DT_HAS_NUVOTON_NUMAKER_PWM_ENABLED help This option enables the PWM driver for Nuvoton NuMaker family of diff --git a/drivers/serial/Kconfig.numaker b/drivers/serial/Kconfig.numaker index ba737a111f51c..85fb81583d1e6 100644 --- a/drivers/serial/Kconfig.numaker +++ b/drivers/serial/Kconfig.numaker @@ -9,6 +9,7 @@ config UART_NUMAKER select SERIAL_HAS_DRIVER select HAS_NUMAKER_UART select SERIAL_SUPPORT_INTERRUPT + select PINCTRL depends on DT_HAS_NUVOTON_NUMAKER_UART_ENABLED help This option enables the UART driver for Nuvoton Numaker family of diff --git a/drivers/serial/Kconfig.numicro b/drivers/serial/Kconfig.numicro index 25bc6a0edc8d4..ea9bd240725f0 100644 --- a/drivers/serial/Kconfig.numicro +++ b/drivers/serial/Kconfig.numicro @@ -11,6 +11,7 @@ config UART_NUMICRO depends on DT_HAS_NUVOTON_NUMICRO_UART_ENABLED select SERIAL_HAS_DRIVER select HAS_NUMICRO_UART + select PINCTRL help This option enables the UART driver for Nuvoton Numicro family of processors. diff --git a/drivers/spi/Kconfig.numaker b/drivers/spi/Kconfig.numaker index 2467c146fbf22..7850321b9630d 100644 --- a/drivers/spi/Kconfig.numaker +++ b/drivers/spi/Kconfig.numaker @@ -7,6 +7,7 @@ config SPI_NUMAKER bool "Nuvoton NuMaker MCU SPI driver" default y select HAS_NUMAKER_SPI + select PINCTRL depends on DT_HAS_NUVOTON_NUMAKER_SPI_ENABLED help This option enables the SPI driver for Nuvoton NuMaker family of diff --git a/drivers/usb/device/Kconfig b/drivers/usb/device/Kconfig index ab17819538191..346bdd3cc6d16 100644 --- a/drivers/usb/device/Kconfig +++ b/drivers/usb/device/Kconfig @@ -204,6 +204,7 @@ config USB_DC_NUMAKER bool "Nuvoton NuMaker USB 1.1 device controller" default y depends on DT_HAS_NUVOTON_NUMAKER_USBD_ENABLED + select PINCTRL help Enable Nuvoton NuMaker USB 1.1 device controller driver diff --git a/drivers/usb/udc/Kconfig.numaker b/drivers/usb/udc/Kconfig.numaker index 8b7e59fd43449..bb2c275030464 100644 --- a/drivers/usb/udc/Kconfig.numaker +++ b/drivers/usb/udc/Kconfig.numaker @@ -5,6 +5,7 @@ config UDC_NUMAKER bool "Nuvoton NuMaker USB 1.1 device controller" default y depends on DT_HAS_NUVOTON_NUMAKER_USBD_ENABLED + select PINCTRL help Enable Nuvoton NuMaker USB 1.1 device controller driver diff --git a/drivers/usb_c/ppc/Kconfig.numaker b/drivers/usb_c/ppc/Kconfig.numaker index 4edec3a569ab6..f0d909f5fcbd3 100644 --- a/drivers/usb_c/ppc/Kconfig.numaker +++ b/drivers/usb_c/ppc/Kconfig.numaker @@ -7,5 +7,6 @@ config USBC_PPC_NUMAKER bool "Nuvoton NuMaker USB-C PPC" default y depends on DT_HAS_NUVOTON_NUMAKER_PPC_ENABLED && USBC_TCPC_NUMAKER + select PINCTRL help Enable USB-C PPC support for Nuvoton NuMaker chip with UTCPD. diff --git a/drivers/usb_c/tcpc/Kconfig.tcpc_numaker b/drivers/usb_c/tcpc/Kconfig.tcpc_numaker index 042a2e5e197f0..10ebce95bc6f6 100644 --- a/drivers/usb_c/tcpc/Kconfig.tcpc_numaker +++ b/drivers/usb_c/tcpc/Kconfig.tcpc_numaker @@ -8,6 +8,7 @@ config USBC_TCPC_NUMAKER default y select HAS_NUMAKER_ADC select HAS_NUMAKER_TMR + select PINCTRL depends on DT_HAS_NUVOTON_NUMAKER_TCPC_ENABLED help Enable USB-C TCPC support for Nuvoton NuMaker chip with UTCPD. diff --git a/drivers/usb_c/vbus/Kconfig.numaker b/drivers/usb_c/vbus/Kconfig.numaker index 0cb85025edb48..9a7ce1aabffab 100644 --- a/drivers/usb_c/vbus/Kconfig.numaker +++ b/drivers/usb_c/vbus/Kconfig.numaker @@ -7,5 +7,6 @@ config USBC_VBUS_NUMAKER bool "Nuvoton NuMaker USB-C VBUS" default y depends on DT_HAS_NUVOTON_NUMAKER_VBUS_ENABLED && USBC_TCPC_NUMAKER + select PINCTRL help Enable USB-C VBUS support for Nuvoton NuMaker chip with UTCPD. From 10bb61ee7d0a05bd2d21a42c61a982b0edc26eea Mon Sep 17 00:00:00 2001 From: Noemie Gillet Date: Tue, 29 Oct 2024 13:34:11 +0100 Subject: [PATCH 2883/4482] drivers: nsos: support for AF_UNIX Handle AF_UNIX family sockets for NSOS offloaded driver Note that the size of struct sockaddr_un is done conditionnaly based on CONFIG_NET_NATIVE_OFFLOADED_SOCKETS Also, NET_SOCKADDR_PTR_MAX_SIZE needs to be updated only if CONFIG_NET_SOCKETS_PACKET is not set. Otherwise, for a AF_PACKET socket, a struct net_context variable can be corrupted, as local would have be on 16 bytes instead of 20 bytes. Signed-off-by: Noemie Gillet --- drivers/net/nsos.h | 10 ++++++++++ drivers/net/nsos_adapt.c | 37 +++++++++++++++++++++++++++++++++++++ drivers/net/nsos_sockets.c | 24 ++++++++++++++++++++++++ include/zephyr/net/net_ip.h | 19 +++++++++++++++++++ 4 files changed, 90 insertions(+) diff --git a/drivers/net/nsos.h b/drivers/net/nsos.h index f1e2f12eb553f..37fd16a416ae9 100644 --- a/drivers/net/nsos.h +++ b/drivers/net/nsos.h @@ -14,11 +14,13 @@ #define NSOS_MID_PF_UNSPEC 0 /**< Unspecified protocol family. */ #define NSOS_MID_PF_INET 1 /**< IP protocol family version 4. */ #define NSOS_MID_PF_INET6 2 /**< IP protocol family version 6. */ +#define NSOS_MID_PF_UNIX 6 /**< Unix protocol. */ /* Address families. */ #define NSOS_MID_AF_UNSPEC NSOS_MID_PF_UNSPEC /**< Unspecified address family. */ #define NSOS_MID_AF_INET NSOS_MID_PF_INET /**< IP protocol family version 4. */ #define NSOS_MID_AF_INET6 NSOS_MID_PF_INET6 /**< IP protocol family version 6. */ +#define NSOS_MID_AF_UNIX NSOS_MID_PF_UNIX /**< Unix protocol. */ /** Protocol numbers from IANA/BSD */ enum nsos_mid_net_ip_protocol { @@ -63,10 +65,18 @@ struct nsos_mid_sockaddr_in6 { uint32_t sin6_scope_id; /* Set of interfaces for a scope */ }; +#define UNIX_PATH_MAX 108 +struct nsos_mid_sockaddr_un { + sa_family_t sun_family; /* AF_UNIX */ + char sun_path[UNIX_PATH_MAX]; /* pathname */ +}; + + struct nsos_mid_sockaddr_storage { union { struct nsos_mid_sockaddr_in sockaddr_in; struct nsos_mid_sockaddr_in6 sockaddr_in6; + struct nsos_mid_sockaddr_un sockaddr_un; }; }; diff --git a/drivers/net/nsos_adapt.c b/drivers/net/nsos_adapt.c index af98caaa4c15c..d51bc0165ecef 100644 --- a/drivers/net/nsos_adapt.c +++ b/drivers/net/nsos_adapt.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "nsos.h" @@ -68,6 +69,9 @@ static int socket_family_from_nsos_mid(int family_mid, int *family) case NSOS_MID_AF_INET6: *family = AF_INET6; break; + case NSOS_MID_AF_UNIX: + *family = AF_UNIX; + break; default: nsi_print_warning("%s: socket family %d not supported\n", __func__, family_mid); return -NSOS_MID_EAFNOSUPPORT; @@ -88,6 +92,9 @@ static int socket_family_to_nsos_mid(int family, int *family_mid) case AF_INET6: *family_mid = NSOS_MID_AF_INET6; break; + case AF_UNIX: + *family_mid = NSOS_MID_AF_UNIX; + break; default: nsi_print_warning("%s: socket family %d not supported\n", __func__, family); return -NSOS_MID_EAFNOSUPPORT; @@ -296,6 +303,19 @@ static int sockaddr_from_nsos_mid(struct sockaddr **addr, socklen_t *addrlen, return 0; } + case NSOS_MID_AF_UNIX: { + const struct nsos_mid_sockaddr_un *addr_un_mid = + (const struct nsos_mid_sockaddr_un *)addr_mid; + struct sockaddr_un *addr_un = (struct sockaddr_un *)*addr; + + addr_un->sun_family = AF_UNIX; + memcpy(addr_un->sun_path, addr_un_mid->sun_path, + sizeof(addr_un->sun_path)); + + *addrlen = sizeof(*addr_un); + + return 0; + } } return -NSOS_MID_EINVAL; @@ -347,6 +367,23 @@ static int sockaddr_to_nsos_mid(const struct sockaddr *addr, socklen_t addrlen, return 0; } + case AF_UNIX: { + struct nsos_mid_sockaddr_un *addr_un_mid = + (struct nsos_mid_sockaddr_un *)addr_mid; + const struct sockaddr_un *addr_un = (const struct sockaddr_un *)addr; + + if (addr_un_mid) { + addr_un_mid->sun_family = NSOS_MID_AF_UNIX; + memcpy(addr_un_mid->sun_path, addr_un->sun_path, + sizeof(addr_un_mid->sun_path)); + } + + if (addrlen_mid) { + *addrlen_mid = sizeof(*addr_un); + } + + return 0; + } } nsi_print_warning("%s: socket family %d not supported\n", __func__, addr->sa_family); diff --git a/drivers/net/nsos_sockets.c b/drivers/net/nsos_sockets.c index bfd8cb2c7f3e6..ec9c8952e5509 100644 --- a/drivers/net/nsos_sockets.c +++ b/drivers/net/nsos_sockets.c @@ -72,6 +72,9 @@ static int socket_family_to_nsos_mid(int family, int *family_mid) case AF_INET6: *family_mid = NSOS_MID_AF_INET6; break; + case AF_UNIX: + *family_mid = NSOS_MID_AF_UNIX; + break; default: return -NSOS_MID_EAFNOSUPPORT; } @@ -448,6 +451,24 @@ static int sockaddr_to_nsos_mid(const struct sockaddr *addr, socklen_t addrlen, return 0; } + case AF_UNIX: { + const struct sockaddr_un *addr_un = + (const struct sockaddr_un *)addr; + struct nsos_mid_sockaddr_un *addr_un_mid = + (struct nsos_mid_sockaddr_un *)*addr_mid; + + if (addrlen < sizeof(*addr_un)) { + return -NSOS_MID_EINVAL; + } + + addr_un_mid->sun_family = NSOS_MID_AF_UNIX; + memcpy(addr_un_mid->sun_path, addr_un->sun_path, + sizeof(addr_un_mid->sun_path)); + + *addrlen_mid = sizeof(*addr_un_mid); + + return 0; + } } return -NSOS_MID_EINVAL; @@ -946,6 +967,9 @@ static int socket_family_from_nsos_mid(int family_mid, int *family) case NSOS_MID_AF_INET6: *family = AF_INET6; break; + case NSOS_MID_AF_UNIX: + *family = AF_UNIX; + break; default: return -NSOS_MID_EAFNOSUPPORT; } diff --git a/include/zephyr/net/net_ip.h b/include/zephyr/net/net_ip.h index c60498b7f5af0..ed3c7419558fb 100644 --- a/include/zephyr/net/net_ip.h +++ b/include/zephyr/net/net_ip.h @@ -231,6 +231,12 @@ struct sockaddr_ll_ptr { uint8_t *sll_addr; /**< Physical-layer address, big endian */ }; +/** Socket address struct for unix socket where address is a pointer */ +struct sockaddr_un_ptr { + sa_family_t sun_family; /**< Always AF_UNIX */ + char *sun_path; /**< pathname */ +}; + struct sockaddr_can_ptr { sa_family_t can_family; int can_ifindex; @@ -373,14 +379,27 @@ struct cmsghdr { #endif #endif +#if defined(CONFIG_NET_NATIVE_OFFLOADED_SOCKETS) +#define UNIX_PATH_MAX 108 +#undef NET_SOCKADDR_MAX_SIZE +/* Define NET_SOCKADDR_MAX_SIZE to be struct of sa_family_t + char[UNIX_PATH_MAX] */ +#define NET_SOCKADDR_MAX_SIZE (UNIX_PATH_MAX+sizeof(sa_family_t)) +#if !defined(CONFIG_NET_SOCKETS_PACKET) +#undef NET_SOCKADDR_PTR_MAX_SIZE +#define NET_SOCKADDR_PTR_MAX_SIZE (sizeof(struct sockaddr_un_ptr)) +#endif +#endif + #if !defined(CONFIG_NET_IPV4) #if !defined(CONFIG_NET_IPV6) #if !defined(CONFIG_NET_SOCKETS_PACKET) +#if !defined(CONFIG_NET_NATIVE_OFFLOADED_SOCKETS) #define NET_SOCKADDR_MAX_SIZE (sizeof(struct sockaddr_in6)) #define NET_SOCKADDR_PTR_MAX_SIZE (sizeof(struct sockaddr_in6_ptr)) #endif #endif #endif +#endif /** @endcond */ From 2253a26c10ec0dd38219d672f7bf8704949c4b88 Mon Sep 17 00:00:00 2001 From: Noemie Gillet Date: Tue, 29 Oct 2024 13:35:10 +0100 Subject: [PATCH 2884/4482] drivers: nsos: support for AF_PACKET Handle AF_PACKET family. Signed-off-by: Noemie Gillet --- drivers/net/nsos.h | 13 ++++++++++ drivers/net/nsos_adapt.c | 49 +++++++++++++++++++++++++++++++++++++ drivers/net/nsos_sockets.c | 35 ++++++++++++++++++++++++++ include/zephyr/net/net_ip.h | 1 + 4 files changed, 98 insertions(+) diff --git a/drivers/net/nsos.h b/drivers/net/nsos.h index 37fd16a416ae9..9b901d9189c97 100644 --- a/drivers/net/nsos.h +++ b/drivers/net/nsos.h @@ -15,18 +15,21 @@ #define NSOS_MID_PF_INET 1 /**< IP protocol family version 4. */ #define NSOS_MID_PF_INET6 2 /**< IP protocol family version 6. */ #define NSOS_MID_PF_UNIX 6 /**< Unix protocol. */ +#define NSOS_MID_PF_PACKET 3 /**< Packet family. */ /* Address families. */ #define NSOS_MID_AF_UNSPEC NSOS_MID_PF_UNSPEC /**< Unspecified address family. */ #define NSOS_MID_AF_INET NSOS_MID_PF_INET /**< IP protocol family version 4. */ #define NSOS_MID_AF_INET6 NSOS_MID_PF_INET6 /**< IP protocol family version 6. */ #define NSOS_MID_AF_UNIX NSOS_MID_PF_UNIX /**< Unix protocol. */ +#define NSOS_MID_AF_PACKET NSOS_MID_PF_PACKET /**< Packet family. */ /** Protocol numbers from IANA/BSD */ enum nsos_mid_net_ip_protocol { NSOS_MID_IPPROTO_IP = 0, /**< IP protocol (pseudo-val for setsockopt() */ NSOS_MID_IPPROTO_ICMP = 1, /**< ICMP protocol */ NSOS_MID_IPPROTO_IGMP = 2, /**< IGMP protocol */ + NSOS_MID_IPPROTO_ETH_P_ALL = 3, /**< Every packet. from linux if_ether.h */ NSOS_MID_IPPROTO_IPIP = 4, /**< IPIP tunnels */ NSOS_MID_IPPROTO_TCP = 6, /**< TCP protocol */ NSOS_MID_IPPROTO_UDP = 17, /**< UDP protocol */ @@ -71,12 +74,22 @@ struct nsos_mid_sockaddr_un { char sun_path[UNIX_PATH_MAX]; /* pathname */ }; +struct nsos_mid_sockaddr_ll { + sa_family_t sll_family; /**< Always AF_PACKET */ + uint16_t sll_protocol; /**< Physical-layer protocol */ + int sll_ifindex; /**< Interface number */ + uint16_t sll_hatype; /**< ARP hardware type */ + uint8_t sll_pkttype; /**< Packet type */ + uint8_t sll_halen; /**< Length of address */ + uint8_t sll_addr[8]; /**< Physical-layer address, big endian */ +}; struct nsos_mid_sockaddr_storage { union { struct nsos_mid_sockaddr_in sockaddr_in; struct nsos_mid_sockaddr_in6 sockaddr_in6; struct nsos_mid_sockaddr_un sockaddr_un; + struct nsos_mid_sockaddr_ll sockaddr_ll; }; }; diff --git a/drivers/net/nsos_adapt.c b/drivers/net/nsos_adapt.c index d51bc0165ecef..09da353f73115 100644 --- a/drivers/net/nsos_adapt.c +++ b/drivers/net/nsos_adapt.c @@ -17,6 +17,8 @@ #include #include #include +#include +#include #include #include #include @@ -72,6 +74,9 @@ static int socket_family_from_nsos_mid(int family_mid, int *family) case NSOS_MID_AF_UNIX: *family = AF_UNIX; break; + case NSOS_MID_AF_PACKET: + *family = AF_PACKET; + break; default: nsi_print_warning("%s: socket family %d not supported\n", __func__, family_mid); return -NSOS_MID_EAFNOSUPPORT; @@ -95,6 +100,9 @@ static int socket_family_to_nsos_mid(int family, int *family_mid) case AF_UNIX: *family_mid = NSOS_MID_AF_UNIX; break; + case AF_PACKET: + *family_mid = NSOS_MID_AF_PACKET; + break; default: nsi_print_warning("%s: socket family %d not supported\n", __func__, family); return -NSOS_MID_EAFNOSUPPORT; @@ -130,6 +138,9 @@ static int socket_proto_from_nsos_mid(int proto_mid, int *proto) case NSOS_MID_IPPROTO_RAW: *proto = IPPROTO_RAW; break; + case NSOS_MID_IPPROTO_ETH_P_ALL: + *proto = htons(ETH_P_ALL); + break; default: nsi_print_warning("%s: socket protocol %d not supported\n", __func__, proto_mid); return -NSOS_MID_EPROTONOSUPPORT; @@ -165,6 +176,9 @@ static int socket_proto_to_nsos_mid(int proto, int *proto_mid) case IPPROTO_RAW: *proto_mid = NSOS_MID_IPPROTO_RAW; break; + case ETH_P_ALL: + *proto_mid = htons(NSOS_MID_IPPROTO_ETH_P_ALL); + break; default: nsi_print_warning("%s: socket protocol %d not supported\n", __func__, proto); return -NSOS_MID_EPROTONOSUPPORT; @@ -316,6 +330,24 @@ static int sockaddr_from_nsos_mid(struct sockaddr **addr, socklen_t *addrlen, return 0; } + case NSOS_MID_AF_PACKET: { + const struct nsos_mid_sockaddr_ll *addr_ll_mid = + (const struct nsos_mid_sockaddr_ll *)addr_mid; + struct sockaddr_ll *addr_ll = (struct sockaddr_ll *)*addr; + + addr_ll->sll_family = NSOS_MID_AF_PACKET; + addr_ll->sll_protocol = addr_ll_mid->sll_protocol; + addr_ll->sll_ifindex = addr_ll_mid->sll_ifindex; + addr_ll->sll_hatype = addr_ll_mid->sll_hatype; + addr_ll->sll_pkttype = addr_ll_mid->sll_pkttype; + addr_ll->sll_halen = addr_ll_mid->sll_halen; + memcpy(addr_ll->sll_addr, addr_ll_mid->sll_addr, + sizeof(addr_ll->sll_addr)); + + *addrlen = sizeof(*addr_ll); + + return 0; + } } return -NSOS_MID_EINVAL; @@ -384,6 +416,23 @@ static int sockaddr_to_nsos_mid(const struct sockaddr *addr, socklen_t addrlen, return 0; } + case AF_PACKET: { + struct nsos_mid_sockaddr_ll *addr_ll_mid = + (struct nsos_mid_sockaddr_ll *)addr_mid; + const struct sockaddr_ll *addr_ll = (const struct sockaddr_ll *)addr; + + if (addr_ll_mid) { + addr_ll_mid->sll_family = NSOS_MID_AF_PACKET; + addr_ll_mid->sll_protocol = addr_ll->sll_protocol; + addr_ll_mid->sll_ifindex = addr_ll->sll_ifindex; + } + + if (addrlen_mid) { + *addrlen_mid = sizeof(*addr_ll); + } + + return 0; + } } nsi_print_warning("%s: socket family %d not supported\n", __func__, addr->sa_family); diff --git a/drivers/net/nsos_sockets.c b/drivers/net/nsos_sockets.c index ec9c8952e5509..6a1cc7637391a 100644 --- a/drivers/net/nsos_sockets.c +++ b/drivers/net/nsos_sockets.c @@ -75,6 +75,9 @@ static int socket_family_to_nsos_mid(int family, int *family_mid) case AF_UNIX: *family_mid = NSOS_MID_AF_UNIX; break; + case AF_PACKET: + *family_mid = NSOS_MID_AF_PACKET; + break; default: return -NSOS_MID_EAFNOSUPPORT; } @@ -109,6 +112,9 @@ static int socket_proto_to_nsos_mid(int proto, int *proto_mid) case IPPROTO_RAW: *proto_mid = NSOS_MID_IPPROTO_RAW; break; + case htons(IPPROTO_ETH_P_ALL): + *proto_mid = NSOS_MID_IPPROTO_ETH_P_ALL; + break; default: return -NSOS_MID_EPROTONOSUPPORT; } @@ -469,6 +475,29 @@ static int sockaddr_to_nsos_mid(const struct sockaddr *addr, socklen_t addrlen, return 0; } + case AF_PACKET: { + const struct sockaddr_ll *addr_ll = + (const struct sockaddr_ll *)addr; + struct nsos_mid_sockaddr_ll *addr_ll_mid = + (struct nsos_mid_sockaddr_ll *)*addr_mid; + + if (addrlen < sizeof(*addr_ll)) { + return -NSOS_MID_EINVAL; + } + + addr_ll_mid->sll_family = NSOS_MID_AF_UNIX; + addr_ll_mid->sll_protocol = addr_ll->sll_protocol; + addr_ll_mid->sll_ifindex = addr_ll->sll_ifindex; + addr_ll_mid->sll_hatype = addr_ll->sll_hatype; + addr_ll_mid->sll_pkttype = addr_ll->sll_pkttype; + addr_ll_mid->sll_halen = addr_ll->sll_halen; + memcpy(addr_ll_mid->sll_addr, addr_ll->sll_addr, + sizeof(addr_ll->sll_addr)); + + *addrlen_mid = sizeof(*addr_ll_mid); + + return 0; + } } return -NSOS_MID_EINVAL; @@ -948,6 +977,9 @@ static int socket_proto_from_nsos_mid(int proto_mid, int *proto) case NSOS_MID_IPPROTO_RAW: *proto = IPPROTO_RAW; break; + case NSOS_MID_IPPROTO_ETH_P_ALL: + *proto = htons(IPPROTO_ETH_P_ALL); + break; default: return -NSOS_MID_EPROTONOSUPPORT; } @@ -970,6 +1002,9 @@ static int socket_family_from_nsos_mid(int family_mid, int *family) case NSOS_MID_AF_UNIX: *family = AF_UNIX; break; + case NSOS_MID_AF_PACKET: + *family = AF_PACKET; + break; default: return -NSOS_MID_EAFNOSUPPORT; } diff --git a/include/zephyr/net/net_ip.h b/include/zephyr/net/net_ip.h index ed3c7419558fb..214b90cd3055a 100644 --- a/include/zephyr/net/net_ip.h +++ b/include/zephyr/net/net_ip.h @@ -65,6 +65,7 @@ enum net_ip_protocol { IPPROTO_IP = 0, /**< IP protocol (pseudo-val for setsockopt() */ IPPROTO_ICMP = 1, /**< ICMP protocol */ IPPROTO_IGMP = 2, /**< IGMP protocol */ + IPPROTO_ETH_P_ALL = 3, /**< Every packet. from linux if_ether.h */ IPPROTO_IPIP = 4, /**< IPIP tunnels */ IPPROTO_TCP = 6, /**< TCP protocol */ IPPROTO_UDP = 17, /**< UDP protocol */ From 9eee2eaee6e3cbbed21cc96e8f08a3c660c9c011 Mon Sep 17 00:00:00 2001 From: Volodymyr Fialko Date: Wed, 23 Oct 2024 14:07:24 +0200 Subject: [PATCH 2885/4482] riscv: pmp: enable stackguard without multithreading Without multithreading only two stacks present: ISR and main. As any stack they also could overflow, so it make sense to add stack guard for them also. Remove stack guard dependency on multithreading and mark `Z_RISCV_STACK_GUARD_SIZE` bytes at the beginning of stack as read-only region with PMP entry. Signed-off-by: Volodymyr Fialko --- arch/riscv/Kconfig | 1 - arch/riscv/core/fatal.c | 10 ++++++++++ arch/riscv/core/pmp.c | 24 +++++++++++++++++++++--- kernel/include/kernel_internal.h | 1 + 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 8f426d09d3f03..7314a1923e245 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -337,7 +337,6 @@ endif #RISCV_PMP config PMP_STACK_GUARD def_bool y - depends on MULTITHREADING depends on HW_STACK_PROTECTION config PMP_STACK_GUARD_MIN_SIZE diff --git a/arch/riscv/core/fatal.c b/arch/riscv/core/fatal.c index d5cbd2f4dc144..879ffab9a8095 100644 --- a/arch/riscv/core/fatal.c +++ b/arch/riscv/core/fatal.c @@ -172,11 +172,21 @@ static bool bad_stack_pointer(struct arch_esf *esf) } #endif /* CONFIG_USERSPACE */ +#if CONFIG_MULTITHREADING if (sp >= _current->stack_info.start - K_KERNEL_STACK_RESERVED && sp < _current->stack_info.start - K_KERNEL_STACK_RESERVED + Z_RISCV_STACK_GUARD_SIZE) { return true; } +#else + uintptr_t isr_stack = (uintptr_t)z_interrupt_stacks; + uintptr_t main_stack = (uintptr_t)z_main_stack; + + if ((sp >= isr_stack && sp < isr_stack + Z_RISCV_STACK_GUARD_SIZE) || + (sp >= main_stack && sp < main_stack + Z_RISCV_STACK_GUARD_SIZE)) { + return true; + } +#endif /* CONFIG_MULTITHREADING */ #endif /* CONFIG_PMP_STACK_GUARD */ #ifdef CONFIG_USERSPACE diff --git a/arch/riscv/core/pmp.c b/arch/riscv/core/pmp.c index e41eb8d4bb080..e29c8abd76d61 100644 --- a/arch/riscv/core/pmp.c +++ b/arch/riscv/core/pmp.c @@ -348,8 +348,8 @@ static unsigned int global_pmp_end_index; */ void z_riscv_pmp_init(void) { - unsigned long pmp_addr[5]; - unsigned long pmp_cfg[2]; + unsigned long pmp_addr[CONFIG_PMP_SLOTS]; + unsigned long pmp_cfg[CONFIG_PMP_SLOTS / PMPCFG_STRIDE]; unsigned int index = 0; /* The read-only area is always there for every mode */ @@ -370,6 +370,7 @@ void z_riscv_pmp_init(void) #endif #ifdef CONFIG_PMP_STACK_GUARD +#ifdef CONFIG_MULTITHREADING /* * Set the stack guard for this CPU's IRQ stack by making the bottom * addresses inaccessible. This will never change so we do it here @@ -396,6 +397,21 @@ void z_riscv_pmp_init(void) /* And forget about that last entry as we won't need it later */ index--; +#else + /* Without multithreading setup stack guards for IRQ and main stacks */ + set_pmp_entry(&index, PMP_NONE | PMP_L, + (uintptr_t)z_interrupt_stacks, + Z_RISCV_STACK_GUARD_SIZE, + pmp_addr, pmp_cfg, ARRAY_SIZE(pmp_addr)); + + set_pmp_entry(&index, PMP_NONE | PMP_L, + (uintptr_t)z_main_stack, + Z_RISCV_STACK_GUARD_SIZE, + pmp_addr, pmp_cfg, ARRAY_SIZE(pmp_addr)); + + /* Write those entries to PMP regs. */ + write_pmp_entries(0, index, true, pmp_addr, pmp_cfg, ARRAY_SIZE(pmp_addr)); +#endif /* CONFIG_MULTITHREADING */ #else /* Write those entries to PMP regs. */ write_pmp_entries(0, index, true, pmp_addr, pmp_cfg, ARRAY_SIZE(pmp_addr)); @@ -419,7 +435,6 @@ void z_riscv_pmp_init(void) } #endif - __ASSERT(index <= PMPCFG_STRIDE, "provision for one global word only"); global_pmp_cfg[0] = pmp_cfg[0]; global_pmp_last_addr = pmp_addr[index - 1]; global_pmp_end_index = index; @@ -454,6 +469,7 @@ static inline unsigned int z_riscv_pmp_thread_init(unsigned long *pmp_addr, #ifdef CONFIG_PMP_STACK_GUARD +#ifdef CONFIG_MULTITHREADING /** * @brief Prepare the PMP stackguard content for given thread. * @@ -511,6 +527,8 @@ void z_riscv_pmp_stackguard_enable(struct k_thread *thread) csr_set(mstatus, MSTATUS_MPRV); } +#endif /* CONFIG_MULTITHREADING */ + /** * @brief Remove PMP stackguard content to actual PMP registers */ diff --git a/kernel/include/kernel_internal.h b/kernel/include/kernel_internal.h index bb9ee4b01f1e6..94f90ce94624c 100644 --- a/kernel/include/kernel_internal.h +++ b/kernel/include/kernel_internal.h @@ -152,6 +152,7 @@ extern struct k_thread z_idle_threads[CONFIG_MP_MAX_NUM_CPUS]; #endif /* CONFIG_MULTITHREADING */ K_KERNEL_PINNED_STACK_ARRAY_DECLARE(z_interrupt_stacks, CONFIG_MP_MAX_NUM_CPUS, CONFIG_ISR_STACK_SIZE); +K_THREAD_STACK_DECLARE(z_main_stack, CONFIG_MAIN_STACK_SIZE); #ifdef CONFIG_GEN_PRIV_STACKS extern uint8_t *z_priv_stack_find(k_thread_stack_t *stack); From 131085634856695f6e1293f1921490aabe485ebe Mon Sep 17 00:00:00 2001 From: Volodymyr Fialko Date: Mon, 18 Nov 2024 09:23:39 +0100 Subject: [PATCH 2886/4482] tests: riscv: test PMP stack guards Test if PMP protected regions prevents write access. Signed-off-by: Volodymyr Fialko --- .../pmp/no-multithreading/CMakeLists.txt | 13 +++ .../arch/riscv/pmp/no-multithreading/prj.conf | 2 + .../riscv/pmp/no-multithreading/src/main.c | 79 +++++++++++++++++++ .../riscv/pmp/no-multithreading/testcase.yaml | 13 +++ 4 files changed, 107 insertions(+) create mode 100644 tests/arch/riscv/pmp/no-multithreading/CMakeLists.txt create mode 100644 tests/arch/riscv/pmp/no-multithreading/prj.conf create mode 100644 tests/arch/riscv/pmp/no-multithreading/src/main.c create mode 100644 tests/arch/riscv/pmp/no-multithreading/testcase.yaml diff --git a/tests/arch/riscv/pmp/no-multithreading/CMakeLists.txt b/tests/arch/riscv/pmp/no-multithreading/CMakeLists.txt new file mode 100644 index 0000000000000..e0f392177d6f3 --- /dev/null +++ b/tests/arch/riscv/pmp/no-multithreading/CMakeLists.txt @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(riscv_pmp) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) + +target_include_directories(app PRIVATE + ${ZEPHYR_BASE}/kernel/include + ${ZEPHYR_BASE}/arch/${ARCH}/include + ) diff --git a/tests/arch/riscv/pmp/no-multithreading/prj.conf b/tests/arch/riscv/pmp/no-multithreading/prj.conf new file mode 100644 index 0000000000000..7414c11237a8a --- /dev/null +++ b/tests/arch/riscv/pmp/no-multithreading/prj.conf @@ -0,0 +1,2 @@ +CONFIG_ZTEST=y +CONFIG_MULTITHREADING=n diff --git a/tests/arch/riscv/pmp/no-multithreading/src/main.c b/tests/arch/riscv/pmp/no-multithreading/src/main.c new file mode 100644 index 0000000000000..26ded61165f7a --- /dev/null +++ b/tests/arch/riscv/pmp/no-multithreading/src/main.c @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2024 Marvell. + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +static volatile ZTEST_BMEM bool valid_fault; + +void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf) +{ + int rv = TC_PASS; + + TC_PRINT("Caught system error -- reason %d %d\n", reason, valid_fault); + if (!valid_fault) { + TC_PRINT("Fatal error was unexpected, aborting...\n"); + rv = TC_FAIL; + } + TC_END_RESULT_CUSTOM(rv, "test_pmp"); + TC_END_REPORT(rv); + arch_system_halt(reason); +} + +#ifdef CONFIG_PMP_STACK_GUARD +static void check_isr_stack_guard(void) +{ + char *isr_stack = (char *)z_interrupt_stacks; + + valid_fault = true; + *isr_stack = 42; +} + +static void check_main_stack_guard(void) +{ + char *main_stack = (char *)z_main_stack; + + valid_fault = true; + *main_stack = 42; +} + +#else + +static void check_isr_stack_guard(void) +{ + ztest_test_skip(); +} + +static void check_main_stack_guard(void) +{ + ztest_test_skip(); +} + +#endif /* CONFIG_PMP_STACK_GUARD */ + +typedef void (*pmp_test_func_t)(void); + +static const pmp_test_func_t pmp_test_func[] = { + check_isr_stack_guard, + check_main_stack_guard, +}; + +/** + * @brief Verify RISC-V specific PMP stack guard regions. + * @details Manually write to the protected stack region to trigger fatal error. + */ +ZTEST(riscv_pmp_no_mt, test_pmp) +{ +#ifndef PMP_TEST_FUNC_IDX +#define PMP_TEST_FUNC_IDX 0 +#endif + pmp_test_func[PMP_TEST_FUNC_IDX](); + + zassert_unreachable("Write to stack guard did not fault"); + TC_END_REPORT(TC_FAIL); +} + +ZTEST_SUITE(riscv_pmp_no_mt, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/arch/riscv/pmp/no-multithreading/testcase.yaml b/tests/arch/riscv/pmp/no-multithreading/testcase.yaml new file mode 100644 index 0000000000000..d8f887fa34121 --- /dev/null +++ b/tests/arch/riscv/pmp/no-multithreading/testcase.yaml @@ -0,0 +1,13 @@ +common: + platform_allow: + - qemu_riscv32 + - qemu_riscv32e + - qemu_riscv64 + filter: CONFIG_RISCV_PMP + ignore_faults: true + +tests: + arch.riscv.pmp.no-mt.isr-stack-guard: + extra_args: EXTRA_CFLAGS=-DPMP_TEST_FUNC_IDX=0 + arch.riscv.pmp.no-mt.main-stack-guard: + extra_args: EXTRA_CFLAGS=-DPMP_TEST_FUNC_IDX=1 From 6843240196356e7e287ff08a4aec502483f57c91 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Tue, 22 Oct 2024 10:22:52 +0800 Subject: [PATCH 2887/4482] drivers: intc: plic: use per-instance spinlock Instead of doing an `irq_lock()`, use per-instance spinlock instead. Refactored out an unlocked version of `local_irq_is_enabled` from `riscv_plic_irq_is_enabled()` to achieve that. Signed-off-by: Yong Cong Sin --- drivers/interrupt_controller/intc_plic.c | 67 ++++++++++++++---------- 1 file changed, 40 insertions(+), 27 deletions(-) diff --git a/drivers/interrupt_controller/intc_plic.c b/drivers/interrupt_controller/intc_plic.c index af16592d982a7..26468d40713f3 100644 --- a/drivers/interrupt_controller/intc_plic.c +++ b/drivers/interrupt_controller/intc_plic.c @@ -103,6 +103,7 @@ struct plic_stats { }; struct plic_data { + struct k_spinlock lock; #ifdef CONFIG_PLIC_SHELL_IRQ_COUNT struct plic_stats stats; @@ -279,11 +280,13 @@ static void plic_irq_enable_set_state(uint32_t irq, bool enable) */ void riscv_plic_irq_enable(uint32_t irq) { - uint32_t key = irq_lock(); + const struct device *dev = get_plic_dev_from_irq(irq); + struct plic_data *data = dev->data; + k_spinlock_key_t key = k_spin_lock(&data->lock); plic_irq_enable_set_state(irq, true); - irq_unlock(key); + k_spin_unlock(&data->lock, key); } /** @@ -298,35 +301,26 @@ void riscv_plic_irq_enable(uint32_t irq) */ void riscv_plic_irq_disable(uint32_t irq) { - uint32_t key = irq_lock(); + const struct device *dev = get_plic_dev_from_irq(irq); + struct plic_data *data = dev->data; + k_spinlock_key_t key = k_spin_lock(&data->lock); plic_irq_enable_set_state(irq, false); - irq_unlock(key); + k_spin_unlock(&data->lock, key); } -/** - * @brief Check if a riscv PLIC-specific interrupt line is enabled - * - * This routine checks if a RISCV PLIC-specific interrupt line is enabled. - * @param irq IRQ number to check - * - * @return 1 or 0 - */ -int riscv_plic_irq_is_enabled(uint32_t irq) +/* Check if the local IRQ of a PLIC instance is enabled */ +static int local_irq_is_enabled(const struct device *dev, uint32_t local_irq) { - const struct device *dev = get_plic_dev_from_irq(irq); - const uint32_t local_irq = irq_from_level_2(irq); uint32_t bit_position = local_irq & PLIC_REG_MASK; - uint32_t en_value; int is_enabled = IS_ENABLED(CONFIG_PLIC_IRQ_AFFINITY) ? 0 : 1; - uint32_t key = irq_lock(); for (uint32_t cpu_num = 0; cpu_num < arch_num_cpus(); cpu_num++) { mem_addr_t en_addr = get_context_en_addr(dev, cpu_num) + local_irq_to_reg_offset(local_irq); + uint32_t en_value = sys_read32(en_addr); - en_value = sys_read32(en_addr); if (IS_ENABLED(CONFIG_PLIC_IRQ_AFFINITY)) { is_enabled |= !!(en_value & BIT(bit_position)); } else { @@ -334,11 +328,31 @@ int riscv_plic_irq_is_enabled(uint32_t irq) } } - irq_unlock(key); - return is_enabled; } +/** + * @brief Check if a riscv PLIC-specific interrupt line is enabled + * + * This routine checks if a RISCV PLIC-specific interrupt line is enabled. + * @param irq IRQ number to check + * + * @return 1 or 0 + */ +int riscv_plic_irq_is_enabled(uint32_t irq) +{ + const struct device *dev = get_plic_dev_from_irq(irq); + struct plic_data *data = dev->data; + const uint32_t local_irq = irq_from_level_2(irq); + int ret = 0; + + K_SPINLOCK(&data->lock) { + ret = local_irq_is_enabled(dev, local_irq); + } + + return ret; +} + /** * @brief Set priority of a riscv PLIC-specific interrupt line * @@ -413,9 +427,10 @@ const struct device *riscv_plic_get_dev(void) int riscv_plic_irq_set_affinity(uint32_t irq, uint32_t cpumask) { const struct device *dev = get_plic_dev_from_irq(irq); - const struct plic_data *data = dev->data; + struct plic_data *data = dev->data; __maybe_unused const struct plic_config *config = dev->config; const uint32_t local_irq = irq_from_level_2(irq); + k_spinlock_key_t key; if (local_irq >= config->nr_irqs) { __ASSERT(false, "overflow: irq %d, local_irq %d", irq, local_irq); @@ -427,17 +442,15 @@ int riscv_plic_irq_set_affinity(uint32_t irq, uint32_t cpumask) return -EINVAL; } - uint32_t key = irq_lock(); - + key = k_spin_lock(&data->lock); /* Updated irq_cpumask for next time setting plic enable register */ data->irq_cpumask[local_irq] = (plic_cpumask_t)cpumask; /* If irq is enabled, apply the new irq affinity */ - if (riscv_plic_irq_is_enabled(irq)) { - riscv_plic_irq_enable(irq); + if (local_irq_is_enabled(dev, local_irq)) { + plic_irq_enable_set_state(irq, true); } - - irq_unlock(key); + k_spin_unlock(&data->lock, key); return 0; } From dc14a212ebbc28c376fc87917b71b44cebbc2fee Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 19 Nov 2024 22:22:48 -0500 Subject: [PATCH 2888/4482] ci: twister: check event using correct context Check for event using correct github context. Signed-off-by: Anas Nashif --- .github/workflows/twister-publish.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/twister-publish.yaml b/.github/workflows/twister-publish.yaml index 9dc80ec17bf1f..7e32b0762724e 100644 --- a/.github/workflows/twister-publish.yaml +++ b/.github/workflows/twister-publish.yaml @@ -41,12 +41,12 @@ jobs: pip3 install elasticsearch # set run date on upload to get consistent and unified data across the matrix. run_date=`date --iso-8601=minutes` - if [ "${{github.event_name}}" = "push" ]; then - python3 ./scripts/ci/upload_test_results_es.py -r ${run_date} \ - --run-attempt ${{github.run_attempt}} \ - --index zephyr-main-ci-push-1 artifacts/*/*/twister.json - elif [ "${{github.event_name}}" = "schedule" ]; then - python3 ./scripts/ci/upload_test_results_es.py -r ${run_date} \ - --run-attempt ${{github.run_attempt}} \ - --index zephyr-main-ci-weekly-1 artifacts/*/*/twister.json + if [ "${{github.event.workflow_run.event}}" = "push" ]; then + python3 ./scripts/ci/upload_test_results_es.py -r ${run_date} \ + --run-attempt ${{github.run_attempt}} \ + --index zephyr-main-ci-push-1 artifacts/*/*/twister.json + elif [ "${{github.event.workflow_run.event}}" = "schedule" ]; then + python3 ./scripts/ci/upload_test_results_es.py -r ${run_date} \ + --run-attempt ${{github.run_attempt}} \ + --index zephyr-main-ci-weekly-1 artifacts/*/*/twister.json fi From 0c88010d0d8383d127c1c89bb1df7c45895cda5c Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 19 Nov 2024 20:22:51 -0500 Subject: [PATCH 2889/4482] Reapply "ci: twister: use workflow_call for prep job" This reverts commit fd4c7bbbc2782ac1e6e40d9843f448f921d0f6ea. Signed-off-by: Anas Nashif --- .github/workflows/twister-prep.yaml | 150 ++++++++++++++++++++++++++++ .github/workflows/twister.yaml | 103 +------------------ 2 files changed, 151 insertions(+), 102 deletions(-) create mode 100644 .github/workflows/twister-prep.yaml diff --git a/.github/workflows/twister-prep.yaml b/.github/workflows/twister-prep.yaml new file mode 100644 index 0000000000000..97f44f68a9e13 --- /dev/null +++ b/.github/workflows/twister-prep.yaml @@ -0,0 +1,150 @@ +name: Prep + +on: + workflow_call: + outputs: + subset: + description: subset + value: ${{ jobs.prep_push.outputs.subset }} || ${{ jobs.prep_pr.outputs.subset }} + size: + description: size + value: ${{ jobs.prep_push.outputs.size }} || ${{ jobs.prep_pr.outputs.size }} + fullrun: + description: fullrun + value: ${{ jobs.prep_push.outputs.fullrun }} || ${{ jobs.prep_pr.outputs.size }} + +jobs: + prep_pr: + if: github.repository_owner == 'zephyrproject-rtos' && github.event_name == 'pull_request_target' + runs-on: + group: zephyr-runner-v2-linux-x64-4xlarge + container: + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.4.20241026 + options: '--entrypoint /bin/bash' + outputs: + subset: ${{ steps.output-services.outputs.subset }} + size: ${{ steps.output-services.outputs.size }} + fullrun: ${{ steps.output-services.outputs.fullrun }} + env: + MATRIX_SIZE: 10 + PUSH_MATRIX_SIZE: 20 + DAILY_MATRIX_SIZE: 80 + BSIM_OUT_PATH: /opt/bsim/ + BSIM_COMPONENTS_PATH: /opt/bsim/components + TESTS_PER_BUILDER: 700 + COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} + BASE_REF: ${{ github.base_ref }} + steps: + - name: Apply container owner mismatch workaround + run: | + # FIXME: The owner UID of the GITHUB_WORKSPACE directory may not + # match the container user UID because of the way GitHub + # Actions runner is implemented. Remove this workaround when + # GitHub comes up with a fundamental fix for this problem. + git config --global --add safe.directory ${GITHUB_WORKSPACE} + + - name: Print cloud service information + run: | + echo "ZEPHYR_RUNNER_CLOUD_PROVIDER = ${ZEPHYR_RUNNER_CLOUD_PROVIDER}" + echo "ZEPHYR_RUNNER_CLOUD_NODE = ${ZEPHYR_RUNNER_CLOUD_NODE}" + echo "ZEPHYR_RUNNER_CLOUD_POD = ${ZEPHYR_RUNNER_CLOUD_POD}" + + - name: Clone cached Zephyr repository + if: github.event_name == 'pull_request_target' + continue-on-error: true + run: | + git clone --shared /repo-cache/zephyrproject/zephyr . + git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} + + - name: Checkout + if: github.event_name == 'pull_request_target' + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + persist-credentials: false + + - name: Environment Setup + if: github.event_name == 'pull_request_target' + run: | + git config --global user.email "bot@zephyrproject.org" + git config --global user.name "Zephyr Bot" + rm -fr ".git/rebase-apply" + git rebase origin/${BASE_REF} + git clean -f -d + git log --pretty=oneline | head -n 10 + west init -l . || true + west config manifest.group-filter -- +ci,+optional + west config --global update.narrow true + west update --path-cache /repo-cache/zephyrproject 2>&1 1> west.update.log || west update --path-cache /repo-cache/zephyrproject 2>&1 1> west.update.log || ( rm -rf ../modules ../bootloader ../tools && west update --path-cache /repo-cache/zephyrproject) + west forall -c 'git reset --hard HEAD' + + echo "ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/zephyr-sdk-$( cat SDK_VERSION )" >> $GITHUB_ENV + + - name: Generate Test Plan with Twister + if: github.event_name == 'pull_request_target' + id: test-plan + run: | + export ZEPHYR_BASE=${PWD} + export ZEPHYR_TOOLCHAIN_VARIANT=zephyr + python3 ./scripts/ci/test_plan.py -c origin/${BASE_REF}.. --pull-request -t $TESTS_PER_BUILDER + if [ -s .testplan ]; then + cat .testplan >> $GITHUB_ENV + else + echo "TWISTER_NODES=${MATRIX_SIZE}" >> $GITHUB_ENV + fi + rm -f testplan.json .testplan + + - name: Determine matrix size + id: output-services + run: | + if [ -n "${TWISTER_NODES}" ]; then + subset="[$(seq -s',' 1 ${TWISTER_NODES})]" + else + subset="[$(seq -s',' 1 ${MATRIX_SIZE})]" + fi + size=${TWISTER_NODES} + + echo "subset=${subset}" >> $GITHUB_OUTPUT + echo "size=${size}" >> $GITHUB_OUTPUT + echo "fullrun=${TWISTER_FULL}" >> $GITHUB_OUTPUT + + prep_push: + if: github.repository_owner == 'zephyrproject-rtos' && (github.event_name == 'push' || github.event_name == 'schedule') + runs-on: ubuntu-22.04 + outputs: + subset: ${{ steps.output-services.outputs.subset }} + size: ${{ steps.output-services.outputs.size }} + fullrun: ${{ steps.output-services.outputs.fullrun }} + env: + MATRIX_SIZE: 10 + PUSH_MATRIX_SIZE: 20 + DAILY_MATRIX_SIZE: 80 + BSIM_OUT_PATH: /opt/bsim/ + BSIM_COMPONENTS_PATH: /opt/bsim/components + TESTS_PER_BUILDER: 700 + COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} + BASE_REF: ${{ github.base_ref }} + steps: + - name: Print cloud service information + run: | + echo "ZEPHYR_RUNNER_CLOUD_PROVIDER = ${ZEPHYR_RUNNER_CLOUD_PROVIDER}" + echo "ZEPHYR_RUNNER_CLOUD_NODE = ${ZEPHYR_RUNNER_CLOUD_NODE}" + echo "ZEPHYR_RUNNER_CLOUD_POD = ${ZEPHYR_RUNNER_CLOUD_POD}" + + - name: Determine matrix size + id: output-services + run: | + if [ "${{github.event_name}}" = "push" ]; then + subset="[$(seq -s',' 1 ${PUSH_MATRIX_SIZE})]" + size=${MATRIX_SIZE} + elif [ "${{github.event_name}}" = "schedule" -a "${{github.repository}}" = "zephyrproject-rtos/zephyr" ]; then + subset="[$(seq -s',' 1 ${DAILY_MATRIX_SIZE})]" + size=${DAILY_MATRIX_SIZE} + else + size=0 + fi + + echo "subset=${subset}" >> $GITHUB_OUTPUT + echo "size=${size}" >> $GITHUB_OUTPUT + echo "fullrun=${TWISTER_FULL}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/twister.yaml b/.github/workflows/twister.yaml index 57cedfd156370..1d863c7c69080 100644 --- a/.github/workflows/twister.yaml +++ b/.github/workflows/twister.yaml @@ -21,108 +21,7 @@ concurrency: jobs: twister-build-prep: - if: github.repository_owner == 'zephyrproject-rtos' - runs-on: - group: zephyr-runner-v2-linux-x64-4xlarge - container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.4.20241026 - options: '--entrypoint /bin/bash' - outputs: - subset: ${{ steps.output-services.outputs.subset }} - size: ${{ steps.output-services.outputs.size }} - fullrun: ${{ steps.output-services.outputs.fullrun }} - env: - MATRIX_SIZE: 10 - PUSH_MATRIX_SIZE: 20 - DAILY_MATRIX_SIZE: 80 - BSIM_OUT_PATH: /opt/bsim/ - BSIM_COMPONENTS_PATH: /opt/bsim/components - TESTS_PER_BUILDER: 700 - COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} - BASE_REF: ${{ github.base_ref }} - steps: - - name: Apply container owner mismatch workaround - run: | - # FIXME: The owner UID of the GITHUB_WORKSPACE directory may not - # match the container user UID because of the way GitHub - # Actions runner is implemented. Remove this workaround when - # GitHub comes up with a fundamental fix for this problem. - git config --global --add safe.directory ${GITHUB_WORKSPACE} - - - name: Print cloud service information - run: | - echo "ZEPHYR_RUNNER_CLOUD_PROVIDER = ${ZEPHYR_RUNNER_CLOUD_PROVIDER}" - echo "ZEPHYR_RUNNER_CLOUD_NODE = ${ZEPHYR_RUNNER_CLOUD_NODE}" - echo "ZEPHYR_RUNNER_CLOUD_POD = ${ZEPHYR_RUNNER_CLOUD_POD}" - - - name: Clone cached Zephyr repository - if: github.event_name == 'pull_request_target' - continue-on-error: true - run: | - git clone --shared /repo-cache/zephyrproject/zephyr . - git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} - - - name: Checkout - if: github.event_name == 'pull_request_target' - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - persist-credentials: false - - - name: Environment Setup - if: github.event_name == 'pull_request_target' - run: | - git config --global user.email "bot@zephyrproject.org" - git config --global user.name "Zephyr Bot" - rm -fr ".git/rebase-apply" - git rebase origin/${BASE_REF} - git clean -f -d - git log --pretty=oneline | head -n 10 - west init -l . || true - west config manifest.group-filter -- +ci,+optional - west config --global update.narrow true - west update --path-cache /repo-cache/zephyrproject 2>&1 1> west.update.log || west update --path-cache /repo-cache/zephyrproject 2>&1 1> west.update.log || ( rm -rf ../modules ../bootloader ../tools && west update --path-cache /repo-cache/zephyrproject) - west forall -c 'git reset --hard HEAD' - - echo "ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/zephyr-sdk-$( cat SDK_VERSION )" >> $GITHUB_ENV - - - name: Generate Test Plan with Twister - if: github.event_name == 'pull_request_target' - id: test-plan - run: | - export ZEPHYR_BASE=${PWD} - export ZEPHYR_TOOLCHAIN_VARIANT=zephyr - python3 ./scripts/ci/test_plan.py -c origin/${BASE_REF}.. --pull-request -t $TESTS_PER_BUILDER - if [ -s .testplan ]; then - cat .testplan >> $GITHUB_ENV - else - echo "TWISTER_NODES=${MATRIX_SIZE}" >> $GITHUB_ENV - fi - rm -f testplan.json .testplan - - - name: Determine matrix size - id: output-services - run: | - if [ "${{github.event_name}}" = "pull_request_target" ]; then - if [ -n "${TWISTER_NODES}" ]; then - subset="[$(seq -s',' 1 ${TWISTER_NODES})]" - else - subset="[$(seq -s',' 1 ${MATRIX_SIZE})]" - fi - size=${TWISTER_NODES} - elif [ "${{github.event_name}}" = "push" ]; then - subset="[$(seq -s',' 1 ${PUSH_MATRIX_SIZE})]" - size=${MATRIX_SIZE} - elif [ "${{github.event_name}}" = "schedule" -a "${{github.repository}}" = "zephyrproject-rtos/zephyr" ]; then - subset="[$(seq -s',' 1 ${DAILY_MATRIX_SIZE})]" - size=${DAILY_MATRIX_SIZE} - else - size=0 - fi - echo "subset=${subset}" >> $GITHUB_OUTPUT - echo "size=${size}" >> $GITHUB_OUTPUT - echo "fullrun=${TWISTER_FULL}" >> $GITHUB_OUTPUT + uses: ./.github/workflows/twister-prep.yaml twister-build: runs-on: From 5b51632103ccf2394b5bad54bd373f47e447758a Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 19 Nov 2024 22:04:57 -0500 Subject: [PATCH 2890/4482] ci: twister: fix setting of output for workflow_call Fix setting of output variables of workflow_call. Signed-off-by: Anas Nashif --- .github/workflows/twister-prep.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/twister-prep.yaml b/.github/workflows/twister-prep.yaml index 97f44f68a9e13..41894574479a9 100644 --- a/.github/workflows/twister-prep.yaml +++ b/.github/workflows/twister-prep.yaml @@ -5,13 +5,13 @@ on: outputs: subset: description: subset - value: ${{ jobs.prep_push.outputs.subset }} || ${{ jobs.prep_pr.outputs.subset }} + value: ${{ jobs.prep_push.outputs.subset != '' && jobs.prep_push.outputs.subset || jobs.prep_pr.outputs.subset }} size: description: size - value: ${{ jobs.prep_push.outputs.size }} || ${{ jobs.prep_pr.outputs.size }} + value: ${{ jobs.prep_push.outputs.size != '' && jobs.prep_push.outputs.size || jobs.prep_pr.outputs.size }} fullrun: description: fullrun - value: ${{ jobs.prep_push.outputs.fullrun }} || ${{ jobs.prep_pr.outputs.size }} + value: ${{ jobs.prep_push.outputs.fullrun != '' && jobs.prep_push.outputs.fullrun || jobs.prep_pr.outputs.size }} jobs: prep_pr: From c1b8cd7db1e840c83be921042e5afd925c5109c6 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Wed, 20 Nov 2024 07:56:07 -0500 Subject: [PATCH 2891/4482] ci: twister_prep: do not double check for event We already do the check for the job. Signed-off-by: Anas Nashif --- .github/workflows/twister-prep.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/twister-prep.yaml b/.github/workflows/twister-prep.yaml index 41894574479a9..9a1e183ad2880 100644 --- a/.github/workflows/twister-prep.yaml +++ b/.github/workflows/twister-prep.yaml @@ -50,14 +50,12 @@ jobs: echo "ZEPHYR_RUNNER_CLOUD_POD = ${ZEPHYR_RUNNER_CLOUD_POD}" - name: Clone cached Zephyr repository - if: github.event_name == 'pull_request_target' continue-on-error: true run: | git clone --shared /repo-cache/zephyrproject/zephyr . git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} - name: Checkout - if: github.event_name == 'pull_request_target' uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} @@ -65,7 +63,6 @@ jobs: persist-credentials: false - name: Environment Setup - if: github.event_name == 'pull_request_target' run: | git config --global user.email "bot@zephyrproject.org" git config --global user.name "Zephyr Bot" @@ -82,7 +79,6 @@ jobs: echo "ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/zephyr-sdk-$( cat SDK_VERSION )" >> $GITHUB_ENV - name: Generate Test Plan with Twister - if: github.event_name == 'pull_request_target' id: test-plan run: | export ZEPHYR_BASE=${PWD} From f79d879d508d70d27ecc29dac51a397a5d514dd9 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Tue, 19 Nov 2024 14:33:16 +0100 Subject: [PATCH 2892/4482] tests: Thread-Metric: Fix filter description Correct the description of why we exclude the POSIX arch Signed-off-by: Alberto Escolar Piedras --- tests/benchmarks/thread_metric/testcase.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/benchmarks/thread_metric/testcase.yaml b/tests/benchmarks/thread_metric/testcase.yaml index e86a5a18ac9f3..474d02cf011eb 100644 --- a/tests/benchmarks/thread_metric/testcase.yaml +++ b/tests/benchmarks/thread_metric/testcase.yaml @@ -2,10 +2,12 @@ common: tags: - kernel - benchmark - # Native platforms excluded as timer interrupts may not be detected - # qemu_nios2 excluded as it is slow + # Native platforms excluded as they are not relevant: These benchmarks run some kernel primitives + # in a loop during a predefined time counting how many times they execute. But in the POSIX arch, + # time does not pass while the CPU executes. So the benchmark just appears as if hung. arch_exclude: - posix + # qemu_nios2 excluded as it is slow platform_exclude: - qemu_nios2 integration_platforms: From e6ea761cd7cc25c54982d809a840cdd6e03b738f Mon Sep 17 00:00:00 2001 From: Dhruv Menon Date: Tue, 19 Nov 2024 01:19:26 +0530 Subject: [PATCH 2893/4482] doc: nxp: Update image of mimxrt1062_fmurt6 The prior image was of poor quality, making it difficult to interpret. Updated the image with a higher-quality version. Signed-off-by: Dhruv Menon --- .../mimxrt1062_fmurt6/doc/mimxrt1062_fmurt6.jpg | Bin 99691 -> 0 bytes .../doc/mimxrt1062_fmurt6.webp | Bin 0 -> 9340 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 boards/nxp/mimxrt1062_fmurt6/doc/mimxrt1062_fmurt6.jpg create mode 100644 boards/nxp/mimxrt1062_fmurt6/doc/mimxrt1062_fmurt6.webp diff --git a/boards/nxp/mimxrt1062_fmurt6/doc/mimxrt1062_fmurt6.jpg b/boards/nxp/mimxrt1062_fmurt6/doc/mimxrt1062_fmurt6.jpg deleted file mode 100644 index 40e1024491f661db4ab6a54aec6d86f6c66efdf0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 99691 zcmbTdbyQnT94(p_E!skHNhwfTq__uCN{f^N#a)U!#htXJxTHXFYjF!H?(P~qxCJSm zpusQSeRtir*8A(-`#a~Xb=EpF$?Takb7uD5b2oFh0(ksEPEii<;K2ic_x%C5TLnCS z?`>-Z04OU1H~|0v;r%lT0M7m0gZtxu#@#$X7Vz-Fga6L|6*zb}{{=oSE)E_6J^{gh z7vUq~M}&k#gaiacq(nr-B=V<+gzUfj|9<4Z?EmGuKS>A)2>(m*e-?LbfG30x zc^~@VJa`Ux_~Zf3lLvQQ0N{OD@$M1*2kL*tgNHb{c=-24A|k#|Q2qG6_&7KZ?+c5E zi+i6s;Ql!P_X!>a3%?9LrP^nL=PpkLzQz6_WPMxSPNhDEW)n1X{r-rEnueB+p8W;K z%U7I2!Xlz#;u5m&-pk1=D1Ok;)Y8_`)zde(u(Yzav9)t^_we-c_VEq+5gZa479J57 z|0^LeDLExIJ0~|Uzo4+FxT3PEx~8_SzM-SDtGlPSuYX{CVsdI4IWs%Ax`tZc*xdTJ zy@NSAJ~=%*$6j3ihwA|V=l_BAzmffaa6P%l_3*w8a0&jy_28k`{e|-c7mtM>pF&2B z;Ij+mbAfM!Pv6G=DQ|zoDyWX8GIJdxqGl6XWykyn?SCTs{|D^*{}rbf8ot+&1w0f!&<{Z&_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mV?d00001 From c5585af4c48282ac17571932bbfb35042a1db45c Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 18 Nov 2024 23:45:21 +0530 Subject: [PATCH 2894/4482] wifi: Add units to listen interval Listen interval as per 802.11 has units as "beacon intervals" i.e., 1 means 1 beacon interval duration (or short beacon interval duration if short beacon is enabled). Signed-off-by: Chaitanya Tata --- include/zephyr/net/wifi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/net/wifi.h b/include/zephyr/net/wifi.h index e3a1ed22b1929..c64ee6acac9ed 100644 --- a/include/zephyr/net/wifi.h +++ b/include/zephyr/net/wifi.h @@ -547,7 +547,7 @@ static inline const char *wifi_twt_get_err_code_str(int16_t err_no) enum wifi_ps_param_type { /** Power save state. */ WIFI_PS_PARAM_STATE, - /** Power save listen interval. */ + /** Power save listen interval (units: (short) beacon intervals). */ WIFI_PS_PARAM_LISTEN_INTERVAL, /** Power save wakeup mode. */ WIFI_PS_PARAM_WAKEUP_MODE, From 0f1f01f9f41b6c8c06a4aacab95113f9055323d3 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Mon, 18 Nov 2024 23:46:30 +0530 Subject: [PATCH 2895/4482] net: l2: wifi: Fix the minimum value 802.11 doesn't have specific constraints, it just says that listen interval should be >=0 and it a 2 byte field. 3 as a typical DTIM value from nRF chipsets, so, remove the hardware specific line and just set a failure. Signed-off-by: Chaitanya Tata --- subsys/net/l2/wifi/wifi_shell.c | 1 - 1 file changed, 1 deletion(-) diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index d8918be34cb53..87a0c1b5b5022 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1933,7 +1933,6 @@ static int cmd_wifi_listen_interval(const struct shell *sh, size_t argc, char *a WIFI_PS_PARAM_LISTEN_INTERVAL_RANGE_INVALID) { PR_WARNING("Setting listen interval failed. Reason :%s\n", wifi_ps_get_config_err_code_str(params.fail_reason)); - PR_WARNING("Hardware support valid range : 3 - 65535\n"); } else { PR_WARNING("Setting listen interval failed. Reason :%s\n", wifi_ps_get_config_err_code_str(params.fail_reason)); From 50509c34cc0ffb8323c415dc8723deb0de0e60af Mon Sep 17 00:00:00 2001 From: Martin Stumpf Date: Mon, 18 Nov 2024 16:38:30 +0100 Subject: [PATCH 2896/4482] lvgl: Flush thread can have preemptive priority The LVGL flush thread was hard-coded to be cooperative. For long-running actions like data transfer to the display, this is problematic as it might block high-frequency actions like USB or input events. Hence, make it configurable to be preemptive, and rename it to match the similar Kconfig values like CONFIG_SDL_THREAD_PRIORITY. Signed-off-by: Martin Stumpf --- doc/releases/migration-guide-4.1.rst | 4 ++++ modules/lvgl/Kconfig | 6 +++--- modules/lvgl/lvgl_display.c | 5 ++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/doc/releases/migration-guide-4.1.rst b/doc/releases/migration-guide-4.1.rst index 04eabfdcd340d..6fc151701a2f3 100644 --- a/doc/releases/migration-guide-4.1.rst +++ b/doc/releases/migration-guide-4.1.rst @@ -36,6 +36,10 @@ Trusted Firmware-M LVGL ==== +* The config option :kconfig:option:`CONFIG_LV_Z_FLUSH_THREAD_PRIO` is now called + :kconfig:option:`CONFIG_LV_Z_FLUSH_THREAD_PRIORITY` and its value is now interpreted as an + absolute priority instead of a cooperative one. + Device Drivers and Devicetree ***************************** diff --git a/modules/lvgl/Kconfig b/modules/lvgl/Kconfig index 932df9e55d979..5345e2a7d58be 100644 --- a/modules/lvgl/Kconfig +++ b/modules/lvgl/Kconfig @@ -103,11 +103,11 @@ config LV_Z_FLUSH_THREAD_STACK_SIZE help Stack size for LVGL flush thread, which will call display_write -config LV_Z_FLUSH_THREAD_PRIO +config LV_Z_FLUSH_THREAD_PRIORITY int "LVGL flush thread priority" - default 0 + default -1 help - Cooperative priority of LVGL flush thread. + Priority of LVGL flush thread. endif # LV_Z_FLUSH_THREAD diff --git a/modules/lvgl/lvgl_display.c b/modules/lvgl/lvgl_display.c index 39f3da1f795df..12f84725008a2 100644 --- a/modules/lvgl/lvgl_display.c +++ b/modules/lvgl/lvgl_display.c @@ -34,9 +34,8 @@ void lvgl_flush_thread_entry(void *arg1, void *arg2, void *arg3) } } -K_THREAD_DEFINE(lvgl_flush_thread, CONFIG_LV_Z_FLUSH_THREAD_STACK_SIZE, - lvgl_flush_thread_entry, NULL, NULL, NULL, - K_PRIO_COOP(CONFIG_LV_Z_FLUSH_THREAD_PRIO), 0, 0); +K_THREAD_DEFINE(lvgl_flush_thread, CONFIG_LV_Z_FLUSH_THREAD_STACK_SIZE, lvgl_flush_thread_entry, + NULL, NULL, NULL, CONFIG_LV_Z_FLUSH_THREAD_PRIORITY, 0, 0); void lvgl_wait_cb(lv_disp_drv_t *disp_drv) From 538753d51b906f0f1b744c1190a9375f2b1fbded Mon Sep 17 00:00:00 2001 From: Marcin Niestroj Date: Sat, 9 Nov 2024 15:07:17 +0100 Subject: [PATCH 2897/4482] boards: st: nucleo_h533re: configure SPI on Arduino headers This allows to use the board right away with samples and shields depending on Arduino SPI. Signed-off-by: Marcin Niestroj --- boards/st/nucleo_h533re/arduino_r3_connector.dtsi | 1 + boards/st/nucleo_h533re/doc/index.rst | 4 +++- boards/st/nucleo_h533re/nucleo_h533re.dts | 7 +++++++ boards/st/nucleo_h533re/nucleo_h533re.yaml | 2 ++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/boards/st/nucleo_h533re/arduino_r3_connector.dtsi b/boards/st/nucleo_h533re/arduino_r3_connector.dtsi index 15bb1aab0bf5e..7e2ca9b705c8e 100644 --- a/boards/st/nucleo_h533re/arduino_r3_connector.dtsi +++ b/boards/st/nucleo_h533re/arduino_r3_connector.dtsi @@ -36,3 +36,4 @@ }; arduino_serial: &usart1 {}; +arduino_spi: &spi1 {}; diff --git a/boards/st/nucleo_h533re/doc/index.rst b/boards/st/nucleo_h533re/doc/index.rst index 89876c48c018f..986cda88c35dc 100644 --- a/boards/st/nucleo_h533re/doc/index.rst +++ b/boards/st/nucleo_h533re/doc/index.rst @@ -169,6 +169,8 @@ The Zephyr nucleo_h533re board configuration supports the following hardware fea +-----------+------------+-------------------------------------+ | USB | on-chip | USB full-speed host/device bus | +-----------+------------+-------------------------------------+ +| SPI | on-chip | spi | ++-----------+------------+-------------------------------------+ Other hardware features are not yet supported on this Zephyr port. @@ -206,7 +208,7 @@ Default Zephyr Peripheral Mapping: - ADC1 channel 0 input: PA0 - USART1 TX/RX : PB14/PB15 (Arduino USART1) -- SPI1 SCK/MISO/MOSI/NSS: PA5/PA6/PA7/PA4 +- SPI1 SCK/MISO/MOSI/NSS: PA5/PA6/PA7/PC9 - UART2 TX/RX : PA2/PA3 (VCP) - USER_PB : PC13 diff --git a/boards/st/nucleo_h533re/nucleo_h533re.dts b/boards/st/nucleo_h533re/nucleo_h533re.dts index ad89a5e80350f..66fade7dcd2ab 100644 --- a/boards/st/nucleo_h533re/nucleo_h533re.dts +++ b/boards/st/nucleo_h533re/nucleo_h533re.dts @@ -105,6 +105,13 @@ status = "okay"; }; +&spi1 { + pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>; + pinctrl-names = "default"; + cs-gpios = <&gpioc 9 GPIO_ACTIVE_LOW>; + status = "okay"; +}; + &iwdg { status = "okay"; }; diff --git a/boards/st/nucleo_h533re/nucleo_h533re.yaml b/boards/st/nucleo_h533re/nucleo_h533re.yaml index 9562322e9c1b8..cf36efb57fb5d 100644 --- a/boards/st/nucleo_h533re/nucleo_h533re.yaml +++ b/boards/st/nucleo_h533re/nucleo_h533re.yaml @@ -12,7 +12,9 @@ flash: 512 supported: - arduino_gpio - arduino_serial + - arduino_spi - gpio + - spi - watchdog - pwm - rtc From aeaf32aada93513bf10fbd921fce7e9c92de79e5 Mon Sep 17 00:00:00 2001 From: James Roy Date: Mon, 18 Nov 2024 22:20:11 +0800 Subject: [PATCH 2898/4482] stm32: Fix wrong binding target for RTC_SEL in stm32u0 Change the stm32u0 clock from CSR_REG to BDCR_REG. Signed-off-by: James Roy --- include/zephyr/dt-bindings/clock/stm32u0_clock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/dt-bindings/clock/stm32u0_clock.h b/include/zephyr/dt-bindings/clock/stm32u0_clock.h index 5ee5059885562..476c423608256 100644 --- a/include/zephyr/dt-bindings/clock/stm32u0_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32u0_clock.h @@ -87,6 +87,6 @@ #define CLK48_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 26, CCIPR_REG) #define ADC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 28, CCIPR_REG) /** BDCR devices */ -#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, CSR_REG) +#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, BDCR_REG) #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32U0_CLOCK_H_ */ From 98d0a2bb34e3b6c4c094e5ffb7ccc7bea7395152 Mon Sep 17 00:00:00 2001 From: Marek Matej Date: Mon, 18 Nov 2024 12:58:50 +0000 Subject: [PATCH 2899/4482] soc: espressif: esp32c6 split cached area Split the cached area and assign both parts IROM and DROM meaning. This is necessary to overcome the esptool section merging issues. Signed-off-by: Marek Matej --- soc/espressif/esp32c6/default.ld | 20 ++++++++------------ soc/espressif/esp32c6/memory.h | 8 +++++--- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/soc/espressif/esp32c6/default.ld b/soc/espressif/esp32c6/default.ld index 39bdac633aee8..feb871511e308 100644 --- a/soc/espressif/esp32c6/default.ld +++ b/soc/espressif/esp32c6/default.ld @@ -25,7 +25,8 @@ user_sram_org = HPSRAM_START; user_sram_size = (user_sram_end - user_sram_org); /* Aliases */ -#define CACHED_REGION mmap0_0_seg +#define FLASH_CODE_REGION irom0_0_seg +#define RODATA_REGION drom0_0_seg #define RAMABLE_REGION sram0_0_seg #define ROMABLE_REGION FLASH @@ -38,7 +39,7 @@ user_sram_size = (user_sram_end - user_sram_org); /* Flash segments (rodata and text) should be mapped in the virtual address spaces. * Executing directly from LMA is not possible. */ #undef GROUP_ROM_LINK_IN -#define GROUP_ROM_LINK_IN(vregion, lregion) > CACHED_REGION AT > lregion +#define GROUP_ROM_LINK_IN(vregion, lregion) > RODATA_REGION AT > lregion /* Make sure new sections have consistent alignment between input and output sections */ #undef SECTION_DATA_PROLOGUE @@ -65,7 +66,8 @@ MEMORY sram0_0_seg(RW): org = user_sram_org, len = user_sram_size - mmap0_0_seg (R): org = CACHED_ORG, len = CACHED_SIZE + irom0_0_seg(RX): org = IROM_SEG_ORG, len = IROM_SEG_LEN + drom0_0_seg(R): org = DROM_SEG_ORG, len = DROM_SEG_LEN lp_ram_seg(RW): org = LPSRAM_IRAM_START, len = 0x2000 - RESERVE_RTC_MEM @@ -770,7 +772,7 @@ SECTIONS __rom_region_end = ABSOLUTE(.); _etext = .; - } GROUP_DATA_LINK_IN(CACHED_REGION, ROMABLE_REGION) + } GROUP_DATA_LINK_IN(FLASH_CODE_REGION, ROMABLE_REGION) /* --- END OF .flash.text --- */ @@ -782,12 +784,6 @@ SECTIONS . = ALIGN(CACHE_ALIGN); } GROUP_LINK_IN(ROMABLE_REGION) - .flash.align_rodata (NOLOAD) : - { - /* Subsequent segment lma and vma align */ - . = ALIGN(CACHE_ALIGN); - } GROUP_LINK_IN(CACHED_REGION) - /* Symbols used during the application memory mapping */ _image_drom_start = LOADADDR(.flash.rodata); _image_drom_size = _image_rodata_end - _image_rodata_start; @@ -844,7 +840,7 @@ SECTIONS *(.rodata_wlog) *(.rodata_wlog*) . = ALIGN(4); - } GROUP_DATA_LINK_IN(CACHED_REGION, ROMABLE_REGION) + } GROUP_DATA_LINK_IN(RODATA_REGION, ROMABLE_REGION) #include #include @@ -864,7 +860,7 @@ SECTIONS . = ALIGN(4); _rodata_reserved_end = ABSOLUTE(.); _image_rodata_end = ABSOLUTE(.); - } GROUP_DATA_LINK_IN(CACHED_REGION, ROMABLE_REGION) + } GROUP_DATA_LINK_IN(RODATA_REGION, ROMABLE_REGION) /* --- END OF .rodata --- */ diff --git a/soc/espressif/esp32c6/memory.h b/soc/espressif/esp32c6/memory.h index 496ea78b73ecb..95fbc21fa1dc7 100644 --- a/soc/espressif/esp32c6/memory.h +++ b/soc/espressif/esp32c6/memory.h @@ -60,6 +60,8 @@ #endif /* Cached memory */ -#define CACHE_ALIGN CONFIG_MMU_PAGE_SIZE -#define CACHED_ORG 0x42000000 -#define CACHED_SIZE FLASH_SIZE +#define CACHE_ALIGN CONFIG_MMU_PAGE_SIZE +#define IROM_SEG_ORG 0x42000000 +#define IROM_SEG_LEN FLASH_SIZE +#define DROM_SEG_ORG 0x42800000 +#define DROM_SEG_LEN FLASH_SIZE From df4883ad23df2eb3da0ffd68f91b3d6de051ea36 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Fri, 15 Nov 2024 12:31:38 -0800 Subject: [PATCH 2900/4482] tests: thread_error_case: fix incorrect userspace filtering The filter here should be used to filter for capability: whether the platform configuration supports userspace. And if it does support userspace, we then enable CONFIG_TEST_USERSPACE (and thus CONFIG_USERSPACE) for testing. We should not be filtering for whether userspace is enabled, but should really be filtering for whether userspace is supported. Signed-off-by: Daniel Leung --- tests/kernel/threads/thread_error_case/testcase.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/kernel/threads/thread_error_case/testcase.yaml b/tests/kernel/threads/thread_error_case/testcase.yaml index 69106b0f61171..171bc8b3b6eab 100644 --- a/tests/kernel/threads/thread_error_case/testcase.yaml +++ b/tests/kernel/threads/thread_error_case/testcase.yaml @@ -4,7 +4,7 @@ tests: - kernel - threads - userspace - filter: CONFIG_USERSPACE + filter: CONFIG_ARCH_HAS_USERSPACE ignore_faults: true integration_platforms: - qemu_x86 From 55ad66a30c7576129a548c508c3ed61a4303fb8c Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Fri, 15 Nov 2024 12:41:36 -0800 Subject: [PATCH 2901/4482] tests: ztest/base: fix incorrect userspace filtering The filter here should be used to filter for capability: whether the platform configuration supports userspace. And if it does support userspace, we then enable CONFIG_TEST_USERSPACE (and thus CONFIG_USERSPACE) for testing. We should not be filtering for whether userspace is enabled, but should really be filtering for whether userspace is supported. Signed-off-by: Daniel Leung --- tests/ztest/base/testcase.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ztest/base/testcase.yaml b/tests/ztest/base/testcase.yaml index 2b6107cd20482..eb88b48786f02 100644 --- a/tests/ztest/base/testcase.yaml +++ b/tests/ztest/base/testcase.yaml @@ -16,7 +16,7 @@ tests: integration_platforms: - native_sim testing.ztest.base.verbose_0_userspace: - filter: CONFIG_USERSPACE + filter: CONFIG_ARCH_HAS_USERSPACE extra_args: CONF_FILE=prj_verbose_0.conf tags: - userspace From 91749dfeb325b0d57488556cd369ba7917d5978f Mon Sep 17 00:00:00 2001 From: Marvin Ouma Date: Fri, 15 Nov 2024 16:43:10 +0300 Subject: [PATCH 2902/4482] tests: posix: common: separate posix xsi streams to standalone test posix.common contains testsuites that can be separated into smaller groups of tests. This change moves stropts into a singular testsuite at tests/posix/xsi_streams app directory. Signed-off-by: Marvin Ouma --- tests/posix/xsi_streams/CMakeLists.txt | 9 +++++++ tests/posix/xsi_streams/prj.conf | 5 ++++ .../src/stropts.c => xsi_streams/src/main.c} | 14 +++++------ tests/posix/xsi_streams/testcase.yaml | 25 +++++++++++++++++++ 4 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 tests/posix/xsi_streams/CMakeLists.txt create mode 100644 tests/posix/xsi_streams/prj.conf rename tests/posix/{common/src/stropts.c => xsi_streams/src/main.c} (85%) create mode 100644 tests/posix/xsi_streams/testcase.yaml diff --git a/tests/posix/xsi_streams/CMakeLists.txt b/tests/posix/xsi_streams/CMakeLists.txt new file mode 100644 index 0000000000000..33c8e5090751c --- /dev/null +++ b/tests/posix/xsi_streams/CMakeLists.txt @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(xsi_streams) + +FILE(GLOB app_sources src/main.c) + +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/posix/xsi_streams/prj.conf b/tests/posix/xsi_streams/prj.conf new file mode 100644 index 0000000000000..6a39c38d1c684 --- /dev/null +++ b/tests/posix/xsi_streams/prj.conf @@ -0,0 +1,5 @@ +CONFIG_POSIX_API=y +CONFIG_ZTEST=y + +CONFIG_POSIX_AEP_CHOICE_BASE=y +CONFIG_XOPEN_STREAMS=y diff --git a/tests/posix/common/src/stropts.c b/tests/posix/xsi_streams/src/main.c similarity index 85% rename from tests/posix/common/src/stropts.c rename to tests/posix/xsi_streams/src/main.c index 9dcf899ca94ee..ff6658572864a 100644 --- a/tests/posix/common/src/stropts.c +++ b/tests/posix/xsi_streams/src/main.c @@ -7,7 +7,7 @@ #include #include -ZTEST(stropts, test_putmsg) +ZTEST(xsi_streams, test_putmsg) { const struct strbuf *ctrl = NULL; const struct strbuf *data = NULL; @@ -18,7 +18,7 @@ ZTEST(stropts, test_putmsg) zassert_equal(errno, ENOSYS, "Expected errno ENOSYS, got %d", errno); } -ZTEST(stropts, test_fdetach) +ZTEST(xsi_streams, test_fdetach) { char *path = NULL; int ret = fdetach(path); @@ -27,7 +27,7 @@ ZTEST(stropts, test_fdetach) zassert_equal(errno, ENOSYS, "Expected errno ENOSYS, got %d", errno); } -ZTEST(stropts, test_fattach) +ZTEST(xsi_streams, test_fattach) { char *path = NULL; int fd = -1; @@ -37,7 +37,7 @@ ZTEST(stropts, test_fattach) zassert_equal(errno, ENOSYS, "Expected errno ENOSYS, got %d", errno); } -ZTEST(stropts, test_getmsg) +ZTEST(xsi_streams, test_getmsg) { struct strbuf *ctrl = NULL; struct strbuf *data = NULL; @@ -48,7 +48,7 @@ ZTEST(stropts, test_getmsg) zassert_equal(errno, ENOSYS, "Expected errno ENOSYS, got %d", errno); } -ZTEST(stropts, test_getpmsg) +ZTEST(xsi_streams, test_getpmsg) { struct strbuf *ctrl = NULL; struct strbuf *data = NULL; @@ -59,7 +59,7 @@ ZTEST(stropts, test_getpmsg) zassert_equal(errno, ENOSYS, "Expected errno ENOSYS, got %d", errno); } -ZTEST(stropts, test_isastream) +ZTEST(xsi_streams, test_isastream) { int fd = -1; int ret = isastream(fd); @@ -68,4 +68,4 @@ ZTEST(stropts, test_isastream) zassert_equal(errno, ENOSYS, "Expected errno ENOSYS, got %d", errno); } -ZTEST_SUITE(stropts, NULL, NULL, NULL, NULL, NULL); +ZTEST_SUITE(xsi_streams, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/posix/xsi_streams/testcase.yaml b/tests/posix/xsi_streams/testcase.yaml new file mode 100644 index 0000000000000..c039596082709 --- /dev/null +++ b/tests/posix/xsi_streams/testcase.yaml @@ -0,0 +1,25 @@ +common: + filter: not CONFIG_NATIVE_LIBC + tags: + - posix + - xsi_streams + # 1 tier0 platform per supported architecture + platform_key: + - arch + - simulation + min_flash: 64 + min_ram: 32 +tests: + portability.posix.xsi_streams: {} + portability.posix.xsi_streams.minimal: + extra_configs: + - CONFIG_MINIMAL_LIBC=y + portability.posix.xsi_streams.newlib: + filter: TOOLCHAIN_HAS_NEWLIB == 1 + extra_configs: + - CONFIG_NEWLIB_LIBC=y + portability.posix.xsi_streams.picolibc: + tags: picolibc + filter: CONFIG_PICOLIBC_SUPPORTED + extra_configs: + - CONFIG_PICOLIBC=y From 9863dc9fd8b58cd88f76eab5f18cce3a961b2de1 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Mon, 11 Nov 2024 16:37:14 -0600 Subject: [PATCH 2903/4482] drivers: nxp_enet: Add get_config for ipv6 chksum Previously, ipv6 being disabled was a dependency of the hw acceleration of the checksums for the nxp enet driver, because this ethernet has an errata causing icmpv6 checksum to not be supported. Now, there is a new config type in ethernet api for checksum types, so we can re-enable hardware acceleration for ipv6 by implementing this type in the get_config api in this driver. Signed-off-by: Declan Snyder --- drivers/ethernet/nxp_enet/Kconfig | 1 - drivers/ethernet/nxp_enet/eth_nxp_enet.c | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/ethernet/nxp_enet/Kconfig b/drivers/ethernet/nxp_enet/Kconfig index f08a207ca5bd9..848d44b485650 100644 --- a/drivers/ethernet/nxp_enet/Kconfig +++ b/drivers/ethernet/nxp_enet/Kconfig @@ -57,7 +57,6 @@ config ETH_NXP_ENET_USE_DTCM_FOR_DMA_BUFFER config ETH_NXP_ENET_HW_ACCELERATION bool "Hardware acceleration" default y - depends on !NET_IPV6 help Enable hardware acceleration for the following: - IPv4, UDP and TCP checksum (both Rx and Tx) diff --git a/drivers/ethernet/nxp_enet/eth_nxp_enet.c b/drivers/ethernet/nxp_enet/eth_nxp_enet.c index c5b1ac92b13d0..f575bfa5ffd14 100644 --- a/drivers/ethernet/nxp_enet/eth_nxp_enet.c +++ b/drivers/ethernet/nxp_enet/eth_nxp_enet.c @@ -315,6 +315,26 @@ static int eth_nxp_enet_set_config(const struct device *dev, return -ENOTSUP; } +static int eth_nxp_enet_get_config(const struct device *dev, + enum ethernet_config_type type, + struct ethernet_config *cfg) +{ + switch (type) { + case ETHERNET_CONFIG_TYPE_RX_CHECKSUM_SUPPORT: + case ETHERNET_CONFIG_TYPE_TX_CHECKSUM_SUPPORT: + cfg->chksum_support = ETHERNET_CHECKSUM_SUPPORT_IPV4_HEADER | + ETHERNET_CHECKSUM_SUPPORT_IPV4_ICMP | + ETHERNET_CHECKSUM_SUPPORT_IPV6_HEADER | + ETHERNET_CHECKSUM_SUPPORT_TCP | + ETHERNET_CHECKSUM_SUPPORT_UDP; + return 0; + default: + break; + } + + return -ENOTSUP; +} + static int eth_nxp_enet_rx(const struct device *dev) { #if defined(CONFIG_PTP_CLOCK_NXP_ENET) @@ -845,6 +865,7 @@ static const struct ethernet_api api_funcs = { .get_capabilities = eth_nxp_enet_get_capabilities, .get_phy = eth_nxp_enet_get_phy, .set_config = eth_nxp_enet_set_config, + .get_config = eth_nxp_enet_get_config, .send = NXP_ENET_SEND_FUNC, #if defined(CONFIG_PTP_CLOCK) .get_ptp_clock = eth_nxp_enet_get_ptp_clock, From 31eee15fcdb35fecb0711c528a9d15f2e53dc08d Mon Sep 17 00:00:00 2001 From: Tarang Raval Date: Sun, 10 Nov 2024 20:09:38 +0530 Subject: [PATCH 2904/4482] dts: arm: rpi_pico: remove #define from dts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing direct #define usage in the DTSI file and converting these definitions to use a dt-bindings header instead. Relocates the RPI_PICO_DEFAULT_IRQ_PRIORITY definition to a DTSI file and introduces an override.dtsi file. The override file is used when no other override file is present, allowing for better flexibility and compliance with Zephyr’s DTS structure. Fixes: #79719 Signed-off-by: Tarang Raval --- dts/arm/rpi_pico/override.dtsi | 7 +++++++ dts/arm/rpi_pico/rp2040.dtsi | 10 +++++++++- .../zephyr/dt-bindings/reset/rpi_pico_reset.h | 4 ---- 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 dts/arm/rpi_pico/override.dtsi rename dts/arm/rpi_pico/rpi_pico_common.dtsi => include/zephyr/dt-bindings/reset/rpi_pico_reset.h (92%) diff --git a/dts/arm/rpi_pico/override.dtsi b/dts/arm/rpi_pico/override.dtsi new file mode 100644 index 0000000000000..e252c6acd4e53 --- /dev/null +++ b/dts/arm/rpi_pico/override.dtsi @@ -0,0 +1,7 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ +/* + * File intentionally left blank. Will be used when there is no other + * higher-priority override.dtsi file in use. + */ diff --git a/dts/arm/rpi_pico/rp2040.dtsi b/dts/arm/rpi_pico/rp2040.dtsi index 1709d01c970d4..00d53f8b3d205 100644 --- a/dts/arm/rpi_pico/rp2040.dtsi +++ b/dts/arm/rpi_pico/rp2040.dtsi @@ -10,9 +10,17 @@ #include #include #include +#include #include -#include "rpi_pico_common.dtsi" +#include +/* + * This value can be overridden at the board level or in an application specific + * override.dtsi file. + */ +#ifndef RPI_PICO_DEFAULT_IRQ_PRIORITY +#define RPI_PICO_DEFAULT_IRQ_PRIORITY 3 +#endif / { aliases { diff --git a/dts/arm/rpi_pico/rpi_pico_common.dtsi b/include/zephyr/dt-bindings/reset/rpi_pico_reset.h similarity index 92% rename from dts/arm/rpi_pico/rpi_pico_common.dtsi rename to include/zephyr/dt-bindings/reset/rpi_pico_reset.h index 58e7fff37201e..6f8c537ba4c66 100644 --- a/dts/arm/rpi_pico/rpi_pico_common.dtsi +++ b/include/zephyr/dt-bindings/reset/rpi_pico_reset.h @@ -4,10 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef RPI_PICO_DEFAULT_IRQ_PRIORITY -#define RPI_PICO_DEFAULT_IRQ_PRIORITY 3 -#endif - #define RPI_PICO_RESETS_RESET_ADC 0 #define RPI_PICO_RESETS_RESET_BUSCTRL 1 #define RPI_PICO_RESETS_RESET_DMA 2 From ac6d8342728c8a63f9fea965ce41610618aeed5a Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Mon, 21 Oct 2024 12:35:18 +0200 Subject: [PATCH 2905/4482] mbedtls: auto-select MBEDTLS_CIPHER_AES_ENABLED when built-in in PSA Auto-select MBEDTLS_CIPHER_AES_ENABLED when AES support is requested through PSA (i.e. CONFIG_PSA_WANT_KEY_TYPE_AES) and the PSA support is provided through Mbed TLS itself (i.e. CONFIG_MBEDTLS_PSA_CRYPTO_C). This mimic what happens in Mbed TLS at build time: if AES support is required through PSA, but there's no one else providing it (i.e. no TF-M in Zephyr) then provide this support through legacy AES module. This is useful in samples/tests so that the user can simply use the PSA_WANT symbol to ask for AES support in PSA crypto and then tune the AES features (ex: CONFIG_MBEDTLS_AES_ROM_TABLES) without the need to also define CONFIG_MBEDTLS_CIPHER_AES_ENABLED. Signed-off-by: Valerio Setti --- modules/mbedtls/Kconfig.tls-generic | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/mbedtls/Kconfig.tls-generic b/modules/mbedtls/Kconfig.tls-generic index 3ea0a49dd3424..1082587315715 100644 --- a/modules/mbedtls/Kconfig.tls-generic +++ b/modules/mbedtls/Kconfig.tls-generic @@ -246,6 +246,7 @@ config MBEDTLS_SOME_CIPHER_ENABLED config MBEDTLS_CIPHER_AES_ENABLED bool "AES block cipher" + default y if PSA_WANT_KEY_TYPE_AES && MBEDTLS_PSA_CRYPTO_C if MBEDTLS_CIPHER_AES_ENABLED From 08bd9c72bd4f6053129e80ec3798626a859000fe Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Tue, 22 Oct 2024 21:34:46 +0200 Subject: [PATCH 2906/4482] mbedtls: use CSPRNG whenever possible as PSA random source The main problem of MBEDTLS_PSA_CRYPTO_LEGACY_RNG is that it brings in some legacy modules (entropy + ctr_drbg/hmac_drbg) which means extra ROM/RAM footprint. MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG instead simply calls to the CSPRNG which makes it definitely smaller. Signed-off-by: Valerio Setti --- doc/releases/migration-guide-4.1.rst | 6 ++++++ modules/mbedtls/Kconfig.tls-generic | 1 + samples/psa/its/overlay-entropy_driver.conf | 1 - samples/psa/persistent_key/overlay-entropy_driver.conf | 1 - tests/bsim/bluetooth/host/gatt/caching/psa_overlay.conf | 1 - tests/bsim/bluetooth/ll/conn/psa_overlay.conf | 1 - tests/crypto/mbedtls_psa/prj.conf | 1 - tests/crypto/mbedtls_psa/testcase.yaml | 5 +++-- tests/crypto/secp256r1/mbedtls.conf | 1 - tests/crypto/secp256r1/p256-m_raw.conf | 1 - tests/net/socket/tls_configurations/prj.conf | 1 - tests/subsys/jwt/testcase.yaml | 6 ++++++ 12 files changed, 16 insertions(+), 10 deletions(-) diff --git a/doc/releases/migration-guide-4.1.rst b/doc/releases/migration-guide-4.1.rst index 6fc151701a2f3..90dfad9a0e237 100644 --- a/doc/releases/migration-guide-4.1.rst +++ b/doc/releases/migration-guide-4.1.rst @@ -30,6 +30,12 @@ Modules Mbed TLS ======== +* If a platform has a CSPRNG source available (i.e. :kconfig:option:`CONFIG_CSPRNG_ENABLED` + is set), then the Kconfig option :kconfig:option:`CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG` + is the default choice for random number source instead of + :kconfig:option:`CONFIG_MBEDTLS_PSA_CRYPTO_LEGACY_RNG`. This helps in reducing + ROM/RAM footprint of the Mbed TLS library. + Trusted Firmware-M ================== diff --git a/modules/mbedtls/Kconfig.tls-generic b/modules/mbedtls/Kconfig.tls-generic index 1082587315715..2e6e6b7f8c322 100644 --- a/modules/mbedtls/Kconfig.tls-generic +++ b/modules/mbedtls/Kconfig.tls-generic @@ -481,6 +481,7 @@ config MBEDTLS_SSL_EXTENDED_MASTER_SECRET choice MBEDTLS_PSA_CRYPTO_RNG_SOURCE prompt "Select random source for built-in PSA crypto" depends on MBEDTLS_PSA_CRYPTO_C + default MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG if CSPRNG_ENABLED default MBEDTLS_PSA_CRYPTO_LEGACY_RNG config MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG diff --git a/samples/psa/its/overlay-entropy_driver.conf b/samples/psa/its/overlay-entropy_driver.conf index b2fea61e044a3..0feb3ad09493f 100644 --- a/samples/psa/its/overlay-entropy_driver.conf +++ b/samples/psa/its/overlay-entropy_driver.conf @@ -1,4 +1,3 @@ # SPDX-License-Identifier: Apache-2.0 CONFIG_ENTROPY_GENERATOR=y -CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG=y diff --git a/samples/psa/persistent_key/overlay-entropy_driver.conf b/samples/psa/persistent_key/overlay-entropy_driver.conf index b2fea61e044a3..0feb3ad09493f 100644 --- a/samples/psa/persistent_key/overlay-entropy_driver.conf +++ b/samples/psa/persistent_key/overlay-entropy_driver.conf @@ -1,4 +1,3 @@ # SPDX-License-Identifier: Apache-2.0 CONFIG_ENTROPY_GENERATOR=y -CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG=y diff --git a/tests/bsim/bluetooth/host/gatt/caching/psa_overlay.conf b/tests/bsim/bluetooth/host/gatt/caching/psa_overlay.conf index 7086f66d96d52..49282c5e502db 100644 --- a/tests/bsim/bluetooth/host/gatt/caching/psa_overlay.conf +++ b/tests/bsim/bluetooth/host/gatt/caching/psa_overlay.conf @@ -4,4 +4,3 @@ CONFIG_MBEDTLS_PSA_CRYPTO_C=y CONFIG_PSA_CRYPTO_ENABLE_ALL=y CONFIG_ENTROPY_GENERATOR=y -CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG=y diff --git a/tests/bsim/bluetooth/ll/conn/psa_overlay.conf b/tests/bsim/bluetooth/ll/conn/psa_overlay.conf index 7086f66d96d52..49282c5e502db 100644 --- a/tests/bsim/bluetooth/ll/conn/psa_overlay.conf +++ b/tests/bsim/bluetooth/ll/conn/psa_overlay.conf @@ -4,4 +4,3 @@ CONFIG_MBEDTLS_PSA_CRYPTO_C=y CONFIG_PSA_CRYPTO_ENABLE_ALL=y CONFIG_ENTROPY_GENERATOR=y -CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG=y diff --git a/tests/crypto/mbedtls_psa/prj.conf b/tests/crypto/mbedtls_psa/prj.conf index 0f4585d6b49d3..54dd833011b1f 100644 --- a/tests/crypto/mbedtls_psa/prj.conf +++ b/tests/crypto/mbedtls_psa/prj.conf @@ -3,4 +3,3 @@ CONFIG_ZTEST=y CONFIG_MBEDTLS=y CONFIG_MBEDTLS_PSA_CRYPTO_C=y -CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG=y diff --git a/tests/crypto/mbedtls_psa/testcase.yaml b/tests/crypto/mbedtls_psa/testcase.yaml index 6b96e8ff5f6fa..187e25b1976c8 100644 --- a/tests/crypto/mbedtls_psa/testcase.yaml +++ b/tests/crypto/mbedtls_psa/testcase.yaml @@ -11,8 +11,6 @@ # - no TF-M enabled devices because we assume that the TF-M implementation # of PSA crypto is working fine on the platforms that support TF-M. # - platform should be testable by the CI. -# - enable CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG in order to reduce as much -# as possible usage of legacy modules in Mbed TLS. # - pick 1 platform which supports entropy driver and 1 which does not. The # latter case will allow to test # CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG_ALLOW_NON_CSPRNG. @@ -34,8 +32,11 @@ tests: # Pick a platform which does not have an entropy driver. In this case we # enable the timer random generator because it's always available on all # platforms. + # Explicitly select CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG because this is + # not "automatically selected" when there is no CSPRNG available. integration_platforms: - qemu_x86 extra_configs: + - CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG=y - CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG_ALLOW_NON_CSPRNG=y - CONFIG_TEST_RANDOM_GENERATOR=y diff --git a/tests/crypto/secp256r1/mbedtls.conf b/tests/crypto/secp256r1/mbedtls.conf index dd8231a21ca54..e87e14abd71ae 100644 --- a/tests/crypto/secp256r1/mbedtls.conf +++ b/tests/crypto/secp256r1/mbedtls.conf @@ -1,5 +1,4 @@ CONFIG_MBEDTLS=y -CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG=y CONFIG_MBEDTLS_PSA_CRYPTO_C=y CONFIG_MBEDTLS_PSA_P256M_DRIVER_ENABLED=y diff --git a/tests/crypto/secp256r1/p256-m_raw.conf b/tests/crypto/secp256r1/p256-m_raw.conf index 801a31df91a86..5ac706ef29bf6 100644 --- a/tests/crypto/secp256r1/p256-m_raw.conf +++ b/tests/crypto/secp256r1/p256-m_raw.conf @@ -1,5 +1,4 @@ CONFIG_MBEDTLS=y -CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG=y CONFIG_MBEDTLS_PSA_CRYPTO_C=y CONFIG_MBEDTLS_PSA_P256M_DRIVER_ENABLED=y CONFIG_MBEDTLS_PSA_P256M_DRIVER_RAW=y diff --git a/tests/net/socket/tls_configurations/prj.conf b/tests/net/socket/tls_configurations/prj.conf index 93a8c0f8b1230..23842f6a64149 100644 --- a/tests/net/socket/tls_configurations/prj.conf +++ b/tests/net/socket/tls_configurations/prj.conf @@ -28,7 +28,6 @@ CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=2048 CONFIG_MBEDTLS_PEM_CERTIFICATE_FORMAT=y # Build the PSA Crypto core so that the TLS stack uses the PSA crypto API. CONFIG_MBEDTLS_PSA_CRYPTO_C=y -CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG=y CONFIG_ENTROPY_GENERATOR=y # Disable some Kconfigs that are implied by CONFIG_NET_SOCKETS_SOCKOPT_TLS. diff --git a/tests/subsys/jwt/testcase.yaml b/tests/subsys/jwt/testcase.yaml index f439e9aea9e1c..8744d51bbd03b 100644 --- a/tests/subsys/jwt/testcase.yaml +++ b/tests/subsys/jwt/testcase.yaml @@ -12,6 +12,9 @@ tests: libraries.encoding.jwt.ecdsa.psa: extra_configs: - CONFIG_JWT_SIGN_ECDSA_PSA=y + # Explicitly select CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG because this + # is not automatically selected on platforms that do not have a CSPRNG + # source. - CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG=y - CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG_ALLOW_NON_CSPRNG=y libraries.encoding.jwt.rsa.legacy: @@ -21,5 +24,8 @@ tests: libraries.encoding.jwt.rsa.psa: extra_configs: - CONFIG_JWT_SIGN_RSA_PSA=y + # Explicitly select CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG because this + # is not automatically selected on platforms that do not have a CSPRNG + # source. - CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG=y - CONFIG_MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG_ALLOW_NON_CSPRNG=y From 516886be1b8ad699ea0e2d32c96bbc5d2240a9c7 Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Tue, 5 Nov 2024 14:59:24 +0100 Subject: [PATCH 2907/4482] mbedtls: MBEDTLS_ENTROPY_POLL_ZEPHYR default on if MBEDTLS_ENTROPY_C As long as MBEDTLS_ENTROPY_C is enabled, Mbed TLS needs to poll some entropy source to gather data that will then be processed by CTR/HMAC-DRBG modules. This means that in most of the cases, once MBEDTLS_ENTROPY_C is enabled then also MBEDTLS_ENTROPY_POLL_ZEPHYR needs to be enabled. This was done manually until now, as the long list of samples/tests demonstrate. This commit solves this dependency by defaulting MBEDTLS_ENTROPY_POLL_ZEPHYR to on as soon as MBEDTLS_ENTROPY_C is set. As a consequence, all manual enablement of MBEDTLS_ENTROPY_POLL_ZEPHYR in samples/tests are removed. Signed-off-by: Valerio Setti --- drivers/bluetooth/hci/Kconfig | 1 - drivers/wifi/esp32/Kconfig.esp32 | 1 - modules/mbedtls/Kconfig.tls-generic | 1 + samples/net/wifi/shell/boards/frdm_rw612.conf | 1 - samples/net/wifi/shell/boards/rd_rw612_bga.conf | 1 - samples/psa/its/overlay-entropy_not_secure.conf | 1 - samples/psa/persistent_key/overlay-entropy_not_secure.conf | 1 - subsys/bluetooth/mesh/Kconfig | 1 - tests/modules/uoscore/prj.conf | 1 - .../subsys/secure_storage/psa/crypto/overlay-secure_storage.conf | 1 - .../subsys/secure_storage/psa/its/overlay-default_transform.conf | 1 - tests/subsys/storage/flash_map/overlay-psa.conf | 1 + 12 files changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/bluetooth/hci/Kconfig b/drivers/bluetooth/hci/Kconfig index e15ba3bb1f388..d2a68ae375891 100644 --- a/drivers/bluetooth/hci/Kconfig +++ b/drivers/bluetooth/hci/Kconfig @@ -112,7 +112,6 @@ config BT_SILABS_EFR32 select MBEDTLS select MBEDTLS_PSA_CRYPTO_C select MBEDTLS_ENTROPY_C - select MBEDTLS_ENTROPY_POLL_ZEPHYR help Use Silicon Labs binary Bluetooth library to connect to the controller. diff --git a/drivers/wifi/esp32/Kconfig.esp32 b/drivers/wifi/esp32/Kconfig.esp32 index 6732bd5ff7eb8..0da3e58c62ae4 100644 --- a/drivers/wifi/esp32/Kconfig.esp32 +++ b/drivers/wifi/esp32/Kconfig.esp32 @@ -377,7 +377,6 @@ config ESP32_WIFI_MBEDTLS_CRYPTO select MBEDTLS_CIPHER_MODE_CTR_ENABLED select MBEDTLS_CMAC select MBEDTLS_ENTROPY_C - select MBEDTLS_ENTROPY_POLL_ZEPHYR help Select this option to use MbedTLS crypto APIs which utilize hardware acceleration. diff --git a/modules/mbedtls/Kconfig.tls-generic b/modules/mbedtls/Kconfig.tls-generic index 2e6e6b7f8c322..779d3b356f826 100644 --- a/modules/mbedtls/Kconfig.tls-generic +++ b/modules/mbedtls/Kconfig.tls-generic @@ -398,6 +398,7 @@ config MBEDTLS_ENTROPY_C config MBEDTLS_ENTROPY_POLL_ZEPHYR bool "Provide entropy data to Mbed TLS through entropy driver or random generator" + default y depends on MBEDTLS_ENTROPY_C help Provide entropy data to the Mbed TLS's entropy module through either diff --git a/samples/net/wifi/shell/boards/frdm_rw612.conf b/samples/net/wifi/shell/boards/frdm_rw612.conf index 87de6bc8dbdee..e9ba4d7df6f34 100644 --- a/samples/net/wifi/shell/boards/frdm_rw612.conf +++ b/samples/net/wifi/shell/boards/frdm_rw612.conf @@ -103,7 +103,6 @@ CONFIG_MBEDTLS_USER_CONFIG_FILE="wpa_supp_els_pkc_mbedtls_config.h" CONFIG_ENTROPY_GENERATOR=y CONFIG_MBEDTLS_PSA_CRYPTO_C=y CONFIG_MBEDTLS_ENTROPY_C=y -CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=8192 # power management diff --git a/samples/net/wifi/shell/boards/rd_rw612_bga.conf b/samples/net/wifi/shell/boards/rd_rw612_bga.conf index 633137e3fb02d..5ecd5b4f1e705 100644 --- a/samples/net/wifi/shell/boards/rd_rw612_bga.conf +++ b/samples/net/wifi/shell/boards/rd_rw612_bga.conf @@ -102,7 +102,6 @@ CONFIG_MBEDTLS_USER_CONFIG_FILE="wpa_supp_els_pkc_mbedtls_config.h" CONFIG_ENTROPY_GENERATOR=y CONFIG_MBEDTLS_PSA_CRYPTO_C=y CONFIG_MBEDTLS_ENTROPY_C=y -CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=8192 # power management diff --git a/samples/psa/its/overlay-entropy_not_secure.conf b/samples/psa/its/overlay-entropy_not_secure.conf index 2aba3a2c7e27d..f2ab17793542e 100644 --- a/samples/psa/its/overlay-entropy_not_secure.conf +++ b/samples/psa/its/overlay-entropy_not_secure.conf @@ -2,4 +2,3 @@ CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_TIMER_RANDOM_GENERATOR=y -CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y diff --git a/samples/psa/persistent_key/overlay-entropy_not_secure.conf b/samples/psa/persistent_key/overlay-entropy_not_secure.conf index 2aba3a2c7e27d..f2ab17793542e 100644 --- a/samples/psa/persistent_key/overlay-entropy_not_secure.conf +++ b/samples/psa/persistent_key/overlay-entropy_not_secure.conf @@ -2,4 +2,3 @@ CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_TIMER_RANDOM_GENERATOR=y -CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 530f3a4fdb401..4731d1c4179b2 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1476,7 +1476,6 @@ config BT_MESH_USES_MBEDTLS_PSA select EXPERIMENTAL select MBEDTLS select MBEDTLS_ENTROPY_C - select MBEDTLS_ENTROPY_POLL_ZEPHYR select MBEDTLS_PSA_CRYPTO_C select MBEDTLS_USE_PSA_CRYPTO select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT diff --git a/tests/modules/uoscore/prj.conf b/tests/modules/uoscore/prj.conf index f661156dbc1d6..d86ae838b21d3 100644 --- a/tests/modules/uoscore/prj.conf +++ b/tests/modules/uoscore/prj.conf @@ -13,7 +13,6 @@ CONFIG_MBEDTLS=y CONFIG_MBEDTLS_ENABLE_HEAP=y CONFIG_MBEDTLS_HEAP_SIZE=2048 CONFIG_MBEDTLS_ENTROPY_C=y -CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y # PSA Crypto options diff --git a/tests/subsys/secure_storage/psa/crypto/overlay-secure_storage.conf b/tests/subsys/secure_storage/psa/crypto/overlay-secure_storage.conf index 84d933c2332ba..063c04fd2b5e7 100644 --- a/tests/subsys/secure_storage/psa/crypto/overlay-secure_storage.conf +++ b/tests/subsys/secure_storage/psa/crypto/overlay-secure_storage.conf @@ -4,7 +4,6 @@ CONFIG_MAIN_STACK_SIZE=2048 CONFIG_MBEDTLS=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_TIMER_RANDOM_GENERATOR=y -CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y CONFIG_MBEDTLS_PSA_CRYPTO_C=y CONFIG_SECURE_STORAGE=y diff --git a/tests/subsys/secure_storage/psa/its/overlay-default_transform.conf b/tests/subsys/secure_storage/psa/its/overlay-default_transform.conf index 52751db59b622..2f49f5d6593aa 100644 --- a/tests/subsys/secure_storage/psa/its/overlay-default_transform.conf +++ b/tests/subsys/secure_storage/psa/its/overlay-default_transform.conf @@ -1,7 +1,6 @@ CONFIG_MBEDTLS=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_TIMER_RANDOM_GENERATOR=y -CONFIG_MBEDTLS_ENTROPY_POLL_ZEPHYR=y CONFIG_MBEDTLS_PSA_CRYPTO_C=y # SETTINGS_MAX_VAL_LEN (256) - flags (1) - CONFIG_SECURE_STORAGE_ITS_TRANSFORM_OUTPUT_OVERHEAD (28) diff --git a/tests/subsys/storage/flash_map/overlay-psa.conf b/tests/subsys/storage/flash_map/overlay-psa.conf index 4b5dcfd9af67d..e70359a2d54e6 100644 --- a/tests/subsys/storage/flash_map/overlay-psa.conf +++ b/tests/subsys/storage/flash_map/overlay-psa.conf @@ -1,3 +1,4 @@ CONFIG_FLASH_AREA_CHECK_INTEGRITY_PSA=y CONFIG_MBEDTLS=y CONFIG_MBEDTLS_PSA_CRYPTO_C=y +CONFIG_TEST_RANDOM_GENERATOR=y From cf45ab85d2d60b65f4a05fca509be09eabd28ade Mon Sep 17 00:00:00 2001 From: Federico Di Gregorio Date: Fri, 18 Oct 2024 17:51:14 +0200 Subject: [PATCH 2908/4482] boards: opta: ethernet reorganization This set of changes reorganize the ethernet configuration by removing the use a regulator to enable the PHY: the correct GPIO pin is set in code only if the network has been configured via CONFIG_NET_L2_ETHERNET. Signed-off-by: Federico Di Gregorio --- boards/arduino/opta/CMakeLists.txt | 2 +- boards/arduino/opta/arduino_opta-common.dtsi | 4 ++ .../opta/arduino_opta_stm32h747xx_m7.dts | 19 ++------ .../arduino_opta_stm32h747xx_m7_defconfig | 4 -- boards/arduino/opta/board_gpio_hse.c | 30 ------------ boards/arduino/opta/board_gpio_init.c | 46 +++++++++++++++++++ .../arduino_opta_stm32h747xx_m7.overlay | 9 ++++ 7 files changed, 65 insertions(+), 49 deletions(-) delete mode 100644 boards/arduino/opta/board_gpio_hse.c create mode 100644 boards/arduino/opta/board_gpio_init.c create mode 100644 samples/net/telnet/boards/arduino_opta_stm32h747xx_m7.overlay diff --git a/boards/arduino/opta/CMakeLists.txt b/boards/arduino/opta/CMakeLists.txt index c4483abeb70c7..07d2bfea9bc8e 100644 --- a/boards/arduino/opta/CMakeLists.txt +++ b/boards/arduino/opta/CMakeLists.txt @@ -1,4 +1,4 @@ # Copyright (c) 2021 STMicroelectronics # SPDX-License-Identifier: Apache-2.0 -zephyr_sources(board_gpio_hse.c) +zephyr_sources(board_gpio_init.c) diff --git a/boards/arduino/opta/arduino_opta-common.dtsi b/boards/arduino/opta/arduino_opta-common.dtsi index dcf957265c46a..add572d6cbc7a 100644 --- a/boards/arduino/opta/arduino_opta-common.dtsi +++ b/boards/arduino/opta/arduino_opta-common.dtsi @@ -87,3 +87,7 @@ &mailbox { status = "okay"; }; + +&rng { + status = "okay"; +}; diff --git a/boards/arduino/opta/arduino_opta_stm32h747xx_m7.dts b/boards/arduino/opta/arduino_opta_stm32h747xx_m7.dts index e26a16c785856..7ddf514eff578 100644 --- a/boards/arduino/opta/arduino_opta_stm32h747xx_m7.dts +++ b/boards/arduino/opta/arduino_opta_stm32h747xx_m7.dts @@ -24,14 +24,6 @@ zephyr,code-partition = &slot0_partition; }; - ethernet_phy_en: ethernet_phy_en { - compatible = "regulator-fixed"; - regulator-name = "ethernet-phy-reset-release"; - enable-gpios = <&gpioj 15 GPIO_ACTIVE_HIGH>; - regulator-boot-on; - status = "okay"; - }; - sdram2: sdram@d0000000 { compatible = "zephyr,memory-region", "mmio-sram"; device_type = "memory"; @@ -101,6 +93,7 @@ zephyr_udc0: &usbotg_fs { }; }; +/* Assign USB to M7 by default */ &usbotg_fs { status = "okay"; }; @@ -109,10 +102,7 @@ zephyr_udc0: &usbotg_fs { status = "disabled"; }; -&cdc_acm_uart0 { - status = "okay"; -}; - +/* Assign ethernet to M7 by default */ &mac { pinctrl-0 = < ð_ref_clk_pa1 @@ -128,9 +118,9 @@ zephyr_udc0: &usbotg_fs { }; &mdio { - status = "okay"; pinctrl-0 = <ð_mdio_pa2 ð_mdc_pc1>; pinctrl-names = "default"; + status = "okay"; ethernet-phy@0 { compatible = "ethernet-phy"; @@ -139,6 +129,7 @@ zephyr_udc0: &usbotg_fs { }; }; -&rng { +/* Assign USB serial (ACM) to M7 to have a working console out of the box */ +&cdc_acm_uart0 { status = "okay"; }; diff --git a/boards/arduino/opta/arduino_opta_stm32h747xx_m7_defconfig b/boards/arduino/opta/arduino_opta_stm32h747xx_m7_defconfig index a0dd727422ebf..dcb6d1edc8744 100644 --- a/boards/arduino/opta/arduino_opta_stm32h747xx_m7_defconfig +++ b/boards/arduino/opta/arduino_opta_stm32h747xx_m7_defconfig @@ -31,7 +31,3 @@ CONFIG_UART_LINE_CTRL=y # Enable USB Stack (needed for the console to work) CONFIG_USB_DEVICE_STACK=y - -# Enable regulator (needed to enable eth) -CONFIG_REGULATOR=y -CONFIG_REGULATOR_FIXED=y diff --git a/boards/arduino/opta/board_gpio_hse.c b/boards/arduino/opta/board_gpio_hse.c deleted file mode 100644 index 2ee45f52dadfc..0000000000000 --- a/boards/arduino/opta/board_gpio_hse.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2024 DNDG srl - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include - -static int board_gpio_hse(void) -{ - /* The external oscillator that drives the HSE clock should be enabled - * by setting the GPIOI1 pin. This function is registered at priority - * RE_KERNEL_1 to be executed before the standard STM clock - * setup code. - */ - - LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOH); - - LL_GPIO_SetPinMode(GPIOH, LL_GPIO_PIN_1, LL_GPIO_MODE_OUTPUT); - LL_GPIO_SetPinSpeed(GPIOH, LL_GPIO_PIN_1, LL_GPIO_SPEED_FREQ_LOW); - LL_GPIO_SetPinOutputType(GPIOH, LL_GPIO_PIN_1, LL_GPIO_OUTPUT_PUSHPULL); - LL_GPIO_SetPinPull(GPIOH, LL_GPIO_PIN_1, LL_GPIO_PULL_UP); - LL_GPIO_SetOutputPin(GPIOH, LL_GPIO_PIN_1); - - return 0; -} - -SYS_INIT(board_gpio_hse, PRE_KERNEL_1, 0); diff --git a/boards/arduino/opta/board_gpio_init.c b/boards/arduino/opta/board_gpio_init.c new file mode 100644 index 0000000000000..fcf8f6872a6de --- /dev/null +++ b/boards/arduino/opta/board_gpio_init.c @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 DNDG srl + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +static int board_gpio_init(void) +{ + /* The external oscillator that drives the HSE clock should be enabled + * by setting the GPIOI1 pin. This function is registered at priority + * RE_KERNEL_1 to be executed before the standard STM clock + * setup code. + * + * Note that the HSE should be turned on by the M7 only because M4 + * is not booted by default on Opta and cannot configure the clocks + * anyway. + */ +#ifdef CONFIG_BOARD_ARDUINO_OPTA_STM32H747XX_M7 + LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOH); + LL_GPIO_SetPinMode(GPIOH, LL_GPIO_PIN_1, LL_GPIO_MODE_OUTPUT); + LL_GPIO_SetPinSpeed(GPIOH, LL_GPIO_PIN_1, LL_GPIO_SPEED_FREQ_LOW); + LL_GPIO_SetPinOutputType(GPIOH, LL_GPIO_PIN_1, LL_GPIO_OUTPUT_PUSHPULL); + LL_GPIO_SetPinPull(GPIOH, LL_GPIO_PIN_1, LL_GPIO_PULL_UP); + LL_GPIO_SetOutputPin(GPIOH, LL_GPIO_PIN_1); +#endif + + /* The ethernet adapter is enabled by settig the GPIOJ15 pin to 1. + * This is done only if the network has been explicitly configured + */ +#ifdef CONFIG_NET_L2_ETHERNET + LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOJ); + LL_GPIO_SetPinMode(GPIOJ, LL_GPIO_PIN_15, LL_GPIO_MODE_OUTPUT); + LL_GPIO_SetPinSpeed(GPIOJ, LL_GPIO_PIN_15, LL_GPIO_SPEED_FREQ_LOW); + LL_GPIO_SetPinOutputType(GPIOJ, LL_GPIO_PIN_15, LL_GPIO_OUTPUT_PUSHPULL); + LL_GPIO_SetPinPull(GPIOJ, LL_GPIO_PIN_15, LL_GPIO_PULL_UP); + LL_GPIO_SetOutputPin(GPIOJ, LL_GPIO_PIN_15); +#endif + + return 0; +} + +SYS_INIT(board_gpio_init, PRE_KERNEL_1, 0); diff --git a/samples/net/telnet/boards/arduino_opta_stm32h747xx_m7.overlay b/samples/net/telnet/boards/arduino_opta_stm32h747xx_m7.overlay new file mode 100644 index 0000000000000..189db2ea3e4c4 --- /dev/null +++ b/samples/net/telnet/boards/arduino_opta_stm32h747xx_m7.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 DNDG srl + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&mac { + status = "okay"; +}; From 32309f812469c59f6aa639236468aeb3d2a28036 Mon Sep 17 00:00:00 2001 From: Federico Di Gregorio Date: Fri, 18 Oct 2024 17:54:05 +0200 Subject: [PATCH 2909/4482] boards: opta: device tree cleanup Some changes to cleanup and clarify some device tree nodes: * removed wrong sdram2 definition * added all internal flash slots accessible from M4 * added all internal flash slots accessible from M7 * removed CONFIG_UART_LINE_CTRL because not needed by USB CDC ACM Signed-off-by: Federico Di Gregorio --- .../arduino/opta/arduino_opta_stm32h747xx_m4.dts | 9 +++++++-- .../arduino/opta/arduino_opta_stm32h747xx_m7.dts | 14 ++++++-------- .../opta/arduino_opta_stm32h747xx_m7_defconfig | 1 - 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/boards/arduino/opta/arduino_opta_stm32h747xx_m4.dts b/boards/arduino/opta/arduino_opta_stm32h747xx_m4.dts index e2825752ddc77..ea586872b63f8 100644 --- a/boards/arduino/opta/arduino_opta_stm32h747xx_m4.dts +++ b/boards/arduino/opta/arduino_opta_stm32h747xx_m4.dts @@ -18,7 +18,7 @@ chosen { zephyr,sram = &sram1; zephyr,flash = &flash1; - zephyr,code-partition = &slot0_partition; + zephyr,code-partition = &slot1_partition; }; }; @@ -28,7 +28,12 @@ #address-cells = <1>; #size-cells = <1>; - slot0_partition: partition@80000 { + slot0_partition: partition@0 { + label = "unused"; + reg = <0x00000000 DT_SIZE_K(512)>; + }; + + slot1_partition: partition@80000 { label = "image-0"; reg = <0x00080000 DT_SIZE_K(512)>; }; diff --git a/boards/arduino/opta/arduino_opta_stm32h747xx_m7.dts b/boards/arduino/opta/arduino_opta_stm32h747xx_m7.dts index 7ddf514eff578..cc408d4daf207 100644 --- a/boards/arduino/opta/arduino_opta_stm32h747xx_m7.dts +++ b/boards/arduino/opta/arduino_opta_stm32h747xx_m7.dts @@ -23,14 +23,6 @@ zephyr,flash = &flash0; zephyr,code-partition = &slot0_partition; }; - - sdram2: sdram@d0000000 { - compatible = "zephyr,memory-region", "mmio-sram"; - device_type = "memory"; - reg = <0xd0000000 DT_SIZE_M(32)>; - zephyr,memory-region = "SDRAM2"; - zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_RAM) )>; - }; }; zephyr_udc0: &usbotg_fs { @@ -86,6 +78,12 @@ zephyr_udc0: &usbotg_fs { #address-cells = <1>; #size-cells = <1>; + boot_partition: partition@0 { + label = "mcu-boot"; + reg = <0x00000000 DT_SIZE_K(256)>; + read-only; + }; + slot0_partition: partition@40000 { label = "image-0"; reg = <0x00040000 DT_SIZE_K(768)>; diff --git a/boards/arduino/opta/arduino_opta_stm32h747xx_m7_defconfig b/boards/arduino/opta/arduino_opta_stm32h747xx_m7_defconfig index dcb6d1edc8744..7440b2163e333 100644 --- a/boards/arduino/opta/arduino_opta_stm32h747xx_m7_defconfig +++ b/boards/arduino/opta/arduino_opta_stm32h747xx_m7_defconfig @@ -27,7 +27,6 @@ CONFIG_STM32H7_BOOT_M4_AT_INIT=n CONFIG_SERIAL=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y -CONFIG_UART_LINE_CTRL=y # Enable USB Stack (needed for the console to work) CONFIG_USB_DEVICE_STACK=y From f8ab959d7e94c85156b89e914232e7bca8fbc217 Mon Sep 17 00:00:00 2001 From: Federico Di Gregorio Date: Thu, 17 Oct 2024 15:28:03 +0200 Subject: [PATCH 2910/4482] boards: opta: RS485 support This set of changes enables the RS485 hardware connected to usart3 and provides some overlays that allow for easily running the modbus rtu_client and rtu_server samples on Opta. Signed-off-by: Federico Di Gregorio --- boards/arduino/opta/arduino_opta-common.dtsi | 12 ++++++++++++ boards/arduino/opta/doc/index.rst | 2 ++ .../boards/arduino_opta_stm32h747xx_m7.overlay | 12 ++++++++++++ .../boards/arduino_opta_stm32h747xx_m7.overlay | 12 ++++++++++++ .../boards/arduino_opta_stm32h747xx_m7.overlay | 12 ++++++++++++ 5 files changed, 50 insertions(+) create mode 100644 samples/subsys/modbus/rtu_client/boards/arduino_opta_stm32h747xx_m7.overlay create mode 100644 samples/subsys/modbus/rtu_server/boards/arduino_opta_stm32h747xx_m7.overlay create mode 100644 tests/subsys/modbus/boards/arduino_opta_stm32h747xx_m7.overlay diff --git a/boards/arduino/opta/arduino_opta-common.dtsi b/boards/arduino/opta/arduino_opta-common.dtsi index add572d6cbc7a..580688eba7924 100644 --- a/boards/arduino/opta/arduino_opta-common.dtsi +++ b/boards/arduino/opta/arduino_opta-common.dtsi @@ -91,3 +91,15 @@ &rng { status = "okay"; }; + +&usart3 { + pinctrl-0 = <&usart3_tx_pb10 &usart3_rx_pb11 &usart3_cts_pb13 &usart3_de_pb14>; + pinctrl-names = "default"; + current-speed = <115200>; + /* The RS485 is often used with the ModBus protocol. */ + modbus0 { + compatible = "zephyr,modbus-serial"; + de-gpios = <&gpiob 14 GPIO_ACTIVE_HIGH>; + re-gpios = <&gpiob 13 GPIO_ACTIVE_LOW>; + }; +}; diff --git a/boards/arduino/opta/doc/index.rst b/boards/arduino/opta/doc/index.rst index 01badd338ffff..8c6aa78848717 100644 --- a/boards/arduino/opta/doc/index.rst +++ b/boards/arduino/opta/doc/index.rst @@ -67,6 +67,8 @@ supports the following hardware features: +-----------+------------+-------------------------------------+ | ETHERNET | on-board | eth | +-----------+------------+-------------------------------------+ +| RS485 | on-board | uart | ++-----------+------------+-------------------------------------+ The ``arduino_opta/stm32h747xx/m4`` board target supports the following hardware features: diff --git a/samples/subsys/modbus/rtu_client/boards/arduino_opta_stm32h747xx_m7.overlay b/samples/subsys/modbus/rtu_client/boards/arduino_opta_stm32h747xx_m7.overlay new file mode 100644 index 0000000000000..1838da4c32c33 --- /dev/null +++ b/samples/subsys/modbus/rtu_client/boards/arduino_opta_stm32h747xx_m7.overlay @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2024 DNDG srl + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&usart3 { + modbus0 { + status = "okay"; + }; + status = "okay"; +}; diff --git a/samples/subsys/modbus/rtu_server/boards/arduino_opta_stm32h747xx_m7.overlay b/samples/subsys/modbus/rtu_server/boards/arduino_opta_stm32h747xx_m7.overlay new file mode 100644 index 0000000000000..1838da4c32c33 --- /dev/null +++ b/samples/subsys/modbus/rtu_server/boards/arduino_opta_stm32h747xx_m7.overlay @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2024 DNDG srl + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&usart3 { + modbus0 { + status = "okay"; + }; + status = "okay"; +}; diff --git a/tests/subsys/modbus/boards/arduino_opta_stm32h747xx_m7.overlay b/tests/subsys/modbus/boards/arduino_opta_stm32h747xx_m7.overlay new file mode 100644 index 0000000000000..1838da4c32c33 --- /dev/null +++ b/tests/subsys/modbus/boards/arduino_opta_stm32h747xx_m7.overlay @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2024 DNDG srl + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&usart3 { + modbus0 { + status = "okay"; + }; + status = "okay"; +}; From 1f5a1b50fa7d7694b8ad6dfa6e447408e19cb521 Mon Sep 17 00:00:00 2001 From: Federico Di Gregorio Date: Thu, 17 Oct 2024 15:29:12 +0200 Subject: [PATCH 2911/4482] boards: opta: ADC support A valid device tree configuration is provided for the ADCs of the 8 input channels and the sample adc_dt works out of the box. Obviously this is not the only possible configuration but it provides a good template for further customization without the need to lookup the ADC GPIOs and connections in the schematics. Signed-off-by: Federico Di Gregorio --- boards/arduino/opta/arduino_opta-common.dtsi | 98 +++++++++++++++++++ .../arduino_opta_stm32h747xx_m7.overlay | 32 ++++++ 2 files changed, 130 insertions(+) create mode 100644 samples/drivers/adc/adc_dt/boards/arduino_opta_stm32h747xx_m7.overlay diff --git a/boards/arduino/opta/arduino_opta-common.dtsi b/boards/arduino/opta/arduino_opta-common.dtsi index 580688eba7924..36a96cc421af6 100644 --- a/boards/arduino/opta/arduino_opta-common.dtsi +++ b/boards/arduino/opta/arduino_opta-common.dtsi @@ -103,3 +103,101 @@ re-gpios = <&gpiob 13 GPIO_ACTIVE_LOW>; }; }; + +&adc1 { + pinctrl-0 = <&adc1_inp0_pa0_c &adc1_inp6_pf12>; + pinctrl-names = "default"; + st,adc-clock-source = ; + st,adc-prescaler = <4>; + vref-mv = <10000>; + + #address-cells = <1>; + #size-cells = <0>; + + a0: channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <16>; + }; + + a2: channel@6 { + reg = <6>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <16>; + }; + +}; + +&adc2 { + pinctrl-0 = <&adc2_inp9_pb0>; + pinctrl-names = "default"; + st,adc-clock-source = ; + st,adc-prescaler = <4>; + vref-mv = <10000>; + + #address-cells = <1>; + #size-cells = <0>; + + a3: channel@9 { + reg = <9>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <16>; + }; +}; + +&adc3 { + pinctrl-0 = <&adc3_inp6_pf10 &adc3_inp7_pf8 &adc3_inp8_pf6 &adc3_inp9_pf4 &adc3_inp0_pc2_c>; + pinctrl-names = "default"; + st,adc-clock-source = ; + st,adc-prescaler = <4>; + vref-mv = <10000>; + + #address-cells = <1>; + #size-cells = <0>; + + a1: channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <16>; + }; + + a4: channel@6 { + reg = <6>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <16>; + }; + + a5: channel@7 { + reg = <7>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <16>; + }; + + a6: channel@8 { + reg = <8>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <16>; + }; + + a7: channel@9 { + reg = <9>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <16>; + }; +}; diff --git a/samples/drivers/adc/adc_dt/boards/arduino_opta_stm32h747xx_m7.overlay b/samples/drivers/adc/adc_dt/boards/arduino_opta_stm32h747xx_m7.overlay new file mode 100644 index 0000000000000..098deab62759f --- /dev/null +++ b/samples/drivers/adc/adc_dt/boards/arduino_opta_stm32h747xx_m7.overlay @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2021 STMicroelectronics + * Copyright (c) 2024 DNDG srl + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + zephyr,user { + io-channels = + <&adc1 0>, /* I1 */ + <&adc3 0>, /* I2 */ + <&adc1 6>, /* I3 */ + <&adc2 9>, /* I4 */ + <&adc3 6>, /* I5 */ + <&adc3 7>, /* I6 */ + <&adc3 8>, /* I7 */ + <&adc3 9>; /* I8 */ + }; +}; + +&adc1 { + status ="okay"; +}; + +&adc2 { + status ="okay"; +}; + +&adc3 { + status = "okay"; +}; From a8f5958c782ca6bb7d09e39d8f20c52a15d8959c Mon Sep 17 00:00:00 2001 From: Lucien Zhao Date: Tue, 27 Aug 2024 11:35:55 +0800 Subject: [PATCH 2912/4482] soc: nxp: imxrt: imxrt118x: add flexspi support add flexspi.c file to get flexspi clock rate. Enable flexspi1 clock if don't boot from flash. Use custom fixed mpu_regions.c file to config MPU for CM7 Signed-off-by: Lucien Zhao --- soc/nxp/imxrt/CMakeLists.txt | 3 ++ soc/nxp/imxrt/imxrt118x/CMakeLists.txt | 7 +++ soc/nxp/imxrt/imxrt118x/Kconfig | 1 + soc/nxp/imxrt/imxrt118x/flexspi.c | 65 ++++++++++++++++++++++++++ soc/nxp/imxrt/imxrt118x/soc.c | 28 +++++++++++ soc/nxp/imxrt/imxrt118x/soc.h | 4 ++ 6 files changed, 108 insertions(+) create mode 100644 soc/nxp/imxrt/imxrt118x/flexspi.c diff --git a/soc/nxp/imxrt/CMakeLists.txt b/soc/nxp/imxrt/CMakeLists.txt index ac5302a32fc7e..5984d081ba9b2 100644 --- a/soc/nxp/imxrt/CMakeLists.txt +++ b/soc/nxp/imxrt/CMakeLists.txt @@ -39,6 +39,9 @@ if(CONFIG_SOC_SERIES_IMXRT10XX OR CONFIG_SOC_SERIES_IMXRT11XX) endif() if(CONFIG_SOC_SERIES_IMXRT118X) + if(CONFIG_SOC_MIMXRT1189_CM7) + zephyr_sources(mpu_regions.c) + endif() if(CONFIG_EXTERNAL_MEM_CONFIG_DATA) set(boot_hdr_xmcd_data_section ".boot_hdr.xmcd_data") endif() diff --git a/soc/nxp/imxrt/imxrt118x/CMakeLists.txt b/soc/nxp/imxrt/imxrt118x/CMakeLists.txt index da554b97e7576..faabf48236ffd 100644 --- a/soc/nxp/imxrt/imxrt118x/CMakeLists.txt +++ b/soc/nxp/imxrt/imxrt118x/CMakeLists.txt @@ -13,4 +13,11 @@ endif() zephyr_include_directories(.) +if(CONFIG_MEMC_MCUX_FLEXSPI) + zephyr_sources(flexspi.c) + if(CONFIG_FLASH_MCUX_FLEXSPI_XIP) + zephyr_code_relocate(FILES flexspi.c LOCATION ${CONFIG_FLASH_MCUX_FLEXSPI_XIP_MEM}_TEXT) + endif() +endif() + set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld CACHE INTERNAL "") diff --git a/soc/nxp/imxrt/imxrt118x/Kconfig b/soc/nxp/imxrt/imxrt118x/Kconfig index c8bcbee4ea03d..b2aa59090af73 100644 --- a/soc/nxp/imxrt/imxrt118x/Kconfig +++ b/soc/nxp/imxrt/imxrt118x/Kconfig @@ -2,6 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 config SOC_SERIES_IMXRT118X + select CPU_HAS_CUSTOM_FIXED_SOC_MPU_REGIONS if SOC_MIMXRT1189_CM7 select CPU_CORTEX_M_HAS_DWT select SOC_RESET_HOOK select INIT_ARCH_HW_AT_BOOT if SOC_MIMXRT1189_CM33 diff --git a/soc/nxp/imxrt/imxrt118x/flexspi.c b/soc/nxp/imxrt/imxrt118x/flexspi.c new file mode 100644 index 0000000000000..b8b49a8f4aa60 --- /dev/null +++ b/soc/nxp/imxrt/imxrt118x/flexspi.c @@ -0,0 +1,65 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +uint32_t flexspi_clock_set_freq(uint32_t clock_name, uint32_t rate) +{ + clock_name_t root; + uint32_t root_rate; + FLEXSPI_Type *flexspi; + clock_root_t flexspi_clk; + clock_ip_name_t clk_gate; + uint32_t divider; + + switch (clock_name) { + case IMX_CCM_FLEXSPI_CLK: + flexspi_clk = kCLOCK_Root_Flexspi1; + flexspi = (FLEXSPI_Type *)DT_REG_ADDR(DT_NODELABEL(flexspi)); + clk_gate = kCLOCK_Flexspi1; + break; + case IMX_CCM_FLEXSPI2_CLK: + flexspi_clk = kCLOCK_Root_Flexspi2; + flexspi = (FLEXSPI_Type *)DT_REG_ADDR(DT_NODELABEL(flexspi2)); + clk_gate = kCLOCK_Flexspi2; + break; + default: + return -ENOTSUP; + } + root = CLOCK_GetRootClockSource(flexspi_clk, + CLOCK_GetRootClockMux(flexspi_clk)); + /* Get clock root frequency */ + root_rate = CLOCK_GetFreq(root); + /* Select a divider based on root clock frequency. We round the + * divider up, so that the resulting clock frequency is lower than + * requested when we can't output the exact requested frequency + */ + divider = ((root_rate + (rate - 1)) / rate); + /* Cap divider to max value */ + divider = MIN(divider, CCM_CLOCK_ROOT_CONTROL_DIV_MASK); + + while (FLEXSPI_GetBusIdleStatus(flexspi) == false) { + /* Spin */ + } + FLEXSPI_Enable(flexspi, false); + + CLOCK_DisableClock(clk_gate); + + CLOCK_SetRootClockDiv(flexspi_clk, divider); + + CLOCK_EnableClock(clk_gate); + + FLEXSPI_Enable(flexspi, true); + + FLEXSPI_SoftwareReset(flexspi); + + return 0; +} diff --git a/soc/nxp/imxrt/imxrt118x/soc.c b/soc/nxp/imxrt/imxrt118x/soc.c index f170b94184078..fa4d3079c3b9d 100644 --- a/soc/nxp/imxrt/imxrt118x/soc.c +++ b/soc/nxp/imxrt/imxrt118x/soc.c @@ -76,6 +76,18 @@ const clock_sys_pll2_config_t sysPll2Config_BOARD_BootClockRUN = { .ssEnable = false, }; +/* Function Name : board_flexspi_clock_safe_config + * Description : FLEXSPI clock source safe configuration weak function. + * Called before clock source configuration. + * Note : Users need override this function to change FLEXSPI clock source to stable + * source when executing code on FLEXSPI memory(XIP). If XIP, the function + * should runs in RAM and move the FLEXSPI clock source to a stable clock + * to avoid instruction/data fetch issue during clock updating. + */ +__attribute__((weak)) void board_flexspi_clock_safe_config(void) +{ +} + /** * @brief Initialize the system clock */ @@ -123,6 +135,12 @@ static ALWAYS_INLINE void clock_init(void) (ANADIG_OSC->OSC_24M_CTRL & ANADIG_OSC_OSC_24M_CTRL_OSC_24M_STABLE_MASK)) { } + /* Call function board_flexspi_clock_safe_config() to move FlexSPI clock to a stable + * clock source to avoid instruction/data fetch issue when updating PLL if XIP + * (execute code on FLEXSPI memory). + */ + board_flexspi_clock_safe_config(); + #ifdef CONFIG_INIT_ARM_PLL /* Init Arm Pll. */ CLOCK_InitArmPll(&armPllConfig_BOARD_BootClockRUN); @@ -391,6 +409,14 @@ static ALWAYS_INLINE void clock_init(void) #endif /* CONFIG_MCUX_LPTMR_TIMER || CONFIG_COUNTER_MCUX_LPTMR */ +#if !(DT_NODE_HAS_COMPAT(DT_PARENT(DT_CHOSEN(zephyr_flash)), nxp_imx_flexspi_nor)) && \ + defined(CONFIG_MEMC_MCUX_FLEXSPI) && DT_NODE_HAS_STATUS(DT_NODELABEL(flexspi), okay) + /* Configure FLEXSPI1 using SYS_PLL3_PFD0_CLK */ + rootCfg.mux = kCLOCK_FLEXSPI1_ClockRoot_MuxSysPll3Pfd0; + rootCfg.div = 3; + CLOCK_SetRootClock(kCLOCK_Root_Flexspi1, &rootCfg); +#endif + /* Keep core clock ungated during WFI */ CCM->LPCG[1].LPM0 = 0x33333333; CCM->LPCG[1].LPM1 = 0x33333333; @@ -511,8 +537,10 @@ void soc_early_init_hook(void) /* Enable data cache */ #if defined(CONFIG_IMXRT118X_CM33_XCACHE_PS) + XCACHE_EnableCache(XCACHE_PC); XCACHE_EnableCache(XCACHE_PS); #elif defined(CONFIG_SOC_MIMXRT1189_CM7) + sys_cache_instr_enable(); sys_cache_data_enable(); #endif __ISB(); diff --git a/soc/nxp/imxrt/imxrt118x/soc.h b/soc/nxp/imxrt/imxrt118x/soc.h index 272227b3a4738..cceb990cc8fb3 100644 --- a/soc/nxp/imxrt/imxrt118x/soc.h +++ b/soc/nxp/imxrt/imxrt118x/soc.h @@ -20,6 +20,10 @@ extern "C" { #endif +#ifdef CONFIG_MEMC_MCUX_FLEXSPI +uint32_t flexspi_clock_set_freq(uint32_t clock_name, uint32_t rate); +#endif + #ifdef __cplusplus } #endif From bfc607e38d43b157e05d0db76eb078bec05a6060 Mon Sep 17 00:00:00 2001 From: Lucien Zhao Date: Tue, 27 Aug 2024 23:06:05 +0800 Subject: [PATCH 2913/4482] dts: arm: nxp: rt118x: add flexspi instance support add flexspi2 and rename flexspi1 to flexspi to adapt flexspi.c driver under soc/nxp/rt118x folder. Signed-off-by: Lucien Zhao --- dts/arm/nxp/nxp_rt118x.dtsi | 11 ++++++++++- dts/arm/nxp/nxp_rt118x_cm33.dtsi | 8 ++++++-- dts/arm/nxp/nxp_rt118x_cm33_ns.dtsi | 7 +++++-- dts/arm/nxp/nxp_rt118x_cm7.dtsi | 9 +++++++-- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/dts/arm/nxp/nxp_rt118x.dtsi b/dts/arm/nxp/nxp_rt118x.dtsi index 6060fc62c5149..0e511bac5dee9 100644 --- a/dts/arm/nxp/nxp_rt118x.dtsi +++ b/dts/arm/nxp/nxp_rt118x.dtsi @@ -665,7 +665,7 @@ }; }; -&flexspi1 { +&flexspi { compatible = "nxp,imx-flexspi"; interrupts = <55 0>; #address-cells = <1>; @@ -674,6 +674,15 @@ clocks = <&ccm IMX_CCM_FLEXSPI_CLK 0x0 0>; }; +&flexspi2 { + compatible = "nxp,imx-flexspi"; + interrupts = <56 0>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + clocks = <&ccm IMX_CCM_FLEXSPI2_CLK 0x0 0>; +}; + &memory { #address-cells = <1>; #size-cells = <1>; diff --git a/dts/arm/nxp/nxp_rt118x_cm33.dtsi b/dts/arm/nxp/nxp_rt118x_cm33.dtsi index 0bc7c5126f307..706be1b04a855 100644 --- a/dts/arm/nxp/nxp_rt118x_cm33.dtsi +++ b/dts/arm/nxp/nxp_rt118x_cm33.dtsi @@ -30,8 +30,12 @@ ranges = <0x0 0x50000000 0x10000000>; }; - flexspi1: spi@525e0000 { - reg = <0x525e0000 0x4000>,<0x38000000 DT_SIZE_M(128)>; + flexspi: spi@525e0000 { + reg = <0x525e0000 0x4000>, <0x38000000 DT_SIZE_M(128)>; + }; + + flexspi2: spi@545e0000 { + reg = <0x545e0000 0x4000>, <0x14000000 DT_SIZE_M(64)>; }; }; }; diff --git a/dts/arm/nxp/nxp_rt118x_cm33_ns.dtsi b/dts/arm/nxp/nxp_rt118x_cm33_ns.dtsi index 2d1a2947b0259..480e376330fb6 100644 --- a/dts/arm/nxp/nxp_rt118x_cm33_ns.dtsi +++ b/dts/arm/nxp/nxp_rt118x_cm33_ns.dtsi @@ -30,10 +30,13 @@ ranges = <0x0 0x40000000 0x10000000>; }; - flexspi1: spi@425e0000 { - reg = <0x425e0000 0x4000>,<0x28000000 DT_SIZE_M(128)>; + flexspi: spi@425e0000 { + reg = <0x425e0000 0x4000>, <0x28000000 DT_SIZE_M(128)>; }; + flexspi2: spi@445e0000 { + reg = <0x445e0000 0x4000>, <0x04000000 DT_SIZE_M(64)>; + }; }; }; diff --git a/dts/arm/nxp/nxp_rt118x_cm7.dtsi b/dts/arm/nxp/nxp_rt118x_cm7.dtsi index 9644dcf3eb324..4b2e60a52a23c 100644 --- a/dts/arm/nxp/nxp_rt118x_cm7.dtsi +++ b/dts/arm/nxp/nxp_rt118x_cm7.dtsi @@ -26,8 +26,13 @@ peripheral: peripheral@40000000 { ranges = <0x0 0x40000000 0x10000000>; }; - flexspi1: spi@425e0000 { - reg = <0x425e0000 0x4000>,<0x28000000 DT_SIZE_M(128)>; + + flexspi: spi@425e0000 { + reg = <0x425e0000 0x4000>, <0x28000000 DT_SIZE_M(128)>; + }; + + flexspi2: spi@445e0000 { + reg = <0x445e0000 0x4000>, <0x04000000 DT_SIZE_M(64)>; }; }; }; From 6463dd610d42298c0d1e410225d1e971d5156ee1 Mon Sep 17 00:00:00 2001 From: Lucien Zhao Date: Tue, 27 Aug 2024 23:09:44 +0800 Subject: [PATCH 2914/4482] drivers: clock_control:: Update ccm_rev2 clock driver for RT118X flexspi_clock_set_freq can be applied for RT118X series. Signed-off-by: Lucien Zhao --- drivers/clock_control/clock_control_mcux_ccm_rev2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clock_control/clock_control_mcux_ccm_rev2.c b/drivers/clock_control/clock_control_mcux_ccm_rev2.c index a3c02451d18bd..703c9f1c7af5b 100644 --- a/drivers/clock_control/clock_control_mcux_ccm_rev2.c +++ b/drivers/clock_control/clock_control_mcux_ccm_rev2.c @@ -270,7 +270,8 @@ static int CCM_SET_FUNC_ATTR mcux_ccm_set_subsys_rate(const struct device *dev, case IMX_CCM_FLEXSPI_CLK: __fallthrough; case IMX_CCM_FLEXSPI2_CLK: -#if defined(CONFIG_SOC_SERIES_IMXRT11XX) && defined(CONFIG_MEMC_MCUX_FLEXSPI) +#if (defined(CONFIG_SOC_SERIES_IMXRT11XX) || defined(CONFIG_SOC_SERIES_IMXRT118X)) \ + && defined(CONFIG_MEMC_MCUX_FLEXSPI) /* The SOC is using the FlexSPI for XIP. Therefore, * the FlexSPI itself must be managed within the function, * which is SOC specific. From 850d471b9549225fa87aa9cba4636a7277f6b9be Mon Sep 17 00:00:00 2001 From: Lucien Zhao Date: Tue, 27 Aug 2024 23:18:01 +0800 Subject: [PATCH 2915/4482] boards: nxp: mimxrt1180_evk: add flexspi1 support USE_HYPERRAM macro defined shouldn't be placed under CONFIG_BOOT_FLEXSPI_NOR. Add flexspi1 pinmux pinctrl and flash partitions Add flash partitions and correct flash parameter. This commit was tested with samples: flash_shell on cm33/cm7 cores Signed-off-by: Lucien Zhao --- boards/nxp/mimxrt1180_evk/CMakeLists.txt | 7 ++-- boards/nxp/mimxrt1180_evk/doc/index.rst | 2 + .../mimxrt1180_evk-pinctrl.dtsi | 14 +++++++ boards/nxp/mimxrt1180_evk/mimxrt1180_evk.dtsi | 37 +++++++++++++++++-- 4 files changed, 54 insertions(+), 6 deletions(-) diff --git a/boards/nxp/mimxrt1180_evk/CMakeLists.txt b/boards/nxp/mimxrt1180_evk/CMakeLists.txt index e8eb5c424256c..1fbff93311635 100644 --- a/boards/nxp/mimxrt1180_evk/CMakeLists.txt +++ b/boards/nxp/mimxrt1180_evk/CMakeLists.txt @@ -22,11 +22,12 @@ if(CONFIG_NXP_IMXRT_BOOT_HEADER) # used on your custom board. zephyr_compile_definitions(XIP_EXTERNAL_FLASH=1) zephyr_compile_definitions(XIP_BOOT_HEADER_ENABLE=1) - if(CONFIG_EXTERNAL_MEM_CONFIG_DATA AND CONFIG_NXP_IMX_EXTERNAL_HYPERRAM) - zephyr_compile_definitions(USE_HYPERRAM) - endif() zephyr_library_sources(${RT1180_BOARD_DIR}/xip/evkmimxrt1180_flexspi_nor_config.c) zephyr_library_include_directories(${RT1180_BOARD_DIR}/xip) zephyr_library_include_directories(${RT1180_BOARD_DIR}) endif() + if(CONFIG_EXTERNAL_MEM_CONFIG_DATA AND CONFIG_NXP_IMX_EXTERNAL_HYPERRAM) + zephyr_compile_definitions(USE_HYPERRAM) + zephyr_library_sources(${RT1180_BOARD_DIR}/xip/evkmimxrt1180_flexspi_nor_config.c) + endif() endif() diff --git a/boards/nxp/mimxrt1180_evk/doc/index.rst b/boards/nxp/mimxrt1180_evk/doc/index.rst index f5ad3fae8c1e6..c8f1147d0b014 100644 --- a/boards/nxp/mimxrt1180_evk/doc/index.rst +++ b/boards/nxp/mimxrt1180_evk/doc/index.rst @@ -112,6 +112,8 @@ configuration supports the following hardware features: +-----------+------------+-------------------------------------+ | LPTMR | on-chip | counter | +-----------+------------+-------------------------------------+ +| FLEXSPI | on-chip | flash programming | ++-----------+------------+-------------------------------------+ The default configuration can be found in the defconfig file: :zephyr_file:`boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm33_defconfig` diff --git a/boards/nxp/mimxrt1180_evk/mimxrt1180_evk-pinctrl.dtsi b/boards/nxp/mimxrt1180_evk/mimxrt1180_evk-pinctrl.dtsi index 40de2b64a89f6..81ac3b1eb210e 100644 --- a/boards/nxp/mimxrt1180_evk/mimxrt1180_evk-pinctrl.dtsi +++ b/boards/nxp/mimxrt1180_evk/mimxrt1180_evk-pinctrl.dtsi @@ -115,4 +115,18 @@ slew-rate = "fast"; }; }; + + pinmux_flexspi1: pinmux_flexspi1 { + group0 { + pinmux = <&iomuxc_gpio_sd_b2_05_flexspi1_b_dqs>, + <&iomuxc_gpio_sd_b2_06_flexspi1_b_ss0_b>, + <&iomuxc_gpio_sd_b2_07_flexspi1_b_sclk>, + <&iomuxc_gpio_sd_b2_08_flexspi1_b_data0>, + <&iomuxc_gpio_sd_b2_09_flexspi1_b_data1>, + <&iomuxc_gpio_sd_b2_10_flexspi1_b_data2>, + <&iomuxc_gpio_sd_b2_11_flexspi1_b_data3>; + bias-pull-down; + input-enable; + }; + }; }; diff --git a/boards/nxp/mimxrt1180_evk/mimxrt1180_evk.dtsi b/boards/nxp/mimxrt1180_evk/mimxrt1180_evk.dtsi index 550d50faf8b2e..725b5439e996c 100644 --- a/boards/nxp/mimxrt1180_evk/mimxrt1180_evk.dtsi +++ b/boards/nxp/mimxrt1180_evk/mimxrt1180_evk.dtsi @@ -55,20 +55,51 @@ status = "okay"; }; -&flexspi1 { +&flexspi { + pinctrl-0 = <&pinmux_flexspi1>; + pinctrl-names = "default"; +}; + +&flexspi { status = "okay"; ahb-prefetch; ahb-read-addr-opt; rx-clock-source = <1>; w25q128jw: w25q128jw@0 { compatible = "nxp,imx-flexspi-nor"; - size = <134217728>; + size = ; reg = <0>; spi-max-frequency = <133000000>; status = "okay"; - jedec-id = [ef 80 18]; + jedec-id = [ef 60 18]; erase-block-size = <4096>; write-block-size = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 DT_SIZE_K(128)>; + }; + /* The MCUBoot swap-move algorithm uses the last 3 sectors + * of the primary slot0 for swap status and move. + */ + slot0_partition: partition@20000 { + label = "image-0"; + reg = <0x00020000 (DT_SIZE_M(7) + DT_SIZE_K(12))>; + }; + slot1_partition: partition@723000 { + label = "image-1"; + reg = <0x00723000 DT_SIZE_M(7)>; + }; + storage_partition: partition@E23000 { + label = "storage"; + reg = <0x00E23000 (DT_SIZE_M(2) - DT_SIZE_K(140))>; + }; + }; }; }; From 0d66091cce5d5fd50afe5b24968e4d698361eb1f Mon Sep 17 00:00:00 2001 From: Volodymyr Fialko Date: Wed, 20 Nov 2024 19:38:46 +0100 Subject: [PATCH 2916/4482] riscv: pmp: don't reconfigure modes Previously PMP was avaible only with Multithreading, since it's now available without MT - add extra checks to prevent user/kernel mode reconfiguration. Signed-off-by: Volodymyr Fialko Signed-off-by: Anas Nashif --- arch/riscv/core/isr.S | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/riscv/core/isr.S b/arch/riscv/core/isr.S index 5ac71fe17b473..1def6cfa62d14 100644 --- a/arch/riscv/core/isr.S +++ b/arch/riscv/core/isr.S @@ -356,7 +356,7 @@ no_fp: /* increment _current->arch.exception_depth */ li t1, RISCV_EXC_ECALLU beq t0, t1, is_user_syscall -#ifdef CONFIG_PMP_STACK_GUARD +#if defined(CONFIG_PMP_STACK_GUARD) && defined(CONFIG_MULTITHREADING) /* * Determine if we come from user space. If so, reconfigure the PMP for * kernel mode stack guard. @@ -397,7 +397,7 @@ is_kernel_syscall: addi t0, t0, 4 sr t0, __struct_arch_esf_mepc_OFFSET(sp) -#ifdef CONFIG_PMP_STACK_GUARD +#if defined(CONFIG_PMP_STACK_GUARD) && defined(CONFIG_MULTITHREADING) /* Re-activate PMP for m-mode */ li t1, MSTATUS_MPP csrc mstatus, t1 @@ -508,7 +508,7 @@ do_irq_offload: #ifdef CONFIG_USERSPACE is_user_syscall: -#ifdef CONFIG_PMP_STACK_GUARD +#if defined(CONFIG_PMP_STACK_GUARD) && defined(CONFIG_MULTITHREADING) /* * We came from userspace and need to reconfigure the * PMP for kernel mode stack guard. @@ -578,7 +578,7 @@ valid_syscall_id: is_interrupt: -#ifdef CONFIG_PMP_STACK_GUARD +#if defined(CONFIG_PMP_STACK_GUARD) && defined(CONFIG_MULTITHREADING) #ifdef CONFIG_USERSPACE /* * If we came from userspace then we need to reconfigure the @@ -748,7 +748,7 @@ fp_trap_exit: and t0, t2, t1 bnez t0, 1f -#ifdef CONFIG_PMP_STACK_GUARD +#if defined(CONFIG_PMP_STACK_GUARD) && defined(CONFIG_MULTITHREADING) /* Remove kernel stack guard and Reconfigure PMP for user mode */ lr a0, ___cpu_t_current_OFFSET(s0) call z_riscv_pmp_usermode_enable From 76b6e6b1d7362a4c9ce3c5ae261a40bbc2921adc Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Wed, 20 Nov 2024 10:14:16 -0600 Subject: [PATCH 2917/4482] MAINTAINERS: Update maintainer for release notes Update to the 4.1 Release managers Signed-off-by: Mahesh Mahadevan --- MAINTAINERS.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 27724795cde48..a0fddc69c649e 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -1007,8 +1007,8 @@ Documentation Infrastructure: Release Notes: status: maintained maintainers: - - dkalowsk - - mmahadevan108 + - fabiobaltieri + - kartben collaborators: - kartben files: From 1aaf08f7f12699a8a68c897a5cb3552a46d1f98c Mon Sep 17 00:00:00 2001 From: Jakub Rzeszutko Date: Tue, 19 Nov 2024 08:54:10 +0100 Subject: [PATCH 2918/4482] lib: shell: replace strtol with strtoul in cmd_load for address parsing Addresses in cmd_load() should always be unsigned. Previously, strtol() was used, which is limited to signed long values, causing issues with addresses >= 0x80000000. This commit replaces strtol() with strtoul(), ensuring proper handling of the full 32-bit address space. Fixes #81343 Signed-off-by: Aaron Fontaine Signed-off-by: Jakub Rzeszutko --- subsys/shell/modules/devmem_service.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/shell/modules/devmem_service.c b/subsys/shell/modules/devmem_service.c index c2c37215d3a36..7856ab8f86203 100644 --- a/subsys/shell/modules/devmem_service.c +++ b/subsys/shell/modules/devmem_service.c @@ -247,8 +247,8 @@ static int cmd_load(const struct shell *sh, size_t argc, char **argv) argc--; } - bytes = (unsigned char *)strtol(argv[1], NULL, 0); - data = (uint32_t *)strtol(argv[1], NULL, 0); + bytes = (unsigned char *)strtoul(argv[1], NULL, 0); + data = (uint32_t *)strtoul(argv[1], NULL, 0); set_bypass(sh, bypass_cb); return 0; From 20678f9ad510eaead824146b59cf2b5b840363f0 Mon Sep 17 00:00:00 2001 From: Dhruv Menon Date: Tue, 19 Nov 2024 10:22:15 +0530 Subject: [PATCH 2919/4482] doc: i2c: Update I2C specification link The prior link to the I2C specification was broken and no longer accessible. Updated the link to a valid and current URL Signed-off-by: Dhruv Menon --- drivers/i2c/i2c_bitbang.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/i2c_bitbang.c b/drivers/i2c/i2c_bitbang.c index 4f99eb1b6dd1c..b77e88282bd92 100644 --- a/drivers/i2c/i2c_bitbang.c +++ b/drivers/i2c/i2c_bitbang.c @@ -13,8 +13,8 @@ * the Standard-mode and Fast-mode speeds and doesn't support optional * protocol feature like 10-bit addresses or clock stretching. * - * Timings and protocol are based Rev. 6 of the I2C specification: - * http://www.nxp.com/documents/user_manual/UM10204.pdf + * Timings and protocol are based Rev. 7 of the I2C specification: + * https://www.nxp.com/docs/en/user-guide/UM10204.pdf */ #include From 027c79add7f5a26f69dcb6be79354bbef3d358ac Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Sat, 16 Nov 2024 13:17:09 +0800 Subject: [PATCH 2920/4482] doc: posix: option_groups: add section for POSIX_FILE_SYSTEM_R Add section for POSIX_FILE_SYSTEM_R which contains only `readdir_r()`. Signed-off-by: Yong Cong Sin --- .../portability/posix/option_groups/index.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/services/portability/posix/option_groups/index.rst b/doc/services/portability/posix/option_groups/index.rst index 300fd9118e3ca..e1e2b930cc803 100644 --- a/doc/services/portability/posix/option_groups/index.rst +++ b/doc/services/portability/posix/option_groups/index.rst @@ -258,6 +258,19 @@ Enable this option group with :kconfig:option:`CONFIG_POSIX_FILE_SYSTEM`. unlink(), yes utime(), +.. _posix_option_group_file_system_r: + +POSIX_FILE_SYSTEM_R ++++++++++++++++++++ + +Enable this option with :kconfig:option:`CONFIG_POSIX_FILE_SYSTEM_R`. + +.. csv-table:: POSIX_FILE_SYSTEM_R + :header: API, Supported + :widths: 50,10 + + readdir_r(), yes + .. _posix_option_group_mapped_files: POSIX_MAPPED_FILES From c071e27e2d46b960f5757ee67237ec6d11080a5d Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 19 Nov 2024 10:49:08 -0600 Subject: [PATCH 2921/4482] boards: fix dependency for LV_COLOR_SWAP_16 to use configdefault Use configdefault when enabling LV_COLOR_SWAP_16 within boards and shield definitions, to avoid OR'ing the dependencies for the Kconfig symbol. Otherwise, a user manually selecting LV_COLOR_DEPTH will encounter build errors as LV_COLOR_SWAP_16 may be enabled when LV_COLOR_DEPTH_16 is not selected Fixes #81546 Signed-off-by: Daniel DeGrasse --- boards/adi/max32662evkit/Kconfig.defconfig | 2 +- boards/adi/max32672evkit/Kconfig.defconfig | 2 +- boards/adi/max32680evkit/Kconfig.defconfig | 2 +- boards/adi/max32690evkit/Kconfig.defconfig | 2 +- boards/espressif/esp32s3_eye/Kconfig.defconfig | 2 +- boards/ezurio/bl5340_dvk/Kconfig.defconfig | 2 +- boards/m5stack/m5stack_atoms3/Kconfig.defconfig | 2 +- boards/m5stack/m5stack_core2/Kconfig.defconfig | 2 +- boards/seeed/wio_terminal/Kconfig.defconfig | 2 +- .../shields/buydisplay_2_8_tft_touch_arduino/Kconfig.defconfig | 2 +- boards/shields/g1120b0mipi/Kconfig.defconfig | 2 +- boards/shields/seeed_xiao_round_display/Kconfig.defconfig | 2 +- boards/shields/st7789v_generic/Kconfig.defconfig | 2 +- boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig.defconfig | 2 +- boards/weact/mini_stm32h743/Kconfig.defconfig | 2 +- modules/lvgl/Kconfig | 1 + 16 files changed, 16 insertions(+), 15 deletions(-) diff --git a/boards/adi/max32662evkit/Kconfig.defconfig b/boards/adi/max32662evkit/Kconfig.defconfig index 5bacd313ad7dc..415360cc1eb47 100644 --- a/boards/adi/max32662evkit/Kconfig.defconfig +++ b/boards/adi/max32662evkit/Kconfig.defconfig @@ -19,7 +19,7 @@ choice LV_COLOR_DEPTH default LV_COLOR_DEPTH_16 # 16 bit per pixel endchoice -config LV_COLOR_16_SWAP +configdefault LV_COLOR_16_SWAP default y endif # LVGL diff --git a/boards/adi/max32672evkit/Kconfig.defconfig b/boards/adi/max32672evkit/Kconfig.defconfig index cb74c0282e704..28ba2e3b96474 100644 --- a/boards/adi/max32672evkit/Kconfig.defconfig +++ b/boards/adi/max32672evkit/Kconfig.defconfig @@ -19,7 +19,7 @@ choice LV_COLOR_DEPTH default LV_COLOR_DEPTH_16 # 16 bit per pixel endchoice -config LV_COLOR_16_SWAP +configdefault LV_COLOR_16_SWAP default y endif # LVGL diff --git a/boards/adi/max32680evkit/Kconfig.defconfig b/boards/adi/max32680evkit/Kconfig.defconfig index 99702938eae62..33ba842e29136 100644 --- a/boards/adi/max32680evkit/Kconfig.defconfig +++ b/boards/adi/max32680evkit/Kconfig.defconfig @@ -19,7 +19,7 @@ choice LV_COLOR_DEPTH default LV_COLOR_DEPTH_16 # 16 bit per pixel endchoice -config LV_COLOR_16_SWAP +configdefault LV_COLOR_16_SWAP default y endif # LVGL diff --git a/boards/adi/max32690evkit/Kconfig.defconfig b/boards/adi/max32690evkit/Kconfig.defconfig index 342cc0ca51333..2e5d60419c847 100644 --- a/boards/adi/max32690evkit/Kconfig.defconfig +++ b/boards/adi/max32690evkit/Kconfig.defconfig @@ -19,7 +19,7 @@ choice LV_COLOR_DEPTH default LV_COLOR_DEPTH_16 # 16 bit per pixel endchoice -config LV_COLOR_16_SWAP +configdefault LV_COLOR_16_SWAP default y endif # LVGL diff --git a/boards/espressif/esp32s3_eye/Kconfig.defconfig b/boards/espressif/esp32s3_eye/Kconfig.defconfig index d20cfdecdc2a4..66745cfd2be47 100644 --- a/boards/espressif/esp32s3_eye/Kconfig.defconfig +++ b/boards/espressif/esp32s3_eye/Kconfig.defconfig @@ -5,7 +5,7 @@ if BOARD_ESP32S3_EYE_ESP32S3_PROCPU -config LV_COLOR_16_SWAP +configdefault LV_COLOR_16_SWAP default y endif # BOARD_ESP32S3_EYE_ESP32S3_PROCPU diff --git a/boards/ezurio/bl5340_dvk/Kconfig.defconfig b/boards/ezurio/bl5340_dvk/Kconfig.defconfig index d90d05152fa84..0fbab14796208 100644 --- a/boards/ezurio/bl5340_dvk/Kconfig.defconfig +++ b/boards/ezurio/bl5340_dvk/Kconfig.defconfig @@ -87,7 +87,7 @@ choice LV_COLOR_DEPTH default LV_COLOR_DEPTH_16 endchoice -config LV_COLOR_16_SWAP +configdefault LV_COLOR_16_SWAP default y config INPUT diff --git a/boards/m5stack/m5stack_atoms3/Kconfig.defconfig b/boards/m5stack/m5stack_atoms3/Kconfig.defconfig index c2f7345a9a8fe..dcb601b638ffb 100644 --- a/boards/m5stack/m5stack_atoms3/Kconfig.defconfig +++ b/boards/m5stack/m5stack_atoms3/Kconfig.defconfig @@ -4,7 +4,7 @@ if BOARD_M5STACK_ATOMS3_ESP32S3_PROCPU -config LV_COLOR_16_SWAP +configdefault LV_COLOR_16_SWAP default y if LVGL endif # BOARD_M5STACK_ATOMS3_ESP32S3_PROCPU diff --git a/boards/m5stack/m5stack_core2/Kconfig.defconfig b/boards/m5stack/m5stack_core2/Kconfig.defconfig index 21b7a6b12a821..155a3c1d39c66 100644 --- a/boards/m5stack/m5stack_core2/Kconfig.defconfig +++ b/boards/m5stack/m5stack_core2/Kconfig.defconfig @@ -29,7 +29,7 @@ config INPUT_FT5336_INTERRUPT config INPUT default y -config LV_COLOR_16_SWAP +configdefault LV_COLOR_16_SWAP default y if LVGL # Increase initialization priority of MIPI DBI device, so that it initializes diff --git a/boards/seeed/wio_terminal/Kconfig.defconfig b/boards/seeed/wio_terminal/Kconfig.defconfig index 4b742f1a22864..47e610c12cd9f 100644 --- a/boards/seeed/wio_terminal/Kconfig.defconfig +++ b/boards/seeed/wio_terminal/Kconfig.defconfig @@ -3,5 +3,5 @@ # SPDX-License-Identifier: Apache-2.0 -config LV_COLOR_16_SWAP +configdefault LV_COLOR_16_SWAP default y if LVGL diff --git a/boards/shields/buydisplay_2_8_tft_touch_arduino/Kconfig.defconfig b/boards/shields/buydisplay_2_8_tft_touch_arduino/Kconfig.defconfig index 2e9c0a6ed8a22..38e54dbec887b 100644 --- a/boards/shields/buydisplay_2_8_tft_touch_arduino/Kconfig.defconfig +++ b/boards/shields/buydisplay_2_8_tft_touch_arduino/Kconfig.defconfig @@ -25,7 +25,7 @@ choice LV_COLOR_DEPTH default LV_COLOR_DEPTH_16 endchoice -config LV_COLOR_16_SWAP +configdefault LV_COLOR_16_SWAP default y config INPUT diff --git a/boards/shields/g1120b0mipi/Kconfig.defconfig b/boards/shields/g1120b0mipi/Kconfig.defconfig index 64b784035e737..5a6971aeef38f 100644 --- a/boards/shields/g1120b0mipi/Kconfig.defconfig +++ b/boards/shields/g1120b0mipi/Kconfig.defconfig @@ -20,7 +20,7 @@ config MIPI_DSI_MCUX_2L_SWAP16 endif # MIPI_DSI_MCUX_2L # Swap 16 bit color setting for LVGL, to send high byte first -config LV_COLOR_16_SWAP +configdefault LV_COLOR_16_SWAP default y if !MIPI_DSI_MCUX_2L_SWAP16 config LV_Z_VDB_SIZE diff --git a/boards/shields/seeed_xiao_round_display/Kconfig.defconfig b/boards/shields/seeed_xiao_round_display/Kconfig.defconfig index 81cbf3807452a..443d5ba03b9d5 100644 --- a/boards/shields/seeed_xiao_round_display/Kconfig.defconfig +++ b/boards/shields/seeed_xiao_round_display/Kconfig.defconfig @@ -14,7 +14,7 @@ choice LV_COLOR_DEPTH default LV_COLOR_DEPTH_16 endchoice -config LV_COLOR_16_SWAP +configdefault LV_COLOR_16_SWAP default y endif # LVGL diff --git a/boards/shields/st7789v_generic/Kconfig.defconfig b/boards/shields/st7789v_generic/Kconfig.defconfig index e0057a2e9d739..b28cf38f78cf5 100644 --- a/boards/shields/st7789v_generic/Kconfig.defconfig +++ b/boards/shields/st7789v_generic/Kconfig.defconfig @@ -20,7 +20,7 @@ choice LV_COLOR_DEPTH default LV_COLOR_DEPTH_16 if SHIELD_ST7789V_WAVESHARE_240X240 endchoice -config LV_COLOR_16_SWAP +configdefault LV_COLOR_16_SWAP default y if SHIELD_ST7789V_WAVESHARE_240X240 endif # LVGL diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig.defconfig b/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig.defconfig index d57628b836e4f..75adffcd0b81b 100644 --- a/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig.defconfig +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/Kconfig.defconfig @@ -12,7 +12,7 @@ config KERNEL_MEM_POOL config PWM default y if DISPLAY -config LV_COLOR_16_SWAP +configdefault LV_COLOR_16_SWAP default y if LVGL endif # BOARD_ESP32S3_TOUCH_LCD_1_28_ESP32S3_PROCPU diff --git a/boards/weact/mini_stm32h743/Kconfig.defconfig b/boards/weact/mini_stm32h743/Kconfig.defconfig index 6817cc3f5f7d7..bcc31baaf59fa 100644 --- a/boards/weact/mini_stm32h743/Kconfig.defconfig +++ b/boards/weact/mini_stm32h743/Kconfig.defconfig @@ -12,7 +12,7 @@ config INPUT if LVGL -config LV_COLOR_16_SWAP +configdefault LV_COLOR_16_SWAP default y config LV_Z_BITS_PER_PIXEL diff --git a/modules/lvgl/Kconfig b/modules/lvgl/Kconfig index 5345e2a7d58be..d2b76451163a5 100644 --- a/modules/lvgl/Kconfig +++ b/modules/lvgl/Kconfig @@ -87,6 +87,7 @@ endchoice config LV_COLOR_16_SWAP bool + depends on LV_COLOR_DEPTH_16 config LV_Z_FLUSH_THREAD bool "Flush LVGL frames in a separate thread" From 6f86adbc0dc726a5830f20d250458f8995a870bb Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Wed, 13 Nov 2024 11:16:09 +0100 Subject: [PATCH 2922/4482] Bluetooth: BAP: Use def_bool instead of select for BT_BAP_UNICAST Remove the selects from BT_BAP_UNICAST_SERVER and BT_BAP_UNICAST_CLIENT and use a def_bool for BT_BAP_UNICAST. This is part of an effort to reduce select in Kconfig. Signed-off-by: Emil Gydesen --- subsys/bluetooth/audio/Kconfig.bap | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/subsys/bluetooth/audio/Kconfig.bap b/subsys/bluetooth/audio/Kconfig.bap index e589e8608cb93..7e375a2e2c427 100644 --- a/subsys/bluetooth/audio/Kconfig.bap +++ b/subsys/bluetooth/audio/Kconfig.bap @@ -7,11 +7,10 @@ # config BT_BAP_UNICAST - bool + def_bool BT_BAP_UNICAST_SERVER || BT_BAP_UNICAST_CLIENT config BT_BAP_UNICAST_SERVER bool "Bluetooth Unicast Audio Server Support" - select BT_BAP_UNICAST depends on BT_GATT_DYNAMIC_DB depends on BT_GATT_CACHING depends on BT_PERIPHERAL @@ -25,7 +24,6 @@ config BT_BAP_UNICAST_SERVER config BT_BAP_UNICAST_CLIENT bool "Bluetooth Unicast Audio Client Support" - select BT_BAP_UNICAST select BT_GATT_CLIENT select BT_GATT_AUTO_DISCOVER_CCC select BT_GATT_AUTO_UPDATE_MTU @@ -79,7 +77,6 @@ config BT_AUDIO_CODEC_CAP_MAX_METADATA_SIZE if BT_BAP_UNICAST_CLIENT config BT_BAP_UNICAST_CLIENT_GROUP_COUNT int "Basic Audio Unicast Group count" - depends on BT_BAP_UNICAST default BT_ISO_MAX_CIG range 1 BT_ISO_MAX_CIG help From df6b5981bf861197d80cb7ba33038d170f239340 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Wed, 13 Nov 2024 11:43:54 +0100 Subject: [PATCH 2923/4482] Bluetooth: Audio: depends on GATT instead of select Modify the Kconfig options to depend on the GATT features rather than selecting them. This is part of an effort to reduce the amount of selects we use in LE Audio. Signed-off-by: Emil Gydesen --- samples/bluetooth/bap_broadcast_assistant/prj.conf | 3 +++ samples/bluetooth/bap_unicast_client/prj.conf | 3 +++ samples/bluetooth/cap_initiator/Kconfig | 3 +++ samples/bluetooth/hap_ha/prj.conf | 2 ++ samples/bluetooth/tmap_central/prj.conf | 3 +++ samples/bluetooth/tmap_peripheral/prj.conf | 2 ++ subsys/bluetooth/audio/Kconfig.bap | 12 ++++++------ subsys/bluetooth/audio/Kconfig.csip | 4 ++-- subsys/bluetooth/audio/Kconfig.has | 6 +++--- subsys/bluetooth/audio/Kconfig.mcs | 4 ++-- subsys/bluetooth/audio/Kconfig.micp | 4 ++-- subsys/bluetooth/audio/Kconfig.tbs | 4 ++-- subsys/bluetooth/audio/Kconfig.vcp | 4 ++-- tests/bluetooth/audio/ascs/testcase.yaml | 3 +++ tests/bluetooth/audio/cap_commander/prj.conf | 3 +++ tests/bluetooth/audio/cap_initiator/prj.conf | 3 +++ tests/bluetooth/shell/audio.conf | 3 +++ tests/bluetooth/tester/overlay-le-audio.conf | 3 +++ tests/bsim/bluetooth/audio/prj.conf | 3 +++ 19 files changed, 53 insertions(+), 19 deletions(-) diff --git a/samples/bluetooth/bap_broadcast_assistant/prj.conf b/samples/bluetooth/bap_broadcast_assistant/prj.conf index 8880c02eaf1a9..3bef6a1e8e607 100644 --- a/samples/bluetooth/bap_broadcast_assistant/prj.conf +++ b/samples/bluetooth/bap_broadcast_assistant/prj.conf @@ -1,6 +1,9 @@ CONFIG_BT=y CONFIG_LOG=y CONFIG_BT_CENTRAL=y +CONFIG_BT_GATT_CLIENT=y +CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y +CONFIG_BT_GATT_AUTO_UPDATE_MTU=y CONFIG_BT_AUDIO=y CONFIG_BT_SMP=y CONFIG_BT_BUF_ACL_RX_SIZE=255 diff --git a/samples/bluetooth/bap_unicast_client/prj.conf b/samples/bluetooth/bap_unicast_client/prj.conf index 518a7fa5e6a57..6d6658d728bf1 100644 --- a/samples/bluetooth/bap_unicast_client/prj.conf +++ b/samples/bluetooth/bap_unicast_client/prj.conf @@ -3,6 +3,9 @@ CONFIG_LOG=y CONFIG_BT_SMP=y CONFIG_BT_CENTRAL=y CONFIG_BT_ISO_CENTRAL=y +CONFIG_BT_GATT_CLIENT=y +CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y +CONFIG_BT_GATT_AUTO_UPDATE_MTU=y CONFIG_BT_AUDIO=y CONFIG_BT_BAP_UNICAST_CLIENT=y CONFIG_BT_ISO_TX_BUF_COUNT=4 diff --git a/samples/bluetooth/cap_initiator/Kconfig b/samples/bluetooth/cap_initiator/Kconfig index fecba8e247fe6..794eab831d5e3 100644 --- a/samples/bluetooth/cap_initiator/Kconfig +++ b/samples/bluetooth/cap_initiator/Kconfig @@ -7,6 +7,9 @@ config SAMPLE_UNICAST bool "Whether or not to search for CAP acceptors for unicast audio" default y select BT_CENTRAL + select BT_GATT_CLIENT + select BT_GATT_AUTO_DISCOVER_CCC + select BT_GATT_AUTO_UPDATE_MTU select BT_ISO_CENTRAL select BT_SMP select BT_KEYS_OVERWRITE_OLDEST diff --git a/samples/bluetooth/hap_ha/prj.conf b/samples/bluetooth/hap_ha/prj.conf index ad0c2d8c3a810..93d624a509582 100644 --- a/samples/bluetooth/hap_ha/prj.conf +++ b/samples/bluetooth/hap_ha/prj.conf @@ -4,6 +4,8 @@ CONFIG_BT_ISO_PERIPHERAL=y CONFIG_BT_PRIVACY=y CONFIG_BT_GATT_CACHING=y CONFIG_BT_GATT_DYNAMIC_DB=y +CONFIG_BT_GATT_CLIENT=y +CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y CONFIG_BT_SMP=y CONFIG_BT_SMP_SC_PAIR_ONLY=y diff --git a/samples/bluetooth/tmap_central/prj.conf b/samples/bluetooth/tmap_central/prj.conf index 3c96524784d3e..0718245e20106 100644 --- a/samples/bluetooth/tmap_central/prj.conf +++ b/samples/bluetooth/tmap_central/prj.conf @@ -2,6 +2,9 @@ CONFIG_BT=y CONFIG_LOG=y CONFIG_BT_CENTRAL=y CONFIG_BT_ISO_CENTRAL=y +CONFIG_BT_GATT_CLIENT=y +CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y +CONFIG_BT_GATT_AUTO_UPDATE_MTU=y CONFIG_BT_AUDIO=y CONFIG_BT_SMP=y diff --git a/samples/bluetooth/tmap_peripheral/prj.conf b/samples/bluetooth/tmap_peripheral/prj.conf index 8c1d6210b2802..f37bb44f2c081 100644 --- a/samples/bluetooth/tmap_peripheral/prj.conf +++ b/samples/bluetooth/tmap_peripheral/prj.conf @@ -2,6 +2,8 @@ CONFIG_BT=y CONFIG_LOG=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_ISO_PERIPHERAL=y +CONFIG_BT_GATT_CLIENT=y +CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y CONFIG_BT_PRIVACY=y CONFIG_BT_AUDIO=y CONFIG_UTF8=y diff --git a/subsys/bluetooth/audio/Kconfig.bap b/subsys/bluetooth/audio/Kconfig.bap index 7e375a2e2c427..bb05d9c5ee799 100644 --- a/subsys/bluetooth/audio/Kconfig.bap +++ b/subsys/bluetooth/audio/Kconfig.bap @@ -24,9 +24,9 @@ config BT_BAP_UNICAST_SERVER config BT_BAP_UNICAST_CLIENT bool "Bluetooth Unicast Audio Client Support" - select BT_GATT_CLIENT - select BT_GATT_AUTO_DISCOVER_CCC - select BT_GATT_AUTO_UPDATE_MTU + depends on BT_GATT_CLIENT + depends on BT_GATT_AUTO_DISCOVER_CCC + depends on BT_GATT_AUTO_UPDATE_MTU depends on BT_CENTRAL depends on BT_ISO_CENTRAL depends on BT_BONDABLE @@ -241,9 +241,9 @@ config BT_BAP_BROADCAST_ASSISTANT select BT_EXT_ADV select BT_PER_ADV_SYNC select BT_ISO_SYNC_RECEIVER - select BT_GATT_CLIENT - select BT_GATT_AUTO_DISCOVER_CCC - select BT_GATT_AUTO_UPDATE_MTU + depends on BT_GATT_CLIENT + depends on BT_GATT_AUTO_DISCOVER_CCC + depends on BT_GATT_AUTO_UPDATE_MTU depends on BT_OBSERVER depends on BT_BONDABLE help diff --git a/subsys/bluetooth/audio/Kconfig.csip b/subsys/bluetooth/audio/Kconfig.csip index 0b248fe82fea5..7ca25770c0fa2 100644 --- a/subsys/bluetooth/audio/Kconfig.csip +++ b/subsys/bluetooth/audio/Kconfig.csip @@ -57,8 +57,8 @@ endif # BT_CSIP_SET_MEMBER config BT_CSIP_SET_COORDINATOR bool "Coordinated Set Identification Profile Set Coordinator Support" - select BT_GATT_CLIENT - select BT_GATT_AUTO_DISCOVER_CCC + depends on BT_GATT_CLIENT + depends on BT_GATT_AUTO_DISCOVER_CCC help This option enables support for Coordinated Set Identification Profile Set Coordinator. diff --git a/subsys/bluetooth/audio/Kconfig.has b/subsys/bluetooth/audio/Kconfig.has index 576f98fdcf6b5..f7d4de583fdc4 100644 --- a/subsys/bluetooth/audio/Kconfig.has +++ b/subsys/bluetooth/audio/Kconfig.has @@ -56,9 +56,9 @@ endif # BT_HAS config BT_HAS_CLIENT bool "Hearing Access Service Client support" - select BT_GATT_CLIENT - select BT_GATT_AUTO_DISCOVER_CCC - select BT_GATT_AUTO_UPDATE_MTU + depends on BT_GATT_CLIENT + depends on BT_GATT_AUTO_DISCOVER_CCC select UTF8 + depends on BT_GATT_AUTO_UPDATE_MTU help This option enables support for Hearing Access Service Client. diff --git a/subsys/bluetooth/audio/Kconfig.mcs b/subsys/bluetooth/audio/Kconfig.mcs index 4814140bf08d3..6c08dd57d2022 100644 --- a/subsys/bluetooth/audio/Kconfig.mcs +++ b/subsys/bluetooth/audio/Kconfig.mcs @@ -20,8 +20,8 @@ config BT_MCS config BT_MCC bool "Media Control Client Support" - select BT_GATT_CLIENT - select BT_GATT_AUTO_DISCOVER_CCC + depends on BT_GATT_CLIENT + depends on BT_GATT_AUTO_DISCOVER_CCC help This option enables support for the Media Control Client. diff --git a/subsys/bluetooth/audio/Kconfig.micp b/subsys/bluetooth/audio/Kconfig.micp index 16399381b7cfc..2581f1694f30d 100644 --- a/subsys/bluetooth/audio/Kconfig.micp +++ b/subsys/bluetooth/audio/Kconfig.micp @@ -40,8 +40,8 @@ endif # BT_MICP_MIC_DEV config BT_MICP_MIC_CTLR bool "Microphone Control Profile Microphone Controller Support" - select BT_GATT_CLIENT - select BT_GATT_AUTO_DISCOVER_CCC + depends on BT_GATT_CLIENT + depends on BT_GATT_AUTO_DISCOVER_CCC depends on BT_BONDABLE help This option enables support for the Microphone Control Profile diff --git a/subsys/bluetooth/audio/Kconfig.tbs b/subsys/bluetooth/audio/Kconfig.tbs index 7c42b74c36353..14729499bee46 100644 --- a/subsys/bluetooth/audio/Kconfig.tbs +++ b/subsys/bluetooth/audio/Kconfig.tbs @@ -70,8 +70,8 @@ config BT_TBS_CLIENT_TBS config BT_TBS_CLIENT def_bool BT_TBS_CLIENT_GTBS || BT_TBS_CLIENT_TBS - select BT_GATT_CLIENT - select BT_GATT_AUTO_DISCOVER_CCC + depends on BT_GATT_CLIENT + depends on BT_GATT_AUTO_DISCOVER_CCC if BT_TBS_CLIENT diff --git a/subsys/bluetooth/audio/Kconfig.vcp b/subsys/bluetooth/audio/Kconfig.vcp index d75d1943f6da0..3699e56c822fe 100644 --- a/subsys/bluetooth/audio/Kconfig.vcp +++ b/subsys/bluetooth/audio/Kconfig.vcp @@ -58,8 +58,8 @@ endif # BT_VCP_VOL_REND config BT_VCP_VOL_CTLR bool "Volume Control Profile Volume Controller Support" - select BT_GATT_CLIENT - select BT_GATT_AUTO_DISCOVER_CCC + depends on BT_GATT_CLIENT + depends on BT_GATT_AUTO_DISCOVER_CCC help This option enables support for Volume Control Profile Volume Controller. diff --git a/tests/bluetooth/audio/ascs/testcase.yaml b/tests/bluetooth/audio/ascs/testcase.yaml index ba6e549c306b7..63663c8177337 100644 --- a/tests/bluetooth/audio/ascs/testcase.yaml +++ b/tests/bluetooth/audio/ascs/testcase.yaml @@ -17,6 +17,9 @@ tests: type: unit extra_configs: - CONFIG_BT_BAP_UNICAST_CLIENT=y + - CONFIG_BT_GATT_CLIENT=y + - CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y + - CONFIG_BT_GATT_AUTO_UPDATE_MTU=y bluetooth.audio.ascs.test_stream_pair: type: unit extra_configs: diff --git a/tests/bluetooth/audio/cap_commander/prj.conf b/tests/bluetooth/audio/cap_commander/prj.conf index 840926e23922a..0ca1961eef71c 100644 --- a/tests/bluetooth/audio/cap_commander/prj.conf +++ b/tests/bluetooth/audio/cap_commander/prj.conf @@ -5,7 +5,10 @@ CONFIG_BT_SMP=y CONFIG_BT_CENTRAL=y CONFIG_BT_MAX_CONN=2 CONFIG_BT_OBSERVER=y +CONFIG_BT_GATT_CLIENT=y +CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y CONFIG_BT_GATT_DYNAMIC_DB=y +CONFIG_BT_GATT_AUTO_UPDATE_MTU=y CONFIG_BT_AUDIO=y # Requirements for CAP commander diff --git a/tests/bluetooth/audio/cap_initiator/prj.conf b/tests/bluetooth/audio/cap_initiator/prj.conf index 52b330d86aea8..85b8fe6aad4e6 100644 --- a/tests/bluetooth/audio/cap_initiator/prj.conf +++ b/tests/bluetooth/audio/cap_initiator/prj.conf @@ -5,6 +5,9 @@ CONFIG_BT=y CONFIG_BT_SMP=y CONFIG_BT_CENTRAL=y CONFIG_BT_ISO_CENTRAL=y +CONFIG_BT_GATT_CLIENT=y +CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y +CONFIG_BT_GATT_AUTO_UPDATE_MTU=y CONFIG_BT_AUDIO=y # Dependencies for CAP initiator unicast diff --git a/tests/bluetooth/shell/audio.conf b/tests/bluetooth/shell/audio.conf index 049c6b766fed8..a509fd8f83cc3 100644 --- a/tests/bluetooth/shell/audio.conf +++ b/tests/bluetooth/shell/audio.conf @@ -13,8 +13,11 @@ CONFIG_BT_CENTRAL=y CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_PRIVACY=y +CONFIG_BT_GATT_CLIENT=y CONFIG_BT_GATT_CACHING=y CONFIG_BT_GATT_DYNAMIC_DB=y +CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y +CONFIG_BT_GATT_AUTO_UPDATE_MTU=y CONFIG_BT_L2CAP_ECRED=y CONFIG_BT_SIGNING=y CONFIG_BT_FIXED_PASSKEY=y diff --git a/tests/bluetooth/tester/overlay-le-audio.conf b/tests/bluetooth/tester/overlay-le-audio.conf index acbde1ea0d753..3f1b5878bf3b3 100644 --- a/tests/bluetooth/tester/overlay-le-audio.conf +++ b/tests/bluetooth/tester/overlay-le-audio.conf @@ -1,8 +1,11 @@ CONFIG_BT_AUDIO=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_CENTRAL=y +CONFIG_BT_GATT_CLIENT=y CONFIG_BT_GATT_CACHING=y CONFIG_BT_GATT_DYNAMIC_DB=y +CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y +CONFIG_BT_GATT_AUTO_UPDATE_MTU=y CONFIG_BT_ISO_PERIPHERAL=y CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_EXT_ADV=y diff --git a/tests/bsim/bluetooth/audio/prj.conf b/tests/bsim/bluetooth/audio/prj.conf index 9ca0a167b6182..70b0e8d465b62 100644 --- a/tests/bsim/bluetooth/audio/prj.conf +++ b/tests/bsim/bluetooth/audio/prj.conf @@ -14,8 +14,11 @@ CONFIG_BT_MAX_CONN=3 CONFIG_BT_MAX_PAIRED=3 CONFIG_BT_EXT_ADV_MAX_ADV_SET=3 CONFIG_BT_OBSERVER=y +CONFIG_BT_GATT_CLIENT=y CONFIG_BT_GATT_CACHING=y CONFIG_BT_GATT_DYNAMIC_DB=y +CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y +CONFIG_BT_GATT_AUTO_UPDATE_MTU=y CONFIG_BT_SMP=y CONFIG_BT_L2CAP_TX_MTU=128 CONFIG_BT_BUF_ACL_RX_SIZE=255 From 9b653540b8258855b8834dc99566482f4b246c91 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Wed, 13 Nov 2024 11:49:12 +0100 Subject: [PATCH 2924/4482] Bluetooth: BAP: Use def_bool instead of select for BT_AUDIO_RX/TX Remove the selects and use def_bool for BT_AUDIO_RX and BT_AUDIO_TX. This is part of an effort to reduce select in Kconfig. Signed-off-by: Emil Gydesen --- subsys/bluetooth/audio/Kconfig | 10 ++-------- subsys/bluetooth/audio/Kconfig.ascs | 2 -- subsys/bluetooth/audio/Kconfig.bap | 4 ---- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/subsys/bluetooth/audio/Kconfig b/subsys/bluetooth/audio/Kconfig index aed0ecbe56fc7..f56c3fe5236ad 100644 --- a/subsys/bluetooth/audio/Kconfig +++ b/subsys/bluetooth/audio/Kconfig @@ -19,16 +19,10 @@ menuconfig BT_AUDIO if BT_AUDIO config BT_AUDIO_RX - bool - help - This hidden option is enabled when any of the profiles/services - enables support for receiving of audio data. + def_bool BT_ASCS_ASE_SNK || BT_BAP_UNICAST_CLIENT_ASE_SRC || BT_BAP_BROADCAST_SINK config BT_AUDIO_TX - bool - help - This hidden option is enabled when any of the profiles/services - enables support for transmitting of audio data. + def_bool BT_ASCS_ASE_SRC || BT_BAP_UNICAST_CLIENT_ASE_SNK || BT_BAP_BROADCAST_SOURCE config BT_AUDIO_NOTIFY_RETRY_DELAY int "Delay for notification sending retried attempt in 1.25 ms units" diff --git a/subsys/bluetooth/audio/Kconfig.ascs b/subsys/bluetooth/audio/Kconfig.ascs index 61d92c2b4846e..750c62730bcf2 100644 --- a/subsys/bluetooth/audio/Kconfig.ascs +++ b/subsys/bluetooth/audio/Kconfig.ascs @@ -31,12 +31,10 @@ config BT_ASCS_MAX_ASE_SRC_COUNT config BT_ASCS_ASE_SNK def_bool BT_ASCS_MAX_ASE_SNK_COUNT > 0 select BT_PAC_SNK - select BT_AUDIO_RX config BT_ASCS_ASE_SRC def_bool BT_ASCS_MAX_ASE_SRC_COUNT > 0 select BT_PAC_SRC - select BT_AUDIO_TX config BT_ASCS_MAX_ACTIVE_ASES int "Number of simultaneously supported ASE sessions" diff --git a/subsys/bluetooth/audio/Kconfig.bap b/subsys/bluetooth/audio/Kconfig.bap index bb05d9c5ee799..ba66f39bc8938 100644 --- a/subsys/bluetooth/audio/Kconfig.bap +++ b/subsys/bluetooth/audio/Kconfig.bap @@ -112,18 +112,15 @@ config BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT config BT_BAP_UNICAST_CLIENT_ASE_SNK def_bool BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT > 0 - select BT_AUDIO_TX config BT_BAP_UNICAST_CLIENT_ASE_SRC def_bool BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT > 0 - select BT_AUDIO_RX endif # BT_BAP_UNICAST_CLIENT config BT_BAP_BROADCAST_SOURCE bool "Bluetooth Broadcast Source Audio Support" select BT_ISO_BROADCASTER - select BT_AUDIO_TX help This option enables support for Bluetooth Broadcast Source Audio using Isochronous channels. @@ -162,7 +159,6 @@ endif # BT_BAP_BROADCAST_SOURCE config BT_BAP_BROADCAST_SINK bool "Bluetooth Broadcast Sink Audio Support" select BT_ISO_SYNC_RECEIVER - select BT_AUDIO_RX select BT_PAC_SNK depends on BT_PERIPHERAL depends on BT_BAP_SCAN_DELEGATOR From d22c7b0cf2aa612a00b0cc260ebb0e2ec1d109c0 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Wed, 13 Nov 2024 11:52:32 +0100 Subject: [PATCH 2925/4482] Bluetooth: BAP: Depend on BT_ISO_BROADCASTER instead of select The BAP_BROADCAST_SOURCE Kconfig option now depends on BT_ISO_BROADCASTER instead of selecting it. This is an effort to reduce the use of select in LE Audio. Signed-off-by: Emil Gydesen --- samples/bluetooth/bap_broadcast_source/prj.conf | 1 + samples/bluetooth/cap_initiator/Kconfig | 1 + samples/bluetooth/cap_initiator/prj.conf | 1 + samples/bluetooth/pbp_public_broadcast_source/prj.conf | 1 + samples/bluetooth/tmap_bms/prj.conf | 1 + subsys/bluetooth/audio/Kconfig.bap | 2 +- tests/bluetooth/audio/bap_broadcast_source/prj.conf | 1 + tests/bluetooth/shell/audio.conf | 1 + tests/bluetooth/tester/overlay-le-audio.conf | 1 + tests/bsim/bluetooth/audio/prj.conf | 1 + 10 files changed, 10 insertions(+), 1 deletion(-) diff --git a/samples/bluetooth/bap_broadcast_source/prj.conf b/samples/bluetooth/bap_broadcast_source/prj.conf index 9fd23815bd920..8daf74f8571f6 100644 --- a/samples/bluetooth/bap_broadcast_source/prj.conf +++ b/samples/bluetooth/bap_broadcast_source/prj.conf @@ -3,6 +3,7 @@ CONFIG_MAIN_STACK_SIZE=2048 CONFIG_BT=y CONFIG_LOG=y CONFIG_BT_AUDIO=y +CONFIG_BT_ISO_BROADCASTER=y CONFIG_BT_BAP_BROADCAST_SOURCE=y CONFIG_BT_ISO_MAX_CHAN=2 diff --git a/samples/bluetooth/cap_initiator/Kconfig b/samples/bluetooth/cap_initiator/Kconfig index 794eab831d5e3..b9bffa08a2e4d 100644 --- a/samples/bluetooth/cap_initiator/Kconfig +++ b/samples/bluetooth/cap_initiator/Kconfig @@ -24,6 +24,7 @@ config SAMPLE_BROADCAST bool "Whether or not to search for CAP acceptors for broadcast audio" default y if !SAMPLE_UNICAST select BT_BROADCASTER + select BT_ISO_BROADCASTER select BT_BAP_BROADCAST_SOURCE select BT_CTLR_ADV_ISO if BT_CTLR help diff --git a/samples/bluetooth/cap_initiator/prj.conf b/samples/bluetooth/cap_initiator/prj.conf index 18887a33429d6..ad5f8117a70be 100644 --- a/samples/bluetooth/cap_initiator/prj.conf +++ b/samples/bluetooth/cap_initiator/prj.conf @@ -18,6 +18,7 @@ CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT=2 CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT=2 CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT=2 +CONFIG_BT_ISO_BROADCASTER=y CONFIG_BT_BAP_BROADCAST_SOURCE=y # Broadcast sources values if enabled by CONFIG_SAMPLE_BROADCAST diff --git a/samples/bluetooth/pbp_public_broadcast_source/prj.conf b/samples/bluetooth/pbp_public_broadcast_source/prj.conf index 3caa15a383a2f..004e1832b64a4 100644 --- a/samples/bluetooth/pbp_public_broadcast_source/prj.conf +++ b/samples/bluetooth/pbp_public_broadcast_source/prj.conf @@ -5,6 +5,7 @@ CONFIG_LOG=y CONFIG_BT_AUDIO=y CONFIG_BT_PERIPHERAL=y +CONFIG_BT_ISO_BROADCASTER=y CONFIG_BT_ISO_MAX_CHAN=2 CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT=2 CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT=2 diff --git a/samples/bluetooth/tmap_bms/prj.conf b/samples/bluetooth/tmap_bms/prj.conf index be8acce18802d..62219183f308c 100644 --- a/samples/bluetooth/tmap_bms/prj.conf +++ b/samples/bluetooth/tmap_bms/prj.conf @@ -16,6 +16,7 @@ CONFIG_BT_TMAP=y CONFIG_BT_CAP_INITIATOR=y # BAP support +CONFIG_BT_ISO_BROADCASTER=y CONFIG_BT_BAP_BROADCAST_SOURCE=y CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT=1 CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT=1 diff --git a/subsys/bluetooth/audio/Kconfig.bap b/subsys/bluetooth/audio/Kconfig.bap index ba66f39bc8938..9c565693e3af2 100644 --- a/subsys/bluetooth/audio/Kconfig.bap +++ b/subsys/bluetooth/audio/Kconfig.bap @@ -120,7 +120,7 @@ endif # BT_BAP_UNICAST_CLIENT config BT_BAP_BROADCAST_SOURCE bool "Bluetooth Broadcast Source Audio Support" - select BT_ISO_BROADCASTER + depends on BT_ISO_BROADCASTER help This option enables support for Bluetooth Broadcast Source Audio using Isochronous channels. diff --git a/tests/bluetooth/audio/bap_broadcast_source/prj.conf b/tests/bluetooth/audio/bap_broadcast_source/prj.conf index 4f4534ac2a597..5bbdaecce6b3a 100644 --- a/tests/bluetooth/audio/bap_broadcast_source/prj.conf +++ b/tests/bluetooth/audio/bap_broadcast_source/prj.conf @@ -3,6 +3,7 @@ CONFIG_ZTEST=y CONFIG_BT=y CONFIG_BT_AUDIO=y +CONFIG_BT_ISO_BROADCASTER=y CONFIG_BT_ISO_MAX_CHAN=2 CONFIG_BT_BAP_BROADCAST_SOURCE=y diff --git a/tests/bluetooth/shell/audio.conf b/tests/bluetooth/shell/audio.conf index a509fd8f83cc3..f142e17028081 100644 --- a/tests/bluetooth/shell/audio.conf +++ b/tests/bluetooth/shell/audio.conf @@ -55,6 +55,7 @@ CONFIG_BT_PER_ADV_SYNC_TRANSFER_RECEIVER=y CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER=y # Support an ISO channel per ASE +CONFIG_BT_ISO_BROADCASTER=y CONFIG_BT_ISO_PERIPHERAL=y CONFIG_BT_ISO_MAX_CHAN=4 CONFIG_BT_ISO_TEST_PARAMS=y diff --git a/tests/bluetooth/tester/overlay-le-audio.conf b/tests/bluetooth/tester/overlay-le-audio.conf index 3f1b5878bf3b3..97f6a2b2bab28 100644 --- a/tests/bluetooth/tester/overlay-le-audio.conf +++ b/tests/bluetooth/tester/overlay-le-audio.conf @@ -8,6 +8,7 @@ CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y CONFIG_BT_GATT_AUTO_UPDATE_MTU=y CONFIG_BT_ISO_PERIPHERAL=y CONFIG_BT_ISO_CENTRAL=y +CONFIG_BT_ISO_BROADCASTER=y CONFIG_BT_EXT_ADV=y CONFIG_BT_BAP_UNICAST_SERVER=y CONFIG_BT_BAP_UNICAST_CLIENT=y diff --git a/tests/bsim/bluetooth/audio/prj.conf b/tests/bsim/bluetooth/audio/prj.conf index 70b0e8d465b62..c9b786e94f5be 100644 --- a/tests/bsim/bluetooth/audio/prj.conf +++ b/tests/bsim/bluetooth/audio/prj.conf @@ -5,6 +5,7 @@ CONFIG_NO_OPTIMIZATIONS=y CONFIG_BT=y CONFIG_BT_CENTRAL=y CONFIG_BT_ISO_CENTRAL=y +CONFIG_BT_ISO_BROADCASTER=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_DEVICE_NAME="bsim_test_audio" # TBS Client may require up to 12 buffers From c0f86011cb25b3efcdd1410fcd14041b36029ba6 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Wed, 13 Nov 2024 11:58:46 +0100 Subject: [PATCH 2926/4482] Bluetooth: BAP: Depend on BT_ISO_SYNC_RECEIVER instead of select The BAP Kconfigs option now depends on BT_ISO_BROADCASTER instead of selecting it. This is an effort to reduce the use of select in LE Audio. Signed-off-by: Emil Gydesen --- samples/bluetooth/bap_broadcast_assistant/prj.conf | 1 + samples/bluetooth/bap_broadcast_sink/prj.conf | 1 + samples/bluetooth/cap_acceptor/Kconfig | 2 +- samples/bluetooth/pbp_public_broadcast_sink/prj.conf | 1 + samples/bluetooth/tmap_bmr/prj.conf | 1 + subsys/bluetooth/audio/Kconfig.bap | 6 +++--- tests/bluetooth/audio/bap_base/prj.conf | 1 + tests/bluetooth/audio/cap_commander/prj.conf | 1 + tests/bluetooth/shell/audio.conf | 1 + tests/bluetooth/tester/overlay-le-audio.conf | 1 + tests/bsim/bluetooth/audio/prj.conf | 1 + 11 files changed, 13 insertions(+), 4 deletions(-) diff --git a/samples/bluetooth/bap_broadcast_assistant/prj.conf b/samples/bluetooth/bap_broadcast_assistant/prj.conf index 3bef6a1e8e607..79613fd0075b8 100644 --- a/samples/bluetooth/bap_broadcast_assistant/prj.conf +++ b/samples/bluetooth/bap_broadcast_assistant/prj.conf @@ -14,5 +14,6 @@ CONFIG_BT_TINYCRYPT_ECC=y CONFIG_BT_EXT_ADV=y CONFIG_BT_BAP_BASS_MAX_SUBGROUPS=2 +CONFIG_BT_ISO_SYNC_RECEIVER=y CONFIG_BT_BAP_BROADCAST_ASSISTANT=y CONFIG_BT_AUDIO_CODEC_CFG_MAX_METADATA_SIZE=255 diff --git a/samples/bluetooth/bap_broadcast_sink/prj.conf b/samples/bluetooth/bap_broadcast_sink/prj.conf index df18314cfa1e0..c4367d2c1e189 100644 --- a/samples/bluetooth/bap_broadcast_sink/prj.conf +++ b/samples/bluetooth/bap_broadcast_sink/prj.conf @@ -6,6 +6,7 @@ CONFIG_BT_PAC_SNK=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_OBSERVER=y CONFIG_BT_GATT_DYNAMIC_DB=y +CONFIG_BT_ISO_SYNC_RECEIVER=y CONFIG_BT_BAP_BROADCAST_SINK=y CONFIG_BT_BAP_SCAN_DELEGATOR=y CONFIG_BT_ISO_MAX_CHAN=2 diff --git a/samples/bluetooth/cap_acceptor/Kconfig b/samples/bluetooth/cap_acceptor/Kconfig index c9a34b2e311f3..9c0ef35140467 100644 --- a/samples/bluetooth/cap_acceptor/Kconfig +++ b/samples/bluetooth/cap_acceptor/Kconfig @@ -22,9 +22,9 @@ config SAMPLE_UNICAST config SAMPLE_BROADCAST bool "Whether or not to search for CAP acceptors for unicast audio" default y if !SAMPLE_UNICAST - select BT_ISO_SYNC_RECEIVER select BT_BAP_SCAN_DELEGATOR select BT_OBSERVER + select BT_ISO_SYNC_RECEIVER select BT_BAP_BROADCAST_SINK select BT_PAC_SNK select BT_PAC_SNK_LOC diff --git a/samples/bluetooth/pbp_public_broadcast_sink/prj.conf b/samples/bluetooth/pbp_public_broadcast_sink/prj.conf index 002c41ed92d36..e07be74d5c3bf 100644 --- a/samples/bluetooth/pbp_public_broadcast_sink/prj.conf +++ b/samples/bluetooth/pbp_public_broadcast_sink/prj.conf @@ -17,6 +17,7 @@ CONFIG_BT_AUDIO_CODEC_CAP_MAX_METADATA_SIZE=196 CONFIG_BT_CAP_ACCEPTOR=y # BAP support +CONFIG_BT_ISO_SYNC_RECEIVER=y CONFIG_BT_BAP_SCAN_DELEGATOR=y CONFIG_BT_BAP_BROADCAST_SINK=y CONFIG_BT_BAP_BROADCAST_SNK_SUBGROUP_COUNT=1 diff --git a/samples/bluetooth/tmap_bmr/prj.conf b/samples/bluetooth/tmap_bmr/prj.conf index 2a87e242cb422..e2112109986ba 100644 --- a/samples/bluetooth/tmap_bmr/prj.conf +++ b/samples/bluetooth/tmap_bmr/prj.conf @@ -18,6 +18,7 @@ CONFIG_BT_TMAP=y CONFIG_BT_CAP_ACCEPTOR=y # BAP support +CONFIG_BT_ISO_SYNC_RECEIVER=y CONFIG_BT_BAP_SCAN_DELEGATOR=y CONFIG_BT_BAP_BROADCAST_SINK=y CONFIG_BT_BAP_BROADCAST_SNK_SUBGROUP_COUNT=1 diff --git a/subsys/bluetooth/audio/Kconfig.bap b/subsys/bluetooth/audio/Kconfig.bap index 9c565693e3af2..6180f4d818ae5 100644 --- a/subsys/bluetooth/audio/Kconfig.bap +++ b/subsys/bluetooth/audio/Kconfig.bap @@ -158,7 +158,7 @@ endif # BT_BAP_BROADCAST_SOURCE config BT_BAP_BROADCAST_SINK bool "Bluetooth Broadcast Sink Audio Support" - select BT_ISO_SYNC_RECEIVER + depends on BT_ISO_SYNC_RECEIVER select BT_PAC_SNK depends on BT_PERIPHERAL depends on BT_BAP_SCAN_DELEGATOR @@ -202,7 +202,7 @@ config BT_BAP_SCAN_DELEGATOR bool "Basic Audio Profile Scan Delegator role support" select BT_EXT_ADV select BT_PER_ADV_SYNC - select BT_ISO_SYNC_RECEIVER + depends on BT_ISO_SYNC_RECEIVER depends on BT_OBSERVER depends on BT_GATT_DYNAMIC_DB depends on BT_BONDABLE @@ -236,7 +236,7 @@ config BT_BAP_BROADCAST_ASSISTANT bool "Basic Audio Profile Broadcast Assistant role support" select BT_EXT_ADV select BT_PER_ADV_SYNC - select BT_ISO_SYNC_RECEIVER + depends on BT_ISO_SYNC_RECEIVER depends on BT_GATT_CLIENT depends on BT_GATT_AUTO_DISCOVER_CCC depends on BT_GATT_AUTO_UPDATE_MTU diff --git a/tests/bluetooth/audio/bap_base/prj.conf b/tests/bluetooth/audio/bap_base/prj.conf index 95192bfe8c1df..e93a7708e5d33 100644 --- a/tests/bluetooth/audio/bap_base/prj.conf +++ b/tests/bluetooth/audio/bap_base/prj.conf @@ -7,6 +7,7 @@ CONFIG_BT_PERIPHERAL=y CONFIG_BT_OBSERVER=y CONFIG_BT_GATT_DYNAMIC_DB=y # Need to enable one broadcast role to enable CONFIG_BT_BAP_BASE +CONFIG_BT_ISO_SYNC_RECEIVER=y CONFIG_BT_BAP_SCAN_DELEGATOR=y CONFIG_LOG=y diff --git a/tests/bluetooth/audio/cap_commander/prj.conf b/tests/bluetooth/audio/cap_commander/prj.conf index 0ca1961eef71c..c7d53283c3fa7 100644 --- a/tests/bluetooth/audio/cap_commander/prj.conf +++ b/tests/bluetooth/audio/cap_commander/prj.conf @@ -3,6 +3,7 @@ CONFIG_ZTEST=y CONFIG_BT=y CONFIG_BT_SMP=y CONFIG_BT_CENTRAL=y +CONFIG_BT_ISO_SYNC_RECEIVER=y CONFIG_BT_MAX_CONN=2 CONFIG_BT_OBSERVER=y CONFIG_BT_GATT_CLIENT=y diff --git a/tests/bluetooth/shell/audio.conf b/tests/bluetooth/shell/audio.conf index f142e17028081..78bdd8575a21c 100644 --- a/tests/bluetooth/shell/audio.conf +++ b/tests/bluetooth/shell/audio.conf @@ -11,6 +11,7 @@ CONFIG_BT_SMP=y CONFIG_BT_TESTING=y CONFIG_BT_CENTRAL=y CONFIG_BT_ISO_CENTRAL=y +CONFIG_BT_ISO_SYNC_RECEIVER=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_PRIVACY=y CONFIG_BT_GATT_CLIENT=y diff --git a/tests/bluetooth/tester/overlay-le-audio.conf b/tests/bluetooth/tester/overlay-le-audio.conf index 97f6a2b2bab28..c82b799e56ec4 100644 --- a/tests/bluetooth/tester/overlay-le-audio.conf +++ b/tests/bluetooth/tester/overlay-le-audio.conf @@ -9,6 +9,7 @@ CONFIG_BT_GATT_AUTO_UPDATE_MTU=y CONFIG_BT_ISO_PERIPHERAL=y CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_ISO_BROADCASTER=y +CONFIG_BT_ISO_SYNC_RECEIVER=y CONFIG_BT_EXT_ADV=y CONFIG_BT_BAP_UNICAST_SERVER=y CONFIG_BT_BAP_UNICAST_CLIENT=y diff --git a/tests/bsim/bluetooth/audio/prj.conf b/tests/bsim/bluetooth/audio/prj.conf index c9b786e94f5be..6372a21b877a2 100644 --- a/tests/bsim/bluetooth/audio/prj.conf +++ b/tests/bsim/bluetooth/audio/prj.conf @@ -6,6 +6,7 @@ CONFIG_BT=y CONFIG_BT_CENTRAL=y CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_ISO_BROADCASTER=y +CONFIG_BT_ISO_SYNC_RECEIVER=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_DEVICE_NAME="bsim_test_audio" # TBS Client may require up to 12 buffers From 4c86a5cc8d59618c97173dc225571f31e5ebc4fa Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Wed, 13 Nov 2024 16:19:41 +0100 Subject: [PATCH 2927/4482] Bluetooth: BAP: Depend on BT_PAC_{SNK,SRC} instead of select Modify ASCS and BAP Broadcast sink to depend on the PAC options instead of selecting them. Since Kconfig does not support "depends on X if Y", a select for PAC_{SRC,SNK} is used depending on ASCS_ASE_{SRC,SNK}. Signed-off-by: Emil Gydesen --- samples/bluetooth/bap_unicast_server/prj.conf | 2 ++ samples/bluetooth/cap_acceptor/prj.conf | 2 ++ samples/bluetooth/hap_ha/prj.conf | 2 ++ samples/bluetooth/tmap_peripheral/prj.conf | 2 ++ subsys/bluetooth/audio/Kconfig.ascs | 2 -- subsys/bluetooth/audio/Kconfig.bap | 5 +++-- subsys/bluetooth/audio/shell/audio.h | 6 +++--- tests/bluetooth/audio/ascs/prj.conf | 2 ++ tests/bluetooth/shell/audio.conf | 4 ++-- tests/bluetooth/tester/overlay-le-audio.conf | 2 ++ 10 files changed, 20 insertions(+), 9 deletions(-) diff --git a/samples/bluetooth/bap_unicast_server/prj.conf b/samples/bluetooth/bap_unicast_server/prj.conf index bc8bb687dab3f..566baa8e83075 100644 --- a/samples/bluetooth/bap_unicast_server/prj.conf +++ b/samples/bluetooth/bap_unicast_server/prj.conf @@ -8,7 +8,9 @@ CONFIG_BT_GATT_CACHING=y CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_BAP_UNICAST_SERVER=y CONFIG_BT_ASCS=y +CONFIG_BT_PAC_SNK=y CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT=2 +CONFIG_BT_PAC_SRC=y CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT=1 CONFIG_BT_ISO_TX_BUF_COUNT=2 # Support an ISO channel per ASE diff --git a/samples/bluetooth/cap_acceptor/prj.conf b/samples/bluetooth/cap_acceptor/prj.conf index 15882dbd8460b..816ed1dcc9a79 100644 --- a/samples/bluetooth/cap_acceptor/prj.conf +++ b/samples/bluetooth/cap_acceptor/prj.conf @@ -17,7 +17,9 @@ CONFIG_BT_ATT_PREPARE_COUNT=1 # Support an ISO channel per ASE CONFIG_BT_ASCS=y +CONFIG_BT_PAC_SNK=y CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT=1 +CONFIG_BT_PAC_SRC=y CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT=1 # Support an ISO channel per ASE diff --git a/samples/bluetooth/hap_ha/prj.conf b/samples/bluetooth/hap_ha/prj.conf index 93d624a509582..72d21beaccb93 100644 --- a/samples/bluetooth/hap_ha/prj.conf +++ b/samples/bluetooth/hap_ha/prj.conf @@ -22,7 +22,9 @@ CONFIG_BT_ATT_PREPARE_COUNT=1 CONFIG_BT_AUDIO=y CONFIG_BT_BAP_UNICAST_SERVER=y CONFIG_BT_ASCS=y +CONFIG_BT_PAC_SNK=y CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT=1 +CONFIG_BT_PAC_SRC=y CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT=1 # Support an ISO channel per ASE CONFIG_BT_ISO_MAX_CHAN=2 diff --git a/samples/bluetooth/tmap_peripheral/prj.conf b/samples/bluetooth/tmap_peripheral/prj.conf index f37bb44f2c081..ebe30c7548639 100644 --- a/samples/bluetooth/tmap_peripheral/prj.conf +++ b/samples/bluetooth/tmap_peripheral/prj.conf @@ -31,7 +31,9 @@ CONFIG_BT_MCC=y # Support an ISO channel per ASE CONFIG_BT_ASCS=y +CONFIG_BT_PAC_SNK=y CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT=1 +CONFIG_BT_PAC_SRC=y CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT=1 # Support an ISO channel per ASE CONFIG_BT_ISO_MAX_CHAN=2 diff --git a/subsys/bluetooth/audio/Kconfig.ascs b/subsys/bluetooth/audio/Kconfig.ascs index 750c62730bcf2..21f05dd520032 100644 --- a/subsys/bluetooth/audio/Kconfig.ascs +++ b/subsys/bluetooth/audio/Kconfig.ascs @@ -30,11 +30,9 @@ config BT_ASCS_MAX_ASE_SRC_COUNT config BT_ASCS_ASE_SNK def_bool BT_ASCS_MAX_ASE_SNK_COUNT > 0 - select BT_PAC_SNK config BT_ASCS_ASE_SRC def_bool BT_ASCS_MAX_ASE_SRC_COUNT > 0 - select BT_PAC_SRC config BT_ASCS_MAX_ACTIVE_ASES int "Number of simultaneously supported ASE sessions" diff --git a/subsys/bluetooth/audio/Kconfig.bap b/subsys/bluetooth/audio/Kconfig.bap index 6180f4d818ae5..c24849c6b2bbe 100644 --- a/subsys/bluetooth/audio/Kconfig.bap +++ b/subsys/bluetooth/audio/Kconfig.bap @@ -16,8 +16,9 @@ config BT_BAP_UNICAST_SERVER depends on BT_PERIPHERAL depends on BT_ISO_PERIPHERAL depends on BT_ASCS - depends on BT_PACS depends on BT_BONDABLE + select BT_PAC_SRC if BT_ASCS_ASE_SNK + select BT_PAC_SNK if BT_ASCS_ASE_SRC help This option enables support for Bluetooth Unicast Audio Server using Isochronous channels. @@ -159,7 +160,7 @@ endif # BT_BAP_BROADCAST_SOURCE config BT_BAP_BROADCAST_SINK bool "Bluetooth Broadcast Sink Audio Support" depends on BT_ISO_SYNC_RECEIVER - select BT_PAC_SNK + depends on BT_PAC_SNK depends on BT_PERIPHERAL depends on BT_BAP_SCAN_DELEGATOR help diff --git a/subsys/bluetooth/audio/shell/audio.h b/subsys/bluetooth/audio/shell/audio.h index 97478158324f0..a02724bd75fdb 100644 --- a/subsys/bluetooth/audio/shell/audio.h +++ b/subsys/bluetooth/audio/shell/audio.h @@ -196,9 +196,9 @@ struct broadcast_sink { #if defined(CONFIG_BT_BAP_UNICAST) #define UNICAST_SERVER_STREAM_COUNT \ - COND_CODE_1(CONFIG_BT_ASCS, \ - (CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT + CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT), \ - (0)) + COND_CODE_1(CONFIG_BT_ASCS_ASE_SRC, (CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT), (0)) + \ + COND_CODE_1(CONFIG_BT_ASCS_ASE_SNK, (CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT), (0)) + #define UNICAST_CLIENT_STREAM_COUNT \ COND_CODE_1(CONFIG_BT_BAP_UNICAST_CLIENT, \ (CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT + \ diff --git a/tests/bluetooth/audio/ascs/prj.conf b/tests/bluetooth/audio/ascs/prj.conf index 83cedefe0e594..84b05139ed069 100644 --- a/tests/bluetooth/audio/ascs/prj.conf +++ b/tests/bluetooth/audio/ascs/prj.conf @@ -10,7 +10,9 @@ CONFIG_BT_GATT_CACHING=y CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_AUDIO=y CONFIG_BT_ASCS=y +CONFIG_BT_PAC_SNK=y CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT=2 +CONFIG_BT_PAC_SRC=y CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT=2 CONFIG_BT_ASCS_MAX_ACTIVE_ASES=1 CONFIG_BT_BAP_UNICAST_SERVER=y diff --git a/tests/bluetooth/shell/audio.conf b/tests/bluetooth/shell/audio.conf index 78bdd8575a21c..b50446e99fcfd 100644 --- a/tests/bluetooth/shell/audio.conf +++ b/tests/bluetooth/shell/audio.conf @@ -67,8 +67,6 @@ CONFIG_BT_ISO_RX_MTU=310 CONFIG_BT_AUDIO=y CONFIG_BT_BAP_UNICAST_SERVER=y -CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT=2 -CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT=2 CONFIG_BT_BAP_UNICAST_CLIENT=y CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT=4 @@ -79,7 +77,9 @@ CONFIG_BT_AUDIO_CODEC_CFG_MAX_METADATA_SIZE=255 CONFIG_BT_AUDIO_CODEC_CAP_MAX_METADATA_SIZE=255 CONFIG_BT_ASCS=y +CONFIG_BT_PAC_SNK=y CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT=2 +CONFIG_BT_PAC_SRC=y CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT=2 CONFIG_BT_BAP_BROADCAST_SOURCE=y CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT=4 diff --git a/tests/bluetooth/tester/overlay-le-audio.conf b/tests/bluetooth/tester/overlay-le-audio.conf index c82b799e56ec4..44d476f968efa 100644 --- a/tests/bluetooth/tester/overlay-le-audio.conf +++ b/tests/bluetooth/tester/overlay-le-audio.conf @@ -69,7 +69,9 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 # ASCS CONFIG_BT_ASCS=y +CONFIG_BT_PAC_SNK=y CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT=2 +CONFIG_BT_PAC_SRC=y CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT=2 # Support an ISO channel per ASE From c4fbe3821909d9309b21a70206d3e6c86f30b0a8 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 14 Nov 2024 10:55:07 +0100 Subject: [PATCH 2928/4482] Bluetooth: BAP: Depend on BT_PER_ADV_SYNC instead of select Change the select of BT_PER_ADV_SYNC and BT_EXT_ADV to depends on. This is an effort to reduce the use of select for Kconfig options. Signed-off-by: Emil Gydesen --- samples/bluetooth/bap_broadcast_assistant/prj.conf | 1 + samples/bluetooth/bap_broadcast_sink/prj.conf | 2 ++ samples/bluetooth/pbp_public_broadcast_sink/prj.conf | 2 ++ samples/bluetooth/tmap_bmr/prj.conf | 2 ++ subsys/bluetooth/audio/Kconfig.bap | 8 ++++---- tests/bluetooth/audio/bap_base/prj.conf | 2 ++ tests/bluetooth/audio/cap_commander/prj.conf | 2 ++ tests/bluetooth/shell/audio.conf | 2 ++ tests/bluetooth/tester/overlay-le-audio.conf | 1 + tests/bsim/bluetooth/audio/prj.conf | 2 ++ 10 files changed, 20 insertions(+), 4 deletions(-) diff --git a/samples/bluetooth/bap_broadcast_assistant/prj.conf b/samples/bluetooth/bap_broadcast_assistant/prj.conf index 79613fd0075b8..409683026cb08 100644 --- a/samples/bluetooth/bap_broadcast_assistant/prj.conf +++ b/samples/bluetooth/bap_broadcast_assistant/prj.conf @@ -13,6 +13,7 @@ CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191 CONFIG_BT_TINYCRYPT_ECC=y CONFIG_BT_EXT_ADV=y +CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_BAP_BASS_MAX_SUBGROUPS=2 CONFIG_BT_ISO_SYNC_RECEIVER=y CONFIG_BT_BAP_BROADCAST_ASSISTANT=y diff --git a/samples/bluetooth/bap_broadcast_sink/prj.conf b/samples/bluetooth/bap_broadcast_sink/prj.conf index c4367d2c1e189..3e0b269e7cf34 100644 --- a/samples/bluetooth/bap_broadcast_sink/prj.conf +++ b/samples/bluetooth/bap_broadcast_sink/prj.conf @@ -6,6 +6,8 @@ CONFIG_BT_PAC_SNK=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_OBSERVER=y CONFIG_BT_GATT_DYNAMIC_DB=y +CONFIG_BT_EXT_ADV=y +CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_ISO_SYNC_RECEIVER=y CONFIG_BT_BAP_BROADCAST_SINK=y CONFIG_BT_BAP_SCAN_DELEGATOR=y diff --git a/samples/bluetooth/pbp_public_broadcast_sink/prj.conf b/samples/bluetooth/pbp_public_broadcast_sink/prj.conf index e07be74d5c3bf..1cc458a47988b 100644 --- a/samples/bluetooth/pbp_public_broadcast_sink/prj.conf +++ b/samples/bluetooth/pbp_public_broadcast_sink/prj.conf @@ -18,6 +18,8 @@ CONFIG_BT_CAP_ACCEPTOR=y # BAP support CONFIG_BT_ISO_SYNC_RECEIVER=y +CONFIG_BT_EXT_ADV=y +CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_BAP_SCAN_DELEGATOR=y CONFIG_BT_BAP_BROADCAST_SINK=y CONFIG_BT_BAP_BROADCAST_SNK_SUBGROUP_COUNT=1 diff --git a/samples/bluetooth/tmap_bmr/prj.conf b/samples/bluetooth/tmap_bmr/prj.conf index e2112109986ba..b9f693c7efdde 100644 --- a/samples/bluetooth/tmap_bmr/prj.conf +++ b/samples/bluetooth/tmap_bmr/prj.conf @@ -18,6 +18,8 @@ CONFIG_BT_TMAP=y CONFIG_BT_CAP_ACCEPTOR=y # BAP support +CONFIG_BT_EXT_ADV=y +CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_ISO_SYNC_RECEIVER=y CONFIG_BT_BAP_SCAN_DELEGATOR=y CONFIG_BT_BAP_BROADCAST_SINK=y diff --git a/subsys/bluetooth/audio/Kconfig.bap b/subsys/bluetooth/audio/Kconfig.bap index c24849c6b2bbe..c370e0d4e3078 100644 --- a/subsys/bluetooth/audio/Kconfig.bap +++ b/subsys/bluetooth/audio/Kconfig.bap @@ -201,8 +201,8 @@ endif # BT_BAP_BROADCAST_SINK config BT_BAP_SCAN_DELEGATOR bool "Basic Audio Profile Scan Delegator role support" - select BT_EXT_ADV - select BT_PER_ADV_SYNC + depends on BT_EXT_ADV + depends on BT_PER_ADV_SYNC depends on BT_ISO_SYNC_RECEIVER depends on BT_OBSERVER depends on BT_GATT_DYNAMIC_DB @@ -235,8 +235,8 @@ endif # BT_BAP_SCAN_DELEGATOR config BT_BAP_BROADCAST_ASSISTANT bool "Basic Audio Profile Broadcast Assistant role support" - select BT_EXT_ADV - select BT_PER_ADV_SYNC + depends on BT_EXT_ADV + depends on BT_PER_ADV_SYNC depends on BT_ISO_SYNC_RECEIVER depends on BT_GATT_CLIENT depends on BT_GATT_AUTO_DISCOVER_CCC diff --git a/tests/bluetooth/audio/bap_base/prj.conf b/tests/bluetooth/audio/bap_base/prj.conf index e93a7708e5d33..6a009f22b509c 100644 --- a/tests/bluetooth/audio/bap_base/prj.conf +++ b/tests/bluetooth/audio/bap_base/prj.conf @@ -7,6 +7,8 @@ CONFIG_BT_PERIPHERAL=y CONFIG_BT_OBSERVER=y CONFIG_BT_GATT_DYNAMIC_DB=y # Need to enable one broadcast role to enable CONFIG_BT_BAP_BASE +CONFIG_BT_EXT_ADV=y +CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_ISO_SYNC_RECEIVER=y CONFIG_BT_BAP_SCAN_DELEGATOR=y diff --git a/tests/bluetooth/audio/cap_commander/prj.conf b/tests/bluetooth/audio/cap_commander/prj.conf index c7d53283c3fa7..5e4604dd8abe0 100644 --- a/tests/bluetooth/audio/cap_commander/prj.conf +++ b/tests/bluetooth/audio/cap_commander/prj.conf @@ -22,6 +22,8 @@ CONFIG_BT_AICS_CLIENT_MAX_INSTANCE_COUNT=1 CONFIG_BT_MICP_MIC_CTLR_MAX_AICS_INST=1 CONFIG_BT_CAP_COMMANDER=y +CONFIG_BT_EXT_ADV=y +CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_BAP_BROADCAST_ASSISTANT=y CONFIG_LOG=y CONFIG_BT_CAP_COMMANDER_LOG_LEVEL_DBG=y diff --git a/tests/bluetooth/shell/audio.conf b/tests/bluetooth/shell/audio.conf index b50446e99fcfd..5e4e57ff561f2 100644 --- a/tests/bluetooth/shell/audio.conf +++ b/tests/bluetooth/shell/audio.conf @@ -11,6 +11,8 @@ CONFIG_BT_SMP=y CONFIG_BT_TESTING=y CONFIG_BT_CENTRAL=y CONFIG_BT_ISO_CENTRAL=y +CONFIG_BT_EXT_ADV=y +CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_ISO_SYNC_RECEIVER=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_PRIVACY=y diff --git a/tests/bluetooth/tester/overlay-le-audio.conf b/tests/bluetooth/tester/overlay-le-audio.conf index 44d476f968efa..ef061eb1d55ec 100644 --- a/tests/bluetooth/tester/overlay-le-audio.conf +++ b/tests/bluetooth/tester/overlay-le-audio.conf @@ -9,6 +9,7 @@ CONFIG_BT_GATT_AUTO_UPDATE_MTU=y CONFIG_BT_ISO_PERIPHERAL=y CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_ISO_BROADCASTER=y +CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_ISO_SYNC_RECEIVER=y CONFIG_BT_EXT_ADV=y CONFIG_BT_BAP_UNICAST_SERVER=y diff --git a/tests/bsim/bluetooth/audio/prj.conf b/tests/bsim/bluetooth/audio/prj.conf index 6372a21b877a2..4879749ef78a5 100644 --- a/tests/bsim/bluetooth/audio/prj.conf +++ b/tests/bsim/bluetooth/audio/prj.conf @@ -6,6 +6,8 @@ CONFIG_BT=y CONFIG_BT_CENTRAL=y CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_ISO_BROADCASTER=y +CONFIG_BT_EXT_ADV=y +CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_ISO_SYNC_RECEIVER=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_DEVICE_NAME="bsim_test_audio" From 7a72280d0171270a3fba3e92f27ab9eb35da3178 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 14 Nov 2024 10:57:10 +0100 Subject: [PATCH 2929/4482] Bluetooth: HAS: Change select UTF8 to depends on Change the select to a depends on for the Kconfig options for HAS and HAS_CLIENT. This is an effort to reduce the number of selects used by LE Audio. Signed-off-by: Emil Gydesen --- samples/bluetooth/hap_ha/prj.conf | 1 + subsys/bluetooth/audio/Kconfig.has | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/samples/bluetooth/hap_ha/prj.conf b/samples/bluetooth/hap_ha/prj.conf index 72d21beaccb93..efd5a4004f9e4 100644 --- a/samples/bluetooth/hap_ha/prj.conf +++ b/samples/bluetooth/hap_ha/prj.conf @@ -34,6 +34,7 @@ CONFIG_BT_PAC_SRC_LOC=y CONFIG_BT_VCP_VOL_REND=y CONFIG_BT_MICP_MIC_DEV=y +CONFIG_UTF8=y CONFIG_BT_HAS=y CONFIG_HAP_HA_HEARING_AID_MONAURAL=y CONFIG_BT_HAS_PRESET_COUNT=4 diff --git a/subsys/bluetooth/audio/Kconfig.has b/subsys/bluetooth/audio/Kconfig.has index f7d4de583fdc4..adf8cda6bbb1f 100644 --- a/subsys/bluetooth/audio/Kconfig.has +++ b/subsys/bluetooth/audio/Kconfig.has @@ -6,7 +6,7 @@ menuconfig BT_HAS bool "Hearing Access Service support" - select UTF8 + depends on UTF8 depends on BT_GATT_DYNAMIC_DB depends on BT_BAP_UNICAST_SERVER help @@ -56,9 +56,9 @@ endif # BT_HAS config BT_HAS_CLIENT bool "Hearing Access Service Client support" + depends on UTF8 depends on BT_GATT_CLIENT depends on BT_GATT_AUTO_DISCOVER_CCC - select UTF8 depends on BT_GATT_AUTO_UPDATE_MTU help This option enables support for Hearing Access Service Client. From ccfd16e2c286b83f7bb3d5addc6336ac66afb105 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Thu, 14 Nov 2024 16:01:42 +0100 Subject: [PATCH 2930/4482] doc: releases: Add BT LE audio Kconfig options to migration guide Add the list of affect Kconfig options to the migration guide. Signed-off-by: Emil Gydesen --- doc/releases/migration-guide-4.1.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/releases/migration-guide-4.1.rst b/doc/releases/migration-guide-4.1.rst index 90dfad9a0e237..4319afe2080c4 100644 --- a/doc/releases/migration-guide-4.1.rst +++ b/doc/releases/migration-guide-4.1.rst @@ -96,6 +96,19 @@ Bluetooth Mesh Bluetooth Audio =============== +* The following Kconfig options are not longer automatically enabled by the LE Audio Kconfig + options and may need to be enabled manually (:github:`81328`): + + * :kconfig:option:`CONFIG_BT_GATT_CLIENT` + * :kconfig:option:`CONFIG_BT_GATT_AUTO_DISCOVER_CCC` + * :kconfig:option:`CONFIG_BT_GATT_AUTO_UPDATE_MTU` + * :kconfig:option:`CONFIG_BT_EXT_ADV` + * :kconfig:option:`CONFIG_BT_PER_ADV_SYNC` + * :kconfig:option:`CONFIG_BT_ISO_BROADCASTER` + * :kconfig:option:`CONFIG_BT_ISO_SYNC_RECEIVER` + * :kconfig:option:`CONFIG_BT_PAC_SNK` + * :kconfig:option:`CONFIG_BT_PAC_SRC` + Bluetooth Classic ================= From 1bafbf4f1d113fd5d722bbcd041082927c4c7421 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Fri, 8 Nov 2024 19:00:25 +0200 Subject: [PATCH 2931/4482] drivers: dma: intel-adsp-hda: optimize L1 exit handling in ISR Use the existing 'atomic' bitmask to speed up ISR processing for CONFIG_DMA_INTEL_ADSP_HDA_TIMING_L1_EXIT. This bitmask is used to track enabled DMA channels. In the common case, only a few DMA channels are active and low channels are allocated first. Take advantage of this and not iterate over all DMA channels of all all host devices. Rather break out as soon as L1 exit handling is done for all enabled channels. Signed-off-by: Kai Vehmanen --- drivers/dma/dma_intel_adsp_hda.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/dma/dma_intel_adsp_hda.c b/drivers/dma/dma_intel_adsp_hda.c index 2f9b98ed74ba0..10db031d9cef7 100644 --- a/drivers/dma/dma_intel_adsp_hda.c +++ b/drivers/dma/dma_intel_adsp_hda.c @@ -459,6 +459,7 @@ void intel_adsp_hda_dma_isr(void) bool triggered_interrupts = false; int i, j; int expected_interrupts = 0; + atomic_val_t enabled_chs; const struct device *host_dev[] = { #if CONFIG_DMA_INTEL_ADSP_HDA_HOST_OUT DT_FOREACH_STATUS_OKAY(intel_adsp_hda_host_out, DEVICE_DT_GET_AND_COMMA) @@ -479,10 +480,12 @@ void intel_adsp_hda_dma_isr(void) for (i = 0; i < ARRAY_SIZE(host_dev); i++) { dma_ctx = (struct dma_context *)host_dev[i]->data; cfg = host_dev[i]->config; - - for (j = 0; j < dma_ctx->dma_channels; j++) { - if (!atomic_test_bit(dma_ctx->atomic, j)) + enabled_chs = atomic_get(dma_ctx->atomic); + for (j = 0; enabled_chs && j < dma_ctx->dma_channels; j++) { + if (!(enabled_chs & BIT(j))) { continue; + } + enabled_chs &= ~(BIT(j)); if (!intel_adsp_hda_is_buffer_interrupt_enabled(cfg->base, cfg->regblock_size, j)) From 58df2533bbbfa895d7543988b262af89327c46aa Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Mon, 18 Nov 2024 12:11:22 +0200 Subject: [PATCH 2932/4482] drivers: dma: intel-adsp-hda: coding style fix Align to coding style and use braces for all if blocks. Signed-off-by: Kai Vehmanen --- drivers/dma/dma_intel_adsp_hda.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/dma/dma_intel_adsp_hda.c b/drivers/dma/dma_intel_adsp_hda.c index 10db031d9cef7..43653933a14e4 100644 --- a/drivers/dma/dma_intel_adsp_hda.c +++ b/drivers/dma/dma_intel_adsp_hda.c @@ -488,8 +488,9 @@ void intel_adsp_hda_dma_isr(void) enabled_chs &= ~(BIT(j)); if (!intel_adsp_hda_is_buffer_interrupt_enabled(cfg->base, - cfg->regblock_size, j)) + cfg->regblock_size, j)) { continue; + } if (intel_adsp_hda_check_buffer_interrupt(cfg->base, cfg->regblock_size, j)) { From e7c3434685368534916efe11f591647deebff437 Mon Sep 17 00:00:00 2001 From: Lothar Felten Date: Thu, 18 Jul 2024 23:14:50 +0200 Subject: [PATCH 2933/4482] boards: lilygo: ttgo_lora32: enable SDHC support device tree: enable support for the SDHC controller to use the micro SD card slot documentation: - added instructions for SD card and OLED samples - added links to code samples defconfig: added CONFIG_ESP32_USE_UNSUPPORTED_REVISION=y to ttgo_lora32_esp32_procpu_defconfig The chip on the board is a ESP32 chip revision 1. The board will not boot, it displays the following warning at boot: I (35) boot: chip revision: v1.0 E (38) boot: You are using ESP32 chip revision (1) that is unsupported. While it may work, it could cause unexpected behavior or issues. E (50) boot: Proceeding with this ESP32 chip revision is not recommended unless you fully understand the potential risk and limitations. E (62) boot: If you choose to continue, please enable the 'CONFIG_ESP32_USE_UNSUPPORTED_REVISION' in your project configuration. E (73) boot: HW init failed, aborting In order to prevent a boot loop, CONFIG_ESP32_USE_UNSUPPORTED_REVISION=y was added to the defconfig. Signed-off-by: Lothar Felten --- boards/lilygo/ttgo_lora32/doc/index.rst | 31 +++++-------------- .../ttgo_lora32/ttgo_lora32-pinctrl.dtsi | 8 ++++- .../ttgo_lora32/ttgo_lora32_esp32_appcpu.yaml | 1 + .../ttgo_lora32/ttgo_lora32_esp32_procpu.dts | 27 ++++++++++++++++ .../ttgo_lora32/ttgo_lora32_esp32_procpu.yaml | 1 + .../ttgo_lora32_esp32_procpu_defconfig | 3 ++ 6 files changed, 47 insertions(+), 24 deletions(-) diff --git a/boards/lilygo/ttgo_lora32/doc/index.rst b/boards/lilygo/ttgo_lora32/doc/index.rst index 4a0ae0a5dde13..fa6613d7414dc 100644 --- a/boards/lilygo/ttgo_lora32/doc/index.rst +++ b/boards/lilygo/ttgo_lora32/doc/index.rst @@ -39,13 +39,13 @@ of the Lilygo TTGO LoRa32 board. +------------------+-------------------------------------------------------------------------+ | Power Switch | Sliding power switch. | +------------------+-------------------------------------------------------------------------+ -| LCD screen | Built-in OLED display \(`SSD1306`_, 0.96", 128x64 px\) controlled | +| OLED display | Built-in OLED display \(`SSD1306`_, 0.96", 128x64 px\) controlled | | | by I2C interface | +------------------+-------------------------------------------------------------------------+ | SX1276/SX1278 | LoRa radio frontend chip, connected via SPI. | | | Use SX1276 for 433MHz and SX1276 for 868/915/923MHz. | +------------------+-------------------------------------------------------------------------+ -| TF card slot | TF card slot wired to the SD interface of the MCU. | +| TF card slot | TF card slot wired to the SDHC interface of the MCU. | +------------------+-------------------------------------------------------------------------+ @@ -195,30 +195,15 @@ message in the monitor: ***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx ***** Hello World! ttgo_lora32 -LoRa samples +Code samples ============ -There are two LoRa samples that will work out of the box with this board. +The following sample applications will work out of the box with this board: -To build the LoRa transmit sample application using sysbuild use the command: - -.. zephyr-app-commands:: - :tool: west - :zephyr-app: samples/drivers/lora/send - :board: ttgo_lora32/esp32/procpu - :goals: build - :west-args: --sysbuild - :compact: - -To build the LoRa receive sample application using sysbuild use the command: - -.. zephyr-app-commands:: - :tool: west - :zephyr-app: samples/drivers/lora/receive - :board: ttgo_lora32/esp32/procpu - :goals: build - :west-args: --sysbuild - :compact: +* :zephyr:code-sample:`lora-send` +* :zephyr:code-sample:`lora-receive` +* :zephyr:code-sample:`fs` +* :zephyr:code-sample:`character-frame-buffer` Debugging ********* diff --git a/boards/lilygo/ttgo_lora32/ttgo_lora32-pinctrl.dtsi b/boards/lilygo/ttgo_lora32/ttgo_lora32-pinctrl.dtsi index 5f043ddb945d6..eaa3e9b422b51 100644 --- a/boards/lilygo/ttgo_lora32/ttgo_lora32-pinctrl.dtsi +++ b/boards/lilygo/ttgo_lora32/ttgo_lora32-pinctrl.dtsi @@ -41,5 +41,11 @@ output-high; }; }; - + sdhc0_default: sdhc0_default { + group1 { + pinmux = ; + bias-pull-up; + output-high; + }; + }; }; diff --git a/boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_appcpu.yaml b/boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_appcpu.yaml index f048566726012..0ab1a0e6182b0 100644 --- a/boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_appcpu.yaml +++ b/boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_appcpu.yaml @@ -24,4 +24,5 @@ testing: - cmsis_rtos - jwt - zdsp + - sdhc vendor: lilygo diff --git a/boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_procpu.dts b/boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_procpu.dts index d8dfad087e3e9..42782b142ac14 100644 --- a/boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_procpu.dts +++ b/boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_procpu.dts @@ -18,6 +18,7 @@ uart-0 = &uart0; i2c-0 = &i2c0; watchdog0 = &wdt0; + sdhc0 = &sdhc1; lora0 = &lora0; }; @@ -28,6 +29,7 @@ zephyr,flash = &flash0; zephyr,code-partition = &slot0_partition; zephyr,display = &ssd1306_128x64; + zephyr,sdhc = &sdhc1; }; leds { @@ -121,6 +123,31 @@ status = "okay"; }; +&sdhc { + sdhc1: sdhc@1 { + status = "okay"; + + pinctrl-0 = <&sdhc0_default>; + pinctrl-names = "default"; + power-delay-ms = <100>; + max-bus-freq = <52000000>; + bus-width = <4>; + + clk-pin = <14>; + cmd-pin = <15>; + d0-pin = <2>; + d1-pin = <4>; + d2-pin = <12>; + d3-pin = <13>; + + mmc { + compatible = "zephyr,sdmmc-disk"; + disk-name = "SD"; + status = "okay"; + }; + }; +}; + &flash0 { status = "okay"; partitions { diff --git a/boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_procpu.yaml b/boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_procpu.yaml index f4d0e25cc59d2..d16b056dd1166 100644 --- a/boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_procpu.yaml +++ b/boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_procpu.yaml @@ -14,6 +14,7 @@ supported: - display - lora - nvs + - sdhc testing: ignore_tags: - net diff --git a/boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_procpu_defconfig b/boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_procpu_defconfig index ee9920cda6870..e18641b5d445b 100644 --- a/boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_procpu_defconfig +++ b/boards/lilygo/ttgo_lora32/ttgo_lora32_esp32_procpu_defconfig @@ -8,3 +8,6 @@ CONFIG_UART_CONSOLE=y CONFIG_GPIO=y CONFIG_I2C=y + +# the following config is required to support chips of revision 1 +CONFIG_ESP32_USE_UNSUPPORTED_REVISION=y From 77e017306e52fb6ad897489f6f79f36ed3700323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Tue, 19 Nov 2024 08:53:27 +0100 Subject: [PATCH 2934/4482] Bsim: Bluetooth: Mesh: Rename/refactor `send_ra` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Renames `bt_mesh_test_send_ra` to `bt_mesh_test_send_data` and changes the corresponding callback funciton as it is used outside of the replay attack tests, and can be used to send custom data. The function is extended to accept a UUID parameter to allow sending data to virtual addresses. Signed-off-by: Håvard Reierstad --- tests/bsim/bluetooth/mesh/src/mesh_test.c | 25 ++++----- tests/bsim/bluetooth/mesh/src/mesh_test.h | 7 ++- tests/bsim/bluetooth/mesh/src/test_brg.c | 52 +++++++++---------- .../bluetooth/mesh/src/test_replay_cache.c | 20 +++---- 4 files changed, 50 insertions(+), 54 deletions(-) diff --git a/tests/bsim/bluetooth/mesh/src/mesh_test.c b/tests/bsim/bluetooth/mesh/src/mesh_test.c index 757e150c35013..255f8d8aa43ac 100644 --- a/tests/bsim/bluetooth/mesh/src/mesh_test.c +++ b/tests/bsim/bluetooth/mesh/src/mesh_test.c @@ -28,7 +28,7 @@ K_MEM_SLAB_DEFINE_STATIC(msg_pool, sizeof(struct bt_mesh_test_msg), static K_QUEUE_DEFINE(recv); struct bt_mesh_test_stats test_stats; struct bt_mesh_msg_ctx test_send_ctx; -static void (*ra_cb)(uint8_t *, size_t); +static void (*data_cb)(uint8_t *, size_t); static int msg_rx(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx, struct net_buf_simple *buf) @@ -78,8 +78,8 @@ static int msg_rx(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx, return 0; } -static int ra_rx(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx, - struct net_buf_simple *buf) +static int data_rx(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx, + struct net_buf_simple *buf) { LOG_INF("\tlen: %d bytes", buf->len); LOG_INF("\tsrc: 0x%04x", ctx->addr); @@ -87,18 +87,15 @@ static int ra_rx(const struct bt_mesh_model *mod, struct bt_mesh_msg_ctx *ctx, LOG_INF("\tttl: %u", ctx->recv_ttl); LOG_INF("\trssi: %d", ctx->recv_rssi); - if (ra_cb) { - ra_cb(buf->data, buf->len); + if (data_cb) { + data_cb(buf->data, buf->len); } return 0; } static const struct bt_mesh_model_op model_op[] = { - { TEST_MSG_OP_1, 0, msg_rx }, - { TEST_MSG_OP_2, 0, ra_rx }, - BT_MESH_MODEL_OP_END -}; + {TEST_MSG_OP_1, 0, msg_rx}, {TEST_MSG_OP_2, 0, data_rx}, BT_MESH_MODEL_OP_END}; int __weak test_model_pub_update(const struct bt_mesh_model *mod) { @@ -534,15 +531,15 @@ int bt_mesh_test_send(uint16_t addr, const uint8_t *uuid, size_t len, return 0; } -int bt_mesh_test_send_ra(uint16_t addr, uint8_t *data, size_t len, - const struct bt_mesh_send_cb *send_cb, - void *cb_data) +int bt_mesh_test_send_data(uint16_t addr, const uint8_t *uuid, uint8_t *data, size_t len, + const struct bt_mesh_send_cb *send_cb, void *cb_data) { int err; test_send_ctx.addr = addr; test_send_ctx.send_rel = 0; test_send_ctx.send_ttl = BT_MESH_TTL_DEFAULT; + test_send_ctx.uuid = uuid; BT_MESH_MODEL_BUF_DEFINE(buf, TEST_MSG_OP_2, BT_MESH_TX_SDU_MAX); bt_mesh_model_msg_init(&buf, TEST_MSG_OP_2); @@ -558,9 +555,9 @@ int bt_mesh_test_send_ra(uint16_t addr, uint8_t *data, size_t len, return 0; } -void bt_mesh_test_ra_cb_setup(void (*cb)(uint8_t *, size_t)) +void bt_mesh_test_data_cb_setup(void (*cb)(uint8_t *, size_t)) { - ra_cb = cb; + data_cb = cb; } uint16_t bt_mesh_test_own_addr_get(uint16_t start_addr) diff --git a/tests/bsim/bluetooth/mesh/src/mesh_test.h b/tests/bsim/bluetooth/mesh/src/mesh_test.h index 2a88d4156ca2b..4ec0648b7fa05 100644 --- a/tests/bsim/bluetooth/mesh/src/mesh_test.h +++ b/tests/bsim/bluetooth/mesh/src/mesh_test.h @@ -196,10 +196,9 @@ int bt_mesh_test_send_async(uint16_t addr, const uint8_t *uuid, size_t len, enum bt_mesh_test_send_flags flags, const struct bt_mesh_send_cb *send_cb, void *cb_data); -int bt_mesh_test_send_ra(uint16_t addr, uint8_t *data, size_t len, - const struct bt_mesh_send_cb *send_cb, - void *cb_data); -void bt_mesh_test_ra_cb_setup(void (*cb)(uint8_t *, size_t)); +int bt_mesh_test_send_data(uint16_t addr, const uint8_t *uuid, uint8_t *data, size_t len, + const struct bt_mesh_send_cb *send_cb, void *cb_data); +void bt_mesh_test_data_cb_setup(void (*cb)(uint8_t *, size_t)); uint16_t bt_mesh_test_own_addr_get(uint16_t start_addr); diff --git a/tests/bsim/bluetooth/mesh/src/test_brg.c b/tests/bsim/bluetooth/mesh/src/test_brg.c index 5c82c4dce7411..0637ea1c48cc5 100644 --- a/tests/bsim/bluetooth/mesh/src/test_brg.c +++ b/tests/bsim/bluetooth/mesh/src/test_brg.c @@ -293,7 +293,7 @@ static void tester_device_configure(uint16_t net_key_idx, uint16_t addr) LOG_INF("Device 0x%04x configured", addr); } -static void tester_ra_cb(uint8_t *data, size_t length) +static void tester_data_cb(uint8_t *data, size_t length) { uint8_t type = data[0]; @@ -309,18 +309,18 @@ static void tester_ra_cb(uint8_t *data, size_t length) k_sem_give(&status_msg_recvd_sem); } -static int send_data(uint16_t dst, uint8_t payload) +static int send_data(uint16_t dst, uint8_t payload, const uint8_t *uuid) { uint8_t data[2] = {MSG_TYPE_DATA, payload}; - return bt_mesh_test_send_ra(dst, data, sizeof(data), NULL, NULL); + return bt_mesh_test_send_data(dst, uuid, data, sizeof(data), NULL, NULL); } -static int send_get(uint16_t dst) +static int send_get(uint16_t dst, const uint8_t *uuid) { uint8_t data[1] = {MSG_TYPE_GET}; - return bt_mesh_test_send_ra(dst, data, sizeof(data), NULL, NULL); + return bt_mesh_test_send_data(dst, uuid, data, sizeof(data), NULL, NULL); } struct bridged_addresses_entry { @@ -363,7 +363,7 @@ static void bridge_table_verify(uint16_t net_idx1, uint16_t net_idx2, uint16_t s } } -static void device_ra_cb(uint8_t *data, size_t length) +static void device_data_cb(uint8_t *data, size_t length) { uint8_t type = data[0]; @@ -385,7 +385,7 @@ static void device_ra_cb(uint8_t *data, size_t length) memcpy(&test_data[2], recvd_msgs, recvd_msgs_cnt * sizeof(recvd_msgs[0])); - ASSERT_OK(bt_mesh_test_send_ra(PROV_ADDR, test_data, + ASSERT_OK(bt_mesh_test_send_data(PROV_ADDR, NULL, test_data, 2 + recvd_msgs_cnt * sizeof(recvd_msgs[0]), NULL, NULL)); @@ -432,7 +432,7 @@ static void send_and_receive(void) uint8_t payload = i | i << 4; for (int j = 0; j < msgs_cnt; j++) { - ASSERT_OK(send_data(DEVICE_ADDR_START + i, payload + j)); + ASSERT_OK(send_data(DEVICE_ADDR_START + i, payload + j, NULL)); } } @@ -441,7 +441,7 @@ static void send_and_receive(void) for (int i = 0; i < REMOTE_NODES; i++) { uint8_t payload = i | i << 4; - ASSERT_OK(send_get(DEVICE_ADDR_START + i)); + ASSERT_OK(send_get(DEVICE_ADDR_START + i, NULL)); ASSERT_OK(k_sem_take(&status_msg_recvd_sem, K_SECONDS(5))); ASSERT_EQUAL(recvd_msgs_cnt, msgs_cnt); @@ -480,7 +480,7 @@ static void test_tester_simple(void) tester_workaround(); - bt_mesh_test_ra_cb_setup(tester_ra_cb); + bt_mesh_test_data_cb_setup(tester_data_cb); LOG_INF("Step 1: Checking bridging table..."); @@ -499,7 +499,7 @@ static void test_tester_simple(void) uint8_t payload = i | i << 4; for (int j = 0; j < 3; j++) { - ASSERT_OK(send_data(DEVICE_ADDR_START + i, payload + j)); + ASSERT_OK(send_data(DEVICE_ADDR_START + i, payload + j, NULL)); } } @@ -512,7 +512,7 @@ static void test_tester_simple(void) LOG_INF("Checking data..."); for (int i = 0; i < REMOTE_NODES; i++) { - ASSERT_OK(send_get(DEVICE_ADDR_START + i)); + ASSERT_OK(send_get(DEVICE_ADDR_START + i, NULL)); ASSERT_OK(k_sem_take(&status_msg_recvd_sem, K_SECONDS(5))); ASSERT_EQUAL(recvd_msgs_cnt, 0); @@ -543,26 +543,26 @@ static void test_tester_table_state_change(void) tester_workaround(); - bt_mesh_test_ra_cb_setup(tester_ra_cb); + bt_mesh_test_data_cb_setup(tester_data_cb); /* Bridge Table is empty, will not get any message back. */ - ASSERT_OK(send_get(DEVICE_ADDR_START)); + ASSERT_OK(send_get(DEVICE_ADDR_START, NULL)); err = k_sem_take(&status_msg_recvd_sem, K_SECONDS(5)); ASSERT_EQUAL(err, -EAGAIN); /* DATA and GET messages should reach Device 1, but STATUS message won't be received. */ bridge_entry_add(PROV_ADDR, DEVICE_ADDR_START, 0, 1, BT_MESH_BRG_CFG_DIR_ONEWAY); - ASSERT_OK(send_data(DEVICE_ADDR_START, 0xAA)); + ASSERT_OK(send_data(DEVICE_ADDR_START, 0xAA, NULL)); - ASSERT_OK(send_get(DEVICE_ADDR_START)); + ASSERT_OK(send_get(DEVICE_ADDR_START, NULL)); err = k_sem_take(&status_msg_recvd_sem, K_SECONDS(5)); ASSERT_EQUAL(err, -EAGAIN); /* Sending DATA message again before adding a new entry as the previous GET message resets * received messages counter on Devices */ - ASSERT_OK(send_data(DEVICE_ADDR_START, 0xAA)); + ASSERT_OK(send_data(DEVICE_ADDR_START, 0xAA, NULL)); /* Adding a reverse entry. This should be added to the bridge table as a separate entry as * the addresses and net keys indexs are provided in the opposite order. */ @@ -581,7 +581,7 @@ static void test_tester_table_state_change(void) k_sleep(K_SECONDS(1)); /* Now we should receive STATUS message. */ - ASSERT_OK(send_get(DEVICE_ADDR_START)); + ASSERT_OK(send_get(DEVICE_ADDR_START, NULL)); ASSERT_OK(k_sem_take(&status_msg_recvd_sem, K_SECONDS(5))); ASSERT_EQUAL(recvd_msgs_cnt, 1); @@ -599,7 +599,7 @@ static void test_tester_table_state_change(void) 1); bridge_table_verify(1, 0, 0, NULL, 0); - ASSERT_OK(send_get(DEVICE_ADDR_START)); + ASSERT_OK(send_get(DEVICE_ADDR_START, NULL)); ASSERT_OK(k_sem_take(&status_msg_recvd_sem, K_SECONDS(5))); ASSERT_EQUAL(recvd_msgs_cnt, 0); @@ -640,7 +640,7 @@ static void test_tester_net_key_remove(void) tester_workaround(); - bt_mesh_test_ra_cb_setup(tester_ra_cb); + bt_mesh_test_data_cb_setup(tester_data_cb); /* Adding devices to bridge table */ for (int i = 0; i < REMOTE_NODES; i++) { @@ -648,8 +648,8 @@ static void test_tester_net_key_remove(void) BT_MESH_BRG_CFG_DIR_TWOWAY); } - ASSERT_OK(send_data(DEVICE_ADDR_START, 0xAA)); - ASSERT_OK(send_get(DEVICE_ADDR_START)); + ASSERT_OK(send_data(DEVICE_ADDR_START, 0xAA, NULL)); + ASSERT_OK(send_get(DEVICE_ADDR_START, NULL)); ASSERT_OK(k_sem_take(&status_msg_recvd_sem, K_SECONDS(5))); ASSERT_EQUAL(recvd_msgs_cnt, 1); ASSERT_EQUAL(recvd_msgs[0], 0xAA); @@ -657,7 +657,7 @@ static void test_tester_net_key_remove(void) /* Removing subnet 1 from Subnet Bridge. */ net_key_remove(BRIDGE_ADDR, 0, 1); - ASSERT_OK(send_get(DEVICE_ADDR_START)); + ASSERT_OK(send_get(DEVICE_ADDR_START, NULL)); err = k_sem_take(&status_msg_recvd_sem, K_SECONDS(5)); ASSERT_EQUAL(err, -EAGAIN); @@ -762,7 +762,7 @@ static void msg_cache_workaround(void) for (int i = 0; i < REMOTE_NODES; i++) { for (int j = 0; j < CONFIG_BT_MESH_MSG_CACHE_SIZE; j++) { - ASSERT_OK(send_get(DEVICE_ADDR_START + i)); + ASSERT_OK(send_get(DEVICE_ADDR_START + i, NULL)); /* k_sem_take is needed to not overflow network buffer pool. The result * of the semaphor is not important as we just need to bump sequence number * enough to bypass message cache. @@ -841,7 +841,7 @@ static void test_tester_ivu(void) tester_workaround(); - bt_mesh_test_ra_cb_setup(tester_ra_cb); + bt_mesh_test_data_cb_setup(tester_data_cb); ASSERT_TRUE(!atomic_test_bit(bt_mesh.flags, BT_MESH_IVU_IN_PROGRESS)); ASSERT_TRUE(bt_mesh.iv_index == test_ividx); @@ -929,7 +929,7 @@ static void device_setup(void) ASSERT_OK(k_sem_take(&prov_sem, K_SECONDS(40))); LOG_INF("Node is provisioned"); - bt_mesh_test_ra_cb_setup(device_ra_cb); + bt_mesh_test_data_cb_setup(device_data_cb); } static void test_device_simple(void) diff --git a/tests/bsim/bluetooth/mesh/src/test_replay_cache.c b/tests/bsim/bluetooth/mesh/src/test_replay_cache.c index 636e112715a1e..49f86db95aa7a 100644 --- a/tests/bsim/bluetooth/mesh/src/test_replay_cache.c +++ b/tests/bsim/bluetooth/mesh/src/test_replay_cache.c @@ -137,8 +137,8 @@ static void test_tx_immediate_replay_attack(void) is_tx_succeeded = false; memset(test_data, i, sizeof(test_data)); - ASSERT_OK(bt_mesh_test_send_ra(rx_cfg.addr, test_data, - sizeof(test_data), &send_cb, &sem)); + ASSERT_OK(bt_mesh_test_send_data(rx_cfg.addr, NULL, test_data, sizeof(test_data), + &send_cb, &sem)); if (k_sem_take(&sem, K_SECONDS(TEST_DATA_WAITING_TIME))) { LOG_ERR("Send timed out"); @@ -155,8 +155,8 @@ static void test_tx_immediate_replay_attack(void) is_tx_succeeded = true; memset(test_data, i, sizeof(test_data)); - ASSERT_OK(bt_mesh_test_send_ra(rx_cfg.addr, test_data, - sizeof(test_data), &send_cb, &sem)); + ASSERT_OK(bt_mesh_test_send_data(rx_cfg.addr, NULL, test_data, sizeof(test_data), + &send_cb, &sem)); if (k_sem_take(&sem, K_SECONDS(TEST_DATA_WAITING_TIME))) { LOG_ERR("Send timed out"); @@ -174,7 +174,7 @@ static void test_rx_immediate_replay_attack(void) { bt_mesh_test_setup(); rx_sar_conf(); - bt_mesh_test_ra_cb_setup(rx_ended); + bt_mesh_test_data_cb_setup(rx_ended); k_sleep(K_SECONDS(6 * TEST_DATA_WAITING_TIME)); @@ -200,8 +200,8 @@ static void test_tx_power_replay_attack(void) is_tx_succeeded = true; memset(test_data, i, sizeof(test_data)); - ASSERT_OK(bt_mesh_test_send_ra(rx_cfg.addr, test_data, - sizeof(test_data), &send_cb, &sem)); + ASSERT_OK(bt_mesh_test_send_data(rx_cfg.addr, NULL, test_data, sizeof(test_data), + &send_cb, &sem)); if (k_sem_take(&sem, K_SECONDS(TEST_DATA_WAITING_TIME))) { LOG_ERR("Send timed out"); @@ -216,8 +216,8 @@ static void test_tx_power_replay_attack(void) is_tx_succeeded = false; memset(test_data, i, sizeof(test_data)); - ASSERT_OK(bt_mesh_test_send_ra(rx_cfg.addr, test_data, - sizeof(test_data), &send_cb, &sem)); + ASSERT_OK(bt_mesh_test_send_data(rx_cfg.addr, NULL, test_data, sizeof(test_data), + &send_cb, &sem)); if (k_sem_take(&sem, K_SECONDS(TEST_DATA_WAITING_TIME))) { LOG_ERR("Send timed out"); @@ -235,7 +235,7 @@ static void test_rx_power_replay_attack(void) { bt_mesh_test_setup(); rx_sar_conf(); - bt_mesh_test_ra_cb_setup(rx_ended); + bt_mesh_test_data_cb_setup(rx_ended); k_sleep(K_SECONDS(6 * TEST_DATA_WAITING_TIME)); From 0b35b38ef59b81040adc5014b9f82dd3863144ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Reierstad?= Date: Tue, 19 Nov 2024 08:53:27 +0100 Subject: [PATCH 2935/4482] Bsim: Bluetooth: Mesh: Add multicast bridge tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds two new tests for the Subnet Bridge feature, testing group and virtual addresses as destinations. The tests are based on the existing `brg_simple.sh` test, with the addition of a new node and a new subnet to make sure that messages are bridged to multiple subnets, but only subnets that have a corresponding entry in the bridging table. Signed-off-by: Håvard Reierstad --- tests/bsim/bluetooth/mesh/prj.conf | 4 +- tests/bsim/bluetooth/mesh/src/test_brg.c | 187 ++++++++++++++++-- .../tests_scripts/bridge/brg_simple_group.sh | 45 +++++ .../tests_scripts/bridge/brg_simple_va.sh | 43 ++++ 4 files changed, 257 insertions(+), 22 deletions(-) create mode 100755 tests/bsim/bluetooth/mesh/tests_scripts/bridge/brg_simple_group.sh create mode 100755 tests/bsim/bluetooth/mesh/tests_scripts/bridge/brg_simple_va.sh diff --git a/tests/bsim/bluetooth/mesh/prj.conf b/tests/bsim/bluetooth/mesh/prj.conf index 156b12496758f..bd5c2d2ec4712 100644 --- a/tests/bsim/bluetooth/mesh/prj.conf +++ b/tests/bsim/bluetooth/mesh/prj.conf @@ -40,10 +40,10 @@ CONFIG_BT_MESH_PB_ADV=y CONFIG_BT_MESH_PROVISIONER=y CONFIG_BT_MESH_PROVISIONEE=y CONFIG_BT_MESH_CDB=y -CONFIG_BT_MESH_CDB_NODE_COUNT=4 +CONFIG_BT_MESH_CDB_NODE_COUNT=5 CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY=y CONFIG_BT_MESH_MODEL_EXTENSIONS=y -CONFIG_BT_MESH_CDB_SUBNET_COUNT=3 +CONFIG_BT_MESH_CDB_SUBNET_COUNT=4 CONFIG_BT_MESH_SUBNET_COUNT=5 CONFIG_BT_MESH_SAR_CFG_CLI=y CONFIG_BT_MESH_SAR_CFG_SRV=y diff --git a/tests/bsim/bluetooth/mesh/src/test_brg.c b/tests/bsim/bluetooth/mesh/src/test_brg.c index 0637ea1c48cc5..507b291fe62fb 100644 --- a/tests/bsim/bluetooth/mesh/src/test_brg.c +++ b/tests/bsim/bluetooth/mesh/src/test_brg.c @@ -10,6 +10,7 @@ #include #include "mesh/net.h" #include "mesh/keys.h" +#include "mesh/va.h" #include "bsim_args_runner.h" #include "common/bt_str.h" @@ -24,8 +25,10 @@ LOG_MODULE_REGISTER(test_brg, LOG_LEVEL_INF); /* Bridge address must be less than DEVICE_ADDR_START */ #define BRIDGE_ADDR 0x0002 #define DEVICE_ADDR_START 0x0003 +#define GROUP_ADDR 0xc000 #define REMOTE_NODES 2 +#define REMOTE_NODES_MULTICAST 3 static const uint8_t prov_dev_key[16] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}; @@ -34,6 +37,7 @@ static const uint8_t subnet_keys[][16] = { {0xaa, 0xbb, 0xcc}, {0xdd, 0xee, 0xff}, {0x11, 0x22, 0x33}, + {0x12, 0x34, 0x56}, }; static uint8_t prov_uuid[16] = {0x6c, 0x69, 0x6e, 0x67, 0x61, 0xaa}; @@ -54,6 +58,14 @@ enum { static uint8_t recvd_msgs[10]; static uint8_t recvd_msgs_cnt; +const struct bt_mesh_va *va_entry; + +enum { + TEST_TYPE_UNICAST = 0, + TEST_TYPE_GROUP = 1, + TEST_TYPE_VA = 2, +}; + BUILD_ASSERT((2 /* opcode */ + 1 /* type */ + 1 /* msgs cnt */ + sizeof(recvd_msgs) + BT_MESH_MIC_SHORT) <= BT_MESH_RX_SDU_MAX, "Status message does not fit into the maximum incoming SDU size."); @@ -148,10 +160,11 @@ static struct bt_mesh_prov bridge_prov = { .complete = prov_complete, }; -static void tester_setup(void) +static void tester_setup(int test_type) { uint8_t status; int err; + int subnets = (test_type == TEST_TYPE_UNICAST) ? REMOTE_NODES : REMOTE_NODES_MULTICAST; ASSERT_OK(bt_mesh_cdb_create(test_net_key)); ASSERT_OK(bt_mesh_provision(test_net_key, 0, 0, test_ividx, PROV_ADDR, prov_dev_key)); @@ -168,7 +181,7 @@ static void tester_setup(void) return; } - for (int i = 0; i < REMOTE_NODES; i++) { + for (int i = 0; i < subnets; i++) { LOG_INF("Creating subnet idx %d", i); ASSERT_OK( @@ -266,7 +279,7 @@ static void tester_bridge_configure(int subnets) LOG_INF("Bridge configured"); } -static void tester_device_configure(uint16_t net_key_idx, uint16_t addr) +static void tester_device_configure(uint16_t net_key_idx, uint16_t addr, int test_type) { int err; uint8_t status; @@ -290,6 +303,25 @@ static void tester_device_configure(uint16_t net_key_idx, uint16_t addr) return; } + if (test_type == TEST_TYPE_GROUP) { + err = bt_mesh_cfg_cli_mod_sub_add(net_key_idx, addr, addr, GROUP_ADDR, TEST_MOD_ID, + &status); + if (err || status) { + FAIL("Mod sub add failed (err %d, status %u)", err, status); + return; + } + } else if (test_type == TEST_TYPE_VA) { + uint16_t vaddr; + + err = bt_mesh_cfg_cli_mod_sub_va_add(net_key_idx, addr, addr, test_va_uuid, + TEST_MOD_ID, &vaddr, &status); + if (err || status) { + FAIL("Mod sub VA add failed (err %d, status %u)", err, status); + return; + } + ASSERT_EQUAL(vaddr, va_entry->addr); + } + LOG_INF("Device 0x%04x configured", addr); } @@ -367,6 +399,12 @@ static void device_data_cb(uint8_t *data, size_t length) { uint8_t type = data[0]; + /* For group/va tests: There is no bridge entry for the subnet that the final device + * belongs to. If it receives a message from the tester, fail. + */ + ASSERT_TRUE_MSG(get_device_nbr() != REMOTE_NODES_MULTICAST + 1, + "Unbridged device received message"); + LOG_HEXDUMP_DBG(data, length, "Device received message"); switch (type) { @@ -386,8 +424,8 @@ static void device_data_cb(uint8_t *data, size_t length) memcpy(&test_data[2], recvd_msgs, recvd_msgs_cnt * sizeof(recvd_msgs[0])); ASSERT_OK(bt_mesh_test_send_data(PROV_ADDR, NULL, test_data, - 2 + recvd_msgs_cnt * sizeof(recvd_msgs[0]), NULL, - NULL)); + 2 + recvd_msgs_cnt * sizeof(recvd_msgs[0]), NULL, + NULL)); memset(recvd_msgs, 0, sizeof(recvd_msgs)); recvd_msgs_cnt = 0; @@ -406,14 +444,15 @@ static void device_data_cb(uint8_t *data, size_t length) * hit when the devices send STATUS message encrypted with the subnet key known by the tester, * but with different app key pair (app key is the same, but net key <-> app key pair is different). */ -static void tester_workaround(void) +static void tester_workaround(int test_type) { uint8_t status; int err; + int subnets = (test_type == TEST_TYPE_UNICAST) ? REMOTE_NODES : REMOTE_NODES_MULTICAST; LOG_INF("Applying subnet's workaround for tester..."); - for (int i = 0; i < REMOTE_NODES; i++) { + for (int i = 0; i < subnets; i++) { err = bt_mesh_cfg_cli_net_key_del(0, PROV_ADDR, i + 1, &status); if (err || status) { FAIL("NetKey del failed (err %d, status %u)", err, status); @@ -459,7 +498,7 @@ static void test_tester_simple(void) bt_mesh_test_cfg_set(NULL, WAIT_TIME); bt_mesh_device_setup(&tester_prov, &comp); - tester_setup(); + tester_setup(TEST_TYPE_UNICAST); for (int i = 0; i < 1 /* bridge */ + REMOTE_NODES; i++) { LOG_INF("Waiting for a device to provision..."); @@ -475,10 +514,10 @@ static void test_tester_simple(void) } for (int i = 0; i < REMOTE_NODES; i++) { - tester_device_configure(i + 1, DEVICE_ADDR_START + i); + tester_device_configure(i + 1, DEVICE_ADDR_START + i, TEST_TYPE_UNICAST); } - tester_workaround(); + tester_workaround(TEST_TYPE_UNICAST); bt_mesh_test_data_cb_setup(tester_data_cb); @@ -521,6 +560,108 @@ static void test_tester_simple(void) PASS(); } +static void tester_simple_multicast(int test_type) +{ + uint8_t status; + int err; + const int msgs_cnt = 3; + uint16_t addr = (test_type == TEST_TYPE_GROUP) ? GROUP_ADDR : va_entry->addr; + const uint8_t *uuid = (test_type == TEST_TYPE_VA) ? va_entry->uuid : NULL; + + bt_mesh_test_cfg_set(NULL, WAIT_TIME); + bt_mesh_device_setup(&tester_prov, &comp); + + tester_setup(test_type); + + for (int i = 0; i < 1 /* bridge */ + REMOTE_NODES_MULTICAST; i++) { + LOG_INF("Waiting for a device to provision..."); + ASSERT_OK(k_sem_take(&prov_sem, K_SECONDS(40))); + } + + tester_bridge_configure(REMOTE_NODES_MULTICAST); + + for (int i = 0; i < REMOTE_NODES_MULTICAST; i++) { + tester_device_configure(i + 1, DEVICE_ADDR_START + i, test_type); + } + + /* Adding devices to bridge table */ + for (int i = 0; i < REMOTE_NODES_MULTICAST; i++) { + /* Bridge messages from tester to multicast addr, for each subnet expect the last */ + if (i != REMOTE_NODES_MULTICAST - 1) { + bridge_entry_add(PROV_ADDR, addr, 0, i + 1, BT_MESH_BRG_CFG_DIR_ONEWAY); + } + + /* Bridge messages from remote nodes to tester */ + bridge_entry_add(DEVICE_ADDR_START + i, PROV_ADDR, i + 1, 0, + BT_MESH_BRG_CFG_DIR_ONEWAY); + } + + tester_workaround(test_type); + + bt_mesh_test_data_cb_setup(tester_data_cb); + + LOG_INF("Step 1: Checking bridging table..."); + + LOG_INF("Sending data..."); + + for (int i = 0; i < msgs_cnt; i++) { + ASSERT_OK(send_data(addr, i, uuid)); + } + + LOG_INF("Checking data..."); + + ASSERT_OK(send_get(addr, uuid)); + for (int i = 0; i < REMOTE_NODES_MULTICAST - 1; i++) { + ASSERT_OK(k_sem_take(&status_msg_recvd_sem, K_SECONDS(5))); + + ASSERT_EQUAL(recvd_msgs_cnt, msgs_cnt); + for (int j = 0; j < recvd_msgs_cnt; j++) { + ASSERT_EQUAL(recvd_msgs[j], j); + } + } + + LOG_INF("Step 2: Disabling bridging..."); + + err = bt_mesh_brg_cfg_cli_set(0, BRIDGE_ADDR, BT_MESH_BRG_CFG_DISABLED, &status); + if (err || status != BT_MESH_BRG_CFG_DISABLED) { + FAIL("Subnet bridge set failed (err %d) (status %u)", err, status); + return; + } + + LOG_INF("Sending data..."); + for (int i = 0; i < msgs_cnt; i++) { + ASSERT_OK(send_data(addr, i, uuid)); + } + + LOG_INF("Step 3: Enabling bridging..."); + err = bt_mesh_brg_cfg_cli_set(0, BRIDGE_ADDR, BT_MESH_BRG_CFG_ENABLED, &status); + if (err || status != BT_MESH_BRG_CFG_ENABLED) { + FAIL("Subnet bridge set failed (err %d) (status %u)", err, status); + return; + } + + LOG_INF("Checking data..."); + ASSERT_OK(send_get(addr, uuid)); + for (int i = 0; i < REMOTE_NODES_MULTICAST - 1; i++) { + ASSERT_OK(k_sem_take(&status_msg_recvd_sem, K_SECONDS(5))); + ASSERT_EQUAL(recvd_msgs_cnt, 0); + } +} + +static void test_tester_simple_group(void) +{ + tester_simple_multicast(TEST_TYPE_GROUP); + PASS(); +} + +static void test_tester_simple_va(void) +{ + ASSERT_OK(bt_mesh_va_add(test_va_uuid, &va_entry)); + ASSERT_TRUE(va_entry != NULL); + tester_simple_multicast(TEST_TYPE_VA); + PASS(); +} + static void test_tester_table_state_change(void) { int err; @@ -528,7 +669,7 @@ static void test_tester_table_state_change(void) bt_mesh_test_cfg_set(NULL, WAIT_TIME); bt_mesh_device_setup(&tester_prov, &comp); - tester_setup(); + tester_setup(TEST_TYPE_UNICAST); for (int i = 0; i < 1 /* bridge */ + REMOTE_NODES; i++) { LOG_INF("Waiting for a device to provision..."); @@ -538,10 +679,10 @@ static void test_tester_table_state_change(void) tester_bridge_configure(REMOTE_NODES); for (int i = 0; i < REMOTE_NODES; i++) { - tester_device_configure(i + 1, DEVICE_ADDR_START + i); + tester_device_configure(i + 1, DEVICE_ADDR_START + i, TEST_TYPE_UNICAST); } - tester_workaround(); + tester_workaround(TEST_TYPE_UNICAST); bt_mesh_test_data_cb_setup(tester_data_cb); @@ -625,7 +766,7 @@ static void test_tester_net_key_remove(void) bt_mesh_test_cfg_set(NULL, WAIT_TIME); bt_mesh_device_setup(&tester_prov, &comp); - tester_setup(); + tester_setup(TEST_TYPE_UNICAST); for (int i = 0; i < 1 /* bridge */ + REMOTE_NODES; i++) { LOG_INF("Waiting for a device to provision..."); @@ -635,10 +776,10 @@ static void test_tester_net_key_remove(void) tester_bridge_configure(REMOTE_NODES); for (int i = 0; i < REMOTE_NODES; i++) { - tester_device_configure(i + 1, DEVICE_ADDR_START + i); + tester_device_configure(i + 1, DEVICE_ADDR_START + i, TEST_TYPE_UNICAST); } - tester_workaround(); + tester_workaround(TEST_TYPE_UNICAST); bt_mesh_test_data_cb_setup(tester_data_cb); @@ -726,7 +867,7 @@ static void test_tester_persistence(void) }, 1); } else { - tester_setup(); + tester_setup(TEST_TYPE_UNICAST); LOG_INF("Waiting for a bridge to provision..."); ASSERT_OK(k_sem_take(&prov_sem, K_SECONDS(40))); @@ -820,7 +961,7 @@ static void test_tester_ivu(void) bt_mesh_device_setup(&tester_prov, &comp); bt_mesh_iv_update_test(true); - tester_setup(); + tester_setup(TEST_TYPE_UNICAST); for (int i = 0; i < 1 /* bridge */ + REMOTE_NODES; i++) { LOG_INF("Waiting for a device to provision..."); @@ -836,10 +977,10 @@ static void test_tester_ivu(void) } for (int i = 0; i < REMOTE_NODES; i++) { - tester_device_configure(i + 1, DEVICE_ADDR_START + i); + tester_device_configure(i + 1, DEVICE_ADDR_START + i, TEST_TYPE_UNICAST); } - tester_workaround(); + tester_workaround(TEST_TYPE_UNICAST); bt_mesh_test_data_cb_setup(tester_data_cb); @@ -964,6 +1105,12 @@ static const struct bst_test_instance test_brg[] = { TEST_CASE(tester, simple, "Tester node: provisions network, exchanges messages with " "mesh nodes"), + TEST_CASE(tester, simple_group, + "Tester node: provisions network, configures group subscription and exchanges " + "messages with mesh nodes"), + TEST_CASE(tester, simple_va, + "Tester node: provisions network, configures virtual address subscription " + "and exchanges messages with mesh nodes"), TEST_CASE(tester, table_state_change, "Tester node: tests changing bridging table " "state"), diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/bridge/brg_simple_group.sh b/tests/bsim/bluetooth/mesh/tests_scripts/bridge/brg_simple_group.sh new file mode 100755 index 0000000000000..02dc8d799a525 --- /dev/null +++ b/tests/bsim/bluetooth/mesh/tests_scripts/bridge/brg_simple_group.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +# Copyright 2024 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh + +# This test checks basic functionality of the Subnet Bridge with group addressing. It checks the +# following: +# - Messages are bridged to group address subscribers, only for subnets in the bridging table. +# - Messages are not bridged when the Subnet Bridge state is disabled. +# +# 3 roles are used in this test: Tester, Subnet Bridge node, and Mesh node. +# +# Subnets topology*: +# Tester +# | +# (subnet 0) +# | +# Subnet Bridge (bridges subnets: 0 --> 0xC000, subnets 1 and 2) +# | +# Group Address (0xC000) +# / | \ +# (subnet 1) (subnet 2) (subnet 3)** +# | | \ +# Node Node Node +# +# (*) - All nodes are in the tester's range +# (**) - Messages are not bridged to subnet 3 via the group address. If the node belonging to subnet +# 3 receives a message from the tester, the test will fail. +# +# Test procedure: +# The same procedure as in the `mesh_brg_simple` test is used. The main differences are: +# - An additional node is added to a new subnet (3). +# - Each of the nodes are subscribed to the same group address. Messages are bridged from the tester +# to the group address, only for subnets 1 and 2. +# - To allow nodes to respond to the tester, messages from each node is bridged to the tester. + +RunTest mesh_brg_simple_group \ + brg_tester_simple_group brg_bridge_simple brg_device_simple brg_device_simple \ + brg_device_simple + +overlay=overlay_psa_conf +RunTest mesh_brg_simple_group_psa \ + brg_tester_simple_group brg_bridge_simple brg_device_simple brg_device_simple \ + brg_device_simple diff --git a/tests/bsim/bluetooth/mesh/tests_scripts/bridge/brg_simple_va.sh b/tests/bsim/bluetooth/mesh/tests_scripts/bridge/brg_simple_va.sh new file mode 100755 index 0000000000000..4c061c9e388ef --- /dev/null +++ b/tests/bsim/bluetooth/mesh/tests_scripts/bridge/brg_simple_va.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +# Copyright 2024 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +source $(dirname "${BASH_SOURCE[0]}")/../../_mesh_test.sh + +# This test checks basic functionality of the Subnet Bridge with virtual addressing. It checks the +# following: +# - Messages are bridged to virtual address subscribers, only for subnets in the bridging table. +# - Messages are not bridged when the Subnet Bridge state is disabled. +# +# 3 roles are used in this test: Tester, Subnet Bridge node, and Mesh node. +# +# Subnets topology*: +# Tester +# | +# (subnet 0) +# | +# Subnet Bridge (bridges subnets 1 and 2) +# | +# Virtual Address +# / | \ +# (subnet 1) (subnet 2) (subnet 3)** +# | | \ +# Node Node Node +# +# (*) - All nodes are in the tester's range +# (**) - Messages are not bridged to subnet 3 via the virtual address. If the node belonging to +# subnet 3 receives a message from the tester, the test will fail. +# +# Test procedure: +# The same procedure as in the `mesh_brg_simple` test is used. The main differences are: +# - An additional node is added to a new subnet (3). +# - Each of the nodes are subscribed to the same virtual address. Messages are bridged from the +# tester to the virtual address, only for subnets 1 and 2. +# - To allow nodes to respond to the tester, messages from each node is bridged to the tester. + +RunTest mesh_brg_simple_va \ + brg_tester_simple_va brg_bridge_simple brg_device_simple brg_device_simple brg_device_simple + +overlay=overlay_psa_conf +RunTest mesh_brg_simple_va_psa \ + brg_tester_simple_va brg_bridge_simple brg_device_simple brg_device_simple brg_device_simple From e92323f0c4a6aa30992b9e0568d788f71f5211f2 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Tue, 19 Nov 2024 18:51:24 +0100 Subject: [PATCH 2936/4482] manifest: hal_nordic: Update to nrfx 3.9.0 See https://github.com/zephyrproject-rtos/hal_nordic/pull/257. Signed-off-by: Carles Cufi --- drivers/counter/counter_nrfx_timer.c | 2 +- west.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/counter/counter_nrfx_timer.c b/drivers/counter/counter_nrfx_timer.c index a9f0ed1d0bf02..333a436c80e46 100644 --- a/drivers/counter/counter_nrfx_timer.c +++ b/drivers/counter/counter_nrfx_timer.c @@ -70,7 +70,7 @@ static int stop(const struct device *dev) { const struct counter_nrfx_config *config = dev->config; - nrf_timer_task_trigger(config->timer, NRF_TIMER_TASK_SHUTDOWN); + nrf_timer_task_trigger(config->timer, NRF_TIMER_TASK_STOP); return 0; } diff --git a/west.yml b/west.yml index 87287fb39ac7c..d13fe29d5a2fa 100644 --- a/west.yml +++ b/west.yml @@ -188,7 +188,7 @@ manifest: groups: - hal - name: hal_nordic - revision: 2dbb2ed6cf461062bbac59a65b6e9d4576656350 + revision: 54bde38c6f6ffb3780b26ae728cf79426184384e path: modules/hal/nordic groups: - hal From 30f0d85fa0da3aa0e010d1fa5b3134c93f01d87a Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 18 Nov 2024 17:57:59 +0100 Subject: [PATCH 2937/4482] manifest: Update nRF hw models to latest Update the HW models module to: 42737c8ec8485987c7c9b0262b136de623e1ded2 Including the following: 42737c8 TIMER: Support devices without TASK_SHUTDOWN nrfx3.9 MDK 8.68 5fe6873 54 UARTE: Add frametimeout functionality dc086d7 UARTE: Add basic 54 support b046745 UARTE: Support better not having UART functionality 1c5f58c README: Mention the nRF54L15 models cover the L10 and L05 597c7d0 TEMP: Also build hal replacement for 54 and define NRF_TEMP_NS/S fb2ca83 Makefile: Let's build libraries (specially HAL) as pic 200a1e3 Makefiles: move some common options to common snippet Signed-off-by: Alberto Escolar Piedras --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index d13fe29d5a2fa..ecf7926973555 100644 --- a/west.yml +++ b/west.yml @@ -300,7 +300,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: aeef3db9fa9e4b9d12b3bbec44f9cedc8fcb7d9c + revision: 42737c8ec8485987c7c9b0262b136de623e1ded2 path: modules/bsim_hw_models/nrf_hw_models - name: open-amp revision: b735edbc739ad59156eb55bb8ce2583d74537719 From ef55d65449f8391105b3de4ca4c13514dee2039a Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 20 Nov 2024 14:13:22 +0100 Subject: [PATCH 2938/4482] manifest: Update nRF hw models to version compatible with nrfx3.9 Update the HW models module to: 3cfca0192ff84da919e9bc7978bcc2239cd6a395 This includes 2 changes: * 3cfca01 UART: Model more accurately TASKS_FLUSH behaviour * 25cbd28: 54L15: Change CLOKPOWER IRQ line (MDK 8.68, nrfx 3.9.0) WARNING! This change breaks backwards compatibility with SW which expected this line to be 270 for 54L15 devices, and therefore with MDKs < 8.68 & nrfx < 3.9.0. This change requires updating to the MDK >=8.68 and nrfx >=3.9.0 if building using the 54L15 models. 52 and 53 models are not affected. Change the CLOCK_POWER interrupt line from 270 to 261. This has changed in the latest MDK (8.68) and the new value is used in the latest nrfx (3.9.0) drivers. Signed-off-by: Alberto Escolar Piedras --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index ecf7926973555..8f691d40f74cd 100644 --- a/west.yml +++ b/west.yml @@ -300,7 +300,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: 42737c8ec8485987c7c9b0262b136de623e1ded2 + revision: 3cfca0192ff84da919e9bc7978bcc2239cd6a395 path: modules/bsim_hw_models/nrf_hw_models - name: open-amp revision: b735edbc739ad59156eb55bb8ce2583d74537719 From 4294814a23b51b8d75744f169ee02548ba2eee3c Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 20 Nov 2024 10:23:20 +0100 Subject: [PATCH 2939/4482] Bluetooth: Controller: nRF: Support MDK 8.68 TASK_SHUTDOWN was deprecated in newer SOCs and now removed in MDK 8.68 (nrfx 3.9.0) Signed-off-by: Alberto Escolar Piedras Signed-off-by: Vinayak Kariappa Chettimada --- .../bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c index f372ef667d0a0..d9ecba277aaed 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c @@ -1724,11 +1724,15 @@ uint32_t radio_tmr_start_get(void) void radio_tmr_stop(void) { nrf_timer_task_trigger(EVENT_TIMER, NRF_TIMER_TASK_STOP); +#if defined(TIMER_TASKS_SHUTDOWN_TASKS_SHUTDOWN_Msk) nrf_timer_task_trigger(EVENT_TIMER, NRF_TIMER_TASK_SHUTDOWN); +#endif #if !defined(CONFIG_BT_CTLR_TIFS_HW) nrf_timer_task_trigger(SW_SWITCH_TIMER, NRF_TIMER_TASK_STOP); +#if defined(TIMER_TASKS_SHUTDOWN_TASKS_SHUTDOWN_Msk) nrf_timer_task_trigger(SW_SWITCH_TIMER, NRF_TIMER_TASK_SHUTDOWN); +#endif #endif /* !CONFIG_BT_CTLR_TIFS_HW */ #if defined(CONFIG_SOC_COMPATIBLE_NRF54LX) From 0b3a15016bf51d950dc527611ede8bc71ed71f81 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Wed, 16 Oct 2024 21:42:12 +0200 Subject: [PATCH 2940/4482] soc: nordic: nRF54L: Consolidate common Kconfig options There are many common options to all ICs of the 54L series. Consolidate them in a single entry so that they do not need to be re-typed for each SoC series member. Signed-off-by: Carles Cufi --- soc/nordic/nrf54l/Kconfig | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/soc/nordic/nrf54l/Kconfig b/soc/nordic/nrf54l/Kconfig index 4f204c91fdb32..bdebe3a7a3dd2 100644 --- a/soc/nordic/nrf54l/Kconfig +++ b/soc/nordic/nrf54l/Kconfig @@ -9,7 +9,8 @@ config SOC_SERIES_NRF54LX select HAS_NORDIC_DRIVERS select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE -config SOC_NRF54L15_CPUAPP +config SOC_NRF54L_CPUAPP_COMMON + bool select ARM select ARMV8_M_DSP select CPU_CORTEX_M33 @@ -20,16 +21,11 @@ config SOC_NRF54L15_CPUAPP select HAS_HW_NRF_RADIO_IEEE802154 select HAS_POWEROFF +config SOC_NRF54L15_CPUAPP + select SOC_NRF54L_CPUAPP_COMMON + config SOC_NRF54L20_ENGA_CPUAPP - select ARM - select ARMV8_M_DSP - select CPU_CORTEX_M33 - select CPU_HAS_ARM_MPU - select CPU_HAS_ICACHE - select CPU_HAS_ARM_SAU - select CPU_HAS_FPU - select HAS_HW_NRF_RADIO_IEEE802154 - select HAS_POWEROFF + select SOC_NRF54L_CPUAPP_COMMON config SOC_NRF54L15_CPUFLPR depends on RISCV_CORE_NORDIC_VPR From e78832034f1ea3632524f2cbdbe290082483ddf6 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Mon, 4 Nov 2024 17:48:40 +0100 Subject: [PATCH 2941/4482] soc: nordic: Introduce the nRF54L05 and nRF54L10 These two new ICs are variants of the nRF54L15 with different memory sizes: - nRF54L05: 500KB RRAM, 96KB RAM - nRF54L10: 1022KB RRAM, 192KB RAM - nRF54L15: 1524KB RRAM, 256KB RAM Signed-off-by: Carles Cufi --- drivers/adc/adc_nrfx_saadc.c | 4 +- drivers/comparator/comparator_nrf_comp.c | 2 +- drivers/comparator/comparator_nrf_lpcomp.c | 2 +- .../nordic_vpr_launcher/nordic_vpr_launcher.c | 4 +- dts/arm/nordic/nrf54l05_cpuapp.dtsi | 8 + dts/arm/nordic/nrf54l10_cpuapp.dtsi | 8 + dts/arm/nordic/nrf54l15_cpuapp.dtsi | 82 +- dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi | 86 + dts/common/nordic/nrf54l05.dtsi | 39 + dts/common/nordic/nrf54l10.dtsi | 39 + dts/common/nordic/nrf54l15.dtsi | 750 +------ dts/common/nordic/nrf54l_05_10_15.dtsi | 734 +++++++ dts/riscv/nordic/nrf54l05_cpuflpr.dtsi | 8 + dts/riscv/nordic/nrf54l10_cpuflpr.dtsi | 8 + dts/riscv/nordic/nrf54l15_cpuflpr.dtsi | 61 +- dts/riscv/nordic/nrf54l_05_10_15_cpuflpr.dtsi | 65 + modules/hal_nordic/nrfx/CMakeLists.txt | 12 +- modules/hal_nordic/nrfx/nrfx_config.h | 8 + .../nrfx/nrfx_config_nrf54l05_application.h | 1775 ++++++++++++++++ .../nrfx/nrfx_config_nrf54l05_flpr.h | 1784 +++++++++++++++++ .../nrfx/nrfx_config_nrf54l10_application.h | 1775 ++++++++++++++++ .../nrfx/nrfx_config_nrf54l10_flpr.h | 1784 +++++++++++++++++ .../nrfx/nrfx_config_nrf54l15_application.h | 170 +- .../nrfx/nrfx_config_nrf54l15_flpr.h | 172 +- soc/nordic/nrf54l/Kconfig | 16 +- .../nrf54l/Kconfig.defconfig.nrf54l15_cpuapp | 11 - .../Kconfig.defconfig.nrf54l_05_10_15_cpuapp | 11 + ...Kconfig.defconfig.nrf54l_05_10_15_cpuflpr} | 6 +- soc/nordic/nrf54l/Kconfig.soc | 38 + soc/nordic/soc.yml | 26 + soc/nordic/validate_base_addresses.c | 2 +- tests/drivers/flash/negative_tests/src/main.c | 2 +- .../drivers/mbox/mbox_error_cases/src/main.c | 3 +- .../watchdog/wdt_error_cases/src/main.c | 3 +- tests/kernel/interrupt/src/nested_irq.c | 2 +- 35 files changed, 8561 insertions(+), 939 deletions(-) create mode 100644 dts/arm/nordic/nrf54l05_cpuapp.dtsi create mode 100644 dts/arm/nordic/nrf54l10_cpuapp.dtsi create mode 100644 dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi create mode 100644 dts/common/nordic/nrf54l05.dtsi create mode 100644 dts/common/nordic/nrf54l10.dtsi create mode 100644 dts/common/nordic/nrf54l_05_10_15.dtsi create mode 100644 dts/riscv/nordic/nrf54l05_cpuflpr.dtsi create mode 100644 dts/riscv/nordic/nrf54l10_cpuflpr.dtsi create mode 100644 dts/riscv/nordic/nrf54l_05_10_15_cpuflpr.dtsi create mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54l05_application.h create mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54l05_flpr.h create mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54l10_application.h create mode 100644 modules/hal_nordic/nrfx/nrfx_config_nrf54l10_flpr.h delete mode 100644 soc/nordic/nrf54l/Kconfig.defconfig.nrf54l15_cpuapp create mode 100644 soc/nordic/nrf54l/Kconfig.defconfig.nrf54l_05_10_15_cpuapp rename soc/nordic/nrf54l/{Kconfig.defconfig.nrf54l15_cpuflpr => Kconfig.defconfig.nrf54l_05_10_15_cpuflpr} (52%) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index b8782d0245483..c5b68f564a825 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -31,7 +31,7 @@ static const uint8_t saadc_psels[NRF_SAADC_AIN7 + 1] = { [NRF_SAADC_AIN6] = NRF_PIN_PORT_TO_PIN_NUMBER(6U, 1), [NRF_SAADC_AIN7] = NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1), }; -#elif defined(CONFIG_SOC_NRF54L15) +#elif defined(CONFIG_SOC_NRF54L05) || defined(CONFIG_SOC_NRF54L10) || defined(CONFIG_SOC_NRF54L15) static const uint32_t saadc_psels[NRF_SAADC_DVDD + 1] = { [NRF_SAADC_AIN0] = NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1), [NRF_SAADC_AIN1] = NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1), @@ -667,7 +667,7 @@ static const struct adc_driver_api adc_nrfx_driver_api = { #ifdef CONFIG_ADC_ASYNC .read_async = adc_nrfx_read_async, #endif -#if defined(CONFIG_SOC_NRF54L15) +#if defined(CONFIG_SOC_NRF54L05) || defined(CONFIG_SOC_NRF54L10) || defined(CONFIG_SOC_NRF54L15) .ref_internal = 900, #elif defined(CONFIG_NRF_PLATFORM_HALTIUM) .ref_internal = 1024, diff --git a/drivers/comparator/comparator_nrf_comp.c b/drivers/comparator/comparator_nrf_comp.c index 339d24f8dcdab..383b852fc33fa 100644 --- a/drivers/comparator/comparator_nrf_comp.c +++ b/drivers/comparator/comparator_nrf_comp.c @@ -78,7 +78,7 @@ static const uint32_t shim_nrf_comp_ain_map[] = { NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1), NRF_PIN_PORT_TO_PIN_NUMBER(6U, 1), NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1), -#elif defined(CONFIG_SOC_NRF54L15) +#elif defined(CONFIG_SOC_NRF54L05) || defined(CONFIG_SOC_NRF54L10) || defined(CONFIG_SOC_NRF54L15) NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1), NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1), NRF_PIN_PORT_TO_PIN_NUMBER(6U, 1), diff --git a/drivers/comparator/comparator_nrf_lpcomp.c b/drivers/comparator/comparator_nrf_lpcomp.c index 6c6710d337d86..cfb64bccf2754 100644 --- a/drivers/comparator/comparator_nrf_lpcomp.c +++ b/drivers/comparator/comparator_nrf_lpcomp.c @@ -49,7 +49,7 @@ static const uint32_t shim_nrf_lpcomp_ain_map[] = { NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1), NRF_PIN_PORT_TO_PIN_NUMBER(6U, 1), NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1), -#elif defined(CONFIG_SOC_NRF54L15) +#elif defined(CONFIG_SOC_NRF54L05) || defined(CONFIG_SOC_NRF54L10) || defined(CONFIG_SOC_NRF54L15) NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1), NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1), NRF_PIN_PORT_TO_PIN_NUMBER(6U, 1), diff --git a/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c b/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c index c688a97f65458..2c2915a798438 100644 --- a/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c +++ b/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c @@ -14,7 +14,7 @@ #include #include -#if defined(CONFIG_SOC_NRF54L15_CPUAPP) && !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) +#if defined(CONFIG_SOC_NRF54L_CPUAPP_COMMON) && !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) #include #endif @@ -41,7 +41,7 @@ static int nordic_vpr_launcher_init(const struct device *dev) } #endif -#if defined(CONFIG_SOC_NRF54L15_CPUAPP) && !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) +#if defined(CONFIG_SOC_NRF54L_CPUAPP_COMMON) && !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) nrf_spu_periph_perm_secattr_set(NRF_SPU00, nrf_address_slave_get((uint32_t)config->vpr), true); #endif diff --git a/dts/arm/nordic/nrf54l05_cpuapp.dtsi b/dts/arm/nordic/nrf54l05_cpuapp.dtsi new file mode 100644 index 0000000000000..45bdfea1f9c66 --- /dev/null +++ b/dts/arm/nordic/nrf54l05_cpuapp.dtsi @@ -0,0 +1,8 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include "nrf54l_05_10_15_cpuapp.dtsi" diff --git a/dts/arm/nordic/nrf54l10_cpuapp.dtsi b/dts/arm/nordic/nrf54l10_cpuapp.dtsi new file mode 100644 index 0000000000000..cf8bc6ab5ea02 --- /dev/null +++ b/dts/arm/nordic/nrf54l10_cpuapp.dtsi @@ -0,0 +1,8 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include "nrf54l_05_10_15_cpuapp.dtsi" diff --git a/dts/arm/nordic/nrf54l15_cpuapp.dtsi b/dts/arm/nordic/nrf54l15_cpuapp.dtsi index 458d5a2e12acb..59ffca714dd65 100644 --- a/dts/arm/nordic/nrf54l15_cpuapp.dtsi +++ b/dts/arm/nordic/nrf54l15_cpuapp.dtsi @@ -5,84 +5,4 @@ */ #include - -cpu: &cpuapp {}; -systick: &cpuapp_systick {}; -nvic: &cpuapp_nvic {}; - -/delete-node/ &cpuflpr; -/delete-node/ &cpuflpr_rram; -/delete-node/ &cpuflpr_sram; -/delete-node/ &cpuflpr_clic; - -/ { - chosen { - zephyr,bt-hci = &bt_hci_controller; - }; - - soc { - compatible = "simple-bus"; - interrupt-parent = <&cpuapp_nvic>; - ranges; - }; - - psa_rng: psa-rng { - compatible = "zephyr,psa-crypto-rng"; - status = "disabled"; - }; -}; - -&bt_hci_controller { - status = "okay"; -}; - -&cpuflpr_vpr { - cpuapp_vevif_rx: mailbox@1 { - compatible = "nordic,nrf-vevif-event-rx"; - reg = <0x0 0x1000>; - status = "disabled"; - interrupts = <76 NRF_DEFAULT_IRQ_PRIORITY>; - #mbox-cells = <1>; - nordic,events = <1>; - nordic,events-mask = <0x00100000>; - }; - - cpuapp_vevif_tx: mailbox@0 { - compatible = "nordic,nrf-vevif-task-tx"; - reg = <0x0 0x1000>; - #mbox-cells = <1>; - nordic,tasks = <7>; - nordic,tasks-mask = <0x007f0000>; - status = "disabled"; - }; -}; - -&cpuapp_ppb { - compatible = "simple-bus"; - ranges; -}; - -&grtc { -#ifdef USE_NON_SECURE_ADDRESS_MAP - interrupts = <227 NRF_DEFAULT_IRQ_PRIORITY>, -#else - interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>, -#endif - <229 NRF_DEFAULT_IRQ_PRIORITY>; /* reserved for Zero Latency IRQs */ -}; - -&gpiote20 { -#ifdef USE_NON_SECURE_ADDRESS_MAP - interrupts = <218 NRF_DEFAULT_IRQ_PRIORITY>; -#else - interrupts = <219 NRF_DEFAULT_IRQ_PRIORITY>; -#endif -}; - -&gpiote30 { -#ifdef USE_NON_SECURE_ADDRESS_MAP - interrupts = <268 NRF_DEFAULT_IRQ_PRIORITY>; -#else - interrupts = <269 NRF_DEFAULT_IRQ_PRIORITY>; -#endif -}; +#include "nrf54l_05_10_15_cpuapp.dtsi" diff --git a/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi new file mode 100644 index 0000000000000..33b0d2cd4536a --- /dev/null +++ b/dts/arm/nordic/nrf54l_05_10_15_cpuapp.dtsi @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +cpu: &cpuapp {}; +systick: &cpuapp_systick {}; +nvic: &cpuapp_nvic {}; + +/delete-node/ &cpuflpr; +/delete-node/ &cpuflpr_rram; +/delete-node/ &cpuflpr_sram; +/delete-node/ &cpuflpr_clic; + +/ { + chosen { + zephyr,bt-hci = &bt_hci_controller; + }; + + soc { + compatible = "simple-bus"; + interrupt-parent = <&cpuapp_nvic>; + ranges; + }; + + psa_rng: psa-rng { + compatible = "zephyr,psa-crypto-rng"; + status = "disabled"; + }; +}; + +&bt_hci_controller { + status = "okay"; +}; + +&cpuflpr_vpr { + cpuapp_vevif_rx: mailbox@1 { + compatible = "nordic,nrf-vevif-event-rx"; + reg = <0x0 0x1000>; + status = "disabled"; + interrupts = <76 NRF_DEFAULT_IRQ_PRIORITY>; + #mbox-cells = <1>; + nordic,events = <1>; + nordic,events-mask = <0x00100000>; + }; + + cpuapp_vevif_tx: mailbox@0 { + compatible = "nordic,nrf-vevif-task-tx"; + reg = <0x0 0x1000>; + #mbox-cells = <1>; + nordic,tasks = <7>; + nordic,tasks-mask = <0x007f0000>; + status = "disabled"; + }; +}; + +&cpuapp_ppb { + compatible = "simple-bus"; + ranges; +}; + +&grtc { +#ifdef USE_NON_SECURE_ADDRESS_MAP + interrupts = <227 NRF_DEFAULT_IRQ_PRIORITY>, +#else + interrupts = <228 NRF_DEFAULT_IRQ_PRIORITY>, +#endif + <229 NRF_DEFAULT_IRQ_PRIORITY>; /* reserved for Zero Latency IRQs */ +}; + +&gpiote20 { +#ifdef USE_NON_SECURE_ADDRESS_MAP + interrupts = <218 NRF_DEFAULT_IRQ_PRIORITY>; +#else + interrupts = <219 NRF_DEFAULT_IRQ_PRIORITY>; +#endif +}; + +&gpiote30 { +#ifdef USE_NON_SECURE_ADDRESS_MAP + interrupts = <268 NRF_DEFAULT_IRQ_PRIORITY>; +#else + interrupts = <269 NRF_DEFAULT_IRQ_PRIORITY>; +#endif +}; diff --git a/dts/common/nordic/nrf54l05.dtsi b/dts/common/nordic/nrf54l05.dtsi new file mode 100644 index 0000000000000..747fea0c54983 --- /dev/null +++ b/dts/common/nordic/nrf54l05.dtsi @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54l_05_10_15.dtsi" + +&cpuapp_sram { + reg = <0x20000000 DT_SIZE_K(72)>; + ranges = <0x0 0x20000000 DT_SIZE_K(72)>; +}; + +/* 72 + 24 = 96KB */ +/ { + soc { + cpuflpr_sram: memory@20012000 { + compatible = "mmio-sram"; + reg = <0x20012000 DT_SIZE_K(24)>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x20012000 DT_SIZE_K(24)>; + }; + }; +}; + +&cpuapp_rram { + reg = <0x0 DT_SIZE_K(470)>; +}; + +/* 470 + 30 = 500KB */ +&rram_controller { + cpuflpr_rram: rram@75800 { + compatible = "soc-nv-flash"; + reg = <0x75800 DT_SIZE_K(30)>; + erase-block-size = <4096>; + write-block-size = <16>; + }; +}; diff --git a/dts/common/nordic/nrf54l10.dtsi b/dts/common/nordic/nrf54l10.dtsi new file mode 100644 index 0000000000000..a515fbb42f531 --- /dev/null +++ b/dts/common/nordic/nrf54l10.dtsi @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54l_05_10_15.dtsi" + +&cpuapp_sram { + reg = <0x20000000 DT_SIZE_K(144)>; + ranges = <0x0 0x20000000 DT_SIZE_K(144)>; +}; + +/* 144 + 48 = 192KB */ +/ { + soc { + cpuflpr_sram: memory@20024000 { + compatible = "mmio-sram"; + reg = <0x20024000 DT_SIZE_K(48)>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x20024000 DT_SIZE_K(48)>; + }; + }; +}; + +&cpuapp_rram { + reg = <0x0 DT_SIZE_K(960)>; +}; + +/* 960 + 62 = 1022KB */ +&rram_controller { + cpuflpr_rram: rram@f0000 { + compatible = "soc-nv-flash"; + reg = <0xf0000 DT_SIZE_K(62)>; + erase-block-size = <4096>; + write-block-size = <16>; + }; +}; diff --git a/dts/common/nordic/nrf54l15.dtsi b/dts/common/nordic/nrf54l15.dtsi index 5a49efd468d33..56c97ae87acfc 100644 --- a/dts/common/nordic/nrf54l15.dtsi +++ b/dts/common/nordic/nrf54l15.dtsi @@ -4,748 +4,36 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include -#include -#include -#include +#include "nrf54l_05_10_15.dtsi" -/delete-node/ &sw_pwm; - -/* Domain IDs. Can be used to specify channel links in IPCT nodes. */ -#define NRF_DOMAIN_ID_APPLICATION 0 -#define NRF_DOMAIN_ID_FLPR 1 +&cpuapp_sram { + reg = <0x20000000 DT_SIZE_K(188)>; + ranges = <0x0 0x20000000 DT_SIZE_K(188)>; +}; +/* 188 + 68 = 256KB */ / { - #address-cells = <1>; - #size-cells = <1>; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpuapp: cpu@0 { - compatible = "arm,cortex-m33f"; - reg = <0>; - device_type = "cpu"; - clock-frequency = ; - #address-cells = <1>; - #size-cells = <1>; - itm: itm@e0000000 { - compatible = "arm,armv8m-itm"; - reg = <0xe0000000 0x1000>; - swo-ref-frequency = ; - }; - }; - - cpuflpr: cpu@1 { - compatible = "nordic,vpr"; - reg = <1>; - device_type = "cpu"; - clock-frequency = ; - riscv,isa = "rv32emc"; - nordic,bus-width = <32>; - }; - }; - - clocks { - lfxo: lfxo { - compatible = "nordic,nrf-lfxo"; - #clock-cells = <0>; - clock-frequency = <32768>; - }; - - hfxo: hfxo { - compatible = "nordic,nrf-hfxo"; - #clock-cells = <0>; - clock-frequency = ; - }; - }; - soc { - #address-cells = <1>; - #size-cells = <1>; - -#ifdef USE_NON_SECURE_ADDRESS_MAP - /* intentionally empty because UICR is hardware fixed to Secure */ -#else - uicr: uicr@ffd000 { - compatible = "nordic,nrf-uicr"; - reg = <0xffd000 0x1000>; - }; -#endif - ficr: ficr@ffc000 { - compatible = "nordic,nrf-ficr"; - reg = <0xffc000 0x1000>; - #nordic,ficr-cells = <1>; - }; - - cpuapp_sram: memory@20000000 { - compatible = "mmio-sram"; - reg = <0x20000000 DT_SIZE_K(188)>; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x20000000 0x2f000>; - }; - cpuflpr_sram: memory@2002f000 { compatible = "mmio-sram"; reg = <0x2002f000 DT_SIZE_K(68)>; #address-cells = <1>; #size-cells = <1>; - ranges = <0x0 0x2002f000 0x11000>; + ranges = <0x0 0x2002f000 DT_SIZE_K(68)>; }; + }; +}; -#ifdef USE_NON_SECURE_ADDRESS_MAP - global_peripherals: peripheral@40000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x40000000 0x10000000>; -#else - global_peripherals: peripheral@50000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x50000000 0x10000000>; -#endif - - dppic00: dppic@42000 { - compatible = "nordic,nrf-dppic"; - reg = <0x42000 0x808>; - status = "disabled"; - }; - - ppib00: ppib@43000 { - compatible = "nordic,nrf-ppib"; - reg = <0x43000 0x1000>; - status = "disabled"; - }; - - ppib01: ppib@44000 { - compatible = "nordic,nrf-ppib"; - reg = <0x44000 0x1000>; - status = "disabled"; - }; - - spi00: spi@4a000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x4a000 0x1000>; - interrupts = <74 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart00: uart@4a000 { - compatible = "nordic,nrf-uarte"; - reg = <0x4a000 0x1000>; - interrupts = <74 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - cpuflpr_vpr: vpr@4c000 { - compatible = "nordic,nrf-vpr-coprocessor"; - reg = <0x4c000 0x1000>; - ranges = <0x0 0x4c000 0x1000>; - #address-cells = <1>; - #size-cells = <1>; - status = "disabled"; - - cpuflpr_clic: interrupt-controller@f0000000 { - compatible = "nordic,nrf-clic"; - reg = <0xf0000000 0x1780>; - interrupt-controller; - #interrupt-cells = <2>; - #address-cells = <1>; - status = "disabled"; - }; - }; - - gpio2: gpio@50400 { - compatible = "nordic,nrf-gpio"; - gpio-controller; - reg = <0x50400 0x300>; - #gpio-cells = <2>; - ngpios = <11>; - status = "disabled"; - port = <2>; - }; - - timer00: timer@55000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0x55000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <85 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - prescaler = <0>; - }; - - dppic10: dppic@82000 { - compatible = "nordic,nrf-dppic"; - reg = <0x82000 0x808>; - status = "disabled"; - }; - - ppib10: ppib@83000 { - compatible = "nordic,nrf-ppib"; - reg = <0x83000 0x1000>; - status = "disabled"; - }; - - ppib11: ppib@84000 { - compatible = "nordic,nrf-ppib"; - reg = <0x84000 0x1000>; - status = "disabled"; - }; - - timer10: timer@85000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0x85000 0x1000>; - cc-num = <8>; - max-bit-width = <32>; - interrupts = <133 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - prescaler = <0>; - }; - - egu10: egu@87000 { - compatible = "nordic,nrf-egu"; - reg = <0x87000 0x1000>; - interrupts = <135 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - radio: radio@8a000 { - compatible = "nordic,nrf-radio"; - reg = <0x8a000 0x1000>; - interrupts = <138 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - dfe-supported; - ieee802154-supported; - ble-2mbps-supported; - ble-coded-phy-supported; - cs-supported; - - ieee802154: ieee802154 { - compatible = "nordic,nrf-ieee802154"; - status = "disabled"; - }; - - /* Note: In the nRF Connect SDK the SoftDevice Controller - * is added and set as the default Bluetooth Controller. - */ - bt_hci_controller: bt_hci_controller { - compatible = "zephyr,bt-hci-ll-sw-split"; - status = "disabled"; - }; - }; - - dppic20: dppic@c2000 { - compatible = "nordic,nrf-dppic"; - reg = <0xc2000 0x808>; - status = "disabled"; - }; - - ppib20: ppib@c3000 { - compatible = "nordic,nrf-ppib"; - reg = <0xc3000 0x1000>; - status = "disabled"; - }; - - ppib21: ppib@c4000 { - compatible = "nordic,nrf-ppib"; - reg = <0xc4000 0x1000>; - status = "disabled"; - }; - - ppib22: ppib@c5000 { - compatible = "nordic,nrf-ppib"; - reg = <0xc5000 0x1000>; - status = "disabled"; - }; - - i2c20: i2c@c6000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc6000 0x1000>; - interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi20: spi@c6000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc6000 0x1000>; - interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart20: uart@c6000 { - compatible = "nordic,nrf-uarte"; - reg = <0xc6000 0x1000>; - interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - i2c21: i2c@c7000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc7000 0x1000>; - interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi21: spi@c7000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc7000 0x1000>; - interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart21: uart@c7000 { - compatible = "nordic,nrf-uarte"; - reg = <0xc7000 0x1000>; - interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - i2c22: i2c@c8000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc8000 0x1000>; - interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi22: spi@c8000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xc8000 0x1000>; - interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart22: uart@c8000 { - compatible = "nordic,nrf-uarte"; - reg = <0xc8000 0x1000>; - interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - egu20: egu@c9000 { - compatible = "nordic,nrf-egu"; - reg = <0xc9000 0x1000>; - interrupts = <201 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - timer20: timer@ca000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xca000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <202 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - timer21: timer@cb000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xcb000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <203 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - timer22: timer@cc000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xcc000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <204 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - timer23: timer@cd000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xcd000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <205 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - timer24: timer@ce000 { - compatible = "nordic,nrf-timer"; - status = "disabled"; - reg = <0xce000 0x1000>; - cc-num = <6>; - max-bit-width = <32>; - interrupts = <206 NRF_DEFAULT_IRQ_PRIORITY>; - prescaler = <0>; - }; - - pdm20: pdm@d0000 { - compatible = "nordic,nrf-pdm"; - status = "disabled"; - reg = <0xd0000 0x1000>; - interrupts = <208 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - pdm21: pdm@d1000 { - compatible = "nordic,nrf-pdm"; - status = "disabled"; - reg = <0xd1000 0x1000>; - interrupts = <209 NRF_DEFAULT_IRQ_PRIORITY>; - }; - - pwm20: pwm@d2000 { - compatible = "nordic,nrf-pwm"; - status = "disabled"; - reg = <0xd2000 0x1000>; - interrupts = <210 NRF_DEFAULT_IRQ_PRIORITY>; - #pwm-cells = <3>; - }; - - pwm21: pwm@d3000 { - compatible = "nordic,nrf-pwm"; - status = "disabled"; - reg = <0xd3000 0x1000>; - interrupts = <211 NRF_DEFAULT_IRQ_PRIORITY>; - #pwm-cells = <3>; - }; - - pwm22: pwm@d4000 { - compatible = "nordic,nrf-pwm"; - status = "disabled"; - reg = <0xd4000 0x1000>; - interrupts = <212 NRF_DEFAULT_IRQ_PRIORITY>; - #pwm-cells = <3>; - }; - - adc: adc@d5000 { - compatible = "nordic,nrf-saadc"; - reg = <0xd5000 0x1000>; - interrupts = <213 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - #io-channel-cells = <1>; - }; - - nfct: nfct@d6000 { - compatible = "nordic,nrf-nfct"; - reg = <0xd6000 0x1000>; - interrupts = <214 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - temp: temp@d7000 { - compatible = "nordic,nrf-temp"; - reg = <0xd7000 0x1000>; - interrupts = <215 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - gpio1: gpio@d8200 { - compatible = "nordic,nrf-gpio"; - gpio-controller; - reg = <0xd8200 0x300>; - #gpio-cells = <2>; - ngpios = <16>; - status = "disabled"; - port = <1>; - gpiote-instance = <&gpiote20>; - }; - - gpiote20: gpiote@da000 { - compatible = "nordic,nrf-gpiote"; - reg = <0xda000 0x1000>; - status = "disabled"; - instance = <20>; - }; - - i2s20: i2s@dd000 { - compatible = "nordic,nrf-i2s"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0xdd000 0x1000>; - interrupts = <221 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - qdec20: qdec@e0000 { - compatible = "nordic,nrf-qdec"; - reg = <0xe0000 0x1000>; - interrupts = <224 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - qdec21: qdec@e1000 { - compatible = "nordic,nrf-qdec"; - reg = <0xe1000 0x1000>; - interrupts = <225 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - grtc: grtc@e2000 { - compatible = "nordic,nrf-grtc"; - reg = <0xe2000 0x1000>; - cc-num = <12>; - status = "disabled"; - }; - - dppic30: dppic@102000 { - compatible = "nordic,nrf-dppic"; - reg = <0x102000 0x808>; - status = "disabled"; - }; - - ppib30: ppib@103000 { - compatible = "nordic,nrf-ppib"; - reg = <0x103000 0x1000>; - status = "disabled"; - }; - - i2c30: i2c@104000 { - compatible = "nordic,nrf-twim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x104000 0x1000>; - interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; - easydma-maxcnt-bits = <16>; - status = "disabled"; - zephyr,pm-device-runtime-auto; - }; - - spi30: spi@104000 { - /* - * This spi node can be either SPIM or SPIS, - * for the user to pick: - * compatible = "nordic,nrf-spim" or - * "nordic,nrf-spis". - */ - compatible = "nordic,nrf-spim"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x104000 0x1000>; - interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; - max-frequency = ; - easydma-maxcnt-bits = <16>; - rx-delay-supported; - rx-delay = <1>; - status = "disabled"; - }; - - uart30: uart@104000 { - compatible = "nordic,nrf-uarte"; - reg = <0x104000 0x1000>; - interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - endtx-stoptx-supported; - frame-timeout-supported; - }; - - comp: comparator@106000 { - /* - * Use compatible "nordic,nrf-comp" to configure as COMP - * Use compatible "nordic,nrf-lpcomp" to configure as LPCOMP - */ - compatible = "nordic,nrf-comp"; - reg = <0x106000 0x1000>; - status = "disabled"; - interrupts = <262 NRF_DEFAULT_IRQ_PRIORITY>; - }; - -#ifdef USE_NON_SECURE_ADDRESS_MAP - /* intentionally empty because WDT30 is hardware fixed to Secure */ -#else - wdt30: watchdog@108000 { - compatible = "nordic,nrf-wdt"; - reg = <0x108000 0x620>; - interrupts = <264 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; -#endif - - wdt31: watchdog@109000 { - compatible = "nordic,nrf-wdt"; - reg = <0x109000 0x620>; - interrupts = <265 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - gpio0: gpio@10a000 { - compatible = "nordic,nrf-gpio"; - gpio-controller; - reg = <0x10a000 0x300>; - #gpio-cells = <2>; - ngpios = <5>; - status = "disabled"; - port = <0>; - gpiote-instance = <&gpiote30>; - }; - - gpiote30: gpiote@10c000 { - compatible = "nordic,nrf-gpiote"; - reg = <0x10c000 0x1000>; - status = "disabled"; - instance = <30>; - }; - - clock: clock@10e000 { - compatible = "nordic,nrf-clock"; - reg = <0x10e000 0x1000>; - interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - }; - - power: power@10e000 { - compatible = "nordic,nrf-power"; - reg = <0x10e000 0x1000>; - ranges = <0x0 0x10e000 0x1000>; - interrupts = <270 NRF_DEFAULT_IRQ_PRIORITY>; - status = "disabled"; - #address-cells = <1>; - #size-cells = <1>; - - gpregret1: gpregret1@51c { - #address-cells = <1>; - #size-cells = <1>; - compatible = "nordic,nrf-gpregret"; - reg = <0x51c 0x1>; - status = "disabled"; - }; - - gpregret2: gpregret2@520 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "nordic,nrf-gpregret"; - reg = <0x520 0x1>; - status = "disabled"; - }; - }; - - regulators: regulator@120000 { - compatible = "nordic,nrf54l-regulators"; - reg = <0x120000 0x1000>; - status = "disabled"; - #address-cells = <1>; - #size-cells = <1>; - - vregmain: regulator@120600 { - compatible = "nordic,nrf5x-regulator"; - reg = <0x120600 0x1>; - status = "disabled"; - regulator-name = "VREGMAIN"; - regulator-initial-mode = ; - }; - }; - }; - - rram_controller: rram-controller@5004b000 { - compatible = "nordic,rram-controller"; - reg = <0x5004b000 0x1000>; - #address-cells = <1>; - #size-cells = <1>; - interrupts = <75 NRF_DEFAULT_IRQ_PRIORITY>; - - cpuapp_rram: rram@0 { - compatible = "soc-nv-flash"; - reg = <0x0 DT_SIZE_K(1428)>; - erase-block-size = <4096>; - write-block-size = <16>; - }; - cpuflpr_rram: rram@165000 { - compatible = "soc-nv-flash"; - reg = <0x165000 DT_SIZE_K(96)>; - erase-block-size = <4096>; - write-block-size = <16>; - }; - }; - - cpuapp_ppb: cpuapp-ppb-bus { - #address-cells = <1>; - #size-cells = <1>; - - cpuapp_nvic: interrupt-controller@e000e100 { - #address-cells = <1>; - compatible = "arm,v8m-nvic"; - reg = <0xe000e100 0xc00>; - arm,num-irq-priority-bits = <3>; - interrupt-controller; - #interrupt-cells = <2>; - }; +&cpuapp_rram { + reg = <0x0 DT_SIZE_K(1428)>; +}; - cpuapp_systick: timer@e000e010 { - compatible = "arm,armv8m-systick"; - reg = <0xe000e010 0x10>; - status = "disabled"; - }; - }; +/* 1428 + 96 = 1524KB */ +&rram_controller { + cpuflpr_rram: rram@165000 { + compatible = "soc-nv-flash"; + reg = <0x165000 DT_SIZE_K(96)>; + erase-block-size = <4096>; + write-block-size = <16>; }; }; diff --git a/dts/common/nordic/nrf54l_05_10_15.dtsi b/dts/common/nordic/nrf54l_05_10_15.dtsi new file mode 100644 index 0000000000000..04fae0272bc89 --- /dev/null +++ b/dts/common/nordic/nrf54l_05_10_15.dtsi @@ -0,0 +1,734 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +/delete-node/ &sw_pwm; + +/* Domain IDs. Can be used to specify channel links in IPCT nodes. */ +#define NRF_DOMAIN_ID_APPLICATION 0 +#define NRF_DOMAIN_ID_FLPR 1 + +/ { + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpuapp: cpu@0 { + compatible = "arm,cortex-m33f"; + reg = <0>; + device_type = "cpu"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <1>; + itm: itm@e0000000 { + compatible = "arm,armv8m-itm"; + reg = <0xe0000000 0x1000>; + swo-ref-frequency = ; + }; + }; + + cpuflpr: cpu@1 { + compatible = "nordic,vpr"; + reg = <1>; + device_type = "cpu"; + clock-frequency = ; + riscv,isa = "rv32emc"; + nordic,bus-width = <32>; + }; + }; + + clocks { + lfxo: lfxo { + compatible = "nordic,nrf-lfxo"; + #clock-cells = <0>; + clock-frequency = <32768>; + }; + + hfxo: hfxo { + compatible = "nordic,nrf-hfxo"; + #clock-cells = <0>; + clock-frequency = ; + }; + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + +#ifdef USE_NON_SECURE_ADDRESS_MAP + /* intentionally empty because UICR is hardware fixed to Secure */ +#else + uicr: uicr@ffd000 { + compatible = "nordic,nrf-uicr"; + reg = <0xffd000 0x1000>; + }; +#endif + ficr: ficr@ffc000 { + compatible = "nordic,nrf-ficr"; + reg = <0xffc000 0x1000>; + #nordic,ficr-cells = <1>; + }; + + cpuapp_sram: memory@20000000 { + compatible = "mmio-sram"; + #address-cells = <1>; + #size-cells = <1>; + }; + +#ifdef USE_NON_SECURE_ADDRESS_MAP + global_peripherals: peripheral@40000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x40000000 0x10000000>; +#else + global_peripherals: peripheral@50000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x50000000 0x10000000>; +#endif + + dppic00: dppic@42000 { + compatible = "nordic,nrf-dppic"; + reg = <0x42000 0x808>; + status = "disabled"; + }; + + ppib00: ppib@43000 { + compatible = "nordic,nrf-ppib"; + reg = <0x43000 0x1000>; + status = "disabled"; + }; + + ppib01: ppib@44000 { + compatible = "nordic,nrf-ppib"; + reg = <0x44000 0x1000>; + status = "disabled"; + }; + + spi00: spi@4a000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x4a000 0x1000>; + interrupts = <74 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart00: uart@4a000 { + compatible = "nordic,nrf-uarte"; + reg = <0x4a000 0x1000>; + interrupts = <74 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + cpuflpr_vpr: vpr@4c000 { + compatible = "nordic,nrf-vpr-coprocessor"; + reg = <0x4c000 0x1000>; + ranges = <0x0 0x4c000 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + status = "disabled"; + + cpuflpr_clic: interrupt-controller@f0000000 { + compatible = "nordic,nrf-clic"; + reg = <0xf0000000 0x1780>; + interrupt-controller; + #interrupt-cells = <2>; + #address-cells = <1>; + status = "disabled"; + }; + }; + + gpio2: gpio@50400 { + compatible = "nordic,nrf-gpio"; + gpio-controller; + reg = <0x50400 0x300>; + #gpio-cells = <2>; + ngpios = <11>; + status = "disabled"; + port = <2>; + }; + + timer00: timer@55000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0x55000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <85 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + prescaler = <0>; + }; + + dppic10: dppic@82000 { + compatible = "nordic,nrf-dppic"; + reg = <0x82000 0x808>; + status = "disabled"; + }; + + ppib10: ppib@83000 { + compatible = "nordic,nrf-ppib"; + reg = <0x83000 0x1000>; + status = "disabled"; + }; + + ppib11: ppib@84000 { + compatible = "nordic,nrf-ppib"; + reg = <0x84000 0x1000>; + status = "disabled"; + }; + + timer10: timer@85000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0x85000 0x1000>; + cc-num = <8>; + max-bit-width = <32>; + interrupts = <133 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + prescaler = <0>; + }; + + egu10: egu@87000 { + compatible = "nordic,nrf-egu"; + reg = <0x87000 0x1000>; + interrupts = <135 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + radio: radio@8a000 { + compatible = "nordic,nrf-radio"; + reg = <0x8a000 0x1000>; + interrupts = <138 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + dfe-supported; + ieee802154-supported; + ble-2mbps-supported; + ble-coded-phy-supported; + cs-supported; + + ieee802154: ieee802154 { + compatible = "nordic,nrf-ieee802154"; + status = "disabled"; + }; + + /* Note: In the nRF Connect SDK the SoftDevice Controller + * is added and set as the default Bluetooth Controller. + */ + bt_hci_controller: bt_hci_controller { + compatible = "zephyr,bt-hci-ll-sw-split"; + status = "disabled"; + }; + }; + + dppic20: dppic@c2000 { + compatible = "nordic,nrf-dppic"; + reg = <0xc2000 0x808>; + status = "disabled"; + }; + + ppib20: ppib@c3000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc3000 0x1000>; + status = "disabled"; + }; + + ppib21: ppib@c4000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc4000 0x1000>; + status = "disabled"; + }; + + ppib22: ppib@c5000 { + compatible = "nordic,nrf-ppib"; + reg = <0xc5000 0x1000>; + status = "disabled"; + }; + + i2c20: i2c@c6000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc6000 0x1000>; + interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi20: spi@c6000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc6000 0x1000>; + interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart20: uart@c6000 { + compatible = "nordic,nrf-uarte"; + reg = <0xc6000 0x1000>; + interrupts = <198 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + i2c21: i2c@c7000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc7000 0x1000>; + interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi21: spi@c7000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc7000 0x1000>; + interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart21: uart@c7000 { + compatible = "nordic,nrf-uarte"; + reg = <0xc7000 0x1000>; + interrupts = <199 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + i2c22: i2c@c8000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc8000 0x1000>; + interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi22: spi@c8000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xc8000 0x1000>; + interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart22: uart@c8000 { + compatible = "nordic,nrf-uarte"; + reg = <0xc8000 0x1000>; + interrupts = <200 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + egu20: egu@c9000 { + compatible = "nordic,nrf-egu"; + reg = <0xc9000 0x1000>; + interrupts = <201 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + timer20: timer@ca000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xca000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <202 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer21: timer@cb000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xcb000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <203 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer22: timer@cc000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xcc000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <204 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer23: timer@cd000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xcd000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <205 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + timer24: timer@ce000 { + compatible = "nordic,nrf-timer"; + status = "disabled"; + reg = <0xce000 0x1000>; + cc-num = <6>; + max-bit-width = <32>; + interrupts = <206 NRF_DEFAULT_IRQ_PRIORITY>; + prescaler = <0>; + }; + + pdm20: pdm@d0000 { + compatible = "nordic,nrf-pdm"; + status = "disabled"; + reg = <0xd0000 0x1000>; + interrupts = <208 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + pdm21: pdm@d1000 { + compatible = "nordic,nrf-pdm"; + status = "disabled"; + reg = <0xd1000 0x1000>; + interrupts = <209 NRF_DEFAULT_IRQ_PRIORITY>; + }; + + pwm20: pwm@d2000 { + compatible = "nordic,nrf-pwm"; + status = "disabled"; + reg = <0xd2000 0x1000>; + interrupts = <210 NRF_DEFAULT_IRQ_PRIORITY>; + #pwm-cells = <3>; + }; + + pwm21: pwm@d3000 { + compatible = "nordic,nrf-pwm"; + status = "disabled"; + reg = <0xd3000 0x1000>; + interrupts = <211 NRF_DEFAULT_IRQ_PRIORITY>; + #pwm-cells = <3>; + }; + + pwm22: pwm@d4000 { + compatible = "nordic,nrf-pwm"; + status = "disabled"; + reg = <0xd4000 0x1000>; + interrupts = <212 NRF_DEFAULT_IRQ_PRIORITY>; + #pwm-cells = <3>; + }; + + adc: adc@d5000 { + compatible = "nordic,nrf-saadc"; + reg = <0xd5000 0x1000>; + interrupts = <213 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + #io-channel-cells = <1>; + }; + + nfct: nfct@d6000 { + compatible = "nordic,nrf-nfct"; + reg = <0xd6000 0x1000>; + interrupts = <214 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + temp: temp@d7000 { + compatible = "nordic,nrf-temp"; + reg = <0xd7000 0x1000>; + interrupts = <215 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + gpio1: gpio@d8200 { + compatible = "nordic,nrf-gpio"; + gpio-controller; + reg = <0xd8200 0x300>; + #gpio-cells = <2>; + ngpios = <16>; + status = "disabled"; + port = <1>; + gpiote-instance = <&gpiote20>; + }; + + gpiote20: gpiote@da000 { + compatible = "nordic,nrf-gpiote"; + reg = <0xda000 0x1000>; + status = "disabled"; + instance = <20>; + }; + + i2s20: i2s@dd000 { + compatible = "nordic,nrf-i2s"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xdd000 0x1000>; + interrupts = <221 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + qdec20: qdec@e0000 { + compatible = "nordic,nrf-qdec"; + reg = <0xe0000 0x1000>; + interrupts = <224 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + qdec21: qdec@e1000 { + compatible = "nordic,nrf-qdec"; + reg = <0xe1000 0x1000>; + interrupts = <225 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + grtc: grtc@e2000 { + compatible = "nordic,nrf-grtc"; + reg = <0xe2000 0x1000>; + cc-num = <12>; + status = "disabled"; + }; + + dppic30: dppic@102000 { + compatible = "nordic,nrf-dppic"; + reg = <0x102000 0x808>; + status = "disabled"; + }; + + ppib30: ppib@103000 { + compatible = "nordic,nrf-ppib"; + reg = <0x103000 0x1000>; + status = "disabled"; + }; + + i2c30: i2c@104000 { + compatible = "nordic,nrf-twim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x104000 0x1000>; + interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + easydma-maxcnt-bits = <16>; + status = "disabled"; + zephyr,pm-device-runtime-auto; + }; + + spi30: spi@104000 { + /* + * This spi node can be either SPIM or SPIS, + * for the user to pick: + * compatible = "nordic,nrf-spim" or + * "nordic,nrf-spis". + */ + compatible = "nordic,nrf-spim"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x104000 0x1000>; + interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + max-frequency = ; + easydma-maxcnt-bits = <16>; + rx-delay-supported; + rx-delay = <1>; + status = "disabled"; + }; + + uart30: uart@104000 { + compatible = "nordic,nrf-uarte"; + reg = <0x104000 0x1000>; + interrupts = <260 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + endtx-stoptx-supported; + frame-timeout-supported; + }; + + clock: clock@10e000 { + compatible = "nordic,nrf-clock"; + reg = <0x10e000 0x1000>; + interrupts = <261 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + power: power@10e000 { + compatible = "nordic,nrf-power"; + reg = <0x10e000 0x1000>; + ranges = <0x0 0x10e000 0x1000>; + interrupts = <261 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <1>; + + gpregret1: gpregret1@51c { + #address-cells = <1>; + #size-cells = <1>; + compatible = "nordic,nrf-gpregret"; + reg = <0x51c 0x1>; + status = "disabled"; + }; + + gpregret2: gpregret2@520 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "nordic,nrf-gpregret"; + reg = <0x520 0x1>; + status = "disabled"; + }; + }; + + comp: comparator@106000 { + /* + * Use compatible "nordic,nrf-comp" to configure as COMP + * Use compatible "nordic,nrf-lpcomp" to configure as LPCOMP + */ + compatible = "nordic,nrf-comp"; + reg = <0x106000 0x1000>; + status = "disabled"; + interrupts = <262 NRF_DEFAULT_IRQ_PRIORITY>; + }; + +#ifdef USE_NON_SECURE_ADDRESS_MAP + /* intentionally empty because WDT30 is hardware fixed to Secure */ +#else + wdt30: watchdog@108000 { + compatible = "nordic,nrf-wdt"; + reg = <0x108000 0x620>; + interrupts = <264 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; +#endif + + wdt31: watchdog@109000 { + compatible = "nordic,nrf-wdt"; + reg = <0x109000 0x620>; + interrupts = <265 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + }; + + gpio0: gpio@10a000 { + compatible = "nordic,nrf-gpio"; + gpio-controller; + reg = <0x10a000 0x300>; + #gpio-cells = <2>; + ngpios = <5>; + status = "disabled"; + port = <0>; + gpiote-instance = <&gpiote30>; + }; + + gpiote30: gpiote@10c000 { + compatible = "nordic,nrf-gpiote"; + reg = <0x10c000 0x1000>; + status = "disabled"; + instance = <30>; + }; + + regulators: regulator@120000 { + compatible = "nordic,nrf54l-regulators"; + reg = <0x120000 0x1000>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <1>; + + vregmain: regulator@120600 { + compatible = "nordic,nrf5x-regulator"; + reg = <0x120600 0x1>; + status = "disabled"; + regulator-name = "VREGMAIN"; + regulator-initial-mode = ; + }; + }; + }; + + rram_controller: rram-controller@5004b000 { + compatible = "nordic,rram-controller"; + reg = <0x5004b000 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + interrupts = <75 NRF_DEFAULT_IRQ_PRIORITY>; + + cpuapp_rram: rram@0 { + compatible = "soc-nv-flash"; + erase-block-size = <4096>; + write-block-size = <16>; + }; + }; + + cpuapp_ppb: cpuapp-ppb-bus { + #address-cells = <1>; + #size-cells = <1>; + + cpuapp_nvic: interrupt-controller@e000e100 { + #address-cells = <1>; + compatible = "arm,v8m-nvic"; + reg = <0xe000e100 0xc00>; + arm,num-irq-priority-bits = <3>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + cpuapp_systick: timer@e000e010 { + compatible = "arm,armv8m-systick"; + reg = <0xe000e010 0x10>; + status = "disabled"; + }; + }; + }; +}; diff --git a/dts/riscv/nordic/nrf54l05_cpuflpr.dtsi b/dts/riscv/nordic/nrf54l05_cpuflpr.dtsi new file mode 100644 index 0000000000000..d4725112a465d --- /dev/null +++ b/dts/riscv/nordic/nrf54l05_cpuflpr.dtsi @@ -0,0 +1,8 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include "nrf54l_05_10_15_cpuflpr.dtsi" diff --git a/dts/riscv/nordic/nrf54l10_cpuflpr.dtsi b/dts/riscv/nordic/nrf54l10_cpuflpr.dtsi new file mode 100644 index 0000000000000..cea4112d363de --- /dev/null +++ b/dts/riscv/nordic/nrf54l10_cpuflpr.dtsi @@ -0,0 +1,8 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include "nrf54l_05_10_15_cpuflpr.dtsi" diff --git a/dts/riscv/nordic/nrf54l15_cpuflpr.dtsi b/dts/riscv/nordic/nrf54l15_cpuflpr.dtsi index fefa43b76c03d..4dedf1fbca553 100644 --- a/dts/riscv/nordic/nrf54l15_cpuflpr.dtsi +++ b/dts/riscv/nordic/nrf54l15_cpuflpr.dtsi @@ -5,63 +5,4 @@ */ #include - -cpu: &cpuflpr {}; -clic: &cpuflpr_clic {}; - -/delete-node/ &cpuapp; -/delete-node/ &cpuapp_rram; -/delete-node/ &cpuapp_ppb; -/delete-node/ &cpuapp_sram; - -/ { - soc { - compatible = "simple-bus"; - interrupt-parent = <&cpuflpr_clic>; - ranges; - }; -}; - -&cpuflpr { - cpuflpr_vevif_rx: mailbox { - compatible = "nordic,nrf-vevif-task-rx"; - status = "disabled"; - interrupt-parent = <&cpuflpr_clic>; - interrupts = <16 NRF_DEFAULT_IRQ_PRIORITY>, - <17 NRF_DEFAULT_IRQ_PRIORITY>, - <18 NRF_DEFAULT_IRQ_PRIORITY>, - <19 NRF_DEFAULT_IRQ_PRIORITY>, - <20 NRF_DEFAULT_IRQ_PRIORITY>, - <21 NRF_DEFAULT_IRQ_PRIORITY>, - <22 NRF_DEFAULT_IRQ_PRIORITY>; - #mbox-cells = <1>; - nordic,tasks = <7>; - nordic,tasks-mask = <0x007f0000>; - }; -}; - -&cpuflpr_vpr { - cpuflpr_vevif_tx: mailbox { - compatible = "nordic,nrf-vevif-event-tx"; - #mbox-cells = <1>; - nordic,events = <1>; - nordic,events-mask = <0x00100000>; - status = "disabled"; - }; -}; - -&cpuflpr_clic { - status = "okay"; -}; - -&grtc { - interrupts = <226 NRF_DEFAULT_IRQ_PRIORITY>; -}; - -&gpiote20 { - interrupts = <218 NRF_DEFAULT_IRQ_PRIORITY>; -}; - -&gpiote30 { - interrupts = <268 NRF_DEFAULT_IRQ_PRIORITY>; -}; +#include "nrf54l_05_10_15_cpuflpr.dtsi" diff --git a/dts/riscv/nordic/nrf54l_05_10_15_cpuflpr.dtsi b/dts/riscv/nordic/nrf54l_05_10_15_cpuflpr.dtsi new file mode 100644 index 0000000000000..b20ddbb1bdaba --- /dev/null +++ b/dts/riscv/nordic/nrf54l_05_10_15_cpuflpr.dtsi @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +cpu: &cpuflpr {}; +clic: &cpuflpr_clic {}; + +/delete-node/ &cpuapp; +/delete-node/ &cpuapp_rram; +/delete-node/ &cpuapp_ppb; +/delete-node/ &cpuapp_sram; + +/ { + soc { + compatible = "simple-bus"; + interrupt-parent = <&cpuflpr_clic>; + ranges; + }; +}; + +&cpuflpr { + cpuflpr_vevif_rx: mailbox { + compatible = "nordic,nrf-vevif-task-rx"; + status = "disabled"; + interrupt-parent = <&cpuflpr_clic>; + interrupts = <16 NRF_DEFAULT_IRQ_PRIORITY>, + <17 NRF_DEFAULT_IRQ_PRIORITY>, + <18 NRF_DEFAULT_IRQ_PRIORITY>, + <19 NRF_DEFAULT_IRQ_PRIORITY>, + <20 NRF_DEFAULT_IRQ_PRIORITY>, + <21 NRF_DEFAULT_IRQ_PRIORITY>, + <22 NRF_DEFAULT_IRQ_PRIORITY>; + #mbox-cells = <1>; + nordic,tasks = <7>; + nordic,tasks-mask = <0x007f0000>; + }; +}; + +&cpuflpr_vpr { + cpuflpr_vevif_tx: mailbox { + compatible = "nordic,nrf-vevif-event-tx"; + #mbox-cells = <1>; + nordic,events = <1>; + nordic,events-mask = <0x00100000>; + status = "disabled"; + }; +}; + +&cpuflpr_clic { + status = "okay"; +}; + +&grtc { + interrupts = <226 NRF_DEFAULT_IRQ_PRIORITY>; +}; + +&gpiote20 { + interrupts = <218 NRF_DEFAULT_IRQ_PRIORITY>; +}; + +&gpiote30 { + interrupts = <268 NRF_DEFAULT_IRQ_PRIORITY>; +}; diff --git a/modules/hal_nordic/nrfx/CMakeLists.txt b/modules/hal_nordic/nrfx/CMakeLists.txt index f9abcd0a0c2da..fc3c8adb371c1 100644 --- a/modules/hal_nordic/nrfx/CMakeLists.txt +++ b/modules/hal_nordic/nrfx/CMakeLists.txt @@ -44,6 +44,12 @@ zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_CPUPPR NRF54H20_XXAA NRF_PPR) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54H20_CPUFLPR NRF54H20_XXAA NRF_FLPR) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L05 NRF54L05_XXAA) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L05_CPUAPP NRF_APPLICATION) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L05_CPUFLPR NRF_FLPR) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L10 NRF54L10_XXAA) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L10_CPUAPP NRF_APPLICATION) +zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L10_CPUFLPR NRF_FLPR) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L15 NRF54L15_XXAA) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L15_CPUAPP NRF_APPLICATION) zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54L15_CPUFLPR NRF_FLPR) @@ -172,7 +178,7 @@ if(DEFINED uicr_path) endif() endif() -if(CONFIG_SOC_NRF54L15_CPUAPP OR CONFIG_SOC_NRF54L20_ENGA_CPUAPP) +if(CONFIG_SOC_NRF54L_CPUAPP_COMMON) dt_prop(clock_frequency PATH "/cpus/cpu@0" PROPERTY "clock-frequency") math(EXPR clock_frequency_mhz "${clock_frequency} / 1000000") zephyr_compile_definitions("NRF_CONFIG_CPU_FREQ_MHZ=${clock_frequency_mhz}") @@ -222,6 +228,10 @@ mdk_svd_ifdef(CONFIG_SOC_NRF54H20_CPUAPP nrf54h20_application.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54H20_CPUPPR nrf54h20_ppr.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54H20_CPUFLPR nrf54h20_flpr.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54H20_CPURAD nrf54h20_radiocore.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF54L05_CPUAPP nrf54l05_application.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF54L05_CPUFLPR nrf54l05_flpr.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF54L10_CPUAPP nrf54l10_application.svd) +mdk_svd_ifdef(CONFIG_SOC_NRF54L10_CPUFLPR nrf54l10_flpr.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54L15_CPUAPP nrf54l15_application.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54L15_CPUFLPR nrf54l15_flpr.svd) mdk_svd_ifdef(CONFIG_SOC_NRF54L20_ENGA_CPUAPP nrf54l20_enga_application.svd) diff --git a/modules/hal_nordic/nrfx/nrfx_config.h b/modules/hal_nordic/nrfx/nrfx_config.h index 48b3b8226fb52..5a6c8bf01c790 100644 --- a/modules/hal_nordic/nrfx/nrfx_config.h +++ b/modules/hal_nordic/nrfx/nrfx_config.h @@ -1129,6 +1129,14 @@ #include #elif defined(NRF54H20_XXAA) && defined(NRF_FLPR) #include +#elif defined(NRF54L05_XXAA) && defined(NRF_APPLICATION) + #include +#elif defined(NRF54L05_XXAA) && defined(NRF_FLPR) + #include +#elif defined(NRF54L10_XXAA) && defined(NRF_APPLICATION) + #include +#elif defined(NRF54L10_XXAA) && defined(NRF_FLPR) + #include #elif defined(NRF54L15_XXAA) && defined(NRF_APPLICATION) #include #elif defined(NRF54L15_XXAA) && defined(NRF_FLPR) diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54l05_application.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54l05_application.h new file mode 100644 index 0000000000000..503405b49f6dc --- /dev/null +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54l05_application.h @@ -0,0 +1,1775 @@ +/* + * Copyright (c) 2024, Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef NRFX_CONFIG_NRF54L05_APPLICATION_H__ +#define NRFX_CONFIG_NRF54L05_APPLICATION_H__ + +#ifndef NRFX_CONFIG_H__ +#error "This file should not be included directly. Include nrfx_config.h instead." +#endif + + +/** + * @brief NRFX_DEFAULT_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_DEFAULT_IRQ_PRIORITY +#define NRFX_DEFAULT_IRQ_PRIORITY 7 +#endif + +/** + * @brief NRFX_CLOCK_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_CLOCK_ENABLED +#define NRFX_CLOCK_ENABLED 0 +#endif + +/** + * @brief NRFX_CLOCK_CONFIG_LF_SRC + * + * Integer value. + * Supported values: + * - RC = 0 + * - XTAL = 1 + * - Synth = 2 + */ +#ifndef NRFX_CLOCK_CONFIG_LF_SRC +#define NRFX_CLOCK_CONFIG_LF_SRC 1 +#endif + +/** + * @brief NRFX_CLOCK_CONFIG_LF_CAL_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_CLOCK_CONFIG_LF_CAL_ENABLED +#define NRFX_CLOCK_CONFIG_LF_CAL_ENABLED 0 +#endif + +/** + * @brief NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED +#define NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED 0 +#endif + +/** + * @brief NRFX_CLOCK_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_CLOCK_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_CLOCK_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_CLOCK_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_CLOCK_CONFIG_LOG_ENABLED +#define NRFX_CLOCK_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_CLOCK_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_CLOCK_CONFIG_LOG_LEVEL +#define NRFX_CLOCK_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_COMP_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_COMP_ENABLED +#define NRFX_COMP_ENABLED 0 +#endif + +/** + * @brief NRFX_COMP_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_COMP_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_COMP_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_COMP_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_COMP_CONFIG_LOG_ENABLED +#define NRFX_COMP_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_COMP_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_COMP_CONFIG_LOG_LEVEL +#define NRFX_COMP_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_DPPI_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI_ENABLED +#define NRFX_DPPI_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI_CONFIG_LOG_ENABLED +#define NRFX_DPPI_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_DPPI_CONFIG_LOG_LEVEL +#define NRFX_DPPI_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_DPPI00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI00_ENABLED +#define NRFX_DPPI00_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI10_ENABLED +#define NRFX_DPPI10_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI20_ENABLED +#define NRFX_DPPI20_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI30_ENABLED +#define NRFX_DPPI30_ENABLED 0 +#endif + +/** + * @brief NRFX_EGU_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_EGU_ENABLED +#define NRFX_EGU_ENABLED 0 +#endif + +/** + * @brief NRFX_EGU_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_EGU_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_EGU_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_EGU10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_EGU10_ENABLED +#define NRFX_EGU10_ENABLED 0 +#endif + +/** + * @brief NRFX_EGU20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_EGU20_ENABLED +#define NRFX_EGU20_ENABLED 0 +#endif + +/** + * @brief NRFX_GPIOTE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE_ENABLED +#define NRFX_GPIOTE_ENABLED 0 +#endif + +/** + * @brief NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS + * + * Integer value. Minimum: 0. Maximum: 15. + */ +#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS +#define NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS 2 +#endif + +/** + * @brief NRFX_GPIOTE_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE_CONFIG_LOG_ENABLED +#define NRFX_GPIOTE_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_GPIOTE_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_GPIOTE_CONFIG_LOG_LEVEL +#define NRFX_GPIOTE_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_GPIOTE20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE20_ENABLED +#define NRFX_GPIOTE20_ENABLED 0 +#endif + +/** + * @brief NRFX_GPIOTE30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE30_ENABLED +#define NRFX_GPIOTE30_ENABLED 0 +#endif + +/** + * @brief NRFX_GRTC_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GRTC_ENABLED +#define NRFX_GRTC_ENABLED 0 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_AUTOEN + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GRTC_CONFIG_AUTOEN +#define NRFX_GRTC_CONFIG_AUTOEN 1 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_AUTOSTART + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GRTC_CONFIG_AUTOSTART +#define NRFX_GRTC_CONFIG_AUTOSTART 1 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_CLEAR_AT_INIT + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GRTC_CONFIG_CLEAR_AT_INIT +#define NRFX_GRTC_CONFIG_CLEAR_AT_INIT 0 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS + * + * Integer value. + */ +#ifndef NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS +#define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS 8 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK + */ +#ifndef NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK +#define NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK 0x00000f0f +#endif + +/** + * @brief NRFX_GRTC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_GRTC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_GRTC_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_GRTC_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GRTC_CONFIG_LOG_ENABLED +#define NRFX_GRTC_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_GRTC_CONFIG_LOG_LEVEL +#define NRFX_GRTC_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_I2S_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S_ENABLED +#define NRFX_I2S_ENABLED 0 +#endif + +/** + * @brief NRFX_I2S_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_I2S_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_I2S_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_I2S_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S_CONFIG_LOG_ENABLED +#define NRFX_I2S_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_I2S_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_I2S_CONFIG_LOG_LEVEL +#define NRFX_I2S_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_I2S20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S20_ENABLED +#define NRFX_I2S20_ENABLED 0 +#endif + +/** + * @brief NRFX_LPCOMP_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_LPCOMP_ENABLED +#define NRFX_LPCOMP_ENABLED 0 +#endif + +/** + * @brief NRFX_LPCOMP_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_LPCOMP_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_LPCOMP_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_LPCOMP_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_LPCOMP_CONFIG_LOG_ENABLED +#define NRFX_LPCOMP_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_LPCOMP_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_LPCOMP_CONFIG_LOG_LEVEL +#define NRFX_LPCOMP_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_NFCT_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_NFCT_ENABLED +#define NRFX_NFCT_ENABLED 0 +#endif + +/** + * @brief NRFX_NFCT_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_NFCT_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_NFCT_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_NFCT_CONFIG_TIMER_INSTANCE_ID - Timer instance used for workarounds in the driver. + * + * Integer value. Minimum: 0. Maximum: 5. + */ +#ifndef NRFX_NFCT_CONFIG_TIMER_INSTANCE_ID +#define NRFX_NFCT_CONFIG_TIMER_INSTANCE_ID 0 +#endif + +/** + * @brief NRFX_NFCT_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_NFCT_CONFIG_LOG_ENABLED +#define NRFX_NFCT_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_NFCT_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_NFCT_CONFIG_LOG_LEVEL +#define NRFX_NFCT_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PDM_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PDM_ENABLED +#define NRFX_PDM_ENABLED 0 +#endif + +/** + * @brief NRFX_PDM_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_PDM_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_PDM_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_PDM_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PDM_CONFIG_LOG_ENABLED +#define NRFX_PDM_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_PDM_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_PDM_CONFIG_LOG_LEVEL +#define NRFX_PDM_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PDM20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PDM20_ENABLED +#define NRFX_PDM20_ENABLED 0 +#endif + +/** + * @brief NRFX_PDM21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PDM21_ENABLED +#define NRFX_PDM21_ENABLED 0 +#endif + +/** + * @brief NRFX_POWER_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_POWER_ENABLED +#define NRFX_POWER_ENABLED 0 +#endif + +/** + * @brief NRFX_POWER_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_POWER_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_POWER_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_PPIB_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB_ENABLED +#define NRFX_PPIB_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB_CONFIG_LOG_ENABLED +#define NRFX_PPIB_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_PPIB_CONFIG_LOG_LEVEL +#define NRFX_PPIB_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PPIB00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB00_ENABLED +#define NRFX_PPIB00_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB01_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB01_ENABLED +#define NRFX_PPIB01_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB10_ENABLED +#define NRFX_PPIB10_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB11_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB11_ENABLED +#define NRFX_PPIB11_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB20_ENABLED +#define NRFX_PPIB20_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB21_ENABLED +#define NRFX_PPIB21_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB22_ENABLED +#define NRFX_PPIB22_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB30_ENABLED +#define NRFX_PPIB30_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_ENABLED +#define NRFX_PRS_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_CONFIG_LOG_ENABLED +#define NRFX_PRS_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_PRS_CONFIG_LOG_LEVEL +#define NRFX_PRS_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PRS_BOX_0_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_0_ENABLED +#define NRFX_PRS_BOX_0_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_1_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_1_ENABLED +#define NRFX_PRS_BOX_1_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_2_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_2_ENABLED +#define NRFX_PRS_BOX_2_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_3_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_3_ENABLED +#define NRFX_PRS_BOX_3_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_4_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_4_ENABLED +#define NRFX_PRS_BOX_4_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_5_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_5_ENABLED +#define NRFX_PRS_BOX_5_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM_ENABLED +#define NRFX_PWM_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_PWM_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_PWM_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_PWM_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM_CONFIG_LOG_ENABLED +#define NRFX_PWM_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_PWM_CONFIG_LOG_LEVEL +#define NRFX_PWM_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PWM20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM20_ENABLED +#define NRFX_PWM20_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM21_ENABLED +#define NRFX_PWM21_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM22_ENABLED +#define NRFX_PWM22_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC_ENABLED +#define NRFX_QDEC_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_QDEC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_QDEC_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_QDEC_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC_CONFIG_LOG_ENABLED +#define NRFX_QDEC_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_QDEC_CONFIG_LOG_LEVEL +#define NRFX_QDEC_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_QDEC20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC20_ENABLED +#define NRFX_QDEC20_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC21_ENABLED +#define NRFX_QDEC21_ENABLED 0 +#endif + +/** + * @brief NRFX_RRAMC_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RRAMC_ENABLED +#define NRFX_RRAMC_ENABLED 0 +#endif + +/** + * @brief NRFX_RRAMC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_RRAMC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_RRAMC_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_RRAMC_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RRAMC_CONFIG_LOG_ENABLED +#define NRFX_RRAMC_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_RRAMC_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_RRAMC_CONFIG_LOG_LEVEL +#define NRFX_RRAMC_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_RTC_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC_ENABLED +#define NRFX_RTC_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_RTC_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC_CONFIG_LOG_ENABLED +#define NRFX_RTC_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_RTC_CONFIG_LOG_LEVEL +#define NRFX_RTC_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_RTC10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC10_ENABLED +#define NRFX_RTC10_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC30_ENABLED +#define NRFX_RTC30_ENABLED 0 +#endif + +/** + * @brief NRFX_SAADC_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SAADC_ENABLED +#define NRFX_SAADC_ENABLED 0 +#endif + +/** + * @brief NRFX_SAADC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_SAADC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_SAADC_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_SAADC_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SAADC_CONFIG_LOG_ENABLED +#define NRFX_SAADC_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_SAADC_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_SAADC_CONFIG_LOG_LEVEL +#define NRFX_SAADC_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_SPIM_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM_ENABLED +#define NRFX_SPIM_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_SPIM_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM_CONFIG_LOG_ENABLED +#define NRFX_SPIM_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_SPIM_CONFIG_LOG_LEVEL +#define NRFX_SPIM_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_SPIM00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM00_ENABLED +#define NRFX_SPIM00_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM20_ENABLED +#define NRFX_SPIM20_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM21_ENABLED +#define NRFX_SPIM21_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM22_ENABLED +#define NRFX_SPIM22_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM30_ENABLED +#define NRFX_SPIM30_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS_ENABLED +#define NRFX_SPIS_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_SPIS_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_SPIS_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_SPIS_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS_CONFIG_LOG_ENABLED +#define NRFX_SPIS_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_SPIS_CONFIG_LOG_LEVEL +#define NRFX_SPIS_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_SPIS00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS00_ENABLED +#define NRFX_SPIS00_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS20_ENABLED +#define NRFX_SPIS20_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS21_ENABLED +#define NRFX_SPIS21_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS22_ENABLED +#define NRFX_SPIS22_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS30_ENABLED +#define NRFX_SPIS30_ENABLED 0 +#endif + +/** + * @brief NRFX_SYSTICK_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SYSTICK_ENABLED +#define NRFX_SYSTICK_ENABLED 0 +#endif + +/** + * @brief NRFX_TEMP_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TEMP_ENABLED +#define NRFX_TEMP_ENABLED 0 +#endif + +/** + * @brief NRFX_TEMP_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_TEMP_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_TEMP_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_TEMP_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TEMP_CONFIG_LOG_ENABLED +#define NRFX_TEMP_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_TEMP_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_TEMP_CONFIG_LOG_LEVEL +#define NRFX_TEMP_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_TIMER_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER_ENABLED +#define NRFX_TIMER_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_TIMER_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER_CONFIG_LOG_ENABLED +#define NRFX_TIMER_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_TIMER_CONFIG_LOG_LEVEL +#define NRFX_TIMER_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_TIMER00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER00_ENABLED +#define NRFX_TIMER00_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER10_ENABLED +#define NRFX_TIMER10_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER20_ENABLED +#define NRFX_TIMER20_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER21_ENABLED +#define NRFX_TIMER21_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER22_ENABLED +#define NRFX_TIMER22_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER23_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER23_ENABLED +#define NRFX_TIMER23_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER24_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER24_ENABLED +#define NRFX_TIMER24_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM_ENABLED +#define NRFX_TWIM_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_TWIM_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM_CONFIG_LOG_ENABLED +#define NRFX_TWIM_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_TWIM_CONFIG_LOG_LEVEL +#define NRFX_TWIM_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_TWIM20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM20_ENABLED +#define NRFX_TWIM20_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM21_ENABLED +#define NRFX_TWIM21_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM22_ENABLED +#define NRFX_TWIM22_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM30_ENABLED +#define NRFX_TWIM30_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS_ENABLED +#define NRFX_TWIS_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_TWIS_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS_CONFIG_LOG_ENABLED +#define NRFX_TWIS_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS_ASSUME_INIT_AFTER_RESET_ONLY + * Assume that any instance would be initialized only once. + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS_ASSUME_INIT_AFTER_RESET_ONLY +#define NRFX_TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0 +#endif + +/** + * @brief NRFX_TWIS_NO_SYNC_MODE - Remove support for synchronous mode. + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS_NO_SYNC_MODE +#define NRFX_TWIS_NO_SYNC_MODE 0 +#endif + +/** + * @brief NRFX_TWIS_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_TWIS_CONFIG_LOG_LEVEL +#define NRFX_TWIS_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_TWIS20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS20_ENABLED +#define NRFX_TWIS20_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS21_ENABLED +#define NRFX_TWIS21_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS22_ENABLED +#define NRFX_TWIS22_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS30_ENABLED +#define NRFX_TWIS30_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_ENABLED +#define NRFX_UARTE_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG + * If enabled, support for configuring GPIO pins is removed from the driver + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG +#define NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG 0 +#endif + +/** + * @brief NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG + * If enabled, support for configuring PSEL registers is removed from the driver + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG +#define NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG 0 +#endif + +/** + * @brief NRFX_UARTE_CONFIG_TX_LINK - If enabled, driver supports linking of TX transfers. + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_TX_LINK +#define NRFX_UARTE_CONFIG_TX_LINK 1 +#endif + +/** + * @brief NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_UARTE_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_LOG_ENABLED +#define NRFX_UARTE_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_UARTE_CONFIG_LOG_LEVEL +#define NRFX_UARTE_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_UARTE00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE00_ENABLED +#define NRFX_UARTE00_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE20_ENABLED +#define NRFX_UARTE20_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE21_ENABLED +#define NRFX_UARTE21_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE22_ENABLED +#define NRFX_UARTE22_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE30_ENABLED +#define NRFX_UARTE30_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT_ENABLED +#define NRFX_WDT_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_WDT_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_WDT_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_WDT_CONFIG_NO_IRQ - Remove WDT IRQ handling from WDT driver + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT_CONFIG_NO_IRQ +#define NRFX_WDT_CONFIG_NO_IRQ 0 +#endif + +/** + * @brief NRFX_WDT_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT_CONFIG_LOG_ENABLED +#define NRFX_WDT_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_WDT_CONFIG_LOG_LEVEL +#define NRFX_WDT_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_WDT30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT30_ENABLED +#define NRFX_WDT30_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT31_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT31_ENABLED +#define NRFX_WDT31_ENABLED 0 +#endif + +#endif /* NRFX_CONFIG_NRF54L05_APPLICATION_H__ */ diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54l05_flpr.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54l05_flpr.h new file mode 100644 index 0000000000000..4d83d5cba2287 --- /dev/null +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54l05_flpr.h @@ -0,0 +1,1784 @@ +/* + * Copyright (c) 2024, Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef NRFX_CONFIG_NRF54L05_FLPR_H__ +#define NRFX_CONFIG_NRF54L05_FLPR_H__ + +#ifndef NRFX_CONFIG_H__ +#error "This file should not be included directly. Include nrfx_config.h instead." +#endif + + +/** + * @brief NRFX_DEFAULT_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_DEFAULT_IRQ_PRIORITY +#define NRFX_DEFAULT_IRQ_PRIORITY 0 +#endif + +/** + * @brief NRFX_CLOCK_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_CLOCK_ENABLED +#define NRFX_CLOCK_ENABLED 0 +#endif + +/** + * @brief NRFX_CLOCK_CONFIG_LF_SRC + * + * Integer value. + * Supported values: + * - RC = 0 + * - XTAL = 1 + * - Synth = 2 + */ +#ifndef NRFX_CLOCK_CONFIG_LF_SRC +#define NRFX_CLOCK_CONFIG_LF_SRC 1 +#endif + +/** + * @brief NRFX_CLOCK_CONFIG_LF_CAL_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_CLOCK_CONFIG_LF_CAL_ENABLED +#define NRFX_CLOCK_CONFIG_LF_CAL_ENABLED 0 +#endif + +/** + * @brief NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED +#define NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED 0 +#endif + +/** + * @brief NRFX_CLOCK_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_CLOCK_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_CLOCK_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_CLOCK_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_CLOCK_CONFIG_LOG_ENABLED +#define NRFX_CLOCK_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_CLOCK_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_CLOCK_CONFIG_LOG_LEVEL +#define NRFX_CLOCK_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_COMP_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_COMP_ENABLED +#define NRFX_COMP_ENABLED 0 +#endif + +/** + * @brief NRFX_COMP_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_COMP_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_COMP_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_COMP_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_COMP_CONFIG_LOG_ENABLED +#define NRFX_COMP_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_COMP_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_COMP_CONFIG_LOG_LEVEL +#define NRFX_COMP_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_COREDEP_VPR_LEGACY + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_COREDEP_VPR_LEGACY +#define NRFX_COREDEP_VPR_LEGACY 0 +#endif + +/** + * @brief NRFX_DPPI_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI_ENABLED +#define NRFX_DPPI_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI_CONFIG_LOG_ENABLED +#define NRFX_DPPI_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_DPPI_CONFIG_LOG_LEVEL +#define NRFX_DPPI_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_DPPI00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI00_ENABLED +#define NRFX_DPPI00_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI10_ENABLED +#define NRFX_DPPI10_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI20_ENABLED +#define NRFX_DPPI20_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI30_ENABLED +#define NRFX_DPPI30_ENABLED 0 +#endif + +/** + * @brief NRFX_EGU_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_EGU_ENABLED +#define NRFX_EGU_ENABLED 0 +#endif + +/** + * @brief NRFX_EGU_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_EGU_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_EGU_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_EGU10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_EGU10_ENABLED +#define NRFX_EGU10_ENABLED 0 +#endif + +/** + * @brief NRFX_EGU20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_EGU20_ENABLED +#define NRFX_EGU20_ENABLED 0 +#endif + +/** + * @brief NRFX_GPIOTE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE_ENABLED +#define NRFX_GPIOTE_ENABLED 0 +#endif + +/** + * @brief NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS + * + * Integer value. Minimum: 0. Maximum: 15. + */ +#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS +#define NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS 2 +#endif + +/** + * @brief NRFX_GPIOTE_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE_CONFIG_LOG_ENABLED +#define NRFX_GPIOTE_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_GPIOTE_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_GPIOTE_CONFIG_LOG_LEVEL +#define NRFX_GPIOTE_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_GPIOTE20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE20_ENABLED +#define NRFX_GPIOTE20_ENABLED 0 +#endif + +/** + * @brief NRFX_GPIOTE30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE30_ENABLED +#define NRFX_GPIOTE30_ENABLED 0 +#endif + +/** + * @brief NRFX_GRTC_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GRTC_ENABLED +#define NRFX_GRTC_ENABLED 0 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_AUTOEN + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GRTC_CONFIG_AUTOEN +#define NRFX_GRTC_CONFIG_AUTOEN 1 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_AUTOSTART + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GRTC_CONFIG_AUTOSTART +#define NRFX_GRTC_CONFIG_AUTOSTART 0 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_CLEAR_AT_INIT + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GRTC_CONFIG_CLEAR_AT_INIT +#define NRFX_GRTC_CONFIG_CLEAR_AT_INIT 0 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS + * + * Integer value. + */ +#ifndef NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS +#define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS 4 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK + */ +#ifndef NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK +#define NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK 0x000000f0 +#endif + +/** + * @brief NRFX_GRTC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_GRTC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_GRTC_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_GRTC_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GRTC_CONFIG_LOG_ENABLED +#define NRFX_GRTC_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_GRTC_CONFIG_LOG_LEVEL +#define NRFX_GRTC_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_I2S_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S_ENABLED +#define NRFX_I2S_ENABLED 0 +#endif + +/** + * @brief NRFX_I2S_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_I2S_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_I2S_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_I2S_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S_CONFIG_LOG_ENABLED +#define NRFX_I2S_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_I2S_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_I2S_CONFIG_LOG_LEVEL +#define NRFX_I2S_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_I2S20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S20_ENABLED +#define NRFX_I2S20_ENABLED 0 +#endif + +/** + * @brief NRFX_LPCOMP_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_LPCOMP_ENABLED +#define NRFX_LPCOMP_ENABLED 0 +#endif + +/** + * @brief NRFX_LPCOMP_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_LPCOMP_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_LPCOMP_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_LPCOMP_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_LPCOMP_CONFIG_LOG_ENABLED +#define NRFX_LPCOMP_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_LPCOMP_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_LPCOMP_CONFIG_LOG_LEVEL +#define NRFX_LPCOMP_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_NFCT_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_NFCT_ENABLED +#define NRFX_NFCT_ENABLED 0 +#endif + +/** + * @brief NRFX_NFCT_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_NFCT_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_NFCT_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_NFCT_CONFIG_TIMER_INSTANCE_ID - Timer instance used for workarounds in the driver. + * + * Integer value. Minimum: 0. Maximum: 5. + */ +#ifndef NRFX_NFCT_CONFIG_TIMER_INSTANCE_ID +#define NRFX_NFCT_CONFIG_TIMER_INSTANCE_ID 0 +#endif + +/** + * @brief NRFX_NFCT_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_NFCT_CONFIG_LOG_ENABLED +#define NRFX_NFCT_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_NFCT_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_NFCT_CONFIG_LOG_LEVEL +#define NRFX_NFCT_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PDM_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PDM_ENABLED +#define NRFX_PDM_ENABLED 0 +#endif + +/** + * @brief NRFX_PDM_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_PDM_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_PDM_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_PDM_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PDM_CONFIG_LOG_ENABLED +#define NRFX_PDM_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_PDM_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_PDM_CONFIG_LOG_LEVEL +#define NRFX_PDM_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PDM20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PDM20_ENABLED +#define NRFX_PDM20_ENABLED 0 +#endif + +/** + * @brief NRFX_PDM21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PDM21_ENABLED +#define NRFX_PDM21_ENABLED 0 +#endif + +/** + * @brief NRFX_POWER_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_POWER_ENABLED +#define NRFX_POWER_ENABLED 0 +#endif + +/** + * @brief NRFX_POWER_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_POWER_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_POWER_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_PPIB_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB_ENABLED +#define NRFX_PPIB_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB_CONFIG_LOG_ENABLED +#define NRFX_PPIB_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_PPIB_CONFIG_LOG_LEVEL +#define NRFX_PPIB_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PPIB00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB00_ENABLED +#define NRFX_PPIB00_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB01_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB01_ENABLED +#define NRFX_PPIB01_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB10_ENABLED +#define NRFX_PPIB10_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB11_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB11_ENABLED +#define NRFX_PPIB11_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB20_ENABLED +#define NRFX_PPIB20_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB21_ENABLED +#define NRFX_PPIB21_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB22_ENABLED +#define NRFX_PPIB22_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB30_ENABLED +#define NRFX_PPIB30_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_ENABLED +#define NRFX_PRS_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_CONFIG_LOG_ENABLED +#define NRFX_PRS_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_PRS_CONFIG_LOG_LEVEL +#define NRFX_PRS_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PRS_BOX_0_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_0_ENABLED +#define NRFX_PRS_BOX_0_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_1_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_1_ENABLED +#define NRFX_PRS_BOX_1_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_2_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_2_ENABLED +#define NRFX_PRS_BOX_2_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_3_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_3_ENABLED +#define NRFX_PRS_BOX_3_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_4_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_4_ENABLED +#define NRFX_PRS_BOX_4_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_5_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_5_ENABLED +#define NRFX_PRS_BOX_5_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM_ENABLED +#define NRFX_PWM_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_PWM_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_PWM_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_PWM_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM_CONFIG_LOG_ENABLED +#define NRFX_PWM_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_PWM_CONFIG_LOG_LEVEL +#define NRFX_PWM_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PWM20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM20_ENABLED +#define NRFX_PWM20_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM21_ENABLED +#define NRFX_PWM21_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM22_ENABLED +#define NRFX_PWM22_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC_ENABLED +#define NRFX_QDEC_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_QDEC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_QDEC_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_QDEC_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC_CONFIG_LOG_ENABLED +#define NRFX_QDEC_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_QDEC_CONFIG_LOG_LEVEL +#define NRFX_QDEC_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_QDEC20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC20_ENABLED +#define NRFX_QDEC20_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC21_ENABLED +#define NRFX_QDEC21_ENABLED 0 +#endif + +/** + * @brief NRFX_RRAMC_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RRAMC_ENABLED +#define NRFX_RRAMC_ENABLED 0 +#endif + +/** + * @brief NRFX_RRAMC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_RRAMC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_RRAMC_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_RRAMC_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RRAMC_CONFIG_LOG_ENABLED +#define NRFX_RRAMC_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_RRAMC_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_RRAMC_CONFIG_LOG_LEVEL +#define NRFX_RRAMC_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_RTC_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC_ENABLED +#define NRFX_RTC_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_RTC_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC_CONFIG_LOG_ENABLED +#define NRFX_RTC_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_RTC_CONFIG_LOG_LEVEL +#define NRFX_RTC_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_RTC10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC10_ENABLED +#define NRFX_RTC10_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC30_ENABLED +#define NRFX_RTC30_ENABLED 0 +#endif + +/** + * @brief NRFX_SAADC_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SAADC_ENABLED +#define NRFX_SAADC_ENABLED 0 +#endif + +/** + * @brief NRFX_SAADC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_SAADC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_SAADC_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_SAADC_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SAADC_CONFIG_LOG_ENABLED +#define NRFX_SAADC_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_SAADC_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_SAADC_CONFIG_LOG_LEVEL +#define NRFX_SAADC_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_SPIM_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM_ENABLED +#define NRFX_SPIM_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_SPIM_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM_CONFIG_LOG_ENABLED +#define NRFX_SPIM_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_SPIM_CONFIG_LOG_LEVEL +#define NRFX_SPIM_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_SPIM00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM00_ENABLED +#define NRFX_SPIM00_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM20_ENABLED +#define NRFX_SPIM20_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM21_ENABLED +#define NRFX_SPIM21_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM22_ENABLED +#define NRFX_SPIM22_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM30_ENABLED +#define NRFX_SPIM30_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS_ENABLED +#define NRFX_SPIS_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_SPIS_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_SPIS_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_SPIS_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS_CONFIG_LOG_ENABLED +#define NRFX_SPIS_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_SPIS_CONFIG_LOG_LEVEL +#define NRFX_SPIS_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_SPIS00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS00_ENABLED +#define NRFX_SPIS00_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS20_ENABLED +#define NRFX_SPIS20_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS21_ENABLED +#define NRFX_SPIS21_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS22_ENABLED +#define NRFX_SPIS22_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS30_ENABLED +#define NRFX_SPIS30_ENABLED 0 +#endif + +/** + * @brief NRFX_TEMP_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TEMP_ENABLED +#define NRFX_TEMP_ENABLED 0 +#endif + +/** + * @brief NRFX_TEMP_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_TEMP_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_TEMP_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_TEMP_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TEMP_CONFIG_LOG_ENABLED +#define NRFX_TEMP_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_TEMP_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_TEMP_CONFIG_LOG_LEVEL +#define NRFX_TEMP_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_TIMER_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER_ENABLED +#define NRFX_TIMER_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_TIMER_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER_CONFIG_LOG_ENABLED +#define NRFX_TIMER_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_TIMER_CONFIG_LOG_LEVEL +#define NRFX_TIMER_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_TIMER00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER00_ENABLED +#define NRFX_TIMER00_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER10_ENABLED +#define NRFX_TIMER10_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER20_ENABLED +#define NRFX_TIMER20_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER21_ENABLED +#define NRFX_TIMER21_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER22_ENABLED +#define NRFX_TIMER22_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER23_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER23_ENABLED +#define NRFX_TIMER23_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER24_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER24_ENABLED +#define NRFX_TIMER24_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM_ENABLED +#define NRFX_TWIM_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_TWIM_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM_CONFIG_LOG_ENABLED +#define NRFX_TWIM_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_TWIM_CONFIG_LOG_LEVEL +#define NRFX_TWIM_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_TWIM20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM20_ENABLED +#define NRFX_TWIM20_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM21_ENABLED +#define NRFX_TWIM21_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM22_ENABLED +#define NRFX_TWIM22_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM30_ENABLED +#define NRFX_TWIM30_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS_ENABLED +#define NRFX_TWIS_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_TWIS_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS_CONFIG_LOG_ENABLED +#define NRFX_TWIS_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS_ASSUME_INIT_AFTER_RESET_ONLY + * Assume that any instance would be initialized only once. + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS_ASSUME_INIT_AFTER_RESET_ONLY +#define NRFX_TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0 +#endif + +/** + * @brief NRFX_TWIS_NO_SYNC_MODE - Remove support for synchronous mode. + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS_NO_SYNC_MODE +#define NRFX_TWIS_NO_SYNC_MODE 0 +#endif + +/** + * @brief NRFX_TWIS_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_TWIS_CONFIG_LOG_LEVEL +#define NRFX_TWIS_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_TWIS20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS20_ENABLED +#define NRFX_TWIS20_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS21_ENABLED +#define NRFX_TWIS21_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS22_ENABLED +#define NRFX_TWIS22_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS30_ENABLED +#define NRFX_TWIS30_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_ENABLED +#define NRFX_UARTE_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG + * If enabled, support for configuring GPIO pins is removed from the driver + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG +#define NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG 0 +#endif + +/** + * @brief NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG + * If enabled, support for configuring PSEL registers is removed from the driver + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG +#define NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG 0 +#endif + +/** + * @brief NRFX_UARTE_CONFIG_TX_LINK - If enabled, driver supports linking of TX transfers. + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_TX_LINK +#define NRFX_UARTE_CONFIG_TX_LINK 1 +#endif + +/** + * @brief NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_UARTE_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_LOG_ENABLED +#define NRFX_UARTE_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_UARTE_CONFIG_LOG_LEVEL +#define NRFX_UARTE_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_UARTE00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE00_ENABLED +#define NRFX_UARTE00_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE20_ENABLED +#define NRFX_UARTE20_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE21_ENABLED +#define NRFX_UARTE21_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE22_ENABLED +#define NRFX_UARTE22_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE30_ENABLED +#define NRFX_UARTE30_ENABLED 0 +#endif + +/** + * @brief NRFX_VEVIF_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_VEVIF_ENABLED +#define NRFX_VEVIF_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT_ENABLED +#define NRFX_WDT_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_WDT_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_WDT_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_WDT_CONFIG_NO_IRQ - Remove WDT IRQ handling from WDT driver + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT_CONFIG_NO_IRQ +#define NRFX_WDT_CONFIG_NO_IRQ 0 +#endif + +/** + * @brief NRFX_WDT_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT_CONFIG_LOG_ENABLED +#define NRFX_WDT_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_WDT_CONFIG_LOG_LEVEL +#define NRFX_WDT_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_WDT30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT30_ENABLED +#define NRFX_WDT30_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT31_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT31_ENABLED +#define NRFX_WDT31_ENABLED 0 +#endif + +#endif /* NRFX_CONFIG_NRF54L05_FLPR_H__ */ diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54l10_application.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54l10_application.h new file mode 100644 index 0000000000000..ab781f507e549 --- /dev/null +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54l10_application.h @@ -0,0 +1,1775 @@ +/* + * Copyright (c) 2024, Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef NRFX_CONFIG_NRF54L10_APPLICATION_H__ +#define NRFX_CONFIG_NRF54L10_APPLICATION_H__ + +#ifndef NRFX_CONFIG_H__ +#error "This file should not be included directly. Include nrfx_config.h instead." +#endif + + +/** + * @brief NRFX_DEFAULT_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_DEFAULT_IRQ_PRIORITY +#define NRFX_DEFAULT_IRQ_PRIORITY 7 +#endif + +/** + * @brief NRFX_CLOCK_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_CLOCK_ENABLED +#define NRFX_CLOCK_ENABLED 0 +#endif + +/** + * @brief NRFX_CLOCK_CONFIG_LF_SRC + * + * Integer value. + * Supported values: + * - RC = 0 + * - XTAL = 1 + * - Synth = 2 + */ +#ifndef NRFX_CLOCK_CONFIG_LF_SRC +#define NRFX_CLOCK_CONFIG_LF_SRC 1 +#endif + +/** + * @brief NRFX_CLOCK_CONFIG_LF_CAL_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_CLOCK_CONFIG_LF_CAL_ENABLED +#define NRFX_CLOCK_CONFIG_LF_CAL_ENABLED 0 +#endif + +/** + * @brief NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED +#define NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED 0 +#endif + +/** + * @brief NRFX_CLOCK_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_CLOCK_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_CLOCK_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_CLOCK_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_CLOCK_CONFIG_LOG_ENABLED +#define NRFX_CLOCK_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_CLOCK_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_CLOCK_CONFIG_LOG_LEVEL +#define NRFX_CLOCK_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_COMP_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_COMP_ENABLED +#define NRFX_COMP_ENABLED 0 +#endif + +/** + * @brief NRFX_COMP_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_COMP_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_COMP_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_COMP_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_COMP_CONFIG_LOG_ENABLED +#define NRFX_COMP_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_COMP_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_COMP_CONFIG_LOG_LEVEL +#define NRFX_COMP_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_DPPI_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI_ENABLED +#define NRFX_DPPI_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI_CONFIG_LOG_ENABLED +#define NRFX_DPPI_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_DPPI_CONFIG_LOG_LEVEL +#define NRFX_DPPI_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_DPPI00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI00_ENABLED +#define NRFX_DPPI00_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI10_ENABLED +#define NRFX_DPPI10_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI20_ENABLED +#define NRFX_DPPI20_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI30_ENABLED +#define NRFX_DPPI30_ENABLED 0 +#endif + +/** + * @brief NRFX_EGU_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_EGU_ENABLED +#define NRFX_EGU_ENABLED 0 +#endif + +/** + * @brief NRFX_EGU_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_EGU_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_EGU_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_EGU10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_EGU10_ENABLED +#define NRFX_EGU10_ENABLED 0 +#endif + +/** + * @brief NRFX_EGU20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_EGU20_ENABLED +#define NRFX_EGU20_ENABLED 0 +#endif + +/** + * @brief NRFX_GPIOTE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE_ENABLED +#define NRFX_GPIOTE_ENABLED 0 +#endif + +/** + * @brief NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS + * + * Integer value. Minimum: 0. Maximum: 15. + */ +#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS +#define NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS 2 +#endif + +/** + * @brief NRFX_GPIOTE_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE_CONFIG_LOG_ENABLED +#define NRFX_GPIOTE_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_GPIOTE_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_GPIOTE_CONFIG_LOG_LEVEL +#define NRFX_GPIOTE_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_GPIOTE20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE20_ENABLED +#define NRFX_GPIOTE20_ENABLED 0 +#endif + +/** + * @brief NRFX_GPIOTE30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE30_ENABLED +#define NRFX_GPIOTE30_ENABLED 0 +#endif + +/** + * @brief NRFX_GRTC_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GRTC_ENABLED +#define NRFX_GRTC_ENABLED 0 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_AUTOEN + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GRTC_CONFIG_AUTOEN +#define NRFX_GRTC_CONFIG_AUTOEN 1 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_AUTOSTART + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GRTC_CONFIG_AUTOSTART +#define NRFX_GRTC_CONFIG_AUTOSTART 1 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_CLEAR_AT_INIT + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GRTC_CONFIG_CLEAR_AT_INIT +#define NRFX_GRTC_CONFIG_CLEAR_AT_INIT 0 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS + * + * Integer value. + */ +#ifndef NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS +#define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS 8 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK + */ +#ifndef NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK +#define NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK 0x00000f0f +#endif + +/** + * @brief NRFX_GRTC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_GRTC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_GRTC_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_GRTC_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GRTC_CONFIG_LOG_ENABLED +#define NRFX_GRTC_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_GRTC_CONFIG_LOG_LEVEL +#define NRFX_GRTC_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_I2S_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S_ENABLED +#define NRFX_I2S_ENABLED 0 +#endif + +/** + * @brief NRFX_I2S_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_I2S_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_I2S_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_I2S_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S_CONFIG_LOG_ENABLED +#define NRFX_I2S_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_I2S_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_I2S_CONFIG_LOG_LEVEL +#define NRFX_I2S_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_I2S20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S20_ENABLED +#define NRFX_I2S20_ENABLED 0 +#endif + +/** + * @brief NRFX_LPCOMP_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_LPCOMP_ENABLED +#define NRFX_LPCOMP_ENABLED 0 +#endif + +/** + * @brief NRFX_LPCOMP_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_LPCOMP_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_LPCOMP_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_LPCOMP_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_LPCOMP_CONFIG_LOG_ENABLED +#define NRFX_LPCOMP_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_LPCOMP_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_LPCOMP_CONFIG_LOG_LEVEL +#define NRFX_LPCOMP_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_NFCT_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_NFCT_ENABLED +#define NRFX_NFCT_ENABLED 0 +#endif + +/** + * @brief NRFX_NFCT_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_NFCT_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_NFCT_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_NFCT_CONFIG_TIMER_INSTANCE_ID - Timer instance used for workarounds in the driver. + * + * Integer value. Minimum: 0. Maximum: 5. + */ +#ifndef NRFX_NFCT_CONFIG_TIMER_INSTANCE_ID +#define NRFX_NFCT_CONFIG_TIMER_INSTANCE_ID 0 +#endif + +/** + * @brief NRFX_NFCT_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_NFCT_CONFIG_LOG_ENABLED +#define NRFX_NFCT_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_NFCT_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_NFCT_CONFIG_LOG_LEVEL +#define NRFX_NFCT_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PDM_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PDM_ENABLED +#define NRFX_PDM_ENABLED 0 +#endif + +/** + * @brief NRFX_PDM_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_PDM_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_PDM_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_PDM_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PDM_CONFIG_LOG_ENABLED +#define NRFX_PDM_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_PDM_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_PDM_CONFIG_LOG_LEVEL +#define NRFX_PDM_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PDM20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PDM20_ENABLED +#define NRFX_PDM20_ENABLED 0 +#endif + +/** + * @brief NRFX_PDM21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PDM21_ENABLED +#define NRFX_PDM21_ENABLED 0 +#endif + +/** + * @brief NRFX_POWER_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_POWER_ENABLED +#define NRFX_POWER_ENABLED 0 +#endif + +/** + * @brief NRFX_POWER_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_POWER_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_POWER_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_PPIB_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB_ENABLED +#define NRFX_PPIB_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB_CONFIG_LOG_ENABLED +#define NRFX_PPIB_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_PPIB_CONFIG_LOG_LEVEL +#define NRFX_PPIB_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PPIB00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB00_ENABLED +#define NRFX_PPIB00_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB01_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB01_ENABLED +#define NRFX_PPIB01_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB10_ENABLED +#define NRFX_PPIB10_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB11_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB11_ENABLED +#define NRFX_PPIB11_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB20_ENABLED +#define NRFX_PPIB20_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB21_ENABLED +#define NRFX_PPIB21_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB22_ENABLED +#define NRFX_PPIB22_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB30_ENABLED +#define NRFX_PPIB30_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_ENABLED +#define NRFX_PRS_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_CONFIG_LOG_ENABLED +#define NRFX_PRS_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_PRS_CONFIG_LOG_LEVEL +#define NRFX_PRS_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PRS_BOX_0_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_0_ENABLED +#define NRFX_PRS_BOX_0_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_1_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_1_ENABLED +#define NRFX_PRS_BOX_1_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_2_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_2_ENABLED +#define NRFX_PRS_BOX_2_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_3_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_3_ENABLED +#define NRFX_PRS_BOX_3_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_4_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_4_ENABLED +#define NRFX_PRS_BOX_4_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_5_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_5_ENABLED +#define NRFX_PRS_BOX_5_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM_ENABLED +#define NRFX_PWM_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_PWM_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_PWM_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_PWM_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM_CONFIG_LOG_ENABLED +#define NRFX_PWM_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_PWM_CONFIG_LOG_LEVEL +#define NRFX_PWM_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PWM20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM20_ENABLED +#define NRFX_PWM20_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM21_ENABLED +#define NRFX_PWM21_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM22_ENABLED +#define NRFX_PWM22_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC_ENABLED +#define NRFX_QDEC_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_QDEC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_QDEC_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_QDEC_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC_CONFIG_LOG_ENABLED +#define NRFX_QDEC_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_QDEC_CONFIG_LOG_LEVEL +#define NRFX_QDEC_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_QDEC20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC20_ENABLED +#define NRFX_QDEC20_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC21_ENABLED +#define NRFX_QDEC21_ENABLED 0 +#endif + +/** + * @brief NRFX_RRAMC_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RRAMC_ENABLED +#define NRFX_RRAMC_ENABLED 0 +#endif + +/** + * @brief NRFX_RRAMC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_RRAMC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_RRAMC_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_RRAMC_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RRAMC_CONFIG_LOG_ENABLED +#define NRFX_RRAMC_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_RRAMC_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_RRAMC_CONFIG_LOG_LEVEL +#define NRFX_RRAMC_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_RTC_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC_ENABLED +#define NRFX_RTC_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_RTC_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC_CONFIG_LOG_ENABLED +#define NRFX_RTC_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_RTC_CONFIG_LOG_LEVEL +#define NRFX_RTC_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_RTC10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC10_ENABLED +#define NRFX_RTC10_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC30_ENABLED +#define NRFX_RTC30_ENABLED 0 +#endif + +/** + * @brief NRFX_SAADC_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SAADC_ENABLED +#define NRFX_SAADC_ENABLED 0 +#endif + +/** + * @brief NRFX_SAADC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_SAADC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_SAADC_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_SAADC_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SAADC_CONFIG_LOG_ENABLED +#define NRFX_SAADC_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_SAADC_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_SAADC_CONFIG_LOG_LEVEL +#define NRFX_SAADC_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_SPIM_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM_ENABLED +#define NRFX_SPIM_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_SPIM_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM_CONFIG_LOG_ENABLED +#define NRFX_SPIM_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_SPIM_CONFIG_LOG_LEVEL +#define NRFX_SPIM_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_SPIM00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM00_ENABLED +#define NRFX_SPIM00_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM20_ENABLED +#define NRFX_SPIM20_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM21_ENABLED +#define NRFX_SPIM21_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM22_ENABLED +#define NRFX_SPIM22_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM30_ENABLED +#define NRFX_SPIM30_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS_ENABLED +#define NRFX_SPIS_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_SPIS_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_SPIS_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_SPIS_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS_CONFIG_LOG_ENABLED +#define NRFX_SPIS_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_SPIS_CONFIG_LOG_LEVEL +#define NRFX_SPIS_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_SPIS00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS00_ENABLED +#define NRFX_SPIS00_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS20_ENABLED +#define NRFX_SPIS20_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS21_ENABLED +#define NRFX_SPIS21_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS22_ENABLED +#define NRFX_SPIS22_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS30_ENABLED +#define NRFX_SPIS30_ENABLED 0 +#endif + +/** + * @brief NRFX_SYSTICK_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SYSTICK_ENABLED +#define NRFX_SYSTICK_ENABLED 0 +#endif + +/** + * @brief NRFX_TEMP_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TEMP_ENABLED +#define NRFX_TEMP_ENABLED 0 +#endif + +/** + * @brief NRFX_TEMP_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_TEMP_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_TEMP_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_TEMP_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TEMP_CONFIG_LOG_ENABLED +#define NRFX_TEMP_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_TEMP_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_TEMP_CONFIG_LOG_LEVEL +#define NRFX_TEMP_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_TIMER_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER_ENABLED +#define NRFX_TIMER_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_TIMER_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER_CONFIG_LOG_ENABLED +#define NRFX_TIMER_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_TIMER_CONFIG_LOG_LEVEL +#define NRFX_TIMER_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_TIMER00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER00_ENABLED +#define NRFX_TIMER00_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER10_ENABLED +#define NRFX_TIMER10_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER20_ENABLED +#define NRFX_TIMER20_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER21_ENABLED +#define NRFX_TIMER21_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER22_ENABLED +#define NRFX_TIMER22_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER23_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER23_ENABLED +#define NRFX_TIMER23_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER24_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER24_ENABLED +#define NRFX_TIMER24_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM_ENABLED +#define NRFX_TWIM_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_TWIM_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM_CONFIG_LOG_ENABLED +#define NRFX_TWIM_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_TWIM_CONFIG_LOG_LEVEL +#define NRFX_TWIM_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_TWIM20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM20_ENABLED +#define NRFX_TWIM20_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM21_ENABLED +#define NRFX_TWIM21_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM22_ENABLED +#define NRFX_TWIM22_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM30_ENABLED +#define NRFX_TWIM30_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS_ENABLED +#define NRFX_TWIS_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_TWIS_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS_CONFIG_LOG_ENABLED +#define NRFX_TWIS_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS_ASSUME_INIT_AFTER_RESET_ONLY + * Assume that any instance would be initialized only once. + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS_ASSUME_INIT_AFTER_RESET_ONLY +#define NRFX_TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0 +#endif + +/** + * @brief NRFX_TWIS_NO_SYNC_MODE - Remove support for synchronous mode. + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS_NO_SYNC_MODE +#define NRFX_TWIS_NO_SYNC_MODE 0 +#endif + +/** + * @brief NRFX_TWIS_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_TWIS_CONFIG_LOG_LEVEL +#define NRFX_TWIS_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_TWIS20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS20_ENABLED +#define NRFX_TWIS20_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS21_ENABLED +#define NRFX_TWIS21_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS22_ENABLED +#define NRFX_TWIS22_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS30_ENABLED +#define NRFX_TWIS30_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_ENABLED +#define NRFX_UARTE_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG + * If enabled, support for configuring GPIO pins is removed from the driver + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG +#define NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG 0 +#endif + +/** + * @brief NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG + * If enabled, support for configuring PSEL registers is removed from the driver + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG +#define NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG 0 +#endif + +/** + * @brief NRFX_UARTE_CONFIG_TX_LINK - If enabled, driver supports linking of TX transfers. + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_TX_LINK +#define NRFX_UARTE_CONFIG_TX_LINK 1 +#endif + +/** + * @brief NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_UARTE_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_LOG_ENABLED +#define NRFX_UARTE_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_UARTE_CONFIG_LOG_LEVEL +#define NRFX_UARTE_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_UARTE00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE00_ENABLED +#define NRFX_UARTE00_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE20_ENABLED +#define NRFX_UARTE20_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE21_ENABLED +#define NRFX_UARTE21_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE22_ENABLED +#define NRFX_UARTE22_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE30_ENABLED +#define NRFX_UARTE30_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT_ENABLED +#define NRFX_WDT_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 7. + */ +#ifndef NRFX_WDT_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_WDT_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_WDT_CONFIG_NO_IRQ - Remove WDT IRQ handling from WDT driver + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT_CONFIG_NO_IRQ +#define NRFX_WDT_CONFIG_NO_IRQ 0 +#endif + +/** + * @brief NRFX_WDT_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT_CONFIG_LOG_ENABLED +#define NRFX_WDT_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_WDT_CONFIG_LOG_LEVEL +#define NRFX_WDT_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_WDT30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT30_ENABLED +#define NRFX_WDT30_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT31_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT31_ENABLED +#define NRFX_WDT31_ENABLED 0 +#endif + +#endif /* NRFX_CONFIG_NRF54L10_APPLICATION_H__ */ diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54l10_flpr.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54l10_flpr.h new file mode 100644 index 0000000000000..784cb0435a18d --- /dev/null +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54l10_flpr.h @@ -0,0 +1,1784 @@ +/* + * Copyright (c) 2024, Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef NRFX_CONFIG_NRF54L10_FLPR_H__ +#define NRFX_CONFIG_NRF54L10_FLPR_H__ + +#ifndef NRFX_CONFIG_H__ +#error "This file should not be included directly. Include nrfx_config.h instead." +#endif + + +/** + * @brief NRFX_DEFAULT_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_DEFAULT_IRQ_PRIORITY +#define NRFX_DEFAULT_IRQ_PRIORITY 0 +#endif + +/** + * @brief NRFX_CLOCK_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_CLOCK_ENABLED +#define NRFX_CLOCK_ENABLED 0 +#endif + +/** + * @brief NRFX_CLOCK_CONFIG_LF_SRC + * + * Integer value. + * Supported values: + * - RC = 0 + * - XTAL = 1 + * - Synth = 2 + */ +#ifndef NRFX_CLOCK_CONFIG_LF_SRC +#define NRFX_CLOCK_CONFIG_LF_SRC 1 +#endif + +/** + * @brief NRFX_CLOCK_CONFIG_LF_CAL_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_CLOCK_CONFIG_LF_CAL_ENABLED +#define NRFX_CLOCK_CONFIG_LF_CAL_ENABLED 0 +#endif + +/** + * @brief NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED +#define NRFX_CLOCK_CONFIG_LFXO_TWO_STAGE_ENABLED 0 +#endif + +/** + * @brief NRFX_CLOCK_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_CLOCK_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_CLOCK_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_CLOCK_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_CLOCK_CONFIG_LOG_ENABLED +#define NRFX_CLOCK_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_CLOCK_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_CLOCK_CONFIG_LOG_LEVEL +#define NRFX_CLOCK_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_COMP_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_COMP_ENABLED +#define NRFX_COMP_ENABLED 0 +#endif + +/** + * @brief NRFX_COMP_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_COMP_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_COMP_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_COMP_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_COMP_CONFIG_LOG_ENABLED +#define NRFX_COMP_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_COMP_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_COMP_CONFIG_LOG_LEVEL +#define NRFX_COMP_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_COREDEP_VPR_LEGACY + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_COREDEP_VPR_LEGACY +#define NRFX_COREDEP_VPR_LEGACY 0 +#endif + +/** + * @brief NRFX_DPPI_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI_ENABLED +#define NRFX_DPPI_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI_CONFIG_LOG_ENABLED +#define NRFX_DPPI_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_DPPI_CONFIG_LOG_LEVEL +#define NRFX_DPPI_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_DPPI00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI00_ENABLED +#define NRFX_DPPI00_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI10_ENABLED +#define NRFX_DPPI10_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI20_ENABLED +#define NRFX_DPPI20_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI30_ENABLED +#define NRFX_DPPI30_ENABLED 0 +#endif + +/** + * @brief NRFX_EGU_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_EGU_ENABLED +#define NRFX_EGU_ENABLED 0 +#endif + +/** + * @brief NRFX_EGU_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_EGU_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_EGU_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_EGU10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_EGU10_ENABLED +#define NRFX_EGU10_ENABLED 0 +#endif + +/** + * @brief NRFX_EGU20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_EGU20_ENABLED +#define NRFX_EGU20_ENABLED 0 +#endif + +/** + * @brief NRFX_GPIOTE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE_ENABLED +#define NRFX_GPIOTE_ENABLED 0 +#endif + +/** + * @brief NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS + * + * Integer value. Minimum: 0. Maximum: 15. + */ +#ifndef NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS +#define NRFX_GPIOTE_CONFIG_NUM_OF_EVT_HANDLERS 2 +#endif + +/** + * @brief NRFX_GPIOTE_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE_CONFIG_LOG_ENABLED +#define NRFX_GPIOTE_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_GPIOTE_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_GPIOTE_CONFIG_LOG_LEVEL +#define NRFX_GPIOTE_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_GPIOTE20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE20_ENABLED +#define NRFX_GPIOTE20_ENABLED 0 +#endif + +/** + * @brief NRFX_GPIOTE30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GPIOTE30_ENABLED +#define NRFX_GPIOTE30_ENABLED 0 +#endif + +/** + * @brief NRFX_GRTC_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GRTC_ENABLED +#define NRFX_GRTC_ENABLED 0 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_AUTOEN + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GRTC_CONFIG_AUTOEN +#define NRFX_GRTC_CONFIG_AUTOEN 1 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_AUTOSTART + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GRTC_CONFIG_AUTOSTART +#define NRFX_GRTC_CONFIG_AUTOSTART 0 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_CLEAR_AT_INIT + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GRTC_CONFIG_CLEAR_AT_INIT +#define NRFX_GRTC_CONFIG_CLEAR_AT_INIT 0 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS + * + * Integer value. + */ +#ifndef NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS +#define NRFX_GRTC_CONFIG_NUM_OF_CC_CHANNELS 4 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK + */ +#ifndef NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK +#define NRFX_GRTC_CONFIG_ALLOWED_CC_CHANNELS_MASK 0x000000f0 +#endif + +/** + * @brief NRFX_GRTC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_GRTC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_GRTC_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_GRTC_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_GRTC_CONFIG_LOG_ENABLED +#define NRFX_GRTC_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_GRTC_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_GRTC_CONFIG_LOG_LEVEL +#define NRFX_GRTC_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_I2S_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S_ENABLED +#define NRFX_I2S_ENABLED 0 +#endif + +/** + * @brief NRFX_I2S_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_I2S_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_I2S_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_I2S_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S_CONFIG_LOG_ENABLED +#define NRFX_I2S_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_I2S_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_I2S_CONFIG_LOG_LEVEL +#define NRFX_I2S_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_I2S20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_I2S20_ENABLED +#define NRFX_I2S20_ENABLED 0 +#endif + +/** + * @brief NRFX_LPCOMP_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_LPCOMP_ENABLED +#define NRFX_LPCOMP_ENABLED 0 +#endif + +/** + * @brief NRFX_LPCOMP_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_LPCOMP_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_LPCOMP_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_LPCOMP_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_LPCOMP_CONFIG_LOG_ENABLED +#define NRFX_LPCOMP_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_LPCOMP_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_LPCOMP_CONFIG_LOG_LEVEL +#define NRFX_LPCOMP_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_NFCT_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_NFCT_ENABLED +#define NRFX_NFCT_ENABLED 0 +#endif + +/** + * @brief NRFX_NFCT_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_NFCT_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_NFCT_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_NFCT_CONFIG_TIMER_INSTANCE_ID - Timer instance used for workarounds in the driver. + * + * Integer value. Minimum: 0. Maximum: 5. + */ +#ifndef NRFX_NFCT_CONFIG_TIMER_INSTANCE_ID +#define NRFX_NFCT_CONFIG_TIMER_INSTANCE_ID 0 +#endif + +/** + * @brief NRFX_NFCT_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_NFCT_CONFIG_LOG_ENABLED +#define NRFX_NFCT_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_NFCT_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_NFCT_CONFIG_LOG_LEVEL +#define NRFX_NFCT_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PDM_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PDM_ENABLED +#define NRFX_PDM_ENABLED 0 +#endif + +/** + * @brief NRFX_PDM_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_PDM_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_PDM_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_PDM_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PDM_CONFIG_LOG_ENABLED +#define NRFX_PDM_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_PDM_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_PDM_CONFIG_LOG_LEVEL +#define NRFX_PDM_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PDM20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PDM20_ENABLED +#define NRFX_PDM20_ENABLED 0 +#endif + +/** + * @brief NRFX_PDM21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PDM21_ENABLED +#define NRFX_PDM21_ENABLED 0 +#endif + +/** + * @brief NRFX_POWER_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_POWER_ENABLED +#define NRFX_POWER_ENABLED 0 +#endif + +/** + * @brief NRFX_POWER_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_POWER_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_POWER_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_PPIB_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB_ENABLED +#define NRFX_PPIB_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB_CONFIG_LOG_ENABLED +#define NRFX_PPIB_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_PPIB_CONFIG_LOG_LEVEL +#define NRFX_PPIB_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PPIB00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB00_ENABLED +#define NRFX_PPIB00_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB01_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB01_ENABLED +#define NRFX_PPIB01_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB10_ENABLED +#define NRFX_PPIB10_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB11_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB11_ENABLED +#define NRFX_PPIB11_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB20_ENABLED +#define NRFX_PPIB20_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB21_ENABLED +#define NRFX_PPIB21_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB22_ENABLED +#define NRFX_PPIB22_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB30_ENABLED +#define NRFX_PPIB30_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_ENABLED +#define NRFX_PRS_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_CONFIG_LOG_ENABLED +#define NRFX_PRS_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_PRS_CONFIG_LOG_LEVEL +#define NRFX_PRS_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PRS_BOX_0_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_0_ENABLED +#define NRFX_PRS_BOX_0_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_1_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_1_ENABLED +#define NRFX_PRS_BOX_1_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_2_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_2_ENABLED +#define NRFX_PRS_BOX_2_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_3_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_3_ENABLED +#define NRFX_PRS_BOX_3_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_4_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_4_ENABLED +#define NRFX_PRS_BOX_4_ENABLED 0 +#endif + +/** + * @brief NRFX_PRS_BOX_5_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PRS_BOX_5_ENABLED +#define NRFX_PRS_BOX_5_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM_ENABLED +#define NRFX_PWM_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_PWM_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_PWM_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_PWM_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM_CONFIG_LOG_ENABLED +#define NRFX_PWM_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_PWM_CONFIG_LOG_LEVEL +#define NRFX_PWM_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PWM20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM20_ENABLED +#define NRFX_PWM20_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM21_ENABLED +#define NRFX_PWM21_ENABLED 0 +#endif + +/** + * @brief NRFX_PWM22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PWM22_ENABLED +#define NRFX_PWM22_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC_ENABLED +#define NRFX_QDEC_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_QDEC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_QDEC_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_QDEC_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC_CONFIG_LOG_ENABLED +#define NRFX_QDEC_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_QDEC_CONFIG_LOG_LEVEL +#define NRFX_QDEC_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_QDEC20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC20_ENABLED +#define NRFX_QDEC20_ENABLED 0 +#endif + +/** + * @brief NRFX_QDEC21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_QDEC21_ENABLED +#define NRFX_QDEC21_ENABLED 0 +#endif + +/** + * @brief NRFX_RRAMC_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RRAMC_ENABLED +#define NRFX_RRAMC_ENABLED 0 +#endif + +/** + * @brief NRFX_RRAMC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_RRAMC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_RRAMC_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_RRAMC_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RRAMC_CONFIG_LOG_ENABLED +#define NRFX_RRAMC_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_RRAMC_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_RRAMC_CONFIG_LOG_LEVEL +#define NRFX_RRAMC_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_RTC_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC_ENABLED +#define NRFX_RTC_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_RTC_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC_CONFIG_LOG_ENABLED +#define NRFX_RTC_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_RTC_CONFIG_LOG_LEVEL +#define NRFX_RTC_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_RTC10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC10_ENABLED +#define NRFX_RTC10_ENABLED 0 +#endif + +/** + * @brief NRFX_RTC30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_RTC30_ENABLED +#define NRFX_RTC30_ENABLED 0 +#endif + +/** + * @brief NRFX_SAADC_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SAADC_ENABLED +#define NRFX_SAADC_ENABLED 0 +#endif + +/** + * @brief NRFX_SAADC_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_SAADC_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_SAADC_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_SAADC_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SAADC_CONFIG_LOG_ENABLED +#define NRFX_SAADC_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_SAADC_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_SAADC_CONFIG_LOG_LEVEL +#define NRFX_SAADC_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_SPIM_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM_ENABLED +#define NRFX_SPIM_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_SPIM_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM_CONFIG_LOG_ENABLED +#define NRFX_SPIM_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_SPIM_CONFIG_LOG_LEVEL +#define NRFX_SPIM_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_SPIM00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM00_ENABLED +#define NRFX_SPIM00_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM20_ENABLED +#define NRFX_SPIM20_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM21_ENABLED +#define NRFX_SPIM21_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM22_ENABLED +#define NRFX_SPIM22_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIM30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIM30_ENABLED +#define NRFX_SPIM30_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS_ENABLED +#define NRFX_SPIS_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_SPIS_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_SPIS_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_SPIS_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS_CONFIG_LOG_ENABLED +#define NRFX_SPIS_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_SPIS_CONFIG_LOG_LEVEL +#define NRFX_SPIS_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_SPIS00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS00_ENABLED +#define NRFX_SPIS00_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS20_ENABLED +#define NRFX_SPIS20_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS21_ENABLED +#define NRFX_SPIS21_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS22_ENABLED +#define NRFX_SPIS22_ENABLED 0 +#endif + +/** + * @brief NRFX_SPIS30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_SPIS30_ENABLED +#define NRFX_SPIS30_ENABLED 0 +#endif + +/** + * @brief NRFX_TEMP_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TEMP_ENABLED +#define NRFX_TEMP_ENABLED 0 +#endif + +/** + * @brief NRFX_TEMP_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_TEMP_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_TEMP_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_TEMP_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TEMP_CONFIG_LOG_ENABLED +#define NRFX_TEMP_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_TEMP_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_TEMP_CONFIG_LOG_LEVEL +#define NRFX_TEMP_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_TIMER_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER_ENABLED +#define NRFX_TIMER_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_TIMER_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER_CONFIG_LOG_ENABLED +#define NRFX_TIMER_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_TIMER_CONFIG_LOG_LEVEL +#define NRFX_TIMER_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_TIMER00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER00_ENABLED +#define NRFX_TIMER00_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER10_ENABLED +#define NRFX_TIMER10_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER20_ENABLED +#define NRFX_TIMER20_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER21_ENABLED +#define NRFX_TIMER21_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER22_ENABLED +#define NRFX_TIMER22_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER23_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER23_ENABLED +#define NRFX_TIMER23_ENABLED 0 +#endif + +/** + * @brief NRFX_TIMER24_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TIMER24_ENABLED +#define NRFX_TIMER24_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM_ENABLED +#define NRFX_TWIM_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_TWIM_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM_CONFIG_LOG_ENABLED +#define NRFX_TWIM_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_TWIM_CONFIG_LOG_LEVEL +#define NRFX_TWIM_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_TWIM20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM20_ENABLED +#define NRFX_TWIM20_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM21_ENABLED +#define NRFX_TWIM21_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM22_ENABLED +#define NRFX_TWIM22_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIM30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIM30_ENABLED +#define NRFX_TWIM30_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS_ENABLED +#define NRFX_TWIS_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_TWIS_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS_CONFIG_LOG_ENABLED +#define NRFX_TWIS_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS_ASSUME_INIT_AFTER_RESET_ONLY + * Assume that any instance would be initialized only once. + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS_ASSUME_INIT_AFTER_RESET_ONLY +#define NRFX_TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0 +#endif + +/** + * @brief NRFX_TWIS_NO_SYNC_MODE - Remove support for synchronous mode. + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS_NO_SYNC_MODE +#define NRFX_TWIS_NO_SYNC_MODE 0 +#endif + +/** + * @brief NRFX_TWIS_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_TWIS_CONFIG_LOG_LEVEL +#define NRFX_TWIS_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_TWIS20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS20_ENABLED +#define NRFX_TWIS20_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS21_ENABLED +#define NRFX_TWIS21_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS22_ENABLED +#define NRFX_TWIS22_ENABLED 0 +#endif + +/** + * @brief NRFX_TWIS30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_TWIS30_ENABLED +#define NRFX_TWIS30_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_ENABLED +#define NRFX_UARTE_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG + * If enabled, support for configuring GPIO pins is removed from the driver + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG +#define NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG 0 +#endif + +/** + * @brief NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG + * If enabled, support for configuring PSEL registers is removed from the driver + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG +#define NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG 0 +#endif + +/** + * @brief NRFX_UARTE_CONFIG_TX_LINK - If enabled, driver supports linking of TX transfers. + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_TX_LINK +#define NRFX_UARTE_CONFIG_TX_LINK 1 +#endif + +/** + * @brief NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_UARTE_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE_CONFIG_LOG_ENABLED +#define NRFX_UARTE_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_UARTE_CONFIG_LOG_LEVEL +#define NRFX_UARTE_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_UARTE00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE00_ENABLED +#define NRFX_UARTE00_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE20_ENABLED +#define NRFX_UARTE20_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE21_ENABLED +#define NRFX_UARTE21_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE22_ENABLED +#define NRFX_UARTE22_ENABLED 0 +#endif + +/** + * @brief NRFX_UARTE30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_UARTE30_ENABLED +#define NRFX_UARTE30_ENABLED 0 +#endif + +/** + * @brief NRFX_VEVIF_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_VEVIF_ENABLED +#define NRFX_VEVIF_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT_ENABLED +#define NRFX_WDT_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT_DEFAULT_CONFIG_IRQ_PRIORITY + * + * Integer value. Minimum: 0. Maximum: 3. + */ +#ifndef NRFX_WDT_DEFAULT_CONFIG_IRQ_PRIORITY +#define NRFX_WDT_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY +#endif + +/** + * @brief NRFX_WDT_CONFIG_NO_IRQ - Remove WDT IRQ handling from WDT driver + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT_CONFIG_NO_IRQ +#define NRFX_WDT_CONFIG_NO_IRQ 0 +#endif + +/** + * @brief NRFX_WDT_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT_CONFIG_LOG_ENABLED +#define NRFX_WDT_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_WDT_CONFIG_LOG_LEVEL +#define NRFX_WDT_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_WDT30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT30_ENABLED +#define NRFX_WDT30_ENABLED 0 +#endif + +/** + * @brief NRFX_WDT31_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_WDT31_ENABLED +#define NRFX_WDT31_ENABLED 0 +#endif + +#endif /* NRFX_CONFIG_NRF54L10_FLPR_H__ */ diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_application.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_application.h index e423c8b515d71..cf49a5f4fa6ce 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_application.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_application.h @@ -136,6 +136,15 @@ #define NRFX_COMP_CONFIG_LOG_LEVEL 3 #endif +/** + * @brief NRFX_DPPI_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI_ENABLED +#define NRFX_DPPI_ENABLED 0 +#endif + /** * @brief NRFX_DPPI_CONFIG_LOG_ENABLED * @@ -160,6 +169,42 @@ #define NRFX_DPPI_CONFIG_LOG_LEVEL 3 #endif +/** + * @brief NRFX_DPPI00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI00_ENABLED +#define NRFX_DPPI00_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI10_ENABLED +#define NRFX_DPPI10_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI20_ENABLED +#define NRFX_DPPI20_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI30_ENABLED +#define NRFX_DPPI30_ENABLED 0 +#endif + /** * @brief NRFX_EGU_ENABLED * @@ -274,22 +319,13 @@ #define NRFX_GRTC_ENABLED 0 #endif -/** - * @brief NRFX_GRTC_CONFIG_SLEEP_ALLOWED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_GRTC_CONFIG_SLEEP_ALLOWED -#define NRFX_GRTC_CONFIG_SLEEP_ALLOWED 0 -#endif - /** * @brief NRFX_GRTC_CONFIG_AUTOEN * * Boolean. Accepted values: 0 and 1. */ #ifndef NRFX_GRTC_CONFIG_AUTOEN -#define NRFX_GRTC_CONFIG_AUTOEN 0 +#define NRFX_GRTC_CONFIG_AUTOEN 1 #endif /** @@ -581,6 +617,111 @@ #define NRFX_POWER_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY #endif +/** + * @brief NRFX_PPIB_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB_ENABLED +#define NRFX_PPIB_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB_CONFIG_LOG_ENABLED +#define NRFX_PPIB_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_PPIB_CONFIG_LOG_LEVEL +#define NRFX_PPIB_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PPIB00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB00_ENABLED +#define NRFX_PPIB00_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB01_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB01_ENABLED +#define NRFX_PPIB01_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB10_ENABLED +#define NRFX_PPIB10_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB11_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB11_ENABLED +#define NRFX_PPIB11_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB20_ENABLED +#define NRFX_PPIB20_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB21_ENABLED +#define NRFX_PPIB21_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB22_ENABLED +#define NRFX_PPIB22_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB30_ENABLED +#define NRFX_PPIB30_ENABLED 0 +#endif + /** * @brief NRFX_PRS_ENABLED * @@ -1484,15 +1625,6 @@ #define NRFX_UARTE_CONFIG_TX_LINK 1 #endif -/** - * @brief NRFX_UARTE_RX_FIFO_FLUSH_WORKAROUND_MAGIC_BYTE - * - * Integer value. Minimum: 0. Maximum: 255. - */ -#ifndef NRFX_UARTE_RX_FIFO_FLUSH_WORKAROUND_MAGIC_BYTE -#define NRFX_UARTE_RX_FIFO_FLUSH_WORKAROUND_MAGIC_BYTE 171 -#endif - /** * @brief NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY * diff --git a/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_flpr.h b/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_flpr.h index a036f8c0a261b..4d5069383378e 100644 --- a/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_flpr.h +++ b/modules/hal_nordic/nrfx/nrfx_config_nrf54l15_flpr.h @@ -145,6 +145,15 @@ #define NRFX_COREDEP_VPR_LEGACY 0 #endif +/** + * @brief NRFX_DPPI_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI_ENABLED +#define NRFX_DPPI_ENABLED 0 +#endif + /** * @brief NRFX_DPPI_CONFIG_LOG_ENABLED * @@ -169,6 +178,42 @@ #define NRFX_DPPI_CONFIG_LOG_LEVEL 3 #endif +/** + * @brief NRFX_DPPI00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI00_ENABLED +#define NRFX_DPPI00_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI10_ENABLED +#define NRFX_DPPI10_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI20_ENABLED +#define NRFX_DPPI20_ENABLED 0 +#endif + +/** + * @brief NRFX_DPPI30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_DPPI30_ENABLED +#define NRFX_DPPI30_ENABLED 0 +#endif + /** * @brief NRFX_EGU_ENABLED * @@ -283,22 +328,13 @@ #define NRFX_GRTC_ENABLED 0 #endif -/** - * @brief NRFX_GRTC_CONFIG_SLEEP_ALLOWED - * - * Boolean. Accepted values: 0 and 1. - */ -#ifndef NRFX_GRTC_CONFIG_SLEEP_ALLOWED -#define NRFX_GRTC_CONFIG_SLEEP_ALLOWED 0 -#endif - /** * @brief NRFX_GRTC_CONFIG_AUTOEN * * Boolean. Accepted values: 0 and 1. */ #ifndef NRFX_GRTC_CONFIG_AUTOEN -#define NRFX_GRTC_CONFIG_AUTOEN 0 +#define NRFX_GRTC_CONFIG_AUTOEN 1 #endif /** @@ -307,7 +343,7 @@ * Boolean. Accepted values: 0 and 1. */ #ifndef NRFX_GRTC_CONFIG_AUTOSTART -#define NRFX_GRTC_CONFIG_AUTOSTART 1 +#define NRFX_GRTC_CONFIG_AUTOSTART 0 #endif /** @@ -590,6 +626,111 @@ #define NRFX_POWER_DEFAULT_CONFIG_IRQ_PRIORITY NRFX_DEFAULT_IRQ_PRIORITY #endif +/** + * @brief NRFX_PPIB_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB_ENABLED +#define NRFX_PPIB_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB_CONFIG_LOG_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB_CONFIG_LOG_ENABLED +#define NRFX_PPIB_CONFIG_LOG_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB_CONFIG_LOG_LEVEL + * + * Integer value. + * Supported values: + * - Off = 0 + * - Error = 1 + * - Warning = 2 + * - Info = 3 + * - Debug = 4 + */ +#ifndef NRFX_PPIB_CONFIG_LOG_LEVEL +#define NRFX_PPIB_CONFIG_LOG_LEVEL 3 +#endif + +/** + * @brief NRFX_PPIB00_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB00_ENABLED +#define NRFX_PPIB00_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB01_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB01_ENABLED +#define NRFX_PPIB01_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB10_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB10_ENABLED +#define NRFX_PPIB10_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB11_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB11_ENABLED +#define NRFX_PPIB11_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB20_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB20_ENABLED +#define NRFX_PPIB20_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB21_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB21_ENABLED +#define NRFX_PPIB21_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB22_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB22_ENABLED +#define NRFX_PPIB22_ENABLED 0 +#endif + +/** + * @brief NRFX_PPIB30_ENABLED + * + * Boolean. Accepted values: 0 and 1. + */ +#ifndef NRFX_PPIB30_ENABLED +#define NRFX_PPIB30_ENABLED 0 +#endif + /** * @brief NRFX_PRS_ENABLED * @@ -1484,15 +1625,6 @@ #define NRFX_UARTE_CONFIG_TX_LINK 1 #endif -/** - * @brief NRFX_UARTE_RX_FIFO_FLUSH_WORKAROUND_MAGIC_BYTE - * - * Integer value. Minimum: 0. Maximum: 255. - */ -#ifndef NRFX_UARTE_RX_FIFO_FLUSH_WORKAROUND_MAGIC_BYTE -#define NRFX_UARTE_RX_FIFO_FLUSH_WORKAROUND_MAGIC_BYTE 171 -#endif - /** * @brief NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY * diff --git a/soc/nordic/nrf54l/Kconfig b/soc/nordic/nrf54l/Kconfig index bdebe3a7a3dd2..1a8f05ba89aae 100644 --- a/soc/nordic/nrf54l/Kconfig +++ b/soc/nordic/nrf54l/Kconfig @@ -21,15 +21,27 @@ config SOC_NRF54L_CPUAPP_COMMON select HAS_HW_NRF_RADIO_IEEE802154 select HAS_POWEROFF -config SOC_NRF54L15_CPUAPP +config SOC_NRF54L05_CPUAPP select SOC_NRF54L_CPUAPP_COMMON -config SOC_NRF54L20_ENGA_CPUAPP +config SOC_NRF54L10_CPUAPP + select SOC_NRF54L_CPUAPP_COMMON + +config SOC_NRF54L15_CPUAPP select SOC_NRF54L_CPUAPP_COMMON +config SOC_NRF54L05_CPUFLPR + depends on RISCV_CORE_NORDIC_VPR + +config SOC_NRF54L10_CPUFLPR + depends on RISCV_CORE_NORDIC_VPR + config SOC_NRF54L15_CPUFLPR depends on RISCV_CORE_NORDIC_VPR +config SOC_NRF54L20_ENGA_CPUAPP + select SOC_NRF54L_CPUAPP_COMMON + if SOC_SERIES_NRF54LX config SOC_NRF54LX_SKIP_CLOCK_CONFIG diff --git a/soc/nordic/nrf54l/Kconfig.defconfig.nrf54l15_cpuapp b/soc/nordic/nrf54l/Kconfig.defconfig.nrf54l15_cpuapp deleted file mode 100644 index 9c8e0b4e34b3f..0000000000000 --- a/soc/nordic/nrf54l/Kconfig.defconfig.nrf54l15_cpuapp +++ /dev/null @@ -1,11 +0,0 @@ -# Nordic Semiconductor nRF54L15 MCU - -# Copyright (c) 2024 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -if SOC_NRF54L15_CPUAPP - -config NUM_IRQS - default 271 - -endif # SOC_NRF54L15_CPUAPP diff --git a/soc/nordic/nrf54l/Kconfig.defconfig.nrf54l_05_10_15_cpuapp b/soc/nordic/nrf54l/Kconfig.defconfig.nrf54l_05_10_15_cpuapp new file mode 100644 index 0000000000000..ecc2e6124da3f --- /dev/null +++ b/soc/nordic/nrf54l/Kconfig.defconfig.nrf54l_05_10_15_cpuapp @@ -0,0 +1,11 @@ +# Nordic Semiconductor nRF54 L05, L10 and L15 MCUs + +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if SOC_NRF54L05_CPUAPP || SOC_NRF54L10_CPUAPP || SOC_NRF54L15_CPUAPP + +config NUM_IRQS + default 271 + +endif # SOC_NRF54L05_CPUAPP || SOC_NRF54L10_CPUAPP || SOC_NRF54L15_CPUAPP diff --git a/soc/nordic/nrf54l/Kconfig.defconfig.nrf54l15_cpuflpr b/soc/nordic/nrf54l/Kconfig.defconfig.nrf54l_05_10_15_cpuflpr similarity index 52% rename from soc/nordic/nrf54l/Kconfig.defconfig.nrf54l15_cpuflpr rename to soc/nordic/nrf54l/Kconfig.defconfig.nrf54l_05_10_15_cpuflpr index 7c653d14b9317..76af552472828 100644 --- a/soc/nordic/nrf54l/Kconfig.defconfig.nrf54l15_cpuflpr +++ b/soc/nordic/nrf54l/Kconfig.defconfig.nrf54l_05_10_15_cpuflpr @@ -1,9 +1,9 @@ -# Nordic Semiconductor nRF54L15 MCU +# Nordic Semiconductor nRF54 L05, L10 and L15 MCUs # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if SOC_NRF54L15_CPUFLPR +if SOC_NRF54L05_CPUFLPR || SOC_NRF54L10_CPUFLPR || SOC_NRF54L15_CPUFLPR config NUM_IRQS default 287 @@ -12,4 +12,4 @@ config NUM_IRQS config ASSERT default n -endif # SOC_NRF54L15_CPUFLPR +endif # SOC_NRF54L05_CPUFLPR || SOC_NRF54L10_CPUFLPR || SOC_NRF54L15_CPUFLPR diff --git a/soc/nordic/nrf54l/Kconfig.soc b/soc/nordic/nrf54l/Kconfig.soc index 25deae9fade71..f7c5adf6924e9 100644 --- a/soc/nordic/nrf54l/Kconfig.soc +++ b/soc/nordic/nrf54l/Kconfig.soc @@ -3,6 +3,42 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 +config SOC_NRF54L05 + bool + select SOC_SERIES_NRF54LX + help + NRF54L05 + +config SOC_NRF54L05_CPUAPP + bool + select SOC_NRF54L05 + help + NRF54L05 CPUAPP + +config SOC_NRF54L05_CPUFLPR + bool + select SOC_NRF54L05 + help + NRF54L05 CPUFLPR + +config SOC_NRF54L10 + bool + select SOC_SERIES_NRF54LX + help + NRF54L10 + +config SOC_NRF54L10_CPUAPP + bool + select SOC_NRF54L10 + help + NRF54L10 CPUAPP + +config SOC_NRF54L10_CPUFLPR + bool + select SOC_NRF54L10 + help + NRF54L10 CPUFLPR + config SOC_NRF54L15 bool select SOC_SERIES_NRF54LX @@ -40,5 +76,7 @@ config SOC_NRF54L20_ENGA_CPUAPP NRF54L20 ENGA CPUAPP config SOC + default "nrf54l05" if SOC_NRF54L05 + default "nrf54l10" if SOC_NRF54L10 default "nrf54l15" if SOC_NRF54L15 default "nrf54l20" if SOC_NRF54L20 diff --git a/soc/nordic/soc.yml b/soc/nordic/soc.yml index 9879f82f61aa2..ee79c7ee86826 100644 --- a/soc/nordic/soc.yml +++ b/soc/nordic/soc.yml @@ -21,6 +21,14 @@ family: - name: cpunet - name: nrf54l socs: + - name: nrf54l05 + cpuclusters: + - name: cpuapp + - name: cpuflpr + - name: nrf54l10 + cpuclusters: + - name: cpuapp + - name: cpuflpr - name: nrf54l15 cpuclusters: - name: cpuapp @@ -94,6 +102,12 @@ runners: - qualifiers: - nrf9161 - nrf9161/ns + - qualifiers: + - nrf54l05/cpuapp + - nrf54l05/cpuflpr + - qualifiers: + - nrf54l10/cpuapp + - nrf54l10/cpuflpr - qualifiers: - nrf54l15/cpuapp - nrf54l15/cpuflpr @@ -148,6 +162,12 @@ runners: - qualifiers: - nrf9161 - nrf9161/ns + - qualifiers: + - nrf54l05/cpuapp + - nrf54l05/cpuflpr + - qualifiers: + - nrf54l10/cpuapp + - nrf54l10/cpuflpr - qualifiers: - nrf54l15/cpuapp - nrf54l15/cpuflpr @@ -202,6 +222,12 @@ runners: - qualifiers: - nrf9161 - nrf9161/ns + - qualifiers: + - nrf54l05/cpuapp + - nrf54l05/cpuflpr + - qualifiers: + - nrf54l10/cpuapp + - nrf54l10/cpuflpr - qualifiers: - nrf54l15/cpuapp - nrf54l15/cpuflpr diff --git a/soc/nordic/validate_base_addresses.c b/soc/nordic/validate_base_addresses.c index 07ae94a233bb5..f47c3dc456ed9 100644 --- a/soc/nordic/validate_base_addresses.c +++ b/soc/nordic/validate_base_addresses.c @@ -338,7 +338,7 @@ CHECK_DT_REG(usbreg, NRF_USBREGULATOR); CHECK_DT_REG(vmc, NRF_VMC); CHECK_DT_REG(cpuflpr_clic, NRF_FLPR_VPRCLIC); CHECK_DT_REG(cpuppr_clic, NRF_PPR_VPRCLIC); -#if defined(CONFIG_SOC_NRF54L15) +#if defined(CONFIG_SOC_NRF54L05) || defined(CONFIG_SOC_NRF54L10) || defined(CONFIG_SOC_NRF54L15) CHECK_DT_REG(cpuflpr_vpr, NRF_VPR00); #elif defined(CONFIG_NRF_PLATFORM_HALTIUM) CHECK_DT_REG(cpuflpr_vpr, NRF_VPR121); diff --git a/tests/drivers/flash/negative_tests/src/main.c b/tests/drivers/flash/negative_tests/src/main.c index 2c4eac7c6a804..f4d5751ba2070 100644 --- a/tests/drivers/flash/negative_tests/src/main.c +++ b/tests/drivers/flash/negative_tests/src/main.c @@ -26,7 +26,7 @@ #define TEST_AREA_SIZE FIXED_PARTITION_SIZE(TEST_AREA) #define TEST_AREA_DEVICE FIXED_PARTITION_DEVICE(TEST_AREA) -#if defined(CONFIG_SOC_NRF54L15) +#if defined(CONFIG_SOC_NRF54L05) || defined(CONFIG_SOC_NRF54L10) || defined(CONFIG_SOC_NRF54L15) #define TEST_FLASH_START (DT_REG_ADDR(DT_MEM_FROM_FIXED_PARTITION(DT_NODELABEL(TEST_AREA)))) #define TEST_FLASH_SIZE (DT_REG_SIZE(DT_MEM_FROM_FIXED_PARTITION(DT_NODELABEL(TEST_AREA)))) #elif defined(CONFIG_SOC_NRF54H20) diff --git a/tests/drivers/mbox/mbox_error_cases/src/main.c b/tests/drivers/mbox/mbox_error_cases/src/main.c index 555a89e288383..54a4a628ec239 100644 --- a/tests/drivers/mbox/mbox_error_cases/src/main.c +++ b/tests/drivers/mbox/mbox_error_cases/src/main.c @@ -10,7 +10,8 @@ int dummy_value; -#if defined(CONFIG_SOC_NRF54L15) || defined(CONFIG_SOC_NRF54H20) +#if defined(CONFIG_SOC_NRF54L05) || defined(CONFIG_SOC_NRF54L10) || \ + defined(CONFIG_SOC_NRF54L15) || defined(CONFIG_SOC_NRF54H20) #define EXPECTED_MTU_VALUE (0) #define DATA_TRANSFER_MODE_SUPPORTED (0) #define REMOTE_BUSY_SUPPORTED (0) diff --git a/tests/drivers/watchdog/wdt_error_cases/src/main.c b/tests/drivers/watchdog/wdt_error_cases/src/main.c index b05bedf01c337..3182cdebd034d 100644 --- a/tests/drivers/watchdog/wdt_error_cases/src/main.c +++ b/tests/drivers/watchdog/wdt_error_cases/src/main.c @@ -42,7 +42,8 @@ #define DEFAULT_WINDOW_MIN (0U) /* Align tests to the specific target: */ -#if defined(CONFIG_SOC_NRF54L15) || defined(CONFIG_SOC_NRF54H20) || defined(CONFIG_SOC_NRF9280) +#if defined(CONFIG_SOC_NRF54L05) || defined(CONFIG_SOC_NRF54L10) || \ + defined(CONFIG_SOC_NRF54L15) || defined(CONFIG_SOC_NRF54H20) || defined(CONFIG_SOC_NRF9280) #define WDT_TEST_FLAGS \ (WDT_DISABLE_SUPPORTED | WDT_FLAG_RESET_SOC_SUPPORTED | \ WDT_FLAG_ONLY_ONE_TIMEOUT_VALUE_SUPPORTED | WDT_OPT_PAUSE_IN_SLEEP_SUPPORTED | \ diff --git a/tests/kernel/interrupt/src/nested_irq.c b/tests/kernel/interrupt/src/nested_irq.c index 6d84dda2ef8e3..d488be5b42684 100644 --- a/tests/kernel/interrupt/src/nested_irq.c +++ b/tests/kernel/interrupt/src/nested_irq.c @@ -56,7 +56,7 @@ */ #define IRQ0_PRIO IRQ_DEFAULT_PRIORITY #define IRQ1_PRIO 0x0 -#elif defined(CONFIG_SOC_NRF54L15_CPUFLPR) +#elif defined(CONFIG_SOC_SERIES_NRF54LX) && defined(CONFIG_RISCV_CORE_NORDIC_VPR) #define IRQ0_LINE 16 #define IRQ1_LINE 17 From 1b84958f5a99de356b2938e9628f086fab1c0fce Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Wed, 6 Nov 2024 18:04:56 +0100 Subject: [PATCH 2942/4482] boards: nordic: nrf54l15dk: Rename the board common file Use the rather logical convention for the name that is applied to other Nordic boards: _common.dtsi for definitions that are common to the board itself (LEDs, buttons, etc). Signed-off-by: Carles Cufi --- boards/nordic/nrf54l15dk/nrf54l15_cpuapp_common.dtsi | 2 +- .../{nrf54l15dk_nrf54l15-common.dtsi => nrf54l15dk_common.dtsi} | 0 boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuflpr.dts | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename boards/nordic/nrf54l15dk/{nrf54l15dk_nrf54l15-common.dtsi => nrf54l15dk_common.dtsi} (100%) diff --git a/boards/nordic/nrf54l15dk/nrf54l15_cpuapp_common.dtsi b/boards/nordic/nrf54l15dk/nrf54l15_cpuapp_common.dtsi index 191babb632f6e..f8714861936e4 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15_cpuapp_common.dtsi +++ b/boards/nordic/nrf54l15dk/nrf54l15_cpuapp_common.dtsi @@ -7,7 +7,7 @@ /* This file is common to the secure and non-secure domain */ #include -#include "nrf54l15dk_nrf54l15-common.dtsi" +#include "nrf54l15dk_common.dtsi" / { chosen { diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15-common.dtsi b/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi similarity index 100% rename from boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15-common.dtsi rename to boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuflpr.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuflpr.dts index 472e3f2b8d38b..2bc4ba292bed6 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuflpr.dts +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuflpr.dts @@ -6,7 +6,7 @@ /dts-v1/; #include -#include "nrf54l15dk_nrf54l15-common.dtsi" +#include "nrf54l15dk_common.dtsi" / { model = "Nordic nRF54L15 DK nRF54L15 FLPR MCU"; From 21475774fc412fed7273408de65ee69bcdd1b84e Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Wed, 6 Nov 2024 18:42:45 +0100 Subject: [PATCH 2943/4482] boards: nordic: nRF54L15DK: Add basic support for the L05 and L10 ICs The nRF54L05 and nRF54L10 are identical to the nRF54L15 except for their memory sizes. Add support for emulating those ICs on the nRF54L15DK. This commit only adds support for the main application core. Support for the FLPR core may be added later. Signed-off-by: Carles Cufi --- boards/nordic/nrf54l15dk/Kconfig.defconfig | 6 +- boards/nordic/nrf54l15dk/Kconfig.nrf54l15dk | 2 + boards/nordic/nrf54l15dk/board.cmake | 6 +- boards/nordic/nrf54l15dk/board.yml | 2 + .../nordic/nrf54l15dk/nrf54l15dk_common.dtsi | 2 +- .../nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.dts | 63 +++++++++++++++++++ .../nrf54l15dk_nrf54l05_cpuapp.yaml | 24 +++++++ .../nrf54l15dk_nrf54l05_cpuapp_defconfig | 29 +++++++++ .../nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.dts | 63 +++++++++++++++++++ .../nrf54l15dk_nrf54l10_cpuapp.yaml | 24 +++++++ .../nrf54l15dk_nrf54l10_cpuapp_defconfig | 29 +++++++++ .../nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.dts | 36 ++++++++++- ...> nrf54l15dk_nrf54l_05_10_15-pinctrl.dtsi} | 0 ...tsi => nrf54l_05_10_15_cpuapp_common.dtsi} | 34 ---------- .../boards/nrf54l15dk_nrf54l05_cpuapp.overlay | 8 +++ .../boards/nrf54l15dk_nrf54l10_cpuapp.overlay | 8 +++ .../boards/nrf54l15dk_nrf54l05_cpuapp.overlay | 43 +++++++++++++ .../boards/nrf54l15dk_nrf54l10_cpuapp.overlay | 43 +++++++++++++ .../boards/nrf54l15dk_nrf54l05_cpuapp.overlay | 9 +++ .../boards/nrf54l15dk_nrf54l10_cpuapp.overlay | 9 +++ tests/lib/cpp/cxx/testcase.yaml | 4 +- 21 files changed, 403 insertions(+), 41 deletions(-) create mode 100644 boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.dts create mode 100644 boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.yaml create mode 100644 boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp_defconfig create mode 100644 boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.dts create mode 100644 boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.yaml create mode 100644 boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_defconfig rename boards/nordic/nrf54l15dk/{nrf54l15dk_nrf54l15-pinctrl.dtsi => nrf54l15dk_nrf54l_05_10_15-pinctrl.dtsi} (100%) rename boards/nordic/nrf54l15dk/{nrf54l15_cpuapp_common.dtsi => nrf54l_05_10_15_cpuapp_common.dtsi} (70%) create mode 100644 samples/drivers/watchdog/boards/nrf54l15dk_nrf54l05_cpuapp.overlay create mode 100644 samples/drivers/watchdog/boards/nrf54l15dk_nrf54l10_cpuapp.overlay create mode 100644 tests/drivers/adc/adc_api/boards/nrf54l15dk_nrf54l05_cpuapp.overlay create mode 100644 tests/drivers/adc/adc_api/boards/nrf54l15dk_nrf54l10_cpuapp.overlay create mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15dk_nrf54l05_cpuapp.overlay create mode 100644 tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15dk_nrf54l10_cpuapp.overlay diff --git a/boards/nordic/nrf54l15dk/Kconfig.defconfig b/boards/nordic/nrf54l15dk/Kconfig.defconfig index 2b753df35151b..cbb822eec9c8a 100644 --- a/boards/nordic/nrf54l15dk/Kconfig.defconfig +++ b/boards/nordic/nrf54l15dk/Kconfig.defconfig @@ -1,7 +1,8 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if BOARD_NRF54L15DK_NRF54L15_CPUAPP +if BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || \ + BOARD_NRF54L15DK_NRF54L15_CPUAPP config BT_CTLR default BT @@ -9,4 +10,5 @@ config BT_CTLR config ROM_START_OFFSET default 0x800 if BOOTLOADER_MCUBOOT -endif # BOARD_NRF54L15DK_NRF54L15_CPUAPP +endif # BOARD_NRF54L15DK_NRF54L05_CPUAPP || BOARD_NRF54L15DK_NRF54L10_CPUAPP || \ + # BOARD_NRF54L15DK_NRF54L15_CPUAPP diff --git a/boards/nordic/nrf54l15dk/Kconfig.nrf54l15dk b/boards/nordic/nrf54l15dk/Kconfig.nrf54l15dk index e385ef84f8917..25472cfff6c47 100644 --- a/boards/nordic/nrf54l15dk/Kconfig.nrf54l15dk +++ b/boards/nordic/nrf54l15dk/Kconfig.nrf54l15dk @@ -2,6 +2,8 @@ # SPDX-License-Identifier: Apache-2.0 config BOARD_NRF54L15DK + select SOC_NRF54L05_CPUAPP if BOARD_NRF54L15DK_NRF54L05_CPUAPP + select SOC_NRF54L10_CPUAPP if BOARD_NRF54L15DK_NRF54L10_CPUAPP select SOC_NRF54L15_CPUAPP if BOARD_NRF54L15DK_NRF54L15_CPUAPP select SOC_NRF54L15_CPUFLPR if BOARD_NRF54L15DK_NRF54L15_CPUFLPR || \ BOARD_NRF54L15DK_NRF54L15_CPUFLPR_XIP diff --git a/boards/nordic/nrf54l15dk/board.cmake b/boards/nordic/nrf54l15dk/board.cmake index 1fd92b7fcedca..c69f8460c0a58 100644 --- a/boards/nordic/nrf54l15dk/board.cmake +++ b/boards/nordic/nrf54l15dk/board.cmake @@ -1,9 +1,11 @@ # Copyright (c) 2024 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -if(CONFIG_SOC_NRF54L15_CPUAPP) +if(CONFIG_SOC_NRF54L05_CPUAPP OR CONFIG_SOC_NRF54L10_CPUAPP OR + CONFIG_SOC_NRF54L15_CPUAPP) board_runner_args(jlink "--device=cortex-m33" "--speed=4000") -elseif(CONFIG_SOC_NRF54L15_CPUFLPR) +elseif(CONFIG_SOC_NRF54L05_CPUFLPR OR CONFIG_SOC_NRF54L10_CPUFLPR OR + CONFIG_SOC_NRF54L15_CPUFLPR) board_runner_args(jlink "--speed=4000") endif() diff --git a/boards/nordic/nrf54l15dk/board.yml b/boards/nordic/nrf54l15dk/board.yml index 8d750b3d14b9e..f1a873cc35f42 100644 --- a/boards/nordic/nrf54l15dk/board.yml +++ b/boards/nordic/nrf54l15dk/board.yml @@ -3,6 +3,8 @@ board: full_name: nRF54L15 DK vendor: nordic socs: + - name: nrf54l05 + - name: nrf54l10 - name: nrf54l15 variants: - name: xip diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi b/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi index 02170276476af..33cfebb55d6e6 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_common.dtsi @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "nrf54l15dk_nrf54l15-pinctrl.dtsi" +#include "nrf54l15dk_nrf54l_05_10_15-pinctrl.dtsi" / { leds { diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.dts new file mode 100644 index 0000000000000..e2215ce129491 --- /dev/null +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.dts @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "nrf54l_05_10_15_cpuapp_common.dtsi" + +/ { + compatible = "nordic,nrf54l15dk_nrf54l05-cpuapp"; + model = "Nordic nRF54L15 DK nRF54L05 Application MCU"; + + chosen { + zephyr,code-partition = &slot0_partition; + zephyr,sram = &cpuapp_sram; + }; +}; + +/* FLPR not supported yet, give all SRAM and RRAM to the APP core */ +&cpuapp_sram { + reg = <0x20000000 DT_SIZE_K(96)>; + ranges = <0x0 0x20000000 DT_SIZE_K(96)>; +}; + +&cpuapp_rram { + reg = <0x0 DT_SIZE_K(500)>; +}; + +/* These partition sizes assume no FLPR area in RRAM */ +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(100)>; + }; + slot0_ns_partition: partition@29000 { + label = "image-0-nonsecure"; + reg = <0x29000 DT_SIZE_K(100)>; + }; + slot1_partition: partition@42000 { + label = "image-1"; + reg = <0x42000 DT_SIZE_K(100)>; + }; + slot1_ns_partition: partition@5b000 { + label = "image-1-nonsecure"; + reg = <0x5b000 DT_SIZE_K(100)>; + }; + storage_partition: partition@74000 { + label = "storage"; + reg = <0x74000 DT_SIZE_K(36)>; + }; + }; +}; diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.yaml b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.yaml new file mode 100644 index 0000000000000..0c451b19a2efd --- /dev/null +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp.yaml @@ -0,0 +1,24 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54l15dk/nrf54l05/cpuapp +name: nRF54L15-DK-nRF54L05-Application +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +sysbuild: true +ram: 96 +flash: 100 +supported: + - adc + - counter + - gpio + - i2c + - pwm + - retained_mem + - spi + - watchdog + - i2s diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp_defconfig b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp_defconfig new file mode 100644 index 0000000000000..02796a1361ef9 --- /dev/null +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l05_cpuapp_defconfig @@ -0,0 +1,29 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# Enable GPIO +CONFIG_GPIO=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + +# MPU-based null-pointer dereferencing detection cannot +# be applied as the (0x0 - 0x400) is unmapped for this target. +CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y + +# Enable Cache +CONFIG_CACHE_MANAGEMENT=y +CONFIG_EXTERNAL_CACHE=y + +# Start SYSCOUNTER on driver init +CONFIG_NRF_GRTC_START_SYSCOUNTER=y diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.dts new file mode 100644 index 0000000000000..1ae6be3e9e9c0 --- /dev/null +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.dts @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "nrf54l_05_10_15_cpuapp_common.dtsi" + +/ { + compatible = "nordic,nrf54l15dk_nrf54l10-cpuapp"; + model = "Nordic nRF54L15 DK nRF54L10 Application MCU"; + + chosen { + zephyr,code-partition = &slot0_partition; + zephyr,sram = &cpuapp_sram; + }; +}; + +/* FLPR not supported yet, give all SRAM and RRAM to the APP core */ +&cpuapp_sram { + reg = <0x20000000 DT_SIZE_K(192)>; + ranges = <0x0 0x20000000 DT_SIZE_K(192)>; +}; + +&cpuapp_rram { + reg = <0x0 DT_SIZE_K(1022)>; +}; + +/* These partition sizes assume no FLPR area in RRAM */ +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(230)>; + }; + slot0_ns_partition: partition@49800 { + label = "image-0-nonsecure"; + reg = <0x49800 DT_SIZE_K(230)>; + }; + slot1_partition: partition@83000 { + label = "image-1"; + reg = <0x83000 DT_SIZE_K(230)>; + }; + slot1_ns_partition: partition@bc800 { + label = "image-1-nonsecure"; + reg = <0xbc800 DT_SIZE_K(230)>; + }; + storage_partition: partition@f6000 { + label = "storage"; + reg = <0xf6000 DT_SIZE_K(38)>; + }; + }; +}; diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.yaml b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.yaml new file mode 100644 index 0000000000000..63afb059b9361 --- /dev/null +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp.yaml @@ -0,0 +1,24 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +identifier: nrf54l15dk/nrf54l10/cpuapp +name: nRF54L15-DK-nRF54L10-Application +type: mcu +arch: arm +toolchain: + - gnuarmemb + - xtools + - zephyr +sysbuild: true +ram: 192 +flash: 230 +supported: + - adc + - counter + - gpio + - i2c + - pwm + - retained_mem + - spi + - watchdog + - i2s diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_defconfig b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_defconfig new file mode 100644 index 0000000000000..02796a1361ef9 --- /dev/null +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l10_cpuapp_defconfig @@ -0,0 +1,29 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +# Enable UART driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# Enable GPIO +CONFIG_GPIO=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + +# MPU-based null-pointer dereferencing detection cannot +# be applied as the (0x0 - 0x400) is unmapped for this target. +CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y + +# Enable Cache +CONFIG_CACHE_MANAGEMENT=y +CONFIG_EXTERNAL_CACHE=y + +# Start SYSCOUNTER on driver init +CONFIG_NRF_GRTC_START_SYSCOUNTER=y diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.dts b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.dts index b71f55c5fb439..79b16bd41254e 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.dts +++ b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15_cpuapp.dts @@ -6,7 +6,8 @@ /dts-v1/; -#include "nrf54l15_cpuapp_common.dtsi" +#include +#include "nrf54l_05_10_15_cpuapp_common.dtsi" / { compatible = "nordic,nrf54l15dk_nrf54l15-cpuapp"; @@ -17,3 +18,36 @@ zephyr,sram = &cpuapp_sram; }; }; + +&cpuapp_rram { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x0 DT_SIZE_K(64)>; + }; + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x10000 DT_SIZE_K(324)>; + }; + slot0_ns_partition: partition@61000 { + label = "image-0-nonsecure"; + reg = <0x61000 DT_SIZE_K(324)>; + }; + slot1_partition: partition@b2000 { + label = "image-1"; + reg = <0xb2000 DT_SIZE_K(324)>; + }; + slot1_ns_partition: partition@103000 { + label = "image-1-nonsecure"; + reg = <0x103000 DT_SIZE_K(324)>; + }; + /* 32k from 0x154000 to 0x15bfff reserved for TF-M partitions */ + storage_partition: partition@15c000 { + label = "storage"; + reg = <0x15c000 DT_SIZE_K(36)>; + }; + }; +}; diff --git a/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15-pinctrl.dtsi b/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l_05_10_15-pinctrl.dtsi similarity index 100% rename from boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l15-pinctrl.dtsi rename to boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l_05_10_15-pinctrl.dtsi diff --git a/boards/nordic/nrf54l15dk/nrf54l15_cpuapp_common.dtsi b/boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi similarity index 70% rename from boards/nordic/nrf54l15dk/nrf54l15_cpuapp_common.dtsi rename to boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi index f8714861936e4..323ebfd1a1b7f 100644 --- a/boards/nordic/nrf54l15dk/nrf54l15_cpuapp_common.dtsi +++ b/boards/nordic/nrf54l15dk/nrf54l_05_10_15_cpuapp_common.dtsi @@ -6,7 +6,6 @@ /* This file is common to the secure and non-secure domain */ -#include #include "nrf54l15dk_common.dtsi" / { @@ -52,39 +51,6 @@ status = "okay"; }; -&cpuapp_rram { - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x0 DT_SIZE_K(64)>; - }; - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x10000 DT_SIZE_K(324)>; - }; - slot0_ns_partition: partition@61000 { - label = "image-0-nonsecure"; - reg = <0x61000 DT_SIZE_K(324)>; - }; - slot1_partition: partition@b2000 { - label = "image-1"; - reg = <0xb2000 DT_SIZE_K(324)>; - }; - slot1_ns_partition: partition@103000 { - label = "image-1-nonsecure"; - reg = <0x103000 DT_SIZE_K(324)>; - }; - /* 32k from 0x154000 to 0x15bfff reserved for TF-M partitions */ - storage_partition: partition@15c000 { - label = "storage"; - reg = <0x15c000 DT_SIZE_K(36)>; - }; - }; -}; - &uart20 { status = "okay"; }; diff --git a/samples/drivers/watchdog/boards/nrf54l15dk_nrf54l05_cpuapp.overlay b/samples/drivers/watchdog/boards/nrf54l15dk_nrf54l05_cpuapp.overlay new file mode 100644 index 0000000000000..5c765a8a89633 --- /dev/null +++ b/samples/drivers/watchdog/boards/nrf54l15dk_nrf54l05_cpuapp.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/samples/drivers/watchdog/boards/nrf54l15dk_nrf54l10_cpuapp.overlay b/samples/drivers/watchdog/boards/nrf54l15dk_nrf54l10_cpuapp.overlay new file mode 100644 index 0000000000000..5c765a8a89633 --- /dev/null +++ b/samples/drivers/watchdog/boards/nrf54l15dk_nrf54l10_cpuapp.overlay @@ -0,0 +1,8 @@ +/* + * Copyright 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/tests/drivers/adc/adc_api/boards/nrf54l15dk_nrf54l05_cpuapp.overlay b/tests/drivers/adc/adc_api/boards/nrf54l15dk_nrf54l05_cpuapp.overlay new file mode 100644 index 0000000000000..87707847eeab2 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/nrf54l15dk_nrf54l05_cpuapp.overlay @@ -0,0 +1,43 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 Nordic Semiconductor ASA + */ + +/ { + zephyr,user { + io-channels = <&adc 0>, <&adc 1> , <&adc 2>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; + zephyr,resolution = <10>; + }; + + channel@1 { + reg = <1>; + zephyr,gain = "ADC_GAIN_1_4"; + zephyr,reference = "ADC_REF_EXTERNAL0"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; + zephyr,resolution = <12>; + }; + + channel@2 { + reg = <2>; + zephyr,gain = "ADC_GAIN_2_3"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; + zephyr,resolution = <10>; + }; +}; diff --git a/tests/drivers/adc/adc_api/boards/nrf54l15dk_nrf54l10_cpuapp.overlay b/tests/drivers/adc/adc_api/boards/nrf54l15dk_nrf54l10_cpuapp.overlay new file mode 100644 index 0000000000000..87707847eeab2 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/nrf54l15dk_nrf54l10_cpuapp.overlay @@ -0,0 +1,43 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 Nordic Semiconductor ASA + */ + +/ { + zephyr,user { + io-channels = <&adc 0>, <&adc 1> , <&adc 2>; + }; +}; + +&adc { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; + zephyr,resolution = <10>; + }; + + channel@1 { + reg = <1>; + zephyr,gain = "ADC_GAIN_1_4"; + zephyr,reference = "ADC_REF_EXTERNAL0"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; + zephyr,resolution = <12>; + }; + + channel@2 { + reg = <2>; + zephyr,gain = "ADC_GAIN_2_3"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,input-positive = ; + zephyr,resolution = <10>; + }; +}; diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15dk_nrf54l05_cpuapp.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15dk_nrf54l05_cpuapp.overlay new file mode 100644 index 0000000000000..8d3dce3b38005 --- /dev/null +++ b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15dk_nrf54l05_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15dk_nrf54l10_cpuapp.overlay b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15dk_nrf54l10_cpuapp.overlay new file mode 100644 index 0000000000000..8d3dce3b38005 --- /dev/null +++ b/tests/drivers/watchdog/wdt_basic_api/boards/nrf54l15dk_nrf54l10_cpuapp.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&wdt31 { + status = "okay"; +}; diff --git a/tests/lib/cpp/cxx/testcase.yaml b/tests/lib/cpp/cxx/testcase.yaml index 06bbcfd5baefb..e9fc90855c4c8 100644 --- a/tests/lib/cpp/cxx/testcase.yaml +++ b/tests/lib/cpp/cxx/testcase.yaml @@ -34,9 +34,11 @@ tests: # -std=c++98) cpp.main.cpp98: arch_exclude: posix - # Exclude nRF54L15, nRF54H20 and nRF9280 as Nordic HAL is not compatible with C++98. + # Exclude nRF54L series, nRF54H20 and nRF9280 as Nordic HAL is not compatible with C++98. # Exclude CONFIG_HAS_RENESAS_RA_FSP as Renesas RA HAL is not compatible with C++98. platform_exclude: + - nrf54l15dk/nrf54l05/cpuapp + - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - nrf54l20pdk/nrf54l20/cpuapp - nrf54h20dk/nrf54h20/cpuapp From f0eba332588be7aff3adf479c23c836cb81c9f61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C5=82=C4=85b?= Date: Tue, 24 Sep 2024 15:39:53 +0200 Subject: [PATCH 2944/4482] samples: boards: nordic: coresight_stm: Test STM dictionary mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extend STM logger test. Use nrfutil trace to decode STM logs in dictionary mode. Signed-off-by: Sebastian Głąb --- .../boards/nordic/coresight_stm/README.rst | 102 +++++++ .../nordic/coresight_stm/pytest/test_stm.py | 258 ++++++++++++++++++ .../boards/nordic/coresight_stm/sample.yaml | 44 ++- 3 files changed, 380 insertions(+), 24 deletions(-) create mode 100644 samples/boards/nordic/coresight_stm/README.rst create mode 100644 samples/boards/nordic/coresight_stm/pytest/test_stm.py diff --git a/samples/boards/nordic/coresight_stm/README.rst b/samples/boards/nordic/coresight_stm/README.rst new file mode 100644 index 0000000000000..370253cf41cc7 --- /dev/null +++ b/samples/boards/nordic/coresight_stm/README.rst @@ -0,0 +1,102 @@ +.. zephyr:code-sample:: coresight_stm_sample + :name: Coresight STM benchmark + :relevant-api: log_api + +Overview +******** + +This sample presents how to enable STM logging on nRF54H20 platform. + +Also, it prints timing for different log messages. +Thus, performance of different loggers can be compared. + +There are three sample configurations in the :file:`sample.yaml`. + +* **sample.boards.nrf.coresight_stm.local_uart** + + This configuration doesn't use STM. + Logs are printed on local console. + +* **sample.boards.nrf.coresight_stm** + + This configuration use STM. + Application, Radio, PPR and FLPR cores send logs to an ETR buffer. + Proxy (Application core) gets logs from the ETR buffer, decodes STPv2 data + and prints human readable logs on UART. + +* **sample.boards.nrf.coresight_stm.dict** + + This sample uses STM logging in dictionary mode. + Application, Radio, PPR and FLPR cores send logs to the ETR buffer. + Proxy (Application core) forwards data from the ETR to the host using UART. + Host tool is needed to decode the logs. + +Requirements +************ + +This application uses nRF54H20 DK board for the demo. + +**sample.boards.nrf.coresight_stm.dict** requires host tool like ``nrfutil trace`` +to decode the traces. + +Building and running +******************** + +To build the sample, use configuration setups from the :file:`sample.yaml` using the ``-T`` option. +See the example: + +nRF54H20 DK + + .. code-block:: console + + west build -p -b nrf54h20dk/nrf54h20/cpuapp -T sample.boards.nrf.coresight_stm . + +Sample Output +============= + +.. code-block:: console + + *** Using Zephyr OS v3.6.99-5bb7bb0af17c *** + (...) + [00:00:00.227,264] app/app: test with one argument 100 + [00:00:00.227,265] app/app: test with one argument 100 + (...) + [00:00:00.585,558] rad/app: test with one argument 100 + [00:00:00.585,569] rad/app: test with one argument 100 + (...) + [00:00:00.624,408] ppr/app: test with one argument 100 + [00:00:00.624,433] ppr/app: test with one argument 100 + (...) + [00:00:00.625,249] flpr/app: test with one argument 100 + [00:00:00.625,251] flpr/app: test with one argument 100 + (...) + rad: Timing for log message with 0 arguments: 5.10us + rad: Timing for log message with 1 argument: 6.10us + rad: Timing for log message with 2 arguments: 6.0us + rad: Timing for log message with 3 arguments: 6.40us + rad: Timing for log_message with string: 7.10us + rad: Timing for tracepoint: 0.5us + rad: Timing for tracepoint_d32: 0.5us + flpr: Timing for log message with 0 arguments: 1.20us + flpr: Timing for log message with 1 argument: 1.20us + flpr: Timing for log message with 2 arguments: 1.20us + flpr: Timing for log message with 3 arguments: 1.30us + flpr: Timing for log_message with string: 3.0us + flpr: Timing for tracepoint: 0.0us + flpr: Timing for tracepoint_d32: 0.0us + app: Timing for log message with 0 arguments: 1.80us + app: Timing for log message with 1 argument: 2.0us + app: Timing for log message with 2 arguments: 2.0us + app: Timing for log message with 3 arguments: 2.10us + app: Timing for log_message with string: 4.40us + app: Timing for tracepoint: 0.10us + app: Timing for tracepoint_d32: 0.10us + ppr: Timing for log message with 0 arguments: 25.20us + ppr: Timing for log message with 1 argument: 26.20us + ppr: Timing for log message with 2 arguments: 26.90us + ppr: Timing for log message with 3 arguments: 27.40us + ppr: Timing for log_message with string: 64.80us + ppr: Timing for tracepoint: 0.30us + ppr: Timing for tracepoint_d32: 0.25us + +For logging on NRF54H20 using ARM Coresight STM see :ref:`logging_cs_stm`. diff --git a/samples/boards/nordic/coresight_stm/pytest/test_stm.py b/samples/boards/nordic/coresight_stm/pytest/test_stm.py new file mode 100644 index 0000000000000..2187805f15f11 --- /dev/null +++ b/samples/boards/nordic/coresight_stm/pytest/test_stm.py @@ -0,0 +1,258 @@ +# +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +import logging +import re +import subprocess +from pathlib import Path +from time import sleep + +import psutil +from twister_harness import DeviceAdapter + +logger = logging.getLogger(__name__) + +SB_CONFIG_APP_CPUPPR_RUN = None +SB_CONFIG_APP_CPUFLPR_RUN = None + +# https://github.com/zephyrproject-rtos/zephyr/blob/main/drivers/misc/coresight/nrf_etr.c#L102 +STM_M_ID = { + "sec": 33, + "app": 34, + "rad": 35, + "mod": 36, + "sys": 44, + "flpr": 45, + "ppr": 46, + "hw": 128, +} + + +def _analyse_autoconf(filepath: str) -> None: + global SB_CONFIG_APP_CPUPPR_RUN + global SB_CONFIG_APP_CPUFLPR_RUN + + SB_CONFIG_APP_CPUPPR_RUN = False + SB_CONFIG_APP_CPUFLPR_RUN = False + + # Parse contents of {BUILD_DIR}/_sysbuild/autoconf.h + with open(f"{filepath}", errors="ignore") as autoconf: + for line in autoconf: + if "SB_CONFIG_APP_CPUPPR_RUN 1" in line: + SB_CONFIG_APP_CPUPPR_RUN = True + continue + if "SB_CONFIG_APP_CPUFLPR_RUN 1" in line: + SB_CONFIG_APP_CPUFLPR_RUN = True + logger.debug(f"{SB_CONFIG_APP_CPUPPR_RUN=}") + logger.debug(f"{SB_CONFIG_APP_CPUFLPR_RUN=}") + + +def _check_benchmark_results(output: str, core: str) -> None: + """ + Use regular expressions to parse 'output' string. + Search for benchmark results related to 'core' coprocessor. + """ + + latency_msg_0_str = re.search( + rf"{core}: Timing for log message with 0 arguments: (.+)us", output + ).group(1) + assert latency_msg_0_str is not None, "Timing for log message with 0 arguments NOT found" + + latency_msg_1_str = re.search( + rf"{core}: Timing for log message with 1 argument: (.+)us", output + ).group(1) + assert latency_msg_1_str is not None, "Timing for log message with 1 argument NOT found" + + latency_msg_2_str = re.search( + rf"{core}: Timing for log message with 2 arguments: (.+)us", output + ).group(1) + assert latency_msg_2_str is not None, "Timing for log message with 2 arguments NOT found" + + latency_msg_3_str = re.search( + rf"{core}: Timing for log message with 3 arguments: (.+)us", output + ).group(1) + assert latency_msg_3_str is not None, "Timing for log message with 3 arguments NOT found" + + latency_msg_string_str = re.search( + rf"{core}: Timing for log_message with string: (.+)us", output + ).group(1) + assert latency_msg_string_str is not None, "Timing for log_message with string NOT found" + + latency_tracepoint_str = re.search( + rf"{core}: Timing for tracepoint: (.+)us", output + ).group(1) + assert latency_tracepoint_str is not None, "Timing for tracepoint NOT found" + + latency_tracepoint_d32_str = re.search( + rf"{core}: Timing for tracepoint_d32: (.+)us", output + ).group(1) + assert latency_tracepoint_d32_str is not None, "Timing for tracepoint_d32 NOT found" + + +# nrfutil starts children processes +# when subprocess.terminate(nrfutil_process) is executed, only the parent terminates +# this blocks serial port for other uses +def _kill(proc): + try: + for child in psutil.Process(proc.pid).children(recursive=True): + child.kill() + proc.kill() + except Exception as e: + logger.exception(f'Could not kill nrfutil - {e}') + + +def _nrfutil_dictionary_from_serial( + dut: DeviceAdapter, + decoded_file_name: str = "output.txt", + collect_time: float = 60.0, +) -> None: + UART_PATH = dut.device_config.serial + UART_BAUDRATE = dut.device_config.baud + dut.close() + + logger.debug(f"Using serial: {UART_PATH}") + + if Path(f"{decoded_file_name}").exists(): + logger.warning("Output file already exists!") + + # prepare database config string + BUILD_DIR = str(dut.device_config.build_dir) + logger.debug(f"{BUILD_DIR=}") + config_str = f"{STM_M_ID['app']}:{BUILD_DIR}/coresight_stm/zephyr/log_dictionary.json" + config_str = config_str + f",{STM_M_ID['rad']}:{BUILD_DIR}/remote_rad/zephyr/log_dictionary.json" + if SB_CONFIG_APP_CPUPPR_RUN: + config_str = config_str + f",{STM_M_ID['ppr']}:{BUILD_DIR}/remote_ppr/zephyr/log_dictionary.json" + if SB_CONFIG_APP_CPUFLPR_RUN: + config_str = config_str + f",{STM_M_ID['flpr']}:{BUILD_DIR}/remote_flpr/zephyr/log_dictionary.json" + logger.debug(f"{config_str=}") + + cmd = ( + "nrfutil trace stm --database-config " + f"{config_str} " + f"--input-serialport {UART_PATH} --baudrate {UART_BAUDRATE} " + f"--output-ascii {decoded_file_name}" + ) + try: + # run nrfutil trace in background non-blocking + logger.info(f"Executing:\n{cmd}") + proc = subprocess.Popen(cmd.split(), stdout=subprocess.DEVNULL) + except OSError as exc: + logger.error(f"Unable to start nrfutil trace:\n{cmd}\n{exc}") + try: + proc.wait(collect_time) + except subprocess.TimeoutExpired: + pass + finally: + _kill(proc) + + +def test_STM_decoded(dut: DeviceAdapter): + """ + Run sample.boards.nrf.coresight_stm from samples/boards/nrf/coresight_stm sample. + Both Application and Radio cores use STM for logging. + STM proxy (Application core) decodes logs from all domains. + After reset, coprocessors execute code in expected way and Application core + outputs STM traces on UART port. + """ + BUILD_DIR = str(dut.device_config.build_dir) + autoconf_file = f"{BUILD_DIR}/_sysbuild/autoconf.h" + + # nrf54h20 prints immediately after it is flashed. + # Wait a bit to skipp logs from previous test. + sleep(4) + + # Get output from serial port + output = "\n".join(dut.readlines()) + + # set SB_CONFIG_APP_CPUPPR_RUN, SB_CONFIG_APP_CPUFLPR_RUN + _analyse_autoconf(autoconf_file) + + # check that LOGs from Application core are present + _check_benchmark_results( + output=output, + core='app', + ) + + # check that LOGs from Radio core are present + _check_benchmark_results( + output=output, + core='rad', + ) + + if SB_CONFIG_APP_CPUPPR_RUN: + # check that LOGs from PPR core are present + _check_benchmark_results( + output=output, + core='ppr', + ) + + if SB_CONFIG_APP_CPUFLPR_RUN: + # check that LOGs from FLPR core are present + _check_benchmark_results( + output=output, + core='flpr', + ) + + +def test_STM_dictionary_mode(dut: DeviceAdapter): + """ + Run sample.boards.nrf.coresight_stm.dict from samples/boards/nrf/coresight_stm sample. + Both Application and Radio cores use STM for logging. + STM proxy (Application core) prints on serial port raw logs from all domains. + Nrfutil trace is used to decode STM logs. + After reset, coprocessors execute code in expected way and Application core + outputs STM traces on UART port. + """ + BUILD_DIR = str(dut.device_config.build_dir) + test_filename = f"{BUILD_DIR}/coresight_stm_dictionary.txt" + autoconf_file = f"{BUILD_DIR}/_sysbuild/autoconf.h" + COLLECT_TIMEOUT = 10.0 + + # set SB_CONFIG_APP_CPUPPR_RUN, SB_CONFIG_APP_CPUFLPR_RUN + # this information is needed to build nrfutil database-config + _analyse_autoconf(autoconf_file) + + # use nrfutil trace to decode logs + _nrfutil_dictionary_from_serial( + dut=dut, + decoded_file_name=f"{test_filename}", + collect_time=COLLECT_TIMEOUT, + ) + + # read decoded logs + with open(f"{test_filename}", errors="ignore") as decoded_file: + decoded_file_content = decoded_file.read() + + # if nothing in decoded_file, stop test + assert( + len(decoded_file_content) > 0 + ), f"File {test_filename} is empty" + + # check that LOGs from Application core are present + _check_benchmark_results( + output=decoded_file_content, + core='app', + ) + + # check that LOGs from Radio core are present + _check_benchmark_results( + output=decoded_file_content, + core='rad', + ) + + if SB_CONFIG_APP_CPUPPR_RUN: + # check that LOGs from PPR core are present + _check_benchmark_results( + output=decoded_file_content, + core='ppr', + ) + + if SB_CONFIG_APP_CPUFLPR_RUN: + # check that LOGs from FLPR core are present + _check_benchmark_results( + output=decoded_file_content, + core='flpr', + ) diff --git a/samples/boards/nordic/coresight_stm/sample.yaml b/samples/boards/nordic/coresight_stm/sample.yaml index eb3971a2f4eb2..4251c5d6df8c1 100644 --- a/samples/boards/nordic/coresight_stm/sample.yaml +++ b/samples/boards/nordic/coresight_stm/sample.yaml @@ -1,44 +1,40 @@ sample: name: Logging using Coresight STM on nrf54h20 + common: + tags: stm sysbuild: true + platform_allow: + - nrf54h20dk/nrf54h20/cpuapp + integration_platforms: + - nrf54h20dk/nrf54h20/cpuapp + tests: sample.boards.nrf.coresight_stm.dict: - platform_allow: - - nrf54h20dk/nrf54h20/cpuapp - integration_platforms: - - nrf54h20dk/nrf54h20/cpuapp - build_only: true + harness: pytest + harness_config: + pytest_dut_scope: session + pytest_root: + - "pytest/test_stm.py::test_STM_dictionary_mode" required_snippets: - nordic-log-stm-dict extra_args: - SB_CONFIG_APP_CPUPPR_RUN=y - SB_CONFIG_APP_CPUFLPR_RUN=y + sample.boards.nrf.coresight_stm: - platform_allow: - - nrf54h20dk/nrf54h20/cpuapp - integration_platforms: - - nrf54h20dk/nrf54h20/cpuapp - harness: console + harness: pytest harness_config: - type: multi_line - ordered: true - regex: - - "Timing for log message with 0 arguments:" - - "Timing for log message with 1 argument:" - - "Timing for log message with 2 arguments:" - - "Timing for log message with 3 arguments:" - - "Timing for log_message with string:" + pytest_dut_scope: session + pytest_root: + - "pytest/test_stm.py::test_STM_decoded" + required_snippets: + - nordic-log-stm extra_args: - SB_CONFIG_APP_CPUPPR_RUN=y - SB_CONFIG_APP_CPUFLPR_RUN=y - required_snippets: - - nordic-log-stm + sample.boards.nrf.coresight_stm.local_uart: - platform_allow: - - nrf54h20dk/nrf54h20/cpuapp - integration_platforms: - - nrf54h20dk/nrf54h20/cpuapp harness: console harness_config: type: multi_line From d6f32bb3393c63febf76b233e76255b1bb6cf8b7 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Sat, 9 Nov 2024 09:06:54 -0500 Subject: [PATCH 2945/4482] cmake: flash: update cmake to support rtt target Add support for the rtt target so that users can run `west build -p auto -b -t rtt ` similarly to the way that users can now do so with the debug target, since the rtt target is supposed to be used in a similar way. Signed-off-by: Chris Friedt --- cmake/flash/CMakeLists.txt | 4 +++- scripts/west_commands/debug.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/flash/CMakeLists.txt b/cmake/flash/CMakeLists.txt index 8fe7380695bfd..d1f0d17da6e8d 100644 --- a/cmake/flash/CMakeLists.txt +++ b/cmake/flash/CMakeLists.txt @@ -154,7 +154,7 @@ endif() # Generate the flash, debug, debugserver, attach targets within the build # system itself. -foreach(target flash debug debugserver attach) +foreach(target flash debug debugserver attach rtt) if(target STREQUAL flash) set(comment "Flashing ${BOARD}") elseif(target STREQUAL debug) @@ -168,6 +168,8 @@ foreach(target flash debug debugserver attach) endif() elseif(target STREQUAL attach) set(comment "Debugging ${BOARD}") + elseif(target STREQUAL rtt) + set(comment "RTT ${BOARD}") endif() string(TOUPPER ${target} TARGET_UPPER) diff --git a/scripts/west_commands/debug.py b/scripts/west_commands/debug.py index 156222aa332f9..e3bf9b4027542 100644 --- a/scripts/west_commands/debug.py +++ b/scripts/west_commands/debug.py @@ -85,7 +85,7 @@ def __init__(self): 'open an rtt shell', "", accepts_unknown_args=True) - self.runner_key = 'rtt-runner' # in runners.yaml + self.runner_key = 'debug-runner' # in runners.yaml def do_add_parser(self, parser_adder): return add_parser_common(self, parser_adder) From c71e33977361e1c4c05107ea3f5ca6b300f39daa Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Mon, 18 Nov 2024 13:11:53 -0500 Subject: [PATCH 2946/4482] west: runners: jlink: print RTT server port Similar to how print_gdbserver_message() prints GDB server info when "west debug" is run, print RTT server info when "west rtt" is run. Signed-off-by: Chris Friedt --- scripts/west_commands/runners/jlink.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/west_commands/runners/jlink.py b/scripts/west_commands/runners/jlink.py index c4647487c6828..2aedba0a37e81 100644 --- a/scripts/west_commands/runners/jlink.py +++ b/scripts/west_commands/runners/jlink.py @@ -169,6 +169,9 @@ def print_gdbserver_message(self): self.logger.info('J-Link GDB server running on port ' f'{self.gdb_port}{thread_msg}') + def print_rttserver_message(self): + self.logger.info(f'J-Link RTT server running on port {self.rtt_port}') + @property def jlink_version(self): # Get the J-Link version as a (major, minor, rev) tuple of integers. @@ -276,6 +279,7 @@ def do_run(self, command, **kwargs): self.check_call(server_cmd) elif command == 'rtt': self.print_gdbserver_message() + self.print_rttserver_message() server_cmd += ['-nohalt'] server_proc = self.popen_ignore_int(server_cmd) try: From 9a8ae21a3c38e9ba48bfd75742fe060047facbd4 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Mon, 18 Nov 2024 21:33:17 -0500 Subject: [PATCH 2947/4482] west: runners: openocd: mitigate pylint R0201 warning Previously, there was a warning that the to_num() method can (and probably should) be unbound from OpenOcdBinaryRunner. Signed-off-by: Chris Friedt --- scripts/west_commands/runners/openocd.py | 27 ++++++++++++------------ 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/scripts/west_commands/runners/openocd.py b/scripts/west_commands/runners/openocd.py index 2569371ff9b30..9c47cdff9b5cb 100644 --- a/scripts/west_commands/runners/openocd.py +++ b/scripts/west_commands/runners/openocd.py @@ -29,6 +29,18 @@ DEFAULT_OPENOCD_RESET_HALT_CMD = 'reset init' DEFAULT_OPENOCD_TARGET_HANDLE = "_TARGETNAME" +def to_num(number): + dev_match = re.search(r"^\d*\+dev", number) + dev_version = dev_match is not None + + num_match = re.search(r"^\d*", number) + num = int(num_match.group(0)) + + if dev_version: + num += 1 + + return num + class OpenOcdBinaryRunner(ZephyrBinaryRunner): '''Runner front-end for openocd.''' @@ -200,19 +212,6 @@ def print_gdbserver_message(self): self.logger.info('OpenOCD GDB server running on port ' f'{self.gdb_port}{thread_msg}') - # pylint: disable=R0201 - def to_num(self, number): - dev_match = re.search(r"^\d*\+dev", number) - dev_version = not dev_match is None - - num_match = re.search(r"^\d*", number) - num = int(num_match.group(0)) - - if dev_version: - num += 1 - - return num - def read_version(self): self.require(self.openocd_cmd[0]) @@ -223,7 +222,7 @@ def read_version(self): version_match = re.search(r"Open On-Chip Debugger (\d+.\d+.\d+)", out) version = version_match.group(1).split('.') - return [self.to_num(i) for i in version] + return [to_num(i) for i in version] def supports_thread_info(self): # Zephyr rtos was introduced after 0.11.0 From b85e1981c38117d7ee24868ae7dec5ed7a0f025f Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Sat, 9 Nov 2024 10:56:04 -0500 Subject: [PATCH 2948/4482] west: runners: update the rtt implementation for openocd Previously, rtt start would always fail because the target (i.e. firmware) had not been started. ``` Info : rtt: Searching for control block 'SEGGER RTT' Info : rtt: No control block found ``` When the command is 'rtt', run the binary via gdb before calling 'rtt start'. Firmware calls `SEGGER_RTT_Init()` shortly after init which allows OpenOCD to find the RTT control block. Similarly, only start the 'rtt server' after calling 'rtt start' to avoid any potential race conditions internally within OpenOCD. Signed-off-by: Chris Friedt --- scripts/west_commands/runners/openocd.py | 103 ++++++++--------------- 1 file changed, 37 insertions(+), 66 deletions(-) diff --git a/scripts/west_commands/runners/openocd.py b/scripts/west_commands/runners/openocd.py index 9c47cdff9b5cb..f9b280d3a3c6b 100644 --- a/scripts/west_commands/runners/openocd.py +++ b/scripts/west_commands/runners/openocd.py @@ -1,4 +1,5 @@ # Copyright (c) 2017 Linaro Limited. +# Copyright (c) 2024 Tenstorrent AI ULC # # SPDX-License-Identifier: Apache-2.0 # @@ -7,9 +8,7 @@ '''Runner for openocd.''' import re -import socket import subprocess -import time from os import path from pathlib import Path @@ -212,6 +211,9 @@ def print_gdbserver_message(self): self.logger.info('OpenOCD GDB server running on port ' f'{self.gdb_port}{thread_msg}') + def print_rttserver_message(self): + self.logger.info(f'OpenOCD RTT server running on port {self.rtt_port}') + def read_version(self): self.require(self.openocd_cmd[0]) @@ -245,12 +247,10 @@ def do_run(self, command, **kwargs): self.do_flash_elf(**kwargs) elif command == 'flash': self.do_flash(**kwargs) - elif command in ('attach', 'debug'): - self.do_attach_debug(command, **kwargs) + elif command in ('attach', 'debug', 'rtt'): + self.do_attach_debug_rtt(command, **kwargs) elif command == 'load': self.do_load(**kwargs) - elif command == 'rtt': - self.do_rtt(**kwargs) else: self.do_debugserver(**kwargs) @@ -343,7 +343,7 @@ def do_flash_elf(self, **kwargs): self.check_call(cmd) - def do_attach_debug(self, command, **kwargs): + def do_attach_debug_rtt(self, command, **kwargs): if self.gdb_cmd is None: raise ValueError('Cannot debug; no gdb specified') if self.elf_name is None: @@ -374,10 +374,39 @@ def do_attach_debug(self, command, **kwargs): for i in self.gdb_init: gdb_cmd.append("-ex") gdb_cmd.append(i) + if command == 'rtt': + rtt_address = self.get_rtt_address() + if rtt_address is None: + raise ValueError("RTT Control block not be found") + + # cannot prompt the user to press return for automation purposes + gdb_cmd.extend(['-ex', 'set pagination off']) + # start the internal openocd rtt service via gdb monitor commands + gdb_cmd.extend( + ['-ex', f'monitor rtt setup 0x{rtt_address:x} 0x10 "SEGGER RTT"']) + gdb_cmd.extend(['-ex', 'monitor reset run']) + gdb_cmd.extend(['-ex', 'monitor rtt start']) + gdb_cmd.extend( + ['-ex', f'monitor rtt server start {self.rtt_port} 0']) + # detach from the target and quit the gdb client session + gdb_cmd.extend(['-ex', 'detach', '-ex', 'quit']) self.require(gdb_cmd[0]) self.print_gdbserver_message() - self.run_server_and_client(server_cmd, gdb_cmd) + + if command in ('attach', 'debug'): + self.run_server_and_client(server_cmd, gdb_cmd) + elif command == 'rtt': + self.print_rttserver_message() + server_proc = self.popen_ignore_int(server_cmd) + try: + # run the binary with gdb, set up the rtt server (runs to completion) + subprocess.run(gdb_cmd) + # run the rtt client in the foreground + self.run_telnet_client('localhost', self.rtt_port) + finally: + server_proc.terminate() + server_proc.wait() def do_debugserver(self, **kwargs): pre_init_cmd = [] @@ -398,61 +427,3 @@ def do_debugserver(self, **kwargs): ['-c', self.reset_halt_cmd]) self.print_gdbserver_message() self.check_call(cmd) - - def do_rtt(self, **kwargs): - pre_init_cmd = [] - for i in self.pre_init: - pre_init_cmd.append("-c") - pre_init_cmd.append(i) - - if self.thread_info_enabled and self.supports_thread_info(): - pre_init_cmd.append("-c") - rtos_command = f'${self.target_handle} configure -rtos Zephyr' - pre_init_cmd.append(rtos_command) - - rtt_address = self.get_rtt_address() - if rtt_address is None: - raise ValueError("RTT Control block not be found") - - rtt_cmds = [ - '-c', f'rtt setup 0x{rtt_address:x} 0x10 "SEGGER RTT"', - '-c', f'rtt server start {self.rtt_port} 0', - '-c', 'rtt start', - ] - - server_cmd = (self.openocd_cmd + self.cfg_cmd + - ['-c', f'tcl_port {self.tcl_port}', - '-c', f'telnet_port {self.telnet_port}', - '-c', f'gdb_port {self.gdb_port}'] + - pre_init_cmd + self.init_arg + self.targets_arg + - ['-c', self.reset_halt_cmd] + - rtt_cmds - ) - self.print_gdbserver_message() - server_proc = self.popen_ignore_int(server_cmd) - # The target gets halted after all commands passed on the commandline are run. - # The only way to run resume here, to not have to connect a GDB, is to connect - # to the tcl port and run the command. When the TCL port comes up, initialization - # is done. - try: - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - # As long as the server process is still running, keep retrying the connection - while server_proc.poll() is None: - try: - sock.connect(('localhost', self.tcl_port)) - break - except ConnectionRefusedError: - time.sleep(0.1) - # \x1a is the command terminator for the openocd tcl rpc - sock.send(b'resume\x1a') - sock.shutdown(socket.SHUT_RDWR) - # Run the client. Since rtt is initialized before the tcl rpc comes up, - # the port is open now. - self.logger.info("Opening RTT") - time.sleep(0.1) # Give the server a moment to output log messages first - self.run_telnet_client('localhost', self.rtt_port) - except Exception as e: - self.logger.error(e) - finally: - server_proc.terminate() - server_proc.wait() From f716973785616dd056d3fba6fd6c063b8d9d548f Mon Sep 17 00:00:00 2001 From: Pierrick Guillaume Date: Fri, 15 Nov 2024 09:55:45 +0100 Subject: [PATCH 2949/4482] init: fix soc and board hooks doxygen comments Documentation for *init_hooks were not generated on doc website. This was due to ill-formed doc-strings for those hooks. Signed-off-by: Pierrick Guillaume --- include/zephyr/platform/hooks.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/include/zephyr/platform/hooks.h b/include/zephyr/platform/hooks.h index d310b0c37ca47..9989f640d65e7 100644 --- a/include/zephyr/platform/hooks.h +++ b/include/zephyr/platform/hooks.h @@ -31,13 +31,12 @@ void soc_reset_hook(void); /** * @brief SoC hook executed after the reset vector. * - * * This hook is implemented by the SoC and can be used to perform any * SoC-specific initialization. */ void soc_prep_hook(void); -/* +/** * @brief SoC hook executed before the kernel and devices are initialized. * * This hook is implemented by the SoC and can be used to perform any @@ -45,7 +44,7 @@ void soc_prep_hook(void); */ void soc_early_init_hook(void); -/* +/** * @brief SoC hook executed after the kernel and devices are initialized. * * This hook is implemented by the SoC and can be used to perform any @@ -61,7 +60,7 @@ void soc_late_init_hook(void); */ void soc_per_core_init_hook(void); -/* +/** * @brief Board hook executed before the kernel starts. * * This is called before the kernel has started. This hook @@ -70,9 +69,9 @@ void soc_per_core_init_hook(void); */ void board_early_init_hook(void); -/* +/** * @brief Board hook executed after the kernel starts. - + * * This is called after the kernel has started, but before the main function is * called. This hook is implemented by the board and can be used to perform * any board-specific initialization. From 2d81351517488c1e4ffa9fcc4fe2ea5f7991da54 Mon Sep 17 00:00:00 2001 From: Erwan Gouriou Date: Tue, 19 Nov 2024 09:35:03 +0100 Subject: [PATCH 2950/4482] drivers: ethernet: stm32: Use MDIO API only if enabled by DTS Not all STM32 series support Zephyr MDIO API yet, while the API is enabled by default. To preserve compatibility, put MDIO API related code under the condition of "st,stm32-mdio" compatible enablement. Signed-off-by: Erwan Gouriou --- drivers/ethernet/eth_stm32_hal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ethernet/eth_stm32_hal.c b/drivers/ethernet/eth_stm32_hal.c index 0c468f0fd7f33..224ce2f7876d4 100644 --- a/drivers/ethernet/eth_stm32_hal.c +++ b/drivers/ethernet/eth_stm32_hal.c @@ -56,7 +56,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #define PHY_ADDR CONFIG_ETH_STM32_HAL_PHY_ADDRESS -#if defined(CONFIG_MDIO) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_mdio) #define DEVICE_PHY_BY_NAME(n) \ DEVICE_DT_GET(DT_CHILD(DT_INST_CHILD(n, mdio), _CONCAT(ethernet_phy_, PHY_ADDR))) @@ -239,7 +239,7 @@ static HAL_StatusTypeDef read_eth_phy_register(ETH_HandleTypeDef *heth, uint32_t PHYReg, uint32_t *RegVal) { -#if defined(CONFIG_MDIO) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_mdio) return phy_read(eth_stm32_phy_dev, PHYReg, RegVal); #elif defined(CONFIG_ETH_STM32_HAL_API_V2) return HAL_ETH_ReadPHYRegister(heth, PHYAddr, PHYReg, RegVal); From d18f4256ee569e7b03caa8151462b6cc79a55f4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Tue, 19 Nov 2024 09:52:24 +0100 Subject: [PATCH 2951/4482] drivers: fpga: fix log level MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use CONFIG_FPGA_LOG_LEVEL for the fpga log modules. Signed-off-by: Fin Maaß --- drivers/fpga/Kconfig | 2 +- drivers/fpga/fpga_altera_agilex_bridge.c | 2 +- drivers/fpga/fpga_ice40.c | 2 +- drivers/fpga/fpga_mpfs.c | 2 +- drivers/fpga/fpga_slg471x5.c | 2 +- drivers/fpga/fpga_zynqmp.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig index 2677dd94d12f2..667d4c561cec4 100644 --- a/drivers/fpga/Kconfig +++ b/drivers/fpga/Kconfig @@ -10,7 +10,7 @@ menuconfig FPGA if FPGA -module = fpga +module = FPGA module-str = fpga source "subsys/logging/Kconfig.template.log_config" diff --git a/drivers/fpga/fpga_altera_agilex_bridge.c b/drivers/fpga/fpga_altera_agilex_bridge.c index ca71c3d04d6e6..2a1f7d5a3894f 100644 --- a/drivers/fpga/fpga_altera_agilex_bridge.c +++ b/drivers/fpga/fpga_altera_agilex_bridge.c @@ -14,7 +14,7 @@ #include #include "fpga_altera_agilex_bridge.h" -LOG_MODULE_REGISTER(fpga_altera); +LOG_MODULE_REGISTER(fpga_altera, CONFIG_FPGA_LOG_LEVEL); struct fpga_bridge_dev_data { /* SiP SVC controller */ diff --git a/drivers/fpga/fpga_ice40.c b/drivers/fpga/fpga_ice40.c index 47d4e2b487f72..3f461ffebf2a1 100644 --- a/drivers/fpga/fpga_ice40.c +++ b/drivers/fpga/fpga_ice40.c @@ -56,7 +56,7 @@ #define FPGA_ICE40_LEADING_CLOCKS_MIN 8 #define FPGA_ICE40_TRAILING_CLOCKS_MIN 49 -LOG_MODULE_REGISTER(fpga_ice40); +LOG_MODULE_REGISTER(fpga_ice40, CONFIG_FPGA_LOG_LEVEL); struct fpga_ice40_data { uint32_t crc; diff --git a/drivers/fpga/fpga_mpfs.c b/drivers/fpga/fpga_mpfs.c index 2a18950b2ec16..6be8476a5fb04 100644 --- a/drivers/fpga/fpga_mpfs.c +++ b/drivers/fpga/fpga_mpfs.c @@ -15,7 +15,7 @@ #include #include #include -LOG_MODULE_REGISTER(fpga_mpfs); +LOG_MODULE_REGISTER(fpga_mpfs, CONFIG_FPGA_LOG_LEVEL); #define SPI_FLASH_DIRECTORY_OFFSET 0x00000000 #define SPI_FLASH_GOLDEN_IMAGE_OFFSET 0x00100400 diff --git a/drivers/fpga/fpga_slg471x5.c b/drivers/fpga/fpga_slg471x5.c index f27128a33df80..e5c5849cd7783 100644 --- a/drivers/fpga/fpga_slg471x5.c +++ b/drivers/fpga/fpga_slg471x5.c @@ -13,7 +13,7 @@ #include #include -LOG_MODULE_REGISTER(fpga_slg471x5); +LOG_MODULE_REGISTER(fpga_slg471x5, CONFIG_FPGA_LOG_LEVEL); #define SLG471X5_NREG 256 diff --git a/drivers/fpga/fpga_zynqmp.c b/drivers/fpga/fpga_zynqmp.c index 8181edf5c75b0..7cedba97babf0 100644 --- a/drivers/fpga/fpga_zynqmp.c +++ b/drivers/fpga/fpga_zynqmp.c @@ -16,7 +16,7 @@ #include #include -LOG_MODULE_REGISTER(fpga_zynqmp); +LOG_MODULE_REGISTER(fpga_zynqmp, CONFIG_FPGA_LOG_LEVEL); static void power_up_fpga(void) { From 36c9777be8db8083e0e7a2d2d0a46b25b63a12af Mon Sep 17 00:00:00 2001 From: Ilya Tagunov Date: Tue, 19 Nov 2024 13:23:20 +0000 Subject: [PATCH 2952/4482] llext: fix unaligned access for ARC We hit some unaligned access faults running our internal tests. Not every 32-bit instruction is 32-bit aligned; some are 16-bit aligned. Make all reads and writes potentially unaligned to be on the safe side. Signed-off-by: Ilya Tagunov --- arch/arc/core/elf.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/arc/core/elf.c b/arch/arc/core/elf.c index 7bdb5b08fcfa8..9f9f1073431a0 100644 --- a/arch/arc/core/elf.c +++ b/arch/arc/core/elf.c @@ -8,6 +8,7 @@ #include #include #include +#include LOG_MODULE_REGISTER(elf, CONFIG_LLEXT_LOG_LEVEL); @@ -17,7 +18,7 @@ LOG_MODULE_REGISTER(elf, CONFIG_LLEXT_LOG_LEVEL); #define R_ARC_32_ME 27 /* ARCompact insns packed in memory have Middle Endian encoding */ -#define ME(x) ((x & 0xffff0000) >> 16) | ((x & 0xffff) << 16); +#define ME(x) (((x & 0xffff0000) >> 16) | ((x & 0xffff) << 16)) /** * @brief Architecture specific function for relocating shared elf @@ -34,7 +35,7 @@ int arch_elf_relocate(elf_rela_t *rel, uintptr_t loc, uintptr_t sym_base_addr, c uintptr_t load_bias) { int ret = 0; - uint32_t insn = *(uint32_t *)loc; + uint32_t insn = UNALIGNED_GET((uint32_t *)loc); uint32_t value; sym_base_addr += rel->r_addend; @@ -44,7 +45,7 @@ int arch_elf_relocate(elf_rela_t *rel, uintptr_t loc, uintptr_t sym_base_addr, c switch (reloc_type) { case R_ARC_32: case R_ARC_B26: - *(uint32_t *)loc = sym_base_addr; + UNALIGNED_PUT(sym_base_addr, (uint32_t *)loc); break; case R_ARC_S25W_PCREL: /* ((S + A) - P) >> 2 @@ -64,10 +65,10 @@ int arch_elf_relocate(elf_rela_t *rel, uintptr_t loc, uintptr_t sym_base_addr, c insn = ME(insn); - *(uint32_t *)loc = insn; + UNALIGNED_PUT(insn, (uint32_t *)loc); break; case R_ARC_32_ME: - *(uint32_t *)loc = ME(sym_base_addr); + UNALIGNED_PUT(ME(sym_base_addr), (uint32_t *)loc); break; default: LOG_ERR("unknown relocation: %u\n", reloc_type); From ae256e1f6cf2ebd26e323ca5059a7583c318444d Mon Sep 17 00:00:00 2001 From: James Roy Date: Tue, 19 Nov 2024 21:25:29 +0800 Subject: [PATCH 2953/4482] boards: openisa: Remove CONFIG_PINCTRL from the boards defconfig Removed 'CONFIG_PINCTRL' from openisa board defconfig. Signed-off-by: James Roy --- .../rv32m1_vega/rv32m1_vega_openisa_rv32m1_ri5cy_defconfig | 1 - .../rv32m1_vega/rv32m1_vega_openisa_rv32m1_zero_riscy_defconfig | 1 - 2 files changed, 2 deletions(-) diff --git a/boards/openisa/rv32m1_vega/rv32m1_vega_openisa_rv32m1_ri5cy_defconfig b/boards/openisa/rv32m1_vega/rv32m1_vega_openisa_rv32m1_ri5cy_defconfig index 908f07c019897..085a155271085 100644 --- a/boards/openisa/rv32m1_vega/rv32m1_vega_openisa_rv32m1_ri5cy_defconfig +++ b/boards/openisa/rv32m1_vega/rv32m1_vega_openisa_rv32m1_ri5cy_defconfig @@ -2,7 +2,6 @@ # Copyright 2018 Foundries.io Ltd CONFIG_GPIO=y -CONFIG_PINCTRL=y CONFIG_SERIAL=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y diff --git a/boards/openisa/rv32m1_vega/rv32m1_vega_openisa_rv32m1_zero_riscy_defconfig b/boards/openisa/rv32m1_vega/rv32m1_vega_openisa_rv32m1_zero_riscy_defconfig index 908f07c019897..085a155271085 100644 --- a/boards/openisa/rv32m1_vega/rv32m1_vega_openisa_rv32m1_zero_riscy_defconfig +++ b/boards/openisa/rv32m1_vega/rv32m1_vega_openisa_rv32m1_zero_riscy_defconfig @@ -2,7 +2,6 @@ # Copyright 2018 Foundries.io Ltd CONFIG_GPIO=y -CONFIG_PINCTRL=y CONFIG_SERIAL=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y From 95fff388ba5925ca5fdee3a188bab4a92f8f4926 Mon Sep 17 00:00:00 2001 From: Omkar Kulkarni Date: Tue, 19 Nov 2024 12:35:21 +0100 Subject: [PATCH 2954/4482] Bluetooth: Mesh: Shell: Align commands Aligns subnet bridge related commands according to conventions used for rest of the shell commands. Also updates documentations to reflect the change. Signed-off-by: Omkar Kulkarni --- doc/connectivity/bluetooth/api/mesh/shell.rst | 28 +++++++++---------- subsys/bluetooth/mesh/shell/brg_cfg.c | 14 +++++----- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/doc/connectivity/bluetooth/api/mesh/shell.rst b/doc/connectivity/bluetooth/api/mesh/shell.rst index 4ef1b4a0701b6..87678a1630ad9 100644 --- a/doc/connectivity/bluetooth/api/mesh/shell.rst +++ b/doc/connectivity/bluetooth/api/mesh/shell.rst @@ -1795,25 +1795,25 @@ The Bridge Configuration Client model is an optional Bluetooth Mesh model that c :kconfig:option:`CONFIG_BT_MESH_BRG_CFG_CLI` configuration option. The model provides functionality for configuring the subnet bridge functionality of a mesh node. -``mesh models brg_cfg bridge-get`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +``mesh models brg get`` +^^^^^^^^^^^^^^^^^^^^^^^ Get the current Subnet Bridge state. -``mesh models brg_cfg bridge-set `` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +``mesh models brg set `` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Set the Subnet Bridge state. * ``State``: Disable or enable the Subnet Bridge functionality. -``mesh models brg_cfg table-size-get`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +``mesh models brg table-size-get`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Get the current size of the Bridging Table. -``mesh models brg_cfg table-add `` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +``mesh models brg table-add `` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Add an entry to the Bridging Table. @@ -1827,8 +1827,8 @@ for configuring the subnet bridge functionality of a mesh node. * ``Addr1``: Address of the node in the first subnet. * ``Addr2``: Address of the node in the second subnet. -``mesh models brg_cfg table-remove `` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +``mesh models brg table-remove `` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Remove an entry from the Bridging Table. @@ -1837,8 +1837,8 @@ for configuring the subnet bridge functionality of a mesh node. * ``Addr1``: Address of the node in the first subnet. * ``Addr2``: Address of the node in the second subnet. -``mesh models brg_cfg subnets-get `` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +``mesh models brg subnets-get `` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Get a filtered set of NetKey index pairs extracted from the Bridging Table. @@ -1852,8 +1852,8 @@ for configuring the subnet bridge functionality of a mesh node. * ``NetIdx``: NetKey index of any of the subnets. * ``StartIdx``: Start offset in units of pairs of NetKey indexes to read. -``mesh models brg_cfg table-get `` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +``mesh models brg table-get `` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Get a list of addresses and allowed traffic directions of the Bridging Table entries. diff --git a/subsys/bluetooth/mesh/shell/brg_cfg.c b/subsys/bluetooth/mesh/shell/brg_cfg.c index cefaaa47035b8..ccaa23d8cad2a 100644 --- a/subsys/bluetooth/mesh/shell/brg_cfg.c +++ b/subsys/bluetooth/mesh/shell/brg_cfg.c @@ -231,16 +231,16 @@ static int cmd_bridging_table_get(const struct shell *sh, size_t argc, char *arg } SHELL_STATIC_SUBCMD_SET_CREATE( - brg_cfg_cmds, SHELL_CMD_ARG(bridge - get, NULL, NULL, cmd_subnet_bridge_get, 1, 0), - SHELL_CMD_ARG(bridge - set, NULL, "", cmd_subnet_bridge_set, 2, 0), - SHELL_CMD_ARG(table - size - get, NULL, NULL, cmd_bridging_table_size_get, 1, 0), - SHELL_CMD_ARG(table - add, NULL, " ", + brg_cfg_cmds, SHELL_CMD_ARG(get, NULL, NULL, cmd_subnet_bridge_get, 1, 0), + SHELL_CMD_ARG(set, NULL, "", cmd_subnet_bridge_set, 2, 0), + SHELL_CMD_ARG(table-size-get, NULL, NULL, cmd_bridging_table_size_get, 1, 0), + SHELL_CMD_ARG(table-add, NULL, " ", cmd_bridging_table_add, 6, 0), - SHELL_CMD_ARG(table - remove, NULL, " ", + SHELL_CMD_ARG(table-remove, NULL, " ", cmd_bridging_table_remove, 5, 0), - SHELL_CMD_ARG(subnets - get, NULL, " ", cmd_bridged_subnets_get, + SHELL_CMD_ARG(subnets-get, NULL, " ", cmd_bridged_subnets_get, 4, 0), - SHELL_CMD_ARG(table - get, NULL, " ", cmd_bridging_table_get, + SHELL_CMD_ARG(table-get, NULL, " ", cmd_bridging_table_get, 4, 0), SHELL_SUBCMD_SET_END); From b160063efbc3f5c1fd33a3c0e809bfdb11dd0d69 Mon Sep 17 00:00:00 2001 From: Omkar Kulkarni Date: Tue, 19 Nov 2024 12:20:24 +0100 Subject: [PATCH 2955/4482] Tests: Bluetooth: mesh_shell: Update prj.conf Updates and aligns the project config file to enable usage of multiple keys so that users are not required to manually update the project config file for testing most common mesh scenarios requiring multiple netkeys and appkeys. Signed-off-by: Omkar Kulkarni --- tests/bluetooth/mesh_shell/prj.conf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/bluetooth/mesh_shell/prj.conf b/tests/bluetooth/mesh_shell/prj.conf index bb4c878bdfdfb..043428e06a240 100644 --- a/tests/bluetooth/mesh_shell/prj.conf +++ b/tests/bluetooth/mesh_shell/prj.conf @@ -60,7 +60,7 @@ CONFIG_BT_MESH_PB_ADV=y CONFIG_BT_MESH_GATT_PROXY=y CONFIG_BT_MESH_NODE_ID_TIMEOUT=10 -CONFIG_BT_MESH_SUBNET_COUNT=2 +CONFIG_BT_MESH_SUBNET_COUNT=3 CONFIG_BT_MESH_APP_KEY_COUNT=2 # PTS requires more key slots when using Opcodes Aggregator. # First one is implicitly taken by Device Key. @@ -75,5 +75,7 @@ CONFIG_LOG_PROCESS_THREAD_SLEEP_MS=250 CONFIG_BT_MESH_IV_UPDATE_TEST=y CONFIG_BT_MESH_LOG_LEVEL_DBG=y CONFIG_BT_MESH_CDB=y +CONFIG_BT_MESH_CDB_SUBNET_COUNT=3 +CONFIG_BT_MESH_CDB_APP_KEY_COUNT=2 CONFIG_BT_MESH_PROVISIONER=y CONFIG_BT_MESH_STATISTIC=y From 035251d7da65d4758de174d82ae940f4e88e08af Mon Sep 17 00:00:00 2001 From: Matthias Hauser Date: Tue, 19 Nov 2024 09:56:40 +0100 Subject: [PATCH 2956/4482] boards: we: Add board orthosie1ev Added new board file of Wurth Electronic board Orthosie-I Signed-off-by: Matthias Hauser --- boards/we/orthosie1ev/Kconfig | 6 + boards/we/orthosie1ev/Kconfig.sysbuild | 10 + boards/we/orthosie1ev/Kconfig.we_orthosie1ev | 5 + boards/we/orthosie1ev/board.cmake | 9 + boards/we/orthosie1ev/board.yml | 6 + .../orthosie1ev/doc/img/we_orthosie1ev.webp | Bin 0 -> 37808 bytes boards/we/orthosie1ev/doc/index.rst | 251 ++++++++++++++++++ boards/we/orthosie1ev/support/openocd.cfg | 11 + .../orthosie1ev/we_orthosie1ev-pinctrl.dtsi | 66 +++++ boards/we/orthosie1ev/we_orthosie1ev.dts | 105 ++++++++ boards/we/orthosie1ev/we_orthosie1ev.yaml | 23 ++ .../we/orthosie1ev/we_orthosie1ev_defconfig | 8 + 12 files changed, 500 insertions(+) create mode 100644 boards/we/orthosie1ev/Kconfig create mode 100644 boards/we/orthosie1ev/Kconfig.sysbuild create mode 100644 boards/we/orthosie1ev/Kconfig.we_orthosie1ev create mode 100644 boards/we/orthosie1ev/board.cmake create mode 100644 boards/we/orthosie1ev/board.yml create mode 100644 boards/we/orthosie1ev/doc/img/we_orthosie1ev.webp create mode 100644 boards/we/orthosie1ev/doc/index.rst create mode 100644 boards/we/orthosie1ev/support/openocd.cfg create mode 100644 boards/we/orthosie1ev/we_orthosie1ev-pinctrl.dtsi create mode 100644 boards/we/orthosie1ev/we_orthosie1ev.dts create mode 100644 boards/we/orthosie1ev/we_orthosie1ev.yaml create mode 100644 boards/we/orthosie1ev/we_orthosie1ev_defconfig diff --git a/boards/we/orthosie1ev/Kconfig b/boards/we/orthosie1ev/Kconfig new file mode 100644 index 0000000000000..acfac103f8c29 --- /dev/null +++ b/boards/we/orthosie1ev/Kconfig @@ -0,0 +1,6 @@ +# Copyright (c) Würth Elektronik GmbH & Co. KG +# SPDX-License-Identifier: Apache-2.0 + +config HEAP_MEM_POOL_ADD_SIZE_BOARD + int + default 4096 diff --git a/boards/we/orthosie1ev/Kconfig.sysbuild b/boards/we/orthosie1ev/Kconfig.sysbuild new file mode 100644 index 0000000000000..7f06e9b17fe68 --- /dev/null +++ b/boards/we/orthosie1ev/Kconfig.sysbuild @@ -0,0 +1,10 @@ +# Copyright (c) 2024 Würth Elektronik GmbH & Co. KG +# SPDX-License-Identifier: Apache-2.0 + +choice BOOTLOADER + default BOOTLOADER_MCUBOOT +endchoice + +choice BOOT_SIGNATURE_TYPE + default BOOT_SIGNATURE_TYPE_NONE +endchoice diff --git a/boards/we/orthosie1ev/Kconfig.we_orthosie1ev b/boards/we/orthosie1ev/Kconfig.we_orthosie1ev new file mode 100644 index 0000000000000..ec731e24f3f31 --- /dev/null +++ b/boards/we/orthosie1ev/Kconfig.we_orthosie1ev @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Würth Elektronik GmbH & Co. KG +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_WE_ORTHOSIE1EV + select SOC_ESP32C3 diff --git a/boards/we/orthosie1ev/board.cmake b/boards/we/orthosie1ev/board.cmake new file mode 100644 index 0000000000000..2f04d1fe8861e --- /dev/null +++ b/boards/we/orthosie1ev/board.cmake @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +if(NOT "${OPENOCD}" MATCHES "^${ESPRESSIF_TOOLCHAIN_PATH}/.*") + set(OPENOCD OPENOCD-NOTFOUND) +endif() +find_program(OPENOCD openocd PATHS ${ESPRESSIF_TOOLCHAIN_PATH}/openocd-esp32/bin NO_DEFAULT_PATH) + +include(${ZEPHYR_BASE}/boards/common/esp32.board.cmake) +include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/boards/we/orthosie1ev/board.yml b/boards/we/orthosie1ev/board.yml new file mode 100644 index 0000000000000..28762af893d5a --- /dev/null +++ b/boards/we/orthosie1ev/board.yml @@ -0,0 +1,6 @@ +board: + name: we_orthosie1ev + full_name: Orthosie-I-EV + vendor: we + socs: + - name: esp32c3 diff --git a/boards/we/orthosie1ev/doc/img/we_orthosie1ev.webp b/boards/we/orthosie1ev/doc/img/we_orthosie1ev.webp new file mode 100644 index 0000000000000000000000000000000000000000..aff718ad805e47064734a2ee69001fe15ad99c96 GIT binary patch literal 37808 zcmV(zK<2+vNk&GflK=o$MM6+kP&go*lK=ov6#|_BDw6>>0zREUnnGm&`IvO? zn_v3Bv>yKdSNjzIO#biGf6X764?PLlL5-7(u(lyS9 z;X$;HA1OQa%RW0R{?gS`3+yvGV;_zYvw|fxgRl^rK$vB52GA`+$n|{t-u|<3h#U_y zUXcQMr3KXkL0LXfBxGT&0;2&2{IPLp1gMHGx{*l%xvBwA`K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;hm+n4iWGFHJsjny>OrCJ#Fe6vxX|21* zDm-DoM5NGVEU!y9>jJ00)CpBk?jqkMxNlTxG-W4|_mN9{?=0jSVPP3(-Rj?DMlhGHTZVZdhw)i3{ zfEwq!m^xwf3alsDTk9?hIE}Y=1PXc|nk)=18d_m{u6@4;h+e^+w zJf^t?5axoh+|o+bbEMBhknZiipy~$_+hL?L=$mbjC?^?;I zL(HA`Da9stfV#(97}uz@R@J-F-L*Ny<8WT_)*gzA{~RQUrAs9^=rifW*BM!Yh^o4! zkvlP(?>F8eSt{e$mIw+@XWY_6;L$F~KaHc(Ff^bh;*_dICzf?N(at10;+tTE`xVJM z<1z+}$KX0loU3Pe9w*3beDDr!EO>&yGw+u2>EGI<`2*md#U34z-Pu`K8Tov+K)`ZT zThBc!Cm5MQ$G>J{lfaIme#@+oLZ{9(NPl*7X#mFnQ9A}hTEZMlgZU@HOI2YWt~0^a z_tqEZvR$Hg==8{pM+=m1>C=0Mn6z4YY!qIk$V&8iaYHuQFs z!yP>sN1&ZGzZevysB`s??FX&%GLj0jYF~jAcDnTySpCq1D0_KXoQ)DVF z&$LlEBrwGq>~tp0$H|yb#wq%v-#(~W{^ZS#phCRr03gh0PAs?Gfxq|4ew`=me{GHD zgOd$;kPG{QY|G9Kj)&gMAPboZmj*OR5`Vodx6arFKn!=5t8DPhLXcHwVBBJk+}X5P zi2SYP?>UjPyDzkbruo6OOGD;I`ap3C1aW!>00FZ$7z6|@70N0X4W@@GuTK1CloLK! YH9|U;yeajBFaflg+3}b%0L`!f0K;rTO#lD@ literal 0 HcmV?d00001 diff --git a/boards/we/orthosie1ev/doc/index.rst b/boards/we/orthosie1ev/doc/index.rst new file mode 100644 index 0000000000000..f6fdb4d554631 --- /dev/null +++ b/boards/we/orthosie1ev/doc/index.rst @@ -0,0 +1,251 @@ +.. zephyr:board:: we_orthosie1ev + +Overview +******** + +Orthosie-I-EV is an entry-level development board based on Orthosie-I, +a module named for its small size. This board integrates complete Wi-Fi and Bluetooth® Low Energy functions. +For more information, check `Orthosie-I Website`_. + +Hardware +******** + +ESP32-C3 is a single-core Wi-Fi and Bluetooth 5 (LE) microcontroller SoC, +based on the open-source RISC-V architecture. It strikes the right balance of power, +I/O capabilities and security, thus offering the optimal cost-effective +solution for connected devices. +The availability of Wi-Fi and Bluetooth 5 (LE) connectivity not only makes the device configuration easy, +but it also facilitates a variety of use-cases based on dual connectivity. + +The features include the following: + +- 32-bit core RISC-V microcontroller with a maximum clock speed of 160 MHz +- 400 KB of internal RAM +- 802.11b/g/n/e/i +- A Bluetooth LE subsystem that supports features of Bluetooth 5 and Bluetooth Mesh +- Various peripherals: + + - 12-bit ADC with up to 6 channels + - TWAI compatible with CAN bus 2.0 + - Temperature sensor + - 3x SPI + - 1x I2S + - 1x I2C + - 2x UART + - LED PWM with up to 6 channels + +- Cryptographic hardware acceleration (RNG, ECC, RSA, SHA-2, AES) + +For more information, check the datasheet at `ESP32-C3 Datasheet`_ or the technical reference +manual at `ESP32-C3 Technical Reference Manual`_. + +Supported Features +================== + +Currently Zephyr's ``we_orthosie1ev`` board target supports the following features: + ++------------+------------+-------------------------------------+ +| Interface | Controller | Driver/Component | ++============+============+=====================================+ +| UART | on-chip | serial port | ++------------+------------+-------------------------------------+ +| GPIO | on-chip | gpio | ++------------+------------+-------------------------------------+ +| PINMUX | on-chip | pinmux | ++------------+------------+-------------------------------------+ +| USB-JTAG | on-chip | hardware interface | ++------------+------------+-------------------------------------+ +| SPI Master | on-chip | spi | ++------------+------------+-------------------------------------+ +| Timers | on-chip | counter | ++------------+------------+-------------------------------------+ +| Watchdog | on-chip | watchdog | ++------------+------------+-------------------------------------+ +| TRNG | on-chip | entropy | ++------------+------------+-------------------------------------+ +| LEDC | on-chip | pwm | ++------------+------------+-------------------------------------+ +| SPI DMA | on-chip | spi | ++------------+------------+-------------------------------------+ +| TWAI | on-chip | can | ++------------+------------+-------------------------------------+ +| USB-CDC | on-chip | serial | ++------------+------------+-------------------------------------+ +| ADC | on-chip | adc | ++------------+------------+-------------------------------------+ +| Wi-Fi | on-chip | | ++------------+------------+-------------------------------------+ +| Bluetooth | on-chip | | ++------------+------------+-------------------------------------+ + +System requirements +******************* + +Prerequisites +============= + +Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command +below to retrieve those files. + +.. code-block:: console + + west blobs fetch hal_espressif + +.. note:: + + It is recommended running the command above after :file:`west update`. + +Building & Flashing +******************* + +Simple boot +=========== + +The board could be loaded using the single binary image, without 2nd stage bootloader. +It is the default option when building the application without additional configuration. + +.. note:: + + Simple boot does not provide any security features nor OTA updates. + +MCUboot bootloader +================== + +User may choose to use MCUboot bootloader instead. In that case the bootloader +must be built (and flashed) at least once. + +There are two options to be used when building an application: + +1. Sysbuild +2. Manual build + +.. note:: + + User can select the MCUboot bootloader by adding the following line + to the board default configuration file. + + .. code:: cfg + + CONFIG_BOOTLOADER_MCUBOOT=y + +Sysbuild +======== + +The sysbuild makes possible to build and flash all necessary images needed to +bootstrap the board with the ESP32 SoC. + +To build the sample application using sysbuild use the command: + +.. zephyr-app-commands:: + :tool: west + :zephyr-app: samples/hello_world + :board: orthosie1ev + :goals: build + :west-args: --sysbuild + :compact: + +By default, the ESP32 sysbuild creates bootloader (MCUboot) and application +images. But it can be configured to create other kind of images. + +Build directory structure created by sysbuild is different from traditional +Zephyr build. Output is structured by the domain subdirectories: + +.. code-block:: + + build/ + ├── hello_world + │ └── zephyr + │ ├── zephyr.elf + │ └── zephyr.bin + ├── mcuboot + │ └── zephyr + │ ├── zephyr.elf + │ └── zephyr.bin + └── domains.yaml + +.. note:: + + With ``--sysbuild`` option the bootloader will be re-build and re-flash + every time the pristine build is used. + +For more information about the system build please read the :ref:`sysbuild` documentation. + +Manual build +============ + +During the development cycle, it is intended to build & flash as quickly possible. +For that reason, images can be built one at a time using traditional build. + +The instructions following are relevant for both manual build and sysbuild. +The only difference is the structure of the build directory. + +.. note:: + + Remember that bootloader (MCUboot) needs to be flash at least once. + +Build and flash applications as usual (see :ref:`build_an_application` and +:ref:`application_run` for more details). + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: orthosie1ev + :goals: build + +The usual ``flash`` target will work with the ``orthosie1ev`` board +configuration. Here is an example for the :zephyr:code-sample:`hello_world` +application. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: orthosie1ev + :goals: flash + +Open the serial monitor using the following command: + +.. code-block:: shell + + west espressif monitor + +After the board has automatically reset and booted, you should see the following +message in the monitor: + +.. code-block:: console + + ***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx ***** + Hello World! orthosie1ev + +Debugging +********* + +As with much custom hardware, the ESP32-C3 modules require patches to +OpenOCD that are not upstreamed yet. Espressif maintains their own fork of +the project. The custom OpenOCD can be obtained at `OpenOCD ESP32`_. + +The Zephyr SDK uses a bundled version of OpenOCD by default. You can overwrite that behavior by adding the +``-DOPENOCD= -DOPENOCD_DEFAULT_PATH=`` +parameter when building. + +Here is an example for building the :zephyr:code-sample:`hello_world` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: orthosie1ev + :goals: build flash + :gen-args: -DOPENOCD= -DOPENOCD_DEFAULT_PATH= + +You can debug an application in the usual way. Here is an example for the :zephyr:code-sample:`hello_world` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: orthosie1ev + :goals: debug + +References +********** + +.. target-notes:: + +.. _`Orthosie-I Website`: https://www.we-online.com/en/components/products/ORTHOSIE-I +.. _`ESP32-C3 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf +.. _`ESP32-C3 Technical Reference Manual`: https://espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf +.. _`OpenOCD ESP32`: https://github.com/espressif/openocd-esp32/releases diff --git a/boards/we/orthosie1ev/support/openocd.cfg b/boards/we/orthosie1ev/support/openocd.cfg new file mode 100644 index 0000000000000..92a792fecb8eb --- /dev/null +++ b/boards/we/orthosie1ev/support/openocd.cfg @@ -0,0 +1,11 @@ +set ESP_RTOS none + +# ESP32C3 has built-in JTAG interface over USB port in pins GPIO18/GPIO19 (D-/D+). +# Uncomment the line below to enable USB debugging. +# source [find interface/esp_usb_jtag.cfg] + +# Otherwise, use external JTAG programmer as ESP-Prog +source [find interface/ftdi/esp32_devkitj_v1.cfg] + +source [find target/esp32c3.cfg] +adapter speed 5000 diff --git a/boards/we/orthosie1ev/we_orthosie1ev-pinctrl.dtsi b/boards/we/orthosie1ev/we_orthosie1ev-pinctrl.dtsi new file mode 100644 index 0000000000000..881f1b3808db8 --- /dev/null +++ b/boards/we/orthosie1ev/we_orthosie1ev-pinctrl.dtsi @@ -0,0 +1,66 @@ +/* + * Copyright (c) Würth Elektronik GmbH & Co. KG + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +&pinctrl { + + uart0_default: uart0_default { + group1 { + pinmux = ; + output-high; + }; + group2 { + pinmux = ; + bias-pull-up; + }; + }; + + spim2_default: spim2_default { + group1 { + pinmux = , + , + ; + }; + group2 { + pinmux = ; + output-low; + }; + }; + + i2c0_default: i2c0_default { + group1 { + pinmux = , + ; + bias-pull-up; + drive-open-drain; + output-high; + }; + }; + + i2s_default: i2s_default { + group1 { + pinmux = , + , + , + ; + output-enable; + }; + group2 { + pinmux = ; + input-enable; + }; + }; + + twai_default: twai_default { + group1 { + pinmux = , + ; + }; + }; +}; diff --git a/boards/we/orthosie1ev/we_orthosie1ev.dts b/boards/we/orthosie1ev/we_orthosie1ev.dts new file mode 100644 index 0000000000000..4958bf4221c5a --- /dev/null +++ b/boards/we/orthosie1ev/we_orthosie1ev.dts @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2024 Würth Elektronik GmbH & Co. KG + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "we_orthosie1ev-pinctrl.dtsi" +#include +#include + +/ { + model = "we_orthosie1ev"; + compatible = "we,we-orthosie1ev"; + + chosen { + zephyr,sram = &sram0; + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_partition; + zephyr,bt-hci = &esp32_bt_hci; + }; + + aliases { + sw0 = &user_button1; + i2c-0 = &i2c0; + watchdog0 = &wdt0; + }; + + gpio_keys { + compatible = "gpio-keys"; + user_button1: button_1 { + label = "User SW1"; + gpios = <&gpio0 3 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + zephyr,code = ; + }; + }; +}; + +&uart0 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart0_default>; + pinctrl-names = "default"; +}; + +&usb_serial { + /* requires resoldering of resistors on the board */ + status = "okay"; +}; + +&i2c0 { + status = "okay"; + clock-frequency = ; + pinctrl-0 = <&i2c0_default>; + pinctrl-names = "default"; +}; + +&i2s { + pinctrl-0 = <&i2s_default>; + pinctrl-names = "default"; + status = "disabled"; +}; + +&trng0 { + status = "okay"; +}; + +&spi2 { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + pinctrl-0 = <&spim2_default>; + pinctrl-names = "default"; +}; + +&gpio0 { + status = "okay"; +}; + +&wdt0 { + status = "okay"; +}; + +&timer0 { + status = "disabled"; +}; + +&timer1 { + status = "disabled"; +}; + +&twai { + /* requires external CAN transceiver or jumper on RX and TX pins for loopback testing */ + status = "disabled"; + pinctrl-0 = <&twai_default>; + pinctrl-names = "default"; +}; + +&esp32_bt_hci { + status = "okay"; +}; diff --git a/boards/we/orthosie1ev/we_orthosie1ev.yaml b/boards/we/orthosie1ev/we_orthosie1ev.yaml new file mode 100644 index 0000000000000..82e60eadc3247 --- /dev/null +++ b/boards/we/orthosie1ev/we_orthosie1ev.yaml @@ -0,0 +1,23 @@ +identifier: we_orthosie1ev +name: we_orthosie1ev +type: mcu +arch: riscv +toolchain: + - zephyr +supported: + - adc + - gpio + - i2c + - i2s + - watchdog + - uart + - dma + - pwm + - spi + - counter + - entropy +testing: + ignore_tags: + - net + - bluetooth +vendor: we diff --git a/boards/we/orthosie1ev/we_orthosie1ev_defconfig b/boards/we/orthosie1ev/we_orthosie1ev_defconfig new file mode 100644 index 0000000000000..ef633ce56a18e --- /dev/null +++ b/boards/we/orthosie1ev/we_orthosie1ev_defconfig @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_MAIN_STACK_SIZE=2048 + +CONFIG_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_UART_CONSOLE=y +CONFIG_GPIO=y From 34a6d5a5dc834f26f06fb318b9c9a21c286a7227 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 18 Nov 2024 15:28:38 +0200 Subject: [PATCH 2957/4482] tests: coap_client: Proper slow-down Use real-time scheduler with 100x speedup, so timeouts are accurate enough, but still fast for tests to run. Signed-off-by: Seppo Takalo --- tests/net/lib/coap_client/CMakeLists.txt | 2 +- tests/net/lib/coap_client/boards/native_sim.conf | 1 + tests/net/lib/coap_client/src/main.c | 15 ++++++++++++--- tests/net/lib/coap_client/src/stubs.c | 5 ++++- 4 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 tests/net/lib/coap_client/boards/native_sim.conf diff --git a/tests/net/lib/coap_client/CMakeLists.txt b/tests/net/lib/coap_client/CMakeLists.txt index 6e3b6353e08ca..9ed7926a20417 100644 --- a/tests/net/lib/coap_client/CMakeLists.txt +++ b/tests/net/lib/coap_client/CMakeLists.txt @@ -26,7 +26,7 @@ add_compile_definitions(CONFIG_COAP_CLIENT_MESSAGE_HEADER_SIZE=48) add_compile_definitions(CONFIG_COAP_CLIENT_STACK_SIZE=1024) add_compile_definitions(CONFIG_COAP_CLIENT_THREAD_PRIORITY=10) add_compile_definitions(CONFIG_COAP_LOG_LEVEL=4) -add_compile_definitions(CONFIG_COAP_INIT_ACK_TIMEOUT_MS=100) +add_compile_definitions(CONFIG_COAP_INIT_ACK_TIMEOUT_MS=1000) add_compile_definitions(CONFIG_COAP_CLIENT_MAX_REQUESTS=2) add_compile_definitions(CONFIG_COAP_CLIENT_MAX_INSTANCES=2) add_compile_definitions(CONFIG_COAP_MAX_RETRANSMIT=4) diff --git a/tests/net/lib/coap_client/boards/native_sim.conf b/tests/net/lib/coap_client/boards/native_sim.conf new file mode 100644 index 0000000000000..0843e94acbdbd --- /dev/null +++ b/tests/net/lib/coap_client/boards/native_sim.conf @@ -0,0 +1 @@ +CONFIG_NATIVE_SIM_SLOWDOWN_TO_REAL_TIME=y diff --git a/tests/net/lib/coap_client/src/main.c b/tests/net/lib/coap_client/src/main.c index 2f3fa28ebff0c..72b84a60f5e75 100644 --- a/tests/net/lib/coap_client/src/main.c +++ b/tests/net/lib/coap_client/src/main.c @@ -8,7 +8,9 @@ #include #include #include - +#if defined(CONFIG_NATIVE_SIM_SLOWDOWN_TO_REAL_TIME) +#include "timer_model.h" +#endif #include "stubs.h" LOG_MODULE_REGISTER(coap_client_test, LOG_LEVEL_DBG); @@ -16,12 +18,12 @@ LOG_MODULE_REGISTER(coap_client_test, LOG_LEVEL_DBG); DEFINE_FFF_GLOBALS; #define FFF_FAKES_LIST(FAKE) -#define LONG_ACK_TIMEOUT_MS 200 +#define LONG_ACK_TIMEOUT_MS (2 * CONFIG_COAP_INIT_ACK_TIMEOUT_MS) #define MORE_THAN_EXCHANGE_LIFETIME_MS 4 * CONFIG_COAP_INIT_ACK_TIMEOUT_MS #define MORE_THAN_LONG_EXCHANGE_LIFETIME_MS 4 * LONG_ACK_TIMEOUT_MS #define MORE_THAN_ACK_TIMEOUT_MS \ (CONFIG_COAP_INIT_ACK_TIMEOUT_MS + CONFIG_COAP_INIT_ACK_TIMEOUT_MS / 2) -#define COAP_SEPARATE_TIMEOUT (6000 * 3) /* Needs a safety marging, tests run faster than -rt */ +#define COAP_SEPARATE_TIMEOUT (6000 * 2) /* Needs a safety marging, tests run faster than -rt */ #define VALID_MESSAGE_ID BIT(31) #define TOKEN_OFFSET 4 @@ -425,6 +427,13 @@ extern void net_coap_init(void); static void *suite_setup(void) { +#if defined(CONFIG_NATIVE_SIM_SLOWDOWN_TO_REAL_TIME) + /* It is enough that some slow-down is happening on sleeps, it does not have to be + * real time + */ + hwtimer_set_rt_ratio(100.0); + k_sleep(K_MSEC(1)); +#endif net_coap_init(); zassert_ok(coap_client_init(&client, NULL)); zassert_ok(coap_client_init(&client2, NULL)); diff --git a/tests/net/lib/coap_client/src/stubs.c b/tests/net/lib/coap_client/src/stubs.c index 8d251157ac1a6..76289991155bc 100644 --- a/tests/net/lib/coap_client/src/stubs.c +++ b/tests/net/lib/coap_client/src/stubs.c @@ -7,7 +7,7 @@ #include #include -LOG_MODULE_DECLARE(coap_client_test); +LOG_MODULE_DECLARE(coap_client_test, LOG_LEVEL_DBG); DEFINE_FAKE_VALUE_FUNC(uint32_t, z_impl_sys_rand32_get); DEFINE_FAKE_VALUE_FUNC(ssize_t, z_impl_zsock_recvfrom, int, void *, size_t, int, struct sockaddr *, @@ -45,6 +45,9 @@ int z_impl_zvfs_poll(struct zvfs_pollfd *fds, int nfds, int poll_timeout) events++; } } + if (events == 0) { + k_sleep(K_MSEC(poll_timeout)); + } return events; } From d64748cc5247645dbbc469d9f1ecf3f80dca561d Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 18 Nov 2024 15:36:16 +0200 Subject: [PATCH 2958/4482] tests: coap_client: Refactor tests Refactor tests to be a bit shorter, so its easier to read and copy-paste for a new testcase All idioms like "ret = somecall(); zasser.." are replaced with just "zassert_ok(some_call());" Commonly used structures are global and initialized once. To avoid cross-test side-effects, suite_after-function is added to cleanup all requests. Signed-off-by: Seppo Takalo --- tests/net/lib/coap_client/src/main.c | 594 ++++++--------------------- 1 file changed, 119 insertions(+), 475 deletions(-) diff --git a/tests/net/lib/coap_client/src/main.c b/tests/net/lib/coap_client/src/main.c index 72b84a60f5e75..a620b1985e0f8 100644 --- a/tests/net/lib/coap_client/src/main.c +++ b/tests/net/lib/coap_client/src/main.c @@ -27,20 +27,48 @@ DEFINE_FFF_GLOBALS; #define VALID_MESSAGE_ID BIT(31) #define TOKEN_OFFSET 4 +void coap_callback(int16_t code, size_t offset, const uint8_t *payload, size_t len, bool last_block, + void *user_data); + static int16_t last_response_code; -static const char *test_path = "test"; +static const char test_path[] = "test"; static uint32_t messages_needing_response[2]; static uint8_t last_token[2][COAP_TOKEN_MAX_LEN]; static const uint8_t empty_token[COAP_TOKEN_MAX_LEN] = {0}; +K_SEM_DEFINE(sem1, 0, 1); +K_SEM_DEFINE(sem2, 0, 1); static struct coap_client client; static struct coap_client client2 = { .fd = 1, }; -static char *short_payload = "testing"; -static char *long_payload = LOREM_IPSUM_SHORT; +static const char short_payload[] = "testing"; +static const char long_payload[] = LOREM_IPSUM_SHORT; +static struct coap_client_request short_request = { + .method = COAP_METHOD_GET, + .confirmable = true, + .path = test_path, + .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, + .cb = coap_callback, + .payload = short_payload, + .len = sizeof(short_payload) - 1, + .user_data = &sem1, +}; +static struct coap_client_request long_request = { + .method = COAP_METHOD_GET, + .confirmable = true, + .path = test_path, + .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, + .cb = coap_callback, + .payload = long_payload, + .len = sizeof(long_payload) - 1, + .user_data = &sem2, +}; +static struct sockaddr dst_address; + + static uint16_t get_next_pending_message_id(void) { @@ -423,6 +451,16 @@ static ssize_t z_impl_zsock_recvfrom_custom_fake_observe(int sock, void *buf, si return ret; } +void coap_callback(int16_t code, size_t offset, const uint8_t *payload, size_t len, bool last_block, + void *user_data) +{ + LOG_INF("CoAP response callback, %d", code); + last_response_code = code; + if (user_data) { + k_sem_give((struct k_sem *) user_data); + } +} + extern void net_coap_init(void); static void *suite_setup(void) @@ -463,90 +501,38 @@ static void test_setup(void *data) memset(&client.requests, 0, sizeof(client.requests)); memset(last_token, 0, sizeof(last_token)); - last_response_code = 0; + k_sem_reset(&sem1); + k_sem_reset(&sem2); k_mutex_unlock(&client.lock); } -void coap_callback(int16_t code, size_t offset, const uint8_t *payload, size_t len, bool last_block, - void *user_data) +static void test_after(void *data) { - LOG_INF("CoAP response callback, %d", code); - last_response_code = code; - if (user_data) { - k_sem_give((struct k_sem *) user_data); - } + coap_client_cancel_requests(&client); + coap_client_cancel_requests(&client2); } -ZTEST_SUITE(coap_client, NULL, suite_setup, test_setup, NULL, NULL); +ZTEST_SUITE(coap_client, NULL, suite_setup, test_setup, test_after, NULL); ZTEST(coap_client, test_get_request) { - int ret = 0; - struct sockaddr address = {0}; - struct coap_client_request client_request = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = test_path, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = NULL, - .len = 0 - }; - - client_request.payload = short_payload; - client_request.len = strlen(short_payload); - - k_sleep(K_MSEC(1)); - - LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, NULL); - zassert_true(ret >= 0, "Sending request failed, %d", ret); + zassert_ok(coap_client_req(&client, 0, &dst_address, &short_request, NULL)); k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); - LOG_INF("Test done"); } ZTEST(coap_client, test_request_block) { - int ret = 0; - struct sockaddr address = {0}; - struct coap_client_request client_request = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = test_path, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = short_payload, - .len = strlen(short_payload), - }; - z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_block; - k_sleep(K_MSEC(1)); - - LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, NULL); - zassert_equal(ret, -EAGAIN, ""); + zassert_equal(coap_client_req(&client, 0, &dst_address, &short_request, NULL), -EAGAIN, ""); } - ZTEST(coap_client, test_resend_request) { - int ret = 0; - struct sockaddr address = {0}; - struct coap_client_request client_request = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = test_path, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = short_payload, - .len = strlen(short_payload), - }; - int (*sendto_fakes[])(int, void *, size_t, int, const struct sockaddr *, socklen_t) = { z_impl_zsock_sendto_custom_fake_no_reply, z_impl_zsock_sendto_custom_fake_block, @@ -556,86 +542,43 @@ ZTEST(coap_client, test_resend_request) SET_CUSTOM_FAKE_SEQ(z_impl_zsock_sendto, sendto_fakes, ARRAY_SIZE(sendto_fakes)); set_socket_events(client.fd, ZSOCK_POLLOUT); - k_sleep(K_MSEC(1)); - - LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, NULL); - zassert_true(ret >= 0, "Sending request failed, %d", ret); + zassert_ok(coap_client_req(&client, 0, &dst_address, &short_request, NULL)); k_sleep(K_MSEC(MORE_THAN_ACK_TIMEOUT_MS)); k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); zassert_equal(z_impl_zsock_sendto_fake.call_count, 3); - LOG_INF("Test done"); } ZTEST(coap_client, test_echo_option) { - int ret = 0; - struct sockaddr address = {0}; - struct coap_client_request client_request = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = test_path, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = NULL, - .len = 0 - }; - - client_request.payload = short_payload; - client_request.len = strlen(short_payload); - z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_echo; - k_sleep(K_MSEC(1)); - - LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, NULL); - zassert_true(ret >= 0, "Sending request failed, %d", ret); + zassert_ok(coap_client_req(&client, 0, &dst_address, &short_request, NULL)); k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); - LOG_INF("Test done"); } ZTEST(coap_client, test_echo_option_next_req) { - int ret = 0; - struct sockaddr address = {0}; - struct coap_client_request client_request = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = test_path, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = NULL, - .len = 0 - }; - - client_request.payload = short_payload; - client_request.len = strlen(short_payload); + struct coap_client_request req = short_request; z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_echo_next_req; - k_sleep(K_MSEC(1)); - - LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, NULL); - zassert_true(ret >= 0, "Sending request failed, %d", ret); + zassert_ok(coap_client_req(&client, 0, &dst_address, &short_request, NULL)); k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); char *payload = "echo testing"; - client_request.method = COAP_METHOD_POST; - client_request.payload = payload; - client_request.len = strlen(payload); + req.method = COAP_METHOD_POST; + req.payload = payload; + req.len = strlen(payload); LOG_INF("Send next request"); - ret = coap_client_req(&client, 0, &address, &client_request, NULL); - zassert_true(ret >= 0, "Sending request failed, %d", ret); + zassert_ok(coap_client_req(&client, 0, &dst_address, &req, NULL)); k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); @@ -643,51 +586,15 @@ ZTEST(coap_client, test_echo_option_next_req) ZTEST(coap_client, test_get_no_path) { - int ret = 0; - struct sockaddr address = {0}; - struct coap_client_request client_request = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = NULL, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = NULL, - .len = 0 - }; + struct coap_client_request req = short_request; - client_request.payload = short_payload; - client_request.len = strlen(short_payload); - - k_sleep(K_MSEC(1)); - - LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, NULL); - - zassert_equal(ret, -EINVAL, "Get request without path"); + req.path = NULL; + zassert_equal(coap_client_req(&client, 0, &dst_address, &req, NULL), -EINVAL, ""); } ZTEST(coap_client, test_send_large_data) { - int ret = 0; - struct sockaddr address = {0}; - struct coap_client_request client_request = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = test_path, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = NULL, - .len = 0 - }; - - client_request.payload = long_payload; - client_request.len = strlen(long_payload); - - k_sleep(K_MSEC(1)); - - LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, NULL); - zassert_true(ret >= 0, "Sending request failed, %d", ret); + zassert_ok(coap_client_req(&client, 0, &dst_address, &long_request, NULL)); k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); @@ -695,35 +602,16 @@ ZTEST(coap_client, test_send_large_data) ZTEST(coap_client, test_no_response) { - int ret = 0; - struct sockaddr address = {0}; - struct coap_client_request client_request = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = test_path, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = NULL, - .len = 0 - }; struct coap_transmission_parameters params = { .ack_timeout = LONG_ACK_TIMEOUT_MS, .coap_backoff_percent = 200, .max_retransmission = 0 }; - client_request.payload = short_payload; - client_request.len = strlen(short_payload); - z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; set_socket_events(client.fd, ZSOCK_POLLOUT); - k_sleep(K_MSEC(1)); - - LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, ¶ms); - - zassert_true(ret >= 0, "Sending request failed, %d", ret); + zassert_ok(coap_client_req(&client, 0, &dst_address, &short_request, ¶ms)); k_sleep(K_MSEC(MORE_THAN_LONG_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, -ETIMEDOUT, "Unexpected response"); @@ -731,28 +619,9 @@ ZTEST(coap_client, test_no_response) ZTEST(coap_client, test_separate_response) { - int ret = 0; - struct sockaddr address = {0}; - struct coap_client_request client_request = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = test_path, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = NULL, - .len = 0 - }; - - client_request.payload = short_payload; - client_request.len = strlen(short_payload); - z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_empty_ack; - k_sleep(K_MSEC(1)); - - LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, NULL); - zassert_true(ret >= 0, "Sending request failed, %d", ret); + zassert_ok(coap_client_req(&client, 0, &dst_address, &short_request, NULL)); k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); @@ -760,50 +629,24 @@ ZTEST(coap_client, test_separate_response) ZTEST(coap_client, test_separate_response_lost) { - int ret = 0; - struct k_sem sem; - struct sockaddr address = {0}; - struct coap_client_request client_request = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = test_path, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = short_payload, - .len = strlen(short_payload), - .user_data = &sem, - }; + struct coap_client_request req = short_request; + + req.user_data = &sem1; - zassert_ok(k_sem_init(&sem, 0, 1)); z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_only_ack; set_socket_events(client.fd, ZSOCK_POLLOUT); - k_sleep(K_MSEC(1)); - - LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, NULL); - zassert_true(ret >= 0, "Sending request failed, %d", ret); + zassert_ok(coap_client_req(&client, 0, &dst_address, &req, NULL)); - zassert_ok(k_sem_take(&sem, K_MSEC(COAP_SEPARATE_TIMEOUT))); + zassert_ok(k_sem_take(&sem1, K_MSEC(COAP_SEPARATE_TIMEOUT))); zassert_equal(last_response_code, -ETIMEDOUT, ""); } ZTEST(coap_client, test_separate_response_ack_fail) { - int ret = 0; - struct k_sem sem; - struct sockaddr address = {0}; - struct coap_client_request client_request = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = test_path, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = short_payload, - .len = strlen(short_payload), - .user_data = &sem, - }; - zassert_ok(k_sem_init(&sem, 0, 1)); + struct coap_client_request req = short_request; + + req.user_data = &sem1; int (*sendto_fakes[])(int, void *, size_t, int, const struct sockaddr *, socklen_t) = { z_impl_zsock_sendto_custom_fake, @@ -813,95 +656,47 @@ ZTEST(coap_client, test_separate_response_ack_fail) SET_CUSTOM_FAKE_SEQ(z_impl_zsock_sendto, sendto_fakes, ARRAY_SIZE(sendto_fakes)); z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_empty_ack; - k_sleep(K_MSEC(1)); - - LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, NULL); - zassert_true(ret >= 0, "Sending request failed, %d", ret); + zassert_ok(coap_client_req(&client, 0, &dst_address, &req, NULL)); - zassert_ok(k_sem_take(&sem, K_MSEC(COAP_SEPARATE_TIMEOUT))); + zassert_ok(k_sem_take(&sem1, K_MSEC(COAP_SEPARATE_TIMEOUT))); zassert_equal(last_response_code, -ENETDOWN, ""); } ZTEST(coap_client, test_multiple_requests) { - int ret = 0; - int retry = MORE_THAN_EXCHANGE_LIFETIME_MS; - struct k_sem sem1, sem2; - - struct sockaddr address = {0}; - struct coap_client_request req1 = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = test_path, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = short_payload, - .len = strlen(short_payload), - .user_data = &sem1 - }; - struct coap_client_request req2 = req1; + struct coap_client_request req1 = short_request; + struct coap_client_request req2 = short_request; + req1.user_data = &sem1; req2.user_data = &sem2; - k_sem_init(&sem1, 0, 1); - k_sem_init(&sem2, 0, 1); - z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; - k_sleep(K_MSEC(1)); - - LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &req1, NULL); - zassert_true(ret >= 0, "Sending request failed, %d", ret); - - ret = coap_client_req(&client, 0, &address, &req2, NULL); - zassert_true(ret >= 0, "Sending request failed, %d", ret); + zassert_ok(coap_client_req(&client, 0, &dst_address, &req1, NULL)); + zassert_ok(coap_client_req(&client, 0, &dst_address, &req2, NULL)); set_socket_events(client.fd, ZSOCK_POLLIN); - while (last_response_code == 0 && retry > 0) { - retry--; - k_sleep(K_MSEC(1)); - } + zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); last_response_code = 0; set_socket_events(client.fd, ZSOCK_POLLIN); - zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); zassert_ok(k_sem_take(&sem2, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); } ZTEST(coap_client, test_unmatching_tokens) { - int ret = 0; - struct sockaddr address = {0}; - struct coap_client_request client_request = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = test_path, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = NULL, - .len = 0 - }; struct coap_transmission_parameters params = { .ack_timeout = LONG_ACK_TIMEOUT_MS, .coap_backoff_percent = 200, .max_retransmission = 0 }; - client_request.payload = short_payload; - client_request.len = strlen(short_payload); - z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_unmatching; set_socket_events(client.fd, ZSOCK_POLLIN | ZSOCK_POLLOUT); - k_sleep(K_MSEC(1)); - - LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, ¶ms); - zassert_true(ret >= 0, "Sending request failed, %d", ret); + zassert_ok(coap_client_req(&client, 0, &dst_address, &short_request, ¶ms)); k_sleep(K_MSEC(MORE_THAN_LONG_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, -ETIMEDOUT, "Unexpected response"); @@ -909,45 +704,14 @@ ZTEST(coap_client, test_unmatching_tokens) ZTEST(coap_client, test_multiple_clients) { - int ret; - int retry = MORE_THAN_EXCHANGE_LIFETIME_MS; - struct k_sem sem1, sem2; - struct sockaddr address = {0}; - struct coap_client_request req1 = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = test_path, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = short_payload, - .len = strlen(short_payload), - .user_data = &sem1 - }; - struct coap_client_request req2 = req1; + struct coap_client_request req1 = short_request; + struct coap_client_request req2 = long_request; + req1.user_data = &sem1; req2.user_data = &sem2; - req2.payload = long_payload; - req2.len = strlen(long_payload); - - zassert_ok(k_sem_init(&sem1, 0, 1)); - zassert_ok(k_sem_init(&sem2, 0, 1)); - - k_sleep(K_MSEC(1)); - LOG_INF("Sending requests"); - ret = coap_client_req(&client, client.fd, &address, &req1, NULL); - zassert_true(ret >= 0, "Sending request failed, %d", ret); - - ret = coap_client_req(&client2, client2.fd, &address, &req2, NULL); - zassert_true(ret >= 0, "Sending request failed, %d", ret); - - while (last_response_code == 0 && retry > 0) { - retry--; - k_sleep(K_MSEC(1)); - } - set_socket_events(client2.fd, ZSOCK_POLLIN); - - k_sleep(K_SECONDS(1)); + zassert_ok(coap_client_req(&client, client.fd, &dst_address, &req1, NULL)); + zassert_ok(coap_client_req(&client2, client2.fd, &dst_address, &req2, NULL)); /* ensure we got both responses */ zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); @@ -958,26 +722,10 @@ ZTEST(coap_client, test_multiple_clients) ZTEST(coap_client, test_poll_err) { - int ret = 0; - struct sockaddr address = {0}; - struct coap_client_request client_request = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = test_path, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = short_payload, - .len = strlen(short_payload), - }; - z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; set_socket_events(client.fd, ZSOCK_POLLERR); - k_sleep(K_MSEC(1)); - - LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, NULL); - zassert_true(ret >= 0, "Sending request failed, %d", ret); + zassert_ok(coap_client_req(&client, 0, &dst_address, &short_request, NULL)); k_sleep(K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)); zassert_equal(last_response_code, -EIO, "Unexpected response"); @@ -985,29 +733,10 @@ ZTEST(coap_client, test_poll_err) ZTEST(coap_client, test_poll_err_after_response) { - int ret = 0; - struct k_sem sem1; - struct sockaddr address = {0}; - struct coap_client_request client_request = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = test_path, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = short_payload, - .len = strlen(short_payload), - .user_data = &sem1 - }; - - zassert_ok(k_sem_init(&sem1, 0, 1)); z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; set_socket_events(client.fd, ZSOCK_POLLIN); - k_sleep(K_MSEC(1)); - - LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, NULL); - zassert_true(ret >= 0, "Sending request failed, %d", ret); + zassert_ok(coap_client_req(&client, 0, &dst_address, &short_request, NULL)); zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); @@ -1018,35 +747,17 @@ ZTEST(coap_client, test_poll_err_after_response) ZTEST(coap_client, test_poll_err_on_another_sock) { - int ret = 0; - struct k_sem sem1, sem2; - struct sockaddr address = {0}; - struct coap_client_request client_request = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = test_path, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = short_payload, - .len = strlen(short_payload), - .user_data = &sem1 - }; - struct coap_client_request request2 = client_request; - - request2.user_data = &sem2; + struct coap_client_request req1 = short_request; + struct coap_client_request req2 = short_request; - zassert_ok(k_sem_init(&sem1, 0, 1)); - zassert_ok(k_sem_init(&sem2, 0, 1)); + req1.user_data = &sem1; + req2.user_data = &sem2; z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; set_socket_events(client.fd, ZSOCK_POLLERR); - k_sleep(K_MSEC(1)); - - ret = coap_client_req(&client2, client2.fd, &address, &request2, NULL); - zassert_true(ret >= 0, "Sending request failed, %d", ret); - ret = coap_client_req(&client, client.fd, &address, &client_request, NULL); - zassert_true(ret >= 0, "Sending request failed, %d", ret); + zassert_ok(coap_client_req(&client2, client2.fd, &dst_address, &req2, NULL)); + zassert_ok(coap_client_req(&client, client.fd, &dst_address, &req1, NULL)); set_socket_events(client2.fd, ZSOCK_POLLIN); @@ -1058,45 +769,25 @@ ZTEST(coap_client, test_poll_err_on_another_sock) ZTEST(coap_client, test_duplicate_response) { - int ret = 0; - struct k_sem sem; - struct sockaddr address = {0}; - struct coap_client_request client_request = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = test_path, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = short_payload, - .len = strlen(short_payload), - .user_data = &sem, - }; - - zassert_ok(k_sem_init(&sem, 0, 2)); z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_duplicate_response; - k_sleep(K_MSEC(1)); - LOG_INF("Send request"); - ret = coap_client_req(&client, 0, &address, &client_request, NULL); - zassert_true(ret >= 0, "Sending request failed, %d", ret); + zassert_ok(coap_client_req(&client, 0, &dst_address, &short_request, NULL)); - zassert_ok(k_sem_take(&sem, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); zassert_equal(last_response_code, COAP_RESPONSE_CODE_OK, "Unexpected response"); - zassert_equal(k_sem_take(&sem, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)), -EAGAIN, ""); + zassert_equal(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS)), -EAGAIN, ""); } ZTEST(coap_client, test_observe) { - struct k_sem sem; - struct sockaddr address = {0}; struct coap_client_option options = { .code = COAP_OPTION_OBSERVE, .value[0] = 0, .len = 1, }; - struct coap_client_request client_request = { + struct coap_client_request req = { .method = COAP_METHOD_GET, .confirmable = true, .path = test_path, @@ -1106,79 +797,47 @@ ZTEST(coap_client, test_observe) .len = strlen(short_payload), .options = &options, .num_options = 1, - .user_data = &sem, + .user_data = &sem1, }; - zassert_ok(k_sem_init(&sem, 0, 1)); z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_observe; - k_sleep(K_MSEC(1)); - zassert_ok(coap_client_req(&client, 0, &address, &client_request, NULL)); + zassert_ok(coap_client_req(&client, 0, &dst_address, &req, NULL)); - zassert_ok(k_sem_take(&sem, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); - zassert_ok(k_sem_take(&sem, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); - zassert_ok(k_sem_take(&sem, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); coap_client_cancel_requests(&client); - zassert_ok(k_sem_take(&sem, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); zassert_equal(last_response_code, -ECANCELED, ""); - zassert_not_ok(k_sem_take(&sem, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_not_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); } ZTEST(coap_client, test_request_rst) { - struct k_sem sem; - struct sockaddr address = {0}; - struct coap_client_request client_request = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = test_path, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = short_payload, - .len = strlen(short_payload), - .user_data = &sem, - }; - - zassert_ok(k_sem_init(&sem, 0, 1)); - k_sleep(K_MSEC(1)); z_impl_zsock_recvfrom_fake.custom_fake = z_impl_zsock_recvfrom_custom_fake_rst; - zassert_ok(coap_client_req(&client, 0, &address, &client_request, NULL)); + zassert_ok(coap_client_req(&client, 0, &dst_address, &short_request, NULL)); - zassert_ok(k_sem_take(&sem, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); + zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); zassert_equal(last_response_code, -ECONNRESET, ""); } ZTEST(coap_client, test_cancel) { - struct k_sem sem1, sem2; - struct sockaddr address = {0}; - struct coap_client_request req1 = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = test_path, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = short_payload, - .len = strlen(short_payload), - .user_data = &sem1 - }; - struct coap_client_request req2 = req1; + struct coap_client_request req1 = short_request; + struct coap_client_request req2 = short_request; + req1.user_data = &sem1; req2.user_data = &sem2; - k_sem_init(&sem1, 0, 1); - k_sem_init(&sem2, 0, 1); - z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; - k_sleep(K_MSEC(1)); - - zassert_ok(coap_client_req(&client, 0, &address, &req1, NULL)); - zassert_ok(coap_client_req(&client, 0, &address, &req2, NULL)); + zassert_ok(coap_client_req(&client, 0, &dst_address, &req1, NULL)); + zassert_ok(coap_client_req(&client, 0, &dst_address, &req2, NULL)); k_sleep(K_SECONDS(1)); @@ -1196,32 +855,17 @@ ZTEST(coap_client, test_cancel) ZTEST(coap_client, test_cancel_match) { - struct k_sem sem1, sem2; - struct sockaddr address = {0}; - struct coap_client_request req1 = { - .method = COAP_METHOD_GET, - .confirmable = true, - .path = test_path, - .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, - .cb = coap_callback, - .payload = short_payload, - .len = strlen(short_payload), - .user_data = &sem1 - }; - struct coap_client_request req2 = req1; + struct coap_client_request req1 = short_request; + struct coap_client_request req2 = short_request; + req1.user_data = &sem1; req2.user_data = &sem2; req2.path = "another"; - k_sem_init(&sem1, 0, 1); - k_sem_init(&sem2, 0, 1); - z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; - k_sleep(K_MSEC(1)); - - zassert_ok(coap_client_req(&client, 0, &address, &req1, NULL)); - zassert_ok(coap_client_req(&client, 0, &address, &req2, NULL)); + zassert_ok(coap_client_req(&client, 0, &dst_address, &req1, NULL)); + zassert_ok(coap_client_req(&client, 0, &dst_address, &req2, NULL)); k_sleep(K_SECONDS(1)); @@ -1233,7 +877,7 @@ ZTEST(coap_client, test_cancel_match) zassert_not_ok(k_sem_take(&sem2, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); zassert_equal(last_response_code, -ECANCELED, ""); - zassert_ok(coap_client_req(&client, 0, &address, &req1, NULL)); + zassert_ok(coap_client_req(&client, 0, &dst_address, &req1, NULL)); /* should not match */ coap_client_cancel_request(&client, &(struct coap_client_request) { @@ -1250,8 +894,8 @@ ZTEST(coap_client, test_cancel_match) zassert_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); zassert_ok(k_sem_take(&sem2, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); - zassert_ok(coap_client_req(&client, 0, &address, &req1, NULL)); - zassert_ok(coap_client_req(&client, 0, &address, &req2, NULL)); + zassert_ok(coap_client_req(&client, 0, &dst_address, &req1, NULL)); + zassert_ok(coap_client_req(&client, 0, &dst_address, &req2, NULL)); /* match both (wildcard)*/ coap_client_cancel_request(&client, &(struct coap_client_request) {0}); From 23345d203e677cada602707635752f20e73e19a7 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 18 Nov 2024 15:37:48 +0200 Subject: [PATCH 2959/4482] tests: coap_client: Add test for non-confirmable request Add test for sending multiple non-confirmable requests. Signed-off-by: Seppo Takalo --- tests/net/lib/coap_client/src/main.c | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/net/lib/coap_client/src/main.c b/tests/net/lib/coap_client/src/main.c index a620b1985e0f8..02d7693a7a06f 100644 --- a/tests/net/lib/coap_client/src/main.c +++ b/tests/net/lib/coap_client/src/main.c @@ -903,3 +903,35 @@ ZTEST(coap_client, test_cancel_match) zassert_ok(k_sem_take(&sem2, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); } + +ZTEST(coap_client, test_non_confirmable) +{ + struct coap_client_request req = { + .method = COAP_METHOD_GET, + .confirmable = false, + .path = test_path, + .fmt = COAP_CONTENT_FORMAT_TEXT_PLAIN, + .cb = coap_callback, + .payload = short_payload, + .len = strlen(short_payload), + .user_data = &sem1 + }; + + z_impl_zsock_sendto_fake.custom_fake = z_impl_zsock_sendto_custom_fake_no_reply; + set_socket_events(client.fd, ZSOCK_POLLOUT); + + for (int i = 0; i < CONFIG_COAP_CLIENT_MAX_REQUESTS; i++) { + zassert_ok(coap_client_req(&client, 0, &dst_address, &req, NULL)); + } + zassert_equal(coap_client_req(&client, 0, &dst_address, &req, NULL), -EAGAIN, ""); + + k_sleep(K_MSEC(MORE_THAN_LONG_EXCHANGE_LIFETIME_MS)); + + for (int i = 0; i < CONFIG_COAP_CLIENT_MAX_REQUESTS; i++) { + zassert_ok(coap_client_req(&client, 0, &dst_address, &req, NULL)); + } + zassert_equal(coap_client_req(&client, 0, &dst_address, &req, NULL), -EAGAIN, ""); + + /* No callbacks from non-confirmable */ + zassert_not_ok(k_sem_take(&sem1, K_MSEC(MORE_THAN_EXCHANGE_LIFETIME_MS))); +} From 6c169668e9230740a780c688704c023ec43ccc98 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 18 Nov 2024 15:43:03 +0200 Subject: [PATCH 2960/4482] net: lib: coap_client: Fix timeout for separate response When waiting for response after receiving the empty Ack, client actually used way too timeout. CoAP timeout only holds the timeout value in ms. t0 is the starting time. Signed-off-by: Seppo Takalo --- subsys/net/lib/coap/coap_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index bda131121757e..df2ea35666978 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -793,7 +793,7 @@ static int handle_response(struct coap_client *client, const struct coap_packet return 0; } internal_req->pending.t0 = k_uptime_get(); - internal_req->pending.timeout = internal_req->pending.t0 + COAP_SEPARATE_TIMEOUT; + internal_req->pending.timeout = COAP_SEPARATE_TIMEOUT; internal_req->pending.retries = 0; return 1; } From 2066cf6a3d17fc1a1733fab3e47fe8969145df6b Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 18 Nov 2024 15:47:01 +0200 Subject: [PATCH 2961/4482] net: lib: coap_client: Release non-confirmable requests Non-confirmable CoAP requests need lifetime tracking as well so we can free the structure after a timeout. Signed-off-by: Seppo Takalo --- subsys/net/lib/coap/coap_client.c | 53 ++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index df2ea35666978..b892432c4e819 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -105,6 +105,10 @@ static bool exchange_lifetime_exceeded(struct coap_client_internal_request *inte return true; } + if (internal_req->pending.t0 == 0) { + return true; + } + time_since_t0 = k_uptime_get() - internal_req->pending.t0; exchange_lifetime = (internal_req->pending.params.ack_timeout * COAP_EXCHANGE_LIFETIME_FACTOR); @@ -364,7 +368,7 @@ int coap_client_req(struct coap_client *client, int sock, const struct sockaddr /* Don't allow changing to a different socket if there is already request ongoing. */ if (client->fd != sock && has_ongoing_request(client)) { ret = -EALREADY; - goto out; + goto release; } /* Don't allow changing to a different address if there is already request ongoing. */ @@ -373,7 +377,7 @@ int coap_client_req(struct coap_client *client, int sock, const struct sockaddr if (has_ongoing_request(client)) { LOG_WRN("Can't change to a different socket, request ongoing."); ret = -EALREADY; - goto out; + goto release; } memcpy(&client->address, addr, sizeof(*addr)); @@ -384,7 +388,7 @@ int coap_client_req(struct coap_client *client, int sock, const struct sockaddr if (has_ongoing_request(client)) { LOG_WRN("Can't change to a different socket, request ongoing."); ret = -EALREADY; - goto out; + goto release; } memset(&client->address, 0, sizeof(client->address)); @@ -397,7 +401,7 @@ int coap_client_req(struct coap_client *client, int sock, const struct sockaddr ret = coap_client_init_request(client, req, internal_req, false); if (ret < 0) { LOG_ERR("Failed to initialize coap request"); - goto out; + goto release; } if (client->send_echo) { @@ -405,7 +409,7 @@ int coap_client_req(struct coap_client *client, int sock, const struct sockaddr client->echo_option.value, client->echo_option.len); if (ret < 0) { LOG_ERR("Failed to append echo option"); - goto out; + goto release; } client->send_echo = false; } @@ -413,28 +417,36 @@ int coap_client_req(struct coap_client *client, int sock, const struct sockaddr ret = coap_client_schedule_poll(client, sock, req, internal_req); if (ret < 0) { LOG_ERR("Failed to schedule polling"); - goto out; + goto release; } - /* only TYPE_CON messages need pending tracking */ - if (coap_header_get_type(&internal_req->request) == COAP_TYPE_CON) { - ret = coap_pending_init(&internal_req->pending, &internal_req->request, - &client->address, params); + ret = coap_pending_init(&internal_req->pending, &internal_req->request, + &client->address, params); - if (ret < 0) { - LOG_ERR("Failed to initialize pending struct"); - goto out; - } + if (ret < 0) { + LOG_ERR("Failed to initialize pending struct"); + goto release; + } - coap_pending_cycle(&internal_req->pending); - internal_req->is_observe = coap_request_is_observe(&internal_req->request); - LOG_DBG("Request is_observe %d", internal_req->is_observe); + /* Non-Confirmable messages are not retried, but we still track the lifetime as + * replies are acceptable. + */ + if (coap_header_get_type(&internal_req->request) == COAP_TYPE_NON_CON) { + internal_req->pending.retries = 0; } + coap_pending_cycle(&internal_req->pending); + internal_req->is_observe = coap_request_is_observe(&internal_req->request); + LOG_DBG("Request is_observe %d", internal_req->is_observe); ret = send_request(sock, internal_req->request.data, internal_req->request.offset, 0, &client->address, client->socklen); if (ret < 0) { - LOG_ERR("Transmission failed: %d", errno); + ret = -errno; + } + +release: + if (ret < 0) { + LOG_ERR("Failed to send request: %d", ret); reset_internal_request(internal_req); } else { /* Do not return the number of bytes sent */ @@ -521,6 +533,11 @@ static void coap_client_resend_handler(struct coap_client *client) for (int i = 0; i < CONFIG_COAP_CLIENT_MAX_REQUESTS; i++) { if (timeout_expired(&client->requests[i])) { + if (!client->requests[i].coap_request.confirmable) { + release_internal_request(&client->requests[i]); + continue; + } + ret = resend_request(client, &client->requests[i]); if (ret < 0) { report_callback_error(&client->requests[i], ret); From bc4f026ea946c5bf587edd91f043672fad617cdc Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Mon, 18 Nov 2024 15:53:21 +0200 Subject: [PATCH 2962/4482] net: lib: coap_client: Const pointers in request CoAP client does not modify any of the members, so change all pointers to const. Signed-off-by: Seppo Takalo --- include/zephyr/net/coap_client.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/zephyr/net/coap_client.h b/include/zephyr/net/coap_client.h index bbeebb2d26c46..ce09c56dd2e6c 100644 --- a/include/zephyr/net/coap_client.h +++ b/include/zephyr/net/coap_client.h @@ -53,16 +53,16 @@ typedef void (*coap_client_response_cb_t)(int16_t result_code, * @brief Representation of a CoAP client request. */ struct coap_client_request { - enum coap_method method; /**< Method of the request */ - bool confirmable; /**< CoAP Confirmable/Non-confirmable message */ - const char *path; /**< Path of the requested resource */ - enum coap_content_format fmt; /**< Content format to be used */ - uint8_t *payload; /**< User allocated buffer for send request */ - size_t len; /**< Length of the payload */ - coap_client_response_cb_t cb; /**< Callback when response received */ - struct coap_client_option *options; /**< Extra options to be added to request */ - uint8_t num_options; /**< Number of extra options */ - void *user_data; /**< User provided context */ + enum coap_method method; /**< Method of the request */ + bool confirmable; /**< CoAP Confirmable/Non-confirmable message */ + const char *path; /**< Path of the requested resource */ + enum coap_content_format fmt; /**< Content format to be used */ + const uint8_t *payload; /**< User allocated buffer for send request */ + size_t len; /**< Length of the payload */ + coap_client_response_cb_t cb; /**< Callback when response received */ + const struct coap_client_option *options; /**< Extra options to be added to request */ + uint8_t num_options; /**< Number of extra options */ + void *user_data; /**< User provided context */ }; /** From b4f3763c3105e07a0e24a956e5725ba4d3c0c7cf Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Mon, 18 Nov 2024 11:43:42 +0100 Subject: [PATCH 2963/4482] tests: Bluetooth: Audio: Use same recv_cb for all tests This commit changes the BSIM tests to use the same recv callback for all tests. The purpose of this is to reduce code duplication and make it easier to maintain the tests. This also changes the recv_cb so that in case of any error we log the most recently received SDU, which should provide more information about why a test failed in case of RX error. PBP had to be updated a bit to support the audio_stream struct. Also modifies a check and log in bap_stream that was less than helpful to determine if it was the stream or the endpoint that was NULL. Signed-off-by: Emil Gydesen --- subsys/bluetooth/audio/bap_stream.c | 8 +- .../audio/src/bap_broadcast_sink_test.c | 61 +++------------ .../audio/src/bap_broadcast_source_test.c | 4 + .../bsim/bluetooth/audio/src/bap_stream_rx.c | 75 +++++++++++++++++++ .../bsim/bluetooth/audio/src/bap_stream_rx.h | 12 +++ .../audio/src/bap_unicast_client_test.c | 49 +----------- .../audio/src/bap_unicast_server_test.c | 49 +----------- .../bluetooth/audio/src/cap_acceptor_test.c | 64 ++++------------ .../audio/src/cap_initiator_broadcast_test.c | 5 ++ tests/bsim/bluetooth/audio/src/common.c | 1 + tests/bsim/bluetooth/audio/src/common.h | 4 +- .../src/pbp_public_broadcast_sink_test.c | 43 +++++------ .../src/pbp_public_broadcast_source_test.c | 50 ++++++++----- 13 files changed, 185 insertions(+), 240 deletions(-) create mode 100644 tests/bsim/bluetooth/audio/src/bap_stream_rx.c create mode 100644 tests/bsim/bluetooth/audio/src/bap_stream_rx.h diff --git a/subsys/bluetooth/audio/bap_stream.c b/subsys/bluetooth/audio/bap_stream.c index 9f3ae7984d143..761ef9d8a8d44 100644 --- a/subsys/bluetooth/audio/bap_stream.c +++ b/subsys/bluetooth/audio/bap_stream.c @@ -362,7 +362,13 @@ static int bap_stream_send(struct bt_bap_stream *stream, struct net_buf *buf, ui struct bt_bap_ep *ep; int ret; - if (stream == NULL || stream->ep == NULL) { + if (stream == NULL) { + LOG_DBG("stream is NULL"); + return -EINVAL; + } + + if (stream->ep == NULL) { + LOG_DBG("stream->ep %p is NULL", stream); return -EINVAL; } diff --git a/tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c b/tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c index 633844a820397..52df6b4337381 100644 --- a/tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c @@ -32,6 +32,7 @@ #include #include "bap_common.h" +#include "bap_stream_rx.h" #include "bstests.h" #include "common.h" @@ -44,7 +45,6 @@ CREATE_FLAG(flag_base_metadata_updated); CREATE_FLAG(flag_pa_synced); CREATE_FLAG(flag_syncable); CREATE_FLAG(flag_pa_sync_lost); -CREATE_FLAG(flag_received); CREATE_FLAG(flag_pa_request); CREATE_FLAG(flag_bis_sync_requested); CREATE_FLAG(flag_big_sync_mic_failure); @@ -528,9 +528,13 @@ static void validate_stream_codec_cfg(const struct bt_bap_stream *stream) static void started_cb(struct bt_bap_stream *stream) { + struct audio_test_stream *test_stream = audio_test_stream_from_bap_stream(stream); struct bt_bap_ep_info info; int err; + memset(&test_stream->last_info, 0, sizeof(test_stream->last_info)); + test_stream->rx_cnt = 0U; + err = bt_bap_ep_get_info(stream->ep, &info); if (err != 0) { FAIL("Failed to get EP info: %d\n", err); @@ -578,57 +582,10 @@ static void stopped_cb(struct bt_bap_stream *stream, uint8_t reason) } } -static void recv_cb(struct bt_bap_stream *stream, - const struct bt_iso_recv_info *info, - struct net_buf *buf) -{ - struct audio_test_stream *test_stream = audio_test_stream_from_bap_stream(stream); - - if ((test_stream->rx_cnt % 100U) == 0U) { - printk("[%zu]: Incoming audio on stream %p len %u and ts %u\n", test_stream->rx_cnt, - stream, buf->len, info->ts); - } - - if (test_stream->rx_cnt > 0U && info->ts == test_stream->last_info.ts) { - FAIL("Duplicated timestamp received: %u\n", test_stream->last_info.ts); - return; - } - - if (test_stream->rx_cnt > 0U && info->seq_num == test_stream->last_info.seq_num) { - FAIL("Duplicated PSN received: %u\n", test_stream->last_info.seq_num); - return; - } - - if (info->flags & BT_ISO_FLAGS_ERROR) { - /* Fail the test if we have not received what we expected */ - if (!TEST_FLAG(flag_received)) { - FAIL("ISO receive error\n"); - } - - return; - } - - if (info->flags & BT_ISO_FLAGS_LOST) { - FAIL("ISO receive lost\n"); - return; - } - - if (memcmp(buf->data, mock_iso_data, buf->len) == 0) { - test_stream->rx_cnt++; - - if (test_stream->rx_cnt >= MIN_SEND_COUNT) { - /* We set the flag is just one stream has received the expected */ - SET_FLAG(flag_received); - } - } else { - FAIL("Unexpected data received\n"); - } -} - static struct bt_bap_stream_ops stream_ops = { .started = started_cb, .stopped = stopped_cb, - .recv = recv_cb + .recv = bap_stream_rx_recv_cb, }; static int init(void) @@ -964,7 +921,7 @@ static void test_common(void) } printk("Waiting for data\n"); - WAIT_FOR_FLAG(flag_received); + WAIT_FOR_FLAG(flag_audio_received); backchannel_sync_send_all(); /* let other devices know we have received what we wanted */ /* Ensure that we also see the metadata update */ @@ -1051,7 +1008,7 @@ static void test_sink_encrypted(void) } printk("Waiting for data\n"); - WAIT_FOR_FLAG(flag_received); + WAIT_FOR_FLAG(flag_audio_received); backchannel_sync_send_all(); /* let other devices know we have received data */ @@ -1140,7 +1097,7 @@ static void broadcast_sink_with_assistant(void) } printk("Waiting for data\n"); - WAIT_FOR_FLAG(flag_received); + WAIT_FOR_FLAG(flag_audio_received); backchannel_sync_send_all(); /* let other devices know we have received what we wanted */ /* Ensure that we also see the metadata update */ diff --git a/tests/bsim/bluetooth/audio/src/bap_broadcast_source_test.c b/tests/bsim/bluetooth/audio/src/bap_broadcast_source_test.c index 330687088f0a7..de0d776477982 100644 --- a/tests/bsim/bluetooth/audio/src/bap_broadcast_source_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_broadcast_source_test.c @@ -176,9 +176,13 @@ static void validate_stream_codec_cfg(const struct bt_bap_stream *stream) static void started_cb(struct bt_bap_stream *stream) { + struct audio_test_stream *test_stream = audio_test_stream_from_bap_stream(stream); struct bt_bap_ep_info info; int err; + test_stream->seq_num = 0U; + test_stream->tx_cnt = 0U; + err = bt_bap_ep_get_info(stream->ep, &info); if (err != 0) { FAIL("Failed to get EP info: %d\n", err); diff --git a/tests/bsim/bluetooth/audio/src/bap_stream_rx.c b/tests/bsim/bluetooth/audio/src/bap_stream_rx.c new file mode 100644 index 0000000000000..e2133a44a761a --- /dev/null +++ b/tests/bsim/bluetooth/audio/src/bap_stream_rx.c @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include + +#include "common.h" +#include + +LOG_MODULE_REGISTER(stream_tx, LOG_LEVEL_INF); + +static void log_stream_rx(struct bt_bap_stream *stream, const struct bt_iso_recv_info *info, + struct net_buf *buf) +{ + struct audio_test_stream *test_stream = audio_test_stream_from_bap_stream(stream); + + LOG_INF("[%zu]: Incoming audio on stream %p len %u, flags 0x%02X, seq_num %u and ts %u\n", + test_stream->rx_cnt, stream, buf->len, info->flags, info->seq_num, info->ts); +} + +void bap_stream_rx_recv_cb(struct bt_bap_stream *stream, const struct bt_iso_recv_info *info, + struct net_buf *buf) +{ + struct audio_test_stream *test_stream = audio_test_stream_from_bap_stream(stream); + + if ((test_stream->rx_cnt % 50U) == 0U) { + log_stream_rx(stream, info, buf); + } + + if (test_stream->rx_cnt > 0U && info->ts == test_stream->last_info.ts) { + log_stream_rx(stream, info, buf); + FAIL("Duplicated timestamp received: %u\n", test_stream->last_info.ts); + return; + } + + if (test_stream->rx_cnt > 0U && info->seq_num == test_stream->last_info.seq_num) { + log_stream_rx(stream, info, buf); + FAIL("Duplicated PSN received: %u\n", test_stream->last_info.seq_num); + return; + } + + if (info->flags & BT_ISO_FLAGS_ERROR) { + /* Fail the test if we have not received what we expected */ + if (!TEST_FLAG(flag_audio_received)) { + log_stream_rx(stream, info, buf); + FAIL("ISO receive error\n"); + } + + return; + } + + if (info->flags & BT_ISO_FLAGS_LOST) { + log_stream_rx(stream, info, buf); + FAIL("ISO receive lost\n"); + return; + } + + if (memcmp(buf->data, mock_iso_data, buf->len) == 0) { + test_stream->rx_cnt++; + + if (test_stream->rx_cnt >= MIN_SEND_COUNT) { + /* We set the flag is just one stream has received the expected */ + SET_FLAG(flag_audio_received); + } + } else { + log_stream_rx(stream, info, buf); + FAIL("Unexpected data received\n"); + } +} diff --git a/tests/bsim/bluetooth/audio/src/bap_stream_rx.h b/tests/bsim/bluetooth/audio/src/bap_stream_rx.h new file mode 100644 index 0000000000000..d24b679a448b5 --- /dev/null +++ b/tests/bsim/bluetooth/audio/src/bap_stream_rx.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +void bap_stream_rx_recv_cb(struct bt_bap_stream *stream, const struct bt_iso_recv_info *info, + struct net_buf *buf); diff --git a/tests/bsim/bluetooth/audio/src/bap_unicast_client_test.c b/tests/bsim/bluetooth/audio/src/bap_unicast_client_test.c index 913c21b6ecceb..970983e2cbe33 100644 --- a/tests/bsim/bluetooth/audio/src/bap_unicast_client_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_unicast_client_test.c @@ -29,6 +29,7 @@ #include #include +#include "bap_stream_rx.h" #include "bstests.h" #include "common.h" #include "bap_common.h" @@ -154,43 +155,6 @@ static void stream_released(struct bt_bap_stream *stream) SET_FLAG(flag_stream_released); } -static void stream_recv_cb(struct bt_bap_stream *stream, const struct bt_iso_recv_info *info, - struct net_buf *buf) -{ - struct audio_test_stream *test_stream = audio_test_stream_from_bap_stream(stream); - - if ((test_stream->rx_cnt % 100U) == 0U) { - printk("[%zu]: Incoming audio on stream %p len %u and ts %u\n", test_stream->rx_cnt, - stream, buf->len, info->ts); - } - - if (test_stream->rx_cnt > 0U && info->ts == test_stream->last_info.ts) { - FAIL("Duplicated timestamp received: %u\n", test_stream->last_info.ts); - return; - } - - if (test_stream->rx_cnt > 0U && info->seq_num == test_stream->last_info.seq_num) { - FAIL("Duplicated PSN received: %u\n", test_stream->last_info.seq_num); - return; - } - - if (info->flags & BT_ISO_FLAGS_ERROR) { - FAIL("ISO receive error\n"); - return; - } - - if (info->flags & BT_ISO_FLAGS_LOST) { - FAIL("ISO receive lost\n"); - return; - } - - if (memcmp(buf->data, mock_iso_data, buf->len) == 0) { - test_stream->rx_cnt++; - } else { - FAIL("Unexpected data received\n"); - } -} - static void stream_sent_cb(struct bt_bap_stream *stream) { struct audio_test_stream *test_stream = audio_test_stream_from_bap_stream(stream); @@ -234,7 +198,7 @@ static struct bt_bap_stream_ops stream_ops = { .disabled = stream_disabled, .stopped = stream_stopped, .released = stream_released, - .recv = stream_recv_cb, + .recv = bap_stream_rx_recv_cb, .sent = stream_sent_cb, .connected = stream_connected, .disconnected = stream_disconnected, @@ -894,13 +858,8 @@ static void transceive_streams(void) } if (source_stream != NULL) { - const struct audio_test_stream *test_stream = - audio_test_stream_from_bap_stream(source_stream); - - /* Keep receiving until we reach the minimum expected */ - while (test_stream->rx_cnt < MIN_SEND_COUNT) { - k_sleep(K_MSEC(100)); - } + printk("Waiting for data\n"); + WAIT_FOR_FLAG(flag_audio_received); } } diff --git a/tests/bsim/bluetooth/audio/src/bap_unicast_server_test.c b/tests/bsim/bluetooth/audio/src/bap_unicast_server_test.c index 7dff0e1a97f9f..5db704fad342a 100644 --- a/tests/bsim/bluetooth/audio/src/bap_unicast_server_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_unicast_server_test.c @@ -27,6 +27,7 @@ #include #include "bap_common.h" +#include "bap_stream_rx.h" #include "bstests.h" #include "common.h" @@ -273,43 +274,6 @@ static void stream_started_cb(struct bt_bap_stream *stream) SET_FLAG(flag_stream_started); } -static void stream_recv_cb(struct bt_bap_stream *stream, const struct bt_iso_recv_info *info, - struct net_buf *buf) -{ - struct audio_test_stream *test_stream = audio_test_stream_from_bap_stream(stream); - - if ((test_stream->rx_cnt % 100U) == 0U) { - printk("[%zu]: Incoming audio on stream %p len %u and ts %u\n", test_stream->rx_cnt, - stream, buf->len, info->ts); - } - - if (test_stream->rx_cnt > 0U && info->ts == test_stream->last_info.ts) { - FAIL("Duplicated timestamp received: %u\n", test_stream->last_info.ts); - return; - } - - if (test_stream->rx_cnt > 0U && info->seq_num == test_stream->last_info.seq_num) { - FAIL("Duplicated PSN received: %u\n", test_stream->last_info.seq_num); - return; - } - - if (info->flags & BT_ISO_FLAGS_ERROR) { - FAIL("ISO receive error\n"); - return; - } - - if (info->flags & BT_ISO_FLAGS_LOST) { - FAIL("ISO receive lost\n"); - return; - } - - if (memcmp(buf->data, mock_iso_data, buf->len) == 0) { - test_stream->rx_cnt++; - } else { - FAIL("Unexpected data received\n"); - } -} - static void stream_sent_cb(struct bt_bap_stream *stream) { struct audio_test_stream *test_stream = audio_test_stream_from_bap_stream(stream); @@ -347,7 +311,7 @@ static void stream_sent_cb(struct bt_bap_stream *stream) static struct bt_bap_stream_ops stream_ops = { .enabled = stream_enabled_cb, .started = stream_started_cb, - .recv = stream_recv_cb, + .recv = bap_stream_rx_recv_cb, .sent = stream_sent_cb, }; @@ -406,13 +370,8 @@ static void transceive_test_streams(void) } if (sink_stream != NULL) { - const struct audio_test_stream *test_stream = - audio_test_stream_from_bap_stream(sink_stream); - - /* Keep receiving until we reach the minimum expected */ - while (test_stream->rx_cnt < MIN_SEND_COUNT) { - k_sleep(K_MSEC(100)); - } + printk("Waiting for data\n"); + WAIT_FOR_FLAG(flag_audio_received); } } diff --git a/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c b/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c index dab3708657a51..a90e090789cd9 100644 --- a/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c @@ -33,6 +33,7 @@ #include #include +#include "bap_stream_rx.h" #include "bstests.h" #include "common.h" #include "bap_common.h" @@ -50,7 +51,6 @@ CREATE_FLAG(flag_broadcast_code); CREATE_FLAG(flag_base_received); CREATE_FLAG(flag_pa_synced); CREATE_FLAG(flag_syncable); -CREATE_FLAG(flag_received); CREATE_FLAG(flag_pa_sync_lost); CREATE_FLAG(flag_pa_request); CREATE_FLAG(flag_bis_sync_requested); @@ -275,6 +275,13 @@ static struct bt_le_per_adv_sync_cb bap_pa_sync_cb = { static void started_cb(struct bt_bap_stream *stream) { + struct audio_test_stream *test_stream = audio_test_stream_from_bap_stream(stream); + + memset(&test_stream->last_info, 0, sizeof(test_stream->last_info)); + test_stream->rx_cnt = 0U; + test_stream->seq_num = 0U; + test_stream->tx_cnt = 0U; + printk("Stream %p started\n", stream); k_sem_give(&sem_broadcast_started); } @@ -285,54 +292,11 @@ static void stopped_cb(struct bt_bap_stream *stream, uint8_t reason) k_sem_give(&sem_broadcast_stopped); } -static void recv_cb(struct bt_bap_stream *stream, const struct bt_iso_recv_info *info, - struct net_buf *buf) -{ - struct audio_test_stream *test_stream = audio_test_stream_from_bap_stream(stream); - - if ((test_stream->rx_cnt % 50U) == 0U) { - printk("[%zu]: Incoming audio on stream %p len %u and ts %u\n", test_stream->rx_cnt, - stream, buf->len, info->ts); - } - - if (test_stream->rx_cnt > 0U && info->ts == test_stream->last_info.ts) { - FAIL("Duplicated timestamp received: %u\n", test_stream->last_info.ts); - return; - } - - if (test_stream->rx_cnt > 0U && info->seq_num == test_stream->last_info.seq_num) { - FAIL("Duplicated PSN received: %u\n", test_stream->last_info.seq_num); - return; - } - - if (info->flags & BT_ISO_FLAGS_ERROR) { - /* Fail the test if we have not received what we expected */ - if (!TEST_FLAG(flag_received)) { - FAIL("ISO receive error\n"); - } - - return; - } - - if (info->flags & BT_ISO_FLAGS_LOST) { - FAIL("ISO receive lost\n"); - return; - } - - if (memcmp(buf->data, mock_iso_data, buf->len) == 0) { - test_stream->rx_cnt++; - - if (test_stream->rx_cnt >= MIN_SEND_COUNT) { - /* We set the flag is just one stream has received the expected */ - SET_FLAG(flag_received); - } - } else { - FAIL("Unexpected data received\n"); - } -} - static struct bt_bap_stream_ops broadcast_stream_ops = { - .started = started_cb, .stopped = stopped_cb, .recv = recv_cb}; + .started = started_cb, + .stopped = stopped_cb, + .recv = bap_stream_rx_recv_cb, +}; static void unicast_stream_enabled_cb(struct bt_bap_stream *stream) { @@ -796,7 +760,7 @@ static void init(void) UNSET_FLAG(flag_base_received); UNSET_FLAG(flag_pa_synced); UNSET_FLAG(flag_pa_request); - UNSET_FLAG(flag_received); + UNSET_FLAG(flag_audio_received); UNSET_FLAG(flag_base_metadata_updated); UNSET_FLAG(flag_bis_sync_requested); @@ -998,7 +962,7 @@ static void create_and_sync_sink(struct bt_bap_stream *bap_streams[], size_t *st static void sink_wait_for_data(void) { printk("Waiting for data\n"); - WAIT_FOR_FLAG(flag_received); + WAIT_FOR_FLAG(flag_audio_received); backchannel_sync_send_all(); /* let other devices know we have received what we wanted */ } diff --git a/tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c b/tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c index b81b1cfe18d4f..98896e407665d 100644 --- a/tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c @@ -116,6 +116,11 @@ static const struct named_lc3_preset lc3_broadcast_presets[] = { static void broadcast_started_cb(struct bt_bap_stream *stream) { + struct audio_test_stream *test_stream = audio_test_stream_from_bap_stream(stream); + + test_stream->seq_num = 0U; + test_stream->tx_cnt = 0U; + printk("Stream %p started\n", stream); k_sem_give(&sem_broadcast_started); } diff --git a/tests/bsim/bluetooth/audio/src/common.c b/tests/bsim/bluetooth/audio/src/common.c index 7931ed1adb8f9..7fcac688a1300 100644 --- a/tests/bsim/bluetooth/audio/src/common.c +++ b/tests/bsim/bluetooth/audio/src/common.c @@ -35,6 +35,7 @@ struct bt_conn *default_conn; atomic_t flag_connected; atomic_t flag_disconnected; atomic_t flag_conn_updated; +atomic_t flag_audio_received; volatile bt_security_t security_level; const struct bt_data ad[AD_SIZE] = { diff --git a/tests/bsim/bluetooth/audio/src/common.h b/tests/bsim/bluetooth/audio/src/common.h index 76020b8529d1b..5487e45593628 100644 --- a/tests/bsim/bluetooth/audio/src/common.h +++ b/tests/bsim/bluetooth/audio/src/common.h @@ -29,6 +29,7 @@ #include #include +#include "bstests.h" #include "bs_types.h" #include "bs_tracing.h" @@ -88,7 +89,7 @@ static const uint8_t mock_iso_data[] = { (void)k_sleep(K_MSEC(1)); \ } - +extern enum bst_result_t bst_result; #define FAIL(...) \ do { \ bst_result = Failed; \ @@ -114,6 +115,7 @@ extern struct bt_conn *default_conn; extern atomic_t flag_connected; extern atomic_t flag_disconnected; extern atomic_t flag_conn_updated; +extern atomic_t flag_audio_received; extern volatile bt_security_t security_level; void disconnected(struct bt_conn *conn, uint8_t reason); diff --git a/tests/bsim/bluetooth/audio/src/pbp_public_broadcast_sink_test.c b/tests/bsim/bluetooth/audio/src/pbp_public_broadcast_sink_test.c index 1f3eb5315c2a8..0df8ae7c60998 100644 --- a/tests/bsim/bluetooth/audio/src/pbp_public_broadcast_sink_test.c +++ b/tests/bsim/bluetooth/audio/src/pbp_public_broadcast_sink_test.c @@ -1,11 +1,13 @@ /* * Copyright 2023 NXP + * Copyright (c) 2024 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ #include #include #include +#include #include #include @@ -27,6 +29,7 @@ #include #include +#include "bap_stream_rx.h" #include "bstests.h" #include "common.h" @@ -41,13 +44,12 @@ static K_SEM_DEFINE(sem_pa_synced, 0U, 1U); static K_SEM_DEFINE(sem_base_received, 0U, 1U); static K_SEM_DEFINE(sem_syncable, 0U, 1U); static K_SEM_DEFINE(sem_pa_sync_lost, 0U, 1U); -static K_SEM_DEFINE(sem_data_received, 0U, 1U); static struct bt_bap_broadcast_sink *broadcast_sink; static struct bt_le_per_adv_sync *bcast_pa_sync; -static struct bt_bap_stream streams[CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT]; -static struct bt_bap_stream *streams_p[ARRAY_SIZE(streams)]; +static struct audio_test_stream test_streams[CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT]; +static struct bt_bap_stream *streams_p[ARRAY_SIZE(test_streams)]; static const struct bt_audio_codec_cap codec = BT_AUDIO_CODEC_CAP_LC3( BT_AUDIO_CODEC_CAP_FREQ_16KHZ | BT_AUDIO_CODEC_CAP_FREQ_24KHZ | @@ -59,7 +61,7 @@ static const struct bt_audio_codec_cap codec = BT_AUDIO_CODEC_CAP_LC3( * we have. We add an additional 1 since the bis indexes start from 1 and not * 0. */ -static const uint32_t bis_index_mask = BIT_MASK(ARRAY_SIZE(streams) + 1U); +static const uint32_t bis_index_mask = BIT_MASK(ARRAY_SIZE(test_streams) + 1U); static uint32_t bis_index_bitfield; static uint32_t broadcast_id; @@ -93,6 +95,11 @@ static struct bt_bap_broadcast_sink_cb broadcast_sink_cbs = { static void started_cb(struct bt_bap_stream *stream) { + struct audio_test_stream *test_stream = audio_test_stream_from_bap_stream(stream); + + memset(&test_stream->last_info, 0, sizeof(test_stream->last_info)); + test_stream->rx_cnt = 0U; + printk("Stream %p started\n", stream); } @@ -101,19 +108,6 @@ static void stopped_cb(struct bt_bap_stream *stream, uint8_t reason) printk("Stream %p stopped with reason 0x%02X\n", stream, reason); } -static void recv_cb(struct bt_bap_stream *stream, - const struct bt_iso_recv_info *info, - struct net_buf *buf) -{ - static uint32_t recv_cnt; - - recv_cnt++; - if (recv_cnt >= MIN_SEND_COUNT) { - k_sem_give(&sem_data_received); - } - printk("Receiving ISO packets\n"); -} - static bool pa_decode_base(struct bt_data *data, void *user_data) { const struct bt_bap_base *base = bt_bap_base_get_base_from_ad(data); @@ -164,7 +158,7 @@ static void broadcast_pa_terminated(struct bt_le_per_adv_sync *sync, static struct bt_bap_stream_ops stream_ops = { .started = started_cb, .stopped = stopped_cb, - .recv = recv_cb + .recv = bap_stream_rx_recv_cb, }; static struct bt_le_per_adv_sync_cb broadcast_sync_cb = { @@ -181,7 +175,7 @@ static int reset(void) k_sem_reset(&sem_base_received); k_sem_reset(&sem_syncable); k_sem_reset(&sem_pa_sync_lost); - k_sem_reset(&sem_data_received); + UNSET_FLAG(flag_audio_received); broadcast_id = BT_BAP_INVALID_BROADCAST_ID; bis_index_bitfield = 0U; @@ -224,12 +218,9 @@ static int init(void) return err; } - for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) { - streams[i].ops = &stream_ops; - } - - for (size_t i = 0U; i < ARRAY_SIZE(streams_p); i++) { - streams_p[i] = &streams[i]; + for (size_t i = 0U; i < ARRAY_SIZE(test_streams); i++) { + streams_p[i] = bap_stream_from_audio_test_stream(&test_streams[i]); + bt_bap_stream_cb_register(streams_p[i], &stream_ops); } return 0; @@ -389,7 +380,7 @@ static void test_main(void) /* Wait for data */ printk("Waiting for data\n"); - k_sem_take(&sem_data_received, SEM_TIMEOUT); + WAIT_FOR_FLAG(flag_audio_received); printk("Sending signal to broadcaster to stop\n"); backchannel_sync_send_all(); /* let the broadcast source know it can stop */ diff --git a/tests/bsim/bluetooth/audio/src/pbp_public_broadcast_source_test.c b/tests/bsim/bluetooth/audio/src/pbp_public_broadcast_source_test.c index 86df90cc38671..8947e386efee4 100644 --- a/tests/bsim/bluetooth/audio/src/pbp_public_broadcast_source_test.c +++ b/tests/bsim/bluetooth/audio/src/pbp_public_broadcast_source_test.c @@ -1,11 +1,13 @@ /* * Copyright 2023 NXP + * Copyright (c) 2024 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ #include #include #include +#include #include #include @@ -55,8 +57,7 @@ static uint8_t bis_codec_data[] = { BT_AUDIO_CODEC_DATA(BT_AUDIO_CODEC_CFG_FREQ, BT_BYTES_LIST_LE16(BT_AUDIO_CODEC_CFG_FREQ_48KHZ))}; -static struct bt_cap_stream broadcast_source_stream; -static struct bt_cap_stream *broadcast_stream; +static struct audio_test_stream broadcast_source_stream; static struct bt_cap_initiator_broadcast_stream_param stream_params; static struct bt_cap_initiator_broadcast_subgroup_param subgroup_param; @@ -74,6 +75,11 @@ static struct bt_le_ext_adv *adv; static void started_cb(struct bt_bap_stream *stream) { + struct audio_test_stream *test_stream = audio_test_stream_from_bap_stream(stream); + + test_stream->seq_num = 0U; + test_stream->tx_cnt = 0U; + printk("Stream %p started\n", stream); k_sem_give(&sem_started); } @@ -86,26 +92,20 @@ static void stopped_cb(struct bt_bap_stream *stream, uint8_t reason) static void sent_cb(struct bt_bap_stream *stream) { - static uint8_t mock_data[CONFIG_BT_ISO_TX_MTU]; - static bool mock_data_initialized; - static uint32_t seq_num; + struct audio_test_stream *test_stream = audio_test_stream_from_bap_stream(stream); struct net_buf *buf; int ret; + if (!test_stream->tx_active) { + return; + } + if (broadcast_preset_48_2_1.qos.sdu > CONFIG_BT_ISO_TX_MTU) { printk("Invalid SDU %u for the MTU: %d", broadcast_preset_48_2_1.qos.sdu, CONFIG_BT_ISO_TX_MTU); return; } - if (!mock_data_initialized) { - for (size_t i = 0U; i < ARRAY_SIZE(mock_data); i++) { - /* Initialize mock data */ - mock_data[i] = (uint8_t)i; - } - mock_data_initialized = true; - } - buf = net_buf_alloc(&tx_pool, K_FOREVER); if (buf == NULL) { printk("Could not allocate buffer when sending on %p\n", stream); @@ -113,11 +113,16 @@ static void sent_cb(struct bt_bap_stream *stream) } net_buf_reserve(buf, BT_ISO_CHAN_SEND_RESERVE); - net_buf_add_mem(buf, mock_data, broadcast_preset_48_2_1.qos.sdu); - ret = bt_bap_stream_send(stream, buf, seq_num++); + net_buf_add_mem(buf, mock_iso_data, broadcast_preset_48_2_1.qos.sdu); + ret = bt_bap_stream_send(stream, buf, test_stream->seq_num++); if (ret < 0) { /* This will end broadcasting on this stream. */ net_buf_unref(buf); + + /* Only fail if tx is active (may fail if we are disabling the stream) */ + if (test_stream->tx_active) { + FAIL("Unable to broadcast data on %p: %d\n", stream, ret); + } return; } } @@ -293,10 +298,10 @@ static void test_main(void) return; } - broadcast_stream = &broadcast_source_stream; - bt_bap_stream_cb_register(&broadcast_stream->bap_stream, &broadcast_stream_ops); + bt_bap_stream_cb_register(&broadcast_source_stream.stream.bap_stream, + &broadcast_stream_ops); - stream_params.stream = &broadcast_source_stream; + stream_params.stream = &broadcast_source_stream.stream; stream_params.data_len = ARRAY_SIZE(bis_codec_data); stream_params.data = bis_codec_data; @@ -347,12 +352,17 @@ static void test_main(void) k_sem_take(&sem_started, SEM_TIMEOUT); /* Initialize sending */ + broadcast_source_stream.tx_active = true; for (unsigned int j = 0U; j < BROADCAST_ENQUEUE_COUNT; j++) { - sent_cb(&broadcast_stream->bap_stream); + sent_cb(&broadcast_source_stream.stream.bap_stream); } /* Wait for other devices to let us know when we can stop the source */ - printk("Waiting for signal from receiver to stop\n"); backchannel_sync_wait_any(); + printk("Waiting for signal from receiver to stop\n"); + backchannel_sync_wait_any(); + + printk("Stopping broadcast source\n"); + broadcast_source_stream.tx_active = false; err = bt_cap_initiator_broadcast_audio_stop(broadcast_source); if (err != 0) { From e0bd7e7c8704412b41ad7dbd7395044ea26f12b4 Mon Sep 17 00:00:00 2001 From: Grzegorz Chwierut Date: Fri, 15 Nov 2024 20:02:16 +0100 Subject: [PATCH 2964/4482] twister: Allow sharing hardware platform between variants Extended hardware map to share a single board between variants. To run tests for different variants on the same board without re-configuring the hardware map file for each variant, one can use a `platform` atribute as a list of names. Signed-off-by: Grzegorz Chwierut --- doc/develop/test/twister.rst | 19 +++++++ scripts/pylib/twister/twisterlib/handlers.py | 36 ++++++++++---- .../pylib/twister/twisterlib/hardwaremap.py | 49 +++++++++++-------- scripts/schemas/twister/hwmap-schema.yaml | 2 +- scripts/tests/twister/test_handlers.py | 1 + 5 files changed, 75 insertions(+), 32 deletions(-) diff --git a/doc/develop/test/twister.rst b/doc/develop/test/twister.rst index eb34435dded9f..685c70ab88657 100644 --- a/doc/develop/test/twister.rst +++ b/doc/develop/test/twister.rst @@ -1278,6 +1278,25 @@ using an external J-Link probe. The ``probe_id`` keyword overrides the runner: jlink serial: null +Using Single Board For Multiple Variants +++++++++++++++++++++++++++++++++++++++++ + + The ``platform`` attribute can be a list of names or a string + with names separated by spaces. This allows to run tests for + different platform variants on the same physical board, without + re-configuring the hardware map file for each variant. For example: + +.. code-block:: yaml + + - connected: true + id: '001234567890' + platform: + - nrf5340dk/nrf5340/cpuapp + - nrf5340dk/nrf5340/cpuapp/ns + product: J-Link + runner: nrfjprog + serial: /dev/ttyACM1 + Quarantine ++++++++++ diff --git a/scripts/pylib/twister/twisterlib/handlers.py b/scripts/pylib/twister/twisterlib/handlers.py index ec4529f9a6e02..1c92e9f5b6dc2 100755 --- a/scripts/pylib/twister/twisterlib/handlers.py +++ b/scripts/pylib/twister/twisterlib/handlers.py @@ -21,6 +21,7 @@ import threading import time +from contextlib import contextmanager from pathlib import Path from queue import Queue, Empty from twisterlib.environment import ZEPHYR_BASE, strip_ansi_sequences @@ -457,6 +458,17 @@ def monitor_serial(self, ser, halt_event, harness): log_out_fp.close() + @staticmethod + @contextmanager + def acquire_dut_locks(duts): + try: + for d in duts: + d.lock.acquire() + yield + finally: + for d in duts: + d.lock.release() + def device_is_available(self, instance): device = instance.platform.name fixture = instance.testsuite.harness_config.get("fixture") @@ -474,15 +486,16 @@ def device_is_available(self, instance): # Select an available DUT with less failures for d in sorted(duts_found, key=lambda _dut: _dut.failures): - d.lock.acquire() - avail = False - if d.available: - d.available = 0 - d.counter_increment() - avail = True - logger.debug(f"Retain DUT:{d.platform}, Id:{d.id}, " - f"counter:{d.counter}, failures:{d.failures}") - d.lock.release() + duts_shared_hw = [_d for _d in self.duts if _d.id == d.id] # get all DUTs with the same id + with self.acquire_dut_locks(duts_shared_hw): + avail = False + if d.available: + for _d in duts_shared_hw: + _d.available = 0 + d.counter_increment() + avail = True + logger.debug(f"Retain DUT:{d.platform}, Id:{d.id}, " + f"counter:{d.counter}, failures:{d.failures}") if avail: return d @@ -493,7 +506,10 @@ def make_dut_available(self, dut): dut.failures_increment() logger.debug(f"Release DUT:{dut.platform}, Id:{dut.id}, " f"counter:{dut.counter}, failures:{dut.failures}") - dut.available = 1 + duts_shared_hw = [_d for _d in self.duts if _d.id == dut.id] # get all DUTs with the same id + with self.acquire_dut_locks(duts_shared_hw): + for _d in duts_shared_hw: + _d.available = 1 @staticmethod def run_custom_script(script, timeout): diff --git a/scripts/pylib/twister/twisterlib/hardwaremap.py b/scripts/pylib/twister/twisterlib/hardwaremap.py index 2bb0a5a54ebff..863419483af58 100644 --- a/scripts/pylib/twister/twisterlib/hardwaremap.py +++ b/scripts/pylib/twister/twisterlib/hardwaremap.py @@ -262,7 +262,13 @@ def load(self, map_file): flash_before = dut.get('flash_before') if flash_before is None: flash_before = self.options.flash_before and (not (flash_with_test or serial_pty)) - platform = dut.get('platform') + platform = dut.get('platform') + if isinstance(platform, str): + platforms = platform.split() + elif isinstance(platform, list): + platforms = platform + else: + raise ValueError(f"Invalid platform value: {platform}") id = dut.get('id') runner = dut.get('runner') runner_params = dut.get('runner_params') @@ -270,28 +276,29 @@ def load(self, map_file): baud = dut.get('baud', None) product = dut.get('product') fixtures = dut.get('fixtures', []) - connected= dut.get('connected') and ((serial or serial_pty) is not None) + connected = dut.get('connected') and ((serial or serial_pty) is not None) if not connected: continue - new_dut = DUT(platform=platform, - product=product, - runner=runner, - runner_params=runner_params, - id=id, - serial_pty=serial_pty, - serial=serial, - serial_baud=baud, - connected=connected, - pre_script=pre_script, - flash_before=flash_before, - post_script=post_script, - post_flash_script=post_flash_script, - script_param=script_param, - flash_timeout=flash_timeout, - flash_with_test=flash_with_test) - new_dut.fixtures = fixtures - new_dut.counter = 0 - self.duts.append(new_dut) + for plat in platforms: + new_dut = DUT(platform=plat, + product=product, + runner=runner, + runner_params=runner_params, + id=id, + serial_pty=serial_pty, + serial=serial, + serial_baud=baud, + connected=connected, + pre_script=pre_script, + flash_before=flash_before, + post_script=post_script, + post_flash_script=post_flash_script, + script_param=script_param, + flash_timeout=flash_timeout, + flash_with_test=flash_with_test) + new_dut.fixtures = fixtures + new_dut.counter = 0 + self.duts.append(new_dut) def scan(self, persistent=False): from serial.tools import list_ports diff --git a/scripts/schemas/twister/hwmap-schema.yaml b/scripts/schemas/twister/hwmap-schema.yaml index f45bd8f79c793..142d4a1969bfa 100644 --- a/scripts/schemas/twister/hwmap-schema.yaml +++ b/scripts/schemas/twister/hwmap-schema.yaml @@ -16,7 +16,7 @@ sequence: type: str required: false "platform": - type: str + type: any required: true "probe_id": type: str diff --git a/scripts/tests/twister/test_handlers.py b/scripts/tests/twister/test_handlers.py index 122f688396387..32340b7f3e014 100644 --- a/scripts/tests/twister/test_handlers.py +++ b/scripts/tests/twister/test_handlers.py @@ -1275,6 +1275,7 @@ def mock_serial(*args, **kwargs): dut = DUT() dut.available = 0 dut.failures = 0 + handler.duts = [dut] hardware_baud = 14400 flash_timeout = 60 From bbfb546e57766540c782fc116721c5dedbd6656a Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 12 Nov 2024 00:12:59 +0530 Subject: [PATCH 2965/4482] modules: hostap: Add external crypto support Add an option for platforms or forks to provide their own hostap compatible crypto implementation. This may include proprietary or platform specific stuff that may or may not be upstreamed to Zephyr. Signed-off-by: Chaitanya Tata --- modules/hostap/Kconfig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 4f0fccecbd6d5..5a29c45401077 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -166,6 +166,14 @@ config WIFI_NM_WPA_SUPPLICANT_CRYPTO_ALT config WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE bool "No Crypto support for WiFi" +config WIFI_NM_WPA_SUPPLICANT_CRYPTO_EXT + bool "External Crypto support for hostap" + help + Use external crypto implementation for hostp, this is useful for + platforms where the crypto implementation is provided by the platform + and not by Zephyr. The external crypto implementation should provide + the required APIs and any other dependencies required by hostap. + endchoice config WIFI_NM_WPA_SUPPLICANT_CRYPTO_MBEDTLS_PSA From 77ebf82b3ed539190bf8baaa48bba70e1c57aafd Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Mon, 11 Nov 2024 18:47:12 +0100 Subject: [PATCH 2966/4482] storage: flash_map: Don't generate flash area when no device Change in default flash map generation, where partitions hanging of disabled devices will not have flash area generated. Signed-off-by: Dominik Ermel --- subsys/storage/flash_map/flash_map.c | 2 +- subsys/storage/flash_map/flash_map_default.c | 10 +++++++--- tests/subsys/storage/flash_map/src/main.c | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/subsys/storage/flash_map/flash_map.c b/subsys/storage/flash_map/flash_map.c index 471b33358c948..7b66825c4427a 100644 --- a/subsys/storage/flash_map/flash_map.c +++ b/subsys/storage/flash_map/flash_map.c @@ -39,7 +39,7 @@ int flash_area_open(uint8_t id, const struct flash_area **fap) return -ENOENT; } - if (!area->fa_dev || !device_is_ready(area->fa_dev)) { + if (!device_is_ready(area->fa_dev)) { return -ENODEV; } diff --git a/subsys/storage/flash_map/flash_map_default.c b/subsys/storage/flash_map/flash_map_default.c index 20d33ece80912..ae1951b4a0e15 100644 --- a/subsys/storage/flash_map/flash_map_default.c +++ b/subsys/storage/flash_map/flash_map_default.c @@ -16,18 +16,22 @@ #define FLASH_AREA_FOO(part) \ {.fa_id = DT_FIXED_PARTITION_ID(part), \ .fa_off = DT_REG_ADDR(part), \ - .fa_dev = DEVICE_DT_GET_OR_NULL(DT_MTD_FROM_FIXED_PARTITION(part)), \ + .fa_dev = DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(part)), \ .fa_size = DT_REG_SIZE(part), \ .fa_label = DT_PROP_OR(part, label, NULL), }, #else #define FLASH_AREA_FOO(part) \ {.fa_id = DT_FIXED_PARTITION_ID(part), \ .fa_off = DT_REG_ADDR(part), \ - .fa_dev = DEVICE_DT_GET_OR_NULL(DT_MTD_FROM_FIXED_PARTITION(part)), \ + .fa_dev = DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(part)), \ .fa_size = DT_REG_SIZE(part), }, #endif -#define FOREACH_PARTITION(n) DT_FOREACH_CHILD(DT_DRV_INST(n), FLASH_AREA_FOO) +#define FLASH_AREA_FOOO(part) \ + COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(DT_MTD_FROM_FIXED_PARTITION(part)), \ + (FLASH_AREA_FOO(part)), ()) + +#define FOREACH_PARTITION(n) DT_FOREACH_CHILD(DT_DRV_INST(n), FLASH_AREA_FOOO) /* We iterate over all compatible 'fixed-partitions' nodes and * use DT_FOREACH_CHILD to iterate over all the partitions for that diff --git a/tests/subsys/storage/flash_map/src/main.c b/tests/subsys/storage/flash_map/src/main.c index 2ff7724f42c95..1b529bbbfce3c 100644 --- a/tests/subsys/storage/flash_map/src/main.c +++ b/tests/subsys/storage/flash_map/src/main.c @@ -27,9 +27,9 @@ ZTEST(flash_map, test_flash_area_disabled_device) /* Test that attempting to open a disabled flash area fails */ rc = flash_area_open(FIXED_PARTITION_ID(disabled_a), &fa); - zassert_equal(rc, -ENODEV, "Open did not fail"); + zassert_equal(rc, -ENOENT, "Open did not fail"); rc = flash_area_open(FIXED_PARTITION_ID(disabled_b), &fa); - zassert_equal(rc, -ENODEV, "Open did not fail"); + zassert_equal(rc, -ENOENT, "Open did not fail"); } /** From 9a804572a3f6714082d102136527e0b3c2c63c0c Mon Sep 17 00:00:00 2001 From: Muhammad Waleed Badar Date: Sat, 9 Nov 2024 17:03:04 +0500 Subject: [PATCH 2967/4482] samples: rtc: Generic RTC sample This sample app set and read date/time from the Real-Time Clock. Signed-off-by: Muhammad Waleed Badar --- samples/drivers/rtc/CMakeLists.txt | 8 +++ samples/drivers/rtc/README.rst | 34 ++++++++++ samples/drivers/rtc/boards/qemu_x86.overlay | 18 +++++ .../drivers/rtc/boards/qemu_x86_64.overlay | 18 +++++ .../drivers/rtc/boards/stm32f3_disco.overlay | 11 ++++ samples/drivers/rtc/prj.conf | 2 + samples/drivers/rtc/sample.yaml | 12 ++++ samples/drivers/rtc/src/main.c | 66 +++++++++++++++++++ 8 files changed, 169 insertions(+) create mode 100644 samples/drivers/rtc/CMakeLists.txt create mode 100644 samples/drivers/rtc/README.rst create mode 100644 samples/drivers/rtc/boards/qemu_x86.overlay create mode 100644 samples/drivers/rtc/boards/qemu_x86_64.overlay create mode 100644 samples/drivers/rtc/boards/stm32f3_disco.overlay create mode 100644 samples/drivers/rtc/prj.conf create mode 100644 samples/drivers/rtc/sample.yaml create mode 100644 samples/drivers/rtc/src/main.c diff --git a/samples/drivers/rtc/CMakeLists.txt b/samples/drivers/rtc/CMakeLists.txt new file mode 100644 index 0000000000000..c1443733848ed --- /dev/null +++ b/samples/drivers/rtc/CMakeLists.txt @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(rtc) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/samples/drivers/rtc/README.rst b/samples/drivers/rtc/README.rst new file mode 100644 index 0000000000000..726771535c889 --- /dev/null +++ b/samples/drivers/rtc/README.rst @@ -0,0 +1,34 @@ +.. zephyr:code-sample:: rtc + :name: Real-Time Clock (RTC) + :relevant-api: rtc_interface + + Set and read the date/time from a Real-Time Clock. + +Overview +******** + +This sample shows how to use the :ref:`rtc driver API ` +to set and read the date/time from RTC and display on the console +and can be built and executed on boards supporting RTC. + +Building and Running +******************** + +Build and flash as follows, replacing ``stm32f3_disco`` with your board: + +.. zephyr-app-commands:: + :zephyr-app: samples/drivers/rtc + :board: stm32f3_disco + :goals: build flash + :compact: + +Sample Output +============= + +.. code-block:: console + + RTC date and time: 2024-11-17 04:21:47 + RTC date and time: 2024-11-17 04:21:48 + RTC date and time: 2024-11-17 04:21:49 + + diff --git a/samples/drivers/rtc/boards/qemu_x86.overlay b/samples/drivers/rtc/boards/qemu_x86.overlay new file mode 100644 index 0000000000000..5dafa42333daf --- /dev/null +++ b/samples/drivers/rtc/boards/qemu_x86.overlay @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2023 Bjarki Arge Andreasen + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * The RTC IRQ is not routed to the IOAPIC if the legacy + * IRQ bit is set. The IRQ is required for alarm + * operation and the update callback. + */ +&hpet { + no-legacy-irq; +}; + +&rtc { + status = "okay"; +}; diff --git a/samples/drivers/rtc/boards/qemu_x86_64.overlay b/samples/drivers/rtc/boards/qemu_x86_64.overlay new file mode 100644 index 0000000000000..5dafa42333daf --- /dev/null +++ b/samples/drivers/rtc/boards/qemu_x86_64.overlay @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2023 Bjarki Arge Andreasen + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * The RTC IRQ is not routed to the IOAPIC if the legacy + * IRQ bit is set. The IRQ is required for alarm + * operation and the update callback. + */ +&hpet { + no-legacy-irq; +}; + +&rtc { + status = "okay"; +}; diff --git a/samples/drivers/rtc/boards/stm32f3_disco.overlay b/samples/drivers/rtc/boards/stm32f3_disco.overlay new file mode 100644 index 0000000000000..bd861fccf4292 --- /dev/null +++ b/samples/drivers/rtc/boards/stm32f3_disco.overlay @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2024 STMicroelectronics + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + aliases { + rtc = &rtc; + }; +}; diff --git a/samples/drivers/rtc/prj.conf b/samples/drivers/rtc/prj.conf new file mode 100644 index 0000000000000..eaf68eee82cbf --- /dev/null +++ b/samples/drivers/rtc/prj.conf @@ -0,0 +1,2 @@ +# Enable Peripheral +CONFIG_RTC=y diff --git a/samples/drivers/rtc/sample.yaml b/samples/drivers/rtc/sample.yaml new file mode 100644 index 0000000000000..10f0a08c46367 --- /dev/null +++ b/samples/drivers/rtc/sample.yaml @@ -0,0 +1,12 @@ +sample: + name: Real-Time Clock Sample +tests: + sample.drivers.rtc: + platform_allow: + - stm32f3_disco + tags: + - samples + - rtc + - api + depends_on: + - rtc diff --git a/samples/drivers/rtc/src/main.c b/samples/drivers/rtc/src/main.c new file mode 100644 index 0000000000000..a7c5a978c51e1 --- /dev/null +++ b/samples/drivers/rtc/src/main.c @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2024, Muhammad Waleed Badar + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +const struct device *const rtc = DEVICE_DT_GET(DT_ALIAS(rtc)); + +static int set_date_time(const struct device *rtc) +{ + int ret = 0; + struct rtc_time tm = { + .tm_year = 2024 - 1900, + .tm_mon = 11 - 1, + .tm_mday = 17, + .tm_hour = 4, + .tm_min = 19, + .tm_sec = 0, + }; + + ret = rtc_set_time(rtc, &tm); + if (ret < 0) { + printk("Cannot write date time: %d\n", ret); + return ret; + } + return ret; +} + +static int get_date_time(const struct device *rtc) +{ + int ret = 0; + struct rtc_time tm; + + ret = rtc_get_time(rtc, &tm); + if (ret < 0) { + printk("Cannot read date time: %d\n", ret); + return ret; + } + + printk("RTC date and time: %04d-%02d-%02d %02d:%02d:%02d\n", tm.tm_year + 1900, + tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); + + return ret; +} + +int main(void) +{ + /* Check if the RTC is ready */ + if (!device_is_ready(rtc)) { + printk("Device is not ready\n"); + return 0; + } + + set_date_time(rtc); + + /* Continuously read the current date and time from the RTC */ + while (get_date_time(rtc) == 0) { + k_sleep(K_MSEC(1000)); + }; + return 0; +} From f05deb1aa40106de32726a96508f54a661da744a Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Thu, 21 Nov 2024 11:49:59 +0100 Subject: [PATCH 2968/4482] python: Format trivial files where only newlines were missing Apply formatting on files that only needed adding newlines. Signed-off-by: Pieter De Gendt --- .ruff-excludes.toml | 23 ------------------- samples/net/cellular_modem/server/te.py | 2 ++ scripts/build/dir_is_writeable.py | 2 ++ scripts/build/llext_slidlib.py | 4 ++++ scripts/build/user_wordsize.py | 2 ++ scripts/coredump/gdbstubs/__init__.py | 2 ++ scripts/dts/python-devicetree/setup.py | 1 - scripts/logging/dictionary/parserlib.py | 2 ++ .../tests/resources/mock_script.py | 1 + .../tests/resources/shell_simulator.py | 1 + scripts/pylib/twister/twisterlib/mixins.py | 1 + .../test_data/mixins/test_to_ignore.py | 1 + scripts/west_commands/tests/test_xsdb.py | 2 ++ scripts/west_commands/zspdx/cmakecache.py | 1 + scripts/west_commands/zspdx/datatypes.py | 8 +++++++ scripts/west_commands/zspdx/getincludes.py | 2 ++ scripts/west_commands/zspdx/sbom.py | 3 +++ scripts/west_commands/zspdx/scanner.py | 9 ++++++++ scripts/west_commands/zspdx/spdxids.py | 3 +++ scripts/west_commands/zspdx/util.py | 1 + .../timer/timer_behavior/pytest/conftest.py | 5 ++++ .../tls_configurations/pytest/conftest.py | 3 +++ tests/subsys/debug/gdbstub/pytest/conftest.py | 6 +++++ .../logging/dictionary/pytest/conftest.py | 2 ++ 24 files changed, 63 insertions(+), 24 deletions(-) diff --git a/.ruff-excludes.toml b/.ruff-excludes.toml index 49f0f35bbc9e2..f4dc917313675 100644 --- a/.ruff-excludes.toml +++ b/.ruff-excludes.toml @@ -2089,7 +2089,6 @@ exclude = [ "./samples/modules/tflite-micro/magic_wand/train/train.py", "./samples/modules/tflite-micro/magic_wand/train/train_test.py", "./samples/modules/thrift/hello/client/hello_client.py", - "./samples/net/cellular_modem/server/te.py", "./samples/net/cellular_modem/server/te_udp_echo.py", "./samples/net/cellular_modem/server/te_udp_receive.py", "./samples/net/cloud/aws_iot_mqtt/src/creds/convert_keys.py", @@ -2100,7 +2099,6 @@ exclude = [ "./samples/subsys/zbus/remote_mock/remote_mock.py", "./scripts/build/check_init_priorities.py", "./scripts/build/check_init_priorities_test.py", - "./scripts/build/dir_is_writeable.py", "./scripts/build/elf_parser.py", "./scripts/build/file2hex.py", "./scripts/build/gen_app_partitions.py", @@ -2120,13 +2118,11 @@ exclude = [ "./scripts/build/gen_syscalls.py", "./scripts/build/llext_inject_slids.py", "./scripts/build/llext_prepare_exptab.py", - "./scripts/build/llext_slidlib.py", "./scripts/build/mergehex.py", "./scripts/build/parse_syscalls.py", "./scripts/build/process_gperf.py", "./scripts/build/subfolder_list.py", "./scripts/build/uf2conv.py", - "./scripts/build/user_wordsize.py", "./scripts/check_maintainers.py", "./scripts/ci/check_compliance.py", "./scripts/ci/coverage/coverage_analysis.py", @@ -2140,7 +2136,6 @@ exclude = [ "./scripts/coredump/coredump_parser/elf_parser.py", "./scripts/coredump/coredump_parser/log_parser.py", "./scripts/coredump/coredump_serial_log_parser.py", - "./scripts/coredump/gdbstubs/__init__.py", "./scripts/coredump/gdbstubs/arch/arm64.py", "./scripts/coredump/gdbstubs/arch/arm_cortex_m.py", "./scripts/coredump/gdbstubs/arch/risc_v.py", @@ -2152,7 +2147,6 @@ exclude = [ "./scripts/dts/gen_driver_kconfig_dts.py", "./scripts/dts/gen_dts_cmake.py", "./scripts/dts/gen_edt.py", - "./scripts/dts/python-devicetree/setup.py", "./scripts/dts/python-devicetree/src/devicetree/_private.py", "./scripts/dts/python-devicetree/src/devicetree/dtlib.py", "./scripts/dts/python-devicetree/src/devicetree/edtlib.py", @@ -2189,7 +2183,6 @@ exclude = [ "./scripts/logging/dictionary/dictionary_parser/utils.py", "./scripts/logging/dictionary/log_parser.py", "./scripts/logging/dictionary/log_parser_uart.py", - "./scripts/logging/dictionary/parserlib.py", "./scripts/make_bugs_pickle.py", "./scripts/net/enumerate_http_status.py", "./scripts/profiling/stackcollapse.py", @@ -2210,8 +2203,6 @@ exclude = [ "./scripts/pylib/pytest-twister-harness/tests/device/qemu_adapter_test.py", "./scripts/pylib/pytest-twister-harness/tests/helpers/shell_test.py", "./scripts/pylib/pytest-twister-harness/tests/plugin_test.py", - "./scripts/pylib/pytest-twister-harness/tests/resources/mock_script.py", - "./scripts/pylib/pytest-twister-harness/tests/resources/shell_simulator.py", "./scripts/pylib/twister/expr_parser.py", "./scripts/pylib/twister/scl.py", "./scripts/pylib/twister/twisterlib/cmakecache.py", @@ -2224,7 +2215,6 @@ exclude = [ "./scripts/pylib/twister/twisterlib/harness.py", "./scripts/pylib/twister/twisterlib/jobserver.py", "./scripts/pylib/twister/twisterlib/log_helper.py", - "./scripts/pylib/twister/twisterlib/mixins.py", "./scripts/pylib/twister/twisterlib/package.py", "./scripts/pylib/twister/twisterlib/platform.py", "./scripts/pylib/twister/twisterlib/quarantine.py", @@ -2247,7 +2237,6 @@ exclude = [ "./scripts/tests/twister/pytest_integration/test_harness_pytest.py", "./scripts/tests/twister/test_cmakecache.py", "./scripts/tests/twister/test_config_parser.py", - "./scripts/tests/twister/test_data/mixins/test_to_ignore.py", "./scripts/tests/twister/test_environment.py", "./scripts/tests/twister/test_errors.py", "./scripts/tests/twister/test_handlers.py", @@ -2373,20 +2362,12 @@ exclude = [ "./scripts/west_commands/tests/test_stm32cubeprogrammer.py", "./scripts/west_commands/tests/test_stm32flash.py", "./scripts/west_commands/tests/test_twister.py", - "./scripts/west_commands/tests/test_xsdb.py", "./scripts/west_commands/twister_cmd.py", "./scripts/west_commands/zcmake.py", "./scripts/west_commands/zephyr_ext_common.py", - "./scripts/west_commands/zspdx/cmakecache.py", "./scripts/west_commands/zspdx/cmakefileapi.py", "./scripts/west_commands/zspdx/cmakefileapijson.py", - "./scripts/west_commands/zspdx/datatypes.py", - "./scripts/west_commands/zspdx/getincludes.py", "./scripts/west_commands/zspdx/licenses.py", - "./scripts/west_commands/zspdx/sbom.py", - "./scripts/west_commands/zspdx/scanner.py", - "./scripts/west_commands/zspdx/spdxids.py", - "./scripts/west_commands/zspdx/util.py", "./scripts/west_commands/zspdx/walker.py", "./scripts/west_commands/zspdx/writer.py", "./scripts/zephyr_module.py", @@ -2409,7 +2390,6 @@ exclude = [ "./tests/drivers/can/host/pytest/can_shell.py", "./tests/drivers/can/host/pytest/conftest.py", "./tests/drivers/can/host/pytest/test_can.py", - "./tests/kernel/timer/timer_behavior/pytest/conftest.py", "./tests/kernel/timer/timer_behavior/pytest/saleae_logic2.py", "./tests/kernel/timer/timer_behavior/pytest/test_timer.py", "./tests/misc/check_init_priorities/validate_check_init_priorities_output.py", @@ -2421,12 +2401,9 @@ exclude = [ "./tests/net/lib/lwm2m/interop/pytest/test_lwm2m.py", "./tests/net/lib/lwm2m/interop/pytest/test_nosec.py", "./tests/net/lib/lwm2m/interop/pytest/test_portfolio.py", - "./tests/net/socket/tls_configurations/pytest/conftest.py", "./tests/net/socket/tls_configurations/pytest/test_app_vs_openssl.py", "./tests/net/socket/udp/generate-c-string.py", - "./tests/subsys/debug/gdbstub/pytest/conftest.py", "./tests/subsys/debug/gdbstub/pytest/test_gdbstub.py", - "./tests/subsys/logging/dictionary/pytest/conftest.py", "./tests/subsys/logging/dictionary/pytest/test_logging_dictionary.py", "./tests/ztest/ztest_param/pytest/test_parameters.py", ] diff --git a/samples/net/cellular_modem/server/te.py b/samples/net/cellular_modem/server/te.py index d2339b2096490..1b6d2341e3b2d 100755 --- a/samples/net/cellular_modem/server/te.py +++ b/samples/net/cellular_modem/server/te.py @@ -13,10 +13,12 @@ print("started") + def terminate_handler(a, b): udp_echo.stop() udp_receive.stop() print("stopped") + signal.signal(signal.SIGTERM, terminate_handler) signal.signal(signal.SIGINT, terminate_handler) diff --git a/scripts/build/dir_is_writeable.py b/scripts/build/dir_is_writeable.py index 540db2850f99c..1b744beb1b175 100644 --- a/scripts/build/dir_is_writeable.py +++ b/scripts/build/dir_is_writeable.py @@ -2,10 +2,12 @@ import os import sys + def main(): is_writeable = os.access(sys.argv[1], os.W_OK) return_code = int(not is_writeable) sys.exit(return_code) + if __name__ == "__main__": main() diff --git a/scripts/build/llext_slidlib.py b/scripts/build/llext_slidlib.py index 99157c526dcc3..f3c7ce6388d5c 100755 --- a/scripts/build/llext_slidlib.py +++ b/scripts/build/llext_slidlib.py @@ -25,6 +25,7 @@ from hashlib import sha256 + def generate_slid(symbol_name: str, slid_size: int) -> int: """ Generates the Symbol Link Identifier (SLID) for a symbol. @@ -40,6 +41,7 @@ def generate_slid(symbol_name: str, slid_size: int) -> int: hash = m.digest() return int.from_bytes(hash[0:slid_size], byteorder='big', signed=False) + def format_slid(slid: int, slid_size: int) -> str: if slid_size == 4: fmt = f"0x{slid:08X}" @@ -47,6 +49,7 @@ def format_slid(slid: int, slid_size: int) -> str: fmt = f"0x{slid:016X}" return fmt + def repl(): while True: sym_name = input("Symbol name? ") @@ -56,6 +59,7 @@ def repl(): print(f" 64-bit SLID for '{sym_name}': {format_slid(slid64, 8)}") print() + if __name__ == "__main__": print("LLEXT SLID calculation REPL") print("Press ^C to exit.") diff --git a/scripts/build/user_wordsize.py b/scripts/build/user_wordsize.py index 46c8f6b731886..923e5cc73a74f 100644 --- a/scripts/build/user_wordsize.py +++ b/scripts/build/user_wordsize.py @@ -4,9 +4,11 @@ import struct import sys + def main(): print(struct.calcsize("P") * 8) sys.exit(0) + if __name__ == "__main__": main() diff --git a/scripts/coredump/gdbstubs/__init__.py b/scripts/coredump/gdbstubs/__init__.py index c6d783206821d..14f75831c6f47 100644 --- a/scripts/coredump/gdbstubs/__init__.py +++ b/scripts/coredump/gdbstubs/__init__.py @@ -11,6 +11,7 @@ from gdbstubs.arch.xtensa import GdbStub_Xtensa from gdbstubs.arch.arm64 import GdbStub_ARM64 + class TgtCode: UNKNOWN = 0 X86 = 1 @@ -20,6 +21,7 @@ class TgtCode: XTENSA = 5 ARM64 = 6 + def get_gdbstub(logfile, elffile): stub = None diff --git a/scripts/dts/python-devicetree/setup.py b/scripts/dts/python-devicetree/setup.py index acafb4ad91ad3..a0582d9339b71 100644 --- a/scripts/dts/python-devicetree/setup.py +++ b/scripts/dts/python-devicetree/setup.py @@ -18,7 +18,6 @@ # TBD, just use these for now. author='Zephyr Project', author_email='devel@lists.zephyrproject.org', - name='devicetree', version=version, description='Python libraries for devicetree', diff --git a/scripts/logging/dictionary/parserlib.py b/scripts/logging/dictionary/parserlib.py index 7e1d0a33b7d2e..2404aab796110 100755 --- a/scripts/logging/dictionary/parserlib.py +++ b/scripts/logging/dictionary/parserlib.py @@ -11,12 +11,14 @@ This library along with dictionary_parser converts the input binary data to the log using log database. """ + import sys import logging import dictionary_parser from dictionary_parser.log_database import LogDatabase + def parser(logdata, dbfile, logger): """function of serial parser""" # Read from database file diff --git a/scripts/pylib/pytest-twister-harness/tests/resources/mock_script.py b/scripts/pylib/pytest-twister-harness/tests/resources/mock_script.py index 150765182238c..c865d7b069dd8 100755 --- a/scripts/pylib/pytest-twister-harness/tests/resources/mock_script.py +++ b/scripts/pylib/pytest-twister-harness/tests/resources/mock_script.py @@ -6,6 +6,7 @@ """ Simply mock for bash script to use with unit tests. """ + import sys import time from argparse import ArgumentParser diff --git a/scripts/pylib/pytest-twister-harness/tests/resources/shell_simulator.py b/scripts/pylib/pytest-twister-harness/tests/resources/shell_simulator.py index e0a1eb1789652..71434da914ddd 100644 --- a/scripts/pylib/pytest-twister-harness/tests/resources/shell_simulator.py +++ b/scripts/pylib/pytest-twister-harness/tests/resources/shell_simulator.py @@ -5,6 +5,7 @@ """ Simple shell simulator. """ + import sys from zen_of_python import zen_of_python diff --git a/scripts/pylib/twister/twisterlib/mixins.py b/scripts/pylib/twister/twisterlib/mixins.py index d174edd0f4557..2b34637d5436e 100644 --- a/scripts/pylib/twister/twisterlib/mixins.py +++ b/scripts/pylib/twister/twisterlib/mixins.py @@ -3,5 +3,6 @@ # Copyright (c) 2018 Intel Corporation # SPDX-License-Identifier: Apache-2.0 + class DisablePyTestCollectionMixin(object): __test__ = False diff --git a/scripts/tests/twister/test_data/mixins/test_to_ignore.py b/scripts/tests/twister/test_data/mixins/test_to_ignore.py index 49381293a8bc2..5401fb4a086f4 100644 --- a/scripts/tests/twister/test_data/mixins/test_to_ignore.py +++ b/scripts/tests/twister/test_data/mixins/test_to_ignore.py @@ -1,5 +1,6 @@ from twisterlib.mixins import DisablePyTestCollectionMixin + class TestClassToIgnore(DisablePyTestCollectionMixin): def test_to_ignore(self): assert False diff --git a/scripts/west_commands/tests/test_xsdb.py b/scripts/west_commands/tests/test_xsdb.py index d64055b52917c..ca97e7ad5118b 100644 --- a/scripts/west_commands/tests/test_xsdb.py +++ b/scripts/west_commands/tests/test_xsdb.py @@ -41,6 +41,7 @@ }, ] + @pytest.mark.parametrize("tc", TEST_CASES) @patch("runners.xsdb.os.path.exists", return_value=True) @patch("runners.xsdb.XSDBBinaryRunner.check_call") @@ -59,6 +60,7 @@ def test_xsdbbinaryrunner_init(check_call, path_exists, tc, runner_config): assert check_call.call_args_list == [call(tc["expected_cmd"])] + @pytest.mark.parametrize("tc", TEST_CASES) @patch("runners.xsdb.os.path.exists", return_value=True) @patch("runners.xsdb.XSDBBinaryRunner.check_call") diff --git a/scripts/west_commands/zspdx/cmakecache.py b/scripts/west_commands/zspdx/cmakecache.py index 2c47fd7f0be11..612cee0170fb3 100644 --- a/scripts/west_commands/zspdx/cmakecache.py +++ b/scripts/west_commands/zspdx/cmakecache.py @@ -4,6 +4,7 @@ from west import log + # Parse a CMakeCache file and return a dict of key:value (discarding # type hints). def parseCMakeCacheFile(filePath): diff --git a/scripts/west_commands/zspdx/datatypes.py b/scripts/west_commands/zspdx/datatypes.py index 33137cf9beb7d..01f2498e0c27a 100644 --- a/scripts/west_commands/zspdx/datatypes.py +++ b/scripts/west_commands/zspdx/datatypes.py @@ -4,6 +4,7 @@ from enum import Enum + # DocumentConfig contains settings used to configure how the SPDX Document # should be built. class DocumentConfig: @@ -20,6 +21,7 @@ def __init__(self): # docs will use to refer to this one self.docRefID = "" + # Document contains the data assembled by the SBOM builder, to be used to # create the actual SPDX Document. class Document: @@ -56,6 +58,7 @@ def __init__(self, cfg): # written to disk, so that others can refer to it self.myDocSHA1 = "" + # PackageConfig contains settings used to configure how an SPDX Package should # be built. class PackageConfig: @@ -95,6 +98,7 @@ def __init__(self): # may want to note this in a Package comment field self.relativeBaseDir = "" + # Package contains the data assembled by the SBOM builder, to be used to # create the actual SPDX Package. class Package: @@ -131,6 +135,7 @@ def __init__(self, cfg, doc): # If this Package was a target, which File was its main build product? self.targetBuildFile = None + # RelationshipDataElementType defines whether a RelationshipData element # (e.g., the "owner" or the "other" element) is a File, a target Package, # a Package's ID (as other only, and only where owner type is DOCUMENT), @@ -142,6 +147,7 @@ class RelationshipDataElementType(Enum): PACKAGEID = 3 DOCUMENT = 4 + # RelationshipData contains the pre-analysis data about a relationship between # Files and/or Packages/targets. It is eventually parsed into a corresponding # Relationship after we have organized the SPDX Package and File data. @@ -179,6 +185,7 @@ def __init__(self): # from table 68 in section 11.1 of SPDX spec v2.3 self.rlnType = "" + # Relationship contains the post-analysis, processed data about a relationship # in a form suitable for creating the actual SPDX Relationship in a particular # Document's context. @@ -198,6 +205,7 @@ def __init__(self): # from table 68 in section 11.1 of SPDX spec v2.3 self.rlnType = "" + # File contains the data needed to create a File element in the context of a # particular SPDX Document and Package. class File: diff --git a/scripts/west_commands/zspdx/getincludes.py b/scripts/west_commands/zspdx/getincludes.py index c1060e661786d..27a0c57965b76 100644 --- a/scripts/west_commands/zspdx/getincludes.py +++ b/scripts/west_commands/zspdx/getincludes.py @@ -6,6 +6,7 @@ from west import log + # Given a path to the applicable C compiler, a C source file, and the # corresponding TargetCompileGroup, determine which include files would # be used. @@ -37,6 +38,7 @@ def getCIncludes(compilerPath, srcFile, tcg): # response will be in cp.stderr, not cp.stdout return extractIncludes(cp.stderr) + # Parse the response from the CC -E -H call, to extract the include file paths def extractIncludes(resp): includes = set() diff --git a/scripts/west_commands/zspdx/sbom.py b/scripts/west_commands/zspdx/sbom.py index 1eff541a5d59f..dceda34fcaf50 100644 --- a/scripts/west_commands/zspdx/sbom.py +++ b/scripts/west_commands/zspdx/sbom.py @@ -10,6 +10,7 @@ from zspdx.scanner import ScannerConfig, scanDocument from zspdx.writer import writeSPDX + # SBOMConfig contains settings that will be passed along to the various # SBOM maker subcomponents. class SBOMConfig: @@ -31,6 +32,7 @@ def __init__(self): # should also add an SPDX document for the SDK? self.includeSDK = False + # create Cmake file-based API directories and query file # Arguments: # 1) build_dir: build directory @@ -60,6 +62,7 @@ def setupCmakeQuery(build_dir): cm_fd.close() return True + # main entry point for SBOM maker # Arguments: # 1) cfg: SBOMConfig diff --git a/scripts/west_commands/zspdx/scanner.py b/scripts/west_commands/zspdx/scanner.py index a259325b18965..cf6e71a0f236b 100644 --- a/scripts/west_commands/zspdx/scanner.py +++ b/scripts/west_commands/zspdx/scanner.py @@ -11,6 +11,7 @@ from zspdx.licenses import LICENSES from zspdx.util import getHashes + # ScannerConfig contains settings used to configure how the SPDX # Document scanning should occur. class ScannerConfig: @@ -36,6 +37,7 @@ def __init__(self): # should we calculate MD5 hashes for each Package's Files? self.doMD5 = False + def parseLineForExpression(line): """Return parsed SPDX expression if tag found in line, or None otherwise.""" p = line.partition("SPDX-License-Identifier:") @@ -47,6 +49,7 @@ def parseLineForExpression(line): expression = expression.strip() return expression + def getExpressionData(filePath, numLines): """ Scans the specified file for the first SPDX-License-Identifier: @@ -77,6 +80,7 @@ def getExpressionData(filePath, numLines): # if we get here, we didn't find an expression return None + def splitExpression(expression): """ Parse a license expression into its constituent identifiers. @@ -96,6 +100,7 @@ def splitExpression(expression): return sorted(e4) + def calculateVerificationCode(pkg): """ Calculate the SPDX Package Verification Code for all files in the package. @@ -114,6 +119,7 @@ def calculateVerificationCode(pkg): hSHA1.update(filelist.encode('utf-8')) return hSHA1.hexdigest() + def checkLicenseValid(lic, doc): """ Check whether this license ID is a valid SPDX license ID, and add it @@ -126,6 +132,7 @@ def checkLicenseValid(lic, doc): if lic not in LICENSES: doc.customLicenseIDs.add(lic) + def getPackageLicenses(pkg): """ Extract lists of all concluded and infoInFile licenses seen. @@ -143,6 +150,7 @@ def getPackageLicenses(pkg): licsFromFiles.add(licInfo) return sorted(list(licsConcluded)), sorted(list(licsFromFiles)) + def normalizeExpression(licsConcluded): """ Combine array of license expressions into one AND'd expression, @@ -170,6 +178,7 @@ def normalizeExpression(licsConcluded): revised.append(lic) return " AND ".join(revised) + def scanDocument(cfg, doc): """ Scan for licenses and calculate hashes for all Files and Packages diff --git a/scripts/west_commands/zspdx/spdxids.py b/scripts/west_commands/zspdx/spdxids.py index 46688207509c2..1c00f63583ac0 100644 --- a/scripts/west_commands/zspdx/spdxids.py +++ b/scripts/west_commands/zspdx/spdxids.py @@ -4,6 +4,7 @@ import re + def getSPDXIDSafeCharacter(c): """ Converts a character to an SPDX-ID-safe character. @@ -17,6 +18,7 @@ def getSPDXIDSafeCharacter(c): return c return "-" + def convertToSPDXIDSafe(s): """ Converts a filename or other string to only SPDX-ID-safe characters. @@ -30,6 +32,7 @@ def convertToSPDXIDSafe(s): """ return "".join([getSPDXIDSafeCharacter(c) for c in s]) + def getUniqueFileID(filenameOnly, timesSeen): """ Find an SPDX ID that is unique among others seen so far. diff --git a/scripts/west_commands/zspdx/util.py b/scripts/west_commands/zspdx/util.py index 059eea3d20f7b..e02a981b6027f 100644 --- a/scripts/west_commands/zspdx/util.py +++ b/scripts/west_commands/zspdx/util.py @@ -6,6 +6,7 @@ from west import log + def getHashes(filePath): """ Scan for and return hashes. diff --git a/tests/kernel/timer/timer_behavior/pytest/conftest.py b/tests/kernel/timer/timer_behavior/pytest/conftest.py index d9564664b7007..9fac87a1edd64 100644 --- a/tests/kernel/timer/timer_behavior/pytest/conftest.py +++ b/tests/kernel/timer/timer_behavior/pytest/conftest.py @@ -6,19 +6,23 @@ from pathlib import Path + def pytest_addoption(parser): parser.addoption('--tool') parser.addoption('--tool-options') parser.addoption('--sys-clock-hw-cycles-per-sec', default=None) + @pytest.fixture() def tool(request): return request.config.getoption('--tool') + @pytest.fixture() def tool_options(request): return request.config.getoption('--tool-options') + @pytest.fixture() def config(request): build_dir = Path(request.config.getoption('--build-dir')) @@ -33,6 +37,7 @@ def config(request): return cfgs + @pytest.fixture() def sys_clock_hw_cycles_per_sec(request, config): if request.config.getoption('--sys-clock-hw-cycles-per-sec'): diff --git a/tests/net/socket/tls_configurations/pytest/conftest.py b/tests/net/socket/tls_configurations/pytest/conftest.py index 4546d15594a2f..5eb76085f0641 100644 --- a/tests/net/socket/tls_configurations/pytest/conftest.py +++ b/tests/net/socket/tls_configurations/pytest/conftest.py @@ -4,14 +4,17 @@ import pytest + def pytest_addoption(parser): parser.addoption('--server-type') parser.addoption('--port') + @pytest.fixture() def server_type(request): return request.config.getoption('--server-type') + @pytest.fixture() def port(request): return request.config.getoption('--port') diff --git a/tests/subsys/debug/gdbstub/pytest/conftest.py b/tests/subsys/debug/gdbstub/pytest/conftest.py index 12d5ced7590a9..1d850d878d8b5 100644 --- a/tests/subsys/debug/gdbstub/pytest/conftest.py +++ b/tests/subsys/debug/gdbstub/pytest/conftest.py @@ -6,20 +6,26 @@ import pytest + def pytest_addoption(parser): parser.addoption('--gdb_target_remote') parser.addoption('--gdb_timeout') parser.addoption('--gdb_script') + @pytest.fixture() def gdb_script(request): return request.config.getoption('--gdb_script') + @pytest.fixture() def gdb_timeout(request): return int(request.config.getoption('--gdb_timeout', default=60)) + @pytest.fixture() def gdb_target_remote(request): return request.config.getoption('--gdb_target_remote', default=":5678") + + # diff --git a/tests/subsys/logging/dictionary/pytest/conftest.py b/tests/subsys/logging/dictionary/pytest/conftest.py index 29d3de55d10bf..5d033ae75a53a 100644 --- a/tests/subsys/logging/dictionary/pytest/conftest.py +++ b/tests/subsys/logging/dictionary/pytest/conftest.py @@ -6,9 +6,11 @@ import pytest + def pytest_addoption(parser): parser.addoption('--fpu', action="store_true") + @pytest.fixture() def is_fpu_build(request): return request.config.getoption('--fpu') From 39889c002321bf6269a31e4e571f175341cfb3fe Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 19 Nov 2024 18:46:20 +0200 Subject: [PATCH 2969/4482] net: if: Do not report error if we are already in promisc mode If we are already in promiscuous mode, then do not report error in that case. Fixes #81605 Signed-off-by: Jukka Rissanen --- subsys/net/ip/net_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c index 002bae2b3a86d..e4113cb56b863 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -5667,7 +5667,7 @@ int net_if_set_promisc(struct net_if *iface) net_if_lock(iface); ret = promisc_mode_set(iface, true); - if (ret < 0) { + if (ret < 0 && ret != -EALREADY) { goto out; } From b20784dfbba95dad6c1727ab69c2451775576180 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Tue, 19 Nov 2024 12:00:27 +0100 Subject: [PATCH 2970/4482] docs: Bluetooth: Move documentating for shell out of API The API directory really isn't the best place for shell documentation, which isn't API. Created a new directory for Bluetooth shell documentation and moved the ISO and LE Audio docs in there. The existing bluetooth-shell.rst file was also split into several new files, so that it follows the same structure. Signed-off-by: Emil Gydesen --- MAINTAINERS.yml | 8 +- doc/_scripts/redirects.py | 12 + doc/connectivity/bluetooth/api/index.rst | 11 - .../bluetooth/bluetooth-shell.rst | 513 +----------------- .../{api/audio/shell => shell/audio}/bap.rst | 0 .../audio}/bap_broadcast_assistant.rst | 0 .../audio}/bap_scan_delegator.rst | 0 .../{api/audio/shell => shell/audio}/cap.rst | 0 .../{api/audio/shell => shell/audio}/ccp.rst | 0 .../{api/audio/shell => shell/audio}/csip.rst | 0 .../{api/audio/shell => shell/audio}/gmap.rst | 0 .../{api/audio/shell => shell/audio}/mcp.rst | 0 .../{api/audio/shell => shell/audio}/pbp.rst | 0 .../{api/audio/shell => shell/audio}/tmap.rst | 0 .../bluetooth/shell/classic/a2dp.rst | 89 +++ doc/connectivity/bluetooth/shell/host/gap.rst | 333 ++++++++++++ .../bluetooth/shell/host/gatt.rst | 26 + .../{api/shell => shell/host}/iso.rst | 4 +- .../bluetooth/shell/host/l2cap.rst | 48 ++ 19 files changed, 537 insertions(+), 507 deletions(-) rename doc/connectivity/bluetooth/{api/audio/shell => shell/audio}/bap.rst (100%) rename doc/connectivity/bluetooth/{api/audio/shell => shell/audio}/bap_broadcast_assistant.rst (100%) rename doc/connectivity/bluetooth/{api/audio/shell => shell/audio}/bap_scan_delegator.rst (100%) rename doc/connectivity/bluetooth/{api/audio/shell => shell/audio}/cap.rst (100%) rename doc/connectivity/bluetooth/{api/audio/shell => shell/audio}/ccp.rst (100%) rename doc/connectivity/bluetooth/{api/audio/shell => shell/audio}/csip.rst (100%) rename doc/connectivity/bluetooth/{api/audio/shell => shell/audio}/gmap.rst (100%) rename doc/connectivity/bluetooth/{api/audio/shell => shell/audio}/mcp.rst (100%) rename doc/connectivity/bluetooth/{api/audio/shell => shell/audio}/pbp.rst (100%) rename doc/connectivity/bluetooth/{api/audio/shell => shell/audio}/tmap.rst (100%) create mode 100644 doc/connectivity/bluetooth/shell/classic/a2dp.rst create mode 100644 doc/connectivity/bluetooth/shell/host/gap.rst create mode 100644 doc/connectivity/bluetooth/shell/host/gatt.rst rename doc/connectivity/bluetooth/{api/shell => shell/host}/iso.rst (94%) create mode 100644 doc/connectivity/bluetooth/shell/host/l2cap.rst diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index a0fddc69c649e..7108f83945811 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -390,8 +390,10 @@ Bluetooth Host: - doc/connectivity/bluetooth/img/ctlr* - doc/connectivity/bluetooth/api/audio/ - doc/connectivity/bluetooth/api/mesh/ - - doc/connectivity/bluetooth/api/shell/iso.rst - doc/connectivity/bluetooth/api/controller.rst + - doc/connectivity/bluetooth/shell/classic/a2dp.rst + - doc/connectivity/bluetooth/shell/host/iso.rst + - doc/connectivity/bluetooth/shell/audio/ - samples/bluetooth/bap*/ - samples/bluetooth/cap*/ - samples/bluetooth/hap*/ @@ -475,6 +477,7 @@ Bluetooth Audio: - tests/bluetooth/tester/overlay-le-audio.conf - tests/bluetooth/tester/src/audio/ - doc/connectivity/bluetooth/api/audio/ + - doc/connectivity/bluetooth/shell/audio/ - samples/bluetooth/bap*/ - samples/bluetooth/cap*/ - samples/bluetooth/hap*/ @@ -493,6 +496,7 @@ Bluetooth Classic: collaborators: - jhedberg files: + - doc/connectivity/bluetooth/shell/classic/a2dp.rst - subsys/bluetooth/common/ - subsys/bluetooth/host/classic/ - include/zephyr/bluetooth/classic/ @@ -512,7 +516,7 @@ Bluetooth ISO: - rugeGerritsen files: - include/zephyr/bluetooth/iso.h - - doc/connectivity/bluetooth/api/shell/iso.rst + - doc/connectivity/bluetooth/shell/host/iso.rst - samples/bluetooth/iso_*/ - subsys/bluetooth/Kconfig.iso - subsys/bluetooth/host/iso.c diff --git a/doc/_scripts/redirects.py b/doc/_scripts/redirects.py index d7c3d1d733706..87d54e5032eca 100644 --- a/doc/_scripts/redirects.py +++ b/doc/_scripts/redirects.py @@ -26,6 +26,18 @@ ('boards/x86/intel_ehl/doc/index', 'boards/intel/ehl/doc/index'), ('boards/x86/intel_rpl/doc/index', 'boards/intel/rpl/doc/index'), ('boards/x86/rpl_crb/doc/index', 'boards/x86/intel_rpl/doc/index'), + + ('connectivity/bluetooth/api/audio/shell/bap', 'connectivity/bluetooth/shell/audio/bap'), + ('connectivity/bluetooth/api/audio/shell/bap_broadcast_assistant', 'connectivity/bluetooth/shell/audio/bap_broadcast_assistant'), + ('connectivity/bluetooth/api/audio/shell/bap_scan_delegator', 'connectivity/bluetooth/shell/audio/bap_scan_delegator'), + ('connectivity/bluetooth/api/audio/shell/cap', 'connectivity/bluetooth/shell/audio/cap'), + ('connectivity/bluetooth/api/audio/shell/ccp', 'connectivity/bluetooth/shell/audio/ccp'), + ('connectivity/bluetooth/api/audio/shell/csip', 'connectivity/bluetooth/shell/audio/csip'), + ('connectivity/bluetooth/api/audio/shell/gmap', 'connectivity/bluetooth/shell/audio/gmap'), + ('connectivity/bluetooth/api/audio/shell/mcp', 'connectivity/bluetooth/shell/audio/mcp'), + ('connectivity/bluetooth/api/audio/shell/pbp', 'connectivity/bluetooth/shell/audio/pbp'), + ('connectivity/bluetooth/api/audio/shell/tmap', 'connectivity/bluetooth/shell/audio/tmap'), + ('connectivity/bluetooth/api/shell/iso', 'connectivity/bluetooth/shell/host/iso'), ('connectivity/bluetooth/audio', 'connectivity/bluetooth/api/audio/audio'), ('connectivity/bluetooth/bap', 'connectivity/bluetooth/api/audio/bap'), ('connectivity/bluetooth/bluetooth-audio-arch', 'connectivity/bluetooth/bluetooth-le-audio-arch'), diff --git a/doc/connectivity/bluetooth/api/index.rst b/doc/connectivity/bluetooth/api/index.rst index 6135df5e6a204..479f276581056 100644 --- a/doc/connectivity/bluetooth/api/index.rst +++ b/doc/connectivity/bluetooth/api/index.rst @@ -26,16 +26,6 @@ Bluetooth LE Audio audio/media.rst audio/microphone.rst audio/volume.rst - audio/shell/bap.rst - audio/shell/bap_broadcast_assistant.rst - audio/shell/bap_scan_delegator.rst - audio/shell/cap.rst - audio/shell/ccp.rst - audio/shell/csip.rst - audio/shell/gmap.rst - audio/shell/mcp.rst - audio/shell/tmap.rst - audio/shell/pbp.rst Bluetooth LE Host ================= @@ -45,7 +35,6 @@ Bluetooth LE Host services.rst gap.rst - shell/iso.rst gatt.rst att.rst diff --git a/doc/connectivity/bluetooth/bluetooth-shell.rst b/doc/connectivity/bluetooth/bluetooth-shell.rst index ad906e3ba8a75..1cfa5d8054689 100644 --- a/doc/connectivity/bluetooth/bluetooth-shell.rst +++ b/doc/connectivity/bluetooth/bluetooth-shell.rst @@ -6,6 +6,27 @@ Shell The Bluetooth Shell is an application based on the :ref:`shell_api` module. It offer a collection of commands made to easily interact with the Bluetooth stack. +For specific Bluetooth functionality see also the following shell documentation + +.. toctree:: + :maxdepth: 1 + + shell/audio/bap.rst + shell/audio/bap_broadcast_assistant.rst + shell/audio/bap_scan_delegator.rst + shell/audio/cap.rst + shell/audio/ccp.rst + shell/audio/csip.rst + shell/audio/gmap.rst + shell/audio/mcp.rst + shell/audio/tmap.rst + shell/audio/pbp.rst + shell/classic/a2dp.rst + shell/host/gap.rst + shell/host/gatt.rst + shell/host/iso.rst + shell/host/l2cap.rst + Bluetooth Shell Setup and Usage ******************************* @@ -42,498 +63,6 @@ message is printed to confirm Bluetooth has been initialized. [00:02:26.794,799] bt_hci_core: bt_dev_show_info: LMP: version 5.3 (0x0c) subver 0xffff -Identities -********** - -Identities are a Zephyr host concept, allowing a single physical device to behave like multiple -logical Bluetooth devices. - -The shell allows the creation of multiple identities, to a maximum that is set by the Kconfig symbol -:kconfig:option:`CONFIG_BT_ID_MAX`. To create a new identity, use :code:`bt id-create` command. You -can then use it by selecting it with its ID :code:`bt id-select `. Finally, you can list all the -available identities with :code:`id-show`. - -Scan for devices -**************** - -Start scanning by using the :code:`bt scan on` command. Depending on the environment you're in, you -may see a lot of lines printed on the shell. To stop the scan, run :code:`bt scan off`, the -scrolling should stop. - -Here is an example of what you can expect: - -.. code-block:: console - - uart:~$ bt scan on - Bluetooth active scan enabled - [DEVICE]: CB:01:1A:2D:6E:AE (random), AD evt type 0, RSSI -78 C:1 S:1 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 us), SID: 0xff - [DEVICE]: 20:C2:EE:59:85:5B (random), AD evt type 3, RSSI -62 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 us), SID: 0xff - [DEVICE]: E3:72:76:87:2F:E8 (random), AD evt type 3, RSSI -74 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 us), SID: 0xff - [DEVICE]: 1E:19:25:8A:CB:84 (random), AD evt type 3, RSSI -67 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 us), SID: 0xff - [DEVICE]: 26:42:F3:D5:A0:86 (random), AD evt type 3, RSSI -73 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 us), SID: 0xff - [DEVICE]: 0C:61:D1:B9:5D:9E (random), AD evt type 3, RSSI -87 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 us), SID: 0xff - [DEVICE]: 20:C2:EE:59:85:5B (random), AD evt type 3, RSSI -66 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 us), SID: 0xff - [DEVICE]: 25:3F:7A:EE:0F:55 (random), AD evt type 3, RSSI -83 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 us), SID: 0xff - uart:~$ bt scan off - Scan successfully stopped - -As you can see, this can lead to a high number of results. To reduce that number and easily find a -specific device, you can enable scan filters. There are four types of filters: by name, by RSSI, by -address and by periodic advertising interval. To apply a filter, use the :code:`bt scan-set-filter` -command followed by the type of filters. You can add multiple filters by using the commands again. - -For example, if you want to look only for devices with the name *test shell*: - -.. code-block:: console - - uart:~$ bt scan-filter-set name "test shell" - -Or if you want to look for devices at a very close range: - -.. code-block:: console - - uart:~$ bt scan-filter-set rssi -40 - RSSI cutoff set at -40 dB - -Finally, if you want to remove all filters: - -.. code-block:: console - - uart:~$ bt scan-filter-clear all - -You can use the command :code:`bt scan on` to create an *active* scanner, meaning that the scanner -will ask the advertisers for more information by sending a *scan request* packet. Alternatively, you -can create a *passive scanner* by using the :code:`bt scan passive` command, so the scanner will not -ask the advertiser for more information. - -Connecting to a device -********************** - -To connect to a device, you need to know its address and type of address and use the -:code:`bt connect` command with the address and the type as arguments. - -Here is an example: - -.. code-block:: console - - uart:~$ bt connect 52:84:F6:BD:CE:48 random - Connection pending - Connected: 52:84:F6:BD:CE:48 (random) - Remote LMP version 5.3 (0x0c) subversion 0xffff manufacturer 0x05f1 - LE Features: 0x000000000001412f - LE PHY updated: TX PHY LE 2M, RX PHY LE 2M - LE conn param req: int (0x0018, 0x0028) lat 0 to 42 - LE conn param updated: int 0x0028 lat 0 to 42 - -You can list the active connections of the shell using the :code:`bt connections` command. The shell -maximum number of connections is defined by :kconfig:option:`CONFIG_BT_MAX_CONN`. You can disconnect -from a connection with the -:code:`bt disconnect ` command. - -.. note:: - - If you were scanning just before, you can connect to the last scanned device by - simply running the :code:`bt connect` command. - - Alternatively, you can use the :code:`bt connect-name ` command to automatically - enable scanning with a name filter and connect to the first match. - -Advertising -*********** - -Begin advertising by using the :code:`bt advertise on` command. This will use the default parameters -and advertise a resolvable private address with the name of the device. You can choose to use the -identity address instead by running the :code:`bt advertise on identity` command. To stop -advertising use the :code:`bt advertise off` command. - -To enable more advanced features of advertising, you should create an advertiser using the -:code:`bt adv-create` command. Parameters for the advertiser can be passed either at the creation of -it or by using the :code:`bt adv-param` command. To begin advertising with this newly created -advertiser, use the :code:`bt adv-start` command, and then the :code:`bt adv-stop` command to stop -advertising. - -When using the custom advertisers, you can choose if it will be connectable or scannable. This leads -to four options: :code:`conn-scan`, :code:`conn-nscan`, :code:`nconn-scan` and :code:`nconn-nscan`. -Those parameters are mandatory when creating an advertiser or updating its parameters. - -For example, if you want to create a connectable and scannable advertiser and start it: - -.. code-block:: console - - uart:~$ bt adv-create conn-scan - Created adv id: 0, adv: 0x200022f0 - uart:~$ bt adv-start - Advertiser[0] 0x200022f0 set started - -You may notice that with this, the custom advertiser does not advertise the device name; you need to -add it. Continuing from the previous example: - -.. code-block:: console - - uart:~$ bt adv-stop - Advertiser set stopped - uart:~$ bt adv-data dev-name - uart:~$ bt adv-start - Advertiser[0] 0x200022f0 set started - -You should now see the name of the device in the advertising data. You can also set a custom name by -using :code:`name ` instead of :code:`dev-name`. It is also possible to set the -advertising data manually with the :code:`bt adv-data` command. The following example shows how -to set the advertiser name with it using raw advertising data: - -.. code-block:: console - - uart:~$ bt adv-create conn-scan - Created adv id: 0, adv: 0x20002348 - uart:~$ bt adv-data 1009426C7565746F6F74682D5368656C6C - uart:~$ bt adv-start - Advertiser[0] 0x20002348 set started - -The data must be formatted according to the Bluetooth Core Specification (see version 5.3, vol. 3, -part C, 11). In this example, the first octet is the size of the data (the data and one octet for -the data type), the second one is the type of data, ``0x09`` is the Complete Local Name and the -remaining data are the name in ASCII. So, on the other device you should see the name -*Bluetooth-Shell*. - -When advertising, if others devices use an *active* scanner, you may receive *scan request* packets. -To visualize those packets, you can add :code:`scan-reports` to the parameters of your advertiser. - -Directed Advertising -==================== - -It is possible to use directed advertising on the shell if you want to reconnect to a device. The -following example demonstrates how to create a directed advertiser with the address specified right -after the parameter :code:`directed`. The :code:`low` parameter indicates that we want to use the -low duty cycle mode, and the :code:`dir-rpa` parameter is required if the remote device is -privacy-enabled and supports address resolution of the target address in directed advertisement. - -.. code-block:: console - - uart:~$ bt adv-create conn-scan directed D7:54:03:CE:F3:B4 random low dir-rpa - Created adv id: 0, adv: 0x20002348 - -After that, you can start the advertiser and then the target device will be able to reconnect. - -Extended Advertising -==================== - -Let's now have a look at some extended advertising features. To enable extended advertising, use the -``ext-adv`` parameter. - -.. code-block:: console - - uart:~$ bt adv-create conn-nscan ext-adv name-ad - Created adv id: 0, adv: 0x200022f0 - uart:~$ bt adv-start - Advertiser[0] 0x200022f0 set started - -This will create an extended advertiser, that is connectable and non-scannable. - -Encrypted Advertising Data -========================== - -Zephyr has support for the Encrypted Advertising Data feature. The :code:`bt encrypted-ad` -sub-commands allow managing the advertising data of a given advertiser. - -To encrypt the advertising data, key materials need to be provided, that can be done with :code:`bt -encrypted-ad set-keys `. The session key is 16 bytes long and the -initialisation vector is 8 bytes long. - -You can add advertising data by using :code:`bt encrypted-ad add-ad` and :code:`bt encrypted-ad -add-ead`. The former will take add one advertising data structure (as defined in the Core -Specification), when the later will read the given data, encrypt them and then add the generated -encrypted advertising data structure. It's possible to mix encrypted and non-encrypted data, when -done adding advertising data, :code:`bt encrypted-ad commit-ad` can be used to apply the change to -the data to the selected advertiser. After that the advertiser can be started as described -previously. It's possible to clear the advertising data by using :code:`bt encrypted-ad clear-ad`. - -On the Central side, it's possible to decrypt the received encrypted advertising data by setting the -correct keys material as described earlier and then enabling the decrypting of the data with -:code:`bt encrypted-ad decrypt-scan on`. - -.. note:: - - To see the advertising data in the scan report :code:`bt scan-verbose-output` need to be - enabled. - -.. note:: - - It's possible to increase the length of the advertising data by increasing the value of - :kconfig:option:`CONFIG_BT_CTLR_ADV_DATA_LEN_MAX` and - :kconfig:option:`CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX`. - -Here is a simple example demonstrating the usage of EAD: - -.. tabs:: - - .. group-tab:: Peripheral - - .. code-block:: console - - uart:~$ bt init - ... - uart:~$ bt adv-create conn-nscan ext-adv - Created adv id: 0, adv: 0x81769a0 - uart:~$ bt encrypted-ad set-keys 9ba22d3824efc70feb800c80294cba38 2e83f3d4d47695b6 - session key set to: - 00000000: 9b a2 2d 38 24 ef c7 0f eb 80 0c 80 29 4c ba 38 |..-8$... ....)L.8| - initialisation vector set to: - 00000000: 2e 83 f3 d4 d4 76 95 b6 |.....v.. | - uart:~$ bt encrypted-ad add-ad 06097368656C6C - uart:~$ bt encrypted-ad add-ead 03ffdead03ffbeef - uart:~$ bt encrypted-ad commit-ad - Advertising data for Advertiser[0] 0x81769a0 updated. - uart:~$ bt adv-start - Advertiser[0] 0x81769a0 set started - - .. group-tab:: Central - - .. code-block:: console - - uart:~$ bt init - ... - uart:~$ bt scan-verbose-output on - uart:~$ bt encrypted-ad set-keys 9ba22d3824efc70feb800c80294cba38 2e83f3d4d47695b6 - session key set to: - 00000000: 9b a2 2d 38 24 ef c7 0f eb 80 0c 80 29 4c ba 38 |..-8$... ....)L.8| - initialisation vector set to: - 00000000: 2e 83 f3 d4 d4 76 95 b6 |.....v.. | - uart:~$ bt encrypted-ad decrypt-scan on - Received encrypted advertising data will now be decrypted using provided key materials. - uart:~$ bt scan on - Bluetooth active scan enabled - [DEVICE]: 68:49:30:68:49:30 (random), AD evt type 5, RSSI -59 shell C:1 S:0 D:0 SR:0 E:1 Prim: LE 1M, Secn: LE 2M, Interval: 0x0000 (0 us), SID: 0x0 - [SCAN DATA START - EXT_ADV] - Type 0x09: shell - Type 0x31: Encrypted Advertising Data: 0xe2, 0x17, 0xed, 0x04, 0xe7, 0x02, 0x1d, 0xc9, 0x40, 0x07, uart:~0x18, 0x90, 0x6c, 0x4b, 0xfe, 0x34, 0xad - [START DECRYPTED DATA] - Type 0xff: 0xde, 0xad - Type 0xff: 0xbe, 0xef - [END DECRYPTED DATA] - [SCAN DATA END] - ... - -Filter Accept List -****************** - -It's possible to create a list of allowed addresses that can be used to -connect to those addresses automatically. Here is how to do it: - -.. code-block:: console - - uart:~$ bt fal-add 47:38:76:EA:29:36 random - uart:~$ bt fal-add 66:C8:80:2A:05:73 random - uart:~$ bt fal-connect on - -The shell will then connect to the first available device. In the example, if both devices are -advertising at the same time, we will connect to the first address added to the list. - -The Filter Accept List can also be used for scanning or advertising by using the option :code:`fal`. -For example, if we want to scan for a bunch of selected addresses, we can set up a Filter Accept -List: - -.. code-block:: console - - uart:~$ bt fal-add 65:4B:9E:83:AF:73 random - uart:~$ bt fal-add 73:72:82:B4:8F:B9 random - uart:~$ bt fal-add 5D:85:50:1C:72:64 random - uart:~$ bt scan on fal - -You should see only those three addresses reported by the scanner. - -Enabling security -***************** - -When connected to a device, you can enable multiple levels of security, here is the list for -Bluetooth LE: - -* **1** No encryption and no authentication; -* **2** Encryption and no authentication; -* **3** Encryption and authentication; -* **4** Bluetooth LE Secure Connection. - -To enable security, use the :code:`bt security ` command. For levels requiring authentication -(level 3 and above), you must first set the authentication method. To do it, you can use the -:code:`bt auth all` command. After that, when you will set the security level, you will be asked to -confirm the passkey on both devices. On the shell side, do it with the command -:code:`bt auth-passkey-confirm`. - -Pairing -======= - -Enabling authentication requires the devices to be bondable. By default the shell is bondable. You -can make the shell not bondable using :code:`bt bondable off`. You can list all the devices you are -paired with using the command :code:`bt bonds`. - -The maximum number of paired devices is set using :kconfig:option:`CONFIG_BT_MAX_PAIRED`. You can -remove a paired device using :code:`bt clear ` -or remove all paired devices with the command :code:`bt clear all`. - -GATT -**** - -The following examples assume that you have two devices already connected. - -To perform service discovery on the client side, use the :code:`gatt discover` command. This should -print all the services that are available on the GATT server. - -On the server side, you can register pre-defined test services using the :code:`gatt register` -command. When done, you should see the newly added services on the client side when running the -discovery command. - -You can now subscribe to those new services on the client side. Here is an example on how to -subscribe to the test service: - -.. code-block:: console - - uart:~$ gatt subscribe 26 25 - Subscribed - -The server can now notify the client with the command :code:`gatt notify`. - -Another option available through the GATT command is initiating the MTU exchange. To do it, use the -:code:`gatt exchange-mtu` command. To update the shell maximum MTU, you need to update Kconfig -symbols in the configuration file of the shell. For more details, see -:zephyr:code-sample:`bluetooth_mtu_update`. - -L2CAP -***** - -The :code:`l2cap` command exposes parts of the L2CAP API. The following example shows how to -register a LE PSM, connect to it from another device and send 3 packets of 14 octets each. - -The example assumes that the two devices are already connected. - -On device A, register the LE PSM: - -.. code-block:: console - - uart:~$ l2cap register 29 - L2CAP psm 41 sec_level 1 registered - -On device B, connect to the registered LE PSM and send data: - -.. code-block:: console - - uart:~$ l2cap connect 29 - Chan sec: 1 - L2CAP connection pending - Channel 0x20000210 connected - Channel 0x20000210 status 1 - uart:~$ l2cap send 3 14 - Rem 2 - Rem 1 - Rem 0 - Outgoing data channel 0x20000210 transmitted - Outgoing data channel 0x20000210 transmitted - Outgoing data channel 0x20000210 transmitted - -On device A, you should have received the data: - -.. code-block:: console - - Incoming conn 0x20002398 - Channel 0x20000210 status 1 - Channel 0x20000210 connected - Channel 0x20000210 requires buffer - Incoming data channel 0x20000210 len 14 - 00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ...... | - Channel 0x20000210 requires buffer - Incoming data channel 0x20000210 len 14 - 00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ...... | - Channel 0x20000210 requires buffer - Incoming data channel 0x20000210 len 14 - 00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ...... | - -A2DP -***** -The :code:`a2dp` command exposes parts of the A2DP API. - -The following examples assume that you have two devices already connected. - -Here is a example connecting two devices: - * Source and Sink sides register a2dp callbacks. using :code:`a2dp register_cb`. - * Source and Sink sides register stream endpoints. using :code:`a2dp register_ep source sbc` and :code:`a2dp register_ep sink sbc`. - * Source establish A2dp connection. It will create the AVDTP Signaling and Media L2CAP channels. using :code:`a2dp connect`. - * Source and Sink side can discover remote device's stream endpoints. using :code:`a2dp discover_peer_eps` - * Source or Sink configure the stream to create the stream after discover remote's endpoints. using :code:`a2dp configure`. - * Source or Sink establish the stream. using :code:`a2dp establish`. - * Source or Sink start the media. using :code:`a2dp start`. - * Source test the media sending. using :code:`a2dp send_media` to send one test packet data. - -.. tabs:: - - .. group-tab:: Device A (Audio Source Side) - - .. code-block:: console - - uart:~$ a2dp register_cb - success - uart:~$ a2dp register_ep source sbc - SBC source endpoint is registered - uart:~$ a2dp connect - Bonded with XX:XX:XX:XX:XX:XX - Security changed: XX:XX:XX:XX:XX:XX level 2 - a2dp connected - uart:~$ a2dp discover_peer_eps - endpoint id: 1, (sink), (idle): - codec type: SBC - sample frequency: - 44100 - 48000 - channel mode: - Mono - Stereo - Joint-Stereo - Block Length: - 16 - Subbands: - 8 - Allocation Method: - Loudness - Bitpool Range: 18 - 35 - uart:~$ a2dp configure - success to configure - stream configured - uart:~$ a2dp establish - success to establish - stream established - uart:~$ a2dp start - success to start - stream started - uart:~$ a2dp send_media - frames num: 1, data length: 160 - data: 1, 2, 3, 4, 5, 6 ...... - - .. group-tab:: Device B (Audio Sink Side) - - .. code-block:: console - - uart:~$ a2dp register_cb - success - uart:~$ a2dp register_ep sink sbc - SBC sink endpoint is registered - - Connected: XX:XX:XX:XX:XX:XX - Bonded with XX:XX:XX:XX:XX:XX - Security changed: XX:XX:XX:XX:XX:XX level 2 - a2dp connected - - receive requesting config and accept - SBC configure success - sample rate 44100Hz - stream configured - - receive requesting establishment and accept - stream established - - receive requesting start and accept - stream started - - received, num of frames: 1, data length: 160 - data: 1, 2, 3, 4, 5, 6 ...... - ... - Logging ******* diff --git a/doc/connectivity/bluetooth/api/audio/shell/bap.rst b/doc/connectivity/bluetooth/shell/audio/bap.rst similarity index 100% rename from doc/connectivity/bluetooth/api/audio/shell/bap.rst rename to doc/connectivity/bluetooth/shell/audio/bap.rst diff --git a/doc/connectivity/bluetooth/api/audio/shell/bap_broadcast_assistant.rst b/doc/connectivity/bluetooth/shell/audio/bap_broadcast_assistant.rst similarity index 100% rename from doc/connectivity/bluetooth/api/audio/shell/bap_broadcast_assistant.rst rename to doc/connectivity/bluetooth/shell/audio/bap_broadcast_assistant.rst diff --git a/doc/connectivity/bluetooth/api/audio/shell/bap_scan_delegator.rst b/doc/connectivity/bluetooth/shell/audio/bap_scan_delegator.rst similarity index 100% rename from doc/connectivity/bluetooth/api/audio/shell/bap_scan_delegator.rst rename to doc/connectivity/bluetooth/shell/audio/bap_scan_delegator.rst diff --git a/doc/connectivity/bluetooth/api/audio/shell/cap.rst b/doc/connectivity/bluetooth/shell/audio/cap.rst similarity index 100% rename from doc/connectivity/bluetooth/api/audio/shell/cap.rst rename to doc/connectivity/bluetooth/shell/audio/cap.rst diff --git a/doc/connectivity/bluetooth/api/audio/shell/ccp.rst b/doc/connectivity/bluetooth/shell/audio/ccp.rst similarity index 100% rename from doc/connectivity/bluetooth/api/audio/shell/ccp.rst rename to doc/connectivity/bluetooth/shell/audio/ccp.rst diff --git a/doc/connectivity/bluetooth/api/audio/shell/csip.rst b/doc/connectivity/bluetooth/shell/audio/csip.rst similarity index 100% rename from doc/connectivity/bluetooth/api/audio/shell/csip.rst rename to doc/connectivity/bluetooth/shell/audio/csip.rst diff --git a/doc/connectivity/bluetooth/api/audio/shell/gmap.rst b/doc/connectivity/bluetooth/shell/audio/gmap.rst similarity index 100% rename from doc/connectivity/bluetooth/api/audio/shell/gmap.rst rename to doc/connectivity/bluetooth/shell/audio/gmap.rst diff --git a/doc/connectivity/bluetooth/api/audio/shell/mcp.rst b/doc/connectivity/bluetooth/shell/audio/mcp.rst similarity index 100% rename from doc/connectivity/bluetooth/api/audio/shell/mcp.rst rename to doc/connectivity/bluetooth/shell/audio/mcp.rst diff --git a/doc/connectivity/bluetooth/api/audio/shell/pbp.rst b/doc/connectivity/bluetooth/shell/audio/pbp.rst similarity index 100% rename from doc/connectivity/bluetooth/api/audio/shell/pbp.rst rename to doc/connectivity/bluetooth/shell/audio/pbp.rst diff --git a/doc/connectivity/bluetooth/api/audio/shell/tmap.rst b/doc/connectivity/bluetooth/shell/audio/tmap.rst similarity index 100% rename from doc/connectivity/bluetooth/api/audio/shell/tmap.rst rename to doc/connectivity/bluetooth/shell/audio/tmap.rst diff --git a/doc/connectivity/bluetooth/shell/classic/a2dp.rst b/doc/connectivity/bluetooth/shell/classic/a2dp.rst new file mode 100644 index 0000000000000..2895b41b23349 --- /dev/null +++ b/doc/connectivity/bluetooth/shell/classic/a2dp.rst @@ -0,0 +1,89 @@ +Bluetooth: A2DP Shell +##################### + +The :code:`a2dp` command exposes parts of the A2DP API. + +The following examples assume that you have two devices already connected. + +Here is a example connecting two devices: + * Source and Sink sides register a2dp callbacks. using :code:`a2dp register_cb`. + * Source and Sink sides register stream endpoints. using :code:`a2dp register_ep source sbc` and :code:`a2dp register_ep sink sbc`. + * Source establish A2dp connection. It will create the AVDTP Signaling and Media L2CAP channels. using :code:`a2dp connect`. + * Source and Sink side can discover remote device's stream endpoints. using :code:`a2dp discover_peer_eps` + * Source or Sink configure the stream to create the stream after discover remote's endpoints. using :code:`a2dp configure`. + * Source or Sink establish the stream. using :code:`a2dp establish`. + * Source or Sink start the media. using :code:`a2dp start`. + * Source test the media sending. using :code:`a2dp send_media` to send one test packet data. + +.. tabs:: + + .. group-tab:: Device A (Audio Source Side) + + .. code-block:: console + + uart:~$ a2dp register_cb + success + uart:~$ a2dp register_ep source sbc + SBC source endpoint is registered + uart:~$ a2dp connect + Bonded with XX:XX:XX:XX:XX:XX + Security changed: XX:XX:XX:XX:XX:XX level 2 + a2dp connected + uart:~$ a2dp discover_peer_eps + endpoint id: 1, (sink), (idle): + codec type: SBC + sample frequency: + 44100 + 48000 + channel mode: + Mono + Stereo + Joint-Stereo + Block Length: + 16 + Subbands: + 8 + Allocation Method: + Loudness + Bitpool Range: 18 - 35 + uart:~$ a2dp configure + success to configure + stream configured + uart:~$ a2dp establish + success to establish + stream established + uart:~$ a2dp start + success to start + stream started + uart:~$ a2dp send_media + frames num: 1, data length: 160 + data: 1, 2, 3, 4, 5, 6 ...... + + .. group-tab:: Device B (Audio Sink Side) + + .. code-block:: console + + uart:~$ a2dp register_cb + success + uart:~$ a2dp register_ep sink sbc + SBC sink endpoint is registered + + Connected: XX:XX:XX:XX:XX:XX + Bonded with XX:XX:XX:XX:XX:XX + Security changed: XX:XX:XX:XX:XX:XX level 2 + a2dp connected + + receive requesting config and accept + SBC configure success + sample rate 44100Hz + stream configured + + receive requesting establishment and accept + stream established + + receive requesting start and accept + stream started + + received, num of frames: 1, data length: 160 + data: 1, 2, 3, 4, 5, 6 ...... + ... diff --git a/doc/connectivity/bluetooth/shell/host/gap.rst b/doc/connectivity/bluetooth/shell/host/gap.rst new file mode 100644 index 0000000000000..3e2e2f477bf11 --- /dev/null +++ b/doc/connectivity/bluetooth/shell/host/gap.rst @@ -0,0 +1,333 @@ +Bluetooth: GAP Shell +#################### + +The GAP shell is the "main" shell of Bluetooth and handles connection management, scanning, +advertising, and more. + + +Identities +********** + +Identities are a Zephyr host concept, allowing a single physical device to behave like multiple +logical Bluetooth devices. + +The shell allows the creation of multiple identities, to a maximum that is set by the Kconfig symbol +:kconfig:option:`CONFIG_BT_ID_MAX`. To create a new identity, use :code:`bt id-create` command. You +can then use it by selecting it with its ID :code:`bt id-select `. Finally, you can list all the +available identities with :code:`id-show`. + +Scan for devices +**************** + +Start scanning by using the :code:`bt scan on` command. Depending on the environment you're in, you +may see a lot of lines printed on the shell. To stop the scan, run :code:`bt scan off`, the +scrolling should stop. + +Here is an example of what you can expect: + +.. code-block:: console + + uart:~$ bt scan on + Bluetooth active scan enabled + [DEVICE]: CB:01:1A:2D:6E:AE (random), AD evt type 0, RSSI -78 C:1 S:1 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 us), SID: 0xff + [DEVICE]: 20:C2:EE:59:85:5B (random), AD evt type 3, RSSI -62 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 us), SID: 0xff + [DEVICE]: E3:72:76:87:2F:E8 (random), AD evt type 3, RSSI -74 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 us), SID: 0xff + [DEVICE]: 1E:19:25:8A:CB:84 (random), AD evt type 3, RSSI -67 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 us), SID: 0xff + [DEVICE]: 26:42:F3:D5:A0:86 (random), AD evt type 3, RSSI -73 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 us), SID: 0xff + [DEVICE]: 0C:61:D1:B9:5D:9E (random), AD evt type 3, RSSI -87 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 us), SID: 0xff + [DEVICE]: 20:C2:EE:59:85:5B (random), AD evt type 3, RSSI -66 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 us), SID: 0xff + [DEVICE]: 25:3F:7A:EE:0F:55 (random), AD evt type 3, RSSI -83 C:0 S:0 D:0 SR:0 E:0 Prim: LE 1M, Secn: No packets, Interval: 0x0000 (0 us), SID: 0xff + uart:~$ bt scan off + Scan successfully stopped + +As you can see, this can lead to a high number of results. To reduce that number and easily find a +specific device, you can enable scan filters. There are four types of filters: by name, by RSSI, by +address and by periodic advertising interval. To apply a filter, use the :code:`bt scan-set-filter` +command followed by the type of filters. You can add multiple filters by using the commands again. + +For example, if you want to look only for devices with the name *test shell*: + +.. code-block:: console + + uart:~$ bt scan-filter-set name "test shell" + +Or if you want to look for devices at a very close range: + +.. code-block:: console + + uart:~$ bt scan-filter-set rssi -40 + RSSI cutoff set at -40 dB + +Finally, if you want to remove all filters: + +.. code-block:: console + + uart:~$ bt scan-filter-clear all + +You can use the command :code:`bt scan on` to create an *active* scanner, meaning that the scanner +will ask the advertisers for more information by sending a *scan request* packet. Alternatively, you +can create a *passive scanner* by using the :code:`bt scan passive` command, so the scanner will not +ask the advertiser for more information. + +Connecting to a device +********************** + +To connect to a device, you need to know its address and type of address and use the +:code:`bt connect` command with the address and the type as arguments. + +Here is an example: + +.. code-block:: console + + uart:~$ bt connect 52:84:F6:BD:CE:48 random + Connection pending + Connected: 52:84:F6:BD:CE:48 (random) + Remote LMP version 5.3 (0x0c) subversion 0xffff manufacturer 0x05f1 + LE Features: 0x000000000001412f + LE PHY updated: TX PHY LE 2M, RX PHY LE 2M + LE conn param req: int (0x0018, 0x0028) lat 0 to 42 + LE conn param updated: int 0x0028 lat 0 to 42 + +You can list the active connections of the shell using the :code:`bt connections` command. The shell +maximum number of connections is defined by :kconfig:option:`CONFIG_BT_MAX_CONN`. You can disconnect +from a connection with the +:code:`bt disconnect ` command. + +.. note:: + + If you were scanning just before, you can connect to the last scanned device by + simply running the :code:`bt connect` command. + + Alternatively, you can use the :code:`bt connect-name ` command to automatically + enable scanning with a name filter and connect to the first match. + +Advertising +*********** + +Begin advertising by using the :code:`bt advertise on` command. This will use the default parameters +and advertise a resolvable private address with the name of the device. You can choose to use the +identity address instead by running the :code:`bt advertise on identity` command. To stop +advertising use the :code:`bt advertise off` command. + +To enable more advanced features of advertising, you should create an advertiser using the +:code:`bt adv-create` command. Parameters for the advertiser can be passed either at the creation of +it or by using the :code:`bt adv-param` command. To begin advertising with this newly created +advertiser, use the :code:`bt adv-start` command, and then the :code:`bt adv-stop` command to stop +advertising. + +When using the custom advertisers, you can choose if it will be connectable or scannable. This leads +to four options: :code:`conn-scan`, :code:`conn-nscan`, :code:`nconn-scan` and :code:`nconn-nscan`. +Those parameters are mandatory when creating an advertiser or updating its parameters. + +For example, if you want to create a connectable and scannable advertiser and start it: + +.. code-block:: console + + uart:~$ bt adv-create conn-scan + Created adv id: 0, adv: 0x200022f0 + uart:~$ bt adv-start + Advertiser[0] 0x200022f0 set started + +You may notice that with this, the custom advertiser does not advertise the device name; you need to +add it. Continuing from the previous example: + +.. code-block:: console + + uart:~$ bt adv-stop + Advertiser set stopped + uart:~$ bt adv-data dev-name + uart:~$ bt adv-start + Advertiser[0] 0x200022f0 set started + +You should now see the name of the device in the advertising data. You can also set a custom name by +using :code:`name ` instead of :code:`dev-name`. It is also possible to set the +advertising data manually with the :code:`bt adv-data` command. The following example shows how +to set the advertiser name with it using raw advertising data: + +.. code-block:: console + + uart:~$ bt adv-create conn-scan + Created adv id: 0, adv: 0x20002348 + uart:~$ bt adv-data 1009426C7565746F6F74682D5368656C6C + uart:~$ bt adv-start + Advertiser[0] 0x20002348 set started + +The data must be formatted according to the Bluetooth Core Specification (see version 5.3, vol. 3, +part C, 11). In this example, the first octet is the size of the data (the data and one octet for +the data type), the second one is the type of data, ``0x09`` is the Complete Local Name and the +remaining data are the name in ASCII. So, on the other device you should see the name +*Bluetooth-Shell*. + +When advertising, if others devices use an *active* scanner, you may receive *scan request* packets. +To visualize those packets, you can add :code:`scan-reports` to the parameters of your advertiser. + +Directed Advertising +==================== + +It is possible to use directed advertising on the shell if you want to reconnect to a device. The +following example demonstrates how to create a directed advertiser with the address specified right +after the parameter :code:`directed`. The :code:`low` parameter indicates that we want to use the +low duty cycle mode, and the :code:`dir-rpa` parameter is required if the remote device is +privacy-enabled and supports address resolution of the target address in directed advertisement. + +.. code-block:: console + + uart:~$ bt adv-create conn-scan directed D7:54:03:CE:F3:B4 random low dir-rpa + Created adv id: 0, adv: 0x20002348 + +After that, you can start the advertiser and then the target device will be able to reconnect. + +Extended Advertising +==================== + +Let's now have a look at some extended advertising features. To enable extended advertising, use the +``ext-adv`` parameter. + +.. code-block:: console + + uart:~$ bt adv-create conn-nscan ext-adv name-ad + Created adv id: 0, adv: 0x200022f0 + uart:~$ bt adv-start + Advertiser[0] 0x200022f0 set started + +This will create an extended advertiser, that is connectable and non-scannable. + +Encrypted Advertising Data +========================== + +Zephyr has support for the Encrypted Advertising Data feature. The :code:`bt encrypted-ad` +sub-commands allow managing the advertising data of a given advertiser. + +To encrypt the advertising data, key materials need to be provided, that can be done with :code:`bt +encrypted-ad set-keys `. The session key is 16 bytes long and the +initialisation vector is 8 bytes long. + +You can add advertising data by using :code:`bt encrypted-ad add-ad` and :code:`bt encrypted-ad +add-ead`. The former will take add one advertising data structure (as defined in the Core +Specification), when the later will read the given data, encrypt them and then add the generated +encrypted advertising data structure. It's possible to mix encrypted and non-encrypted data, when +done adding advertising data, :code:`bt encrypted-ad commit-ad` can be used to apply the change to +the data to the selected advertiser. After that the advertiser can be started as described +previously. It's possible to clear the advertising data by using :code:`bt encrypted-ad clear-ad`. + +On the Central side, it's possible to decrypt the received encrypted advertising data by setting the +correct keys material as described earlier and then enabling the decrypting of the data with +:code:`bt encrypted-ad decrypt-scan on`. + +.. note:: + + To see the advertising data in the scan report :code:`bt scan-verbose-output` need to be + enabled. + +.. note:: + + It's possible to increase the length of the advertising data by increasing the value of + :kconfig:option:`CONFIG_BT_CTLR_ADV_DATA_LEN_MAX` and + :kconfig:option:`CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX`. + +Here is a simple example demonstrating the usage of EAD: + +.. tabs:: + + .. group-tab:: Peripheral + + .. code-block:: console + + uart:~$ bt init + ... + uart:~$ bt adv-create conn-nscan ext-adv + Created adv id: 0, adv: 0x81769a0 + uart:~$ bt encrypted-ad set-keys 9ba22d3824efc70feb800c80294cba38 2e83f3d4d47695b6 + session key set to: + 00000000: 9b a2 2d 38 24 ef c7 0f eb 80 0c 80 29 4c ba 38 |..-8$... ....)L.8| + initialisation vector set to: + 00000000: 2e 83 f3 d4 d4 76 95 b6 |.....v.. | + uart:~$ bt encrypted-ad add-ad 06097368656C6C + uart:~$ bt encrypted-ad add-ead 03ffdead03ffbeef + uart:~$ bt encrypted-ad commit-ad + Advertising data for Advertiser[0] 0x81769a0 updated. + uart:~$ bt adv-start + Advertiser[0] 0x81769a0 set started + + .. group-tab:: Central + + .. code-block:: console + + uart:~$ bt init + ... + uart:~$ bt scan-verbose-output on + uart:~$ bt encrypted-ad set-keys 9ba22d3824efc70feb800c80294cba38 2e83f3d4d47695b6 + session key set to: + 00000000: 9b a2 2d 38 24 ef c7 0f eb 80 0c 80 29 4c ba 38 |..-8$... ....)L.8| + initialisation vector set to: + 00000000: 2e 83 f3 d4 d4 76 95 b6 |.....v.. | + uart:~$ bt encrypted-ad decrypt-scan on + Received encrypted advertising data will now be decrypted using provided key materials. + uart:~$ bt scan on + Bluetooth active scan enabled + [DEVICE]: 68:49:30:68:49:30 (random), AD evt type 5, RSSI -59 shell C:1 S:0 D:0 SR:0 E:1 Prim: LE 1M, Secn: LE 2M, Interval: 0x0000 (0 us), SID: 0x0 + [SCAN DATA START - EXT_ADV] + Type 0x09: shell + Type 0x31: Encrypted Advertising Data: 0xe2, 0x17, 0xed, 0x04, 0xe7, 0x02, 0x1d, 0xc9, 0x40, 0x07, uart:~0x18, 0x90, 0x6c, 0x4b, 0xfe, 0x34, 0xad + [START DECRYPTED DATA] + Type 0xff: 0xde, 0xad + Type 0xff: 0xbe, 0xef + [END DECRYPTED DATA] + [SCAN DATA END] + ... + +Filter Accept List +****************** + +It's possible to create a list of allowed addresses that can be used to +connect to those addresses automatically. Here is how to do it: + +.. code-block:: console + + uart:~$ bt fal-add 47:38:76:EA:29:36 random + uart:~$ bt fal-add 66:C8:80:2A:05:73 random + uart:~$ bt fal-connect on + +The shell will then connect to the first available device. In the example, if both devices are +advertising at the same time, we will connect to the first address added to the list. + +The Filter Accept List can also be used for scanning or advertising by using the option :code:`fal`. +For example, if we want to scan for a bunch of selected addresses, we can set up a Filter Accept +List: + +.. code-block:: console + + uart:~$ bt fal-add 65:4B:9E:83:AF:73 random + uart:~$ bt fal-add 73:72:82:B4:8F:B9 random + uart:~$ bt fal-add 5D:85:50:1C:72:64 random + uart:~$ bt scan on fal + +You should see only those three addresses reported by the scanner. + +Enabling security +***************** + +When connected to a device, you can enable multiple levels of security, here is the list for +Bluetooth LE: + +* **1** No encryption and no authentication; +* **2** Encryption and no authentication; +* **3** Encryption and authentication; +* **4** Bluetooth LE Secure Connection. + +To enable security, use the :code:`bt security ` command. For levels requiring authentication +(level 3 and above), you must first set the authentication method. To do it, you can use the +:code:`bt auth all` command. After that, when you will set the security level, you will be asked to +confirm the passkey on both devices. On the shell side, do it with the command +:code:`bt auth-passkey-confirm`. + +Pairing +======= + +Enabling authentication requires the devices to be bondable. By default the shell is bondable. You +can make the shell not bondable using :code:`bt bondable off`. You can list all the devices you are +paired with using the command :code:`bt bonds`. + +The maximum number of paired devices is set using :kconfig:option:`CONFIG_BT_MAX_PAIRED`. You can +remove a paired device using :code:`bt clear ` +or remove all paired devices with the command :code:`bt clear all`. diff --git a/doc/connectivity/bluetooth/shell/host/gatt.rst b/doc/connectivity/bluetooth/shell/host/gatt.rst new file mode 100644 index 0000000000000..9e90eea0f8928 --- /dev/null +++ b/doc/connectivity/bluetooth/shell/host/gatt.rst @@ -0,0 +1,26 @@ +Bluetooth: GATT Shell +##################### + +The following examples assume that you have two devices already connected. + +To perform service discovery on the client side, use the :code:`gatt discover` command. This should +print all the services that are available on the GATT server. + +On the server side, you can register pre-defined test services using the :code:`gatt register` +command. When done, you should see the newly added services on the client side when running the +discovery command. + +You can now subscribe to those new services on the client side. Here is an example on how to +subscribe to the test service: + +.. code-block:: console + + uart:~$ gatt subscribe 26 25 + Subscribed + +The server can now notify the client with the command :code:`gatt notify`. + +Another option available through the GATT command is initiating the MTU exchange. To do it, use the +:code:`gatt exchange-mtu` command. To update the shell maximum MTU, you need to update Kconfig +symbols in the configuration file of the shell. For more details, see +:zephyr:code-sample:`bluetooth_mtu_update`. diff --git a/doc/connectivity/bluetooth/api/shell/iso.rst b/doc/connectivity/bluetooth/shell/host/iso.rst similarity index 94% rename from doc/connectivity/bluetooth/api/shell/iso.rst rename to doc/connectivity/bluetooth/shell/host/iso.rst index 4919e740ea032..f79b1374123ce 100644 --- a/doc/connectivity/bluetooth/api/shell/iso.rst +++ b/doc/connectivity/bluetooth/shell/host/iso.rst @@ -1,5 +1,5 @@ -Bluetooth: Isochronous Channels -################################ +Bluetooth: Isochronous Channels Shell +##################################### Commands ******** diff --git a/doc/connectivity/bluetooth/shell/host/l2cap.rst b/doc/connectivity/bluetooth/shell/host/l2cap.rst new file mode 100644 index 0000000000000..70e174f04d7b5 --- /dev/null +++ b/doc/connectivity/bluetooth/shell/host/l2cap.rst @@ -0,0 +1,48 @@ +Bluetooth: L2CAP Shell +###################### + +The :code:`l2cap` command exposes parts of the L2CAP API. The following example shows how to +register a LE PSM, connect to it from another device and send 3 packets of 14 octets each. + +The example assumes that the two devices are already connected. + +On device A, register the LE PSM: + +.. code-block:: console + + uart:~$ l2cap register 29 + L2CAP psm 41 sec_level 1 registered + +On device B, connect to the registered LE PSM and send data: + +.. code-block:: console + + uart:~$ l2cap connect 29 + Chan sec: 1 + L2CAP connection pending + Channel 0x20000210 connected + Channel 0x20000210 status 1 + uart:~$ l2cap send 3 14 + Rem 2 + Rem 1 + Rem 0 + Outgoing data channel 0x20000210 transmitted + Outgoing data channel 0x20000210 transmitted + Outgoing data channel 0x20000210 transmitted + +On device A, you should have received the data: + +.. code-block:: console + + Incoming conn 0x20002398 + Channel 0x20000210 status 1 + Channel 0x20000210 connected + Channel 0x20000210 requires buffer + Incoming data channel 0x20000210 len 14 + 00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ...... | + Channel 0x20000210 requires buffer + Incoming data channel 0x20000210 len 14 + 00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ...... | + Channel 0x20000210 requires buffer + Incoming data channel 0x20000210 len 14 + 00000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ...... | From 07b7802460957e93129be75fa3afcd43c87126e9 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Tue, 19 Nov 2024 15:36:35 +0100 Subject: [PATCH 2971/4482] doc: Bluetooth: Audio: Shell: Make shell docs a bit more consistent Make the headers of the audio shell documentation files consistent. Signed-off-by: Emil Gydesen --- doc/connectivity/bluetooth/shell/audio/bap.rst | 4 ++-- .../bluetooth/shell/audio/bap_broadcast_assistant.rst | 4 ++-- doc/connectivity/bluetooth/shell/audio/bap_scan_delegator.rst | 4 ++-- doc/connectivity/bluetooth/shell/audio/ccp.rst | 4 ++-- doc/connectivity/bluetooth/shell/audio/csip.rst | 4 ++-- doc/connectivity/bluetooth/shell/audio/mcp.rst | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/connectivity/bluetooth/shell/audio/bap.rst b/doc/connectivity/bluetooth/shell/audio/bap.rst index ce60e3d07629b..f4cc48e08817a 100644 --- a/doc/connectivity/bluetooth/shell/audio/bap.rst +++ b/doc/connectivity/bluetooth/shell/audio/bap.rst @@ -1,7 +1,7 @@ .. _bluetooth_shell_audio: -Bluetooth: Basic Audio Profile -############################## +Bluetooth: Basic Audio Profile Shell +#################################### This document describes how to run Basic Audio Profile functionality which includes: diff --git a/doc/connectivity/bluetooth/shell/audio/bap_broadcast_assistant.rst b/doc/connectivity/bluetooth/shell/audio/bap_broadcast_assistant.rst index 2fdd25192c112..197cbe868889a 100644 --- a/doc/connectivity/bluetooth/shell/audio/bap_broadcast_assistant.rst +++ b/doc/connectivity/bluetooth/shell/audio/bap_broadcast_assistant.rst @@ -1,5 +1,5 @@ -Bluetooth: Broadcast Audio Profile Broadcast Assistant -###################################################### +Bluetooth: Basic Audio Profile: Broadcast Assistant Shell +######################################################### This document describes how to run the BAP Broadcast Assistant functionality. Note that in the examples below, some lines of debug have been diff --git a/doc/connectivity/bluetooth/shell/audio/bap_scan_delegator.rst b/doc/connectivity/bluetooth/shell/audio/bap_scan_delegator.rst index 8327160cbcf66..70861c3c4d345 100644 --- a/doc/connectivity/bluetooth/shell/audio/bap_scan_delegator.rst +++ b/doc/connectivity/bluetooth/shell/audio/bap_scan_delegator.rst @@ -1,5 +1,5 @@ -Bluetooth: Broadcast Audio Profile Scan Delegator -################################################# +Bluetooth: Basic Audio Profile: Scan Delegator Shell +#################################################### This document describes how to run the Scan Delegator functionality, Note that in the examples below, some lines of debug have been diff --git a/doc/connectivity/bluetooth/shell/audio/ccp.rst b/doc/connectivity/bluetooth/shell/audio/ccp.rst index b03a46aeeba2d..9d5c17c4e7c9c 100644 --- a/doc/connectivity/bluetooth/shell/audio/ccp.rst +++ b/doc/connectivity/bluetooth/shell/audio/ccp.rst @@ -1,5 +1,5 @@ -Bluetooth: Call Control Profile -############################### +Bluetooth: Call Control Profile Shell +##################################### This document describes how to run the call control functionality, both as a client and as a (telephone bearer service (TBS)) server. Note that in the diff --git a/doc/connectivity/bluetooth/shell/audio/csip.rst b/doc/connectivity/bluetooth/shell/audio/csip.rst index 84a11d75081bf..25e725fa8385d 100644 --- a/doc/connectivity/bluetooth/shell/audio/csip.rst +++ b/doc/connectivity/bluetooth/shell/audio/csip.rst @@ -1,5 +1,5 @@ -Bluetooth: Coordinated Set Identification Profile -################################################# +Bluetooth: Coordinated Set Identification Profile Shell +####################################################### This document describes how to run the coordinated set identification functionality, both as a client and as a server. diff --git a/doc/connectivity/bluetooth/shell/audio/mcp.rst b/doc/connectivity/bluetooth/shell/audio/mcp.rst index e0930852e10c2..51a47d4ea6c88 100644 --- a/doc/connectivity/bluetooth/shell/audio/mcp.rst +++ b/doc/connectivity/bluetooth/shell/audio/mcp.rst @@ -1,5 +1,5 @@ -Media control for Generic Audio Content Control -############################################### +Bluetooth: Media Control Profile Shell +###################################### This document describes how to run the media control functionality, using the shell, both as a client and as a server. From 53ae195f0d3684f53595a52fa8af478d4e480b87 Mon Sep 17 00:00:00 2001 From: Benedikt Schmidt Date: Tue, 19 Nov 2024 08:44:35 +0100 Subject: [PATCH 2972/4482] drivers: fpga: replace runtime checks with buildtime asserts in iCE40 Replace NULL checks for the set and clear registers with BUILD_ASSERTs in the iCE40 device instantiation. Signed-off-by: Benedikt Schmidt --- drivers/fpga/fpga_ice40.c | 22 ++++++++++++---------- tests/drivers/build_all/fpga/spi.dtsi | 8 ++++---- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/fpga/fpga_ice40.c b/drivers/fpga/fpga_ice40.c index 3f461ffebf2a1..6ffc67ec2f92f 100644 --- a/drivers/fpga/fpga_ice40.c +++ b/drivers/fpga/fpga_ice40.c @@ -210,16 +210,6 @@ static int fpga_ice40_load_gpio(const struct device *dev, uint32_t *image_ptr, u return -ENODEV; } - if (config->set == NULL) { - LOG_ERR("%s: set register was not specified", dev->name); - return -EFAULT; - } - - if (config->clear == NULL) { - LOG_ERR("%s: clear register was not specified", dev->name); - return -EFAULT; - } - /* prepare masks */ cs = BIT(config->bus.config.cs.gpio.pin); clk = BIT(config->clk.pin); @@ -589,6 +579,18 @@ static int fpga_ice40_init(const struct device *dev) BUILD_ASSERT(FPGA_ICE40_TRAILING_CLOCKS(inst) >= FPGA_ICE40_TRAILING_CLOCKS_MIN); \ BUILD_ASSERT(FPGA_ICE40_TRAILING_CLOCKS(inst) <= UINT8_MAX); \ BUILD_ASSERT(FPGA_ICE40_MHZ_DELAY_COUNT(inst) >= 0); \ + BUILD_ASSERT(!DT_INST_PROP(inst, load_mode_bitbang) || \ + DT_INST_NODE_HAS_PROP(inst, creset_gpios)); \ + BUILD_ASSERT(!DT_INST_PROP(inst, load_mode_bitbang) || \ + DT_INST_NODE_HAS_PROP(inst, cdone_gpios)); \ + BUILD_ASSERT(!DT_INST_PROP(inst, load_mode_bitbang) || \ + DT_INST_NODE_HAS_PROP(inst, clk_gpios)); \ + BUILD_ASSERT(!DT_INST_PROP(inst, load_mode_bitbang) || \ + DT_INST_NODE_HAS_PROP(inst, pico_gpios)); \ + BUILD_ASSERT(!DT_INST_PROP(inst, load_mode_bitbang) || \ + DT_INST_NODE_HAS_PROP(inst, gpios_set_reg)); \ + BUILD_ASSERT(!DT_INST_PROP(inst, load_mode_bitbang) || \ + DT_INST_NODE_HAS_PROP(inst, gpios_clear_reg)); \ \ FPGA_ICE40_PINCTRL_DEFINE(inst); \ static struct fpga_ice40_data fpga_ice40_data_##inst; \ diff --git a/tests/drivers/build_all/fpga/spi.dtsi b/tests/drivers/build_all/fpga/spi.dtsi index 008b51b01a8a7..c1d5c27965404 100644 --- a/tests/drivers/build_all/fpga/spi.dtsi +++ b/tests/drivers/build_all/fpga/spi.dtsi @@ -16,6 +16,10 @@ test_spi_fpga_ice40_gpio: ice40@0 { load-mode-bitbang; cdone-gpios = <&test_gpio 0 0>; creset-gpios = <&test_gpio 0 0>; + clk-gpios = <&test_gpio 0 0>; + pico-gpios = <&test_gpio 0 0>; + gpios-set-reg = <0>; + gpios-clear-reg = <0>; config-delay-us = <3900>; }; @@ -28,9 +32,5 @@ test_spi_fpga_ice40_spi: ice40@1 { cdone-gpios = <&test_gpio 0 0>; creset-gpios = <&test_gpio 0 0>; - clk-gpios = <&test_gpio 0 0>; - pico-gpios = <&test_gpio 0 0>; - gpios-set-reg = <0>; - gpios-clear-reg = <0>; config-delay-us = <3900>; }; From 41e33573e84b90011d6f0f460f7d5885154c6890 Mon Sep 17 00:00:00 2001 From: Hongquan Li Date: Mon, 28 Oct 2024 16:44:43 +0800 Subject: [PATCH 2973/4482] drivers: wifi: esp_at: Fix serial receive interrupt can't exit If a character is received immediately after modem_iface_uart_init called, the modem_iface_uart_isr function will not read the data in the serial port fifo register as the context has not been registered at this time, which will result in the program not being able to exit the interrupt, so the context should registered before the serial port is initialised. Signed-off-by: Hongquan Li --- drivers/wifi/esp_at/esp.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/wifi/esp_at/esp.c b/drivers/wifi/esp_at/esp.c index 203991900a25e..0dfe0bfb9d439 100644 --- a/drivers/wifi/esp_at/esp.c +++ b/drivers/wifi/esp_at/esp.c @@ -1606,6 +1606,14 @@ static int esp_init(const struct device *dev) .hw_flow_control = DT_PROP(ESP_BUS, hw_flow_control), }; + /* The context must be registered before the serial port is initialised. */ + data->mctx.driver_data = data; + ret = modem_context_register(&data->mctx); + if (ret < 0) { + LOG_ERR("Error registering modem context: %d", ret); + goto error; + } + ret = modem_iface_uart_init(&data->mctx.iface, &data->iface_data, &uart_config); if (ret < 0) { goto error; @@ -1627,14 +1635,6 @@ static int esp_init(const struct device *dev) } #endif - data->mctx.driver_data = data; - - ret = modem_context_register(&data->mctx); - if (ret < 0) { - LOG_ERR("Error registering modem context: %d", ret); - goto error; - } - /* start RX thread */ k_thread_create(&esp_rx_thread, esp_rx_stack, K_KERNEL_STACK_SIZEOF(esp_rx_stack), From 760bba6d24e272af09cacc0b5f4e1792d78e7e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 12 Nov 2024 12:37:18 +0100 Subject: [PATCH 2974/4482] drivers: serial: nrfx_uarte: Fix pin retention MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit b6d45423c60b Added support for pin retention but it was added only to the case when device PM is used. There is another mode in which UARTE is disabled when idle (low power mode) and in that case pin retention must also be added. Signed-off-by: Krzysztof Chruściński --- drivers/serial/uart_nrfx_uarte.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 452307acaa833..6acb6e44fbd88 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -590,6 +590,9 @@ static void uarte_periph_enable(const struct device *dev) (void)data; nrf_uarte_enable(uarte); +#ifdef CONFIG_SOC_NRF54H20_GPD + nrf_gpd_retain_pins_set(config->pcfg, false); +#endif #if UARTE_BAUDRATE_RETENTION_WORKAROUND nrf_uarte_baudrate_set(uarte, COND_CODE_1(CONFIG_UART_USE_RUNTIME_CONFIGURE, @@ -702,6 +705,11 @@ static void uarte_disable_locked(const struct device *dev, uint32_t dis_mask) } #endif +#ifdef CONFIG_SOC_NRF54H20_GPD + const struct uarte_nrfx_config *cfg = dev->config; + + nrf_gpd_retain_pins_set(cfg->pcfg, true); +#endif nrf_uarte_disable(get_uarte_instance(dev)); } @@ -2103,9 +2111,6 @@ static void uarte_pm_resume(const struct device *dev) if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || !LOW_POWER_ENABLED(cfg)) { uarte_periph_enable(dev); -#ifdef CONFIG_SOC_NRF54H20_GPD - nrf_gpd_retain_pins_set(cfg->pcfg, false); -#endif } } From bc007fd53bd564ac893a0c759943595e258bdc61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Thu, 18 Jul 2024 14:37:44 +0200 Subject: [PATCH 2975/4482] tests: drivers: uart: async_api: Add missing static keyword MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Multiple variable in the test were missing static keyword. Signed-off-by: Krzysztof Chruściński --- .../uart/uart_async_api/src/test_uart_async.c | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/tests/drivers/uart/uart_async_api/src/test_uart_async.c b/tests/drivers/uart/uart_async_api/src/test_uart_async.c index 0506ff0a01ff6..3f56bbe1d809e 100644 --- a/tests/drivers/uart/uart_async_api/src/test_uart_async.c +++ b/tests/drivers/uart/uart_async_api/src/test_uart_async.c @@ -24,12 +24,12 @@ K_SEM_DEFINE(rx_buf_coherency, 0, 255); K_SEM_DEFINE(rx_buf_released, 0, 1); K_SEM_DEFINE(rx_disabled, 0, 1); -ZTEST_BMEM volatile bool failed_in_isr; +static ZTEST_BMEM volatile bool failed_in_isr; static ZTEST_BMEM const struct device *const uart_dev = DEVICE_DT_GET(UART_NODE); static void read_abort_timeout(struct k_timer *timer); -K_TIMER_DEFINE(read_abort_timer, read_abort_timeout, NULL); +static K_TIMER_DEFINE(read_abort_timer, read_abort_timeout, NULL); static void init_test(void) @@ -100,7 +100,7 @@ struct test_data { #if NOCACHE_MEM static struct test_data tdata __used __NOCACHE; #else -ZTEST_BMEM struct test_data tdata; +static ZTEST_BMEM struct test_data tdata; #endif /* NOCACHE_MEM */ static void test_single_read_callback(const struct device *dev, @@ -331,14 +331,14 @@ static __aligned(32) uint8_t chained_read_buf_0[8] __used __NOCACHE; static __aligned(32) uint8_t chained_read_buf_1[8] __used __NOCACHE; static __aligned(32) uint8_t chained_cpy_buf[10] __used __NOCACHE; #else -ZTEST_BMEM uint8_t chained_read_buf_0[8]; -ZTEST_BMEM uint8_t chained_read_buf_1[8]; -ZTEST_BMEM uint8_t chained_cpy_buf[10]; +static ZTEST_BMEM uint8_t chained_read_buf_0[8]; +static ZTEST_BMEM uint8_t chained_read_buf_1[8]; +static ZTEST_BMEM uint8_t chained_cpy_buf[10]; #endif /* NOCACHE_MEM */ -ZTEST_BMEM volatile uint8_t rx_data_idx; -ZTEST_BMEM uint8_t rx_buf_idx; +static ZTEST_BMEM volatile uint8_t rx_data_idx; +static ZTEST_BMEM uint8_t rx_buf_idx; -ZTEST_BMEM uint8_t *read_ptr; +static ZTEST_BMEM uint8_t *read_ptr; static uint8_t *chained_read_buf[2] = {chained_read_buf_0, chained_read_buf_1}; @@ -422,9 +422,9 @@ ZTEST_USER(uart_async_chain_read, test_chained_read) #if NOCACHE_MEM static __aligned(32) uint8_t double_buffer[2][12] __used __NOCACHE; #else -ZTEST_BMEM uint8_t double_buffer[2][12]; +static ZTEST_BMEM uint8_t double_buffer[2][12]; #endif /* NOCACHE_MEM */ -ZTEST_DMEM uint8_t *next_buf = double_buffer[1]; +static ZTEST_DMEM uint8_t *next_buf = double_buffer[1]; static void test_double_buffer_callback(const struct device *dev, struct uart_event *evt, void *user_data) @@ -497,10 +497,10 @@ ZTEST_USER(uart_async_double_buf, test_double_buffer) static __aligned(32) uint8_t test_read_abort_rx_buf[2][100] __used __NOCACHE; static __aligned(32) uint8_t test_read_abort_read_buf[100] __used __NOCACHE; #else -ZTEST_BMEM uint8_t test_read_abort_rx_buf[2][100]; -ZTEST_BMEM uint8_t test_read_abort_read_buf[100]; +static ZTEST_BMEM uint8_t test_read_abort_rx_buf[2][100]; +static ZTEST_BMEM uint8_t test_read_abort_read_buf[100]; #endif /* NOCACHE_MEM */ -ZTEST_BMEM int test_read_abort_rx_cnt; +static ZTEST_BMEM int test_read_abort_rx_cnt; static void test_read_abort_callback(const struct device *dev, struct uart_event *evt, void *user_data) @@ -613,12 +613,12 @@ ZTEST_USER(uart_async_read_abort, test_read_abort) } -ZTEST_BMEM volatile size_t sent; -ZTEST_BMEM volatile size_t received; +static ZTEST_BMEM volatile size_t sent; +static ZTEST_BMEM volatile size_t received; #if NOCACHE_MEM static __aligned(32) uint8_t test_rx_buf[2][100] __used __NOCACHE; #else -ZTEST_BMEM uint8_t test_rx_buf[2][100]; +static ZTEST_BMEM uint8_t test_rx_buf[2][100]; #endif /* NOCACHE_MEM */ static void test_write_abort_callback(const struct device *dev, @@ -776,12 +776,12 @@ ZTEST_USER(uart_async_timeout, test_forever_timeout) #if NOCACHE_MEM -const uint8_t chained_write_tx_bufs[2][10] = {"Message 1", "Message 2"}; +static const uint8_t chained_write_tx_bufs[2][10] = {"Message 1", "Message 2"}; #else -ZTEST_DMEM uint8_t chained_write_tx_bufs[2][10] = {"Message 1", "Message 2"}; +static ZTEST_DMEM uint8_t chained_write_tx_bufs[2][10] = {"Message 1", "Message 2"}; #endif /* NOCACHE_MEM */ -ZTEST_DMEM bool chained_write_next_buf = true; -ZTEST_BMEM volatile uint8_t tx_sent; +static ZTEST_DMEM bool chained_write_next_buf = true; +static ZTEST_BMEM volatile uint8_t tx_sent; static void test_chained_write_callback(const struct device *dev, struct uart_event *evt, void *user_data) @@ -863,12 +863,12 @@ static __aligned(32) uint8_t long_rx_buf[RX_LONG_BUFFER] __used __NOCACHE; static __aligned(32) uint8_t long_rx_buf2[RX_LONG_BUFFER] __used __NOCACHE; static __aligned(32) uint8_t long_tx_buf[TX_LONG_BUFFER] __used __NOCACHE; #else -ZTEST_BMEM uint8_t long_rx_buf[RX_LONG_BUFFER]; -ZTEST_BMEM uint8_t long_rx_buf2[RX_LONG_BUFFER]; -ZTEST_BMEM uint8_t long_tx_buf[TX_LONG_BUFFER]; +static ZTEST_BMEM uint8_t long_rx_buf[RX_LONG_BUFFER]; +static ZTEST_BMEM uint8_t long_rx_buf2[RX_LONG_BUFFER]; +static ZTEST_BMEM uint8_t long_tx_buf[TX_LONG_BUFFER]; #endif /* NOCACHE_MEM */ -ZTEST_BMEM volatile uint8_t evt_num; -ZTEST_BMEM size_t long_received[2]; +static ZTEST_BMEM volatile uint8_t evt_num; +static ZTEST_BMEM size_t long_received[2]; static void test_long_buffers_callback(const struct device *dev, struct uart_event *evt, void *user_data) From d2b69a4ec7184a08f8821e1c68eb456fc2a0927f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Thu, 18 Jul 2024 14:28:51 +0200 Subject: [PATCH 2976/4482] tests: drivers: uart: async_api: Rework for multi instance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rework the test to be able to run on multiple instances. Signed-off-by: Krzysztof Chruściński --- .../uart/uart_async_api/src/test_uart_async.c | 106 ++++++++++++------ 1 file changed, 73 insertions(+), 33 deletions(-) diff --git a/tests/drivers/uart/uart_async_api/src/test_uart_async.c b/tests/drivers/uart/uart_async_api/src/test_uart_async.c index 3f56bbe1d809e..139de516fd8b5 100644 --- a/tests/drivers/uart/uart_async_api/src/test_uart_async.c +++ b/tests/drivers/uart/uart_async_api/src/test_uart_async.c @@ -25,39 +25,49 @@ K_SEM_DEFINE(rx_buf_released, 0, 1); K_SEM_DEFINE(rx_disabled, 0, 1); static ZTEST_BMEM volatile bool failed_in_isr; -static ZTEST_BMEM const struct device *const uart_dev = - DEVICE_DT_GET(UART_NODE); + +struct dut_data { + const struct device *dev; + const char *name; +}; + +static ZTEST_DMEM struct dut_data duts[] = { + { + .dev = DEVICE_DT_GET(UART_NODE), + .name = DT_NODE_FULL_NAME(UART_NODE), + }, + /* More instances can be added here. */ +}; + +static ZTEST_BMEM const struct device *uart_dev; +static ZTEST_BMEM const char *uart_name; static void read_abort_timeout(struct k_timer *timer); static K_TIMER_DEFINE(read_abort_timer, read_abort_timeout, NULL); -static void init_test(void) -{ - __ASSERT_NO_MSG(device_is_ready(uart_dev)); - uart_rx_disable(uart_dev); - uart_tx_abort(uart_dev); - k_sem_reset(&tx_done); - k_sem_reset(&tx_aborted); - k_sem_reset(&rx_rdy); - k_sem_reset(&rx_buf_released); - k_sem_reset(&rx_disabled); -} - #ifdef CONFIG_USERSPACE static void set_permissions(void) { k_thread_access_grant(k_current_get(), &tx_done, &tx_aborted, &rx_rdy, &rx_buf_coherency, &rx_buf_released, &rx_disabled, uart_dev, &read_abort_timer); + + for (size_t i = 0; i < ARRAY_SIZE(duts); i++) { + k_thread_access_grant(k_current_get(), duts[i].dev); + } } #endif -static void uart_async_test_init(void) +static void uart_async_test_init(int idx) { static bool initialized; + uart_dev = duts[idx].dev; + uart_name = duts[idx].name; + __ASSERT_NO_MSG(device_is_ready(uart_dev)); + TC_PRINT("UART instance:%s\n", uart_name); uart_rx_disable(uart_dev); uart_tx_abort(uart_dev); k_sem_reset(&tx_done); @@ -79,7 +89,6 @@ static void uart_async_test_init(void) #endif if (!initialized) { - init_test(); initialized = true; #ifdef CONFIG_USERSPACE set_permissions(); @@ -143,11 +152,13 @@ static void test_single_read_callback(const struct device *dev, } } -ZTEST_BMEM volatile uint32_t tx_aborted_count; +static ZTEST_BMEM volatile uint32_t tx_aborted_count; static void *single_read_setup(void) { - uart_async_test_init(); + static int idx; + + uart_async_test_init(idx++); memset(&tdata, 0, sizeof(tdata)); tdata.supply_second_buffer = true; @@ -228,7 +239,9 @@ ZTEST_USER(uart_async_single_read, test_single_read) static void *multiple_rx_enable_setup(void) { - uart_async_test_init(); + static int idx; + + uart_async_test_init(idx++); memset(&tdata, 0, sizeof(tdata)); /* Reuse the callback from the single_read test case, as this test case @@ -375,7 +388,9 @@ static void test_chained_read_callback(const struct device *dev, static void *chained_read_setup(void) { - uart_async_test_init(); + static int idx; + + uart_async_test_init(idx++); uart_callback_set(uart_dev, test_chained_read_callback, NULL); @@ -455,7 +470,9 @@ static void test_double_buffer_callback(const struct device *dev, static void *double_buffer_setup(void) { - uart_async_test_init(); + static int idx; + + uart_async_test_init(idx++); uart_callback_set(uart_dev, test_double_buffer_callback, NULL); @@ -501,6 +518,7 @@ static ZTEST_BMEM uint8_t test_read_abort_rx_buf[2][100]; static ZTEST_BMEM uint8_t test_read_abort_read_buf[100]; #endif /* NOCACHE_MEM */ static ZTEST_BMEM int test_read_abort_rx_cnt; +static ZTEST_BMEM bool test_read_abort_rx_buf_req_once; static void test_read_abort_callback(const struct device *dev, struct uart_event *evt, void *user_data) @@ -515,14 +533,12 @@ static void test_read_abort_callback(const struct device *dev, break; case UART_RX_BUF_REQUEST: { - static bool once; - - if (!once) { + if (!test_read_abort_rx_buf_req_once) { k_sem_give(&rx_buf_coherency); uart_rx_buf_rsp(dev, test_read_abort_rx_buf[1], sizeof(test_read_abort_rx_buf[1])); - once = true; + test_read_abort_rx_buf_req_once = true; } break; } @@ -558,8 +574,11 @@ static void read_abort_timeout(struct k_timer *timer) static void *read_abort_setup(void) { - uart_async_test_init(); + static int idx; + uart_async_test_init(idx++); + + test_read_abort_rx_buf_req_once = false; failed_in_isr = false; uart_callback_set(uart_dev, test_read_abort_callback, NULL); @@ -654,7 +673,9 @@ static void test_write_abort_callback(const struct device *dev, static void *write_abort_setup(void) { - uart_async_test_init(); + static int idx; + + uart_async_test_init(idx++); uart_callback_set(uart_dev, test_write_abort_callback, NULL); @@ -727,7 +748,9 @@ static void test_forever_timeout_callback(const struct device *dev, static void *forever_timeout_setup(void) { - uart_async_test_init(); + static int idx; + + uart_async_test_init(idx++); uart_callback_set(uart_dev, test_forever_timeout_callback, NULL); @@ -816,8 +839,12 @@ static void test_chained_write_callback(const struct device *dev, static void *chained_write_setup(void) { - uart_async_test_init(); + static int idx; + + uart_async_test_init(idx++); + tx_sent = 0; + chained_write_next_buf = true; uart_callback_set(uart_dev, test_chained_write_callback, NULL); return NULL; @@ -869,11 +896,11 @@ static ZTEST_BMEM uint8_t long_tx_buf[TX_LONG_BUFFER]; #endif /* NOCACHE_MEM */ static ZTEST_BMEM volatile uint8_t evt_num; static ZTEST_BMEM size_t long_received[2]; +static ZTEST_BMEM uint8_t *long_next_buffer; static void test_long_buffers_callback(const struct device *dev, struct uart_event *evt, void *user_data) { - static uint8_t *next_buffer = long_rx_buf2; switch (evt->type) { case UART_TX_DONE: @@ -895,8 +922,8 @@ static void test_long_buffers_callback(const struct device *dev, k_sem_give(&rx_disabled); break; case UART_RX_BUF_REQUEST: - uart_rx_buf_rsp(dev, next_buffer, RX_LONG_BUFFER); - next_buffer = (next_buffer == long_rx_buf2) ? long_rx_buf : long_rx_buf2; + uart_rx_buf_rsp(dev, long_next_buffer, RX_LONG_BUFFER); + long_next_buffer = (long_next_buffer == long_rx_buf2) ? long_rx_buf : long_rx_buf2; break; default: break; @@ -905,8 +932,12 @@ static void test_long_buffers_callback(const struct device *dev, static void *long_buffers_setup(void) { - uart_async_test_init(); + static int idx; + uart_async_test_init(idx++); + + evt_num = 0; + long_next_buffer = long_rx_buf2; uart_callback_set(uart_dev, test_long_buffers_callback, NULL); return NULL; @@ -988,3 +1019,12 @@ ZTEST_SUITE(uart_async_write_abort, NULL, write_abort_setup, ZTEST_SUITE(uart_async_timeout, NULL, forever_timeout_setup, NULL, NULL, NULL); + +void test_main(void) +{ + /* Run all suites for each dut UART. Setup function for each suite is picking + * next UART from the array. + */ + ztest_run_all(NULL, false, ARRAY_SIZE(duts), 1); + ztest_verify_all_test_suites_ran(); +} From f235ddb2cf261eccd93633e4a91060f71008ec6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Thu, 18 Jul 2024 14:20:33 +0200 Subject: [PATCH 2977/4482] tests: drivers: uart: async_api: Add uart120 instance to nrf54h20dk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add second instance to be tested on nrf54h20dk. uart120 is a fast UARTE which works on fixed pin locations. It is not available for cpuppr core. Signed-off-by: Krzysztof Chruściński --- .../boards/nrf54h20dk_nrf54h20_common.dtsi | 31 +++++++++++++++++-- .../boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 9 ++++++ .../uart/uart_async_api/src/test_uart_async.c | 9 ++++-- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_common.dtsi index 9aa338deaad71..ae810c2796616 100644 --- a/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_common.dtsi +++ b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_common.dtsi @@ -3,8 +3,11 @@ &pinctrl { uart137_default_alt: uart137_default_alt { group1 { - psels = , - ; + psels = ; + }; + group2 { + psels = ; + bias-pull-up; }; }; @@ -15,6 +18,23 @@ low-power-enable; }; }; + uart120_default_alt: uart120_default_alt { + group1 { + psels = ; + }; + group2 { + psels = ; + bias-pull-up; + }; + }; + + uart120_sleep_alt: uart120_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; }; dut: &uart137 { @@ -24,3 +44,10 @@ dut: &uart137 { pinctrl-names = "default", "sleep"; current-speed = <115200>; }; + +dut2: &uart120 { + pinctrl-0 = <&uart120_default_alt>; + pinctrl-1 = <&uart120_sleep_alt>; + pinctrl-names = "default", "sleep"; + current-speed = <115200>; +}; diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index be5897fd0516f..79f5554a33baf 100644 --- a/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -5,3 +5,12 @@ &dut { memory-regions = <&cpuapp_dma_region>; }; + +&dut2 { + status = "okay"; + memory-regions = <&dma_fast_region>; +}; + +&dma_fast_region { + status = "okay"; +}; diff --git a/tests/drivers/uart/uart_async_api/src/test_uart_async.c b/tests/drivers/uart/uart_async_api/src/test_uart_async.c index 139de516fd8b5..c087878eee885 100644 --- a/tests/drivers/uart/uart_async_api/src/test_uart_async.c +++ b/tests/drivers/uart/uart_async_api/src/test_uart_async.c @@ -31,12 +31,17 @@ struct dut_data { const char *name; }; -static ZTEST_DMEM struct dut_data duts[] = { +ZTEST_DMEM struct dut_data duts[] = { { .dev = DEVICE_DT_GET(UART_NODE), .name = DT_NODE_FULL_NAME(UART_NODE), }, - /* More instances can be added here. */ +#if DT_NODE_EXISTS(DT_NODELABEL(dut2)) && DT_NODE_HAS_STATUS(DT_NODELABEL(dut2), okay) + { + .dev = DEVICE_DT_GET(DT_NODELABEL(dut2)), + .name = DT_NODE_FULL_NAME(DT_NODELABEL(dut2)), + }, +#endif }; static ZTEST_BMEM const struct device *uart_dev; From 12486ca7e272c0d3db4f24298cc0e326f3969a5a Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Thu, 24 Oct 2024 06:10:35 -0500 Subject: [PATCH 2978/4482] dts: mcxn947: Add SCTimer support Add SCTimer node Signed-off-by: Mahesh Mahadevan --- dts/arm/nxp/nxp_mcxn94x_common.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dts/arm/nxp/nxp_mcxn94x_common.dtsi b/dts/arm/nxp/nxp_mcxn94x_common.dtsi index 72b3177f082dc..fd36a4c2aef08 100644 --- a/dts/arm/nxp/nxp_mcxn94x_common.dtsi +++ b/dts/arm/nxp/nxp_mcxn94x_common.dtsi @@ -795,6 +795,16 @@ prescale = <0>; }; + sc_timer: pwm@91000 { + compatible = "nxp,sctimer-pwm"; + reg = <0x91000 0x1000>; + interrupts = <33 0>; + clocks = <&syscon MCUX_SCTIMER_CLK>; + status = "disabled"; + prescaler = <1>; + #pwm-cells = <3>; + }; + smartdma: smartdma@33000 { compatible = "nxp,smartdma"; reg = <0x33000 0x1000>; From 488e4bbf5f18a201ccffafc8d7c0e2e808409856 Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Thu, 24 Oct 2024 06:11:02 -0500 Subject: [PATCH 2979/4482] boards: frdm_mcxn947: Add SCTimer support Add support for SCTimer Signed-off-by: Mahesh Mahadevan --- boards/nxp/frdm_mcxn947/board.c | 6 ++++++ boards/nxp/frdm_mcxn947/doc/index.rst | 2 ++ boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi | 9 +++++++++ boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi | 5 +++++ boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi | 5 +++++ 5 files changed, 27 insertions(+) diff --git a/boards/nxp/frdm_mcxn947/board.c b/boards/nxp/frdm_mcxn947/board.c index abec73950be1d..75ff1cb04e42c 100644 --- a/boards/nxp/frdm_mcxn947/board.c +++ b/boards/nxp/frdm_mcxn947/board.c @@ -379,6 +379,12 @@ static int frdm_mcxn947_init(void) CLOCK_AttachClk(kI3C1FCLK_to_I3C1FCLKSTC); #endif +#if DT_NODE_HAS_STATUS(DT_NODELABEL(sc_timer), okay) + /* attach FRO HF to SCT */ + CLOCK_SetClkDiv(kCLOCK_DivSctClk, 1u); + CLOCK_AttachClk(kFRO_HF_to_SCT); +#endif + /* Set SystemCoreClock variable. */ SystemCoreClock = CLOCK_INIT_CORE_CLOCK; diff --git a/boards/nxp/frdm_mcxn947/doc/index.rst b/boards/nxp/frdm_mcxn947/doc/index.rst index 63d0bbc7830d1..6b5008a20551f 100644 --- a/boards/nxp/frdm_mcxn947/doc/index.rst +++ b/boards/nxp/frdm_mcxn947/doc/index.rst @@ -75,6 +75,8 @@ The FRDM-MCXN947 board configuration supports the following hardware features: +-----------+------------+-------------------------------------+ | PWM | on-chip | pwm | +-----------+------------+-------------------------------------+ +| SCTimer | on-chip | pwm | ++-----------+------------+-------------------------------------+ | CTIMER | on-chip | counter | +-----------+------------+-------------------------------------+ | USDHC | on-chip | sdhc | diff --git a/boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi b/boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi index a39123f01bc24..ce4995b6d1cd4 100644 --- a/boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi +++ b/boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi @@ -232,6 +232,15 @@ }; }; + pinmux_sctimer: pinmux_sctimer { + group0 { + pinmux = ; + slew-rate = "fast"; + drive-strength = "low"; + input-enable; + }; + }; + pinmux_flexio_lcd: pinmux_flexio_lcd { group0 { pinmux = , diff --git a/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi b/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi index 4ac575f51c762..2ca276f9f89b6 100644 --- a/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi +++ b/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi @@ -268,3 +268,8 @@ zephyr_mipi_dbi_parallel: &flexio0_lcd { pinctrl-0 = <&pinmux_flexcan0>; pinctrl-names = "default"; }; + +&sc_timer { + pinctrl-0 = <&pinmux_sctimer>; + pinctrl-names = "default"; +}; diff --git a/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi b/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi index d2483b4ec0840..3a1a565c89911 100644 --- a/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi +++ b/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi @@ -32,6 +32,7 @@ aliases{ watchdog0 = &wwdt0; pwm-0 = &flexpwm1_pwm0; + pwm-1 = &sc_timer; rtc = &rtc; }; }; @@ -206,3 +207,7 @@ zephyr_udc0: &usb1 { &rtc { status = "okay"; }; + +&sc_timer { + status = "okay"; +}; From 21d0a3b699aba07f72eeff48d6adc2042151485b Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Thu, 24 Oct 2024 17:46:51 -0500 Subject: [PATCH 2980/4482] tests: pwm: Add support for SCTimer PWM on FRDM-MCXN947 Add overlay files to enable test of PWM over SCTimer. Signed-off-by: Mahesh Mahadevan --- .../boards/frdm_mcxn947_mcxn947_cpu0_sctimer.overlay | 12 ++++++++++++ tests/drivers/pwm/pwm_api/testcase.yaml | 5 +++++ 2 files changed, 17 insertions(+) create mode 100644 tests/drivers/pwm/pwm_api/boards/frdm_mcxn947_mcxn947_cpu0_sctimer.overlay diff --git a/tests/drivers/pwm/pwm_api/boards/frdm_mcxn947_mcxn947_cpu0_sctimer.overlay b/tests/drivers/pwm/pwm_api/boards/frdm_mcxn947_mcxn947_cpu0_sctimer.overlay new file mode 100644 index 0000000000000..105d2fcf733aa --- /dev/null +++ b/tests/drivers/pwm/pwm_api/boards/frdm_mcxn947_mcxn947_cpu0_sctimer.overlay @@ -0,0 +1,12 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* Disable flexpwm node as it is mapped to pwm-0 alias which is picked up first by the test. + * PWM signal is visible on J9-16. + */ +&flexpwm1_pwm0 { + status = "disabled"; +}; diff --git a/tests/drivers/pwm/pwm_api/testcase.yaml b/tests/drivers/pwm/pwm_api/testcase.yaml index b30458cc970eb..191a2b86be878 100644 --- a/tests/drivers/pwm/pwm_api/testcase.yaml +++ b/tests/drivers/pwm/pwm_api/testcase.yaml @@ -25,3 +25,8 @@ tests: extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay" platform_allow: - nrf54h20dk/nrf54h20/cpuapp + drivers.pwm.frdm_mcxn947_mcxn947_cpu0_sctimer: + extra_args: DTC_OVERLAY_FILE="boards/frdm_mcxn947_mcxn947_cpu0_sctimer.overlay" + platform_allow: + - frdm_mcxn947/mcxn947/cpu0 + - frdm_mcxn947/mcxn947/cpu0/qspi From b0a1dddde34b922032e5ccf84a2245c8c2177828 Mon Sep 17 00:00:00 2001 From: Benedikt Schmidt Date: Thu, 7 Nov 2024 07:59:47 +0100 Subject: [PATCH 2981/4482] drivers: fpga: fix waveform for iCE40 configuration in SPI mode The datasheet of the iCE40 specifies that there should be a leading and trailing clocks phase during its configuration with SPI. Due to the limitations of the SPI interface, and probably also due to a lock of support for such a feature for instance in the STM32 SPI peripheral, this is achieved with additional SPI transfers before and after the actual image. Unfortunately, this by default also affects the slave select GPIO, which has to stay high during these phases. This fixes this behaviour via not passing the slave select GPIO to the SPI driver and manipulating this GPIO manually. Signed-off-by: Benedikt Schmidt --- drivers/fpga/fpga_ice40.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/fpga/fpga_ice40.c b/drivers/fpga/fpga_ice40.c index 6ffc67ec2f92f..22eba12e00210 100644 --- a/drivers/fpga/fpga_ice40.c +++ b/drivers/fpga/fpga_ice40.c @@ -317,6 +317,15 @@ static int fpga_ice40_load_spi(const struct device *dev, uint32_t *image_ptr, ui struct fpga_ice40_data *data = dev->data; uint8_t clock_buf[(UINT8_MAX + 1) / BITS_PER_BYTE]; const struct fpga_ice40_config *config = dev->config; + struct spi_dt_spec bus; + + memcpy(&bus, &config->bus, sizeof(bus)); + /* + * Disable the automatism for chip select within the SPI driver, + * as the configuration sequence requires this signal to be inactive + * during the leading and trailing clock phase. + */ + bus.config.cs.gpio.port = NULL; /* crc check */ crc = crc32_ieee((uint8_t *)image_ptr, img_size); @@ -381,7 +390,7 @@ static int fpga_ice40_load_spi(const struct device *dev, uint32_t *image_ptr, ui LOG_DBG("Send %u clocks", config->leading_clocks); tx_buf.buf = clock_buf; tx_buf.len = DIV_ROUND_UP(config->leading_clocks, BITS_PER_BYTE); - ret = spi_write_dt(&config->bus, &tx_bufs); + ret = spi_write_dt(&bus, &tx_bufs); if (ret < 0) { LOG_ERR("Failed to send leading %u clocks: %d", config->leading_clocks, ret); goto unlock; @@ -397,7 +406,7 @@ static int fpga_ice40_load_spi(const struct device *dev, uint32_t *image_ptr, ui LOG_DBG("Send bin file"); tx_buf.buf = image_ptr; tx_buf.len = img_size; - ret = spi_write_dt(&config->bus, &tx_bufs); + ret = spi_write_dt(&bus, &tx_bufs); if (ret < 0) { LOG_ERR("Failed to send bin file: %d", ret); goto unlock; @@ -413,7 +422,7 @@ static int fpga_ice40_load_spi(const struct device *dev, uint32_t *image_ptr, ui LOG_DBG("Send %u clocks", config->trailing_clocks); tx_buf.buf = clock_buf; tx_buf.len = DIV_ROUND_UP(config->trailing_clocks, BITS_PER_BYTE); - ret = spi_write_dt(&config->bus, &tx_bufs); + ret = spi_write_dt(&bus, &tx_bufs); if (ret < 0) { LOG_ERR("Failed to send trailing %u clocks: %d", config->trailing_clocks, ret); goto unlock; @@ -596,7 +605,10 @@ static int fpga_ice40_init(const struct device *dev) static struct fpga_ice40_data fpga_ice40_data_##inst; \ \ static const struct fpga_ice40_config fpga_ice40_config_##inst = { \ - .bus = SPI_DT_SPEC_INST_GET(inst, SPI_WORD_SET(8) | SPI_TRANSFER_MSB, 0), \ + .bus = SPI_DT_SPEC_INST_GET(inst, \ + SPI_OP_MODE_MASTER | SPI_MODE_CPOL | SPI_MODE_CPHA | \ + SPI_WORD_SET(8) | SPI_TRANSFER_MSB, \ + 0), \ .creset = GPIO_DT_SPEC_INST_GET(inst, creset_gpios), \ .cdone = GPIO_DT_SPEC_INST_GET(inst, cdone_gpios), \ .clk = GPIO_DT_SPEC_INST_GET_OR(inst, clk_gpios, {0}), \ From 28796076d84056d085e5a4ebf213dafbfe56202a Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 21 Nov 2024 06:03:30 -0500 Subject: [PATCH 2982/4482] tests: kernel: common: optimize filters Optimize filters and remove build_on_all, this option is already used in the synchronization sample which has more coverage on small platforms. Since we only build, it does provide basic sanitcheck for the kernel as well. This reduces testplan on PRs and push events by almost 1000 entries that would only be built or filtered at runtime. Signed-off-by: Anas Nashif --- tests/kernel/common/testcase.yaml | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/tests/kernel/common/testcase.yaml b/tests/kernel/common/testcase.yaml index c4c17e2eb51b2..43010a537cc28 100644 --- a/tests/kernel/common/testcase.yaml +++ b/tests/kernel/common/testcase.yaml @@ -7,8 +7,7 @@ common: min_ram: 32 timeout: 120 tests: - kernel.common: - build_on_all: true + kernel.common: {} kernel.common.tls: # ARCMWDT can't handle THREAD_LOCAL_STORAGE with USERSPACE, see #52570 for details filter: > @@ -17,6 +16,8 @@ tests: extra_configs: - CONFIG_THREAD_LOCAL_STORAGE=y kernel.common.misra: + platform_key: + - arch # Some configurations are known-incompliant and won't build filter: not ((CONFIG_I2C or CONFIG_SPI) and CONFIG_USERSPACE) integration_platforms: @@ -24,30 +25,52 @@ tests: extra_configs: - CONFIG_MISRA_SANE=y kernel.common.minimallibc: + platform_key: + - arch filter: CONFIG_MINIMAL_LIBC_SUPPORTED tags: libc extra_configs: - CONFIG_MINIMAL_LIBC=y + integration_platforms: + - qemu_x86 + - mps2/an385 kernel.common.nano32: + platform_key: + - arch tags: - nano filter: not CONFIG_KERNEL_COHERENCE extra_configs: - CONFIG_CBPRINTF_NANO=y - CONFIG_CBPRINTF_REDUCED_INTEGRAL=y + integration_platforms: + - qemu_x86 + - mps2/an385 kernel.common.nano64: + platform_key: + - arch tags: - nano filter: not CONFIG_KERNEL_COHERENCE extra_configs: - CONFIG_CBPRINTF_NANO=y - CONFIG_CBPRINTF_FULL_INTEGRAL=y + integration_platforms: + - qemu_x86 + - mps2/an385 kernel.common.picolibc: + platform_key: + - arch filter: CONFIG_PICOLIBC_SUPPORTED tags: picolibc extra_configs: - CONFIG_PICOLIBC=y + integration_platforms: + - qemu_x86 + - mps2/an385 kernel.common.lto: + platform_key: + - arch # CONFIG_CODE_DATA_RELOCATION causes a build error (issue #69730) filter: CONFIG_ISR_TABLES_LOCAL_DECLARATION_SUPPORTED and not CONFIG_CODE_DATA_RELOCATION tags: lto @@ -55,3 +78,6 @@ tests: - CONFIG_TEST_USERSPACE=n - CONFIG_ISR_TABLES_LOCAL_DECLARATION=y - CONFIG_LTO=y + integration_platforms: + - qemu_x86 + - mps2/an385 From 067a35f2fb718a10d3fb556b56d909a680e1b3c9 Mon Sep 17 00:00:00 2001 From: Emil Lindqvist Date: Wed, 20 Nov 2024 09:16:29 +0100 Subject: [PATCH 2983/4482] display: stm32: implement display_get_framebuffer API This commit implements the display_get_framebuffer API function in the STM32 LTDC display driver Signed-off-by: Emil Lindqvist --- drivers/display/display_stm32_ltdc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/display/display_stm32_ltdc.c b/drivers/display/display_stm32_ltdc.c index 3c6a2085def47..068c9e9eb0c7b 100644 --- a/drivers/display/display_stm32_ltdc.c +++ b/drivers/display/display_stm32_ltdc.c @@ -249,6 +249,13 @@ static int stm32_ltdc_read(const struct device *dev, const uint16_t x, return 0; } +static void *stm32_ltdc_get_framebuffer(const struct device *dev) +{ + struct display_stm32_ltdc_data *data = dev->data; + + return ((void *)data->front_buf); +} + static int stm32_ltdc_display_blanking_off(const struct device *dev) { const struct display_stm32_ltdc_config *config = dev->config; @@ -462,6 +469,7 @@ static int stm32_ltdc_pm_action(const struct device *dev, static const struct display_driver_api stm32_ltdc_display_api = { .write = stm32_ltdc_write, .read = stm32_ltdc_read, + .get_framebuffer = stm32_ltdc_get_framebuffer, .get_capabilities = stm32_ltdc_get_capabilities, .set_pixel_format = stm32_ltdc_set_pixel_format, .set_orientation = stm32_ltdc_set_orientation, From 45ebd390cfd632055f11a8ac5be0c40e0d333a0c Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Wed, 20 Nov 2024 17:25:30 +0800 Subject: [PATCH 2984/4482] arch: riscv: reg: include required header Include `zephyr/sys/util.h` for the `STRINGIFY()` macro. Signed-off-by: Yong Cong Sin --- include/zephyr/arch/riscv/reg.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/zephyr/arch/riscv/reg.h b/include/zephyr/arch/riscv/reg.h index 6d3b2d88b1755..2c0650f0498f1 100644 --- a/include/zephyr/arch/riscv/reg.h +++ b/include/zephyr/arch/riscv/reg.h @@ -7,6 +7,8 @@ #ifndef ZEPHYR_INCLUDE_ZEPHYR_ARCH_RISCV_REG_H_ #define ZEPHYR_INCLUDE_ZEPHYR_ARCH_RISCV_REG_H_ +#include + #define reg_read(reg) \ ({ \ register unsigned long __rv; \ From c2802618df89b4f7b820b47ba6f0f024c8caa0a6 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 20 Nov 2024 09:35:42 +0200 Subject: [PATCH 2985/4482] tests: net: socket: tcp: Add min_flash to the test config Add minimum flash requirement to the tests. This will effectively exclude nrf5340dk/nrf5340/cpuapp/ns as it does not have enough flash for the application. Fixes #81608 Signed-off-by: Jukka Rissanen --- tests/net/socket/tcp/testcase.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/net/socket/tcp/testcase.yaml b/tests/net/socket/tcp/testcase.yaml index 1bf87a17e9e7a..a7593ffcdd36b 100644 --- a/tests/net/socket/tcp/testcase.yaml +++ b/tests/net/socket/tcp/testcase.yaml @@ -1,6 +1,7 @@ common: depends_on: netif min_ram: 32 + min_flash: 194 tags: - net - socket From ca46c7c816c0fd9e5b56b0f9f7cac067320b8540 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 18 Nov 2024 13:30:16 +0100 Subject: [PATCH 2986/4482] boards nrfbsim: Enable UART(E) peripherals for nrf54l15bsim The HW models now support this peripheral for this target. Let's enable it. Signed-off-by: Alberto Escolar Piedras --- .../nrf_bsim/nrf54l15bsim_nrf54l15_cpuapp.dts | 21 ++++++++++++++----- .../nrf54l15bsim_nrf54l15_cpuapp.yaml | 1 - 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/boards/native/nrf_bsim/nrf54l15bsim_nrf54l15_cpuapp.dts b/boards/native/nrf_bsim/nrf54l15bsim_nrf54l15_cpuapp.dts index fbfe0f0dc6512..cc1de29bd8a7e 100644 --- a/boards/native/nrf_bsim/nrf54l15bsim_nrf54l15_cpuapp.dts +++ b/boards/native/nrf_bsim/nrf54l15bsim_nrf54l15_cpuapp.dts @@ -8,6 +8,7 @@ #include #include +#include <../boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l_05_10_15-pinctrl.dtsi> / { model = "Nordic NRF54L15 BSIM NRF54L15 Application"; @@ -15,6 +16,7 @@ chosen { zephyr,entropy = &rng; + zephyr,bt-c2h-uart = &uart20; zephyr,flash-controller = &rram_controller; zephyr,flash = &cpuapp_rram; }; @@ -28,19 +30,15 @@ /delete-node/ memory@2002f000; peripheral@50000000 { /delete-node/ spi@4a000; - /delete-node/ uart@4a000; /delete-node/ vpr@4c000; /delete-node/ mailbox@0; /delete-node/ interrupt-controller@f0000000; /delete-node/ i2c@c6000; /delete-node/ spi@c6000; - /delete-node/ uart@c6000; /delete-node/ i2c@c7000; /delete-node/ spi@c7000; - /delete-node/ uart@c7000; /delete-node/ i2c@c8000; /delete-node/ spi@c8000; - /delete-node/ uart@c8000; /delete-node/ pwm@d2000; /delete-node/ pwm@d3000; /delete-node/ pwm@d4000; @@ -51,7 +49,6 @@ /delete-node/ qdec@e1000; /delete-node/ i2c@104000; /delete-node/ spi@104000; - /delete-node/ uart@104000; /delete-node/ watchdog@108000; /delete-node/ watchdog@109000; }; @@ -86,6 +83,20 @@ }; }; +&uart20 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart20_default>; + pinctrl-1 = <&uart20_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&uart30 { + current-speed = <115200>; + pinctrl-0 = <&uart30_default>; + pinctrl-1 = <&uart30_sleep>; + pinctrl-names = "default", "sleep"; +}; &gpio0 { status = "okay"; diff --git a/boards/native/nrf_bsim/nrf54l15bsim_nrf54l15_cpuapp.yaml b/boards/native/nrf_bsim/nrf54l15bsim_nrf54l15_cpuapp.yaml index 6bbf454266024..e09184de96d58 100644 --- a/boards/native/nrf_bsim/nrf54l15bsim_nrf54l15_cpuapp.yaml +++ b/boards/native/nrf_bsim/nrf54l15bsim_nrf54l15_cpuapp.yaml @@ -13,5 +13,4 @@ supported: testing: ignore_tags: - modem - - uart - bsim_skip_CI From 890f13426e8715a593b39a5c3c3f5d02704f6c69 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 18 Nov 2024 13:44:48 +0100 Subject: [PATCH 2987/4482] doc boards nrfbsim: Mention the UARTE as supported for nrf54l15 Include in the list of supported peripherals the UARTE for the simulated nrf54l15 Signed-off-by: Alberto Escolar Piedras --- boards/native/nrf_bsim/doc/nrf54l15bsim.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/native/nrf_bsim/doc/nrf54l15bsim.rst b/boards/native/nrf_bsim/doc/nrf54l15bsim.rst index eaabaf1cc4de1..ae8b29d2aecff 100644 --- a/boards/native/nrf_bsim/doc/nrf54l15bsim.rst +++ b/boards/native/nrf_bsim/doc/nrf54l15bsim.rst @@ -52,6 +52,7 @@ This boards include models of some of the nRF54L15 SOC peripherals: * RTC (Real Time Counter) * TEMP (Temperature sensor) * TIMER +* UARTE (UART with Easy DMA) * UICR (User Information Configuration Registers) and will use the same drivers as the nrf54l15dk targets for these. From dd2f4117e3a0e327e60d6d6a2c9146a9d1d886a3 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 18 Nov 2024 15:56:03 +0100 Subject: [PATCH 2988/4482] tests uart_async_api: Enable in nrf54l15bsim//cpuapp Enable this test in the simulated nrf54l15 by providing an appropriate overlay. Signed-off-by: Alberto Escolar Piedras --- .../uart_async_api/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay | 3 +++ tests/drivers/uart/uart_async_api/testcase.yaml | 1 + 2 files changed, 4 insertions(+) create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay new file mode 100644 index 0000000000000..10b8825014f97 --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54l15dk_nrf54l15_cpuapp.overlay" diff --git a/tests/drivers/uart/uart_async_api/testcase.yaml b/tests/drivers/uart/uart_async_api/testcase.yaml index 15974269c3946..24f7b3008ace4 100644 --- a/tests/drivers/uart/uart_async_api/testcase.yaml +++ b/tests/drivers/uart/uart_async_api/testcase.yaml @@ -30,6 +30,7 @@ tests: - nrf52840dk/nrf52840 - nrf52_bsim - nrf5340bsim/nrf5340/cpuapp + - nrf54l15bsim/nrf54l15/cpuapp filter: CONFIG_SERIAL_SUPPORT_ASYNC harness: ztest harness_config: From eec736355c2245ce268696a8c5923e86e5f49774 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 18 Nov 2024 17:16:43 +0100 Subject: [PATCH 2989/4482] tests uart_mix_fifo_poll: Enable for nrf54l15bsim Enable this test in the simulated nrf54l15 and provide an appropriate overlay. Signed-off-by: Alberto Escolar Piedras --- .../boards/nrf54l15bsim_nrf54l15_cpuapp.overlay | 3 +++ tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml | 1 + 2 files changed, 4 insertions(+) create mode 100644 tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay diff --git a/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay new file mode 100644 index 0000000000000..10b8825014f97 --- /dev/null +++ b/tests/drivers/uart/uart_mix_fifo_poll/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54l15dk_nrf54l15_cpuapp.overlay" diff --git a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml index 91470dc990be4..13f1d52d4d566 100644 --- a/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml +++ b/tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml @@ -10,6 +10,7 @@ common: - nrf5340dk/nrf5340/cpuapp - nrf5340bsim/nrf5340/cpuapp - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15bsim/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf54h20dk/nrf54h20/cpurad - nrf52_bsim From 9c386cab935f65c2e700e6a89bf6d2e5bb48fd2d Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 18 Nov 2024 17:25:38 +0100 Subject: [PATCH 2990/4482] tests uart_pm: Enable for nrf54l15bsim Enable this test in the simulated nrf5340 and provide an appropriate overlay. Signed-off-by: Alberto Escolar Piedras --- .../uart/uart_pm/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay | 3 +++ tests/drivers/uart/uart_pm/testcase.yaml | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 tests/drivers/uart/uart_pm/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay diff --git a/tests/drivers/uart/uart_pm/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_pm/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay new file mode 100644 index 0000000000000..10b8825014f97 --- /dev/null +++ b/tests/drivers/uart/uart_pm/boards/nrf54l15bsim_nrf54l15_cpuapp.overlay @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include "nrf54l15dk_nrf54l15_cpuapp.overlay" diff --git a/tests/drivers/uart/uart_pm/testcase.yaml b/tests/drivers/uart/uart_pm/testcase.yaml index f9a7a8f902cf3..29c336441c611 100644 --- a/tests/drivers/uart/uart_pm/testcase.yaml +++ b/tests/drivers/uart/uart_pm/testcase.yaml @@ -6,6 +6,7 @@ common: platform_allow: - nrf52840dk/nrf52840 - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15bsim/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp - nrf52_bsim - nrf5340bsim/nrf5340/cpuapp @@ -29,6 +30,7 @@ tests: extra_args: DTC_OVERLAY_FILE="boards/nrf52840dk_nrf52840.overlay;nrf_rx_disable.overlay" platform_exclude: - nrf54l15dk/nrf54l15/cpuapp + - nrf54l15bsim/nrf54l15/cpuapp - nrf54h20dk/nrf54h20/cpuapp drivers.uart.pm.enhanced_poll: From 4558056f81fe7387e6c291e3321dc880f1858ee2 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 18 Nov 2024 17:28:03 +0100 Subject: [PATCH 2991/4482] tests/bsim: Also runtime test the UART drivers for the nrf54l15 To increase coverage. Note that we call twister separatedly for this target, due to the 54l15 overlays using UARTE20 which is indexed in simulation as "2", but as the nrf52833 does not have 3 instances. So "-uart2_loopback" is not a valid option for a 52833 executable. Signed-off-by: Alberto Escolar Piedras --- tests/bsim/ci.uart.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/bsim/ci.uart.sh b/tests/bsim/ci.uart.sh index 86c5282fa921c..70d296d23dfa1 100755 --- a/tests/bsim/ci.uart.sh +++ b/tests/bsim/ci.uart.sh @@ -12,10 +12,16 @@ cd ${ZEPHYR_BASE} set -uex echo "UART: Single device tests" +echo " nRF52833 & 5340:" ${ZEPHYR_BASE}/scripts/twister -T tests/drivers/uart/ --force-color --inline-logs -v -M \ -p nrf52_bsim -p nrf5340bsim/nrf5340/cpuapp --fixture gpio_loopback \ -- -uart0_loopback -uart1_loopback +echo " nRF54L15:" +${ZEPHYR_BASE}/scripts/twister -T tests/drivers/uart/ --force-color --inline-logs -v -M \ + -p nrf54l15bsim/nrf54l15/cpuapp --fixture gpio_loopback \ + -- -uart2_loopback + echo "UART: Multi device tests" WORK_DIR=${ZEPHYR_BASE}/bsim_uart nice tests/bsim/drivers/uart/compile.sh RESULTS_FILE=${ZEPHYR_BASE}/bsim_out/bsim_results.uart.52.xml \ From 3063f18942d1e2f2511795ef39241d90bd2f8d98 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 19 Nov 2024 21:19:33 +0200 Subject: [PATCH 2992/4482] Bluetooth: Host: Remove unnecessary hci_driver.h includes None of these files actually use anything from the hci_driver.h header file. Signed-off-by: Johan Hedberg --- drivers/bluetooth/hci/h4_ifx_cyw43xxx.c | 1 - samples/bluetooth/hci_uart_3wire/src/main.c | 1 - samples/bluetooth/hci_uart_async/src/hci_uart_async.c | 1 - subsys/bluetooth/host/att.c | 1 - subsys/bluetooth/host/classic/l2cap_br.c | 1 - subsys/bluetooth/host/classic/rfcomm.c | 1 - subsys/bluetooth/host/gatt.c | 1 - subsys/bluetooth/host/id.c | 1 - subsys/bluetooth/host/l2cap.c | 1 - .../include/zephyr/drivers/bluetooth/hci_driver.h | 11 ----------- 10 files changed, 20 deletions(-) delete mode 100644 tests/bluetooth/host/conn/mocks/zephyr/include/zephyr/drivers/bluetooth/hci_driver.h diff --git a/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c b/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c index 6c3b132ed30ec..ae98a8e51e2d6 100644 --- a/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c +++ b/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include diff --git a/samples/bluetooth/hci_uart_3wire/src/main.c b/samples/bluetooth/hci_uart_3wire/src/main.c index ce0e993dab04a..5454b0cd9c7c6 100644 --- a/samples/bluetooth/hci_uart_3wire/src/main.c +++ b/samples/bluetooth/hci_uart_3wire/src/main.c @@ -28,7 +28,6 @@ #include #include #include -#include #define LOG_MODULE_NAME hci_uart_3wire LOG_MODULE_REGISTER(LOG_MODULE_NAME); diff --git a/samples/bluetooth/hci_uart_async/src/hci_uart_async.c b/samples/bluetooth/hci_uart_async/src/hci_uart_async.c index 011d920662246..936c47f76d7f3 100644 --- a/samples/bluetooth/hci_uart_async/src/hci_uart_async.c +++ b/samples/bluetooth/hci_uart_async/src/hci_uart_async.c @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index c9872aebc6789..26b3c3f542b6c 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -19,7 +19,6 @@ #include #include #include -#include #include "common/bt_str.h" diff --git a/subsys/bluetooth/host/classic/l2cap_br.c b/subsys/bluetooth/host/classic/l2cap_br.c index d1e558a7b3d66..0ebfdce8560b0 100644 --- a/subsys/bluetooth/host/classic/l2cap_br.c +++ b/subsys/bluetooth/host/classic/l2cap_br.c @@ -17,7 +17,6 @@ #include #include #include -#include #include "host/buf_view.h" #include "host/hci_core.h" diff --git a/subsys/bluetooth/host/classic/rfcomm.c b/subsys/bluetooth/host/classic/rfcomm.c index f8742bff3678a..4e088209cd6b2 100644 --- a/subsys/bluetooth/host/classic/rfcomm.c +++ b/subsys/bluetooth/host/classic/rfcomm.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index 926337dd76133..f03cbcec3950e 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -37,7 +37,6 @@ #include #include #include -#include #include "common/bt_str.h" diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index 3a6fdf3ee28aa..67f691dfa799b 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include "hci_core.h" diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index d280db5363cd0..8830d05d58ab3 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -23,7 +23,6 @@ #include #include #include -#include #define LOG_DBG_ENABLED IS_ENABLED(CONFIG_BT_L2CAP_LOG_LEVEL_DBG) diff --git a/tests/bluetooth/host/conn/mocks/zephyr/include/zephyr/drivers/bluetooth/hci_driver.h b/tests/bluetooth/host/conn/mocks/zephyr/include/zephyr/drivers/bluetooth/hci_driver.h deleted file mode 100644 index 68285925d81b7..0000000000000 --- a/tests/bluetooth/host/conn/mocks/zephyr/include/zephyr/drivers/bluetooth/hci_driver.h +++ /dev/null @@ -1,11 +0,0 @@ -/* Stub for Bluetooth HCI driver API used to hide real hci_driver.h. */ - -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef ZEPHYR_INCLUDE_DRIVERS_BLUETOOTH_HCI_DRIVER_H_ -#define ZEPHYR_INCLUDE_DRIVERS_BLUETOOTH_HCI_DRIVER_H_ - -#endif /* ZEPHYR_INCLUDE_DRIVERS_BLUETOOTH_HCI_DRIVER_H_ */ From 30d1d0e526d3763044d289dde2549bf0671d9fbd Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 19 Nov 2024 21:20:10 +0200 Subject: [PATCH 2993/4482] Bluetooth: Host: Remove deprecated HCI driver API Remove the deprecated HCI driver API which was provided by the hci_driver.h header file. The deprecation happened in Zephyr 3.7, so the API can now be removed for Zephyr 4.1. Signed-off-by: Johan Hedberg --- .../bluetooth/api/hci_drivers.rst | 2 +- include/zephyr/drivers/bluetooth/hci_driver.h | 242 ------------------ subsys/bluetooth/controller/hci/hci.c | 2 +- subsys/bluetooth/host/conn.c | 2 +- subsys/bluetooth/host/hci_common.c | 2 +- subsys/bluetooth/host/hci_core.c | 114 ++------- subsys/bluetooth/host/hci_core.h | 7 - subsys/bluetooth/host/hci_ecc.c | 20 -- subsys/bluetooth/host/hci_raw.c | 70 +---- subsys/bluetooth/host/hci_raw_internal.h | 7 - subsys/usb/device/class/bluetooth.c | 2 +- subsys/usb/device_next/class/bt_hci.c | 2 +- 12 files changed, 43 insertions(+), 429 deletions(-) delete mode 100644 include/zephyr/drivers/bluetooth/hci_driver.h diff --git a/doc/connectivity/bluetooth/api/hci_drivers.rst b/doc/connectivity/bluetooth/api/hci_drivers.rst index 9b01981d67a0d..fd70691f2a89b 100644 --- a/doc/connectivity/bluetooth/api/hci_drivers.rst +++ b/doc/connectivity/bluetooth/api/hci_drivers.rst @@ -8,4 +8,4 @@ HCI Drivers API Reference ************* -.. doxygengroup:: bt_hci_driver +.. doxygengroup:: bt_hci_api diff --git a/include/zephyr/drivers/bluetooth/hci_driver.h b/include/zephyr/drivers/bluetooth/hci_driver.h deleted file mode 100644 index c2eae9d90cb93..0000000000000 --- a/include/zephyr/drivers/bluetooth/hci_driver.h +++ /dev/null @@ -1,242 +0,0 @@ -/** @file - * @brief Bluetooth HCI driver API. - */ - -/* - * Copyright (c) 2015-2016 Intel Corporation - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef ZEPHYR_INCLUDE_DRIVERS_BLUETOOTH_HCI_DRIVER_H_ -#define ZEPHYR_INCLUDE_DRIVERS_BLUETOOTH_HCI_DRIVER_H_ - -/** - * @brief HCI drivers - * - * @deprecated This is the old HCI driver API. Drivers should use @ref bt_hci_api instead. - * - * @defgroup bt_hci_driver HCI drivers - * @ingroup bluetooth - * @{ - */ - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -enum { - /* The host should never send HCI_Reset */ - BT_QUIRK_NO_RESET = BIT(0), - /* The controller does not auto-initiate a DLE procedure when the - * initial connection data length parameters are not equal to the - * default data length parameters. Therefore the host should initiate - * the DLE procedure after connection establishment. */ - BT_QUIRK_NO_AUTO_DLE = BIT(1), -}; - -/** - * @brief Receive data from the controller/HCI driver. - * - * This is the main function through which the HCI driver provides the - * host with data from the controller. The buffer needs to have its type - * set with the help of bt_buf_set_type() before calling this API. - * - * @param buf Network buffer containing data from the controller. - * - * @return 0 on success or negative error number on failure. - * - * @deprecated Use the new HCI driver interface instead: @ref bt_hci_api - */ -__deprecated int bt_recv(struct net_buf *buf); - -/** Possible values for the 'bus' member of the bt_hci_driver struct */ -enum bt_hci_driver_bus { - BT_HCI_DRIVER_BUS_VIRTUAL = 0, - BT_HCI_DRIVER_BUS_USB = 1, - BT_HCI_DRIVER_BUS_PCCARD = 2, - BT_HCI_DRIVER_BUS_UART = 3, - BT_HCI_DRIVER_BUS_RS232 = 4, - BT_HCI_DRIVER_BUS_PCI = 5, - BT_HCI_DRIVER_BUS_SDIO = 6, - BT_HCI_DRIVER_BUS_SPI = 7, - BT_HCI_DRIVER_BUS_I2C = 8, - BT_HCI_DRIVER_BUS_IPM = 9, -}; - -#if defined(CONFIG_BT_HCI_SETUP) || defined(__DOXYGEN__) -struct bt_hci_setup_params { - /** The public identity address to give to the controller. This field is used when the - * driver selects @kconfig{CONFIG_BT_HCI_SET_PUBLIC_ADDR} to indicate that it supports - * setting the controller's public address. - */ - bt_addr_t public_addr; -}; -#endif - -/** - * @brief Abstraction which represents the HCI transport to the controller. - * - * This struct is used to represent the HCI transport to the Bluetooth - * controller. - */ -struct bt_hci_driver { - /** Name of the driver */ - const char *name; - - /** Bus of the transport (BT_HCI_DRIVER_BUS_*) */ - enum bt_hci_driver_bus bus; - - /** Specific controller quirks. These are set by the HCI driver - * and acted upon by the host. They can either be statically - * set at buildtime, or set at runtime before the HCI driver's - * open() callback returns. - */ - uint32_t quirks; - - /** - * @brief Open the HCI transport. - * - * Opens the HCI transport for operation. This function must not - * return until the transport is ready for operation, meaning it - * is safe to start calling the send() handler. - * - * @return 0 on success or negative error number on failure. - */ - int (*open)(void); - - /** - * @brief Close the HCI transport. - * - * Closes the HCI transport. This function must not return until the - * transport is closed. - * - * @return 0 on success or negative error number on failure. - */ - int (*close)(void); - - /** - * @brief Send HCI buffer to controller. - * - * Send an HCI command or ACL data to the controller. The exact - * type of the data can be checked with the help of bt_buf_get_type(). - * - * @note This function must only be called from a cooperative thread. - * - * @param buf Buffer containing data to be sent to the controller. - * - * @return 0 on success or negative error number on failure. - */ - int (*send)(struct net_buf *buf); - -#if defined(CONFIG_BT_HCI_SETUP) || defined(__DOXYGEN__) - /** - * @brief HCI vendor-specific setup - * - * Executes vendor-specific commands sequence to initialize - * BT Controller before BT Host executes Reset sequence. - * - * @note @kconfig{CONFIG_BT_HCI_SETUP} must be selected for this - * field to be available. - * - * @return 0 on success or negative error number on failure. - */ - int (*setup)(const struct bt_hci_setup_params *params); -#endif /* defined(CONFIG_BT_HCI_SETUP) || defined(__DOXYGEN__)*/ -}; - -/** - * @brief Register a new HCI driver to the Bluetooth stack. - * - * This needs to be called before any application code runs. The bt_enable() - * API will fail if there is no driver registered. - * - * @param drv A bt_hci_driver struct representing the driver. - * - * @return 0 on success or negative error number on failure. - * - * @deprecated Use the new HCI driver interface instead: @ref bt_hci_api - */ -__deprecated int bt_hci_driver_register(const struct bt_hci_driver *drv); - -/** - * @brief Setup the HCI transport, which usually means to reset the - * Bluetooth IC. - * - * @note A weak version of this function is included in the H4 driver, so - * defining it is optional per board. - * - * @param dev The device structure for the bus connecting to the IC - * - * @return 0 on success, negative error value on failure - */ -int bt_hci_transport_setup(const struct device *dev); - -/** - * @brief Teardown the HCI transport. - * - * @note A weak version of this function is included in the IPC driver, so - * defining it is optional. NRF5340 includes support to put network core - * in reset state. - * - * @param dev The device structure for the bus connecting to the IC - * - * @return 0 on success, negative error value on failure - */ -int bt_hci_transport_teardown(const struct device *dev); - -/** Allocate an HCI event buffer. - * - * This function allocates a new buffer for an HCI event. It is given the - * event code and the total length of the parameters. Upon successful return - * the buffer is ready to have the parameters encoded into it. - * - * @param evt Event OpCode. - * @param len Length of event parameters. - * - * @return Newly allocated buffer. - */ -struct net_buf *bt_hci_evt_create(uint8_t evt, uint8_t len); - -/** Allocate an HCI Command Complete event buffer. - * - * This function allocates a new buffer for HCI Command Complete event. - * It is given the OpCode (encoded e.g. using the BT_OP macro) and the total - * length of the parameters. Upon successful return the buffer is ready to have - * the parameters encoded into it. - * - * @param op Command OpCode. - * @param plen Length of command parameters. - * - * @return Newly allocated buffer. - */ -struct net_buf *bt_hci_cmd_complete_create(uint16_t op, uint8_t plen); - -/** Allocate an HCI Command Status event buffer. - * - * This function allocates a new buffer for HCI Command Status event. - * It is given the OpCode (encoded e.g. using the BT_OP macro) and the status - * code. Upon successful return the buffer is ready to have the parameters - * encoded into it. - * - * @param op Command OpCode. - * @param status Status code. - * - * @return Newly allocated buffer. - */ -struct net_buf *bt_hci_cmd_status_create(uint16_t op, uint8_t status); - -#ifdef __cplusplus -} -#endif - -/** - * @} - */ - -#endif /* ZEPHYR_INCLUDE_DRIVERS_BLUETOOTH_HCI_DRIVER_H_ */ diff --git a/subsys/bluetooth/controller/hci/hci.c b/subsys/bluetooth/controller/hci/hci.c index 8fffa01a3feaf..059b94d933d76 100644 --- a/subsys/bluetooth/controller/hci/hci.c +++ b/subsys/bluetooth/controller/hci/hci.c @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index f77710b3e08d0..ec5cdeb3f67e7 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include "common/assert.h" diff --git a/subsys/bluetooth/host/hci_common.c b/subsys/bluetooth/host/hci_common.c index a050b4915e979..1f382075d05f0 100644 --- a/subsys/bluetooth/host/hci_common.c +++ b/subsys/bluetooth/host/hci_common.c @@ -6,7 +6,7 @@ #include #include -#include +#include #include "common/assert.h" struct net_buf *bt_hci_evt_create(uint8_t evt, uint8_t len) diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 88eac980f0103..a2f72d3a70773 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -30,11 +30,7 @@ #include #include #include -#if DT_HAS_CHOSEN(zephyr_bt_hci) #include -#else -#include -#endif #include "common/bt_str.h" #include "common/assert.h" @@ -70,9 +66,20 @@ #include LOG_MODULE_REGISTER(bt_hci_core); -#define BT_HCI_DEV DT_CHOSEN(zephyr_bt_hci) -#define BT_HCI_BUS BT_DT_HCI_BUS_GET(BT_HCI_DEV) -#define BT_HCI_NAME BT_DT_HCI_NAME_GET(BT_HCI_DEV) +#if DT_HAS_CHOSEN(zephyr_bt_hci) +#define BT_HCI_NODE DT_CHOSEN(zephyr_bt_hci) +#define BT_HCI_DEV DEVICE_DT_GET(BT_HCI_NODE) +#define BT_HCI_BUS BT_DT_HCI_BUS_GET(BT_HCI_NODE) +#define BT_HCI_NAME BT_DT_HCI_NAME_GET(BT_HCI_NODE) +#define BT_HCI_QUIRKS BT_DT_HCI_QUIRKS_GET(BT_HCI_NODE) +#else +/* The zephyr,bt-hci chosen property is mandatory, except for unit tests */ +BUILD_ASSERT(IS_ENABLED(CONFIG_ZTEST), "Missing DT chosen property for HCI"); +#define BT_HCI_DEV NULL +#define BT_HCI_BUS 0 +#define BT_HCI_NAME "" +#define BT_HCI_QUIRKS 0 +#endif void bt_tx_irq_raise(void); @@ -96,9 +103,7 @@ struct bt_dev bt_dev = { #if defined(CONFIG_BT_DEVICE_APPEARANCE_DYNAMIC) .appearance = CONFIG_BT_DEVICE_APPEARANCE, #endif -#if DT_HAS_CHOSEN(zephyr_bt_hci) - .hci = DEVICE_DT_GET(BT_HCI_DEV), -#endif + .hci = BT_HCI_DEV, }; static bt_ready_cb_t ready_cb; @@ -126,28 +131,16 @@ static struct cmd_data cmd_data[CONFIG_BT_BUF_CMD_TX_COUNT]; #define cmd(buf) (&cmd_data[net_buf_id(buf)]) #define acl(buf) ((struct acl_data *)net_buf_user_data(buf)) -#if DT_HAS_CHOSEN(zephyr_bt_hci) static bool drv_quirk_no_reset(void) { - return ((BT_DT_HCI_QUIRKS_GET(DT_CHOSEN(zephyr_bt_hci)) & BT_HCI_QUIRK_NO_RESET) != 0); + return ((BT_HCI_QUIRKS & BT_HCI_QUIRK_NO_RESET) != 0); } bool bt_drv_quirk_no_auto_dle(void) { - return ((BT_DT_HCI_QUIRKS_GET(DT_CHOSEN(zephyr_bt_hci)) & BT_HCI_QUIRK_NO_AUTO_DLE) != 0); -} -#else -static bool drv_quirk_no_reset(void) -{ - return ((bt_dev.drv->quirks & BT_QUIRK_NO_RESET) != 0); + return ((BT_HCI_QUIRKS & BT_HCI_QUIRK_NO_AUTO_DLE) != 0); } -bool bt_drv_quirk_no_auto_dle(void) -{ - return ((bt_dev.drv->quirks & BT_QUIRK_NO_AUTO_DLE) != 0); -} -#endif - void bt_hci_cmd_state_set_init(struct net_buf *buf, struct bt_hci_cmd_state_set *state, atomic_t *target, int bit, bool val) @@ -4008,19 +4001,10 @@ static int hci_init(void) } #endif /* defined(CONFIG_BT_HCI_SET_PUBLIC_ADDR) */ -#if DT_HAS_CHOSEN(zephyr_bt_hci) err = bt_hci_setup(bt_dev.hci, &setup_params); if (err && err != -ENOSYS) { return err; } -#else - if (bt_dev.drv->setup) { - err = bt_dev.drv->setup(&setup_params); - if (err) { - return err; - } - } -#endif #endif /* defined(CONFIG_BT_HCI_SETUP) */ err = common_init(); @@ -4075,11 +4059,7 @@ int bt_send(struct net_buf *buf) return bt_hci_ecc_send(buf); } -#if DT_HAS_CHOSEN(zephyr_bt_hci) return bt_hci_send(bt_dev.hci, buf); -#else - return bt_dev.drv->send(buf); -#endif } static const struct event_handler prio_events[] = { @@ -4181,14 +4161,9 @@ static int bt_recv_unsafe(struct net_buf *buf) } } -#if DT_HAS_CHOSEN(zephyr_bt_hci) int bt_hci_recv(const struct device *dev, struct net_buf *buf) { ARG_UNUSED(dev); -#else -int bt_recv(struct net_buf *buf) -{ -#endif int err; k_sched_lock(); @@ -4198,29 +4173,6 @@ int bt_recv(struct net_buf *buf) return err; } -/* Old-style HCI driver registration */ -#if !DT_HAS_CHOSEN(zephyr_bt_hci) -int bt_hci_driver_register(const struct bt_hci_driver *drv) -{ - if (bt_dev.drv) { - return -EALREADY; - } - - if (!drv->open || !drv->send) { - return -EINVAL; - } - - bt_dev.drv = drv; - - LOG_DBG("Registered %s", drv->name ? drv->name : ""); - - bt_monitor_new_index(BT_MONITOR_TYPE_PRIMARY, drv->bus, - BT_ADDR_ANY, drv->name ? drv->name : "bt0"); - - return 0; -} -#endif /* !DT_HAS_CHOSEN(zephyr_bt_hci) */ - void bt_finalize_init(void) { atomic_set_bit(bt_dev.flags, BT_DEV_READY); @@ -4349,19 +4301,17 @@ int bt_enable(bt_ready_cb_t cb) { int err; -#if DT_HAS_CHOSEN(zephyr_bt_hci) + if (IS_ENABLED(CONFIG_ZTEST) && bt_dev.hci == NULL) { + LOG_ERR("No DT chosen property for HCI"); + return -ENODEV; + } + if (!device_is_ready(bt_dev.hci)) { LOG_ERR("HCI driver is not ready"); return -ENODEV; } bt_monitor_new_index(BT_MONITOR_TYPE_PRIMARY, BT_HCI_BUS, BT_ADDR_ANY, BT_HCI_NAME); -#else /* !DT_HAS_CHONSEN(zephyr_bt_hci) */ - if (!bt_dev.drv) { - LOG_ERR("No HCI driver registered"); - return -ENODEV; - } -#endif atomic_clear_bit(bt_dev.flags, BT_DEV_DISABLE); @@ -4403,11 +4353,7 @@ int bt_enable(bt_ready_cb_t cb) k_thread_name_set(&bt_workq.thread, "BT RX WQ"); #endif -#if DT_HAS_CHOSEN(zephyr_bt_hci) err = bt_hci_open(bt_dev.hci, bt_hci_recv); -#else - err = bt_dev.drv->open(); -#endif if (err) { LOG_ERR("HCI driver open failed (%d)", err); return err; @@ -4427,17 +4373,6 @@ int bt_disable(void) { int err; -#if !DT_HAS_CHOSEN(zephyr_bt_hci) - if (!bt_dev.drv) { - LOG_ERR("No HCI driver registered"); - return -ENODEV; - } - - if (!bt_dev.drv->close) { - return -ENOTSUP; - } -#endif - if (atomic_test_and_set_bit(bt_dev.flags, BT_DEV_DISABLE)) { return -EALREADY; } @@ -4465,16 +4400,13 @@ int bt_disable(void) disconnected_handles_reset(); #endif /* CONFIG_BT_CONN */ -#if DT_HAS_CHOSEN(zephyr_bt_hci) err = bt_hci_close(bt_dev.hci); if (err == -ENOSYS) { atomic_clear_bit(bt_dev.flags, BT_DEV_DISABLE); atomic_set_bit(bt_dev.flags, BT_DEV_READY); return -ENOTSUP; } -#else - err = bt_dev.drv->close(); -#endif + if (err) { LOG_ERR("HCI driver close failed (%d)", err); diff --git a/subsys/bluetooth/host/hci_core.h b/subsys/bluetooth/host/hci_core.h index fb7a69539fd7b..ac2bf9d297021 100644 --- a/subsys/bluetooth/host/hci_core.h +++ b/subsys/bluetooth/host/hci_core.h @@ -403,12 +403,7 @@ struct bt_dev { /* Queue for outgoing HCI commands */ struct k_fifo cmd_tx_queue; -#if DT_HAS_CHOSEN(zephyr_bt_hci) const struct device *hci; -#else - /* Registered HCI driver */ - const struct bt_hci_driver *drv; -#endif #if defined(CONFIG_BT_PRIVACY) /* Local Identity Resolving Key */ @@ -443,9 +438,7 @@ extern sys_slist_t bt_auth_info_cbs; enum bt_security_err bt_security_err_get(uint8_t hci_err); #endif /* CONFIG_BT_SMP || CONFIG_BT_CLASSIC */ -#if DT_HAS_CHOSEN(zephyr_bt_hci) int bt_hci_recv(const struct device *dev, struct net_buf *buf); -#endif /* Data type to store state related with command to be updated * when command completes successfully. diff --git a/subsys/bluetooth/host/hci_ecc.c b/subsys/bluetooth/host/hci_ecc.c index 39fc7ef47a2f5..017ed6b354ad5 100644 --- a/subsys/bluetooth/host/hci_ecc.c +++ b/subsys/bluetooth/host/hci_ecc.c @@ -27,11 +27,7 @@ #include #include #include -#if DT_HAS_CHOSEN(zephyr_bt_hci) #include -#else -#include -#endif #include "common/bt_str.h" @@ -102,11 +98,7 @@ static void send_cmd_status(uint16_t opcode, uint8_t status) evt->opcode = sys_cpu_to_le16(opcode); evt->status = status; -#if DT_HAS_CHOSEN(zephyr_bt_hci) bt_hci_recv(bt_dev.hci, buf); -#else - bt_recv(buf); -#endif } #if defined(CONFIG_BT_USE_PSA_API) @@ -217,11 +209,7 @@ static void emulate_le_p256_public_key_cmd(void) atomic_clear_bit(flags, PENDING_PUB_KEY); -#if DT_HAS_CHOSEN(zephyr_bt_hci) bt_hci_recv(bt_dev.hci, buf); -#else - bt_recv(buf); -#endif } static void emulate_le_generate_dhkey(void) @@ -303,11 +291,7 @@ static void emulate_le_generate_dhkey(void) atomic_clear_bit(flags, PENDING_DHKEY); -#if DT_HAS_CHOSEN(zephyr_bt_hci) bt_hci_recv(bt_dev.hci, buf); -#else - bt_recv(buf); -#endif } static void ecc_process(struct k_work *work) @@ -432,11 +416,7 @@ int bt_hci_ecc_send(struct net_buf *buf) } } -#if DT_HAS_CHOSEN(zephyr_bt_hci) return bt_hci_send(bt_dev.hci, buf); -#else - return bt_dev.drv->send(buf); -#endif } void bt_hci_ecc_supported_commands(uint8_t *supported_commands) diff --git a/subsys/bluetooth/host/hci_raw.c b/subsys/bluetooth/host/hci_raw.c index 984c8607ee653..0f0b93e99e686 100644 --- a/subsys/bluetooth/host/hci_raw.c +++ b/subsys/bluetooth/host/hci_raw.c @@ -11,11 +11,7 @@ #include #include -#if DT_HAS_CHOSEN(zephyr_bt_hci) #include -#else -#include -#endif #include #include #include @@ -53,40 +49,25 @@ NET_BUF_POOL_FIXED_DEFINE(hci_iso_pool, CONFIG_BT_ISO_TX_BUF_COUNT, sizeof(struct bt_buf_data), NULL); #endif /* CONFIG_BT_ISO */ -#define BT_HCI_DEV DT_CHOSEN(zephyr_bt_hci) -#define BT_HCI_BUS BT_DT_HCI_BUS_GET(BT_HCI_DEV) -#define BT_HCI_NAME BT_DT_HCI_NAME_GET(BT_HCI_DEV) - -struct bt_dev_raw bt_dev = { #if DT_HAS_CHOSEN(zephyr_bt_hci) - .hci = DEVICE_DT_GET(BT_HCI_DEV), +#define BT_HCI_NODE DT_CHOSEN(zephyr_bt_hci) +#define BT_HCI_DEV DEVICE_DT_GET(BT_HCI_NODE) +#define BT_HCI_BUS BT_DT_HCI_BUS_GET(BT_HCI_NODE) +#define BT_HCI_NAME BT_DT_HCI_NAME_GET(BT_HCI_NODE) +#else +/* The zephyr,bt-hci chosen property is mandatory, except for unit tests */ +BUILD_ASSERT(IS_ENABLED(CONFIG_ZTEST), "Missing DT chosen property for HCI"); +#define BT_HCI_DEV NULL +#define BT_HCI_BUS 0 +#define BT_HCI_NAME "" #endif + +struct bt_dev_raw bt_dev = { + .hci = BT_HCI_DEV, }; struct bt_hci_raw_cmd_ext *cmd_ext; static size_t cmd_ext_size; -#if !DT_HAS_CHOSEN(zephyr_bt_hci) -int bt_hci_driver_register(const struct bt_hci_driver *drv) -{ - if (bt_dev.drv) { - return -EALREADY; - } - - if (!drv->open || !drv->send) { - return -EINVAL; - } - - bt_dev.drv = drv; - - LOG_DBG("Registered %s", drv->name ? drv->name : ""); - - bt_monitor_new_index(BT_MONITOR_TYPE_PRIMARY, drv->bus, - BT_ADDR_ANY, drv->name ? drv->name : "bt0"); - - return 0; -} -#endif - struct net_buf *bt_buf_get_rx(enum bt_buf_type type, k_timeout_t timeout) { struct net_buf *buf; @@ -191,14 +172,10 @@ struct net_buf *bt_buf_get_evt(uint8_t evt, bool discardable, k_timeout_t timeou return bt_buf_get_rx(BT_BUF_EVT, timeout); } -#if DT_HAS_CHOSEN(zephyr_bt_hci) int bt_hci_recv(const struct device *dev, struct net_buf *buf) { ARG_UNUSED(dev); -#else -int bt_recv(struct net_buf *buf) -{ -#endif + LOG_DBG("buf %p len %u", buf, buf->len); bt_monitor_send(bt_monitor_opcode(buf), buf->data, buf->len); @@ -243,11 +220,7 @@ static void bt_cmd_complete_ext(uint16_t op, uint8_t status) cc = net_buf_add(buf, sizeof(*cc)); cc->status = status; -#if DT_HAS_CHOSEN(zephyr_bt_hci) bt_hci_recv(bt_dev.hci, buf); -#else - bt_recv(buf); -#endif } static uint8_t bt_send_ext(struct net_buf *buf) @@ -327,11 +300,7 @@ int bt_send(struct net_buf *buf) return bt_hci_ecc_send(buf); } -#if DT_HAS_CHOSEN(zephyr_bt_hci) return bt_hci_send(bt_dev.hci, buf); -#else - return bt_dev.drv->send(buf); -#endif } int bt_hci_raw_set_mode(uint8_t mode) @@ -375,7 +344,6 @@ int bt_enable_raw(struct k_fifo *rx_queue) raw_rx = rx_queue; -#if DT_HAS_CHOSEN(zephyr_bt_hci) if (!device_is_ready(bt_dev.hci)) { LOG_ERR("HCI driver is not ready"); return -ENODEV; @@ -384,16 +352,6 @@ int bt_enable_raw(struct k_fifo *rx_queue) bt_monitor_new_index(BT_MONITOR_TYPE_PRIMARY, BT_HCI_BUS, BT_ADDR_ANY, BT_HCI_NAME); err = bt_hci_open(bt_dev.hci, bt_hci_recv); -#else - const struct bt_hci_driver *drv = bt_dev.drv; - - if (!drv) { - LOG_ERR("No HCI driver registered"); - return -ENODEV; - } - - err = drv->open(); -#endif if (err) { LOG_ERR("HCI driver open failed (%d)", err); return err; diff --git a/subsys/bluetooth/host/hci_raw_internal.h b/subsys/bluetooth/host/hci_raw_internal.h index 6f1d711eedfcc..d652cc0ceabca 100644 --- a/subsys/bluetooth/host/hci_raw_internal.h +++ b/subsys/bluetooth/host/hci_raw_internal.h @@ -14,17 +14,10 @@ extern "C" { #endif struct bt_dev_raw { -#if DT_HAS_CHOSEN(zephyr_bt_hci) const struct device *hci; -#else - /* Registered HCI driver */ - const struct bt_hci_driver *drv; -#endif }; -#if DT_HAS_CHOSEN(zephyr_bt_hci) int bt_hci_recv(const struct device *dev, struct net_buf *buf); -#endif extern struct bt_dev_raw bt_dev; diff --git a/subsys/usb/device/class/bluetooth.c b/subsys/usb/device/class/bluetooth.c index 942a107615682..8acd749d8195d 100644 --- a/subsys/usb/device/class/bluetooth.c +++ b/subsys/usb/device/class/bluetooth.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include diff --git a/subsys/usb/device_next/class/bt_hci.c b/subsys/usb/device_next/class/bt_hci.c index 52eddc4e25b61..baca59db2b8c6 100644 --- a/subsys/usb/device_next/class/bt_hci.c +++ b/subsys/usb/device_next/class/bt_hci.c @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include From da713a2b86c00b1d3167e35a75debf16db5d0931 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 21 Nov 2024 23:03:22 +0200 Subject: [PATCH 2994/4482] doc: release-notes-4.1: Mention removal of deprecated HCI API Mention the removed deprecated Bluetooth HCI driver API. Signed-off-by: Johan Hedberg --- doc/releases/release-notes-4.1.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/releases/release-notes-4.1.rst b/doc/releases/release-notes-4.1.rst index dff3f100c2c51..b19ad21b0e7a4 100644 --- a/doc/releases/release-notes-4.1.rst +++ b/doc/releases/release-notes-4.1.rst @@ -27,6 +27,9 @@ API Changes Removed APIs in this release ============================ + * The deprecated Bluetooth HCI driver API has been removed. It has been replaced by a + :c:group:`new API` that follows the normal Zephyr driver model. + Deprecated in this release ========================== From 932e8708b194500a7468ab9d206861eeaaccb3f7 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Fri, 22 Nov 2024 07:10:17 -0500 Subject: [PATCH 2995/4482] tests: posix: single_process: correct typo and filter What looks to be a copy-paste typo was not caught in code review. Change .rwlocks to nothing and move the filter to the common area. Signed-off-by: Chris Friedt --- tests/posix/single_process/testcase.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/posix/single_process/testcase.yaml b/tests/posix/single_process/testcase.yaml index a8f8a54c1406c..ce226e9dc9daa 100644 --- a/tests/posix/single_process/testcase.yaml +++ b/tests/posix/single_process/testcase.yaml @@ -7,10 +7,10 @@ common: platform_key: - arch - simulation + min_flash: 64 + min_ram: 32 tests: - portability.single_process.rwlocks: - min_flash: 64 - min_ram: 32 + portability.single_process: {} portability.posix.single_process.minimal: extra_configs: - CONFIG_MINIMAL_LIBC=y From ae5609aef246811728bf7a1c973e8663e4ae85a3 Mon Sep 17 00:00:00 2001 From: Andrej Butok Date: Wed, 20 Nov 2024 12:11:00 +0100 Subject: [PATCH 2996/4482] samples: smp_svr: Move bluetooth tag to bt_tests Move "bluetooth" tag and harness from the common section of the smp_svr sample.yaml file to "bluetooth" specific test cases. Signed-off-by: Andrej Butok --- samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml index 058a5c581e87b..a4342cab66ed4 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml +++ b/samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml @@ -3,10 +3,10 @@ sample: name: smp svr common: sysbuild: true - harness: bluetooth - tags: bluetooth tests: sample.mcumgr.smp_svr.bt: + harness: bluetooth + tags: bluetooth extra_args: EXTRA_CONF_FILE="overlay-bt.conf" platform_allow: - nrf52dk/nrf52832 @@ -17,6 +17,8 @@ tests: - nrf52dk/nrf52832 - nrf52840dk/nrf52840 sample.mcumgr.smp_svr.bt_static_svc: + harness: bluetooth + tags: bluetooth extra_args: EXTRA_CONF_FILE="overlay-bt.conf" extra_configs: - CONFIG_MCUMGR_TRANSPORT_BT_DYNAMIC_SVC_REGISTRATION=n From 50f23500b8c62a7fca4d35f0b4ec9434ceab5fed Mon Sep 17 00:00:00 2001 From: Chen Xingyu Date: Wed, 20 Nov 2024 10:37:50 +0800 Subject: [PATCH 2997/4482] net: Fix warning of `size_t` formatting with `%.*s` This addresses the following warning building with `CONFIG_64BIT=y`: error: field precision specifier '.*' expects argument of type 'int', but argument X has type 'size_t' {aka 'long unsigned int'} Signed-off-by: Chen Xingyu --- subsys/net/lib/dns/resolve.c | 4 ++-- subsys/net/lib/wifi_credentials/wifi_credentials_shell.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/subsys/net/lib/dns/resolve.c b/subsys/net/lib/dns/resolve.c index 5b9402768da31..0e28439e5ca8b 100644 --- a/subsys/net/lib/dns/resolve.c +++ b/subsys/net/lib/dns/resolve.c @@ -424,7 +424,7 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, if (!ret) { if (servers[i] != NULL && servers[i][0] != '\0') { NET_DBG("Invalid server address %.*s", - server_len, servers[i]); + (int)server_len, servers[i]); } continue; @@ -432,7 +432,7 @@ static int dns_resolve_init_locked(struct dns_resolve_context *ctx, dns_postprocess_server(ctx, idx); - NET_DBG("[%d] %.*s%s%s%s%s", i, server_len, servers[i], + NET_DBG("[%d] %.*s%s%s%s%s", i, (int)server_len, servers[i], IS_ENABLED(CONFIG_MDNS_RESOLVER) ? (ctx->servers[i].is_mdns ? " mDNS" : "") : "", IS_ENABLED(CONFIG_LLMNR_RESOLVER) ? diff --git a/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c b/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c index 33731315f368d..c9652ba390cb5 100644 --- a/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c +++ b/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c @@ -34,20 +34,20 @@ static void print_network_info(void *cb_arg, const char *ssid, size_t ssid_len) shell_error(sh, "An error occurred when trying to load credentials for network \"%.*s\"" ". err: %d", - ssid_len, ssid, ret); + (int)ssid_len, ssid, ret); return; } shell_fprintf(sh, SHELL_VT100_COLOR_DEFAULT, - " network ssid: \"%.*s\", ssid_len: %d, type: %s", ssid_len, ssid, ssid_len, - wifi_security_txt(creds.header.type)); + " network ssid: \"%.*s\", ssid_len: %d, type: %s", (int)ssid_len, ssid, + ssid_len, wifi_security_txt(creds.header.type)); if (creds.header.type == WIFI_SECURITY_TYPE_PSK || creds.header.type == WIFI_SECURITY_TYPE_PSK_SHA256 || creds.header.type == WIFI_SECURITY_TYPE_SAE || creds.header.type == WIFI_SECURITY_TYPE_WPA_PSK) { shell_fprintf(sh, SHELL_VT100_COLOR_DEFAULT, - ", password: \"%.*s\", password_len: %d", creds.password_len, + ", password: \"%.*s\", password_len: %d", (int)creds.password_len, creds.password, creds.password_len); } From bb94c63fa2447af60d449fc1234c0cbb288168d5 Mon Sep 17 00:00:00 2001 From: Chen Xingyu Date: Wed, 20 Nov 2024 10:39:37 +0800 Subject: [PATCH 2998/4482] samples: subsys: ipc: Fix warning of `size_t` formatting with `%.*s` This addresses the following warning building with `CONFIG_64BIT=y`: error: field precision specifier '.*' expects argument of type 'int', but argument X has type 'size_t' {aka 'long unsigned int'} Signed-off-by: Chen Xingyu --- samples/subsys/ipc/openamp_rsc_table/src/main_remote.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/subsys/ipc/openamp_rsc_table/src/main_remote.c b/samples/subsys/ipc/openamp_rsc_table/src/main_remote.c index c8d12092ace05..a28e017e9be7a 100644 --- a/samples/subsys/ipc/openamp_rsc_table/src/main_remote.c +++ b/samples/subsys/ipc/openamp_rsc_table/src/main_remote.c @@ -299,7 +299,7 @@ void app_rpmsg_tty(void *arg1, void *arg2, void *arg3) k_sem_take(&data_tty_sem, K_FOREVER); if (tty_msg.len) { LOG_INF("[Linux TTY] incoming msg: %.*s", - tty_msg.len, (char *)tty_msg.data); + (int)tty_msg.len, (char *)tty_msg.data); snprintf(tx_buff, 13, "TTY 0x%04x: ", tty_ept.addr); memcpy(&tx_buff[12], tty_msg.data, tty_msg.len); rpmsg_send(&tty_ept, tx_buff, tty_msg.len + 12); From 1dd6d0db6785626b143d53e559d708725075ac9c Mon Sep 17 00:00:00 2001 From: Chen Xingyu Date: Wed, 20 Nov 2024 10:40:16 +0800 Subject: [PATCH 2999/4482] tests: subsys: mgmt: Fix warning of `size_t` formatting with `%.*s` This addresses the following warning building with `CONFIG_64BIT=y`: error: field precision specifier '.*' expects argument of type 'int', but argument X has type 'size_t' {aka 'long unsigned int'} Signed-off-by: Chen Xingyu --- tests/subsys/mgmt/mcumgr/zcbor_bulk/src/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/subsys/mgmt/mcumgr/zcbor_bulk/src/main.c b/tests/subsys/mgmt/mcumgr/zcbor_bulk/src/main.c index b1d3d79b30a18..1556beeb148ea 100644 --- a/tests/subsys/mgmt/mcumgr/zcbor_bulk/src/main.c +++ b/tests/subsys/mgmt/mcumgr/zcbor_bulk/src/main.c @@ -71,7 +71,7 @@ ZTEST(zcbor_bulk, test_correct) zassert_equal(sizeof("world") - 1, world.len, "Expected length %d", sizeof("world") - 1); zassert_equal(0, memcmp(world.value, "world", world.len), - "Expected \"world\", got %.*s", world.len, world.value); + "Expected \"world\", got %.*s", (int)world.len, world.value); zassert_true(bool_val, "Expected bool val == true"); } @@ -112,7 +112,7 @@ ZTEST(zcbor_bulk, test_correct_out_of_order) zassert_equal(sizeof("world") - 1, world.len, "Expected length %d", sizeof("world") - 1); zassert_equal(0, memcmp(world.value, "world", world.len), - "Expected \"world\", got %.*s", world.len, world.value); + "Expected \"world\", got %.*s", (int)world.len, world.value); zassert_true(bool_val, "Expected bool val == true"); } @@ -222,7 +222,7 @@ ZTEST(zcbor_bulk, test_bad_type_2) zassert_equal(sizeof("world") - 1, world.len, "Expected length %d", sizeof("world") - 1); zassert_equal(0, memcmp(world.value, "world", world.len), - "Expected \"world\", got %.*s", world.len, world.value); + "Expected \"world\", got %.*s", (int)world.len, world.value); zassert_false(bool_val, "Expected bool val unmodified"); } @@ -298,7 +298,7 @@ ZTEST(zcbor_bulk, test_duplicate) zassert_equal(sizeof("world") - 1, world.len, "Expected length %d", sizeof("world") - 1); zassert_equal(0, memcmp(world.value, "world", world.len), - "Expected \"world\", got %.*s", world.len, world.value); + "Expected \"world\", got %.*s", (int)world.len, world.value); zassert_false(bool_val, "Expected bool val unmodified"); } @@ -377,7 +377,7 @@ ZTEST(zcbor_bulk, test_map_in_map_correct) zassert_equal(sizeof("world") - 1, world.len, "Expected length %d", sizeof("world") - 1); zassert_equal(0, memcmp(world.value, "world", world.len), - "Expected \"world\", got %.*s", world.len, world.value); + "Expected \"world\", got %.*s", (int)world.len, world.value); zassert_true(bool_val, "Expected bool_val == true"); /* Map within map */ From b4893c46ce572d588498a2cba235db16a7ebfdbe Mon Sep 17 00:00:00 2001 From: Benedikt Schmidt Date: Mon, 11 Nov 2024 09:14:26 +0100 Subject: [PATCH 3000/4482] drivers: fpga: use defaults in iCE40 binding Replace the DT_INST_PROP_OR statements with defaults in the devicetree binding of the iCE40. Signed-off-by: Benedikt Schmidt --- drivers/fpga/fpga_ice40.c | 12 ++++-------- dts/bindings/fpga/lattice,ice40-fpga.yaml | 17 +++++++++-------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/drivers/fpga/fpga_ice40.c b/drivers/fpga/fpga_ice40.c index 22eba12e00210..bc251e5c3b1df 100644 --- a/drivers/fpga/fpga_ice40.c +++ b/drivers/fpga/fpga_ice40.c @@ -549,17 +549,13 @@ static int fpga_ice40_init(const struct device *dev) #define FPGA_ICE40_BUS_FREQ(inst) DT_INST_PROP(inst, spi_max_frequency) -#define FPGA_ICE40_CONFIG_DELAY_US(inst) \ - DT_INST_PROP_OR(inst, config_delay_us, FPGA_ICE40_CONFIG_DELAY_US_MIN) +#define FPGA_ICE40_CONFIG_DELAY_US(inst) DT_INST_PROP(inst, config_delay_us) -#define FPGA_ICE40_CRESET_DELAY_US(inst) \ - DT_INST_PROP_OR(inst, creset_delay_us, FPGA_ICE40_CRESET_DELAY_US_MIN) +#define FPGA_ICE40_CRESET_DELAY_US(inst) DT_INST_PROP(inst, creset_delay_us) -#define FPGA_ICE40_LEADING_CLOCKS(inst) \ - DT_INST_PROP_OR(inst, leading_clocks, FPGA_ICE40_LEADING_CLOCKS_MIN) +#define FPGA_ICE40_LEADING_CLOCKS(inst) DT_INST_PROP(inst, leading_clocks) -#define FPGA_ICE40_TRAILING_CLOCKS(inst) \ - DT_INST_PROP_OR(inst, trailing_clocks, FPGA_ICE40_TRAILING_CLOCKS_MIN) +#define FPGA_ICE40_TRAILING_CLOCKS(inst) DT_INST_PROP(inst, trailing_clocks) #define FPGA_ICE40_MHZ_DELAY_COUNT(inst) DT_INST_PROP_OR(inst, mhz_delay_count, 0) diff --git a/dts/bindings/fpga/lattice,ice40-fpga.yaml b/dts/bindings/fpga/lattice,ice40-fpga.yaml index 2e8cb010d271c..6355092f60090 100644 --- a/dts/bindings/fpga/lattice,ice40-fpga.yaml +++ b/dts/bindings/fpga/lattice,ice40-fpga.yaml @@ -69,25 +69,26 @@ properties: mhz-delay-count = <0>; creset-delay-us: type: int + default: 1 description: | Delay (in microseconds) between asserting CRESET_B and releasing CRESET_B. - Example usage / default: - creset-delay-us = <1>; + The datasheet specifies a minimum of 200ns, therefore the default is set + to 1us. config-delay-us: type: int + default: 1200 description: | Delay (in microseconds) after releasing CRESET_B to clear internal configuration memory. - Example usage / default: - config-delay-us = <1200>; + The datasheet specifies a minimum of 1200us, which is the default. leading-clocks: type: int + default: 8 description: | Prior to sending the bitstream, issue this number of leading clocks with SPI_CS pulled high. - Example usage / default: - leading-clocks = <8>; + The datasheet specifies 8 dummy cycles, which is the default. trailing-clocks: type: int + default: 49 description: | After sending the bitstream, issue this number of trailing clocks with SPI_CS pulled high. - Example usage / default: - trailing-clocks = <49>; + The datasheet specifies 49 dummy cycles, which is the default. From 585fb2a61bd1b489753e5efb777e7bcfdb0caf0b Mon Sep 17 00:00:00 2001 From: Filip Kokosinski Date: Tue, 12 Nov 2024 14:21:25 +0100 Subject: [PATCH 3001/4482] boards/arduino/portenta_h7: enable USART1 on M4 Right now, USART1 is enabled on the M7 target variant by default, leaving M4 without a UART to use; this is the way this port was originally contributed. Since then, USB was enabled on M7, changing the console backend from USART1 to USB CDC ACM; the M4 target was left unchanged. This commit enabled USART1 on the M4 variant and disabled it on the M7 variant, so that the M4 variant can use it as its console backend. Note that, for the M4 variant, USART1 has been assigned to `zephyr,console` and `zephyr,shell-uart` since this port was contributed, even though USART1 was always disabled on M4. Signed-off-by: Filip Kokosinski --- .../portenta_h7/arduino_portenta_h7_stm32h747xx_m4.dts | 2 +- .../arduino_portenta_h7_stm32h747xx_m4_defconfig | 10 ++++------ .../portenta_h7/arduino_portenta_h7_stm32h747xx_m7.dts | 4 ++-- .../arduino_portenta_h7_stm32h747xx_m7_defconfig | 6 +----- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m4.dts b/boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m4.dts index 12190a28715b3..3e1352834819d 100644 --- a/boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m4.dts +++ b/boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m4.dts @@ -28,5 +28,5 @@ }; &usart1 { - status = "disabled"; + status = "okay"; }; diff --git a/boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m4_defconfig b/boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m4_defconfig index 8a931846ae78a..768c0b2c03dce 100644 --- a/boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m4_defconfig +++ b/boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m4_defconfig @@ -10,9 +10,7 @@ CONFIG_ARM_MPU=y # Enable HW stack protection CONFIG_HW_STACK_PROTECTION=y -# Enable uart driver -# CONFIG_SERIAL=y - -# By default CONSOLE is assigned to m7 -# CONFIG_CONSOLE=y -# CONFIG_UART_CONSOLE=y +# On M4, USART1 is used as the UART console backend by default +CONFIG_SERIAL=y +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y diff --git a/boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m7.dts b/boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m7.dts index 4b43bb6cbd4f8..30b5b06db2720 100644 --- a/boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m7.dts +++ b/boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m7.dts @@ -80,9 +80,9 @@ clock-frequency = ; }; - +/* USART1 is enabled on M4 by default */ &usart1 { - status = "okay"; + status = "disabled"; }; &i2c1 { diff --git a/boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m7_defconfig b/boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m7_defconfig index ff4b2954d027c..06d55f8db39ac 100644 --- a/boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m7_defconfig +++ b/boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m7_defconfig @@ -16,12 +16,8 @@ CONFIG_HW_STACK_PROTECTION=y # Use zephyr,code-partition as flash offset CONFIG_USE_DT_CODE_PARTITION=y -# Disable following to assign serial ports to m4 core - -# Enable uart driver +# On M7, USB CDC ACM is used as the UART console backend by default CONFIG_SERIAL=y - -# Enable console CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y CONFIG_UART_LINE_CTRL=y From 4fe6d476832dc3972bf95260851da6ce73728880 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Thu, 24 Oct 2024 09:57:09 +0200 Subject: [PATCH 3002/4482] boards: arduino_nicla_vision: fix hardware information The board shares many features with other Arduinos based on STM32H747 (like the HSE in bypass mode). Once https://github.com/zephyrproject-rtos/zephyr/pull/76542 is merged, PF1550 support should be added too to allow switching IO voltage from 3v3 to 1v8 Signed-off-by: Martino Facchin --- .../arduino_nicla_vision_stm32h747xx_m7.dts | 41 +++++++++++++++---- boards/arduino/nicla_vision/board_gpio_hse.c | 30 ++++++++++++++ 2 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 boards/arduino/nicla_vision/board_gpio_hse.c diff --git a/boards/arduino/nicla_vision/arduino_nicla_vision_stm32h747xx_m7.dts b/boards/arduino/nicla_vision/arduino_nicla_vision_stm32h747xx_m7.dts index 1fe8d2f961099..0028128f8e231 100644 --- a/boards/arduino/nicla_vision/arduino_nicla_vision_stm32h747xx_m7.dts +++ b/boards/arduino/nicla_vision/arduino_nicla_vision_stm32h747xx_m7.dts @@ -25,14 +25,6 @@ zephyr,camera = &dcmi; }; - sdram1: sdram@c0000000 { - compatible = "zephyr,memory-region", "mmio-sram"; - device_type = "memory"; - reg = <0xc0000000 DT_SIZE_M(8)>; - zephyr,memory-region = "SDRAM1"; - zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_RAM) )>; - }; - aliases { led0 = &red_led; led1 = &green_led; @@ -46,10 +38,12 @@ &clk_hse { status = "okay"; + hse-bypass; clock-frequency = ; }; &clk_lse { + lse-bypass; status = "okay"; }; @@ -164,6 +158,37 @@ }; }; +&quadspi { + pinctrl-0 = <&quadspi_clk_pf10 &quadspi_bk1_ncs_pg6 + &quadspi_bk1_io0_pd11 &quadspi_bk1_io1_pf9 + &quadspi_bk1_io2_pe2 &quadspi_bk1_io3_pd13>; + pinctrl-names = "default"; + status = "okay"; + + n25q128a1: qspi-nor-flash@90000000 { + compatible = "st,stm32-qspi-nor"; + reg = <0x90000000 DT_SIZE_M(16)>; /* 128 Mbits */ + qspi-max-frequency = <72000000>; + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + slot1_partition: partition@0 { + label = "image-1"; + reg = <0x00000000 DT_SIZE_M(1)>; + }; + + storage_partition: partition@100000 { + label = "storage"; + reg = <0x00100000 DT_SIZE_M(15)>; + }; + }; + }; +}; + &rng { status = "okay"; }; diff --git a/boards/arduino/nicla_vision/board_gpio_hse.c b/boards/arduino/nicla_vision/board_gpio_hse.c new file mode 100644 index 0000000000000..caeca006ad5e9 --- /dev/null +++ b/boards/arduino/nicla_vision/board_gpio_hse.c @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024 DNDG srl + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +static int board_gpio_hse(void) +{ + /* The external oscillator that drives the HSE clock should be enabled + * by setting the GPIOH1 pin. This function is registered at priority + * RE_KERNEL_1 to be executed before the standard STM clock + * setup code. + */ + + LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOH); + + LL_GPIO_SetPinMode(GPIOH, LL_GPIO_PIN_1, LL_GPIO_MODE_OUTPUT); + LL_GPIO_SetPinSpeed(GPIOH, LL_GPIO_PIN_1, LL_GPIO_SPEED_FREQ_LOW); + LL_GPIO_SetPinOutputType(GPIOH, LL_GPIO_PIN_1, LL_GPIO_OUTPUT_PUSHPULL); + LL_GPIO_SetPinPull(GPIOH, LL_GPIO_PIN_1, LL_GPIO_PULL_UP); + LL_GPIO_SetOutputPin(GPIOH, LL_GPIO_PIN_1); + + return 0; +} + +SYS_INIT(board_gpio_hse, PRE_KERNEL_1, 0); From 81bb231fd07971156d487d6603920a5576fd71ad Mon Sep 17 00:00:00 2001 From: Dominik Kilian Date: Wed, 23 Oct 2024 14:28:19 +0200 Subject: [PATCH 3003/4482] ipc: icbmsg: Reduce block alignment to 32-bits The ICBMsg backend divides its memory into blocks. Each block is aligned to data cache alignment. Is it not required, since adjacent blocks has the same data flow direction (either read-only or write-only). This commit changes it to 32-bits making wasted memory significantly reduced. Signed-off-by: Dominik Kilian --- subsys/ipc/ipc_service/backends/ipc_icbmsg.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c index 395931d9cd467..7e985aa76deb0 100644 --- a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c +++ b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c @@ -1296,6 +1296,11 @@ const static struct ipc_service_backend backend_ops = { .release_rx_buffer = release_rx_buffer, }; +/** + * Required block alignment. + */ +#define BLOCK_ALIGNMENT sizeof(uint32_t) + /** * Number of bytes per each ICMsg message. It is used to calculate size of ICMsg area. */ @@ -1309,10 +1314,10 @@ const static struct ipc_service_backend backend_ops = { (PBUF_HEADER_OVERHEAD(GET_CACHE_ALIGNMENT(i)) + 2 * BYTES_PER_ICMSG_MESSAGE) /** - * Returns required block alignment for instance "i". + * Returns required data cache alignment for instance "i". */ #define GET_CACHE_ALIGNMENT(i) \ - MAX(sizeof(uint32_t), DT_INST_PROP_OR(i, dcache_alignment, 0)) + MAX(BLOCK_ALIGNMENT, DT_INST_PROP_OR(i, dcache_alignment, 0)) /** * Calculates minimum size required for ICMsg region for specific number of local @@ -1320,9 +1325,9 @@ const static struct ipc_service_backend backend_ops = { * because it can hold data message for each local block and release message * for each remote block. */ -#define GET_ICMSG_MIN_SIZE(i, local_blocks, remote_blocks) \ +#define GET_ICMSG_MIN_SIZE(i, local_blocks, remote_blocks) ROUND_UP( \ (ICMSG_BUFFER_OVERHEAD(i) + BYTES_PER_ICMSG_MESSAGE * \ - (local_blocks + remote_blocks)) + (local_blocks + remote_blocks)), GET_CACHE_ALIGNMENT(i)) /** * Calculate aligned block size by evenly dividing remaining space after removing @@ -1330,7 +1335,7 @@ const static struct ipc_service_backend backend_ops = { */ #define GET_BLOCK_SIZE(i, total_size, local_blocks, remote_blocks) ROUND_DOWN( \ ((total_size) - GET_ICMSG_MIN_SIZE(i, (local_blocks), (remote_blocks))) / \ - (local_blocks), GET_CACHE_ALIGNMENT(i)) + (local_blocks), BLOCK_ALIGNMENT) /** * Calculate offset where area for blocks starts which is just after the ICMsg. @@ -1435,11 +1440,11 @@ const static struct ipc_service_backend backend_ops = { }; \ BUILD_ASSERT(IS_POWER_OF_TWO(GET_CACHE_ALIGNMENT(i)), \ "This module supports only power of two cache alignment"); \ - BUILD_ASSERT((GET_BLOCK_SIZE_INST(i, tx, rx) >= GET_CACHE_ALIGNMENT(i)) && \ + BUILD_ASSERT((GET_BLOCK_SIZE_INST(i, tx, rx) >= BLOCK_ALIGNMENT) && \ (GET_BLOCK_SIZE_INST(i, tx, rx) < \ GET_MEM_SIZE_INST(i, tx)), \ "TX region is too small for provided number of blocks"); \ - BUILD_ASSERT((GET_BLOCK_SIZE_INST(i, rx, tx) >= GET_CACHE_ALIGNMENT(i)) && \ + BUILD_ASSERT((GET_BLOCK_SIZE_INST(i, rx, tx) >= BLOCK_ALIGNMENT) && \ (GET_BLOCK_SIZE_INST(i, rx, tx) < \ GET_MEM_SIZE_INST(i, rx)), \ "RX region is too small for provided number of blocks"); \ From 18a2a63a25b38788050ec307a60b15817a28733c Mon Sep 17 00:00:00 2001 From: Lucien Zhao Date: Sun, 1 Sep 2024 23:17:32 +0800 Subject: [PATCH 3004/4482] dts: arm: nxp: rt118x: add flexpwm instances add 4 flexpwm instances update clock driver to adapt flexpwm clock structure Signed-off-by: Lucien Zhao --- .../clock_control_mcux_ccm_rev2.c | 8 +- dts/arm/nxp/nxp_rt118x.dtsi | 185 ++++++++++++++++++ 2 files changed, 192 insertions(+), 1 deletion(-) diff --git a/drivers/clock_control/clock_control_mcux_ccm_rev2.c b/drivers/clock_control/clock_control_mcux_ccm_rev2.c index 703c9f1c7af5b..f0059a962405d 100644 --- a/drivers/clock_control/clock_control_mcux_ccm_rev2.c +++ b/drivers/clock_control/clock_control_mcux_ccm_rev2.c @@ -111,10 +111,16 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev, #endif #ifdef CONFIG_PWM_MCUX +#if defined(CONFIG_SOC_SERIES_IMXRT118X) + case IMX_CCM_PWM_CLK: + clock_root = kCLOCK_Root_Bus_Aon; + break; +#else case IMX_CCM_PWM_CLK: clock_root = kCLOCK_Root_Bus; break; -#endif +#endif /* CONFIG_SOC_SERIES_IMXRT118X */ +#endif /* CONFIG_PWM_MCUX */ #ifdef CONFIG_CAN_MCUX_FLEXCAN case IMX_CCM_CAN1_CLK: diff --git a/dts/arm/nxp/nxp_rt118x.dtsi b/dts/arm/nxp/nxp_rt118x.dtsi index 0e511bac5dee9..db58d532d182a 100644 --- a/dts/arm/nxp/nxp_rt118x.dtsi +++ b/dts/arm/nxp/nxp_rt118x.dtsi @@ -8,6 +8,7 @@ #include #include #include +#include / { cpus { @@ -663,6 +664,190 @@ resolution = <32>; status = "disabled"; }; + + flexpwm1: flexpwm@2650000 { + compatible = "nxp,flexpwm"; + reg = <0x2650000 0x4000>; + interrupts = <23 0>; + + flexpwm1_pwm0: flexpwm1_pwm0 { + compatible = "nxp,imx-pwm"; + index = <0>; + interrupts = <24 0>; + #pwm-cells = <3>; + clocks = <&ccm IMX_CCM_PWM_CLK 0 0>; + nxp,prescaler = <128>; + status = "disabled"; + }; + + flexpwm1_pwm1: flexpwm1_pwm1 { + compatible = "nxp,imx-pwm"; + index = <1>; + interrupts = <25 0>; + #pwm-cells = <3>; + clocks = <&ccm IMX_CCM_PWM_CLK 0 0>; + nxp,prescaler = <128>; + status = "disabled"; + }; + + flexpwm1_pwm2: flexpwm1_pwm2 { + compatible = "nxp,imx-pwm"; + index = <2>; + interrupts = <26 0>; + #pwm-cells = <3>; + clocks = <&ccm IMX_CCM_PWM_CLK 0 0>; + nxp,prescaler = <128>; + status = "disabled"; + }; + + flexpwm1_pwm3: flexpwm1_pwm3 { + compatible = "nxp,imx-pwm"; + index = <3>; + interrupts = <27 0>; + #pwm-cells = <3>; + clocks = <&ccm IMX_CCM_PWM_CLK 0 0>; + nxp,prescaler = <128>; + status = "disabled"; + }; + }; + + flexpwm2: flexpwm@2660000 { + compatible = "nxp,flexpwm"; + reg = <0x2660000 0x4000>; + interrupts = <170 0>; + + flexpwm2_pwm0: flexpwm2_pwm0 { + compatible = "nxp,imx-pwm"; + index = <0>; + interrupts = <171 0>; + #pwm-cells = <3>; + clocks = <&ccm IMX_CCM_PWM_CLK 0 0>; + nxp,prescaler = <128>; + status = "disabled"; + }; + + flexpwm2_pwm1: flexpwm2_pwm1 { + compatible = "nxp,imx-pwm"; + index = <1>; + interrupts = <172 0>; + #pwm-cells = <3>; + clocks = <&ccm IMX_CCM_PWM_CLK 0 0>; + nxp,prescaler = <128>; + status = "disabled"; + }; + + flexpwm2_pwm2: flexpwm2_pwm2 { + compatible = "nxp,imx-pwm"; + index = <2>; + interrupts = <173 0>; + #pwm-cells = <3>; + clocks = <&ccm IMX_CCM_PWM_CLK 0 0>; + nxp,prescaler = <128>; + status = "disabled"; + }; + + flexpwm2_pwm3: flexpwm2_pwm3 { + compatible = "nxp,imx-pwm"; + index = <3>; + interrupts = <174 0>; + #pwm-cells = <3>; + clocks = <&ccm IMX_CCM_PWM_CLK 0 0>; + nxp,prescaler = <128>; + status = "disabled"; + }; + }; + + flexpwm3: flexpwm@2670000 { + compatible = "nxp,flexpwm"; + reg = <0x2670000 0x4000>; + interrupts = <175 0>; + + flexpwm3_pwm0: flexpwm3_pwm0 { + compatible = "nxp,imx-pwm"; + index = <0>; + interrupts = <176 0>; + #pwm-cells = <3>; + clocks = <&ccm IMX_CCM_PWM_CLK 0 0>; + nxp,prescaler = <128>; + status = "disabled"; + }; + + flexpwm3_pwm1: flexpwm3_pwm1 { + compatible = "nxp,imx-pwm"; + index = <1>; + interrupts = <177 0>; + #pwm-cells = <3>; + clocks = <&ccm IMX_CCM_PWM_CLK 0 0>; + nxp,prescaler = <128>; + status = "disabled"; + }; + + flexpwm3_pwm2: flexpwm3_pwm2 { + compatible = "nxp,imx-pwm"; + index = <2>; + interrupts = <178 0>; + #pwm-cells = <3>; + clocks = <&ccm IMX_CCM_PWM_CLK 0 0>; + nxp,prescaler = <128>; + status = "disabled"; + }; + + flexpwm3_pwm3: flexpwm3_pwm3 { + compatible = "nxp,imx-pwm"; + index = <3>; + interrupts = <179 0>; + #pwm-cells = <3>; + clocks = <&ccm IMX_CCM_PWM_CLK 0 0>; + nxp,prescaler = <128>; + status = "disabled"; + }; + }; + + flexpwm4: flexpwm@2680000 { + compatible = "nxp,flexpwm"; + reg = <0x2680000 0x4000>; + interrupts = <180 0>; + + flexpwm4_pwm0: flexpwm4_pwm0 { + compatible = "nxp,imx-pwm"; + index = <0>; + interrupts = <181 0>; + #pwm-cells = <3>; + clocks = <&ccm IMX_CCM_PWM_CLK 0 0>; + nxp,prescaler = <128>; + status = "disabled"; + }; + + flexpwm4_pwm1: flexpwm4_pwm1 { + compatible = "nxp,imx-pwm"; + index = <1>; + interrupts = <182 0>; + #pwm-cells = <3>; + clocks = <&ccm IMX_CCM_PWM_CLK 0 0>; + nxp,prescaler = <128>; + status = "disabled"; + }; + + flexpwm4_pwm2: flexpwm4_pwm2 { + compatible = "nxp,imx-pwm"; + index = <2>; + interrupts = <183 0>; + #pwm-cells = <3>; + clocks = <&ccm IMX_CCM_PWM_CLK 0 0>; + nxp,prescaler = <128>; + status = "disabled"; + }; + + flexpwm4_pwm3: flexpwm4_pwm3 { + compatible = "nxp,imx-pwm"; + index = <3>; + interrupts = <184 0>; + #pwm-cells = <3>; + clocks = <&ccm IMX_CCM_PWM_CLK 0 0>; + nxp,prescaler = <128>; + status = "disabled"; + }; + }; }; &flexspi { From 74d1f60fafa1d1970a94a0b4043826e1f5e0fd76 Mon Sep 17 00:00:00 2001 From: Lucien Zhao Date: Sun, 1 Sep 2024 23:21:56 +0800 Subject: [PATCH 3005/4482] boards: mimxrt1180_evk: Enable PWM for RT1180 EVK Enables PWM for RT1180 EVK. Tested with sample led_pwm Signed-off-by: Lucien Zhao --- boards/nxp/mimxrt1180_evk/doc/index.rst | 2 ++ .../nxp/mimxrt1180_evk/mimxrt1180_evk-pinctrl.dtsi | 8 ++++++++ boards/nxp/mimxrt1180_evk/mimxrt1180_evk.dtsi | 14 ++++++++++++++ .../mimxrt1180_evk_mimxrt1189_cm33.yaml | 1 + .../mimxrt1180_evk_mimxrt1189_cm7.yaml | 1 + 5 files changed, 26 insertions(+) diff --git a/boards/nxp/mimxrt1180_evk/doc/index.rst b/boards/nxp/mimxrt1180_evk/doc/index.rst index c8f1147d0b014..012cb9407ada5 100644 --- a/boards/nxp/mimxrt1180_evk/doc/index.rst +++ b/boards/nxp/mimxrt1180_evk/doc/index.rst @@ -114,6 +114,8 @@ configuration supports the following hardware features: +-----------+------------+-------------------------------------+ | FLEXSPI | on-chip | flash programming | +-----------+------------+-------------------------------------+ +| PWM | on-chip | pwm | ++-----------+------------+-------------------------------------+ The default configuration can be found in the defconfig file: :zephyr_file:`boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm33_defconfig` diff --git a/boards/nxp/mimxrt1180_evk/mimxrt1180_evk-pinctrl.dtsi b/boards/nxp/mimxrt1180_evk/mimxrt1180_evk-pinctrl.dtsi index 81ac3b1eb210e..29687171a5073 100644 --- a/boards/nxp/mimxrt1180_evk/mimxrt1180_evk-pinctrl.dtsi +++ b/boards/nxp/mimxrt1180_evk/mimxrt1180_evk-pinctrl.dtsi @@ -129,4 +129,12 @@ input-enable; }; }; + + pinmux_flexpwm2: pinmux_flexpwm2 { + group0 { + pinmux = <&iomuxc_gpio_ad_27_flexpwm2_pwm1_b>; + drive-strength = "high"; + slew-rate = "fast"; + }; + }; }; diff --git a/boards/nxp/mimxrt1180_evk/mimxrt1180_evk.dtsi b/boards/nxp/mimxrt1180_evk/mimxrt1180_evk.dtsi index 725b5439e996c..3f71d74a762b5 100644 --- a/boards/nxp/mimxrt1180_evk/mimxrt1180_evk.dtsi +++ b/boards/nxp/mimxrt1180_evk/mimxrt1180_evk.dtsi @@ -11,6 +11,7 @@ aliases { led0 = &green_led; sw0 = &user_button; + pwm-led0 = &green_pwm_led; }; leds { @@ -29,6 +30,13 @@ zephyr,code = ; }; }; + + pwmleds { + compatible = "pwm-leds"; + green_pwm_led: green_pwm_led { + pwms = <&flexpwm2_pwm1 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>; + }; + }; }; &lpuart1 { @@ -125,3 +133,9 @@ max-bitrate = <5000000>; }; }; + +&flexpwm2_pwm1 { + status = "okay"; + pinctrl-0 = <&pinmux_flexpwm2>; + pinctrl-names = "default"; +}; diff --git a/boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm33.yaml b/boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm33.yaml index add9a84abc6a9..639b19be76818 100644 --- a/boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm33.yaml +++ b/boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm33.yaml @@ -22,4 +22,5 @@ supported: - adc - netif:eth - can + - pwm vendor: nxp diff --git a/boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm7.yaml b/boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm7.yaml index 4323dc8ac974b..e69b1ca1feee1 100644 --- a/boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm7.yaml +++ b/boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm7.yaml @@ -21,4 +21,5 @@ supported: - counter - adc - can + - pwm vendor: nxp From a72244f2d0644a261cc6318ec07a4f597dffac57 Mon Sep 17 00:00:00 2001 From: Dmitrii Golovanov Date: Thu, 17 Oct 2024 09:02:35 +0200 Subject: [PATCH 3006/4482] twister: ztest: harness: Fix missed TestCase statuses Fix a problem of Ztest suite names not taken into account by Twister to identify a TestCase, so in some situations a Ztest test's status was not assigned to the proper TestCase and it remains 'None' whereas the actual status value lost, eventually the resulting total execution counters not correct. The issue was observed in these situations: * Ztest application with multiple test suites having same test names. * Ztest suite is 'skipped' entirely on execution with all its tests. The proposed solution extends Twister test case name for Ztest to include Ztest suite name, so the resulting identifier looks like: `..` The above naming scheme now requires ztest_suite_name part to be provided for `--sub-test` command line option. Testcase identifiers in twister.json and testplan.json will also include ztest_suite_name component. The Twister Ztest(Test) Harness is improved to track all state changes known from the test application's log for Ztest suites and test cases, so now it parses log output from a Ztest application more scurpulously. Regular expressions to match log records are extended and optimized to compile them only once and, in some cases, fixed (suite summary). Signed-off-by: Dmitrii Golovanov --- .../pylib/twister/twisterlib/environment.py | 24 ++- scripts/pylib/twister/twisterlib/harness.py | 159 ++++++++++++++---- scripts/pylib/twister/twisterlib/runner.py | 11 +- scripts/pylib/twister/twisterlib/testsuite.py | 12 +- scripts/tests/twister/test_harness.py | 39 ++++- scripts/tests/twister/test_runner.py | 16 +- scripts/tests/twister/test_testplan.py | 5 +- scripts/tests/twister/test_testsuite.py | 2 +- scripts/tests/twister_blackbox/test_config.py | 7 +- .../tests/dummy/agnostic/group2/src/main.c | 7 + scripts/tests/twister_blackbox/test_filter.py | 16 +- .../tests/twister_blackbox/test_platform.py | 4 +- .../tests/twister_blackbox/test_printouts.py | 28 +-- scripts/tests/twister_blackbox/test_report.py | 6 +- scripts/tests/twister_blackbox/test_runner.py | 4 +- .../tests/twister_blackbox/test_shuffle.py | 10 +- .../tests/twister_blackbox/test_testlist.py | 3 +- .../tests/twister_blackbox/test_testplan.py | 11 +- 18 files changed, 254 insertions(+), 110 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/environment.py b/scripts/pylib/twister/twisterlib/environment.py index 2b330caf2ab33..9f41d24b541aa 100644 --- a/scripts/pylib/twister/twisterlib/environment.py +++ b/scripts/pylib/twister/twisterlib/environment.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: set syntax=python ts=4 : # -# Copyright (c) 2018 Intel Corporation +# Copyright (c) 2018-2024 Intel Corporation # Copyright 2022 NXP # Copyright (c) 2024 Arm Limited (or its affiliates). All rights reserved. # @@ -149,7 +149,8 @@ def add_parse_arguments(parser = None): test_plan_report_xor.add_argument("--list-tests", action="store_true", help="""List of all sub-test functions recursively found in all --testsuite-root arguments. Note different sub-tests can share - the same section name and come from different directories. + the same test scenario identifier (section.subsection) + and come from different directories. The output is flattened and reports --sub-test names only, not their directories. For instance net.socket.getaddrinfo_ok and net.socket.fd_set belong to different directories. @@ -239,17 +240,22 @@ def add_parse_arguments(parser = None): test_xor_subtest.add_argument( "-s", "--test", "--scenario", action="append", type = norm_path, - help="Run only the specified testsuite scenario. These are named by " - "") + help="""Run only the specified test suite scenario. These are named by + 'path/relative/to/Zephyr/base/section.subsection_in_testcase_yaml', + or just 'section.subsection' identifier. With '--testsuite-root' option + the scenario will be found faster. + """) test_xor_subtest.add_argument( "--sub-test", action="append", - help="""Recursively find sub-test functions and run the entire - test section where they were found, including all sibling test + help="""Recursively find sub-test functions (test cases) and run the entire + test scenario (section.subsection) where they were found, including all sibling test functions. Sub-tests are named by: - section.name.in.testcase.yaml.function_name_without_test_prefix - Example: In kernel.fifo.fifo_loop: 'kernel.fifo' is a section name - and 'fifo_loop' is a name of a function found in main.c without test prefix. + 'section.subsection_in_testcase_yaml.ztest_suite.ztest_without_test_prefix'. + Example_1: 'kernel.fifo.fifo_api_1cpu.fifo_loop' where 'kernel.fifo' is a test scenario + name (section.subsection) and 'fifo_api_1cpu.fifo_loop' is + a Ztest suite_name.test_name identificator. + Example_2: 'debug.coredump.logging_backend' is a standalone test scenario name. """) parser.add_argument( diff --git a/scripts/pylib/twister/twisterlib/harness.py b/scripts/pylib/twister/twisterlib/harness.py index 2629cdfb83faf..cd2655e927f93 100644 --- a/scripts/pylib/twister/twisterlib/harness.py +++ b/scripts/pylib/twister/twisterlib/harness.py @@ -31,7 +31,6 @@ _WINDOWS = platform.system() == 'Windows' -result_re = re.compile(r".*(PASS|FAIL|SKIP) - (test_)?(\S*) in (\d*[.,]?\d*) seconds") class Harness: GCOV_START = "GCOV_COVERAGE_DUMP_START" GCOV_END = "GCOV_COVERAGE_DUMP_END" @@ -59,12 +58,19 @@ def __init__(self): self.ztest = False self.detected_suite_names = [] self.run_id = None + self.started_suites = {} + self.started_cases = {} self.matched_run_id = False self.run_id_exists = False self.instance: TestInstance | None = None self.testcase_output = "" self._match = False + + @property + def trace(self) -> bool: + return self.instance.handler.options.verbose > 2 + @property def status(self) -> TwisterStatus: return self._status @@ -710,42 +716,124 @@ def _check_result(self, line): class Test(Harness): __test__ = False # for pytest to skip this class when collects tests - RUN_PASSED = "PROJECT EXECUTION SUCCESSFUL" - RUN_FAILED = "PROJECT EXECUTION FAILED" - test_suite_start_pattern = r"Running TESTSUITE (?P.*)" - ZTEST_START_PATTERN = r"START - (test_)?([a-zA-Z0-9_-]+)" - def handle(self, line): - test_suite_match = re.search(self.test_suite_start_pattern, line) - if test_suite_match: - suite_name = test_suite_match.group("suite_name") + test_suite_start_pattern = re.compile(r"Running TESTSUITE (?P\S*)") + test_suite_end_pattern = re.compile(r"TESTSUITE (?P\S*)\s+(?Psucceeded|failed)") + test_case_start_pattern = re.compile(r"START - (test_)?([a-zA-Z0-9_-]+)") + test_case_end_pattern = re.compile(r".*(PASS|FAIL|SKIP) - (test_)?(\S*) in (\d*[.,]?\d*) seconds") + test_suite_summary_pattern = re.compile(r"SUITE (?P\S*) - .* \[(?P\S*)\]: .* duration = (\d*[.,]?\d*) seconds") + test_case_summary_pattern = re.compile(r" - (PASS|FAIL|SKIP) - \[([^\.]*).(test_)?(\S*)\] duration = (\d*[.,]?\d*) seconds") + + + def get_testcase(self, tc_name, phase, ts_name=None): + """ Search a Ztest case among detected in the test image binary + expecting the same test names as already known from the ELF. + Track suites and cases unexpectedly found in the log. + """ + ts_names = self.started_suites.keys() + if ts_name: + if ts_name not in self.instance.testsuite.ztest_suite_names: + logger.warning(f"On {phase}: unexpected Ztest suite '{ts_name}' " + f"not present among: {self.instance.testsuite.ztest_suite_names}") + if ts_name not in self.detected_suite_names: + if self.trace: + logger.debug(f"On {phase}: detected new Ztest suite '{ts_name}'") + self.detected_suite_names.append(ts_name) + ts_names = [ ts_name ] if ts_name in ts_names else [] + + # Firstly try to match the test case ID to the first running Ztest suite with this test name. + for ts_name_ in ts_names: + if self.started_suites[ts_name_]['count'] < (0 if phase == 'TS_SUM' else 1): + continue + tc_fq_id = "{}.{}.{}".format(self.id, ts_name_, tc_name) + if tc := self.instance.get_case_by_name(tc_fq_id): + if self.trace: + logger.debug(f"On {phase}: Ztest case '{tc_name}' matched to '{tc_fq_id}") + return tc + logger.debug(f"On {phase}: Ztest case '{tc_name}' is not known in {self.started_suites} running suite(s).") + tc_id = "{}.{}".format(self.id, tc_name) + return self.instance.get_case_or_create(tc_id) + + def start_suite(self, suite_name): + if suite_name not in self.detected_suite_names: self.detected_suite_names.append(suite_name) + if suite_name not in self.instance.testsuite.ztest_suite_names: + logger.warning(f"Unexpected Ztest suite '{suite_name}'") + if suite_name in self.started_suites: + if self.started_suites[suite_name]['count'] > 0: + logger.warning(f"Already STARTED '{suite_name}':{self.started_suites[suite_name]}") + elif self.trace: + logger.debug(f"START suite '{suite_name}'") + self.started_suites[suite_name]['count'] += 1 + self.started_suites[suite_name]['repeat'] += 1 + else: + self.started_suites[suite_name] = { 'count': 1, 'repeat': 0 } + + def end_suite(self, suite_name, phase='', suite_status=None): + if suite_name in self.started_suites: + if phase == 'TS_SUM' and self.started_suites[suite_name]['count'] == 0: + return + if self.started_suites[suite_name]['count'] < 1: + logger.error(f"Already ENDED {phase} suite '{suite_name}':{self.started_suites[suite_name]}") + elif self.trace: + logger.debug(f"END {phase} suite '{suite_name}':{self.started_suites[suite_name]}") + self.started_suites[suite_name]['count'] -= 1 + elif suite_status == 'SKIP': + self.start_suite(suite_name) # register skipped suites at their summary end + self.started_suites[suite_name]['count'] -= 1 + else: + logger.warning(f"END {phase} suite '{suite_name}' without START detected") - testcase_match = re.search(self.ZTEST_START_PATTERN, line) - if testcase_match: - name = "{}.{}".format(self.id, testcase_match.group(2)) - tc = self.instance.get_case_or_create(name) + def start_case(self, tc_name): + if tc_name in self.started_cases: + if self.started_cases[tc_name]['count'] > 0: + logger.warning(f"Already STARTED '{tc_name}':{self.started_cases[tc_name]}") + self.started_cases[tc_name]['count'] += 1 + else: + self.started_cases[tc_name] = { 'count': 1 } + + def end_case(self, tc_name, phase=''): + if tc_name in self.started_cases: + if phase == 'TS_SUM' and self.started_cases[tc_name]['count'] == 0: + return + if self.started_cases[tc_name]['count'] < 1: + logger.error(f"Already ENDED {phase} case '{tc_name}':{self.started_cases[tc_name]}") + elif self.trace: + logger.debug(f"END {phase} case '{tc_name}':{self.started_cases[tc_name]}") + self.started_cases[tc_name]['count'] -= 1 + elif phase != 'TS_SUM': + logger.warning(f"END {phase} case '{tc_name}' without START detected") + + + def handle(self, line): + testcase_match = None + if self._match: + self.testcase_output += line + "\n" + + if test_suite_start_match := re.search(self.test_suite_start_pattern, line): + self.start_suite(test_suite_start_match.group("suite_name")) + elif test_suite_end_match := re.search(self.test_suite_end_pattern, line): + suite_name=test_suite_end_match.group("suite_name") + self.end_suite(suite_name, 'TS_END') + elif testcase_match := re.search(self.test_case_start_pattern, line): + tc_name = testcase_match.group(2) + tc = self.get_testcase(tc_name, 'TC_START') + self.start_case(tc.name) # Mark the test as started, if something happens here, it is mostly # due to this tests, for example timeout. This should in this case # be marked as failed and not blocked (not run). tc.status = TwisterStatus.STARTED - - if testcase_match or self._match: - self.testcase_output += line + "\n" - self._match = True - - result_match = result_re.match(line) + if not self._match: + self.testcase_output += line + "\n" + self._match = True # some testcases are skipped based on predicates and do not show up # during test execution, however they are listed in the summary. Parse # the summary for status and use that status instead. - - summary_re = re.compile(r"- (PASS|FAIL|SKIP) - \[([^\.]*).(test_)?(\S*)\] duration = (\d*[.,]?\d*) seconds") - summary_match = summary_re.match(line) - - if result_match: + elif result_match := self.test_case_end_pattern.match(line): matched_status = result_match.group(1) - name = "{}.{}".format(self.id, result_match.group(3)) - tc = self.instance.get_case_or_create(name) + tc_name = result_match.group(3) + tc = self.get_testcase(tc_name, 'TC_END') + self.end_case(tc.name) tc.status = TwisterStatus[matched_status] if tc.status == TwisterStatus.SKIP: tc.reason = "ztest skip" @@ -755,15 +843,22 @@ def handle(self, line): self.testcase_output = "" self._match = False self.ztest = True - elif summary_match: - matched_status = summary_match.group(1) - self.detected_suite_names.append(summary_match.group(2)) - name = "{}.{}".format(self.id, summary_match.group(4)) - tc = self.instance.get_case_or_create(name) + elif test_suite_summary_match := self.test_suite_summary_pattern.match(line): + suite_name=test_suite_summary_match.group("suite_name") + suite_status=test_suite_summary_match.group("suite_status") + self._match = False + self.ztest = True + self.end_suite(suite_name, 'TS_SUM', suite_status=suite_status) + elif test_case_summary_match := self.test_case_summary_pattern.match(line): + matched_status = test_case_summary_match.group(1) + suite_name = test_case_summary_match.group(2) + tc_name = test_case_summary_match.group(4) + tc = self.get_testcase(tc_name, 'TS_SUM', suite_name) + self.end_case(tc.name, 'TS_SUM') tc.status = TwisterStatus[matched_status] if tc.status == TwisterStatus.SKIP: tc.reason = "ztest skip" - tc.duration = float(summary_match.group(5)) + tc.duration = float(test_case_summary_match.group(5)) if tc.status == TwisterStatus.FAIL: tc.output = self.testcase_output self.testcase_output = "" diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index 128bc598ed9c4..83ca94f9fb5f2 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -1,6 +1,6 @@ # vim: set syntax=python ts=4 : # -# Copyright (c) 20180-2022 Intel Corporation +# Copyright (c) 2018-2024 Intel Corporation # Copyright 2022 NXP # SPDX-License-Identifier: Apache-2.0 @@ -1108,13 +1108,16 @@ def determine_testcases(self, results): matches = new_ztest_unit_test_regex.findall(sym.name) if matches: for m in matches: - # new_ztest_suite = m[0] # not used for now + new_ztest_suite = m[0] + if new_ztest_suite not in self.instance.testsuite.ztest_suite_names: + logger.warning(f"Unexpected Ztest suite '{new_ztest_suite}' " + f"not present in: {self.instance.testsuite.ztest_suite_names}") test_func_name = m[1].replace("test_", "", 1) - testcase_id = f"{yaml_testsuite_name}.{test_func_name}" + testcase_id = f"{yaml_testsuite_name}.{new_ztest_suite}.{test_func_name}" detected_cases.append(testcase_id) if detected_cases: - logger.debug(f"{', '.join(detected_cases)} in {elf_file}") + logger.debug(f"Detected Ztest cases: [{', '.join(detected_cases)}] in {elf_file}") tc_keeper = {tc.name: {'status': tc.status, 'reason': tc.reason} for tc in self.instance.testcases} self.instance.testcases.clear() self.instance.testsuite.testcases.clear() diff --git a/scripts/pylib/twister/twisterlib/testsuite.py b/scripts/pylib/twister/twisterlib/testsuite.py index 3522c5bb218e0..01b91f4b876d8 100644 --- a/scripts/pylib/twister/twisterlib/testsuite.py +++ b/scripts/pylib/twister/twisterlib/testsuite.py @@ -1,6 +1,6 @@ # vim: set syntax=python ts=4 : # -# Copyright (c) 2018-2022 Intel Corporation +# Copyright (c) 2018-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from enum import Enum @@ -248,14 +248,16 @@ def _find_ztest_testcases(search_area, testcase_regex): testcase_regex_matches = \ [m for m in testcase_regex.finditer(search_area)] testcase_names = \ - [m.group("testcase_name") for m in testcase_regex_matches] - testcase_names = [name.decode("UTF-8") for name in testcase_names] + [(m.group("suite_name") if m.groupdict().get("suite_name") else b'', m.group("testcase_name")) \ + for m in testcase_regex_matches] + testcase_names = [(ts_name.decode("UTF-8"), tc_name.decode("UTF-8")) for ts_name, tc_name in testcase_names] warnings = None for testcase_name in testcase_names: - if not testcase_name.startswith("test_"): + if not testcase_name[1].startswith("test_"): warnings = "Found a test that does not start with test_" testcase_names = \ - [tc_name.replace("test_", "", 1) for tc_name in testcase_names] + [(ts_name + '.' if ts_name else '') + f"{tc_name.replace('test_', '', 1)}" \ + for (ts_name, tc_name) in testcase_names] return testcase_names, warnings diff --git a/scripts/tests/twister/test_harness.py b/scripts/tests/twister/test_harness.py index c0a135fb24105..7e0fca79677ab 100644 --- a/scripts/tests/twister/test_harness.py +++ b/scripts/tests/twister/test_harness.py @@ -597,31 +597,48 @@ def test_get_harness(name): "", "Running TESTSUITE suite_name", ["suite_name"], + { 'suite_name': { 'count': 1, 'repeat': 0 } }, + {}, TwisterStatus.NONE, True, TwisterStatus.NONE, ), - ("", "START - test_testcase", [], TwisterStatus.STARTED, True, TwisterStatus.NONE), ( - "", + "On TC_START: Ztest case 'testcase' is not known in {} running suite(s)", + "START - test_testcase", + [], + {}, + { 'test_id.testcase': { 'count': 1 } }, + TwisterStatus.STARTED, + True, + TwisterStatus.NONE + ), + ( + "On TC_END: Ztest case 'example' is not known in {} running suite(s)", "PASS - test_example in 0 seconds", [], + {}, + {}, TwisterStatus.PASS, True, TwisterStatus.NONE, ), ( - "", + "On TC_END: Ztest case 'example' is not known in {} running suite(s)", "SKIP - test_example in 0 seconds", [], + {}, + {}, TwisterStatus.SKIP, True, TwisterStatus.NONE, ), ( - "", + "On TC_END: Ztest case 'example' is not known in {} running suite(s)", "FAIL - test_example in 0 seconds", [], + {}, + {}, TwisterStatus.FAIL, True, TwisterStatus.NONE, @@ -630,6 +647,8 @@ def test_get_harness(name): "not a ztest and no state for test_id", "START - test_testcase", [], + {}, + { 'test_id.testcase': { 'count': 1 } }, TwisterStatus.PASS, False, TwisterStatus.PASS, @@ -638,6 +657,8 @@ def test_get_harness(name): "not a ztest and no state for test_id", "START - test_testcase", [], + {}, + { 'test_id.testcase': { 'count': 1 } }, TwisterStatus.FAIL, False, TwisterStatus.FAIL, @@ -646,12 +667,14 @@ def test_get_harness(name): @pytest.mark.parametrize( - "exp_out, line, exp_suite_name, exp_status, ztest, state", + "exp_out, line, exp_suite_name, exp_started_suites, exp_started_cases, exp_status, ztest, state", TEST_DATA_7, ids=["testsuite", "testcase", "pass", "skip", "failed", "ztest pass", "ztest fail"], ) def test_test_handle( - tmp_path, caplog, exp_out, line, exp_suite_name, exp_status, ztest, state + tmp_path, caplog, exp_out, line, + exp_suite_name, exp_started_suites, exp_started_cases, + exp_status, ztest, state ): # Arrange line = line @@ -662,6 +685,7 @@ def test_test_handle( mock_testsuite = mock.Mock(id="id", testcases=[]) mock_testsuite.name = "mock_testsuite" mock_testsuite.harness_config = {} + mock_testsuite.ztest_suite_names = [] outdir = tmp_path / "gtest_out" outdir.mkdir() @@ -681,6 +705,9 @@ def test_test_handle( # Assert assert test_obj.detected_suite_names == exp_suite_name + assert test_obj.started_suites == exp_started_suites + assert test_obj.started_cases == exp_started_cases + assert exp_out in caplog.text if not "Running" in line and exp_out == "": assert test_obj.instance.testcases[0].status == exp_status diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index 3ab7de2fb935f..24e5e4fb77998 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -1562,11 +1562,14 @@ def mock_determine_testcases(res): TESTDATA_7 = [ ( [ - 'z_ztest_unit_test__dummy_suite_name__dummy_test_name', - 'z_ztest_unit_test__dummy_suite_name__test_dummy_name', + 'z_ztest_unit_test__dummy_suite1_name__dummy_test_name1', + 'z_ztest_unit_test__dummy_suite2_name__test_dummy_name2', 'no match' ], - ['dummy_id.dummy_name', 'dummy_id.dummy_name'] + [ + ('dummy_id.dummy_suite1_name.dummy_name1'), + ('dummy_id.dummy_suite2_name.dummy_name2') + ] ), ( ['no match'], @@ -1599,6 +1602,7 @@ def test_projectbuilder_determine_testcases( instance_mock = mock.Mock() instance_mock.testcases = [] instance_mock.testsuite.id = 'dummy_id' + instance_mock.testsuite.ztest_suite_names = [] env_mock = mock.Mock() pb = ProjectBuilder(instance_mock, env_mock, mocked_jobserver) @@ -2137,13 +2141,11 @@ def test_projectbuilder_cmake(): instance_mock = mock.Mock() instance_mock.handler = 'dummy handler' instance_mock.build_dir = os.path.join('build', 'dir') - instance_mock.platform.name = 'frdm_k64f' env_mock = mock.Mock() pb = ProjectBuilder(instance_mock, env_mock, mocked_jobserver) pb.build_dir = 'build_dir' - pb.testsuite.platform = instance_mock.platform - pb.testsuite.extra_args = ['some', 'platform:frdm_k64f:args'] + pb.testsuite.extra_args = ['some', 'args'] pb.testsuite.extra_conf_files = ['some', 'files1'] pb.testsuite.extra_overlay_confs = ['some', 'files2'] pb.testsuite.extra_dtc_overlay_files = ['some', 'files3'] @@ -2156,7 +2158,7 @@ def test_projectbuilder_cmake(): assert res == cmake_res_mock pb.cmake_assemble_args.assert_called_once_with( - ['some', 'args'], + pb.testsuite.extra_args, pb.instance.handler, pb.testsuite.extra_conf_files, pb.testsuite.extra_overlay_confs, diff --git a/scripts/tests/twister/test_testplan.py b/scripts/tests/twister/test_testplan.py index eea3d3e9abefb..b00d69ab06113 100644 --- a/scripts/tests/twister/test_testplan.py +++ b/scripts/tests/twister/test_testplan.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Copyright (c) 2020 Intel Corporation +# Copyright (c) 2020-2024 Intel Corporation # # SPDX-License-Identifier: Apache-2.0 @@ -85,7 +85,8 @@ def test_get_all_testsuites_short(class_testplan, all_testsuites_dict): 'test_b.check_1', 'test_b.check_2', 'test_c.check_1', 'test_c.check_2', 'test_d.check_1.unit_1a', 'test_d.check_1.unit_1b', - 'test_e.check_1.1a', 'test_e.check_1.1b', + 'test_e.check_1.feature5.1a', + 'test_e.check_1.feature5.1b', 'test_config.main'] assert sorted(plan.get_all_tests()) == sorted(expected_tests) diff --git a/scripts/tests/twister/test_testsuite.py b/scripts/tests/twister/test_testsuite.py index e297b6b6d9cd6..8d20902a5ebaf 100644 --- a/scripts/tests/twister/test_testsuite.py +++ b/scripts/tests/twister/test_testsuite.py @@ -165,7 +165,7 @@ def test_scanpathresults_dunders(original, provided, expected): ), ScanPathResult( warnings=None, - matches=['1a', '1b'], + matches=['feature5.1a', 'feature5.1b'], has_registered_test_suites=False, has_run_registered_test_suites=True, has_test_main=False, diff --git a/scripts/tests/twister_blackbox/test_config.py b/scripts/tests/twister_blackbox/test_config.py index c05d18cdaa780..2cad497055f5b 100644 --- a/scripts/tests/twister_blackbox/test_config.py +++ b/scripts/tests/twister_blackbox/test_config.py @@ -13,6 +13,7 @@ import sys import json +# pylint: disable=no-name-in-module from conftest import ZEPHYR_BASE, TEST_DATA, testsuite_filename_mock from twisterlib.testplan import TestPlan @@ -55,13 +56,13 @@ def test_alt_config_root(self, out_path): assert str(sys_exit.value) == '0' - assert len(filtered_j) == 3 + assert len(filtered_j) == 4 @pytest.mark.parametrize( 'level, expected_tests', [ - ('smoke', 5), - ('acceptance', 6), + ('smoke', 6), + ('acceptance', 7), ], ids=['smoke', 'acceptance'] ) diff --git a/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic/group2/src/main.c b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic/group2/src/main.c index 55c375965aeb9..798fd9756a8c1 100644 --- a/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic/group2/src/main.c +++ b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic/group2/src/main.c @@ -9,6 +9,8 @@ ZTEST_SUITE(a2_tests, NULL, NULL, NULL, NULL, NULL); +ZTEST_SUITE(a3_tests, NULL, NULL, NULL, NULL, NULL); + /** * @brief Test Asserts * @@ -34,3 +36,8 @@ ZTEST(a2_tests, test_assert2) zassert_equal(1, 1, "1 was not equal to 1"); zassert_equal_ptr(NULL, NULL, "NULL was not equal to NULL"); } + +ZTEST(a3_tests, test_assert1) +{ + zassert_true(1, "1 was false"); +} diff --git a/scripts/tests/twister_blackbox/test_filter.py b/scripts/tests/twister_blackbox/test_filter.py index 90ea95e643075..d8dfd3575e407 100644 --- a/scripts/tests/twister_blackbox/test_filter.py +++ b/scripts/tests/twister_blackbox/test_filter.py @@ -14,6 +14,7 @@ import json import re +# pylint: disable=no-name-in-module from conftest import ZEPHYR_BASE, TEST_DATA, testsuite_filename_mock from twisterlib.testplan import TestPlan @@ -83,11 +84,12 @@ def teardown_class(cls): @pytest.mark.parametrize( 'tag, expected_test_count', [ - ('device', 5), # dummy.agnostic.group1.subgroup1.assert - # dummy.agnostic.group1.subgroup2.assert - # dummy.agnostic.group2.assert1 - # dummy.agnostic.group2.assert2 - # dummy.agnostic.group2.assert3 + ('device', 6), # dummy.agnostic.group1.subgroup1.a1_1_tests.assert + # dummy.agnostic.group1.subgroup2.a2_2_tests.assert + # dummy.agnostic.group2.a2_tests.assert1 + # dummy.agnostic.group2.a2_tests.assert2 + # dummy.agnostic.group2.a2_tests.assert3 + # dummy.agnostic.group2.a3_tests.assert1 ('agnostic', 1) # dummy.device.group.assert ], ids=['no device', 'no agnostic'] @@ -144,7 +146,7 @@ def test_enable_slow(self, out_path): assert str(sys_exit.value) == '0' - assert len(filtered_j) == 5 + assert len(filtered_j) == 6 @mock.patch.object(TestPlan, 'TESTSUITE_FILENAME', testsuite_filename_mock) def test_enable_slow_only(self, out_path): @@ -172,7 +174,7 @@ def test_enable_slow_only(self, out_path): assert str(sys_exit.value) == '0' - assert len(filtered_j) == 3 + assert len(filtered_j) == 4 @pytest.mark.parametrize( 'arch, expected', diff --git a/scripts/tests/twister_blackbox/test_platform.py b/scripts/tests/twister_blackbox/test_platform.py index 83fe07b274b9c..2e97fa293487c 100644 --- a/scripts/tests/twister_blackbox/test_platform.py +++ b/scripts/tests/twister_blackbox/test_platform.py @@ -36,7 +36,7 @@ class TestPlatform: 'built_configurations': 2, 'failed_configurations': 0, 'errored_configurations': 0, - 'executed_test_cases': 8, + 'executed_test_cases': 10, 'skipped_test_cases': 2, 'platform_count': 2, 'executed_on_platform': 4, @@ -129,7 +129,7 @@ def test_force_platform(self, out_path): assert str(sys_exit.value) == '0' - assert len(filtered_j) == 12 + assert len(filtered_j) == 14 def test_platform(self, out_path): path = os.path.join(TEST_DATA, 'tests', 'dummy') diff --git a/scripts/tests/twister_blackbox/test_printouts.py b/scripts/tests/twister_blackbox/test_printouts.py index 3f65549b8ea9c..853797354f44c 100644 --- a/scripts/tests/twister_blackbox/test_printouts.py +++ b/scripts/tests/twister_blackbox/test_printouts.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Copyright (c) 2023 Intel Corporation +# Copyright (c) 2023-2024 Intel Corporation # # SPDX-License-Identifier: Apache-2.0 """ @@ -41,17 +41,18 @@ class TestPrintOuts: ( os.path.join(TEST_DATA, 'tests', 'dummy', 'agnostic'), [ - 'dummy.agnostic.group1.subgroup1.assert', - 'dummy.agnostic.group1.subgroup2.assert', - 'dummy.agnostic.group2.assert1', - 'dummy.agnostic.group2.assert2', - 'dummy.agnostic.group2.assert3' + 'dummy.agnostic.group1.subgroup1.a1_1_tests.assert', + 'dummy.agnostic.group1.subgroup2.a1_2_tests.assert', + 'dummy.agnostic.group2.a2_tests.assert1', + 'dummy.agnostic.group2.a2_tests.assert2', + 'dummy.agnostic.group2.a3_tests.assert1', + 'dummy.agnostic.group2.a2_tests.assert3' ] ), ( os.path.join(TEST_DATA, 'tests', 'dummy', 'device'), [ - 'dummy.device.group.assert' + 'dummy.device.group.d_tests.assert' ] ), ] @@ -64,11 +65,12 @@ class TestPrintOuts: '└── Tests\n' \ ' └── dummy\n' \ ' └── agnostic\n' \ - ' ├── dummy.agnostic.group1.subgroup1.assert\n' \ - ' ├── dummy.agnostic.group1.subgroup2.assert\n' \ - ' ├── dummy.agnostic.group2.assert1\n' \ - ' ├── dummy.agnostic.group2.assert2\n' \ - ' └── dummy.agnostic.group2.assert3\n' + ' ├── dummy.agnostic.group1.subgroup1.a1_1_tests.assert\n' \ + ' ├── dummy.agnostic.group1.subgroup2.a1_2_tests.assert\n' \ + ' ├── dummy.agnostic.group2.a2_tests.assert1\n' \ + ' ├── dummy.agnostic.group2.a2_tests.assert2\n' \ + ' ├── dummy.agnostic.group2.a2_tests.assert3\n' \ + ' └── dummy.agnostic.group2.a3_tests.assert1\n' ), ( os.path.join(TEST_DATA, 'tests', 'dummy', 'device'), @@ -77,7 +79,7 @@ class TestPrintOuts: '└── Tests\n' ' └── dummy\n' ' └── device\n' - ' └── dummy.device.group.assert\n' + ' └── dummy.device.group.d_tests.assert\n' ), ] diff --git a/scripts/tests/twister_blackbox/test_report.py b/scripts/tests/twister_blackbox/test_report.py index 2db1006bc5aa9..3a145fd59b37c 100644 --- a/scripts/tests/twister_blackbox/test_report.py +++ b/scripts/tests/twister_blackbox/test_report.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Copyright (c) 2023 Intel Corporation +# Copyright (c) 2023-2024 Intel Corporation # # SPDX-License-Identifier: Apache-2.0 """ @@ -350,12 +350,12 @@ def test_log_file(self, capfd, test_path, test_platforms, out_path, file_name): ( os.path.join(TEST_DATA, 'tests', 'dummy'), ['--detailed-skipped-report'], - {'qemu_x86/atom': 5, 'intel_adl_crb/alder_lake': 1} + {'qemu_x86/atom': 6, 'intel_adl_crb/alder_lake': 1} ), ( os.path.join(TEST_DATA, 'tests', 'dummy'), ['--detailed-skipped-report', '--report-filtered'], - {'qemu_x86/atom': 6, 'intel_adl_crb/alder_lake': 6} + {'qemu_x86/atom': 7, 'intel_adl_crb/alder_lake': 7} ), ], ids=['dummy tests', 'dummy tests with filtered'] diff --git a/scripts/tests/twister_blackbox/test_runner.py b/scripts/tests/twister_blackbox/test_runner.py index a4a253fbff7a8..41eea8987b619 100644 --- a/scripts/tests/twister_blackbox/test_runner.py +++ b/scripts/tests/twister_blackbox/test_runner.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Copyright (c) 2023 Intel Corporation +# Copyright (c) 2023-2024 Intel Corporation # # SPDX-License-Identifier: Apache-2.0 """ @@ -54,7 +54,7 @@ class TestRunner: 'built_configurations': 0, 'failed_configurations': 0, 'errored_configurations': 0, - 'executed_test_cases': 8, + 'executed_test_cases': 10, 'skipped_test_cases': 0, 'platform_count': 2, 'executed_on_platform': 4, diff --git a/scripts/tests/twister_blackbox/test_shuffle.py b/scripts/tests/twister_blackbox/test_shuffle.py index ade1267b48227..412d97a619bf9 100644 --- a/scripts/tests/twister_blackbox/test_shuffle.py +++ b/scripts/tests/twister_blackbox/test_shuffle.py @@ -10,10 +10,10 @@ import mock import os import pytest -import re import sys import json +# pylint: disable=no-name-in-module from conftest import ZEPHYR_BASE, TEST_DATA, testsuite_filename_mock from twisterlib.testplan import TestPlan @@ -65,14 +65,8 @@ def test_shuffle_tests(self, out_path, seed, ratio, expected_order): with open(os.path.join(out_path, 'testplan.json')) as f: j = json.load(f) - filtered_j = [ - (ts['platform'], ts['name'], tc['identifier']) \ - for ts in j['testsuites'] \ - for tc in ts['testcases'] if 'reason' not in tc - ] - testcases = [re.sub(r'\.assert[^\.]*?$', '', j[2]) for j in filtered_j] - testsuites = list(dict.fromkeys(testcases)) + testsuites = [os.path.basename(ts['name']) for ts in j['testsuites']] assert testsuites == expected_order diff --git a/scripts/tests/twister_blackbox/test_testlist.py b/scripts/tests/twister_blackbox/test_testlist.py index 1ef93f072b6b5..ad8eaeddfaf55 100644 --- a/scripts/tests/twister_blackbox/test_testlist.py +++ b/scripts/tests/twister_blackbox/test_testlist.py @@ -13,6 +13,7 @@ import sys import json +# pylint: disable=no-name-in-module from conftest import ZEPHYR_BASE, TEST_DATA, testsuite_filename_mock, clear_log_in_test from twisterlib.testplan import TestPlan @@ -71,4 +72,4 @@ def test_save_tests(self, out_path): for tc in ts['testcases'] if 'reason' not in tc ] - assert len(filtered_j) == 5 + assert len(filtered_j) == 6 diff --git a/scripts/tests/twister_blackbox/test_testplan.py b/scripts/tests/twister_blackbox/test_testplan.py index 915653a33e15e..8834e03ead039 100644 --- a/scripts/tests/twister_blackbox/test_testplan.py +++ b/scripts/tests/twister_blackbox/test_testplan.py @@ -13,6 +13,7 @@ import sys import json +# pylint: disable=no-name-in-module from conftest import ZEPHYR_BASE, TEST_DATA, testsuite_filename_mock from twisterlib.testplan import TestPlan from twisterlib.error import TwisterRuntimeError @@ -20,7 +21,7 @@ class TestTestPlan: TESTDATA_1 = [ - ('dummy.agnostic.group2.assert1', SystemExit, 3), + ('dummy.agnostic.group2.a2_tests.assert1', SystemExit, 4), ( os.path.join('scripts', 'tests', 'twister_blackbox', 'test_data', 'tests', 'dummy', 'agnostic', 'group1', 'subgroup1', @@ -30,12 +31,12 @@ class TestTestPlan: ), ] TESTDATA_2 = [ - ('buildable', 6), - ('runnable', 4), + ('buildable', 7), + ('runnable', 5), ] TESTDATA_3 = [ (True, 1), - (False, 6), + (False, 7), ] @classmethod @@ -52,7 +53,7 @@ def teardown_class(cls): @pytest.mark.parametrize( 'test, expected_exception, expected_subtest_count', TESTDATA_1, - ids=['valid', 'invalid'] + ids=['valid', 'not found'] ) @mock.patch.object(TestPlan, 'TESTSUITE_FILENAME', testsuite_filename_mock) def test_subtest(self, out_path, test, expected_exception, expected_subtest_count): From 18451bca44df36e479ae4eec27b7eeb39c0b05e9 Mon Sep 17 00:00:00 2001 From: Dmitrii Golovanov Date: Sat, 19 Oct 2024 18:51:29 +0200 Subject: [PATCH 3007/4482] doc: twister: Update test naming and application diagram Update Test Application diagram as well as Test Scenario and Test Case naming conventions to make them more clear and aligned to Ztest suite name included as a part of Test Case name. Signed-off-by: Dmitrii Golovanov --- .../test/figures/twister_test_project.svg | 2 +- doc/develop/test/twister.rst | 65 ++++++++++--------- 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/doc/develop/test/figures/twister_test_project.svg b/doc/develop/test/figures/twister_test_project.svg index f21a45c2971ae..75440d6bda601 100644 --- a/doc/develop/test/figures/twister_test_project.svg +++ b/doc/develop/test/figures/twister_test_project.svg @@ -1,4 +1,4 @@ -
Test Framework (ZTEST)
Test Framework (ZTEST)
Test Suite (ZTEST_SUITE)
Test Suite (ZTEST_SUITE)
+ suite_name = "foo_bar_feature_aspect"
+ suite_name = "foo_bar_feature_aspect"

Test (ZTEST*)
Test (ZTEST*)
+ test_name = "test_buzz_and_blink"
+ test_name = "test_buzz_and_blink"

Test Scenario
(name_section.name_subsection)
Test Scenario...

+ tags:
+ levels: 
+ filter:
+ required_*:
+ arch_*:
+ platform_*: 
+ extra_*:
+ harness:
+ harness_config:

+ tags:...
Test Scenario
(name_section.name_subsection)
Test Scenario...

+ tags:
+ levels: 
+ filter:
+ required_*:
+ arch_*:
+ platform_*: 
+ extra_*:
+ harness:
+ harness_config:

+ tags:...
tests:
tests:
Test Scenario
(name_section.name_subsection)
Test Scenario...

+ tags:
+ levels: 
+ filter:
+ required_*:
+ arch_*:
+ platform_*: 
+ extra_*:

+ harness:
+ harness_config:

+ tags:...
CMakeList.txt
CMakeList.txt
+ project(foo-bar-feature)

+ project(foo-bar-feature)
./src (Test Project Implementation)
./src (Test Project Implementation)
prj.conf
prj.conf
+ Kconfig:
+ Kconfig:
Test Application binary
Test Application binary
Twister
Twister
Test Instance
Test Instance
+ outdir
+ outdir
+ testsuite:
+ testsuite:
+ platform:
+ platform:
+ testcases: []
+ testcases: []
+ status:
+ status:
+ reason:
+ reason:
+ execution_time:
+ execution_time:
+ retries:
+ retries:

Test Suite (test specification)
Test Suite (test specification)
+ yamlfile
+ yamlfile
+ id
+ id
+ testcases: []
+ testcases: []
+ ztest_suite_names: []
+ ztest_suite_names: []
+ name
+ name

Test Case
Test Case
+ testsuite:
+ testsuite:
+ status:
+ status:
+ reason:
+ reason:
+ output:
+ output:
+ duration:
+ duration:
+ name:
+ name:

Legend:
Legend:
Test Instance (Test Application) 
Test Instance (Test Application) 
Execution time-specific Test properties
Execution time-specific Test properties
Elementary Test
Elementary Test
tests/foo/bar/feature/name_section.name_subsection
tests/foo/bar/feature/name_section.name_subsection
name_section.name_subsection.buzz_and_blink
name_section.name_subsection.buzz_and_blink
Zephyr Test Application Project (tests/foo/bar/feature)
Zephyr Test Application Project (tests/foo/bar/feature)
Test Configuration (testcase.yaml)
Test Configuration (testcase.yaml)
build & run
build & run
Twister parameters:

--arch
--platform
--level

... etc. 
Twister parameters...
select
select
ELF symbols and application log parsing
ELF symbols and application log parsing
Text is not SVG - cannot display
\ No newline at end of file +
Zephyr Test Framework (Ztest)
Zephyr Test Framework (Ztest)
Ztest Test Suite (ZTEST_SUITE)
Ztest Test Suite (ZTEST_SUITE)
+ suite_name = "foo_bar_aspect"
+ suite_name = "foo_bar_aspect"

Ztest Test (ZTEST*)
Ztest Test (ZTEST*)
+ test_name = "test_buzz_and_blink"
+ test_name = "test_buzz_and_blink"

Test Scenario
(name_section.name_subsection)
Test Scenario...

+ tags:
+ levels: 
+ filter:
+ required_*:
+ arch_*:
+ platform_*: 
+ extra_*:
+ harness:
+ harness_config:

+ tags:...
Test Scenario
(name_section.name_subsection)
Test Scenario...

+ tags:
+ levels: 
+ filter:
+ required_*:
+ arch_*:
+ platform_*: 
+ extra_*:
+ harness:
+ harness_config:

+ tags:...
tests:
tests:
Test Scenario
(section_name.subsection_name)
Test Scenario...

+ tags:
+ levels: 
+ filter:
+ required_*:
+ arch_*:
+ platform_*: 
+ extra_*:

+ harness:
+ harness_config:

+ tags:...
CMakeList.txt
CMakeList.txt
+ project(foo-bar-feature)

+ project(foo-bar-feature)
./src (Test Project Implementation)
./src (Test Project Implementation)
prj.conf
prj.conf
+ Kconfig:
+ Kconfig:
Test Application binary
Test Application binary
Twister
Twister
Test Instance
Test Instance
+ outdir
+ outdir
+ testsuite:
+ testsuite:
+ platform:
+ platform:
+ testcases: []
+ testcases: []
+ status:
+ status:
+ reason:
+ reason:
+ execution_time:
+ execution_time:
+ retries:
+ retries:

Test Suite (test specification)
Test Suite (test specification)
+ yamlfile
+ yamlfile
+ testcases: []
+ testcases: []
+ id
+ id
+ name
+ name
+ ztest_suite_names: []
+ ztest_suite_names: []

Test Case
Test Case
+ testsuite:
+ testsuite:
+ status:
+ status:
+ reason:
+ reason:
+ output:
+ output:
+ duration:
+ duration:
+ name:
+ name:

Legend:
Legend:
Test Instance (Test Application) 
Test Instance (Test Application) 
Execution time-specific Test properties
Execution time-specific Test properties
Elementary Test
Elementary Test
tests/foo/bar/feature/section_name.subsection_name
tests/foo/bar/feature/section_name.subsection_name
section_name.subsection_name.foo_bar_aspect.buzz_and_blink
section_name.subsection_name.foo_bar_aspect.buzz_and_blink
Zephyr Test Application Project (tests/foo/bar/feature)
Zephyr Test Application Project (tests/foo/bar/feature)
Test Configuration (testcase.yaml)
Test Configuration (testcase.yaml)
build & run
build & run
Twister parameters:

--arch
--platform
--level

... etc. 
Twister parameters...
select
select
ELF symbols and application log parsing
ELF symbols and application log parsing
section_name.subsection_name
section_name.subsection_name
Text is not SVG - cannot display
\ No newline at end of file diff --git a/doc/develop/test/twister.rst b/doc/develop/test/twister.rst index 685c70ab88657..8d943279a3dc6 100644 --- a/doc/develop/test/twister.rst +++ b/doc/develop/test/twister.rst @@ -223,57 +223,60 @@ Tests Tests are detected by the presence of a ``testcase.yaml`` or a ``sample.yaml`` files in the application's project directory. This test application -configuration file may contain one or more entries in the tests section each -identifying a test scenario. +configuration file may contain one or more entries in the ``tests:`` section each +identifying a Test Scenario. .. _twister_test_project_diagram: .. figure:: figures/twister_test_project.svg - :alt: Twister and a Test applications' project. + :alt: Twister and a Test application project. :figclass: align-center - Twister and a Test applications' project. + Twister and a Test application project. Test application configurations are written using the YAML syntax and share the same structure as samples. -A test scenario is a set of conditions or variables, defined in test scenario -entry, under which a set of test suites will be executed. Can be used -interchangeably with test scenario entry. +A Test Scenario is a set of conditions and variables defined in a Test Scenario +entry, under which a set of Test Suites will be built and executed. -A test suite is a collection of test cases that are intended to be used to test -a software program to ensure it meets certain requirements. The test cases in a -test suite are often related or meant to be executed together. +A Test Suite is a collection of Test Cases which are intended to be used to test +a software program to ensure it meets certain requirements. The Test Cases in a +Test Suite are either related or meant to be executed together. -The name of each test scenario needs to be unique in the context of the overall +The name of each Test Scenario needs to be unique in the context of the overall test application and has to follow basic rules: -#. The format of the test scenario identifier shall be a string without any spaces or +#. The format of the Test Scenario identifier shall be a string without any spaces or special characters (allowed characters: alphanumeric and [\_=]) consisting - of multiple sections delimited with a dot (.). + of multiple sections delimited with a dot (``.``). -#. Each test scenario identifier shall start with a section followed by a - subsection separated by a dot. For example, a test scenario that covers - semaphores in the kernel shall start with ``kernel.semaphore``. +#. Each Test Scenario identifier shall start with a section name followed by a + subsection names delimited with a dot (``.``). For example, a test scenario + that covers semaphores in the kernel shall start with ``kernel.semaphore``. -#. All test scenario identifiers within a ``testcase.yaml`` file need to be unique. For - example a ``testcase.yaml`` file covering semaphores in the kernel can have: +#. All Test Scenario identifiers within a ``testcase.yaml`` file need to be unique. + For example a ``testcase.yaml`` file covering semaphores in the kernel can have: * ``kernel.semaphore``: For general semaphore tests * ``kernel.semaphore.stress``: Stress testing semaphores in the kernel. -#. Depending on the nature of the test, an identifier can consist of at least - two sections: +#. The full canonical name of a Test Suite is: + ``/`` - * Ztest tests: The individual test cases in the ztest testsuite will be - concatenated by dot (``.``) to the identifier in the ``testcase.yaml`` file - generating unique identifiers for every test case in the suite. +#. Depending on the Test Suite implementation, its Test Case identifiers consist + of **at least three sections** delimited with a dot (``.``): - * Standalone tests and samples: This type of test should at least have 3 - sections concatnated by dot (``.``) in the test scenario identifier in the - ``testcase.yaml`` (or ``sample.yaml``) file. - The last section of the name shall signify the test case itself. + * **Ztest tests**: + a Test Scenario identifier from the corresponding ``testcase.yaml`` file, + a Ztest suite name, and a Ztest test name: + ``..`` + + * **Standalone tests and samples**: + a Test Scenario identifier from the corresponding ``testcase.yaml`` (or + ``sample.yaml``) file where the last section signifies the standalone + Test Case name, for example: ``debug.coredump.logging_backend``. The following is an example test configuration with a few options that are @@ -316,12 +319,10 @@ related to the sample and what is being demonstrated: tags: tests min_ram: 16 -The full canonical name for each test scenario is:``/`` - -A test scenario entry is a a block or entry starting with test scenario -identifier in the YAML files. +A Test Scenario entry in the ``tests:`` YAML dictionary has its Test Scenario +identifier as a key. -Each test scenario entry in the test application configuration can define the +Each Test Scenario entry in the Test Application configuration can define the following key/value pairs: .. _test_config_args: From e11aecaed5aff6334a77b296de259b763a08e0ca Mon Sep 17 00:00:00 2001 From: Dmitrii Golovanov Date: Fri, 1 Nov 2024 12:07:02 +0100 Subject: [PATCH 3008/4482] twister: fix Ztest C++ test names extraction from ELF Fix Ztest test function name extraction from ELF symbols for C++ compiled binaries where symbol names need additional 'demangling' to match with corresponding test names. The `c++filt` utility (part of binutils) is called for demangling when it is needed. Twister test suite extension and adjustment. Signed-off-by: Dmitrii Golovanov --- scripts/pylib/twister/twisterlib/runner.py | 41 +++++++++++----- scripts/tests/twister/test_runner.py | 25 ++++++++-- .../test_data/test_config.yaml | 5 +- .../group1/subgroup1/CMakeLists.txt | 8 ++++ .../agnostic_cpp/group1/subgroup1/prj.conf | 1 + .../group1/subgroup1/src/main.cpp | 28 +++++++++++ .../group1/subgroup1/test_data.yaml | 10 ++++ .../group1/subgroup2/CMakeLists.txt | 8 ++++ .../agnostic_cpp/group1/subgroup2/prj.conf | 1 + .../group1/subgroup2/src/main.cpp | 27 +++++++++++ .../group1/subgroup2/test_data.yaml | 11 +++++ .../dummy/agnostic_cpp/group2/CMakeLists.txt | 8 ++++ .../tests/dummy/agnostic_cpp/group2/prj.conf | 1 + .../dummy/agnostic_cpp/group2/src/main.cpp | 48 +++++++++++++++++++ .../dummy/agnostic_cpp/group2/src/submain.cpp | 28 +++++++++++ .../dummy/agnostic_cpp/group2/test_data.yaml | 9 ++++ scripts/tests/twister_blackbox/test_filter.py | 15 +++--- .../tests/twister_blackbox/test_platform.py | 24 +++++++++- scripts/tests/twister_blackbox/test_report.py | 4 +- scripts/tests/twister_blackbox/test_runner.py | 2 +- .../tests/twister_blackbox/test_shuffle.py | 19 ++++---- 21 files changed, 288 insertions(+), 35 deletions(-) create mode 100644 scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup1/CMakeLists.txt create mode 100644 scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup1/prj.conf create mode 100644 scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup1/src/main.cpp create mode 100644 scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup1/test_data.yaml create mode 100644 scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup2/CMakeLists.txt create mode 100644 scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup2/prj.conf create mode 100644 scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup2/src/main.cpp create mode 100644 scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup2/test_data.yaml create mode 100644 scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group2/CMakeLists.txt create mode 100644 scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group2/prj.conf create mode 100644 scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group2/src/main.cpp create mode 100644 scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group2/src/submain.cpp create mode 100644 scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group2/test_data.yaml diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index 83ca94f9fb5f2..172add5367edf 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -814,6 +814,10 @@ def __init__(self, instance: TestInstance, env: TwisterEnv, jobserver, **kwargs) self.env = env self.duts = None + @property + def trace(self) -> bool: + return self.options.verbose > 2 + def log_info(self, filename, inline_logs, log_testcases=False): filename = os.path.abspath(os.path.realpath(filename)) if inline_logs: @@ -1087,6 +1091,18 @@ def process(self, pipeline, done, message, lock, results): self.instance.reason = reason self.instance.add_missing_case_status(TwisterStatus.BLOCK, reason) + def demangle(self, symbol_name): + if symbol_name[:2] == '_Z': + try: + cpp_filt = subprocess.run('c++filt', input=symbol_name, text=True, check=True, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + if self.trace: + logger.debug(f"Demangle: '{symbol_name}'==>'{cpp_filt.stdout}'") + return cpp_filt.stdout.strip() + except Exception as e: + logger.error(f"Failed to demangle '{symbol_name}': {e}") + return symbol_name + def determine_testcases(self, results): yaml_testsuite_name = self.instance.testsuite.id logger.debug(f"Determine test cases for test suite: {yaml_testsuite_name}") @@ -1102,19 +1118,22 @@ def determine_testcases(self, results): for sym in section.iter_symbols(): # It is only meant for new ztest fx because only new ztest fx exposes test functions # precisely. - + m_ = new_ztest_unit_test_regex.search(sym.name) + if not m_: + continue + # Demangle C++ symbols + m_ = new_ztest_unit_test_regex.search(self.demangle(sym.name)) + if not m_: + continue # The 1st capture group is new ztest suite name. # The 2nd capture group is new ztest unit test name. - matches = new_ztest_unit_test_regex.findall(sym.name) - if matches: - for m in matches: - new_ztest_suite = m[0] - if new_ztest_suite not in self.instance.testsuite.ztest_suite_names: - logger.warning(f"Unexpected Ztest suite '{new_ztest_suite}' " - f"not present in: {self.instance.testsuite.ztest_suite_names}") - test_func_name = m[1].replace("test_", "", 1) - testcase_id = f"{yaml_testsuite_name}.{new_ztest_suite}.{test_func_name}" - detected_cases.append(testcase_id) + new_ztest_suite = m_[1] + if new_ztest_suite not in self.instance.testsuite.ztest_suite_names: + logger.warning(f"Unexpected Ztest suite '{new_ztest_suite}' " + f"not present in: {self.instance.testsuite.ztest_suite_names}") + test_func_name = m_[2].replace("test_", "", 1) + testcase_id = f"{yaml_testsuite_name}.{new_ztest_suite}.{test_func_name}" + detected_cases.append(testcase_id) if detected_cases: logger.debug(f"Detected Ztest cases: [{', '.join(detected_cases)}] in {elf_file}") diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index 24e5e4fb77998..29459d585498d 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -56,6 +56,7 @@ def mocked_instance(tmp_path): def mocked_env(): env = mock.Mock() options = mock.Mock() + options.verbose = 2 env.options = options return env @@ -1571,6 +1572,24 @@ def mock_determine_testcases(res): ('dummy_id.dummy_suite2_name.dummy_name2') ] ), + ( + [ + 'z_ztest_unit_test__dummy_suite2_name__test_dummy_name2', + 'z_ztest_unit_test__bad_suite3_name_no_test', + '_ZN12_GLOBAL__N_1L54z_ztest_unit_test__dummy_suite3_name__test_dummy_name4E', + '_ZN12_GLOBAL__N_1L54z_ztest_unit_test__dummy_suite3_name__test_bad_name1E', + '_ZN12_GLOBAL__N_1L51z_ztest_unit_test_dummy_suite3_name__test_bad_name2E', + '_ZN12_GLOBAL__N_1L54z_ztest_unit_test__dummy_suite3_name__test_dummy_name5E', + '_ZN15foobarnamespaceL54z_ztest_unit_test__dummy_suite3_name__test_dummy_name6E', + ], + [ + ('dummy_id.dummy_suite2_name.dummy_name2'), + ('dummy_id.dummy_suite3_name.dummy_name4'), + ('dummy_id.dummy_suite3_name.bad_name1E'), + ('dummy_id.dummy_suite3_name.dummy_name5'), + ('dummy_id.dummy_suite3_name.dummy_name6'), + ] + ), ( ['no match'], [] @@ -1580,10 +1599,11 @@ def mock_determine_testcases(res): @pytest.mark.parametrize( 'symbols_names, added_tcs', TESTDATA_7, - ids=['two hits, one miss', 'nothing'] + ids=['two hits, one miss', 'demangle', 'nothing'] ) def test_projectbuilder_determine_testcases( mocked_jobserver, + mocked_env, symbols_names, added_tcs ): @@ -1603,9 +1623,8 @@ def test_projectbuilder_determine_testcases( instance_mock.testcases = [] instance_mock.testsuite.id = 'dummy_id' instance_mock.testsuite.ztest_suite_names = [] - env_mock = mock.Mock() - pb = ProjectBuilder(instance_mock, env_mock, mocked_jobserver) + pb = ProjectBuilder(instance_mock, mocked_env, mocked_jobserver) with mock.patch('twisterlib.runner.ELFFile', elf_mock), \ mock.patch('builtins.open', mock.mock_open()): diff --git a/scripts/tests/twister_blackbox/test_data/test_config.yaml b/scripts/tests/twister_blackbox/test_data/test_config.yaml index d7e4828350cf9..6bfe24a4e819e 100644 --- a/scripts/tests/twister_blackbox/test_data/test_config.yaml +++ b/scripts/tests/twister_blackbox/test_data/test_config.yaml @@ -6,9 +6,10 @@ levels: description: > A plan to be used verifying basic features adds: - - dummy.agnostic.* + - dummy.agnostic\..* - name: acceptance description: > More coverage adds: - - dummy.* + - dummy.agnostic\..* + - dummy.device\..* diff --git a/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup1/CMakeLists.txt b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup1/CMakeLists.txt new file mode 100644 index 0000000000000..3ffe630f1ad98 --- /dev/null +++ b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup1/CMakeLists.txt @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(integration) + +FILE(GLOB app_sources src/*.cpp) +target_sources(app PRIVATE ${app_sources}) diff --git a/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup1/prj.conf b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup1/prj.conf new file mode 100644 index 0000000000000..9467c2926896d --- /dev/null +++ b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup1/prj.conf @@ -0,0 +1 @@ +CONFIG_ZTEST=y diff --git a/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup1/src/main.cpp b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup1/src/main.cpp new file mode 100644 index 0000000000000..b37d02646cfcb --- /dev/null +++ b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup1/src/main.cpp @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2023-2024 Intel Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + + +// global namespace + +ZTEST_SUITE(a1_1_tests, NULL, NULL, NULL, NULL, NULL); + +/** + * @brief Test Asserts + * + * This test verifies various assert macros provided by ztest. + * + */ +ZTEST(a1_1_tests, test_assert) +{ + zassert_true(1, "1 was false"); + zassert_false(0, "0 was true"); + zassert_is_null(NULL, "NULL was not NULL"); + zassert_not_null("foo", "\"foo\" was NULL"); + zassert_equal(1, 1, "1 was not equal to 1"); + zassert_equal_ptr(NULL, NULL, "NULL was not equal to NULL"); +} diff --git a/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup1/test_data.yaml b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup1/test_data.yaml new file mode 100644 index 0000000000000..7d8a642054144 --- /dev/null +++ b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup1/test_data.yaml @@ -0,0 +1,10 @@ +tests: + dummy.agnostic_cpp.group1.subgroup1: + platform_allow: + - native_sim + integration_platforms: + - native_sim + tags: + - agnostic + - cpp + - subgrouped diff --git a/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup2/CMakeLists.txt b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup2/CMakeLists.txt new file mode 100644 index 0000000000000..3ffe630f1ad98 --- /dev/null +++ b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup2/CMakeLists.txt @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(integration) + +FILE(GLOB app_sources src/*.cpp) +target_sources(app PRIVATE ${app_sources}) diff --git a/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup2/prj.conf b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup2/prj.conf new file mode 100644 index 0000000000000..9467c2926896d --- /dev/null +++ b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup2/prj.conf @@ -0,0 +1 @@ +CONFIG_ZTEST=y diff --git a/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup2/src/main.cpp b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup2/src/main.cpp new file mode 100644 index 0000000000000..0ac835a959c04 --- /dev/null +++ b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup2/src/main.cpp @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2023-2024 Intel Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +// global namespace + +ZTEST_SUITE(a1_2_tests, NULL, NULL, NULL, NULL, NULL); + +/** + * @brief Test Asserts + * + * This test verifies various assert macros provided by ztest. + * + */ +ZTEST(a1_2_tests, test_assert) +{ + zassert_true(1, "1 was false"); + zassert_false(0, "0 was true"); + zassert_is_null(NULL, "NULL was not NULL"); + zassert_not_null("foo", "\"foo\" was NULL"); + zassert_equal(1, 1, "1 was not equal to 1"); + zassert_equal_ptr(NULL, NULL, "NULL was not equal to NULL"); +} diff --git a/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup2/test_data.yaml b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup2/test_data.yaml new file mode 100644 index 0000000000000..f0146d3e19344 --- /dev/null +++ b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group1/subgroup2/test_data.yaml @@ -0,0 +1,11 @@ +tests: + dummy.agnostic_cpp.group1.subgroup2: + build_only: true + platform_allow: + - native_sim + integration_platforms: + - native_sim + tags: + - agnostic + - cpp + - subgrouped diff --git a/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group2/CMakeLists.txt b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group2/CMakeLists.txt new file mode 100644 index 0000000000000..3ffe630f1ad98 --- /dev/null +++ b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group2/CMakeLists.txt @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(integration) + +FILE(GLOB app_sources src/*.cpp) +target_sources(app PRIVATE ${app_sources}) diff --git a/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group2/prj.conf b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group2/prj.conf new file mode 100644 index 0000000000000..9467c2926896d --- /dev/null +++ b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group2/prj.conf @@ -0,0 +1 @@ +CONFIG_ZTEST=y diff --git a/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group2/src/main.cpp b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group2/src/main.cpp new file mode 100644 index 0000000000000..1c86457e76a0d --- /dev/null +++ b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group2/src/main.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2023-2024 Intel Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + + +namespace +{ + +ZTEST_SUITE(a2_tests, NULL, NULL, NULL, NULL, NULL); + +ZTEST_SUITE(a3_tests, NULL, NULL, NULL, NULL, NULL); + +/** + * @brief Test Asserts + * + * This test verifies various assert macros provided by ztest. + * + */ +ZTEST(a2_tests, test_assert1) +{ + zassert_true(1, "1 was false"); + zassert_false(0, "0 was true"); + zassert_is_null(NULL, "NULL was not NULL"); + zassert_not_null("foo", "\"foo\" was NULL"); + zassert_equal(1, 1, "1 was not equal to 1"); + zassert_equal_ptr(NULL, NULL, "NULL was not equal to NULL"); +} + +ZTEST(a2_tests, test_assert2) +{ + zassert_true(1, "1 was false"); + zassert_false(0, "0 was true"); + zassert_is_null(NULL, "NULL was not NULL"); + zassert_not_null("foo", "\"foo\" was NULL"); + zassert_equal(1, 1, "1 was not equal to 1"); + zassert_equal_ptr(NULL, NULL, "NULL was not equal to NULL"); +} + +ZTEST(a3_tests, test_assert1) +{ + zassert_true(1, "1 was false"); +} + +} // namsespace diff --git a/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group2/src/submain.cpp b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group2/src/submain.cpp new file mode 100644 index 0000000000000..bf9c90536b2d2 --- /dev/null +++ b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group2/src/submain.cpp @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2023-2024 Intel Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +namespace foo_namespace +{ + +/** + * @brief Test Asserts + * + * This test verifies various assert macros provided by ztest. + * + */ +ZTEST(a2_tests, test_assert3) +{ + zassert_true(1, "1 was false"); + zassert_false(0, "0 was true"); + zassert_is_null(NULL, "NULL was not NULL"); + zassert_not_null("foo", "\"foo\" was NULL"); + zassert_equal(1, 1, "1 was not equal to 1"); + zassert_equal_ptr(NULL, NULL, "NULL was not equal to NULL"); +} + +} // foo_namespace diff --git a/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group2/test_data.yaml b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group2/test_data.yaml new file mode 100644 index 0000000000000..1a93b591460f6 --- /dev/null +++ b/scripts/tests/twister_blackbox/test_data/tests/dummy/agnostic_cpp/group2/test_data.yaml @@ -0,0 +1,9 @@ +tests: + dummy.agnostic_cpp.group2: + platform_allow: + - native_sim + integration_platforms: + - native_sim + tags: + - agnostic + - cpp diff --git a/scripts/tests/twister_blackbox/test_filter.py b/scripts/tests/twister_blackbox/test_filter.py index d8dfd3575e407..3558296d40b11 100644 --- a/scripts/tests/twister_blackbox/test_filter.py +++ b/scripts/tests/twister_blackbox/test_filter.py @@ -82,24 +82,27 @@ def teardown_class(cls): pass @pytest.mark.parametrize( - 'tag, expected_test_count', + 'tags, expected_test_count', [ - ('device', 6), # dummy.agnostic.group1.subgroup1.a1_1_tests.assert + (['device', 'cpp'], 6), + # dummy.agnostic.group1.subgroup1.a1_1_tests.assert # dummy.agnostic.group1.subgroup2.a2_2_tests.assert # dummy.agnostic.group2.a2_tests.assert1 # dummy.agnostic.group2.a2_tests.assert2 # dummy.agnostic.group2.a2_tests.assert3 # dummy.agnostic.group2.a3_tests.assert1 - ('agnostic', 1) # dummy.device.group.assert + (['agnostic'], 1) # dummy.device.group.assert ], - ids=['no device', 'no agnostic'] + ids=['no device, no cpp', 'no agnostic'] ) @mock.patch.object(TestPlan, 'TESTSUITE_FILENAME', testsuite_filename_mock) - def test_exclude_tag(self, out_path, tag, expected_test_count): + def test_exclude_tag(self, out_path, tags, expected_test_count): test_platforms = ['qemu_x86', 'intel_adl_crb'] path = os.path.join(TEST_DATA, 'tests', 'dummy') args = ['-i', '--outdir', out_path, '-T', path, '-y'] + \ - ['--exclude-tag', tag] + \ + [val for pair in zip( + ['--exclude-tag'] * len(tags), tags + ) for val in pair] + \ [val for pair in zip( ['-p'] * len(test_platforms), test_platforms ) for val in pair] diff --git a/scripts/tests/twister_blackbox/test_platform.py b/scripts/tests/twister_blackbox/test_platform.py index 2e97fa293487c..0c644dcff5aee 100644 --- a/scripts/tests/twister_blackbox/test_platform.py +++ b/scripts/tests/twister_blackbox/test_platform.py @@ -64,6 +64,27 @@ class TestPlatform: 'only_built': 0 } ), + ( + os.path.join(TEST_DATA, 'tests', 'dummy', 'agnostic_cpp'), + ['native_sim'], + { + 'selected_test_scenarios': 3, + 'selected_test_instances': 3, + 'executed_test_instances': 3, + 'skipped_configurations': 0, + 'skipped_by_static_filter': 0, + 'skipped_at_runtime': 0, + 'passed_configurations': 2, + 'built_configurations': 1, + 'failed_configurations': 0, + 'errored_configurations': 0, + 'executed_test_cases': 5, + 'skipped_test_cases': 0, + 'platform_count': 1, + 'executed_on_platform': 2, + 'only_built': 1 + } + ), ] @classmethod @@ -129,7 +150,7 @@ def test_force_platform(self, out_path): assert str(sys_exit.value) == '0' - assert len(filtered_j) == 14 + assert len(filtered_j) == 26 def test_platform(self, out_path): path = os.path.join(TEST_DATA, 'tests', 'dummy') @@ -250,6 +271,7 @@ def test_exclude_platform(self, capfd, out_path, test_path, test_platforms, expe ids=[ 'emulation_only tests/dummy/agnostic', 'emulation_only tests/dummy/device', + 'native_sim_only tests/dummy/agnostic_cpp', ] ) def test_emulation_only(self, capfd, out_path, test_path, test_platforms, expected): diff --git a/scripts/tests/twister_blackbox/test_report.py b/scripts/tests/twister_blackbox/test_report.py index 3a145fd59b37c..bac6ddbbbfa0b 100644 --- a/scripts/tests/twister_blackbox/test_report.py +++ b/scripts/tests/twister_blackbox/test_report.py @@ -355,7 +355,7 @@ def test_log_file(self, capfd, test_path, test_platforms, out_path, file_name): ( os.path.join(TEST_DATA, 'tests', 'dummy'), ['--detailed-skipped-report', '--report-filtered'], - {'qemu_x86/atom': 7, 'intel_adl_crb/alder_lake': 7} + {'qemu_x86/atom': 13, 'intel_adl_crb/alder_lake': 13} ), ], ids=['dummy tests', 'dummy tests with filtered'] @@ -392,7 +392,7 @@ def test_detailed_skipped_report(self, out_path, test_path, flags, expected_test 'test_path, report_filtered, expected_filtered_count', [ (os.path.join(TEST_DATA, 'tests', 'dummy'), False, 0), - (os.path.join(TEST_DATA, 'tests', 'dummy'), True, 4), + (os.path.join(TEST_DATA, 'tests', 'dummy'), True, 10), ], ids=['no filtered', 'with filtered'] ) diff --git a/scripts/tests/twister_blackbox/test_runner.py b/scripts/tests/twister_blackbox/test_runner.py index 41eea8987b619..e1b6a19470333 100644 --- a/scripts/tests/twister_blackbox/test_runner.py +++ b/scripts/tests/twister_blackbox/test_runner.py @@ -591,7 +591,7 @@ def test_tag(self, capfd, out_path, test_path, test_platforms, tags, expected): sys.stderr.write(err) for line in expected: - assert re.search(line, err) + assert re.search(line, err), f"no expected:'{line}' in '{err}'" assert str(sys_exit.value) == '0' diff --git a/scripts/tests/twister_blackbox/test_shuffle.py b/scripts/tests/twister_blackbox/test_shuffle.py index 412d97a619bf9..f45724b7b55e7 100644 --- a/scripts/tests/twister_blackbox/test_shuffle.py +++ b/scripts/tests/twister_blackbox/test_shuffle.py @@ -33,20 +33,21 @@ def teardown_class(cls): @pytest.mark.parametrize( 'seed, ratio, expected_order', [ - ('123', '1/2', ['dummy.agnostic.group1.subgroup1', 'dummy.agnostic.group1.subgroup2']), - ('123', '2/2', ['dummy.agnostic.group2', 'dummy.device.group']), - ('321', '1/2', ['dummy.agnostic.group1.subgroup1', 'dummy.agnostic.group2']), - ('321', '2/2', ['dummy.device.group', 'dummy.agnostic.group1.subgroup2']), - ('123', '1/3', ['dummy.agnostic.group1.subgroup1', 'dummy.agnostic.group1.subgroup2']), + ('123', '1/2', ['dummy.device.group', 'dummy.agnostic.group1.subgroup2']), + ('123', '2/2', ['dummy.agnostic.group2', 'dummy.agnostic.group1.subgroup1']), + ('321', '1/2', ['dummy.agnostic.group2', 'dummy.agnostic.group1.subgroup2']), + ('321', '2/2', ['dummy.device.group', 'dummy.agnostic.group1.subgroup1']), + ('123', '1/3', ['dummy.device.group', 'dummy.agnostic.group1.subgroup2']), ('123', '2/3', ['dummy.agnostic.group2']), - ('123', '3/3', ['dummy.device.group']), - ('321', '1/3', ['dummy.agnostic.group1.subgroup1', 'dummy.agnostic.group2']), + ('123', '3/3', ['dummy.agnostic.group1.subgroup1']), + ('321', '1/3', ['dummy.agnostic.group2', 'dummy.agnostic.group1.subgroup2']), ('321', '2/3', ['dummy.device.group']), - ('321', '3/3', ['dummy.agnostic.group1.subgroup2']) + ('321', '3/3', ['dummy.agnostic.group1.subgroup1']) ], ids=['first half, 123', 'second half, 123', 'first half, 321', 'second half, 321', 'first third, 123', 'middle third, 123', 'last third, 123', - 'first third, 321', 'middle third, 321', 'last third, 321'] + 'first third, 321', 'middle third, 321', 'last third, 321' +] ) @mock.patch.object(TestPlan, 'TESTSUITE_FILENAME', testsuite_filename_mock) def test_shuffle_tests(self, out_path, seed, ratio, expected_order): From c14b022beab8097ed7b79daed02dbf899fc8a490 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 21 Nov 2024 11:31:30 -0500 Subject: [PATCH 3009/4482] ci: twister: add --no-detailed-test-id Switch to short test identifier in reporting. Part of a series of changes to improve reporting and remove duplication and clutter when running twister. Signed-off-by: Anas Nashif --- .github/workflows/clang.yaml | 4 ++-- .github/workflows/twister-prep.yaml | 2 +- .github/workflows/twister.yaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/clang.yaml b/.github/workflows/clang.yaml index 4221babe2e5f6..0d97ecc8abcad 100644 --- a/.github/workflows/clang.yaml +++ b/.github/workflows/clang.yaml @@ -107,13 +107,13 @@ jobs: export ZEPHYR_TOOLCHAIN_VARIANT=llvm # check if we need to run a full twister or not based on files changed - python3 ./scripts/ci/test_plan.py --platform ${{ matrix.platform }} -c origin/${BASE_REF}.. + python3 ./scripts/ci/test_plan.py --no-detailed-test-id --platform ${{ matrix.platform }} -c origin/${BASE_REF}.. # We can limit scope to just what has changed if [ -s testplan.json ]; then echo "report_needed=1" >> $GITHUB_OUTPUT # Full twister but with options based on changes - ./scripts/twister --force-color --inline-logs -M -N -v --load-tests testplan.json --retry-failed 2 + ./scripts/twister --no-detailed-test-id --force-color --inline-logs -M -N -v --load-tests testplan.json --retry-failed 2 else # if nothing is run, skip reporting step echo "report_needed=0" >> $GITHUB_OUTPUT diff --git a/.github/workflows/twister-prep.yaml b/.github/workflows/twister-prep.yaml index 9a1e183ad2880..49840b1d063c3 100644 --- a/.github/workflows/twister-prep.yaml +++ b/.github/workflows/twister-prep.yaml @@ -83,7 +83,7 @@ jobs: run: | export ZEPHYR_BASE=${PWD} export ZEPHYR_TOOLCHAIN_VARIANT=zephyr - python3 ./scripts/ci/test_plan.py -c origin/${BASE_REF}.. --pull-request -t $TESTS_PER_BUILDER + python3 ./scripts/ci/test_plan.py -c origin/${BASE_REF}.. --no-detailed-test-id --pull-request -t $TESTS_PER_BUILDER if [ -s .testplan ]; then cat .testplan >> $GITHUB_ENV else diff --git a/.github/workflows/twister.yaml b/.github/workflows/twister.yaml index 1d863c7c69080..5cd8b2e59f39a 100644 --- a/.github/workflows/twister.yaml +++ b/.github/workflows/twister.yaml @@ -44,7 +44,7 @@ jobs: CCACHE_IGNOREOPTIONS: '-specs=* --specs=*' BSIM_OUT_PATH: /opt/bsim/ BSIM_COMPONENTS_PATH: /opt/bsim/components - TWISTER_COMMON: ' --force-color --inline-logs -v -N -M --retry-failed 3 --timeout-multiplier 2 ' + TWISTER_COMMON: '--no-detailed-test-id --force-color --inline-logs -v -N -M --retry-failed 3 --timeout-multiplier 2 ' DAILY_OPTIONS: ' -M --build-only --all --show-footprint' PR_OPTIONS: ' --clobber-output --integration' PUSH_OPTIONS: ' --clobber-output -M --show-footprint --report-filtered' From 1f17c761e5e78856ccde9a9f84b9f81974364374 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 22 Nov 2024 11:29:14 -0500 Subject: [PATCH 3010/4482] ci: test_plan: call with --no-detailed-test-id add --no-detailed-test-id to call of test_plan. Was missed in previous commit. Signed-off-by: Anas Nashif --- .github/workflows/twister.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/twister.yaml b/.github/workflows/twister.yaml index 5cd8b2e59f39a..01be87ffabdf0 100644 --- a/.github/workflows/twister.yaml +++ b/.github/workflows/twister.yaml @@ -148,7 +148,7 @@ jobs: rm -f testplan.json export ZEPHYR_BASE=${PWD} export ZEPHYR_TOOLCHAIN_VARIANT=zephyr - python3 ./scripts/ci/test_plan.py -c origin/${BASE_REF}.. --pull-request + python3 ./scripts/ci/test_plan.py -c origin/${BASE_REF}.. --pull-request --no-detailed-test-id ./scripts/twister --subset ${{matrix.subset}}/${{ strategy.job-total }} --load-tests testplan.json ${TWISTER_COMMON} ${PR_OPTIONS} if [ "${{matrix.subset}}" = "1" -a ${{needs.twister-build-prep.outputs.fullrun}} = 'True' ]; then ./scripts/zephyr_module.py --twister-out module_tests.args From aae018be873236a136264c8b65de1397c58cbeb5 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 20 Nov 2024 19:39:56 +0100 Subject: [PATCH 3011/4482] scripts: west_commands: runners: Remove obsolete pylint ignores These ignores were added with an older version of pylint and are either removed or ignored by default. Signed-off-by: Pieter De Gendt --- scripts/west_commands/runners/intel_cyclonev.py | 1 - scripts/west_commands/runners/uf2.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/west_commands/runners/intel_cyclonev.py b/scripts/west_commands/runners/intel_cyclonev.py index c14e20b967f93..764ebd7420b49 100644 --- a/scripts/west_commands/runners/intel_cyclonev.py +++ b/scripts/west_commands/runners/intel_cyclonev.py @@ -174,7 +174,6 @@ def print_gdbserver_message(self): self.logger.info('OpenOCD GDB server running on port ' f'{self.gdb_port}{thread_msg}') - # pylint: disable=R0201 def to_num(self, number): dev_match = re.search(r"^\d*\+dev", number) dev_version = not dev_match is None diff --git a/scripts/west_commands/runners/uf2.py b/scripts/west_commands/runners/uf2.py index 87db248c7bf30..0db4f0b9b4418 100644 --- a/scripts/west_commands/runners/uf2.py +++ b/scripts/west_commands/runners/uf2.py @@ -10,7 +10,7 @@ from runners.core import ZephyrBinaryRunner, RunnerCaps try: - import psutil # pylint: disable=unused-import + import psutil MISSING_PSUTIL = False except ImportError: # This can happen when building the documentation for the From 25be1501abb11eefa223575c7c148e51adaeccc9 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 20 Nov 2024 19:45:12 +0100 Subject: [PATCH 3012/4482] scripts: west_commands: runners: Fix pylint unbound issues Variables are possibly unbound, initialize to None. Signed-off-by: Pieter De Gendt --- scripts/west_commands/runners/intel_cyclonev.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/west_commands/runners/intel_cyclonev.py b/scripts/west_commands/runners/intel_cyclonev.py index 764ebd7420b49..490beca4da833 100644 --- a/scripts/west_commands/runners/intel_cyclonev.py +++ b/scripts/west_commands/runners/intel_cyclonev.py @@ -34,6 +34,10 @@ def __init__(self, cfg, pre_init=None, reset_halt_cmd=DEFAULT_OPENOCD_RESET_HALT support = path.join(cfg.board_dir, 'support') + gdb_commands = None + gdb_commands2 = None + gdb_commands_deb = None + if not config: default = path.join(support, 'openocd.cfg') default2 = path.join(support, 'download_all.gdb') From e8294b45904f71387a521863abd336173345d1f1 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 20 Nov 2024 09:01:24 +0100 Subject: [PATCH 3013/4482] scripts: west_commands: runners: Fix assert-false (B011) Prefer AssertionError instead of assert False. See https://docs.astral.sh/ruff/rules/assert-false/ Signed-off-by: Pieter De Gendt --- scripts/west_commands/runners/native.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/west_commands/runners/native.py b/scripts/west_commands/runners/native.py index 2cbcf60d3ab97..17add87fbc541 100644 --- a/scripts/west_commands/runners/native.py +++ b/scripts/west_commands/runners/native.py @@ -60,7 +60,7 @@ def do_run(self, command: str, **kwargs): elif command == 'debugserver': self.do_debugserver(**kwargs) else: - assert False + raise AssertionError def do_flash(self, **kwargs): cmd = [self.cfg.exe_file] From a48e37608f7190a8da51f61d4b7e71b13118a11b Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 20 Nov 2024 17:06:37 +0100 Subject: [PATCH 3014/4482] scripts: west_commands: runners: Ignore missing abstract decorator (B027) The empty function is intentional. https://docs.astral.sh/ruff/rules/empty-method-without-abstract-decorator/ Signed-off-by: Pieter De Gendt --- scripts/west_commands/runners/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/west_commands/runners/core.py b/scripts/west_commands/runners/core.py index 69491f1990df0..588e381e254a0 100644 --- a/scripts/west_commands/runners/core.py +++ b/scripts/west_commands/runners/core.py @@ -624,7 +624,7 @@ def add_parser(cls, parser): def do_add_parser(cls, parser): '''Hook for adding runner-specific options.''' - @classmethod + @classmethod # noqa: B027 def args_from_previous_runner(cls, previous_runner, args: argparse.Namespace): '''Update arguments from a previously created runner. From ddbba0ef4c8951e7bb210d84f0b2e201b6174842 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 20 Nov 2024 09:11:16 +0100 Subject: [PATCH 3015/4482] scripts: west_commands: runners: Fix mixed-spaces-and-tabs (E101) Use spaces for indentation. See https://docs.astral.sh/ruff/rules/mixed-spaces-and-tabs/ Signed-off-by: Pieter De Gendt --- scripts/west_commands/runners/bossac.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/west_commands/runners/bossac.py b/scripts/west_commands/runners/bossac.py index fcbd6fdf92be4..ff4478f1e1ffd 100644 --- a/scripts/west_commands/runners/bossac.py +++ b/scripts/west_commands/runners/bossac.py @@ -102,8 +102,7 @@ def get_chosen_code_partition_node(self): b = pathlib.Path(self.cfg.build_dir) edt_pickle = b / 'zephyr' / 'edt.pickle' if not edt_pickle.is_file(): - error_msg = "can't load devicetree; expected to find:" \ - + str(edt_pickle) + error_msg = "can't load devicetree; expected to find:" + str(edt_pickle) raise RuntimeError(error_msg) From 133665e55a707e6eb58425298779e3b3d680d319 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 20 Nov 2024 09:12:46 +0100 Subject: [PATCH 3016/4482] scripts: west_commands: runners: Fix unused-import (F401) Removed unused import. See https://docs.astral.sh/ruff/rules/unused-import/ Signed-off-by: Pieter De Gendt --- scripts/west_commands/runners/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/west_commands/runners/__init__.py b/scripts/west_commands/runners/__init__.py index a4fbe843782e9..000cdf1dc03ba 100644 --- a/scripts/west_commands/runners/__init__.py +++ b/scripts/west_commands/runners/__init__.py @@ -5,7 +5,7 @@ import importlib import logging -from runners.core import ZephyrBinaryRunner, MissingProgram +from runners.core import ZephyrBinaryRunner _logger = logging.getLogger('runners') From d397b0133890923d16547d10aba0bb7140684ad8 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 20 Nov 2024 09:15:57 +0100 Subject: [PATCH 3017/4482] scripts: west_commands: runners: Fix collapsible-if (SIM102) Combine multiple nested if statements. See https://docs.astral.sh/ruff/rules/collapsible-if/ Signed-off-by: Pieter De Gendt --- scripts/west_commands/runners/nrf_common.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index 220bd204249a7..b97cc5ef4a17e 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -264,15 +264,15 @@ def flush(self, force=False): 'must be recovered.\n' ' To fix, run "west flash --recover" instead.\n' + family_help) - if cpe.returncode == ErrVerify: - # If there are data in the UICR region it is likely that the - # verify failed du to the UICR not been erased before, so giving + if cpe.returncode == ErrVerify and self.hex_get_uicrs(): + # If there is data in the UICR region it is likely that the + # verify failed due to the UICR not been erased before, so giving # a warning here will hopefully enhance UX. - if self.hex_get_uicrs(): - self.logger.warning( - 'The hex file contains data placed in the UICR, which ' - 'may require a full erase before reprogramming. Run ' - 'west flash again with --erase, or --recover.') + self.logger.warning( + 'The hex file contains data placed in the UICR, which ' + 'may require a full erase before reprogramming. Run ' + 'west flash again with --erase, or --recover.' + ) raise From 2e39674344850cfce0e09b76255fc6a7835f9601 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 20 Nov 2024 09:18:43 +0100 Subject: [PATCH 3018/4482] scripts: west_commands: runners: Fix needless-bool (SIM103) Return the result instead of the if statements. See https://docs.astral.sh/ruff/rules/needless-bool/ Signed-off-by: Pieter De Gendt --- scripts/west_commands/runners/mdb.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/west_commands/runners/mdb.py b/scripts/west_commands/runners/mdb.py index 6dbffa30dbd9b..da040df9d8271 100644 --- a/scripts/west_commands/runners/mdb.py +++ b/scripts/west_commands/runners/mdb.py @@ -27,12 +27,10 @@ def is_flash_cmd_need_exit_immediately(mdb_runner): if is_simulation_run(mdb_runner): # for nsim, we can't run and quit immediately return False - elif is_hostlink_used(mdb_runner): - # if hostlink is used we can't run and quit immediately, as we still need MDB process - # attached to process hostlink IO - return False - else: - return True + + # if hostlink is used we can't run and quit immediately, as we still need MDB process + # attached to process hostlink IO + return not is_hostlink_used(mdb_runner) def smp_core_order(mdb_runner, id): if is_simulation_run(mdb_runner): From dbaf01ef289bae01a2f31428e05f8fb5093af5d1 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 20 Nov 2024 09:24:05 +0100 Subject: [PATCH 3019/4482] scripts: west_commands: runners: Ignore open file without ctx (SIM115) Add noqa to a complex statement with multiple open/close statements. See https://docs.astral.sh/ruff/rules/open-file-with-context-handler/ Signed-off-by: Pieter De Gendt --- scripts/west_commands/runners/canopen_program.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/west_commands/runners/canopen_program.py b/scripts/west_commands/runners/canopen_program.py index 2fb8ba42b0170..de670bb53e91b 100644 --- a/scripts/west_commands/runners/canopen_program.py +++ b/scripts/west_commands/runners/canopen_program.py @@ -278,7 +278,7 @@ def download(self, bin_file): self.logger.info('Downloading program: %s', bin_file) try: size = os.path.getsize(bin_file) - infile = open(bin_file, 'rb') + infile = open(bin_file, 'rb') # noqa: SIM115 outfile = self.data_sdo.open('wb', buffering=self.download_buffer_size, size=size, block_transfer=self.block_transfer) From fc5286fe2542a9d0165698ef01485fbc6ee4c24b Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 20 Nov 2024 09:26:48 +0100 Subject: [PATCH 3020/4482] scripts: west_commands: runners: Fix useless-object-inheritance (UP004) Remove object inheritance. See https://docs.astral.sh/ruff/rules/useless-object-inheritance/ Signed-off-by: Pieter De Gendt --- scripts/west_commands/runners/canopen_program.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/west_commands/runners/canopen_program.py b/scripts/west_commands/runners/canopen_program.py index de670bb53e91b..6183631cca0cc 100644 --- a/scripts/west_commands/runners/canopen_program.py +++ b/scripts/west_commands/runners/canopen_program.py @@ -185,7 +185,7 @@ def flash(self, **kwargs): self.downloader.disconnect() -class CANopenProgramDownloader(object): +class CANopenProgramDownloader: '''CANopen program downloader''' def __init__(self, logger, node_id, can_context=DEFAULT_CAN_CONTEXT, program_number=DEFAULT_PROGRAM_NUMBER, From d562731096996e50b61da4e50506a1cb182154ce Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 20 Nov 2024 09:28:27 +0100 Subject: [PATCH 3021/4482] scripts: west_commands: runners: Fix redundant-open-modes (UP015) Don't pass default open mode. See https://docs.astral.sh/ruff/rules/redundant-open-modes/ Signed-off-by: Pieter De Gendt --- scripts/west_commands/runners/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/west_commands/runners/core.py b/scripts/west_commands/runners/core.py index 588e381e254a0..b4ccc2eb5367c 100644 --- a/scripts/west_commands/runners/core.py +++ b/scripts/west_commands/runners/core.py @@ -190,7 +190,7 @@ def _parse(self): opt_value = re.compile(f'^(?P

Warning: this is a content sample. Proceed to -Zephyr About page +Zephyr About page for up to date information.

Mt zzV^|?(H0`GHv<>lSQH~!iozoJgsAR}Q(}r#A1@3@d!SdfvjNH|nNE*UiUsJC71a%W>wKbo6I>rwU-(jV z_~|EY3voeV*+fAYhMsmcXQOkr*N)9F`gjkh5jkql=&};%Y%9h>%eU*q)Ea-U8q^z5 z_@yp3`n>_aajcVYnvb3!xRYWwHa4OAolwc-r((d3F61~qfN+VS=4W2_u;|1C`6vNv zcn;3!qlltT+UXU$#0#6m1yf(uNjE|_h3spCdI5zwXLmb8*fCvTvE&<~cB3AjjOYfV znX5Sut;+434QW2P%zF4{QqK$TTEY`%=kqXGnE-l-YwKw5wC&P;F-`m(xI<4+Gru*- z7P-=U9}y?K!;k-&d%}6x{gl3#bw%J|YT;&9xQ3g6GrtEc&*#4eaZ(cvQn3q*bbG~M zgikJ~e!VJ6&F@mUyzh)(@R_~QT!}~j{G1M@J#}I{=MVJ|<+>?raqMdv3p{%aPev@mP3uT~CS3 zUGY=o(F5y2)5NR_GZoFxwSwC?+ze1l{rBd&XtGGOt&OWO-L^$}FDm2In7Kb)M&tww zY?9qiqqDB#aH5P$%a?24cQPj+-q8atsEigT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RiW8si-~Dou>XzwSc5SX@A#3yvh(JIcKL z-F}T~CTuB4C^{A_Hm2)VGY|zxPJ)|4%lIupK<^Q8*%#d(1dKT#izl3c$#Z~BA&!2c zhDI8-@>Oi))>}|JiP0G^Tb_7wGL$&@Y}9)pMzy@@{CmLMm`_@Ppoi7P;0b{eQ|O8< c&?5*ullg(nF@Pie_bt#WRN_pH_utb01L)htF8}}l diff --git a/boards/pine64/pinetime_devkit0/doc/img/PineTime_DevKit0.jpg b/boards/pine64/pinetime_devkit0/doc/img/pinetime_devkit0.jpg similarity index 100% rename from boards/pine64/pinetime_devkit0/doc/img/PineTime_DevKit0.jpg rename to boards/pine64/pinetime_devkit0/doc/img/pinetime_devkit0.jpg diff --git a/boards/pine64/pinetime_devkit0/doc/index.rst b/boards/pine64/pinetime_devkit0/doc/index.rst index 16a04cd329cc5..097bbcf4a11a6 100644 --- a/boards/pine64/pinetime_devkit0/doc/index.rst +++ b/boards/pine64/pinetime_devkit0/doc/index.rst @@ -1,28 +1,12 @@ -.. _pinetime_devkit0: - -Pine64 PineTime DevKit0 -####################### +.. zephyr:board:: pinetime_devkit0 Overview ******** -.. figure:: img/PineTime_leaflet.jpg - :align: center - :alt: Pine64 PineTime - - PineTime leaflet (Credit: Pine64) - - The Pine64 smartwatch, dubbed "PineTime", is a product of a community effort for an open source smartwatch in collaboration with wearable RTOS and Linux app developers/communities. -.. figure:: img/PineTime_DevKit0.jpg - :align: center - :alt: Pine64 PineTime - - PineTime Dev Kit (Credit: Pine64) - Hardware ******** From 2df21ce76a07353cbd5b01390908c5403a6c7a55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 14:36:16 +0200 Subject: [PATCH 1583/4482] boards: quicklogic: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Quicklogic boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/quicklogic/qomu/doc/index.rst | 12 +----------- boards/quicklogic/quick_feather/doc/index.rst | 12 +----------- samples/drivers/fpga/fpga_controller/README.rst | 2 +- 3 files changed, 3 insertions(+), 23 deletions(-) diff --git a/boards/quicklogic/qomu/doc/index.rst b/boards/quicklogic/qomu/doc/index.rst index 57505aebe91c0..7406e9896b57c 100644 --- a/boards/quicklogic/qomu/doc/index.rst +++ b/boards/quicklogic/qomu/doc/index.rst @@ -1,20 +1,10 @@ -.. _qomu: - -Qomu -#### +.. zephyr:board:: qomu Overview ******** The Qomu board is a platform with an on-board QuickLogic EOS S3 Sensor Processing Platform. - -.. figure:: img/qomu-board.png - :align: center - :alt: Qomu - - Qomu (Credit: QuickLogic) - Hardware ******** diff --git a/boards/quicklogic/quick_feather/doc/index.rst b/boards/quicklogic/quick_feather/doc/index.rst index d5bf1e7026de3..1139464395689 100644 --- a/boards/quicklogic/quick_feather/doc/index.rst +++ b/boards/quicklogic/quick_feather/doc/index.rst @@ -1,7 +1,4 @@ -.. _quickfeather: - -QuickFeather -############ +.. zephyr:board:: quick_feather Overview ******** @@ -9,13 +6,6 @@ Overview The QuickFeather development board is a platform with an on-board QuickLogic EOS S3 Sensor Processing Platform. - -.. figure:: img/feather-board.jpg - :align: center - :alt: QuickFeather - - QuickFeather (Credit: QuickLogic) - Hardware ******** diff --git a/samples/drivers/fpga/fpga_controller/README.rst b/samples/drivers/fpga/fpga_controller/README.rst index 92f4ea67d663e..4b2bfe9e3de18 100644 --- a/samples/drivers/fpga/fpga_controller/README.rst +++ b/samples/drivers/fpga/fpga_controller/README.rst @@ -44,7 +44,7 @@ configuration file prj_shell.conf: Running ******* -See :ref:`quickfeather` on how to load an image to the board. +See :zephyr:board:`quick_feather` on how to load an image to the board. Sample output ============= From a38b648b8433c3359bbafa512800651f1ef6bf87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 14:32:35 +0200 Subject: [PATCH 1584/4482] boards: rak: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the RAK Wireless boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/rakwireless/rak11720/doc/index.rst | 9 +-------- boards/rakwireless/rak4631/doc/index.rst | 9 +-------- boards/rakwireless/rak5010/doc/index.rst | 6 +----- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/boards/rakwireless/rak11720/doc/index.rst b/boards/rakwireless/rak11720/doc/index.rst index 238ba6d830378..cae97f57c14cb 100644 --- a/boards/rakwireless/rak11720/doc/index.rst +++ b/boards/rakwireless/rak11720/doc/index.rst @@ -1,7 +1,4 @@ -.. _rak11720: - -RAK11720 -######## +.. zephyr:board:: rak11720 The RAK11720 is a WisBlock Core module for RAK WisBlock. It is based on the powerful ultra-low power Apollo3 Blue SoC (AMA3B1KK-KBR-B0) @@ -13,10 +10,6 @@ comes in the same size and footprint as our RAK3172 module which gives you the opportunity to enhance your existing designs with BLE without designing a new PCB. -.. image:: img/rak11720.webp - :align: center - :alt: RAK11720 - Hardware ******** diff --git a/boards/rakwireless/rak4631/doc/index.rst b/boards/rakwireless/rak4631/doc/index.rst index 14c6c91297687..49055f67bf51b 100644 --- a/boards/rakwireless/rak4631/doc/index.rst +++ b/boards/rakwireless/rak4631/doc/index.rst @@ -1,7 +1,4 @@ -.. _rak4631_nrf52840: - -RAK4631 -####### +.. zephyr:board:: rak4631 Overview ******** @@ -16,10 +13,6 @@ the same TX power. This makes the RAK4631 an ultra-low power communication solution. RAK4631 can be comfortably programmed with ZephyrRTOS. -.. image:: img/rak4631-front-parts.jpg - :align: center - :alt: RAK4631-NRF52840 - Hardware ******** diff --git a/boards/rakwireless/rak5010/doc/index.rst b/boards/rakwireless/rak5010/doc/index.rst index 851d892484287..3ffc2b7f7124d 100644 --- a/boards/rakwireless/rak5010/doc/index.rst +++ b/boards/rakwireless/rak5010/doc/index.rst @@ -1,4 +1,4 @@ -.. _rak5010_nrf52840: +.. zephyr:board:: rak5010 RAK5010 ####### @@ -24,10 +24,6 @@ quick testing and prototyping tool for applications requiring NB-IoT connectivity. Application development supports the GCC environment. -.. image:: img/rak5010-front-parts.jpg - :align: center - :alt: RAK5010-NRF52840 - Hardware ******** From 3f6f4ca3931cab70e1e66b5d14c9707af59b6f3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 12:16:11 +0200 Subject: [PATCH 1585/4482] boards: ruuvi: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Ruuvi boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/ruuvi/ruuvitag/doc/index.rst | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/boards/ruuvi/ruuvitag/doc/index.rst b/boards/ruuvi/ruuvitag/doc/index.rst index 42348b8a38776..946b9549468ba 100644 --- a/boards/ruuvi/ruuvitag/doc/index.rst +++ b/boards/ruuvi/ruuvitag/doc/index.rst @@ -1,7 +1,4 @@ -.. _ruuvi_ruuvitag: - -Ruuvi RuuviTag -############## +.. zephyr:board:: ruuvi_ruuvitag Overview ******** @@ -10,12 +7,6 @@ RuuviTag is an advanced battery-operated open-source Bluetooth enabled sensor beacon platform capable of sending temperature, humidity, pressure, and motion information over Bluetooth Low Energy. -.. figure:: img/ruuvitag.jpg - :align: center - :alt: RUUVI RuuviTag - - RUUVI RuuviTag (Credit: https://ruuvi.com/) - More information about the board can be found at the `ruuvitag website`_. From a43009079f6670ef1085603b0474d147ffdb76f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 14:10:20 +0200 Subject: [PATCH 1586/4482] boards: st: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the STM32 boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/st/b_g474e_dpow1/doc/index.rst | 9 +-------- boards/st/b_l072z_lrwan1/doc/index.rst | 9 +-------- boards/st/b_l4s5i_iot01a/doc/index.rst | 9 +-------- boards/st/b_u585i_iot02a/doc/index.rst | 9 +-------- boards/st/disco_l475_iot1/doc/index.rst | 9 +-------- boards/st/nucleo_c031c6/doc/index.rst | 9 +-------- boards/st/nucleo_f030r8/doc/index.rst | 9 +-------- boards/st/nucleo_f031k6/doc/index.rst | 9 +-------- boards/st/nucleo_f042k6/doc/index.rst | 9 +-------- boards/st/nucleo_f070rb/doc/index.rst | 9 +-------- boards/st/nucleo_f091rc/doc/index.rst | 9 +-------- boards/st/nucleo_f103rb/doc/index.rst | 9 +-------- boards/st/nucleo_f207zg/doc/index.rst | 9 +-------- boards/st/nucleo_f302r8/doc/index.rst | 9 +-------- boards/st/nucleo_f303k8/doc/index.rst | 9 +-------- boards/st/nucleo_f303re/doc/index.rst | 9 +-------- boards/st/nucleo_f334r8/doc/index.rst | 9 +-------- boards/st/nucleo_f401re/doc/index.rst | 9 +-------- boards/st/nucleo_f410rb/doc/index.rst | 9 +-------- boards/st/nucleo_f411re/doc/index.rst | 9 +-------- boards/st/nucleo_f412zg/doc/index.rst | 9 +-------- boards/st/nucleo_f413zh/doc/index.rst | 9 +-------- boards/st/nucleo_f429zi/doc/index.rst | 9 +-------- boards/st/nucleo_f446re/doc/index.rst | 9 +-------- boards/st/nucleo_f446ze/doc/index.rst | 9 +-------- boards/st/nucleo_f722ze/doc/index.rst | 10 +--------- boards/st/nucleo_f746zg/doc/index.rst | 9 +-------- boards/st/nucleo_f756zg/doc/index.rst | 9 +-------- boards/st/nucleo_f767zi/doc/index.rst | 9 +-------- boards/st/nucleo_g031k8/doc/index.rst | 9 +-------- boards/st/nucleo_g070rb/doc/index.rst | 9 +-------- boards/st/nucleo_g071rb/doc/index.rst | 9 +-------- boards/st/nucleo_g0b1re/doc/index.rst | 9 +-------- boards/st/nucleo_g431kb/doc/index.rst | 9 +-------- boards/st/nucleo_g431rb/doc/index.rst | 9 +-------- boards/st/nucleo_g474re/doc/index.rst | 9 +-------- boards/st/nucleo_h503rb/doc/index.rst | 5 +---- boards/st/nucleo_h533re/doc/index.rst | 9 +-------- boards/st/nucleo_h563zi/doc/index.rst | 9 +-------- boards/st/nucleo_h723zg/doc/index.rst | 9 +-------- boards/st/nucleo_h743zi/doc/index.rst | 9 +-------- boards/st/nucleo_h745zi_q/doc/index.rst | 9 +-------- boards/st/nucleo_h753zi/doc/index.rst | 9 +-------- boards/st/nucleo_h755zi_q/doc/index.rst | 9 +-------- boards/st/nucleo_h7a3zi_q/doc/index.rst | 9 +-------- boards/st/nucleo_l011k4/doc/index.rst | 9 +-------- boards/st/nucleo_l031k6/doc/index.rst | 9 +-------- boards/st/nucleo_l053r8/doc/index.rst | 9 +-------- boards/st/nucleo_l073rz/doc/index.rst | 9 +-------- boards/st/nucleo_l152re/doc/index.rst | 9 +-------- boards/st/nucleo_l412rb_p/doc/index.rst | 9 +-------- boards/st/nucleo_l432kc/doc/index.rst | 9 +-------- boards/st/nucleo_l433rc_p/doc/index.rst | 9 +-------- boards/st/nucleo_l452re/doc/index.rst | 9 +-------- boards/st/nucleo_l476rg/doc/index.rst | 9 +-------- boards/st/nucleo_l496zg/doc/index.rst | 9 +-------- boards/st/nucleo_l4a6zg/doc/index.rst | 9 +-------- boards/st/nucleo_l4r5zi/doc/index.rst | 9 +-------- boards/st/nucleo_l552ze_q/doc/nucleol552ze_q.rst | 9 +-------- boards/st/nucleo_u031r8/doc/index.rst | 9 +-------- boards/st/nucleo_u083rc/doc/index.rst | 9 +-------- boards/st/nucleo_u575zi_q/doc/index.rst | 5 +---- boards/st/nucleo_u5a5zj_q/doc/index.rst | 5 +---- boards/st/nucleo_wb05kz/doc/index.rst | 9 +-------- boards/st/nucleo_wb09ke/doc/index.rst | 9 +-------- boards/st/nucleo_wb55rg/doc/nucleo_wb55rg.rst | 9 +-------- boards/st/nucleo_wba52cg/doc/nucleo_wba52cg.rst | 9 +-------- boards/st/nucleo_wba55cg/doc/nucleo_wba55cg.rst | 9 +-------- boards/st/nucleo_wl55jc/doc/nucleo_wl55jc.rst | 9 +-------- boards/st/sensortile_box/doc/index.rst | 9 +-------- boards/st/sensortile_box_pro/doc/index.rst | 9 +-------- .../{docs => doc}/img/st25dv_mb1283_disco.jpg | Bin .../st25dv_mb1283_disco/{docs => doc}/index.rst | 9 +-------- boards/st/steval_fcu001v1/doc/index.rst | 9 +-------- boards/st/steval_stwinbx1/doc/index.rst | 9 +-------- boards/st/stm3210c_eval/doc/index.rst | 9 +-------- boards/st/stm32373c_eval/doc/index.rst | 9 +-------- boards/st/stm32c0116_dk/doc/index.rst | 9 +-------- boards/st/stm32f072_eval/doc/index.rst | 10 +--------- boards/st/stm32f072b_disco/doc/index.rst | 9 +-------- boards/st/stm32f0_disco/doc/index.rst | 9 +-------- boards/st/stm32f3_disco/doc/index.rst | 9 +-------- boards/st/stm32f411e_disco/doc/index.rst | 9 +-------- boards/st/stm32f412g_disco/doc/index.rst | 9 +-------- boards/st/stm32f429i_disc1/doc/index.rst | 9 +-------- boards/st/stm32f469i_disco/doc/index.rst | 9 +-------- boards/st/stm32f4_disco/doc/index.rst | 9 +-------- boards/st/stm32f723e_disco/doc/index.rst | 9 +-------- boards/st/stm32f746g_disco/doc/index.rst | 9 +-------- boards/st/stm32f7508_dk/doc/index.rst | 9 +-------- boards/st/stm32f769i_disco/doc/index.rst | 9 +-------- boards/st/stm32g0316_disco/doc/index.rst | 9 +-------- boards/st/stm32g071b_disco/doc/index.rst | 9 +-------- boards/st/stm32g081b_eval/doc/index.rst | 9 +-------- boards/st/stm32h573i_dk/doc/index.rst | 9 +-------- boards/st/stm32h735g_disco/doc/index.rst | 9 +-------- boards/st/stm32h745i_disco/doc/index.rst | 9 +-------- boards/st/stm32h747i_disco/doc/index.rst | 9 +-------- boards/st/stm32h750b_dk/doc/index.rst | 9 +-------- boards/st/stm32h7b3i_dk/doc/index.rst | 9 +-------- boards/st/stm32h7s78_dk/doc/index.rst | 9 +-------- boards/st/stm32l1_disco/doc/index.rst | 9 +-------- boards/st/stm32l476g_disco/doc/index.rst | 9 +-------- boards/st/stm32l496g_disco/doc/index.rst | 9 +-------- boards/st/stm32l4r9i_disco/doc/index.rst | 9 +-------- boards/st/stm32l562e_dk/doc/index.rst | 9 +-------- boards/st/stm32mp157c_dk2/doc/stm32mp157_dk2.rst | 9 +-------- boards/st/stm32u083c_dk/doc/index.rst | 9 +-------- boards/st/stm32u5a9j_dk/doc/index.rst | 5 +---- boards/st/stm32vl_disco/doc/index.rst | 9 +-------- boards/st/stm32wb5mm_dk/doc/stm32wb5mm_dk.rst | 9 +-------- boards/st/stm32wb5mmg/doc/stm32wb5mmg.rst | 9 +-------- doc/connectivity/networking/api/gptp.rst | 6 +++--- doc/releases/release-notes-3.7.rst | 14 +++++++------- doc/services/tfm/requirements.rst | 6 +++--- samples/basic/blinky_pwm/README.rst | 12 ++++++------ .../st/bluetooth/interactive_gui/README.rst | 2 +- samples/boards/st/sensortile_box/README.rst | 4 ++-- .../sensors-on-board/README.rst | 4 ++-- .../boards/st/steval_stwinbx1/sensors/README.rst | 4 ++-- samples/drivers/adc/adc_dt/README.rst | 2 +- samples/drivers/counter/alarm/README.rst | 2 +- samples/drivers/dac/README.rst | 14 +++++++------- samples/drivers/haptics/drv2605/README.rst | 4 ++-- samples/drivers/led/pca9633/README.rst | 4 ++-- samples/drivers/watchdog/README.rst | 2 +- samples/modules/canopennode/README.rst | 4 ++-- samples/net/cloud/tagoio_http_post/README.rst | 4 ++-- samples/net/sockets/can/README.rst | 4 ++-- samples/sensor/lis2dh/README.rst | 2 +- samples/sensor/lsm6dso/README.rst | 4 ++-- samples/shields/x_nucleo_53l0a1/README.rst | 2 +- samples/shields/x_nucleo_iks01a1/README.rst | 2 +- .../shields/x_nucleo_iks01a2/sensorhub/README.rst | 2 +- .../shields/x_nucleo_iks01a2/standard/README.rst | 4 ++-- .../shields/x_nucleo_iks01a3/sensorhub/README.rst | 4 ++-- .../shields/x_nucleo_iks01a3/standard/README.rst | 4 ++-- .../x_nucleo_iks02a1/microphone/README.rst | 2 +- .../shields/x_nucleo_iks02a1/sensorhub/README.rst | 4 ++-- .../shields/x_nucleo_iks02a1/standard/README.rst | 4 ++-- .../shields/x_nucleo_iks4a1/sensorhub1/README.rst | 4 ++-- .../shields/x_nucleo_iks4a1/sensorhub2/README.rst | 4 ++-- .../shields/x_nucleo_iks4a1/standard/README.rst | 4 ++-- samples/subsys/fs/littlefs/README.rst | 2 +- samples/subsys/input/draw_touch_events/README.rst | 2 +- samples/subsys/mgmt/updatehub/README.rst | 2 +- samples/subsys/smf/hsm_psicc2/README.rst | 2 +- samples/subsys/smf/smf_calculator/README.rst | 14 +++++++------- samples/subsys/task_wdt/README.rst | 2 +- samples/subsys/usb_c/sink/README.rst | 4 ++-- samples/tfm_integration/tfm_ipc/README.rst | 2 +- 151 files changed, 195 insertions(+), 958 deletions(-) rename boards/st/st25dv_mb1283_disco/{docs => doc}/img/st25dv_mb1283_disco.jpg (100%) rename boards/st/st25dv_mb1283_disco/{docs => doc}/index.rst (95%) diff --git a/boards/st/b_g474e_dpow1/doc/index.rst b/boards/st/b_g474e_dpow1/doc/index.rst index 7e1f584b5221d..b130b72866320 100644 --- a/boards/st/b_g474e_dpow1/doc/index.rst +++ b/boards/st/b_g474e_dpow1/doc/index.rst @@ -1,7 +1,4 @@ -.. _b_g474e_dpow1_board: - -ST B-G474E-DPOW1 Discovery -########################## +.. zephyr:board:: b_g474e_dpow1 Overview ******** @@ -34,10 +31,6 @@ the STLINK-V3E debugger and programmer. - On-board STLINK-V3E debugger/programmer with USB re-enumeration capability: mass storage, Virtual COM port, and debug port -.. image:: img/b_g474e_dpow1.jpg - :align: center - :alt: B-G474E-DPOW1 - More information about the board can be found at the `B-G474E-DPOW1 website`_. diff --git a/boards/st/b_l072z_lrwan1/doc/index.rst b/boards/st/b_l072z_lrwan1/doc/index.rst index 527461c24a44b..06385429700a1 100644 --- a/boards/st/b_l072z_lrwan1/doc/index.rst +++ b/boards/st/b_l072z_lrwan1/doc/index.rst @@ -1,7 +1,4 @@ -.. _b_l072z_lrwan1_board: - -ST B-L072Z-LRWAN1 Discovery kit -############################### +.. zephyr:board:: b_l072z_lrwan1 Overview ******** @@ -53,10 +50,6 @@ This kit provides: - 2 push-buttons (user and reset) - Arduino* Uno V3 connectors -.. image:: img/b_l072z_lrwan1.jpg - :align: center - :alt: B-L072Z-LRWAN1 - More information about the board can be found at the `B-L072Z-LRWAN1 website`_. Hardware diff --git a/boards/st/b_l4s5i_iot01a/doc/index.rst b/boards/st/b_l4s5i_iot01a/doc/index.rst index fb1620c672d6c..83a6dcd1e8a7c 100644 --- a/boards/st/b_l4s5i_iot01a/doc/index.rst +++ b/boards/st/b_l4s5i_iot01a/doc/index.rst @@ -1,7 +1,4 @@ -.. _b_l4s5i_iot01a_board: - -ST B_L4S5I_IOT01A Discovery kit -############################### +.. zephyr:board:: b_l4s5i_iot01a Overview ******** @@ -40,10 +37,6 @@ some highlights of the B_L4S5I_IOT01A Discovery kit: - External 5 V -.. image:: img/b-l4s5i_iot01a.jpg - :align: center - :alt: B_L4S5I_IOT01A Discovery kit - More information about the board can be found at the `B L4S5I IOT01A Discovery kit website`_. Hardware diff --git a/boards/st/b_u585i_iot02a/doc/index.rst b/boards/st/b_u585i_iot02a/doc/index.rst index 2400f75e3d172..c9d9378444a07 100644 --- a/boards/st/b_u585i_iot02a/doc/index.rst +++ b/boards/st/b_u585i_iot02a/doc/index.rst @@ -1,7 +1,4 @@ -.. _b_u585i_iot02a_board: - -ST B_U585I_IOT02A Discovery kit -############################### +.. zephyr:board:: b_u585i_iot02a Overview ******** @@ -35,10 +32,6 @@ some highlights of the B_U585I_IOT02A Discovery kit: - External sources -.. image:: img/b-u585i-iot02a.jpg - :align: center - :alt: B_U585I_IOT02A Discovery kit - More information about the board can be found at the `B U585I IOT02A Discovery kit website`_. Hardware diff --git a/boards/st/disco_l475_iot1/doc/index.rst b/boards/st/disco_l475_iot1/doc/index.rst index 197881078a31b..b301979a16389 100644 --- a/boards/st/disco_l475_iot1/doc/index.rst +++ b/boards/st/disco_l475_iot1/doc/index.rst @@ -1,7 +1,4 @@ -.. _disco_l475_iot1_board: - -ST Disco L475 IOT01 (B-L475E-IOT01A) -#################################### +.. zephyr:board:: disco_l475_iot1 Overview ******** @@ -36,10 +33,6 @@ This kit provides: - mass storage, virtual COM port and debug port -.. image:: img/disco_l475_iot1.jpg - :align: center - :alt: Disco L475 IoT1 - More information about the board can be found at the `Disco L475 IoT1 website`_. Hardware diff --git a/boards/st/nucleo_c031c6/doc/index.rst b/boards/st/nucleo_c031c6/doc/index.rst index 997b60e47e62e..7de1e597fac4f 100644 --- a/boards/st/nucleo_c031c6/doc/index.rst +++ b/boards/st/nucleo_c031c6/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_c031c6_board: - -ST Nucleo C031C6 -################ +.. zephyr:board:: nucleo_c031c6 Overview ******** @@ -16,10 +13,6 @@ The STM32 Nucleo board integrates the ST-LINK/V2-1 debugger and programmer. The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together with various packaged software examples. -.. image:: img/nucleo_c031c6.jpg - :align: center - :alt: Nucleo C031C6 - More information about the board can be found at the `Nucleo C031C6 website`_. Hardware diff --git a/boards/st/nucleo_f030r8/doc/index.rst b/boards/st/nucleo_f030r8/doc/index.rst index 376faaa2d57c6..34abf6f6cb08a 100644 --- a/boards/st/nucleo_f030r8/doc/index.rst +++ b/boards/st/nucleo_f030r8/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f030r8_board: - -ST Nucleo F030R8 -################ +.. zephyr:board:: nucleo_f030r8 Overview ******** @@ -20,10 +17,6 @@ The STM32 Nucleo board integrates the ST-LINK/V2-1 debugger and programmer. The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together with various packaged software examples. -.. image:: img/nucleo_f030r8.jpg - :align: center - :alt: Nucleo F030R8 - More information about the board can be found at the `Nucleo F030R8 website`_. Hardware diff --git a/boards/st/nucleo_f031k6/doc/index.rst b/boards/st/nucleo_f031k6/doc/index.rst index ba1a44d8bc48b..2da4927aeadd2 100644 --- a/boards/st/nucleo_f031k6/doc/index.rst +++ b/boards/st/nucleo_f031k6/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f031k6_board: - -ST Nucleo F031K6 -################ +.. zephyr:board:: nucleo_f031k6 Overview ******** @@ -16,10 +13,6 @@ The STM32 Nucleo board integrates the ST-LINK/V2-1 debugger and programmer. The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together with various packaged software examples. -.. image:: img/nucleo_f031k6.jpg - :align: center - :alt: Nucleo F031k6 - More information about the board can be found at the `Nucleo F031K6 website`_. Hardware diff --git a/boards/st/nucleo_f042k6/doc/index.rst b/boards/st/nucleo_f042k6/doc/index.rst index 7d0ec6e2a2bcf..51145f105e24b 100644 --- a/boards/st/nucleo_f042k6/doc/index.rst +++ b/boards/st/nucleo_f042k6/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f042k6_board: - -ST Nucleo F042K6 -################ +.. zephyr:board:: nucleo_f042k6 Overview ******** @@ -16,10 +13,6 @@ The STM32 Nucleo board integrates the ST-LINK/V2-1 debugger and programmer. The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together with various packaged software examples. -.. image:: img/nucleo_f042k6.jpg - :align: center - :alt: Nucleo F042k6 - More information about the board can be found at the `Nucleo F042K6 website`_. Hardware diff --git a/boards/st/nucleo_f070rb/doc/index.rst b/boards/st/nucleo_f070rb/doc/index.rst index acecfb2097937..c198fe28f6e20 100644 --- a/boards/st/nucleo_f070rb/doc/index.rst +++ b/boards/st/nucleo_f070rb/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f070rb_board: - -ST Nucleo F070RB -################ +.. zephyr:board:: nucleo_f070rb Overview ******** @@ -20,10 +17,6 @@ The STM32 Nucleo board integrates the ST-LINK/V2-1 debugger and programmer. The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together with various packaged software examples. -.. image:: img/nucleo_f070rb.jpg - :align: center - :alt: Nucleo F070RB - More information about the board can be found at the `Nucleo F070RB website`_. Hardware diff --git a/boards/st/nucleo_f091rc/doc/index.rst b/boards/st/nucleo_f091rc/doc/index.rst index 2cce144c1fbcc..60181533aff9d 100644 --- a/boards/st/nucleo_f091rc/doc/index.rst +++ b/boards/st/nucleo_f091rc/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f091rc_board: - -ST Nucleo F091RC -################ +.. zephyr:board:: nucleo_f091rc Overview ******** @@ -20,10 +17,6 @@ The STM32 Nucleo board integrates the ST-LINK/V2-1 debugger and programmer. The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together with various packaged software examples. -.. image:: img/nucleo_f091rc.jpg - :align: center - :alt: Nucleo F091RC - More information about the board can be found at the `Nucleo F091RC website`_. Hardware diff --git a/boards/st/nucleo_f103rb/doc/index.rst b/boards/st/nucleo_f103rb/doc/index.rst index 8a9baaea537de..662fd3ac3cc87 100644 --- a/boards/st/nucleo_f103rb/doc/index.rst +++ b/boards/st/nucleo_f103rb/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f103rb_board: - -ST Nucleo F103RB -################ +.. zephyr:board:: nucleo_f103rb Overview ******** @@ -20,10 +17,6 @@ The STM32 Nucleo board integrates the ST-LINK/V2-1 debugger and programmer. The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together with various packaged software examples. -.. image:: img/nucleo_f103rb.jpg - :align: center - :alt: Nucleo F103RB - More information about the board can be found at the `Nucleo F103RB website`_. Hardware diff --git a/boards/st/nucleo_f207zg/doc/index.rst b/boards/st/nucleo_f207zg/doc/index.rst index 17d51354dded8..51082a2cfc6c6 100644 --- a/boards/st/nucleo_f207zg/doc/index.rst +++ b/boards/st/nucleo_f207zg/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f207zg_board: - -ST Nucleo F207ZG -################ +.. zephyr:board:: nucleo_f207zg Overview ******** @@ -29,10 +26,6 @@ some highlights of the Nucleo F207ZG board: - Three user LEDs - Two push-buttons: USER and RESET -.. image:: img/nucleo_f207zg.jpg - :align: center - :alt: Nucleo F207ZG - More information about the board can be found at the `Nucleo F207ZG website`_. Hardware diff --git a/boards/st/nucleo_f302r8/doc/index.rst b/boards/st/nucleo_f302r8/doc/index.rst index 8cb3f9e8a1311..9609270cd69c1 100644 --- a/boards/st/nucleo_f302r8/doc/index.rst +++ b/boards/st/nucleo_f302r8/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f302r8_board: - -ST Nucleo F302R8 -################ +.. zephyr:board:: nucleo_f302r8 Overview ******** @@ -27,10 +24,6 @@ Here are some highlights of the Nucleo F302R8 board: - One user LED - Two push-buttons: USER and RESET -.. image:: img/nucleo_f302r8.jpg - :align: center - :alt: Nucleo F302R8 - More information about the board can be found at the `Nucleo F302R8 website`_, and in the `STM32 Nucleo-64 board User Manual`_. diff --git a/boards/st/nucleo_f303k8/doc/index.rst b/boards/st/nucleo_f303k8/doc/index.rst index e659d453a80c2..a21cc477b413c 100644 --- a/boards/st/nucleo_f303k8/doc/index.rst +++ b/boards/st/nucleo_f303k8/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f303k8_board: - -ST Nucleo F303K8 -################ +.. zephyr:board:: nucleo_f303k8 Overview ******** @@ -24,10 +21,6 @@ Here are some highlights of the Nucleo F303K8 board: - One user LED - One push-buttons: RESET -.. image:: img/nucleo_f303k8.jpg - :align: center - :alt: Nucleo F303K8 - More information about the board can be found at the `Nucleo F303K8 website`_, and in the `STM32 Nucleo-32 board User Manual`_. diff --git a/boards/st/nucleo_f303re/doc/index.rst b/boards/st/nucleo_f303re/doc/index.rst index dc7d7e2d0a6a4..1c8b6363a397c 100644 --- a/boards/st/nucleo_f303re/doc/index.rst +++ b/boards/st/nucleo_f303re/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f303re_board: - -ST Nucleo F303RE -################ +.. zephyr:board:: nucleo_f303re Overview ******** @@ -27,10 +24,6 @@ Here are some highlights of the Nucleo F303RE board: - One user LED - Two push-buttons: USER and RESET -.. image:: img/nucleo_f303re.jpg - :align: center - :alt: Nucleo F303RE - More information about the board can be found at the `Nucleo F303RE website`_, and in the `STM32 Nucleo-64 board User Manual`_. diff --git a/boards/st/nucleo_f334r8/doc/index.rst b/boards/st/nucleo_f334r8/doc/index.rst index 0115b2bda9cdf..385f4e05094ee 100644 --- a/boards/st/nucleo_f334r8/doc/index.rst +++ b/boards/st/nucleo_f334r8/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f334r8_board: - -ST Nucleo F334R8 -################ +.. zephyr:board:: nucleo_f334r8 Overview ******** @@ -21,10 +18,6 @@ debugger and programmer. The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together with various packaged software examples. -.. image:: img/nucleo_f334r8.jpg - :align: center - :alt: Nucleo F334R8 - More information about the board can be found at the `Nucleo F334R8 website`_. Hardware diff --git a/boards/st/nucleo_f401re/doc/index.rst b/boards/st/nucleo_f401re/doc/index.rst index 123992ac18b70..fc64a2e5bfde6 100644 --- a/boards/st/nucleo_f401re/doc/index.rst +++ b/boards/st/nucleo_f401re/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f401re_board: - -ST Nucleo F401RE -################ +.. zephyr:board:: nucleo_f401re Overview ******** @@ -25,10 +22,6 @@ some highlights of the Nucleo F401RE board: - Three LEDs: USB communication (LD1), user LED (LD2), power LED (LD3) - Two push-buttons: USER and RESET -.. image:: img/nucleo_f401re.jpg - :align: center - :alt: Nucleo F401RE - More information about the board can be found at the `Nucleo F401RE website`_. Hardware diff --git a/boards/st/nucleo_f410rb/doc/index.rst b/boards/st/nucleo_f410rb/doc/index.rst index af87b501923aa..4b48811fdf9fa 100644 --- a/boards/st/nucleo_f410rb/doc/index.rst +++ b/boards/st/nucleo_f410rb/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f410rb_board: - -ST Nucleo F410RB -################ +.. zephyr:board:: nucleo_f410rb Overview ******** @@ -25,10 +22,6 @@ some highlights of the Nucleo F410RB board: - Three LEDs: USB communication (LD1), user LED (LD2), power LED (LD3) - Two push-buttons: USER and RESET -.. image:: img/nucleo_f410rb.jpg - :align: center - :alt: Nucleo F410RB - More information about the board can be found at the `Nucleo F410RB website`_. Hardware diff --git a/boards/st/nucleo_f411re/doc/index.rst b/boards/st/nucleo_f411re/doc/index.rst index e4c10085d9bca..cdfcd32678708 100644 --- a/boards/st/nucleo_f411re/doc/index.rst +++ b/boards/st/nucleo_f411re/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f411re_board: - -ST Nucleo F411RE -################ +.. zephyr:board:: nucleo_f411re Overview ******** @@ -25,10 +22,6 @@ some highlights of the Nucleo F411RE board: - Three LEDs: USB communication (LD1), user LED (LD2), power LED (LD3) - Two push-buttons: USER and RESET -.. image:: img/nucleo_f411re.jpg - :align: center - :alt: Nucleo F411RE - More information about the board can be found at the `Nucleo F411RE website`_. Hardware diff --git a/boards/st/nucleo_f412zg/doc/index.rst b/boards/st/nucleo_f412zg/doc/index.rst index f3f1cf0db7532..60f5f06531a22 100644 --- a/boards/st/nucleo_f412zg/doc/index.rst +++ b/boards/st/nucleo_f412zg/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f412zg_board: - -ST Nucleo F412ZG -################ +.. zephyr:board:: nucleo_f412zg Overview ******** @@ -28,10 +25,6 @@ some highlights of the Nucleo F412ZG board: - Three user LEDs - Two push-buttons: USER and RESET -.. image:: img/nucleo_f412zg.jpg - :align: center - :alt: Nucleo F412ZG - More information about the board can be found at the `Nucleo F412ZG website`_. Hardware diff --git a/boards/st/nucleo_f413zh/doc/index.rst b/boards/st/nucleo_f413zh/doc/index.rst index 1240923df8257..0c9bad9f77d42 100644 --- a/boards/st/nucleo_f413zh/doc/index.rst +++ b/boards/st/nucleo_f413zh/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f413zh_board: - -ST Nucleo F413ZH -################ +.. zephyr:board:: nucleo_f413zh Overview ******** @@ -28,10 +25,6 @@ some highlights of the Nucleo F413ZH board: - Three user LEDs - Two push-buttons: USER and RESET -.. image:: img/nucleo_f413zh.jpg - :align: center - :alt: Nucleo F413ZH - More information about the board can be found at the `Nucleo F413ZH website`_. Hardware diff --git a/boards/st/nucleo_f429zi/doc/index.rst b/boards/st/nucleo_f429zi/doc/index.rst index 924c30de42bc6..1fe03b83ced52 100644 --- a/boards/st/nucleo_f429zi/doc/index.rst +++ b/boards/st/nucleo_f429zi/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f429zi_board: - -ST Nucleo F429ZI -################ +.. zephyr:board:: nucleo_f429zi Overview ******** @@ -31,10 +28,6 @@ some highlights of the Nucleo F429ZI board: - Three user LEDs - Two push-buttons: USER and RESET -.. image:: img/nucleo_f429zi.jpg - :align: center - :alt: Nucleo F429ZI - More information about the board can be found at the `Nucleo F429ZI website`_. Hardware diff --git a/boards/st/nucleo_f446re/doc/index.rst b/boards/st/nucleo_f446re/doc/index.rst index e111880ef3231..0688c3c6f02fb 100644 --- a/boards/st/nucleo_f446re/doc/index.rst +++ b/boards/st/nucleo_f446re/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f446re_board: - -ST Nucleo F446RE -################ +.. zephyr:board:: nucleo_f446re Overview ******** @@ -25,10 +22,6 @@ some highlights of the Nucleo F446RE board: - Three LEDs: USB communication (LD1), user LED (LD2), power LED (LD3) - Two push-buttons: USER and RESET -.. image:: img/nucleo_f446re.jpg - :align: center - :alt: Nucleo F446RE - More information about the board can be found at the `Nucleo F446RE website`_. Hardware diff --git a/boards/st/nucleo_f446ze/doc/index.rst b/boards/st/nucleo_f446ze/doc/index.rst index 0029f016ccf71..852ce5bd99b62 100644 --- a/boards/st/nucleo_f446ze/doc/index.rst +++ b/boards/st/nucleo_f446ze/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f446ze_board: - -ST Nucleo F446ZE -################ +.. zephyr:board:: nucleo_f446ze Overview @@ -30,10 +27,6 @@ some highlights of the Nucleo F446ZE board: - Three LEDs: USB communication (LD1), user LED (LD2), power LED (LD3) - Two push-buttons: USER and RESET -.. image:: img/nucleo_f446ze.jpg - :align: center - :alt: Nucleo F446ZE - More information about the board can be found at the `Nucleo F446ZE website`_. Hardware diff --git a/boards/st/nucleo_f722ze/doc/index.rst b/boards/st/nucleo_f722ze/doc/index.rst index fde339622a827..b381f20de4ce5 100644 --- a/boards/st/nucleo_f722ze/doc/index.rst +++ b/boards/st/nucleo_f722ze/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f722ze_board: - -ST Nucleo F722ZE -################ +.. zephyr:board:: nucleo_f722ze Overview ******** @@ -23,11 +20,6 @@ Key Features: - On-board ST-LINK debugger/programmer - Flexible power supply options, including ST-LINK VBUS and external sources. -.. image:: img/nucleo_f722ze.jpg - :width: 800px - :align: center - :alt: Nucleo F722ZE - Hardware ******** diff --git a/boards/st/nucleo_f746zg/doc/index.rst b/boards/st/nucleo_f746zg/doc/index.rst index 59566cf34c7f0..05b436d99e9fd 100644 --- a/boards/st/nucleo_f746zg/doc/index.rst +++ b/boards/st/nucleo_f746zg/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f746zg_board: - -ST Nucleo F746ZG -################ +.. zephyr:board:: nucleo_f746zg Overview ******** @@ -44,10 +41,6 @@ Key Features STM32Cube MCU package. - Arm* Mbed Enabled* compliant (only for some Nucleo part numbers) -.. image:: img/nucleo_f746zg.jpg - :align: center - :alt: Nucleo F746ZG - More information about the board can be found at the `Nucleo F746ZG website`_. Hardware diff --git a/boards/st/nucleo_f756zg/doc/index.rst b/boards/st/nucleo_f756zg/doc/index.rst index 6d512dcca3759..3b90c688ff8c3 100644 --- a/boards/st/nucleo_f756zg/doc/index.rst +++ b/boards/st/nucleo_f756zg/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f756zg_board: - -ST Nucleo F756ZG -################ +.. zephyr:board:: nucleo_f756zg Overview ******** @@ -44,10 +41,6 @@ Key Features - STM32Cube MCU package. - Arm* Mbed Enabled* compliant (only for some Nucleo part numbers) -.. image:: img/nucleo_f756zg.jpg - :align: center - :alt: Nucleo F756ZG - More information about the board can be found at the `Nucleo F756ZG website`_. Hardware diff --git a/boards/st/nucleo_f767zi/doc/index.rst b/boards/st/nucleo_f767zi/doc/index.rst index e0b5005015194..d68ae61592f4a 100644 --- a/boards/st/nucleo_f767zi/doc/index.rst +++ b/boards/st/nucleo_f767zi/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_f767zi_board: - -ST Nucleo F767ZI -################ +.. zephyr:board:: nucleo_f767zi Overview ******** @@ -44,10 +41,6 @@ Key Features STM32Cube MCU package. - Arm* Mbed Enabled* compliant (only for some Nucleo part numbers) -.. image:: img/nucleo_f767zi.jpg - :align: center - :alt: Nucleo F767ZI - More information about the board can be found at the `Nucleo F767ZI website`_. Hardware diff --git a/boards/st/nucleo_g031k8/doc/index.rst b/boards/st/nucleo_g031k8/doc/index.rst index c3776071ee248..bf985149d833a 100644 --- a/boards/st/nucleo_g031k8/doc/index.rst +++ b/boards/st/nucleo_g031k8/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_g031k8_board: - -ST Nucleo G031K8 -################ +.. zephyr:board:: nucleo_g031k8 Overview ******** @@ -21,10 +18,6 @@ The STM32 Nucleo-32 board comes with the STM32 comprehensive free software libraries and examples available with the STM32Cube MCU Package. -.. image:: img/nucleo_g031k8.jpg - :align: center - :alt: Nucleo G031K8 - More information about the board can be found at the `Nucleo G031K8 website`_. Hardware diff --git a/boards/st/nucleo_g070rb/doc/index.rst b/boards/st/nucleo_g070rb/doc/index.rst index 87b8cef25af38..f15d559403ca9 100644 --- a/boards/st/nucleo_g070rb/doc/index.rst +++ b/boards/st/nucleo_g070rb/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_g070rb_board: - -ST Nucleo G070RB -################ +.. zephyr:board:: nucleo_g070rb Overview ******** @@ -24,10 +21,6 @@ some highlights of the Nucleo G070RB board: - Three LEDs: USB communication (LD1), user LED (LD4), power LED (LD3) - Two push-buttons: USER and RESET -.. image:: img/nucleo_g070rb.jpg - :align: center - :alt: Nucleo G070RB - More information about the board can be found at the `Nucleo G070RB website`_. Hardware diff --git a/boards/st/nucleo_g071rb/doc/index.rst b/boards/st/nucleo_g071rb/doc/index.rst index 2202157b6cd69..0ab38d78118ec 100644 --- a/boards/st/nucleo_g071rb/doc/index.rst +++ b/boards/st/nucleo_g071rb/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_g071rb_board: - -ST Nucleo G071RB -################ +.. zephyr:board:: nucleo_g071rb Overview ******** @@ -24,10 +21,6 @@ some highlights of the Nucleo G071RB board: - Three LEDs: USB communication (LD1), user LED (LD4), power LED (LD3) - Two push-buttons: USER and RESET -.. image:: img/nucleo_g071rb.jpg - :align: center - :alt: Nucleo G071RB - More information about the board can be found at the `Nucleo G071RB website`_. Hardware diff --git a/boards/st/nucleo_g0b1re/doc/index.rst b/boards/st/nucleo_g0b1re/doc/index.rst index 3a32623a82ea1..aa68effb93ced 100644 --- a/boards/st/nucleo_g0b1re/doc/index.rst +++ b/boards/st/nucleo_g0b1re/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_g0b1re_board: - -ST Nucleo G0B1RE -################ +.. zephyr:board:: nucleo_g0b1re Overview ******** @@ -28,10 +25,6 @@ some highlights of the Nucleo G0B1RE board: - Two push-buttons: USER and RESET - 32.768 kHz crystal oscillator -.. image:: img/nucleo_g0b1re.jpg - :align: center - :alt: Nucleo G0B1RE - More information about the board can be found at the `Nucleo G0B1RE website`_. Hardware diff --git a/boards/st/nucleo_g431kb/doc/index.rst b/boards/st/nucleo_g431kb/doc/index.rst index 27311760458b7..d9400a7b38bcd 100644 --- a/boards/st/nucleo_g431kb/doc/index.rst +++ b/boards/st/nucleo_g431kb/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_g431kb_board: - -ST Nucleo G431KB -################ +.. zephyr:board:: nucleo_g431kb Overview ******** @@ -21,10 +18,6 @@ Here are some highlights of the Nucleo G431KB board: - Three LEDs: USB communication (LD1), power LED (LD3), user LED (LD2) - One push-button for RESET -.. image:: img/nucleo_g431kb.webp - :align: center - :alt: Nucleo G431kB - More information about the board can be found at the `Nucleo G431KB website`_. - Development support: serial wire debug (SWD), JTAG, Embedded Trace Macrocell. diff --git a/boards/st/nucleo_g431rb/doc/index.rst b/boards/st/nucleo_g431rb/doc/index.rst index 62805c011cde8..cebd20cc4913a 100644 --- a/boards/st/nucleo_g431rb/doc/index.rst +++ b/boards/st/nucleo_g431rb/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_g431rb_board: - -ST Nucleo G431RB -################ +.. zephyr:board:: nucleo_g431rb Overview ******** @@ -21,10 +18,6 @@ some highlights of the Nucleo G431RB board: - Three LEDs: USB communication (LD1), power LED (LD3), user LED (LD2) - Two push-buttons: RESET and USER -.. image:: img/nucleo_g431rb.jpg - :align: center - :alt: Nucleo G431RB - More information about the board can be found at the `Nucleo G431RB website`_. Hardware diff --git a/boards/st/nucleo_g474re/doc/index.rst b/boards/st/nucleo_g474re/doc/index.rst index 8ef04ed8fa19e..2b61e4b2296e8 100644 --- a/boards/st/nucleo_g474re/doc/index.rst +++ b/boards/st/nucleo_g474re/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_g474re_board: - -ST Nucleo G474RE -################ +.. zephyr:board:: nucleo_g474re Overview ******** @@ -21,10 +18,6 @@ some highlights of the Nucleo G474RE board: - Three LEDs: USB communication (LD1), power LED (LD3), user LED (LD2) - Two push-buttons: RESET and USER -.. image:: img/nucleo_g474re.jpg - :align: center - :alt: Nucleo G474RE - More information about the board can be found at the `Nucleo G474RE website`_. Hardware diff --git a/boards/st/nucleo_h503rb/doc/index.rst b/boards/st/nucleo_h503rb/doc/index.rst index ed7133cb5b177..2be64f7e95a6b 100644 --- a/boards/st/nucleo_h503rb/doc/index.rst +++ b/boards/st/nucleo_h503rb/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_h503rb_board: - -ST Nucleo H503RB -################ +.. zephyr:board:: nucleo_h503rb Overview ******** diff --git a/boards/st/nucleo_h533re/doc/index.rst b/boards/st/nucleo_h533re/doc/index.rst index 428f79b83c266..89876c48c018f 100644 --- a/boards/st/nucleo_h533re/doc/index.rst +++ b/boards/st/nucleo_h533re/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_h533re_board: - -ST Nucleo H533RE -################ +.. zephyr:board:: nucleo_h533re Overview ******** @@ -41,10 +38,6 @@ Here are some highlights of the Nucleo H533RE board: More information about the board can be found at the `NUCLEO_H533RE website`_. -.. image:: img/nucleo_h533re.jpg - :align: center - :alt: NUCLEO H533RE - Hardware ******** diff --git a/boards/st/nucleo_h563zi/doc/index.rst b/boards/st/nucleo_h563zi/doc/index.rst index 8bbb099147e07..092a1aec678e5 100644 --- a/boards/st/nucleo_h563zi/doc/index.rst +++ b/boards/st/nucleo_h563zi/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_h563zi_board: - -ST Nucleo H563ZI -################ +.. zephyr:board:: nucleo_h563zi Overview ******** @@ -41,10 +38,6 @@ Here are some highlights of the Nucleo H563ZI board: More information about the board can be found at the `NUCLEO_H563ZI website`_. -.. image:: img/nucleo_h563zi.jpg - :align: center - :alt: NUCLEO H563ZI - Hardware ******** diff --git a/boards/st/nucleo_h723zg/doc/index.rst b/boards/st/nucleo_h723zg/doc/index.rst index 06675941e7c6b..6cd0dc6c56806 100644 --- a/boards/st/nucleo_h723zg/doc/index.rst +++ b/boards/st/nucleo_h723zg/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_h723zg_board: - -ST Nucleo H723ZG -################ +.. zephyr:board:: nucleo_h723zg Overview ******** @@ -42,10 +39,6 @@ Key Features - capability: mass storage, virtual COM port and debug port - USB OTG full speed or device only -.. image:: img/nucleo_h723zg.jpg - :align: center - :alt: Nucleo H723ZG - More information about the board can be found at the `Nucleo H723ZG website`_. Hardware diff --git a/boards/st/nucleo_h743zi/doc/index.rst b/boards/st/nucleo_h743zi/doc/index.rst index ac6674873b7b3..cb6e58b3b2989 100644 --- a/boards/st/nucleo_h743zi/doc/index.rst +++ b/boards/st/nucleo_h743zi/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_h743zi_board: - -ST Nucleo H743ZI -################ +.. zephyr:board:: nucleo_h743zi Overview ******** @@ -44,10 +41,6 @@ Key Features STM32Cube MCU package. - Arm* Mbed Enabled* compliant (only for some Nucleo part numbers) -.. image:: img/nucleo_h743zi.jpg - :align: center - :alt: Nucleo H743ZI - More information about the board can be found at the `Nucleo H743ZI website`_. Hardware diff --git a/boards/st/nucleo_h745zi_q/doc/index.rst b/boards/st/nucleo_h745zi_q/doc/index.rst index 194e4b92f47ba..ba3f5627a6f76 100644 --- a/boards/st/nucleo_h745zi_q/doc/index.rst +++ b/boards/st/nucleo_h745zi_q/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_h745zi_q_board: - -ST Nucleo H745ZI-Q -################### +.. zephyr:board:: nucleo_h745zi_q Overview ******** @@ -45,10 +42,6 @@ Key Features STM32Cube MCU package. - Arm* Mbed Enabled* compliant (only for some Nucleo part numbers) -.. image:: img/nucleo_h745zi_q.jpg - :align: center - :alt: Nucleo H745ZI-Q - More information about the board can be found at the `Nucleo H745ZI-Q website`_. Hardware diff --git a/boards/st/nucleo_h753zi/doc/index.rst b/boards/st/nucleo_h753zi/doc/index.rst index 37282dbbd8dae..a6b8dcf0bf676 100644 --- a/boards/st/nucleo_h753zi/doc/index.rst +++ b/boards/st/nucleo_h753zi/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_h753zi_board: - -ST Nucleo H753ZI -################ +.. zephyr:board:: nucleo_h753zi Overview ******** @@ -44,10 +41,6 @@ Key Features STM32Cube MCU package. - Arm* Mbed Enabled* compliant (only for some Nucleo part numbers) -.. image:: img/nucleo_h753zi.jpg - :align: center - :alt: Nucleo H753ZI - More information about the board can be found at the `Nucleo H753ZI website`_. Hardware diff --git a/boards/st/nucleo_h755zi_q/doc/index.rst b/boards/st/nucleo_h755zi_q/doc/index.rst index 3d509cc90ba35..cc29afb00093b 100644 --- a/boards/st/nucleo_h755zi_q/doc/index.rst +++ b/boards/st/nucleo_h755zi_q/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_h755zi_q_board: - -ST Nucleo H755ZI-Q -################### +.. zephyr:board:: nucleo_h755zi_q Overview ******** @@ -37,10 +34,6 @@ Key Features - capability: mass storage, virtual COM port and debug port - USB OTG full speed or device only -.. image:: img/nucleo_h755zi_q.webp - :align: center - :alt: Nucleo H755ZI-Q - More information about the board can be found at the `Nucleo H755ZI-Q website`_. Hardware diff --git a/boards/st/nucleo_h7a3zi_q/doc/index.rst b/boards/st/nucleo_h7a3zi_q/doc/index.rst index 0de0ef109eb82..e823191e62591 100644 --- a/boards/st/nucleo_h7a3zi_q/doc/index.rst +++ b/boards/st/nucleo_h7a3zi_q/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_h7a3zi_q_board: - -ST Nucleo H7A3ZI-Q -################## +.. zephyr:board:: nucleo_h7a3zi_q Overview ******** @@ -42,10 +39,6 @@ Key Features STM32Cube MCU package. - Arm* Mbed Enabled* compliant (only for some Nucleo part numbers) -.. image:: img/nucleo_h7a3zi_q.jpg - :align: center - :alt: Nucleo H7A3ZI-Q - More information about the board can be found at the `Nucleo H7A3ZI-Q website`_. Hardware diff --git a/boards/st/nucleo_l011k4/doc/index.rst b/boards/st/nucleo_l011k4/doc/index.rst index b1d9396f7ed76..cb8ad43e2ab56 100644 --- a/boards/st/nucleo_l011k4/doc/index.rst +++ b/boards/st/nucleo_l011k4/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_l011k4_board: - -ST Nucleo L011K4 -################ +.. zephyr:board:: nucleo_l011k4 Overview ******** @@ -20,10 +17,6 @@ The STM32 Nucleo board integrates the ST-LINK/V2-1 debugger and programmer. The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together with various packaged software examples. -.. image:: img/nucleo_l011k4.jpg - :align: center - :alt: Nucleo L011K4 - More information about the board can be found at the `Nucleo L011K4 website`_. Hardware diff --git a/boards/st/nucleo_l031k6/doc/index.rst b/boards/st/nucleo_l031k6/doc/index.rst index 0845a046fc04c..b5a7727a23864 100644 --- a/boards/st/nucleo_l031k6/doc/index.rst +++ b/boards/st/nucleo_l031k6/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_l031k6_board: - -ST Nucleo L031K6 -################ +.. zephyr:board:: nucleo_l031k6 Overview ******** @@ -20,10 +17,6 @@ The STM32 Nucleo board integrates the ST-LINK/V2-1 debugger and programmer. The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together with various packaged software examples. -.. image:: img/nucleo_l031k6.jpg - :align: center - :alt: Nucleo L031K6 - More information about the board can be found at the `Nucleo L031K6 website`_. Hardware diff --git a/boards/st/nucleo_l053r8/doc/index.rst b/boards/st/nucleo_l053r8/doc/index.rst index 4fd63f57f4384..755520a2bfbf9 100644 --- a/boards/st/nucleo_l053r8/doc/index.rst +++ b/boards/st/nucleo_l053r8/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_l053r8_board: - -ST Nucleo L053R8 -################ +.. zephyr:board:: nucleo_l053r8 Overview ******** @@ -20,10 +17,6 @@ The STM32 Nucleo board integrates the ST-LINK/V2-1 debugger and programmer. The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together with various packaged software examples. -.. image:: img/nucleo_l053r8.jpg - :align: center - :alt: Nucleo L053R8 - More information about the board can be found at the `Nucleo L053R8 website`_. Hardware diff --git a/boards/st/nucleo_l073rz/doc/index.rst b/boards/st/nucleo_l073rz/doc/index.rst index 6ea4076a98a26..401290d90dec0 100644 --- a/boards/st/nucleo_l073rz/doc/index.rst +++ b/boards/st/nucleo_l073rz/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_l073rz_board: - -ST Nucleo L073RZ -################ +.. zephyr:board:: nucleo_l073rz Overview ******** @@ -20,10 +17,6 @@ The STM32 Nucleo board integrates the ST-LINK/V2-1 debugger and programmer. The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together with various packaged software examples. -.. image:: img/nucleo_l073rz.jpg - :align: center - :alt: Nucleo L073RZ - More information about the board can be found at the `Nucleo L073RZ website`_. Hardware diff --git a/boards/st/nucleo_l152re/doc/index.rst b/boards/st/nucleo_l152re/doc/index.rst index c4d18190a23ae..1973ffa8e5a39 100644 --- a/boards/st/nucleo_l152re/doc/index.rst +++ b/boards/st/nucleo_l152re/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_l152re_board: - -ST Nucleo L152RE -################ +.. zephyr:board:: nucleo_l152re Overview ******** @@ -20,10 +17,6 @@ The STM32 Nucleo board integrates the ST-LINK/V2-1 debugger and programmer. The STM32 Nucleo board comes with the STM32 comprehensive software HAL library together with various packaged software examples. -.. image:: img/nucleo_l152re.jpg - :align: center - :alt: NUCLEO-L152RE - More information about the board can be found at the `Nucleo L152RE website`_. Hardware diff --git a/boards/st/nucleo_l412rb_p/doc/index.rst b/boards/st/nucleo_l412rb_p/doc/index.rst index 11a1239078235..75caa4e9f1b97 100644 --- a/boards/st/nucleo_l412rb_p/doc/index.rst +++ b/boards/st/nucleo_l412rb_p/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_l412rb_p_board: - -ST Nucleo L412RB-P -################## +.. zephyr:board:: nucleo_l412rb_p Overview ******** @@ -37,10 +34,6 @@ some highlights of the Nucleo L412RB board: - Arm® Mbed Enabled |trade| compliant -.. image:: img/nucleo_l412rb_p.jpg - :align: center - :alt: Nucleo L412RB - More information about the board can be found at the `Nucleo L412RB-P website`_. Hardware diff --git a/boards/st/nucleo_l432kc/doc/index.rst b/boards/st/nucleo_l432kc/doc/index.rst index f312380a07c32..ad17c525de5f2 100644 --- a/boards/st/nucleo_l432kc/doc/index.rst +++ b/boards/st/nucleo_l432kc/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_l432kc_board: - -ST Nucleo L432KC -################ +.. zephyr:board:: nucleo_l432kc Overview ******** @@ -21,10 +18,6 @@ some highlights of the Nucleo L432KC board: - Three LEDs: USB communication (LD1), power LED (LD2), user LED (LD3) - One push-button: RESET -.. image:: img/nucleo_l432kc.jpg - :align: center - :alt: Nucleo L432KC - More information about the board can be found at the `Nucleo L432KC website`_. Hardware diff --git a/boards/st/nucleo_l433rc_p/doc/index.rst b/boards/st/nucleo_l433rc_p/doc/index.rst index 75b3a8fe20ebc..5b61f6e77183e 100644 --- a/boards/st/nucleo_l433rc_p/doc/index.rst +++ b/boards/st/nucleo_l433rc_p/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_l433rc_board: - -ST Nucleo L433RC -################ +.. zephyr:board:: nucleo_l433rc_p Overview ******** @@ -21,10 +18,6 @@ some highlights of the Nucleo L433RC board: - Three LEDs: USB communication (LD1), power LED (LD3), user LED (LD4) - One push-button: RESET -.. image:: img/nucleo_l433rc_p.jpg - :align: center - :alt: Nucleo L433RC - More information about the board can be found at the `Nucleo L433RC-P website`_. Hardware diff --git a/boards/st/nucleo_l452re/doc/index.rst b/boards/st/nucleo_l452re/doc/index.rst index 9587b9e6c02ee..2995387e8ae4e 100644 --- a/boards/st/nucleo_l452re/doc/index.rst +++ b/boards/st/nucleo_l452re/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_l452re_board: - -ST Nucleo L452RE -################ +.. zephyr:board:: nucleo_l452re Overview ******** @@ -25,10 +22,6 @@ Here some highlights of these boards: - Three LEDs: USB communication (LD1), user LED (LD2), power LED (LD3) - One push-button: RESET -.. image:: img/nucleo_l452re_p.jpg - :align: center - :alt: Nucleo L452RE-P - The main difference between the ST Nucleo L452RE and the L452RE-P (note the missing "-P" at the end) lays in the External Switched Mode Power Supply (SMPS) included in the P series. diff --git a/boards/st/nucleo_l476rg/doc/index.rst b/boards/st/nucleo_l476rg/doc/index.rst index ac566003430cf..7c0ddb76958d3 100644 --- a/boards/st/nucleo_l476rg/doc/index.rst +++ b/boards/st/nucleo_l476rg/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_l476rg_board: - -ST Nucleo L476RG -################ +.. zephyr:board:: nucleo_l476rg Overview ******** @@ -26,10 +23,6 @@ some highlights of the Nucleo L476RG board: - Three LEDs: USB communication (LD1), user LED (LD2), power LED (LD3) - Two push-buttons: USER and RESET -.. image:: img/nucleo_l476rg.jpg - :align: center - :alt: Nucleo L476RG - More information about the board can be found at the `Nucleo L476RG website`_. Hardware diff --git a/boards/st/nucleo_l496zg/doc/index.rst b/boards/st/nucleo_l496zg/doc/index.rst index 4abdc105c6a6d..838bec9905e66 100644 --- a/boards/st/nucleo_l496zg/doc/index.rst +++ b/boards/st/nucleo_l496zg/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_l496zg_board: - -ST Nucleo L496ZG -################ +.. zephyr:board:: nucleo_l496zg Overview ******** @@ -28,10 +25,6 @@ some highlights of the Nucleo L476ZG board: power fault(LD5), power LED (LD6), USB FS OTG (LD7, LD8) - 2 push buttons: USER and RESET -.. image:: img/nucleo_l496zg.jpg - :align: center - :alt: Nucleo L496ZG - More information about the board can be found at the `Nucleo L496ZG website`_. Hardware diff --git a/boards/st/nucleo_l4a6zg/doc/index.rst b/boards/st/nucleo_l4a6zg/doc/index.rst index 267d5f619b803..aced62768600a 100644 --- a/boards/st/nucleo_l4a6zg/doc/index.rst +++ b/boards/st/nucleo_l4a6zg/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_l4a6zg_board: - -ST Nucleo L4A6ZG -################ +.. zephyr:board:: nucleo_l4a6zg Overview ******** @@ -28,10 +25,6 @@ some highlights of the Nucleo L4A6ZG board: power fault(LD5), power LED (LD6), USB FS OTG (LD7, LD8) - 2 push buttons: USER and RESET -.. image:: ../../nucleo_l496zg/doc/img/nucleo_l496zg.jpg - :align: center - :alt: Nucleo L4A6ZG - More information about the board can be found at the `Nucleo L4A6ZG website`_. Hardware diff --git a/boards/st/nucleo_l4r5zi/doc/index.rst b/boards/st/nucleo_l4r5zi/doc/index.rst index 1a1302aa3e2d2..7ea8f85980620 100644 --- a/boards/st/nucleo_l4r5zi/doc/index.rst +++ b/boards/st/nucleo_l4r5zi/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_l4r5zi_board: - -ST Nucleo L4R5ZI -################ +.. zephyr:board:: nucleo_l4r5zi Overview ******** @@ -26,10 +23,6 @@ some highlights of the Nucleo L4R5ZI board: - Three User LEDs: LD1 (Green), LD2 (Blue), LD3 (Red) - Two push-buttons: USER and RESET -.. image:: img/nucleo_l4r5zi.jpg - :align: center - :alt: Nucleo L4R5ZI - More information about the board can be found at the `Nucleo L4R5ZI website`_. Hardware diff --git a/boards/st/nucleo_l552ze_q/doc/nucleol552ze_q.rst b/boards/st/nucleo_l552ze_q/doc/nucleol552ze_q.rst index 0d5aa6e0fd873..9dab9c36a9ab2 100644 --- a/boards/st/nucleo_l552ze_q/doc/nucleol552ze_q.rst +++ b/boards/st/nucleo_l552ze_q/doc/nucleol552ze_q.rst @@ -1,7 +1,4 @@ -.. _nucleo_l552ze_q_board: - -ST Nucleo L552ZE Q -################## +.. zephyr:board:: nucleo_l552ze_q Overview ******** @@ -30,10 +27,6 @@ board: - External or internal SMPS to generate Vcore logic supply - USB OTG full speed or device only -.. image:: img/nucleo_l552ze_q.jpg - :align: center - :alt: Nucleo L552ZE Q - More information about the board can be found at the `Nucleo L552ZE Q website`_. Hardware diff --git a/boards/st/nucleo_u031r8/doc/index.rst b/boards/st/nucleo_u031r8/doc/index.rst index 57c278f52bbab..6126586000f73 100644 --- a/boards/st/nucleo_u031r8/doc/index.rst +++ b/boards/st/nucleo_u031r8/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_u031r8_board: - -ST Nucleo U031R8 -################ +.. zephyr:board:: nucleo_u031r8 Overview ******** @@ -29,10 +26,6 @@ board: - Two push-buttons: USER and RESET - USB Type-C |reg| connector for the ST-LINK -.. image:: img/nucleo_u031r8.jpg - :align: center - :alt: Nucleo U031R8 - More information about the board can be found at the `NUCLEO_U031R8 website`_. Hardware diff --git a/boards/st/nucleo_u083rc/doc/index.rst b/boards/st/nucleo_u083rc/doc/index.rst index 36329ac8dd30d..09db38710c615 100644 --- a/boards/st/nucleo_u083rc/doc/index.rst +++ b/boards/st/nucleo_u083rc/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_u083rc_board: - -ST Nucleo U083RC -################ +.. zephyr:board:: nucleo_u083rc Overview ******** @@ -29,10 +26,6 @@ board: - Two push-buttons: USER and RESET - USB Type-C |reg| connector for the ST-LINK -.. image:: img/nucleo_u083rc.jpg - :align: center - :alt: Nucleo U083RC - More information about the board can be found at the `NUCLEO_U083RC website`_. Hardware diff --git a/boards/st/nucleo_u575zi_q/doc/index.rst b/boards/st/nucleo_u575zi_q/doc/index.rst index 080bd074c4f02..29dc145ce29c7 100644 --- a/boards/st/nucleo_u575zi_q/doc/index.rst +++ b/boards/st/nucleo_u575zi_q/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_u575zi_q_board: - -ST Nucleo U575ZI Q -################## +.. zephyr:board:: nucleo_u575zi_q Overview ******** diff --git a/boards/st/nucleo_u5a5zj_q/doc/index.rst b/boards/st/nucleo_u5a5zj_q/doc/index.rst index d3f90a178d40b..60701060fcc1f 100644 --- a/boards/st/nucleo_u5a5zj_q/doc/index.rst +++ b/boards/st/nucleo_u5a5zj_q/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_u5a5zj_q_board: - -ST Nucleo U5A5ZJ Q -################## +.. zephyr:board:: nucleo_u5a5zj_q Overview ******** diff --git a/boards/st/nucleo_wb05kz/doc/index.rst b/boards/st/nucleo_wb05kz/doc/index.rst index 7d242549ffe4e..e1435584d4038 100644 --- a/boards/st/nucleo_wb05kz/doc/index.rst +++ b/boards/st/nucleo_wb05kz/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_wb05kz_board: - -ST Nucleo WB05KZ -################ +.. zephyr:board:: nucleo_wb05kz Overview ******** @@ -11,10 +8,6 @@ board featuring an ARM Cortex |reg|-M0+ based STM32WB05KZV MCU, embedding a powerful and ultra-low-power radio compliant with the Bluetooth® Low Energy SIG specification v5.4. -.. image:: img/nucleo_wb05kz.webp - :align: center - :alt: Nucleo WB05KZ - More information about the board can be found on the `Nucleo WB05KZ webpage`_. Hardware diff --git a/boards/st/nucleo_wb09ke/doc/index.rst b/boards/st/nucleo_wb09ke/doc/index.rst index 9e4ce9eb7286b..2e124268b003c 100644 --- a/boards/st/nucleo_wb09ke/doc/index.rst +++ b/boards/st/nucleo_wb09ke/doc/index.rst @@ -1,7 +1,4 @@ -.. _nucleo_wb09ke_board: - -ST Nucleo WB09KE -################ +.. zephyr:board:: nucleo_wb09ke Overview ******** @@ -11,10 +8,6 @@ board featuring an ARM Cortex |reg|-M0+ based STM32WB09KEV MCU, embedding a powerful and ultra-low-power radio compliant with the Bluetooth® Low Energy SIG specification v5.4. -.. image:: img/nucleo_wb09ke.webp - :align: center - :alt: Nucleo WB09KE - More information about the board can be found on the `Nucleo WB09KE webpage`_. Hardware diff --git a/boards/st/nucleo_wb55rg/doc/nucleo_wb55rg.rst b/boards/st/nucleo_wb55rg/doc/nucleo_wb55rg.rst index fb1b76e76ca33..0aa7928ca2a90 100644 --- a/boards/st/nucleo_wb55rg/doc/nucleo_wb55rg.rst +++ b/boards/st/nucleo_wb55rg/doc/nucleo_wb55rg.rst @@ -1,7 +1,4 @@ -.. _nucleo_wb55rg_board: - -ST Nucleo WB55RG -################ +.. zephyr:board:: nucleo_wb55rg Overview ******** @@ -29,10 +26,6 @@ Low Energy (BLE) SIG specification v5.0 and with IEEE 802.15.4-2011. - On-board ST-LINK/V2-1 debugger/programmer with USB re- enumeration capability: mass storage, virtual COM port and debug port -.. image:: img/nucleowb55rg.jpg - :align: center - :alt: Nucleo WB55RG - More information about the board can be found at the `Nucleo WB55RG website`_. Hardware diff --git a/boards/st/nucleo_wba52cg/doc/nucleo_wba52cg.rst b/boards/st/nucleo_wba52cg/doc/nucleo_wba52cg.rst index 7c3257aa6faad..c27dc4a56a56d 100644 --- a/boards/st/nucleo_wba52cg/doc/nucleo_wba52cg.rst +++ b/boards/st/nucleo_wba52cg/doc/nucleo_wba52cg.rst @@ -1,7 +1,4 @@ -.. _nucleo_wba52cg_board: - -ST Nucleo WBA52CG -################# +.. zephyr:board:: nucleo_wba52cg Overview ******** @@ -37,10 +34,6 @@ platform with a wide choice of specialized shields. - On-board STLINK-V3MODS debugger/programmer with USB re-enumeration capability: mass storage, Virtual COM port, and debug port -.. image:: img/nucleowba52cg.jpg - :align: center - :alt: Nucleo WBA52CG - More information about the board can be found at the `Nucleo WBA52CG website`_. Hardware diff --git a/boards/st/nucleo_wba55cg/doc/nucleo_wba55cg.rst b/boards/st/nucleo_wba55cg/doc/nucleo_wba55cg.rst index c1ec07518545b..affcf8c4c499f 100644 --- a/boards/st/nucleo_wba55cg/doc/nucleo_wba55cg.rst +++ b/boards/st/nucleo_wba55cg/doc/nucleo_wba55cg.rst @@ -1,7 +1,4 @@ -.. _nucleo_wba55cg_board: - -ST Nucleo WBA55CG -################# +.. zephyr:board:: nucleo_wba55cg Overview ******** @@ -37,10 +34,6 @@ platform with a wide choice of specialized shields. - On-board STLINK-V3MODS debugger/programmer with USB re-enumeration capability: mass storage, Virtual COM port, and debug port -.. image:: img/nucleowba55cg.jpg - :align: center - :alt: Nucleo WBA55CG - Hardware ******** diff --git a/boards/st/nucleo_wl55jc/doc/nucleo_wl55jc.rst b/boards/st/nucleo_wl55jc/doc/nucleo_wl55jc.rst index 98ce41d587723..72f7147c5b6eb 100644 --- a/boards/st/nucleo_wl55jc/doc/nucleo_wl55jc.rst +++ b/boards/st/nucleo_wl55jc/doc/nucleo_wl55jc.rst @@ -1,7 +1,4 @@ -.. _nucleo_wl55jc_board: - -ST Nucleo WL55JC -################ +.. zephyr:board:: nucleo_wl55jc Overview ******** @@ -43,10 +40,6 @@ power consumption, and features. - Fully open hardware platform -.. image:: img/nucleo_wl55jc.jpg - :align: center - :alt: Nucleo WL55JC - More information about the board can be found at the `Nucleo WL55JC website`_. Hardware diff --git a/boards/st/sensortile_box/doc/index.rst b/boards/st/sensortile_box/doc/index.rst index d582d3f2ee1da..861b2e559b9fb 100644 --- a/boards/st/sensortile_box/doc/index.rst +++ b/boards/st/sensortile_box/doc/index.rst @@ -1,7 +1,4 @@ -.. _sensortile_box: - -ST SensorTile.box -################# +.. zephyr:board:: sensortile_box Overview ******** @@ -13,10 +10,6 @@ The SensorTile.box board fits into a small plastic box with a long-life recharge battery, and communicates with a standard smartphone through its Bluetooth interface, providing data coming from the sensors. -.. image:: img/sensortile_box.jpg - :align: center - :alt: SensorTile.box - More information about the board can be found at the `SensorTile.box website`_. Hardware diff --git a/boards/st/sensortile_box_pro/doc/index.rst b/boards/st/sensortile_box_pro/doc/index.rst index 68e30a80848e6..1487518e68689 100644 --- a/boards/st/sensortile_box_pro/doc/index.rst +++ b/boards/st/sensortile_box_pro/doc/index.rst @@ -1,7 +1,4 @@ -.. _sensortile_box_pro_board: - -ST SensorTile.box PRO -##################### +.. zephyr:board:: sensortile_box_pro Overview ******** @@ -14,10 +11,6 @@ The SensorTile.box PRO board fits into a small plastic box with a long-life rech battery, and communicates with a standard smartphone through its Bluetooth interface, providing data coming from the sensors. -.. image:: img/sensortile_box_pro.jpg - :align: center - :alt: SensorTile.box PRO - More information about the board can be found at the `SensorTile.box PRO website`_. Supported Features diff --git a/boards/st/st25dv_mb1283_disco/docs/img/st25dv_mb1283_disco.jpg b/boards/st/st25dv_mb1283_disco/doc/img/st25dv_mb1283_disco.jpg similarity index 100% rename from boards/st/st25dv_mb1283_disco/docs/img/st25dv_mb1283_disco.jpg rename to boards/st/st25dv_mb1283_disco/doc/img/st25dv_mb1283_disco.jpg diff --git a/boards/st/st25dv_mb1283_disco/docs/index.rst b/boards/st/st25dv_mb1283_disco/doc/index.rst similarity index 95% rename from boards/st/st25dv_mb1283_disco/docs/index.rst rename to boards/st/st25dv_mb1283_disco/doc/index.rst index 1fef60ebf63a9..b1fe8fa35da63 100644 --- a/boards/st/st25dv_mb1283_disco/docs/index.rst +++ b/boards/st/st25dv_mb1283_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _st25dv_mb1283_disco_board: - -ST ST25DV Discovery, MB1283 version -################################### +.. zephyr:board:: st25dv_mb1283_disco Overview ******** @@ -16,10 +13,6 @@ of the ST25DV series. It is based on the NFC ST25DV04K device embedded on a daughter card using a Class 5 antenna and a STM32 processor driving a mother board. -.. image:: img/st25dv_mb1283_disco.jpg - :align: center - :alt: ST25DV_MB1283_DISCO - .. note:: The ST25DV itself is not implemented yet. diff --git a/boards/st/steval_fcu001v1/doc/index.rst b/boards/st/steval_fcu001v1/doc/index.rst index f10c0300957e2..aea2ce5ac7901 100644 --- a/boards/st/steval_fcu001v1/doc/index.rst +++ b/boards/st/steval_fcu001v1/doc/index.rst @@ -1,17 +1,10 @@ -.. _steval_fcu001v1: - -ST STM32 Flight Controller Unit -############################### +.. zephyr:board:: steval_fcu001v1 Overview ******** The STEVAL-FCU001V1 is a Cortex M4 MCU-based flight controller unit for toy quad-copter drones. -.. figure:: img/steval_fcu001v1.jpg - :align: center - :alt: STM32 Flight Controller Unit - Hardware ******** diff --git a/boards/st/steval_stwinbx1/doc/index.rst b/boards/st/steval_stwinbx1/doc/index.rst index cd0e2469484ba..474127e8bcca1 100644 --- a/boards/st/steval_stwinbx1/doc/index.rst +++ b/boards/st/steval_stwinbx1/doc/index.rst @@ -1,7 +1,4 @@ -.. _steval_stwinbx1_board: - -STEVAL STWINBX1 Development kit -############################### +.. zephyr:board:: steval_stwinbx1 Overview ******** @@ -13,10 +10,6 @@ IoT contexts such as condition monitoring and predictive maintenance. The STEVAL-STWINBX1 kit consists of an STWIN.box core system, a 480mAh LiPo battery, an adapter for the ST-LINK debugger, a plastic case, an adapter board for DIL 24 sensors and a flexible cable. -.. image:: img/steval_stwinbx1.jpg - :align: center - :alt: STEVAL-STWINBX1 Development kit - More information about the board can be found at the `STEVAL-STWINBX1 Development kit website`_. diff --git a/boards/st/stm3210c_eval/doc/index.rst b/boards/st/stm3210c_eval/doc/index.rst index 117e378b659f7..43a5bdd4b68b0 100644 --- a/boards/st/stm3210c_eval/doc/index.rst +++ b/boards/st/stm3210c_eval/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm3210c_eval_board: - -ST STM3210C Evaluation -###################### +.. zephyr:board:: stm3210c_eval Overview ******** @@ -15,10 +12,6 @@ audio DAC, MEMS, EEPROM and more) and develop your own applications. Extension headers make it easy to connect a daughterboard or wrapping board for your specific application. -.. image:: img/stm3210c_eval.jpg - :align: center - :alt: STM3210C-EVAL - More information about the board can be found at the `STM3210C-EVAL website`_. Hardware diff --git a/boards/st/stm32373c_eval/doc/index.rst b/boards/st/stm32373c_eval/doc/index.rst index b6895a4bca221..10f722c650dcb 100644 --- a/boards/st/stm32373c_eval/doc/index.rst +++ b/boards/st/stm32373c_eval/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32373c_eval_board: - -ST STM32373C Evaluation -####################### +.. zephyr:board:: stm32373c_eval Overview ******** @@ -11,10 +8,6 @@ The full range of hardware features on the board can help the user evaluate all Extension headers make it possible to easily connect a daughter board or wrapping board for a specific application. -.. image:: img/stm32373c_eval.jpg - :align: center - :alt: STM32373C-EVAL - More information about the board can be found at the `STM32373C-EVAL website`_. Hardware diff --git a/boards/st/stm32c0116_dk/doc/index.rst b/boards/st/stm32c0116_dk/doc/index.rst index 52e3c24ef208b..b955518a77634 100644 --- a/boards/st/stm32c0116_dk/doc/index.rst +++ b/boards/st/stm32c0116_dk/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32c0116_dk_board: - -ST STM32C0116-DK Discovery Kit -############################## +.. zephyr:board:: stm32c0116_dk Overview ******** @@ -12,10 +9,6 @@ to DIL20 module designed with the STM32C011F6 microcontroller and allows the use and share applications. It includes an on-board ST-LINK/V2-1 to debug and program the embedded STM32 microcontroller. Important board features include: -.. image:: img/stm32c0116_dk.jpg - :align: center - :alt: STM32C0116-DK - More information about the board can be found at the `STM32C0116-DK website`_. Hardware diff --git a/boards/st/stm32f072_eval/doc/index.rst b/boards/st/stm32f072_eval/doc/index.rst index b1bb7b0b5acfc..43c1eb1e0bef9 100644 --- a/boards/st/stm32f072_eval/doc/index.rst +++ b/boards/st/stm32f072_eval/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32f072_eval_board: - -ST STM32F072 Evaluation -####################### +.. zephyr:board:: stm32f072_eval Overview ******** @@ -35,11 +32,6 @@ Here are some highlights of the STM32F072-EVAL board: - Smart Card slot - Motor control connector - -.. image:: img/stm32f072_eval.jpg - :align: center - :alt: STM32F072-EVAL - Hardware ******** diff --git a/boards/st/stm32f072b_disco/doc/index.rst b/boards/st/stm32f072b_disco/doc/index.rst index 6f97341d2b37a..9790d3f4d0e76 100644 --- a/boards/st/stm32f072b_disco/doc/index.rst +++ b/boards/st/stm32f072b_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32f072b_disco_board: - -ST STM32F072B Discovery -####################### +.. zephyr:board:: stm32f072b_disco Overview ******** @@ -29,10 +26,6 @@ started quickly. Here are some highlights of the STM32F072B-DISCO board: - One linear touch sensor or four touch keys - RF EEprom daughter board connector -.. image:: img/stm32f072b_disco.jpg - :align: center - :alt: STM32F072B-DISCO - More information about the board can be found at the `STM32F072B-DISCO website`_. diff --git a/boards/st/stm32f0_disco/doc/index.rst b/boards/st/stm32f0_disco/doc/index.rst index 64e4605566b0b..dccce953fac97 100644 --- a/boards/st/stm32f0_disco/doc/index.rst +++ b/boards/st/stm32f0_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32f0_disco_board: - -ST STM32F0 Discovery -#################### +.. zephyr:board:: stm32f0_disco Overview ******** @@ -11,10 +8,6 @@ integrates the ST-LINK/V2-1 debugger and programmer. It also comes with a comprehensive STM32 software HAL library and various packaged software examples. -.. image:: img/stm32f0_disco.jpg - :align: center - :alt: STM32F0DISCOVERY - More information about the board can be found at the `STM32F0DISCOVERY website`_. Hardware diff --git a/boards/st/stm32f3_disco/doc/index.rst b/boards/st/stm32f3_disco/doc/index.rst index e557eb013c7df..107f3a609646c 100644 --- a/boards/st/stm32f3_disco/doc/index.rst +++ b/boards/st/stm32f3_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32f3_disco_board: - -ST STM32F3 Discovery -#################### +.. zephyr:board:: stm32f3_disco Overview ******** @@ -35,10 +32,6 @@ started quickly. Here are some highlights of the STM32F3DISCOVERY board: .. HINT:: Recent PCB revisions (E and newer) are shipped with I3G4250D and LSM303AGR. -.. image:: img/stm32f3_disco.jpg - :align: center - :alt: STM32F3DISCOVERY - More information about the board can be found at the `STM32F3DISCOVERY website`_. diff --git a/boards/st/stm32f411e_disco/doc/index.rst b/boards/st/stm32f411e_disco/doc/index.rst index acac229c81065..3b97cf290129f 100644 --- a/boards/st/stm32f411e_disco/doc/index.rst +++ b/boards/st/stm32f411e_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32f411e_disco_board: - -ST STM32F411E Discovery -####################### +.. zephyr:board:: stm32f411e_disco Overview ******** @@ -29,10 +26,6 @@ Here are some highlights of the STM32F411E-DISCO board: - USB OTG with micro-AB connector - Extension header for LQFP100 I/Os for a quick connection to the prototyping board and an easy probing -.. image:: img/stm32f411e_disco.jpg - :align: center - :alt: STM32F411E-DISCO - More information about the board can be found at the `32F411EDISCOVERY website`_. Hardware diff --git a/boards/st/stm32f412g_disco/doc/index.rst b/boards/st/stm32f412g_disco/doc/index.rst index ae84de7cea784..7dab509efecc1 100644 --- a/boards/st/stm32f412g_disco/doc/index.rst +++ b/boards/st/stm32f412g_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32f412g_disco_board: - -ST STM32F412G Discovery -####################### +.. zephyr:board:: stm32f412g_disco Overview ******** @@ -39,10 +36,6 @@ some highlights of the STM32F412G-DISCO board: - Extension connector for direct access to various features of STM32F412ZGT6 MCU - Comprehensive free software including a variety of examples, part of STM32Cube package -.. image:: img/stm32f412g_disco.jpg - :align: center - :alt: STM32F412G-DISCO - More information about the board can be found at the `32F412GDISCOVERY website`_. Hardware diff --git a/boards/st/stm32f429i_disc1/doc/index.rst b/boards/st/stm32f429i_disc1/doc/index.rst index 28a79e9ac2acb..c547996ab27aa 100644 --- a/boards/st/stm32f429i_disc1/doc/index.rst +++ b/boards/st/stm32f429i_disc1/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32f429i_disc1_board: - -ST STM32F429I Discovery -####################### +.. zephyr:board:: stm32f429i_disc1 Overview ******** @@ -31,10 +28,6 @@ some highlights of the STM32F429I-DISC1 board: - Two user LEDs: LD3 (green), LD4 (red) - Two USB OTG LEDs: LD5 (green) VBUS and LD6 (red) OC (over-current) -.. image:: img/stm32f429i_disc1.jpg - :align: center - :alt: STM32F429I-DISC1 - More information about the board can be found at the `STM32F429I-DISC1 website`_. Hardware diff --git a/boards/st/stm32f469i_disco/doc/index.rst b/boards/st/stm32f469i_disco/doc/index.rst index 549ffd4c67ec6..7570831c568a1 100644 --- a/boards/st/stm32f469i_disco/doc/index.rst +++ b/boards/st/stm32f469i_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32f469i_disco_board: - -ST STM32F469I Discovery -####################### +.. zephyr:board:: stm32f469i_disco Overview ******** @@ -31,10 +28,6 @@ some highlights of the STM32F469I-DISCO board: - 128-Mbit Quad-SPI NOR Flash - Expansion connectors and Arduino UNO V3 connectors -.. image:: img/stm32f469i_disco.jpg - :align: center - :alt: STM32F469I-DISCO - More information about the board can be found at the `32F469IDISCOVERY website`_. Hardware diff --git a/boards/st/stm32f4_disco/doc/index.rst b/boards/st/stm32f4_disco/doc/index.rst index e590250741abc..f21b1cdc01407 100644 --- a/boards/st/stm32f4_disco/doc/index.rst +++ b/boards/st/stm32f4_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32f4_disco_board: - -ST STM32F4 Discovery -#################### +.. zephyr:board:: stm32f4_disco Overview ******** @@ -32,10 +29,6 @@ some highlights of the STM32F4DISCOVERY board: - MP45DT02 ST-MEMS audio sensor omni-directional digital microphone - CS43L22 audio DAC with integrated class D speaker driver -.. image:: img/stm32f4_disco.jpg - :align: center - :alt: STM32F4DISCOVERY - More information about the board can be found at the `STM32F4DISCOVERY website`_. Hardware diff --git a/boards/st/stm32f723e_disco/doc/index.rst b/boards/st/stm32f723e_disco/doc/index.rst index 755e87d4a1284..412e5998dd0b5 100644 --- a/boards/st/stm32f723e_disco/doc/index.rst +++ b/boards/st/stm32f723e_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32f723e_disco_board: - -ST STM32F723E Discovery -####################### +.. zephyr:board:: stm32f723e_disco Overview ******** @@ -23,10 +20,6 @@ and high-speed connectivity features. Important board features include: - USB OTG HS with Micro-AB connectors - USB OTG FS with Micro-AB connectors -.. image:: img/stm32f723e_disco.jpg - :align: center - :alt: STM32F723E-DISCO - More information about the board can be found at the `32F723E-DISCO website`_. Hardware diff --git a/boards/st/stm32f746g_disco/doc/index.rst b/boards/st/stm32f746g_disco/doc/index.rst index 7bd37aa26523b..bdd9ee665b635 100644 --- a/boards/st/stm32f746g_disco/doc/index.rst +++ b/boards/st/stm32f746g_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32f746g_disco_board: - -ST STM32F746G Discovery -####################### +.. zephyr:board:: stm32f746g_disco Overview ******** @@ -35,10 +32,6 @@ and high-speed connectivity features. Important board features include: - USB OTG FS with Micro-AB connectors - Ethernet connector compliant with IEEE-802.3-2002 -.. image:: img/stm32f746g_disco.jpg - :align: center - :alt: STM32F746G-DISCO - More information about the board can be found at the `32F746G-DISCO website`_. Hardware diff --git a/boards/st/stm32f7508_dk/doc/index.rst b/boards/st/stm32f7508_dk/doc/index.rst index 7a3c1c96c2200..fae2512a2f0b0 100644 --- a/boards/st/stm32f7508_dk/doc/index.rst +++ b/boards/st/stm32f7508_dk/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32f7508_dk_board: - -ST STM32F7508-DK Discovery Kit -############################## +.. zephyr:board:: stm32f7508_dk Overview ******** @@ -34,10 +31,6 @@ and high-speed connectivity features. Important board features include: - USB OTG FS with Micro-AB connectors - Ethernet connector compliant with IEEE-802.3-2002 -.. image:: img/stm32f7508_dk.jpg - :align: center - :alt: STM32F7508-DK - More information about the board can be found at the `32F7508-DK website`_. Hardware diff --git a/boards/st/stm32f769i_disco/doc/index.rst b/boards/st/stm32f769i_disco/doc/index.rst index 210eb840ff07e..5324f080bed49 100644 --- a/boards/st/stm32f769i_disco/doc/index.rst +++ b/boards/st/stm32f769i_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32f769i_disco_board: - -ST STM32F769I Discovery -####################### +.. zephyr:board:: stm32f769i_disco Overview ******** @@ -40,10 +37,6 @@ and high-speed connectivity features. Important board features include: - Comprehensive free software including a variety of examples, part of the STM32Cube package - Supported by a wide choice of integrated development environments -.. image:: img/stm32f769i_disco.jpg - :align: center - :alt: STM32F769I-DISCO - More information about the board can be found at the `32F769I-DISCO website`_. Hardware diff --git a/boards/st/stm32g0316_disco/doc/index.rst b/boards/st/stm32g0316_disco/doc/index.rst index de6c2d91e5545..45741fad177b8 100644 --- a/boards/st/stm32g0316_disco/doc/index.rst +++ b/boards/st/stm32g0316_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32g0316_disco_board: - -ST STM32G0316 Discovery -####################### +.. zephyr:board:: stm32g0316_disco Overview ******** @@ -11,10 +8,6 @@ This discovery kit offers an SO8 to DIL8 module designed with the STM32G031J6 mi and allows the user to develop applications. It includes an on-board ST-LINK/V2-1 to debug and program the embedded STM32 microcontroller. -.. image:: img/stm32g0316_disco.jpg - :align: center - :alt: STM32G0316-DISCO - Hardware ******** diff --git a/boards/st/stm32g071b_disco/doc/index.rst b/boards/st/stm32g071b_disco/doc/index.rst index e64a06d12135d..6937ea9452e79 100644 --- a/boards/st/stm32g071b_disco/doc/index.rst +++ b/boards/st/stm32g071b_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32g071b_disco_board: - -ST STM32G071B Discovery -####################### +.. zephyr:board:: stm32g071b_disco Overview ******** @@ -43,10 +40,6 @@ as a USB Type-C™ and Power Delivery analyzer. - On-board ST-LINK/V2-1 debugger/programmer with USB enumeration capability: mass storage, Virtual COM port and debug port -.. image:: img/stm32g071b_disco.jpg - :align: center - :alt: STM32G071B-DISCO - More information about the board can be found at the `STM32G071B-DISCO website`_. diff --git a/boards/st/stm32g081b_eval/doc/index.rst b/boards/st/stm32g081b_eval/doc/index.rst index 1f737c8daa109..27d932b096bbb 100644 --- a/boards/st/stm32g081b_eval/doc/index.rst +++ b/boards/st/stm32g081b_eval/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32g081b_eval_board: - -ST STM32G081B Evaluation -######################## +.. zephyr:board:: stm32g081b_eval Overview ******** @@ -84,10 +81,6 @@ through various use cases. - USB2.0 Type-A receptacle - 19 V power jack for USB PD -.. image:: img/stm32g081b_eval.jpg - :align: center - :alt: STM32G081B-EVAL - More information about the board can be found at the `STM32G081B-EVAL website`_. diff --git a/boards/st/stm32h573i_dk/doc/index.rst b/boards/st/stm32h573i_dk/doc/index.rst index 86190a77deda7..9c04b4165b445 100644 --- a/boards/st/stm32h573i_dk/doc/index.rst +++ b/boards/st/stm32h573i_dk/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32h573i_dk_board: - -ST STM32H573I-DK Discovery -########################## +.. zephyr:board:: stm32h573i_dk Overview ******** @@ -43,10 +40,6 @@ the STM32H573I-DK Discovery board: - 4 user LEDs - User and reset push-buttons -.. image:: img/stm32h573i_dk.jpg - :align: center - :alt: STM32H573I-DK Discovery - More information about the board can be found at the `STM32H573I-DK Discovery website`_. Hardware diff --git a/boards/st/stm32h735g_disco/doc/index.rst b/boards/st/stm32h735g_disco/doc/index.rst index 3ec250bb4e849..919451922dc37 100644 --- a/boards/st/stm32h735g_disco/doc/index.rst +++ b/boards/st/stm32h735g_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32h735g_disco_board: - -ST STM32H735G Discovery -####################### +.. zephyr:board:: stm32h735g_disco Overview ******** @@ -27,10 +24,6 @@ programmer for the STM32 MCU and USB Virtual COM port bridge. STM32H735G-DK boar comes with the STM32CubeH7 MCU Package, which provides an STM32 comprehensive software HAL library as well as various software examples. -.. image:: img/stm32h735g_disco.jpg - :align: center - :alt: STM32H735G-DISCO - More information about the board can be found at the `STM32H735G-DISCO website`_. More information about STM32H735 can be found here: diff --git a/boards/st/stm32h745i_disco/doc/index.rst b/boards/st/stm32h745i_disco/doc/index.rst index c5b0ef79276cc..24dab98ae4ca8 100644 --- a/boards/st/stm32h745i_disco/doc/index.rst +++ b/boards/st/stm32h745i_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32h745i_disco_board: - -ST STM32H745I Discovery -####################### +.. zephyr:board:: stm32h745i_disco Overview ******** @@ -53,10 +50,6 @@ Key Features - USB charger - USB power -.. image:: img/stm32h745i-disco.jpg - :align: center - :alt: STM32H745I-DISCO - More information about the board can be found at the `STM32H745I-DISCO website`_. More information about STM32H747XIH6 can be found here: diff --git a/boards/st/stm32h747i_disco/doc/index.rst b/boards/st/stm32h747i_disco/doc/index.rst index 4f7a345ccc4d8..8d61400060a5a 100644 --- a/boards/st/stm32h747i_disco/doc/index.rst +++ b/boards/st/stm32h747i_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32h747i_disco_board: - -ST STM32H747I Discovery -####################### +.. zephyr:board:: stm32h747i_disco Overview ******** @@ -34,10 +31,6 @@ Additionally, the board features: - 4-direction joystick with selection button - Arduino Uno V3 connectors -.. image:: img/stm32h747i_disco.jpg - :align: center - :alt: STM32H747I-DISCO - More information about the board can be found at the `STM32H747I-DISCO website`_. More information about STM32H747XIH6 can be found here: diff --git a/boards/st/stm32h750b_dk/doc/index.rst b/boards/st/stm32h750b_dk/doc/index.rst index 351276599af90..8dacd802075de 100644 --- a/boards/st/stm32h750b_dk/doc/index.rst +++ b/boards/st/stm32h750b_dk/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32h750b_dk_board: - -ST STM32H750B Discovery Kit -########################### +.. zephyr:board:: stm32h750b_dk Overview ******** @@ -27,10 +24,6 @@ programmer for the STM32 MCU and USB Virtual COM port bridge. STM32H750B-DK boar comes with the STM32CubeH7 MCU Package, which provides an STM32 comprehensive software HAL library as well as various software examples. -.. image:: img/stm32h750b_dk.png - :align: center - :alt: STM32H750B-DK - More information about the board can be found at the `STM32H750B-DK website`_. More information about STM32H750 can be found here: diff --git a/boards/st/stm32h7b3i_dk/doc/index.rst b/boards/st/stm32h7b3i_dk/doc/index.rst index 954f4342d56ec..e5ad38f4c2b77 100644 --- a/boards/st/stm32h7b3i_dk/doc/index.rst +++ b/boards/st/stm32h7b3i_dk/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32h7b3i_dk_board: - -ST STM32H7B3I Discovery kit -########################### +.. zephyr:board:: stm32h7b3i_dk Overview ******** @@ -50,10 +47,6 @@ Important board features include: - ST-LINK USB VBUS, USB OTG HS connector, or external sources - On-board STLINK-V3E debugger/programmer with USB re-enumeration capability -.. image:: img/stm32h7b3i_dk.jpg - :align: center - :alt: STM32H7B3I-DK - More information about the board can be found at the `STM32H7B3I-DK website`_. Hardware diff --git a/boards/st/stm32h7s78_dk/doc/index.rst b/boards/st/stm32h7s78_dk/doc/index.rst index 2352fde0fc9c9..430b3d9dd0edc 100644 --- a/boards/st/stm32h7s78_dk/doc/index.rst +++ b/boards/st/stm32h7s78_dk/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32h7s78_dk_board: - -ST STM32H7S78-DK Discovery -########################## +.. zephyr:board:: stm32h7s78_dk Overview ******** @@ -41,10 +38,6 @@ the STM32H7S78-DK Discovery board: - 4 user LEDs - User and reset push-buttons -.. image:: img/stm32h7s78_dk.jpg - :align: center - :alt: STM32H7S78-DK Discovery - More information about the board can be found at the `STM32H7S78-DK Discovery website`_. Hardware diff --git a/boards/st/stm32l1_disco/doc/index.rst b/boards/st/stm32l1_disco/doc/index.rst index 20d6067b96658..6954625564b48 100644 --- a/boards/st/stm32l1_disco/doc/index.rst +++ b/boards/st/stm32l1_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32l1_disco_board: - -ST STM32L1 Discovery -#################### +.. zephyr:board:: stm32l1_disco Overview ******** @@ -24,10 +21,6 @@ stm32l1_disco configuration enables support for STM32LDISCOVERY board and stm32l152c_disco configuration enables support for STM32L152CDISCOVERY board. -.. image:: img/stm32l1_disco.jpg - :align: center - :alt: STM32LDISCOVERY - More information about the board can be found at the `STM32LDISCOVERY website`_. Hardware diff --git a/boards/st/stm32l476g_disco/doc/index.rst b/boards/st/stm32l476g_disco/doc/index.rst index 94a6e9ce24f14..00c7fdc45d404 100644 --- a/boards/st/stm32l476g_disco/doc/index.rst +++ b/boards/st/stm32l476g_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32l476g_disco_board: - -ST STM32L476G Discovery -####################### +.. zephyr:board:: stm32l476g_disco Overview ******** @@ -42,10 +39,6 @@ some highlights of the STM32L476G Discovery board: - External 5 V - CR2032 battery (not provided) -.. image:: img/stm32l476g_disco.jpg - :align: center - :alt: STM32L476G Discovery - More information about the board can be found at the `STM32L476G Discovery website`_. Hardware diff --git a/boards/st/stm32l496g_disco/doc/index.rst b/boards/st/stm32l496g_disco/doc/index.rst index 15461fb1a71bb..ce91d694043f6 100644 --- a/boards/st/stm32l496g_disco/doc/index.rst +++ b/boards/st/stm32l496g_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32l496g_disco_board: - -ST STM32L496G Discovery -####################### +.. zephyr:board:: stm32l496g_disco Overview ******** @@ -41,10 +38,6 @@ some highlights of the STM32L496G Discovery board: - Reset push button - 4 direction-joystick with selection -.. image:: img/stm32l496g_disco.jpg - :align: center - :alt: STM32L496G Discovery - More information about the board can be found at the `STM32L496G Discovery website`_. Hardware diff --git a/boards/st/stm32l4r9i_disco/doc/index.rst b/boards/st/stm32l4r9i_disco/doc/index.rst index 6fadc331d45ba..0b5b992c05937 100644 --- a/boards/st/stm32l4r9i_disco/doc/index.rst +++ b/boards/st/stm32l4r9i_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32l4r9i_disco_board: - -ST STM32L4R9I Discovery -####################### +.. zephyr:board:: stm32l4r9i_disco Overview ******** @@ -18,10 +15,6 @@ support for AMOLED DSI round LCD display. For even more user-friendliness, the on-board ST-LINK/V2-1 debugger provides out-of-the-box programming and debugging capabilities. -.. image:: img/stm32l4r9i_disco.jpg - :align: center - :alt: STM32L4R9I-DISCO - More information about the board can be found at the `STM32L4R9I-DISCOVERY website`_. More information about STM32L4R9 can be found here: diff --git a/boards/st/stm32l562e_dk/doc/index.rst b/boards/st/stm32l562e_dk/doc/index.rst index 55fd91a34fa78..02109d0a5f7c8 100644 --- a/boards/st/stm32l562e_dk/doc/index.rst +++ b/boards/st/stm32l562e_dk/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32l562e_dk_board: - -ST STM32L562E-DK Discovery -########################## +.. zephyr:board:: stm32l562e_dk Overview ******** @@ -43,10 +40,6 @@ the STM32L562E-DK Discovery board: - 2 user LEDs - User and reset push-buttons -.. image:: img/stm32l562e_dk.jpg - :align: center - :alt: STM32L562E-DK Discovery - More information about the board can be found at the `STM32L562E-DK Discovery website`_. Hardware diff --git a/boards/st/stm32mp157c_dk2/doc/stm32mp157_dk2.rst b/boards/st/stm32mp157c_dk2/doc/stm32mp157_dk2.rst index f8f9a4869e291..bd649f2e2510c 100644 --- a/boards/st/stm32mp157c_dk2/doc/stm32mp157_dk2.rst +++ b/boards/st/stm32mp157c_dk2/doc/stm32mp157_dk2.rst @@ -1,7 +1,4 @@ -.. _stm32mp157c_dk2_board: - -ST STM32MP157C-DK2 Discovery -############################ +.. zephyr:board:: stm32mp157c_dk2 Overview ******** @@ -46,10 +43,6 @@ Zephyr OS is ported to run on the Cortex®-M4 core. - Wi-Fi® 802.11b/g/n - Bluetooth® Low Energy 4.1 -.. image:: img/en.stm32mp157c-dk2.jpg - :align: center - :alt: STM32MP157C-DK2 Discovery - More information about the board can be found at the `STM32P157C Discovery website`_. diff --git a/boards/st/stm32u083c_dk/doc/index.rst b/boards/st/stm32u083c_dk/doc/index.rst index 7b8b74de9169d..81ddcf92a1f2a 100644 --- a/boards/st/stm32u083c_dk/doc/index.rst +++ b/boards/st/stm32u083c_dk/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32u083c_dk_board: - -ST STM32U083C_DK -################ +.. zephyr:board:: stm32u083c_dk Overview ******** @@ -36,10 +33,6 @@ board: - Touchkey - Temperature sensor -.. image:: img/stm32u083c_dk.jpg - :align: center - :alt: STM32U083C_DK - More information about the board can be found at the `STM32U083_DK website`_. Hardware diff --git a/boards/st/stm32u5a9j_dk/doc/index.rst b/boards/st/stm32u5a9j_dk/doc/index.rst index 54d4124303e0e..0851459c26804 100644 --- a/boards/st/stm32u5a9j_dk/doc/index.rst +++ b/boards/st/stm32u5a9j_dk/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32u5a9j_dk_board: - -ST STM32U5A9J Discovery Kit -########################### +.. zephyr:board:: stm32u5a9j_dk Overview ******** diff --git a/boards/st/stm32vl_disco/doc/index.rst b/boards/st/stm32vl_disco/doc/index.rst index e676e4ab42670..a2bb8c8baec4b 100644 --- a/boards/st/stm32vl_disco/doc/index.rst +++ b/boards/st/stm32vl_disco/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32vl_disco_board: - -ST STM32VL Discovery -#################### +.. zephyr:board:: stm32vl_disco Overview ******** @@ -11,10 +8,6 @@ Line" STM32F100x SoC series is showcased. Like other Discovery board, an integrated ST-LINK debugger and programmer is included (V1), but the only included I/O devices are two user LEDs and one user button. -.. image:: img/stm32vl_disco.jpg - :align: center - :alt: STM32VLDISCOVERY - More information about the board can be found at the `STM32VLDISCOVERY website`_. Hardware diff --git a/boards/st/stm32wb5mm_dk/doc/stm32wb5mm_dk.rst b/boards/st/stm32wb5mm_dk/doc/stm32wb5mm_dk.rst index 9ee025f45e95c..3a7bae73f13a4 100644 --- a/boards/st/stm32wb5mm_dk/doc/stm32wb5mm_dk.rst +++ b/boards/st/stm32wb5mm_dk/doc/stm32wb5mm_dk.rst @@ -1,7 +1,4 @@ -.. _stm32wb5mm_dk_discovery_kit: - -ST STM32WB5MM-DK -################ +.. zephyr:board:: stm32wb5mm_dk Overview ******** @@ -47,10 +44,6 @@ STM32WB5MM-DK supports the following features: - Virtual COM port and debug port -.. image:: img/STM32WB5MM_DK.jpg - :align: center - :alt: STM32WB5MM-DK - More information about the board can be found in `STM32WB5MM-DK on www.st.com`_. Hardware diff --git a/boards/st/stm32wb5mmg/doc/stm32wb5mmg.rst b/boards/st/stm32wb5mmg/doc/stm32wb5mmg.rst index 7b8ee9f00622b..f4f2a34cdd18b 100644 --- a/boards/st/stm32wb5mmg/doc/stm32wb5mmg.rst +++ b/boards/st/stm32wb5mmg/doc/stm32wb5mmg.rst @@ -1,7 +1,4 @@ -.. _stm32wb5mmg_bluetooth_module: - -ST STM32WB5MMG -################ +.. zephyr:board:: stm32wb5mmg Overview ******** @@ -33,10 +30,6 @@ STM32WB5MMG supports the following features: - 68 GPIOs - SWD, JTAG -.. image:: img/STM32WB5MMG.jpg - :align: center - :alt: STM32WB5MMG - More information about the board can be found at the `` `STM32WB5MMG on www.st.com`_. Hardware diff --git a/doc/connectivity/networking/api/gptp.rst b/doc/connectivity/networking/api/gptp.rst index 5c4218c730f11..5cabe508ec965 100644 --- a/doc/connectivity/networking/api/gptp.rst +++ b/doc/connectivity/networking/api/gptp.rst @@ -36,9 +36,9 @@ support must be enabled in ethernet drivers. Boards supported: - :zephyr:board:`frdm_k64f` -- :ref:`nucleo_h743zi_board` -- :ref:`nucleo_h745zi_q_board` -- :ref:`nucleo_f767zi_board` +- :zephyr:board:`nucleo_h743zi` +- :zephyr:board:`nucleo_h745zi_q` +- :zephyr:board:`nucleo_f767zi` - :ref:`sam_e70_xplained` - :ref:`native_sim` (only usable for simple testing, limited capabilities due to lack of hardware clock) diff --git a/doc/releases/release-notes-3.7.rst b/doc/releases/release-notes-3.7.rst index fb8b1b5922125..ba288a17d3a22 100644 --- a/doc/releases/release-notes-3.7.rst +++ b/doc/releases/release-notes-3.7.rst @@ -414,12 +414,12 @@ Boards & SoC Support * Added support for :zephyr:board:`Mikroe RA4M1 Clicker board `: ``mikroe_clicker_ra4m1``. * Added support for :ref:`Arduino UNO R4 WiFi board `: ``arduino_uno_r4_wifi``. * Added support for :ref:`Renesas EK-RA8M1 board `: ``ek_ra8m1``. - * Added support for :ref:`ST Nucleo H533RE `: ``nucleo_h533re``. - * Added support for :ref:`ST STM32C0116-DK Discovery Kit `: ``stm32c0116_dk``. - * Added support for :ref:`ST STM32H745I Discovery `: ``stm32h745i_disco``. - * Added support for :ref:`ST STM32H7S78-DK Discovery `: ``stm32h7s78_dk``. - * Added support for :ref:`ST STM32L152CDISCOVERY board `: ``stm32l152c_disco``. - * Added support for :ref:`ST STEVAL STWINBX1 Development kit `: ``steval_stwinbx1``. + * Added support for :zephyr:board:`ST Nucleo H533RE `: ``nucleo_h533re``. + * Added support for :zephyr:board:`ST STM32C0116-DK Discovery Kit `: ``stm32c0116_dk``. + * Added support for :zephyr:board:`ST STM32H745I Discovery `: ``stm32h745i_disco``. + * Added support for :zephyr:board:`ST STM32H7S78-DK Discovery `: ``stm32h7s78_dk``. + * Added support for :zephyr:board:`ST STM32L152CDISCOVERY board `: ``stm32l152c_disco``. + * Added support for :zephyr:board:`ST STEVAL STWINBX1 Development kit `: ``steval_stwinbx1``. * Added support for NXP boards: ``frdm_mcxn947``, ``ke17z512``, ``rd_rw612_bga``, ``frdm_rw612``, ``frdm_ke15z``, ``frdm_ke17z`` * Added support for :ref:`Synopsys ARC-V RMX1xx nSIM-based simulation platform `: ``nsim_arc_v/rmx100``. * Added support for :zephyr:board:`Analog Devices MAX32690EVKIT `: ``max32690evkit``. @@ -441,7 +441,7 @@ Boards & SoC Support * Made these board changes: - * On :ref:`ST STM32H7B3I Discovery Kit `: ``stm32h7b3i_dk_board``, + * On :zephyr:board:`ST STM32H7B3I Discovery Kit `: ``stm32h7b3i_dk``, enabled full cache management, Chrom-ART, double frame buffer and full refresh for optimal LVGL performance. * On ST STM32 boards, stm32cubeprogrammer runner can now be used to program external diff --git a/doc/services/tfm/requirements.rst b/doc/services/tfm/requirements.rst index f8e58dfb21b67..20c342741801c 100644 --- a/doc/services/tfm/requirements.rst +++ b/doc/services/tfm/requirements.rst @@ -20,11 +20,11 @@ The following are some of the boards that can be used with TF-M: - ``nrf9160dk/nrf9160/ns`` * - :ref:`nrf5340dk_nrf5340` - ``nrf5340dk/nrf5340/cpuapp/ns`` - * - :ref:`b_u585i_iot02a_board` + * - :zephyr:board:`b_u585i_iot02a` - ``b_u585i_iot02a/stm32u585xx/ns`` - * - :ref:`nucleo_l552ze_q_board` + * - :zephyr:board:`nucleo_l552ze_q` - ``nucleo_l552ze_q/stm32l552xx/ns`` - * - :ref:`stm32l562e_dk_board` + * - :zephyr:board:`stm32l562e_dk` - ``stm32l562e_dk/stm32l562xx/ns`` * - :ref:`v2m_musca_b1_board` - ``v2m_musca_b1_ns`` diff --git a/samples/basic/blinky_pwm/README.rst b/samples/basic/blinky_pwm/README.rst index d8ec957b192f9..21e086edfc3e8 100644 --- a/samples/basic/blinky_pwm/README.rst +++ b/samples/basic/blinky_pwm/README.rst @@ -41,17 +41,17 @@ In these other cases, however, manual wiring is necessary: * - Board - Wiring - * - :ref:`nucleo_f401re_board` + * - :zephyr:board:`nucleo_f401re` - connect PWM2 (PA0) to an LED - * - :ref:`nucleo_l476rg_board` + * - :zephyr:board:`nucleo_l476rg` - connect PWM2 (PA0) to an LED - * - :ref:`stm32f4_disco_board` + * - :zephyr:board:`stm32f4_disco` - connect PWM2 (PA0) to an LED - * - :ref:`nucleo_f302r8_board` + * - :zephyr:board:`nucleo_f302r8` - connect PWM2 (PA0) to an LED - * - :ref:`nucleo_f103rb_board` + * - :zephyr:board:`nucleo_f103rb` - connect PWM1 (PA8) to an LED - * - :ref:`nucleo_wb55rg_board` + * - :zephyr:board:`nucleo_wb55rg` - connect PWM1 (PA8) to an LED * - :zephyr:board:`esp32_devkitc_wroom` - connect GPIO2 to an LED diff --git a/samples/boards/st/bluetooth/interactive_gui/README.rst b/samples/boards/st/bluetooth/interactive_gui/README.rst index 8721031ffb67e..9e552fd91f938 100644 --- a/samples/boards/st/bluetooth/interactive_gui/README.rst +++ b/samples/boards/st/bluetooth/interactive_gui/README.rst @@ -15,7 +15,7 @@ and it passes the data between the host (PC) and controller. Requirements ************ -* A board based on BlueNRG BLE module such as :ref:`disco_l475_iot1_board` +* A board based on BlueNRG BLE module such as :zephyr:board:`disco_l475_iot1` * `BlueNRG GUI`_ application installed on your PC Default UART settings diff --git a/samples/boards/st/sensortile_box/README.rst b/samples/boards/st/sensortile_box/README.rst index 4ccdf17b55e4a..6fb6c43adc451 100644 --- a/samples/boards/st/sensortile_box/README.rst +++ b/samples/boards/st/sensortile_box/README.rst @@ -27,7 +27,7 @@ through USB. The board declares itself as a USB CDC class device. References ********** -- :ref:`sensortile_box` +- :zephyr:board:`sensortile_box` Building and Running ******************** @@ -40,7 +40,7 @@ Build and flash the sample in the following way: :goals: build flash Please note that flashing the board requires a few preliminary steps described -in :ref:`sensortile_box`. +in :zephyr:board:`sensortile_box`. Then, power cycle the board by disconnecting and reconnecting the USB cable. Run your favorite terminal program to listen for output. diff --git a/samples/boards/st/sensortile_box_pro/sensors-on-board/README.rst b/samples/boards/st/sensortile_box_pro/sensors-on-board/README.rst index b1e74d0a215bf..4e8d32ca1763e 100644 --- a/samples/boards/st/sensortile_box_pro/sensors-on-board/README.rst +++ b/samples/boards/st/sensortile_box_pro/sensors-on-board/README.rst @@ -25,7 +25,7 @@ through USB. The board shows up as a USB CDC class standard device. References ********** -- :ref:`sensortile_box_pro_board` +- :zephyr:board:`sensortile_box_pro` Building and Running ******************** @@ -38,7 +38,7 @@ Build and flash the sample in the following way: :goals: build flash Please note that flashing the board requires a few preliminary steps described -in :ref:`sensortile_box_pro_board`. +in :zephyr:board:`sensortile_box_pro`. Then, power cycle the board by disconnecting and reconnecting the USB cable. Run your favorite terminal program to listen for output. diff --git a/samples/boards/st/steval_stwinbx1/sensors/README.rst b/samples/boards/st/steval_stwinbx1/sensors/README.rst index 9f276fd066c58..3fec6e2e0687e 100644 --- a/samples/boards/st/steval_stwinbx1/sensors/README.rst +++ b/samples/boards/st/steval_stwinbx1/sensors/README.rst @@ -28,7 +28,7 @@ through USB. The board shows up as a USB CDC class standard device. References ********** -- :ref:`steval_stwinbx1_board` +- :zephyr:board:`steval_stwinbx1` Building and Running ******************** @@ -41,7 +41,7 @@ Build and flash the sample in the following way: :goals: build flash Please note that flashing the board requires a few preliminary steps described -in :ref:`steval_stwinbx1_board`. +in :zephyr:board:`steval_stwinbx1`. Then, power cycle the board by disconnecting and reconnecting the USB cable. Run your favorite terminal program to listen for output. diff --git a/samples/drivers/adc/adc_dt/README.rst b/samples/drivers/adc/adc_dt/README.rst index af185f5caa0e0..c66eef6a1166e 100644 --- a/samples/drivers/adc/adc_dt/README.rst +++ b/samples/drivers/adc/adc_dt/README.rst @@ -38,7 +38,7 @@ Building and Running for ST Nucleo L073RZ ========================================= The sample can be built and executed for the -:ref:`nucleo_l073rz_board` as follows: +:zephyr:board:`nucleo_l073rz` as follows: .. zephyr-app-commands:: :zephyr-app: samples/drivers/adc/adc_dt diff --git a/samples/drivers/counter/alarm/README.rst b/samples/drivers/counter/alarm/README.rst index 50ddfed2b13e9..35a6bcc0661a3 100644 --- a/samples/drivers/counter/alarm/README.rst +++ b/samples/drivers/counter/alarm/README.rst @@ -22,7 +22,7 @@ This sample requires the support of a timer IP compatible with alarm setting. References ********** -- :ref:`disco_l475_iot1_board` +- :zephyr:board:`disco_l475_iot1` Building and Running ******************** diff --git a/samples/drivers/dac/README.rst b/samples/drivers/dac/README.rst index f65852f8bbc39..34e3c36339a85 100644 --- a/samples/drivers/dac/README.rst +++ b/samples/drivers/dac/README.rst @@ -21,7 +21,7 @@ overlays in :zephyr_file:`samples/drivers/dac/boards` for examples. Building and Running for ST Nucleo L073RZ ========================================= The sample can be built and executed for the -:ref:`nucleo_l073rz_board` as follows: +:zephyr:board:`nucleo_l073rz` as follows: .. zephyr-app-commands:: :zephyr-app: samples/drivers/dac @@ -32,7 +32,7 @@ The sample can be built and executed for the Building and Running for ST Nucleo L152RE ========================================= The sample can be built and executed for the -:ref:`nucleo_l152re_board` as follows: +:zephyr:board:`nucleo_l152re` as follows: .. zephyr-app-commands:: :zephyr-app: samples/drivers/dac @@ -43,7 +43,7 @@ The sample can be built and executed for the Building and Running for ST Nucleo F767ZI ========================================= The sample can be built and executed for the -:ref:`nucleo_f767zi_board` as follows: +:zephyr:board:`nucleo_f767zi` as follows: .. zephyr-app-commands:: :zephyr-app: samples/drivers/dac @@ -54,7 +54,7 @@ The sample can be built and executed for the Building and Running for ST Disco F3 ========================================= The sample can be built and executed for the -:ref:`stm32f3_disco_board` as follows: +:zephyr:board:`stm32f3_disco` as follows: .. zephyr-app-commands:: :zephyr-app: samples/drivers/dac @@ -65,7 +65,7 @@ The sample can be built and executed for the Building and Running for ST Nucleo F429ZI ========================================= The sample can be built and executed for the -:ref:`nucleo_f429zi_board` as follows: +:zephyr:board:`nucleo_f429zi` as follows: .. zephyr-app-commands:: :zephyr-app: samples/drivers/dac @@ -76,7 +76,7 @@ The sample can be built and executed for the Building and Running for STM32L562E DK ====================================== The sample can be built and executed for the -:ref:`stm32l562e_dk_board` as follows: +:zephyr:board:`stm32l562e_dk` as follows: .. zephyr-app-commands:: :zephyr-app: samples/drivers/dac @@ -87,7 +87,7 @@ The sample can be built and executed for the Building and Running for ST Nucleo L552ZE Q =========================================== The sample can be built and executed for the -:ref:`nucleo_l552ze_q_board` as follows: +:zephyr:board:`nucleo_l552ze_q` as follows: .. zephyr-app-commands:: :zephyr-app: samples/drivers/dac diff --git a/samples/drivers/haptics/drv2605/README.rst b/samples/drivers/haptics/drv2605/README.rst index 4d6ca198b3432..19f52a2f00919 100644 --- a/samples/drivers/haptics/drv2605/README.rst +++ b/samples/drivers/haptics/drv2605/README.rst @@ -13,7 +13,7 @@ of a tapping rhythmic pattern. Building and Running ******************** -Build the application for the :ref:`nucleo_f401re_board` board, and connect a DRV2605 haptic driver +Build the application for the :zephyr:board:`nucleo_f401re` board, and connect a DRV2605 haptic driver on the bus I2C1 at the address 0x5A. .. zephyr-app-commands:: @@ -22,7 +22,7 @@ on the bus I2C1 at the address 0x5A. :goals: build :compact: -For flashing the application, refer to the Flashing section of the :ref:`nucleo_f401re_board` board +For flashing the application, refer to the Flashing section of the :zephyr:board:`nucleo_f401re` board documentation. .. code-block:: none diff --git a/samples/drivers/led/pca9633/README.rst b/samples/drivers/led/pca9633/README.rst index d8add0b143564..66beaf480a62c 100644 --- a/samples/drivers/led/pca9633/README.rst +++ b/samples/drivers/led/pca9633/README.rst @@ -20,7 +20,7 @@ following pattern: Building and Running ******************** -Build the application for the :ref:`nucleo_f334r8_board` board, and connect +Build the application for the :zephyr:board:`nucleo_f334r8` board, and connect a PCA9633 LED driver on the bus I2C Arduino. .. zephyr-app-commands:: @@ -30,7 +30,7 @@ a PCA9633 LED driver on the bus I2C Arduino. :compact: For flashing the application, refer to the Flashing section of the -:ref:`nucleo_f334r8_board` board documentation. +:zephyr:board:`nucleo_f334r8` board documentation. References ********** diff --git a/samples/drivers/watchdog/README.rst b/samples/drivers/watchdog/README.rst index 619ddf789523a..6072689ff81f2 100644 --- a/samples/drivers/watchdog/README.rst +++ b/samples/drivers/watchdog/README.rst @@ -25,7 +25,7 @@ Building and Running for ST Nucleo F091RC ========================================= The sample can be built and executed for the -:ref:`nucleo_f091rc_board` as follows: +:zephyr:board:`nucleo_f091rc` as follows: .. zephyr-app-commands:: :zephyr-app: samples/drivers/watchdog diff --git a/samples/modules/canopennode/README.rst b/samples/modules/canopennode/README.rst index 97dcc251dde60..fae73165bd9ad 100644 --- a/samples/modules/canopennode/README.rst +++ b/samples/modules/canopennode/README.rst @@ -70,7 +70,7 @@ counter object at index ``0x2102`` in the object dictionary. Building and Running for STM32F072RB Discovery ============================================== -The :ref:`stm32f072b_disco_board` board does not come with an onboard CAN +The :zephyr:board:`stm32f072b_disco` board does not come with an onboard CAN transceiver. In order to use the CAN bus on the STM32F072RB Discovery board, an external CAN bus transceiver must be connected to ``PB8`` (``CAN_RX``) and ``PB9`` (``CAN_TX``). This board supports CANopen LED indicators (red and green @@ -89,7 +89,7 @@ object at index ``0x2102`` in the object dictionary. Building and Running for STM32F3 Discovery ========================================== -The :ref:`stm32f3_disco_board` board does not come with an onboard CAN +The :zephyr:board:`stm32f3_disco` board does not come with an onboard CAN transceiver. In order to use the CAN bus on the STM32F3 Discovery board, an external CAN bus transceiver must be connected to ``PD1`` (``CAN_TX``) and ``PD0`` (``CAN_RX``). This board supports CANopen LED indicators (red and green diff --git a/samples/net/cloud/tagoio_http_post/README.rst b/samples/net/cloud/tagoio_http_post/README.rst index 0f7d394fe5c5c..26b3a6e5a115a 100644 --- a/samples/net/cloud/tagoio_http_post/README.rst +++ b/samples/net/cloud/tagoio_http_post/README.rst @@ -44,7 +44,7 @@ Ethernet You can use this application on a supported board with ethernet port. There are many like :ref:`sam4e_xpro`, :ref:`sam_v71_xplained_ultra`, -:zephyr:board:`frdm_k64f`, :ref:`nucleo_f767zi_board` etc. Pick one and just build +:zephyr:board:`frdm_k64f`, :zephyr:board:`nucleo_f767zi` etc. Pick one and just build tagoio-http-client sample application with minimal configuration: .. zephyr-app-commands:: @@ -58,7 +58,7 @@ WIFI ==== To enable WIFI support, you need a board with an embedded WIFI support like -:ref:`disco_l475_iot1_board` or you can add a shield like +:zephyr:board:`disco_l475_iot1` or you can add a shield like :ref:`module_esp_8266` or :ref:`inventek_eswifi_shield`. Additionally you need fill ``CONFIG_TAGOIO_HTTP_WIFI_SSID`` with your wifi network SSID and ``CONFIG_TAGOIO_HTTP_WIFI_PSK`` with the correspondent password at diff --git a/samples/net/sockets/can/README.rst b/samples/net/sockets/can/README.rst index 800665a85233e..8d9661311cd07 100644 --- a/samples/net/sockets/can/README.rst +++ b/samples/net/sockets/can/README.rst @@ -25,8 +25,8 @@ The source code for this sample application can be found at: Requirements ************ -You need a CANBUS enabled board like :ref:`nucleo_l432kc_board` or -:ref:`stm32f072b_disco_board`. +You need a CANBUS enabled board like :zephyr:board:`nucleo_l432kc` or +:zephyr:board:`stm32f072b_disco`. Building and Running ******************** diff --git a/samples/sensor/lis2dh/README.rst b/samples/sensor/lis2dh/README.rst index 23a86bd1523e7..0b635de1c47ee 100644 --- a/samples/sensor/lis2dh/README.rst +++ b/samples/sensor/lis2dh/README.rst @@ -31,7 +31,7 @@ and shields supported by Zephyr, including: * :zephyr:board:`actinius_icarus` * :ref:`thingy52_nrf52832` -* :ref:`stm32f3_disco_board` +* :zephyr:board:`stm32f3_disco` * :ref:`x-nucleo-iks01a2` See the board documentation for detailed instructions on how to flash diff --git a/samples/sensor/lsm6dso/README.rst b/samples/sensor/lsm6dso/README.rst index 1945ca99132f8..2f82e28f18735 100644 --- a/samples/sensor/lsm6dso/README.rst +++ b/samples/sensor/lsm6dso/README.rst @@ -15,7 +15,7 @@ Requirements ************ This sample uses the LSM6DSO sensor controlled using the I2C interface. -It has been tested on the :ref:`stm32l562e_dk_board`. +It has been tested on the :zephyr:board:`stm32l562e_dk`. References ********** @@ -26,7 +26,7 @@ Building and Running ******************** This project outputs sensor data to the console. It requires an LSM6DSO - sensor, which is present on the :ref:`stm32l562e_dk_board`. + sensor, which is present on the :zephyr:board:`stm32l562e_dk`. Building on stm32l562e_dk board =============================== diff --git a/samples/shields/x_nucleo_53l0a1/README.rst b/samples/shields/x_nucleo_53l0a1/README.rst index 403c7ebb4f91b..6addfd589d524 100644 --- a/samples/shields/x_nucleo_53l0a1/README.rst +++ b/samples/shields/x_nucleo_53l0a1/README.rst @@ -48,7 +48,7 @@ Building and Running ******************** This sample runs with X-NUCLEO-53L0A1 stacked on any board with a matching -Arduino connector. For this example, we use a :ref:`nucleo_f429zi_board` board. +Arduino connector. For this example, we use a :zephyr:board:`nucleo_f429zi` board. .. zephyr-app-commands:: :zephyr-app: samples/shields/x_nucleo_53l0a1 diff --git a/samples/shields/x_nucleo_iks01a1/README.rst b/samples/shields/x_nucleo_iks01a1/README.rst index 58121c1f95148..629edc6f8abec 100644 --- a/samples/shields/x_nucleo_iks01a1/README.rst +++ b/samples/shields/x_nucleo_iks01a1/README.rst @@ -34,7 +34,7 @@ Building and Running ******************** This sample runs with X-NUCLEO-IKS01A1 stacked on any board with a matching -Arduino connector. For this example, we use a :ref:`nucleo_f429zi_board` board. +Arduino connector. For this example, we use a :zephyr:board:`nucleo_f429zi` board. .. zephyr-app-commands:: :zephyr-app: samples/shields/x_nucleo_iks01a1 diff --git a/samples/shields/x_nucleo_iks01a2/sensorhub/README.rst b/samples/shields/x_nucleo_iks01a2/sensorhub/README.rst index 5b97f05717286..73296539e9d73 100644 --- a/samples/shields/x_nucleo_iks01a2/sensorhub/README.rst +++ b/samples/shields/x_nucleo_iks01a2/sensorhub/README.rst @@ -42,7 +42,7 @@ Building and Running ******************** This sample runs with X-NUCLEO-IKS01A2 stacked on any board with a matching -Arduino connector. For this example, we use a :ref:`nucleo_f401re_board` board. +Arduino connector. For this example, we use a :zephyr:board:`nucleo_f401re` board. .. zephyr-app-commands:: :zephyr-app: samples/shields/x_nucleo_iks01a2/sensorhub diff --git a/samples/shields/x_nucleo_iks01a2/standard/README.rst b/samples/shields/x_nucleo_iks01a2/standard/README.rst index fb0b8af84a841..ad32685233cf8 100644 --- a/samples/shields/x_nucleo_iks01a2/standard/README.rst +++ b/samples/shields/x_nucleo_iks01a2/standard/README.rst @@ -20,7 +20,7 @@ Requirements This sample communicates over I2C with the X-NUCLEO-IKS01A2 shield stacked on a board with an Arduino connector. The board's I2C must be configured for the I2C Arduino connector in the devicetree. See for -example the :ref:`nucleo_f401re_board` board source code: +example the :zephyr:board:`nucleo_f401re` board source code: - :zephyr_file:`boards/st/nucleo_f401re/nucleo_f401re.dts` - :zephyr_file:`boards/st/nucleo_f401re/arduino_r3_connector.dtsi` @@ -38,7 +38,7 @@ Building and Running ******************** This sample runs with X-NUCLEO-IKS01A2 stacked on any board with a matching -Arduino connector. For this example, we use a :ref:`nucleo_f401re_board` board. +Arduino connector. For this example, we use a :zephyr:board:`nucleo_f401re` board. .. zephyr-app-commands:: :zephyr-app: samples/shields/x_nucleo_iks01a2/standard diff --git a/samples/shields/x_nucleo_iks01a3/sensorhub/README.rst b/samples/shields/x_nucleo_iks01a3/sensorhub/README.rst index ddd06b483a1a6..174589f674619 100644 --- a/samples/shields/x_nucleo_iks01a3/sensorhub/README.rst +++ b/samples/shields/x_nucleo_iks01a3/sensorhub/README.rst @@ -33,7 +33,7 @@ Requirements This sample communicates over I2C with the X-NUCLEO-IKS01A3 shield stacked on a board with an Arduino connector. The board's I2C must be configured for the I2C Arduino connector (both for pin muxing -and devicetree). See for example the :ref:`nucleo_f401re_board` board +and devicetree). See for example the :zephyr:board:`nucleo_f401re` board source code: - :file:`$ZEPHYR_BASE/boards/arm/nucleo_f401re/nucleo_f401re.dts` @@ -52,7 +52,7 @@ Building and Running ******************** This sample runs with X-NUCLEO-IKS01A3 stacked on any board with a matching -Arduino connector. For this example, we use a :ref:`nucleo_f401re_board` board. +Arduino connector. For this example, we use a :zephyr:board:`nucleo_f401re` board. .. zephyr-app-commands:: :zephyr-app: samples/shields/x_nucleo_iks01a3/sensorhub/ diff --git a/samples/shields/x_nucleo_iks01a3/standard/README.rst b/samples/shields/x_nucleo_iks01a3/standard/README.rst index 0677fad6c52b4..5580109e48a12 100644 --- a/samples/shields/x_nucleo_iks01a3/standard/README.rst +++ b/samples/shields/x_nucleo_iks01a3/standard/README.rst @@ -26,7 +26,7 @@ Requirements This sample communicates over I2C with the X-NUCLEO-IKS01A3 shield stacked on a board with an Arduino connector. The board's I2C must be configured for the I2C Arduino connector (both for pin muxing -and devicetree). See for example the :ref:`nucleo_f401re_board` board +and devicetree). See for example the :zephyr:board:`nucleo_f401re` board source code: - :file:`$ZEPHYR_BASE/boards/arm/nucleo_f401re/nucleo_f401re.dts` @@ -56,7 +56,7 @@ Building and Running ******************** This sample runs with X-NUCLEO-IKS01A3 stacked on any board with a matching -Arduino connector. For this example, we use a :ref:`nucleo_f401re_board` board. +Arduino connector. For this example, we use a :zephyr:board:`nucleo_f401re` board. .. zephyr-app-commands:: :zephyr-app: samples/shields/x_nucleo_iks01a3/standard/ diff --git a/samples/shields/x_nucleo_iks02a1/microphone/README.rst b/samples/shields/x_nucleo_iks02a1/microphone/README.rst index 2aba5cc2bae19..68c7d0119cd5b 100644 --- a/samples/shields/x_nucleo_iks02a1/microphone/README.rst +++ b/samples/shields/x_nucleo_iks02a1/microphone/README.rst @@ -37,7 +37,7 @@ Building and Running ******************** This sample runs with X-NUCLEO-IKS02A1 stacked on any board with a matching -Arduino connector. For this example, we use a :ref:`nucleo_f411re_board` board. +Arduino connector. For this example, we use a :zephyr:board:`nucleo_f411re` board. To build the sample you can use following command: .. zephyr-app-commands:: diff --git a/samples/shields/x_nucleo_iks02a1/sensorhub/README.rst b/samples/shields/x_nucleo_iks02a1/sensorhub/README.rst index 699c63e92ebf0..55597b90eddd9 100644 --- a/samples/shields/x_nucleo_iks02a1/sensorhub/README.rst +++ b/samples/shields/x_nucleo_iks02a1/sensorhub/README.rst @@ -28,7 +28,7 @@ Requirements This sample communicates over I2C with the X-NUCLEO-IKS02A1 shield stacked on a board with an Arduino connector. The board's I2C must be configured for the I2C Arduino connector (both for pin muxing -and devicetree). See for example the :ref:`nucleo_f401re_board` board +and devicetree). See for example the :zephyr:board:`nucleo_f401re` board source code: - :zephyr_file:`boards/st/nucleo_f401re/nucleo_f401re.dts` @@ -47,7 +47,7 @@ Building and Running ******************** This sample runs with X-NUCLEO-IKS02A1 stacked on any board with a matching -Arduino connector. For this example, we use a :ref:`nucleo_f401re_board` board. +Arduino connector. For this example, we use a :zephyr:board:`nucleo_f401re` board. .. zephyr-app-commands:: :zephyr-app: samples/shields/x_nucleo_iks02a1/sensorhub/ diff --git a/samples/shields/x_nucleo_iks02a1/standard/README.rst b/samples/shields/x_nucleo_iks02a1/standard/README.rst index faa60e8387a8b..112cbb6c8bef5 100644 --- a/samples/shields/x_nucleo_iks02a1/standard/README.rst +++ b/samples/shields/x_nucleo_iks02a1/standard/README.rst @@ -23,7 +23,7 @@ Requirements This sample communicates over I2C with the X-NUCLEO-IKS02A1 shield stacked on a board with an Arduino connector. The board's I2C must be configured for the I2C Arduino connector (both for pin muxing -and devicetree). See for example the :ref:`nucleo_f401re_board` board +and devicetree). See for example the :zephyr:board:`nucleo_f401re` board source code: - :file:`$ZEPHYR_BASE/boards/arm/nucleo_f401re/nucleo_f401re.dts` @@ -42,7 +42,7 @@ Building and Running ******************** This sample runs with X-NUCLEO-IKS02A1 stacked on any board with a matching -Arduino connector. For this example, we use a :ref:`nucleo_f401re_board` board. +Arduino connector. For this example, we use a :zephyr:board:`nucleo_f401re` board. .. zephyr-app-commands:: :zephyr-app: samples/shields/x_nucleo_iks02a1/standard/ diff --git a/samples/shields/x_nucleo_iks4a1/sensorhub1/README.rst b/samples/shields/x_nucleo_iks4a1/sensorhub1/README.rst index 73296ce36ca48..debbd904769c5 100644 --- a/samples/shields/x_nucleo_iks4a1/sensorhub1/README.rst +++ b/samples/shields/x_nucleo_iks4a1/sensorhub1/README.rst @@ -23,13 +23,13 @@ Requirements This sample communicates over I2C with the X-NUCLEO-IKS4A1 shield stacked on a board with an Arduino connector, e.g. the -:ref:`nucleo_f411re_board` board. +:zephyr:board:`nucleo_f411re` board. Building and Running ******************** This sample runs with X-NUCLEO-IKS4A1 stacked on any board with a matching -Arduino connector. For this example, we use a :ref:`nucleo_f411re_board` board. +Arduino connector. For this example, we use a :zephyr:board:`nucleo_f411re` board. .. zephyr-app-commands:: :zephyr-app: samples/shields/x_nucleo_iks4a1/sensorhub1/ diff --git a/samples/shields/x_nucleo_iks4a1/sensorhub2/README.rst b/samples/shields/x_nucleo_iks4a1/sensorhub2/README.rst index 9fc28a45b5745..be0f48dcd9a95 100644 --- a/samples/shields/x_nucleo_iks4a1/sensorhub2/README.rst +++ b/samples/shields/x_nucleo_iks4a1/sensorhub2/README.rst @@ -23,13 +23,13 @@ Requirements This sample communicates over I2C with the X-NUCLEO-IKS4A1 shield stacked on a board with an Arduino connector, e.g. the -:ref:`nucleo_f411re_board` board. +:zephyr:board:`nucleo_f411re` board. Building and Running ******************** This sample runs with X-NUCLEO-IKS4A1 stacked on any board with a matching -Arduino connector. For this example, we use a :ref:`nucleo_f411re_board` board. +Arduino connector. For this example, we use a :zephyr:board:`nucleo_f411re` board. .. zephyr-app-commands:: :zephyr-app: samples/shields/x_nucleo_iks4a1/sensorhub2/ diff --git a/samples/shields/x_nucleo_iks4a1/standard/README.rst b/samples/shields/x_nucleo_iks4a1/standard/README.rst index 0dfc2651da7ee..7f6b93787613e 100644 --- a/samples/shields/x_nucleo_iks4a1/standard/README.rst +++ b/samples/shields/x_nucleo_iks4a1/standard/README.rst @@ -22,13 +22,13 @@ Requirements This sample communicates over I2C with the X-NUCLEO-IKS4A1 shield stacked on a board with an Arduino connector, e.g. the -:ref:`nucleo_f411re_board` board. +:zephyr:board:`nucleo_f411re` board. Building and Running ******************** This sample runs with X-NUCLEO-IKS4A1 stacked on any board with a matching -Arduino connector. For this example, we use a :ref:`nucleo_f411re_board` board. +Arduino connector. For this example, we use a :zephyr:board:`nucleo_f411re` board. .. zephyr-app-commands:: :zephyr-app: samples/shields/x_nucleo_iks4a1/standard/ diff --git a/samples/subsys/fs/littlefs/README.rst b/samples/subsys/fs/littlefs/README.rst index 342614b591463..600008b5f2b1e 100644 --- a/samples/subsys/fs/littlefs/README.rst +++ b/samples/subsys/fs/littlefs/README.rst @@ -77,7 +77,7 @@ recreated. Block device (e.g. SD card) --------------------------- -This example has been devised and initially tested on :ref:`Nucleo H743ZI ` +This example has been devised and initially tested on :zephyr:board:`nucleo_h743zi` board. It can be also run on any other board with SD/MMC card connected to it. To build the test: diff --git a/samples/subsys/input/draw_touch_events/README.rst b/samples/subsys/input/draw_touch_events/README.rst index 782d7b82b1b30..393651d57875e 100644 --- a/samples/subsys/input/draw_touch_events/README.rst +++ b/samples/subsys/input/draw_touch_events/README.rst @@ -14,7 +14,7 @@ Building and Running While this is a generic sample and it should work with any boards with both display controllers and touch controllers supported by Zephyr (provided the corresponding ``/chosen node`` properties are set i.e. ``zephyr,touch`` and ``zephyr,display``). -Below is an example on how to build the sample for :ref:`stm32f746g_disco_board`: +Below is an example on how to build the sample for :zephyr:board:`stm32f746g_disco`: .. zephyr-app-commands:: :zephyr-app: samples/subsys/input/draw_touch_events diff --git a/samples/subsys/mgmt/updatehub/README.rst b/samples/subsys/mgmt/updatehub/README.rst index b83b52cdc7c12..733df73b267cb 100644 --- a/samples/subsys/mgmt/updatehub/README.rst +++ b/samples/subsys/mgmt/updatehub/README.rst @@ -455,7 +455,7 @@ The below list of hardware have been used by UpdateHub team. :zephyr:board:`frdm_k64f`, "1, 2, 3, 4" :ref:`nrf52840dk_nrf52840`, "2, 3, 4, 5, 6" - :ref:`nucleo_f767zi_board`, "1, 2, 3, 4" + :zephyr:board:`nucleo_f767zi`, "1, 2, 3, 4" .. _updatehub.io: https://updatehub.io diff --git a/samples/subsys/smf/hsm_psicc2/README.rst b/samples/subsys/smf/hsm_psicc2/README.rst index e6215dee7c57b..ff6afc29cdb65 100644 --- a/samples/subsys/smf/hsm_psicc2/README.rst +++ b/samples/subsys/smf/hsm_psicc2/README.rst @@ -16,7 +16,7 @@ It should be possible to build and run this sample on almost any board or emulat Building and Running for ST Disco L475 IOT01 (B-L475E-IOT01A) ============================================================= -The sample can be built and executed for the :ref:`disco_l475_iot1_board` as follows: +The sample can be built and executed for the :zephyr:board:`disco_l475_iot1` as follows: .. zephyr-app-commands:: :zephyr-app: samples/subsys/smf/hsm_psicc2 diff --git a/samples/subsys/smf/smf_calculator/README.rst b/samples/subsys/smf/smf_calculator/README.rst index 329c379bc911b..ae67a316984c3 100644 --- a/samples/subsys/smf/smf_calculator/README.rst +++ b/samples/subsys/smf/smf_calculator/README.rst @@ -31,7 +31,7 @@ output, based on the sample in samples/drivers/display. The state machine update the output text label after every call to :c:func:`smf_run_state`. :kconfig:option:`CONFIG_LV_Z_VDB_SIZE` has been reduced to 14% to allow it to run -on RAM-constrained boards like the :ref:`disco_l475_iot1_board`. +on RAM-constrained boards like the :zephyr:board:`disco_l475_iot1`. Requirements ************ @@ -48,10 +48,10 @@ List of Arduino-based touchscreen shields: The demo should also work on STM32 Discovery Kits with built-in touchscreens e.g. -- :ref:`stm32f412g_disco_board` -- :ref:`st25dv_mb1283_disco_board` -- :ref:`stm32f7508_dk_board` -- :ref:`stm32f769i_disco_board` +- :zephyr:board:`stm32f412g_disco` +- :zephyr:board:`st25dv_mb1283_disco` +- :zephyr:board:`stm32f7508_dk` +- :zephyr:board:`stm32f769i_disco` etc. These will not need a shield defined as the touchscreen is built-in. @@ -59,7 +59,7 @@ etc. These will not need a shield defined as the touchscreen is built-in. Building and Running ******************** -Below is an example on how to build for a :ref:`disco_l475_iot1_board` board with +Below is an example on how to build for a :zephyr:board:`disco_l475_iot1` board with a :ref:`adafruit_2_8_tft_touch_v2`. .. zephyr-app-commands:: @@ -87,7 +87,7 @@ The ``key `` command sends a keypress to the state machine. Valid keys are ``0`` through ``9`` for numbers, ``.``, ``+``, ``-``, ``*``, ``/`` and ``=`` to perform the expected function, ``C`` for Cancel, and ``E`` for Cancel Entry. -GUI update speed on the :ref:`disco_l475_iot1_board` with :ref:`adafruit_2_8_tft_touch_v2` +GUI update speed on the :zephyr:board:`disco_l475_iot1` with :ref:`adafruit_2_8_tft_touch_v2` touchscreen is of the order of 0.8s due to button matrices invalidating the entire matrix area when pressed, rather than just the button that was selected. This could be sped up by using 18 individual buttons rather than a single matrix, but is sufficient diff --git a/samples/subsys/task_wdt/README.rst b/samples/subsys/task_wdt/README.rst index 21372f87d2d4c..d97cfdd178d84 100644 --- a/samples/subsys/task_wdt/README.rst +++ b/samples/subsys/task_wdt/README.rst @@ -19,7 +19,7 @@ fallback. Otherwise the task watchdog will run independently. Building and Running for ST Nucleo L073RZ ========================================= The sample can be built and executed for the -:ref:`nucleo_l073rz_board` as follows: +:zephyr:board:`nucleo_l073rz` as follows: .. zephyr-app-commands:: :zephyr-app: samples/subsys/task_wdt diff --git a/samples/subsys/usb_c/sink/README.rst b/samples/subsys/usb_c/sink/README.rst index 954147965b70c..79b8101651da5 100644 --- a/samples/subsys/usb_c/sink/README.rst +++ b/samples/subsys/usb_c/sink/README.rst @@ -21,8 +21,8 @@ Requirements ************ The TCPC device used by the sample is specified in the devicetree node that's compatible with ``usb-c-connector``. -The sample has been tested on :ref:`b_g474e_dpow1_board` and -:ref:`stm32g081b_eval_board`. Overlay files for the two boards +The sample has been tested on :zephyr:board:`b_g474e_dpow1` and +:zephyr:board:`stm32g081b_eval`. Overlay files for the two boards are provided. Building and Running diff --git a/samples/tfm_integration/tfm_ipc/README.rst b/samples/tfm_integration/tfm_ipc/README.rst index e105be8761551..cc7e87bc99109 100644 --- a/samples/tfm_integration/tfm_ipc/README.rst +++ b/samples/tfm_integration/tfm_ipc/README.rst @@ -142,7 +142,7 @@ Run them in the following order to flash the board: ``STM32_Programmer_CLI`` is required to run ``regression.sh`` (see https://www.st.com/en/development-tools/stm32cubeprog.html). If you are still having trouble running these scripts, check the Programming and Debugging section of the - :ref:`nucleo_l552ze_q_board` or :ref:`stm32l562e_dk_board` documentation. + :zephyr:board:`nucleo_l552ze_q` or :zephyr:board:`stm32l562e_dk` documentation. On LPCxpresso55S69: =================== From 466c1390e68bca546cd8693f6b61f90730aee4a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 16:48:45 +0200 Subject: [PATCH 1587/4482] boards: starfive: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the StarFive boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/starfive/visionfive2/doc/index.rst | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/boards/starfive/visionfive2/doc/index.rst b/boards/starfive/visionfive2/doc/index.rst index 98f966f0513db..24cebc6021c69 100644 --- a/boards/starfive/visionfive2/doc/index.rst +++ b/boards/starfive/visionfive2/doc/index.rst @@ -1,7 +1,4 @@ -.. _visionfive2: - -Starfive VisionFive 2 JH7110 -############################ +.. zephyr:board:: visionfive2 Overview ******** @@ -9,10 +6,6 @@ Overview The StarFive VisionFive 2 is a development board with a StarFive JH7110 multi-core 64bit RISC-V SoC. -.. image:: img/visionfive2.webp - :align: center - :alt: StarFive VisionFive 2 Board - Programming and debugging ************************* From 0452f92bba9127903a5313babd81a1d945675adf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 14:14:21 +0200 Subject: [PATCH 1588/4482] boards: tdk: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the TDK boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/tdk/robokit1/doc/index.rst | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/boards/tdk/robokit1/doc/index.rst b/boards/tdk/robokit1/doc/index.rst index abc90a0a611b6..4f674a188618a 100644 --- a/boards/tdk/robokit1/doc/index.rst +++ b/boards/tdk/robokit1/doc/index.rst @@ -1,7 +1,4 @@ -.. _robokit1: - -TDK RoboKit 1 -############# +.. zephyr:board:: robokit1 Overview ******** @@ -12,10 +9,6 @@ number of small ground robotics useful sensors including chirp sensors for time It pairs a 300MHz Cortex-M7 ATSAME70Q21 with an array of TDK sensors and pin headers useful for robotics. -.. image:: img/tdk_robokit1.jpg - :align: center - :alt: TDK RoboKit1 - Hardware ******** From 4f2511e91eef9cef1af09fc6c6d96e70c9ef9b11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 14:15:01 +0200 Subject: [PATCH 1589/4482] boards: technexion: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Technexion boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/technexion/pico_pi/doc/index.rst | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/boards/technexion/pico_pi/doc/index.rst b/boards/technexion/pico_pi/doc/index.rst index 3b651729227bd..530bc3a86afa1 100644 --- a/boards/technexion/pico_pi/doc/index.rst +++ b/boards/technexion/pico_pi/doc/index.rst @@ -1,7 +1,4 @@ -.. _pico_pi: - -Pico-Pi i.MX7D - Android Things IoT Development Platform -############################################################# +.. zephyr:board:: pico_pi Overview ******** @@ -11,11 +8,6 @@ core and Single Cortex M4 core. Zephyr was ported to run on the M4 core. In a later release, it will also communicate with the A7 core (running Linux) via RPmsg. - -.. image:: pico_pi.jpg - :align: center - :alt: Pico-Pi i.MX7D - Hardware ******** From 1e895fedab3eccb3bb52a6f083d6325234a733f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 14:15:27 +0200 Subject: [PATCH 1590/4482] boards: telink: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Telink boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/telink/tlsr9518adk80d/doc/index.rst | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/boards/telink/tlsr9518adk80d/doc/index.rst b/boards/telink/tlsr9518adk80d/doc/index.rst index 97413403889fc..27a65a0429946 100644 --- a/boards/telink/tlsr9518adk80d/doc/index.rst +++ b/boards/telink/tlsr9518adk80d/doc/index.rst @@ -1,7 +1,4 @@ -.. _tlsr9518adk80d: - -Telink TLSR9518ADK80D -##################### +.. zephyr:board:: tlsr9518adk80d Overview ******** @@ -12,10 +9,6 @@ for several 2.4 GHz air interface standards including Bluetooth 5.2 (Basic data rate, Enhanced data rate, LE, Indoor positioning and BLE Mesh), Zigbee 3.0, Homekit, 6LoWPAN, Thread and 2.4 Ghz proprietary. -.. figure:: img/tlsr9518adk80d.jpg - :align: center - :alt: TLSR9518ADK80D - More information about the board can be found at the `Telink B91 Generic Starter Kit Hardware Guide`_ website. Hardware From d2072f0502426a34d82eaa788fcf118c80fc0475 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 16:49:35 +0200 Subject: [PATCH 1591/4482] boards: toradex: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Toradex boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/toradex/colibri_imx7d/doc/index.rst | 10 +--------- boards/toradex/verdin_imx8mp/doc/index.rst | 11 +---------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/boards/toradex/colibri_imx7d/doc/index.rst b/boards/toradex/colibri_imx7d/doc/index.rst index dd13a140b3c82..ea36ff6b50b47 100644 --- a/boards/toradex/colibri_imx7d/doc/index.rst +++ b/boards/toradex/colibri_imx7d/doc/index.rst @@ -1,7 +1,4 @@ -.. _colibri_imx7d: - -NXP i.MX 7 Computer on Module - Colibri iMX7 -############################################ +.. zephyr:board:: colibri_imx7d Overview ******** @@ -11,11 +8,6 @@ core and Single Cortex M4 core. Zephyr was ported to run on the M4 core. In a later release, it will also communicate with the A7 core (running Linux) via RPmsg. - -.. image:: colibri_imx7d.jpg - :align: center - :alt: Colibri-iMX7 - Hardware ******** diff --git a/boards/toradex/verdin_imx8mp/doc/index.rst b/boards/toradex/verdin_imx8mp/doc/index.rst index e59101fa212e8..af78ea49808f0 100644 --- a/boards/toradex/verdin_imx8mp/doc/index.rst +++ b/boards/toradex/verdin_imx8mp/doc/index.rst @@ -1,7 +1,4 @@ -.. _verdin_imx8mp: - -Toradex Verdin iMX8M Plus SoM -############################# +.. zephyr:board:: verdin_imx8mp Overview ******** @@ -34,12 +31,6 @@ Quoting NXP: The Verdin iMX8M Plus integrates a total of 4 Arm Cortex™-A53 CPUs, operating at 1.6 GHz, alongside a single Arm Cortex™-M7F microcontroller operating at 800 MHz. -.. figure:: verdin_imx8mp_front.jpg - :align: center - :alt: Toradex Verdin iMX8M Plus - - Toradex Verdin iMX8M Plus (Credit: Toradex) - Regarding the Cortex-A53 cluster, it employs the ARMv8-A architecture as a mid-range and energy-efficient processor. With four cores in this cluster, each core is equipped with its own L1 memory system. Moreover, the cluster incorporates a unified L2 cache that offers supplementary From 4662af0b7c7bc91232c4b400012357455bd9c364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 16:50:34 +0200 Subject: [PATCH 1592/4482] boards: udoo: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the UDOO boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/udoo/udoo_neo_full/doc/index.rst | 11 +---------- samples/drivers/ipm/ipm_imx/README.rst | 2 +- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/boards/udoo/udoo_neo_full/doc/index.rst b/boards/udoo/udoo_neo_full/doc/index.rst index 945c1dcee4af0..3c9dd90e2141d 100644 --- a/boards/udoo/udoo_neo_full/doc/index.rst +++ b/boards/udoo/udoo_neo_full/doc/index.rst @@ -1,7 +1,4 @@ -.. _udoo_neo_full: - -UDOO Neo Full -############# +.. zephyr:board:: udoo_neo_full Overview ******** @@ -13,12 +10,6 @@ core running up to 227 MHz for high CPU performance and real-time response. Zephyr was ported to run on the Cortex-M4 core only. In a future release, it will also communicate with the Cortex-A9 core (running Linux) via OpenAMP. -.. figure:: udoo_neo_full_mcimx6x_m4.jpg - :align: center - :alt: UDOO-Neo-Full - - UDOO Neo Full (Credit: udoo.org) - Hardware ******** diff --git a/samples/drivers/ipm/ipm_imx/README.rst b/samples/drivers/ipm/ipm_imx/README.rst index ecffdbede07b3..5ca6a4030881f 100644 --- a/samples/drivers/ipm/ipm_imx/README.rst +++ b/samples/drivers/ipm/ipm_imx/README.rst @@ -39,7 +39,7 @@ It can be built as follows: :goals: build flash :compact: -Follow the instructions in the :ref:`udoo_neo_full` board documentation +Follow the instructions in the :zephyr:board:`udoo_neo_full` board documentation for how to load the Zephyr binary to the desired core and execute it. Building and Running the Linux Code From f0165f29f504fc87b3758bcafc2c81f63e42639b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 16:52:03 +0200 Subject: [PATCH 1593/4482] boards: vcc-gnd: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the VCC-GND boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/vcc-gnd/yd_esp32/doc/index.rst | 11 +---------- boards/vcc-gnd/yd_stm32h750vb/doc/index.rst | 9 +-------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/boards/vcc-gnd/yd_esp32/doc/index.rst b/boards/vcc-gnd/yd_esp32/doc/index.rst index 737b606392c49..425c11c69f0c9 100644 --- a/boards/vcc-gnd/yd_esp32/doc/index.rst +++ b/boards/vcc-gnd/yd_esp32/doc/index.rst @@ -1,7 +1,4 @@ -.. _yd_esp32: - -YD-ESP32 -######## +.. zephyr:board:: yd_esp32 Overview ******** @@ -9,12 +6,6 @@ Overview The YD-ESP32 development board is one of VCC-GND® Studio's official boards. This board is based on the ESP32-WROOM-32E module, with the ESP32 as the core. -.. figure:: img/yd_esp32.png - :align: center - :alt: YD-ESP32 - - YD-ESP32 DevKit with ESP32-WROOM-32E Module - ESP32 ===== diff --git a/boards/vcc-gnd/yd_stm32h750vb/doc/index.rst b/boards/vcc-gnd/yd_stm32h750vb/doc/index.rst index 2b5e1794bd255..d11a7e2473060 100644 --- a/boards/vcc-gnd/yd_stm32h750vb/doc/index.rst +++ b/boards/vcc-gnd/yd_stm32h750vb/doc/index.rst @@ -1,7 +1,4 @@ -.. _yd_stm32h750vb: - -YD-STM32H750VB -############## +.. zephyr:board:: yd_stm32h750vb Overview ******** @@ -10,10 +7,6 @@ The YD-STM32H750VB development board is a complete demonstration and development platform for Arm |reg| Cortex |reg|-M7 core-based STM32H750VBT6 microcontroller, with 128Kbytes of Flash memory and 1 Mbytes of SRAM. -.. image:: img/yd_stm32h750vb.png - :align: center - :alt: YD-STM32H750VB - More information about STM32H750 can be found here: - `STM32H750 on www.st.com`_ From 33985678a619bd12852c830675498f19fa30f77c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 16:53:14 +0200 Subject: [PATCH 1594/4482] boards: vngiotlab: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the VNG boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/vngiotlab/nrf51_vbluno51/doc/index.rst | 11 +---------- boards/vngiotlab/nrf52_vbluno52/doc/index.rst | 11 +---------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/boards/vngiotlab/nrf51_vbluno51/doc/index.rst b/boards/vngiotlab/nrf51_vbluno51/doc/index.rst index b56bcdd093ddc..ad9db23a69e1b 100644 --- a/boards/vngiotlab/nrf51_vbluno51/doc/index.rst +++ b/boards/vngiotlab/nrf51_vbluno51/doc/index.rst @@ -1,7 +1,4 @@ -.. _nrf51_vbluno51: - -nRF51-VBLUno51 -############## +.. zephyr:board:: nrf51_vbluno51 Overview ******** @@ -9,12 +6,6 @@ Overview Zephyr uses the nrf51_vbluno51 board configuration to run on the VBLUno51 board, a VNG Bluetooth Low Energy UNO using an nRF51822 ARM processor. -.. figure:: img/nrf51_vbluno51.jpg - :align: center - :alt: nRF51_VBLUno51 - - nrf51_vbluno51 Top - .. figure:: img/nrf51_vbluno51_bot.jpg :align: center :alt: nRF51_VBLUno51 Bottom diff --git a/boards/vngiotlab/nrf52_vbluno52/doc/index.rst b/boards/vngiotlab/nrf52_vbluno52/doc/index.rst index 68a7c1b97c640..2c710421a64ec 100644 --- a/boards/vngiotlab/nrf52_vbluno52/doc/index.rst +++ b/boards/vngiotlab/nrf52_vbluno52/doc/index.rst @@ -1,7 +1,4 @@ -.. _nrf52_vbluno52: - -nRF52-VBLUno52 -############## +.. zephyr:board:: nrf52_vbluno52 Overview ******** @@ -18,12 +15,6 @@ the following devices: * FLASH * RADIO (Bluetooth Low Energy 5.0) -.. figure:: img/nrf52_vbluno52.jpg - :align: center - :alt: nRF52 VBLUno52 - - nRF52_VBLUno52 board - Hardware ******** From c45a1441b25dc9cacbbc5ef3673caae8b052091b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 16:54:21 +0200 Subject: [PATCH 1595/4482] boards: waveshare: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the WaveShare boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/waveshare/esp32s3_touch_lcd_1_28/doc/index.rst | 5 +---- boards/waveshare/nrf51_ble400/doc/index.rst | 5 +---- boards/waveshare/open103z/doc/index.rst | 7 +------ doc/releases/release-notes-3.7.rst | 2 +- samples/sensor/sht3xd/README.rst | 2 +- 5 files changed, 5 insertions(+), 16 deletions(-) diff --git a/boards/waveshare/esp32s3_touch_lcd_1_28/doc/index.rst b/boards/waveshare/esp32s3_touch_lcd_1_28/doc/index.rst index d2e7a88be870a..540ac8a68e66f 100644 --- a/boards/waveshare/esp32s3_touch_lcd_1_28/doc/index.rst +++ b/boards/waveshare/esp32s3_touch_lcd_1_28/doc/index.rst @@ -1,7 +1,4 @@ -.. _esp32s3_touch_lcd_1_28: - -Waveshare ESP32-S3-Touch-LCD-1.28 -################################# +.. zephyr:board:: esp32s3_touch_lcd_1_28 Overview ******** diff --git a/boards/waveshare/nrf51_ble400/doc/index.rst b/boards/waveshare/nrf51_ble400/doc/index.rst index 3d34f2f27f0b1..5dd3034f9ca85 100644 --- a/boards/waveshare/nrf51_ble400/doc/index.rst +++ b/boards/waveshare/nrf51_ble400/doc/index.rst @@ -1,7 +1,4 @@ -.. _nrf51_ble400: - -Waveshare BLE400 -################# +.. zephyr:board:: nrf51_ble400 Overview ******** diff --git a/boards/waveshare/open103z/doc/index.rst b/boards/waveshare/open103z/doc/index.rst index 773b60f202f83..0ba052cc623d0 100644 --- a/boards/waveshare/open103z/doc/index.rst +++ b/boards/waveshare/open103z/doc/index.rst @@ -1,15 +1,10 @@ -.. _waveshare_open103z_board: - -Waveshare Open103Z -################## +.. zephyr:board:: waveshare_open103z Overview ******** The Waveshare Open103Z-64 is a development board equipped with STM32F103ZE MCU. -.. image:: img/waveshare_open103z.jpg - Hardware ******** diff --git a/doc/releases/release-notes-3.7.rst b/doc/releases/release-notes-3.7.rst index ba288a17d3a22..3410fa344d127 100644 --- a/doc/releases/release-notes-3.7.rst +++ b/doc/releases/release-notes-3.7.rst @@ -435,7 +435,7 @@ Boards & SoC Support * Added support for :zephyr:board:`Espressif ESP32-S2 DevKit-C `: ``esp32s2_devkitc``. * Added support for :zephyr:board:`Espressif ESP32-S3 DevKit-C `: ``esp32s3_devkitc``. * Added support for :zephyr:board:`Espressif ESP32-C6 DevKit-C `: ``esp32c6_devkitc``. - * Added support for :ref:`Waveshare ESP32-S3-Touch-LCD-1.28 `: ``esp32s3_touch_lcd_1_28``. + * Added support for :zephyr:board:`Waveshare ESP32-S3-Touch-LCD-1.28 `: ``esp32s3_touch_lcd_1_28``. * Added support for :zephyr:board:`M5Stack ATOM Lite `: ``m5stack_atom_lite``. * Added support for :ref:`CTHINGS.CO Connectivity Card nRF52840 `: ``ctcc_nrf52840``. diff --git a/samples/sensor/sht3xd/README.rst b/samples/sensor/sht3xd/README.rst index ed3e1a7e1847f..0979b4ef8e89c 100644 --- a/samples/sensor/sht3xd/README.rst +++ b/samples/sensor/sht3xd/README.rst @@ -32,7 +32,7 @@ Building and Running This project outputs sensor data to the console. It requires a SHT3XD sensor. It should work with any platform featuring a I2C peripheral interface. It does not work on QEMU. In this example below the -:ref:`nrf51_ble400` board is used. +:zephyr:board:`nrf51_ble400` board is used. .. zephyr-app-commands:: From 1a3565dd11394b500f951e6b1477d55103779073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 12:11:24 +0200 Subject: [PATCH 1596/4482] boards: we: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Wurth Elektronik boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/we/ophelia1ev/doc/index.rst | 11 +---------- boards/we/proteus2ev/doc/index.rst | 11 +---------- boards/we/proteus3ev/doc/index.rst | 11 +---------- 3 files changed, 3 insertions(+), 30 deletions(-) diff --git a/boards/we/ophelia1ev/doc/index.rst b/boards/we/ophelia1ev/doc/index.rst index 908b0ce6889f9..189e0bdcfc702 100644 --- a/boards/we/ophelia1ev/doc/index.rst +++ b/boards/we/ophelia1ev/doc/index.rst @@ -1,7 +1,4 @@ -.. _we_ophelia1ev_nrf52805: - -Ophelia-I EV NRF52805 -##################### +.. zephyr:board:: we_ophelia1ev Overview ******** @@ -22,12 +19,6 @@ the following devices: * :abbr:`UART (Universal asynchronous receiver-transmitter)` * :abbr:`WDT (Watchdog Timer)` -.. figure:: img/we_ophelia1ev_nrf52805.jpg - :align: center - :alt: Ophelia-I EV - - Ophelia-I EV (Credit: Würth Elektronik) - Hardware ******** diff --git a/boards/we/proteus2ev/doc/index.rst b/boards/we/proteus2ev/doc/index.rst index 19a7df8fbac9e..938258249a159 100644 --- a/boards/we/proteus2ev/doc/index.rst +++ b/boards/we/proteus2ev/doc/index.rst @@ -1,7 +1,4 @@ -.. _we_proteus2ev_nrf52832: - -Würth Elektronik Proteus-II-EV -############################## +.. zephyr:board:: we_proteus2ev Overview ******** @@ -25,12 +22,6 @@ the following devices: * :abbr:`UART (Universal asynchronous receiver-transmitter)` * :abbr:`WDT (Watchdog Timer)` -.. figure:: img/we_proteus2ev_nrf52832.jpg - :align: center - :alt: Proteus-II EV - - Proteus-II-EV (Credit: Würth Elektronik) - More information about the radio module can be found the Würth Elektronik web page https://www.we-online.com/katalog/de/PROTEUS-II . diff --git a/boards/we/proteus3ev/doc/index.rst b/boards/we/proteus3ev/doc/index.rst index 87180a801b4d5..8c8b855cc5dd5 100644 --- a/boards/we/proteus3ev/doc/index.rst +++ b/boards/we/proteus3ev/doc/index.rst @@ -1,7 +1,4 @@ -.. _we_proteus3ev_nrf52840: - -Würth Elektronik Proteus-III-EV -############################### +.. zephyr:board:: we_proteus3ev Overview ******** @@ -25,12 +22,6 @@ nRF52840 ARM Cortex-M4F CPU and the following devices: * :abbr:`UART (Universal asynchronous receiver-transmitter)` * :abbr:`WDT (Watchdog Timer)` -.. figure:: img/we_proteus3ev_nrf52840.jpg - :align: center - :alt: Proteus-III EV - - Proteus-III EV (Credit: Würth Elektronik) - More information about the radio module can be found the Würth Elektronik web page https://www.we-online.com/katalog/de/PROTEUS-III . From e28c1ccb10d22f9c957f356ca7d98baeea2893fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 16:54:51 +0200 Subject: [PATCH 1597/4482] boards: wemos: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Wemos boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/wemos/esp32s2_lolin_mini/doc/index.rst | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/boards/wemos/esp32s2_lolin_mini/doc/index.rst b/boards/wemos/esp32s2_lolin_mini/doc/index.rst index 6d4e57dc8fcd7..c9ce4b2306821 100644 --- a/boards/wemos/esp32s2_lolin_mini/doc/index.rst +++ b/boards/wemos/esp32s2_lolin_mini/doc/index.rst @@ -1,7 +1,4 @@ -.. _esp32s2_lolin_mini: - -ESP32-S2 Lolin Mini -################### +.. zephyr:board:: esp32s2_lolin_mini Overview ******** @@ -30,10 +27,6 @@ The features include the following: - DAC - LED PWM with up to 8 channels -.. figure:: img/esp32_s2_lolin_mini.jpg - :align: center - :alt: ESP32-S2 LOLIN MINI - System requirements ******************* From d1bfc3f91533743ec2e43db1cf37295b4fa3e027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 16:55:08 +0200 Subject: [PATCH 1598/4482] boards: witte: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Witte boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/witte/linum/doc/index.rst | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/boards/witte/linum/doc/index.rst b/boards/witte/linum/doc/index.rst index 537807a797904..43466abdfc88c 100644 --- a/boards/witte/linum/doc/index.rst +++ b/boards/witte/linum/doc/index.rst @@ -1,7 +1,4 @@ -.. _linum: - -Witte Technology Linum Board -############################ +.. zephyr:board:: linum Overview ******** @@ -11,10 +8,6 @@ touchscreen and another for access to other peripherals of microcontroller. Also of communications interfaces like UART with RS232 and RS485 capabillities, CAN bus compatible to FD standard, and networking over Ethernet. -.. image:: img/linum-stm32h753bi-top.jpg - :align: center - :alt: Linum development board - Hardware ******** From 97ba4ca5534a846655971a5b93315a3acfcf5444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 17:46:18 +0200 Subject: [PATCH 1599/4482] boards: atmel: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Atmel boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/atmel/sam/sam4e_xpro/doc/index.rst | 9 +-------- boards/atmel/sam/sam4l_ek/doc/index.rst | 9 +-------- boards/atmel/sam/sam4s_xplained/doc/index.rst | 9 +-------- boards/atmel/sam/sam_e70_xplained/doc/index.rst | 9 +-------- boards/atmel/sam/sam_v71_xult/doc/index.rst | 9 +-------- boards/atmel/sam0/samc21n_xpro/doc/index.rst | 9 +-------- boards/atmel/sam0/samd20_xpro/doc/index.rst | 12 +----------- boards/atmel/sam0/samd21_xpro/doc/index.rst | 12 +----------- boards/atmel/sam0/same54_xpro/doc/index.rst | 9 +-------- boards/atmel/sam0/saml21_xpro/doc/index.rst | 9 +-------- boards/atmel/sam0/samr21_xpro/doc/index.rst | 9 +-------- boards/atmel/sam0/samr34_xpro/doc/index.rst | 9 +-------- doc/connectivity/networking/api/gptp.rst | 2 +- doc/develop/flash_debug/host-tools.rst | 2 +- samples/net/cloud/tagoio_http_post/README.rst | 2 +- 15 files changed, 15 insertions(+), 105 deletions(-) diff --git a/boards/atmel/sam/sam4e_xpro/doc/index.rst b/boards/atmel/sam/sam4e_xpro/doc/index.rst index b01e60cd56d48..1069727aa6c8f 100644 --- a/boards/atmel/sam/sam4e_xpro/doc/index.rst +++ b/boards/atmel/sam/sam4e_xpro/doc/index.rst @@ -1,7 +1,4 @@ -.. _sam4e_xpro: - -SAM4E Xplained Pro -################### +.. zephyr:board:: sam4e_xpro Overview ******** @@ -9,10 +6,6 @@ Overview The SAM4E Xplained Pro evaluation kit is a development platform to evaluate the Atmel SAM4E series microcontrollers. -.. image:: img/sam4e_xpro.jpg - :align: center - :alt: SAM4E Xplained Pro - Hardware ******** diff --git a/boards/atmel/sam/sam4l_ek/doc/index.rst b/boards/atmel/sam/sam4l_ek/doc/index.rst index f3e4e27d37683..f958a54051549 100644 --- a/boards/atmel/sam/sam4l_ek/doc/index.rst +++ b/boards/atmel/sam/sam4l_ek/doc/index.rst @@ -1,7 +1,4 @@ -.. _sam4l_ek: - -SAM4L-EK -######## +.. zephyr:board:: sam4l_ek Overview ******** @@ -22,10 +19,6 @@ The kit is equipped with a rich set of peripherals that make the ATSAM4L-EK a perfect evaluation platform. Download the `SAM4L-EK Online User Guide`_ for more details. -.. image:: img/atmel-sam4l-ek-callouts.jpg - :align: center - :alt: SAM4L-EK - Hardware ******** diff --git a/boards/atmel/sam/sam4s_xplained/doc/index.rst b/boards/atmel/sam/sam4s_xplained/doc/index.rst index a5276bd67161a..480411323bdda 100644 --- a/boards/atmel/sam/sam4s_xplained/doc/index.rst +++ b/boards/atmel/sam/sam4s_xplained/doc/index.rst @@ -1,7 +1,4 @@ -.. _sam4s_xplained: - -SAM4S Xplained -############## +.. zephyr:board:: sam4s_xplained Overview ******** @@ -9,10 +6,6 @@ Overview The SAM4S Xplained evaluation kit is a development platform to evaluate the Atmel SAM4S series microcontrollers. -.. image:: img/sam4s_xplained.jpg - :align: center - :alt: SAM4S Xplained - Hardware ******** diff --git a/boards/atmel/sam/sam_e70_xplained/doc/index.rst b/boards/atmel/sam/sam_e70_xplained/doc/index.rst index 67b90d42c59cf..6c8164391768f 100644 --- a/boards/atmel/sam/sam_e70_xplained/doc/index.rst +++ b/boards/atmel/sam/sam_e70_xplained/doc/index.rst @@ -1,7 +1,4 @@ -.. _sam_e70_xplained: - -SAM E70(B) Xplained -################### +.. zephyr:board:: sam_e70_xplained Overview ******** @@ -10,10 +7,6 @@ The SAM E70 Xplained evaluation kit is a development platform to evaluate the Atmel SAM E70 series microcontrollers. The current version allows to use both IC variations ATSAME70Q21A(B). -.. image:: img/sam_e70_xplained.jpg - :align: center - :alt: SAM E70 Xplained - Hardware ******** diff --git a/boards/atmel/sam/sam_v71_xult/doc/index.rst b/boards/atmel/sam/sam_v71_xult/doc/index.rst index 7ce56d58a7090..cb7ecbfda4398 100644 --- a/boards/atmel/sam/sam_v71_xult/doc/index.rst +++ b/boards/atmel/sam/sam_v71_xult/doc/index.rst @@ -1,7 +1,4 @@ -.. _sam_v71_xplained_ultra: - -SAM V71(B) Xplained Ultra -######################### +.. zephyr:board:: sam_v71_xult Overview ******** @@ -10,10 +7,6 @@ The SAM V71 Xplained Ultra evaluation kit is a development platform to evaluate the Atmel SAM V71 series microcontrollers. The current version allows to use both IC variations ATSAMV71Q21A(B). -.. image:: img/sam_v71_xult.jpg - :align: center - :alt: SAM V71 Xplained Ultra - Hardware ******** diff --git a/boards/atmel/sam0/samc21n_xpro/doc/index.rst b/boards/atmel/sam0/samc21n_xpro/doc/index.rst index 600163a00c958..678e3afa45300 100644 --- a/boards/atmel/sam0/samc21n_xpro/doc/index.rst +++ b/boards/atmel/sam0/samc21n_xpro/doc/index.rst @@ -1,7 +1,4 @@ -.. _samc21n_xpro: - -SAM C21N Xplained Pro Evaluation Kit -#################################### +.. zephyr:board:: samc21n_xpro Overview ******** @@ -12,10 +9,6 @@ microcontrollers. The kit includes Atmel’s Embedded Debugger (EDBG), which provides a full debug interface without the need for additional hardware. -.. image:: img/atsamc21n_xpro.jpg - :align: center - :alt: SAMC21N-XPRO - Hardware ******** diff --git a/boards/atmel/sam0/samd20_xpro/doc/index.rst b/boards/atmel/sam0/samd20_xpro/doc/index.rst index 7b788cbbf73a4..6127a37aff685 100644 --- a/boards/atmel/sam0/samd20_xpro/doc/index.rst +++ b/boards/atmel/sam0/samd20_xpro/doc/index.rst @@ -1,7 +1,4 @@ -.. _samd20_xpro: - -SAM D20 Xplained Pro Evaluation Kit -################################### +.. zephyr:board:: samd20_xpro Overview ******** @@ -12,13 +9,6 @@ microcontrollers. The kit includes Atmel’s Embedded Debugger (EDBG), which provides a full debug interface without the need for additional hardware. -.. figure:: img/atsamd20_xpro.jpg - :width: 500px - :align: center - :alt: SAMD20-XPRO - - SAMD20-XPRO (Credit: `Microchip Technology`_) - Hardware ******** diff --git a/boards/atmel/sam0/samd21_xpro/doc/index.rst b/boards/atmel/sam0/samd21_xpro/doc/index.rst index f4f5bd3391de9..057d6d80b8de4 100644 --- a/boards/atmel/sam0/samd21_xpro/doc/index.rst +++ b/boards/atmel/sam0/samd21_xpro/doc/index.rst @@ -1,7 +1,4 @@ -.. _samd21_xpro: - -SAM D21 Xplained Pro Evaluation Kit -################################### +.. zephyr:board:: samd21_xpro Overview ******** @@ -12,13 +9,6 @@ microcontrollers. The kit includes Atmel's Embedded Debugger (EDBG), which provides a full debug interface without the need for additional hardware. -.. figure:: img/atsamd21_xpro.jpg - :width: 500px - :align: center - :alt: SAMD21-XPRO - - SAMD21-XPRO (Credit: `Microchip Technology`_) - Hardware ******** diff --git a/boards/atmel/sam0/same54_xpro/doc/index.rst b/boards/atmel/sam0/same54_xpro/doc/index.rst index 5fa1eb49e3788..61b127d7a1b50 100644 --- a/boards/atmel/sam0/same54_xpro/doc/index.rst +++ b/boards/atmel/sam0/same54_xpro/doc/index.rst @@ -1,7 +1,4 @@ -.. _same54_xpro: - -SAM E54 Xplained Pro Evaluation Kit -################################### +.. zephyr:board:: same54_xpro Overview ******** @@ -12,10 +9,6 @@ microcontrollers. The kit includes Atmel’s Embedded Debugger (EDBG), which provides a full debug interface without the need for additional hardware. -.. image:: img/atsame54_xpro.jpg - :align: center - :alt: SAME54-XPRO - Hardware ******** diff --git a/boards/atmel/sam0/saml21_xpro/doc/index.rst b/boards/atmel/sam0/saml21_xpro/doc/index.rst index 172fa1f0826c2..b92e1bf09a70c 100644 --- a/boards/atmel/sam0/saml21_xpro/doc/index.rst +++ b/boards/atmel/sam0/saml21_xpro/doc/index.rst @@ -1,7 +1,4 @@ - .. _saml21_xpro: - -SAM L21 Xplained Pro Evaluation Kit -################################### +.. zephyr:board:: saml21_xpro Overview ******** @@ -12,10 +9,6 @@ microcontrollers. The kit includes Atmel’s Embedded Debugger (EDBG), which provides a full debug interface without the need for additional hardware. -.. image:: img/atsaml21-xpro.jpg - :align: center - :alt: SAML21-XPRO - Hardware ******** diff --git a/boards/atmel/sam0/samr21_xpro/doc/index.rst b/boards/atmel/sam0/samr21_xpro/doc/index.rst index 91a47615b9afa..e04b4d7a711fb 100644 --- a/boards/atmel/sam0/samr21_xpro/doc/index.rst +++ b/boards/atmel/sam0/samr21_xpro/doc/index.rst @@ -1,7 +1,4 @@ -.. _samr21_xpro: - -SAM R21 Xplained Pro Evaluation Kit -################################### +.. zephyr:board:: samr21_xpro Overview ******** @@ -12,10 +9,6 @@ bundled with Atmel's AT86RF233, a 2.4GHz IEEE802.15.4 compatible radio. The kit includes Atmel’s Embedded Debugger (EDBG), which provides a full debug interface without the need for additional hardware. -.. image:: img/atsamr21_xpro.jpg - :align: center - :alt: SAMR21-XPRO - Hardware ******** diff --git a/boards/atmel/sam0/samr34_xpro/doc/index.rst b/boards/atmel/sam0/samr34_xpro/doc/index.rst index aa8849d2cb3d4..4a38544be350f 100644 --- a/boards/atmel/sam0/samr34_xpro/doc/index.rst +++ b/boards/atmel/sam0/samr34_xpro/doc/index.rst @@ -1,7 +1,4 @@ - .. _samr34_xpro: - -SAM R34 Xplained Pro Evaluation Kit -################################### +.. zephyr:board:: samr34_xpro Overview ******** @@ -17,10 +14,6 @@ including both a SAML21 die, and a Semtech SX1276 LoRa radio die. This board is also referred to as DM320111. -.. image:: img/atsamr34-xpro.jpg - :align: center - :alt: SAMR34-XPRO - Hardware ******** diff --git a/doc/connectivity/networking/api/gptp.rst b/doc/connectivity/networking/api/gptp.rst index 5cabe508ec965..772e6f099d1c5 100644 --- a/doc/connectivity/networking/api/gptp.rst +++ b/doc/connectivity/networking/api/gptp.rst @@ -39,7 +39,7 @@ Boards supported: - :zephyr:board:`nucleo_h743zi` - :zephyr:board:`nucleo_h745zi_q` - :zephyr:board:`nucleo_f767zi` -- :ref:`sam_e70_xplained` +- :zephyr:board:`sam_e70_xplained` - :ref:`native_sim` (only usable for simple testing, limited capabilities due to lack of hardware clock) - :ref:`qemu_x86` (emulated, limited capabilities due to lack of hardware clock) diff --git a/doc/develop/flash_debug/host-tools.rst b/doc/develop/flash_debug/host-tools.rst index 1cb25cd01c4c1..85cf6a826dc03 100644 --- a/doc/develop/flash_debug/host-tools.rst +++ b/doc/develop/flash_debug/host-tools.rst @@ -176,7 +176,7 @@ options are available passing the runner option, for instance More implementation details can be found in the :ref:`boards` documentation. As a quick reference, see these three board documentation pages: - - :ref:`sam4e_xpro` (ROM bootloader) + - :zephyr:board:`sam4e_xpro` (ROM bootloader) - :zephyr:board:`adafruit_feather_m0_basic_proto` (Adafruit UF2 bootloader) - :ref:`arduino_nano_33_iot` (Arduino bootloader) - :ref:`arduino_nano_33_ble` (Arduino legacy bootloader) diff --git a/samples/net/cloud/tagoio_http_post/README.rst b/samples/net/cloud/tagoio_http_post/README.rst index 26b3a6e5a115a..39e6597a0a783 100644 --- a/samples/net/cloud/tagoio_http_post/README.rst +++ b/samples/net/cloud/tagoio_http_post/README.rst @@ -43,7 +43,7 @@ Ethernet ======== You can use this application on a supported board with ethernet port. There -are many like :ref:`sam4e_xpro`, :ref:`sam_v71_xplained_ultra`, +are many like :zephyr:board:`sam4e_xpro`, :zephyr:board:`sam_v71_xult`, :zephyr:board:`frdm_k64f`, :zephyr:board:`nucleo_f767zi` etc. Pick one and just build tagoio-http-client sample application with minimal configuration: From 23f5e3e97e187ddb35347377a57d76d3aab351fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 17:58:59 +0200 Subject: [PATCH 1600/4482] boards: aconno: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Aconno boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/aconno/acn52832/doc/index.rst | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/boards/aconno/acn52832/doc/index.rst b/boards/aconno/acn52832/doc/index.rst index ff0c98cd91a6a..3e773c91a2a98 100644 --- a/boards/aconno/acn52832/doc/index.rst +++ b/boards/aconno/acn52832/doc/index.rst @@ -1,7 +1,4 @@ -.. _acn52832: - -acn52832 -######## +.. zephyr:board:: acn52832 Overview ******** From 200ff9ec57d6907a359a9a84b62dc48c2c19c60f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 18:00:10 +0200 Subject: [PATCH 1601/4482] boards: bcdevices: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Blue Clover Devices boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/bcdevices/plt_demo_v2/doc/index.rst | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/boards/bcdevices/plt_demo_v2/doc/index.rst b/boards/bcdevices/plt_demo_v2/doc/index.rst index cf4df2dcb8725..646e5c9202507 100644 --- a/boards/bcdevices/plt_demo_v2/doc/index.rst +++ b/boards/bcdevices/plt_demo_v2/doc/index.rst @@ -1,7 +1,4 @@ -.. _blueclover_plt_demo_v2_nrf52832: - -Blue Clover PLT Demo V2 nRF52832 -################################ +.. zephyr:board:: blueclover_plt_demo_v2 Overview ******** @@ -27,10 +24,6 @@ The Nordic Semiconductor nRF52832 ARM Cortex-M4F MCU features the following: * :abbr:`UART (Universal asynchronous receiver-transmitter)` * :abbr:`WDT (Watchdog Timer)` -.. figure:: img/blueclover_plt_demo_v2.jpg - :align: center - :alt: Blue Clover PLT Demo V2 nRF52832 - Hardware ******** From b715a977ba547e60b843cc24ff717eaae9fadefa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 18:00:45 +0200 Subject: [PATCH 1602/4482] boards: bytesatwork: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the bytesatwork boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/bytesatwork/bytesensi_l/doc/index.rst | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/boards/bytesatwork/bytesensi_l/doc/index.rst b/boards/bytesatwork/bytesensi_l/doc/index.rst index 9d16e74d21bf6..d1b220a778b94 100644 --- a/boards/bytesatwork/bytesensi_l/doc/index.rst +++ b/boards/bytesatwork/bytesensi_l/doc/index.rst @@ -1,7 +1,4 @@ -.. _bytesensi_l: - -bytesatwork byteSENSI-L -####################### +.. zephyr:board:: bytesensi_l Overview ******** @@ -9,11 +6,6 @@ Overview The byteSENSI-L is a fun LoRa device based on nRF52 MCU that integrates many sensors. -.. image:: img/byteSENSI-L.jpg - :width: 800px - :align: center - :alt: byteSENSI-L - Hardware ******** From ba09b12735e8a8e38ac6f8f7613ab2b99eebaf12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 18:13:10 +0200 Subject: [PATCH 1603/4482] boards: silabs: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Silicon Labs boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/silabs/dev_kits/sim3u1xx_dk/doc/index.rst | 8 +------- boards/silabs/dev_kits/sltb004a/doc/index.rst | 9 +-------- boards/silabs/dev_kits/sltb009a/doc/index.rst | 11 +---------- boards/silabs/dev_kits/sltb010a/doc/index.rst | 9 +-------- boards/silabs/dev_kits/xg24_dk2601b/doc/index.rst | 12 +----------- boards/silabs/dev_kits/xg27_dk2602a/doc/index.rst | 12 +----------- boards/silabs/radio_boards/slwrb4104a/doc/index.rst | 11 +---------- boards/silabs/radio_boards/slwrb4161a/doc/index.rst | 11 +---------- boards/silabs/radio_boards/slwrb4170a/doc/index.rst | 11 +---------- boards/silabs/radio_boards/slwrb4180a/doc/index.rst | 11 +---------- boards/silabs/radio_boards/slwrb4250b/doc/index.rst | 11 +---------- boards/silabs/radio_boards/slwrb4255a/doc/index.rst | 11 +---------- boards/silabs/radio_boards/slwrb4321a/doc/index.rst | 11 +---------- .../silabs/radio_boards/xg24_rb4187c/doc/index.rst | 11 +---------- .../starter_kits/efm32wg_stk3800/doc/index.rst | 12 +----------- boards/silabs/starter_kits/slstk3400a/doc/index.rst | 11 +---------- boards/silabs/starter_kits/slstk3401a/doc/index.rst | 11 +---------- boards/silabs/starter_kits/slstk3402a/doc/index.rst | 11 +---------- boards/silabs/starter_kits/slstk3701a/doc/index.rst | 11 +---------- 19 files changed, 19 insertions(+), 186 deletions(-) diff --git a/boards/silabs/dev_kits/sim3u1xx_dk/doc/index.rst b/boards/silabs/dev_kits/sim3u1xx_dk/doc/index.rst index 67284c4b7822c..cacc8da90ba10 100644 --- a/boards/silabs/dev_kits/sim3u1xx_dk/doc/index.rst +++ b/boards/silabs/dev_kits/sim3u1xx_dk/doc/index.rst @@ -1,16 +1,10 @@ -.. _sim3u1xx_dk: - -Silicon Labs SiM3U1xx 32-bit MCU USB Development Kit -#################################################### +.. zephyr:board:: sim3u1xx_dk Overview ******** This is a `development kit`_ that is used to develop software for the SiM3U1xx MCUs. -.. figure:: sim3u1xx_dk.webp - :align: center - Hardware ******** diff --git a/boards/silabs/dev_kits/sltb004a/doc/index.rst b/boards/silabs/dev_kits/sltb004a/doc/index.rst index e11145365fbae..13b0ddc47c6fe 100644 --- a/boards/silabs/dev_kits/sltb004a/doc/index.rst +++ b/boards/silabs/dev_kits/sltb004a/doc/index.rst @@ -1,7 +1,4 @@ -.. _sltb004a: - -EFR32MG12 Thunderboard (SLTB004A) -################################# +.. zephyr:board:: sltb004a Overview ******** @@ -10,10 +7,6 @@ The EFR32MG12 Thunderboard (a.k.a Thunderboard Sense 2) contains an MCU from the EFR32MG12 family built on ARM® Cortex®-M4F processor with low power capabilities. -.. image:: sltb004a.jpg - :align: center - :alt: EFR32MG12 SLTB004A - Hardware ******** diff --git a/boards/silabs/dev_kits/sltb009a/doc/index.rst b/boards/silabs/dev_kits/sltb009a/doc/index.rst index 9366a7d264991..1e0489dbad3ff 100644 --- a/boards/silabs/dev_kits/sltb009a/doc/index.rst +++ b/boards/silabs/dev_kits/sltb009a/doc/index.rst @@ -1,7 +1,4 @@ -.. _efm32gg_sltb009a: - -EFM32GG12 Thunderboard (SLTB009A) -################################# +.. zephyr:board:: sltb009a Overview ******** @@ -10,12 +7,6 @@ The EFM32GG12 Thunderboard Kit (SLTB009A) is an evaluation platform for the EFM32GG12 Giant Gecko Microcontroller, featuring an ARM Cortex-M4 with FPU, 1024kB flash, and 192kB RAM. -.. figure:: sltb009a.jpg - :align: center - :alt: SLTB009A - - SLTB009A (Credit: Silicon Labs) - Hardware ******** diff --git a/boards/silabs/dev_kits/sltb010a/doc/index.rst b/boards/silabs/dev_kits/sltb010a/doc/index.rst index a335924359f47..f1ed44facb40e 100644 --- a/boards/silabs/dev_kits/sltb010a/doc/index.rst +++ b/boards/silabs/dev_kits/sltb010a/doc/index.rst @@ -1,16 +1,9 @@ -.. _sltb010a: - -EFR32BG22 Thunderboard (SLTB010A) -################################# +.. zephyr:board:: sltb010a SLTB010A is a development kit based on the EFR32BG22 SoC. Early revisions of the kit (A00 and A01) use a slightly different PCB (BRD4184A) from later revisions (BRD4184B). -.. image:: ./sltb010a.jpg - :align: center - :alt: SLTB010A board - Hardware ******** diff --git a/boards/silabs/dev_kits/xg24_dk2601b/doc/index.rst b/boards/silabs/dev_kits/xg24_dk2601b/doc/index.rst index 069b1d8923f12..214ce3b00bcf4 100644 --- a/boards/silabs/dev_kits/xg24_dk2601b/doc/index.rst +++ b/boards/silabs/dev_kits/xg24_dk2601b/doc/index.rst @@ -1,7 +1,4 @@ -.. _efr32mg24_dk2601b: - -EFR32xG24 Dev Kit (xG24-DK2601B) -################################ +.. zephyr:board:: xg24_dk2601b Overview ******** @@ -10,13 +7,6 @@ The EFR32MG24 Mighty Gecko Board dev kit contains a Wireless System-On-Chip from the EFR32MG24 family built on an ARM Cortex®-M33F processor with excellent low power capabilities. -.. figure:: ./img/xg24_dk2601b.jpg - :height: 260px - :align: center - :alt: xG24-DK2601B Dev Kit board - - xG24-DK2601B (image courtesy of Silicon Labs) - Hardware ******** diff --git a/boards/silabs/dev_kits/xg27_dk2602a/doc/index.rst b/boards/silabs/dev_kits/xg27_dk2602a/doc/index.rst index 273b78e60ba5c..cd739beeaedf3 100644 --- a/boards/silabs/dev_kits/xg27_dk2602a/doc/index.rst +++ b/boards/silabs/dev_kits/xg27_dk2602a/doc/index.rst @@ -1,18 +1,8 @@ -.. _xg27_dk2602a: - -EFR32xG27 Dev Kit (xG27-DK2602A) -################################ +.. zephyr:board:: xg27_dk2602a Silicon Labs xG27-DK2602A is a Dev Kit using the EFR32BG27 SoC. The kit consists of the EFR32BG27 +8 dBm Dev Kit Board (BRD2602A). -.. figure:: ./xg27_dk2602a.png - :height: 260px - :align: center - :alt: xG27-DK2602A - - xG27-DK2602A (image courtesy of Silicon Labs) - Hardware ******** diff --git a/boards/silabs/radio_boards/slwrb4104a/doc/index.rst b/boards/silabs/radio_boards/slwrb4104a/doc/index.rst index 3496421743c04..1cee2ffd5ab55 100644 --- a/boards/silabs/radio_boards/slwrb4104a/doc/index.rst +++ b/boards/silabs/radio_boards/slwrb4104a/doc/index.rst @@ -1,7 +1,4 @@ -.. _slwrb4104a: - -EFR32BG13 2.4 GHz 10 dBm (SLWRB4104A) -##################################### +.. zephyr:board:: slwrb4104a Overview ******** @@ -11,12 +8,6 @@ radio boards delivered with `SLWSTK6020B Bluetooth SoC Starter Kit`_. It contains a Wireless System-On-Chip from the EFR32BG13 family built on an ARM Cortex®-M4F processor with excellent low power capabilities. -.. figure:: efr32bg13-slwrb4104a.jpg - :align: center - :alt: SLWRB4104A Blue Gecko Bluetooth® Low Energy Radio Board - - SLWRB4104A (image courtesy of Silicon Labs) - The BRD4104A a.k.a. SLWRB4104A radio board plugs into the Wireless Starter Kit Mainboard BRD4001A and is supported as one of :ref:`silabs_radio_boards`. diff --git a/boards/silabs/radio_boards/slwrb4161a/doc/index.rst b/boards/silabs/radio_boards/slwrb4161a/doc/index.rst index 927e27c20ae1e..134dbdb3af0a8 100644 --- a/boards/silabs/radio_boards/slwrb4161a/doc/index.rst +++ b/boards/silabs/radio_boards/slwrb4161a/doc/index.rst @@ -1,7 +1,4 @@ -.. _slwrb4161a: - -EFR32MG12 2.4 GHz 19 dBm (SLWRB4161A) -##################################### +.. zephyr:board:: slwrb4161a Overview ******** @@ -10,12 +7,6 @@ The EFR32MG12 Mighty Gecko Radio Board contains a Wireless System-On-Chip from the EFR32MG12 family built on an ARM Cortex®-M4F processor with excellent low power capabilities. -.. figure:: efr32mg12-slwrb4161a.jpeg - :align: center - :alt: SLWRB4161A Mighty Gecko Radio Board - - SLWRB4161A (image courtesy of Silicon Labs) - The BRD4161A a.k.a. SLWRB4161A radio board plugs into the Wireless Starter Kit Mainboard BRD4001A and is supported as one of :ref:`silabs_radio_boards`. diff --git a/boards/silabs/radio_boards/slwrb4170a/doc/index.rst b/boards/silabs/radio_boards/slwrb4170a/doc/index.rst index ccc2b7248ea6a..9c96d7ec31ec9 100644 --- a/boards/silabs/radio_boards/slwrb4170a/doc/index.rst +++ b/boards/silabs/radio_boards/slwrb4170a/doc/index.rst @@ -1,7 +1,4 @@ -.. _slwrb4170a: - -EFR32MG12 2400/868-915 MHz 19 dBm Dual Band (SLWRB4170A) -######################################################## +.. zephyr:board:: slwrb4170a Overview ******** @@ -10,12 +7,6 @@ The EFR32MG12 Mighty Gecko Radio Board contains a Wireless System-On-Chip from the EFR32MG12 family built on an ARM Cortex®-M4F processor with excellent low power capabilities. -.. figure:: efr32mg12-slwrb4170a.jpg - :align: center - :alt: SLWRB4170A Mighty Gecko Radio Board - - SLWRB4170A (image courtesy of Silicon Labs) - The BRD4170A a.k.a. SLWRB4170A radio board plugs into the Wireless Starter Kit Mainboard BRD4001A and is supported as one of :ref:`silabs_radio_boards`. diff --git a/boards/silabs/radio_boards/slwrb4180a/doc/index.rst b/boards/silabs/radio_boards/slwrb4180a/doc/index.rst index 057e8ec9b0044..4bdaf37630919 100644 --- a/boards/silabs/radio_boards/slwrb4180a/doc/index.rst +++ b/boards/silabs/radio_boards/slwrb4180a/doc/index.rst @@ -1,7 +1,4 @@ -.. _slwrb4180a: - -EFR32xG21 2.4 GHz 20 dBm (SLWRB4180A) -##################################### +.. zephyr:board:: slwrb4180a Overview ******** @@ -11,12 +8,6 @@ radio boards delivered with `EFR32-SLWSTK6006A Website`_. It contains a Wireless System-On-Chip from the EFR32MG21 family built on an ARM Cortex®-M33F processor with excellent low power capabilities. -.. figure:: efr32mg21-slwrb4180a.jpg - :align: center - :alt: SLWRB4180A Mighty Gecko Radio Board - - SLWRB4180A (image courtesy of Silicon Labs) - The BRD4180A a.k.a. SLWRB4180A radio board plugs into the Wireless Starter Kit Mainboard BRD4001A and is supported as one of :ref:`silabs_radio_boards`. diff --git a/boards/silabs/radio_boards/slwrb4250b/doc/index.rst b/boards/silabs/radio_boards/slwrb4250b/doc/index.rst index 7a865b5b5738b..57a26c65cbf26 100644 --- a/boards/silabs/radio_boards/slwrb4250b/doc/index.rst +++ b/boards/silabs/radio_boards/slwrb4250b/doc/index.rst @@ -1,7 +1,4 @@ -.. _slwrb4250b: - -EFR32FG1 2400/868 MHz 13 dBm Dual Band (SLWRB4250B) -################################################### +.. zephyr:board:: slwrb4250b Overview ******** @@ -10,12 +7,6 @@ The EFR32FG1 Flex Gecko 2.4 GHz and 868 MHz Radio Board is delivered as part of `SLWSTK6061B Proprietary Wireless Starter Kit`_. It contains a EFR32FG1 Wireless SoC built on an ARM Cortex®-M4F processor with excellent low power capabilities. -.. figure:: efr32fg1-slwrb4250b.jpg - :align: center - :alt: SLWRB4250B Flex Gecko 2.4 GHz and 868 MHz Radio Board - - SLWRB4250B (image courtesy of Silicon Labs) - The BRD4250B a.k.a. SLWRB4250B radio board plugs into the Wireless Starter Kit Mainboard BRD4001A and is supported as one of :ref:`silabs_radio_boards`. diff --git a/boards/silabs/radio_boards/slwrb4255a/doc/index.rst b/boards/silabs/radio_boards/slwrb4255a/doc/index.rst index 43dd6e65aadf3..50506431cf462 100644 --- a/boards/silabs/radio_boards/slwrb4255a/doc/index.rst +++ b/boards/silabs/radio_boards/slwrb4255a/doc/index.rst @@ -1,7 +1,4 @@ -.. _slwrb4255a: - -EFR32FG13 2400/915 MHz 19 dBm Dual Band (SLWRB4255A) -#################################################### +.. zephyr:board:: slwrb4255a Overview ******** @@ -10,12 +7,6 @@ The EFR32FG13P Flex Gecko 2.4 GHz and 915 MHz Radio Board is delivered as a `standalone Proprietary Wireless radio board`_. It contains a EFR32FG13P Wireless SoC built on an ARM Cortex®-M4F processor with excellent low power capabilities. -.. figure:: efr32fg13-slwrb4255a.jpg - :align: center - :alt: SLWRB4255A Flex Gecko 2.4 GHz and 915 MHz Radio Board - - SLWRB4255A (image courtesy of Silicon Labs) - The BRD4255A a.k.a. SLWRB4255A radio board plugs into the Wireless Starter Kit Mainboard BRD4001A and is supported as one of :ref:`silabs_radio_boards`. diff --git a/boards/silabs/radio_boards/slwrb4321a/doc/index.rst b/boards/silabs/radio_boards/slwrb4321a/doc/index.rst index 50ec07b7f7989..aa64ddc71d11c 100644 --- a/boards/silabs/radio_boards/slwrb4321a/doc/index.rst +++ b/boards/silabs/radio_boards/slwrb4321a/doc/index.rst @@ -1,7 +1,4 @@ -.. _slwrb4321a: - -WGM160P Wi-Fi Module (SLWRB4321A) -################################# +.. zephyr:board:: slwrb4321a Overview ******** @@ -10,12 +7,6 @@ The WGM160P Starter Kit SLWSTK6121A comes with the BRD4321A radio board. This radio boards contains a WGM160P module, which combines the WF200 Wi-Fi transceiver with an EFM32GG11 microcontroller. -.. figure:: wgm160p-starter-kit.jpg - :align: center - :alt: SLWSTK6121A - - SLWSTK6121A (image courtesy of Silicon Labs) - Hardware ******** diff --git a/boards/silabs/radio_boards/xg24_rb4187c/doc/index.rst b/boards/silabs/radio_boards/xg24_rb4187c/doc/index.rst index 82da55861ce5b..82804d3e93f29 100644 --- a/boards/silabs/radio_boards/xg24_rb4187c/doc/index.rst +++ b/boards/silabs/radio_boards/xg24_rb4187c/doc/index.rst @@ -1,7 +1,4 @@ -.. _xg24_rb4187c: - -EFR32xG24 2.4 GHz 20 dBm (xG24-RB4187C) -####################################### +.. zephyr:board:: xg24_rb4187c Overview ******** @@ -11,12 +8,6 @@ radio boards delivered with `xG24-PK6010A Website`_. It contains a Wireless System-On-Chip from the EFR32MG24 family built on an ARM Cortex®-M33F processor with excellent low power capabilities. -.. figure:: efr32mg24-xg24-rb4187c.jpg - :align: center - :alt: xG24-RB4187C Mighty Gecko Radio Board - - xG24-RB4187C (image courtesy of Silicon Labs) - The BRD4187C a.k.a. xG24-RB4187C radio board plugs into the Wireless Pro Kit Mainboard BRD4002A and is supported as one of :ref:`silabs_radio_boards`. diff --git a/boards/silabs/starter_kits/efm32wg_stk3800/doc/index.rst b/boards/silabs/starter_kits/efm32wg_stk3800/doc/index.rst index 0c04b7b21de00..107bab8a518c2 100644 --- a/boards/silabs/starter_kits/efm32wg_stk3800/doc/index.rst +++ b/boards/silabs/starter_kits/efm32wg_stk3800/doc/index.rst @@ -1,7 +1,4 @@ -.. _efm32wg_stk3800: - -EFM32 Wonder Gecko (EFM32WG-STK3800) -#################################### +.. zephyr:board:: efm32wg_stk3800 Overview ******** @@ -10,13 +7,6 @@ The EFM32 Wonder Gecko Starter Kit EFM32WG-STK3800 contains a MCU from the EFM32WG family built on ARM® Cortex®-M4F processor with excellent low power capabilities. -.. figure:: efm32wg_stk3800.jpg - :align: center - :alt: EFM32WG-STK3800 - - EFM32WG-STK3800 (image courtesy of Silicon Labs) - - Hardware ******** diff --git a/boards/silabs/starter_kits/slstk3400a/doc/index.rst b/boards/silabs/starter_kits/slstk3400a/doc/index.rst index 7f3f919643bc2..fdfa5a4aab2f6 100644 --- a/boards/silabs/starter_kits/slstk3400a/doc/index.rst +++ b/boards/silabs/starter_kits/slstk3400a/doc/index.rst @@ -1,7 +1,4 @@ -.. _slstk3400a: - -EFM32 Happy Gecko (SLSTK3400A) -############################## +.. zephyr:board:: slstk3400a Overview ******** @@ -10,12 +7,6 @@ The EFM32 Happy Gecko Starter Kit SLSTK3400A contains a MCU from the EFM32HG family built on ARM® Cortex®-M0+ processor with excellent low power capabilities. -.. figure:: slstk3400a.jpg - :align: center - :alt: SLSTK3400A - - SLSTK3400A (image courtesy of Silicon Labs) - Hardware ******** diff --git a/boards/silabs/starter_kits/slstk3401a/doc/index.rst b/boards/silabs/starter_kits/slstk3401a/doc/index.rst index d1e41ade626af..0508a5894757b 100644 --- a/boards/silabs/starter_kits/slstk3401a/doc/index.rst +++ b/boards/silabs/starter_kits/slstk3401a/doc/index.rst @@ -1,7 +1,4 @@ -.. _slstk3401a: - -EFM32 Pearl Gecko (SLSTK3401A) -############################## +.. zephyr:board:: slstk3401a Overview ******** @@ -10,12 +7,6 @@ The EFM32 Pearl Gecko Starter Kit SLSTK3401A contains an MCU from the EFM32PG family built on an ARM® Cortex®-M4F processor with excellent low power capabilities. -.. figure:: slstk3401a.jpg - :align: center - :alt: EFM32PG-SLSTK3401A - - EFM32PG-SLSTK3401A (image courtesy of Silicon Labs) - Hardware ******** diff --git a/boards/silabs/starter_kits/slstk3402a/doc/index.rst b/boards/silabs/starter_kits/slstk3402a/doc/index.rst index 4e5293ee08f1c..f0dbd560fb396 100644 --- a/boards/silabs/starter_kits/slstk3402a/doc/index.rst +++ b/boards/silabs/starter_kits/slstk3402a/doc/index.rst @@ -1,7 +1,4 @@ -.. _slstk3402a: - -EFM32 Pearl Gecko 12 (SLSTK3402A) -################################# +.. zephyr:board:: slstk3402a Overview ******** @@ -10,12 +7,6 @@ The EFM32 Pearl Gecko 12 Starter Kit SLSTK3402A contains an MCU from the EFM32PG family built on an ARM® Cortex®-M4F processor with excellent low power capabilities. -.. figure:: slstk3402a.jpg - :align: center - :alt: SLSTK3402A - - EFM32PG12 SLSTK3402A (image courtesy of Silicon Labs) - Hardware ******** diff --git a/boards/silabs/starter_kits/slstk3701a/doc/index.rst b/boards/silabs/starter_kits/slstk3701a/doc/index.rst index 6209984049eea..fcde5ddd21876 100644 --- a/boards/silabs/starter_kits/slstk3701a/doc/index.rst +++ b/boards/silabs/starter_kits/slstk3701a/doc/index.rst @@ -1,7 +1,4 @@ -.. _efm32gg_stk3701a: - -EFM32 Giant Gecko 11 (SLSTK3701A) -################################# +.. zephyr:board:: slstk3701a Overview ******** @@ -10,12 +7,6 @@ The EFM32 Giant Gecko Starter Kit SLSTK3701A contains an MCU from the EFM32GG Series 1 family built on an ARM® Cortex®-M4F processor with excellent low power capabilities. -.. figure:: slstk3701a.jpg - :align: center - :alt: EFM32GG11 SLSTK3701A - - EFM32GG11 SLSTK3701A (image courtesy of Silicon Labs) - Hardware ******** From ed7e6b103fe1e4a1e998d12b8785b49a1a900d8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 18:26:51 +0200 Subject: [PATCH 1604/4482] boards: longan: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Longan boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/sipeed/longan_nano/doc/index.rst | 9 +-------- samples/drivers/dac/README.rst | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/boards/sipeed/longan_nano/doc/index.rst b/boards/sipeed/longan_nano/doc/index.rst index 6150c2378cf81..49a52c00d6526 100644 --- a/boards/sipeed/longan_nano/doc/index.rst +++ b/boards/sipeed/longan_nano/doc/index.rst @@ -1,11 +1,4 @@ -.. _longan_nano: - -Sipeed Longan Nano -################## - -.. image:: img/longan_nano.jpg - :align: center - :alt: longan_nano +.. zephyr:board:: longan_nano Overview ******** diff --git a/samples/drivers/dac/README.rst b/samples/drivers/dac/README.rst index 34e3c36339a85..edfe9fa9101db 100644 --- a/samples/drivers/dac/README.rst +++ b/samples/drivers/dac/README.rst @@ -193,7 +193,7 @@ Bridge the JP23 to DAC with the jumper cap, then DAC output will available on JP Building and Running for Longan Nano and Longan Nano Lite ========================================================= The sample can be built and executed for the -:ref:`longan_nano` as follows: +:zephyr:board:`longan_nano` as follows: .. zephyr-app-commands:: :zephyr-app: samples/drivers/dac From 0af1a9946b78f731a19e3d0a99c928b01a79876b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 18:28:48 +0200 Subject: [PATCH 1605/4482] boards: snps: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Synopsis boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/snps/em_starterkit/doc/index.rst | 9 +-------- boards/snps/emsdp/doc/index.rst | 9 +-------- boards/snps/hsdk/doc/index.rst | 9 +-------- boards/snps/hsdk4xd/doc/index.rst | 11 ++--------- boards/snps/iotdk/doc/index.rst | 9 +-------- boards/snps/nsim/arc_classic/doc/index.rst | 5 +---- boards/snps/nsim/arc_v/doc/index.rst | 5 +---- doc/releases/release-notes-3.7.rst | 2 +- 8 files changed, 9 insertions(+), 50 deletions(-) diff --git a/boards/snps/em_starterkit/doc/index.rst b/boards/snps/em_starterkit/doc/index.rst index 1bca8bd69de4e..28434f1d71192 100644 --- a/boards/snps/em_starterkit/doc/index.rst +++ b/boards/snps/em_starterkit/doc/index.rst @@ -1,7 +1,4 @@ -.. _em_starterkit: - -DesignWare(R) ARC(R) EM Starter Kit -################################### +.. zephyr:board:: em_starterkit Overview ******** @@ -12,10 +9,6 @@ for the ARC EM Family of processors. The EM Family includes the EM4, EM6, EM5D, EM7D, EM9D, and EM11D cores. The Zephyr RTOS can be used with the EM Starter Kit. -.. image:: em_starterkit.jpg - :align: center - :alt: DesignWare(R) ARC(R) EM Starter Kit (synopsys.com) - The ARC EM Starter Kit consists of a hardware platform, including pre-installed FPGA images of different ARC EM processor configurations with peripherals. Documentation for this board can be found at `embARC website`_. diff --git a/boards/snps/emsdp/doc/index.rst b/boards/snps/emsdp/doc/index.rst index bad8a48e4bbb2..f300d3723cea2 100644 --- a/boards/snps/emsdp/doc/index.rst +++ b/boards/snps/emsdp/doc/index.rst @@ -1,7 +1,4 @@ -.. _emsdp: - -DesignWare(R) ARC(R) EM Software Development Platform -##################################################### +.. zephyr:board:: emsdp Overview ******** @@ -12,10 +9,6 @@ to accelerate software development and debug of ARC EM processors and subsystems a wide range of ultra-low power embedded applications such as IoT, sensor fusion, and voice applications. -.. image:: emsdp.jpg - :align: center - :alt: DesignWare(R) ARC(R) EM Software Development Platform (synopsys.com) - For details about the board, see: `DesignWare ARC EM Software Development Platform (EM SDP) `__ diff --git a/boards/snps/hsdk/doc/index.rst b/boards/snps/hsdk/doc/index.rst index 6bf82bce86555..f7d82a9866fb8 100644 --- a/boards/snps/hsdk/doc/index.rst +++ b/boards/snps/hsdk/doc/index.rst @@ -1,7 +1,4 @@ -.. _hsdk: - -DesignWare(R) ARC(R) HS Development Kit -######################################## +.. zephyr:board:: hsdk Overview ******** @@ -14,10 +11,6 @@ UART, I2S, ADC, PWM and GPIO. A Vivante GPU is also contained in the ARC Development System SoC. This allows developers to build and debug complex software on a comprehensive hardware platform -.. image:: hsdk.jpg - :align: center - :alt: DesignWare(R) ARC(R) HS Development Kit (synopsys.com) - For details about the board, see: `ARC HS Development Kit (HSDK) `__ diff --git a/boards/snps/hsdk4xd/doc/index.rst b/boards/snps/hsdk4xd/doc/index.rst index 96c8ae73370cd..0808b76ca6d1c 100644 --- a/boards/snps/hsdk4xd/doc/index.rst +++ b/boards/snps/hsdk4xd/doc/index.rst @@ -1,20 +1,13 @@ -.. _hsdk4xd: - -DesignWare(R) ARC(R) HS4x/HS4xD Development Kit -############################################### +.. zephyr:board:: hsdk4xd Overview ******** -The ARC HS4x/HS4xD Development Kit is the next revision of :ref:`Synopsys HSDK board `. +The ARC HS4x/HS4xD Development Kit is the next revision of :zephyr:board:`Synopsys HSDK board `. It includes a multicore ARC HS4xD-based chip that integrates a wide range of interfaces including Ethernet, HDMI, WiFi, Bluetooth, USB, SDIO, I2C, SPI, UART, I2S, ADC, PWM and GPIO, as well as a Think Silicon GPU. -.. image:: hsdk4xd.jpg - :align: center - :alt: DesignWare(R) ARC(R) HS4x/HS4xD Development Kit (synopsys.com) - For details about the board, see: `ARC HS4x/HS4xD Development Kit (HSDK4xD) `__ diff --git a/boards/snps/iotdk/doc/index.rst b/boards/snps/iotdk/doc/index.rst index 4b740ce6223e5..8176f51618d95 100644 --- a/boards/snps/iotdk/doc/index.rst +++ b/boards/snps/iotdk/doc/index.rst @@ -1,7 +1,4 @@ -.. _iotdk: - -DesignWare(R) ARC(R) IoT Development Kit -######################################## +.. zephyr:board:: iotdk Overview ******** @@ -14,10 +11,6 @@ implementation of the ARC Data Fusion IP Subsystem running at 144 MHz on SMIC's 55-nm ultra-low power process, and a rich set of peripherals commonly used in IoT designs such as USB, UART, SPI, I2C, PWM, SDIO, and ADCs. -.. image:: iotdk.jpg - :align: center - :alt: DesignWare(R) ARC(R)IoT Development Kit (synopsys.com) - For details about the board, see: `ARC IoT Development Kit (IoTDK) `__ diff --git a/boards/snps/nsim/arc_classic/doc/index.rst b/boards/snps/nsim/arc_classic/doc/index.rst index 5f4dd81f302a0..940d08f1b6378 100644 --- a/boards/snps/nsim/arc_classic/doc/index.rst +++ b/boards/snps/nsim/arc_classic/doc/index.rst @@ -1,7 +1,4 @@ -.. _nsim: - -DesignWare ARC nSIM and HAPS FPGA boards -######################################## +.. zephyr:board:: nsim Overview ******** diff --git a/boards/snps/nsim/arc_v/doc/index.rst b/boards/snps/nsim/arc_v/doc/index.rst index e863124f13767..e7b1a48f1bbe8 100644 --- a/boards/snps/nsim/arc_v/doc/index.rst +++ b/boards/snps/nsim/arc_v/doc/index.rst @@ -1,7 +1,4 @@ -.. _nsim_arc_v: - -DesignWare RISC-V nSIM and HAPS FPGA boards -########################################### +.. zephyr:board:: nsim_arc_v Overview ******** diff --git a/doc/releases/release-notes-3.7.rst b/doc/releases/release-notes-3.7.rst index 3410fa344d127..8b8af21c28570 100644 --- a/doc/releases/release-notes-3.7.rst +++ b/doc/releases/release-notes-3.7.rst @@ -421,7 +421,7 @@ Boards & SoC Support * Added support for :zephyr:board:`ST STM32L152CDISCOVERY board `: ``stm32l152c_disco``. * Added support for :zephyr:board:`ST STEVAL STWINBX1 Development kit `: ``steval_stwinbx1``. * Added support for NXP boards: ``frdm_mcxn947``, ``ke17z512``, ``rd_rw612_bga``, ``frdm_rw612``, ``frdm_ke15z``, ``frdm_ke17z`` - * Added support for :ref:`Synopsys ARC-V RMX1xx nSIM-based simulation platform `: ``nsim_arc_v/rmx100``. + * Added support for :zephyr:board:`Synopsys ARC-V RMX1xx nSIM-based simulation platform `: ``nsim_arc_v/rmx100``. * Added support for :zephyr:board:`Analog Devices MAX32690EVKIT `: ``max32690evkit``. * Added support for :zephyr:board:`Analog Devices MAX32680EVKIT `: ``max32680evkit``. * Added support for :zephyr:board:`Analog Devices MAX32672EVKIT `: ``max32672evkit``. From 841f8a6a62b9e7f77bf90025384b69740f2067fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 18:31:01 +0200 Subject: [PATCH 1606/4482] boards: ti: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Texas Instruments boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/ti/cc1352p1_launchxl/doc/index.rst | 12 +----------- boards/ti/cc1352p7_launchpad/doc/index.rst | 11 +---------- boards/ti/cc1352r1_launchxl/doc/index.rst | 11 +---------- boards/ti/cc1352r_sensortag/doc/index.rst | 11 +---------- boards/ti/cc26x2r1_launchxl/doc/index.rst | 11 +---------- boards/ti/cc3220sf_launchxl/doc/index.rst | 5 +---- boards/ti/cc3235sf_launchxl/doc/index.rst | 5 +---- boards/ti/msp_exp432p401r_launchxl/doc/index.rst | 9 +-------- boards/ti/sk_am62/doc/index.rst | 11 +---------- samples/net/mqtt_publisher/README.rst | 2 +- samples/net/sockets/echo/README.rst | 2 +- 11 files changed, 11 insertions(+), 79 deletions(-) diff --git a/boards/ti/cc1352p1_launchxl/doc/index.rst b/boards/ti/cc1352p1_launchxl/doc/index.rst index b751b357307b3..dc807f559424a 100644 --- a/boards/ti/cc1352p1_launchxl/doc/index.rst +++ b/boards/ti/cc1352p1_launchxl/doc/index.rst @@ -1,7 +1,4 @@ -.. _cc1352p1_launchxl: - -CC1352P1 LaunchXL -################# +.. zephyr:board:: cc1352p1_launchxl Overview ******** @@ -11,13 +8,6 @@ development kit for the SimpleLink |trade| multi-Standard CC1352P wireless MCU. See the `TI CC1352P LaunchPad Product Page`_ for details. -.. figure:: img/cc1352p1_launchxl.jpg - :width: 400px - :align: center - :alt: TI CC1352P1 LaunchPad - - Texas Instruments CC1352P1 LaunchPad |trade| - Hardware ******** diff --git a/boards/ti/cc1352p7_launchpad/doc/index.rst b/boards/ti/cc1352p7_launchpad/doc/index.rst index aa2c28cb2c45e..6ad90f18e8679 100644 --- a/boards/ti/cc1352p7_launchpad/doc/index.rst +++ b/boards/ti/cc1352p7_launchpad/doc/index.rst @@ -1,7 +1,4 @@ -.. _cc1352p7_lp: - -CC1352P7 LaunchPad -################## +.. zephyr:board:: cc1352p7_lp Overview ******** @@ -11,12 +8,6 @@ development kit for the SimpleLink |trade| multi-Standard CC1352P7 wireless MCU. See the `TI CC1352P7 LaunchPad Product Page`_ for details. -.. figure:: img/lp-cc1352p7-top.jpg - :width: 400px - :align: center - :alt: TI CC1352P7 LaunchPad - - Texas Instruments CC1352P7 LaunchPad |trade| Hardware ******** diff --git a/boards/ti/cc1352r1_launchxl/doc/index.rst b/boards/ti/cc1352r1_launchxl/doc/index.rst index 2e7ed0ae2ff37..a908e1ceccc02 100644 --- a/boards/ti/cc1352r1_launchxl/doc/index.rst +++ b/boards/ti/cc1352r1_launchxl/doc/index.rst @@ -1,7 +1,4 @@ -.. _cc1352r1_launchxl: - -CC1352R1 LaunchXL -################# +.. zephyr:board:: cc1352r1_launchxl Overview ******** @@ -11,12 +8,6 @@ development kit for the SimpleLink |trade| multi-Standard CC1352R wireless MCU. See the `TI CC1352R LaunchPad Product Page`_ for details. -.. figure:: img/cc1352r1_launchxl.jpg - :align: center - :alt: TI CC1352R LaunchPad - - Texas Instruments CC1352R LaunchPad |trade| - Hardware ******** diff --git a/boards/ti/cc1352r_sensortag/doc/index.rst b/boards/ti/cc1352r_sensortag/doc/index.rst index 4120f4934df83..f31c744b7b7b6 100644 --- a/boards/ti/cc1352r_sensortag/doc/index.rst +++ b/boards/ti/cc1352r_sensortag/doc/index.rst @@ -1,7 +1,4 @@ -.. _cc1352r_sensortag: - -CC1352R SensorTag -################# +.. zephyr:board:: cc1352r_sensortag Overview ******** @@ -11,12 +8,6 @@ development kit for the SimpleLink |trade| multi-Standard CC1352R wireless MCU. See the `TI CC1352R SensorTag Product Page`_ for details. -.. figure:: img/cc1352r_sensortag.jpg - :align: center - :alt: TI CC1352R SensorTag - - Texas Instruments CC1352R SensorTag |trade| - Hardware ******** diff --git a/boards/ti/cc26x2r1_launchxl/doc/index.rst b/boards/ti/cc26x2r1_launchxl/doc/index.rst index 1f6a02d92ddf1..c08b2b9a933ca 100644 --- a/boards/ti/cc26x2r1_launchxl/doc/index.rst +++ b/boards/ti/cc26x2r1_launchxl/doc/index.rst @@ -1,7 +1,4 @@ -.. _cc26x2r1_launchxl: - -CC26x2R1 LaunchXL -################# +.. zephyr:board:: cc26x2r1_launchxl Overview ******** @@ -11,12 +8,6 @@ development kit for the SimpleLink |trade| multi-Standard CC2652R wireless MCU. See the `TI CC26x2R LaunchPad Product Page`_ for details. -.. figure:: img/cc26x2r1_launchxl.jpg - :align: center - :alt: TI CC26x2R LaunchPad - - Texas Instruments CC26x2R LaunchPad |trade| - Hardware ******** diff --git a/boards/ti/cc3220sf_launchxl/doc/index.rst b/boards/ti/cc3220sf_launchxl/doc/index.rst index cc14840d99959..63952bd4351b8 100644 --- a/boards/ti/cc3220sf_launchxl/doc/index.rst +++ b/boards/ti/cc3220sf_launchxl/doc/index.rst @@ -1,7 +1,4 @@ -.. _cc3220sf_launchxl: - -CC3220SF LaunchXL -################# +.. zephyr:board:: cc3220sf_launchxl Overview ******** diff --git a/boards/ti/cc3235sf_launchxl/doc/index.rst b/boards/ti/cc3235sf_launchxl/doc/index.rst index edaabf082eac0..5ddf5930d0d73 100644 --- a/boards/ti/cc3235sf_launchxl/doc/index.rst +++ b/boards/ti/cc3235sf_launchxl/doc/index.rst @@ -1,7 +1,4 @@ -.. _cc3235sf_launchxl: - -CC3235SF LaunchXL -################# +.. zephyr:board:: cc3235sf_launchxl Overview ******** diff --git a/boards/ti/msp_exp432p401r_launchxl/doc/index.rst b/boards/ti/msp_exp432p401r_launchxl/doc/index.rst index 9baec99f0a998..7b0662d66221f 100644 --- a/boards/ti/msp_exp432p401r_launchxl/doc/index.rst +++ b/boards/ti/msp_exp432p401r_launchxl/doc/index.rst @@ -1,7 +1,4 @@ -.. _msp_exp432p401r_launchxl: - -MSP-EXP432P401R LaunchXL -######################## +.. zephyr:board:: msp_exp432p401r_launchxl Overview ******** @@ -11,10 +8,6 @@ module for the SimpleLink MSP432P401R microcontroller. It contains everything ne developing on the SimpleLink MSP432 low-power + performance ARM |reg| 32-bit Cortex |reg|-M4F microcontroller (MCU). -.. figure:: img/msp_exp432p401r_launchxl.jpg - :align: center - :alt: MSP-EXP432P401R LaunchXL development board - Features: ========= diff --git a/boards/ti/sk_am62/doc/index.rst b/boards/ti/sk_am62/doc/index.rst index 60252c236ebde..5e6cab8439f7e 100644 --- a/boards/ti/sk_am62/doc/index.rst +++ b/boards/ti/sk_am62/doc/index.rst @@ -1,7 +1,4 @@ -.. _sk_am62: - -SK-AM62 M4F Core -################ +.. zephyr:board:: sk_am62 Overview ******** @@ -17,12 +14,6 @@ The board configuration also enables support for the semihosting debugging conso See the `TI AM62X Product Page`_ for details. -.. figure:: img/sk_am62_angled.webp - :align: center - :alt: TI SK-AM62 EVM - - Texas Instruments SK-AM62 EVM - Hardware ******** The SK-AM62 EVM features the AM62x SoC, which is composed of a quad Cortex-A53 diff --git a/samples/net/mqtt_publisher/README.rst b/samples/net/mqtt_publisher/README.rst index 081d3a3262591..d94bb9708fbf1 100644 --- a/samples/net/mqtt_publisher/README.rst +++ b/samples/net/mqtt_publisher/README.rst @@ -217,7 +217,7 @@ In addition, TLS_SNI_HOSTNAME in main.c should be defined to match the Common Name (CN) in the certificate file in order for the TLS domain name verification to succeed. -See the note on Provisioning and Fast Connect in :ref:`cc3220sf_launchxl`. +See the note on Provisioning and Fast Connect in :zephyr:board:`cc3220sf_launchxl`. The Secure Socket Offload section has information on programming the certificate to flash. diff --git a/samples/net/sockets/echo/README.rst b/samples/net/sockets/echo/README.rst index ca49115fd5d88..1867c46657731 100644 --- a/samples/net/sockets/echo/README.rst +++ b/samples/net/sockets/echo/README.rst @@ -76,7 +76,7 @@ version. Running on cc3220sf_launchxl ============================ -See the note on Provisioning and Fast Connect in :ref:`cc3220sf_launchxl`. +See the note on Provisioning and Fast Connect in :zephyr:board:`cc3220sf_launchxl`. After having connected to an Access Point using the sample Wi-Fi shell, the IP address will be printed to the console upon running this echo From 0df51eaf10d6ecae2d56959bc8dc41d54766b017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 18:35:00 +0200 Subject: [PATCH 1607/4482] boards: segger: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Segger boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/segger/ip_k66f/doc/index.rst | 9 +-------- boards/segger/trb_stm32f407/doc/index.rst | 11 +---------- samples/net/dsa/README.rst | 2 +- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/boards/segger/ip_k66f/doc/index.rst b/boards/segger/ip_k66f/doc/index.rst index 1d081835cc821..902802eb6d320 100644 --- a/boards/segger/ip_k66f/doc/index.rst +++ b/boards/segger/ip_k66f/doc/index.rst @@ -1,7 +1,4 @@ -.. _ip_k66f: - -SEGGER IP Switch Board -###################### +.. zephyr:board:: ip_k66f Overview ******** @@ -13,10 +10,6 @@ Ethernet switch with Gigabit RGMII/MII/RMII interface. - KSZ8794CNX enables evaluation for switch functions - On-board debug probe J-Link-OB for programming -.. image:: ip_k66f.jpg - :align: center - :alt: IP-K66F - Hardware ******** diff --git a/boards/segger/trb_stm32f407/doc/index.rst b/boards/segger/trb_stm32f407/doc/index.rst index 24c8f8df6d855..0b90123c411ac 100644 --- a/boards/segger/trb_stm32f407/doc/index.rst +++ b/boards/segger/trb_stm32f407/doc/index.rst @@ -1,7 +1,4 @@ -.. _segger_trb_stm32f407: - -Cortex-M Trace Reference Board V1.2 -################################### +.. zephyr:board:: segger_trb_stm32f407 Overview ******** @@ -12,12 +9,6 @@ ARM Cortex-M4 CPU, to test hardware tracing with the SEGGER Trace-Pro debuggers. It is not meant for general prototype development because it is extremely limited when it comes to IO, and only has 3 LEDs. -.. figure:: img/segger_trb_stm32f407.jpg - :align: center - :alt: SEGGER-TRB-STM32F407 - - SEGGER-TRB-STM32F407 - Hardware ******** diff --git a/samples/net/dsa/README.rst b/samples/net/dsa/README.rst index 729aac7785e98..72dd7071f17d1 100644 --- a/samples/net/dsa/README.rst +++ b/samples/net/dsa/README.rst @@ -20,7 +20,7 @@ Requirements Building and Running ******************** -Host machine with :ref:`ip_k66f` board from Segger. +Host machine with :zephyr:board:`ip_k66f` board from Segger. Follow these steps to build the DSA sample application: From 5aa80dfae6ddc4f01487cb3b284fa384e6414f7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Fri, 18 Oct 2024 18:35:46 +0200 Subject: [PATCH 1608/4482] boards: renode: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Renode boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/renode/cortex_r8_virtual/doc/index.rst | 5 +---- boards/renode/riscv32_virtual/doc/index.rst | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/boards/renode/cortex_r8_virtual/doc/index.rst b/boards/renode/cortex_r8_virtual/doc/index.rst index 07a18a7765074..8691724fceaf2 100644 --- a/boards/renode/cortex_r8_virtual/doc/index.rst +++ b/boards/renode/cortex_r8_virtual/doc/index.rst @@ -1,7 +1,4 @@ -.. _cortex_r8_virtual: - -Cortex-R8 Virtual -################# +.. zephyr:board:: cortex_r8_virtual Overview ******** diff --git a/boards/renode/riscv32_virtual/doc/index.rst b/boards/renode/riscv32_virtual/doc/index.rst index a53384f533197..478260d268955 100644 --- a/boards/renode/riscv32_virtual/doc/index.rst +++ b/boards/renode/riscv32_virtual/doc/index.rst @@ -1,7 +1,4 @@ -.. _riscv32-virtual: - -RISCV32 Virtual -############### +.. zephyr:board:: riscv32_virtual Overview ******** From 77163e0eff9e0421da7ce67ef30b650432d0f485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 11:53:24 +0200 Subject: [PATCH 1609/4482] boards: kincony: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Kincony boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/kincony/kincony_kc868_a32/doc/index.rst | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/boards/kincony/kincony_kc868_a32/doc/index.rst b/boards/kincony/kincony_kc868_a32/doc/index.rst index 8c89d3de3715e..d88eec584c670 100644 --- a/boards/kincony/kincony_kc868_a32/doc/index.rst +++ b/boards/kincony/kincony_kc868_a32/doc/index.rst @@ -1,7 +1,4 @@ -.. _kincony_kc868_a32: - -KINCONY KC868-A32 -################# +.. zephyr:board:: kincony_kc868_a32 Overview ******** @@ -23,12 +20,6 @@ The features include the following: - RESET and DOWNLOAD buttons - Powered by 12V DC -.. figure:: img/kincony_kc868_a32.jpg - :align: center - :alt: KINCONCY-KC868-A32 - - KINCONCY-KC868-A32 - System requirements =================== From b67ed0b1d7ee98d4c5ba3548af175f2a54421f90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 12:00:56 +0200 Subject: [PATCH 1610/4482] boards: raytac: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Raytac boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/raytac/mdbt50q_db_33/doc/index.rst | 10 +--------- boards/raytac/mdbt50q_db_40/doc/index.rst | 10 +--------- boards/raytac/mdbt53_db_40/doc/index.rst | 12 +----------- boards/raytac/mdbt53v_db_40/doc/index.rst | 12 +----------- 4 files changed, 4 insertions(+), 40 deletions(-) diff --git a/boards/raytac/mdbt50q_db_33/doc/index.rst b/boards/raytac/mdbt50q_db_33/doc/index.rst index 8089b7b5e489b..fe10186965ed1 100644 --- a/boards/raytac/mdbt50q_db_33/doc/index.rst +++ b/boards/raytac/mdbt50q_db_33/doc/index.rst @@ -1,7 +1,4 @@ -.. _raytac_mdbt50q_db_33_nrf52833: - -Raytac MDBT50Q-DB-33 -#################### +.. zephyr:board:: raytac_mdbt50q_db_33 Overview ******** @@ -25,11 +22,6 @@ Nordic Semiconductor nRF52833 ARM Cortex-M4F CPU and the following devices: * :abbr:`USB (Universal Serial Bus)` * :abbr:`WDT (Watchdog Timer)` -.. figure:: img/mdbt50q_db_33.jpg - :width: 442px - :align: center - :alt: MDBT50Q-DB-33 - More information about the board can be found at the `MDBT50Q-DB-33 website`_. The `MDBT50Q-DB-33 Specification`_ contains the demo board's datasheet. The `MDBT50Q-DB-33 Schematic`_ contains the demo board's schematic. diff --git a/boards/raytac/mdbt50q_db_40/doc/index.rst b/boards/raytac/mdbt50q_db_40/doc/index.rst index 269b42bb9d583..5655d41e2294d 100644 --- a/boards/raytac/mdbt50q_db_40/doc/index.rst +++ b/boards/raytac/mdbt50q_db_40/doc/index.rst @@ -1,7 +1,4 @@ -.. _raytac_mdbt50q_db_40_nrf52840: - -Raytac MDBT50Q-DB-40 -#################### +.. zephyr:board:: raytac_mdbt50q_db_40 Overview ******** @@ -25,11 +22,6 @@ Nordic Semiconductor nRF52840 ARM Cortex-M4F CPU and the following devices: * :abbr:`USB (Universal Serial Bus)` * :abbr:`WDT (Watchdog Timer)` -.. figure:: img/mdbt50q_db_40.jpg - :width: 442px - :align: center - :alt: MDBT50Q-DB-40 - More information about the board can be found at the `MDBT50Q-DB-40 website`_. The `MDBT50Q-DB-40 Specification`_ contains the demo board's datasheet. The `MDBT50Q-DB-40 Schematic`_ contains the demo board's schematic. diff --git a/boards/raytac/mdbt53_db_40/doc/index.rst b/boards/raytac/mdbt53_db_40/doc/index.rst index ff7b7140378ef..a429f7b1881a9 100644 --- a/boards/raytac/mdbt53_db_40/doc/index.rst +++ b/boards/raytac/mdbt53_db_40/doc/index.rst @@ -1,7 +1,4 @@ -.. _raytac_mdbt53_db_40_nrf5340: - -Raytac MDBT53-DB-40 -################### +.. zephyr:board:: raytac_mdbt53_db_40 Overview ******** @@ -43,13 +40,6 @@ nRF5340 SoC provides support for the following devices: * :abbr:`UARTE (Universal asynchronous receiver-transmitter)` * :abbr:`WDT (Watchdog Timer)` -.. figure:: img/MDBT53-DB-40.jpg - :width: 442px - :align: center - :alt: MDBT53-DB-40 - - MDBT53-DB-40 (Credit: Raytac Corporation) - More information about the board can be found at the `MDBT53-DB-40 website`_. The `MDBT53-DB-40 Specification`_ contains the demo board's datasheet. The `MDBT53-DB-40 Schematic`_ contains the demo board's schematic. diff --git a/boards/raytac/mdbt53v_db_40/doc/index.rst b/boards/raytac/mdbt53v_db_40/doc/index.rst index 6df0362e831ee..834971e7c7db4 100644 --- a/boards/raytac/mdbt53v_db_40/doc/index.rst +++ b/boards/raytac/mdbt53v_db_40/doc/index.rst @@ -1,7 +1,4 @@ -.. _raytac_mdbt53v_db_40_nrf5340: - -Raytac MDBT53V-DB-40 -#################### +.. zephyr:board:: raytac_mdbt53v_db_40 Overview ******** @@ -42,13 +39,6 @@ nRF5340 SoC provides support for the following devices: * :abbr:`UARTE (Universal asynchronous receiver-transmitter)` * :abbr:`WDT (Watchdog Timer)` -.. figure:: img/MDBT53V-DB-40.jpg - :width: 442px - :align: center - :alt: MDBT53V-DB-40 - - MDBT53V-DB-40 (Credit: Raytac Corporation) - More information about the board can be found at the `MDBT53V-DB-40 website`_. The `MDBT53V-DB-40 Specification`_ contains the demo board's datasheet. The `MDBT53V-DB-40 Schematic`_ contains the demo board's schematic. From dc6c34918c06b00d4fb05f9a61f374a16d8084fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 12:04:54 +0200 Subject: [PATCH 1611/4482] boards: ebyte: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the EBYTE boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/ebyte/e73_tbb/doc/index.rst | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/boards/ebyte/e73_tbb/doc/index.rst b/boards/ebyte/e73_tbb/doc/index.rst index 7f18da86159a9..5d1327e322c7c 100644 --- a/boards/ebyte/e73_tbb/doc/index.rst +++ b/boards/ebyte/e73_tbb/doc/index.rst @@ -1,7 +1,4 @@ -.. _ebyte_e73_tbb_nrf52832: - -EBYTE E73-TBB -############# +.. zephyr:board:: ebyte_e73_tbb Overview ******** @@ -25,12 +22,6 @@ the following devices: * :abbr:`UART (Universal asynchronous receiver-transmitter)` * :abbr:`WDT (Watchdog Timer)` -.. figure:: img/ebyte_e73_tbb_nrf52832.jpg - :align: center - :alt: EBYTE E73-TBB - - EBYTE E73-TBB (Credit: EBYTE) - More information about the board can be found at the `E73-TBB website`_. The `Nordic Semiconductor Infocenter`_ contains the processor's information and the datasheet. From 0e9013b26113fcef6db6c60542ed652693d7bfd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 12:06:50 +0200 Subject: [PATCH 1612/4482] boards: croxel: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Croxel boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/croxel/croxel_cx1825/doc/index.rst | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/boards/croxel/croxel_cx1825/doc/index.rst b/boards/croxel/croxel_cx1825/doc/index.rst index c2dc41220b7c0..ab88c4dd4321d 100644 --- a/boards/croxel/croxel_cx1825/doc/index.rst +++ b/boards/croxel/croxel_cx1825/doc/index.rst @@ -1,7 +1,4 @@ -.. _croxel_cx1825_nrf52840: - -CX1825 nRF52840 -############### +.. zephyr:board:: croxel_cx1825 Overview ******** @@ -24,12 +21,6 @@ Semiconductor nRF52840 ARM Cortex-M4F CPU and the following devices: * :abbr:`USB (Universal Serial Bus)` * :abbr:`WDT (Watchdog Timer)` -.. figure:: img/cx1825_nrf52840.jpg - :align: center - :alt: CX1825 - - Croxel's CX1825 Bluetooth Prototyping board (Credit: Croxel) - Hardware ******** From 47ca8b2782186fd242096bb0fcd627f219475af4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 12:08:54 +0200 Subject: [PATCH 1613/4482] boards: gaisler: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Gaisler boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/gaisler/generic_leon3/doc/index.rst | 5 +---- boards/gaisler/gr716a_mini/doc/index.rst | 11 +---------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/boards/gaisler/generic_leon3/doc/index.rst b/boards/gaisler/generic_leon3/doc/index.rst index 9ab9c897ce866..9f7781f3e2119 100644 --- a/boards/gaisler/generic_leon3/doc/index.rst +++ b/boards/gaisler/generic_leon3/doc/index.rst @@ -1,7 +1,4 @@ -.. _generic_leon3: - -Generic LEON3 -############# +.. zephyr:board:: generic_leon3 Overview ******** diff --git a/boards/gaisler/gr716a_mini/doc/index.rst b/boards/gaisler/gr716a_mini/doc/index.rst index c09374996e765..0f72330610554 100644 --- a/boards/gaisler/gr716a_mini/doc/index.rst +++ b/boards/gaisler/gr716a_mini/doc/index.rst @@ -1,7 +1,4 @@ -.. _gr716a_mini: - -GR716-MINI Development Board -############################ +.. zephyr:board:: gr716a_mini Overview ******** @@ -16,12 +13,6 @@ The GR716-MINI development board provides: * 4x MMCX connectors (2 ADC, 2 DAC) * Miniature 80 pin mezzanine connector (bottom side) -.. figure:: gr716a_mini.jpg - :align: center - :alt: GR716-MINI Development Board - - GR716-MINI Development Board (Credit: Cobham Gaisler AB) - Hardware ******** From 3b7e9175ecc3badf70f79ac26f43efbab7a270f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 12:29:59 +0200 Subject: [PATCH 1614/4482] boards: khadas: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Khadas boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/khadas/edgev/doc/index.rst | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/boards/khadas/edgev/doc/index.rst b/boards/khadas/edgev/doc/index.rst index c6c3e44826a6a..82294c07e994c 100644 --- a/boards/khadas/edgev/doc/index.rst +++ b/boards/khadas/edgev/doc/index.rst @@ -1,7 +1,4 @@ -.. _khadas_edgev: - -Khadas Edge-V -################################# +.. zephyr:board:: khadas_edgev Overview ******** From 11e2be4a1b712ae7c420526090ab9390d8099e5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 12:35:19 +0200 Subject: [PATCH 1615/4482] boards: ronoth: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Ronoth boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- .../lodev/doc/img/{lodev.jpg => ronoth_lodev.jpg} | Bin boards/ronoth/lodev/doc/index.rst | 11 +---------- 2 files changed, 1 insertion(+), 10 deletions(-) rename boards/ronoth/lodev/doc/img/{lodev.jpg => ronoth_lodev.jpg} (100%) diff --git a/boards/ronoth/lodev/doc/img/lodev.jpg b/boards/ronoth/lodev/doc/img/ronoth_lodev.jpg similarity index 100% rename from boards/ronoth/lodev/doc/img/lodev.jpg rename to boards/ronoth/lodev/doc/img/ronoth_lodev.jpg diff --git a/boards/ronoth/lodev/doc/index.rst b/boards/ronoth/lodev/doc/index.rst index 58f0756ecb30f..bce64d4faa130 100644 --- a/boards/ronoth/lodev/doc/index.rst +++ b/boards/ronoth/lodev/doc/index.rst @@ -1,7 +1,4 @@ -.. _ronoth_lodev: - -Ronoth LoDev -############ +.. zephyr:board:: ronoth_lodev ======== Overview @@ -16,12 +13,6 @@ and a +20 dBm power amplifier. Refer to `AcSIP S76S Product Information Brief`_ Zephyr applications may use the **ronoth_lodev** configuration to run on this board. -.. figure:: img/lodev.jpg - :align: center - :alt: Image of Ronoth LoDev open source development board containing S76S system on a chip - - Ronoth LoDev - `Board design files`_ are available on GitHub. ================ From 3835f9ceafb18ef0600d51d776cd58965fd3f28a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 14:37:35 +0200 Subject: [PATCH 1616/4482] boards: firefly: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Firefly boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/firefly/roc_rk3568_pc/doc/index.rst | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/boards/firefly/roc_rk3568_pc/doc/index.rst b/boards/firefly/roc_rk3568_pc/doc/index.rst index 4da6df1023aed..bd55e747c5197 100644 --- a/boards/firefly/roc_rk3568_pc/doc/index.rst +++ b/boards/firefly/roc_rk3568_pc/doc/index.rst @@ -1,7 +1,4 @@ -.. _roc_rk3568_pc: - -Firefly ROC-RK3568-PC (Quad-core Cortex-A55) -############################################ +.. zephyr:board:: roc_rk3568_pc Overview ******** From aa2082142aa5adafcfbfc3e22ebc84e89e42397f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 14:38:14 +0200 Subject: [PATCH 1617/4482] boards: qorvo: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Qorvo boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/qorvo/decawave_dwm1001_dev/doc/index.rst | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/boards/qorvo/decawave_dwm1001_dev/doc/index.rst b/boards/qorvo/decawave_dwm1001_dev/doc/index.rst index 93966edb73990..491851f3075e2 100644 --- a/boards/qorvo/decawave_dwm1001_dev/doc/index.rst +++ b/boards/qorvo/decawave_dwm1001_dev/doc/index.rst @@ -1,7 +1,4 @@ -.. _decawave_dwm1001_dev: - -Decawave DWM1001 -################# +.. zephyr:board:: decawave_dwm1001_dev Overview ******** From 41066b5f73d2a82e70a18a12fc83ef11fe939542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 14:38:55 +0200 Subject: [PATCH 1618/4482] boards: seco: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the SECO boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/seco/stm32f3_seco_d23/doc/index.rst | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/boards/seco/stm32f3_seco_d23/doc/index.rst b/boards/seco/stm32f3_seco_d23/doc/index.rst index bc2626767f059..03e0bf82586bd 100644 --- a/boards/seco/stm32f3_seco_d23/doc/index.rst +++ b/boards/seco/stm32f3_seco_d23/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32f3_seco_d23_board: - -SECO SBC-3.5-PX30 (JUNO - D23) (STM32F302) -########################################## +.. zephyr:board:: stm32f3_seco_d23 Overview ******** @@ -21,13 +18,6 @@ The audio functionalities are managed by the AudioCodec embedded in the RK-809 PMIC. SBC-3.5-PX30 board is completed by a series of connectors with various interfaces (UART, SPI, I2C) managed by the microcontroller STM32F302VCT6. -.. image:: img/stm32f3_seco_d23.jpg - :align: center - :alt: SECO SBC-3.5-PX30 - -More information about the board can be found at the -`SECO SBC-3.5-PX30 website`_. - Hardware ******** From f5e3535759f360bc01e3e942fa95c67483a892ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 14:39:44 +0200 Subject: [PATCH 1619/4482] boards: sc: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Space Cubics boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/sc/scobc_module1/doc/index.rst | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/boards/sc/scobc_module1/doc/index.rst b/boards/sc/scobc_module1/doc/index.rst index 260a062692f97..52e8000b1b89a 100644 --- a/boards/sc/scobc_module1/doc/index.rst +++ b/boards/sc/scobc_module1/doc/index.rst @@ -1,7 +1,4 @@ -.. _scobc_module1: - -Space Cubics OBC module 1 -######################### +.. zephyr:board:: scobc_module1 Overview ******** @@ -10,12 +7,6 @@ Overview especially for 3U CubeSats. The board is based on Xilinx Artix-7 FPGA and implements ARM Cortex M3 as the main CPU. -.. figure:: scobc.jpg - :align: center - :alt: Space Cubics OBC module 1 - - Space Cubics OBC module 1 - It is designed to survive in the severe space environment, extreme temperature, vacuum, and space radiation. From 1a56594957144e2386e0954d548ca0b4da5613f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 14:45:11 +0200 Subject: [PATCH 1620/4482] boards: dptechnics: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the DPTechnics boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/dptechnics/walter/doc/index.rst | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/boards/dptechnics/walter/doc/index.rst b/boards/dptechnics/walter/doc/index.rst index bb8d9eecbf530..c77e266f52be1 100644 --- a/boards/dptechnics/walter/doc/index.rst +++ b/boards/dptechnics/walter/doc/index.rst @@ -1,7 +1,4 @@ -.. _walter: - -DPTechnics Walter -################# +.. zephyr:board:: walter Overview ******** @@ -11,12 +8,6 @@ with a Sequans Monarch 2 GM02SP LTE-M/NB-IoT/GNSS modem. More information about Walter can be found on the `QuickSpot Website`_ and on the `QuickSpot GitHub page`_. -.. figure:: img/walter.webp - :align: center - :alt: DPTechnics Walter board - - DPTechnics Walter board (Credit: DPTechnics bv) - Hardware ******** From 834c3878ca628705b83f4e3cbf52f4b11b3455d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 14:52:50 +0200 Subject: [PATCH 1621/4482] boards: raspberrypi: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Rasperry Pi boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/raspberrypi/rpi_4b/doc/index.rst | 5 +---- boards/raspberrypi/rpi_5/doc/index.rst | 5 +---- boards/raspberrypi/rpi_pico/doc/index.rst | 5 +---- doc/releases/release-notes-3.7.rst | 2 +- samples/sensor/bme280/README.rst | 2 +- 5 files changed, 5 insertions(+), 14 deletions(-) diff --git a/boards/raspberrypi/rpi_4b/doc/index.rst b/boards/raspberrypi/rpi_4b/doc/index.rst index 6f840ec55e590..88862cf7f9fbc 100644 --- a/boards/raspberrypi/rpi_4b/doc/index.rst +++ b/boards/raspberrypi/rpi_4b/doc/index.rst @@ -1,7 +1,4 @@ -.. rpi_4b: - -Raspberry Pi 4 Model B (Cortex-A72) -################################### +.. zephyr:board:: rpi_4b Overview ******** diff --git a/boards/raspberrypi/rpi_5/doc/index.rst b/boards/raspberrypi/rpi_5/doc/index.rst index fd0ad27df0a44..ea3b3c4243a96 100644 --- a/boards/raspberrypi/rpi_5/doc/index.rst +++ b/boards/raspberrypi/rpi_5/doc/index.rst @@ -1,7 +1,4 @@ -.. _rpi_5: - -Raspberry Pi 5 (Cortex-A76) -########################### +.. zephyr:board:: rpi_5 Overview ******** diff --git a/boards/raspberrypi/rpi_pico/doc/index.rst b/boards/raspberrypi/rpi_pico/doc/index.rst index b2af4693b01ab..47ce4401f66bf 100644 --- a/boards/raspberrypi/rpi_pico/doc/index.rst +++ b/boards/raspberrypi/rpi_pico/doc/index.rst @@ -1,7 +1,4 @@ -.. _rpi_pico: - -Raspberry Pi Pico -################# +.. zephyr:board:: rpi_pico Overview ******** diff --git a/doc/releases/release-notes-3.7.rst b/doc/releases/release-notes-3.7.rst index 8b8af21c28570..d47ad1613802f 100644 --- a/doc/releases/release-notes-3.7.rst +++ b/doc/releases/release-notes-3.7.rst @@ -409,7 +409,7 @@ Boards & SoC Support * Added support for :zephyr:board:`Ambiq Apollo3 Blue board `: ``apollo3_evb``. * Added support for :zephyr:board:`Ambiq Apollo3 Blue Plus board `: ``apollo3p_evb``. - * Added support for :ref:`Raspberry Pi 5 board `: ``rpi_5``. + * Added support for :zephyr:board:`Raspberry Pi 5 board `: ``rpi_5``. * Added support for :zephyr:board:`Seeed Studio XIAO RP2040 board `: ``xiao_rp2040``. * Added support for :zephyr:board:`Mikroe RA4M1 Clicker board `: ``mikroe_clicker_ra4m1``. * Added support for :ref:`Arduino UNO R4 WiFi board `: ``arduino_uno_r4_wifi``. diff --git a/samples/sensor/bme280/README.rst b/samples/sensor/bme280/README.rst index 9226ac34d059a..90390d6db167e 100644 --- a/samples/sensor/bme280/README.rst +++ b/samples/sensor/bme280/README.rst @@ -77,7 +77,7 @@ peripheral. BME280 via Raspberry Pi Pico ============================ -The default assignment of the built-in spi0 device on the :ref:`rpi_pico` is +The default assignment of the built-in spi0 device on the :zephyr:board:`rpi_pico` is to GPIO16 through GPIO19. With the sensor wired to those lines, build and flash with: From 3e0bf34a9475146c7aca7abdc22837ec150fdea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 14:54:22 +0200 Subject: [PATCH 1622/4482] boards: contextualelectronics: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Contextual Electronics boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/contextualelectronics/abc/doc/index.rst | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/boards/contextualelectronics/abc/doc/index.rst b/boards/contextualelectronics/abc/doc/index.rst index dd8aa8acfb033..d7f12bc4738cd 100644 --- a/boards/contextualelectronics/abc/doc/index.rst +++ b/boards/contextualelectronics/abc/doc/index.rst @@ -1,7 +1,4 @@ -.. _contextualelectronics_abc: - -Contextual Electronics Advanced BLE Cell -######################################## +.. zephyr:board:: contextualelectronics_abc Overview ******** @@ -21,12 +18,6 @@ Nordic Semiconductor nRF52840 ARM Cortex-M4F CPU and the following devices: * :abbr:`UART (Universal asynchronous receiver-transmitter)` * Quectel BG95 Modem -.. figure:: img/contextualelectronics_abc.jpg - :align: center - :alt: Contextual Electronics Advanced BLE Cell - - Contextual Electronics Advanced BLE Cell (Credit: Chris Gamell) - More information about the board can be found at the `ABC Board website`_. The `Nordic Semiconductor Infocenter`_ contains the processor's information and the datasheet. From dc271263d4e69f701907f0eabc746b637dd5d3ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 15:09:36 +0200 Subject: [PATCH 1623/4482] boards: others: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the "others" boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/others/black_f407ve/doc/index.rst | 9 +-------- boards/others/black_f407zg_pro/doc/index.rst | 9 +-------- boards/others/icev_wireless/doc/index.rst | 11 +---------- boards/others/neorv32/doc/index.rst | 5 +---- boards/others/serpente/doc/index.rst | 9 +-------- boards/others/stm32_min_dev/doc/index.rst | 11 +---------- boards/others/stm32f030_demo/doc/index.rst | 9 +-------- boards/others/stm32f103_mini/doc/index.rst | 5 +---- boards/others/stm32f401_mini/doc/index.rst | 9 +-------- 9 files changed, 9 insertions(+), 68 deletions(-) diff --git a/boards/others/black_f407ve/doc/index.rst b/boards/others/black_f407ve/doc/index.rst index cffdd4d41be4d..f6f088b399840 100644 --- a/boards/others/black_f407ve/doc/index.rst +++ b/boards/others/black_f407ve/doc/index.rst @@ -1,7 +1,4 @@ -.. _black_f407ve_board: - -Black STM32 F407VE Development Board -#################################### +.. zephyr:board:: black_f407ve Overview ******** @@ -27,10 +24,6 @@ Here are some highlights of the BLACK_F407VE board: - Four push-buttons: RESET, K0, K1 and WK_UP - Mini-AB connector -.. image:: img/black_f407ve.jpg - :align: center - :alt: BLACK_F407VE - See also board descriptions at `STM32-base website`_, `STM32F407VET6 black board`_ and `MCUDev Black STM32F407VET6`_ diff --git a/boards/others/black_f407zg_pro/doc/index.rst b/boards/others/black_f407zg_pro/doc/index.rst index 4857e8bb8da57..ec7e6313c105f 100644 --- a/boards/others/black_f407zg_pro/doc/index.rst +++ b/boards/others/black_f407zg_pro/doc/index.rst @@ -1,7 +1,4 @@ -.. _black_f407zg_pro_board: - -Black STM32 F407ZG Pro Development Board -######################################## +.. zephyr:board:: black_f407zg_pro Overview ******** @@ -27,10 +24,6 @@ Here are some highlights of the BLACK_F407ZG_PRO board: - Four push-buttons: RESET, K0, K1 and WK_UP - Mini-AB connector -.. image:: img/black_f407zg_pro.jpg - :align: center - :alt: BLACK_F407ZG_PRO - .. warning:: The +5V pins on this board are directly connected to the +5V pin of the USB connector. There is no protection in place. Do not power this board through USB and an external power supply at diff --git a/boards/others/icev_wireless/doc/index.rst b/boards/others/icev_wireless/doc/index.rst index c699686caf31a..91c4ee1ff983e 100644 --- a/boards/others/icev_wireless/doc/index.rst +++ b/boards/others/icev_wireless/doc/index.rst @@ -1,7 +1,4 @@ -.. _icev_wireless: - -ICE-V Wireless -############## +.. zephyr:board:: icev_wireless Overview ******** @@ -10,12 +7,6 @@ The ICE-V Wireless is a combined ESP32C3 and iCE40 FPGA board. See the `ICE-V Wireless Github Project`_ for details. -.. figure:: img/icev_wireless.jpg - :align: center - :alt: ICE-V Wireless - - ICE-V Wireless - Hardware ******** diff --git a/boards/others/neorv32/doc/index.rst b/boards/others/neorv32/doc/index.rst index a2dedba0a76f7..066377bbf2541 100644 --- a/boards/others/neorv32/doc/index.rst +++ b/boards/others/neorv32/doc/index.rst @@ -1,7 +1,4 @@ -.. _neorv32: - -NEORV32 -####### +.. zephyr:board:: neorv32 Overview ******** diff --git a/boards/others/serpente/doc/index.rst b/boards/others/serpente/doc/index.rst index e7140707d74f1..0894427ff3e29 100644 --- a/boards/others/serpente/doc/index.rst +++ b/boards/others/serpente/doc/index.rst @@ -1,7 +1,4 @@ -.. _serpente: - -Arturo182 Serpente -################## +.. zephyr:board:: serpente Overview ******** @@ -11,10 +8,6 @@ board equipped with 4MiB flash storage, a PWM enabled RGB led and 6 I/O pins. The board comes with 3 different USB connector options: USB Type-C plug, USB Type-C socket and USB Type-A plug. -.. image:: img/serpente.jpg - :align: center - :alt: Serpente Boards - Hardware ******** diff --git a/boards/others/stm32_min_dev/doc/index.rst b/boards/others/stm32_min_dev/doc/index.rst index e27ea5c59f5af..29d5a75b27e9f 100644 --- a/boards/others/stm32_min_dev/doc/index.rst +++ b/boards/others/stm32_min_dev/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32_min_dev: - -STM32 Minimum Development Board -############################### +.. zephyr:board:: stm32_min_dev Overview ******** @@ -16,12 +13,6 @@ are two variants of the board: Zephyr applications can use the stm32_min_dev@blue or stm32_min_dev@black board configuration to use these boards. -.. figure:: img/stm32_min_dev.jpg - :align: center - :alt: STM32 Minimum Development Board - - STM32 Minimum Development Board - As the name suggests, these boards have the bare minimum components required to power on the CPU. For practical use, you'll need to add additional components and circuits using a breadboard, for example. diff --git a/boards/others/stm32f030_demo/doc/index.rst b/boards/others/stm32f030_demo/doc/index.rst index 8080f2b33d91d..84d619b38b0ff 100644 --- a/boards/others/stm32f030_demo/doc/index.rst +++ b/boards/others/stm32f030_demo/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32f030_demo: - -STM32F030 DEMO BOARD -#################### +.. zephyr:board:: stm32f030_demo This board has the bare minimum components required to power on the STM32F030F4P6 MCU. Most of the GPIOs on the STM32 SoC have @@ -11,10 +8,6 @@ that match the SoC's pin names. For practical use, you'll need to add additional components and circuits using a breadboard, for example. -.. image:: img/stm32f030_demo.jpg - :align: center - :alt: STM32F030 DEMO BOARD - More information about the board can be found at the `stm32-base.org website`_. More information about STM32F030F4P6 can be found here: diff --git a/boards/others/stm32f103_mini/doc/index.rst b/boards/others/stm32f103_mini/doc/index.rst index c6938020f99ef..c19ded8a82f11 100644 --- a/boards/others/stm32f103_mini/doc/index.rst +++ b/boards/others/stm32f103_mini/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32f103_mini_board: - -STM32F103 Mini -################ +.. zephyr:board:: stm32f103_mini Overview ******** diff --git a/boards/others/stm32f401_mini/doc/index.rst b/boards/others/stm32f401_mini/doc/index.rst index b24538f313757..5cfa267f7128b 100644 --- a/boards/others/stm32f401_mini/doc/index.rst +++ b/boards/others/stm32f401_mini/doc/index.rst @@ -1,7 +1,4 @@ -.. _stm32f401_mini: - -STM32 Mini F401 -############### +.. zephyr:board:: stm32f401_mini Overview ******** @@ -10,10 +7,6 @@ The STM32 Mini F401 is an extremely low cost and bare-bones development board featuring the STM32F401CC, see `STM32F401CC website`_. More info about the board with schematics available `here `_ -.. image:: img/STM32_Mini_F401-1.jpg - :align: center - :alt: STM32 Mini F401 - Hardware ******** From f2c2cc334d486ec613463774ac009df3982b3221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 15:18:26 +0200 Subject: [PATCH 1624/4482] boards: weact: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the WeAct boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/weact/blackpill_f401cc/doc/index.rst | 9 +-------- boards/weact/blackpill_f401ce/doc/index.rst | 9 +-------- boards/weact/blackpill_f411ce/doc/index.rst | 9 +-------- .../doc/img/{stm32h7xx.webp => mini_stm32h743.webp} | Bin boards/weact/mini_stm32h743/doc/index.rst | 11 +---------- boards/weact/stm32f405_core/doc/index.rst | 9 +-------- boards/weact/stm32g431_core/doc/index.rst | 5 +---- samples/drivers/video/capture_to_lvgl/README.rst | 2 +- samples/sensor/sgp40_sht4x/README.rst | 2 +- 9 files changed, 8 insertions(+), 48 deletions(-) rename boards/weact/mini_stm32h743/doc/img/{stm32h7xx.webp => mini_stm32h743.webp} (100%) diff --git a/boards/weact/blackpill_f401cc/doc/index.rst b/boards/weact/blackpill_f401cc/doc/index.rst index 79e30862e87ad..ff6ef271f700b 100644 --- a/boards/weact/blackpill_f401cc/doc/index.rst +++ b/boards/weact/blackpill_f401cc/doc/index.rst @@ -1,7 +1,4 @@ -.. _blackpill_f401cc: - -WeAct Studio Black Pill V1.2 -############################ +.. zephyr:board:: blackpill_f401cc Overview ******** @@ -12,10 +9,6 @@ This is the 48-pin variant of the STM32F401x series, see `STM32F401x reference manual`_. More info about the board available `here `_ and on `WeAct Github`_. -.. image:: img/blackpill-v3.jpg - :align: center - :alt: Black Pill V3.0+ - Hardware ******** diff --git a/boards/weact/blackpill_f401ce/doc/index.rst b/boards/weact/blackpill_f401ce/doc/index.rst index eb4983577ae13..aa81976e7d90d 100644 --- a/boards/weact/blackpill_f401ce/doc/index.rst +++ b/boards/weact/blackpill_f401ce/doc/index.rst @@ -1,7 +1,4 @@ -.. _blackpill_f401ce: - -WeAct Studio Black Pill V3.0 -############################ +.. zephyr:board:: blackpill_f401ce Overview ******** @@ -12,10 +9,6 @@ This is the 48-pin variant of the STM32F401x series, see `STM32F401x reference manual`_. More info about the board available `here `_ and on `WeAct Github`_. -.. image:: img/blackpill-v3.jpg - :align: center - :alt: Black Pill V3.0+ - Hardware ******** diff --git a/boards/weact/blackpill_f411ce/doc/index.rst b/boards/weact/blackpill_f411ce/doc/index.rst index f190d7ea64a0d..f045f331b8656 100644 --- a/boards/weact/blackpill_f411ce/doc/index.rst +++ b/boards/weact/blackpill_f411ce/doc/index.rst @@ -1,7 +1,4 @@ -.. _blackpill_f411ce: - -WeAct Studio Black Pill V2.0 -############################ +.. zephyr:board:: blackpill_f411ce Overview ******** @@ -12,10 +9,6 @@ This is the 48-pin variant of the STM32F411x series, see `STM32F411x reference manual`_. More info about the board available `here `_ and on `WeAct Github`_. -.. image:: img/blackpill-v2.jpg - :align: center - :alt: Black Pill V2.0+ - Hardware ******** diff --git a/boards/weact/mini_stm32h743/doc/img/stm32h7xx.webp b/boards/weact/mini_stm32h743/doc/img/mini_stm32h743.webp similarity index 100% rename from boards/weact/mini_stm32h743/doc/img/stm32h7xx.webp rename to boards/weact/mini_stm32h743/doc/img/mini_stm32h743.webp diff --git a/boards/weact/mini_stm32h743/doc/index.rst b/boards/weact/mini_stm32h743/doc/index.rst index 1b71f8a17c2fc..9dc96700d5bc9 100644 --- a/boards/weact/mini_stm32h743/doc/index.rst +++ b/boards/weact/mini_stm32h743/doc/index.rst @@ -1,7 +1,4 @@ -.. _mini_stm32h743: - -WeAct Studio MiniSTM32H743 Core Board -##################################### +.. zephyr:board:: mini_stm32h743 Overview ******** @@ -27,12 +24,6 @@ Key Features - SWD header for external debugger - 2x 40-pin GPIO connector -.. figure:: img/stm32h7xx.webp - :align: center - :alt: MiniSTM32H743 Core Board - - MiniSTM32H743 Core Board (Credit: WeAct Studio) - More information about the board can be found on the `Mini_STM32H743 website`_. Hardware diff --git a/boards/weact/stm32f405_core/doc/index.rst b/boards/weact/stm32f405_core/doc/index.rst index e08ec5cb78738..3afc69b79d01e 100644 --- a/boards/weact/stm32f405_core/doc/index.rst +++ b/boards/weact/stm32f405_core/doc/index.rst @@ -1,7 +1,4 @@ -.. _weact_stm32f405_core: - -WeAct Studio STM32F405 Core Board V1.0 -###################################### +.. zephyr:board:: weact_stm32f405_core Overview ******** @@ -12,10 +9,6 @@ This is the 64-pin variant of the STM32F405x series, see `STM32F405x reference manual`_. More info about the board available on `WeAct Github`_. -.. image:: img/stm32f405_core.jpg - :align: center - :alt: STM32F405 Core Board v1.0 - Hardware ******** diff --git a/boards/weact/stm32g431_core/doc/index.rst b/boards/weact/stm32g431_core/doc/index.rst index bf6f80009d502..862398794f60e 100644 --- a/boards/weact/stm32g431_core/doc/index.rst +++ b/boards/weact/stm32g431_core/doc/index.rst @@ -1,7 +1,4 @@ -.. _weact_stm32g431_core: - -WeAct Studio STM32G431 Core Board -################################# +.. zephyr:board:: weact_stm32g431_core The WeAct STM32G431 Core Board is a low-cost bare-bones STM32G431-based development board. See the `STM32G431CB website`_ for more information about the MCU. More information diff --git a/samples/drivers/video/capture_to_lvgl/README.rst b/samples/drivers/video/capture_to_lvgl/README.rst index 0d8a2a8152a2f..c63fb73f2fcd0 100644 --- a/samples/drivers/video/capture_to_lvgl/README.rst +++ b/samples/drivers/video/capture_to_lvgl/README.rst @@ -27,7 +27,7 @@ board to receive console output messages. Building and Running ******************** -For :ref:`mini_stm32h743`, build this sample application with the following commands: +For :zephyr:board:`mini_stm32h743`, build this sample application with the following commands: .. zephyr-app-commands:: :zephyr-app: samples/drivers/video/capture_to_lvgl/ diff --git a/samples/sensor/sgp40_sht4x/README.rst b/samples/sensor/sgp40_sht4x/README.rst index 326d3d1600be1..19bb5c7d976fa 100644 --- a/samples/sensor/sgp40_sht4x/README.rst +++ b/samples/sensor/sgp40_sht4x/README.rst @@ -42,7 +42,7 @@ Building and Running This project outputs sensor data to the console. It requires a SHT4X and a SGP40 sensor. It should work with any platform featuring a I2C peripheral interface. This example has an example device tree overlay -for the :ref:`blackpill_f411ce` board. +for the :zephyr:board:`blackpill_f411ce` board. .. zephyr-app-commands:: From bcfbcc00afc841d509539ccd4ccf451bfc5b89fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 15:24:59 +0200 Subject: [PATCH 1625/4482] boards: qemu: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Qemu boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/qemu/arc/doc/index.rst | 5 +---- boards/qemu/cortex_a53/doc/index.rst | 5 +---- boards/qemu/cortex_m0/doc/index.rst | 5 +---- boards/qemu/cortex_m3/doc/index.rst | 5 +---- boards/qemu/cortex_r5/doc/index.rst | 5 +---- boards/qemu/kvm_arm64/doc/index.rst | 5 +---- boards/qemu/leon3/doc/index.rst | 5 +---- boards/qemu/malta/doc/index.rst | 5 +---- boards/qemu/nios2/doc/index.rst | 5 +---- boards/qemu/riscv32/doc/index.rst | 5 +---- boards/qemu/riscv32_xip/doc/index.rst | 5 +---- boards/qemu/riscv32e/board.yml | 2 +- boards/qemu/riscv32e/doc/index.rst | 5 +---- boards/qemu/riscv64/doc/index.rst | 5 +---- boards/qemu/x86/doc/index.rst | 5 +---- boards/qemu/xtensa/doc/index.rst | 5 +---- doc/build/dts/howtos.rst | 3 ++- doc/connectivity/networking/api/gptp.rst | 2 +- doc/develop/west/build-flash-debug.rst | 4 ++-- doc/services/debugging/coredump.rst | 2 +- samples/subsys/llext/modules/README.rst | 4 ++-- 21 files changed, 24 insertions(+), 68 deletions(-) diff --git a/boards/qemu/arc/doc/index.rst b/boards/qemu/arc/doc/index.rst index 0aef5d8dc39bd..1c38701b22ee2 100644 --- a/boards/qemu/arc/doc/index.rst +++ b/boards/qemu/arc/doc/index.rst @@ -1,7 +1,4 @@ -.. _qemu_arc: - -ARCv2 & ARCv3 Emulation (QEMU) -############################### +.. zephyr:board:: qemu_arc Overview ******** diff --git a/boards/qemu/cortex_a53/doc/index.rst b/boards/qemu/cortex_a53/doc/index.rst index 424d6e5f874b6..d6e2e307b0926 100644 --- a/boards/qemu/cortex_a53/doc/index.rst +++ b/boards/qemu/cortex_a53/doc/index.rst @@ -1,7 +1,4 @@ -.. _qemu_cortex_a53: - -ARM Cortex-A53 Emulation (QEMU) -############################### +.. zephyr:board:: qemu_cortex_a53 Overview ******** diff --git a/boards/qemu/cortex_m0/doc/index.rst b/boards/qemu/cortex_m0/doc/index.rst index 7035f57b07f0a..e091ace42a7cd 100644 --- a/boards/qemu/cortex_m0/doc/index.rst +++ b/boards/qemu/cortex_m0/doc/index.rst @@ -1,7 +1,4 @@ -.. _qemu_cortex_m0: - -ARM Cortex-M0 Emulation (QEMU) -############################## +.. zephyr:board:: qemu_cortex_m0 Overview ******** diff --git a/boards/qemu/cortex_m3/doc/index.rst b/boards/qemu/cortex_m3/doc/index.rst index f07f6bf21669a..96eb19bc3753c 100644 --- a/boards/qemu/cortex_m3/doc/index.rst +++ b/boards/qemu/cortex_m3/doc/index.rst @@ -1,7 +1,4 @@ -.. _qemu_cortex_m3: - -ARM Cortex-M3 Emulation (QEMU) -############################## +.. zephyr:board:: qemu_cortex_m3 Overview ******** diff --git a/boards/qemu/cortex_r5/doc/index.rst b/boards/qemu/cortex_r5/doc/index.rst index c566e5d4c0408..9d385b5a57887 100644 --- a/boards/qemu/cortex_r5/doc/index.rst +++ b/boards/qemu/cortex_r5/doc/index.rst @@ -1,7 +1,4 @@ -.. _qemu_cortex_r5: - -ARM Cortex-R5 Emulation (QEMU) -############################## +.. zephyr:board:: qemu_cortex_r5 Overview ******** diff --git a/boards/qemu/kvm_arm64/doc/index.rst b/boards/qemu/kvm_arm64/doc/index.rst index 79eabb5c50f80..e1341211e463a 100644 --- a/boards/qemu/kvm_arm64/doc/index.rst +++ b/boards/qemu/kvm_arm64/doc/index.rst @@ -1,7 +1,4 @@ -.. _qemu_kvm_arm64: - -ARM AArch64 Virt KVM Emulation (QEMU) -##################################### +.. zephyr:board:: qemu_kvm_arm64 Overview ******** diff --git a/boards/qemu/leon3/doc/index.rst b/boards/qemu/leon3/doc/index.rst index 4e0599697fd9b..32a85ebbc5a0f 100644 --- a/boards/qemu/leon3/doc/index.rst +++ b/boards/qemu/leon3/doc/index.rst @@ -1,7 +1,4 @@ -.. _qemu_leon3: - -LEON3 Emulation (QEMU) -###################### +.. zephyr:board:: qemu_leon3 Overview ******** diff --git a/boards/qemu/malta/doc/index.rst b/boards/qemu/malta/doc/index.rst index 014d2ae9c7868..f10dcc8c8dfc6 100644 --- a/boards/qemu/malta/doc/index.rst +++ b/boards/qemu/malta/doc/index.rst @@ -1,7 +1,4 @@ -.. _qemu_malta: - -MIPS Malta Emulation (QEMU) -########################### +.. zephyr:board:: qemu_malta Overview ******** diff --git a/boards/qemu/nios2/doc/index.rst b/boards/qemu/nios2/doc/index.rst index 9dcef10a451a4..81717ab91b425 100644 --- a/boards/qemu/nios2/doc/index.rst +++ b/boards/qemu/nios2/doc/index.rst @@ -1,7 +1,4 @@ -.. _qemu_nios2: - -Altera Nios-II Emulation (QEMU) -############################### +.. zephyr:board:: qemu_nios2 Overview ******** diff --git a/boards/qemu/riscv32/doc/index.rst b/boards/qemu/riscv32/doc/index.rst index cf33745e198cd..ef2e3f91623f1 100644 --- a/boards/qemu/riscv32/doc/index.rst +++ b/boards/qemu/riscv32/doc/index.rst @@ -1,7 +1,4 @@ -.. _qemu_riscv32: - -RISCV32 Emulation (QEMU) -######################## +.. zephyr:board:: qemu_riscv32 Overview ******** diff --git a/boards/qemu/riscv32_xip/doc/index.rst b/boards/qemu/riscv32_xip/doc/index.rst index 4cc4f30522fda..aea547ff75df2 100644 --- a/boards/qemu/riscv32_xip/doc/index.rst +++ b/boards/qemu/riscv32_xip/doc/index.rst @@ -1,7 +1,4 @@ -.. _qemu_riscv32_xip: - -RISCV32 XIP Emulation (QEMU) -############################ +.. zephyr:board:: qemu_riscv32_xip Overview ******** diff --git a/boards/qemu/riscv32e/board.yml b/boards/qemu/riscv32e/board.yml index e4b41d79f3ea0..e720485ff439c 100644 --- a/boards/qemu/riscv32e/board.yml +++ b/boards/qemu/riscv32e/board.yml @@ -1,6 +1,6 @@ board: name: qemu_riscv32e - full_name: QEMU Emulation for RISCV32E Emulation + full_name: QEMU Emulation for RISCV32E vendor: qemu socs: - name: qemu_virt_riscv32e diff --git a/boards/qemu/riscv32e/doc/index.rst b/boards/qemu/riscv32e/doc/index.rst index 15981f00c8e18..6b47c3a363993 100644 --- a/boards/qemu/riscv32e/doc/index.rst +++ b/boards/qemu/riscv32e/doc/index.rst @@ -1,7 +1,4 @@ -.. _qemu_riscv32e: - -RISCV32E Emulation (QEMU) -######################### +.. zephyr:board:: qemu_riscv32e Overview ******** diff --git a/boards/qemu/riscv64/doc/index.rst b/boards/qemu/riscv64/doc/index.rst index e58df91f67949..79d4f6d155f70 100644 --- a/boards/qemu/riscv64/doc/index.rst +++ b/boards/qemu/riscv64/doc/index.rst @@ -1,7 +1,4 @@ -.. _qemu_riscv64: - -RISCV64 Emulation (QEMU) -######################## +.. zephyr:board:: qemu_riscv64 Overview ******** diff --git a/boards/qemu/x86/doc/index.rst b/boards/qemu/x86/doc/index.rst index 2fdba13bc09da..98e0098d39a0d 100644 --- a/boards/qemu/x86/doc/index.rst +++ b/boards/qemu/x86/doc/index.rst @@ -1,7 +1,4 @@ -.. _qemu_x86: - -X86 Emulation (QEMU) -#################### +.. zephyr:board:: qemu_x86 Overview ******** diff --git a/boards/qemu/xtensa/doc/index.rst b/boards/qemu/xtensa/doc/index.rst index f0ec7e9deec71..741e0569b7f5b 100644 --- a/boards/qemu/xtensa/doc/index.rst +++ b/boards/qemu/xtensa/doc/index.rst @@ -1,7 +1,4 @@ -.. _qemu_xtensa: - -Xtensa Emulation (QEMU) -####################### +.. zephyr:board:: qemu_xtensa Overview ******** diff --git a/doc/build/dts/howtos.rst b/doc/build/dts/howtos.rst index 5bd4df9fcbe43..b132e7ff1a7d9 100644 --- a/doc/build/dts/howtos.rst +++ b/doc/build/dts/howtos.rst @@ -26,7 +26,8 @@ application and open the :file:`zephyr.dts` file in the build directory. You can build :zephyr:code-sample:`hello_world` to see the "base" devicetree for your board without any additional changes from :ref:`overlay files `. -For example, using the :ref:`qemu_cortex_m3` board to build :zephyr:code-sample:`hello_world`: +For example, using the :zephyr:board:`qemu_cortex_m3` board to build +:zephyr:code-sample:`hello_world`: .. code-block:: sh diff --git a/doc/connectivity/networking/api/gptp.rst b/doc/connectivity/networking/api/gptp.rst index 772e6f099d1c5..e4fab0dcdafc5 100644 --- a/doc/connectivity/networking/api/gptp.rst +++ b/doc/connectivity/networking/api/gptp.rst @@ -42,7 +42,7 @@ Boards supported: - :zephyr:board:`sam_e70_xplained` - :ref:`native_sim` (only usable for simple testing, limited capabilities due to lack of hardware clock) -- :ref:`qemu_x86` (emulated, limited capabilities due to lack of hardware clock) +- :zephyr:board:`qemu_x86` (emulated, limited capabilities due to lack of hardware clock) Enabling the stack ****************** diff --git a/doc/develop/west/build-flash-debug.rst b/doc/develop/west/build-flash-debug.rst index 36a4d5ddc510f..c45a4551843e9 100644 --- a/doc/develop/west/build-flash-debug.rst +++ b/doc/develop/west/build-flash-debug.rst @@ -145,8 +145,8 @@ Setting the Build System Target To specify the build system target to run, use ``--target`` (or ``-t``). For example, on host platforms with QEMU, you can use the ``run`` target to -build and run the :zephyr:code-sample:`hello_world` sample for the emulated :ref:`qemu_x86 -` board in one command:: +build and run the :zephyr:code-sample:`hello_world` sample for the emulated +:zephyr:board:`qemu_x86 ` board in one command:: west build -b qemu_x86 -t run samples/hello_world diff --git a/doc/services/debugging/coredump.rst b/doc/services/debugging/coredump.rst index 3777cfd266ac0..a5a84b96ccd42 100644 --- a/doc/services/debugging/coredump.rst +++ b/doc/services/debugging/coredump.rst @@ -90,7 +90,7 @@ Example ------- This example uses the log module backend tied to serial console. -This was done on :ref:`qemu_x86` where a null pointer was dereferenced. +This was done on :zephyr:board:`qemu_x86` where a null pointer was dereferenced. This is the core dump log from the serial console, and is stored in :file:`coredump.log`: diff --git a/samples/subsys/llext/modules/README.rst b/samples/subsys/llext/modules/README.rst index 4149dffab25b8..a4c5bf640788d 100644 --- a/samples/subsys/llext/modules/README.rst +++ b/samples/subsys/llext/modules/README.rst @@ -30,8 +30,8 @@ Requirements ************ A board with a supported llext architecture and console. This can also be -executed in QEMU emulation on the :ref:`qemu_xtensa ` or -:ref:`qemu_cortex_r5 ` virtual boards. +executed in QEMU emulation on the :zephyr:board:`qemu_xtensa ` or +:zephyr:board:`qemu_cortex_r5 ` virtual boards. Building and running ******************** From cf3665eda401a2d0deb5c94bd25f8b062a3a61ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 18:56:33 +0200 Subject: [PATCH 1626/4482] boards: ct: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the CThings boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/ct/ctcc/doc/index.rst | 5 +---- doc/releases/release-notes-3.7.rst | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/boards/ct/ctcc/doc/index.rst b/boards/ct/ctcc/doc/index.rst index 914df63b3aae4..73b857b47dfa5 100644 --- a/boards/ct/ctcc/doc/index.rst +++ b/boards/ct/ctcc/doc/index.rst @@ -1,7 +1,4 @@ -.. _ctcc_nrf52840: - -CTHINGS.CO Connectivity Card nRF52840 -##################################### +.. zephyr:board:: ctcc Overview ******** diff --git a/doc/releases/release-notes-3.7.rst b/doc/releases/release-notes-3.7.rst index d47ad1613802f..30749ad038076 100644 --- a/doc/releases/release-notes-3.7.rst +++ b/doc/releases/release-notes-3.7.rst @@ -437,7 +437,7 @@ Boards & SoC Support * Added support for :zephyr:board:`Espressif ESP32-C6 DevKit-C `: ``esp32c6_devkitc``. * Added support for :zephyr:board:`Waveshare ESP32-S3-Touch-LCD-1.28 `: ``esp32s3_touch_lcd_1_28``. * Added support for :zephyr:board:`M5Stack ATOM Lite `: ``m5stack_atom_lite``. - * Added support for :ref:`CTHINGS.CO Connectivity Card nRF52840 `: ``ctcc_nrf52840``. + * Added support for :zephyr:board:`CTHINGS.CO Connectivity Card nRF52840 `: ``ctcc``. * Made these board changes: From 5666e93f607480c6b416312404b5b841c412442a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 18:59:34 +0200 Subject: [PATCH 1627/4482] boards: franzininho: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Franzininho boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/franzininho/esp32s2_franzininho/doc/index.rst | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/boards/franzininho/esp32s2_franzininho/doc/index.rst b/boards/franzininho/esp32s2_franzininho/doc/index.rst index 803cb9be652a6..47f223b83ca28 100644 --- a/boards/franzininho/esp32s2_franzininho/doc/index.rst +++ b/boards/franzininho/esp32s2_franzininho/doc/index.rst @@ -1,7 +1,4 @@ -.. _esp32s2_franzininho: - -ESP32-S2 Franzininho -#################### +.. zephyr:board:: esp32s2_franzininho Overview ******** @@ -30,10 +27,6 @@ The features include the following: - DAC - LED PWM with up to 8 channels -.. figure:: img/esp32_s2_franzininho.jpg - :align: center - :alt: ESP32-S2 FRANZININHO - System requirements =================== From 04e259ca98e0d95af2ed1a18da10ff21428c4e28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 19:01:01 +0200 Subject: [PATCH 1628/4482] boards: cdns: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Cadence boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/cdns/xt-sim/doc/index.rst | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/boards/cdns/xt-sim/doc/index.rst b/boards/cdns/xt-sim/doc/index.rst index 30a86d00953fd..f904ae34572d1 100644 --- a/boards/cdns/xt-sim/doc/index.rst +++ b/boards/cdns/xt-sim/doc/index.rst @@ -1,7 +1,4 @@ -.. _xt-sim: - -Xtensa simulator -################ +.. zephyr:board:: xt-sim Overview ******** @@ -13,12 +10,6 @@ addition to a base ISA to tailor the processor for a particular application. For more information, see https://ip.cadence.com/ipportfolio/tensilica-ip/xtensa-customizable -.. figure:: img/xt-sim.jpg - :align: center - :alt: Xtensa Xplorer (Eclipse base frontend for xt-sim) - - Xtensa Xplorer - Hardware ******** From 367f4eb14383a30e03a708f5f0fd2ed8b8ebda72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 19:02:32 +0200 Subject: [PATCH 1629/4482] boards: element14: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the Element14 boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/element14/warp7/doc/index.rst | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/boards/element14/warp7/doc/index.rst b/boards/element14/warp7/doc/index.rst index e55de8a80e3ed..d0940f5271ac9 100644 --- a/boards/element14/warp7/doc/index.rst +++ b/boards/element14/warp7/doc/index.rst @@ -1,7 +1,4 @@ -.. _warp7: - -WaRP7 - Next Generation IoT and Wearable Development Platform -############################################################# +.. zephyr:board:: warp7 Overview ******** @@ -11,11 +8,6 @@ core and Single Cortex M4 core. Zephyr was ported to run on the M4 core. In a later release, it will also communicate with the A7 core (running Linux) via RPmsg. - -.. image:: warp7.jpg - :align: center - :alt: WaRP7-iMX7S - Hardware ******** From a4adfc72d30107279ef9feafab621e3c4a9c4322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 19:05:22 +0200 Subject: [PATCH 1630/4482] boards: sifive: adopt new zephyr:board directive and role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the documentation of all the SiFive boards to use the new `zephyr:board::` directive. Signed-off-by: Benjamin Cabé --- boards/sifive/hifive1/doc/index.rst | 5 +---- boards/sifive/hifive_unleashed/doc/index.rst | 9 +-------- boards/sifive/hifive_unmatched/doc/index.rst | 9 +-------- 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/boards/sifive/hifive1/doc/index.rst b/boards/sifive/hifive1/doc/index.rst index 2c3d2ba1fb6a7..dcd9a2948ef28 100644 --- a/boards/sifive/hifive1/doc/index.rst +++ b/boards/sifive/hifive1/doc/index.rst @@ -1,7 +1,4 @@ -.. _hifive1: - -SiFive HiFive1 -############## +.. zephyr:board:: hifive1 Overview ******** diff --git a/boards/sifive/hifive_unleashed/doc/index.rst b/boards/sifive/hifive_unleashed/doc/index.rst index f2dd987ff033f..647911746fc19 100644 --- a/boards/sifive/hifive_unleashed/doc/index.rst +++ b/boards/sifive/hifive_unleashed/doc/index.rst @@ -1,7 +1,4 @@ -.. _hifive_unleashed: - -SiFive HiFive Unleashed -####################### +.. zephyr:board:: hifive_unleashed Overview ******** @@ -9,10 +6,6 @@ Overview The HiFive Unleashed is a development board with a SiFive FU540-C000 multi-core 64bit RISC-V SoC. -.. image:: img/hifive_unleashed.jpg - :align: center - :alt: SiFive HiFive Unleashed board - Programming and debugging ************************* diff --git a/boards/sifive/hifive_unmatched/doc/index.rst b/boards/sifive/hifive_unmatched/doc/index.rst index da374e37679ed..2ff4d5de6e3e4 100644 --- a/boards/sifive/hifive_unmatched/doc/index.rst +++ b/boards/sifive/hifive_unmatched/doc/index.rst @@ -1,7 +1,4 @@ -.. _hifive_unmatched: - -SiFive HiFive Unmatched -####################### +.. zephyr:board:: hifive_unmatched Overview ******** @@ -9,10 +6,6 @@ Overview The HiFive Unmatched is a development board with a SiFive FU740-C000 multi-core 64bit RISC-V SoC. -.. image:: img/hifive_unmatched.jpg - :align: center - :alt: SiFive HiFive Unmatched board - Programming and debugging ************************* From cda19bdab6f73d50a765a84b25d90c4d2cd81256 Mon Sep 17 00:00:00 2001 From: Rafael Laya Date: Thu, 17 Oct 2024 16:54:49 -0700 Subject: [PATCH 1631/4482] drivers: regulator: API to get max regulator voltage There is already a get_min_voltage() API, so let us add an API to also query the max voltage Signed-off-by: Rafael Laya --- include/zephyr/drivers/regulator.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/zephyr/drivers/regulator.h b/include/zephyr/drivers/regulator.h index b1692e254b768..1d8e2255a3c25 100644 --- a/include/zephyr/drivers/regulator.h +++ b/include/zephyr/drivers/regulator.h @@ -313,6 +313,28 @@ static inline int regulator_common_get_min_voltage(const struct device *dev, int return 0; } +/** + * @brief Get maximum supported voltage. + * + * @param dev Regulator device instance. + * @param max_uv Where maximum voltage will be stored, in microvolts. + * + * @retval 0 If successful + * @retval -ENOENT If maximum voltage is not specified. + */ +static inline int regulator_common_get_max_voltage(const struct device *dev, int32_t *max_uv) +{ + const struct regulator_common_config *config = + (const struct regulator_common_config *)dev->config; + + if (config->max_uv == INT32_MAX) { + return -ENOENT; + } + + *max_uv = config->max_uv; + return 0; +} + /** @endcond */ /** From e542dde890cb1102d8cd5aabd0b2bba57a515ec1 Mon Sep 17 00:00:00 2001 From: Rafael Laya Date: Mon, 21 Oct 2024 06:10:36 -0700 Subject: [PATCH 1632/4482] drivers: regulator: add tests for get_max/min voltage Adds unit tests to make sure get_max and get_min voltage remain healthy Signed-off-by: Rafael Laya --- tests/drivers/regulator/api/src/main.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/drivers/regulator/api/src/main.c b/tests/drivers/regulator/api/src/main.c index 93fa786308599..7dcfd8f9f3123 100644 --- a/tests/drivers/regulator/api/src/main.c +++ b/tests/drivers/regulator/api/src/main.c @@ -777,6 +777,32 @@ static int get_error_flags_fail(const struct device *dev, return -EIO; } +ZTEST(regulator_api, test_get_max_voltage) +{ + int32_t max_uv = 0; + int err = 0; + + err = regulator_common_get_max_voltage(reg0, &max_uv); + zassert_equal(err, -ENOENT); + + err = regulator_common_get_max_voltage(reg3, &max_uv); + zassert_equal(err, 0); + zassert_equal(max_uv, 200); +} + +ZTEST(regulator_api, test_get_min_voltage) +{ + int32_t min_uv = 0; + int err = 0; + + err = regulator_common_get_min_voltage(reg0, &min_uv); + zassert_equal(err, -ENOENT); + + err = regulator_common_get_min_voltage(reg3, &min_uv); + zassert_equal(err, 0); + zassert_equal(min_uv, 100); +} + ZTEST(regulator_api, test_get_error_flags_error) { RESET_FAKE(regulator_fake_get_error_flags); From 16218018d7e163feeca7f20dab541f253215be01 Mon Sep 17 00:00:00 2001 From: Rafael Laya Date: Mon, 21 Oct 2024 06:13:11 -0700 Subject: [PATCH 1633/4482] drivers: regulator: Linter pass to unit test Linter pass makes CI happy and keeps code compliant with the stylistic guidelines of the project Signed-off-by: Rafael Laya --- tests/drivers/regulator/api/src/main.c | 79 +++++++++----------------- 1 file changed, 26 insertions(+), 53 deletions(-) diff --git a/tests/drivers/regulator/api/src/main.c b/tests/drivers/regulator/api/src/main.c index 7dcfd8f9f3123..ec4c2b88cc17e 100644 --- a/tests/drivers/regulator/api/src/main.c +++ b/tests/drivers/regulator/api/src/main.c @@ -9,8 +9,7 @@ DEFINE_FFF_GLOBALS; -static const struct device *const parent = - DEVICE_DT_GET(DT_NODELABEL(regulator)); +static const struct device *const parent = DEVICE_DT_GET(DT_NODELABEL(regulator)); /* REG0: no Devicetree properties */ static const struct device *const reg0 = DEVICE_DT_GET(DT_NODELABEL(reg0)); /* REG1: regulator-always-on */ @@ -27,8 +26,7 @@ static const struct device *const reg5 = DEVICE_DT_GET(DT_NODELABEL(reg5)); ZTEST(regulator_api, test_parent_dvs_state_set_not_implemented) { int ret; - struct regulator_parent_driver_api *api = - (struct regulator_parent_driver_api *)parent->api; + struct regulator_parent_driver_api *api = (struct regulator_parent_driver_api *)parent->api; regulator_dvs_state_set_t dvs_state_set = api->dvs_state_set; api->dvs_state_set = NULL; @@ -45,8 +43,7 @@ ZTEST(regulator_api, test_parent_dvs_state_set_ok) regulator_parent_fake_dvs_state_set_fake.return_val = 0; zassert_equal(regulator_parent_dvs_state_set(parent, 0U), 0); - zassert_equal(regulator_parent_fake_dvs_state_set_fake.arg0_val, - parent); + zassert_equal(regulator_parent_fake_dvs_state_set_fake.arg0_val, parent); zassert_equal(regulator_parent_fake_dvs_state_set_fake.arg1_val, 0U); zassert_equal(regulator_parent_fake_dvs_state_set_fake.call_count, 1U); } @@ -58,8 +55,7 @@ ZTEST(regulator_api, test_parent_dvs_state_set_fail) regulator_parent_fake_dvs_state_set_fake.return_val = -ENOTSUP; zassert_equal(regulator_parent_dvs_state_set(parent, 0U), -ENOTSUP); - zassert_equal(regulator_parent_fake_dvs_state_set_fake.arg0_val, - parent); + zassert_equal(regulator_parent_fake_dvs_state_set_fake.arg0_val, parent); zassert_equal(regulator_parent_fake_dvs_state_set_fake.arg1_val, 0U); zassert_equal(regulator_parent_fake_dvs_state_set_fake.call_count, 1U); } @@ -67,8 +63,7 @@ ZTEST(regulator_api, test_parent_dvs_state_set_fail) ZTEST(regulator_api, test_parent_ship_mode_not_implemented) { int ret; - struct regulator_parent_driver_api *api = - (struct regulator_parent_driver_api *)parent->api; + struct regulator_parent_driver_api *api = (struct regulator_parent_driver_api *)parent->api; regulator_ship_mode_t ship_mode = api->ship_mode; api->ship_mode = NULL; @@ -113,7 +108,7 @@ ZTEST(regulator_api, test_common_config) zassert_equal(config->allowed_modes_cnt, 0U); zassert_equal(config->initial_mode, REGULATOR_INITIAL_MODE_UNKNOWN); zassert_equal(REGULATOR_ACTIVE_DISCHARGE_GET_BITS(config->flags), - REGULATOR_ACTIVE_DISCHARGE_DEFAULT); + REGULATOR_ACTIVE_DISCHARGE_DEFAULT); /* reg1: regulator-always-on */ config = reg1->config; @@ -189,15 +184,12 @@ ZTEST(regulator_api, test_enable_disable) /* REG5: disable */ zassert_equal(regulator_disable(reg5), 0); zassert_equal(regulator_fake_disable_fake.call_count, 3U); - - } ZTEST(regulator_api, test_count_voltages_not_implemented) { unsigned int count; - struct regulator_driver_api *api = - (struct regulator_driver_api *)reg0->api; + struct regulator_driver_api *api = (struct regulator_driver_api *)reg0->api; regulator_count_voltages_t count_voltages = api->count_voltages; api->count_voltages = NULL; @@ -221,8 +213,7 @@ ZTEST(regulator_api, test_count_voltages) ZTEST(regulator_api, test_list_voltage_not_implemented) { int ret; - struct regulator_driver_api *api = - (struct regulator_driver_api *)reg0->api; + struct regulator_driver_api *api = (struct regulator_driver_api *)reg0->api; regulator_list_voltage_t list_voltage = api->list_voltage; api->list_voltage = NULL; @@ -232,8 +223,7 @@ ZTEST(regulator_api, test_list_voltage_not_implemented) zassert_equal(ret, -EINVAL); } -static int list_voltage_ok(const struct device *dev, unsigned int idx, - int32_t *volt_uv) +static int list_voltage_ok(const struct device *dev, unsigned int idx, int32_t *volt_uv) { ARG_UNUSED(dev); ARG_UNUSED(idx); @@ -259,8 +249,7 @@ ZTEST(regulator_api, test_list_voltage_valid) zassert_equal(regulator_fake_list_voltage_fake.arg2_val, &volt_uv); } -static int list_voltage_invalid(const struct device *dev, unsigned int idx, - int32_t *volt_uv) +static int list_voltage_invalid(const struct device *dev, unsigned int idx, int32_t *volt_uv) { ARG_UNUSED(dev); ARG_UNUSED(idx); @@ -282,8 +271,7 @@ ZTEST(regulator_api, test_list_voltage_invalid) zassert_equal(regulator_fake_list_voltage_fake.arg2_val, NULL); } -static int list_voltage(const struct device *dev, unsigned int idx, - int32_t *volt_uv) +static int list_voltage(const struct device *dev, unsigned int idx, int32_t *volt_uv) { ARG_UNUSED(dev); @@ -352,8 +340,7 @@ ZTEST(regulator_api, test_is_supported_voltage_dt_limit) ZTEST(regulator_api, test_set_voltage_not_implemented) { int ret; - struct regulator_driver_api *api = - (struct regulator_driver_api *)reg0->api; + struct regulator_driver_api *api = (struct regulator_driver_api *)reg0->api; regulator_set_voltage_t set_voltage = api->set_voltage; api->set_voltage = NULL; @@ -402,8 +389,7 @@ ZTEST(regulator_api, test_set_voltage_dt_limit) ZTEST(regulator_api, test_get_voltage_not_implemented) { int ret; - struct regulator_driver_api *api = - (struct regulator_driver_api *)reg0->api; + struct regulator_driver_api *api = (struct regulator_driver_api *)reg0->api; regulator_get_voltage_t get_voltage = api->get_voltage; api->get_voltage = NULL; @@ -460,10 +446,8 @@ ZTEST(regulator_api, test_get_voltage_error) ZTEST(regulator_api, test_set_current_limit_not_implemented) { int ret; - struct regulator_driver_api *api = - (struct regulator_driver_api *)reg0->api; - regulator_set_current_limit_t set_current_limit = - api->set_current_limit; + struct regulator_driver_api *api = (struct regulator_driver_api *)reg0->api; + regulator_set_current_limit_t set_current_limit = api->set_current_limit; api->set_current_limit = NULL; ret = regulator_set_current_limit(reg0, 0, 0); @@ -511,10 +495,8 @@ ZTEST(regulator_api, test_set_current_limit_dt_limit) ZTEST(regulator_api, test_get_current_limit_not_implemented) { int ret; - struct regulator_driver_api *api = - (struct regulator_driver_api *)reg0->api; - regulator_get_current_limit_t get_current_limit = - api->get_current_limit; + struct regulator_driver_api *api = (struct regulator_driver_api *)reg0->api; + regulator_get_current_limit_t get_current_limit = api->get_current_limit; api->get_current_limit = NULL; ret = regulator_get_current_limit(reg0, NULL); @@ -538,8 +520,7 @@ ZTEST(regulator_api, test_get_current_limit_ok) RESET_FAKE(regulator_fake_get_current_limit); - regulator_fake_get_current_limit_fake.custom_fake = - get_current_limit_ok; + regulator_fake_get_current_limit_fake.custom_fake = get_current_limit_ok; zassert_equal(regulator_get_current_limit(reg0, &curr_ua), 0); zassert_equal(curr_ua, 100); @@ -560,8 +541,7 @@ ZTEST(regulator_api, test_get_current_limit_error) { RESET_FAKE(regulator_fake_get_current_limit); - regulator_fake_get_current_limit_fake.custom_fake = - get_current_limit_fail; + regulator_fake_get_current_limit_fake.custom_fake = get_current_limit_fail; zassert_equal(regulator_get_current_limit(reg0, NULL), -EIO); zassert_equal(regulator_fake_get_current_limit_fake.call_count, 1U); @@ -572,8 +552,7 @@ ZTEST(regulator_api, test_get_current_limit_error) ZTEST(regulator_api, test_set_mode_not_implemented) { int ret; - struct regulator_driver_api *api = - (struct regulator_driver_api *)reg0->api; + struct regulator_driver_api *api = (struct regulator_driver_api *)reg0->api; regulator_set_mode_t set_mode = api->set_mode; api->set_mode = NULL; @@ -622,8 +601,7 @@ ZTEST(regulator_api, test_set_mode_dt_limit) ZTEST(regulator_api, test_get_mode_not_implemented) { int ret; - struct regulator_driver_api *api = - (struct regulator_driver_api *)reg0->api; + struct regulator_driver_api *api = (struct regulator_driver_api *)reg0->api; regulator_get_mode_t get_mode = api->get_mode; api->get_mode = NULL; @@ -636,8 +614,7 @@ ZTEST(regulator_api, test_get_mode_not_implemented) ZTEST(regulator_api, test_set_active_discharge_not_implemented) { int ret; - struct regulator_driver_api *api = - (struct regulator_driver_api *)reg0->api; + struct regulator_driver_api *api = (struct regulator_driver_api *)reg0->api; regulator_set_active_discharge_t set_active_discharge = api->set_active_discharge; api->set_active_discharge = NULL; @@ -674,8 +651,7 @@ ZTEST(regulator_api, test_get_active_discharge_ok) ZTEST(regulator_api, test_get_active_discharge_not_implemented) { int ret; - struct regulator_driver_api *api = - (struct regulator_driver_api *)reg0->api; + struct regulator_driver_api *api = (struct regulator_driver_api *)reg0->api; regulator_get_active_discharge_t get_active_discharge = api->get_active_discharge; api->get_active_discharge = NULL; @@ -732,8 +708,7 @@ ZTEST(regulator_api, test_get_mode_error) ZTEST(regulator_api, test_get_error_flags_not_implemented) { int ret; - struct regulator_driver_api *api = - (struct regulator_driver_api *)reg0->api; + struct regulator_driver_api *api = (struct regulator_driver_api *)reg0->api; regulator_get_error_flags_t get_error_flags = api->get_error_flags; api->get_error_flags = NULL; @@ -743,8 +718,7 @@ ZTEST(regulator_api, test_get_error_flags_not_implemented) zassert_equal(ret, -ENOSYS); } -static int get_error_flags_ok(const struct device *dev, - regulator_error_flags_t *flags) +static int get_error_flags_ok(const struct device *dev, regulator_error_flags_t *flags) { ARG_UNUSED(dev); @@ -768,8 +742,7 @@ ZTEST(regulator_api, test_get_error_flags_ok) zassert_equal(regulator_fake_get_error_flags_fake.arg1_val, &flags); } -static int get_error_flags_fail(const struct device *dev, - regulator_error_flags_t *flags) +static int get_error_flags_fail(const struct device *dev, regulator_error_flags_t *flags) { ARG_UNUSED(dev); ARG_UNUSED(flags); From 492f84d8b0e2a888c60a6cdcc05ce91cb197a8d9 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Mon, 14 Oct 2024 15:17:07 +0900 Subject: [PATCH 1634/4482] doc: gsg: Updating SDK installation instructions to using `west sdk` SDK installation has been simplified by introducing the `west sdk` command. I updated the documentation to use this. Signed-off-by: TOKITA Hiroshi --- doc/develop/getting_started/index.rst | 55 +++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/doc/develop/getting_started/index.rst b/doc/develop/getting_started/index.rst index 3cb87da9ec6cb..426c61d459091 100644 --- a/doc/develop/getting_started/index.rst +++ b/doc/develop/getting_started/index.rst @@ -389,9 +389,58 @@ Zephyr applications. It also contains additional host tools, such as custom QEMU and OpenOCD builds that are used to emulate, flash and debug Zephyr applications. -.. include:: ../toolchains/zephyr_sdk.rst - :start-after: toolchain_zephyr_sdk_install_start - :end-before: toolchain_zephyr_sdk_install_end + +.. tabs:: + + .. group-tab:: Ubuntu + + Install the Zephyr SDK using the ``west sdk install``. + + .. code-block:: bash + + cd ~/zephyrproject/zephyr + west sdk install + + .. tip:: + + Using the command options, you can specify the SDK installation destination + and which architecture of toolchains to install. + See ``west sdk install --help`` for details. + + .. group-tab:: macOS + + Install the Zephyr SDK using the ``west sdk install``. + + .. code-block:: bash + + cd ~/zephyrproject/zephyr + west sdk install + + .. tip:: + + Using the command options, you can specify the SDK installation destination + and which architecture of toolchains to install. + See ``west sdk install --help`` for details. + + .. group-tab:: Windows + + Install the Zephyr SDK using the ``west sdk install``. + + .. code-block:: bat + + cd %HOMEPATH%\zephyrproject\zephyr + west sdk install + + .. tip:: + + Using the command options, you can specify the SDK installation destination + and which architecture of toolchains to install. + See ``west sdk install --help`` for details. + +.. note:: + + If you want to install Zephyr SDK without using the ``west sdk`` command, + please see :ref:`toolchain_zephyr_sdk_install`. .. _getting_started_run_sample: From ae74e87c386d46f88f3ac20556209562784cafec Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Mon, 14 Oct 2024 21:29:39 +0900 Subject: [PATCH 1635/4482] doc: gsg: Host-Tools is only provide for Linux Host-Tools are only included in the SDK for Linux, so revised the description. Signed-off-by: TOKITA Hiroshi --- doc/develop/getting_started/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/develop/getting_started/index.rst b/doc/develop/getting_started/index.rst index 426c61d459091..f6d2d3fea670c 100644 --- a/doc/develop/getting_started/index.rst +++ b/doc/develop/getting_started/index.rst @@ -386,7 +386,7 @@ contains toolchains for each of Zephyr's supported architectures, which include a compiler, assembler, linker and other programs required to build Zephyr applications. -It also contains additional host tools, such as custom QEMU and OpenOCD builds +For Linux, it also contains additional host tools, such as custom QEMU and OpenOCD builds that are used to emulate, flash and debug Zephyr applications. From 22ad20591903151ec46ceabe7fe64932abd14207 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Fri, 18 Oct 2024 07:16:53 +0900 Subject: [PATCH 1636/4482] doc: gsg: Add a note about setting udev rules Added a note that udev rules must be configured in Linux environments. Reformatted text accordingly. Signed-off-by: TOKITA Hiroshi --- doc/develop/getting_started/index.rst | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/develop/getting_started/index.rst b/doc/develop/getting_started/index.rst index f6d2d3fea670c..5d828f3bbd9b2 100644 --- a/doc/develop/getting_started/index.rst +++ b/doc/develop/getting_started/index.rst @@ -510,9 +510,17 @@ Then flash the sample using :ref:`west flash `: west flash -You may need to install additional :ref:`host tools ` -required by your board. The ``west flash`` command will print an error if any -required dependencies are missing. +.. note:: + + You may need to install additional :ref:`host tools ` + required by your board. The ``west flash`` command will print an error if any + required dependencies are missing. + +.. note:: + + When using Linux, you may need to configure udev rules the first time + of using a debug probe. + Please also see :ref:`setting-udev-rules`. If you're using blinky, the LED will start to blink as shown in this figure: From d2273c02dfd7d13f4cfac8f90e6fa57eca02bb80 Mon Sep 17 00:00:00 2001 From: Hubert Guan Date: Wed, 9 Oct 2024 23:52:12 -0700 Subject: [PATCH 1637/4482] include: zephyr: dt-bindings: clock: Define STM32_CLOCK macro Define new macro for reading and writing convenience. Signed-off-by: Hubert Guan --- include/zephyr/dt-bindings/clock/stm32_common_clocks.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/zephyr/dt-bindings/clock/stm32_common_clocks.h b/include/zephyr/dt-bindings/clock/stm32_common_clocks.h index 721904cce7773..3aece1bb77573 100644 --- a/include/zephyr/dt-bindings/clock/stm32_common_clocks.h +++ b/include/zephyr/dt-bindings/clock/stm32_common_clocks.h @@ -45,4 +45,13 @@ (((mask) & STM32_MCO_CFGR_MASK_MASK) << STM32_MCO_CFGR_MASK_SHIFT) | \ (((val) & STM32_MCO_CFGR_VAL_MASK) << STM32_MCO_CFGR_VAL_SHIFT)) +/** + * Pack RCC clock register offset and bit in two 32-bit values + * as expected for the Device Tree `clocks` property on STM32. + * + * @param bus STM32 bus name (expands to STM32_CLOCK_BUS_{bus}) + * @param bit Clock bit + */ +#define STM32_CLOCK(bus, bit) (STM32_CLOCK_BUS_##bus) (1 << bit) + #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32_COMMON_CLOCKS_H_ */ From e382969f3bbc248190d74ac258261a4f1b79ccd5 Mon Sep 17 00:00:00 2001 From: Hubert Guan Date: Thu, 10 Oct 2024 00:02:47 -0700 Subject: [PATCH 1638/4482] include: zephyr: dt-bindings: clock: Rename domain clock selection macro Rename from STM32_CLOCK to STM32_DOMAIN_CLOCK since it conflicts with new macro name. Signed-off-by: Hubert Guan --- .../zephyr/dt-bindings/clock/stm32c0_clock.h | 12 +-- .../zephyr/dt-bindings/clock/stm32f0_clock.h | 16 ++-- .../zephyr/dt-bindings/clock/stm32f1_clock.h | 8 +- .../zephyr/dt-bindings/clock/stm32f3_clock.h | 38 ++++---- .../dt-bindings/clock/stm32f410_clock.h | 22 ++--- .../dt-bindings/clock/stm32f427_clock.h | 14 +-- .../zephyr/dt-bindings/clock/stm32f4_clock.h | 6 +- .../zephyr/dt-bindings/clock/stm32f7_clock.h | 42 ++++----- .../zephyr/dt-bindings/clock/stm32g0_clock.h | 40 ++++---- .../zephyr/dt-bindings/clock/stm32g4_clock.h | 40 ++++---- .../zephyr/dt-bindings/clock/stm32h5_clock.h | 92 +++++++++---------- .../zephyr/dt-bindings/clock/stm32h7_clock.h | 62 ++++++------- .../dt-bindings/clock/stm32h7rs_clock.h | 48 +++++----- .../zephyr/dt-bindings/clock/stm32l0_clock.h | 18 ++-- .../zephyr/dt-bindings/clock/stm32l1_clock.h | 4 +- .../zephyr/dt-bindings/clock/stm32l4_clock.h | 54 +++++------ .../zephyr/dt-bindings/clock/stm32u0_clock.h | 32 +++---- .../zephyr/dt-bindings/clock/stm32u5_clock.h | 78 ++++++++-------- .../zephyr/dt-bindings/clock/stm32wb0_clock.h | 8 +- .../zephyr/dt-bindings/clock/stm32wb_clock.h | 26 +++--- .../zephyr/dt-bindings/clock/stm32wba_clock.h | 30 +++--- .../zephyr/dt-bindings/clock/stm32wl_clock.h | 28 +++--- 22 files changed, 359 insertions(+), 359 deletions(-) diff --git a/include/zephyr/dt-bindings/clock/stm32c0_clock.h b/include/zephyr/dt-bindings/clock/stm32c0_clock.h index 861543f0ae46b..70438d62b6d5e 100644 --- a/include/zephyr/dt-bindings/clock/stm32c0_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32c0_clock.h @@ -51,7 +51,7 @@ * @param mask Mask for the RCC_CCIPRx field. * @param val Clock value (0, 1, ... 7). */ -#define STM32_CLOCK(val, mask, shift, reg) \ +#define STM32_DOMAIN_CLOCK(val, mask, shift, reg) \ ((((reg) & STM32_CLOCK_REG_MASK) << STM32_CLOCK_REG_SHIFT) | \ (((shift) & STM32_CLOCK_SHIFT_MASK) << STM32_CLOCK_SHIFT_SHIFT) | \ (((mask) & STM32_CLOCK_MASK_MASK) << STM32_CLOCK_MASK_SHIFT) | \ @@ -68,12 +68,12 @@ /** @brief Device domain clocks selection helpers */ /** CCIPR devices */ -#define USART1_SEL(val) STM32_CLOCK(val, 3, 0, CCIPR_REG) -#define I2C1_SEL(val) STM32_CLOCK(val, 3, 12, CCIPR_REG) -#define I2C2_I2S1_SEL(val) STM32_CLOCK(val, 3, 14, CCIPR_REG) -#define ADC_SEL(val) STM32_CLOCK(val, 3, 30, CCIPR_REG) +#define USART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 0, CCIPR_REG) +#define I2C1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 12, CCIPR_REG) +#define I2C2_I2S1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 14, CCIPR_REG) +#define ADC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 30, CCIPR_REG) /** CSR1 devices */ -#define RTC_SEL(val) STM32_CLOCK(val, 3, 8, CSR1_REG) +#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, CSR1_REG) /** CFGR1 devices */ #define MCO1_SEL(val) STM32_MCO_CFGR(val, 0x7, 24, CFGR1_REG) diff --git a/include/zephyr/dt-bindings/clock/stm32f0_clock.h b/include/zephyr/dt-bindings/clock/stm32f0_clock.h index 0ddf7aff90966..7572c1c422f1c 100644 --- a/include/zephyr/dt-bindings/clock/stm32f0_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32f0_clock.h @@ -52,7 +52,7 @@ * @param mask Mask for the RCC_CFGRx field. * @param val Clock value (0, 1, ... 7). */ -#define STM32_CLOCK(val, mask, shift, reg) \ +#define STM32_DOMAIN_CLOCK(val, mask, shift, reg) \ ((((reg) & STM32_CLOCK_REG_MASK) << STM32_CLOCK_REG_SHIFT) | \ (((shift) & STM32_CLOCK_SHIFT_MASK) << STM32_CLOCK_SHIFT_SHIFT) | \ (((mask) & STM32_CLOCK_MASK_MASK) << STM32_CLOCK_MASK_SHIFT) | \ @@ -67,14 +67,14 @@ /** @brief Device domain clocks selection helpers */ /** CFGR3 devices */ -#define USART1_SEL(val) STM32_CLOCK(val, 3, 0, CFGR3_REG) -#define I2C1_SEL(val) STM32_CLOCK(val, 1, 4, CFGR3_REG) -#define CEC_SEL(val) STM32_CLOCK(val, 1, 6, CFGR3_REG) -#define USB_SEL(val) STM32_CLOCK(val, 1, 7, CFGR3_REG) -#define USART2_SEL(val) STM32_CLOCK(val, 3, 16, CFGR3_REG) -#define USART3_SEL(val) STM32_CLOCK(val, 3, 18, CFGR3_REG) +#define USART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 0, CFGR3_REG) +#define I2C1_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 4, CFGR3_REG) +#define CEC_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 6, CFGR3_REG) +#define USB_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 7, CFGR3_REG) +#define USART2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 16, CFGR3_REG) +#define USART3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 18, CFGR3_REG) /** BDCR devices */ -#define RTC_SEL(val) STM32_CLOCK(val, 3, 8, BDCR_REG) +#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, BDCR_REG) /** CFGR1 devices */ #define MCO1_SEL(val) STM32_MCO_CFGR(val, 0xF, 24, CFGR1_REG) diff --git a/include/zephyr/dt-bindings/clock/stm32f1_clock.h b/include/zephyr/dt-bindings/clock/stm32f1_clock.h index 31e7d99b8303e..a7e16ba2f7970 100644 --- a/include/zephyr/dt-bindings/clock/stm32f1_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32f1_clock.h @@ -49,7 +49,7 @@ * @param mask Mask for the RCC_CFGRx field. * @param val Clock value (0, 1, ... 7). */ -#define STM32_CLOCK(val, mask, shift, reg) \ +#define STM32_DOMAIN_CLOCK(val, mask, shift, reg) \ ((((reg) & STM32_CLOCK_REG_MASK) << STM32_CLOCK_REG_SHIFT) | \ (((shift) & STM32_CLOCK_SHIFT_MASK) << STM32_CLOCK_SHIFT_SHIFT) | \ (((mask) & STM32_CLOCK_MASK_MASK) << STM32_CLOCK_MASK_SHIFT) | \ @@ -64,10 +64,10 @@ /** @brief Device domain clocks selection helpers */ /** CFGR2 devices */ -#define I2S2_SEL(val) STM32_CLOCK(val, 1, 17, CFGR2_REG) -#define I2S3_SEL(val) STM32_CLOCK(val, 1, 18, CFGR2_REG) +#define I2S2_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 17, CFGR2_REG) +#define I2S3_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 18, CFGR2_REG) /** BDCR devices */ -#define RTC_SEL(val) STM32_CLOCK(val, 3, 8, BDCR_REG) +#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, BDCR_REG) /** CFGR1 devices */ #define MCO1_SEL(val) STM32_MCO_CFGR(val, 0x7, 24, CFGR1_REG) diff --git a/include/zephyr/dt-bindings/clock/stm32f3_clock.h b/include/zephyr/dt-bindings/clock/stm32f3_clock.h index eb7f5780ad97b..c00d1dd59c38a 100644 --- a/include/zephyr/dt-bindings/clock/stm32f3_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32f3_clock.h @@ -53,7 +53,7 @@ * @param mask Mask for the RCC_CFGRx field. * @param val Clock value (0, 1, ... 7). */ -#define STM32_CLOCK(val, mask, shift, reg) \ +#define STM32_DOMAIN_CLOCK(val, mask, shift, reg) \ ((((reg) & STM32_CLOCK_REG_MASK) << STM32_CLOCK_REG_SHIFT) | \ (((shift) & STM32_CLOCK_SHIFT_MASK) << STM32_CLOCK_SHIFT_SHIFT) | \ (((mask) & STM32_CLOCK_MASK_MASK) << STM32_CLOCK_MASK_SHIFT) | \ @@ -68,27 +68,27 @@ /** @brief Device domain clocks selection helpers) */ /** CFGR devices */ -#define I2S_SEL(val) STM32_CLOCK(val, 1, 23, CFGR_REG) +#define I2S_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 23, CFGR_REG) #define MCO1_SEL(val) STM32_MCO_CFGR(val, 0x7, 24, CFGR_REG) #define MCO1_PRE(val) STM32_MCO_CFGR(val, 0x7, 28, CFGR_REG) /** CFGR3 devices */ -#define USART1_SEL(val) STM32_CLOCK(val, 3, 0, CFGR3_REG) -#define I2C1_SEL(val) STM32_CLOCK(val, 1, 4, CFGR3_REG) -#define I2C2_SEL(val) STM32_CLOCK(val, 1, 5, CFGR3_REG) -#define I2C3_SEL(val) STM32_CLOCK(val, 1, 6, CFGR3_REG) -#define TIM1_SEL(val) STM32_CLOCK(val, 1, 8, CFGR3_REG) -#define TIM8_SEL(val) STM32_CLOCK(val, 1, 9, CFGR3_REG) -#define TIM15_SEL(val) STM32_CLOCK(val, 1, 10, CFGR3_REG) -#define TIM16_SEL(val) STM32_CLOCK(val, 1, 11, CFGR3_REG) -#define TIM17_SEL(val) STM32_CLOCK(val, 1, 13, CFGR3_REG) -#define TIM20_SEL(val) STM32_CLOCK(val, 1, 15, CFGR3_REG) -#define USART2_SEL(val) STM32_CLOCK(val, 3, 16, CFGR3_REG) -#define USART3_SEL(val) STM32_CLOCK(val, 3, 18, CFGR3_REG) -#define USART4_SEL(val) STM32_CLOCK(val, 3, 20, CFGR3_REG) -#define USART5_SEL(val) STM32_CLOCK(val, 3, 22, CFGR3_REG) -#define TIM2_SEL(val) STM32_CLOCK(val, 1, 24, CFGR3_REG) -#define TIM3_4_SEL(val) STM32_CLOCK(val, 1, 25, CFGR3_REG) +#define USART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 0, CFGR3_REG) +#define I2C1_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 4, CFGR3_REG) +#define I2C2_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 5, CFGR3_REG) +#define I2C3_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 6, CFGR3_REG) +#define TIM1_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 8, CFGR3_REG) +#define TIM8_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 9, CFGR3_REG) +#define TIM15_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 10, CFGR3_REG) +#define TIM16_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 11, CFGR3_REG) +#define TIM17_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 13, CFGR3_REG) +#define TIM20_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 15, CFGR3_REG) +#define USART2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 16, CFGR3_REG) +#define USART3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 18, CFGR3_REG) +#define USART4_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 20, CFGR3_REG) +#define USART5_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 22, CFGR3_REG) +#define TIM2_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 24, CFGR3_REG) +#define TIM3_4_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 25, CFGR3_REG) /** BDCR devices */ -#define RTC_SEL(val) STM32_CLOCK(val, 3, 8, BDCR_REG) +#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, BDCR_REG) #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32F3_CLOCK_H_ */ diff --git a/include/zephyr/dt-bindings/clock/stm32f410_clock.h b/include/zephyr/dt-bindings/clock/stm32f410_clock.h index 073d7c3b5f3f8..fffd47321f6e8 100644 --- a/include/zephyr/dt-bindings/clock/stm32f410_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32f410_clock.h @@ -12,19 +12,19 @@ /** @brief Device domain clocks selection helpers */ /** DCKCFGR devices */ -#define CKDFSDM2A_SEL(val) STM32_CLOCK(val, 1, 14, DCKCFGR_REG) -#define CKDFSDM1A_SEL(val) STM32_CLOCK(val, 1, 15, DCKCFGR_REG) -#define SAI1A_SEL(val) STM32_CLOCK(val, 3, 20, DCKCFGR_REG) -#define SAI1B_SEL(val) STM32_CLOCK(val, 3, 22, DCKCFGR_REG) -#define I2S1_SEL(val) STM32_CLOCK(val, 3, 25, DCKCFGR_REG) -#define I2S2_SEL(val) STM32_CLOCK(val, 3, 27, DCKCFGR_REG) -#define CKDFSDM_SEL(val) STM32_CLOCK(val, 1, 31, DCKCFGR_REG) +#define CKDFSDM2A_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 14, DCKCFGR_REG) +#define CKDFSDM1A_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 15, DCKCFGR_REG) +#define SAI1A_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 20, DCKCFGR_REG) +#define SAI1B_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 22, DCKCFGR_REG) +#define I2S1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 25, DCKCFGR_REG) +#define I2S2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 27, DCKCFGR_REG) +#define CKDFSDM_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 31, DCKCFGR_REG) /** DCKCFGR2 devices */ -#define I2CFMP1_SEL(val) STM32_CLOCK(val, 3, 22, DCKCFGR2_REG) -#define CK48M_SEL(val) STM32_CLOCK(val, 1, 27, DCKCFGR2_REG) -#define SDIO_SEL(val) STM32_CLOCK(val, 1, 28, DCKCFGR2_REG) -#define LPTIM1_SEL(val) STM32_CLOCK(val, 3, 30, DCKCFGR2_REG) +#define I2CFMP1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 22, DCKCFGR2_REG) +#define CK48M_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 27, DCKCFGR2_REG) +#define SDIO_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 28, DCKCFGR2_REG) +#define LPTIM1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 30, DCKCFGR2_REG) /* F4 generic I2S_SEL is not compatible with F410 devices */ #ifdef I2S_SEL diff --git a/include/zephyr/dt-bindings/clock/stm32f427_clock.h b/include/zephyr/dt-bindings/clock/stm32f427_clock.h index 46370be53a063..97d22836be512 100644 --- a/include/zephyr/dt-bindings/clock/stm32f427_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32f427_clock.h @@ -11,12 +11,12 @@ /** @brief Device domain clocks selection helpers */ /** DCKCFGR devices */ -#define CKDFSDM2A_SEL(val) STM32_CLOCK(val, 1, 14, DCKCFGR_REG) -#define CKDFSDM1A_SEL(val) STM32_CLOCK(val, 1, 15, DCKCFGR_REG) -#define SAI1A_SEL(val) STM32_CLOCK(val, 3, 20, DCKCFGR_REG) -#define SAI1B_SEL(val) STM32_CLOCK(val, 3, 22, DCKCFGR_REG) -#define CLK48M_SEL(val) STM32_CLOCK(val, 1, 27, DCKCFGR_REG) -#define SDMMC_SEL(val) STM32_CLOCK(val, 1, 28, DCKCFGR_REG) -#define DSI_SEL(val) STM32_CLOCK(val, 1, 29, DCKCFGR_REG) +#define CKDFSDM2A_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 14, DCKCFGR_REG) +#define CKDFSDM1A_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 15, DCKCFGR_REG) +#define SAI1A_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 20, DCKCFGR_REG) +#define SAI1B_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 22, DCKCFGR_REG) +#define CLK48M_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 27, DCKCFGR_REG) +#define SDMMC_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 28, DCKCFGR_REG) +#define DSI_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 29, DCKCFGR_REG) #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32F427_CLOCK_H_ */ diff --git a/include/zephyr/dt-bindings/clock/stm32f4_clock.h b/include/zephyr/dt-bindings/clock/stm32f4_clock.h index 975f90bea39a2..f3712555e80c9 100644 --- a/include/zephyr/dt-bindings/clock/stm32f4_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32f4_clock.h @@ -60,7 +60,7 @@ * @param mask Mask for the RCC_CFGRx field. * @param val Clock value (0, 1, ... 7). */ -#define STM32_CLOCK(val, mask, shift, reg) \ +#define STM32_DOMAIN_CLOCK(val, mask, shift, reg) \ ((((reg) & STM32_CLOCK_REG_MASK) << STM32_CLOCK_REG_SHIFT) | \ (((shift) & STM32_CLOCK_SHIFT_MASK) << STM32_CLOCK_SHIFT_SHIFT) | \ (((mask) & STM32_CLOCK_MASK_MASK) << STM32_CLOCK_MASK_SHIFT) | \ @@ -73,12 +73,12 @@ /** @brief Device domain clocks selection helpers */ /** CFGR devices */ -#define I2S_SEL(val) STM32_CLOCK(val, 1, 23, CFGR_REG) +#define I2S_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 23, CFGR_REG) #define MCO1_SEL(val) STM32_MCO_CFGR(val, 0x3, 21, CFGR_REG) #define MCO1_PRE(val) STM32_MCO_CFGR(val, 0x7, 24, CFGR_REG) #define MCO2_SEL(val) STM32_MCO_CFGR(val, 0x3, 30, CFGR_REG) #define MCO2_PRE(val) STM32_MCO_CFGR(val, 0x7, 27, CFGR_REG) /** BDCR devices */ -#define RTC_SEL(val) STM32_CLOCK(val, 3, 8, BDCR_REG) +#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, BDCR_REG) #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32F4_CLOCK_H_ */ diff --git a/include/zephyr/dt-bindings/clock/stm32f7_clock.h b/include/zephyr/dt-bindings/clock/stm32f7_clock.h index c20ba27c3a928..11fbd10308a9e 100644 --- a/include/zephyr/dt-bindings/clock/stm32f7_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32f7_clock.h @@ -63,7 +63,7 @@ * @param mask Mask for the RCC_CFGRx field. * @param val Clock value (0, 1, ... 7). */ -#define STM32_CLOCK(val, mask, shift, reg) \ +#define STM32_DOMAIN_CLOCK(val, mask, shift, reg) \ ((((reg) & STM32_CLOCK_REG_MASK) << STM32_CLOCK_REG_SHIFT) | \ (((shift) & STM32_CLOCK_SHIFT_MASK) << STM32_CLOCK_SHIFT_SHIFT) | \ (((mask) & STM32_CLOCK_MASK_MASK) << STM32_CLOCK_MASK_SHIFT) | \ @@ -77,13 +77,13 @@ /** @brief Device domain clocks selection helpers */ /** CFGR devices */ -#define I2S_SEL(val) STM32_CLOCK(val, 1, 23, CFGR_REG) +#define I2S_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 23, CFGR_REG) #define MCO1_SEL(val) STM32_MCO_CFGR(val, 0x3, 21, CFGR_REG) #define MCO1_PRE(val) STM32_MCO_CFGR(val, 0x7, 24, CFGR_REG) #define MCO2_SEL(val) STM32_MCO_CFGR(val, 0x3, 30, CFGR_REG) #define MCO2_PRE(val) STM32_MCO_CFGR(val, 0x7, 27, CFGR_REG) /** BDCR devices */ -#define RTC_SEL(val) STM32_CLOCK(val, 3, 8, BDCR_REG) +#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, BDCR_REG) /** @brief RCC_DKCFGR register offset */ #define DCKCFGR1_REG 0x8C @@ -91,23 +91,23 @@ /** @brief Dedicated clocks configuration register selection helpers */ /** DKCFGR2 devices */ -#define USART1_SEL(val) STM32_CLOCK(val, 3, 0, DCKCFGR2_REG) -#define USART2_SEL(val) STM32_CLOCK(val, 3, 2, DCKCFGR2_REG) -#define USART3_SEL(val) STM32_CLOCK(val, 3, 4, DCKCFGR2_REG) -#define USART4_SEL(val) STM32_CLOCK(val, 3, 6, DCKCFGR2_REG) -#define USART5_SEL(val) STM32_CLOCK(val, 3, 8, DCKCFGR2_REG) -#define USART6_SEL(val) STM32_CLOCK(val, 3, 10, DCKCFGR2_REG) -#define USART7_SEL(val) STM32_CLOCK(val, 3, 12, DCKCFGR2_REG) -#define USART8_SEL(val) STM32_CLOCK(val, 3, 14, DCKCFGR2_REG) -#define I2C1_SEL(val) STM32_CLOCK(val, 3, 16, DCKCFGR2_REG) -#define I2C2_SEL(val) STM32_CLOCK(val, 3, 18, DCKCFGR2_REG) -#define I2C3_SEL(val) STM32_CLOCK(val, 3, 20, DCKCFGR2_REG) -#define I2C4_SEL(val) STM32_CLOCK(val, 3, 22, DCKCFGR2_REG) -#define LPTIM1_SEL(val) STM32_CLOCK(val, 3, 24, DCKCFGR2_REG) -#define CEC_SEL(val) STM32_CLOCK(val, 1, 26, DCKCFGR2_REG) -#define CK48M_SEL(val) STM32_CLOCK(val, 1, 27, DCKCFGR2_REG) -#define SDMMC1_SEL(val) STM32_CLOCK(val, 1, 28, DCKCFGR2_REG) -#define SDMMC2_SEL(val) STM32_CLOCK(val, 1, 29, DCKCFGR2_REG) -#define DSI_SEL(val) STM32_CLOCK(val, 1, 30, DCKCFGR2_REG) +#define USART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 0, DCKCFGR2_REG) +#define USART2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 2, DCKCFGR2_REG) +#define USART3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 4, DCKCFGR2_REG) +#define USART4_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 6, DCKCFGR2_REG) +#define USART5_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, DCKCFGR2_REG) +#define USART6_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 10, DCKCFGR2_REG) +#define USART7_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 12, DCKCFGR2_REG) +#define USART8_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 14, DCKCFGR2_REG) +#define I2C1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 16, DCKCFGR2_REG) +#define I2C2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 18, DCKCFGR2_REG) +#define I2C3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 20, DCKCFGR2_REG) +#define I2C4_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 22, DCKCFGR2_REG) +#define LPTIM1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 24, DCKCFGR2_REG) +#define CEC_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 26, DCKCFGR2_REG) +#define CK48M_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 27, DCKCFGR2_REG) +#define SDMMC1_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 28, DCKCFGR2_REG) +#define SDMMC2_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 29, DCKCFGR2_REG) +#define DSI_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 30, DCKCFGR2_REG) #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32F7_CLOCK_H_ */ diff --git a/include/zephyr/dt-bindings/clock/stm32g0_clock.h b/include/zephyr/dt-bindings/clock/stm32g0_clock.h index 86d93e83d1479..b7d7714b1b15b 100644 --- a/include/zephyr/dt-bindings/clock/stm32g0_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32g0_clock.h @@ -57,7 +57,7 @@ * @param mask Mask for the RCC_CCIPRx field. * @param val Clock value (0, 1, ... 7). */ -#define STM32_CLOCK(val, mask, shift, reg) \ +#define STM32_DOMAIN_CLOCK(val, mask, shift, reg) \ ((((reg) & STM32_CLOCK_REG_MASK) << STM32_CLOCK_REG_SHIFT) | \ (((shift) & STM32_CLOCK_SHIFT_MASK) << STM32_CLOCK_SHIFT_SHIFT) | \ (((mask) & STM32_CLOCK_MASK_MASK) << STM32_CLOCK_MASK_SHIFT) | \ @@ -72,26 +72,26 @@ /** @brief Device domain clocks selection helpers */ /** CCIPR devices */ -#define USART1_SEL(val) STM32_CLOCK(val, 3, 0, CCIPR_REG) -#define USART2_SEL(val) STM32_CLOCK(val, 3, 2, CCIPR_REG) -#define USART3_SEL(val) STM32_CLOCK(val, 3, 4, CCIPR_REG) -#define CEC_SEL(val) STM32_CLOCK(val, 1, 6, CCIPR_REG) -#define LPUART2_SEL(val) STM32_CLOCK(val, 3, 8, CCIPR_REG) -#define LPUART1_SEL(val) STM32_CLOCK(val, 3, 10, CCIPR_REG) -#define I2C1_SEL(val) STM32_CLOCK(val, 3, 12, CCIPR_REG) -#define I2C2_I2S1_SEL(val) STM32_CLOCK(val, 3, 14, CCIPR_REG) -#define LPTIM1_SEL(val) STM32_CLOCK(val, 3, 18, CCIPR_REG) -#define LPTIM2_SEL(val) STM32_CLOCK(val, 3, 20, CCIPR_REG) -#define TIM1_SEL(val) STM32_CLOCK(val, 1, 22, CCIPR_REG) -#define TIM15_SEL(val) STM32_CLOCK(val, 1, 24, CCIPR_REG) -#define RNG_SEL(val) STM32_CLOCK(val, 3, 26, CCIPR_REG) -#define ADC_SEL(val) STM32_CLOCK(val, 3, 30, CCIPR_REG) +#define USART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 0, CCIPR_REG) +#define USART2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 2, CCIPR_REG) +#define USART3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 4, CCIPR_REG) +#define CEC_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 6, CCIPR_REG) +#define LPUART2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, CCIPR_REG) +#define LPUART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 10, CCIPR_REG) +#define I2C1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 12, CCIPR_REG) +#define I2C2_I2S1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 14, CCIPR_REG) +#define LPTIM1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 18, CCIPR_REG) +#define LPTIM2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 20, CCIPR_REG) +#define TIM1_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 22, CCIPR_REG) +#define TIM15_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 24, CCIPR_REG) +#define RNG_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 26, CCIPR_REG) +#define ADC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 30, CCIPR_REG) /** CCIPR2 devices */ -#define I2S1_SEL(val) STM32_CLOCK(val, 3, 0, CCIPR2_REG) -#define I2S2_SEL(val) STM32_CLOCK(val, 3, 2, CCIPR2_REG) -#define FDCAN_SEL(val) STM32_CLOCK(val, 3, 8, CCIPR2_REG) -#define USB_SEL(val) STM32_CLOCK(val, 3, 12, CCIPR2_REG) +#define I2S1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 0, CCIPR2_REG) +#define I2S2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 2, CCIPR2_REG) +#define FDCAN_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, CCIPR2_REG) +#define USB_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 12, CCIPR2_REG) /** BDCR devices */ -#define RTC_SEL(val) STM32_CLOCK(val, 3, 8, BDCR_REG) +#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, BDCR_REG) #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32G0_CLOCK_H_ */ diff --git a/include/zephyr/dt-bindings/clock/stm32g4_clock.h b/include/zephyr/dt-bindings/clock/stm32g4_clock.h index 0cc0b1be2dc8d..a7d928c801f49 100644 --- a/include/zephyr/dt-bindings/clock/stm32g4_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32g4_clock.h @@ -61,7 +61,7 @@ * @param mask Mask for the RCC_CCIPRx field. * @param val Clock value (0, 1, ... 7). */ -#define STM32_CLOCK(val, mask, shift, reg) \ +#define STM32_DOMAIN_CLOCK(val, mask, shift, reg) \ ((((reg) & STM32_CLOCK_REG_MASK) << STM32_CLOCK_REG_SHIFT) | \ (((shift) & STM32_CLOCK_SHIFT_MASK) << STM32_CLOCK_SHIFT_SHIFT) | \ (((mask) & STM32_CLOCK_MASK_MASK) << STM32_CLOCK_MASK_SHIFT) | \ @@ -76,26 +76,26 @@ /** @brief Device domain clocks selection helpers */ /** CCIPR devices */ -#define USART1_SEL(val) STM32_CLOCK(val, 3, 0, CCIPR_REG) -#define USART2_SEL(val) STM32_CLOCK(val, 3, 2, CCIPR_REG) -#define USART3_SEL(val) STM32_CLOCK(val, 3, 4, CCIPR_REG) -#define USART4_SEL(val) STM32_CLOCK(val, 3, 6, CCIPR_REG) -#define USART5_SEL(val) STM32_CLOCK(val, 3, 8, CCIPR_REG) -#define LPUART1_SEL(val) STM32_CLOCK(val, 3, 10, CCIPR_REG) -#define I2C1_SEL(val) STM32_CLOCK(val, 3, 12, CCIPR_REG) -#define I2C2_SEL(val) STM32_CLOCK(val, 3, 14, CCIPR_REG) -#define I2C3_SEL(val) STM32_CLOCK(val, 3, 16, CCIPR_REG) -#define LPTIM1_SEL(val) STM32_CLOCK(val, 3, 18, CCIPR_REG) -#define SAI1_SEL(val) STM32_CLOCK(val, 3, 20, CCIPR_REG) -#define I2S23_SEL(val) STM32_CLOCK(val, 3, 22, CCIPR_REG) -#define FDCAN_SEL(val) STM32_CLOCK(val, 3, 24, CCIPR_REG) -#define CLK48_SEL(val) STM32_CLOCK(val, 3, 26, CCIPR_REG) -#define ADC12_SEL(val) STM32_CLOCK(val, 3, 28, CCIPR_REG) -#define ADC34_SEL(val) STM32_CLOCK(val, 3, 30, CCIPR_REG) +#define USART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 0, CCIPR_REG) +#define USART2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 2, CCIPR_REG) +#define USART3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 4, CCIPR_REG) +#define USART4_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 6, CCIPR_REG) +#define USART5_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, CCIPR_REG) +#define LPUART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 10, CCIPR_REG) +#define I2C1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 12, CCIPR_REG) +#define I2C2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 14, CCIPR_REG) +#define I2C3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 16, CCIPR_REG) +#define LPTIM1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 18, CCIPR_REG) +#define SAI1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 20, CCIPR_REG) +#define I2S23_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 22, CCIPR_REG) +#define FDCAN_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 24, CCIPR_REG) +#define CLK48_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 26, CCIPR_REG) +#define ADC12_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 28, CCIPR_REG) +#define ADC34_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 30, CCIPR_REG) /** CCIPR2 devices */ -#define I2C4_SEL(val) STM32_CLOCK(val, 3, 0, CCIPR2_REG) -#define QSPI_SEL(val) STM32_CLOCK(val, 3, 20, CCIPR2_REG) +#define I2C4_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 0, CCIPR2_REG) +#define QSPI_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 20, CCIPR2_REG) /** BDCR devices */ -#define RTC_SEL(val) STM32_CLOCK(val, 3, 8, BDCR_REG) +#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, BDCR_REG) #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32G4_CLOCK_H_ */ diff --git a/include/zephyr/dt-bindings/clock/stm32h5_clock.h b/include/zephyr/dt-bindings/clock/stm32h5_clock.h index 25e0d7ab7ba39..0fb5d9166aa39 100644 --- a/include/zephyr/dt-bindings/clock/stm32h5_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32h5_clock.h @@ -73,7 +73,7 @@ * @param mask Mask for the RCC_CCIPRx field. * @param val Clock value (0, 1, ... 7). */ -#define STM32_CLOCK(val, mask, shift, reg) \ +#define STM32_DOMAIN_CLOCK(val, mask, shift, reg) \ ((((reg) & STM32_CLOCK_REG_MASK) << STM32_CLOCK_REG_SHIFT) | \ (((shift) & STM32_CLOCK_SHIFT_MASK) << STM32_CLOCK_SHIFT_SHIFT) | \ (((mask) & STM32_CLOCK_MASK_MASK) << STM32_CLOCK_MASK_SHIFT) | \ @@ -94,61 +94,61 @@ /** @brief Device domain clocks selection helpers */ /** CCIPR1 devices */ -#define USART1_SEL(val) STM32_CLOCK(val, 7, 0, CCIPR1_REG) -#define USART2_SEL(val) STM32_CLOCK(val, 7, 3, CCIPR1_REG) -#define USART3_SEL(val) STM32_CLOCK(val, 7, 6, CCIPR1_REG) -#define USART4_SEL(val) STM32_CLOCK(val, 7, 9, CCIPR1_REG) -#define USART5_SEL(val) STM32_CLOCK(val, 7, 12, CCIPR1_REG) -#define USART6_SEL(val) STM32_CLOCK(val, 7, 15, CCIPR1_REG) -#define USART7_SEL(val) STM32_CLOCK(val, 7, 18, CCIPR1_REG) -#define USART8_SEL(val) STM32_CLOCK(val, 7, 21, CCIPR1_REG) -#define USART9_SEL(val) STM32_CLOCK(val, 7, 24, CCIPR1_REG) -#define USART10_SEL(val) STM32_CLOCK(val, 7, 27, CCIPR1_REG) -#define TIMIC_SEL(val) STM32_CLOCK(val, 1, 31, CCIPR1_REG) +#define USART1_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 0, CCIPR1_REG) +#define USART2_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 3, CCIPR1_REG) +#define USART3_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 6, CCIPR1_REG) +#define USART4_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 9, CCIPR1_REG) +#define USART5_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 12, CCIPR1_REG) +#define USART6_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 15, CCIPR1_REG) +#define USART7_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 18, CCIPR1_REG) +#define USART8_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 21, CCIPR1_REG) +#define USART9_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 24, CCIPR1_REG) +#define USART10_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 27, CCIPR1_REG) +#define TIMIC_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 31, CCIPR1_REG) /** CCIPR2 devices */ -#define USART11_SEL(val) STM32_CLOCK(val, 7, 0, CCIPR2_REG) -#define USART12_SEL(val) STM32_CLOCK(val, 7, 4, CCIPR2_REG) -#define LPTIM1_SEL(val) STM32_CLOCK(val, 7, 8, CCIPR2_REG) -#define LPTIM2_SEL(val) STM32_CLOCK(val, 7, 12, CCIPR2_REG) -#define LPTIM3_SEL(val) STM32_CLOCK(val, 7, 16, CCIPR2_REG) -#define LPTIM4_SEL(val) STM32_CLOCK(val, 7, 20, CCIPR2_REG) -#define LPTIM5_SEL(val) STM32_CLOCK(val, 7, 24, CCIPR2_REG) -#define LPTIM6_SEL(val) STM32_CLOCK(val, 7, 28, CCIPR2_REG) +#define USART11_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 0, CCIPR2_REG) +#define USART12_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 4, CCIPR2_REG) +#define LPTIM1_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 8, CCIPR2_REG) +#define LPTIM2_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 12, CCIPR2_REG) +#define LPTIM3_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 16, CCIPR2_REG) +#define LPTIM4_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 20, CCIPR2_REG) +#define LPTIM5_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 24, CCIPR2_REG) +#define LPTIM6_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 28, CCIPR2_REG) /** CCIPR3 devices */ -#define SPI1_SEL(val) STM32_CLOCK(val, 7, 0, CCIPR3_REG) -#define SPI2_SEL(val) STM32_CLOCK(val, 7, 3, CCIPR3_REG) -#define SPI3_SEL(val) STM32_CLOCK(val, 7, 6, CCIPR3_REG) -#define SPI4_SEL(val) STM32_CLOCK(val, 7, 9, CCIPR3_REG) -#define SPI5_SEL(val) STM32_CLOCK(val, 7, 12, CCIPR3_REG) -#define SPI6_SEL(val) STM32_CLOCK(val, 7, 15, CCIPR2_REG) -#define LPUART1_SEL(val) STM32_CLOCK(val, 7, 24, CCIPR3_REG) +#define SPI1_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 0, CCIPR3_REG) +#define SPI2_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 3, CCIPR3_REG) +#define SPI3_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 6, CCIPR3_REG) +#define SPI4_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 9, CCIPR3_REG) +#define SPI5_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 12, CCIPR3_REG) +#define SPI6_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 15, CCIPR2_REG) +#define LPUART1_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 24, CCIPR3_REG) /** CCIPR4 devices */ -#define OCTOSPI1_SEL(val) STM32_CLOCK(val, 3, 0, CCIPR4_REG) -#define SYSTICK_SEL(val) STM32_CLOCK(val, 3, 2, CCIPR4_REG) -#define USB_SEL(val) STM32_CLOCK(val, 3, 4, CCIPR4_REG) -#define SDMMC1_SEL(val) STM32_CLOCK(val, 1, 6, CCIPR4_REG) -#define SDMMC2_SEL(val) STM32_CLOCK(val, 1, 7, CCIPR4_REG) -#define I2C1_SEL(val) STM32_CLOCK(val, 3, 16, CCIPR4_REG) -#define I2C2_SEL(val) STM32_CLOCK(val, 3, 18, CCIPR4_REG) -#define I2C3_SEL(val) STM32_CLOCK(val, 3, 20, CCIPR4_REG) -#define I2C4_SEL(val) STM32_CLOCK(val, 3, 22, CCIPR4_REG) -#define I3C1_SEL(val) STM32_CLOCK(val, 3, 24, CCIPR4_REG) +#define OCTOSPI1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 0, CCIPR4_REG) +#define SYSTICK_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 2, CCIPR4_REG) +#define USB_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 4, CCIPR4_REG) +#define SDMMC1_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 6, CCIPR4_REG) +#define SDMMC2_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 7, CCIPR4_REG) +#define I2C1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 16, CCIPR4_REG) +#define I2C2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 18, CCIPR4_REG) +#define I2C3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 20, CCIPR4_REG) +#define I2C4_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 22, CCIPR4_REG) +#define I3C1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 24, CCIPR4_REG) /** CCIPR5 devices */ -#define ADCDAC_SEL(val) STM32_CLOCK(val, 7, 0, CCIPR5_REG) -#define DAC_SEL(val) STM32_CLOCK(val, 1, 3, CCIPR5_REG) -#define RNG_SEL(val) STM32_CLOCK(val, 3, 4, CCIPR5_REG) -#define CEC_SEL(val) STM32_CLOCK(val, 3, 6, CCIPR5_REG) -#define FDCAN_SEL(val) STM32_CLOCK(val, 3, 8, CCIPR5_REG) -#define SAI1_SEL(val) STM32_CLOCK(val, 7, 16, CCIPR5_REG) -#define SAI2_SEL(val) STM32_CLOCK(val, 7, 19, CCIPR5_REG) -#define CKPER_SEL(val) STM32_CLOCK(val, 3, 30, CCIPR5_REG) +#define ADCDAC_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 0, CCIPR5_REG) +#define DAC_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 3, CCIPR5_REG) +#define RNG_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 4, CCIPR5_REG) +#define CEC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 6, CCIPR5_REG) +#define FDCAN_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, CCIPR5_REG) +#define SAI1_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 16, CCIPR5_REG) +#define SAI2_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 19, CCIPR5_REG) +#define CKPER_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 30, CCIPR5_REG) /** BDCR devices */ -#define RTC_SEL(val) STM32_CLOCK(val, 3, 8, BDCR_REG) +#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, BDCR_REG) /** CFGR1 devices */ #define MCO1_SEL(val) STM32_MCO_CFGR(val, 0x7, 22, CFGR1_REG) diff --git a/include/zephyr/dt-bindings/clock/stm32h7_clock.h b/include/zephyr/dt-bindings/clock/stm32h7_clock.h index e38ac61e2b3c2..b844612edd4cc 100644 --- a/include/zephyr/dt-bindings/clock/stm32h7_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32h7_clock.h @@ -80,7 +80,7 @@ * @param mask Mask for the RCC_DxCCIP field. * @param val Clock value (0, 1, 2 or 3). */ -#define STM32_CLOCK(val, mask, shift, reg) \ +#define STM32_DOMAIN_CLOCK(val, mask, shift, reg) \ ((((reg) & STM32_CLOCK_REG_MASK) << STM32_CLOCK_REG_SHIFT) | \ (((shift) & STM32_CLOCK_SHIFT_MASK) << STM32_CLOCK_SHIFT_SHIFT) | \ (((mask) & STM32_CLOCK_MASK_MASK) << STM32_CLOCK_MASK_SHIFT) | \ @@ -100,41 +100,41 @@ /** @brief Device domain clocks selection helpers (RM0399.pdf) */ /** D1CCIPR devices */ -#define FMC_SEL(val) STM32_CLOCK(val, 3, 0, D1CCIPR_REG) -#define QSPI_SEL(val) STM32_CLOCK(val, 3, 4, D1CCIPR_REG) -#define DSI_SEL(val) STM32_CLOCK(val, 1, 8, D1CCIPR_REG) -#define SDMMC_SEL(val) STM32_CLOCK(val, 1, 16, D1CCIPR_REG) -#define CKPER_SEL(val) STM32_CLOCK(val, 3, 28, D1CCIPR_REG) +#define FMC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 0, D1CCIPR_REG) +#define QSPI_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 4, D1CCIPR_REG) +#define DSI_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 8, D1CCIPR_REG) +#define SDMMC_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 16, D1CCIPR_REG) +#define CKPER_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 28, D1CCIPR_REG) /* Device domain clocks selection helpers (RM0468.pdf) */ -#define OSPI_SEL(val) STM32_CLOCK(val, 3, 4, D1CCIPR_REG) +#define OSPI_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 4, D1CCIPR_REG) /** D2CCIP1R devices */ -#define SAI1_SEL(val) STM32_CLOCK(val, 7, 0, D2CCIP1R_REG) -#define SAI23_SEL(val) STM32_CLOCK(val, 7, 6, D2CCIP1R_REG) -#define SPI123_SEL(val) STM32_CLOCK(val, 7, 12, D2CCIP1R_REG) -#define SPI45_SEL(val) STM32_CLOCK(val, 7, 16, D2CCIP1R_REG) -#define SPDIF_SEL(val) STM32_CLOCK(val, 3, 20, D2CCIP1R_REG) -#define DFSDM1_SEL(val) STM32_CLOCK(val, 1, 24, D2CCIP1R_REG) -#define FDCAN_SEL(val) STM32_CLOCK(val, 3, 28, D2CCIP1R_REG) -#define SWP_SEL(val) STM32_CLOCK(val, 1, 31, D2CCIP1R_REG) +#define SAI1_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 0, D2CCIP1R_REG) +#define SAI23_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 6, D2CCIP1R_REG) +#define SPI123_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 12, D2CCIP1R_REG) +#define SPI45_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 16, D2CCIP1R_REG) +#define SPDIF_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 20, D2CCIP1R_REG) +#define DFSDM1_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 24, D2CCIP1R_REG) +#define FDCAN_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 28, D2CCIP1R_REG) +#define SWP_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 31, D2CCIP1R_REG) /** D2CCIP2R devices */ -#define USART2345678_SEL(val) STM32_CLOCK(val, 7, 0, D2CCIP2R_REG) -#define USART16_SEL(val) STM32_CLOCK(val, 7, 3, D2CCIP2R_REG) -#define RNG_SEL(val) STM32_CLOCK(val, 3, 8, D2CCIP2R_REG) -#define I2C123_SEL(val) STM32_CLOCK(val, 3, 12, D2CCIP2R_REG) -#define USB_SEL(val) STM32_CLOCK(val, 3, 20, D2CCIP2R_REG) -#define CEC_SEL(val) STM32_CLOCK(val, 3, 22, D2CCIP2R_REG) -#define LPTIM1_SEL(val) STM32_CLOCK(val, 7, 28, D2CCIP2R_REG) +#define USART2345678_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 0, D2CCIP2R_REG) +#define USART16_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 3, D2CCIP2R_REG) +#define RNG_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, D2CCIP2R_REG) +#define I2C123_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 12, D2CCIP2R_REG) +#define USB_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 20, D2CCIP2R_REG) +#define CEC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 22, D2CCIP2R_REG) +#define LPTIM1_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 28, D2CCIP2R_REG) /** D3CCIPR devices */ -#define LPUART1_SEL(val) STM32_CLOCK(val, 7, 0, D3CCIPR_REG) -#define I2C4_SEL(val) STM32_CLOCK(val, 3, 8, D3CCIPR_REG) -#define LPTIM2_SEL(val) STM32_CLOCK(val, 7, 10, D3CCIPR_REG) -#define LPTIM345_SEL(val) STM32_CLOCK(val, 7, 13, D3CCIPR_REG) -#define ADC_SEL(val) STM32_CLOCK(val, 3, 16, D3CCIPR_REG) -#define SAI4A_SEL(val) STM32_CLOCK(val, 7, 21, D3CCIPR_REG) -#define SAI4B_SEL(val) STM32_CLOCK(val, 7, 24, D3CCIPR_REG) -#define SPI6_SEL(val) STM32_CLOCK(val, 7, 28, D3CCIPR_REG) +#define LPUART1_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 0, D3CCIPR_REG) +#define I2C4_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, D3CCIPR_REG) +#define LPTIM2_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 10, D3CCIPR_REG) +#define LPTIM345_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 13, D3CCIPR_REG) +#define ADC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 16, D3CCIPR_REG) +#define SAI4A_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 21, D3CCIPR_REG) +#define SAI4B_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 24, D3CCIPR_REG) +#define SPI6_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 28, D3CCIPR_REG) /** BDCR devices */ -#define RTC_SEL(val) STM32_CLOCK(val, 3, 8, BDCR_REG) +#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, BDCR_REG) /** CFGR devices */ #define MCO1_SEL(val) STM32_MCO_CFGR(val, 0xF, 22, CFGR_REG) #define MCO1_PRE(val) STM32_MCO_CFGR(val, 0x7, 18, CFGR_REG) diff --git a/include/zephyr/dt-bindings/clock/stm32h7rs_clock.h b/include/zephyr/dt-bindings/clock/stm32h7rs_clock.h index d16f820815232..38f7d1734d31b 100644 --- a/include/zephyr/dt-bindings/clock/stm32h7rs_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32h7rs_clock.h @@ -76,7 +76,7 @@ * @param mask Mask for the RCC_DxCCIP field. * @param val Clock value (0, 1, 2 or 3). */ -#define STM32_CLOCK(val, mask, shift, reg) \ +#define STM32_DOMAIN_CLOCK(val, mask, shift, reg) \ ((((reg) & STM32_CLOCK_REG_MASK) << STM32_CLOCK_REG_SHIFT) | \ (((shift) & STM32_CLOCK_SHIFT_MASK) << STM32_CLOCK_SHIFT_SHIFT) | \ (((mask) & STM32_CLOCK_MASK_MASK) << STM32_CLOCK_MASK_SHIFT) | \ @@ -99,37 +99,37 @@ /* TODO to be completed */ /** D1CCIPR devices */ -#define FMC_SEL(val) STM32_CLOCK(val, 3, 0, D1CCIPR_REG) -#define SDMMC_SEL(val) STM32_CLOCK(val, 1, 2, D1CCIPR_REG) -#define XSPI1_SEL(val) STM32_CLOCK(val, 3, 4, D1CCIPR_REG) -#define XSPI2_SEL(val) STM32_CLOCK(val, 3, 6, D1CCIPR_REG) -#define ADC_SEL(val) STM32_CLOCK(val, 3, 24, D1CCIPR_REG) -#define CKPER_SEL(val) STM32_CLOCK(val, 3, 28, D1CCIPR_REG) +#define FMC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 0, D1CCIPR_REG) +#define SDMMC_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 2, D1CCIPR_REG) +#define XSPI1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 4, D1CCIPR_REG) +#define XSPI2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 6, D1CCIPR_REG) +#define ADC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 24, D1CCIPR_REG) +#define CKPER_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 28, D1CCIPR_REG) /** D2CCIPR devices */ -#define USART234578_SEL(val) STM32_CLOCK(val, 7, 0, D2CCIPR_REG) -#define SPI23_SEL(val) STM32_CLOCK(val, 7, 4, D2CCIPR_REG) -#define I2C23_SEL(val) STM32_CLOCK(val, 3, 8, D2CCIPR_REG) -#define I2C1_SEL(val) STM32_CLOCK(val, 3, 12, D2CCIPR_REG) -#define I3C1_SEL(val) STM32_CLOCK(val, 3, 12, D2CCIPR_REG) -#define LPTIM1_SEL(val) STM32_CLOCK(val, 7, 16, D2CCIPR_REG) -#define FDCAN_SEL(val) STM32_CLOCK(val, 3, 22, D2CCIPR_REG) +#define USART234578_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 0, D2CCIPR_REG) +#define SPI23_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 4, D2CCIPR_REG) +#define I2C23_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, D2CCIPR_REG) +#define I2C1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 12, D2CCIPR_REG) +#define I3C1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 12, D2CCIPR_REG) +#define LPTIM1_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 16, D2CCIPR_REG) +#define FDCAN_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 22, D2CCIPR_REG) /** D3CCIPR devices */ -#define USART1_SEL(val) STM32_CLOCK(val, 7, 0, D3CCIPR_REG) -#define SPI45_SEL(val) STM32_CLOCK(val, 7, 4, D3CCIPR_REG) -#define SPI1_SEL(val) STM32_CLOCK(val, 7, 8, D3CCIPR_REG) -#define SAI1_SEL(val) STM32_CLOCK(val, 7, 16, D3CCIPR_REG) -#define SAI2_SEL(val) STM32_CLOCK(val, 7, 20, D3CCIPR_REG) +#define USART1_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 0, D3CCIPR_REG) +#define SPI45_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 4, D3CCIPR_REG) +#define SPI1_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 8, D3CCIPR_REG) +#define SAI1_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 16, D3CCIPR_REG) +#define SAI2_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 20, D3CCIPR_REG) /** D4CCIPR devices */ -#define LPUART1_SEL(val) STM32_CLOCK(val, 7, 0, D4CCIPR_REG) -#define SPI6_SEL(val) STM32_CLOCK(val, 7, 4, D4CCIPR_REG) -#define LPTIM23_SEL(val) STM32_CLOCK(val, 7, 8, D4CCIPR_REG) -#define LPTIM45_SEL(val) STM32_CLOCK(val, 7, 12, D4CCIPR_REG) +#define LPUART1_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 0, D4CCIPR_REG) +#define SPI6_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 4, D4CCIPR_REG) +#define LPTIM23_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 8, D4CCIPR_REG) +#define LPTIM45_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 12, D4CCIPR_REG) /** BDCR devices */ -#define RTC_SEL(val) STM32_CLOCK(val, 3, 8, BDCR_REG) +#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, BDCR_REG) /** CFGR devices */ #define MCO1_SEL(val) STM32_MCO_CFGR(val, 0x7, 22, CFGR_REG) diff --git a/include/zephyr/dt-bindings/clock/stm32l0_clock.h b/include/zephyr/dt-bindings/clock/stm32l0_clock.h index 5c4d80a2b34ec..c16e367a94e32 100644 --- a/include/zephyr/dt-bindings/clock/stm32l0_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32l0_clock.h @@ -53,7 +53,7 @@ * @param mask Mask for the RCC_CCIPRx field. * @param val Clock value (0, 1, ... 7). */ -#define STM32_CLOCK(val, mask, shift, reg) \ +#define STM32_DOMAIN_CLOCK(val, mask, shift, reg) \ ((((reg) & STM32_CLOCK_REG_MASK) << STM32_CLOCK_REG_SHIFT) | \ (((shift) & STM32_CLOCK_SHIFT_MASK) << STM32_CLOCK_SHIFT_SHIFT) | \ (((mask) & STM32_CLOCK_MASK_MASK) << STM32_CLOCK_MASK_SHIFT) | \ @@ -67,14 +67,14 @@ /** @brief Device domain clocks selection helpers */ /** CCIPR devices */ -#define USART1_SEL(val) STM32_CLOCK(val, 3, 0, CCIPR_REG) -#define USART2_SEL(val) STM32_CLOCK(val, 3, 2, CCIPR_REG) -#define LPUART1_SEL(val) STM32_CLOCK(val, 3, 10, CCIPR_REG) -#define I2C1_SEL(val) STM32_CLOCK(val, 3, 12, CCIPR_REG) -#define I2C3_SEL(val) STM32_CLOCK(val, 3, 16, CCIPR_REG) -#define LPTIM1_SEL(val) STM32_CLOCK(val, 3, 18, CCIPR_REG) -#define HSI48_SEL(val) STM32_CLOCK(val, 1, 26, CCIPR_REG) +#define USART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 0, CCIPR_REG) +#define USART2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 2, CCIPR_REG) +#define LPUART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 10, CCIPR_REG) +#define I2C1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 12, CCIPR_REG) +#define I2C3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 16, CCIPR_REG) +#define LPTIM1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 18, CCIPR_REG) +#define HSI48_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 26, CCIPR_REG) /** CSR devices */ -#define RTC_SEL(val) STM32_CLOCK(val, 3, 16, CSR_REG) +#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 16, CSR_REG) #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32L0_CLOCK_H_ */ diff --git a/include/zephyr/dt-bindings/clock/stm32l1_clock.h b/include/zephyr/dt-bindings/clock/stm32l1_clock.h index 602133e799041..f958f7b6bb8fa 100644 --- a/include/zephyr/dt-bindings/clock/stm32l1_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32l1_clock.h @@ -48,7 +48,7 @@ * @param mask Mask for the RCC_CCIPRx field. * @param val Clock value (0, 1, ... 7). */ -#define STM32_CLOCK(val, mask, shift, reg) \ +#define STM32_DOMAIN_CLOCK(val, mask, shift, reg) \ ((((reg) & STM32_CLOCK_REG_MASK) << STM32_CLOCK_REG_SHIFT) | \ (((shift) & STM32_CLOCK_SHIFT_MASK) << STM32_CLOCK_SHIFT_SHIFT) | \ (((mask) & STM32_CLOCK_MASK_MASK) << STM32_CLOCK_MASK_SHIFT) | \ @@ -57,6 +57,6 @@ /** @brief RCC_CSR register offset */ #define CSR_REG 0x34 -#define RTC_SEL(val) STM32_CLOCK(val, 3, 16, CSR_REG) +#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 16, CSR_REG) #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32L1_CLOCK_H_ */ diff --git a/include/zephyr/dt-bindings/clock/stm32l4_clock.h b/include/zephyr/dt-bindings/clock/stm32l4_clock.h index 806939580f800..3e865f9a880e2 100644 --- a/include/zephyr/dt-bindings/clock/stm32l4_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32l4_clock.h @@ -59,7 +59,7 @@ * @param mask Mask for the RCC_CCIPRx field. * @param val Clock value (0, 1, ... 7). */ -#define STM32_CLOCK(val, mask, shift, reg) \ +#define STM32_DOMAIN_CLOCK(val, mask, shift, reg) \ ((((reg) & STM32_CLOCK_REG_MASK) << STM32_CLOCK_REG_SHIFT) | \ (((shift) & STM32_CLOCK_SHIFT_MASK) << STM32_CLOCK_SHIFT_SHIFT) | \ (((mask) & STM32_CLOCK_MASK_MASK) << STM32_CLOCK_MASK_SHIFT) | \ @@ -77,34 +77,34 @@ /** @brief Device domain clocks selection helpers */ /** CCIPR devices */ -#define USART1_SEL(val) STM32_CLOCK(val, 3, 0, CCIPR_REG) -#define USART2_SEL(val) STM32_CLOCK(val, 3, 2, CCIPR_REG) -#define USART3_SEL(val) STM32_CLOCK(val, 3, 4, CCIPR_REG) -#define UART4_SEL(val) STM32_CLOCK(val, 3, 6, CCIPR_REG) -#define UART5_SEL(val) STM32_CLOCK(val, 3, 8, CCIPR_REG) -#define LPUART1_SEL(val) STM32_CLOCK(val, 3, 10, CCIPR_REG) -#define I2C1_SEL(val) STM32_CLOCK(val, 3, 12, CCIPR_REG) -#define I2C2_SEL(val) STM32_CLOCK(val, 3, 14, CCIPR_REG) -#define I2C3_SEL(val) STM32_CLOCK(val, 3, 16, CCIPR_REG) -#define LPTIM1_SEL(val) STM32_CLOCK(val, 3, 18, CCIPR_REG) -#define LPTIM2_SEL(val) STM32_CLOCK(val, 3, 20, CCIPR_REG) -#define SAI1_SEL(val) STM32_CLOCK(val, 3, 22, CCIPR_REG) -#define SAI2_SEL(val) STM32_CLOCK(val, 3, 24, CCIPR_REG) -#define CLK48_SEL(val) STM32_CLOCK(val, 3, 26, CCIPR_REG) -#define ADC_SEL(val) STM32_CLOCK(val, 3, 28, CCIPR_REG) -#define SWPMI1_SEL(val) STM32_CLOCK(val, 1, 30, CCIPR_REG) -#define DFSDM1_SEL(val) STM32_CLOCK(val, 1, 31, CCIPR_REG) +#define USART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 0, CCIPR_REG) +#define USART2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 2, CCIPR_REG) +#define USART3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 4, CCIPR_REG) +#define UART4_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 6, CCIPR_REG) +#define UART5_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, CCIPR_REG) +#define LPUART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 10, CCIPR_REG) +#define I2C1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 12, CCIPR_REG) +#define I2C2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 14, CCIPR_REG) +#define I2C3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 16, CCIPR_REG) +#define LPTIM1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 18, CCIPR_REG) +#define LPTIM2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 20, CCIPR_REG) +#define SAI1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 22, CCIPR_REG) +#define SAI2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 24, CCIPR_REG) +#define CLK48_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 26, CCIPR_REG) +#define ADC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 28, CCIPR_REG) +#define SWPMI1_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 30, CCIPR_REG) +#define DFSDM1_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 31, CCIPR_REG) /** CCIPR2 devices */ -#define I2C4_SEL(val) STM32_CLOCK(val, 3, 0, CCIPR2_REG) -#define DFSDM_SEL(val) STM32_CLOCK(val, 1, 2, CCIPR2_REG) -#define ADFSDM_SEL(val) STM32_CLOCK(val, 3, 3, CCIPR2_REG) -/* #define SAI1_SEL(val) STM32_CLOCK(val, 7, 5, CCIPR2_REG) */ -/* #define SAI2_SEL(val) STM32_CLOCK(val, 7, 8, CCIPR2_REG) */ -#define DSI_SEL(val) STM32_CLOCK(val, 1, 12, CCIPR2_REG) -#define SDMMC_SEL(val) STM32_CLOCK(val, 1, 14, CCIPR2_REG) -#define OSPI_SEL(val) STM32_CLOCK(val, 3, 20, CCIPR2_REG) +#define I2C4_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 0, CCIPR2_REG) +#define DFSDM_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 2, CCIPR2_REG) +#define ADFSDM_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 3, CCIPR2_REG) +/* #define SAI1_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 5, CCIPR2_REG) */ +/* #define SAI2_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 8, CCIPR2_REG) */ +#define DSI_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 12, CCIPR2_REG) +#define SDMMC_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 14, CCIPR2_REG) +#define OSPI_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 20, CCIPR2_REG) /** BDCR devices */ -#define RTC_SEL(val) STM32_CLOCK(val, 3, 8, BDCR_REG) +#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, BDCR_REG) /** CFGR devices */ #define MCO1_SEL(val) STM32_MCO_CFGR(val, 0xF, 24, CFGR_REG) #define MCO1_PRE(val) STM32_MCO_CFGR(val, 0x7, 28, CFGR_REG) diff --git a/include/zephyr/dt-bindings/clock/stm32u0_clock.h b/include/zephyr/dt-bindings/clock/stm32u0_clock.h index 4dfd1b3a0f335..aee6cbd8518ae 100644 --- a/include/zephyr/dt-bindings/clock/stm32u0_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32u0_clock.h @@ -58,7 +58,7 @@ * @param mask Mask for the RCC_CCIPRx field. * @param val Clock value (0, 1, ... 7). */ -#define STM32_CLOCK(val, mask, shift, reg) \ +#define STM32_DOMAIN_CLOCK(val, mask, shift, reg) \ ((((reg) & STM32_CLOCK_REG_MASK) << STM32_CLOCK_REG_SHIFT) | \ (((shift) & STM32_CLOCK_SHIFT_MASK) << STM32_CLOCK_SHIFT_SHIFT) | \ (((mask) & STM32_CLOCK_MASK_MASK) << STM32_CLOCK_MASK_SHIFT) | \ @@ -72,21 +72,21 @@ /** @brief Device domain clocks selection helpers */ /** CCIPR devices */ -#define USART1_SEL(val) STM32_CLOCK(val, 3, 0, CCIPR_REG) -#define USART2_SEL(val) STM32_CLOCK(val, 3, 2, CCIPR_REG) -#define LPUART3_SEL(val) STM32_CLOCK(val, 3, 6, CCIPR_REG) -#define LPUART2_SEL(val) STM32_CLOCK(val, 3, 8, CCIPR_REG) -#define LPUART1_SEL(val) STM32_CLOCK(val, 3, 10, CCIPR_REG) -#define I2C1_SEL(val) STM32_CLOCK(val, 3, 12, CCIPR_REG) -#define I2C3_SEL(val) STM32_CLOCK(val, 3, 16, CCIPR_REG) -#define LPTIM1_SEL(val) STM32_CLOCK(val, 3, 18, CCIPR_REG) -#define LPTIM2_SEL(val) STM32_CLOCK(val, 3, 20, CCIPR_REG) -#define LPTIM3_SEL(val) STM32_CLOCK(val, 3, 22, CCIPR_REG) -#define TIM1_SEL(val) STM32_CLOCK(val, 1, 24, CCIPR_REG) -#define TIM15_SEL(val) STM32_CLOCK(val, 1, 25, CCIPR_REG) -#define CLK48_SEL(val) STM32_CLOCK(val, 3, 26, CCIPR_REG) -#define ADC_SEL(val) STM32_CLOCK(val, 3, 28, CCIPR_REG) +#define USART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 0, CCIPR_REG) +#define USART2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 2, CCIPR_REG) +#define LPUART3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 6, CCIPR_REG) +#define LPUART2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, CCIPR_REG) +#define LPUART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 10, CCIPR_REG) +#define I2C1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 12, CCIPR_REG) +#define I2C3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 16, CCIPR_REG) +#define LPTIM1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 18, CCIPR_REG) +#define LPTIM2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 20, CCIPR_REG) +#define LPTIM3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 22, CCIPR_REG) +#define TIM1_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 24, CCIPR_REG) +#define TIM15_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 25, CCIPR_REG) +#define CLK48_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 26, CCIPR_REG) +#define ADC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 28, CCIPR_REG) /** BDCR devices */ -#define RTC_SEL(val) STM32_CLOCK(val, 3, 8, CSR_REG) +#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, CSR_REG) #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32U0_CLOCK_H_ */ diff --git a/include/zephyr/dt-bindings/clock/stm32u5_clock.h b/include/zephyr/dt-bindings/clock/stm32u5_clock.h index d9c426a6b36bb..4b9b563121e9c 100644 --- a/include/zephyr/dt-bindings/clock/stm32u5_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32u5_clock.h @@ -74,7 +74,7 @@ * @param mask Mask for the RCC_CCIPRx field. * @param val Clock value (0, 1, ... 7). */ -#define STM32_CLOCK(val, mask, shift, reg) \ +#define STM32_DOMAIN_CLOCK(val, mask, shift, reg) \ ((((reg) & STM32_CLOCK_REG_MASK) << STM32_CLOCK_REG_SHIFT) | \ (((shift) & STM32_CLOCK_SHIFT_MASK) << STM32_CLOCK_SHIFT_SHIFT) | \ (((mask) & STM32_CLOCK_MASK_MASK) << STM32_CLOCK_MASK_SHIFT) | \ @@ -93,47 +93,47 @@ /** @brief Device domain clocks selection helpers */ /** CCIPR1 devices */ -#define USART1_SEL(val) STM32_CLOCK(val, 3, 0, CCIPR1_REG) -#define USART2_SEL(val) STM32_CLOCK(val, 3, 2, CCIPR1_REG) -#define USART3_SEL(val) STM32_CLOCK(val, 3, 4, CCIPR1_REG) -#define UART4_SEL(val) STM32_CLOCK(val, 3, 6, CCIPR1_REG) -#define UART5_SEL(val) STM32_CLOCK(val, 3, 8, CCIPR1_REG) -#define I2C1_SEL(val) STM32_CLOCK(val, 3, 10, CCIPR1_REG) -#define I2C2_SEL(val) STM32_CLOCK(val, 3, 12, CCIPR1_REG) -#define I2C4_SEL(val) STM32_CLOCK(val, 3, 14, CCIPR1_REG) -#define SPI2_SEL(val) STM32_CLOCK(val, 3, 16, CCIPR1_REG) -#define LPTIM2_SEL(val) STM32_CLOCK(val, 3, 18, CCIPR1_REG) -#define SPI1_SEL(val) STM32_CLOCK(val, 3, 20, CCIPR1_REG) -#define SYSTICK_SEL(val) STM32_CLOCK(val, 3, 22, CCIPR1_REG) -#define FDCAN1_SEL(val) STM32_CLOCK(val, 3, 24, CCIPR1_REG) -#define ICKLK_SEL(val) STM32_CLOCK(val, 3, 26, CCIPR1_REG) -#define TIMIC_SEL(val) STM32_CLOCK(val, 7, 29, CCIPR1_REG) +#define USART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 0, CCIPR1_REG) +#define USART2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 2, CCIPR1_REG) +#define USART3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 4, CCIPR1_REG) +#define UART4_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 6, CCIPR1_REG) +#define UART5_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, CCIPR1_REG) +#define I2C1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 10, CCIPR1_REG) +#define I2C2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 12, CCIPR1_REG) +#define I2C4_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 14, CCIPR1_REG) +#define SPI2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 16, CCIPR1_REG) +#define LPTIM2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 18, CCIPR1_REG) +#define SPI1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 20, CCIPR1_REG) +#define SYSTICK_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 22, CCIPR1_REG) +#define FDCAN1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 24, CCIPR1_REG) +#define ICKLK_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 26, CCIPR1_REG) +#define TIMIC_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 29, CCIPR1_REG) /** CCIPR2 devices */ -#define MDF1_SEL(val) STM32_CLOCK(val, 7, 0, CCIPR2_REG) -#define SAI1_SEL(val) STM32_CLOCK(val, 7, 5, CCIPR2_REG) -#define SAI2_SEL(val) STM32_CLOCK(val, 7, 8, CCIPR2_REG) -#define SAE_SEL(val) STM32_CLOCK(val, 1, 11, CCIPR2_REG) -#define RNG_SEL(val) STM32_CLOCK(val, 3, 12, CCIPR2_REG) -#define SDMMC_SEL(val) STM32_CLOCK(val, 1, 14, CCIPR2_REG) -#define DSIHOST_SEL(val) STM32_CLOCK(val, 1, 15, CCIPR2_REG) -#define USART6_SEL(val) STM32_CLOCK(val, 1, 16, CCIPR2_REG) -#define LTDC_SEL(val) STM32_CLOCK(val, 1, 18, CCIPR2_REG) -#define OCTOSPI_SEL(val) STM32_CLOCK(val, 3, 20, CCIPR2_REG) -#define HSPI_SEL(val) STM32_CLOCK(val, 3, 22, CCIPR2_REG) -#define I2C5_SEL(val) STM32_CLOCK(val, 3, 24, CCIPR2_REG) -#define I2C6_SEL(val) STM32_CLOCK(val, 3, 26, CCIPR2_REG) -#define USBPHYC_SEL(val) STM32_CLOCK(val, 3, 30, CCIPR2_REG) +#define MDF1_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 0, CCIPR2_REG) +#define SAI1_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 5, CCIPR2_REG) +#define SAI2_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 8, CCIPR2_REG) +#define SAE_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 11, CCIPR2_REG) +#define RNG_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 12, CCIPR2_REG) +#define SDMMC_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 14, CCIPR2_REG) +#define DSIHOST_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 15, CCIPR2_REG) +#define USART6_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 16, CCIPR2_REG) +#define LTDC_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 18, CCIPR2_REG) +#define OCTOSPI_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 20, CCIPR2_REG) +#define HSPI_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 22, CCIPR2_REG) +#define I2C5_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 24, CCIPR2_REG) +#define I2C6_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 26, CCIPR2_REG) +#define USBPHYC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 30, CCIPR2_REG) /** CCIPR3 devices */ -#define LPUART1_SEL(val) STM32_CLOCK(val, 7, 0, CCIPR3_REG) -#define SPI3_SEL(val) STM32_CLOCK(val, 3, 3, CCIPR3_REG) -#define I2C3_SEL(val) STM32_CLOCK(val, 3, 6, CCIPR3_REG) -#define LPTIM34_SEL(val) STM32_CLOCK(val, 3, 8, CCIPR3_REG) -#define LPTIM1_SEL(val) STM32_CLOCK(val, 3, 10, CCIPR3_REG) -#define ADCDAC_SEL(val) STM32_CLOCK(val, 7, 12, CCIPR3_REG) -#define DAC1_SEL(val) STM32_CLOCK(val, 1, 15, CCIPR3_REG) -#define ADF1_SEL(val) STM32_CLOCK(val, 7, 16, CCIPR3_REG) +#define LPUART1_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 0, CCIPR3_REG) +#define SPI3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 3, CCIPR3_REG) +#define I2C3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 6, CCIPR3_REG) +#define LPTIM34_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, CCIPR3_REG) +#define LPTIM1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 10, CCIPR3_REG) +#define ADCDAC_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 12, CCIPR3_REG) +#define DAC1_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 15, CCIPR3_REG) +#define ADF1_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 16, CCIPR3_REG) /** BDCR devices */ -#define RTC_SEL(val) STM32_CLOCK(val, 3, 8, BDCR_REG) +#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, BDCR_REG) /** CFGR1 devices */ #define MCO1_SEL(val) STM32_MCO_CFGR(val, 0xF, 24, CFGR1_REG) diff --git a/include/zephyr/dt-bindings/clock/stm32wb0_clock.h b/include/zephyr/dt-bindings/clock/stm32wb0_clock.h index 0505526e9683d..23ba8e996086e 100644 --- a/include/zephyr/dt-bindings/clock/stm32wb0_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32wb0_clock.h @@ -49,7 +49,7 @@ * @note 'mask' range: 0x00~0x1F [ 22 : 26 ] * @note 'val' range: 0x00~0x1F [ 27 : 31 ] */ -#define STM32_CLOCK(val, mask, shift, reg) \ +#define STM32_DOMAIN_CLOCK(val, mask, shift, reg) \ ((((reg) & STM32_CLOCK_REG_MASK) << STM32_CLOCK_REG_SHIFT) | \ (((shift) & STM32_CLOCK_SHIFT_MASK) << STM32_CLOCK_SHIFT_SHIFT) | \ (((mask) & STM32_CLOCK_MASK_MASK) << STM32_CLOCK_MASK_SHIFT) | \ @@ -62,9 +62,9 @@ #define APB2ENR_REG 0x60 /** @brief Device clk sources selection helpers */ -#define LPUART1_SEL(val) STM32_CLOCK(val, 1, 13, CFGR_REG) /* WB05/WB09 only */ -#define SPI2_I2S2_SEL(val) STM32_CLOCK(val, 1, 22, CFGR_REG) /* WB06/WB07 only */ +#define LPUART1_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 13, CFGR_REG) /* WB05/WB09 only */ +#define SPI2_I2S2_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 22, CFGR_REG) /* WB06/WB07 only */ /* `mask` is only 0x1 for WB06/WB07, but a single definition with mask=0x3 is acceptable */ -#define SPI3_I2S3_SEL(val) STM32_CLOCK(val, 3, 22, CFGR_REG) +#define SPI3_I2S3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 22, CFGR_REG) #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32WB0_CLOCK_H_ */ diff --git a/include/zephyr/dt-bindings/clock/stm32wb_clock.h b/include/zephyr/dt-bindings/clock/stm32wb_clock.h index d90b640d2dc01..31786c8675dd3 100644 --- a/include/zephyr/dt-bindings/clock/stm32wb_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32wb_clock.h @@ -60,7 +60,7 @@ * @param mask Mask for the RCC_CCIPRx field. * @param val Clock value (0, 1, ... 7). */ -#define STM32_CLOCK(val, mask, shift, reg) \ +#define STM32_DOMAIN_CLOCK(val, mask, shift, reg) \ ((((reg) & STM32_CLOCK_REG_MASK) << STM32_CLOCK_REG_SHIFT) | \ (((shift) & STM32_CLOCK_SHIFT_MASK) << STM32_CLOCK_SHIFT_SHIFT) | \ (((mask) & STM32_CLOCK_MASK_MASK) << STM32_CLOCK_MASK_SHIFT) | \ @@ -77,19 +77,19 @@ /** @brief Device domain clocks selection helpers */ /** CCIPR devices */ -#define USART1_SEL(val) STM32_CLOCK(val, 3, 0, CCIPR_REG) -#define LPUART1_SEL(val) STM32_CLOCK(val, 3, 10, CCIPR_REG) -#define I2C1_SEL(val) STM32_CLOCK(val, 3, 12, CCIPR_REG) -#define I2C3_SEL(val) STM32_CLOCK(val, 3, 16, CCIPR_REG) -#define LPTIM1_SEL(val) STM32_CLOCK(val, 3, 18, CCIPR_REG) -#define LPTIM2_SEL(val) STM32_CLOCK(val, 3, 20, CCIPR_REG) -#define SAI1_SEL(val) STM32_CLOCK(val, 3, 22, CCIPR_REG) -#define CLK48_SEL(val) STM32_CLOCK(val, 3, 26, CCIPR_REG) -#define ADC_SEL(val) STM32_CLOCK(val, 3, 28, CCIPR_REG) -#define RNG_SEL(val) STM32_CLOCK(val, 3, 30, CCIPR_REG) +#define USART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 0, CCIPR_REG) +#define LPUART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 10, CCIPR_REG) +#define I2C1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 12, CCIPR_REG) +#define I2C3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 16, CCIPR_REG) +#define LPTIM1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 18, CCIPR_REG) +#define LPTIM2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 20, CCIPR_REG) +#define SAI1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 22, CCIPR_REG) +#define CLK48_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 26, CCIPR_REG) +#define ADC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 28, CCIPR_REG) +#define RNG_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 30, CCIPR_REG) /** BDCR devices */ -#define RTC_SEL(val) STM32_CLOCK(val, 3, 8, BDCR_REG) +#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, BDCR_REG) /** CSR devices */ -#define RFWKP_SEL(val) STM32_CLOCK(val, 3, 14, CSR_REG) +#define RFWKP_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 14, CSR_REG) #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32WB_CLOCK_H_ */ diff --git a/include/zephyr/dt-bindings/clock/stm32wba_clock.h b/include/zephyr/dt-bindings/clock/stm32wba_clock.h index 36b25ed0826f1..b8baaada6be88 100644 --- a/include/zephyr/dt-bindings/clock/stm32wba_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32wba_clock.h @@ -68,7 +68,7 @@ #define STM32_CLOCK_VAL_MASK 0x7U #define STM32_CLOCK_VAL_SHIFT 16U -#define STM32_CLOCK(val, mask, shift, reg) \ +#define STM32_DOMAIN_CLOCK(val, mask, shift, reg) \ ((((reg) & STM32_CLOCK_REG_MASK) << STM32_CLOCK_REG_SHIFT) | \ (((shift) & STM32_CLOCK_SHIFT_MASK) << STM32_CLOCK_SHIFT_SHIFT) | \ (((mask) & STM32_CLOCK_MASK_MASK) << STM32_CLOCK_MASK_SHIFT) | \ @@ -83,22 +83,22 @@ /** @brief Device clk sources selection helpers */ /** CCIPR1 devices */ -#define USART1_SEL(val) STM32_CLOCK(val, 3, 0, CCIPR1_REG) -#define USART2_SEL(val) STM32_CLOCK(val, 3, 2, CCIPR1_REG) -#define I2C1_SEL(val) STM32_CLOCK(val, 3, 10, CCIPR1_REG) -#define LPTIM2_SEL(val) STM32_CLOCK(val, 3, 18, CCIPR1_REG) -#define SPI1_SEL(val) STM32_CLOCK(val, 3, 20, CCIPR1_REG) -#define SYSTICK_SEL(val) STM32_CLOCK(val, 3, 22, CCIPR1_REG) -#define TIMIC_SEL(val) STM32_CLOCK(val, 1, 31, CCIPR1_REG) +#define USART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 0, CCIPR1_REG) +#define USART2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 2, CCIPR1_REG) +#define I2C1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 10, CCIPR1_REG) +#define LPTIM2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 18, CCIPR1_REG) +#define SPI1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 20, CCIPR1_REG) +#define SYSTICK_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 22, CCIPR1_REG) +#define TIMIC_SEL(val) STM32_DOMAIN_CLOCK(val, 1, 31, CCIPR1_REG) /** CCIPR2 devices */ -#define RNG_SEL(val) STM32_CLOCK(val, 3, 12, CCIPR2_REG) +#define RNG_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 12, CCIPR2_REG) /** CCIPR3 devices */ -#define LPUART1_SEL(val) STM32_CLOCK(val, 3, 0, CCIPR3_REG) -#define SPI3_SEL(val) STM32_CLOCK(val, 3, 3, CCIPR3_REG) -#define I2C3_SEL(val) STM32_CLOCK(val, 3, 6, CCIPR3_REG) -#define LPTIM1_SEL(val) STM32_CLOCK(val, 3, 10, CCIPR3_REG) -#define ADC_SEL(val) STM32_CLOCK(val, 7, 12, CCIPR3_REG) +#define LPUART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 0, CCIPR3_REG) +#define SPI3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 3, CCIPR3_REG) +#define I2C3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 6, CCIPR3_REG) +#define LPTIM1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 10, CCIPR3_REG) +#define ADC_SEL(val) STM32_DOMAIN_CLOCK(val, 7, 12, CCIPR3_REG) /** BCDR1 devices */ -#define RTC_SEL(val) STM32_CLOCK(val, 3, 8, BCDR1_REG) +#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, BCDR1_REG) #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32WBA_CLOCK_H_ */ diff --git a/include/zephyr/dt-bindings/clock/stm32wl_clock.h b/include/zephyr/dt-bindings/clock/stm32wl_clock.h index 125e9a765e825..7384703267e43 100644 --- a/include/zephyr/dt-bindings/clock/stm32wl_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32wl_clock.h @@ -60,7 +60,7 @@ * @param mask Mask for the RCC_CCIPRx field. * @param val Clock value (0, 1, ... 7). */ -#define STM32_CLOCK(val, mask, shift, reg) \ +#define STM32_DOMAIN_CLOCK(val, mask, shift, reg) \ ((((reg) & STM32_CLOCK_REG_MASK) << STM32_CLOCK_REG_SHIFT) | \ (((shift) & STM32_CLOCK_SHIFT_MASK) << STM32_CLOCK_SHIFT_SHIFT) | \ (((mask) & STM32_CLOCK_MASK_MASK) << STM32_CLOCK_MASK_SHIFT) | \ @@ -74,19 +74,19 @@ /** @brief Device domain clocks selection helpers */ /** CCIPR devices */ -#define USART1_SEL(val) STM32_CLOCK(val, 3, 0, CCIPR_REG) -#define USART2_SEL(val) STM32_CLOCK(val, 3, 2, CCIPR_REG) -#define SPI2_SEL(val) STM32_CLOCK(val, 3, 8, CCIPR_REG) -#define LPUART1_SEL(val) STM32_CLOCK(val, 3, 10, CCIPR_REG) -#define I2C1_SEL(val) STM32_CLOCK(val, 3, 12, CCIPR_REG) -#define I2C2_SEL(val) STM32_CLOCK(val, 3, 14, CCIPR_REG) -#define I2C3_SEL(val) STM32_CLOCK(val, 3, 16, CCIPR_REG) -#define LPTIM1_SEL(val) STM32_CLOCK(val, 3, 18, CCIPR_REG) -#define LPTIM2_SEL(val) STM32_CLOCK(val, 3, 20, CCIPR_REG) -#define LPTIM3_SEL(val) STM32_CLOCK(val, 3, 22, CCIPR_REG) -#define ADC_SEL(val) STM32_CLOCK(val, 3, 28, CCIPR_REG) -#define RNG_SEL(val) STM32_CLOCK(val, 3, 30, CCIPR_REG) +#define USART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 0, CCIPR_REG) +#define USART2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 2, CCIPR_REG) +#define SPI2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, CCIPR_REG) +#define LPUART1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 10, CCIPR_REG) +#define I2C1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 12, CCIPR_REG) +#define I2C2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 14, CCIPR_REG) +#define I2C3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 16, CCIPR_REG) +#define LPTIM1_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 18, CCIPR_REG) +#define LPTIM2_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 20, CCIPR_REG) +#define LPTIM3_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 22, CCIPR_REG) +#define ADC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 28, CCIPR_REG) +#define RNG_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 30, CCIPR_REG) /** BDCR devices */ -#define RTC_SEL(val) STM32_CLOCK(val, 3, 8, BDCR_REG) +#define RTC_SEL(val) STM32_DOMAIN_CLOCK(val, 3, 8, BDCR_REG) #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32WL_CLOCK_H_ */ From 79cf84c6f42256acc2e459b0ad082c9ba16fda42 Mon Sep 17 00:00:00 2001 From: Hubert Guan Date: Fri, 11 Oct 2024 15:10:11 -0700 Subject: [PATCH 1639/4482] dts: arm: st: Add include to stm32mp157 Fixes error where STM32_CLOCK macro isn't recognized. Signed-off-by: Hubert Guan --- dts/arm/st/mp1/stm32mp157.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/dts/arm/st/mp1/stm32mp157.dtsi b/dts/arm/st/mp1/stm32mp157.dtsi index 4368b9f1a8f6e..392e475addf6d 100644 --- a/dts/arm/st/mp1/stm32mp157.dtsi +++ b/dts/arm/st/mp1/stm32mp157.dtsi @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include From 57723cf40594545bbfc4aa36606ad9a838c4674a Mon Sep 17 00:00:00 2001 From: Hubert Guan Date: Mon, 14 Oct 2024 13:37:58 -0700 Subject: [PATCH 1640/4482] dts: arm: st: Refactor DTSI files to use macro Replaces raw hex codes by using STM32_CLOCK macro Signed-off-by: Hubert Guan --- dts/arm/st/c0/stm32c0.dtsi | 34 +++---- dts/arm/st/c0/stm32c031.dtsi | 2 +- dts/arm/st/f0/stm32f0.dtsi | 36 +++---- dts/arm/st/f0/stm32f030X8.dtsi | 10 +- dts/arm/st/f0/stm32f030Xc.dtsi | 10 +- dts/arm/st/f0/stm32f031.dtsi | 2 +- dts/arm/st/f0/stm32f042.dtsi | 10 +- dts/arm/st/f0/stm32f051.dtsi | 12 +-- dts/arm/st/f0/stm32f070.dtsi | 6 +- dts/arm/st/f0/stm32f070Xb.dtsi | 12 +-- dts/arm/st/f0/stm32f071.dtsi | 8 +- dts/arm/st/f0/stm32f072.dtsi | 4 +- dts/arm/st/f0/stm32f091.dtsi | 12 +-- dts/arm/st/f1/stm32f1.dtsi | 40 ++++---- dts/arm/st/f1/stm32f100Xb.dtsi | 4 +- dts/arm/st/f1/stm32f100Xe.dtsi | 2 +- dts/arm/st/f1/stm32f103X8.dtsi | 6 +- dts/arm/st/f1/stm32f103Xc.dtsi | 26 ++--- dts/arm/st/f1/stm32f103Xg.dtsi | 12 +-- dts/arm/st/f1/stm32f105.dtsi | 22 ++--- dts/arm/st/f1/stm32f107.dtsi | 8 +- dts/arm/st/f2/stm32f2.dtsi | 88 ++++++++--------- dts/arm/st/f2/stm32f207.dtsi | 8 +- dts/arm/st/f3/stm32f3.dtsi | 50 +++++----- dts/arm/st/f3/stm32f302.dtsi | 14 +-- dts/arm/st/f3/stm32f302Xc.dtsi | 6 +- dts/arm/st/f3/stm32f303.dtsi | 22 ++--- dts/arm/st/f3/stm32f303X8.dtsi | 2 +- dts/arm/st/f3/stm32f303Xb.dtsi | 2 +- dts/arm/st/f3/stm32f303Xe.dtsi | 2 +- dts/arm/st/f3/stm32f334.dtsi | 4 +- dts/arm/st/f3/stm32f334X8.dtsi | 2 +- dts/arm/st/f3/stm32f373.dtsi | 24 ++--- dts/arm/st/f3/stm32f373Xc.dtsi | 4 +- dts/arm/st/f4/stm32f4.dtsi | 60 ++++++------ dts/arm/st/f4/stm32f401.dtsi | 10 +- dts/arm/st/f4/stm32f405.dtsi | 40 ++++---- dts/arm/st/f4/stm32f407.dtsi | 8 +- dts/arm/st/f4/stm32f410.dtsi | 16 +-- dts/arm/st/f4/stm32f411.dtsi | 8 +- dts/arm/st/f4/stm32f412.dtsi | 32 +++--- dts/arm/st/f4/stm32f413.dtsi | 16 +-- dts/arm/st/f4/stm32f415.dtsi | 2 +- dts/arm/st/f4/stm32f417.dtsi | 2 +- dts/arm/st/f4/stm32f423.dtsi | 2 +- dts/arm/st/f4/stm32f427.dtsi | 16 +-- dts/arm/st/f4/stm32f429.dtsi | 4 +- dts/arm/st/f4/stm32f437.dtsi | 2 +- dts/arm/st/f4/stm32f446.dtsi | 26 ++--- dts/arm/st/f4/stm32f469.dtsi | 4 +- dts/arm/st/f7/stm32f7.dtsi | 110 ++++++++++----------- dts/arm/st/f7/stm32f722.dtsi | 2 +- dts/arm/st/f7/stm32f745.dtsi | 18 ++-- dts/arm/st/f7/stm32f746.dtsi | 2 +- dts/arm/st/f7/stm32f765.dtsi | 18 ++-- dts/arm/st/f7/stm32f767.dtsi | 2 +- dts/arm/st/g0/stm32g0.dtsi | 44 ++++----- dts/arm/st/g0/stm32g031.dtsi | 4 +- dts/arm/st/g0/stm32g050.dtsi | 4 +- dts/arm/st/g0/stm32g051.dtsi | 8 +- dts/arm/st/g0/stm32g070.dtsi | 6 +- dts/arm/st/g0/stm32g071.dtsi | 8 +- dts/arm/st/g0/stm32g0_crypt.dtsi | 4 +- dts/arm/st/g0/stm32g0b0.dtsi | 16 +-- dts/arm/st/g0/stm32g0b1.dtsi | 22 ++--- dts/arm/st/g4/stm32g4.dtsi | 86 ++++++++-------- dts/arm/st/g4/stm32g473.dtsi | 16 +-- dts/arm/st/g4/stm32g491.dtsi | 8 +- dts/arm/st/h5/stm32h5.dtsi | 76 +++++++-------- dts/arm/st/h5/stm32h533.dtsi | 4 +- dts/arm/st/h5/stm32h562.dtsi | 72 +++++++------- dts/arm/st/h5/stm32h563.dtsi | 2 +- dts/arm/st/h7/stm32h7.dtsi | 146 ++++++++++++++-------------- dts/arm/st/h7/stm32h723.dtsi | 20 ++-- dts/arm/st/h7/stm32h730.dtsi | 2 +- dts/arm/st/h7/stm32h743.dtsi | 4 +- dts/arm/st/h7/stm32h745.dtsi | 6 +- dts/arm/st/h7/stm32h747.dtsi | 2 +- dts/arm/st/h7/stm32h755.dtsi | 4 +- dts/arm/st/h7/stm32h7_dualcore.dtsi | 2 +- dts/arm/st/h7/stm32h7a3.dtsi | 12 +-- dts/arm/st/h7/stm32h7b0.dtsi | 2 +- dts/arm/st/h7rs/stm32h7rs.dtsi | 92 +++++++++--------- dts/arm/st/l0/stm32l0.dtsi | 32 +++--- dts/arm/st/l0/stm32l010Xb.dtsi | 2 +- dts/arm/st/l0/stm32l031.dtsi | 2 +- dts/arm/st/l0/stm32l051.dtsi | 10 +- dts/arm/st/l0/stm32l053.dtsi | 4 +- dts/arm/st/l0/stm32l071.dtsi | 22 ++--- dts/arm/st/l0/stm32l072.dtsi | 6 +- dts/arm/st/l1/stm32l1.dtsi | 54 +++++----- dts/arm/st/l1/stm32l151Xc.dtsi | 4 +- dts/arm/st/l1/stm32l152Xc.dtsi | 4 +- dts/arm/st/l1/stm32l152Xe.dtsi | 4 +- dts/arm/st/l4/stm32l4.dtsi | 52 +++++----- dts/arm/st/l4/stm32l412.dtsi | 10 +- dts/arm/st/l4/stm32l422.dtsi | 2 +- dts/arm/st/l4/stm32l431.dtsi | 22 ++--- dts/arm/st/l4/stm32l432.dtsi | 12 +-- dts/arm/st/l4/stm32l433.dtsi | 12 +-- dts/arm/st/l4/stm32l451.dtsi | 26 ++--- dts/arm/st/l4/stm32l452.dtsi | 2 +- dts/arm/st/l4/stm32l462.dtsi | 2 +- dts/arm/st/l4/stm32l471.dtsi | 40 ++++---- dts/arm/st/l4/stm32l475.dtsi | 2 +- dts/arm/st/l4/stm32l486.dtsi | 2 +- dts/arm/st/l4/stm32l496.dtsi | 12 +-- dts/arm/st/l4/stm32l4a6.dtsi | 2 +- dts/arm/st/l4/stm32l4p5.dtsi | 58 +++++------ dts/arm/st/l4/stm32l4q5.dtsi | 2 +- dts/arm/st/l4/stm32l4r9.dtsi | 2 +- dts/arm/st/l4/stm32l4s5.dtsi | 2 +- dts/arm/st/l5/stm32l5.dtsi | 88 ++++++++--------- dts/arm/st/l5/stm32l562.dtsi | 2 +- dts/arm/st/mp1/stm32mp157.dtsi | 64 ++++++------ dts/arm/st/u0/stm32u0.dtsi | 42 ++++---- dts/arm/st/u0/stm32u073.dtsi | 2 +- dts/arm/st/u5/stm32u5.dtsi | 110 ++++++++++----------- dts/arm/st/u5/stm32u545.dtsi | 2 +- dts/arm/st/u5/stm32u575.dtsi | 2 +- dts/arm/st/u5/stm32u595.dtsi | 14 +-- dts/arm/st/wb/stm32wb.dtsi | 58 +++++------ dts/arm/st/wb0/stm32wb0.dtsi | 8 +- dts/arm/st/wba/stm32wba.dtsi | 46 ++++----- dts/arm/st/wl/stm32wl.dtsi | 54 +++++----- 125 files changed, 1238 insertions(+), 1238 deletions(-) diff --git a/dts/arm/st/c0/stm32c0.dtsi b/dts/arm/st/c0/stm32c0.dtsi index 812db5f010127..b605b7674e0f5 100644 --- a/dts/arm/st/c0/stm32c0.dtsi +++ b/dts/arm/st/c0/stm32c0.dtsi @@ -84,7 +84,7 @@ compatible = "st,stm32-flash-controller"; reg = <0x40022000 0x400>; interrupts = <3 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000100>; + clocks = <&rcc STM32_CLOCK(AHB1, 8U)>; #address-cells = <1>; #size-cells = <1>; @@ -133,7 +133,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000001>; + clocks = <&rcc STM32_CLOCK(IOP, 0U)>; }; gpiob: gpio@50000400 { @@ -141,7 +141,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000002>; + clocks = <&rcc STM32_CLOCK(IOP, 1U)>; }; gpioc: gpio@50000800 { @@ -149,7 +149,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000004>; + clocks = <&rcc STM32_CLOCK(IOP, 2U)>; }; gpiof: gpio@50001400 { @@ -157,7 +157,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000020>; + clocks = <&rcc STM32_CLOCK(IOP, 5U)>; }; }; @@ -165,7 +165,7 @@ compatible = "st,stm32-rtc"; reg = <0x40002800 0x400>; interrupts = <2 0>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000400>; + clocks = <&rcc STM32_CLOCK(APB1, 10U)>; prescaler = <32768>; alarms-count = <1>; alrm-exti-line = <19>; @@ -175,7 +175,7 @@ wwdg: watchdog@40002c00 { compatible = "st,stm32-window-watchdog"; reg = <0x40002C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <0 2>; status = "disabled"; }; @@ -189,7 +189,7 @@ usart1: serial@40013800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40013800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1_2, 14U)>; resets = <&rctl STM32_RESET(APB1H, 14U)>; interrupts = <27 0>; status = "disabled"; @@ -198,7 +198,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1L, 17U)>; interrupts = <28 0>; status = "disabled"; @@ -207,7 +207,7 @@ timers1: timers@40012c00 { compatible = "st,stm32-timers"; reg = <0x40012C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1_2, 11U)>; resets = <&rctl STM32_RESET(APB1H, 11U)>; interrupts = <13 0>, <14 0>; interrupt-names = "brk_up_trg_com", "cc"; @@ -224,7 +224,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1L, 1U)>; interrupts = <16 0>; interrupt-names = "global"; @@ -241,7 +241,7 @@ timers14: timers@40002000 { compatible = "st,stm32-timers"; reg = <0x40002000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1_2, 15U)>; resets = <&rctl STM32_RESET(APB1H, 15U)>; interrupts = <19 0>; interrupt-names = "global"; @@ -258,7 +258,7 @@ timers16: timers@40014400 { compatible = "st,stm32-timers"; reg = <0x40014400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1_2, 17U)>; resets = <&rctl STM32_RESET(APB1H, 17U)>; interrupts = <21 0>; interrupt-names = "global"; @@ -275,7 +275,7 @@ timers17: timers@40014800 { compatible = "st,stm32-timers"; reg = <0x40014800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1_2, 18U)>; resets = <&rctl STM32_RESET(APB1H, 18U)>; interrupts = <22 0>; interrupt-names = "global"; @@ -295,7 +295,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB1, 21U)>; interrupts = <23 0>; interrupt-names = "combined"; status = "disabled"; @@ -304,7 +304,7 @@ adc1: adc@40012400 { compatible = "st,stm32-adc"; reg = <0x40012400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1_2, 20U)>; interrupts = <12 0>; status = "disabled"; #io-channel-cells = <1>; @@ -322,7 +322,7 @@ #dma-cells = <3>; reg = <0x40020000 0x400>; interrupts = <9 0 10 0 10 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB1, 0U)>; dma-requests = <3>; dma-offset = <0>; status = "disabled"; diff --git a/dts/arm/st/c0/stm32c031.dtsi b/dts/arm/st/c0/stm32c031.dtsi index e91e5267bc4c1..dc24fc521cd28 100644 --- a/dts/arm/st/c0/stm32c031.dtsi +++ b/dts/arm/st/c0/stm32c031.dtsi @@ -16,7 +16,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000008>; + clocks = <&rcc STM32_CLOCK(IOP, 3U)>; }; }; }; diff --git a/dts/arm/st/f0/stm32f0.dtsi b/dts/arm/st/f0/stm32f0.dtsi index 315827f791d8d..96b9e907b6549 100644 --- a/dts/arm/st/f0/stm32f0.dtsi +++ b/dts/arm/st/f0/stm32f0.dtsi @@ -86,7 +86,7 @@ compatible = "st,stm32-flash-controller", "st,stm32f1-flash-controller"; reg = <0x40022000 0x400>; interrupts = <3 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB1, 4U)>; #address-cells = <1>; #size-cells = <1>; @@ -134,7 +134,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(AHB1, 17U)>; }; gpiob: gpio@48000400 { @@ -142,7 +142,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(AHB1, 18U)>; }; gpioc: gpio@48000800 { @@ -150,7 +150,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(AHB1, 19U)>; }; gpiod: gpio@48000c00 { @@ -158,7 +158,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(AHB1, 20U)>; }; gpiof: gpio@48001400 { @@ -166,14 +166,14 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(AHB1, 22U)>; }; }; usart1: serial@40013800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40013800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB2, 14U)>; resets = <&rctl STM32_RESET(APB2, 14U)>; interrupts = <27 0>; status = "disabled"; @@ -185,7 +185,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>, + clocks = <&rcc STM32_CLOCK(APB1, 21U)>, /* I2C1 clock source should always be defined, * even for the default value */ @@ -200,7 +200,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB2, 12U)>; interrupts = <25 3>; status = "disabled"; }; @@ -208,7 +208,7 @@ rtc: rtc@40002800 { compatible = "st,stm32-rtc"; reg = <0x40002800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>; + clocks = <&rcc STM32_CLOCK(APB1, 28U)>; interrupts = <2 0>; prescaler = <32768>; alarms-count = <1>; @@ -225,7 +225,7 @@ wwdg: watchdog@40002c00 { compatible = "st,stm32-window-watchdog"; reg = <0x40002C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <0 2>; status = "disabled"; }; @@ -233,7 +233,7 @@ timers1: timers@40012c00 { compatible = "st,stm32-timers"; reg = <0x40012c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB2, 11U)>; resets = <&rctl STM32_RESET(APB2, 11U)>; interrupts = <13 0>, <14 0>; interrupt-names = "brk_up_trg_com", "cc"; @@ -250,7 +250,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1, 1U)>; interrupts = <16 0>; interrupt-names = "global"; @@ -272,7 +272,7 @@ timers14: timers@40002000 { compatible = "st,stm32-timers"; reg = <0x40002000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000100>; + clocks = <&rcc STM32_CLOCK(APB1, 8U)>; resets = <&rctl STM32_RESET(APB1, 8U)>; interrupts = <19 0>; interrupt-names = "global"; @@ -294,7 +294,7 @@ timers16: timers@40014400 { compatible = "st,stm32-timers"; reg = <0x40014400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB2, 17U)>; resets = <&rctl STM32_RESET(APB2, 17U)>; interrupts = <21 0>; interrupt-names = "global"; @@ -316,7 +316,7 @@ timers17: timers@40014800 { compatible = "st,stm32-timers"; reg = <0x40014800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB2, 18U)>; resets = <&rctl STM32_RESET(APB2, 18U)>; interrupts = <22 0>; interrupt-names = "global"; @@ -338,7 +338,7 @@ adc1: adc@40012400 { compatible = "st,stm32-adc"; reg = <0x40012400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000200>; + clocks = <&rcc STM32_CLOCK(APB2, 9U)>; interrupts = <12 0>; status = "disabled"; #io-channel-cells = <1>; @@ -355,7 +355,7 @@ compatible = "st,stm32-dma-v2bis"; #dma-cells = <2>; reg = <0x40020000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x1>; + clocks = <&rcc STM32_CLOCK(AHB1, 0U)>; interrupts = <9 0 10 0 10 0 11 0 11 0>; status = "disabled"; }; diff --git a/dts/arm/st/f0/stm32f030X8.dtsi b/dts/arm/st/f0/stm32f030X8.dtsi index 9044da82c0ad4..9666a3f92182b 100644 --- a/dts/arm/st/f0/stm32f030X8.dtsi +++ b/dts/arm/st/f0/stm32f030X8.dtsi @@ -21,7 +21,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1, 17U)>; interrupts = <28 0>; status = "disabled"; @@ -33,7 +33,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <24 0>; interrupt-names = "combined"; status = "disabled"; @@ -44,7 +44,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <26 3>; status = "disabled"; }; @@ -52,7 +52,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1, 4U)>; interrupts = <17 0>; interrupt-names = "global"; @@ -63,7 +63,7 @@ timers15: timers@40014000 { compatible = "st,stm32-timers"; reg = <0x40014000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(APB2, 16U)>; resets = <&rctl STM32_RESET(APB2, 16U)>; interrupts = <20 0>; interrupt-names = "global"; diff --git a/dts/arm/st/f0/stm32f030Xc.dtsi b/dts/arm/st/f0/stm32f030Xc.dtsi index 098cd0c47ee19..0520555523daf 100644 --- a/dts/arm/st/f0/stm32f030Xc.dtsi +++ b/dts/arm/st/f0/stm32f030Xc.dtsi @@ -29,7 +29,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1, 18U)>; interrupts = <29 0>; status = "disabled"; @@ -38,7 +38,7 @@ usart4: serial@40004c00 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1, 19U)>; interrupts = <29 0>; status = "disabled"; @@ -47,7 +47,7 @@ usart5: serial@40005000 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1, 20U)>; interrupts = <29 0>; status = "disabled"; @@ -56,7 +56,7 @@ usart6: serial@40011400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40011400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB2, 5U)>; resets = <&rctl STM32_RESET(APB2, 5U)>; interrupts = <29 0>; status = "disabled"; @@ -65,7 +65,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1, 5U)>; interrupts = <18 0>; interrupt-names = "global"; diff --git a/dts/arm/st/f0/stm32f031.dtsi b/dts/arm/st/f0/stm32f031.dtsi index 5d04c1d3eda70..df67750946d09 100644 --- a/dts/arm/st/f0/stm32f031.dtsi +++ b/dts/arm/st/f0/stm32f031.dtsi @@ -13,7 +13,7 @@ timers2: timers@40000000 { compatible = "st,stm32-timers"; reg = <0x40000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1, 0U)>; resets = <&rctl STM32_RESET(APB1, 0U)>; interrupts = <15 0>; interrupt-names = "global"; diff --git a/dts/arm/st/f0/stm32f042.dtsi b/dts/arm/st/f0/stm32f042.dtsi index a18f0a46bea7b..2dc48d49e7cb0 100644 --- a/dts/arm/st/f0/stm32f042.dtsi +++ b/dts/arm/st/f0/stm32f042.dtsi @@ -24,7 +24,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1, 17U)>; interrupts = <28 0>; status = "disabled"; @@ -35,7 +35,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <26 3>; status = "disabled"; }; @@ -44,14 +44,14 @@ compatible = "st,stm32-bxcan"; reg = <0x40006400 0x400>; interrupts = <30 0>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; status = "disabled"; }; timers15: timers@40014000 { compatible = "st,stm32-timers"; reg = <0x40014000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(APB2, 16U)>; resets = <&rctl STM32_RESET(APB2, 16U)>; interrupts = <20 0>; interrupt-names = "global"; @@ -73,7 +73,7 @@ num-bidir-endpoints = <8>; ram-size = <1024>; phys = <&usb_fs_phy>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>, + clocks = <&rcc STM32_CLOCK(APB1, 23U)>, <&rcc STM32_SRC_PLLCLK USB_SEL(1)>; status = "disabled"; }; diff --git a/dts/arm/st/f0/stm32f051.dtsi b/dts/arm/st/f0/stm32f051.dtsi index 51d23418207d1..d6b43154aafca 100644 --- a/dts/arm/st/f0/stm32f051.dtsi +++ b/dts/arm/st/f0/stm32f051.dtsi @@ -13,7 +13,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1, 17U)>; interrupts = <28 0>; status = "disabled"; @@ -25,7 +25,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <24 0>; interrupt-names = "combined"; status = "disabled"; @@ -36,7 +36,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <26 3>; status = "disabled"; }; @@ -44,7 +44,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1, 4U)>; interrupts = <17 0>; interrupt-names = "global"; @@ -55,7 +55,7 @@ timers15: timers@40014000 { compatible = "st,stm32-timers"; reg = <0x40014000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(APB2, 16U)>; resets = <&rctl STM32_RESET(APB2, 16U)>; interrupts = <20 0>; interrupt-names = "global"; @@ -72,7 +72,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; diff --git a/dts/arm/st/f0/stm32f070.dtsi b/dts/arm/st/f0/stm32f070.dtsi index bf659775aa4c4..98f2de5aa33b3 100644 --- a/dts/arm/st/f0/stm32f070.dtsi +++ b/dts/arm/st/f0/stm32f070.dtsi @@ -13,7 +13,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1, 17U)>; interrupts = <28 0>; status = "disabled"; @@ -22,7 +22,7 @@ timers15: timers@40014000 { compatible = "st,stm32-timers"; reg = <0x40014000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(APB2, 16U)>; resets = <&rctl STM32_RESET(APB2, 16U)>; interrupts = <20 0>; interrupt-names = "global"; @@ -44,7 +44,7 @@ num-bidir-endpoints = <8>; ram-size = <1024>; phys = <&usb_fs_phy>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>, + clocks = <&rcc STM32_CLOCK(APB1, 23U)>, <&rcc STM32_SRC_PLLCLK USB_SEL(1)>; status = "disabled"; }; diff --git a/dts/arm/st/f0/stm32f070Xb.dtsi b/dts/arm/st/f0/stm32f070Xb.dtsi index 6962a67ba1095..766b5ffe2b3c0 100644 --- a/dts/arm/st/f0/stm32f070Xb.dtsi +++ b/dts/arm/st/f0/stm32f070Xb.dtsi @@ -28,7 +28,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1, 18U)>; interrupts = <29 0>; status = "disabled"; @@ -37,7 +37,7 @@ usart4: serial@40004c00 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1, 19U)>; interrupts = <29 0>; status = "disabled"; @@ -49,7 +49,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <24 0>; interrupt-names = "combined"; status = "disabled"; @@ -60,7 +60,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <26 3>; status = "disabled"; }; @@ -68,7 +68,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1, 4U)>; interrupts = <17 0>; interrupt-names = "global"; @@ -79,7 +79,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1, 5U)>; interrupts = <18 0>; interrupt-names = "global"; diff --git a/dts/arm/st/f0/stm32f071.dtsi b/dts/arm/st/f0/stm32f071.dtsi index 35156176e11fb..63217e9b529cd 100644 --- a/dts/arm/st/f0/stm32f071.dtsi +++ b/dts/arm/st/f0/stm32f071.dtsi @@ -31,7 +31,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(AHB1, 21U)>; }; }; @@ -44,7 +44,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1, 18U)>; interrupts = <29 0>; status = "disabled"; @@ -53,7 +53,7 @@ usart4: serial@40004c00 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1, 19U)>; interrupts = <29 0>; status = "disabled"; @@ -62,7 +62,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1, 5U)>; interrupts = <18 0>; interrupt-names = "global"; diff --git a/dts/arm/st/f0/stm32f072.dtsi b/dts/arm/st/f0/stm32f072.dtsi index a529d7238f744..734b44ad34661 100644 --- a/dts/arm/st/f0/stm32f072.dtsi +++ b/dts/arm/st/f0/stm32f072.dtsi @@ -14,7 +14,7 @@ compatible = "st,stm32-bxcan"; reg = <0x40006400 0x400>; interrupts = <30 0>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; status = "disabled"; }; @@ -26,7 +26,7 @@ num-bidir-endpoints = <8>; ram-size = <1024>; phys = <&usb_fs_phy>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>, + clocks = <&rcc STM32_CLOCK(APB1, 23U)>, <&rcc STM32_SRC_PLLCLK USB_SEL(1)>; status = "disabled"; }; diff --git a/dts/arm/st/f0/stm32f091.dtsi b/dts/arm/st/f0/stm32f091.dtsi index ee46f86c3195c..18aea85517bd4 100644 --- a/dts/arm/st/f0/stm32f091.dtsi +++ b/dts/arm/st/f0/stm32f091.dtsi @@ -19,7 +19,7 @@ usart5: serial@40005000 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1, 20U)>; interrupts = <29 0>; status = "disabled"; @@ -28,7 +28,7 @@ usart6: serial@40011400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40011400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB2, 5U)>; resets = <&rctl STM32_RESET(APB2, 5U)>; interrupts = <29 0>; status = "disabled"; @@ -37,7 +37,7 @@ usart7: serial@40011800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40011800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000040>; + clocks = <&rcc STM32_CLOCK(APB2, 6U)>; resets = <&rctl STM32_RESET(APB2, 6U)>; interrupts = <29 0>; status = "disabled"; @@ -46,7 +46,7 @@ usart8: serial@40011c00 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40011c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000080>; + clocks = <&rcc STM32_CLOCK(APB2, 7U)>; resets = <&rctl STM32_RESET(APB2, 7U)>; interrupts = <29 0>; status = "disabled"; @@ -56,7 +56,7 @@ compatible = "st,stm32-bxcan"; reg = <0x40006400 0x400>; interrupts = <30 0>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; status = "disabled"; }; @@ -65,7 +65,7 @@ #dma-cells = <2>; reg = <0x40020400 0x400>; interrupts = <10 0 10 0 11 0 11 0 11 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x2>; + clocks = <&rcc STM32_CLOCK(AHB1, 1U)>; status = "disabled"; }; }; diff --git a/dts/arm/st/f1/stm32f1.dtsi b/dts/arm/st/f1/stm32f1.dtsi index 53a12c413d44d..5e5077069b697 100644 --- a/dts/arm/st/f1/stm32f1.dtsi +++ b/dts/arm/st/f1/stm32f1.dtsi @@ -85,7 +85,7 @@ compatible = "st,stm32-flash-controller", "st,stm32f1-flash-controller"; reg = <0x40022000 0x400>; interrupts = <3 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB1, 4U)>; #address-cells = <1>; #size-cells = <1>; @@ -136,7 +136,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40010800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB2, 2U)>; }; gpiob: gpio@40010c00 { @@ -144,7 +144,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40010c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB2, 3U)>; }; gpioc: gpio@40011000 { @@ -152,7 +152,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40011000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB2, 4U)>; }; gpiod: gpio@40011400 { @@ -160,7 +160,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40011400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB2, 5U)>; }; gpioe: gpio@40011800 { @@ -168,14 +168,14 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40011800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000040>; + clocks = <&rcc STM32_CLOCK(APB2, 6U)>; }; }; usart1: serial@40013800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40013800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB2, 14U)>; resets = <&rctl STM32_RESET(APB2, 14U)>; interrupts = <37 0>; status = "disabled"; @@ -184,7 +184,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1, 17U)>; interrupts = <38 0>; status = "disabled"; @@ -193,7 +193,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1, 18U)>; interrupts = <39 0>; status = "disabled"; @@ -205,7 +205,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB1, 21U)>; interrupts = <31 0>, <32 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -217,7 +217,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <33 0>, <34 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -228,7 +228,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB2, 12U)>; interrupts = <35 5>; status = "disabled"; }; @@ -242,7 +242,7 @@ wwdg: watchdog@40002c00 { compatible = "st,stm32-window-watchdog"; reg = <0x40002C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <0 7>; status = "disabled"; }; @@ -250,7 +250,7 @@ timers1: timers@40012c00 { compatible = "st,stm32-timers"; reg = <0x40012c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB2, 11U)>; resets = <&rctl STM32_RESET(APB2, 11U)>; interrupts = <24 0>, <25 0>, <26 0>, <27 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -267,7 +267,7 @@ timers2: timers@40000000 { compatible = "st,stm32-timers"; reg = <0x40000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1, 0U)>; resets = <&rctl STM32_RESET(APB1, 0U)>; interrupts = <28 0>; interrupt-names = "global"; @@ -289,7 +289,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1, 1U)>; interrupts = <29 0>; interrupt-names = "global"; @@ -311,7 +311,7 @@ timers4: timers@40000800 { compatible = "st,stm32-timers"; reg = <0x40000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB1, 2U)>; resets = <&rctl STM32_RESET(APB1, 2U)>; interrupts = <30 0>; interrupt-names = "global"; @@ -334,7 +334,7 @@ compatible = "st,stm32-rtc"; reg = <0x40002800 0x400>; interrupts = <41 0>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>; + clocks = <&rcc STM32_CLOCK(APB1, 28U)>; prescaler = <32768>; status = "disabled"; }; @@ -342,7 +342,7 @@ adc1: adc@40012400 { compatible = "st,stm32f1-adc", "st,stm32-adc"; reg = <0x40012400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000200>; + clocks = <&rcc STM32_CLOCK(APB2, 9U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; @@ -355,7 +355,7 @@ compatible = "st,stm32-dma-v2bis"; #dma-cells = <2>; reg = <0x40020000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x1>; + clocks = <&rcc STM32_CLOCK(AHB1, 0U)>; interrupts = <11 0 12 0 13 0 14 0 15 0 16 0 17 0>; status = "disabled"; }; diff --git a/dts/arm/st/f1/stm32f100Xb.dtsi b/dts/arm/st/f1/stm32f100Xb.dtsi index eefe269e4596e..9a33217e18c43 100644 --- a/dts/arm/st/f1/stm32f100Xb.dtsi +++ b/dts/arm/st/f1/stm32f100Xb.dtsi @@ -39,7 +39,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <36 5>; status = "disabled"; }; @@ -47,7 +47,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; diff --git a/dts/arm/st/f1/stm32f100Xe.dtsi b/dts/arm/st/f1/stm32f100Xe.dtsi index 982dbd2343592..45a8bedd9e0ee 100644 --- a/dts/arm/st/f1/stm32f100Xe.dtsi +++ b/dts/arm/st/f1/stm32f100Xe.dtsi @@ -26,7 +26,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <51 5>; status = "disabled"; }; diff --git a/dts/arm/st/f1/stm32f103X8.dtsi b/dts/arm/st/f1/stm32f103X8.dtsi index c34699026d35c..19ea073904e39 100644 --- a/dts/arm/st/f1/stm32f103X8.dtsi +++ b/dts/arm/st/f1/stm32f103X8.dtsi @@ -30,7 +30,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <36 5>; status = "disabled"; }; @@ -43,7 +43,7 @@ num-bidir-endpoints = <8>; ram-size = <512>; status = "disabled"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>; + clocks = <&rcc STM32_CLOCK(APB1, 23U)>; phys = <&usb_fs_phy>; }; @@ -52,7 +52,7 @@ reg = <0x40006400 0x400>; interrupts = <19 0>, <20 0>, <21 0>, <22 0>; interrupt-names = "TX", "RX0", "RX1", "SCE"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; status = "disabled"; }; }; diff --git a/dts/arm/st/f1/stm32f103Xc.dtsi b/dts/arm/st/f1/stm32f103Xc.dtsi index 78143f18bd99c..d2a609a22de47 100644 --- a/dts/arm/st/f1/stm32f103Xc.dtsi +++ b/dts/arm/st/f1/stm32f103Xc.dtsi @@ -26,7 +26,7 @@ uart4: serial@40004c00 { compatible = "st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1, 19U)>; interrupts = <52 0>; status = "disabled"; @@ -35,7 +35,7 @@ uart5: serial@40005000 { compatible = "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1, 20U)>; interrupts = <53 0>; status = "disabled"; @@ -44,7 +44,7 @@ timers5: timers@40000c00 { compatible = "st,stm32-timers"; reg = <0x40000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB1, 3U)>; resets = <&rctl STM32_RESET(APB1, 3U)>; interrupts = <50 0>; interrupt-names = "global"; @@ -61,7 +61,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1, 4U)>; interrupts = <54 0>; interrupt-names = "global"; @@ -72,7 +72,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1, 5U)>; interrupts = <55 0>; interrupt-names = "global"; @@ -85,7 +85,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0X40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <51 5>; status = "disabled"; }; @@ -93,7 +93,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -106,7 +106,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40011c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000080>; + clocks = <&rcc STM32_CLOCK(APB2, 7U)>; }; gpiog: gpio@40012000 { @@ -114,14 +114,14 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40012000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000100>; + clocks = <&rcc STM32_CLOCK(APB2, 8U)>; }; }; adc2: adc@40012800 { compatible = "st,stm32-adc"; reg = <0x40012800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000400>; + clocks = <&rcc STM32_CLOCK(APB2, 10U)>; /* Shares vector with ADC1 */ interrupts = <18 0>; status = "disabled"; @@ -131,7 +131,7 @@ adc3: adc@40013c00 { compatible = "st,stm32-adc"; reg = <0x40013c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB2, 15U)>; interrupts = <47 0>; status = "disabled"; #io-channel-cells = <1>; @@ -140,7 +140,7 @@ timers8: timers@40013400 { compatible = "st,stm32-timers"; reg = <0x40013400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(APB2, 13U)>; resets = <&rctl STM32_RESET(APB2, 13U)>; interrupts = <43 0>, <44 0>, <45 0>, <46 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -158,7 +158,7 @@ compatible = "st,stm32-dma-v2bis"; #dma-cells = <2>; reg = <0x40020400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x2>; + clocks = <&rcc STM32_CLOCK(AHB1, 1U)>; interrupts = < 56 0 57 0 58 0 59 0 60 0>; status = "disabled"; }; diff --git a/dts/arm/st/f1/stm32f103Xg.dtsi b/dts/arm/st/f1/stm32f103Xg.dtsi index 7f6263ade115b..a40a4c4036169 100644 --- a/dts/arm/st/f1/stm32f103Xg.dtsi +++ b/dts/arm/st/f1/stm32f103Xg.dtsi @@ -32,7 +32,7 @@ timers9: timers@40014c00 { compatible = "st,stm32-timers"; reg = <0x40014c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB2, 19U)>; resets = <&rctl STM32_RESET(APB2, 19U)>; /* Shared with TIM1_BRK */ interrupts = <24 0>; @@ -49,7 +49,7 @@ timers10: timers@40015000 { compatible = "st,stm32-timers"; reg = <0x40015000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB2, 20U)>; resets = <&rctl STM32_RESET(APB2, 20U)>; /* Shared with TIM1_UP */ interrupts = <25 0>; @@ -66,7 +66,7 @@ timers11: timers@40015400 { compatible = "st,stm32-timers"; reg = <0x40015400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB2, 21U)>; resets = <&rctl STM32_RESET(APB2, 21U)>; /* Shared with TIM1_TRG_COM */ interrupts = <26 0>; @@ -83,7 +83,7 @@ timers12: timers@40001800 { compatible = "st,stm32-timers"; reg = <0x40001800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000040>; + clocks = <&rcc STM32_CLOCK(APB1, 6U)>; resets = <&rctl STM32_RESET(APB1, 6U)>; /* Shared with TIM8_BRK */ interrupts = <43 0>; @@ -100,7 +100,7 @@ timers13: timers@40001c00 { compatible = "st,stm32-timers"; reg = <0x40001c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000080>; + clocks = <&rcc STM32_CLOCK(APB1, 7U)>; resets = <&rctl STM32_RESET(APB1, 7U)>; /* Shared with TIM8_UP */ interrupts = <44 0>; @@ -117,7 +117,7 @@ timers14: timers@40002000 { compatible = "st,stm32-timers"; reg = <0x40002000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000100>; + clocks = <&rcc STM32_CLOCK(APB1, 8U)>; resets = <&rctl STM32_RESET(APB1, 8U)>; /* Shared with TIM8_TRG_COM */ interrupts = <45 0>; diff --git a/dts/arm/st/f1/stm32f105.dtsi b/dts/arm/st/f1/stm32f105.dtsi index 6df7f92f9e60a..d4f05930a80e2 100644 --- a/dts/arm/st/f1/stm32f105.dtsi +++ b/dts/arm/st/f1/stm32f105.dtsi @@ -39,7 +39,7 @@ reg = <0x40006400 0x400>; interrupts = <19 0>, <20 0>, <21 0>, <22 0>; interrupt-names = "TX", "RX0", "RX1", "SCE"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; status = "disabled"; }; @@ -49,14 +49,14 @@ interrupts = <63 0>, <64 0>, <65 0>, <66 0>; interrupt-names = "TX", "RX0", "RX1", "SCE"; /* also enabling clock for can1 (master instance) */ - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x06000000>; + clocks = <&rcc STM32_CLOCK(APB1, 26U)>; status = "disabled"; }; dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -64,7 +64,7 @@ uart4: serial@40004c00 { compatible = "st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1, 19U)>; interrupts = <52 0>; status = "disabled"; @@ -73,7 +73,7 @@ uart5: serial@40005000 { compatible = "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1, 20U)>; interrupts = <53 0>; status = "disabled"; @@ -84,7 +84,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <36 5>; status = "disabled"; }; @@ -94,7 +94,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <51 5>; status = "disabled"; }; @@ -102,7 +102,7 @@ timers5: timers@40000c00 { compatible = "st,stm32-timers"; reg = <0x40000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB1, 3U)>; resets = <&rctl STM32_RESET(APB1, 3U)>; interrupts = <50 0>; interrupt-names = "global"; @@ -119,7 +119,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1, 4U)>; interrupts = <54 0>; interrupt-names = "global"; @@ -130,7 +130,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1, 5U)>; interrupts = <55 0>; interrupt-names = "global"; @@ -145,7 +145,7 @@ interrupt-names = "otgfs"; num-bidir-endpoints = <4>; ram-size = <1280>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00001000>; + clocks = <&rcc STM32_CLOCK(AHB1, 12U)>; phys = <&otgfs_phy>; status = "disabled"; }; diff --git a/dts/arm/st/f1/stm32f107.dtsi b/dts/arm/st/f1/stm32f107.dtsi index 3f629ef65d821..1ba41fff76034 100644 --- a/dts/arm/st/f1/stm32f107.dtsi +++ b/dts/arm/st/f1/stm32f107.dtsi @@ -14,7 +14,7 @@ compatible = "st,stm32-dma-v2bis"; #dma-cells = <2>; reg = <0x40020400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x2>; + clocks = <&rcc STM32_CLOCK(AHB1, 1U)>; interrupts = <56 0 57 0 58 0 59 0 60 0>; status = "disabled"; }; @@ -25,9 +25,9 @@ interrupts = <61 0>; clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx"; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00004000>, - <&rcc STM32_CLOCK_BUS_AHB1 0x00008000>, - <&rcc STM32_CLOCK_BUS_AHB1 0x00010000>; + clocks = <&rcc STM32_CLOCK(AHB1, 14U)>, + <&rcc STM32_CLOCK(AHB1, 15U)>, + <&rcc STM32_CLOCK(AHB1, 16U)>; status = "disabled"; }; }; diff --git a/dts/arm/st/f2/stm32f2.dtsi b/dts/arm/st/f2/stm32f2.dtsi index a625d4d362d45..a00519dd4dcc4 100644 --- a/dts/arm/st/f2/stm32f2.dtsi +++ b/dts/arm/st/f2/stm32f2.dtsi @@ -129,7 +129,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40020000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB1, 0U)>; }; gpiob: gpio@40020400 { @@ -137,7 +137,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40020400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(AHB1, 1U)>; }; gpioc: gpio@40020800 { @@ -145,7 +145,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40020800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(AHB1, 2U)>; }; gpiod: gpio@40020c00 { @@ -153,7 +153,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40020c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(AHB1, 3U)>; }; gpioe: gpio@40021000 { @@ -161,7 +161,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40021000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB1, 4U)>; }; gpiof: gpio@40021400 { @@ -169,7 +169,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40021400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB1, 5U)>; }; gpiog: gpio@40021800 { @@ -177,7 +177,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40021800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000040>; + clocks = <&rcc STM32_CLOCK(AHB1, 6U)>; }; gpioh: gpio@40021c00 { @@ -185,7 +185,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40021c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000080>; + clocks = <&rcc STM32_CLOCK(AHB1, 7U)>; }; gpioi: gpio@40022000 { @@ -193,14 +193,14 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40022000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000100>; + clocks = <&rcc STM32_CLOCK(AHB1, 8U)>; }; }; rtc: rtc@40002800 { compatible = "st,stm32-rtc"; reg = <0x40002800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>; + clocks = <&rcc STM32_CLOCK(APB1, 28U)>; interrupts = <41 0>; prescaler = <32768>; alarms-count = <2>; @@ -223,7 +223,7 @@ wwdg: watchdog@40002c00 { compatible = "st,stm32-window-watchdog"; reg = <0x40002C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <0 7>; status = "disabled"; }; @@ -231,7 +231,7 @@ usart1: serial@40011000 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40011000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB2, 4U)>; resets = <&rctl STM32_RESET(APB2, 4U)>; interrupts = <37 0>; status = "disabled"; @@ -240,7 +240,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1, 17U)>; interrupts = <38 0>; status = "disabled"; @@ -249,7 +249,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1, 18U)>; interrupts = <39 0>; status = "disabled"; @@ -258,7 +258,7 @@ usart6: serial@40011400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40011400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB2, 5U)>; resets = <&rctl STM32_RESET(APB2, 5U)>; interrupts = <71 0>; status = "disabled"; @@ -267,7 +267,7 @@ uart4: serial@40004c00 { compatible ="st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1, 19U)>; interrupts = <52 0>; status = "disabled"; @@ -276,7 +276,7 @@ uart5: serial@40005000 { compatible = "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1, 20U)>; interrupts = <53 0>; status = "disabled"; @@ -287,7 +287,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB2, 12U)>; interrupts = <35 5>; status = "disabled"; }; @@ -297,7 +297,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <36 5>; status = "disabled"; }; @@ -307,7 +307,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <51 5>; status = "disabled"; }; @@ -318,7 +318,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB1, 21U)>; interrupts = <31 0>, <32 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -330,7 +330,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <33 0>, <34 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -342,7 +342,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>; + clocks = <&rcc STM32_CLOCK(APB1, 23U)>; interrupts = <72 0>, <73 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -356,7 +356,7 @@ num-bidir-endpoints = <4>; ram-size = <1280>; maximum-speed = "full-speed"; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000080>, + clocks = <&rcc STM32_CLOCK(AHB2, 7U)>, <&rcc STM32_SRC_PLL_Q NO_SEL>; phys = <&otgfs_phy>; status = "disabled"; @@ -365,7 +365,7 @@ adc1: adc@40012000 { compatible = "st,stm32f4-adc", "st,stm32-adc"; reg = <0x40012000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000100>; + clocks = <&rcc STM32_CLOCK(APB2, 8U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; @@ -383,7 +383,7 @@ #dma-cells = <4>; reg = <0x40026000 0x400>; interrupts = <11 0 12 0 13 0 14 0 15 0 16 0 17 0 47 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x200000>; + clocks = <&rcc STM32_CLOCK(AHB1, 21U)>; status = "disabled"; }; @@ -392,7 +392,7 @@ #dma-cells = <4>; reg = <0x40026400 0x400>; interrupts = <56 0 57 0 58 0 59 0 60 0 68 0 69 0 70 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x400000>; + clocks = <&rcc STM32_CLOCK(AHB1, 22U)>; st,mem2mem; status = "disabled"; }; @@ -400,7 +400,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -408,7 +408,7 @@ timers1: timers@40010000 { compatible = "st,stm32-timers"; reg = <0x40010000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB2, 0U)>; resets = <&rctl STM32_RESET(APB2, 0U)>; interrupts = <24 0>, <25 0>, <26 0>, <27 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -425,7 +425,7 @@ timers2: timers@40000000 { compatible = "st,stm32-timers"; reg = <0x40000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1, 0U)>; resets = <&rctl STM32_RESET(APB1, 0U)>; interrupts = <28 0>; interrupt-names = "global"; @@ -442,7 +442,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1, 1U)>; interrupts = <29 0>; interrupt-names = "global"; @@ -464,7 +464,7 @@ timers4: timers@40000800 { compatible = "st,stm32-timers"; reg = <0x40000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB1, 2U)>; resets = <&rctl STM32_RESET(APB1, 2U)>; interrupts = <30 0>; interrupt-names = "global"; @@ -486,7 +486,7 @@ timers5: timers@40000c00 { compatible = "st,stm32-timers"; reg = <0x40000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB1, 3U)>; resets = <&rctl STM32_RESET(APB1, 3U)>; interrupts = <50 0>; interrupt-names = "global"; @@ -508,7 +508,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1, 4U)>; interrupts = <54 0>; interrupt-names = "global"; @@ -524,7 +524,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1, 5U)>; interrupts = <55 0>; interrupt-names = "global"; @@ -540,7 +540,7 @@ timers8: timers@40010400 { compatible = "st,stm32-timers"; reg = <0x40010400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB2, 1U)>; resets = <&rctl STM32_RESET(APB2, 1U)>; interrupts = <43 0>, <44 0>, <45 0>, <46 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -557,7 +557,7 @@ timers9: timers@40014000 { compatible = "st,stm32-timers"; reg = <0x40014000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(APB2, 16U)>; resets = <&rctl STM32_RESET(APB2, 16U)>; interrupts = <24 0>; interrupt-names = "global"; @@ -579,7 +579,7 @@ timers10: timers@40014400 { compatible = "st,stm32-timers"; reg = <0x40014400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB2, 17U)>; resets = <&rctl STM32_RESET(APB2, 17U)>; interrupts = <25 0>; interrupt-names = "global"; @@ -601,7 +601,7 @@ timers11: timers@40014800 { compatible = "st,stm32-timers"; reg = <0x40014800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB2, 18U)>; resets = <&rctl STM32_RESET(APB2, 18U)>; interrupts = <26 0>; interrupt-names = "global"; @@ -623,7 +623,7 @@ timers12: timers@40001800 { compatible = "st,stm32-timers"; reg = <0x40001800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000040>; + clocks = <&rcc STM32_CLOCK(APB1, 6U)>; resets = <&rctl STM32_RESET(APB1, 6U)>; interrupts = <43 0>; interrupt-names = "global"; @@ -645,7 +645,7 @@ timers13: timers@40001c00 { compatible = "st,stm32-timers"; reg = <0x40001c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000080>; + clocks = <&rcc STM32_CLOCK(APB1, 7U)>; resets = <&rctl STM32_RESET(APB1, 7U)>; interrupts = <44 0>; interrupt-names = "global"; @@ -667,7 +667,7 @@ timers14: timers@40002000 { compatible = "st,stm32-timers"; reg = <0x40002000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000100>; + clocks = <&rcc STM32_CLOCK(APB1, 8U)>; resets = <&rctl STM32_RESET(APB1, 8U)>; interrupts = <45 0>; interrupt-names = "global"; @@ -690,14 +690,14 @@ compatible = "st,stm32-rng"; reg = <0x50060800 0x400>; interrupts = <80 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000040>; + clocks = <&rcc STM32_CLOCK(AHB2, 6U)>; status = "disabled"; }; backup_sram: memory@40024000 { compatible = "zephyr,memory-region", "st,stm32-backup-sram"; reg = <0x40024000 DT_SIZE_K(4)>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(AHB1, 18U)>; zephyr,memory-region = "BACKUP_SRAM"; status = "disabled"; }; diff --git a/dts/arm/st/f2/stm32f207.dtsi b/dts/arm/st/f2/stm32f207.dtsi index 726266c0b2794..a3d8ce18bb721 100644 --- a/dts/arm/st/f2/stm32f207.dtsi +++ b/dts/arm/st/f2/stm32f207.dtsi @@ -16,10 +16,10 @@ interrupts = <61 0>; clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx", "mac-clk-ptp"; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x02000000>, - <&rcc STM32_CLOCK_BUS_AHB1 0x04000000>, - <&rcc STM32_CLOCK_BUS_AHB1 0x08000000>, - <&rcc STM32_CLOCK_BUS_AHB1 0x10000000>; + clocks = <&rcc STM32_CLOCK(AHB1, 25U)>, + <&rcc STM32_CLOCK(AHB1, 26U)>, + <&rcc STM32_CLOCK(AHB1, 27U)>, + <&rcc STM32_CLOCK(AHB1, 28U)>; status = "disabled"; }; }; diff --git a/dts/arm/st/f3/stm32f3.dtsi b/dts/arm/st/f3/stm32f3.dtsi index 07ed6f9dc2606..435877e136e22 100644 --- a/dts/arm/st/f3/stm32f3.dtsi +++ b/dts/arm/st/f3/stm32f3.dtsi @@ -79,7 +79,7 @@ compatible = "st,stm32-flash-controller", "st,stm32f1-flash-controller"; reg = <0x40022000 0x400>; interrupts = <4 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB1, 4U)>; #address-cells = <1>; #size-cells = <1>; @@ -131,7 +131,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(AHB1, 17U)>; }; gpiob: gpio@48000400 { @@ -139,7 +139,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(AHB1, 18U)>; }; gpioc: gpio@48000800 { @@ -147,7 +147,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(AHB1, 19U)>; }; gpiod: gpio@48000c00 { @@ -155,7 +155,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(AHB1, 20U)>; }; gpiof: gpio@48001400 { @@ -163,7 +163,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(AHB1, 22U)>; }; }; @@ -176,7 +176,7 @@ wwdg: watchdog@40002c00 { compatible = "st,stm32-window-watchdog"; reg = <0x40002C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <0 7>; status = "disabled"; }; @@ -184,7 +184,7 @@ usart1: serial@40013800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40013800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB2, 14U)>; resets = <&rctl STM32_RESET(APB2, 14U)>; interrupts = <37 0>; status = "disabled"; @@ -193,7 +193,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1, 17U)>; interrupts = <38 0>; status = "disabled"; @@ -202,7 +202,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1, 18U)>; interrupts = <39 0>; status = "disabled"; @@ -211,7 +211,7 @@ uart4: serial@40004c00 { compatible = "st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1, 19U)>; interrupts = <52 0>; status = "disabled"; @@ -223,7 +223,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>, + clocks = <&rcc STM32_CLOCK(APB1, 21U)>, /* I2C clock source should always be defined, * even for the default value */ @@ -238,7 +238,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB2, 12U)>; interrupts = <35 5>; status = "disabled"; }; @@ -246,7 +246,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -259,14 +259,14 @@ num-bidir-endpoints = <8>; ram-size = <512>; phys = <&usb_fs_phy>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>; + clocks = <&rcc STM32_CLOCK(APB1, 23U)>; status = "disabled"; }; timers2: timers@40000000 { compatible = "st,stm32-timers"; reg = <0x40000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1, 0U)>; resets = <&rctl STM32_RESET(APB1, 0U)>; interrupts = <28 0>; interrupt-names = "global"; @@ -288,7 +288,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1, 1U)>; interrupts = <29 0>; interrupt-names = "global"; @@ -310,7 +310,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1, 4U)>; interrupts = <54 0>; interrupt-names = "global"; @@ -326,7 +326,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1, 5U)>; interrupts = <55 0>; interrupt-names = "global"; @@ -342,7 +342,7 @@ timers15: timers@40014000 { compatible = "st,stm32-timers"; reg = <0x40014000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(APB2, 16U)>; resets = <&rctl STM32_RESET(APB2, 16U)>; interrupts = <24 0>; interrupt-names = "global"; @@ -364,7 +364,7 @@ timers16: timers@40014400 { compatible = "st,stm32-timers"; reg = <0x40014400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB2, 17U)>; resets = <&rctl STM32_RESET(APB2, 17U)>; interrupts = <25 0>; interrupt-names = "global"; @@ -386,7 +386,7 @@ timers17: timers@40014800 { compatible = "st,stm32-timers"; reg = <0x40014800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB2, 18U)>; resets = <&rctl STM32_RESET(APB2, 18U)>; interrupts = <26 0>; interrupt-names = "global"; @@ -408,7 +408,7 @@ rtc: rtc@40002800 { compatible = "st,stm32-rtc"; reg = <0x40002800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>; + clocks = <&rcc STM32_CLOCK(APB1, 28U)>; interrupts = <41 0>; prescaler = <32768>; alarms-count = <2>; @@ -421,7 +421,7 @@ reg = <0x40006400 0x400>; interrupts = <19 0>, <20 0>, <21 0>, <22 0>; interrupt-names = "TX", "RX0", "RX1", "SCE"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; status = "disabled"; }; @@ -429,7 +429,7 @@ compatible = "st,stm32-dma-v2bis"; #dma-cells = <2>; reg = <0x40020000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x1>; + clocks = <&rcc STM32_CLOCK(AHB1, 0U)>; interrupts = <11 0 12 0 13 0 14 0 15 0 16 0 17 0>; status = "disabled"; }; diff --git a/dts/arm/st/f3/stm32f302.dtsi b/dts/arm/st/f3/stm32f302.dtsi index 5d2c40be20b1e..de7a1c202b03d 100644 --- a/dts/arm/st/f3/stm32f302.dtsi +++ b/dts/arm/st/f3/stm32f302.dtsi @@ -22,7 +22,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>, + clocks = <&rcc STM32_CLOCK(APB1, 22U)>, /* I2C clock source should always be defined, * even for the default value */ @@ -38,7 +38,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40007800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x40000000>, + clocks = <&rcc STM32_CLOCK(APB1, 30U)>, /* I2C clock source should always be defined, * even for the default value */ @@ -53,7 +53,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <36 5>; status = "disabled"; }; @@ -63,7 +63,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0X40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <51 5>; status = "disabled"; }; @@ -71,7 +71,7 @@ timers1: timers@40012c00 { compatible = "st,stm32-timers"; reg = <0x40012c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB2, 11U)>; resets = <&rctl STM32_RESET(APB2, 11U)>; interrupts = <24 0>, <25 0>, <26 0>, <27 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -88,7 +88,7 @@ timers4: timers@40000800 { compatible = "st,stm32-timers"; reg = <0x40000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB1, 2U)>; resets = <&rctl STM32_RESET(APB1, 2U)>; interrupts = <30 0>; interrupt-names = "global"; @@ -105,7 +105,7 @@ adc1: adc@50000000 { compatible = "st,stm32-adc"; reg = <0x50000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x10000000>; + clocks = <&rcc STM32_CLOCK(AHB1, 28U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; diff --git a/dts/arm/st/f3/stm32f302Xc.dtsi b/dts/arm/st/f3/stm32f302Xc.dtsi index 8d30e7d31d189..859feab046fa1 100644 --- a/dts/arm/st/f3/stm32f302Xc.dtsi +++ b/dts/arm/st/f3/stm32f302Xc.dtsi @@ -23,7 +23,7 @@ compatible = "st,stm32-dma-v2bis"; #dma-cells = <2>; reg = <0x40020400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x2>; + clocks = <&rcc STM32_CLOCK(AHB1, 1U)>; interrupts = <56 0 57 0 58 0 59 0 60 0>; status = "disabled"; }; @@ -31,7 +31,7 @@ uart5: serial@40005000 { compatible = "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; interrupts = <53 0>; status = "disabled"; }; @@ -42,7 +42,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(AHB1, 21U)>; }; }; }; diff --git a/dts/arm/st/f3/stm32f303.dtsi b/dts/arm/st/f3/stm32f303.dtsi index 5fa8d11b150de..9122ee4cf01bc 100644 --- a/dts/arm/st/f3/stm32f303.dtsi +++ b/dts/arm/st/f3/stm32f303.dtsi @@ -22,7 +22,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>, + clocks = <&rcc STM32_CLOCK(APB1, 22U)>, /* I2C clock source should always be defined, * even for the default value */ @@ -37,7 +37,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <36 5>; status = "disabled"; }; @@ -47,7 +47,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <51 5>; status = "disabled"; }; @@ -55,7 +55,7 @@ uart5: serial@40005000 { compatible = "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1, 20U)>; interrupts = <53 0>; status = "disabled"; @@ -68,14 +68,14 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(AHB1, 21U)>; }; }; timers1: timers@40012c00 { compatible = "st,stm32-timers"; reg = <0x40012c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB2, 11U)>; resets = <&rctl STM32_RESET(APB2, 11U)>; interrupts = <24 0>, <25 0>, <26 0>, <27 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -92,7 +92,7 @@ timers4: timers@40000800 { compatible = "st,stm32-timers"; reg = <0x40000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB1, 2U)>; resets = <&rctl STM32_RESET(APB1, 2U)>; interrupts = <30 0>; interrupt-names = "global"; @@ -109,7 +109,7 @@ timers8: timers@40013400 { compatible = "st,stm32-timers"; reg = <0x40013400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(APB2, 13U)>; resets = <&rctl STM32_RESET(APB2, 13U)>; interrupts = <43 0>, <44 0>, <45 0>, <46 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -126,7 +126,7 @@ timers20: timers@40015000 { compatible = "st,stm32-timers"; reg = <0x40015000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB2, 20U)>; resets = <&rctl STM32_RESET(APB2, 20U)>; interrupts = <77 0>, <78 0>, <79 0>, <80 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -143,7 +143,7 @@ adc1: adc@50000000 { compatible = "st,stm32-adc"; reg = <0x50000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x10000000>; + clocks = <&rcc STM32_CLOCK(AHB1, 28U)>; interrupts = <18 0>; status = "disabled"; vref-mv = <3000>; @@ -159,7 +159,7 @@ adc2: adc@50000100 { compatible = "st,stm32-adc"; reg = <0x50000100 0x4c>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x10000000>; + clocks = <&rcc STM32_CLOCK(AHB1, 28U)>; interrupts = <18 0>; status = "disabled"; vref-mv = <3000>; diff --git a/dts/arm/st/f3/stm32f303X8.dtsi b/dts/arm/st/f3/stm32f303X8.dtsi index 9a8a743cae658..2e03ffe83790e 100644 --- a/dts/arm/st/f3/stm32f303X8.dtsi +++ b/dts/arm/st/f3/stm32f303X8.dtsi @@ -28,7 +28,7 @@ dac2: dac@40009800 { compatible = "st,stm32-dac"; reg = <0x40009800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x04000000>; + clocks = <&rcc STM32_CLOCK(APB1, 26U)>; status = "disabled"; #io-channel-cells = <1>; }; diff --git a/dts/arm/st/f3/stm32f303Xb.dtsi b/dts/arm/st/f3/stm32f303Xb.dtsi index 040566c0b2298..b0aff89104e10 100644 --- a/dts/arm/st/f3/stm32f303Xb.dtsi +++ b/dts/arm/st/f3/stm32f303Xb.dtsi @@ -29,7 +29,7 @@ compatible = "st,stm32-dma-v2bis"; #dma-cells = <2>; reg = <0x40020400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x2>; + clocks = <&rcc STM32_CLOCK(AHB1, 1U)>; interrupts = <56 0 57 0 58 0 59 0 60 0>; status = "disabled"; }; diff --git a/dts/arm/st/f3/stm32f303Xe.dtsi b/dts/arm/st/f3/stm32f303Xe.dtsi index 77ccb43565500..bb04ee099aee3 100644 --- a/dts/arm/st/f3/stm32f303Xe.dtsi +++ b/dts/arm/st/f3/stm32f303Xe.dtsi @@ -29,7 +29,7 @@ compatible = "st,stm32-dma-v2bis"; #dma-cells = <2>; reg = <0x40020400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x2>; + clocks = <&rcc STM32_CLOCK(AHB1, 1U)>; interrupts = <56 0 57 0 58 0 59 0 60 0>; status = "disabled"; }; diff --git a/dts/arm/st/f3/stm32f334.dtsi b/dts/arm/st/f3/stm32f334.dtsi index f24fefc22df8d..77786fada02e0 100644 --- a/dts/arm/st/f3/stm32f334.dtsi +++ b/dts/arm/st/f3/stm32f334.dtsi @@ -14,7 +14,7 @@ timers1: timers@40012c00 { compatible = "st,stm32-timers"; reg = <0x40012c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB2, 11U)>; resets = <&rctl STM32_RESET(APB2, 11U)>; interrupts = <24 0>, <25 0>, <26 0>, <27 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -31,7 +31,7 @@ adc1: adc@50000000 { compatible = "st,stm32-adc"; reg = <0x50000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x10000000>; + clocks = <&rcc STM32_CLOCK(AHB1, 28U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; diff --git a/dts/arm/st/f3/stm32f334X8.dtsi b/dts/arm/st/f3/stm32f334X8.dtsi index 03e86c86a38dd..d74d77ab49a3d 100644 --- a/dts/arm/st/f3/stm32f334X8.dtsi +++ b/dts/arm/st/f3/stm32f334X8.dtsi @@ -28,7 +28,7 @@ dac2: dac@40009800 { compatible = "st,stm32-dac"; reg = <0x40009800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x04000000>; + clocks = <&rcc STM32_CLOCK(APB1, 26U)>; status = "disabled"; #io-channel-cells = <1>; }; diff --git a/dts/arm/st/f3/stm32f373.dtsi b/dts/arm/st/f3/stm32f373.dtsi index 73c4de1eafac3..b06356312d120 100644 --- a/dts/arm/st/f3/stm32f373.dtsi +++ b/dts/arm/st/f3/stm32f373.dtsi @@ -25,7 +25,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(AHB1, 21U)>; }; }; @@ -35,7 +35,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>, + clocks = <&rcc STM32_CLOCK(APB1, 22U)>, /* I2C clock source should always be defined, * even for the default value */ @@ -50,7 +50,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <36 5>; status = "disabled"; }; @@ -60,7 +60,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <51 5>; status = "disabled"; }; @@ -68,7 +68,7 @@ timers4: timers@40000800 { compatible = "st,stm32-timers"; reg = <0x40000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB1, 2U)>; resets = <&rctl STM32_RESET(APB1, 2U)>; interrupts = <30 0>; interrupt-names = "global"; @@ -85,7 +85,7 @@ timers5: timers@40000c00 { compatible = "st,stm32-timers"; reg = <0x40000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB1, 3U)>; resets = <&rctl STM32_RESET(APB1, 3U)>; interrupts = <50 0>; interrupt-names = "global"; @@ -102,7 +102,7 @@ timers12: timers@40001800 { compatible = "st,stm32-timers"; reg = <0x40001800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000040>; + clocks = <&rcc STM32_CLOCK(APB1, 6U)>; resets = <&rctl STM32_RESET(APB1, 6U)>; interrupts = <43 0>; interrupt-names = "global"; @@ -119,7 +119,7 @@ timers13: timers@40001c00 { compatible = "st,stm32-timers"; reg = <0x40001c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000080>; + clocks = <&rcc STM32_CLOCK(APB1, 7U)>; resets = <&rctl STM32_RESET(APB1, 7U)>; interrupts = <44 0>; interrupt-names = "global"; @@ -136,7 +136,7 @@ timers14: timers@40002000 { compatible = "st,stm32-timers"; reg = <0x40002000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000100>; + clocks = <&rcc STM32_CLOCK(APB1, 8U)>; resets = <&rctl STM32_RESET(APB1, 8U)>; interrupts = <45 0>; interrupt-names = "global"; @@ -153,7 +153,7 @@ timers18: timers@40009c00 { compatible = "st,stm32-timers"; reg = <0x40009c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000200>; + clocks = <&rcc STM32_CLOCK(APB1, 9U)>; resets = <&rctl STM32_RESET(APB1, 9U)>; interrupts = <27 0>; interrupt-names = "global"; @@ -170,7 +170,7 @@ timers19: timers@40015c00 { compatible = "st,stm32-timers"; reg = <0x40015c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB2, 19U)>; resets = <&rctl STM32_RESET(APB2, 19U)>; interrupts = <78 0>; interrupt-names = "global"; @@ -187,7 +187,7 @@ adc1: adc@40012400 { compatible = "st,stm32f1-adc", "st,stm32-adc"; reg = <0x40012400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000200>; + clocks = <&rcc STM32_CLOCK(APB2, 9U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; diff --git a/dts/arm/st/f3/stm32f373Xc.dtsi b/dts/arm/st/f3/stm32f373Xc.dtsi index 4214cf98516bf..6ad6a7174a08a 100644 --- a/dts/arm/st/f3/stm32f373Xc.dtsi +++ b/dts/arm/st/f3/stm32f373Xc.dtsi @@ -22,7 +22,7 @@ dma2: dma@40020400 { compatible = "st,stm32-dma-v2bis"; reg = <0x40020400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x2>; + clocks = <&rcc STM32_CLOCK(AHB1, 1U)>; interrupts = <56 0 57 0 58 0 59 0 60 0>; status = "disabled"; }; @@ -30,7 +30,7 @@ dac2: dac@40009800 { compatible = "st,stm32-dac"; reg = <0x40009800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x04000000>; + clocks = <&rcc STM32_CLOCK(APB1, 26U)>; status = "disabled"; #io-channel-cells = <1>; }; diff --git a/dts/arm/st/f4/stm32f4.dtsi b/dts/arm/st/f4/stm32f4.dtsi index 2757295f6d8c7..4a85aabc5ada8 100644 --- a/dts/arm/st/f4/stm32f4.dtsi +++ b/dts/arm/st/f4/stm32f4.dtsi @@ -160,7 +160,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40020000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB1, 0U)>; }; gpiob: gpio@40020400 { @@ -168,7 +168,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40020400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(AHB1, 1U)>; }; gpioc: gpio@40020800 { @@ -176,7 +176,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40020800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(AHB1, 2U)>; }; gpiod: gpio@40020c00 { @@ -184,7 +184,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40020c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(AHB1, 3U)>; }; gpioe: gpio@40021000 { @@ -192,7 +192,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40021000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB1, 4U)>; }; gpiof: gpio@40021400 { @@ -200,7 +200,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40021400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB1, 5U)>; }; gpiog: gpio@40021800 { @@ -208,7 +208,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40021800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000040>; + clocks = <&rcc STM32_CLOCK(AHB1, 6U)>; }; gpioh: gpio@40021c00 { @@ -216,7 +216,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40021c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000080>; + clocks = <&rcc STM32_CLOCK(AHB1, 7U)>; }; }; @@ -229,7 +229,7 @@ wwdg: watchdog@40002c00 { compatible = "st,stm32-window-watchdog"; reg = <0x40002C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <0 7>; status = "disabled"; }; @@ -237,7 +237,7 @@ usart1: serial@40011000 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40011000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB2, 4U)>; resets = <&rctl STM32_RESET(APB2, 4U)>; interrupts = <37 0>; status = "disabled"; @@ -246,7 +246,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1, 17U)>; interrupts = <38 0>; status = "disabled"; @@ -255,7 +255,7 @@ usart6: serial@40011400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40011400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB2, 5U)>; resets = <&rctl STM32_RESET(APB2, 5U)>; interrupts = <71 0>; status = "disabled"; @@ -267,7 +267,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB1, 21U)>; interrupts = <31 0>, <32 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -279,7 +279,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <33 0>, <34 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -291,7 +291,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>; + clocks = <&rcc STM32_CLOCK(APB1, 23U)>; interrupts = <72 0>, <73 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -302,7 +302,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB2, 12U)>; interrupts = <35 5>; status = "disabled"; }; @@ -316,7 +316,7 @@ ram-size = <1280>; maximum-speed = "full-speed"; phys = <&otgfs_phy>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000080>, + clocks = <&rcc STM32_CLOCK(AHB2, 7U)>, <&rcc STM32_SRC_PLL_Q NO_SEL>; status = "disabled"; }; @@ -324,7 +324,7 @@ timers1: timers@40010000 { compatible = "st,stm32-timers"; reg = <0x40010000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB2, 0U)>; resets = <&rctl STM32_RESET(APB2, 0U)>; interrupts = <24 0>, <25 0>, <26 0>, <27 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -347,7 +347,7 @@ timers2: timers@40000000 { compatible = "st,stm32-timers"; reg = <0x40000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1, 0U)>; resets = <&rctl STM32_RESET(APB1, 0U)>; interrupts = <28 0>; interrupt-names = "global"; @@ -375,7 +375,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1, 1U)>; interrupts = <29 0>; interrupt-names = "global"; @@ -403,7 +403,7 @@ timers4: timers@40000800 { compatible = "st,stm32-timers"; reg = <0x40000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB1, 2U)>; resets = <&rctl STM32_RESET(APB1, 2U)>; interrupts = <30 0>; interrupt-names = "global"; @@ -431,7 +431,7 @@ timers5: timers@40000c00 { compatible = "st,stm32-timers"; reg = <0x40000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB1, 3U)>; resets = <&rctl STM32_RESET(APB1, 3U)>; interrupts = <50 0>; interrupt-names = "global"; @@ -459,7 +459,7 @@ timers9: timers@40014000 { compatible = "st,stm32-timers"; reg = <0x40014000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(APB2, 16U)>; resets = <&rctl STM32_RESET(APB2, 16U)>; interrupts = <24 0>; interrupt-names = "global"; @@ -481,7 +481,7 @@ timers10: timers@40014400 { compatible = "st,stm32-timers"; reg = <0x40014400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB2, 17U)>; resets = <&rctl STM32_RESET(APB2, 17U)>; interrupts = <25 0>; interrupt-names = "global"; @@ -503,7 +503,7 @@ timers11: timers@40014800 { compatible = "st,stm32-timers"; reg = <0x40014800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB2, 18U)>; resets = <&rctl STM32_RESET(APB2, 18U)>; interrupts = <26 0>; interrupt-names = "global"; @@ -526,7 +526,7 @@ compatible = "st,stm32-rtc"; reg = <0x40002800 0x400>; interrupts = <41 0>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>; + clocks = <&rcc STM32_CLOCK(APB1, 28U)>; prescaler = <32768>; alarms-count = <2>; alrm-exti-line = <17>; @@ -542,7 +542,7 @@ adc1: adc@40012000 { compatible = "st,stm32f4-adc", "st,stm32-adc"; reg = <0x40012000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000100>; + clocks = <&rcc STM32_CLOCK(APB2, 8U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; @@ -560,7 +560,7 @@ #dma-cells = <4>; reg = <0x40026000 0x400>; interrupts = <11 0 12 0 13 0 14 0 15 0 16 0 17 0 47 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x200000>; + clocks = <&rcc STM32_CLOCK(AHB1, 21U)>; status = "disabled"; }; @@ -569,7 +569,7 @@ #dma-cells = <4>; reg = <0x40026400 0x400>; interrupts = <56 0 57 0 58 0 59 0 60 0 68 0 69 0 70 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x400000>; + clocks = <&rcc STM32_CLOCK(AHB1, 22U)>; st,mem2mem; status = "disabled"; }; @@ -577,7 +577,7 @@ sdmmc1: sdmmc@40012c00 { compatible = "st,stm32-sdmmc"; reg = <0x40012c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000800>, + clocks = <&rcc STM32_CLOCK(APB2, 11U)>, <&rcc STM32_SRC_PLL_Q NO_SEL>; resets = <&rctl STM32_RESET(APB2, 11U)>; interrupts = <49 0>; diff --git a/dts/arm/st/f4/stm32f401.dtsi b/dts/arm/st/f4/stm32f401.dtsi index be3eb9fc1a9ab..eda9b1e4a9824 100644 --- a/dts/arm/st/f4/stm32f401.dtsi +++ b/dts/arm/st/f4/stm32f401.dtsi @@ -23,7 +23,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <36 5>; status = "disabled"; }; @@ -33,7 +33,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <51 5>; status = "disabled"; }; @@ -43,7 +43,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(APB2, 13U)>; interrupts = <84 5>; status = "disabled"; }; @@ -53,7 +53,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <36 5>; dmas = <&dma1 4 0 0x400 0x3 &dma1 3 0 0x400 0x3>; @@ -66,7 +66,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <51 5>; dmas = <&dma1 5 0 0x400 0x3 &dma1 0 0 0x400 0x3>; diff --git a/dts/arm/st/f4/stm32f405.dtsi b/dts/arm/st/f4/stm32f405.dtsi index be2941822e1b5..9dbc4af8c57ef 100644 --- a/dts/arm/st/f4/stm32f405.dtsi +++ b/dts/arm/st/f4/stm32f405.dtsi @@ -23,7 +23,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40021400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB1, 5U)>; }; gpiog: gpio@40021800 { @@ -31,7 +31,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40021800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000040>; + clocks = <&rcc STM32_CLOCK(AHB1, 6U)>; }; gpioi: gpio@40022000 { @@ -39,14 +39,14 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40022000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000100>; + clocks = <&rcc STM32_CLOCK(AHB1, 8U)>; }; }; usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1, 18U)>; interrupts = <39 0>; status = "disabled"; @@ -55,7 +55,7 @@ uart4: serial@40004c00 { compatible ="st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1, 19U)>; interrupts = <52 0>; status = "disabled"; @@ -64,7 +64,7 @@ uart5: serial@40005000 { compatible = "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1, 20U)>; interrupts = <53 0>; status = "disabled"; @@ -73,7 +73,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1, 4U)>; interrupts = <54 0>; interrupt-names = "global"; @@ -89,7 +89,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1, 5U)>; interrupts = <55 0>; interrupt-names = "global"; @@ -105,7 +105,7 @@ timers8: timers@40010400 { compatible = "st,stm32-timers"; reg = <0x40010400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB2, 1U)>; resets = <&rctl STM32_RESET(APB2, 1U)>; interrupts = <43 0>, <44 0>, <45 0>, <46 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -128,7 +128,7 @@ timers12: timers@40001800 { compatible = "st,stm32-timers"; reg = <0x40001800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000040>; + clocks = <&rcc STM32_CLOCK(APB1, 6U)>; resets = <&rctl STM32_RESET(APB1, 6U)>; interrupts = <43 0>; interrupt-names = "global"; @@ -150,7 +150,7 @@ timers13: timers@40001c00 { compatible = "st,stm32-timers"; reg = <0x40001c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000080>; + clocks = <&rcc STM32_CLOCK(APB1, 7U)>; resets = <&rctl STM32_RESET(APB1, 7U)>; interrupts = <44 0>; interrupt-names = "global"; @@ -172,7 +172,7 @@ timers14: timers@40002000 { compatible = "st,stm32-timers"; reg = <0x40002000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000100>; + clocks = <&rcc STM32_CLOCK(APB1, 8U)>; resets = <&rctl STM32_RESET(APB1, 8U)>; interrupts = <45 0>; interrupt-names = "global"; @@ -200,7 +200,7 @@ ram-size = <4096>; maximum-speed = "full-speed"; phys = <&otghs_fs_phy>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x20000000>, + clocks = <&rcc STM32_CLOCK(AHB1, 29U)>, <&rcc STM32_SRC_PLL_Q NO_SEL>; status = "disabled"; }; @@ -210,7 +210,7 @@ reg = <0x40006400 0x400>; interrupts = <19 0>, <20 0>, <21 0>, <22 0>; interrupt-names = "TX", "RX0", "RX1", "SCE"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; status = "disabled"; }; @@ -220,7 +220,7 @@ interrupts = <63 0>, <64 0>, <65 0>, <66 0>; interrupt-names = "TX", "RX0", "RX1", "SCE"; /* also enabling clock for can1 (master instance) */ - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x06000000>; + clocks = <&rcc STM32_CLOCK(APB1, 26U)>; master-can-reg = <0x40006400>; status = "disabled"; }; @@ -229,14 +229,14 @@ compatible = "st,stm32-rng"; reg = <0x50060800 0x400>; interrupts = <80 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000040>; + clocks = <&rcc STM32_CLOCK(AHB2, 6U)>; status = "disabled"; }; backup_sram: memory@40024000 { compatible = "zephyr,memory-region", "st,stm32-backup-sram"; reg = <0x40024000 DT_SIZE_K(4)>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(AHB1, 18U)>; zephyr,memory-region = "BACKUP_SRAM"; status = "disabled"; }; @@ -244,7 +244,7 @@ adc2: adc@40012100 { compatible = "st,stm32-adc"; reg = <0x40012100 0x050>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000200>; + clocks = <&rcc STM32_CLOCK(APB2, 9U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; @@ -260,7 +260,7 @@ adc3: adc@40012200 { compatible = "st,stm32-adc"; reg = <0x40012200 0x050>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000400>; + clocks = <&rcc STM32_CLOCK(APB2, 10U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; @@ -276,7 +276,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; diff --git a/dts/arm/st/f4/stm32f407.dtsi b/dts/arm/st/f4/stm32f407.dtsi index fbf69aab3b877..8ced67aaf26b0 100644 --- a/dts/arm/st/f4/stm32f407.dtsi +++ b/dts/arm/st/f4/stm32f407.dtsi @@ -16,10 +16,10 @@ interrupts = <61 0>; clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx", "mac-clk-ptp"; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x02000000>, - <&rcc STM32_CLOCK_BUS_AHB1 0x04000000>, - <&rcc STM32_CLOCK_BUS_AHB1 0x08000000>, - <&rcc STM32_CLOCK_BUS_AHB1 0x10000000>; + clocks = <&rcc STM32_CLOCK(AHB1, 25U)>, + <&rcc STM32_CLOCK(AHB1, 26U)>, + <&rcc STM32_CLOCK(AHB1, 27U)>, + <&rcc STM32_CLOCK(AHB1, 28U)>; status = "disabled"; }; }; diff --git a/dts/arm/st/f4/stm32f410.dtsi b/dts/arm/st/f4/stm32f410.dtsi index 0752bb80b23c9..9593affa63aef 100644 --- a/dts/arm/st/f4/stm32f410.dtsi +++ b/dts/arm/st/f4/stm32f410.dtsi @@ -20,7 +20,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <36 5>; status = "disabled"; }; @@ -30,7 +30,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40015000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB2, 20U)>; interrupts = <85 5>; status = "disabled"; }; @@ -40,7 +40,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB2, 12U)>; interrupts = <35 5>; dmas = <&dma2 3 3 0x400 0x3 &dma2 2 3 0x400 0x3>; @@ -53,7 +53,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <36 5>; dmas = <&dma1 4 0 0x400 0x3 &dma1 3 0 0x400 0x3>; @@ -66,7 +66,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40015000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB2, 20U)>; interrupts = <85 5>; dmas = <&dma2 6 7 0x400 0x3 &dma2 5 7 0x400 0x3>; @@ -77,7 +77,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1, 4U)>; interrupts = <54 0>; interrupt-names = "global"; @@ -93,7 +93,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -102,7 +102,7 @@ compatible = "st,stm32-rng"; reg = <0x40080000 0x400>; interrupts = <80 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x80000000>; + clocks = <&rcc STM32_CLOCK(AHB1, 31U)>; status = "disabled"; }; }; diff --git a/dts/arm/st/f4/stm32f411.dtsi b/dts/arm/st/f4/stm32f411.dtsi index 0826bf2cbaad2..846b5d6b74eb2 100644 --- a/dts/arm/st/f4/stm32f411.dtsi +++ b/dts/arm/st/f4/stm32f411.dtsi @@ -15,7 +15,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40015000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB2, 20U)>; interrupts = <85 5>; status = "disabled"; }; @@ -25,7 +25,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB2, 12U)>; interrupts = <35 5>; dmas = <&dma2 3 3 0x400 0x3 &dma2 2 3 0x400 0x3>; @@ -38,7 +38,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(APB2, 13U)>; interrupts = <84 5>; dmas = <&dma2 1 4 0x400 0x3 &dma2 0 4 0x400 0x3>; @@ -51,7 +51,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40015000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB2, 20U)>; interrupts = <85 5>; dmas = <&dma2 6 7 0x400 0x3 &dma2 5 7 0x400 0x3>; diff --git a/dts/arm/st/f4/stm32f412.dtsi b/dts/arm/st/f4/stm32f412.dtsi index 5c7024b295f93..d250d167259d8 100644 --- a/dts/arm/st/f4/stm32f412.dtsi +++ b/dts/arm/st/f4/stm32f412.dtsi @@ -29,7 +29,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40021400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB1, 5U)>; }; gpiog: gpio@40021800 { @@ -37,14 +37,14 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40021800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000040>; + clocks = <&rcc STM32_CLOCK(AHB1, 6U)>; }; }; usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1, 18U)>; interrupts = <39 0>; status = "disabled"; @@ -55,7 +55,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <51 5>; status = "disabled"; }; @@ -65,7 +65,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(APB2, 13U)>; interrupts = <84 5>; status = "disabled"; }; @@ -75,7 +75,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(APB2, 13U)>; interrupts = <84 5>; dmas = <&dma2 1 4 0x400 0x3 &dma2 0 4 0x400 0x3>; @@ -86,7 +86,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1, 5U)>; interrupts = <55 0>; interrupt-names = "global"; @@ -102,7 +102,7 @@ timers8: timers@40010400 { compatible = "st,stm32-timers"; reg = <0x40010400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB2, 1U)>; resets = <&rctl STM32_RESET(APB2, 1U)>; interrupts = <43 0>, <44 0>, <45 0>, <46 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -125,7 +125,7 @@ timers12: timers@40001800 { compatible = "st,stm32-timers"; reg = <0x40001800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000040>; + clocks = <&rcc STM32_CLOCK(APB1, 6U)>; resets = <&rctl STM32_RESET(APB1, 6U)>; interrupts = <43 0>; interrupt-names = "global"; @@ -147,7 +147,7 @@ timers13: timers@40001c00 { compatible = "st,stm32-timers"; reg = <0x40001c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000080>; + clocks = <&rcc STM32_CLOCK(APB1, 7U)>; resets = <&rctl STM32_RESET(APB1, 7U)>; interrupts = <44 0>; interrupt-names = "global"; @@ -169,7 +169,7 @@ timers14: timers@40002000 { compatible = "st,stm32-timers"; reg = <0x40002000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000100>; + clocks = <&rcc STM32_CLOCK(APB1, 8U)>; resets = <&rctl STM32_RESET(APB1, 8U)>; interrupts = <45 0>; interrupt-names = "global"; @@ -192,7 +192,7 @@ compatible = "st,stm32-rng"; reg = <0x50060800 0x400>; interrupts = <80 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000040>; + clocks = <&rcc STM32_CLOCK(AHB2, 6U)>; status = "disabled"; }; @@ -201,7 +201,7 @@ }; sdmmc1: sdmmc@40012c00 { - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000800>, + clocks = <&rcc STM32_CLOCK(APB2, 11U)>, <&rcc STM32_SRC_SYSCLK SDIO_SEL(1)>; }; @@ -211,7 +211,7 @@ #size-cells = <0x0>; reg = <0xa0001000 0x400>; interrupts = <92 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00000002>; + clocks = <&rcc STM32_CLOCK(AHB3, 1U)>; status = "disabled"; }; @@ -220,7 +220,7 @@ reg = <0x40006400 0x400>; interrupts = <19 0>, <20 0>, <21 0>, <22 0>; interrupt-names = "TX", "RX0", "RX1", "SCE"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; status = "disabled"; }; @@ -230,7 +230,7 @@ interrupts = <63 0>, <64 0>, <65 0>, <66 0>; interrupt-names = "TX", "RX0", "RX1", "SCE"; /* also enabling clock for can1 (master instance) */ - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x06000000>; + clocks = <&rcc STM32_CLOCK(APB1, 26U)>; master-can-reg = <0x40006400>; status = "disabled"; }; diff --git a/dts/arm/st/f4/stm32f413.dtsi b/dts/arm/st/f4/stm32f413.dtsi index 91f0eda924fca..47b5a55f6c442 100644 --- a/dts/arm/st/f4/stm32f413.dtsi +++ b/dts/arm/st/f4/stm32f413.dtsi @@ -13,7 +13,7 @@ uart4: serial@40004c00 { compatible ="st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1, 19U)>; interrupts = <52 0>; status = "disabled"; @@ -22,7 +22,7 @@ uart5: serial@40005000 { compatible = "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1, 20U)>; interrupts = <53 0>; status = "disabled"; @@ -31,7 +31,7 @@ uart7: serial@40007800 { compatible = "st,stm32-uart"; reg = <0x40007800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x40000000>; + clocks = <&rcc STM32_CLOCK(APB1, 30U)>; resets = <&rctl STM32_RESET(APB1, 30U)>; interrupts = <82 0>; status = "disabled"; @@ -40,7 +40,7 @@ uart8: serial@40007c00 { compatible = "st,stm32-uart"; reg = <0x40007c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>; + clocks = <&rcc STM32_CLOCK(APB1, 31U)>; resets = <&rctl STM32_RESET(APB1, 31U)>; interrupts = <83 0>; status = "disabled"; @@ -49,7 +49,7 @@ uart9: serial@40011800 { compatible = "st,stm32-uart"; reg = <0x40011800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000040>; + clocks = <&rcc STM32_CLOCK(APB2, 6U)>; resets = <&rctl STM32_RESET(APB2, 6U)>; interrupts = <88 0>; status = "disabled"; @@ -58,7 +58,7 @@ uart10: serial@40011c00 { compatible = "st,stm32-uart"; reg = <0x40011c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000080>; + clocks = <&rcc STM32_CLOCK(APB2, 7U)>; resets = <&rctl STM32_RESET(APB2, 7U)>; interrupts = <89 0>; status = "disabled"; @@ -67,7 +67,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -77,7 +77,7 @@ reg = <0x40006c00 0x400>; interrupts = <74 0>, <75 0>, <76 0>, <77 0>; interrupt-names = "TX", "RX0", "RX1", "SCE"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x08000000>; + clocks = <&rcc STM32_CLOCK(APB1, 27U)>; status = "disabled"; }; }; diff --git a/dts/arm/st/f4/stm32f415.dtsi b/dts/arm/st/f4/stm32f415.dtsi index fd635847ab0af..212560c2e23d8 100644 --- a/dts/arm/st/f4/stm32f415.dtsi +++ b/dts/arm/st/f4/stm32f415.dtsi @@ -13,7 +13,7 @@ cryp: cryp@50060000 { compatible = "st,stm32-cryp"; reg = <0x50060000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB2, 4U)>; resets = <&rctl STM32_RESET(AHB2, 4U)>; interrupts = <79 0>; status = "disabled"; diff --git a/dts/arm/st/f4/stm32f417.dtsi b/dts/arm/st/f4/stm32f417.dtsi index 544a8c212bc59..b6b3865fb022d 100644 --- a/dts/arm/st/f4/stm32f417.dtsi +++ b/dts/arm/st/f4/stm32f417.dtsi @@ -13,7 +13,7 @@ cryp: cryp@50060000 { compatible = "st,stm32-cryp"; reg = <0x50060000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB2, 4U)>; resets = <&rctl STM32_RESET(AHB2, 4U)>; interrupts = <79 0>; status = "disabled"; diff --git a/dts/arm/st/f4/stm32f423.dtsi b/dts/arm/st/f4/stm32f423.dtsi index 14f53f0addcf6..b8aa21b135abe 100644 --- a/dts/arm/st/f4/stm32f423.dtsi +++ b/dts/arm/st/f4/stm32f423.dtsi @@ -13,7 +13,7 @@ aes: aes@50060000 { compatible = "st,stm32-aes"; reg = <0x50060000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB2, 4U)>; resets = <&rctl STM32_RESET(AHB2, 4U)>; interrupts = <79 0>; status = "disabled"; diff --git a/dts/arm/st/f4/stm32f427.dtsi b/dts/arm/st/f4/stm32f427.dtsi index cf3c28a9b82b1..2e820d49547ef 100644 --- a/dts/arm/st/f4/stm32f427.dtsi +++ b/dts/arm/st/f4/stm32f427.dtsi @@ -20,7 +20,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40022400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000200>; + clocks = <&rcc STM32_CLOCK(AHB1, 9U)>; }; gpiok: gpio@40022800 { @@ -28,14 +28,14 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40022800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000400>; + clocks = <&rcc STM32_CLOCK(AHB1, 10U)>; }; }; uart7: serial@40007800 { compatible = "st,stm32-uart"; reg = <0x40007800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x40000000>; + clocks = <&rcc STM32_CLOCK(APB1, 30U)>; resets = <&rctl STM32_RESET(APB1, 30U)>; interrupts = <82 0>; status = "disabled"; @@ -44,7 +44,7 @@ uart8: serial@40007c00 { compatible = "st,stm32-uart"; reg = <0x40007c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>; + clocks = <&rcc STM32_CLOCK(APB1, 31U)>; resets = <&rctl STM32_RESET(APB1, 31U)>; interrupts = <83 0>; status = "disabled"; @@ -55,7 +55,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(APB2, 13U)>; interrupts = <84 5>; status = "disabled"; }; @@ -68,7 +68,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40015000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB2, 20U)>; interrupts = <85 5>; status = "disabled"; }; @@ -81,7 +81,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40015400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB2, 21U)>; interrupts = <86 5>; status = "disabled"; }; @@ -89,7 +89,7 @@ fmc: memory-controller@a0000000 { compatible = "st,stm32-fmc"; reg = <0xa0000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB3, 0U)>; status = "disabled"; sdram: sdram { diff --git a/dts/arm/st/f4/stm32f429.dtsi b/dts/arm/st/f4/stm32f429.dtsi index e3a21d57d5941..6409628052210 100644 --- a/dts/arm/st/f4/stm32f429.dtsi +++ b/dts/arm/st/f4/stm32f429.dtsi @@ -14,7 +14,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -24,7 +24,7 @@ reg = <0x40016800 0x200>; interrupts = <88 0>, <89 0>; interrupt-names = "ltdc", "ltdc_er"; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x04000000>; + clocks = <&rcc STM32_CLOCK(APB2, 26U)>; resets = <&rctl STM32_RESET(APB2, 26U)>; status = "disabled"; }; diff --git a/dts/arm/st/f4/stm32f437.dtsi b/dts/arm/st/f4/stm32f437.dtsi index c9cd3dd849bc4..8e5f6510c26f8 100644 --- a/dts/arm/st/f4/stm32f437.dtsi +++ b/dts/arm/st/f4/stm32f437.dtsi @@ -14,7 +14,7 @@ cryp: cryp@50060000 { compatible = "st,stm32-cryp"; reg = <0x50060000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB2, 4U)>; resets = <&rctl STM32_RESET(AHB2, 4U)>; interrupts = <79 0>; status = "disabled"; diff --git a/dts/arm/st/f4/stm32f446.dtsi b/dts/arm/st/f4/stm32f446.dtsi index f979a30ff66d3..4aea609df1fcb 100644 --- a/dts/arm/st/f4/stm32f446.dtsi +++ b/dts/arm/st/f4/stm32f446.dtsi @@ -23,7 +23,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB2, 12U)>; interrupts = <35 5>; dmas = <&dma2 3 3 0x400 0x3 &dma2 2 3 0x400 0x3>; @@ -34,7 +34,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1, 18U)>; interrupts = <39 0>; status = "disabled"; @@ -43,7 +43,7 @@ uart4: serial@40004c00 { compatible ="st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1, 19U)>; interrupts = <52 0>; status = "disabled"; @@ -52,7 +52,7 @@ uart5: serial@40005000 { compatible = "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1, 20U)>; interrupts = <53 0>; status = "disabled"; @@ -63,7 +63,7 @@ reg = <0x40006400 0x400>; interrupts = <19 0>, <20 0>, <21 0>, <22 0>; interrupt-names = "TX", "RX0", "RX1", "SCE"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; status = "disabled"; }; @@ -73,14 +73,14 @@ interrupts = <63 0>, <64 0>, <65 0>, <66 0>; interrupt-names = "TX", "RX0", "RX1", "SCE"; /* also enabling clock for can1 (master instance) */ - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x06000000>; + clocks = <&rcc STM32_CLOCK(APB1, 26U)>; master-can-reg = <0x40006400>; status = "disabled"; }; usbotg_fs: usb@50000000 { num-bidir-endpoints = <6>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000080>, + clocks = <&rcc STM32_CLOCK(AHB2, 7U)>, <&rcc STM32_SRC_PLL_Q CK48M_SEL(0)>; }; @@ -93,7 +93,7 @@ ram-size = <4096>; maximum-speed = "full-speed"; phys = <&otghs_fs_phy>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x20000000>, + clocks = <&rcc STM32_CLOCK(AHB1, 29U)>, <&rcc STM32_SRC_PLL_Q CK48M_SEL(0)>; status = "disabled"; }; @@ -101,7 +101,7 @@ backup_sram: memory@40024000 { compatible = "zephyr,memory-region", "st,stm32-backup-sram"; reg = <0x40024000 DT_SIZE_K(4)>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(AHB1, 18U)>; zephyr,memory-region = "BACKUP_SRAM"; status = "disabled"; }; @@ -109,7 +109,7 @@ adc2: adc@40012100 { compatible = "st,stm32-adc"; reg = <0x40012100 0x050>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000200>; + clocks = <&rcc STM32_CLOCK(APB2, 9U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; @@ -125,7 +125,7 @@ adc3: adc@40012200 { compatible = "st,stm32-adc"; reg = <0x40012200 0x050>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000400>; + clocks = <&rcc STM32_CLOCK(APB2, 10U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; @@ -141,7 +141,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -149,7 +149,7 @@ fmc: memory-controller@a0000000 { compatible = "st,stm32-fmc"; reg = <0xa0000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB3, 0U)>; status = "disabled"; sdram: sdram { diff --git a/dts/arm/st/f4/stm32f469.dtsi b/dts/arm/st/f4/stm32f469.dtsi index 0b1afdc269427..9daa2706b3270 100644 --- a/dts/arm/st/f4/stm32f469.dtsi +++ b/dts/arm/st/f4/stm32f469.dtsi @@ -11,13 +11,13 @@ compatible = "st,stm32f469", "st,stm32f4", "simple-bus"; sdmmc1: sdmmc@40012c00 { - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000800>, + clocks = <&rcc STM32_CLOCK(APB2, 11U)>, <&rcc STM32_SRC_SYSCLK SDMMC_SEL(1)>; }; usbotg_fs: usb@50000000 { num-bidir-endpoints = <6>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000080>, + clocks = <&rcc STM32_CLOCK(AHB2, 7U)>, <&rcc STM32_SRC_PLL_Q CLK48M_SEL(0)>; }; diff --git a/dts/arm/st/f7/stm32f7.dtsi b/dts/arm/st/f7/stm32f7.dtsi index d5f7288c5a5f0..fd847fb8f4bd9 100644 --- a/dts/arm/st/f7/stm32f7.dtsi +++ b/dts/arm/st/f7/stm32f7.dtsi @@ -104,7 +104,7 @@ fmc: memory-controller@a0000000 { compatible = "st,stm32-fmc"; reg = <0xa0000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB3, 0U)>; status = "disabled"; sdram: sdram { @@ -169,7 +169,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40020000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB1, 0U)>; }; gpiob: gpio@40020400 { @@ -177,7 +177,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40020400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(AHB1, 1U)>; }; gpioc: gpio@40020800 { @@ -185,7 +185,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40020800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(AHB1, 2U)>; }; gpiod: gpio@40020C00 { @@ -193,7 +193,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40020C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(AHB1, 3U)>; }; gpioe: gpio@40021000 { @@ -201,7 +201,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40021000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB1, 4U)>; }; gpiof: gpio@40021400 { @@ -209,7 +209,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40021400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB1, 5U)>; }; gpiog: gpio@40021800 { @@ -217,7 +217,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40021800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000040>; + clocks = <&rcc STM32_CLOCK(AHB1, 6U)>; }; gpioh: gpio@40021C00 { @@ -225,7 +225,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40021C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000080>; + clocks = <&rcc STM32_CLOCK(AHB1, 7U)>; }; gpioi: gpio@40022000 { @@ -233,7 +233,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40022000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000100>; + clocks = <&rcc STM32_CLOCK(AHB1, 8U)>; }; }; @@ -246,7 +246,7 @@ wwdg: watchdog@40002c00 { compatible = "st,stm32-window-watchdog"; reg = <0x40002C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <0 7>; status = "disabled"; }; @@ -254,7 +254,7 @@ usart1: serial@40011000 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40011000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB2, 4U)>; resets = <&rctl STM32_RESET(APB2, 4U)>; interrupts = <37 0>; status = "disabled"; @@ -263,7 +263,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1, 17U)>; interrupts = <38 0>; status = "disabled"; @@ -272,7 +272,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1, 18U)>; interrupts = <39 0>; status = "disabled"; @@ -281,7 +281,7 @@ uart4: serial@40004c00 { compatible ="st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1, 19U)>; interrupts = <52 0>; status = "disabled"; @@ -290,7 +290,7 @@ uart5: serial@40005000 { compatible = "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1, 20U)>; interrupts = <53 0>; status = "disabled"; @@ -299,7 +299,7 @@ usart6: serial@40011400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40011400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB2, 5U)>; resets = <&rctl STM32_RESET(APB2, 5U)>; interrupts = <71 0>; status = "disabled"; @@ -308,7 +308,7 @@ uart7: serial@40007800 { compatible = "st,stm32-uart"; reg = <0x40007800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x40000000>; + clocks = <&rcc STM32_CLOCK(APB1, 30U)>; resets = <&rctl STM32_RESET(APB1, 30U)>; interrupts = <82 0>; status = "disabled"; @@ -317,7 +317,7 @@ uart8: serial@40007c00 { compatible = "st,stm32-uart"; reg = <0x40007c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>; + clocks = <&rcc STM32_CLOCK(APB1, 31U)>; resets = <&rctl STM32_RESET(APB1, 31U)>; interrupts = <83 0>; status = "disabled"; @@ -329,7 +329,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB1, 21U)>; interrupts = <31 0>, <32 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -341,7 +341,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <33 0>, <34 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -353,7 +353,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>; + clocks = <&rcc STM32_CLOCK(APB1, 23U)>; interrupts = <72 0>, <73 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -364,7 +364,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB2, 12U)>; interrupts = <35 5>; status = "disabled"; }; @@ -374,7 +374,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <36 5>; status = "disabled"; }; @@ -384,7 +384,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <51 5>; status = "disabled"; }; @@ -394,7 +394,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(APB2, 13U)>; interrupts = <84 5>; status = "disabled"; }; @@ -404,7 +404,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40015000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB2, 20U)>; interrupts = <85 5>; status = "disabled"; }; @@ -414,14 +414,14 @@ reg = <0x40006400 0x400>; interrupts = <19 0>, <20 0>, <21 0>, <22 0>; interrupt-names = "TX", "RX0", "RX1", "SCE"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; status = "disabled"; }; timers1: timers@40010000 { compatible = "st,stm32-timers"; reg = <0x40010000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB2, 0U)>; resets = <&rctl STM32_RESET(APB2, 0U)>; interrupts = <24 0>, <25 0>, <26 0>, <27 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -438,7 +438,7 @@ timers2: timers@40000000 { compatible = "st,stm32-timers"; reg = <0x40000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1, 0U)>; resets = <&rctl STM32_RESET(APB1, 0U)>; interrupts = <28 0>; interrupt-names = "global"; @@ -460,7 +460,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1, 1U)>; interrupts = <29 0>; interrupt-names = "global"; @@ -482,7 +482,7 @@ timers4: timers@40000800 { compatible = "st,stm32-timers"; reg = <0x40000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB1, 2U)>; resets = <&rctl STM32_RESET(APB1, 2U)>; interrupts = <30 0>; interrupt-names = "global"; @@ -504,7 +504,7 @@ timers5: timers@40000c00 { compatible = "st,stm32-timers"; reg = <0x40000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB1, 3U)>; resets = <&rctl STM32_RESET(APB1, 3U)>; interrupts = <50 0>; interrupt-names = "global"; @@ -526,7 +526,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1, 4U)>; interrupts = <54 0>; interrupt-names = "global"; @@ -542,7 +542,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1, 5U)>; interrupts = <55 0>; interrupt-names = "global"; @@ -558,7 +558,7 @@ timers8: timers@40010400 { compatible = "st,stm32-timers"; reg = <0x40010400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB2, 1U)>; resets = <&rctl STM32_RESET(APB2, 1U)>; interrupts = <43 0>, <44 0>, <45 0>, <46 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -575,7 +575,7 @@ timers9: timers@40014000 { compatible = "st,stm32-timers"; reg = <0x40014000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(APB2, 16U)>; resets = <&rctl STM32_RESET(APB2, 16U)>; interrupts = <24 0>; interrupt-names = "global"; @@ -597,7 +597,7 @@ timers10: timers@40014400 { compatible = "st,stm32-timers"; reg = <0x40014400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB2, 17U)>; resets = <&rctl STM32_RESET(APB2, 17U)>; interrupts = <25 0>; interrupt-names = "global"; @@ -619,7 +619,7 @@ timers11: timers@40014800 { compatible = "st,stm32-timers"; reg = <0x40014800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB2, 18U)>; resets = <&rctl STM32_RESET(APB2, 18U)>; interrupts = <26 0>; interrupt-names = "global"; @@ -641,7 +641,7 @@ timers12: timers@40001800 { compatible = "st,stm32-timers"; reg = <0x40001800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000040>; + clocks = <&rcc STM32_CLOCK(APB1, 6U)>; resets = <&rctl STM32_RESET(APB1, 6U)>; interrupts = <43 0>; interrupt-names = "global"; @@ -663,7 +663,7 @@ timers13: timers@40001c00 { compatible = "st,stm32-timers"; reg = <0x40001c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000080>; + clocks = <&rcc STM32_CLOCK(APB1, 7U)>; resets = <&rctl STM32_RESET(APB1, 7U)>; interrupts = <44 0>; interrupt-names = "global"; @@ -685,7 +685,7 @@ timers14: timers@40002000 { compatible = "st,stm32-timers"; reg = <0x40002000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000100>; + clocks = <&rcc STM32_CLOCK(APB1, 8U)>; resets = <&rctl STM32_RESET(APB1, 8U)>; interrupts = <45 0>; interrupt-names = "global"; @@ -713,7 +713,7 @@ ram-size = <1280>; maximum-speed = "full-speed"; phys = <&otgfs_phy>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000080>, + clocks = <&rcc STM32_CLOCK(AHB2, 7U)>, <&rcc STM32_SRC_PLL_Q CK48M_SEL(0)>; status = "disabled"; }; @@ -726,7 +726,7 @@ num-bidir-endpoints = <9>; ram-size = <4096>; maximum-speed = "full-speed"; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x20000000>, + clocks = <&rcc STM32_CLOCK(AHB1, 29U)>, <&rcc STM32_SRC_PLL_Q CK48M_SEL(0)>; phys = <&otghs_fs_phy>; status = "disabled"; @@ -736,7 +736,7 @@ compatible = "st,stm32-rtc"; reg = <0x40002800 0x300>; interrupts = <41 0>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>; + clocks = <&rcc STM32_CLOCK(APB1, 28U)>; prescaler = <32768>; alarms-count = <2>; alrm-exti-line = <17>; @@ -752,7 +752,7 @@ adc1: adc@40012000 { compatible = "st,stm32f4-adc", "st,stm32-adc"; reg = <0x40012000 0x50>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000100>; + clocks = <&rcc STM32_CLOCK(APB2, 8U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; @@ -768,7 +768,7 @@ adc2: adc@40012100 { compatible = "st,stm32f4-adc", "st,stm32-adc"; reg = <0x40012100 0x50>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000200>; + clocks = <&rcc STM32_CLOCK(APB2, 9U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; @@ -784,7 +784,7 @@ adc3: adc@40012200 { compatible = "st,stm32f4-adc", "st,stm32-adc"; reg = <0x40012200 0x50>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000400>; + clocks = <&rcc STM32_CLOCK(APB2, 10U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; @@ -800,7 +800,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -810,7 +810,7 @@ #dma-cells = <4>; reg = <0x40026000 0x400>; interrupts = <11 0 12 0 13 0 14 0 15 0 16 0 17 0 47 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x200000>; + clocks = <&rcc STM32_CLOCK(AHB1, 21U)>; status = "disabled"; }; @@ -819,7 +819,7 @@ #dma-cells = <4>; reg = <0x40026400 0x400>; interrupts = <56 0 57 0 58 0 59 0 60 0 68 0 69 0 70 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x400000>; + clocks = <&rcc STM32_CLOCK(AHB1, 22U)>; st,mem2mem; status = "disabled"; }; @@ -828,7 +828,7 @@ compatible = "st,stm32-rng"; reg = <0x50060800 0x400>; interrupts = <80 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000040>, + clocks = <&rcc STM32_CLOCK(AHB2, 6U)>, <&rcc STM32_SRC_PLL_Q CK48M_SEL(0)>; status = "disabled"; }; @@ -836,7 +836,7 @@ sdmmc1: sdmmc@40012c00 { compatible = "st,stm32-sdmmc"; reg = <0x40012c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000800>, + clocks = <&rcc STM32_CLOCK(APB2, 11U)>, <&rcc STM32_SRC_PLL_Q SDMMC1_SEL(0)>; resets = <&rctl STM32_RESET(APB2, 11U)>; interrupts = <49 0>; @@ -846,7 +846,7 @@ backup_sram: memory@40024000 { compatible = "zephyr,memory-region", "st,stm32-backup-sram"; reg = <0x40024000 DT_SIZE_K(4)>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(AHB1, 18U)>; zephyr,memory-region = "BACKUP_SRAM"; status = "disabled"; }; @@ -857,7 +857,7 @@ #size-cells = <0x0>; reg = <0xa0001000 0x34>; interrupts = <92 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x2>; + clocks = <&rcc STM32_CLOCK(AHB3, 1U)>; status = "disabled"; }; }; diff --git a/dts/arm/st/f7/stm32f722.dtsi b/dts/arm/st/f7/stm32f722.dtsi index 0784e99265b4d..ba3b459cb7477 100644 --- a/dts/arm/st/f7/stm32f722.dtsi +++ b/dts/arm/st/f7/stm32f722.dtsi @@ -35,7 +35,7 @@ sdmmc2: sdmmc@40011c00 { compatible = "st,stm32-sdmmc"; reg = <0x40011c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000080>, + clocks = <&rcc STM32_CLOCK(APB2, 7U)>, <&rcc STM32_SRC_PLL_Q SDMMC2_SEL(0)>; resets = <&rctl STM32_RESET(APB2, 7U)>; interrupts = <103 0>; diff --git a/dts/arm/st/f7/stm32f745.dtsi b/dts/arm/st/f7/stm32f745.dtsi index f42d2e542835a..40f2b10362980 100644 --- a/dts/arm/st/f7/stm32f745.dtsi +++ b/dts/arm/st/f7/stm32f745.dtsi @@ -32,7 +32,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40022400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000200>; + clocks = <&rcc STM32_CLOCK(AHB1, 9U)>; }; gpiok: gpio@40022800 { @@ -40,7 +40,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40022800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000400>; + clocks = <&rcc STM32_CLOCK(AHB1, 10U)>; }; }; @@ -50,7 +50,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40006000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x01000000>; + clocks = <&rcc STM32_CLOCK(APB1, 24U)>; interrupts = <95 0>, <96 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -61,7 +61,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40015400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB2, 21U)>; interrupts = <86 5>; status = "disabled"; }; @@ -71,7 +71,7 @@ reg = <0x40006800 0x400>; interrupts = <63 0>, <64 0>, <65 0>, <66 0>; interrupt-names = "TX", "RX0", "RX1", "SCE"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x04000000>; + clocks = <&rcc STM32_CLOCK(APB1, 26U)>; status = "disabled"; }; @@ -81,10 +81,10 @@ interrupts = <61 0>; clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx", "mac-clk-ptp"; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x02000000>, - <&rcc STM32_CLOCK_BUS_AHB1 0x04000000>, - <&rcc STM32_CLOCK_BUS_AHB1 0x08000000>, - <&rcc STM32_CLOCK_BUS_AHB1 0x10000000>; + clocks = <&rcc STM32_CLOCK(AHB1, 25U)>, + <&rcc STM32_CLOCK(AHB1, 26U)>, + <&rcc STM32_CLOCK(AHB1, 27U)>, + <&rcc STM32_CLOCK(AHB1, 28U)>; status = "disabled"; }; }; diff --git a/dts/arm/st/f7/stm32f746.dtsi b/dts/arm/st/f7/stm32f746.dtsi index a85bbac849f8a..b77ddaa2d05b2 100644 --- a/dts/arm/st/f7/stm32f746.dtsi +++ b/dts/arm/st/f7/stm32f746.dtsi @@ -16,7 +16,7 @@ reg = <0x40016800 0x200>; interrupts = <88 0>, <89 0>; interrupt-names = "ltdc", "ltdc_err"; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x04000000>; + clocks = <&rcc STM32_CLOCK(APB2, 26U)>; resets = <&rctl STM32_RESET(APB2, 26U)>; status = "disabled"; }; diff --git a/dts/arm/st/f7/stm32f765.dtsi b/dts/arm/st/f7/stm32f765.dtsi index b53203be76018..d8c62d3bf274c 100644 --- a/dts/arm/st/f7/stm32f765.dtsi +++ b/dts/arm/st/f7/stm32f765.dtsi @@ -34,7 +34,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40022400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000200>; + clocks = <&rcc STM32_CLOCK(AHB1, 9U)>; }; gpiok: gpio@40022800 { @@ -42,7 +42,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40022800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000400>; + clocks = <&rcc STM32_CLOCK(AHB1, 10U)>; }; }; @@ -52,7 +52,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40006000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x01000000>; + clocks = <&rcc STM32_CLOCK(APB1, 24U)>; interrupts = <95 0>, <96 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -63,7 +63,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40015400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB2, 21U)>; interrupts = <86 5>; status = "disabled"; }; @@ -74,17 +74,17 @@ interrupts = <61 0>; clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx", "mac-clk-ptp"; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x02000000>, - <&rcc STM32_CLOCK_BUS_AHB1 0x04000000>, - <&rcc STM32_CLOCK_BUS_AHB1 0x08000000>, - <&rcc STM32_CLOCK_BUS_AHB1 0x10000000>; + clocks = <&rcc STM32_CLOCK(AHB1, 25U)>, + <&rcc STM32_CLOCK(AHB1, 26U)>, + <&rcc STM32_CLOCK(AHB1, 27U)>, + <&rcc STM32_CLOCK(AHB1, 28U)>; status = "disabled"; }; sdmmc2: sdmmc@40011c00 { compatible = "st,stm32-sdmmc"; reg = <0x40011c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000080>, + clocks = <&rcc STM32_CLOCK(APB2, 7U)>, <&rcc STM32_SRC_PLL_Q SDMMC2_SEL(0)>; resets = <&rctl STM32_RESET(APB2, 7U)>; interrupts = <103 0>; diff --git a/dts/arm/st/f7/stm32f767.dtsi b/dts/arm/st/f7/stm32f767.dtsi index 6ed8d68d0cc34..eef8f020c807f 100644 --- a/dts/arm/st/f7/stm32f767.dtsi +++ b/dts/arm/st/f7/stm32f767.dtsi @@ -17,7 +17,7 @@ reg = <0x40016800 0x200>; interrupts = <88 0>, <89 0>; interrupt-names = "ltdc", "ltdc_err"; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x04000000>; + clocks = <&rcc STM32_CLOCK(APB2, 26U)>; resets = <&rctl STM32_RESET(APB2, 26U)>; status = "disabled"; }; diff --git a/dts/arm/st/g0/stm32g0.dtsi b/dts/arm/st/g0/stm32g0.dtsi index ca4e3d47d8a91..e8cd8a8d30a20 100644 --- a/dts/arm/st/g0/stm32g0.dtsi +++ b/dts/arm/st/g0/stm32g0.dtsi @@ -98,7 +98,7 @@ compatible = "st,stm32-flash-controller", "st,stm32g0-flash-controller"; reg = <0x40022000 0x400>; interrupts = <3 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000100>; + clocks = <&rcc STM32_CLOCK(AHB1, 8U)>; #address-cells = <1>; #size-cells = <1>; @@ -147,7 +147,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000001>; + clocks = <&rcc STM32_CLOCK(IOP, 0U)>; }; gpiob: gpio@50000400 { @@ -155,7 +155,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000002>; + clocks = <&rcc STM32_CLOCK(IOP, 1U)>; }; gpioc: gpio@50000800 { @@ -163,7 +163,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000004>; + clocks = <&rcc STM32_CLOCK(IOP, 2U)>; }; gpiod: gpio@50000c00 { @@ -171,7 +171,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000008>; + clocks = <&rcc STM32_CLOCK(IOP, 3U)>; }; gpiof: gpio@50001400 { @@ -179,7 +179,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000020>; + clocks = <&rcc STM32_CLOCK(IOP, 5U)>; }; }; @@ -187,7 +187,7 @@ compatible = "st,stm32-rtc"; reg = <0x40002800 0x400>; interrupts = <2 0>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000400>; + clocks = <&rcc STM32_CLOCK(APB1, 10U)>; prescaler = <32768>; alarms-count = <2>; alrm-exti-line = <19>; @@ -215,7 +215,7 @@ wwdg: watchdog@40002c00 { compatible = "st,stm32-window-watchdog"; reg = <0x40002C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <0 2>; status = "disabled"; }; @@ -223,7 +223,7 @@ usart1: serial@40013800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40013800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1_2, 14U)>; resets = <&rctl STM32_RESET(APB1H, 14U)>; interrupts = <27 0>; status = "disabled"; @@ -232,7 +232,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1L, 17U)>; interrupts = <28 0>; status = "disabled"; @@ -240,7 +240,7 @@ lptim1: timers@40007c00 { compatible = "st,stm32-lptim"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>; + clocks = <&rcc STM32_CLOCK(APB1, 31U)>; #address-cells = <1>; #size-cells = <0>; reg = <0x40007c00 0x400>; @@ -252,7 +252,7 @@ timers1: timers@40012c00 { compatible = "st,stm32-timers"; reg = <0x40012C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1_2, 11U)>; resets = <&rctl STM32_RESET(APB1H, 11U)>; interrupts = <13 0>, <14 0>; interrupt-names = "brk_up_trg_com", "cc"; @@ -274,7 +274,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1L, 1U)>; interrupts = <16 0>; interrupt-names = "global"; @@ -296,7 +296,7 @@ timers14: timers@40002000 { compatible = "st,stm32-timers"; reg = <0x40002000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1_2, 15U)>; resets = <&rctl STM32_RESET(APB1H, 15U)>; interrupts = <19 0>; interrupt-names = "global"; @@ -318,7 +318,7 @@ timers16: timers@40014400 { compatible = "st,stm32-timers"; reg = <0x40014400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1_2, 17U)>; resets = <&rctl STM32_RESET(APB1H, 17U)>; interrupts = <21 0>; interrupt-names = "global"; @@ -340,7 +340,7 @@ timers17: timers@40014800 { compatible = "st,stm32-timers"; reg = <0x40014800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1_2, 18U)>; resets = <&rctl STM32_RESET(APB1H, 18U)>; interrupts = <22 0>; interrupt-names = "global"; @@ -365,7 +365,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB1, 21U)>; interrupts = <23 0>; interrupt-names = "combined"; status = "disabled"; @@ -377,7 +377,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <24 0>; interrupt-names = "combined"; status = "disabled"; @@ -388,7 +388,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB1_2, 12U)>; interrupts = <25 0>; status = "disabled"; }; @@ -398,7 +398,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <26 0>; status = "disabled"; }; @@ -406,7 +406,7 @@ adc1: adc@40012400 { compatible = "st,stm32-adc"; reg = <0x40012400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1_2, 20U)>; interrupts = <12 0>; status = "disabled"; #io-channel-cells = <1>; @@ -430,7 +430,7 @@ #dma-cells = <3>; reg = <0x40020000 0x400>; interrupts = <9 0 10 0 10 0 11 0 11 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x1>; + clocks = <&rcc STM32_CLOCK(AHB1, 0U)>; dma-requests = <5>; dma-offset = <0>; status = "disabled"; diff --git a/dts/arm/st/g0/stm32g031.dtsi b/dts/arm/st/g0/stm32g031.dtsi index 582763b7dda47..11dc630b485b7 100644 --- a/dts/arm/st/g0/stm32g031.dtsi +++ b/dts/arm/st/g0/stm32g031.dtsi @@ -14,7 +14,7 @@ lpuart1: serial@40008000 { compatible = "st,stm32-lpuart", "st,stm32-uart"; reg = <0x40008000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1L, 20U)>; interrupts = <29 0>; status = "disabled"; @@ -23,7 +23,7 @@ timers2: timers@40000000 { compatible = "st,stm32-timers"; reg = <0x40000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1, 0U)>; resets = <&rctl STM32_RESET(APB1L, 0U)>; interrupts = <15 0>; interrupt-names = "global"; diff --git a/dts/arm/st/g0/stm32g050.dtsi b/dts/arm/st/g0/stm32g050.dtsi index 0adea1a400cee..236d88586474b 100644 --- a/dts/arm/st/g0/stm32g050.dtsi +++ b/dts/arm/st/g0/stm32g050.dtsi @@ -13,7 +13,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1L, 4U)>; interrupts = <17 0>; interrupt-names = "global"; @@ -24,7 +24,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1L, 5U)>; interrupts = <18 0>; interrupt-names = "global"; diff --git a/dts/arm/st/g0/stm32g051.dtsi b/dts/arm/st/g0/stm32g051.dtsi index 0b6626d58413f..1b32d05c27c09 100644 --- a/dts/arm/st/g0/stm32g051.dtsi +++ b/dts/arm/st/g0/stm32g051.dtsi @@ -13,7 +13,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1L, 4U)>; interrupts = <17 0>; interrupt-names = "global"; @@ -28,7 +28,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1L, 5U)>; interrupts = <18 0>; interrupt-names = "global"; @@ -44,7 +44,7 @@ timers15: timers@40014000 { compatible = "st,stm32-timers"; reg = <0x40014000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00010000>; + clocks = <&rcc STM32_CLOCK(APB1_2, 16U)>; resets = <&rctl STM32_RESET(APB1H, 16U)>; interrupts = <20 0>; interrupt-names = "global"; @@ -66,7 +66,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; diff --git a/dts/arm/st/g0/stm32g070.dtsi b/dts/arm/st/g0/stm32g070.dtsi index 72f83e9896df5..db4f1f681c61e 100644 --- a/dts/arm/st/g0/stm32g070.dtsi +++ b/dts/arm/st/g0/stm32g070.dtsi @@ -14,7 +14,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1L, 18U)>; interrupts = <29 0>; status = "disabled"; @@ -23,7 +23,7 @@ usart4: serial@40004c00 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1L, 19U)>; interrupts = <29 0>; status = "disabled"; @@ -32,7 +32,7 @@ timers15: timers@40014000 { compatible = "st,stm32-timers"; reg = <0x40014000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00010000>; + clocks = <&rcc STM32_CLOCK(APB1_2, 16U)>; resets = <&rctl STM32_RESET(APB1H, 16U)>; interrupts = <20 0>; interrupt-names = "global"; diff --git a/dts/arm/st/g0/stm32g071.dtsi b/dts/arm/st/g0/stm32g071.dtsi index 8531e9df2b03f..bb694cfb6f544 100644 --- a/dts/arm/st/g0/stm32g071.dtsi +++ b/dts/arm/st/g0/stm32g071.dtsi @@ -15,7 +15,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1L, 18U)>; interrupts = <29 0>; status = "disabled"; @@ -24,7 +24,7 @@ usart4: serial@40004c00 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1L, 19U)>; interrupts = <29 0>; status = "disabled"; @@ -37,7 +37,7 @@ ucpd1: ucpd@4000a000 { compatible = "st,stm32-ucpd"; reg = <0x4000a000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; interrupts = <8 0>; status = "disabled"; }; @@ -45,7 +45,7 @@ ucpd2: ucpd@4000a400 { compatible = "st,stm32-ucpd"; reg = <0x4000a400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x04000000>; + clocks = <&rcc STM32_CLOCK(APB1, 26U)>; interrupts = <8 0>; status = "disabled"; }; diff --git a/dts/arm/st/g0/stm32g0_crypt.dtsi b/dts/arm/st/g0/stm32g0_crypt.dtsi index 473be89d9cac2..70d69b0710d71 100644 --- a/dts/arm/st/g0/stm32g0_crypt.dtsi +++ b/dts/arm/st/g0/stm32g0_crypt.dtsi @@ -13,7 +13,7 @@ aes: aes@40026000 { compatible = "st,stm32-aes"; reg = <0x40026000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00010000>; + clocks = <&rcc STM32_CLOCK(AHB1, 16U)>; resets = <&rctl STM32_RESET(AHB1, 16U)>; interrupts = <31 0>; status = "disabled"; @@ -23,7 +23,7 @@ compatible = "st,stm32-rng"; reg = <0x40025000 0x400>; interrupts = <31 1>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(AHB1, 18U)>; status = "disabled"; }; }; diff --git a/dts/arm/st/g0/stm32g0b0.dtsi b/dts/arm/st/g0/stm32g0b0.dtsi index 861c70f2d5b9d..b0afe8d1ed949 100644 --- a/dts/arm/st/g0/stm32g0b0.dtsi +++ b/dts/arm/st/g0/stm32g0b0.dtsi @@ -16,14 +16,14 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000010>; + clocks = <&rcc STM32_CLOCK(IOP, 4U)>; }; }; usart5: serial@40005000 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000100>; + clocks = <&rcc STM32_CLOCK(APB1, 8U)>; resets = <&rctl STM32_RESET(APB1L, 8U)>; interrupts = <29 0>; status = "disabled"; @@ -32,7 +32,7 @@ usart6: serial@40013c00 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40013c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000200>; + clocks = <&rcc STM32_CLOCK(APB1, 9U)>; resets = <&rctl STM32_RESET(APB1L, 9U)>; interrupts = <29 0>; status = "disabled"; @@ -41,7 +41,7 @@ timers4: timers@40000800 { compatible = "st,stm32-timers"; reg = <0x40000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB1, 2U)>; resets = <&rctl STM32_RESET(APB1L, 2U)>; interrupts = <16 0>; interrupt-names = "global"; @@ -61,7 +61,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40008800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>; + clocks = <&rcc STM32_CLOCK(APB1, 23U)>; interrupts = <24 0>; interrupt-names = "combined"; status = "disabled"; @@ -72,7 +72,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <26 3>; status = "disabled"; }; @@ -82,7 +82,7 @@ #dma-cells = <3>; reg = <0x40020400 0x400>; interrupts = <11 0 11 0 11 0 11 0 11 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x2>; + clocks = <&rcc STM32_CLOCK(AHB1, 1U)>; dma-requests = <5>; dma-offset = <7>; status = "disabled"; @@ -100,7 +100,7 @@ num-bidir-endpoints = <8>; ram-size = <2048>; phys = <&usb_fs_phy>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00002000>, + clocks = <&rcc STM32_CLOCK(APB1, 13U)>, <&rcc STM32_SRC_HSI48 USB_SEL(0)>; status = "disabled"; }; diff --git a/dts/arm/st/g0/stm32g0b1.dtsi b/dts/arm/st/g0/stm32g0b1.dtsi index 1cbf7f2830b75..bc621076b314d 100644 --- a/dts/arm/st/g0/stm32g0b1.dtsi +++ b/dts/arm/st/g0/stm32g0b1.dtsi @@ -28,7 +28,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000010>; + clocks = <&rcc STM32_CLOCK(IOP, 4U)>; }; }; @@ -38,7 +38,7 @@ reg-names = "m_can", "message_ram"; interrupts = <21 0>, <22 0>; interrupt-names = "int0", "int1"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB1, 12U)>; bosch,mram-cfg = <0x0 28 8 3 3 0 3 3>; status = "disabled"; }; @@ -49,7 +49,7 @@ reg-names = "m_can", "message_ram"; interrupts = <21 0>, <22 0>; interrupt-names = "int0", "int1"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB1, 12U)>; bosch,mram-cfg = <0x0 28 8 3 3 0 3 3>; status = "disabled"; }; @@ -57,7 +57,7 @@ usart5: serial@40005000 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000100>; + clocks = <&rcc STM32_CLOCK(APB1, 8U)>; resets = <&rctl STM32_RESET(APB1L, 8U)>; interrupts = <29 0>; status = "disabled"; @@ -66,7 +66,7 @@ usart6: serial@40013c00 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40013c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000200>; + clocks = <&rcc STM32_CLOCK(APB1, 9U)>; resets = <&rctl STM32_RESET(APB1L, 9U)>; interrupts = <29 0>; status = "disabled"; @@ -75,7 +75,7 @@ lpuart2: serial@40008400 { compatible = "st,stm32-lpuart", "st,stm32-uart"; reg = <0x40008400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000080>; + clocks = <&rcc STM32_CLOCK(APB1, 7U)>; resets = <&rctl STM32_RESET(APB1L, 7U)>; interrupts = <28 0>; status = "disabled"; @@ -84,7 +84,7 @@ timers4: timers@40000800 { compatible = "st,stm32-timers"; reg = <0x40000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB1, 2U)>; resets = <&rctl STM32_RESET(APB1L, 2U)>; interrupts = <16 0>; interrupt-names = "global"; @@ -104,7 +104,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40008800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>; + clocks = <&rcc STM32_CLOCK(APB1, 23U)>; interrupts = <24 0>; interrupt-names = "combined"; status = "disabled"; @@ -115,7 +115,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <26 3>; status = "disabled"; }; @@ -125,7 +125,7 @@ #dma-cells = <3>; reg = <0x40020400 0x400>; interrupts = <11 0 11 0 11 0 11 0 11 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x2>; + clocks = <&rcc STM32_CLOCK(AHB1, 1U)>; dma-requests = <5>; dma-offset = <7>; status = "disabled"; @@ -144,7 +144,7 @@ num-bidir-endpoints = <8>; ram-size = <2048>; phys = <&usb_fs_phy>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00002000>, + clocks = <&rcc STM32_CLOCK(APB1, 13U)>, <&rcc STM32_SRC_HSI48 USB_SEL(0)>; status = "disabled"; }; diff --git a/dts/arm/st/g4/stm32g4.dtsi b/dts/arm/st/g4/stm32g4.dtsi index 8cba3a5802153..79e44bada0b6f 100644 --- a/dts/arm/st/g4/stm32g4.dtsi +++ b/dts/arm/st/g4/stm32g4.dtsi @@ -106,7 +106,7 @@ adc1: adc@50000000 { compatible = "st,stm32-adc"; reg = <0x50000000 0x100>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(AHB2, 13U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; @@ -121,7 +121,7 @@ adc2: adc@50000100 { compatible = "st,stm32-adc"; reg = <0x50000100 0x100>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(AHB2, 13U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; @@ -136,7 +136,7 @@ dac1: dac@50000800 { compatible = "st,stm32-dac"; reg = <0x50000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(AHB2, 16U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -144,7 +144,7 @@ dac3: dac@50001000 { compatible = "st,stm32-dac"; reg = <0x50001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00040000>; + clocks = <&rcc STM32_CLOCK(AHB2, 18U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -153,7 +153,7 @@ compatible = "st,stm32-flash-controller", "st,stm32g4-flash-controller"; reg = <0x40022000 0x400>; interrupts = <3 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000100>; + clocks = <&rcc STM32_CLOCK(AHB1, 8U)>; #address-cells = <1>; #size-cells = <1>; @@ -206,7 +206,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB2, 0U)>; }; gpiob: gpio@48000400 { @@ -214,7 +214,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000002>; + clocks = <&rcc STM32_CLOCK(AHB2, 1U)>; }; gpioc: gpio@48000800 { @@ -222,7 +222,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000004>; + clocks = <&rcc STM32_CLOCK(AHB2, 2U)>; }; gpiod: gpio@48000c00 { @@ -230,7 +230,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000008>; + clocks = <&rcc STM32_CLOCK(AHB2, 3U)>; }; gpioe: gpio@48001000 { @@ -238,7 +238,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB2, 4U)>; }; gpiof: gpio@48001400 { @@ -246,7 +246,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB2, 5U)>; }; gpiog: gpio@48001800 { @@ -254,14 +254,14 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48001800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000040>; + clocks = <&rcc STM32_CLOCK(AHB2, 6U)>; }; }; usart1: serial@40013800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40013800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB2, 14U)>; resets = <&rctl STM32_RESET(APB2, 14U)>; interrupts = <37 0>; status = "disabled"; @@ -270,7 +270,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1L, 17U)>; interrupts = <38 0>; status = "disabled"; @@ -279,7 +279,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1L, 18U)>; interrupts = <39 0>; status = "disabled"; @@ -288,7 +288,7 @@ uart4: serial@40004c00 { compatible = "st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1L, 19U)>; interrupts = <52 0>; status = "disabled"; @@ -297,7 +297,7 @@ lpuart1: serial@40008000 { compatible = "st,stm32-lpuart", "st,stm32-uart"; reg = <0x40008000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1_2, 0U)>; resets = <&rctl STM32_RESET(APB1H, 0U)>; interrupts = <91 0>; status = "disabled"; @@ -312,7 +312,7 @@ wwdg: watchdog@40002c00 { compatible = "st,stm32-window-watchdog"; reg = <0x40002C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <0 7>; status = "disabled"; }; @@ -323,7 +323,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB1, 21U)>; interrupts = <31 0>, <32 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -335,7 +335,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <33 0>, <34 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -347,7 +347,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40007800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x40000000>; + clocks = <&rcc STM32_CLOCK(APB1, 30U)>; interrupts = <92 0>, <93 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -359,7 +359,7 @@ #size-cells = <0>; reg = <0x40013000 0x400>; interrupts = <35 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB2, 12U)>; status = "disabled"; }; @@ -368,7 +368,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <36 5>; status = "disabled"; }; @@ -378,7 +378,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <51 5>; status = "disabled"; }; @@ -389,14 +389,14 @@ reg-names = "m_can", "message_ram"; interrupts = <21 0>, <22 0>; interrupt-names = "int0", "int1"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; bosch,mram-cfg = <0x0 28 8 3 3 0 3 3>; status = "disabled"; }; lptim1: timers@40007c00 { compatible = "st,stm32-lptim"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>; + clocks = <&rcc STM32_CLOCK(APB1, 31U)>; #address-cells = <1>; #size-cells = <0>; reg = <0x40007c00 0x400>; @@ -408,7 +408,7 @@ timers1: timers@40012c00 { compatible = "st,stm32-timers"; reg = <0x40012c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB2, 11U)>; resets = <&rctl STM32_RESET(APB2, 11U)>; interrupts = <24 0>, <25 0>, <26 0>, <27 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -425,7 +425,7 @@ timers2: timers@40000000 { compatible = "st,stm32-timers"; reg = <0x40000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1, 0U)>; resets = <&rctl STM32_RESET(APB1L, 0U)>; interrupts = <28 0>; interrupt-names = "global"; @@ -447,7 +447,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1L, 1U)>; interrupts = <29 0>; interrupt-names = "global"; @@ -469,7 +469,7 @@ timers4: timers@40000800 { compatible = "st,stm32-timers"; reg = <0x40000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB1, 2U)>; resets = <&rctl STM32_RESET(APB1L, 2U)>; interrupts = <30 0>; interrupt-names = "global"; @@ -491,7 +491,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1L, 4U)>; interrupts = <54 0>; interrupt-names = "global"; @@ -502,7 +502,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1L, 5U)>; interrupts = <55 0>; interrupt-names = "global"; @@ -513,7 +513,7 @@ timers8: timers@40013400 { compatible = "st,stm32-timers"; reg = <0x40013400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(APB2, 13U)>; resets = <&rctl STM32_RESET(APB2, 13U)>; interrupts = <43 0>, <44 0>, <45 0>, <46 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -530,7 +530,7 @@ timers15: timers@40014000 { compatible = "st,stm32-timers"; reg = <0x40014000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(APB2, 16U)>; resets = <&rctl STM32_RESET(APB2, 16U)>; interrupts = <24 0>; interrupt-names = "global"; @@ -552,7 +552,7 @@ timers16: timers@40014400 { compatible = "st,stm32-timers"; reg = <0x40014400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB2, 17U)>; resets = <&rctl STM32_RESET(APB2, 17U)>; interrupts = <25 0>; interrupt-names = "global"; @@ -574,7 +574,7 @@ timers17: timers@40014800 { compatible = "st,stm32-timers"; reg = <0x40014800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB2, 18U)>; resets = <&rctl STM32_RESET(APB2, 18U)>; interrupts = <26 0>; interrupt-names = "global"; @@ -597,7 +597,7 @@ compatible = "st,stm32-rtc"; reg = <0x40002800 0x400>; interrupts = <41 0>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000400>; + clocks = <&rcc STM32_CLOCK(APB1, 10U)>; prescaler = <32768>; alarms-count = <2>; alrm-exti-line = <17>; @@ -608,7 +608,7 @@ compatible = "st,stm32-rng"; reg = <0x50060800 0x400>; interrupts = <90 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x04000000>; + clocks = <&rcc STM32_CLOCK(AHB2, 26U)>; status = "disabled"; }; @@ -620,7 +620,7 @@ num-bidir-endpoints = <8>; ram-size = <1024>; phys = <&usb_fs_phy>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>, + clocks = <&rcc STM32_CLOCK(APB1, 23U)>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; status = "disabled"; }; @@ -629,7 +629,7 @@ compatible = "st,stm32-dma-v2"; #dma-cells = <3>; reg = <0x40020000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x1>; + clocks = <&rcc STM32_CLOCK(AHB1, 0U)>; dma-offset = <0>; status = "disabled"; }; @@ -638,7 +638,7 @@ compatible = "st,stm32-dma-v2"; #dma-cells = <3>; reg = <0x40020400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x2>; + clocks = <&rcc STM32_CLOCK(AHB1, 1U)>; status = "disabled"; }; @@ -647,7 +647,7 @@ #dma-cells = <3>; reg = <0x40020800 0x400>; interrupts = <94 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x4>; + clocks = <&rcc STM32_CLOCK(AHB1, 2U)>; dma-generators = <4>; dma-requests= <111>; status = "disabled"; @@ -656,7 +656,7 @@ ucpd1: ucpd@4000a000 { compatible = "st,stm32-ucpd"; reg = <0x4000a000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; interrupts = <63 0>; status = "disabled"; }; diff --git a/dts/arm/st/g4/stm32g473.dtsi b/dts/arm/st/g4/stm32g473.dtsi index 0f538669ff3d0..be945b5e4fdb9 100644 --- a/dts/arm/st/g4/stm32g473.dtsi +++ b/dts/arm/st/g4/stm32g473.dtsi @@ -13,7 +13,7 @@ timers5: timers@40000c00 { compatible = "st,stm32-timers"; reg = <0x40000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB1, 3U)>; resets = <&rctl STM32_RESET(APB1L, 3U)>; interrupts = <50 0>; interrupt-names = "global"; @@ -30,7 +30,7 @@ adc4: adc@50000500 { compatible = "st,stm32-adc"; reg = <0x50000500 0x100>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00004000>; + clocks = <&rcc STM32_CLOCK(AHB2, 14U)>; interrupts = <61 0>; status = "disabled"; #io-channel-cells = <1>; @@ -45,7 +45,7 @@ adc5: adc@50000600 { compatible = "st,stm32-adc"; reg = <0x50000600 0x100>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00004000>; + clocks = <&rcc STM32_CLOCK(AHB2, 14U)>; interrupts = <62 0>; status = "disabled"; #io-channel-cells = <1>; @@ -62,7 +62,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB2, 15U)>; interrupts = <84 5>; status = "disabled"; }; @@ -70,7 +70,7 @@ dac2: dac@50000c00 { compatible = "st,stm32-dac"; reg = <0x50000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00020000>; + clocks = <&rcc STM32_CLOCK(AHB2, 17U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -78,7 +78,7 @@ dac4: dac@50001400 { compatible = "st,stm32-dac"; reg = <0x50001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00080000>; + clocks = <&rcc STM32_CLOCK(AHB2, 19U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -89,7 +89,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40008400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1_2, 1U)>; interrupts = <82 0>, <83 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -101,7 +101,7 @@ reg-names = "m_can", "message_ram"; interrupts = <88 0>, <89 0>; interrupt-names = "int0", "int1"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; bosch,mram-cfg = <0x6a0 28 8 3 3 0 3 3>; status = "disabled"; }; diff --git a/dts/arm/st/g4/stm32g491.dtsi b/dts/arm/st/g4/stm32g491.dtsi index f51eb356157a6..03875473b58ce 100644 --- a/dts/arm/st/g4/stm32g491.dtsi +++ b/dts/arm/st/g4/stm32g491.dtsi @@ -16,7 +16,7 @@ reg-names = "m_can", "message_ram"; interrupts = <86 0>, <87 0>; interrupt-names = "int0", "int1"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; bosch,mram-cfg = <0x350 28 8 3 3 0 3 3>; status = "disabled"; }; @@ -24,7 +24,7 @@ timers20: timers@40015000 { compatible = "st,stm32-timers"; reg = <0x40015000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB2, 20U)>; resets = <&rctl STM32_RESET(APB2, 20U)>; interrupts = <77 0>, <78 0>, <79 0>, <80 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -56,7 +56,7 @@ adc3: adc@50000400 { compatible = "st,stm32-adc"; reg = <0x50000400 0x100>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00004000>; + clocks = <&rcc STM32_CLOCK(AHB2, 14U)>; interrupts = <47 0>; status = "disabled"; #io-channel-cells = <1>; @@ -71,7 +71,7 @@ uart5: serial@40005000 { compatible = "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1L, 20U)>; interrupts = <53 0>; status = "disabled"; diff --git a/dts/arm/st/h5/stm32h5.dtsi b/dts/arm/st/h5/stm32h5.dtsi index 32f39caf8fe19..03c84df8a0666 100644 --- a/dts/arm/st/h5/stm32h5.dtsi +++ b/dts/arm/st/h5/stm32h5.dtsi @@ -132,7 +132,7 @@ backup_sram: memory@40036400 { compatible = "zephyr,memory-region", "st,stm32-backup-sram"; reg = <0x40036400 DT_SIZE_K(2)>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x10000000>; + clocks = <&rcc STM32_CLOCK(AHB1, 28U)>; zephyr,memory-region = "BACKUP_SRAM"; status = "disabled"; }; @@ -190,7 +190,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42020000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB2, 0U)>; }; gpiob: gpio@42020400 { @@ -198,7 +198,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42020400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000002>; + clocks = <&rcc STM32_CLOCK(AHB2, 1U)>; }; gpioc: gpio@42020800 { @@ -206,7 +206,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42020800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000004>; + clocks = <&rcc STM32_CLOCK(AHB2, 2U)>; }; gpiod: gpio@42020c00 { @@ -214,7 +214,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42020c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000008>; + clocks = <&rcc STM32_CLOCK(AHB2, 3U)>; }; gpioh: gpio@42021c00 { @@ -222,13 +222,13 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42021c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000080>; + clocks = <&rcc STM32_CLOCK(AHB2, 7U)>; }; }; lptim1: timers@44004400 { compatible = "st,stm32-lptim"; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x800>; + clocks = <&rcc STM32_CLOCK(APB3, 11U)>; #address-cells = <1>; #size-cells = <0>; reg = <0x44004400 0x400>; @@ -239,7 +239,7 @@ lptim2: timers@40009400 { compatible = "st,stm32-lptim"; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x20>; + clocks = <&rcc STM32_CLOCK(APB1_2, 5U)>; #address-cells = <1>; #size-cells = <0>; reg = <0x40009400 0x400>; @@ -251,7 +251,7 @@ usart1: serial@40013800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40013800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB2, 14U)>; resets = <&rctl STM32_RESET(APB2, 14U)>; interrupts = <58 0>; status = "disabled"; @@ -260,7 +260,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1L, 17U)>; interrupts = <59 0>; status = "disabled"; @@ -269,7 +269,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1L, 18U)>; interrupts = <60 0>; status = "disabled"; @@ -278,7 +278,7 @@ lpuart1: serial@44002400 { compatible = "st,stm32-lpuart", "st,stm32-uart"; reg = <0x44002400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00000040>; + clocks = <&rcc STM32_CLOCK(APB3, 6U)>; resets = <&rctl STM32_RESET(APB3, 6U)>; interrupts = <63 0>; status = "disabled"; @@ -293,7 +293,7 @@ wwdg: watchdog@40002c00 { compatible = "st,stm32-window-watchdog"; reg = <0x40002c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <0 7>; status = "disabled"; }; @@ -301,7 +301,7 @@ dac1: dac@42028400 { compatible = "st,stm32-dac"; reg = <0x42028400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000800>; + clocks = <&rcc STM32_CLOCK(AHB2, 11U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -309,7 +309,7 @@ adc1: adc@42028000 { compatible = "st,stm32-adc"; reg = <0x42028000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000400>; + clocks = <&rcc STM32_CLOCK(AHB2, 10U)>; interrupts = <37 0>; status = "disabled"; vref-mv = <3300>; @@ -326,7 +326,7 @@ compatible = "st,stm32-rtc"; reg = <0x44007800 0x400>; interrupts = <2 0>; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB3, 21U)>; prescaler = <32768>; alarms-count = <2>; alrm-exti-line = <17>; @@ -336,7 +336,7 @@ timers1: timers@40012c00 { compatible = "st,stm32-timers"; reg = <0x40012c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB2, 11U)>; resets = <&rctl STM32_RESET(APB2, 11U)>; interrupts = <41 0>, <42 0>, <43 0>, <44 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -352,7 +352,7 @@ timers2: timers@40000000 { compatible = "st,stm32-timers"; reg = <0x40000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1, 0U)>; resets = <&rctl STM32_RESET(APB1L, 0U)>; interrupts = <45 0>; interrupt-names = "global"; @@ -373,7 +373,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1L, 1U)>; interrupts = <46 0>; interrupt-names = "global"; @@ -394,7 +394,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1L, 4U)>; interrupts = <49 0>; interrupt-names = "global"; @@ -415,7 +415,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1L, 5U)>; interrupts = <50 0>; interrupt-names = "global"; @@ -439,7 +439,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB1, 21U)>; interrupts = <51 0>, <52 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -451,7 +451,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <53 0>, <54 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -463,7 +463,7 @@ #size-cells = <0>; reg = <0x40013000 0x400>; interrupts = <55 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>, + clocks = <&rcc STM32_CLOCK(APB2, 12U)>, <&rcc STM32_SRC_PLL1_Q SPI1_SEL(0)>; status = "disabled"; }; @@ -474,7 +474,7 @@ #size-cells = <0>; reg = <0x40003800 0x400>; interrupts = <56 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>, + clocks = <&rcc STM32_CLOCK(APB1, 14U)>, <&rcc STM32_SRC_PLL1_Q SPI2_SEL(0)>; status = "disabled"; }; @@ -485,7 +485,7 @@ #size-cells = <0>; reg = <0x40003c00 0x400>; interrupts = <57 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>, + clocks = <&rcc STM32_CLOCK(APB1, 15U)>, <&rcc STM32_SRC_PLL1_Q SPI3_SEL(0)>; status = "disabled"; }; @@ -496,7 +496,7 @@ reg-names = "m_can", "message_ram"; interrupts = <39 0>, <40 0>; interrupt-names = "int0", "int1"; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000200>; + clocks = <&rcc STM32_CLOCK(APB1_2, 9U)>; bosch,mram-cfg = <0x0 28 8 3 3 0 3 3>; status = "disabled"; }; @@ -504,7 +504,7 @@ rng: rng@420c0800 { compatible = "st,stm32-rng"; reg = <0x420c0800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00040000>; + clocks = <&rcc STM32_CLOCK(AHB2, 18U)>; interrupts = <114 0>; nist-config = <0xf00d00>; health-test-config = <0xaac7>; @@ -516,9 +516,9 @@ reg = <0x40028000 0x8000>; interrupts = <106 0>; clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx"; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00080000>, - <&rcc STM32_CLOCK_BUS_AHB1 0x00100000>, - <&rcc STM32_CLOCK_BUS_AHB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(AHB1, 19U)>, + <&rcc STM32_CLOCK(AHB1, 20U)>, + <&rcc STM32_CLOCK(AHB1, 21U)>; status = "disabled"; mdio: mdio { @@ -534,7 +534,7 @@ #dma-cells = <3>; reg = <0x40020000 0x1000>; interrupts = <27 0 28 0 29 0 30 0 31 0 32 0 33 0 34 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x1>; + clocks = <&rcc STM32_CLOCK(AHB1, 0U)>; dma-channels = <8>; dma-requests = <140>; dma-offset = <0>; @@ -546,7 +546,7 @@ #dma-cells = <3>; reg = <0x40021000 0x1000>; interrupts = <90 0 91 0 92 0 93 0 94 0 95 0 96 0 97 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x2>; + clocks = <&rcc STM32_CLOCK(AHB1, 1U)>; dma-channels = <8>; dma-requests = <140>; dma-offset = <8>; @@ -558,7 +558,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>, + clocks = <&rcc STM32_CLOCK(APB2, 12U)>, <&rcc STM32_SRC_PLL1_Q SPI1_SEL(0)>; dmas = <&gpdma1 0 7 (STM32_DMA_PERIPH_TX |STM32_DMA_16BITS | \ STM32_DMA_PRIORITY_HIGH) @@ -574,7 +574,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>, + clocks = <&rcc STM32_CLOCK(APB1, 14U)>, <&rcc STM32_SRC_PLL1_Q SPI2_SEL(0)>; dmas = <&gpdma1 2 9 (STM32_DMA_PERIPH_TX | STM32_DMA_16BITS | \ STM32_DMA_PRIORITY_HIGH) @@ -590,7 +590,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>, + clocks = <&rcc STM32_CLOCK(APB1, 15U)>, <&rcc STM32_SRC_PLL1_Q SPI3_SEL(0)>; dmas = <&gpdma1 4 11 (STM32_DMA_PERIPH_TX | STM32_DMA_16BITS | \ STM32_DMA_PRIORITY_HIGH) @@ -609,7 +609,7 @@ num-bidir-endpoints = <8>; ram-size = <2048>; phys = <&usb_fs_phy>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x01000000>, + clocks = <&rcc STM32_CLOCK(APB2, 24U)>, <&rcc STM32_SRC_HSI48 USB_SEL(3)>; status = "disabled"; }; @@ -619,7 +619,7 @@ reg = <0x40008c00 0x400>; interrupts = <113 0>; interrupt-names = "digi_temp"; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB1_2, 3U)>; status = "disabled"; }; }; diff --git a/dts/arm/st/h5/stm32h533.dtsi b/dts/arm/st/h5/stm32h533.dtsi index fff14197c46eb..a3a4c69d63f91 100644 --- a/dts/arm/st/h5/stm32h533.dtsi +++ b/dts/arm/st/h5/stm32h533.dtsi @@ -14,13 +14,13 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42021400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000080>; + clocks = <&rcc STM32_CLOCK(AHB2, 7U)>; }; fmc: memory-controller@47000400 { compatible = "st,stm32-fmc"; reg = <0x47000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00010000>; + clocks = <&rcc STM32_CLOCK(AHB4, 16U)>; status = "disabled"; }; }; diff --git a/dts/arm/st/h5/stm32h562.dtsi b/dts/arm/st/h5/stm32h562.dtsi index 130ec20437fb7..290343ef426a4 100644 --- a/dts/arm/st/h5/stm32h562.dtsi +++ b/dts/arm/st/h5/stm32h562.dtsi @@ -28,7 +28,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42021000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB2, 4U)>; }; gpiof: gpio@42021400 { @@ -36,7 +36,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42021400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB2, 5U)>; }; gpiog: gpio@42021800 { @@ -44,7 +44,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42021800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000040>; + clocks = <&rcc STM32_CLOCK(AHB2, 6U)>; }; gpioi: gpio@42022000 { @@ -52,7 +52,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42022000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000100>; + clocks = <&rcc STM32_CLOCK(AHB2, 8U)>; }; }; @@ -62,7 +62,7 @@ lptim3: timers@44004800 { compatible = "st,stm32-lptim"; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x1000>; + clocks = <&rcc STM32_CLOCK(APB3, 12U)>; #address-cells = <1>; #size-cells = <0>; reg = <0x44004800 0x400>; @@ -73,7 +73,7 @@ lptim4: timers@44004c00 { compatible = "st,stm32-lptim"; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x2000>; + clocks = <&rcc STM32_CLOCK(APB3, 13U)>; #address-cells = <1>; #size-cells = <0>; reg = <0x44004c00 0x400>; @@ -84,7 +84,7 @@ lptim5: timers@44005000 { compatible = "st,stm32-lptim"; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x4000>; + clocks = <&rcc STM32_CLOCK(APB3, 14U)>; #address-cells = <1>; #size-cells = <0>; reg = <0x44005000 0x400>; @@ -95,7 +95,7 @@ lptim6: timers@44005400 { compatible = "st,stm32-lptim"; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x8000>; + clocks = <&rcc STM32_CLOCK(APB3, 15U)>; #address-cells = <1>; #size-cells = <0>; reg = <0x44005400 0x400>; @@ -107,7 +107,7 @@ uart4: serial@40004c00 { compatible = "st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1L, 19U)>; interrupts = <61 0>; status = "disabled"; @@ -116,7 +116,7 @@ uart5: serial@40005000 { compatible = "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1L, 20U)>; interrupts = <62 0>; status = "disabled"; @@ -125,7 +125,7 @@ uart7: serial@40007800 { compatible = "st,stm32-uart"; reg = <0x40007800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x40000000>; + clocks = <&rcc STM32_CLOCK(APB1, 30U)>; resets = <&rctl STM32_RESET(APB1L, 30U)>; interrupts = <98 0>; status = "disabled"; @@ -134,7 +134,7 @@ uart8: serial@40007c00 { compatible = "st,stm32-uart"; reg = <0x40007c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>; + clocks = <&rcc STM32_CLOCK(APB1, 31U)>; resets = <&rctl STM32_RESET(APB1L, 31U)>; interrupts = <99 0>; status = "disabled"; @@ -143,7 +143,7 @@ uart9: serial@40008000 { compatible = "st,stm32-uart"; reg = <0x40008000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1_2, 0U)>; resets = <&rctl STM32_RESET(APB1H, 0U)>; interrupts = <100 0>; status = "disabled"; @@ -152,7 +152,7 @@ usart6: serial@40006400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40006400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; resets = <&rctl STM32_RESET(APB1L, 25U)>; interrupts = <85 0>; status = "disabled"; @@ -161,7 +161,7 @@ usart10: serial@40006800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40006800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x04000000>; + clocks = <&rcc STM32_CLOCK(APB1, 26U)>; resets = <&rctl STM32_RESET(APB1L, 26U)>; interrupts = <86 0>; status = "disabled"; @@ -170,7 +170,7 @@ usart11: serial@40006c00 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40006c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x08000000>; + clocks = <&rcc STM32_CLOCK(APB1, 27U)>; resets = <&rctl STM32_RESET(APB1L, 27U)>; interrupts = <87 0>; status = "disabled"; @@ -179,7 +179,7 @@ uart12: serial@40008400 { compatible = "st,stm32-uart"; reg = <0x40008400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1_2, 1U)>; resets = <&rctl STM32_RESET(APB1H, 1U)>; interrupts = <101 0>; status = "disabled"; @@ -191,7 +191,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x44002800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00000080>; + clocks = <&rcc STM32_CLOCK(APB3, 7U)>; interrupts = <80 0>, <81 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -203,7 +203,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x44002c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00000100>; + clocks = <&rcc STM32_CLOCK(APB3, 8U)>; interrupts = <125 0>, <126 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -215,7 +215,7 @@ #size-cells = <0>; reg = <0x40014c00 0x400>; interrupts = <82 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB2, 19U)>; status = "disabled"; }; @@ -225,7 +225,7 @@ #size-cells = <0>; reg = <0x44002000 0x400>; interrupts = <83 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB3, 5U)>; status = "disabled"; }; @@ -235,7 +235,7 @@ #size-cells = <0>; reg = <0x40015000 0x400>; interrupts = <84 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB2, 20U)>; status = "disabled"; }; @@ -244,7 +244,7 @@ reg = <0x47001400 0x400>; interrupts = <78 0>; clock-names = "xspix", "xspi-ker"; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00100000>, + clocks = <&rcc STM32_CLOCK(AHB4, 20U)>, <&rcc STM32_SRC_PLL1_Q OCTOSPI1_SEL(1)>; #address-cells = <1>; #size-cells = <0>; @@ -254,7 +254,7 @@ adc2: adc@42028100 { compatible = "st,stm32-adc"; reg = <0x42028100 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000400>; + clocks = <&rcc STM32_CLOCK(AHB2, 10U)>; interrupts = <69 0>; status = "disabled"; vref-mv = <3300>; @@ -270,7 +270,7 @@ timers4: timers@40000800 { compatible = "st,stm32-timers"; reg = <0x40000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB1, 2U)>; resets = <&rctl STM32_RESET(APB1L, 2U)>; interrupts = <47 0>; interrupt-names = "global"; @@ -291,7 +291,7 @@ timers5: timers@40000c00 { compatible = "st,stm32-timers"; reg = <0x40000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB1, 3U)>; resets = <&rctl STM32_RESET(APB1L, 3U)>; interrupts = <48 0>; interrupt-names = "global"; @@ -312,7 +312,7 @@ timers12: timers@40001800 { compatible = "st,stm32-timers"; reg = <0x40001800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000040>; + clocks = <&rcc STM32_CLOCK(APB1, 6U)>; resets = <&rctl STM32_RESET(APB1L, 6U)>; interrupts = <120 0>; interrupt-names = "global"; @@ -333,7 +333,7 @@ timers13: timers@40001c00 { compatible = "st,stm32-timers"; reg = <0x40001c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000080>; + clocks = <&rcc STM32_CLOCK(APB1, 7U)>; resets = <&rctl STM32_RESET(APB1L, 7U)>; interrupts = <121 0>; interrupt-names = "global"; @@ -354,7 +354,7 @@ timers14: timers@40002000 { compatible = "st,stm32-timers"; reg = <0x40002000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000100>; + clocks = <&rcc STM32_CLOCK(APB1, 8U)>; resets = <&rctl STM32_RESET(APB1L, 8U)>; interrupts = <122 0>; interrupt-names = "global"; @@ -375,7 +375,7 @@ timers15: timers@40014000 { compatible = "st,stm32-timers"; reg = <0x40014000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(APB2, 16U)>; resets = <&rctl STM32_RESET(APB2, 16U)>; interrupts = <71 0>; interrupt-names = "global"; @@ -396,7 +396,7 @@ timers16: timers@40014400 { compatible = "st,stm32-timers"; reg = <0x40014400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB2, 17U)>; resets = <&rctl STM32_RESET(APB2, 17U)>; interrupts = <72 0>; interrupt-names = "global"; @@ -417,7 +417,7 @@ timers17: timers@40014800 { compatible = "st,stm32-timers"; reg = <0x40014800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB2, 18U)>; resets = <&rctl STM32_RESET(APB2, 18U)>; interrupts = <73 0>; interrupt-names = "global"; @@ -438,7 +438,7 @@ aes: aes@420c0000 { compatible = "st,stm32-aes"; reg = <0x420c0000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(AHB2, 16U)>; resets = <&rctl STM32_RESET(AHB2, 16U)>; interrupts = <116 0>; status = "disabled"; @@ -451,7 +451,7 @@ interrupts = <109 0>, <110 0>; interrupt-names = "int0", "int1"; /* common clock FDCAN 1 & 2 */ - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000200>; + clocks = <&rcc STM32_CLOCK(APB1_2, 9U)>; bosch,mram-cfg = <0x350 28 8 3 3 0 3 3>; status = "disabled"; }; @@ -459,7 +459,7 @@ sdmmc1: sdmmc@46008000 { compatible = "st,stm32-sdmmc"; reg = <0x46008000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000800>, + clocks = <&rcc STM32_CLOCK(AHB4, 11U)>, <&rcc STM32_SRC_PLL1_Q SDMMC1_SEL(0)>; resets = <&rctl STM32_RESET(AHB4, 11U)>; interrupts = <79 0>; @@ -469,7 +469,7 @@ fmc: memory-controller@47000400 { compatible = "st,stm32-fmc"; reg = <0x47000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00010000>; + clocks = <&rcc STM32_CLOCK(AHB4, 16U)>; status = "disabled"; }; }; diff --git a/dts/arm/st/h5/stm32h563.dtsi b/dts/arm/st/h5/stm32h563.dtsi index 474794299734b..0b23250565cb8 100644 --- a/dts/arm/st/h5/stm32h563.dtsi +++ b/dts/arm/st/h5/stm32h563.dtsi @@ -13,7 +13,7 @@ sdmmc2: sdmmc@46008c00 { compatible = "st,stm32-sdmmc"; reg = <0x46008c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00001000>, + clocks = <&rcc STM32_CLOCK(AHB4, 12U)>, <&rcc STM32_SRC_PLL1_Q SDMMC2_SEL(0)>; resets = <&rctl STM32_RESET(AHB4, 12U)>; interrupts = <102 0>; diff --git a/dts/arm/st/h7/stm32h7.dtsi b/dts/arm/st/h7/stm32h7.dtsi index 9d7bb3d7c66e8..3e2d37eebe179 100644 --- a/dts/arm/st/h7/stm32h7.dtsi +++ b/dts/arm/st/h7/stm32h7.dtsi @@ -144,7 +144,7 @@ compatible = "st,stm32-flash-controller", "st,stm32h7-flash-controller"; reg = <0x52002000 0x400>; interrupts = <4 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00000100>; + clocks = <&rcc STM32_CLOCK(AHB3, 8U)>; #address-cells = <1>; #size-cells = <1>; @@ -187,7 +187,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58020000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB4, 0U)>; }; gpiob: gpio@58020400 { @@ -195,7 +195,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58020400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000002>; + clocks = <&rcc STM32_CLOCK(AHB4, 1U)>; }; gpioc: gpio@58020800 { @@ -203,7 +203,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58020800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000004>; + clocks = <&rcc STM32_CLOCK(AHB4, 2U)>; }; gpiod: gpio@58020C00 { @@ -211,7 +211,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58020C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000008>; + clocks = <&rcc STM32_CLOCK(AHB4, 3U)>; }; gpioe: gpio@58021000 { @@ -219,7 +219,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58021000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB4, 4U)>; }; gpiof: gpio@58021400 { @@ -227,7 +227,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58021400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB4, 5U)>; }; gpiog: gpio@58021800 { @@ -235,7 +235,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58021800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000040>; + clocks = <&rcc STM32_CLOCK(AHB4, 6U)>; }; gpioh: gpio@58021C00 { @@ -243,7 +243,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58021C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000080>; + clocks = <&rcc STM32_CLOCK(AHB4, 7U)>; }; gpioi: gpio@58022000 { @@ -251,7 +251,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58022000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000100>; + clocks = <&rcc STM32_CLOCK(AHB4, 8U)>; }; gpioj: gpio@58022400 { @@ -259,7 +259,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58022400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000200>; + clocks = <&rcc STM32_CLOCK(AHB4, 9U)>; }; gpiok: gpio@58022800 { @@ -267,7 +267,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58022800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000400>; + clocks = <&rcc STM32_CLOCK(AHB4, 10U)>; }; }; @@ -280,7 +280,7 @@ wwdg: wwdg1: watchdog@50003000 { compatible = "st,stm32-window-watchdog"; reg = <0x50003000 0x1000>; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00000040>; + clocks = <&rcc STM32_CLOCK(APB3, 6U)>; interrupts = <0 7>; status = "disabled"; }; @@ -288,7 +288,7 @@ usart1: serial@40011000 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40011000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB2, 4U)>; resets = <&rctl STM32_RESET(APB2, 4U)>; interrupts = <37 0>; status = "disabled"; @@ -296,7 +296,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1L, 17U)>; interrupts = <38 0>; status = "disabled"; @@ -304,7 +304,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1L, 18U)>; interrupts = <39 0>; status = "disabled"; @@ -312,7 +312,7 @@ uart4: serial@40004c00 { compatible ="st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1L, 19U)>; interrupts = <52 0>; status = "disabled"; @@ -320,7 +320,7 @@ uart5: serial@40005000 { compatible = "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1L, 20U)>; interrupts = <53 0>; status = "disabled"; @@ -328,7 +328,7 @@ usart6: serial@40011400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40011400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB2, 5U)>; resets = <&rctl STM32_RESET(APB2, 5U)>; interrupts = <71 0>; status = "disabled"; @@ -336,7 +336,7 @@ uart7: serial@40007800 { compatible = "st,stm32-uart"; reg = <0x40007800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x40000000>; + clocks = <&rcc STM32_CLOCK(APB1, 30U)>; resets = <&rctl STM32_RESET(APB1L, 30U)>; interrupts = <82 0>; status = "disabled"; @@ -344,7 +344,7 @@ uart8: serial@40007c00 { compatible = "st,stm32-uart"; reg = <0x40007c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>; + clocks = <&rcc STM32_CLOCK(APB1, 31U)>; resets = <&rctl STM32_RESET(APB1L, 31U)>; interrupts = <83 0>; status = "disabled"; @@ -353,7 +353,7 @@ lpuart1: serial@58000c00 { compatible = "st,stm32-lpuart", "st,stm32-uart"; reg = <0x58000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB4 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB4, 3U)>; resets = <&rctl STM32_RESET(APB4, 3U)>; interrupts = <142 0>; status = "disabled"; @@ -363,7 +363,7 @@ compatible = "st,stm32-rtc"; reg = <0x58004000 0x400>; interrupts = <41 0>; - clocks = <&rcc STM32_CLOCK_BUS_APB4 0x00010000>; + clocks = <&rcc STM32_CLOCK(APB4, 16U)>; prescaler = <32768>; alarms-count = <2>; alrm-exti-line = <17>; @@ -376,7 +376,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB1, 21U)>; interrupts = <31 0>, <32 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -388,7 +388,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <33 0>, <34 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -400,7 +400,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>; + clocks = <&rcc STM32_CLOCK(APB1, 23U)>; interrupts = <72 0>, <73 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -412,7 +412,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x58001c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB4 0x00000080>; + clocks = <&rcc STM32_CLOCK(APB4, 7U)>; interrupts = <95 0>, <96 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -423,7 +423,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>, + clocks = <&rcc STM32_CLOCK(APB2, 12U)>, <&rcc STM32_SRC_PLL1_Q SPI123_SEL(0)>; interrupts = <35 0>; status = "disabled"; @@ -434,7 +434,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>, + clocks = <&rcc STM32_CLOCK(APB1, 14U)>, <&rcc STM32_SRC_PLL1_Q SPI123_SEL(0)>; interrupts = <36 0>; status = "disabled"; @@ -445,7 +445,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>, + clocks = <&rcc STM32_CLOCK(APB1, 15U)>, <&rcc STM32_SRC_PLL1_Q SPI123_SEL(0)>; interrupts = <51 0>; status = "disabled"; @@ -456,7 +456,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(APB2, 13U)>; interrupts = <84 0>; status = "disabled"; }; @@ -466,7 +466,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40015000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB2, 20U)>; interrupts = <85 0>; status = "disabled"; }; @@ -476,7 +476,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x58001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB4 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB4, 5U)>; interrupts = <86 0>; status = "disabled"; }; @@ -486,7 +486,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>, + clocks = <&rcc STM32_CLOCK(APB2, 12U)>, <&rcc STM32_SRC_PLL1_Q SPI123_SEL(0)>; dmas = <&dmamux1 0 38 (STM32_DMA_PERIPH_TX | STM32_DMA_PRIORITY_HIGH) &dmamux1 1 37 (STM32_DMA_PERIPH_RX | STM32_DMA_PRIORITY_HIGH)>; @@ -500,7 +500,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>, + clocks = <&rcc STM32_CLOCK(APB1, 14U)>, <&rcc STM32_SRC_PLL1_Q SPI123_SEL(0)>; dmas = <&dmamux1 0 40 (STM32_DMA_PERIPH_TX | STM32_DMA_PRIORITY_HIGH) &dmamux1 1 39 (STM32_DMA_PERIPH_RX | STM32_DMA_PRIORITY_HIGH)>; @@ -514,7 +514,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>, + clocks = <&rcc STM32_CLOCK(APB1, 15U)>, <&rcc STM32_SRC_PLL1_Q SPI123_SEL(0)>; dmas = <&dmamux1 0 62 (STM32_DMA_PERIPH_TX | STM32_DMA_PRIORITY_HIGH) &dmamux1 1 61 (STM32_DMA_PERIPH_RX | STM32_DMA_PRIORITY_HIGH)>; @@ -527,7 +527,7 @@ compatible = "st,stm32h7-fdcan"; reg = <0x4000a000 0x400>, <0x4000ac00 0x350>; reg-names = "m_can", "message_ram"; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000100>; + clocks = <&rcc STM32_CLOCK(APB1_2, 8U)>; interrupts = <19 0>, <21 0>, <63 0>; interrupt-names = "int0", "int1", "calib"; bosch,mram-cfg = <0x0 28 8 3 3 0 3 3>; @@ -538,7 +538,7 @@ compatible = "st,stm32h7-fdcan"; reg = <0x4000a400 0x400>, <0x4000ac00 0x6a0>; reg-names = "m_can", "message_ram"; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000100>; + clocks = <&rcc STM32_CLOCK(APB1_2, 8U)>; interrupts = <20 0>, <22 0>, <63 0>; interrupt-names = "int0", "int1", "calib"; bosch,mram-cfg = <0x350 28 8 3 3 0 3 3>; @@ -548,7 +548,7 @@ timers1: timers@40010000 { compatible = "st,stm32-timers"; reg = <0x40010000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB2, 0U)>; resets = <&rctl STM32_RESET(APB2, 0U)>; interrupts = <24 0>, <25 0>, <26 0>, <27 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -565,7 +565,7 @@ timers2: timers@40000000 { compatible = "st,stm32-timers"; reg = <0x40000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1, 0U)>; resets = <&rctl STM32_RESET(APB1L, 0U)>; interrupts = <28 0>; interrupt-names = "global"; @@ -587,7 +587,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1L, 1U)>; interrupts = <29 0>; interrupt-names = "global"; @@ -609,7 +609,7 @@ timers4: timers@40000800 { compatible = "st,stm32-timers"; reg = <0x40000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB1, 2U)>; resets = <&rctl STM32_RESET(APB1L, 2U)>; interrupts = <30 0>; interrupt-names = "global"; @@ -631,7 +631,7 @@ timers5: timers@40000c00 { compatible = "st,stm32-timers"; reg = <0x40000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB1, 3U)>; resets = <&rctl STM32_RESET(APB1L, 3U)>; interrupts = <50 0>; interrupt-names = "global"; @@ -653,7 +653,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1L, 4U)>; interrupts = <54 0>; interrupt-names = "global"; @@ -669,7 +669,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1L, 5U)>; interrupts = <55 0>; interrupt-names = "global"; @@ -685,7 +685,7 @@ timers8: timers@40010400 { compatible = "st,stm32-timers"; reg = <0x40010400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB2, 1U)>; resets = <&rctl STM32_RESET(APB2, 1U)>; interrupts = <43 0>, <44 0>, <45 0>, <46 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -702,7 +702,7 @@ timers12: timers@40001800 { compatible = "st,stm32-timers"; reg = <0x40001800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000040>; + clocks = <&rcc STM32_CLOCK(APB1, 6U)>; resets = <&rctl STM32_RESET(APB1L, 6U)>; interrupts = <43 0>; interrupt-names = "global"; @@ -724,7 +724,7 @@ timers13: timers@40001c00 { compatible = "st,stm32-timers"; reg = <0x40001c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000080>; + clocks = <&rcc STM32_CLOCK(APB1, 7U)>; resets = <&rctl STM32_RESET(APB1L, 7U)>; interrupts = <44 0>; interrupt-names = "global"; @@ -746,7 +746,7 @@ timers14: timers@40002000 { compatible = "st,stm32-timers"; reg = <0x40002000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000100>; + clocks = <&rcc STM32_CLOCK(APB1, 8U)>; resets = <&rctl STM32_RESET(APB1L, 8U)>; interrupts = <45 0>; interrupt-names = "global"; @@ -768,7 +768,7 @@ timers15: timers@40014000 { compatible = "st,stm32-timers"; reg = <0x40014000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(APB2, 16U)>; resets = <&rctl STM32_RESET(APB2, 16U)>; interrupts = <116 0>; interrupt-names = "global"; @@ -790,7 +790,7 @@ timers16: timers@40014400 { compatible = "st,stm32-timers"; reg = <0x40014400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB2, 17U)>; resets = <&rctl STM32_RESET(APB2, 17U)>; interrupts = <117 0>; interrupt-names = "global"; @@ -812,7 +812,7 @@ timers17: timers@40014800 { compatible = "st,stm32-timers"; reg = <0x40014800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB2, 18U)>; resets = <&rctl STM32_RESET(APB2, 18U)>; interrupts = <118 0>; interrupt-names = "global"; @@ -833,7 +833,7 @@ lptim1: timers@40002400 { compatible = "st,stm32-lptim"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000200>; + clocks = <&rcc STM32_CLOCK(APB1, 9U)>; #address-cells = <1>; #size-cells = <0>; reg = <0x40002400 0x400>; @@ -852,7 +852,7 @@ adc1: adc@40022000 { compatible = "st,stm32-adc"; reg = <0x40022000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB1, 5U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; @@ -868,7 +868,7 @@ adc2: adc@40022100 { compatible = "st,stm32-adc"; reg = <0x40022100 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB1, 5U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; @@ -885,7 +885,7 @@ adc1_2: adc@40022300 { compatible = "st,stm32-adc"; reg = <0x40022300 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB1, 5U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; @@ -901,7 +901,7 @@ adc3: adc@58026000 { compatible = "st,stm32-adc"; reg = <0x58026000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x01000000>; + clocks = <&rcc STM32_CLOCK(AHB4, 24U)>; interrupts = <127 0>; status = "disabled"; #io-channel-cells = <1>; @@ -917,7 +917,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -928,7 +928,7 @@ reg = <0x40020000 0x400>; interrupts = <11 0>, <12 0>, <13 0>, <14 0>, <15 0>, <16 0>, <17 0>, <47 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB1, 0U)>; st,mem2mem; dma-offset = <0>; dma-requests = <8>; @@ -941,7 +941,7 @@ reg = <0x40020400 0x400>; interrupts = <56 0>, <57 0>, <58 0>, <59 0>, <60 0>, <68 0>, <69 0>, <70 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(AHB1, 1U)>; st,mem2mem; dma-offset = <8>; dma-requests = <8>; @@ -954,7 +954,7 @@ reg = <0x58025400 0x400>; interrupts = <129 0>, <130 0>, <131 0>, <132 0>, <133 0>, <134 0>, <135 0>, <136 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00200000>; + clocks = <&rcc STM32_CLOCK(AHB4, 21U)>; st,mem2mem; dma-offset = <0>; dma-requests = <8>; @@ -967,7 +967,7 @@ reg = <0x40020800 0x400>; interrupts = <102 0>; /* dmamux1 has no dedicated clock, so we enable dma1 clock */ - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB1, 0U)>; dma-channels = <16>; dma-generators = <8>; status = "disabled"; @@ -983,7 +983,7 @@ reg = <0x58025800 0x400>; interrupts = <128 0>; /* dmamux2 has no dedicated clock, so we enable bdma clock */ - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00200000>; + clocks = <&rcc STM32_CLOCK(AHB4, 21U)>; dma-channels = <8>; dma-generators = <8>; status = "disabled"; @@ -996,7 +996,7 @@ rng: rng@48021800 { compatible = "st,stm32-rng"; reg = <0x48021800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000040>; + clocks = <&rcc STM32_CLOCK(AHB2, 6U)>; interrupts = <80 0>; status = "disabled"; }; @@ -1004,7 +1004,7 @@ sdmmc1: sdmmc@52007000 { compatible = "st,stm32-sdmmc"; reg = <0x52007000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00010000>, + clocks = <&rcc STM32_CLOCK(AHB3, 16U)>, <&rcc STM32_SRC_PLL1_Q SDMMC_SEL(0)>; resets = <&rctl STM32_RESET(AHB3, 16U)>; interrupts = <49 0>; @@ -1014,7 +1014,7 @@ sdmmc2: sdmmc@48022400 { compatible = "st,stm32-sdmmc"; reg = <0x48022400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000200>, + clocks = <&rcc STM32_CLOCK(AHB2, 9U)>, <&rcc STM32_SRC_PLL1_Q SDMMC_SEL(0)>; resets = <&rctl STM32_RESET(AHB2, 9U)>; interrupts = <124 0>; @@ -1026,9 +1026,9 @@ reg = <0x40028000 0x8000>; interrupts = <61 0>; clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx"; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00008000>, - <&rcc STM32_CLOCK_BUS_AHB1 0x00010000>, - <&rcc STM32_CLOCK_BUS_AHB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(AHB1, 15U)>, + <&rcc STM32_CLOCK(AHB1, 16U)>, + <&rcc STM32_CLOCK(AHB1, 17U)>; status = "disabled"; mdio: mdio { @@ -1042,7 +1042,7 @@ fmc: memory-controller@52004000 { compatible = "st,stm32h7-fmc"; reg = <0x52004000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00001000>; + clocks = <&rcc STM32_CLOCK(AHB3, 12U)>; status = "disabled"; sdram: sdram { @@ -1056,7 +1056,7 @@ backup_sram: memory@38800000 { compatible = "zephyr,memory-region", "st,stm32-backup-sram"; reg = <0x38800000 DT_SIZE_K(4)>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x10000000>; + clocks = <&rcc STM32_CLOCK(AHB4, 28U)>; zephyr,memory-region = "BACKUP_SRAM"; status = "disabled"; }; @@ -1067,7 +1067,7 @@ #size-cells = <0x0>; reg = <0x52005000 0x34>; interrupts = <92 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00004000>; + clocks = <&rcc STM32_CLOCK(AHB3, 14U)>; status = "disabled"; }; @@ -1076,7 +1076,7 @@ reg = <0x48020000 0x400>; interrupts = <78 0>; interrupt-names = "dcmi"; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB2, 0U)>; status = "disabled"; }; }; diff --git a/dts/arm/st/h7/stm32h723.dtsi b/dts/arm/st/h7/stm32h723.dtsi index e0b961a2a0144..e4e7e4ee7acc4 100644 --- a/dts/arm/st/h7/stm32h723.dtsi +++ b/dts/arm/st/h7/stm32h723.dtsi @@ -27,7 +27,7 @@ uart9: serial@40011800 { compatible = "st,stm32-uart"; reg = <0x40011800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000040>; + clocks = <&rcc STM32_CLOCK(APB2, 6U)>; resets = <&rctl STM32_RESET(APB2, 6U)>; interrupts = <155 0>; status = "disabled"; @@ -36,7 +36,7 @@ usart10: serial@40011c00 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40011c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000080>; + clocks = <&rcc STM32_CLOCK(APB2, 7U)>; resets = <&rctl STM32_RESET(APB2, 7U)>; interrupts = <156 0>; status = "disabled"; @@ -76,7 +76,7 @@ num-bidir-endpoints = <9>; ram-size = ; maximum-speed = "full-speed"; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x02000000>, + clocks = <&rcc STM32_CLOCK(AHB1, 25U)>, <&rcc STM32_SRC_HSI48 USB_SEL(3)>; phys = <&otghs_fs_phy>; status = "disabled"; @@ -87,7 +87,7 @@ reg = <0x50001000 0x200>; interrupts = <88 0>, <89 0>; interrupt-names = "ltdc", "ltdc_er"; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB3, 3U)>; resets = <&rctl STM32_RESET(APB3, 4U)>; status = "disabled"; }; @@ -97,7 +97,7 @@ reg = <0x52005000 0x1000>; interrupts = <92 0>; clock-names = "ospix", "ospi-ker"; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00004000>, + clocks = <&rcc STM32_CLOCK(AHB3, 14U)>, <&rcc STM32_SRC_PLL1_Q OSPI_SEL(1)>; #address-cells = <1>; #size-cells = <0>; @@ -109,7 +109,7 @@ reg = <0x5200a000 0x1000>; interrupts = <150 0>; clock-names = "ospix", "ospi-ker"; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x000080000>, + clocks = <&rcc STM32_CLOCK(AHB3, 19U)>, <&rcc STM32_SRC_PLL1_Q OSPI_SEL(1)>; #address-cells = <1>; #size-cells = <0>; @@ -120,7 +120,7 @@ compatible = "st,stm32h7-fdcan"; reg = <0x4000d400 0x400>, <0x4000ac00 0x9f0>; reg-names = "m_can", "message_ram"; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000100>; + clocks = <&rcc STM32_CLOCK(APB1_2, 8U)>; interrupts = <159 0>, <160 0>, <63 0>; interrupt-names = "int0", "int1", "calib"; bosch,mram-cfg = <0x6a0 28 8 3 3 0 3 3>; @@ -138,7 +138,7 @@ timers23: timers@4000e000 { compatible = "st,stm32-timers"; reg = <0x4000e000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x01000000>; + clocks = <&rcc STM32_CLOCK(APB1_2, 24U)>; resets = <&rctl STM32_RESET(APB1H, 24U)>; interrupts = <161 0>; interrupt-names = "global"; @@ -160,7 +160,7 @@ timers24: timers@4000e400 { compatible = "st,stm32-timers"; reg = <0x4000e400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x02000000>; + clocks = <&rcc STM32_CLOCK(APB1_2, 25U)>; resets = <&rctl STM32_RESET(APB1H, 25U)>; interrupts = <162 0>; interrupt-names = "global"; @@ -184,7 +184,7 @@ reg = <0x58006800 0x400>; interrupts = <147 0>; interrupt-names = "digi_temp"; - clocks = <&rcc STM32_CLOCK_BUS_APB4 0x04000000>; + clocks = <&rcc STM32_CLOCK(APB4, 26U)>; status = "disabled"; }; }; diff --git a/dts/arm/st/h7/stm32h730.dtsi b/dts/arm/st/h7/stm32h730.dtsi index b3b18949eea07..1d73fe7f52434 100644 --- a/dts/arm/st/h7/stm32h730.dtsi +++ b/dts/arm/st/h7/stm32h730.dtsi @@ -13,7 +13,7 @@ cryp: cryp@48021000 { compatible = "st,stm32-cryp"; reg = <0x48021000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB2, 4U)>; resets = <&rctl STM32_RESET(AHB2, 4U)>; interrupts = <79 0>; status = "disabled"; diff --git a/dts/arm/st/h7/stm32h743.dtsi b/dts/arm/st/h7/stm32h743.dtsi index b18c46cd8e31d..114db6e7c1ece 100644 --- a/dts/arm/st/h7/stm32h743.dtsi +++ b/dts/arm/st/h7/stm32h743.dtsi @@ -37,7 +37,7 @@ num-bidir-endpoints = <9>; ram-size = <4096>; maximum-speed = "full-speed"; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x08000000>, + clocks = <&rcc STM32_CLOCK(AHB1, 27U)>, <&rcc STM32_SRC_HSI48 USB_SEL(3)>; phys = <&otghs_fs_phy>; status = "disabled"; @@ -48,7 +48,7 @@ reg = <0x50001000 0x200>; interrupts = <88 0>, <89 0>; interrupt-names = "ltdc", "ltdc_er"; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB3, 3U)>; resets = <&rctl STM32_RESET(APB3, 4U)>; status = "disabled"; }; diff --git a/dts/arm/st/h7/stm32h745.dtsi b/dts/arm/st/h7/stm32h745.dtsi index 299b826733cde..294fd02c502c0 100644 --- a/dts/arm/st/h7/stm32h745.dtsi +++ b/dts/arm/st/h7/stm32h745.dtsi @@ -41,7 +41,7 @@ reg = <0x50001000 0x200>; interrupts = <88 0>, <89 0>; interrupt-names = "ltdc", "ltdc_er"; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB3, 3U)>; resets = <&rctl STM32_RESET(APB3, 4U)>; status = "disabled"; }; @@ -54,7 +54,7 @@ num-bidir-endpoints = <9>; ram-size = <4096>; maximum-speed = "full-speed"; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x02000000>, + clocks = <&rcc STM32_CLOCK(AHB1, 25U)>, <&rcc STM32_SRC_HSI48 USB_SEL(3)>; phys = <&otghs_fs_phy>; status = "disabled"; @@ -68,7 +68,7 @@ num-bidir-endpoints = <9>; ram-size = <4096>; maximum-speed = "full-speed"; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x08000000>, + clocks = <&rcc STM32_CLOCK(AHB1, 27U)>, <&rcc STM32_SRC_HSI48 USB_SEL(3)>; phys = <&otghs_fs_phy>; status = "disabled"; diff --git a/dts/arm/st/h7/stm32h747.dtsi b/dts/arm/st/h7/stm32h747.dtsi index 25e9d451bdd5a..864dda873ba58 100644 --- a/dts/arm/st/h7/stm32h747.dtsi +++ b/dts/arm/st/h7/stm32h747.dtsi @@ -17,7 +17,7 @@ #size-cells = <0>; reg = <0x50000000 0x1000>; clock-names = "dsiclk", "refclk", "pixelclk"; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00000010>, + clocks = <&rcc STM32_CLOCK(APB3, 4U)>, <&rcc STM32_SRC_HSE NO_SEL>, <&rcc STM32_SRC_PLL3_R NO_SEL>; resets = <&rctl STM32_RESET(APB3, 4U)>; diff --git a/dts/arm/st/h7/stm32h755.dtsi b/dts/arm/st/h7/stm32h755.dtsi index 8637763c6dfa4..1293ec2b89cbf 100644 --- a/dts/arm/st/h7/stm32h755.dtsi +++ b/dts/arm/st/h7/stm32h755.dtsi @@ -14,7 +14,7 @@ cryp: cryp@48021000 { compatible = "st,stm32-cryp"; reg = <0x48021000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB2, 4U)>; interrupts = <79 0>; status = "disabled"; }; @@ -22,7 +22,7 @@ hash: cryp@48021400 { compatible = "st,stm32-cryp"; reg = <0x48021400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB2, 5U)>; interrupts = <80 0>; status = "disabled"; }; diff --git a/dts/arm/st/h7/stm32h7_dualcore.dtsi b/dts/arm/st/h7/stm32h7_dualcore.dtsi index 1ba052502ac15..e3b3d88a77aec 100644 --- a/dts/arm/st/h7/stm32h7_dualcore.dtsi +++ b/dts/arm/st/h7/stm32h7_dualcore.dtsi @@ -19,7 +19,7 @@ mailbox: mailbox@58026400 { compatible = "st,stm32-hsem-mailbox", "st,mbox-stm32-hsem"; reg = <0x58026400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x02000000>; + clocks = <&rcc STM32_CLOCK(AHB4, 25U)>; #mbox-cells = <1>; status = "disabled"; }; diff --git a/dts/arm/st/h7/stm32h7a3.dtsi b/dts/arm/st/h7/stm32h7a3.dtsi index 5be690de405b8..4721872a3b1d0 100644 --- a/dts/arm/st/h7/stm32h7a3.dtsi +++ b/dts/arm/st/h7/stm32h7a3.dtsi @@ -40,7 +40,7 @@ num-bidir-endpoints = <9>; ram-size = <4096>; maximum-speed = "full-speed"; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x02000000>, + clocks = <&rcc STM32_CLOCK(AHB1, 25U)>, <&rcc STM32_SRC_HSI48 USB_SEL(3)>; phys = <&otghs_fs_phy>; status = "disabled"; @@ -51,7 +51,7 @@ reg = <0x50001000 0x200>; interrupts = <88 0>, <89 0>; interrupt-names = "ltdc", "ltdc_er"; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB3, 3U)>; resets = <&rctl STM32_RESET(APB3, 4U)>; status = "disabled"; }; @@ -61,7 +61,7 @@ reg = <0x52005000 0x1000>; interrupts = <92 0>; clock-names = "ospix", "ospi-ker"; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00004000>, + clocks = <&rcc STM32_CLOCK(AHB3, 14U)>, <&rcc STM32_SRC_PLL1_Q OSPI_SEL(1)>; #address-cells = <1>; #size-cells = <0>; @@ -73,7 +73,7 @@ reg = <0x5200a000 0x1000>; interrupts = <150 0>; clock-names = "ospix", "ospi-ker"; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x000080000>, + clocks = <&rcc STM32_CLOCK(AHB3, 19U)>, <&rcc STM32_SRC_PLL1_Q OSPI_SEL(1)>; #address-cells = <1>; #size-cells = <0>; @@ -85,7 +85,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x58001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB4 0x00000020>, + clocks = <&rcc STM32_CLOCK(APB4, 5U)>, <&rcc STM32_SRC_PLL1_Q SPI6_SEL(0)>; dmas = <&dmamux2 0 12 0x20440 &dmamux2 1 11 0x20480>; dma-names = "tx", "rx"; @@ -104,7 +104,7 @@ reg = <0x58006800 0x400>; interrupts = <147 0>; interrupt-names = "digi_temp"; - clocks = <&rcc STM32_CLOCK_BUS_APB4 0x04000000>; + clocks = <&rcc STM32_CLOCK(APB4, 26U)>; status = "disabled"; }; }; diff --git a/dts/arm/st/h7/stm32h7b0.dtsi b/dts/arm/st/h7/stm32h7b0.dtsi index fc768212ca37e..2ea3a18e79db9 100644 --- a/dts/arm/st/h7/stm32h7b0.dtsi +++ b/dts/arm/st/h7/stm32h7b0.dtsi @@ -18,7 +18,7 @@ cryp: cryp@48021000 { compatible = "st,stm32-cryp"; reg = <0x48021000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB2, 4U)>; resets = <&rctl STM32_RESET(AHB2, 4U)>; interrupts = <79 0>; interrupt-names = "cryp"; diff --git a/dts/arm/st/h7rs/stm32h7rs.dtsi b/dts/arm/st/h7rs/stm32h7rs.dtsi index 3df6d5398a52c..8f17428ff00ba 100644 --- a/dts/arm/st/h7rs/stm32h7rs.dtsi +++ b/dts/arm/st/h7rs/stm32h7rs.dtsi @@ -175,7 +175,7 @@ compatible = "st,stm32-flash-controller", "st,stm32h7-flash-controller"; reg = <0x52002000 0x400>; interrupts = <8 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00000100>; + clocks = <&rcc STM32_CLOCK(AHB3, 8U)>; #address-cells = <1>; #size-cells = <1>; @@ -233,7 +233,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58020000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB4, 0U)>; }; gpiob: gpio@58020400 { @@ -241,7 +241,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58020400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000002>; + clocks = <&rcc STM32_CLOCK(AHB4, 1U)>; }; gpioc: gpio@58020800 { @@ -249,7 +249,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58020800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000004>; + clocks = <&rcc STM32_CLOCK(AHB4, 2U)>; }; gpiod: gpio@58020C00 { @@ -257,7 +257,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58020C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000008>; + clocks = <&rcc STM32_CLOCK(AHB4, 3U)>; }; gpioe: gpio@58021000 { @@ -265,7 +265,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58021000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB4, 4U)>; }; gpiof: gpio@58021400 { @@ -273,7 +273,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58021400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB4, 5U)>; }; gpiog: gpio@58021800 { @@ -281,7 +281,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58021800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000040>; + clocks = <&rcc STM32_CLOCK(AHB4, 6U)>; }; gpioh: gpio@58021c00 { @@ -289,7 +289,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58021c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000080>; + clocks = <&rcc STM32_CLOCK(AHB4, 7U)>; }; gpiom: gpio@58023000 { @@ -297,7 +297,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58023000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00001000>; + clocks = <&rcc STM32_CLOCK(AHB4, 12U)>; }; gpion: gpio@58023400 { @@ -305,7 +305,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58023400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00002000>; + clocks = <&rcc STM32_CLOCK(AHB4, 13U)>; }; gpioo: gpio@58023800 { @@ -313,7 +313,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58023800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00004000>; + clocks = <&rcc STM32_CLOCK(AHB4, 14U)>; }; gpiop: gpio@58023c00 { @@ -321,14 +321,14 @@ gpio-controller; #gpio-cells = <2>; reg = <0x58023c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00008000>; + clocks = <&rcc STM32_CLOCK(AHB4, 15U)>; }; }; usart1: serial@42001000 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x42001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB2, 4U)>; resets = <&rctl STM32_RESET(APB2, 4U)>; interrupts = <82 0>; status = "disabled"; @@ -336,7 +336,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1L, 17U)>; interrupts = <83 0>; status = "disabled"; @@ -344,7 +344,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1L, 18U)>; interrupts = <84 0>; status = "disabled"; @@ -352,7 +352,7 @@ uart4: serial@40004c00 { compatible ="st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1L, 19U)>; interrupts = <85 0>; status = "disabled"; @@ -360,7 +360,7 @@ uart5: serial@40005000 { compatible = "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1L, 20U)>; interrupts = <86 0>; status = "disabled"; @@ -368,7 +368,7 @@ uart7: serial@40007800 { compatible = "st,stm32-uart"; reg = <0x40007800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x40000000>; + clocks = <&rcc STM32_CLOCK(APB1, 30U)>; resets = <&rctl STM32_RESET(APB1L, 30U)>; interrupts = <87 0>; status = "disabled"; @@ -376,7 +376,7 @@ uart8: serial@40007c00 { compatible = "st,stm32-uart"; reg = <0x40007c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>; + clocks = <&rcc STM32_CLOCK(APB1, 31U)>; resets = <&rctl STM32_RESET(APB1L, 31U)>; interrupts = <88 0>; status = "disabled"; @@ -385,7 +385,7 @@ lpuart1: serial@58000c00 { compatible = "st,stm32-lpuart", "st,stm32-uart"; reg = <0x58000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB4 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB4, 3U)>; resets = <&rctl STM32_RESET(APB4, 3U)>; interrupts = <131 0>; status = "disabled"; @@ -397,7 +397,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB1, 21U)>; interrupts = <76 0>, <77 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -409,7 +409,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <78 0>, <79 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -421,7 +421,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>; + clocks = <&rcc STM32_CLOCK(APB1, 23U)>; interrupts = <80 0>, <81 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -432,7 +432,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x42003000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>, + clocks = <&rcc STM32_CLOCK(APB2, 12U)>, <&rcc STM32_SRC_PLL1_Q SPI1_SEL(0)>; interrupts = <58 0>; status = "disabled"; @@ -443,7 +443,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>, + clocks = <&rcc STM32_CLOCK(APB1, 14U)>, <&rcc STM32_SRC_PLL1_Q SPI23_SEL(0)>; interrupts = <59 0>; status = "disabled"; @@ -454,7 +454,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>, + clocks = <&rcc STM32_CLOCK(APB1, 15U)>, <&rcc STM32_SRC_PLL1_Q SPI23_SEL(0)>; interrupts = <60 0>; status = "disabled"; @@ -465,7 +465,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x42003400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(APB2, 13U)>; interrupts = <61 0>; status = "disabled"; }; @@ -475,7 +475,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x42005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB2, 20U)>; interrupts = <62 0>; status = "disabled"; }; @@ -485,7 +485,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>, + clocks = <&rcc STM32_CLOCK(APB2, 12U)>, <&rcc STM32_SRC_PLL1_Q SPI1_SEL(0)>; interrupts = <35 3>; status = "disabled"; @@ -501,7 +501,7 @@ wwdg: wwdg1: watchdog@40002c00 { compatible = "st,stm32-window-watchdog"; reg = <0x40002c00 0x1000>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <4 7>; status = "disabled"; }; @@ -509,7 +509,7 @@ timers1: timers@42000000 { compatible = "st,stm32-timers"; reg = <0x42000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB2, 0U)>; resets = <&rctl STM32_RESET(APB2, 0U)>; interrupts = <47 0>, <48 0>, <49 0>, <50 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -526,7 +526,7 @@ timers2: timers@40000000 { compatible = "st,stm32-timers"; reg = <0x40000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1, 0U)>; resets = <&rctl STM32_RESET(APB1L, 0U)>; interrupts = <51 0>; interrupt-names = "global"; @@ -548,7 +548,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1L, 1U)>; interrupts = <52 0>; interrupt-names = "global"; @@ -570,7 +570,7 @@ timers4: timers@40000800 { compatible = "st,stm32-timers"; reg = <0x40000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB1, 2U)>; resets = <&rctl STM32_RESET(APB1L, 2U)>; interrupts = <53 0>; interrupt-names = "global"; @@ -592,7 +592,7 @@ timers5: timers@40000c00 { compatible = "st,stm32-timers"; reg = <0x40000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB1, 3U)>; resets = <&rctl STM32_RESET(APB1L, 3U)>; interrupts = <54 0>; interrupt-names = "global"; @@ -614,7 +614,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1L, 4U)>; interrupts = <55 0>; interrupt-names = "global"; @@ -630,7 +630,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1L, 5U)>; interrupts = <56 0>; interrupt-names = "global"; @@ -646,7 +646,7 @@ timers9: timers@42004c00 { compatible = "st,stm32-timers"; reg = <0x42004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB2, 19U)>; resets = <&rctl STM32_RESET(APB2, 19U)>; interrupts = <57 0>; interrupt-names = "global"; @@ -662,7 +662,7 @@ timers15: timers@42004000 { compatible = "st,stm32-timers"; reg = <0x42004000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(APB2, 16U)>; resets = <&rctl STM32_RESET(APB2, 16U)>; interrupts = <116 0>; interrupt-names = "global"; @@ -684,7 +684,7 @@ timers16: timers@42004400 { compatible = "st,stm32-timers"; reg = <0x42004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB2, 17U)>; interrupts = <117 0>; interrupt-names = "global"; @@ -706,7 +706,7 @@ timers17: timers@42004800 { compatible = "st,stm32-timers"; reg = <0x42004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB2, 18U)>; interrupts = <118 0>; interrupt-names = "global"; @@ -727,7 +727,7 @@ lptim1: timers@40002400 { compatible = "st,stm32-lptim"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000200>; + clocks = <&rcc STM32_CLOCK(APB1, 9U)>; #address-cells = <1>; #size-cells = <0>; reg = <0x40002400 0x400>; @@ -739,7 +739,7 @@ adc1: adc@40022000 { compatible = "st,stm32-adc"; reg = <0x40022000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB1, 5U)>; interrupts = <38 0>; status = "disabled"; #io-channel-cells = <1>; @@ -754,7 +754,7 @@ adc2: adc@40022100 { compatible = "st,stm32-adc"; reg = <0x40022100 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB1, 5U)>; interrupts = <38 0>; status = "disabled"; #io-channel-cells = <1>; @@ -769,7 +769,7 @@ rng: rng@48020000 { compatible = "st,stm32-rng"; reg = <0x48020000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB3, 0U)>; interrupts = <37 0>; status = "disabled"; }; diff --git a/dts/arm/st/l0/stm32l0.dtsi b/dts/arm/st/l0/stm32l0.dtsi index f515f9c3166bf..4ac1ccb56a175 100644 --- a/dts/arm/st/l0/stm32l0.dtsi +++ b/dts/arm/st/l0/stm32l0.dtsi @@ -95,7 +95,7 @@ compatible = "st,stm32-rtc"; reg = <0x40002800 0x400>; interrupts = <2 0>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>; + clocks = <&rcc STM32_CLOCK(APB1, 28U)>; prescaler = <32768>; alarms-count = <2>; alrm-exti-line = <17>; @@ -160,7 +160,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000001>; + clocks = <&rcc STM32_CLOCK(IOP, 0U)>; }; gpiob: gpio@50000400 { @@ -168,7 +168,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000002>; + clocks = <&rcc STM32_CLOCK(IOP, 1U)>; }; gpioc: gpio@50000800 { @@ -176,7 +176,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000004>; + clocks = <&rcc STM32_CLOCK(IOP, 2U)>; }; gpiod: gpio@50000c00 { @@ -184,7 +184,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000008>; + clocks = <&rcc STM32_CLOCK(IOP, 3U)>; }; gpioh: gpio@50001c00 { @@ -192,7 +192,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50001c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000080>; + clocks = <&rcc STM32_CLOCK(IOP, 7U)>; }; }; @@ -205,7 +205,7 @@ wwdg: watchdog@40002c00 { compatible = "st,stm32-window-watchdog"; reg = <0x40002C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <0 2>; status = "disabled"; }; @@ -213,7 +213,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1, 17U)>; interrupts = <28 0>; status = "disabled"; @@ -222,7 +222,7 @@ lpuart1: serial@40004800 { compatible = "st,stm32-lpuart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1, 18U)>; interrupts = <29 0>; status = "disabled"; @@ -234,7 +234,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB1, 21U)>; interrupts = <23 0>; interrupt-names = "combined"; status = "disabled"; @@ -245,7 +245,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB2, 12U)>; interrupts = <25 3>; status = "disabled"; }; @@ -253,7 +253,7 @@ timers2: timers@40000000 { compatible = "st,stm32-timers"; reg = <0x40000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1, 0U)>; resets = <&rctl STM32_RESET(APB1, 0U)>; interrupts = <15 0>; interrupt-names = "global"; @@ -275,7 +275,7 @@ timers21: timers@40010800 { compatible = "st,stm32-timers"; reg = <0x40010800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB2, 2U)>; resets = <&rctl STM32_RESET(APB2, 2U)>; interrupts = <20 0>; interrupt-names = "global"; @@ -296,7 +296,7 @@ lptim1: timers@40007c00 { compatible = "st,stm32-lptim"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>; + clocks = <&rcc STM32_CLOCK(APB1, 31U)>; #address-cells = <1>; #size-cells = <0>; reg = <0x40007c00 0x400>; @@ -308,7 +308,7 @@ adc1: adc@40012400 { compatible = "st,stm32-adc"; reg = <0x40012400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000200>; + clocks = <&rcc STM32_CLOCK(APB2, 9U)>; interrupts = <12 0>; status = "disabled"; #io-channel-cells = <1>; @@ -326,7 +326,7 @@ #dma-cells = <3>; reg = <0x40020000 0x400>; interrupts = <9 0 10 0 10 0 11 0 11 0 11 0 11 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x1>; + clocks = <&rcc STM32_CLOCK(AHB1, 0U)>; status = "disabled"; }; diff --git a/dts/arm/st/l0/stm32l010Xb.dtsi b/dts/arm/st/l0/stm32l010Xb.dtsi index 9b35bbe9f7be0..56f7f79b95e00 100644 --- a/dts/arm/st/l0/stm32l010Xb.dtsi +++ b/dts/arm/st/l0/stm32l010Xb.dtsi @@ -26,7 +26,7 @@ timers22: timers@40011400 { compatible = "st,stm32-timers"; reg = <0x40011400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB2, 5U)>; resets = <&rctl STM32_RESET(APB2, 5U)>; interrupts = <22 0>; interrupt-names = "global"; diff --git a/dts/arm/st/l0/stm32l031.dtsi b/dts/arm/st/l0/stm32l031.dtsi index 18cb9e5160c04..e1e61b25ed1d7 100644 --- a/dts/arm/st/l0/stm32l031.dtsi +++ b/dts/arm/st/l0/stm32l031.dtsi @@ -13,7 +13,7 @@ timers22: timers@40011400 { compatible = "st,stm32-timers"; reg = <0x40011400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB2, 5U)>; resets = <&rctl STM32_RESET(APB2, 5U)>; interrupts = <22 0>; interrupt-names = "global"; diff --git a/dts/arm/st/l0/stm32l051.dtsi b/dts/arm/st/l0/stm32l051.dtsi index 9c5bfa1b02841..2dc089afccf39 100644 --- a/dts/arm/st/l0/stm32l051.dtsi +++ b/dts/arm/st/l0/stm32l051.dtsi @@ -16,7 +16,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <24 0>; interrupt-names = "combined"; status = "disabled"; @@ -27,7 +27,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <26 3>; status = "disabled"; }; @@ -35,7 +35,7 @@ usart1: serial@40013800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40013800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB2, 14U)>; resets = <&rctl STM32_RESET(APB2, 14U)>; interrupts = <27 0>; status = "disabled"; @@ -44,7 +44,7 @@ timers22: timers@40011400 { compatible = "st,stm32-timers"; reg = <0x40011400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB2, 5U)>; resets = <&rctl STM32_RESET(APB2, 5U)>; interrupts = <22 0>; interrupt-names = "global"; @@ -61,7 +61,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1, 4U)>; interrupts = <17 0>; interrupt-names = "global"; diff --git a/dts/arm/st/l0/stm32l053.dtsi b/dts/arm/st/l0/stm32l053.dtsi index 4c3d3dd6263de..6209bc63abee4 100644 --- a/dts/arm/st/l0/stm32l053.dtsi +++ b/dts/arm/st/l0/stm32l053.dtsi @@ -29,7 +29,7 @@ ram-size = <1024>; maximum-speed = "full-speed"; phys = <&otgfs_phy>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>, + clocks = <&rcc STM32_CLOCK(APB1, 23U)>, <&rcc STM32_SRC_HSI48 HSI48_SEL(1)>; status = "disabled"; }; @@ -37,7 +37,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; diff --git a/dts/arm/st/l0/stm32l071.dtsi b/dts/arm/st/l0/stm32l071.dtsi index 95a8fdc84249b..e02fbc179d603 100644 --- a/dts/arm/st/l0/stm32l071.dtsi +++ b/dts/arm/st/l0/stm32l071.dtsi @@ -16,7 +16,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000010>; + clocks = <&rcc STM32_CLOCK(IOP, 4U)>; }; }; @@ -26,7 +26,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <24 0>; interrupt-names = "combined"; status = "disabled"; @@ -38,7 +38,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40007800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x40000000>; + clocks = <&rcc STM32_CLOCK(APB1, 30U)>; interrupts = <21 0>; interrupt-names = "combined"; status = "disabled"; @@ -49,7 +49,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <26 3>; status = "disabled"; }; @@ -57,7 +57,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1, 1U)>; interrupts = <16 0>; interrupt-names = "global"; @@ -79,7 +79,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1, 4U)>; interrupts = <17 0>; interrupt-names = "global"; @@ -95,7 +95,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1, 5U)>; interrupts = <18 0>; interrupt-names = "global"; @@ -111,7 +111,7 @@ timers22: timers@40011400 { compatible = "st,stm32-timers"; reg = <0x40011400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB2, 5U)>; resets = <&rctl STM32_RESET(APB2, 5U)>; interrupts = <22 0>; interrupt-names = "global"; @@ -133,7 +133,7 @@ usart1: serial@40013800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40013800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB2, 14U)>; resets = <&rctl STM32_RESET(APB2, 14U)>; interrupts = <27 0>; status = "disabled"; @@ -142,7 +142,7 @@ usart4: serial@40004c00 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1, 19U)>; interrupts = <14 0>; status = "disabled"; @@ -151,7 +151,7 @@ usart5: serial@40005000 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1, 20U)>; interrupts = <14 0>; status = "disabled"; diff --git a/dts/arm/st/l0/stm32l072.dtsi b/dts/arm/st/l0/stm32l072.dtsi index c9e493513c8bf..0095909de7e3a 100644 --- a/dts/arm/st/l0/stm32l072.dtsi +++ b/dts/arm/st/l0/stm32l072.dtsi @@ -32,7 +32,7 @@ ram-size = <1024>; maximum-speed = "full-speed"; phys = <&otgfs_phy>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>, + clocks = <&rcc STM32_CLOCK(APB1, 23U)>, <&rcc STM32_SRC_HSI48 HSI48_SEL(1)>; status = "disabled"; }; @@ -41,7 +41,7 @@ compatible = "st,stm32-rng"; reg = <0x40025000 0x400>; interrupts = <29 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(AHB1, 20U)>; status = "disabled"; }; }; @@ -54,7 +54,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; diff --git a/dts/arm/st/l1/stm32l1.dtsi b/dts/arm/st/l1/stm32l1.dtsi index b4e6bb97fee03..2b138621f0264 100644 --- a/dts/arm/st/l1/stm32l1.dtsi +++ b/dts/arm/st/l1/stm32l1.dtsi @@ -86,7 +86,7 @@ compatible = "st,stm32-flash-controller", "st,stm32f1-flash-controller"; reg = <0x40023c00 0x400>; interrupts = <4 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(AHB1, 15U)>; #address-cells = <1>; #size-cells = <1>; @@ -117,7 +117,7 @@ compatible = "st,stm32-rtc"; reg = <0x40002800 0x400>; interrupts = <41 0>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>; + clocks = <&rcc STM32_CLOCK(APB1, 28U)>; prescaler = <32768>; alarms-count = <2>; alrm-exti-line = <17>; @@ -127,7 +127,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1, 17U)>; interrupts = <38 0>; status = "disabled"; @@ -136,7 +136,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1, 18U)>; interrupts = <39 0>; status = "disabled"; @@ -145,7 +145,7 @@ uart4: serial@40004c00 { compatible = "st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1, 19U)>; interrupts = <48 0>; status = "disabled"; @@ -154,7 +154,7 @@ uart5: serial@40005000 { compatible = "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1, 20U)>; interrupts = <49 0>; status = "disabled"; @@ -166,7 +166,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB1, 21U)>; interrupts = <31 0>, <32 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -178,7 +178,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <33 0>, <34 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -189,7 +189,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40013000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB2, 12U)>; interrupts = <35 0>; status = "disabled"; }; @@ -199,7 +199,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <36 0>; status = "disabled"; }; @@ -207,7 +207,7 @@ usart1: serial@40013800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40013800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB2, 14U)>; resets = <&rctl STM32_RESET(APB2, 14U)>; interrupts = <37 0>; status = "disabled"; @@ -216,7 +216,7 @@ adc1: adc@40012400 { compatible = "st,stm32f4-adc", "st,stm32-adc"; reg = <0x40012400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000200>, + clocks = <&rcc STM32_CLOCK(APB2, 9U)>, <&rcc STM32_SRC_HSI NO_SEL>; interrupts = <18 0>; status = "disabled"; @@ -233,7 +233,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -256,7 +256,7 @@ timers2: timers@40000000 { compatible = "st,stm32-timers"; reg = <0x40000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1, 0U)>; resets = <&rctl STM32_RESET(APB1, 0U)>; interrupts = <28 0>; interrupt-names = "global"; @@ -278,7 +278,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1, 1U)>; interrupts = <29 0>; interrupt-names = "global"; @@ -300,7 +300,7 @@ timers4: timers@40000800 { compatible = "st,stm32-timers"; reg = <0x40000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB1, 2U)>; resets = <&rctl STM32_RESET(APB1, 2U)>; interrupts = <30 0>; interrupt-names = "global"; @@ -322,7 +322,7 @@ timers9: timers@40010800 { compatible = "st,stm32-timers"; reg = <0x40010800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB2, 2U)>; resets = <&rctl STM32_RESET(APB2, 2U)>; interrupts = <25 0>; interrupt-names = "global"; @@ -344,7 +344,7 @@ timers10: timers@40010c00 { compatible = "st,stm32-timers"; reg = <0x40010c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB2, 3U)>; resets = <&rctl STM32_RESET(APB2, 3U)>; interrupts = <26 0>; interrupt-names = "global"; @@ -366,7 +366,7 @@ timers11: timers@40011000 { compatible = "st,stm32-timers"; reg = <0x40011000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB2, 4U)>; resets = <&rctl STM32_RESET(APB2, 4U)>; interrupts = <27 0>; interrupt-names = "global"; @@ -396,7 +396,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40020000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB1, 0U)>; }; gpiob: gpio@40020400 { @@ -404,7 +404,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40020400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(AHB1, 1U)>; }; gpioc: gpio@40020800 { @@ -412,7 +412,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40020800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(AHB1, 2U)>; }; gpiod: gpio@40020c00 { @@ -420,7 +420,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40020c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(AHB1, 3U)>; }; gpioe: gpio@40021000 { @@ -428,7 +428,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40021000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB1, 4U)>; }; gpioh: gpio@40021400 { @@ -436,7 +436,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x40021400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB1, 5U)>; }; }; @@ -449,7 +449,7 @@ wwdg: watchdog@40002c00 { compatible = "st,stm32-window-watchdog"; reg = <0x40002C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <0 7>; status = "disabled"; }; @@ -463,7 +463,7 @@ compatible = "st,stm32-dma-v2bis"; #dma-cells = <2>; reg = <0x40026000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x1000000>; + clocks = <&rcc STM32_CLOCK(AHB1, 24U)>; interrupts = <11 0 12 0 13 0 14 0 15 0 16 0 17 0>; status = "disabled"; }; diff --git a/dts/arm/st/l1/stm32l151Xc.dtsi b/dts/arm/st/l1/stm32l151Xc.dtsi index 6c513695c926f..00ca179c9f522 100644 --- a/dts/arm/st/l1/stm32l151Xc.dtsi +++ b/dts/arm/st/l1/stm32l151Xc.dtsi @@ -22,7 +22,7 @@ timers5: timers@40000c00 { compatible = "st,stm32-timers"; reg = <0x40000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB1, 3U)>; resets = <&rctl STM32_RESET(APB1, 3U)>; interrupts = <45 0>; interrupt-names = "global"; @@ -41,7 +41,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <47 0>; status = "disabled"; }; diff --git a/dts/arm/st/l1/stm32l152Xc.dtsi b/dts/arm/st/l1/stm32l152Xc.dtsi index 2a394383bf58c..5303f7c75830b 100644 --- a/dts/arm/st/l1/stm32l152Xc.dtsi +++ b/dts/arm/st/l1/stm32l152Xc.dtsi @@ -22,7 +22,7 @@ timers5: timers@40000c00 { compatible = "st,stm32-timers"; reg = <0x40000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB1, 3U)>; resets = <&rctl STM32_RESET(APB1, 3U)>; interrupts = <45 0>; interrupt-names = "global"; @@ -41,7 +41,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <47 0>; status = "disabled"; }; diff --git a/dts/arm/st/l1/stm32l152Xe.dtsi b/dts/arm/st/l1/stm32l152Xe.dtsi index 5a48ed44be155..8e261242d3c4e 100644 --- a/dts/arm/st/l1/stm32l152Xe.dtsi +++ b/dts/arm/st/l1/stm32l152Xe.dtsi @@ -22,7 +22,7 @@ timers5: timers@40000c00 { compatible = "st,stm32-timers"; reg = <0x40000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB1, 3U)>; resets = <&rctl STM32_RESET(APB1, 3U)>; interrupts = <45 0>; interrupt-names = "global"; @@ -41,7 +41,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <47 0>; status = "disabled"; }; diff --git a/dts/arm/st/l4/stm32l4.dtsi b/dts/arm/st/l4/stm32l4.dtsi index 0c4f3c2d576c0..5ddee7107d93b 100644 --- a/dts/arm/st/l4/stm32l4.dtsi +++ b/dts/arm/st/l4/stm32l4.dtsi @@ -118,7 +118,7 @@ compatible = "st,stm32-flash-controller", "st,stm32l4-flash-controller"; reg = <0x40022000 0x400>; interrupts = <4 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000100>; + clocks = <&rcc STM32_CLOCK(AHB1, 8U)>; #address-cells = <1>; #size-cells = <1>; @@ -170,7 +170,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB2, 0U)>; }; gpiob: gpio@48000400 { @@ -178,7 +178,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000002>; + clocks = <&rcc STM32_CLOCK(AHB2, 1U)>; }; gpioc: gpio@48000800 { @@ -186,7 +186,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000004>; + clocks = <&rcc STM32_CLOCK(AHB2, 2U)>; }; gpioh: gpio@48001c00 { @@ -194,7 +194,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48001c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000080>; + clocks = <&rcc STM32_CLOCK(AHB2, 7U)>; }; }; @@ -207,7 +207,7 @@ wwdg: watchdog@40002c00 { compatible = "st,stm32-window-watchdog"; reg = <0x40002C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <0 7>; status = "disabled"; }; @@ -215,7 +215,7 @@ usart1: serial@40013800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40013800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB2, 14U)>; resets = <&rctl STM32_RESET(APB2, 14U)>; interrupts = <37 0>; status = "disabled"; @@ -224,7 +224,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1L, 17U)>; interrupts = <38 0>; status = "disabled"; @@ -233,7 +233,7 @@ lpuart1: serial@40008000 { compatible = "st,stm32-lpuart", "st,stm32-uart"; reg = <0x40008000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1_2, 0U)>; resets = <&rctl STM32_RESET(APB1H, 0U)>; interrupts = <70 0>; status = "disabled"; @@ -245,7 +245,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB1, 21U)>; interrupts = <31 0>, <32 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -257,7 +257,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>; + clocks = <&rcc STM32_CLOCK(APB1, 23U)>; interrupts = <72 0>, <73 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -269,7 +269,7 @@ #size-cells = <0>; reg = <0xa0001000 0x400>; interrupts = <71 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00000100>; + clocks = <&rcc STM32_CLOCK(AHB3, 8U)>; status = "disabled"; }; @@ -279,7 +279,7 @@ #size-cells = <0>; reg = <0x40013000 0x400>; interrupts = <35 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB2, 12U)>; status = "disabled"; }; @@ -287,7 +287,7 @@ timers1: timers@40012c00 { compatible = "st,stm32-timers"; reg = <0x40012c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB2, 11U)>; resets = <&rctl STM32_RESET(APB2, 11U)>; interrupts = <24 0>, <25 0>, <26 0>, <27 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -304,7 +304,7 @@ timers2: timers@40000000 { compatible = "st,stm32-timers"; reg = <0x40000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1, 0U)>; resets = <&rctl STM32_RESET(APB1L, 0U)>; interrupts = <28 0>; interrupt-names = "global"; @@ -326,7 +326,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1L, 4U)>; interrupts = <54 0>; interrupt-names = "global"; @@ -342,7 +342,7 @@ timers15: timers@40014000 { compatible = "st,stm32-timers"; reg = <0x40014000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(APB2, 16U)>; resets = <&rctl STM32_RESET(APB2, 16U)>; interrupts = <24 0>; interrupt-names = "global"; @@ -364,7 +364,7 @@ timers16: timers@40014400 { compatible = "st,stm32-timers"; reg = <0x40014400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB2, 17U)>; resets = <&rctl STM32_RESET(APB2, 17U)>; interrupts = <25 0>; interrupt-names = "global"; @@ -387,7 +387,7 @@ compatible = "st,stm32-rtc"; reg = <0x40002800 0x400>; interrupts = <41 0>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>; + clocks = <&rcc STM32_CLOCK(APB1, 28U)>; prescaler = <32768>; alarms-count = <2>; alrm-exti-line = <18>; @@ -397,7 +397,7 @@ adc1: adc@50040000 { compatible = "st,stm32-adc"; reg = <0x50040000 0x100>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(AHB2, 13U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; @@ -412,7 +412,7 @@ adc2: adc@50040100 { compatible = "st,stm32-adc"; reg = <0x50040100 0x100>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(AHB2, 13U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; @@ -429,7 +429,7 @@ #dma-cells = <3>; reg = <0x40020000 0x400>; interrupts = <11 0 12 0 13 0 14 0 15 0 16 0 17 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x1>; + clocks = <&rcc STM32_CLOCK(AHB1, 0U)>; dma-requests = <7>; status = "disabled"; }; @@ -439,14 +439,14 @@ #dma-cells = <3>; reg = <0x40020400 0x400>; interrupts = <56 0 57 0 58 0 59 0 60 0 68 0 69 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x2>; + clocks = <&rcc STM32_CLOCK(AHB1, 1U)>; dma-requests = <7>; status = "disabled"; }; lptim1: timers@40007c00 { compatible = "st,stm32-lptim"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>; + clocks = <&rcc STM32_CLOCK(APB1, 31U)>; #address-cells = <1>; #size-cells = <0>; reg = <0x40007c00 0x400>; @@ -460,7 +460,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40009400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1_2, 5U)>; interrupts = <66 1>; interrupt-names = "wakeup"; status = "disabled"; @@ -470,7 +470,7 @@ compatible = "st,stm32-rng"; reg = <0x50060800 0x400>; interrupts = <80 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00040000>, + clocks = <&rcc STM32_CLOCK(AHB2, 18U)>, /* Following domain clock setting requires MSI * clock to be enabled with msi-range = <11>; */ diff --git a/dts/arm/st/l4/stm32l412.dtsi b/dts/arm/st/l4/stm32l412.dtsi index 69c26d848aa9e..3084a43fdfb8c 100644 --- a/dts/arm/st/l4/stm32l412.dtsi +++ b/dts/arm/st/l4/stm32l412.dtsi @@ -22,7 +22,7 @@ rng: rng@50060800 { - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00040000>, + clocks = <&rcc STM32_CLOCK(AHB2, 18U)>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; }; @@ -35,7 +35,7 @@ ram-size = <1024>; maximum-speed = "full-speed"; phys = <&usb_fs_phy>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x04000000>, + clocks = <&rcc STM32_CLOCK(APB1, 26U)>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; status = "disabled"; }; @@ -45,7 +45,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; clock-frequency = ; interrupts = <33 0>, <34 0>; interrupt-names = "event", "error"; @@ -58,14 +58,14 @@ #size-cells = <0>; reg = <0x40003800 0x400>; interrupts = <36 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; status = "disabled"; }; usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1L, 18U)>; interrupts = <39 0>; status = "disabled"; diff --git a/dts/arm/st/l4/stm32l422.dtsi b/dts/arm/st/l4/stm32l422.dtsi index ce672dd412878..bceee881ef17c 100644 --- a/dts/arm/st/l4/stm32l422.dtsi +++ b/dts/arm/st/l4/stm32l422.dtsi @@ -13,7 +13,7 @@ aes: aes@50060000 { compatible = "st,stm32l4-aes", "st,stm32-aes"; reg = <0x50060000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(AHB2, 16U)>; resets = <&rctl STM32_RESET(AHB2, 16U)>; interrupts = <79 0>; interrupt-names = "aes"; diff --git a/dts/arm/st/l4/stm32l431.dtsi b/dts/arm/st/l4/stm32l431.dtsi index 3682e2a98ba62..652fa0b906793 100644 --- a/dts/arm/st/l4/stm32l431.dtsi +++ b/dts/arm/st/l4/stm32l431.dtsi @@ -25,7 +25,7 @@ gpiod: gpio@48000c00 { compatible = "st,stm32-gpio"; reg = <0x48000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000008>; + clocks = <&rcc STM32_CLOCK(AHB2, 3U)>; gpio-controller; #gpio-cells = <2>; }; @@ -33,7 +33,7 @@ gpioe: gpio@48001000 { compatible = "st,stm32-gpio"; reg = <0x48001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB2, 4U)>; gpio-controller; #gpio-cells = <2>; }; @@ -41,7 +41,7 @@ }; rng: rng@50060800 { - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00040000>, + clocks = <&rcc STM32_CLOCK(AHB2, 18U)>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; }; @@ -50,7 +50,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; clock-frequency = ; interrupts = <33 0>, <34 0>; interrupt-names = "event", "error"; @@ -62,7 +62,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <36 5>; status = "disabled"; }; @@ -72,7 +72,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <51 5>; status = "disabled"; }; @@ -80,7 +80,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1L, 18U)>; interrupts = <39 0>; status = "disabled"; @@ -89,7 +89,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1L, 5U)>; interrupts = <55 0>; interrupt-names = "global"; @@ -105,7 +105,7 @@ can1: can@40006400 { compatible = "st,stm32-bxcan"; reg = <0x40006400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; interrupts = <19 0>, <20 0>, <21 0>, <22 0>; interrupt-names = "TX", "RX0", "RX1", "SCE"; status = "disabled"; @@ -114,7 +114,7 @@ sdmmc1: sdmmc@40012800 { compatible = "st,stm32-sdmmc"; reg = <0x40012800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000400>, + clocks = <&rcc STM32_CLOCK(APB2, 10U)>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; resets = <&rctl STM32_RESET(APB2, 10U)>; interrupts = <49 0>; @@ -124,7 +124,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; #io-channel-cells = <1>; status = "disabled"; }; diff --git a/dts/arm/st/l4/stm32l432.dtsi b/dts/arm/st/l4/stm32l432.dtsi index 138942cd77ffb..b8c8a3d178a06 100644 --- a/dts/arm/st/l4/stm32l432.dtsi +++ b/dts/arm/st/l4/stm32l432.dtsi @@ -21,7 +21,7 @@ compatible = "st,stm32l432", "st,stm32l4", "simple-bus"; rng: rng@50060800 { - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00040000>, + clocks = <&rcc STM32_CLOCK(AHB2, 18U)>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; }; @@ -30,7 +30,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <51 5>; status = "disabled"; }; @@ -38,7 +38,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1L, 5U)>; interrupts = <55 0>; interrupt-names = "global"; @@ -56,7 +56,7 @@ reg = <0x40006400 0x400>; interrupts = <19 0>, <20 0>, <21 0>, <22 0>; interrupt-names = "TX", "RX0", "RX1", "SCE"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; //RCC_APB1ENR1_CAN1EN + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; //RCC_APB1ENR1_CAN1EN status = "disabled"; }; @@ -69,7 +69,7 @@ ram-size = <1024>; maximum-speed = "full-speed"; phys = <&usb_fs_phy>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x04000000>, + clocks = <&rcc STM32_CLOCK(APB1, 26U)>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; status = "disabled"; }; @@ -77,7 +77,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; diff --git a/dts/arm/st/l4/stm32l433.dtsi b/dts/arm/st/l4/stm32l433.dtsi index c0e1f0e18bee3..040773a644fba 100644 --- a/dts/arm/st/l4/stm32l433.dtsi +++ b/dts/arm/st/l4/stm32l433.dtsi @@ -16,7 +16,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000008>; + clocks = <&rcc STM32_CLOCK(AHB2, 3U)>; }; gpioe: gpio@48001000 { @@ -24,7 +24,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB2, 4U)>; }; }; @@ -34,7 +34,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <33 0>, <34 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -45,7 +45,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <36 5>; status = "disabled"; }; @@ -53,7 +53,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1L, 18U)>; interrupts = <39 0>; status = "disabled"; @@ -62,7 +62,7 @@ sdmmc1: sdmmc@40012800 { compatible = "st,stm32-sdmmc"; reg = <0x40012800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000400>, + clocks = <&rcc STM32_CLOCK(APB2, 10U)>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; interrupts = <49 0>; status = "disabled"; diff --git a/dts/arm/st/l4/stm32l451.dtsi b/dts/arm/st/l4/stm32l451.dtsi index 31d4b2047c537..bdeb4d0bba97c 100644 --- a/dts/arm/st/l4/stm32l451.dtsi +++ b/dts/arm/st/l4/stm32l451.dtsi @@ -26,7 +26,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000008>; + clocks = <&rcc STM32_CLOCK(AHB2, 3U)>; }; gpioe: gpio@48001000 { @@ -34,12 +34,12 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB2, 4U)>; }; }; rng: rng@50060800 { - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00040000>, + clocks = <&rcc STM32_CLOCK(AHB2, 18U)>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; }; @@ -49,7 +49,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <33 0>, <34 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -61,7 +61,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40008400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1_2, 1U)>; interrupts = <83 0>, <84 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -72,7 +72,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <36 5>; status = "disabled"; }; @@ -82,7 +82,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <51 5>; status = "disabled"; }; @@ -90,7 +90,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1L, 18U)>; interrupts = <39 0>; status = "disabled"; @@ -99,7 +99,7 @@ uart4: serial@40004c00 { compatible = "st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1L, 19U)>; interrupts = <52 0>; status = "disabled"; @@ -108,7 +108,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1L, 1U)>; interrupts = <29 0>; interrupt-names = "global"; @@ -130,7 +130,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -140,14 +140,14 @@ reg = <0x40006400 0x400>; interrupts = <19 0>, <20 0>, <21 0>, <22 0>; interrupt-names = "TX", "RX0", "RX1", "SCE"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; //RCC_APB1ENR1_CAN1EN + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; //RCC_APB1ENR1_CAN1EN status = "disabled"; }; sdmmc1: sdmmc@40012800 { compatible = "st,stm32-sdmmc"; reg = <0x40012800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000400>, + clocks = <&rcc STM32_CLOCK(APB2, 10U)>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; resets = <&rctl STM32_RESET(APB2, 10U)>; interrupts = <49 0>; diff --git a/dts/arm/st/l4/stm32l452.dtsi b/dts/arm/st/l4/stm32l452.dtsi index 5aef40ca59aa7..9dfb59d7486ab 100644 --- a/dts/arm/st/l4/stm32l452.dtsi +++ b/dts/arm/st/l4/stm32l452.dtsi @@ -19,7 +19,7 @@ ram-size = <1024>; maximum-speed = "full-speed"; phys = <&usb_fs_phy>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x04000000>, + clocks = <&rcc STM32_CLOCK(APB1, 26U)>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; status = "disabled"; }; diff --git a/dts/arm/st/l4/stm32l462.dtsi b/dts/arm/st/l4/stm32l462.dtsi index 40093d76f7e22..c81b19567b85a 100644 --- a/dts/arm/st/l4/stm32l462.dtsi +++ b/dts/arm/st/l4/stm32l462.dtsi @@ -13,7 +13,7 @@ aes: aes@50060000 { compatible = "st,stm32l4-aes", "st,stm32-aes"; reg = <0x50060000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(AHB2, 16U)>; resets = <&rctl STM32_RESET(AHB2, 16U)>; interrupts = <79 0>; interrupt-names = "aes"; diff --git a/dts/arm/st/l4/stm32l471.dtsi b/dts/arm/st/l4/stm32l471.dtsi index 11cf6d1f3598f..208d8c6af6b4d 100644 --- a/dts/arm/st/l4/stm32l471.dtsi +++ b/dts/arm/st/l4/stm32l471.dtsi @@ -17,7 +17,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000008>; + clocks = <&rcc STM32_CLOCK(AHB2, 3U)>; }; gpioe: gpio@48001000 { @@ -25,7 +25,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB2, 4U)>; }; gpiof: gpio@48001400 { @@ -33,7 +33,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB2, 5U)>; }; gpiog: gpio@48001800 { @@ -41,14 +41,14 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48001800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000040>; + clocks = <&rcc STM32_CLOCK(AHB2, 6U)>; }; }; usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1L, 18U)>; interrupts = <39 0>; status = "disabled"; @@ -57,7 +57,7 @@ uart4: serial@40004c00 { compatible = "st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1L, 19U)>; interrupts = <52 0>; status = "disabled"; @@ -66,7 +66,7 @@ uart5: serial@40005000 { compatible = "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1L, 20U)>; interrupts = <53 0>; status = "disabled"; @@ -78,7 +78,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <33 0>, <34 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -89,7 +89,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <36 5>; status = "disabled"; }; @@ -99,7 +99,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <51 5>; status = "disabled"; }; @@ -107,7 +107,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1L, 1U)>; interrupts = <29 0>; interrupt-names = "global"; @@ -129,7 +129,7 @@ timers4: timers@40000800 { compatible = "st,stm32-timers"; reg = <0x40000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB1, 2U)>; resets = <&rctl STM32_RESET(APB1L, 2U)>; interrupts = <30 0>; interrupt-names = "global"; @@ -151,7 +151,7 @@ timers5: timers@40000c00 { compatible = "st,stm32-timers"; reg = <0x40000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB1, 3U)>; resets = <&rctl STM32_RESET(APB1L, 3U)>; interrupts = <50 0>; interrupt-names = "global"; @@ -173,7 +173,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1L, 5U)>; interrupts = <55 0>; interrupt-names = "global"; @@ -189,7 +189,7 @@ timers8: timers@40013400 { compatible = "st,stm32-timers"; reg = <0x40013400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(APB2, 13U)>; resets = <&rctl STM32_RESET(APB2, 13U)>; interrupts = <43 0>, <44 0>, <45 0>, <46 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -206,7 +206,7 @@ timers17: timers@40014800 { compatible = "st,stm32-timers"; reg = <0x40014800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB2, 18U)>; resets = <&rctl STM32_RESET(APB2, 18U)>; interrupts = <26 0>; interrupt-names = "global"; @@ -230,14 +230,14 @@ reg = <0x40006400 0x400>; interrupts = <19 0>, <20 0>, <21 0>, <22 0>; interrupt-names = "TX", "RX0", "RX1", "SCE"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; //RCC_APB1ENR1_CAN1EN + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; //RCC_APB1ENR1_CAN1EN status = "disabled"; }; sdmmc1: sdmmc@40012800 { compatible = "st,stm32-sdmmc"; reg = <0x40012800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000400>, + clocks = <&rcc STM32_CLOCK(APB2, 10U)>, <&rcc STM32_SRC_MSI CLK48_SEL(3)>; resets = <&rctl STM32_RESET(APB2, 10U)>; interrupts = <49 0>; @@ -247,7 +247,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -255,7 +255,7 @@ adc3: adc@50040200 { compatible = "st,stm32-adc"; reg = <0x50040200 0x100>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(AHB2, 13U)>; interrupts = <47 0>; status = "disabled"; #io-channel-cells = <1>; diff --git a/dts/arm/st/l4/stm32l475.dtsi b/dts/arm/st/l4/stm32l475.dtsi index 61edb39ceac38..cc76a34a14bf8 100644 --- a/dts/arm/st/l4/stm32l475.dtsi +++ b/dts/arm/st/l4/stm32l475.dtsi @@ -19,7 +19,7 @@ ram-size = <1280>; maximum-speed = "full-speed"; phys = <&otgfs_phy>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00001000>, + clocks = <&rcc STM32_CLOCK(AHB2, 12U)>, <&rcc STM32_SRC_MSI CLK48_SEL(3)>; status = "disabled"; }; diff --git a/dts/arm/st/l4/stm32l486.dtsi b/dts/arm/st/l4/stm32l486.dtsi index 2851b6a37c1c7..223f1583073fb 100644 --- a/dts/arm/st/l4/stm32l486.dtsi +++ b/dts/arm/st/l4/stm32l486.dtsi @@ -13,7 +13,7 @@ aes: aes@50060000 { compatible = "st,stm32l4-aes", "st,stm32-aes"; reg = <0x50060000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(AHB2, 16U)>; resets = <&rctl STM32_RESET(AHB2, 16U)>; interrupts = <79 0>; interrupt-names = "aes"; diff --git a/dts/arm/st/l4/stm32l496.dtsi b/dts/arm/st/l4/stm32l496.dtsi index 8416fe6a192c9..58cbeca390013 100644 --- a/dts/arm/st/l4/stm32l496.dtsi +++ b/dts/arm/st/l4/stm32l496.dtsi @@ -21,7 +21,7 @@ compatible = "st,stm32l496", "st,stm32l4", "simple-bus"; rng: rng@50060800 { - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00040000>, + clocks = <&rcc STM32_CLOCK(AHB2, 18U)>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; }; @@ -31,7 +31,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40008400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1_2, 1U)>; interrupts = <83 0>, <84 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -46,7 +46,7 @@ #gpio-cells = <2>; ngpios = <12>; reg = <0x48002000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000100>; + clocks = <&rcc STM32_CLOCK(AHB2, 8U)>; }; }; @@ -55,18 +55,18 @@ reg = <0x40006800 0x400>; interrupts = <86 0>, <87 0>, <88 0>, <89 0>; interrupt-names = "TX", "RX0", "RX1", "SCE"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x04000000>; //RCC_APB1ENR1_CAN2EN + clocks = <&rcc STM32_CLOCK(APB1, 26U)>; //RCC_APB1ENR1_CAN2EN master-can-reg = <0x40006400>; status = "disabled"; }; usbotg_fs: otgfs@50000000 { - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00001000>, + clocks = <&rcc STM32_CLOCK(AHB2, 12U)>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; }; sdmmc1: sdmmc@40012800 { - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000400>, + clocks = <&rcc STM32_CLOCK(APB2, 10U)>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; }; }; diff --git a/dts/arm/st/l4/stm32l4a6.dtsi b/dts/arm/st/l4/stm32l4a6.dtsi index 49e9f838219e1..369f7f04bda0f 100644 --- a/dts/arm/st/l4/stm32l4a6.dtsi +++ b/dts/arm/st/l4/stm32l4a6.dtsi @@ -13,7 +13,7 @@ aes: aes@50060000 { compatible = "st,stm32l4-aes", "st,stm32-aes"; reg = <0x50060000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(AHB2, 16U)>; resets = <&rctl STM32_RESET(AHB2, 16U)>; interrupts = <79 0>; interrupt-names = "aes"; diff --git a/dts/arm/st/l4/stm32l4p5.dtsi b/dts/arm/st/l4/stm32l4p5.dtsi index d8d67db5d48d2..2fae89a6a1ef1 100644 --- a/dts/arm/st/l4/stm32l4p5.dtsi +++ b/dts/arm/st/l4/stm32l4p5.dtsi @@ -39,7 +39,7 @@ }; rng: rng@50060800 { - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00040000>, + clocks = <&rcc STM32_CLOCK(AHB2, 18U)>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; }; @@ -51,7 +51,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000008>; + clocks = <&rcc STM32_CLOCK(AHB2, 3U)>; }; gpioe: gpio@48001000 { @@ -59,7 +59,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB2, 4U)>; }; gpiof: gpio@48001400 { @@ -67,7 +67,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB2, 5U)>; }; gpiog: gpio@48001800 { @@ -75,7 +75,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48001800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000040>; + clocks = <&rcc STM32_CLOCK(AHB2, 6U)>; }; gpioi: gpio@48002000 { @@ -83,14 +83,14 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48002000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000100>; + clocks = <&rcc STM32_CLOCK(AHB2, 8U)>; }; }; usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1L, 18U)>; interrupts = <39 0>; status = "disabled"; @@ -99,7 +99,7 @@ uart4: serial@40004c00 { compatible = "st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1L, 19U)>; interrupts = <52 0>; status = "disabled"; @@ -108,7 +108,7 @@ uart5: serial@40005000 { compatible = "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1L, 20U)>; interrupts = <53 0>; status = "disabled"; @@ -120,7 +120,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <33 0>, <34 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -132,7 +132,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40008400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1_2, 1U)>; interrupts = <84 0>, <83 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -143,7 +143,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; interrupts = <36 5>; status = "disabled"; }; @@ -153,7 +153,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40003c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; interrupts = <51 5>; status = "disabled"; }; @@ -161,7 +161,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1L, 1U)>; interrupts = <29 0>; interrupt-names = "global"; @@ -183,7 +183,7 @@ timers4: timers@40000800 { compatible = "st,stm32-timers"; reg = <0x40000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB1, 2U)>; resets = <&rctl STM32_RESET(APB1L, 2U)>; interrupts = <30 0>; interrupt-names = "global"; @@ -205,7 +205,7 @@ timers5: timers@40000c00 { compatible = "st,stm32-timers"; reg = <0x40000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB1, 3U)>; resets = <&rctl STM32_RESET(APB1L, 3U)>; interrupts = <50 0>; interrupt-names = "global"; @@ -227,7 +227,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1L, 5U)>; interrupts = <55 0>; interrupt-names = "global"; @@ -249,7 +249,7 @@ timers8: timers@40013400 { compatible = "st,stm32-timers"; reg = <0x40013400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(APB2, 13U)>; resets = <&rctl STM32_RESET(APB2, 13U)>; interrupts = <43 0>, <44 0>, <45 0>, <46 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -266,7 +266,7 @@ timers17: timers@40014800 { compatible = "st,stm32-timers"; reg = <0x40014800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB2, 18U)>; resets = <&rctl STM32_RESET(APB2, 18U)>; interrupts = <26 0>; interrupt-names = "global"; @@ -290,7 +290,7 @@ reg = <0x40006400 0x400>; interrupts = <19 0>, <20 0>, <21 0>, <22 0>; interrupt-names = "TX", "RX0", "RX1", "SCE"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; //RCC_APB1ENR1_CAN1EN + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; //RCC_APB1ENR1_CAN1EN status = "disabled"; }; @@ -302,7 +302,7 @@ num-bidir-endpoints = <6>; ram-size = <1280>; maximum-speed = "full-speed"; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00001000>, + clocks = <&rcc STM32_CLOCK(AHB2, 12U)>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; phys = <&otgfs_phy>; status = "disabled"; @@ -321,7 +321,7 @@ #dma-cells = <3>; reg = <0x40020800 0x400>; interrupts = <94 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x4>; + clocks = <&rcc STM32_CLOCK(AHB1, 2U)>; dma-channels = <14>; dma-generators = <4>; dma-requests= <89>; @@ -331,7 +331,7 @@ sdmmc1: sdmmc@50062400 { compatible = "st,stm32-sdmmc"; reg = <0x50062400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x400000>, + clocks = <&rcc STM32_CLOCK(AHB2, 22U)>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; resets = <&rctl STM32_RESET(AHB2, 22U)>; interrupts = <49 0>; @@ -341,7 +341,7 @@ sdmmc2: sdmmc@50062800 { compatible = "st,stm32-sdmmc"; reg = <0x50062800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x800000>, + clocks = <&rcc STM32_CLOCK(AHB2, 23U)>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; resets = <&rctl STM32_RESET(AHB2, 23U)>; interrupts = <47 0>; @@ -351,7 +351,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -361,9 +361,9 @@ reg = <0xa0001000 0x400>; interrupts = <71 0>; clock-names = "ospix", "ospi-ker", "ospi-mgr"; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00000100>, + clocks = <&rcc STM32_CLOCK(AHB3, 8U)>, <&rcc STM32_SRC_SYSCLK OSPI_SEL(0)>, - <&rcc STM32_CLOCK_BUS_AHB2 0x00100000>; + <&rcc STM32_CLOCK(AHB2, 20U)>; #address-cells = <1>; #size-cells = <0>; @@ -375,9 +375,9 @@ reg = <0xa0001400 0x400>; interrupts = <76 0>; clock-names = "ospix", "ospi-ker", "ospi-mgr"; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00000200>, + clocks = <&rcc STM32_CLOCK(AHB3, 9U)>, <&rcc STM32_SRC_SYSCLK OSPI_SEL(0)>, - <&rcc STM32_CLOCK_BUS_AHB2 0x00100000>; + <&rcc STM32_CLOCK(AHB2, 20U)>; #address-cells = <1>; #size-cells = <0>; diff --git a/dts/arm/st/l4/stm32l4q5.dtsi b/dts/arm/st/l4/stm32l4q5.dtsi index 725a26b46a9a1..cc6191afb7f62 100644 --- a/dts/arm/st/l4/stm32l4q5.dtsi +++ b/dts/arm/st/l4/stm32l4q5.dtsi @@ -13,7 +13,7 @@ aes: aes@50060000 { compatible = "st,stm32l4-aes", "st,stm32-aes"; reg = <0x50060000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(AHB2, 16U)>; resets = <&rctl STM32_RESET(AHB2, 16U)>; interrupts = <79 0>; interrupt-names = "aes"; diff --git a/dts/arm/st/l4/stm32l4r9.dtsi b/dts/arm/st/l4/stm32l4r9.dtsi index 20b47a0402d08..db067f754e200 100644 --- a/dts/arm/st/l4/stm32l4r9.dtsi +++ b/dts/arm/st/l4/stm32l4r9.dtsi @@ -17,7 +17,7 @@ reg = <0x40016800 0x200>; interrupts = <91 0>, <92 0>; interrupt-names = "ltdc", "ltdc_er"; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x04000000>; + clocks = <&rcc STM32_CLOCK(APB2, 26U)>; resets = <&rctl STM32_RESET(APB2, 26U)>; status = "disabled"; }; diff --git a/dts/arm/st/l4/stm32l4s5.dtsi b/dts/arm/st/l4/stm32l4s5.dtsi index 623ef46fd1c14..04ae65b6cbf89 100644 --- a/dts/arm/st/l4/stm32l4s5.dtsi +++ b/dts/arm/st/l4/stm32l4s5.dtsi @@ -13,7 +13,7 @@ aes: aes@50060000 { compatible = "st,stm32l4-aes", "st,stm32-aes"; reg = <0x50060000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(AHB2, 16U)>; resets = <&rctl STM32_RESET(AHB2, 16U)>; interrupts = <79 0>; interrupt-names = "aes"; diff --git a/dts/arm/st/l5/stm32l5.dtsi b/dts/arm/st/l5/stm32l5.dtsi index c4cf89a968b0e..07c68b12fffa9 100644 --- a/dts/arm/st/l5/stm32l5.dtsi +++ b/dts/arm/st/l5/stm32l5.dtsi @@ -125,7 +125,7 @@ compatible = "st,stm32-flash-controller", "st,stm32l5-flash-controller"; reg = <0x40022000 0x400>; interrupts = <6 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00000100>; + clocks = <&rcc STM32_CLOCK(AHB1, 8U)>; #address-cells = <1>; #size-cells = <1>; @@ -187,7 +187,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42020000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB2, 0U)>; }; gpiob: gpio@42020400 { @@ -195,7 +195,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42020400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000002>; + clocks = <&rcc STM32_CLOCK(AHB2, 1U)>; }; gpioc: gpio@42020800 { @@ -203,7 +203,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42020800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000004>; + clocks = <&rcc STM32_CLOCK(AHB2, 2U)>; }; gpiod: gpio@42020c00 { @@ -211,7 +211,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42020c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000008>; + clocks = <&rcc STM32_CLOCK(AHB2, 3U)>; }; gpioe: gpio@42021000 { @@ -219,7 +219,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42021000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB2, 4U)>; }; gpiof: gpio@42021400 { @@ -227,7 +227,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42021400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB2, 5U)>; }; gpiog: gpio@42021800 { @@ -235,7 +235,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42021800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000040>; + clocks = <&rcc STM32_CLOCK(AHB2, 6U)>; }; gpioh: gpio@42021c00 { @@ -243,7 +243,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42021c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000080>; + clocks = <&rcc STM32_CLOCK(AHB2, 7U)>; }; }; @@ -256,7 +256,7 @@ wwdg: watchdog@40002c00 { compatible = "st,stm32-window-watchdog"; reg = <0x40002C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <0 6>; status = "disabled"; }; @@ -264,7 +264,7 @@ usart1: serial@40013800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40013800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB2, 14U)>; resets = <&rctl STM32_RESET(APB2, 14U)>; interrupts = <61 0>; status = "disabled"; @@ -273,7 +273,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1L, 17U)>; interrupts = <62 0>; status = "disabled"; @@ -282,7 +282,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1L, 18U)>; interrupts = <63 0>; status = "disabled"; @@ -291,7 +291,7 @@ uart4: serial@40004c00 { compatible = "st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1L, 19U)>; interrupts = <64 0>; status = "disabled"; @@ -300,7 +300,7 @@ uart5: serial@40005000 { compatible = "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1L, 20U)>; interrupts = <65 0>; status = "disabled"; @@ -309,7 +309,7 @@ lpuart1: serial@40008000 { compatible = "st,stm32-lpuart", "st,stm32-uart"; reg = <0x40008000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1_2, 0U)>; resets = <&rctl STM32_RESET(APB1H, 0U)>; interrupts = <66 0>; status = "disabled"; @@ -317,7 +317,7 @@ lptim1: timers@40007c00 { compatible = "st,stm32-lptim"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>; + clocks = <&rcc STM32_CLOCK(APB1, 31U)>; #address-cells = <1>; #size-cells = <0>; reg = <0x40007c00 0x400>; @@ -331,7 +331,7 @@ #dma-cells = <3>; reg = <0x40020000 0x400>; interrupts = <29 0 30 0 31 0 32 0 33 0 34 0 35 0 36 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x1>; + clocks = <&rcc STM32_CLOCK(AHB1, 0U)>; dma-requests = <8>; dma-offset = <0>; status = "disabled"; @@ -342,7 +342,7 @@ #dma-cells = <3>; reg = <0x40020400 0x400>; interrupts = <80 0 81 0 82 0 83 0 84 0 85 0 86 0 87 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x2>; + clocks = <&rcc STM32_CLOCK(AHB1, 1U)>; dma-requests = <8>; dma-offset = <8>; status = "disabled"; @@ -353,7 +353,7 @@ #dma-cells = <3>; reg = <0x40020800 0x400>; interrupts = <27 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x4>; + clocks = <&rcc STM32_CLOCK(AHB1, 2U)>; dma-channels = <16>; dma-generators = <4>; dma-requests= <90>; @@ -366,7 +366,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB1, 21U)>; interrupts = <55 0>, <56 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -378,7 +378,7 @@ #size-cells = <0>; clock-frequency = ; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <57 0>, <58 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -390,14 +390,14 @@ #size-cells = <0>; reg = <0x40013000 0x400>; interrupts = <59 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB2, 12U)>; status = "disabled"; }; sdmmc1: sdmmc@420c8000 { compatible = "st,stm32-sdmmc"; reg = <0x420c8000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00400000>, + clocks = <&rcc STM32_CLOCK(AHB2, 22U)>, <&rcc STM32_SRC_HSI48 SDMMC_SEL(0)>; resets = <&rctl STM32_RESET(AHB2, 22U)>; interrupts = <78 0>; @@ -407,7 +407,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -418,7 +418,7 @@ #size-cells = <0>; reg = <0x40003800 0x400>; interrupts = <60 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; status = "disabled"; }; @@ -428,7 +428,7 @@ #size-cells = <0>; reg = <0x40003c00 0x400>; interrupts = <99 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; status = "disabled"; }; @@ -437,7 +437,7 @@ reg = <0x44021000 0x400>; interrupts = <76 0>; clock-names = "ospix", "ospi-ker"; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00000100>, + clocks = <&rcc STM32_CLOCK(AHB3, 8U)>, <&rcc STM32_SRC_SYSCLK OSPI_SEL(0)>; #address-cells = <1>; #size-cells = <0>; @@ -448,7 +448,7 @@ compatible = "st,stm32-rng"; reg = <0x420c0800 0x400>; interrupts = <94 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00040000>; + clocks = <&rcc STM32_CLOCK(AHB2, 18U)>; nist-config = <0xf00d00>; health-test-magic = <0x17590abc>; health-test-config = <0xa2b3>; @@ -459,7 +459,7 @@ compatible = "st,stm32-rtc"; reg = <0x40002800 0x400>; interrupts = <2 0>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000400>; + clocks = <&rcc STM32_CLOCK(APB1, 10U)>; prescaler = <32768>; alarms-count = <2>; alrm-exti-line = <17>; @@ -469,7 +469,7 @@ timers1: timers@40012c00 { compatible = "st,stm32-timers"; reg = <0x40012c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB2, 11U)>; resets = <&rctl STM32_RESET(APB2, 11U)>; interrupts = <41 0>, <42 0>, <43 0>, <44 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -486,7 +486,7 @@ timers2: timers@40000000 { compatible = "st,stm32-timers"; reg = <0x40000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1, 0U)>; resets = <&rctl STM32_RESET(APB1L, 0U)>; interrupts = <45 0>; interrupt-names = "global"; @@ -508,7 +508,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1L, 1U)>; interrupts = <46 0>; interrupt-names = "global"; @@ -530,7 +530,7 @@ timers4: timers@40000800 { compatible = "st,stm32-timers"; reg = <0x40000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB1, 2U)>; resets = <&rctl STM32_RESET(APB1L, 2U)>; interrupts = <47 0>; interrupt-names = "global"; @@ -552,7 +552,7 @@ timers5: timers@40000c00 { compatible = "st,stm32-timers"; reg = <0x40000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB1, 3U)>; resets = <&rctl STM32_RESET(APB1L, 3U)>; interrupts = <48 0>; interrupt-names = "global"; @@ -574,7 +574,7 @@ timers8: timers@40013400 { compatible = "st,stm32-timers"; reg = <0x40013400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(APB2, 13U)>; resets = <&rctl STM32_RESET(APB2, 13U)>; interrupts = <51 0>, <52 0>, <53 0>, <54 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -591,7 +591,7 @@ timers15: timers@40014000 { compatible = "st,stm32-timers"; reg = <0x40014000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(APB2, 16U)>; resets = <&rctl STM32_RESET(APB2, 16U)>; interrupts = <69 0>; interrupt-names = "global"; @@ -613,7 +613,7 @@ timers16: timers@40014400 { compatible = "st,stm32-timers"; reg = <0x40014400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB2, 17U)>; resets = <&rctl STM32_RESET(APB2, 17U)>; interrupts = <70 0>; interrupt-names = "global"; @@ -635,7 +635,7 @@ timers17: timers@40014800 { compatible = "st,stm32-timers"; reg = <0x40014800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB2, 18U)>; resets = <&rctl STM32_RESET(APB2, 18U)>; interrupts = <71 0>; interrupt-names = "global"; @@ -657,7 +657,7 @@ adc1: adc@42028000 { compatible = "st,stm32-adc"; reg = <0x42028000 0x100>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(AHB2, 13U)>; interrupts = <37 0>; status = "disabled"; #io-channel-cells = <1>; @@ -672,7 +672,7 @@ adc2: adc@42028100 { compatible = "st,stm32-adc"; reg = <0x42028100 0x100>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(AHB2, 13U)>; interrupts = <37 0>; status = "disabled"; #io-channel-cells = <1>; @@ -692,7 +692,7 @@ num-bidir-endpoints = <8>; ram-size = <1024>; status = "disabled"; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00200000>, + clocks = <&rcc STM32_CLOCK(APB1_2, 21U)>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; phys = <&usb_fs_phy>; }; @@ -700,7 +700,7 @@ ucpd1: ucpd@4000dc00 { compatible = "st,stm32-ucpd"; reg = <0x4000dc00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>; + clocks = <&rcc STM32_CLOCK(APB1, 23U)>; interrupts = <106 0>; status = "disabled"; }; @@ -708,7 +708,7 @@ fmc: fmc@44020000 { compatible = "st,stm32-fmc"; reg = <0x44020000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB3, 0U)>; status = "disabled"; }; }; diff --git a/dts/arm/st/l5/stm32l562.dtsi b/dts/arm/st/l5/stm32l562.dtsi index efe4c8a570bf8..35c36715f25ea 100644 --- a/dts/arm/st/l5/stm32l562.dtsi +++ b/dts/arm/st/l5/stm32l562.dtsi @@ -13,7 +13,7 @@ aes: aes@420c0000 { compatible = "st,stm32-aes"; reg = <0x420c0000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(AHB2, 16U)>; resets = <&rctl STM32_RESET(AHB2, 16U)>; interrupts = <93 0>; status = "disabled"; diff --git a/dts/arm/st/mp1/stm32mp157.dtsi b/dts/arm/st/mp1/stm32mp157.dtsi index 392e475addf6d..0d22f356422cd 100644 --- a/dts/arm/st/mp1/stm32mp157.dtsi +++ b/dts/arm/st/mp1/stm32mp157.dtsi @@ -86,7 +86,7 @@ reg = <0x50002000 0x400>; gpio-controller; #gpio-cells = <2>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB4, 0U)>; }; gpiob: gpio@50003000 { @@ -94,7 +94,7 @@ reg = <0x50003000 0x400>; gpio-controller; #gpio-cells = <2>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000002>; + clocks = <&rcc STM32_CLOCK(AHB4, 1U)>; }; gpioc: gpio@50004000 { @@ -102,7 +102,7 @@ reg = <0x50004000 0x400>; gpio-controller; #gpio-cells = <2>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000004>; + clocks = <&rcc STM32_CLOCK(AHB4, 2U)>; }; gpiod: gpio@50005000 { @@ -110,7 +110,7 @@ reg = <0x50005000 0x400>; gpio-controller; #gpio-cells = <2>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000008>; + clocks = <&rcc STM32_CLOCK(AHB4, 3U)>; }; gpioe: gpio@50006000 { @@ -118,7 +118,7 @@ reg = <0x50006000 0x400>; gpio-controller; #gpio-cells = <2>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB4, 4U)>; }; gpiof: gpio@50007000 { @@ -126,7 +126,7 @@ reg = <0x50007000 0x400>; gpio-controller; #gpio-cells = <2>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB4, 5U)>; }; gpiog: gpio@50008000 { @@ -134,7 +134,7 @@ reg = <0x50008000 0x400>; gpio-controller; #gpio-cells = <2>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000040>; + clocks = <&rcc STM32_CLOCK(AHB4, 6U)>; }; gpioh: gpio@50009000 { @@ -142,7 +142,7 @@ reg = <0x50009000 0x400>; gpio-controller; #gpio-cells = <2>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000080>; + clocks = <&rcc STM32_CLOCK(AHB4, 7U)>; }; gpioi: gpio@5000a000 { @@ -150,7 +150,7 @@ reg = <0x5000a000 0x400>; gpio-controller; #gpio-cells = <2>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000100>; + clocks = <&rcc STM32_CLOCK(AHB4, 8U)>; }; gpioj: gpio@5000b000 { @@ -158,7 +158,7 @@ reg = <0x5000b000 0x400>; gpio-controller; #gpio-cells = <2>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000200>; + clocks = <&rcc STM32_CLOCK(AHB4, 9U)>; }; gpiok: gpio@5000c000 { @@ -166,14 +166,14 @@ reg = <0x5000c000 0x400>; gpio-controller; #gpio-cells = <2>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000400>; + clocks = <&rcc STM32_CLOCK(AHB4, 10U)>; }; }; wwdg: wwdg1: watchdog@4000a000 { compatible = "st,stm32-window-watchdog"; reg = <0x4000a000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <0 7>; status = "disabled"; }; @@ -182,7 +182,7 @@ compatible = "st,stm32-dma-v1"; #dma-cells = <4>; reg = <0x48000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x1>; + clocks = <&rcc STM32_CLOCK(AHB2, 0U)>; interrupts = <11 0 12 0 13 0 14 0 15 0 16 0 17 0 47 0>; dma-offset = <0>; dma-requests = <8>; @@ -193,7 +193,7 @@ compatible = "st,stm32-dma-v1"; #dma-cells = <4>; reg = <0x48001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x2>; + clocks = <&rcc STM32_CLOCK(AHB2, 1U)>; interrupts = <56 0 57 0 58 0 59 0 60 0 68 0 69 0 70 0>; dma-offset = <8>; dma-requests = <8>; @@ -204,7 +204,7 @@ compatible = "st,stm32-dmamux"; #dma-cells = <3>; reg = <0x48002000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x4>; + clocks = <&rcc STM32_CLOCK(AHB2, 2U)>; interrupts = <102 0>; dma-channels = <16>; dma-generators = <8>; @@ -217,7 +217,7 @@ reg = <0x44004000 0x400>; #address-cells = <1>; #size-cells = <0>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x100>; + clocks = <&rcc STM32_CLOCK(APB2, 8U)>; interrupts = <35 5>; status = "disabled"; }; @@ -227,7 +227,7 @@ reg = <0x4000b000 0x400>; #address-cells = <1>; #size-cells = <0>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <36 5>; status = "disabled"; }; @@ -237,7 +237,7 @@ reg = <0x4000c000 0x400>; #address-cells = <1>; #size-cells = <0>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x1000>; + clocks = <&rcc STM32_CLOCK(APB1, 12U)>; interrupts = <51 5>; status = "disabled"; }; @@ -247,7 +247,7 @@ reg = <0x44005000 0x400>; #address-cells = <1>; #size-cells = <0>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x200>; + clocks = <&rcc STM32_CLOCK(APB2, 9U)>; interrupts = <84 5>; status = "disabled"; }; @@ -257,7 +257,7 @@ reg = <0x44009000 0x400>; #address-cells = <1>; #size-cells = <0>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x400>; + clocks = <&rcc STM32_CLOCK(APB2, 10U)>; interrupts = <85 5>; status = "disabled"; }; @@ -265,7 +265,7 @@ usart2: serial@4000e000 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x4000e000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; resets = <&rctl STM32_RESET(APB1, 14U)>; interrupts = <38 0>; status = "disabled"; @@ -274,7 +274,7 @@ usart3: serial@4000f000 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x4000f000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00008000>; + clocks = <&rcc STM32_CLOCK(APB1, 15U)>; resets = <&rctl STM32_RESET(APB1, 15U)>; interrupts = <39 0>; status = "disabled"; @@ -283,7 +283,7 @@ uart4: serial@40010000 { compatible = "st,stm32-uart"; reg = <0x40010000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00010000>; + clocks = <&rcc STM32_CLOCK(APB1, 16U)>; resets = <&rctl STM32_RESET(APB1, 16U)>; interrupts = <52 0>; status = "disabled"; @@ -292,7 +292,7 @@ uart5: serial@40011000 { compatible = "st,stm32-uart"; reg = <0x40011000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1, 17U)>; interrupts = <53 0>; status = "disabled"; @@ -301,7 +301,7 @@ usart6: serial@44003000 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x44003000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(APB2, 13U)>; resets = <&rctl STM32_RESET(APB2, 13U)>; interrupts = <71 0>; status = "disabled"; @@ -310,7 +310,7 @@ uart7: serial@40018000 { compatible = "st,stm32-uart"; reg = <0x40018000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1, 18U)>; interrupts = <82 0>; status = "disabled"; @@ -319,7 +319,7 @@ uart8: serial@40019000 { compatible = "st,stm32-uart"; reg = <0x40019000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1, 19U)>; interrupts = <83 0>; status = "disabled"; @@ -331,7 +331,7 @@ reg = <0x40015000 0x400>; #address-cells = <1>; #size-cells = <0>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x01000000>; + clocks = <&rcc STM32_CLOCK(APB1, 24U)>; interrupt-names = "event", "error"; interrupts = <107 0>, <108 0>; status = "disabled"; @@ -340,7 +340,7 @@ timers3: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1, 1U)>; interrupts = <29 0>; interrupt-names = "global"; @@ -362,7 +362,7 @@ timers5: timers@40003000 { compatible = "st,stm32-timers"; reg = <0x40003000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB1, 3U)>; resets = <&rctl STM32_RESET(APB1, 3U)>; interrupts = <50 0>; interrupt-names = "global"; @@ -384,7 +384,7 @@ mailbox: mailbox@4c001000 { compatible = "st,stm32-ipcc-mailbox"; reg = <0x4c001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00001000>; + clocks = <&rcc STM32_CLOCK(AHB3, 12U)>; interrupts = <103 0>, <104 0>; interrupt-names = "rxo", "txf"; status = "disabled"; @@ -395,7 +395,7 @@ reg = <0x5a001000 0x200>; interrupts = <88 0>, <89 0>; interrupt-names = "ltdc", "ltdc_er"; - clocks = <&rcc STM32_CLOCK_BUS_APB4 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB4, 0U)>; resets = <&rctl STM32_RESET(APB4, 26U)>; status = "disabled"; }; diff --git a/dts/arm/st/u0/stm32u0.dtsi b/dts/arm/st/u0/stm32u0.dtsi index 25359e41104be..62edce08afb1b 100644 --- a/dts/arm/st/u0/stm32u0.dtsi +++ b/dts/arm/st/u0/stm32u0.dtsi @@ -142,7 +142,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000001>; + clocks = <&rcc STM32_CLOCK(IOP, 0U)>; }; gpiob: gpio@50000400 { @@ -150,7 +150,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000002>; + clocks = <&rcc STM32_CLOCK(IOP, 1U)>; }; gpioc: gpio@50000800 { @@ -158,7 +158,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000004>; + clocks = <&rcc STM32_CLOCK(IOP, 2U)>; }; gpiod: gpio@50000C00 { @@ -166,7 +166,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50000C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000008>; + clocks = <&rcc STM32_CLOCK(IOP, 3U)>; }; gpioe: gpio@50001000 { @@ -174,7 +174,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000010>; + clocks = <&rcc STM32_CLOCK(IOP, 4U)>; }; gpiof: gpio@50001400 { @@ -182,14 +182,14 @@ gpio-controller; #gpio-cells = <2>; reg = <0x50001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_IOP 0x00000020>; + clocks = <&rcc STM32_CLOCK(IOP, 5U)>; }; }; usart1: serial@40013800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40013800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1_2, 14U)>; resets = <&rctl STM32_RESET(APB1H, 14U)>; interrupts = <27 0>; status = "disabled"; @@ -198,7 +198,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1L, 17U)>; interrupts = <28 0>; status = "disabled"; @@ -207,7 +207,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1L, 18U)>; interrupts = <29 0>; status = "disabled"; @@ -216,7 +216,7 @@ adc1: adc@40012400 { compatible = "st,stm32-adc"; reg = <0x40012400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1_2, 20U)>; interrupts = <12 0>; status = "disabled"; #io-channel-cells = <1>; @@ -232,7 +232,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -243,7 +243,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB1, 21U)>; interrupts = <23 0>; interrupt-names = "combined"; status = "disabled"; @@ -255,7 +255,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <24 0>; interrupt-names = "combined"; status = "disabled"; @@ -267,7 +267,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40008800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>; + clocks = <&rcc STM32_CLOCK(APB1, 23U)>; interrupts = <24 0>; interrupt-names = "combined"; status = "disabled"; @@ -277,7 +277,7 @@ timers1: timers@40012c00 { compatible = "st,stm32-timers"; reg = <0x40012C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1_2, 11U)>; resets = <&rctl STM32_RESET(APB1H, 11U)>; interrupts = <13 0>, <14 0>; interrupt-names = "brk_up_trg_com", "cc"; @@ -299,7 +299,7 @@ timers2: timers@40000000 { compatible = "st,stm32-timers"; reg = <0x40000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1, 0U)>; resets = <&rctl STM32_RESET(APB1L, 0U)>; interrupts = <15 0>; interrupt-names = "global"; @@ -321,7 +321,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1L, 1U)>; interrupts = <16 0>; interrupt-names = "global"; @@ -343,7 +343,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1L, 4U)>; interrupts = <17 0>; interrupt-names = "combined"; @@ -354,7 +354,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1L, 5U)>; interrupts = <18 0>; interrupt-names = "combined"; @@ -365,7 +365,7 @@ timers15: timers@40014000 { compatible = "st,stm32-timers"; reg = <0x40014000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00010000>; + clocks = <&rcc STM32_CLOCK(APB1_2, 16U)>; resets = <&rctl STM32_RESET(APB1H, 16U)>; interrupts = <19 0>; interrupt-names = "combined"; @@ -387,7 +387,7 @@ timers16: timers@40014400 { compatible = "st,stm32-timers"; reg = <0x40014400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1_2, 17U)>; resets = <&rctl STM32_RESET(APB1H, 17U)>; interrupts = <20 0>; interrupt-names = "global"; diff --git a/dts/arm/st/u0/stm32u073.dtsi b/dts/arm/st/u0/stm32u073.dtsi index 0600a598da7dc..35284d536c5e1 100644 --- a/dts/arm/st/u0/stm32u073.dtsi +++ b/dts/arm/st/u0/stm32u073.dtsi @@ -16,7 +16,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x4000a000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; interrupts = <24 0>; interrupt-names = "combined"; status = "disabled"; diff --git a/dts/arm/st/u5/stm32u5.dtsi b/dts/arm/st/u5/stm32u5.dtsi index ced2cbb0723d1..9f694d600a3fd 100644 --- a/dts/arm/st/u5/stm32u5.dtsi +++ b/dts/arm/st/u5/stm32u5.dtsi @@ -218,7 +218,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42020000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB2, 0U)>; }; gpiob: gpio@42020400 { @@ -226,7 +226,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42020400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000002>; + clocks = <&rcc STM32_CLOCK(AHB2, 1U)>; }; gpioc: gpio@42020800 { @@ -234,7 +234,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42020800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000004>; + clocks = <&rcc STM32_CLOCK(AHB2, 2U)>; }; gpiod: gpio@42020c00 { @@ -242,7 +242,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42020c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000008>; + clocks = <&rcc STM32_CLOCK(AHB2, 3U)>; }; gpioe: gpio@42021000 { @@ -250,7 +250,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42021000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB2, 4U)>; }; gpiof: gpio@42021400 { @@ -258,7 +258,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42021400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000020>; + clocks = <&rcc STM32_CLOCK(AHB2, 5U)>; }; gpiog: gpio@42021800 { @@ -266,7 +266,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42021800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000040>; + clocks = <&rcc STM32_CLOCK(AHB2, 6U)>; }; gpioh: gpio@42021c00 { @@ -274,7 +274,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42021c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000080>; + clocks = <&rcc STM32_CLOCK(AHB2, 7U)>; }; gpioi: gpio@42022000 { @@ -282,7 +282,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42022000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000100>; + clocks = <&rcc STM32_CLOCK(AHB2, 8U)>; }; }; @@ -295,7 +295,7 @@ wwdg: wwdg1: watchdog@40002c00 { compatible = "st,stm32-window-watchdog"; reg = <0x40002c00 0x1000>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <0 7>; status = "disabled"; }; @@ -304,7 +304,7 @@ compatible = "zephyr,memory-region", "st,stm32-backup-sram"; reg = <0x40036400 DT_SIZE_K(2)>; /* BKPSRAMEN and RAMCFGEN clock enable */ - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x10020000>; + clocks = <&rcc STM32_CLOCK(AHB1, 28U)>; zephyr,memory-region = "BACKUP_SRAM"; status = "disabled"; }; @@ -312,7 +312,7 @@ usart1: serial@40013800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40013800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB2, 14U)>; resets = <&rctl STM32_RESET(APB2, 14U)>; interrupts = <61 0>; status = "disabled"; @@ -321,7 +321,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1L, 17U)>; interrupts = <62 0>; status = "disabled"; @@ -330,7 +330,7 @@ usart3: serial@40004800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB1, 18U)>; resets = <&rctl STM32_RESET(APB1L, 18U)>; interrupts = <63 0>; status = "disabled"; @@ -339,7 +339,7 @@ uart4: serial@40004c00 { compatible = "st,stm32-uart"; reg = <0x40004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00080000>; + clocks = <&rcc STM32_CLOCK(APB1, 19U)>; resets = <&rctl STM32_RESET(APB1L, 19U)>; interrupts = <64 0>; status = "disabled"; @@ -348,7 +348,7 @@ uart5: serial@40005000 { compatible = "st,stm32-uart"; reg = <0x40005000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00100000>; + clocks = <&rcc STM32_CLOCK(APB1, 20U)>; resets = <&rctl STM32_RESET(APB1L, 20U)>; interrupts = <65 0>; status = "disabled"; @@ -357,7 +357,7 @@ lpuart1: serial@46002400 { compatible = "st,stm32-lpuart", "st,stm32-uart"; reg = <0x46002400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00000040>; + clocks = <&rcc STM32_CLOCK(APB3, 6U)>; resets = <&rctl STM32_RESET(APB3, 6U)>; interrupts = <66 0>; status = "disabled"; @@ -369,7 +369,7 @@ #size-cells = <0>; reg = <0x40013000 0x400>; interrupts = <59 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB2, 12U)>; status = "disabled"; }; @@ -379,7 +379,7 @@ #size-cells = <0>; reg = <0x40003800 0x400>; interrupts = <60 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; status = "disabled"; }; @@ -389,7 +389,7 @@ #size-cells = <0>; reg = <0x46002000 0x400>; interrupts = <99 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB3, 5U)>; status = "disabled"; }; @@ -399,7 +399,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB1, 21U)>; interrupts = <55 0>, <56 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -411,7 +411,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <57 0>, <58 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -423,7 +423,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x46002800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00000080>; + clocks = <&rcc STM32_CLOCK(APB3, 7U)>; interrupts = <88 0>, <89 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -435,7 +435,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40008400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1_2, 1U)>; interrupts = <101 0>, <100 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -446,7 +446,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x46004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB3, 11U)>; interrupts = <67 1>; interrupt-names = "wakeup"; status = "disabled"; @@ -457,7 +457,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40009400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1_2, 5U)>; interrupts = <68 0>; interrupt-names = "global"; status = "disabled"; @@ -468,7 +468,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x46004800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB3, 12U)>; interrupts = <98 0>; interrupt-names = "global"; status = "disabled"; @@ -479,7 +479,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x46004c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00002000>; + clocks = <&rcc STM32_CLOCK(APB3, 13U)>; interrupts = <110 0>; interrupt-names = "global"; status = "disabled"; @@ -489,7 +489,7 @@ compatible = "st,stm32-rtc"; reg = <0x46007800 0x400>; interrupts = <2 0>; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB3, 21U)>; prescaler = <32768>; alarms-count = <2>; status = "disabled"; @@ -498,7 +498,7 @@ timers1: timers@40012c00 { compatible = "st,stm32-timers"; reg = <0x40012c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB2, 11U)>; resets = <&rctl STM32_RESET(APB2, 11U)>; interrupts = <41 0>, <42 0>, <43 0>, <44 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -514,7 +514,7 @@ timers2: timers@40000000 { compatible = "st,stm32-timers"; reg = <0x40000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1, 0U)>; resets = <&rctl STM32_RESET(APB1L, 0U)>; interrupts = <45 0>; interrupt-names = "global"; @@ -530,7 +530,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1L, 1U)>; interrupts = <46 0>; interrupt-names = "global"; @@ -546,7 +546,7 @@ timers4: timers@40000800 { compatible = "st,stm32-timers"; reg = <0x40000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000004>; + clocks = <&rcc STM32_CLOCK(APB1, 2U)>; resets = <&rctl STM32_RESET(APB1L, 2U)>; interrupts = <47 0>; interrupt-names = "global"; @@ -567,7 +567,7 @@ timers5: timers@40000c00 { compatible = "st,stm32-timers"; reg = <0x40000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000008>; + clocks = <&rcc STM32_CLOCK(APB1, 3U)>; resets = <&rctl STM32_RESET(APB1L, 3U)>; interrupts = <48 0>; interrupt-names = "global"; @@ -588,7 +588,7 @@ timers6: timers@40001000 { compatible = "st,stm32-timers"; reg = <0x40001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000010>; + clocks = <&rcc STM32_CLOCK(APB1, 4U)>; resets = <&rctl STM32_RESET(APB1L, 4U)>; interrupts = <49 0>; interrupt-names = "global"; @@ -604,7 +604,7 @@ timers7: timers@40001400 { compatible = "st,stm32-timers"; reg = <0x40001400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1, 5U)>; resets = <&rctl STM32_RESET(APB1L, 5U)>; interrupts = <50 0>; interrupt-names = "global"; @@ -620,7 +620,7 @@ timers8: timers@40013400 { compatible = "st,stm32-timers"; reg = <0x40013400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(APB2, 13U)>; resets = <&rctl STM32_RESET(APB2, 13U)>; interrupts = <51 0>, <52 0>, <53 0>, <54 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -636,7 +636,7 @@ timers15: timers@40014000 { compatible = "st,stm32-timers"; reg = <0x40014000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(APB2, 16U)>; resets = <&rctl STM32_RESET(APB2, 16U)>; interrupts = <69 0>; interrupt-names = "global"; @@ -657,7 +657,7 @@ timers16: timers@40014400 { compatible = "st,stm32-timers"; reg = <0x40014400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB2, 17U)>; resets = <&rctl STM32_RESET(APB2, 17U)>; interrupts = <70 0>; interrupt-names = "global"; @@ -678,7 +678,7 @@ timers17: timers@40014800 { compatible = "st,stm32-timers"; reg = <0x40014800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB2, 18U)>; resets = <&rctl STM32_RESET(APB2, 18U)>; interrupts = <71 0>; interrupt-names = "global"; @@ -701,9 +701,9 @@ reg = <0x420d1400 0x400>; interrupts = <76 0>; clock-names = "ospix", "ospi-ker", "ospi-mgr"; - clocks = <&rcc STM32_CLOCK_BUS_AHB2_2 0x00000010>, + clocks = <&rcc STM32_CLOCK(AHB2_2, 4U)>, <&rcc STM32_SRC_SYSCLK OCTOSPI_SEL(0)>, - <&rcc STM32_CLOCK_BUS_AHB2 0x00200000>; + <&rcc STM32_CLOCK(AHB2, 21U)>; #address-cells = <1>; #size-cells = <0>; status = "disabled"; @@ -714,9 +714,9 @@ reg = <0x420d2400 0x400>; interrupts = <120 0>; clock-names = "ospix", "ospi-ker", "ospi-mgr"; - clocks = <&rcc STM32_CLOCK_BUS_AHB2_2 0x00000100>, + clocks = <&rcc STM32_CLOCK(AHB2_2, 8U)>, <&rcc STM32_SRC_SYSCLK OCTOSPI_SEL(0)>, - <&rcc STM32_CLOCK_BUS_AHB2 0x00200000>; + <&rcc STM32_CLOCK(AHB2, 21U)>; #address-cells = <1>; #size-cells = <0>; status = "disabled"; @@ -725,7 +725,7 @@ aes: aes@420c0000 { compatible = "st,stm32-aes"; reg = <0x420c0000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(AHB2, 16U)>; resets = <&rctl STM32_RESET(AHB2L, 16U)>; interrupts = <93 0>; status = "disabled"; @@ -734,7 +734,7 @@ rng: rng@420c0800 { compatible = "st,stm32-rng"; reg = <0x420c0800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00040000>; + clocks = <&rcc STM32_CLOCK(AHB2, 18U)>; interrupts = <94 0>; nist-config = <0xf60d00>; health-test-config = <0x9aae>; @@ -753,7 +753,7 @@ sdmmc1: sdmmc@420c8000 { compatible = "st,stm32-sdmmc"; reg = <0x420c8000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x08000000>, + clocks = <&rcc STM32_CLOCK(AHB2, 27U)>, <&rcc STM32_SRC_HSI48 SDMMC_SEL(0)>; resets = <&rctl STM32_RESET(AHB2L, 27U)>; interrupts = <78 0>; @@ -763,7 +763,7 @@ sdmmc2: sdmmc@420c8c00 { compatible = "st,stm32-sdmmc"; reg = <0x420c8c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x10000000>, + clocks = <&rcc STM32_CLOCK(AHB2, 28U)>, <&rcc STM32_SRC_HSI48 SDMMC_SEL(0)>; resets = <&rctl STM32_RESET(AHB2L, 28U)>; interrupts = <79 0>; @@ -773,7 +773,7 @@ dac1: dac@46021800 { compatible = "st,stm32-dac"; reg = <0x46021800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00000040>; + clocks = <&rcc STM32_CLOCK(AHB3, 6U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -781,7 +781,7 @@ adc1: adc@42028000 { compatible = "st,stm32-adc"; reg = <0x42028000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000400>, + clocks = <&rcc STM32_CLOCK(AHB2, 10U)>, <&rcc STM32_SRC_HCLK ADCDAC_SEL(0)>; interrupts = <37 0>; status = "disabled"; @@ -798,7 +798,7 @@ adc4: adc@46021000 { compatible = "st,stm32-adc"; reg = <0x46021000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00000020>, + clocks = <&rcc STM32_CLOCK(AHB3, 5U)>, <&rcc STM32_SRC_HCLK ADCDAC_SEL(0)>; interrupts = <113 0>; status = "disabled"; @@ -819,7 +819,7 @@ reg-names = "m_can", "message_ram"; interrupts = <39 0>, <40 0>; interrupt-names = "int0", "int1"; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000200>; + clocks = <&rcc STM32_CLOCK(APB1_2, 9U)>; bosch,mram-cfg = <0x0 28 8 3 3 0 3 3>; status = "disabled"; }; @@ -827,7 +827,7 @@ ucpd1: ucpd@4000dc00 { compatible = "st,stm32-ucpd"; reg = <0x4000dc00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>; + clocks = <&rcc STM32_CLOCK(APB1, 23U)>; interrupts = <106 0>; status = "disabled"; }; @@ -838,7 +838,7 @@ reg = <0x40020000 0x400>; interrupts = <29 0 30 0 31 0 32 0 33 0 34 0 35 0 36 0 80 0 81 0 82 0 83 0 84 0 85 0 86 0 87 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x1>; + clocks = <&rcc STM32_CLOCK(AHB1, 0U)>; dma-channels = <16>; dma-requests = <114>; dma-offset = <0>; @@ -848,7 +848,7 @@ fmc: memory-controller@420d0400 { compatible = "st,stm32-fmc"; reg = <0x420d0400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2_2 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB2_2, 0U)>; status = "disabled"; sram { diff --git a/dts/arm/st/u5/stm32u545.dtsi b/dts/arm/st/u5/stm32u545.dtsi index d671688fed085..b7c7b6c0c646f 100644 --- a/dts/arm/st/u5/stm32u545.dtsi +++ b/dts/arm/st/u5/stm32u545.dtsi @@ -22,7 +22,7 @@ num-bidir-endpoints = <8>; ram-size = <1024>; status = "disabled"; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x01000000>, + clocks = <&rcc STM32_CLOCK(APB2, 24U)>, <&rcc STM32_SRC_HSI48 ICKLK_SEL(0)>; phys = <&usb_fs_phy>; }; diff --git a/dts/arm/st/u5/stm32u575.dtsi b/dts/arm/st/u5/stm32u575.dtsi index f9ca66f8a8799..eafda700e856d 100644 --- a/dts/arm/st/u5/stm32u575.dtsi +++ b/dts/arm/st/u5/stm32u575.dtsi @@ -19,7 +19,7 @@ num-bidir-endpoints = <6>; ram-size = <1280>; maximum-speed = "full-speed"; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00004000>, + clocks = <&rcc STM32_CLOCK(AHB2, 14U)>, <&rcc STM32_SRC_HSI48 ICKLK_SEL(0)>; phys = <&otgfs_phy>; status = "disabled"; diff --git a/dts/arm/st/u5/stm32u595.dtsi b/dts/arm/st/u5/stm32u595.dtsi index fa5639934be7b..c0c856dc27384 100644 --- a/dts/arm/st/u5/stm32u595.dtsi +++ b/dts/arm/st/u5/stm32u595.dtsi @@ -23,14 +23,14 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42022400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000200>; + clocks = <&rcc STM32_CLOCK(AHB2, 9U)>; }; }; usart6: serial@40006400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40006400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x02000000>; + clocks = <&rcc STM32_CLOCK(APB1, 25U)>; resets = <&rctl STM32_RESET(APB1L, 25U)>; interrupts = <126 0>; status = "disabled"; @@ -42,7 +42,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40009800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000040>; + clocks = <&rcc STM32_CLOCK(APB1_2, 6U)>; interrupts = <128 0>, <127 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -54,7 +54,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40009c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000080>; + clocks = <&rcc STM32_CLOCK(APB1_2, 7U)>; interrupts = <130 0>, <129 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -64,7 +64,7 @@ adc2: adc@42028100 { compatible = "st,stm32-adc"; reg = <0x42028100 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000400>, + clocks = <&rcc STM32_CLOCK(AHB2, 10U)>, <&rcc STM32_SRC_HCLK ADCDAC_SEL(0)>; interrupts = <37 0>; status = "disabled"; @@ -85,7 +85,7 @@ adc1_2: adc@42028300 { compatible = "st,stm32-adc"; reg = <0x42028300 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000400>; + clocks = <&rcc STM32_CLOCK(AHB2, 10U)>; interrupts = <37 0>; status = "disabled"; #io-channel-cells = <1>; @@ -106,7 +106,7 @@ num-bidir-endpoints = <9>; ram-size = <4096>; maximum-speed = "high-speed"; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x0000c000>, + clocks = <&rcc STM32_CLOCK(AHB2, 15U)>, <&rcc STM32_SRC_HSI48 ICKLK_SEL(0)>; phys = <&otghs_phy>; status = "disabled"; diff --git a/dts/arm/st/wb/stm32wb.dtsi b/dts/arm/st/wb/stm32wb.dtsi index f51c578a2b347..90ff2423dc91f 100644 --- a/dts/arm/st/wb/stm32wb.dtsi +++ b/dts/arm/st/wb/stm32wb.dtsi @@ -145,7 +145,7 @@ compatible = "st,stm32-flash-controller", "st,stm32wb-flash-controller"; reg = <0x58004000 0x400>; interrupts = <4 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x02000000>; + clocks = <&rcc STM32_CLOCK(AHB3, 25U)>; #address-cells = <1>; #size-cells = <1>; @@ -197,7 +197,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB2, 0U)>; }; gpiob: gpio@48000400 { @@ -205,7 +205,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000002>; + clocks = <&rcc STM32_CLOCK(AHB2, 1U)>; }; gpioc: gpio@48000800 { @@ -213,7 +213,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000004>; + clocks = <&rcc STM32_CLOCK(AHB2, 2U)>; }; gpiod: gpio@48000c00 { @@ -221,7 +221,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000008>; + clocks = <&rcc STM32_CLOCK(AHB2, 3U)>; }; gpioe: gpio@48001000 { @@ -230,7 +230,7 @@ #gpio-cells = <2>; ngpios = <5>; reg = <0x48001000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000010>; + clocks = <&rcc STM32_CLOCK(AHB2, 4U)>; }; gpioh: gpio@48001c00 { @@ -239,14 +239,14 @@ #gpio-cells = <2>; ngpios = <4>; reg = <0x48001c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000080>; + clocks = <&rcc STM32_CLOCK(AHB2, 7U)>; }; }; wwdg: watchdog@40002c00 { compatible = "st,stm32-window-watchdog"; reg = <0x40002C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <0 7>; status = "disabled"; }; @@ -254,7 +254,7 @@ usart1: serial@40013800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40013800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB2, 14U)>; resets = <&rctl STM32_RESET(APB2, 14U)>; interrupts = <36 0>; status = "disabled"; @@ -266,7 +266,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB1, 21U)>; interrupts = <30 0>, <31 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -278,7 +278,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>; + clocks = <&rcc STM32_CLOCK(APB1, 23U)>; interrupts = <32 0>, <33 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -288,7 +288,7 @@ compatible = "st,stm32-rtc"; reg = <0x40002800 0x400>; interrupts = <41 0>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000400>; + clocks = <&rcc STM32_CLOCK(APB1, 10U)>; prescaler = <32768>; alarms-count = <2>; alrm-exti-line = <17>; @@ -307,7 +307,7 @@ #size-cells = <0>; reg = <0x40013000 0x400>; interrupts = <34 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB2, 12U)>; status = "disabled"; }; @@ -317,14 +317,14 @@ #size-cells = <0>; reg = <0x40003800 0x400>; interrupts = <35 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; status = "disabled"; }; lpuart1: serial@40008000 { compatible = "st,stm32-lpuart", "st,stm32-uart"; reg = <0x40008000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1_2, 0U)>; resets = <&rctl STM32_RESET(APB1H, 0U)>; interrupts = <37 0>; status = "disabled"; @@ -333,7 +333,7 @@ timers1: timers@40012c00 { compatible = "st,stm32-timers"; reg = <0x40012c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB2, 11U)>; resets = <&rctl STM32_RESET(APB2, 11U)>; interrupts = <24 0>, <25 0>, <26 0>, <27 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -350,7 +350,7 @@ timers2: timers@40000000 { compatible = "st,stm32-timers"; reg = <0x40000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1, 0U)>; resets = <&rctl STM32_RESET(APB1L, 0U)>; interrupts = <28 0>; interrupt-names = "global"; @@ -372,7 +372,7 @@ timers16: timers@40014400 { compatible = "st,stm32-timers"; reg = <0x40014400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB2, 17U)>; resets = <&rctl STM32_RESET(APB2, 17U)>; interrupts = <25 0>; interrupt-names = "global"; @@ -394,7 +394,7 @@ timers17: timers@40014800 { compatible = "st,stm32-timers"; reg = <0x40014800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB2, 18U)>; resets = <&rctl STM32_RESET(APB2, 18U)>; interrupts = <26 0>; interrupt-names = "global"; @@ -416,7 +416,7 @@ adc1: adc@50040000 { compatible = "st,stm32-adc"; reg = <0x50040000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00002000>; + clocks = <&rcc STM32_CLOCK(AHB2, 13U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; @@ -436,7 +436,7 @@ lptim1: timers@40007c00 { compatible = "st,stm32-lptim"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>; + clocks = <&rcc STM32_CLOCK(APB1, 31U)>; #address-cells = <1>; #size-cells = <0>; reg = <0x40007c00 0x400>; @@ -450,7 +450,7 @@ #dma-cells = <3>; reg = <0x40020000 0x400>; interrupts = <11 0 12 0 13 0 14 0 15 0 16 0 17 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x1>; + clocks = <&rcc STM32_CLOCK(AHB1, 0U)>; dma-requests = <7>; dma-offset = <0>; status = "disabled"; @@ -461,7 +461,7 @@ #dma-cells = <3>; reg = <0x40020400 0x400>; interrupts = <55 0 56 0 57 0 58 0 59 0 60 0 61 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x2>; + clocks = <&rcc STM32_CLOCK(AHB1, 1U)>; dma-requests = <7>; dma-offset = <7>; status = "disabled"; @@ -472,7 +472,7 @@ #dma-cells = <3>; reg = <0x40020800 0x400>; interrupts = <62 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x4>; + clocks = <&rcc STM32_CLOCK(AHB1, 2U)>; dma-channels = <14>; dma-generators = <4>; dma-requests= <36>; @@ -487,7 +487,7 @@ num-bidir-endpoints = <8>; ram-size = <1024>; phys = <&usb_fs_phy>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x04000000>, + clocks = <&rcc STM32_CLOCK(APB1, 26U)>, <&rcc STM32_SRC_HSI48 CLK48_SEL(0)>; status = "disabled"; }; @@ -498,7 +498,7 @@ #size-cells = <0x0>; reg = <0xa0001000 0x400>; interrupts = <0x32 0x0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x100>; + clocks = <&rcc STM32_CLOCK(AHB3, 8U)>; status = "disabled"; }; @@ -506,14 +506,14 @@ compatible = "st,stm32-rng"; reg = <0x58001000 0x400>; interrupts = <53 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00040000>; + clocks = <&rcc STM32_CLOCK(AHB3, 18U)>; status = "disabled"; }; aes1: aes@50060000 { compatible = "st,stm32-aes"; reg = <0x50060000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00010000>; + clocks = <&rcc STM32_CLOCK(AHB2, 16U)>; resets = <&rctl STM32_RESET(AHB2, 16U)>; interrupts = <51 0>; status = "disabled"; @@ -576,7 +576,7 @@ ble_rf: ble_rf { compatible = "st,stm32wb-rf"; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00100000>, + clocks = <&rcc STM32_CLOCK(AHB3, 20U)>, <&rcc STM32_SRC_LSE RFWKP_SEL(1)>; }; diff --git a/dts/arm/st/wb0/stm32wb0.dtsi b/dts/arm/st/wb0/stm32wb0.dtsi index 157438a2e85db..07f1c58a6c6fc 100644 --- a/dts/arm/st/wb0/stm32wb0.dtsi +++ b/dts/arm/st/wb0/stm32wb0.dtsi @@ -165,7 +165,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000000 DT_SIZE_K(1)>; - clocks = <&rcc STM32_CLOCK_BUS_AHB0 (1 << 2)>; + clocks = <&rcc STM32_CLOCK(AHB0, 2)>; }; gpiob: gpio@48100000 { @@ -173,7 +173,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48100000 DT_SIZE_K(1)>; - clocks = <&rcc STM32_CLOCK_BUS_AHB0 (1 << 3)>; + clocks = <&rcc STM32_CLOCK(AHB0, 3)>; }; }; @@ -181,7 +181,7 @@ compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x41004000 DT_SIZE_K(1)>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 (1 << 10)>; + clocks = <&rcc STM32_CLOCK(APB1, 10)>; resets = <&rctl STM32_RESET(APB1, 10)>; interrupts = <8 0>; status = "disabled"; @@ -190,7 +190,7 @@ lpuart1: serial@41005000 { compatible = "st,stm32-lpuart", "st,stm32-uart"; reg = <0x41005000 DT_SIZE_K(1)>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 (1 << 8)>; + clocks = <&rcc STM32_CLOCK(APB1, 8)>; resets = <&rctl STM32_RESET(APB1, 8)>; interrupts = <9 0>; status = "disabled"; diff --git a/dts/arm/st/wba/stm32wba.dtsi b/dts/arm/st/wba/stm32wba.dtsi index aa59cef65b3e0..6d12ca8c8dda2 100644 --- a/dts/arm/st/wba/stm32wba.dtsi +++ b/dts/arm/st/wba/stm32wba.dtsi @@ -180,7 +180,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42020000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB2, 0U)>; }; gpiob: gpio@42020400 { @@ -188,7 +188,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42020400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000002>; + clocks = <&rcc STM32_CLOCK(AHB2, 1U)>; }; gpioc: gpio@42020800 { @@ -196,7 +196,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42020800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000004>; + clocks = <&rcc STM32_CLOCK(AHB2, 2U)>; }; gpioh: gpio@42021c00 { @@ -204,7 +204,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x42021c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000080>; + clocks = <&rcc STM32_CLOCK(AHB2, 7U)>; }; }; @@ -212,7 +212,7 @@ compatible = "st,stm32-rtc"; reg = <0x46007800 0x400>; interrupts = <2 0>; - clocks = <&rcc STM32_CLOCK_BUS_APB7 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB7, 21U)>; alarms-count = <2>; status = "disabled"; }; @@ -226,7 +226,7 @@ wwdg: watchdog@40002c00 { compatible = "st,stm32-window-watchdog"; reg = <0x40002C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <0 7>; status = "disabled"; }; @@ -234,7 +234,7 @@ usart1: serial@40013800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40013800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB2, 14U)>; resets = <&rctl STM32_RESET(APB2, 14U)>; interrupts = <46 0>; status = "disabled"; @@ -243,7 +243,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1L, 17U)>; interrupts = <47 0>; status = "disabled"; @@ -252,7 +252,7 @@ lpuart1: serial@46002400 { compatible = "st,stm32-lpuart", "st,stm32-uart"; reg = <0x46002400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB7 0x00000040>; + clocks = <&rcc STM32_CLOCK(APB7, 6U)>; resets = <&rctl STM32_RESET(APB7, 6U)>; interrupts = <48 0>; status = "disabled"; @@ -264,7 +264,7 @@ #size-cells = <0>; reg = <0x40013000 0x400>; interrupts = <45 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB2, 12U)>; status = "disabled"; }; @@ -274,7 +274,7 @@ #size-cells = <0>; reg = <0x46002000 0x400>; interrupts = <63 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB7 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB7, 5U)>; status = "disabled"; }; @@ -284,7 +284,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB1, 21U)>; interrupts = <43 0>, <44 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -296,7 +296,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x46002800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB7 0x00000080>; + clocks = <&rcc STM32_CLOCK(APB7, 7U)>; interrupts = <54 0>, <55 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -305,7 +305,7 @@ timers1: timers@40012c00 { compatible = "st,stm32-timers"; reg = <0x40012c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB2, 11U)>; resets = <&rctl STM32_RESET(APB2, 11U)>; interrupts = <37 0>, <38 0>, <39 0>, <40 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -327,7 +327,7 @@ timers2: timers@40000000 { compatible = "st,stm32-timers"; reg = <0x40000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1, 0U)>; resets = <&rctl STM32_RESET(APB1L, 0U)>; interrupts = <41 0>; interrupt-names = "global"; @@ -349,7 +349,7 @@ timers3: timers@40000400 { compatible = "st,stm32-timers"; reg = <0x40000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000002>; + clocks = <&rcc STM32_CLOCK(APB1, 1U)>; resets = <&rctl STM32_RESET(APB1L, 1U)>; interrupts = <42 0>; interrupt-names = "global"; @@ -371,7 +371,7 @@ timers16: timers@40014400 { compatible = "st,stm32-timers"; reg = <0x40014400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB2, 17U)>; resets = <&rctl STM32_RESET(APB2, 17U)>; interrupts = <51 0>; interrupt-names = "global"; @@ -392,7 +392,7 @@ timers17: timers@40014800 { compatible = "st,stm32-timers"; reg = <0x40014800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB2, 18U)>; resets = <&rctl STM32_RESET(APB2, 18U)>; interrupts = <52 0>; interrupt-names = "global"; @@ -413,7 +413,7 @@ adc4: adc@46021000 { compatible = "st,stm32-adc"; reg = <0x46021000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB4 0x00000020>, + clocks = <&rcc STM32_CLOCK(AHB4, 5U)>, <&rcc STM32_SRC_HCLK1 ADC_SEL(0)>; interrupts = <65 0>; status = "disabled"; @@ -433,7 +433,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x46004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB7 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB7, 11U)>; interrupts = <49 1>; interrupt-names = "wakeup"; status = "disabled"; @@ -444,7 +444,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40009400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000020>; + clocks = <&rcc STM32_CLOCK(APB1_2, 5U)>; interrupts = <50 1>; interrupt-names = "wakeup"; status = "disabled"; @@ -454,7 +454,7 @@ compatible = "st,stm32-rng"; reg = <0x420c0800 0x400>; interrupts = <59 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00040000>, + clocks = <&rcc STM32_CLOCK(AHB2, 18U)>, <&rcc STM32_SRC_HSI16 RNG_SEL(2)>; nist-config = <0xf00d>; health-test-config = <0xaac7>; @@ -466,7 +466,7 @@ #dma-cells = <3>; reg = <0x40020000 0x1000>; interrupts = <29 0 30 0 31 0 32 0 33 0 34 0 35 0 36 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x1>; + clocks = <&rcc STM32_CLOCK(AHB1, 0U)>; dma-channels = <8>; dma-requests = <52>; dma-offset = <0>; diff --git a/dts/arm/st/wl/stm32wl.dtsi b/dts/arm/st/wl/stm32wl.dtsi index 1787d250eb0b3..b5df0b9070f89 100644 --- a/dts/arm/st/wl/stm32wl.dtsi +++ b/dts/arm/st/wl/stm32wl.dtsi @@ -162,7 +162,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000001>; + clocks = <&rcc STM32_CLOCK(AHB2, 0U)>; }; gpiob: gpio@48000400 { @@ -170,7 +170,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000002>; + clocks = <&rcc STM32_CLOCK(AHB2, 1U)>; }; gpioc: gpio@48000800 { @@ -178,7 +178,7 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48000800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000004>; + clocks = <&rcc STM32_CLOCK(AHB2, 2U)>; }; gpioh: gpio@48001c00 { @@ -186,13 +186,13 @@ gpio-controller; #gpio-cells = <2>; reg = <0x48001c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB2 0x00000080>; + clocks = <&rcc STM32_CLOCK(AHB2, 7U)>; }; }; lptim1: timers@40007c00 { compatible = "st,stm32-lptim"; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>; + clocks = <&rcc STM32_CLOCK(APB1, 31U)>; #address-cells = <1>; #size-cells = <0>; reg = <0x40007c00 0x400>; @@ -205,7 +205,7 @@ compatible = "st,stm32-rtc"; reg = <0x40002800 0x400>; interrupts = <42 0>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000400>; + clocks = <&rcc STM32_CLOCK(APB1, 10U)>; prescaler = <32768>; alarms-count = <2>; alrm-exti-line = <17>; @@ -233,7 +233,7 @@ wwdg: watchdog@40002c00 { compatible = "st,stm32-window-watchdog"; reg = <0x40002C00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB1, 11U)>; interrupts = <0 7>; status = "disabled"; }; @@ -241,7 +241,7 @@ usart1: serial@40013800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40013800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB2, 14U)>; resets = <&rctl STM32_RESET(APB2, 14U)>; interrupts = <36 0>; status = "disabled"; @@ -250,7 +250,7 @@ usart2: serial@40004400 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40004400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB1, 17U)>; resets = <&rctl STM32_RESET(APB1L, 17U)>; interrupts = <37 0>; status = "disabled"; @@ -259,7 +259,7 @@ lpuart1: serial@40008000 { compatible = "st,stm32-lpuart", "st,stm32-uart"; reg = <0x40008000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1_2, 0U)>; resets = <&rctl STM32_RESET(APB1H, 0U)>; interrupts = <38 0>; wakeup-line = <28>; @@ -272,7 +272,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>; + clocks = <&rcc STM32_CLOCK(APB1, 21U)>; interrupts = <30 0>, <31 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -284,7 +284,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00400000>; + clocks = <&rcc STM32_CLOCK(APB1, 22U)>; interrupts = <32 0>, <33 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -296,7 +296,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x40005c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00800000>; + clocks = <&rcc STM32_CLOCK(APB1, 23U)>; interrupts = <48 0>, <49 0>; interrupt-names = "event", "error"; status = "disabled"; @@ -308,7 +308,7 @@ #size-cells = <0>; reg = <0x40013000 0x400>; interrupts = <34 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00001000>; + clocks = <&rcc STM32_CLOCK(APB2, 12U)>; status = "disabled"; }; @@ -318,7 +318,7 @@ #size-cells = <0>; reg = <0x40003800 0x400>; interrupts = <35 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00004000>; + clocks = <&rcc STM32_CLOCK(APB1, 14U)>; status = "disabled"; }; @@ -328,7 +328,7 @@ #size-cells = <0>; reg = <0x58010000 0x400>; interrupts = <44 5>; - clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB3, 0U)>; status = "disabled"; use-subghzspi-nss; @@ -344,7 +344,7 @@ adc1: adc@40012400 { compatible = "st,stm32-adc"; reg = <0x40012400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000200>; + clocks = <&rcc STM32_CLOCK(APB2, 9U)>; interrupts = <18 0>; status = "disabled"; #io-channel-cells = <1>; @@ -360,7 +360,7 @@ dac1: dac@40007400 { compatible = "st,stm32-dac"; reg = <0x40007400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x20000000>; + clocks = <&rcc STM32_CLOCK(APB1, 29U)>; status = "disabled"; #io-channel-cells = <1>; }; @@ -368,7 +368,7 @@ timers1: timers@40012c00 { compatible = "st,stm32-timers"; reg = <0x40012c00 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00000800>; + clocks = <&rcc STM32_CLOCK(APB2, 11U)>; resets = <&rctl STM32_RESET(APB2, 11U)>; interrupts = <23 0>, <24 0>, <25 0>, <26 0>; interrupt-names = "brk", "up", "trgcom", "cc"; @@ -385,7 +385,7 @@ timers2: timers@40000000 { compatible = "st,stm32-timers"; reg = <0x40000000 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000001>; + clocks = <&rcc STM32_CLOCK(APB1, 0U)>; resets = <&rctl STM32_RESET(APB1L, 0U)>; interrupts = <27 0>; interrupt-names = "global"; @@ -407,7 +407,7 @@ timers16: timers@40014400 { compatible = "st,stm32-timers"; reg = <0x40014400 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00020000>; + clocks = <&rcc STM32_CLOCK(APB2, 17U)>; resets = <&rctl STM32_RESET(APB2, 17U)>; interrupts = <28 0>; interrupt-names = "global"; @@ -429,7 +429,7 @@ timers17: timers@40014800 { compatible = "st,stm32-timers"; reg = <0x40014800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_APB2 0x00040000>; + clocks = <&rcc STM32_CLOCK(APB2, 18U)>; resets = <&rctl STM32_RESET(APB2, 18U)>; interrupts = <29 0>; interrupt-names = "global"; @@ -451,7 +451,7 @@ aes: aes@58001800 { compatible = "st,stm32-aes"; reg = <0x58001800 0x400>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00020000>; + clocks = <&rcc STM32_CLOCK(AHB3, 17U)>; resets = <&rctl STM32_RESET(AHB3, 16U)>; interrupts = <51 0>; status = "disabled"; @@ -461,7 +461,7 @@ compatible = "st,stm32-rng"; reg = <0x58001000 0x400>; interrupts = <52 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00040000>; + clocks = <&rcc STM32_CLOCK(AHB3, 18U)>; health-test-magic = <0x17590abc>; health-test-config = <0xaa74>; status = "disabled"; @@ -472,7 +472,7 @@ #dma-cells = <3>; reg = <0x40020000 0x400>; interrupts = <11 0 12 0 13 0 14 0 15 0 16 0 17 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x1>; + clocks = <&rcc STM32_CLOCK(AHB1, 0U)>; dma-requests = <7>; dma-offset = <0>; status = "disabled"; @@ -483,7 +483,7 @@ #dma-cells = <3>; reg = <0x40020400 0x400>; interrupts = <54 0 55 0 56 0 57 0 58 0 59 0 60 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x2>; + clocks = <&rcc STM32_CLOCK(AHB1, 1U)>; dma-requests = <7>; dma-offset = <7>; status = "disabled"; @@ -494,7 +494,7 @@ #dma-cells = <3>; reg = <0x40020800 0x400>; interrupts = <61 0>; - clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x4>; + clocks = <&rcc STM32_CLOCK(AHB1, 2U)>; dma-channels = <14>; dma-generators = <4>; dma-requests= <38>; From dc553051169ec89da07226fc987ddbcc9e0ce1b4 Mon Sep 17 00:00:00 2001 From: Lingao Meng Date: Thu, 10 Oct 2024 19:07:18 +0800 Subject: [PATCH 1641/4482] Samples: Bluetooth: Fix where the TX thread no longer be sent out When ever `unack_queue_len` changed, should raise signal `tx_queue_change` to let's tx_thread known queue changed. Fixed the situation where the TX thread may no longer be sent out Signed-off-by: Lingao Meng --- samples/bluetooth/hci_uart_3wire/src/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/samples/bluetooth/hci_uart_3wire/src/main.c b/samples/bluetooth/hci_uart_3wire/src/main.c index 7f459061e8936..ce0e993dab04a 100644 --- a/samples/bluetooth/hci_uart_3wire/src/main.c +++ b/samples/bluetooth/hci_uart_3wire/src/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Xiaomi Coopration + * Copyright (c) 2024 Xiaomi Corporation * Copyright (c) 2015-2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 @@ -182,6 +182,7 @@ static void process_unack(void) { uint8_t next_seq = h5.tx_seq; uint8_t number_removed = unack_queue_len; + bool acked = false; if (!unack_queue_len) { return; @@ -224,6 +225,12 @@ static void process_unack(void) net_buf_unref(buf); unack_queue_len--; number_removed--; + + acked = true; + } + + if (acked) { + k_poll_signal_raise(&tx_queue_change, 0); } } From d4ea3010eeb447776637e52cddf692035dde130d Mon Sep 17 00:00:00 2001 From: Yassine El Aissaoui Date: Tue, 8 Oct 2024 17:55:51 +0200 Subject: [PATCH 1642/4482] west.yml: update hal_nxp to reference MCXW71 blob addition Reference MCXW71 blob addition. Signed-off-by: Yassine El Aissaoui --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 425ef04c1c26a..09810b9d1dbeb 100644 --- a/west.yml +++ b/west.yml @@ -198,7 +198,7 @@ manifest: groups: - hal - name: hal_nxp - revision: 99570ee6fa32a9ab413b8ee9c0226cda26f6a2ae + revision: 78b3972e2ccb884057b838c9f60979a4c5602b18 path: modules/hal/nxp groups: - hal From 71214ae576138bca326c80760767a089b52cc9e3 Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Mon, 16 Sep 2024 01:27:49 +0200 Subject: [PATCH 1643/4482] dts: bindings: crypto: Add initial Si32 binding This is needed for Si32 crypto driver support. Signed-off-by: Reto Schneider --- dts/bindings/crypto/silabs,si32-aes.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 dts/bindings/crypto/silabs,si32-aes.yaml diff --git a/dts/bindings/crypto/silabs,si32-aes.yaml b/dts/bindings/crypto/silabs,si32-aes.yaml new file mode 100644 index 0000000000000..3c2688df35c4a --- /dev/null +++ b/dts/bindings/crypto/silabs,si32-aes.yaml @@ -0,0 +1,21 @@ +# Copyright (c) 2024 GARDENA GmbH +# SPDX-License-Identifier: Apache-2.0 + +description: Si32 AES node + +compatible: "silabs,si32-aes" + +include: base.yaml + +properties: + reg: + required: true + + interrupts: + required: true + + dmas: + required: true + + dma-names: + required: true From de04a0e7cd0152241d367c11e1ee13f8c12d48ae Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Mon, 16 Sep 2024 01:30:16 +0200 Subject: [PATCH 1644/4482] dts: arm: silabs: sim3u: Add crypto support node This is needed for Si32 crypto driver support. Signed-off-by: Reto Schneider --- dts/arm/silabs/sim3u.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dts/arm/silabs/sim3u.dtsi b/dts/arm/silabs/sim3u.dtsi index 79a9e6c343b4e..13c94846e4fd2 100644 --- a/dts/arm/silabs/sim3u.dtsi +++ b/dts/arm/silabs/sim3u.dtsi @@ -73,6 +73,17 @@ status = "disabled"; }; + crypto: crypto@40027000 { + compatible = "silabs,si32-aes"; + reg = <0x40027000 0x1000>; + interrupts = <42 0>; + dmas = <&dma 5 0 0>, + <&dma 6 0 0>, + <&dma 7 0 0>; + dma-names = "tx", "rx", "xor"; + status = "disabled"; + }; + flash: flash-controller@4002e000 { compatible = "silabs,si32-flash-controller"; reg = <0x4002e000 0x1000>; From 1790eda851973eb4eec030d73ab00603020a5040 Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Mon, 16 Sep 2024 01:31:46 +0200 Subject: [PATCH 1645/4482] drivers: crypto: Add initial SiM3U1xx support This driver makes use of the hardware AES acceleration, using DMA transfers. Signed-off-by: Reto Schneider --- drivers/crypto/CMakeLists.txt | 1 + drivers/crypto/Kconfig | 1 + drivers/crypto/Kconfig.si32 | 18 + drivers/crypto/crypto_si32.c | 1204 +++++++++++++++++++++++++++++++++ 4 files changed, 1224 insertions(+) create mode 100644 drivers/crypto/Kconfig.si32 create mode 100644 drivers/crypto/crypto_si32.c diff --git a/drivers/crypto/CMakeLists.txt b/drivers/crypto/CMakeLists.txt index 4cdf7a6e8b89a..59d02d44ad973 100644 --- a/drivers/crypto/CMakeLists.txt +++ b/drivers/crypto/CMakeLists.txt @@ -13,4 +13,5 @@ zephyr_library_sources_ifdef(CONFIG_CRYPTO_MCHP_XEC_SYMCR crypto_mchp_xec_symcr. zephyr_library_sources_ifdef(CONFIG_CRYPTO_IT8XXX2_SHA crypto_it8xxx2_sha.c) zephyr_library_sources_ifdef(CONFIG_CRYPTO_IT8XXX2_SHA_V2 crypto_it8xxx2_sha_v2.c) zephyr_library_sources_ifdef(CONFIG_CRYPTO_MCUX_DCP crypto_mcux_dcp.c) +zephyr_library_sources_ifdef(CONFIG_CRYPTO_SI32 crypto_si32.c) zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS) diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index 61955697da87b..964e9439db041 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig @@ -82,6 +82,7 @@ source "drivers/crypto/Kconfig.npcx" source "drivers/crypto/Kconfig.xec" source "drivers/crypto/Kconfig.it8xxx2" source "drivers/crypto/Kconfig.mcux_dcp" +source "drivers/crypto/Kconfig.si32" source "drivers/crypto/Kconfig.smartbond" endif # CRYPTO diff --git a/drivers/crypto/Kconfig.si32 b/drivers/crypto/Kconfig.si32 new file mode 100644 index 0000000000000..dbed9ffd993dd --- /dev/null +++ b/drivers/crypto/Kconfig.si32 @@ -0,0 +1,18 @@ +# Copyright (c) 2024 GARDENA GmbH +# SPDX-License-Identifier: Apache-2.0 + +config CRYPTO_SI32 + bool "Si32 AES driver" + default y + depends on DT_HAS_SILABS_SI32_AES_ENABLED + select DMA + help + Enable hardware accelerated AES driver. + +config CRYPTO_SI32_MAX_SESSION + int "Maximum of sessions the Si32 driver can handle" + default 2 + depends on CRYPTO_SI32 + help + This can be used to tweak the amount of sessions the driver + can handle in parallel. diff --git a/drivers/crypto/crypto_si32.c b/drivers/crypto/crypto_si32.c new file mode 100644 index 0000000000000..e933852e7a5fa --- /dev/null +++ b/drivers/crypto/crypto_si32.c @@ -0,0 +1,1204 @@ +/* + * Copyright (c) 2024 GARDENA GmbH + * + * SPDX-License-Identifier: Apache-2.0 + * + * Design decisions: + * - As there is only one AES controller, this implementation is not using a device configuration. + * + * Notes: + * - If not noted otherwise, chapter numbers refer to the SiM3U1XX/SiM3C1XX reference manual + * (SiM3U1xx-SiM3C1xx-RM.pdf, revision 1.0) + * - Each DMA channel has one word of unused data (=> 3 x 4 = 12 bytes of unused RAM) + */ + +#define DT_DRV_COMPAT silabs_si32_aes + +#define LOG_LEVEL CONFIG_CRYPTO_LOG_LEVEL +#include +LOG_MODULE_REGISTER(aes_silabs_si32); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include "SI32_DMAXBAR_A_Type.h" +#include + +#include + +#define AES_KEY_SIZE 16 +#define AES_BLOCK_SIZE 16 + +#define DMA_CHANNEL_COUNT DT_PROP(DT_INST(0, silabs_si32_dma), dma_channels) + +#define DMA_CHANNEL_ID_RX DT_INST_DMAS_CELL_BY_NAME(0, rx, channel) +#define DMA_CHANNEL_ID_TX DT_INST_DMAS_CELL_BY_NAME(0, tx, channel) +#define DMA_CHANNEL_ID_XOR DT_INST_DMAS_CELL_BY_NAME(0, xor, channel) + +BUILD_ASSERT(DMA_CHANNEL_ID_RX < DMA_CHANNEL_COUNT, "Too few DMA channels"); +BUILD_ASSERT(DMA_CHANNEL_ID_TX < DMA_CHANNEL_COUNT, "Too few DMA channels"); +BUILD_ASSERT(DMA_CHANNEL_ID_XOR < DMA_CHANNEL_COUNT, "Too few DMA channels"); + +struct crypto_session { + /* Decryption key needed only by ECB and CBC, and counter only by CTR. */ + union { + uint8_t decryption_key[32]; /* only used for decryption sessions */ + uint32_t current_ctr; /* only used for AES-CTR sessions */ + }; + + bool in_use; +}; + +struct crypto_data { + struct crypto_session sessions[CONFIG_CRYPTO_SI32_MAX_SESSION]; +}; + +K_MUTEX_DEFINE(crypto_si32_in_use); +K_SEM_DEFINE(crypto_si32_work_done, 0, 1); + +static struct crypto_data crypto_si32_data; + +static void crypto_si32_dma_completed(const struct device *dev, void *user_data, uint32_t channel, + int status) +{ + ARG_UNUSED(dev); + ARG_UNUSED(user_data); + + const char *const result = status == DMA_STATUS_COMPLETE ? "succeeded" : "failed"; + + switch (channel) { + case DMA_CHANNEL_ID_RX: + LOG_DBG("AES0 RX DMA channel %s", result); + k_sem_give(&crypto_si32_work_done); + break; + case DMA_CHANNEL_ID_TX: + LOG_DBG("AES0 TX DMA channel %s", result); + break; + case DMA_CHANNEL_ID_XOR: + LOG_DBG("AES0 XOR DMA channel %s", result); + break; + default: + LOG_ERR("Unknown DMA channel number: %d", channel); + break; + } +} + +static int crypto_si32_query_hw_caps(const struct device *dev) +{ + ARG_UNUSED(dev); + + return (CAP_RAW_KEY | CAP_INPLACE_OPS | CAP_SEPARATE_IO_BUFS | CAP_SYNC_OPS | + CAP_NO_IV_PREFIX); +} + +static void crypto_si32_irq_error_handler(const struct device *dev) +{ + ARG_UNUSED(dev); + + /* 12.3 Interrupts: An AES0 error interrupt can be generated whenever an input/output data + * FIFO overrun (DORF = 1) or underrun (DURF = 1) error occurs, or when an XOR data FIFO + * overrun (XORF = 1) occurs. + */ + if (SI32_AES_0->STATUS.ERRI) { + LOG_ERR("AES0 FIFO overrun (%u), underrun (%u), XOR FIF0 overrun (%u)", + SI32_AES_0->STATUS.DORF, SI32_AES_0->STATUS.DURF, SI32_AES_0->STATUS.XORF); + SI32_AES_A_clear_error_interrupt(SI32_AES_0); + } +} + +/* For simplicity, the AES HW does not get turned of when not in use. */ +static int crypto_si32_init(const struct device *dev) +{ + ARG_UNUSED(dev); + + /* Enable clock for AES HW */ + SI32_CLKCTRL_A_enable_apb_to_modules_0(SI32_CLKCTRL_0, SI32_CLKCTRL_A_APBCLKG0_AES0); + + /* To use the AES0 module, firmware must first clear the RESET bit before initializing the + * registers. + */ + SI32_AES_A_reset_module(SI32_AES_0); + + __ASSERT(SI32_AES_0->CONTROL.RESET == 0, "Reset done"); + + /* 12.3. Interrupts: The completion interrupt should only be used in conjunction + * with software mode (SWMDEN bit is set to 1) and not with DMA operations, where the DMA + * completion interrupt should be used. + */ + SI32_AES_A_disable_operation_complete_interrupt(SI32_AES_0); /* default */ + + /* 12.3. Interrupts: The error interrupt should always be enabled (ERRIEN = 1), even when + * using the DMA with the AES module. + */ + SI32_AES_A_enable_error_interrupt(SI32_AES_0); + + /* Install error handler */ + IRQ_CONNECT(DT_INST_IRQN(0), DT_INST_IRQ(0, priority), crypto_si32_irq_error_handler, + DEVICE_DT_INST_GET(0), 0); + irq_enable(DT_INST_IRQN(0)); + + /* Halt AES0 module on debug breakpoint */ + SI32_AES_A_enable_stall_in_debug_mode(SI32_AES_0); + + /* For peripheral transfers, firmware should configure the peripheral for the DMA transfer + * and set the device’s DMA crossbar (DMAXBAR) to map a DMA channel to the peripheral. + */ + SI32_DMAXBAR_A_select_channel_peripheral(SI32_DMAXBAR_0, SI32_DMAXBAR_CHAN5_AES0_TX); + SI32_DMAXBAR_A_select_channel_peripheral(SI32_DMAXBAR_0, SI32_DMAXBAR_CHAN6_AES0_RX); + SI32_DMAXBAR_A_select_channel_peripheral(SI32_DMAXBAR_0, SI32_DMAXBAR_CHAN7_AES0_XOR); + + return 0; +} + +static int crypto_si32_aes_set_key(const uint8_t *key, uint8_t key_len) +{ + const uint32_t *key_as_word = (const uint32_t *)key; + + switch (key_len) { + case 32: + SI32_AES_0->HWKEY7.U32 = key_as_word[7]; + SI32_AES_0->HWKEY6.U32 = key_as_word[6]; + __fallthrough; + case 24: + SI32_AES_0->HWKEY5.U32 = key_as_word[5]; + SI32_AES_0->HWKEY4.U32 = key_as_word[4]; + __fallthrough; + case 16: + SI32_AES_0->HWKEY3.U32 = key_as_word[3]; + SI32_AES_0->HWKEY2.U32 = key_as_word[2]; + SI32_AES_0->HWKEY1.U32 = key_as_word[1]; + SI32_AES_0->HWKEY0.U32 = key_as_word[0]; + break; + default: + LOG_ERR("Invalid key len: %" PRIu16, key_len); + return -EINVAL; + } + + return 0; +} + +static int crypto_si32_aes_calc_decryption_key(const struct cipher_ctx *ctx, + uint8_t *decryption_key) +{ + uint32_t *decryption_key_word = (uint32_t *)decryption_key; + int ret; + + ret = crypto_si32_aes_set_key(ctx->key.bit_stream, ctx->keylen); + if (ret) { + return ret; + } + + LOG_INF("Generating decryption key"); + /* TODO: How much of this can be removed? */ + SI32_AES_A_write_xfrsize(SI32_AES_0, 0); + SI32_AES_A_enable_error_interrupt(SI32_AES_0); + SI32_AES_A_exit_cipher_block_chaining_mode(SI32_AES_0); + SI32_AES_A_exit_counter_mode(SI32_AES_0); + SI32_AES_A_exit_bypass_hardware_mode(SI32_AES_0); + SI32_AES_A_select_xor_path_none(SI32_AES_0); + SI32_AES_A_select_software_mode(SI32_AES_0); + SI32_AES_A_select_encryption_mode(SI32_AES_0); + SI32_AES_A_enable_key_capture(SI32_AES_0); + + for (unsigned int i = 0; i < 4; i++) { + SI32_AES_A_write_datafifo(SI32_AES_0, 0x00000000); + } + + SI32_AES_A_clear_operation_complete_interrupt(SI32_AES_0); + SI32_AES_A_start_operation(SI32_AES_0); + while (!SI32_AES_A_is_operation_complete_interrupt_pending(SI32_AES_0)) { + /* This should not take long */ + } + + for (unsigned int i = 0; i < 4; i++) { + SI32_AES_A_read_datafifo(SI32_AES_0); + } + + switch (ctx->keylen) { + case 32: + decryption_key_word[7] = SI32_AES_0->HWKEY7.U32; + decryption_key_word[6] = SI32_AES_0->HWKEY6.U32; + __fallthrough; + case 24: + decryption_key_word[5] = SI32_AES_0->HWKEY5.U32; + decryption_key_word[4] = SI32_AES_0->HWKEY4.U32; + __fallthrough; + case 16: + decryption_key_word[3] = SI32_AES_0->HWKEY3.U32; + decryption_key_word[2] = SI32_AES_0->HWKEY2.U32; + decryption_key_word[1] = SI32_AES_0->HWKEY1.U32; + decryption_key_word[0] = SI32_AES_0->HWKEY0.U32; + break; + default: + LOG_ERR("Invalid key len: %" PRIu16, ctx->keylen); + return -EINVAL; + } + + return 0; +} + +static int crypto_si32_aes_set_key_size(const struct cipher_ctx *ctx) +{ + switch (ctx->keylen) { + case 32: + SI32_AES_A_select_key_size_256(SI32_AES_0); + break; + case 24: + SI32_AES_A_select_key_size_192(SI32_AES_0); + break; + case 16: + SI32_AES_A_select_key_size_128(SI32_AES_0); + break; + default: + LOG_ERR("Invalid key len: %" PRIu16, ctx->keylen); + return -EINVAL; + } + + return 0; +} + +static void assert_dma_settings_common(struct SI32_DMADESC_A_Struct *channel_descriptor) +{ + ARG_UNUSED(channel_descriptor); + + __ASSERT(channel_descriptor->CONFIG.SRCSIZE == 2, + "Source size (SRCSIZE) and destination size (DSTSIZE) are 2 for a word transfer."); + __ASSERT(channel_descriptor->CONFIG.DSTSIZE == 2, + "Source size (SRCSIZE) and destination size (DSTSIZE) are 2 for a word transfer."); + __ASSERT(channel_descriptor->CONFIG.RPOWER == 2, + "RPOWER = 2 (4 data transfers per transaction)."); +} + +static void assert_dma_settings_channel_rx(struct SI32_DMADESC_A_Struct *channel_descriptor) +{ + ARG_UNUSED(channel_descriptor); + + assert_dma_settings_common(channel_descriptor); + + __ASSERT(channel_descriptor->SRCEND.U32 == (uintptr_t)&SI32_AES_0->DATAFIFO, + "Source end pointer set to the DATAFIFO register."); + __ASSERT(channel_descriptor->CONFIG.DSTAIMD == 0b10, + "The DSTAIMD field should be set to 010b for word increments."); + __ASSERT(channel_descriptor->CONFIG.SRCAIMD == 0b11, + "The SRCAIMD field should be set to 011b for no increment."); +} + +static void assert_dma_settings_channel_tx(struct SI32_DMADESC_A_Struct *channel_descriptor) +{ + ARG_UNUSED(channel_descriptor); + + assert_dma_settings_common(channel_descriptor); + + __ASSERT(channel_descriptor->DSTEND.U32 == (uintptr_t)&SI32_AES_0->DATAFIFO, + "Destination end pointer set to the DATAFIFO register."); + __ASSERT(channel_descriptor->CONFIG.DSTAIMD == 0b11, + "The DSTAIMD field should be set to 011b for no increment."); + __ASSERT(channel_descriptor->CONFIG.SRCAIMD == 0b10, + "The SRCAIMD field should be set to 010b for word increments."); +} + +static void assert_dma_settings_channel_xor(struct SI32_DMADESC_A_Struct *channel_descriptor) +{ + ARG_UNUSED(channel_descriptor); + + assert_dma_settings_common(channel_descriptor); + + __ASSERT(channel_descriptor->DSTEND.U32 == (uintptr_t)&SI32_AES_0->XORFIFO, + "Destination end pointer set to the XORFIFO register."); + __ASSERT(channel_descriptor->CONFIG.DSTAIMD == 0b11, + "The DSTAIMD field should be set to 011b for no increment."); + __ASSERT(channel_descriptor->CONFIG.SRCAIMD == 0b10, + "The SRCAIMD field should be set to 010b for word increments."); +} + +/* Set up and start input (TX) DMA channel */ +static int crypto_si32_dma_setup_tx(struct cipher_pkt *pkt, unsigned int in_buf_offset) +{ + struct dma_block_config dma_block_cfg = {}; + const struct device *dma = DEVICE_DT_GET(DT_NODELABEL(dma)); + struct dma_config dma_cfg; + int ret; + + if (!pkt->in_len) { + LOG_WRN("Zero-sized data"); + return 0; + } + + if (pkt->in_len % 16) { + LOG_ERR("Data size must be 4-word aligned"); + return -EINVAL; + } + + dma_block_cfg.block_size = pkt->in_len - in_buf_offset; + dma_block_cfg.source_address = (uintptr_t)pkt->in_buf + in_buf_offset; + dma_block_cfg.source_addr_adj = 0b00; /* increment */ + dma_block_cfg.dest_address = (uintptr_t)&SI32_AES_0->DATAFIFO; + dma_block_cfg.dest_addr_adj = 0b10; /* no change (no increment) */ + + dma_cfg = (struct dma_config){ + .channel_direction = MEMORY_TO_PERIPHERAL, + .source_data_size = 4, /* SiM3x1xx limitation: must match dest_data_size */ + .dest_data_size = 4, /* DATAFIFO must be written to in word chunks (4 bytes) */ + .source_burst_length = AES_BLOCK_SIZE, + .dest_burst_length = AES_BLOCK_SIZE, + .block_count = 1, + .head_block = &dma_block_cfg, + .dma_callback = crypto_si32_dma_completed, + }; + + /* Stop channel to ensure we are not messing with an ongoing DMA operation */ + ret = dma_stop(dma, DMA_CHANNEL_ID_TX); + if (ret) { + LOG_ERR("TX DMA channel stop failed: %d", ret); + return ret; + } + + ret = dma_config(dma, DMA_CHANNEL_ID_TX, &dma_cfg); + if (ret) { + LOG_ERR("TX DMA channel setup failed: %d", ret); + return ret; + } + + ret = dma_start(dma, DMA_CHANNEL_ID_TX); + if (ret) { + LOG_ERR("TX DMA channel start failed: %d", ret); + return ret; + } + + /* Some assertions, helpful during development */ + { + struct SI32_DMADESC_A_Struct *d = + (struct SI32_DMADESC_A_Struct *)SI32_DMACTRL_0->BASEPTR.U32; + + /* Verify 12.5.2. General DMA Transfer Setup */ + assert_dma_settings_channel_tx(d + DMA_CHANNEL_ID_TX); + + /* Other checks */ + __ASSERT(SI32_DMACTRL_A_is_channel_enabled(SI32_DMACTRL_0, DMA_CHANNEL_ID_TX), + "The channel request mask (CHREQMCLR) must be cleared for the channel to " + "use peripheral transfers."); + + __ASSERT(SI32_DMAXBAR_0->DMAXBAR0.CH5SEL == 0b0001, + "0001: Service AES0 TX data requests."); + } + + return 0; +} + +/* Set up and start output (RX) DMA channel */ +static int crypto_si32_dma_setup_rx(struct cipher_pkt *pkt, unsigned int in_buf_offset, + unsigned int out_buf_offset) +{ + struct dma_block_config dma_block_cfg = {}; + const struct device *dma = DEVICE_DT_GET(DT_NODELABEL(dma)); + struct dma_config dma_cfg; + int ret; + uint32_t dest_address; + + if (!pkt->in_len) { + LOG_WRN("Zero-sized data"); + return 0; + } + + if (pkt->in_len % 16) { + LOG_ERR("Data size must be 4-word aligned"); + return -EINVAL; + } + + /* A NULL out_buf indicates an in-place operation. */ + if (pkt->out_buf == NULL) { + dest_address = (uintptr_t)pkt->in_buf; + } else { + if ((pkt->out_buf_max - out_buf_offset) < (pkt->in_len - in_buf_offset)) { + LOG_ERR("Output buf too small"); + return -ENOMEM; + } + + dest_address = (uintptr_t)(pkt->out_buf + out_buf_offset); + } + + /* Set up output (RX) DMA channel */ + dma_block_cfg.block_size = pkt->in_len - in_buf_offset; + dma_block_cfg.source_address = (uintptr_t)&SI32_AES_0->DATAFIFO; + dma_block_cfg.source_addr_adj = 0b10; /* no change */ + dma_block_cfg.dest_address = dest_address; + dma_block_cfg.dest_addr_adj = 0b00; /* increment */ + + dma_cfg = (struct dma_config){ + .channel_direction = PERIPHERAL_TO_MEMORY, + .source_data_size = 4, /* DATAFIFO must be read from in word chunks (4 bytes) */ + .dest_data_size = 4, /* SiM3x1xx limitation: must match source_data_size */ + .source_burst_length = AES_BLOCK_SIZE, + .dest_burst_length = AES_BLOCK_SIZE, + .block_count = 1, + .head_block = &dma_block_cfg, + .dma_callback = crypto_si32_dma_completed, + }; + + /* Stop channel to ensure we are not messing with an ongoing DMA operation */ + ret = dma_stop(dma, DMA_CHANNEL_ID_RX); + if (ret) { + LOG_ERR("RX DMA channel stop failed: %d", ret); + return ret; + } + + ret = dma_config(dma, DMA_CHANNEL_ID_RX, &dma_cfg); + if (ret) { + LOG_ERR("RX DMA channel setup failed: %d", ret); + return ret; + } + + ret = dma_start(dma, DMA_CHANNEL_ID_RX); + if (ret) { + LOG_ERR("RX DMA channel start failed: %d", ret); + return ret; + } + + /* Some assertions, helpful during development */ + { + struct SI32_DMADESC_A_Struct *d = + (struct SI32_DMADESC_A_Struct *)SI32_DMACTRL_0->BASEPTR.U32; + + /* As per 12.5.2. General DMA Transfer Setup, check input and output channel + * programming + */ + assert_dma_settings_channel_rx(d + DMA_CHANNEL_ID_RX); + + /* Other checks */ + __ASSERT(SI32_DMACTRL_A_is_channel_enabled(SI32_DMACTRL_0, DMA_CHANNEL_ID_RX), + "The channel request mask (CHREQMCLR) must be cleared for the channel to " + "use peripheral transfers."); + + __ASSERT(SI32_DMAXBAR_0->DMAXBAR0.CH6SEL == 0b0001, + "0001: Service AES0 RX data requests."); + } + + return 0; +} + +/* Set up and start XOR DMA channel */ +static int crypto_si32_dma_setup_xor(struct cipher_pkt *pkt) +{ + struct dma_block_config dma_block_cfg = {}; + const struct device *dma = DEVICE_DT_GET(DT_NODELABEL(dma)); + struct dma_config dma_cfg; + int ret; + + if (!pkt->in_len) { + LOG_WRN("Zero-sized data"); + return 0; + } + + if (pkt->in_len % 16) { + LOG_ERR("Data size must be 4-word aligned"); + return -EINVAL; + } + + dma_block_cfg.block_size = pkt->in_len; + dma_block_cfg.source_address = (uintptr_t)pkt->in_buf; + dma_block_cfg.source_addr_adj = 0b00; /* increment */ + dma_block_cfg.dest_address = (uintptr_t)&SI32_AES_0->XORFIFO; + dma_block_cfg.dest_addr_adj = 0b10; /* no change (no increment) */ + + dma_cfg = (struct dma_config){ + .channel_direction = MEMORY_TO_PERIPHERAL, + .source_data_size = 4, /* SiM3x1xx limitation: must match dest_data_size */ + .dest_data_size = 4, /* DATAFIFO must be written to in word chunks (4 bytes) */ + .source_burst_length = AES_BLOCK_SIZE, + .dest_burst_length = AES_BLOCK_SIZE, + .block_count = 1, + .head_block = &dma_block_cfg, + .dma_callback = crypto_si32_dma_completed, + }; + + /* Stop channel to ensure we are not messing with an ongoing DMA operation */ + ret = dma_stop(dma, DMA_CHANNEL_ID_XOR); + if (ret) { + LOG_ERR("XOR DMA channel stop failed: %d", ret); + return ret; + } + + ret = dma_config(dma, DMA_CHANNEL_ID_XOR, &dma_cfg); + if (ret) { + LOG_ERR("XOR DMA channel setup failed: %d", ret); + return ret; + } + + ret = dma_start(dma, DMA_CHANNEL_ID_XOR); + if (ret) { + LOG_ERR("XOR DMA channel start failed: %d", ret); + return ret; + } + + /* Some assertions, helpful during development */ + { + struct SI32_DMADESC_A_Struct *d = + (struct SI32_DMADESC_A_Struct *)SI32_DMACTRL_0->BASEPTR.U32; + + /* As per 12.5.2. General DMA Transfer Setup, check input and output channel + * programming + */ + assert_dma_settings_channel_xor(d + DMA_CHANNEL_ID_XOR); + + /* Other checks */ + __ASSERT(SI32_DMACTRL_A_is_channel_enabled(SI32_DMACTRL_0, DMA_CHANNEL_ID_XOR), + "The channel request mask (CHREQMCLR) must be cleared for the channel to " + "use peripheral transfers."); + + __ASSERT(SI32_DMAXBAR_0->DMAXBAR0.CH7SEL == 0b0001, + "0001: Service AES0 XOR data requests."); + } + + return 0; +} + +static int crypto_si32_aes_ecb_op(struct cipher_ctx *ctx, struct cipher_pkt *pkt, + const enum cipher_op op) +{ + struct crypto_session *session; + int ret; + + if (!ctx) { + LOG_WRN("Missing context"); + return -EINVAL; + } + + session = (struct crypto_session *)ctx->drv_sessn_state; + + if (!pkt) { + LOG_WRN("Missing packet"); + return -EINVAL; + } + + if (pkt->in_len % 16) { + LOG_ERR("Can't work on partial blocks"); + return -EINVAL; + } + + if (pkt->in_len > 16) { + LOG_ERR("Refusing to work on multiple ECB blocks"); + return -EINVAL; + } + + if (pkt->in_len == 0) { + LOG_DBG("Zero-sized packet"); + return 0; + } + + if ((ctx->flags & CAP_INPLACE_OPS) && (pkt->out_buf != NULL)) { + LOG_ERR("In-place must not have an out_buf"); + return -EINVAL; + } + + /* As per 12.6.1./12.6.2. Configuring the DMA for ECB Encryption/Decryption */ + + /* DMA Input Channel */ + ret = crypto_si32_dma_setup_tx(pkt, 0); + if (ret) { + return ret; + } + + /* DMA Output Channel */ + ret = crypto_si32_dma_setup_rx(pkt, 0, 0); + if (ret) { + return ret; + } + + /* AES Module */ + + /* 1. The XFRSIZE register should be set to N-1, where N is the number of 4-word blocks. */ + SI32_AES_A_write_xfrsize(SI32_AES_0, pkt->in_len / AES_BLOCK_SIZE - 1); + + switch (op) { + case CRYPTO_CIPHER_OP_ENCRYPT: + /* 2. The HWKEYx registers should be written with the desired key in little endian + * format. + */ + ret = crypto_si32_aes_set_key(ctx->key.bit_stream, ctx->keylen); + if (ret) { + return ret; + } + break; + case CRYPTO_CIPHER_OP_DECRYPT: + /* 2. The HWKEYx registers should be written with decryption key value + * (automatically generated in the HWKEYx registers after the encryption process). + */ + ret = crypto_si32_aes_set_key(session->decryption_key, ctx->keylen); + if (ret) { + return ret; + } + break; + default: + LOG_ERR("Unsupported cipher_op: %d", op); + return -ENOSYS; + } + + /* 3. The CONTROL register should be set as follows: */ + { + __ASSERT(SI32_AES_0->CONTROL.ERRIEN == 1, "a. ERRIEN set to 1."); + + /* KEYSIZE set to the appropriate number of bits for the key. */ + ret = crypto_si32_aes_set_key_size(ctx); + if (ret) { + return ret; + } + + switch (op) { + /* c. EDMD set to 1 for encryption. */ + case CRYPTO_CIPHER_OP_ENCRYPT: + SI32_AES_A_select_encryption_mode(SI32_AES_0); + break; + /* c. EDMD set to 1 for DEcryption. (documentation is wrong here) */ + case CRYPTO_CIPHER_OP_DECRYPT: + SI32_AES_A_select_decryption_mode(SI32_AES_0); + break; + default: + LOG_ERR("Unsupported cipher_op: %d", op); + return -ENOSYS; + } + + /* d. KEYCPEN set to 1 to enable key capture at the end of the transaction. */ + SI32_AES_A_enable_key_capture(SI32_AES_0); + + /* e. The HCBCEN, HCTREN, XOREN, BEN, SWMDEN bits should all be cleared to 0. */ + SI32_AES_A_exit_cipher_block_chaining_mode(SI32_AES_0); /* Clear HCBCEN */ + SI32_AES_A_exit_counter_mode(SI32_AES_0); /* Clear HCTREN */ + SI32_AES_A_select_xor_path_none(SI32_AES_0); /* Clear XOREN */ + SI32_AES_A_exit_bypass_hardware_mode(SI32_AES_0); /* Clear BEN */ + SI32_AES_A_select_dma_mode(SI32_AES_0); /* Clear SWMDEN*/ + } + + k_sem_reset(&crypto_si32_work_done); + + /* Once the DMA and AES settings have been set, the transfer should be started by writing 1 + * to the XFRSTA bit. + */ + SI32_AES_A_start_operation(SI32_AES_0); + + ret = k_sem_take(&crypto_si32_work_done, Z_TIMEOUT_MS(50)); /* TODO: Verify 50 ms */ + if (ret) { + LOG_ERR("AES operation timed out: %d", ret); + return -EIO; + } + + pkt->out_len = pkt->in_len; + + return 0; +} + +static int crypto_si32_aes_cbc_op(struct cipher_ctx *ctx, struct cipher_pkt *pkt, + const enum cipher_op op, const uint8_t iv[16]) +{ + struct crypto_session *session; + int ret; + unsigned int in_buf_offset = 0; + unsigned int out_buf_offset = 0; + + if (!ctx) { + LOG_WRN("Missing context"); + return -EINVAL; + } + + session = (struct crypto_session *)ctx->drv_sessn_state; + + if (!pkt) { + LOG_WRN("Missing packet"); + return -EINVAL; + } + + if (pkt->in_len % 16) { + LOG_ERR("Can't work on partial blocks"); + return -EINVAL; + } + + if (pkt->in_len == 0) { + LOG_WRN("Zero-sized packet"); + return 0; + } + + /* Prefix IV to/remove from ciphertext unless CAP_NO_IV_PREFIX is set. */ + if ((ctx->flags & CAP_NO_IV_PREFIX) == 0U) { + switch (op) { + case CRYPTO_CIPHER_OP_ENCRYPT: + if (pkt->out_buf_max < 16) { + LOG_ERR("Output buf too small"); + return -ENOMEM; + } + if (!pkt->out_buf) { + LOG_ERR("Missing output buf"); + return -EINVAL; + } + memcpy(pkt->out_buf, iv, 16); + out_buf_offset = 16; + break; + case CRYPTO_CIPHER_OP_DECRYPT: + in_buf_offset = 16; + break; + default: + LOG_ERR("Unsupported cipher_op: %d", op); + return -ENOSYS; + } + } + + /* As per 12.7.1.1./12.7.1.2. Configuring the DMA for Hardware CBC Encryption/Decryption */ + + /* DMA Input Channel */ + ret = crypto_si32_dma_setup_tx(pkt, in_buf_offset); + if (ret) { + return ret; + } + + /* DMA Output Channel */ + ret = crypto_si32_dma_setup_rx(pkt, in_buf_offset, out_buf_offset); + if (ret) { + return ret; + } + + /* Initialization Vector */ + + /* The initialization vector should be initialized to the HWCTRx registers. */ + SI32_AES_0->HWCTR0.U32 = *((uint32_t *)iv); + SI32_AES_0->HWCTR1.U32 = *((uint32_t *)iv + 1); + SI32_AES_0->HWCTR2.U32 = *((uint32_t *)iv + 2); + SI32_AES_0->HWCTR3.U32 = *((uint32_t *)iv + 3); + + /* AES Module */ + + /* 1. The XFRSIZE register should be set to N-1, where N is the number of 4-word blocks. */ + SI32_AES_A_write_xfrsize(SI32_AES_0, (pkt->in_len - in_buf_offset) / AES_BLOCK_SIZE - 1); + + switch (op) { + case CRYPTO_CIPHER_OP_ENCRYPT: + /* 2. The HWKEYx registers should be written with the desired key in little endian + * format. + */ + ret = crypto_si32_aes_set_key(ctx->key.bit_stream, ctx->keylen); + if (ret) { + return ret; + } + break; + case CRYPTO_CIPHER_OP_DECRYPT: + /* 2. The HWKEYx registers should be written with decryption key value + * (automatically generated in the HWKEYx registers after the encryption process). + */ + ret = crypto_si32_aes_set_key(session->decryption_key, ctx->keylen); + if (ret) { + return ret; + } + break; + default: + LOG_ERR("Unsupported cipher_op: %d", op); + return -ENOSYS; + } + + /* 3. The CONTROL register should be set as follows: */ + { + __ASSERT(SI32_AES_0->CONTROL.ERRIEN == 1, "a. ERRIEN set to 1."); + + /* b. KEYSIZE set to the appropriate number of bits for the key. */ + ret = crypto_si32_aes_set_key_size(ctx); + if (ret) { + return ret; + } + + switch (op) { + case CRYPTO_CIPHER_OP_ENCRYPT: + /* c. XOREN bits set to 01b to enable the XOR input path. */ + SI32_AES_A_select_xor_path_input(SI32_AES_0); + + /* d. EDMD set to 1 for encryption. */ + SI32_AES_A_select_encryption_mode(SI32_AES_0); + + /* e. KEYCPEN set to 1 to enable key capture at the end of the transaction. + */ + SI32_AES_A_enable_key_capture(SI32_AES_0); + break; + case CRYPTO_CIPHER_OP_DECRYPT: + /* c. XOREN set to 10b to enable the XOR output path. */ + SI32_AES_A_select_xor_path_output(SI32_AES_0); + + /* d. EDMD set to 0 for decryption. */ + SI32_AES_A_select_decryption_mode(SI32_AES_0); + + /* e. KEYCPEN set to 0 to disable key capture at the end of the transaction. + */ + SI32_AES_A_disable_key_capture(SI32_AES_0); + break; + default: + LOG_ERR("Unsupported cipher_op: %d", op); + return -ENOSYS; + } + + /* f. HCBCEN set to 1 to enable Hardware Cipher Block Chaining mode. */ + SI32_AES_A_enter_cipher_block_chaining_mode(SI32_AES_0); + + /* g. The HCTREN, BEN, SWMDEN bits should all be cleared to 0. */ + SI32_AES_A_exit_counter_mode(SI32_AES_0); /* Clear HCTREN */ + SI32_AES_A_exit_bypass_hardware_mode(SI32_AES_0); /* Clear BEN */ + SI32_AES_A_select_dma_mode(SI32_AES_0); /* Clear SWMDEN*/ + } + + k_sem_reset(&crypto_si32_work_done); + + /* Once the DMA and AES settings have been set, the transfer should be started by writing 1 + * to the XFRSTA bit. + */ + SI32_AES_A_start_operation(SI32_AES_0); + + ret = k_sem_take(&crypto_si32_work_done, Z_TIMEOUT_MS(50)); /* TODO: Verify 50 ms */ + if (ret) { + LOG_ERR("AES operation timed out: %d", ret); + return -EIO; + } + + /* Update passed IV buffer with new version */ + *((uint32_t *)iv) = SI32_AES_0->HWCTR0.U32; + *((uint32_t *)iv + 1) = SI32_AES_0->HWCTR1.U32; + *((uint32_t *)iv + 2) = SI32_AES_0->HWCTR2.U32; + *((uint32_t *)iv + 3) = SI32_AES_0->HWCTR3.U32; + + pkt->out_len = pkt->in_len - in_buf_offset + out_buf_offset; + + return 0; +} + +static int crypto_si32_aes_ctr_op(struct cipher_ctx *ctx, struct cipher_pkt *pkt, uint8_t iv[12]) +{ + struct crypto_session *session; + int ret; + + if (!ctx) { + LOG_WRN("Missing context"); + return -EINVAL; + } + + session = (struct crypto_session *)ctx->drv_sessn_state; + + if (!pkt) { + LOG_WRN("Missing packet"); + return -EINVAL; + } + + if (pkt->in_len % 16) { + LOG_ERR("Can't work on partial blocks"); + return -EINVAL; + } + + if (pkt->in_len == 0) { + LOG_WRN("Zero-sized packet"); + return 0; + } + + k_mutex_lock(&crypto_si32_in_use, K_FOREVER); + + /* 12.8.1./12.8.2. Configuring the DMA for CTR Encryption/Decryption */ + + /* DMA Output Channel */ + ret = crypto_si32_dma_setup_rx(pkt, 0, 0); + if (ret) { + goto out_unlock; + } + + /* DMA XOR Channel */ + ret = crypto_si32_dma_setup_xor(pkt); + if (ret) { + goto out_unlock; + } + + /* Initialization Vector */ + + /* The initialization vector should be initialized to the HWCTRx registers. */ + switch (ctx->mode_params.ctr_info.ctr_len) { + case 32: + SI32_AES_0->HWCTR3.U32 = sys_cpu_to_be32(session->current_ctr); + SI32_AES_0->HWCTR2.U32 = *((uint32_t *)iv + 2); + SI32_AES_0->HWCTR1.U32 = *((uint32_t *)iv + 1); + SI32_AES_0->HWCTR0.U32 = *((uint32_t *)iv); + break; + default: + LOG_ERR("Unsupported counter length: %" PRIu16, ctx->mode_params.ctr_info.ctr_len); + ret = -ENOSYS; + goto out_unlock; + } + + /* AES Module */ + + /* 1. The XFRSIZE register should be set to N-1, where N is the number of 4-word blocks. */ + SI32_AES_A_write_xfrsize(SI32_AES_0, pkt->in_len / AES_BLOCK_SIZE - 1); + + /* 2. The HWKEYx registers should be written with the desired key in little endian format. + */ + ret = crypto_si32_aes_set_key(ctx->key.bit_stream, ctx->keylen); + if (ret) { + goto out_unlock; + } + + /* 3. The CONTROL register should be set as follows: */ + { + __ASSERT(SI32_AES_0->CONTROL.ERRIEN == 1, "a. ERRIEN set to 1."); + + /* b. KEYSIZE set to the appropriate number of bits for the key. */ + ret = crypto_si32_aes_set_key_size(ctx); + if (ret) { + goto out_unlock; + } + + /* c. EDMD set to 1 for encryption. */ + SI32_AES_A_select_encryption_mode(SI32_AES_0); + + /* d. KEYCPEN set to 0 to disable key capture at the end of the transaction. */ + SI32_AES_A_disable_key_capture(SI32_AES_0); + + /* e. HCTREN set to 1 to enable Hardware Counter mode. */ + SI32_AES_A_enter_counter_mode(SI32_AES_0); + + /* f. XOREN set to 10b to enable the XOR output path. */ + SI32_AES_A_select_xor_path_output(SI32_AES_0); + + /* g. The HCBCEN, BEN, SWMDEN bits should all be cleared to 0. */ + SI32_AES_A_exit_cipher_block_chaining_mode(SI32_AES_0); /* Clear HCBCEN */ + SI32_AES_A_exit_bypass_hardware_mode(SI32_AES_0); /* Clear BEN */ + SI32_AES_A_select_dma_mode(SI32_AES_0); /* Clear SWMDEN*/ + } + + k_sem_reset(&crypto_si32_work_done); + + /* Once the DMA and AES settings have been set, the transfer should be started by writing 1 + * to the XFRSTA bit. + */ + SI32_AES_A_start_operation(SI32_AES_0); + + ret = k_sem_take(&crypto_si32_work_done, Z_TIMEOUT_MS(50)); /* TODO: Verify 50 ms */ + if (ret) { + LOG_ERR("AES operation timed out: %d", ret); + ret = -EIO; + goto out_unlock; + } + + /* Update session with new counter value */ + switch (ctx->mode_params.ctr_info.ctr_len) { + case 32: + session->current_ctr = sys_be32_to_cpu(SI32_AES_0->HWCTR3.U32); + break; + default: + LOG_ERR("Unsupported counter length: %" PRIu16, ctx->mode_params.ctr_info.ctr_len); + ret = -ENOSYS; + goto out_unlock; + } + + pkt->out_len = pkt->in_len; + +out_unlock: + k_mutex_unlock(&crypto_si32_in_use); + + return ret; +} + +static int crypto_si32_aes_ecb_encrypt(struct cipher_ctx *ctx, struct cipher_pkt *pkt) +{ + int ret; + + k_mutex_lock(&crypto_si32_in_use, K_FOREVER); + ret = crypto_si32_aes_ecb_op(ctx, pkt, CRYPTO_CIPHER_OP_ENCRYPT); + k_mutex_unlock(&crypto_si32_in_use); + + return ret; +} + +static int crypto_si32_aes_ecb_decrypt(struct cipher_ctx *ctx, struct cipher_pkt *pkt) +{ + int ret; + + k_mutex_lock(&crypto_si32_in_use, K_FOREVER); + ret = crypto_si32_aes_ecb_op(ctx, pkt, CRYPTO_CIPHER_OP_DECRYPT); + k_mutex_unlock(&crypto_si32_in_use); + + return ret; +} + +static int crypto_si32_aes_cbc_encrypt(struct cipher_ctx *ctx, struct cipher_pkt *pkt, uint8_t *iv) +{ + int ret; + + k_mutex_lock(&crypto_si32_in_use, K_FOREVER); + ret = crypto_si32_aes_cbc_op(ctx, pkt, CRYPTO_CIPHER_OP_ENCRYPT, iv); + k_mutex_unlock(&crypto_si32_in_use); + + return ret; +} + +static int crypto_si32_aes_cbc_decrypt(struct cipher_ctx *ctx, struct cipher_pkt *pkt, uint8_t *iv) +{ + int ret; + + k_mutex_lock(&crypto_si32_in_use, K_FOREVER); + ret = crypto_si32_aes_cbc_op(ctx, pkt, CRYPTO_CIPHER_OP_DECRYPT, iv); + k_mutex_unlock(&crypto_si32_in_use); + + return ret; +} + +static int crypto_si32_begin_session(const struct device *dev, struct cipher_ctx *ctx, + const enum cipher_algo algo, const enum cipher_mode mode, + const enum cipher_op op) +{ + int ret = 0; + struct crypto_session *session = 0; + + if (algo != CRYPTO_CIPHER_ALGO_AES) { + LOG_ERR("This driver supports only AES"); + return -ENOTSUP; + } + + if (!(ctx->flags & CAP_SYNC_OPS)) { + LOG_ERR("This driver supports only synchronous mode"); + return -ENOTSUP; + } + + if (ctx->key.bit_stream == NULL) { + LOG_ERR("No key provided"); + return -EINVAL; + } + + if (ctx->keylen != 16) { + LOG_ERR("Only AES-128 implemented"); + return -ENOSYS; + } + + switch (mode) { + case CRYPTO_CIPHER_MODE_CBC: + if (ctx->flags & CAP_INPLACE_OPS && (ctx->flags & CAP_NO_IV_PREFIX) == 0) { + LOG_ERR("In-place requires no IV prefix"); + return -EINVAL; + } + break; + case CRYPTO_CIPHER_MODE_CTR: + if (ctx->mode_params.ctr_info.ctr_len != 32U) { + LOG_ERR("Only 32 bit counter implemented"); + return -ENOSYS; + } + break; + case CRYPTO_CIPHER_MODE_ECB: + case CRYPTO_CIPHER_MODE_CCM: + case CRYPTO_CIPHER_MODE_GCM: + default: + break; + } + + k_mutex_lock(&crypto_si32_in_use, K_FOREVER); + + for (unsigned int i = 0; i < ARRAY_SIZE(crypto_si32_data.sessions); i++) { + if (crypto_si32_data.sessions[i].in_use) { + continue; + } + + LOG_INF("Claiming session %u", i); + session = &crypto_si32_data.sessions[i]; + break; + } + + if (!session) { + LOG_INF("All %d session(s) in use", CONFIG_CRYPTO_SI32_MAX_SESSION); + ret = -ENOSPC; + goto out; + } + + switch (op) { + case CRYPTO_CIPHER_OP_ENCRYPT: + switch (mode) { + case CRYPTO_CIPHER_MODE_ECB: + ctx->ops.block_crypt_hndlr = crypto_si32_aes_ecb_encrypt; + break; + case CRYPTO_CIPHER_MODE_CBC: + ctx->ops.cbc_crypt_hndlr = crypto_si32_aes_cbc_encrypt; + break; + case CRYPTO_CIPHER_MODE_CTR: + ctx->ops.ctr_crypt_hndlr = crypto_si32_aes_ctr_op; + session->current_ctr = 0; + break; + case CRYPTO_CIPHER_MODE_CCM: + case CRYPTO_CIPHER_MODE_GCM: + default: + LOG_ERR("Unsupported encryption mode: %d", mode); + ret = -ENOSYS; + goto out; + } + break; + case CRYPTO_CIPHER_OP_DECRYPT: + switch (mode) { + case CRYPTO_CIPHER_MODE_ECB: + ctx->ops.block_crypt_hndlr = crypto_si32_aes_ecb_decrypt; + ret = crypto_si32_aes_calc_decryption_key(ctx, session->decryption_key); + if (ret) { + goto out; + } + break; + case CRYPTO_CIPHER_MODE_CBC: + ctx->ops.cbc_crypt_hndlr = crypto_si32_aes_cbc_decrypt; + ret = crypto_si32_aes_calc_decryption_key(ctx, session->decryption_key); + if (ret) { + goto out; + } + break; + case CRYPTO_CIPHER_MODE_CTR: + ctx->ops.ctr_crypt_hndlr = crypto_si32_aes_ctr_op; + session->current_ctr = 0; + break; + case CRYPTO_CIPHER_MODE_CCM: + case CRYPTO_CIPHER_MODE_GCM: + default: + LOG_ERR("Unsupported decryption mode: %d", mode); + ret = -ENOSYS; + goto out; + } + break; + default: + LOG_ERR("Unsupported cipher_op: %d", op); + ret = -ENOSYS; + goto out; + } + + session->in_use = true; + ctx->drv_sessn_state = session; + +out: + k_mutex_unlock(&crypto_si32_in_use); + + return ret; +} + +static int crypto_si32_free_session(const struct device *dev, struct cipher_ctx *ctx) +{ + ARG_UNUSED(dev); + + if (!ctx) { + LOG_WRN("Missing context"); + return -EINVAL; + } + + struct crypto_session *session = (struct crypto_session *)ctx->drv_sessn_state; + + k_mutex_lock(&crypto_si32_in_use, K_FOREVER); + session->in_use = false; + k_mutex_unlock(&crypto_si32_in_use); + + return 0; +} + +/* AES only, no support for hashing */ +static const struct crypto_driver_api crypto_si32_api = { + .query_hw_caps = crypto_si32_query_hw_caps, + .cipher_begin_session = crypto_si32_begin_session, + .cipher_free_session = crypto_si32_free_session, +}; + +DEVICE_DT_INST_DEFINE(0, crypto_si32_init, NULL, NULL, NULL, POST_KERNEL, + CONFIG_CRYPTO_INIT_PRIORITY, &crypto_si32_api); From 7dc6dd9b8aab28fe571ad2582557b8c7e8fa72ab Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Sat, 11 May 2024 05:13:49 +0200 Subject: [PATCH 1646/4482] boards: silabs: sim3u1xx_dk: Enable crypto support Using the HW acceleration is much faster than either Mbed TLS or tinycrypt. Signed-off-by: Reto Schneider --- boards/silabs/dev_kits/sim3u1xx_dk/doc/index.rst | 2 ++ boards/silabs/dev_kits/sim3u1xx_dk/sim3u1xx_dk.dts | 9 +++++++++ boards/silabs/dev_kits/sim3u1xx_dk/sim3u1xx_dk.yaml | 1 + 3 files changed, 12 insertions(+) diff --git a/boards/silabs/dev_kits/sim3u1xx_dk/doc/index.rst b/boards/silabs/dev_kits/sim3u1xx_dk/doc/index.rst index cacc8da90ba10..da8bb3cac5e9b 100644 --- a/boards/silabs/dev_kits/sim3u1xx_dk/doc/index.rst +++ b/boards/silabs/dev_kits/sim3u1xx_dk/doc/index.rst @@ -49,6 +49,8 @@ The board configuration supports the following hardware features: +-----------+------------+-------------------------------------+ | SYSTICK | on-chip | systick | +-----------+------------+-------------------------------------+ +| AES | on-chip | crypto | ++-----------+------------+-------------------------------------+ | DMA | on-chip | dma | +-----------+------------+-------------------------------------+ | FLASH | on-chip | flash memory | diff --git a/boards/silabs/dev_kits/sim3u1xx_dk/sim3u1xx_dk.dts b/boards/silabs/dev_kits/sim3u1xx_dk/sim3u1xx_dk.dts index f55f5a667f9f2..dea9d6f0fb72b 100644 --- a/boards/silabs/dev_kits/sim3u1xx_dk/sim3u1xx_dk.dts +++ b/boards/silabs/dev_kits/sim3u1xx_dk/sim3u1xx_dk.dts @@ -109,3 +109,12 @@ }; }; }; + +&dma { + status = "okay"; + dma-channels = <8>; /* Crypto DMA channels have ID 5, 6, and 7 */ +}; + +&crypto { + status = "okay"; +}; diff --git a/boards/silabs/dev_kits/sim3u1xx_dk/sim3u1xx_dk.yaml b/boards/silabs/dev_kits/sim3u1xx_dk/sim3u1xx_dk.yaml index 3555255ae423e..13a20e8a73665 100644 --- a/boards/silabs/dev_kits/sim3u1xx_dk/sim3u1xx_dk.yaml +++ b/boards/silabs/dev_kits/sim3u1xx_dk/sim3u1xx_dk.yaml @@ -13,6 +13,7 @@ toolchain: - xtools - zephyr supported: + - crypto - dma - flash - gpio From e399bcc98a051525f3851e157cc00be93ddd9309 Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Fri, 26 Apr 2024 03:37:17 +0200 Subject: [PATCH 1647/4482] samples: drivers: crypto: Support SiM3Uxx This is needed to allow testing the SiM3U implementation using Twister. Signed-off-by: Reto Schneider --- .../drivers/crypto/boards/sim3u1xx_dk.overlay | 13 +++++++++++++ samples/drivers/crypto/sample.yaml | 16 ++++++++++++++++ samples/drivers/crypto/src/main.c | 2 ++ 3 files changed, 31 insertions(+) create mode 100644 samples/drivers/crypto/boards/sim3u1xx_dk.overlay diff --git a/samples/drivers/crypto/boards/sim3u1xx_dk.overlay b/samples/drivers/crypto/boards/sim3u1xx_dk.overlay new file mode 100644 index 0000000000000..b2776e3c69a8f --- /dev/null +++ b/samples/drivers/crypto/boards/sim3u1xx_dk.overlay @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2024 GARDENA GmbH + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&dma { + status = "okay"; +}; + +&crypto { + status = "okay"; +}; diff --git a/samples/drivers/crypto/sample.yaml b/samples/drivers/crypto/sample.yaml index c969bafa67ce3..b1dcdc8f194d0 100644 --- a/samples/drivers/crypto/sample.yaml +++ b/samples/drivers/crypto/sample.yaml @@ -65,3 +65,19 @@ tests: - ".*: ECB mode DECRYPT - Match" - ".*: CBC mode ENCRYPT - Match" - ".*: CBC mode DECRYPT - Match" + sample.drivers.crypto.si32: + tags: crypto + filter: dt_compat_enabled("silabs,si32-aes") + integration_platforms: + - sim3u1xx_dk + harness: console + harness_config: + type: multi_line + regex: + - ".*: Cipher Sample" + - ".*: ECB mode ENCRYPT - Match" + - ".*: ECB mode DECRYPT - Match" + - ".*: CBC mode ENCRYPT - Match" + - ".*: CBC mode DECRYPT - Match" + - ".*: CTR mode ENCRYPT - Match" + - ".*: CTR mode DECRYPT - Match" diff --git a/samples/drivers/crypto/src/main.c b/samples/drivers/crypto/src/main.c index 1d65cbd3c7706..ef0d248c36567 100644 --- a/samples/drivers/crypto/src/main.c +++ b/samples/drivers/crypto/src/main.c @@ -31,6 +31,8 @@ LOG_MODULE_REGISTER(main); #define CRYPTO_DEV_COMPAT nordic_nrf_ecb #elif DT_HAS_COMPAT_STATUS_OKAY(renesas_smartbond_crypto) #define CRYPTO_DEV_COMPAT renesas_smartbond_crypto +#elif CONFIG_CRYPTO_SI32 +#define CRYPTO_DEV_COMPAT silabs_si32_aes #else #error "You need to enable one crypto device" #endif From b9ab52fc5d3d2f1a7bf57fd05a4f1fc876f95dec Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Tue, 22 Oct 2024 15:46:15 +0200 Subject: [PATCH 1648/4482] MAINTAINERS: Add rugeGerritsen to BT host and ISO as collaborator Add Rubin Gerritsen as collaborator to the BT host and BT ISO. He has been very active in these areas. See for more info: https://github.com/zephyrproject-rtos/zephyr/issues/80233 List the host collaborators in alphabetical order while at it. Signed-off-by: Alberto Escolar Piedras --- MAINTAINERS.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 214cf9b78aa1a..7bb8c2062d440 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -359,8 +359,9 @@ Bluetooth Host: - alwa-nordic collaborators: - hermabe - - Thalley + - rugeGerritsen - sjanc + - Thalley - theob-pro files: - doc/connectivity/bluetooth/ @@ -506,6 +507,7 @@ Bluetooth ISO: collaborators: - jhedberg - kruithofa + - rugeGerritsen files: - include/zephyr/bluetooth/iso.h - doc/connectivity/bluetooth/api/shell/iso.rst From 66af846010132b4732e3227e2badd9f4518822e3 Mon Sep 17 00:00:00 2001 From: Tobias Pisani Date: Thu, 12 Sep 2024 11:16:14 +0200 Subject: [PATCH 1649/4482] drivers: ti: bq274xx: Do not wait for device on init when lazy-loading Before communicating with the device, the driver needs to wait 300ms. This moves all communication with the device from init to configure, such that this delay can be avoided on startup by using zephyr,lazy-load. Signed-off-by: Tobias Pisani --- drivers/sensor/ti/bq274xx/bq274xx.c | 44 +++++++++++++++-------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/drivers/sensor/ti/bq274xx/bq274xx.c b/drivers/sensor/ti/bq274xx/bq274xx.c index 13275638df5c4..cb9f8f423062a 100644 --- a/drivers/sensor/ti/bq274xx/bq274xx.c +++ b/drivers/sensor/ti/bq274xx/bq274xx.c @@ -391,11 +391,32 @@ static int bq274xx_gauge_configure(const struct device *dev) { const struct bq274xx_config *const config = dev->config; struct bq274xx_data *data = dev->data; - const struct bq274xx_regs *regs = data->regs; + const struct bq274xx_regs *regs; int ret; uint16_t designenergy_mwh, taperrate; uint8_t block[BQ27XXX_DM_SZ]; bool block_modified = false; + uint16_t id; + + if (data->regs == NULL) { + k_sleep(K_TIMEOUT_ABS_MS(POWER_UP_DELAY_MS)); + + ret = bq274xx_get_device_type(dev, &id); + if (ret < 0) { + LOG_ERR("Unable to get device ID"); + return -EIO; + } + + if (id == BQ27421_DEVICE_ID) { + data->regs = &bq27421_regs; + } else if (id == BQ27427_DEVICE_ID) { + data->regs = &bq27427_regs; + } else { + LOG_ERR("Unsupported device ID: 0x%04x", id); + return -ENOTSUP; + } + } + regs = data->regs; designenergy_mwh = (uint32_t)config->design_capacity * 37 / 10; /* x3.7 */ taperrate = config->design_capacity * 10 / config->taper_current; @@ -696,9 +717,7 @@ static int bq274xx_sample_fetch(const struct device *dev, enum sensor_channel ch static int bq274xx_gauge_init(const struct device *dev) { const struct bq274xx_config *const config = dev->config; - struct bq274xx_data *data = dev->data; - int ret; - uint16_t id; + int ret = 0; if (!device_is_ready(config->i2c.bus)) { LOG_ERR("I2C bus device not ready"); @@ -712,23 +731,6 @@ static int bq274xx_gauge_init(const struct device *dev) } #endif - k_sleep(K_TIMEOUT_ABS_MS(POWER_UP_DELAY_MS)); - - ret = bq274xx_get_device_type(dev, &id); - if (ret < 0) { - LOG_ERR("Unable to get device ID"); - return -EIO; - } - - if (id == BQ27421_DEVICE_ID) { - data->regs = &bq27421_regs; - } else if (id == BQ27427_DEVICE_ID) { - data->regs = &bq27427_regs; - } else { - LOG_ERR("Unsupported device ID: 0x%04x", id); - return -ENOTSUP; - } - #ifdef CONFIG_BQ274XX_TRIGGER ret = bq274xx_trigger_mode_init(dev); if (ret < 0) { From 9f0c618c459aa1e2a1cc35320063715d554ee37f Mon Sep 17 00:00:00 2001 From: Iuliana Prodan Date: Thu, 14 Mar 2024 16:19:46 +0200 Subject: [PATCH 1650/4482] samples: add number crunching using optimized library sample This sample executes some mathematical functions that can be used for audio processing like filtering (Fast Fourier Transform (FFT)) or echo cancellation (Least Mean Square (LMS) filter algorithm). This is an example that demonstrates how to include a proprietary static library into the Zephyr build system. The library is in an out of tree location. To use this sample, with an out of tree library, one needs to define an environment variable LIB_LOCATION. If that is not defined, a default Zephyr API is used instead. By default it uses CMSIS-DSP backend for math operations. In README one can find more information. Signed-off-by: Iuliana Prodan --- .../nxp/adsp/number_crunching/CMakeLists.txt | 39 ++ .../nxp/adsp/number_crunching/README.rst | 139 ++++++ .../nxp/adsp/number_crunching/include/input.h | 404 ++++++++++++++++++ .../adsp/number_crunching/include/math_ops.h | 127 ++++++ .../boards/nxp/adsp/number_crunching/prj.conf | 14 + .../nxp/adsp/number_crunching/sample.yaml | 20 + .../number_crunching/src/cmsis_dsp_wrapper.c | 78 ++++ .../nxp/adsp/number_crunching/src/main.c | 34 ++ .../nxp/adsp/number_crunching/src/math_ops.c | 144 +++++++ .../number_crunching/src/nature_dsp_wrapper.c | 94 ++++ 10 files changed, 1093 insertions(+) create mode 100644 samples/boards/nxp/adsp/number_crunching/CMakeLists.txt create mode 100644 samples/boards/nxp/adsp/number_crunching/README.rst create mode 100644 samples/boards/nxp/adsp/number_crunching/include/input.h create mode 100644 samples/boards/nxp/adsp/number_crunching/include/math_ops.h create mode 100644 samples/boards/nxp/adsp/number_crunching/prj.conf create mode 100644 samples/boards/nxp/adsp/number_crunching/sample.yaml create mode 100644 samples/boards/nxp/adsp/number_crunching/src/cmsis_dsp_wrapper.c create mode 100644 samples/boards/nxp/adsp/number_crunching/src/main.c create mode 100644 samples/boards/nxp/adsp/number_crunching/src/math_ops.c create mode 100644 samples/boards/nxp/adsp/number_crunching/src/nature_dsp_wrapper.c diff --git a/samples/boards/nxp/adsp/number_crunching/CMakeLists.txt b/samples/boards/nxp/adsp/number_crunching/CMakeLists.txt new file mode 100644 index 0000000000000..71e6f50d384ad --- /dev/null +++ b/samples/boards/nxp/adsp/number_crunching/CMakeLists.txt @@ -0,0 +1,39 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(number_crunching) + +# defines targets and sources +target_sources(app PRIVATE + src/main.c + src/math_ops.c +) +zephyr_include_directories(include) + +if(DEFINED ENV{LIB_LOCATION}) + message(STATUS "LIB_LOCATION environment variable defined") + + # contains a "proprietary" library we will link to + # this should set the INCLUDE_DIR, LIB_DIR and LIB_NAME variables + add_subdirectory($ENV{LIB_LOCATION} ${CMAKE_CURRENT_BINARY_DIR}/proprietary) + + # this is an example for NatureDSP backend + target_sources(app PRIVATE + src/nature_dsp_wrapper.c + ) + + if(INCLUDE_DIR) + zephyr_include_directories($ENV{LIB_LOCATION}/${INCLUDE_DIR}) + endif() + + if(LIB_DIR AND LIB_NAME) + zephyr_link_libraries($ENV{LIB_LOCATION}/${LIB_DIR}/${LIB_NAME}) + endif() +else() + message(STATUS "LIB_LOCATION environment variable NOT defined") + # this is an example for CMSIS-DSP backend + target_sources(app PRIVATE + src/cmsis_dsp_wrapper.c + ) +endif() diff --git a/samples/boards/nxp/adsp/number_crunching/README.rst b/samples/boards/nxp/adsp/number_crunching/README.rst new file mode 100644 index 0000000000000..4a4936fa60ce0 --- /dev/null +++ b/samples/boards/nxp/adsp/number_crunching/README.rst @@ -0,0 +1,139 @@ +.. zephyr:code-sample:: number_crunching + :name: Number crunching using optimized library + + Set up and use different backends for complex math operations. + +Overview +******** + +Number crunching sample does vector operations, Fast Fourier Transformation and filtering. +This example demonstrates how to include a proprietary static library into the Zephyr build system. +The library is in an out of tree location. + +To use this sample, with an out of tree library, one needs to define an environment variable +``LIB_LOCATION``. +In that location, one needs to have a ``CMakeLists.txt`` that defines: + +.. code-block:: cmake + + # Link with the external 3rd party library. + set(LIB_DIR "lib" CACHE STRING "") + set(INCLUDE_DIR "include" CACHE STRING "") + set(LIB_NAME "proprietary_lib.a" CACHE STRING "") + +If the environment variable ``LIB_LOCATION`` is not defined, a default Zephyr API is used instead. + +This sample executes some mathematical functions that can be used for audio processing like +filtering (Fast Fourier Transform (FFT)) or echo cancellation (Least Mean Square (LMS) filter +algorithm). + +The sample has: + +- :file:`main.c`: calls the generic math functions; +- :file:`math_ops.c`: executes the math functions, computes the cycles it took to execute and checks the output; +- :file:`cmsis_dsp_wrapper.c`: calls the exact math functions from CMSIS-DSP if :kconfig:option:`CONFIG_CMSIS_DSP` is defined and ``LIB_LOCATION`` is not defined; +- :file:`nature_dsp_wrapper`: if ``LIB_LOCATION`` is defined and points to an out of tree location where that NatureDSP lib and headers can be found, calls the exact math functions from NatureDSP library. + +If one wants to include a new backend it needs to create a new wrapper for that library or backend. + +Requirements +************ + +CMSIS-DSP is an optional module and needs to be added explicitly to your Zephyr workspace: + +.. code-block:: shell + + west config manifest.project-filter -- +cmsis-dsp + west update cmsis-dsp + +NatureDSP can be taken from Github: https://github.com/foss-xtensa/ndsplib-hifi4/tree/main. +To compile it use the steps described in the repository. + +Building and Running +********************* + +To build the sample with ``west`` for the ``imx8mp_evk/mimx8ml8/adsp``, which is the HiFi4 DSP core +from NXP i.MX8M Plus board, run: + +.. zephyr-app-commands:: + :zephyr-app: samples/boards/nxp/adsp/number_crunching/ + :board: imx8mp_evk/mimx8ml8/adsp + :goals: build run + :compact: + +An output example, for CMSIS-DSP is: + +.. code-block:: console + + *** Booting Zephyr OS build v3.7.0-2815-g9018e424d7a1 *** + + Proprietary library example! + + [Library Test] == Vector Sum test == + [Backend] CMSIS-DSP module + [Library Test] Vector Sum takes 6886 cycles + [Library Test] == Vector Sum test end with 1 == + + [Library Test] == Vector power sum test == + [Backend] CMSIS-DSP module + [Library Test] Vector power sum takes 6659 cycles + [Library Test] == Vector power sum test end with 1 == + + [Library Test] == Vector power sum test == + [Backend] CMSIS-DSP module + [Library Test] Vector power sum takes 3681 cycles + [Library Test] == Vector power sum test end == + + [Library Test] == Fast Fourier Transform on Real Data test == + [Backend] CMSIS-DSP module + [Library Test] Fast Fourier Transform on Real Data takes 67956 cycles + [Library Test] == Fast Fourier Transform on Real Data test end == + + [Library Test] == Bi-quad Real Block IIR test == + [Backend] CMSIS-DSP module + [Library Test] Bi-quad Real Block IIR takes 506702 cycles + [Library Test] == Bi-quad Real Block IIR end == + + [Library Test] == Least Mean Square (LMS) Filter for Real Data test == + [Backend] CMSIS-DSP module + [Library Test] Least Mean Square (LMS) Filter for Real Data test takes 184792 cycles + [Library Test] == Least Mean Square (LMS) Filter for Real Data test end == + +For NatureDSP, the output looks like this: + +.. code-block:: console + + *** Booting Zephyr OS build v3.7.0-2815-g9018e424d7a1 *** + + Proprietary library example! + + [Library Test] == Vector Sum test == + [Backend] NatureDSP library + [Library Test] Vector Sum takes 3829 cycles + [Library Test] == Vector Sum test end with 1 == + + [Library Test] == Vector power sum test == + [Backend] NatureDSP library + [Library Test] Vector power sum takes 2432 cycles + [Library Test] == Vector power sum test end with 1 == + + [Library Test] == Vector power sum test == + [Backend] NatureDSP library + [Library Test] Vector power sum takes 2594 cycles + [Library Test] == Vector power sum test end == + + [Library Test] == Fast Fourier Transform on Real Data test == + [Backend] NatureDSP library + [Library Test] Fast Fourier Transform on Real Data takes 3338 cycles + [Library Test] == Fast Fourier Transform on Real Data test end == + + [Library Test] == Bi-quad Real Block IIR test == + [Backend] NatureDSP library + [Library Test] Bi-quad Real Block IIR takes 13501 cycles + [Library Test] == Bi-quad Real Block IIR end == + + [Library Test] == Least Mean Square (LMS) Filter for Real Data test == + [Backend] NatureDSP library + [Backend] NatureDSP library + [Library Test] Least Mean Square (LMS) Filter for Real Data test takes 7724 cycles + [Library Test] == Least Mean Square (LMS) Filter for Real Data test end == diff --git a/samples/boards/nxp/adsp/number_crunching/include/input.h b/samples/boards/nxp/adsp/number_crunching/include/input.h new file mode 100644 index 0000000000000..68500716dadac --- /dev/null +++ b/samples/boards/nxp/adsp/number_crunching/include/input.h @@ -0,0 +1,404 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define ABS_ERROR_THRESH_Q15 ((int16_t)2) +#define VEC_LENGTH 256 + +static const int16_t in_a[VEC_LENGTH] = { + 0x0EB1, 0xD7DA, 0xDFC2, 0x2DDA, 0xAEB8, 0x1A8C, 0x34D0, 0xC949, + 0x19FF, 0x1AFC, 0xD67E, 0x2639, 0x1546, 0xF32D, 0x2A82, 0xB79E, + 0x1317, 0xEAF2, 0xCBD9, 0xC454, 0x42FD, 0xBB89, 0x9B4F, 0xCE5C, + 0x09A1, 0xDFC2, 0xD780, 0x2B2C, 0x0FDB, 0xC69C, 0x5D9B, 0xBC82, + 0x2794, 0xC287, 0x152B, 0xDA69, 0x2BE1, 0xE9BB, 0xD5EE, 0xC7C4, + 0xBCDA, 0xC828, 0x19B1, 0x5F41, 0x5146, 0x00F0, 0xDEF6, 0x2A44, + 0xCD0A, 0xE918, 0xF4D0, 0xD863, 0x241F, 0xE030, 0x26F3, 0x1ACB, + 0x245C, 0x047C, 0x9433, 0x2BF5, 0x2F0F, 0x40E5, 0xC00D, 0x849C, + 0x215D, 0xDE1B, 0x264A, 0x311D, 0x0C88, 0x1028, 0x2D8F, 0xCE0E, + 0x1B43, 0x5529, 0x2914, 0xE215, 0x0C95, 0xF727, 0xDF21, 0xD12E, + 0xBF74, 0xBFB5, 0xC4B0, 0xCDBB, 0xE3D0, 0xFAF9, 0x2579, 0xE9F5, + 0xE00D, 0xE3B7, 0x2FE5, 0xE7A2, 0xE72C, 0x4C12, 0x156E, 0x03A9, + 0xE767, 0x14B9, 0x8F36, 0x54D3, 0xF8CF, 0xC5F2, 0xE3E2, 0x3EEB, + 0x054A, 0x6482, 0x013C, 0xFF6D, 0x078F, 0xA20A, 0xEF63, 0xCBAB, + 0xC222, 0xA967, 0x3F6B, 0xFAFE, 0x1498, 0xF9D3, 0xC2C3, 0xCD2C, + 0x1B37, 0xA9E8, 0xF8A4, 0xD3A6, 0xD238, 0x55EC, 0xF7FA, 0x007C, + 0xC1BF, 0x161F, 0x8000, 0x273D, 0xEEC7, 0xFDDA, 0xD41C, 0x51C4, + 0x1697, 0x3C98, 0x2E62, 0xC85D, 0x01FF, 0xC356, 0xBCC5, 0xF6C0, + 0xC2FB, 0x1CC0, 0xC736, 0xED5C, 0x1B3C, 0xCEDC, 0xDC71, 0xD699, + 0x895A, 0xF44E, 0xFEAB, 0xB470, 0xE176, 0xC915, 0x23AD, 0xDBDE, + 0x2579, 0xB028, 0xF293, 0xF1D3, 0x2BE9, 0x3FE0, 0x5143, 0x8BB5, + 0xD9A9, 0xC304, 0x5BE4, 0xBD39, 0xF24A, 0xC721, 0xE044, 0xE5EB, + 0x3015, 0x22EB, 0x0FC5, 0xF766, 0xCAEC, 0x356E, 0xF105, 0xE3F6, + 0xC69B, 0xC858, 0x1EF3, 0xD29A, 0xF220, 0x156B, 0x0625, 0xD1BA, + 0x0DF9, 0x6A80, 0xECF5, 0xBBC4, 0xE8B3, 0x1DBD, 0x27ED, 0x43D5, + 0x38E0, 0x0942, 0x0DB3, 0x93F4, 0xF640, 0xBC17, 0xFB75, 0xB565, + 0x39FD, 0x037E, 0x533F, 0x3981, 0x2FC2, 0xA54D, 0x2DAC, 0x403B, + 0xD1AC, 0x2397, 0x06C3, 0xDD46, 0x9F4C, 0xF716, 0xD4F2, 0xFEEA, + 0xCE26, 0xF1C9, 0x376E, 0x2D6C, 0x1DA1, 0x1ADF, 0x2DB9, 0x1E02, + 0xFA30, 0x0633, 0x4356, 0x06F1, 0x0751, 0x2881, 0x1D47, 0x2D8C, + 0xA430, 0xB60E, 0x9CBD, 0xF925, 0xF90C, 0x235A, 0xDAAC, 0x3B2B, + 0x112A, 0x8F09, 0x00B9, 0xB234, 0xA386, 0xD619, 0x20AA, 0x5063}; + +static const int16_t in_b[VEC_LENGTH] = { + 0xF977, 0xF484, 0xB38D, 0xC049, 0x127F, 0xEE0D, 0x5183, 0x1CFF, + 0x2EC8, 0x7FFF, 0x44B4, 0xD9AD, 0x4410, 0x27AA, 0x0313, 0xC597, + 0xA23C, 0xFCF7, 0xF6CA, 0x0540, 0x3DD7, 0x4BA0, 0xCB04, 0x4650, + 0x5117, 0x0F7A, 0x16B7, 0x0052, 0x04F6, 0xCBB2, 0xD270, 0xFCD5, + 0xDFF0, 0x389E, 0x2413, 0xD405, 0x08F1, 0xF872, 0xABD2, 0x13D4, + 0x86AB, 0xDECA, 0xEFE1, 0x04D6, 0x2F20, 0xE4F2, 0x74C9, 0xFAFF, + 0x1E5B, 0x4BBC, 0xE50F, 0x26A3, 0xF12F, 0x9774, 0x0465, 0x0FE1, + 0xB3DD, 0xFF6A, 0x2B48, 0xD882, 0xD6B7, 0x077A, 0xE7AC, 0x94B7, + 0x03BB, 0x2E0B, 0xEE40, 0xED35, 0xEC88, 0x3365, 0x60B5, 0x249E, + 0x03B7, 0xCCB7, 0xB6E0, 0xB83B, 0xEB34, 0xEC7F, 0xEC20, 0x037F, + 0x29F7, 0x9EE0, 0x0079, 0xF08C, 0xE025, 0xE064, 0xF44A, 0x28BF, + 0xDB1A, 0x11F0, 0xFF16, 0x5896, 0x01D3, 0x2546, 0x0D96, 0xE7A4, + 0xFBAF, 0xC158, 0x1BD0, 0x1349, 0x0F56, 0x3C3A, 0x0971, 0x0144, + 0x0103, 0xD605, 0x5F13, 0xD660, 0x56D8, 0x281A, 0xCB9C, 0xF087, + 0x0DF1, 0xE910, 0x00A3, 0xDB1F, 0xEF24, 0xCB3C, 0xFDC3, 0x33BF, + 0xC071, 0x2387, 0x1D00, 0xFCAB, 0xDEAF, 0xD8BE, 0x50D2, 0xA530, + 0x3BED, 0x33D0, 0xC7B0, 0x8906, 0x1389, 0x5832, 0x12A8, 0xCD6B, + 0x3FB1, 0x2AF3, 0x1438, 0x230A, 0x1D37, 0xDBE5, 0xC794, 0xCF49, + 0xBD1F, 0x0352, 0xDDEF, 0xF71B, 0xF034, 0x69E3, 0xE115, 0xD0FB, + 0x14C9, 0xF522, 0xDF36, 0xE814, 0xE306, 0x2CE3, 0xDB81, 0x6658, + 0x02D7, 0x1E97, 0xBA82, 0xEE1A, 0x5C73, 0x2956, 0xBC37, 0xF3FA, + 0xD52D, 0xFE74, 0xA370, 0xE439, 0x007A, 0x0138, 0xF675, 0xDAB6, + 0xFB95, 0xE5D5, 0xF490, 0xF4FD, 0x0BD8, 0x58FF, 0xE5FA, 0x1DC2, + 0x0DB3, 0xD10F, 0x006F, 0xC3FA, 0xE69E, 0xFF03, 0x01C4, 0x2F8A, + 0xE336, 0x05F5, 0xD870, 0xDF1E, 0x532B, 0x2F9B, 0xED67, 0xB192, + 0xF663, 0xC955, 0xD832, 0xCB4F, 0x060B, 0x136A, 0x3EC8, 0xCBF4, + 0xF509, 0x480F, 0x22B4, 0xE9D0, 0x3610, 0x35F0, 0xD66A, 0xC10A, + 0x3476, 0x0C80, 0x002B, 0xEF29, 0x02A2, 0x8E39, 0xED70, 0x0D5D, + 0x8AF0, 0x1793, 0x1CD9, 0xE7A7, 0x45C4, 0x422D, 0xCF10, 0x3A84, + 0xF767, 0xC650, 0xF766, 0xCAA0, 0x2688, 0x1341, 0x3C45, 0x492B, + 0x01EE, 0x156F, 0x0862, 0x28AF, 0x42C1, 0xE27E, 0x0164, 0x8BC3, + 0x678D, 0xEECA, 0xCAF7, 0xE0AD, 0x15EB, 0x9059, 0xCAB6, 0xFE6E}; + +static const int16_t ref_add[VEC_LENGTH] = { + 0x0827, 0xCC5E, 0x934F, 0xEE23, 0xC137, 0x0899, 0x7FFF, 0xE647, + 0x48C7, 0x7FFF, 0x1B32, 0xFFE7, 0x5956, 0x1AD7, 0x2D96, 0x8000, + 0xB553, 0xE7E9, 0xC2A3, 0xC994, 0x7FFF, 0x072A, 0x8000, 0x14AC, + 0x5AB8, 0xEF3B, 0xEE37, 0x2B7E, 0x14D1, 0x924E, 0x300B, 0xB957, + 0x0784, 0xFB26, 0x393E, 0xAE6E, 0x34D3, 0xE22D, 0x81C0, 0xDB98, + 0x8000, 0xA6F2, 0x0992, 0x6417, 0x7FFF, 0xE5E2, 0x53BF, 0x2543, + 0xEB65, 0x34D3, 0xD9DF, 0xFF06, 0x154E, 0x8000, 0x2B58, 0x2AAC, + 0xD839, 0x03E6, 0xBF7B, 0x0477, 0x05C7, 0x485F, 0xA7B9, 0x8000, + 0x2518, 0x0C26, 0x148A, 0x1E53, 0xF910, 0x438D, 0x7FFF, 0xF2AD, + 0x1EFA, 0x21E0, 0xDFF5, 0x9A50, 0xF7C9, 0xE3A5, 0xCB41, 0xD4AD, + 0xE96C, 0x8000, 0xC529, 0xBE46, 0xC3F5, 0xDB5D, 0x19C2, 0x12B5, + 0xBB27, 0xF5A7, 0x2EFA, 0x4038, 0xE8FF, 0x7159, 0x2304, 0xEB4D, + 0xE317, 0xD611, 0xAB06, 0x681C, 0x0825, 0x022B, 0xED53, 0x402F, + 0x064D, 0x3A86, 0x6050, 0xD5CD, 0x5E68, 0xCA23, 0xBAFF, 0xBC32, + 0xD013, 0x9277, 0x400E, 0xD61D, 0x03BC, 0xC50F, 0xC086, 0x00EB, + 0xDBA8, 0xCD6F, 0x15A4, 0xD051, 0xB0E7, 0x2EAA, 0x48CC, 0xA5AC, + 0xFDAC, 0x49EF, 0x8000, 0xB044, 0x0250, 0x560C, 0xE6C4, 0x1F2F, + 0x5648, 0x678B, 0x429A, 0xEB67, 0x1F37, 0x9F3B, 0x8458, 0xC609, + 0x801A, 0x2012, 0xA525, 0xE477, 0x0B71, 0x38BF, 0xBD86, 0xA794, + 0x9E23, 0xE970, 0xDDE1, 0x9C84, 0xC47B, 0xF5F8, 0xFF2E, 0x4237, + 0x2851, 0xCEBF, 0xAD15, 0xDFED, 0x7FFF, 0x6936, 0x0D7A, 0x8000, + 0xAED7, 0xC178, 0xFF54, 0xA172, 0xF2C4, 0xC859, 0xD6B9, 0xC0A1, + 0x2BAA, 0x08C0, 0x0455, 0xEC63, 0xD6C4, 0x7FFF, 0xD6FF, 0x01B8, + 0xD44E, 0x9968, 0x1F62, 0x9693, 0xD8BE, 0x146E, 0x07E9, 0x0143, + 0xF12F, 0x7075, 0xC565, 0x9AE2, 0x3BDE, 0x4D58, 0x1554, 0xF567, + 0x2F43, 0xD297, 0xE5E5, 0x8000, 0xFC4B, 0xCF81, 0x3A3C, 0x8158, + 0x2F06, 0x4B8E, 0x75F2, 0x2351, 0x65D3, 0xDB3E, 0x0417, 0x0145, + 0x0623, 0x3017, 0x06EE, 0xCC6F, 0xA1ED, 0x854F, 0xC262, 0x0C47, + 0x8000, 0x095C, 0x5447, 0x1513, 0x6365, 0x5D0C, 0xFCC9, 0x5886, + 0xF197, 0xCC83, 0x3ABC, 0xD191, 0x2DD9, 0x3BC2, 0x598C, 0x76B7, + 0xA61E, 0xCB7E, 0xA51F, 0x21D4, 0x3BCD, 0x05D8, 0xDC10, 0xC6EE, + 0x78B7, 0x8000, 0xCBB0, 0x92E1, 0xB971, 0x8000, 0xEB5F, 0x4ED1}; + +static const int64_t ref_power_16[] = {44135408683}; + +#define FFT_LENGTH 512 + +int32_t fft_in[FFT_LENGTH * 2]; +int32_t fft_out[FFT_LENGTH * 2]; + +#define IIR_LENGTH 1024 + +static const int32_t iir_in[IIR_LENGTH] = { + 1073741824, 1073721611, 1073660973, 1073559912, 1073418433, + 1073236539, 1073014240, 1072751541, 1072448454, 1072104991, + 1071721163, 1071296985, 1070832474, 1070327646, 1069782521, + 1069197120, 1068571463, 1067905576, 1067199483, 1066453210, + 1065666786, 1064840240, 1063973603, 1063066908, 1062120190, + 1061133483, 1060106826, 1059040255, 1057933813, 1056787540, + 1055601479, 1054375676, 1053110176, 1051805027, 1050460278, + 1049075980, 1047652185, 1046188947, 1044686319, 1043144360, + 1041563128, 1039942681, 1038283080, 1036584389, 1034846672, + 1033069992, 1031254419, 1029400019, 1027506863, 1025575021, + 1023604568, 1021595576, 1019548122, 1017462282, 1015338136, + 1013175762, 1010975244, 1008736662, 1006460102, 1004145650, + 1001793392, 999403417, 996975815, 994510677, 992008097, + 989468168, 986890986, 984276648, 981625253, 978936900, + 976211691, 973449728, 970651115, 967815958, 964944363, + 962036438, 959092294, 956112040, 953095789, 950043654, + 946955751, 943832195, 940673105, 937478599, 934248797, + 930983821, 927683795, 924348841, 920979087, 917574658, + 914135683, 910662291, 907154613, 903612782, 900036930, + 896427192, 892783704, 889106603, 885396028, 881652118, + 877875015, 874064860, 870221797, 866345970, 862437526, + 858496612, 854523376, 850517968, 846480538, 842411239, + 838310223, 834177646, 830013662, 825818428, 821592103, + 817334846, 813046816, 808728176, 804379087, 799999714, + 795590221, 791150775, 786681543, 782182692, 777654393, + 773096815, 768510131, 763894513, 759250135, 754577171, + 749875798, 745146192, 740388532, 735602997, 730789767, + 725949023, 721080948, 716185724, 711263536, 706314570, + 701339011, 696337047, 691308867, 686254659, 681174614, + 676068923, 670937779, 665781374, 660599903, 655393561, + 650162543, 644907047, 639627271, 634323413, 628995673, + 623644252, 618269352, 612871173, 607449921, 602005798, + 596539010, 591049763, 585538263, 580004717, 574449335, + 568872326, 563273898, 557654264, 552013634, 546352221, + 540670239, 534967900, 529245420, 523503015, 517740900, + 511959292, 506158409, 500338470, 494499693, 488642298, + 482766507, 476872539, 470960618, 465030965, 459083804, + 453119359, 447137854, 441139515, 435124566, 429093236, + 423045751, 416982338, 410903226, 404808644, 398698821, + 392573987, 386434373, 380280210, 374111730, 367929164, + 361732746, 355522709, 349299287, 343062714, 336813225, + 330551055, 324276440, 317989617, 311690821, 305380290, + 299058261, 292724974, 286380665, 280025574, 273659941, + 267284004, 260898005, 254502182, 248096778, 241682033, + 235258189, 228825487, 222384171, 215934481, 209476662, + 203010957, 196537608, 190056859, 183568955, 177074140, + 170572658, 164064754, 157550673, 151030660, 144504961, + 137973822, 131437487, 124896205, 118350220, 111799779, + 105245129, 98686517, 92124189, 85558393, 78989376, + 72417384, 65842666, 59265470, 52686041, 46104630, + 39521482, 32936847, 26350971, 19764104, 13176492, + 6588384, 28, -6588327, -13176434, -19764046, + -26350914, -32936789, -39521425, -46104572, -52685984, + -59265412, -65842609, -72417327, -78989318, -85558336, + -92124132, -98686460, -105245072, -111799722, -118350163, + -124896148, -131437430, -137973764, -144504904, -151030603, + -157550616, -164064697, -170572601, -177074083, -183568898, + -190056802, -196537551, -203010900, -209476606, -215934425, + -222384114, -228825431, -235258133, -241681977, -248096722, + -254502126, -260897949, -267283949, -273659885, -280025519, + -286380610, -292724918, -299058206, -305380235, -311690766, + -317989562, -324276386, -330551001, -336813171, -343062660, + -349299233, -355522655, -361732692, -367929110, -374111676, + -380280156, -386434319, -392573933, -398698767, -404808591, + -410903173, -416982285, -423045698, -429093183, -435124514, + -441139462, -447137802, -453119307, -459083752, -465030913, + -470960566, -476872488, -482766455, -488642247, -494499642, + -500338419, -506158358, -511959241, -517740849, -523502964, + -529245370, -534967850, -540670189, -546352172, -552013585, + -557654215, -563273849, -568872277, -574449287, -580004669, + -585538214, -591049714, -596538962, -602005750, -607449873, + -612871126, -618269305, -623644206, -628995627, -634323367, + -639627225, -644907001, -650162497, -655393515, -660599858, + -665781329, -670937734, -676068879, -681174570, -686254615, + -691308823, -696337004, -701338968, -706314527, -711263493, + -716185681, -721080905, -725948981, -730789725, -735602955, + -740388491, -745146151, -749875757, -754577130, -759250094, + -763894473, -768510091, -773096775, -777654353, -782182653, + -786681504, -791150736, -795590183, -799999676, -804379049, + -808728138, -813046778, -817334808, -821592066, -825818391, + -830013625, -834177609, -838310187, -842411203, -846480503, + -850517933, -854523341, -858496578, -862437492, -866345936, + -870221763, -874064826, -877874981, -881652085, -885395995, + -889106571, -892783672, -896427160, -900036898, -903612751, + -907154582, -910662260, -914135653, -917574628, -920979057, + -924348812, -927683766, -930983793, -934248769, -937478571, + -940673077, -943832168, -946955724, -950043627, -953095762, + -956112014, -959092268, -962036413, -964944338, -967815933, + -970651091, -973449704, -976211667, -978936877, -981625230, + -984276625, -986890963, -989468145, -992008075, -994510655, + -996975793, -999403395, -1001793371, -1004145629, -1006460082, + -1008736642, -1010975224, -1013175743, -1015338117, -1017462264, + -1019548104, -1021595558, -1023604550, -1025575004, -1027506846, + -1029400002, -1031254403, -1033069977, -1034846656, -1036584374, + -1038283066, -1039942666, -1041563114, -1043144347, -1044686306, + -1046188934, -1047652173, -1049075968, -1050460266, -1051805016, + -1053110165, -1054375665, -1055601469, -1056787530, -1057933803, + -1059040246, -1060106816, -1061133474, -1062120182, -1063066900, + -1063973595, -1064840232, -1065666778, -1066453203, -1067199476, + -1067905570, -1068571458, -1069197114, -1069782516, -1070327641, + -1070832469, -1071296981, -1071721159, -1072104987, -1072448452, + -1072751539, -1073014237, -1073236538, -1073418431, -1073559911, + -1073660972, -1073721610, -1073741823, -1073721611, -1073660973, + -1073559913, -1073418434, -1073236541, -1073014242, -1072751544, + -1072448457, -1072104994, -1071721166, -1071296989, -1070832478, + -1070327651, -1069782526, -1069197125, -1068571469, -1067905582, + -1067199489, -1066453216, -1065666793, -1064840247, -1063973611, + -1063066917, -1062120198, -1061133492, -1060106835, -1059040265, + -1057933823, -1056787550, -1055601490, -1054375687, -1053110187, + -1051805039, -1050460290, -1049075993, -1047652198, -1046188959, + -1044686333, -1043144374, -1041563142, -1039942695, -1038283095, + -1036584404, -1034846687, -1033070008, -1031254435, -1029400035, + -1027506879, -1025575038, -1023604585, -1021595594, -1019548140, + -1017462301, -1015338155, -1013175781, -1010975263, -1008736682, + -1006460122, -1004145670, -1001793412, -999403438, -996975836, + -994510699, -992008119, -989468190, -986891009, -984276671, + -981625277, -978936924, -976211715, -973449753, -970651140, + -967815983, -964944388, -962036464, -959092320, -956112066, + -953095815, -950043681, -946955778, -943832223, -940673133, + -937478627, -934248825, -930983850, -927683824, -924348871, + -920979116, -917574688, -914135713, -910662321, -907154644, + -903612813, -900036961, -896427223, -892783736, -889106635, + -885396060, -881652151, -877875048, -874064893, -870221830, + -866346004, -862437561, -858496647, -854523411, -850518003, + -846480574, -842411274, -838310259, -834177682, -830013698, + -825818465, -821592140, -817334883, -813046854, -808728213, + -804379125, -799999752, -795590260, -791150814, -786681582, + -782182732, -777654433, -773096855, -768510171, -763894553, + -759250175, -754577212, -749875839, -745146234, -740388574, + -735603039, -730789809, -725949066, -721080991, -716185767, + -711263580, -706314613, -701339055, -696337091, -691308911, + -686254703, -681174659, -676068968, -670937824, -665781419, + -660599948, -655393606, -650162589, -644907093, -639627317, + -634323460, -628995720, -623644299, -618269399, -612871220, + -607449968, -602005845, -596539058, -591049811, -585538311, + -580004766, -574449384, -568872374, -563273947, -557654313, + -552013683, -546352271, -540670288, -534967950, -529245470, + -523503065, -517740950, -511959342, -506158460, -500338521, + -494499744, -488642350, -482766558, -476872591, -470960670, + -465031017, -459083856, -453119411, -447137906, -441139567, + -435124619, -429093289, -423045804, -416982391, -410903279, + -404808697, -398698874, -392574041, -386434427, -380280264, + -374111784, -367929218, -361732801, -355522764, -349299342, + -343062769, -336813280, -330551110, -324276495, -317989672, + -311690876, -305380345, -299058317, -292725029, -286380721, + -280025630, -273659997, -267284060, -260898060, -254502238, + -248096834, -241682089, -235258245, -228825544, -222384227, + -215934538, -209476719, -203011013, -196537664, -190056916, + -183569012, -177074196, -170572714, -164064810, -157550729, + -151030717, -144505018, -137973879, -131437545, -124896262, + -118350277, -111799837, -105245187, -98686574, -92124247, + -85558450, -78989433, -72417442, -65842724, -59265527, + -52686099, -46104687, -39521540, -32936904, -26351029, + -19764161, -13176549, -6588442, -86, 6588269, + 13176377, 19763989, 26350856, 32936732, 39521367, + 46104515, 52685927, 59265355, 65842551, 72417269, + 78989261, 85558278, 92124075, 98686402, 105245015, + 111799665, 118350106, 124896091, 131437373, 137973707, + 144504847, 151030546, 157550559, 164064640, 170572544, + 177074026, 183568842, 190056746, 196537494, 203010844, + 209476550, 215934369, 222384058, 228825375, 235258077, + 241681921, 248096666, 254502070, 260897893, 267283893, + 273659830, 280025463, 286380554, 292724863, 299058151, + 305380179, 311690711, 317989507, 324276331, 330550946, + 336813116, 343062605, 349299179, 355522601, 361732638, + 367929056, 374111622, 380280102, 386434266, 392573880, + 398698714, 404808537, 410903120, 416982232, 423045645, + 429093131, 435124461, 441139410, 447137749, 453119255, + 459083700, 465030861, 470960514, 476872436, 482766404, + 488642196, 494499591, 500338368, 506158307, 511959191, + 517740799, 523502914, 529245320, 534967800, 540670139, + 546352122, 552013535, 557654165, 563273800, 568872228, + 574449238, 580004620, 585538166, 591049666, 596538914, + 602005702, 607449826, 612871079, 618269257, 623644159, + 628995580, 634323320, 639627179, 644906955, 650162451, + 655393469, 660599812, 665781284, 670937689, 676068834, + 681174525, 686254571, 691308779, 696336960, 701338924, + 706314483, 711263450, 716185638, 721080863, 725948939, + 730789683, 735602914, 740388449, 745146109, 749875715, + 754577089, 759250053, 763894432, 768510051, 773096736, + 777654314, 782182613, 786681465, 791150698, 795590144, + 799999637, 804379011, 808728100, 813046741, 817334771, + 821592029, 825818355, 830013589, 834177573, 838310151, + 842411167, 846480467, 850517898, 854523307, 858496543, + 862437458, 866345902, 870221729, 874064793, 877874948, + 881652052, 885395963, 889106538, 892783640, 896427128, + 900036867, 903612719, 907154552, 910662230, 914135622, + 917574598, 920979028, 924348783, 927683737, 930983764, + 934248740, 937478543, 940673049, 943832140, 946955696, + 950043600, 953095736, 956111987, 959092242, 962036387, + 964944313, 967815908, 970651066, 973449680, 976211643, + 978936853, 981625207, 984276602, 986890941, 989468123, + 992008053, 994510634, 996975772, 999403374, 1001793350, + 1004145609, 1006460062, 1008736623, 1010975205, 1013175724, + 1015338098, 1017462246, 1019548086, 1021595541, 1023604533, + 1025574987, 1027506829, 1029399986, 1031254387, 1033069961, + 1034846641, 1036584359, 1038283051, 1039942652, 1041563100, + 1043144333, 1044686293, 1046188921, 1047652160, 1049075956, + 1050460255, 1051805004, 1053110154, 1054375654, 1055601458, + 1056787520, 1057933793, 1059040236, 1060106807, 1061133466, + 1062120173, 1063066892, 1063973588, 1064840225, 1065666771, + 1066453196, 1067199470, 1067905564, 1068571452, 1069197109, + 1069782511, 1070327637, 1070832465, 1071296977, 1071721156, + 1072104984, 1072448449, 1072751536, 1073014235, 1073236536, + 1073418430, 1073559910, 1073660971, 1073721610}; + +static int32_t iir_out[IIR_LENGTH] = {}; + +#define IIR_M 5 + +static const int32_t coef_sos[IIR_M * 5] = {526133493, 848256040, 633507676, + 236223201, 96636764, 0, + 515396075, 654982512, 762356695, + 204010946, 214748364, 762356695, + 547608330, 987842478, 493921239, + 891205713, 869730877, 998579896, + 794568949, 0, 633507676, + 858993459, 386547056, 848256040, + 1063004405}; + +static const int16_t coef_g[IIR_M] = {16384, 8192, 4096, 2048, 1024}; +static const int64_t ref_power_32[] = {17179951315}; + +/* Value of MU and rightShift are arbitrary just for testing */ +#define MU 100 +#define RSH 31 +#define FIR_LENGTH 64 +#define FIR_M 64 + +static int32_t fir_err[FIR_LENGTH] = {}; +static const int32_t fir_coef_ref[FIR_M] = { + 0, 52686013, 105245101, 157550644, 209476634, 260897977, + 311690793, 361732719, 410903200, 459083778, 506158384, 552013609, + 596538986, 639627248, 681174592, 721080927, 759250114, 795590202, + 830013643, 862437509, 892783688, 920979072, 946955737, 970651103, + 992008086, 1010975234, 1027506854, 1041563121, 1053110171, 1062120186, + 1068571460, 1072448453, 1073741823, 1072448456, 1068571466, 1062120194, + 1053110182, 1041563135, 1027506871, 1010975253, 992008108, 970651128, + 946955764, 920979102, 892783720, 862437544, 830013680, 795590241, + 759250155, 721080969, 681174636, 639627294, 596539034, 552013659, + 506158434, 459083830, 410903253, 361732773, 311690848, 260898033, + 209476691, 157550701, 105245158, 52686070}; + +static const int32_t fir_in_ref[FIR_LENGTH] = { + 2784, 52687975, 105245127, 157551129, 209480572, 260899599, + 311690864, 361732998, 410904911, 459085677, 506162152, 552013733, + 596539132, 639630371, 681178382, 721082228, 759252428, 795593181, + 830014978, 862438380, 892787610, 920979899, 946958840, 970653120, + 992011496, 1010976065, 1027509675, 1041565392, 1053112620, 1062121586, + 1068572784, 1072451133, 1073743011, 1072450743, 1068572751, 1062121479, + 1053112929, 1041563681, 1027509789, 1010979047, 992010538, 970651799, + 946958915, 920979653, 892787363, 862441108, 830016340, 795592792, + 759252140, 721081076, 681177636, 639628174, 596540644, 552013841, + 506160429, 459083884, 410905774, 361733050, 311692285, 260901927, + 209478927, 157554346, 105247954, 52687892}; + +static const int32_t fir_ref_ref[FIR_LENGTH + FIR_M] = { + 0, 52686013, 105245101, 157550644, 209476634, + 260897977, 311690793, 361732719, 410903200, 459083778, + 506158384, 552013609, 596538986, 639627248, 681174592, + 721080927, 759250114, 795590202, 830013643, 862437509, + 892783688, 920979072, 946955737, 970651103, 992008086, + 1010975234, 1027506854, 1041563121, 1053110171, 1062120186, + 1068571460, 1072448453, 1073741823, 1072448456, 1068571466, + 1062120194, 1053110182, 1041563135, 1027506871, 1010975253, + 992008108, 970651128, 946955764, 920979102, 892783720, + 862437544, 830013680, 795590241, 759250155, 721080969, + 681174636, 639627294, 596539034, 552013659, 506158434, + 459083830, 410903253, 361732773, 311690848, 260898033, + 209476691, 157550701, 105245158, 52686070, 57, + -52685955, -105245043, -157550587, -209476578, -260897921, + -311690738, -361732665, -410903146, -459083726, -506158333, + -552013560, -596538938, -639627202, -681174547, -721080884, + -759250074, -795590163, -830013607, -862437475, -892783656, + -920979042, -946955710, -970651079, -992008064, -1010975214, + -1027506838, -1041563107, -1053110159, -1062120177, -1068571455, + -1072448450, -1073741823, -1072448459, -1068571472, -1062120203, + -1053110193, -1041563149, -1027506888, -1010975273, -992008130, + -970651152, -946955791, -920979131, -892783752, -862437578, + -830013716, -795590279, -759250196, -721081012, -681174681, + -639627340, -596539082, -552013708, -506158485, -459083882, + -410903306, -361732828, -311690903, -260898088, -209476747, + -157550758, -105245215, -52686128}; diff --git a/samples/boards/nxp/adsp/number_crunching/include/math_ops.h b/samples/boards/nxp/adsp/number_crunching/include/math_ops.h new file mode 100644 index 0000000000000..869d15e0de737 --- /dev/null +++ b/samples/boards/nxp/adsp/number_crunching/include/math_ops.h @@ -0,0 +1,127 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/* test vector sum on int16_t elements */ +void test_vec_sum_int16_op(void); +/** + * @brief Vector Sum - makes pair wise saturated summation of vectors + * + * @param[in] *input1 - points to the first input vector + * @param[in] *input2 - points to the second input vector + * @param[out] *output - points to the output vector + * @param[in] length - number of samples in each vector + * + * @return none + */ +void vec_sum_int16(const int16_t *input1, const int16_t *input2, + int16_t *output, uint32_t length); + +/* test sum of the squares of the int16_t vector elements */ +void test_power_int16_op(void); +/** + * @brief Power of a Vector - makes sum of the squares of the elements of + * an int16_t vector + * + * @param[in] *input - points to the input vector + * @param[in] length - size of the input vector + * @param[in] rsh - right shift of result + * @param[out] *output - sum of the squares value + * + * @return none + * + * @details + * For NatureDSP, rsh is in range 0...31 and output may scaled down with + * saturation by rsh bits. + * + * For CMSIS-DSP, intermediate multiplication yields a 2.30 format, + * and this result is added without saturation to a 64-bit accumulator + * in 34.30 format. + * + * Therefore, for some cases, rsh is not used, it can be ignored. + */ +void vec_power_int16(const int16_t *input, int64_t *output, int rsh, uint32_t length); + +/* test sum of the squares of the int32_t vector elements */ +void test_power_int32_op(void); +/** + * @brief Power of a Vector - makes sum of the squares of the elements of + * an int32_t vector + * + * @param[in] *input - points to the input vector + * @param[in] length - size of the input vector + * @param[in] rsh - right shift of result + * @param[out] *output - sum of the squares value + * + * @return none + * + * @details + * For NatureDSP, rsh is in range 31...62 and output may scaled down with + * saturation by rsh bits. + * + * For CMSIS-DSP, intermediate multiplication yields a 2.62 format, + * and this result is truncated to 2.48 format by discarding the lower 14 bits. + * The 2.48 result is then added without saturation to a 64-bit accumulator + * in 16.48 format. + * + * Therefore, for some cases, rsh is not used, it can be ignored. + */ +void vec_power_int32(const int32_t *input, int64_t *output, int rsh, uint32_t length); + +/* test Fast Fourier Transform (FFT) */ +void test_fft_op(void); +/** + * @brief Fast Fourier Transform on Real Data - make FFT on real data + * + * @param[in] *input - points to the input buffer + * @param[in] length - length of the FFT + * @param[out] *output - points to the output buffer + * + * @return none + */ +void fft_real32(int32_t *input, int32_t *output, int length); + +/* test Bi-quad Real Block Infinite Impulse Response (IIR) Filter */ +void test_iir_op(void); +/** + * @brief Bi-quad Real Block IIR - makes a real IIR filter + * (cascaded IIR direct form I using + * 5 coefficients per bi-quad + gain term) + * + * @param[in] M - number of bi-quad sections + * @param[in] *coef_sos - points to the filter coefficients + * @param[in] *coef_g - points to the scale factor for each section + * @param[in] *input - points to the block of input data + * @param[in] blockSize - number of samples to process + * @param[out] *output - points to the block of output data + * + * @return none + */ +void real_block_iir_32(int M, const int32_t *coef_sos, const int16_t *coef_g, + const int32_t *input, int32_t *output, int block_size); + +/* test Least Mean Square (LMS) Filter for Real Data */ +void test_fir_blms_op(void); +/** + * @brief Blockwise Adaptive LMS Algorithm for Real Data - performs filtering of + * reference samples 'ref', computation of + * error 'err' over a block of + * input samples 'input' + * + * @param[in] *coef - points to coefficient buffer + * @param[in] *input -points to the block of input data + * @param[in] *ref - points to the block of reference data + * @param[in] mu - step size that controls filter coefficient updates + * @param[in] blockSize - number of samples to process + * @param[in] M - number of filter coefficients + * @param[out] *output - points to the block of output data + * @param[out] *err - points to the block of error data + * + * @return none + */ +void lms_iir_32(int32_t *err, int32_t *coef, int32_t *input, int32_t *ref, + int32_t mu, int block_size, int M); diff --git a/samples/boards/nxp/adsp/number_crunching/prj.conf b/samples/boards/nxp/adsp/number_crunching/prj.conf new file mode 100644 index 0000000000000..0f06c353341d6 --- /dev/null +++ b/samples/boards/nxp/adsp/number_crunching/prj.conf @@ -0,0 +1,14 @@ +CONFIG_STDOUT_CONSOLE=y +CONFIG_REQUIRES_FLOAT_PRINTF=y +CONFIG_MAIN_STACK_SIZE=3072 + +#for CMSIS-DSP +CONFIG_REQUIRES_FULL_LIBC=y + +CONFIG_CMSIS_DSP=y +CONFIG_CMSIS_DSP_FILTERING=y + +# for FFT +CONFIG_CMSIS_DSP_TRANSFORM=y +# for arm_power +CONFIG_CMSIS_DSP_STATISTICS=y diff --git a/samples/boards/nxp/adsp/number_crunching/sample.yaml b/samples/boards/nxp/adsp/number_crunching/sample.yaml new file mode 100644 index 0000000000000..9886f57c153b9 --- /dev/null +++ b/samples/boards/nxp/adsp/number_crunching/sample.yaml @@ -0,0 +1,20 @@ +sample: + description: An application that demonstrates + how to integrate a proprietary library which + executes math functions on target. + name: Proprietary Library +tests: + sample.app_dev.number_crunching: + platform_allow: + - native_sim + - imx8mp_evk/mimx8ml8/adsp + integration_platforms: + - native_sim + - imx8mp_evk/mimx8ml8/adsp + tags: external + harness: console + harness_config: + type: multi_line + regex: + - "Number crunching example!" + - "[Library Test]" diff --git a/samples/boards/nxp/adsp/number_crunching/src/cmsis_dsp_wrapper.c b/samples/boards/nxp/adsp/number_crunching/src/cmsis_dsp_wrapper.c new file mode 100644 index 0000000000000..4196b5927b065 --- /dev/null +++ b/samples/boards/nxp/adsp/number_crunching/src/cmsis_dsp_wrapper.c @@ -0,0 +1,78 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include "arm_math.h" + +void vec_sum_int16(const int16_t *in_a, const int16_t *in_b, int16_t *out, uint32_t length) +{ + printk("[Backend] CMSIS-DSP module\n"); + arm_add_q15(in_a, in_b, out, length); +} + +void vec_power_int16(const int16_t *in, int64_t *out, int rsh, uint32_t length) +{ + printk("[Backend] CMSIS-DSP module\n"); + arm_power_q15(in, length, out); +} + +void vec_power_int32(const int32_t *in, int64_t *out, int rsh, uint32_t length) +{ + printk("[Backend] CMSIS-DSP module\n"); + arm_power_q31(in, length, out); +} + +void fft_real32(int32_t *in, int32_t *out, int length) +{ + /* Instance structure for the Q31 RFFT */ + arm_rfft_instance_q31 rFFT; + + printk("[Backend] CMSIS-DSP module\n"); + + /* + * Initialize the FFT + * value = 0: forward transform + * value = 1: enables bit reversal of output + */ + arm_rfft_init_q31(&rFFT, length, 0, 1); + /* Apply FFT */ + arm_rfft_q31(&rFFT, in, out); +} + +void real_block_iir_32(int M, const int32_t *coef_sos, const int16_t *coef_g, + const int32_t *in, int32_t *out, int block_size) +{ + /* Instance of the Q31 Biquad cascade structure */ + arm_biquad_casd_df1_inst_q31 handle; + /* + * State variables array + * Each Bi-quad stage has 4 state variables. + * The state array has a total length of 4*M values. + */ + q31_t biquadStateBandQ31[4 * M]; + + printk("[Backend] CMSIS-DSP module\n"); + + /* + * Initialize the state and coefficient buffers for all Bi-quad sections + * value = 2: Shift to be applied after the accumulator + */ + arm_biquad_cascade_df1_init_q31(&handle, M, coef_sos, &biquadStateBandQ31[0], 2); + /* Call the Q31 Bi-quad Cascade DF1 process function */ + arm_biquad_cascade_df1_q31(&handle, in, out, block_size); +} + +void lms_iir_32(int32_t *err, int32_t *coef, int32_t *input, int32_t *ref, + int32_t mu, int block_size, int M) +{ + arm_lms_instance_q31 handle; + + printk("[Backend] CMSIS-DSP module\n"); + arm_lms_init_q31(&handle, M, coef, ref, mu, block_size, 0); + arm_lms_q31(&handle, input, ref, coef, err, block_size); +} diff --git a/samples/boards/nxp/adsp/number_crunching/src/main.c b/samples/boards/nxp/adsp/number_crunching/src/main.c new file mode 100644 index 0000000000000..f0515e7f4fbf3 --- /dev/null +++ b/samples/boards/nxp/adsp/number_crunching/src/main.c @@ -0,0 +1,34 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * Number crunching sample: + * calling functions from an out of tree static library + */ + +#include +#include + +#include "math_ops.h" + +int main(void) +{ + printk("\r\nNumber crunching example!\r\n\n"); + + test_vec_sum_int16_op(); + + test_power_int16_op(); + + test_power_int32_op(); + + test_fft_op(); + + test_iir_op(); + + test_fir_blms_op(); + + return 0; +} diff --git a/samples/boards/nxp/adsp/number_crunching/src/math_ops.c b/samples/boards/nxp/adsp/number_crunching/src/math_ops.c new file mode 100644 index 0000000000000..a3ee68cbb9285 --- /dev/null +++ b/samples/boards/nxp/adsp/number_crunching/src/math_ops.c @@ -0,0 +1,144 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include "math_ops.h" +#include "input.h" + +static int start, stop; + +static inline int test_near_equal_q15(uint32_t length, const int16_t *in_a, + const int16_t *in_b, int16_t threshold) +{ + int i; + + for (i = 0; i < length; i++) { + if (abs(in_a[i] - in_b[i]) > threshold) { + return 0; + } + } + + return 1; +} + +void test_vec_sum_int16_op(void) +{ + int16_t output[VEC_LENGTH]; + int ret = 1; /* test passed successfully */ + + printk("[Library Test] == Vector Sum test ==\r\n"); + start = k_cycle_get_32(); + + /* Run test function */ + vec_sum_int16(in_a, in_b, output, VEC_LENGTH); + stop = k_cycle_get_32(); + + /* Validate output */ + ret = test_near_equal_q15(VEC_LENGTH, output, ref_add, ABS_ERROR_THRESH_Q15); + + printk("[Library Test] Vector Sum takes %d cycles\r\n", stop - start); + printk("[Library Test] == Vector Sum test end with %d ==\r\n\r\n", ret); +} + +void test_power_int16_op(void) +{ + int64_t output; + int ret = 1; /* test passed successfully */ + + printk("[Library Test] == Vector power sum test ==\r\n"); + start = k_cycle_get_32(); + + /* Run test function */ + vec_power_int16(in_a, &output, 0, VEC_LENGTH); + stop = k_cycle_get_32(); + + /* Validate output */ + if (output != ref_power_16[0]) { + printk("[Library Test] Mismatch: expected %lld result %lld\r\n", + ref_power_16[0], output); + ret = 0; /* test failed */ + } + + printk("[Library Test] Vector power sum takes %d cycles\r\n", stop - start); + printk("[Library Test] == Vector power sum test end with %d ==\r\n\r\n", ret); +} + +void test_power_int32_op(void) +{ + int64_t output; + + printk("[Library Test] == Vector power sum test ==\r\n"); + start = k_cycle_get_32(); + + /* Run test function */ + vec_power_int32(fir_in_ref, &output, RSH, FIR_LENGTH); + stop = k_cycle_get_32(); + + printk("[Library Test] Vector power sum takes %d cycles\r\n", stop - start); + printk("[Library Test] == Vector power sum test end ==\r\n\r\n"); +} + +void test_fft_op(void) +{ + int i; + int32_t fft_in[FFT_LENGTH]; + + /* Create input */ + for (i = 0; i < FFT_LENGTH; i++) + fft_in[i] = FFT_LENGTH * (1 + i % 2); /* only real part */ + + printk("[Library Test] == Fast Fourier Transform on Real Data test ==\r\n"); + start = k_cycle_get_32(); + + /* Run test function */ + fft_real32(fft_in, fft_out, FFT_LENGTH); + stop = k_cycle_get_32(); + + printk("[Library Test] Fast Fourier Transform on Real Data takes %d cycles\r\n", + stop - start); + printk("[Library Test] == Fast Fourier Transform on Real Data test end ==\r\n\r\n"); +} + +void test_iir_op(void) +{ + printk("[Library Test] == Bi-quad Real Block IIR test ==\r\n"); + start = k_cycle_get_32(); + + /* Run test function */ + real_block_iir_32(IIR_M, coef_sos, coef_g, iir_in, iir_out, IIR_LENGTH); + stop = k_cycle_get_32(); + + printk("[Library Test] Bi-quad Real Block IIR takes %d cycles\r\n", stop - start); + printk("[Library Test] == Bi-quad Real Block IIR end ==\r\n\r\n"); +} + +void test_fir_blms_op(void) +{ + int i; + int32_t fir_coef[FIR_M]; + int32_t fir_in[FIR_LENGTH]; + int32_t fir_ref[FIR_LENGTH + FIR_M]; + + for (i = 0; i < FIR_M; i++) + fir_coef[i] = fir_coef_ref[i]; + for (i = 0; i < FIR_LENGTH; i++) + fir_in[i] = fir_in_ref[i]; + for (i = 0; i < FIR_LENGTH + FIR_M; i++) + fir_ref[i] = fir_ref_ref[i]; + + printk("[Library Test] == Least Mean Square (LMS) Filter for Real Data test ==\r\n"); + start = k_cycle_get_32(); + + /* Run test function */ + lms_iir_32(fir_err, fir_coef, fir_in, fir_ref, MU, FIR_LENGTH, FIR_M); + stop = k_cycle_get_32(); + + printk("[Library Test] Least Mean Square (LMS) Filter for Real Data test takes %d cycles\r\n", + stop - start); + printk("[Library Test] == Least Mean Square (LMS) Filter for Real Data test end ==\r\n\r\n"); +} diff --git a/samples/boards/nxp/adsp/number_crunching/src/nature_dsp_wrapper.c b/samples/boards/nxp/adsp/number_crunching/src/nature_dsp_wrapper.c new file mode 100644 index 0000000000000..aced26db7cfdf --- /dev/null +++ b/samples/boards/nxp/adsp/number_crunching/src/nature_dsp_wrapper.c @@ -0,0 +1,94 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include "NatureDSP_Signal.h" + +/** + * For fft_real32x32, scaling options are: + * 2 - 32-bit dynamic scaling + * 3 - fixed scaling before each stage + */ +#define FFT_SCALING_OPTION 3 +#define RSH 31 + +void vec_sum_int16(const int16_t *in_a, const int16_t *in_b, int16_t *out, uint32_t length) +{ + printk("[Backend] NatureDSP library\n"); + vec_add16x16(out, in_a, in_b, length); +} + +void vec_power_int16(const int16_t *in, int64_t *out, int rsh, uint32_t length) +{ + printk("[Backend] NatureDSP library\n"); + out[0] = vec_power16x16(in, rsh, length); +} + +void vec_power_int32(const int32_t *in, int64_t *out, int rsh, uint32_t length) +{ + printk("[Backend] NatureDSP library\n"); + out[0] = vec_power32x32(in, rsh, length); +} + +void fft_real32(int32_t *in, int32_t *out, int length) +{ + /* FFT handle for 32x32 */ + extern const fft_handle_t rfft32_32; + + printk("[Backend] NatureDSP library\n"); + + /* Apply FFT */ + fft_real32x32(out, in, rfft32_32, FFT_SCALING_OPTION); +} + +void real_block_iir_32(int M, const int32_t *coef_sos, const int16_t *coef_g, + const int32_t *in, int32_t *out, int block_size) +{ + bqriir32x32_df1_handle_t handle; + static int32_t objmem[256] = {}; + + printk("[Backend] NatureDSP library\n"); + /* + * Initialization routine for IIR filters + * value = 0: total gain shift amount applied to output signal + * + * Returns: handle to the object + */ + handle = bqriir32x32_df1_init(objmem, M, coef_sos, coef_g, 0); + /* + * Call Bi-quad Real Block IIR + * value = NULL: scratch memory area (for fixed-point functions only) + * + * The filter calculates block_size output samples using + * coef_sos and coef_g matrices. + */ + bqriir32x32_df1(handle, NULL, out, in, block_size); +} + +void lms_iir_32(int32_t *err, int32_t *coef, int32_t *input, int32_t *ref, + int32_t mu, int block_size, int M) +{ + int64_t norm64; + + printk("[Backend] NatureDSP library\n"); + + /* + * Compute the normalization factor, + * which is the power of the reference signal times block_size, + * where block_size is the number of samples to process + */ + vec_power_int32(ref, &norm64, RSH, block_size); + /* + * Call Blockwise Adaptive LMS Algorithm for Real Data + * value = NULL: scratch memory area (for fixed-point functions only) + * + * The filter calculates block_size output samples using + * coef_sos and coef_g matrices. + */ + fir_blms32x32(err, coef, input, ref, norm64, mu, block_size, M); +} From 2ed67e9841df3a3249d62abf8626ac7c2362facf Mon Sep 17 00:00:00 2001 From: Janco Kock Date: Wed, 29 May 2024 11:46:46 +0200 Subject: [PATCH 1651/4482] drivers: ethernet: enc424j600: change mac addr runtime Add ability to change mac address at runtime using net mgmt config call Signed-off-by: Janco Kock --- drivers/ethernet/eth_enc424j600.c | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/ethernet/eth_enc424j600.c b/drivers/ethernet/eth_enc424j600.c index b2b645652cee3..0e317c3d8ba94 100644 --- a/drivers/ethernet/eth_enc424j600.c +++ b/drivers/ethernet/eth_enc424j600.c @@ -556,6 +556,40 @@ static enum ethernet_hw_caps enc424j600_get_capabilities(const struct device *de return ETHERNET_LINK_10BASE_T | ETHERNET_LINK_100BASE_T; } +static int enc424j600_set_config(const struct device *dev, + enum ethernet_config_type type, + const struct ethernet_config *config) +{ + struct enc424j600_runtime *ctx = dev->data; + uint16_t tmp; + + switch (type) { + case ETHERNET_CONFIG_TYPE_MAC_ADDRESS: + ctx->mac_address[0] = config->mac_address.addr[0]; + ctx->mac_address[1] = config->mac_address.addr[1]; + ctx->mac_address[2] = config->mac_address.addr[2]; + ctx->mac_address[3] = config->mac_address.addr[3]; + ctx->mac_address[4] = config->mac_address.addr[4]; + ctx->mac_address[5] = config->mac_address.addr[5]; + + /* write MAC address byte 2 and 1 */ + tmp = config->mac_address.addr[0] | config->mac_address.addr[1] << 8; + enc424j600_write_sfru(dev, ENC424J600_SFR3_MAADR1L, tmp); + + /* write MAC address byte 4 and 3 */ + tmp = config->mac_address.addr[2] | config->mac_address.addr[3] << 8; + enc424j600_write_sfru(dev, ENC424J600_SFR3_MAADR2L, tmp); + + /* write MAC address byte 6 and 5 */ + tmp = config->mac_address.addr[4] | config->mac_address.addr[5] << 8; + enc424j600_write_sfru(dev, ENC424J600_SFR3_MAADR3L, tmp); + + return 0; + default: + return -ENOTSUP; + } +} + static void enc424j600_iface_init(struct net_if *iface) { const struct device *dev = net_if_get_device(iface); @@ -644,6 +678,7 @@ static int enc424j600_stop_device(const struct device *dev) static const struct ethernet_api api_funcs = { .iface_api.init = enc424j600_iface_init, .get_config = enc424j600_get_config, + .set_config = enc424j600_set_config, .get_capabilities = enc424j600_get_capabilities, .send = enc424j600_tx, .start = enc424j600_start_device, From eab3f492470703669be308ec2fc22d7992d3f0c2 Mon Sep 17 00:00:00 2001 From: Troels Nilsson Date: Fri, 27 Sep 2024 13:17:48 +0200 Subject: [PATCH 1652/4482] Bluetooth: Controller: Introduce scan_aux_chain context Introduces the concept of ll_scan_aux_chain, that allows for keeping track of several advertising chains with a minimal overhead. This replaces using several scan aux sets each with an associated ticker IDs Only one ticker is used for following chains; This is achieved by having the scheduled chains in a sorted list and restarting the ticker when the first in the list expires EVENT_DONE_EXTRA_TYPE_SCAN_AUX now includes a pointer to the lll structure to identify which chain to flush (to avoid race conditions) New implementation is hidden behind a config for now (defaults to off): BT_CTLR_SCAN_AUX_USE_CHAINS Other minor changes: - rx_incomplete node pointer was moved to ll_sync_set - data_len removed from ll_sync_set (it uses the chains instead) Signed-off-by: Troels Nilsson --- .../bluetooth/controller/Kconfig.ll_sw_split | 20 +- subsys/bluetooth/controller/ll_sw/lll.h | 8 + .../ll_sw/nordic/lll/lll_scan_aux.c | 36 +- subsys/bluetooth/controller/ll_sw/ull.c | 10 + subsys/bluetooth/controller/ll_sw/ull_scan.c | 8 + .../bluetooth/controller/ll_sw/ull_scan_aux.c | 1518 ++++++++++++++++- .../controller/ll_sw/ull_scan_internal.h | 4 + .../controller/ll_sw/ull_scan_types.h | 33 + subsys/bluetooth/controller/ll_sw/ull_sync.c | 12 +- .../controller/ll_sw/ull_sync_internal.h | 2 +- .../controller/ll_sw/ull_sync_types.h | 8 + 11 files changed, 1605 insertions(+), 54 deletions(-) diff --git a/subsys/bluetooth/controller/Kconfig.ll_sw_split b/subsys/bluetooth/controller/Kconfig.ll_sw_split index f5a2abe228a08..90d5413a05be6 100644 --- a/subsys/bluetooth/controller/Kconfig.ll_sw_split +++ b/subsys/bluetooth/controller/Kconfig.ll_sw_split @@ -498,14 +498,32 @@ config BT_CTRL_ADV_ADI_IN_SCAN_RSP help Enable ADI field in AUX_SCAN_RSP PDU +config BT_CTLR_SCAN_AUX_USE_CHAINS + bool "Use new chains based implementation for following advertising chains" + depends on BT_OBSERVER && BT_CTLR_ADV_EXT + help + Use the new chains based implementation of following advertising chains + instead of the old sets based one. The new implementation has a much lighter + footprint, since it limits allocations per advertising chain to the bare + minimum and only uses one ticker + config BT_CTLR_SCAN_AUX_SET int "LE Extended Scanning Auxiliary Sets" - depends on BT_OBSERVER && BT_CTLR_ADV_EXT + depends on BT_OBSERVER && BT_CTLR_ADV_EXT && !BT_CTLR_SCAN_AUX_USE_CHAINS range 1 64 default 1 help Maximum supported auxiliary channel scan sets. +config BT_CTLR_SCAN_AUX_CHAIN_COUNT + int "LE Extended Scanning Auxiliary Chains" + depends on BT_OBSERVER && BT_CTLR_ADV_EXT && BT_CTLR_SCAN_AUX_USE_CHAINS + range 1 64 + default 3 + help + Maximum number of extended/periodic advertising chains that can be + followed simultaneously + config BT_CTLR_SCAN_AUX_SYNC_RESERVE_MIN bool "Use minimal Scan Auxiliary and Periodic Sync PDU time reservation" depends on (BT_OBSERVER && BT_CTLR_ADV_EXT) || BT_CTLR_SYNC_PERIODIC diff --git a/subsys/bluetooth/controller/ll_sw/lll.h b/subsys/bluetooth/controller/ll_sw/lll.h index bfe9be02500e0..30154739ff2ca 100644 --- a/subsys/bluetooth/controller/ll_sw/lll.h +++ b/subsys/bluetooth/controller/ll_sw/lll.h @@ -93,9 +93,13 @@ enum { TICKER_ID_SCAN_BASE, TICKER_ID_SCAN_LAST = ((TICKER_ID_SCAN_BASE) + (BT_CTLR_SCAN_SET) - 1), #if defined(CONFIG_BT_CTLR_ADV_EXT) +#if defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) + TICKER_ID_SCAN_AUX, +#else /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ TICKER_ID_SCAN_AUX_BASE, TICKER_ID_SCAN_AUX_LAST = ((TICKER_ID_SCAN_AUX_BASE) + (CONFIG_BT_CTLR_SCAN_AUX_SET) - 1), +#endif /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ #if defined(CONFIG_BT_CTLR_SYNC_PERIODIC) TICKER_ID_SCAN_SYNC_BASE, TICKER_ID_SCAN_SYNC_LAST = ((TICKER_ID_SCAN_SYNC_BASE) + @@ -526,6 +530,10 @@ struct event_done_extra { * CONFIG_BT_CTLR_CTEINLINE_SUPPORT */ }; + +#if defined(CONFIG_BT_CTLR_ADV_EXT) + void *lll; +#endif /* CONFIG_BT_CTLR_ADV_EXT */ }; #if defined(CONFIG_BT_CTLR_LE_ENC) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c index d3b2e0aa628bd..161311958e3d9 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan_aux.c @@ -250,6 +250,7 @@ uint8_t lll_scan_aux_setup(struct pdu_adv *pdu, uint8_t pdu_phy, void lll_scan_aux_isr_aux_setup(void *param) { struct pdu_adv_aux_ptr *aux_ptr; + struct lll_scan_aux *lll_aux; struct node_rx_pdu *node_rx; uint32_t window_widening_us; uint32_t window_size_us; @@ -269,7 +270,14 @@ void lll_scan_aux_isr_aux_setup(void *param) phy_aux = BIT(PDU_ADV_AUX_PTR_PHY_GET(aux_ptr)); ftr->aux_phy = phy_aux; - lll = ftr->param; + lll = ull_scan_lll_is_valid_get(ftr->param); + if (!lll) { + /* param is a scan_aux */ + lll_aux = ftr->param; + lll = ull_scan_aux_lll_parent_get(lll_aux, NULL); + } else { + lll_aux = NULL; + } /* Determine the window size */ if (aux_ptr->offs_units) { @@ -299,11 +307,14 @@ void lll_scan_aux_isr_aux_setup(void *param) radio_pkt_rx_set(node_rx->pdu); - /* FIXME: we could (?) use isr_rx_ull_schedule if already have aux - * context allocated, i.e. some previous aux was scheduled from - * ull already. + /* Use isr_rx_ull_schedule if already have aux context allocated, + * i.e. some previous aux was scheduled from ull already. */ - radio_isr_set(isr_rx_lll_schedule, node_rx); + if (lll_aux) { + radio_isr_set(isr_rx_ull_schedule, lll_aux); + } else { + radio_isr_set(isr_rx_lll_schedule, node_rx); + } /* setup tIFS switching */ radio_tmr_tifs_set(EVENT_IFS_US); @@ -569,8 +580,12 @@ static int prepare_cb(struct lll_prepare_param *p) (EVENT_OVERHEAD_PREEMPT_US <= EVENT_OVERHEAD_PREEMPT_MIN_US) uint32_t overhead; +#if defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) + overhead = lll_preempt_calc(ull, TICKER_ID_SCAN_AUX, ticks_at_event); +#else /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ overhead = lll_preempt_calc(ull, (TICKER_ID_SCAN_AUX_BASE + ull_scan_aux_lll_handle_get(lll_aux)), ticks_at_event); +#endif /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ /* check if preempt to start has changed */ if (overhead) { LL_ASSERT_OVERHEAD(overhead); @@ -661,6 +676,7 @@ static void abort_cb(struct lll_prepare_param *prepare_param, void *param) e = ull_done_extra_type_set(EVENT_DONE_EXTRA_TYPE_SCAN_AUX); LL_ASSERT(e); + e->lll = param; lll_done(param); } @@ -700,6 +716,7 @@ static void isr_done(void *param) e = ull_done_extra_type_set(EVENT_DONE_EXTRA_TYPE_SCAN_AUX); LL_ASSERT(e); + e->lll = param; } lll_isr_cleanup(param); @@ -853,7 +870,7 @@ static void isr_rx(struct lll_scan *lll, struct lll_scan_aux *lll_aux, isr_rx_do_close: if (lll_aux) { - radio_isr_set(isr_done, NULL); + radio_isr_set(isr_done, lll_aux); } else { /* Send message to flush Auxiliary PDU list */ if (lll->is_aux_sched && err != -ECANCELED) { @@ -888,7 +905,7 @@ static void isr_rx(struct lll_scan *lll, struct lll_scan_aux *lll_aux, radio_isr_set(lll_scan_isr_resume, lll); } else { /* auxiliary channel radio event done */ - radio_isr_set(isr_done, NULL); + radio_isr_set(isr_done, lll->lll_aux); } } radio_disable(); @@ -1308,7 +1325,7 @@ static int isr_rx_pdu(struct lll_scan *lll, struct lll_scan_aux *lll_aux, ftr->aux_lll_sched = lll_scan_aux_setup(pdu, phy_aux, phy_aux_flags_rx, lll_scan_aux_isr_aux_setup, - lll); + lll_aux ? (void *)lll_aux : (void *)lll); node_rx->hdr.type = NODE_RX_TYPE_EXT_AUX_REPORT; @@ -1601,7 +1618,7 @@ static void isr_rx_connect_rsp(void *param) radio_isr_set(lll_scan_isr_resume, lll); } else { - radio_isr_set(isr_done, NULL); + radio_isr_set(isr_done, lll_aux); } radio_disable(); @@ -1644,6 +1661,7 @@ static void isr_early_abort(void *param) e = ull_done_extra_type_set(EVENT_DONE_EXTRA_TYPE_SCAN_AUX); LL_ASSERT(e); + e->lll = param; lll_isr_early_abort(param); } diff --git a/subsys/bluetooth/controller/ll_sw/ull.c b/subsys/bluetooth/controller/ll_sw/ull.c index 8b31ce846ab67..4a7280246f8b8 100644 --- a/subsys/bluetooth/controller/ll_sw/ull.c +++ b/subsys/bluetooth/controller/ll_sw/ull.c @@ -120,8 +120,12 @@ #if defined(CONFIG_BT_OBSERVER) #define BT_SCAN_TICKER_NODES ((TICKER_ID_SCAN_LAST) - (TICKER_ID_SCAN_STOP) + 1) #if defined(CONFIG_BT_CTLR_ADV_EXT) +#if defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) +#define BT_SCAN_AUX_TICKER_NODES 1 +#else /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ #define BT_SCAN_AUX_TICKER_NODES ((TICKER_ID_SCAN_AUX_LAST) - \ (TICKER_ID_SCAN_AUX_BASE) + 1) +#endif /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ #if defined(CONFIG_BT_CTLR_SYNC_PERIODIC) #define BT_SCAN_SYNC_TICKER_NODES ((TICKER_ID_SCAN_SYNC_LAST) - \ (TICKER_ID_SCAN_SYNC_BASE) + 1) @@ -236,8 +240,14 @@ #if defined(CONFIG_BT_CTLR_ADV_EXT) && defined(CONFIG_BT_OBSERVER) #if defined(CONFIG_BT_CTLR_DF_PER_SCAN_CTE_NUM_MAX) /* Note: Need node for PDU and CTE sample */ +#if defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) +#define BT_CTLR_ADV_EXT_RX_CNT (MIN(CONFIG_BT_CTLR_SCAN_AUX_CHAIN_COUNT, \ + CONFIG_BT_PER_ADV_SYNC_MAX) * \ + CONFIG_BT_CTLR_DF_PER_SCAN_CTE_NUM_MAX * 2) +#else /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ #define BT_CTLR_ADV_EXT_RX_CNT (CONFIG_BT_CTLR_SCAN_AUX_SET * \ CONFIG_BT_CTLR_DF_PER_SCAN_CTE_NUM_MAX * 2) +#endif /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ #else /* !CONFIG_BT_CTLR_DF_PER_SCAN_CTE_NUM_MAX */ #define BT_CTLR_ADV_EXT_RX_CNT 1 #endif /* !CONFIG_BT_CTLR_DF_PER_SCAN_CTE_NUM_MAX */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_scan.c b/subsys/bluetooth/controller/ll_sw/ull_scan.c index f15a00a04e6db..a1d90d3cc7500 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_scan.c +++ b/subsys/bluetooth/controller/ll_sw/ull_scan.c @@ -665,6 +665,13 @@ uint8_t ull_scan_disable(uint8_t handle, struct ll_scan_set *scan) } #if defined(CONFIG_BT_CTLR_ADV_EXT) +#if defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) + /* Stop associated auxiliary scan contexts */ + err = ull_scan_aux_stop(&scan->lll); + if (err && (err != -EALREADY)) { + return BT_HCI_ERR_CMD_DISALLOWED; + } +#else /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ /* Find and stop associated auxiliary scan contexts */ for (uint8_t aux_handle = 0; aux_handle < CONFIG_BT_CTLR_SCAN_AUX_SET; aux_handle++) { @@ -697,6 +704,7 @@ uint8_t ull_scan_disable(uint8_t handle, struct ll_scan_set *scan) LL_ASSERT(!parent || (parent != aux_scan_lll)); } } +#endif /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ #endif /* CONFIG_BT_CTLR_ADV_EXT */ return 0; diff --git a/subsys/bluetooth/controller/ll_sw/ull_scan_aux.c b/subsys/bluetooth/controller/ll_sw/ull_scan_aux.c index ee84bba6e53b5..b572f1d0d92ee 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_scan_aux.c +++ b/subsys/bluetooth/controller/ll_sw/ull_scan_aux.c @@ -60,23 +60,20 @@ #include "hal/debug.h" static int init_reset(void); +static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, + uint32_t remainder, uint16_t lazy, uint8_t force, + void *param); +static void ticker_op_cb(uint32_t status, void *param); +static void flush_safe(void *param); +static void done_disabled_cb(void *param); + +#if !defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) + static inline struct ll_scan_aux_set *aux_acquire(void); static inline void aux_release(struct ll_scan_aux_set *aux); static inline uint8_t aux_handle_get(struct ll_scan_aux_set *aux); -static inline struct ll_sync_set *sync_create_get(struct ll_scan_set *scan); -#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC) -static inline struct ll_sync_iso_set * - sync_iso_create_get(struct ll_sync_set *sync); -#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */ -static void done_disabled_cb(void *param); -static void flush_safe(void *param); static void flush(void *param); -static void rx_release_put(struct node_rx_pdu *rx); static void aux_sync_incomplete(void *param); -static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, - uint32_t remainder, uint16_t lazy, uint8_t force, - void *param); -static void ticker_op_cb(uint32_t status, void *param); /* Auxiliary context pool used for reception of PDUs at aux offsets, common for * both Extended Advertising and Periodic Advertising. @@ -86,6 +83,36 @@ static void ticker_op_cb(uint32_t status, void *param); static struct ll_scan_aux_set ll_scan_aux_pool[CONFIG_BT_CTLR_SCAN_AUX_SET]; static void *scan_aux_free; +#else /* CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ + +static inline struct ll_scan_aux_chain *aux_chain_acquire(void); +static inline void aux_chain_release(struct ll_scan_aux_chain *chain); +struct ll_scan_aux_chain *scan_aux_chain_is_valid_get(struct ll_scan_aux_chain *chain); +struct ll_scan_aux_chain *lll_scan_aux_chain_is_valid_get(struct lll_scan_aux *lll); +#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC) +static void aux_sync_incomplete(struct ll_scan_aux_chain *chain); +#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */ +static void flush(struct ll_scan_aux_chain *chain); +static void chain_start_ticker(struct ll_scan_aux_chain *chain, bool replace); +static bool chain_insert_in_sched_list(struct ll_scan_aux_chain *chain); +static void chain_remove_from_list(struct ll_scan_aux_chain **head, + struct ll_scan_aux_chain *chain); +static void chain_append_to_list(struct ll_scan_aux_chain **head, struct ll_scan_aux_chain *chain); +static bool chain_is_in_list(struct ll_scan_aux_chain *head, struct ll_scan_aux_chain *chain); + +/* Auxiliary context pool used for reception of PDUs at aux offsets, common for + * both Extended Advertising and Periodic Advertising. + * Increasing the count allows simultaneous reception of interleaved chain PDUs + * from multiple advertisers. + */ +static struct ll_scan_aux_chain ll_scan_aux_pool[CONFIG_BT_CTLR_SCAN_AUX_CHAIN_COUNT]; +static struct ll_scan_aux_set scan_aux_set; +static void *scan_aux_free; + +static K_SEM_DEFINE(sem_scan_aux_stop, 0, 1); + +#endif /* CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ + int ull_scan_aux_init(void) { int err; @@ -110,6 +137,35 @@ int ull_scan_aux_reset(void) return 0; } +static void rx_release_put(struct node_rx_pdu *rx) +{ + rx->hdr.type = NODE_RX_TYPE_RELEASE; + + ll_rx_put(rx->hdr.link, rx); +} + +static inline struct ll_sync_set *sync_create_get(struct ll_scan_set *scan) +{ +#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC) + return (!scan->periodic.cancelled) ? scan->periodic.sync : NULL; +#else /* !CONFIG_BT_CTLR_SYNC_PERIODIC */ + return NULL; +#endif /* !CONFIG_BT_CTLR_SYNC_PERIODIC */ +} + +#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC) +static inline struct ll_sync_iso_set * + sync_iso_create_get(struct ll_sync_set *sync) +{ +#if defined(CONFIG_BT_CTLR_SYNC_ISO) + return sync->iso.sync_iso; +#else /* !CONFIG_BT_CTLR_SYNC_ISO */ + return NULL; +#endif /* !CONFIG_BT_CTLR_SYNC_ISO */ +} +#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */ + +#if !defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) { struct node_rx_pdu *rx_incomplete; @@ -435,7 +491,7 @@ void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) */ if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) && aux && sync && adi && ull_sync_setup_sid_match(sync, scan, PDU_ADV_ADI_SID_GET(adi))) { - ull_sync_setup(scan, aux, rx, si); + ull_sync_setup(scan, aux->lll.phy, rx, si); } } @@ -1217,27 +1273,6 @@ static inline uint8_t aux_handle_get(struct ll_scan_aux_set *aux) sizeof(struct ll_scan_aux_set)); } -static inline struct ll_sync_set *sync_create_get(struct ll_scan_set *scan) -{ -#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC) - return (!scan->periodic.cancelled) ? scan->periodic.sync : NULL; -#else /* !CONFIG_BT_CTLR_SYNC_PERIODIC */ - return NULL; -#endif /* !CONFIG_BT_CTLR_SYNC_PERIODIC */ -} - -#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC) -static inline struct ll_sync_iso_set * - sync_iso_create_get(struct ll_sync_set *sync) -{ -#if defined(CONFIG_BT_CTLR_SYNC_ISO) - return sync->iso.sync_iso; -#else /* !CONFIG_BT_CTLR_SYNC_ISO */ - return NULL; -#endif /* !CONFIG_BT_CTLR_SYNC_ISO */ -} -#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */ - static void done_disabled_cb(void *param) { struct ll_scan_aux_set *aux; @@ -1331,13 +1366,6 @@ static void flush(void *param) aux_release(aux); } -static void rx_release_put(struct node_rx_pdu *rx) -{ - rx->hdr.type = NODE_RX_TYPE_RELEASE; - - ll_rx_put(rx->hdr.link, rx); -} - static void aux_sync_partial(void *param) { struct ll_scan_aux_set *aux; @@ -1484,3 +1512,1411 @@ static void ticker_op_cb(uint32_t status, void *param) 0, &mfy); LL_ASSERT(!ret); } + +#else /* CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ + +void ull_scan_aux_setup(memq_link_t *link, struct node_rx_pdu *rx) +{ + struct node_rx_pdu *rx_incomplete; + struct ll_sync_iso_set *sync_iso; + struct ll_scan_aux_chain *chain; + struct pdu_adv_aux_ptr *aux_ptr; + struct pdu_adv_com_ext_adv *p; + struct lll_scan_aux *lll_aux; + uint32_t window_widening_us; + uint32_t ticks_aux_offset; + struct pdu_adv_ext_hdr *h; + struct lll_sync *sync_lll; + struct ll_scan_set *scan; + struct ll_sync_set *sync; + struct pdu_adv_adi *adi; + struct node_rx_ftr *ftr; + uint32_t ready_delay_us; + uint16_t window_size_us; + uint32_t aux_offset_us; + struct lll_scan *lll; + struct pdu_adv *pdu; + uint8_t hdr_buf_len; + bool is_scan_req; + uint8_t acad_len; + uint8_t data_len; + uint8_t hdr_len; + uint32_t pdu_us; + uint8_t phy_aux; + uint8_t *ptr; + uint8_t phy; + + is_scan_req = false; + ftr = &rx->rx_ftr; + + switch (rx->hdr.type) { + case NODE_RX_TYPE_EXT_1M_REPORT: + lll_aux = NULL; + chain = NULL; + sync_lll = NULL; + sync_iso = NULL; + rx_incomplete = NULL; + + lll = ftr->param; + LL_ASSERT(!lll->lll_aux); + + scan = HDR_LLL2ULL(lll); + sync = sync_create_get(scan); + phy = BT_HCI_LE_EXT_SCAN_PHY_1M; + break; + +#if defined(CONFIG_BT_CTLR_PHY_CODED) + case NODE_RX_TYPE_EXT_CODED_REPORT: + lll_aux = NULL; + chain = NULL; + sync_lll = NULL; + sync_iso = NULL; + rx_incomplete = NULL; + + lll = ftr->param; + LL_ASSERT(!lll->lll_aux); + + scan = HDR_LLL2ULL(lll); + sync = sync_create_get(scan); + phy = BT_HCI_LE_EXT_SCAN_PHY_CODED; + break; +#endif /* CONFIG_BT_CTLR_PHY_CODED */ + + case NODE_RX_TYPE_EXT_AUX_REPORT: + sync_iso = NULL; + rx_incomplete = NULL; + if (lll_scan_aux_chain_is_valid_get(ftr->param)) { + sync_lll = NULL; + + /* Node has valid chain context so its scan was scheduled + * from ULL. + */ + lll_aux = ftr->param; + chain = CONTAINER_OF(lll_aux, struct ll_scan_aux_chain, lll); + + /* chain parent will be NULL for periodic sync */ + lll = chain->parent; + LL_ASSERT(lll); + + } else if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || + ull_scan_is_valid_get(HDR_LLL2ULL(ftr->param))) { + sync_lll = NULL; + + /* Node that does not have valid chain context but has + * valid scan set was scheduled from LLL. We can + * retrieve chain context from lll_scan as it was stored + * there when superior PDU was handled. + */ + lll = ftr->param; + + lll_aux = lll->lll_aux; + LL_ASSERT(lll_aux); + + chain = CONTAINER_OF(lll_aux, struct ll_scan_aux_chain, lll); + LL_ASSERT(lll == chain->parent); + + } else { + lll = NULL; + + /* If none of the above, node is part of sync scanning + */ + sync_lll = ftr->param; + + lll_aux = sync_lll->lll_aux; + LL_ASSERT(lll_aux); + + chain = CONTAINER_OF(lll_aux, struct ll_scan_aux_chain, lll); + LL_ASSERT(sync_lll == chain->parent); + } + + if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || lll) { + scan = HDR_LLL2ULL(lll); + sync = (void *)scan; + scan = ull_scan_is_valid_get(scan); + if (scan) { + sync = NULL; + } + } else { + scan = NULL; + sync = HDR_LLL2ULL(sync_lll); + } + + phy = lll_aux->phy; + if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || scan) { + /* Here we are scanner context */ + sync = sync_create_get(scan); + + /* Generate report based on PHY scanned */ + switch (phy) { + case PHY_1M: + rx->hdr.type = NODE_RX_TYPE_EXT_1M_REPORT; + break; + case PHY_2M: + rx->hdr.type = NODE_RX_TYPE_EXT_2M_REPORT; + break; +#if defined(CONFIG_BT_CTLR_PHY_CODED) + case PHY_CODED: + rx->hdr.type = NODE_RX_TYPE_EXT_CODED_REPORT; + break; +#endif /* CONFIG_BT_CTLR_PHY_CODED */ + default: + LL_ASSERT(0); + return; + } + + /* Backup scan requested flag as it is in union with + * `extra` struct member which will be set to NULL + * in subsequent code. + */ + is_scan_req = !!ftr->scan_req; + +#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC) + } else { + /* Here we are periodic sync context */ + rx->hdr.type = NODE_RX_TYPE_SYNC_REPORT; + rx->hdr.handle = ull_sync_handle_get(sync); + + /* Check if we need to create BIG sync */ + sync_iso = sync_iso_create_get(sync); + + /* lll_aux and aux are auxiliary channel context, + * reuse the existing aux context to scan the chain. + * hence lll_aux and aux are not released or set to NULL. + */ + sync = NULL; + } + break; + + case NODE_RX_TYPE_SYNC_REPORT: + { + struct ll_sync_set *ull_sync; + + /* set the sync handle corresponding to the LLL context + * passed in the node rx footer field. + */ + sync_lll = ftr->param; + LL_ASSERT(!sync_lll->lll_aux); + + ull_sync = HDR_LLL2ULL(sync_lll); + rx->hdr.handle = ull_sync_handle_get(ull_sync); + + /* Check if we need to create BIG sync */ + sync_iso = sync_iso_create_get(ull_sync); + + /* FIXME: we will need lll_scan if chain was scheduled + * from LLL; should we store lll_scan_set in + * sync_lll instead? + */ + lll = NULL; + lll_aux = NULL; + chain = NULL; + scan = NULL; + sync = NULL; + phy = sync_lll->phy; + + /* backup extra node_rx supplied for generating + * incomplete report + */ + rx_incomplete = ftr->extra; +#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */ + + } + break; + default: + LL_ASSERT(0); + return; + } + + rx->hdr.link = link; + ftr->extra = NULL; + + ftr->aux_sched = 0U; + + if (chain) { + chain->aux_sched = 0U; + + if (!is_scan_req) { + /* Remove chain from active list */ + chain_remove_from_list(&scan_aux_set.active_chains, chain); + + /* Reset LLL scheduled flag */ + chain->is_lll_sched = 0U; + } + } + + pdu = (void *)rx->pdu; + p = (void *)&pdu->adv_ext_ind; + if (!pdu->len || !p->ext_hdr_len) { + if (pdu->len) { + data_len = pdu->len - PDU_AC_EXT_HEADER_SIZE_MIN; + } else { + data_len = 0U; + } + + if (chain) { + chain->data_len += data_len; + ftr->aux_data_len = chain->data_len; + } else { + ftr->aux_data_len = data_len; + } + + goto ull_scan_aux_rx_flush; + } + + h = (void *)p->ext_hdr_adv_data; + + /* Note: The extended header contains a RFU flag that could potentially cause incorrect + * calculation of offset to ACAD field if it gets used to add a new header field; However, + * from discussion in BT errata ES-8080 it seems clear that BT SIG is aware that the RFU + * bit can not be used to add a new field since existing implementations will not be able + * to calculate the start of ACAD in that case + */ + + ptr = h->data; + + if (h->adv_addr) { +#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC) + /* Check if Periodic Advertising Synchronization to be created + */ + if (sync && (scan->periodic.state != LL_SYNC_STATE_CREATED)) { + /* Check address and update internal state */ +#if defined(CONFIG_BT_CTLR_PRIVACY) + ull_sync_setup_addr_check(sync, scan, pdu->tx_addr, ptr, + ftr->rl_idx); +#else /* !CONFIG_BT_CTLR_PRIVACY */ + ull_sync_setup_addr_check(sync, scan, pdu->tx_addr, ptr, 0U); +#endif /* !CONFIG_BT_CTLR_PRIVACY */ + + } +#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */ + + ptr += BDADDR_SIZE; + } + + if (h->tgt_addr) { + ptr += BDADDR_SIZE; + } + + if (h->cte_info) { + ptr += sizeof(struct pdu_cte_info); + } + + adi = NULL; + if (h->adi) { + adi = (void *)ptr; + ptr += sizeof(*adi); + } + + aux_ptr = NULL; + if (h->aux_ptr) { + aux_ptr = (void *)ptr; + ptr += sizeof(*aux_ptr); + } + + if (h->sync_info) { + struct pdu_adv_sync_info *si; + + si = (void *)ptr; + ptr += sizeof(*si); + + /* Check if Periodic Advertising Synchronization to be created. + * Setup synchronization if address and SID match in the + * Periodic Advertiser List or with the explicitly supplied. + */ + if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) && chain && sync && adi && + ull_sync_setup_sid_match(sync, scan, PDU_ADV_ADI_SID_GET(adi))) { + ull_sync_setup(scan, chain->lll.phy, rx, si); + } + } + + if (h->tx_pwr) { + ptr++; + } + + /* Calculate ACAD Len */ + hdr_len = ptr - (uint8_t *)p; + hdr_buf_len = PDU_AC_EXT_HEADER_SIZE_MIN + p->ext_hdr_len; + if (hdr_len > hdr_buf_len) { + /* FIXME: Handle invalid header length */ + acad_len = 0U; + } else { + acad_len = hdr_buf_len - hdr_len; + hdr_len += acad_len; + } + + /* calculate and set total data length */ + if (hdr_len < pdu->len) { + data_len = pdu->len - hdr_len; + } else { + data_len = 0U; + } + + if (chain) { + chain->data_len += data_len; + ftr->aux_data_len = chain->data_len; + } else { + ftr->aux_data_len = data_len; + } + + /* Periodic Advertising Channel Map Indication and/or Broadcast ISO + * synchronization + */ + if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) && + (rx->hdr.type == NODE_RX_TYPE_SYNC_REPORT) && + acad_len) { + /* Periodic Advertising Channel Map Indication */ + ull_sync_chm_update(rx->hdr.handle, ptr, acad_len); + +#if defined(CONFIG_BT_CTLR_SYNC_ISO) + struct ll_sync_set *sync_set; + struct pdu_big_info *bi; + uint8_t bi_size; + + sync_set = HDR_LLL2ULL(sync_lll); + + /* Provide encryption information for BIG sync creation */ + bi_size = ptr[PDU_ADV_DATA_HEADER_LEN_OFFSET] - + PDU_ADV_DATA_HEADER_TYPE_SIZE; + sync_set->enc = (bi_size == PDU_BIG_INFO_ENCRYPTED_SIZE); + + /* Store number of BISes in the BIG */ + bi = (void *)&ptr[PDU_ADV_DATA_HEADER_DATA_OFFSET]; + sync_set->num_bis = PDU_BIG_INFO_NUM_BIS_GET(bi); + + /* Broadcast ISO synchronize */ + if (sync_iso) { + ull_sync_iso_setup(sync_iso, rx, ptr, acad_len); + } +#endif /* CONFIG_BT_CTLR_SYNC_ISO */ + } + + /* Do not ULL schedule auxiliary PDU reception if no aux pointer + * or aux pointer is zero or scannable advertising has erroneous aux + * pointer being present or PHY in the aux pointer is invalid or unsupported + * or if scanning and scan has been stopped + */ + if (!aux_ptr || !PDU_ADV_AUX_PTR_OFFSET_GET(aux_ptr) || is_scan_req || + (PDU_ADV_AUX_PTR_PHY_GET(aux_ptr) > EXT_ADV_AUX_PHY_LE_CODED) || + (!IS_ENABLED(CONFIG_BT_CTLR_PHY_CODED) && + PDU_ADV_AUX_PTR_PHY_GET(aux_ptr) == EXT_ADV_AUX_PHY_LE_CODED)) { + + if (is_scan_req) { + LL_ASSERT(chain && chain->rx_last); + + chain->rx_last->rx_ftr.extra = rx; + chain->rx_last = rx; + + return; + } + + goto ull_scan_aux_rx_flush; + } + + /* Determine the window size */ + if (aux_ptr->offs_units) { + window_size_us = OFFS_UNIT_300_US; + } else { + window_size_us = OFFS_UNIT_30_US; + } + + /* Calculate received aux offset we need to have ULL schedule a reception */ + aux_offset_us = (uint32_t)PDU_ADV_AUX_PTR_OFFSET_GET(aux_ptr) * window_size_us; + + /* Skip reception if invalid aux offset */ + pdu_us = PDU_AC_US(pdu->len, phy, ftr->phy_flags); + if (unlikely(!AUX_OFFSET_IS_VALID(aux_offset_us, window_size_us, pdu_us))) { + goto ull_scan_aux_rx_flush; + } + + /* CA field contains the clock accuracy of the advertiser; + * 0 - 51 ppm to 500 ppm + * 1 - 0 ppm to 50 ppm + */ + if (aux_ptr->ca) { + window_widening_us = SCA_DRIFT_50_PPM_US(aux_offset_us); + } else { + window_widening_us = SCA_DRIFT_500_PPM_US(aux_offset_us); + } + + phy_aux = BIT(PDU_ADV_AUX_PTR_PHY_GET(aux_ptr)); + ready_delay_us = lll_radio_rx_ready_delay_get(phy_aux, PHY_FLAGS_S8); + + /* Calculate the aux offset from start of the scan window */ + aux_offset_us += ftr->radio_end_us; + aux_offset_us -= pdu_us; + aux_offset_us -= EVENT_TICKER_RES_MARGIN_US; + aux_offset_us -= EVENT_JITTER_US; + aux_offset_us -= ready_delay_us; + aux_offset_us -= window_widening_us; + + ticks_aux_offset = HAL_TICKER_US_TO_TICKS(aux_offset_us); + + /* Check if too late to ULL schedule an auxiliary PDU reception */ + if (!ftr->aux_lll_sched) { + uint32_t ticks_at_expire; + uint32_t overhead_us; + uint32_t ticks_now; + uint32_t diff; + + /* CPU execution overhead to setup the radio for reception plus the + * minimum prepare tick offset. And allow one additional event in + * between as overhead (say, an advertising event in between got closed + * when reception for auxiliary PDU is being setup). + */ + overhead_us = (EVENT_OVERHEAD_END_US + EVENT_OVERHEAD_START_US + + HAL_TICKER_TICKS_TO_US(HAL_TICKER_CNTR_CMP_OFFSET_MIN)) << 1; + + ticks_now = ticker_ticks_now_get(); + ticks_at_expire = ftr->ticks_anchor + ticks_aux_offset - + HAL_TICKER_US_TO_TICKS(overhead_us); + diff = ticker_ticks_diff_get(ticks_now, ticks_at_expire); + if ((diff & BIT(HAL_TICKER_CNTR_MSBIT)) == 0U) { + goto ull_scan_aux_rx_flush; + } + } + + if (!chain) { + chain = aux_chain_acquire(); + if (!chain) { + /* As LLL scheduling has been used and will fail due to + * non-allocation of a new chain context, a sync report with + * aux_failed flag set will be generated. Let the + * current sync report be set as partial, and the + * sync report corresponding to ull_scan_aux_release + * have the incomplete data status. + */ + if (ftr->aux_lll_sched) { + ftr->aux_sched = 1U; + } + + goto ull_scan_aux_rx_flush; + } + + chain->rx_head = chain->rx_last = NULL; + chain->data_len = data_len; + chain->is_lll_sched = ftr->aux_lll_sched; + lll_aux = &chain->lll; + lll_aux->is_chain_sched = 0U; + + lll_hdr_init(lll_aux, &scan_aux_set); + + chain->parent = lll ? (void *)lll : (void *)sync_lll; +#if defined(CONFIG_BT_CTLR_JIT_SCHEDULING) + if (lll) { + lll_aux->hdr.score = lll->scan_aux_score; + } +#endif /* CONFIG_BT_CTLR_JIT_SCHEDULING */ + +#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC) + if (sync_lll) { + struct ll_sync_set *sync_set = HDR_LLL2ULL(sync_lll); + + sync_set->rx_incomplete = rx_incomplete; + rx_incomplete = NULL; + } +#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */ + + /* See if this was already scheduled from LLL. If so, store aux context + * in global scan/sync struct so we can pick it when scanned node is received + * with a valid context. + */ + if (ftr->aux_lll_sched) { + + if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) && sync_lll) { + sync_lll->lll_aux = lll_aux; + } else { + lll->lll_aux = lll_aux; + } + + /* Reset auxiliary channel PDU scan state which otherwise is + * done in the prepare_cb when ULL scheduling is used. + */ + lll_aux->state = 0U; + } + } else if (chain->data_len >= CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX) { + + /* Flush auxiliary PDU receptions and stop any more ULL + * scheduling if accumulated data length exceeds configured + * maximum supported. + */ + + /* If LLL has already scheduled, then let it proceed. + * + * TODO: LLL to check accumulated data length and + * stop further reception. + * Currently LLL will schedule as long as there + * are free node rx available. + */ + if (!ftr->aux_lll_sched) { + goto ull_scan_aux_rx_flush; + } + } + + /* In sync context we can dispatch rx immediately, in scan context we + * enqueue rx in aux context and will flush them after scan is complete. + */ + if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || scan) { + if (chain->rx_last) { + chain->rx_last->rx_ftr.extra = rx; + } else { + chain->rx_head = rx; + } + chain->rx_last = rx; + } + + /* Initialize the channel index and PHY for the Auxiliary PDU reception. + */ + lll_aux->chan = aux_ptr->chan_idx; + lll_aux->phy = phy_aux; + + if (ftr->aux_lll_sched) { + /* AUX_ADV_IND/AUX_CHAIN_IND PDU reception is being setup */ + ftr->aux_sched = 1U; + chain->aux_sched = 1U; + + chain->next = scan_aux_set.active_chains; + scan_aux_set.active_chains = chain; + + if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) && sync_lll) { + /* In sync context, dispatch immediately */ + ll_rx_put_sched(link, rx); + } + + return; + } + + /* Switching to ULL scheduling to receive auxiliary PDUs */ + if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || lll) { + LL_ASSERT(scan); + + /* Do not ULL schedule if scan disable requested */ + if (unlikely(scan->is_stop)) { + goto ull_scan_aux_rx_flush; + } + + /* Remove auxiliary context association with scan context so + * that LLL can differentiate it to being ULL scheduling. + */ + if (lll->lll_aux == &chain->lll) { + lll->lll_aux = NULL; + } + } else { + struct ll_sync_set *sync_set; + + LL_ASSERT(sync_lll && + (!sync_lll->lll_aux || sync_lll->lll_aux == lll_aux)); + + /* Do not ULL schedule if sync terminate requested */ + sync_set = HDR_LLL2ULL(sync_lll); + if (unlikely(sync_set->is_stop)) { + goto ull_scan_aux_rx_flush; + } + + /* Associate the auxiliary context with sync context, we do this + * for ULL scheduling also in constrast to how extended + * advertising only associates when LLL scheduling is used. + * Each Periodic Advertising chain is received by unique sync + * context, hence LLL and ULL scheduling is always associated + * with same unique sync context. + */ + sync_lll->lll_aux = lll_aux; + + } + + lll_aux->window_size_us = window_size_us; + lll_aux->window_size_us += ((EVENT_TICKER_RES_MARGIN_US + EVENT_JITTER_US + + window_widening_us) << 1); + + chain->ticker_ticks = (ftr->ticks_anchor + ticks_aux_offset) & HAL_TICKER_CNTR_MASK; + + if (!chain_insert_in_sched_list(chain)) { + /* Failed to add chain - flush */ + goto ull_scan_aux_rx_flush; + } + +#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC) + if (sync_lll) { + /* In sync context, dispatch immediately */ + rx->rx_ftr.aux_sched = 1U; + chain->aux_sched = 1U; + ll_rx_put_sched(link, rx); + } +#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */ + + return; + +ull_scan_aux_rx_flush: +#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC) + if (sync && (scan->periodic.state != LL_SYNC_STATE_CREATED)) { + scan->periodic.state = LL_SYNC_STATE_IDLE; + } +#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */ + + if (chain) { + /* Enqueue last rx in chain context if possible, otherwise send + * immediately since we are in sync context. + */ + if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || chain->rx_last) { + LL_ASSERT(scan); + + /* rx could already be enqueued before coming here - + * check if rx not the last in the list of received PDUs + * then add it, else do not add it, to avoid duplicate + * report generation, release and probable infinite loop + * processing of the list. + */ + if (chain->rx_last != rx) { + chain->rx_last->rx_ftr.extra = rx; + chain->rx_last = rx; + } + } else { + LL_ASSERT(sync_lll); + + ll_rx_put_sched(link, rx); + } + + LL_ASSERT(chain->parent); + + flush_safe(chain); + + return; + } + + ll_rx_put(link, rx); + + if (IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) && rx_incomplete) { + rx_release_put(rx_incomplete); + } + + ll_rx_sched(); +} + +void ull_scan_aux_done(struct node_rx_event_done *done) +{ + struct ll_scan_aux_chain *chain; + + /* Get reference to chain */ + chain = CONTAINER_OF(done->extra.lll, struct ll_scan_aux_chain, lll); + LL_ASSERT(scan_aux_chain_is_valid_get(chain)); + + /* Remove chain from active list */ + chain_remove_from_list(&scan_aux_set.active_chains, chain); + + flush(chain); +} + +struct ll_scan_aux_chain *lll_scan_aux_chain_is_valid_get(struct lll_scan_aux *lll) +{ + return scan_aux_chain_is_valid_get(CONTAINER_OF(lll, struct ll_scan_aux_chain, lll)); +} + +void *ull_scan_aux_lll_parent_get(struct lll_scan_aux *lll, + uint8_t *is_lll_scan) +{ + struct ll_scan_aux_chain *chain; + + chain = CONTAINER_OF(lll, struct ll_scan_aux_chain, lll); + + if (is_lll_scan) { + struct ll_scan_set *scan; + struct lll_scan *lllscan; + + lllscan = chain->parent; + LL_ASSERT(lllscan); + + scan = HDR_LLL2ULL(lllscan); + *is_lll_scan = !!ull_scan_is_valid_get(scan); + } + + return chain->parent; +} + +struct ll_scan_aux_chain *scan_aux_chain_is_valid_get(struct ll_scan_aux_chain *chain) +{ + if (((uint8_t *)chain < (uint8_t *)ll_scan_aux_pool) || + ((uint8_t *)chain > ((uint8_t *)ll_scan_aux_pool + + (sizeof(struct ll_scan_aux_chain) * + (CONFIG_BT_CTLR_SCAN_AUX_CHAIN_COUNT - 1))))) { + return NULL; + } + + return chain; +} + +struct lll_scan_aux *ull_scan_aux_lll_is_valid_get(struct lll_scan_aux *lll) +{ + struct ll_scan_aux_chain *chain; + + chain = CONTAINER_OF(lll, struct ll_scan_aux_chain, lll); + chain = scan_aux_chain_is_valid_get(chain); + if (chain) { + return &chain->lll; + } + + return NULL; +} + +void ull_scan_aux_release(memq_link_t *link, struct node_rx_pdu *rx) +{ + struct lll_scan_aux *lll_aux; + void *param_ull; + + param_ull = HDR_LLL2ULL(rx->rx_ftr.param); + + /* Mark for buffer for release */ + rx->hdr.type = NODE_RX_TYPE_RELEASE; + + if (ull_scan_is_valid_get(param_ull)) { + struct lll_scan *lll; + + lll = rx->rx_ftr.param; + lll_aux = lll->lll_aux; + + } else if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || + param_ull == &scan_aux_set) { + + lll_aux = rx->rx_ftr.param; + + } else if (ull_sync_is_valid_get(param_ull)) { + struct lll_sync *lll; + + lll = rx->rx_ftr.param; + lll_aux = lll->lll_aux; + + if (!lll_aux) { + struct ll_sync_set *sync = param_ull; + + /* Change node type so HCI can dispatch report for truncated + * data properly. + */ + rx->hdr.type = NODE_RX_TYPE_SYNC_REPORT; + rx->hdr.handle = ull_sync_handle_get(sync); + + /* Dequeue will try releasing list of node rx, set the extra + * pointer to NULL. + */ + rx->rx_ftr.extra = NULL; + } + } else { + LL_ASSERT(0); + lll_aux = NULL; + } + + if (lll_aux) { + struct ll_scan_aux_chain *chain; + struct ll_scan_set *scan; + struct lll_scan *lll; + uint8_t is_stop; + + chain = CONTAINER_OF(lll_aux, struct ll_scan_aux_chain, lll); + lll = chain->parent; + LL_ASSERT(lll); + + scan = HDR_LLL2ULL(lll); + scan = ull_scan_is_valid_get(scan); + if (scan) { + is_stop = scan->is_stop; + } else { + struct lll_sync *sync_lll; + struct ll_sync_set *sync; + + sync_lll = (void *)lll; + sync = HDR_LLL2ULL(sync_lll); + is_stop = sync->is_stop; + } + + if (!is_stop) { + LL_ASSERT(chain->parent); + + /* Remove chain from active list and flush */ + chain_remove_from_list(&scan_aux_set.active_chains, chain); + flush(chain); + } + } + + ll_rx_put(link, rx); + ll_rx_sched(); +} + +static void scan_aux_stop_all_chains_for_parent(void *parent) +{ + static memq_link_t link; + static struct mayfly mfy = {0, 0, &link, NULL, lll_disable}; + struct ll_scan_aux_chain *curr = scan_aux_set.sched_chains; + struct ll_scan_aux_chain *prev = NULL; + bool ticker_stopped = false; + bool disabling = false; + + if (curr && curr->parent == parent) { + uint8_t ticker_status; + + /* Scheduled head is about to be removed - stop running ticker */ + ticker_status = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, + TICKER_ID_SCAN_AUX, NULL, NULL); + LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); + ticker_stopped = true; + } + + while (curr) { + if (curr->parent == parent) { + if (curr == scan_aux_set.sched_chains) { + scan_aux_set.sched_chains = curr->next; + flush(curr); + curr = scan_aux_set.sched_chains; + } else { + prev->next = curr->next; + flush(curr); + curr = prev->next; + } + } else { + prev = curr; + curr = curr->next; + } + } + + if (ticker_stopped && scan_aux_set.sched_chains) { + /* Start ticker using new head */ + chain_start_ticker(scan_aux_set.sched_chains, false); + } + + /* Check active chains */ + prev = NULL; + curr = scan_aux_set.active_chains; + while (curr) { + if (curr->parent == parent) { + struct ll_scan_aux_chain *chain = curr; + uint32_t ret; + + if (curr == scan_aux_set.active_chains) { + scan_aux_set.active_chains = curr->next; + curr = scan_aux_set.active_chains; + } else { + prev->next = curr->next; + curr = prev->next; + } + + if (chain->is_lll_sched || ull_ref_get(&scan_aux_set.ull) == 0) { + /* Disable called by parent disable or race with scan stop */ + flush(chain); + } else { + /* Flush on disabled callback */ + chain->next = scan_aux_set.flushing_chains; + scan_aux_set.flushing_chains = chain; + scan_aux_set.ull.disabled_cb = done_disabled_cb; + + /* Call lll_disable */ + disabling = true; + mfy.param = &curr->lll; + ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, 0, + &mfy); + LL_ASSERT(!ret); + } + } else { + prev = curr; + curr = curr->next; + } + } + + if (!disabling) { + /* Signal completion */ + k_sem_give(&sem_scan_aux_stop); + } +} + +/* Stops all chains with the given parent */ +int ull_scan_aux_stop(void *parent) +{ + static memq_link_t link; + static struct mayfly mfy = {0, 0, &link, NULL, scan_aux_stop_all_chains_for_parent}; + uint32_t ret; + + /* Stop chains in ULL execution context */ + mfy.param = parent; + ret = mayfly_enqueue(TICKER_USER_ID_THREAD, TICKER_USER_ID_ULL_HIGH, 0, &mfy); + LL_ASSERT(!ret); + + /* Wait for chains to be stopped before returning */ + (void)k_sem_take(&sem_scan_aux_stop, K_FOREVER); + + return 0; +} + +static int init_reset(void) +{ + ull_hdr_init(&scan_aux_set.ull); + scan_aux_set.sched_chains = NULL; + scan_aux_set.active_chains = NULL; + + /* Initialize scan aux chains pool */ + mem_init(ll_scan_aux_pool, sizeof(struct ll_scan_aux_chain), + sizeof(ll_scan_aux_pool) / sizeof(struct ll_scan_aux_chain), + &scan_aux_free); + + return 0; +} + +static inline struct ll_scan_aux_chain *aux_chain_acquire(void) +{ + return mem_acquire(&scan_aux_free); +} + +static inline void aux_chain_release(struct ll_scan_aux_chain *chain) +{ + /* Clear the parent so that when scan is being disabled then this + * auxiliary context shall not associate itself from being disable. + */ + LL_ASSERT(chain->parent); + chain->parent = NULL; + + mem_release(chain, &scan_aux_free); +} + +static void done_disabled_cb(void *param) +{ + ARG_UNUSED(param); + + while (scan_aux_set.flushing_chains) { + flush(scan_aux_set.flushing_chains); + } + + scan_aux_set.ull.disabled_cb = NULL; + + /* Release semaphore if it is locked */ + if (k_sem_count_get(&sem_scan_aux_stop) == 0) { + k_sem_give(&sem_scan_aux_stop); + } +} + +static void flush_safe(void *param) +{ + struct ll_scan_aux_chain *chain; + + chain = param; + LL_ASSERT(chain->parent); + + if (chain_is_in_list(scan_aux_set.flushing_chains, chain)) { + /* Chain already marked for flushing */ + return; + } + + /* If chain is active we need to flush from disabled callback */ + if (chain_is_in_list(scan_aux_set.active_chains, chain) && + ull_ref_get(&scan_aux_set.ull)) { + + chain->next = scan_aux_set.flushing_chains; + scan_aux_set.flushing_chains = chain; + scan_aux_set.ull.disabled_cb = done_disabled_cb; + } else { + flush(chain); + } +} + +static void flush(struct ll_scan_aux_chain *chain) +{ + struct ll_scan_set *scan; + struct node_rx_pdu *rx; + struct lll_scan *lll; + bool sched = false; + + /* Debug check that parent was assigned when allocated for reception of + * auxiliary channel PDUs. + */ + LL_ASSERT(chain->parent); + + /* Chain is being flushed now - remove from flushing_chains if present */ + chain_remove_from_list(&scan_aux_set.flushing_chains, chain); + + lll = chain->parent; + scan = HDR_LLL2ULL(lll); + scan = ull_scan_is_valid_get(scan); + +#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC) + if (!scan && chain->aux_sched) { + /* Send incomplete sync message */ + aux_sync_incomplete(chain); + } +#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */ + + rx = chain->rx_head; + if (rx) { + chain->rx_head = NULL; + + ll_rx_put(rx->hdr.link, rx); + sched = true; + } + +#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC) + if (!scan) { + struct ll_sync_set *sync = HDR_LLL2ULL(lll); + + rx = sync->rx_incomplete; + if (rx) { + sync->rx_incomplete = NULL; + + rx_release_put(rx); + sched = true; + } + } +#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */ + + if (sched) { + ll_rx_sched(); + } + + if (!IS_ENABLED(CONFIG_BT_CTLR_SYNC_PERIODIC) || scan) { + if (lll->lll_aux == &chain->lll) { + lll->lll_aux = NULL; + } +#if defined(CONFIG_BT_CTLR_JIT_SCHEDULING) + lll->scan_aux_score = chain->lll.hdr.score; +#endif /* CONFIG_BT_CTLR_JIT_SCHEDULING */ + } else { + struct lll_sync *sync_lll; + struct ll_sync_set *sync; + + sync_lll = chain->parent; + sync = HDR_LLL2ULL(sync_lll); + + LL_ASSERT(sync->is_stop || sync_lll->lll_aux); + sync_lll->lll_aux = NULL; + } + + aux_chain_release(chain); +} + +#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC) +static void aux_sync_incomplete(struct ll_scan_aux_chain *chain) +{ + struct ll_sync_set *sync; + struct node_rx_pdu *rx; + struct lll_sync *lll; + + LL_ASSERT(chain->parent); + + /* get reference to sync context */ + lll = chain->parent; + LL_ASSERT(lll); + sync = HDR_LLL2ULL(lll); + + /* pick extra node rx stored in sync context */ + rx = sync->rx_incomplete; + LL_ASSERT(rx); + sync->rx_incomplete = NULL; + + /* prepare sync report with failure */ + rx->hdr.type = NODE_RX_TYPE_SYNC_REPORT; + rx->hdr.handle = ull_sync_handle_get(sync); + rx->rx_ftr.param = lll; + + /* flag chain reception failure */ + rx->rx_ftr.aux_failed = 1U; + + /* Dequeue will try releasing list of node rx, + * set the extra pointer to NULL. + */ + rx->rx_ftr.extra = NULL; + + /* add to rx list, will be flushed */ + chain->rx_head = rx; +} +#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */ + +static void chain_start_ticker(struct ll_scan_aux_chain *chain, bool replace) +{ +#if !defined(CONFIG_BT_TICKER_SLOT_AGNOSTIC) + uint8_t ticker_yield_handle = TICKER_NULL; +#endif /* !CONFIG_BT_TICKER_SLOT_AGNOSTIC */ + uint32_t ticks_slot_overhead; + uint32_t ticks_slot_offset; + uint32_t ready_delay_us; + uint8_t ticker_status; + +#if !defined(CONFIG_BT_TICKER_SLOT_AGNOSTIC) + if (ull_scan_is_valid_get(HDR_LLL2ULL(chain->parent))) { + if (chain->rx_head == chain->rx_last) { + struct ll_scan_set *scan = HDR_LLL2ULL(chain->parent); + + ticker_yield_handle = TICKER_ID_SCAN_BASE + + ull_scan_handle_get(scan); + } else { + ticker_yield_handle = TICKER_ID_SCAN_AUX; + } +#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC) + } else { + /* Periodic sync context */ + struct ll_sync_set *ull_sync = HDR_LLL2ULL(chain->parent); + + ticker_yield_handle = TICKER_ID_SCAN_SYNC_BASE + + ull_sync_handle_get(ull_sync); +#endif /* CONFIG_BT_CTLR_SYNC_PERIODIC */ + } +#endif /* !CONFIG_BT_TICKER_SLOT_AGNOSTIC */ + + ready_delay_us = lll_radio_rx_ready_delay_get(chain->lll.phy, PHY_FLAGS_S8); + + /* TODO: active_to_start feature port */ + scan_aux_set.ull.ticks_active_to_start = 0; + scan_aux_set.ull.ticks_prepare_to_start = + HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_XTAL_US); + scan_aux_set.ull.ticks_preempt_to_start = + HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_PREEMPT_MIN_US); + scan_aux_set.ull.ticks_slot = HAL_TICKER_US_TO_TICKS_CEIL( + EVENT_OVERHEAD_START_US + ready_delay_us + + PDU_AC_MAX_US(PDU_AC_EXT_PAYLOAD_RX_SIZE, chain->lll.phy) + + EVENT_OVERHEAD_END_US); + + ticks_slot_offset = MAX(scan_aux_set.ull.ticks_active_to_start, + scan_aux_set.ull.ticks_prepare_to_start); + if (IS_ENABLED(CONFIG_BT_CTLR_LOW_LAT)) { + ticks_slot_overhead = ticks_slot_offset; + } else { + ticks_slot_overhead = 0U; + } + ticks_slot_offset += HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_START_US); + +#if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) + /* disable ticker job, in order to chain yield and start to reduce + * CPU use by reducing successive calls to ticker_job(). + */ + mayfly_enable(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 0); +#endif + +#if !defined(CONFIG_BT_TICKER_SLOT_AGNOSTIC) + /* Yield the primary scan window or auxiliary or periodic sync event + * in ticker. + */ + if (ticker_yield_handle != TICKER_NULL) { + ticker_status = ticker_yield_abs(TICKER_INSTANCE_ID_CTLR, + TICKER_USER_ID_ULL_HIGH, + ticker_yield_handle, + (chain->ticker_ticks - + ticks_slot_offset), + NULL, NULL); + LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); + } +#endif /* !CONFIG_BT_TICKER_SLOT_AGNOSTIC */ + + if (replace) { + ticker_status = ticker_stop(TICKER_INSTANCE_ID_CTLR, TICKER_USER_ID_ULL_HIGH, + TICKER_ID_SCAN_AUX, NULL, NULL); + LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); + } + + ticker_status = ticker_start(TICKER_INSTANCE_ID_CTLR, + TICKER_USER_ID_ULL_HIGH, + TICKER_ID_SCAN_AUX, + chain->ticker_ticks - ticks_slot_offset, + 0, + TICKER_NULL_PERIOD, + TICKER_NULL_REMAINDER, + TICKER_NULL_LAZY, + (scan_aux_set.ull.ticks_slot + + ticks_slot_overhead), + ticker_cb, chain, ticker_op_cb, chain); +#if defined(CONFIG_BT_TICKER_SLOT_AGNOSTIC) + LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY)); +#else + LL_ASSERT((ticker_status == TICKER_STATUS_SUCCESS) || + (ticker_status == TICKER_STATUS_BUSY) || + ((ticker_status == TICKER_STATUS_FAILURE) && + IS_ENABLED(CONFIG_BT_TICKER_LOW_LAT))); +#endif /* !CONFIG_BT_TICKER_SLOT_AGNOSTIC */ + +#if (CONFIG_BT_CTLR_ULL_HIGH_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) + /* enable ticker job, queued ticker operation will be handled + * thereafter. + */ + mayfly_enable(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_LOW, 1); +#endif +} + +static void ticker_cb(uint32_t ticks_at_expire, uint32_t ticks_drift, + uint32_t remainder, uint16_t lazy, uint8_t force, + void *param) +{ + static memq_link_t link; + static struct mayfly mfy = {0, 0, &link, NULL, lll_scan_aux_prepare}; + struct ll_scan_aux_chain *chain = param; + static struct lll_prepare_param p; + uint32_t ret; + uint8_t ref; + + DEBUG_RADIO_PREPARE_O(1); + + /* Increment prepare reference count */ + ref = ull_ref_inc(&scan_aux_set.ull); + LL_ASSERT(ref); + + /* The chain should always be the first in the sched_chains list */ + LL_ASSERT(scan_aux_set.sched_chains == chain); + + /* Move chain to active list */ + chain_remove_from_list(&scan_aux_set.sched_chains, chain); + chain_append_to_list(&scan_aux_set.active_chains, chain); + + /* Append timing parameters */ + p.ticks_at_expire = ticks_at_expire; + p.remainder = 0; /* FIXME: remainder; */ + p.lazy = lazy; + p.force = force; + p.param = &chain->lll; + mfy.param = &p; + + /* Kick LLL prepare */ + ret = mayfly_enqueue(TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_LLL, + 0, &mfy); + LL_ASSERT(!ret); + + if (scan_aux_set.sched_chains) { + /* Start ticker for next chain */ + chain_start_ticker(scan_aux_set.sched_chains, false); + } + + DEBUG_RADIO_PREPARE_O(1); +} + +#if !defined(CONFIG_BT_TICKER_SLOT_AGNOSTIC) +static void ticker_start_failed(void *param) +{ + struct ll_scan_aux_chain *chain; + + /* Ticker start failed, so remove this chain from scheduled chains */ + chain = param; + chain_remove_from_list(&scan_aux_set.sched_chains, chain); + + flush(chain); + + if (scan_aux_set.sched_chains) { + chain_start_ticker(scan_aux_set.sched_chains, false); + } +} +#endif /* !CONFIG_BT_TICKER_SLOT_AGNOSTIC */ + +static void ticker_op_cb(uint32_t status, void *param) +{ +#if defined(CONFIG_BT_TICKER_SLOT_AGNOSTIC) + LL_ASSERT(status == TICKER_STATUS_SUCCESS); +#else /* !CONFIG_BT_TICKER_SLOT_AGNOSTIC */ + static memq_link_t link; + static struct mayfly mfy = {0, 0, &link, NULL, ticker_start_failed}; + uint32_t ret; + + if (status == TICKER_STATUS_SUCCESS) { + return; + } + + mfy.param = param; + + ret = mayfly_enqueue(TICKER_USER_ID_ULL_LOW, TICKER_USER_ID_ULL_HIGH, + 1, &mfy); + LL_ASSERT(!ret); +#endif /* !CONFIG_BT_TICKER_SLOT_AGNOSTIC */ +} + +static int32_t chain_ticker_ticks_diff(uint32_t ticks_a, uint32_t ticks_b) +{ + if ((ticks_a - ticks_b) & BIT(HAL_TICKER_CNTR_MSBIT)) { + return -ticker_ticks_diff_get(ticks_b, ticks_a); + } else { + return ticker_ticks_diff_get(ticks_a, ticks_b); + } +} + +/* Sorted insertion into sched list, starting/replacing the ticker when needed + * Returns: + * - false for no insertion (conflict with existing entry) + * - true for inserted + */ +static bool chain_insert_in_sched_list(struct ll_scan_aux_chain *chain) +{ + struct ll_scan_aux_chain *curr = scan_aux_set.sched_chains; + struct ll_scan_aux_chain *prev = NULL; + uint32_t ticks_min_delta; + + if (!scan_aux_set.sched_chains) { + chain->next = NULL; + scan_aux_set.sched_chains = chain; + chain_start_ticker(chain, false); + return true; + } + + /* Find insertion point */ + while (curr && chain_ticker_ticks_diff(chain->ticker_ticks, curr->ticker_ticks) > 0) { + prev = curr; + curr = curr->next; + } + + /* Check for conflict with existing entry */ + ticks_min_delta = HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_END_US + EVENT_OVERHEAD_START_US); + if ((prev && + ticker_ticks_diff_get(chain->ticker_ticks, prev->ticker_ticks) < ticks_min_delta) || + (curr && + ticker_ticks_diff_get(curr->ticker_ticks, chain->ticker_ticks) < ticks_min_delta)) { + return false; + } + + if (prev) { + chain->next = prev->next; + prev->next = chain; + } else { + chain->next = scan_aux_set.sched_chains; + scan_aux_set.sched_chains = chain; + chain_start_ticker(chain, true); + } + + return true; +} + +static void chain_remove_from_list(struct ll_scan_aux_chain **head, struct ll_scan_aux_chain *chain) +{ + struct ll_scan_aux_chain *curr = *head; + struct ll_scan_aux_chain *prev = NULL; + + while (curr && curr != chain) { + prev = curr; + curr = curr->next; + } + + if (curr) { + if (prev) { + prev->next = curr->next; + } else { + *head = curr->next; + } + } + + chain->next = NULL; +} + +static void chain_append_to_list(struct ll_scan_aux_chain **head, struct ll_scan_aux_chain *chain) +{ + struct ll_scan_aux_chain *prev = *head; + + if (!*head) { + chain->next = NULL; + *head = chain; + return; + } + + while (prev->next) { + prev = prev->next; + } + + prev->next = chain; +} + +static bool chain_is_in_list(struct ll_scan_aux_chain *head, struct ll_scan_aux_chain *chain) +{ + while (head) { + if (head == chain) { + return true; + } + head = head->next; + } + return false; +} +#endif /* CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_scan_internal.h b/subsys/bluetooth/controller/ll_sw/ull_scan_internal.h index a399cbfd86356..d9ea37ef3bd38 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_scan_internal.h +++ b/subsys/bluetooth/controller/ll_sw/ull_scan_internal.h @@ -91,4 +91,8 @@ struct ll_scan_aux_set *ull_scan_aux_is_valid_get(struct ll_scan_aux_set *aux); void ull_scan_aux_release(memq_link_t *link, struct node_rx_pdu *rx); /* Helper function to stop auxiliary scan context */ +#if defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) +int ull_scan_aux_stop(void *parent); +#else /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ int ull_scan_aux_stop(struct ll_scan_aux_set *aux); +#endif /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_scan_types.h b/subsys/bluetooth/controller/ll_sw/ull_scan_types.h index ab91448f34cf3..c9d2c073f8f97 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_scan_types.h +++ b/subsys/bluetooth/controller/ll_sw/ull_scan_types.h @@ -35,8 +35,40 @@ struct ll_scan_set { #endif }; +struct ll_scan_aux_chain { + struct lll_scan_aux lll; + + /* lll_scan or lll_sync */ + void *volatile parent; + + /* Current nodes in this chain */ + /* TODO - do we need both head and tail? */ + struct node_rx_pdu *rx_head; + struct node_rx_pdu *rx_last; + + /* current ticker timeout for this chain */ + uint32_t ticker_ticks; + + /* Next chain in list (if any) */ + struct ll_scan_aux_chain *next; + + /* Current total advertising data */ + uint16_t data_len; + + /* This chain is LLL scheduled */ + uint8_t is_lll_sched:1; + /* Last emitted node_rx's aux_sched (only used in sync contexts) */ + uint8_t aux_sched:1; +}; + struct ll_scan_aux_set { struct ull_hdr ull; + +#if defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) + struct ll_scan_aux_chain *sched_chains; + struct ll_scan_aux_chain *active_chains; + struct ll_scan_aux_chain *flushing_chains; +#else /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ struct lll_scan_aux lll; /* lll_scan or lll_sync */ @@ -50,4 +82,5 @@ struct ll_scan_aux_set { #if defined(CONFIG_BT_CTLR_SYNC_PERIODIC) struct node_rx_pdu *rx_incomplete; #endif +#endif /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ }; diff --git a/subsys/bluetooth/controller/ll_sw/ull_sync.c b/subsys/bluetooth/controller/ll_sw/ull_sync.c index e151f9b8f4703..63e9e7ef57c8f 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sync.c +++ b/subsys/bluetooth/controller/ll_sw/ull_sync.c @@ -577,15 +577,21 @@ uint8_t ll_sync_terminate(uint16_t handle) /* Check and stop any auxiliary PDU receptions */ lll_aux = sync->lll.lll_aux; if (lll_aux) { +#if defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) + err = ull_scan_aux_stop(&sync->lll); +#else /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ struct ll_scan_aux_set *aux; aux = HDR_LLL2ULL(lll_aux); err = ull_scan_aux_stop(aux); +#endif /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ if (err && (err != -EALREADY)) { return BT_HCI_ERR_CMD_DISALLOWED; } +#if !defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) LL_ASSERT(!aux->parent); +#endif /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ } #if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) @@ -866,8 +872,10 @@ void ull_sync_release(struct ll_sync_set *sync) sync->timeout = 0U; } +#if !defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) /* reset accumulated data len */ sync->data_len = 0U; +#endif /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ mem_release(sync, &sync_free); } @@ -938,7 +946,7 @@ bool ull_sync_setup_sid_match(struct ll_sync_set *sync, struct ll_scan_set *scan (sid == sync->sid))); } -void ull_sync_setup(struct ll_scan_set *scan, struct ll_scan_aux_set *aux, +void ull_sync_setup(struct ll_scan_set *scan, uint8_t phy, struct node_rx_pdu *node_rx, struct pdu_adv_sync_info *si) { uint32_t ticks_slot_overhead; @@ -987,7 +995,7 @@ void ull_sync_setup(struct ll_scan_set *scan, struct ll_scan_aux_set *aux, lll->data_chan_id = lll_chan_id(lll->access_addr); memcpy(lll->crc_init, si->crc_init, sizeof(lll->crc_init)); lll->event_counter = sys_le16_to_cpu(si->evt_cntr); - lll->phy = aux->lll.phy; + lll->phy = phy; lll->forced = 0U; interval = sys_le16_to_cpu(si->interval); diff --git a/subsys/bluetooth/controller/ll_sw/ull_sync_internal.h b/subsys/bluetooth/controller/ll_sw/ull_sync_internal.h index a9d19c2e5466f..79f2f3d67de89 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sync_internal.h +++ b/subsys/bluetooth/controller/ll_sw/ull_sync_internal.h @@ -16,7 +16,7 @@ void ull_sync_create_from_sync_transfer(uint16_t conn_handle, uint16_t service_ struct ll_sync_set *sync, struct pdu_adv_sync_info *si, uint32_t conn_offset_us); -void ull_sync_setup(struct ll_scan_set *scan, struct ll_scan_aux_set *aux, +void ull_sync_setup(struct ll_scan_set *scan, uint8_t phy, struct node_rx_pdu *node_rx, struct pdu_adv_sync_info *si); void ull_sync_setup_reset(struct ll_sync_set *sync); void ull_sync_established_report(memq_link_t *link, struct node_rx_pdu *rx); diff --git a/subsys/bluetooth/controller/ll_sw/ull_sync_types.h b/subsys/bluetooth/controller/ll_sw/ull_sync_types.h index d816abb217cbe..5ec93ee81cdf7 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sync_types.h +++ b/subsys/bluetooth/controller/ll_sw/ull_sync_types.h @@ -75,6 +75,11 @@ struct ll_sync_set { */ struct node_rx_pdu *node_rx_sync_estab; +#if defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) + /* Extra node_rx for generating incomplete report */ + struct node_rx_pdu *rx_incomplete; +#endif /* CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ + #if defined(CONFIG_BT_CTLR_SYNC_ISO) struct { struct node_rx_pdu *node_rx_estab; @@ -87,11 +92,14 @@ struct ll_sync_set { } iso; #endif /* CONFIG_BT_CTLR_SYNC_ISO */ +#if !defined(CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS) uint16_t data_len; +#endif /* !CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS */ #if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER) uint16_t interval; #endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER */ }; + struct node_rx_sync { uint8_t status; uint8_t phy; From e07076df87312bd93d98f36c26e50254b1a8be87 Mon Sep 17 00:00:00 2001 From: Troels Nilsson Date: Tue, 22 Oct 2024 12:58:57 +0200 Subject: [PATCH 1653/4482] tests: Bluetooth: Add BSim tests with BT_CTLR_SCAN_AUX_USE_CHAINS Add overlay setting CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS for advx and bis tests Signed-off-by: Troels Nilsson --- .../ll/advx/overlay-scan_aux_use_chains.conf | 2 ++ .../basic_advx_scan_aux_use_chains.sh | 24 +++++++++++++++++++ .../ll/bis/overlay-scan_aux_use_chains.conf | 2 ++ .../broadcast_iso_scan_aux_use_chains.sh | 23 ++++++++++++++++++ tests/bsim/bluetooth/ll/compile.sh | 2 ++ 5 files changed, 53 insertions(+) create mode 100644 tests/bsim/bluetooth/ll/advx/overlay-scan_aux_use_chains.conf create mode 100755 tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_scan_aux_use_chains.sh create mode 100644 tests/bsim/bluetooth/ll/bis/overlay-scan_aux_use_chains.conf create mode 100755 tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso_scan_aux_use_chains.sh diff --git a/tests/bsim/bluetooth/ll/advx/overlay-scan_aux_use_chains.conf b/tests/bsim/bluetooth/ll/advx/overlay-scan_aux_use_chains.conf new file mode 100644 index 0000000000000..f390e698184bf --- /dev/null +++ b/tests/bsim/bluetooth/ll/advx/overlay-scan_aux_use_chains.conf @@ -0,0 +1,2 @@ +CONFIG_BT_CTLR_ADVANCED_FEATURES=y +CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS=y diff --git a/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_scan_aux_use_chains.sh b/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_scan_aux_use_chains.sh new file mode 100755 index 0000000000000..0e26ae907de3c --- /dev/null +++ b/tests/bsim/bluetooth/ll/advx/tests_scripts/basic_advx_scan_aux_use_chains.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# Copyright 2018 Oticon A/S +# SPDX-License-Identifier: Apache-2.0 + +source ${ZEPHYR_BASE}/tests/bsim/sh_common.source + +# Basic connection test: a central connects to a peripheral and expects a +# notification, using the split controller (ULL LLL) +simulation_id="basic_advx_scan_aux_use_chains" +verbosity_level=2 +EXECUTE_TIMEOUT=120 + +cd ${BSIM_OUT_PATH}/bin + +Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_advx_prj_conf_overlay-scan_aux_use_chains_conf \ + -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=advx + +Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_advx_prj_conf_overlay-scan_aux_use_chains_conf \ + -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=scanx + +Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ + -D=2 -sim_length=60e6 $@ + +wait_for_background_jobs diff --git a/tests/bsim/bluetooth/ll/bis/overlay-scan_aux_use_chains.conf b/tests/bsim/bluetooth/ll/bis/overlay-scan_aux_use_chains.conf new file mode 100644 index 0000000000000..f390e698184bf --- /dev/null +++ b/tests/bsim/bluetooth/ll/bis/overlay-scan_aux_use_chains.conf @@ -0,0 +1,2 @@ +CONFIG_BT_CTLR_ADVANCED_FEATURES=y +CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS=y diff --git a/tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso_scan_aux_use_chains.sh b/tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso_scan_aux_use_chains.sh new file mode 100755 index 0000000000000..310a98d082ab8 --- /dev/null +++ b/tests/bsim/bluetooth/ll/bis/tests_scripts/broadcast_iso_scan_aux_use_chains.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# Copyright 2020 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source ${ZEPHYR_BASE}/tests/bsim/sh_common.source + +# Basic ISO broadcast test: a broadcaster transmits a BIS and a receiver listens +# to the BIS. +simulation_id="broadcast_iso_scan_aux_use_chains" +verbosity_level=2 + +cd ${BSIM_OUT_PATH}/bin + +Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_bis_prj_conf_overlay-scan_aux_use_chains_conf \ + -v=${verbosity_level} -s=${simulation_id} -d=0 -testid=receive + +Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_bis_prj_conf_overlay-scan_aux_use_chains_conf \ + -v=${verbosity_level} -s=${simulation_id} -d=1 -testid=broadcast + +Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \ + -D=2 -sim_length=30e6 $@ + +wait_for_background_jobs diff --git a/tests/bsim/bluetooth/ll/compile.sh b/tests/bsim/bluetooth/ll/compile.sh index 5b7e374510aa8..6eae34b67a848 100755 --- a/tests/bsim/bluetooth/ll/compile.sh +++ b/tests/bsim/bluetooth/ll/compile.sh @@ -15,6 +15,7 @@ ${ZEPHYR_BASE}/tests/bsim/bluetooth/ll/cis/compile.sh app=tests/bsim/bluetooth/ll/advx compile app=tests/bsim/bluetooth/ll/advx \ conf_overlay=overlay-ticker_expire_info.conf compile +app=tests/bsim/bluetooth/ll/advx conf_overlay=overlay-scan_aux_use_chains.conf compile app=tests/bsim/bluetooth/ll/conn conf_file=prj_split.conf compile app=tests/bsim/bluetooth/ll/conn conf_file=prj_split_1ms.conf compile @@ -26,6 +27,7 @@ app=tests/bsim/bluetooth/ll/conn conf_file=prj_split_single_timer.conf compile app=tests/bsim/bluetooth/ll/bis compile app=tests/bsim/bluetooth/ll/bis conf_overlay=overlay-ll_interface.conf compile app=tests/bsim/bluetooth/ll/bis conf_overlay=overlay-ticker_expire_info.conf compile +app=tests/bsim/bluetooth/ll/bis conf_overlay=overlay-scan_aux_use_chains.conf compile app=tests/bsim/bluetooth/ll/bis conf_file=prj_vs_dp.conf compile app=tests/bsim/bluetooth/ll/bis conf_file=prj_past.conf compile From 41f53b209169f967cb43bc59f2f730f6f838a5eb Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Tue, 22 Oct 2024 14:19:46 +0200 Subject: [PATCH 1654/4482] drivers: cache: Enable LINEADDR workaround on nRF54H20 EngB Just like on nRF54H20 EngC. Signed-off-by: Grzegorz Swiderski --- drivers/cache/Kconfig.nrf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cache/Kconfig.nrf b/drivers/cache/Kconfig.nrf index c1cfc2c8c582c..ffcbfe66d1957 100644 --- a/drivers/cache/Kconfig.nrf +++ b/drivers/cache/Kconfig.nrf @@ -10,6 +10,6 @@ config CACHE_NRF_CACHE config CACHE_NRF_PATCH_LINEADDR bool "Patch lineaddr" - default y if SOC_NRF54H20 + default y if SOC_NRF54H20 || SOC_NRF54H20_ENGB help Manually set 28th bit in the LINEADDR in Trustzone Secure build. From 3f221f9577e33eeee37442d8a22f049c1f1a1f65 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Tue, 22 Oct 2024 14:19:46 +0200 Subject: [PATCH 1655/4482] modules: hal_nordic: Disable 802.15.4 temp update on nRF54H20 EngB Just like on nRF54H20 EngC. Signed-off-by: Grzegorz Swiderski --- modules/hal_nordic/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hal_nordic/Kconfig b/modules/hal_nordic/Kconfig index dd4e0a0859b1f..9d54c15d71590 100644 --- a/modules/hal_nordic/Kconfig +++ b/modules/hal_nordic/Kconfig @@ -55,7 +55,7 @@ endchoice config NRF_802154_TEMPERATURE_UPDATE bool "nRF 802.15.4 temperature update" - default y if !SOC_NRF54H20 + default y if !SOC_NRF54H20 && !SOC_NRF54H20_ENGB help Enable temperature update for nRF 802.15.4 driver From 0379424b4372eeecf15e57938a74cd4c44ac55f1 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Tue, 22 Oct 2024 14:19:46 +0200 Subject: [PATCH 1656/4482] modules: hal_nordic: nrfs: Enable DVFS service on nRF54H20 EngB Just like on nRF54H20 EngC. Signed-off-by: Grzegorz Swiderski --- modules/hal_nordic/nrfs/Kconfig | 2 +- modules/hal_nordic/nrfs/dvfs/ld_dvfs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/hal_nordic/nrfs/Kconfig b/modules/hal_nordic/nrfs/Kconfig index 7245b72875793..eafe06167646d 100644 --- a/modules/hal_nordic/nrfs/Kconfig +++ b/modules/hal_nordic/nrfs/Kconfig @@ -103,7 +103,7 @@ config NRFS_PMIC_SERVICE_ENABLED config NRFS_DVFS_SERVICE_ENABLED bool "DVFS service" depends on NRFS_HAS_DVFS_SERVICE - default y if SOC_NRF54H20_CPUAPP || SOC_NRF9280_CPUAPP + default y if SOC_NRF54H20_CPUAPP || SOC_NRF54H20_ENGB_CPUAPP || SOC_NRF9280_CPUAPP config NRFS_DIAG_SERVICE_ENABLED bool "System Diagnostics service (only for development purposes)" diff --git a/modules/hal_nordic/nrfs/dvfs/ld_dvfs.c b/modules/hal_nordic/nrfs/dvfs/ld_dvfs.c index 1faffbdb3c263..57ee0bdc37514 100644 --- a/modules/hal_nordic/nrfs/dvfs/ld_dvfs.c +++ b/modules/hal_nordic/nrfs/dvfs/ld_dvfs.c @@ -269,7 +269,7 @@ int32_t ld_dvfs_configure_hsfll(enum dvfs_frequency_setting oppoint) freq_trim = 2; } -#if defined(CONFIG_SOC_NRF54H20_CPUAPP) || defined(CONFIG_SOC_NRF9280_CPUAPP) +#if defined(NRF_APPLICATION) hsfll_trim.vsup = NRF_FICR->TRIM.APPLICATION.HSFLL.TRIM.VSUP; hsfll_trim.coarse = NRF_FICR->TRIM.APPLICATION.HSFLL.TRIM.COARSE[freq_trim]; hsfll_trim.fine = NRF_FICR->TRIM.APPLICATION.HSFLL.TRIM.FINE[freq_trim]; From bcf6a91689eb507d9548fee84866a8b9c4402043 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Tue, 22 Oct 2024 14:19:46 +0200 Subject: [PATCH 1657/4482] logging: stmesp: Do not append strings on nRF54H20 EngB VPRs Just like on nRF54H20 EngC. Signed-off-by: Grzegorz Swiderski --- subsys/logging/frontends/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/subsys/logging/frontends/Kconfig b/subsys/logging/frontends/Kconfig index c232eb7354ade..4d6d85e3e8834 100644 --- a/subsys/logging/frontends/Kconfig +++ b/subsys/logging/frontends/Kconfig @@ -46,8 +46,9 @@ config LOG_FRONTEND_STMESP_DICT config LOG_FRONTEND_STMESP_FSC bool "Send fully self-contained messages" - select LOG_MSG_APPEND_RO_STRING_LOC if (!NRF_ETR && !SOC_NRF54H20_CPUPPR && \ - !SOC_NRF54H20_CPUFLPR) + select LOG_MSG_APPEND_RO_STRING_LOC if !(NRF_ETR || \ + SOC_NRF54H20_CPUPPR || SOC_NRF54H20_ENGB_CPUPPR || \ + SOC_NRF54H20_CPUFLPR || SOC_NRF54H20_ENGB_CPUFLPR) config LOG_FRONTEND_STMESP_FLUSH_COUNT int "Number of flushing words" From b3b0c63ad9534da8e0893ef4f26e8150119c38dd Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Wed, 23 Oct 2024 09:48:01 +0200 Subject: [PATCH 1658/4482] soc: nordic: Enable VPR launcher on nRF54H20 EngB Just like on nRF54H20 EngC. Signed-off-by: Grzegorz Swiderski --- soc/nordic/common/vpr/Kconfig.sysbuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/nordic/common/vpr/Kconfig.sysbuild b/soc/nordic/common/vpr/Kconfig.sysbuild index cfbd619f623f6..8821810d63d78 100644 --- a/soc/nordic/common/vpr/Kconfig.sysbuild +++ b/soc/nordic/common/vpr/Kconfig.sysbuild @@ -4,7 +4,7 @@ config VPR_LAUNCHER bool "VPR launcher" default y - depends on (SOC_NRF54H20_CPUPPR || SOC_NRF54H20_CPUFLPR || SOC_NRF54L15_CPUFLPR || SOC_NRF9280_CPUPPR) + depends on (SOC_NRF54H20_CPUPPR || SOC_NRF54H20_ENGB_CPUPPR || SOC_NRF54H20_CPUFLPR || SOC_NRF54H20_ENGB_CPUFLPR || SOC_NRF54L15_CPUFLPR || SOC_NRF9280_CPUPPR) help Include VPR launcher in build. VPR launcher is a minimal sample built for an ARM core that starts given VPR core. From 96f08d53a482beb8867861f230adaf79955bb7c0 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Wed, 23 Oct 2024 09:48:01 +0200 Subject: [PATCH 1659/4482] drivers: adc: nrfx_saadc: Use CONFIG_NRF_PLATFORM_HALTIUM Apply it in a few more locations that were missed in 5a4655f69fb2c006a4ee0ddcfe4372066b0cb138. Signed-off-by: Grzegorz Swiderski --- drivers/adc/adc_nrfx_saadc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index e4c37a1f73606..b8782d0245483 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -66,9 +66,9 @@ BUILD_ASSERT((NRF_SAADC_AIN0 == NRF_SAADC_INPUT_AIN0) && "Definitions from nrf-adc.h do not match those from nrf_saadc.h"); #endif -#if defined(CONFIG_SOC_NRF54H20) || defined(CONFIG_SOC_NRF9280) +#if defined(CONFIG_NRF_PLATFORM_HALTIUM) -/* nRF54H20 and nRF9280 always use bounce buffers in RAM */ +/* Haltium devices always use bounce buffers in RAM */ #define SAADC_MEMORY_SECTION \ COND_CODE_1(DT_NODE_HAS_PROP(DT_NODELABEL(adc), memory_regions), \ @@ -80,7 +80,7 @@ static uint16_t adc_samples_buffer[SAADC_CH_NUM] SAADC_MEMORY_SECTION; #define ADC_BUFFER_IN_RAM -#endif /* defined(CONFIG_SOC_NRF54H20) || defined(CONFIG_SOC_NRF9280) */ +#endif /* defined(CONFIG_NRF_PLATFORM_HALTIUM) */ struct driver_data { struct adc_context ctx; @@ -669,7 +669,7 @@ static const struct adc_driver_api adc_nrfx_driver_api = { #endif #if defined(CONFIG_SOC_NRF54L15) .ref_internal = 900, -#elif defined(CONFIG_SOC_NRF54H20) || defined(CONFIG_SOC_NRF9280) +#elif defined(CONFIG_NRF_PLATFORM_HALTIUM) .ref_internal = 1024, #else .ref_internal = 600, From d4e246dfa1f2fe09ba526dce38b218297b698948 Mon Sep 17 00:00:00 2001 From: Riadh Ghaddab Date: Mon, 26 Feb 2024 12:18:58 +0100 Subject: [PATCH 1660/4482] fs: introduce ZMS a new Memory storage system ZMS is the abreviation of Zephyr Memory Storage. It is a storage developed to target especially the non erasable devices. The new memory storage system inherit from the NVS storage multiple features and introduce new ones : * Inherited features : - light key-value based storage - cache for entries - Wear Leveling of flash memory - Resilience to power failures * New features : - cycle counter for non erasable devices (instead of erase emulation) - Keys up to 32-bit - Built-in support of CRC32 for data - Small size data (<= 8 bytes) integrated within entries Signed-off-by: Riadh Ghaddab --- include/zephyr/fs/zms.h | 215 +++++ subsys/fs/CMakeLists.txt | 1 + subsys/fs/Kconfig | 1 + subsys/fs/zms/CMakeLists.txt | 3 + subsys/fs/zms/Kconfig | 57 ++ subsys/fs/zms/zms.c | 1752 ++++++++++++++++++++++++++++++++++ subsys/fs/zms/zms_priv.h | 76 ++ 7 files changed, 2105 insertions(+) create mode 100644 include/zephyr/fs/zms.h create mode 100644 subsys/fs/zms/CMakeLists.txt create mode 100644 subsys/fs/zms/Kconfig create mode 100644 subsys/fs/zms/zms.c create mode 100644 subsys/fs/zms/zms_priv.h diff --git a/include/zephyr/fs/zms.h b/include/zephyr/fs/zms.h new file mode 100644 index 0000000000000..1155319d7924b --- /dev/null +++ b/include/zephyr/fs/zms.h @@ -0,0 +1,215 @@ +/* ZMS: Zephyr Memory Storage + * + * Copyright (c) 2024 BayLibre SAS + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef ZEPHYR_INCLUDE_FS_ZMS_H_ +#define ZEPHYR_INCLUDE_FS_ZMS_H_ + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Zephyr Memory Storage (ZMS) + * @defgroup zms Zephyr Memory Storage (ZMS) + * @ingroup file_system_storage + * @{ + * @} + */ + +/** + * @brief Zephyr Memory Storage Data Structures + * @defgroup zms_data_structures Zephyr Memory Storage Data Structures + * @ingroup zms + * @{ + */ + +/** + * @brief Zephyr Memory Storage File system structure + */ +struct zms_fs { + /** File system offset in flash **/ + off_t offset; + /** Allocation table entry write address. + * Addresses are stored as uint64_t: + * - high 4 bytes correspond to the sector + * - low 4 bytes are the offset in the sector + */ + uint64_t ate_wra; + /** Data write address */ + uint64_t data_wra; + /** Storage system is split into sectors, each sector size must be multiple of erase-blocks + * if the device has erase capabilities + */ + uint32_t sector_size; + /** Number of sectors in the file system */ + uint32_t sector_count; + /** Current cycle counter of the active sector (pointed by ate_wra)*/ + uint8_t sector_cycle; + /** Flag indicating if the file system is initialized */ + bool ready; + /** Mutex */ + struct k_mutex zms_lock; + /** Flash device runtime structure */ + const struct device *flash_device; + /** Flash memory parameters structure */ + const struct flash_parameters *flash_parameters; + /** Size of an Allocation Table Entry */ + size_t ate_size; +#if CONFIG_ZMS_LOOKUP_CACHE + /** Lookup table used to cache ATE address of a written ID */ + uint64_t lookup_cache[CONFIG_ZMS_LOOKUP_CACHE_SIZE]; +#endif +}; + +/** + * @} + */ + +/** + * @brief Zephyr Memory Storage APIs + * @defgroup zms_high_level_api Zephyr Memory Storage APIs + * @ingroup zms + * @{ + */ + +/** + * @brief Mount a ZMS file system onto the device specified in @p fs. + * + * @param fs Pointer to file system + * @retval 0 Success + * @retval -ERRNO errno code if error + */ +int zms_mount(struct zms_fs *fs); + +/** + * @brief Clear the ZMS file system from device. + * + * @param fs Pointer to file system + * @retval 0 Success + * @retval -ERRNO errno code if error + */ +int zms_clear(struct zms_fs *fs); + +/** + * @brief Write an entry to the file system. + * + * @note When @p len parameter is equal to @p 0 then entry is effectively removed (it is + * equivalent to calling of zms_delete). It is not possible to distinguish between a deleted + * entry and an entry with data of length 0. + * + * @param fs Pointer to file system + * @param id Id of the entry to be written + * @param data Pointer to the data to be written + * @param len Number of bytes to be written (maximum 64 KB) + * + * @return Number of bytes written. On success, it will be equal to the number of bytes requested + * to be written. When a rewrite of the same data already stored is attempted, nothing is written + * to flash, thus 0 is returned. On error, returns negative value of errno.h defined error codes. + */ +ssize_t zms_write(struct zms_fs *fs, uint32_t id, const void *data, size_t len); + +/** + * @brief Delete an entry from the file system + * + * @param fs Pointer to file system + * @param id Id of the entry to be deleted + * @retval 0 Success + * @retval -ERRNO errno code if error + */ +int zms_delete(struct zms_fs *fs, uint32_t id); + +/** + * @brief Read an entry from the file system. + * + * @param fs Pointer to file system + * @param id Id of the entry to be read + * @param data Pointer to data buffer + * @param len Number of bytes to be read (or size of the allocated read buffer) + * + * @return Number of bytes read. On success, it will be equal to the number of bytes requested + * to be read. When the return value is less than the number of bytes requested to read this + * indicates that ATE contain less data than requested. On error, returns negative value of + * errno.h defined error codes. + */ +ssize_t zms_read(struct zms_fs *fs, uint32_t id, void *data, size_t len); + +/** + * @brief Read a history entry from the file system. + * + * @param fs Pointer to file system + * @param id Id of the entry to be read + * @param data Pointer to data buffer + * @param len Number of bytes to be read + * @param cnt History counter: 0: latest entry, 1: one before latest ... + * + * @return Number of bytes read. On success, it will be equal to the number of bytes requested + * to be read. When the return value is larger than the number of bytes requested to read this + * indicates not all bytes were read, and more data is available. On error, returns negative + * value of errno.h defined error codes. + */ +ssize_t zms_read_hist(struct zms_fs *fs, uint32_t id, void *data, size_t len, uint32_t cnt); + +/** + * @brief Gets the data size that is stored in an entry with a given id + * + * @param fs Pointer to file system + * @param id Id of the entry that we want to get its data length + * + * @return Data length contained in the ATE. On success, it will be equal to the number of bytes + * in the ATE. On error, returns negative value of errno.h defined error codes. + */ +ssize_t zms_get_data_length(struct zms_fs *fs, uint32_t id); +/** + * @brief Calculate the available free space in the file system. + * + * @param fs Pointer to file system + * + * @return Number of bytes free. On success, it will be equal to the number of bytes that can + * still be written to the file system. + * Calculating the free space is a time consuming operation, especially on spi flash. + * On error, returns negative value of errno.h defined error codes. + */ +ssize_t zms_calc_free_space(struct zms_fs *fs); + +/** + * @brief Tell how many contiguous free space remains in the currently active ZMS sector. + * + * @param fs Pointer to the file system. + * + * @return Number of free bytes. + */ +size_t zms_sector_max_data_size(struct zms_fs *fs); + +/** + * @brief Close the currently active sector and switch to the next one. + * + * @note The garbage collector is called on the new sector. + * + * @warning This routine is made available for specific use cases. + * It collides with the ZMS goal of avoiding any unnecessary flash erase operations. + * Using this routine extensively can result in premature failure of the flash device. + * + * @param fs Pointer to the file system. + * + * @return 0 on success. On error, returns negative value of errno.h defined error codes. + */ +int zms_sector_use_next(struct zms_fs *fs); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_FS_ZMS_H_ */ diff --git a/subsys/fs/CMakeLists.txt b/subsys/fs/CMakeLists.txt index 574f9b26c923a..15f97649a13d5 100644 --- a/subsys/fs/CMakeLists.txt +++ b/subsys/fs/CMakeLists.txt @@ -27,6 +27,7 @@ endif() add_subdirectory_ifdef(CONFIG_FCB ./fcb) add_subdirectory_ifdef(CONFIG_NVS ./nvs) +add_subdirectory_ifdef(CONFIG_ZMS ./zms) if(CONFIG_FUSE_FS_ACCESS) zephyr_library_named(FS_FUSE) diff --git a/subsys/fs/Kconfig b/subsys/fs/Kconfig index af92a9bab9a9e..83e4185ea7514 100644 --- a/subsys/fs/Kconfig +++ b/subsys/fs/Kconfig @@ -110,5 +110,6 @@ endif # FILE_SYSTEM rsource "fcb/Kconfig" rsource "nvs/Kconfig" +rsource "zms/Kconfig" endmenu diff --git a/subsys/fs/zms/CMakeLists.txt b/subsys/fs/zms/CMakeLists.txt new file mode 100644 index 0000000000000..b6db8a3f57fa9 --- /dev/null +++ b/subsys/fs/zms/CMakeLists.txt @@ -0,0 +1,3 @@ +#SPDX-License-Identifier: Apache-2.0 + +zephyr_sources(zms.c) diff --git a/subsys/fs/zms/Kconfig b/subsys/fs/zms/Kconfig new file mode 100644 index 0000000000000..330ef11155ccc --- /dev/null +++ b/subsys/fs/zms/Kconfig @@ -0,0 +1,57 @@ +#Zephyr Memory Storage ZMS + +#Copyright (c) 2024 BayLibre SAS + +#SPDX-License-Identifier: Apache-2.0 + +config ZMS + bool "Zephyr Memory Storage" + select CRC + help + Enable support of Zephyr Memory Storage. + +if ZMS + +config ZMS_LOOKUP_CACHE + bool "ZMS lookup cache" + help + Enable ZMS cache to reduce the ZMS data lookup time. + Each cache entry holds an address of the most recent allocation + table entry (ATE) for all ZMS IDs that fall into that cache position. + +config ZMS_LOOKUP_CACHE_SIZE + int "ZMS Storage lookup cache size" + default 128 + range 1 65536 + depends on ZMS_LOOKUP_CACHE + help + Number of entries in ZMS lookup cache. + It is recommended that it should be a power of 2. + Every additional entry in cache will add 8 bytes in RAM + +config ZMS_DATA_CRC + bool "ZMS DATA CRC" + help + Enables DATA CRC + +config ZMS_CUSTOM_BLOCK_SIZE + bool "Custom buffer size used by ZMS for reads and writes" + help + ZMS uses internal buffers to read/write and compare stored data. + Increasing the size of these buffers should be done carefully in order to not + overflow the stack. + Increasing this buffer means as well that ZMS could work with storage devices + that have larger write-block-size which decreases ZMS performance + +config ZMS_MAX_BLOCK_SIZE + int "ZMS internal buffer size" + default 32 + depends on ZMS_CUSTOM_BLOCK_SIZE + help + Changes the internal buffer size of ZMS + +module = ZMS +module-str = zms +source "subsys/logging/Kconfig.template.log_config" + +endif # ZMS diff --git a/subsys/fs/zms/zms.c b/subsys/fs/zms/zms.c new file mode 100644 index 0000000000000..219303131093b --- /dev/null +++ b/subsys/fs/zms/zms.c @@ -0,0 +1,1752 @@ +/* ZMS: Zephyr Memory Storage + * + * Copyright (c) 2024 BayLibre SAS + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include "zms_priv.h" + +#include +LOG_MODULE_REGISTER(fs_zms, CONFIG_ZMS_LOG_LEVEL); + +static int zms_prev_ate(struct zms_fs *fs, uint64_t *addr, struct zms_ate *ate); +static int zms_ate_valid(struct zms_fs *fs, const struct zms_ate *entry); +static int zms_get_sector_cycle(struct zms_fs *fs, uint64_t addr, uint8_t *cycle_cnt); +static int zms_get_sector_header(struct zms_fs *fs, uint64_t addr, struct zms_ate *empty_ate, + struct zms_ate *close_ate); +static int zms_ate_valid_different_sector(struct zms_fs *fs, const struct zms_ate *entry, + uint8_t cycle_cnt); + +#ifdef CONFIG_ZMS_LOOKUP_CACHE + +static inline size_t zms_lookup_cache_pos(uint32_t id) +{ + uint32_t hash; + + /* 32-bit integer hash function found by https://github.com/skeeto/hash-prospector. */ + hash = id; + hash ^= hash >> 16; + hash *= 0x7feb352dU; + hash ^= hash >> 15; + hash *= 0x846ca68bU; + hash ^= hash >> 16; + + return hash % CONFIG_ZMS_LOOKUP_CACHE_SIZE; +} + +static int zms_lookup_cache_rebuild(struct zms_fs *fs) +{ + int rc, previous_sector_num = ZMS_INVALID_SECTOR_NUM; + uint64_t addr, ate_addr; + uint64_t *cache_entry; + uint8_t current_cycle; + struct zms_ate ate; + + memset(fs->lookup_cache, 0xff, sizeof(fs->lookup_cache)); + addr = fs->ate_wra; + + while (true) { + /* Make a copy of 'addr' as it will be advanced by zms_prev_ate() */ + ate_addr = addr; + rc = zms_prev_ate(fs, &addr, &ate); + + if (rc) { + return rc; + } + + cache_entry = &fs->lookup_cache[zms_lookup_cache_pos(ate.id)]; + + if (ate.id != ZMS_HEAD_ID && *cache_entry == ZMS_LOOKUP_CACHE_NO_ADDR) { + /* read the ate cycle only when we change the sector + * or if it is the first read + */ + if (SECTOR_NUM(ate_addr) != previous_sector_num) { + rc = zms_get_sector_cycle(fs, ate_addr, ¤t_cycle); + if (rc == -ENOENT) { + /* sector never used */ + current_cycle = 0; + } else if (rc) { + /* bad flash read */ + return rc; + } + } + if (zms_ate_valid_different_sector(fs, &ate, current_cycle)) { + *cache_entry = ate_addr; + } + previous_sector_num = SECTOR_NUM(ate_addr); + } + + if (addr == fs->ate_wra) { + break; + } + } + + return 0; +} + +static void zms_lookup_cache_invalidate(struct zms_fs *fs, uint32_t sector) +{ + uint64_t *cache_entry = fs->lookup_cache; + uint64_t *const cache_end = &fs->lookup_cache[CONFIG_ZMS_LOOKUP_CACHE_SIZE]; + + for (; cache_entry < cache_end; ++cache_entry) { + if (SECTOR_NUM(*cache_entry) == sector) { + *cache_entry = ZMS_LOOKUP_CACHE_NO_ADDR; + } + } +} + +#endif /* CONFIG_ZMS_LOOKUP_CACHE */ + +/* Helper to compute offset given the address */ +static inline off_t zms_addr_to_offset(struct zms_fs *fs, uint64_t addr) +{ + return fs->offset + (fs->sector_size * SECTOR_NUM(addr)) + SECTOR_OFFSET(addr); +} + +/* zms_al_size returns size aligned to fs->write_block_size */ +static inline size_t zms_al_size(struct zms_fs *fs, size_t len) +{ + size_t write_block_size = fs->flash_parameters->write_block_size; + + if (write_block_size <= 1U) { + return len; + } + return (len + (write_block_size - 1U)) & ~(write_block_size - 1U); +} + +/* Helper to get empty ATE address */ +static inline uint64_t zms_empty_ate_addr(struct zms_fs *fs, uint64_t addr) +{ + return (addr & ADDR_SECT_MASK) + fs->sector_size - fs->ate_size; +} + +/* Helper to get close ATE address */ +static inline uint64_t zms_close_ate_addr(struct zms_fs *fs, uint64_t addr) +{ + return (addr & ADDR_SECT_MASK) + fs->sector_size - 2 * fs->ate_size; +} + +/* Aligned memory write */ +static int zms_flash_al_wrt(struct zms_fs *fs, uint64_t addr, const void *data, size_t len) +{ + const uint8_t *data8 = (const uint8_t *)data; + int rc = 0; + off_t offset; + size_t blen; + uint8_t buf[ZMS_BLOCK_SIZE]; + + if (!len) { + /* Nothing to write, avoid changing the flash protection */ + return 0; + } + + offset = zms_addr_to_offset(fs, addr); + + blen = len & ~(fs->flash_parameters->write_block_size - 1U); + if (blen > 0) { + rc = flash_write(fs->flash_device, offset, data8, blen); + if (rc) { + /* flash write error */ + goto end; + } + len -= blen; + offset += blen; + data8 += blen; + } + if (len) { + memcpy(buf, data8, len); + (void)memset(buf + len, fs->flash_parameters->erase_value, + fs->flash_parameters->write_block_size - len); + + rc = flash_write(fs->flash_device, offset, buf, + fs->flash_parameters->write_block_size); + } + +end: + return rc; +} + +/* basic flash read from zms address */ +static int zms_flash_rd(struct zms_fs *fs, uint64_t addr, void *data, size_t len) +{ + off_t offset; + + offset = zms_addr_to_offset(fs, addr); + + return flash_read(fs->flash_device, offset, data, len); +} + +/* allocation entry write */ +static int zms_flash_ate_wrt(struct zms_fs *fs, const struct zms_ate *entry) +{ + int rc; + + rc = zms_flash_al_wrt(fs, fs->ate_wra, entry, sizeof(struct zms_ate)); + if (rc) { + goto end; + } +#ifdef CONFIG_ZMS_LOOKUP_CACHE + /* 0xFFFFFFFF is a special-purpose identifier. Exclude it from the cache */ + if (entry->id != ZMS_HEAD_ID) { + fs->lookup_cache[zms_lookup_cache_pos(entry->id)] = fs->ate_wra; + } +#endif + fs->ate_wra -= zms_al_size(fs, sizeof(struct zms_ate)); +end: + return rc; +} + +/* data write */ +static int zms_flash_data_wrt(struct zms_fs *fs, const void *data, size_t len) +{ + int rc; + + rc = zms_flash_al_wrt(fs, fs->data_wra, data, len); + if (rc < 0) { + return rc; + } + fs->data_wra += zms_al_size(fs, len); + + return 0; +} + +/* flash ate read */ +static int zms_flash_ate_rd(struct zms_fs *fs, uint64_t addr, struct zms_ate *entry) +{ + return zms_flash_rd(fs, addr, entry, sizeof(struct zms_ate)); +} + +/* zms_flash_block_cmp compares the data in flash at addr to data + * in blocks of size ZMS_BLOCK_SIZE aligned to fs->write_block_size + * returns 0 if equal, 1 if not equal, errcode if error + */ +static int zms_flash_block_cmp(struct zms_fs *fs, uint64_t addr, const void *data, size_t len) +{ + const uint8_t *data8 = (const uint8_t *)data; + int rc; + size_t bytes_to_cmp, block_size; + uint8_t buf[ZMS_BLOCK_SIZE]; + + block_size = ZMS_BLOCK_SIZE & ~(fs->flash_parameters->write_block_size - 1U); + + while (len) { + bytes_to_cmp = MIN(block_size, len); + rc = zms_flash_rd(fs, addr, buf, bytes_to_cmp); + if (rc) { + return rc; + } + rc = memcmp(data8, buf, bytes_to_cmp); + if (rc) { + return 1; + } + len -= bytes_to_cmp; + addr += bytes_to_cmp; + data8 += bytes_to_cmp; + } + return 0; +} + +/* zms_flash_cmp_const compares the data in flash at addr to a constant + * value. returns 0 if all data in flash is equal to value, 1 if not equal, + * errcode if error + */ +static int zms_flash_cmp_const(struct zms_fs *fs, uint64_t addr, uint8_t value, size_t len) +{ + int rc; + size_t bytes_to_cmp, block_size; + uint8_t cmp[ZMS_BLOCK_SIZE]; + + block_size = ZMS_BLOCK_SIZE & ~(fs->flash_parameters->write_block_size - 1U); + + (void)memset(cmp, value, block_size); + while (len) { + bytes_to_cmp = MIN(block_size, len); + rc = zms_flash_block_cmp(fs, addr, cmp, bytes_to_cmp); + if (rc) { + return rc; + } + len -= bytes_to_cmp; + addr += bytes_to_cmp; + } + return 0; +} + +/* flash block move: move a block at addr to the current data write location + * and updates the data write location. + */ +static int zms_flash_block_move(struct zms_fs *fs, uint64_t addr, size_t len) +{ + int rc; + size_t bytes_to_copy, block_size; + uint8_t buf[ZMS_BLOCK_SIZE]; + + block_size = ZMS_BLOCK_SIZE & ~(fs->flash_parameters->write_block_size - 1U); + + while (len) { + bytes_to_copy = MIN(block_size, len); + rc = zms_flash_rd(fs, addr, buf, bytes_to_copy); + if (rc) { + return rc; + } + rc = zms_flash_data_wrt(fs, buf, bytes_to_copy); + if (rc) { + return rc; + } + len -= bytes_to_copy; + addr += bytes_to_copy; + } + return 0; +} + +/* erase a sector and verify erase was OK. + * return 0 if OK, errorcode on error. + */ +static int zms_flash_erase_sector(struct zms_fs *fs, uint64_t addr) +{ + int rc; + off_t offset; + bool ebw_required = + flash_params_get_erase_cap(fs->flash_parameters) & FLASH_ERASE_C_EXPLICIT; + + if (!ebw_required) { + /* Do nothing for devices that do not have erase capability */ + return 0; + } + + addr &= ADDR_SECT_MASK; + offset = zms_addr_to_offset(fs, addr); + + LOG_DBG("Erasing flash at offset 0x%lx ( 0x%llx ), len %u", (long)offset, addr, + fs->sector_size); + +#ifdef CONFIG_ZMS_LOOKUP_CACHE + zms_lookup_cache_invalidate(fs, SECTOR_NUM(addr)); +#endif + rc = flash_erase(fs->flash_device, offset, fs->sector_size); + + if (rc) { + return rc; + } + + if (zms_flash_cmp_const(fs, addr, fs->flash_parameters->erase_value, fs->sector_size)) { + LOG_ERR("Failure while erasing the sector at offset 0x%lx", (long)offset); + rc = -ENXIO; + } + + return rc; +} + +/* crc update on allocation entry */ +static void zms_ate_crc8_update(struct zms_ate *entry) +{ + uint8_t crc8; + + /* crc8 field is the first element of the structure, do not include it */ + crc8 = crc8_ccitt(0xff, (uint8_t *)entry + SIZEOF_FIELD(struct zms_ate, crc8), + sizeof(struct zms_ate) - SIZEOF_FIELD(struct zms_ate, crc8)); + entry->crc8 = crc8; +} + +/* crc check on allocation entry + * returns 0 if OK, 1 on crc fail + */ +static int zms_ate_crc8_check(const struct zms_ate *entry) +{ + uint8_t crc8; + + /* crc8 field is the first element of the structure, do not include it */ + crc8 = crc8_ccitt(0xff, (uint8_t *)entry + SIZEOF_FIELD(struct zms_ate, crc8), + sizeof(struct zms_ate) - SIZEOF_FIELD(struct zms_ate, crc8)); + if (crc8 == entry->crc8) { + return 0; + } + + return 1; +} + +/* zms_ate_valid validates an ate: + * return 1 if crc8 and cycle_cnt valid, + * 0 otherwise + */ +static int zms_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) +{ + if ((fs->sector_cycle != entry->cycle_cnt) || zms_ate_crc8_check(entry)) { + return 0; + } + + return 1; +} + +/* zms_ate_valid_different_sector validates an ate that is in a different + * sector than the active one. It takes as argument the cycle_cnt of the + * sector where the ATE to be validated is stored + * return 1 if crc8 and cycle_cnt are valid, + * 0 otherwise + */ +static int zms_ate_valid_different_sector(struct zms_fs *fs, const struct zms_ate *entry, + uint8_t cycle_cnt) +{ + if ((cycle_cnt != entry->cycle_cnt) || zms_ate_crc8_check(entry)) { + return 0; + } + + return 1; +} + +static inline int zms_get_cycle_on_sector_change(struct zms_fs *fs, uint64_t addr, + int previous_sector_num, uint8_t *cycle_cnt) +{ + int rc; + + /* read the ate cycle only when we change the sector + * or if it is the first read + */ + if (SECTOR_NUM(addr) != previous_sector_num) { + rc = zms_get_sector_cycle(fs, addr, cycle_cnt); + if (rc == -ENOENT) { + /* sector never used */ + *cycle_cnt = 0; + } else if (rc) { + /* bad flash read */ + return rc; + } + } + + return 0; +} + +/* zms_close_ate_valid validates an sector close ate: a valid sector close ate: + * - valid ate + * - len = 0 and id = ZMS_HEAD_ID + * - offset points to location at ate multiple from sector size + * return true if valid, false otherwise + */ +static bool zms_close_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) +{ + return (zms_ate_valid_different_sector(fs, entry, entry->cycle_cnt) && (!entry->len) && + (entry->id == ZMS_HEAD_ID) && !((fs->sector_size - entry->offset) % fs->ate_size)); +} + +/* zms_empty_ate_valid validates an sector empty ate: a valid sector empty ate: + * - valid ate + * - len = 0xffff and id = 0xffffffff + * return true if valid, false otherwise + */ +static bool zms_empty_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) +{ + return (zms_ate_valid_different_sector(fs, entry, entry->cycle_cnt) && + (entry->len == 0xffff) && (entry->id == ZMS_HEAD_ID)); +} + +/* zms_gc_done_ate_valid validates a garbage collector done ATE + * Valid gc_done_ate: + * - valid ate + * - len = 0 + * - id = 0xffffffff + * return true if valid, false otherwise + */ +static bool zms_gc_done_ate_valid(struct zms_fs *fs, const struct zms_ate *entry) +{ + return (zms_ate_valid_different_sector(fs, entry, entry->cycle_cnt) && (!entry->len) && + (entry->id == ZMS_HEAD_ID)); +} + +/* Read empty and close ATE of the sector where belongs address "addr" and + * validates that the sector is closed. + * retval: 0 if sector is not close + * retval: 1 is sector is closed + * retval: < 0 if read of the header failed. + */ +static int zms_validate_closed_sector(struct zms_fs *fs, uint64_t addr, struct zms_ate *empty_ate, + struct zms_ate *close_ate) +{ + int rc; + + /* read the header ATEs */ + rc = zms_get_sector_header(fs, addr, empty_ate, close_ate); + if (rc) { + return rc; + } + + if (zms_empty_ate_valid(fs, empty_ate) && zms_close_ate_valid(fs, close_ate) && + (empty_ate->cycle_cnt == close_ate->cycle_cnt)) { + /* Closed sector validated */ + return 1; + } + + return 0; +} + +/* store an entry in flash */ +static int zms_flash_write_entry(struct zms_fs *fs, uint32_t id, const void *data, size_t len) +{ + int rc; + struct zms_ate entry; + + /* Initialize all members to 0 */ + memset(&entry, 0, sizeof(struct zms_ate)); + + entry.id = id; + entry.len = (uint16_t)len; + entry.cycle_cnt = fs->sector_cycle; + + if (len > ZMS_DATA_IN_ATE_SIZE) { + /* only compute CRC if len is greater than 8 bytes */ + if (IS_ENABLED(CONFIG_ZMS_DATA_CRC)) { + entry.data_crc = crc32_ieee(data, len); + } + entry.offset = (uint32_t)SECTOR_OFFSET(fs->data_wra); + } else if ((len > 0) && (len <= ZMS_DATA_IN_ATE_SIZE)) { + /* Copy data into entry for small data ( < 8B) */ + memcpy(&entry.data, data, len); + } + + zms_ate_crc8_update(&entry); + + if (len > ZMS_DATA_IN_ATE_SIZE) { + rc = zms_flash_data_wrt(fs, data, len); + if (rc) { + return rc; + } + } + + rc = zms_flash_ate_wrt(fs, &entry); + if (rc) { + return rc; + } + + return 0; +} + +/* end of flash routines */ + +/* Search for the last valid ATE written in a sector and also update data write address + */ +static int zms_recover_last_ate(struct zms_fs *fs, uint64_t *addr, uint64_t *data_wra) +{ + uint64_t data_end_addr, ate_end_addr; + struct zms_ate end_ate; + int rc; + + LOG_DBG("Recovering last ate from sector %llu", SECTOR_NUM(*addr)); + + /* skip close and empty ATE */ + *addr -= 2 * fs->ate_size; + + ate_end_addr = *addr; + data_end_addr = *addr & ADDR_SECT_MASK; + /* Initialize the data_wra to the first address of the sector */ + *data_wra = data_end_addr; + + while (ate_end_addr > data_end_addr) { + rc = zms_flash_ate_rd(fs, ate_end_addr, &end_ate); + if (rc) { + return rc; + } + if (zms_ate_valid(fs, &end_ate)) { + /* found a valid ate, update data_end_addr and *addr */ + data_end_addr &= ADDR_SECT_MASK; + if (end_ate.len > ZMS_DATA_IN_ATE_SIZE) { + data_end_addr += end_ate.offset + zms_al_size(fs, end_ate.len); + *data_wra = data_end_addr; + } + *addr = ate_end_addr; + } + ate_end_addr -= fs->ate_size; + } + + return 0; +} + +/* compute previous addr of ATE */ +static int zms_compute_prev_addr(struct zms_fs *fs, uint64_t *addr) +{ + int sec_closed; + struct zms_ate empty_ate, close_ate; + + *addr += fs->ate_size; + if ((SECTOR_OFFSET(*addr)) != (fs->sector_size - 2 * fs->ate_size)) { + return 0; + } + + /* last ate in sector, do jump to previous sector */ + if (SECTOR_NUM(*addr) == 0U) { + *addr += ((uint64_t)(fs->sector_count - 1) << ADDR_SECT_SHIFT); + } else { + *addr -= (1ULL << ADDR_SECT_SHIFT); + } + + /* verify if the sector is closed */ + sec_closed = zms_validate_closed_sector(fs, *addr, &empty_ate, &close_ate); + if (sec_closed < 0) { + return sec_closed; + } + + /* Non Closed Sector */ + if (!sec_closed) { + /* at the end of filesystem */ + *addr = fs->ate_wra; + return 0; + } + + /* Update the address here because the header ATEs are valid.*/ + (*addr) &= ADDR_SECT_MASK; + (*addr) += close_ate.offset; + + return 0; +} + +/* walking through allocation entry list, from newest to oldest entries + * read ate from addr, modify addr to the previous ate + */ +static int zms_prev_ate(struct zms_fs *fs, uint64_t *addr, struct zms_ate *ate) +{ + int rc; + + rc = zms_flash_ate_rd(fs, *addr, ate); + if (rc) { + return rc; + } + + return zms_compute_prev_addr(fs, addr); +} + +static void zms_sector_advance(struct zms_fs *fs, uint64_t *addr) +{ + *addr += (1ULL << ADDR_SECT_SHIFT); + if ((*addr >> ADDR_SECT_SHIFT) == fs->sector_count) { + *addr -= ((uint64_t)fs->sector_count << ADDR_SECT_SHIFT); + } +} + +/* allocation entry close (this closes the current sector) by writing offset + * of last ate to the sector end. + */ +static int zms_sector_close(struct zms_fs *fs) +{ + int rc; + struct zms_ate close_ate, garbage_ate; + + close_ate.id = ZMS_HEAD_ID; + close_ate.len = 0U; + close_ate.offset = (uint32_t)SECTOR_OFFSET(fs->ate_wra + fs->ate_size); + close_ate.metadata = 0xffffffff; + close_ate.cycle_cnt = fs->sector_cycle; + + /* When we close the sector, we must write all non used ATE with + * a non valid (Junk) ATE. + * This is needed to avoid some corner cases where some ATEs are + * not overwritten and become valid when the cycle counter wrap again + * to the same cycle counter of the old ATE. + * Example : + * - An ATE.cycl_cnt == 0 is written as last ATE of the sector + - This ATE was never overwritten in the next 255 cycles because of + large data size + - Next 256th cycle the leading cycle_cnt is 0, this ATE becomes + valid even if it is not the case. + */ + memset(&garbage_ate, fs->flash_parameters->erase_value, sizeof(garbage_ate)); + while (SECTOR_OFFSET(fs->ate_wra) && (fs->ate_wra >= fs->data_wra)) { + rc = zms_flash_ate_wrt(fs, &garbage_ate); + if (rc) { + return rc; + } + } + + fs->ate_wra = zms_close_ate_addr(fs, fs->ate_wra); + + zms_ate_crc8_update(&close_ate); + + (void)zms_flash_ate_wrt(fs, &close_ate); + + zms_sector_advance(fs, &fs->ate_wra); + + rc = zms_get_sector_cycle(fs, fs->ate_wra, &fs->sector_cycle); + if (rc == -ENOENT) { + /* sector never used */ + fs->sector_cycle = 0; + } else if (rc) { + /* bad flash read */ + return rc; + } + + fs->data_wra = fs->ate_wra & ADDR_SECT_MASK; + + return 0; +} + +static int zms_add_gc_done_ate(struct zms_fs *fs) +{ + struct zms_ate gc_done_ate; + + LOG_DBG("Adding gc done ate at %llx", fs->ate_wra); + gc_done_ate.id = ZMS_HEAD_ID; + gc_done_ate.len = 0U; + gc_done_ate.offset = (uint32_t)SECTOR_OFFSET(fs->data_wra); + gc_done_ate.metadata = 0xffffffff; + gc_done_ate.cycle_cnt = fs->sector_cycle; + + zms_ate_crc8_update(&gc_done_ate); + + return zms_flash_ate_wrt(fs, &gc_done_ate); +} + +static int zms_add_empty_ate(struct zms_fs *fs, uint64_t addr) +{ + struct zms_ate empty_ate; + uint8_t cycle_cnt; + int rc = 0; + uint64_t previous_ate_wra; + + addr &= ADDR_SECT_MASK; + + LOG_DBG("Adding empty ate at %llx", (uint64_t)(addr + fs->sector_size - fs->ate_size)); + empty_ate.id = ZMS_HEAD_ID; + empty_ate.len = 0xffff; + empty_ate.offset = 0U; + empty_ate.metadata = + FIELD_PREP(ZMS_MAGIC_NUMBER_MASK, ZMS_MAGIC_NUMBER) | ZMS_DEFAULT_VERSION; + + rc = zms_get_sector_cycle(fs, addr, &cycle_cnt); + if (rc == -ENOENT) { + /* sector never used */ + cycle_cnt = 0; + } else if (rc) { + /* bad flash read */ + return rc; + } + + /* increase cycle counter */ + empty_ate.cycle_cnt = (cycle_cnt + 1) % BIT(8); + zms_ate_crc8_update(&empty_ate); + + /* Adding empty ate to this sector changes fs->ate_wra value + * Restore the ate_wra of the current sector after this + */ + previous_ate_wra = fs->ate_wra; + fs->ate_wra = zms_empty_ate_addr(fs, addr); + rc = zms_flash_ate_wrt(fs, &empty_ate); + if (rc) { + return rc; + } + fs->ate_wra = previous_ate_wra; + + return 0; +} + +static int zms_get_sector_cycle(struct zms_fs *fs, uint64_t addr, uint8_t *cycle_cnt) +{ + int rc; + struct zms_ate empty_ate; + uint64_t empty_addr; + + empty_addr = zms_empty_ate_addr(fs, addr); + + /* read the cycle counter of the current sector */ + rc = zms_flash_ate_rd(fs, empty_addr, &empty_ate); + if (rc < 0) { + /* flash error */ + return rc; + } + + if (zms_empty_ate_valid(fs, &empty_ate)) { + *cycle_cnt = empty_ate.cycle_cnt; + return 0; + } + + /* there is no empty ATE in this sector */ + return -ENOENT; +} + +static int zms_get_sector_header(struct zms_fs *fs, uint64_t addr, struct zms_ate *empty_ate, + struct zms_ate *close_ate) +{ + int rc; + uint64_t close_addr; + + close_addr = zms_close_ate_addr(fs, addr); + /* read the second ate in the sector to get the close ATE */ + rc = zms_flash_ate_rd(fs, close_addr, close_ate); + if (rc) { + return rc; + } + + /* read the first ate in the sector to get the empty ATE */ + rc = zms_flash_ate_rd(fs, close_addr + fs->ate_size, empty_ate); + if (rc) { + return rc; + } + + return 0; +} + +/** + * @brief Helper to find an ATE using its ID + * + * @param fs Pointer to file system + * @param id Id of the entry to be found + * @param start_addr Address from where the search will start + * @param end_addr Address where the search will stop + * @param ate pointer to the found ATE if it exists + * @param ate_addr Pointer to the address of the found ATE + * + * @retval 0 No ATE is found + * @retval 1 valid ATE with same ID found + * @retval < 0 An error happened + */ +static int zms_find_ate_with_id(struct zms_fs *fs, uint32_t id, uint64_t start_addr, + uint64_t end_addr, struct zms_ate *ate, uint64_t *ate_addr) +{ + int rc; + int previous_sector_num = ZMS_INVALID_SECTOR_NUM; + uint64_t wlk_prev_addr, wlk_addr; + int prev_found = 0; + struct zms_ate wlk_ate; + uint8_t current_cycle; + + wlk_addr = start_addr; + + do { + wlk_prev_addr = wlk_addr; + rc = zms_prev_ate(fs, &wlk_addr, &wlk_ate); + if (rc) { + return rc; + } + if (wlk_ate.id == id) { + /* read the ate cycle only when we change the sector or if it is + * the first read ( previous_sector_num == ZMS_INVALID_SECTOR_NUM). + */ + rc = zms_get_cycle_on_sector_change(fs, wlk_prev_addr, previous_sector_num, + ¤t_cycle); + if (rc) { + return rc; + } + if (zms_ate_valid_different_sector(fs, &wlk_ate, current_cycle)) { + prev_found = 1; + break; + } + previous_sector_num = SECTOR_NUM(wlk_prev_addr); + } + } while (wlk_addr != end_addr); + + *ate = wlk_ate; + *ate_addr = wlk_prev_addr; + + return prev_found; +} + +/* garbage collection: the address ate_wra has been updated to the new sector + * that has just been started. The data to gc is in the sector after this new + * sector. + */ +static int zms_gc(struct zms_fs *fs) +{ + int rc, sec_closed; + struct zms_ate close_ate, gc_ate, wlk_ate, empty_ate; + uint64_t sec_addr, gc_addr, gc_prev_addr, wlk_addr, wlk_prev_addr, data_addr, stop_addr; + uint8_t previous_cycle = 0; + + rc = zms_get_sector_cycle(fs, fs->ate_wra, &fs->sector_cycle); + if (rc == -ENOENT) { + /* Erase this new unused sector if needed */ + rc = zms_flash_erase_sector(fs, fs->ate_wra); + if (rc) { + return rc; + } + /* sector never used */ + rc = zms_add_empty_ate(fs, fs->ate_wra); + if (rc) { + return rc; + } + /* At this step we are sure that empty ATE exist. + * If not, then there is an I/O problem. + */ + rc = zms_get_sector_cycle(fs, fs->ate_wra, &fs->sector_cycle); + if (rc) { + return rc; + } + } else if (rc) { + /* bad flash read */ + return rc; + } + previous_cycle = fs->sector_cycle; + + sec_addr = (fs->ate_wra & ADDR_SECT_MASK); + zms_sector_advance(fs, &sec_addr); + gc_addr = sec_addr + fs->sector_size - fs->ate_size; + + /* verify if the sector is closed */ + sec_closed = zms_validate_closed_sector(fs, gc_addr, &empty_ate, &close_ate); + if (sec_closed < 0) { + return sec_closed; + } + + /* if the sector is not closed don't do gc */ + if (!sec_closed) { + goto gc_done; + } + + /* update sector_cycle */ + fs->sector_cycle = empty_ate.cycle_cnt; + + /* stop_addr points to the first ATE before the header ATEs */ + stop_addr = gc_addr - 2 * fs->ate_size; + /* At this step empty & close ATEs are valid. + * let's start the GC + */ + gc_addr &= ADDR_SECT_MASK; + gc_addr += close_ate.offset; + + do { + gc_prev_addr = gc_addr; + rc = zms_prev_ate(fs, &gc_addr, &gc_ate); + if (rc) { + return rc; + } + + if (!zms_ate_valid(fs, &gc_ate) || !gc_ate.len) { + continue; + } + +#ifdef CONFIG_ZMS_LOOKUP_CACHE + wlk_addr = fs->lookup_cache[zms_lookup_cache_pos(gc_ate.id)]; + + if (wlk_addr == ZMS_LOOKUP_CACHE_NO_ADDR) { + wlk_addr = fs->ate_wra; + } +#else + wlk_addr = fs->ate_wra; +#endif + + /* Initialize the wlk_prev_addr as if no previous ID will be found */ + wlk_prev_addr = gc_prev_addr; + /* Search for a previous valid ATE with the same ID. If it doesn't exist + * then wlk_prev_addr will be equal to gc_prev_addr. + */ + rc = zms_find_ate_with_id(fs, gc_ate.id, wlk_addr, fs->ate_wra, &wlk_ate, + &wlk_prev_addr); + if (rc < 0) { + return rc; + } + + /* if walk_addr has reached the same address as gc_addr, a copy is + * needed unless it is a deleted item. + */ + if (wlk_prev_addr == gc_prev_addr) { + /* copy needed */ + LOG_DBG("Moving %d, len %d", gc_ate.id, gc_ate.len); + + if (gc_ate.len > ZMS_DATA_IN_ATE_SIZE) { + /* Copy Data only when len > 8 + * Otherwise, Data is already inside ATE + */ + data_addr = (gc_prev_addr & ADDR_SECT_MASK); + data_addr += gc_ate.offset; + gc_ate.offset = (uint32_t)SECTOR_OFFSET(fs->data_wra); + + rc = zms_flash_block_move(fs, data_addr, gc_ate.len); + if (rc) { + return rc; + } + } + + gc_ate.cycle_cnt = previous_cycle; + zms_ate_crc8_update(&gc_ate); + rc = zms_flash_ate_wrt(fs, &gc_ate); + if (rc) { + return rc; + } + } + } while (gc_prev_addr != stop_addr); + +gc_done: + + /* restore the previous sector_cycle */ + fs->sector_cycle = previous_cycle; + + /* Write a GC_done ATE to mark the end of this operation + */ + + rc = zms_add_gc_done_ate(fs); + if (rc) { + return rc; + } + + /* Erase the GC'ed sector when needed */ + rc = zms_flash_erase_sector(fs, sec_addr); + if (rc) { + return rc; + } + +#ifdef CONFIG_ZMS_LOOKUP_CACHE + zms_lookup_cache_invalidate(fs, sec_addr >> ADDR_SECT_SHIFT); +#endif + rc = zms_add_empty_ate(fs, sec_addr); + + return rc; +} + +int zms_clear(struct zms_fs *fs) +{ + int rc; + uint64_t addr; + + if (!fs->ready) { + LOG_ERR("zms not initialized"); + return -EACCES; + } + + k_mutex_lock(&fs->zms_lock, K_FOREVER); + for (uint32_t i = 0; i < fs->sector_count; i++) { + addr = (uint64_t)i << ADDR_SECT_SHIFT; + rc = zms_flash_erase_sector(fs, addr); + if (rc) { + goto end; + } + rc = zms_add_empty_ate(fs, addr); + if (rc) { + goto end; + } + } + + /* zms needs to be reinitialized after clearing */ + fs->ready = false; + +end: + k_mutex_unlock(&fs->zms_lock); + + return 0; +} + +static int zms_init(struct zms_fs *fs) +{ + int rc, sec_closed; + struct zms_ate last_ate, first_ate, close_ate, empty_ate; + /* Initialize addr to 0 for the case fs->sector_count == 0. This + * should never happen as this is verified in zms_mount() but both + * Coverity and GCC believe the contrary. + */ + uint64_t addr = 0U, data_wra = 0U; + uint32_t i, closed_sectors = 0; + bool zms_magic_exist = false; + + k_mutex_lock(&fs->zms_lock, K_FOREVER); + + /* step through the sectors to find a open sector following + * a closed sector, this is where zms can write. + */ + + for (i = 0; i < fs->sector_count; i++) { + addr = zms_close_ate_addr(fs, ((uint64_t)i << ADDR_SECT_SHIFT)); + + /* verify if the sector is closed */ + sec_closed = zms_validate_closed_sector(fs, addr, &empty_ate, &close_ate); + if (sec_closed < 0) { + rc = sec_closed; + goto end; + } + /* update cycle count */ + fs->sector_cycle = empty_ate.cycle_cnt; + + if (sec_closed == 1) { + /* closed sector */ + closed_sectors++; + /* Let's verify that this is a ZMS storage system */ + if (ZMS_GET_MAGIC_NUMBER(empty_ate.metadata) == ZMS_MAGIC_NUMBER) { + zms_magic_exist = true; + /* Let's check that we support this ZMS version */ + if (ZMS_GET_VERSION(empty_ate.metadata) != ZMS_DEFAULT_VERSION) { + LOG_ERR("ZMS Version is not supported"); + rc = -ENOEXEC; + goto end; + } + } + + zms_sector_advance(fs, &addr); + /* addr is pointing to the close ATE */ + /* verify if the sector is Open */ + sec_closed = zms_validate_closed_sector(fs, addr, &empty_ate, &close_ate); + if (sec_closed < 0) { + rc = sec_closed; + goto end; + } + /* update cycle count */ + fs->sector_cycle = empty_ate.cycle_cnt; + + if (!sec_closed) { + /* We found an Open sector following a closed one */ + break; + } + } + } + /* all sectors are closed, and zms magic number not found. This is not a zms fs */ + if ((closed_sectors == fs->sector_count) && !zms_magic_exist) { + rc = -EDEADLK; + goto end; + } + /* TODO: add a recovery mechanism here if the ZMS magic number exist but all + * sectors are closed + */ + + if (i == fs->sector_count) { + /* none of the sectors were closed, which means that the first + * sector is the one in use, except if there are only 2 sectors. + * Let's check if the last sector has valid ATEs otherwise set + * the open sector to the first one. + */ + rc = zms_flash_ate_rd(fs, addr - fs->ate_size, &first_ate); + if (rc) { + goto end; + } + if (!zms_ate_valid(fs, &first_ate)) { + zms_sector_advance(fs, &addr); + } + rc = zms_get_sector_header(fs, addr, &empty_ate, &close_ate); + if (rc) { + goto end; + } + + if (zms_empty_ate_valid(fs, &empty_ate)) { + /* Empty ATE is valid, let's verify that this is a ZMS storage system */ + if (ZMS_GET_MAGIC_NUMBER(empty_ate.metadata) == ZMS_MAGIC_NUMBER) { + zms_magic_exist = true; + /* Let's check the version */ + if (ZMS_GET_VERSION(empty_ate.metadata) != ZMS_DEFAULT_VERSION) { + LOG_ERR("ZMS Version is not supported"); + rc = -ENOEXEC; + goto end; + } + } + } else { + rc = zms_flash_erase_sector(fs, addr); + if (rc) { + goto end; + } + rc = zms_add_empty_ate(fs, addr); + if (rc) { + goto end; + } + } + rc = zms_get_sector_cycle(fs, addr, &fs->sector_cycle); + if (rc == -ENOENT) { + /* sector never used */ + fs->sector_cycle = 0; + } else if (rc) { + /* bad flash read */ + goto end; + } + } + + /* addr contains address of closing ate in the most recent sector, + * search for the last valid ate using the recover_last_ate routine + * and also update the data_wra + */ + rc = zms_recover_last_ate(fs, &addr, &data_wra); + if (rc) { + goto end; + } + + /* addr contains address of the last valid ate in the most recent sector + * data_wra contains the data write address of the current sector + */ + fs->ate_wra = addr; + fs->data_wra = data_wra; + + /* fs->ate_wra should point to the next available entry. This is normally + * the next position after the one found by the recovery function. + * Let's verify that it doesn't contain any valid ATE, otherwise search for + * an empty position + */ + while (fs->ate_wra >= fs->data_wra) { + rc = zms_flash_ate_rd(fs, fs->ate_wra, &last_ate); + if (rc) { + goto end; + } + if (!zms_ate_valid(fs, &last_ate)) { + /* found empty location */ + break; + } + + /* ate on the last position within the sector is + * reserved for deletion an entry + */ + if ((fs->ate_wra == fs->data_wra) && last_ate.len) { + /* not a delete ate */ + rc = -ESPIPE; + goto end; + } + + fs->ate_wra -= fs->ate_size; + } + + /* The sector after the write sector is either empty with a valid empty ATE (regular case) + * or it has never been used or it is a closed sector (GC didn't finish) + * If it is a closed sector we must look for a valid GC done ATE in the current write + * sector, if it is missing, we need to restart gc because it has been interrupted. + * If no valid empty ATE is found then it has never been used. Just erase it by adding + * a valid empty ATE. + * When gc needs to be restarted, first erase the sector by adding an empty + * ATE otherwise the data might not fit into the sector. + */ + addr = zms_close_ate_addr(fs, fs->ate_wra); + zms_sector_advance(fs, &addr); + + /* verify if the sector is closed */ + sec_closed = zms_validate_closed_sector(fs, addr, &empty_ate, &close_ate); + if (sec_closed < 0) { + rc = sec_closed; + goto end; + } + + if (sec_closed == 1) { + /* The sector after fs->ate_wrt is closed. + * Look for a marker (gc_done_ate) that indicates that gc was finished. + */ + bool gc_done_marker = false; + struct zms_ate gc_done_ate; + + fs->sector_cycle = empty_ate.cycle_cnt; + addr = fs->ate_wra + fs->ate_size; + while (SECTOR_OFFSET(addr) < (fs->sector_size - 2 * fs->ate_size)) { + rc = zms_flash_ate_rd(fs, addr, &gc_done_ate); + if (rc) { + goto end; + } + + if (zms_gc_done_ate_valid(fs, &gc_done_ate)) { + break; + } + addr += fs->ate_size; + } + + if (gc_done_marker) { + /* erase the next sector */ + LOG_INF("GC Done marker found"); + addr = fs->ate_wra & ADDR_SECT_MASK; + zms_sector_advance(fs, &addr); + rc = zms_flash_erase_sector(fs, addr); + if (rc < 0) { + goto end; + } + rc = zms_add_empty_ate(fs, addr); + goto end; + } + LOG_INF("No GC Done marker found: restarting gc"); + rc = zms_flash_erase_sector(fs, fs->ate_wra); + if (rc) { + goto end; + } + rc = zms_add_empty_ate(fs, fs->ate_wra); + if (rc) { + goto end; + } + + /* Let's point to the first writable position */ + fs->ate_wra &= ADDR_SECT_MASK; + fs->ate_wra += (fs->sector_size - 3 * fs->ate_size); + fs->data_wra = (fs->ate_wra & ADDR_SECT_MASK); +#ifdef CONFIG_ZMS_LOOKUP_CACHE + /** + * At this point, the lookup cache wasn't built but the gc function need to use it. + * So, temporarily, we set the lookup cache to the end of the fs. + * The cache will be rebuilt afterwards + **/ + for (i = 0; i < CONFIG_ZMS_LOOKUP_CACHE_SIZE; i++) { + fs->lookup_cache[i] = fs->ate_wra; + } +#endif + rc = zms_gc(fs); + goto end; + } + +end: +#ifdef CONFIG_ZMS_LOOKUP_CACHE + if (!rc) { + rc = zms_lookup_cache_rebuild(fs); + } +#endif + /* If the sector is empty add a gc done ate to avoid having insufficient + * space when doing gc. + */ + if ((!rc) && (SECTOR_OFFSET(fs->ate_wra) == (fs->sector_size - 3 * fs->ate_size))) { + rc = zms_add_gc_done_ate(fs); + } + k_mutex_unlock(&fs->zms_lock); + + return rc; +} + +int zms_mount(struct zms_fs *fs) +{ + + int rc; + struct flash_pages_info info; + size_t write_block_size; + + k_mutex_init(&fs->zms_lock); + + fs->flash_parameters = flash_get_parameters(fs->flash_device); + if (fs->flash_parameters == NULL) { + LOG_ERR("Could not obtain flash parameters"); + return -EINVAL; + } + + fs->ate_size = zms_al_size(fs, sizeof(struct zms_ate)); + write_block_size = flash_get_write_block_size(fs->flash_device); + + /* check that the write block size is supported */ + if (write_block_size > ZMS_BLOCK_SIZE || write_block_size == 0) { + LOG_ERR("Unsupported write block size"); + return -EINVAL; + } + + /* When the device need erase operations before write let's check that + * sector size is a multiple of pagesize + */ + if (flash_params_get_erase_cap(fs->flash_parameters) & FLASH_ERASE_C_EXPLICIT) { + rc = flash_get_page_info_by_offs(fs->flash_device, fs->offset, &info); + if (rc) { + LOG_ERR("Unable to get page info"); + return -EINVAL; + } + if (!fs->sector_size || fs->sector_size % info.size) { + LOG_ERR("Invalid sector size"); + return -EINVAL; + } + } + + /* we need at least 5 aligned ATEs size as the minimum sector size + * 1 close ATE, 1 empty ATE, 1 GC done ATE, 1 Delete ATE, 1 ID/Value ATE + */ + if (fs->sector_size < ZMS_MIN_ATE_NUM * fs->ate_size) { + LOG_ERR("Invalid sector size, should be at least %u", + ZMS_MIN_ATE_NUM * fs->ate_size); + } + + /* check the number of sectors, it should be at least 2 */ + if (fs->sector_count < 2) { + LOG_ERR("Configuration error - sector count below minimum requirement (2)"); + return -EINVAL; + } + + rc = zms_init(fs); + + if (rc) { + return rc; + } + + /* zms is ready for use */ + fs->ready = true; + + LOG_INF("%u Sectors of %u bytes", fs->sector_count, fs->sector_size); + LOG_INF("alloc wra: %llu, %llx", SECTOR_NUM(fs->ate_wra), SECTOR_OFFSET(fs->ate_wra)); + LOG_INF("data wra: %llu, %llx", SECTOR_NUM(fs->data_wra), SECTOR_OFFSET(fs->data_wra)); + + return 0; +} + +ssize_t zms_write(struct zms_fs *fs, uint32_t id, const void *data, size_t len) +{ + int rc; + size_t data_size; + struct zms_ate wlk_ate; + uint64_t wlk_addr, rd_addr; + uint32_t gc_count, required_space = 0U; /* no space, appropriate for delete ate */ + int prev_found = 0; + + if (!fs->ready) { + LOG_ERR("zms not initialized"); + return -EACCES; + } + + data_size = zms_al_size(fs, len); + + /* The maximum data size is sector size - 5 ate + * where: 1 ate for data, 1 ate for sector close, 1 ate for empty, + * 1 ate for gc done, and 1 ate to always allow a delete. + * We cannot also store more than 64 KB of data + */ + if ((len > (fs->sector_size - 5 * fs->ate_size)) || (len > UINT16_MAX) || + ((len > 0) && (data == NULL))) { + return -EINVAL; + } + + /* find latest entry with same id */ +#ifdef CONFIG_ZMS_LOOKUP_CACHE + wlk_addr = fs->lookup_cache[zms_lookup_cache_pos(id)]; + + if (wlk_addr == ZMS_LOOKUP_CACHE_NO_ADDR) { + goto no_cached_entry; + } +#else + wlk_addr = fs->ate_wra; +#endif + rd_addr = wlk_addr; + + /* Search for a previous valid ATE with the same ID */ + prev_found = zms_find_ate_with_id(fs, id, wlk_addr, fs->ate_wra, &wlk_ate, &rd_addr); + if (prev_found < 0) { + return prev_found; + } + +#ifdef CONFIG_ZMS_LOOKUP_CACHE +no_cached_entry: +#endif + if (prev_found) { + /* previous entry found */ + if (len > ZMS_DATA_IN_ATE_SIZE) { + rd_addr &= ADDR_SECT_MASK; + rd_addr += wlk_ate.offset; + } + + if (len == 0) { + /* do not try to compare with empty data */ + if (wlk_ate.len == 0U) { + /* skip delete entry as it is already the + * last one + */ + return 0; + } + } else if (len == wlk_ate.len) { + /* do not try to compare if lengths are not equal */ + /* compare the data and if equal return 0 */ + if (len <= ZMS_DATA_IN_ATE_SIZE) { + rc = memcmp(&wlk_ate.data, data, len); + if (!rc) { + return 0; + } + } else { + rc = zms_flash_block_cmp(fs, rd_addr, data, len); + if (rc <= 0) { + return rc; + } + } + } + } else { + /* skip delete entry for non-existing entry */ + if (len == 0) { + return 0; + } + } + + /* calculate required space if the entry contains data */ + if (data_size) { + /* Leave space for delete ate */ + if (len > ZMS_DATA_IN_ATE_SIZE) { + required_space = data_size + fs->ate_size; + } else { + required_space = fs->ate_size; + } + } + + k_mutex_lock(&fs->zms_lock, K_FOREVER); + + gc_count = 0; + while (1) { + if (gc_count == fs->sector_count) { + /* gc'ed all sectors, no extra space will be created + * by extra gc. + */ + rc = -ENOSPC; + goto end; + } + + /* We need to make sure that we leave the ATE at address 0x0 of the sector + * empty (even for delete ATE). Otherwise, the fs->ate_wra will be decremented + * after this write by ate_size and it will underflow. + * So the first position of a sector (fs->ate_wra = 0x0) is forbidden for ATEs + * and the second position could be written only be a delete ATE. + */ + if ((SECTOR_OFFSET(fs->ate_wra)) && + (fs->ate_wra >= (fs->data_wra + required_space)) && + (SECTOR_OFFSET(fs->ate_wra - fs->ate_size) || !len)) { + rc = zms_flash_write_entry(fs, id, data, len); + if (rc) { + goto end; + } + break; + } + rc = zms_sector_close(fs); + if (rc) { + LOG_ERR("Failed to close the sector, returned = %d", rc); + goto end; + } + rc = zms_gc(fs); + if (rc) { + LOG_ERR("Garbage collection failed, returned = %d", rc); + goto end; + } + gc_count++; + } + rc = len; +end: + k_mutex_unlock(&fs->zms_lock); + return rc; +} + +int zms_delete(struct zms_fs *fs, uint32_t id) +{ + return zms_write(fs, id, NULL, 0); +} + +ssize_t zms_read_hist(struct zms_fs *fs, uint32_t id, void *data, size_t len, uint32_t cnt) +{ + int rc, prev_found = 0; + uint64_t wlk_addr, rd_addr = 0, wlk_prev_addr = 0; + uint32_t cnt_his; + struct zms_ate wlk_ate; +#ifdef CONFIG_ZMS_DATA_CRC + uint32_t computed_data_crc; +#endif + + if (!fs->ready) { + LOG_ERR("zms not initialized"); + return -EACCES; + } + + cnt_his = 0U; + +#ifdef CONFIG_ZMS_LOOKUP_CACHE + wlk_addr = fs->lookup_cache[zms_lookup_cache_pos(id)]; + + if (wlk_addr == ZMS_LOOKUP_CACHE_NO_ADDR) { + rc = -ENOENT; + goto err; + } +#else + wlk_addr = fs->ate_wra; +#endif + + while (cnt_his <= cnt) { + wlk_prev_addr = wlk_addr; + /* Search for a previous valid ATE with the same ID */ + prev_found = zms_find_ate_with_id(fs, id, wlk_addr, fs->ate_wra, &wlk_ate, + &wlk_prev_addr); + if (prev_found < 0) { + return prev_found; + } + if (prev_found) { + cnt_his++; + /* wlk_prev_addr contain the ATE address of the previous found ATE. */ + rd_addr = wlk_prev_addr; + /* + * compute the previous ATE address in case we need to start + * the research again. + */ + rc = zms_compute_prev_addr(fs, &wlk_prev_addr); + if (rc) { + return rc; + } + /* wlk_addr will be the start research address in the next loop */ + wlk_addr = wlk_prev_addr; + } else { + break; + } + } + + if (((!prev_found) || (wlk_ate.id != id)) || (wlk_ate.len == 0U) || (cnt_his < cnt)) { + return -ENOENT; + } + + if (wlk_ate.len <= ZMS_DATA_IN_ATE_SIZE) { + /* data is stored in the ATE */ + if (data) { + memcpy(data, &wlk_ate.data, MIN(len, wlk_ate.len)); + } + } else { + rd_addr &= ADDR_SECT_MASK; + rd_addr += wlk_ate.offset; + /* do not read or copy data if pointer is NULL */ + if (data) { + rc = zms_flash_rd(fs, rd_addr, data, MIN(len, wlk_ate.len)); + if (rc) { + goto err; + } + } +#ifdef CONFIG_ZMS_DATA_CRC + /* Do not compute CRC for partial reads as CRC won't match */ + if (len >= wlk_ate.len) { + computed_data_crc = crc32_ieee(data, wlk_ate.len); + if (computed_data_crc != wlk_ate.data_crc) { + LOG_ERR("Invalid data CRC: ATE_CRC=0x%08X, " + "computed_data_crc=0x%08X", + wlk_ate.data_crc, computed_data_crc); + return -EIO; + } + } +#endif + } + + return wlk_ate.len; + +err: + return rc; +} + +ssize_t zms_read(struct zms_fs *fs, uint32_t id, void *data, size_t len) +{ + int rc; + + rc = zms_read_hist(fs, id, data, len, 0); + if (rc < 0) { + return rc; + } + + /* returns the minimum between ATE data length and requested length */ + return MIN(rc, len); +} + +ssize_t zms_get_data_length(struct zms_fs *fs, uint32_t id) +{ + int rc; + + rc = zms_read_hist(fs, id, NULL, 0, 0); + + return rc; +} + +ssize_t zms_calc_free_space(struct zms_fs *fs) +{ + + int rc, previous_sector_num = ZMS_INVALID_SECTOR_NUM, prev_found = 0, sec_closed; + struct zms_ate step_ate, wlk_ate, empty_ate, close_ate; + uint64_t step_addr, wlk_addr, step_prev_addr, wlk_prev_addr, data_wra = 0U; + uint8_t current_cycle; + ssize_t free_space = 0; + + if (!fs->ready) { + LOG_ERR("zms not initialized"); + return -EACCES; + } + + /* + * There is always a closing ATE , an empty ATE, a GC_done ATE and a reserved ATE for + * deletion in each sector. + * And there is always one reserved Sector for garbage collection operations + */ + free_space = (fs->sector_count - 1) * (fs->sector_size - 4 * fs->ate_size); + + step_addr = fs->ate_wra; + + do { + step_prev_addr = step_addr; + rc = zms_prev_ate(fs, &step_addr, &step_ate); + if (rc) { + return rc; + } + + /* When changing the sector let's get the new cycle counter */ + rc = zms_get_cycle_on_sector_change(fs, step_prev_addr, previous_sector_num, + ¤t_cycle); + if (rc) { + return rc; + } + previous_sector_num = SECTOR_NUM(step_prev_addr); + + /* Invalid and deleted ATEs are free spaces. + * Header ATEs are already retrieved from free space + */ + if (!zms_ate_valid_different_sector(fs, &step_ate, current_cycle) || + (step_ate.id == ZMS_HEAD_ID) || (step_ate.len == 0)) { + continue; + } + + wlk_addr = step_addr; + /* Try to find if there is a previous valid ATE with same ID */ + prev_found = zms_find_ate_with_id(fs, step_ate.id, wlk_addr, step_addr, &wlk_ate, + &wlk_prev_addr); + if (prev_found < 0) { + return prev_found; + } + + /* If no previous ATE is found, then this is a valid ATE that cannot be + * Garbage Collected + */ + if (!prev_found || (wlk_prev_addr == step_prev_addr)) { + if (step_ate.len > ZMS_DATA_IN_ATE_SIZE) { + free_space -= zms_al_size(fs, step_ate.len); + } + free_space -= fs->ate_size; + } + } while (step_addr != fs->ate_wra); + + /* we must keep the sector_cycle before we start looking into special cases */ + current_cycle = fs->sector_cycle; + + /* Let's look now for special cases where some sectors have only ATEs with + * small data size. + */ + const uint32_t second_to_last_offset = (2 * fs->ate_size); + + for (uint32_t i = 0; i < fs->sector_count; i++) { + step_addr = zms_close_ate_addr(fs, ((uint64_t)i << ADDR_SECT_SHIFT)); + + /* verify if the sector is closed */ + sec_closed = zms_validate_closed_sector(fs, step_addr, &empty_ate, &close_ate); + if (sec_closed < 0) { + return sec_closed; + } + + /* If the sector is closed and its offset is pointing to a position less than the + * 3rd to last ATE position in a sector, it means that we need to leave the second + * to last ATE empty. + */ + if ((sec_closed == 1) && (close_ate.offset <= second_to_last_offset)) { + free_space -= fs->ate_size; + } else if (!sec_closed) { + /* sector is open, let's recover the last ATE */ + fs->sector_cycle = empty_ate.cycle_cnt; + rc = zms_recover_last_ate(fs, &step_addr, &data_wra); + if (rc) { + return rc; + } + if (SECTOR_OFFSET(step_addr) <= second_to_last_offset) { + free_space -= fs->ate_size; + } + } + } + /* restore sector cycle */ + fs->sector_cycle = current_cycle; + + return free_space; +} + +size_t zms_sector_max_data_size(struct zms_fs *fs) +{ + if (!fs->ready) { + LOG_ERR("ZMS not initialized"); + return -EACCES; + } + + return fs->ate_wra - fs->data_wra - fs->ate_size; +} + +int zms_sector_use_next(struct zms_fs *fs) +{ + int ret; + + if (!fs->ready) { + LOG_ERR("ZMS not initialized"); + return -EACCES; + } + + k_mutex_lock(&fs->zms_lock, K_FOREVER); + + ret = zms_sector_close(fs); + if (ret != 0) { + goto end; + } + + ret = zms_gc(fs); + +end: + k_mutex_unlock(&fs->zms_lock); + return ret; +} diff --git a/subsys/fs/zms/zms_priv.h b/subsys/fs/zms/zms_priv.h new file mode 100644 index 0000000000000..6594048ea0f47 --- /dev/null +++ b/subsys/fs/zms/zms_priv.h @@ -0,0 +1,76 @@ +/* ZMS: Zephyr Memory Storage + * + * Copyright (c) 2024 BayLibre SAS + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef __ZMS_PRIV_H_ +#define __ZMS_PRIV_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * MASKS AND SHIFT FOR ADDRESSES + * an address in zms is an uint64_t where: + * high 4 bytes represent the sector number + * low 4 bytes represent the offset in a sector + */ +#define ADDR_SECT_MASK GENMASK64(63, 32) +#define ADDR_SECT_SHIFT 32 +#define ADDR_OFFS_MASK GENMASK64(31, 0) +#define SECTOR_NUM(x) FIELD_GET(ADDR_SECT_MASK, x) +#define SECTOR_OFFSET(x) FIELD_GET(ADDR_OFFS_MASK, x) + +#if defined(CONFIG_ZMS_CUSTOM_BLOCK_SIZE) +#define ZMS_BLOCK_SIZE CONFIG_ZMS_MAX_BLOCK_SIZE +#else +#define ZMS_BLOCK_SIZE 32 +#endif + +#define ZMS_LOOKUP_CACHE_NO_ADDR GENMASK64(63, 0) +#define ZMS_HEAD_ID GENMASK(31, 0) + +#define ZMS_VERSION_MASK GENMASK(7, 0) +#define ZMS_GET_VERSION(x) FIELD_GET(ZMS_VERSION_MASK, x) +#define ZMS_DEFAULT_VERSION 1 +#define ZMS_MAGIC_NUMBER 0x42 /* murmur3a hash of "ZMS" (MSB) */ +#define ZMS_MAGIC_NUMBER_MASK GENMASK(15, 8) +#define ZMS_GET_MAGIC_NUMBER(x) FIELD_GET(ZMS_MAGIC_NUMBER_MASK, x) +#define ZMS_MIN_ATE_NUM 5 + +#define ZMS_INVALID_SECTOR_NUM -1 +#define ZMS_DATA_IN_ATE_SIZE 8 + +struct zms_ate { + uint8_t crc8; /* crc8 check of the entry */ + uint8_t cycle_cnt; /* cycle counter for non erasable devices */ + uint32_t id; /* data id */ + uint16_t len; /* data len within sector */ + union { + uint8_t data[8]; /* used to store small size data */ + struct { + uint32_t offset; /* data offset within sector */ + union { + uint32_t data_crc; /* + * crc for data: The data CRC is checked only + * when the whole data of the element is read. + * The data CRC is not checked for a partial + * read, as it is computed for the complete + * set of data. + */ + uint32_t metadata; /* + * Used to store metadata information + * such as storage version. + */ + }; + }; + }; +} __packed; + +#ifdef __cplusplus +} +#endif + +#endif /* __ZMS_PRIV_H_ */ From 004d6d6adc01ef8c776eb0c4863d05cb3b661d03 Mon Sep 17 00:00:00 2001 From: Riadh Ghaddab Date: Mon, 5 Aug 2024 13:09:18 +0200 Subject: [PATCH 1661/4482] tests: fs: zms: add testsuite for ZMS storage List of added tests : - zms.test_delete - zms.test_zms_cache_collission - zms.test_zms_cache_gc - zms.test_zms_cache_hash_quality - zms.test_zms_cache_init - zms.test_zms_corrupted_sector_close_operation - zms.test_zms_corrupted_write - zms.test_zms_full_sector - zms.test_zms_gc - zms.test_zms_gc_3sectors - zms.test_zms_gc_corrupt_ate - zms.test_zms_gc_corrupt_close_ate - zms.test_zms_mount - zms.test_zms_write Signed-off-by: Riadh Ghaddab --- tests/subsys/fs/zms/CMakeLists.txt | 9 + tests/subsys/fs/zms/boards/native_sim.overlay | 9 + .../fs/zms/boards/qemu_x86_ev_0x00.overlay | 9 + tests/subsys/fs/zms/prj.conf | 9 + tests/subsys/fs/zms/src/main.c | 888 ++++++++++++++++++ tests/subsys/fs/zms/testcase.yaml | 28 + 6 files changed, 952 insertions(+) create mode 100644 tests/subsys/fs/zms/CMakeLists.txt create mode 100644 tests/subsys/fs/zms/boards/native_sim.overlay create mode 100644 tests/subsys/fs/zms/boards/qemu_x86_ev_0x00.overlay create mode 100644 tests/subsys/fs/zms/prj.conf create mode 100644 tests/subsys/fs/zms/src/main.c create mode 100644 tests/subsys/fs/zms/testcase.yaml diff --git a/tests/subsys/fs/zms/CMakeLists.txt b/tests/subsys/fs/zms/CMakeLists.txt new file mode 100644 index 0000000000000..66d9c91a520d6 --- /dev/null +++ b/tests/subsys/fs/zms/CMakeLists.txt @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(fs_zms) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) +target_include_directories(app PRIVATE ${ZEPHYR_BASE}/subsys/fs/zms) diff --git a/tests/subsys/fs/zms/boards/native_sim.overlay b/tests/subsys/fs/zms/boards/native_sim.overlay new file mode 100644 index 0000000000000..0f330fd7b176e --- /dev/null +++ b/tests/subsys/fs/zms/boards/native_sim.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&flash0 { + erase-block-size = <0x400>; +}; diff --git a/tests/subsys/fs/zms/boards/qemu_x86_ev_0x00.overlay b/tests/subsys/fs/zms/boards/qemu_x86_ev_0x00.overlay new file mode 100644 index 0000000000000..ffc3bc97aacac --- /dev/null +++ b/tests/subsys/fs/zms/boards/qemu_x86_ev_0x00.overlay @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&sim_flash { + erase-value = < 0x00 >; +}; diff --git a/tests/subsys/fs/zms/prj.conf b/tests/subsys/fs/zms/prj.conf new file mode 100644 index 0000000000000..5d84f6e17fde4 --- /dev/null +++ b/tests/subsys/fs/zms/prj.conf @@ -0,0 +1,9 @@ +CONFIG_ZTEST=y +CONFIG_ZTEST_STACK_SIZE=4096 + +CONFIG_FLASH=y +CONFIG_FLASH_MAP=y + +CONFIG_ZMS=y +CONFIG_LOG=y +CONFIG_ZMS_LOG_LEVEL_DBG=y diff --git a/tests/subsys/fs/zms/src/main.c b/tests/subsys/fs/zms/src/main.c new file mode 100644 index 0000000000000..80866687dbab7 --- /dev/null +++ b/tests/subsys/fs/zms/src/main.c @@ -0,0 +1,888 @@ +/* + * Copyright (c) 2024 BayLibre SAS + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * This test is designed to be run using flash-simulator which provide + * functionality for flash property customization and emulating errors in + * flash operation in parallel to regular flash API. + * Test should be run on qemu_x86 or native_sim target. + */ + +#if !defined(CONFIG_BOARD_QEMU_X86) && !defined(CONFIG_ARCH_POSIX) +#error "Run only on qemu_x86 or a posix architecture based target (for ex. native_sim)" +#endif + +#include +#include +#include + +#include +#include +#include +#include +#include +#include "zms_priv.h" + +#define TEST_ZMS_AREA storage_partition +#define TEST_ZMS_AREA_OFFSET FIXED_PARTITION_OFFSET(TEST_ZMS_AREA) +#define TEST_ZMS_AREA_ID FIXED_PARTITION_ID(TEST_ZMS_AREA) +#define TEST_ZMS_AREA_DEV DEVICE_DT_GET(DT_MTD_FROM_FIXED_PARTITION(DT_NODELABEL(TEST_ZMS_AREA))) +#define TEST_DATA_ID 1 +#define TEST_SECTOR_COUNT 5U + +static const struct device *const flash_dev = TEST_ZMS_AREA_DEV; + +struct zms_fixture { + struct zms_fs fs; + struct stats_hdr *sim_stats; + struct stats_hdr *sim_thresholds; +}; + +static void *setup(void) +{ + int err; + const struct flash_area *fa; + struct flash_pages_info info; + static struct zms_fixture fixture; + + __ASSERT_NO_MSG(device_is_ready(flash_dev)); + + err = flash_area_open(TEST_ZMS_AREA_ID, &fa); + zassert_true(err == 0, "flash_area_open() fail: %d", err); + + fixture.fs.offset = TEST_ZMS_AREA_OFFSET; + err = flash_get_page_info_by_offs(flash_area_get_device(fa), fixture.fs.offset, &info); + zassert_true(err == 0, "Unable to get page info: %d", err); + + fixture.fs.sector_size = info.size; + fixture.fs.sector_count = TEST_SECTOR_COUNT; + fixture.fs.flash_device = flash_area_get_device(fa); + + return &fixture; +} + +static void before(void *data) +{ + struct zms_fixture *fixture = (struct zms_fixture *)data; + + fixture->sim_stats = stats_group_find("flash_sim_stats"); + fixture->sim_thresholds = stats_group_find("flash_sim_thresholds"); +} + +static void after(void *data) +{ + struct zms_fixture *fixture = (struct zms_fixture *)data; + + if (fixture->sim_stats) { + stats_reset(fixture->sim_stats); + } + if (fixture->sim_thresholds) { + stats_reset(fixture->sim_thresholds); + } + + /* Clear ZMS */ + if (fixture->fs.ready) { + int err; + + err = zms_clear(&fixture->fs); + zassert_true(err == 0, "zms_clear call failure: %d", err); + } + + fixture->fs.sector_count = TEST_SECTOR_COUNT; +} + +ZTEST_SUITE(zms, NULL, setup, before, after, NULL); + +ZTEST_F(zms, test_zms_mount) +{ + int err; + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); +} + +static void execute_long_pattern_write(uint32_t id, struct zms_fs *fs) +{ + char rd_buf[512]; + char wr_buf[512]; + char pattern[] = {0xDE, 0xAD, 0xBE, 0xEF}; + size_t len; + + len = zms_read(fs, id, rd_buf, sizeof(rd_buf)); + zassert_true(len == -ENOENT, "zms_read unexpected failure: %d", len); + + BUILD_ASSERT((sizeof(wr_buf) % sizeof(pattern)) == 0); + for (int i = 0; i < sizeof(wr_buf); i += sizeof(pattern)) { + memcpy(wr_buf + i, pattern, sizeof(pattern)); + } + + len = zms_write(fs, id, wr_buf, sizeof(wr_buf)); + zassert_true(len == sizeof(wr_buf), "zms_write failed: %d", len); + + len = zms_read(fs, id, rd_buf, sizeof(rd_buf)); + zassert_true(len == sizeof(rd_buf), "zms_read unexpected failure: %d", len); + zassert_mem_equal(wr_buf, rd_buf, sizeof(rd_buf), "RD buff should be equal to the WR buff"); +} + +ZTEST_F(zms, test_zms_write) +{ + int err; + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + execute_long_pattern_write(TEST_DATA_ID, &fixture->fs); +} + +static int flash_sim_write_calls_find(struct stats_hdr *hdr, void *arg, const char *name, + uint16_t off) +{ + if (!strcmp(name, "flash_write_calls")) { + uint32_t **flash_write_stat = (uint32_t **)arg; + *flash_write_stat = (uint32_t *)((uint8_t *)hdr + off); + } + + return 0; +} + +static int flash_sim_max_write_calls_find(struct stats_hdr *hdr, void *arg, const char *name, + uint16_t off) +{ + if (!strcmp(name, "max_write_calls")) { + uint32_t **max_write_calls = (uint32_t **)arg; + *max_write_calls = (uint32_t *)((uint8_t *)hdr + off); + } + + return 0; +} + +ZTEST_F(zms, test_zms_corrupted_write) +{ + int err; + size_t len; + char rd_buf[512]; + char wr_buf_1[512]; + char wr_buf_2[512]; + char pattern_1[] = {0xDE, 0xAD, 0xBE, 0xEF}; + char pattern_2[] = {0x03, 0xAA, 0x85, 0x6F}; + uint32_t *flash_write_stat; + uint32_t *flash_max_write_calls; + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + err = zms_read(&fixture->fs, TEST_DATA_ID, rd_buf, sizeof(rd_buf)); + zassert_true(err == -ENOENT, "zms_read unexpected failure: %d", err); + + BUILD_ASSERT((sizeof(wr_buf_1) % sizeof(pattern_1)) == 0); + for (int i = 0; i < sizeof(wr_buf_1); i += sizeof(pattern_1)) { + memcpy(wr_buf_1 + i, pattern_1, sizeof(pattern_1)); + } + + len = zms_write(&fixture->fs, TEST_DATA_ID, wr_buf_1, sizeof(wr_buf_1)); + zassert_true(len == sizeof(wr_buf_1), "zms_write failed: %d", len); + + len = zms_read(&fixture->fs, TEST_DATA_ID, rd_buf, sizeof(rd_buf)); + zassert_true(len == sizeof(rd_buf), "zms_read unexpected failure: %d", len); + zassert_mem_equal(wr_buf_1, rd_buf, sizeof(rd_buf), + "RD buff should be equal to the first WR buff"); + + BUILD_ASSERT((sizeof(wr_buf_2) % sizeof(pattern_2)) == 0); + for (int i = 0; i < sizeof(wr_buf_2); i += sizeof(pattern_2)) { + memcpy(wr_buf_2 + i, pattern_2, sizeof(pattern_2)); + } + + /* Set the maximum number of writes that the flash simulator can + * execute. + */ + stats_walk(fixture->sim_thresholds, flash_sim_max_write_calls_find, &flash_max_write_calls); + stats_walk(fixture->sim_stats, flash_sim_write_calls_find, &flash_write_stat); + + *flash_max_write_calls = *flash_write_stat - 1; + *flash_write_stat = 0; + + /* Flash simulator will lose part of the data at the end of this write. + * This should simulate power down during flash write. The written data + * are corrupted at this point and should be discarded by the ZMS. + */ + len = zms_write(&fixture->fs, TEST_DATA_ID, wr_buf_2, sizeof(wr_buf_2)); + zassert_true(len == sizeof(wr_buf_2), "zms_write failed: %d", len); + + /* Reinitialize the ZMS. */ + memset(&fixture->fs, 0, sizeof(fixture->fs)); + (void)setup(); + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + len = zms_read(&fixture->fs, TEST_DATA_ID, rd_buf, sizeof(rd_buf)); + zassert_true(len == sizeof(rd_buf), "zms_read unexpected failure: %d", len); + zassert_true(memcmp(wr_buf_2, rd_buf, sizeof(rd_buf)) != 0, + "RD buff should not be equal to the second WR buff because of " + "corrupted write operation"); + zassert_mem_equal(wr_buf_1, rd_buf, sizeof(rd_buf), + "RD buff should be equal to the first WR buff because subsequent " + "write operation has failed"); +} + +ZTEST_F(zms, test_zms_gc) +{ + int err; + int len; + uint8_t buf[32]; + uint8_t rd_buf[32]; + + const uint16_t max_id = 10; + /* 21st write will trigger GC. */ + const uint16_t max_writes = 21; + + fixture->fs.sector_count = 2; + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + for (uint32_t i = 0; i < max_writes; i++) { + uint8_t id = (i % max_id); + uint8_t id_data = id + max_id * (i / max_id); + + memset(buf, id_data, sizeof(buf)); + + len = zms_write(&fixture->fs, id, buf, sizeof(buf)); + zassert_true(len == sizeof(buf), "zms_write failed: %d", len); + } + + for (uint32_t id = 0; id < max_id; id++) { + len = zms_read(&fixture->fs, id, rd_buf, sizeof(buf)); + zassert_true(len == sizeof(rd_buf), "zms_read unexpected failure: %d", len); + + for (uint16_t i = 0; i < sizeof(rd_buf); i++) { + rd_buf[i] = rd_buf[i] % max_id; + buf[i] = id; + } + zassert_mem_equal(buf, rd_buf, sizeof(rd_buf), + "RD buff should be equal to the WR buff"); + } + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + for (uint32_t id = 0; id < max_id; id++) { + len = zms_read(&fixture->fs, id, rd_buf, sizeof(buf)); + zassert_true(len == sizeof(rd_buf), "zms_read unexpected failure: %d", len); + + for (uint16_t i = 0; i < sizeof(rd_buf); i++) { + rd_buf[i] = rd_buf[i] % max_id; + buf[i] = id; + } + zassert_mem_equal(buf, rd_buf, sizeof(rd_buf), + "RD buff should be equal to the WR buff"); + } +} + +static void write_content(uint32_t max_id, uint32_t begin, uint32_t end, struct zms_fs *fs) +{ + uint8_t buf[32]; + ssize_t len; + + for (uint32_t i = begin; i < end; i++) { + uint8_t id = (i % max_id); + uint8_t id_data = id + max_id * (i / max_id); + + memset(buf, id_data, sizeof(buf)); + + len = zms_write(fs, id, buf, sizeof(buf)); + zassert_true(len == sizeof(buf), "zms_write failed: %d", len); + } +} + +static void check_content(uint32_t max_id, struct zms_fs *fs) +{ + uint8_t rd_buf[32]; + uint8_t buf[32]; + ssize_t len; + + for (uint32_t id = 0; id < max_id; id++) { + len = zms_read(fs, id, rd_buf, sizeof(buf)); + zassert_true(len == sizeof(rd_buf), "zms_read unexpected failure: %d", len); + + for (uint16_t i = 0; i < ARRAY_SIZE(rd_buf); i++) { + rd_buf[i] = rd_buf[i] % max_id; + buf[i] = id; + } + zassert_mem_equal(buf, rd_buf, sizeof(rd_buf), + "RD buff should be equal to the WR buff"); + } +} + +/** + * Full round of GC over 3 sectors + */ +ZTEST_F(zms, test_zms_gc_3sectors) +{ + int err; + + const uint16_t max_id = 10; + /* 41st write will trigger 1st GC. */ + const uint16_t max_writes = 41; + /* 61st write will trigger 2nd GC. */ + const uint16_t max_writes_2 = 41 + 20; + /* 81st write will trigger 3rd GC. */ + const uint16_t max_writes_3 = 41 + 20 + 20; + /* 101st write will trigger 4th GC. */ + const uint16_t max_writes_4 = 41 + 20 + 20 + 20; + + fixture->fs.sector_count = 3; + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + zassert_equal(fixture->fs.ate_wra >> ADDR_SECT_SHIFT, 0, "unexpected write sector"); + + /* Trigger 1st GC */ + write_content(max_id, 0, max_writes, &fixture->fs); + + /* sector sequence: empty,closed, write */ + zassert_equal(fixture->fs.ate_wra >> ADDR_SECT_SHIFT, 2, "unexpected write sector"); + check_content(max_id, &fixture->fs); + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + zassert_equal(fixture->fs.ate_wra >> ADDR_SECT_SHIFT, 2, "unexpected write sector"); + check_content(max_id, &fixture->fs); + + /* Trigger 2nd GC */ + write_content(max_id, max_writes, max_writes_2, &fixture->fs); + + /* sector sequence: write, empty, closed */ + zassert_equal(fixture->fs.ate_wra >> ADDR_SECT_SHIFT, 0, "unexpected write sector"); + check_content(max_id, &fixture->fs); + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + zassert_equal(fixture->fs.ate_wra >> ADDR_SECT_SHIFT, 0, "unexpected write sector"); + check_content(max_id, &fixture->fs); + + /* Trigger 3rd GC */ + write_content(max_id, max_writes_2, max_writes_3, &fixture->fs); + + /* sector sequence: closed, write, empty */ + zassert_equal(fixture->fs.ate_wra >> ADDR_SECT_SHIFT, 1, "unexpected write sector"); + check_content(max_id, &fixture->fs); + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + zassert_equal(fixture->fs.ate_wra >> ADDR_SECT_SHIFT, 1, "unexpected write sector"); + check_content(max_id, &fixture->fs); + + /* Trigger 4th GC */ + write_content(max_id, max_writes_3, max_writes_4, &fixture->fs); + + /* sector sequence: empty,closed, write */ + zassert_equal(fixture->fs.ate_wra >> ADDR_SECT_SHIFT, 2, "unexpected write sector"); + check_content(max_id, &fixture->fs); + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + zassert_equal(fixture->fs.ate_wra >> ADDR_SECT_SHIFT, 2, "unexpected write sector"); + check_content(max_id, &fixture->fs); +} + +static int flash_sim_max_len_find(struct stats_hdr *hdr, void *arg, const char *name, uint16_t off) +{ + if (!strcmp(name, "max_len")) { + uint32_t **max_len = (uint32_t **)arg; + *max_len = (uint32_t *)((uint8_t *)hdr + off); + } + + return 0; +} + +ZTEST_F(zms, test_zms_corrupted_sector_close_operation) +{ + int err; + int len; + uint8_t buf[32]; + uint32_t *flash_write_stat; + uint32_t *flash_max_write_calls; + uint32_t *flash_max_len; + + const uint16_t max_id = 10; + /* 21st write will trigger GC. */ + const uint16_t max_writes = 21; + + /* Get the address of simulator parameters. */ + stats_walk(fixture->sim_thresholds, flash_sim_max_write_calls_find, &flash_max_write_calls); + stats_walk(fixture->sim_thresholds, flash_sim_max_len_find, &flash_max_len); + stats_walk(fixture->sim_stats, flash_sim_write_calls_find, &flash_write_stat); + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + for (uint32_t i = 0; i < max_writes; i++) { + uint8_t id = (i % max_id); + uint8_t id_data = id + max_id * (i / max_id); + + memset(buf, id_data, sizeof(buf)); + + if (i == max_writes - 1) { + /* Reset stats. */ + *flash_write_stat = 0; + + /* Block write calls and simulate power down during + * sector closing operation, so only a part of a ZMS + * closing ate will be written. + */ + *flash_max_write_calls = 1; + *flash_max_len = 4; + } + len = zms_write(&fixture->fs, id, buf, sizeof(buf)); + zassert_true(len == sizeof(buf), "zms_write failed: %d", len); + } + + /* Make the flash simulator functional again. */ + *flash_max_write_calls = 0; + *flash_max_len = 0; + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + check_content(max_id, &fixture->fs); + + /* Ensure that the ZMS is able to store new content. */ + execute_long_pattern_write(max_id, &fixture->fs); +} + +/** + * @brief Test case when storage become full, so only deletion is possible. + */ +ZTEST_F(zms, test_zms_full_sector) +{ + int err; + ssize_t len; + uint32_t filling_id = 0; + uint32_t i, data_read; + + fixture->fs.sector_count = 3; + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + while (1) { + len = zms_write(&fixture->fs, filling_id, &filling_id, sizeof(filling_id)); + if (len == -ENOSPC) { + break; + } + zassert_true(len == sizeof(filling_id), "zms_write failed: %d", len); + filling_id++; + } + + /* check whether can delete whatever from full storage */ + err = zms_delete(&fixture->fs, 1); + zassert_true(err == 0, "zms_delete call failure: %d", err); + + /* the last sector is full now, test re-initialization */ + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + len = zms_write(&fixture->fs, filling_id, &filling_id, sizeof(filling_id)); + zassert_true(len == sizeof(filling_id), "zms_write failed: %d", len); + + /* sanitycheck on ZMS content */ + for (i = 0; i <= filling_id; i++) { + len = zms_read(&fixture->fs, i, &data_read, sizeof(data_read)); + if (i == 1) { + zassert_true(len == -ENOENT, "zms_read shouldn't found the entry: %d", len); + } else { + zassert_true(len == sizeof(data_read), + "zms_read #%d failed: len is %zd instead of %zu", i, len, + sizeof(data_read)); + zassert_equal(data_read, i, "read unexpected data: %d instead of %d", + data_read, i); + } + } +} + +ZTEST_F(zms, test_delete) +{ + int err; + ssize_t len; + uint32_t filling_id, data_read; + uint32_t ate_wra, data_wra; + + fixture->fs.sector_count = 3; + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + for (filling_id = 0; filling_id < 10; filling_id++) { + len = zms_write(&fixture->fs, filling_id, &filling_id, sizeof(filling_id)); + + zassert_true(len == sizeof(filling_id), "zms_write failed: %d", len); + + if (filling_id != 0) { + continue; + } + + /* delete the first entry while it is the most recent one */ + err = zms_delete(&fixture->fs, filling_id); + zassert_true(err == 0, "zms_delete call failure: %d", err); + + len = zms_read(&fixture->fs, filling_id, &data_read, sizeof(data_read)); + zassert_true(len == -ENOENT, "zms_read shouldn't found the entry: %d", len); + } + + /* delete existing entry */ + err = zms_delete(&fixture->fs, 1); + zassert_true(err == 0, "zms_delete call failure: %d", err); + + len = zms_read(&fixture->fs, 1, &data_read, sizeof(data_read)); + zassert_true(len == -ENOENT, "zms_read shouldn't found the entry: %d", len); + + ate_wra = fixture->fs.ate_wra; + data_wra = fixture->fs.data_wra; + + /* delete already deleted entry */ + err = zms_delete(&fixture->fs, 1); + zassert_true(err == 0, "zms_delete call failure: %d", err); + zassert_true(ate_wra == fixture->fs.ate_wra && data_wra == fixture->fs.data_wra, + "delete already deleted entry should not make" + " any footprint in the storage"); + + /* delete nonexisting entry */ + err = zms_delete(&fixture->fs, filling_id); + zassert_true(err == 0, "zms_delete call failure: %d", err); + zassert_true(ate_wra == fixture->fs.ate_wra && data_wra == fixture->fs.data_wra, + "delete nonexistent entry should not make" + " any footprint in the storage"); +} + +/* + * Test that garbage-collection can recover all ate's even when the last ate, + * ie close_ate, is corrupt. In this test the close_ate is set to point to the + * last ate at -5. A valid ate is however present at -6. Since the close_ate + * has an invalid crc8, the offset should not be used and a recover of the + * last ate should be done instead. + */ +ZTEST_F(zms, test_zms_gc_corrupt_close_ate) +{ + struct zms_ate ate, close_ate, empty_ate; + uint32_t data; + ssize_t len; + int err; + + Z_TEST_SKIP_IFNDEF(CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES); + close_ate.id = 0xffffffff; + close_ate.offset = fixture->fs.sector_size - sizeof(struct zms_ate) * 5; + close_ate.len = 0; + close_ate.metadata = 0xffffffff; + close_ate.cycle_cnt = 1; + close_ate.crc8 = 0xff; /* Incorrect crc8 */ + + empty_ate.id = 0xffffffff; + empty_ate.offset = 0; + empty_ate.len = 0xffff; + empty_ate.metadata = 0x4201; + empty_ate.cycle_cnt = 1; + empty_ate.crc8 = + crc8_ccitt(0xff, (uint8_t *)&empty_ate + SIZEOF_FIELD(struct zms_ate, crc8), + sizeof(struct zms_ate) - SIZEOF_FIELD(struct zms_ate, crc8)); + + memset(&ate, 0, sizeof(struct zms_ate)); + ate.id = 0x1; + ate.len = sizeof(data); + ate.cycle_cnt = 1; + data = 0xaa55aa55; + memcpy(&ate.data, &data, sizeof(data)); + ate.crc8 = crc8_ccitt(0xff, (uint8_t *)&ate + SIZEOF_FIELD(struct zms_ate, crc8), + sizeof(struct zms_ate) - SIZEOF_FIELD(struct zms_ate, crc8)); + + /* Add empty ATE */ + err = flash_write(fixture->fs.flash_device, + fixture->fs.offset + fixture->fs.sector_size - sizeof(struct zms_ate), + &empty_ate, sizeof(empty_ate)); + zassert_true(err == 0, "flash_write failed: %d", err); + + /* Mark sector 0 as closed */ + err = flash_write(fixture->fs.flash_device, + fixture->fs.offset + fixture->fs.sector_size - 2 * sizeof(struct zms_ate), + &close_ate, sizeof(close_ate)); + zassert_true(err == 0, "flash_write failed: %d", err); + + /* Write valid ate at -6 */ + err = flash_write(fixture->fs.flash_device, + fixture->fs.offset + fixture->fs.sector_size - 6 * sizeof(struct zms_ate), + &ate, sizeof(ate)); + zassert_true(err == 0, "flash_write failed: %d", err); + + /* Mark sector 1 as closed */ + err = flash_write(fixture->fs.flash_device, + fixture->fs.offset + (2 * fixture->fs.sector_size) - + 2 * sizeof(struct zms_ate), + &close_ate, sizeof(close_ate)); + zassert_true(err == 0, "flash_write failed: %d", err); + + fixture->fs.sector_count = 3; + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + data = 0; + len = zms_read(&fixture->fs, 1, &data, sizeof(data)); + zassert_true(len == sizeof(data), "zms_read should have read %d bytes", sizeof(data)); + zassert_true(data == 0xaa55aa55, "unexpected value %d", data); +} + +/* + * Test that garbage-collection correctly handles corrupt ate's. + */ +ZTEST_F(zms, test_zms_gc_corrupt_ate) +{ + struct zms_ate corrupt_ate, close_ate; + int err; + + close_ate.id = 0xffffffff; + close_ate.offset = fixture->fs.sector_size / 2; + close_ate.len = 0; + close_ate.crc8 = + crc8_ccitt(0xff, (uint8_t *)&close_ate + SIZEOF_FIELD(struct zms_ate, crc8), + sizeof(struct zms_ate) - SIZEOF_FIELD(struct zms_ate, crc8)); + + corrupt_ate.id = 0xdeadbeef; + corrupt_ate.offset = 0; + corrupt_ate.len = 20; + corrupt_ate.crc8 = 0xff; /* Incorrect crc8 */ + + /* Mark sector 0 as closed */ + err = flash_write(fixture->fs.flash_device, + fixture->fs.offset + fixture->fs.sector_size - 2 * sizeof(struct zms_ate), + &close_ate, sizeof(close_ate)); + zassert_true(err == 0, "flash_write failed: %d", err); + + /* Write a corrupt ate */ + err = flash_write(fixture->fs.flash_device, + fixture->fs.offset + (fixture->fs.sector_size / 2), &corrupt_ate, + sizeof(corrupt_ate)); + zassert_true(err == 0, "flash_write failed: %d", err); + + /* Mark sector 1 as closed */ + err = flash_write(fixture->fs.flash_device, + fixture->fs.offset + (2 * fixture->fs.sector_size) - + 2 * sizeof(struct zms_ate), + &close_ate, sizeof(close_ate)); + zassert_true(err == 0, "flash_write failed: %d", err); + + fixture->fs.sector_count = 3; + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); +} + +#ifdef CONFIG_ZMS_LOOKUP_CACHE +static size_t num_matching_cache_entries(uint64_t addr, bool compare_sector_only, struct zms_fs *fs) +{ + size_t i, num = 0; + uint64_t mask = compare_sector_only ? ADDR_SECT_MASK : UINT64_MAX; + + for (i = 0; i < CONFIG_ZMS_LOOKUP_CACHE_SIZE; i++) { + if ((fs->lookup_cache[i] & mask) == addr) { + num++; + } + } + + return num; +} + +static size_t num_occupied_cache_entries(struct zms_fs *fs) +{ + return CONFIG_ZMS_LOOKUP_CACHE_SIZE - + num_matching_cache_entries(ZMS_LOOKUP_CACHE_NO_ADDR, false, fs); +} +#endif + +/* + * Test that ZMS lookup cache is properly rebuilt on zms_mount(), or initialized + * to ZMS_LOOKUP_CACHE_NO_ADDR if the store is empty. + */ +ZTEST_F(zms, test_zms_cache_init) +{ +#ifdef CONFIG_ZMS_LOOKUP_CACHE + int err; + size_t num; + uint64_t ate_addr; + uint8_t data = 0; + + /* Test cache initialization when the store is empty */ + + fixture->fs.sector_count = 3; + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + num = num_occupied_cache_entries(&fixture->fs); + zassert_equal(num, 0, "uninitialized cache"); + + /* Test cache update after zms_write() */ + + ate_addr = fixture->fs.ate_wra; + err = zms_write(&fixture->fs, 1, &data, sizeof(data)); + zassert_equal(err, sizeof(data), "zms_write call failure: %d", err); + + num = num_occupied_cache_entries(&fixture->fs); + zassert_equal(num, 1, "cache not updated after write"); + + num = num_matching_cache_entries(ate_addr, false, &fixture->fs); + zassert_equal(num, 1, "invalid cache entry after write"); + + /* Test cache initialization when the store is non-empty */ + + memset(fixture->fs.lookup_cache, 0xAA, sizeof(fixture->fs.lookup_cache)); + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + num = num_occupied_cache_entries(&fixture->fs); + zassert_equal(num, 1, "uninitialized cache after restart"); + + num = num_matching_cache_entries(ate_addr, false, &fixture->fs); + zassert_equal(num, 1, "invalid cache entry after restart"); +#endif +} + +/* + * Test that even after writing more ZMS IDs than the number of ZMS lookup cache + * entries they all can be read correctly. + */ +ZTEST_F(zms, test_zms_cache_collission) +{ +#ifdef CONFIG_ZMS_LOOKUP_CACHE + int err; + uint32_t id; + uint16_t data; + + fixture->fs.sector_count = 4; + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + for (id = 0; id < CONFIG_ZMS_LOOKUP_CACHE_SIZE + 1; id++) { + data = id; + err = zms_write(&fixture->fs, id, &data, sizeof(data)); + zassert_equal(err, sizeof(data), "zms_write call failure: %d", err); + } + + for (id = 0; id < CONFIG_ZMS_LOOKUP_CACHE_SIZE + 1; id++) { + err = zms_read(&fixture->fs, id, &data, sizeof(data)); + zassert_equal(err, sizeof(data), "zms_read call failure: %d", err); + zassert_equal(data, id, "incorrect data read"); + } +#endif +} + +/* + * Test that ZMS lookup cache does not contain any address from gc-ed sector + */ +ZTEST_F(zms, test_zms_cache_gc) +{ +#ifdef CONFIG_ZMS_LOOKUP_CACHE + int err; + size_t num; + uint16_t data = 0; + + fixture->fs.sector_count = 3; + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + /* Fill the first sector with writes of ID 1 */ + + while (fixture->fs.data_wra + sizeof(data) + sizeof(struct zms_ate) <= + fixture->fs.ate_wra) { + ++data; + err = zms_write(&fixture->fs, 1, &data, sizeof(data)); + zassert_equal(err, sizeof(data), "zms_write call failure: %d", err); + } + + /* Verify that cache contains a single entry for sector 0 */ + + num = num_matching_cache_entries(0ULL << ADDR_SECT_SHIFT, true, &fixture->fs); + zassert_equal(num, 1, "invalid cache content after filling sector 0"); + + /* Fill the second sector with writes of ID 2 */ + + while ((fixture->fs.ate_wra >> ADDR_SECT_SHIFT) != 2) { + ++data; + err = zms_write(&fixture->fs, 2, &data, sizeof(data)); + zassert_equal(err, sizeof(data), "zms_write call failure: %d", err); + } + + /* + * At this point sector 0 should have been gc-ed. Verify that action is + * reflected by the cache content. + */ + + num = num_matching_cache_entries(0ULL << ADDR_SECT_SHIFT, true, &fixture->fs); + zassert_equal(num, 0, "not invalidated cache entries aftetr gc"); + + num = num_matching_cache_entries(2ULL << ADDR_SECT_SHIFT, true, &fixture->fs); + zassert_equal(num, 2, "invalid cache content after gc"); +#endif +} + +/* + * Test ZMS lookup cache hash quality. + */ +ZTEST_F(zms, test_zms_cache_hash_quality) +{ +#ifdef CONFIG_ZMS_LOOKUP_CACHE + const size_t MIN_CACHE_OCCUPANCY = CONFIG_ZMS_LOOKUP_CACHE_SIZE * 6 / 10; + int err; + size_t num; + uint32_t id; + uint16_t data; + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + /* Write ZMS IDs from 0 to CONFIG_ZMS_LOOKUP_CACHE_SIZE - 1 */ + + for (uint16_t i = 0; i < CONFIG_ZMS_LOOKUP_CACHE_SIZE; i++) { + id = i; + data = 0; + + err = zms_write(&fixture->fs, id, &data, sizeof(data)); + zassert_equal(err, sizeof(data), "zms_write call failure: %d", err); + } + + /* Verify that at least 60% cache entries are occupied */ + + num = num_occupied_cache_entries(&fixture->fs); + TC_PRINT("Cache occupancy: %u\n", (unsigned int)num); + zassert_between_inclusive(num, MIN_CACHE_OCCUPANCY, CONFIG_ZMS_LOOKUP_CACHE_SIZE, + "too low cache occupancy - poor hash quality"); + + err = zms_clear(&fixture->fs); + zassert_true(err == 0, "zms_clear call failure: %d", err); + + err = zms_mount(&fixture->fs); + zassert_true(err == 0, "zms_mount call failure: %d", err); + + /* Write CONFIG_ZMS_LOOKUP_CACHE_SIZE ZMS IDs that form the following series: 0, 4, 8... */ + + for (uint16_t i = 0; i < CONFIG_ZMS_LOOKUP_CACHE_SIZE; i++) { + id = i * 4; + data = 0; + + err = zms_write(&fixture->fs, id, &data, sizeof(data)); + zassert_equal(err, sizeof(data), "zms_write call failure: %d", err); + } + + /* Verify that at least 60% cache entries are occupied */ + + num = num_occupied_cache_entries(&fixture->fs); + TC_PRINT("Cache occupancy: %u\n", (unsigned int)num); + zassert_between_inclusive(num, MIN_CACHE_OCCUPANCY, CONFIG_ZMS_LOOKUP_CACHE_SIZE, + "too low cache occupancy - poor hash quality"); + +#endif +} diff --git a/tests/subsys/fs/zms/testcase.yaml b/tests/subsys/fs/zms/testcase.yaml new file mode 100644 index 0000000000000..bdee4529f2af8 --- /dev/null +++ b/tests/subsys/fs/zms/testcase.yaml @@ -0,0 +1,28 @@ +common: + tags: zms +tests: + filesystem.zms: + platform_allow: + - qemu_x86 + filesystem.zms.0x00: + extra_args: DTC_OVERLAY_FILE=boards/qemu_x86_ev_0x00.overlay + platform_allow: qemu_x86 + filesystem.zms.sim.no_erase: + extra_args: CONFIG_FLASH_SIMULATOR_EXPLICIT_ERASE=n + platform_allow: qemu_x86 + filesystem.zms.sim.corrupt_close: + extra_args: + - CONFIG_FLASH_SIMULATOR_EXPLICIT_ERASE=y + - CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y + platform_allow: qemu_x86 + filesystem.zms.cache: + extra_args: + - CONFIG_ZMS_LOOKUP_CACHE=y + - CONFIG_ZMS_LOOKUP_CACHE_SIZE=64 + platform_allow: native_sim + filesystem.zms.data_crc: + extra_args: + - CONFIG_ZMS_DATA_CRC=y + platform_allow: + - native_sim + - qemu_x86 From fb7dae77ef937c008d9b62e062a515160703eb33 Mon Sep 17 00:00:00 2001 From: Riadh Ghaddab Date: Sat, 28 Sep 2024 07:24:33 +0200 Subject: [PATCH 1662/4482] samples: fs: zms: add a sample app for ZMS storage system This adds a user application that shows the usage of ZMS The sample app shows three main functions of ZMS: - read/write/delete key/value pairs - fill all storage and delete it - calculate free remaining space Signed-off-by: Riadh Ghaddab --- samples/subsys/fs/zms/CMakeLists.txt | 10 + samples/subsys/fs/zms/README.rst | 96 ++++++++++ samples/subsys/fs/zms/prj.conf | 5 + samples/subsys/fs/zms/sample.yaml | 10 + samples/subsys/fs/zms/src/main.c | 267 +++++++++++++++++++++++++++ 5 files changed, 388 insertions(+) create mode 100644 samples/subsys/fs/zms/CMakeLists.txt create mode 100644 samples/subsys/fs/zms/README.rst create mode 100644 samples/subsys/fs/zms/prj.conf create mode 100644 samples/subsys/fs/zms/sample.yaml create mode 100644 samples/subsys/fs/zms/src/main.c diff --git a/samples/subsys/fs/zms/CMakeLists.txt b/samples/subsys/fs/zms/CMakeLists.txt new file mode 100644 index 0000000000000..33644e1d90360 --- /dev/null +++ b/samples/subsys/fs/zms/CMakeLists.txt @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(zms) + + +target_sources(app PRIVATE src/main.c) +target_include_directories(app PRIVATE ${ZEPHYR_BASE}/subsys/fs/zms) diff --git a/samples/subsys/fs/zms/README.rst b/samples/subsys/fs/zms/README.rst new file mode 100644 index 0000000000000..f05d1fa0838f2 --- /dev/null +++ b/samples/subsys/fs/zms/README.rst @@ -0,0 +1,96 @@ +.. zephyr:code-sample:: zms + :name: Zephyr Memory Storage (ZMS) + :relevant-api: zms_high_level_api + + Store and retrieve data from storage using the ZMS API. + +Overview +******** + The sample shows how to use ZMS to store ID/VALUE pairs and reads them back. + Deleting an ID/VALUE pair is also shown in this sample. + + The sample stores the following items: + + #. A string representing an IP address: stored at id=1, data="192.168.1.1" + #. A binary blob representing a key/value pair: stored at id=0xbeefdead, + data={0xDE, 0xAD, 0xBE, 0xEF, 0xDE, 0xAD, 0xBE, 0xEF} + #. A variable (32bit): stored at id=2, data=cnt + #. A long set of data (128 bytes) + + A loop is executed where we mount the storage system, and then write all set + of data. + + Each DELETE_ITERATION period, we delete all set of data and verify that it has been deleted. + We generate as well incremented ID/value pairs, we store them until storage is full, then we + delete them and verify that storage is empty. + +Requirements +************ + +* A board with flash support or native_sim target + +Building and Running +******************** + +This sample can be found under :zephyr_file:`samples/subsys/fs/zms` in the Zephyr tree. + +The sample can be built for several platforms, but for the moment it has been tested only +on native_sim target + +.. zephyr-app-commands:: + :zephyr-app: samples/subsys/fs/zms + :goals: build + :compact: + +After running the generated image on a native_sim target, the output on the console shows the +multiple Iterations of read/write/delete exectuted. + +Sample Output +============= + +.. code-block:: console + + *** Booting Zephyr OS build v3.7.0-2383-g624f75400242 *** + [00:00:00.000,000] fs_zms: 3 Sectors of 4096 bytes + [00:00:00.000,000] fs_zms: alloc wra: 0, fc0 + [00:00:00.000,000] fs_zms: data wra: 0, 0 + ITERATION: 0 + Adding IP_ADDRESS 172.16.254.1 at id 1 + Adding key/value at id beefdead + Adding counter at id 2 + Adding Longarray at id 3 + [00:00:00.000,000] fs_zms: 3 Sectors of 4096 bytes + [00:00:00.000,000] fs_zms: alloc wra: 0, f80 + [00:00:00.000,000] fs_zms: data wra: 0, 8c + ITERATION: 1 + ID: 1, IP Address: 172.16.254.1 + Adding IP_ADDRESS 172.16.254.1 at id 1 + Id: beefdead, Key: de ad be ef de ad be ef + Adding key/value at id beefdead + Id: 2, loop_cnt: 0 + Adding counter at id 2 + Id: 3, Longarray: 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 5 + 4 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f + Adding Longarray at id 3 + . + . + . + . + . + . + [00:00:00.000,000] fs_zms: 3 Sectors of 4096 bytes + [00:00:00.000,000] fs_zms: alloc wra: 0, f40 + [00:00:00.000,000] fs_zms: data wra: 0, 80 + ITERATION: 299 + ID: 1, IP Address: 172.16.254.1 + Adding IP_ADDRESS 172.16.254.1 at id 1 + Id: beefdead, Key: de ad be ef de ad be ef + Adding key/value at id beefdead + Id: 2, loop_cnt: 298 + Adding counter at id 2 + Id: 3, Longarray: 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 5 + 4 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f + Adding Longarray at id 3 + Memory is full let's delete all items + Free space in storage is 8064 bytes + Sample code finished Successfully diff --git a/samples/subsys/fs/zms/prj.conf b/samples/subsys/fs/zms/prj.conf new file mode 100644 index 0000000000000..343c5021899e8 --- /dev/null +++ b/samples/subsys/fs/zms/prj.conf @@ -0,0 +1,5 @@ +CONFIG_FLASH=y +CONFIG_FLASH_MAP=y + +CONFIG_ZMS=y +CONFIG_LOG=y diff --git a/samples/subsys/fs/zms/sample.yaml b/samples/subsys/fs/zms/sample.yaml new file mode 100644 index 0000000000000..802dabcf0f118 --- /dev/null +++ b/samples/subsys/fs/zms/sample.yaml @@ -0,0 +1,10 @@ +sample: + name: ZMS Sample + +tests: + sample.zms.basic: + tags: zms + depends_on: zms + platform_allow: + - qemu_x86 + - native_posix diff --git a/samples/subsys/fs/zms/src/main.c b/samples/subsys/fs/zms/src/main.c new file mode 100644 index 0000000000000..a2166392724c9 --- /dev/null +++ b/samples/subsys/fs/zms/src/main.c @@ -0,0 +1,267 @@ +/* + * Copyright (c) 2024 BayLibre SAS + * + * SPDX-License-Identifier: Apache-2.0 + * + * ZMS Sample for Zephyr using high level API. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +static struct zms_fs fs; + +#define ZMS_PARTITION storage_partition +#define ZMS_PARTITION_DEVICE FIXED_PARTITION_DEVICE(ZMS_PARTITION) +#define ZMS_PARTITION_OFFSET FIXED_PARTITION_OFFSET(ZMS_PARTITION) + +#define IP_ADDRESS_ID 1 +#define KEY_VALUE_ID 0xbeefdead +#define CNT_ID 2 +#define LONG_DATA_ID 3 + +#define MAX_ITERATIONS 300 +#define DELETE_ITERATION 10 + +static int delete_and_verify_items(struct zms_fs *fs, uint32_t id) +{ + int rc = 0; + + rc = zms_delete(fs, id); + if (rc) { + goto error1; + } + rc = zms_get_data_length(fs, id); + if (rc > 0) { + goto error2; + } + + return 0; +error1: + printk("Error while deleting item rc=%d\n", rc); + return rc; +error2: + printk("Error, Delete failed item should not be present\n"); + return -1; +} + +static int delete_basic_items(struct zms_fs *fs) +{ + int rc = 0; + + rc = delete_and_verify_items(fs, IP_ADDRESS_ID); + if (rc) { + printk("Error while deleting item %x rc=%d\n", IP_ADDRESS_ID, rc); + return rc; + } + rc = delete_and_verify_items(fs, KEY_VALUE_ID); + if (rc) { + printk("Error while deleting item %x rc=%d\n", KEY_VALUE_ID, rc); + return rc; + } + rc = delete_and_verify_items(fs, CNT_ID); + if (rc) { + printk("Error while deleting item %x rc=%d\n", CNT_ID, rc); + return rc; + } + rc = delete_and_verify_items(fs, LONG_DATA_ID); + if (rc) { + printk("Error while deleting item %x rc=%d\n", LONG_DATA_ID, rc); + } + + return rc; +} + +int main(void) +{ + int rc = 0; + char buf[16]; + uint8_t key[8] = {0xDE, 0xAD, 0xBE, 0xEF, 0xDE, 0xAD, 0xBE, 0xEF}, longarray[128]; + uint32_t i_cnt = 0U, i; + uint32_t id = 0; + ssize_t free_space = 0; + struct flash_pages_info info; + + for (int n = 0; n < sizeof(longarray); n++) { + longarray[n] = n; + } + + /* define the zms file system by settings with: + * sector_size equal to the pagesize, + * 3 sectors + * starting at ZMS_PARTITION_OFFSET + */ + fs.flash_device = ZMS_PARTITION_DEVICE; + if (!device_is_ready(fs.flash_device)) { + printk("Storage device %s is not ready\n", fs.flash_device->name); + return 0; + } + fs.offset = ZMS_PARTITION_OFFSET; + rc = flash_get_page_info_by_offs(fs.flash_device, fs.offset, &info); + if (rc) { + printk("Unable to get page info, rc=%d\n", rc); + return 0; + } + fs.sector_size = info.size; + fs.sector_count = 3U; + + for (i = 0; i < MAX_ITERATIONS; i++) { + rc = zms_mount(&fs); + if (rc) { + printk("Storage Init failed, rc=%d\n", rc); + return 0; + } + + printk("ITERATION: %u\n", i); + /* IP_ADDRESS_ID is used to store an address, lets see if we can + * read it from flash, since we don't know the size read the + * maximum possible + */ + rc = zms_read(&fs, IP_ADDRESS_ID, &buf, sizeof(buf)); + if (rc > 0) { + /* item was found, show it */ + buf[rc] = '\0'; + printk("ID: %u, IP Address: %s\n", IP_ADDRESS_ID, buf); + } + /* Rewriting ADDRESS IP even if we found it */ + strncpy(buf, "172.16.254.1", sizeof(buf) - 1); + printk("Adding IP_ADDRESS %s at id %u\n", buf, IP_ADDRESS_ID); + rc = zms_write(&fs, IP_ADDRESS_ID, &buf, strlen(buf)); + if (rc < 0) { + printk("Error while writing Entry rc=%d\n", rc); + break; + } + + /* KEY_VALUE_ID is used to store a key/value pair , lets see if we can read + * it from storage. + */ + rc = zms_read(&fs, KEY_VALUE_ID, &key, sizeof(key)); + if (rc > 0) { /* item was found, show it */ + printk("Id: %x, Key: ", KEY_VALUE_ID); + for (int n = 0; n < 8; n++) { + printk("%x ", key[n]); + } + printk("\n"); + } + /* Rewriting KEY_VALUE even if we found it */ + printk("Adding key/value at id %x\n", KEY_VALUE_ID); + rc = zms_write(&fs, KEY_VALUE_ID, &key, sizeof(key)); + if (rc < 0) { + printk("Error while writing Entry rc=%d\n", rc); + break; + } + + /* CNT_ID is used to store the loop counter, lets see + * if we can read it from storage + */ + rc = zms_read(&fs, CNT_ID, &i_cnt, sizeof(i_cnt)); + if (rc > 0) { /* item was found, show it */ + printk("Id: %d, loop_cnt: %u\n", CNT_ID, i_cnt); + if (i_cnt != (i - 1)) { + break; + } + } + printk("Adding counter at id %u\n", CNT_ID); + rc = zms_write(&fs, CNT_ID, &i, sizeof(i)); + if (rc < 0) { + printk("Error while writing Entry rc=%d\n", rc); + break; + } + + /* LONG_DATA_ID is used to store a larger dataset ,lets see if we can read + * it from flash + */ + rc = zms_read(&fs, LONG_DATA_ID, &longarray, sizeof(longarray)); + if (rc > 0) { + /* item was found, show it */ + printk("Id: %d, Longarray: ", LONG_DATA_ID); + for (int n = 0; n < sizeof(longarray); n++) { + printk("%x ", longarray[n]); + } + printk("\n"); + } + /* Rewrite the entry even if we found it */ + printk("Adding Longarray at id %d\n", LONG_DATA_ID); + rc = zms_write(&fs, LONG_DATA_ID, &longarray, sizeof(longarray)); + if (rc < 0) { + printk("Error while writing Entry rc=%d\n", rc); + break; + } + + /* Each DELETE_ITERATION delete all basic items */ + if (!(i % DELETE_ITERATION) && (i)) { + rc = delete_basic_items(&fs); + if (rc) { + break; + } + } + } + + if (i != MAX_ITERATIONS) { + printk("Error: Something went wrong at iteration %u rc=%d\n", i - 1, rc); + return 0; + } + + while (1) { + /* fill all storage */ + rc = zms_write(&fs, id, &id, sizeof(uint32_t)); + if (rc < 0) { + break; + } + id++; + } + + if (rc == -ENOSPC) { + /* Calculate free space and verify that it is 0 */ + free_space = zms_calc_free_space(&fs); + if (free_space < 0) { + printk("Error while computing free space, rc=%d\n", free_space); + return 0; + } + if (free_space > 0) { + printk("Error: free_space should be 0, computed %u\n", free_space); + return 0; + } + printk("Memory is full let's delete all items\n"); + + /* Now delete all previously written items */ + for (uint32_t n = 0; n < id; n++) { + rc = delete_and_verify_items(&fs, n); + if (rc) { + printk("Error deleting at id %u\n", n); + return 0; + } + } + rc = delete_basic_items(&fs); + if (rc) { + printk("Error deleting basic items\n"); + return 0; + } + } + + /* + * Let's compute free space in storage. But before doing that let's Garbage collect + * all sectors where we deleted all entries and then compute the free space + */ + for (uint32_t i = 0; i < fs.sector_count; i++) { + rc = zms_sector_use_next(&fs); + if (rc) { + printk("Error while changing sector rc=%d\n", rc); + } + } + free_space = zms_calc_free_space(&fs); + if (free_space < 0) { + printk("Error while computing free space, rc=%d\n", free_space); + return 0; + } + printk("Free space in storage is %u bytes\n", free_space); + printk("Sample code finished Successfully\n"); + + return 0; +} From 3c4fcaa2c0e2c525d416ae248574a2fb505eff7b Mon Sep 17 00:00:00 2001 From: Riadh Ghaddab Date: Wed, 9 Oct 2024 04:08:22 +0200 Subject: [PATCH 1663/4482] doc: zms: add documentation for ZMS This adds the documentation for the Zephyr Memory Storage system. Signed-off-by: Riadh Ghaddab --- doc/services/storage/index.rst | 1 + doc/services/storage/zms/zms.rst | 432 +++++++++++++++++++++++++++++++ 2 files changed, 433 insertions(+) create mode 100644 doc/services/storage/zms/zms.rst diff --git a/doc/services/storage/index.rst b/doc/services/storage/index.rst index 8d3dd3da50c2b..f6e069ecf2ab1 100644 --- a/doc/services/storage/index.rst +++ b/doc/services/storage/index.rst @@ -7,6 +7,7 @@ Storage :maxdepth: 1 nvs/nvs.rst + zms/zms.rst disk/access.rst flash_map/flash_map.rst fcb/fcb.rst diff --git a/doc/services/storage/zms/zms.rst b/doc/services/storage/zms/zms.rst new file mode 100644 index 0000000000000..d1125e0505d24 --- /dev/null +++ b/doc/services/storage/zms/zms.rst @@ -0,0 +1,432 @@ +.. _zms_api: + +Zephyr Memory Storage (ZMS) +########################### +Zephyr Memory Storage is a new key-value storage system that is designed to work with all types +of non-volatile storage technologies. It supports classical on-chip NOR flash as well as new +technologies like RRAM and MRAM that do not require a separate erase operation at all, that is, +data on these types of devices can be overwritten directly at any time. + +General behavior +**************** +ZMS divides the memory space into sectors (minimum 2), and each sector is filled with key-value +pairs until it is full. + +The key-value pair is divided into two parts: + +- The key part is written in an ATE (Allocation Table Entry) called "ID-ATE" which is stored + starting from the bottom of the sector +- The value part is defined as "DATA" and is stored raw starting from the top of the sector + +Additionally, for each sector we store at the last positions Header-ATEs which are ATEs that +are needed for the sector to describe its status (closed, open) and the current version of ZMS. + +When the current sector is full we verify first that the following sector is empty, we garbage +collect the N+2 sector (where N is the current sector number) by moving the valid ATEs to the +N+1 empty sector, we erase the garbage collected sector and then we close the current sector by +writing a garbage_collect_done ATE and the close ATE (one of the header entries). +Afterwards we move forward to the next sector and start writing entries again. + +This behavior is repeated until it reaches the end of the partition. Then it starts again from +the first sector after garbage collecting it and erasing its content. + +Composition of a sector +======================= +A sector is organized in this form (example with 3 sectors): + +.. list-table:: + :widths: 25 25 25 + :header-rows: 1 + + * - Sector 0 (closed) + - Sector 1 (open) + - Sector 2 (empty) + * - Data_a0 + - Data_b0 + - Data_c0 + * - Data_a1 + - Data_b1 + - Data_c1 + * - Data_a2 + - Data_b2 + - Data_c2 + * - GC_done + - . + - . + * - . + - . + - . + * - . + - . + - . + * - . + - ATE_b2 + - ATE_c2 + * - ATE_a2 + - ATE_b1 + - ATE_c1 + * - ATE_a1 + - ATE_b0 + - ATE_c0 + * - ATE_a0 + - GC_done + - GC_done + * - Close (cyc=1) + - Close (cyc=1) + - Close (cyc=1) + * - Empty (cyc=1) + - Empty (cyc=2) + - Empty (cyc=2) + +Definition of each element in the sector +======================================== + +``Empty ATE:`` is written when erasing a sector (last position of the sector). + +``Close ATE:`` is written when closing a sector (second to last position of the sector). + +``GC_done ATE:`` is written to indicate that the next sector has been already garbage +collected. This ATE could be in any position of the sector. + +``ID-ATE:`` are entries that contain a 32 bits Key and describe where the data is stored, its +size and its crc32 + +``Data:`` is the actual value associated to the ID-ATE + +How does ZMS work? +****************** + +Mounting the Storage system +=========================== + +Mounting the storage starts by getting the flash parameters, checking that the file system +properties are correct (sector_size, sector_count ...) then calling the zms_init function to +make the storage ready. + +To mount the filesystem some elements in the zms_fs structure must be initialized. + +.. code-block:: c + + struct zms_fs { + /** File system offset in flash **/ + off_t offset; + + /** Storage system is split into sectors, each sector size must be multiple of + * erase-blocks if the device has erase capabilities + */ + uint32_t sector_size; + /** Number of sectors in the file system */ + uint32_t sector_count; + + /** Flash device runtime structure */ + const struct device *flash_device; + }; + +Initialization +============== + +As ZMS has a fast-forward write mechanism, we must find the last sector and the last pointer of +the entry where it stopped the last time. +It must look for a closed sector followed by an open one, then within the open sector, it finds +(recover) the last written ATE (Allocation Table Entry). +After that, it checks that the sector after this one is empty, or it will erase it. + +ZMS ID-Data write +=================== + +To avoid rewriting the same data with the same ID again, it must look in all the sectors if the +same ID exist then compares its data, if the data is identical no write is performed. +If we must perform a write, then an ATE and Data (if not a delete) are written in the sector. +If the sector is full (cannot hold the current data + ATE) we have to move to the next sector, +garbage collect the sector after the newly opened one then erase it. +Data size that is smaller or equal to 8 bytes are written within the ATE. + +ZMS ID/data read (with history) +=============================== + +By default it looks for the last data with the same ID by browsing through all stored ATEs from +the most recent ones to the oldest ones. If it finds a valid ATE with a matching ID it retrieves +its data and returns the number of bytes that were read. +If history count is provided that is different than 0, older data with same ID is retrieved. + +ZMS free space calculation +========================== + +ZMS can also return the free space remaining in the partition. +However, this operation is very time consuming and needs to browse all valid ATEs in all sectors +of the partition and for each valid ATE try to find if an older one exist. +It is not recommended for application to use this function often, as it is time consuming and +could slow down the calling thread. + +The cycle counter +================= + +Each sector has a lead cycle counter which is a uin8_t that is used to validate all the other +ATEs. +The lead cycle counter is stored in the empty ATE. +To become valid, an ATE must have the same cycle counter as the one stored in the empty ATE. +Each time an ATE is moved from a sector to another it must get the cycle counter of the +destination sector. +To erase a sector, the cycle counter of the empty ATE is incremented and a single write of the +empty ATE is done. +All the ATEs in that sector become invalid. + +Closing sectors +=============== + +To close a sector a close ATE is added at the end of the sector and it must have the same cycle +counter as the empty ATE. +When closing a sector, all the remaining space that has not been used is filled with garbage data +to avoid having old ATEs with a valid cycle counter. + +Triggering Garbage collection +============================= + +Some applications need to make sure that storage writes have a maximum defined latency. +When calling a ZMS write, the current sector could be almost full and we need to trigger the GC +to switch to the next sector. +This operation is time consuming and it will cause some applications to not meet their real time +constraints. +ZMS adds an API for the application to get the current remaining free space in a sector. +The application could then decide when needed to switch to the next sector if the current one is +almost full and of course it will trigger the garbage collection on the next sector. +This will guarantee the application that the next write won't trigger the garbage collection. + +ATE (Allocation Table Entry) structure +====================================== + +An entry has 16 bytes divided between these variables : + +.. code-block:: c + + struct zms_ate { + uint8_t crc8; /* crc8 check of the entry */ + uint8_t cycle_cnt; /* cycle counter for non erasable devices */ + uint32_t id; /* data id */ + uint16_t len; /* data len within sector */ + union { + uint8_t data[8]; /* used to store small size data */ + struct { + uint32_t offset; /* data offset within sector */ + union { + uint32_t data_crc; /* crc for data */ + uint32_t metadata; /* Used to store metadata information + * such as storage version. + */ + }; + }; + }; + } __packed; + +.. note:: The data CRC is checked only when the whole data of the element is read. + The data CRC is not checked for a partial read, as it is computed for the complete set of data. + +.. note:: Enabling the data CRC feature on a previously existing ZMS content without + data CRC will make all existing data invalid. + +.. _free-space: + +Available space for user data (key-value pairs) +*********************************************** + +For both scenarios ZMS should have always an empty sector to be able to perform the garbage +collection. +So if we suppose that 4 sectors exist in a partition, ZMS will only use 3 sectors to store +Key-value pairs and keep always one (rotating sector) empty to be able to launch GC. + +.. note:: The maximum single data length that could be written at once in a sector is 64K + (This could change in future versions of ZMS) + +Small data values +================= + +For small data values (<= 8 bytes), the data is stored within the entry (ATE) itself and no data +is written at the top of the sector. +ZMS has an entry size of 16 bytes which means that the maximum available space in a partition to +store data is computed in this scenario as : + +.. math:: + + \small\frac{(NUM\_SECTORS - 1) \times (SECTOR\_SIZE - (5 \times ATE\_SIZE))}{2} + +Where: + +``NUM_SECTOR:`` Total number of sectors + +``SECTOR_SIZE:`` Size of the sector + +``ATE_SIZE:`` 16 bytes + +``(5 * ATE_SIZE):`` Reserved ATEs for header and delete items + +For example for 4 sectors of 1024 bytes, free space for data is :math:`\frac{3 \times 944}{2} = 1416 \, \text{ bytes}`. + +Large data values +================= + +Large data values ( > 8 bytes) are stored separately at the top of the sector. +In this case it is hard to estimate the free available space as this depends on the size of +the data. But we can take into account that for N bytes of data (N > 8 bytes) an additional +16 bytes of ATE must be added at the bottom of the sector. + +Let's take an example: + +For a partition that has 4 sectors of 1024 bytes and for data size of 64 bytes. +Only 3 sectors are available for writes with a capacity of 944 bytes each. +Each Key-value pair needs an extra 16 bytes for ATE which makes it possible to store 11 pairs +in each sectors (:math:`\frac{944}{80}`). +Total data that could be stored in this partition for this case is :math:`11 \times 3 \times 64 = 2112 \text{ bytes}` + +.. _wear-leveling: + +Wear leveling +************* + +This storage system is optimized for devices that do not require an erase. +Using storage systems that rely on an erase-value (NVS as an example) will need to emulate the +erase with write operations. This will cause a significant decrease in the life expectancy of +these devices and will cause more delays for write operations and for initialization. +ZMS introduces a cycle count mechanism that avoids emulating erase operation for these devices. +It also guarantees that every memory location is written only once for each cycle of sector write. + +As an example, to erase a 4096 bytes sector on a non erasable device using NVS, 256 flash writes +must be performed (supposing that write-block-size=16 bytes), while using ZMS only 1 write of +16 bytes is needed. This operation is 256 times faster in this case. + +Garbage collection operation is also adding some writes to the memory cell life expectancy as it +is moving some blocks from one sector to another. +To make the garbage collector not affect the life expectancy of the device it is recommended +to dimension correctly the partition size. Its size should be the double of the maximum size of +data (including extra headers) that could be written in the storage. + +See :ref:`free-space`. + +Device lifetime calculation +=========================== + +Storage devices whether they are classical Flash or new technologies like RRAM/MRAM has a limited +life expectancy which is determined by the number of times memory cells can be erased/written. +Flash devices are erased one page at a time as part of their functional behavior (otherwise +memory cells cannot be overwritten) and for non erasable storage devices memory cells can be +overwritten directly. + +A typical scenario is shown here to calculate the life expectancy of a device. +Let's suppose that we store an 8 bytes variable using the same ID but its content changes every +minute. The partition has 4 sectors with 1024 bytes each. +Each write of the variable requires 16 bytes of storage. +As we have 944 bytes available for ATEs for each sector, and because ZMS is a fast-forward +storage system, we are going to rewrite the first location of the first sector after +:math:`\frac{(944 \times 4)}{16} = 236 \text{ minutes}`. + +In addition to the normal writes, garbage collector will move the still valid data from old +sectors to new ones. +As we are using the same ID and a big partition size, no data will be moved by the garbage +collector in this case. +For storage devices that could be written 20000 times, the storage will last about +4.720.000 minutes (~9 years). + +To make a more general formula we must first compute the effective used size in ZMS by our +typical set of data. +For id/data pair with data <= 8 bytes, effective_size is 16 bytes +For id/data pair with data > 8 bytes, effective_size is 16 bytes + sizeof(data) +Let's suppose that total_effective_size is the total size of the set of data that is written in +the storage and that the partition is well dimensioned (double of the effective size) to avoid +having the garbage collector moving blocks all the time. + +The expected life of the device in minutes is computed as : + +.. math:: + + \small\frac{(SECTOR\_EFFECTIVE\_SIZE \times SECTOR\_NUMBER \times MAX\_NUM\_WRITES)}{(TOTAL\_EFFECTIVE\_SIZE \times WR\_MIN)} + +Where: + +``SECTOR_EFFECTIVE_SIZE``: is the size sector - header_size(80 bytes) + +``SECTOR_NUMBER``: is the number of sectors + +``MAX_NUM_WRITES``: is the life expectancy of the storage device in number of writes + +``TOTAL_EFFECTIVE_SIZE``: Total effective size of the set of written data + +``WR_MIN``: Number of writes of the set of data per minute + +Features +******** +ZMS has introduced many features compared to existing storage system like NVS and will evolve +from its initial version to include more features that satisfies new technologies requirements +such as low latency and bigger storage space. + +Existing features +================= +Version1 +-------- +- Supports non erasable devices (only one write operation to erase a sector) +- Supports large partition size and sector size (64 bits address space) +- Supports large IDs width (32 bits) to store ID/Value pairs +- Small sized data ( <= 8 bytes) are stored in the ATE itself +- Built-in Data CRC32 (included in the ATE) +- Versionning of ZMS (to handle future evolution) +- Supports large write-block-size (Only for platforms that need this) + +Future features +=============== + +- Add multiple format ATE support to be able to use ZMS with different ATE formats that satisfies + requirements from application +- Add the possibility to skip garbage collector for some application usage where ID/value pairs + are written periodically and do not exceed half of the partition size (ther is always an old + entry with the same ID). +- Divide IDs into namespaces and allocate IDs on demand from application to handle collisions + between IDs used by different subsystems or samples. +- Add the possibility to retrieve the wear out value of the device based on the cycle count value +- Add a recovery function that can recover a storage partition if something went wrong +- Add a library/application to allow migration from NVS entries to ZMS entries +- Add the possibility to force formatting the storage partition to the ZMS format if something + went wrong when mounting the storage. + +ZMS and other storage systems in Zephyr +======================================= +This section describes ZMS in the wider context of storage systems in Zephyr (not full filesystems, +but simpler, non-hierarchical ones). +Today Zephyr includes at least two other systems that are somewhat comparable in scope and +functionality: :ref:`NVS ` and :ref:`FCB `. +Which one to use in your application will depend on your needs and the hardware you are using, +and this section provides information to help make a choice. + +- If you are using a non erasable technology device like RRAM or MRAM, :ref:`ZMS ` is definitely the + best fit for your storage subsystem as it is designed very well to avoid emulating erase for + these devices and replace it by a single write call. +- For devices with large write_block_size and/or needs a sector size that is different than the + classical flash page size (equal to erase_block_size), :ref:`ZMS ` is also the best fit as there is + the possibility to customize these parameters and add the support of these devices in ZMS. +- For classical flash technology devices, :ref:`NVS ` is recommended as it has low footprint (smaller + ATEs and smaller header ATEs). Erasing flash in NVS is also very fast and do not require an + additional write operation compared to ZMS. + For these devices, NVS reads/writes will be faster as well than ZMS as it has smaller ATE size. +- If your application needs more than 64K IDs for storage, :ref:`ZMS ` is recommended here as it + has a 32-bit ID field. +- If your application is working in a FIFO mode (First-in First-out) then :ref:`FCB ` is + the best storage solution for this use case. + +More generally to make the right choice between NVS and ZMS, all the blockers should be first +verified to make sure that the application could work with one subsystem or the other, then if +both solutions could be implemented, the best choice should be based on the calculations of the +life expectancy of the device described in this section: :ref:`wear-leveling`. + +Sample +****** + +A sample of how ZMS can be used is supplied in :zephyr:code-sample:`zms`. + +API Reference +************* + +The ZMS subsystem APIs are provided by ``zms.h``: + +.. doxygengroup:: zms_data_structures + +.. doxygengroup:: zms_high_level_api + +.. comment + not documenting .. doxygengroup:: zms From 6ffbb8c72878c3f3f605f13455b28e23d8d36de0 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 21 Oct 2024 13:42:20 +0200 Subject: [PATCH 1664/4482] native_simulator: Get latest from upstream Align with native_simulator's upstream main 51b27b67addd0073dc86e3d83f492c5cac5c3361 Which includes: * 51b27b nsi_utils: Add macro for weak declarations Signed-off-by: Alberto Escolar Piedras --- scripts/native_simulator/common/src/include/nsi_utils.h | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/native_simulator/common/src/include/nsi_utils.h b/scripts/native_simulator/common/src/include/nsi_utils.h index 997eac30005d5..43d171a8e896f 100644 --- a/scripts/native_simulator/common/src/include/nsi_utils.h +++ b/scripts/native_simulator/common/src/include/nsi_utils.h @@ -28,6 +28,7 @@ #define NSI_CODE_UNREACHABLE __builtin_unreachable() #define NSI_FUNC_NORETURN __attribute__((__noreturn__)) +#define NSI_WEAK __attribute__((__weak__)) #if defined(__clang__) /* The address sanitizer in llvm adds padding (redzones) after data From 15a7819a9bab2682efcb6aad320e374aa4693d66 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 21 Oct 2024 14:25:34 +0200 Subject: [PATCH 1665/4482] manifest: Update nRF hw models to latest Update the HW models module to: aca798cf7cf0c5dc1fd89c66cf62670051feb8d0 Including the following: * aca798c IRQ controller: Add missing prototype * 4f108bc IRQ controller: Add API to check if int is pending * a514448 MDK: provide replacement for SystemCoreClock* Signed-off-by: Alberto Escolar Piedras --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 09810b9d1dbeb..0108755946f9e 100644 --- a/west.yml +++ b/west.yml @@ -300,7 +300,7 @@ manifest: groups: - tools - name: nrf_hw_models - revision: eeed2591d38e5e9bf89658df67555f2777249fc0 + revision: aca798cf7cf0c5dc1fd89c66cf62670051feb8d0 path: modules/bsim_hw_models/nrf_hw_models - name: open-amp revision: b735edbc739ad59156eb55bb8ce2583d74537719 From c4e6ec89a7db966a5d36fd70d3aa8cfb7a78e6a1 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 21 Oct 2024 14:27:59 +0200 Subject: [PATCH 1666/4482] boards nrf_bsim: Provide IRQ_PRIO_LOWEST Some apps use it, so let's provide it. Signed-off-by: Alberto Escolar Piedras --- boards/native/nrf_bsim/board_irq.h | 1 + 1 file changed, 1 insertion(+) diff --git a/boards/native/nrf_bsim/board_irq.h b/boards/native/nrf_bsim/board_irq.h index e1a385194fbdf..38f359fdf621d 100644 --- a/boards/native/nrf_bsim/board_irq.h +++ b/boards/native/nrf_bsim/board_irq.h @@ -18,6 +18,7 @@ void nrfbsim_WFE_model(void); void nrfbsim_SEV_model(void); #define IRQ_ZERO_LATENCY BIT(1) /* Unused in this board*/ +#define IRQ_PRIO_LOWEST UINT8_MAX #ifdef __cplusplus } From 1c7540883fb3d2c1c80ef416724e75acc260e762 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 21 Oct 2024 15:45:16 +0200 Subject: [PATCH 1667/4482] boards nrf_bsim: Add NVIC_GetPendingIRQ() equivalent Add a substitute for NVIC_GetPendingIRQ() Signed-off-by: Alberto Escolar Piedras --- boards/native/nrf_bsim/common/cmsis/cmsis.c | 5 +++++ boards/native/nrf_bsim/common/cmsis/cmsis.h | 1 + 2 files changed, 6 insertions(+) diff --git a/boards/native/nrf_bsim/common/cmsis/cmsis.c b/boards/native/nrf_bsim/common/cmsis/cmsis.c index e80aea6b4ff60..dac5f82e699e4 100644 --- a/boards/native/nrf_bsim/common/cmsis/cmsis.c +++ b/boards/native/nrf_bsim/common/cmsis/cmsis.c @@ -30,6 +30,11 @@ void NVIC_DisableIRQ(IRQn_Type IRQn) hw_irq_ctrl_disable_irq(CONFIG_NATIVE_SIMULATOR_MCU_N, IRQn); } +uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + return hw_irq_ctrl_is_irq_pending(CONFIG_NATIVE_SIMULATOR_MCU_N, IRQn); +} + void NVIC_EnableIRQ(IRQn_Type IRQn) { hw_irq_ctrl_enable_irq(CONFIG_NATIVE_SIMULATOR_MCU_N, IRQn); diff --git a/boards/native/nrf_bsim/common/cmsis/cmsis.h b/boards/native/nrf_bsim/common/cmsis/cmsis.h index ff9030ca54752..2afc6e9ae50fe 100644 --- a/boards/native/nrf_bsim/common/cmsis/cmsis.h +++ b/boards/native/nrf_bsim/common/cmsis/cmsis.h @@ -30,6 +30,7 @@ void __set_PRIMASK(uint32_t primask); void NVIC_SetPendingIRQ(IRQn_Type IRQn); void NVIC_ClearPendingIRQ(IRQn_Type IRQn); void NVIC_DisableIRQ(IRQn_Type IRQn); +uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn); void NVIC_EnableIRQ(IRQn_Type IRQn); void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority); uint32_t NVIC_GetPriority(IRQn_Type IRQn); From 1e83368d88222ae573fe5ff6ad1b7b8187cee554 Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Thu, 24 Oct 2024 14:10:56 +0000 Subject: [PATCH 1668/4482] tests: drivers: can: api: fix misunderstood use of ESI flag Fix the test for sending frames with the CAN_FRAME_ESI flag set. Sending frames with this flag set in software is never allowed. Fixes: 8023a58c2a463cfcda1ffeaf41b0ea853bba0178 Signed-off-by: Henrik Brix Andersen --- tests/drivers/can/api/src/canfd.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/drivers/can/api/src/canfd.c b/tests/drivers/can/api/src/canfd.c index 50e5d43add844..feb78be24f9f3 100644 --- a/tests/drivers/can/api/src/canfd.c +++ b/tests/drivers/can/api/src/canfd.c @@ -257,22 +257,20 @@ ZTEST(canfd, test_send_fd_dlc_out_of_range) } /** - * @brief Test error when CAN FD Error State Indicator (ESI) is send without FD format flag (FDF). + * @brief Test error when CAN FD Error State Indicator (ESI) is set on transmit frame. * - * CAN FD Error State Indicator (ESI) indicates that the transmitting node is - * in error-passive state. Only valid in combination with CAN_FRAME_FDF. + * CAN FD Error State Indicator (ESI) indicates that the transmitting node is in error-passive + * state, but should never be set explicitly. Setting it is handled in the CAN controller hardware. */ ZTEST(canfd, test_send_fd_incorrect_esi) { struct can_frame frame = { - .flags = CAN_FRAME_ESI, + .flags = CAN_FRAME_FDF | CAN_FRAME_ESI, .id = TEST_CAN_STD_ID_1, .dlc = 0, }; int err; - Z_TEST_SKIP_IFNDEF(CONFIG_RUNTIME_ERROR_CHECKS); - err = can_send(can_dev, &frame, TEST_SEND_TIMEOUT, NULL, NULL); zassert_equal(err, -ENOTSUP, "wrong error on sending invalid frame (err %d)", err); } From 3d4f83aaace5f87c3fdd4af2611ea9bbf3da1560 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 22 Oct 2024 11:27:46 -0500 Subject: [PATCH 1669/4482] drivers: wifi: eswifi: fix casts for 64 bit pointers The eswifi driver uses an integer to identify the socket used for each connection, which must be cast to and from a `void *`. This causes warnings on 64 bit platforms, as precision is lost when casting from a `void *` to `int`. Use a `intptr_t` type to store the socket value to resolve this warning. Also, fix a function signature for the `accept_cb` to use `size_t` instead of `int` for the length Fixes #80242 Signed-off-by: Daniel DeGrasse --- drivers/wifi/eswifi/eswifi_socket_offload.c | 27 +++++++++++---------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/wifi/eswifi/eswifi_socket_offload.c b/drivers/wifi/eswifi/eswifi_socket_offload.c index 8775062e2c4ff..212bef4380ac0 100644 --- a/drivers/wifi/eswifi/eswifi_socket_offload.c +++ b/drivers/wifi/eswifi/eswifi_socket_offload.c @@ -28,7 +28,7 @@ LOG_MODULE_DECLARE(LOG_MODULE_NAME); * a special meaning in the fdtable subsys. */ #define SD_TO_OBJ(sd) ((void *)(sd + 1)) -#define OBJ_TO_SD(obj) (((int)obj) - 1) +#define OBJ_TO_SD(obj) (((intptr_t)obj) - 1) /* Default socket context (50CE) */ #define ESWIFI_INIT_CONTEXT INT_TO_POINTER(0x50CE) @@ -55,7 +55,7 @@ static void __process_received(struct net_context *context, static int eswifi_socket_connect(void *obj, const struct sockaddr *addr, socklen_t addrlen) { - int sock = OBJ_TO_SD(obj); + intptr_t sock = OBJ_TO_SD(obj); struct eswifi_off_socket *socket; int ret; @@ -94,7 +94,7 @@ static int eswifi_socket_connect(void *obj, const struct sockaddr *addr, static int eswifi_socket_listen(void *obj, int backlog) { struct eswifi_off_socket *socket; - int sock = OBJ_TO_SD(obj); + intptr_t sock = OBJ_TO_SD(obj); int ret; eswifi_lock(eswifi); @@ -107,7 +107,7 @@ static int eswifi_socket_listen(void *obj, int backlog) } void __eswifi_socket_accept_cb(struct net_context *context, struct sockaddr *addr, - unsigned int len, int val, void *data) + size_t len, int val, void *data) { struct sockaddr *addr_target = data; @@ -117,7 +117,7 @@ void __eswifi_socket_accept_cb(struct net_context *context, struct sockaddr *add static int __eswifi_socket_accept(void *obj, struct sockaddr *addr, socklen_t *addrlen) { - int sock = OBJ_TO_SD(obj); + intptr_t sock = OBJ_TO_SD(obj); struct eswifi_off_socket *socket; int ret; @@ -146,7 +146,7 @@ static int eswifi_socket_accept(void *obj, struct sockaddr *addr, socklen_t *addrlen) { int fd = zvfs_reserve_fd(); - int sock; + intptr_t sock; if (fd < 0) { return -1; @@ -240,7 +240,7 @@ static int map_credentials(int sd, const void *optval, socklen_t optlen) static int eswifi_socket_setsockopt(void *obj, int level, int optname, const void *optval, socklen_t optlen) { - int sd = OBJ_TO_SD(obj); + intptr_t sd = OBJ_TO_SD(obj); int ret; if (IS_ENABLED(CONFIG_NET_SOCKETS_SOCKOPT_TLS) && level == SOL_TLS) { @@ -265,7 +265,7 @@ static int eswifi_socket_setsockopt(void *obj, int level, int optname, static ssize_t eswifi_socket_send(void *obj, const void *buf, size_t len, int flags) { - int sock = OBJ_TO_SD(obj); + intptr_t sock = OBJ_TO_SD(obj); struct eswifi_off_socket *socket; int ret; int offset; @@ -320,7 +320,7 @@ static ssize_t eswifi_socket_sendto(void *obj, const void *buf, size_t len, static ssize_t eswifi_socket_recv(void *obj, void *buf, size_t max_len, int flags) { - int sock = OBJ_TO_SD(obj); + intptr_t sock = OBJ_TO_SD(obj); struct eswifi_off_socket *socket; int len = 0, ret = 0; struct net_pkt *pkt; @@ -400,7 +400,7 @@ static ssize_t eswifi_socket_recvfrom(void *obj, void *buf, size_t len, static int eswifi_socket_close(void *obj) { - int sock = OBJ_TO_SD(obj); + intptr_t sock = OBJ_TO_SD(obj); struct eswifi_off_socket *socket; struct net_pkt *pkt; int ret; @@ -467,7 +467,8 @@ static int eswifi_socket_poll(struct zsock_pollfd *fds, int nfds, int msecs) { struct eswifi_off_socket *socket; k_timeout_t timeout; - int sock, ret; + intptr_t sock; + int ret; void *obj; if (nfds != 1) { @@ -540,7 +541,7 @@ static int eswifi_socket_poll(struct zsock_pollfd *fds, int nfds, int msecs) static int eswifi_socket_bind(void *obj, const struct sockaddr *addr, socklen_t addrlen) { - int sock = OBJ_TO_SD(obj); + intptr_t sock = OBJ_TO_SD(obj); struct eswifi_off_socket *socket; int ret; @@ -582,7 +583,7 @@ static bool eswifi_socket_is_supported(int family, int type, int proto) int eswifi_socket_create(int family, int type, int proto) { int fd = zvfs_reserve_fd(); - int sock; + intptr_t sock; if (fd < 0) { return -1; From d56e22d425442fdaac61e4455a2c2a874b968319 Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Thu, 24 Oct 2024 16:37:54 +0200 Subject: [PATCH 1670/4482] tests: net: wifi_credentials: restrict to native_sim Adjust the testcase.yaml files to only allow running on native_sim. These tests use mocking and are not meant to run on embedded platforms. Signed-off-by: Maximilian Deubel --- tests/net/lib/wifi_credentials/testcase.yaml | 2 ++ tests/net/lib/wifi_credentials_backend_psa/testcase.yaml | 2 ++ tests/net/lib/wifi_credentials_backend_settings/testcase.yaml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/tests/net/lib/wifi_credentials/testcase.yaml b/tests/net/lib/wifi_credentials/testcase.yaml index 04dfc84af35b2..027009d8d1331 100644 --- a/tests/net/lib/wifi_credentials/testcase.yaml +++ b/tests/net/lib/wifi_credentials/testcase.yaml @@ -2,5 +2,7 @@ tests: net.wifi_credentials: tags: - net + platform_allow: + - native_sim integration_platforms: - native_sim diff --git a/tests/net/lib/wifi_credentials_backend_psa/testcase.yaml b/tests/net/lib/wifi_credentials_backend_psa/testcase.yaml index 2ec5ff4b1d9e8..164fac013a3e7 100644 --- a/tests/net/lib/wifi_credentials_backend_psa/testcase.yaml +++ b/tests/net/lib/wifi_credentials_backend_psa/testcase.yaml @@ -2,5 +2,7 @@ tests: net.wifi_credentials_backend_psa: tags: - net + platform_allow: + - native_sim integration_platforms: - native_sim diff --git a/tests/net/lib/wifi_credentials_backend_settings/testcase.yaml b/tests/net/lib/wifi_credentials_backend_settings/testcase.yaml index 2673831ed53ca..55c3a8591f50d 100644 --- a/tests/net/lib/wifi_credentials_backend_settings/testcase.yaml +++ b/tests/net/lib/wifi_credentials_backend_settings/testcase.yaml @@ -2,5 +2,7 @@ tests: net.wifi_credentials_backend_settings: tags: - net + platform_allow: + - native_sim integration_platforms: - native_sim From 25d9fc118f61c049a58858703ea354a1b833ca6d Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Tue, 22 Oct 2024 20:44:27 +0000 Subject: [PATCH 1671/4482] boards: weact: add USB2CANFDV1 board support Add support for the WeAct Studio USB2CANFDV1, a dedicated USB to CAN FD adapter board. Signed-off-by: Henrik Brix Andersen --- boards/weact/usb2canfdv1/Kconfig.usb2canfdv1 | 5 + boards/weact/usb2canfdv1/board.cmake | 6 + boards/weact/usb2canfdv1/board.yml | 6 + boards/weact/usb2canfdv1/doc/index.rst | 62 ++++++++++ boards/weact/usb2canfdv1/doc/usb2canfdv1.webp | Bin 0 -> 59556 bytes boards/weact/usb2canfdv1/usb2canfdv1.dts | 108 ++++++++++++++++++ boards/weact/usb2canfdv1/usb2canfdv1.yaml | 16 +++ .../weact/usb2canfdv1/usb2canfdv1_defconfig | 2 + 8 files changed, 205 insertions(+) create mode 100644 boards/weact/usb2canfdv1/Kconfig.usb2canfdv1 create mode 100644 boards/weact/usb2canfdv1/board.cmake create mode 100644 boards/weact/usb2canfdv1/board.yml create mode 100644 boards/weact/usb2canfdv1/doc/index.rst create mode 100644 boards/weact/usb2canfdv1/doc/usb2canfdv1.webp create mode 100644 boards/weact/usb2canfdv1/usb2canfdv1.dts create mode 100644 boards/weact/usb2canfdv1/usb2canfdv1.yaml create mode 100644 boards/weact/usb2canfdv1/usb2canfdv1_defconfig diff --git a/boards/weact/usb2canfdv1/Kconfig.usb2canfdv1 b/boards/weact/usb2canfdv1/Kconfig.usb2canfdv1 new file mode 100644 index 0000000000000..76072f6297a44 --- /dev/null +++ b/boards/weact/usb2canfdv1/Kconfig.usb2canfdv1 @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Henrik Brix Andersen +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_USB2CANFDV1 + select SOC_STM32G0B1XX diff --git a/boards/weact/usb2canfdv1/board.cmake b/boards/weact/usb2canfdv1/board.cmake new file mode 100644 index 0000000000000..07c49fc8644e6 --- /dev/null +++ b/boards/weact/usb2canfdv1/board.cmake @@ -0,0 +1,6 @@ +# Copyright (c) 2024 Henrik Brix Andersen +# SPDX-License-Identifier: Apache-2.0 + +board_runner_args(jlink "--device=STM32G0B1CB") + +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/weact/usb2canfdv1/board.yml b/boards/weact/usb2canfdv1/board.yml new file mode 100644 index 0000000000000..4608eaaa2df59 --- /dev/null +++ b/boards/weact/usb2canfdv1/board.yml @@ -0,0 +1,6 @@ +board: + name: usb2canfdv1 + full_name: USB2CANFDV1 + vendor: weact + socs: + - name: stm32g0b1xx diff --git a/boards/weact/usb2canfdv1/doc/index.rst b/boards/weact/usb2canfdv1/doc/index.rst new file mode 100644 index 0000000000000..db07a7b7dd47d --- /dev/null +++ b/boards/weact/usb2canfdv1/doc/index.rst @@ -0,0 +1,62 @@ +.. zephyr:board:: usb2canfdv1 + +Overview +******** + +The WeAct Studio USB2CANFDV1 is a dedicated USB to CAN FD adapter board. More information can be +found on the `USB2CANFDV1 website`_. + +Hardware +******** + +The USB2CANFDV1 is equipped with a STM32G0B1CBT6 microcontroller and features a USB-C connector, a +terminal block for connecting to the CAN bus, and three LEDs. + +Supported Features +================== + +The ``usb2canfdv1`` board configuration supports the following hardware features: + ++-----------+------------+-------------------------------------+ +| Interface | Controller | Driver/Component | ++===========+============+=====================================+ +| NVIC | on-chip | nested vector interrupt controller | ++-----------+------------+-------------------------------------+ +| PINMUX | on-chip | pinmux | ++-----------+------------+-------------------------------------+ +| FLASH | on-chip | flash memory | ++-----------+------------+-------------------------------------+ +| GPIO | on-chip | gpio | ++-----------+------------+-------------------------------------+ +| USB | on-chip | USB | ++-----------+------------+-------------------------------------+ +| FDCAN1 | on-chip | CAN controller | ++-----------+------------+-------------------------------------+ + +The default configuration can be found in the defconfig file: +:zephyr_file:`boards/weact/usb2canfd/usb2canfdv1_defconfig`. + +Other hardware features are not currently supported by the port. + +System Clock +============ + +The STM32G0B1CBT6 PLL is driven by an external crystal oscillator (HSE) running at 16 MHz and +configured to provide a system clock of 60 MHz. This allows generating a FDCAN1 core clock of 80 +MHz. + +Programming and Debugging +************************* + +Build and flash applications as usual (see :ref:`build_an_application` and +:ref:`application_run` for more details). + +Here is an example for the :zephyr:code-sample:`blinky` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: usb2canfdv1 + :goals: flash + +.. _USB2CANFDV1 website: + https://github.com/WeActStudio/WeActStudio.USB2CANFDV1 diff --git a/boards/weact/usb2canfdv1/doc/usb2canfdv1.webp b/boards/weact/usb2canfdv1/doc/usb2canfdv1.webp new file mode 100644 index 0000000000000000000000000000000000000000..a1c4e3e24afc6747d5b081cf39fb721cc932f84c GIT binary patch literal 59556 zcmd>l=Qmt$)b^RtgXmotCFfK^78HJUEAlRXA*AC;YwOS?tFkQfLk=(%r&}6%Ewr+Jc*)NhyXx11sa|$ji5z$k zMFSyudBz%$U5Bc;3}>5N^FI47t2mar7QuRcE5SW-dU|og$tm%zwKb%nzRi{5U~SL| zje`H*H@x~jeYDmym*@S5nBOS)>>T=qN7(nqxi@$e#S4&;@BUurVXuyyo32q{}n-{fz7(yjkENRcb8aPdYH`M2azfq3}kp`Ev$!2f#40LcG3`~UF3 z;_@{M^Z|tC|9SQ9rcGK-Uf4YVQ2FI;!b=Bj`#AGT=^G`FUzYw0B6YUe3EEGpZNyz(JGJF)#kT~niBE^X^1AV#}09et|*Xq5|Vtu6jx9inQ(yyARk*6;N zDf(ZF4yNjtJ@`q^@Tq}6iUa3xw#u(DpaQ7~xR>5ZYeA1Eh3`y)XCV&Ve*NjU2DB}* zfD2ks9~mV^Oi8F>g-@T6$t^=?`JyD3+)^sp(ZXlqL!hdk0aKyZG=IuMX&RhEw3Muq zoHiZ+z}Ny-vLxBaYHHGk4l|4pl-WX$AffQSOU5F$zdLdHmf2dPyB7-=0r_=t4%7{q(=B^W*< zB|U&h7li>-Dp3SlU{M%;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NRTbP%l9ZVAr?Ywzep#kVPfG#*hA8C5RoOeXhYM_Q$yaP7E89 zh}B3H#NrQ?2f_TaBoj<5|7;3EqkkfcM3y6lRuTA@0!n%i9-(_Jc~&*c=i1K)AaBHL zmd+NF*xiXtZx<2M{aj`QP*#xRI^AvZ>k=I>z7x&Fog4BSVK+|p&pM|}mv1I1)!|wO zbs%ek^S06BfVYm zsNm2B17OR0z8ApR_)ySH2nxc=2IR{iBNJ#Q$KjwK_rY&mHwqvK%R_|X!VZ3?#T|I% zwap4;Gjm2XWe=j*ps#ZtFlon1CRV?Zk5e)uGkrsR4ABm@HzV@DT3Wn*n7QsyC#BwI zQMMiX(knaHJW;Y7Qg$vxo$n!Pb1tcn+hTb;*Tyus#QAmL@VS_;Ac(B!Z)UXFME;0Q z?=25aIIX4RWUjIyK+{io2SgLF40qq3O2@Jt^4yRkFZv1D#t@N z!lh|m9ECj%iwf$3C}jpb7EPw5@SkBmTZY4M!B-N||3CiUego&^I}oB00PueRBvu`+ literal 0 HcmV?d00001 diff --git a/boards/weact/usb2canfdv1/usb2canfdv1.dts b/boards/weact/usb2canfdv1/usb2canfdv1.dts new file mode 100644 index 0000000000000..b67f2692e3d33 --- /dev/null +++ b/boards/weact/usb2canfdv1/usb2canfdv1.dts @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2024 Henrik Brix Andersen + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include + +/ { + model = "WeAct USB2CANFDV1 board"; + compatible = "weact,usb2canfdv1"; + + chosen { + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_partition; + zephyr,canbus = &fdcan1; + }; + + aliases { + led0 = &led_ready; + led1 = &led_rxd; + led2 = &led_txd; + mcuboot-led0 = &led_ready; + }; + + leds { + compatible = "gpio-leds"; + led_ready: led_ready { + gpios = <&gpioa 2 GPIO_ACTIVE_LOW>; + label = "LED READY"; + }; + led_rxd: led_rxd { + gpios = <&gpioa 0 GPIO_ACTIVE_LOW>; + label = "LED RXD"; + }; + led_txd: led_txd { + gpios = <&gpioa 1 GPIO_ACTIVE_LOW>; + label = "LED TXD"; + }; + }; +}; + +&clk_hse { + status = "okay"; + clock-frequency = ; +}; + +&clk_hsi48 { + status = "okay"; + crs-usb-sof; +}; + +&pll { + div-m = <1>; + mul-n = <15>; + div-p = <2>; + div-q = <3>; + div-r = <4>; + clocks = <&clk_hse>; + status = "okay"; +}; + +&rcc { + clocks = <&pll>; + clock-frequency = ; + ahb-prescaler = <1>; + apb1-prescaler = <1>; +}; + +zephyr_udc0: &usb { + pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>; + pinctrl-names = "default"; + status = "okay"; +}; + +&fdcan1 { + clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00001000>, + <&rcc STM32_SRC_PLL_Q FDCAN_SEL(1)>; + pinctrl-0 = <&fdcan1_rx_pb8 &fdcan1_tx_pb9>; + pinctrl-names = "default"; + status = "okay"; + + can-transceiver { + max-bitrate = <5000000>; + }; +}; + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 DT_SIZE_K(48)>; + read-only; + }; + slot0_partition: partition@c000 { + label = "image-0"; + reg = <0x0000c000 DT_SIZE_K(80)>; + }; + }; +}; diff --git a/boards/weact/usb2canfdv1/usb2canfdv1.yaml b/boards/weact/usb2canfdv1/usb2canfdv1.yaml new file mode 100644 index 0000000000000..8fb61f88e14cf --- /dev/null +++ b/boards/weact/usb2canfdv1/usb2canfdv1.yaml @@ -0,0 +1,16 @@ +identifier: usb2canfdv1 +name: WeAct USB2CANFDV1 +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +ram: 144 +flash: 128 +supported: + - can + - gpio + - usb_device + - usbd +vendor: weact diff --git a/boards/weact/usb2canfdv1/usb2canfdv1_defconfig b/boards/weact/usb2canfdv1/usb2canfdv1_defconfig new file mode 100644 index 0000000000000..90c77db2fff4b --- /dev/null +++ b/boards/weact/usb2canfdv1/usb2canfdv1_defconfig @@ -0,0 +1,2 @@ +CONFIG_ARM_MPU=y +CONFIG_GPIO=y From 54545254d954f9162c18b932be5a046d3f778475 Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Tue, 22 Oct 2024 20:45:10 +0000 Subject: [PATCH 1672/4482] tests: tests: drivers: can: timing: enable full timing test on usb2canfdv1 Enable the full range of CAN timing tests on the WeAct USB2CANFDV1 board. Signed-off-by: Henrik Brix Andersen --- tests/drivers/can/timing/boards/usb2canfdv1_stm32g0b1xx.conf | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/drivers/can/timing/boards/usb2canfdv1_stm32g0b1xx.conf diff --git a/tests/drivers/can/timing/boards/usb2canfdv1_stm32g0b1xx.conf b/tests/drivers/can/timing/boards/usb2canfdv1_stm32g0b1xx.conf new file mode 100644 index 0000000000000..7b071f3a54f51 --- /dev/null +++ b/tests/drivers/can/timing/boards/usb2canfdv1_stm32g0b1xx.conf @@ -0,0 +1 @@ +CONFIG_TEST_ALL_BITRATES=y From 95fa167e453bf92ad5306a9aac430e6abab3af06 Mon Sep 17 00:00:00 2001 From: Laczen JMS Date: Tue, 15 Oct 2024 12:41:35 +0200 Subject: [PATCH 1673/4482] settings: introduce priority for commit A priority is introduced to allow scheduling of commit routines. Signed-off-by: Laczen JMS --- include/zephyr/settings/settings.h | 33 ++++++++++- subsys/settings/src/settings.c | 91 +++++++++++++++++++++++------- 2 files changed, 100 insertions(+), 24 deletions(-) diff --git a/include/zephyr/settings/settings.h b/include/zephyr/settings/settings.h index 99b9fc21077d8..f22f1aba1189f 100644 --- a/include/zephyr/settings/settings.h +++ b/include/zephyr/settings/settings.h @@ -70,6 +70,9 @@ struct settings_handler { const char *name; /**< Name of subtree. */ + int cprio; + /**< Priority of commit, lower value is higher priority */ + int (*h_get)(const char *key, char *val, int val_len_max); /**< Get values handler of settings items identified by keyword names. * @@ -136,6 +139,9 @@ struct settings_handler_static { const char *name; /**< Name of subtree. */ + int cprio; + /**< Priority of commit, lower value is higher priority */ + int (*h_get)(const char *key, char *val, int val_len_max); /**< Get values handler of settings items identified by keyword names. * @@ -196,22 +202,30 @@ struct settings_handler_static { * @param _set set routine (can be NULL) * @param _commit commit routine (can be NULL) * @param _export export routine (can be NULL) + * @param _cprio commit priority (lower value is higher priority) * * This creates a variable _hname prepended by settings_handler_. * */ -#define SETTINGS_STATIC_HANDLER_DEFINE(_hname, _tree, _get, _set, _commit, \ - _export) \ +#define SETTINGS_STATIC_HANDLER_DEFINE_WITH_CPRIO(_hname, _tree, _get, _set, \ + _commit, _export, _cprio) \ const STRUCT_SECTION_ITERABLE(settings_handler_static, \ settings_handler_ ## _hname) = { \ .name = _tree, \ + .cprio = _cprio, \ .h_get = _get, \ .h_set = _set, \ .h_commit = _commit, \ .h_export = _export, \ } +/* Handlers without commit priority are set to priority O */ +#define SETTINGS_STATIC_HANDLER_DEFINE(_hname, _tree, _get, _set, _commit, \ + _export) \ + SETTINGS_STATIC_HANDLER_DEFINE_WITH_CPRIO(_hname, _tree, _get, _set, \ + _commit, _export, 0) + /** * Initialization of settings and backend * @@ -224,7 +238,20 @@ struct settings_handler_static { int settings_subsys_init(void); /** - * Register a handler for settings items stored in RAM. + * Register a handler for settings items stored in RAM with + * commit priority. + * + * @param cf Structure containing registration info. + * @param cprio Commit priority (lower value is higher priority). + * + * @return 0 on success, non-zero on failure. + */ +int settings_register_with_cprio(struct settings_handler *cf, + int cprio); + +/** + * Register a handler for settings items stored in RAM with + * commit priority set to default. * * @param cf Structure containing registration info. * diff --git a/subsys/settings/src/settings.c b/subsys/settings/src/settings.c index e2072234fa9db..dde6135a41194 100644 --- a/subsys/settings/src/settings.c +++ b/subsys/settings/src/settings.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -36,7 +37,7 @@ void settings_init(void) } #if defined(CONFIG_SETTINGS_DYNAMIC_HANDLERS) -int settings_register(struct settings_handler *handler) +int settings_register_with_cprio(struct settings_handler *handler, int cprio) { int rc = 0; @@ -55,12 +56,19 @@ int settings_register(struct settings_handler *handler) goto end; } } + + handler->cprio = cprio; sys_slist_append(&settings_handlers, &handler->node); end: k_mutex_unlock(&settings_lock); return rc; } + +int settings_register(struct settings_handler *handler) +{ + return settings_register_with_cprio(handler, 0); +} #endif /* CONFIG_SETTINGS_DYNAMIC_HANDLERS */ int settings_name_steq(const char *name, const char *key, const char **next) @@ -234,39 +242,80 @@ int settings_commit(void) return settings_commit_subtree(NULL); } +static int set_next_cprio(int handler_cprio, int cprio, int next_cprio) +{ + if (handler_cprio <= cprio) { + return next_cprio; + } + + /* If cprio and next_cprio are identical then next_cprio has not + * yet been set to any value and its initialized to the first + * handler_cprio above cprio. + */ + if (cprio == next_cprio) { + return handler_cprio; + } + + return MIN(handler_cprio, next_cprio); +} + int settings_commit_subtree(const char *subtree) { int rc; int rc2; + int cprio = INT_MIN; rc = 0; - STRUCT_SECTION_FOREACH(settings_handler_static, ch) { - if (subtree && !settings_name_steq(ch->name, subtree, NULL)) { - continue; - } - if (ch->h_commit) { - rc2 = ch->h_commit(); - if (!rc) { - rc = rc2; + while (true) { + int next_cprio = cprio; + + STRUCT_SECTION_FOREACH(settings_handler_static, ch) { + if (subtree && !settings_name_steq(ch->name, subtree, NULL)) { + continue; } - } - } -#if defined(CONFIG_SETTINGS_DYNAMIC_HANDLERS) - struct settings_handler *ch; - SYS_SLIST_FOR_EACH_CONTAINER(&settings_handlers, ch, node) { - if (subtree && !settings_name_steq(ch->name, subtree, NULL)) { - continue; + if (ch->h_commit) { + next_cprio = set_next_cprio(ch->cprio, cprio, next_cprio); + if (ch->cprio != cprio) { + continue; + } + + rc2 = ch->h_commit(); + if (!rc) { + rc = rc2; + } + } } - if (ch->h_commit) { - rc2 = ch->h_commit(); - if (!rc) { - rc = rc2; + + if (IS_ENABLED(CONFIG_SETTINGS_DYNAMIC_HANDLERS)) { + struct settings_handler *ch; + + SYS_SLIST_FOR_EACH_CONTAINER(&settings_handlers, ch, node) { + if (subtree && !settings_name_steq(ch->name, subtree, NULL)) { + continue; + } + + if (ch->h_commit) { + next_cprio = set_next_cprio(ch->cprio, cprio, next_cprio); + if (ch->cprio != cprio) { + continue; + } + + rc2 = ch->h_commit(); + if (!rc) { + rc = rc2; + } + } } } + + if (cprio == next_cprio) { + break; + } + + cprio = next_cprio; } -#endif /* CONFIG_SETTINGS_DYNAMIC_HANDLERS */ return rc; } From 435587d3681e8949edf868827d960f54e701940b Mon Sep 17 00:00:00 2001 From: Laczen JMS Date: Fri, 18 Oct 2024 09:46:07 +0200 Subject: [PATCH 1674/4482] settings: Add test for settings commit priority Add a test to validate settings commit priority Signed-off-by: Laczen JMS --- .../settings_commit_prio/CMakeLists.txt | 8 ++ tests/subsys/settings_commit_prio/README.rst | 18 ++++ tests/subsys/settings_commit_prio/prj.conf | 5 ++ tests/subsys/settings_commit_prio/src/main.c | 90 +++++++++++++++++++ .../subsys/settings_commit_prio/testcase.yaml | 4 + 5 files changed, 125 insertions(+) create mode 100644 tests/subsys/settings_commit_prio/CMakeLists.txt create mode 100644 tests/subsys/settings_commit_prio/README.rst create mode 100644 tests/subsys/settings_commit_prio/prj.conf create mode 100644 tests/subsys/settings_commit_prio/src/main.c create mode 100644 tests/subsys/settings_commit_prio/testcase.yaml diff --git a/tests/subsys/settings_commit_prio/CMakeLists.txt b/tests/subsys/settings_commit_prio/CMakeLists.txt new file mode 100644 index 0000000000000..f36a52380d320 --- /dev/null +++ b/tests/subsys/settings_commit_prio/CMakeLists.txt @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(test_settings_commit_prio) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/subsys/settings_commit_prio/README.rst b/tests/subsys/settings_commit_prio/README.rst new file mode 100644 index 0000000000000..afc2c4c75c6a5 --- /dev/null +++ b/tests/subsys/settings_commit_prio/README.rst @@ -0,0 +1,18 @@ +.. _settings_commit_prio_test: + +Settings Subsystem commit priority Test +####################################### + +Overview +******** + +This test is used to test the Settings Subsystem commit priority. + +Building and Testing +******************** + +This application can be built and executed on native_sim as follows: + +.. code-block:: console + $ ./scripts/twister -p native_sim -T tests/subsys/settings_commit_prio +To build for another board, change ``native_sim`` above to that board's name. diff --git a/tests/subsys/settings_commit_prio/prj.conf b/tests/subsys/settings_commit_prio/prj.conf new file mode 100644 index 0000000000000..8914d4f20f22e --- /dev/null +++ b/tests/subsys/settings_commit_prio/prj.conf @@ -0,0 +1,5 @@ +CONFIG_TEST=y +CONFIG_ZTEST=y +CONFIG_LOG=y +CONFIG_SETTINGS=y +CONFIG_SETTINGS_DYNAMIC_HANDLERS=y diff --git a/tests/subsys/settings_commit_prio/src/main.c b/tests/subsys/settings_commit_prio/src/main.c new file mode 100644 index 0000000000000..9722727901b11 --- /dev/null +++ b/tests/subsys/settings_commit_prio/src/main.c @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2024 Laczen + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +LOG_MODULE_REGISTER(test); + +static int prio; + +int commit0(void) +{ + LOG_INF("%s Called", __func__); + zassert_equal(prio, 0, "Bad commit order"); + prio++; + return 0; +} + +int commit1(void) +{ + LOG_INF("%s Called", __func__); + zassert_equal(prio, 1, "Bad commit order"); + prio++; + return 0; +} + +int commit2(void) +{ + LOG_INF("%s Called", __func__); + zassert_equal(prio, 2, "Bad commit order"); + prio++; + return 0; +} + +int commit3(void) +{ + LOG_INF("%s Called", __func__); + zassert_equal(prio, 3, "Bad commit order"); + prio++; + return 0; +} + +int commit5(void) +{ + LOG_INF("%s Called", __func__); + zassert_equal(prio, 0, "Bad commit order"); + return 0; +} + +SETTINGS_STATIC_HANDLER_DEFINE_WITH_CPRIO(h0, "h0", NULL, NULL, commit0, NULL, 0); +SETTINGS_STATIC_HANDLER_DEFINE_WITH_CPRIO(h2, "h2", NULL, NULL, commit2, NULL, 2); + +static struct settings_handler h1 = { + .name = "h1", + .h_commit = commit1, +}; + +static struct settings_handler h3 = { + .name = "h3", + .h_commit = commit3, +}; + +SETTINGS_STATIC_HANDLER_DEFINE_WITH_CPRIO(h5, "h5", NULL, NULL, commit5, NULL, -1); + +/** + * @brief Test Settings commit order + * + * This test verifies the settings commit order. + */ +ZTEST(settings_commit_prio, test_commit_order) +{ + int rc; + + prio = 0; + rc = settings_register_with_cprio(&h1, 1); + zassert_equal(rc, 0, "Failed to register handler"); + rc = settings_register_with_cprio(&h3, 3); + zassert_equal(rc, 0, "Failed to register handler"); + + rc = settings_commit(); + zassert_equal(rc, 0, "Commit failed with code [%d]", rc); + zassert_equal(prio, 4, "Incorrect prio level reached [%d]", prio); +} + +ZTEST_SUITE(settings_commit_prio, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/subsys/settings_commit_prio/testcase.yaml b/tests/subsys/settings_commit_prio/testcase.yaml new file mode 100644 index 0000000000000..089329a514278 --- /dev/null +++ b/tests/subsys/settings_commit_prio/testcase.yaml @@ -0,0 +1,4 @@ +tests: + settings.settings_commit_prio: + platform_allow: native_sim + tags: settings From 6e451b66a423708e34af3e82d3f4ae7ace6098a4 Mon Sep 17 00:00:00 2001 From: Laczen JMS Date: Fri, 18 Oct 2024 09:50:37 +0200 Subject: [PATCH 1675/4482] settings: add release note for commit prio Add release note for added settings commit priority Signed-off-by: Laczen JMS --- doc/releases/release-notes-4.0.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index da0fa4d054cb1..1e901f34b932b 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -479,6 +479,12 @@ Libraries / Subsystems * SD +* Settings + + * Settings has been extended to allow prioritizing the commit handlers using + ``SETTINGS_STATIC_HANDLER_DEFINE_WITH_CPRIO(...)`` for static_handlers and + ``settings_register_with_cprio(...)`` for dynamic_handlers. + * Shell: * Reorganized the ``kernel threads`` and ``kernel stacks`` shell command under the From 237a18928b9f5280cc029c1ba14cfd044ec46429 Mon Sep 17 00:00:00 2001 From: Laczen JMS Date: Tue, 22 Oct 2024 09:32:38 +0200 Subject: [PATCH 1676/4482] settings: add note to documentation Add information about commit priority to settings documentation. Signed-off-by: Laczen JMS --- doc/services/settings/index.rst | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/services/settings/index.rst b/doc/services/settings/index.rst index 10578da5bec2e..66c99d050a353 100644 --- a/doc/services/settings/index.rst +++ b/doc/services/settings/index.rst @@ -30,7 +30,9 @@ Handlers ******** Settings handlers for subtree implement a set of handler functions. -These are registered using a call to :c:func:`settings_register()`. +These are registered using a call to :c:func:`settings_register()` for +dynamic handlers or defined using a call to :c:macro:`SETTINGS_STATIC_HANDLER_DEFINE()` +for static handlers. **h_get** This gets called when asking for a settings element value by its name using @@ -52,6 +54,16 @@ These are registered using a call to :c:func:`settings_register()`. when :c:func:`settings_save()` tries to save the settings or transfer to any user-implemented back-end. +Settings handlers also have a commit priority ``cprio`` that allows to prioritize +the ``h_commit`` calls. This can be advantageous when e.g. a subsystem initializes +a service that other ``h_commit`` calls depend on. + +Settings handlers ``h_commit`` routines are by default initialized with ``cprio = 0``, +initializing a settings handler with a different priority is done using a call to +:c:func:`settings_register_with_cprio()` for dynamic handlers or using a call to +:c:macro:`SETTINGS_STATIC_HANDLER_DEFINE_WITH_CPRIO()` for static handlers. The +specified ``cprio`` value is an integer where lower values mean higher priority. + Backends ******** From ca768581c80853542c3e899eb8241b2e3273a543 Mon Sep 17 00:00:00 2001 From: IBEN EL HADJ MESSAOUD Marwa Date: Fri, 27 Sep 2024 00:07:24 +0200 Subject: [PATCH 1677/4482] drivers: ethernet: eth_stm32_hal: Remove V1 code for H7/H5 series Remove the V1 code for STM32H7 and STM32H5 series Signed-off-by: IBEN EL HADJ MESSAOUD Marwa --- drivers/ethernet/eth_stm32_hal.c | 230 ++------------------------ drivers/ethernet/eth_stm32_hal_priv.h | 5 +- 2 files changed, 19 insertions(+), 216 deletions(-) diff --git a/drivers/ethernet/eth_stm32_hal.c b/drivers/ethernet/eth_stm32_hal.c index 046b6916fa456..35b191145496e 100644 --- a/drivers/ethernet/eth_stm32_hal.c +++ b/drivers/ethernet/eth_stm32_hal.c @@ -205,8 +205,7 @@ static inline uint16_t allocate_tx_buffer(void) } #endif /* CONFIG_ETH_STM32_HAL_API_V2 */ -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) || \ - defined(CONFIG_ETH_STM32_HAL_API_V2) +#if defined(CONFIG_ETH_STM32_HAL_API_V2) static ETH_TxPacketConfig tx_config; #endif @@ -222,7 +221,7 @@ static HAL_StatusTypeDef read_eth_phy_register(ETH_HandleTypeDef *heth, #else ARG_UNUSED(PHYAddr); return HAL_ETH_ReadPHYRegister(heth, PHYReg, RegVal); -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X || CONFIG_ETH_STM32_HAL_API_V2 */ +#endif /* CONFIG_ETH_STM32_HAL_API_V2 */ } static inline void setup_mac_filter(ETH_HandleTypeDef *heth) @@ -334,16 +333,8 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt) #if defined(CONFIG_ETH_STM32_HAL_API_V2) ctx.first_tx_buffer_index = allocate_tx_buffer(); buf_header = &dma_tx_buffer_header[ctx.first_tx_buffer_index]; -#else /* CONFIG_ETH_STM32_HAL_API_V2 */ -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) - uint32_t cur_tx_desc_idx; - - cur_tx_desc_idx = heth->TxDescList.CurTxDesc; - dma_tx_desc = (ETH_DMADescTypeDef *)heth->TxDescList.TxDesc[cur_tx_desc_idx]; #else dma_tx_desc = heth->TxDesc; -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ - while (IS_ETH_DMATXDESC_OWN(dma_tx_desc) != (uint32_t)RESET) { k_yield(); } @@ -356,8 +347,6 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt) /* Enable transmit timestamp */ #if defined(CONFIG_ETH_STM32_HAL_API_V2) HAL_ETH_PTP_InsertTxTimestamp(heth); -#elif defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) - dma_tx_desc->DESC2 |= ETH_DMATXNDESCRF_TTSE; #else dma_tx_desc->Status |= ETH_DMATXDESC_TTSE; #endif /* CONFIG_ETH_STM32_HAL_API_V2 */ @@ -388,37 +377,19 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt) buf_header->tx_buff.len = remaining_read; buf_header->tx_buff.next = NULL; -#else /* CONFIG_ETH_STM32_HAL_API_V2 */ -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) - dma_buffer = dma_tx_buffer[cur_tx_desc_idx]; #else dma_buffer = (uint8_t *)(dma_tx_desc->Buffer1Addr); -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ if (net_pkt_read(pkt, dma_buffer, total_len)) { res = -ENOBUFS; goto error; } - -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) - ETH_BufferTypeDef tx_buffer_def; - - tx_buffer_def.buffer = dma_buffer; - tx_buffer_def.len = total_len; - tx_buffer_def.next = NULL; -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ #endif /* CONFIG_ETH_STM32_HAL_API_V2 */ -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) || \ - defined(CONFIG_ETH_STM32_HAL_API_V2) - - tx_config.Length = total_len; #if defined(CONFIG_ETH_STM32_HAL_API_V2) + tx_config.Length = total_len; tx_config.pData = &ctx; tx_config.TxBuffer = &dma_tx_buffer_header[ctx.first_tx_buffer_index].tx_buff; -#else - tx_config.TxBuffer = &tx_buffer_def; -#endif /* CONFIG_ETH_STM32_HAL_API_V2 */ /* Reset TX complete interrupt semaphore before TX request*/ k_sem_reset(&dev_data->tx_int_sem); @@ -443,11 +414,6 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt) LOG_ERR("HAL_ETH_TransmitIT tx_int_sem take timeout"); res = -EIO; -#ifndef CONFIG_ETH_STM32_HAL_API_V2 - /* Content of the packet could be the reason for timeout */ - LOG_HEXDUMP_ERR(dma_buffer, total_len, "eth packet timeout"); -#endif - /* Check for errors */ /* Ethernet device was put in error state */ /* Error state is unrecoverable ? */ @@ -499,42 +465,11 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt) res = -EIO; goto error; } -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X || CONFIG_ETH_STM32_HAL_API_V2 */ +#endif /* CONFIG_ETH_STM32_HAL_API_V2 */ #if defined(CONFIG_PTP_CLOCK_STM32_HAL) && !defined(CONFIG_ETH_STM32_HAL_API_V2) if (timestamped_frame) { /* Retrieve transmission timestamp from last DMA TX descriptor */ -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) - ETH_TxDescListTypeDef * dma_tx_desc_list; - - __IO ETH_DMADescTypeDef *last_dma_tx_desc; - - dma_tx_desc_list = &heth->TxDescList; - for (uint32_t i = 0; i < ETH_TX_DESC_CNT; i++) { - const uint32_t last_desc_idx = (cur_tx_desc_idx + i) % ETH_TX_DESC_CNT; - - last_dma_tx_desc = - (ETH_DMADescTypeDef *)dma_tx_desc_list->TxDesc[last_desc_idx]; - if (last_dma_tx_desc->DESC3 & ETH_DMATXNDESCWBF_LD) { - break; - } - } - - while (IS_ETH_DMATXDESC_OWN(last_dma_tx_desc) != (uint32_t)RESET) { - /* Wait for transmission */ - k_yield(); - } - - if ((last_dma_tx_desc->DESC3 & ETH_DMATXNDESCWBF_LD) && - (last_dma_tx_desc->DESC3 & ETH_DMATXNDESCWBF_TTSS)) { - pkt->timestamp.second = last_dma_tx_desc->DESC1; - pkt->timestamp.nanosecond = last_dma_tx_desc->DESC0; - } else { - /* Invalid value */ - pkt->timestamp.second = UINT64_MAX; - pkt->timestamp.nanosecond = UINT32_MAX; - } -#else __IO ETH_DMADescTypeDef *last_dma_tx_desc = dma_tx_desc; while (!(last_dma_tx_desc->Status & ETH_DMATXDESC_LS) && @@ -557,8 +492,6 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt) pkt->timestamp.second = UINT64_MAX; pkt->timestamp.nanosecond = UINT32_MAX; } -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ - net_if_add_tx_timestamp(pkt); } #endif /* CONFIG_PTP_CLOCK_STM32_HAL && !CONFIG_ETH_STM32_HAL_API_V2 */ @@ -596,9 +529,7 @@ static struct net_pkt *eth_rx(const struct device *dev) void *appbuf = NULL; struct eth_stm32_rx_buffer_header *rx_header; #else -#if !defined(CONFIG_SOC_SERIES_STM32H7X) && !defined(CONFIG_SOC_SERIES_STM32H5X) __IO ETH_DMADescTypeDef *dma_rx_desc; -#endif /* !CONFIG_SOC_SERIES_STM32H7X */ uint8_t *dma_buffer; HAL_StatusTypeDef hal_ret = HAL_OK; #endif /* CONFIG_ETH_STM32_HAL_API_V2 */ @@ -631,31 +562,6 @@ static struct net_pkt *eth_rx(const struct device *dev) rx_header; rx_header = rx_header->next) { total_len += rx_header->size; } -#elif defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) - if (HAL_ETH_IsRxDataAvailable(heth) != true) { - /* no frame available */ - return NULL; - } - - ETH_BufferTypeDef rx_buffer_def; - uint32_t frame_length = 0; - - hal_ret = HAL_ETH_GetRxDataBuffer(heth, &rx_buffer_def); - if (hal_ret != HAL_OK) { - LOG_ERR("HAL_ETH_GetRxDataBuffer: failed with state: %d", - hal_ret); - return NULL; - } - - hal_ret = HAL_ETH_GetRxDataLength(heth, &frame_length); - if (hal_ret != HAL_OK) { - LOG_ERR("HAL_ETH_GetRxDataLength: failed with state: %d", - hal_ret); - return NULL; - } - - total_len = frame_length; - dma_buffer = rx_buffer_def.buffer; #else hal_ret = HAL_ETH_GetReceivedFrame_IT(heth); if (hal_ret != HAL_OK) { @@ -665,7 +571,7 @@ static struct net_pkt *eth_rx(const struct device *dev) total_len = heth->RxFrameInfos.length; dma_buffer = (uint8_t *)heth->RxFrameInfos.buffer; -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* CONFIG_ETH_STM32_HAL_API_V2 */ #if defined(CONFIG_PTP_CLOCK_STM32_HAL) #if defined(CONFIG_ETH_STM32_HAL_API_V2) @@ -674,37 +580,6 @@ static struct net_pkt *eth_rx(const struct device *dev) timestamp.second = ts_registers.TimeStampHigh; timestamp.nanosecond = ts_registers.TimeStampLow; } - -#elif defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) - ETH_RxDescListTypeDef * dma_rx_desc_list; - - dma_rx_desc_list = &heth->RxDescList; - if (dma_rx_desc_list->AppDescNbr) { - __IO ETH_DMADescTypeDef *last_dma_rx_desc; - - const uint32_t last_desc_idx = - (dma_rx_desc_list->FirstAppDesc + dma_rx_desc_list->AppDescNbr - 1U) - % ETH_RX_DESC_CNT; - - last_dma_rx_desc = - (ETH_DMADescTypeDef *)dma_rx_desc_list->RxDesc[last_desc_idx]; - - if (dma_rx_desc_list->AppContextDesc && - last_dma_rx_desc->DESC1 & ETH_DMARXNDESCWBF_TSA) { - /* Retrieve timestamp from context DMA descriptor */ - __IO ETH_DMADescTypeDef *context_dma_rx_desc; - - const uint32_t context_desc_idx = (last_desc_idx + 1U) % ETH_RX_DESC_CNT; - - context_dma_rx_desc = - (ETH_DMADescTypeDef *)dma_rx_desc_list->RxDesc[context_desc_idx]; - if (context_dma_rx_desc->DESC1 != UINT32_MAX || - context_dma_rx_desc->DESC0 != UINT32_MAX) { - timestamp.second = context_dma_rx_desc->DESC1; - timestamp.nanosecond = context_dma_rx_desc->DESC0; - } - } - } #else __IO ETH_DMADescTypeDef *last_dma_rx_desc; @@ -714,7 +589,7 @@ static struct net_pkt *eth_rx(const struct device *dev) timestamp.second = last_dma_rx_desc->TimeStampHigh; timestamp.nanosecond = last_dma_rx_desc->TimeStampLow; } -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* CONFIG_ETH_STM32_HAL_API_V2 */ #endif /* CONFIG_PTP_CLOCK_STM32_HAL */ pkt = net_pkt_rx_alloc_with_buffer(get_iface(dev_data), @@ -752,12 +627,6 @@ static struct net_pkt *eth_rx(const struct device *dev) rx_header; rx_header = rx_header->next) { rx_header->used = false; } - -#elif defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) - hal_ret = HAL_ETH_BuildRxDescriptors(heth); - if (hal_ret != HAL_OK) { - LOG_ERR("HAL_ETH_BuildRxDescriptors: failed: %d", hal_ret); - } #else /* Release descriptors to DMA */ /* Point to first descriptor */ @@ -885,8 +754,7 @@ static void eth_isr(const struct device *dev) HAL_ETH_IRQHandler(heth); } -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) || \ - defined(CONFIG_ETH_STM32_HAL_API_V2) +#if defined(CONFIG_ETH_STM32_HAL_API_V2) void HAL_ETH_TxCpltCallback(ETH_HandleTypeDef *heth_handle) { __ASSERT_NO_MSG(heth_handle != NULL); @@ -899,7 +767,7 @@ void HAL_ETH_TxCpltCallback(ETH_HandleTypeDef *heth_handle) k_sem_give(&dev_data->tx_int_sem); } -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X || CONFIG_ETH_STM32_HAL_API_V2 */ +#endif /* CONFIG_ETH_STM32_HAL_API_V2 */ #if defined(CONFIG_ETH_STM32_HAL_API_V2) void HAL_ETH_ErrorCallback(ETH_HandleTypeDef *heth) @@ -977,53 +845,6 @@ void HAL_ETH_ErrorCallback(ETH_HandleTypeDef *heth) #endif /* CONFIG_NET_STATISTICS_ETHERNET */ } -#elif defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) -/* DMA and MAC errors callback only appear in H7 series */ -void HAL_ETH_DMAErrorCallback(ETH_HandleTypeDef *heth_handle) -{ - __ASSERT_NO_MSG(heth_handle != NULL); - - LOG_ERR("%s errorcode:%x dmaerror:%x", - __func__, - HAL_ETH_GetError(heth_handle), - HAL_ETH_GetDMAError(heth_handle)); - - /* State of eth handle is ERROR in case of unrecoverable error */ - /* unrecoverable (ETH_DMACSR_FBE | ETH_DMACSR_TPS | ETH_DMACSR_RPS) */ - if (HAL_ETH_GetState(heth_handle) == HAL_ETH_STATE_ERROR) { - LOG_ERR("%s ethernet in error state", __func__); - /* TODO restart the ETH peripheral to recover */ - return; - } - - /* Recoverable errors don't put ETH in error state */ - /* ETH_DMACSR_CDE | ETH_DMACSR_ETI | ETH_DMACSR_RWT */ - /* | ETH_DMACSR_RBU | ETH_DMACSR_AIS) */ - - /* TODO Check if we were TX transmitting and the unlock semaphore */ - /* To return the error as soon as possible else we'll just wait */ - /* for the timeout */ - - -} -void HAL_ETH_MACErrorCallback(ETH_HandleTypeDef *heth_handle) -{ - __ASSERT_NO_MSG(heth_handle != NULL); - - /* MAC errors dumping */ - LOG_ERR("%s errorcode:%x macerror:%x", - __func__, - HAL_ETH_GetError(heth_handle), - HAL_ETH_GetMACError(heth_handle)); - - /* State of eth handle is ERROR in case of unrecoverable error */ - if (HAL_ETH_GetState(heth_handle) == HAL_ETH_STATE_ERROR) { - LOG_ERR("%s ethernet in error state", __func__); - /* TODO restart or reconfig ETH peripheral to recover */ - - return; - } -} #endif /* CONFIG_ETH_STM32_HAL_API_V2 */ void HAL_ETH_RxCpltCallback(ETH_HandleTypeDef *heth_handle) @@ -1117,12 +938,11 @@ static int eth_initialize(const struct device *dev) heth->Init.MACAddr = dev_data->mac_addr; -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) || \ - defined(CONFIG_ETH_STM32_HAL_API_V2) +#if defined(CONFIG_ETH_STM32_HAL_API_V2) heth->Init.TxDesc = dma_tx_desc_tab; heth->Init.RxDesc = dma_rx_desc_tab; heth->Init.RxBuffLen = ETH_MAX_PACKET_SIZE; -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X || CONFIG_ETH_STM32_HAL_API_V2 */ +#endif /* CONFIG_ETH_STM32_HAL_API_V2 */ hal_ret = HAL_ETH_Init(heth); if (hal_ret == HAL_TIMEOUT) { @@ -1146,8 +966,7 @@ static int eth_initialize(const struct device *dev) #endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ #endif /* CONFIG_PTP_CLOCK_STM32_HAL */ -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) || \ - defined(CONFIG_ETH_STM32_HAL_API_V2) +#if defined(CONFIG_ETH_STM32_HAL_API_V2) /* Tx config init: */ memset(&tx_config, 0, sizeof(ETH_TxPacketConfig)); tx_config.Attributes = ETH_TX_PACKETS_FEATURES_CSUM | @@ -1155,20 +974,18 @@ static int eth_initialize(const struct device *dev) tx_config.ChecksumCtrl = IS_ENABLED(CONFIG_ETH_STM32_HW_CHECKSUM) ? ETH_CHECKSUM_IPHDR_PAYLOAD_INSERT_PHDR_CALC : ETH_CHECKSUM_DISABLE; tx_config.CRCPadCtrl = ETH_CRC_PAD_INSERT; -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X || CONFIG_ETH_STM32_HAL_API_V2 */ +#endif /* CONFIG_ETH_STM32_HAL_API_V2 */ dev_data->link_up = false; /* Initialize semaphores */ k_mutex_init(&dev_data->tx_mutex); k_sem_init(&dev_data->rx_int_sem, 0, K_SEM_MAX_LIMIT); -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) || \ - defined(CONFIG_ETH_STM32_HAL_API_V2) +#if defined(CONFIG_ETH_STM32_HAL_API_V2) k_sem_init(&dev_data->tx_int_sem, 0, K_SEM_MAX_LIMIT); -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X || CONFIG_ETH_STM32_HAL_API_V2 */ +#endif /* CONFIG_ETH_STM32_HAL_API_V2 */ -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) || \ - defined(CONFIG_ETH_STM32_HAL_API_V2) +#if defined(CONFIG_ETH_STM32_HAL_API_V2) /* Adjust MDC clock range depending on HCLK frequency: */ HAL_ETH_SetMDIOClockRange(heth); @@ -1185,7 +1002,7 @@ static int eth_initialize(const struct device *dev) if (hal_ret != HAL_OK) { LOG_ERR("HAL_ETH_SetMACConfig: failed: %d", hal_ret); } -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X || CONFIG_ETH_STM32_HAL_API_V2 */ +#endif /* CONFIG_ETH_STM32_HAL_API_V2 */ #if defined(CONFIG_ETH_STM32_HAL_API_V2) @@ -1194,18 +1011,6 @@ static int eth_initialize(const struct device *dev) dma_tx_buffer_header[i].tx_buff.buffer = dma_tx_buffer[i]; } - hal_ret = HAL_ETH_Start_IT(heth); -#elif defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) - for (uint32_t i = 0; i < ETH_RX_DESC_CNT; i++) { - hal_ret = HAL_ETH_DescAssignMemory(heth, i, dma_rx_buffer[i], - NULL); - if (hal_ret != HAL_OK) { - LOG_ERR("HAL_ETH_DescAssignMemory: failed: %d, i: %d", - hal_ret, i); - return -EINVAL; - } - } - hal_ret = HAL_ETH_Start_IT(heth); #else HAL_ETH_DMATxDescListInit(heth, dma_tx_desc_tab, @@ -1482,8 +1287,7 @@ static struct eth_stm32_hal_dev_data eth0_data = { .heth = { .Instance = (ETH_TypeDef *)DT_INST_REG_ADDR(0), .Init = { -#if !defined(CONFIG_SOC_SERIES_STM32H7X) && !defined(CONFIG_SOC_SERIES_STM32H5X) && \ - !defined(CONFIG_ETH_STM32_HAL_API_V2) +#if !defined(CONFIG_ETH_STM32_HAL_API_V2) #if defined(CONFIG_ETH_STM32_AUTO_NEGOTIATION_ENABLE) .AutoNegotiation = ETH_AUTONEGOTIATION_ENABLE, #else diff --git a/drivers/ethernet/eth_stm32_hal_priv.h b/drivers/ethernet/eth_stm32_hal_priv.h index d6eeb47b95bc7..0d19578cd4826 100644 --- a/drivers/ethernet/eth_stm32_hal_priv.h +++ b/drivers/ethernet/eth_stm32_hal_priv.h @@ -43,10 +43,9 @@ struct eth_stm32_hal_dev_data { const struct device *clock; struct k_mutex tx_mutex; struct k_sem rx_int_sem; -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) || \ - defined(CONFIG_ETH_STM32_HAL_API_V2) +#if defined(CONFIG_ETH_STM32_HAL_API_V2) struct k_sem tx_int_sem; -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X || CONFIG_ETH_STM32_HAL_API_V2*/ +#endif /* CONFIG_ETH_STM32_HAL_API_V2 */ K_KERNEL_STACK_MEMBER(rx_thread_stack, CONFIG_ETH_STM32_HAL_RX_THREAD_STACK_SIZE); struct k_thread rx_thread; From d0751148c10874ff6a545060109c77ec5fda017a Mon Sep 17 00:00:00 2001 From: IBEN EL HADJ MESSAOUD Marwa Date: Fri, 27 Sep 2024 00:36:21 +0200 Subject: [PATCH 1678/4482] dts: Introduce stm32h7 ethernet compatible Add stm32h7 ethernet compatible "st,stm32h7-ethernet", used also for stm32h5. Signed-off-by: IBEN EL HADJ MESSAOUD Marwa --- dts/arm/st/h5/stm32h5.dtsi | 2 +- dts/arm/st/h7/stm32h7.dtsi | 2 +- .../ethernet/st,stm32-ethernet-common.yaml | 20 +++++++++++++++++++ dts/bindings/ethernet/st,stm32-ethernet.yaml | 17 ++-------------- .../ethernet/st,stm32h7-ethernet.yaml | 14 +++++++++++++ 5 files changed, 38 insertions(+), 17 deletions(-) create mode 100644 dts/bindings/ethernet/st,stm32-ethernet-common.yaml create mode 100644 dts/bindings/ethernet/st,stm32h7-ethernet.yaml diff --git a/dts/arm/st/h5/stm32h5.dtsi b/dts/arm/st/h5/stm32h5.dtsi index 03c84df8a0666..6f14e2369bf50 100644 --- a/dts/arm/st/h5/stm32h5.dtsi +++ b/dts/arm/st/h5/stm32h5.dtsi @@ -512,7 +512,7 @@ }; mac: ethernet@40028000 { - compatible = "st,stm32-ethernet"; + compatible = "st,stm32h7-ethernet", "st,stm32-ethernet"; reg = <0x40028000 0x8000>; interrupts = <106 0>; clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx"; diff --git a/dts/arm/st/h7/stm32h7.dtsi b/dts/arm/st/h7/stm32h7.dtsi index 3e2d37eebe179..64abc777b769f 100644 --- a/dts/arm/st/h7/stm32h7.dtsi +++ b/dts/arm/st/h7/stm32h7.dtsi @@ -1022,7 +1022,7 @@ }; mac: ethernet@40028000 { - compatible = "st,stm32-ethernet"; + compatible = "st,stm32h7-ethernet", "st,stm32-ethernet"; reg = <0x40028000 0x8000>; interrupts = <61 0>; clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx"; diff --git a/dts/bindings/ethernet/st,stm32-ethernet-common.yaml b/dts/bindings/ethernet/st,stm32-ethernet-common.yaml new file mode 100644 index 0000000000000..4b3707d061073 --- /dev/null +++ b/dts/bindings/ethernet/st,stm32-ethernet-common.yaml @@ -0,0 +1,20 @@ +# Copyright (c) 2024, STMicroelectronics +# SPDX-License-Identifier: Apache-2.0 + +# Common fields for STM32 Ethernet peripherals. + +include: [ethernet-controller.yaml, pinctrl-device.yaml] + +properties: + reg: + required: true + interrupts: + required: true + clocks: + required: true + clock-names: + required: true + pinctrl-0: + required: true + pinctrl-names: + required: true diff --git a/dts/bindings/ethernet/st,stm32-ethernet.yaml b/dts/bindings/ethernet/st,stm32-ethernet.yaml index b0e5665f3374f..67f211194dc6b 100644 --- a/dts/bindings/ethernet/st,stm32-ethernet.yaml +++ b/dts/bindings/ethernet/st,stm32-ethernet.yaml @@ -1,22 +1,9 @@ # Copyright (c) 2020, Linaro Limited +# Copyright (c) 2024, STMicroelectronics # SPDX-License-Identifier: Apache-2.0 description: ST STM32 Ethernet compatible: "st,stm32-ethernet" -include: [ethernet-controller.yaml, pinctrl-device.yaml] - -properties: - reg: - required: true - interrupts: - required: true - clocks: - required: true - clock-names: - required: true - pinctrl-0: - required: true - pinctrl-names: - required: true +include: st,stm32-ethernet-common.yaml diff --git a/dts/bindings/ethernet/st,stm32h7-ethernet.yaml b/dts/bindings/ethernet/st,stm32h7-ethernet.yaml new file mode 100644 index 0000000000000..00f2addd21c20 --- /dev/null +++ b/dts/bindings/ethernet/st,stm32h7-ethernet.yaml @@ -0,0 +1,14 @@ +# Copyright (c) 2024, STMicroelectronics +# SPDX-License-Identifier: Apache-2.0 + +description: | + ST STM32H7 Ethernet + + This binding file describes the device tree properties required to configure + and use the Ethernet controller on STM32H7 and STM32H5 series microcontrollers. + The `st,stm32h7-ethernet` compatible string can be used for both series, + ensuring flexibility and ease of configuration. + +compatible: "st,stm32h7-ethernet" + +include: st,stm32-ethernet-common.yaml From eff9a87a7a6d7adb4d506808f632d8be87643678 Mon Sep 17 00:00:00 2001 From: IBEN EL HADJ MESSAOUD Marwa Date: Thu, 24 Oct 2024 17:33:28 +0200 Subject: [PATCH 1679/4482] drivers: ethernet: eth_stm32_hal: Use the compatible st_stm32h7_ethernet Replace "CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X" by the compatble st_stm32h7_ethernet Signed-off-by: IBEN EL HADJ MESSAOUD Marwa --- drivers/ethernet/eth_stm32_hal.c | 88 ++++++++++++++++---------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/drivers/ethernet/eth_stm32_hal.c b/drivers/ethernet/eth_stm32_hal.c index 35b191145496e..e59b8316fb6bd 100644 --- a/drivers/ethernet/eth_stm32_hal.c +++ b/drivers/ethernet/eth_stm32_hal.c @@ -65,7 +65,7 @@ static const struct device *eth_stm32_phy_dev = DEVICE_PHY_BY_NAME(0); #endif -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) #define PHY_BSR ((uint16_t)0x0001U) /*!< Transceiver Basic Status Register */ #define PHY_LINKED_STATUS ((uint16_t)0x0004U) /*!< Valid link established */ @@ -80,7 +80,7 @@ static const struct device *eth_stm32_phy_dev = DEVICE_PHY_BY_NAME(0); #define IS_ETH_DMATXDESC_OWN(dma_tx_desc) (dma_tx_desc->Status & \ ETH_DMATXDESC_OWN) -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ #define ETH_DMA_TX_TIMEOUT_MS 20U /* transmit timeout in milliseconds */ @@ -228,7 +228,7 @@ static inline void setup_mac_filter(ETH_HandleTypeDef *heth) { __ASSERT_NO_MSG(heth != NULL); -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) ETH_MACFilterConfigTypeDef MACFilterConf; HAL_ETH_GetMACFilterConfig(heth, &MACFilterConf); @@ -269,7 +269,7 @@ static inline void setup_mac_filter(ETH_HandleTypeDef *heth) tmp = heth->Instance->MACFFR; k_sleep(K_MSEC(1)); heth->Instance->MACFFR = tmp; -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X) */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ } #if defined(CONFIG_PTP_CLOCK_STM32_HAL) @@ -779,9 +779,9 @@ void HAL_ETH_ErrorCallback(ETH_HandleTypeDef *heth) __ASSERT_NO_MSG(heth != NULL); uint32_t dma_error; -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) uint32_t mac_error; -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ const uint32_t error_code = HAL_ETH_GetError(heth); struct eth_stm32_hal_dev_data *dev_data = @@ -791,7 +791,7 @@ void HAL_ETH_ErrorCallback(ETH_HandleTypeDef *heth) case HAL_ETH_ERROR_DMA: dma_error = HAL_ETH_GetDMAError(heth); -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) if ((dma_error & ETH_DMA_RX_WATCHDOG_TIMEOUT_FLAG) || (dma_error & ETH_DMA_RX_PROCESS_STOPPED_FLAG) || (dma_error & ETH_DMA_RX_BUFFER_UNAVAILABLE_FLAG)) { @@ -812,10 +812,10 @@ void HAL_ETH_ErrorCallback(ETH_HandleTypeDef *heth) (dma_error & ETH_DMASR_TJTS)) { eth_stats_update_errors_tx(dev_data->iface); } -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ break; -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) case HAL_ETH_ERROR_MAC: mac_error = HAL_ETH_GetMACError(heth); @@ -832,16 +832,16 @@ void HAL_ETH_ErrorCallback(ETH_HandleTypeDef *heth) eth_stats_update_errors_tx(dev_data->iface); } break; -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ } -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) dev_data->stats.error_details.rx_crc_errors = heth->Instance->MMCRCRCEPR; dev_data->stats.error_details.rx_align_errors = heth->Instance->MMCRAEPR; #else dev_data->stats.error_details.rx_crc_errors = heth->Instance->MMCRFCECR; dev_data->stats.error_details.rx_align_errors = heth->Instance->MMCRFAECR; -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ #endif /* CONFIG_NET_STATISTICS_ETHERNET */ } @@ -959,11 +959,11 @@ static int eth_initialize(const struct device *dev) /* Enable timestamping of RX packets. We enable all packets to be * timestamped to cover both IEEE 1588 and gPTP. */ -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) heth->Instance->MACTSCR |= ETH_MACTSCR_TSENALL; #else heth->Instance->PTPTSCR |= ETH_PTPTSCR_TSSARFE; -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ #endif /* CONFIG_PTP_CLOCK_STM32_HAL */ #if defined(CONFIG_ETH_STM32_HAL_API_V2) @@ -1052,13 +1052,13 @@ static void eth_stm32_mcast_filter(const struct device *dev, const struct ethern __ASSERT_NO_MSG(hash_index < ARRAY_SIZE(dev_data->hash_index_cnt)); -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) hash_table[0] = heth->Instance->MACHT0R; hash_table[1] = heth->Instance->MACHT1R; #else hash_table[0] = heth->Instance->MACHTLR; hash_table[1] = heth->Instance->MACHTHR; -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ if (filter->set) { dev_data->hash_index_cnt[hash_index]++; @@ -1075,13 +1075,13 @@ static void eth_stm32_mcast_filter(const struct device *dev, const struct ethern } } -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) heth->Instance->MACHT0R = hash_table[0]; heth->Instance->MACHT1R = hash_table[1]; #else heth->Instance->MACHTLR = hash_table[0]; heth->Instance->MACHTHR = hash_table[1]; -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ } #endif /* CONFIG_ETH_STM32_MULTICAST_FILTER */ @@ -1196,7 +1196,7 @@ static int eth_stm32_hal_set_config(const struct device *dev, break; case ETHERNET_CONFIG_TYPE_PROMISC_MODE: #if defined(CONFIG_NET_PROMISCUOUS_MODE) -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) if (config->promisc_mode) { heth->Instance->MACPFR |= ETH_MACPFR_PR; } else { @@ -1208,7 +1208,7 @@ static int eth_stm32_hal_set_config(const struct device *dev, } else { heth->Instance->MACFFR &= ~ETH_MACFFR_PM; } -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ ret = 0; #endif /* CONFIG_NET_PROMISCUOUS_MODE */ break; @@ -1330,7 +1330,7 @@ static int ptp_clock_stm32_set(const struct device *dev, key = irq_lock(); -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) heth->Instance->MACSTSUR = tm->second; heth->Instance->MACSTNUR = tm->nanosecond; heth->Instance->MACTSCR |= ETH_MACTSCR_TSINIT; @@ -1344,7 +1344,7 @@ static int ptp_clock_stm32_set(const struct device *dev, while (heth->Instance->PTPTSCR & ETH_PTPTSCR_TSSTI_Msk) { /* spin lock */ } -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ irq_unlock(key); @@ -1362,7 +1362,7 @@ static int ptp_clock_stm32_get(const struct device *dev, key = irq_lock(); -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) tm->second = heth->Instance->MACSTSR; tm->nanosecond = heth->Instance->MACSTNR; second_2 = heth->Instance->MACSTSR; @@ -1370,7 +1370,7 @@ static int ptp_clock_stm32_get(const struct device *dev, tm->second = heth->Instance->PTPTSHR; tm->nanosecond = heth->Instance->PTPTSLR; second_2 = heth->Instance->PTPTSHR; -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ irq_unlock(key); @@ -1398,7 +1398,7 @@ static int ptp_clock_stm32_adjust(const struct device *dev, int increment) } else { key = irq_lock(); -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) heth->Instance->MACSTSUR = 0; if (increment >= 0) { heth->Instance->MACSTNUR = increment; @@ -1420,7 +1420,7 @@ static int ptp_clock_stm32_adjust(const struct device *dev, int increment) while (heth->Instance->PTPTSCR & ETH_PTPTSCR_TSSTU_Msk) { /* spin lock */ } -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ ret = 0; irq_unlock(key); @@ -1459,7 +1459,7 @@ static int ptp_clock_stm32_rate_adjust(const struct device *dev, double ratio) /* Update addend register */ addend_val = UINT32_MAX * (double)eth_dev_data->clk_ratio * ratio; -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) heth->Instance->MACTSAR = addend_val; heth->Instance->MACTSCR |= ETH_MACTSCR_TSADDREG; while (heth->Instance->MACTSCR & ETH_MACTSCR_TSADDREG_Msk) { @@ -1471,7 +1471,7 @@ static int ptp_clock_stm32_rate_adjust(const struct device *dev, double ratio) while (heth->Instance->PTPTSCR & ETH_PTPTSCR_TSARU_Msk) { /* spin lock */ } -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ ret = 0; @@ -1504,26 +1504,26 @@ static int ptp_stm32_init(const struct device *port) ptp_context->eth_dev_data = eth_dev_data; /* Mask the Timestamp Trigger interrupt */ -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) heth->Instance->MACIER &= ~(ETH_MACIER_TSIE); #else heth->Instance->MACIMR &= ~(ETH_MACIMR_TSTIM); -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ /* Enable timestamping */ -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) heth->Instance->MACTSCR |= ETH_MACTSCR_TSENA; #else heth->Instance->PTPTSCR |= ETH_PTPTSCR_TSE; -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ /* Query ethernet clock rate */ ret = clock_control_get_rate(eth_dev_data->clock, -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) (clock_control_subsys_t)ð_cfg->pclken, #else (clock_control_subsys_t)ð_cfg->pclken_ptp, -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ &ptp_hclk_rate); if (ret) { LOG_ERR("Failed to query ethernet clock"); @@ -1540,11 +1540,11 @@ static int ptp_stm32_init(const struct device *port) LOG_ERR("PTP clock period is more than %d nanoseconds", UINT8_MAX); return -EINVAL; } -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) heth->Instance->MACSSIR = ss_incr_ns << ETH_MACMACSSIR_SSINC_Pos; #else heth->Instance->PTPSSIR = ss_incr_ns; -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ /* Program timestamp addend register */ eth_dev_data->clk_ratio = @@ -1559,7 +1559,7 @@ static int ptp_stm32_init(const struct device *port) eth_dev_data->clk_ratio_adj = 1.0f; addend_val = UINT32_MAX * eth_dev_data->clk_ratio * eth_dev_data->clk_ratio_adj; -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) heth->Instance->MACTSAR = addend_val; heth->Instance->MACTSCR |= ETH_MACTSCR_TSADDREG; while (heth->Instance->MACTSCR & ETH_MACTSCR_TSADDREG_Msk) { @@ -1571,24 +1571,24 @@ static int ptp_stm32_init(const struct device *port) while (heth->Instance->PTPTSCR & ETH_PTPTSCR_TSARU_Msk) { k_yield(); } -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ /* Enable fine timestamp correction method */ -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) heth->Instance->MACTSCR |= ETH_MACTSCR_TSCFUPDT; #else heth->Instance->PTPTSCR |= ETH_PTPTSCR_TSFCU; -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ /* Enable nanosecond rollover into a new second */ -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) heth->Instance->MACTSCR |= ETH_MACTSCR_TSCTRLSSR; #else heth->Instance->PTPTSCR |= ETH_PTPTSCR_TSSSR; -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ /* Initialize timestamp */ -#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) heth->Instance->MACSTSUR = 0; heth->Instance->MACSTNUR = 0; heth->Instance->MACTSCR |= ETH_MACTSCR_TSINIT; @@ -1602,7 +1602,7 @@ static int ptp_stm32_init(const struct device *port) while (heth->Instance->PTPTSCR & ETH_PTPTSCR_TSSTI_Msk) { k_yield(); } -#endif /* CONFIG_SOC_SERIES_STM32H7X || CONFIG_SOC_SERIES_STM32H5X */ +#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ #if defined(CONFIG_ETH_STM32_HAL_API_V2) /* Set PTP Configuration done */ From cf367686f6e4a3f63581ea836e6d9db7f503a819 Mon Sep 17 00:00:00 2001 From: IBEN EL HADJ MESSAOUD Marwa Date: Thu, 24 Oct 2024 17:37:47 +0200 Subject: [PATCH 1680/4482] drivers: ethernet: eth_stm32_hal: Correct indentation Adjusted indentation to follow consistent coding standards. Signed-off-by: IBEN EL HADJ MESSAOUD Marwa --- drivers/ethernet/eth_stm32_hal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/ethernet/eth_stm32_hal.c b/drivers/ethernet/eth_stm32_hal.c index e59b8316fb6bd..59adaad032c30 100644 --- a/drivers/ethernet/eth_stm32_hal.c +++ b/drivers/ethernet/eth_stm32_hal.c @@ -1520,11 +1520,11 @@ static int ptp_stm32_init(const struct device *port) /* Query ethernet clock rate */ ret = clock_control_get_rate(eth_dev_data->clock, #if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) - (clock_control_subsys_t)ð_cfg->pclken, + (clock_control_subsys_t)ð_cfg->pclken, #else - (clock_control_subsys_t)ð_cfg->pclken_ptp, + (clock_control_subsys_t)ð_cfg->pclken_ptp, #endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ - &ptp_hclk_rate); + &ptp_hclk_rate); if (ret) { LOG_ERR("Failed to query ethernet clock"); return -EIO; From 4be18975193cf967de7121705d418456a503467a Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Sat, 12 Oct 2024 16:51:40 -0300 Subject: [PATCH 1681/4482] drivers: counter: systimer: esp32c2: Fix clock parameters Fix clock source frequency for systimer and GP timer. Signed-off-by: Raffael Rostagno --- drivers/counter/counter_esp32_tmr.c | 17 ++++++++++++----- soc/espressif/common/Kconfig.defconfig | 8 ++++++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/counter/counter_esp32_tmr.c b/drivers/counter/counter_esp32_tmr.c index 90ad22df3fe88..bef1da9a2113f 100644 --- a/drivers/counter/counter_esp32_tmr.c +++ b/drivers/counter/counter_esp32_tmr.c @@ -256,6 +256,13 @@ static void counter_esp32_isr(void *arg) timer_ll_clear_intr_status(data->hal_ctx.dev, TIMER_LL_EVENT_ALARM(data->hal_ctx.timer_id)); } +#if defined(CONFIG_SOC_SERIES_ESP32C2) +#define CLK_LL_PLL_40M_FREQ MHZ(40) +#define CLOCK_SOURCE_FREQ CLK_LL_PLL_40M_FREQ +#else +#define CLOCK_SOURCE_FREQ APB_CLK_FREQ +#endif + #define ESP32_COUNTER_GET_CLK_DIV(idx) \ (((DT_INST_PROP(idx, prescaler) & UINT16_MAX) < 2) ? \ 2 : (DT_INST_PROP(idx, prescaler) & UINT16_MAX)) @@ -265,11 +272,11 @@ static void counter_esp32_isr(void *arg) static struct counter_esp32_data counter_data_##idx; \ \ static const struct counter_esp32_config counter_config_##idx = { \ - .counter_info = { \ - .max_top_value = UINT32_MAX, \ - .freq = (APB_CLK_FREQ / ESP32_COUNTER_GET_CLK_DIV(idx)), \ - .flags = COUNTER_CONFIG_INFO_COUNT_UP, \ - .channels = 1 \ + .counter_info = { \ + .max_top_value = UINT32_MAX, \ + .freq = (CLOCK_SOURCE_FREQ / ESP32_COUNTER_GET_CLK_DIV(idx)), \ + .flags = COUNTER_CONFIG_INFO_COUNT_UP, \ + .channels = 1 \ }, \ .config = { \ .alarm_en = TIMER_ALARM_DIS, \ diff --git a/soc/espressif/common/Kconfig.defconfig b/soc/espressif/common/Kconfig.defconfig index b474c8cd05d52..9e33c4ff7ea3e 100644 --- a/soc/espressif/common/Kconfig.defconfig +++ b/soc/espressif/common/Kconfig.defconfig @@ -21,9 +21,13 @@ config ISR_STACK_SIZE config ATOMIC_OPERATIONS_C default y +config XTAL_FREQ_HZ + int + default $(dt_node_int_prop_int,/cpus/cpu@0,xtal-freq) + config SYS_CLOCK_HW_CYCLES_PER_SEC - default 12000000 if SOC_SERIES_ESP32C2 - default 16000000 if SOC_SERIES_ESP32C3 || SOC_SERIES_ESP32C6 + default 10400000 if XTAL_FREQ_HZ = 26000000 + default 16000000 if XTAL_FREQ_HZ = 40000000 config SYS_CLOCK_TICKS_PER_SEC default 1000 From 03dc880aa622af375a3243211c98528cba776d7a Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Wed, 16 Oct 2024 17:15:57 -0300 Subject: [PATCH 1682/4482] drivers: counter: esp32: Clang run Clang run on driver for formatting Signed-off-by: Raffael Rostagno --- drivers/counter/counter_esp32_tmr.c | 78 +++++++++++++---------------- 1 file changed, 35 insertions(+), 43 deletions(-) diff --git a/drivers/counter/counter_esp32_tmr.c b/drivers/counter/counter_esp32_tmr.c index bef1da9a2113f..34ddec926174d 100644 --- a/drivers/counter/counter_esp32_tmr.c +++ b/drivers/counter/counter_esp32_tmr.c @@ -100,9 +100,9 @@ static int counter_esp32_init(const struct device *dev) k_spin_unlock(&lock, key); int ret = esp_intr_alloc(cfg->irq_source, - ESP_PRIO_TO_FLAGS(cfg->irq_priority) | - ESP_INT_FLAGS_CHECK(cfg->irq_flags), - (ISR_HANDLER)counter_esp32_isr, (void *)dev, NULL); + ESP_PRIO_TO_FLAGS(cfg->irq_priority) | + ESP_INT_FLAGS_CHECK(cfg->irq_flags), + (ISR_HANDLER)counter_esp32_isr, (void *)dev, NULL); if (ret != 0) { LOG_ERR("could not allocate interrupt (err %d)", ret); @@ -202,8 +202,7 @@ static int counter_esp32_cancel_alarm(const struct device *dev, uint8_t chan_id) return 0; } -static int counter_esp32_set_top_value(const struct device *dev, - const struct counter_top_cfg *cfg) +static int counter_esp32_set_top_value(const struct device *dev, const struct counter_top_cfg *cfg) { const struct counter_esp32_config *config = dev->config; @@ -263,44 +262,37 @@ static void counter_esp32_isr(void *arg) #define CLOCK_SOURCE_FREQ APB_CLK_FREQ #endif -#define ESP32_COUNTER_GET_CLK_DIV(idx) \ - (((DT_INST_PROP(idx, prescaler) & UINT16_MAX) < 2) ? \ - 2 : (DT_INST_PROP(idx, prescaler) & UINT16_MAX)) - -#define ESP32_COUNTER_INIT(idx) \ - \ - static struct counter_esp32_data counter_data_##idx; \ - \ - static const struct counter_esp32_config counter_config_##idx = { \ - .counter_info = { \ - .max_top_value = UINT32_MAX, \ - .freq = (CLOCK_SOURCE_FREQ / ESP32_COUNTER_GET_CLK_DIV(idx)), \ - .flags = COUNTER_CONFIG_INFO_COUNT_UP, \ - .channels = 1 \ - }, \ - .config = { \ - .alarm_en = TIMER_ALARM_DIS, \ - .counter_en = TIMER_START, \ - .intr_type = TIMER_INTR_LEVEL, \ - .counter_dir = TIMER_COUNT_UP, \ - .auto_reload = TIMER_AUTORELOAD_DIS, \ - .divider = ESP32_COUNTER_GET_CLK_DIV(idx), \ - }, \ - .group = DT_INST_PROP(idx, group), \ - .index = DT_INST_PROP(idx, index), \ - .irq_source = DT_INST_IRQ_BY_IDX(idx, 0, irq), \ - .irq_priority = DT_INST_IRQ_BY_IDX(idx, 0, priority), \ - .irq_flags = DT_INST_IRQ_BY_IDX(idx, 0, flags) \ - }; \ - \ - \ - DEVICE_DT_INST_DEFINE(idx, \ - counter_esp32_init, \ - NULL, \ - &counter_data_##idx, \ - &counter_config_##idx, \ - PRE_KERNEL_1, \ - CONFIG_COUNTER_INIT_PRIORITY, \ +#define ESP32_COUNTER_GET_CLK_DIV(idx) \ + (((DT_INST_PROP(idx, prescaler) & UINT16_MAX) < 2) \ + ? 2 \ + : (DT_INST_PROP(idx, prescaler) & UINT16_MAX)) + +#define ESP32_COUNTER_INIT(idx) \ + \ + static struct counter_esp32_data counter_data_##idx; \ + \ + static const struct counter_esp32_config counter_config_##idx = { \ + .counter_info = {.max_top_value = UINT32_MAX, \ + .freq = (CLOCK_SOURCE_FREQ / ESP32_COUNTER_GET_CLK_DIV(idx)), \ + .flags = COUNTER_CONFIG_INFO_COUNT_UP, \ + .channels = 1}, \ + .config = \ + { \ + .alarm_en = TIMER_ALARM_DIS, \ + .counter_en = TIMER_START, \ + .intr_type = TIMER_INTR_LEVEL, \ + .counter_dir = TIMER_COUNT_UP, \ + .auto_reload = TIMER_AUTORELOAD_DIS, \ + .divider = ESP32_COUNTER_GET_CLK_DIV(idx), \ + }, \ + .group = DT_INST_PROP(idx, group), \ + .index = DT_INST_PROP(idx, index), \ + .irq_source = DT_INST_IRQ_BY_IDX(idx, 0, irq), \ + .irq_priority = DT_INST_IRQ_BY_IDX(idx, 0, priority), \ + .irq_flags = DT_INST_IRQ_BY_IDX(idx, 0, flags)}; \ + \ + DEVICE_DT_INST_DEFINE(idx, counter_esp32_init, NULL, &counter_data_##idx, \ + &counter_config_##idx, PRE_KERNEL_1, CONFIG_COUNTER_INIT_PRIORITY, \ &counter_api); DT_INST_FOREACH_STATUS_OKAY(ESP32_COUNTER_INIT); From 91f509b984b05f709ba48704e9da6ab2504b393f Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Tue, 22 Oct 2024 10:26:33 -0700 Subject: [PATCH 1683/4482] llext: rename symbol struct identifiers with SLID Similar to commit aeec014cbe5ff4d93b128fb6f218c41965ffac3b, this renames the identifiers to have prefix of "__llext_sym_name_" instead of having suffix of "_sym_name" in LLEXT symbol tables for SLID-enabled applications. This is needed to avoid confusing the gen_device_deps.py script as it searches for objects (e.g. __device_dts_ord_*) by matching name stems without regard to suffixes. Signed-off-by: Daniel Leung --- include/zephyr/llext/symbol.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/zephyr/llext/symbol.h b/include/zephyr/llext/symbol.h index 109586709fe3d..9eb847b97fcf0 100644 --- a/include/zephyr/llext/symbol.h +++ b/include/zephyr/llext/symbol.h @@ -123,10 +123,10 @@ struct llext_symtable { /* SLID-enabled LLEXT application: export symbols, names in separate section */ #define Z_EXPORT_SYMBOL(x) \ static const char Z_GENERIC_SECTION("llext_exports_strtab") __used \ - x ## _sym_name[] = STRINGIFY(x); \ + __llext_sym_name_ ## x[] = STRINGIFY(x); \ static const STRUCT_SECTION_ITERABLE(llext_const_symbol, \ __llext_sym_ ## x) = { \ - .name = x ## _sym_name, .addr = (const void *)&x, \ + .name = __llext_sym_name_ ## x, .addr = (const void *)&x, \ } #elif defined(CONFIG_LLEXT) /* LLEXT application: export symbols */ From e84cfa5095844aaa310d6ef2efb7f7ebf325b05f Mon Sep 17 00:00:00 2001 From: Michal Smola Date: Tue, 8 Oct 2024 10:54:19 +0200 Subject: [PATCH 1684/4482] dts: usb: Add no-voltage-regulator property to nxp,kinetis-usbd binding Some NXP SoC's do not have USB voltage regulator present. Add property to indicate it. Negative logic is used, because the regulator is present in great majority of SoC's, and thus the new property can be added only for SoC's without the regulator. Signed-off-by: Michal Smola --- dts/bindings/usb/nxp,kinetis-usbd.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dts/bindings/usb/nxp,kinetis-usbd.yaml b/dts/bindings/usb/nxp,kinetis-usbd.yaml index 2ef1b74c2e12b..284fee6d773f5 100644 --- a/dts/bindings/usb/nxp,kinetis-usbd.yaml +++ b/dts/bindings/usb/nxp,kinetis-usbd.yaml @@ -14,3 +14,7 @@ properties: interrupts: required: true + + no-voltage-regulator: + type: boolean + description: Indicates that USB voltage regulator is not present. From 13e0b1fa2b5d1a4db212f6bbc9b6937ed51ac6dd Mon Sep 17 00:00:00 2001 From: Michal Smola Date: Mon, 30 Sep 2024 15:53:12 +0200 Subject: [PATCH 1685/4482] drivers: usb: Use VREG only if present for NXP Kinetis usb Some NXP socs with Kinetis USB do not have USB voltage regulator. It causes build error in USB samples. Fix it by enabling and disabling the voltage regulator only if present. Signed-off-by: Michal Smola --- drivers/usb/device/usb_dc_kinetis.c | 2 ++ drivers/usb/udc/udc_kinetis.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/drivers/usb/device/usb_dc_kinetis.c b/drivers/usb/device/usb_dc_kinetis.c index 36734580e6c97..c6ff25aabde50 100644 --- a/drivers/usb/device/usb_dc_kinetis.c +++ b/drivers/usb/device/usb_dc_kinetis.c @@ -147,8 +147,10 @@ static inline uint8_t get_bdt_idx(uint8_t ep, uint8_t odd) static int kinetis_usb_init(void) { +#if !DT_INST_PROP(0, no_voltage_regulator) /* enable USB voltage regulator */ SIM->SOPT1 |= SIM_SOPT1_USBREGEN_MASK; +#endif USB0->USBTRC0 |= USB_USBTRC0_USBRESET_MASK; k_busy_wait(2000); diff --git a/drivers/usb/udc/udc_kinetis.c b/drivers/usb/udc/udc_kinetis.c index 6331110d8b72d..5a93d4a8b3a59 100644 --- a/drivers/usb/udc/udc_kinetis.c +++ b/drivers/usb/udc/udc_kinetis.c @@ -976,8 +976,10 @@ static int usbfsotg_init(const struct device *dev) const struct usbfsotg_config *config = dev->config; USB_Type *base = config->base; +#if !DT_ANY_INST_HAS_PROP_STATUS_OKAY(no_voltage_regulator) /* (FIXME) Enable USB voltage regulator */ SIM->SOPT1 |= SIM_SOPT1_USBREGEN_MASK; +#endif /* Reset USB module */ base->USBTRC0 |= USB_USBTRC0_USBRESET_MASK; @@ -1057,8 +1059,10 @@ static int usbfsotg_shutdown(const struct device *dev) /* Disable USB module */ config->base->CTL = 0; +#if !DT_ANY_INST_HAS_PROP_STATUS_OKAY(no_voltage_regulator) /* Disable USB voltage regulator */ SIM->SOPT1 &= ~SIM_SOPT1_USBREGEN_MASK; +#endif return 0; } From 8ad3c99dab639c4a16217df93f1e7f6f3b8c49db Mon Sep 17 00:00:00 2001 From: Michal Smola Date: Mon, 30 Sep 2024 16:12:56 +0200 Subject: [PATCH 1686/4482] soc: nxp mcxc: Enable usb clock USB clock is not enabled for NXP mcxc series. Enable it. Signed-off-by: Michal Smola --- soc/nxp/mcx/mcxc/soc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/soc/nxp/mcx/mcxc/soc.c b/soc/nxp/mcx/mcxc/soc.c index bd3f6ae96b79a..4b9c58a88785d 100644 --- a/soc/nxp/mcx/mcxc/soc.c +++ b/soc/nxp/mcx/mcxc/soc.c @@ -15,6 +15,8 @@ /******************************************************************************* * Definitions ******************************************************************************/ +#define IRC48M_CLK_FREQ (48000000UL) + #define MCG_NODE DT_NODELABEL(mcg) #define OSC_NODE DT_NODELABEL(osc) @@ -105,6 +107,9 @@ static void clock_init(void) */ CLOCK_SetTpmClock(TPM_CLOCK_SEL(DT_COMPAT_GET_ANY_STATUS_OKAY(nxp_kinetis_tpm))); #endif +#if CONFIG_USB_KINETIS || CONFIG_UDC_KINETIS + CLOCK_EnableUsbfs0Clock(kCLOCK_UsbSrcIrc48M, IRC48M_CLK_FREQ); +#endif } void soc_early_init_hook(void) From 4f4020344c2fdbeacd76084560c08fc7c06e6243 Mon Sep 17 00:00:00 2001 From: Michal Smola Date: Tue, 1 Oct 2024 12:00:25 +0200 Subject: [PATCH 1687/4482] dts: nxp mcxc: Add usb configuration USB configuration is missing in Devicetree for NXP MCX C series. Add the configuration to common and SoC specific dtsi file. Delete usb node for SoCs without USB support. Signed-off-by: Michal Smola --- dts/arm/nxp/nxp_mcxc141.dtsi | 2 ++ dts/arm/nxp/nxp_mcxc142.dtsi | 2 ++ dts/arm/nxp/nxp_mcxc242.dtsi | 4 ++++ dts/arm/nxp/nxp_mcxc_common.dtsi | 9 +++++++++ 4 files changed, 17 insertions(+) diff --git a/dts/arm/nxp/nxp_mcxc141.dtsi b/dts/arm/nxp/nxp_mcxc141.dtsi index 01dd42e0c6f92..a8918a521e79a 100644 --- a/dts/arm/nxp/nxp_mcxc141.dtsi +++ b/dts/arm/nxp/nxp_mcxc141.dtsi @@ -13,3 +13,5 @@ &flash0 { reg = <0 DT_SIZE_K(32)>; }; + +/delete-node/ &usb; diff --git a/dts/arm/nxp/nxp_mcxc142.dtsi b/dts/arm/nxp/nxp_mcxc142.dtsi index 1f48b3ae7b824..ae7f90eb066cc 100644 --- a/dts/arm/nxp/nxp_mcxc142.dtsi +++ b/dts/arm/nxp/nxp_mcxc142.dtsi @@ -13,3 +13,5 @@ &flash0 { reg = <0 DT_SIZE_K(64)>; }; + +/delete-node/ &usb; diff --git a/dts/arm/nxp/nxp_mcxc242.dtsi b/dts/arm/nxp/nxp_mcxc242.dtsi index 1f48b3ae7b824..1e493364e7345 100644 --- a/dts/arm/nxp/nxp_mcxc242.dtsi +++ b/dts/arm/nxp/nxp_mcxc242.dtsi @@ -13,3 +13,7 @@ &flash0 { reg = <0 DT_SIZE_K(64)>; }; + +&usb { + no-voltage-regulator; +}; diff --git a/dts/arm/nxp/nxp_mcxc_common.dtsi b/dts/arm/nxp/nxp_mcxc_common.dtsi index 92c7c8a86bd6b..ef0b7f807e1e5 100644 --- a/dts/arm/nxp/nxp_mcxc_common.dtsi +++ b/dts/arm/nxp/nxp_mcxc_common.dtsi @@ -213,6 +213,15 @@ status = "disabled"; }; + usb: usbd@40072000 { + compatible = "nxp,kinetis-usbd"; + reg = <0x40072000 0x1000>; + interrupts = <24 1>; + interrupt-names = "usb"; + num-bidir-endpoints = <16>; + status = "disabled"; + }; + lpuart0: uart@40054000 { compatible = "nxp,kinetis-lpuart"; reg = <0x40054000 0x1000>; From 361d0ba2473771f450e449c771d45310a9405f40 Mon Sep 17 00:00:00 2001 From: Michal Smola Date: Tue, 1 Oct 2024 12:37:09 +0200 Subject: [PATCH 1688/4482] boards: frdm_mcxc242: Add usb support mcxc242 has usb device capability. Add usb to board documentation and to the yaml file. Enable and configure it in board dts. Signed-off-by: Michal Smola --- boards/nxp/frdm_mcxc242/doc/index.rst | 2 ++ boards/nxp/frdm_mcxc242/frdm_mcxc242.dts | 5 +++++ boards/nxp/frdm_mcxc242/frdm_mcxc242.yaml | 2 ++ 3 files changed, 9 insertions(+) diff --git a/boards/nxp/frdm_mcxc242/doc/index.rst b/boards/nxp/frdm_mcxc242/doc/index.rst index feda4ecf3fabd..447cebd8dfa8b 100644 --- a/boards/nxp/frdm_mcxc242/doc/index.rst +++ b/boards/nxp/frdm_mcxc242/doc/index.rst @@ -58,6 +58,8 @@ The ``frdm_mcxc242`` board target supports the following hardware features: +-----------+------------+-------------------------------------+ | I2C | on-chip | i2c | +-----------+------------+-------------------------------------+ +| USB | on-chip | USB device | ++-----------+------------+-------------------------------------+ | PWM | on-chip | pwm | +-----------+------------+-------------------------------------+ | ADC | on-chip | adc | diff --git a/boards/nxp/frdm_mcxc242/frdm_mcxc242.dts b/boards/nxp/frdm_mcxc242/frdm_mcxc242.dts index 3f0bb0f5956ef..7c4a9da500447 100644 --- a/boards/nxp/frdm_mcxc242/frdm_mcxc242.dts +++ b/boards/nxp/frdm_mcxc242/frdm_mcxc242.dts @@ -143,6 +143,11 @@ i2c1: &i2c1 { }; }; +zephyr_udc0: &usb { + status = "okay"; + num-bidir-endpoints = <8>; +}; + &tpm1 { status = "okay"; pinctrl-0 = <&pinmux_tpm1>; diff --git a/boards/nxp/frdm_mcxc242/frdm_mcxc242.yaml b/boards/nxp/frdm_mcxc242/frdm_mcxc242.yaml index 49dc9c741cb22..9fa844462a1ba 100644 --- a/boards/nxp/frdm_mcxc242/frdm_mcxc242.yaml +++ b/boards/nxp/frdm_mcxc242/frdm_mcxc242.yaml @@ -18,6 +18,8 @@ supported: - gpio - uart - i2c + - usb_device + - usbd - pwm - adc - counter From c76b984aae3b2cf053f4a970601b73a694e13302 Mon Sep 17 00:00:00 2001 From: Michal Smola Date: Tue, 1 Oct 2024 15:04:32 +0200 Subject: [PATCH 1689/4482] samples: usb: Exclude frdm_mcxc242 platform from dfu sample frdm_mcxc242 does not support MCUboot. Exclude the platform from dfu sample. Signed-off-by: Michal Smola --- samples/subsys/usb/dfu/sample.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/subsys/usb/dfu/sample.yaml b/samples/subsys/usb/dfu/sample.yaml index 122a8f63c7fb4..a298d5b5a6e8b 100644 --- a/samples/subsys/usb/dfu/sample.yaml +++ b/samples/subsys/usb/dfu/sample.yaml @@ -18,6 +18,7 @@ common: - teensy41 - b_u585i_iot02a - frdm_kl25z + - frdm_mcxc242 - lpcxpresso55s69/lpc55s69/cpu0 - stm32l562e_dk/stm32l562xx/ns depends_on: usb_device From 31093d24a76f184abfed369aa3dbe1228d99374a Mon Sep 17 00:00:00 2001 From: Charles Dias Date: Tue, 3 Sep 2024 15:03:45 -0300 Subject: [PATCH 1690/4482] boards: shields: add suport for weact_ov2640_cam_module Add support for WeAct Studio MiniSTM32H7xx OV2640 camera sensor. Signed-off-by: Charles Dias --- .../weact_ov2640_cam_module/Kconfig.shield | 5 ++ .../boards/mini_stm32h743.conf | 8 ++ .../boards/mini_stm32h743.overlay | 59 +++++++++++++ .../weact_ov2640_cam_module/doc/index.rst | 82 ++++++++++++++++++ .../weact_ov2640_cam_module/doc/ov2640.webp | Bin 0 -> 38306 bytes .../weact_ov2640_cam_module.overlay | 44 ++++++++++ .../weact/mini_stm32h743/mini_stm32h743.dts | 35 ++++++++ .../gpio/weact,dcmi-camera-connector.yaml | 24 +++++ 8 files changed, 257 insertions(+) create mode 100644 boards/shields/weact_ov2640_cam_module/Kconfig.shield create mode 100644 boards/shields/weact_ov2640_cam_module/boards/mini_stm32h743.conf create mode 100644 boards/shields/weact_ov2640_cam_module/boards/mini_stm32h743.overlay create mode 100644 boards/shields/weact_ov2640_cam_module/doc/index.rst create mode 100644 boards/shields/weact_ov2640_cam_module/doc/ov2640.webp create mode 100644 boards/shields/weact_ov2640_cam_module/weact_ov2640_cam_module.overlay create mode 100644 dts/bindings/gpio/weact,dcmi-camera-connector.yaml diff --git a/boards/shields/weact_ov2640_cam_module/Kconfig.shield b/boards/shields/weact_ov2640_cam_module/Kconfig.shield new file mode 100644 index 0000000000000..a00d675d780e4 --- /dev/null +++ b/boards/shields/weact_ov2640_cam_module/Kconfig.shield @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Charles Dias +# SPDX-License-Identifier: Apache-2.0 + +config SHIELD_WEACT_OV2640_CAM_MODULE + def_bool $(shields_list_contains,weact_ov2640_cam_module) diff --git a/boards/shields/weact_ov2640_cam_module/boards/mini_stm32h743.conf b/boards/shields/weact_ov2640_cam_module/boards/mini_stm32h743.conf new file mode 100644 index 0000000000000..48b3a8db88d7a --- /dev/null +++ b/boards/shields/weact_ov2640_cam_module/boards/mini_stm32h743.conf @@ -0,0 +1,8 @@ +# +# Copyright (c) 2024 Charles Dias +# +# SPDX-License-Identifier: Apache-2.0 +# + +CONFIG_VIDEO_HFLIP=y +CONFIG_VIDEO_VFLIP=y diff --git a/boards/shields/weact_ov2640_cam_module/boards/mini_stm32h743.overlay b/boards/shields/weact_ov2640_cam_module/boards/mini_stm32h743.overlay new file mode 100644 index 0000000000000..e99237276078b --- /dev/null +++ b/boards/shields/weact_ov2640_cam_module/boards/mini_stm32h743.overlay @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2024 Charles Dias + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* AHB clocks must respect the minimum ratio AHB / DCMI_PIXCLK of 2.5 (AN5020 - Rev 3). + * The OV2640 PCLK is around 72 MHz for QQVGA resolution (160x120) with MCO1_SEL_HSI48 + * and MCO1_PRE_DIV_4. + */ +&rcc { + clocks = <&pll>; + clock-frequency = ; + d1cpre = <1>; + hpre = <1>; + d1ppre = <2>; + d2ppre1 = <2>; + d2ppre2 = <2>; + d3ppre = <2>; +}; + +/* See reference manual (RM0433 Rev 8) page 390: + * 100: HSI48 clock selected (hsi48_ck) + */ +#define MCO1_SEL_HSI48 4 + + /* See reference manual (RM0433 Rev 8) page 391: + * 0100: division by 4 + */ +#define MCO1_PRE_DIV_4 4 + +&mco1 { + status = "okay"; + clocks = <&rcc STM32_SRC_HSI48 MCO1_SEL(MCO1_SEL_HSI48)>; + prescaler = ; + pinctrl-0 = <&rcc_mco_1_pa8>; + pinctrl-names = "default"; +}; + +&zephyr_camera_i2c { + ov2640: ov2640@30 { + supply-gpios = <&dcmi_camera_connector 8 GPIO_ACTIVE_HIGH>; + clock-rate-control = <0x80>; + }; +}; + +&zephyr_camera_dvp { + dmas = <&dma1 0 75 (STM32_DMA_PERIPH_TO_MEMORY | STM32_DMA_PERIPH_NO_INC | + STM32_DMA_MEM_INC | STM32_DMA_PERIPH_8BITS | STM32_DMA_MEM_32BITS | + STM32_DMA_PRIORITY_HIGH) STM32_DMA_FIFO_1_4>; +}; + +&dma1 { + status = "okay"; +}; + +&dmamux1 { + status = "okay"; +}; diff --git a/boards/shields/weact_ov2640_cam_module/doc/index.rst b/boards/shields/weact_ov2640_cam_module/doc/index.rst new file mode 100644 index 0000000000000..1609fc5a23d94 --- /dev/null +++ b/boards/shields/weact_ov2640_cam_module/doc/index.rst @@ -0,0 +1,82 @@ +.. _weact_ov2640_cam_module: + +WeAct Studio MiniSTM32H7xx OV2640 Camera Sensor +############################################### + +Overview +******** + +The OV2640 camera sensor is designed to interface with the WeAct Studio +MiniSTM32H7xx boards, providing camera sensor capabilities. This shield +integrates the OV2640 camera module, which is capable of capturing images +and video with a resolution of up to 2 megapixels. + +.. figure:: ov2640.webp + :align: center + :alt: OV2640 Camera Sensor + +More information about the OV2640 camera sensor can be found on the +`MiniSTM32H7xx GitHub`_ and in the `OV2640 datasheet`_. + +Requirements +************ + +Your board needs to have a ``zephyr_camera_dvp`` device tree label to work with this shield. + +Pin Assignments +=============== + +The shield connects to the WeAct Studio MiniSTM32H7xx board via the +following pins: + ++--------------+-----------+-----------------------------+ +| Shield Pin | Board Pin | Function | ++==============+===========+=============================+ +| DCMI_D0 | PC6 | DCMI Data Line 0 | ++--------------+-----------+-----------------------------+ +| DCMI_D1 | PC7 | DCMI Data Line 1 | ++--------------+-----------+-----------------------------+ +| DCMI_D2 | PE0 | DCMI Data Line 2 | ++--------------+-----------+-----------------------------+ +| DCMI_D3 | PE1 | DCMI Data Line 3 | ++--------------+-----------+-----------------------------+ +| DCMI_D4 | PE4 | DCMI Data Line 4 | ++--------------+-----------+-----------------------------+ +| DCMI_D5 | PD3 | DCMI Data Line 5 | ++--------------+-----------+-----------------------------+ +| DCMI_D6 | PE5 | DCMI Data Line 6 | ++--------------+-----------+-----------------------------+ +| DCMI_D7 | PE6 | DCMI Data Line 7 | ++--------------+-----------+-----------------------------+ +| DCMI_HSYNC | PA4 | DCMI HSYNC | ++--------------+-----------+-----------------------------+ +| DCMI_VSYNC | PB7 | DCMI VSYNC | ++--------------+-----------+-----------------------------+ +| DCMI_PIXCLK | PA6 | DCMI Pixel Clock | ++--------------+-----------+-----------------------------+ +| I2C_SDA | PB9 | I2C Data Line | ++--------------+-----------+-----------------------------+ +| I2C_SCL | PB8 | I2C Clock Line | ++--------------+-----------+-----------------------------+ +| RCC_MCO1 | PA8 | Clock Output | ++--------------+-----------+-----------------------------+ +| SUPPLY | PA7 | Power Supply Control (GPIO) | ++--------------+-----------+-----------------------------+ + +Programming +*********** + +Set ``--shield weact_ov2640_cam_module`` when you invoke ``west build``. For example: + +.. zephyr-app-commands:: + :zephyr-app: samples/drivers/video/capture_to_lvgl/ + :board: mini_stm32h743 + :shield: weact_ov2640_cam_module + :gen-args: -DCONFIG_BOOT_DELAY=2000 + :goals: build + +.. _MiniSTM32H7xx GitHub: + https://github.com/WeActStudio/MiniSTM32H7xx + +.. _OV2640 datasheet: + https://www.uctronics.com/download/cam_module/OV2640DS.pdf diff --git a/boards/shields/weact_ov2640_cam_module/doc/ov2640.webp b/boards/shields/weact_ov2640_cam_module/doc/ov2640.webp new file mode 100644 index 0000000000000000000000000000000000000000..8043befcf75b02b27fe4fb66723b6e2fc71f3d2e GIT binary patch literal 38306 zcmV(tKh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{)HFz0QXXv_dXQHvEx~D0YvFKkPu?Cp7HGLz0D`i$ z#3fsO+z`7(stmV{1v3&GNH6)&b|I#Os3oMap&Z=}g?Gv$ra5?7%QLGI<=GlhVrk_f zl3rJ1{(MBqTpDJI_^FdFt~|h^CzkSO0Qg8q9pH_R3&(ck!8NolM$ zSb_Axd4bPKflcwKwy2!<<$@B`8J^YT-pq;c%acrB{-aL?wq0Nzvx9>HEJQb;)WcSB zbCIG6g-|0d3D50(wE1|=5Sv!>;P~47@EtT}KFyXEWBs%=(+dRtRq&Q2^fy0mK6?SH z7{-+!eY7tbzet@4@sc@n&Js2aKSBlIk0RE=I|+gnv#)j6u@%5+fe#s`f?Vp)4A3L~ zDVUt8!AU(N_fs*VimA}qrZQGMK=tR%4E)Re`wr9=+UhrSvpCp(Eyc$zb6&$7=Wy>N zAf_O1c{BM;4DfR+8jguZEk~@N{vBK4yMX6+TQSsmf9Vfax-mwP+~ayYG|LVbp) zOGwl&_7o2?l+1IrQ+ZH#1{^Z`U+=wj5w=H&w|{9^XD9p`!7(xaMs1v3 zocwwWB_uR=qBr^te-r9e7?_Z~YqFV0B!iiPYhBJWn%dp7Fq=mm@`a$98-D4~M?#Tu z;!;&Zcx9}!b4@l55xQxcc|0qs>4%sbFC;S+p?aF0zBKY5I_qgW1$9;OjR?V5)_epu z>apGt#6&r46(>;2>h@D82{%@yp8DQ13!ip;uESBOK|qKKmDzl-<)t_>glv(J00007 C6d*?c literal 0 HcmV?d00001 diff --git a/boards/shields/weact_ov2640_cam_module/weact_ov2640_cam_module.overlay b/boards/shields/weact_ov2640_cam_module/weact_ov2640_cam_module.overlay new file mode 100644 index 0000000000000..bc8c6ebddb288 --- /dev/null +++ b/boards/shields/weact_ov2640_cam_module/weact_ov2640_cam_module.overlay @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Charles Dias + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + chosen { + zephyr,camera = &zephyr_camera_dvp; + }; +}; + +&zephyr_camera_i2c { + status = "okay"; + clock-frequency = ; + + ov2640: ov2640@30 { + compatible = "ovti,ov2640"; + reg = <0x30>; + status = "okay"; + + port { + ov2640_ep_out: endpoint { + remote-endpoint = <&zephyr_camera_dvp_in>; + }; + }; + }; +}; + +&zephyr_camera_dvp { + status = "okay"; + sensor = <&ov2640>; + bus-width = <8>; + hsync-active = <0>; + vsync-active = <0>; + pixelclk-active = <1>; + capture-rate = <1>; + + port { + zephyr_camera_dvp_in: endpoint { + remote-endpoint = <&ov2640_ep_out>; + }; + }; +}; diff --git a/boards/weact/mini_stm32h743/mini_stm32h743.dts b/boards/weact/mini_stm32h743/mini_stm32h743.dts index 5ee5dea2076db..00722f32ead30 100644 --- a/boards/weact/mini_stm32h743/mini_stm32h743.dts +++ b/boards/weact/mini_stm32h743/mini_stm32h743.dts @@ -83,6 +83,29 @@ watchdog0 = &iwdg; sdhc0 = &sdmmc1; }; + + dcmi_camera_connector: connector_dcmi_camera { + compatible = "weact,dcmi-camera-connector"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + + gpio-map = <3 0 &gpiob 9 0>, /* DVP_SDA (I2C1_SDA) */ + <5 0 &gpiob 8 0>, /* DVP_SCL (I2C1_SCL) */ + <7 0 &gpiob 7 0>, /* DVP_VSYNC */ + <8 0 &gpioa 7 0>, /* DVP_PWDN */ + <9 0 &gpioa 4 0>, /* DVP_HSYNC */ + <12 0 &gpioe 6 0>, /* DVP_D7 */ + <13 0 &gpioa 8 0>, /* DVP_XCLK (RCC_MCO1) */ + <14 0 &gpioe 5 0>, /* DVP_D6 */ + <16 0 &gpiod 3 0>, /* DVP_D5 */ + <17 0 &gpioa 6 0>, /* DVP_PCLK */ + <18 0 &gpioe 4 0>, /* DVP_D4 */ + <19 0 &gpioc 6 0>, /* DVP_D0 */ + <20 0 &gpioe 1 0>, /* DVP_D3 */ + <21 0 &gpioc 7 0>, /* DVP_D1 */ + <22 0 &gpioe 0 0>; /* DVP_D2 */ + }; }; &clk_lsi { @@ -220,3 +243,15 @@ zephyr_udc0: &usbotg_fs { &iwdg1 { status = "okay"; }; + +zephyr_camera_i2c: &i2c1 { + pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>; + pinctrl-names = "default"; +}; + +zephyr_camera_dvp: &dcmi { + pinctrl-0 = <&dcmi_hsync_pa4 &dcmi_pixclk_pa6 &dcmi_vsync_pb7 + &dcmi_d0_pc6 &dcmi_d1_pc7 &dcmi_d2_pe0 &dcmi_d3_pe1 + &dcmi_d4_pe4 &dcmi_d5_pd3 &dcmi_d6_pe5 &dcmi_d7_pe6>; + pinctrl-names = "default"; +}; diff --git a/dts/bindings/gpio/weact,dcmi-camera-connector.yaml b/dts/bindings/gpio/weact,dcmi-camera-connector.yaml new file mode 100644 index 0000000000000..786ecc915374a --- /dev/null +++ b/dts/bindings/gpio/weact,dcmi-camera-connector.yaml @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: Apache-2.0 + +description: | + GPIO pins exposed on the DCMI camera connector used for interfacing + with the OV2640, OV7670, and OV5640 camera sensors. + + Connector layout (not mapped GPIOs in parentheses): + + (1) OV_STROBE (Unused) (2) AGND + 3 DVP_SDA (4) AVDD-2V8 + 5 DVP_SCL (6) DVP_RST + 7 DVP_VSYNC 8 DVP_PWDN + 9 DVP_HSYNC (10) DVDD-1V5 + (11) 2V8 12 DVP_D7 + 13 DVP_XCLK 14 DVP_D6 + (15) GND 16 DVP_D5 + 17 DVP_PCLK 18 DVP_D4 + 19 DVP_D0 20 DVP_D3 + 21 DVP_D1 22 DVP_D2 + (23) AF-2V8 (24) GND + +compatible: "weact,dcmi-camera-connector" + +include: [gpio-nexus.yaml, base.yaml] From 7128e3379667b77e130e71ee32d27bfe264ad70e Mon Sep 17 00:00:00 2001 From: Charles Dias Date: Thu, 24 Oct 2024 19:33:58 +0100 Subject: [PATCH 1691/4482] samples: drivers: video: capture_to_lvgl: add menu and update the YAML Add the Kconfig menu to the sample configuration. Update sample.yaml by adding the shield configuration. Signed-off-by: Charles Dias --- samples/drivers/video/capture_to_lvgl/Kconfig | 8 +++++++- samples/drivers/video/capture_to_lvgl/sample.yaml | 13 ++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/samples/drivers/video/capture_to_lvgl/Kconfig b/samples/drivers/video/capture_to_lvgl/Kconfig index 541ca33e1d35f..edff9ffbc3708 100644 --- a/samples/drivers/video/capture_to_lvgl/Kconfig +++ b/samples/drivers/video/capture_to_lvgl/Kconfig @@ -3,7 +3,9 @@ # Copyright (c) 2024 Charles Dias # SPDX-License-Identifier: Apache-2.0 -source "Kconfig.zephyr" +mainmenu "Video capture to LVGL sample application" + +menu "Video capture configuration" config VIDEO_WIDTH int "Define the width of the video" @@ -20,3 +22,7 @@ config VIDEO_HFLIP config VIDEO_VFLIP bool "Vertical flip" default n + +endmenu + +source "Kconfig.zephyr" diff --git a/samples/drivers/video/capture_to_lvgl/sample.yaml b/samples/drivers/video/capture_to_lvgl/sample.yaml index 39d722403f8a8..64b2396a5e8d9 100644 --- a/samples/drivers/video/capture_to_lvgl/sample.yaml +++ b/samples/drivers/video/capture_to_lvgl/sample.yaml @@ -1,10 +1,21 @@ sample: name: Video capture to LVGL tests: - sample.video.capture_to_lvgl: + sample.video.capture_to_lvgl.shield.weact_ov2640_cam_module: tags: - video + - shield - samples + extra_args: SHIELD=weact_ov2640_cam_module + harness: console + harness_config: + fixture: fixture_camera + type: multi_line + ordered: true + regex: + - "Device name" + - "Format" + - "Capture started" platform_allow: - mini_stm32h743 depends_on: video From cef6b69a39d664b84161d61edde4704cac722132 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Fri, 25 Oct 2024 04:01:32 +0530 Subject: [PATCH 1692/4482] net: lib: capture: Fix build error The CONFIG_ prefix was missed. Signed-off-by: Chaitanya Tata --- subsys/net/lib/capture/capture.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subsys/net/lib/capture/capture.c b/subsys/net/lib/capture/capture.c index 7b7f135c251a7..122096c96fcb5 100644 --- a/subsys/net/lib/capture/capture.c +++ b/subsys/net/lib/capture/capture.c @@ -42,7 +42,8 @@ NET_PKT_SLAB_DEFINE(capture_pkts, CONFIG_NET_CAPTURE_PKT_COUNT); NET_BUF_POOL_FIXED_DEFINE(capture_bufs, CONFIG_NET_CAPTURE_BUF_COUNT, CONFIG_NET_BUF_DATA_SIZE, 4, NULL); #else -#define DATA_POOL_SIZE MAX(NET_PKT_BUF_RX_DATA_POOL_SIZE, NET_PKT_BUF_TX_DATA_POOL_SIZE) +#define DATA_POOL_SIZE MAX(CONFIG_NET_PKT_BUF_RX_DATA_POOL_SIZE, \ + CONFIG_NET_PKT_BUF_TX_DATA_POOL_SIZE) NET_BUF_POOL_VAR_DEFINE(capture_bufs, CONFIG_NET_CAPTURE_BUF_COUNT, DATA_POOL_SIZE, 4, NULL); From f99e0c6d7be8ce73d5a81dbdd3c014371b4ddb5a Mon Sep 17 00:00:00 2001 From: Michal Smola Date: Thu, 24 Oct 2024 15:03:17 +0200 Subject: [PATCH 1693/4482] soc: nxp mcxc: add has segger rtt in Kconfig HAS_SEGGER_RTT Kconfix symbol is missing in NXP MCXC series Kconfig. Add the symbol to fix and enable Segger RTT samples. Signed-off-by: Michal Smola --- soc/nxp/mcx/mcxc/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/soc/nxp/mcx/mcxc/Kconfig b/soc/nxp/mcx/mcxc/Kconfig index ff49d66ae6562..040e5b23a0c1b 100644 --- a/soc/nxp/mcx/mcxc/Kconfig +++ b/soc/nxp/mcx/mcxc/Kconfig @@ -17,6 +17,7 @@ config SOC_SERIES_MCXC select HAS_MCUX_LPI2C select HAS_MCUX_TPM select SOC_EARLY_INIT_HOOK + select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE if SOC_SERIES_MCXC From eb45e49a0201db381cd03269c11c1c22bda43d9b Mon Sep 17 00:00:00 2001 From: David Leach Date: Wed, 23 Oct 2024 23:38:03 -0500 Subject: [PATCH 1694/4482] tests: mcuboot: remove twr_kv58f220m from allowed list. mcuboot is not supported on twr_kv58f220m. Removing from allowed list. Fixes #78951 Signed-off-by: David Leach --- tests/boot/test_mcuboot/testcase.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/boot/test_mcuboot/testcase.yaml b/tests/boot/test_mcuboot/testcase.yaml index 3de1f70426a92..a19a51485d189 100644 --- a/tests/boot/test_mcuboot/testcase.yaml +++ b/tests/boot/test_mcuboot/testcase.yaml @@ -20,7 +20,6 @@ tests: - frdm_ke17z512 - rddrone_fmuk66 - twr_ke18f - - twr_kv58f220m - frdm_mcxn947/mcxn947/cpu0 - lpcxpresso55s06 - lpcxpresso55s16 From 528493194b0d945e684399fdd6030e4c52a791c1 Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Wed, 23 Oct 2024 11:04:08 +0200 Subject: [PATCH 1695/4482] lpcxpresso55s36: Improve debug documentation The LPC55S36 board has an integrated MCU-Link debug probe, not an LPC-Link2. Also, it is now possible to directly use the stock CMSIS-DAP mode with the `linkserver` runner. Signed-off-by: Luca Burelli --- boards/nxp/lpcxpresso55s36/doc/index.rst | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/boards/nxp/lpcxpresso55s36/doc/index.rst b/boards/nxp/lpcxpresso55s36/doc/index.rst index cf5a1848833bb..f361f1ea79697 100644 --- a/boards/nxp/lpcxpresso55s36/doc/index.rst +++ b/boards/nxp/lpcxpresso55s36/doc/index.rst @@ -159,19 +159,17 @@ and :ref:`application_run` for more details). Configuring a Debug Probe ========================= -A debug probe is used for both flashing and debugging the board. This -board is configured by default to use the LPC-Link2 CMSIS-DAP Onboard -Debug Probe, however the :ref:`pyocd-debug-host-tools` does not yet -support the LPC55S36 so you must reconfigure the board for one of the -J-Link debug probe instead. - -First install the :ref:`jlink-debug-host-tools` and make sure they are -in your search path. - -Then follow the instructions in -:ref:`lpclink2-jlink-onboard-debug-probe` to program the J-Link -firmware. Please make sure you have the latest firmware for this -board. +A debug probe is used for both flashing and debugging the board. This board is +configured by default to use the integrated :ref:`mcu-link-onboard-debug-probe` +in the CMSIS-DAP mode. To use this probe with Zephyr, you need to install the +:ref:`linkserver-debug-host-tools` and make sure they are in your search path. +Then, use the ``linkserver`` runner option to flash and debug the board. Refer +to the detailed overview about :ref:`application_debugging` for additional +information. + +The integrated MCU-Link hardware can also be used as a J-Link probe with a +firmware update, as described in :ref:`mcu-link-jlink-onboard-debug-probe`. +The :ref:`jlink-debug-host-tools` should be available in this case. Configuring a Console ===================== From d612982b14003364047565f21537578f173ac8b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 19 Jul 2024 14:52:43 +0200 Subject: [PATCH 1696/4482] tests: drivers: uart: async_api: Make long buffer configurable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One of the test case is performing long transfers using 1k buffers. For some targets there may be not enough RAM to perform such transfers. Make long buffer length configurable. Signed-off-by: Krzysztof Chruściński --- tests/drivers/uart/uart_async_api/Kconfig | 4 ++ .../uart/uart_async_api/src/test_uart_async.c | 38 +++++++++++-------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/tests/drivers/uart/uart_async_api/Kconfig b/tests/drivers/uart/uart_async_api/Kconfig index 6883eb2350967..b7ec969a5f534 100644 --- a/tests/drivers/uart/uart_async_api/Kconfig +++ b/tests/drivers/uart/uart_async_api/Kconfig @@ -19,3 +19,7 @@ config DT_DEFINED_NOCACHE_NAME endif # DT_DEFINED_NOCACHE endif # DCACHE + +config TEST_LONG_BUFFER_SIZE + int "Long buffer size" + default 1024 diff --git a/tests/drivers/uart/uart_async_api/src/test_uart_async.c b/tests/drivers/uart/uart_async_api/src/test_uart_async.c index 660bd843323fc..0506ff0a01ff6 100644 --- a/tests/drivers/uart/uart_async_api/src/test_uart_async.c +++ b/tests/drivers/uart/uart_async_api/src/test_uart_async.c @@ -855,14 +855,17 @@ ZTEST_USER(uart_async_chain_write, test_chained_write) "RX_DISABLED timeout"); } +#define RX_LONG_BUFFER CONFIG_TEST_LONG_BUFFER_SIZE +#define TX_LONG_BUFFER (CONFIG_TEST_LONG_BUFFER_SIZE - 8) + #if NOCACHE_MEM -static __aligned(32) uint8_t long_rx_buf[1024] __used __NOCACHE; -static __aligned(32) uint8_t long_rx_buf2[1024] __used __NOCACHE; -static __aligned(32) uint8_t long_tx_buf[1000] __used __NOCACHE; +static __aligned(32) uint8_t long_rx_buf[RX_LONG_BUFFER] __used __NOCACHE; +static __aligned(32) uint8_t long_rx_buf2[RX_LONG_BUFFER] __used __NOCACHE; +static __aligned(32) uint8_t long_tx_buf[TX_LONG_BUFFER] __used __NOCACHE; #else -ZTEST_BMEM uint8_t long_rx_buf[1024]; -ZTEST_BMEM uint8_t long_rx_buf2[1024]; -ZTEST_BMEM uint8_t long_tx_buf[1000]; +ZTEST_BMEM uint8_t long_rx_buf[RX_LONG_BUFFER]; +ZTEST_BMEM uint8_t long_rx_buf2[RX_LONG_BUFFER]; +ZTEST_BMEM uint8_t long_tx_buf[TX_LONG_BUFFER]; #endif /* NOCACHE_MEM */ ZTEST_BMEM volatile uint8_t evt_num; ZTEST_BMEM size_t long_received[2]; @@ -892,7 +895,7 @@ static void test_long_buffers_callback(const struct device *dev, k_sem_give(&rx_disabled); break; case UART_RX_BUF_REQUEST: - uart_rx_buf_rsp(dev, next_buffer, 1024); + uart_rx_buf_rsp(dev, next_buffer, RX_LONG_BUFFER); next_buffer = (next_buffer == long_rx_buf2) ? long_rx_buf : long_rx_buf2; break; default: @@ -911,16 +914,19 @@ static void *long_buffers_setup(void) ZTEST_USER(uart_async_long_buf, test_long_buffers) { + size_t tx_len1 = TX_LONG_BUFFER / 2; + size_t tx_len2 = TX_LONG_BUFFER; + memset(long_rx_buf, 0, sizeof(long_rx_buf)); memset(long_tx_buf, 1, sizeof(long_tx_buf)); uart_rx_enable(uart_dev, long_rx_buf, sizeof(long_rx_buf), 10 * USEC_PER_MSEC); - uart_tx(uart_dev, long_tx_buf, 500, 200 * USEC_PER_MSEC); + uart_tx(uart_dev, long_tx_buf, tx_len1, 200 * USEC_PER_MSEC); zassert_equal(k_sem_take(&tx_done, K_MSEC(200)), 0, "TX_DONE timeout"); zassert_equal(k_sem_take(&rx_rdy, K_MSEC(200)), 0, "RX_RDY timeout"); - zassert_equal(long_received[0], 500, "Wrong number of bytes received."); - zassert_equal(memcmp(long_tx_buf, long_rx_buf, 500), + zassert_equal(long_received[0], tx_len1, "Wrong number of bytes received."); + zassert_equal(memcmp(long_tx_buf, long_rx_buf, tx_len1), 0, "Buffers not equal"); k_msleep(10); @@ -928,19 +934,21 @@ ZTEST_USER(uart_async_long_buf, test_long_buffers) bool release_on_timeout = k_sem_take(&rx_buf_released, K_NO_WAIT) == 0; evt_num = 0; - uart_tx(uart_dev, long_tx_buf, 1000, 200 * USEC_PER_MSEC); + uart_tx(uart_dev, long_tx_buf, tx_len2, 200 * USEC_PER_MSEC); zassert_equal(k_sem_take(&tx_done, K_MSEC(200)), 0, "TX_DONE timeout"); zassert_equal(k_sem_take(&rx_rdy, K_MSEC(200)), 0, "RX_RDY timeout"); if (release_on_timeout) { - zassert_equal(long_received[0], 1000, "Wrong number of bytes received."); + zassert_equal(long_received[0], tx_len2, "Wrong number of bytes received."); zassert_equal(memcmp(long_tx_buf, long_rx_buf2, long_received[0]), 0, "Buffers not equal"); } else { zassert_equal(k_sem_take(&rx_rdy, K_MSEC(200)), 0, "RX_RDY timeout"); - zassert_equal(long_received[0], 524, "Wrong number of bytes received."); - zassert_equal(long_received[1], 476, "Wrong number of bytes received."); - zassert_equal(memcmp(long_tx_buf, long_rx_buf + 500, long_received[0]), 0, + zassert_equal(long_received[0], RX_LONG_BUFFER - tx_len1, + "Wrong number of bytes received."); + zassert_equal(long_received[1], tx_len2 - (RX_LONG_BUFFER - tx_len1), + "Wrong number of bytes received."); + zassert_equal(memcmp(long_tx_buf, long_rx_buf + tx_len1, long_received[0]), 0, "Buffers not equal"); zassert_equal(memcmp(long_tx_buf, long_rx_buf2, long_received[1]), 0, "Buffers not equal"); From d480093cd62df25603106f4a505c17e34805d764 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 23 Oct 2024 07:33:37 +0200 Subject: [PATCH 1697/4482] tests: drivers: uart: async_api: Use custom long buffer for nrf54h20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nrf54h20dk_nrf54h20_cpurad by default has less RAM dedicated for DMA transfers and default 1k buffer cannot be used for uart_async_long_buf case. Use custom value. Signed-off-by: Krzysztof Chruściński --- .../uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpurad.conf | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpurad.conf diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpurad.conf b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpurad.conf new file mode 100644 index 0000000000000..0eebd15e8a921 --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54h20dk_nrf54h20_cpurad.conf @@ -0,0 +1 @@ +CONFIG_TEST_LONG_BUFFER_SIZE=128 From ad9c3c39ad431a004e80058d554c68a47bb04ec9 Mon Sep 17 00:00:00 2001 From: James Roy Date: Wed, 23 Oct 2024 13:59:05 +0800 Subject: [PATCH 1698/4482] net: wifi: Fix ssid member byte size in wifi core structure Change the bytes occupied by the ssid member in the wifi structure to 'WIFI_SSID_MAX_LEN + 1' so that it can eliminate the '-Wstringop-truncation' warning. Signed-off-by: James Roy --- include/zephyr/net/wifi_mgmt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index ddfdfa05309fd..bdf3bab48bd88 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -429,7 +429,7 @@ struct wifi_scan_params { */ struct wifi_scan_result { /** SSID */ - uint8_t ssid[WIFI_SSID_MAX_LEN]; + uint8_t ssid[WIFI_SSID_MAX_LEN + 1]; /** SSID length */ uint8_t ssid_length; /** Frequency band */ @@ -586,7 +586,7 @@ struct wifi_iface_status { /** SSID length */ unsigned int ssid_len; /** SSID */ - char ssid[WIFI_SSID_MAX_LEN]; + char ssid[WIFI_SSID_MAX_LEN + 1]; /** BSSID */ char bssid[WIFI_MAC_ADDR_LEN]; /** Frequency band */ From b443929f496f9bffabb5112258e6170e6afa7e4c Mon Sep 17 00:00:00 2001 From: James Roy Date: Wed, 23 Oct 2024 16:54:26 +0800 Subject: [PATCH 1699/4482] drivers: esp32: Fix esp_wifi_drv strncpy warning Add '\0' to the end of the ssid to prevent warnings or segmentation errors. Signed-off-by: James Roy --- drivers/wifi/esp32/src/esp_wifi_drv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/wifi/esp32/src/esp_wifi_drv.c b/drivers/wifi/esp32/src/esp_wifi_drv.c index b2e41a58a5131..fb8dd8577f095 100644 --- a/drivers/wifi/esp32/src/esp_wifi_drv.c +++ b/drivers/wifi/esp32/src/esp_wifi_drv.c @@ -735,6 +735,7 @@ static int esp32_wifi_status(const struct device *dev, struct wifi_iface_status strncpy(status->ssid, data->status.ssid, WIFI_SSID_MAX_LEN); status->ssid_len = strnlen(data->status.ssid, WIFI_SSID_MAX_LEN); + status->ssid[status->ssid_len] = '\0'; status->band = WIFI_FREQ_BAND_2_4_GHZ; status->link_mode = WIFI_LINK_MODE_UNKNOWN; status->mfp = WIFI_MFP_DISABLE; From d4783f119de18b67a856d3d41ce55957a6215873 Mon Sep 17 00:00:00 2001 From: Neil Chen Date: Thu, 24 Oct 2024 17:06:25 +0800 Subject: [PATCH 1700/4482] dts: arm/nxp: Add LPTMR nodes to NXP MCXN23x dtsi file Add LPTMR nodes to NXP MCXN23x dtsi file Signed-off-by: Neil Chen --- dts/arm/nxp/nxp_mcxn23x_common.dtsi | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/dts/arm/nxp/nxp_mcxn23x_common.dtsi b/dts/arm/nxp/nxp_mcxn23x_common.dtsi index 5431542a9f2b8..698f83bd75d2e 100644 --- a/dts/arm/nxp/nxp_mcxn23x_common.dtsi +++ b/dts/arm/nxp/nxp_mcxn23x_common.dtsi @@ -769,6 +769,26 @@ status = "disabled"; }; }; + + lptmr0: lptmr@4a000 { + compatible = "nxp,lptmr"; + reg = <0x4a000 0x1000>; + interrupts = <143 0>; + clock-frequency = <16000>; + prescaler = <1>; + clk-source = <1>; + resolution = <32>; + }; + + lptmr1: lptmr@4b000 { + compatible = "nxp,lptmr"; + reg = <0x4b000 0x1000>; + interrupts = <144 0>; + clock-frequency = <16000>; + prescaler = <1>; + clk-source = <1>; + resolution = <32>; + }; }; &systick { From 712637f4beef18a8d55c7e834c56dc5fbc9e310b Mon Sep 17 00:00:00 2001 From: Neil Chen Date: Thu, 24 Oct 2024 17:08:29 +0800 Subject: [PATCH 1701/4482] boards: nxp/frdm_mcxn236: Support LPTMR for NXP frdm_mcxn236 board Support LPTMR for NXP frdm_mcxn236 board Signed-off-by: Neil Chen --- boards/nxp/frdm_mcxn236/board.c | 24 ++++++++++++++++++++++++ boards/nxp/frdm_mcxn236/doc/index.rst | 2 ++ boards/nxp/frdm_mcxn236/frdm_mcxn236.dts | 4 ++++ 3 files changed, 30 insertions(+) diff --git a/boards/nxp/frdm_mcxn236/board.c b/boards/nxp/frdm_mcxn236/board.c index 3ada0c1cd73bc..a41230b063abb 100644 --- a/boards/nxp/frdm_mcxn236/board.c +++ b/boards/nxp/frdm_mcxn236/board.c @@ -217,6 +217,30 @@ static int frdm_mcxn236_init(void) CLOCK_AttachClk(kPLL0_to_FLEXIO); #endif +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lptmr0)) + +/* + * Clock Select Decides what input source the lptmr will clock from + * + * 0 <- 12MHz FRO + * 1 <- 16K FRO + * 2 <- 32K OSC + * 3 <- Output from the OSC_SYS + */ +#if DT_PROP(DT_NODELABEL(lptmr0), clk_source) == 0x0 + CLOCK_SetupClockCtrl(kCLOCK_FRO12MHZ_ENA); +#elif DT_PROP(DT_NODELABEL(lptmr0), clk_source) == 0x1 + CLOCK_SetupClk16KClocking(kCLOCK_Clk16KToVsys); +#elif DT_PROP(DT_NODELABEL(lptmr0), clk_source) == 0x2 + CLOCK_SetupOsc32KClocking(kCLOCK_Osc32kToVsys); +#elif DT_PROP(DT_NODELABEL(lptmr0), clk_source) == 0x3 + /* Value here should not exceed 25MHZ when using lptmr */ + CLOCK_SetupExtClocking(MHZ(24)); + CLOCK_SetupClockCtrl(kCLOCK_CLKIN_ENA_FM_USBH_LPT); +#endif /* DT_PROP(DT_NODELABEL(lptmr0), clk_source) */ + +#endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lptmr0)) */ + /* Set SystemCoreClock variable. */ SystemCoreClock = CLOCK_INIT_CORE_CLOCK; diff --git a/boards/nxp/frdm_mcxn236/doc/index.rst b/boards/nxp/frdm_mcxn236/doc/index.rst index 88f74619bcfcf..2be790987cecf 100644 --- a/boards/nxp/frdm_mcxn236/doc/index.rst +++ b/boards/nxp/frdm_mcxn236/doc/index.rst @@ -74,6 +74,8 @@ The FRDM-MCXN236 board configuration supports the following hardware features: | DISPLAY | on-chip | flexio; MIPI-DBI. Tested with | | | | :ref:`lcd_par_s035` | +-----------+------------+-------------------------------------+ +| LPTMR | on-chip | counter | ++-----------+------------+-------------------------------------+ Targets available ================== diff --git a/boards/nxp/frdm_mcxn236/frdm_mcxn236.dts b/boards/nxp/frdm_mcxn236/frdm_mcxn236.dts index bff8cd907acb4..6eef74a0a7421 100644 --- a/boards/nxp/frdm_mcxn236/frdm_mcxn236.dts +++ b/boards/nxp/frdm_mcxn236/frdm_mcxn236.dts @@ -134,3 +134,7 @@ &flexio0 { status = "okay"; }; + +&lptmr0 { + status = "okay"; +}; From 38f06aa4bf6eddb9736bfe38001b83b37f0f2712 Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Mon, 30 Sep 2024 11:02:03 -0500 Subject: [PATCH 1702/4482] drivers: sensor: p3t1755: Driver for NXP digital temperature sensor Added driver for the NXP P3T1755 digital temperature sensor. Signed-off-by: Mahesh Mahadevan --- drivers/sensor/nxp/CMakeLists.txt | 1 + drivers/sensor/nxp/Kconfig | 1 + drivers/sensor/nxp/p3t1755/CMakeLists.txt | 7 + drivers/sensor/nxp/p3t1755/Kconfig | 13 ++ drivers/sensor/nxp/p3t1755/p3t1755.c | 191 ++++++++++++++++++++ drivers/sensor/nxp/p3t1755/p3t1755.h | 71 ++++++++ dts/bindings/sensor/nxp,p3t1755-common.yaml | 12 ++ dts/bindings/sensor/nxp,p3t1755-i2c.yaml | 9 + dts/bindings/sensor/nxp,p3t1755-i3c.yaml | 9 + 9 files changed, 314 insertions(+) create mode 100644 drivers/sensor/nxp/p3t1755/CMakeLists.txt create mode 100644 drivers/sensor/nxp/p3t1755/Kconfig create mode 100644 drivers/sensor/nxp/p3t1755/p3t1755.c create mode 100644 drivers/sensor/nxp/p3t1755/p3t1755.h create mode 100644 dts/bindings/sensor/nxp,p3t1755-common.yaml create mode 100644 dts/bindings/sensor/nxp,p3t1755-i2c.yaml create mode 100644 dts/bindings/sensor/nxp,p3t1755-i3c.yaml diff --git a/drivers/sensor/nxp/CMakeLists.txt b/drivers/sensor/nxp/CMakeLists.txt index 36e39e002bf95..bca607d819fc4 100644 --- a/drivers/sensor/nxp/CMakeLists.txt +++ b/drivers/sensor/nxp/CMakeLists.txt @@ -7,6 +7,7 @@ add_subdirectory_ifdef(CONFIG_FXLS8974 fxls8974) add_subdirectory_ifdef(CONFIG_FXOS8700 fxos8700) add_subdirectory_ifdef(CONFIG_MCUX_LPCMP mcux_lpcmp) add_subdirectory_ifdef(CONFIG_NXP_TEMPMON nxp_tempmon) +add_subdirectory_ifdef(CONFIG_P3T1755 p3t1755) add_subdirectory_ifdef(CONFIG_QDEC_MCUX qdec_mcux) add_subdirectory_ifdef(CONFIG_QDEC_NXP_S32 qdec_nxp_s32) add_subdirectory_ifdef(CONFIG_SENSOR_MCUX_ACMP mcux_acmp) diff --git a/drivers/sensor/nxp/Kconfig b/drivers/sensor/nxp/Kconfig index 10e8139b26cef..e1289d7fdeb61 100644 --- a/drivers/sensor/nxp/Kconfig +++ b/drivers/sensor/nxp/Kconfig @@ -9,6 +9,7 @@ source "drivers/sensor/nxp/mcux_acmp/Kconfig" source "drivers/sensor/nxp/mcux_lpcmp/Kconfig" source "drivers/sensor/nxp/nxp_kinetis_temp/Kconfig" source "drivers/sensor/nxp/nxp_tempmon/Kconfig" +source "drivers/sensor/nxp/p3t1755/Kconfig" source "drivers/sensor/nxp/qdec_mcux/Kconfig" source "drivers/sensor/nxp/qdec_nxp_s32/Kconfig" # zephyr-keep-sorted-stop diff --git a/drivers/sensor/nxp/p3t1755/CMakeLists.txt b/drivers/sensor/nxp/p3t1755/CMakeLists.txt new file mode 100644 index 0000000000000..90435d7a86ff7 --- /dev/null +++ b/drivers/sensor/nxp/p3t1755/CMakeLists.txt @@ -0,0 +1,7 @@ +# Copyright 2024 NXP +# +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library() + +zephyr_library_sources(p3t1755.c) diff --git a/drivers/sensor/nxp/p3t1755/Kconfig b/drivers/sensor/nxp/p3t1755/Kconfig new file mode 100644 index 0000000000000..aaddc80c04a31 --- /dev/null +++ b/drivers/sensor/nxp/p3t1755/Kconfig @@ -0,0 +1,13 @@ +# P3T1755 digital temperature sensor + +# Copyright 2024 NXP +# SPDX-License-Identifier: Apache-2.0 + +config P3T1755 + bool "P3T1755 digital temperature sensor driver" + default y + depends on DT_HAS_NXP_P3T1755_ENABLED + select I2C if $(dt_compat_on_bus,$(DT_COMPAT_NXP_P3T1755),i2c) + select I3C if $(dt_compat_on_bus,$(DT_COMPAT_NXP_P3T1755),i3c) + help + Enable driver for the P3T1755 digital temperature sensor. diff --git a/drivers/sensor/nxp/p3t1755/p3t1755.c b/drivers/sensor/nxp/p3t1755/p3t1755.c new file mode 100644 index 0000000000000..b84dde4ffe213 --- /dev/null +++ b/drivers/sensor/nxp/p3t1755/p3t1755.c @@ -0,0 +1,191 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT nxp_p3t1755 + +#include "p3t1755.h" +#include +#include +#include +#include + +LOG_MODULE_REGISTER(P3T1755, CONFIG_SENSOR_LOG_LEVEL); + + +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i3c) +static int p3t1755_i3c_read_reg(const struct device *dev, uint8_t reg, uint8_t *value, uint8_t len) +{ + struct p3t1755_data *data = dev->data; + + return i3c_burst_read(data->i3c_dev, reg, value, len); +} + +static int p3t1755_i3c_write_reg(const struct device *dev, uint8_t reg, uint8_t *byte, uint8_t len) +{ + struct p3t1755_data *data = dev->data; + + return i3c_burst_write(data->i3c_dev, reg, byte, len); +} +#endif + +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) +int p3t1755_i2c_read_reg(const struct device *dev, uint8_t reg, uint8_t *value, uint8_t len) +{ + const struct p3t1755_config *config = dev->config; + + return i2c_burst_read_dt(&config->bus_cfg.i2c, reg, value, len); +} + +int p3t1755_i2c_write_reg(const struct device *dev, uint8_t reg, uint8_t *byte, uint8_t len) +{ + const struct p3t1755_config *config = dev->config; + + return i2c_burst_write_dt(&config->bus_cfg.i2c, reg, byte, len); +} +#endif + +static int p3t1755_sample_fetch(const struct device *dev, enum sensor_channel chan) +{ + const struct p3t1755_config *config = dev->config; + struct p3t1755_data *data = dev->data; + uint8_t raw_temp[2]; + + if (chan != SENSOR_CHAN_ALL && chan != SENSOR_CHAN_AMBIENT_TEMP) { + LOG_ERR("Invalid channel provided"); + return -ENOTSUP; + } + + if (config->oneshot_mode) { + data->config_reg |= P3T1755_CONFIG_REG_OS; + config->ops.write(dev, P3T1755_CONFIG_REG, &data->config_reg, 1); + /* Maximum one-shot conversion time per specification is 12ms */ + k_sleep(K_MSEC(12)); + } + + config->ops.read(dev, P3T1755_TEMPERATURE_REG, raw_temp, 2); + + /* Byte 1 contains the MSByte and Byte 2 contains the LSByte, we need to swap the 2 bytes. + * The 4 least significant bits of the LSByte are zero and should be ignored. + */ + data->sample = (((uint16_t)raw_temp[0] << 8U) | (uint16_t)raw_temp[1]) >> + P3T1755_TEMPERATURE_REG_SHIFT; + + return 0; +} + +/* Decode a register temperature value to a signed temperature */ +static inline int p3t1755_convert_to_signed(uint16_t reg) +{ + int rv = reg & P3T1755_TEMPERATURE_ABS_MASK; + + if (reg & P3T1755_TEMPERATURE_SIGN_BIT) { + /* Convert 12-bit 2s complement to signed negative + * value. + */ + rv = -(1U + (rv ^ P3T1755_TEMPERATURE_ABS_MASK)); + } + return rv; +} + +static int p3t1755_channel_get(const struct device *dev, enum sensor_channel chan, + struct sensor_value *val) +{ + struct p3t1755_data *data = dev->data; + int32_t raw_val; + + if (chan != SENSOR_CHAN_AMBIENT_TEMP) { + return -ENOTSUP; + } + + raw_val = p3t1755_convert_to_signed(data->sample); + + /* Temperature data resolution is 0.0625 C, apply a temperature scale */ + raw_val = raw_val * P3T1755_TEMPERATURE_SCALE; + + sensor_value_from_micro(val, raw_val); + + return 0; +} + +static int p3t1755_init(const struct device *dev) +{ + const struct p3t1755_config *config = dev->config; + struct p3t1755_data *data = dev->data; + +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i3c) + if (config->i3c.bus != NULL) { + data->i3c_dev = i3c_device_find(config->i3c.bus, &config->i3c.dev_id); + if (data->i3c_dev == NULL) { + LOG_ERR("Cannot find I3C device descriptor"); + return -ENODEV; + } + } +#endif +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) + if (config->inst_on_bus == P3T1755_BUS_I2C) { + if (!i2c_is_ready_dt(&config->bus_cfg.i2c)) { + LOG_ERR("I2C bus device not ready"); + return -ENODEV; + } + } +#endif + + if (config->oneshot_mode) { + config->ops.read(dev, P3T1755_CONFIG_REG, &data->config_reg, 1); + /* Operate in shutdown mode. Set the OS bit to start the + * one-shot temperature measurement. + */ + data->config_reg |= P3T1755_CONFIG_REG_SD; + config->ops.write(dev, P3T1755_CONFIG_REG, &data->config_reg, 1); + } + + LOG_DBG("Init complete"); + + return 0; +} + +static const struct sensor_driver_api p3t1755_driver_api = { + .sample_fetch = p3t1755_sample_fetch, + .channel_get = p3t1755_channel_get, +}; + +/* + * Instantiation macros used when a device is on an I2C bus. + */ +#define P3T1755_CONFIG_I2C(inst) \ + .bus_cfg = {.i2c = I2C_DT_SPEC_INST_GET(inst)}, \ + .ops = { \ + .read = p3t1755_i2c_read_reg, \ + .write = p3t1755_i2c_write_reg, \ + }, \ + .inst_on_bus = P3T1755_BUS_I2C, + +/* + * Instantiation macros used when a device is on an I#C bus. + */ +#define P3T1755_CONFIG_I3C(inst) \ + .bus_cfg = {.i3c = &p3t1755_data_##inst.i3c_dev}, \ + .ops = { \ + .read = p3t1755_i3c_read_reg, \ + .write = p3t1755_i3c_write_reg, \ + }, \ + .inst_on_bus = P3T1755_BUS_I3C, \ + .i3c.bus = DEVICE_DT_GET(DT_INST_BUS(inst)), .i3c.dev_id = I3C_DEVICE_ID_DT_INST(inst), + +#define P3T1755_INIT(n) \ + static struct p3t1755_data p3t1755_data_##n; \ + static const struct p3t1755_config p3t1755_config_##n = { \ + COND_CODE_1(DT_INST_ON_BUS(n, i3c), \ + (P3T1755_CONFIG_I3C(n)), \ + (P3T1755_CONFIG_I2C(n))) \ + .oneshot_mode = DT_INST_PROP(n, oneshot_mode), \ + }; \ + \ + SENSOR_DEVICE_DT_INST_DEFINE(n, p3t1755_init, NULL, &p3t1755_data_##n, \ + &p3t1755_config_##n, POST_KERNEL, \ + CONFIG_SENSOR_INIT_PRIORITY, &p3t1755_driver_api); + +DT_INST_FOREACH_STATUS_OKAY(P3T1755_INIT) diff --git a/drivers/sensor/nxp/p3t1755/p3t1755.h b/drivers/sensor/nxp/p3t1755/p3t1755.h new file mode 100644 index 0000000000000..b2ba329f2fe23 --- /dev/null +++ b/drivers/sensor/nxp/p3t1755/p3t1755.h @@ -0,0 +1,71 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_DRIVERS_SENSOR_P3T1755_P3T1755_H_ +#define ZEPHYR_DRIVERS_SENSOR_P3T1755_P3T1755_H_ + +#include + +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) +#include +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */ + +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i3c) +#include +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i3c) */ + +#include + +#define P3T1755_BUS_I2C (1<<0) +#define P3T1755_BUS_I3C (1<<1) +/* Registers. */ +#define P3T1755_TEMPERATURE_REG (0x00U) +#define P3T1755_CONFIG_REG (0x01U) + +#define P3T1755_TEMPERATURE_REG_SHIFT (0x04U) +#define P3T1755_TEMPERATURE_SCALE 62500 +#define P3T1755_TEMPERATURE_SIGN_BIT BIT(12) +#define P3T1755_TEMPERATURE_ABS_MASK ((uint16_t)(P3T1755_TEMPERATURE_SIGN_BIT - 1U)) + +#define P3T1755_CONFIG_REG_OS BIT(7) +#define P3T1755_CONFIG_REG_SD BIT(0) + +struct p3t1755_io_ops { + int (*read)(const struct device *dev, uint8_t reg, uint8_t *byte, uint8_t len); + int (*write)(const struct device *dev, uint8_t reg, uint8_t *byte, uint8_t len); +}; + +union p3t1755_bus_cfg { +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) + const struct i2c_dt_spec i2c; +#endif +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i3c) + struct i3c_device_desc **i3c; +#endif +}; + +struct p3t1755_config { + const union p3t1755_bus_cfg bus_cfg; + const struct p3t1755_io_ops ops; +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i3c) + struct { + const struct device *bus; + const struct i3c_device_id dev_id; + } i3c; +#endif + bool oneshot_mode; + uint8_t inst_on_bus; +}; + +struct p3t1755_data { + int16_t sample; + uint8_t config_reg; +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i3c) + struct i3c_device_desc *i3c_dev; +#endif +}; + +#endif /* ZEPHYR_DRIVERS_SENSOR_P3T1755_P3T1755_H_ */ diff --git a/dts/bindings/sensor/nxp,p3t1755-common.yaml b/dts/bindings/sensor/nxp,p3t1755-common.yaml new file mode 100644 index 0000000000000..ff090a8349a25 --- /dev/null +++ b/dts/bindings/sensor/nxp,p3t1755-common.yaml @@ -0,0 +1,12 @@ +# Copyright 2024 NXP +# SPDX-License-Identifier: Apache-2.0 + +description: | + NXP P3T1755 digital temperature sensor. + +properties: + oneshot-mode: + type: boolean + description: | + Oneshot sampling mode, this reduces power consumption. By default the sensor + is in a continuous conversion state. diff --git a/dts/bindings/sensor/nxp,p3t1755-i2c.yaml b/dts/bindings/sensor/nxp,p3t1755-i2c.yaml new file mode 100644 index 0000000000000..8e58dcc6d4367 --- /dev/null +++ b/dts/bindings/sensor/nxp,p3t1755-i2c.yaml @@ -0,0 +1,9 @@ +# Copyright 2024 NXP +# SPDX-License-Identifier: Apache-2.0 + +description: | + NXP P3T1755 digital temperature sensor connected to I2C bus. + +compatible: "nxp,p3t1755" + +include: ["i2c-device.yaml", "nxp,p3t1755-common.yaml"] diff --git a/dts/bindings/sensor/nxp,p3t1755-i3c.yaml b/dts/bindings/sensor/nxp,p3t1755-i3c.yaml new file mode 100644 index 0000000000000..899dc4a97d0b7 --- /dev/null +++ b/dts/bindings/sensor/nxp,p3t1755-i3c.yaml @@ -0,0 +1,9 @@ +# Copyright 2024 NXP +# SPDX-License-Identifier: Apache-2.0 + +description: | + NXP P3T1755 digital temperature sensor connected to I3C bus. + +compatible: "nxp,p3t1755" + +include: ["i3c-device.yaml", "nxp,p3t1755-common.yaml"] From 513ead82dd12459b1a8b882804a87945e5492e95 Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Mon, 9 Sep 2024 13:40:35 -0500 Subject: [PATCH 1703/4482] drivers: clock: Update the NXP Syscon driver for MCUX Update the code for MCUXN947 I3C support Signed-off-by: Mahesh Mahadevan --- drivers/clock_control/clock_control_mcux_syscon.c | 14 ++++++++++++++ .../dt-bindings/clock/mcux_lpc_syscon_clock.h | 1 + 2 files changed, 15 insertions(+) diff --git a/drivers/clock_control/clock_control_mcux_syscon.c b/drivers/clock_control/clock_control_mcux_syscon.c index 4be9b4dc7d453..70226a5570fac 100644 --- a/drivers/clock_control/clock_control_mcux_syscon.c +++ b/drivers/clock_control/clock_control_mcux_syscon.c @@ -289,10 +289,24 @@ static int mcux_lpc_syscon_clock_control_get_subsys_rate(const struct device *de #if defined(CONFIG_I3C_MCUX) case MCUX_I3C_CLK: +#if CONFIG_SOC_SERIES_MCXN + *rate = CLOCK_GetI3cClkFreq(0); +#else *rate = CLOCK_GetI3cClkFreq(); +#endif + break; +#if (FSL_FEATURE_SOC_I3C_COUNT == 2) + case MCUX_I3C2_CLK: +#if CONFIG_SOC_SERIES_MCXN + *rate = CLOCK_GetI3cClkFreq(1); +#else + *rate = CLOCK_GetI3cClkFreq(); +#endif break; #endif +#endif /* CONFIG_I3C_MCUX */ + #if defined(CONFIG_MIPI_DSI_MCUX_2L) case MCUX_MIPI_DSI_DPHY_CLK: *rate = CLOCK_GetMipiDphyClkFreq(); diff --git a/include/zephyr/dt-bindings/clock/mcux_lpc_syscon_clock.h b/include/zephyr/dt-bindings/clock/mcux_lpc_syscon_clock.h index 46a3190183368..c26735174880b 100644 --- a/include/zephyr/dt-bindings/clock/mcux_lpc_syscon_clock.h +++ b/include/zephyr/dt-bindings/clock/mcux_lpc_syscon_clock.h @@ -51,6 +51,7 @@ #define MCUX_SDIF_CLK MCUX_LPC_CLK_ID(0x05, 0x00) #define MCUX_I3C_CLK MCUX_LPC_CLK_ID(0x06, 0x00) +#define MCUX_I3C2_CLK MCUX_LPC_CLK_ID(0x06, 0x01) #define MCUX_MIPI_DSI_DPHY_CLK MCUX_LPC_CLK_ID(0x07, 0x00) #define MCUX_MIPI_DSI_ESC_CLK MCUX_LPC_CLK_ID(0x07, 0x01) From 3dc3f6e93801f7b9667aad62007541885a6a0187 Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Fri, 6 Sep 2024 11:23:41 -0500 Subject: [PATCH 1704/4482] dts: nxp_mcxn94x: Add I3C nodes Add the I3C nodes for nxp_mcxn94x Signed-off-by: Mahesh Mahadevan --- dts/arm/nxp/nxp_mcxn94x_common.dtsi | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/dts/arm/nxp/nxp_mcxn94x_common.dtsi b/dts/arm/nxp/nxp_mcxn94x_common.dtsi index a45a7d417c39d..935f5aa7511df 100644 --- a/dts/arm/nxp/nxp_mcxn94x_common.dtsi +++ b/dts/arm/nxp/nxp_mcxn94x_common.dtsi @@ -931,6 +931,31 @@ resolution = <32>; }; + i3c0: i3c@21000 { + compatible = "nxp,mcux-i3c"; + reg = <0x21000 0x1000>; + interrupts = <95 0>; + clocks = <&syscon MCUX_I3C_CLK>; + clk-divider = <6>; + clk-divider-slow = <1>; + clk-divider-tc = <1>; + status = "disabled"; + #address-cells = <3>; + #size-cells = <0>; + }; + + i3c1: i3c@22000 { + compatible = "nxp,mcux-i3c"; + reg = <0x22000 0x1000>; + interrupts = <96 0>; + clocks = <&syscon MCUX_I3C2_CLK>; + clk-divider = <6>; + clk-divider-slow = <1>; + clk-divider-tc = <1>; + status = "disabled"; + #address-cells = <3>; + #size-cells = <0>; + }; flexio0: flexio@105000 { compatible = "nxp,flexio"; From 630d99ca9cf291a9bb25e1c43f2947e57517bd9c Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Mon, 9 Sep 2024 13:45:08 -0500 Subject: [PATCH 1705/4482] boards: frdm_mcxn947: Add I3C support Add support for I3C1 on frdm_mcxn947 Signed-off-by: Mahesh Mahadevan --- boards/nxp/frdm_mcxn947/board.c | 14 ++++++++++++++ boards/nxp/frdm_mcxn947/doc/index.rst | 2 ++ .../nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi | 17 +++++++++++++++++ boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi | 5 +++++ .../frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi | 4 ++++ 5 files changed, 42 insertions(+) diff --git a/boards/nxp/frdm_mcxn947/board.c b/boards/nxp/frdm_mcxn947/board.c index eb3d6c5ab4ce7..abec73950be1d 100644 --- a/boards/nxp/frdm_mcxn947/board.c +++ b/boards/nxp/frdm_mcxn947/board.c @@ -365,6 +365,20 @@ static int frdm_mcxn947_init(void) CLOCK_AttachClk(kPLL0_to_FLEXIO); #endif +#if DT_NODE_HAS_STATUS(DT_NODELABEL(i3c1), okay) + /* Enable 1MHz clock. */ + SYSCON->CLOCK_CTRL |= SYSCON_CLOCK_CTRL_FRO1MHZ_CLK_ENA_MASK; + + CLOCK_SetClkDiv(kCLOCK_DivI3c1FClk, DT_PROP(DT_NODELABEL(i3c1), clk_divider)); + CLOCK_SetClkDiv(kCLOCK_DivI3c1FClkS, DT_PROP(DT_NODELABEL(i3c1), clk_divider_slow)); + CLOCK_SetClkDiv(kCLOCK_DivI3c1FClkStc, DT_PROP(DT_NODELABEL(i3c1), clk_divider_tc)); + + /* Attach PLL0 clock to I3C, 150MHz / 6 = 25MHz. */ + CLOCK_AttachClk(kPLL0_to_I3C1FCLK); + CLOCK_AttachClk(kCLK_1M_to_I3C1FCLKS); + CLOCK_AttachClk(kI3C1FCLK_to_I3C1FCLKSTC); +#endif + /* Set SystemCoreClock variable. */ SystemCoreClock = CLOCK_INIT_CORE_CLOCK; diff --git a/boards/nxp/frdm_mcxn947/doc/index.rst b/boards/nxp/frdm_mcxn947/doc/index.rst index 8460ef2648ac1..7caf478f9a4fd 100644 --- a/boards/nxp/frdm_mcxn947/doc/index.rst +++ b/boards/nxp/frdm_mcxn947/doc/index.rst @@ -59,6 +59,8 @@ The FRDM-MCXN947 board configuration supports the following hardware features: +-----------+------------+-------------------------------------+ | I2C | on-chip | i2c | +-----------+------------+-------------------------------------+ +| I3C | on-chip | i3c | ++-----------+------------+-------------------------------------+ | CLOCK | on-chip | clock_control | +-----------+------------+-------------------------------------+ | FLASH | on-chip | soc flash | diff --git a/boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi b/boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi index b868f07891985..a39123f01bc24 100644 --- a/boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi +++ b/boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi @@ -215,6 +215,23 @@ }; }; + pinmux_i3c1: pinmux_i3c1 { + group0 { + pinmux = , + ; + slew-rate = "fast"; + drive-strength = "low"; + input-enable; + bias-pull-up; + }; + group1 { + pinmux = ; + slew-rate = "fast"; + drive-strength = "low"; + input-enable; + }; + }; + pinmux_flexio_lcd: pinmux_flexio_lcd { group0 { pinmux = , diff --git a/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi b/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi index bf4c633a7ac74..4ac575f51c762 100644 --- a/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi +++ b/boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi @@ -259,6 +259,11 @@ zephyr_mipi_dbi_parallel: &flexio0_lcd { pinctrl-names = "default"; }; +&i3c1 { + pinctrl-0 = <&pinmux_i3c1>; + pinctrl-names = "default"; +}; + &flexcan0 { pinctrl-0 = <&pinmux_flexcan0>; pinctrl-names = "default"; diff --git a/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi b/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi index 04a9eb74d8f46..816a315cbfbab 100644 --- a/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi +++ b/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi @@ -189,6 +189,10 @@ zephyr_udc0: &usb1 { status = "okay"; }; +&i3c1 { + status = "okay"; +}; + &flexio0 { status = "okay"; }; From f05dc7115ae60bc7400b63269ef8e3826ec940e9 Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Mon, 7 Oct 2024 14:23:52 -0500 Subject: [PATCH 1706/4482] samples: sensor: Add support for temperature sensor on FRDM_MCXN947 Add support for the P3T1755 temperature sensor on the FRDM MCXN947 board. Signed-off-by: Mahesh Mahadevan --- .../frdm_mcxn947_mcxn947_cpu0.yaml | 1 + .../frdm_mcxn947_mcxn947_cpu0_qspi.yaml | 1 + .../boards/frdm_mcxn947_mcxn947_cpu0.overlay | 27 +++++++++++++++++++ .../frdm_mcxn947_mcxn947_cpu0_qspi.overlay | 27 +++++++++++++++++++ samples/sensor/thermometer/sample.yaml | 1 + 5 files changed, 57 insertions(+) create mode 100644 samples/sensor/thermometer/boards/frdm_mcxn947_mcxn947_cpu0.overlay create mode 100644 samples/sensor/thermometer/boards/frdm_mcxn947_mcxn947_cpu0_qspi.overlay diff --git a/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.yaml b/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.yaml index 76f937fb1e562..60538848facf3 100644 --- a/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.yaml +++ b/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.yaml @@ -28,4 +28,5 @@ supported: - regulator - adc - usb_device + - i3c vendor: nxp diff --git a/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0_qspi.yaml b/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0_qspi.yaml index 6cd7ad2e40c8a..fe5a82ca4470a 100644 --- a/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0_qspi.yaml +++ b/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0_qspi.yaml @@ -28,4 +28,5 @@ supported: - regulator - adc - usb_device + - i3c vendor: nxp diff --git a/samples/sensor/thermometer/boards/frdm_mcxn947_mcxn947_cpu0.overlay b/samples/sensor/thermometer/boards/frdm_mcxn947_mcxn947_cpu0.overlay new file mode 100644 index 0000000000000..9c2991a4d2336 --- /dev/null +++ b/samples/sensor/thermometer/boards/frdm_mcxn947_mcxn947_cpu0.overlay @@ -0,0 +1,27 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/ { + aliases { + ambient-temp0 = &p3t1755; + }; +}; + +&i3c1 { + status = "okay"; + + i2c-scl-hz = ; + i3c-scl-hz = ; + i3c-od-scl-hz = ; + + p3t1755: p3t1755@4800000236152a0090 { + compatible = "nxp,p3t1755"; + reg = <0x48 0x0236 0x152a0090>; + status = "okay"; + }; +}; diff --git a/samples/sensor/thermometer/boards/frdm_mcxn947_mcxn947_cpu0_qspi.overlay b/samples/sensor/thermometer/boards/frdm_mcxn947_mcxn947_cpu0_qspi.overlay new file mode 100644 index 0000000000000..9c2991a4d2336 --- /dev/null +++ b/samples/sensor/thermometer/boards/frdm_mcxn947_mcxn947_cpu0_qspi.overlay @@ -0,0 +1,27 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +/ { + aliases { + ambient-temp0 = &p3t1755; + }; +}; + +&i3c1 { + status = "okay"; + + i2c-scl-hz = ; + i3c-scl-hz = ; + i3c-od-scl-hz = ; + + p3t1755: p3t1755@4800000236152a0090 { + compatible = "nxp,p3t1755"; + reg = <0x48 0x0236 0x152a0090>; + status = "okay"; + }; +}; diff --git a/samples/sensor/thermometer/sample.yaml b/samples/sensor/thermometer/sample.yaml index 168c8ffc74b49..4cce8e3973ee9 100644 --- a/samples/sensor/thermometer/sample.yaml +++ b/samples/sensor/thermometer/sample.yaml @@ -10,3 +10,4 @@ tests: - frdm_k22f # tcn75a - robokit1 # ntc_thermistor - adi_eval_adin1110ebz # adt7420 + - frdm_mcxn947/mcxn947/cpu0 # p3t1755 From d207ee976de4a9757f531ac619f8c3941d3919cb Mon Sep 17 00:00:00 2001 From: Radim Lipka Date: Mon, 16 Sep 2024 09:19:18 +0200 Subject: [PATCH 1707/4482] modules: hal_nxp: osa: Remove deprecated OSA API New location of current OSA API available in /hal/nxp/mcux/mcux-sdk/components/osa Signed-off-by: Radim Lipka --- modules/hal_nxp/fsl_os_abstraction.h | 17 ----------------- west.yml | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 modules/hal_nxp/fsl_os_abstraction.h diff --git a/modules/hal_nxp/fsl_os_abstraction.h b/modules/hal_nxp/fsl_os_abstraction.h deleted file mode 100644 index 1f02b68609780..0000000000000 --- a/modules/hal_nxp/fsl_os_abstraction.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2022 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef __FSL_OS_ABSTRACTION__ -#define __FSL_OS_ABSTRACTION__ - -#include - -/* enter critical macros */ -#define OSA_SR_ALLOC() int osa_current_sr -#define OSA_ENTER_CRITICAL() osa_current_sr = irq_lock() -#define OSA_EXIT_CRITICAL() irq_unlock(osa_current_sr) - -#endif /* __FSL_OS_ABSTRACTION__ */ diff --git a/west.yml b/west.yml index 0108755946f9e..60cdb99d385c4 100644 --- a/west.yml +++ b/west.yml @@ -198,7 +198,7 @@ manifest: groups: - hal - name: hal_nxp - revision: 78b3972e2ccb884057b838c9f60979a4c5602b18 + revision: 74a7735bb0775754a9c2058b225777d6ecfeaa6f path: modules/hal/nxp groups: - hal From b2ec8313b3bf8843a5c430295f863ea2266715bd Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Tue, 15 Oct 2024 11:09:15 +0200 Subject: [PATCH 1708/4482] dts-bindings: video: ov7725: Use video interfaces binding Switch to use the new video interfaces binding Signed-off-by: Phi Bang Nguyen --- boards/madmachine/mm_swiftio/mm_swiftio.dts | 2 +- dts/bindings/video/ovti,ov7725.yaml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/boards/madmachine/mm_swiftio/mm_swiftio.dts b/boards/madmachine/mm_swiftio/mm_swiftio.dts index 0ad825814d3d3..23c79e330fe5c 100644 --- a/boards/madmachine/mm_swiftio/mm_swiftio.dts +++ b/boards/madmachine/mm_swiftio/mm_swiftio.dts @@ -115,7 +115,7 @@ port { ov7725_ep_out: endpoint { - remote-endpoint = <&csi_ep_in>; + remote-endpoint-label = "csi_ep_in"; }; }; }; diff --git a/dts/bindings/video/ovti,ov7725.yaml b/dts/bindings/video/ovti,ov7725.yaml index 15b557d78e740..a3648234d6512 100644 --- a/dts/bindings/video/ovti,ov7725.yaml +++ b/dts/bindings/video/ovti,ov7725.yaml @@ -13,3 +13,7 @@ properties: reset. The sensor receives this as an active-low signal. include: i2c-device.yaml + +child-binding: + child-binding: + include: video-interfaces.yaml From 43569d9ab1542e2f9d3e2791ed1f884462c81138 Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Thu, 17 Oct 2024 10:39:06 +0200 Subject: [PATCH 1709/4482] dts-bindings: video: mt9m114: Use video interfaces binding Switch to use the new video interfaces binding Signed-off-by: Phi Bang Nguyen --- boards/shields/dvp_fpc24_mt9m114/dvp_fpc24_mt9m114.overlay | 2 +- dts/bindings/video/aptina,mt9m114.yaml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/boards/shields/dvp_fpc24_mt9m114/dvp_fpc24_mt9m114.overlay b/boards/shields/dvp_fpc24_mt9m114/dvp_fpc24_mt9m114.overlay index 52988535182d3..4b135455c82a3 100644 --- a/boards/shields/dvp_fpc24_mt9m114/dvp_fpc24_mt9m114.overlay +++ b/boards/shields/dvp_fpc24_mt9m114/dvp_fpc24_mt9m114.overlay @@ -17,7 +17,7 @@ port { mt9m114_ep_out: endpoint { - remote-endpoint = <&dfi_ep_in>; + remote-endpoint-label = "dfi_ep_in"; }; }; }; diff --git a/dts/bindings/video/aptina,mt9m114.yaml b/dts/bindings/video/aptina,mt9m114.yaml index 21dbefb5419ee..f8fcb6dc31d7d 100644 --- a/dts/bindings/video/aptina,mt9m114.yaml +++ b/dts/bindings/video/aptina,mt9m114.yaml @@ -1,4 +1,6 @@ # Copyright (c) 2019, Linaro Limited +# Copyright 2024 NXP +# # SPDX-License-Identifier: Apache-2.0 description: MT9M114 CMOS video sensor @@ -6,3 +8,7 @@ description: MT9M114 CMOS video sensor compatible: "aptina,mt9m114" include: i2c-device.yaml + +child-binding: + child-binding: + include: video-interfaces.yaml From 30604a8a76e303ba27efef0c8abc2ec3ff2572cc Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Tue, 15 Oct 2024 11:13:58 +0200 Subject: [PATCH 1710/4482] dts-bindings: video: ov5640: Use video interfaces binding Switch to use the new video interfaces binding Signed-off-by: Phi Bang Nguyen --- .../shields/nxp_btb44_ov5640/nxp_btb44_ov5640.overlay | 2 +- dts/bindings/video/ovti,ov5640.yaml | 4 ++++ .../video/mimxrt1170_evk_mimxrt1176_cm7.overlay | 10 ++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/boards/shields/nxp_btb44_ov5640/nxp_btb44_ov5640.overlay b/boards/shields/nxp_btb44_ov5640/nxp_btb44_ov5640.overlay index e7c179f5d2355..1397c2ecf5167 100644 --- a/boards/shields/nxp_btb44_ov5640/nxp_btb44_ov5640.overlay +++ b/boards/shields/nxp_btb44_ov5640/nxp_btb44_ov5640.overlay @@ -21,7 +21,7 @@ port { ov5640_ep_out: endpoint { - remote-endpoint = <&mipi_csi2rx_ep_in>; + remote-endpoint-label = "mipi_csi2rx_ep_in"; }; }; }; diff --git a/dts/bindings/video/ovti,ov5640.yaml b/dts/bindings/video/ovti,ov5640.yaml index eecb0e3d3192b..9b10d9b2d27ff 100644 --- a/dts/bindings/video/ovti,ov5640.yaml +++ b/dts/bindings/video/ovti,ov5640.yaml @@ -18,3 +18,7 @@ properties: description: | The PWDN pin is asserted to disable the sensor. The sensor receives this as an active-high signal. + +child-binding: + child-binding: + include: video-interfaces.yaml diff --git a/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay b/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay index 99542ad4c7825..eb787d9a3c3d4 100644 --- a/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay +++ b/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay @@ -8,6 +8,8 @@ * (and be extended to test) real hardware. */ +#include + / { test { #address-cells = <1>; @@ -34,6 +36,14 @@ reg = <0x1>; reset-gpios = <&test_gpio 0 0>; powerdown-gpios = <&test_gpio 1 0>; + + port { + ov5640_ep_out: endpoint { + remote-endpoint-label = "mipi_csi2rx_ep_in"; + bus-type = ; + data-lanes = <1 2>; + }; + }; }; }; From 328f40fddbc08f6aea33f42ff596134fb3e3d0dd Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Tue, 15 Oct 2024 11:16:18 +0200 Subject: [PATCH 1711/4482] dts-bindings: video: mipicsi2rx: Use video interfaces bindings Switch to use the new video interfaces bindings Signed-off-by: Phi Bang Nguyen --- .../nxp_btb44_ov5640/nxp_btb44_ov5640.overlay | 2 +- dts/arm/nxp/nxp_rt11xx.dtsi | 2 +- dts/bindings/video/nxp,mipi-csi2rx.yaml | 5 +++++ .../video/mimxrt1170_evk_mimxrt1176_cm7.overlay | 14 ++++++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/boards/shields/nxp_btb44_ov5640/nxp_btb44_ov5640.overlay b/boards/shields/nxp_btb44_ov5640/nxp_btb44_ov5640.overlay index 1397c2ecf5167..adab695be9c9f 100644 --- a/boards/shields/nxp_btb44_ov5640/nxp_btb44_ov5640.overlay +++ b/boards/shields/nxp_btb44_ov5640/nxp_btb44_ov5640.overlay @@ -37,7 +37,7 @@ reg = <1>; mipi_csi2rx_ep_in: endpoint { - remote-endpoint = <&ov5640_ep_out>; + remote-endpoint-label = "ov5640_ep_out"; }; }; }; diff --git a/dts/arm/nxp/nxp_rt11xx.dtsi b/dts/arm/nxp/nxp_rt11xx.dtsi index 5dd41ed398b66..10e27d7250713 100644 --- a/dts/arm/nxp/nxp_rt11xx.dtsi +++ b/dts/arm/nxp/nxp_rt11xx.dtsi @@ -909,7 +909,7 @@ port@0 { reg = <0>; mipi_csi2rx_ep_out: endpoint { - remote-endpoint = <&csi_ep_in>; + remote-endpoint-label = "csi_ep_in"; }; }; diff --git a/dts/bindings/video/nxp,mipi-csi2rx.yaml b/dts/bindings/video/nxp,mipi-csi2rx.yaml index 1726d63b3299e..c644083e61ffc 100644 --- a/dts/bindings/video/nxp,mipi-csi2rx.yaml +++ b/dts/bindings/video/nxp,mipi-csi2rx.yaml @@ -15,3 +15,8 @@ properties: required: true type: phandle description: the connected camera sensor + +child-binding: + child-binding: + child-binding: + include: video-interfaces.yaml diff --git a/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay b/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay index eb787d9a3c3d4..0619309444fc6 100644 --- a/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay +++ b/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay @@ -61,6 +61,20 @@ reg = <0x33334444 0x200>; status = "okay"; sensor = <&test_i2c_ov5640>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + + mipi_csi2rx_ep_in: endpoint { + remote-endpoint-label = "ov5640_ep_out"; + data-lanes = <1 2>; + }; + }; + }; }; }; }; From c1627d2819f8cfd203080e2c9ffc938d6625d046 Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Tue, 15 Oct 2024 11:18:21 +0200 Subject: [PATCH 1712/4482] dts-bindings: video: csi: Use video interfaces bindings Switch to use the new video interfaces bindings Signed-off-by: Phi Bang Nguyen --- boards/madmachine/mm_swiftio/mm_swiftio.dts | 2 +- boards/shields/dvp_fpc24_mt9m114/dvp_fpc24_mt9m114.overlay | 2 +- dts/arm/nxp/nxp_rt11xx.dtsi | 2 +- dts/bindings/video/nxp,imx-csi.yaml | 4 ++++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/boards/madmachine/mm_swiftio/mm_swiftio.dts b/boards/madmachine/mm_swiftio/mm_swiftio.dts index 23c79e330fe5c..b3898789ec392 100644 --- a/boards/madmachine/mm_swiftio/mm_swiftio.dts +++ b/boards/madmachine/mm_swiftio/mm_swiftio.dts @@ -198,7 +198,7 @@ port { csi_ep_in: endpoint { - remote-endpoint = <&ov7725_ep_out>; + remote-endpoint-label = "ov7725_ep_out"; }; }; }; diff --git a/boards/shields/dvp_fpc24_mt9m114/dvp_fpc24_mt9m114.overlay b/boards/shields/dvp_fpc24_mt9m114/dvp_fpc24_mt9m114.overlay index 4b135455c82a3..49bc018779a8f 100644 --- a/boards/shields/dvp_fpc24_mt9m114/dvp_fpc24_mt9m114.overlay +++ b/boards/shields/dvp_fpc24_mt9m114/dvp_fpc24_mt9m114.overlay @@ -28,7 +28,7 @@ port { dfi_ep_in: endpoint { - remote-endpoint = <&mt9m114_ep_out>; + remote-endpoint-label = "mt9m114_ep_out"; }; }; }; diff --git a/dts/arm/nxp/nxp_rt11xx.dtsi b/dts/arm/nxp/nxp_rt11xx.dtsi index 10e27d7250713..9ac5a32d6c61f 100644 --- a/dts/arm/nxp/nxp_rt11xx.dtsi +++ b/dts/arm/nxp/nxp_rt11xx.dtsi @@ -892,7 +892,7 @@ port { csi_ep_in: endpoint { - remote-endpoint = <&mipi_csi2rx_ep_out>; + remote-endpoint-label = "mipi_csi2rx_ep_out"; }; }; }; diff --git a/dts/bindings/video/nxp,imx-csi.yaml b/dts/bindings/video/nxp,imx-csi.yaml index bf7fd01eeaadd..fa24ea2590123 100644 --- a/dts/bindings/video/nxp,imx-csi.yaml +++ b/dts/bindings/video/nxp,imx-csi.yaml @@ -19,3 +19,7 @@ properties: type: phandle description: the connected source device, e.g., a mipi csi or a camera sensor + +child-binding: + child-binding: + include: video-interfaces.yaml From 317f050116fa9e853056a6b479c954b066538b4b Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Tue, 15 Oct 2024 11:26:16 +0200 Subject: [PATCH 1713/4482] boards: shields: nxp_btb44_ov5640: Add some endpoint properties The ov5640 camera driver now supports both MIPI CSI2 (DPHY) and DVP modes. It is in MIPI CSI2 mode in this overlay. Add bus-type property for this. In this mode, data-lanes property is required as well. Signed-off-by: Phi Bang Nguyen --- boards/shields/nxp_btb44_ov5640/nxp_btb44_ov5640.overlay | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/boards/shields/nxp_btb44_ov5640/nxp_btb44_ov5640.overlay b/boards/shields/nxp_btb44_ov5640/nxp_btb44_ov5640.overlay index adab695be9c9f..304df6bdb13ec 100644 --- a/boards/shields/nxp_btb44_ov5640/nxp_btb44_ov5640.overlay +++ b/boards/shields/nxp_btb44_ov5640/nxp_btb44_ov5640.overlay @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + /{ chosen { zephyr,camera = &nxp_csi; @@ -22,6 +24,8 @@ port { ov5640_ep_out: endpoint { remote-endpoint-label = "mipi_csi2rx_ep_in"; + bus-type = ; + data-lanes = <1 2>; }; }; }; @@ -38,6 +42,7 @@ mipi_csi2rx_ep_in: endpoint { remote-endpoint-label = "ov5640_ep_out"; + data-lanes = <1 2>; }; }; }; From 901f022cdb400630d0bdd0e4f82e67aebf18d91f Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Wed, 19 Jun 2024 14:56:05 +0200 Subject: [PATCH 1714/4482] drivers: video: mipi_csi2rx: Get data lanes number from devicetree Get number of data lanes from device tree instead of hard-coding it. Signed-off-by: Phi Bang Nguyen --- drivers/video/video_mcux_mipi_csi2rx.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/video/video_mcux_mipi_csi2rx.c b/drivers/video/video_mcux_mipi_csi2rx.c index 5ad56383fda4f..e303841ab6f68 100644 --- a/drivers/video/video_mcux_mipi_csi2rx.c +++ b/drivers/video/video_mcux_mipi_csi2rx.c @@ -14,11 +14,6 @@ LOG_MODULE_REGISTER(video_mipi_csi2rx, CONFIG_VIDEO_LOG_LEVEL); -/* - * Two data lanes are set by default as 2-lanes camera sensors are - * more common and more performant but single lane is also supported. - */ -#define DEFAULT_MIPI_CSI_NUM_LANES 2 #define DEFAULT_CAMERA_FRAME_RATE 30 struct mipi_csi2rx_config { @@ -102,8 +97,6 @@ static int mipi_csi2rx_set_fmt(const struct device *dev, enum video_endpoint_id }, }; - csi2rxConfig.laneNum = DEFAULT_MIPI_CSI_NUM_LANES; - for (i = 0; i < ARRAY_SIZE(csi2rxHsSettle); i++) { if ((fmt->width == csi2rxHsSettle[i][0]) && (fmt->height == csi2rxHsSettle[i][1]) && (DEFAULT_CAMERA_FRAME_RATE == csi2rxHsSettle[i][2])) { @@ -203,7 +196,11 @@ static int mipi_csi2rx_init(const struct device *dev) } #define MIPI_CSI2RX_INIT(n) \ - static struct mipi_csi2rx_data mipi_csi2rx_data_##n; \ + static struct mipi_csi2rx_data mipi_csi2rx_data_##n = { \ + .csi2rxConfig.laneNum = \ + DT_PROP_LEN(DT_CHILD(DT_CHILD(DT_INST_CHILD(n, ports), port_1), endpoint), \ + data_lanes), \ + }; \ \ static const struct mipi_csi2rx_config mipi_csi2rx_config_##n = { \ .base = (MIPI_CSI2RX_Type *)DT_INST_REG_ADDR(n), \ From f82b0d568140998e0552b3ba8b910a1451392fee Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Mon, 21 Oct 2024 21:53:23 +0200 Subject: [PATCH 1715/4482] drivers: video: mipi_csi2rx: Drop sensor device phandle reference The peer remote device "sensor_dev" can be retrieved from the remote-endpoint-label. Direct reference via phandle is not needed. Signed-off-by: Phi Bang Nguyen --- boards/shields/nxp_btb44_ov5640/nxp_btb44_ov5640.overlay | 2 -- drivers/video/video_mcux_mipi_csi2rx.c | 7 ++++++- dts/bindings/video/nxp,mipi-csi2rx.yaml | 6 ------ .../build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay | 1 - 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/boards/shields/nxp_btb44_ov5640/nxp_btb44_ov5640.overlay b/boards/shields/nxp_btb44_ov5640/nxp_btb44_ov5640.overlay index 304df6bdb13ec..9eca70c27cdeb 100644 --- a/boards/shields/nxp_btb44_ov5640/nxp_btb44_ov5640.overlay +++ b/boards/shields/nxp_btb44_ov5640/nxp_btb44_ov5640.overlay @@ -34,8 +34,6 @@ &nxp_mipi_csi { status = "okay"; - sensor = <&ov5640>; - ports { port@1 { reg = <1>; diff --git a/drivers/video/video_mcux_mipi_csi2rx.c b/drivers/video/video_mcux_mipi_csi2rx.c index e303841ab6f68..f377a56832c5a 100644 --- a/drivers/video/video_mcux_mipi_csi2rx.c +++ b/drivers/video/video_mcux_mipi_csi2rx.c @@ -16,6 +16,11 @@ LOG_MODULE_REGISTER(video_mipi_csi2rx, CONFIG_VIDEO_LOG_LEVEL); #define DEFAULT_CAMERA_FRAME_RATE 30 +#define DEVICE_DT_INST_GET_SENSOR_DEV(n) \ + DEVICE_DT_GET(DT_GPARENT(DT_NODELABEL( \ + DT_STRING_TOKEN(DT_CHILD(DT_CHILD(DT_INST_CHILD(n, ports), port_1), endpoint), \ + remote_endpoint_label)))) + struct mipi_csi2rx_config { const MIPI_CSI2RX_Type *base; const struct device *sensor_dev; @@ -204,7 +209,7 @@ static int mipi_csi2rx_init(const struct device *dev) \ static const struct mipi_csi2rx_config mipi_csi2rx_config_##n = { \ .base = (MIPI_CSI2RX_Type *)DT_INST_REG_ADDR(n), \ - .sensor_dev = DEVICE_DT_GET(DT_INST_PHANDLE(n, sensor)), \ + .sensor_dev = DEVICE_DT_INST_GET_SENSOR_DEV(n), \ }; \ \ DEVICE_DT_INST_DEFINE(n, &mipi_csi2rx_init, NULL, &mipi_csi2rx_data_##n, \ diff --git a/dts/bindings/video/nxp,mipi-csi2rx.yaml b/dts/bindings/video/nxp,mipi-csi2rx.yaml index c644083e61ffc..727289e567b3d 100644 --- a/dts/bindings/video/nxp,mipi-csi2rx.yaml +++ b/dts/bindings/video/nxp,mipi-csi2rx.yaml @@ -10,12 +10,6 @@ compatible: "nxp,mipi-csi2rx" include: [base.yaml] -properties: - sensor: - required: true - type: phandle - description: the connected camera sensor - child-binding: child-binding: child-binding: diff --git a/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay b/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay index 0619309444fc6..aef4dce37c1c9 100644 --- a/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay +++ b/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay @@ -60,7 +60,6 @@ compatible = "nxp,mipi-csi2rx"; reg = <0x33334444 0x200>; status = "okay"; - sensor = <&test_i2c_ov5640>; ports { #address-cells = <1>; From a40505148c0c9ccf9ec0089f2436ad6800fa3ac5 Mon Sep 17 00:00:00 2001 From: Farah Fliss Date: Tue, 16 Jul 2024 11:19:43 +0200 Subject: [PATCH 1716/4482] drivers: video: mipi_csi2rx: Add set_ctrl callback Add set_ctrl callback to propagate controls to the sensor. Signed-off-by: Farah Fliss Signed-off-by: Phi Bang Nguyen --- drivers/video/video_mcux_mipi_csi2rx.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/video/video_mcux_mipi_csi2rx.c b/drivers/video/video_mcux_mipi_csi2rx.c index f377a56832c5a..4b7d608a1265c 100644 --- a/drivers/video/video_mcux_mipi_csi2rx.c +++ b/drivers/video/video_mcux_mipi_csi2rx.c @@ -180,12 +180,24 @@ static int mipi_csi2rx_get_caps(const struct device *dev, enum video_endpoint_id return video_get_caps(config->sensor_dev, ep, caps); } +static inline int mipi_csi2rx_set_ctrl(const struct device *dev, unsigned int cid, void *value) +{ + const struct mipi_csi2rx_config *config = dev->config; + + if (config->sensor_dev) { + return video_set_ctrl(config->sensor_dev, cid, value); + } + + return -ENOTSUP; +} + static const struct video_driver_api mipi_csi2rx_driver_api = { .get_caps = mipi_csi2rx_get_caps, .get_format = mipi_csi2rx_get_fmt, .set_format = mipi_csi2rx_set_fmt, .stream_start = mipi_csi2rx_stream_start, .stream_stop = mipi_csi2rx_stream_stop, + .set_ctrl = mipi_csi2rx_set_ctrl, }; static int mipi_csi2rx_init(const struct device *dev) From a182394725482d781a6bf6eaf696afd7050ab7e6 Mon Sep 17 00:00:00 2001 From: Trung Hieu Le Date: Wed, 24 Jul 2024 21:38:08 +0200 Subject: [PATCH 1717/4482] drivers: video: mipi_csi2rx: Set clocks according to pixel rate Instead of fixing csi2rx clock frequencies, set them according to the pixel rate got from the camera sensor. Signed-off-by: Trung Hieu Le Signed-off-by: Phi Bang Nguyen --- .../clock_control_mcux_ccm_rev2.c | 23 +++ drivers/video/video_mcux_mipi_csi2rx.c | 186 ++++++++++-------- dts/arm/nxp/nxp_rt11xx.dtsi | 3 + .../zephyr/dt-bindings/clock/imx_ccm_rev2.h | 5 + soc/nxp/imxrt/imxrt11xx/soc.c | 46 +++-- soc/nxp/imxrt/imxrt11xx/soc.h | 4 + .../mimxrt1170_evk_mimxrt1176_cm7.overlay | 3 + 7 files changed, 179 insertions(+), 91 deletions(-) diff --git a/drivers/clock_control/clock_control_mcux_ccm_rev2.c b/drivers/clock_control/clock_control_mcux_ccm_rev2.c index 3a709a776761f..a3c02451d18bd 100644 --- a/drivers/clock_control/clock_control_mcux_ccm_rev2.c +++ b/drivers/clock_control/clock_control_mcux_ccm_rev2.c @@ -225,6 +225,19 @@ static int mcux_ccm_get_subsys_rate(const struct device *dev, clock_root = kCLOCK_Root_Netc; break; #endif + +#if defined(CONFIG_VIDEO_MCUX_MIPI_CSI2RX) + case IMX_CCM_MIPI_CSI2RX_ROOT_CLK: + clock_root = kCLOCK_Root_Csi2; + break; + case IMX_CCM_MIPI_CSI2RX_ESC_CLK: + clock_root = kCLOCK_Root_Csi2_Esc; + break; + case IMX_CCM_MIPI_CSI2RX_UI_CLK: + clock_root = kCLOCK_Root_Csi2_Ui; + break; +#endif + default: return -EINVAL; } @@ -264,6 +277,16 @@ static int CCM_SET_FUNC_ATTR mcux_ccm_set_subsys_rate(const struct device *dev, */ return flexspi_clock_set_freq(clock_name, clock_rate); #endif + +#if defined(CONFIG_VIDEO_MCUX_MIPI_CSI2RX) + case IMX_CCM_MIPI_CSI2RX_ROOT_CLK: + return mipi_csi2rx_clock_set_freq(kCLOCK_Root_Csi2, clock_rate); + case IMX_CCM_MIPI_CSI2RX_UI_CLK: + return mipi_csi2rx_clock_set_freq(kCLOCK_Root_Csi2_Ui, clock_rate); + case IMX_CCM_MIPI_CSI2RX_ESC_CLK: + return mipi_csi2rx_clock_set_freq(kCLOCK_Root_Csi2_Esc, clock_rate); +#endif + default: /* Silence unused variable warning */ ARG_UNUSED(clock_rate); diff --git a/drivers/video/video_mcux_mipi_csi2rx.c b/drivers/video/video_mcux_mipi_csi2rx.c index 4b7d608a1265c..dc046541ffc6b 100644 --- a/drivers/video/video_mcux_mipi_csi2rx.c +++ b/drivers/video/video_mcux_mipi_csi2rx.c @@ -6,15 +6,19 @@ #define DT_DRV_COMPAT nxp_mipi_csi2rx +#include #include #include #include +#include #include LOG_MODULE_REGISTER(video_mipi_csi2rx, CONFIG_VIDEO_LOG_LEVEL); -#define DEFAULT_CAMERA_FRAME_RATE 30 +#define MAX_SUPPORTED_PIXEL_RATE MHZ(96) + +#define ABS(a, b) (a > b ? a - b : b - a) #define DEVICE_DT_INST_GET_SENSOR_DEV(n) \ DEVICE_DT_GET(DT_GPARENT(DT_NODELABEL( \ @@ -28,100 +32,106 @@ struct mipi_csi2rx_config { struct mipi_csi2rx_data { csi2rx_config_t csi2rxConfig; + const struct device *clock_dev; + clock_control_subsys_t clock_root; + clock_control_subsys_t clock_ui; + clock_control_subsys_t clock_esc; }; -static int mipi_csi2rx_set_fmt(const struct device *dev, enum video_endpoint_id ep, - struct video_format *fmt) +struct mipi_csi2rx_tHsSettleEscClk_config { + uint64_t pixel_rate; + uint8_t tHsSettle_EscClk; +}; + +/* Must be in pixel rate ascending order */ +const struct mipi_csi2rx_tHsSettleEscClk_config tHsSettleEscClk_configs[] = { + {MHZ(24), 0x24}, + {MHZ(48), 0x12}, + {MHZ(96), 0x09}, +}; + +static int mipi_csi2rx_update_settings(const struct device *dev, enum video_endpoint_id ep) { const struct mipi_csi2rx_config *config = dev->config; struct mipi_csi2rx_data *drv_data = dev->data; - csi2rx_config_t csi2rxConfig = {0}; - uint8_t i = 0; + uint8_t bpp; + uint64_t sensor_pixel_rate; + uint32_t root_clk_rate, ui_clk_rate, sensor_byte_clk, best_match; + int ret, ind = 0; + struct video_format fmt; + + ret = video_get_format(config->sensor_dev, ep, &fmt); + if (ret) { + LOG_ERR("Cannot get sensor_dev pixel format"); + return ret; + } - /* - * Initialize the MIPI CSI2 - * - * From D-PHY specification, the T-HSSETTLE should in the range of 85ns+6*UI to 145ns+10*UI - * UI is Unit Interval, equal to the duration of any HS state on the Clock Lane - * - * T-HSSETTLE = csi2rxConfig.tHsSettle_EscClk * (Tperiod of RxClkInEsc) - * - * csi2rxConfig.tHsSettle_EscClk setting for camera: - * - * Resolution | frame rate | T_HS_SETTLE - * ============================================= - * 720P | 30 | 0x12 - * --------------------------------------------- - * 720P | 15 | 0x17 - * --------------------------------------------- - * VGA | 30 | 0x1F - * --------------------------------------------- - * VGA | 15 | 0x24 - * --------------------------------------------- - * QVGA | 30 | 0x1F - * --------------------------------------------- - * QVGA | 15 | 0x24 - * --------------------------------------------- - */ - static const uint32_t csi2rxHsSettle[][4] = { - { - 1280, - 720, - 30, - 0x12, - }, - { - 1280, - 720, - 15, - 0x17, - }, - { - 640, - 480, - 30, - 0x1F, - }, - { - 640, - 480, - 15, - 0x24, - }, - { - 320, - 240, - 30, - 0x1F, - }, - { - 320, - 240, - 15, - 0x24, - }, - }; - - for (i = 0; i < ARRAY_SIZE(csi2rxHsSettle); i++) { - if ((fmt->width == csi2rxHsSettle[i][0]) && (fmt->height == csi2rxHsSettle[i][1]) && - (DEFAULT_CAMERA_FRAME_RATE == csi2rxHsSettle[i][2])) { - csi2rxConfig.tHsSettle_EscClk = csi2rxHsSettle[i][3]; - break; - } + ret = video_get_ctrl(config->sensor_dev, VIDEO_CID_PIXEL_RATE, &sensor_pixel_rate); + if (ret) { + LOG_ERR("Can not get sensor_dev pixel rate"); + return ret; } - if (i == ARRAY_SIZE(csi2rxHsSettle)) { - LOG_ERR("Unsupported resolution"); + if (sensor_pixel_rate > MAX_SUPPORTED_PIXEL_RATE) { + LOG_ERR("Sensor pixel rate is not supported"); return -ENOTSUP; } - drv_data->csi2rxConfig = csi2rxConfig; + bpp = video_pix_fmt_bpp(fmt.pixelformat) * 8; + sensor_byte_clk = sensor_pixel_rate * bpp / drv_data->csi2rxConfig.laneNum / 8; + + ret = clock_control_get_rate(drv_data->clock_dev, drv_data->clock_root, &root_clk_rate); + if (ret) { + return ret; + } + + if (sensor_byte_clk > root_clk_rate) { + ret = clock_control_set_rate(drv_data->clock_dev, drv_data->clock_root, + (clock_control_subsys_rate_t)sensor_byte_clk); + if (ret) { + return ret; + } + } + + ret = clock_control_get_rate(drv_data->clock_dev, drv_data->clock_ui, &ui_clk_rate); + if (ret) { + return ret; + } + + if (sensor_pixel_rate > ui_clk_rate) { + ret = clock_control_set_rate( + drv_data->clock_dev, drv_data->clock_ui, + (clock_control_subsys_rate_t)(uint32_t)sensor_pixel_rate); + if (ret) { + return ret; + } + } + + /* Find the supported sensor_pixel_rate closest to the desired one */ + best_match = tHsSettleEscClk_configs[ind].pixel_rate; + for (uint8_t i = 0; i < ARRAY_SIZE(tHsSettleEscClk_configs); i++) { + if (ABS(tHsSettleEscClk_configs[i].pixel_rate, sensor_pixel_rate) < + ABS(tHsSettleEscClk_configs[i].pixel_rate, best_match)) { + best_match = tHsSettleEscClk_configs[i].pixel_rate; + ind = i; + } + } + + drv_data->csi2rxConfig.tHsSettle_EscClk = tHsSettleEscClk_configs[ind].tHsSettle_EscClk; + + return ret; +} + +static int mipi_csi2rx_set_fmt(const struct device *dev, enum video_endpoint_id ep, + struct video_format *fmt) +{ + const struct mipi_csi2rx_config *config = dev->config; if (video_set_format(config->sensor_dev, ep, fmt)) { return -EIO; } - return 0; + return mipi_csi2rx_update_settings(dev, ep); } static int mipi_csi2rx_get_fmt(const struct device *dev, enum video_endpoint_id ep, @@ -203,13 +213,25 @@ static const struct video_driver_api mipi_csi2rx_driver_api = { static int mipi_csi2rx_init(const struct device *dev) { const struct mipi_csi2rx_config *config = dev->config; + struct mipi_csi2rx_data *drv_data = dev->data; + int ret; /* Check if there is any sensor device */ if (!device_is_ready(config->sensor_dev)) { return -ENODEV; } - return 0; + /* + * CSI2 escape clock should be in the range [60, 80] Mhz. We set it + * to 60 Mhz. + */ + ret = clock_control_set_rate(drv_data->clock_dev, drv_data->clock_esc, + (clock_control_subsys_rate_t)MHZ(60)); + if (ret) { + return ret; + } + + return mipi_csi2rx_update_settings(dev, VIDEO_EP_ALL); } #define MIPI_CSI2RX_INIT(n) \ @@ -217,6 +239,10 @@ static int mipi_csi2rx_init(const struct device *dev) .csi2rxConfig.laneNum = \ DT_PROP_LEN(DT_CHILD(DT_CHILD(DT_INST_CHILD(n, ports), port_1), endpoint), \ data_lanes), \ + .clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \ + .clock_root = (clock_control_subsys_t)DT_INST_CLOCKS_CELL_BY_IDX(n, 0, name), \ + .clock_ui = (clock_control_subsys_t)DT_INST_CLOCKS_CELL_BY_IDX(n, 1, name), \ + .clock_esc = (clock_control_subsys_t)DT_INST_CLOCKS_CELL_BY_IDX(n, 2, name), \ }; \ \ static const struct mipi_csi2rx_config mipi_csi2rx_config_##n = { \ diff --git a/dts/arm/nxp/nxp_rt11xx.dtsi b/dts/arm/nxp/nxp_rt11xx.dtsi index 9ac5a32d6c61f..e6425edce8091 100644 --- a/dts/arm/nxp/nxp_rt11xx.dtsi +++ b/dts/arm/nxp/nxp_rt11xx.dtsi @@ -901,6 +901,9 @@ compatible = "nxp,mipi-csi2rx"; reg = <0x40810000 0x200>; status = "disabled"; + clocks = <&ccm IMX_CCM_MIPI_CSI2RX_ROOT_CLK 0 0>, + <&ccm IMX_CCM_MIPI_CSI2RX_UI_CLK 0 0>, + <&ccm IMX_CCM_MIPI_CSI2RX_ESC_CLK 0 0>; ports { #address-cells = <1>; diff --git a/include/zephyr/dt-bindings/clock/imx_ccm_rev2.h b/include/zephyr/dt-bindings/clock/imx_ccm_rev2.h index 0778acb941cf4..f7d6b7afcd164 100644 --- a/include/zephyr/dt-bindings/clock/imx_ccm_rev2.h +++ b/include/zephyr/dt-bindings/clock/imx_ccm_rev2.h @@ -134,6 +134,11 @@ /* NETC */ #define IMX_CCM_NETC_CLK 0x1800UL +/* MIPI CSI2RX */ +#define IMX_CCM_MIPI_CSI2RX_ROOT_CLK 0x1900UL +#define IMX_CCM_MIPI_CSI2RX_UI_CLK 0x2000UL +#define IMX_CCM_MIPI_CSI2RX_ESC_CLK 0x2100UL + /* QTMR */ #define IMX_CCM_QTMR_CLK 0x6000UL #define IMX_CCM_QTMR1_CLK 0x6000UL diff --git a/soc/nxp/imxrt/imxrt11xx/soc.c b/soc/nxp/imxrt/imxrt11xx/soc.c index 7f1fca10c651b..4f1cca4dcc6db 100644 --- a/soc/nxp/imxrt/imxrt11xx/soc.c +++ b/soc/nxp/imxrt/imxrt11xx/soc.c @@ -474,17 +474,6 @@ static ALWAYS_INLINE void clock_init(void) CLOCK_EnableClock(kCLOCK_Video_Mux); VIDEO_MUX->VID_MUX_CTRL.SET = VIDEO_MUX_VID_MUX_CTRL_CSI_SEL_MASK; - /* Configure MIPI CSI-2 Rx clocks */ - rootCfg.div = 8; - rootCfg.mux = kCLOCK_CSI2_ClockRoot_MuxSysPll3Out; - CLOCK_SetRootClock(kCLOCK_Root_Csi2, &rootCfg); - - rootCfg.mux = kCLOCK_CSI2_ESC_ClockRoot_MuxSysPll3Out; - CLOCK_SetRootClock(kCLOCK_Root_Csi2_Esc, &rootCfg); - - rootCfg.mux = kCLOCK_CSI2_UI_ClockRoot_MuxSysPll3Out; - CLOCK_SetRootClock(kCLOCK_Root_Csi2_Ui, &rootCfg); - /* Enable power domain for MIPI CSI-2 */ PGMC_BPC4->BPC_POWER_CTRL |= (PGMC_BPC_BPC_POWER_CTRL_PSW_ON_SOFT_MASK | PGMC_BPC_BPC_POWER_CTRL_ISO_OFF_SOFT_MASK); @@ -682,6 +671,41 @@ void imxrt_post_init_display_interface(void) #endif +#if CONFIG_VIDEO_MCUX_MIPI_CSI2RX +int mipi_csi2rx_clock_set_freq(clock_root_t clock_root, uint32_t rate) +{ + clock_root_config_t rootCfg = {0}; + uint32_t freq; + clock_name_t clk_source; + + switch (clock_root) { + case kCLOCK_Root_Csi2: + rootCfg.mux = kCLOCK_CSI2_ClockRoot_MuxSysPll3Out; + break; + case kCLOCK_Root_Csi2_Esc: + rootCfg.mux = kCLOCK_CSI2_ESC_ClockRoot_MuxSysPll3Out; + break; + case kCLOCK_Root_Csi2_Ui: + rootCfg.mux = kCLOCK_CSI2_UI_ClockRoot_MuxSysPll3Out; + break; + default: + return -EINVAL; + } + + clk_source = CLOCK_GetRootClockSource(clock_root, rootCfg.mux); + freq = CLOCK_GetFreq(clk_source); + if (rate > freq) { + LOG_ERR("Requested rate is higher than the maximum clock frequency"); + return -EINVAL; + } + + rootCfg.div = (uint32_t)freq / rate; + CLOCK_SetRootClock(clock_root, &rootCfg); + + return 0; +} +#endif + /** * * @brief Perform basic hardware initialization diff --git a/soc/nxp/imxrt/imxrt11xx/soc.h b/soc/nxp/imxrt/imxrt11xx/soc.h index 88b344541793c..f3a7a8333a6ab 100644 --- a/soc/nxp/imxrt/imxrt11xx/soc.h +++ b/soc/nxp/imxrt/imxrt11xx/soc.h @@ -32,6 +32,10 @@ void imxrt_pre_init_display_interface(void); void imxrt_post_init_display_interface(void); #endif +#if CONFIG_VIDEO_MCUX_MIPI_CSI2RX +int mipi_csi2rx_clock_set_freq(clock_root_t clock_root, uint32_t rate); +#endif + void flexspi_clock_set_div(uint32_t value); uint32_t flexspi_clock_get_freq(void); diff --git a/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay b/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay index aef4dce37c1c9..ba127ef7eec24 100644 --- a/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay +++ b/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay @@ -60,6 +60,9 @@ compatible = "nxp,mipi-csi2rx"; reg = <0x33334444 0x200>; status = "okay"; + clocks = <&ccm IMX_CCM_MIPI_CSI2RX_ROOT_CLK 0 0>, + <&ccm IMX_CCM_MIPI_CSI2RX_UI_CLK 0 0>, + <&ccm IMX_CCM_MIPI_CSI2RX_ESC_CLK 0 0>; ports { #address-cells = <1>; From 8053b722af02a00e6afb37b0a7fd720af0d0db15 Mon Sep 17 00:00:00 2001 From: Trung Hieu Le Date: Tue, 23 Jul 2024 13:29:59 +0200 Subject: [PATCH 1718/4482] drivers: video: mipi_csi2rx: Add support for changing frame rate Add support for changing frame rate. Signed-off-by: Trung Hieu Le Signed-off-by: Phi Bang Nguyen --- drivers/video/video_mcux_mipi_csi2rx.c | 113 +++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/drivers/video/video_mcux_mipi_csi2rx.c b/drivers/video/video_mcux_mipi_csi2rx.c index dc046541ffc6b..a73c17efa07fe 100644 --- a/drivers/video/video_mcux_mipi_csi2rx.c +++ b/drivers/video/video_mcux_mipi_csi2rx.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -201,6 +202,115 @@ static inline int mipi_csi2rx_set_ctrl(const struct device *dev, unsigned int ci return -ENOTSUP; } +static int mipi_csi2rx_set_frmival(const struct device *dev, enum video_endpoint_id ep, + struct video_frmival *frmival) +{ + const struct mipi_csi2rx_config *config = dev->config; + int ret; + + ret = video_set_frmival(config->sensor_dev, ep, frmival); + if (ret) { + LOG_ERR("Cannot set sensor_dev frmival"); + return ret; + } + + ret = mipi_csi2rx_update_settings(dev, ep); + + return ret; +} + +static int mipi_csi2rx_get_frmival(const struct device *dev, enum video_endpoint_id ep, + struct video_frmival *frmival) +{ + const struct mipi_csi2rx_config *config = dev->config; + + return video_get_frmival(config->sensor_dev, ep, frmival); +} + +static uint64_t mipi_csi2rx_cal_frame_size(const struct video_format *fmt) +{ + return fmt->height * fmt->width * video_pix_fmt_bpp(fmt->pixelformat) * 8; +} + +static uint64_t mipi_csi2rx_estimate_pixel_rate(const struct video_frmival *cur_fmival, + const struct video_frmival *fie_frmival, + const struct video_format *cur_format, + const struct video_format *fie_format, + uint64_t cur_pixel_rate, uint8_t laneNum) +{ + return mipi_csi2rx_cal_frame_size(cur_format) * fie_frmival->denominator * + cur_fmival->numerator * cur_pixel_rate / + (mipi_csi2rx_cal_frame_size(fie_format) * fie_frmival->numerator * + cur_fmival->denominator); +} + +static int mipi_csi2rx_enum_frmival(const struct device *dev, enum video_endpoint_id ep, + struct video_frmival_enum *fie) +{ + const struct mipi_csi2rx_config *config = dev->config; + struct mipi_csi2rx_data *drv_data = dev->data; + int ret; + uint64_t cur_pixel_rate, est_pixel_rate; + struct video_frmival cur_frmival; + struct video_format cur_fmt; + + ret = video_enum_frmival(config->sensor_dev, ep, fie); + if (ret) { + return ret; + } + + ret = video_get_ctrl(config->sensor_dev, VIDEO_CID_PIXEL_RATE, &cur_pixel_rate); + if (ret) { + LOG_ERR("Cannot get sensor_dev pixel rate"); + return ret; + } + + ret = video_get_frmival(config->sensor_dev, ep, &cur_frmival); + if (ret) { + LOG_ERR("Cannot get sensor_dev frame rate"); + return ret; + } + + ret = video_get_format(config->sensor_dev, ep, &cur_fmt); + if (ret) { + LOG_ERR("Cannot get sensor_dev format"); + return ret; + } + + if (fie->type == VIDEO_FRMIVAL_TYPE_DISCRETE) { + est_pixel_rate = mipi_csi2rx_estimate_pixel_rate( + &cur_frmival, &fie->discrete, &cur_fmt, fie->format, cur_pixel_rate, + drv_data->csi2rxConfig.laneNum); + if (est_pixel_rate > MAX_SUPPORTED_PIXEL_RATE) { + return -EINVAL; + } + + } else { + /* Check the lane rate of the lower bound framerate */ + est_pixel_rate = mipi_csi2rx_estimate_pixel_rate( + &cur_frmival, &fie->stepwise.min, &cur_fmt, fie->format, cur_pixel_rate, + drv_data->csi2rxConfig.laneNum); + if (est_pixel_rate > MAX_SUPPORTED_PIXEL_RATE) { + return -EINVAL; + } + + /* Check the lane rate of the upper bound framerate */ + est_pixel_rate = mipi_csi2rx_estimate_pixel_rate( + &cur_frmival, &fie->stepwise.max, &cur_fmt, fie->format, cur_pixel_rate, + drv_data->csi2rxConfig.laneNum); + if (est_pixel_rate > MAX_SUPPORTED_PIXEL_RATE) { + fie->stepwise.max.denominator = + (mipi_csi2rx_cal_frame_size(&cur_fmt) * MAX_SUPPORTED_PIXEL_RATE * + cur_frmival.denominator) / + (mipi_csi2rx_cal_frame_size(fie->format) * cur_pixel_rate * + cur_frmival.numerator); + fie->stepwise.max.numerator = 1; + } + } + + return 0; +} + static const struct video_driver_api mipi_csi2rx_driver_api = { .get_caps = mipi_csi2rx_get_caps, .get_format = mipi_csi2rx_get_fmt, @@ -208,6 +318,9 @@ static const struct video_driver_api mipi_csi2rx_driver_api = { .stream_start = mipi_csi2rx_stream_start, .stream_stop = mipi_csi2rx_stream_stop, .set_ctrl = mipi_csi2rx_set_ctrl, + .set_frmival = mipi_csi2rx_set_frmival, + .get_frmival = mipi_csi2rx_get_frmival, + .enum_frmival = mipi_csi2rx_enum_frmival, }; static int mipi_csi2rx_init(const struct device *dev) From 29f38b81e2d035df63363468e1eb9f87ae7db2ae Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Wed, 23 Oct 2024 12:42:51 +0200 Subject: [PATCH 1719/4482] include: video: Add an utility function to get bytes per pixel As getting bytes per pixel of a pixel format is a very common operation, add an utility function for it instead of repeating the same codes in different drivers. Signed-off-by: Phi Bang Nguyen --- drivers/video/video_mcux_csi.c | 19 ------------------- drivers/video/video_stm32_dcmi.c | 16 ---------------- include/zephyr/drivers/video.h | 24 ++++++++++++++++++++++++ 3 files changed, 24 insertions(+), 35 deletions(-) diff --git a/drivers/video/video_mcux_csi.c b/drivers/video/video_mcux_csi.c index c6a82accdb40b..0818cc04098df 100644 --- a/drivers/video/video_mcux_csi.c +++ b/drivers/video/video_mcux_csi.c @@ -32,25 +32,6 @@ struct video_mcux_csi_data { struct k_poll_signal *signal; }; -static inline unsigned int video_pix_fmt_bpp(uint32_t pixelformat) -{ - switch (pixelformat) { - case VIDEO_PIX_FMT_BGGR8: - case VIDEO_PIX_FMT_GBRG8: - case VIDEO_PIX_FMT_GRBG8: - case VIDEO_PIX_FMT_RGGB8: - return 1; - case VIDEO_PIX_FMT_RGB565: - case VIDEO_PIX_FMT_YUYV: - return 2; - case VIDEO_PIX_FMT_XRGB32: - case VIDEO_PIX_FMT_XYUV32: - return 4; - default: - return 0; - } -} - static void __frame_done_cb(CSI_Type *base, csi_handle_t *handle, status_t status, void *user_data) { struct video_mcux_csi_data *data = user_data; diff --git a/drivers/video/video_stm32_dcmi.c b/drivers/video/video_stm32_dcmi.c index 135f38d238dac..2af5dc14b5a9c 100644 --- a/drivers/video/video_stm32_dcmi.c +++ b/drivers/video/video_stm32_dcmi.c @@ -54,22 +54,6 @@ struct video_stm32_dcmi_config { const struct stream dma; }; -static inline unsigned int video_pix_fmt_bpp(uint32_t pixelformat) -{ - switch (pixelformat) { - case VIDEO_PIX_FMT_BGGR8: - case VIDEO_PIX_FMT_GBRG8: - case VIDEO_PIX_FMT_GRBG8: - case VIDEO_PIX_FMT_RGGB8: - return 1; - case VIDEO_PIX_FMT_RGB565: - case VIDEO_PIX_FMT_YUYV: - return 2; - default: - return 0; - } -} - void HAL_DCMI_ErrorCallback(DCMI_HandleTypeDef *hdcmi) { LOG_WRN("%s", __func__); diff --git a/include/zephyr/drivers/video.h b/include/zephyr/drivers/video.h index b90707383166a..fb647cac70fb1 100644 --- a/include/zephyr/drivers/video.h +++ b/include/zephyr/drivers/video.h @@ -827,6 +827,30 @@ void video_buffer_release(struct video_buffer *buf); * @} */ +/** + * @brief Get number of bytes per pixel of a pixel format + * + * @param pixfmt FourCC pixel format value (\ref video_pixel_formats). + */ +static inline unsigned int video_pix_fmt_bpp(uint32_t pixfmt) +{ + switch (pixfmt) { + case VIDEO_PIX_FMT_BGGR8: + case VIDEO_PIX_FMT_GBRG8: + case VIDEO_PIX_FMT_GRBG8: + case VIDEO_PIX_FMT_RGGB8: + return 1; + case VIDEO_PIX_FMT_RGB565: + case VIDEO_PIX_FMT_YUYV: + return 2; + case VIDEO_PIX_FMT_XRGB32: + case VIDEO_PIX_FMT_XYUV32: + return 4; + default: + return 0; + } +} + #ifdef __cplusplus } #endif From 5bbaffe7c36a52a5fb2d84d7f7477e6e3d418c46 Mon Sep 17 00:00:00 2001 From: Trung Hieu Le Date: Mon, 22 Jul 2024 17:23:39 +0200 Subject: [PATCH 1720/4482] drivers: video: csi: Add support for changing frame rate Add support for changing frame rate Signed-off-by: Trung Hieu Le Signed-off-by: Phi Bang Nguyen --- drivers/video/video_mcux_csi.c | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/video/video_mcux_csi.c b/drivers/video/video_mcux_csi.c index 0818cc04098df..f6d20c2da3677 100644 --- a/drivers/video/video_mcux_csi.c +++ b/drivers/video/video_mcux_csi.c @@ -431,6 +431,42 @@ static int video_mcux_csi_set_signal(const struct device *dev, enum video_endpoi } #endif +static int video_mcux_csi_set_frmival(const struct device *dev, enum video_endpoint_id ep, + struct video_frmival *frmival) +{ + const struct video_mcux_csi_config *config = dev->config; + + return video_set_frmival(config->source_dev, ep, frmival); +} + +static int video_mcux_csi_get_frmival(const struct device *dev, enum video_endpoint_id ep, + struct video_frmival *frmival) +{ + const struct video_mcux_csi_config *config = dev->config; + + return video_get_frmival(config->source_dev, ep, frmival); +} + +static int video_mcux_csi_enum_frmival(const struct device *dev, enum video_endpoint_id ep, + struct video_frmival_enum *fie) +{ + const struct video_mcux_csi_config *config = dev->config; + const struct video_format *fie_fmt = fie->format; + int ret; + +#if defined(CONFIG_VIDEO_MCUX_MIPI_CSI2RX) + struct video_format converted_fmt = *fie->format; + + video_pix_fmt_convert(&converted_fmt, false); + fie->format = &converted_fmt; +#endif + + ret = video_enum_frmival(config->source_dev, ep, fie); + fie->format = fie_fmt; + + return ret; +} + static const struct video_driver_api video_mcux_csi_driver_api = { .set_format = video_mcux_csi_set_fmt, .get_format = video_mcux_csi_get_fmt, @@ -442,6 +478,9 @@ static const struct video_driver_api video_mcux_csi_driver_api = { .set_ctrl = video_mcux_csi_set_ctrl, .get_ctrl = video_mcux_csi_get_ctrl, .get_caps = video_mcux_csi_get_caps, + .set_frmival = video_mcux_csi_set_frmival, + .get_frmival = video_mcux_csi_get_frmival, + .enum_frmival = video_mcux_csi_enum_frmival, #ifdef CONFIG_POLL .set_signal = video_mcux_csi_set_signal, #endif From 1dd96ba9f9f001924e68be4c1a05bf2740b140c1 Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Wed, 24 Jul 2024 19:00:39 +0200 Subject: [PATCH 1721/4482] drivers: video: csi: Remove obsolete comment Remove the obsolete comment about the init order of the CSI and the camera sensors (e.g. mt9m114) which is not true anymore. Signed-off-by: Phi Bang Nguyen --- drivers/video/video_mcux_csi.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/video/video_mcux_csi.c b/drivers/video/video_mcux_csi.c index f6d20c2da3677..9909cbd323a8a 100644 --- a/drivers/video/video_mcux_csi.c +++ b/drivers/video/video_mcux_csi.c @@ -510,11 +510,6 @@ static int video_mcux_csi_init_0(const struct device *dev) return video_mcux_csi_init(dev); } -/* CONFIG_KERNEL_INIT_PRIORITY_DEVICE is used to make sure the - * CSI peripheral is initialized before the camera, which is - * necessary since the clock to the camera is provided by the - * CSI peripheral. - */ DEVICE_DT_INST_DEFINE(0, &video_mcux_csi_init_0, NULL, &video_mcux_csi_data_0, &video_mcux_csi_config_0, POST_KERNEL, CONFIG_VIDEO_MCUX_CSI_INIT_PRIORITY, &video_mcux_csi_driver_api); From 59e253ed4a952317e0e7c637b1ac21219cb1c51a Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Mon, 21 Oct 2024 22:00:15 +0200 Subject: [PATCH 1722/4482] drivers: video: csi: Drop source device phandle reference The peer remote device "source_dev" can be retrieved from the remote-endpoint-label. Direct reference via phandle is not needed. Signed-off-by: Phi Bang Nguyen --- boards/madmachine/mm_swiftio/mm_swiftio.dts | 1 - .../boards/mimxrt1060_evkb.overlay | 9 --------- .../boards/mimxrt1064_evk.overlay | 9 --------- drivers/video/video_mcux_csi.c | 12 +++++++++++- dts/arm/nxp/nxp_rt11xx.dtsi | 1 - dts/bindings/video/nxp,imx-csi.yaml | 6 ------ .../video/mimxrt1170_evk_mimxrt1176_cm7.overlay | 14 +++++++++++++- 7 files changed, 24 insertions(+), 28 deletions(-) delete mode 100644 boards/shields/dvp_fpc24_mt9m114/boards/mimxrt1060_evkb.overlay delete mode 100644 boards/shields/dvp_fpc24_mt9m114/boards/mimxrt1064_evk.overlay diff --git a/boards/madmachine/mm_swiftio/mm_swiftio.dts b/boards/madmachine/mm_swiftio/mm_swiftio.dts index b3898789ec392..14af45b01b800 100644 --- a/boards/madmachine/mm_swiftio/mm_swiftio.dts +++ b/boards/madmachine/mm_swiftio/mm_swiftio.dts @@ -192,7 +192,6 @@ &csi { status = "okay"; - source = <&ov7725>; pinctrl-0 = <&pinmux_csi>; pinctrl-names = "default"; diff --git a/boards/shields/dvp_fpc24_mt9m114/boards/mimxrt1060_evkb.overlay b/boards/shields/dvp_fpc24_mt9m114/boards/mimxrt1060_evkb.overlay deleted file mode 100644 index a4aa7a273080d..0000000000000 --- a/boards/shields/dvp_fpc24_mt9m114/boards/mimxrt1060_evkb.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&dvp_fpc24_interface { - source = <&mt9m114>; -}; diff --git a/boards/shields/dvp_fpc24_mt9m114/boards/mimxrt1064_evk.overlay b/boards/shields/dvp_fpc24_mt9m114/boards/mimxrt1064_evk.overlay deleted file mode 100644 index a4aa7a273080d..0000000000000 --- a/boards/shields/dvp_fpc24_mt9m114/boards/mimxrt1064_evk.overlay +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright 2024 NXP - * - * SPDX-License-Identifier: Apache-2.0 - */ - -&dvp_fpc24_interface { - source = <&mt9m114>; -}; diff --git a/drivers/video/video_mcux_csi.c b/drivers/video/video_mcux_csi.c index 9909cbd323a8a..06b45dace1660 100644 --- a/drivers/video/video_mcux_csi.c +++ b/drivers/video/video_mcux_csi.c @@ -17,6 +17,16 @@ #include #endif +#if defined(CONFIG_VIDEO_MCUX_MIPI_CSI2RX) +#define DEVICE_DT_INST_GET_SOURCE_DEV(n) \ + DEVICE_DT_GET(DT_PARENT(DT_GPARENT(DT_NODELABEL(DT_STRING_TOKEN( \ + DT_CHILD(DT_INST_CHILD(n, port), endpoint), remote_endpoint_label))))) +#else +#define DEVICE_DT_INST_GET_SOURCE_DEV(n) \ + DEVICE_DT_GET(DT_GPARENT(DT_NODELABEL(DT_STRING_TOKEN( \ + DT_CHILD(DT_INST_CHILD(n, port), endpoint), remote_endpoint_label)))) +#endif + struct video_mcux_csi_config { CSI_Type *base; const struct device *source_dev; @@ -491,7 +501,7 @@ PINCTRL_DT_INST_DEFINE(0); static const struct video_mcux_csi_config video_mcux_csi_config_0 = { .base = (CSI_Type *)DT_INST_REG_ADDR(0), - .source_dev = DEVICE_DT_GET(DT_INST_PHANDLE(0, source)), + .source_dev = DEVICE_DT_INST_GET_SOURCE_DEV(0), .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0), }; diff --git a/dts/arm/nxp/nxp_rt11xx.dtsi b/dts/arm/nxp/nxp_rt11xx.dtsi index e6425edce8091..30b6c5a404579 100644 --- a/dts/arm/nxp/nxp_rt11xx.dtsi +++ b/dts/arm/nxp/nxp_rt11xx.dtsi @@ -888,7 +888,6 @@ reg = <0x40800000 0x4000>; interrupts = <56 1>; status = "disabled"; - source = <&mipi_csi2rx>; port { csi_ep_in: endpoint { diff --git a/dts/bindings/video/nxp,imx-csi.yaml b/dts/bindings/video/nxp,imx-csi.yaml index fa24ea2590123..f8f146c9c425d 100644 --- a/dts/bindings/video/nxp,imx-csi.yaml +++ b/dts/bindings/video/nxp,imx-csi.yaml @@ -14,12 +14,6 @@ properties: interrupts: required: true - source: - required: true - type: phandle - description: the connected source device, - e.g., a mipi csi or a camera sensor - child-binding: child-binding: include: video-interfaces.yaml diff --git a/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay b/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay index ba127ef7eec24..3e628f79ac387 100644 --- a/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay +++ b/tests/drivers/build_all/video/mimxrt1170_evk_mimxrt1176_cm7.overlay @@ -53,7 +53,12 @@ status = "okay"; interrupt-parent = <&nvic>; interrupts = <56 1>; - source = <&test_mipi_csi2rx>; + + port { + test_csi_ep_in: endpoint { + remote-endpoint-label = "test_mipi_csi2rx_ep_out"; + }; + }; }; test_mipi_csi2rx: mipi_csi2rx@33334444 { @@ -68,6 +73,13 @@ #address-cells = <1>; #size-cells = <0>; + port@0 { + reg = <0>; + test_mipi_csi2rx_ep_out: endpoint { + remote-endpoint-label = "test_csi_ep_in"; + }; + }; + port@1 { reg = <1>; From a738613dcff2547f52bf079f415689ed0bfe42aa Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Mon, 21 Oct 2024 22:00:45 +0200 Subject: [PATCH 1723/4482] drivers: video: csi: Increase init priority The CSI needs to be initialized BEFORE the camera sensor to provide clock to the camera sensor. It is now possible to do so as direct reference to the sensor via phandle is now removed. There will be no check failure on the init order anymore when compiling. Signed-off-by: Phi Bang Nguyen --- drivers/video/Kconfig.mcux_csi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/Kconfig.mcux_csi b/drivers/video/Kconfig.mcux_csi index 88b57d3b461f1..e9bc48c7bd091 100644 --- a/drivers/video/Kconfig.mcux_csi +++ b/drivers/video/Kconfig.mcux_csi @@ -11,7 +11,7 @@ config VIDEO_MCUX_CSI config VIDEO_MCUX_CSI_INIT_PRIORITY int "NXP MCUX CSI init priority" - default 61 + default 59 depends on VIDEO_MCUX_CSI help Initialization priority for the CSI interface on an NXP MCUX device. From 5e41249ddfc3459f28f19c723fcf0c076268b2f4 Mon Sep 17 00:00:00 2001 From: Phi Bang Nguyen Date: Wed, 24 Jul 2024 19:04:51 +0200 Subject: [PATCH 1724/4482] drivers: video: csi: Add NXP copyright The CSI is an NXP IP and the driver has been very much changed by NXP, so add NXP copyright to it. Signed-off-by: Phi Bang Nguyen --- drivers/video/video_mcux_csi.c | 1 + dts/bindings/video/nxp,imx-csi.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/video/video_mcux_csi.c b/drivers/video/video_mcux_csi.c index 06b45dace1660..244dc61ab6a66 100644 --- a/drivers/video/video_mcux_csi.c +++ b/drivers/video/video_mcux_csi.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2019, Linaro Limited + * Copyright 2024 NXP * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/dts/bindings/video/nxp,imx-csi.yaml b/dts/bindings/video/nxp,imx-csi.yaml index f8f146c9c425d..ee3790dffb003 100644 --- a/dts/bindings/video/nxp,imx-csi.yaml +++ b/dts/bindings/video/nxp,imx-csi.yaml @@ -1,5 +1,6 @@ # # Copyright (c) 2019, Linaro Limited +# Copyright 2024 NXP # # SPDX-License-Identifier: Apache-2.0 # From 573c18f42ad28f420d7210f2a9b19e64ab595af5 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Fri, 16 Aug 2024 20:50:16 +1000 Subject: [PATCH 1725/4482] bluetooth: hci: dedicated symbols for SPI variants Add dedicated Kconfig symbols for the two SPI backend variants. This allows enabling the symbols by default from devicetree, and cleans up the cmake logic. Signed-off-by: Jordan Yates --- drivers/bluetooth/hci/CMakeLists.txt | 9 ++--- drivers/bluetooth/hci/Kconfig | 51 ++++++++++++++++++---------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/drivers/bluetooth/hci/CMakeLists.txt b/drivers/bluetooth/hci/CMakeLists.txt index 91daa9d9cb7a4..954477a54c7a9 100644 --- a/drivers/bluetooth/hci/CMakeLists.txt +++ b/drivers/bluetooth/hci/CMakeLists.txt @@ -20,13 +20,8 @@ endif() zephyr_library_sources_ifdef(CONFIG_BT_H4 h4.c) zephyr_library_sources_ifdef(CONFIG_BT_H5 h5.c) zephyr_library_sources_ifdef(CONFIG_BT_HCI_IPC ipc.c) -if(CONFIG_BT_SPI) - if ((CONFIG_DT_HAS_ST_HCI_SPI_V1_ENABLED) OR (CONFIG_DT_HAS_ST_HCI_SPI_V2_ENABLED)) - zephyr_library_sources(hci_spi_st.c) - else() - zephyr_library_sources(spi.c) - endif() -endif() +zephyr_library_sources_ifdef(CONFIG_BT_SPI_ZEPHYR spi.c) +zephyr_library_sources_ifdef(CONFIG_BT_SPI_BLUENRG hci_spi_st.c) zephyr_library_sources_ifdef(CONFIG_BT_CYW43XX h4_ifx_cyw43xxx.c) zephyr_library_sources_ifdef(CONFIG_BT_CYW208XX hci_ifx_cyw208xx.c) diff --git a/drivers/bluetooth/hci/Kconfig b/drivers/bluetooth/hci/Kconfig index 32ad3b7258453..9355f40eeec05 100644 --- a/drivers/bluetooth/hci/Kconfig +++ b/drivers/bluetooth/hci/Kconfig @@ -48,15 +48,46 @@ config BT_HCI_IPC using the IPC subsystem. config BT_SPI - bool "SPI HCI" + bool select SPI help Supports Bluetooth ICs using SPI as the communication protocol. HCI packets are sent and received as single Byte transfers, - prepended after a known header. Headers may vary per device, so + prepended after a known header. Headers may vary per device, so additional platform specific knowledge may need to be added as devices are. +config BT_SPI_INIT_PRIORITY + int "BT SPI init priority" + depends on BT_SPI + default 75 + +config BT_SPI_ZEPHYR + bool + default y + depends on DT_HAS_ZEPHYR_BT_HCI_SPI_ENABLED + select BT_SPI + help + Bluetooth HCI over SPI driver for communication with Bluetooth + controllers running Zephyr. + +config BT_SPI_BLUENRG + bool + default y + depends on DT_HAS_ST_HCI_SPI_V1_ENABLED || DT_HAS_ST_HCI_SPI_V2_ENABLED + select BT_SPI + help + Bluetooth HCI over SPI driver for communication with + STMicroelectronics BlueNRG devices. + +config BT_BLUENRG_ACI + bool "ACI message with BlueNRG-based devices" + depends on BT_SPI_BLUENRG + select BT_HCI_SET_PUBLIC_ADDR + help + Enable support for devices compatible with the BlueNRG Bluetooth + Stack. Current driver supports: ST BLUENRG-MS. + config BT_STM32_IPM bool default y @@ -159,22 +190,6 @@ config BT_AMBIQ_HCI Supports Ambiq Bluetooth SoC using SPI as the communication protocol. HCI packets are sent and received as single Byte transfers. - -if BT_SPI - -config BT_SPI_INIT_PRIORITY - int "BT SPI init priority" - default 75 - -config BT_BLUENRG_ACI - bool "ACI message with BlueNRG-based devices" - select BT_HCI_SET_PUBLIC_ADDR - help - Enable support for devices compatible with the BlueNRG Bluetooth - Stack. Current driver supports: ST BLUENRG-MS. - -endif # BT_SPI - config BT_HCI_INIT_PRIORITY int "BT HCI init priority" default 75 if BT_AMBIQ_HCI From e876c5d4877941c38007a97f6cf098ed87a6d59c Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Fri, 16 Aug 2024 21:35:59 +1000 Subject: [PATCH 1726/4482] boards: remove `HCI_SPI` defaults The `HCI_SPI` symbol is now automatically selected from devicetree, removing the need for board specific defaults. Signed-off-by: Jordan Yates --- boards/96boards/carbon/Kconfig.defconfig | 10 ---------- boards/shields/x_nucleo_bnrg2a1/Kconfig.defconfig | 6 ------ boards/shields/x_nucleo_idb05a1/Kconfig.defconfig | 6 ------ boards/shields/x_nucleo_wb05kn1/Kconfig.defconfig | 12 ------------ boards/st/b_l4s5i_iot01a/Kconfig.defconfig | 6 ------ boards/st/disco_l475_iot1/Kconfig.defconfig | 6 ------ boards/st/sensortile_box/Kconfig.defconfig | 6 ------ boards/st/sensortile_box_pro/Kconfig.defconfig | 6 ------ boards/st/steval_stwinbx1/Kconfig.defconfig | 6 ------ boards/st/stm32l562e_dk/Kconfig.defconfig | 6 ------ doc/releases/migration-guide-4.0.rst | 2 ++ 11 files changed, 2 insertions(+), 70 deletions(-) diff --git a/boards/96boards/carbon/Kconfig.defconfig b/boards/96boards/carbon/Kconfig.defconfig index 2cf1bbdc6fcec..3fe660ff6d35b 100644 --- a/boards/96boards/carbon/Kconfig.defconfig +++ b/boards/96boards/carbon/Kconfig.defconfig @@ -9,16 +9,6 @@ config SPI_STM32_INTERRUPT default y depends on SPI -if BT - -config SPI - default y - -config BT_SPI - default y - -endif # BT - endif # BOARD_96B_CARBON_STM32F401XE if BOARD_96B_CARBON_NRF51822 diff --git a/boards/shields/x_nucleo_bnrg2a1/Kconfig.defconfig b/boards/shields/x_nucleo_bnrg2a1/Kconfig.defconfig index 94ace9e384989..0c42f5dcb4072 100644 --- a/boards/shields/x_nucleo_bnrg2a1/Kconfig.defconfig +++ b/boards/shields/x_nucleo_bnrg2a1/Kconfig.defconfig @@ -5,12 +5,6 @@ if SHIELD_X_NUCLEO_BNRG2A1 if BT -config SPI - default y - -config BT_SPI - default y - config BT_BLUENRG_ACI default y diff --git a/boards/shields/x_nucleo_idb05a1/Kconfig.defconfig b/boards/shields/x_nucleo_idb05a1/Kconfig.defconfig index 276ee66467992..4e346ea3e642e 100644 --- a/boards/shields/x_nucleo_idb05a1/Kconfig.defconfig +++ b/boards/shields/x_nucleo_idb05a1/Kconfig.defconfig @@ -5,12 +5,6 @@ if SHIELD_X_NUCLEO_IDB05A1 if BT -config SPI - default y - -config BT_SPI - default y - config BT_BLUENRG_ACI default y # Disable Flow control diff --git a/boards/shields/x_nucleo_wb05kn1/Kconfig.defconfig b/boards/shields/x_nucleo_wb05kn1/Kconfig.defconfig index 9ca3447718175..dae0d61a9b066 100644 --- a/boards/shields/x_nucleo_wb05kn1/Kconfig.defconfig +++ b/boards/shields/x_nucleo_wb05kn1/Kconfig.defconfig @@ -5,22 +5,10 @@ if SHIELD_X_NUCLEO_WB05KN1_UART || SHIELD_X_NUCLEO_WB05KN1_SPI if BT -config SPI - default y - depends on SHIELD_X_NUCLEO_WB05KN1_SPI - config SPI_STM32_INTERRUPT default y depends on SPI -config BT_SPI - default y - depends on DT_HAS_ST_HCI_SPI_V2_ENABLED - -config BT_H4 - default y - depends on DT_HAS_ZEPHYR_BT_HCI_UART_ENABLED - config BT_BLUENRG_ACI default y diff --git a/boards/st/b_l4s5i_iot01a/Kconfig.defconfig b/boards/st/b_l4s5i_iot01a/Kconfig.defconfig index 317d096e0cea7..8e2d927cf94df 100644 --- a/boards/st/b_l4s5i_iot01a/Kconfig.defconfig +++ b/boards/st/b_l4s5i_iot01a/Kconfig.defconfig @@ -24,12 +24,6 @@ endchoice if BT -config SPI - default y - -config BT_SPI - default y - config BT_BLUENRG_ACI default y # Disable Flow control diff --git a/boards/st/disco_l475_iot1/Kconfig.defconfig b/boards/st/disco_l475_iot1/Kconfig.defconfig index 808425eae0569..68ede55faaea1 100644 --- a/boards/st/disco_l475_iot1/Kconfig.defconfig +++ b/boards/st/disco_l475_iot1/Kconfig.defconfig @@ -24,12 +24,6 @@ endchoice if BT -config SPI - default y - -config BT_SPI - default y - config BT_BLUENRG_ACI default y # Disable Flow control diff --git a/boards/st/sensortile_box/Kconfig.defconfig b/boards/st/sensortile_box/Kconfig.defconfig index faa5dc0864c4d..24d16b199dd5f 100644 --- a/boards/st/sensortile_box/Kconfig.defconfig +++ b/boards/st/sensortile_box/Kconfig.defconfig @@ -7,12 +7,6 @@ if BOARD_SENSORTILE_BOX if BT -config SPI - default y - -config BT_SPI - default y - config BT_BLUENRG_ACI default y # Disable Flow control diff --git a/boards/st/sensortile_box_pro/Kconfig.defconfig b/boards/st/sensortile_box_pro/Kconfig.defconfig index fb701bd426546..fffa4f419f8b1 100644 --- a/boards/st/sensortile_box_pro/Kconfig.defconfig +++ b/boards/st/sensortile_box_pro/Kconfig.defconfig @@ -7,12 +7,6 @@ if BOARD_SENSORTILE_BOX_PRO if BT -config SPI - default y - -config BT_SPI - default y - config BT_BLUENRG_ACI default y diff --git a/boards/st/steval_stwinbx1/Kconfig.defconfig b/boards/st/steval_stwinbx1/Kconfig.defconfig index 657170dd30344..35256e0c2ada7 100644 --- a/boards/st/steval_stwinbx1/Kconfig.defconfig +++ b/boards/st/steval_stwinbx1/Kconfig.defconfig @@ -7,12 +7,6 @@ if BOARD_STEVAL_STWINBX1 if BT -config SPI - default y - -config BT_SPI - default y - config BT_BLUENRG_ACI default y diff --git a/boards/st/stm32l562e_dk/Kconfig.defconfig b/boards/st/stm32l562e_dk/Kconfig.defconfig index b0dc8f3bab80c..118968f4c082a 100644 --- a/boards/st/stm32l562e_dk/Kconfig.defconfig +++ b/boards/st/stm32l562e_dk/Kconfig.defconfig @@ -7,12 +7,6 @@ if BOARD_STM32L562E_DK if BT -config SPI - default y - -config BT_SPI - default y - config BT_BLUENRG_ACI default y diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index e68dfb40271ac..b3ec144473fad 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -330,6 +330,8 @@ Bluetooth HCI * The ``bt-hci-bus`` and ``bt-hci-quirks`` devicetree properties for HCI bindings have been changed to use lower-case strings without the ``BT_HCI_QUIRK_`` and ``BT_HCI_BUS_`` prefixes. +* The Kconfig option :kconfig:option:`BT_SPI` is now automatically selected based on devicetree + compatibles and can be removed from board ``.defconfig`` files. Bluetooth Mesh ============== From 95cc5f53b82cbc87da1e0f8f402bb1430bda9d66 Mon Sep 17 00:00:00 2001 From: The Nguyen Date: Thu, 28 Mar 2024 10:19:04 +0000 Subject: [PATCH 1727/4482] drivers: can: initial support for Renesas RA CANFD Add support for CAN driver running on Renesas RA CANFD Signed-off-by: The Nguyen --- boards/renesas/ek_ra8d1/ek_ra8d1-pinctrl.dtsi | 9 + boards/renesas/ek_ra8d1/ek_ra8d1.dts | 17 + boards/renesas/ek_ra8m1/ek_ra8m1-pinctrl.dtsi | 9 + boards/renesas/ek_ra8m1/ek_ra8m1.dts | 29 + .../renesas/mck_ra8t1/mck_ra8t1-pinctrl.dtsi | 9 + boards/renesas/mck_ra8t1/mck_ra8t1.dts | 17 + drivers/can/CMakeLists.txt | 41 +- drivers/can/Kconfig | 1 + drivers/can/Kconfig.renesas_ra | 11 + drivers/can/can_renesas_ra.c | 1158 +++++++++++++++++ dts/arm/renesas/ra/ra8/ra8x1.dtsi | 30 + dts/bindings/can/renesas,ra-canfd-global.yaml | 15 + dts/bindings/can/renesas,ra-canfd.yaml | 25 + modules/Kconfig.renesas_fsp | 5 + 14 files changed, 1356 insertions(+), 20 deletions(-) create mode 100644 drivers/can/Kconfig.renesas_ra create mode 100644 drivers/can/can_renesas_ra.c create mode 100644 dts/bindings/can/renesas,ra-canfd-global.yaml create mode 100644 dts/bindings/can/renesas,ra-canfd.yaml diff --git a/boards/renesas/ek_ra8d1/ek_ra8d1-pinctrl.dtsi b/boards/renesas/ek_ra8d1/ek_ra8d1-pinctrl.dtsi index 7dd8b9676f9a2..7893b7df6ce73 100644 --- a/boards/renesas/ek_ra8d1/ek_ra8d1-pinctrl.dtsi +++ b/boards/renesas/ek_ra8d1/ek_ra8d1-pinctrl.dtsi @@ -36,4 +36,13 @@ psels = ; }; }; + + canfd0_default: canfd0_default { + group1 { + /* CRX0 CTX0 */ + psels = , + ; + drive-strength = "high"; + }; + }; }; diff --git a/boards/renesas/ek_ra8d1/ek_ra8d1.dts b/boards/renesas/ek_ra8d1/ek_ra8d1.dts index 1acd074322090..4e82e5efa0262 100644 --- a/boards/renesas/ek_ra8d1/ek_ra8d1.dts +++ b/boards/renesas/ek_ra8d1/ek_ra8d1.dts @@ -21,6 +21,7 @@ zephyr,shell-uart = &uart9; zephyr,entropy = &trng; zephyr,flash-controller = &flash1; + zephyr,canbus = &canfd0; }; leds { @@ -74,6 +75,12 @@ status = "okay"; }; +&canfdclk { + clocks = <&pll>; + div = <5>; + status = "okay"; +}; + &ioport1 { status = "okay"; }; @@ -132,3 +139,13 @@ pinctrl-names = "default"; status = "okay"; }; + +&canfd_global { + status = "okay"; + canfd0 { + pinctrl-0 = <&canfd0_default>; + pinctrl-names = "default"; + rx-max-filters = <16>; + status = "okay"; + }; +}; diff --git a/boards/renesas/ek_ra8m1/ek_ra8m1-pinctrl.dtsi b/boards/renesas/ek_ra8m1/ek_ra8m1-pinctrl.dtsi index 006a2d5f855e1..89899dfa6a2b6 100644 --- a/boards/renesas/ek_ra8m1/ek_ra8m1-pinctrl.dtsi +++ b/boards/renesas/ek_ra8m1/ek_ra8m1-pinctrl.dtsi @@ -64,4 +64,13 @@ psels = ; }; }; + + canfd0_default: canfd0_default { + group1 { + /* CRX0 CTX0 */ + psels = , + ; + drive-strength = "high"; + }; + }; }; diff --git a/boards/renesas/ek_ra8m1/ek_ra8m1.dts b/boards/renesas/ek_ra8m1/ek_ra8m1.dts index 3d0c8dba180e9..8bbeec4ed40e1 100644 --- a/boards/renesas/ek_ra8m1/ek_ra8m1.dts +++ b/boards/renesas/ek_ra8m1/ek_ra8m1.dts @@ -21,6 +21,7 @@ zephyr,console = &uart9; zephyr,shell-uart = &uart9; zephyr,entropy = &trng; + zephyr,canbus = &canfd0; }; leds { @@ -65,6 +66,13 @@ aliases { led0 = &led1; }; + + transceiver0: can-phy0 { + compatible = "nxp,tja1040t", "can-transceiver-gpio"; + standby-gpios = <&ioport2 7 GPIO_ACTIVE_HIGH>; + max-bitrate = <5000000>; + #phy-cells = <0>; + }; }; &xtal { @@ -97,6 +105,12 @@ status = "okay"; }; +&canfdclk { + clocks = <&pll>; + div = <5>; + status = "okay"; +}; + &ioport0 { status = "okay"; }; @@ -105,6 +119,10 @@ status = "okay"; }; +&ioport2 { + status = "okay"; +}; + &ioport3 { status = "okay"; }; @@ -189,3 +207,14 @@ mikrobus_serial: &uart3 {}; }; }; }; + +&canfd_global { + status = "okay"; + canfd0 { + pinctrl-0 = <&canfd0_default>; + pinctrl-names = "default"; + phys = <&transceiver0>; + rx-max-filters = <16>; + status = "okay"; + }; +}; diff --git a/boards/renesas/mck_ra8t1/mck_ra8t1-pinctrl.dtsi b/boards/renesas/mck_ra8t1/mck_ra8t1-pinctrl.dtsi index 7a044d434e956..b5528917be5c3 100644 --- a/boards/renesas/mck_ra8t1/mck_ra8t1-pinctrl.dtsi +++ b/boards/renesas/mck_ra8t1/mck_ra8t1-pinctrl.dtsi @@ -36,4 +36,13 @@ psels = ; }; }; + + canfd1_default: canfd1_default { + group1 { + /* CRX1 CTX1 */ + psels = , + ; + drive-strength = "high"; + }; + }; }; diff --git a/boards/renesas/mck_ra8t1/mck_ra8t1.dts b/boards/renesas/mck_ra8t1/mck_ra8t1.dts index 440e4d78241f0..1f275fcbff24c 100644 --- a/boards/renesas/mck_ra8t1/mck_ra8t1.dts +++ b/boards/renesas/mck_ra8t1/mck_ra8t1.dts @@ -21,6 +21,7 @@ zephyr,shell-uart = &uart3; zephyr,entropy = &trng; zephyr,flash-controller = &flash1; + zephyr,canbus = &canfd1; }; leds { @@ -78,6 +79,12 @@ status = "okay"; }; +&canfdclk { + clocks = <&pll>; + div = <5>; + status = "okay"; +}; + &ioport6 { status = "okay"; }; @@ -126,3 +133,13 @@ pinctrl-names = "default"; status = "okay"; }; + +&canfd_global { + status = "okay"; + canfd1 { + pinctrl-0 = <&canfd1_default>; + pinctrl-names = "default"; + rx-max-filters = <16>; + status = "okay"; + }; +}; diff --git a/drivers/can/CMakeLists.txt b/drivers/can/CMakeLists.txt index caed52dc8fb8a..1398309e91484 100644 --- a/drivers/can/CMakeLists.txt +++ b/drivers/can/CMakeLists.txt @@ -5,26 +5,27 @@ zephyr_syscall_header(${ZEPHYR_BASE}/include/zephyr/drivers/can.h) zephyr_library() zephyr_sources_ifdef(CONFIG_CAN_MCUX_MCAN can_mcux_mcan.c) -zephyr_library_sources_ifdef(CONFIG_CAN can_common.c) -zephyr_library_sources_ifdef(CONFIG_CAN_FAKE can_fake.c) -zephyr_library_sources_ifdef(CONFIG_CAN_LOOPBACK can_loopback.c) -zephyr_library_sources_ifdef(CONFIG_CAN_MCAN can_mcan.c) -zephyr_library_sources_ifdef(CONFIG_CAN_MCP2515 can_mcp2515.c) -zephyr_library_sources_ifdef(CONFIG_CAN_MCP251XFD can_mcp251xfd.c) -zephyr_library_sources_ifdef(CONFIG_CAN_MCUX_FLEXCAN can_mcux_flexcan.c) -zephyr_library_sources_ifdef(CONFIG_CAN_SAM can_sam.c) -zephyr_library_sources_ifdef(CONFIG_CAN_SAM0 can_sam0.c) -zephyr_library_sources_ifdef(CONFIG_CAN_STM32_BXCAN can_stm32_bxcan.c) -zephyr_library_sources_ifdef(CONFIG_CAN_STM32_FDCAN can_stm32_fdcan.c) -zephyr_library_sources_ifdef(CONFIG_CAN_STM32H7_FDCAN can_stm32h7_fdcan.c) -zephyr_library_sources_ifdef(CONFIG_CAN_TCAN4X5X can_tcan4x5x.c) -zephyr_library_sources_ifdef(CONFIG_CAN_RCAR can_rcar.c) -zephyr_library_sources_ifdef(CONFIG_CAN_NUMAKER can_numaker.c) -zephyr_library_sources_ifdef(CONFIG_CAN_XMC4XXX can_xmc4xxx.c) -zephyr_library_sources_ifdef(CONFIG_CAN_SJA1000 can_sja1000.c) -zephyr_library_sources_ifdef(CONFIG_CAN_ESP32_TWAI can_esp32_twai.c) -zephyr_library_sources_ifdef(CONFIG_CAN_KVASER_PCI can_kvaser_pci.c) -zephyr_library_sources_ifdef(CONFIG_CAN_NRF can_nrf.c) +zephyr_library_sources_ifdef(CONFIG_CAN can_common.c) +zephyr_library_sources_ifdef(CONFIG_CAN_FAKE can_fake.c) +zephyr_library_sources_ifdef(CONFIG_CAN_LOOPBACK can_loopback.c) +zephyr_library_sources_ifdef(CONFIG_CAN_MCAN can_mcan.c) +zephyr_library_sources_ifdef(CONFIG_CAN_MCP2515 can_mcp2515.c) +zephyr_library_sources_ifdef(CONFIG_CAN_MCP251XFD can_mcp251xfd.c) +zephyr_library_sources_ifdef(CONFIG_CAN_MCUX_FLEXCAN can_mcux_flexcan.c) +zephyr_library_sources_ifdef(CONFIG_CAN_SAM can_sam.c) +zephyr_library_sources_ifdef(CONFIG_CAN_SAM0 can_sam0.c) +zephyr_library_sources_ifdef(CONFIG_CAN_STM32_BXCAN can_stm32_bxcan.c) +zephyr_library_sources_ifdef(CONFIG_CAN_STM32_FDCAN can_stm32_fdcan.c) +zephyr_library_sources_ifdef(CONFIG_CAN_STM32H7_FDCAN can_stm32h7_fdcan.c) +zephyr_library_sources_ifdef(CONFIG_CAN_TCAN4X5X can_tcan4x5x.c) +zephyr_library_sources_ifdef(CONFIG_CAN_RCAR can_rcar.c) +zephyr_library_sources_ifdef(CONFIG_CAN_NUMAKER can_numaker.c) +zephyr_library_sources_ifdef(CONFIG_CAN_XMC4XXX can_xmc4xxx.c) +zephyr_library_sources_ifdef(CONFIG_CAN_SJA1000 can_sja1000.c) +zephyr_library_sources_ifdef(CONFIG_CAN_ESP32_TWAI can_esp32_twai.c) +zephyr_library_sources_ifdef(CONFIG_CAN_KVASER_PCI can_kvaser_pci.c) +zephyr_library_sources_ifdef(CONFIG_CAN_NRF can_nrf.c) +zephyr_library_sources_ifdef(CONFIG_CAN_RENESAS_RA_CANFD can_renesas_ra.c) zephyr_library_sources_ifdef(CONFIG_USERSPACE can_handlers.c) zephyr_library_sources_ifdef(CONFIG_CAN_SHELL can_shell.c) diff --git a/drivers/can/Kconfig b/drivers/can/Kconfig index 5aa956353dc21..c6e89e464aa9b 100644 --- a/drivers/can/Kconfig +++ b/drivers/can/Kconfig @@ -129,6 +129,7 @@ source "drivers/can/Kconfig.tcan4x5x" source "drivers/can/Kconfig.mcp251xfd" source "drivers/can/Kconfig.xmc4xxx" source "drivers/can/Kconfig.nrf" +source "drivers/can/Kconfig.renesas_ra" source "drivers/can/transceiver/Kconfig" diff --git a/drivers/can/Kconfig.renesas_ra b/drivers/can/Kconfig.renesas_ra new file mode 100644 index 0000000000000..be10395306a88 --- /dev/null +++ b/drivers/can/Kconfig.renesas_ra @@ -0,0 +1,11 @@ +# Copyright (c) 2024 Renesas Electronics Corporation +# SPDX-License-Identifier: Apache-2.0 + +config CAN_RENESAS_RA_CANFD + bool "Renesas RA CANFD" + default y + depends on DT_HAS_RENESAS_RA_CANFD_ENABLED + select USE_RA_FSP_CANFD + select PINCTRL + help + Enable Renesas RA CANFD driver diff --git a/drivers/can/can_renesas_ra.c b/drivers/can/can_renesas_ra.c new file mode 100644 index 0000000000000..1548b38c502c0 --- /dev/null +++ b/drivers/can/can_renesas_ra.c @@ -0,0 +1,1158 @@ +/* + * Copyright (c) 2024 Renesas Electronics Corporation + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include "r_can_api.h" +#include "r_canfd.h" + +LOG_MODULE_REGISTER(can_renesas_ra, CONFIG_CAN_LOG_LEVEL); + +#define DT_DRV_COMPAT renesas_ra_canfd + +#define CAN_RENESAS_RA_TIMING_MAX \ + { \ + .sjw = 128, \ + .prop_seg = 1, \ + .phase_seg1 = 255, \ + .phase_seg2 = 128, \ + .prescaler = 1024, \ + } + +#define CAN_RENESAS_RA_TIMING_MIN \ + { \ + .sjw = 1, \ + .prop_seg = 1, \ + .phase_seg1 = 2, \ + .phase_seg2 = 2, \ + .prescaler = 1, \ + } + +#ifdef CONFIG_CAN_FD_MODE +#define CAN_RENESAS_RA_TIMING_DATA_MAX \ + { \ + .sjw = 16, \ + .prop_seg = 1, \ + .phase_seg1 = 31, \ + .phase_seg2 = 16, \ + .prescaler = 128, \ + } +#define CAN_RENESAS_RA_TIMING_DATA_MIN \ + { \ + .sjw = 1, \ + .prop_seg = 1, \ + .phase_seg1 = 2, \ + .phase_seg2 = 2, \ + .prescaler = 1, \ + } +#endif + +/* This frame ID will be reserved. Any filter using this ID may cause undefined behavior. */ +#define CAN_RENESAS_RA_RESERVED_ID (CAN_EXT_ID_MASK) + +/* + * Common FIFO configuration: refer to '34.2.28 CFDCFCC : Common FIFO Configuration/Control + * Register' - RA8M1 MCU group HWM + */ +#define CANFD_CFG_COMMONFIFO0 (0U << R_CANFD_CFDCFCC_CFE_Pos) /* Common FIFO Disable */ + +#define CANFD_CFG_COMMONFIFO {CANFD_CFG_COMMONFIFO0} + +/* + * RX FIFO configuration: refer to '34.2.25 CFDRFCCa : RX FIFO Configuration/Control Registers' - + * RA8M1 MCU group HWM + */ +#define CANFD_CFG_RX_FIFO0 \ + ((1U << R_CANFD_CFDRFCC_RFE_Pos) | /* RX FIFO Enable */ \ + (1U << R_CANFD_CFDRFCC_RFIE_Pos) | /* RX FIFO Interrupt Enable */ \ + (7U << R_CANFD_CFDRFCC_RFPLS_Pos) | /* RX FIFO Payload Data Size: 64 */ \ + (3U << R_CANFD_CFDRFCC_RFDC_Pos) | /* RX FIFO Depth: 16 messages */ \ + (1U << R_CANFD_CFDRFCC_RFIM_Pos)) /* Interrupt generated at every received message \ + * storage \ + */ + +#define CANFD_CFG_RX_FIFO1 (0U << R_CANFD_CFDRFCC_RFE_Pos) /* RX FIFO Disable */ + +#define CANFD_CFG_RXFIFO {CANFD_CFG_RX_FIFO0, CANFD_CFG_RX_FIFO1} + +/* + * Global Configuration: refer to '34.2.11 CFDGCFG : Global Configuration Register' - RA8M1 MCU + * group HWM + */ +#define CANFD_CFG_GLOBAL \ + ((0U << R_CANFD_CFDGCFG_TPRI_Pos) | /* Transmission Priority: ID priority */ \ + (0U << R_CANFD_CFDGCFG_DCE_Pos) | /* DLC check disabled */ \ + (1U << R_CANFD_CFDGCFG_DCS_Pos)) /* DLL Clock Select: CANFDCLK */ + +/* + * TX Message Buffer Interrupt Enable Configuration: refer to '34.2.43 CFDTMIEC : TX Message Buffer + * Interrupt Enable Configuration Register' - RA8M1 MCU group HWM + */ +#define CANFD_CFG_TXMB_TXI_ENABLE (BIT(0)) /* Enable TXMB0 interrupt */ + +/* + * Number and size of RX Message Buffers: refer to '34.2.23 CFDRMNB : RX Message Buffer Number + * Register' - RA8M1 MCU group HWM + */ +#define CANFD_CFG_RXMB (0U << R_CANFD_CFDRMNB_NRXMB_Pos) /* Number of RX Message Buffers: 0 */ + +/* + * Channel Error IRQ configurations: refer to '34.2.3 CFDC0CTR : Control Register' - RA8M1 MCU group + * HWM + */ +#define CANFD_CFG_ERR_IRQ \ + (BIT(R_CANFD_CFDC_CTR_EWIE_Pos) | /* Error Warning Interrupt Enable */ \ + BIT(R_CANFD_CFDC_CTR_EPIE_Pos) | /* Error Passive Interrupt Enable */ \ + BIT(R_CANFD_CFDC_CTR_BOEIE_Pos) | /* Bus-Off Entry Interrupt Enable */ \ + BIT(R_CANFD_CFDC_CTR_BORIE_Pos) | /* Bus-Off Recovery Interrupt Enable */ \ + BIT(R_CANFD_CFDC_CTR_OLIE_Pos)) /* Overload Interrupt Enable */ + +/* + * Global Error IRQ configurations: refer to '34.2.12 CFDGCTR : Global Control Register' - RA8M1 MCU + * group HWM + */ +#define CANFD_CFG_GLERR_IRQ \ + ((3UL << R_CANFD_CFDGCTR_GMDC_Pos) | /* Global Mode Control: Keep current value */ \ + (0UL << R_CANFD_CFDGCTR_DEIE_Pos) | /* DLC check interrupt disabled */ \ + (0UL << R_CANFD_CFDGCTR_MEIE_Pos) | /* Message lost error interrupt disabled */ \ + (0UL << R_CANFD_CFDGCTR_THLEIE_Pos) | /* TX history list entry lost interrupt disabled */ \ + (0UL << R_CANFD_CFDGCTR_CMPOFIE_Pos)) /* CANFD message payload overflow flag interrupt \ + * disabled \ + */ + +/* Keycode to enable/disable accessing to AFL entry */ +#define CFDGAFLIGNCTR_KEY_CODE (0xC4UL) + +/* Default Dataphase bitrate configuration in case classic mode is enabled */ +static const can_bit_timing_cfg_t classic_can_data_timing_default = { + .baud_rate_prescaler = 1, + .time_segment_1 = 3, + .time_segment_2 = 2, + .synchronization_jump_width = 1, +}; + +struct can_renesas_ra_global_cfg { + const struct device *op_clk; + const struct device *ram_clk; + const struct clock_control_ra_subsys_cfg op_subsys; + const struct clock_control_ra_subsys_cfg ram_subsys; +}; + +struct can_renesas_ra_filter { + bool set; + struct can_filter filter; + can_rx_callback_t rx_cb; + void *rx_usr_data; +}; + +struct can_renesas_ra_cfg { + struct can_driver_config common; + const struct pinctrl_dev_config *pcfg; + const struct device *global_dev; + const struct device *dll_clk; + const struct clock_control_ra_subsys_cfg dll_subsys; + const uint32_t rx_filter_num; +}; + +struct can_renesas_ra_data { + struct can_driver_data common; + struct k_mutex inst_mutex; + const struct device *dev; + can_instance_t fsp_can; + can_tx_callback_t tx_cb; + struct k_sem tx_sem; + void *tx_usr_data; + struct can_renesas_ra_filter *rx_filter; + can_bit_timing_cfg_t data_timing; +}; + +extern void canfd_error_isr(void); +extern void canfd_rx_fifo_isr(void); +extern void canfd_common_fifo_rx_isr(void); +extern void canfd_channel_tx_isr(void); + +static const can_api_t *can_api = &g_canfd_on_canfd; + +static inline int set_hw_timing_configuration(const struct device *dev, + can_bit_timing_cfg_t *f_timing, + const struct can_timing *z_timing) +{ + struct can_renesas_ra_data *data = dev->data; + + if (f_timing == NULL || z_timing == NULL) { + return -EINVAL; + } + + k_mutex_lock(&data->inst_mutex, K_FOREVER); + + *f_timing = (can_bit_timing_cfg_t){ + .baud_rate_prescaler = z_timing->prescaler, + .time_segment_1 = z_timing->prop_seg + z_timing->phase_seg1, + .time_segment_2 = z_timing->phase_seg2, + .synchronization_jump_width = z_timing->sjw, + }; + + k_mutex_unlock(&data->inst_mutex); + + return 0; +} + +static inline int get_free_filter_id(const struct device *dev) +{ + struct can_renesas_ra_data *data = dev->data; + const struct can_renesas_ra_cfg *cfg = dev->config; + + for (uint32_t filter_id = 0; filter_id < cfg->rx_filter_num; filter_id++) { + if (!data->rx_filter[filter_id].set) { + return filter_id; + } + } + + return -ENOSPC; +} + +static void set_afl_rule(const struct device *dev, const struct can_filter *filter, + uint32_t afl_offset) +{ + struct can_renesas_ra_data *data = dev->data; + canfd_extended_cfg_t const *p_extend = data->fsp_can.p_cfg->p_extend; + canfd_afl_entry_t *afl = (canfd_afl_entry_t *)&p_extend->p_afl[afl_offset]; + + *afl = (canfd_afl_entry_t){.id = {.id = filter->id, +#ifndef CONFIG_CAN_ACCEPT_RTR + .frame_type = CAN_FRAME_TYPE_DATA, +#endif + .id_mode = ((filter->flags & CAN_FILTER_IDE) != 0) + ? CAN_ID_MODE_EXTENDED + : CAN_ID_MODE_STANDARD}, + .mask = {.mask_id = filter->mask, +#ifdef CONFIG_CAN_ACCEPT_RTR + /* Accept all types of frames */ + .mask_frame_type = 0, +#else + /* Only accept frames with the configured frametype */ + .mask_frame_type = 1, +#endif + .mask_id_mode = ((filter->flags & CAN_FILTER_IDE) != 0) + ? CAN_ID_MODE_EXTENDED + : CAN_ID_MODE_STANDARD}, + .destination = {.fifo_select_flags = CANFD_RX_FIFO_0}}; + + if (data->common.started) { + /* These steps help update AFL rules while CAN module running */ + canfd_instance_ctrl_t *p_ctrl = (canfd_instance_ctrl_t *)data->fsp_can.p_ctrl; + R_CANFD_Type *reg = p_ctrl->p_reg; + + /* Ignore AFL entry which will be changed */ + reg->CFDGAFLIGNENT_b.IRN = afl_offset; + reg->CFDGAFLIGNCTR = ((CFDGAFLIGNCTR_KEY_CODE << R_CANFD_CFDGAFLIGNCTR_KEY_Pos) | + BIT(R_CANFD_CFDGAFLIGNCTR_IREN_Pos)); + reg->CFDGAFLECTR_b.AFLDAE = 1; + + /* Write AFL configuration */ + reg->CFDGAFL[afl_offset] = *(R_CANFD_CFDGAFL_Type *)afl; + + /* Lock AFL entry access */ + reg->CFDGAFLECTR_b.AFLDAE = 0; + reg->CFDGAFLIGNCTR = ((CFDGAFLIGNCTR_KEY_CODE << R_CANFD_CFDGAFLIGNCTR_KEY_Pos)); + } +} + +static void remove_afl_rule(const struct device *dev, uint32_t afl_offset) +{ + struct can_renesas_ra_data *data = dev->data; + canfd_extended_cfg_t const *p_extend = data->fsp_can.p_cfg->p_extend; + canfd_afl_entry_t *afl = (canfd_afl_entry_t *)&p_extend->p_afl[afl_offset]; + + /* Set the AFL ID to reserved ID */ + *afl = (canfd_afl_entry_t){ + .id = {.id = CAN_RENESAS_RA_RESERVED_ID, .id_mode = CAN_ID_MODE_EXTENDED}, + .mask = {.mask_id = CAN_RENESAS_RA_RESERVED_ID, + .mask_id_mode = CAN_ID_MODE_EXTENDED}}; + + if (data->common.started) { + /* These steps help update AFL rules while CAN module running */ + canfd_instance_ctrl_t *p_ctrl = (canfd_instance_ctrl_t *)data->fsp_can.p_ctrl; + R_CANFD_Type *reg = p_ctrl->p_reg; + + /* Ignore AFL entry which will be changed */ + reg->CFDGAFLIGNENT_b.IRN = afl_offset; + reg->CFDGAFLIGNCTR = ((CFDGAFLIGNCTR_KEY_CODE << R_CANFD_CFDGAFLIGNCTR_KEY_Pos) | + BIT(R_CANFD_CFDGAFLIGNCTR_IREN_Pos)); + reg->CFDGAFLECTR_b.AFLDAE = 1; + + /* Change configurations for AFL entry */ + reg->CFDGAFL[afl_offset] = *(R_CANFD_CFDGAFL_Type *)(afl); + + /* Lock AFL entry access */ + reg->CFDGAFLECTR_b.AFLDAE = 0; + reg->CFDGAFLIGNCTR = ((CFDGAFLIGNCTR_KEY_CODE << R_CANFD_CFDGAFLIGNCTR_KEY_Pos)); + } +} + +#ifdef CONFIG_CAN_MANUAL_RECOVERY_MODE +static int recover_bus(const struct device *dev, k_timeout_t timeout) +{ + struct can_renesas_ra_data *data = dev->data; + canfd_instance_ctrl_t *p_ctrl = data->fsp_can.p_ctrl; + R_CANFD_Type *reg = p_ctrl->p_reg; + uint32_t cfdcnctr = reg->CFDC->CTR; + int ret = 0; + + if (reg->CFDC->ERFL_b.BOEF == 0) { + /* Channel bus-off entry not detected */ + goto end; + } + + reg->CFDC->CTR_b.BOM = 0x00; /* Switch to Normal Bus-Off mode (comply with ISO 11898-1) */ + reg->CFDC->CTR_b.RTBO = 1; /* Force channel state to return from bus-off */ + + int64_t start_ticks = k_uptime_ticks(); + + while (reg->CFDC->ERFL_b.BORF == 0) { + if ((k_uptime_ticks() - start_ticks) > timeout.ticks) { + ret = -EAGAIN; + goto end; + } + } +end: + reg->CFDC->CTR = cfdcnctr; /* Restore channel configuration */ + return ret; +} +#endif + +static inline void can_renesas_ra_call_tx_cb(const struct device *dev, int err) +{ + struct can_renesas_ra_data *data = dev->data; + can_tx_callback_t cb = data->tx_cb; + + if (cb != NULL) { + data->tx_cb = NULL; + cb(dev, err, data->tx_usr_data); + k_sem_give(&data->tx_sem); + } +} + +static inline void can_renesas_ra_call_rx_cb(const struct device *dev, can_callback_args_t *p_args) +{ + struct can_renesas_ra_data *data = dev->data; + struct can_renesas_ra_filter *rx_filter = data->rx_filter; + const struct can_renesas_ra_cfg *cfg = dev->config; + struct can_frame frame = { + .dlc = can_bytes_to_dlc(p_args->frame.data_length_code), + .id = p_args->frame.id, + .flags = (((p_args->frame.id_mode == CAN_ID_MODE_EXTENDED) ? CAN_FRAME_IDE : 0UL) | + ((p_args->frame.type == CAN_FRAME_TYPE_REMOTE) ? CAN_FRAME_RTR : 0UL) | + ((p_args->frame.options & CANFD_FRAME_OPTION_FD) != 0 ? CAN_FRAME_FDF + : 0UL) | + ((p_args->frame.options & CANFD_FRAME_OPTION_ERROR) != 0 ? CAN_FRAME_ESI + : 0UL) | + ((p_args->frame.options & CANFD_FRAME_OPTION_BRS) != 0 ? CAN_FRAME_BRS + : 0UL)), + }; + + memcpy(frame.data, p_args->frame.data, p_args->frame.data_length_code); + + for (uint32_t i = 0; i < cfg->rx_filter_num; i++) { + can_rx_callback_t cb = rx_filter->rx_cb; + void *usr_data = rx_filter->rx_usr_data; + + if (cb == NULL) { + rx_filter++; + continue; /* this filter has not set yet */ + } + + if (!can_frame_matches_filter(&frame, &rx_filter->filter)) { + rx_filter++; + continue; /* filter did not match */ + } + + cb(dev, &frame, usr_data); + break; + } +} + +static inline void can_renesas_ra_call_state_change_cb(const struct device *dev, + enum can_state state) +{ + struct can_renesas_ra_data *data = dev->data; + can_info_t can_info; + + if (FSP_SUCCESS != can_api->infoGet(data->fsp_can.p_ctrl, &can_info)) { + LOG_DBG("get state info failed"); + return; + } + + struct can_bus_err_cnt err_cnt = { + .rx_err_cnt = can_info.error_count_receive, + .tx_err_cnt = can_info.error_count_transmit, + }; + + data->common.state_change_cb(dev, state, err_cnt, data->common.state_change_cb_user_data); +} + +static int can_renesas_ra_get_capabilities(const struct device *dev, can_mode_t *cap) +{ + ARG_UNUSED(dev); + *cap = CAN_MODE_NORMAL | CAN_MODE_LOOPBACK; + +#ifdef CONFIG_CAN_FD_MODE + *cap |= CAN_MODE_FD; +#endif + +#ifdef CONFIG_CAN_MANUAL_RECOVERY_MODE + *cap |= CAN_MODE_MANUAL_RECOVERY; +#endif + + return 0; +} + +static int can_renesas_ra_start(const struct device *dev) +{ + struct can_renesas_ra_data *data = dev->data; + const struct device *transceiver_dev = can_get_transceiver(dev); + int ret = 0; + + if (!device_is_ready(dev)) { + return -EIO; + } + + if (data->common.started) { + return -EALREADY; + } + + if (((transceiver_dev != NULL) && + can_transceiver_enable(transceiver_dev, data->common.mode))) { + LOG_DBG("CAN transceiver enable failed"); + return -EIO; + } + + k_mutex_lock(&data->inst_mutex, K_FOREVER); + canfd_extended_cfg_t *p_extend = (canfd_extended_cfg_t *)data->fsp_can.p_cfg->p_extend; + + p_extend->p_data_timing = + (can_bit_timing_cfg_t *)((data->common.mode & CAN_MODE_FD) != 0 + ? &data->data_timing + : &classic_can_data_timing_default); + + if (FSP_SUCCESS != can_api->close(data->fsp_can.p_ctrl)) { + LOG_DBG("CAN close failed"); + ret = -EIO; + goto end; + } + + if (FSP_SUCCESS != can_api->open(data->fsp_can.p_ctrl, data->fsp_can.p_cfg)) { + LOG_DBG("CAN open failed"); + ret = -EIO; + goto end; + } + + if ((data->common.mode & CAN_MODE_LOOPBACK) != 0) { + if (FSP_SUCCESS != can_api->modeTransition(data->fsp_can.p_ctrl, + CAN_OPERATION_MODE_NORMAL, + CAN_TEST_MODE_LOOPBACK_INTERNAL)) { + LOG_DBG("CAN mode change failed"); + ret = -EIO; + goto end; + } + } + + data->common.started = true; +end: + k_mutex_unlock(&data->inst_mutex); + return ret; +} + +static int can_renesas_ra_stop(const struct device *dev) +{ + struct can_renesas_ra_data *data = dev->data; + const struct device *transceiver_dev = can_get_transceiver(dev); + int ret = 0; + + if (!data->common.started) { + return -EALREADY; + } + + k_mutex_lock(&data->inst_mutex, K_FOREVER); + + if (FSP_SUCCESS != can_api->modeTransition(data->fsp_can.p_ctrl, CAN_OPERATION_MODE_HALT, + CAN_TEST_MODE_DISABLED)) { + LOG_DBG("CAN stop failed"); + ret = -EIO; + goto end; + } + + if (((transceiver_dev != NULL) && can_transceiver_disable(transceiver_dev))) { + LOG_DBG("CAN transceiver disable failed"); + ret = -EIO; + goto end; + } + + if (data->tx_cb != NULL) { + data->tx_cb = NULL; + k_sem_give(&data->tx_sem); + } + + data->common.started = false; + +end: + k_mutex_unlock(&data->inst_mutex); + return ret; +} + +static int can_renesas_ra_set_mode(const struct device *dev, can_mode_t mode) +{ + struct can_renesas_ra_data *data = dev->data; + int ret = 0; + + if (data->common.started) { + /* CAN controller should be in stopped state */ + return -EBUSY; + } + + k_mutex_lock(&data->inst_mutex, K_FOREVER); + + can_mode_t caps = 0; + + ret = can_renesas_ra_get_capabilities(dev, &caps); + if (ret != 0) { + goto end; + } + + if ((mode & ~caps) != 0) { + ret = -ENOTSUP; + goto end; + } + + data->common.mode = mode; + +end: + k_mutex_unlock(&data->inst_mutex); + return ret; +} + +static int can_renesas_ra_set_timing(const struct device *dev, const struct can_timing *timing) +{ + struct can_renesas_ra_data *data = dev->data; + + if (data->common.started) { + /* Device is not in stopped state */ + return -EBUSY; + } + + return set_hw_timing_configuration(dev, data->fsp_can.p_cfg->p_bit_timing, timing); +} + +static int can_renesas_ra_send(const struct device *dev, const struct can_frame *frame, + k_timeout_t timeout, can_tx_callback_t callback, void *user_data) +{ + struct can_renesas_ra_data *data = dev->data; + + if (!data->common.started) { + return -ENETDOWN; + } + +#ifdef CONFIG_CAN_FD_MODE + if ((frame->flags & ~(CAN_FRAME_IDE | CAN_FRAME_RTR | CAN_FRAME_FDF | CAN_FRAME_BRS)) != + 0) { + LOG_ERR("unsupported CAN frame flags 0x%02x", frame->flags); + return -ENOTSUP; + } + + if ((data->common.mode & CAN_MODE_FD) == 0U && + ((frame->flags & (CAN_FRAME_FDF | CAN_FRAME_BRS)) != 0U)) { + LOG_ERR("CAN FD format not supported in non-FD mode"); + return -ENOTSUP; + } +#else /* CONFIG_CAN_FD_MODE */ + if ((frame->flags & ~(CAN_FRAME_IDE | CAN_FRAME_RTR)) != 0U) { + LOG_ERR("unsupported CAN frame flags 0x%02x", frame->flags); + return -ENOTSUP; + } +#endif /* !CONFIG_CAN_FD_MODE */ + + if ((frame->flags & CAN_FRAME_FDF) != 0U) { + if (frame->dlc > CANFD_MAX_DLC) { + LOG_ERR("DLC of %d for CAN FD format frame", frame->dlc); + return -EINVAL; + } + } else { + if (frame->dlc > CAN_MAX_DLC) { + LOG_ERR("DLC of %d for non-FD format frame", frame->dlc); + return -EINVAL; + } + } + + if (k_sem_take(&data->tx_sem, timeout) != 0) { + return -EAGAIN; + } + + k_mutex_lock(&data->inst_mutex, K_FOREVER); + int ret = 0; + + data->tx_cb = callback; + data->tx_usr_data = user_data; + + can_frame_t fsp_frame = { + .id = frame->id, + .id_mode = ((frame->flags & CAN_FRAME_IDE) != 0) ? CAN_ID_MODE_EXTENDED + : CAN_ID_MODE_STANDARD, + .type = ((frame->flags & CAN_FRAME_RTR) != 0) ? CAN_FRAME_TYPE_REMOTE + : CAN_FRAME_TYPE_DATA, + .data_length_code = can_dlc_to_bytes(frame->dlc), + .options = + ((((frame->flags & CAN_FRAME_FDF) != 0) ? CANFD_FRAME_OPTION_FD : 0UL) | + (((frame->flags & CAN_FRAME_BRS) != 0) ? CANFD_FRAME_OPTION_BRS : 0UL) | + (((frame->flags & CAN_FRAME_ESI) != 0) ? CANFD_FRAME_OPTION_ERROR : 0UL)), + }; + + memcpy(fsp_frame.data, frame->data, fsp_frame.data_length_code); + + if (FSP_SUCCESS != can_api->write(data->fsp_can.p_ctrl, CANFD_TX_BUFFER_0, &fsp_frame)) { + LOG_DBG("CAN transmit failed"); + data->tx_cb = NULL; + data->tx_usr_data = NULL; + k_sem_give(&data->tx_sem); + ret = -EIO; + goto end; + } + +end: + k_mutex_unlock(&data->inst_mutex); + return ret; +} + +static int can_renesas_ra_add_rx_filter(const struct device *dev, can_rx_callback_t callback, + void *user_data, const struct can_filter *filter) +{ + struct can_renesas_ra_data *data = dev->data; + int filter_id = -ENOSPC; + + k_mutex_lock(&data->inst_mutex, K_FOREVER); + + filter_id = get_free_filter_id(dev); + if (filter_id == -ENOSPC) { + goto end; + } + + set_afl_rule(dev, filter, filter_id); + + memcpy(&data->rx_filter[filter_id].filter, filter, sizeof(struct can_filter)); + data->rx_filter[filter_id].rx_cb = callback; + data->rx_filter[filter_id].rx_usr_data = user_data; + data->rx_filter[filter_id].set = true; + +end: + k_mutex_unlock(&data->inst_mutex); + return filter_id; +} + +static void can_renesas_ra_remove_rx_filter(const struct device *dev, int filter_id) +{ + struct can_renesas_ra_data *data = dev->data; + const struct can_renesas_ra_cfg *cfg = dev->config; + + if ((filter_id < 0) || (filter_id >= cfg->rx_filter_num)) { + return; + } + + k_mutex_lock(&data->inst_mutex, K_FOREVER); + + remove_afl_rule(dev, filter_id); + + data->rx_filter[filter_id].rx_cb = NULL; + data->rx_filter[filter_id].rx_usr_data = NULL; + data->rx_filter[filter_id].set = false; + + k_mutex_unlock(&data->inst_mutex); +} + +#ifdef CONFIG_CAN_MANUAL_RECOVERY_MODE +static int can_renesas_ra_recover(const struct device *dev, k_timeout_t timeout) +{ + struct can_renesas_ra_data *data = dev->data; + + if (!data->common.started) { + return -ENETDOWN; + } + + if ((data->common.mode & CAN_MODE_MANUAL_RECOVERY) == 0) { + return -ENOTSUP; + } + + return recover_bus(dev, timeout); +} +#endif + +static int can_renesas_ra_get_state(const struct device *dev, enum can_state *state, + struct can_bus_err_cnt *err_cnt) +{ + struct can_renesas_ra_data *data = dev->data; + can_info_t fsp_info = {0}; + + if (state == NULL && err_cnt == NULL) { + return 0; + } + + if (FSP_SUCCESS != can_api->infoGet(data->fsp_can.p_ctrl, &fsp_info)) { + LOG_DBG("CAN get state info failed"); + return -EIO; + } + + if (state != NULL) { + if (!data->common.started) { + *state = CAN_STATE_STOPPED; + } else { + if ((fsp_info.error_code & R_CANFD_CFDC_ERFL_BOEF_Msk) != 0) { + *state = CAN_STATE_BUS_OFF; + } else if ((fsp_info.error_code & R_CANFD_CFDC_ERFL_EPF_Msk) != 0) { + *state = CAN_STATE_ERROR_PASSIVE; + } else if ((fsp_info.error_code & R_CANFD_CFDC_ERFL_EWF_Msk) != 0) { + *state = CAN_STATE_ERROR_WARNING; + } else if ((fsp_info.error_code & R_CANFD_CFDC_ERFL_BEF_Msk) != 0) { + *state = CAN_STATE_ERROR_ACTIVE; + } + } + } + + if (err_cnt != NULL) { + err_cnt->tx_err_cnt = fsp_info.error_count_transmit; + err_cnt->rx_err_cnt = fsp_info.error_count_receive; + } + + return 0; +} + +static void can_renesas_ra_set_state_change_callback(const struct device *dev, + can_state_change_callback_t callback, + void *user_data) +{ + struct can_renesas_ra_data *data = dev->data; + canfd_instance_ctrl_t *p_ctrl = data->fsp_can.p_ctrl; + int key = irq_lock(); + + k_mutex_lock(&data->inst_mutex, K_FOREVER); + + if (callback != NULL) { + /* Enable state change interrupt */ + p_ctrl->p_reg->CFDC->CTR |= (uint32_t)CANFD_CFG_ERR_IRQ; + } else { + /* Disable state change interrupt */ + p_ctrl->p_reg->CFDC->CTR &= (uint32_t)~CANFD_CFG_ERR_IRQ; + + /* Clear state change interrupt flags */ + p_ctrl->p_reg->CFDC->ERFL &= + ~(BIT(R_CANFD_CFDC_ERFL_BOEF_Pos) | BIT(R_CANFD_CFDC_ERFL_EWF_Pos) | + BIT(R_CANFD_CFDC_ERFL_EPF_Pos) | BIT(R_CANFD_CFDC_ERFL_BOEF_Pos)); + } + + data->common.state_change_cb = callback; + data->common.state_change_cb_user_data = user_data; + + k_mutex_unlock(&data->inst_mutex); + + irq_unlock(key); +} + +static int can_renesas_ra_get_core_clock(const struct device *dev, uint32_t *rate) +{ + const struct can_renesas_ra_cfg *cfg = dev->config; + clock_control_subsys_t dll_subsys = (clock_control_subsys_t)&cfg->dll_subsys; + + return clock_control_get_rate(cfg->dll_clk, dll_subsys, rate); +} + +static int can_renesas_ra_get_max_filters(const struct device *dev, bool ide) +{ + ARG_UNUSED(ide); + const struct can_renesas_ra_cfg *cfg = dev->config; + + return cfg->rx_filter_num; +} + +#ifdef CONFIG_CAN_FD_MODE +static int can_renesas_ra_set_timing_data(const struct device *dev, + const struct can_timing *timing_data) +{ + struct can_renesas_ra_data *data = dev->data; + + if (data->common.started) { + return -EBUSY; + } + + return set_hw_timing_configuration(dev, &data->data_timing, timing_data); +} +#endif /* CONFIG_CAN_FD_MODE */ + +void can_renesas_ra_fsp_cb(can_callback_args_t *p_args) +{ + const struct device *dev = p_args->p_context; + + switch (p_args->event) { + case CAN_EVENT_RX_COMPLETE: { + can_renesas_ra_call_rx_cb(dev, p_args); + break; + } + + case CAN_EVENT_TX_COMPLETE: { + can_renesas_ra_call_tx_cb(dev, 0); + break; + } + + case CAN_EVENT_ERR_CHANNEL: { + if ((p_args->error & R_CANFD_CFDC_ERFL_BEF_Msk) != 0) { + can_renesas_ra_call_state_change_cb(dev, CAN_STATE_ERROR_ACTIVE); + } + if ((p_args->error & R_CANFD_CFDC_ERFL_EWF_Msk) != 0) { + can_renesas_ra_call_state_change_cb(dev, CAN_STATE_ERROR_WARNING); + } + if ((p_args->error & R_CANFD_CFDC_ERFL_EPF_Msk) != 0) { + can_renesas_ra_call_state_change_cb(dev, CAN_STATE_ERROR_PASSIVE); + } + if ((p_args->error & R_CANFD_CFDC_ERFL_BOEF_Msk) != 0) { + can_renesas_ra_call_state_change_cb(dev, CAN_STATE_BUS_OFF); + } + + if ((p_args->error & R_CANFD_CFDC_ERFL_ALF_Msk) != 0) { /* Arbitration Lost Error */ + can_renesas_ra_call_tx_cb(dev, -EBUSY); + } + if ((p_args->error & (R_CANFD_CFDC_ERFL_AERR_Msk | /* ACK Error */ + R_CANFD_CFDC_ERFL_ADERR_Msk | /* ACK Delimiter Error */ + R_CANFD_CFDC_ERFL_B1ERR_Msk | /* Bit 1 Error */ + R_CANFD_CFDC_ERFL_B0ERR_Msk)) /* Bit 0 Error */ + != 0) { + can_renesas_ra_call_tx_cb(dev, -EIO); + } + } + + default: + break; + } +} + +static inline int can_renesas_ra_apply_default_config(const struct device *dev) +{ + struct can_renesas_ra_cfg *cfg = (struct can_renesas_ra_cfg *)dev->config; + int ret; + + struct can_timing timing = {0}; + + /* Calculate bit_timing parameter */ + ret = can_calc_timing(dev, &timing, cfg->common.bitrate, cfg->common.sample_point); + if (ret < 0) { + return ret; + } + + ret = can_renesas_ra_set_timing(dev, &timing); + if (ret != 0) { + return ret; + } + +#ifdef CONFIG_CAN_FD_MODE + can_calc_timing_data(dev, &timing, cfg->common.bitrate_data, cfg->common.sample_point_data); + ret = can_renesas_ra_set_timing_data(dev, &timing); + if (ret < 0) { + return ret; + } +#endif + + for (uint32_t filter_id = 0; filter_id < cfg->rx_filter_num; filter_id++) { + remove_afl_rule(dev, filter_id); + } + + return 0; +} + +static inline int can_renesas_module_clock_init(const struct device *dev) +{ + const struct can_renesas_ra_cfg *cfg = dev->config; + const struct can_renesas_ra_global_cfg *global_cfg = cfg->global_dev->config; + int ret; + + ret = clock_control_on(cfg->dll_clk, (clock_control_subsys_t)&cfg->dll_subsys); + if (ret < 0) { + return -EIO; + } + + uint32_t op_rate; + uint32_t ram_rate; + uint32_t dll_rate; + + ret = clock_control_get_rate(global_cfg->op_clk, + (clock_control_subsys_t)&global_cfg->op_subsys, &op_rate); + if (ret < 0) { + return ret; + } + + ret = clock_control_get_rate(global_cfg->ram_clk, + (clock_control_subsys_t)&global_cfg->ram_subsys, &ram_rate); + if (ret < 0) { + return ret; + } + + ret = clock_control_get_rate(cfg->dll_clk, (clock_control_subsys_t)&cfg->dll_subsys, + &dll_rate); + if (ret < 0) { + return ret; + } + + /* Clock constraint: refer to '34.1.2 Clock restriction' - RA8M1 MCU group HWM */ + /* + * Operation clock rate must be at least 40Mhz in case CANFD mode. + * Otherwise, it must be at least 32MHz. + */ + if (IS_ENABLED(CONFIG_CAN_FD_MODE) ? op_rate < 40000000 : op_rate < 32000000) { + return -ENOTSUP; + } + /* + * (RAM clock rate / 2) >= DLL rate + * (CANFD operation clock rate) >= DLL rate + */ + if ((ram_rate / 2) < dll_rate || op_rate < dll_rate) { + return -ENOTSUP; + } + + return 0; +} + +static int can_renesas_ra_init(const struct device *dev) +{ + const struct can_renesas_ra_cfg *cfg = dev->config; + struct can_renesas_ra_data *data = dev->data; + int ret = 0; + + k_mutex_init(&data->inst_mutex); + k_sem_init(&data->tx_sem, 1, 1); + data->common.started = false; + + ret = can_renesas_module_clock_init(dev); + if (ret < 0) { + LOG_DBG("clock initialize failed"); + return ret; + } + + /* Configure dt provided device signals when available */ + ret = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT); + if (ret < 0) { + LOG_DBG("pin function initial failed"); + return ret; + } + + /* Apply config and setting for CAN controller HW */ + ret = can_renesas_ra_apply_default_config(dev); + if (ret < 0) { + LOG_DBG("invalid default configuration"); + return ret; + } + + ret = can_api->open(data->fsp_can.p_ctrl, data->fsp_can.p_cfg); + if (ret != FSP_SUCCESS) { + LOG_DBG("CAN bus initialize failed"); + return -EIO; + } + + /* Put CAN controller into stopped state */ + ret = can_api->modeTransition(data->fsp_can.p_ctrl, CAN_OPERATION_MODE_HALT, + CAN_TEST_MODE_DISABLED); + if (ret != FSP_SUCCESS) { + can_api->close(data->fsp_can.p_ctrl); + LOG_DBG("CAN bus initialize failed"); + return -EIO; + } + + return 0; +} + +static const struct can_driver_api can_renesas_ra_driver_api = { + .get_capabilities = can_renesas_ra_get_capabilities, + .start = can_renesas_ra_start, + .stop = can_renesas_ra_stop, + .set_mode = can_renesas_ra_set_mode, + .set_timing = can_renesas_ra_set_timing, + .send = can_renesas_ra_send, + .add_rx_filter = can_renesas_ra_add_rx_filter, + .remove_rx_filter = can_renesas_ra_remove_rx_filter, +#if defined(CONFIG_CAN_MANUAL_RECOVERY_MODE) + .recover = can_renesas_ra_recover, +#endif /* CONFIG_CAN_MANUAL_RECOVERY_MODE */ + .get_state = can_renesas_ra_get_state, + .set_state_change_callback = can_renesas_ra_set_state_change_callback, + .get_core_clock = can_renesas_ra_get_core_clock, + .get_max_filters = can_renesas_ra_get_max_filters, + .timing_min = CAN_RENESAS_RA_TIMING_MIN, + .timing_max = CAN_RENESAS_RA_TIMING_MAX, +#if defined(CONFIG_CAN_FD_MODE) + .set_timing_data = can_renesas_ra_set_timing_data, + .timing_data_min = CAN_RENESAS_RA_TIMING_DATA_MIN, + .timing_data_max = CAN_RENESAS_RA_TIMING_DATA_MAX, +#endif /* CONFIG_CAN_FD_MODE */ +}; + +#define CAN_RENESAS_RA_GLOBAL_IRQ_INIT() \ + R_ICU->IELSR_b[VECTOR_NUMBER_CAN_GLERR].IELS = ELC_EVENT_CAN_GLERR; \ + R_ICU->IELSR_b[VECTOR_NUMBER_CAN_RXF].IELS = ELC_EVENT_CAN_RXF; \ + IRQ_CONNECT(VECTOR_NUMBER_CAN_GLERR, \ + DT_IRQ_BY_NAME(DT_COMPAT_GET_ANY_STATUS_OKAY(renesas_ra_canfd_global), glerr, \ + priority), \ + canfd_error_isr, NULL, 0); \ + IRQ_CONNECT(VECTOR_NUMBER_CAN_RXF, \ + DT_IRQ_BY_NAME(DT_COMPAT_GET_ANY_STATUS_OKAY(renesas_ra_canfd_global), rxf, \ + priority), \ + canfd_rx_fifo_isr, NULL, 0); \ + irq_enable(VECTOR_NUMBER_CAN_RXF); \ + irq_enable(VECTOR_NUMBER_CAN_GLERR); + +static canfd_global_cfg_t g_canfd_global_cfg = { + .global_interrupts = CANFD_CFG_GLERR_IRQ, + .global_config = CANFD_CFG_GLOBAL, + .rx_mb_config = CANFD_CFG_RXMB, + .global_err_ipl = DT_IRQ_BY_NAME(DT_COMPAT_GET_ANY_STATUS_OKAY(renesas_ra_canfd_global), + glerr, priority), + .rx_fifo_ipl = DT_IRQ_BY_NAME(DT_COMPAT_GET_ANY_STATUS_OKAY(renesas_ra_canfd_global), rxf, + priority), + .rx_fifo_config = CANFD_CFG_RXFIFO, + .common_fifo_config = CANFD_CFG_COMMONFIFO, +}; + +static const struct can_renesas_ra_global_cfg g_can_renesas_ra_global_cfg = { + .op_clk = DEVICE_DT_GET(DT_CLOCKS_CTLR_BY_NAME( + DT_COMPAT_GET_ANY_STATUS_OKAY(renesas_ra_canfd_global), opclk)), + .ram_clk = DEVICE_DT_GET(DT_CLOCKS_CTLR_BY_NAME( + DT_COMPAT_GET_ANY_STATUS_OKAY(renesas_ra_canfd_global), ramclk)), + .op_subsys = {.mstp = DT_CLOCKS_CELL_BY_NAME( + DT_COMPAT_GET_ANY_STATUS_OKAY(renesas_ra_canfd_global), opclk, mstp), + .stop_bit = DT_CLOCKS_CELL_BY_NAME( + DT_COMPAT_GET_ANY_STATUS_OKAY(renesas_ra_canfd_global), opclk, + stop_bit)}, + .ram_subsys = {.mstp = DT_CLOCKS_CELL_BY_NAME( + DT_COMPAT_GET_ANY_STATUS_OKAY(renesas_ra_canfd_global), ramclk, + mstp), + .stop_bit = DT_CLOCKS_CELL_BY_NAME( + DT_COMPAT_GET_ANY_STATUS_OKAY(renesas_ra_canfd_global), ramclk, + stop_bit)}, +}; + +static int can_renesas_ra_global_init(const struct device *dev) +{ + int ret; + const struct can_renesas_ra_global_cfg *cfg = dev->config; + + ret = clock_control_on(cfg->op_clk, (clock_control_subsys_t)&cfg->op_subsys); + if (ret < 0) { + LOG_DBG("clock initialize failed"); + return ret; + } + + ret = clock_control_on(cfg->ram_clk, (clock_control_subsys_t)&cfg->ram_subsys); + if (ret < 0) { + LOG_DBG("clock initialize failed"); + return ret; + } + + CAN_RENESAS_RA_GLOBAL_IRQ_INIT(); + + return 0; +} + +DEVICE_DT_DEFINE(DT_COMPAT_GET_ANY_STATUS_OKAY(renesas_ra_canfd_global), can_renesas_ra_global_init, + NULL, NULL, &g_can_renesas_ra_global_cfg, PRE_KERNEL_2, CONFIG_CAN_INIT_PRIORITY, + NULL) + +#define _ELC_EVENT_CAN_COMFRX(channel) ELC_EVENT_CAN##channel##_COMFRX +#define _ELC_EVENT_CAN_TX(channel) ELC_EVENT_CAN##channel##_TX +#define _ELC_EVENT_CAN_CHERR(channel) ELC_EVENT_CAN##channel##_CHERR + +#define ELC_EVENT_CAN_COMFRX(channel) _ELC_EVENT_CAN_COMFRX(channel) +#define ELC_EVENT_CAN_TX(channel) _ELC_EVENT_CAN_TX(channel) +#define ELC_EVENT_CAN_CHERR(channel) _ELC_EVENT_CAN_CHERR(channel) + +#define CAN_RENESAS_RA_CHANNEL_IRQ_INIT(index) \ + { \ + R_ICU->IELSR_b[DT_INST_IRQ_BY_NAME(index, rx, irq)].IELS = \ + ELC_EVENT_CAN_COMFRX(DT_INST_PROP(index, channel)); \ + R_ICU->IELSR_b[DT_INST_IRQ_BY_NAME(index, tx, irq)].IELS = \ + ELC_EVENT_CAN_TX(DT_INST_PROP(index, channel)); \ + R_ICU->IELSR_b[DT_INST_IRQ_BY_NAME(index, err, irq)].IELS = \ + ELC_EVENT_CAN_CHERR(DT_INST_PROP(index, channel)); \ + \ + IRQ_CONNECT(DT_INST_IRQ_BY_NAME(index, rx, irq), \ + DT_INST_IRQ_BY_NAME(index, rx, priority), canfd_common_fifo_rx_isr, \ + NULL, 0); \ + IRQ_CONNECT(DT_INST_IRQ_BY_NAME(index, tx, irq), \ + DT_INST_IRQ_BY_NAME(index, tx, priority), canfd_channel_tx_isr, NULL, \ + 0); \ + IRQ_CONNECT(DT_INST_IRQ_BY_NAME(index, err, irq), \ + DT_INST_IRQ_BY_NAME(index, err, priority), canfd_error_isr, NULL, 0); \ + \ + irq_enable(DT_INST_IRQ_BY_NAME(index, rx, irq)); \ + irq_enable(DT_INST_IRQ_BY_NAME(index, tx, irq)); \ + irq_enable(DT_INST_IRQ_BY_NAME(index, err, irq)); \ + } + +#define CAN_RENESAS_RA_INIT(index) \ + PINCTRL_DT_INST_DEFINE(index); \ + static canfd_afl_entry_t canfd_afl##index[DT_INST_PROP(index, rx_max_filters)]; \ + struct can_renesas_ra_filter \ + can_renesas_ra_rx_filter##index[DT_INST_PROP(index, rx_max_filters)]; \ + static can_bit_timing_cfg_t g_canfd_bit_timing##index; \ + static const struct can_renesas_ra_cfg can_renesas_ra_cfg##index = { \ + .common = CAN_DT_DRIVER_CONFIG_INST_GET(index, 0, 5000000), \ + .global_dev = DEVICE_DT_GET(DT_INST_PARENT(index)), \ + .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(index), \ + .dll_clk = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR_BY_NAME(index, dllclk)), \ + .dll_subsys = \ + { \ + .mstp = DT_INST_CLOCKS_CELL_BY_NAME(index, dllclk, mstp), \ + .stop_bit = DT_INST_CLOCKS_CELL_BY_NAME(index, dllclk, stop_bit), \ + }, \ + .rx_filter_num = DT_INST_PROP(index, rx_max_filters), \ + }; \ + static canfd_instance_ctrl_t fsp_canfd_ctrl##index; \ + static canfd_extended_cfg_t fsp_canfd_extend####index = { \ + .p_afl = canfd_afl##index, \ + .txmb_txi_enable = CANFD_CFG_TXMB_TXI_ENABLE, \ + .error_interrupts = 0U, \ + .p_global_cfg = &g_canfd_global_cfg, \ + }; \ + static can_cfg_t fsp_canfd_cfg####index = { \ + .channel = DT_INST_PROP(index, channel), \ + .ipl = DT_INST_IRQ_BY_NAME(index, err, priority), \ + .error_irq = DT_INST_IRQ_BY_NAME(index, err, irq), \ + .rx_irq = DT_INST_IRQ_BY_NAME(index, rx, irq), \ + .tx_irq = DT_INST_IRQ_BY_NAME(index, tx, irq), \ + .p_extend = &fsp_canfd_extend##index, \ + .p_bit_timing = &g_canfd_bit_timing##index, \ + .p_context = DEVICE_DT_INST_GET(index), \ + .p_callback = can_renesas_ra_fsp_cb, \ + }; \ + static struct can_renesas_ra_data can_renesas_ra_data##index = { \ + .fsp_can = \ + { \ + .p_ctrl = &fsp_canfd_ctrl##index, \ + .p_cfg = &fsp_canfd_cfg##index, \ + .p_api = &g_canfd_on_canfd, \ + }, \ + .rx_filter = can_renesas_ra_rx_filter##index, \ + .dev = DEVICE_DT_INST_GET(index), \ + }; \ + static int can_renesas_ra_init##index(const struct device *dev) \ + { \ + const struct device *global_canfd = DEVICE_DT_GET(DT_INST_PARENT(index)); \ + if (!device_is_ready(global_canfd)) { \ + return -EIO; \ + } \ + CAN_RENESAS_RA_CHANNEL_IRQ_INIT(index) \ + return can_renesas_ra_init(dev); \ + } \ + CAN_DEVICE_DT_INST_DEFINE(index, can_renesas_ra_init##index, NULL, \ + &can_renesas_ra_data##index, &can_renesas_ra_cfg##index, \ + POST_KERNEL, CONFIG_CAN_INIT_PRIORITY, \ + &can_renesas_ra_driver_api); + +DT_INST_FOREACH_STATUS_OKAY(CAN_RENESAS_RA_INIT) diff --git a/dts/arm/renesas/ra/ra8/ra8x1.dtsi b/dts/arm/renesas/ra/ra8/ra8x1.dtsi index c4ba97aba984e..a8c952f8228a5 100644 --- a/dts/arm/renesas/ra/ra8/ra8x1.dtsi +++ b/dts/arm/renesas/ra/ra8/ra8x1.dtsi @@ -527,6 +527,36 @@ status = "disabled"; }; }; + + canfd_global: canfd_global@40380000 { + compatible = "renesas,ra-canfd-global"; + interrupts = <40 1>, <41 1>; + interrupt-names = "rxf", "glerr"; + clocks = <&pclka 0 0>, <&pclke 0 0>; + clock-names = "opclk", "ramclk"; + reg = <0x40380000 0x4000>; + status = "disabled"; + + canfd0: canfd0 { + compatible = "renesas,ra-canfd"; + channel = <0>; + interrupts = <43 12>, <44 12>, <45 12>; + interrupt-names = "err", "tx", "rx"; + clocks = <&canfdclk MSTPC 27>; + clock-names = "dllclk"; + status = "disabled"; + }; + + canfd1: canfd1 { + compatible = "renesas,ra-canfd"; + channel = <1>; + interrupts = <46 1>, <47 1>, <48 1>; + interrupt-names = "err", "tx", "rx"; + clocks = <&canfdclk MSTPC 26>; + clock-names = "dllclk"; + status = "disabled"; + }; + }; }; }; diff --git a/dts/bindings/can/renesas,ra-canfd-global.yaml b/dts/bindings/can/renesas,ra-canfd-global.yaml new file mode 100644 index 0000000000000..a737b571ee257 --- /dev/null +++ b/dts/bindings/can/renesas,ra-canfd-global.yaml @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Renesas Electronics Corporation +# SPDX-License-Identifier: Apache-2.0 + +description: Renesas RA CANFD controller global + +compatible: "renesas,ra-canfd-global" + +include: [base.yaml] + +properties: + interrupts: + required: true + + clocks: + required: true diff --git a/dts/bindings/can/renesas,ra-canfd.yaml b/dts/bindings/can/renesas,ra-canfd.yaml new file mode 100644 index 0000000000000..76c8115660ffb --- /dev/null +++ b/dts/bindings/can/renesas,ra-canfd.yaml @@ -0,0 +1,25 @@ +# Copyright (c) 2024 Renesas Electronics Corporation +# SPDX-License-Identifier: Apache-2.0 + +description: Renesas RA CANFD controller + +compatible: "renesas,ra-canfd" + +include: [can-fd-controller.yaml, pinctrl-device.yaml] + +properties: + interrupts: + required: true + + clocks: + required: true + + channel: + type: int + required: true + + rx-max-filters: + type: int + description: | + To determine the maximum rx filters can be added on this CAN device. + Valid range: 0 - 16 diff --git a/modules/Kconfig.renesas_fsp b/modules/Kconfig.renesas_fsp index 661f8bdbf58ef..9e8de7afed86f 100644 --- a/modules/Kconfig.renesas_fsp +++ b/modules/Kconfig.renesas_fsp @@ -71,4 +71,9 @@ config USE_RA_FSP_AGT help Enable RA FSP AGT driver +config USE_RA_FSP_CANFD + bool + help + Enable RA FSP CANFD driver + endif # HAS_RENESAS_RA_FSP From 189e875906bd984df313a821961a83afef58df53 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Fri, 3 May 2024 15:33:35 +0200 Subject: [PATCH 1728/4482] doc: change plank.yaml to plank_.yaml The board file used by twister is the normalized board target and not just the board name. Indicate this by changing plank.yaml to plank_.yaml in the board porting guide. Signed-off-by: Torsten Rasmussen --- doc/hardware/porting/board_porting.rst | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/doc/hardware/porting/board_porting.rst b/doc/hardware/porting/board_porting.rst index 7291cc8e93ced..48c7c2e497e2c 100644 --- a/doc/hardware/porting/board_porting.rst +++ b/doc/hardware/porting/board_porting.rst @@ -265,11 +265,9 @@ Your board directory should look like this: │   └── index.rst ├── Kconfig.plank ├── Kconfig.defconfig - ├── plank_defconfig ├── plank__defconfig - ├── plank.dts ├── plank_.dts - └── plank.yaml + └── plank_.yaml Replace ``plank`` with your board's name, of course. @@ -280,7 +278,7 @@ The mandatory files are: CPU clusters for multi-core SoCs are not described in this file as they are inherited from the SoC's YAML description. -#. :file:`plank.dts` or :file:`plank_.dts`: a hardware description +#. :file:`plank_.dts`: a hardware description in :ref:`devicetree ` format. This declares your SoC, connectors, and any other hardware components such as LEDs, buttons, sensors, or communication peripherals (USB, BLE controller, etc). @@ -304,8 +302,8 @@ The optional files are: - :file:`doc/index.rst`, :file:`doc/plank.png`: documentation for and a picture of your board. You only need this if you're :ref:`contributing-your-board` to Zephyr. -- :file:`plank.yaml`: a YAML file with miscellaneous metadata used by the - :ref:`twister_script`. +- :file:`plank_.yaml`: a YAML file with miscellaneous metadata used + by the :ref:`twister_script`. Board qualifiers of the form ``//`` are normalized so that ``/`` is replaced with ``_`` when used for filenames, for example: From f44690795fdec7f59d1717b8fffb8ed494afea14 Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Mon, 16 Sep 2024 14:23:15 +0700 Subject: [PATCH 1729/4482] drivers: serial: ra_sci: revise switch-case in `callback_adapter` Unified switch-case usage in `uart_ra_sci_callback_adapter` to use `break` instead of `return`. Typically, a `break` is used in switch-case statements unless an early return is necessary, in which case `return` is appropriate. For this case, using a `break` statement is the more suitable choice. Signed-off-by: Pisit Sawangvonganan --- drivers/serial/uart_renesas_ra_sci.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/serial/uart_renesas_ra_sci.c b/drivers/serial/uart_renesas_ra_sci.c index f1327c59fbd9e..97919b17f5cab 100644 --- a/drivers/serial/uart_renesas_ra_sci.c +++ b/drivers/serial/uart_renesas_ra_sci.c @@ -860,17 +860,22 @@ static void uart_ra_sci_callback_adapter(struct st_uart_callback_arg *fsp_args) switch (fsp_args->event) { case UART_EVENT_TX_COMPLETE: - return async_evt_tx_done(dev); + async_evt_tx_done(dev); + break; case UART_EVENT_RX_COMPLETE: async_evt_rx_complete(dev); case UART_EVENT_ERR_PARITY: - return async_evt_rx_err(dev, UART_ERROR_PARITY); + async_evt_rx_err(dev, UART_ERROR_PARITY); + break; case UART_EVENT_ERR_FRAMING: - return async_evt_rx_err(dev, UART_ERROR_FRAMING); + async_evt_rx_err(dev, UART_ERROR_FRAMING); + break; case UART_EVENT_ERR_OVERFLOW: - return async_evt_rx_err(dev, UART_ERROR_OVERRUN); + async_evt_rx_err(dev, UART_ERROR_OVERRUN); + break; case UART_EVENT_BREAK_DETECT: - return async_evt_rx_err(dev, UART_BREAK); + async_evt_rx_err(dev, UART_BREAK); + break; case UART_EVENT_TX_DATA_EMPTY: case UART_EVENT_RX_CHAR: break; From 3ca71c94df45b58d3e18687c0cf798c22caba99d Mon Sep 17 00:00:00 2001 From: Pisit Sawangvonganan Date: Mon, 16 Sep 2024 14:28:01 +0700 Subject: [PATCH 1730/4482] drivers: serial: ra_sci: add missing `break` in `callback_adapter` Added missing `break` statement in `uart_ra_sci_callback_adapter` for the `UART_EVENT_RX_COMPLETE` case. Without it, `async_evt_rx_err()` would be called, which is not the desired operation. Signed-off-by: Pisit Sawangvonganan --- drivers/serial/uart_renesas_ra_sci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/serial/uart_renesas_ra_sci.c b/drivers/serial/uart_renesas_ra_sci.c index 97919b17f5cab..fc2b79104e015 100644 --- a/drivers/serial/uart_renesas_ra_sci.c +++ b/drivers/serial/uart_renesas_ra_sci.c @@ -864,6 +864,7 @@ static void uart_ra_sci_callback_adapter(struct st_uart_callback_arg *fsp_args) break; case UART_EVENT_RX_COMPLETE: async_evt_rx_complete(dev); + break; case UART_EVENT_ERR_PARITY: async_evt_rx_err(dev, UART_ERROR_PARITY); break; From 7c167c67c341b34a1cc8abaeb39e00a892507094 Mon Sep 17 00:00:00 2001 From: Hui Bai Date: Thu, 12 Sep 2024 14:16:22 +0800 Subject: [PATCH 1731/4482] modules: hostap: add 11k cmd support Add 11k cmds support. User can issue 11k cmds to enable/disable 11k and send Neighbor Report Request packet. Signed-off-by: Hui Bai --- drivers/wifi/nxp/nxp_wifi_drv.c | 12 +++++ include/zephyr/net/wifi_mgmt.h | 40 +++++++++++++++ modules/hostap/src/supp_api.c | 42 +++++++++++++++ modules/hostap/src/supp_api.h | 18 +++++++ modules/hostap/src/supp_main.c | 2 + subsys/net/l2/wifi/wifi_mgmt.c | 33 ++++++++++++ subsys/net/l2/wifi/wifi_shell.c | 90 +++++++++++++++++++++++++++++++++ 7 files changed, 237 insertions(+) diff --git a/drivers/wifi/nxp/nxp_wifi_drv.c b/drivers/wifi/nxp/nxp_wifi_drv.c index 71041c3360ea9..48f440831b4d7 100644 --- a/drivers/wifi/nxp/nxp_wifi_drv.c +++ b/drivers/wifi/nxp/nxp_wifi_drv.c @@ -1055,6 +1055,17 @@ static void nxp_wifi_auto_connect(void) } #endif +static int nxp_wifi_11k_cfg(const struct device *dev, struct wifi_11k_params *params) +{ + if (params->oper == WIFI_MGMT_GET) { + params->enable_11k = wlan_get_host_11k_status(); + } else { + wlan_host_11k_cfg(params->enable_11k); + } + + return 0; +} + static int nxp_wifi_power_save(const struct device *dev, struct wifi_ps_params *params) { int status = NXP_WIFI_RET_SUCCESS; @@ -1640,6 +1651,7 @@ static const struct wifi_mgmt_ops nxp_wifi_sta_mgmt = { #if defined(CONFIG_NET_STATISTICS_WIFI) .get_stats = nxp_wifi_stats, #endif + .cfg_11k = nxp_wifi_11k_cfg, .set_power_save = nxp_wifi_power_save, .get_power_save_config = nxp_wifi_get_power_save, .set_twt = nxp_wifi_set_twt, diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index bdf3bab48bd88..b4d230abfdbe9 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -71,6 +71,10 @@ enum net_request_wifi_cmd { NET_REQUEST_WIFI_CMD_AP_DISABLE, /** Get interface status */ NET_REQUEST_WIFI_CMD_IFACE_STATUS, + /** Set or get 11k status */ + NET_REQUEST_WIFI_CMD_11K_CONFIG, + /** Send 11k neighbor request */ + NET_REQUEST_WIFI_CMD_11K_NEIGHBOR_REQUEST, /** Set power save status */ NET_REQUEST_WIFI_CMD_PS, /** Setup or teardown TWT flow */ @@ -154,6 +158,16 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_DISABLE); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_IFACE_STATUS); +#define NET_REQUEST_WIFI_11K_CONFIG \ + (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_11K_CONFIG) + +NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_11K_CONFIG); + +#define NET_REQUEST_WIFI_11K_NEIGHBOR_REQUEST \ + (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_11K_NEIGHBOR_REQUEST) + +NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_11K_NEIGHBOR_REQUEST); + /** Request a Wi-Fi power save */ #define NET_REQUEST_WIFI_PS \ (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_PS) @@ -769,6 +783,16 @@ enum wifi_mgmt_op { WIFI_MGMT_SET = 1, }; +/** Wi-Fi 11k parameters */ +struct wifi_11k_params { + /** 11k command operation */ + enum wifi_mgmt_op oper; + /** 11k enable/disable */ + bool enable_11k; + /** SSID */ + uint8_t ssid[WIFI_SSID_MAX_LEN + 1]; +}; + /** Max regulatory channel number */ #define MAX_REG_CHAN_NUM 42 @@ -1227,6 +1251,22 @@ struct wifi_mgmt_ops { */ int (*reset_stats)(const struct device *dev); #endif /* CONFIG_NET_STATISTICS_WIFI */ + /** Set or get 11K status + * + * @param dev Pointer to the device structure for the driver instance. + * @param params 11k parameters + * + * @return 0 if ok, < 0 if error + */ + int (*cfg_11k)(const struct device *dev, struct wifi_11k_params *params); + /** Send 11k neighbor request + * + * @param dev Pointer to the device structure for the driver instance. + * @param params 11k parameters + * + * @return 0 if ok, < 0 if error + */ + int (*send_11k_neighbor_request)(const struct device *dev, struct wifi_11k_params *params); /** Set power save status * * @param dev Pointer to the device structure for the driver instance. diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index 52772b4becfc6..c8674a027165a 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -1384,6 +1384,48 @@ int supplicant_pmksa_flush(const struct device *dev) return ret; } +int supplicant_11k_cfg(const struct device *dev, struct wifi_11k_params *params) +{ + const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_mgmt_api(dev); + + if (!wifi_mgmt_api || !wifi_mgmt_api->cfg_11k) { + wpa_printf(MSG_ERROR, "cfg 11k not supported"); + return -ENOTSUP; + } + + return wifi_mgmt_api->cfg_11k(dev, params); +} + +int supplicant_11k_neighbor_request(const struct device *dev, struct wifi_11k_params *params) +{ + int ssid_len = strlen(params->ssid); + + if (params != NULL && ssid_len > 0) { + if (ssid_len > WIFI_SSID_MAX_LEN) { + wpa_printf(MSG_ERROR, "%s: ssid too long %u", + __func__, ssid_len); + return -1; + } + + if (!wpa_cli_cmd_v("neighbor_rep_request ssid %s", + params->ssid)) { + wpa_printf(MSG_ERROR, + "%s: cli cmd fail", + __func__, params->ssid); + return -1; + } + } else { + if (!wpa_cli_cmd_v("neighbor_rep_request")) { + wpa_printf(MSG_ERROR, + "%s: cli cmd fail", + __func__); + return -1; + } + } + + return 0; +} + int supplicant_set_power_save(const struct device *dev, struct wifi_ps_params *params) { const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_mgmt_api(dev); diff --git a/modules/hostap/src/supp_api.h b/modules/hostap/src/supp_api.h index f6584d861261c..b04824c3d5ebf 100644 --- a/modules/hostap/src/supp_api.h +++ b/modules/hostap/src/supp_api.h @@ -100,6 +100,24 @@ int supplicant_reset_stats(const struct device *dev); */ int supplicant_pmksa_flush(const struct device *dev); +/** Set or get 11K status + * + * @param dev Pointer to the device structure for the driver instance. + * @param params 11k parameters + * + * @return 0 if ok, < 0 if error + */ +int supplicant_11k_cfg(const struct device *dev, struct wifi_11k_params *params); + +/** Send 11k neighbor request + * + * @param dev Pointer to the device structure for the driver instance. + * @param params 11k parameters + * + * @return 0 if ok, < 0 if error + */ +int supplicant_11k_neighbor_request(const struct device *dev, struct wifi_11k_params *params); + /** * @brief Set Wi-Fi power save configuration * diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index 826e15e9d8d3d..aa1530a109929 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -62,6 +62,8 @@ static const struct wifi_mgmt_ops mgmt_ops = { .get_stats = supplicant_get_stats, .reset_stats = supplicant_reset_stats, #endif + .cfg_11k = supplicant_11k_cfg, + .send_11k_neighbor_request = supplicant_11k_neighbor_request, .set_power_save = supplicant_set_power_save, .set_twt = supplicant_set_twt, .get_power_save_config = supplicant_get_power_save_config, diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index a1a84f9dcbbf2..7439f7d6338de 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -555,6 +555,39 @@ static int wifi_iface_stats_reset(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_STATS_RESET_WIFI, wifi_iface_stats_reset); #endif /* CONFIG_NET_STATISTICS_WIFI */ +static int wifi_11k_cfg(uint32_t mgmt_request, struct net_if *iface, + void *data, size_t len) +{ + const struct device *dev = net_if_get_device(iface); + const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_api(iface); + struct wifi_11k_params *params = data; + + if (wifi_mgmt_api == NULL || wifi_mgmt_api->cfg_11k == NULL) { + return -ENOTSUP; + } + + return wifi_mgmt_api->cfg_11k(dev, params); +} + +NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_11K_CONFIG, wifi_11k_cfg); + +static int wifi_11k_neighbor_request(uint32_t mgmt_request, struct net_if *iface, + void *data, size_t len) +{ + const struct device *dev = net_if_get_device(iface); + const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_api(iface); + struct wifi_11k_params *params = data; + + if (wifi_mgmt_api == NULL || wifi_mgmt_api->send_11k_neighbor_request == NULL) { + return -ENOTSUP; + } + + return wifi_mgmt_api->send_11k_neighbor_request(dev, params); +} + +NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_11K_NEIGHBOR_REQUEST, + wifi_11k_neighbor_request); + static int wifi_set_power_save(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 75fec48b0bd1f..6696dd9c147d6 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -1172,6 +1172,84 @@ static int cmd_wifi_stats(const struct shell *sh, size_t argc, char *argv[]) return 0; } +static int cmd_wifi_11k(const struct shell *sh, size_t argc, char *argv[]) +{ + struct net_if *iface = net_if_get_first_wifi(); + struct wifi_11k_params params = { 0 }; + + context.sh = sh; + + if (argc > 2) { + PR_WARNING("Invalid number of arguments\n"); + return -ENOEXEC; + } + + if (argc == 1) { + params.oper = WIFI_MGMT_GET; + } else { + params.oper = WIFI_MGMT_SET; + if (!strncasecmp(argv[1], "enable", 2)) { + params.enable_11k = true; + } else if (!strncasecmp(argv[1], "disable", 3)) { + params.enable_11k = false; + } else { + PR_WARNING("Invalid argument\n"); + return -ENOEXEC; + } + } + + if (net_mgmt(NET_REQUEST_WIFI_11K_CONFIG, iface, ¶ms, sizeof(params))) { + PR_WARNING("11k enable/disable failed\n"); + return -ENOEXEC; + } + + if (params.oper == WIFI_MGMT_GET) { + PR("11k is %s\n", params.enable_11k ? "disabled" : "enabled"); + } else { + PR("%s %s requested\n", argv[0], argv[1]); + } + + return 0; +} + + +static int cmd_wifi_11k_neighbor_request(const struct shell *sh, size_t argc, char *argv[]) +{ + struct net_if *iface = net_if_get_first_wifi(); + struct wifi_11k_params params = { 0 }; + + context.sh = sh; + + if ((argc != 1 && argc != 3) || (argc == 3 && !strncasecmp("ssid", argv[1], 4))) { + PR_WARNING("Invalid input arguments\n"); + PR_WARNING("Usage: %s\n", argv[0]); + PR_WARNING("or %s ssid \n", argv[0]); + return -ENOEXEC; + } + + if (argc == 3) { + if (strlen(argv[2]) > (sizeof(params.ssid) - 1)) { + PR_WARNING("Error: ssid too long\n"); + return -ENOEXEC; + } + (void)memcpy((void *)params.ssid, (const void *)argv[2], + (size_t)strlen(argv[2])); + } + + if (net_mgmt(NET_REQUEST_WIFI_11K_NEIGHBOR_REQUEST, iface, ¶ms, sizeof(params))) { + PR_WARNING("11k neighbor request failed\n"); + return -ENOEXEC; + } + + if (argc == 3) { + PR("%s %s %s requested\n", argv[0], argv[1], argv[2]); + } else { + PR("%s requested\n", argv[0]); + } + + return 0; +} + static int cmd_wifi_ps(const struct shell *sh, size_t argc, char *argv[]) { struct net_if *iface = net_if_get_first_wifi(); @@ -3057,6 +3135,18 @@ SHELL_SUBCMD_ADD((wifi), dpp, &wifi_cmd_dpp, SHELL_SUBCMD_SET_CREATE(wifi_commands, (wifi)); +SHELL_SUBCMD_ADD((wifi), 11k, &wifi_commands, + "Configure 11k or get 11k status.\n" + "[enable/disable]\n", + cmd_wifi_11k, + 1, 1); + +SHELL_SUBCMD_ADD((wifi), 11k_neighbor_request, &wifi_commands, + "Send Neighbor Report Request frame.\n" + "[ssid ]\n", + cmd_wifi_11k_neighbor_request, + 1, 2); + #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_WNM SHELL_SUBCMD_ADD((wifi), 11v_btm_query, &wifi_commands, ".\n", From 91ec46e9615d2941e97416c0d67d10ab67845fe2 Mon Sep 17 00:00:00 2001 From: Hui Bai Date: Thu, 12 Sep 2024 16:24:14 +0800 Subject: [PATCH 1732/4482] modules: hostap: add IEEE80211R support Add 80211R support in hostap. Add cmd wifi connect option '-R' to enable 80211R. Signed-off-by: Hui Bai --- include/zephyr/net/wifi_mgmt.h | 2 ++ modules/hostap/CMakeLists.txt | 5 +++++ modules/hostap/Kconfig | 4 ++++ modules/hostap/src/supp_api.c | 19 ++++++++++++++----- subsys/net/l2/wifi/wifi_shell.c | 6 +++++- 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index b4d230abfdbe9..e32f8c194e075 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -512,6 +512,8 @@ struct wifi_connect_req_params { const uint8_t *eap_password; /** eap passwd length, max 128 */ uint8_t eap_passwd_length; + /** Fast BSS Transition used */ + bool ft_used; }; /** @brief Wi-Fi connect result codes. To be overlaid on top of \ref wifi_status diff --git a/modules/hostap/CMakeLists.txt b/modules/hostap/CMakeLists.txt index 9910b077e6ba6..a3bfdc84e14d2 100644 --- a/modules/hostap/CMakeLists.txt +++ b/modules/hostap/CMakeLists.txt @@ -161,6 +161,11 @@ zephyr_library_sources_ifdef(CONFIG_WPA_CLI src/wpa_cli.c ) +zephyr_library_sources_ifdef(CONFIG_IEEE80211R + ${HOSTAP_SRC_BASE}/rsn_supp/wpa_ft.c + ${HOSTAP_SRC_BASE}/ap/wpa_auth_ft.c +) + zephyr_library_sources_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_AP ${WIFI_NM_WPA_SUPPLICANT_BASE}/ap.c ${HOSTAP_SRC_BASE}/ap/ap_config.c diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index e22059f00f067..973398abeee26 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -508,6 +508,10 @@ config ACS config IEEE80211AC bool +config IEEE80211R + bool + depends on !WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE + config NW_SEL_RELIABILITY bool default y diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index c8674a027165a..27e1be505c128 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -480,13 +480,21 @@ int process_cipher_config(struct wifi_connect_req_params *params, } else if (params->suiteb_type == WIFI_SUITEB_192) { cipher_capa = WPA_CAPA_ENC_GCMP_256; gropu_mgmt_cipher_capa = WPA_CAPA_ENC_BIP_GMAC_256; - cipher_config->key_mgmt = "WPA-EAP-SUITE-B-192"; + if (params->ft_used) { + cipher_config->key_mgmt = "WPA-EAP-SUITE-B-192 FT-EAP-SHA384"; + } else { + cipher_config->key_mgmt = "WPA-EAP-SUITE-B-192"; + } cipher_config->openssl_ciphers = "SUITEB192"; cipher_config->tls_flags = "[SUITEB]"; } else { cipher_capa = WPA_CAPA_ENC_CCMP; gropu_mgmt_cipher_capa = WPA_CAPA_ENC_BIP; - cipher_config->key_mgmt = "WPA-EAP"; + if (params->ft_used) { + cipher_config->key_mgmt = "WPA-EAP FT-EAP"; + } else { + cipher_config->key_mgmt = "WPA-EAP"; + } } if (params->security == WIFI_SECURITY_TYPE_EAP_TLS_SHA256) { @@ -678,7 +686,8 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s, } } - if (!wpa_cli_cmd_v("set_network %d key_mgmt SAE", resp.network_id)) { + if (!wpa_cli_cmd_v("set_network %d key_mgmt SAE%s", resp.network_id, + params->ft_used ? " FT-SAE" : "")) { goto out; } } else if (params->security == WIFI_SECURITY_TYPE_PSK_SHA256) { @@ -698,8 +707,8 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s, goto out; } - if (!wpa_cli_cmd_v("set_network %d key_mgmt WPA-PSK", - resp.network_id)) { + if (!wpa_cli_cmd_v("set_network %d key_mgmt WPA-PSK%s", + resp.network_id, params->ft_used ? " FT-PSK" : "")) { goto out; } diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 6696dd9c147d6..1918797cd8c32 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -541,6 +541,7 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv {"eap-pwd6", required_argument, 0, 'P'}, {"eap-pwd7", required_argument, 0, 'P'}, {"eap-pwd8", required_argument, 0, 'P'}, + {"ieee-80211r", no_argument, 0, 'R'}, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}}; char *endptr; @@ -565,7 +566,7 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv params->mfp = WIFI_MFP_OPTIONAL; params->eap_ver = 1; - while ((opt = getopt_long(argc, argv, "s:p:k:e:w:b:c:m:t:a:K:S:V:I:P:h", + while ((opt = getopt_long(argc, argv, "s:p:k:e:w:b:c:m:t:a:K:S:V:I:P:Rh", long_options, &opt_index)) != -1) { state = getopt_state_get(); switch (opt) { @@ -731,6 +732,9 @@ static int __wifi_args_to_params(const struct shell *sh, size_t argc, char *argv return -EINVAL; } break; + case 'R': + params->ft_used = true; + break; case 'h': return -ENOEXEC; default: From 83812f213f2eab538a4714c8fcd089c2775939a9 Mon Sep 17 00:00:00 2001 From: Hui Bai Date: Fri, 13 Sep 2024 11:07:41 +0800 Subject: [PATCH 1733/4482] modules: hostap: add 11k/v/r roaming support Added new ops and events in glue layer to support roaming. Added new flag WIFI_NM_WPA_SUPPLICANT_ROAMING to control roaming feature. Signed-off-by: Hui Bai --- include/zephyr/net/wifi.h | 8 ++ include/zephyr/net/wifi_mgmt.h | 56 ++++++++ modules/hostap/Kconfig | 17 +++ modules/hostap/src/supp_api.c | 73 ++++++++++ modules/hostap/src/supp_api.h | 19 +++ modules/hostap/src/supp_events.c | 15 ++ modules/hostap/src/supp_main.c | 4 + samples/net/wifi/boards/frdm_rw612.conf | 2 + samples/net/wifi/boards/rd_rw612_bga.conf | 2 + subsys/net/l2/wifi/wifi_mgmt.c | 160 ++++++++++++++++++++++ subsys/net/l2/wifi/wifi_shell.c | 40 ++++++ 11 files changed, 396 insertions(+) diff --git a/include/zephyr/net/wifi.h b/include/zephyr/net/wifi.h index 36a62f02cadea..e3a1ed22b1929 100644 --- a/include/zephyr/net/wifi.h +++ b/include/zephyr/net/wifi.h @@ -78,6 +78,14 @@ enum wifi_security_type { WIFI_SECURITY_TYPE_EAP_PEAP_TLS, /** EAP TLS SHA256 security - Enterprise. */ WIFI_SECURITY_TYPE_EAP_TLS_SHA256, + /** FT-PSK security */ + WIFI_SECURITY_TYPE_FT_PSK, + /** FT-SAE security */ + WIFI_SECURITY_TYPE_FT_SAE, + /** FT-EAP security */ + WIFI_SECURITY_TYPE_FT_EAP, + /** FT-EAP-SHA384 security */ + WIFI_SECURITY_TYPE_FT_EAP_SHA384, /** @cond INTERNAL_HIDDEN */ __WIFI_SECURITY_TYPE_AFTER_LAST, diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index e32f8c194e075..772aac1105c60 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -117,6 +117,12 @@ enum net_request_wifi_cmd { /** Connect to APs stored using wifi_credentials library. */ NET_REQUEST_WIFI_CMD_CONNECT_STORED, #endif + /** Start roaming */ + NET_REQUEST_WIFI_CMD_START_ROAMING, + /** Neighbor report complete */ + NET_REQUEST_WIFI_CMD_NEIGHBOR_REP_COMPLETE, + /** Specific scan */ + NET_REQUEST_WIFI_CMD_CANDIDATE_SCAN, /** @cond INTERNAL_HIDDEN */ NET_REQUEST_WIFI_CMD_MAX /** @endcond */ @@ -282,6 +288,16 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_WPS_CONFIG); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_CONNECT_STORED); #endif +#define NET_REQUEST_WIFI_START_ROAMING \ + (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_START_ROAMING) + +NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_START_ROAMING); + +#define NET_REQUEST_WIFI_NEIGHBOR_REP_COMPLETE \ + (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_NEIGHBOR_REP_COMPLETE) + +NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_NEIGHBOR_REP_COMPLETE); + /** @brief Wi-Fi management events */ enum net_event_wifi_cmd { /** Scan results available */ @@ -304,6 +320,12 @@ enum net_event_wifi_cmd { NET_EVENT_WIFI_CMD_RAW_SCAN_RESULT, /** Disconnect complete */ NET_EVENT_WIFI_CMD_DISCONNECT_COMPLETE, + /** Signal change event */ + NET_EVENT_WIFI_CMD_SIGNAL_CHANGE, + /** Neighbor Report */ + NET_EVENT_WIFI_CMD_NEIGHBOR_REP_RECEIVED, + /** Neighbor Report complete */ + NET_EVENT_WIFI_CMD_NEIGHBOR_REP_COMPLETE, /** AP mode enable result */ NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT, /** AP mode disable result */ @@ -352,6 +374,14 @@ enum net_event_wifi_cmd { #define NET_EVENT_WIFI_DISCONNECT_COMPLETE \ (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_DISCONNECT_COMPLETE) +/** Event signal change of connected AP */ +#define NET_EVENT_WIFI_SIGNAL_CHANGE \ + (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_SIGNAL_CHANGE) + +/** Event Neighbor Report Completed */ +#define NET_EVENT_WIFI_NEIGHBOR_REP_COMP \ + (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_NEIGHBOR_REP_COMPLETE) + /** Event emitted for Wi-Fi access point enable result */ #define NET_EVENT_WIFI_AP_ENABLE_RESULT \ (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT) @@ -1417,6 +1447,21 @@ struct wifi_mgmt_ops { * @return 0 if ok, < 0 if error */ int (*wps_config)(const struct device *dev, struct wifi_wps_config_params *params); + /** Trigger candidate scan + * + * @param dev Pointer to the device structure for the driver instance + * @param params Scan parameters + * + * @return 0 if ok, < 0 if error + */ + int (*candidate_scan)(const struct device *dev, struct wifi_scan_params *params); + /** Start 11r roaming + * + * @param dev Pointer to the device structure for the driver instance + * + * @return 0 if ok, < 0 if error + */ + int (*start_11r_roaming)(const struct device *dev); }; /** Wi-Fi management offload API */ @@ -1508,6 +1553,17 @@ void wifi_mgmt_raise_raw_scan_result_event(struct net_if *iface, */ void wifi_mgmt_raise_disconnect_complete_event(struct net_if *iface, int status); +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_ROAMING +/** Wi-Fi management neighbor reports event + * + * @param iface Network interface + * @param inbuf Input buffer of neighbor reports + * @param buf_len Lenghth of input buffer + */ +void wifi_mgmt_raise_neighbor_rep_recv_event(struct net_if *iface, + char *inbuf, size_t buf_len); +#endif + /** Wi-Fi management AP mode enable result event * * @param iface Network interface diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 973398abeee26..3f011768b605c 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -303,6 +303,23 @@ if WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE default 16384 endif +config WIFI_NM_WPA_SUPPLICANT_ROAMING + bool "Roaming support" + imply IEEE80211R + help + Enable roaming support with wpa_supplicant. When current BSS RSSI drops, + STA will try to find an AP with better RSSI. If found, STA will reassociate + to the new AP automatically without losing connection. + +config WIFI_NM_WPA_SUPPLICANT_SKIP_DHCP_ON_ROAMING + bool "Skip DHCP after roaming to new AP" + help + For L2 roaming, the original AP and new AP are in the same subnet, client + can use same IP address and skip DHCP. Enable this to skip DHCP. + For L3 roaming, the original AP and new AP are in different subnet, client + needs to get new IP address after roaming to new AP. Disable this to keep + DHCP after roaming. + # Create hidden config options that are used in hostap. This way we do not need # to mark them as allowed for CI checks, and also someone else cannot use the # same name options. diff --git a/modules/hostap/src/supp_api.c b/modules/hostap/src/supp_api.c index 27e1be505c128..e8209b8cd089e 100644 --- a/modules/hostap/src/supp_api.c +++ b/modules/hostap/src/supp_api.c @@ -380,6 +380,14 @@ static inline enum wifi_security_type wpas_key_mgmt_to_zephyr(int key_mgmt, int return WIFI_SECURITY_TYPE_SAE; case WPA_KEY_MGMT_SAE | WPA_KEY_MGMT_PSK: return WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL; + case WPA_KEY_MGMT_FT_PSK: + return WIFI_SECURITY_TYPE_FT_PSK; + case WPA_KEY_MGMT_FT_SAE: + return WIFI_SECURITY_TYPE_FT_SAE; + case WPA_KEY_MGMT_FT_IEEE8021X: + return WIFI_SECURITY_TYPE_FT_EAP; + case WPA_KEY_MGMT_FT_IEEE8021X_SHA384: + return WIFI_SECURITY_TYPE_FT_EAP_SHA384; default: return WIFI_SECURITY_TYPE_UNKNOWN; } @@ -1435,6 +1443,71 @@ int supplicant_11k_neighbor_request(const struct device *dev, struct wifi_11k_pa return 0; } +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_ROAMING +#define SUPPLICANT_CANDIDATE_SCAN_CMD_BUF_SIZE 100 +int supplicant_candidate_scan(const struct device *dev, struct wifi_scan_params *params) +{ + int i = 0; + char cmd[SUPPLICANT_CANDIDATE_SCAN_CMD_BUF_SIZE] = {0}; + char *pos = cmd; + char *end = pos + SUPPLICANT_CANDIDATE_SCAN_CMD_BUF_SIZE; + int freq = 0; + + strcpy(pos, "freq="); + pos += 5; + while (params->band_chan[i].channel) { + if (i > 0) { + pos += snprintf(pos, end - pos, ","); + } + freq = chan_to_freq(params->band_chan[i].channel); + pos += snprintf(pos, end - pos, "%d", freq); + i++; + } + + if (!wpa_cli_cmd_v("scan %s", cmd)) { + wpa_printf(MSG_ERROR, + "%s: cli cmd fail", + __func__, cmd); + return -1; + } + + return 0; +} + +int supplicant_11r_roaming(const struct device *dev) +{ + struct wpa_supplicant *wpa_s; + int ret = 0; + + k_mutex_lock(&wpa_supplicant_mutex, K_FOREVER); + + wpa_s = get_wpa_s_handle(dev); + if (!wpa_s) { + wpa_printf(MSG_ERROR, "Device %s not found", dev->name); + ret = -1; + goto out; + } + + if (wpa_s->reassociate || (wpa_s->wpa_state >= WPA_AUTHENTICATING && + wpa_s->wpa_state < WPA_COMPLETED)) { + wpa_printf(MSG_INFO, "Reassociation is in progress, skip"); + ret = 0; + goto out; + } + + if (!wpa_cli_cmd_v("reassociate")) { + wpa_printf(MSG_ERROR, "%s: cli cmd fail", + __func__); + ret = -1; + goto out; + } + +out: + k_mutex_unlock(&wpa_supplicant_mutex); + return ret; +} +#endif + int supplicant_set_power_save(const struct device *dev, struct wifi_ps_params *params) { const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_mgmt_api(dev); diff --git a/modules/hostap/src/supp_api.h b/modules/hostap/src/supp_api.h index b04824c3d5ebf..46a1381a28dd4 100644 --- a/modules/hostap/src/supp_api.h +++ b/modules/hostap/src/supp_api.h @@ -118,6 +118,25 @@ int supplicant_11k_cfg(const struct device *dev, struct wifi_11k_params *params) */ int supplicant_11k_neighbor_request(const struct device *dev, struct wifi_11k_params *params); +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_ROAMING +/** Send candidate scan request + * + * @param dev Pointer to the device structure for the driver instance. + * @param params Scan parameters + * + * @return 0 if ok, < 0 if error + */ +int supplicant_candidate_scan(const struct device *dev, struct wifi_scan_params *params); + +/** Send 11r roaming request + * + * @param dev Pointer to the device structure for the driver instance. + * + * @return 0 if ok, < 0 if error + */ +int supplicant_11r_roaming(const struct device *dev); +#endif + /** * @brief Set Wi-Fi power save configuration * diff --git a/modules/hostap/src/supp_events.c b/modules/hostap/src/supp_events.c index 9ac472b6bdb44..3b0cd94cc89aa 100644 --- a/modules/hostap/src/supp_events.c +++ b/modules/hostap/src/supp_events.c @@ -368,6 +368,21 @@ int supplicant_send_wifi_mgmt_event(const char *ifname, enum net_event_wifi_cmd iface, *(int *)supplicant_status); break; +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_ROAMING + case NET_EVENT_WIFI_CMD_SIGNAL_CHANGE: + net_mgmt_event_notify_with_info(NET_EVENT_WIFI_SIGNAL_CHANGE, + iface, NULL, 0); + break; + case NET_EVENT_WIFI_CMD_NEIGHBOR_REP_RECEIVED: + wifi_mgmt_raise_neighbor_rep_recv_event( + iface, + (char *)supplicant_status, len); + break; + case NET_EVENT_WIFI_CMD_NEIGHBOR_REP_COMPLETE: + net_mgmt_event_notify_with_info(NET_EVENT_WIFI_NEIGHBOR_REP_COMP, + iface, NULL, 0); + break; +#endif #ifdef CONFIG_AP case NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT: wifi_mgmt_raise_ap_enable_result_event(iface, diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index aa1530a109929..26e8304295fb1 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -64,6 +64,10 @@ static const struct wifi_mgmt_ops mgmt_ops = { #endif .cfg_11k = supplicant_11k_cfg, .send_11k_neighbor_request = supplicant_11k_neighbor_request, +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_ROAMING + .candidate_scan = supplicant_candidate_scan, + .start_11r_roaming = supplicant_11r_roaming, +#endif .set_power_save = supplicant_set_power_save, .set_twt = supplicant_set_twt, .get_power_save_config = supplicant_get_power_save_config, diff --git a/samples/net/wifi/boards/frdm_rw612.conf b/samples/net/wifi/boards/frdm_rw612.conf index 5b5ec82460e08..6094632aca077 100644 --- a/samples/net/wifi/boards/frdm_rw612.conf +++ b/samples/net/wifi/boards/frdm_rw612.conf @@ -88,6 +88,8 @@ CONFIG_WIFI_NM_MAX_MANAGED_INTERFACES=2 CONFIG_SAE_PWE_EARLY_EXIT=y CONFIG_WIFI_NM_HOSTAPD_AP=y CONFIG_WIFI_NM_WPA_SUPPLICANT_WPS=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_ROAMING=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_SKIP_DHCP_ON_ROAMING=y # Enable mbedtls CONFIG_MBEDTLS=y diff --git a/samples/net/wifi/boards/rd_rw612_bga.conf b/samples/net/wifi/boards/rd_rw612_bga.conf index 5b3ebdd7fc63b..a5a1bc1961f41 100644 --- a/samples/net/wifi/boards/rd_rw612_bga.conf +++ b/samples/net/wifi/boards/rd_rw612_bga.conf @@ -87,6 +87,8 @@ CONFIG_WIFI_NM_MAX_MANAGED_INTERFACES=2 CONFIG_SAE_PWE_EARLY_EXIT=y CONFIG_WIFI_NM_HOSTAPD_AP=y CONFIG_WIFI_NM_WPA_SUPPLICANT_WPS=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_ROAMING=y +CONFIG_WIFI_NM_WPA_SUPPLICANT_SKIP_DHCP_ON_ROAMING=y # Enable mbedtls CONFIG_MBEDTLS=y diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index 7439f7d6338de..11adc826cf4d6 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -21,6 +21,33 @@ LOG_MODULE_REGISTER(net_wifi_mgmt, CONFIG_NET_L2_WIFI_MGMT_LOG_LEVEL); #include #endif /* CONFIG_WIFI_NM */ +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_ROAMING +#define MAX_NEIGHBOR_AP_LIMIT 6U +#define MAX_EVENT_STR_LEN 32U + +struct wifi_rrm_neighbor_ap_t { + char ssid[WIFI_SSID_MAX_LEN + 1]; + uint8_t bssid[WIFI_SSID_MAX_LEN]; + uint8_t bssid_info[WIFI_SSID_MAX_LEN]; + int op_class; + int channel; + int phy_type; +}; + +struct wifi_rrm_neighbor_report_t { + struct wifi_rrm_neighbor_ap_t neighbor_ap[MAX_NEIGHBOR_AP_LIMIT]; + int neighbor_cnt; +}; + +struct wifi_roaming_params { + bool is_11r_used; + bool is_11k_enabled; + struct wifi_rrm_neighbor_report_t neighbor_rep; +}; + +static struct wifi_roaming_params roaming_params; +#endif + const char *wifi_security_txt(enum wifi_security_type security) { switch (security) { @@ -46,6 +73,14 @@ const char *wifi_security_txt(enum wifi_security_type security) return "EAP"; case WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL: return "WPA/WPA2/WPA3 PSK"; + case WIFI_SECURITY_TYPE_FT_PSK: + return "FT-PSK"; + case WIFI_SECURITY_TYPE_FT_SAE: + return "FT-SAE"; + case WIFI_SECURITY_TYPE_FT_EAP: + return "FT-EAP"; + case WIFI_SECURITY_TYPE_FT_EAP_SHA384: + return "FT-EAP-SHA384"; case WIFI_SECURITY_TYPE_UNKNOWN: default: return "UNKNOWN"; @@ -312,6 +347,11 @@ static int wifi_connect(uint32_t mgmt_request, struct net_if *iface, return -EINVAL; } +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_ROAMING + memset(&roaming_params, 0x0, sizeof(roaming_params)); + roaming_params.is_11r_used = params->ft_used; +#endif + return wifi_mgmt_api->connect(dev, params); } @@ -403,6 +443,122 @@ void wifi_mgmt_raise_disconnect_result_event(struct net_if *iface, int status) sizeof(struct wifi_status)); } +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_ROAMING +static int wifi_start_roaming(uint32_t mgmt_request, struct net_if *iface, + void *data, size_t len) +{ + const struct device *dev = net_if_get_device(iface); + const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_api(iface); + + if (roaming_params.is_11r_used) { + if (wifi_mgmt_api == NULL || + wifi_mgmt_api->start_11r_roaming == NULL) { + return -ENOTSUP; + } + + return wifi_mgmt_api->start_11r_roaming(dev); + } else if (roaming_params.is_11k_enabled) { + memset(&roaming_params.neighbor_rep, 0x0, sizeof(roaming_params.neighbor_rep)); + if (wifi_mgmt_api == NULL + || wifi_mgmt_api->send_11k_neighbor_request == NULL) { + return -ENOTSUP; + } + + return wifi_mgmt_api->send_11k_neighbor_request(dev, NULL); + } else if (wifi_mgmt_api == NULL || wifi_mgmt_api->btm_query == NULL) { + return -ENOTSUP; + } + + return wifi_mgmt_api->btm_query(dev, 0x10); +} + +NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_START_ROAMING, wifi_start_roaming); + +static int wifi_neighbor_rep_complete(uint32_t mgmt_request, struct net_if *iface, + void *data, size_t len) +{ + const struct device *dev = net_if_get_device(iface); + const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_api(iface); + struct wifi_scan_params params = {0}; + + for (int i = 0; i < roaming_params.neighbor_rep.neighbor_cnt; i++) { + params.band_chan[i].channel = roaming_params.neighbor_rep.neighbor_ap[i].channel; + if (params.band_chan[i].channel > 14) { + params.band_chan[i].band = WIFI_FREQ_BAND_5_GHZ; + } else { + params.band_chan[i].band = WIFI_FREQ_BAND_2_4_GHZ; + } + } + if (wifi_mgmt_api == NULL || wifi_mgmt_api->candidate_scan == NULL) { + return -ENOTSUP; + } + + return wifi_mgmt_api->candidate_scan(dev, ¶ms); +} + +NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_NEIGHBOR_REP_COMPLETE, + wifi_neighbor_rep_complete); + +void wifi_mgmt_raise_neighbor_rep_recv_event(struct net_if *iface, char *inbuf, size_t buf_len) +{ + const uint8_t *buf = inbuf; + char event[MAX_EVENT_STR_LEN] = {0}; + char bssid[WIFI_SSID_MAX_LEN] = {0}; + char bssid_info[WIFI_SSID_MAX_LEN] = {0}; + int op_class, channel, phy_type; + int idx = roaming_params.neighbor_rep.neighbor_cnt; + + if (!buf || buf[0] == '\0') { + return; + } + if (sscanf(buf, "%s bssid=%s info=%s op_class=%d chan=%d phy_type=%d", + event, bssid, bssid_info, &op_class, &channel, &phy_type) == 6) { + int i; + int match = 0; + size_t len = 0; + + for (i = 0; i < roaming_params.neighbor_rep.neighbor_cnt; i++) { + if (strncmp((const char *)roaming_params.neighbor_rep.neighbor_ap[i].bssid, + bssid, sizeof(bssid)) == 0) { + match = 1; + break; + } + + if (roaming_params.neighbor_rep.neighbor_ap[i].channel == channel) { + match = 1; + break; + } + } + if (!match && (roaming_params.neighbor_rep.neighbor_cnt < MAX_NEIGHBOR_AP_LIMIT)) { + strncpy((char *)roaming_params.neighbor_rep.neighbor_ap[idx].bssid, + bssid, sizeof(roaming_params.neighbor_rep.neighbor_ap[idx].bssid)); + len = strnlen(bssid, sizeof(bssid) - 1); + roaming_params.neighbor_rep.neighbor_ap[idx].bssid[len] = (uint8_t)'\0'; + + strncpy((char *)roaming_params.neighbor_rep.neighbor_ap[idx].bssid_info, + (bssid_info), + sizeof(roaming_params.neighbor_rep.neighbor_ap->bssid_info)); + len = strnlen(bssid_info, sizeof(bssid_info) - 1); + roaming_params.neighbor_rep.neighbor_ap[idx].bssid_info[len] = + (uint8_t)'\0'; + + roaming_params.neighbor_rep.neighbor_ap[idx].channel = channel; + roaming_params.neighbor_rep.neighbor_ap[idx].op_class = op_class; + roaming_params.neighbor_rep.neighbor_ap[idx].phy_type = phy_type; + + roaming_params.neighbor_rep.neighbor_cnt += 1; + } else if (match) { + LOG_INF("BSSID already present in neighbor list, Skipping %s ", + bssid); + } else { + LOG_INF("Maximum neighbors added to list, Skipping."); + } + } else { + LOG_INF("Failed to Parse Neighbor Report - Skipping entry\n"); + } +} +#endif + static int wifi_ap_enable(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) { @@ -566,6 +722,10 @@ static int wifi_11k_cfg(uint32_t mgmt_request, struct net_if *iface, return -ENOTSUP; } +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_ROAMING + roaming_params.is_11k_enabled = params->enable_11k; +#endif + return wifi_mgmt_api->cfg_11k(dev, params); } diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 1918797cd8c32..77b2debe3550e 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -463,6 +463,38 @@ static void handle_wifi_ap_sta_disconnected(struct net_mgmt_event_callback *cb) k_mutex_unlock(&wifi_ap_sta_list_lock); } +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_ROAMING +static void handle_wifi_signal_change(struct net_mgmt_event_callback *cb) +{ + struct net_if *iface = net_if_get_wifi_sta(); + const struct shell *sh = context.sh; + int ret; + + ret = net_mgmt(NET_REQUEST_WIFI_START_ROAMING, iface, NULL, 0); + if (ret) { + PR_WARNING("Start roaming failed\n"); + return; + } + + PR("Start roaming requested\n"); +} + +static void handle_wifi_neighbor_rep_complete(struct net_mgmt_event_callback *cb) +{ + struct net_if *iface = net_if_get_wifi_sta(); + const struct shell *sh = context.sh; + int ret; + + ret = net_mgmt(NET_REQUEST_WIFI_NEIGHBOR_REP_COMPLETE, iface, NULL, 0); + if (ret) { + PR_WARNING("Neighbor report complete failed\n"); + return; + } + + PR("Neighbor report complete requested\n"); +} +#endif + static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface) { @@ -499,6 +531,14 @@ static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, case NET_EVENT_WIFI_AP_STA_DISCONNECTED: handle_wifi_ap_sta_disconnected(cb); break; +#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_ROAMING + case NET_EVENT_WIFI_SIGNAL_CHANGE: + handle_wifi_signal_change(cb); + break; + case NET_EVENT_WIFI_NEIGHBOR_REP_COMP: + handle_wifi_neighbor_rep_complete(cb); + break; +#endif default: break; } From aaebe38db9f76a3b304ed111b242dde41d212656 Mon Sep 17 00:00:00 2001 From: Hui Bai Date: Thu, 19 Sep 2024 10:43:59 +0800 Subject: [PATCH 1734/4482] net: Increase net_mgmt task priority Originally, the net_mgmt task priority is very low. Based on roaming implementation, roaming is triggered in net_mgmt task. When running UDP test while doing roaming, the net_mgmt task won't have much chance to run and roaming can't be triggered. Increase it to 3, which is same value of supplicant task. Signed-off-by: Hui Bai --- samples/net/wifi/boards/frdm_rw612.conf | 2 ++ samples/net/wifi/boards/rd_rw612_bga.conf | 2 ++ subsys/net/ip/Kconfig.mgmt | 10 ++++++++++ subsys/net/ip/net_mgmt.c | 4 +++- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/samples/net/wifi/boards/frdm_rw612.conf b/samples/net/wifi/boards/frdm_rw612.conf index 6094632aca077..87de6bc8dbdee 100644 --- a/samples/net/wifi/boards/frdm_rw612.conf +++ b/samples/net/wifi/boards/frdm_rw612.conf @@ -75,6 +75,8 @@ CONFIG_ZPERF_WORK_Q_THREAD_PRIORITY=3 CONFIG_NET_SOCKETS_SERVICE_THREAD_PRIO=3 CONFIG_NET_TC_SKIP_FOR_HIGH_PRIO=y CONFIG_NET_CONTEXT_PRIORITY=y +CONFIG_NET_MGMT_THREAD_PRIO_CUSTOM=y +CONFIG_NET_MGMT_THREAD_PRIORITY=3 CONFIG_WIFI_NM_WPA_SUPPLICANT=y CONFIG_WIFI_NM_WPA_SUPPLICANT_CLI=y diff --git a/samples/net/wifi/boards/rd_rw612_bga.conf b/samples/net/wifi/boards/rd_rw612_bga.conf index a5a1bc1961f41..633137e3fb02d 100644 --- a/samples/net/wifi/boards/rd_rw612_bga.conf +++ b/samples/net/wifi/boards/rd_rw612_bga.conf @@ -74,6 +74,8 @@ CONFIG_ZPERF_WORK_Q_THREAD_PRIORITY=3 CONFIG_NET_SOCKETS_SERVICE_THREAD_PRIO=3 CONFIG_NET_TC_SKIP_FOR_HIGH_PRIO=y CONFIG_NET_CONTEXT_PRIORITY=y +CONFIG_NET_MGMT_THREAD_PRIO_CUSTOM=y +CONFIG_NET_MGMT_THREAD_PRIORITY=3 CONFIG_WIFI_NM_WPA_SUPPLICANT=y CONFIG_WIFI_NM_WPA_SUPPLICANT_CLI=y diff --git a/subsys/net/ip/Kconfig.mgmt b/subsys/net/ip/Kconfig.mgmt index c84dd8f239832..4ca57e4c8e5ee 100644 --- a/subsys/net/ip/Kconfig.mgmt +++ b/subsys/net/ip/Kconfig.mgmt @@ -133,4 +133,14 @@ config NET_DEBUG_MGMT_EVENT_STACK help Add debug messages output on how much Net MGMT event stack is used. +config NET_MGMT_THREAD_PRIO_CUSTOM + bool "Customize net mgmt thread priority" + +if NET_MGMT_THREAD_PRIO_CUSTOM +config NET_MGMT_THREAD_PRIORITY + int "Priority of net_mgmt thread" + default NUM_PREEMPT_PRIORITIES + +endif # NET_MGMT_THREAD_PRIO_CUSTOM + endif # NET_MGMT_EVENT diff --git a/subsys/net/ip/net_mgmt.c b/subsys/net/ip/net_mgmt.c index 3c073040f0910..4fbc1a1b59973 100644 --- a/subsys/net/ip/net_mgmt.c +++ b/subsys/net/ip/net_mgmt.c @@ -413,7 +413,9 @@ void net_mgmt_event_init(void) mgmt_rebuild_global_event_mask(); #if defined(CONFIG_NET_MGMT_EVENT_THREAD) -#if defined(CONFIG_NET_TC_THREAD_COOPERATIVE) +#if defined(CONFIG_NET_MGMT_THREAD_PRIO_CUSTOM) +#define THREAD_PRIORITY CONFIG_NET_MGMT_THREAD_PRIORITY +#elif defined(CONFIG_NET_TC_THREAD_COOPERATIVE) /* Lowest priority cooperative thread */ #define THREAD_PRIORITY K_PRIO_COOP(CONFIG_NUM_COOP_PRIORITIES - 1) #else From 14d08ccbc37f4bce3107abde6d105b15042bde1b Mon Sep 17 00:00:00 2001 From: Hui Bai Date: Thu, 19 Sep 2024 14:36:00 +0800 Subject: [PATCH 1735/4482] manifest: Update hostap repo Update hostap repo in west.yml Signed-off-by: Hui Bai --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 60cdb99d385c4..ce14009c668d9 100644 --- a/west.yml +++ b/west.yml @@ -259,7 +259,7 @@ manifest: - hal - name: hostap path: modules/lib/hostap - revision: e481fe559e17052ec8ea04388a934f3d30816737 + revision: c533ab18dcf71795dcee61f4d2598ae31098f731 - name: libmetal revision: a6851ba6dba8c9e87d00c42f171a822f7a29639b path: modules/hal/libmetal From 71b9d8ad661c00130b54cec7e918b99609c35777 Mon Sep 17 00:00:00 2001 From: Hui Bai Date: Thu, 24 Oct 2024 10:33:14 +0200 Subject: [PATCH 1736/4482] hostap: More fixes to crypto=none compilation The aes_unwrap() and aes_decrypt() functions were missing if CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE is enabled. Add missing C files to fix this. Signed-off-by: Hui Bai --- modules/hostap/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/hostap/CMakeLists.txt b/modules/hostap/CMakeLists.txt index a3bfdc84e14d2..79fec27841d58 100644 --- a/modules/hostap/CMakeLists.txt +++ b/modules/hostap/CMakeLists.txt @@ -251,8 +251,10 @@ zephyr_library_sources_ifdef(CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_NONE # FIXME: why do we need these when crypto is not selected? ${HOSTAP_SRC_BASE}/crypto/aes-wrap.c + ${HOSTAP_SRC_BASE}/crypto/aes-unwrap.c ${HOSTAP_SRC_BASE}/crypto/aes-internal.c ${HOSTAP_SRC_BASE}/crypto/aes-internal-enc.c + ${HOSTAP_SRC_BASE}/crypto/aes-internal-dec.c ${HOSTAP_SRC_BASE}/crypto/aes-omac1.c ${HOSTAP_SRC_BASE}/crypto/md5.c ${HOSTAP_SRC_BASE}/crypto/md5-internal.c From 98805a29f5379103a9645aae862f8d00298a1243 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Wed, 9 Oct 2024 12:41:58 +0200 Subject: [PATCH 1737/4482] Bluetooth: BAP: Add BT_AUDIO_RTN_PREF_NONE Add BT_AUDIO_RTN_PREF_NONE which indicates no preference from the server for number of retransmissions chosen by the client. Signed-off-by: Emil Gydesen --- include/zephyr/bluetooth/audio/audio.h | 2 ++ include/zephyr/bluetooth/audio/bap.h | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/zephyr/bluetooth/audio/audio.h b/include/zephyr/bluetooth/audio/audio.h index 1d052e3828398..928e33f88e2f0 100644 --- a/include/zephyr/bluetooth/audio/audio.h +++ b/include/zephyr/bluetooth/audio/audio.h @@ -47,6 +47,8 @@ extern "C" { #define BT_AUDIO_PD_PREF_NONE 0x000000U /** Maximum presentation delay in microseconds */ #define BT_AUDIO_PD_MAX 0xFFFFFFU +/** Indicates that the unicast server does not have a preference for any retransmission number */ +#define BT_AUDIO_RTN_PREF_NONE 0xFFU /** Maximum size of the broadcast code in octets */ #define BT_AUDIO_BROADCAST_CODE_SIZE 16 diff --git a/include/zephyr/bluetooth/audio/bap.h b/include/zephyr/bluetooth/audio/bap.h index c9c8d4fdf439c..73433035e823a 100644 --- a/include/zephyr/bluetooth/audio/bap.h +++ b/include/zephyr/bluetooth/audio/bap.h @@ -260,7 +260,11 @@ struct bt_bap_qos_cfg_pref { */ uint8_t phy; - /** Preferred Retransmission Number */ + /** + * @brief Preferred Retransmission Number + * + * @ref BT_AUDIO_RTN_PREF_NONE indicates no preference. + */ uint8_t rtn; /** From 88de2711caa357bc8b6d279b3675eb7b279fbf5c Mon Sep 17 00:00:00 2001 From: Sungwoo Kim Date: Thu, 10 Oct 2024 00:36:37 +0000 Subject: [PATCH 1738/4482] Bluetooth: userchan: fix buffer overflow in hci_packet_complete() hci_packet_complete(buf, buf_size) should check whether buf_size is enough. For instance, hci_packet_complete can receive buf with buf_size 1, leading to the buffer overflow in cmd->param_len, which is buf[3]. This can happen when rx_thread() receives two frames in 512 bytes and the first frame size is 511. Then, rx_thread() will call hci_packet_complete() with 1. ==5==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000000ad81c2 at pc 0x0000005279b3 bp 0x7fffe74f5b70 sp 0x7fffe74f5b68 READ of size 2 at 0x000000ad81c2 thread T6 #0 0x5279b2 (/root/zephyr.exe+0x5279b2) #1 0x4d697d (/root/zephyr.exe+0x4d697d) #2 0x7ffff60e5daa (/lib/x86_64-linux-gnu/libc.so.6+0x89daa) (BuildId: 2e01923fea4ad9f7fa50fe24e0f3385a45a6cd1c) 0x000000ad81c2 is located 2 bytes to the right of global variable 'rx_thread.frame' defined in 'zephyr/drivers/bluetooth/hci/userchan.c' (0xad7fc0) of size 512 SUMMARY: AddressSanitizer: global-buffer-overflow (/root/zephyr.exe+0x5279b2) Thread T6 created by T2 here: #0 0x48c17c (/root/zephyr.exe+0x48c17c) #1 0x530192 (/root/zephyr.exe+0x530192) #2 0x4dcc22 (/root/zephyr.exe+0x4dcc22) Thread T2 created by T1 here: #0 0x48c17c (/root/zephyr.exe+0x48c17c) #1 0x530192 (/root/zephyr.exe+0x530192) #2 0x4dcc22 (/root/zephyr.exe+0x4dcc22) Thread T1 created by T0 here: #0 0x48c17c (/root/zephyr.exe+0x48c17c) #1 0x52f36c (/root/zephyr.exe+0x52f36c) #2 0x5371dc (/root/zephyr.exe+0x5371dc) #3 0x5312a6 (/root/zephyr.exe+0x5312a6) #4 0x52ed7b (/root/zephyr.exe+0x52ed7b) #5 0x52eddd (/root/zephyr.exe+0x52eddd) #6 0x7ffff6083c89 (/lib/x86_64-linux-gnu/libc.so.6+0x27c89) (BuildId: 2e01923fea4ad9f7fa50fe24e0f3385a45a6cd1c) ==5==ABORTING Signed-off-by: Sungwoo Kim --- drivers/bluetooth/hci/userchan.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/hci/userchan.c b/drivers/bluetooth/hci/userchan.c index b3d401960df11..aedb71a8430c5 100644 --- a/drivers/bluetooth/hci/userchan.c +++ b/drivers/bluetooth/hci/userchan.c @@ -111,6 +111,9 @@ static int32_t hci_packet_complete(const uint8_t *buf, uint16_t buf_len) switch (type) { case BT_HCI_H4_CMD: { + if (buf_len < header_len + BT_HCI_CMD_HDR_SIZE) { + return 0; + } const struct bt_hci_cmd_hdr *cmd = (const struct bt_hci_cmd_hdr *)hdr; /* Parameter Total Length */ @@ -119,6 +122,9 @@ static int32_t hci_packet_complete(const uint8_t *buf, uint16_t buf_len) break; } case BT_HCI_H4_ACL: { + if (buf_len < header_len + BT_HCI_ACL_HDR_SIZE) { + return 0; + } const struct bt_hci_acl_hdr *acl = (const struct bt_hci_acl_hdr *)hdr; /* Data Total Length */ @@ -127,6 +133,9 @@ static int32_t hci_packet_complete(const uint8_t *buf, uint16_t buf_len) break; } case BT_HCI_H4_SCO: { + if (buf_len < header_len + BT_HCI_SCO_HDR_SIZE) { + return 0; + } const struct bt_hci_sco_hdr *sco = (const struct bt_hci_sco_hdr *)hdr; /* Data_Total_Length */ @@ -135,6 +144,9 @@ static int32_t hci_packet_complete(const uint8_t *buf, uint16_t buf_len) break; } case BT_HCI_H4_EVT: { + if (buf_len < header_len + BT_HCI_EVT_HDR_SIZE) { + return 0; + } const struct bt_hci_evt_hdr *evt = (const struct bt_hci_evt_hdr *)hdr; /* Parameter Total Length */ @@ -143,6 +155,9 @@ static int32_t hci_packet_complete(const uint8_t *buf, uint16_t buf_len) break; } case BT_HCI_H4_ISO: { + if (buf_len < header_len + BT_HCI_ISO_HDR_SIZE) { + return 0; + } const struct bt_hci_iso_hdr *iso = (const struct bt_hci_iso_hdr *)hdr; /* ISO_Data_Load_Length parameter */ @@ -157,7 +172,7 @@ static int32_t hci_packet_complete(const uint8_t *buf, uint16_t buf_len) } /* Request more data */ - if (buf_len < header_len || buf_len - header_len < payload_len) { + if (buf_len < header_len + payload_len) { return 0; } From 474d4c3249c190b3261bc128ec1847e0a4f7b176 Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Thu, 17 Oct 2024 12:28:03 +0200 Subject: [PATCH 1739/4482] arch: arm: cortex_m: pm_s2ram: Rework S2RAM mark functions The S2RAM procedure requires marker checking after reset. Such checking is performed on very early stage of the system initialization and must ensure that the stack is not used due to the TLS pointer which is not initialized yet. Signed-off-by: Adam Kondraciuk --- arch/arm/core/cortex_m/pm_s2ram.S | 23 +++++++-------- arch/arm/core/cortex_m/pm_s2ram.c | 40 +++++++++++++++++++++------ include/zephyr/arch/common/pm_s2ram.h | 10 +++++++ 3 files changed, 54 insertions(+), 19 deletions(-) diff --git a/arch/arm/core/cortex_m/pm_s2ram.S b/arch/arm/core/cortex_m/pm_s2ram.S index f9c82b4069b62..27c2a1e96a71a 100644 --- a/arch/arm/core/cortex_m/pm_s2ram.S +++ b/arch/arm/core/cortex_m/pm_s2ram.S @@ -70,7 +70,9 @@ SECTION_FUNC(TEXT, arch_pm_s2ram_suspend) /* * Mark entering suspend to RAM. */ - bl pm_s2ram_mark_set + mov r1, lr + bl pm_s2ram_mark_set + mov lr, r1 /* * Call the system_off function passed as parameter. This should never @@ -86,7 +88,9 @@ SECTION_FUNC(TEXT, arch_pm_s2ram_suspend) /* * Reset the marking of suspend to RAM, return is ignored. */ - bl pm_s2ram_mark_check_and_clear + mov r1, lr + bl pm_s2ram_mark_check_and_clear + mov lr, r1 /* Move system_off back to r0 as return value */ mov r0, r4 @@ -99,16 +103,13 @@ GTEXT(arch_pm_s2ram_resume) SECTION_FUNC(TEXT, arch_pm_s2ram_resume) /* * Check if reset occurred after suspending to RAM. - * Store LR to ensure we can continue boot when we are not suspended - * to RAM. In addition to LR, R0 is pushed too, to ensure "SP mod 8 = 0", - * as stated by ARM rule 6.2.1.2 for AAPCS32. */ - push {r0, lr} - bl pm_s2ram_mark_check_and_clear - cmp r0, #0x1 - pop {r0, lr} - beq resume - bx lr + mov r1, lr + bl pm_s2ram_mark_check_and_clear + mov lr, r1 + cmp r0, #0x1 + beq resume + bx lr resume: /* diff --git a/arch/arm/core/cortex_m/pm_s2ram.c b/arch/arm/core/cortex_m/pm_s2ram.c index 2657d48dc32a1..b7fe5d9b62601 100644 --- a/arch/arm/core/cortex_m/pm_s2ram.c +++ b/arch/arm/core/cortex_m/pm_s2ram.c @@ -22,20 +22,44 @@ __noinit _cpu_context_t _cpu_context; */ static __noinit uint32_t marker; -void pm_s2ram_mark_set(void) +void __attribute__((naked)) pm_s2ram_mark_set(void) { - marker = MAGIC; + __asm__ volatile( + /* Set the marker to MAGIC value */ + "str %[_magic_val], [%[_marker]]\n" + + "bx lr\n" + : + : [_magic_val] "r"(MAGIC), [_marker] "r"(&marker) + : "r1", "r4", "memory"); } -bool pm_s2ram_mark_check_and_clear(void) +bool __attribute__((naked)) pm_s2ram_mark_check_and_clear(void) { - if (marker == MAGIC) { - marker = 0; + __asm__ volatile( + /* Set return value to 0 */ + "mov r0, #0\n" + + /* Check the marker */ + "ldr r3, [%[_marker]]\n" + "cmp r3, %[_magic_val]\n" + "bne exit\n" + + /* + * Reset the marker + */ + "str r0, [%[_marker]]\n" - return true; - } + /* + * Set return value to 1 + */ + "mov r0, #1\n" - return false; + "exit:\n" + "bx lr\n" + : + : [_magic_val] "r"(MAGIC), [_marker] "r"(&marker) + : "r0", "r1", "r3", "r4", "memory"); } #endif /* CONFIG_PM_S2RAM_CUSTOM_MARKING */ diff --git a/include/zephyr/arch/common/pm_s2ram.h b/include/zephyr/arch/common/pm_s2ram.h index 34c544c769b9b..ad9ab8ad7a401 100644 --- a/include/zephyr/arch/common/pm_s2ram.h +++ b/include/zephyr/arch/common/pm_s2ram.h @@ -65,6 +65,11 @@ int arch_pm_s2ram_suspend(pm_s2ram_system_off_fn_t system_off); * * Default implementation is setting a magic word in RAM. CONFIG_PM_S2RAM_CUSTOM_MARKING * allows custom implementation. + * The following requirements must be fulfilled: + * - the function cannot use stack (asm function or function with 'naked' attribute) + * - the content of the R1 and R4 registers must remain unchanged + * - returning from the function should be performed with the `bx lr` instruction + * */ void pm_s2ram_mark_set(void); @@ -76,6 +81,11 @@ void pm_s2ram_mark_set(void); * * Default implementation is checking a magic word in RAM. CONFIG_PM_S2RAM_CUSTOM_MARKING * allows custom implementation. + * The following requirements must be fulfilled: + * - the function cannot use stack (most likely asm function) + * - the content of the R1 and R4 registers must remain unchanged + * - the function's return value is passed by R0 register + * - returning from the function should be performed with the `bx lr` instruction * * @retval true if marking is found which indicates resuming after suspend-to-RAM. * @retval false if marking is not found which indicates standard boot. From 59629d0039b053dd96b27c7c366e892e8d9fc7e5 Mon Sep 17 00:00:00 2001 From: Adam Kondraciuk Date: Thu, 24 Oct 2024 14:45:28 +0200 Subject: [PATCH 1740/4482] soc: nordic: s2ram: Align s2ram marking procedures Rework Nordic specific S2RAM marking procedures. The S2RAM marking procedures must not disrupt the stack due to the TLS pointer not yet being initialized during their execution. Signed-off-by: Adam Kondraciuk --- soc/nordic/nrf54h/pm_s2ram.c | 49 ++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/soc/nordic/nrf54h/pm_s2ram.c b/soc/nordic/nrf54h/pm_s2ram.c index 10cdd36a7621b..88529c4bb755b 100644 --- a/soc/nordic/nrf54h/pm_s2ram.c +++ b/soc/nordic/nrf54h/pm_s2ram.c @@ -127,25 +127,48 @@ int soc_s2ram_suspend(pm_s2ram_system_off_fn_t system_off) return ret; } -void pm_s2ram_mark_set(void) +void __attribute__((naked)) pm_s2ram_mark_set(void) { /* empty */ + __asm__ volatile("bx lr\n"); } -bool pm_s2ram_mark_check_and_clear(void) +bool __attribute__((naked)) pm_s2ram_mark_check_and_clear(void) { - bool unretained_wake; - bool restore_valid; - uint32_t reset_reason = nrf_resetinfo_resetreas_local_get(NRF_RESETINFO); + __asm__ volatile( + /* Set return value to 0 */ + "mov r0, #0\n" - if (reset_reason != NRF_RESETINFO_RESETREAS_LOCAL_UNRETAINED_MASK) { - return false; - } - unretained_wake = reset_reason & NRF_RESETINFO_RESETREAS_LOCAL_UNRETAINED_MASK; - nrf_resetinfo_resetreas_local_set(NRF_RESETINFO, 0); + /* Load and check RESETREAS register */ + "ldr r3, [%[resetinfo_addr], %[resetreas_offs]]\n" + "cmp r3, %[resetreas_unretained_mask]\n" + + "bne exit\n" + + /* Clear RESETREAS register */ + "str r0, [%[resetinfo_addr], %[resetreas_offs]]\n" + + /* Load RESTOREVALID register */ + "ldr r3, [%[resetinfo_addr], %[restorevalid_offs]]\n" + + /* Clear RESTOREVALID */ + "str r0, [%[resetinfo_addr], %[restorevalid_offs]]\n" + + /* Check RESTOREVALID register */ + "cmp r3, %[restorevalid_present_mask]\n" + "bne exit\n" + + /* Set return value to 1 */ + "mov r0, #1\n" - restore_valid = nrf_resetinfo_restore_valid_check(NRF_RESETINFO); - nrf_resetinfo_restore_valid_set(NRF_RESETINFO, false); + "exit:\n" + "bx lr\n" + : + : [resetinfo_addr] "r"(NRF_RESETINFO), + [resetreas_offs] "r"(offsetof(NRF_RESETINFO_Type, RESETREAS.LOCAL)), + [resetreas_unretained_mask] "r"(NRF_RESETINFO_RESETREAS_LOCAL_UNRETAINED_MASK), + [restorevalid_offs] "r"(offsetof(NRF_RESETINFO_Type, RESTOREVALID)), + [restorevalid_present_mask] "r"(RESETINFO_RESTOREVALID_RESTOREVALID_Msk) - return (unretained_wake & restore_valid) ? true : false; + : "r0", "r1", "r3", "r4", "memory"); } From 62d706e3b3f1c03c624d93e5469d6e0c3292470e Mon Sep 17 00:00:00 2001 From: Ian Morris Date: Fri, 18 Oct 2024 11:30:43 -0700 Subject: [PATCH 1741/4482] dts: arm: renesas: ra: ra6: added missing io ports Additional IO ports (6,7 and 8) are availble on the r7fa6m4af3cfb variant of the RA6M4 Microcontroller. Signed-off-by: Ian Morris --- dts/arm/renesas/ra/ra6/r7fa6m4af3cfb.dtsi | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/dts/arm/renesas/ra/ra6/r7fa6m4af3cfb.dtsi b/dts/arm/renesas/ra/ra6/r7fa6m4af3cfb.dtsi index 4ab1124d5f7b0..50810cdb5f1d5 100644 --- a/dts/arm/renesas/ra/ra6/r7fa6m4af3cfb.dtsi +++ b/dts/arm/renesas/ra/ra6/r7fa6m4af3cfb.dtsi @@ -18,5 +18,35 @@ reg = <0x0 DT_SIZE_M(1)>; }; }; + + ioport6: gpio@400800c0 { + compatible = "renesas,ra-gpio-ioport"; + reg = <0x400800c0 0x20>; + port = <6>; + gpio-controller; + #gpio-cells = <2>; + ngpios = <16>; + status = "disabled"; + }; + + ioport7: gpio@400800e0 { + compatible = "renesas,ra-gpio-ioport"; + reg = <0x400800e0 0x20>; + port = <7>; + gpio-controller; + #gpio-cells = <2>; + ngpios = <16>; + status = "disabled"; + }; + + ioport8: gpio@40080100 { + compatible = "renesas,ra-gpio-ioport"; + reg = <0x40080100 0x20>; + port = <8>; + gpio-controller; + #gpio-cells = <2>; + ngpios = <16>; + status = "disabled"; + }; }; }; From 973ba91487ca2800a3ec807d55bf4eb96ede0ba0 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Sun, 20 Oct 2024 10:22:50 +0100 Subject: [PATCH 1742/4482] mgmt: mcumgr: transport: Add LoRaWAN MCUmgr SMP transport Adds a transport that uses LoRaWAN for receiving and responding to messages Signed-off-by: Jamie McCrae --- include/zephyr/mgmt/mcumgr/transport/smp.h | 2 + subsys/mgmt/mcumgr/transport/CMakeLists.txt | 3 + subsys/mgmt/mcumgr/transport/Kconfig | 2 + subsys/mgmt/mcumgr/transport/Kconfig.lorawan | 93 ++++++ .../mgmt/mcumgr/transport/src/smp_lorawan.c | 267 ++++++++++++++++++ 5 files changed, 367 insertions(+) create mode 100644 subsys/mgmt/mcumgr/transport/Kconfig.lorawan create mode 100644 subsys/mgmt/mcumgr/transport/src/smp_lorawan.c diff --git a/include/zephyr/mgmt/mcumgr/transport/smp.h b/include/zephyr/mgmt/mcumgr/transport/smp.h index d8cec6878f796..38aa1b0e0c22c 100644 --- a/include/zephyr/mgmt/mcumgr/transport/smp.h +++ b/include/zephyr/mgmt/mcumgr/transport/smp.h @@ -148,6 +148,8 @@ enum smp_transport_type { SMP_UDP_IPV4_TRANSPORT, /** SMP UDP IPv6 */ SMP_UDP_IPV6_TRANSPORT, + /** SMP LoRaWAN */ + SMP_LORAWAN_TRANSPORT, /** SMP user defined type */ SMP_USER_DEFINED_TRANSPORT }; diff --git a/subsys/mgmt/mcumgr/transport/CMakeLists.txt b/subsys/mgmt/mcumgr/transport/CMakeLists.txt index 2d8ea3e6d87ae..871fab1ecd09a 100644 --- a/subsys/mgmt/mcumgr/transport/CMakeLists.txt +++ b/subsys/mgmt/mcumgr/transport/CMakeLists.txt @@ -25,6 +25,9 @@ zephyr_library_sources_ifdef(CONFIG_MCUMGR_TRANSPORT_UART zephyr_library_sources_ifdef(CONFIG_MCUMGR_TRANSPORT_UDP src/smp_udp.c ) +zephyr_library_sources_ifdef(CONFIG_MCUMGR_TRANSPORT_LORAWAN + src/smp_lorawan.c +) zephyr_library_sources_ifdef(CONFIG_MCUMGR_TRANSPORT_DUMMY src/smp_dummy.c ) diff --git a/subsys/mgmt/mcumgr/transport/Kconfig b/subsys/mgmt/mcumgr/transport/Kconfig index 3d99fb33ccf4d..a892caee8d6b6 100644 --- a/subsys/mgmt/mcumgr/transport/Kconfig +++ b/subsys/mgmt/mcumgr/transport/Kconfig @@ -77,6 +77,8 @@ rsource "Kconfig.dummy" rsource "Kconfig.bluetooth" +rsource "Kconfig.lorawan" + rsource "Kconfig.shell" rsource "Kconfig.uart" diff --git a/subsys/mgmt/mcumgr/transport/Kconfig.lorawan b/subsys/mgmt/mcumgr/transport/Kconfig.lorawan new file mode 100644 index 0000000000000..a9dcc80d9f595 --- /dev/null +++ b/subsys/mgmt/mcumgr/transport/Kconfig.lorawan @@ -0,0 +1,93 @@ +# +# Copyright (c) 2024, Jamie McCrae +# +# SPDX-License-Identifier: Apache-2.0 +# + +# The Kconfig file is dedicated to the LoRaWAN transport of MCUmgr +# subsystem and provides Kconfig options to control aspects of +# the transport. +# +# Options defined in this file should be prefixed: +# MCUMGR_TRANSPORT_LORAWAN_ + +menuconfig MCUMGR_TRANSPORT_LORAWAN + bool "LoRaWAN MCUmgr SMP transport" + depends on LORAWAN + help + Enables handling of SMP commands received over LoRaWAN. + +if MCUMGR_TRANSPORT_LORAWAN + +config MCUMGR_TRANSPORT_LORAWAN_FRAME_PORT + int "LoRaWAN SMP frame port" + range 1 223 + default 2 + help + LoRaWAN download and uplink frame port used for communication. All messages received on + this port will be treated as SMP packets. + +config MCUMGR_TRANSPORT_LORAWAN_CONFIRMED_UPLINKS + bool "Use confirmed packets for uplinks" + default y + help + Will use confirmed uplink packets for responses if enabled, otherwise will use + unconfirmed packets. + +config MCUMGR_TRANSPORT_LORAWAN_REASSEMBLY + bool "Reassemble LoRaWAN SMP messages" + select MCUMGR_TRANSPORT_REASSEMBLY + default y + help + Will reassemble downlink LoRaWAN messages together to allow for messages larger than a + single message to be received, otherwise will support messages up to a single packet in + size. + +menuconfig MCUMGR_TRANSPORT_LORAWAN_POLL_FOR_DATA + bool "Send empty packet if partial packet received" + depends on MCUMGR_TRANSPORT_LORAWAN_REASSEMBLY + default y + help + Will send an empty packet if a partial (fragmented) message has been received from the + server, this will allow the next packet to be received without waiting for next + transmission window. + + Note: this requires a dedicated thread in order to prevent blocking the system workqueue. + +if MCUMGR_TRANSPORT_LORAWAN_POLL_FOR_DATA + +config MCUMGR_TRANSPORT_LORAWAN_POLL_FOR_DATA_STACK_SIZE + int "Poll thread stack size" + default 1800 + help + Stack size of the thread that will poll for empty additional packets when a partial + frame is received. + +config MCUMGR_TRANSPORT_LORAWAN_POLL_FOR_DATA_THREAD_PRIORITY + int "Poll thread priority" + default 3 + help + Priority of the thread for polling for empty additional packets when a partial frame + is received. + +config MCUMGR_TRANSPORT_LORAWAN_POLL_FOR_DATA_RETRIES + int "Poll thread retries" + default 3 + help + Number of LoRaWAN message send retries if sending fails for the thread for polling for + empty additional packets when a partial frame is received. + +endif # MCUMGR_TRANSPORT_LORAWAN_POLL_FOR_DATA + +config MCUMGR_TRANSPORT_LORAWAN_FRAGMENTED_UPLINKS + bool "Fragment uplink messages" + default y + help + Will fragment messages into multiple uplink messages if they are too big to fit into a + single uplink message. If disabled then uplinks that are too large will not be sent. + +module = MCUMGR_TRANSPORT_LORAWAN +module-str = LoRaWAN MCUmgr SMP transport +source "subsys/logging/Kconfig.template.log_config" + +endif # MCUMGR_TRANSPORT_LORAWAN diff --git a/subsys/mgmt/mcumgr/transport/src/smp_lorawan.c b/subsys/mgmt/mcumgr/transport/src/smp_lorawan.c new file mode 100644 index 0000000000000..7e5864500f1b1 --- /dev/null +++ b/subsys/mgmt/mcumgr/transport/src/smp_lorawan.c @@ -0,0 +1,267 @@ +/* + * Copyright (c) 2024, Jamie McCrae + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +LOG_MODULE_REGISTER(smp_lorawan, CONFIG_MCUMGR_TRANSPORT_LORAWAN_LOG_LEVEL); + +static void smp_lorawan_downlink(uint8_t port, bool data_pending, int16_t rssi, int8_t snr, + uint8_t len, const uint8_t *hex_data); + +static int smp_lorawan_uplink(struct net_buf *nb); + +static uint16_t smp_lorawan_get_mtu(const struct net_buf *nb); + +static struct lorawan_downlink_cb lorawan_smp_downlink_cb = { + .port = CONFIG_MCUMGR_TRANSPORT_LORAWAN_FRAME_PORT, + .cb = smp_lorawan_downlink, +}; + +struct smp_transport smp_lorawan_transport = { + .functions.output = smp_lorawan_uplink, + .functions.get_mtu = smp_lorawan_get_mtu, +}; + +#ifdef CONFIG_SMP_CLIENT +struct smp_client_transport_entry smp_lorawan_client_transport = { + .smpt = &smp_lorawan_transport, + .smpt_type = SMP_LORAWAN_TRANSPORT, +}; +#endif + +#ifdef CONFIG_MCUMGR_TRANSPORT_LORAWAN_POLL_FOR_DATA +static struct k_thread smp_lorawan_thread; +K_KERNEL_STACK_MEMBER(smp_lorawan_stack, CONFIG_MCUMGR_TRANSPORT_LORAWAN_POLL_FOR_DATA_STACK_SIZE); +K_FIFO_DEFINE(smp_lorawan_fifo); + +struct smp_lorawan_uplink_message_t { + void *fifo_reserved; + struct net_buf *nb; + struct k_sem my_sem; +}; + +static struct smp_lorawan_uplink_message_t empty_message = { + .nb = NULL, +}; + +static void smp_lorawan_uplink_thread(void *p1, void *p2, void *p3) +{ + struct smp_lorawan_uplink_message_t *msg; + + while (1) { + msg = k_fifo_get(&smp_lorawan_fifo, K_FOREVER); + uint16_t size = 0; + uint16_t pos = 0; + + if (msg->nb != NULL) { + size = msg->nb->len; + } + + while (pos < size || size == 0) { + uint8_t *data = NULL; + uint8_t data_size; + uint8_t temp; + uint8_t tries = CONFIG_MCUMGR_TRANSPORT_LORAWAN_POLL_FOR_DATA_RETRIES; + + lorawan_get_payload_sizes(&data_size, &temp); + + if (data_size > size) { + data_size = size; + } + + if (size > 0) { + if ((data_size + pos) > size) { + data_size = size - pos; + } + + data = net_buf_pull_mem(msg->nb, data_size); + } + + while (tries > 0) { + int rc; + + rc = lorawan_send(CONFIG_MCUMGR_TRANSPORT_LORAWAN_FRAME_PORT, + data, data_size, +#if defined(CONFIG_MCUMGR_TRANSPORT_LORAWAN_CONFIRMED_UPLINKS) + LORAWAN_MSG_CONFIRMED +#else + LORAWAN_MSG_UNCONFIRMED +#endif + ); + + if (rc != 0) { + --tries; + } else { + break; + } + } + + if (size == 0) { + break; + } + + pos += data_size; + } + + /* For empty packets, do not trigger semaphore */ + if (size != 0) { + k_sem_give(&msg->my_sem); + } + } +} +#endif + +static void smp_lorawan_downlink(uint8_t port, bool data_pending, int16_t rssi, int8_t snr, + uint8_t len, const uint8_t *hex_data) +{ + ARG_UNUSED(data_pending); + ARG_UNUSED(rssi); + ARG_UNUSED(snr); + + if (port == CONFIG_MCUMGR_TRANSPORT_LORAWAN_FRAME_PORT) { +#ifdef CONFIG_MCUMGR_TRANSPORT_LORAWAN_REASSEMBLY + int rc; + + if (len == 0) { + /* Empty packet is used to clear partially queued data */ + (void)smp_reassembly_drop(&smp_lorawan_transport); + } else { + rc = smp_reassembly_collect(&smp_lorawan_transport, hex_data, len); + + if (rc == 0) { + rc = smp_reassembly_complete(&smp_lorawan_transport, false); + + if (rc) { + LOG_ERR("LoRaWAN SMP reassembly complete failed: %d", rc); + } + } else if (rc < 0) { + LOG_ERR("LoRaWAN SMP reassembly collect failed: %d", rc); + } else { + LOG_ERR("LoRaWAN SMP expected data left: %d", rc); + +#ifdef CONFIG_MCUMGR_TRANSPORT_LORAWAN_POLL_FOR_DATA + /* Send empty LoRaWAN packet to receive next packet from server */ + k_fifo_put(&smp_lorawan_fifo, &empty_message); +#endif + } + } +#else + if (len > sizeof(struct smp_hdr)) { + struct net_buf *nb; + + nb = smp_packet_alloc(); + + if (!nb) { + LOG_ERR("LoRaWAN SMP packet allocation failure"); + return; + } + + net_buf_add_mem(nb, hex_data, len); + smp_rx_req(&smp_lorawan_transport, nb); + } else { + LOG_ERR("Invalid LoRaWAN SMP downlink"); + } +#endif + } else { + LOG_ERR("Invalid LoRaWAN SMP downlink"); + } +} + +static int smp_lorawan_uplink(struct net_buf *nb) +{ + int rc = 0; + +#ifdef CONFIG_MCUMGR_TRANSPORT_LORAWAN_FRAGMENTED_UPLINKS + struct smp_lorawan_uplink_message_t tx_data = { + .nb = nb, + }; + + k_sem_init(&tx_data.my_sem, 0, 1); + k_fifo_put(&smp_lorawan_fifo, &tx_data); + k_sem_take(&tx_data.my_sem, K_FOREVER); +#else + uint8_t data_size; + uint8_t temp; + + lorawan_get_payload_sizes(&data_size, &temp); + + if (nb->len > data_size) { + LOG_ERR("Cannot send LoRaWAN SMP message, too large. Message: %d, maximum: %d", + nb->len, data_size); + } else { + rc = lorawan_send(CONFIG_MCUMGR_TRANSPORT_LORAWAN_FRAME_PORT, nb->data, nb->len, +#if defined(CONFIG_MCUMGR_TRANSPORT_LORAWAN_CONFIRMED_UPLINKS) + LORAWAN_MSG_CONFIRMED +#else + LORAWAN_MSG_UNCONFIRMED +#endif + ); + + if (rc != 0) { + LOG_ERR("Failed to send LoRaWAN SMP message: %d", rc); + } + } +#endif + + smp_packet_free(nb); + + return rc; +} + +static uint16_t smp_lorawan_get_mtu(const struct net_buf *nb) +{ + ARG_UNUSED(nb); + + uint8_t max_data_size; + uint8_t temp; + + lorawan_get_payload_sizes(&max_data_size, &temp); + + return (uint16_t)max_data_size; +} + +static void smp_lorawan_start(void) +{ + int rc; + + rc = smp_transport_init(&smp_lorawan_transport); + +#ifdef CONFIG_SMP_CLIENT + if (rc == 0) { + smp_client_transport_register(&smp_lorawan_client_transport); + } +#endif + + if (rc == 0) { + lorawan_register_downlink_callback(&lorawan_smp_downlink_cb); + } else { + LOG_ERR("Failed to init LoRaWAN MCUmgr SMP transport: %d", rc); + } + +#ifdef CONFIG_MCUMGR_TRANSPORT_LORAWAN_REASSEMBLY + smp_reassembly_init(&smp_lorawan_transport); +#endif + +#ifdef CONFIG_MCUMGR_TRANSPORT_LORAWAN_POLL_FOR_DATA + k_thread_create(&smp_lorawan_thread, smp_lorawan_stack, + K_KERNEL_STACK_SIZEOF(smp_lorawan_stack), + smp_lorawan_uplink_thread, NULL, NULL, NULL, + CONFIG_MCUMGR_TRANSPORT_LORAWAN_POLL_FOR_DATA_THREAD_PRIORITY, 0, + K_FOREVER); + + k_thread_start(&smp_lorawan_thread); +#endif +} + +MCUMGR_HANDLER_DEFINE(smp_lorawan, smp_lorawan_start); From d9312524eb54fa1a03914ff5b921ca6010ea4e5c Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Sun, 20 Oct 2024 10:39:50 +0100 Subject: [PATCH 1743/4482] tests: mgmt: mcumgr: Add transport_lorawan test Adds a test to ensure that the LoRaWAN MCUmgr transport builds with all options enabled and all options disabled Signed-off-by: Jamie McCrae --- .../mcumgr/transport_lorawan/CMakeLists.txt | 15 ++++++++++++++ .../mcumgr/transport_lorawan/lorawan_all.conf | 10 ++++++++++ .../mgmt/mcumgr/transport_lorawan/prj.conf | 20 +++++++++++++++++++ .../mgmt/mcumgr/transport_lorawan/src/main.c | 9 +++++++++ .../mcumgr/transport_lorawan/testcase.yaml | 19 ++++++++++++++++++ 5 files changed, 73 insertions(+) create mode 100644 tests/subsys/mgmt/mcumgr/transport_lorawan/CMakeLists.txt create mode 100644 tests/subsys/mgmt/mcumgr/transport_lorawan/lorawan_all.conf create mode 100644 tests/subsys/mgmt/mcumgr/transport_lorawan/prj.conf create mode 100644 tests/subsys/mgmt/mcumgr/transport_lorawan/src/main.c create mode 100644 tests/subsys/mgmt/mcumgr/transport_lorawan/testcase.yaml diff --git a/tests/subsys/mgmt/mcumgr/transport_lorawan/CMakeLists.txt b/tests/subsys/mgmt/mcumgr/transport_lorawan/CMakeLists.txt new file mode 100644 index 0000000000000..931087d54559e --- /dev/null +++ b/tests/subsys/mgmt/mcumgr/transport_lorawan/CMakeLists.txt @@ -0,0 +1,15 @@ +# +# Copyright (c) 2022 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 +# + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(all_options) + +FILE(GLOB app_sources + src/*.c +) + +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/subsys/mgmt/mcumgr/transport_lorawan/lorawan_all.conf b/tests/subsys/mgmt/mcumgr/transport_lorawan/lorawan_all.conf new file mode 100644 index 0000000000000..69f947e987a6e --- /dev/null +++ b/tests/subsys/mgmt/mcumgr/transport_lorawan/lorawan_all.conf @@ -0,0 +1,10 @@ +# +# Copyright (c) 2024 Jamie McCrae +# +# SPDX-License-Identifier: Apache-2.0 +# + +CONFIG_MCUMGR_TRANSPORT_LORAWAN_CONFIRMED_UPLINKS=y +CONFIG_MCUMGR_TRANSPORT_LORAWAN_REASSEMBLY=y +CONFIG_MCUMGR_TRANSPORT_LORAWAN_POLL_FOR_DATA=y +CONFIG_MCUMGR_TRANSPORT_LORAWAN_FRAGMENTED_UPLINKS=y diff --git a/tests/subsys/mgmt/mcumgr/transport_lorawan/prj.conf b/tests/subsys/mgmt/mcumgr/transport_lorawan/prj.conf new file mode 100644 index 0000000000000..a69e123c74060 --- /dev/null +++ b/tests/subsys/mgmt/mcumgr/transport_lorawan/prj.conf @@ -0,0 +1,20 @@ +# +# Copyright (c) 2024 Jamie McCrae +# +# SPDX-License-Identifier: Apache-2.0 +# + +CONFIG_ZTEST=y +CONFIG_NET_BUF=y +CONFIG_ZCBOR=y +CONFIG_MCUMGR=y +CONFIG_SPI=y +CONFIG_LORA=y +CONFIG_LORAWAN=y +CONFIG_LORAMAC_REGION_EU868=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=3000 +CONFIG_MCUMGR_TRANSPORT_LORAWAN=y +CONFIG_MCUMGR_TRANSPORT_LORAWAN_CONFIRMED_UPLINKS=n +CONFIG_MCUMGR_TRANSPORT_LORAWAN_REASSEMBLY=n +CONFIG_MCUMGR_TRANSPORT_LORAWAN_POLL_FOR_DATA=n +CONFIG_MCUMGR_TRANSPORT_LORAWAN_FRAGMENTED_UPLINKS=n diff --git a/tests/subsys/mgmt/mcumgr/transport_lorawan/src/main.c b/tests/subsys/mgmt/mcumgr/transport_lorawan/src/main.c new file mode 100644 index 0000000000000..999d07a7c7426 --- /dev/null +++ b/tests/subsys/mgmt/mcumgr/transport_lorawan/src/main.c @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 Jamie McCrae + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#if !defined(CONFIG_MCUMGR_TRANSPORT_LORAWAN) +#error "Expected Kconfig option CONFIG_MCUMGR_TRANSPORT_LORAWAN not enabled" +#endif diff --git a/tests/subsys/mgmt/mcumgr/transport_lorawan/testcase.yaml b/tests/subsys/mgmt/mcumgr/transport_lorawan/testcase.yaml new file mode 100644 index 0000000000000..bdc7c72ec2268 --- /dev/null +++ b/tests/subsys/mgmt/mcumgr/transport_lorawan/testcase.yaml @@ -0,0 +1,19 @@ +# +# Copyright (c) 2024 Jamie McCrae +# +# SPDX-License-Identifier: Apache-2.0 +# +common: + platform_allow: rm1xx_dvk + tags: + - mgmt + - mcumgr + - all_options + - transport + - lorawan + build_only: true +tests: + mgmt.mcumgr.transport.lorawan: {} + mgmt.mcumgr.transport.lorawan.all: + extra_args: + - EXTRA_CONF_FILE="lorawan_all.conf" From efd60dfaafa6741f6912e6b55cce2aaa0f232fc6 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Sun, 20 Oct 2024 10:42:43 +0100 Subject: [PATCH 1744/4482] doc: release: 4.0: Add note on LoRaWAN MCUmgr transport Adds a note that this transport has been added Signed-off-by: Jamie McCrae --- doc/releases/release-notes-4.0.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 1e901f34b932b..9864e49d3ff37 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -414,10 +414,12 @@ Libraries / Subsystems * Fixed formatting of milliseconds in :c:enum:`OS_MGMT_ID_DATETIME_STR` by adding leading zeros. * Added support for custom os mgmt bootloader info responses using notification hooks, this - can be enabled witbh :kconfig:option:`CONFIG_MCUMGR_GRP_OS_BOOTLOADER_INFO_HOOK`, the data + can be enabled with :kconfig:option:`CONFIG_MCUMGR_GRP_OS_BOOTLOADER_INFO_HOOK`, the data structure is :c:struct:`os_mgmt_bootloader_info_data`. * Added support for img mgmt slot info command, which allows for listing information on images and slots on the device. + * Added support for LoRaWAN MCUmgr transport, which can be enabled with + :kconfig:option:`CONFIG_MCUMGR_TRANSPORT_LORAWAN`. * hawkBit From 16605585c0068f608334af60764e9d9e45bdf2b2 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Mon, 21 Oct 2024 11:49:52 +0200 Subject: [PATCH 1745/4482] Bluetooth: Audio: Add bt_audio_data_get_val Add a generic function to retrieve any data based on an assigned numbers type. This function can in theory be used for any data type, and not just LE Audio types, but since it relies on bt_audio_data_parse it was made specificially for LE Audio. The function can be used in cases where bt_audio_codec_cfg_get_val, bt_audio_codec_cfg_meta_get_val, bt_audio_codec_cap_get_val or bt_audio_codec_cap_meta_get_val (or their derivation) are not easily applicable due to the type constrainst. Signed-off-by: Emil Gydesen --- include/zephyr/bluetooth/audio/audio.h | 18 ++++++ subsys/bluetooth/audio/audio.c | 62 ++++++++++++++++++ subsys/bluetooth/audio/codec.c | 88 +------------------------- 3 files changed, 83 insertions(+), 85 deletions(-) diff --git a/include/zephyr/bluetooth/audio/audio.h b/include/zephyr/bluetooth/audio/audio.h index 928e33f88e2f0..3b62ae9d4a71a 100644 --- a/include/zephyr/bluetooth/audio/audio.h +++ b/include/zephyr/bluetooth/audio/audio.h @@ -768,6 +768,24 @@ struct bt_audio_codec_cfg { int bt_audio_data_parse(const uint8_t ltv[], size_t size, bool (*func)(struct bt_data *data, void *user_data), void *user_data); +/** + * @brief Get the value of a specific data type in an length-type-value data array + * + * @param[in] ltv_data The array containing the length-type-value tuples + * @param[in] size The size of @p ltv_data + * @param[in] type The type to get the value for. May be any type, but typically either + * @ref bt_audio_codec_cap_type, @ref bt_audio_codec_cfg_type or + * @ref bt_audio_metadata_type. + * @param[out] data Pointer to the data-pointer to update when item is found. + * Any found data will be little endian. + * + * @retval Length The length of found @p data (may be 0). + * @retval -EINVAL if arguments are invalid + * @retval -ENODATA if not found + */ +int bt_audio_data_get_val(const uint8_t ltv_data[], size_t size, uint8_t type, + const uint8_t **data); + /** * @brief Function to get the number of channels from the channel allocation * diff --git a/subsys/bluetooth/audio/audio.c b/subsys/bluetooth/audio/audio.c index 72fac3e8cb2ef..55412c4f7e1a9 100644 --- a/subsys/bluetooth/audio/audio.c +++ b/subsys/bluetooth/audio/audio.c @@ -77,6 +77,68 @@ int bt_audio_data_parse(const uint8_t ltv[], size_t size, return 0; } +struct search_type_param { + bool found; + uint8_t type; + uint8_t data_len; + const uint8_t **data; +}; + +static bool parse_cb(struct bt_data *data, void *user_data) +{ + struct search_type_param *param = (struct search_type_param *)user_data; + + if (param->type == data->type) { + param->found = true; + param->data_len = data->data_len; + *param->data = data->data; + + return false; + } + + return true; +} + +int bt_audio_data_get_val(const uint8_t ltv_data[], size_t size, uint8_t type, const uint8_t **data) +{ + struct search_type_param param = { + .found = false, + .type = type, + .data_len = 0U, + .data = data, + }; + int err; + + CHECKIF(ltv_data == NULL) { + LOG_DBG("ltv_data is NULL"); + return -EINVAL; + } + + CHECKIF(data == NULL) { + LOG_DBG("data is NULL"); + return -EINVAL; + } + + *data = NULL; + + /* If the size is 0 we can terminate early */ + if (size == 0U) { + return -ENODATA; + } + + err = bt_audio_data_parse(ltv_data, size, parse_cb, ¶m); + if (err != 0 && err != -ECANCELED) { + LOG_DBG("Could not parse the data: %d", err); + return err; + } + + if (!param.found) { + return -ENODATA; + } + + return param.data_len; +} + uint8_t bt_audio_get_chan_count(enum bt_audio_location chan_allocation) { if (chan_allocation == BT_AUDIO_LOCATION_MONO_AUDIO) { diff --git a/subsys/bluetooth/audio/codec.c b/subsys/bluetooth/audio/codec.c index f07c4dc3a6171..0f0ba58e72e3b 100644 --- a/subsys/bluetooth/audio/codec.c +++ b/subsys/bluetooth/audio/codec.c @@ -125,28 +125,6 @@ int bt_audio_codec_cfg_frame_dur_us_to_frame_dur(uint32_t frame_dur_us) CONFIG_BT_AUDIO_CODEC_CAP_MAX_DATA_SIZE > 0 || \ CONFIG_BT_AUDIO_CODEC_CAP_MAX_METADATA_SIZE > 0 -struct search_type_param { - bool found; - uint8_t type; - uint8_t data_len; - const uint8_t **data; -}; - -static bool parse_cb(struct bt_data *data, void *user_data) -{ - struct search_type_param *param = (struct search_type_param *)user_data; - - if (param->type == data->type) { - param->found = true; - param->data_len = data->data_len; - *param->data = data->data; - - return false; - } - - return true; -} - static int ltv_set_val(struct net_buf_simple *buf, uint8_t type, const uint8_t *data, size_t data_len) { @@ -290,14 +268,6 @@ static void init_net_buf_simple_from_codec_cfg(struct net_buf_simple *buf, int bt_audio_codec_cfg_get_val(const struct bt_audio_codec_cfg *codec_cfg, enum bt_audio_codec_cfg_type type, const uint8_t **data) { - struct search_type_param param = { - .found = false, - .type = (uint8_t)type, - .data_len = 0, - .data = data, - }; - int err; - CHECKIF(codec_cfg == NULL) { LOG_DBG("codec is NULL"); return -EINVAL; @@ -308,19 +278,7 @@ int bt_audio_codec_cfg_get_val(const struct bt_audio_codec_cfg *codec_cfg, return -EINVAL; } - *data = NULL; - - err = bt_audio_data_parse(codec_cfg->data, codec_cfg->data_len, parse_cb, ¶m); - if (err != 0 && err != -ECANCELED) { - LOG_DBG("Could not parse the data: %d", err); - return err; - } - - if (!param.found) { - return -ENODATA; - } - - return param.data_len; + return bt_audio_data_get_val(codec_cfg->data, codec_cfg->data_len, (uint8_t)type, data); } int bt_audio_codec_cfg_set_val(struct bt_audio_codec_cfg *codec_cfg, @@ -608,14 +566,6 @@ static void init_net_buf_simple_from_meta(struct net_buf_simple *buf, uint8_t me static int codec_meta_get_val(const uint8_t meta[], size_t meta_len, enum bt_audio_metadata_type type, const uint8_t **data) { - struct search_type_param param = { - .found = false, - .type = (uint8_t)type, - .data_len = 0, - .data = data, - }; - int err; - CHECKIF(meta == NULL) { LOG_DBG("meta is NULL"); return -EINVAL; @@ -626,19 +576,7 @@ static int codec_meta_get_val(const uint8_t meta[], size_t meta_len, return -EINVAL; } - *data = NULL; - - err = bt_audio_data_parse(meta, meta_len, parse_cb, ¶m); - if (err != 0 && err != -ECANCELED) { - LOG_DBG("Could not parse the meta data: %d", err); - return err; - } - - if (!param.found) { - return -ENODATA; - } - - return param.data_len; + return bt_audio_data_get_val(meta, meta_len, (uint8_t)type, data); } static int codec_meta_set_val(uint8_t meta[], size_t meta_len, size_t meta_size, @@ -2016,14 +1954,6 @@ static void init_net_buf_simple_from_codec_cap(struct net_buf_simple *buf, int bt_audio_codec_cap_get_val(const struct bt_audio_codec_cap *codec_cap, enum bt_audio_codec_cap_type type, const uint8_t **data) { - struct search_type_param param = { - .found = false, - .type = (uint8_t)type, - .data_len = 0, - .data = data, - }; - int err; - CHECKIF(codec_cap == NULL) { LOG_DBG("codec_cap is NULL"); return -EINVAL; @@ -2034,19 +1964,7 @@ int bt_audio_codec_cap_get_val(const struct bt_audio_codec_cap *codec_cap, return -EINVAL; } - *data = NULL; - - err = bt_audio_data_parse(codec_cap->data, codec_cap->data_len, parse_cb, ¶m); - if (err != 0 && err != -ECANCELED) { - LOG_DBG("Could not parse the data: %d", err); - return err; - } - - if (!param.found) { - return -ENODATA; - } - - return param.data_len; + return bt_audio_data_get_val(codec_cap->data, codec_cap->data_len, (uint8_t)type, data); } int bt_audio_codec_cap_set_val(struct bt_audio_codec_cap *codec_cap, From a04c1db9a46ab3912d0a678a370516ef754a7007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 22 Oct 2024 11:08:49 +0200 Subject: [PATCH 1746/4482] tests: drivers: uart: uart_async_api: Add nrf54l15dk//cpuapp overlay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add overlay for nrf54l15dk/nrf54l15/cpuapp target. Signed-off-by: Krzysztof Chruściński --- .../boards/nrf54l15dk_nrf54l15_cpuapp.overlay | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/drivers/uart/uart_async_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay diff --git a/tests/drivers/uart/uart_async_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay b/tests/drivers/uart/uart_async_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay new file mode 100644 index 0000000000000..ed4a2de1891c0 --- /dev/null +++ b/tests/drivers/uart/uart_async_api/boards/nrf54l15dk_nrf54l15_cpuapp.overlay @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +&pinctrl { + uart21_default_alt: uart21_default_alt { + group1 { + psels = , + ; + }; + }; + + uart21_sleep_alt: uart21_sleep_alt { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; + +dut: &uart21 { + status = "okay"; + pinctrl-0 = <&uart21_default_alt>; + pinctrl-1 = <&uart21_sleep_alt>; + pinctrl-names = "default", "sleep"; + current-speed = <115200>; +}; From 94baef654c9509cf7de87a8c161d7c3efb8dae8c Mon Sep 17 00:00:00 2001 From: Nils Bosbach Date: Tue, 22 Oct 2024 11:10:43 +0200 Subject: [PATCH 1747/4482] drivers: gpio: gpio_iproc: fix reg write The sys_write32 function expects a value as the first parameter and the memory location where the value should be written as the second parameter. Signed-off-by: Nils Bosbach --- drivers/gpio/gpio_iproc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio_iproc.c b/drivers/gpio/gpio_iproc.c index def1a07dd4ea8..70f765b5ac7f4 100644 --- a/drivers/gpio/gpio_iproc.c +++ b/drivers/gpio/gpio_iproc.c @@ -77,7 +77,7 @@ static int gpio_iproc_port_set_masked_raw(const struct device *dev, uint32_t mas value = sys_read32(base + IPROC_GPIO_DATA_OUT_OFFSET); value = (value & (~mask)) | (value & mask); - sys_write32(base + IPROC_GPIO_DATA_OUT_OFFSET, value); + sys_write32(value, base + IPROC_GPIO_DATA_OUT_OFFSET); return 0; } @@ -87,7 +87,7 @@ static int gpio_iproc_port_set_bits_raw(const struct device *dev, uint32_t mask) const struct gpio_iproc_config *const cfg = DEV_CFG(dev); mem_addr_t base = cfg->base; - sys_write32(base + IPROC_GPIO_DATA_OUT_OFFSET, mask); + sys_write32(mask, base + IPROC_GPIO_DATA_OUT_OFFSET); return 0; } @@ -101,7 +101,7 @@ static int gpio_iproc_port_clear_bits_raw(const struct device *dev, uint32_t mas /* Clear pins. */ value = sys_read32(base + IPROC_GPIO_DATA_OUT_OFFSET); value = (value & ~mask); - sys_write32(base + IPROC_GPIO_DATA_OUT_OFFSET, value); + sys_write32(value, base + IPROC_GPIO_DATA_OUT_OFFSET); return 0; } @@ -115,7 +115,7 @@ static int gpio_iproc_port_toggle_bits(const struct device *dev, uint32_t mask) /* toggles pins. */ value = sys_read32(base + IPROC_GPIO_DATA_OUT_OFFSET); value = (value ^ mask); - sys_write32(base + IPROC_GPIO_DATA_OUT_OFFSET, value); + sys_write32(value, base + IPROC_GPIO_DATA_OUT_OFFSET); return 0; } From 5b44edc4ebde4d20022f7458a897b3538cc9e900 Mon Sep 17 00:00:00 2001 From: Jens Rehhoff Thomsen Date: Tue, 22 Oct 2024 11:26:16 +0200 Subject: [PATCH 1748/4482] Bluetooth samples: Fix wrong SDU size check Just a typo in broadcast sink sample main code. '<' changed to '>' in if statement. Signed-off-by: Jens Rehhoff Thomsen --- samples/bluetooth/bap_broadcast_sink/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/bluetooth/bap_broadcast_sink/src/main.c b/samples/bluetooth/bap_broadcast_sink/src/main.c index 44e9999c14246..df17d6c458e94 100644 --- a/samples/bluetooth/bap_broadcast_sink/src/main.c +++ b/samples/bluetooth/bap_broadcast_sink/src/main.c @@ -393,7 +393,7 @@ static int lc3_enable(struct broadcast_sink_stream *sink_stream) chan_alloc_bit_cnt = bt_audio_get_chan_count(sink_stream->chan_allocation); sdu_size_required = chan_alloc_bit_cnt * sink_stream->lc3_octets_per_frame * sink_stream->lc3_frames_blocks_per_sdu; - if (sdu_size_required < sink_stream->stream.qos->sdu) { + if (sdu_size_required > sink_stream->stream.qos->sdu) { printk("With %zu channels and %u octets per frame and %u frames per block, SDUs " "shall be at minimum %zu, but the stream has been configured for %u", chan_alloc_bit_cnt, sink_stream->lc3_octets_per_frame, From 32a719ae12f7c483903c003528cc93ae0023c1e6 Mon Sep 17 00:00:00 2001 From: Jens Rehhoff Thomsen Date: Tue, 22 Oct 2024 12:05:52 +0200 Subject: [PATCH 1749/4482] Bluetooth samples: Fix BIS index mask variable For the BIS index mask variable used in broadcast sink sample bit 0 is now BIS index 1. Signed-off-by: Jens Rehhoff Thomsen --- samples/bluetooth/bap_broadcast_sink/src/main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/samples/bluetooth/bap_broadcast_sink/src/main.c b/samples/bluetooth/bap_broadcast_sink/src/main.c index df17d6c458e94..d2c88db5556b7 100644 --- a/samples/bluetooth/bap_broadcast_sink/src/main.c +++ b/samples/bluetooth/bap_broadcast_sink/src/main.c @@ -143,10 +143,9 @@ static const struct bt_audio_codec_cap codec_cap = BT_AUDIO_CODEC_CAP_LC3( (BT_AUDIO_CONTEXT_TYPE_CONVERSATIONAL | BT_AUDIO_CONTEXT_TYPE_MEDIA)); /* Create a mask for the maximum BIS we can sync to using the number of streams - * we have. We add an additional 1 since the bis indexes start from 1 and not - * 0. + * we have. Bit 0 is BIS index 1. */ -static const uint32_t bis_index_mask = BIT_MASK(ARRAY_SIZE(streams) + 1U); +static const uint32_t bis_index_mask = BIT_MASK(ARRAY_SIZE(streams)); static uint32_t requested_bis_sync; static uint32_t bis_index_bitfield; static uint8_t sink_broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]; @@ -1649,7 +1648,7 @@ int main(void) sync_bitfield = bis_index_bitfield & requested_bis_sync; stream_count = 0; - for (int i = 1; i < BT_ISO_MAX_GROUP_ISO_COUNT; i++) { + for (int i = 0; i < BT_ISO_MAX_GROUP_ISO_COUNT; i++) { if ((sync_bitfield & BIT(i)) != 0) { stream_count++; } From 5a728825b7c18a1820b331a983c2f10c6ec287c5 Mon Sep 17 00:00:00 2001 From: Jens Rehhoff Thomsen Date: Tue, 22 Oct 2024 11:04:06 +0200 Subject: [PATCH 1750/4482] Bluetooth samples: Increase codec meta data size To improve broadcast sink sample robostness the max codec meta data size configuration is increased to reflect the meta codec data sizes seen for sources in market. Signed-off-by: Jens Rehhoff Thomsen --- samples/bluetooth/bap_broadcast_sink/prj.conf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/samples/bluetooth/bap_broadcast_sink/prj.conf b/samples/bluetooth/bap_broadcast_sink/prj.conf index c8a1dd228fa4e..df18314cfa1e0 100644 --- a/samples/bluetooth/bap_broadcast_sink/prj.conf +++ b/samples/bluetooth/bap_broadcast_sink/prj.conf @@ -16,6 +16,10 @@ CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT=2 CONFIG_BT_BAP_BASS_MAX_SUBGROUPS=2 CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 +CONFIG_BT_AUDIO_CODEC_CFG_MAX_METADATA_SIZE=64 +CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_SIZE=64 +CONFIG_BT_AUDIO_CODEC_CAP_MAX_METADATA_SIZE=64 +CONFIG_BT_AUDIO_CODEC_CAP_MAX_DATA_SIZE=64 CONFIG_BT_DEVICE_NAME="Broadcast Audio Sink" From 7d83419b6f3e2a3e09ad4566b27d8eca5cb9f295 Mon Sep 17 00:00:00 2001 From: Jens Rehhoff Thomsen Date: Wed, 28 Aug 2024 13:06:49 +0200 Subject: [PATCH 1751/4482] Bluetooth samples: Add multi subgroup support Add multi subgroup support for the broadcast sink sample Signed-off-by: Jens Rehhoff Thomsen --- .../bluetooth/bap_broadcast_sink/src/main.c | 295 ++++++++---------- 1 file changed, 133 insertions(+), 162 deletions(-) diff --git a/samples/bluetooth/bap_broadcast_sink/src/main.c b/samples/bluetooth/bap_broadcast_sink/src/main.c index d2c88db5556b7..39ea5e82d8303 100644 --- a/samples/bluetooth/bap_broadcast_sink/src/main.c +++ b/samples/bluetooth/bap_broadcast_sink/src/main.c @@ -538,6 +538,7 @@ static void stream_started_cb(struct bt_bap_stream *stream) k_sem_give(&sem_stream_started); if (k_sem_count_get(&sem_stream_started) == stream_count) { big_synced = true; + printk("BIG synced\n"); k_sem_give(&sem_big_synced); } } @@ -554,6 +555,7 @@ static void stream_stopped_cb(struct bt_bap_stream *stream, uint8_t reason) } if (k_sem_count_get(&sem_stream_started) != stream_count) { + printk("BIG sync terminated\n"); big_synced = false; } } @@ -605,8 +607,9 @@ static struct bt_bap_stream_ops stream_ops = { }; #if defined(CONFIG_TARGET_BROADCAST_CHANNEL) -struct find_valid_bis_data { +struct bis_channel_allocation_data { struct { + bool chan_allocation_available; uint8_t index; enum bt_audio_location chan_allocation; } bis[BT_ISO_BIS_INDEX_MAX]; @@ -617,106 +620,39 @@ struct find_valid_bis_data { /** * This is called for each BIS in a subgroup * - * It returns `false` if the current BIS contains all of the channels we are looking for, - * or if it does not contain any and we are looking for BT_AUDIO_LOCATION_MONO_AUDIO. This stops - * the iteration of the remaining BIS in the subgroup. - * - * It returns `true` if the BIS either contains none or some of the channels we are looking for. - * If it contains some, then that is being stored in the user_data, so that the calling function - * can check if a combination of the BIS satisfy the channel allocations we want. + * Gets BIS channel allocation (if exists). + * Always returns `true` to continue to next BIS */ -static bool find_valid_bis_cb(const struct bt_bap_base_subgroup_bis *bis, - void *user_data) +static bool bis_get_channel_allocation_cb(const struct bt_bap_base_subgroup_bis *bis, + void *user_data) { - struct find_valid_bis_data *data = user_data; - struct bt_audio_codec_cfg codec_cfg = {0}; - enum bt_audio_location chan_allocation; - int err; + struct bis_channel_allocation_data *data = user_data; + struct bt_audio_codec_cfg codec_cfg; + int err, idx; + + idx = data->cnt++; + data->bis[idx].index = bis->index; + data->bis[idx].chan_allocation_available = false; err = bt_bap_base_subgroup_bis_codec_to_codec_cfg(bis, &codec_cfg); if (err != 0) { printk("Could not get codec configuration for BIS: %d\n", err); - return true; + + return true; /* continue to next BIS */ } - err = bt_audio_codec_cfg_get_chan_allocation(&codec_cfg, &chan_allocation, true); + err = bt_audio_codec_cfg_get_chan_allocation(&codec_cfg, &data->bis[idx].chan_allocation, + false); if (err != 0) { printk("Could not find channel allocation for BIS: %d\n", err); - if (err == -ENODATA && strlen(CONFIG_TARGET_BROADCAST_NAME) > 0U) { - /* Accept no channel allocation data available - * if TARGET_BROADCAST_NAME defined. Use current index. - */ - data->bis[0].index = bis->index; - data->bis[0].chan_allocation = chan_allocation; - data->cnt = 1; - - return false; - } - } else { - if ((chan_allocation & CONFIG_TARGET_BROADCAST_CHANNEL) == - CONFIG_TARGET_BROADCAST_CHANNEL) { - /* Found single BIS with all channels we want - keep as only and stop - * parsing - */ - data->bis[0].index = bis->index; - data->bis[0].chan_allocation = chan_allocation; - data->cnt = 1; - - return false; - } else if ((chan_allocation & CONFIG_TARGET_BROADCAST_CHANNEL) != 0) { - /* BIS contains part of what we are looking for - Store and see if there are - * other BIS that may fill the gaps - */ - data->bis[data->cnt].index = bis->index; - data->bis[data->cnt].chan_allocation = chan_allocation; - data->cnt++; - } + return true; /* continue to next BIS */ } - return true; -} + /* Channel allocation data available for this bis */ + data->bis[idx].chan_allocation_available = true; -/** - * This function searches all the BIS in a subgroup for a set of BIS indexes that satisfy - * CONFIG_TARGET_BROADCAST_CHANNEL - * - * Returns `true` if the right channels were found, otherwise `false`. - */ -static bool find_valid_bis_in_subgroup_bis(const struct bt_bap_base_subgroup *subgroup, - uint32_t *bis_indexes) -{ - struct find_valid_bis_data data = {0}; - int err; - - err = bt_bap_base_subgroup_foreach_bis(subgroup, find_valid_bis_cb, &data); - if (err == -ECANCELED) { - /* We found what we are looking for in a single BIS */ - - *bis_indexes = BIT(data.bis[0].index); - - return true; - } else if (err == 0) { - /* We are finished parsing all BIS - Try to find a combination that satisfy our - * channel allocation. For simplicity this is using a greedy approach, rather than - * an optimal one. - */ - enum bt_audio_location chan_allocation = BT_AUDIO_LOCATION_MONO_AUDIO; - *bis_indexes = 0; - - for (uint8_t i = 0U; i < data.cnt; i++) { - chan_allocation |= data.bis[i].chan_allocation; - *bis_indexes |= BIT(data.bis[i].index); - - if ((chan_allocation & CONFIG_TARGET_BROADCAST_CHANNEL) == - CONFIG_TARGET_BROADCAST_CHANNEL) { - return true; - } - } - } - - /* Some error occurred or we did not find expected channel allocation */ - return false; + return true; /* continue to next BIS */ } /** @@ -731,89 +667,91 @@ static bool find_valid_bis_in_subgroup_bis(const struct bt_bap_base_subgroup *su * configuration overwrites the subgroup values * * This function returns `true` if the subgroup does not support the channels in - * CONFIG_TARGET_BROADCAST_CHANNEL which makes it iterate over the next subgroup, and returns - * `false` if this subgroup satisfies our CONFIG_TARGET_BROADCAST_CHANNEL. + * CONFIG_TARGET_BROADCAST_CHANNEL which makes it iterate over the next subgroup, and + * returns `false` if this subgroup satisfies our CONFIG_TARGET_BROADCAST_CHANNEL. */ -static bool find_valid_bis_in_subgroup_cb(const struct bt_bap_base_subgroup *subgroup, - void *user_data) +static bool subgroup_get_valid_bis_indexes_cb(const struct bt_bap_base_subgroup *subgroup, + void *user_data) { - enum bt_audio_location chan_allocation; + enum bt_audio_location subgroup_chan_allocation; + enum bt_audio_location chan_allocation = BT_AUDIO_LOCATION_MONO_AUDIO; + bool subgroup_chan_allocation_available = false; struct bt_audio_codec_cfg codec_cfg; - uint32_t *bis_indexes = user_data; + struct bis_channel_allocation_data data = { + .cnt = 0, + }; + uint32_t bis_indexes = 0; int err; - /* We only want indexes from a single subgroup, so reset between each of them*/ - *bis_indexes = 0U; - err = bt_bap_base_subgroup_codec_to_codec_cfg(subgroup, &codec_cfg); if (err != 0) { printk("Could not get codec configuration: %d\n", err); - return true; + return true; /* continue to next subgroup */ } - err = bt_audio_codec_cfg_get_chan_allocation(&codec_cfg, &chan_allocation, false); - if (err != 0) { - printk("Could not find subgroup channel allocation: %d - Looking in the BISes\n", - err); + if (codec_cfg.id != BT_HCI_CODING_FORMAT_LC3) { + /* Only LC3 codec supported */ + return false; /* abort */ + } - /* Find chan alloc in BIS */ - if (find_valid_bis_in_subgroup_bis(subgroup, bis_indexes)) { - /* Found BISes with correct channel allocation */ - return false; - } + /* Get channel allocation at subgroup level */ + err = bt_audio_codec_cfg_get_chan_allocation(&codec_cfg, &subgroup_chan_allocation, true); + if (err == 0) { + printk("Channel allocation (subgroup level) 0x%x\n", subgroup_chan_allocation); + subgroup_chan_allocation_available = true; } else { - /* If the subgroup contains a single channel, then we just grab the first BIS index - */ - if (bt_audio_get_chan_count(chan_allocation) == 1 && - chan_allocation == CONFIG_TARGET_BROADCAST_CHANNEL) { - uint32_t subgroup_bis_indexes; - - /* Set bis_indexes to the first bit set */ - err = bt_bap_base_subgroup_get_bis_indexes(subgroup, &subgroup_bis_indexes); - if (err != 0) { - /* Should never happen as that would indicate an invalid - * subgroup If it does, we just parse the next subgroup - */ - return true; - } + /* subgroup error */ + return false; /* abort */ + } - /* We found the BIS index we want, stop parsing*/ - *bis_indexes = BIT(find_lsb_set(subgroup_bis_indexes) - 1); + /* Get channel allocation at BIS level */ + err = bt_bap_base_subgroup_foreach_bis(subgroup, bis_get_channel_allocation_cb, &data); + if (err != 0) { + printk("Get channel allocation error %d\n", err); - return false; - } else if ((chan_allocation & CONFIG_TARGET_BROADCAST_CHANNEL) == - CONFIG_TARGET_BROADCAST_CHANNEL) { - /* The subgroup contains all channels we are looking for/ - * We continue searching each BIS to get the minimal amount of BIS that - * satisfy CONFIG_TARGET_BROADCAST_CHANNEL. - */ + return true; /* continue to next subgroup */ + } - if (find_valid_bis_in_subgroup_bis(subgroup, bis_indexes)) { - /* Found BISes with correct channel allocation */ - return false; - } + /* If no BIS channel allocation available use subgroup channel allocation instead if + * exists (otherwise mono assumed) + */ + for (uint8_t i = 0U; i < data.cnt; i++) { + if (!data.bis[i].chan_allocation_available) { + data.bis[i].chan_allocation = subgroup_chan_allocation_available + ? subgroup_chan_allocation + : BT_AUDIO_LOCATION_MONO_AUDIO; } } - return true; -} + /* Get the BIS indexes */ + for (uint8_t i = 0U; i < data.cnt; i++) { + if ((data.bis[i].chan_allocation == CONFIG_TARGET_BROADCAST_CHANNEL) || + ((data.bis[i].chan_allocation & CONFIG_TARGET_BROADCAST_CHANNEL) == + CONFIG_TARGET_BROADCAST_CHANNEL)) { + /* Exact match */ + bis_indexes = BT_ISO_BIS_INDEX_BIT(data.bis[i].index); -/** - * This function gets a 32-bit bitfield of BIS indexes that cover the channel allocation values in - * CONFIG_TARGET_BROADCAST_CHANNEL. - */ -static int base_get_valid_bis_indexes(const struct bt_bap_base *base, uint32_t *bis_indexes) -{ - int err; + printk("Channel allocation match. BIS index bitfield 0x%x\n", bis_indexes); + *(uint32_t *)user_data = bis_indexes; - err = bt_bap_base_foreach_subgroup(base, find_valid_bis_in_subgroup_cb, bis_indexes); - if (err != -ECANCELED) { - printk("Failed to parse subgroups: %d\n", err); - return err != 0 ? err : -ENOENT; - } + return false; /* bis index found */ + } else if ((data.bis[i].chan_allocation & CONFIG_TARGET_BROADCAST_CHANNEL) != 0) { + /* Partial match */ + chan_allocation |= data.bis[i].chan_allocation; + bis_indexes |= BT_ISO_BIS_INDEX_BIT(data.bis[i].index); - return 0; + if ((chan_allocation & CONFIG_TARGET_BROADCAST_CHANNEL) == + CONFIG_TARGET_BROADCAST_CHANNEL) { + printk("Channel allocation match. BIS index bitfield 0x%x\n", + bis_indexes); + *(uint32_t *)user_data = bis_indexes; + + return false; /* bis indexes found */ + } + } + } + return true; /* continue to next subgroup */ } #endif /* CONFIG_TARGET_BROADCAST_CHANNEL */ @@ -831,17 +769,27 @@ static void base_recv_cb(struct bt_bap_broadcast_sink *sink, const struct bt_bap bt_bap_base_get_subgroup_count(base), sink); #if defined(CONFIG_TARGET_BROADCAST_CHANNEL) - err = base_get_valid_bis_indexes(base, &base_bis_index_bitfield); - if (err != 0) { - printk("Failed to find a valid BIS\n"); + /** + * Get a 32-bit bitfield of BIS indexes that cover the channel allocation values in + * CONFIG_TARGET_BROADCAST_CHANNEL. + */ + printk("Target channel location: 0x%x\n", CONFIG_TARGET_BROADCAST_CHANNEL); + err = bt_bap_base_foreach_subgroup(base, subgroup_get_valid_bis_indexes_cb, + &base_bis_index_bitfield); + if ((err != 0 && err != -ECANCELED) || + (err == -ECANCELED && base_bis_index_bitfield == 0)) { + printk("Failed to get valid BIS indexes: %d\n", err); + return; } #else err = bt_bap_base_get_bis_indexes(base, &base_bis_index_bitfield); if (err != 0) { - printk("Failed to BIS indexes: %d\n", err); + printk("Failed to get BIS indexes: %d\n", err); + return; } + #endif /* CONFIG_TARGET_BROADCAST_CHANNEL */ bis_index_bitfield = base_bis_index_bitfield & bis_index_mask; @@ -939,7 +887,8 @@ static int pa_sync_past(struct bt_conn *conn, uint16_t pa_interval) static void recv_state_updated_cb(struct bt_conn *conn, const struct bt_bap_scan_delegator_recv_state *recv_state) { - printk("Receive state updated, pa sync state: %u\n", recv_state->pa_sync_state); + printk("Receive state updated, pa sync state: %u, encrypt_state %u\n", + recv_state->pa_sync_state, recv_state->encrypt_state); for (uint8_t i = 0; i < recv_state->num_subgroups; i++) { printk("subgroup %d bis_sync: 0x%08x\n", i, recv_state->subgroups[i].bis_sync); @@ -1032,15 +981,38 @@ static int bis_sync_req_cb(struct bt_conn *conn, const struct bt_bap_scan_delegator_recv_state *recv_state, const uint32_t bis_sync_req[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]) { - printk("BIS sync request received for %p: 0x%08x->0x%08x, broadcast id: 0x%06x, (%s)\n", - recv_state, requested_bis_sync, bis_sync_req[0], recv_state->broadcast_id, + /* Bit field indicating from which subgroup(s) BIS sync is requested */ + uint32_t requested_subgroup_sync = 0; /* currently only used for printout */ + + requested_bis_sync = 0; + + for (uint8_t subgroup = 0; subgroup < recv_state->num_subgroups; subgroup++) { + if (bis_sync_req[subgroup] != 0) { + if (requested_bis_sync == 0) { + requested_bis_sync = bis_sync_req[subgroup]; + } else { + if (requested_bis_sync != BT_BAP_BIS_SYNC_NO_PREF && + bis_sync_req[subgroup] != BT_BAP_BIS_SYNC_NO_PREF) { + /* Spec a little bit unclear. Here we choose to say that + * BIS sync request from more than 1 subgroup is not + * possible unless sync value is 0 or + * BT_BAP_BIS_SYNC_NO_PREF + */ + printk("Unsupported BIS sync request from more than 1 " + "subgroup\n"); + return -EINVAL; + } + } + requested_subgroup_sync |= BIT(subgroup); + } + } + + printk("BIS sync req for %p: BIS indexes 0x%08x (subgroup indexes 0x%08x), " + "broadcast id: 0x%06x, (%s)\n", + recv_state, requested_bis_sync, requested_subgroup_sync, recv_state->broadcast_id, big_synced ? "BIG synced" : "BIG not synced"); - /* We only care about a single subgroup in this sample */ - if (big_synced && requested_bis_sync != bis_sync_req[0]) { - /* If the BIS sync request is received while we are already - * synced, it means that the requested BIS sync has changed. - */ + if (big_synced && requested_bis_sync == 0) { int err; /* The stream stopped callback will be called as part of this, @@ -1058,9 +1030,8 @@ static int bis_sync_req_cb(struct bt_conn *conn, k_sem_give(&sem_broadcast_sink_stopped); } - requested_bis_sync = bis_sync_req[0]; broadcaster_broadcast_id = recv_state->broadcast_id; - if (bis_sync_req[0] != 0) { + if (requested_bis_sync != 0) { k_sem_give(&sem_bis_sync_requested); } From 635d03b7e0b1fe61f218e8eb66091168e7cc7ae7 Mon Sep 17 00:00:00 2001 From: Olivier Lesage Date: Thu, 24 Oct 2024 13:46:00 +0200 Subject: [PATCH 1752/4482] bluetooth: host: Unit tests for bt_le_cs_step_data_parse Add unit tests for bt_le_cs_step_data_parse. Also exit early (without calling the function pointer) if the next step would seem to read out of bounds. Signed-off-by: Olivier Lesage --- subsys/bluetooth/host/cs.c | 5 + .../bt_le_cs_step_data_parse/CMakeLists.txt | 25 +++ .../host/cs/bt_le_cs_step_data_parse/prj.conf | 10 + .../cs/bt_le_cs_step_data_parse/src/main.c | 171 ++++++++++++++++++ .../cs/bt_le_cs_step_data_parse/testcase.yaml | 7 + tests/bluetooth/host/cs/mocks/CMakeLists.txt | 17 ++ tests/bluetooth/host/cs/mocks/conn.c | 22 +++ tests/bluetooth/host/cs/mocks/conn.h | 37 ++++ tests/bluetooth/host/cs/mocks/hci_core.c | 19 ++ tests/bluetooth/host/cs/mocks/hci_core.h | 16 ++ tests/bluetooth/host/cs/mocks/net_buf.c | 17 ++ tests/bluetooth/host/cs/mocks/net_buf.h | 21 +++ 12 files changed, 367 insertions(+) create mode 100644 tests/bluetooth/host/cs/bt_le_cs_step_data_parse/CMakeLists.txt create mode 100644 tests/bluetooth/host/cs/bt_le_cs_step_data_parse/prj.conf create mode 100644 tests/bluetooth/host/cs/bt_le_cs_step_data_parse/src/main.c create mode 100644 tests/bluetooth/host/cs/bt_le_cs_step_data_parse/testcase.yaml create mode 100644 tests/bluetooth/host/cs/mocks/CMakeLists.txt create mode 100644 tests/bluetooth/host/cs/mocks/conn.c create mode 100644 tests/bluetooth/host/cs/mocks/conn.h create mode 100644 tests/bluetooth/host/cs/mocks/hci_core.c create mode 100644 tests/bluetooth/host/cs/mocks/hci_core.h create mode 100644 tests/bluetooth/host/cs/mocks/net_buf.c create mode 100644 tests/bluetooth/host/cs/mocks/net_buf.h diff --git a/subsys/bluetooth/host/cs.c b/subsys/bluetooth/host/cs.c index b22877d31b8ac..aa1e1beadf37d 100644 --- a/subsys/bluetooth/host/cs.c +++ b/subsys/bluetooth/host/cs.c @@ -1313,6 +1313,11 @@ void bt_le_cs_step_data_parse(struct net_buf_simple *step_data_buf, step.data = step_data_buf->data; + if (step.data_len > step_data_buf->len) { + LOG_WRN("Step data appears malformed."); + return; + } + if (!func(&step, user_data)) { return; } diff --git a/tests/bluetooth/host/cs/bt_le_cs_step_data_parse/CMakeLists.txt b/tests/bluetooth/host/cs/bt_le_cs_step_data_parse/CMakeLists.txt new file mode 100644 index 0000000000000..089406a316f21 --- /dev/null +++ b/tests/bluetooth/host/cs/bt_le_cs_step_data_parse/CMakeLists.txt @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +project(bt_step_data_parse) + +include_directories(BEFORE + ${ZEPHYR_BASE}/tests/bluetooth/host/cs/mocks +) + +add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/host host_mocks) +add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/host/cs/mocks mocks) + +target_link_libraries(testbinary PRIVATE mocks host_mocks) + +target_sources(testbinary + PRIVATE + src/main.c + + ${ZEPHYR_BASE}/subsys/bluetooth/host/cs.c + ${ZEPHYR_BASE}/lib/net_buf/buf_simple.c + ${ZEPHYR_BASE}/subsys/logging/log_minimal.c +) diff --git a/tests/bluetooth/host/cs/bt_le_cs_step_data_parse/prj.conf b/tests/bluetooth/host/cs/bt_le_cs_step_data_parse/prj.conf new file mode 100644 index 0000000000000..8ff995b6f0405 --- /dev/null +++ b/tests/bluetooth/host/cs/bt_le_cs_step_data_parse/prj.conf @@ -0,0 +1,10 @@ +CONFIG_ZTEST=y +CONFIG_BT=y +CONFIG_BT_HCI=y +CONFIG_BT_CENTRAL=y +CONFIG_BT_CHANNEL_SOUNDING=y +CONFIG_ASSERT=y +CONFIG_ASSERT_LEVEL=2 +CONFIG_ASSERT_VERBOSE=y +CONFIG_ASSERT_ON_ERRORS=y +CONFIG_NET_BUF=y diff --git a/tests/bluetooth/host/cs/bt_le_cs_step_data_parse/src/main.c b/tests/bluetooth/host/cs/bt_le_cs_step_data_parse/src/main.c new file mode 100644 index 0000000000000..1ed0f2d640b76 --- /dev/null +++ b/tests/bluetooth/host/cs/bt_le_cs_step_data_parse/src/main.c @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "mocks/conn.h" +#include "mocks/hci_core.h" +#include "mocks/net_buf.h" + +#include +#include +#include + +DEFINE_FFF_GLOBALS; + +FAKE_VALUE_FUNC(bool, bt_le_cs_step_data_parse_func, struct bt_le_cs_subevent_step *, void *); + +static void fff_reset_rule_before(const struct ztest_unit_test *test, void *fixture) +{ + RESET_FAKE(bt_le_cs_step_data_parse_func); + CONN_FFF_FAKES_LIST(RESET_FAKE); +} + +ZTEST_RULE(fff_reset_rule, fff_reset_rule_before, NULL); + +ZTEST_SUITE(bt_le_cs_step_data_parse, NULL, NULL, NULL, NULL, NULL); + +/* + * Test empty data buffer + * + * Constraints: + * - buffer len set to 0 + * + * Expected behaviour: + * - Callback function is not called + */ +ZTEST(bt_le_cs_step_data_parse, test_parsing_empty_buf) +{ + struct net_buf_simple *buf = NET_BUF_SIMPLE(0); + + bt_le_cs_step_data_parse(buf, bt_le_cs_step_data_parse_func, NULL); + + zassert_equal(bt_le_cs_step_data_parse_func_fake.call_count, 0); +} + +/* + * Test malformed step data + * + * Constraints: + * - step data with a step length going out of bounds + * + * Expected behaviour: + * - Callback function is called once + */ +ZTEST(bt_le_cs_step_data_parse, test_parsing_invalid_length) +{ + struct net_buf_simple buf; + uint8_t data[] = { + 0x00, 0x01, 0x01, 0x00, /* mode 0 */ + 0x03, 0x20, 0x03, 0x00, 0x11, /* mode 3 step with bad length */ + }; + + bt_le_cs_step_data_parse_func_fake.return_val = true; + + net_buf_simple_init_with_data(&buf, data, ARRAY_SIZE(data)); + + bt_le_cs_step_data_parse(&buf, bt_le_cs_step_data_parse_func, NULL); + + zassert_equal(1, bt_le_cs_step_data_parse_func_fake.call_count, "called %d", + bt_le_cs_step_data_parse_func_fake.call_count); +} + +/* + * Test parsing stopped + * + * Constraints: + * - Data contains valid step data + * - Callback function returns false to stop parsing + * + * Expected behaviour: + * - Once parsing is stopped, the callback is not called anymore + */ +ZTEST(bt_le_cs_step_data_parse, test_parsing_stopped) +{ + struct net_buf_simple buf; + uint8_t data[] = { + 0x00, 0x05, 0x01, 0x00, /* mode 0 */ + 0x01, 0x10, 0x02, 0x00, 0x11, /* mode 1 */ + 0x02, 0x11, 0x02, 0x00, 0x11, /* mode 2 */ + }; + + bt_le_cs_step_data_parse_func_fake.return_val = false; + + net_buf_simple_init_with_data(&buf, data, ARRAY_SIZE(data)); + + bt_le_cs_step_data_parse(&buf, bt_le_cs_step_data_parse_func, NULL); + + zassert_equal(1, bt_le_cs_step_data_parse_func_fake.call_count, "called %d", + bt_le_cs_step_data_parse_func_fake.call_count); +} + +struct custom_user_data { + const uint8_t *data; + size_t len; +}; + +static bool bt_le_cs_step_data_parse_func_custom_fake(struct bt_le_cs_subevent_step *step, + void *user_data) +{ + struct custom_user_data *ud = user_data; + + /* mode check */ + zassert_true(ud->len-- > 0); + zassert_equal(step->mode, *ud->data); + ud->data++; + + /* channel check */ + zassert_true(ud->len-- > 0); + zassert_equal(step->channel, *ud->data); + ud->data++; + + /* step data length check */ + zassert_true(ud->len-- > 0); + zassert_equal(step->data_len, *ud->data); + ud->data++; + + /* value check */ + zassert_true(ud->len >= step->data_len); + zassert_mem_equal(step->data, ud->data, step->data_len); + ud->data += step->data_len; + ud->len -= step->data_len; + + return true; +} + +/* + * Test parsing successfully + * + * Constraints: + * - Data contains valid step data + * - Callback function returns false to stop parsing + * + * Expected behaviour: + * - Data passed to the callback match the expected data + */ +ZTEST(bt_le_cs_step_data_parse, test_parsing_success) +{ + struct net_buf_simple buf; + uint8_t data[] = { + 0x00, 0x05, 0x01, 0x00, /* mode 0 */ + 0x03, 0x11, 0x01, 0x11, /* mode 3 */ + 0x02, 0x12, 0x02, 0x00, 0x11, /* mode 2 */ + 0x03, 0x13, 0x01, 0x11, /* mode 3 */ + 0x02, 0x14, 0x02, 0x00, 0x11, /* mode 2 */ + }; + + struct custom_user_data user_data = { + .data = data, + .len = ARRAY_SIZE(data), + }; + + bt_le_cs_step_data_parse_func_fake.custom_fake = bt_le_cs_step_data_parse_func_custom_fake; + + net_buf_simple_init_with_data(&buf, data, ARRAY_SIZE(data)); + + bt_le_cs_step_data_parse(&buf, bt_le_cs_step_data_parse_func, &user_data); + + zassert_equal(5, bt_le_cs_step_data_parse_func_fake.call_count, "called %d", + bt_le_cs_step_data_parse_func_fake.call_count); +} diff --git a/tests/bluetooth/host/cs/bt_le_cs_step_data_parse/testcase.yaml b/tests/bluetooth/host/cs/bt_le_cs_step_data_parse/testcase.yaml new file mode 100644 index 0000000000000..2e65668c519c0 --- /dev/null +++ b/tests/bluetooth/host/cs/bt_le_cs_step_data_parse/testcase.yaml @@ -0,0 +1,7 @@ +common: + tags: + - bluetooth + - host +tests: + bluetooth.host.cs.bt_le_cs_step_data_parse: + type: unit diff --git a/tests/bluetooth/host/cs/mocks/CMakeLists.txt b/tests/bluetooth/host/cs/mocks/CMakeLists.txt new file mode 100644 index 0000000000000..1ab1a58a1d02c --- /dev/null +++ b/tests/bluetooth/host/cs/mocks/CMakeLists.txt @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: Apache-2.0 + +add_library(mocks STATIC + conn.c + hci_core.c + net_buf.c +) + +target_include_directories(mocks PUBLIC + .. + ${ZEPHYR_BASE}/subsys/bluetooth + ${ZEPHYR_BASE}/subsys/bluetooth/host + ${ZEPHYR_BASE}/tests/bluetooth/host + ${ZEPHYR_BASE}/tests/bluetooth/host/cs/mocks +) + +target_link_libraries(mocks PRIVATE test_interface) diff --git a/tests/bluetooth/host/cs/mocks/conn.c b/tests/bluetooth/host/cs/mocks/conn.c new file mode 100644 index 0000000000000..910a06e3ce351 --- /dev/null +++ b/tests/bluetooth/host/cs/mocks/conn.c @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "mocks/conn.h" + +#include + +DEFINE_FAKE_VOID_FUNC(bt_conn_unref, struct bt_conn *); +DEFINE_FAKE_VALUE_FUNC(struct bt_conn *, bt_conn_lookup_handle, uint16_t, enum bt_conn_type); +DEFINE_FAKE_VOID_FUNC(notify_remote_cs_capabilities, struct bt_conn *, + struct bt_conn_le_cs_capabilities); +DEFINE_FAKE_VOID_FUNC(notify_remote_cs_fae_table, struct bt_conn *, struct bt_conn_le_cs_fae_table); +DEFINE_FAKE_VOID_FUNC(notify_cs_config_created, struct bt_conn *, struct bt_conn_le_cs_config *); +DEFINE_FAKE_VOID_FUNC(notify_cs_config_removed, struct bt_conn *, uint8_t); +DEFINE_FAKE_VOID_FUNC(notify_cs_subevent_result, struct bt_conn *, + struct bt_conn_le_cs_subevent_result *); +DEFINE_FAKE_VOID_FUNC(notify_cs_security_enable_available, struct bt_conn *); +DEFINE_FAKE_VOID_FUNC(notify_cs_procedure_enable_available, struct bt_conn *, + struct bt_conn_le_cs_procedure_enable_complete *); diff --git a/tests/bluetooth/host/cs/mocks/conn.h b/tests/bluetooth/host/cs/mocks/conn.h new file mode 100644 index 0000000000000..70aa9bdfd267a --- /dev/null +++ b/tests/bluetooth/host/cs/mocks/conn.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#include + +/* List of fakes used by this unit tester */ +#define CONN_FFF_FAKES_LIST(FAKE) \ + FAKE(bt_conn_unref) \ + FAKE(bt_conn_lookup_handle) \ + FAKE(notify_remote_cs_capabilities) \ + FAKE(notify_cs_config_created) \ + FAKE(notify_cs_config_removed) \ + FAKE(notify_cs_subevent_result) \ + FAKE(notify_cs_security_enable_available) \ + FAKE(notify_cs_procedure_enable_available) \ + FAKE(notify_remote_cs_fae_table) + +DECLARE_FAKE_VOID_FUNC(bt_conn_unref, struct bt_conn *); +DECLARE_FAKE_VALUE_FUNC(struct bt_conn *, bt_conn_lookup_handle, uint16_t, enum bt_conn_type); +DECLARE_FAKE_VOID_FUNC(notify_remote_cs_capabilities, struct bt_conn *, + struct bt_conn_le_cs_capabilities); +DECLARE_FAKE_VOID_FUNC(notify_remote_cs_fae_table, struct bt_conn *, + struct bt_conn_le_cs_fae_table); +DECLARE_FAKE_VOID_FUNC(notify_cs_config_created, struct bt_conn *, struct bt_conn_le_cs_config *); +DECLARE_FAKE_VOID_FUNC(notify_cs_config_removed, struct bt_conn *, uint8_t); +DECLARE_FAKE_VOID_FUNC(notify_cs_subevent_result, struct bt_conn *, + struct bt_conn_le_cs_subevent_result *); +DECLARE_FAKE_VOID_FUNC(notify_cs_security_enable_available, struct bt_conn *); +DECLARE_FAKE_VOID_FUNC(notify_cs_procedure_enable_available, struct bt_conn *, + struct bt_conn_le_cs_procedure_enable_complete *); diff --git a/tests/bluetooth/host/cs/mocks/hci_core.c b/tests/bluetooth/host/cs/mocks/hci_core.c new file mode 100644 index 0000000000000..34ae77164cc19 --- /dev/null +++ b/tests/bluetooth/host/cs/mocks/hci_core.c @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "mocks/hci_core.h" + +#include +#include + +#include + +struct bt_dev bt_dev = { + .manufacturer = 0x1234, +}; + +DEFINE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_create, uint16_t, uint8_t); +DEFINE_FAKE_VALUE_FUNC(int, bt_hci_cmd_send_sync, uint16_t, struct net_buf *, struct net_buf **); diff --git a/tests/bluetooth/host/cs/mocks/hci_core.h b/tests/bluetooth/host/cs/mocks/hci_core.h new file mode 100644 index 0000000000000..8dc28890755a1 --- /dev/null +++ b/tests/bluetooth/host/cs/mocks/hci_core.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +/* List of fakes used by this unit tester */ +#define HCI_CORE_FFF_FAKES_LIST(FAKE) \ + FAKE(bt_hci_cmd_create) \ + FAKE(bt_hci_cmd_send_sync) + +DECLARE_FAKE_VALUE_FUNC(struct net_buf *, bt_hci_cmd_create, uint16_t, uint8_t); +DECLARE_FAKE_VALUE_FUNC(int, bt_hci_cmd_send_sync, uint16_t, struct net_buf *, struct net_buf **); diff --git a/tests/bluetooth/host/cs/mocks/net_buf.c b/tests/bluetooth/host/cs/mocks/net_buf.c new file mode 100644 index 0000000000000..22ceb93a25e5a --- /dev/null +++ b/tests/bluetooth/host/cs/mocks/net_buf.c @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +#include "mocks/net_buf.h" + +const struct net_buf_data_cb net_buf_fixed_cb; + +DEFINE_FAKE_VOID_FUNC(net_buf_unref, struct net_buf *); +DEFINE_FAKE_VOID_FUNC(net_buf_reset, struct net_buf *); +DEFINE_FAKE_VOID_FUNC(net_buf_slist_put, sys_slist_t *, struct net_buf *); +DEFINE_FAKE_VALUE_FUNC(struct net_buf *, net_buf_alloc_fixed, struct net_buf_pool *, k_timeout_t); diff --git a/tests/bluetooth/host/cs/mocks/net_buf.h b/tests/bluetooth/host/cs/mocks/net_buf.h new file mode 100644 index 0000000000000..14437d3d158c1 --- /dev/null +++ b/tests/bluetooth/host/cs/mocks/net_buf.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +/* List of fakes used by this unit tester */ +#define NET_BUF_FFF_FAKES_LIST(FAKE) \ + FAKE(net_buf_unref) \ + FAKE(net_buf_reset) \ + FAKE(net_buf_slist_put) \ + FAKE(net_buf_alloc_fixed) + +DECLARE_FAKE_VOID_FUNC(net_buf_unref, struct net_buf *); +DECLARE_FAKE_VOID_FUNC(net_buf_reset, struct net_buf *); +DECLARE_FAKE_VOID_FUNC(net_buf_slist_put, sys_slist_t *, struct net_buf *); +DECLARE_FAKE_VALUE_FUNC(struct net_buf *, net_buf_alloc_fixed, struct net_buf_pool *, k_timeout_t); From 7e72d46e2e79e780307246374e1a0ab7e8aae0a4 Mon Sep 17 00:00:00 2001 From: Olivier Lesage Date: Tue, 22 Oct 2024 13:44:35 +0200 Subject: [PATCH 1753/4482] bluetooth: host: Add helper function for parsing PCTs The 12-bit signed values for the results of PBR are a bit cumbersome, so this adds a helper function to make it easier to work with the HCI formatted steps. Signed-off-by: Olivier Lesage --- include/zephyr/bluetooth/cs.h | 18 +++ include/zephyr/bluetooth/hci_types.h | 3 +- subsys/bluetooth/host/cs.c | 18 +++ .../host/cs/bt_le_cs_parse_pct/CMakeLists.txt | 25 +++++ .../host/cs/bt_le_cs_parse_pct/prj.conf | 10 ++ .../host/cs/bt_le_cs_parse_pct/src/main.c | 106 ++++++++++++++++++ .../host/cs/bt_le_cs_parse_pct/testcase.yaml | 7 ++ 7 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 tests/bluetooth/host/cs/bt_le_cs_parse_pct/CMakeLists.txt create mode 100644 tests/bluetooth/host/cs/bt_le_cs_parse_pct/prj.conf create mode 100644 tests/bluetooth/host/cs/bt_le_cs_parse_pct/src/main.c create mode 100644 tests/bluetooth/host/cs/bt_le_cs_parse_pct/testcase.yaml diff --git a/include/zephyr/bluetooth/cs.h b/include/zephyr/bluetooth/cs.h index d5d34039d279b..e7043f667629d 100644 --- a/include/zephyr/bluetooth/cs.h +++ b/include/zephyr/bluetooth/cs.h @@ -551,6 +551,24 @@ struct bt_le_cs_subevent_step { const uint8_t *data; }; +/** Sign-extended IQ value extracted from step data. */ +struct bt_le_cs_iq_sample { + int16_t i; + int16_t q; +}; + +/** @brief Extract in-phase and quadrature terms from HCI-formatted PCT. + * + * Convenience function for processing 24-bit phase correction terms found + * in CS step data. The 12-bit signed real and imaginary components are + * converted to host endianness and sign-extended. + * + * @param pct 24-bit little-endian phase correction term. + * + * @return struct bt_le_cs_iq_sample containing real and imaginary terms as int16_t + */ +struct bt_le_cs_iq_sample bt_le_cs_parse_pct(const uint8_t pct[3]); + /** @brief Set all valid channel map bits * * This command is used to enable all valid channels in a diff --git a/include/zephyr/bluetooth/hci_types.h b/include/zephyr/bluetooth/hci_types.h index d33abf30302de..08be96bd2ff38 100644 --- a/include/zephyr/bluetooth/hci_types.h +++ b/include/zephyr/bluetooth/hci_types.h @@ -3620,7 +3620,8 @@ struct bt_hci_evt_le_cs_config_complete { #define BT_HCI_LE_CS_REF_POWER_LEVEL_UNAVAILABLE 0x7F -#define BT_HCI_LE_CS_PCT_MASK 0xFFF +#define BT_HCI_LE_CS_PCT_I_MASK 0x000FFF +#define BT_HCI_LE_CS_PCT_Q_MASK 0xFFF000 #define BT_HCI_LE_CS_TONE_QUALITY_HIGH 0x0 #define BT_HCI_LE_CS_TONE_QUALITY_MED 0x1 diff --git a/subsys/bluetooth/host/cs.c b/subsys/bluetooth/host/cs.c index aa1e1beadf37d..c11f262b5d226 100644 --- a/subsys/bluetooth/host/cs.c +++ b/subsys/bluetooth/host/cs.c @@ -240,6 +240,24 @@ static void reset_reassembly_results(void) memset(&reassembled_result, 0, sizeof(struct bt_conn_le_cs_subevent_result)); } +/** @brief Converts PCT to a pair of int16_t + * + */ +struct bt_le_cs_iq_sample bt_le_cs_parse_pct(const uint8_t pct[3]) +{ + uint32_t pct_u32 = sys_get_le24(pct); + + /* Extract I and Q. */ + uint16_t i_u16 = pct_u32 & BT_HCI_LE_CS_PCT_I_MASK; + uint16_t q_u16 = (pct_u32 & BT_HCI_LE_CS_PCT_Q_MASK) >> 12; + + /* Convert from 12-bit 2's complement to int16_t */ + int16_t i = (i_u16 ^ BIT(11)) - BIT(11); + int16_t q = (q_u16 ^ BIT(11)) - BIT(11); + + return (struct bt_le_cs_iq_sample){.i = i, .q = q}; +} + void bt_le_cs_set_valid_chmap_bits(uint8_t channel_map[10]) { memset(channel_map, 0xFF, 10); diff --git a/tests/bluetooth/host/cs/bt_le_cs_parse_pct/CMakeLists.txt b/tests/bluetooth/host/cs/bt_le_cs_parse_pct/CMakeLists.txt new file mode 100644 index 0000000000000..089406a316f21 --- /dev/null +++ b/tests/bluetooth/host/cs/bt_le_cs_parse_pct/CMakeLists.txt @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +project(bt_step_data_parse) + +include_directories(BEFORE + ${ZEPHYR_BASE}/tests/bluetooth/host/cs/mocks +) + +add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/host host_mocks) +add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/host/cs/mocks mocks) + +target_link_libraries(testbinary PRIVATE mocks host_mocks) + +target_sources(testbinary + PRIVATE + src/main.c + + ${ZEPHYR_BASE}/subsys/bluetooth/host/cs.c + ${ZEPHYR_BASE}/lib/net_buf/buf_simple.c + ${ZEPHYR_BASE}/subsys/logging/log_minimal.c +) diff --git a/tests/bluetooth/host/cs/bt_le_cs_parse_pct/prj.conf b/tests/bluetooth/host/cs/bt_le_cs_parse_pct/prj.conf new file mode 100644 index 0000000000000..8ff995b6f0405 --- /dev/null +++ b/tests/bluetooth/host/cs/bt_le_cs_parse_pct/prj.conf @@ -0,0 +1,10 @@ +CONFIG_ZTEST=y +CONFIG_BT=y +CONFIG_BT_HCI=y +CONFIG_BT_CENTRAL=y +CONFIG_BT_CHANNEL_SOUNDING=y +CONFIG_ASSERT=y +CONFIG_ASSERT_LEVEL=2 +CONFIG_ASSERT_VERBOSE=y +CONFIG_ASSERT_ON_ERRORS=y +CONFIG_NET_BUF=y diff --git a/tests/bluetooth/host/cs/bt_le_cs_parse_pct/src/main.c b/tests/bluetooth/host/cs/bt_le_cs_parse_pct/src/main.c new file mode 100644 index 0000000000000..70f07748f533b --- /dev/null +++ b/tests/bluetooth/host/cs/bt_le_cs_parse_pct/src/main.c @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +DEFINE_FFF_GLOBALS; + +ZTEST_SUITE(bt_le_cs_parse_pct, NULL, NULL, NULL, NULL, NULL); + +/* + * Test success case + * + * Constraints: + * - Valid PCT is passed in + * + * Expected behaviour: + * - IQ term matches expected values + */ +ZTEST(bt_le_cs_parse_pct, test_parsing_success) +{ + struct bt_le_cs_iq_sample iq; + + struct { + uint8_t input[3]; + struct bt_le_cs_iq_sample output; + } test_vector[] = { + /* Edge cases */ + {.input = {0x00, 0x00, 0x00}, .output = {.i = 0, .q = 0}}, + {.input = {0xFF, 0xFF, 0xFF}, .output = {.i = -1, .q = -1}}, + {.input = {0xFF, 0x00, 0xFF}, .output = {.i = 255, .q = -16}}, + {.input = {0xFF, 0x00, 0x00}, .output = {.i = 255, .q = 0}}, + {.input = {0x00, 0xFF, 0x00}, .output = {.i = -256, .q = 15}}, + {.input = {0x00, 0x00, 0xFF}, .output = {.i = 0, .q = -16}}, + {.input = {0x00, 0x08, 0x80}, .output = {.i = -2048, .q = -2048}}, + {.input = {0xFF, 0xF7, 0x7F}, .output = {.i = 2047, .q = 2047}}, + + /* Randomly generated using python */ + {.input = {0xEF, 0xCD, 0xAB}, .output = {.i = -529, .q = -1348}}, + {.input = {0x30, 0x75, 0x44}, .output = {.i = 1328, .q = 1095}}, + {.input = {0x46, 0x5D, 0xEB}, .output = {.i = -698, .q = -331}}, + {.input = {0xE8, 0x14, 0x45}, .output = {.i = 1256, .q = 1105}}, + {.input = {0x23, 0xCA, 0x5C}, .output = {.i = -1501, .q = 1484}}, + {.input = {0x68, 0xA0, 0x15}, .output = {.i = 104, .q = 346}}, + {.input = {0x39, 0x73, 0x1B}, .output = {.i = 825, .q = 439}}, + {.input = {0x23, 0x72, 0x3D}, .output = {.i = 547, .q = 983}}, + {.input = {0xF5, 0xF8, 0x3D}, .output = {.i = -1803, .q = 991}}, + {.input = {0xF7, 0xB4, 0xB9}, .output = {.i = 1271, .q = -1125}}, + {.input = {0x61, 0x9F, 0xD5}, .output = {.i = -159, .q = -679}}, + {.input = {0x9B, 0x21, 0xC6}, .output = {.i = 411, .q = -926}}, + {.input = {0x14, 0x86, 0x0F}, .output = {.i = 1556, .q = 248}}, + {.input = {0x8E, 0xBB, 0xC6}, .output = {.i = -1138, .q = -917}}, + {.input = {0x5B, 0xD1, 0xC2}, .output = {.i = 347, .q = -979}}, + {.input = {0x99, 0x4A, 0x28}, .output = {.i = -1383, .q = 644}}, + {.input = {0x32, 0x16, 0x2B}, .output = {.i = 1586, .q = 689}}, + {.input = {0x3E, 0x8C, 0xD4}, .output = {.i = -962, .q = -696}}, + {.input = {0x2B, 0x1F, 0x95}, .output = {.i = -213, .q = -1711}}, + {.input = {0x22, 0xE6, 0xD6}, .output = {.i = 1570, .q = -658}}, + {.input = {0x0B, 0x31, 0xD6}, .output = {.i = 267, .q = -669}}, + {.input = {0x1B, 0x98, 0x9D}, .output = {.i = -2021, .q = -1575}}, + {.input = {0x8E, 0x97, 0x63}, .output = {.i = 1934, .q = 1593}}, + {.input = {0x97, 0x91, 0x8D}, .output = {.i = 407, .q = -1831}}, + {.input = {0x67, 0xF7, 0x1F}, .output = {.i = 1895, .q = 511}}, + {.input = {0xD6, 0x5C, 0x23}, .output = {.i = -810, .q = 565}}, + {.input = {0x92, 0xD3, 0x0B}, .output = {.i = 914, .q = 189}}, + {.input = {0xE8, 0xF3, 0x23}, .output = {.i = 1000, .q = 575}}, + {.input = {0xE6, 0xE3, 0xAD}, .output = {.i = 998, .q = -1314}}, + {.input = {0x6E, 0x70, 0xA9}, .output = {.i = 110, .q = -1385}}, + {.input = {0x63, 0x65, 0x28}, .output = {.i = 1379, .q = 646}}, + {.input = {0x27, 0x0F, 0x32}, .output = {.i = -217, .q = 800}}, + {.input = {0x3F, 0x8C, 0xE1}, .output = {.i = -961, .q = -488}}, + {.input = {0x4E, 0x86, 0xAA}, .output = {.i = 1614, .q = -1368}}, + {.input = {0x9E, 0xD1, 0xF6}, .output = {.i = 414, .q = -147}}, + {.input = {0x86, 0x09, 0x56}, .output = {.i = -1658, .q = 1376}}, + {.input = {0xFF, 0x09, 0x41}, .output = {.i = -1537, .q = 1040}}, + {.input = {0x89, 0xC5, 0x1F}, .output = {.i = 1417, .q = 508}}, + {.input = {0x1A, 0xE2, 0x9A}, .output = {.i = 538, .q = -1618}}, + {.input = {0x7E, 0x03, 0xB8}, .output = {.i = 894, .q = -1152}}, + {.input = {0x5E, 0x28, 0xB3}, .output = {.i = -1954, .q = -1230}}, + {.input = {0xFF, 0x50, 0xF0}, .output = {.i = 255, .q = -251}}, + {.input = {0xB0, 0x07, 0x87}, .output = {.i = 1968, .q = -1936}}, + {.input = {0x7E, 0xD7, 0x0C}, .output = {.i = 1918, .q = 205}}, + {.input = {0x26, 0xA2, 0xC9}, .output = {.i = 550, .q = -870}}, + {.input = {0x97, 0x71, 0x72}, .output = {.i = 407, .q = 1831}}, + {.input = {0x73, 0x0E, 0xC1}, .output = {.i = -397, .q = -1008}}, + {.input = {0xAC, 0x20, 0x6B}, .output = {.i = 172, .q = 1714}}, + {.input = {0x85, 0x7D, 0xB4}, .output = {.i = -635, .q = -1209}}, + {.input = {0xCC, 0xE3, 0x1B}, .output = {.i = 972, .q = 446}}, + {.input = {0x88, 0x48, 0x65}, .output = {.i = -1912, .q = 1620}}, + }; + + for (uint16_t k = 0; k < ARRAY_SIZE(test_vector); k++) { + iq = bt_le_cs_parse_pct(test_vector[k].input); + + zassert_equal(iq.i, test_vector[k].output.i, + "Failed for k = %u, expected %d, not %d", k, test_vector[k].output.i, + iq.i); + zassert_equal(iq.q, test_vector[k].output.q, + "Failed for k = %u, expected %d, not %d", k, test_vector[k].output.q, + iq.q); + } +} diff --git a/tests/bluetooth/host/cs/bt_le_cs_parse_pct/testcase.yaml b/tests/bluetooth/host/cs/bt_le_cs_parse_pct/testcase.yaml new file mode 100644 index 0000000000000..deab8ebd2949a --- /dev/null +++ b/tests/bluetooth/host/cs/bt_le_cs_parse_pct/testcase.yaml @@ -0,0 +1,7 @@ +common: + tags: + - bluetooth + - host +tests: + bluetooth.host.cs.bt_le_cs_parse_pct: + type: unit From f970b066d210af56ab6159b2c22e825230c212b9 Mon Sep 17 00:00:00 2001 From: Fredrik Danebjer Date: Tue, 22 Oct 2024 14:45:25 +0200 Subject: [PATCH 1754/4482] Bluetooth: audio: Add possibility to use static broadcast id Removed the generation of broadcast id inside the stack. It is now up to the application to generate this by itself. The CAP sample has been modified to allow either a static broadcast, or a random one. All of this is handled in the application. Signed-off-by: Fredrik Danebjer --- doc/releases/migration-guide-4.0.rst | 7 ++ include/zephyr/bluetooth/audio/bap.h | 16 ---- include/zephyr/bluetooth/audio/cap.h | 17 ----- .../bluetooth/bap_broadcast_source/Kconfig | 14 ++++ .../bluetooth/bap_broadcast_source/prj.conf | 1 + .../bluetooth/bap_broadcast_source/src/main.c | 12 ++- samples/bluetooth/cap_initiator/Kconfig | 14 ++++ samples/bluetooth/cap_initiator/prj.conf | 1 + .../src/cap_initiator_broadcast.c | 10 ++- .../pbp_public_broadcast_source/Kconfig | 20 +++++ .../pbp_public_broadcast_source/prj.conf | 1 + .../pbp_public_broadcast_source/src/main.c | 11 ++- .../bluetooth/tmap_bms/src/cap_initiator.c | 6 +- subsys/bluetooth/audio/bap_broadcast_source.c | 64 ---------------- subsys/bluetooth/audio/bap_endpoint.h | 1 - subsys/bluetooth/audio/cap_initiator.c | 11 --- subsys/bluetooth/audio/shell/bap.c | 4 +- subsys/bluetooth/audio/shell/cap_initiator.c | 6 +- .../audio/bap_broadcast_source/src/main.c | 73 ------------------- .../tester/src/audio/btp_bap_broadcast.c | 11 +-- tests/bluetooth/tester/src/audio/btp_cap.c | 7 +- .../audio/src/bap_broadcast_source_test.c | 18 ++--- .../audio/src/cap_initiator_broadcast_test.c | 6 +- .../bsim/bluetooth/audio/src/gmap_ugg_test.c | 6 +- .../src/pbp_public_broadcast_source_test.c | 7 +- 25 files changed, 112 insertions(+), 232 deletions(-) create mode 100644 samples/bluetooth/pbp_public_broadcast_source/Kconfig diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index b3ec144473fad..f68275f286c5e 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -388,6 +388,13 @@ Bluetooth Audio do a search-and-replace for ``bt_audio_codec_qos`` to ``bt_bap_qos_cfg`` and ``BT_AUDIO_CODEC_QOS`` to ``BT_BAP_QOS_CFG``. (:github:`76633`) +* The generation of broadcast ID inside of zephyr stack has been removed, it is now up the + application to generate a broadcast ID. This means that the application can now fully decide + whether to use a static or random broadcast ID. Reusing and statically defining a broadcast ID was + added to the Basic Audio Profile in version 1.0.2, which is the basis for this change. All + instances of :c:func:`bt_cap_initiator_broadcast_get_id` and + :c:func:`bt_bap_broadcast_source_get_id` has been removed(:github:`80228`) + Bluetooth Classic ================= diff --git a/include/zephyr/bluetooth/audio/bap.h b/include/zephyr/bluetooth/audio/bap.h index 73433035e823a..e2dc29ac3a0a9 100644 --- a/include/zephyr/bluetooth/audio/bap.h +++ b/include/zephyr/bluetooth/audio/bap.h @@ -2184,22 +2184,6 @@ int bt_bap_broadcast_source_stop(struct bt_bap_broadcast_source *source); */ int bt_bap_broadcast_source_delete(struct bt_bap_broadcast_source *source); -/** - * @brief Get the broadcast ID of a broadcast source - * - * This will return the 3-octet broadcast ID that should be advertised in the - * extended advertising data with @ref BT_UUID_BROADCAST_AUDIO_VAL as @ref BT_DATA_SVC_DATA16. - * - * See table 3.14 in the Basic Audio Profile v1.0.1 for the structure. - * - * @param[in] source Pointer to the broadcast source. - * @param[out] broadcast_id Pointer to the 3-octet broadcast ID. - * - * @return Zero on success or (negative) error code otherwise. - */ -int bt_bap_broadcast_source_get_id(struct bt_bap_broadcast_source *source, - uint32_t *const broadcast_id); - /** * @brief Get the Broadcast Audio Stream Endpoint of a broadcast source * diff --git a/include/zephyr/bluetooth/audio/cap.h b/include/zephyr/bluetooth/audio/cap.h index 13a004babddd1..a90a464c7ccfd 100644 --- a/include/zephyr/bluetooth/audio/cap.h +++ b/include/zephyr/bluetooth/audio/cap.h @@ -603,23 +603,6 @@ int bt_cap_initiator_broadcast_audio_stop(struct bt_cap_broadcast_source *broadc */ int bt_cap_initiator_broadcast_audio_delete(struct bt_cap_broadcast_source *broadcast_source); -/** - * @brief Get the broadcast ID of a Common Audio Profile broadcast source - * - * This will return the 3-octet broadcast ID that should be advertised in the - * extended advertising data with @ref BT_UUID_BROADCAST_AUDIO_VAL as - * @ref BT_DATA_SVC_DATA16. - * - * See table 3.14 in the Basic Audio Profile v1.0.1 for the structure. - * - * @param[in] broadcast_source Pointer to the broadcast source. - * @param[out] broadcast_id Pointer to the 3-octet broadcast ID. - * - * @return int 0 if on success, errno on error. - */ -int bt_cap_initiator_broadcast_get_id(const struct bt_cap_broadcast_source *broadcast_source, - uint32_t *const broadcast_id); - /** * @brief Get the Broadcast Audio Stream Endpoint of a Common Audio Profile broadcast source * diff --git a/samples/bluetooth/bap_broadcast_source/Kconfig b/samples/bluetooth/bap_broadcast_source/Kconfig index 0189da81b6921..97ec40502f931 100644 --- a/samples/bluetooth/bap_broadcast_source/Kconfig +++ b/samples/bluetooth/bap_broadcast_source/Kconfig @@ -45,4 +45,18 @@ config BROADCAST_CODE Setting a non-empty string for this option will encrypt the broadcast using this string as the broadcast code. The length of the string shall be between 1 and 16 octets. +config STATIC_BROADCAST_ID + bool "Use static broadcast ID" + default y + help + Enabling this option will make the application use static broadcast ID, as opposed to a + randomly generated one. + +config BROADCAST_ID + hex "The static broadcast ID to use" + range 0x000000 0xFFFFFF + depends on STATIC_BROADCAST_ID + help + This is the 3-octet broadcast ID advertised if static broadcast IDs are enabled. + source "Kconfig.zephyr" diff --git a/samples/bluetooth/bap_broadcast_source/prj.conf b/samples/bluetooth/bap_broadcast_source/prj.conf index 746b7fff42341..9fd23815bd920 100644 --- a/samples/bluetooth/bap_broadcast_source/prj.conf +++ b/samples/bluetooth/bap_broadcast_source/prj.conf @@ -14,3 +14,4 @@ CONFIG_BT_ISO_TX_BUF_COUNT=6 CONFIG_BT_ISO_TX_MTU=60 CONFIG_BT_DEVICE_NAME="Broadcast Audio Source" +CONFIG_BROADCAST_ID=0x123456 diff --git a/samples/bluetooth/bap_broadcast_source/src/main.c b/samples/bluetooth/bap_broadcast_source/src/main.c index 7e93fee32da65..b703c25cceb8f 100644 --- a/samples/bluetooth/bap_broadcast_source/src/main.c +++ b/samples/bluetooth/bap_broadcast_source/src/main.c @@ -518,11 +518,15 @@ int main(void) return 0; } - err = bt_bap_broadcast_source_get_id(broadcast_source, &broadcast_id); - if (err != 0) { - printk("Unable to get broadcast ID: %d\n", err); - return 0; +#if defined(CONFIG_STATIC_BROADCAST_ID) + broadcast_id = CONFIG_BROADCAST_ID; +#else + err = bt_rand(&broadcast_id, BT_AUDIO_BROADCAST_ID_SIZE); + if (err) { + printk("Unable to generate broadcast ID: %d\n", err); + return err; } +#endif /* CONFIG_STATIC_BROADCAST_ID */ /* Setup extended advertising data */ net_buf_simple_add_le16(&ad_buf, BT_UUID_BROADCAST_AUDIO_VAL); diff --git a/samples/bluetooth/cap_initiator/Kconfig b/samples/bluetooth/cap_initiator/Kconfig index 32b7a4503fc0a..fecba8e247fe6 100644 --- a/samples/bluetooth/cap_initiator/Kconfig +++ b/samples/bluetooth/cap_initiator/Kconfig @@ -26,4 +26,18 @@ config SAMPLE_BROADCAST help If set to true, the sample will start advertising syncable audio streams +config STATIC_BROADCAST_ID + bool "Use static broadcast ID" + default y + help + Enabling this option will make the application use static broadcast ID, as opposed to a + randomly generated one. + +config BROADCAST_ID + hex "The static broadcast ID to use" + range 0x000000 0xFFFFFF + depends on STATIC_BROADCAST_ID + help + This is the 3-octet broadcast ID advertised if static broadcast IDs are enabled. + source "Kconfig.zephyr" diff --git a/samples/bluetooth/cap_initiator/prj.conf b/samples/bluetooth/cap_initiator/prj.conf index c1182a5f2be16..18887a33429d6 100644 --- a/samples/bluetooth/cap_initiator/prj.conf +++ b/samples/bluetooth/cap_initiator/prj.conf @@ -23,3 +23,4 @@ CONFIG_BT_BAP_BROADCAST_SOURCE=y # Broadcast sources values if enabled by CONFIG_SAMPLE_BROADCAST CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT=2 CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT=1 +CONFIG_BROADCAST_ID=0x123456 diff --git a/samples/bluetooth/cap_initiator/src/cap_initiator_broadcast.c b/samples/bluetooth/cap_initiator/src/cap_initiator_broadcast.c index 1880e587446f3..d55f0f6c3b790 100644 --- a/samples/bluetooth/cap_initiator/src/cap_initiator_broadcast.c +++ b/samples/bluetooth/cap_initiator/src/cap_initiator_broadcast.c @@ -133,11 +133,15 @@ static int setup_extended_adv_data(struct bt_cap_broadcast_source *source, uint32_t broadcast_id; int err; - err = bt_cap_initiator_broadcast_get_id(source, &broadcast_id); - if (err != 0) { - LOG_ERR("Unable to get broadcast ID: %d", err); +#if defined(CONFIG_STATIC_BROADCAST_ID) + broadcast_id = CONFIG_BROADCAST_ID; +#else + err = bt_rand(&broadcast_id, BT_AUDIO_BROADCAST_ID_SIZE); + if (err) { + printk("Unable to generate broadcast ID: %d\n", err); return err; } +#endif /* CONFIG_STATIC_BROADCAST_ID */ /* Setup extended advertising data */ net_buf_simple_add_le16(&ad_buf, BT_UUID_BROADCAST_AUDIO_VAL); diff --git a/samples/bluetooth/pbp_public_broadcast_source/Kconfig b/samples/bluetooth/pbp_public_broadcast_source/Kconfig new file mode 100644 index 0000000000000..e41451107d4f3 --- /dev/null +++ b/samples/bluetooth/pbp_public_broadcast_source/Kconfig @@ -0,0 +1,20 @@ +# Copyright (c) 2024 Demant A/S +# SPDX-License-Identifier: Apache-2.0 + +mainmenu "Bluetooth: PBP Broadcast Audio Source" + +config STATIC_BROADCAST_ID + bool "Use static broadcast ID" + default y + help + Enabling this option will make the application use static broadcast ID, as opposed to a + randomly generated one. + +config BROADCAST_ID + hex "The static broadcast ID to use" + range 0x000000 0xFFFFFF + depends on STATIC_BROADCAST_ID + help + This is the 3-octet broadcast ID advertised if static broadcast IDs are enabled. + +source "Kconfig.zephyr" diff --git a/samples/bluetooth/pbp_public_broadcast_source/prj.conf b/samples/bluetooth/pbp_public_broadcast_source/prj.conf index ca7d3f38261b7..3caa15a383a2f 100644 --- a/samples/bluetooth/pbp_public_broadcast_source/prj.conf +++ b/samples/bluetooth/pbp_public_broadcast_source/prj.conf @@ -24,3 +24,4 @@ CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT=1 CONFIG_BT_EXT_ADV=y CONFIG_BT_DEVICE_NAME="PBS" +CONFIG_STATIC_BROADCAST_ID=n diff --git a/samples/bluetooth/pbp_public_broadcast_source/src/main.c b/samples/bluetooth/pbp_public_broadcast_source/src/main.c index f2a7ebd81254c..a365ecbfb9431 100644 --- a/samples/bluetooth/pbp_public_broadcast_source/src/main.c +++ b/samples/bluetooth/pbp_public_broadcast_source/src/main.c @@ -189,12 +189,15 @@ static int setup_extended_adv_data(struct bt_cap_broadcast_source *source, uint32_t broadcast_id; int err; - err = bt_cap_initiator_broadcast_get_id(source, &broadcast_id); - if (err != 0) { - printk("Unable to get broadcast ID: %d\n", err); - +#if defined(CONFIG_STATIC_BROADCAST_ID) + broadcast_id = CONFIG_BROADCAST_ID; +#else + err = bt_rand(&broadcast_id, BT_AUDIO_BROADCAST_ID_SIZE); + if (err) { + printk("Unable to generate broadcast ID: %d\n", err); return err; } +#endif /* CONFIG_STATIC_BROADCAST_ID */ /* Setup extended advertising data */ ext_ad[0].type = BT_DATA_GAP_APPEARANCE; diff --git a/samples/bluetooth/tmap_bms/src/cap_initiator.c b/samples/bluetooth/tmap_bms/src/cap_initiator.c index e038e13f7e9c7..5ea8f88475b86 100644 --- a/samples/bluetooth/tmap_bms/src/cap_initiator.c +++ b/samples/bluetooth/tmap_bms/src/cap_initiator.c @@ -172,9 +172,9 @@ static int setup_extended_adv_data(struct bt_cap_broadcast_source *source, uint32_t broadcast_id; int err; - err = bt_cap_initiator_broadcast_get_id(source, &broadcast_id); - if (err != 0) { - printk("Unable to get broadcast ID: %d\n", err); + err = bt_rand(&broadcast_id, BT_AUDIO_BROADCAST_ID_SIZE); + if (err) { + printk("Unable to generate broadcast ID: %d\n", err); return err; } diff --git a/subsys/bluetooth/audio/bap_broadcast_source.c b/subsys/bluetooth/audio/bap_broadcast_source.c index 26a1f6bb5d02a..93186af67f0f7 100644 --- a/subsys/bluetooth/audio/bap_broadcast_source.c +++ b/subsys/bluetooth/audio/bap_broadcast_source.c @@ -450,36 +450,6 @@ static bool encode_base(struct bt_bap_broadcast_source *source, struct net_buf_s return true; } -static int generate_broadcast_id(struct bt_bap_broadcast_source *source) -{ - bool unique; - - do { - int err; - - err = bt_rand(&source->broadcast_id, - BT_AUDIO_BROADCAST_ID_SIZE); - if (err) { - return err; - } - - /* Ensure uniqueness */ - unique = true; - for (int i = 0; i < ARRAY_SIZE(broadcast_sources); i++) { - if (&broadcast_sources[i] == source) { - continue; - } - - if (broadcast_sources[i].broadcast_id == source->broadcast_id) { - unique = false; - break; - } - } - } while (!unique); - - return 0; -} - static void broadcast_source_cleanup(struct bt_bap_broadcast_source *source) { struct bt_bap_broadcast_subgroup *subgroup, *next_subgroup; @@ -830,12 +800,6 @@ int bt_bap_broadcast_source_create(struct bt_bap_broadcast_source_param *param, } } - err = generate_broadcast_id(source); - if (err != 0) { - LOG_DBG("Could not generate broadcast id: %d", err); - return err; - } - /* Finalize state changes and store information */ broadcast_source_set_state(source, BT_BAP_EP_STATE_QOS_CONFIGURED); source->qos = qos; @@ -852,8 +816,6 @@ int bt_bap_broadcast_source_create(struct bt_bap_broadcast_source_param *param, sizeof(source->broadcast_code)); } - LOG_DBG("Broadcasting with ID 0x%6X", source->broadcast_id); - *out_source = source; return 0; @@ -1197,32 +1159,6 @@ int bt_bap_broadcast_source_delete(struct bt_bap_broadcast_source *source) return 0; } -int bt_bap_broadcast_source_get_id(struct bt_bap_broadcast_source *source, - uint32_t *const broadcast_id) -{ - enum bt_bap_ep_state broadcast_state; - - CHECKIF(source == NULL) { - LOG_DBG("source is NULL"); - return -EINVAL; - } - - CHECKIF(broadcast_id == NULL) { - LOG_DBG("broadcast_id is NULL"); - return -EINVAL; - } - - broadcast_state = broadcast_source_get_state(source); - if (broadcast_state == BT_BAP_EP_STATE_IDLE) { - LOG_DBG("Broadcast source invalid state: %u", broadcast_state); - return -EBADMSG; - } - - *broadcast_id = source->broadcast_id; - - return 0; -} - int bt_bap_broadcast_source_get_base(struct bt_bap_broadcast_source *source, struct net_buf_simple *base_buf) { diff --git a/subsys/bluetooth/audio/bap_endpoint.h b/subsys/bluetooth/audio/bap_endpoint.h index b127bc601f0cc..83d7e34ddd0fc 100644 --- a/subsys/bluetooth/audio/bap_endpoint.h +++ b/subsys/bluetooth/audio/bap_endpoint.h @@ -108,7 +108,6 @@ struct bt_bap_broadcast_source { uint8_t stream_count; uint8_t packing; bool encryption; - uint32_t broadcast_id; /* 24 bit */ struct bt_iso_big *big; struct bt_bap_qos_cfg *qos; diff --git a/subsys/bluetooth/audio/cap_initiator.c b/subsys/bluetooth/audio/cap_initiator.c index 486d173ff4665..b79a07ef08cf7 100644 --- a/subsys/bluetooth/audio/cap_initiator.c +++ b/subsys/bluetooth/audio/cap_initiator.c @@ -322,17 +322,6 @@ int bt_cap_initiator_broadcast_audio_delete(struct bt_cap_broadcast_source *broa return err; } -int bt_cap_initiator_broadcast_get_id(const struct bt_cap_broadcast_source *broadcast_source, - uint32_t *const broadcast_id) -{ - CHECKIF(broadcast_source == NULL) { - LOG_DBG("broadcast_source is NULL"); - return -EINVAL; - } - - return bt_bap_broadcast_source_get_id(broadcast_source->bap_broadcast, broadcast_id); -} - int bt_cap_initiator_broadcast_get_base(struct bt_cap_broadcast_source *broadcast_source, struct net_buf_simple *base_buf) { diff --git a/subsys/bluetooth/audio/shell/bap.c b/subsys/bluetooth/audio/shell/bap.c index 6850761321933..9f53a3769972b 100644 --- a/subsys/bluetooth/audio/shell/bap.c +++ b/subsys/bluetooth/audio/shell/bap.c @@ -4329,9 +4329,9 @@ static ssize_t nonconnectable_ad_data_add(struct bt_data *data_array, uint32_t broadcast_id; int err; - err = bt_bap_broadcast_source_get_id(default_source.bap_source, &broadcast_id); + err = bt_rand(&broadcast_id, BT_AUDIO_BROADCAST_ID_SIZE); if (err != 0) { - printk("Unable to get broadcast ID: %d\n", err); + printk("Unable to generate broadcast ID: %d\n", err); return -1; } diff --git a/subsys/bluetooth/audio/shell/cap_initiator.c b/subsys/bluetooth/audio/shell/cap_initiator.c index 6809d870de06c..b55cee3ad28a5 100644 --- a/subsys/bluetooth/audio/shell/cap_initiator.c +++ b/subsys/bluetooth/audio/shell/cap_initiator.c @@ -1447,9 +1447,9 @@ static ssize_t nonconnectable_ad_data_add(struct bt_data *data_array, const size uint32_t broadcast_id; int err; - err = bt_cap_initiator_broadcast_get_id(default_source.cap_source, &broadcast_id); - if (err != 0) { - printk("Unable to get broadcast ID: %d\n", err); + err = bt_rand(&broadcast_id, BT_AUDIO_BROADCAST_ID_SIZE); + if (err) { + printk("Unable to generate broadcast ID: %d\n", err); return -1; } diff --git a/tests/bluetooth/audio/bap_broadcast_source/src/main.c b/tests/bluetooth/audio/bap_broadcast_source/src/main.c index d1e1194986325..82e6406919f1b 100644 --- a/tests/bluetooth/audio/bap_broadcast_source/src/main.c +++ b/tests/bluetooth/audio/bap_broadcast_source/src/main.c @@ -1163,79 +1163,6 @@ ZTEST_F(bap_broadcast_source_test_suite, test_broadcast_source_delete_inval_doub zassert_not_equal(0, err, "Did not fail with deleting already deleting source"); } -ZTEST_F(bap_broadcast_source_test_suite, test_broadcast_source_get_id) -{ - struct bt_bap_broadcast_source_param *create_param = fixture->param; - uint32_t broadcast_id; - int err; - - printk("Creating broadcast source with %zu subgroups with %zu streams\n", - create_param->params_count, fixture->stream_cnt); - - err = bt_bap_broadcast_source_create(create_param, &fixture->source); - zassert_equal(0, err, "Unable to create broadcast source: err %d", err); - - err = bt_bap_broadcast_source_get_id(fixture->source, &broadcast_id); - zassert_equal(0, err, "Unable to get broadcast ID: err %d", err); - - err = bt_bap_broadcast_source_delete(fixture->source); - zassert_equal(0, err, "Unable to delete broadcast source: err %d", err); - fixture->source = NULL; -} - -ZTEST_F(bap_broadcast_source_test_suite, test_broadcast_source_get_id_inval_source_null) -{ - uint32_t broadcast_id; - int err; - - err = bt_bap_broadcast_source_get_id(NULL, &broadcast_id); - zassert_not_equal(0, err, "Did not fail with null source"); -} - -ZTEST_F(bap_broadcast_source_test_suite, test_broadcast_source_get_id_inval_id_null) -{ - struct bt_bap_broadcast_source_param *create_param = fixture->param; - int err; - - printk("Creating broadcast source with %zu subgroups with %zu streams\n", - create_param->params_count, fixture->stream_cnt); - - err = bt_bap_broadcast_source_create(create_param, &fixture->source); - zassert_equal(0, err, "Unable to create broadcast source: err %d", err); - - err = bt_bap_broadcast_source_get_id(fixture->source, NULL); - zassert_not_equal(0, err, "Did not fail with null ID"); - - err = bt_bap_broadcast_source_delete(fixture->source); - zassert_equal(0, err, "Unable to delete broadcast source: err %d", err); - fixture->source = NULL; -} - -ZTEST_F(bap_broadcast_source_test_suite, test_broadcast_source_get_id_inval_state) -{ - struct bt_bap_broadcast_source_param *create_param = fixture->param; - struct bt_bap_broadcast_source *source; - uint32_t broadcast_id; - int err; - - printk("Creating broadcast source with %zu subgroups with %zu streams\n", - create_param->params_count, fixture->stream_cnt); - - err = bt_bap_broadcast_source_create(create_param, &fixture->source); - zassert_equal(0, err, "Unable to create broadcast source: err %d", err); - - source = fixture->source; - - err = bt_bap_broadcast_source_delete(fixture->source); - zassert_equal(0, err, "Unable to delete broadcast source: err %d", err); - fixture->source = NULL; - - err = bt_bap_broadcast_source_get_id(source, &broadcast_id); - zassert_not_equal(0, err, "Did not fail with deleted broadcast source"); -} - - - ZTEST_F(bap_broadcast_source_test_suite, test_broadcast_source_get_base_single_bis) { struct bt_bap_broadcast_source_param *create_param = fixture->param; diff --git a/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c b/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c index 574ae5e61f93b..f94a9cfc3210b 100644 --- a/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c +++ b/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c @@ -298,6 +298,7 @@ uint8_t btp_bap_broadcast_source_setup(const void *cmd, uint16_t cmd_len, const struct btp_bap_broadcast_source_setup_cmd *cp = cmd; struct btp_bap_broadcast_source_setup_rp *rp = rsp; struct bt_le_adv_param param = *BT_LE_EXT_ADV_NCONN; + uint32_t broadcast_id; /* Only one local source/BIG supported for now */ struct btp_bap_broadcast_local_source *source = &local_source; @@ -338,16 +339,16 @@ uint8_t btp_bap_broadcast_source_setup(const void *cmd, uint16_t cmd_len, return BTP_STATUS_FAILED; } - err = bt_bap_broadcast_source_get_id(source->bap_broadcast, &source->broadcast_id); - if (err != 0) { - LOG_DBG("Unable to get broadcast ID: %d", err); + err = bt_rand(&broadcast_id, BT_AUDIO_BROADCAST_ID_SIZE); + if (err) { + LOG_DBG("Unable to generate broadcast ID: %d\n", err); return BTP_STATUS_FAILED; } /* Setup extended advertising data */ net_buf_simple_add_le16(&ad_buf, BT_UUID_BROADCAST_AUDIO_VAL); - net_buf_simple_add_le24(&ad_buf, source->broadcast_id); + net_buf_simple_add_le24(&ad_buf, broadcast_id); base_ad[0].type = BT_DATA_SVC_DATA16; base_ad[0].data_len = ad_buf.len; base_ad[0].data = ad_buf.data; @@ -387,7 +388,7 @@ uint8_t btp_bap_broadcast_source_setup(const void *cmd, uint16_t cmd_len, } rp->gap_settings = gap_settings; - sys_put_le24(source->broadcast_id, rp->broadcast_id); + sys_put_le24(broadcast_id, rp->broadcast_id); *rsp_len = sizeof(*rp) + 1; return BTP_STATUS_SUCCESS; diff --git a/tests/bluetooth/tester/src/audio/btp_cap.c b/tests/bluetooth/tester/src/audio/btp_cap.c index ed0ebfacbfb86..ea0aedd52b8e1 100644 --- a/tests/bluetooth/tester/src/audio/btp_cap.c +++ b/tests/bluetooth/tester/src/audio/btp_cap.c @@ -534,6 +534,7 @@ static int cap_broadcast_source_adv_setup(struct btp_bap_broadcast_local_source { int err; struct bt_le_adv_param param = *BT_LE_EXT_ADV_NCONN; + uint32_t broadcast_id; NET_BUF_SIMPLE_DEFINE(ad_buf, BT_UUID_SIZE_16 + BT_AUDIO_BROADCAST_ID_SIZE); NET_BUF_SIMPLE_DEFINE(base_buf, 128); @@ -542,9 +543,9 @@ static int cap_broadcast_source_adv_setup(struct btp_bap_broadcast_local_source struct bt_data base_ad[2]; struct bt_data per_ad; - err = bt_cap_initiator_broadcast_get_id(source->cap_broadcast, &source->broadcast_id); - if (err != 0) { - LOG_DBG("Unable to get broadcast ID: %d", err); + err = bt_rand(&broadcast_id, BT_AUDIO_BROADCAST_ID_SIZE); + if (err) { + printk("Unable to generate broadcast ID: %d\n", err); return -EINVAL; } diff --git a/tests/bsim/bluetooth/audio/src/bap_broadcast_source_test.c b/tests/bsim/bluetooth/audio/src/bap_broadcast_source_test.c index 5d7cc1717200b..330687088f0a7 100644 --- a/tests/bsim/bluetooth/audio/src/bap_broadcast_source_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_broadcast_source_test.c @@ -321,18 +321,6 @@ static int setup_broadcast_source(struct bt_bap_broadcast_source **source, bool return 0; } -static void test_broadcast_source_get_id(struct bt_bap_broadcast_source *source, - uint32_t *broadcast_id_out) -{ - int err; - - err = bt_bap_broadcast_source_get_id(source, broadcast_id_out); - if (err != 0) { - FAIL("Unable to get broadcast ID: %d\n", err); - return; - } -} - static void test_broadcast_source_get_base(struct bt_bap_broadcast_source *source, struct net_buf_simple *base_buf) { @@ -373,7 +361,11 @@ static int setup_extended_adv(struct bt_bap_broadcast_source *source, struct bt_ return err; } - test_broadcast_source_get_id(source, &broadcast_id); + err = bt_rand(&broadcast_id, BT_AUDIO_BROADCAST_ID_SIZE); + if (err) { + printk("Unable to generate broadcast ID: %d\n", err); + return err; + } /* Setup extended advertising data */ net_buf_simple_add_le16(&ad_buf, BT_UUID_BROADCAST_AUDIO_VAL); diff --git a/tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c b/tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c index d1d6618b83bd4..9b9ad2d335490 100644 --- a/tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c @@ -249,9 +249,9 @@ static void setup_extended_adv_data(struct bt_cap_broadcast_source *source, uint32_t broadcast_id; int err; - err = bt_cap_initiator_broadcast_get_id(source, &broadcast_id); - if (err != 0) { - FAIL("Unable to get broadcast ID: %d\n", err); + err = bt_rand(&broadcast_id, BT_AUDIO_BROADCAST_ID_SIZE); + if (err) { + FAIL("Unable to generate broadcast ID: %d\n", err); return; } diff --git a/tests/bsim/bluetooth/audio/src/gmap_ugg_test.c b/tests/bsim/bluetooth/audio/src/gmap_ugg_test.c index d1039e64aee81..c50f5104f0ddf 100644 --- a/tests/bsim/bluetooth/audio/src/gmap_ugg_test.c +++ b/tests/bsim/bluetooth/audio/src/gmap_ugg_test.c @@ -1055,9 +1055,9 @@ static void setup_extended_adv_data(struct bt_cap_broadcast_source *source, uint32_t broadcast_id; int err; - err = bt_cap_initiator_broadcast_get_id(source, &broadcast_id); - if (err != 0) { - FAIL("Unable to get broadcast ID: %d\n", err); + err = bt_rand(&broadcast_id, BT_AUDIO_BROADCAST_ID_SIZE); + if (err) { + FAIL("Unable to generate broadcast ID: %d\n", err); return; } diff --git a/tests/bsim/bluetooth/audio/src/pbp_public_broadcast_source_test.c b/tests/bsim/bluetooth/audio/src/pbp_public_broadcast_source_test.c index c9812f10b04c0..cd703406e32fc 100644 --- a/tests/bsim/bluetooth/audio/src/pbp_public_broadcast_source_test.c +++ b/tests/bsim/bluetooth/audio/src/pbp_public_broadcast_source_test.c @@ -135,10 +135,9 @@ static int setup_extended_adv_data(struct bt_cap_broadcast_source *source, uint32_t broadcast_id; int err; - err = bt_cap_initiator_broadcast_get_id(source, &broadcast_id); - if (err != 0) { - printk("Unable to get broadcast ID: %d\n", err); - + err = bt_rand(&broadcast_id, BT_AUDIO_BROADCAST_ID_SIZE); + if (err) { + FAIL("Unable to generate broadcast ID: %d\n", err); return err; } From a2c193374cd47c854d298243cf097f4a2b12d70e Mon Sep 17 00:00:00 2001 From: Dmitrii Golovanov Date: Wed, 23 Oct 2024 11:52:17 +0200 Subject: [PATCH 1755/4482] ci: footprint: fix nrf5340dk/nrf5340/cpuapp board name Fix nrf5340dk/nrf5340/cpuapp board name to align with HWMv2 changes and resolve build error for its footprint data collection. Signed-off-by: Dmitrii Golovanov --- scripts/footprint/plan.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/footprint/plan.txt b/scripts/footprint/plan.txt index 910a994c51436..f53a1371e7c74 100644 --- a/scripts/footprint/plan.txt +++ b/scripts/footprint/plan.txt @@ -18,7 +18,7 @@ bt_beacon,default,nrf52840dk/nrf52840,samples/bluetooth/beacon, bt_peripheral,default,nrf52840dk/nrf52840,samples/bluetooth/peripheral, bt_central_hr,default,nrf52840dk/nrf52840,samples/bluetooth/central_hr, bt_mesh_demo,default,bbc_microbit,samples/bluetooth/mesh_demo, -bt_hap_ha,default,nrf5340dk/nrf5340_cpuapp,samples/bluetooth/hap_ha, +bt_hap_ha,default,nrf5340dk/nrf5340/cpuapp,samples/bluetooth/hap_ha, bt_bap_unicast_client,default,nrf5340dk/nrf5340/cpuapp,samples/bluetooth/bap_unicast_client, bt_bap_unicast_server,default,nrf5340dk/nrf5340/cpuapp,samples/bluetooth/bap_unicast_server, bt_tmap_central,default,nrf5340dk/nrf5340/cpuapp,samples/bluetooth/tmap_central, From e0b748e1aba144782f9497e9b43babf73e9e516c Mon Sep 17 00:00:00 2001 From: Dmitrii Golovanov Date: Wed, 23 Oct 2024 11:54:58 +0200 Subject: [PATCH 1756/4482] ci: footprint: extend data transform on all applications In addition to 'footprints' application data, execute transformation step for all other applications listed in `plan.txt` to upload their memory footprint reports to the ELK storage as well. Signed-off-by: Dmitrii Golovanov --- .github/workflows/footprint-tracking.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/footprint-tracking.yml b/.github/workflows/footprint-tracking.yml index 91b19462379cd..694dc8166be7d 100644 --- a/.github/workflows/footprint-tracking.yml +++ b/.github/workflows/footprint-tracking.yml @@ -104,7 +104,7 @@ jobs: python3 ./scripts/footprint/pack_as_twister.py -vvv \ --plan ./scripts/footprint/plan.txt \ --test-name='name.feature' \ - ./footprint_data/*/footprints/*/*/ + ./footprint_data/**/ - name: Upload to ElasticSearch env: From 00378b56ec63677cb0a9ebc411c2aa1eb5936402 Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Mon, 21 Oct 2024 17:54:06 +0200 Subject: [PATCH 1757/4482] drivers: serial: gecko: Add device power management Add basic device power management to USART driver. The initial implementation only ensures that the TX FIFO is flushed before allowing the system to go to sleep by polling the TXIDLE status register. This fixes an issue where the last 1-2 characters would be lost if transmitted immediately before going to deep sleep. Signed-off-by: Aksel Skauge Mellbye --- drivers/serial/Kconfig.gecko | 1 + drivers/serial/uart_gecko.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/serial/Kconfig.gecko b/drivers/serial/Kconfig.gecko index 863558c280769..4d84965988dd9 100644 --- a/drivers/serial/Kconfig.gecko +++ b/drivers/serial/Kconfig.gecko @@ -12,5 +12,6 @@ config UART_GECKO select SOC_GECKO_USART select PINCTRL if SOC_FAMILY_SILABS_S1 select CLOCK_CONTROL if SOC_FAMILY_SILABS_S2 + select PM_DEVICE if PM && SOC_FAMILY_SILABS_S2 help Enable the Gecko uart driver. diff --git a/drivers/serial/uart_gecko.c b/drivers/serial/uart_gecko.c index 6a8beb3d27ddc..ffda4fd977ee4 100644 --- a/drivers/serial/uart_gecko.c +++ b/drivers/serial/uart_gecko.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -488,6 +489,29 @@ static int uart_gecko_init(const struct device *dev) return 0; } +#ifdef CONFIG_PM_DEVICE +static int uart_gecko_pm_action(const struct device *dev, enum pm_device_action action) +{ + const struct uart_gecko_config *config = dev->config; + + switch (action) { + case PM_DEVICE_ACTION_SUSPEND: + /* Wait for TX FIFO to flush before suspending */ + while (!(USART_StatusGet(config->base) & USART_STATUS_TXIDLE)) { + } + break; + + case PM_DEVICE_ACTION_RESUME: + break; + + default: + return -ENOTSUP; + } + + return 0; +} +#endif + static const struct uart_driver_api uart_gecko_driver_api = { .poll_in = uart_gecko_poll_in, .poll_out = uart_gecko_poll_out, @@ -686,6 +710,7 @@ DT_INST_FOREACH_STATUS_OKAY(GECKO_UART_INIT) #define GECKO_USART_INIT(idx) \ PINCTRL_DT_INST_DEFINE(idx); \ GECKO_USART_IRQ_HANDLER_DECL(idx); \ + PM_DEVICE_DT_INST_DEFINE(idx, uart_gecko_pm_action); \ \ static const struct uart_gecko_config usart_gecko_cfg_##idx = { \ .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(idx), \ @@ -697,7 +722,7 @@ DT_INST_FOREACH_STATUS_OKAY(GECKO_UART_INIT) \ static struct uart_gecko_data usart_gecko_data_##idx; \ \ - DEVICE_DT_INST_DEFINE(idx, uart_gecko_init, NULL, \ + DEVICE_DT_INST_DEFINE(idx, uart_gecko_init, PM_DEVICE_DT_INST_GET(idx),\ &usart_gecko_data_##idx, \ &usart_gecko_cfg_##idx, PRE_KERNEL_1, \ CONFIG_SERIAL_INIT_PRIORITY, \ @@ -710,6 +735,7 @@ DT_INST_FOREACH_STATUS_OKAY(GECKO_UART_INIT) VALIDATE_GECKO_UART_RTS_CTS_PIN_LOCATIONS(idx); \ \ GECKO_USART_IRQ_HANDLER_DECL(idx); \ + PM_DEVICE_DT_INST_DEFINE(idx, uart_gecko_pm_action); \ \ static const struct uart_gecko_config usart_gecko_cfg_##idx = { \ .base = (USART_TypeDef *)DT_INST_REG_ADDR(idx), \ @@ -725,7 +751,7 @@ DT_INST_FOREACH_STATUS_OKAY(GECKO_UART_INIT) \ static struct uart_gecko_data usart_gecko_data_##idx; \ \ - DEVICE_DT_INST_DEFINE(idx, uart_gecko_init, NULL, \ + DEVICE_DT_INST_DEFINE(idx, uart_gecko_init, PM_DEVICE_DT_INST_GET(idx),\ &usart_gecko_data_##idx, \ &usart_gecko_cfg_##idx, PRE_KERNEL_1, \ CONFIG_SERIAL_INIT_PRIORITY, \ From 8fc5514a9415acf55c39b5eb43e7c21a0fb20e7b Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Mon, 21 Oct 2024 12:19:58 +0200 Subject: [PATCH 1758/4482] soc: silabs: Only initialize HFXO Manager if HFXO is enabled Only initialize the HFXO Manager HAL driver if the HFXO is enabled in DeviceTree, the device uses SYSRTC for timekeeping, and Power Manager is enabled. HFXO Manager integrates with the Sleeptimer HAL driver for SYSRTC to autonomously wake the HFXO prior to Sleeptimer wakeup from deep sleep. It is not needed on devices that don't have HFXO-SYSRTC integration, and it is not needed if the application doesn't use deep sleep. Add missing call to init_hardware() prior to init(). Signed-off-by: Aksel Skauge Mellbye --- dts/arm/silabs/efr32bg22.dtsi | 5 +++ dts/arm/silabs/efr32bg27.dtsi | 5 +++ dts/arm/silabs/efr32mg21.dtsi | 2 + dts/arm/silabs/efr32mg24.dtsi | 2 + .../hal_silabs/simplicity_sdk/CMakeLists.txt | 45 ++++++++++++------- soc/silabs/Kconfig | 6 +++ soc/silabs/silabs_s2/soc.c | 9 +++- 7 files changed, 58 insertions(+), 16 deletions(-) diff --git a/dts/arm/silabs/efr32bg22.dtsi b/dts/arm/silabs/efr32bg22.dtsi index c8184284b61a3..87b1420693693 100644 --- a/dts/arm/silabs/efr32bg22.dtsi +++ b/dts/arm/silabs/efr32bg22.dtsi @@ -31,6 +31,11 @@ interrupts = <46 0>; }; +&hfxo { + interrupts = <44 0>; + interrupt-names = "hfxo"; +}; + &msc { flash0: flash@0 { compatible = "soc-nv-flash"; diff --git a/dts/arm/silabs/efr32bg27.dtsi b/dts/arm/silabs/efr32bg27.dtsi index 9e4d9b1d26538..3a3b7e181affb 100644 --- a/dts/arm/silabs/efr32bg27.dtsi +++ b/dts/arm/silabs/efr32bg27.dtsi @@ -41,6 +41,11 @@ interrupts = <52 0>; }; +&hfxo { + interrupts = <50 0>; + interrupt-names = "hfxo"; +}; + &msc { flash0: flash@8000000 { compatible = "soc-nv-flash"; diff --git a/dts/arm/silabs/efr32mg21.dtsi b/dts/arm/silabs/efr32mg21.dtsi index bc3de7156755d..911f8cbff19df 100644 --- a/dts/arm/silabs/efr32mg21.dtsi +++ b/dts/arm/silabs/efr32mg21.dtsi @@ -138,6 +138,8 @@ #clock-cells = <0>; compatible = "silabs,hfxo"; reg = <0x5000c000 0x4000>; + interrupts = <45 0>; + interrupt-names = "hfxo"; clock-frequency = ; ctune = <140>; precision = <50>; diff --git a/dts/arm/silabs/efr32mg24.dtsi b/dts/arm/silabs/efr32mg24.dtsi index 00eeff0e38ba6..00a784cd1dc48 100644 --- a/dts/arm/silabs/efr32mg24.dtsi +++ b/dts/arm/silabs/efr32mg24.dtsi @@ -208,6 +208,8 @@ #clock-cells = <0>; compatible = "silabs,hfxo"; reg = <0x5a004000 0x4000>; + interrupts = <44 0>; + interrupt-names = "hfxo"; clock-frequency = ; ctune = <140>; precision = <50>; diff --git a/modules/hal_silabs/simplicity_sdk/CMakeLists.txt b/modules/hal_silabs/simplicity_sdk/CMakeLists.txt index 0398ed5b75d1c..b59c14d11ed5a 100644 --- a/modules/hal_silabs/simplicity_sdk/CMakeLists.txt +++ b/modules/hal_silabs/simplicity_sdk/CMakeLists.txt @@ -114,11 +114,6 @@ zephyr_compile_definitions( ${SILABS_DEVICE_PART_NUMBER} ) -zephyr_compile_definitions_ifdef(CONFIG_SOC_GECKO_DEV_INIT - SL_CATALOG_POWER_MANAGER_PRESENT - SL_CATALOG_HFXO_MANAGER_PRESENT -) - zephyr_library_sources( ${DEVICE_DIR}/SiliconLabs/${SILABS_DEVICE_FAMILY}/Source/system_${CONFIG_SOC_SERIES}.c ${EMLIB_DIR}/src/em_system.c @@ -131,6 +126,7 @@ zephyr_library_sources( ${SERVICE_DIR}/device_manager/src/sl_device_clock.c ${SERVICE_DIR}/device_manager/src/sl_device_gpio.c ${SERVICE_DIR}/device_manager/src/sl_device_peripheral.c + ${SERVICE_DIR}/memory_manager/profiler/src/sli_memory_profiler_stubs.c ) if(NOT SILABS_DEVICE_FAMILY_NUMBER EQUAL "21") @@ -156,18 +152,37 @@ zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_IADC ${EMLIB_DIR}/src/em_i zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_BURTC ${EMLIB_DIR}/src/em_burtc.c) zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CMU ${EMLIB_DIR}/src/em_cmu.c) +# Device Init if(CONFIG_SOC_GECKO_DEV_INIT) -zephyr_library_sources_ifdef(CONFIG_DT_HAS_SILABS_SERIES2_DCDC_ENABLED - ${SERVICE_DIR}/device_init/src/sl_device_init_dcdc_s2.c -) + zephyr_library_sources_ifdef(CONFIG_DT_HAS_SILABS_SERIES2_DCDC_ENABLED + ${SERVICE_DIR}/device_init/src/sl_device_init_dcdc_s2.c + ) +endif() + +# Power Manager +if(CONFIG_SOC_GECKO_PM_BACKEND_PMGR) + zephyr_library_sources( + ${SERVICE_DIR}/power_manager/src/sl_power_manager.c + ${SERVICE_DIR}/power_manager/src/sl_power_manager_hal_s2.c + ) + zephyr_compile_definitions( + SL_CATALOG_POWER_MANAGER_PRESENT + ) + zephyr_compile_definitions_ifdef(CONFIG_SOC_GECKO_RTCC + SL_CATALOG_POWER_MANAGER_DEEPSLEEP_BLOCKING_HFXO_RESTORE_PRESENT + ) +endif() + +# HFXO Manager +if(CONFIG_SOC_SILABS_HFXO_MANAGER) + zephyr_library_sources( + ${SERVICE_DIR}/hfxo_manager/src/sl_hfxo_manager.c + ${SERVICE_DIR}/hfxo_manager/src/sl_hfxo_manager_hal_s2.c + ) + zephyr_compile_definitions( + SL_CATALOG_HFXO_MANAGER_PRESENT + ) endif() -zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_DEV_INIT - ${SERVICE_DIR}/power_manager/src/sl_power_manager.c - ${SERVICE_DIR}/power_manager/src/sl_power_manager_hal_s2.c - ${SERVICE_DIR}/hfxo_manager/src/sl_hfxo_manager.c - ${SERVICE_DIR}/hfxo_manager/src/sl_hfxo_manager_hal_s2.c - ${SERVICE_DIR}/memory_manager/profiler/src/sli_memory_profiler_stubs.c -) zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_DEV_INIT ${COMMON_DIR}/src/sl_slist.c) zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CORE diff --git a/soc/silabs/Kconfig b/soc/silabs/Kconfig index c9f7bdea180e9..e1474623154a4 100644 --- a/soc/silabs/Kconfig +++ b/soc/silabs/Kconfig @@ -128,6 +128,12 @@ config SOC_SILABS_SLEEPTIMER help Set if the Sleeptimer HAL module is used. +config SOC_SILABS_HFXO_MANAGER + bool + default y if PM && $(dt_nodelabel_enabled,sysrtc0) && $(dt_nodelabel_enabled,hfxo) + help + Set if the HFXO Manager HAL module is used. + if PM config SOC_GECKO_PM_BACKEND_PMGR diff --git a/soc/silabs/silabs_s2/soc.c b/soc/silabs/silabs_s2/soc.c index a6ad018bc43c0..2f76045b415db 100644 --- a/soc/silabs/silabs_s2/soc.c +++ b/soc/silabs/silabs_s2/soc.c @@ -32,6 +32,10 @@ LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); +#if defined(CONFIG_SOC_SILABS_HFXO_MANAGER) +Z_ISR_DECLARE_DIRECT(DT_IRQ(DT_NODELABEL(hfxo), irq), 0, sl_hfxo_manager_irq_handler); +#endif + void soc_early_init_hook(void) { /* Handle chip errata */ @@ -42,9 +46,12 @@ void soc_early_init_hook(void) } sl_clock_manager_init(); + if (IS_ENABLED(CONFIG_SOC_SILABS_HFXO_MANAGER)) { + sl_hfxo_manager_init_hardware(); + sl_hfxo_manager_init(); + } if (IS_ENABLED(CONFIG_PM)) { sl_power_manager_init(); - sl_hfxo_manager_init(); } } From 545e9334f7b3d6fc4ed84400b81bf7f5c69e5b48 Mon Sep 17 00:00:00 2001 From: Aksel Skauge Mellbye Date: Mon, 21 Oct 2024 18:00:13 +0200 Subject: [PATCH 1759/4482] drivers: bluetooth: hci: silabs: Configure radio for sleep If PM is enabled, the radio must be configured to synchronize its protocol timer with the low frequency timer. Signed-off-by: Aksel Skauge Mellbye --- drivers/bluetooth/hci/hci_silabs_efr32.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/bluetooth/hci/hci_silabs_efr32.c b/drivers/bluetooth/hci/hci_silabs_efr32.c index e90552c2521c0..bd0fe0c0af771 100644 --- a/drivers/bluetooth/hci/hci_silabs_efr32.c +++ b/drivers/bluetooth/hci/hci_silabs_efr32.c @@ -43,6 +43,7 @@ static atomic_t sli_btctrl_events; void BTLE_LL_EventRaise(uint32_t events); void BTLE_LL_Process(uint32_t events); bool sli_pending_btctrl_events(void); +RAIL_Handle_t BTLE_LL_GetRadioHandle(void); void rail_isr_installer(void) { @@ -212,6 +213,7 @@ static int slz_bt_open(const struct device *dev, bt_hci_recv_t recv) #ifdef CONFIG_PM { + RAIL_ConfigSleep(BTLE_LL_GetRadioHandle(), RAIL_SLEEP_CONFIG_TIMERSYNC_ENABLED); RAIL_Status_t status = RAIL_InitPowerManager(); if (status != RAIL_STATUS_NO_ERROR) { From 8cd361a51a4e7954d58ca7f06ed554bd3a7ef076 Mon Sep 17 00:00:00 2001 From: Bartlomiej Buczek Date: Thu, 24 Oct 2024 15:03:02 +0200 Subject: [PATCH 1760/4482] samples: boards: nordic: system_off: Update README. Update DK naming - NRF54L15PDK is deprecated. Signed-off-by: Bartlomiej Buczek --- samples/boards/nordic/system_off/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/boards/nordic/system_off/README.rst b/samples/boards/nordic/system_off/README.rst index 7cf546d901d6c..7c98a4e833628 100644 --- a/samples/boards/nordic/system_off/README.rst +++ b/samples/boards/nordic/system_off/README.rst @@ -22,7 +22,7 @@ RAM is configured to keep the containing section powered while in system-off mod Requirements ************ -This application uses nRF51 DK, nRF52 DK or nRF54L15 PDK board for the demo. +This application uses nRF51 DK, nRF52 DK or nRF54L15 DK board for the demo. Sample Output ============= From d2410f54e0666ed389d65dbada058e222396846a Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Fri, 25 Oct 2024 09:43:02 +0200 Subject: [PATCH 1761/4482] dts: arm: st: wb0: use STM32_CLOCK everywhere PR #79683 missed a few nodes introduced while it was under review. Replace the remaining raw values with STM32_CLOCK in WB0 DTSI files. Signed-off-by: Mathieu Choplain --- dts/arm/st/wb0/stm32wb0.dtsi | 4 ++-- dts/arm/st/wb0/stm32wb07.dtsi | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dts/arm/st/wb0/stm32wb0.dtsi b/dts/arm/st/wb0/stm32wb0.dtsi index 07f1c58a6c6fc..9fcbafece6125 100644 --- a/dts/arm/st/wb0/stm32wb0.dtsi +++ b/dts/arm/st/wb0/stm32wb0.dtsi @@ -202,7 +202,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x41000000 DT_SIZE_K(1)>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 (1 << 21)>; + clocks = <&rcc STM32_CLOCK(APB1, 21)>; interrupts = <3 0>; interrupt-names = "combined"; status = "disabled"; @@ -213,7 +213,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x41007000 DT_SIZE_K(1)>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 (1 << 14)>; + clocks = <&rcc STM32_CLOCK(APB1, 14)>; interrupts = <7 0>; status = "disabled"; }; diff --git a/dts/arm/st/wb0/stm32wb07.dtsi b/dts/arm/st/wb0/stm32wb07.dtsi index d6fbf5acc9339..dec050b680e0b 100644 --- a/dts/arm/st/wb0/stm32wb07.dtsi +++ b/dts/arm/st/wb0/stm32wb07.dtsi @@ -22,7 +22,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x41001000 DT_SIZE_K(1)>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 (1 << 23)>; + clocks = <&rcc STM32_CLOCK(APB1, 23)>; interrupts = <4 0>; interrupt-names = "combined"; status = "disabled"; @@ -33,7 +33,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x41002000 DT_SIZE_K(1)>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 (1 << 0)>; + clocks = <&rcc STM32_CLOCK(APB1, 0)>; interrupts = <5 0>; status = "disabled"; }; @@ -43,7 +43,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x41003000 DT_SIZE_K(1)>; - clocks = <&rcc STM32_CLOCK_BUS_APB1 (1 << 12)>; + clocks = <&rcc STM32_CLOCK(APB1, 12)>; interrupts = <6 0>; status = "disabled"; }; From ade5e7892879a6b6ed7f7adc6a1f71323a4a2b63 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 21 Oct 2024 11:36:53 +0200 Subject: [PATCH 1762/4482] dts: bindings: dma: make DMAMUX IRQ optional Remove the "required: true" attribute from the STM32 DMAMUX binding. This is required for STM32WB0 series where the DMAMUX has no interrupt line Signed-off-by: Mathieu Choplain --- dts/bindings/dma/st,stm32-dmamux.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/dts/bindings/dma/st,stm32-dmamux.yaml b/dts/bindings/dma/st,stm32-dmamux.yaml index 84d5e8668e46f..8fa07a9c053d9 100644 --- a/dts/bindings/dma/st,stm32-dmamux.yaml +++ b/dts/bindings/dma/st,stm32-dmamux.yaml @@ -66,9 +66,6 @@ properties: reg: required: true - interrupts: - required: true - "#dma-cells": const: 3 From c532702d76b9439a7c182085ef5531f375397e05 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Wed, 23 Oct 2024 15:32:29 +0200 Subject: [PATCH 1763/4482] drivers: dma: dmamux_stm32: remove unused SO and RGO functions Functions related to synchronization inputs and request generators were present in the DMAMUX driver, despite being completely unused. Remove them for compatibility with WB0 which lacks this hardware. Signed-off-by: Mathieu Choplain --- drivers/dma/dmamux_stm32.c | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/drivers/dma/dmamux_stm32.c b/drivers/dma/dmamux_stm32.c index 43e7056dccc0c..71a470f532851 100644 --- a/drivers/dma/dmamux_stm32.c +++ b/drivers/dma/dmamux_stm32.c @@ -56,42 +56,6 @@ struct dmamux_stm32_config { const struct dmamux_stm32_channel *mux_channels; }; -/* - * LISTIFY is used to generate arrays with function pointers to check - * and clear interrupt flags using LL functions - */ -#define DMAMUX_CHANNEL(i, _) LL_DMAMUX_CHANNEL_ ## i -#define IS_ACTIVE_FLAG_SOX(i, _) LL_DMAMUX_IsActiveFlag_SO ## i -#define CLEAR_FLAG_SOX(i, _) LL_DMAMUX_ClearFlag_SO ## i -#define IS_ACTIVE_FLAG_RGOX(i, _) LL_DMAMUX_IsActiveFlag_RGO ## i -#define CLEAR_FLAG_RGOX(i, _) LL_DMAMUX_ClearFlag_RGO ## i - -uint32_t table_ll_channel[] = { - LISTIFY(DT_INST_PROP(0, dma_channels), DMAMUX_CHANNEL, (,)) -}; - -#if !defined(CONFIG_SOC_SERIES_STM32G0X) && \ - !defined(CONFIG_SOC_SERIES_STM32C0X) -#define dmamux_channel_typedef DMAMUX_Channel_TypeDef -#else -#define dmamux_channel_typedef const DMAMUX_Channel_TypeDef -#endif -uint32_t (*func_ll_is_active_so[])(dmamux_channel_typedef * DMAMUXx) = { - LISTIFY(DT_INST_PROP(0, dma_channels), IS_ACTIVE_FLAG_SOX, (,)) -}; - -void (*func_ll_clear_so[])(dmamux_channel_typedef * DMAMUXx) = { - LISTIFY(DT_INST_PROP(0, dma_channels), CLEAR_FLAG_SOX, (,)) -}; - -uint32_t (*func_ll_is_active_rgo[])(dmamux_channel_typedef * DMAMUXx) = { - LISTIFY(DT_INST_PROP(0, dma_generators), IS_ACTIVE_FLAG_RGOX, (,)) -}; - -void (*func_ll_clear_rgo[])(dmamux_channel_typedef * DMAMUXx) = { - LISTIFY(DT_INST_PROP(0, dma_generators), CLEAR_FLAG_RGOX, (,)) -}; - typedef int (*dma_configure_fn)(const struct device *dev, uint32_t id, struct dma_config *config); typedef int (*dma_start_fn)(const struct device *dev, uint32_t id); typedef int (*dma_stop_fn)(const struct device *dev, uint32_t id); From 764ce97b2fb392b13a8f1c3b67a066676d97654c Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 21 Oct 2024 13:20:09 +0200 Subject: [PATCH 1764/4482] drivers: dma: stm32: add support for STM32WB0 Add support for STM32WB0 series in the relevant drivers and Kconfig. Signed-off-by: Mathieu Choplain --- drivers/dma/Kconfig.stm32 | 3 +- drivers/dma/dma_stm32.c | 85 +++++++++++++++++++++------------------ 2 files changed, 48 insertions(+), 40 deletions(-) diff --git a/drivers/dma/Kconfig.stm32 b/drivers/dma/Kconfig.stm32 index 937d98be542bb..03af025f883c1 100644 --- a/drivers/dma/Kconfig.stm32 +++ b/drivers/dma/Kconfig.stm32 @@ -55,7 +55,8 @@ config DMA_STM32_SHARED_IRQS bool default y depends on SOC_SERIES_STM32C0X || SOC_SERIES_STM32F0X || \ - SOC_SERIES_STM32G0X || SOC_SERIES_STM32L0X + SOC_SERIES_STM32G0X || SOC_SERIES_STM32L0X || \ + SOC_SERIES_STM32WB0X help Enable shared IRQ support on devices where channels share 1 IRQ. diff --git a/drivers/dma/dma_stm32.c b/drivers/dma/dma_stm32.c index 8918c1c460517..8afc07792b55f 100644 --- a/drivers/dma/dma_stm32.c +++ b/drivers/dma/dma_stm32.c @@ -725,6 +725,7 @@ DEVICE_DT_INST_DEFINE(index, \ #define DMA_STM32_DEFINE_IRQ_HANDLER(dma, chan) /* nothing */ +/** Connect and enable IRQ @p chan of DMA instance @p dma */ #define DMA_STM32_IRQ_CONNECT(dma, chan) \ do { \ IRQ_CONNECT(DT_INST_IRQ_BY_IDX(dma, chan, irq), \ @@ -743,8 +744,12 @@ static void dma_stm32_irq_##dma##_##chan(const struct device *dev) \ dma_stm32_irq_handler(dev, chan); \ } - -#define DMA_STM32_IRQ_CONNECT(dma, chan) \ +/** + * Connect and enable IRQ @p chan of DMA instance @p dma + * + * @note Arguments order is reversed for compatibility with LISTIFY! + */ +#define DMA_STM32_IRQ_CONNECT(chan, dma) \ do { \ IRQ_CONNECT(DT_INST_IRQ_BY_IDX(dma, chan, irq), \ DT_INST_IRQ_BY_IDX(dma, chan, priority), \ @@ -779,27 +784,37 @@ static void dma_stm32_config_irq_0(const struct device *dev) { ARG_UNUSED(dev); +#if !defined(CONFIG_DMA_STM32_SHARED_IRQS) + /* No shared IRQs: call IRQ_CONNECT for each IRQn in DTS */ + LISTIFY( + DT_INST_NUM_IRQS(0), + DMA_STM32_IRQ_CONNECT, + (;), /* instance: */ 0 + ); +#else + /* All DMAs have at least one IRQ line */ DMA_STM32_IRQ_CONNECT(0, 0); + + /* On STM32WB0 series, there is a single IRQ line for all channels */ +#if !defined(CONFIG_SOC_SERIES_STM32WB0X) + /* On other series, the sharing follows a pattern: + * IRQn (X+0) is not shared (assigned to DMA1 channel 1) + * IRQn (X+1) is shared by DMA1 channels 2 and 3 + * IRQn (X+2) is shared by DMA1 channels >= 4 + * + * If present, DMA2 channels may also share IRQn (X+1) and (X+2); + * this works fine because shared ISR checks all channels of all DMAs. + */ + + /* Connect IRQ line shared by CH2 and CH3 */ DMA_STM32_IRQ_CONNECT(0, 1); -#ifndef CONFIG_DMA_STM32_SHARED_IRQS - DMA_STM32_IRQ_CONNECT(0, 2); -#endif /* CONFIG_DMA_STM32_SHARED_IRQS */ + + /* If DMA has more than 3 channels, connect IRQ line shared by CH4+ */ #if DT_INST_IRQ_HAS_IDX(0, 3) DMA_STM32_IRQ_CONNECT(0, 3); -#ifndef CONFIG_DMA_STM32_SHARED_IRQS - DMA_STM32_IRQ_CONNECT(0, 4); -#if DT_INST_IRQ_HAS_IDX(0, 5) - DMA_STM32_IRQ_CONNECT(0, 5); -#if DT_INST_IRQ_HAS_IDX(0, 6) - DMA_STM32_IRQ_CONNECT(0, 6); -#if DT_INST_IRQ_HAS_IDX(0, 7) - DMA_STM32_IRQ_CONNECT(0, 7); #endif /* DT_INST_IRQ_HAS_IDX(0, 3) */ -#endif /* DT_INST_IRQ_HAS_IDX(0, 5) */ -#endif /* DT_INST_IRQ_HAS_IDX(0, 6) */ -#endif /* DT_INST_IRQ_HAS_IDX(0, 7) */ -#endif /* CONFIG_DMA_STM32_SHARED_IRQS */ -/* Either 3 or 5 or 6 or 7 or 8 channels for DMA across all stm32 series. */ +#endif /* !CONFIG_SOC_SERIES_STM32WB0X */ +#endif /* !CONFIG_DMA_STM32_SHARED_IRQS */ } DMA_STM32_INIT_DEV(0); @@ -831,27 +846,19 @@ static void dma_stm32_config_irq_1(const struct device *dev) ARG_UNUSED(dev); #ifndef CONFIG_DMA_STM32_SHARED_IRQS - DMA_STM32_IRQ_CONNECT(1, 0); - DMA_STM32_IRQ_CONNECT(1, 1); - DMA_STM32_IRQ_CONNECT(1, 2); - DMA_STM32_IRQ_CONNECT(1, 3); -#if DT_INST_IRQ_HAS_IDX(1, 4) - DMA_STM32_IRQ_CONNECT(1, 4); -#if DT_INST_IRQ_HAS_IDX(1, 5) - DMA_STM32_IRQ_CONNECT(1, 5); -#if DT_INST_IRQ_HAS_IDX(1, 6) - DMA_STM32_IRQ_CONNECT(1, 6); -#if DT_INST_IRQ_HAS_IDX(1, 7) - DMA_STM32_IRQ_CONNECT(1, 7); -#endif /* DT_INST_IRQ_HAS_IDX(1, 4) */ -#endif /* DT_INST_IRQ_HAS_IDX(1, 5) */ -#endif /* DT_INST_IRQ_HAS_IDX(1, 6) */ -#endif /* DT_INST_IRQ_HAS_IDX(1, 7) */ -#endif /* CONFIG_DMA_STM32_SHARED_IRQS */ -/* - * Either 5 or 6 or 7 or 8 channels for DMA across all stm32 series. - * STM32F0 and STM32G0: if dma2 exits, the channel interrupts overlap with dma1 - */ + /* No shared IRQs: call IRQ_CONNECT for each IRQn in DTS */ + LISTIFY( + DT_INST_NUM_IRQS(1), + DMA_STM32_IRQ_CONNECT, + (;), /* instance: */ 1 + ); +#else + /** + * Series with 2 DMAs and SHARED_IRQS are STM32F0 and STM32G0. + * On both of these series, the DMA2 interrupt lines are shared with DMA1, + * so they have already been IRQ_CONNECT()'ed and there's nothing to do here. + */ +#endif /* !CONFIG_DMA_STM32_SHARED_IRQS */ } DMA_STM32_INIT_DEV(1); From 0e1f80500c18a416647fbb6d1a1d1589cfaacb2c Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 21 Oct 2024 13:25:05 +0200 Subject: [PATCH 1765/4482] dts: arm: st: wb0: add DMA and DMAMUX nodes Add device tree nodes corresponding to DMA and DMAMUX peripherals to STM32WB0 series DTSI. Signed-off-by: Mathieu Choplain --- dts/arm/st/wb0/stm32wb0.dtsi | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/dts/arm/st/wb0/stm32wb0.dtsi b/dts/arm/st/wb0/stm32wb0.dtsi index 9fcbafece6125..0532f0ba027b6 100644 --- a/dts/arm/st/wb0/stm32wb0.dtsi +++ b/dts/arm/st/wb0/stm32wb0.dtsi @@ -217,6 +217,31 @@ interrupts = <7 0>; status = "disabled"; }; + + dma1: dma@48700000 { + compatible = "st,stm32-dma-v2bis"; + #dma-cells = <2>; + reg = <0x48700000 256>; + clocks = <&rcc STM32_CLOCK(AHB0, 0)>; + interrupts = <17 0 17 0 17 0 17 0 17 0 17 0 17 0 17 0>; + dma-requests = <8>; + dma-offset = <0>; + status = "disabled"; + }; + + dmamux1: dmamux@48800000 { + compatible = "st,stm32-dmamux"; + reg = <0x48800000 DT_SIZE_K(1)>; + /* `clocks` property is identical between DMA and DMAMUX + * because they share a single common bit in RCC registers + */ + clocks = <&rcc STM32_CLOCK(AHB0, 0)>; + #dma-cells = <3>; + dma-channels = <8>; + dma-generators = <1>; + dma-requests= <25>; + status = "disabled"; + }; }; }; From c3e522d91882172e27778e3f0d34e3b7462dc868 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 21 Oct 2024 13:50:34 +0200 Subject: [PATCH 1766/4482] boards: st: wb0: add DMA to supported feature set Add DMA to supported feature set on existing STM32WB0 boards. Signed-off-by: Mathieu Choplain --- boards/st/nucleo_wb05kz/nucleo_wb05kz.yaml | 1 + boards/st/nucleo_wb09ke/nucleo_wb09ke.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/boards/st/nucleo_wb05kz/nucleo_wb05kz.yaml b/boards/st/nucleo_wb05kz/nucleo_wb05kz.yaml index f5a717e7840e0..8070d9ece04fb 100644 --- a/boards/st/nucleo_wb05kz/nucleo_wb05kz.yaml +++ b/boards/st/nucleo_wb05kz/nucleo_wb05kz.yaml @@ -11,6 +11,7 @@ flash: 192 supported: - arduino_i2c - arduino_spi + - dma - gpio - i2c - spi diff --git a/boards/st/nucleo_wb09ke/nucleo_wb09ke.yaml b/boards/st/nucleo_wb09ke/nucleo_wb09ke.yaml index c645659d26a58..922f199851d56 100644 --- a/boards/st/nucleo_wb09ke/nucleo_wb09ke.yaml +++ b/boards/st/nucleo_wb09ke/nucleo_wb09ke.yaml @@ -11,6 +11,7 @@ flash: 512 supported: - arduino_i2c - arduino_spi + - dma - gpio - i2c - spi From 35835f8d47fe0f23cf2ff7cf3176d125a49e0c94 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 21 Oct 2024 13:31:28 +0200 Subject: [PATCH 1767/4482] tests: dma: chan_blen_transfer: add overlay for Nucleo-WB09KE Add an overlay to the test so that it can run on STM32WB0 series hardware. Signed-off-by: Mathieu Choplain --- .../dma/chan_blen_transfer/boards/nucleo_wb09ke.conf | 3 +++ .../chan_blen_transfer/boards/nucleo_wb09ke.overlay | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 tests/drivers/dma/chan_blen_transfer/boards/nucleo_wb09ke.conf create mode 100644 tests/drivers/dma/chan_blen_transfer/boards/nucleo_wb09ke.overlay diff --git a/tests/drivers/dma/chan_blen_transfer/boards/nucleo_wb09ke.conf b/tests/drivers/dma/chan_blen_transfer/boards/nucleo_wb09ke.conf new file mode 100644 index 0000000000000..4cf988ef36d06 --- /dev/null +++ b/tests/drivers/dma/chan_blen_transfer/boards/nucleo_wb09ke.conf @@ -0,0 +1,3 @@ +# Use lowest- and highest-numbered channels to make sure the whole range works +CONFIG_DMA_TRANSFER_CHANNEL_NR_0=0 +CONFIG_DMA_TRANSFER_CHANNEL_NR_1=7 diff --git a/tests/drivers/dma/chan_blen_transfer/boards/nucleo_wb09ke.overlay b/tests/drivers/dma/chan_blen_transfer/boards/nucleo_wb09ke.overlay new file mode 100644 index 0000000000000..3dad23a87a907 --- /dev/null +++ b/tests/drivers/dma/chan_blen_transfer/boards/nucleo_wb09ke.overlay @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2024 STMicroelectronics + * + * SPDX-License-Identifier: Apache-2.0 + */ +&dma1 { + status = "okay"; +}; + +tst_dma0: &dmamux1 { + status = "okay"; +}; From 31fea97e05fd524b089c70281356d07df7788349 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 21 Oct 2024 13:33:09 +0200 Subject: [PATCH 1768/4482] tests: dma: loop_transfer: add overlay for Nucleo-WB09KE Add an overlay to the test so that it can run on STM32WB0 series hardware. Signed-off-by: Mathieu Choplain --- .../dma/loop_transfer/boards/nucleo_wb09ke.conf | 1 + .../dma/loop_transfer/boards/nucleo_wb09ke.overlay | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 tests/drivers/dma/loop_transfer/boards/nucleo_wb09ke.conf create mode 100644 tests/drivers/dma/loop_transfer/boards/nucleo_wb09ke.overlay diff --git a/tests/drivers/dma/loop_transfer/boards/nucleo_wb09ke.conf b/tests/drivers/dma/loop_transfer/boards/nucleo_wb09ke.conf new file mode 100644 index 0000000000000..fe1ac38875bf6 --- /dev/null +++ b/tests/drivers/dma/loop_transfer/boards/nucleo_wb09ke.conf @@ -0,0 +1 @@ +CONFIG_DMA_LOOP_TRANSFER_CHANNEL_NR=7 diff --git a/tests/drivers/dma/loop_transfer/boards/nucleo_wb09ke.overlay b/tests/drivers/dma/loop_transfer/boards/nucleo_wb09ke.overlay new file mode 100644 index 0000000000000..3dad23a87a907 --- /dev/null +++ b/tests/drivers/dma/loop_transfer/boards/nucleo_wb09ke.overlay @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2024 STMicroelectronics + * + * SPDX-License-Identifier: Apache-2.0 + */ +&dma1 { + status = "okay"; +}; + +tst_dma0: &dmamux1 { + status = "okay"; +}; From 7a7cfd0d64b5ad6837393620fecc4462c21862b4 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Wed, 23 Oct 2024 20:54:46 +0200 Subject: [PATCH 1769/4482] cmake: gcc/ld: Fix LTO warnings Fix the following warnings: [255/261] Linking C executable zephyr/zephyr_pre0.elf lto-wrapper: warning: using serial compilation of 8 LTRANS jobs lto-wrapper: note: see the '-flto' option documentation for more information [260/261] Linking C executable zephyr/zephyr.elf lto-wrapper: warning: using serial compilation of 8 LTRANS jobs lto-wrapper: note: see the '-flto' option documentation for more information Signed-off-by: Vinayak Kariappa Chettimada --- cmake/compiler/gcc/compiler_flags.cmake | 2 +- cmake/linker/ld/linker_flags.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/compiler/gcc/compiler_flags.cmake b/cmake/compiler/gcc/compiler_flags.cmake index f92fcd9f0cc63..5d348a2aacc2d 100644 --- a/cmake/compiler/gcc/compiler_flags.cmake +++ b/cmake/compiler/gcc/compiler_flags.cmake @@ -23,7 +23,7 @@ set_compiler_property(PROPERTY optimization_size -Os) set_compiler_property(PROPERTY optimization_size_aggressive -Oz) if(CMAKE_C_COMPILER_VERSION GREATER_EQUAL "4.5.0") - set_compiler_property(PROPERTY optimization_lto -flto) + set_compiler_property(PROPERTY optimization_lto -flto=auto) set_compiler_property(PROPERTY prohibit_lto -fno-lto) endif() diff --git a/cmake/linker/ld/linker_flags.cmake b/cmake/linker/ld/linker_flags.cmake index 5063ddb46fbab..0e0e8b6b0a107 100644 --- a/cmake/linker/ld/linker_flags.cmake +++ b/cmake/linker/ld/linker_flags.cmake @@ -36,7 +36,7 @@ endif() set_property(TARGET linker PROPERTY partial_linking "-r") -set_property(TARGET linker PROPERTY lto_arguments -flto -fno-ipa-sra -ffunction-sections -fdata-sections) +set_property(TARGET linker PROPERTY lto_arguments -flto=auto -fno-ipa-sra -ffunction-sections -fdata-sections) check_set_linker_property(TARGET linker PROPERTY no_relax ${LINKERFLAGPREFIX},--no-relax) From c15f8edd60e6555310ad2227a861932b857052df Mon Sep 17 00:00:00 2001 From: Lars Knudsen Date: Fri, 25 Oct 2024 11:17:07 +0200 Subject: [PATCH 1770/4482] Bluetooth: Shell: Fix iso sync timeout range check Using BT_ISO_SYNC_TIMEOUT_MIN and BT_ISO_SYNC_TIMEOUT_MAX now. Signed-off-by: Lars Knudsen --- subsys/bluetooth/host/shell/iso.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/shell/iso.c b/subsys/bluetooth/host/shell/iso.c index d9124d6dc891a..e2a592a0a6bd4 100644 --- a/subsys/bluetooth/host/shell/iso.c +++ b/subsys/bluetooth/host/shell/iso.c @@ -873,8 +873,8 @@ static int cmd_big_sync(const struct shell *sh, size_t argc, char *argv[]) } if (!IN_RANGE(sync_timeout, - BT_ISO_SYNC_MSE_MIN, - BT_ISO_SYNC_MSE_MAX)) { + BT_ISO_SYNC_TIMEOUT_MIN, + BT_ISO_SYNC_TIMEOUT_MAX)) { shell_error(sh, "Invalid sync_timeout %lu", sync_timeout); From cd3dcf788a3764dd526919fe13b960f1bf14ff4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Wed, 23 Oct 2024 16:44:43 +0200 Subject: [PATCH 1771/4482] net: socket: service: mark as unstable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As the socket service API is currently used by mutiple applications (dhcpv4 server, dns, telnet), it should be marked as unstable, according to the docs: https://docs.zephyrproject.org/latest/develop/api/api_lifecycle.html Signed-off-by: Fin Maaß --- include/zephyr/net/socket_service.h | 2 +- subsys/net/lib/sockets/Kconfig | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/zephyr/net/socket_service.h b/include/zephyr/net/socket_service.h index 4b6aaf23bbbd2..045d98dd5461c 100644 --- a/include/zephyr/net/socket_service.h +++ b/include/zephyr/net/socket_service.h @@ -19,7 +19,7 @@ * @brief BSD socket service API * @defgroup bsd_socket_service BSD socket service API * @since 3.6 - * @version 0.1.0 + * @version 0.2.0 * @ingroup networking * @{ */ diff --git a/subsys/net/lib/sockets/Kconfig b/subsys/net/lib/sockets/Kconfig index b46a871467c71..e694c7b9e3f9c 100644 --- a/subsys/net/lib/sockets/Kconfig +++ b/subsys/net/lib/sockets/Kconfig @@ -101,8 +101,7 @@ config NET_SOCKET_MAX_SEND_WAIT returning an ENOBUFS error. config NET_SOCKETS_SERVICE - bool "Socket service support [EXPERIMENTAL]" - select EXPERIMENTAL + bool "Socket service support" select EVENTFD help The socket service can monitor multiple sockets and save memory From 09546ff3e313facb666663e8f89dc45d9e13616d Mon Sep 17 00:00:00 2001 From: Lars Knudsen Date: Fri, 25 Oct 2024 10:42:01 +0200 Subject: [PATCH 1772/4482] Bluetooth: Shell: Set err to 0 before shell_strtoul The value of err was not initialized to 0 prior to calling shell_strtoul, which only sets err on actual error. Signed-off-by: Lars Knudsen --- subsys/bluetooth/host/shell/iso.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/bluetooth/host/shell/iso.c b/subsys/bluetooth/host/shell/iso.c index e2a592a0a6bd4..b42340452a213 100644 --- a/subsys/bluetooth/host/shell/iso.c +++ b/subsys/bluetooth/host/shell/iso.c @@ -806,6 +806,7 @@ static int cmd_big_sync(const struct shell *sh, size_t argc, char *argv[]) return -ENOEXEC; } + err = 0; bis_bitfield = shell_strtoul(argv[1], 0, &err); if (err != 0) { shell_error(sh, "Could not parse bis_bitfield: %d", err); From 6f99b6d0e4db7821d7ea98cedadb6bfb8685b5f4 Mon Sep 17 00:00:00 2001 From: Cla Mattia Galliard Date: Fri, 25 Oct 2024 10:26:22 +0200 Subject: [PATCH 1773/4482] drivers: ethernet: phy: phy_mii: log remove excess newlines Remove excess newlines from log output in phy_mii. Signed-off-by: Cla Mattia Galliard --- drivers/ethernet/phy/phy_mii.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ethernet/phy/phy_mii.c b/drivers/ethernet/phy/phy_mii.c index f4f06a0f10da1..6d51e9f94a243 100644 --- a/drivers/ethernet/phy/phy_mii.c +++ b/drivers/ethernet/phy/phy_mii.c @@ -243,7 +243,7 @@ static int update_link_state(const struct device *dev) data->state.speed = LINK_HALF_10BASE_T; } - LOG_INF("PHY (%d) Link speed %s Mb, %s duplex\n", + LOG_INF("PHY (%d) Link speed %s Mb, %s duplex", cfg->phy_addr, PHY_LINK_IS_SPEED_1000M(data->state.speed) ? "1000" : (PHY_LINK_IS_SPEED_100M(data->state.speed) ? "100" : "10"), @@ -455,7 +455,7 @@ static int phy_mii_initialize(const struct device *dev) return -EINVAL; } - LOG_INF("PHY (%d) ID %X\n", cfg->phy_addr, phy_id); + LOG_INF("PHY (%d) ID %X", cfg->phy_addr, phy_id); } data->gigabit_supported = is_gigabit_supported(dev); From c225b02ad54c6c28fac7ae0ca5e3137265662d59 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 25 Oct 2024 10:05:41 +0300 Subject: [PATCH 1774/4482] logging: backend: websocket: Add missing header file The log_backend_ws.h include file was missing which caused build issues. Fixes #80392 Signed-off-by: Jukka Rissanen --- include/zephyr/logging/log_backend_ws.h | 56 +++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 include/zephyr/logging/log_backend_ws.h diff --git a/include/zephyr/logging/log_backend_ws.h b/include/zephyr/logging/log_backend_ws.h new file mode 100644 index 0000000000000..0894d2ca19cb3 --- /dev/null +++ b/include/zephyr/logging/log_backend_ws.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_LOG_BACKEND_WS_H_ +#define ZEPHYR_LOG_BACKEND_WS_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Register websocket socket where the logging output is sent. + * + * @param fd Websocket socket value. + * + * @return 0 if ok, <0 if error + */ +int log_backend_ws_register(int fd); + +/** + * @brief Unregister websocket socket where the logging output was sent. + * + * @details After this the websocket output is disabled. + * + * @param fd Websocket socket value. + * + * @return 0 if ok, <0 if error + */ +int log_backend_ws_unregister(int fd); + +/** + * @brief Get the websocket logger backend + * + * @details This function returns the websocket logger backend. + * + * @return Pointer to the websocket logger backend. + */ +const struct log_backend *log_backend_ws_get(void); + +/** + * @brief Start the websocket logger backend + * + * @details This function starts the websocket logger backend. + */ +void log_backend_ws_start(void); + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_LOG_BACKEND_WS_H_ */ From 34bb8cb35c2167d7c55c8196cc9047e4e68d0b08 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 25 Oct 2024 10:24:58 +0300 Subject: [PATCH 1775/4482] logging: backend: websocket: Avoid uninit variable warning The ret variable might be used uninitialized. Signed-off-by: Jukka Rissanen --- subsys/logging/backends/log_backend_ws.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/logging/backends/log_backend_ws.c b/subsys/logging/backends/log_backend_ws.c index 03dc995d48d17..370bd7a41ebe2 100644 --- a/subsys/logging/backends/log_backend_ws.c +++ b/subsys/logging/backends/log_backend_ws.c @@ -64,7 +64,7 @@ static int ws_console_out(struct log_backend_ws_ctx *ctx, int c) static int max_cnt = CONFIG_LOG_BACKEND_WS_TX_RETRY_CNT; bool printnow = false; unsigned int cnt = 0; - int ret; + int ret = 0; if (pos >= (sizeof(output_buf) - 1)) { printnow = true; From 074b5f2ca071c9738eefda062020bb8ef85ff564 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 25 Oct 2024 10:27:32 +0300 Subject: [PATCH 1776/4482] shell: backend: websocket: Fix socket service creation The NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC() macro was changed earlier but the compilation error was missed. Fixing the macro call. Signed-off-by: Jukka Rissanen --- subsys/shell/backends/shell_websocket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/shell/backends/shell_websocket.c b/subsys/shell/backends/shell_websocket.c index 28ff070483232..62b8dc9a5f8e1 100644 --- a/subsys/shell/backends/shell_websocket.c +++ b/subsys/shell/backends/shell_websocket.c @@ -26,7 +26,7 @@ LOG_MODULE_REGISTER(shell_websocket, CONFIG_SHELL_WEBSOCKET_INIT_LOG_LEVEL); static void ws_server_cb(struct net_socket_service_event *evt); -NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(websocket_server, NULL, ws_server_cb, +NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(websocket_server, ws_server_cb, SHELL_WEBSOCKET_SERVICE_COUNT); static void ws_end_client_connection(struct shell_websocket *ws) From b29534f0e3416a3d510be6c3b79f3d3066bae540 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 25 Oct 2024 10:31:56 +0300 Subject: [PATCH 1777/4482] samples: net: echo_server: Add websocket console test Make sure that the websocket console is build tested. Signed-off-by: Jukka Rissanen --- samples/net/sockets/echo_server/sample.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/samples/net/sockets/echo_server/sample.yaml b/samples/net/sockets/echo_server/sample.yaml index 224221a4f8b53..0bd76501d5cdf 100644 --- a/samples/net/sockets/echo_server/sample.yaml +++ b/samples/net/sockets/echo_server/sample.yaml @@ -145,3 +145,9 @@ tests: sample.net.sockets.echo_server.802154.subg: extra_args: EXTRA_CONF_FILE="overlay-802154-subg.conf" platform_allow: beagleconnect_freedom + sample.net.sockets.echo_server.ws_console: + platform_allow: + - native_sim + - native_sim/native/64 + extra_args: + - EXTRA_CONF_FILE="overlay-ws-console.conf" From 6fb34733b5d123b3c16c16678c6128f4f3221c65 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 25 Oct 2024 10:39:05 +0300 Subject: [PATCH 1778/4482] samples: net: echo_server: Avoid warning about truncated writing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The truncation is not possible in practice but add suitable cast to avoid the warning. samples/net/sockets/echo_server/src/tcp.c:297:54: warning: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 5 [-Wformat-truncation=] 297 | snprintk(name, sizeof(name), "tcp4[%d]", slot); | ^~~~~~~~~~ Signed-off-by: Jukka Rissanen --- samples/net/sockets/echo_server/src/tcp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/net/sockets/echo_server/src/tcp.c b/samples/net/sockets/echo_server/src/tcp.c index 310decddae412..584ff0ffc02ed 100644 --- a/samples/net/sockets/echo_server/src/tcp.c +++ b/samples/net/sockets/echo_server/src/tcp.c @@ -250,7 +250,7 @@ static int process_tcp(struct data *data) LOG_INF("TCP (%s): Accepted connection", data->proto); -#define MAX_NAME_LEN sizeof("tcp6[0]") +#define MAX_NAME_LEN sizeof("tcp6[xxx]") #if defined(CONFIG_NET_IPV6) if (client_addr.sin_family == AF_INET6) { @@ -270,7 +270,7 @@ static int process_tcp(struct data *data) if (IS_ENABLED(CONFIG_THREAD_NAME)) { char name[MAX_NAME_LEN]; - snprintk(name, sizeof(name), "tcp6[%d]", slot); + snprintk(name, sizeof(name), "tcp6[%3d]", (uint8_t)slot); k_thread_name_set(&tcp6_handler_thread[slot], name); } } @@ -294,7 +294,7 @@ static int process_tcp(struct data *data) if (IS_ENABLED(CONFIG_THREAD_NAME)) { char name[MAX_NAME_LEN]; - snprintk(name, sizeof(name), "tcp4[%d]", slot); + snprintk(name, sizeof(name), "tcp4[%3d]", (uint8_t)slot); k_thread_name_set(&tcp4_handler_thread[slot], name); } } From 99d7161e346729426b631be3d5f73f09e6e7563c Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 23 Oct 2024 10:38:34 +0200 Subject: [PATCH 1779/4482] tests/ztest/fail: fix board name Use full board name in cmake file. Akin to the fix done in https://github.com/zephyrproject-rtos/zephyr/pull/80270/ following the changes from https://github.com/zephyrproject-rtos/zephyr/pull/77250/ Note after the Zephyr cmake code has been run the BOARD variable is split into BOARD BOARD_QUALIFIERS, where BOARD does not contain the qualifiers anymore (see cmake/modules/boards.cmake for more info). Signed-off-by: Alberto Escolar Piedras --- tests/ztest/fail/CMakeLists.txt | 4 ++-- tests/ztest/fail/core/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/ztest/fail/CMakeLists.txt b/tests/ztest/fail/CMakeLists.txt index b513ce6662d34..1f1b3e97faab5 100644 --- a/tests/ztest/fail/CMakeLists.txt +++ b/tests/ztest/fail/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.20.0) include(ExternalProject) -if(BOARD STREQUAL unit_testing) +if(BOARD STREQUAL unit_testing/unit_testing) find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE}) set(target testbinary) # Set the target binary for the 'core' external project. The path to this must match the one set @@ -36,7 +36,7 @@ string(REPLACE ";" " " fail_test_config "${fail_test_config}") ExternalProject_Add(core SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/core CMAKE_ARGS - -DBOARD:STRING=${BOARD} + -DBOARD:STRING=${BOARD}${BOARD_QUALIFIERS} -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}/core ${fail_test_config} ) diff --git a/tests/ztest/fail/core/CMakeLists.txt b/tests/ztest/fail/core/CMakeLists.txt index af7ff16c0bde3..804ece66bae3e 100644 --- a/tests/ztest/fail/core/CMakeLists.txt +++ b/tests/ztest/fail/core/CMakeLists.txt @@ -23,7 +23,7 @@ elseif(CONFIG_ZTEST_FAIL_TEST_UNEXPECTED_ASSUME) list(APPEND test_sources src/unexpected_assume.cpp) endif() -if(BOARD STREQUAL unit_testing) +if(BOARD STREQUAL unit_testing/unit_testing) find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(base) From 9ceeb9bfefc29d4635cda7feae1d72d11f316c95 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 23 Oct 2024 10:42:31 +0200 Subject: [PATCH 1780/4482] tests/ztest/fail: Fix yaml description Fix filtering done in 22c3438f1b9589d31777912528f42312a28e2f8e Otherwise we end up with tests defined twice, as a .unit and .zerphyr variant but both run in normal builds, and none for unit tests. Signed-off-by: Alberto Escolar Piedras --- tests/ztest/fail/testcase.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/ztest/fail/testcase.yaml b/tests/ztest/fail/testcase.yaml index 5b630a5d1225d..c6054c75f449c 100644 --- a/tests/ztest/fail/testcase.yaml +++ b/tests/ztest/fail/testcase.yaml @@ -6,27 +6,34 @@ common: - test_framework # test has dependencies on host libc platform_allow: + - unit_testing - native_sim - native_sim/native/64 integration_platforms: - native_sim tests: testing.fail.unit.assert_after: + type: unit extra_configs: - CONFIG_ZTEST_FAIL_TEST_ASSERT_AFTER=y testing.fail.unit.assert_teardown: + type: unit extra_configs: - CONFIG_ZTEST_FAIL_TEST_ASSERT_TEARDOWN=y testing.fail.unit.assume_after: + type: unit extra_configs: - CONFIG_ZTEST_FAIL_TEST_ASSUME_AFTER=y testing.fail.unit.assume_teardown: + type: unit extra_configs: - CONFIG_ZTEST_FAIL_TEST_ASSUME_TEARDOWN=y testing.fail.unit.pass_after: + type: unit extra_configs: - CONFIG_ZTEST_FAIL_TEST_PASS_AFTER=y testing.fail.unit.pass_teardown: + type: unit extra_configs: - CONFIG_ZTEST_FAIL_TEST_PASS_TEARDOWN=y testing.fail.zephyr.assert_after: From 28edb220cddf59e7310275c70190bbe2bc0f3a31 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Thu, 24 Oct 2024 10:48:09 +0200 Subject: [PATCH 1781/4482] tests: Support targeting unit_testing with and without qualifier For tests that support both targeting unit_testing and other targets, we check in the cmake code the BOARD variable. Let's allow users to set this to either of unit_testing or unit_testing/unit_testing so it behaves like for other tests. Signed-off-by: Alberto Escolar Piedras --- tests/subsys/testsuite/fff_fake_contexts/CMakeLists.txt | 2 +- tests/ztest/base/CMakeLists.txt | 2 +- tests/ztest/fail/CMakeLists.txt | 2 +- tests/ztest/fail/core/CMakeLists.txt | 2 +- tests/ztest/zexpect/CMakeLists.txt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/subsys/testsuite/fff_fake_contexts/CMakeLists.txt b/tests/subsys/testsuite/fff_fake_contexts/CMakeLists.txt index d4cf1a06bf650..ad60f9a414b9f 100644 --- a/tests/subsys/testsuite/fff_fake_contexts/CMakeLists.txt +++ b/tests/subsys/testsuite/fff_fake_contexts/CMakeLists.txt @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 cmake_minimum_required(VERSION 3.20.0) -if(BOARD STREQUAL unit_testing/unit_testing) +if(BOARD STREQUAL "unit_testing" OR BOARD STREQUAL "unit_testing/unit_testing") find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE}) set(target testbinary) else() diff --git a/tests/ztest/base/CMakeLists.txt b/tests/ztest/base/CMakeLists.txt index 5cbbcb1089416..f516aa36aecf1 100644 --- a/tests/ztest/base/CMakeLists.txt +++ b/tests/ztest/base/CMakeLists.txt @@ -1,7 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 cmake_minimum_required(VERSION 3.20.0) -if(BOARD STREQUAL unit_testing/unit_testing) +if(BOARD STREQUAL "unit_testing" OR BOARD STREQUAL "unit_testing/unit_testing") find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(base) diff --git a/tests/ztest/fail/CMakeLists.txt b/tests/ztest/fail/CMakeLists.txt index 1f1b3e97faab5..6a37c8efd7225 100644 --- a/tests/ztest/fail/CMakeLists.txt +++ b/tests/ztest/fail/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.20.0) include(ExternalProject) -if(BOARD STREQUAL unit_testing/unit_testing) +if(BOARD STREQUAL "unit_testing" OR BOARD STREQUAL "unit_testing/unit_testing") find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE}) set(target testbinary) # Set the target binary for the 'core' external project. The path to this must match the one set diff --git a/tests/ztest/fail/core/CMakeLists.txt b/tests/ztest/fail/core/CMakeLists.txt index 804ece66bae3e..9b39501a3b321 100644 --- a/tests/ztest/fail/core/CMakeLists.txt +++ b/tests/ztest/fail/core/CMakeLists.txt @@ -23,7 +23,7 @@ elseif(CONFIG_ZTEST_FAIL_TEST_UNEXPECTED_ASSUME) list(APPEND test_sources src/unexpected_assume.cpp) endif() -if(BOARD STREQUAL unit_testing/unit_testing) +if(BOARD STREQUAL "unit_testing" OR BOARD STREQUAL "unit_testing/unit_testing") find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(base) diff --git a/tests/ztest/zexpect/CMakeLists.txt b/tests/ztest/zexpect/CMakeLists.txt index 0b2813f48b23d..70f60af4d99c3 100644 --- a/tests/ztest/zexpect/CMakeLists.txt +++ b/tests/ztest/zexpect/CMakeLists.txt @@ -1,7 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 cmake_minimum_required(VERSION 3.20.0) -if(BOARD STREQUAL unit_testing/unit_testing) +if(BOARD STREQUAL "unit_testing" OR BOARD STREQUAL "unit_testing/unit_testing") find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(base) From 527c1f5356f80fe77fe728c572bc451c4c3cc5be Mon Sep 17 00:00:00 2001 From: Vladislav Pejic Date: Wed, 23 Oct 2024 18:48:35 +0200 Subject: [PATCH 1782/4482] driver: sensor: adxl362: Bug fix for q31_t conv This is a bug fix for adxl362_temp_convert_q31 and adxl362_accel_convert_q31 functions. Functions are used to convert samples received from sensor to q31_t format when RTIO stream is used. Signed-off-by: Vladislav Pejic --- drivers/sensor/adi/adxl362/adxl362_decoder.c | 35 +++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/drivers/sensor/adi/adxl362/adxl362_decoder.c b/drivers/sensor/adi/adxl362/adxl362_decoder.c index 5328c74ad9787..24141327ed416 100644 --- a/drivers/sensor/adi/adxl362/adxl362_decoder.c +++ b/drivers/sensor/adi/adxl362/adxl362_decoder.c @@ -9,6 +9,10 @@ #ifdef CONFIG_ADXL362_STREAM +/* (2^31 / 2^8(shift) */ +#define ADXL362_TEMP_QSCALE 8388608 +#define ADXL362_TEMP_LSB_PER_C 15 + #define ADXL362_COMPLEMENT 0xf000 static const uint32_t accel_period_ns[] = { @@ -20,11 +24,20 @@ static const uint32_t accel_period_ns[] = { [ADXL362_ODR_400_HZ] = UINT32_C(1000000000) / 400, }; -static const int32_t range_to_scale[] = { - /* See table 1 in specifications section of datasheet */ - [ADXL362_RANGE_2G] = ADXL362_ACCEL_2G_LSB_PER_G, - [ADXL362_RANGE_4G] = ADXL362_ACCEL_4G_LSB_PER_G, - [ADXL362_RANGE_8G] = ADXL362_ACCEL_8G_LSB_PER_G, +static const uint32_t range_to_shift[] = { + [ADXL362_RANGE_2G] = 5, + [ADXL362_RANGE_4G] = 6, + [ADXL362_RANGE_8G] = 7, +}; + +/* (1 / sensitivity) * (pow(2,31) / pow(2,shift)) * (unit_scaler) */ +static const uint32_t qscale_factor[] = { + /* (1.0 / ADXL362_ACCEL_2G_LSB_PER_G) * (2^31 / 2^5) * SENSOR_G / 1000000 */ + [ADXL362_RANGE_2G] = UINT32_C(658338), + /* (1.0 / ADXL362_ACCEL_4G_LSB_PER_G) * (2^31 / 2^6) * SENSOR_G / 1000000 */ + [ADXL362_RANGE_4G] = UINT32_C(658338), + /* (1.0 / ADXL362_ACCEL_8G_LSB_PER_G) * (2^31 / 2^7) ) * SENSOR_G / 1000000 */ + [ADXL362_RANGE_8G] = UINT32_C(700360), }; static inline void adxl362_temp_convert_q31(q31_t *out, int16_t data_in) @@ -36,10 +49,8 @@ static inline void adxl362_temp_convert_q31(q31_t *out, int16_t data_in) data_in |= ADXL362_COMPLEMENT; } - int64_t milli_c = (data_in - ADXL362_TEMP_BIAS_LSB) * ADXL362_TEMP_MC_PER_LSB + - (ADXL362_TEMP_BIAS_TEST_CONDITION * 1000); - - *out = CLAMP(((milli_c * 1000) + ((milli_c % 1000) * 1000)), INT32_MIN, INT32_MAX); + *out = ((data_in - ADXL362_TEMP_BIAS_LSB) / ADXL362_TEMP_LSB_PER_C + + ADXL362_TEMP_BIAS_TEST_CONDITION) * ADXL362_TEMP_QSCALE; } static inline void adxl362_accel_convert_q31(q31_t *out, int16_t data_in, int32_t range) @@ -50,9 +61,7 @@ static inline void adxl362_accel_convert_q31(q31_t *out, int16_t data_in, int32_ data_in |= ADXL362_COMPLEMENT; } - int64_t micro_ms2 = data_in * SENSOR_G / range_to_scale[range]; - - *out = CLAMP((micro_ms2 + (micro_ms2 % 1000000)), INT32_MIN, INT32_MAX); + *out = data_in * qscale_factor[range]; } static int adxl362_decode_stream(const uint8_t *buffer, struct sensor_chan_spec chan_spec, @@ -102,6 +111,7 @@ static int adxl362_decode_stream(const uint8_t *buffer, struct sensor_chan_spec memset(data, 0, sizeof(struct sensor_three_axis_data)); data->header.base_timestamp_ns = enc_data->timestamp; data->header.reading_count = 1; + data->shift = 8; data->readings[count].timestamp_delta = period_ns * sample_num; @@ -121,6 +131,7 @@ static int adxl362_decode_stream(const uint8_t *buffer, struct sensor_chan_spec memset(data, 0, sizeof(struct sensor_three_axis_data)); data->header.base_timestamp_ns = enc_data->timestamp; data->header.reading_count = 1; + data->shift = range_to_shift[enc_data->selected_range]; switch (chan_spec.chan_type) { case SENSOR_CHAN_ACCEL_X: From 6bc73df06b804e980f294f59e5e75048be6176f4 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Wed, 16 Oct 2024 16:20:51 -0500 Subject: [PATCH 1783/4482] drivers: flash: flash_mcux_flexspi: add support for W25Q512JV Add support for the W25Q512JV with the FLEXSPI, using a custom LUT table. Signed-off-by: Daniel DeGrasse --- drivers/flash/flash_mcux_flexspi_nor.c | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/flash/flash_mcux_flexspi_nor.c b/drivers/flash/flash_mcux_flexspi_nor.c index 4617b61ee4449..ea9377d075414 100644 --- a/drivers/flash/flash_mcux_flexspi_nor.c +++ b/drivers/flash/flash_mcux_flexspi_nor.c @@ -977,6 +977,37 @@ static int flash_flexspi_nor_check_jedec(struct flash_flexspi_nor_data *data, } /* Still return an error- we want the JEDEC configuration to run */ return -ENOTSUP; + case 0x40ef: + /* W25Q512JV flash, use 4 byte read/write */ + flexspi_lut[READ][0] = FLEXSPI_LUT_SEQ( + kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, SPI_NOR_CMD_4READ_4B, + kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_4PAD, 32); + /* Flash needs 6 dummy cycles (at 104MHz) */ + flexspi_lut[READ][1] = FLEXSPI_LUT_SEQ( + kFLEXSPI_Command_DUMMY_SDR, kFLEXSPI_4PAD, 6, + kFLEXSPI_Command_READ_SDR, kFLEXSPI_4PAD, 0x04); + /* Only 1S-1S-4S page program supported */ + flexspi_lut[PAGE_PROGRAM][0] = FLEXSPI_LUT_SEQ( + kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, SPI_NOR_CMD_PP_1_1_4_4B, + kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_1PAD, 32); + flexspi_lut[PAGE_PROGRAM][1] = FLEXSPI_LUT_SEQ( + kFLEXSPI_Command_WRITE_SDR, kFLEXSPI_4PAD, 0x4, + kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0x0); + /* Update ERASE commands for 4 byte mode */ + flexspi_lut[ERASE_SECTOR][0] = FLEXSPI_LUT_SEQ( + kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, SPI_NOR_CMD_SE_4B, + kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_1PAD, 32); + flexspi_lut[ERASE_BLOCK][0] = FLEXSPI_LUT_SEQ( + kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0xDC, + kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_1PAD, 32), + /* Read instruction used for polling is 0x05 */ + data->legacy_poll = true; + flexspi_lut[READ_STATUS_REG][0] = FLEXSPI_LUT_SEQ( + kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, SPI_NOR_CMD_RDSR, + kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x01); + /* Device uses bit 1 of status reg 2 for QE */ + return flash_flexspi_nor_quad_enable(data, flexspi_lut, + JESD216_DW15_QER_VAL_S2B1v5); case 0x25C2: /* MX25 flash, use 4 byte read/write */ flexspi_lut[READ][0] = FLEXSPI_LUT_SEQ( From 23d253727c7f68ba78e7206d0b7d47aa6cc75352 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Tue, 22 Oct 2024 17:37:48 -0500 Subject: [PATCH 1784/4482] boards: nxp: frdm_rw612: correct max frequency for WS25Q512JV WS25Q512JV can only run at 104MHz at 3.3V, unless the read parameter bits are changed. Since we don't reprogram these currently, reduce max frequency to safe value Signed-off-by: Daniel DeGrasse --- boards/nxp/frdm_rw612/frdm_rw612.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/nxp/frdm_rw612/frdm_rw612.dts b/boards/nxp/frdm_rw612/frdm_rw612.dts index 5b5d3d998e093..47a7bbd10f85a 100644 --- a/boards/nxp/frdm_rw612/frdm_rw612.dts +++ b/boards/nxp/frdm_rw612/frdm_rw612.dts @@ -72,7 +72,7 @@ status = "okay"; erase-block-size = <4096>; write-block-size = <1>; - spi-max-frequency = <133000000>; + spi-max-frequency = <104000000>; }; aps6404l: aps6404l@2 { compatible = "nxp,imx-flexspi-aps6404l"; From 7f4c94872977a8873d0e421137c62e53a48cac40 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Wed, 23 Oct 2024 22:55:51 +0900 Subject: [PATCH 1785/4482] MAINTAINERS: soburi takeover RaspberryPi Pico maintainer from yonsch I am taking over the maintainer role of the Raspberry Pi Pico platform. Signed-off-by: TOKITA Hiroshi --- MAINTAINERS.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 7bb8c2062d440..6bfb26a8bf1a0 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -3508,9 +3508,9 @@ Nuvoton NPCM Platforms: Raspberry Pi Pico Platforms: status: maintained maintainers: - - yonsch - collaborators: - soburi + collaborators: + - yonsch files: - boards/raspberrypi/ - boards/adafruit/kb2040/ @@ -4806,6 +4806,8 @@ West: "West project: hal_rpi_pico": status: maintained maintainers: + - soburi + collaborators: - yonsch files: - modules/hal_rpi_pico/ From e4deb46ba10f3cad5f42379a21473e6147ea99f9 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Tue, 8 Oct 2024 16:15:53 -0500 Subject: [PATCH 1786/4482] dts: nxp_vref: Add current compensation prop Add DT property to enable current compensation feature of NXP VREF. Signed-off-by: Declan Snyder --- drivers/regulator/regulator_nxp_vref.c | 9 +++++++++ dts/bindings/regulator/nxp,vref.yaml | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/drivers/regulator/regulator_nxp_vref.c b/drivers/regulator/regulator_nxp_vref.c index 1e2f51e06b738..e0c8f30d46f67 100644 --- a/drivers/regulator/regulator_nxp_vref.c +++ b/drivers/regulator/regulator_nxp_vref.c @@ -26,6 +26,7 @@ struct regulator_nxp_vref_config { VREF_Type *base; uint16_t buf_start_delay; uint16_t bg_start_time; + bool current_compensation_en; }; static int regulator_nxp_vref_enable(const struct device *dev) @@ -183,6 +184,8 @@ static const struct regulator_driver_api api = { static int regulator_nxp_vref_init(const struct device *dev) { + const struct regulator_nxp_vref_config *config = dev->config; + VREF_Type *const base = config->base; int ret; regulator_common_data_init(dev); @@ -192,6 +195,10 @@ static int regulator_nxp_vref_init(const struct device *dev) return ret; } + if (config->current_compensation_en) { + base->CSR |= VREF_CSR_ICOMPEN_MASK; + } + return regulator_common_init(dev, false); } @@ -205,6 +212,8 @@ static int regulator_nxp_vref_init(const struct device *dev) nxp_buffer_startup_delay_us), \ .bg_start_time = DT_INST_PROP(inst, \ nxp_bandgap_startup_time_us), \ + .current_compensation_en = DT_INST_PROP(inst, \ + nxp_current_compensation_en), \ }; \ \ DEVICE_DT_INST_DEFINE(inst, regulator_nxp_vref_init, NULL, &data_##inst,\ diff --git a/dts/bindings/regulator/nxp,vref.yaml b/dts/bindings/regulator/nxp,vref.yaml index ce678f8708cd9..7f07dc681b601 100644 --- a/dts/bindings/regulator/nxp,vref.yaml +++ b/dts/bindings/regulator/nxp,vref.yaml @@ -34,6 +34,13 @@ properties: Maximum bandgap startup time as specified in the appropriate device data sheet, in microseconds. + nxp,current-compensation-en: + type: boolean + description: | + Enable second-order curvature compensation. + This must be enabled to achieve the performance stated in the datasheet. + However, the reset value of the peripheral has it disabled. + "#nxp,reference-cells": type: int const: 1 From a196ba564f879a29ab852a757389e26f1c7236de Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Tue, 8 Oct 2024 18:01:02 -0500 Subject: [PATCH 1787/4482] dts: nxp: rename lpadc nodes to adc Follow DT spec name recommendation, name the nodes "adc" instead of lpadc. Signed-off-by: Declan Snyder --- dts/arm/nxp/nxp_mcxn94x_common.dtsi | 4 ++-- dts/arm/nxp/nxp_rt118x.dtsi | 4 ++-- dts/arm/nxp/nxp_rt11xx.dtsi | 4 ++-- dts/arm/nxp/nxp_rt5xx_common.dtsi | 2 +- dts/arm/nxp/nxp_rt6xx_common.dtsi | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dts/arm/nxp/nxp_mcxn94x_common.dtsi b/dts/arm/nxp/nxp_mcxn94x_common.dtsi index 935f5aa7511df..e466493013c4c 100644 --- a/dts/arm/nxp/nxp_mcxn94x_common.dtsi +++ b/dts/arm/nxp/nxp_mcxn94x_common.dtsi @@ -825,7 +825,7 @@ }; - lpadc0: lpadc@10d000 { + lpadc0: adc@10d000 { compatible = "nxp,lpc-lpadc"; reg = <0x10d000 0x1000>; interrupts = <45 0>; @@ -842,7 +842,7 @@ nxp,references = <&vref 1800>; }; - lpadc1: lpadc@10e000 { + lpadc1: adc@10e000 { compatible = "nxp,lpc-lpadc"; reg = <0x10e000 0x1000>; interrupts = <46 0>; diff --git a/dts/arm/nxp/nxp_rt118x.dtsi b/dts/arm/nxp/nxp_rt118x.dtsi index c8dc44d2ee7ec..e2fc1c489f4a8 100644 --- a/dts/arm/nxp/nxp_rt118x.dtsi +++ b/dts/arm/nxp/nxp_rt118x.dtsi @@ -323,7 +323,7 @@ status = "disabled"; }; - lpadc1: lpadc@2600000 { + lpadc1: adc@2600000 { compatible = "nxp,lpc-lpadc"; reg = <0x2600000 0x304>; interrupts = <93 0>; @@ -339,7 +339,7 @@ clocks = <&ccm IMX_CCM_LPADC1_CLK 0 0>; }; - lpadc2: lpadc@2e00000 { + lpadc2: adc@2e00000 { compatible = "nxp,lpc-lpadc"; reg = <0x2e00000 0x304>; interrupts = <189 0>; diff --git a/dts/arm/nxp/nxp_rt11xx.dtsi b/dts/arm/nxp/nxp_rt11xx.dtsi index 30b6c5a404579..d1469a86b72f3 100644 --- a/dts/arm/nxp/nxp_rt11xx.dtsi +++ b/dts/arm/nxp/nxp_rt11xx.dtsi @@ -976,7 +976,7 @@ reg = <0x202c0000 DT_SIZE_K(512)>; }; - lpadc0: lpadc@40050000 { + lpadc0: adc@40050000 { compatible = "nxp,lpc-lpadc"; reg = <0x40050000 0x304>; interrupts = <88 0>; @@ -992,7 +992,7 @@ clocks = <&ccm IMX_CCM_LPADC1_CLK 0 0>; }; - lpadc1: lpadc@40054000 { + lpadc1: adc@40054000 { compatible = "nxp,lpc-lpadc"; reg = <0x40054000 0x304>; interrupts = <89 0>; diff --git a/dts/arm/nxp/nxp_rt5xx_common.dtsi b/dts/arm/nxp/nxp_rt5xx_common.dtsi index 8467b231cc9e7..116e9d44949ec 100644 --- a/dts/arm/nxp/nxp_rt5xx_common.dtsi +++ b/dts/arm/nxp/nxp_rt5xx_common.dtsi @@ -569,7 +569,7 @@ min-bus-freq = <400000>; }; - lpadc0: lpadc@13a000 { + lpadc0: adc@13a000 { compatible = "nxp,lpc-lpadc"; reg = <0x13a000 0x304>; interrupts = <22 0>; diff --git a/dts/arm/nxp/nxp_rt6xx_common.dtsi b/dts/arm/nxp/nxp_rt6xx_common.dtsi index 2b36664f757cd..bf2dc2daccd91 100644 --- a/dts/arm/nxp/nxp_rt6xx_common.dtsi +++ b/dts/arm/nxp/nxp_rt6xx_common.dtsi @@ -476,7 +476,7 @@ min-bus-freq = <400000>; }; - lpadc0: lpadc@13a000 { + lpadc0: adc@13a000 { compatible = "nxp,lpc-lpadc"; reg = <0x13a000 0x304>; interrupts = <22 0>; From 3853fb20b3d57e32eafc77d238e78f8194ae710a Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Tue, 8 Oct 2024 17:58:56 -0500 Subject: [PATCH 1788/4482] dts: nxp_lpc_lpadc: Make clk props optional These properties should eventually be removed from this binding as they have been introduced to control soc specific clock trees and don't correlate to anything in the IP, but for now just make them not required and remove them from DT for SOCs that don't even use them. Signed-off-by: Declan Snyder --- dts/arm/nxp/nxp_mcxn94x_common.dtsi | 4 ---- dts/arm/nxp/nxp_rt118x.dtsi | 2 -- dts/arm/nxp/nxp_rt11xx.dtsi | 2 -- dts/arm/nxp/nxp_rt5xx_common.dtsi | 2 -- dts/bindings/adc/nxp,lpc-lpadc.yaml | 2 -- 5 files changed, 12 deletions(-) diff --git a/dts/arm/nxp/nxp_mcxn94x_common.dtsi b/dts/arm/nxp/nxp_mcxn94x_common.dtsi index e466493013c4c..880442c40bb95 100644 --- a/dts/arm/nxp/nxp_mcxn94x_common.dtsi +++ b/dts/arm/nxp/nxp_mcxn94x_common.dtsi @@ -830,8 +830,6 @@ reg = <0x10d000 0x1000>; interrupts = <45 0>; status = "disabled"; - clk-divider = <1>; - clk-source = <0>; voltage-ref= <1>; calibration-average = <128>; power-level = <0>; @@ -847,8 +845,6 @@ reg = <0x10e000 0x1000>; interrupts = <46 0>; status = "disabled"; - clk-divider = <1>; - clk-source = <0>; voltage-ref= <0>; calibration-average = <128>; power-level = <1>; diff --git a/dts/arm/nxp/nxp_rt118x.dtsi b/dts/arm/nxp/nxp_rt118x.dtsi index e2fc1c489f4a8..10a18ebd4a80f 100644 --- a/dts/arm/nxp/nxp_rt118x.dtsi +++ b/dts/arm/nxp/nxp_rt118x.dtsi @@ -328,8 +328,6 @@ reg = <0x2600000 0x304>; interrupts = <93 0>; status = "disabled"; - clk-divider = <7>; - clk-source = <1>; voltage-ref= <1>; calibration-average = <128>; no-power-level; diff --git a/dts/arm/nxp/nxp_rt11xx.dtsi b/dts/arm/nxp/nxp_rt11xx.dtsi index d1469a86b72f3..04016dc040259 100644 --- a/dts/arm/nxp/nxp_rt11xx.dtsi +++ b/dts/arm/nxp/nxp_rt11xx.dtsi @@ -981,8 +981,6 @@ reg = <0x40050000 0x304>; interrupts = <88 0>; status = "disabled"; - clk-divider = <8>; - clk-source = <0>; voltage-ref= <1>; calibration-average = <128>; power-level = <0>; diff --git a/dts/arm/nxp/nxp_rt5xx_common.dtsi b/dts/arm/nxp/nxp_rt5xx_common.dtsi index 116e9d44949ec..aa9db51f12552 100644 --- a/dts/arm/nxp/nxp_rt5xx_common.dtsi +++ b/dts/arm/nxp/nxp_rt5xx_common.dtsi @@ -574,8 +574,6 @@ reg = <0x13a000 0x304>; interrupts = <22 0>; status = "disabled"; - clk-divider = <1>; - clk-source = <0>; voltage-ref= <1>; calibration-average = <128>; power-level = <0>; diff --git a/dts/bindings/adc/nxp,lpc-lpadc.yaml b/dts/bindings/adc/nxp,lpc-lpadc.yaml index 9888d2bbad1a1..2fa5009d69be6 100644 --- a/dts/bindings/adc/nxp,lpc-lpadc.yaml +++ b/dts/bindings/adc/nxp,lpc-lpadc.yaml @@ -16,12 +16,10 @@ properties: clk-divider: type: int - required: true description: clock divider for the converter clk-source: type: int - required: true description: source to attach the ADC clock to voltage-ref: From 7d2f0b8476e0c41d5b9e67811f84a04ea6723836 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Tue, 8 Oct 2024 17:35:39 -0500 Subject: [PATCH 1789/4482] soc: mcxw71: Add VREF node and clocking Add VREF node and clocking to MCXW71 SOC. Signed-off-by: Declan Snyder --- dts/arm/nxp/nxp_mcxw71.dtsi | 13 +++++++++++++ soc/nxp/mcx/mcxw/soc.c | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/dts/arm/nxp/nxp_mcxw71.dtsi b/dts/arm/nxp/nxp_mcxw71.dtsi index b8e9edf17bb33..30cee09385d09 100644 --- a/dts/arm/nxp/nxp_mcxw71.dtsi +++ b/dts/arm/nxp/nxp_mcxw71.dtsi @@ -317,6 +317,19 @@ clk-source = <2>; status = "disabled"; }; + + vref: regulator@4a000 { + compatible = "nxp,vref"; + regulator-name = "mcxw71-vref"; + reg = <0x4a000 0x20>; + #nxp,reference-cells = <1>; + nxp,buffer-startup-delay-us = <400>; + nxp,bandgap-startup-time-us = <20>; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <2100000>; + nxp,current-compensation-en; + status = "disabled"; + }; }; &fast_peripheral0 { diff --git a/soc/nxp/mcx/mcxw/soc.c b/soc/nxp/mcx/mcxw/soc.c index f3ab6c3745ec1..d00b648dee224 100644 --- a/soc/nxp/mcx/mcxw/soc.c +++ b/soc/nxp/mcx/mcxw/soc.c @@ -158,6 +158,10 @@ static ALWAYS_INLINE void clock_init(void) if (IS_ENABLED(CONFIG_CAN_MCUX_FLEXCAN)) { CLOCK_EnableClock(kCLOCK_Can0); } + + if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(vref), nxp_vref, okay)) { + CLOCK_EnableClock(kCLOCK_Vref0); + } } static void vbat_init(void) From 66ae0096a27b7b94054295515c97c6e4eece06f8 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Tue, 8 Oct 2024 17:36:11 -0500 Subject: [PATCH 1790/4482] boards: frdm_mcxw71: Enable VREF Enable VREF for frdm_mcxw71 board. Signed-off-by: Declan Snyder --- boards/nxp/frdm_mcxw71/doc/index.rst | 2 ++ boards/nxp/frdm_mcxw71/frdm_mcxw71.dts | 4 ++++ boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml | 1 + 3 files changed, 7 insertions(+) diff --git a/boards/nxp/frdm_mcxw71/doc/index.rst b/boards/nxp/frdm_mcxw71/doc/index.rst index 0910086e37b1f..a8d5d9632ced9 100644 --- a/boards/nxp/frdm_mcxw71/doc/index.rst +++ b/boards/nxp/frdm_mcxw71/doc/index.rst @@ -64,6 +64,8 @@ The ``frdm_mcxw71`` board target in Zephyr currently supports the following feat +-----------+------------+-------------------------------------+ | FLEXCAN | on-chip | can | +-----------+------------+-------------------------------------+ +| VREF | on-chip | regulator | ++-----------+------------+-------------------------------------+ Fetch Binary Blobs ****************** diff --git a/boards/nxp/frdm_mcxw71/frdm_mcxw71.dts b/boards/nxp/frdm_mcxw71/frdm_mcxw71.dts index 5a66fb297645b..542ddfbe1f8e9 100644 --- a/boards/nxp/frdm_mcxw71/frdm_mcxw71.dts +++ b/boards/nxp/frdm_mcxw71/frdm_mcxw71.dts @@ -50,6 +50,10 @@ }; }; +&vref { + status = "okay"; +}; + &gpioc { status = "okay"; }; diff --git a/boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml b/boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml index 99e97ddae898e..e45ad1e2998db 100644 --- a/boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml +++ b/boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml @@ -19,3 +19,4 @@ supported: - spi - i2c - can + - regulator From 4b3d88e82e1d3598a9d40faf37225e1d0f9e2628 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Mon, 14 Oct 2024 16:17:10 -0500 Subject: [PATCH 1791/4482] soc: nxp: MCXW71: Add LPADC node + clocking Add DT entry and default clocking for ADC0 on MCXW71. Signed-off-by: Declan Snyder --- dts/arm/nxp/nxp_mcxw71.dtsi | 16 ++++++++++++++++ soc/nxp/mcx/mcxw/soc.c | 6 ++++++ 2 files changed, 22 insertions(+) diff --git a/dts/arm/nxp/nxp_mcxw71.dtsi b/dts/arm/nxp/nxp_mcxw71.dtsi index 30cee09385d09..7b5f13e5d544e 100644 --- a/dts/arm/nxp/nxp_mcxw71.dtsi +++ b/dts/arm/nxp/nxp_mcxw71.dtsi @@ -318,6 +318,22 @@ status = "disabled"; }; + adc0: adc@47000 { + compatible = "nxp,lpc-lpadc"; + reg = <0x47000 0x1000>; + interrupts = <71 0>; + clocks = <&scg SCG_K4_FIRC_CLK 0x11c>; + voltage-ref= <1>; + calibration-average = <128>; + /* pwrlvl 0 is slow speed low power, 1 is opposite */ + power-level = <0>; + offset-value-a = <0>; + offset-value-b = <0>; + #io-channel-cells = <1>; + nxp,references = <&vref 1800>; + status = "disabled"; + }; + vref: regulator@4a000 { compatible = "nxp,vref"; regulator-name = "mcxw71-vref"; diff --git a/soc/nxp/mcx/mcxw/soc.c b/soc/nxp/mcx/mcxw/soc.c index d00b648dee224..e17d6a91d16ed 100644 --- a/soc/nxp/mcx/mcxw/soc.c +++ b/soc/nxp/mcx/mcxw/soc.c @@ -121,6 +121,8 @@ static ALWAYS_INLINE void clock_init(void) CLOCK_SetIpSrcDiv(kCLOCK_Lpi2c1, kSCG_SysClkDivBy16); CLOCK_SetIpSrc(kCLOCK_Lpspi0, kCLOCK_IpSrcFro192M); CLOCK_SetIpSrc(kCLOCK_Lpspi1, kCLOCK_IpSrcFro192M); + CLOCK_SetIpSrc(kCLOCK_Lpadc0, kCLOCK_IpSrcFro192M); + CLOCK_SetIpSrcDiv(kCLOCK_Lpadc0, kSCG_SysClkDivBy10); /* Ungate clocks if the peripheral is enabled in devicetree */ if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(lpuart0), nxp_lpc_lpuart, okay)) { @@ -162,6 +164,10 @@ static ALWAYS_INLINE void clock_init(void) if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(vref), nxp_vref, okay)) { CLOCK_EnableClock(kCLOCK_Vref0); } + + if (DT_NODE_HAS_COMPAT_STATUS(adc0, nxp_lpadc, okay)) { + CLOCK_EnableClock(kCLOCK_Lpadc0); + } } static void vbat_init(void) From c1affb981dd1f2c346783d5313b134c04780d439 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Mon, 14 Oct 2024 16:17:45 -0500 Subject: [PATCH 1792/4482] drivers: regulator_nxp_vref: Clear UTRIM on init Reset value of this register is supposed to be 0 but I noticed on some chip, it was not resetting to 0 on system reset, don't know why, but this supposedly redundant clear is fine for now. Signed-off-by: Declan Snyder --- drivers/regulator/regulator_nxp_vref.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/regulator/regulator_nxp_vref.c b/drivers/regulator/regulator_nxp_vref.c index e0c8f30d46f67..dee12f6f679c3 100644 --- a/drivers/regulator/regulator_nxp_vref.c +++ b/drivers/regulator/regulator_nxp_vref.c @@ -199,6 +199,9 @@ static int regulator_nxp_vref_init(const struct device *dev) base->CSR |= VREF_CSR_ICOMPEN_MASK; } + /* Workaround some chips not resetting the value correctly on reset */ + base->UTRIM = 0; + return regulator_common_init(dev, false); } From 5f51b0acbaad909639d950a3fc349c2289a1b8ed Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Mon, 14 Oct 2024 16:19:31 -0500 Subject: [PATCH 1793/4482] boards: frdm_mcxw71: Enable ADC and tests/sample Enable LPADC on the FRDM_MCXW71 and add overlays for tests and sample Signed-off-by: Declan Snyder --- boards/nxp/frdm_mcxw71/doc/index.rst | 2 + .../nxp/frdm_mcxw71/frdm_mcxw71-pinctrl.dtsi | 10 ++++ boards/nxp/frdm_mcxw71/frdm_mcxw71.dts | 6 +++ boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml | 1 + .../adc/adc_dt/boards/frdm_mcxw71.overlay | 29 +++++++++++ .../adc/adc_api/boards/frdm_mcxw71.overlay | 29 +++++++++++ .../voltage/boards/frdm_mcxw71.overlay | 48 +++++++++++++++++++ 7 files changed, 125 insertions(+) create mode 100644 samples/drivers/adc/adc_dt/boards/frdm_mcxw71.overlay create mode 100644 tests/drivers/adc/adc_api/boards/frdm_mcxw71.overlay create mode 100644 tests/drivers/regulator/voltage/boards/frdm_mcxw71.overlay diff --git a/boards/nxp/frdm_mcxw71/doc/index.rst b/boards/nxp/frdm_mcxw71/doc/index.rst index a8d5d9632ced9..87800853fdaf7 100644 --- a/boards/nxp/frdm_mcxw71/doc/index.rst +++ b/boards/nxp/frdm_mcxw71/doc/index.rst @@ -66,6 +66,8 @@ The ``frdm_mcxw71`` board target in Zephyr currently supports the following feat +-----------+------------+-------------------------------------+ | VREF | on-chip | regulator | +-----------+------------+-------------------------------------+ +| LPADC | on-chip | adc | ++-----------+------------+-------------------------------------+ Fetch Binary Blobs ****************** diff --git a/boards/nxp/frdm_mcxw71/frdm_mcxw71-pinctrl.dtsi b/boards/nxp/frdm_mcxw71/frdm_mcxw71-pinctrl.dtsi index d91adb8f252a1..29e41f6926e20 100644 --- a/boards/nxp/frdm_mcxw71/frdm_mcxw71-pinctrl.dtsi +++ b/boards/nxp/frdm_mcxw71/frdm_mcxw71-pinctrl.dtsi @@ -58,4 +58,14 @@ drive-strength = "low"; }; }; + + pinmux_lpadc0: pinmux_lpadc0 { + group0 { + pinmux = , + , + ; + drive-strength = "low"; + slew-rate = "fast"; + }; + }; }; diff --git a/boards/nxp/frdm_mcxw71/frdm_mcxw71.dts b/boards/nxp/frdm_mcxw71/frdm_mcxw71.dts index 542ddfbe1f8e9..4e7d1b31b4135 100644 --- a/boards/nxp/frdm_mcxw71/frdm_mcxw71.dts +++ b/boards/nxp/frdm_mcxw71/frdm_mcxw71.dts @@ -131,3 +131,9 @@ max-bitrate = <5000000>; }; }; + +&adc0 { + pinctrl-0 = <&pinmux_lpadc0>; + pinctrl-names = "default"; + status = "okay"; +}; diff --git a/boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml b/boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml index e45ad1e2998db..ffc4104008155 100644 --- a/boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml +++ b/boards/nxp/frdm_mcxw71/frdm_mcxw71.yaml @@ -20,3 +20,4 @@ supported: - i2c - can - regulator + - adc diff --git a/samples/drivers/adc/adc_dt/boards/frdm_mcxw71.overlay b/samples/drivers/adc/adc_dt/boards/frdm_mcxw71.overlay new file mode 100644 index 0000000000000..5bda571575da1 --- /dev/null +++ b/samples/drivers/adc/adc_dt/boards/frdm_mcxw71.overlay @@ -0,0 +1,29 @@ +/* + * Copyright 2024 NXP + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +/ { + zephyr,user { + io-channels = <&adc0 0>; + }; +}; + +&adc0 { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_EXTERNAL1"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + zephyr,vref-mv = <1800>; + /* channel 2 signal 6A */ + zephyr,input-positive = ; + }; +}; diff --git a/tests/drivers/adc/adc_api/boards/frdm_mcxw71.overlay b/tests/drivers/adc/adc_api/boards/frdm_mcxw71.overlay new file mode 100644 index 0000000000000..5bda571575da1 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/frdm_mcxw71.overlay @@ -0,0 +1,29 @@ +/* + * Copyright 2024 NXP + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +/ { + zephyr,user { + io-channels = <&adc0 0>; + }; +}; + +&adc0 { + #address-cells = <1>; + #size-cells = <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_EXTERNAL1"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + zephyr,vref-mv = <1800>; + /* channel 2 signal 6A */ + zephyr,input-positive = ; + }; +}; diff --git a/tests/drivers/regulator/voltage/boards/frdm_mcxw71.overlay b/tests/drivers/regulator/voltage/boards/frdm_mcxw71.overlay new file mode 100644 index 0000000000000..8bd87d26b9e2c --- /dev/null +++ b/tests/drivers/regulator/voltage/boards/frdm_mcxw71.overlay @@ -0,0 +1,48 @@ +/* + * Copyright 2024 NXP + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +/* To do this test, connect LPADC0 channel 6A(J4 pin 5) to VREF_OUT (J2 pin 3) */ + +/ { + resources: resources { + compatible = "test-regulator-voltage"; + regulators = <&vref>; + tolerance-microvolt = <40000>; + set-read-delay-ms = <1>; + adc-avg-count = <10>; + io-channels = <&adc0 0>; + min-microvolt = <1000000>; + max-microvolt = <2100000>; + }; +}; + +&vref { + regulator-initial-mode = ; +}; + +&adc0 { + #address-cells = <1>; + #size-cells = <0>; + + /* In this case, the LPADC reference source cannot be set to VREFO, + * switch the reference source to VDD_ANA. + */ + voltage-ref= <0>; + + channel@0 { + reg = <0>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_EXTERNAL0"; + zephyr,vref-mv = <3300>; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + /* the signal name is ADC0_A6 but it is still channel 2 */ + zephyr,input-positive = ; + }; +}; From 3023e76371d6fad00db2e2091023cef4204aa0a7 Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Thu, 22 Aug 2024 10:06:28 +0200 Subject: [PATCH 1794/4482] snippets: Add snippet for the Zephyr Bluetooth Controller By defining this snippet it becomes simpler to build an application for the Zephyr Bluetooth Controller in environments where this is not enabled in device tree by default. It removes the need for adding boilerplate overlay files to applications. Also, we would be able to add this snippet by default for samples and tests where it is required to use the zephyr link layer. Signed-off-by: Rubin Gerritsen --- snippets/bt-ll-sw-split/README.rst | 24 +++++++++++++++++++ snippets/bt-ll-sw-split/bt-ll-sw-split.conf | 3 +++ .../bt-ll-sw-split/bt-ll-sw-split.overlay | 9 +++++++ snippets/bt-ll-sw-split/snippet.yml | 4 ++++ 4 files changed, 40 insertions(+) create mode 100644 snippets/bt-ll-sw-split/README.rst create mode 100644 snippets/bt-ll-sw-split/bt-ll-sw-split.conf create mode 100644 snippets/bt-ll-sw-split/bt-ll-sw-split.overlay create mode 100644 snippets/bt-ll-sw-split/snippet.yml diff --git a/snippets/bt-ll-sw-split/README.rst b/snippets/bt-ll-sw-split/README.rst new file mode 100644 index 0000000000000..1c7161b22f100 --- /dev/null +++ b/snippets/bt-ll-sw-split/README.rst @@ -0,0 +1,24 @@ +.. _snippet-bt-ll-sw-split: + +Zephyr Bluetooth LE Controller (bt-ll-sw-split) +############################################### + +You can build with this snippet by following the instructions in :ref:`the snippets usage page`. +When building with ``west``, you can do: + +.. code-block:: console + + west build -S bt-ll-sw-split [...] + +Overview +******** + +This selects the Zephyr Bluetooth LE Controller. + +Requirements +************ + +Hardware support for: + +- :kconfig:option:`CONFIG_BT` +- :kconfig:option:`CONFIG_BT_CTLR` diff --git a/snippets/bt-ll-sw-split/bt-ll-sw-split.conf b/snippets/bt-ll-sw-split/bt-ll-sw-split.conf new file mode 100644 index 0000000000000..f2dd622901bb1 --- /dev/null +++ b/snippets/bt-ll-sw-split/bt-ll-sw-split.conf @@ -0,0 +1,3 @@ +CONFIG_BT=y +CONFIG_BT_CTLR=y +CONFIG_BT_LL_SW_SPLIT=y diff --git a/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay b/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay new file mode 100644 index 0000000000000..04bf83ef44d4c --- /dev/null +++ b/snippets/bt-ll-sw-split/bt-ll-sw-split.overlay @@ -0,0 +1,9 @@ +&bt_hci_controller { + status = "okay"; +}; + +/ { + chosen { + zephyr,bt-hci = &bt_hci_controller; + }; +}; diff --git a/snippets/bt-ll-sw-split/snippet.yml b/snippets/bt-ll-sw-split/snippet.yml new file mode 100644 index 0000000000000..27a7325dc7e6f --- /dev/null +++ b/snippets/bt-ll-sw-split/snippet.yml @@ -0,0 +1,4 @@ +name: bt-ll-sw-split +append: + EXTRA_CONF_FILE: bt-ll-sw-split.conf + EXTRA_DTC_OVERLAY_FILE: bt-ll-sw-split.overlay From 4773975a6b355a80b24cd4ad69e8864d2d2fac5a Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Thu, 11 Jul 2024 18:27:17 -0500 Subject: [PATCH 1795/4482] scripts: Add dt_compat_any_has_prop value param Add optional value parameter to dt_compat_any_has_prop kconfig preprocessor function, which puts an additional constraint on the truth of the function in that the property value must match the parameter value. Signed-off-by: Declan Snyder --- doc/build/kconfig/preprocessor-functions.rst | 2 +- scripts/kconfig/kconfigfunctions.py | 21 ++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/doc/build/kconfig/preprocessor-functions.rst b/doc/build/kconfig/preprocessor-functions.rst index 3ffcea2a7c72f..20e5cd3631e16 100644 --- a/doc/build/kconfig/preprocessor-functions.rst +++ b/doc/build/kconfig/preprocessor-functions.rst @@ -39,7 +39,7 @@ while the ``*_hex`` version returns a hexadecimal value starting with ``0x``. $(dt_chosen_reg_addr_int,[,,]) $(dt_chosen_reg_size_hex,[,,]) $(dt_chosen_reg_size_int,[,,]) - $(dt_compat_any_has_prop,,) + $(dt_compat_any_has_prop,,[,]) $(dt_compat_any_on_bus,,) $(dt_compat_enabled,) $(dt_compat_on_bus,,) diff --git a/scripts/kconfig/kconfigfunctions.py b/scripts/kconfig/kconfigfunctions.py index c29e039abe89a..03071fba7dfd8 100644 --- a/scripts/kconfig/kconfigfunctions.py +++ b/scripts/kconfig/kconfigfunctions.py @@ -738,7 +738,7 @@ def dt_compat_enabled(kconf, _, compat): def dt_compat_on_bus(kconf, _, compat, bus): """ - This function takes a 'compat' and returns "y" if we find an "enabled" + This function takes a 'compat' and returns "y" if we find an enabled compatible node in the EDT which is on bus 'bus'. It returns "n" otherwise. """ if doc_mode or edt is None: @@ -751,10 +751,13 @@ def dt_compat_on_bus(kconf, _, compat, bus): return "n" -def dt_compat_any_has_prop(kconf, _, compat, prop): +def dt_compat_any_has_prop(kconf, _, compat, prop, value=None): """ - This function takes a 'compat' and a 'prop' and returns "y" if any - node with compatible 'compat' also has a valid property 'prop'. + This function takes a 'compat', a 'prop', and a 'value'. + If value=None, the function returns "y" if any + enabled node with compatible 'compat' also has a valid property 'prop'. + If value is given, the function returns "y" if any enabled node with compatible 'compat' + also has a valid property 'prop' with value 'value'. It returns "n" otherwise. """ if doc_mode or edt is None: @@ -763,8 +766,10 @@ def dt_compat_any_has_prop(kconf, _, compat, prop): if compat in edt.compat2okay: for node in edt.compat2okay[compat]: if prop in node.props: - return "y" - + if value is None: + return "y" + elif str(node.props[prop].val) == value: + return "y" return "n" def dt_nodelabel_has_compat(kconf, _, label, compat): @@ -805,7 +810,7 @@ def dt_node_has_compat(kconf, _, path, compat): def dt_nodelabel_enabled_with_compat(kconf, _, label, compat): """ - This function takes a 'label' and returns "y" if an "enabled" node with + This function takes a 'label' and returns "y" if an enabled node with such label can be found in the EDT and that node is compatible with the provided 'compat', otherwise it returns "n". """ @@ -1000,7 +1005,7 @@ def inc_dec(kconf, name, *args): "dt_has_compat": (dt_has_compat, 1, 1), "dt_compat_enabled": (dt_compat_enabled, 1, 1), "dt_compat_on_bus": (dt_compat_on_bus, 2, 2), - "dt_compat_any_has_prop": (dt_compat_any_has_prop, 2, 2), + "dt_compat_any_has_prop": (dt_compat_any_has_prop, 2, 3), "dt_chosen_label": (dt_chosen_label, 1, 1), "dt_chosen_enabled": (dt_chosen_enabled, 1, 1), "dt_chosen_path": (dt_chosen_path, 1, 1), From 20e313496c3e306650367d4923a713c93dc1a8bc Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Thu, 24 Oct 2024 16:43:49 -0500 Subject: [PATCH 1796/4482] dts: arm: nxp_mcxn94x: fix support for NS mode Fix build error for MCXN94X devicetree for nonsecure mode Signed-off-by: Daniel DeGrasse --- dts/arm/nxp/nxp_mcxn94x_ns.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dts/arm/nxp/nxp_mcxn94x_ns.dtsi b/dts/arm/nxp/nxp_mcxn94x_ns.dtsi index e92def9621420..9e8cd4477599e 100644 --- a/dts/arm/nxp/nxp_mcxn94x_ns.dtsi +++ b/dts/arm/nxp/nxp_mcxn94x_ns.dtsi @@ -4,6 +4,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include +#include + / { soc { sram: sram@4000000 { From c966eac722e351f4bb6acb5084b827c751b44235 Mon Sep 17 00:00:00 2001 From: Lars Knudsen Date: Fri, 25 Oct 2024 13:42:17 +0200 Subject: [PATCH 1797/4482] Bluetooth: Shell: Fix missing RX QoS param and MSE check The bis_iso_qos.rx was missing in param sent in bt_iso_big_sync Also, MSE = 0 is valid (fixed error check) Signed-off-by: Lars Knudsen --- subsys/bluetooth/host/shell/iso.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/bluetooth/host/shell/iso.c b/subsys/bluetooth/host/shell/iso.c index b42340452a213..7c30b09bce91e 100644 --- a/subsys/bluetooth/host/shell/iso.c +++ b/subsys/bluetooth/host/shell/iso.c @@ -821,6 +821,7 @@ static int cmd_big_sync(const struct shell *sh, size_t argc, char *argv[]) } bis_iso_qos.tx = NULL; + bis_iso_qos.rx = &iso_rx_qos; param.bis_channels = bis_channels; param.num_bis = BIS_ISO_CHAN_COUNT; @@ -846,9 +847,8 @@ static int cmd_big_sync(const struct shell *sh, size_t argc, char *argv[]) return -ENOEXEC; } - if (!IN_RANGE(mse, - BT_ISO_SYNC_MSE_MIN, - BT_ISO_SYNC_MSE_MAX)) { + if (mse != BT_ISO_SYNC_MSE_ANY && + !IN_RANGE(mse, BT_ISO_SYNC_MSE_MIN, BT_ISO_SYNC_MSE_MAX)) { shell_error(sh, "Invalid mse %lu", mse); return -ENOEXEC; From ea099b039f6c39e1ce9c61ca9735c41bcf4ba7e0 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 25 Oct 2024 16:00:11 +0300 Subject: [PATCH 1798/4482] tests: net: wifi: Disable native/64 from tests There are issues with 64 bit compilation in hostap so disable native_sim/native/64 board from the tests. The board will be enabled again after updating the hostap from upstream and fixing the issues. Fixes #80437 Signed-off-by: Jukka Rissanen --- tests/net/wifi/configs/testcase.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/net/wifi/configs/testcase.yaml b/tests/net/wifi/configs/testcase.yaml index 017407bc8467c..7d4c1c6456b93 100644 --- a/tests/net/wifi/configs/testcase.yaml +++ b/tests/net/wifi/configs/testcase.yaml @@ -6,7 +6,6 @@ common: - net platform_allow: - native_sim - - native_sim/native/64 tests: wifi.build.crypto_default: extra_configs: From faba6325e96349248a6c5c57104bf0da0f669acc Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Fri, 25 Oct 2024 13:18:50 +0200 Subject: [PATCH 1799/4482] modules/hostap: Fix size_t print format specifier The format specifier for size_t is zu. Using d only works when int and size_t are the same underlying type which is not the case for 64bit systems, which leads to a build warning in this case. Signed-off-by: Alberto Escolar Piedras --- modules/hostap/src/supp_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index 26e8304295fb1..75b0962b000c2 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -387,7 +387,7 @@ static int del_interface(struct supplicant_context *ctx, struct net_if *iface) supplicant_generate_state_event(ifname, NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVING, 0); if (sizeof(event->interface_status.ifname) < strlen(ifname)) { - wpa_printf(MSG_ERROR, "Interface name too long: %s (max: %d)", + wpa_printf(MSG_ERROR, "Interface name too long: %s (max: %zu)", ifname, sizeof(event->interface_status.ifname)); goto free; } From 0705a6301cf80ddfe9668ad4fcc3c75702b153c4 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Wed, 23 Oct 2024 12:40:10 +0200 Subject: [PATCH 1800/4482] west: runners: nrf: Add support for the suit manifest starter With the recent introduction of the SUIT manifest starter binary blob, it is now possible to use it with the nRF54H20 during the flashing procedure in order to provide a valid SUIT manifest to the system. This PR introduces the code that handles programming the SUIT manifest starter, as well as a new --suit-manifest-starter command-line option. Signed-off-by: Carles Cufi --- scripts/west_commands/runners/nrf_common.py | 78 ++++++++++++++++++--- scripts/west_commands/runners/nrfutil.py | 17 ++++- 2 files changed, 83 insertions(+), 12 deletions(-) diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index 3d27c60f74bd0..cf723ba7bd3e6 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -7,6 +7,7 @@ import abc from collections import deque +import functools import os from pathlib import Path import shlex @@ -14,6 +15,11 @@ import sys from re import fullmatch, escape +from zephyr_ext_common import ZEPHYR_BASE + +sys.path.append(os.fspath(Path(__file__).parent.parent.parent)) +import zephyr_module + from runners.core import ZephyrBinaryRunner, RunnerCaps try: @@ -34,6 +40,29 @@ } } +# Relative to the root of the hal_nordic module +SUIT_STARTER_PATH = Path('zephyr/blobs/suit/bin/suit_manifest_starter.hex') + +@functools.cache +def _get_suit_starter(): + path = None + modules = zephyr_module.parse_modules(ZEPHYR_BASE) + for m in modules: + if 'hal_nordic' in m.meta.get('name'): + path = Path(m.project) + break + + if not path: + raise RuntimeError("hal_nordic project missing in the manifest") + + suit_starter = path / SUIT_STARTER_PATH + if not suit_starter.exists(): + raise RuntimeError("Unable to find suit manifest starter file, " + "please make sure to run \'west blobs fetch " + "hal_nordic\'") + + return str(suit_starter.resolve()) + class NrfBinaryRunner(ZephyrBinaryRunner): '''Runner front-end base class for nrf tools.''' @@ -51,6 +80,9 @@ def __init__(self, cfg, family, softreset, dev_id, erase=False, self.force = force self.recover = bool(recover) + # Only applicable for nrfutil + self.suit_starter = False + self.tool_opt = [] for opts in [shlex.split(opt) for opt in tool_opt]: self.tool_opt += opts @@ -425,22 +457,50 @@ def reset_target(self): def do_require(self): ''' Ensure the tool is installed ''' + def _check_suit_starter(self, op): + op = op['operation'] + if op['type'] not in ('erase', 'recover', 'program'): + return None + elif op['type'] == 'program' and op['chip_erase_mode'] != "ERASE_UICR": + return None + + file = _get_suit_starter() + self.logger.debug(f'suit starter: {file}') + + return file + def op_program(self, hex_file, erase, qspi_erase, defer=False, core=None): + args = self._op_program(hex_file, erase, qspi_erase) + self.exec_op('program', defer, core, **args) + + def _op_program(self, hex_file, erase, qspi_erase): args = {'firmware': {'file': hex_file}, 'chip_erase_mode': erase, 'verify': 'VERIFY_READ'} if qspi_erase: args['qspi_erase_mode'] = qspi_erase - self.exec_op('program', defer, core, **args) + + return args def exec_op(self, op, defer=False, core=None, **kwargs): - _op = f'{op}' - op = {'operation': {'type': _op}} - if core: - op['core'] = core - op['operation'].update(kwargs) - self.logger.debug(f'defer: {defer} op: {op}') - if defer or not self.do_exec_op(op, force=False): - self.ops.append(op) + + def _exec_op(op, defer=False, core=None, **kwargs): + _op = f'{op}' + op = {'operation': {'type': _op}} + if core: + op['core'] = core + op['operation'].update(kwargs) + self.logger.debug(f'defer: {defer} op: {op}') + if defer or not self.do_exec_op(op, force=False): + self.ops.append(op) + return op + + _op = _exec_op(op, defer, core, **kwargs) + # Check if the suit manifest starter needs programming + if self.suit_starter and self.family == 'NRF54H_FAMILY': + file = self._check_suit_starter(_op) + if file: + args = self._op_program(file, 'ERASE_NONE', None) + _exec_op('program', defer, core, **args) @abc.abstractmethod def do_exec_op(self, op, force=False): diff --git a/scripts/west_commands/runners/nrfutil.py b/scripts/west_commands/runners/nrfutil.py index ec1328e4edc99..0f83c78f7d609 100644 --- a/scripts/west_commands/runners/nrfutil.py +++ b/scripts/west_commands/runners/nrfutil.py @@ -13,15 +13,18 @@ from runners.core import _DRY_RUN from runners.nrf_common import NrfBinaryRunner - class NrfUtilBinaryRunner(NrfBinaryRunner): '''Runner front-end for nrfutil.''' def __init__(self, cfg, family, softreset, dev_id, erase=False, - reset=True, tool_opt=[], force=False, recover=False): + reset=True, tool_opt=[], force=False, recover=False, + suit_starter=False): super().__init__(cfg, family, softreset, dev_id, erase, reset, tool_opt, force, recover) + + self.suit_starter = suit_starter + self._ops = [] self._op_id = 1 @@ -39,7 +42,15 @@ def do_create(cls, cfg, args): args.dev_id, erase=args.erase, reset=args.reset, tool_opt=args.tool_opt, force=args.force, - recover=args.recover) + recover=args.recover, + suit_starter=args.suit_manifest_starter) + + @classmethod + def do_add_parser(cls, parser): + super().do_add_parser(parser) + parser.add_argument('--suit-manifest-starter', required=False, + action='store_true', + help='Use the SUIT manifest starter file') def _exec(self, args): jout_all = [] From 1dd59ea20383808e565567cb988acb9cef79ed17 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Tue, 22 Oct 2024 13:15:32 +0200 Subject: [PATCH 1801/4482] Bluetooth: Audio: Remove BT_AUDIO_BROADCAST_CODE_SIZE Removed the LE Audio specific definition and instead refer to the value defined by iso.h as it is ISO/Core that defines this size, and not BAP/Audio. Signed-off-by: Emil Gydesen --- doc/releases/migration-guide-4.0.rst | 3 +++ include/zephyr/bluetooth/audio/audio.h | 3 --- include/zephyr/bluetooth/audio/bap.h | 11 ++++++----- include/zephyr/bluetooth/audio/cap.h | 2 +- samples/bluetooth/bap_broadcast_sink/src/main.c | 6 +++--- samples/bluetooth/bap_broadcast_source/src/main.c | 3 +-- .../cap_acceptor/src/cap_acceptor_broadcast.c | 6 +++--- subsys/bluetooth/audio/bap_broadcast_assistant.c | 11 +++++------ subsys/bluetooth/audio/bap_broadcast_sink.c | 3 ++- subsys/bluetooth/audio/bap_endpoint.h | 2 +- subsys/bluetooth/audio/bap_internal.h | 2 +- subsys/bluetooth/audio/bap_scan_delegator.c | 3 ++- subsys/bluetooth/audio/cap_initiator.c | 4 ++-- subsys/bluetooth/audio/shell/bap.c | 2 +- .../bluetooth/audio/shell/bap_broadcast_assistant.c | 7 +++---- subsys/bluetooth/audio/shell/bap_scan_delegator.c | 9 +++++---- tests/bluetooth/tester/src/audio/btp/btp_bap.h | 2 +- tests/bluetooth/tester/src/audio/btp/btp_cap.h | 2 +- tests/bluetooth/tester/src/audio/btp_bap_broadcast.c | 5 ++--- tests/bluetooth/tester/src/audio/btp_bap_broadcast.h | 2 +- .../audio/src/bap_broadcast_assistant_test.c | 11 +++++------ .../bluetooth/audio/src/bap_broadcast_sink_test.c | 8 ++++---- .../bluetooth/audio/src/bap_scan_delegator_test.c | 6 +++--- tests/bsim/bluetooth/audio/src/cap_acceptor_test.c | 2 +- tests/bsim/bluetooth/audio/src/cap_commander_test.c | 5 +++-- 25 files changed, 60 insertions(+), 60 deletions(-) diff --git a/doc/releases/migration-guide-4.0.rst b/doc/releases/migration-guide-4.0.rst index f68275f286c5e..f5ad27bff7767 100644 --- a/doc/releases/migration-guide-4.0.rst +++ b/doc/releases/migration-guide-4.0.rst @@ -395,6 +395,9 @@ Bluetooth Audio instances of :c:func:`bt_cap_initiator_broadcast_get_id` and :c:func:`bt_bap_broadcast_source_get_id` has been removed(:github:`80228`) +* ``BT_AUDIO_BROADCAST_CODE_SIZE`` has been removed and ``BT_ISO_BROADCAST_CODE_SIZE`` should be + used instead. (:github:`80217`) + Bluetooth Classic ================= diff --git a/include/zephyr/bluetooth/audio/audio.h b/include/zephyr/bluetooth/audio/audio.h index 3b62ae9d4a71a..ed44924fc52ce 100644 --- a/include/zephyr/bluetooth/audio/audio.h +++ b/include/zephyr/bluetooth/audio/audio.h @@ -49,9 +49,6 @@ extern "C" { #define BT_AUDIO_PD_MAX 0xFFFFFFU /** Indicates that the unicast server does not have a preference for any retransmission number */ #define BT_AUDIO_RTN_PREF_NONE 0xFFU -/** Maximum size of the broadcast code in octets */ -#define BT_AUDIO_BROADCAST_CODE_SIZE 16 - /** The minimum size of a Broadcast Name as defined by Bluetooth Assigned Numbers */ #define BT_AUDIO_BROADCAST_NAME_LEN_MIN 4 /** The maximum size of a Broadcast Name as defined by Bluetooth Assigned Numbers */ diff --git a/include/zephyr/bluetooth/audio/bap.h b/include/zephyr/bluetooth/audio/bap.h index e2dc29ac3a0a9..a85dec860e4e1 100644 --- a/include/zephyr/bluetooth/audio/bap.h +++ b/include/zephyr/bluetooth/audio/bap.h @@ -572,7 +572,7 @@ struct bt_bap_scan_delegator_recv_state { * * Only valid if encrypt_state is @ref BT_BAP_BIG_ENC_STATE_BCODE_REQ */ - uint8_t bad_code[BT_AUDIO_BROADCAST_CODE_SIZE]; + uint8_t bad_code[BT_ISO_BROADCAST_CODE_SIZE]; /** Number of subgroups */ uint8_t num_subgroups; @@ -652,7 +652,7 @@ struct bt_bap_scan_delegator_cb { */ void (*broadcast_code)(struct bt_conn *conn, const struct bt_bap_scan_delegator_recv_state *recv_state, - const uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]); + const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]); /** * @brief Broadcast Isochronous Stream synchronize request * @@ -2058,7 +2058,7 @@ struct bt_bap_broadcast_source_param { * The string "Broadcast Code" shall be * [42 72 6F 61 64 63 61 73 74 20 43 6F 64 65 00 00] */ - uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]; + uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]; #if defined(CONFIG_BT_ISO_TEST_PARAMS) || defined(__DOXYGEN__) /** @@ -2298,7 +2298,8 @@ int bt_bap_broadcast_sink_create(struct bt_le_per_adv_sync *pa_sync, uint32_t br * @return 0 in case of success or negative value in case of error. */ int bt_bap_broadcast_sink_sync(struct bt_bap_broadcast_sink *sink, uint32_t indexes_bitfield, - struct bt_bap_stream *streams[], const uint8_t broadcast_code[16]); + struct bt_bap_stream *streams[], + const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]); /** * @brief Stop audio broadcast sink. @@ -2799,7 +2800,7 @@ int bt_bap_broadcast_assistant_mod_src( */ int bt_bap_broadcast_assistant_set_broadcast_code( struct bt_conn *conn, uint8_t src_id, - const uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]); + const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]); /** * @brief Remove a source from the server. diff --git a/include/zephyr/bluetooth/audio/cap.h b/include/zephyr/bluetooth/audio/cap.h index a90a464c7ccfd..69e984711e87c 100644 --- a/include/zephyr/bluetooth/audio/cap.h +++ b/include/zephyr/bluetooth/audio/cap.h @@ -482,7 +482,7 @@ struct bt_cap_initiator_broadcast_create_param { * The string "Broadcast Code" shall be * [42 72 6F 61 64 63 61 73 74 20 43 6F 64 65 00 00] */ - uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]; + uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]; #if defined(CONFIG_BT_ISO_TEST_PARAMS) || defined(__DOXYGEN__) /** diff --git a/samples/bluetooth/bap_broadcast_sink/src/main.c b/samples/bluetooth/bap_broadcast_sink/src/main.c index 39ea5e82d8303..8fd6d01ec4a6c 100644 --- a/samples/bluetooth/bap_broadcast_sink/src/main.c +++ b/samples/bluetooth/bap_broadcast_sink/src/main.c @@ -148,7 +148,7 @@ static const struct bt_audio_codec_cap codec_cap = BT_AUDIO_CODEC_CAP_LC3( static const uint32_t bis_index_mask = BIT_MASK(ARRAY_SIZE(streams)); static uint32_t requested_bis_sync; static uint32_t bis_index_bitfield; -static uint8_t sink_broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]; +static uint8_t sink_broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]; uint64_t total_rx_iso_packet_count; /* This value is exposed to test code */ @@ -966,13 +966,13 @@ static int pa_sync_term_req_cb(struct bt_conn *conn, static void broadcast_code_cb(struct bt_conn *conn, const struct bt_bap_scan_delegator_recv_state *recv_state, - const uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]) + const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]) { printk("Broadcast code received for %p\n", recv_state); req_recv_state = recv_state; - (void)memcpy(sink_broadcast_code, broadcast_code, BT_AUDIO_BROADCAST_CODE_SIZE); + (void)memcpy(sink_broadcast_code, broadcast_code, BT_ISO_BROADCAST_CODE_SIZE); k_sem_give(&sem_broadcast_code_received); } diff --git a/samples/bluetooth/bap_broadcast_source/src/main.c b/samples/bluetooth/bap_broadcast_source/src/main.c index b703c25cceb8f..9d3fc8759e12f 100644 --- a/samples/bluetooth/bap_broadcast_source/src/main.c +++ b/samples/bluetooth/bap_broadcast_source/src/main.c @@ -27,8 +27,7 @@ #include #include -BUILD_ASSERT(strlen(CONFIG_BROADCAST_CODE) <= BT_AUDIO_BROADCAST_CODE_SIZE, - "Invalid broadcast code"); +BUILD_ASSERT(strlen(CONFIG_BROADCAST_CODE) <= BT_ISO_BROADCAST_CODE_SIZE, "Invalid broadcast code"); /* Zephyr Controller works best while Extended Advertising interval to be a multiple * of the ISO Interval minus 10 ms (max. advertising random delay). This is diff --git a/samples/bluetooth/cap_acceptor/src/cap_acceptor_broadcast.c b/samples/bluetooth/cap_acceptor/src/cap_acceptor_broadcast.c index 60fb40b6daefb..4bb2b24bc4c17 100644 --- a/samples/bluetooth/cap_acceptor/src/cap_acceptor_broadcast.c +++ b/samples/bluetooth/cap_acceptor/src/cap_acceptor_broadcast.c @@ -54,7 +54,7 @@ ATOMIC_DEFINE(flags, FLAG_NUM); static struct broadcast_sink { const struct bt_bap_scan_delegator_recv_state *req_recv_state; - uint8_t sink_broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]; + uint8_t sink_broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]; struct bt_bap_broadcast_sink *bap_broadcast_sink; struct bt_cap_stream broadcast_stream; struct bt_le_per_adv_sync *pa_sync; @@ -424,14 +424,14 @@ static int pa_sync_term_req_cb(struct bt_conn *conn, static void broadcast_code_cb(struct bt_conn *conn, const struct bt_bap_scan_delegator_recv_state *recv_state, - const uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]) + const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]) { LOG_INF("Broadcast code received for %p", recv_state); broadcast_sink.req_recv_state = recv_state; (void)memcpy(broadcast_sink.sink_broadcast_code, broadcast_code, - BT_AUDIO_BROADCAST_CODE_SIZE); + BT_ISO_BROADCAST_CODE_SIZE); atomic_set_bit(flags, FLAG_BROADCAST_CODE_RECEIVED); } diff --git a/subsys/bluetooth/audio/bap_broadcast_assistant.c b/subsys/bluetooth/audio/bap_broadcast_assistant.c index 70f6a5c778fed..f5105eb24032e 100644 --- a/subsys/bluetooth/audio/bap_broadcast_assistant.c +++ b/subsys/bluetooth/audio/bap_broadcast_assistant.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -262,8 +263,7 @@ static int parse_recv_state(const void *data, uint16_t length, return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); } - broadcast_code = net_buf_simple_pull_mem(&buf, - BT_AUDIO_BROADCAST_CODE_SIZE); + broadcast_code = net_buf_simple_pull_mem(&buf, BT_ISO_BROADCAST_CODE_SIZE); (void)memcpy(recv_state->bad_code, broadcast_code, sizeof(recv_state->bad_code)); } @@ -1446,7 +1446,7 @@ int bt_bap_broadcast_assistant_mod_src(struct bt_conn *conn, int bt_bap_broadcast_assistant_set_broadcast_code( struct bt_conn *conn, uint8_t src_id, - const uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]) + const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]) { struct bt_bap_bass_cp_broadcase_code *cp; struct bap_broadcast_assistant_instance *inst; @@ -1479,10 +1479,9 @@ int bt_bap_broadcast_assistant_set_broadcast_code( cp->opcode = BT_BAP_BASS_OP_BROADCAST_CODE; cp->src_id = src_id; - (void)memcpy(cp->broadcast_code, broadcast_code, - BT_AUDIO_BROADCAST_CODE_SIZE); + (void)memcpy(cp->broadcast_code, broadcast_code, BT_ISO_BROADCAST_CODE_SIZE); - LOG_HEXDUMP_DBG(cp->broadcast_code, BT_AUDIO_BROADCAST_CODE_SIZE, "broadcast code:"); + LOG_HEXDUMP_DBG(cp->broadcast_code, BT_ISO_BROADCAST_CODE_SIZE, "broadcast code:"); return bt_bap_broadcast_assistant_common_cp(conn, &att_buf); } diff --git a/subsys/bluetooth/audio/bap_broadcast_sink.c b/subsys/bluetooth/audio/bap_broadcast_sink.c index aece13def247f..611ecb3b73a6e 100644 --- a/subsys/bluetooth/audio/bap_broadcast_sink.c +++ b/subsys/bluetooth/audio/bap_broadcast_sink.c @@ -1157,7 +1157,8 @@ int bt_bap_broadcast_sink_create(struct bt_le_per_adv_sync *pa_sync, uint32_t br } int bt_bap_broadcast_sink_sync(struct bt_bap_broadcast_sink *sink, uint32_t indexes_bitfield, - struct bt_bap_stream *streams[], const uint8_t broadcast_code[16]) + struct bt_bap_stream *streams[], + const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]) { struct bt_iso_big_sync_param param; struct bt_audio_codec_cfg *codec_cfgs[CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT] = {NULL}; diff --git a/subsys/bluetooth/audio/bap_endpoint.h b/subsys/bluetooth/audio/bap_endpoint.h index 83d7e34ddd0fc..08d385aefacba 100644 --- a/subsys/bluetooth/audio/bap_endpoint.h +++ b/subsys/bluetooth/audio/bap_endpoint.h @@ -122,7 +122,7 @@ struct bt_bap_broadcast_source { /* The codec specific configured data for each stream in the subgroup */ struct bt_audio_broadcast_stream_data stream_data[BROADCAST_STREAM_CNT]; #endif /* CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_SIZE > 0 */ - uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]; + uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]; /* The complete codec specific configured data for each stream in the subgroup. * This contains both the subgroup and the BIS-specific data for each stream. diff --git a/subsys/bluetooth/audio/bap_internal.h b/subsys/bluetooth/audio/bap_internal.h index 777b136d6c193..28cf88e4659d3 100644 --- a/subsys/bluetooth/audio/bap_internal.h +++ b/subsys/bluetooth/audio/bap_internal.h @@ -78,7 +78,7 @@ struct bt_bap_bass_cp_mod_src { struct bt_bap_bass_cp_broadcase_code { uint8_t opcode; uint8_t src_id; - uint8_t broadcast_code[16]; + uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]; } __packed; struct bt_bap_bass_cp_rem_src { diff --git a/subsys/bluetooth/audio/bap_scan_delegator.c b/subsys/bluetooth/audio/bap_scan_delegator.c index a68f6b4316327..8fdf83557d761 100644 --- a/subsys/bluetooth/audio/bap_scan_delegator.c +++ b/subsys/bluetooth/audio/bap_scan_delegator.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -67,7 +68,7 @@ struct bass_recv_state_internal { bool active; uint8_t index; struct bt_bap_scan_delegator_recv_state state; - uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]; + uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]; struct bt_le_per_adv_sync *pa_sync; /** Requested BIS sync bitfield for each subgroup */ uint32_t requested_bis_sync[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]; diff --git a/subsys/bluetooth/audio/cap_initiator.c b/subsys/bluetooth/audio/cap_initiator.c index b79a07ef08cf7..d6485e5f094a8 100644 --- a/subsys/bluetooth/audio/cap_initiator.c +++ b/subsys/bluetooth/audio/cap_initiator.c @@ -186,9 +186,9 @@ static void cap_initiator_broadcast_to_bap_broadcast_param( bap_param->encryption = cap_param->encryption; if (bap_param->encryption) { memcpy(bap_param->broadcast_code, cap_param->broadcast_code, - BT_AUDIO_BROADCAST_CODE_SIZE); + BT_ISO_BROADCAST_CODE_SIZE); } else { - memset(bap_param->broadcast_code, 0, BT_AUDIO_BROADCAST_CODE_SIZE); + memset(bap_param->broadcast_code, 0, BT_ISO_BROADCAST_CODE_SIZE); } for (size_t i = 0U; i < bap_param->params_count; i++) { diff --git a/subsys/bluetooth/audio/shell/bap.c b/subsys/bluetooth/audio/shell/bap.c index 9f53a3769972b..71d795cc071e7 100644 --- a/subsys/bluetooth/audio/shell/bap.c +++ b/subsys/bluetooth/audio/shell/bap.c @@ -3528,7 +3528,7 @@ static int cmd_create_sink_by_name(const struct shell *sh, size_t argc, char *ar static int cmd_sync_broadcast(const struct shell *sh, size_t argc, char *argv[]) { struct bt_bap_stream *streams[ARRAY_SIZE(broadcast_sink_streams)]; - uint8_t bcode[BT_AUDIO_BROADCAST_CODE_SIZE] = {0}; + uint8_t bcode[BT_ISO_BROADCAST_CODE_SIZE] = {0}; bool bcode_set = false; uint32_t bis_bitfield; size_t stream_cnt; diff --git a/subsys/bluetooth/audio/shell/bap_broadcast_assistant.c b/subsys/bluetooth/audio/shell/bap_broadcast_assistant.c index d10b85e1ec48a..52e562ca37c25 100644 --- a/subsys/bluetooth/audio/shell/bap_broadcast_assistant.c +++ b/subsys/bluetooth/audio/shell/bap_broadcast_assistant.c @@ -139,8 +139,7 @@ static void bap_broadcast_assistant_recv_state_cb( } bt_addr_le_to_str(&state->addr, le_addr, sizeof(le_addr)); - bin2hex(state->bad_code, BT_AUDIO_BROADCAST_CODE_SIZE, - bad_code, sizeof(bad_code)); + bin2hex(state->bad_code, BT_ISO_BROADCAST_CODE_SIZE, bad_code, sizeof(bad_code)); is_bad_code = state->encrypt_state == BT_BAP_BIG_ENC_STATE_BAD_CODE; shell_print(ctx_shell, @@ -1041,7 +1040,7 @@ static int cmd_bap_broadcast_assistant_add_pa_sync(const struct shell *sh, static int cmd_bap_broadcast_assistant_broadcast_code(const struct shell *sh, size_t argc, char **argv) { - uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE] = { 0 }; + uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE] = {0}; size_t broadcast_code_len; unsigned long src_id; int result = 0; @@ -1060,7 +1059,7 @@ static int cmd_bap_broadcast_assistant_broadcast_code(const struct shell *sh, } broadcast_code_len = strlen(argv[2]); - if (!IN_RANGE(broadcast_code_len, 1, BT_AUDIO_BROADCAST_CODE_SIZE)) { + if (!IN_RANGE(broadcast_code_len, 1, BT_ISO_BROADCAST_CODE_SIZE)) { shell_error(sh, "Invalid broadcast code length: %zu", broadcast_code_len); return -ENOEXEC; diff --git a/subsys/bluetooth/audio/shell/bap_scan_delegator.c b/subsys/bluetooth/audio/shell/bap_scan_delegator.c index 43447d20649e0..676c5a5143647 100644 --- a/subsys/bluetooth/audio/shell/bap_scan_delegator.c +++ b/subsys/bluetooth/audio/shell/bap_scan_delegator.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -45,7 +46,7 @@ static struct sync_state { struct bt_conn *conn; struct bt_le_per_adv_sync *pa_sync; const struct bt_bap_scan_delegator_recv_state *recv_state; - uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]; + uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]; } sync_states[CONFIG_BT_BAP_SCAN_DELEGATOR_RECV_STATE_COUNT]; static bool past_preference = true; @@ -335,12 +336,12 @@ static int pa_sync_term_req_cb(struct bt_conn *conn, static void broadcast_code_cb(struct bt_conn *conn, const struct bt_bap_scan_delegator_recv_state *recv_state, - const uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]) + const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]) { struct sync_state *state; shell_info(ctx_shell, "Broadcast code received for %p", recv_state); - shell_hexdump(ctx_shell, broadcast_code, BT_AUDIO_BROADCAST_CODE_SIZE); + shell_hexdump(ctx_shell, broadcast_code, BT_ISO_BROADCAST_CODE_SIZE); state = sync_state_get(recv_state); if (state == NULL) { @@ -349,7 +350,7 @@ static void broadcast_code_cb(struct bt_conn *conn, return; } - (void)memcpy(state->broadcast_code, broadcast_code, BT_AUDIO_BROADCAST_CODE_SIZE); + (void)memcpy(state->broadcast_code, broadcast_code, BT_ISO_BROADCAST_CODE_SIZE); } static int bis_sync_req_cb(struct bt_conn *conn, diff --git a/tests/bluetooth/tester/src/audio/btp/btp_bap.h b/tests/bluetooth/tester/src/audio/btp/btp_bap.h index d094d53639050..002ef1d5d65e0 100644 --- a/tests/bluetooth/tester/src/audio/btp/btp_bap.h +++ b/tests/bluetooth/tester/src/audio/btp/btp_bap.h @@ -167,7 +167,7 @@ struct btp_bap_modify_broadcast_src_cmd { struct btp_bap_set_broadcast_code_cmd { bt_addr_le_t address; uint8_t src_id; - uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]; + uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]; } __packed; #define BTP_BAP_SEND_PAST 0x18 diff --git a/tests/bluetooth/tester/src/audio/btp/btp_cap.h b/tests/bluetooth/tester/src/audio/btp/btp_cap.h index 4369e87536a2f..303f793003338 100644 --- a/tests/bluetooth/tester/src/audio/btp/btp_cap.h +++ b/tests/bluetooth/tester/src/audio/btp/btp_cap.h @@ -97,7 +97,7 @@ struct btp_cap_broadcast_source_setup_cmd { uint16_t max_transport_latency; uint8_t presentation_delay[3]; uint8_t flags; - uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]; + uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]; } __packed; struct btp_cap_broadcast_source_setup_rp { uint8_t source_id; diff --git a/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c b/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c index f94a9cfc3210b..4a93c343a95fe 100644 --- a/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c +++ b/tests/bluetooth/tester/src/audio/btp_bap_broadcast.c @@ -939,7 +939,7 @@ static int pa_sync_term_req_cb(struct bt_conn *conn, static void broadcast_code_cb(struct bt_conn *conn, const struct bt_bap_scan_delegator_recv_state *recv_state, - const uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]) + const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]) { int err; uint32_t index_bitfield; @@ -955,8 +955,7 @@ static void broadcast_code_cb(struct bt_conn *conn, } broadcaster->sink_recv_state = recv_state; - (void)memcpy(broadcaster->sink_broadcast_code, broadcast_code, - BT_AUDIO_BROADCAST_CODE_SIZE); + (void)memcpy(broadcaster->sink_broadcast_code, broadcast_code, BT_ISO_BROADCAST_CODE_SIZE); if (!broadcaster->requested_bis_sync) { return; diff --git a/tests/bluetooth/tester/src/audio/btp_bap_broadcast.h b/tests/bluetooth/tester/src/audio/btp_bap_broadcast.h index a7fe7ec970bff..acb49bee8649e 100644 --- a/tests/bluetooth/tester/src/audio/btp_bap_broadcast.h +++ b/tests/bluetooth/tester/src/audio/btp_bap_broadcast.h @@ -36,7 +36,7 @@ struct btp_bap_broadcast_remote_source { /* BIS Index bitfield read from sync request */ uint32_t requested_bis_sync; bool assistant_request; - uint8_t sink_broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]; + uint8_t sink_broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]; const struct bt_bap_scan_delegator_recv_state *sink_recv_state; }; diff --git a/tests/bsim/bluetooth/audio/src/bap_broadcast_assistant_test.c b/tests/bsim/bluetooth/audio/src/bap_broadcast_assistant_test.c index 0e6c4b23ede32..cb1a3296df09a 100644 --- a/tests/bsim/bluetooth/audio/src/bap_broadcast_assistant_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_broadcast_assistant_test.c @@ -116,7 +116,7 @@ static void bap_broadcast_assistant_recv_state_cb( const struct bt_bap_scan_delegator_recv_state *state) { char le_addr[BT_ADDR_LE_STR_LEN]; - char bad_code[BT_AUDIO_BROADCAST_CODE_SIZE * 2 + 1]; + char bad_code[BT_ISO_BROADCAST_CODE_SIZE * 2 + 1]; if (err != 0) { FAIL("BASS recv state read failed (%d)\n", err); @@ -131,8 +131,7 @@ static void bap_broadcast_assistant_recv_state_cb( } bt_addr_le_to_str(&state->addr, le_addr, sizeof(le_addr)); - (void)bin2hex(state->bad_code, BT_AUDIO_BROADCAST_CODE_SIZE, bad_code, - sizeof(bad_code)); + (void)bin2hex(state->bad_code, BT_ISO_BROADCAST_CODE_SIZE, bad_code, sizeof(bad_code)); printk("BASS recv state: src_id %u, addr %s, sid %u, sync_state %u, encrypt_state %u%s%s\n", state->src_id, le_addr, state->adv_sid, state->pa_sync_state, state->encrypt_state, state->encrypt_state == BT_BAP_BIG_ENC_STATE_BAD_CODE ? ", bad code: " : "", @@ -142,8 +141,8 @@ static void bap_broadcast_assistant_recv_state_cb( SET_FLAG(flag_broadcast_code_requested); } else if (state->encrypt_state == BT_BAP_BIG_ENC_STATE_BAD_CODE) { SET_FLAG(flag_incorrect_broadcast_code); - if (memcmp(state->bad_code, INCORRECT_BROADCAST_CODE, - BT_AUDIO_BROADCAST_CODE_SIZE) != 0) { + if (memcmp(state->bad_code, INCORRECT_BROADCAST_CODE, BT_ISO_BROADCAST_CODE_SIZE) != + 0) { FAIL("Bad code is not what we sent"); return; } @@ -518,7 +517,7 @@ static void test_bass_mod_source_long_meta(void) printk("Server PA synced\n"); } -static void test_bass_broadcast_code(const uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]) +static void test_bass_broadcast_code(const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]) { int err; diff --git a/tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c b/tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c index 8c870ed2e99c8..633844a820397 100644 --- a/tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c @@ -59,7 +59,7 @@ static struct bt_bap_stream *streams[ARRAY_SIZE(broadcast_sink_streams)]; static uint32_t requested_bis_sync; static struct bt_le_ext_adv *ext_adv; static const struct bt_bap_scan_delegator_recv_state *req_recv_state; -static uint8_t recv_state_broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]; +static uint8_t recv_state_broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]; #define SUPPORTED_CHAN_COUNTS BT_AUDIO_CODEC_CAP_CHAN_COUNT_SUPPORT(1, 2) #define SUPPORTED_MIN_OCTETS_PER_FRAME 30 @@ -403,11 +403,11 @@ static int bis_sync_req_cb(struct bt_conn *conn, static void broadcast_code_cb(struct bt_conn *conn, const struct bt_bap_scan_delegator_recv_state *recv_state, - const uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]) + const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]) { req_recv_state = recv_state; - memcpy(recv_state_broadcast_code, broadcast_code, BT_AUDIO_BROADCAST_CODE_SIZE); + memcpy(recv_state_broadcast_code, broadcast_code, BT_ISO_BROADCAST_CODE_SIZE); } static void scanning_state_cb(struct bt_conn *conn, bool is_scanning) @@ -775,7 +775,7 @@ static void test_broadcast_sink_create_inval(void) } } -static void test_broadcast_sync(const uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]) +static void test_broadcast_sync(const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]) { int err; diff --git a/tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c b/tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c index 10a41acb6546e..a904c4a5cda08 100644 --- a/tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c @@ -48,7 +48,7 @@ struct sync_state { bool pa_syncing; struct k_work_delayable pa_timer; struct bt_le_per_adv_sync *pa_sync; - uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]; + uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]; uint32_t bis_sync_req[CONFIG_BT_BAP_BASS_MAX_SUBGROUPS]; } sync_states[CONFIG_BT_BAP_SCAN_DELEGATOR_RECV_STATE_COUNT]; @@ -300,7 +300,7 @@ static int pa_sync_term_req_cb(struct bt_conn *conn, static void broadcast_code_cb(struct bt_conn *conn, const struct bt_bap_scan_delegator_recv_state *recv_state, - const uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]) + const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]) { struct sync_state *state; @@ -312,7 +312,7 @@ static void broadcast_code_cb(struct bt_conn *conn, return; } - (void)memcpy(state->broadcast_code, broadcast_code, BT_AUDIO_BROADCAST_CODE_SIZE); + (void)memcpy(state->broadcast_code, broadcast_code, BT_ISO_BROADCAST_CODE_SIZE); SET_FLAG(flag_broadcast_code_received); } diff --git a/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c b/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c index 430f1268f413d..d0a33bdc0a253 100644 --- a/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c @@ -414,7 +414,7 @@ static int bis_sync_req_cb(struct bt_conn *conn, static void broadcast_code_cb(struct bt_conn *conn, const struct bt_bap_scan_delegator_recv_state *recv_state, - const uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]) + const uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]) { printk("Broadcast code received for %p\n", recv_state); diff --git a/tests/bsim/bluetooth/audio/src/cap_commander_test.c b/tests/bsim/bluetooth/audio/src/cap_commander_test.c index e27b75e91e6be..43e57a2e6f5b7 100644 --- a/tests/bsim/bluetooth/audio/src/cap_commander_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_commander_test.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -426,7 +427,7 @@ bap_broadcast_assistant_recv_state_cb(struct bt_conn *conn, int err, const struct bt_bap_scan_delegator_recv_state *state) { char le_addr[BT_ADDR_LE_STR_LEN]; - char bad_code[BT_AUDIO_BROADCAST_CODE_SIZE * 2 + 1]; + char bad_code[BT_ISO_BROADCAST_CODE_SIZE * 2 + 1]; if (err != 0) { FAIL("BASS recv state read failed (%d)\n", err); @@ -439,7 +440,7 @@ bap_broadcast_assistant_recv_state_cb(struct bt_conn *conn, int err, } bt_addr_le_to_str(&state->addr, le_addr, sizeof(le_addr)); - (void)bin2hex(state->bad_code, BT_AUDIO_BROADCAST_CODE_SIZE, bad_code, sizeof(bad_code)); + (void)bin2hex(state->bad_code, BT_ISO_BROADCAST_CODE_SIZE, bad_code, sizeof(bad_code)); printk("BASS recv state: src_id %u, addr %s, sid %u, sync_state %u, " "encrypt_state %u%s%s\n", state->src_id, le_addr, state->adv_sid, state->pa_sync_state, state->encrypt_state, From 2ff2526c5cb7c89676ab297494e4d2ab948af5a3 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Mon, 21 Oct 2024 11:01:15 -0700 Subject: [PATCH 1802/4482] reports: footprint: Print footprint output Both ram and rom reports print their outputs in the console and publish their reports in json. footprint is wrapper to generate both reports but it is currently not printing their outputs in the console nor given any feedback to the user that those reports were generated. Change it to behave like the others reports allowing the user to see them and / or redirect to a file if they want. Signed-off-by: Flavio Ceolin --- cmake/reports/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/reports/CMakeLists.txt b/cmake/reports/CMakeLists.txt index 5cd3246f9729a..96cba730788ea 100644 --- a/cmake/reports/CMakeLists.txt +++ b/cmake/reports/CMakeLists.txt @@ -2,7 +2,7 @@ set(flag_for_ram_report ram) set(flag_for_rom_report rom) -set(flag_for_footprint all -q) +set(flag_for_footprint all) set(report_depth 99) if(DEFINED ZEPHYR_WORKSPACE) From 6a179996c387b17b0e5e0bd9c81c0bee2e2b505c Mon Sep 17 00:00:00 2001 From: Gerson Fernando Budke Date: Wed, 16 Oct 2024 22:00:56 +0200 Subject: [PATCH 1803/4482] soc: sam0: Speed-up xosc32 initialization The current selected start-up time takes 8 seconds to initialize. When xosc32 is used as main clock reference it blocks the whole initializarion of the system by that amount of time. This patch relax that condition setting the initialization time to 62ms. Fixes #79949 Signed-off-by: Gerson Fernando Budke --- soc/atmel/sam0/common/soc_samd5x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/atmel/sam0/common/soc_samd5x.c b/soc/atmel/sam0/common/soc_samd5x.c index c18f4e37b9ab2..f9f337f0f3b2f 100644 --- a/soc/atmel/sam0/common/soc_samd5x.c +++ b/soc/atmel/sam0/common/soc_samd5x.c @@ -24,7 +24,7 @@ static void osc32k_init(void) { OSC32KCTRL->XOSC32K.reg = OSC32KCTRL_XOSC32K_ENABLE | OSC32KCTRL_XOSC32K_XTALEN | OSC32KCTRL_XOSC32K_EN32K | OSC32KCTRL_XOSC32K_RUNSTDBY - | OSC32KCTRL_XOSC32K_STARTUP(6) | OSC32KCTRL_XOSC32K_CGM_XT; + | OSC32KCTRL_XOSC32K_STARTUP(0) | OSC32KCTRL_XOSC32K_CGM_XT; while (!OSC32KCTRL->STATUS.bit.XOSC32KRDY) { } From 0d36622b0594f66215e9fa248047158c62ec36a0 Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Wed, 16 Oct 2024 16:05:08 -0500 Subject: [PATCH 1804/4482] doc: Fix dt_chosen_has_compat doc Missing a parameter in this function documentation Signed-off-by: Declan Snyder --- doc/build/kconfig/preprocessor-functions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/build/kconfig/preprocessor-functions.rst b/doc/build/kconfig/preprocessor-functions.rst index 20e5cd3631e16..e3cd282f9250b 100644 --- a/doc/build/kconfig/preprocessor-functions.rst +++ b/doc/build/kconfig/preprocessor-functions.rst @@ -30,7 +30,7 @@ while the ``*_hex`` version returns a hexadecimal value starting with ``0x``. $(dt_alias_enabled,) $(dt_chosen_bool_prop, , ) $(dt_chosen_enabled,) - $(dt_chosen_has_compat,) + $(dt_chosen_has_compat,,) $(dt_chosen_label,) $(dt_chosen_partition,addr_hex,[,,]) $(dt_chosen_partition,addr_int,[,,]) From 8714c172edd1947a6348ac0f669d89668f5896c3 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Tue, 15 Oct 2024 07:29:20 +0200 Subject: [PATCH 1805/4482] storage/stream_flash: Fix range check in stream_flash_erase_page Added check where stream_flash_erase_page checks if requested offset is actually within stream flash designated area. Fixes #79800 Signed-off-by: Dominik Ermel --- include/zephyr/storage/stream_flash.h | 3 ++- subsys/storage/stream/stream_flash.c | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/zephyr/storage/stream_flash.h b/include/zephyr/storage/stream_flash.h index bc871dbab05fe..c2b488348b422 100644 --- a/include/zephyr/storage/stream_flash.h +++ b/include/zephyr/storage/stream_flash.h @@ -149,7 +149,8 @@ int stream_flash_erase_page(struct stream_flash_ctx *ctx, off_t off); * @param settings_key key to use with the settings module for loading * the stream write progress * - * @return non-negative on success, negative errno code on fail + * @return non-negative on success, -ERANGE in case when @p off is out + * of area designated for stream or negative errno code on fail */ int stream_flash_progress_load(struct stream_flash_ctx *ctx, const char *settings_key); diff --git a/subsys/storage/stream/stream_flash.c b/subsys/storage/stream/stream_flash.c index 0ff0c4578ff86..a8e28c6c8ff4b 100644 --- a/subsys/storage/stream/stream_flash.c +++ b/subsys/storage/stream/stream_flash.c @@ -79,6 +79,12 @@ int stream_flash_erase_page(struct stream_flash_ctx *ctx, off_t off) #if defined(CONFIG_FLASH_HAS_EXPLICIT_ERASE) int rc; struct flash_pages_info page; + + if (off < ctx->offset || (off - ctx->offset) >= ctx->available) { + LOG_ERR("Offset out of designated range"); + return -ERANGE; + } + #if defined(CONFIG_FLASH_HAS_NO_EXPLICIT_ERASE) /* There are both types of devices */ const struct flash_parameters *fparams = flash_get_parameters(ctx->fdev); From 23805301b0046fe531553c0a094c1cef63c62cb0 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Tue, 15 Oct 2024 07:31:35 +0200 Subject: [PATCH 1806/4482] tests/storage/stream_flash: Add erase range check test The commit adds test for stream_flash_erase_page range check. Signed-off-by: Dominik Ermel --- .../storage/stream/stream_flash/src/main.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/subsys/storage/stream/stream_flash/src/main.c b/tests/subsys/storage/stream/stream_flash/src/main.c index 58fbb6e35bbb2..52d412053dd47 100644 --- a/tests/subsys/storage/stream/stream_flash/src/main.c +++ b/tests/subsys/storage/stream/stream_flash/src/main.c @@ -465,6 +465,25 @@ ZTEST(lib_stream_flash, test_stream_flash_erase_page) zassert_equal(memcmp(&bad_ctx, &cmp_ctx, sizeof(bad_ctx)), 0, "Ctx should not get altered"); zassert_equal(rc, -EINVAL, "Expected failure"); + + /* False dev with erase set to NULL to avoid actual erase */ + fake_api.erase = NULL; + struct stream_flash_ctx range_test_ctx = { + .offset = 1024, + .available = 2048, + .fdev = &fake_dev, + .last_erased_page_start_offset = -1, + }; + + rc = stream_flash_erase_page(&range_test_ctx, 1024); + zassert_equal(rc, -ENOSYS, "%d No device attached - expected failure", rc); + + rc = stream_flash_erase_page(&range_test_ctx, 1023); + zassert_equal(rc, -ERANGE, "Expected failure - offset before designated area"); + + rc = stream_flash_erase_page(&range_test_ctx, + range_test_ctx.offset + range_test_ctx.available + 1); + zassert_equal(rc, -ERANGE, "Expected failure - offset after designated area"); } #else ZTEST(lib_stream_flash, test_stream_flash_erase_page) From 87ce37f7c49288eb59c1926c2d56087a9c9e4883 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Fri, 4 Oct 2024 20:35:32 +0200 Subject: [PATCH 1807/4482] storage/stream_flash: Make context const where not modified The commit sets const qualifier struct stream_flash_ctx *ctx parameter of Stream Flash API calls: stream_flash_bytes_written stream_flash_progress_save stream_flash_progress_clear Signed-off-by: Dominik Ermel --- include/zephyr/storage/stream_flash.h | 6 +++--- subsys/storage/stream/stream_flash.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/zephyr/storage/stream_flash.h b/include/zephyr/storage/stream_flash.h index c2b488348b422..b1d78af90a9f0 100644 --- a/include/zephyr/storage/stream_flash.h +++ b/include/zephyr/storage/stream_flash.h @@ -97,7 +97,7 @@ int stream_flash_init(struct stream_flash_ctx *ctx, const struct device *fdev, * * @return Number of payload bytes written to flash. */ -size_t stream_flash_bytes_written(struct stream_flash_ctx *ctx); +size_t stream_flash_bytes_written(const struct stream_flash_ctx *ctx); /** * @brief Process input buffers to be written to flash device in single blocks. @@ -164,7 +164,7 @@ int stream_flash_progress_load(struct stream_flash_ctx *ctx, * * @return non-negative on success, negative errno code on fail */ -int stream_flash_progress_save(struct stream_flash_ctx *ctx, +int stream_flash_progress_save(const struct stream_flash_ctx *ctx, const char *settings_key); /** @@ -176,7 +176,7 @@ int stream_flash_progress_save(struct stream_flash_ctx *ctx, * * @return non-negative on success, negative errno code on fail */ -int stream_flash_progress_clear(struct stream_flash_ctx *ctx, +int stream_flash_progress_clear(const struct stream_flash_ctx *ctx, const char *settings_key); #ifdef __cplusplus diff --git a/subsys/storage/stream/stream_flash.c b/subsys/storage/stream/stream_flash.c index a8e28c6c8ff4b..63455af6d2899 100644 --- a/subsys/storage/stream/stream_flash.c +++ b/subsys/storage/stream/stream_flash.c @@ -237,7 +237,7 @@ int stream_flash_buffered_write(struct stream_flash_ctx *ctx, const uint8_t *dat return rc; } -size_t stream_flash_bytes_written(struct stream_flash_ctx *ctx) +size_t stream_flash_bytes_written(const struct stream_flash_ctx *ctx) { return ctx->bytes_written; } @@ -348,7 +348,7 @@ int stream_flash_progress_load(struct stream_flash_ctx *ctx, return rc; } -int stream_flash_progress_save(struct stream_flash_ctx *ctx, +int stream_flash_progress_save(const struct stream_flash_ctx *ctx, const char *settings_key) { if (!ctx || !settings_key) { @@ -367,7 +367,7 @@ int stream_flash_progress_save(struct stream_flash_ctx *ctx, return rc; } -int stream_flash_progress_clear(struct stream_flash_ctx *ctx, +int stream_flash_progress_clear(const struct stream_flash_ctx *ctx, const char *settings_key) { if (!ctx || !settings_key) { From 09574e68eb3a6f30c8e2e0f787a9fc52953474d3 Mon Sep 17 00:00:00 2001 From: Phil Hindman Date: Tue, 1 Oct 2024 14:24:50 -0500 Subject: [PATCH 1808/4482] fs: littlefs: Gracefully fail when static buffers are too small The cache_size and lookahead_size are set at compile time using the CONFIG_FS_LITTLEFS_CACHE_SIZE and CONFIG_FS_LITTLEFS_LOOKAHEAD_SIZE values from Kconfig, or from the cache-size and lookahead-size properties in a 'zephyr,fstab,littlefs' compatible in the devicetree. Those values are also used to statically allocate buffers that are pointed at by the read_buffer, prog_buffer, and lookahead_buffer members of the lfs_config structure. At runtime, when using a block device, the cache_size and lookahead_size are updated to be multiples of the underlying block device's block_size, which may make them bigger than the original size used to allocate the static buffers. Log an error and fail the operation when this occurs. Signed-off-by: Phil Hindman --- subsys/fs/littlefs_fs.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/subsys/fs/littlefs_fs.c b/subsys/fs/littlefs_fs.c index e183b2c7029b6..ff63770291be6 100644 --- a/subsys/fs/littlefs_fs.c +++ b/subsys/fs/littlefs_fs.c @@ -836,14 +836,30 @@ static int littlefs_init_cfg(struct fs_littlefs *fs, int flags) lcp->context = fs->backend; /* Set the validated/defaulted values. */ if (littlefs_on_blkdev(flags)) { + lfs_size_t new_cache_size = block_size; + lfs_size_t new_lookahead_size = block_size * 4; + lcp->read = lfs_api_read_blk; lcp->prog = lfs_api_prog_blk; lcp->erase = lfs_api_erase_blk; lcp->read_size = block_size; lcp->prog_size = block_size; - lcp->cache_size = block_size; - lcp->lookahead_size = block_size * 4; + + if (lcp->cache_size < new_cache_size) { + LOG_ERR("Configured cache size is too small: %d < %d", lcp->cache_size, + new_cache_size); + return -ENOMEM; + } + lcp->cache_size = new_cache_size; + + if (lcp->lookahead_size < new_lookahead_size) { + LOG_ERR("Configured lookahead size is too small: %d < %d", + lcp->lookahead_size, new_lookahead_size); + return -ENOMEM; + } + lcp->lookahead_size = new_lookahead_size; + lcp->sync = lfs_api_sync_blk; LOG_INF("sizes: rd %u ; pr %u ; ca %u ; la %u", From 5049ac48c05746b881857f3eca65d03fec8ad924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20R=C3=B8nningstad?= Date: Tue, 17 Sep 2024 14:27:54 +0200 Subject: [PATCH 1809/4482] zcbor: Kconfig: Clarify docs for the ZCBOR_STOP_ON_ERROR config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Specify that it must also be enabled in code. Signed-off-by: Øyvind Rønningstad --- modules/zcbor/Kconfig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/zcbor/Kconfig b/modules/zcbor/Kconfig index 655fb2ed2a84a..deb976bbcd08a 100644 --- a/modules/zcbor/Kconfig +++ b/modules/zcbor/Kconfig @@ -19,8 +19,11 @@ config ZCBOR_CANONICAL indefinite-length arrays (it will still decode them properly). config ZCBOR_STOP_ON_ERROR - bool "Stop on error when processing" + bool "Stop on error when processing (Must also be enabled in state var)" help + Make the stop_on_error functionality available. Note that it still + needs to be enabled in the state variable + (`state->constant_state->stop_on_error`). This makes all functions abort their execution if called when an error has already happened. From 82c7f432751ffac0fb66124283ac1f829a534af3 Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Fri, 25 Oct 2024 20:05:31 +0000 Subject: [PATCH 1810/4482] boards: weact: usb2canfdv1: fix broken link Fix broken link to the usb2canfdv1 default board configuration file. Fixes: 25d9fc118f61c049a58858703ea354a1b833ca6d Signed-off-by: Henrik Brix Andersen --- boards/weact/usb2canfdv1/doc/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/weact/usb2canfdv1/doc/index.rst b/boards/weact/usb2canfdv1/doc/index.rst index db07a7b7dd47d..1ea39dcd4be2e 100644 --- a/boards/weact/usb2canfdv1/doc/index.rst +++ b/boards/weact/usb2canfdv1/doc/index.rst @@ -34,7 +34,7 @@ The ``usb2canfdv1`` board configuration supports the following hardware features +-----------+------------+-------------------------------------+ The default configuration can be found in the defconfig file: -:zephyr_file:`boards/weact/usb2canfd/usb2canfdv1_defconfig`. +:zephyr_file:`boards/weact/usb2canfdv1/usb2canfdv1_defconfig`. Other hardware features are not currently supported by the port. From 25272ae5ed53de23ff403f6336595f14b3cd7e0c Mon Sep 17 00:00:00 2001 From: Arif Balik Date: Fri, 27 Sep 2024 14:32:02 +0300 Subject: [PATCH 1811/4482] samples: button: add comment for input subsys We wanted to redirect users who wants a debounced driver #78813 Signed-off-by: Arif Balik --- samples/basic/button/src/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/samples/basic/button/src/main.c b/samples/basic/button/src/main.c index a86407a65c256..7c6ab66faa145 100644 --- a/samples/basic/button/src/main.c +++ b/samples/basic/button/src/main.c @@ -3,6 +3,10 @@ * Copyright (c) 2020 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 + * + * NOTE: If you are looking into an implementation of button events with + * debouncing, check out `input` subsystem and `samples/subsys/input/input_dump` + * example instead. */ #include From 618d44164accbe80c30311d6b5b8107a83c12ee6 Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Wed, 23 Oct 2024 23:16:33 +0200 Subject: [PATCH 1812/4482] bluetooth: Remove migration hints Zephyr 3.7.0 has been released and it is time to remove the migration code added in 9cf07bbdb55f4264062297d2bee00779c7627604 (bluetooth: Rename rpmsg HCI driver and sample to ipc). Signed-off-by: Reto Schneider --- drivers/bluetooth/hci/CMakeLists.txt | 13 ------------- drivers/bluetooth/hci/Kconfig | 7 ------- samples/bluetooth/hci_ipc/CMakeLists.txt | 6 ------ 3 files changed, 26 deletions(-) diff --git a/drivers/bluetooth/hci/CMakeLists.txt b/drivers/bluetooth/hci/CMakeLists.txt index 954477a54c7a9..b205fbc4e134a 100644 --- a/drivers/bluetooth/hci/CMakeLists.txt +++ b/drivers/bluetooth/hci/CMakeLists.txt @@ -1,18 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -# Remove after 3.7.0 is released -if(CONFIG_BT_RPMSG) - message(FATAL_ERROR "CONFIG_BT_RPMSG has been renamed to CONFIG_BT_HCI_IPC") -endif() - -# Remove after 3.7.0 is released -if(CONFIG_BT_HCI_IPC) - dt_chosen(chosen_hci_rpmsg PROPERTY "zephyr,bt-hci-rpmsg-ipc") - if(DEFINED chosen_hci_rpmsg) - message(FATAL_ERROR "zephyr,bt-hci-rpmsg-ipc has been renamed to zephyr,bt-hci-ipc") - endif() -endif() - zephyr_library_sources_ifdef(CONFIG_BT_ESP32 hci_esp32.c) if(CONFIG_DT_HAS_ESPRESSIF_ESP32_BT_HCI_ENABLED) zephyr_blobs_verify(MODULE hal_espressif REQUIRED) diff --git a/drivers/bluetooth/hci/Kconfig b/drivers/bluetooth/hci/Kconfig index 9355f40eeec05..c18142dcbe6b6 100644 --- a/drivers/bluetooth/hci/Kconfig +++ b/drivers/bluetooth/hci/Kconfig @@ -29,13 +29,6 @@ config BT_H5 Bluetooth three-wire (H:5) UART driver. Implementation of HCI Three-Wire UART Transport Layer. -# Removed: Here only to give the user a warning about its removal -# Remove after 3.7.0 is released -config BT_RPMSG - bool - help - Use BT_HCI_IPC instead - config BT_HCI_IPC bool default y diff --git a/samples/bluetooth/hci_ipc/CMakeLists.txt b/samples/bluetooth/hci_ipc/CMakeLists.txt index 02ff09719d7f9..3ed54db7dfc79 100644 --- a/samples/bluetooth/hci_ipc/CMakeLists.txt +++ b/samples/bluetooth/hci_ipc/CMakeLists.txt @@ -6,9 +6,3 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(hci_ipc) target_sources(app PRIVATE src/main.c) - -# Remove after 3.7.0 is released -dt_chosen(chosen_hci_rpmsg PROPERTY "zephyr,bt-hci-rpmsg-ipc") -if(DEFINED chosen_hci_rpmsg) - message(FATAL_ERROR "zephyr,bt-hci-rpmsg-ipc has been renamed to zephyr,bt-hci-ipc") -endif() From c1670f945bb344a5f28ea68da41b7a2e7a461f6d Mon Sep 17 00:00:00 2001 From: Maochen Wang Date: Mon, 14 Oct 2024 15:18:21 +0800 Subject: [PATCH 1813/4482] manifest: Update hal_nxp to add wifi related change Update hal_nxp to add wifi related change Signed-off-by: Maochen Wang --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index ce14009c668d9..b1287ecabd647 100644 --- a/west.yml +++ b/west.yml @@ -198,7 +198,7 @@ manifest: groups: - hal - name: hal_nxp - revision: 74a7735bb0775754a9c2058b225777d6ecfeaa6f + revision: 4a4741fa2be33f6b638a49e357c5e33bb7ad0544 path: modules/hal/nxp groups: - hal From 5969a10c3064e0e2954c5b5593d6501818618ac0 Mon Sep 17 00:00:00 2001 From: David Brown Date: Tue, 22 Oct 2024 13:31:09 -0600 Subject: [PATCH 1814/4482] drivers: pwm: rpi_pico: Convert clk calculations to fixed-point Remove the use of floating point to calculate in `pwm_rpi_get_cycles_per_sec` to fixed point calculations that result in the same value. There is still a division here, which is somewhat slow still, but the end result about twice fast for the whole path through the led pwm code. Even better would be to cache these values, since there is no interface in this driver to change the configuration past init time. Signed-off-by: David Brown --- drivers/pwm/pwm_rpi_pico.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/pwm/pwm_rpi_pico.c b/drivers/pwm/pwm_rpi_pico.c index d277cddaf15f1..a6b9489b4e45f 100644 --- a/drivers/pwm/pwm_rpi_pico.c +++ b/drivers/pwm/pwm_rpi_pico.c @@ -38,15 +38,6 @@ struct pwm_rpi_config { const clock_control_subsys_t clk_id; }; -static float pwm_rpi_get_clkdiv(const struct device *dev, int slice) -{ - const struct pwm_rpi_config *cfg = dev->config; - - /* the divider is a fixed point 8.4 convert to float for use in pico-sdk */ - return (float)cfg->slice_configs[slice].integral + - (float)cfg->slice_configs[slice].frac / 16.0f; -} - static inline uint32_t pwm_rpi_channel_to_slice(uint32_t channel) { return channel / 2; @@ -68,20 +59,22 @@ static int pwm_rpi_get_cycles_per_sec(const struct device *dev, uint32_t ch, uin return -EINVAL; } + const struct pwm_rpi_slice_config *slice_config = &cfg->slice_configs[slice]; + ret = clock_control_get_rate(cfg->clk_dev, cfg->clk_id, &pclk); if (ret < 0 || pclk == 0) { return -EINVAL; } - if (cfg->slice_configs[slice].integral == 0) { + if (slice_config->integral == 0) { *cycles = pclk; } else { /* No need to check for divide by 0 since the minimum value of * pwm_rpi_get_clkdiv is 1 */ - *cycles = (uint64_t)((float)pclk / pwm_rpi_get_clkdiv(dev, slice)); + *cycles = (uint64_t)pclk * 16 / + ((uint64_t)slice_config->integral * 16 + slice_config->frac); } - return 0; } From a98bde993e91fac5f2944f2cc9f48a271065dba9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 22 Oct 2024 09:34:27 +0200 Subject: [PATCH 1815/4482] drivers: serial: nrfx_uarte: Add missing closing bracket MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A code ifdefed by UARTE_BAUDRATE_RETENTION_WORKAROUND was missing a closing bracket. It was missed because CI did not compile any target that is applying this workaround and enables code compilation. Signed-off-by: Krzysztof Chruściński --- drivers/serial/uart_nrfx_uarte.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index d308bef4f131b..27a8b23e2c05a 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -2187,7 +2187,7 @@ static int uarte_nrfx_pm_action(const struct device *dev, #if UARTE_BAUDRATE_RETENTION_WORKAROUND nrf_uarte_baudrate_set(get_uarte_instance(dev), COND_CODE_1(CONFIG_UART_USE_RUNTIME_CONFIGURE, - (data->nrf_baudrate), (cfg->nrf_baudrate)); + (data->nrf_baudrate), (cfg->nrf_baudrate))); #endif #ifdef UARTE_ANY_ASYNC From cfc87dab75b937d4618795a20c58c5989c6bf492 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 21 Oct 2024 15:34:25 +0200 Subject: [PATCH 1816/4482] drivers: serial: nrfx_uarte: Remove unused element from a structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove aborted flag from uarte_async_rx structure. Flag is not used. Signed-off-by: Krzysztof Chruściński --- drivers/serial/uart_nrfx_uarte.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 27a8b23e2c05a..efef52102c595 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -162,7 +162,6 @@ struct uarte_async_rx { uint8_t flush_cnt; volatile bool enabled; volatile bool discard_fifo; - volatile bool aborted; }; struct uarte_async_cb { From 3ce19da43b1e07a39c9f078687d3e8b2154e662e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 16 Sep 2024 10:32:22 +0200 Subject: [PATCH 1817/4482] drivers: serial: nrfx_uarte: Add runtime PM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add runtime PM to the driver. When asynchronous or interrupt driven API is used, there are 3 independent paths for enabling the device: RX, TX and TX poll_out. TX poll_out requires special handling because number of poll_out calls does not need to much number of TXSTOPPED interrupts. To handle that special flag is added. For standard RX and TX is simpler. Signed-off-by: Krzysztof Chruściński --- drivers/serial/Kconfig.nrfx_uart_instance | 5 +- drivers/serial/uart_nrfx_uarte.c | 463 ++++++++++++---------- 2 files changed, 254 insertions(+), 214 deletions(-) diff --git a/drivers/serial/Kconfig.nrfx_uart_instance b/drivers/serial/Kconfig.nrfx_uart_instance index 4ea1393a2c196..d44c1ab7e0261 100644 --- a/drivers/serial/Kconfig.nrfx_uart_instance +++ b/drivers/serial/Kconfig.nrfx_uart_instance @@ -68,11 +68,14 @@ config UART_$(nrfx_uart_num)_NRF_ASYNC_LOW_POWER depends on HAS_HW_NRF_UARTE$(nrfx_uart_num) depends on UART_ASYNC_API depends on UART_NRFX_UARTE_LEGACY_SHIM - default y + default y if !PM_DEVICE help When enabled, UARTE is enabled before each TX or RX usage and disabled when not used. Disabling UARTE while in idle allows to achieve lowest power consumption. It is only feasible if receiver is not always on. + This option is irrelevant when device power management (PM) is enabled + because then device state is controlled by the PM actions. + config UART_$(nrfx_uart_num)_NRF_HW_ASYNC_TIMER int "Timer instance" diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index efef52102c595..b22c50af09614 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -98,6 +99,12 @@ LOG_MODULE_REGISTER(uart_nrfx_uarte, CONFIG_UART_LOG_LEVEL); #define UARTE_ANY_CACHE 1 #endif +#define IS_LOW_POWER(unused, prefix, i, _) IS_ENABLED(CONFIG_UART_##prefix##i##_NRF_ASYNC_LOW_POWER) + +#if UARTE_FOR_EACH_INSTANCE(IS_LOW_POWER, (||), (0)) +#define UARTE_ANY_LOW_POWER 1 +#endif + #ifdef UARTE_ANY_CACHE /* uart120 instance does not retain BAUDRATE register when ENABLE=0. When this instance * is used then baudrate must be set after enabling the peripheral and not before. @@ -211,6 +218,7 @@ struct uarte_nrfx_data { #define UARTE_FLAG_LOW_POWER_TX BIT(0) #define UARTE_FLAG_LOW_POWER_RX BIT(1) #define UARTE_FLAG_TRIG_RXTO BIT(2) +#define UARTE_FLAG_POLL_OUT BIT(3) /* If enabled then ENDTX is PPI'ed to TXSTOP */ #define UARTE_CFG_FLAG_PPI_ENDTX BIT(0) @@ -251,6 +259,10 @@ struct uarte_nrfx_data { (baudrate) == 921600 ? NRF_UARTE_BAUDRATE_921600 : \ (baudrate) == 1000000 ? NRF_UARTE_BAUDRATE_1000000 : 0) +#define LOW_POWER_ENABLED(_config) \ + (IS_ENABLED(UARTE_ANY_LOW_POWER) && \ + !IS_ENABLED(CONFIG_PM_DEVICE) && \ + (_config->flags & UARTE_CFG_FLAG_LOW_POWER)) /** * @brief Structure for UARTE configuration. */ @@ -316,6 +328,7 @@ static void uarte_nrfx_isr_int(const void *arg) { const struct device *dev = arg; const struct uarte_nrfx_config *config = dev->config; + struct uarte_nrfx_data *data = dev->data; NRF_UARTE_Type *uarte = get_uarte_instance(dev); /* If interrupt driven and asynchronous APIs are disabled then UART @@ -327,34 +340,35 @@ static void uarte_nrfx_isr_int(const void *arg) endtx_isr(dev); } - if (config->flags & UARTE_CFG_FLAG_LOW_POWER) { + bool txstopped = nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_TXSTOPPED); + + if (txstopped && (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || LOW_POWER_ENABLED(config))) { unsigned int key = irq_lock(); - if (nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_TXSTOPPED)) { + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) && + (data->flags & UARTE_FLAG_POLL_OUT)) { + data->flags &= ~UARTE_FLAG_POLL_OUT; + pm_device_runtime_put(dev); + } else { nrf_uarte_disable(uarte); } #ifdef UARTE_INTERRUPT_DRIVEN - struct uarte_nrfx_data *data = dev->data; - if (!data->int_driven || data->int_driven->fifo_fill_lock == 0) #endif { - nrf_uarte_int_disable(uarte, - NRF_UARTE_INT_TXSTOPPED_MASK); + nrf_uarte_int_disable(uarte, NRF_UARTE_INT_TXSTOPPED_MASK); } irq_unlock(key); } #ifdef UARTE_INTERRUPT_DRIVEN - struct uarte_nrfx_data *data = dev->data; - if (!data->int_driven) { return; } - if (nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_TXSTOPPED)) { + if (txstopped) { data->int_driven->fifo_fill_lock = 0; if (data->int_driven->disable_tx_irq) { nrf_uarte_int_disable(uarte, @@ -553,8 +567,6 @@ static int wait_tx_ready(const struct device *dev) return key; } -#ifdef UARTE_ANY_ASYNC - /* Using Macro instead of static inline function to handle NO_OPTIMIZATIONS case * where static inline fails on linking. */ @@ -562,21 +574,22 @@ static int wait_tx_ready(const struct device *dev) (IS_ENABLED(UARTE_ANY_HW_ASYNC) ? \ (config->flags & UARTE_CFG_FLAG_HW_BYTE_COUNTING) : false) -#endif /* UARTE_ANY_ASYNC */ - -static void uarte_enable(const struct device *dev, uint32_t act_mask, uint32_t sec_mask) +static void uarte_periph_enable(const struct device *dev) { + NRF_UARTE_Type *uarte = get_uarte_instance(dev); + const struct uarte_nrfx_config *config = dev->config; struct uarte_nrfx_data *data = dev->data; - if (atomic_or(&data->flags, act_mask) & sec_mask) { - /* Second direction already enabled so UARTE is enabled. */ - return; - } + (void)data; + nrf_uarte_enable(uarte); +#if UARTE_BAUDRATE_RETENTION_WORKAROUND + nrf_uarte_baudrate_set(uarte, + COND_CODE_1(CONFIG_UART_USE_RUNTIME_CONFIGURE, + (data->nrf_baudrate), (config->nrf_baudrate))); +#endif #ifdef UARTE_ANY_ASYNC if (data->async) { - const struct uarte_nrfx_config *config = dev->config; - if (HW_RX_COUNTING_ENABLED(config)) { const nrfx_timer_t *timer = &config->timer; @@ -586,16 +599,32 @@ static void uarte_enable(const struct device *dev, uint32_t act_mask, uint32_t s nrfx_timer_increment(timer); } } + return; } #endif - nrf_uarte_enable(get_uarte_instance(dev)); -#if UARTE_BAUDRATE_RETENTION_WORKAROUND - nrf_uarte_baudrate_t baudrate = COND_CODE_1(CONFIG_UART_USE_RUNTIME_CONFIGURE, - (data->nrf_baudrate), - (((const struct uarte_nrfx_config *)dev->config)->nrf_baudrate)); - nrf_uarte_baudrate_set(get_uarte_instance(dev), baudrate); + if (IS_ENABLED(UARTE_ANY_NONE_ASYNC) && !config->disable_rx) { + nrf_uarte_rx_buffer_set(uarte, config->poll_in_byte, 1); + nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_ENDRX); + nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STARTRX); +#if defined(UARTE_INTERRUPT_DRIVEN) && defined(CONFIG_PM_DEVICE) + if (data->int_driven && data->int_driven->rx_irq_enabled) { + nrf_uarte_int_enable(uarte, NRF_UARTE_INT_ENDRX_MASK); + } #endif + } +} + +static void uarte_enable(const struct device *dev, uint32_t act_mask, uint32_t sec_mask) +{ + struct uarte_nrfx_data *data = dev->data; + + if (atomic_or(&data->flags, act_mask) & sec_mask) { + /* Second direction already enabled so UARTE is enabled. */ + return; + } + + uarte_periph_enable(dev); } /* At this point we should have irq locked and any previous transfer completed. @@ -606,7 +635,7 @@ static void tx_start(const struct device *dev, const uint8_t *buf, size_t len) const struct uarte_nrfx_config *config = dev->config; NRF_UARTE_Type *uarte = get_uarte_instance(dev); -#ifdef CONFIG_PM_DEVICE +#if defined(CONFIG_PM_DEVICE) && !defined(CONFIG_PM_DEVICE_RUNTIME) enum pm_device_state state; (void)pm_device_state_get(dev, &state); @@ -620,18 +649,19 @@ static void tx_start(const struct device *dev, const uint8_t *buf, size_t len) } nrf_uarte_tx_buffer_set(uarte, buf, len); - nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_ENDTX); + if (!IS_ENABLED(UARTE_HAS_ENDTX_STOPTX_SHORT)) { + nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_ENDTX); + } nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_TXSTOPPED); - if (config->flags & UARTE_CFG_FLAG_LOW_POWER) { + if (LOW_POWER_ENABLED(config)) { uarte_enable(dev, UARTE_FLAG_LOW_POWER_TX, UARTE_FLAG_LOW_POWER_RX); - nrf_uarte_int_enable(uarte, NRF_UARTE_INT_TXSTOPPED_MASK); } nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STARTTX); } -#if defined(UARTE_ANY_ASYNC) || defined(CONFIG_PM_DEVICE) +#if defined(UARTE_ANY_ASYNC) /** @brief Disable UARTE peripheral is not used by RX or TX. * * It must be called with interrupts locked so that deciding if no direction is @@ -652,7 +682,7 @@ static void uarte_disable_locked(const struct device *dev, uint32_t dis_mask, ui return; } -#if defined(UARTE_ANY_ASYNC) && !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) +#if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) const struct uarte_nrfx_config *config = dev->config; if (data->async && HW_RX_COUNTING_ENABLED(config)) { @@ -717,7 +747,7 @@ static int uarte_nrfx_rx_counting_init(const struct device *dev) } #endif /* !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) */ -static int uarte_nrfx_init(const struct device *dev) +static int uarte_async_init(const struct device *dev) { struct uarte_nrfx_data *data = dev->data; NRF_UARTE_Type *uarte = get_uarte_instance(dev); @@ -738,7 +768,6 @@ static int uarte_nrfx_init(const struct device *dev) #endif nrf_uarte_int_enable(uarte, rx_int_mask); - nrf_uarte_enable(uarte); k_timer_init(&data->async->rx.timer, rx_timeout, NULL); k_timer_user_data_set(&data->async->rx.timer, (void *)dev); @@ -754,6 +783,7 @@ static int uarte_nrfx_init(const struct device *dev) */ static void start_tx_locked(const struct device *dev, struct uarte_nrfx_data *data) { + nrf_uarte_int_enable(get_uarte_instance(dev), NRF_UARTE_INT_TXSTOPPED_MASK); if (!is_tx_ready(dev)) { /* Active poll out, postpone until it is completed. */ data->async->tx.pending = true; @@ -817,7 +847,6 @@ static int uarte_nrfx_tx(const struct device *dev, const uint8_t *buf, data->async->tx.len = len; data->async->tx.buf = buf; - nrf_uarte_int_enable(uarte, NRF_UARTE_INT_TXSTOPPED_MASK); if (nrf_dma_accessible_check(uarte, buf)) { data->async->tx.xfer_buf = buf; @@ -827,6 +856,10 @@ static int uarte_nrfx_tx(const struct device *dev, const uint8_t *buf, (void)setup_tx_cache(dev); } + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_get(dev); + } + start_tx_locked(dev, data); irq_unlock(key); @@ -966,7 +999,7 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, async_rx->next_buf = NULL; async_rx->next_buf_len = 0; - if (cfg->flags & UARTE_CFG_FLAG_LOW_POWER) { + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || LOW_POWER_ENABLED(cfg)) { if (async_rx->flush_cnt) { int cpy_len = MIN(len, async_rx->flush_cnt); @@ -1018,7 +1051,10 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED); async_rx->enabled = true; - if (cfg->flags & UARTE_CFG_FLAG_LOW_POWER) { + + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_get(dev); + } else if (LOW_POWER_ENABLED(cfg)) { unsigned int key = irq_lock(); uarte_enable(dev, UARTE_FLAG_LOW_POWER_RX, UARTE_FLAG_LOW_POWER_TX); @@ -1534,7 +1570,9 @@ static void rxto_isr(const struct device *dev) nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXDRDY); #endif - if (config->flags & UARTE_CFG_FLAG_LOW_POWER) { + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_put(dev); + } else if (LOW_POWER_ENABLED(config)) { uint32_t key = irq_lock(); uarte_disable_locked(dev, UARTE_FLAG_LOW_POWER_RX, UARTE_FLAG_LOW_POWER_TX); @@ -1551,27 +1589,28 @@ static void txstopped_isr(const struct device *dev) NRF_UARTE_Type *uarte = get_uarte_instance(dev); unsigned int key; - if (config->flags & UARTE_CFG_FLAG_LOW_POWER) { - nrf_uarte_int_disable(uarte, NRF_UARTE_INT_TXSTOPPED_MASK); - key = irq_lock(); - uarte_disable_locked(dev, UARTE_FLAG_LOW_POWER_TX, UARTE_FLAG_LOW_POWER_RX); - irq_unlock(key); + key = irq_lock(); - if (!data->async->tx.len) { - return; + size_t amount = (data->async->tx.amount >= 0) ? + data->async->tx.amount : nrf_uarte_tx_amount_get(uarte); + + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + nrf_uarte_int_disable(uarte, NRF_UARTE_INT_TXSTOPPED_MASK); + if (data->flags & UARTE_FLAG_POLL_OUT) { + pm_device_runtime_put(dev); + data->flags &= ~UARTE_FLAG_POLL_OUT; } + } else if (LOW_POWER_ENABLED(config)) { + nrf_uarte_int_disable(uarte, NRF_UARTE_INT_TXSTOPPED_MASK); + uarte_disable_locked(dev, UARTE_FLAG_LOW_POWER_TX, UARTE_FLAG_LOW_POWER_RX); } + irq_unlock(key); + if (!data->async->tx.buf) { return; } - key = irq_lock(); - size_t amount = (data->async->tx.amount >= 0) ? - data->async->tx.amount : nrf_uarte_tx_amount_get(uarte); - - irq_unlock(key); - /* If there is a pending tx request, it means that uart_tx() * was called when there was ongoing uart_poll_out. Handling * TXSTOPPED interrupt means that uart_poll_out has completed. @@ -1621,6 +1660,10 @@ static void txstopped_isr(const struct device *dev) data->async->tx.buf = NULL; data->async->tx.len = 0; + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + pm_device_runtime_put(dev); + } + user_callback(dev, &evt); } @@ -1783,6 +1826,8 @@ static void uarte_nrfx_poll_out(const struct device *dev, unsigned char c) { const struct uarte_nrfx_config *config = dev->config; bool isr_mode = k_is_in_isr() || k_is_pre_kernel(); + struct uarte_nrfx_data *data = dev->data; + NRF_UARTE_Type *uarte = get_uarte_instance(dev); unsigned int key; if (isr_mode) { @@ -1790,9 +1835,6 @@ static void uarte_nrfx_poll_out(const struct device *dev, unsigned char c) key = irq_lock(); if (is_tx_ready(dev)) { #if UARTE_ANY_ASYNC - NRF_UARTE_Type *uarte = get_uarte_instance(dev); - struct uarte_nrfx_data *data = dev->data; - if (data->async && data->async->tx.len && data->async->tx.amount < 0) { data->async->tx.amount = nrf_uarte_tx_amount_get(uarte); @@ -1808,6 +1850,17 @@ static void uarte_nrfx_poll_out(const struct device *dev, unsigned char c) key = wait_tx_ready(dev); } + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + if (!(data->flags & UARTE_FLAG_POLL_OUT)) { + data->flags |= UARTE_FLAG_POLL_OUT; + pm_device_runtime_get(dev); + } + } + + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || LOW_POWER_ENABLED(config)) { + nrf_uarte_int_enable(uarte, NRF_UARTE_INT_TXSTOPPED_MASK); + } + *config->poll_out_byte = c; tx_start(dev, config->poll_out_byte, 1); @@ -2041,84 +2094,6 @@ static int endtx_stoptx_ppi_init(NRF_UARTE_Type *uarte, } #endif /* UARTE_ENHANCED_POLL_OUT */ -static int uarte_instance_init(const struct device *dev, - uint8_t interrupts_active) -{ - int err; - NRF_UARTE_Type *uarte = get_uarte_instance(dev); - const struct uarte_nrfx_config *cfg = dev->config; - -#if defined(CONFIG_UART_USE_RUNTIME_CONFIGURE) || defined(UARTE_ENHANCED_POLL_OUT) || \ - defined(UARTE_ANY_ASYNC) - struct uarte_nrfx_data *data = dev->data; -#endif - - nrf_uarte_disable(uarte); - -#ifdef CONFIG_ARCH_POSIX - /* For simulation the DT provided peripheral address needs to be corrected */ - ((struct pinctrl_dev_config *)cfg->pcfg)->reg = (uintptr_t)cfg->uarte_regs; -#endif - - err = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT); - if (err < 0) { - return err; - } - -#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE - err = uarte_nrfx_configure(dev, &data->uart_config); - if (err) { - return err; - } -#else - nrf_uarte_baudrate_set(uarte, cfg->nrf_baudrate); - nrf_uarte_configure(uarte, &cfg->hw_config); -#endif - -#ifdef UARTE_HAS_ENDTX_STOPTX_SHORT - nrf_uarte_shorts_enable(uarte, NRF_UARTE_SHORT_ENDTX_STOPTX); -#elif defined(UARTE_ENHANCED_POLL_OUT) - if (cfg->flags & UARTE_CFG_FLAG_PPI_ENDTX) { - err = endtx_stoptx_ppi_init(uarte, data); - if (err < 0) { - return err; - } - } -#endif -#ifdef UARTE_ANY_ASYNC - if (data->async) { - err = uarte_nrfx_init(dev); - if (err < 0) { - return err; - } - } else -#endif - { - /* Enable receiver and transmitter */ - nrf_uarte_enable(uarte); - - if (!cfg->disable_rx) { - nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_ENDRX); - - nrf_uarte_rx_buffer_set(uarte, cfg->poll_in_byte, 1); - nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STARTRX); - } - } - - if (!IS_ENABLED(UARTE_HAS_ENDTX_STOPTX_SHORT) && !(cfg->flags & UARTE_CFG_FLAG_PPI_ENDTX)) { - nrf_uarte_int_enable(uarte, NRF_UARTE_INT_ENDTX_MASK); - } - - /* Set TXSTOPPED event by requesting fake (zero-length) transfer. - * Pointer to RAM variable (data->tx_buffer) is set because otherwise - * such operation may result in HardFault or RAM corruption. - */ - tx_start(dev, cfg->poll_out_byte, 0); - - return 0; -} - -#ifdef CONFIG_PM_DEVICE /** @brief Pend until TX is stopped. * * There are 2 configurations that must be handled: @@ -2142,7 +2117,9 @@ static void wait_for_tx_stopped(const struct device *dev) nrf_uarte_int_disable(uarte, NRF_UARTE_INT_ENDTX_MASK); NRFX_WAIT_FOR(is_tx_ready(dev), 1000, 1, res); if (!nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_TXSTOPPED)) { - nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_ENDTX); + if (!IS_ENABLED(UARTE_HAS_ENDTX_STOPTX_SHORT)) { + nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_ENDTX); + } nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STOPTX); } } @@ -2155,93 +2132,59 @@ static void wait_for_tx_stopped(const struct device *dev) } } - -static int uarte_nrfx_pm_action(const struct device *dev, - enum pm_device_action action) +static void uarte_pm_resume(const struct device *dev) { - NRF_UARTE_Type *uarte = get_uarte_instance(dev); -#if defined(UARTE_ANY_ASYNC) || defined(UARTE_INTERRUPT_DRIVEN) - struct uarte_nrfx_data *data = dev->data; -#endif const struct uarte_nrfx_config *cfg = dev->config; - int ret; -#ifdef UARTE_ANY_ASYNC - /* If low power mode for asynchronous mode is used then there is nothing to do here. - * In low power mode UARTE is turned off whenever there is no activity. - */ - if (data->async && (cfg->flags & UARTE_CFG_FLAG_LOW_POWER)) { - return 0; - } -#endif + (void)pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT); - switch (action) { - case PM_DEVICE_ACTION_RESUME: - ret = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT); - if (ret < 0) { - return ret; - } + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || !LOW_POWER_ENABLED(cfg)) { + uarte_periph_enable(dev); + } +} - nrf_uarte_enable(uarte); -#if UARTE_BAUDRATE_RETENTION_WORKAROUND - nrf_uarte_baudrate_set(get_uarte_instance(dev), - COND_CODE_1(CONFIG_UART_USE_RUNTIME_CONFIGURE, - (data->nrf_baudrate), (cfg->nrf_baudrate))); -#endif +static void uarte_pm_suspend(const struct device *dev) +{ + NRF_UARTE_Type *uarte = get_uarte_instance(dev); + const struct uarte_nrfx_config *cfg = dev->config; + struct uarte_nrfx_data *data = dev->data; + (void)data; #ifdef UARTE_ANY_ASYNC - if (data->async) { - if (HW_RX_COUNTING_ENABLED(cfg)) { - nrfx_timer_enable(&cfg->timer); - } - - return 0; - } -#endif - if (!cfg->disable_rx) { - - nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_ENDRX); - nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STARTRX); -#ifdef UARTE_INTERRUPT_DRIVEN - if (data->int_driven && - data->int_driven->rx_irq_enabled) { - nrf_uarte_int_enable(uarte, - NRF_UARTE_INT_ENDRX_MASK); - } -#endif - } - break; - case PM_DEVICE_ACTION_SUSPEND: - /* Disabling UART requires stopping RX, but stop RX event is - * only sent after each RX if async UART API is used. + if (data->async) { + /* Entering inactive state requires device to be no + * active asynchronous calls. */ -#ifdef UARTE_ANY_ASYNC - if (data->async) { - /* Entering inactive state requires device to be no - * active asynchronous calls. + __ASSERT_NO_MSG(!data->async->rx.enabled); + __ASSERT_NO_MSG(!data->async->tx.len); + if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) { + /* If runtime PM is enabled then reference counting ensures that + * suspend will not occur when TX is active. */ - __ASSERT_NO_MSG(!data->async->rx.enabled); - __ASSERT_NO_MSG(!data->async->tx.len); -#if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) - if (data->async && HW_RX_COUNTING_ENABLED(cfg)) { - nrfx_timer_disable(&cfg->timer); - /* Timer/counter value is reset when disabled. */ - data->async->rx.total_byte_cnt = 0; - data->async->rx.total_user_byte_cnt = 0; - } -#endif + __ASSERT_NO_MSG(nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_TXSTOPPED)); + } else { + wait_for_tx_stopped(dev); + } +#if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) + if (data->async && HW_RX_COUNTING_ENABLED(cfg)) { + nrfx_timer_disable(&cfg->timer); + /* Timer/counter value is reset when disabled. */ + data->async->rx.total_byte_cnt = 0; + data->async->rx.total_user_byte_cnt = 0; } #endif + } else if (IS_ENABLED(UARTE_ANY_NONE_ASYNC)) +#endif + { if (nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_RXSTARTED)) { -#ifdef UARTE_INTERRUPT_DRIVEN +#if defined(UARTE_INTERRUPT_DRIVEN) && defined(CONFIG_PM_DEVICE) if (data->int_driven) { data->int_driven->rx_irq_enabled = - nrf_uarte_int_enable_check(uarte, - NRF_UARTE_INT_ENDRX_MASK); + nrf_uarte_int_enable_check(uarte, + NRF_UARTE_INT_ENDRX_MASK); if (data->int_driven->rx_irq_enabled) { - nrf_uarte_int_disable(uarte, - NRF_UARTE_INT_ENDRX_MASK); + nrf_uarte_int_disable(uarte, NRF_UARTE_INT_ENDRX_MASK); } } #endif @@ -2257,21 +2200,114 @@ static int uarte_nrfx_pm_action(const struct device *dev, } wait_for_tx_stopped(dev); - uarte_disable_locked(dev, UARTE_FLAG_LOW_POWER_TX | UARTE_FLAG_LOW_POWER_RX, 0); + } - ret = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_SLEEP); - if (ret < 0) { - return ret; - } + nrf_uarte_disable(uarte); - break; - default: + (void)pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_SLEEP); +} + +static int uarte_nrfx_pm_action(const struct device *dev, enum pm_device_action action) +{ + if (action == PM_DEVICE_ACTION_RESUME) { + uarte_pm_resume(dev); + } else if (IS_ENABLED(CONFIG_PM_DEVICE) && (action == PM_DEVICE_ACTION_SUSPEND)) { + uarte_pm_suspend(dev); + } else { return -ENOTSUP; } return 0; } -#endif /* CONFIG_PM_DEVICE */ + +static int uarte_tx_path_init(const struct device *dev) +{ + NRF_UARTE_Type *uarte = get_uarte_instance(dev); + const struct uarte_nrfx_config *cfg = dev->config; + bool auto_endtx = false; + +#ifdef UARTE_HAS_ENDTX_STOPTX_SHORT + nrf_uarte_shorts_enable(uarte, NRF_UARTE_SHORT_ENDTX_STOPTX); + auto_endtx = true; +#elif defined(UARTE_ENHANCED_POLL_OUT) + if (cfg->flags & UARTE_CFG_FLAG_PPI_ENDTX) { + struct uarte_nrfx_data *data = dev->data; + int err; + + err = endtx_stoptx_ppi_init(uarte, data); + if (err < 0) { + return err; + } + auto_endtx = true; + } +#endif + + /* Get to the point where TXSTOPPED event is set but TXSTOPPED interrupt is + * disabled. This trick is later on used to handle TX path and determine + * using HW if TX is active (TXSTOPPED event set means TX is inactive). + * + * Set TXSTOPPED event by requesting fake (zero-length) transfer. + * Pointer to RAM variable is set because otherwise such operation may + * result in HardFault or RAM corruption. + */ + nrf_uarte_enable(uarte); + nrf_uarte_tx_buffer_set(uarte, cfg->poll_out_byte, 0); + nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STARTTX); + if (!auto_endtx) { + while (!nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_ENDTX)) { + } + nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_ENDTX); + nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STOPTX); + nrf_uarte_int_enable(uarte, NRF_UARTE_INT_ENDTX_MASK); + } + while (!nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_TXSTOPPED)) { + } + nrf_uarte_disable(uarte); + + return 0; +} + +static int uarte_instance_init(const struct device *dev, + uint8_t interrupts_active) +{ + int err; + const struct uarte_nrfx_config *cfg = dev->config; + + if (IS_ENABLED(CONFIG_ARCH_POSIX)) { + /* For simulation the DT provided peripheral address needs to be corrected */ + ((struct pinctrl_dev_config *)cfg->pcfg)->reg = (uintptr_t)cfg->uarte_regs; + } + +#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE + err = uarte_nrfx_configure(dev, &((struct uarte_nrfx_data *)dev->data)->uart_config); + if (err) { + return err; + } +#else + NRF_UARTE_Type *uarte = get_uarte_instance(dev); + + nrf_uarte_baudrate_set(uarte, cfg->nrf_baudrate); + nrf_uarte_configure(uarte, &cfg->hw_config); +#endif + +#ifdef UARTE_ANY_ASYNC + struct uarte_nrfx_data *data = dev->data; + + if (data->async) { + err = uarte_async_init(dev); + if (err < 0) { + return err; + } + } +#endif + + err = uarte_tx_path_init(dev); + if (err) { + return err; + } + + return pm_device_driver_init(dev, uarte_nrfx_pm_action); +} #define UARTE_IRQ_CONFIGURE(idx, isr_handler) \ do { \ @@ -2398,7 +2434,8 @@ static int uarte_nrfx_pm_action(const struct device *dev, IS_ENABLED(CONFIG_UART_##idx##_INTERRUPT_DRIVEN)); \ } \ \ - PM_DEVICE_DT_DEFINE(UARTE(idx), uarte_nrfx_pm_action); \ + PM_DEVICE_DT_DEFINE(UARTE(idx), uarte_nrfx_pm_action, \ + PM_DEVICE_ISR_SAFE); \ \ DEVICE_DT_DEFINE(UARTE(idx), \ uarte_##idx##_init, \ From 68903ca8dded73a1dc6c6893e69e72c294673266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Fri, 25 Oct 2024 12:59:55 +0200 Subject: [PATCH 1818/4482] drivers: serial: nrfx_uarte: Improve RX FIFO flushing workaround MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improved a workaround. When FIFO is not empty then FLUSHRX task will generate RXSTARTED event to indicated that DMA transfer was started. This property can be used to detect when FIFO was not empty and workaroud a HW bug where RX.AMOUNT register is not updated after flushing empty FIFO. Signed-off-by: Krzysztof Chruściński --- drivers/serial/Kconfig.nrfx | 10 ---- drivers/serial/uart_nrfx_uarte.c | 88 ++++++++------------------------ 2 files changed, 22 insertions(+), 76 deletions(-) diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index 6bd4b2d45916f..ae790980f4247 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -57,16 +57,6 @@ config UART_ASYNC_TX_CACHE_SIZE in RAM, because EasyDMA in UARTE peripherals can only transfer data from RAM. -config UART_NRFX_UARTE_RX_FLUSH_MAGIC_BYTE - hex "Byte used for RX FIFO flush workaround" - default 0xAA - range 0x00 0xFF - help - Byte used to fill the buffer before RX FIFO is flushed into it. Due to the - HW anomaly a workaround need to be applied which checks if content of the - buffer changed. There are cases when specific value of the magic byte is - used if it is known that certain bytes are less likely to occur. - if HAS_HW_NRF_UART0 || HAS_HW_NRF_UARTE0 nrfx_uart_num = 0 rsource "Kconfig.nrfx_uart_instance" diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index b22c50af09614..6bc211a53514b 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -25,7 +25,9 @@ #include LOG_MODULE_REGISTER(uart_nrfx_uarte, CONFIG_UART_LOG_LEVEL); +#if !defined(CONFIG_ARCH_POSIX) #define RX_FLUSH_WORKAROUND 1 +#endif #define UARTE(idx) DT_NODELABEL(uart##idx) #define UARTE_HAS_PROP(idx, prop) DT_NODE_HAS_PROP(UARTE(idx), prop) @@ -695,9 +697,6 @@ static void uarte_disable_locked(const struct device *dev, uint32_t dis_mask, ui nrf_uarte_disable(get_uarte_instance(dev)); } -#endif - -#ifdef UARTE_ANY_ASYNC static void rx_timeout(struct k_timer *timer); static void tx_timeout(struct k_timer *timer); @@ -1437,85 +1436,45 @@ static void endrx_isr(const struct device *dev) #endif } -/* Function for flushing internal RX fifo. Function can be called in case - * flushed data is discarded or when data is valid and needs to be retrieved. +/** @brief RX FIFO flushing * - * However, UARTE does not update RXAMOUNT register if fifo is empty. Old value - * remains. In certain cases it makes it impossible to distinguish between - * case when fifo was empty and not. Function is trying to minimize chances of - * error with following measures: - * - RXAMOUNT is read before flushing and compared against value after flushing - * if they differ it indicates that data was flushed - * - user buffer is dirtied and if RXAMOUNT did not changed it is checked if - * it is still dirty. If not then it indicates that data was flushed - * - * In other cases function indicates that fifo was empty. It means that if - * number of bytes in the fifo equal last rx transfer length and data is equal - * to dirty marker it will be discarded. + * Due to the HW bug which does not update RX.AMOUNT register when FIFO was empty + * a workaround is applied which checks RXSTARTED event. If that event is set it + * means that FIFO was not empty. * * @param dev Device. - * @param buf Buffer for flushed data, null indicates that flushed data can be - * dropped but we still want to get amount of data flushed. - * @param len Buffer size, not used if @p buf is null. * * @return number of bytes flushed from the fifo. */ - -static uint8_t rx_flush(const struct device *dev, uint8_t *buf) +static uint8_t rx_flush(const struct device *dev) { - /* Flushing RX fifo requires buffer bigger than 4 bytes to empty fifo*/ - static const uint8_t dirty = CONFIG_UART_NRFX_UARTE_RX_FLUSH_MAGIC_BYTE; NRF_UARTE_Type *uarte = get_uarte_instance(dev); const struct uarte_nrfx_config *config = dev->config; - uint32_t prev_rx_amount; uint32_t rx_amount; - if (IS_ENABLED(RX_FLUSH_WORKAROUND)) { - memset(buf, dirty, UARTE_HW_RX_FIFO_SIZE); - if (IS_ENABLED(UARTE_ANY_CACHE) && (config->flags & UARTE_CFG_FLAG_CACHEABLE)) { - sys_cache_data_flush_range(buf, UARTE_HW_RX_FIFO_SIZE); - } - prev_rx_amount = nrf_uarte_rx_amount_get(uarte); - } else { - prev_rx_amount = 0; - } - - nrf_uarte_rx_buffer_set(uarte, buf, UARTE_HW_RX_FIFO_SIZE); - /* Final part of handling RXTO event is in ENDRX interrupt - * handler. ENDRX is generated as a result of FLUSHRX task. - */ - nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_ENDRX); + nrf_uarte_rx_buffer_set(uarte, config->rx_flush_buf, UARTE_HW_RX_FIFO_SIZE); nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_FLUSHRX); while (!nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_ENDRX)) { /* empty */ } nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_ENDRX); - nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED); - rx_amount = nrf_uarte_rx_amount_get(uarte); - if (!buf || !IS_ENABLED(RX_FLUSH_WORKAROUND)) { - return rx_amount; - } - - if (rx_amount != prev_rx_amount) { - return rx_amount; - } - - if (rx_amount > UARTE_HW_RX_FIFO_SIZE) { - return 0; - } - - if (IS_ENABLED(UARTE_ANY_CACHE) && (config->flags & UARTE_CFG_FLAG_CACHEABLE)) { - sys_cache_data_invd_range(buf, UARTE_HW_RX_FIFO_SIZE); + if (!IS_ENABLED(RX_FLUSH_WORKAROUND)) { + nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED); + rx_amount = nrf_uarte_rx_amount_get(uarte); + } else if (nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_RXSTARTED)) { + nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED); + rx_amount = nrf_uarte_rx_amount_get(uarte); + } else { + rx_amount = 0; } - for (int i = 0; i < rx_amount; i++) { - if (buf[i] != dirty) { - return rx_amount; - } + if (IS_ENABLED(UARTE_ANY_CACHE) && (config->flags & UARTE_CFG_FLAG_CACHEABLE) && + rx_amount) { + sys_cache_data_invd_range(config->rx_flush_buf, rx_amount); } - return 0; + return rx_amount; } /* This handler is called when the receiver is stopped. If rx was aborted @@ -1549,17 +1508,14 @@ static void rxto_isr(const struct device *dev) async_rx->discard_fifo = false; #if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX) if (HW_RX_COUNTING_ENABLED(config)) { - uint8_t buf[UARTE_HW_RX_FIFO_SIZE]; - /* It need to be included because TIMER+PPI got RXDRDY events * and counted those flushed bytes. */ - async_rx->total_user_byte_cnt += rx_flush(dev, buf); - (void)buf; + async_rx->total_user_byte_cnt += rx_flush(dev); } #endif } else { - async_rx->flush_cnt = rx_flush(dev, config->rx_flush_buf); + async_rx->flush_cnt = rx_flush(dev); } #ifdef CONFIG_UART_NRFX_UARTE_ENHANCED_RX From 7e94fca0bdd8ee2499a00f947b0fc632fe1b301f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Mon, 7 Oct 2024 16:21:22 +0200 Subject: [PATCH 1819/4482] drivers: serial: nrfx_uarte: Use legacy shim by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So far new platforms did not use legacy shim but it shall be now a default uart shim for all platforms. Signed-off-by: Krzysztof Chruściński --- drivers/serial/Kconfig.nrfx | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/serial/Kconfig.nrfx b/drivers/serial/Kconfig.nrfx index ae790980f4247..650404fceecb3 100644 --- a/drivers/serial/Kconfig.nrfx +++ b/drivers/serial/Kconfig.nrfx @@ -31,8 +31,6 @@ config UART_NRFX_UARTE config UART_NRFX_UARTE_LEGACY_SHIM bool "Legacy UARTE shim" depends on UART_NRFX_UARTE - depends on !SOC_SERIES_NRF54HX || RISCV - depends on !SOC_SERIES_NRF92X || RISCV default y config UART_NRFX_UARTE_ENHANCED_RX From 9ccaf9b5bdb68c393b8c14a82e1132266cc6b900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Tue, 22 Oct 2024 20:31:10 +0200 Subject: [PATCH 1820/4482] drivers: serial: nrfx_uarte: Minor code size optimization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Optimize function which enables UARTE peripheral. It is called only when interrupts are locked so data->flags does not require atomic operation. Use standard logical operations so save few bytes. Simplify uarte_disable_locked. Signed-off-by: Krzysztof Chruściński --- drivers/serial/uart_nrfx_uarte.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 6bc211a53514b..5c19485946c4e 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -219,6 +219,7 @@ struct uarte_nrfx_data { #define UARTE_FLAG_LOW_POWER_TX BIT(0) #define UARTE_FLAG_LOW_POWER_RX BIT(1) +#define UARTE_FLAG_LOW_POWER (UARTE_FLAG_LOW_POWER_TX | UARTE_FLAG_LOW_POWER_RX) #define UARTE_FLAG_TRIG_RXTO BIT(2) #define UARTE_FLAG_POLL_OUT BIT(3) @@ -617,11 +618,13 @@ static void uarte_periph_enable(const struct device *dev) } } -static void uarte_enable(const struct device *dev, uint32_t act_mask, uint32_t sec_mask) +static void uarte_enable_locked(const struct device *dev, uint32_t act_mask) { struct uarte_nrfx_data *data = dev->data; + bool already_active = (data->flags & UARTE_FLAG_LOW_POWER) != 0; - if (atomic_or(&data->flags, act_mask) & sec_mask) { + data->flags |= act_mask; + if (already_active) { /* Second direction already enabled so UARTE is enabled. */ return; } @@ -657,7 +660,7 @@ static void tx_start(const struct device *dev, const uint8_t *buf, size_t len) nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_TXSTOPPED); if (LOW_POWER_ENABLED(config)) { - uarte_enable(dev, UARTE_FLAG_LOW_POWER_TX, UARTE_FLAG_LOW_POWER_RX); + uarte_enable_locked(dev, UARTE_FLAG_LOW_POWER_TX); } nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STARTTX); @@ -673,14 +676,13 @@ static void tx_start(const struct device *dev, const uint8_t *buf, size_t len) * here. * @param dev Device. * @param dis_mask Mask of direction (RX or TX) which now longer uses the UARTE instance. - * @param sec_mask Mask of second direction which is used to check if it uses the UARTE. */ -static void uarte_disable_locked(const struct device *dev, uint32_t dis_mask, uint32_t sec_mask) +static void uarte_disable_locked(const struct device *dev, uint32_t dis_mask) { struct uarte_nrfx_data *data = dev->data; data->flags &= ~dis_mask; - if (data->flags & sec_mask) { + if (data->flags & UARTE_FLAG_LOW_POWER) { return; } @@ -1056,7 +1058,7 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf, } else if (LOW_POWER_ENABLED(cfg)) { unsigned int key = irq_lock(); - uarte_enable(dev, UARTE_FLAG_LOW_POWER_RX, UARTE_FLAG_LOW_POWER_TX); + uarte_enable_locked(dev, UARTE_FLAG_LOW_POWER_RX); irq_unlock(key); } @@ -1531,7 +1533,7 @@ static void rxto_isr(const struct device *dev) } else if (LOW_POWER_ENABLED(config)) { uint32_t key = irq_lock(); - uarte_disable_locked(dev, UARTE_FLAG_LOW_POWER_RX, UARTE_FLAG_LOW_POWER_TX); + uarte_disable_locked(dev, UARTE_FLAG_LOW_POWER_RX); irq_unlock(key); } @@ -1558,7 +1560,7 @@ static void txstopped_isr(const struct device *dev) } } else if (LOW_POWER_ENABLED(config)) { nrf_uarte_int_disable(uarte, NRF_UARTE_INT_TXSTOPPED_MASK); - uarte_disable_locked(dev, UARTE_FLAG_LOW_POWER_TX, UARTE_FLAG_LOW_POWER_RX); + uarte_disable_locked(dev, UARTE_FLAG_LOW_POWER_TX); } irq_unlock(key); From 832bbd80306ea35b992fb7328fdd83cb52998dd8 Mon Sep 17 00:00:00 2001 From: Vladislav Pejic Date: Wed, 23 Oct 2024 15:19:58 +0200 Subject: [PATCH 1821/4482] driver: sensor: adxl372: Bug fix for q31_t conv This is a bug fix for adxl372_accel_convert_q31 function. Function is used to convert samples received from sensor to q31_t format when RTIO stream is used. Signed-off-by: Vladislav Pejic --- drivers/sensor/adi/adxl372/adxl372_decoder.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/sensor/adi/adxl372/adxl372_decoder.c b/drivers/sensor/adi/adxl372/adxl372_decoder.c index db3dc866c0c80..eaa3ce7f5c3cf 100644 --- a/drivers/sensor/adi/adxl372/adxl372_decoder.c +++ b/drivers/sensor/adi/adxl372/adxl372_decoder.c @@ -8,11 +8,9 @@ #ifdef CONFIG_ADXL372_STREAM -/* - * Sensor resolution is 100mg/LSB, 12-bit value needs to be right - * shifted by 4 or divided by 16. Overall this results in a scale of 160 - */ -#define SENSOR_SCALING_FACTOR (SENSOR_G / (16 * 1000 / 100)) +/* (1.0 / 10 (sensor sensitivity)) * (2^31 / 2^11 (sensor shift) ) * SENSOR_G */ +#define SENSOR_QSCALE_FACTOR UINT32_C(1027604) + #define ADXL372_COMPLEMENT 0xf000 static const uint32_t accel_period_ns[] = { @@ -31,9 +29,7 @@ static inline void adxl372_accel_convert_q31(q31_t *out, const uint8_t *buff) data_in |= ADXL372_COMPLEMENT; } - int64_t micro_ms2 = data_in * SENSOR_SCALING_FACTOR; - - *out = CLAMP((micro_ms2 + (micro_ms2 % 1000000)), INT32_MIN, INT32_MAX); + *out = data_in * SENSOR_QSCALE_FACTOR; } static int adxl372_decode_stream(const uint8_t *buffer, struct sensor_chan_spec chan_spec, @@ -54,6 +50,7 @@ static int adxl372_decode_stream(const uint8_t *buffer, struct sensor_chan_spec memset(data, 0, sizeof(struct sensor_three_axis_data)); data->header.base_timestamp_ns = enc_data->timestamp; data->header.reading_count = 1; + data->header.shift = 11; /* Sensor shift */ buffer += sizeof(struct adxl372_fifo_data); From f8a7035c0aa289a391fbc848998b4d03dc5e530e Mon Sep 17 00:00:00 2001 From: Benjamin Lindqvist Date: Wed, 23 Oct 2024 14:26:25 +0200 Subject: [PATCH 1822/4482] net: coap_client: signal socket error to user Before this patch, any unexpected socket error during poll (caused by LTE disconnects for instance) would lead to a infinite loop because the error state was never cleared, handled or even signaled to the user. Signed-off-by: Benjamin Lindqvist --- include/zephyr/net/coap_client.h | 1 + subsys/net/lib/coap/coap_client.c | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/include/zephyr/net/coap_client.h b/include/zephyr/net/coap_client.h index a4f35374c93bf..00b97af60af2d 100644 --- a/include/zephyr/net/coap_client.h +++ b/include/zephyr/net/coap_client.h @@ -115,6 +115,7 @@ struct coap_client { struct coap_client_internal_request requests[CONFIG_COAP_CLIENT_MAX_REQUESTS]; struct coap_option echo_option; bool send_echo; + int socket_error; }; /** @endcond */ diff --git a/subsys/net/lib/coap/coap_client.c b/subsys/net/lib/coap/coap_client.c index 5569ab17008fb..f1ced3a9cdcdc 100644 --- a/subsys/net/lib/coap/coap_client.c +++ b/subsys/net/lib/coap/coap_client.c @@ -550,19 +550,24 @@ static int handle_poll(void) } else { for (int i = 0; i < nfds; i++) { + if (fds[i].revents & ZSOCK_POLLERR) { LOG_ERR("Error in poll for socket %d", fds[i].fd); + clients[i]->socket_error = -EIO; } if (fds[i].revents & ZSOCK_POLLHUP) { LOG_ERR("Error in poll: POLLHUP for socket %d", fds[i].fd); + clients[i]->socket_error = -ENOTCONN; } if (fds[i].revents & ZSOCK_POLLNVAL) { LOG_ERR("Error in poll: POLLNVAL - fd %d not open", fds[i].fd); + clients[i]->socket_error = -EINVAL; } if (fds[i].revents & ZSOCK_POLLIN) { clients[i]->response_ready = true; } + } return 0; @@ -918,7 +923,24 @@ void coap_client_cancel_requests(struct coap_client *client) k_sleep(K_MSEC(COAP_PERIODIC_TIMEOUT)); } -static void coap_client_recv(void *coap_cl, void *a, void *b) +static void signal_socket_error(struct coap_client *cli) +{ + for (int i = 0; i < CONFIG_COAP_CLIENT_MAX_REQUESTS; i++) { + struct coap_client_internal_request *req = &cli->requests[i]; + + if (!req->request_ongoing) { + continue; + } + + req->request_ongoing = false; + if (req->coap_request.cb) { + req->coap_request.cb(cli->socket_error, 0, NULL, 0, + true, req->coap_request.user_data); + } + } +} + +void coap_client_recv(void *coap_cl, void *a, void *b) { int ret; @@ -959,6 +981,12 @@ static void coap_client_recv(void *coap_cl, void *a, void *b) clients[i]->response_ready = false; k_mutex_unlock(&clients[i]->lock); } + + if (clients[i]->socket_error) { + signal_socket_error(clients[i]); + clients[i]->socket_error = 0; + } + } /* There are more messages coming */ From f64747b792ffbe1109a2095de95b49224536e24d Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Sat, 19 Oct 2024 18:03:53 +0200 Subject: [PATCH 1823/4482] bluetooth: shell: Fix includes This allows to build the shell with BT_CTLR_DTM and/or BT_CTLR_ADV_EXT enabled. The issues has been introduced by commit bf897cf941a514e7ea7a5f837d2287e360281f24 (Bluetooth: Shell: Restructure shell files). Signed-off-by: Reto Schneider --- subsys/bluetooth/controller/ll_sw/shell/ll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/controller/ll_sw/shell/ll.c b/subsys/bluetooth/controller/ll_sw/shell/ll.c index 6af986effc210..40bed78f559e4 100644 --- a/subsys/bluetooth/controller/ll_sw/shell/ll.c +++ b/subsys/bluetooth/controller/ll_sw/shell/ll.c @@ -53,7 +53,7 @@ int cmd_ll_addr_read(const struct shell *sh, size_t argc, char *argv[]) } #if defined(CONFIG_BT_CTLR_DTM) -#include "../controller/ll_sw/ll_test.h" +#include "controller/ll_sw/ll_test.h" int cmd_test_tx(const struct shell *sh, size_t argc, char *argv[]) { From 17d9e75e3b8c6c782ae39495943aeed06399ef24 Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Fri, 25 Oct 2024 16:05:07 +0200 Subject: [PATCH 1824/4482] bluetooth: shell: Test BT_CTLR_DTM This ensures that enabling BT_CTLR_DTM does not break the compilation of the Bluetooth shell. Signed-off-by: Reto Schneider --- tests/bluetooth/shell/testcase.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/bluetooth/shell/testcase.yaml b/tests/bluetooth/shell/testcase.yaml index f8c3b7abb299d..6db24ccc0e51f 100644 --- a/tests/bluetooth/shell/testcase.yaml +++ b/tests/bluetooth/shell/testcase.yaml @@ -73,6 +73,13 @@ tests: build_only: true extra_args: CONF_FILE="log.conf" tags: bluetooth + bluetooth.shell.bt_ctrl_dtm: + build_only: true + extra_args: + - CONFIG_BT_CTLR_DTM_HCI=y + tags: bluetooth + platform_allow: + - nrf52840dk/nrf52840 # Bluetooth Audio Compile validation tests bluetooth.shell.audio: From 9ca3826abf676c2734a9a3050b9fa5c465166ed5 Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Sun, 20 Oct 2024 13:38:02 -0500 Subject: [PATCH 1825/4482] drivers: sensor: adi: Set trigger thread name Sets the trigger thread name for all adi sensor drivers to more clearly identify the thread when tracing or debugging. Signed-off-by: Maureen Helm --- drivers/sensor/adi/adt7310/adt7310_trigger.c | 1 + drivers/sensor/adi/adt7420/adt7420_trigger.c | 2 ++ drivers/sensor/adi/adxl362/adxl362_trigger.c | 2 ++ drivers/sensor/adi/adxl367/adxl367_trigger.c | 2 ++ drivers/sensor/adi/adxl372/adxl372_trigger.c | 2 ++ 5 files changed, 9 insertions(+) diff --git a/drivers/sensor/adi/adt7310/adt7310_trigger.c b/drivers/sensor/adi/adt7310/adt7310_trigger.c index be989a69910bd..4318293a35e0a 100644 --- a/drivers/sensor/adi/adt7310/adt7310_trigger.c +++ b/drivers/sensor/adi/adt7310/adt7310_trigger.c @@ -133,6 +133,7 @@ int adt7310_init_interrupt(const struct device *dev) adt7310_thread, drv_data, NULL, NULL, K_PRIO_COOP(CONFIG_ADT7310_THREAD_PRIORITY), 0, K_NO_WAIT); + k_thread_name_set(&drv_data->thread, dev->name); #elif defined(CONFIG_ADT7310_TRIGGER_GLOBAL_THREAD) drv_data->work.handler = adt7310_work_cb; #endif diff --git a/drivers/sensor/adi/adt7420/adt7420_trigger.c b/drivers/sensor/adi/adt7420/adt7420_trigger.c index 1a26903adc752..d70813d6cf1ff 100644 --- a/drivers/sensor/adi/adt7420/adt7420_trigger.c +++ b/drivers/sensor/adi/adt7420/adt7420_trigger.c @@ -170,6 +170,8 @@ int adt7420_init_interrupt(const struct device *dev) adt7420_thread, drv_data, NULL, NULL, K_PRIO_COOP(CONFIG_ADT7420_THREAD_PRIORITY), 0, K_NO_WAIT); + + k_thread_name_set(&drv_data->thread, dev->name); #elif defined(CONFIG_ADT7420_TRIGGER_GLOBAL_THREAD) drv_data->work.handler = adt7420_work_cb; #endif diff --git a/drivers/sensor/adi/adxl362/adxl362_trigger.c b/drivers/sensor/adi/adxl362/adxl362_trigger.c index 2bf6f34cf38ef..725c89dc64a27 100644 --- a/drivers/sensor/adi/adxl362/adxl362_trigger.c +++ b/drivers/sensor/adi/adxl362/adxl362_trigger.c @@ -185,6 +185,8 @@ int adxl362_init_interrupt(const struct device *dev) adxl362_thread, drv_data, NULL, NULL, K_PRIO_COOP(CONFIG_ADXL362_THREAD_PRIORITY), 0, K_NO_WAIT); + + k_thread_name_set(&drv_data->thread, dev->name); #elif defined(CONFIG_ADXL362_TRIGGER_GLOBAL_THREAD) drv_data->work.handler = adxl362_work_cb; #endif diff --git a/drivers/sensor/adi/adxl367/adxl367_trigger.c b/drivers/sensor/adi/adxl367/adxl367_trigger.c index 534bd07324e82..3c466f5087fa4 100644 --- a/drivers/sensor/adi/adxl367/adxl367_trigger.c +++ b/drivers/sensor/adi/adxl367/adxl367_trigger.c @@ -174,6 +174,8 @@ int adxl367_init_interrupt(const struct device *dev) (k_thread_entry_t)adxl367_thread, drv_data, NULL, NULL, K_PRIO_COOP(CONFIG_ADXL367_THREAD_PRIORITY), 0, K_NO_WAIT); + + k_thread_name_set(&drv_data->thread, dev->name); #elif defined(CONFIG_ADXL367_TRIGGER_GLOBAL_THREAD) drv_data->work.handler = adxl367_work_cb; #endif diff --git a/drivers/sensor/adi/adxl372/adxl372_trigger.c b/drivers/sensor/adi/adxl372/adxl372_trigger.c index b5a8e9272fb29..02f42f59767d9 100644 --- a/drivers/sensor/adi/adxl372/adxl372_trigger.c +++ b/drivers/sensor/adi/adxl372/adxl372_trigger.c @@ -192,6 +192,8 @@ int adxl372_init_interrupt(const struct device *dev) adxl372_thread, drv_data, NULL, NULL, K_PRIO_COOP(CONFIG_ADXL372_THREAD_PRIORITY), 0, K_NO_WAIT); + + k_thread_name_set(&drv_data->thread, dev->name); #elif defined(CONFIG_ADXL372_TRIGGER_GLOBAL_THREAD) drv_data->work.handler = adxl372_work_cb; #endif From fac21acc6b12aba5bcb6e6140f650419b5698c41 Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Sat, 19 Oct 2024 14:18:18 -0500 Subject: [PATCH 1826/4482] samples: sensor: Add adxl362 streaming and trigger configurations Adds adxl362 streaming and trigger configurations to accelerometer samples for profiling the performance impact of adding rtio support to max32 spi and adxl362 accelerometer drivers. Signed-off-by: Maureen Helm --- samples/sensor/accel_polling/adxl362-stream.conf | 7 +++++++ samples/sensor/accel_polling/sample.yaml | 14 ++++++++++++++ samples/sensor/accel_trig/adxl362-trigger.conf | 5 +++++ samples/sensor/accel_trig/sample.yaml | 14 ++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 samples/sensor/accel_polling/adxl362-stream.conf create mode 100644 samples/sensor/accel_trig/adxl362-trigger.conf diff --git a/samples/sensor/accel_polling/adxl362-stream.conf b/samples/sensor/accel_polling/adxl362-stream.conf new file mode 100644 index 0000000000000..49b04a4234249 --- /dev/null +++ b/samples/sensor/accel_polling/adxl362-stream.conf @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Analog Devices, Inc. +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SPI_RTIO=y +CONFIG_SENSOR_ASYNC_API=y +CONFIG_ADXL362_STREAM=y +CONFIG_ADXL362_ACCEL_ODR_400=y diff --git a/samples/sensor/accel_polling/sample.yaml b/samples/sensor/accel_polling/sample.yaml index a684fd932df50..b4752dfcff3da 100644 --- a/samples/sensor/accel_polling/sample.yaml +++ b/samples/sensor/accel_polling/sample.yaml @@ -26,3 +26,17 @@ tests: - b_l4s5i_iot01a # lsm6dsl - sensortile_box # lis2dw12, lsm6dso, iisdhhc - thingy53/nrf5340/cpuapp # adxl362, bmi270 + sample.sensor.accel_polling.adxl362-stream: + harness: console + tags: sensors + harness_config: + type: one_line + regex: + - "^\\s*[0-9A-Za-z_,+-.]*@[0-9A-Fa-f]* \\[m\/s\\^2\\]: \ + \\(\\s*-?[0-9\\.]*,\\s*-?[0-9\\.]*,\\s*-?[0-9\\.]*\\)$" + extra_args: + - SHIELD=eval_adxl362_ardz + - EXTRA_CONF_FILE=adxl362-stream.conf + - SNIPPET=rtt-tracing;rtt-console + platform_allow: + - apard32690/max32690/m4 diff --git a/samples/sensor/accel_trig/adxl362-trigger.conf b/samples/sensor/accel_trig/adxl362-trigger.conf new file mode 100644 index 0000000000000..64f78482ae824 --- /dev/null +++ b/samples/sensor/accel_trig/adxl362-trigger.conf @@ -0,0 +1,5 @@ +# Copyright (c) 2024 Analog Devices, Inc. +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_ADXL362_TRIGGER_OWN_THREAD=y +CONFIG_ADXL362_ACCEL_ODR_400=y diff --git a/samples/sensor/accel_trig/sample.yaml b/samples/sensor/accel_trig/sample.yaml index 0cdbd0667810d..2ce9ba9157533 100644 --- a/samples/sensor/accel_trig/sample.yaml +++ b/samples/sensor/accel_trig/sample.yaml @@ -12,3 +12,17 @@ tests: \\(\\s*-?[0-9\\.]*,\\s*-?[0-9\\.]*,\\s*-?[0-9\\.]*\\)$" integration_platforms: - frdm_k64f # fxos8700 + sample.sensor.accel_trig.adxl362-trigger: + harness: console + tags: sensors + harness_config: + type: one_line + regex: + - "^\\s*[0-9A-Za-z_,+-.]*@[0-9A-Fa-f]* \\[m\/s\\^2\\]: \ + \\(\\s*-?[0-9\\.]*,\\s*-?[0-9\\.]*,\\s*-?[0-9\\.]*\\)$" + extra_args: + - SHIELD=eval_adxl362_ardz + - EXTRA_CONF_FILE=adxl362-trigger.conf + - SNIPPET=rtt-tracing;rtt-console + platform_allow: + - apard32690/max32690/m4 From 2ea25ea238e0cdb2d948f59bf24fa3a26bfd7f4b Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Wed, 16 Oct 2024 23:39:40 +0530 Subject: [PATCH 1827/4482] drivers: nrfwifi: Fix regulatory domain regression Recent WPA supplicant changes have broken nRF regulatory support, implement the new set/get country WPA supplicant ops. WPA supplicant: Regulatory SET through WPA supplicant, GET is direct to the driver Scan only: SET and GET direct calls to the driver Fixes #79916. Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/inc/wpa_supp_if.h | 2 + drivers/wifi/nrfwifi/src/fmac_main.c | 77 +++++++++++--------------- drivers/wifi/nrfwifi/src/wpa_supp_if.c | 73 ++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 46 deletions(-) diff --git a/drivers/wifi/nrfwifi/inc/wpa_supp_if.h b/drivers/wifi/nrfwifi/inc/wpa_supp_if.h index 06a13261a706a..c543644e31283 100644 --- a/drivers/wifi/nrfwifi/inc/wpa_supp_if.h +++ b/drivers/wifi/nrfwifi/inc/wpa_supp_if.h @@ -123,6 +123,8 @@ int nrf_wifi_supp_get_conn_info(void *if_priv, struct wpa_conn_info *info); void nrf_wifi_supp_event_proc_get_conn_info(void *os_vif_ctx, struct nrf_wifi_umac_event_conn_info *info, unsigned int event_len); +int nrf_wifi_supp_set_country(void *if_priv, const char *alpha2); +int nrf_wifi_supp_get_country(void *if_priv, char *alpha2); #endif /* CONFIG_NRF70_STA_MODE */ #ifdef CONFIG_NRF70_AP_MODE diff --git a/drivers/wifi/nrfwifi/src/fmac_main.c b/drivers/wifi/nrfwifi/src/fmac_main.c index f2f7ba4134071..eb67e15680009 100644 --- a/drivers/wifi/nrfwifi/src/fmac_main.c +++ b/drivers/wifi/nrfwifi/src/fmac_main.c @@ -343,28 +343,8 @@ int nrf_wifi_reg_domain(const struct device *dev, struct wifi_reg_domain *reg_do goto err; } +#ifdef CONFIG_NRF70_SCAN_ONLY if (reg_domain->oper == WIFI_MGMT_SET) { -#ifndef CONFIG_NRF70_RADIO_TEST -#ifdef CONFIG_NRF70_STA_MODE - /* Need to check if WPA supplicant is initialized or not. - * Must be checked when CONFIG_WIFI_NM_WPA_SUPPLICANT is enabled. - * Not applicable for RADIO_TEST or when - * CONFIG_WIFI_NM_WPA_SUPPLICANT is not enabled. - */ - /* It is possbile that during supplicant initialization driver may - * get the command. lock will try to ensure that supplicant - * initialization is complete. - */ - k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); - if ((!vif_ctx_zep->supp_drv_if_ctx) || - (!wifi_nm_get_instance_iface(vif_ctx_zep->zep_net_if_ctx))) { - LOG_ERR("%s: WPA supplicant initialization not complete yet", __func__); - k_mutex_unlock(&vif_ctx_zep->vif_lock); - goto err; - } - k_mutex_unlock(&vif_ctx_zep->vif_lock); -#endif /* CONFIG_NRF70_STA_MODE */ -#endif /* !CONFIG_NRF70_RADIO_TEST */ memcpy(reg_domain_info.alpha2, reg_domain->country_code, WIFI_COUNTRY_CODE_LEN); reg_domain_info.force = reg_domain->force; @@ -374,36 +354,39 @@ int nrf_wifi_reg_domain(const struct device *dev, struct wifi_reg_domain *reg_do LOG_ERR("%s: Failed to set regulatory domain", __func__); goto err; } - } else if (reg_domain->oper == WIFI_MGMT_GET) { - if (!reg_domain->chan_info) { - LOG_ERR("%s: Invalid regulatory info (NULL)\n", __func__); - goto err; - } + goto err; + } +#endif + if (reg_domain->oper != WIFI_MGMT_GET) { + LOG_ERR("%s: Invalid operation: %d", __func__, reg_domain->oper); + goto err; + } - status = nrf_wifi_fmac_get_reg(fmac_dev_ctx, ®_domain_info); - if (status != NRF_WIFI_STATUS_SUCCESS) { - LOG_ERR("%s: Failed to get regulatory domain", __func__); - goto err; - } + if (!reg_domain->chan_info) { + LOG_ERR("%s: Invalid regulatory info (NULL)\n", __func__); + goto err; + } - memcpy(reg_domain->country_code, reg_domain_info.alpha2, WIFI_COUNTRY_CODE_LEN); - reg_domain->num_channels = reg_domain_info.reg_chan_count; - - for (chan_idx = 0; chan_idx < reg_domain_info.reg_chan_count; chan_idx++) { - chan_info = &(reg_domain->chan_info[chan_idx]); - reg_domain_chan_info = &(reg_domain_info.reg_chan_info[chan_idx]); - chan_info->center_frequency = reg_domain_chan_info->center_frequency; - chan_info->dfs = !!reg_domain_chan_info->dfs; - chan_info->max_power = reg_domain_chan_info->max_power; - chan_info->passive_only = !!reg_domain_chan_info->passive_channel; - chan_info->supported = !!reg_domain_chan_info->supported; - } - } else { - LOG_ERR("%s: Invalid operation: %d", __func__, reg_domain->oper); + status = nrf_wifi_fmac_get_reg(fmac_dev_ctx, ®_domain_info); + if (status != NRF_WIFI_STATUS_SUCCESS) { + LOG_ERR("%s: Failed to get regulatory domain", __func__); goto err; } + memcpy(reg_domain->country_code, reg_domain_info.alpha2, WIFI_COUNTRY_CODE_LEN); + reg_domain->num_channels = reg_domain_info.reg_chan_count; + + for (chan_idx = 0; chan_idx < reg_domain_info.reg_chan_count; chan_idx++) { + chan_info = &(reg_domain->chan_info[chan_idx]); + reg_domain_chan_info = &(reg_domain_info.reg_chan_info[chan_idx]); + chan_info->center_frequency = reg_domain_chan_info->center_frequency; + chan_info->dfs = !!reg_domain_chan_info->dfs; + chan_info->max_power = reg_domain_chan_info->max_power; + chan_info->passive_only = !!reg_domain_chan_info->passive_channel; + chan_info->supported = !!reg_domain_chan_info->supported; + } + ret = 0; err: k_mutex_unlock(®_lock); @@ -850,7 +833,7 @@ static struct wifi_mgmt_ops nrf_wifi_mgmt_ops = { .get_power_save_config = nrf_wifi_get_power_save_config, .set_rts_threshold = nrf_wifi_set_rts_threshold, .get_rts_threshold = nrf_wifi_get_rts_threshold, -#endif /* CONFIG_NRF70_STA_MODE */ +#endif #ifdef CONFIG_NRF70_SYSTEM_WITH_RAW_MODES .mode = nrf_wifi_mode, #endif @@ -883,6 +866,8 @@ static struct zep_wpa_supp_dev_ops wpa_supp_ops = { .register_frame = nrf_wifi_supp_register_frame, .get_capa = nrf_wifi_supp_get_capa, .get_conn_info = nrf_wifi_supp_get_conn_info, + .set_country = nrf_wifi_supp_set_country, + .get_country = nrf_wifi_supp_get_country, #ifdef CONFIG_NRF70_AP_MODE .init_ap = nrf_wifi_wpa_supp_init_ap, .start_ap = nrf_wifi_wpa_supp_start_ap, diff --git a/drivers/wifi/nrfwifi/src/wpa_supp_if.c b/drivers/wifi/nrfwifi/src/wpa_supp_if.c index b022c8d5af19e..292c1b9117a6d 100644 --- a/drivers/wifi/nrfwifi/src/wpa_supp_if.c +++ b/drivers/wifi/nrfwifi/src/wpa_supp_if.c @@ -1861,6 +1861,79 @@ int nrf_wifi_supp_get_conn_info(void *if_priv, struct wpa_conn_info *info) return ret; } +int nrf_wifi_supp_set_country(void *if_priv, const char *alpha2) +{ + struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; + struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; + enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; + struct nrf_wifi_fmac_reg_info reg_domain_info = {0}; + + if (!if_priv || !alpha2) { + LOG_ERR("%s: Invalid params", __func__); + return -1; + } + + vif_ctx_zep = if_priv; + rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; + if (!rpu_ctx_zep) { + LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); + return -1; + } + + k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); + if (!rpu_ctx_zep->rpu_ctx) { + LOG_DBG("%s: RPU context not initialized", __func__); + goto out; + } + + memcpy(reg_domain_info.alpha2, alpha2, NRF_WIFI_COUNTRY_CODE_LEN); + + status = nrf_wifi_fmac_set_reg(rpu_ctx_zep->rpu_ctx, ®_domain_info); + if (status != NRF_WIFI_STATUS_SUCCESS) { + LOG_ERR("%s: nrf_wifi_fmac_set_reg failed", __func__); + goto out; + } +out: + k_mutex_unlock(&vif_ctx_zep->vif_lock); + return status; +} + +int nrf_wifi_supp_get_country(void *if_priv, char *alpha2) +{ + struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL; + struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL; + enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL; + struct nrf_wifi_fmac_reg_info reg_domain_info = {0}; + + if (!if_priv || !alpha2) { + LOG_ERR("%s: Invalid params", __func__); + return -1; + } + + vif_ctx_zep = if_priv; + rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; + if (!rpu_ctx_zep) { + LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); + return -1; + } + + k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER); + if (!rpu_ctx_zep->rpu_ctx) { + LOG_DBG("%s: RPU context not initialized", __func__); + goto out; + } + + status = nrf_wifi_fmac_get_reg(rpu_ctx_zep->rpu_ctx, ®_domain_info); + if (status != NRF_WIFI_STATUS_SUCCESS) { + LOG_ERR("%s: nrf_wifi_fmac_get_reg failed", __func__); + goto out; + } + + memcpy(alpha2, reg_domain_info.alpha2, NRF_WIFI_COUNTRY_CODE_LEN); +out: + k_mutex_unlock(&vif_ctx_zep->vif_lock); + return status; +} void nrf_wifi_supp_event_proc_get_conn_info(void *if_priv, struct nrf_wifi_umac_event_conn_info *info, From 7d696f5b69f02909337699ac3828a2fbe4571923 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 17 Oct 2024 00:34:21 +0530 Subject: [PATCH 1828/4482] drivers: nrfwifi: Fix label name The label is used for both positive and negative cases, so, should be called "out". Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/src/fmac_main.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/wifi/nrfwifi/src/fmac_main.c b/drivers/wifi/nrfwifi/src/fmac_main.c index eb67e15680009..470be6c805578 100644 --- a/drivers/wifi/nrfwifi/src/fmac_main.c +++ b/drivers/wifi/nrfwifi/src/fmac_main.c @@ -320,27 +320,27 @@ int nrf_wifi_reg_domain(const struct device *dev, struct wifi_reg_domain *reg_do k_mutex_lock(®_lock, K_FOREVER); if (!dev || !reg_domain) { - goto err; + goto out; } vif_ctx_zep = dev->data; if (!vif_ctx_zep) { LOG_ERR("%s: vif_ctx_zep is NULL", __func__); - goto err; + goto out; } rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep; if (!rpu_ctx_zep) { LOG_ERR("%s: rpu_ctx_zep is NULL", __func__); - goto err; + goto out; } fmac_dev_ctx = rpu_ctx_zep->rpu_ctx; if (!fmac_dev_ctx) { LOG_ERR("%s: fmac_dev_ctx is NULL", __func__); - goto err; + goto out; } #ifdef CONFIG_NRF70_SCAN_ONLY @@ -352,26 +352,26 @@ int nrf_wifi_reg_domain(const struct device *dev, struct wifi_reg_domain *reg_do status = nrf_wifi_fmac_set_reg(fmac_dev_ctx, ®_domain_info); if (status != NRF_WIFI_STATUS_SUCCESS) { LOG_ERR("%s: Failed to set regulatory domain", __func__); - goto err; + goto out; } - goto err; + goto out; } #endif if (reg_domain->oper != WIFI_MGMT_GET) { LOG_ERR("%s: Invalid operation: %d", __func__, reg_domain->oper); - goto err; + goto out; } if (!reg_domain->chan_info) { LOG_ERR("%s: Invalid regulatory info (NULL)\n", __func__); - goto err; + goto out; } status = nrf_wifi_fmac_get_reg(fmac_dev_ctx, ®_domain_info); if (status != NRF_WIFI_STATUS_SUCCESS) { LOG_ERR("%s: Failed to get regulatory domain", __func__); - goto err; + goto out; } memcpy(reg_domain->country_code, reg_domain_info.alpha2, WIFI_COUNTRY_CODE_LEN); @@ -388,7 +388,7 @@ int nrf_wifi_reg_domain(const struct device *dev, struct wifi_reg_domain *reg_do } ret = 0; -err: +out: k_mutex_unlock(®_lock); return ret; } From d33b8f63147afed44a4fa91c4fef2523af805ce9 Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Mon, 14 Oct 2024 15:47:02 -0300 Subject: [PATCH 1829/4482] drivers: counter: rtc: esp32: Limit minimum time for set_alarm Include value of 30 us as not valid to set alarm for RTC counter. Change included to allow RTC timer to be properly set to use RC_FAST_D256 as clock source. Signed-off-by: Raffael Rostagno --- drivers/counter/counter_esp32_rtc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/counter/counter_esp32_rtc.c b/drivers/counter/counter_esp32_rtc.c index 2438819baae55..c9c4ac9509b5d 100644 --- a/drivers/counter/counter_esp32_rtc.c +++ b/drivers/counter/counter_esp32_rtc.c @@ -116,8 +116,8 @@ static int counter_esp32_set_alarm(const struct device *dev, uint8_t chan_id, #if defined(CONFIG_SOC_SERIES_ESP32) || defined(CONFIG_SOC_SERIES_ESP32C2) || \ defined(CONFIG_SOC_SERIES_ESP32C3) - /* In ESP32/C3 Series the min possible value is 30 us*/ - if (counter_ticks_to_us(dev, alarm_cfg->ticks) < 30) { + /* In ESP32/C3 Series the min possible value is 30+ us*/ + if (counter_ticks_to_us(dev, alarm_cfg->ticks) <= 30) { return -EINVAL; } #endif From 891b946bc684b3495b6b3d8235c8cc983424d6e4 Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Mon, 14 Oct 2024 11:41:12 -0300 Subject: [PATCH 1830/4482] tests: counter: rtc: Change clock source for precision Clock source is changed from RC_SLOW to RC_FAST_D256 in order to improve clock precision and avoid tests failing due to lower precision of RC clock (around 10%). Signed-off-by: Raffael Rostagno --- .../boards/esp32_devkitc_wroom_procpu.overlay | 4 ++++ .../boards/esp32_devkitc_wrover_procpu.overlay | 4 ++++ .../counter_basic_api/boards/esp32s2_saola.overlay | 4 ++++ .../boards/esp32s3_devkitm_procpu.overlay | 8 ++++++++ .../boards/esp32s3_luatos_core_procpu.overlay | 4 ++++ .../boards/esp32s3_luatos_core_procpu_usb.overlay | 4 ++++ .../counter/counter_basic_api/socs/esp32c2.overlay | 4 ++++ .../counter/counter_basic_api/socs/esp32c3.overlay | 4 ++++ 8 files changed, 36 insertions(+) diff --git a/tests/drivers/counter/counter_basic_api/boards/esp32_devkitc_wroom_procpu.overlay b/tests/drivers/counter/counter_basic_api/boards/esp32_devkitc_wroom_procpu.overlay index 241947b06437b..b5ba7f5739852 100644 --- a/tests/drivers/counter/counter_basic_api/boards/esp32_devkitc_wroom_procpu.overlay +++ b/tests/drivers/counter/counter_basic_api/boards/esp32_devkitc_wroom_procpu.overlay @@ -1,3 +1,7 @@ &timer0 { status = "okay"; }; + +&rtc { + slow-clk-src = ; +}; diff --git a/tests/drivers/counter/counter_basic_api/boards/esp32_devkitc_wrover_procpu.overlay b/tests/drivers/counter/counter_basic_api/boards/esp32_devkitc_wrover_procpu.overlay index 241947b06437b..b5ba7f5739852 100644 --- a/tests/drivers/counter/counter_basic_api/boards/esp32_devkitc_wrover_procpu.overlay +++ b/tests/drivers/counter/counter_basic_api/boards/esp32_devkitc_wrover_procpu.overlay @@ -1,3 +1,7 @@ &timer0 { status = "okay"; }; + +&rtc { + slow-clk-src = ; +}; diff --git a/tests/drivers/counter/counter_basic_api/boards/esp32s2_saola.overlay b/tests/drivers/counter/counter_basic_api/boards/esp32s2_saola.overlay index 241947b06437b..b5ba7f5739852 100644 --- a/tests/drivers/counter/counter_basic_api/boards/esp32s2_saola.overlay +++ b/tests/drivers/counter/counter_basic_api/boards/esp32s2_saola.overlay @@ -1,3 +1,7 @@ &timer0 { status = "okay"; }; + +&rtc { + slow-clk-src = ; +}; diff --git a/tests/drivers/counter/counter_basic_api/boards/esp32s3_devkitm_procpu.overlay b/tests/drivers/counter/counter_basic_api/boards/esp32s3_devkitm_procpu.overlay index 2b3ef4f24cae6..7f34bf353a981 100644 --- a/tests/drivers/counter/counter_basic_api/boards/esp32s3_devkitm_procpu.overlay +++ b/tests/drivers/counter/counter_basic_api/boards/esp32s3_devkitm_procpu.overlay @@ -1,3 +1,11 @@ &timer3 { status = "okay"; }; + +&rtc_timer { + status = "okay"; +}; + +&rtc { + slow-clk-src = ; +}; diff --git a/tests/drivers/counter/counter_basic_api/boards/esp32s3_luatos_core_procpu.overlay b/tests/drivers/counter/counter_basic_api/boards/esp32s3_luatos_core_procpu.overlay index 2b3ef4f24cae6..330d9906ec94f 100644 --- a/tests/drivers/counter/counter_basic_api/boards/esp32s3_luatos_core_procpu.overlay +++ b/tests/drivers/counter/counter_basic_api/boards/esp32s3_luatos_core_procpu.overlay @@ -1,3 +1,7 @@ &timer3 { status = "okay"; }; + +&rtc { + slow-clk-src = ; +}; diff --git a/tests/drivers/counter/counter_basic_api/boards/esp32s3_luatos_core_procpu_usb.overlay b/tests/drivers/counter/counter_basic_api/boards/esp32s3_luatos_core_procpu_usb.overlay index 2b3ef4f24cae6..330d9906ec94f 100644 --- a/tests/drivers/counter/counter_basic_api/boards/esp32s3_luatos_core_procpu_usb.overlay +++ b/tests/drivers/counter/counter_basic_api/boards/esp32s3_luatos_core_procpu_usb.overlay @@ -1,3 +1,7 @@ &timer3 { status = "okay"; }; + +&rtc { + slow-clk-src = ; +}; diff --git a/tests/drivers/counter/counter_basic_api/socs/esp32c2.overlay b/tests/drivers/counter/counter_basic_api/socs/esp32c2.overlay index 0fcefc4d15c27..507724fbce45c 100644 --- a/tests/drivers/counter/counter_basic_api/socs/esp32c2.overlay +++ b/tests/drivers/counter/counter_basic_api/socs/esp32c2.overlay @@ -5,3 +5,7 @@ &rtc_timer { status = "okay"; }; + +&rtc { + slow-clk-src = ; +}; diff --git a/tests/drivers/counter/counter_basic_api/socs/esp32c3.overlay b/tests/drivers/counter/counter_basic_api/socs/esp32c3.overlay index 241947b06437b..b5ba7f5739852 100644 --- a/tests/drivers/counter/counter_basic_api/socs/esp32c3.overlay +++ b/tests/drivers/counter/counter_basic_api/socs/esp32c3.overlay @@ -1,3 +1,7 @@ &timer0 { status = "okay"; }; + +&rtc { + slow-clk-src = ; +}; From 5e3fe2765aee5c59e4fa36813bbee6b03a50c238 Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Fri, 25 Oct 2024 09:33:43 -0300 Subject: [PATCH 1831/4482] tests: counter: overlays: Files cleanup Moving overlay files from boards to socs as cleanup of redundant configs. Signed-off-by: Raffael Rostagno --- .../counter/counter_basic_api/boards/esp32s2_saola.overlay | 7 ------- .../boards/esp32s3_luatos_core_procpu.overlay | 7 ------- .../boards/esp32s3_luatos_core_procpu_usb.overlay | 7 ------- .../esp32_procpu.overlay} | 0 .../esp32s2.overlay} | 0 .../esp32s3_procpu.overlay} | 0 6 files changed, 21 deletions(-) delete mode 100644 tests/drivers/counter/counter_basic_api/boards/esp32s2_saola.overlay delete mode 100644 tests/drivers/counter/counter_basic_api/boards/esp32s3_luatos_core_procpu.overlay delete mode 100644 tests/drivers/counter/counter_basic_api/boards/esp32s3_luatos_core_procpu_usb.overlay rename tests/drivers/counter/counter_basic_api/{boards/esp32_devkitc_wroom_procpu.overlay => socs/esp32_procpu.overlay} (100%) rename tests/drivers/counter/counter_basic_api/{boards/esp32_devkitc_wrover_procpu.overlay => socs/esp32s2.overlay} (100%) rename tests/drivers/counter/counter_basic_api/{boards/esp32s3_devkitm_procpu.overlay => socs/esp32s3_procpu.overlay} (100%) diff --git a/tests/drivers/counter/counter_basic_api/boards/esp32s2_saola.overlay b/tests/drivers/counter/counter_basic_api/boards/esp32s2_saola.overlay deleted file mode 100644 index b5ba7f5739852..0000000000000 --- a/tests/drivers/counter/counter_basic_api/boards/esp32s2_saola.overlay +++ /dev/null @@ -1,7 +0,0 @@ -&timer0 { - status = "okay"; -}; - -&rtc { - slow-clk-src = ; -}; diff --git a/tests/drivers/counter/counter_basic_api/boards/esp32s3_luatos_core_procpu.overlay b/tests/drivers/counter/counter_basic_api/boards/esp32s3_luatos_core_procpu.overlay deleted file mode 100644 index 330d9906ec94f..0000000000000 --- a/tests/drivers/counter/counter_basic_api/boards/esp32s3_luatos_core_procpu.overlay +++ /dev/null @@ -1,7 +0,0 @@ -&timer3 { - status = "okay"; -}; - -&rtc { - slow-clk-src = ; -}; diff --git a/tests/drivers/counter/counter_basic_api/boards/esp32s3_luatos_core_procpu_usb.overlay b/tests/drivers/counter/counter_basic_api/boards/esp32s3_luatos_core_procpu_usb.overlay deleted file mode 100644 index 330d9906ec94f..0000000000000 --- a/tests/drivers/counter/counter_basic_api/boards/esp32s3_luatos_core_procpu_usb.overlay +++ /dev/null @@ -1,7 +0,0 @@ -&timer3 { - status = "okay"; -}; - -&rtc { - slow-clk-src = ; -}; diff --git a/tests/drivers/counter/counter_basic_api/boards/esp32_devkitc_wroom_procpu.overlay b/tests/drivers/counter/counter_basic_api/socs/esp32_procpu.overlay similarity index 100% rename from tests/drivers/counter/counter_basic_api/boards/esp32_devkitc_wroom_procpu.overlay rename to tests/drivers/counter/counter_basic_api/socs/esp32_procpu.overlay diff --git a/tests/drivers/counter/counter_basic_api/boards/esp32_devkitc_wrover_procpu.overlay b/tests/drivers/counter/counter_basic_api/socs/esp32s2.overlay similarity index 100% rename from tests/drivers/counter/counter_basic_api/boards/esp32_devkitc_wrover_procpu.overlay rename to tests/drivers/counter/counter_basic_api/socs/esp32s2.overlay diff --git a/tests/drivers/counter/counter_basic_api/boards/esp32s3_devkitm_procpu.overlay b/tests/drivers/counter/counter_basic_api/socs/esp32s3_procpu.overlay similarity index 100% rename from tests/drivers/counter/counter_basic_api/boards/esp32s3_devkitm_procpu.overlay rename to tests/drivers/counter/counter_basic_api/socs/esp32s3_procpu.overlay From abca729367fdf49d26899a712410c3ac6d6ee31d Mon Sep 17 00:00:00 2001 From: Bill Waters Date: Thu, 26 Sep 2024 07:24:06 -0700 Subject: [PATCH 1832/4482] driver: pwm: infineon: cyw920829m2evk_02 pwm - Enable PWM for the cyw920829m2evk_02 board Signed-off-by: Bill Waters --- .../cyw920829m2evk_02/cyw920829m2evk_02.yaml | 2 + drivers/pwm/CMakeLists.txt | 1 + drivers/pwm/Kconfig | 2 + drivers/pwm/Kconfig.ifx_cat1 | 16 ++ drivers/pwm/pwm_ifx_cat1.c | 177 ++++++++++++++++++ .../cat1b/cyw20829/cyw20829.40-qfn.dtsi | 105 +++++++++++ .../cat1b/cyw20829/cyw20829.56-qfn.dtsi | 106 ++++++++++- .../cat1b/cyw20829/cyw20829.77-bga.dtsi | 105 +++++++++++ dts/arm/infineon/cat1b/cyw20829/cyw20829.dtsi | 9 + dts/bindings/pwm/infineon,cat1-pwm.yaml | 70 +++++++ include/zephyr/dt-bindings/pwm/pwm_ifx_cat1.h | 11 ++ modules/hal_infineon/Kconfig | 3 +- .../hal_infineon/mtb-hal-cat1/CMakeLists.txt | 1 - .../hal_infineon/mtb-pdl-cat1/CMakeLists.txt | 6 + .../fade_led/boards/cyw920829m2evk_02.overlay | 39 ++++ 15 files changed, 649 insertions(+), 4 deletions(-) create mode 100644 drivers/pwm/Kconfig.ifx_cat1 create mode 100644 drivers/pwm/pwm_ifx_cat1.c create mode 100644 dts/bindings/pwm/infineon,cat1-pwm.yaml create mode 100644 include/zephyr/dt-bindings/pwm/pwm_ifx_cat1.h create mode 100644 samples/basic/fade_led/boards/cyw920829m2evk_02.overlay diff --git a/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02.yaml b/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02.yaml index 5292dd06cef51..9d83de725c0f9 100644 --- a/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02.yaml +++ b/boards/infineon/cyw920829m2evk_02/cyw920829m2evk_02.yaml @@ -21,5 +21,7 @@ supported: - spi - i2c - rtc + - dma + - pwm vendor: infineon diff --git a/drivers/pwm/CMakeLists.txt b/drivers/pwm/CMakeLists.txt index dbf59444e7e42..e5d9b622c5b20 100644 --- a/drivers/pwm/CMakeLists.txt +++ b/drivers/pwm/CMakeLists.txt @@ -45,6 +45,7 @@ zephyr_library_sources_ifdef(CONFIG_PWM_NXP_FLEXIO pwm_nxp_flexio.c) zephyr_library_sources_ifdef(CONFIG_PWM_NXP_S32_EMIOS pwm_nxp_s32_emios.c) zephyr_library_sources_ifdef(CONFIG_PWM_ENE_KB1200 pwm_ene_kb1200.c) zephyr_library_sources_ifdef(CONFIG_PWM_RENESAS_RA8 pwm_renesas_ra8.c) +zephyr_library_sources_ifdef(CONFIG_PWM_INFINEON_CAT1 pwm_ifx_cat1.c) zephyr_library_sources_ifdef(CONFIG_USERSPACE pwm_handlers.c) zephyr_library_sources_ifdef(CONFIG_PWM_CAPTURE pwm_capture.c) diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig index 53562f238239a..a97fc36588696 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig @@ -110,4 +110,6 @@ source "drivers/pwm/Kconfig.ene" source "drivers/pwm/Kconfig.renesas_ra8" +source "drivers/pwm/Kconfig.ifx_cat1" + endif # PWM diff --git a/drivers/pwm/Kconfig.ifx_cat1 b/drivers/pwm/Kconfig.ifx_cat1 new file mode 100644 index 0000000000000..d8c12ac411f85 --- /dev/null +++ b/drivers/pwm/Kconfig.ifx_cat1 @@ -0,0 +1,16 @@ +# Infineon CAT1 PWM configuration options + +# Copyright (c) 2024 Cypress Semiconductor Corporation (an Infineon company) or +# an affiliate of Cypress Semiconductor Corporation +# +# SPDX-License-Identifier: Apache-2.0 + +config PWM_INFINEON_CAT1 + bool "Infineon CAT1 PWM driver" + default y + depends on DT_HAS_INFINEON_CAT1_PWM_ENABLED + depends on SOC_FAMILY_INFINEON_CAT1B + select USE_INFINEON_PWM + select PINCTRL + help + This option enables the PWM driver for Infineon CAT1 family. diff --git a/drivers/pwm/pwm_ifx_cat1.c b/drivers/pwm/pwm_ifx_cat1.c new file mode 100644 index 0000000000000..c6aa8ae57b0e9 --- /dev/null +++ b/drivers/pwm/pwm_ifx_cat1.c @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2023 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @brief ADC driver for Infineon CAT1 MCU family. + */ + +#define DT_DRV_COMPAT infineon_cat1_pwm + +#include +#include + +#include +#include +#include +#include +#include + +#include +LOG_MODULE_REGISTER(pwm_ifx_cat1, CONFIG_PWM_LOG_LEVEL); + +#define PWM_REG_BASE TCPWM0 + +struct ifx_cat1_pwm_data { + uint32_t pwm_num; +}; + +struct ifx_cat1_pwm_config { + TCPWM_GRP_CNT_Type *reg_addr; + const struct pinctrl_dev_config *pcfg; + bool resolution_32_bits; + cy_en_divider_types_t divider_type; + uint32_t divider_sel; + uint32_t divider_val; +}; + +static int ifx_cat1_pwm_init(const struct device *dev) +{ + struct ifx_cat1_pwm_data *data = dev->data; + const struct ifx_cat1_pwm_config *config = dev->config; + cy_en_tcpwm_status_t status; + int ret; + uint32_t addr_offset = (uint32_t)config->reg_addr - TCPWM0_BASE; + uint32_t clk_connection; + + const cy_stc_tcpwm_pwm_config_t pwm_config = { + .pwmMode = CY_TCPWM_PWM_MODE_PWM, + .clockPrescaler = CY_TCPWM_PWM_PRESCALER_DIVBY_1, + .pwmAlignment = CY_TCPWM_PWM_LEFT_ALIGN, + .runMode = CY_TCPWM_PWM_CONTINUOUS, + .countInputMode = CY_TCPWM_INPUT_LEVEL, + .countInput = CY_TCPWM_INPUT_1, + }; + + /* Configure PWM clock */ + Cy_SysClk_PeriphDisableDivider(config->divider_type, config->divider_sel); + Cy_SysClk_PeriphSetDivider(config->divider_type, config->divider_sel, config->divider_val); + Cy_SysClk_PeriphEnableDivider(config->divider_type, config->divider_sel); + + /* This is very specific to the cyw920829m2evk_02 and may need to be modified + * for other boards. + */ + if (addr_offset < sizeof(TCPWM_GRP_Type)) { + clk_connection = + PCLK_TCPWM0_CLOCK_COUNTER_EN0 + (addr_offset / sizeof(TCPWM_GRP_CNT_Type)); + } else { + addr_offset -= sizeof(TCPWM_GRP_Type); + clk_connection = PCLK_TCPWM0_CLOCK_COUNTER_EN256 + + (addr_offset / sizeof(TCPWM_GRP_CNT_Type)); + } + Cy_SysClk_PeriphAssignDivider(clk_connection, config->divider_type, config->divider_sel); + + ret = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); + if (ret < 0) { + return ret; + } + + /* Configure the TCPWM to be a PWM */ + data->pwm_num += addr_offset / sizeof(TCPWM_GRP_CNT_Type); + status = Cy_TCPWM_PWM_Init(PWM_REG_BASE, data->pwm_num, &pwm_config); + if (status != CY_TCPWM_SUCCESS) { + return -ENOTSUP; + } + + return 0; +} + +static int ifx_cat1_pwm_set_cycles(const struct device *dev, uint32_t channel, + uint32_t period_cycles, uint32_t pulse_cycles, pwm_flags_t flags) +{ + struct ifx_cat1_pwm_data *data = dev->data; + const struct ifx_cat1_pwm_config *config = dev->config; + + if (!config->resolution_32_bits && + ((period_cycles > UINT16_MAX) || (pulse_cycles > UINT16_MAX))) { + /* 16-bit resolution */ + if (period_cycles > UINT16_MAX) { + LOG_ERR("Period cycles more than 16-bits (%u)", period_cycles); + } + if (pulse_cycles > UINT16_MAX) { + LOG_ERR("Pulse cycles more than 16-bits (%u)", pulse_cycles); + } + return -EINVAL; + } + + if ((period_cycles == 0) || (pulse_cycles == 0)) { + Cy_TCPWM_PWM_Disable(PWM_REG_BASE, data->pwm_num); + } else { + Cy_TCPWM_PWM_SetPeriod0(PWM_REG_BASE, data->pwm_num, period_cycles); + Cy_TCPWM_PWM_SetCompare0Val(PWM_REG_BASE, data->pwm_num, pulse_cycles); + + if ((flags & PWM_POLARITY_MASK) == PWM_POLARITY_INVERTED) { + config->reg_addr->CTRL &= ~TCPWM_GRP_CNT_V2_CTRL_QUAD_ENCODING_MODE_Msk; + config->reg_addr->CTRL |= _VAL2FLD(TCPWM_GRP_CNT_V2_CTRL_QUAD_ENCODING_MODE, + CY_TCPWM_PWM_INVERT_ENABLE); + } + + /* TODO: Add 2-bit field to top 8 bits of pwm_flags_t to set this. + * #define CY_TCPWM_PWM_OUTPUT_HIGHZ (0U) + * #define CY_TCPWM_PWM_OUTPUT_RETAIN (1U) + * #define CY_TCPWM_PWM_OUTPUT_LOW (2U) + * #define CY_TCPWM_PWM_OUTPUT_HIGH (3U) + * if ((flags & __) == __) { + * config->reg_addr->CTRL &= ~TCPWM_GRP_CNT_V2_CTRL_PWM_DISABLE_MODE_Msk; + * config->reg_addr->CTRL |= _VAL2FLD(TCPWM_GRP_CNT_V2_CTRL_PWM_DISABLE_MODE, + * __); + * } + */ + + /* Enable the TCPWM for PWM mode of operation */ + Cy_TCPWM_PWM_Enable(PWM_REG_BASE, data->pwm_num); + + /* Start the TCPWM block */ + Cy_TCPWM_TriggerStart_Single(PWM_REG_BASE, data->pwm_num); + } + + return 0; +} + +static int ifx_cat1_pwm_get_cycles_per_sec(const struct device *dev, uint32_t channel, + uint64_t *cycles) +{ + const struct ifx_cat1_pwm_config *config = dev->config; + + *cycles = Cy_SysClk_PeriphGetFrequency(config->divider_type, config->divider_sel); + + return 0; +} + +static const struct pwm_driver_api ifx_cat1_pwm_api = { + .set_cycles = ifx_cat1_pwm_set_cycles, + .get_cycles_per_sec = ifx_cat1_pwm_get_cycles_per_sec, +}; + +#define INFINEON_CAT1_PWM_INIT(n) \ + PINCTRL_DT_INST_DEFINE(n); \ + \ + static struct ifx_cat1_pwm_data pwm_cat1_data_##n; \ + \ + static struct ifx_cat1_pwm_config pwm_cat1_config_##n = { \ + .reg_addr = (TCPWM_GRP_CNT_Type *)DT_INST_REG_ADDR(n), \ + .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ + .resolution_32_bits = (DT_INST_PROP(n, resolution) == 32) ? true : false, \ + .divider_type = DT_INST_PROP(n, divider_type), \ + .divider_sel = DT_INST_PROP(n, divider_sel), \ + .divider_val = DT_INST_PROP(n, divider_val), \ + }; \ + \ + DEVICE_DT_INST_DEFINE(n, ifx_cat1_pwm_init, NULL, &pwm_cat1_data_##n, \ + &pwm_cat1_config_##n, POST_KERNEL, CONFIG_PWM_INIT_PRIORITY, \ + &ifx_cat1_pwm_api); + +DT_INST_FOREACH_STATUS_OKAY(INFINEON_CAT1_PWM_INIT) diff --git a/dts/arm/infineon/cat1b/cyw20829/cyw20829.40-qfn.dtsi b/dts/arm/infineon/cat1b/cyw20829/cyw20829.40-qfn.dtsi index aff1340f79712..62bcb7b3a460c 100644 --- a/dts/arm/infineon/cat1b/cyw20829/cyw20829.40-qfn.dtsi +++ b/dts/arm/infineon/cat1b/cyw20829/cyw20829.40-qfn.dtsi @@ -188,6 +188,111 @@ pinmux = ; }; + /* PWM group 0 */ + /omit-if-no-ref/ p0_1_pwm0_1: p0_1_pwm0_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p0_3_pwm0_0: p0_3_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p0_5_pwm0_1: p0_5_pwm0_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p1_1_pwm0_0: p1_1_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p1_3_pwm0_1: p1_3_pwm0_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p1_5_pwm0_0: p1_5_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_0_pwm0_0: p3_0_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_2_pwm0_1: p3_2_pwm0_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_4_pwm0_0: p3_4_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_6_pwm0_1: p3_6_pwm0_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p4_1_pwm0_0: p4_1_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p5_0_pwm0_0: p5_0_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p5_2_pwm0_1: p5_2_pwm0_1 { + pinmux = ; + }; + + /* PWM group 1 */ + /omit-if-no-ref/ p0_1_pwm1_0: p0_1_pwm1_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p0_3_pwm1_1: p0_3_pwm1_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p0_5_pwm1_2: p0_5_pwm1_2 { + pinmux = ; + }; + + /omit-if-no-ref/ p1_1_pwm1_3: p1_1_pwm1_3 { + pinmux = ; + }; + + /omit-if-no-ref/ p1_3_pwm1_4: p1_3_pwm1_4 { + pinmux = ; + }; + + /omit-if-no-ref/ p1_5_pwm1_5: p1_5_pwm1_5 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_0_pwm1_0: p3_0_pwm1_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_2_pwm1_1: p3_2_pwm1_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_4_pwm1_2: p3_4_pwm1_2 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_6_pwm1_3: p3_6_pwm1_3 { + pinmux = ; + }; + + /omit-if-no-ref/ p4_1_pwm1_6: p4_1_pwm1_6 { + pinmux = ; + }; + + /omit-if-no-ref/ p5_0_pwm1_4: p5_0_pwm1_4 { + pinmux = ; + }; + + /omit-if-no-ref/ p5_2_pwm1_5: p5_2_pwm1_5 { + pinmux = ; + }; }; }; }; diff --git a/dts/arm/infineon/cat1b/cyw20829/cyw20829.56-qfn.dtsi b/dts/arm/infineon/cat1b/cyw20829/cyw20829.56-qfn.dtsi index a94c9744b9e9d..9a548a094e729 100644 --- a/dts/arm/infineon/cat1b/cyw20829/cyw20829.56-qfn.dtsi +++ b/dts/arm/infineon/cat1b/cyw20829/cyw20829.56-qfn.dtsi @@ -10,7 +10,6 @@ #include "cyw20829.dtsi" / { - soc { pinctrl: pinctrl@40400000 { @@ -252,6 +251,111 @@ pinmux = ; }; + /* PWM group 0 */ + /omit-if-no-ref/ p0_1_pwm0_1: p0_1_pwm0_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p0_3_pwm0_0: p0_3_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p0_5_pwm0_1: p0_5_pwm0_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p1_1_pwm0_0: p1_1_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p1_3_pwm0_1: p1_3_pwm0_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p1_5_pwm0_0: p1_5_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_0_pwm0_0: p3_0_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_2_pwm0_1: p3_2_pwm0_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_4_pwm0_0: p3_4_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_6_pwm0_1: p3_6_pwm0_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p4_1_pwm0_0: p4_1_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p5_0_pwm0_0: p5_0_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p5_2_pwm0_1: p5_2_pwm0_1 { + pinmux = ; + }; + + /* PWM group 1 */ + /omit-if-no-ref/ p0_1_pwm1_0: p0_1_pwm1_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p0_3_pwm1_1: p0_3_pwm1_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p0_5_pwm1_2: p0_5_pwm1_2 { + pinmux = ; + }; + + /omit-if-no-ref/ p1_1_pwm1_3: p1_1_pwm1_3 { + pinmux = ; + }; + + /omit-if-no-ref/ p1_3_pwm1_4: p1_3_pwm1_4 { + pinmux = ; + }; + + /omit-if-no-ref/ p1_5_pwm1_5: p1_5_pwm1_5 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_0_pwm1_0: p3_0_pwm1_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_2_pwm1_1: p3_2_pwm1_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_4_pwm1_2: p3_4_pwm1_2 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_6_pwm1_3: p3_6_pwm1_3 { + pinmux = ; + }; + + /omit-if-no-ref/ p4_1_pwm1_6: p4_1_pwm1_6 { + pinmux = ; + }; + + /omit-if-no-ref/ p5_0_pwm1_4: p5_0_pwm1_4 { + pinmux = ; + }; + + /omit-if-no-ref/ p5_2_pwm1_5: p5_2_pwm1_5 { + pinmux = ; + }; }; }; }; diff --git a/dts/arm/infineon/cat1b/cyw20829/cyw20829.77-bga.dtsi b/dts/arm/infineon/cat1b/cyw20829/cyw20829.77-bga.dtsi index 6975188c56167..9a548a094e729 100644 --- a/dts/arm/infineon/cat1b/cyw20829/cyw20829.77-bga.dtsi +++ b/dts/arm/infineon/cat1b/cyw20829/cyw20829.77-bga.dtsi @@ -251,6 +251,111 @@ pinmux = ; }; + /* PWM group 0 */ + /omit-if-no-ref/ p0_1_pwm0_1: p0_1_pwm0_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p0_3_pwm0_0: p0_3_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p0_5_pwm0_1: p0_5_pwm0_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p1_1_pwm0_0: p1_1_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p1_3_pwm0_1: p1_3_pwm0_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p1_5_pwm0_0: p1_5_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_0_pwm0_0: p3_0_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_2_pwm0_1: p3_2_pwm0_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_4_pwm0_0: p3_4_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_6_pwm0_1: p3_6_pwm0_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p4_1_pwm0_0: p4_1_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p5_0_pwm0_0: p5_0_pwm0_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p5_2_pwm0_1: p5_2_pwm0_1 { + pinmux = ; + }; + + /* PWM group 1 */ + /omit-if-no-ref/ p0_1_pwm1_0: p0_1_pwm1_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p0_3_pwm1_1: p0_3_pwm1_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p0_5_pwm1_2: p0_5_pwm1_2 { + pinmux = ; + }; + + /omit-if-no-ref/ p1_1_pwm1_3: p1_1_pwm1_3 { + pinmux = ; + }; + + /omit-if-no-ref/ p1_3_pwm1_4: p1_3_pwm1_4 { + pinmux = ; + }; + + /omit-if-no-ref/ p1_5_pwm1_5: p1_5_pwm1_5 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_0_pwm1_0: p3_0_pwm1_0 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_2_pwm1_1: p3_2_pwm1_1 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_4_pwm1_2: p3_4_pwm1_2 { + pinmux = ; + }; + + /omit-if-no-ref/ p3_6_pwm1_3: p3_6_pwm1_3 { + pinmux = ; + }; + + /omit-if-no-ref/ p4_1_pwm1_6: p4_1_pwm1_6 { + pinmux = ; + }; + + /omit-if-no-ref/ p5_0_pwm1_4: p5_0_pwm1_4 { + pinmux = ; + }; + + /omit-if-no-ref/ p5_2_pwm1_5: p5_2_pwm1_5 { + pinmux = ; + }; }; }; }; diff --git a/dts/arm/infineon/cat1b/cyw20829/cyw20829.dtsi b/dts/arm/infineon/cat1b/cyw20829/cyw20829.dtsi index 8f609c5309c1f..139e8f38e8523 100644 --- a/dts/arm/infineon/cat1b/cyw20829/cyw20829.dtsi +++ b/dts/arm/infineon/cat1b/cyw20829/cyw20829.dtsi @@ -216,6 +216,7 @@ interrupts = <42 4>; resolution = <32>; status = "disabled"; + #pwm-cells = <3>; }; pwm0_1: pwm@404a0080 { compatible = "infineon,cat1-pwm"; @@ -223,6 +224,7 @@ interrupts = <43 4>; resolution = <32>; status = "disabled"; + #pwm-cells = <3>; }; pwm1_0: pwm@404a8000 { compatible = "infineon,cat1-pwm"; @@ -230,6 +232,7 @@ interrupts = <44 4>; resolution = <16>; status = "disabled"; + #pwm-cells = <3>; }; pwm1_1: pwm@404a8080 { compatible = "infineon,cat1-pwm"; @@ -237,6 +240,7 @@ interrupts = <45 4>; resolution = <16>; status = "disabled"; + #pwm-cells = <3>; }; pwm1_2: pwm@404a8100 { compatible = "infineon,cat1-pwm"; @@ -244,6 +248,7 @@ interrupts = <46 4>; resolution = <16>; status = "disabled"; + #pwm-cells = <3>; }; pwm1_3: pwm@404a8180 { compatible = "infineon,cat1-pwm"; @@ -251,6 +256,7 @@ interrupts = <47 4>; resolution = <16>; status = "disabled"; + #pwm-cells = <3>; }; pwm1_4: pwm@404a8200 { compatible = "infineon,cat1-pwm"; @@ -258,6 +264,7 @@ interrupts = <48 4>; resolution = <16>; status = "disabled"; + #pwm-cells = <3>; }; pwm1_5: pwm@404a8280 { compatible = "infineon,cat1-pwm"; @@ -265,6 +272,7 @@ interrupts = <49 4>; resolution = <16>; status = "disabled"; + #pwm-cells = <3>; }; pwm1_6: pwm@404a8300 { compatible = "infineon,cat1-pwm"; @@ -272,6 +280,7 @@ interrupts = <50 4>; resolution = <16>; status = "disabled"; + #pwm-cells = <3>; }; dma0: dw@40180000 { diff --git a/dts/bindings/pwm/infineon,cat1-pwm.yaml b/dts/bindings/pwm/infineon,cat1-pwm.yaml new file mode 100644 index 0000000000000..e00df7136a256 --- /dev/null +++ b/dts/bindings/pwm/infineon,cat1-pwm.yaml @@ -0,0 +1,70 @@ +# Copyright (c) 2024 Cypress Semiconductor Corporation (an Infineon company) or +# an affiliate of Cypress Semiconductor Corporation +# +# SPDX-License-Identifier: Apache-2.0 + +description: Infineon Cat1 PWM + +compatible: "infineon,cat1-pwm" + +include: [pwm-controller.yaml, pinctrl-device.yaml] + +properties: + reg: + type: array + required: true + + interrupts: + type: array + required: true + + pinctrl-0: + description: | + PORT pin configuration for the PWM signal. + We expect that the phandles will reference pinctrl nodes. These + nodes will have a nodelabel that matches the Infineon SoC Pinctrl + defines and have following + format: p___. + + Examples: + pinctrl-0 = <&p1_1_pwm0_0>; + required: true + + pinctrl-names: + required: true + + resolution: + type: int + + divider-type: + type: int + description: | + Specifies which type of divider to use. + Defined by cy_en_divider_types_t in cy_sysclk.h. + required: true + + divider-sel: + type: int + description: | + Specifies which divider of the selected type to configure. + required: true + + divider-val: + type: int + description: | + Causes integer division of (divider value + 1), or division by 1 to 256 + (8-bit divider) or 1 to 65536 (16-bit divider). + required: true + + "#pwm-cells": + const: 3 + description: | + Number of items to expect in a PWM + - channel of the timer used for PWM (not used) + - period to set in ns + - flags: standard flags like PWM_POLARITY_NORMAL + +pwm-cells: + - channel + - period + - flags diff --git a/include/zephyr/dt-bindings/pwm/pwm_ifx_cat1.h b/include/zephyr/dt-bindings/pwm/pwm_ifx_cat1.h new file mode 100644 index 0000000000000..82256c709c1b4 --- /dev/null +++ b/include/zephyr/dt-bindings/pwm/pwm_ifx_cat1.h @@ -0,0 +1,11 @@ +/* Copyright 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * Divider Type + */ +#define CY_SYSCLK_DIV_8_BIT 0 +#define CY_SYSCLK_DIV_16_BIT 1 diff --git a/modules/hal_infineon/Kconfig b/modules/hal_infineon/Kconfig index 7046c48a0fc78..17c2d283ce41d 100644 --- a/modules/hal_infineon/Kconfig +++ b/modules/hal_infineon/Kconfig @@ -66,8 +66,7 @@ config USE_INFINEON_UART config USE_INFINEON_PWM bool help - Enable Pulse Width Modulator (PWM) HAL module - driver for Infineon devices + Enable Pulse Width Modulator (PWM) HAL module driver for Infineon devices config USE_INFINEON_WDT bool diff --git a/modules/hal_infineon/mtb-hal-cat1/CMakeLists.txt b/modules/hal_infineon/mtb-hal-cat1/CMakeLists.txt index e759a471f7921..bff5cb96e66c3 100644 --- a/modules/hal_infineon/mtb-hal-cat1/CMakeLists.txt +++ b/modules/hal_infineon/mtb-hal-cat1/CMakeLists.txt @@ -78,7 +78,6 @@ zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_ADC ${hal_dir}/source/cyhal zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_FLASH ${hal_dir}/source/cyhal_nvm.c) zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_I2C ${hal_dir}/source/cyhal_i2c.c) zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_LPTIMER ${hal_dir}/source/cyhal_lptimer.c) -zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_PWM ${hal_dir}/source/cyhal_pwm.c) zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_RTC ${hal_dir}/source/cyhal_rtc.c) zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_SDIO ${hal_dir}/source/cyhal_sdhc.c) zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_SPI ${hal_dir}/source/cyhal_spi.c) diff --git a/modules/hal_infineon/mtb-pdl-cat1/CMakeLists.txt b/modules/hal_infineon/mtb-pdl-cat1/CMakeLists.txt index ed33a73bfcd91..a7a1155612345 100644 --- a/modules/hal_infineon/mtb-pdl-cat1/CMakeLists.txt +++ b/modules/hal_infineon/mtb-pdl-cat1/CMakeLists.txt @@ -45,6 +45,12 @@ zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_UART ${pdl_drv_dir}/source/ zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_FLASH ${pdl_drv_dir}/source/cy_flash.c) zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_WDT ${pdl_drv_dir}/source/cy_wdt.c) +if(CONFIG_SOC_FAMILY_INFINEON_CAT1B) + zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_ADC ${pdl_drv_dir}/source/cy_adcmic.c) +else() + zephyr_library_sources_ifdef(CONFIG_USE_INFINEON_ADC ${pdl_drv_dir}/source/cy_sar.c) +endif() + if(CONFIG_USE_INFINEON_TRNG) zephyr_library_sources(${pdl_drv_dir}/source/cy_crypto.c) zephyr_library_sources(${pdl_drv_dir}/source/cy_crypto_core_trng_v1.c) diff --git a/samples/basic/fade_led/boards/cyw920829m2evk_02.overlay b/samples/basic/fade_led/boards/cyw920829m2evk_02.overlay new file mode 100644 index 0000000000000..26dd161b1cfe3 --- /dev/null +++ b/samples/basic/fade_led/boards/cyw920829m2evk_02.overlay @@ -0,0 +1,39 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 Cypress Semiconductor Corporation (an Infineon company) or + * an affiliate of Cypress Semiconductor Corporation + */ + +#include +#include + +/ { + aliases { + pwm-led0 = &pwm_led0; + }; + + pwmleds { + compatible = "pwm-leds"; + pwm_led0: pwm_led_0 { + pwms = <&pwm0_0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>; + label = "PWM MB1"; + }; + }; +}; + +&pwm0_0 { + status = "okay"; + pinctrl-0 = <&p1_1_pwm0_0>; + pinctrl-names = "default"; + divider-type = ; + divider-sel = <1>; + divider-val = <9599>; +}; + + +&pinctrl { + p1_1_pwm0_0: p1_1_pwm0_0 { + drive-push-pull; + }; +}; From 3092d96e5bb8e19a808cd16189277197332d8cd3 Mon Sep 17 00:00:00 2001 From: Sudan Landge Date: Mon, 16 Sep 2024 21:46:17 +0100 Subject: [PATCH 1833/4482] boards: mps3: Add support for corstone300/an552 What is changed? - Added a new mps3 board an552 for the soc corstone300. The qualifier to build/run application with board mps3/an552 is `mps3/corstone300/an552` for secure and `mps3/corstone300/an552/ns` for non-secure. - Added FVP variant to enable FVP testing with corstone300 and it uses the ARM FVP `FVP_Corstone_SSE-300_Ethos-U55`. The qualifier to build/run application with FVP is `mps3/corstone300/fvp` for secure and `mps3/corstone300/fvp/ns` for non-secure. - Note: the qualifier to build/run application with board mps3/an547 is now changed to `mps3/corstone300/an547` for secure and `mps3/corstone300/an547/ns` for non-secure. How is it changed? - Moved common code from mps3/an547 to corstone300. - Renamed soc for an547 to corstone300 and added a new soc corstone300/an552. Why do we need this change? - This enables FVP support and testing for corstone300. - SOC/qualifier for mps3/an547 was renamed to reduce code redundancy - A separate FVP variant was added for AN552 because, the TFM board used for non-secure variant differs for FPGA and FVP. TFM board `arm/mps3/corstone300/fvp` should be used when testing AN552 with FVP and `arm/mps3/corstone300/an552` should be used when testing with AN552 FPGA. Signed-off-by: Sudan Landge --- boards/arm/mps3/Kconfig | 3 +- boards/arm/mps3/Kconfig.defconfig | 3 +- boards/arm/mps3/Kconfig.mps3 | 8 +- boards/arm/mps3/board.cmake | 46 +++-- boards/arm/mps3/board.yml | 12 +- .../mps3/doc/img/{mps3_an547.jpg => mps3.jpg} | Bin boards/arm/mps3/doc/index.rst | 191 ++++++++++++------ boards/arm/mps3/mps3_common.dtsi | 98 +++++++++ ...n.dtsi => mps3_common_soc_peripheral.dtsi} | 39 +++- ...3_an547.dts => mps3_corstone300_an547.dts} | 117 ++--------- ...an547.yaml => mps3_corstone300_an547.yaml} | 5 +- ...onfig => mps3_corstone300_an547_defconfig} | 1 + ...7_ns.dts => mps3_corstone300_an547_ns.dts} | 66 +----- ...ns.yaml => mps3_corstone300_an547_ns.yaml} | 7 +- ...ig => mps3_corstone300_an547_ns_defconfig} | 1 + boards/arm/mps3/mps3_corstone300_an552.dts | 96 +++++++++ boards/arm/mps3/mps3_corstone300_an552.yaml | 22 ++ .../arm/mps3/mps3_corstone300_an552_defconfig | 17 ++ boards/arm/mps3/mps3_corstone300_an552_ns.dts | 101 +++++++++ .../arm/mps3/mps3_corstone300_an552_ns.yaml | 17 ++ .../mps3/mps3_corstone300_an552_ns_defconfig | 18 ++ boards/arm/mps3/mps3_corstone300_fvp.dts | 96 +++++++++ boards/arm/mps3/mps3_corstone300_fvp.yaml | 24 +++ .../arm/mps3/mps3_corstone300_fvp_defconfig | 17 ++ boards/arm/mps3/mps3_corstone300_fvp_ns.dts | 101 +++++++++ boards/arm/mps3/mps3_corstone300_fvp_ns.yaml | 17 ++ .../mps3/mps3_corstone300_fvp_ns_defconfig | 20 ++ boards/deprecated.cmake | 4 +- doc/releases/release-notes-4.0.rst | 5 + doc/services/tfm/requirements.rst | 4 +- modules/trusted-firmware-m/Kconfig.tfm | 5 +- .../tflite-micro/hello_world/README.rst | 2 +- .../tflite-micro/hello_world/sample.yaml | 3 +- .../tflite-micro/tflm_ethosu/README.rst | 2 +- .../tflite-micro/tflm_ethosu/sample.yaml | 2 +- soc/arm/mps3/Kconfig | 5 +- ...547 => Kconfig.defconfig.mps3_corstone300} | 3 +- soc/arm/mps3/Kconfig.soc | 5 +- soc/arm/soc.yml | 2 +- .../arm/arm_no_multithreading/testcase.yaml | 2 +- .../arch/arm/arm_thread_swap_tz/testcase.yaml | 4 +- .../cmsis_dsp/basicmath/testcase.yaml | 2 +- .../mem_protect/mem_protect/testcase.yaml | 4 +- .../mem_protect/userspace/testcase.yaml | 4 +- tests/lib/cmsis_dsp/bayes/testcase.yaml | 2 +- tests/lib/cmsis_dsp/complexmath/testcase.yaml | 2 +- tests/lib/cmsis_dsp/distance/testcase.yaml | 2 +- tests/lib/cmsis_dsp/fastmath/testcase.yaml | 2 +- tests/lib/cmsis_dsp/filtering/testcase.yaml | 10 +- .../lib/cmsis_dsp/interpolation/testcase.yaml | 2 +- tests/lib/cmsis_dsp/matrix/testcase.yaml | 24 +-- .../cmsis_dsp/quaternionmath/testcase.yaml | 2 +- tests/lib/cmsis_dsp/statistics/testcase.yaml | 2 +- tests/lib/cmsis_dsp/support/testcase.yaml | 2 +- tests/lib/cmsis_dsp/svm/testcase.yaml | 2 +- tests/lib/cmsis_dsp/transform/testcase.yaml | 10 +- tests/subsys/dsp/basicmath/testcase.yaml | 2 +- 57 files changed, 956 insertions(+), 309 deletions(-) rename boards/arm/mps3/doc/img/{mps3_an547.jpg => mps3.jpg} (100%) create mode 100644 boards/arm/mps3/mps3_common.dtsi rename boards/arm/mps3/{mps3_an547-common.dtsi => mps3_common_soc_peripheral.dtsi} (80%) rename boards/arm/mps3/{mps3_an547.dts => mps3_corstone300_an547.dts} (52%) rename boards/arm/mps3/{mps3_an547.yaml => mps3_corstone300_an547.yaml} (66%) rename boards/arm/mps3/{mps3_an547_defconfig => mps3_corstone300_an547_defconfig} (80%) rename boards/arm/mps3/{mps3_an547_ns.dts => mps3_corstone300_an547_ns.dts} (58%) rename boards/arm/mps3/{mps3_an547_ns.yaml => mps3_corstone300_an547_ns.yaml} (59%) rename boards/arm/mps3/{mps3_an547_ns_defconfig => mps3_corstone300_an547_ns_defconfig} (82%) create mode 100644 boards/arm/mps3/mps3_corstone300_an552.dts create mode 100644 boards/arm/mps3/mps3_corstone300_an552.yaml create mode 100644 boards/arm/mps3/mps3_corstone300_an552_defconfig create mode 100644 boards/arm/mps3/mps3_corstone300_an552_ns.dts create mode 100644 boards/arm/mps3/mps3_corstone300_an552_ns.yaml create mode 100644 boards/arm/mps3/mps3_corstone300_an552_ns_defconfig create mode 100644 boards/arm/mps3/mps3_corstone300_fvp.dts create mode 100644 boards/arm/mps3/mps3_corstone300_fvp.yaml create mode 100644 boards/arm/mps3/mps3_corstone300_fvp_defconfig create mode 100644 boards/arm/mps3/mps3_corstone300_fvp_ns.dts create mode 100644 boards/arm/mps3/mps3_corstone300_fvp_ns.yaml create mode 100644 boards/arm/mps3/mps3_corstone300_fvp_ns_defconfig rename soc/arm/mps3/{Kconfig.defconfig.mps3_an547 => Kconfig.defconfig.mps3_corstone300} (52%) diff --git a/boards/arm/mps3/Kconfig b/boards/arm/mps3/Kconfig index 019f22aae49dd..836143e8f31b0 100644 --- a/boards/arm/mps3/Kconfig +++ b/boards/arm/mps3/Kconfig @@ -1,5 +1,6 @@ # Copyright (c) 2021 Linaro Limited +# Copyright 2024 Arm Limited and/or its affiliates # SPDX-License-Identifier: Apache-2.0 config BOARD_MPS3 - select QEMU_TARGET + select QEMU_TARGET if BOARD_MPS3_CORSTONE300_AN547 || BOARD_MPS3_CORSTONE300_AN547_NS diff --git a/boards/arm/mps3/Kconfig.defconfig b/boards/arm/mps3/Kconfig.defconfig index 078012e46a760..ebb103dd72006 100644 --- a/boards/arm/mps3/Kconfig.defconfig +++ b/boards/arm/mps3/Kconfig.defconfig @@ -1,7 +1,8 @@ # Copyright (c) 2018-2021 Linaro Limited +# Copyright 2024 Arm Limited and/or its affiliates # SPDX-License-Identifier: Apache-2.0 -if BOARD_MPS3_AN547 +if BOARD_MPS3_CORSTONE300_AN547 || BOARD_MPS3_CORSTONE300_AN552 || BOARD_MPS3_CORSTONE300_FVP # MPU-based null-pointer dereferencing detection cannot # be applied as the (0x0 - 0x400) is unmapped but QEMU diff --git a/boards/arm/mps3/Kconfig.mps3 b/boards/arm/mps3/Kconfig.mps3 index 84dd3fff09531..92827014839b2 100644 --- a/boards/arm/mps3/Kconfig.mps3 +++ b/boards/arm/mps3/Kconfig.mps3 @@ -1,7 +1,13 @@ # Copyright (c) 2023 Nordic Semiconductor +# Copyright 2024 Arm Limited and/or its affiliates # # SPDX-License-Identifier: Apache-2.0 config BOARD_MPS3 select SOC_SERIES_MPS3 - select SOC_MPS3_AN547 + select SOC_MPS3_CORSTONE300 if BOARD_MPS3_CORSTONE300_AN547 || \ + BOARD_MPS3_CORSTONE300_AN547_NS || \ + BOARD_MPS3_CORSTONE300_AN552 || \ + BOARD_MPS3_CORSTONE300_AN552_NS || \ + BOARD_MPS3_CORSTONE300_FVP || \ + BOARD_MPS3_CORSTONE300_FVP_NS diff --git a/boards/arm/mps3/board.cmake b/boards/arm/mps3/board.cmake index b8035658dd232..5143a174b6d96 100644 --- a/boards/arm/mps3/board.cmake +++ b/boards/arm/mps3/board.cmake @@ -1,24 +1,36 @@ # Copyright (c) 2021 Linaro +# Copyright 2024 Arm Limited and/or its affiliates # SPDX-License-Identifier: Apache-2.0 -# The AN547 FVP must be used to enable Ethos-U55 NPU support, but QEMU also +# The FVP variant must be used to enable Ethos-U55 NPU support, but QEMU also # supports the AN547 without the NPU. # -# For emulation, QEMU is used by default. To use AN547 FVP as an emulation -# use the 'run_armfvp' target, for example: +# Default emulation: +# QEMU is used by default for corstone300/an547 and +# FVP is used by default for corstone300/fvp. # -# $ west build -b mps3_an547 samples/hello_world -t run_armfvp -set(SUPPORTED_EMU_PLATFORMS qemu armfvp) -# QEMU settings -set(QEMU_CPU_TYPE_${ARCH} cortex-m55) -set(QEMU_FLAGS_${ARCH} - -cpu ${QEMU_CPU_TYPE_${ARCH}} - -machine mps3-an547 - -nographic - -vga none - ) +if(CONFIG_BOARD_MPS3_CORSTONE300_AN547 OR CONFIG_BOARD_MPS3_CORSTONE300_AN547_NS) + set(SUPPORTED_EMU_PLATFORMS qemu) + + # QEMU settings + set(QEMU_CPU_TYPE_${ARCH} cortex-m55) + set(QEMU_FLAGS_${ARCH} + -cpu ${QEMU_CPU_TYPE_${ARCH}} + -machine mps3-an547 + -nographic + -vga none + ) +elseif(CONFIG_BOARD_MPS3_CORSTONE300_FVP OR CONFIG_BOARD_MPS3_CORSTONE300_FVP_NS) + set(SUPPORTED_EMU_PLATFORMS armfvp) + set(ARMFVP_BIN_NAME FVP_Corstone_SSE-300_Ethos-U55) +elseif(CONFIG_BOARD_MPS3_CORSTONE300) + string(REPLACE "mps3/corstone300;" "" board_targets "${board_targets}") + string(REPLACE ";" "\n" board_targets "${board_targets}") + message(FATAL_ERROR "Please use a target from the list below: \n${board_targets}\n") +endif() + board_set_debugger_ifnset(qemu) if (CONFIG_BUILD_WITH_TFM) @@ -28,14 +40,11 @@ if (CONFIG_BUILD_WITH_TFM) set(QEMU_KERNEL_OPTION "-device;loader,file=${CMAKE_BINARY_DIR}/zephyr/tfm_merged.hex") endif() -# FVP settings -set(ARMFVP_BIN_NAME FVP_Corstone_SSE-300_Ethos-U55) - # FVP Parameters # -C indicate a config option in the form of: # instance.parameter=value # Run the FVP with --list-params to list all options -set(ARMFVP_FLAGS +set(ARMFVP_FLAGS ${ARMFVP_FLAGS} -C mps3_board.uart0.out_file=- -C mps3_board.uart0.unbuffered_output=1 -C mps3_board.uart1.out_file=- @@ -43,4 +52,7 @@ set(ARMFVP_FLAGS -C mps3_board.uart2.out_file=- -C mps3_board.uart2.unbuffered_output=1 -C mps3_board.visualisation.disable-visualisation=1 + -C mps3_board.telnetterminal0.start_telnet=0 + -C mps3_board.telnetterminal1.start_telnet=0 + -C mps3_board.telnetterminal2.start_telnet=0 ) diff --git a/boards/arm/mps3/board.yml b/boards/arm/mps3/board.yml index 9eea26dc244b1..609efaee9624e 100644 --- a/boards/arm/mps3/board.yml +++ b/boards/arm/mps3/board.yml @@ -3,6 +3,14 @@ board: full_name: MPS3 AN547 vendor: arm socs: - - name: 'an547' + - name: 'corstone300' variants: - - name: 'ns' + - name: 'an547' + variants: + - name: 'ns' + - name: 'an552' + variants: + - name: 'ns' + - name: 'fvp' + variants: + - name: 'ns' diff --git a/boards/arm/mps3/doc/img/mps3_an547.jpg b/boards/arm/mps3/doc/img/mps3.jpg similarity index 100% rename from boards/arm/mps3/doc/img/mps3_an547.jpg rename to boards/arm/mps3/doc/img/mps3.jpg diff --git a/boards/arm/mps3/doc/index.rst b/boards/arm/mps3/doc/index.rst index e618b9a714c5e..70b7044e98c33 100644 --- a/boards/arm/mps3/doc/index.rst +++ b/boards/arm/mps3/doc/index.rst @@ -1,61 +1,133 @@ -.. _mps3_an547_board: +.. _mps3_board: -ARM MPS3 AN547 +ARM MPS3 ############### Overview ******** -The mps3_an547 board configuration is used by Zephyr applications that run -on the MPS3 AN547 board. It provides support for the MPS3 AN547 ARM Cortex-M55 -CPU and the following devices: +The mps3 board configuration is used by Zephyr applications that run +on the MPS3 board. It provides support for the following devices: - Nested Vectored Interrupt Controller (NVIC) - System Tick System Clock (SYSTICK) - Cortex-M System Design Kit GPIO - Cortex-M System Design Kit UART - Ethos-U55 NPU +- AN547 and AN552 support Arm Cortex-M55 CPU -.. image:: img/mps3_an547.jpg +.. image:: img/mps3.jpg :align: center - :alt: ARM MPS3 AN547 + :alt: ARM MPS3 -This board configuration also supports using the `Corstone-300 FVP`_ to emulate -a MPS3 AN547 hardware platform. +`Corstone-300 FVP`_ (Fixed Virtual Platforms) is a complete +simulations of the Arm system, including processor, memory and peripherals. +They are available free of charge for Linux and Windows systems. +The FVPs have been selected for simulation since they provide access to the +Ethos-U55 NPU, which is unavailable in QEMU or other simulation platforms. -The Corstone-300 FVP (Fixed Virtual Platform) is a complete simulation of the -Arm system, including processor, memory and peripherals. It is a available free -of charge for Linux and Windows systems. The FVP has been selected for -simulation since it provides access to the Ethos-U55 NPU, which is unavailable -in QEMU or other simulation platforms. - -To run the Fixed Virtual Platform simulation tool you must download "FVP model -for the Corstone-300 MPS3" from Arm and install it on your host PC. This board -has been tested with version 11.12.57 (Nov 2 2020). Zephyr board options ==================== -The MPS3+ AN547 is an SoC with Cortex-M55 architecture. Zephyr provides support -for building for both Secure and Non-Secure firmware. +.. tabs:: + + .. tab:: MPS3 Corstone-300 (AN547) + + The MPS3+ AN547 is an SoC with Cortex-M55 architecture. Zephyr provides support + for building for both Secure and Non-Secure firmware. + + The BOARD options are summarized below: + + +-------------------------------+-----------------------------------------------+ + | BOARD | Description | + +===============================+===============================================+ + | ``mps3/corstone300/an547`` | For building Secure (or Secure-only) firmware | + +-------------------------------+-----------------------------------------------+ + | ``mps3/corstone300/an547/ns`` | For building Non-Secure firmware | + +-------------------------------+-----------------------------------------------+ + + FPGA Usage: + - Follow `Programming and Debugging`_ for build and flash instructions. + + FVP Usage: + - FVP is not supported for this variant. + + QEMU Usage: + - To run with QEMU instead of the default FVP, override the emulator selection at build time via: + + .. code-block:: bash + + $ west build -b mps3_an547 samples/hello_world -DEMU_PLATFORM=qemu -t run + + .. tab:: MPS3 Corstone-300 (AN552) + + The MPS3+ AN552 is an SoC with Cortex-M55 architecture. Zephyr provides support + for building for both Secure and Non-Secure firmware. + + The BOARD options are summarized below: + + +-------------------------------+-----------------------------------------------+ + | BOARD | Description | + +===============================+===============================================+ + | ``mps3/corstone300/an552`` | For building Secure (or Secure-only) firmware | + +-------------------------------+-----------------------------------------------+ + | ``mps3/corstone300/an552/ns`` | For building Non-Secure firmware | + +-------------------------------+-----------------------------------------------+ + + FPGA Usage: + - Follow `Programming and Debugging`_ for build and flash instructions. + + FVP Usage: + - FVP not supported for this variant. + + QEMU Usage: + - QEMU not supported for this variant of board. + + .. tab:: MPS3 Corstone-300 (FVP) + + The MPS3+ FVP is an SoC with Cortex-M55 architecture. Zephyr provides support + for building for both Secure and Non-Secure firmware. + + The BOARD options are summarized below: + + +-------------------------------+-----------------------------------------------+ + | BOARD | Description | + +===============================+===============================================+ + | ``mps3/corstone300/fvp`` | For building Secure (or Secure-only) firmware | + +-------------------------------+-----------------------------------------------+ + | ``mps3/corstone300/fvp/ns`` | For building Non-Secure firmware | + +-------------------------------+-----------------------------------------------+ -The BOARD options are summarized below: + FVP Usage: + - To run with the FVP, first set environment variable ``ARMFVP_BIN_PATH`` before using it. Then you can run it with ``west build -t run``. -+----------------------+-----------------------------------------------+ -| BOARD | Description | -+======================+===============================================+ -| ``mps3/an547`` | For building Secure (or Secure-only) firmware | -+----------------------+-----------------------------------------------+ -| ``mps3/an547/ns`` | For building Non-Secure firmware | -+----------------------+-----------------------------------------------+ + .. code-block:: bash + + export ARMFVP_BIN_PATH=/path/to/fvp/directory + west build -b {BOARD qualifier from table above} samples/hello_world -t run + + To run the Fixed Virtual Platform simulation tool you must download "FVP model + for the Corstone-300 MPS3" from Arm and install it on your host PC. This board + has been tested with version 11.24.13 (Jan 4 2024). + + QEMU Usage: + - QEMU not supported for this variant of board. + + .. note:: + Board qualifier must include the board name as mentioned above. + ``mps3/corstone300`` without the board name is not a valid qualifier. Hardware ******** -ARM MPS3 AN547 provides the following hardware components: +ARM MPS3 provides the following hardware components: + +- CPU + + - AN547 and AN552 support Arm Cortex-M55 CPU and + Soft Macro Model (SMM) implementation of SSE-300 subsystem -- ARM Cortex-M55 -- Soft Macro Model (SMM) implementation of SSE-300 subsystem - Memory - 8MB BRAM @@ -89,7 +161,7 @@ ARM MPS3 AN547 provides the following hardware components: Supported Features =================== -The ``mps3/an547`` board configuration supports the following hardware features: +The ``MPS3`` board configuration supports the following hardware features: +-----------+------------+-------------------------------------+ | Interface | Controller | Driver/Component | @@ -109,14 +181,15 @@ See the `MPS3 FPGA Website`_ for a complete list of MPS3 AN547 board hardware features. The default configuration can be found in -:zephyr_file:`boards/arm/mps3/mps3_an547_defconfig`. + - For AN547: :zephyr_file:`boards/arm/mps3/mps3_corstone300_an547_defconfig`. + - For AN552: :zephyr_file:`boards/arm/mps3/mps3_corstone300_an552_defconfig`. + - For FVP : :zephyr_file:`boards/arm/mps3/mps3_corstone300_fvp_defconfig`. -For more details refer to `MPS3 AN547 Technical Reference Manual (TRM)`_. Serial Port =========== -The MPS3 AN547 has six UARTs. The Zephyr console output by default, uses +The MPS3 has six UARTs. The Zephyr console output by default, uses UART0, which is exposed over the Debug USB interface (J8). Serial port 0 on the Debug USB interface is the MCC board control console. @@ -127,26 +200,28 @@ Serial port 2 on the Debug USB interface is connected to UART 1. Serial port 3 on the Debug USB interface is connected to UART 2. +.. Programming and Debugging: + Programming and Debugging ************************* Flashing ======== -MPS3 AN547 provides: +MPS3 provides: - A USB connection to the host computer, which exposes Mass Storage and CMSIS-DAP, and serial ports. -Building an application ------------------------ +Building an application with AN547 +---------------------------------- You can build applications in the usual way. Here is an example for -the :zephyr:code-sample:`hello_world` application. +the :zephyr:code-sample:`hello_world` application with AN547. .. zephyr-app-commands:: :zephyr-app: samples/hello_world - :board: mps3/an547 + :board: mps3/corstone300/an547 :goals: build Open a serial terminal (minicom, putty, etc.) with the following settings: @@ -178,7 +253,7 @@ The update requires 3 steps: 1. Copy application files to ``/SOFTWARE/``. 2. Open ``/MB/HBI0309C/AN547/images.txt``. -3. Update the ``AN547/images.txt`` file as follows: +3. Update the ``images.txt`` file as follows: .. code-block:: bash @@ -200,31 +275,12 @@ serial port: Hello World! mps3 -FVP Usage -========= - -To run with the FVP, first set environment variable ``ARMFVP_BIN_PATH`` before -using it. Then you can run it with ``west build -t run``. - -.. code-block:: bash - - export ARMFVP_BIN_PATH=/path/to/fvp/directory - west build -t run - - -QEMU Usage -========== - -To run with QEMU instead of the default FVP, override the emulator selection -at build time via: - -.. code-block:: bash - - $ west build -b mps3_an547 samples/hello_world -DEMU_PLATFORM=qemu -t run - - -Note, however, that the Ethos-U55 NPU is not available in QEMU. If you require -the use of the NPU, please use the default FVP for device emulation. +For more details refer to: + - `MPS3 AN547 Technical Reference Manual (TRM)`_ + - `MPS3 AN552 Technical Reference Manual (TRM)`_ + - `MPS3 FPGA Prototyping Board Technical Reference Manual (TRM)`_ + - `Cortex M55 Generic User Guide`_ + - `Corelink SSE-300 Example Subsystem`_ .. _Corstone-300 FVP: https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps @@ -235,6 +291,9 @@ the use of the NPU, please use the default FVP for device emulation. .. _MPS3 AN547 Technical Reference Manual (TRM): https://developer.arm.com/-/media/Arm%20Developer%20Community/PDF/DAI0547B_SSE300_PLUS_U55_FPGA_for_mps3.pdf +.. _MPS3 AN552 Technical Reference Manual (TRM): + https://developer.arm.com/documentation/dai0552/latest + .. _MPS3 FPGA Prototyping Board Technical Reference Manual (TRM): https://developer.arm.com/documentation/100765/latest diff --git a/boards/arm/mps3/mps3_common.dtsi b/boards/arm/mps3/mps3_common.dtsi new file mode 100644 index 0000000000000..b719e94971679 --- /dev/null +++ b/boards/arm/mps3/mps3_common.dtsi @@ -0,0 +1,98 @@ +/* + * Copyright 2024 Arm Limited and/or its affiliates + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* /dts-v1/; */ + +#include +#include +#include +#include + +/ { + aliases { + led0 = &led_0; + led1 = &led_1; + sw0 = &user_button_0; + sw1 = &user_button_1; + }; + + leds { + compatible = "gpio-leds"; + led_0: led_0 { + gpios = <&gpio_led0 0>; + label = "USERLED0"; + }; + led_1: led_1 { + gpios = <&gpio_led0 1>; + label = "USERLED1"; + }; + led_2: led_2 { + gpios = <&gpio_led0 2>; + label = "USERLED2"; + }; + led_3: led_3 { + gpios = <&gpio_led0 3>; + label = "USERLED3"; + }; + led_4: led_4 { + gpios = <&gpio_led0 4>; + label = "USERLED4"; + }; + led_5: led_5 { + gpios = <&gpio_led0 5>; + label = "USERLED5"; + }; + led_6: led_6 { + gpios = <&gpio_led0 6>; + label = "USERLED6"; + }; + led_7: led_7 { + gpios = <&gpio_led0 7>; + label = "USERLED7"; + }; + led_8: led_8 { + gpios = <&gpio_led0 8>; + label = "PB1LED"; + }; + led_9: led_9 { + gpios = <&gpio_led0 9>; + label = "PB2LED"; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + user_button_0: button_0 { + label = "USERPB0"; + gpios = <&gpio_button 0>; + zephyr,code = ; + }; + user_button_1: button_1 { + label = "USERPB1"; + gpios = <&gpio_button 1>; + zephyr,code = ; + }; + }; + + /* DDR4 - 2G, alternates non-secure/secure every 256M */ + ddr4: memory@60000000 { + device_type = "memory"; + compatible = "zephyr,memory-region"; + reg = <0x60000000 DT_SIZE_M(256) + 0x70000000 DT_SIZE_M(256) + 0x80000000 DT_SIZE_M(256) + 0x90000000 DT_SIZE_M(256) + 0xa0000000 DT_SIZE_M(256) + 0xb0000000 DT_SIZE_M(256) + 0xc0000000 DT_SIZE_M(256) + 0xd0000000 DT_SIZE_M(256)>; + zephyr,memory-region = "DDR4"; + }; +}; + +&nvic { + arm,num-irq-priority-bits = <3>; +}; diff --git a/boards/arm/mps3/mps3_an547-common.dtsi b/boards/arm/mps3/mps3_common_soc_peripheral.dtsi similarity index 80% rename from boards/arm/mps3/mps3_an547-common.dtsi rename to boards/arm/mps3/mps3_common_soc_peripheral.dtsi index 96147b0bd29f5..6fd5c7acd4024 100644 --- a/boards/arm/mps3/mps3_an547-common.dtsi +++ b/boards/arm/mps3/mps3_common_soc_peripheral.dtsi @@ -1,5 +1,6 @@ /* * Copyright (c) 2019-2021 Linaro Limited + * Copyright 2024 Arm Limited and/or its affiliates * * SPDX-License-Identifier: Apache-2.0 */ @@ -66,20 +67,50 @@ i2c_audio_conf: i2c@9201000 { reg = <0x9201000 0x1000>; }; -i2c_shield0: i2c@9203000 { +spi_adc: spi@9202000 { + compatible = "arm,pl022"; + reg = <0x9202000 DT_SIZE_K(4)>; + interrupts = <53 3>; + interrupt-names = "shield_adc"; + clocks = <&sysclk>; + #address-cells = <1>; + #size-cells = <0>; +}; + +spi_shield0: spi@9203000 { + compatible = "arm,pl022"; + reg = <0x9203000 DT_SIZE_K(4)>; + interrupts = <54 3>; + interrupt-names = "shield0_spi"; + clocks = <&sysclk>; + #address-cells = <1>; + #size-cells = <0>; +}; + +spi_shield1: spi@9204000 { + compatible = "arm,pl022"; + reg = <0x9204000 DT_SIZE_K(4)>; + interrupts = <55 3>; + interrupt-names = "shield1_spi"; + clocks = <&sysclk>; + #address-cells = <1>; + #size-cells = <0>; +}; + +i2c_shield0: i2c@9205000 { compatible = "arm,versatile-i2c"; clock-frequency = ; #address-cells = <1>; #size-cells = <0>; - reg = <0x9203000 0x1000>; + reg = <0x9205000 0x1000>; }; -i2c_shield1: i2c@9204000 { +i2c_shield1: i2c@9206000 { compatible = "arm,versatile-i2c"; clock-frequency = ; #address-cells = <1>; #size-cells = <0>; - reg = <0x9204000 0x1000>; + reg = <0x9206000 0x1000>; }; i2c_ddr4_eeprom: i2c@9208000 { diff --git a/boards/arm/mps3/mps3_an547.dts b/boards/arm/mps3/mps3_corstone300_an547.dts similarity index 52% rename from boards/arm/mps3/mps3_an547.dts rename to boards/arm/mps3/mps3_corstone300_an547.dts index 8b6585a13e294..ae71ddf72825a 100644 --- a/boards/arm/mps3/mps3_an547.dts +++ b/boards/arm/mps3/mps3_corstone300_an547.dts @@ -1,6 +1,6 @@ /* * Copyright (c) 2018-2021 Linaro Limited - * Copyright 2022 Arm Limited and/or its affiliates + * Copyright 2024 Arm Limited and/or its affiliates * * SPDX-License-Identifier: Apache-2.0 */ @@ -11,19 +11,13 @@ #include #include #include +#include "mps3_common.dtsi" / { compatible = "arm,mps3-an547"; #address-cells = <1>; #size-cells = <1>; - aliases { - led0 = &led_0; - led1 = &led_1; - sw0 = &user_button_0; - sw1 = &user_button_1; - }; - chosen { zephyr,console = &uart0; zephyr,shell-uart = &uart0; @@ -31,61 +25,21 @@ zephyr,flash = &itcm; }; - leds { - compatible = "gpio-leds"; - led_0: led_0 { - gpios = <&gpio_led0 0>; - label = "USERLED0"; - }; - led_1: led_1 { - gpios = <&gpio_led0 1>; - label = "USERLED1"; - }; - led_2: led_2 { - gpios = <&gpio_led0 2>; - label = "USERLED2"; - }; - led_3: led_3 { - gpios = <&gpio_led0 3>; - label = "USERLED3"; - }; - led_4: led_4 { - gpios = <&gpio_led0 4>; - label = "USERLED4"; - }; - led_5: led_5 { - gpios = <&gpio_led0 5>; - label = "USERLED5"; - }; - led_6: led_6 { - gpios = <&gpio_led0 6>; - label = "USERLED6"; - }; - led_7: led_7 { - gpios = <&gpio_led0 7>; - label = "USERLED7"; - }; - led_8: led_8 { - gpios = <&gpio_led0 8>; - label = "PB1LED"; - }; - led_9: led_9 { - gpios = <&gpio_led0 9>; - label = "PB2LED"; - }; - }; + cpus { + #address-cells = <1>; + #size-cells = <0>; - gpio_keys { - compatible = "gpio-keys"; - user_button_0: button_0 { - label = "USERPB0"; - gpios = <&gpio_button 0>; - zephyr,code = ; - }; - user_button_1: button_1 { - label = "USERPB1"; - gpios = <&gpio_button 1>; - zephyr,code = ; + cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-m55"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + + mpu: mpu@e000ed90 { + compatible = "arm,armv8.1m-mpu"; + reg = <0xe000ed90 0x40>; + }; }; }; @@ -104,24 +58,6 @@ }; }; - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - device_type = "cpu"; - compatible = "arm,cortex-m55"; - reg = <0>; - #address-cells = <1>; - #size-cells = <1>; - - mpu: mpu@e000ed90 { - compatible = "arm,armv8.1m-mpu"; - reg = <0xe000ed90 0x40>; - }; - }; - }; - /* We utilize the secure addresses, if you subtract 0x10000000 * you'll get the non-secure alias */ @@ -149,32 +85,13 @@ zephyr,memory-region = "ISRAM"; }; - /* DDR4 - 2G, alternates non-secure/secure every 256M */ - ddr4: memory@60000000 { - device_type = "memory"; - compatible = "zephyr,memory-region"; - reg = <0x60000000 DT_SIZE_M(256) - 0x70000000 DT_SIZE_M(256) - 0x80000000 DT_SIZE_M(256) - 0x90000000 DT_SIZE_M(256) - 0xa0000000 DT_SIZE_M(256) - 0xb0000000 DT_SIZE_M(256) - 0xc0000000 DT_SIZE_M(256) - 0xd0000000 DT_SIZE_M(256)>; - zephyr,memory-region = "DDR4"; - }; - soc { peripheral@50000000 { #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x50000000 0x10000000>; - #include "mps3_an547-common.dtsi" + #include "mps3_common_soc_peripheral.dtsi" }; }; }; - -&nvic { - arm,num-irq-priority-bits = <3>; -}; diff --git a/boards/arm/mps3/mps3_an547.yaml b/boards/arm/mps3/mps3_corstone300_an547.yaml similarity index 66% rename from boards/arm/mps3/mps3_an547.yaml rename to boards/arm/mps3/mps3_corstone300_an547.yaml index 538fa24db67d9..44987ebe55220 100644 --- a/boards/arm/mps3/mps3_an547.yaml +++ b/boards/arm/mps3/mps3_corstone300_an547.yaml @@ -1,11 +1,12 @@ # # Copyright (c) 2019-2021 Linaro Limited +# Copyright 2024 Arm Limited and/or its affiliates # # SPDX-License-Identifier: Apache-2.0 # -identifier: mps3/an547 -name: Arm MPS3-AN547 +identifier: mps3/corstone300/an547 +name: Arm MPS3-Corstone300-AN547 type: mcu arch: arm ram: 512 diff --git a/boards/arm/mps3/mps3_an547_defconfig b/boards/arm/mps3/mps3_corstone300_an547_defconfig similarity index 80% rename from boards/arm/mps3/mps3_an547_defconfig rename to boards/arm/mps3/mps3_corstone300_an547_defconfig index 90c9b6a9f8e42..2d4a9af56aec6 100644 --- a/boards/arm/mps3/mps3_an547_defconfig +++ b/boards/arm/mps3/mps3_corstone300_an547_defconfig @@ -1,5 +1,6 @@ # # Copyright (c) 2018-2021 Linaro Limited +# Copyright 2024 Arm Limited and/or its affiliates # # SPDX-License-Identifier: Apache-2.0 # diff --git a/boards/arm/mps3/mps3_an547_ns.dts b/boards/arm/mps3/mps3_corstone300_an547_ns.dts similarity index 58% rename from boards/arm/mps3/mps3_an547_ns.dts rename to boards/arm/mps3/mps3_corstone300_an547_ns.dts index 1c6a0fc2605c1..5a4e0031946c8 100644 --- a/boards/arm/mps3/mps3_an547_ns.dts +++ b/boards/arm/mps3/mps3_corstone300_an547_ns.dts @@ -1,5 +1,6 @@ /* * Copyright (c) 2018-2021 Linaro Limited + * Copyright 2024 Arm Limited and/or its affiliates * * SPDX-License-Identifier: Apache-2.0 */ @@ -10,19 +11,13 @@ #include #include #include +#include "mps3_common.dtsi" / { compatible = "arm,mps3-an547"; #address-cells = <1>; #size-cells = <1>; - aliases { - led0 = &led_0; - led1 = &led_1; - sw0 = &user_button_0; - sw1 = &user_button_1; - }; - chosen { zephyr,console = &uart0; zephyr,shell-uart = &uart0; @@ -30,32 +25,6 @@ zephyr,flash = &code; }; - leds { - compatible = "gpio-leds"; - led_0: led_0 { - gpios = <&gpio_led0 0>; - label = "USERLED0"; - }; - led_1: led_1 { - gpios = <&gpio_led0 1>; - label = "USERLED1"; - }; - }; - - gpio_keys { - compatible = "gpio-keys"; - user_button_0: button_0 { - label = "USERPB0"; - gpios = <&gpio_button 0>; - zephyr,code = ; - }; - user_button_1: button_1 { - label = "USERPB1"; - gpios = <&gpio_button 1>; - zephyr,code = ; - }; - }; - cpus { #address-cells = <1>; #size-cells = <0>; @@ -101,21 +70,6 @@ zephyr,memory-region = "ISRAM"; }; - /* DDR4 - 2G, alternates non-secure/secure every 256M */ - ddr4: memory@60000000 { - device_type = "memory"; - compatible = "zephyr,memory-region"; - reg = <0x60000000 DT_SIZE_M(256) - 0x70000000 DT_SIZE_M(256) - 0x80000000 DT_SIZE_M(256) - 0x90000000 DT_SIZE_M(256) - 0xa0000000 DT_SIZE_M(256) - 0xb0000000 DT_SIZE_M(256) - 0xc0000000 DT_SIZE_M(256) - 0xd0000000 DT_SIZE_M(256)>; - zephyr,memory-region = "DDR4"; - }; - reserved-memory { #address-cells = <1>; #size-cells = <1>; @@ -124,15 +78,15 @@ /* The memory regions defined below must match what the TF-M * project has defined for that board - a single image boot is * assumed. Please see the memory layout in: - * https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/platform/ext/target/mps3/an547/partition/flash_layout.h + * https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/platform/ext/target/mps3/corstone300/common/partition/flash_layout.h */ - code: memory@01060000 { - reg = <0x01060000 DT_SIZE_K(384)>; + code: memory@28080000 { + reg = <0x28080000 DT_SIZE_K(512)>; }; - ram: memory@21000000 { - reg = <0x21000000 DT_SIZE_M(2)>; + ram: memory@21020000 { + reg = <0x21020000 DT_SIZE_M(2)>; }; }; @@ -142,11 +96,7 @@ #size-cells = <1>; ranges = <0x0 0x40000000 0x10000000>; - #include "mps3_an547-common.dtsi" + #include "mps3_common_soc_peripheral.dtsi" }; }; }; - -&nvic { - arm,num-irq-priority-bits = <3>; -}; diff --git a/boards/arm/mps3/mps3_an547_ns.yaml b/boards/arm/mps3/mps3_corstone300_an547_ns.yaml similarity index 59% rename from boards/arm/mps3/mps3_an547_ns.yaml rename to boards/arm/mps3/mps3_corstone300_an547_ns.yaml index e58f636b55571..ad66706012fcd 100644 --- a/boards/arm/mps3/mps3_an547_ns.yaml +++ b/boards/arm/mps3/mps3_corstone300_an547_ns.yaml @@ -1,15 +1,16 @@ # # Copyright (c) 2019-2021 Linaro Limited +# Copyright 2024 Arm Limited and/or its affiliates # # SPDX-License-Identifier: Apache-2.0 # -identifier: mps3/an547/ns -name: Arm MPS3-AN547_ns +identifier: mps3/corstone300/an547/ns +name: Arm MPS3-Corstone300-AN547_ns type: mcu arch: arm ram: 2048 -flash: 384 +flash: 512 simulation: qemu toolchain: - gnuarmemb diff --git a/boards/arm/mps3/mps3_an547_ns_defconfig b/boards/arm/mps3/mps3_corstone300_an547_ns_defconfig similarity index 82% rename from boards/arm/mps3/mps3_an547_ns_defconfig rename to boards/arm/mps3/mps3_corstone300_an547_ns_defconfig index ccc25c35019c1..37a0b3827f0f2 100644 --- a/boards/arm/mps3/mps3_an547_ns_defconfig +++ b/boards/arm/mps3/mps3_corstone300_an547_ns_defconfig @@ -1,5 +1,6 @@ # # Copyright (c) 2018-2021 Linaro Limited +# Copyright 2024 Arm Limited and/or its affiliates # # SPDX-License-Identifier: Apache-2.0 # diff --git a/boards/arm/mps3/mps3_corstone300_an552.dts b/boards/arm/mps3/mps3_corstone300_an552.dts new file mode 100644 index 0000000000000..7c7ec8d02a5c9 --- /dev/null +++ b/boards/arm/mps3/mps3_corstone300_an552.dts @@ -0,0 +1,96 @@ +/* + * Copyright 2024 Arm Limited and/or its affiliates + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include +#include +#include +#include "mps3_common.dtsi" + +/ { + compatible = "arm,mps3-an552"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,sram = &dtcm; + zephyr,flash = &itcm; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-m55"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + + mpu: mpu@e000ed90 { + compatible = "arm,armv8.1m-mpu"; + reg = <0xe000ed90 0x40>; + }; + }; + }; + + ethosu { + #address-cells = <1>; + #size-cells = <0>; + interrupt-parent = <&nvic>; + + ethosu0: ethosu@48102000 { + compatible = "arm,ethos-u"; + reg = <0x48102000>; + interrupts = <56 3>; + secure-enable; + privilege-enable; + status = "okay"; + }; + }; + + /* We utilize the secure addresses, if you subtract 0x10000000 + * you'll get the non-secure alias + */ + itcm: itcm@10000000 { /* alias @ 0x0 */ + compatible = "zephyr,memory-region"; + reg = <0x10000000 DT_SIZE_K(512)>; + zephyr,memory-region = "ITCM"; + }; + + sram: sram@11000000 { /* alias @ 0x01000000 */ + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x11000000 DT_SIZE_M(1)>; + zephyr,memory-region = "SRAM"; + }; + + dtcm: dtcm@30000000 { /* alias @ 0x20000000 */ + compatible = "zephyr,memory-region"; + reg = <0x30000000 DT_SIZE_K(512)>; + zephyr,memory-region = "DTCM"; + }; + + isram: sram@31000000 {/* alias @ 0x21000000 */ + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x31000000 DT_SIZE_M(2)>; + zephyr,memory-region = "ISRAM"; + }; + + soc { + peripheral@50000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x50000000 0x10000000>; + + #include "mps3_common_soc_peripheral.dtsi" + }; + }; +}; diff --git a/boards/arm/mps3/mps3_corstone300_an552.yaml b/boards/arm/mps3/mps3_corstone300_an552.yaml new file mode 100644 index 0000000000000..ecabe7150853d --- /dev/null +++ b/boards/arm/mps3/mps3_corstone300_an552.yaml @@ -0,0 +1,22 @@ +# Copyright 2024 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +identifier: mps3/corstone300/an552 +name: Arm MPS3-Corstone300-AN552 +type: mcu +arch: arm +ram: 512 +flash: 512 +toolchain: + - gnuarmemb + - zephyr + - xtools +supported: + - gpio +testing: + ignore_tags: + - drivers + - bluetooth + - net + - timer +vendor: arm diff --git a/boards/arm/mps3/mps3_corstone300_an552_defconfig b/boards/arm/mps3/mps3_corstone300_an552_defconfig new file mode 100644 index 0000000000000..f5607f3da4c2f --- /dev/null +++ b/boards/arm/mps3/mps3_corstone300_an552_defconfig @@ -0,0 +1,17 @@ +# Copyright 2024 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_RUNTIME_NMI=y +CONFIG_ARM_TRUSTZONE_M=y +CONFIG_ARM_MPU=y + +# GPIOs +CONFIG_GPIO=y + +# Serial +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y + +# Build a Secure firmware image +CONFIG_TRUSTED_EXECUTION_SECURE=y diff --git a/boards/arm/mps3/mps3_corstone300_an552_ns.dts b/boards/arm/mps3/mps3_corstone300_an552_ns.dts new file mode 100644 index 0000000000000..17e9d259bca9d --- /dev/null +++ b/boards/arm/mps3/mps3_corstone300_an552_ns.dts @@ -0,0 +1,101 @@ +/* + * Copyright 2024 Arm Limited and/or its affiliates + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include +#include +#include +#include "mps3_common.dtsi" + +/ { + compatible = "arm,mps3-an552"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,sram = &ram; + zephyr,flash = &code; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-m55"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + + mpu: mpu@e000ed90 { + compatible = "arm,armv8.1m-mpu"; + reg = <0xe000ed90 0x40>; + }; + }; + }; + + /* We utilize the secure addresses, if you subtract 0x10000000 + * you'll get the non-secure alias + */ + itcm: itcm@0 { + compatible = "zephyr,memory-region"; + reg = <0x0 DT_SIZE_K(512)>; + zephyr,memory-region = "ITCM"; + }; + + sram: sram@1000000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x1000000 DT_SIZE_M(1)>; + zephyr,memory-region = "SRAM"; + }; + + dtcm: dtcm@20000000 { + compatible = "zephyr,memory-region"; + reg = <0x20000000 DT_SIZE_K(512)>; + zephyr,memory-region = "DTCM"; + }; + + isram: sram@21000000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x21000000 DT_SIZE_M(2)>; + zephyr,memory-region = "ISRAM"; + }; + + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + /* The memory regions defined below must match what the TF-M + * project has defined for that board - a single image boot is + * assumed. Please see the memory layout in: + * https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/platform/ext/target/mps3/corstone300/common/partition/flash_layout.h + */ + + code: memory@28080000 { + reg = <0x28080000 DT_SIZE_K(512)>; + }; + + ram: memory@21020000 { + reg = <0x21020000 DT_SIZE_M(1)>; + }; + }; + + soc { + peripheral@40000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x40000000 0x10000000>; + + #include "mps3_common_soc_peripheral.dtsi" + }; + }; +}; diff --git a/boards/arm/mps3/mps3_corstone300_an552_ns.yaml b/boards/arm/mps3/mps3_corstone300_an552_ns.yaml new file mode 100644 index 0000000000000..b8a914a5725bd --- /dev/null +++ b/boards/arm/mps3/mps3_corstone300_an552_ns.yaml @@ -0,0 +1,17 @@ +# Copyright 2024 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +identifier: mps3/corstone300/an552/ns +name: Arm MPS3-Corstone300-AN552_ns +type: mcu +arch: arm +ram: 2048 +flash: 512 +toolchain: + - gnuarmemb + - zephyr + - xtools +testing: + default: true + only_tags: + - trusted-firmware-m diff --git a/boards/arm/mps3/mps3_corstone300_an552_ns_defconfig b/boards/arm/mps3/mps3_corstone300_an552_ns_defconfig new file mode 100644 index 0000000000000..c9cfdd8950b2a --- /dev/null +++ b/boards/arm/mps3/mps3_corstone300_an552_ns_defconfig @@ -0,0 +1,18 @@ +# Copyright 2024 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_RUNTIME_NMI=y +CONFIG_ARM_TRUSTZONE_M=y +CONFIG_ARM_MPU=y + +# GPIOs +CONFIG_GPIO=y + +# Serial +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y + +# Build a Non-secure firmware image +CONFIG_TRUSTED_EXECUTION_SECURE=n +CONFIG_TRUSTED_EXECUTION_NONSECURE=y diff --git a/boards/arm/mps3/mps3_corstone300_fvp.dts b/boards/arm/mps3/mps3_corstone300_fvp.dts new file mode 100644 index 0000000000000..eff11378c6166 --- /dev/null +++ b/boards/arm/mps3/mps3_corstone300_fvp.dts @@ -0,0 +1,96 @@ +/* + * Copyright 2024 Arm Limited and/or its affiliates + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include +#include +#include +#include "mps3_common.dtsi" + +/ { + compatible = "arm,mps3-fvp"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,sram = &dtcm; + zephyr,flash = &itcm; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-m55"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + + mpu: mpu@e000ed90 { + compatible = "arm,armv8.1m-mpu"; + reg = <0xe000ed90 0x40>; + }; + }; + }; + + ethosu { + #address-cells = <1>; + #size-cells = <0>; + interrupt-parent = <&nvic>; + + ethosu0: ethosu@48102000 { + compatible = "arm,ethos-u"; + reg = <0x48102000>; + interrupts = <56 3>; + secure-enable; + privilege-enable; + status = "okay"; + }; + }; + + /* We utilize the secure addresses, if you subtract 0x10000000 + * you'll get the non-secure alias + */ + itcm: itcm@10000000 { /* alias @ 0x0 */ + compatible = "zephyr,memory-region"; + reg = <0x10000000 DT_SIZE_K(512)>; + zephyr,memory-region = "ITCM"; + }; + + sram: sram@11000000 { /* alias @ 0x01000000 */ + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x11000000 DT_SIZE_M(1)>; + zephyr,memory-region = "SRAM"; + }; + + dtcm: dtcm@30000000 { /* alias @ 0x20000000 */ + compatible = "zephyr,memory-region"; + reg = <0x30000000 DT_SIZE_K(512)>; + zephyr,memory-region = "DTCM"; + }; + + isram: sram@31000000 {/* alias @ 0x21000000 */ + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x31000000 DT_SIZE_M(2)>; + zephyr,memory-region = "ISRAM"; + }; + + soc { + peripheral@50000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x50000000 0x10000000>; + + #include "mps3_common_soc_peripheral.dtsi" + }; + }; +}; diff --git a/boards/arm/mps3/mps3_corstone300_fvp.yaml b/boards/arm/mps3/mps3_corstone300_fvp.yaml new file mode 100644 index 0000000000000..4d665e24aa07a --- /dev/null +++ b/boards/arm/mps3/mps3_corstone300_fvp.yaml @@ -0,0 +1,24 @@ +# Copyright 2024 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +identifier: mps3/corstone300/fvp +name: Arm MPS3-Corstone300-FVP +type: mcu +arch: arm +ram: 512 +flash: 512 +simulation: armfvp +simulation_exec: FVP_Corstone_SSE-300_Ethos-U55 +toolchain: + - gnuarmemb + - zephyr + - xtools +supported: + - gpio +testing: + ignore_tags: + - drivers + - bluetooth + - net + - timer +vendor: arm diff --git a/boards/arm/mps3/mps3_corstone300_fvp_defconfig b/boards/arm/mps3/mps3_corstone300_fvp_defconfig new file mode 100644 index 0000000000000..f5607f3da4c2f --- /dev/null +++ b/boards/arm/mps3/mps3_corstone300_fvp_defconfig @@ -0,0 +1,17 @@ +# Copyright 2024 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_RUNTIME_NMI=y +CONFIG_ARM_TRUSTZONE_M=y +CONFIG_ARM_MPU=y + +# GPIOs +CONFIG_GPIO=y + +# Serial +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y + +# Build a Secure firmware image +CONFIG_TRUSTED_EXECUTION_SECURE=y diff --git a/boards/arm/mps3/mps3_corstone300_fvp_ns.dts b/boards/arm/mps3/mps3_corstone300_fvp_ns.dts new file mode 100644 index 0000000000000..8a9704cae3a8c --- /dev/null +++ b/boards/arm/mps3/mps3_corstone300_fvp_ns.dts @@ -0,0 +1,101 @@ +/* + * Copyright 2024 Arm Limited and/or its affiliates + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include +#include +#include +#include "mps3_common.dtsi" + +/ { + compatible = "arm,mps3-fvp"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,sram = &ram; + zephyr,flash = &code; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-m55"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + + mpu: mpu@e000ed90 { + compatible = "arm,armv8.1m-mpu"; + reg = <0xe000ed90 0x40>; + }; + }; + }; + + /* We utilize the secure addresses, if you subtract 0x10000000 + * you'll get the non-secure alias + */ + itcm: itcm@0 { + compatible = "zephyr,memory-region"; + reg = <0x0 DT_SIZE_K(512)>; + zephyr,memory-region = "ITCM"; + }; + + sram: sram@1000000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x1000000 DT_SIZE_M(1)>; + zephyr,memory-region = "SRAM"; + }; + + dtcm: dtcm@20000000 { + compatible = "zephyr,memory-region"; + reg = <0x20000000 DT_SIZE_K(512)>; + zephyr,memory-region = "DTCM"; + }; + + isram: sram@21000000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x21000000 DT_SIZE_M(2)>; + zephyr,memory-region = "ISRAM"; + }; + + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + /* The memory regions defined below must match what the TF-M + * project has defined for that board - a single image boot is + * assumed. Please see the memory layout in: + * https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/platform/ext/target/mps3/corstone300/common/partition/flash_layout.h + */ + + code: memory@28080000 { + reg = <0x28080000 DT_SIZE_K(512)>; + }; + + ram: memory@21020000 { + reg = <0x21020000 DT_SIZE_M(1)>; + }; + }; + + soc { + peripheral@40000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x40000000 0x10000000>; + + #include "mps3_common_soc_peripheral.dtsi" + }; + }; +}; diff --git a/boards/arm/mps3/mps3_corstone300_fvp_ns.yaml b/boards/arm/mps3/mps3_corstone300_fvp_ns.yaml new file mode 100644 index 0000000000000..1c05bb561d65b --- /dev/null +++ b/boards/arm/mps3/mps3_corstone300_fvp_ns.yaml @@ -0,0 +1,17 @@ +# Copyright 2024 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +identifier: mps3/corstone300/fvp/ns +name: Arm MPS3-Corstone300-FVP_ns +type: mcu +arch: arm +ram: 2048 +flash: 512 +toolchain: + - gnuarmemb + - zephyr + - xtools +testing: + default: true + only_tags: + - trusted-firmware-m diff --git a/boards/arm/mps3/mps3_corstone300_fvp_ns_defconfig b/boards/arm/mps3/mps3_corstone300_fvp_ns_defconfig new file mode 100644 index 0000000000000..1aca4a4abc455 --- /dev/null +++ b/boards/arm/mps3/mps3_corstone300_fvp_ns_defconfig @@ -0,0 +1,20 @@ +# Copyright 2024 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_RUNTIME_NMI=y +CONFIG_ARM_TRUSTZONE_M=y +CONFIG_ARM_MPU=y + +# GPIOs +CONFIG_GPIO=y + +# Serial +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y + +# Build a Non-secure firmware image +CONFIG_TRUSTED_EXECUTION_SECURE=n +CONFIG_TRUSTED_EXECUTION_NONSECURE=y + +CONFIG_BUILD_WITH_TFM=y diff --git a/boards/deprecated.cmake b/boards/deprecated.cmake index f15b8fbee42db..41e90ba3b93c7 100644 --- a/boards/deprecated.cmake +++ b/boards/deprecated.cmake @@ -437,10 +437,10 @@ set(mps2_an521_remote_DEPRECATED mps2/an521/cpu1 ) set(mps3_an547_DEPRECATED - mps3 + mps3/corstone300/547 ) set(mps3_an547_ns_DEPRECATED - mps3/an547/ns + mps3/corstone300/an547/ns ) set(native_posix_64_DEPRECATED diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 9864e49d3ff37..18a60105befe1 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -164,6 +164,11 @@ Boards & SoC Support with the old name marked as deprecated. * PHYTEC: ``mimx8mm_phyboard_polis`` has been renamed to :ref:`phyboard_polis`, with the old name marked as deprecated. + * The board qualifier for MPS3/AN547 is changed from: + + * ``mps3/an547`` to ``mps3/corstone300/an547`` for secure and + * ``mps3/an547/ns`` to ``mps3/corstone300/an547/ns`` for non-secure. + * Added support for the following shields: diff --git a/doc/services/tfm/requirements.rst b/doc/services/tfm/requirements.rst index 20c342741801c..3170b03fc1ba8 100644 --- a/doc/services/tfm/requirements.rst +++ b/doc/services/tfm/requirements.rst @@ -10,8 +10,8 @@ The following are some of the boards that can be used with TF-M: - NSPE board name * - :ref:`mps2_an521_board` - ``mps2_an521_ns`` (qemu supported) - * - :ref:`mps3_an547_board` - - ``mps3_an547_ns`` (qemu supported) + * - :ref:`mps3_board` + - ``mps3/corstone300/an547/ns`` (qemu supported) * - :zephyr:board:`bl5340_dvk` - ``bl5340_dvk/nrf5340/cpuapp/ns`` * - :zephyr:board:`lpcxpresso55s69` diff --git a/modules/trusted-firmware-m/Kconfig.tfm b/modules/trusted-firmware-m/Kconfig.tfm index 33ec3e8c9d10c..51cf8209254bc 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm +++ b/modules/trusted-firmware-m/Kconfig.tfm @@ -2,6 +2,7 @@ # Copyright (c) 2019, 2020 Linaro Limited # Copyright (c) 2020, 2021 Nordic Semiconductor ASA +# Copyright 2024 Arm Limited and/or its affiliates # SPDX-License-Identifier: Apache-2.0 config ZEPHYR_TRUSTED_FIRMWARE_M_MODULE @@ -11,7 +12,9 @@ config TFM_BOARD string default "nxp/lpcxpresso55s69" if BOARD_LPCXPRESSO55S69_LPC55S69_CPU0_NS default "arm/mps2/an521" if BOARD_MPS2_AN521_CPU0_NS - default "arm/mps3/an547" if BOARD_MPS3_AN547 + default "arm/mps3/corstone300/fvp" if BOARD_MPS3_CORSTONE300_FVP_NS + default "arm/mps3/corstone300/an547" if BOARD_MPS3_CORSTONE300_AN547_NS + default "arm/mps3/corstone300/an552" if BOARD_MPS3_CORSTONE300_AN552_NS default "stm/b_u585i_iot02a" if BOARD_B_U585I_IOT02A default "stm/nucleo_l552ze_q" if BOARD_NUCLEO_L552ZE_Q default "stm/stm32l562e_dk" if BOARD_STM32L562E_DK diff --git a/samples/modules/tflite-micro/hello_world/README.rst b/samples/modules/tflite-micro/hello_world/README.rst index 10192c337c8fb..7a1d89cf83aad 100644 --- a/samples/modules/tflite-micro/hello_world/README.rst +++ b/samples/modules/tflite-micro/hello_world/README.rst @@ -65,7 +65,7 @@ the :envvar:`PATH` variable, then building and testing can be done with followin commands. ``` -$ west build -p auto -b mps3/an547 samples/modules/tflite-micro/hello_world/ -T sample.tensorflow.helloworld.cmsis_nn +$ west build -p auto -b mps3/corstone300/an547 samples/modules/tflite-micro/hello_world/ -T sample.tensorflow.helloworld.cmsis_nn $ FVP_Corstone_SSE-300_Ethos-U55 build/zephyr/zephyr.elf ``` diff --git a/samples/modules/tflite-micro/hello_world/sample.yaml b/samples/modules/tflite-micro/hello_world/sample.yaml index 000db6fffe2eb..b0f087f1c44de 100644 --- a/samples/modules/tflite-micro/hello_world/sample.yaml +++ b/samples/modules/tflite-micro/hello_world/sample.yaml @@ -23,6 +23,7 @@ tests: filter: CONFIG_FULL_LIBC_SUPPORTED sample.tensorflow.helloworld.cmsis_nn: tags: tensorflow - platform_allow: mps3/an547 + platform_allow: + - mps3/corstone300/an547 extra_configs: - CONFIG_TENSORFLOW_LITE_MICRO_CMSIS_NN_KERNELS=y diff --git a/samples/modules/tflite-micro/tflm_ethosu/README.rst b/samples/modules/tflite-micro/tflm_ethosu/README.rst index 46583daab3b79..0e8d7279dfd1b 100644 --- a/samples/modules/tflite-micro/tflm_ethosu/README.rst +++ b/samples/modules/tflite-micro/tflm_ethosu/README.rst @@ -43,5 +43,5 @@ commands. .. code-block:: bash - $ west build -b mps3/an547 zephyr/samples/modules/tflite-micro/tflm_ethosu + $ west build -b mps3/corstone300/an547 zephyr/samples/modules/tflite-micro/tflm_ethosu $ FVP_Corstone_SSE-300_Ethos-U55 build/zephyr/zephyr.elf diff --git a/samples/modules/tflite-micro/tflm_ethosu/sample.yaml b/samples/modules/tflite-micro/tflm_ethosu/sample.yaml index 6e0342e6a5656..37d97a87d346d 100644 --- a/samples/modules/tflite-micro/tflm_ethosu/sample.yaml +++ b/samples/modules/tflite-micro/tflm_ethosu/sample.yaml @@ -10,4 +10,4 @@ tests: filter: dt_compat_enabled("arm,ethos-u") build_only: true integration_platforms: - - mps3/an547 + - mps3/corstone300/an547 diff --git a/soc/arm/mps3/Kconfig b/soc/arm/mps3/Kconfig index 06c1af46d5d2b..db67450969a5d 100644 --- a/soc/arm/mps3/Kconfig +++ b/soc/arm/mps3/Kconfig @@ -1,11 +1,12 @@ # Copyright (c) 2017-2021 Linaro Limited +# Copyright 2024 Arm Limited and/or its affiliates # SPDX-License-Identifier: Apache-2.0 config SOC_SERIES_MPS3 select ARM select GPIO_MMIO32 if GPIO -config SOC_MPS3_AN547 +config SOC_MPS3_CORSTONE300 select CPU_CORTEX_M55 select CPU_HAS_ARM_SAU select CPU_HAS_ARM_MPU @@ -17,4 +18,4 @@ config SOC_MPS3_AN547 config ARMV8_1_M_PMU_EVENTCNT int - default 8 if SOC_MPS3_AN547 + default 8 if SOC_MPS3_CORSTONE300 diff --git a/soc/arm/mps3/Kconfig.defconfig.mps3_an547 b/soc/arm/mps3/Kconfig.defconfig.mps3_corstone300 similarity index 52% rename from soc/arm/mps3/Kconfig.defconfig.mps3_an547 rename to soc/arm/mps3/Kconfig.defconfig.mps3_corstone300 index 0961808eae213..df86713214fcf 100644 --- a/soc/arm/mps3/Kconfig.defconfig.mps3_an547 +++ b/soc/arm/mps3/Kconfig.defconfig.mps3_corstone300 @@ -1,7 +1,8 @@ # Copyright (c) 2018-2021 Linaro Limited +# Copyright 2024 Arm Limited and/or its affiliates # SPDX-License-Identifier: Apache-2.0 -if SOC_MPS3_AN547 +if SOC_MPS3_CORSTONE300 config NUM_IRQS default 128 diff --git a/soc/arm/mps3/Kconfig.soc b/soc/arm/mps3/Kconfig.soc index 99bb1fb78c496..07d85f48a9ba0 100644 --- a/soc/arm/mps3/Kconfig.soc +++ b/soc/arm/mps3/Kconfig.soc @@ -1,4 +1,5 @@ # Copyright (c) 2017-2021 Linaro Limited +# Copyright 2024 Arm Limited and/or its affiliates # SPDX-License-Identifier: Apache-2.0 config SOC_SERIES_MPS3 @@ -10,9 +11,9 @@ config SOC_SERIES_MPS3 config SOC_SERIES default "mps3" if SOC_SERIES_MPS3 -config SOC_MPS3_AN547 +config SOC_MPS3_CORSTONE300 bool select SOC_SERIES_MPS3 config SOC - default "an547" if SOC_MPS3_AN547 + default "corstone300" if SOC_MPS3_CORSTONE300 diff --git a/soc/arm/soc.yml b/soc/arm/soc.yml index c0b2456501e0c..e1d906d76e03c 100644 --- a/soc/arm/soc.yml +++ b/soc/arm/soc.yml @@ -10,7 +10,7 @@ family: - name: cpu1 - name: mps3 socs: - - name: an547 + - name: corstone300 - name: musca socs: - name: musca_b1 diff --git a/tests/arch/arm/arm_no_multithreading/testcase.yaml b/tests/arch/arm/arm_no_multithreading/testcase.yaml index 855a94ca97e9e..3aa62846e810e 100644 --- a/tests/arch/arm/arm_no_multithreading/testcase.yaml +++ b/tests/arch/arm/arm_no_multithreading/testcase.yaml @@ -10,7 +10,7 @@ tests: - qemu_cortex_m3 - mps2/an385 - mps2/an521/cpu0 - - mps3/an547 + - mps3/corstone300/an547 - nrf52840dk/nrf52840 - nrf9160dk/nrf9160 - nrf51dk/nrf51822 diff --git a/tests/arch/arm/arm_thread_swap_tz/testcase.yaml b/tests/arch/arm/arm_thread_swap_tz/testcase.yaml index fca7a79d1d31a..ebb9996454200 100644 --- a/tests/arch/arm/arm_thread_swap_tz/testcase.yaml +++ b/tests/arch/arm/arm_thread_swap_tz/testcase.yaml @@ -9,7 +9,7 @@ tests: arch.arm.swap.tz: # NOTE: this platform disables FPU access in TFM. platform_exclude: - - mps3/an547/ns + - mps3/corstone300/an547/ns - nucleo_l552ze_q/stm32l552xx/ns integration_platforms: - mps2/an521/cpu0/ns @@ -18,7 +18,7 @@ tests: - CONFIG_ARM_NONSECURE_PREEMPTIBLE_SECURE_CALLS=n # NOTE: this platform disables FPU access in TFM. platform_exclude: - - mps3/an547/ns + - mps3/corstone300/an547/ns - nucleo_l552ze_q/stm32l552xx/ns integration_platforms: - mps2/an521/cpu0/ns diff --git a/tests/benchmarks/cmsis_dsp/basicmath/testcase.yaml b/tests/benchmarks/cmsis_dsp/basicmath/testcase.yaml index d63b4f0aa8323..9eca243092669 100644 --- a/tests/benchmarks/cmsis_dsp/basicmath/testcase.yaml +++ b/tests/benchmarks/cmsis_dsp/basicmath/testcase.yaml @@ -17,7 +17,7 @@ tests: filter: CONFIG_CPU_HAS_FPU integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - fpu extra_configs: diff --git a/tests/kernel/mem_protect/mem_protect/testcase.yaml b/tests/kernel/mem_protect/mem_protect/testcase.yaml index 5d2406081e399..76e27a22e1163 100644 --- a/tests/kernel/mem_protect/mem_protect/testcase.yaml +++ b/tests/kernel/mem_protect/mem_protect/testcase.yaml @@ -24,8 +24,8 @@ tests: arch_allow: arm platform_allow: - slwrb4180a - - mps3/an547 + - mps3/corstone300/an547 - nrf9160dk/nrf9160 integration_platforms: - - mps3/an547 + - mps3/corstone300/an547 extra_args: CONFIG_MPU_GAP_FILLING=y diff --git a/tests/kernel/mem_protect/userspace/testcase.yaml b/tests/kernel/mem_protect/userspace/testcase.yaml index 0f539367ff47c..9a9e8a1df7324 100644 --- a/tests/kernel/mem_protect/userspace/testcase.yaml +++ b/tests/kernel/mem_protect/userspace/testcase.yaml @@ -23,8 +23,8 @@ tests: arch_allow: arm platform_allow: - slwrb4180a - - mps3/an547 + - mps3/corstone300/an547 - nrf9160dk/nrf9160 integration_platforms: - - mps3/an547 + - mps3/corstone300/an547 extra_args: CONFIG_MPU_GAP_FILLING=y diff --git a/tests/lib/cmsis_dsp/bayes/testcase.yaml b/tests/lib/cmsis_dsp/bayes/testcase.yaml index abdc24b73358a..dd02226fc5a2f 100644 --- a/tests/lib/cmsis_dsp/bayes/testcase.yaml +++ b/tests/lib/cmsis_dsp/bayes/testcase.yaml @@ -16,7 +16,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu diff --git a/tests/lib/cmsis_dsp/complexmath/testcase.yaml b/tests/lib/cmsis_dsp/complexmath/testcase.yaml index b6ad7f46e27a0..c287a8a113aa2 100644 --- a/tests/lib/cmsis_dsp/complexmath/testcase.yaml +++ b/tests/lib/cmsis_dsp/complexmath/testcase.yaml @@ -15,7 +15,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu diff --git a/tests/lib/cmsis_dsp/distance/testcase.yaml b/tests/lib/cmsis_dsp/distance/testcase.yaml index b44b53af16e1a..00c7ab8c7f4aa 100644 --- a/tests/lib/cmsis_dsp/distance/testcase.yaml +++ b/tests/lib/cmsis_dsp/distance/testcase.yaml @@ -15,7 +15,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu diff --git a/tests/lib/cmsis_dsp/fastmath/testcase.yaml b/tests/lib/cmsis_dsp/fastmath/testcase.yaml index 27665a8025047..d3da7020f3656 100644 --- a/tests/lib/cmsis_dsp/fastmath/testcase.yaml +++ b/tests/lib/cmsis_dsp/fastmath/testcase.yaml @@ -15,7 +15,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu diff --git a/tests/lib/cmsis_dsp/filtering/testcase.yaml b/tests/lib/cmsis_dsp/filtering/testcase.yaml index ef45599a82725..89af8c52cfb4d 100644 --- a/tests/lib/cmsis_dsp/filtering/testcase.yaml +++ b/tests/lib/cmsis_dsp/filtering/testcase.yaml @@ -26,7 +26,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu @@ -55,7 +55,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu @@ -84,7 +84,8 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 + - mps3/corstone300/an552 tags: - cmsis-dsp - fpu @@ -114,7 +115,8 @@ tests: integration_platforms: - mps2/an521/cpu1 platform_exclude: - - mps3/an547 + - mps3/corstone300/an547 + - mps3/corstone300/an552 tags: - cmsis-dsp - fpu diff --git a/tests/lib/cmsis_dsp/interpolation/testcase.yaml b/tests/lib/cmsis_dsp/interpolation/testcase.yaml index 7c5b516371525..d99111037f84f 100644 --- a/tests/lib/cmsis_dsp/interpolation/testcase.yaml +++ b/tests/lib/cmsis_dsp/interpolation/testcase.yaml @@ -15,7 +15,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu diff --git a/tests/lib/cmsis_dsp/matrix/testcase.yaml b/tests/lib/cmsis_dsp/matrix/testcase.yaml index 36aea53d84ba7..47d84ea36fe76 100644 --- a/tests/lib/cmsis_dsp/matrix/testcase.yaml +++ b/tests/lib/cmsis_dsp/matrix/testcase.yaml @@ -23,7 +23,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu @@ -52,7 +52,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu @@ -81,7 +81,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu @@ -109,7 +109,7 @@ tests: and CONFIG_CPU_HAS_FPU and CONFIG_FULL_LIBC_SUPPORTED) integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu @@ -138,7 +138,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu @@ -167,7 +167,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu @@ -197,7 +197,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu @@ -228,7 +228,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu @@ -259,7 +259,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu @@ -288,7 +288,7 @@ tests: and CONFIG_CPU_HAS_FPU and CONFIG_FULL_LIBC_SUPPORTED) integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu @@ -318,7 +318,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu @@ -349,7 +349,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu diff --git a/tests/lib/cmsis_dsp/quaternionmath/testcase.yaml b/tests/lib/cmsis_dsp/quaternionmath/testcase.yaml index e6d59cd451aa0..97346ea4e772e 100644 --- a/tests/lib/cmsis_dsp/quaternionmath/testcase.yaml +++ b/tests/lib/cmsis_dsp/quaternionmath/testcase.yaml @@ -15,7 +15,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu diff --git a/tests/lib/cmsis_dsp/statistics/testcase.yaml b/tests/lib/cmsis_dsp/statistics/testcase.yaml index a6ec436ee11ac..33f7a001ed620 100644 --- a/tests/lib/cmsis_dsp/statistics/testcase.yaml +++ b/tests/lib/cmsis_dsp/statistics/testcase.yaml @@ -16,7 +16,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu diff --git a/tests/lib/cmsis_dsp/support/testcase.yaml b/tests/lib/cmsis_dsp/support/testcase.yaml index 254684346f3e2..51c64939c5848 100644 --- a/tests/lib/cmsis_dsp/support/testcase.yaml +++ b/tests/lib/cmsis_dsp/support/testcase.yaml @@ -15,7 +15,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu diff --git a/tests/lib/cmsis_dsp/svm/testcase.yaml b/tests/lib/cmsis_dsp/svm/testcase.yaml index 895a32bd1810f..6052ffed8d627 100644 --- a/tests/lib/cmsis_dsp/svm/testcase.yaml +++ b/tests/lib/cmsis_dsp/svm/testcase.yaml @@ -15,7 +15,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu diff --git a/tests/lib/cmsis_dsp/transform/testcase.yaml b/tests/lib/cmsis_dsp/transform/testcase.yaml index 3e4fb163cb08d..d6679bd4ae2f0 100644 --- a/tests/lib/cmsis_dsp/transform/testcase.yaml +++ b/tests/lib/cmsis_dsp/transform/testcase.yaml @@ -22,7 +22,7 @@ tests: filter: ((CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_CPU_HAS_FPU and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu @@ -50,7 +50,7 @@ tests: filter: ((CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_CPU_HAS_FPU and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu @@ -129,7 +129,7 @@ tests: filter: (CMSIS_DSP_FLOAT16 and (CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_CPU_HAS_FPU and CONFIG_FULL_LIBC_SUPPORTED) integration_platforms: - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu @@ -156,7 +156,7 @@ tests: filter: (CMSIS_DSP_FLOAT16 and (CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_CPU_HAS_FPU and CONFIG_FULL_LIBC_SUPPORTED) integration_platforms: - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu @@ -210,7 +210,7 @@ tests: filter: ((CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_CPU_HAS_FPU and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - - mps3/an547 + - mps3/corstone300/an547 tags: - cmsis-dsp - fpu diff --git a/tests/subsys/dsp/basicmath/testcase.yaml b/tests/subsys/dsp/basicmath/testcase.yaml index 7311f8cb9060f..dd3564f3e3b07 100644 --- a/tests/subsys/dsp/basicmath/testcase.yaml +++ b/tests/subsys/dsp/basicmath/testcase.yaml @@ -13,7 +13,7 @@ tests: filter: (CONFIG_CPU_HAS_FPU and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2/an521/cpu1 - - mps3/an547 + - mps3/corstone300/an547 tags: - zdsp - fpu From caa7226157a63168c544d4407816c3904d5f95fc Mon Sep 17 00:00:00 2001 From: Sudan Landge Date: Fri, 20 Sep 2024 14:26:17 +0100 Subject: [PATCH 1834/4482] boards: mps3: Add support for corstone310/an555 What is changed? - Added a new mps3 board an555 for the soc corstone310. The qualifier to build/run application with board mps3/an555 is `mps3/corstone310/an555` for secure and `mps3/corstone310/an555/ns` for non-secure. - Added FVP variant to enable FVP testing with corstone310 and it uses the ARM FVP `FVP_Corstone_SSE-310`. The qualifier to build/run application with FVP is `mps3/corstone310/an555fvp` for secure and `mps3/corstone310/an555fvp/ns` for non-secure. Why do we need this change? - This enables FVP support and testing for corstone310. - A separate FVP variant was added for AN555 because, the TFM board used for non-secure variant differs for FPGA and FVP. TFM board `arm/mps3/corstone310/an555` should be used when testing AN555 with FVP and `arm/mps3/corstone310/fvp` should be used when testing with AN555 FPGA. Signed-off-by: Sudan Landge --- boards/arm/mps3/Kconfig.defconfig | 2 +- boards/arm/mps3/Kconfig.mps3 | 4 + boards/arm/mps3/board.cmake | 10 ++ boards/arm/mps3/board.yml | 8 ++ boards/arm/mps3/doc/index.rst | 83 +++++++++++++- boards/arm/mps3/mps3_corstone310_an555.dts | 96 +++++++++++++++++ boards/arm/mps3/mps3_corstone310_an555.yaml | 22 ++++ .../arm/mps3/mps3_corstone310_an555_defconfig | 17 +++ boards/arm/mps3/mps3_corstone310_an555_ns.dts | 101 ++++++++++++++++++ .../arm/mps3/mps3_corstone310_an555_ns.yaml | 17 +++ .../mps3/mps3_corstone310_an555_ns_defconfig | 18 ++++ boards/arm/mps3/mps3_corstone310_fvp.dts | 96 +++++++++++++++++ boards/arm/mps3/mps3_corstone310_fvp.yaml | 24 +++++ .../arm/mps3/mps3_corstone310_fvp_defconfig | 17 +++ boards/arm/mps3/mps3_corstone310_fvp_ns.dts | 101 ++++++++++++++++++ boards/arm/mps3/mps3_corstone310_fvp_ns.yaml | 17 +++ .../mps3/mps3_corstone310_fvp_ns_defconfig | 19 ++++ modules/trusted-firmware-m/Kconfig.tfm | 2 + soc/arm/mps3/Kconfig | 11 ++ .../mps3/Kconfig.defconfig.mps3_corstone310 | 9 ++ soc/arm/mps3/Kconfig.soc | 5 + soc/arm/soc.yml | 1 + 22 files changed, 677 insertions(+), 3 deletions(-) create mode 100644 boards/arm/mps3/mps3_corstone310_an555.dts create mode 100644 boards/arm/mps3/mps3_corstone310_an555.yaml create mode 100644 boards/arm/mps3/mps3_corstone310_an555_defconfig create mode 100644 boards/arm/mps3/mps3_corstone310_an555_ns.dts create mode 100644 boards/arm/mps3/mps3_corstone310_an555_ns.yaml create mode 100644 boards/arm/mps3/mps3_corstone310_an555_ns_defconfig create mode 100644 boards/arm/mps3/mps3_corstone310_fvp.dts create mode 100644 boards/arm/mps3/mps3_corstone310_fvp.yaml create mode 100644 boards/arm/mps3/mps3_corstone310_fvp_defconfig create mode 100644 boards/arm/mps3/mps3_corstone310_fvp_ns.dts create mode 100644 boards/arm/mps3/mps3_corstone310_fvp_ns.yaml create mode 100644 boards/arm/mps3/mps3_corstone310_fvp_ns_defconfig create mode 100644 soc/arm/mps3/Kconfig.defconfig.mps3_corstone310 diff --git a/boards/arm/mps3/Kconfig.defconfig b/boards/arm/mps3/Kconfig.defconfig index ebb103dd72006..4ce6cf0c910b9 100644 --- a/boards/arm/mps3/Kconfig.defconfig +++ b/boards/arm/mps3/Kconfig.defconfig @@ -2,7 +2,7 @@ # Copyright 2024 Arm Limited and/or its affiliates # SPDX-License-Identifier: Apache-2.0 -if BOARD_MPS3_CORSTONE300_AN547 || BOARD_MPS3_CORSTONE300_AN552 || BOARD_MPS3_CORSTONE300_FVP +if BOARD_MPS3_CORSTONE300_AN547 || BOARD_MPS3_CORSTONE300_AN552 || BOARD_MPS3_CORSTONE300_FVP || BOARD_MPS3_CORSTONE310_AN555 || BOARD_MPS3_CORSTONE310_FVP # MPU-based null-pointer dereferencing detection cannot # be applied as the (0x0 - 0x400) is unmapped but QEMU diff --git a/boards/arm/mps3/Kconfig.mps3 b/boards/arm/mps3/Kconfig.mps3 index 92827014839b2..02d081f826ae5 100644 --- a/boards/arm/mps3/Kconfig.mps3 +++ b/boards/arm/mps3/Kconfig.mps3 @@ -11,3 +11,7 @@ config BOARD_MPS3 BOARD_MPS3_CORSTONE300_AN552_NS || \ BOARD_MPS3_CORSTONE300_FVP || \ BOARD_MPS3_CORSTONE300_FVP_NS + select SOC_MPS3_CORSTONE310 if BOARD_MPS3_CORSTONE310_AN555 || \ + BOARD_MPS3_CORSTONE310_AN555_NS || \ + BOARD_MPS3_CORSTONE310_FVP || \ + BOARD_MPS3_CORSTONE310_FVP_NS diff --git a/boards/arm/mps3/board.cmake b/boards/arm/mps3/board.cmake index 5143a174b6d96..ca090a832fc80 100644 --- a/boards/arm/mps3/board.cmake +++ b/boards/arm/mps3/board.cmake @@ -8,6 +8,7 @@ # Default emulation: # QEMU is used by default for corstone300/an547 and # FVP is used by default for corstone300/fvp. +# FVP is used by default for corstone310/fvp. # @@ -29,6 +30,15 @@ elseif(CONFIG_BOARD_MPS3_CORSTONE300) string(REPLACE "mps3/corstone300;" "" board_targets "${board_targets}") string(REPLACE ";" "\n" board_targets "${board_targets}") message(FATAL_ERROR "Please use a target from the list below: \n${board_targets}\n") +elseif(CONFIG_BOARD_MPS3_CORSTONE310_FVP OR CONFIG_BOARD_MPS3_CORSTONE310_FVP_NS) + set(SUPPORTED_EMU_PLATFORMS armfvp) + set(ARMFVP_BIN_NAME FVP_Corstone_SSE-310) + if(CONFIG_BOARD_MPS3_CORSTONE310_FVP) + set(ARMFVP_FLAGS + # default is '0x11000000' but should match cpu.INITSVTOR which is 0. + -C mps3_board.sse300.iotss3_systemcontrol.INITSVTOR_RST=0 + ) + endif() endif() board_set_debugger_ifnset(qemu) diff --git a/boards/arm/mps3/board.yml b/boards/arm/mps3/board.yml index 609efaee9624e..0257cd3a9d13b 100644 --- a/boards/arm/mps3/board.yml +++ b/boards/arm/mps3/board.yml @@ -14,3 +14,11 @@ board: - name: 'fvp' variants: - name: 'ns' + - name: 'corstone310' + variants: + - name: 'an555' + variants: + - name: 'ns' + - name: 'fvp' + variants: + - name: 'ns' diff --git a/boards/arm/mps3/doc/index.rst b/boards/arm/mps3/doc/index.rst index 70b7044e98c33..82089408ec0a0 100644 --- a/boards/arm/mps3/doc/index.rst +++ b/boards/arm/mps3/doc/index.rst @@ -15,12 +15,13 @@ on the MPS3 board. It provides support for the following devices: - Cortex-M System Design Kit UART - Ethos-U55 NPU - AN547 and AN552 support Arm Cortex-M55 CPU +- AN555 support Arm Cortex-M85 CPU .. image:: img/mps3.jpg :align: center :alt: ARM MPS3 -`Corstone-300 FVP`_ (Fixed Virtual Platforms) is a complete +`Corstone-300 FVP`_/`Corstone-310 FVP`_ (Fixed Virtual Platforms) is a complete simulations of the Arm system, including processor, memory and peripherals. They are available free of charge for Linux and Windows systems. The FVPs have been selected for simulation since they provide access to the @@ -99,6 +100,9 @@ Zephyr board options | ``mps3/corstone300/fvp/ns`` | For building Non-Secure firmware | +-------------------------------+-----------------------------------------------+ + FPGA Usage: + - N/A. + FVP Usage: - To run with the FVP, first set environment variable ``ARMFVP_BIN_PATH`` before using it. Then you can run it with ``west build -t run``. @@ -111,12 +115,69 @@ Zephyr board options for the Corstone-300 MPS3" from Arm and install it on your host PC. This board has been tested with version 11.24.13 (Jan 4 2024). + QEMU Usage: + - N/A. + + .. tab:: MPS3 Corstone-310 (AN555) + + The MPS3+ AN555 is an SoC with Cortex-M85 architecture. Zephyr provides support + for building for both Secure and Non-Secure firmware. + + The BOARD options are summarized below: + + +-------------------------------+-----------------------------------------------+ + | BOARD | Description | + +===============================+===============================================+ + | ``mps3/corstone310/an555`` | For building Secure (or Secure-only) firmware | + +-------------------------------+-----------------------------------------------+ + | ``mps3/corstone310/an555/ns`` | For building Non-Secure firmware | + +-------------------------------+-----------------------------------------------+ + + FPGA Usage: + - Follow `Programming and Debugging`_ for build and flash instructions. + + FVP Usage: + - FVP not supported for this variant. + QEMU Usage: - QEMU not supported for this variant of board. + .. tab:: MPS3 Corstone-310 (FVP) + + The MPS3+ FVP is an SoC with Cortex-M85 architecture. Zephyr provides support + for building for both Secure and Non-Secure firmware. + + The BOARD options are summarized below: + + +-------------------------------+-----------------------------------------------+ + | BOARD | Description | + +===============================+===============================================+ + | ``mps3/corstone310/fvp`` | For building Secure (or Secure-only) firmware | + +-------------------------------+-----------------------------------------------+ + | ``mps3/corstone310/fvp/ns`` | For building Non-Secure firmware | + +-------------------------------+-----------------------------------------------+ + + FPGA Usage: + - N/A. + + FVP Usage: + - To run with the FVP, first set environment variable ``ARMFVP_BIN_PATH`` before using it. Then you can run it with ``west build -t run``. + + .. code-block:: bash + + export ARMFVP_BIN_PATH=/path/to/fvp/directory + west build -b {BOARD qualifier from table above} samples/hello_world -t run + + To run the Fixed Virtual Platform simulation tool you must download "FVP model + for the Corstone-310 MPS3" from Arm and install it on your host PC. This board + has been tested with version 11.24.13 (Jan 4 2024). + + QEMU Usage: + - N/A. + .. note:: Board qualifier must include the board name as mentioned above. - ``mps3/corstone300`` without the board name is not a valid qualifier. + ``mps3/corstone300`` or ``mps3/corstone310`` without the board name is not a valid qualifier. Hardware ******** @@ -127,6 +188,8 @@ ARM MPS3 provides the following hardware components: - AN547 and AN552 support Arm Cortex-M55 CPU and Soft Macro Model (SMM) implementation of SSE-300 subsystem + - AN555 support Arm Cortex-M85 CPU and + Soft Macro Model (SMM) implementation of SSE-310 subsystem - Memory @@ -184,6 +247,7 @@ The default configuration can be found in - For AN547: :zephyr_file:`boards/arm/mps3/mps3_corstone300_an547_defconfig`. - For AN552: :zephyr_file:`boards/arm/mps3/mps3_corstone300_an552_defconfig`. - For FVP : :zephyr_file:`boards/arm/mps3/mps3_corstone300_fvp_defconfig`. + - For AN555: :zephyr_file:`boards/arm/mps3/mps3_corstone310_an555_defconfig`. Serial Port @@ -278,13 +342,19 @@ serial port: For more details refer to: - `MPS3 AN547 Technical Reference Manual (TRM)`_ - `MPS3 AN552 Technical Reference Manual (TRM)`_ + - `MPS3 AN555 Technical Reference Manual (TRM)`_ - `MPS3 FPGA Prototyping Board Technical Reference Manual (TRM)`_ - `Cortex M55 Generic User Guide`_ + - `Cortex M85 Generic User Guide`_ - `Corelink SSE-300 Example Subsystem`_ + - `Corelink SSE-310 Example Subsystem`_ .. _Corstone-300 FVP: https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps +.. _Corstone-310 FVP: + https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps + .. _MPS3 FPGA Website: https://developer.arm.com/tools-and-software/development-boards/fpga-prototyping-boards/mps3 @@ -294,11 +364,20 @@ For more details refer to: .. _MPS3 AN552 Technical Reference Manual (TRM): https://developer.arm.com/documentation/dai0552/latest +.. _MPS3 AN555 Technical Reference Manual (TRM): + https://developer.arm.com/documentation/107642/latest + .. _MPS3 FPGA Prototyping Board Technical Reference Manual (TRM): https://developer.arm.com/documentation/100765/latest .. _Cortex M55 Generic User Guide: https://developer.arm.com/documentation/101051/latest +.. _Cortex M85 Generic User Guide: + https://developer.arm.com/documentation/101924/latest + .. _Corelink SSE-300 Example Subsystem: https://developer.arm.com/documentation/101772/latest + +.. _Corelink SSE-310 Example Subsystem: + https://developer.arm.com/documentation/102778/latest diff --git a/boards/arm/mps3/mps3_corstone310_an555.dts b/boards/arm/mps3/mps3_corstone310_an555.dts new file mode 100644 index 0000000000000..f16aff58eae82 --- /dev/null +++ b/boards/arm/mps3/mps3_corstone310_an555.dts @@ -0,0 +1,96 @@ +/* + * Copyright 2024 Arm Limited and/or its affiliates + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include +#include +#include +#include "mps3_common.dtsi" + +/ { + compatible = "arm,mps3-an555"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,sram = &dtcm; + zephyr,flash = &itcm; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-m85"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + + mpu: mpu@e000ed90 { + compatible = "arm,armv8.1m-mpu"; + reg = <0xe000ed90 0x40>; + }; + }; + }; + + ethosu { + #address-cells = <1>; + #size-cells = <0>; + interrupt-parent = <&nvic>; + + ethosu0: ethosu@50004000 { + compatible = "arm,ethos-u"; + reg = <0x50004000>; + interrupts = <16 3>; + secure-enable; + privilege-enable; + status = "okay"; + }; + }; + + /* We utilize the secure addresses, if you subtract 0x10000000 + * you'll get the non-secure alias + */ + itcm: itcm@10000000 { /* alias @ 0x0 */ + compatible = "zephyr,memory-region"; + reg = <0x10000000 DT_SIZE_K(32)>; + zephyr,memory-region = "ITCM"; + }; + + sram: sram@11000000 { /* alias @ 0x01000000 */ + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x11000000 DT_SIZE_M(2)>; + zephyr,memory-region = "SRAM"; + }; + + dtcm: dtcm@30000000 { /* alias @ 0x20000000 */ + compatible = "zephyr,memory-region"; + reg = <0x30000000 DT_SIZE_K(32)>; + zephyr,memory-region = "DTCM"; + }; + + isram: sram@31000000 {/* alias @ 0x21000000 */ + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x31000000 DT_SIZE_M(4)>; + zephyr,memory-region = "ISRAM"; + }; + + soc { + peripheral@50000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x50000000 0x10000000>; + + #include "mps3_common_soc_peripheral.dtsi" + }; + }; +}; diff --git a/boards/arm/mps3/mps3_corstone310_an555.yaml b/boards/arm/mps3/mps3_corstone310_an555.yaml new file mode 100644 index 0000000000000..5bcd0fb19251b --- /dev/null +++ b/boards/arm/mps3/mps3_corstone310_an555.yaml @@ -0,0 +1,22 @@ +# Copyright 2024 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +identifier: mps3/corstone310/an555 +name: Arm MPS3-Corstone310-AN555 +type: mcu +arch: arm +ram: 32 +flash: 32 +toolchain: + - gnuarmemb + - zephyr + - xtools +supported: + - gpio +testing: + ignore_tags: + - drivers + - bluetooth + - net + - timer +vendor: arm diff --git a/boards/arm/mps3/mps3_corstone310_an555_defconfig b/boards/arm/mps3/mps3_corstone310_an555_defconfig new file mode 100644 index 0000000000000..f5607f3da4c2f --- /dev/null +++ b/boards/arm/mps3/mps3_corstone310_an555_defconfig @@ -0,0 +1,17 @@ +# Copyright 2024 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_RUNTIME_NMI=y +CONFIG_ARM_TRUSTZONE_M=y +CONFIG_ARM_MPU=y + +# GPIOs +CONFIG_GPIO=y + +# Serial +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y + +# Build a Secure firmware image +CONFIG_TRUSTED_EXECUTION_SECURE=y diff --git a/boards/arm/mps3/mps3_corstone310_an555_ns.dts b/boards/arm/mps3/mps3_corstone310_an555_ns.dts new file mode 100644 index 0000000000000..786ca6d9eb16d --- /dev/null +++ b/boards/arm/mps3/mps3_corstone310_an555_ns.dts @@ -0,0 +1,101 @@ +/* + * Copyright 2024 Arm Limited and/or its affiliates + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include +#include +#include +#include "mps3_common.dtsi" + +/ { + compatible = "arm,mps3-an555"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,sram = &ram; + zephyr,flash = &code; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-m85"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + + mpu: mpu@e000ed90 { + compatible = "arm,armv8.1m-mpu"; + reg = <0xe000ed90 0x40>; + }; + }; + }; + + /* We utilize the secure addresses, if you subtract 0x10000000 + * you'll get the non-secure alias + */ + itcm: itcm@0 { + compatible = "zephyr,memory-region"; + reg = <0x0 DT_SIZE_K(32)>; + zephyr,memory-region = "ITCM"; + }; + + sram: sram@1000000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x1000000 DT_SIZE_M(2)>; + zephyr,memory-region = "SRAM"; + }; + + dtcm: dtcm@20000000 { + compatible = "zephyr,memory-region"; + reg = <0x20000000 DT_SIZE_K(512)>; + zephyr,memory-region = "DTCM"; + }; + + isram: sram@21000000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x21000000 DT_SIZE_M(4)>; + zephyr,memory-region = "ISRAM"; + }; + + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + /* The memory regions defined below must match what the TF-M + * project has defined for that board - a single image boot is + * assumed. Please see the memory layout in: + * https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/platform/ext/target/mps3/corstone310/common/partition/flash_layout.h + */ + + code: memory@1000000 { + reg = <0x01000000 DT_SIZE_M(2)>; + }; + + ram: memory@21000000 { + reg = <0x21000000 DT_SIZE_M(4)>; + }; + }; + + soc { + peripheral@40000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x40000000 0x10000000>; + + #include "mps3_common_soc_peripheral.dtsi" + }; + }; +}; diff --git a/boards/arm/mps3/mps3_corstone310_an555_ns.yaml b/boards/arm/mps3/mps3_corstone310_an555_ns.yaml new file mode 100644 index 0000000000000..f6a1f444f396e --- /dev/null +++ b/boards/arm/mps3/mps3_corstone310_an555_ns.yaml @@ -0,0 +1,17 @@ +# Copyright 2024 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +identifier: mps3/corstone310/an555/ns +name: Arm MPS3-Corstone310-AN555_ns +type: mcu +arch: arm +ram: 32 +flash: 32 +toolchain: + - gnuarmemb + - zephyr + - xtools +testing: + default: true + only_tags: + - trusted-firmware-m diff --git a/boards/arm/mps3/mps3_corstone310_an555_ns_defconfig b/boards/arm/mps3/mps3_corstone310_an555_ns_defconfig new file mode 100644 index 0000000000000..51224f49ad804 --- /dev/null +++ b/boards/arm/mps3/mps3_corstone310_an555_ns_defconfig @@ -0,0 +1,18 @@ +# Copyright 2024 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_ARM_TRUSTZONE_M=y +CONFIG_RUNTIME_NMI=y +CONFIG_ARM_MPU=y + +# GPIOs +CONFIG_GPIO=y + +# Serial +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y + +# Build a Non-secure firmware image +CONFIG_TRUSTED_EXECUTION_SECURE=n +CONFIG_TRUSTED_EXECUTION_NONSECURE=y diff --git a/boards/arm/mps3/mps3_corstone310_fvp.dts b/boards/arm/mps3/mps3_corstone310_fvp.dts new file mode 100644 index 0000000000000..6ad45b5f97352 --- /dev/null +++ b/boards/arm/mps3/mps3_corstone310_fvp.dts @@ -0,0 +1,96 @@ +/* + * Copyright 2024 Arm Limited and/or its affiliates + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include +#include +#include +#include "mps3_common.dtsi" + +/ { + compatible = "arm,mps3-fvp"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,sram = &dtcm; + zephyr,flash = &itcm; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-m85"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + + mpu: mpu@e000ed90 { + compatible = "arm,armv8.1m-mpu"; + reg = <0xe000ed90 0x40>; + }; + }; + }; + + ethosu { + #address-cells = <1>; + #size-cells = <0>; + interrupt-parent = <&nvic>; + + ethosu0: ethosu@50004000 { + compatible = "arm,ethos-u"; + reg = <0x50004000>; + interrupts = <16 3>; + secure-enable; + privilege-enable; + status = "okay"; + }; + }; + + /* We utilize the secure addresses, if you subtract 0x10000000 + * you'll get the non-secure alias + */ + itcm: itcm@10000000 { /* alias @ 0x0 */ + compatible = "zephyr,memory-region"; + reg = <0x10000000 DT_SIZE_K(32)>; + zephyr,memory-region = "ITCM"; + }; + + sram: sram@11000000 { /* alias @ 0x01000000 */ + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x11000000 DT_SIZE_M(2)>; + zephyr,memory-region = "SRAM"; + }; + + dtcm: dtcm@30000000 { /* alias @ 0x20000000 */ + compatible = "zephyr,memory-region"; + reg = <0x30000000 DT_SIZE_K(32)>; + zephyr,memory-region = "DTCM"; + }; + + isram: sram@31000000 {/* alias @ 0x21000000 */ + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x31000000 DT_SIZE_M(4)>; + zephyr,memory-region = "ISRAM"; + }; + + soc { + peripheral@50000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x50000000 0x10000000>; + + #include "mps3_common_soc_peripheral.dtsi" + }; + }; +}; diff --git a/boards/arm/mps3/mps3_corstone310_fvp.yaml b/boards/arm/mps3/mps3_corstone310_fvp.yaml new file mode 100644 index 0000000000000..e91d524ffc908 --- /dev/null +++ b/boards/arm/mps3/mps3_corstone310_fvp.yaml @@ -0,0 +1,24 @@ +# Copyright 2024 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +identifier: mps3/corstone310/fvp +name: Arm MPS3-Corstone310-FVP +type: mcu +arch: arm +ram: 32 +flash: 32 +simulation: armfvp +simulation_exec: FVP_Corstone_SSE-310 +toolchain: + - gnuarmemb + - zephyr + - xtools +supported: + - gpio +testing: + ignore_tags: + - drivers + - bluetooth + - net + - timer +vendor: arm diff --git a/boards/arm/mps3/mps3_corstone310_fvp_defconfig b/boards/arm/mps3/mps3_corstone310_fvp_defconfig new file mode 100644 index 0000000000000..f5607f3da4c2f --- /dev/null +++ b/boards/arm/mps3/mps3_corstone310_fvp_defconfig @@ -0,0 +1,17 @@ +# Copyright 2024 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_RUNTIME_NMI=y +CONFIG_ARM_TRUSTZONE_M=y +CONFIG_ARM_MPU=y + +# GPIOs +CONFIG_GPIO=y + +# Serial +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y + +# Build a Secure firmware image +CONFIG_TRUSTED_EXECUTION_SECURE=y diff --git a/boards/arm/mps3/mps3_corstone310_fvp_ns.dts b/boards/arm/mps3/mps3_corstone310_fvp_ns.dts new file mode 100644 index 0000000000000..acc9b5fb737e3 --- /dev/null +++ b/boards/arm/mps3/mps3_corstone310_fvp_ns.dts @@ -0,0 +1,101 @@ +/* + * Copyright 2024 Arm Limited and/or its affiliates + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include +#include +#include +#include "mps3_common.dtsi" + +/ { + compatible = "arm,mps3-fvp"; + #address-cells = <1>; + #size-cells = <1>; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,sram = &ram; + zephyr,flash = &code; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-m85"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + + mpu: mpu@e000ed90 { + compatible = "arm,armv8.1m-mpu"; + reg = <0xe000ed90 0x40>; + }; + }; + }; + + /* We utilize the secure addresses, if you subtract 0x10000000 + * you'll get the non-secure alias + */ + itcm: itcm@0 { + compatible = "zephyr,memory-region"; + reg = <0x0 DT_SIZE_K(32)>; + zephyr,memory-region = "ITCM"; + }; + + sram: sram@1000000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x1000000 DT_SIZE_M(2)>; + zephyr,memory-region = "SRAM"; + }; + + dtcm: dtcm@20000000 { + compatible = "zephyr,memory-region"; + reg = <0x20000000 DT_SIZE_K(512)>; + zephyr,memory-region = "DTCM"; + }; + + isram: sram@21000000 { + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x21000000 DT_SIZE_M(4)>; + zephyr,memory-region = "ISRAM"; + }; + + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + /* The memory regions defined below must match what the TF-M + * project has defined for that board - a single image boot is + * assumed. Please see the memory layout in: + * https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/platform/ext/target/mps3/corstone310/common/partition/flash_layout.h + */ + + code: memory@28080000 { + reg = <0x28080000 DT_SIZE_K(512)>; + }; + + ram: memory@21020000 { + reg = <0x21020000 DT_SIZE_M(1)>; + }; + }; + + soc { + peripheral@40000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x40000000 0x10000000>; + + #include "mps3_common_soc_peripheral.dtsi" + }; + }; +}; diff --git a/boards/arm/mps3/mps3_corstone310_fvp_ns.yaml b/boards/arm/mps3/mps3_corstone310_fvp_ns.yaml new file mode 100644 index 0000000000000..6a70eff7fb09d --- /dev/null +++ b/boards/arm/mps3/mps3_corstone310_fvp_ns.yaml @@ -0,0 +1,17 @@ +# Copyright 2024 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +identifier: mps3/corstone310/fvp/ns +name: Arm MPS3-Corstone310-FVP_ns +type: mcu +arch: arm +ram: 32 +flash: 32 +toolchain: + - gnuarmemb + - zephyr + - xtools +testing: + default: true + only_tags: + - trusted-firmware-m diff --git a/boards/arm/mps3/mps3_corstone310_fvp_ns_defconfig b/boards/arm/mps3/mps3_corstone310_fvp_ns_defconfig new file mode 100644 index 0000000000000..4eec22103ff87 --- /dev/null +++ b/boards/arm/mps3/mps3_corstone310_fvp_ns_defconfig @@ -0,0 +1,19 @@ +# Copyright 2024 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_ARM_TRUSTZONE_M=y +CONFIG_RUNTIME_NMI=y +CONFIG_ARM_MPU=y + +# GPIOs +CONFIG_GPIO=y + +# Serial +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y + +# Build a Non-secure firmware image +CONFIG_TRUSTED_EXECUTION_SECURE=n +CONFIG_TRUSTED_EXECUTION_NONSECURE=y +CONFIG_BUILD_WITH_TFM=y diff --git a/modules/trusted-firmware-m/Kconfig.tfm b/modules/trusted-firmware-m/Kconfig.tfm index 51cf8209254bc..9e86bda7c6fde 100644 --- a/modules/trusted-firmware-m/Kconfig.tfm +++ b/modules/trusted-firmware-m/Kconfig.tfm @@ -15,6 +15,8 @@ config TFM_BOARD default "arm/mps3/corstone300/fvp" if BOARD_MPS3_CORSTONE300_FVP_NS default "arm/mps3/corstone300/an547" if BOARD_MPS3_CORSTONE300_AN547_NS default "arm/mps3/corstone300/an552" if BOARD_MPS3_CORSTONE300_AN552_NS + default "arm/mps3/corstone310/an555" if BOARD_MPS3_CORSTONE310_AN555_NS + default "arm/mps3/corstone310/fvp" if BOARD_MPS3_CORSTONE310_FVP_NS default "stm/b_u585i_iot02a" if BOARD_B_U585I_IOT02A default "stm/nucleo_l552ze_q" if BOARD_NUCLEO_L552ZE_Q default "stm/stm32l562e_dk" if BOARD_STM32L562E_DK diff --git a/soc/arm/mps3/Kconfig b/soc/arm/mps3/Kconfig index db67450969a5d..304e8065fcbdb 100644 --- a/soc/arm/mps3/Kconfig +++ b/soc/arm/mps3/Kconfig @@ -16,6 +16,17 @@ config SOC_MPS3_CORSTONE300 select ARMV8_1_M_MVEF select ARMV8_1_M_PMU +config SOC_MPS3_CORSTONE310 + select CPU_CORTEX_M85 + select CPU_HAS_ARM_SAU + select CPU_HAS_ARM_MPU + select CPU_HAS_FPU + select ARMV8_M_DSP + select ARMV8_1_M_MVEI + select ARMV8_1_M_MVEF + select ARMV8_1_M_PMU + config ARMV8_1_M_PMU_EVENTCNT int default 8 if SOC_MPS3_CORSTONE300 + default 8 if SOC_MPS3_CORSTONE310 diff --git a/soc/arm/mps3/Kconfig.defconfig.mps3_corstone310 b/soc/arm/mps3/Kconfig.defconfig.mps3_corstone310 new file mode 100644 index 0000000000000..11aebd44f7bd4 --- /dev/null +++ b/soc/arm/mps3/Kconfig.defconfig.mps3_corstone310 @@ -0,0 +1,9 @@ +# Copyright 2024 Arm Limited and/or its affiliates +# SPDX-License-Identifier: Apache-2.0 + +if SOC_MPS3_CORSTONE310 + +config NUM_IRQS + default 128 + +endif diff --git a/soc/arm/mps3/Kconfig.soc b/soc/arm/mps3/Kconfig.soc index 07d85f48a9ba0..94c9538b5260a 100644 --- a/soc/arm/mps3/Kconfig.soc +++ b/soc/arm/mps3/Kconfig.soc @@ -15,5 +15,10 @@ config SOC_MPS3_CORSTONE300 bool select SOC_SERIES_MPS3 +config SOC_MPS3_CORSTONE310 + bool + select SOC_SERIES_MPS3 + config SOC default "corstone300" if SOC_MPS3_CORSTONE300 + default "corstone310" if SOC_MPS3_CORSTONE310 diff --git a/soc/arm/soc.yml b/soc/arm/soc.yml index e1d906d76e03c..4f1f01726deb4 100644 --- a/soc/arm/soc.yml +++ b/soc/arm/soc.yml @@ -11,6 +11,7 @@ family: - name: mps3 socs: - name: corstone300 + - name: corstone310 - name: musca socs: - name: musca_b1 From f2e115cca374516cb9e2a5845d1e3b77b53a18c9 Mon Sep 17 00:00:00 2001 From: Sudan Landge Date: Sat, 19 Oct 2024 21:12:47 +0100 Subject: [PATCH 1835/4482] arch: arm: fix null pointer dereference check test What is changed? Updated the condition thats prevents mpu config for null dereference. Added a new check so that mpu is configured for null dereference if devicetree contains a memory-region node with: - node address starting at 0 - size covered by the node is more than the null dereference page size (0x400) and - contains a memory-attr Why is the change needed? The check relied on flash base address to align with 0 for configuring the mpu for null dereference but, a device tree could have a flash starting at an address other than 0 and still need the mpu config for null dereference. The new extra check provides a way to connfigure mpu for null dereference even if flash base address is not 0. Note, though this change helps with mpu config for new boards having flash address other than 0, this change does not change existing behaviour for existing boards. Signed-off-by: Sudan Landge --- arch/arm/core/mpu/arm_mpu.c | 11 ++++++++++- boards/arm/mps3/mps3_common.dtsi | 8 ++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/arch/arm/core/mpu/arm_mpu.c b/arch/arm/core/mpu/arm_mpu.c index 3f9cf09575469..f121e57e39224 100644 --- a/arch/arm/core/mpu/arm_mpu.c +++ b/arch/arm/core/mpu/arm_mpu.c @@ -37,6 +37,13 @@ BUILD_ASSERT((DT_FOREACH_STATUS_OKAY_NODE_VARGS( NODE_HAS_PROP_AND_OR, zephyr_memory_region_mpu) false) == false, "`zephyr,memory-region-mpu` was deprecated in favor of `zephyr,memory-attr`"); +#define NULL_PAGE_DETECT_NODE_FINDER(node_id, prop) \ + (DT_NODE_HAS_PROP(node_id, prop) && (DT_REG_ADDR(node_id) == 0) && \ + (DT_REG_SIZE(node_id) >= CONFIG_CORTEX_M_NULL_POINTER_EXCEPTION_PAGE_SIZE)) || + +#define DT_NULL_PAGE_DETECT_NODE_EXIST \ + (DT_FOREACH_STATUS_OKAY_NODE_VARGS(NULL_PAGE_DETECT_NODE_FINDER, zephyr_memory_attr) false) + /* * Global status variable holding the number of HW MPU region indices, which * have been reserved by the MPU driver to program the static (fixed) memory @@ -470,7 +477,9 @@ int z_arm_mpu_init(void) */ #if defined(CONFIG_NULL_POINTER_EXCEPTION_DETECTION_MPU) #if (defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE)) && \ - (CONFIG_FLASH_BASE_ADDRESS > CONFIG_CORTEX_M_NULL_POINTER_EXCEPTION_PAGE_SIZE) + (CONFIG_FLASH_BASE_ADDRESS > CONFIG_CORTEX_M_NULL_POINTER_EXCEPTION_PAGE_SIZE) && \ + (!DT_NULL_PAGE_DETECT_NODE_EXIST) + #pragma message "Null-Pointer exception detection cannot be configured on un-mapped flash areas" #else const struct z_arm_mpu_partition unmap_region = { diff --git a/boards/arm/mps3/mps3_common.dtsi b/boards/arm/mps3/mps3_common.dtsi index b719e94971679..798af2633103f 100644 --- a/boards/arm/mps3/mps3_common.dtsi +++ b/boards/arm/mps3/mps3_common.dtsi @@ -9,6 +9,7 @@ #include #include #include +#include #include / { @@ -77,6 +78,13 @@ }; }; + null_ptr_detect: null_ptr_detect@0 { + compatible = "zephyr,memory-region"; + /* 0 - CONFIG_CORTEX_M_NULL_POINTER_EXCEPTION_PAGE_SIZE> */ + reg = <0x0 0x400>; + zephyr,memory-region = "NULL_PTR_DETECT"; + zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_FLASH) )>; + }; /* DDR4 - 2G, alternates non-secure/secure every 256M */ ddr4: memory@60000000 { device_type = "memory"; From ca3041f11a37e3d38931a5525c7ac1a444abecdd Mon Sep 17 00:00:00 2001 From: Emilio Benavente Date: Mon, 19 Aug 2024 16:18:03 +0000 Subject: [PATCH 1836/4482] drivers: rtc: Added IRTC Driver Support. Added NXP IRTC Driver support and binding. This driver is expected for users needing Time Date info in their application. The driver additionally has an alarm mode that can be enabled to fire an intterupt when the time and alarm values match. Signed-off-by: Emilio Benavente --- drivers/rtc/CMakeLists.txt | 1 + drivers/rtc/Kconfig | 1 + drivers/rtc/Kconfig.nxp_irtc | 7 + drivers/rtc/rtc_nxp_irtc.c | 397 +++++++++++++++++++++++++++++++++ dts/bindings/rtc/nxp,irtc.yaml | 42 ++++ 5 files changed, 448 insertions(+) create mode 100644 drivers/rtc/Kconfig.nxp_irtc create mode 100644 drivers/rtc/rtc_nxp_irtc.c create mode 100644 dts/bindings/rtc/nxp,irtc.yaml diff --git a/drivers/rtc/CMakeLists.txt b/drivers/rtc/CMakeLists.txt index cd0c7a3ad5832..6b298b969b71c 100644 --- a/drivers/rtc/CMakeLists.txt +++ b/drivers/rtc/CMakeLists.txt @@ -26,3 +26,4 @@ zephyr_library_sources_ifdef(CONFIG_RTC_RPI_PICO rtc_rpi_pico.c) zephyr_library_sources_ifdef(CONFIG_RTC_RV3028 rtc_rv3028.c) zephyr_library_sources_ifdef(CONFIG_RTC_NUMAKER rtc_numaker.c) zephyr_library_sources_ifdef(CONFIG_RTC_XMC4XXX rtc_xmc4xxx.c) +zephyr_library_sources_ifdef(CONFIG_RTC_NXP_IRTC rtc_nxp_irtc.c) diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 2b1d2d29a7a4e..5dd3eaf1301b7 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -58,5 +58,6 @@ source "drivers/rtc/Kconfig.stm32" source "drivers/rtc/Kconfig.numaker" source "drivers/rtc/Kconfig.rv8263" source "drivers/rtc/Kconfig.xmc4xxx" +source "drivers/rtc/Kconfig.nxp_irtc" endif # RTC diff --git a/drivers/rtc/Kconfig.nxp_irtc b/drivers/rtc/Kconfig.nxp_irtc new file mode 100644 index 0000000000000..9935d971e7ca0 --- /dev/null +++ b/drivers/rtc/Kconfig.nxp_irtc @@ -0,0 +1,7 @@ +# Copyright 2024 NXP +# SPDX-License-Identifier: Apache-2.0 + +config RTC_NXP_IRTC + bool "NXP Independent Real Time Clock driver" + default y + depends on DT_HAS_NXP_IRTC_ENABLED diff --git a/drivers/rtc/rtc_nxp_irtc.c b/drivers/rtc/rtc_nxp_irtc.c new file mode 100644 index 0000000000000..adea90f3aabca --- /dev/null +++ b/drivers/rtc/rtc_nxp_irtc.c @@ -0,0 +1,397 @@ +/* + * Copyright 2024 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT nxp_irtc + +#include +#include +#include +#include "rtc_utils.h" + +struct nxp_irtc_config { + RTC_Type *base; + void (*irq_config_func)(const struct device *dev); + bool is_output_clock_enabled; + uint8_t clock_src; + uint8_t alarm_match_flag; +}; + +struct nxp_irtc_data { + bool is_dst_enabled; +#ifdef CONFIG_RTC_ALARM + rtc_alarm_callback alarm_callback; + void *alarm_user_data; + uint16_t alarm_mask; +#endif /* CONFIG_RTC_ALARM */ +}; + +/* The IRTC Offset is 2112 instead of 1900 [2112 - 1900] -> [212] */ +#define RTC_NXP_IRTC_YEAR_OFFSET 212 + +#define RTC_NXP_GET_REG_FIELD(_reg, _name, _field) \ + ((_reg->_name & RTC_##_name##_##_field##_MASK) >> \ + RTC_##_name##_##_field##_SHIFT) + +/* + * The runtime where this is accessed is unknown so we force a lock on the registers then force an + * unlock to guarantee 2 seconds of write time + */ +static void nxp_irtc_unlock_registers(RTC_Type *reg) +{ + /* Lock the regsiters */ + while ((reg->STATUS & (uint16_t)RTC_STATUS_WRITE_PROT_EN_MASK) == 0) { + *(uint8_t *)(®->STATUS) |= RTC_STATUS_WE(0x2); + } + /* Unlock the registers */ + while ((reg->STATUS & (int16_t)RTC_STATUS_WRITE_PROT_EN_MASK) != 0) { + /* + * The casting is required for writing only a single Byte to the STATUS Register, + * the pattern here unlocks all RTC registers for writing. When unlocked if a 0x20 + * if written to the STATUS register the RTC registers will lock again and the next + * write will lead to a fault. + */ + *(volatile uint8_t *)(®->STATUS) = 0x00; + *(volatile uint8_t *)(®->STATUS) = 0x40; + *(volatile uint8_t *)(®->STATUS) = 0xC0; + *(volatile uint8_t *)(®->STATUS) = 0x80; + } +} + +static int nxp_irtc_set_time(const struct device *dev, const struct rtc_time *timeptr) +{ + const struct nxp_irtc_config *config = dev->config; + struct nxp_irtc_data *data = dev->data; + RTC_Type *irtc_reg = config->base; + + if (!timeptr || !rtc_utils_validate_rtc_time(timeptr, 0)) { + return -EINVAL; + } + + int calc_year = timeptr->tm_year - RTC_NXP_IRTC_YEAR_OFFSET; + /* The IRTC Month Index starts at 1 instead of 0 */ + int calc_month = timeptr->tm_mon + 1; + + uint32_t key = irq_lock(); + + nxp_irtc_unlock_registers(irtc_reg); + irtc_reg->SECONDS = RTC_SECONDS_SEC_CNT(timeptr->tm_sec); + + irtc_reg->HOURMIN = RTC_HOURMIN_MIN_CNT(timeptr->tm_min) | + RTC_HOURMIN_HOUR_CNT(timeptr->tm_hour); + + /* 1 is valid for rtc_time.tm_wday property but is out of bounds for IRTC registers */ + irtc_reg->DAYS = RTC_DAYS_DAY_CNT(timeptr->tm_mday) | + (timeptr->tm_wday == -1 ? 0 : RTC_DAYS_DOW(timeptr->tm_wday)); + + irtc_reg->YEARMON = RTC_YEARMON_MON_CNT(calc_month) | RTC_YEARMON_YROFST(calc_year); + + if (timeptr->tm_isdst != -1) { + irtc_reg->CTRL |= RTC_CTRL_DST_EN(timeptr->tm_isdst); + data->is_dst_enabled = true; + } + + irq_unlock(key); + + return 0; +} + +static int nxp_irtc_get_time(const struct device *dev, struct rtc_time *timeptr) +{ + const struct nxp_irtc_config *config = dev->config; + struct nxp_irtc_data *data = dev->data; + RTC_Type *irtc_reg = config->base; + + __ASSERT(timeptr != 0, "timeptr has not been set"); + + timeptr->tm_sec = RTC_NXP_GET_REG_FIELD(irtc_reg, SECONDS, SEC_CNT); + timeptr->tm_min = RTC_NXP_GET_REG_FIELD(irtc_reg, HOURMIN, MIN_CNT); + timeptr->tm_hour = RTC_NXP_GET_REG_FIELD(irtc_reg, HOURMIN, HOUR_CNT); + timeptr->tm_wday = RTC_NXP_GET_REG_FIELD(irtc_reg, DAYS, DOW); + timeptr->tm_mday = RTC_NXP_GET_REG_FIELD(irtc_reg, DAYS, DAY_CNT); + timeptr->tm_mon = RTC_NXP_GET_REG_FIELD(irtc_reg, YEARMON, MON_CNT) - 1; + timeptr->tm_year = (int8_t)RTC_NXP_GET_REG_FIELD(irtc_reg, YEARMON, YROFST) + + RTC_NXP_IRTC_YEAR_OFFSET; + if (data->is_dst_enabled) { + timeptr->tm_isdst = + ((irtc_reg->CTRL & RTC_CTRL_DST_EN_MASK) >> RTC_CTRL_DST_EN_SHIFT); + } + + /* There is no nano second support for IRTC */ + timeptr->tm_nsec = 0; + /* There is no day of the year support for IRTC */ + timeptr->tm_yday = -1; + + return 0; +} + +#if defined(CONFIG_RTC_ALARM) +static int nxp_irtc_alarm_get_supported_fields(const struct device *dev, uint16_t id, + uint16_t *mask) +{ + ARG_UNUSED(dev); + + if (id != 0) { + return -EINVAL; + } + + *mask = (RTC_ALARM_TIME_MASK_SECOND | RTC_ALARM_TIME_MASK_MINUTE | + RTC_ALARM_TIME_MASK_HOUR | RTC_ALARM_TIME_MASK_MONTHDAY | + RTC_ALARM_TIME_MASK_MONTH | RTC_ALARM_TIME_MASK_YEAR); + + return 0; +} + +static int nxp_irtc_alarm_set_time(const struct device *dev, uint16_t id, uint16_t mask, + const struct rtc_time *timeptr) +{ + const struct nxp_irtc_config *config = dev->config; + struct nxp_irtc_data *data = dev->data; + RTC_Type *irtc_reg = config->base; + + if (id != 0 || (mask && (timeptr == 0)) || + (timeptr && !rtc_utils_validate_rtc_time(timeptr, mask))) { + return -EINVAL; + } + + uint32_t key = irq_lock(); + + nxp_irtc_unlock_registers(irtc_reg); + + if (mask & RTC_ALARM_TIME_MASK_SECOND) { + irtc_reg->ALM_SECONDS = RTC_ALM_SECONDS_ALM_SEC(timeptr->tm_sec); + } + + if (mask & RTC_ALARM_TIME_MASK_MINUTE) { + irtc_reg->ALM_HOURMIN = RTC_ALM_HOURMIN_ALM_MIN(timeptr->tm_min); + } + + if (mask & RTC_ALARM_TIME_MASK_HOUR) { + irtc_reg->ALM_HOURMIN |= RTC_ALM_HOURMIN_ALM_HOUR(timeptr->tm_hour); + } + + if (mask & RTC_ALARM_TIME_MASK_MONTHDAY) { + irtc_reg->ALM_DAYS = RTC_ALM_DAYS_ALM_DAY(timeptr->tm_mday); + } + + if (mask & RTC_ALARM_TIME_MASK_MONTH) { + irtc_reg->ALM_YEARMON = RTC_ALM_YEARMON_ALM_MON(timeptr->tm_mon + 1); + } + + if (mask & RTC_ALARM_TIME_MASK_YEAR) { + irtc_reg->ALM_YEARMON |= + RTC_ALM_YEARMON_ALM_YEAR(timeptr->tm_year - RTC_NXP_IRTC_YEAR_OFFSET); + } + + /* Clearing out the ALARM Flag Field then setting the correct value */ + irtc_reg->CTRL &= ~(0xC); + switch (mask) { + case 0x0F: + irtc_reg->CTRL |= RTC_CTRL_ALM_MATCH(0x4); + break; + case 0x1F: + irtc_reg->CTRL |= RTC_CTRL_ALM_MATCH(0x8); + break; + case 0x3F: + irtc_reg->CTRL |= RTC_CTRL_ALM_MATCH(0xC); + break; + default: + irtc_reg->CTRL |= RTC_CTRL_ALM_MATCH(0x0); + } + + /* Enabling Alarm Interrupts */ + irtc_reg->IER |= RTC_ISR_ALM_IS_MASK; + data->alarm_mask = mask; + + irq_unlock(key); + + return 0; +} + +static int nxp_irtc_alarm_get_time(const struct device *dev, uint16_t id, uint16_t *mask, + struct rtc_time *timeptr) +{ + const struct nxp_irtc_config *config = dev->config; + struct nxp_irtc_data *data = dev->data; + RTC_Type *irtc_reg = config->base; + uint16_t curr_alarm_mask = data->alarm_mask; + uint16_t return_mask = 0; + + if (id != 0 || !timeptr) { + return -EINVAL; + } + + if (curr_alarm_mask & RTC_ALARM_TIME_MASK_SECOND) { + timeptr->tm_sec = RTC_NXP_GET_REG_FIELD(irtc_reg, ALM_SECONDS, ALM_SEC); + return_mask |= RTC_ALARM_TIME_MASK_SECOND; + } + + if (curr_alarm_mask & RTC_ALARM_TIME_MASK_MINUTE) { + timeptr->tm_min = RTC_NXP_GET_REG_FIELD(irtc_reg, HOURMIN, MIN_CNT); + return_mask |= RTC_ALARM_TIME_MASK_MINUTE; + } + + if (curr_alarm_mask & RTC_ALARM_TIME_MASK_HOUR) { + timeptr->tm_hour = RTC_NXP_GET_REG_FIELD(irtc_reg, HOURMIN, HOUR_CNT); + return_mask |= RTC_ALARM_TIME_MASK_HOUR; + } + + if (curr_alarm_mask & RTC_ALARM_TIME_MASK_MONTHDAY) { + timeptr->tm_mday = RTC_NXP_GET_REG_FIELD(irtc_reg, DAYS, DAY_CNT); + return_mask |= RTC_ALARM_TIME_MASK_MONTHDAY; + } + + if (curr_alarm_mask & RTC_ALARM_TIME_MASK_MONTH) { + timeptr->tm_mon = RTC_NXP_GET_REG_FIELD(irtc_reg, YEARMON, MON_CNT) - 1; + return_mask |= RTC_ALARM_TIME_MASK_MONTH; + } + + if (curr_alarm_mask & RTC_ALARM_TIME_MASK_YEAR) { + timeptr->tm_year = (int8_t)RTC_NXP_GET_REG_FIELD(irtc_reg, YEARMON, YROFST) + + RTC_NXP_IRTC_YEAR_OFFSET; + return_mask |= RTC_ALARM_TIME_MASK_YEAR; + } + + *mask = return_mask; + + return 0; +} + +static int nxp_irtc_alarm_is_pending(const struct device *dev, uint16_t id) +{ + struct nxp_irtc_data *data = dev->data; + RTC_Type *irtc_reg = config->base; + + if (id != 0) { + return -EINVAL; + } + + return RTC_ISR_ALM_IS(0x4); +} + +static int nxp_irtc_alarm_set_callback(const struct device *dev, uint16_t id, + rtc_alarm_callback callback, void *user_data) +{ + struct nxp_irtc_data *data = dev->data; + + if (id != 0) { + return -EINVAL; + } + + uint32_t key = irq_lock(); + + data->alarm_callback = callback; + data->alarm_user_data = user_data; + + irq_unlock(key); + + return 0; +} + +#endif /* CONFIG_RTC_ALARM */ +#if defined(CONFIG_RTC_UPDATE) + +static int nxp_irtc_update_set_callback(const struct device *dev, rtc_update_callback callback, + void *user_data) +{ + ARG_UNUSED(dev); + ARG_UNUSED(calibration); + ARG_UNUSED(user_data); + return -ENOTSUP; +} + +#endif /* CONFIG_RTC_UPDATE */ +#if defined(CONFIG_RTC_CALIBRATION) + +static int nxp_irtc_set_calibration(const struct device *dev, int32_t calibration) +{ + ARG_UNUSED(dev); + ARG_UNUSED(calibration); + return -ENOTSUP; +} + +static int nxp_irtc_get_calibration(const struct device *dev, int32_t *calibration) +{ + ARG_UNUSED(dev); + ARG_UNUSED(calibration); + return -ENOTSUP; +} + +#endif /* CONFIG_RTC_CALIBRATION */ + +static int nxp_irtc_init(const struct device *dev) +{ + const struct nxp_irtc_config *config = dev->config; + RTC_Type *irtc_reg = config->base; + + nxp_irtc_unlock_registers(irtc_reg); + + /* set the control register bits */ + irtc_reg->CTRL = RTC_CTRL_CLK_SEL(config->clock_src) | + RTC_CTRL_CLKO_DIS(!config->is_output_clock_enabled); + + config->irq_config_func(dev); + + return 0; +} + +static void nxp_irtc_isr(const struct device *dev) +{ +#ifdef CONFIG_RTC_ALARM + const struct nxp_irtc_config *config = dev->config; + RTC_Type *irtc_reg = config->base; + struct nxp_irtc_data *data = dev->data; + uint32_t key = irq_lock(); + + nxp_irtc_unlock_registers(irtc_reg); + /* Clearing ISR Register since w1c */ + irtc_reg->ISR = irtc_reg->ISR; + + if (data->alarm_callback) { + data->alarm_callback(dev, 0, data->alarm_user_data); + } + irq_unlock(key); +#endif /* CONFIG_RTC_ALARM */ +} + +static const struct rtc_driver_api rtc_nxp_irtc_driver_api = { + .set_time = nxp_irtc_set_time, + .get_time = nxp_irtc_get_time, +#if defined(CONFIG_RTC_ALARM) + .alarm_get_supported_fields = nxp_irtc_alarm_get_supported_fields, + .alarm_set_time = nxp_irtc_alarm_set_time, + .alarm_get_time = nxp_irtc_alarm_get_time, + .alarm_is_pending = nxp_irtc_alarm_is_pending, + .alarm_set_callback = nxp_irtc_alarm_set_callback, +#endif /* CONFIG_RTC_ALARM */ +#if defined(CONFIG_RTC_UPDATE) + .update_set_callback = nxp_irtc_update_set_callback, +#endif /* CONFIG_RTC_UPDATE */ +#if defined(CONFIG_RTC_CALIBRATION) + .set_calibration = nxp_irtc_set_calibration, + .get_calibration = nxp_irtc_get_calibration, +#endif /* CONFIG_RTC_CALIBRATION */ +}; + +#define RTC_NXP_IRTC_DEVICE_INIT(n) \ + static void nxp_irtc_config_func_##n(const struct device *dev) \ + { \ + IRQ_CONNECT(DT_INST_IRQN(n), DT_INST_IRQ(n, priority), nxp_irtc_isr, \ + DEVICE_DT_INST_GET(n), 0); \ + irq_enable(DT_INST_IRQN(n)); \ + } \ + static const struct nxp_irtc_config nxp_irtc_config_##n = { \ + .base = (RTC_Type *)DT_INST_REG_ADDR(n), \ + .clock_src = DT_INST_PROP(n, clock_src), \ + .is_output_clock_enabled = DT_INST_PROP(n, output_clk_en), \ + .irq_config_func = nxp_irtc_config_func_##n, \ + }; \ + \ + static struct nxp_irtc_data nxp_irtc_data_##n; \ + \ + DEVICE_DT_INST_DEFINE(n, nxp_irtc_init, NULL, &nxp_irtc_data_##n, &nxp_irtc_config_##n, \ + PRE_KERNEL_1, CONFIG_RTC_INIT_PRIORITY, &rtc_nxp_irtc_driver_api); + +DT_INST_FOREACH_STATUS_OKAY(RTC_NXP_IRTC_DEVICE_INIT) diff --git a/dts/bindings/rtc/nxp,irtc.yaml b/dts/bindings/rtc/nxp,irtc.yaml new file mode 100644 index 0000000000000..7b25ce1d4ce93 --- /dev/null +++ b/dts/bindings/rtc/nxp,irtc.yaml @@ -0,0 +1,42 @@ +# Copyright 2024 NXP +# SPDX-License-Identifier: Apache-2.0 + +description: IRTC + +compatible: "nxp,irtc" + +include: + - name: rtc.yaml + - name: rtc-device.yaml + +properties: + reg: + required: true + + clock-src: + type: int + required: true + enum: + - 0 + - 1 + description: | + The input clock select for IRTC. + 0 <- 16.384 kHz + 1 <- 32.768 kHz + + output-clk-en: + type: int + default: 0 + enum: + - 0 + - 1 + - 2 + - 3 + description: | + Enable clock as an output for other peripherals to use. + 0 <- No clock output + 1 <- Fine 1Hz + 2 <- Buffered Oscillator Clock + 3 <- Coarse 1Hz + Default value ensures the output clock is turned off. + This is the reset value. From 4d77aa1eff68ee9bff9dfbc5c010bad38affa8a6 Mon Sep 17 00:00:00 2001 From: Emilio Benavente Date: Mon, 19 Aug 2024 16:16:03 +0000 Subject: [PATCH 1837/4482] drivers: clock_control: syscon: Added Clock support for IRTC. Added Clock Support code for the MCXN947 when IRTC is enabled. Signed-off-by: Emilio Benavente --- .../clock_control/clock_control_mcux_syscon.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/clock_control/clock_control_mcux_syscon.c b/drivers/clock_control/clock_control_mcux_syscon.c index 70226a5570fac..ca772e2cdd459 100644 --- a/drivers/clock_control/clock_control_mcux_syscon.c +++ b/drivers/clock_control/clock_control_mcux_syscon.c @@ -113,6 +113,23 @@ static int mcux_lpc_syscon_clock_control_on(const struct device *dev, } #endif +#if DT_NODE_HAS_STATUS(DT_NODELABEL(rtc), okay) +#if CONFIG_SOC_SERIES_IMXRT5XX + CLOCK_EnableOsc32K(true); +#elif CONFIG_SOC_SERIES_IMXRT6XX + /* No configuration */ +#else /* !CONFIG_SOC_SERIES_IMXRT5XX | !CONFIG_SOC_SERIES_IMXRT6XX */ +/* 0x0 Clock Select Value Set IRTC to use FRO 16K Clk */ +#if DT_PROP(DT_NODELABEL(rtc), clock_select) == 0x0 + CLOCK_SetupClk16KClocking(kCLOCK_Clk16KToVbat | kCLOCK_Clk16KToMain); +/* 0x1 Clock Select Value Set IRTC to use Osc 32K Clk */ +#elif DT_PROP(DT_NODELABEL(rtc), clock_select) == 0x1 + CLOCK_SetupOsc32KClocking(kCLOCK_Osc32kToVbat | kCLOCK_Osc32kToMain); +#endif /* DT_PROP(DT_NODELABEL(rtc), clock_select) */ + CLOCK_EnableClock(kCLOCK_Rtc0); +#endif /* CONFIG_SOC_SERIES_IMXRT5XX */ +#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(rtc), okay) */ + return 0; } From 97b73b323484f2f8bec0c5f0785f242285539421 Mon Sep 17 00:00:00 2001 From: Emilio Benavente Date: Mon, 19 Aug 2024 16:11:44 +0000 Subject: [PATCH 1838/4482] dts: arm: nxp: Added IRTC Binding. Added IRTC Binding Support. Applied Binding support for MCXN94x Devices. Signed-off-by: Emilio Benavente --- dts/arm/nxp/nxp_mcxn94x_common.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dts/arm/nxp/nxp_mcxn94x_common.dtsi b/dts/arm/nxp/nxp_mcxn94x_common.dtsi index 880442c40bb95..3a4548f4d1b7b 100644 --- a/dts/arm/nxp/nxp_mcxn94x_common.dtsi +++ b/dts/arm/nxp/nxp_mcxn94x_common.dtsi @@ -997,6 +997,17 @@ status = "disabled"; }; }; + + rtc: rtc@4c000 { + compatible = "nxp,irtc"; + reg = <0x4c000 0x1000>; + status = "disabled"; + interrupts = <52 0>; + prescaler = <1>; + clock-frequency = <16384>; + clock-src = <0>; + alarms-count = <1>; + }; }; &systick { From 58b8d38cabc207266edb0558e6e533d403a43666 Mon Sep 17 00:00:00 2001 From: Emilio Benavente Date: Mon, 19 Aug 2024 16:21:45 +0000 Subject: [PATCH 1839/4482] boards: nxp: frdm_mcxn947: Enabled IRTC Driver. Enabling the IRTC Driver for the frdm_mcxn947 board cpu0. Signed-off-by: Emilio Benavente --- boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi b/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi index 816a315cbfbab..cad61c08cbf7c 100644 --- a/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi +++ b/boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi @@ -32,6 +32,7 @@ aliases{ watchdog0 = &wwdt0; pwm-0 = &flexpwm1_pwm0; + rtc = &rtc; }; }; @@ -200,3 +201,7 @@ zephyr_udc0: &usb1 { &mrt0_channel0 { status = "okay"; }; + +&rtc { + status = "okay"; +}; From f268bfa41913975e83d3c66395e6bf6e7a95a4f4 Mon Sep 17 00:00:00 2001 From: Andries Kruithof Date: Tue, 23 Jul 2024 11:29:03 +0200 Subject: [PATCH 1840/4482] Bluetooth: Audio: shell command for broadcast reception stop Implement the shell command for the CAP procedure 'broadcast reception stop' Signed-off-by: Andries Kruithof --- .../bluetooth/api/audio/shell/cap.rst | 31 +++--- subsys/bluetooth/audio/shell/cap_commander.c | 94 +++++++++++++++++++ 2 files changed, 114 insertions(+), 11 deletions(-) diff --git a/doc/connectivity/bluetooth/api/audio/shell/cap.rst b/doc/connectivity/bluetooth/api/audio/shell/cap.rst index 57dc7e19d83c2..9a9c520e3fd8d 100644 --- a/doc/connectivity/bluetooth/api/audio/shell/cap.rst +++ b/doc/connectivity/bluetooth/api/audio/shell/cap.rst @@ -257,15 +257,20 @@ the optionally included CSIS instance by calling (:code:`cap_commander discover` cap_commander --help cap_commander - Bluetooth CAP commander shell commands Subcommands: - discover :Discover CAS - cancel :CAP commander cancel current procedure - change_volume :Change volume on all connections - change_volume_mute :Change volume mute state on all connections - change_volume_offset :Change volume offset per connection - change_microphone_mute :Change microphone mute state on all connections - change_microphone_gain :Change microphone gain per connection + discover :Discover CAS + cancel :CAP commander cancel current procedure + change_volume :Change volume on all connections + change_volume_mute :Change volume mute state on all connections + change_volume_offset :Change volume offset per connection + change_microphone_mute :Change microphone mute state on all connections + change_microphone_gain :Change microphone gain per connection + broadcast_reception_start : Start broadcast reception with + source + + [] [] [] + broadcast_reception_stop : Stop broadcast reception Before being able to perform any stream operation, the device must also perform the @@ -437,8 +442,8 @@ and index 1 gets the second offset, etc.: Gain set for inst 0x20014188 Microphone gain change completed -Starting a broadcast reception -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Starting and stopping broadcast reception +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: console @@ -451,3 +456,7 @@ Starting a broadcast reception BASS discover done with 1 recv states uart:~$ cap_commander broadcast_reception_start 0 4 Starting broadcast reception on 1 connection(s) + Broadcast reception start completed + uart:~$ cap_commander broadcast_reception_stop 0 + Stopping broadcast reception on 1 connection(s) + Broadcast reception stop completed diff --git a/subsys/bluetooth/audio/shell/cap_commander.c b/subsys/bluetooth/audio/shell/cap_commander.c index 579039b34938c..3cee3a396483c 100644 --- a/subsys/bluetooth/audio/shell/cap_commander.c +++ b/subsys/bluetooth/audio/shell/cap_commander.c @@ -103,6 +103,17 @@ static void cap_broadcast_reception_start_cb(struct bt_conn *conn, int err) shell_print(ctx_shell, "Broadcast reception start completed"); } + +static void cap_broadcast_reception_stop_cb(struct bt_conn *conn, int err) +{ + if (err != 0) { + shell_error(ctx_shell, "Broadcast reception stop failed (%d) for conn %p", err, + (void *)conn); + return; + } + + shell_print(ctx_shell, "Broadcast reception stop completed"); +} #endif static struct bt_cap_commander_cb cbs = { @@ -122,6 +133,7 @@ static struct bt_cap_commander_cb cbs = { #endif /* CONFIG_BT_MICP_MIC_CTLR */ #if defined(CONFIG_BT_BAP_BROADCAST_ASSISTANT) .broadcast_reception_start = cap_broadcast_reception_start_cb, + .broadcast_reception_stop = cap_broadcast_reception_stop_cb, #endif /* CONFIG_BT_BAP_BROADCAST_ASSISTANT */ }; @@ -662,6 +674,83 @@ static int cmd_cap_commander_broadcast_reception_start(const struct shell *sh, s return 0; } + +static int cmd_cap_commander_broadcast_reception_stop(const struct shell *sh, size_t argc, + char *argv[]) +{ + struct bt_cap_commander_broadcast_reception_stop_member_param + member_params[CONFIG_BT_MAX_CONN] = {0}; + const size_t cap_args = argc - 1; /* First argument is the command itself */ + struct bt_cap_commander_broadcast_reception_stop_param param = { + .type = BT_CAP_SET_TYPE_AD_HOC, + .param = member_params, + }; + + struct bt_conn *connected_conns[CONFIG_BT_MAX_CONN] = {0}; + size_t conn_cnt = 0U; + int err = 0; + + if (default_conn == NULL) { + shell_error(sh, "Not connected"); + return -ENOEXEC; + } + + /* TODO: Add support for coordinated sets */ + + /* Populate the array of connected connections */ + bt_conn_foreach(BT_CONN_TYPE_LE, populate_connected_conns, (void *)connected_conns); + for (size_t i = 0; i < ARRAY_SIZE(connected_conns); i++) { + struct bt_conn *conn = connected_conns[i]; + + if (conn == NULL) { + break; + } + + conn_cnt++; + } + + if (cap_args > conn_cnt) { + shell_error(sh, "Cannot use %zu arguments for %zu connections", argc, conn_cnt); + + return -ENOEXEC; + } + + for (size_t i = 0U; i < cap_args; i++) { + const char *arg = argv[i + 1]; + unsigned long src_id; + + src_id = shell_strtoul(arg, 0, &err); + if (err != 0) { + shell_error(sh, "Could not parse src_id: %d", err); + + return -ENOEXEC; + } + + if (src_id > UINT8_MAX) { + shell_error(sh, "Invalid src_id: %lu", src_id); + + return -ENOEXEC; + } + + /* TODO: Allow for multiple subgroups */ + member_params[i].num_subgroups = 1; + member_params[i].src_id = src_id; + member_params[i].member.member = connected_conns[i]; + param.count++; + } + + shell_print(sh, "Stopping broadcast reception on %zu connection(s)", param.count); + + err = bt_cap_commander_broadcast_reception_stop(¶m); + if (err != 0) { + shell_print(sh, "Failed to initiate broadcast reception stop: %d", err); + + return -ENOEXEC; + } + + return 0; +} + #endif /* CONFIG_BT_BAP_BROADCAST_ASSISTANT */ static int cmd_cap_commander(const struct shell *sh, size_t argc, char **argv) @@ -710,6 +799,11 @@ SHELL_STATIC_SUBCMD_SET_CREATE( " [] [] " "[]", cmd_cap_commander_broadcast_reception_start, 5, 3), + SHELL_CMD_ARG(broadcast_reception_stop, NULL, + "Stop broadcast reception " + "", + cmd_cap_commander_broadcast_reception_stop, 2, 0), + #endif /* CONFIG_BT_BAP_BROADCAST_ASSISTANT */ SHELL_SUBCMD_SET_END); From 4a8a035bd7b9178e6ae31d56e931aa9b9a40f9b9 Mon Sep 17 00:00:00 2001 From: Ben Booher Date: Thu, 20 Jun 2024 14:45:49 -0400 Subject: [PATCH 1841/4482] drivers: sensor: dacx3608: add broadcast register for synchronized output The dacx3608 line supports a broadcast register so all configured channels can output a singular value, simultaneously. This drastically reduces I2C overhead when using multi-channel control. An API addition was necessary to support a global broadcast channel number. The API addition does not break the write_value() implementation for other DAC drivers in the repo. This change is based on an out-of-tree driver developed internally to handle this use case. Alternative to the API change, could be a KConfig option or device tree entry. Also, no support for the Broadcast channel was added to the channel_setup() implementation - this may or may not be confusing. I believe it makes sense to maintain explicit setup calls for each channel intended to be configured. Signed-off-by: Ben Booher --- drivers/dac/dac_dacx3608.c | 14 +++++++++++--- include/zephyr/drivers/dac.h | 6 ++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/dac/dac_dacx3608.c b/drivers/dac/dac_dacx3608.c index e2340422020c7..cb6210c4483ce 100644 --- a/drivers/dac/dac_dacx3608.c +++ b/drivers/dac/dac_dacx3608.c @@ -135,12 +135,18 @@ static int dacx3608_write_value(const struct device *dev, uint8_t channel, uint16_t regval; int ret; - if (channel > DACX3608_MAX_CHANNEL - 1) { + const bool brdcast = (channel == DAC_CHANNEL_BROADCAST) ? 1 : 0; + + if (!brdcast && (channel > DACX3608_MAX_CHANNEL - 1)) { LOG_ERR("Unsupported channel %d", channel); return -ENOTSUP; } - if (!(data->configured & BIT(channel))) { + /* + * Check if channel is initialized + * If broadcast channel is used, check if any channel is initialized + */ + if ((brdcast && !data->configured) || (!(data->configured & BIT(channel)))) { LOG_ERR("Channel %d not initialized", channel); return -EINVAL; } @@ -162,7 +168,9 @@ static int dacx3608_write_value(const struct device *dev, uint8_t channel, regval = value << 2; regval &= 0xFFFF; - ret = dacx3608_reg_write(dev, DACX3608_REG_DACA_DATA + channel, regval); + const uint8_t reg = brdcast ? DACX3608_REG_BRDCAST : DACX3608_REG_DACA_DATA + channel; + + ret = dacx3608_reg_write(dev, reg, regval); if (ret) { LOG_ERR("Unable to set value %d on channel %d", value, channel); return -EIO; diff --git a/include/zephyr/drivers/dac.h b/include/zephyr/drivers/dac.h index e6f696fc9dc4c..fea4e3298fadf 100644 --- a/include/zephyr/drivers/dac.h +++ b/include/zephyr/drivers/dac.h @@ -27,6 +27,12 @@ extern "C" { * @{ */ +/** + * @brief Broadcast channel identifier for DACs that support it. + * @note Only for use in dac_write_value(). + */ +#define DAC_CHANNEL_BROADCAST 0xFF + /** * @brief Structure for specifying the configuration of a DAC channel. */ From 9a50c10b346d64e330b09b6b1ac14fcee442c7f8 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Fri, 25 Oct 2024 17:45:55 +0200 Subject: [PATCH 1842/4482] drivers/wifi/winc1500: Fix build warnings with 64bit targets Fix a set of warnings like: drivers/wifi/winc1500/wifi_winc1500.c:332:25: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] 332 | SOCKET socket = (int)context->offload_context; when int and void* do not have the same size, by casting the content of context->offload_context to intptr_t which is whichever integer size matches the pointer size. Signed-off-by: Alberto Escolar Piedras --- drivers/wifi/winc1500/wifi_winc1500.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/wifi/winc1500/wifi_winc1500.c b/drivers/wifi/winc1500/wifi_winc1500.c index 588a2e3e0dcd1..8ef41f71215eb 100644 --- a/drivers/wifi/winc1500/wifi_winc1500.c +++ b/drivers/wifi/winc1500/wifi_winc1500.c @@ -329,7 +329,7 @@ static int winc1500_bind(struct net_context *context, const struct sockaddr *addr, socklen_t addrlen) { - SOCKET socket = (int)context->offload_context; + SOCKET socket = (intptr_t)context->offload_context; int ret; /* FIXME atmel winc1500 don't support bind on null port */ @@ -337,8 +337,7 @@ static int winc1500_bind(struct net_context *context, return 0; } - ret = bind((int)context->offload_context, (struct sockaddr *)addr, - addrlen); + ret = bind((intptr_t)context->offload_context, (struct sockaddr *)addr, addrlen); if (ret) { LOG_ERR("bind error %d %s!", ret, socket_message_to_string(ret)); @@ -360,10 +359,10 @@ static int winc1500_bind(struct net_context *context, */ static int winc1500_listen(struct net_context *context, int backlog) { - SOCKET socket = (int)context->offload_context; + SOCKET socket = (intptr_t)context->offload_context; int ret; - ret = listen((int)context->offload_context, backlog); + ret = listen((intptr_t)context->offload_context, backlog); if (ret) { LOG_ERR("listen error %d %s!", ret, socket_error_string(ret)); @@ -389,7 +388,7 @@ static int winc1500_connect(struct net_context *context, int32_t timeout, void *user_data) { - SOCKET socket = (int)context->offload_context; + SOCKET socket = (intptr_t)context->offload_context; int ret; w1500_data.socket_data[socket].connect_cb = cb; @@ -420,7 +419,7 @@ static int winc1500_accept(struct net_context *context, int32_t timeout, void *user_data) { - SOCKET socket = (int)context->offload_context; + SOCKET socket = (intptr_t)context->offload_context; int ret; w1500_data.socket_data[socket].accept_cb = cb; @@ -452,7 +451,7 @@ static int winc1500_send(struct net_pkt *pkt, void *user_data) { struct net_context *context = pkt->context; - SOCKET socket = (int)context->offload_context; + SOCKET socket = (intptr_t)context->offload_context; int ret = 0; struct net_buf *buf; @@ -492,7 +491,7 @@ static int winc1500_sendto(struct net_pkt *pkt, void *user_data) { struct net_context *context = pkt->context; - SOCKET socket = (int)context->offload_context; + SOCKET socket = (intptr_t)context->offload_context; int ret = 0; struct net_buf *buf; @@ -556,7 +555,7 @@ static int winc1500_recv(struct net_context *context, int32_t timeout, void *user_data) { - SOCKET socket = (int) context->offload_context; + SOCKET socket = (intptr_t)context->offload_context; int ret; w1500_data.socket_data[socket].recv_cb = cb; @@ -588,7 +587,7 @@ static int winc1500_recv(struct net_context *context, */ static int winc1500_put(struct net_context *context) { - SOCKET sock = (int) context->offload_context; + SOCKET sock = (intptr_t)context->offload_context; struct socket_data *sd = &w1500_data.socket_data[sock]; int ret; @@ -899,10 +898,9 @@ static void handle_socket_msg_accept(struct socket_data *sd, void *pvMsg) * context as well. The new context gives us another socket * so we have to close that one first. */ - winc1500_close((int)a_sd->context->offload_context); + winc1500_close((intptr_t)a_sd->context->offload_context); - a_sd->context->offload_context = - (void *)((int)accept_msg->sock); + a_sd->context->offload_context = (void *)((intptr_t)accept_msg->sock); /** The iface is reset when getting a new context. */ a_sd->context->iface = sd->context->iface; From 367f853a4c95fd90b0021504b9f6b436009ccb34 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Fri, 25 Oct 2024 08:17:00 +0200 Subject: [PATCH 1843/4482] drivers: stepper: rename compatible of gpio-stepper This commit fixes minor copyright issues and corrects the compatible of gpio-stepper with the vendor name as zephyr Signed-off-by: Jilay Pandya --- drivers/stepper/Kconfig.gpio | 3 ++- drivers/stepper/gpio_stepper_controller.c | 3 ++- ...io-stepper-controller.yaml => zephyr,gpio-stepper.yaml} | 5 +++-- .../stepper/stepper_api/boards/nucleo_g071rb.overlay | 7 ++++++- .../drivers/stepper/stepper_api/boards/qemu_x86_64.overlay | 4 ++-- 5 files changed, 15 insertions(+), 7 deletions(-) rename dts/bindings/stepper/{gpio-stepper-controller.yaml => zephyr,gpio-stepper.yaml} (86%) diff --git a/drivers/stepper/Kconfig.gpio b/drivers/stepper/Kconfig.gpio index eae1f8d1ca46a..126ebf179fcd5 100644 --- a/drivers/stepper/Kconfig.gpio +++ b/drivers/stepper/Kconfig.gpio @@ -1,11 +1,12 @@ # SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG +# SPDX-FileCopyrightText: Copyright (c) 2024 Jilay Sandeep Pandya # SPDX-License-Identifier: Apache-2.0 menu "GPIO stepper driver" config GPIO_STEPPER bool "Activate driver for gpio stepper control" - depends on DT_HAS_GPIO_STEPPERS_ENABLED + depends on DT_HAS_ZEPHYR_GPIO_STEPPERS_ENABLED default y help GPIO Stepper driver for stepper motor control with darlington arrays or dual H-bridge. diff --git a/drivers/stepper/gpio_stepper_controller.c b/drivers/stepper/gpio_stepper_controller.c index fc68d551295d7..9fb4f333aa241 100644 --- a/drivers/stepper/gpio_stepper_controller.c +++ b/drivers/stepper/gpio_stepper_controller.c @@ -1,9 +1,10 @@ /* * SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG + * SPDX-FileCopyrightText: Copyright (c) 2024 Jilay Sandeep Pandya * SPDX-License-Identifier: Apache-2.0 */ -#define DT_DRV_COMPAT gpio_steppers +#define DT_DRV_COMPAT zephyr_gpio_steppers #include #include diff --git a/dts/bindings/stepper/gpio-stepper-controller.yaml b/dts/bindings/stepper/zephyr,gpio-stepper.yaml similarity index 86% rename from dts/bindings/stepper/gpio-stepper-controller.yaml rename to dts/bindings/stepper/zephyr,gpio-stepper.yaml index fcd1860325531..d094b14a48bf0 100644 --- a/dts/bindings/stepper/gpio-stepper-controller.yaml +++ b/dts/bindings/stepper/zephyr,gpio-stepper.yaml @@ -1,4 +1,5 @@ # SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG +# SPDX-FileCopyrightText: Copyright (c) 2024 Jilay Sandeep Pandya # SPDX-License-Identifier: Apache-2.0 description: | @@ -7,7 +8,7 @@ description: | Example: /* Lead A is connected Lead C and Lead B is connected to Lead D*/ stepper { - compatible = "gpio-steppers"; + compatible = "zephyr,gpio-steppers"; motor: motor { gpios = <&gpioa 9 GPIO_ACTIVE_HIGH>, /* Lead A1/A */ <&gpioc 7 GPIO_ACTIVE_HIGH>, /* Lead B1/B */ @@ -16,7 +17,7 @@ description: | }; }; -compatible: "gpio-steppers" +compatible: "zephyr,gpio-steppers" child-binding: description: GPIO Controller for stepper motor diff --git a/tests/drivers/stepper/stepper_api/boards/nucleo_g071rb.overlay b/tests/drivers/stepper/stepper_api/boards/nucleo_g071rb.overlay index bc6d449a4bacd..80b58d3fd5e1b 100644 --- a/tests/drivers/stepper/stepper_api/boards/nucleo_g071rb.overlay +++ b/tests/drivers/stepper/stepper_api/boards/nucleo_g071rb.overlay @@ -1,6 +1,11 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2024 Jilay Sandeep Pandya + * SPDX-License-Identifier: Apache-2.0 + */ + / { uln2003_motor: uln2003_1 { - compatible = "gpio-steppers"; + compatible = "zephyr,gpio-steppers"; status = "okay"; motor_1: motor_1 { micro-step-res = <1>; diff --git a/tests/drivers/stepper/stepper_api/boards/qemu_x86_64.overlay b/tests/drivers/stepper/stepper_api/boards/qemu_x86_64.overlay index 37615c025ff10..72de2d2ecc7ac 100644 --- a/tests/drivers/stepper/stepper_api/boards/qemu_x86_64.overlay +++ b/tests/drivers/stepper/stepper_api/boards/qemu_x86_64.overlay @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Jilay Sandeep Pandya + * SPDX-FileCopyrightText: Copyright (c) 2024 Jilay Sandeep Pandya * SPDX-License-Identifier: Apache-2.0 */ @@ -20,7 +20,7 @@ / { test_uln2003_motor_cluster: uln2003_motor_cluster { - compatible = "gpio-steppers"; + compatible = "zephyr,gpio-steppers"; status = "okay"; motor_1: motor_1 { From 0687522cd4f9069d01ef750659b62f80d37ef3e3 Mon Sep 17 00:00:00 2001 From: Jilay Pandya Date: Fri, 25 Oct 2024 08:19:32 +0200 Subject: [PATCH 1844/4482] drivers: stepper: introduce invert-direction property to gpio-stepper This commit introduces invert-direction property to gpio-stepper Signed-off-by: Jilay Pandya --- drivers/stepper/gpio_stepper_controller.c | 42 ++++++++++++++----- dts/bindings/stepper/zephyr,gpio-stepper.yaml | 1 + 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/drivers/stepper/gpio_stepper_controller.c b/drivers/stepper/gpio_stepper_controller.c index 9fb4f333aa241..ad59b734db16f 100644 --- a/drivers/stepper/gpio_stepper_controller.c +++ b/drivers/stepper/gpio_stepper_controller.c @@ -25,6 +25,7 @@ static const uint8_t struct gpio_stepper_config { const struct gpio_dt_spec *control_pins; + bool invert_direction; }; struct gpio_stepper_data { @@ -54,20 +55,38 @@ static int stepper_motor_set_coil_charge(const struct device *dev) return 0; } +static void increment_coil_charge(const struct device *dev) +{ + struct gpio_stepper_data *data = dev->data; + + if (data->coil_charge == NUM_CONTROL_PINS * MAX_MICRO_STEP_RES - data->step_gap) { + data->coil_charge = 0; + } else { + data->coil_charge = data->coil_charge + data->step_gap; + } +} + +static void decrement_coil_charge(const struct device *dev) +{ + struct gpio_stepper_data *data = dev->data; + + if (data->coil_charge == 0) { + data->coil_charge = NUM_CONTROL_PINS * MAX_MICRO_STEP_RES - data->step_gap; + } else { + data->coil_charge = data->coil_charge - data->step_gap; + } +} + static void update_coil_charge(const struct device *dev) { + const struct gpio_stepper_config *config = dev->config; struct gpio_stepper_data *data = dev->data; if (data->direction == STEPPER_DIRECTION_POSITIVE) { - data->coil_charge = data->coil_charge == 0 - ? NUM_CONTROL_PINS * MAX_MICRO_STEP_RES - data->step_gap - : data->coil_charge - data->step_gap; + config->invert_direction ? decrement_coil_charge(dev) : increment_coil_charge(dev); data->actual_position++; } else if (data->direction == STEPPER_DIRECTION_NEGATIVE) { - data->coil_charge = - data->coil_charge == NUM_CONTROL_PINS * MAX_MICRO_STEP_RES - data->step_gap - ? 0 - : data->coil_charge + data->step_gap; + config->invert_direction ? increment_coil_charge(dev) : decrement_coil_charge(dev); data->actual_position--; } } @@ -89,8 +108,10 @@ static void update_remaining_steps(struct gpio_stepper_data *data) } } -static void update_direction_from_step_count(struct gpio_stepper_data *data) +static void update_direction_from_step_count(const struct device *dev) { + struct gpio_stepper_data *data = dev->data; + if (data->step_count > 0) { data->direction = STEPPER_DIRECTION_POSITIVE; } else if (data->step_count < 0) { @@ -152,7 +173,7 @@ static int gpio_stepper_move(const struct device *dev, int32_t micro_steps) K_SPINLOCK(&data->lock) { data->run_mode = STEPPER_RUN_MODE_POSITION; data->step_count = micro_steps; - update_direction_from_step_count(data); + update_direction_from_step_count(dev); (void)k_work_reschedule(&data->stepper_dwork, K_NO_WAIT); } return 0; @@ -189,7 +210,7 @@ static int gpio_stepper_set_target_position(const struct device *dev, int32_t po K_SPINLOCK(&data->lock) { data->run_mode = STEPPER_RUN_MODE_POSITION; data->step_count = position - data->actual_position; - update_direction_from_step_count(data); + update_direction_from_step_count(dev); (void)k_work_reschedule(&data->stepper_dwork, K_NO_WAIT); } return 0; @@ -327,6 +348,7 @@ static int gpio_stepper_motor_controller_init(const struct device *dev) ARRAY_SIZE(gpio_stepper_motor_control_pins_##child) == 4, \ "gpio_stepper_controller driver currently supports only 4 wire configuration"); \ static const struct gpio_stepper_config gpio_stepper_config_##child = { \ + .invert_direction = DT_PROP(child, invert_direction), \ .control_pins = gpio_stepper_motor_control_pins_##child}; #define GPIO_STEPPER_API_DEFINE(child) \ diff --git a/dts/bindings/stepper/zephyr,gpio-stepper.yaml b/dts/bindings/stepper/zephyr,gpio-stepper.yaml index d094b14a48bf0..58c6e029b9f37 100644 --- a/dts/bindings/stepper/zephyr,gpio-stepper.yaml +++ b/dts/bindings/stepper/zephyr,gpio-stepper.yaml @@ -25,6 +25,7 @@ child-binding: - name: stepper-controller.yaml property-allowlist: - micro-step-res + - invert-direction properties: gpios: From 4f88301bc9682a3635928f850083c4ad181fdc0f Mon Sep 17 00:00:00 2001 From: Daniel Baluta Date: Wed, 23 Oct 2024 18:46:09 +0300 Subject: [PATCH 1845/4482] drivers: sai: Use 0x0 as clock id if none is provided We use the name cell at a given index to retrieve a clock's id. But not all clocks provide a name cell, so use 0x0 as clock-id for these situations. Signed-off-by: Daniel Baluta --- drivers/dai/nxp/sai/sai.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dai/nxp/sai/sai.h b/drivers/dai/nxp/sai/sai.h index 1abf41e68a2b3..0704274433468 100644 --- a/drivers/dai/nxp/sai/sai.h +++ b/drivers/dai/nxp/sai/sai.h @@ -38,7 +38,7 @@ LOG_MODULE_REGISTER(nxp_dai_sai); /* used to retrieve a clock's ID using its index generated via _SAI_CLOCK_INDEX_ARRAY */ #define _SAI_GET_CLOCK_ID(clock_idx, inst)\ - DT_INST_CLOCKS_CELL_BY_IDX(inst, clock_idx, name) + DT_INST_PHA_BY_IDX_OR(inst, clocks, clock_idx, name, 0x0) /* used to retrieve a clock's name using its index generated via _SAI_CLOCK_INDEX_ARRAY */ #define _SAI_GET_CLOCK_NAME(clock_idx, inst)\ From 4e879ab518e27c9e30daa1d5080ed531c15d7671 Mon Sep 17 00:00:00 2001 From: Savent Gate Date: Wed, 23 Oct 2024 21:07:56 +0800 Subject: [PATCH 1846/4482] drivers: watchdog: wdt_dw: add missing header Needs zephyr/irq.h to compile it. Signed-off-by: Savent Gate --- drivers/watchdog/wdt_dw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/watchdog/wdt_dw.c b/drivers/watchdog/wdt_dw.c index fd0e338a4c36b..d65b5e315c907 100644 --- a/drivers/watchdog/wdt_dw.c +++ b/drivers/watchdog/wdt_dw.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "wdt_dw.h" #include "wdt_dw_common.h" From 46cc7a054df62302d60fe9eaa43c5a30470bf820 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Sun, 29 Sep 2024 16:16:22 +0200 Subject: [PATCH 1847/4482] scripts: west_commands: spdx: Remove deprecated west.log The global state west.log is deprecated, replace with WestCommand logging. Signed-off-by: Pieter De Gendt --- scripts/west_commands/spdx.py | 117 +++++++++++++++++----------------- 1 file changed, 58 insertions(+), 59 deletions(-) diff --git a/scripts/west_commands/spdx.py b/scripts/west_commands/spdx.py index 58e79f87f7e9e..25ccde63e5be6 100644 --- a/scripts/west_commands/spdx.py +++ b/scripts/west_commands/spdx.py @@ -6,7 +6,6 @@ import uuid from west.commands import WestCommand -from west import log from zspdx.sbom import SBOMConfig, makeSPDX, setupCmakeQuery @@ -50,65 +49,65 @@ def do_add_parser(self, parser_adder): return parser def do_run(self, args, unknown_args): - log.dbg(f"running zephyr SPDX generator") + self.dbg(f"running zephyr SPDX generator") - log.dbg(f" --init is", args.init) - log.dbg(f" --build-dir is", args.build_dir) - log.dbg(f" --namespace-prefix is", args.namespace_prefix) - log.dbg(f" --spdx-dir is", args.spdx_dir) - log.dbg(f" --analyze-includes is", args.analyze_includes) - log.dbg(f" --include-sdk is", args.include_sdk) + self.dbg(f" --init is", args.init) + self.dbg(f" --build-dir is", args.build_dir) + self.dbg(f" --namespace-prefix is", args.namespace_prefix) + self.dbg(f" --spdx-dir is", args.spdx_dir) + self.dbg(f" --analyze-includes is", args.analyze_includes) + self.dbg(f" --include-sdk is", args.include_sdk) if args.init: - do_run_init(args) + self.do_run_init(args) else: - do_run_spdx(args) - -def do_run_init(args): - log.inf("initializing Cmake file-based API prior to build") - - if not args.build_dir: - log.die("Build directory not specified; call `west spdx --init --build-dir=BUILD_DIR`") - - # initialize CMake file-based API - empty query file - query_ready = setupCmakeQuery(args.build_dir) - if query_ready: - log.inf("initialized; run `west build` then run `west spdx`") - else: - log.err("Couldn't create Cmake file-based API query directory") - log.err("You can manually create an empty file at $BUILDDIR/.cmake/api/v1/query/codemodel-v2") - -def do_run_spdx(args): - if not args.build_dir: - log.die("Build directory not specified; call `west spdx --build-dir=BUILD_DIR`") - - # create the SPDX files - cfg = SBOMConfig() - cfg.buildDir = args.build_dir - if args.namespace_prefix: - cfg.namespacePrefix = args.namespace_prefix - else: - # create default namespace according to SPDX spec - # note that this is intentionally _not_ an actual URL where - # this document will be stored - cfg.namespacePrefix = f"http://spdx.org/spdxdocs/zephyr-{str(uuid.uuid4())}" - if args.spdx_dir: - cfg.spdxDir = args.spdx_dir - else: - cfg.spdxDir = os.path.join(args.build_dir, "spdx") - if args.analyze_includes: - cfg.analyzeIncludes = True - if args.include_sdk: - cfg.includeSDK = True - - # make sure SPDX directory exists, or create it if it doesn't - if os.path.exists(cfg.spdxDir): - if not os.path.isdir(cfg.spdxDir): - log.err(f'SPDX output directory {cfg.spdxDir} exists but is not a directory') - return - # directory exists, we're good - else: - # create the directory - os.makedirs(cfg.spdxDir, exist_ok=False) - - makeSPDX(cfg) + self.do_run_spdx(args) + + def do_run_init(self, args): + self.inf("initializing Cmake file-based API prior to build") + + if not args.build_dir: + self.die("Build directory not specified; call `west spdx --init --build-dir=BUILD_DIR`") + + # initialize CMake file-based API - empty query file + query_ready = setupCmakeQuery(args.build_dir) + if query_ready: + self.inf("initialized; run `west build` then run `west spdx`") + else: + self.err("Couldn't create Cmake file-based API query directory") + self.err("You can manually create an empty file at $BUILDDIR/.cmake/api/v1/query/codemodel-v2") + + def do_run_spdx(self, args): + if not args.build_dir: + self.die("Build directory not specified; call `west spdx --build-dir=BUILD_DIR`") + + # create the SPDX files + cfg = SBOMConfig() + cfg.buildDir = args.build_dir + if args.namespace_prefix: + cfg.namespacePrefix = args.namespace_prefix + else: + # create default namespace according to SPDX spec + # note that this is intentionally _not_ an actual URL where + # this document will be stored + cfg.namespacePrefix = f"http://spdx.org/spdxdocs/zephyr-{str(uuid.uuid4())}" + if args.spdx_dir: + cfg.spdxDir = args.spdx_dir + else: + cfg.spdxDir = os.path.join(args.build_dir, "spdx") + if args.analyze_includes: + cfg.analyzeIncludes = True + if args.include_sdk: + cfg.includeSDK = True + + # make sure SPDX directory exists, or create it if it doesn't + if os.path.exists(cfg.spdxDir): + if not os.path.isdir(cfg.spdxDir): + self.err(f'SPDX output directory {cfg.spdxDir} exists but is not a directory') + return + # directory exists, we're good + else: + # create the directory + os.makedirs(cfg.spdxDir, exist_ok=False) + + makeSPDX(cfg) From 8b0edb2b22332c53c711929ba4d4f9c9fd641e2a Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Sun, 29 Sep 2024 16:13:25 +0200 Subject: [PATCH 1848/4482] scripts: west_commands: sign: Remove deprecated west.log The global state west.log is deprecated, replace with WestCommand logging. Signed-off-by: Pieter De Gendt --- scripts/west_commands/sign.py | 94 +++++++++++++++++------------------ 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/scripts/west_commands/sign.py b/scripts/west_commands/sign.py index 0b71e9b708b85..8aa7ff2435f6d 100644 --- a/scripts/west_commands/sign.py +++ b/scripts/west_commands/sign.py @@ -12,8 +12,8 @@ import subprocess import sys -from west import log from west import manifest +from west.commands import Verbosity from west.util import quote_sh_list from build_helpers import find_build_dir, is_zephyr_build, \ @@ -189,16 +189,16 @@ def do_run(self, args, ignored): # Delegate to the signer. if args.tool == 'imgtool': if args.if_tool_available: - log.die('imgtool does not support --if-tool-available') + self.die('imgtool does not support --if-tool-available') signer = ImgtoolSigner() elif args.tool == 'rimage': signer = RimageSigner() # (Add support for other signers here in elif blocks) else: if args.tool is None: - log.die('one --tool is required') + self.die('one --tool is required') else: - log.die(f'invalid tool: {args.tool}') + self.die(f'invalid tool: {args.tool}') signer.sign(self, build_dir, build_conf, formats) @@ -229,7 +229,7 @@ def sign(self, command, build_dir, build_conf, formats): args = command.args b = pathlib.Path(build_dir) - log.wrn("west sign using imgtool is deprecated and will be removed in a future release") + command.wrn("west sign using imgtool is deprecated and will be removed in a future release") imgtool = self.find_imgtool(command, args) # The vector table offset and application version are set in Kconfig: @@ -237,35 +237,35 @@ def sign(self, command, build_dir, build_conf, formats): vtoff = self.get_cfg(command, build_conf, 'CONFIG_ROM_START_OFFSET') # Flash device write alignment and the partition's slot size # come from devicetree: - flash = self.edt_flash_node(b, args.quiet) - align, addr, size = self.edt_flash_params(flash) + flash = self.edt_flash_node(command, b, args.quiet) + align, addr, size = self.edt_flash_params(command, flash) if not build_conf.getboolean('CONFIG_BOOTLOADER_MCUBOOT'): - log.wrn("CONFIG_BOOTLOADER_MCUBOOT is not set to y in " - f"{build_conf.path}; this probably won't work") + command.wrn("CONFIG_BOOTLOADER_MCUBOOT is not set to y in " + f"{build_conf.path}; this probably won't work") kernel = build_conf.get('CONFIG_KERNEL_BIN_NAME', 'zephyr') if 'bin' in formats: in_bin = b / 'zephyr' / f'{kernel}.bin' if not in_bin.is_file(): - log.die(f"no unsigned .bin found at {in_bin}") + command.die(f"no unsigned .bin found at {in_bin}") in_bin = os.fspath(in_bin) else: in_bin = None if 'hex' in formats: in_hex = b / 'zephyr' / f'{kernel}.hex' if not in_hex.is_file(): - log.die(f"no unsigned .hex found at {in_hex}") + command.die(f"no unsigned .hex found at {in_hex}") in_hex = os.fspath(in_hex) else: in_hex = None if not args.quiet: - log.banner('image configuration:') - log.inf('partition offset: {0} (0x{0:x})'.format(addr)) - log.inf('partition size: {0} (0x{0:x})'.format(size)) - log.inf('rom start offset: {0} (0x{0:x})'.format(vtoff)) + command.banner('image configuration:') + command.inf('partition offset: {0} (0x{0:x})'.format(addr)) + command.inf('partition size: {0} (0x{0:x})'.format(size)) + command.inf('rom start offset: {0} (0x{0:x})'.format(vtoff)) # Base sign command. sign_base = imgtool + ['sign', @@ -276,34 +276,34 @@ def sign(self, command, build_dir, build_conf, formats): sign_base.extend(args.tool_args) if not args.quiet: - log.banner('signing binaries') + command.banner('signing binaries') if in_bin: out_bin = args.sbin or str(b / 'zephyr' / 'zephyr.signed.bin') sign_bin = sign_base + [in_bin, out_bin] if not args.quiet: - log.inf(f'unsigned bin: {in_bin}') - log.inf(f'signed bin: {out_bin}') - log.dbg(quote_sh_list(sign_bin)) + command.inf(f'unsigned bin: {in_bin}') + command.inf(f'signed bin: {out_bin}') + command.dbg(quote_sh_list(sign_bin)) subprocess.check_call(sign_bin, stdout=subprocess.PIPE if args.quiet else None) if in_hex: out_hex = args.shex or str(b / 'zephyr' / 'zephyr.signed.hex') sign_hex = sign_base + [in_hex, out_hex] if not args.quiet: - log.inf(f'unsigned hex: {in_hex}') - log.inf(f'signed hex: {out_hex}') - log.dbg(quote_sh_list(sign_hex)) + command.inf(f'unsigned hex: {in_hex}') + command.inf(f'signed hex: {out_hex}') + command.dbg(quote_sh_list(sign_hex)) subprocess.check_call(sign_hex, stdout=subprocess.PIPE if args.quiet else None) @staticmethod - def find_imgtool(command, args): + def find_imgtool(cmd, args): if args.tool_path: imgtool = args.tool_path if not os.path.isfile(imgtool): - log.die(f'--tool-path {imgtool}: no such file') + cmd.die(f'--tool-path {imgtool}: no such file') else: imgtool = shutil.which('imgtool') or shutil.which('imgtool.py') if not imgtool: - log.die('imgtool not found; either install it', + cmd.die('imgtool not found; either install it', '(e.g. "pip3 install imgtool") or provide --tool-path') if platform.system() == 'Windows' and imgtool.endswith('.py'): @@ -327,7 +327,7 @@ def get_cfg(command, build_conf, item): return None @staticmethod - def edt_flash_node(b, quiet=False): + def edt_flash_node(cmd, b, quiet=False): # Get the EDT Node corresponding to the zephyr,flash chosen DT # node; 'b' is the build directory as a pathlib object. @@ -335,10 +335,10 @@ def edt_flash_node(b, quiet=False): # where we expect it to be. dts = b / 'zephyr' / 'zephyr.dts' if not quiet: - log.dbg('DTS file:', dts, level=log.VERBOSE_VERY) + cmd.dbg('DTS file:', dts, level=Verbosity.DBG_MORE) edt_pickle = b / 'zephyr' / 'edt.pickle' if not edt_pickle.is_file(): - log.die("can't load devicetree; expected to find:", edt_pickle) + cmd.die("can't load devicetree; expected to find:", edt_pickle) # Load the devicetree. with open(edt_pickle, 'rb') as f: @@ -348,13 +348,13 @@ def edt_flash_node(b, quiet=False): # partition information about the zephyr image to sign. flash = edt.chosen_node('zephyr,flash') if not flash: - log.die('devicetree has no chosen zephyr,flash node;', + cmd.die('devicetree has no chosen zephyr,flash node;', "can't infer flash write block or slot0_partition slot sizes") return flash @staticmethod - def edt_flash_params(flash): + def edt_flash_params(cmd, flash): # Get the flash device's write alignment and offset from the # slot0_partition and the size from slot1_partition , out of the # build directory's devicetree. slot1_partition size is used, @@ -366,7 +366,7 @@ def edt_flash_params(flash): # with label slot1_partition. By convention, the slots for consumption by # imgtool are linked into these partitions. if 'partitions' not in flash.children: - log.die("DT zephyr,flash chosen node has no partitions,", + cmd.die("DT zephyr,flash chosen node has no partitions,", "can't find partitions for MCUboot slots") partitions = flash.children['partitions'] @@ -377,23 +377,23 @@ def edt_flash_params(flash): } if 'slot0_partition' not in slots: - log.die("DT zephyr,flash chosen node has no slot0_partition partition,", + cmd.die("DT zephyr,flash chosen node has no slot0_partition partition,", "can't determine its address") # Die on missing or zero alignment or slot_size. if "write-block-size" not in flash.props: - log.die('DT zephyr,flash node has no write-block-size;', + cmd.die('DT zephyr,flash node has no write-block-size;', "can't determine imgtool write alignment") align = flash.props['write-block-size'].val if align == 0: - log.die('expected nonzero flash alignment, but got ' + cmd.die('expected nonzero flash alignment, but got ' 'DT flash device write-block-size {}'.format(align)) # The partitions node, and its subnode, must provide # the size of slot1_partition or slot0_partition partition via the regs property. slot_key = 'slot1_partition' if 'slot1_partition' in slots else 'slot0_partition' if not slots[slot_key].regs: - log.die(f'{slot_key} flash partition has no regs property;', + cmd.die(f'{slot_key} flash partition has no regs property;', "can't determine size of slot") # always use addr of slot0_partition, which is where slots are run @@ -401,7 +401,7 @@ def edt_flash_params(flash): size = slots[slot_key].regs[0].size if size == 0: - log.die('expected nonzero slot size for {}'.format(slot_key)) + cmd.die('expected nonzero slot size for {}'.format(slot_key)) return (align, addr, size) @@ -462,10 +462,10 @@ def sign(self, command, build_dir, build_conf, formats): if not target: msg = 'rimage target not defined in board.cmake' if args.if_tool_available: - log.inf(msg) + command.inf(msg) sys.exit(0) else: - log.die(msg) + command.die(msg) kernel_name = build_conf.get('CONFIG_KERNEL_BIN_NAME', 'zephyr') @@ -490,7 +490,7 @@ def sign(self, command, build_dir, build_conf, formats): tool_path = ( args.tool_path if args.tool_path else - self.command.config_get('rimage.path', None) + command.config_get('rimage.path', None) ) err_prefix = '--tool-path' if args.tool_path else 'west config' @@ -502,16 +502,16 @@ def sign(self, command, build_dir, build_conf, formats): if not tool_path: err_msg = 'rimage not found; either install it or provide --tool-path' if args.if_tool_available: - log.wrn(err_msg) - log.wrn('zephyr binary _not_ signed!') + command.wrn(err_msg) + command.wrn('zephyr binary _not_ signed!') return else: - log.die(err_msg) + command.die(err_msg) #### -c sof/rimage/config/signing_schema.toml #### if not args.quiet: - log.inf('Signing with tool {}'.format(tool_path)) + command.inf('Signing with tool {}'.format(tool_path)) try: sof_proj = command.manifest.get_projects(['sof'], allow_paths=False) @@ -522,7 +522,7 @@ def sign(self, command, build_dir, build_conf, formats): self.sof_src_dir = sof_src_dir - log.inf('Signing for SOC target ' + target) + command.inf('Signing for SOC target ' + target) # FIXME: deprecate --no-manifest and replace it with a much # simpler and more direct `-- -e` which the user can _already_ @@ -555,7 +555,7 @@ def sign(self, command, build_dir, build_conf, formats): components = [ ] if bootloader is None else [ bootloader ] components += [ kernel ] - sign_config_extra_args = self.command.config_get_words('rimage.extra-args', []) + sign_config_extra_args = command.config_get_words('rimage.extra-args', []) if '-k' not in sign_config_extra_args + args.tool_args: # rimage requires a key argument even when it does not sign @@ -563,7 +563,7 @@ def sign(self, command, build_dir, build_conf, formats): extra_ri_args += [ '-k', str(sof_src_dir / 'keys' / cmake_default_key) ] if args.tool_data and '-c' in args.tool_args: - log.wrn('--tool-data ' + args.tool_data + ' ignored! Overridden by: -- -c ... ') + command.wrn('--tool-data ' + args.tool_data + ' ignored! Overridden by: -- -c ... ') if '-c' not in sign_config_extra_args + args.tool_args: conf_dir = self.rimage_config_dir() @@ -594,7 +594,7 @@ def sign(self, command, build_dir, build_conf, formats): else: filenames = [out_xman, out_bin] if not args.quiet: - log.inf('Prefixing ' + out_bin + ' with manifest ' + out_xman) + command.inf('Prefixing ' + out_bin + ' with manifest ' + out_xman) with open(out_tmp, 'wb') as outfile: for fname in filenames: with open(fname, 'rb') as infile: From c2b6bcc6609b5ecdeb59aca4bd7ae6496c9d0abc Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Sun, 29 Sep 2024 15:35:22 +0200 Subject: [PATCH 1849/4482] scripts: west_commands: build: Remove deprecated west.log The global state west.log is deprecated, replace with WestCommand logging. Signed-off-by: Pieter De Gendt --- scripts/west_commands/build.py | 74 +++++++++++++++++----------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/scripts/west_commands/build.py b/scripts/west_commands/build.py index 63cfa9cd5ec8f..8181640adac10 100644 --- a/scripts/west_commands/build.py +++ b/scripts/west_commands/build.py @@ -9,7 +9,7 @@ import sys import yaml -from west import log +from west.commands import Verbosity from west.configuration import config from west.util import west_topdir from west.version import __version__ @@ -55,9 +55,6 @@ --pristine=always. Setting --pristine=auto uses heuristics to guess if a pristine build may be necessary.""" -def _banner(msg): - log.inf('-- west build: ' + msg, colorize=True) - def config_get(option, fallback): return config.get('build', option, fallback=fallback) @@ -98,6 +95,9 @@ def __init__(self): self.cmake_cache = None '''Final parsed CMake cache for the build, or None on error.''' + def _banner(self, msg): + self.inf('-- west build: ' + msg, colorize=True) + def do_add_parser(self, parser_adder): parser = parser_adder.add_parser( self.name, @@ -189,8 +189,8 @@ def do_add_parser(self, parser_adder): def do_run(self, args, remainder): self.args = args # Avoid having to pass them around self.config_board = config_get('board', None) - log.dbg('args: {} remainder: {}'.format(args, remainder), - level=log.VERBOSE_EXTREME) + self.dbg('args: {} remainder: {}'.format(args, remainder), + level=Verbosity.DBG_EXTREME) # Store legacy -s option locally source_dir = self.args.source_dir self._parse_remainder(remainder) @@ -205,18 +205,18 @@ def do_run(self, args, remainder): if test_path and os.path.exists(test_path): self.args.source_dir = test_path if not self._parse_test_item(item): - log.die("No test metadata found") + self.die("No test metadata found") else: - log.die("test item path does not exist") + self.die("test item path does not exist") if source_dir: if self.args.source_dir: - log.die("source directory specified twice:({} and {})".format( + self.die("source directory specified twice:({} and {})".format( source_dir, self.args.source_dir)) self.args.source_dir = source_dir - log.dbg('source_dir: {} cmake_opts: {}'.format(self.args.source_dir, + self.dbg('source_dir: {} cmake_opts: {}'.format(self.args.source_dir, self.args.cmake_opts), - level=log.VERBOSE_EXTREME) + level=Verbosity.DBG_EXTREME) self._sanity_precheck() self._setup_build_dir() @@ -226,15 +226,15 @@ def do_run(self, args, remainder): # Load the pristine={auto, always, never} configuration value pristine = config_get('pristine', 'never') if pristine not in ['auto', 'always', 'never']: - log.wrn( + self.wrn( 'treating unknown build.pristine value "{}" as "never"'. format(pristine)) pristine = 'never' self.auto_pristine = pristine == 'auto' - log.dbg('pristine: {} auto_pristine: {}'.format(pristine, + self.dbg('pristine: {} auto_pristine: {}'.format(pristine, self.auto_pristine), - level=log.VERBOSE_VERY) + level=Verbosity.DBG_MORE) if is_zephyr_build(self.build_dir): if pristine == 'always': self._run_pristine() @@ -326,13 +326,13 @@ def _parse_test_item(self, test_item): try: y = yaml.safe_load(stream) except yaml.YAMLError as exc: - log.die(exc) + self.die(exc) common = y.get('common') tests = y.get('tests') if not tests: - log.die(f"No tests found in {yf}") + self.die(f"No tests found in {yf}") if test_item not in tests: - log.die(f"Test item {test_item} not found in {yf}") + self.die(f"Test item {test_item} not found in {yf}") item = tests.get(test_item) sysbuild = False @@ -431,7 +431,7 @@ def _update_cache(self): def _setup_build_dir(self): # Initialize build_dir and created_build_dir attributes. # If we created the build directory, we must run CMake. - log.dbg('setting up build directory', level=log.VERBOSE_EXTREME) + self.dbg('setting up build directory', level=Verbosity.DBG_EXTREME) # The CMake Cache has not been loaded yet, so this is safe board, _ = self._find_board() source_dir = self._find_source_dir() @@ -439,12 +439,12 @@ def _setup_build_dir(self): build_dir = find_build_dir(self.args.build_dir, board=board, source_dir=source_dir, app=app) if not build_dir: - log.die('Unable to determine a default build folder. Check ' + self.die('Unable to determine a default build folder. Check ' 'your build.dir-fmt configuration option') if os.path.exists(build_dir): if not os.path.isdir(build_dir): - log.die('build directory {} exists and is not a directory'. + self.die('build directory {} exists and is not a directory'. format(build_dir)) else: os.makedirs(build_dir, exist_ok=False) @@ -457,7 +457,7 @@ def _find_source_dir(self): # Initialize source_dir attribute, either from command line argument, # implicitly from the build directory's CMake cache, or using the # default (current working directory). - log.dbg('setting up source directory', level=log.VERBOSE_EXTREME) + self.dbg('setting up source directory', level=Verbosity.DBG_EXTREME) if self.args.source_dir: source_dir = self.args.source_dir elif self.cmake_cache: @@ -472,7 +472,7 @@ def _find_source_dir(self): if not source_dir: # This really ought to be there. The build directory # must be corrupted somehow. Let's see what we can do. - log.die('build directory', self.build_dir, + self.die('build directory', self.build_dir, 'CMake cache has no CMAKE_HOME_DIRECTORY;', 'please give a source_dir') else: @@ -482,7 +482,7 @@ def _find_source_dir(self): def _sanity_check_source_dir(self): if self.source_dir == self.build_dir: # There's no forcing this. - log.die('source and build directory {} cannot be the same; ' + self.die('source and build directory {} cannot be the same; ' 'use --build-dir {} to specify a build directory'. format(self.source_dir, self.build_dir)) @@ -503,7 +503,7 @@ def _sanity_check_source_dir(self): def _sanity_check(self): # Sanity check the build configuration. # Side effect: may update cmake_cache attribute. - log.dbg('sanity checking the build', level=log.VERBOSE_EXTREME) + self.dbg('sanity checking the build', level=Verbosity.DBG_EXTREME) self._sanity_check_source_dir() if not self.cmake_cache: @@ -522,12 +522,12 @@ def _sanity_check(self): if cached_app is None and cached_proj: cached_app = cached_proj - log.dbg('APP_DIR:', cached_app, level=log.VERBOSE_EXTREME) + self.dbg('APP_DIR:', cached_app, level=Verbosity.DBG_EXTREME) source_abs = (os.path.abspath(self.args.source_dir) if self.args.source_dir else None) cached_abs = os.path.abspath(cached_app) if cached_app else None - log.dbg('pristine:', self.auto_pristine, level=log.VERBOSE_EXTREME) + self.dbg('pristine:', self.auto_pristine, level=Verbosity.DBG_EXTREME) # If the build directory specifies a source app, make sure it's # consistent with --source-dir. @@ -547,7 +547,7 @@ def _sanity_check(self): # If CACHED_BOARD is not defined, we need some other way to # find the board. cached_board = self.cmake_cache.get('CACHED_BOARD') - log.dbg('CACHED_BOARD:', cached_board, level=log.VERBOSE_EXTREME) + self.dbg('CACHED_BOARD:', cached_board, level=Verbosity.DBG_EXTREME) # If apps_mismatched and self.auto_pristine are true, we will # run pristine on the build, invalidating the cached # board. In that case, we need some way of getting the board. @@ -573,7 +573,7 @@ def _sanity_check(self): if self.auto_pristine and (apps_mismatched or boards_mismatched): self._run_pristine() self.cmake_cache = None - log.dbg('run_cmake:', True, level=log.VERBOSE_EXTREME) + self.dbg('run_cmake:', True, level=Verbosity.DBG_EXTREME) self.run_cmake = True # Tricky corner-case: The user has not specified a build folder but @@ -586,16 +586,16 @@ def _sanity_check(self): def _run_cmake(self, board, origin, cmake_opts): if board is None and config_getboolean('board_warn', True): - log.wrn('This looks like a fresh build and BOARD is unknown;', + self.wrn('This looks like a fresh build and BOARD is unknown;', "so it probably won't work. To fix, use", '--board=.') - log.inf('Note: to silence the above message, run', + self.inf('Note: to silence the above message, run', "'west config build.board_warn false'") if not self.run_cmake: return - _banner('generating a build system') + self._banner('generating a build system') if board is not None and origin != 'CMakeCache.txt': cmake_opts = ['-DBOARD={}'.format(board)] @@ -642,10 +642,10 @@ def _run_cmake(self, board, origin, cmake_opts): run_cmake(final_cmake_args, dry_run=self.args.dry_run) def _run_pristine(self): - _banner('making build dir {} pristine'.format(self.build_dir)) + self._banner('making build dir {} pristine'.format(self.build_dir)) if not is_zephyr_build(self.build_dir): - log.die('Refusing to run pristine on a folder that is not a ' - 'Zephyr build system') + self.die('Refusing to run pristine on a folder that is not a ' + 'Zephyr build system') cache = CMakeCache.from_build_dir(self.build_dir) @@ -659,9 +659,9 @@ def _run_pristine(self): def _run_build(self, target, domain): if target: - _banner('running target {}'.format(target)) + self._banner('running target {}'.format(target)) elif self.run_cmake: - _banner('building application') + self._banner('building application') extra_args = ['--target', target] if target else [] if self.args.build_opt: extra_args.append('--') @@ -678,7 +678,7 @@ def _run_build(self, target, domain): # will build all domains. build_dir_list = [domains.get_top_build_dir()] else: - _banner('building domain(s): {}'.format(' '.join(domain))) + self._banner('building domain(s): {}'.format(' '.join(domain))) domain_list = domains.get_domains(domain) for d in domain_list: build_dir_list.append(d.build_dir) From 1e5cdb110a3be3f8f817aec7601301bc79fec665 Mon Sep 17 00:00:00 2001 From: Hao Luo Date: Fri, 2 Aug 2024 17:01:41 +0800 Subject: [PATCH 1850/4482] drivers: spi: Add SPI device support for Apollo3 SoCs This commit adds spi device support for Apollo3 SoCs. Signed-off-by: Hao Luo --- .../apollo3_evb/apollo3_evb-pinctrl.dtsi | 6 +- .../apollo3p_evb/apollo3p_evb-pinctrl.dtsi | 6 +- drivers/spi/CMakeLists.txt | 3 +- drivers/spi/Kconfig.ambiq | 24 +- drivers/spi/{spi_ambiq.c => spi_ambiq_spic.c} | 5 +- drivers/spi/spi_ambiq_spid.c | 430 ++++++++++++++++++ dts/arm/ambiq/ambiq_apollo3_blue.dtsi | 11 + dts/arm/ambiq/ambiq_apollo3p_blue.dtsi | 11 + dts/bindings/spi/ambiq,spid.yaml | 15 + modules/hal_ambiq/Kconfig | 9 +- 10 files changed, 506 insertions(+), 14 deletions(-) rename drivers/spi/{spi_ambiq.c => spi_ambiq_spic.c} (99%) create mode 100644 drivers/spi/spi_ambiq_spid.c create mode 100644 dts/bindings/spi/ambiq,spid.yaml diff --git a/boards/ambiq/apollo3_evb/apollo3_evb-pinctrl.dtsi b/boards/ambiq/apollo3_evb/apollo3_evb-pinctrl.dtsi index 7fbd368813be2..366e914cc423d 100644 --- a/boards/ambiq/apollo3_evb/apollo3_evb-pinctrl.dtsi +++ b/boards/ambiq/apollo3_evb/apollo3_evb-pinctrl.dtsi @@ -65,7 +65,11 @@ bias-pull-up; }; }; - + spid0_default: spid0_default { + group1 { + pinmux = , , , ; + }; + }; spi0_default: spi0_default { group1 { pinmux = , , ; diff --git a/boards/ambiq/apollo3p_evb/apollo3p_evb-pinctrl.dtsi b/boards/ambiq/apollo3p_evb/apollo3p_evb-pinctrl.dtsi index b026ba7722fe2..3dfd7227dac5e 100644 --- a/boards/ambiq/apollo3p_evb/apollo3p_evb-pinctrl.dtsi +++ b/boards/ambiq/apollo3p_evb/apollo3p_evb-pinctrl.dtsi @@ -65,7 +65,11 @@ bias-pull-up; }; }; - + spid0_default: spid0_default { + group1 { + pinmux = , , , ; + }; + }; spi0_default: spi0_default { group1 { pinmux = , , ; diff --git a/drivers/spi/CMakeLists.txt b/drivers/spi/CMakeLists.txt index d88ff745a2302..d89ac3f9555f7 100644 --- a/drivers/spi/CMakeLists.txt +++ b/drivers/spi/CMakeLists.txt @@ -46,7 +46,8 @@ zephyr_library_sources_ifdef(CONFIG_SPI_PW spi_pw.c) zephyr_library_sources_ifdef(CONFIG_SPI_SMARTBOND spi_smartbond.c) zephyr_library_sources_ifdef(CONFIG_SPI_OPENTITAN spi_opentitan.c) zephyr_library_sources_ifdef(CONFIG_SPI_NUMAKER spi_numaker.c) -zephyr_library_sources_ifdef(CONFIG_SPI_AMBIQ spi_ambiq.c) +zephyr_library_sources_ifdef(CONFIG_SPI_AMBIQ_SPIC spi_ambiq_spic.c) +zephyr_library_sources_ifdef(CONFIG_SPI_AMBIQ_SPID spi_ambiq_spid.c) zephyr_library_sources_ifdef(CONFIG_SPI_AMBIQ_BLEIF spi_ambiq_bleif.c) zephyr_library_sources_ifdef(CONFIG_SPI_RPI_PICO_PIO spi_rpi_pico_pio.c) zephyr_library_sources_ifdef(CONFIG_SPI_MCHP_MSS spi_mchp_mss.c) diff --git a/drivers/spi/Kconfig.ambiq b/drivers/spi/Kconfig.ambiq index 17fb6cbd6792b..23366cb3597d6 100644 --- a/drivers/spi/Kconfig.ambiq +++ b/drivers/spi/Kconfig.ambiq @@ -6,21 +6,21 @@ # SPDX-License-Identifier: Apache-2.0 # -menuconfig SPI_AMBIQ - bool "AMBIQ SPI driver" +menuconfig SPI_AMBIQ_SPIC + bool "AMBIQ SPI Controller driver" default y depends on DT_HAS_AMBIQ_SPI_ENABLED select GPIO select AMBIQ_HAL - select AMBIQ_HAL_USE_SPI + select AMBIQ_HAL_USE_SPIC help - Enable driver for Ambiq SPI. + Enable driver for Ambiq SPI in Controller mode. -if SPI_AMBIQ +if SPI_AMBIQ_SPIC config SPI_AMBIQ_DMA bool "AMBIQ APOLLO SPI DMA Support" - depends on SPI_AMBIQ + depends on SPI_AMBIQ_SPIC help Enable DMA for Ambiq SPI. @@ -31,7 +31,17 @@ config SPI_DMA_TCB_BUFFER_SIZE help DMA Transfer Control Buffer size in words -endif # SPI_AMBIQ +endif # SPI_AMBIQ_SPIC + +config SPI_AMBIQ_SPID + bool "AMBIQ SPI Device driver" + default y + depends on DT_HAS_AMBIQ_SPID_ENABLED + select GPIO + select AMBIQ_HAL + select AMBIQ_HAL_USE_SPID + help + Enable driver for Ambiq SPI in Device mode. config SPI_AMBIQ_BLEIF bool "AMBIQ SPI-BLEIF driver" diff --git a/drivers/spi/spi_ambiq.c b/drivers/spi/spi_ambiq_spic.c similarity index 99% rename from drivers/spi/spi_ambiq.c rename to drivers/spi/spi_ambiq_spic.c index c36fc0391e7a5..2511c852b23c1 100644 --- a/drivers/spi/spi_ambiq.c +++ b/drivers/spi/spi_ambiq_spic.c @@ -170,7 +170,7 @@ static int spi_config(const struct device *dev, const struct spi_config *config) } if (config->operation & SPI_OP_MODE_SLAVE) { - LOG_ERR("Slave mode not supported"); + LOG_ERR("Device mode not supported"); return -ENOTSUP; } if (config->operation & SPI_MODE_LOOP) { @@ -183,7 +183,8 @@ static int spi_config(const struct device *dev, const struct spi_config *config) return -ENOTSUP; } - /* Select slower of two: SPI bus frequency for SPI device or SPI master clock frequency */ + /* Select slower of two: SPI bus frequency for SPI device or SPI controller clock frequency + */ data->iom_cfg.ui32ClockFreq = (config->frequency ? MIN(config->frequency, cfg->clock_freq) : cfg->clock_freq); ctx->config = config; diff --git a/drivers/spi/spi_ambiq_spid.c b/drivers/spi/spi_ambiq_spid.c new file mode 100644 index 0000000000000..6ccc6e7819a79 --- /dev/null +++ b/drivers/spi/spi_ambiq_spid.c @@ -0,0 +1,430 @@ +/* + * Copyright (c) 2024 Ambiq + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define DT_DRV_COMPAT ambiq_spid + +#include +LOG_MODULE_REGISTER(spi_ambiq_spid); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include "spi_context.h" +#include + +#define AMBIQ_SPID_PWRCTRL_MAX_WAIT_US 5 + +typedef int (*ambiq_spi_pwr_func_t)(void); + +struct spi_ambiq_config { + const struct gpio_dt_spec int_gpios; + uint32_t base; + int size; + const struct pinctrl_dev_config *pcfg; + ambiq_spi_pwr_func_t pwr_func; + void (*irq_config_func)(void); +}; + +struct spi_ambiq_data { + struct spi_context ctx; + am_hal_ios_config_t ios_cfg; + void *ios_handler; + int inst_idx; + struct k_sem spim_wrcmp_sem; +}; + +#define AMBIQ_SPID_TX_BUFSIZE_MAX 1023 +uint8_t ambiq_spid_sram_buffer[AMBIQ_SPID_TX_BUFSIZE_MAX]; + +#define AMBIQ_SPID_DUMMY_BYTE 0 +#define AMBIQ_SPID_DUMMY_LENGTH 16 +static uint8_t ambiq_spid_dummy_buffer[2][AMBIQ_SPID_DUMMY_LENGTH]; + +#define AMBIQ_SPID_WORD_SIZE 8 + +#define AMBIQ_SPID_FIFO_BASE 0x78 +#define AMBIQ_SPID_FIFO_END 0x100 +#define AMBIQ_SPID_FIFO_LENGTH (AMBIQ_SPID_FIFO_END - AMBIQ_SPID_FIFO_BASE) + +#define AMBIQ_SPID_INT_ERR (AM_HAL_IOS_INT_FOVFL | AM_HAL_IOS_INT_FUNDFL | AM_HAL_IOS_INT_FRDERR) + +#define AMBIQ_SPID_XCMP_INT \ + (AM_HAL_IOS_INT_XCMPWR | AM_HAL_IOS_INT_XCMPWF | AM_HAL_IOS_INT_XCMPRR | \ + AM_HAL_IOS_INT_XCMPRF) + +static void spi_ambiq_reset(const struct device *dev) +{ + struct spi_ambiq_data *data = dev->data; + struct spi_context *ctx = &data->ctx; + + /* cancel timed out transaction */ + am_hal_ios_disable(data->ios_handler); + /* NULL config to trigger reconfigure on next xfer */ + ctx->config = NULL; + /* signal any thread waiting on sync semaphore */ + spi_context_complete(ctx, dev, -ETIMEDOUT); +} + +static void spi_ambiq_inform(const struct device *dev) +{ + const struct spi_ambiq_config *cfg = dev->config; + /* Inform the controller */ + gpio_pin_set_dt(&cfg->int_gpios, 1); + gpio_pin_set_dt(&cfg->int_gpios, 0); +} + +static void spi_ambiq_isr(const struct device *dev) +{ + uint32_t ui32Status; + struct spi_ambiq_data *data = dev->data; + + am_hal_ios_interrupt_status_get(data->ios_handler, false, &ui32Status); + am_hal_ios_interrupt_clear(data->ios_handler, ui32Status); + if (ui32Status & AM_HAL_IOS_INT_XCMPWR) { + k_sem_give(&data->spim_wrcmp_sem); + } +} + +static int spi_config(const struct device *dev, const struct spi_config *config) +{ + struct spi_ambiq_data *data = dev->data; + struct spi_context *ctx = &(data->ctx); + int ret = 0; + + data->ios_cfg.ui32InterfaceSelect = AM_HAL_IOS_USE_SPI; + + if (spi_context_configured(ctx, config)) { + /* Already configured. No need to do it again. */ + return 0; + } + + if (SPI_WORD_SIZE_GET(config->operation) != AMBIQ_SPID_WORD_SIZE) { + LOG_ERR("Word size must be %d", AMBIQ_SPID_WORD_SIZE); + return -ENOTSUP; + } + + if ((config->operation & SPI_LINES_MASK) != SPI_LINES_SINGLE) { + LOG_ERR("Only supports single mode"); + return -ENOTSUP; + } + + if (config->operation & SPI_LOCK_ON) { + LOG_ERR("Lock On not supported"); + return -ENOTSUP; + } + + if (config->operation & SPI_TRANSFER_LSB) { + LOG_ERR("LSB first not supported"); + return -ENOTSUP; + } + + if (config->operation & SPI_MODE_CPOL) { + if (config->operation & SPI_MODE_CPHA) { + data->ios_cfg.ui32InterfaceSelect |= AM_HAL_IOS_SPIMODE_3; + } else { + data->ios_cfg.ui32InterfaceSelect |= AM_HAL_IOS_SPIMODE_2; + } + } else { + if (config->operation & SPI_MODE_CPHA) { + data->ios_cfg.ui32InterfaceSelect |= AM_HAL_IOS_SPIMODE_1; + } else { + data->ios_cfg.ui32InterfaceSelect |= AM_HAL_IOS_SPIMODE_0; + } + } + + if (config->operation & SPI_OP_MODE_MASTER) { + LOG_ERR("Controller mode not supported"); + return -ENOTSUP; + } + + if (config->operation & SPI_MODE_LOOP) { + LOG_ERR("Loopback mode not supported"); + return -ENOTSUP; + } + + if (spi_cs_is_gpio(config)) { + LOG_ERR("CS control via GPIO is not supported"); + return -EINVAL; + } + + /* Eliminate the "read-only" section, so an external controller can use the + * entire "direct write" section. + */ + data->ios_cfg.ui32ROBase = AMBIQ_SPID_FIFO_BASE; + /* Making the "FIFO" section as big as possible. */ + data->ios_cfg.ui32FIFOBase = AMBIQ_SPID_FIFO_BASE; + /* We don't need any RAM space, so extend the FIFO all the way to the end + * of the LRAM. + */ + data->ios_cfg.ui32RAMBase = AMBIQ_SPID_FIFO_END; + /* FIFO Threshold - set to half the size */ + data->ios_cfg.ui32FIFOThreshold = AMBIQ_SPID_FIFO_LENGTH >> 1; + + data->ios_cfg.pui8SRAMBuffer = ambiq_spid_sram_buffer, + data->ios_cfg.ui32SRAMBufferCap = AMBIQ_SPID_TX_BUFSIZE_MAX, + + ctx->config = config; + + ret = am_hal_ios_configure(data->ios_handler, &data->ios_cfg); + + return ret; +} + +static int spi_ambiq_xfer(const struct device *dev, const struct spi_config *config) +{ + struct spi_ambiq_data *data = dev->data; + struct spi_context *ctx = &data->ctx; + int ret = 0; + uint32_t chunk, num_written, num_read, used_space = 0; + + while (1) { + /* First send out all data */ + if (spi_context_tx_on(ctx)) { + spi_ambiq_inform(dev); + chunk = (ctx->tx_len > AMBIQ_SPID_TX_BUFSIZE_MAX) + ? AMBIQ_SPID_TX_BUFSIZE_MAX + : ctx->tx_len; + am_hal_ios_fifo_space_used(data->ios_handler, &used_space); + /* Controller done reading the last block signalled + * Check if any more data available + */ + if (!used_space) { + if (ctx->tx_buf) { + /* Copy data into FIFO */ + ret = am_hal_ios_fifo_write(data->ios_handler, + (uint8_t *)ctx->tx_buf, chunk, + &num_written); + } else { + uint32_t dummy_written = 0; + + num_written = 0; + /* Copy dummy into FIFO */ + while (chunk) { + uint32_t size = (chunk > AMBIQ_SPID_DUMMY_LENGTH) + ? AMBIQ_SPID_DUMMY_LENGTH + : chunk; + ret = am_hal_ios_fifo_write( + data->ios_handler, + ambiq_spid_dummy_buffer[0], size, + &dummy_written); + num_written += dummy_written; + chunk -= dummy_written; + } + } + if (ret != 0) { + LOG_ERR("SPID write error: %d", ret); + goto end; + } + spi_context_update_tx(ctx, 1, num_written); + } + } else if (spi_context_rx_on(ctx)) { + /* Wait for controller write complete interrupt */ + (void)k_sem_take(&data->spim_wrcmp_sem, K_FOREVER); + /* Read out the first byte as packet length */ + num_read = am_hal_ios_pui8LRAM[0]; + uint32_t size, offset = 0; + + while (spi_context_rx_on(ctx)) { + /* There's no data in the LRAM any more */ + if (!num_read) { + spi_ambiq_inform(dev); + goto end; + } + if (ctx->rx_buf) { + size = MIN(num_read, ctx->rx_len); + /* Read data from LRAM */ + memcpy(ctx->rx_buf, + (uint8_t *)&am_hal_ios_pui8LRAM[1 + offset], size); + } else { + size = MIN(num_read, AMBIQ_SPID_DUMMY_LENGTH); + /* Consume data from LRAM */ + memcpy(ambiq_spid_dummy_buffer[1], + (uint8_t *)&am_hal_ios_pui8LRAM[1 + offset], size); + } + num_read -= size; + offset += size; + spi_context_update_rx(ctx, 1, size); + } + } else { + break; + } + } + +end: + if (ret != 0) { + spi_ambiq_reset(dev); + } else { + spi_context_complete(ctx, dev, ret); + } + + return ret; +} + +static int spi_ambiq_transceive(const struct device *dev, const struct spi_config *config, + const struct spi_buf_set *tx_bufs, + const struct spi_buf_set *rx_bufs) +{ + struct spi_ambiq_data *data = dev->data; + int ret; + + if (!tx_bufs && !rx_bufs) { + return 0; + } + + ret = pm_device_runtime_get(dev); + if (ret < 0) { + LOG_ERR("pm_device_runtime_get failed: %d", ret); + } + + /* context setup */ + spi_context_lock(&data->ctx, false, NULL, NULL, config); + + ret = spi_config(dev, config); + if (ret) { + spi_context_release(&data->ctx, ret); + return ret; + } + + spi_context_buffers_setup(&data->ctx, tx_bufs, rx_bufs, 1); + + ret = spi_ambiq_xfer(dev, config); + + spi_context_release(&data->ctx, ret); + + /* Use async put to avoid useless device suspension/resumption + * when doing consecutive transmission. + */ + ret = pm_device_runtime_put_async(dev, K_MSEC(2)); + if (ret < 0) { + LOG_ERR("pm_device_runtime_put failed: %d", ret); + } + + return ret; +} + +static int spi_ambiq_release(const struct device *dev, const struct spi_config *config) +{ + struct spi_ambiq_data *data = dev->data; + + if (!spi_context_configured(&data->ctx, config)) { + return -EINVAL; + } + + spi_context_unlock_unconditionally(&data->ctx); + + return 0; +} + +static const struct spi_driver_api spi_ambiq_driver_api = { + .transceive = spi_ambiq_transceive, + .release = spi_ambiq_release, +}; + +static int spi_ambiq_init(const struct device *dev) +{ + struct spi_ambiq_data *data = dev->data; + const struct spi_ambiq_config *cfg = dev->config; + int ret = 0; + + if (AM_HAL_STATUS_SUCCESS != + am_hal_ios_initialize((cfg->base - IOSLAVE_BASE) / cfg->size, &data->ios_handler)) { + LOG_ERR("Fail to initialize SPID\n"); + return -ENXIO; + } + + ret = cfg->pwr_func(); + + ret |= pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT); + if (ret < 0) { + LOG_ERR("Fail to config SPID pins\n"); + goto end; + } + + memset(ambiq_spid_dummy_buffer[0], AMBIQ_SPID_DUMMY_BYTE, AMBIQ_SPID_DUMMY_LENGTH); + + am_hal_ios_interrupt_clear(data->ios_handler, AM_HAL_IOS_INT_ALL); + am_hal_ios_interrupt_enable(data->ios_handler, AMBIQ_SPID_INT_ERR | AM_HAL_IOS_INT_IOINTW | + AMBIQ_SPID_XCMP_INT); + cfg->irq_config_func(); + +end: + if (ret < 0) { + am_hal_ios_uninitialize(data->ios_handler); + } else { + spi_context_unlock_unconditionally(&data->ctx); + } + return ret; +} + +#ifdef CONFIG_PM_DEVICE +static int spi_ambiq_pm_action(const struct device *dev, enum pm_device_action action) +{ + struct spi_ambiq_data *data = dev->data; + uint32_t ret; + am_hal_sysctrl_power_state_e status; + + switch (action) { + case PM_DEVICE_ACTION_RESUME: + status = AM_HAL_SYSCTRL_WAKE; + break; + case PM_DEVICE_ACTION_SUSPEND: + status = AM_HAL_SYSCTRL_DEEPSLEEP; + break; + default: + return -ENOTSUP; + } + + ret = am_hal_ios_power_ctrl(data->ios_handler, status, true); + if (ret != AM_HAL_STATUS_SUCCESS) { + LOG_ERR("am_hal_ios_power_ctrl failed: %d", ret); + return -EPERM; + } else { + return 0; + } +} +#endif /* CONFIG_PM_DEVICE */ + +#define AMBIQ_SPID_INIT(n) \ + PINCTRL_DT_INST_DEFINE(n); \ + static int pwr_on_ambiq_spi_##n(void) \ + { \ + uint32_t addr = DT_REG_ADDR(DT_INST_PHANDLE(n, ambiq_pwrcfg)) + \ + DT_INST_PHA(n, ambiq_pwrcfg, offset); \ + sys_write32((sys_read32(addr) | DT_INST_PHA(n, ambiq_pwrcfg, mask)), addr); \ + k_busy_wait(AMBIQ_SPID_PWRCTRL_MAX_WAIT_US); \ + return 0; \ + } \ + static void spi_irq_config_func_##n(void) \ + { \ + IRQ_CONNECT(DT_INST_IRQN(n), DT_INST_IRQ(n, priority), spi_ambiq_isr, \ + DEVICE_DT_INST_GET(n), 0); \ + irq_enable(DT_INST_IRQN(n)); \ + }; \ + static struct spi_ambiq_data spi_ambiq_data##n = { \ + SPI_CONTEXT_INIT_LOCK(spi_ambiq_data##n, ctx), \ + SPI_CONTEXT_INIT_SYNC(spi_ambiq_data##n, ctx), \ + .spim_wrcmp_sem = Z_SEM_INITIALIZER(spi_ambiq_data##n.spim_wrcmp_sem, 0, 1), \ + .inst_idx = n}; \ + static const struct spi_ambiq_config spi_ambiq_config##n = { \ + .int_gpios = GPIO_DT_SPEC_INST_GET(n, int_gpios), \ + .base = DT_INST_REG_ADDR(n), \ + .size = DT_INST_REG_SIZE(n), \ + .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ + .irq_config_func = spi_irq_config_func_##n, \ + .pwr_func = pwr_on_ambiq_spi_##n}; \ + PM_DEVICE_DT_INST_DEFINE(n, spi_ambiq_pm_action); \ + DEVICE_DT_INST_DEFINE(n, spi_ambiq_init, PM_DEVICE_DT_INST_GET(n), &spi_ambiq_data##n, \ + &spi_ambiq_config##n, POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ + &spi_ambiq_driver_api); + +DT_INST_FOREACH_STATUS_OKAY(AMBIQ_SPID_INIT) diff --git a/dts/arm/ambiq/ambiq_apollo3_blue.dtsi b/dts/arm/ambiq/ambiq_apollo3_blue.dtsi index de76a84fc4005..14760d737b169 100644 --- a/dts/arm/ambiq/ambiq_apollo3_blue.dtsi +++ b/dts/arm/ambiq/ambiq_apollo3_blue.dtsi @@ -189,6 +189,17 @@ zephyr,pm-device-runtime-auto; }; + spid0: spi@50000100 { + compatible = "ambiq,spid"; + reg = <0x50000100 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + interrupts = <4 0>; + status = "disabled"; + ambiq,pwrcfg = <&pwrcfg 0x8 0>; + zephyr,pm-device-runtime-auto; + }; + spi0: spi@50004000 { reg = <0x50004000 0x1000>; #address-cells = <1>; diff --git a/dts/arm/ambiq/ambiq_apollo3p_blue.dtsi b/dts/arm/ambiq/ambiq_apollo3p_blue.dtsi index e41e17f61df59..ef0f680c75b50 100644 --- a/dts/arm/ambiq/ambiq_apollo3p_blue.dtsi +++ b/dts/arm/ambiq/ambiq_apollo3p_blue.dtsi @@ -207,6 +207,17 @@ zephyr,pm-device-runtime-auto; }; + spid0: spi@50000100 { + compatible = "ambiq,spid"; + reg = <0x50000100 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + interrupts = <4 0>; + status = "disabled"; + ambiq,pwrcfg = <&pwrcfg 0x8 0>; + zephyr,pm-device-runtime-auto; + }; + spi0: spi@50004000 { reg = <0x50004000 0x1000>; #address-cells = <1>; diff --git a/dts/bindings/spi/ambiq,spid.yaml b/dts/bindings/spi/ambiq,spid.yaml new file mode 100644 index 0000000000000..d6d4be55c8372 --- /dev/null +++ b/dts/bindings/spi/ambiq,spid.yaml @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Ambiq +# SPDX-License-Identifier: Apache-2.0 + +description: Ambiq SPI Device + +compatible: "ambiq,spid" + +include: [spi-controller.yaml, pinctrl-device.yaml, ambiq-pwrcfg.yaml] + +properties: + int-gpios: + type: phandle-array + required: true + description: | + GPIO that interrupts the SPI controller to require operation diff --git a/modules/hal_ambiq/Kconfig b/modules/hal_ambiq/Kconfig index a9a7e47e78434..e5932b474f4c3 100644 --- a/modules/hal_ambiq/Kconfig +++ b/modules/hal_ambiq/Kconfig @@ -40,10 +40,15 @@ config AMBIQ_HAL_USE_I2C help Use the I2C driver from Ambiq HAL -config AMBIQ_HAL_USE_SPI +config AMBIQ_HAL_USE_SPIC bool help - Use the SPI driver from Ambiq HAL + Use the SPI Controller driver from Ambiq HAL + +config AMBIQ_HAL_USE_SPID + bool + help + Use the SPI Device driver from Ambiq HAL config AMBIQ_HAL_USE_MSPI bool From 7b701a40d519c0d40864e12e11eb54c79614dfc6 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Mon, 1 Apr 2024 19:44:29 +0200 Subject: [PATCH 1851/4482] tests: fs: fcb: Make fixed endmarker test optional The commit splits default FCB scenario into one with endmarker enabled, the original one, and one with disabled. This allows to test the FCB in cases when CONFIG_FCB_ALLOW_FIXED_ENDMARKER is set and not set. Signed-off-by: Dominik Ermel --- tests/subsys/fs/fcb/CMakeLists.txt | 3 +++ tests/subsys/fs/fcb/src/fcb_test.h | 2 ++ tests/subsys/fs/fcb/src/main.c | 6 ++++++ tests/subsys/fs/fcb/testcase.yaml | 12 ++++++++++++ 4 files changed, 23 insertions(+) diff --git a/tests/subsys/fs/fcb/CMakeLists.txt b/tests/subsys/fs/fcb/CMakeLists.txt index 6b11305af388e..d969b8e355a61 100644 --- a/tests/subsys/fs/fcb/CMakeLists.txt +++ b/tests/subsys/fs/fcb/CMakeLists.txt @@ -5,5 +5,8 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(fs_fcb) FILE(GLOB app_sources src/*.c) +if(NOT CONFIG_FCB_ALLOW_FIXED_ENDMARKER) + list(REMOVE_ITEM "src/fcb_test_crc_disabled_after_enabled.c") +endif() target_sources(app PRIVATE ${app_sources}) target_include_directories(app PRIVATE ${ZEPHYR_BASE}/subsys/fs/fcb) diff --git a/tests/subsys/fs/fcb/src/fcb_test.h b/tests/subsys/fs/fcb/src/fcb_test.h index 936c0eeba47f2..9ae833991b666 100644 --- a/tests/subsys/fs/fcb/src/fcb_test.h +++ b/tests/subsys/fs/fcb/src/fcb_test.h @@ -24,7 +24,9 @@ extern "C" { #define TEST_FCB_FLASH_AREA_ID FIXED_PARTITION_ID(TEST_FCB_FLASH_AREA) extern struct fcb test_fcb; +#if defined(CONFIG_FCB_ALLOW_FIXED_ENDMARKER) extern struct fcb test_fcb_crc_disabled; +#endif extern struct flash_sector test_fcb_sector[]; diff --git a/tests/subsys/fs/fcb/src/main.c b/tests/subsys/fs/fcb/src/main.c index 2603f7fddf586..3642a2e8de4fb 100644 --- a/tests/subsys/fs/fcb/src/main.c +++ b/tests/subsys/fs/fcb/src/main.c @@ -14,7 +14,9 @@ #include struct fcb test_fcb = {0}; +#if defined(CONFIG_FCB_ALLOW_FIXED_ENDMARKER) struct fcb test_fcb_crc_disabled = { .f_flags = FCB_FLAGS_CRC_DISABLED }; +#endif uint8_t fcb_test_erase_value; @@ -139,7 +141,11 @@ static void fcb_pretest_4_sectors(void *data) static void fcb_pretest_crc_disabled(void *data) { +#if defined(CONFIG_FCB_ALLOW_FIXED_ENDMARKER) fcb_tc_pretest(2, &test_fcb_crc_disabled); +#else + ztest_test_skip(); +#endif } /* diff --git a/tests/subsys/fs/fcb/testcase.yaml b/tests/subsys/fs/fcb/testcase.yaml index 06263927690ee..4d9c1851e7c6a 100644 --- a/tests/subsys/fs/fcb/testcase.yaml +++ b/tests/subsys/fs/fcb/testcase.yaml @@ -16,6 +16,18 @@ tests: filesystem.fcb.native_sim.no_erase: extra_args: CONFIG_FLASH_SIMULATOR_EXPLICIT_ERASE=n platform_allow: native_sim + filesystem.fcb.fixed_endmarker: + platform_allow: + - nrf52840dk/nrf52840 + - nrf52dk/nrf52832 + - nrf51dk/nrf51822 + - native_sim + - native_sim/native/64 + - mr_canhubk3 + tags: flash_circural_buffer + integration_platforms: + - nrf52840dk/nrf52840 + extra_args: CONFIG_FCB_ALLOW_FIXED_ENDMARKER=y filesystem.fcb.native_sim.fcb_0x00: extra_args: DTC_OVERLAY_FILE=boards/native_sim_ev_0x00.overlay platform_allow: native_sim From 625246f2416ae03bd558f8f918400868eca24bd7 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 25 Oct 2024 09:34:24 -0400 Subject: [PATCH 1852/4482] twister: --device-testing always implies --filter runnable --device-testing implies runnable tests, this was the case before the rework and was missed in one spot, so instead do that directly in the argument parser. Fixes #80428 Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/environment.py | 2 +- scripts/pylib/twister/twisterlib/testplan.py | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/environment.py b/scripts/pylib/twister/twisterlib/environment.py index e0773878ddf8a..0ab3022729dde 100644 --- a/scripts/pylib/twister/twisterlib/environment.py +++ b/scripts/pylib/twister/twisterlib/environment.py @@ -382,7 +382,7 @@ def add_parse_arguments(parser = None): parser.add_argument( "--filter", choices=['buildable', 'runnable'], - default='buildable', + default='runnable' if "--device-testing" in sys.argv else 'buildable', help="""Filter tests to be built and executed. By default everything is built and if a test is runnable (emulation or a connected device), it is run. This option allows for example to only build tests that can diff --git a/scripts/pylib/twister/twisterlib/testplan.py b/scripts/pylib/twister/twisterlib/testplan.py index 8731522c21ece..7f098d8e1fcdf 100755 --- a/scripts/pylib/twister/twisterlib/testplan.py +++ b/scripts/pylib/twister/twisterlib/testplan.py @@ -644,9 +644,6 @@ def load_from_file(self, file, filter_platform=[]): if ts.get("run_id"): instance.run_id = ts.get("run_id") - if self.options.device_testing: - self.options.filter = 'runnable' - instance.run = instance.check_runnable( self.options, self.hwm From e90559f0da70b0ea00dd8822cc9928fb189f2236 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Wed, 23 Oct 2024 21:28:35 -0400 Subject: [PATCH 1853/4482] twister: fix platform filter when loading plan from file if alias or shorthand name is provided on the command line, we need convert this to complete target name for the filters to work. Fixes #80332 Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/testplan.py | 14 ++++++++++++-- scripts/tests/twister/test_testplan.py | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/testplan.py b/scripts/pylib/twister/twisterlib/testplan.py index 7f098d8e1fcdf..25aa5c218eafc 100755 --- a/scripts/pylib/twister/twisterlib/testplan.py +++ b/scripts/pylib/twister/twisterlib/testplan.py @@ -230,11 +230,21 @@ def load(self): # Get list of connected hardware and filter tests to only be run on connected hardware. # If the platform does not exist in the hardware map or was not specified by --platform, # just skip it. - connected_list = self.options.platform + + connected_list = [] + excluded_list = [] + for _cp in self.options.platform: + if _cp in self.platform_names: + connected_list.append(self.get_platform(_cp).name) + if self.options.exclude_platform: - for excluded in self.options.exclude_platform: + for _p in self.options.exclude_platform: + if _p in self.platform_names: + excluded_list.append(self.get_platform(_p).name) + for excluded in excluded_list: if excluded in connected_list: connected_list.remove(excluded) + self.load_from_file(last_run, filter_platform=connected_list) self.selected_platforms = set(p.platform.name for p in self.instances.values()) else: diff --git a/scripts/tests/twister/test_testplan.py b/scripts/tests/twister/test_testplan.py index 7241633626f83..de1c9595a21d8 100644 --- a/scripts/tests/twister/test_testplan.py +++ b/scripts/tests/twister/test_testplan.py @@ -594,7 +594,7 @@ def test_testplan_discover( (None, None, 'load_tests.json', None, '0/4', TwisterRuntimeError, set(['lt-p1', 'lt-p3', 'lt-p4', 'lt-p2']), []), ('suffix', None, None, True, '2/4', - None, set(['ts-p4', 'ts-p2', 'ts-p3']), [2, 4]), + None, set(['ts-p4', 'ts-p2', 'ts-p1', 'ts-p3']), [2, 4]), ] @pytest.mark.parametrize( From 7066c40afc00e2cf34d8648c0079817e235e4d0a Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 24 Oct 2024 11:10:36 -0400 Subject: [PATCH 1854/4482] twister: also convert platform names from the hardwaremap Convert platform names from the hardware map to full target names. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/twister_main.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/pylib/twister/twisterlib/twister_main.py b/scripts/pylib/twister/twisterlib/twister_main.py index f5ee03b808aed..310cdc7bfdde1 100644 --- a/scripts/pylib/twister/twisterlib/twister_main.py +++ b/scripts/pylib/twister/twisterlib/twister_main.py @@ -181,6 +181,15 @@ def main(options: argparse.Namespace, default_options: argparse.Namespace): tplan.create_build_dir_links() runner = TwisterRunner(tplan.instances, tplan.testsuites, env) + # FIXME: This is a workaround for the fact that the hardware map can be usng + # the short name of the platform, while the testplan is using the full name. + # + # convert platform names coming from the hardware map to the full target + # name. + # this is needed to match the platform names in the testplan. + for d in hwm.duts: + if d.platform in tplan.platform_names: + d.platform = tplan.get_platform(d.platform).name runner.duts = hwm.duts runner.run() From 200de7c00a0a1beb905ec8565a24fce1d498e13b Mon Sep 17 00:00:00 2001 From: Aleksander Wasaznik Date: Thu, 1 Aug 2024 14:25:51 +0200 Subject: [PATCH 1855/4482] Bluetooth: Host: Fix `bt_l2cap_chan_ops.recv` `-EINPROGRESS` Fix discrepancy in reference management between calls to `bt_l2cap_chan_ops.recv` when the application returns `-EINPROGRESS`. There are two call sites, `l2cap_chan_le_recv_sdu` and `l2cap_chan_le_recv`, that were inconsistent. `l2cap_chan_le_recv_sdu` moves the reference, and this patch updates `l2cap_chan_le_recv` to do the same. This behavior is also now documented. This bug has existed since the introduction of this feature in 3151d265726fb528d31d8e1ee8b35004e901cfc4. Signed-off-by: Aleksander Wasaznik --- include/zephyr/bluetooth/l2cap.h | 5 +++++ subsys/bluetooth/host/l2cap.c | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/zephyr/bluetooth/l2cap.h b/include/zephyr/bluetooth/l2cap.h index 0117da5ebb963..cdd162f9889d7 100644 --- a/include/zephyr/bluetooth/l2cap.h +++ b/include/zephyr/bluetooth/l2cap.h @@ -349,6 +349,11 @@ struct bt_l2cap_chan_ops { * @kconfig{CONFIG_BT_L2CAP_SEG_RECV} is enabled and seg_recv is * supplied. * + * If the application returns @c -EINPROGRESS, the application takes + * ownership of the reference in @p buf. (I.e. This pointer value can + * simply be given to @ref bt_l2cap_chan_recv_complete without any + * calls @ref net_buf_ref or @ref net_buf_unref.) + * * @return 0 in case of success or negative value in case of error. * @return -EINPROGRESS in case where user has to confirm once the data * has been processed by calling diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index 3b5cfe8286497..8012706bc4560 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -2566,6 +2567,7 @@ static void l2cap_chan_le_recv_seg_direct(struct bt_l2cap_le_chan *chan, struct static void l2cap_chan_le_recv(struct bt_l2cap_le_chan *chan, struct net_buf *buf) { + struct net_buf *owned_ref; uint16_t sdu_len; int err; @@ -2639,7 +2641,13 @@ static void l2cap_chan_le_recv(struct bt_l2cap_le_chan *chan, return; } - err = chan->chan.ops->recv(&chan->chan, buf); + owned_ref = net_buf_ref(buf); + err = chan->chan.ops->recv(&chan->chan, owned_ref); + if (err != -EINPROGRESS) { + net_buf_unref(owned_ref); + owned_ref = NULL; + } + if (err < 0) { if (err != -EINPROGRESS) { LOG_ERR("err %d", err); From 70ad45d4d915e21583fc1efecd916303c40f5a2a Mon Sep 17 00:00:00 2001 From: Aleksander Wasaznik Date: Thu, 22 Aug 2024 10:14:02 +0200 Subject: [PATCH 1856/4482] Bluetooth: Host: Upgrade log severity for L2CAP user error For ease of development, we should log the event as an error. Signed-off-by: Aleksander Wasaznik --- subsys/bluetooth/host/l2cap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index 8012706bc4560..d280db5363cd0 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -3147,7 +3147,7 @@ static int bt_l2cap_dyn_chan_send(struct bt_l2cap_le_chan *le_chan, struct net_b /* Call `net_buf_reserve(buf, BT_L2CAP_SDU_CHAN_SEND_RESERVE)` * when allocating buffers intended for bt_l2cap_chan_send(). */ - LOG_DBG("Not enough headroom in buf %p", buf); + LOG_ERR("Not enough headroom in buf %p", buf); return -EINVAL; } @@ -3195,7 +3195,7 @@ int bt_l2cap_chan_send(struct bt_l2cap_chan *chan, struct net_buf *buf) LOG_DBG("chan %p buf %p len %zu", chan, buf, buf->len); if (buf->ref != 1) { - LOG_DBG("Expecting 1 ref, got %d", buf->ref); + LOG_WRN("Expecting 1 ref, got %d", buf->ref); return -EINVAL; } From 5f89a6b8f1051ca30655c8a049935a497bb245d6 Mon Sep 17 00:00:00 2001 From: Aleksander Wasaznik Date: Thu, 22 Aug 2024 10:17:39 +0200 Subject: [PATCH 1857/4482] Bluetooth: Host: Add BT_TESTING trace event for ACL pool destroy This is needed for a test to catch a double-free. Signed-off-by: Aleksander Wasaznik --- include/zephyr/bluetooth/testing.h | 27 +++++++++++++++++++++++++++ subsys/bluetooth/host/hci_core.c | 12 ++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 include/zephyr/bluetooth/testing.h diff --git a/include/zephyr/bluetooth/testing.h b/include/zephyr/bluetooth/testing.h new file mode 100644 index 0000000000000..3ac48c7b36e11 --- /dev/null +++ b/include/zephyr/bluetooth/testing.h @@ -0,0 +1,27 @@ +/* Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +/** @brief Internal testing interfaces for Bluetooth + * @file + * @internal + * + * The interfaces in this file are internal and not stable. + */ + +#ifndef ZEPHYR_INCLUDE_BLUETOOTH_TESTING_H_ +#define ZEPHYR_INCLUDE_BLUETOOTH_TESTING_H_ + +#include + +/** @brief Hook for `acl_in_pool.destroy` + * + * Weak-function interface. The user can simply define this + * function, and it will automatically become the event + * listener. + * + * @kconfig_dep{CONFIG_BT_TESTING} + */ +void bt_testing_trace_event_acl_pool_destroy(struct net_buf *buf); + +#endif /* ZEPHYR_INCLUDE_BLUETOOTH_TESTING_H_ */ diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 6a19f79c31b96..4606c8c9b1f1c 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -28,6 +29,7 @@ #include #include #include +#include #if DT_HAS_CHOSEN(zephyr_bt_hci) #include #else @@ -263,6 +265,12 @@ void bt_send_one_host_num_completed_packets(uint16_t handle) BT_ASSERT_MSG(err == 0, "Unable to send Host NCP (err %d)", err); } +#if defined(CONFIG_BT_TESTING) +__weak void bt_testing_trace_event_acl_pool_destroy(struct net_buf *buf) +{ +} +#endif + #if defined(CONFIG_BT_HCI_ACL_FLOW_CONTROL) void bt_hci_host_num_completed_packets(struct net_buf *buf) { @@ -270,6 +278,10 @@ void bt_hci_host_num_completed_packets(struct net_buf *buf) struct bt_conn *conn; uint8_t index = acl(buf)->index; + if (IS_ENABLED(CONFIG_BT_TESTING)) { + bt_testing_trace_event_acl_pool_destroy(buf); + } + net_buf_destroy(buf); if (acl(buf)->host_ncp_sent) { From abeca2470247db7da9c1aa3bd83b6e55d94c9407 Mon Sep 17 00:00:00 2001 From: Aleksander Wasaznik Date: Thu, 22 Aug 2024 10:19:08 +0200 Subject: [PATCH 1858/4482] Bluetooth: testlib: Add `BT_TESTLIB_ADDR_LE_RANDOM_C0_00_00_00_00_` This is shorthand for random static addresses. It's similar to `bt_addr_le_from_str`, but is a macro that results in an object literal, making it more versatile and less verbose. This macro only gives access to the first 255 random static addresses, but this ought to be enough addresses for testing. Signed-off-by: Aleksander Wasaznik --- .../common/testlib/include/testlib/addr.h | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/bluetooth/common/testlib/include/testlib/addr.h diff --git a/tests/bluetooth/common/testlib/include/testlib/addr.h b/tests/bluetooth/common/testlib/include/testlib/addr.h new file mode 100644 index 0000000000000..2f9e49488b7a5 --- /dev/null +++ b/tests/bluetooth/common/testlib/include/testlib/addr.h @@ -0,0 +1,20 @@ +/* Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_TESTS_BLUETOOTH_COMMON_TESTLIB_INCLUDE_TESTLIB_ADDR_H_ +#define ZEPHYR_TESTS_BLUETOOTH_COMMON_TESTLIB_INCLUDE_TESTLIB_ADDR_H_ + +#include + +#include +#include + +/** Bluetooth LE static random address */ +#define BT_TESTLIB_ADDR_LE_RANDOM_C0_00_00_00_00_(last) \ + ((bt_addr_le_t){ \ + .type = BT_ADDR_LE_RANDOM, \ + .a = {{last, 0x00, 0x00, 0x00, 0x00, 0xc0}}, \ + }) + +#endif /* ZEPHYR_TESTS_BLUETOOTH_COMMON_TESTLIB_INCLUDE_TESTLIB_ADDR_H_ */ From 47325f8df5649cfdfff9d19504e79b5635e35a08 Mon Sep 17 00:00:00 2001 From: Aleksander Wasaznik Date: Thu, 1 Aug 2024 14:25:51 +0200 Subject: [PATCH 1859/4482] Bluetooth: Host: Test L2CAP -EINPROGRESS feature The test implementation is based on a copy of the HFC multilink test. The test verifies that the stack respects the reference counting of SDU buffers when the L2CAP -EINPROGRESS feature is used. Signed-off-by: Aleksander Wasaznik --- tests/bsim/bluetooth/host/l2cap/compile.sh | 1 + .../host/l2cap/einprogress/CMakeLists.txt | 24 ++++ .../host/l2cap/einprogress/compile.sh | 13 ++ .../bluetooth/host/l2cap/einprogress/prj.conf | 25 ++++ .../host/l2cap/einprogress/src/data.h | 11 ++ .../host/l2cap/einprogress/src/dut.c | 124 ++++++++++++++++++ .../host/l2cap/einprogress/src/main.c | 47 +++++++ .../host/l2cap/einprogress/src/tester.c | 72 ++++++++++ .../l2cap/einprogress/test_scripts/run.sh | 26 ++++ 9 files changed, 343 insertions(+) create mode 100644 tests/bsim/bluetooth/host/l2cap/einprogress/CMakeLists.txt create mode 100755 tests/bsim/bluetooth/host/l2cap/einprogress/compile.sh create mode 100644 tests/bsim/bluetooth/host/l2cap/einprogress/prj.conf create mode 100644 tests/bsim/bluetooth/host/l2cap/einprogress/src/data.h create mode 100644 tests/bsim/bluetooth/host/l2cap/einprogress/src/dut.c create mode 100644 tests/bsim/bluetooth/host/l2cap/einprogress/src/main.c create mode 100644 tests/bsim/bluetooth/host/l2cap/einprogress/src/tester.c create mode 100755 tests/bsim/bluetooth/host/l2cap/einprogress/test_scripts/run.sh diff --git a/tests/bsim/bluetooth/host/l2cap/compile.sh b/tests/bsim/bluetooth/host/l2cap/compile.sh index 71d41a7f2e75c..ddb7f5d14bcf8 100755 --- a/tests/bsim/bluetooth/host/l2cap/compile.sh +++ b/tests/bsim/bluetooth/host/l2cap/compile.sh @@ -19,6 +19,7 @@ app=tests/bsim/bluetooth/host/l2cap/stress conf_file=prj_nofrag.conf compile app=tests/bsim/bluetooth/host/l2cap/stress conf_file=prj_syswq.conf compile run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/host/l2cap/split/compile.sh run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/host/l2cap/reassembly/compile.sh +run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/host/l2cap/einprogress/compile.sh run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/host/l2cap/ecred/compile.sh app=tests/bsim/bluetooth/host/l2cap/credits compile app=tests/bsim/bluetooth/host/l2cap/credits conf_file=prj_ecred.conf compile diff --git a/tests/bsim/bluetooth/host/l2cap/einprogress/CMakeLists.txt b/tests/bsim/bluetooth/host/l2cap/einprogress/CMakeLists.txt new file mode 100644 index 0000000000000..b6d0135f93609 --- /dev/null +++ b/tests/bsim/bluetooth/host/l2cap/einprogress/CMakeLists.txt @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +project(test_l2cap_einprogress) + +add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/common/testlib testlib) +target_link_libraries(app PRIVATE testlib) + +add_subdirectory(${ZEPHYR_BASE}/tests/bsim/babblekit babblekit) +target_link_libraries(app PRIVATE babblekit) + +zephyr_include_directories( + ${BSIM_COMPONENTS_PATH}/libUtilv1/src/ + ${BSIM_COMPONENTS_PATH}/libPhyComv1/src/ +) + +target_sources(app PRIVATE + src/main.c + src/dut.c + src/tester.c +) diff --git a/tests/bsim/bluetooth/host/l2cap/einprogress/compile.sh b/tests/bsim/bluetooth/host/l2cap/einprogress/compile.sh new file mode 100755 index 0000000000000..e717a4b2bbef0 --- /dev/null +++ b/tests/bsim/bluetooth/host/l2cap/einprogress/compile.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# Copyright 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 +set -eu +: "${ZEPHYR_BASE:?ZEPHYR_BASE must be defined}" + +INCR_BUILD=1 + +source ${ZEPHYR_BASE}/tests/bsim/compile.source + +app="$(guess_test_relpath)" compile + +wait_for_background_jobs diff --git a/tests/bsim/bluetooth/host/l2cap/einprogress/prj.conf b/tests/bsim/bluetooth/host/l2cap/einprogress/prj.conf new file mode 100644 index 0000000000000..e2540cd6f6a88 --- /dev/null +++ b/tests/bsim/bluetooth/host/l2cap/einprogress/prj.conf @@ -0,0 +1,25 @@ +CONFIG_LOG=y +CONFIG_ASSERT=y +CONFIG_THREAD_NAME=y +CONFIG_LOG_THREAD_ID_PREFIX=y +CONFIG_ARCH_POSIX_TRAP_ON_FATAL=y +CONFIG_BT_TESTING=y + +CONFIG_BT_HCI_ACL_FLOW_CONTROL=y + +CONFIG_BT=y +CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=y + +# Dependency of testlib/adv and testlib/scan. +CONFIG_BT_EXT_ADV=y + +# Dynamic channel depends on SMP +CONFIG_BT_SMP=y +CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y + +# Disable auto-initiated procedures so they don't +# mess with the test's execution. +CONFIG_BT_AUTO_PHY_UPDATE=n +CONFIG_BT_AUTO_DATA_LEN_UPDATE=n +CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n diff --git a/tests/bsim/bluetooth/host/l2cap/einprogress/src/data.h b/tests/bsim/bluetooth/host/l2cap/einprogress/src/data.h new file mode 100644 index 0000000000000..4920d909d089f --- /dev/null +++ b/tests/bsim/bluetooth/host/l2cap/einprogress/src/data.h @@ -0,0 +1,11 @@ +/* Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_TESTS_BSIM_BLUETOOTH_HOST_L2CAP_EINPROGRESS_SRC_DATA_H_ +#define ZEPHYR_TESTS_BSIM_BLUETOOTH_HOST_L2CAP_EINPROGRESS_SRC_DATA_H_ + +#define TEST_DATA_L2CAP_PSM 0x0080 +#define TEST_DATA_DUT_ADDR BT_TESTLIB_ADDR_LE_RANDOM_C0_00_00_00_00_(0x01) + +#endif /* ZEPHYR_TESTS_BSIM_BLUETOOTH_HOST_L2CAP_EINPROGRESS_SRC_DATA_H_ */ diff --git a/tests/bsim/bluetooth/host/l2cap/einprogress/src/dut.c b/tests/bsim/bluetooth/host/l2cap/einprogress/src/dut.c new file mode 100644 index 0000000000000..2c026befd203d --- /dev/null +++ b/tests/bsim/bluetooth/host/l2cap/einprogress/src/dut.c @@ -0,0 +1,124 @@ +/* Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "data.h" + +LOG_MODULE_REGISTER(dut, LOG_LEVEL_INF); + +/** Here we keep track of the reference count in the test + * application. This allows us to notice if the stack has freed + * references that were ours. + */ +static atomic_t acl_pool_refs_held[CONFIG_BT_BUF_ACL_RX_COUNT]; + +BUILD_ASSERT(IS_ENABLED(CONFIG_BT_TESTING)); +BUILD_ASSERT(IS_ENABLED(CONFIG_BT_HCI_ACL_FLOW_CONTROL)); +void bt_testing_trace_event_acl_pool_destroy(struct net_buf *destroyed_buf) +{ + int buf_id = net_buf_id(destroyed_buf); + + __ASSERT_NO_MSG(0 <= buf_id && buf_id < ARRAY_SIZE(acl_pool_refs_held)); + TEST_ASSERT(acl_pool_refs_held[buf_id] == 0, + "ACL buf was destroyed while tester still held a reference"); +} + +static void acl_pool_refs_held_add(struct net_buf *buf) +{ + int buf_id = net_buf_id(buf); + + __ASSERT_NO_MSG(0 <= buf_id && buf_id < CONFIG_BT_BUF_ACL_RX_COUNT); + atomic_inc(&acl_pool_refs_held[buf_id]); +} + +static void acl_pool_refs_held_remove(struct net_buf *buf) +{ + int buf_id = net_buf_id(buf); + + __ASSERT_NO_MSG(0 <= buf_id && buf_id < ARRAY_SIZE(acl_pool_refs_held)); + atomic_val_t old = atomic_dec(&acl_pool_refs_held[buf_id]); + + __ASSERT(old != 0, "Tester error: releasing a reference that was not held"); +} + +struct k_fifo ack_todo; + +static int dut_chan_recv_cb(struct bt_l2cap_chan *chan, struct net_buf *buf) +{ + /* Move buf. Ownership is ours if we return -EINPROGRESS. */ + acl_pool_refs_held_add(buf); + k_fifo_put(&ack_todo, buf); + + return -EINPROGRESS; +} + +static const struct bt_l2cap_chan_ops ops = { + .recv = dut_chan_recv_cb, +}; + +static struct bt_l2cap_le_chan le_chan = { + .chan.ops = &ops, +}; + +static int dut_server_accept_cb(struct bt_conn *conn, struct bt_l2cap_server *server, + struct bt_l2cap_chan **chan) +{ + *chan = &le_chan.chan; + return 0; +} + +static struct bt_l2cap_server test_l2cap_server = { + .accept = dut_server_accept_cb, + .psm = TEST_DATA_L2CAP_PSM, +}; + +void entrypoint_dut(void) +{ + struct net_buf *ack_buf; + struct bt_conn *conn = NULL; + int err; + + TEST_START("dut"); + + k_fifo_init(&ack_todo); + + err = bt_id_create(&TEST_DATA_DUT_ADDR, NULL); + __ASSERT_NO_MSG(!err); + + err = bt_enable(NULL); + __ASSERT_NO_MSG(!err); + + err = bt_l2cap_server_register(&test_l2cap_server); + __ASSERT_NO_MSG(!err); + + err = bt_testlib_adv_conn(&conn, BT_ID_DEFAULT, NULL); + __ASSERT_NO_MSG(!err); + + ack_buf = k_fifo_get(&ack_todo, K_FOREVER); + __ASSERT_NO_MSG(ack_buf); + + acl_pool_refs_held_remove(ack_buf); + err = bt_l2cap_chan_recv_complete(&le_chan.chan, ack_buf); + TEST_ASSERT(!err); + + TEST_PASS_AND_EXIT("dut"); +} diff --git a/tests/bsim/bluetooth/host/l2cap/einprogress/src/main.c b/tests/bsim/bluetooth/host/l2cap/einprogress/src/main.c new file mode 100644 index 0000000000000..d6611e8f8dd14 --- /dev/null +++ b/tests/bsim/bluetooth/host/l2cap/einprogress/src/main.c @@ -0,0 +1,47 @@ +/* Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include "bstests.h" +#include "babblekit/testcase.h" + +extern void entrypoint_dut(void); +extern void entrypoint_tester(void); +extern enum bst_result_t bst_result; + +static void test_end_cb(void) +{ + if (bst_result != Passed) { + TEST_PRINT("Test has not passed."); + } +} + +static const struct bst_test_instance entrypoints[] = { + { + .test_id = "l2cap/einprogress/dut", + .test_delete_f = test_end_cb, + .test_main_f = entrypoint_dut, + }, + { + .test_id = "l2cap/einprogress/tester", + .test_delete_f = test_end_cb, + .test_main_f = entrypoint_tester, + }, + BSTEST_END_MARKER, +}; + +static struct bst_test_list *install(struct bst_test_list *tests) +{ + return bst_add_tests(tests, entrypoints); +}; + +bst_test_install_t test_installers[] = {install, NULL}; + +int main(void) +{ + bst_main(); + + return 0; +} diff --git a/tests/bsim/bluetooth/host/l2cap/einprogress/src/tester.c b/tests/bsim/bluetooth/host/l2cap/einprogress/src/tester.c new file mode 100644 index 0000000000000..2e2d000aa9c43 --- /dev/null +++ b/tests/bsim/bluetooth/host/l2cap/einprogress/src/tester.c @@ -0,0 +1,72 @@ +/* Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "data.h" + +LOG_MODULE_REGISTER(tester, LOG_LEVEL_INF); + +static int tester_chan_recv_cb(struct bt_l2cap_chan *chan, struct net_buf *buf) +{ + __ASSERT(false, "Unexpected recv in tester"); + return 0; +}; + +static struct bt_l2cap_le_chan le_chan = { + .chan.ops = + &(const struct bt_l2cap_chan_ops){ + .recv = tester_chan_recv_cb, + }, +}; + +NET_BUF_POOL_DEFINE(test_pool, 1, BT_L2CAP_SDU_BUF_SIZE(0), CONFIG_BT_CONN_TX_USER_DATA_SIZE, NULL); + +void entrypoint_tester(void) +{ + struct net_buf *sdu; + struct bt_conn *conn = NULL; + int err; + + TEST_START("tester"); + + err = bt_enable(NULL); + __ASSERT_NO_MSG(!err); + + err = bt_testlib_connect(&TEST_DATA_DUT_ADDR, &conn); + __ASSERT_NO_MSG(!err); + + err = bt_l2cap_chan_connect(conn, &le_chan.chan, TEST_DATA_L2CAP_PSM); + __ASSERT_NO_MSG(!err); + + /* Wait for async L2CAP connect */ + while (!atomic_test_bit(le_chan.chan.status, BT_L2CAP_STATUS_OUT)) { + k_sleep(K_MSEC(100)); + } + + sdu = net_buf_alloc(&test_pool, K_NO_WAIT); + __ASSERT_NO_MSG(sdu); + net_buf_reserve(sdu, BT_L2CAP_SDU_CHAN_SEND_RESERVE); + + err = bt_l2cap_chan_send(&le_chan.chan, sdu); + __ASSERT(!err, "err: %d", err); + + TEST_PASS("tester"); +} diff --git a/tests/bsim/bluetooth/host/l2cap/einprogress/test_scripts/run.sh b/tests/bsim/bluetooth/host/l2cap/einprogress/test_scripts/run.sh new file mode 100755 index 0000000000000..b86db52d9dfc0 --- /dev/null +++ b/tests/bsim/bluetooth/host/l2cap/einprogress/test_scripts/run.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# Copyright (c) 2024 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +set -eu + +source ${ZEPHYR_BASE}/tests/bsim/sh_common.source + +test_name="$(guess_test_long_name)" +simulation_id=${test_name} +verbosity_level=2 +EXECUTE_TIMEOUT=120 +SIM_LEN_US=$((2 * 1000 * 1000)) + +test_exe="${BSIM_OUT_PATH}/bin/bs_${BOARD_TS}_${test_name}_prj_conf" + +cd ${BSIM_OUT_PATH}/bin + +Execute "${test_exe}" -v=${verbosity_level} -s=${simulation_id} -d=0 \ + -testid=l2cap/einprogress/dut +Execute "${test_exe}" -v=${verbosity_level} -s=${simulation_id} -d=1 \ + -testid=l2cap/einprogress/tester + +Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} -D=2 -sim_length=${SIM_LEN_US} $@ + +wait_for_background_jobs From e2f5ac01c7965e973dc40fb2a6e6e3fd80a37d1b Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Tue, 14 May 2024 11:58:10 +0200 Subject: [PATCH 1860/4482] cmake: cleanup hwm_v2.cmake module code Cleanup the Kconfig generating code in hwm_v2.cmake by moving common logic inside the kconfig_gen() helper function. This prepares the code for board extension feature. Signed-off-by: Torsten Rasmussen --- cmake/modules/hwm_v2.cmake | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/cmake/modules/hwm_v2.cmake b/cmake/modules/hwm_v2.cmake index 45238f212b391..b514a33c5b0a6 100644 --- a/cmake/modules/hwm_v2.cmake +++ b/cmake/modules/hwm_v2.cmake @@ -24,9 +24,11 @@ if(NOT HWMv2) endif() # Internal helper function for creation of Kconfig files. -function(kconfig_gen bin_dir file dirs) - file(MAKE_DIRECTORY "${bin_dir}") - set(kconfig_file ${bin_dir}/${file}) +function(kconfig_gen bin_dir file dirs comment) + set(kconfig_header "# Load ${comment} descriptions.\n") + set(kconfig_file ${KCONFIG_BINARY_DIR}/${bin_dir}/${file}) + file(WRITE ${kconfig_file} "${kconfig_header}") + foreach(dir ${dirs}) cmake_path(CONVERT "${dir}" TO_CMAKE_PATH_LIST dir) file(APPEND ${kconfig_file} "osource \"${dir}/${file}\"\n") @@ -92,28 +94,12 @@ while(TRUE) endwhile() list(REMOVE_DUPLICATES kconfig_soc_source_dir) -# Support multiple ARCH_ROOT and SOC_ROOT -set(arch_kconfig_file Kconfig) -set(soc_defconfig_file Kconfig.defconfig) -set(soc_zephyr_file Kconfig) -set(soc_kconfig_file Kconfig.soc) -set(soc_sysbuild_file Kconfig.sysbuild) -set(arch_kconfig_header "# Load arch Kconfig descriptions.\n") -set(defconfig_header "# Load Zephyr SoC Kconfig defconfig.\n") -set(soc_zephyr_header "# Load Zephyr SoC Kconfig descriptions.\n") -set(soc_kconfig_header "# Load SoC Kconfig descriptions.\n") -set(soc_sysbuild_header "# Load SoC sysbuild Kconfig descriptions.\n") -file(WRITE ${KCONFIG_BINARY_DIR}/arch/${arch_kconfig_file} "${arch_kconfig_header}") -file(WRITE ${KCONFIG_BINARY_DIR}/soc/${soc_defconfig_file} "${defconfig_header}") -file(WRITE ${KCONFIG_BINARY_DIR}/soc/${soc_zephyr_file} "${soc_zephyr_header}") -file(WRITE ${KCONFIG_BINARY_DIR}/soc/${soc_kconfig_file} "${soc_kconfig_header}") -file(WRITE ${KCONFIG_BINARY_DIR}/soc/${soc_sysbuild_file} "${soc_sysbuild_header}") - -kconfig_gen("${KCONFIG_BINARY_DIR}/arch" "${arch_kconfig_file}" "${kconfig_arch_source_dir}") -kconfig_gen("${KCONFIG_BINARY_DIR}/soc" "${soc_defconfig_file}" "${kconfig_soc_source_dir}") -kconfig_gen("${KCONFIG_BINARY_DIR}/soc" "${soc_zephyr_file}" "${kconfig_soc_source_dir}") -kconfig_gen("${KCONFIG_BINARY_DIR}/soc" "${soc_kconfig_file}" "${kconfig_soc_source_dir}") -kconfig_gen("${KCONFIG_BINARY_DIR}/soc" "${soc_sysbuild_file}" "${kconfig_soc_source_dir}") +# Support multiple ARCH_ROOT, SOC_ROOT and BOARD_ROOT +kconfig_gen("arch" "Kconfig" "${kconfig_arch_source_dir}" "Zephyr Arch Kconfig") +kconfig_gen("soc" "Kconfig.defconfig" "${kconfig_soc_source_dir}" "Zephyr SoC defconfig") +kconfig_gen("soc" "Kconfig" "${kconfig_soc_source_dir}" "Zephyr SoC Kconfig") +kconfig_gen("soc" "Kconfig.soc" "${kconfig_soc_source_dir}" "SoC Kconfig") +kconfig_gen("soc" "Kconfig.sysbuild" "${kconfig_soc_source_dir}" "Sysbuild SoC Kconfig") # Clear variables created by cmake_parse_arguments unset(SOC_V2_NAME) From 536d34fa7ae84870d595a0453897d800107ae0c5 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Wed, 8 May 2024 13:10:48 +0200 Subject: [PATCH 1861/4482] cmake: scripts: support board extension Fixes: #69548 Support extending an existing board with new board variants. This commit introduces the following changes to allow a board to be extended out-of-tree. The board yaml schema is extended to support an extend field which will be used to identify the board to be extended. A board 'plank' can be extended like this: > board: > extend: plank > variants: > - name: ext > qualifier: soc1 For the rest of the build system this means that there is no longer a single board directory. The existing CMake variable BOARD_DIR is kept and reference the directory which defines the board. A new CMake variable BOARD_DIRECTORIES provides a list of all directories which defines board targets for the board. This means the directory which defines the board as well as all directories that extends the board. Signed-off-by: Torsten Rasmussen --- Kconfig.zephyr | 4 +- boards/Kconfig | 2 +- boards/Kconfig.v1 | 6 +- boards/Kconfig.v2 | 2 +- cmake/modules/boards.cmake | 34 ++--- cmake/modules/dts.cmake | 40 +++--- cmake/modules/hwm_v2.cmake | 14 ++- cmake/modules/kconfig.cmake | 7 +- cmake/modules/kernel.cmake | 4 +- doc/_extensions/zephyr/kconfig/__init__.py | 12 +- doc/_scripts/gen_boards_catalog.py | 4 +- scripts/ci/check_compliance.py | 12 +- scripts/ci/test_plan.py | 4 +- scripts/kconfig/lint.py | 2 +- scripts/list_boards.py | 125 +++++++++++++++---- scripts/pylib/twister/twisterlib/testplan.py | 2 +- scripts/schemas/board-schema.yml | 22 +++- scripts/west_commands/boards.py | 4 +- share/sysbuild/Kconfig | 2 +- 19 files changed, 200 insertions(+), 102 deletions(-) diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 425d79f4e74ec..f97819896d94a 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -17,13 +17,13 @@ osource "${APPLICATION_SOURCE_DIR}/VERSION" # Shield defaults should have precedence over board defaults, which should have # precedence over SoC defaults, so include them in that order. # -# $ARCH and $BOARD_DIR will be glob patterns when building documentation. +# $ARCH and $KCONFIG_BOARD_DIR will be glob patterns when building documentation. # This loads custom shields defconfigs (from BOARD_ROOT) osource "$(KCONFIG_BINARY_DIR)/Kconfig.shield.defconfig" # This loads Zephyr base shield defconfigs source "boards/shields/*/Kconfig.defconfig" -osource "$(BOARD_DIR)/Kconfig.defconfig" +osource "$(KCONFIG_BOARD_DIR)/Kconfig.defconfig" # This loads Zephyr specific SoC root defconfigs source "$(KCONFIG_BINARY_DIR)/soc/Kconfig.defconfig" diff --git a/boards/Kconfig b/boards/Kconfig index 6eb9ca5916dd2..8f186b32caf4f 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -129,7 +129,7 @@ config QEMU_EXTRA_FLAGS GDBstub over serial with `-serial tcp:127.0.0.1:5678,server` # There might not be any board options, hence the optional source -osource "$(BOARD_DIR)/Kconfig" +osource "$(KCONFIG_BOARD_DIR)/Kconfig" endmenu config BOARD_HAS_TIMING_FUNCTIONS diff --git a/boards/Kconfig.v1 b/boards/Kconfig.v1 index 670e2f2376eb8..c98bd27d2db85 100644 --- a/boards/Kconfig.v1 +++ b/boards/Kconfig.v1 @@ -2,9 +2,13 @@ # SPDX-License-Identifier: Apache-2.0 +# In HWMv1 the KCONFIG_BOARD_DIR points directly to the BOARD_DIR. +# Set the BOARD_DIR variable for backwards compatibility to legacy hardware model. +BOARD_DIR := $(KCONFIG_BOARD_DIR) + choice prompt "Board Selection" -source "$(BOARD_DIR)/Kconfig.board" +source "$(KCONFIG_BOARD_DIR)/Kconfig.board" endchoice diff --git a/boards/Kconfig.v2 b/boards/Kconfig.v2 index 47bb3ae224016..6fce9ccb99d58 100644 --- a/boards/Kconfig.v2 +++ b/boards/Kconfig.v2 @@ -25,4 +25,4 @@ config BOARD_QUALIFIERS For example, if building for ``nrf5340dk/nrf5340/cpuapp`` then this will contain the value ``nrf5340/cpuapp``. -osource "$(BOARD_DIR)/Kconfig.$(BOARD)" +osource "$(KCONFIG_BOARD_DIR)/Kconfig.$(BOARD)" diff --git a/cmake/modules/boards.cmake b/cmake/modules/boards.cmake index a1b05b07b5754..2b78845482a23 100644 --- a/cmake/modules/boards.cmake +++ b/cmake/modules/boards.cmake @@ -185,9 +185,7 @@ set(format_str "{NAME}\;{DIR}\;{HWM}\;") set(format_str "${format_str}{REVISION_FORMAT}\;{REVISION_DEFAULT}\;{REVISION_EXACT}\;") set(format_str "${format_str}{REVISIONS}\;{SOCS}\;{QUALIFIERS}") -if(BOARD_DIR) - set(board_dir_arg "--board-dir=${BOARD_DIR}") -endif() +list(TRANSFORM BOARD_DIRECTORIES PREPEND "--board-dir=" OUTPUT_VARIABLE board_dir_arg) execute_process(${list_boards_commands} --board=${BOARD} ${board_dir_arg} --cmakeformat=${format_str} OUTPUT_VARIABLE ret_board @@ -200,29 +198,15 @@ endif() if(NOT "${ret_board}" STREQUAL "") string(STRIP "${ret_board}" ret_board) - string(FIND "${ret_board}" "\n" idx REVERSE) - if(idx GREATER -1) - while(TRUE) - math(EXPR start "${idx} + 1") - string(SUBSTRING "${ret_board}" ${start} -1 line) - string(SUBSTRING "${ret_board}" 0 ${idx} ret_board) - - cmake_parse_arguments(LIST_BOARD "" "DIR" "" ${line}) - set(board_dirs "${board_dirs}\n${LIST_BOARD_DIR}") - - if(idx EQUAL -1) - break() - endif() - string(FIND "${ret_board}" "\n" idx REVERSE) - endwhile() - message(FATAL_ERROR "Multiple boards named '${BOARD}' found in:${board_dirs}") - endif() - - set(single_val "NAME;DIR;HWM;REVISION_FORMAT;REVISION_DEFAULT;REVISION_EXACT") - set(multi_val "REVISIONS;SOCS;QUALIFIERS") + set(single_val "NAME;HWM;REVISION_FORMAT;REVISION_DEFAULT;REVISION_EXACT") + set(multi_val "DIR;REVISIONS;SOCS;QUALIFIERS") cmake_parse_arguments(LIST_BOARD "" "${single_val}" "${multi_val}" ${ret_board}) - set(BOARD_DIR ${LIST_BOARD_DIR} CACHE PATH "Board directory for board (${BOARD})" FORCE) - set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${BOARD_DIR}/board.yml) + list(GET LIST_BOARD_DIR 0 BOARD_DIR) + set(BOARD_DIR ${BOARD_DIR} CACHE PATH "Main board directory for board (${BOARD})" FORCE) + set(BOARD_DIRECTORIES ${LIST_BOARD_DIR} CACHE INTERNAL "List of board directories for board (${BOARD})" FORCE) + foreach(dir ${BOARD_DIRECTORIES}) + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${dir}/board.yml) + endforeach() # Create two CMake variables identifying the hw model. # CMake variable: HWM=[v1,v2] diff --git a/cmake/modules/dts.cmake b/cmake/modules/dts.cmake index 16b497d573776..a2c56577cfa54 100644 --- a/cmake/modules/dts.cmake +++ b/cmake/modules/dts.cmake @@ -76,9 +76,9 @@ find_package(Dtc 1.4.6) # # Optional variables: # - BOARD: board name to use when looking for DTS_SOURCE -# - BOARD_DIR: board directory to use when looking for DTS_SOURCE +# - BOARD_DIRECTORIES: list of board directories to use when looking for DTS_SOURCE # - BOARD_REVISION_STRING: used when looking for a board revision's -# devicetree overlay file in BOARD_DIR +# devicetree overlay file in one of the BOARD_DIRECTORIES # - CMAKE_DTS_PREPROCESSOR: the path to the preprocessor to use # for devicetree files # - DTC_OVERLAY_FILE: list of devicetree overlay files which will be @@ -94,7 +94,7 @@ find_package(Dtc 1.4.6) # C preprocessor when generating the devicetree from DTS_SOURCE # - DTS_SOURCE: the devicetree source file to use may be pre-set # with this variable; otherwise, it defaults to -# ${BOARD_DIR}/${BOARD}.dts +# ${BOARD_DIRECTORIES}/.dts # # Variables set by this module and not mentioned above are for internal # use only, and may be removed, renamed, or re-purposed without prior notice. @@ -137,28 +137,30 @@ if(NOT DEFINED DTS_SOURCE) zephyr_build_string(board_string SHORT shortened_board_string BOARD ${BOARD} BOARD_QUALIFIERS ${BOARD_QUALIFIERS} ) - if(EXISTS ${BOARD_DIR}/${shortened_board_string}.dts AND NOT BOARD_${BOARD}_SINGLE_SOC) - message(FATAL_ERROR "Board ${ZFILE_BOARD} defines multiple SoCs.\nShortened file name " - "(${shortened_board_string}.dts) not allowed, use '_.dts' naming" - ) - elseif(EXISTS ${BOARD_DIR}/${board_string}.dts AND EXISTS ${BOARD_DIR}/${shortened_board_string}.dts) - message(FATAL_ERROR "Conflicting file names discovered. Cannot use both " - "${board_string}.dts and ${shortened_board_string}.dts. " - "Please choose one naming style, ${board_string}.dts is recommended." - ) - elseif(EXISTS ${BOARD_DIR}/${board_string}.dts) - set(DTS_SOURCE ${BOARD_DIR}/${board_string}.dts) - elseif(EXISTS ${BOARD_DIR}/${shortened_board_string}.dts) - set(DTS_SOURCE ${BOARD_DIR}/${shortened_board_string}.dts) - endif() + foreach(dir ${BOARD_DIRECTORIES}) + if(EXISTS ${dir}/${shortened_board_string}.dts AND NOT BOARD_${BOARD}_SINGLE_SOC) + message(FATAL_ERROR "Board ${ZFILE_BOARD} defines multiple SoCs.\nShortened file name " + "(${shortened_board_string}.dts) not allowed, use '_.dts' naming" + ) + elseif(EXISTS ${dir}/${board_string}.dts AND EXISTS ${dir}/${shortened_board_string}.dts) + message(FATAL_ERROR "Conflicting file names discovered. Cannot use both " + "${board_string}.dts and ${shortened_board_string}.dts. " + "Please choose one naming style, ${board_string}.dts is recommended." + ) + elseif(EXISTS ${dir}/${board_string}.dts) + set(DTS_SOURCE ${dir}/${board_string}.dts) + elseif(EXISTS ${dir}/${shortened_board_string}.dts) + set(DTS_SOURCE ${dir}/${shortened_board_string}.dts) + endif() + endforeach() endif() if(EXISTS ${DTS_SOURCE}) # We found a devicetree. Append all relevant dts overlays we can find... - zephyr_file(CONF_FILES ${BOARD_DIR} DTS DTS_SOURCE) + zephyr_file(CONF_FILES ${BOARD_DIRECTORIES} DTS DTS_SOURCE) zephyr_file( - CONF_FILES ${BOARD_DIR} + CONF_FILES ${BOARD_DIRECTORIES} DTS no_rev_suffix_dts_board_overlays BOARD ${BOARD} BOARD_QUALIFIERS ${BOARD_QUALIFIERS} diff --git a/cmake/modules/hwm_v2.cmake b/cmake/modules/hwm_v2.cmake index b514a33c5b0a6..c4feb03736e3b 100644 --- a/cmake/modules/hwm_v2.cmake +++ b/cmake/modules/hwm_v2.cmake @@ -95,11 +95,15 @@ endwhile() list(REMOVE_DUPLICATES kconfig_soc_source_dir) # Support multiple ARCH_ROOT, SOC_ROOT and BOARD_ROOT -kconfig_gen("arch" "Kconfig" "${kconfig_arch_source_dir}" "Zephyr Arch Kconfig") -kconfig_gen("soc" "Kconfig.defconfig" "${kconfig_soc_source_dir}" "Zephyr SoC defconfig") -kconfig_gen("soc" "Kconfig" "${kconfig_soc_source_dir}" "Zephyr SoC Kconfig") -kconfig_gen("soc" "Kconfig.soc" "${kconfig_soc_source_dir}" "SoC Kconfig") -kconfig_gen("soc" "Kconfig.sysbuild" "${kconfig_soc_source_dir}" "Sysbuild SoC Kconfig") +kconfig_gen("arch" "Kconfig" "${kconfig_arch_source_dir}" "Zephyr Arch Kconfig") +kconfig_gen("soc" "Kconfig.defconfig" "${kconfig_soc_source_dir}" "Zephyr SoC defconfig") +kconfig_gen("soc" "Kconfig" "${kconfig_soc_source_dir}" "Zephyr SoC Kconfig") +kconfig_gen("soc" "Kconfig.soc" "${kconfig_soc_source_dir}" "SoC Kconfig") +kconfig_gen("soc" "Kconfig.sysbuild" "${kconfig_soc_source_dir}" "Sysbuild SoC Kconfig") +kconfig_gen("boards" "Kconfig.defconfig" "${BOARD_DIRECTORIES}" "Zephyr board defconfig") +kconfig_gen("boards" "Kconfig.${BOARD}" "${BOARD_DIRECTORIES}" "board Kconfig") +kconfig_gen("boards" "Kconfig" "${BOARD_DIRECTORIES}" "Zephyr board Kconfig") +kconfig_gen("boards" "Kconfig.sysbuild" "${BOARD_DIRECTORIES}" "Sysbuild board Kconfig") # Clear variables created by cmake_parse_arguments unset(SOC_V2_NAME) diff --git a/cmake/modules/kconfig.cmake b/cmake/modules/kconfig.cmake index 0273d39bf8508..02bebbe085199 100644 --- a/cmake/modules/kconfig.cmake +++ b/cmake/modules/kconfig.cmake @@ -21,9 +21,12 @@ file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/kconfig/include/config) set_ifndef(KCONFIG_NAMESPACE "CONFIG") set_ifndef(KCONFIG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/Kconfig) +set(KCONFIG_BOARD_DIR ${KCONFIG_BINARY_DIR}/boards) file(MAKE_DIRECTORY ${KCONFIG_BINARY_DIR}) if(HWMv1) + # HWMv1 only supoorts a single board dir which points directly to the board dir. + set(KCONFIG_BOARD_DIR ${BOARD_DIR}) # Support multiple SOC_ROOT file(MAKE_DIRECTORY ${KCONFIG_BINARY_DIR}/soc) set(kconfig_soc_root ${SOC_ROOT}) @@ -73,7 +76,7 @@ else() endif() if(NOT DEFINED BOARD_DEFCONFIG) - zephyr_file(CONF_FILES ${BOARD_DIR} DEFCONFIG BOARD_DEFCONFIG) + zephyr_file(CONF_FILES ${BOARD_DIRECTORIES} DEFCONFIG BOARD_DEFCONFIG) endif() if(DEFINED BOARD_REVISION) @@ -157,7 +160,7 @@ set(COMMON_KCONFIG_ENV_SETTINGS APP_VERSION_TWEAK_STRING=${APP_VERSION_TWEAK_STRING} CONFIG_=${KCONFIG_NAMESPACE}_ KCONFIG_CONFIG=${DOTCONFIG} - BOARD_DIR=${BOARD_DIR} + KCONFIG_BOARD_DIR=${KCONFIG_BOARD_DIR} BOARD=${BOARD} BOARD_REVISION=${BOARD_REVISION} BOARD_QUALIFIERS=${BOARD_QUALIFIERS} diff --git a/cmake/modules/kernel.cmake b/cmake/modules/kernel.cmake index 1946e2357ba52..6a1a48b172d06 100644 --- a/cmake/modules/kernel.cmake +++ b/cmake/modules/kernel.cmake @@ -173,7 +173,9 @@ if(CONFIG_LLEXT AND CONFIG_LLEXT_TYPE_ELF_SHAREDLIB) set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) endif() -include(${BOARD_DIR}/board.cmake OPTIONAL) +foreach(dir ${BOARD_DIRECTORIES}) + include(${dir}/board.cmake OPTIONAL) +endforeach() # If we are using a suitable ethernet driver inside qemu, then these options # must be set, otherwise a zephyr instance cannot receive any network packets. diff --git a/doc/_extensions/zephyr/kconfig/__init__.py b/doc/_extensions/zephyr/kconfig/__init__.py index 6052db638fa2b..abbdcc1b9be35 100644 --- a/doc/_extensions/zephyr/kconfig/__init__.py +++ b/doc/_extensions/zephyr/kconfig/__init__.py @@ -91,7 +91,7 @@ def kconfig_load(app: Sphinx) -> Tuple[kconfiglib.Kconfig, Dict[str, str]]: root_args = argparse.Namespace(**{'soc_roots': [Path(ZEPHYR_BASE)]}) v2_systems = list_hardware.find_v2_systems(root_args) - soc_folders = {soc.folder for soc in v2_systems.get_socs()} + soc_folders = {soc.folder[0] for soc in v2_systems.get_socs()} with open(Path(td) / "soc" / "Kconfig.defconfig", "w") as f: f.write('') @@ -114,8 +114,9 @@ def kconfig_load(app: Sphinx) -> Tuple[kconfiglib.Kconfig, Dict[str, str]]: (Path(td) / 'boards').mkdir(exist_ok=True) root_args = argparse.Namespace(**{'board_roots': [Path(ZEPHYR_BASE)], - 'soc_roots': [Path(ZEPHYR_BASE)], 'board': None}) - v2_boards = list_boards.find_v2_boards(root_args) + 'soc_roots': [Path(ZEPHYR_BASE)], 'board': None, + 'board_dir': []}) + v2_boards = list_boards.find_v2_boards(root_args).values() with open(Path(td) / "boards" / "Kconfig.boards", "w") as f: for board in v2_boards: @@ -126,7 +127,8 @@ def kconfig_load(app: Sphinx) -> Tuple[kconfiglib.Kconfig, Dict[str, str]]: board_str = 'BOARD_' + re.sub(r"[^a-zA-Z0-9_]", "_", qualifier).upper() f.write('config ' + board_str + '\n') f.write('\t bool\n') - f.write('source "' + (board.dir / ('Kconfig.' + board.name)).as_posix() + '"\n\n') + f.write('source "' + + (board.directories[0] / ('Kconfig.' + board.name)).as_posix() + '"\n\n') # base environment os.environ["ZEPHYR_BASE"] = str(ZEPHYR_BASE) @@ -140,7 +142,7 @@ def kconfig_load(app: Sphinx) -> Tuple[kconfiglib.Kconfig, Dict[str, str]]: os.environ["HWM_SCHEME"] = "v2" os.environ["BOARD"] = "boards" - os.environ["BOARD_DIR"] = str(Path(td) / "boards") + os.environ["KCONFIG_BOARD_DIR"] = str(Path(td) / "boards") # insert external Kconfigs to the environment module_paths = dict() diff --git a/doc/_scripts/gen_boards_catalog.py b/doc/_scripts/gen_boards_catalog.py index 859f37c9eceb4..52be751e81f63 100644 --- a/doc/_scripts/gen_boards_catalog.py +++ b/doc/_scripts/gen_boards_catalog.py @@ -70,7 +70,7 @@ def get_catalog(): arch_roots=module_settings["arch_root"], board_roots=module_settings["board_root"], soc_roots=module_settings["soc_root"], - board_dir=ZEPHYR_BASE / "boards", + board_dir=[], board=None, ) @@ -78,7 +78,7 @@ def get_catalog(): systems = list_hardware.find_v2_systems(args_find_boards) board_catalog = {} - for board in boards: + for board in boards.values(): # We could use board.vendor but it is often incorrect. Instead, deduce vendor from # containing folder. There are a few exceptions, like the "native" and "others" folders # which we know are not actual vendors so treat them as such. diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index f586b53d14712..63e7fb948b73c 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -511,8 +511,9 @@ def get_v2_model(self, kconfig_dir, settings_file): soc_roots = self.get_module_setting_root('soc', settings_file) soc_roots.insert(0, Path(ZEPHYR_BASE)) root_args = argparse.Namespace(**{'board_roots': board_roots, - 'soc_roots': soc_roots, 'board': None}) - v2_boards = list_boards.find_v2_boards(root_args) + 'soc_roots': soc_roots, 'board': None, + 'board_dir': []}) + v2_boards = list_boards.find_v2_boards(root_args).values() with open(kconfig_defconfig_file, 'w') as fp: for board in v2_boards: @@ -546,7 +547,7 @@ def get_v2_model(self, kconfig_dir, settings_file): root_args = argparse.Namespace(**{'soc_roots': soc_roots}) v2_systems = list_hardware.find_v2_systems(root_args) - soc_folders = {soc.folder for soc in v2_systems.get_socs()} + soc_folders = {soc.folder[0] for soc in v2_systems.get_socs()} with open(kconfig_defconfig_file, 'w') as fp: for folder in soc_folders: fp.write('osource "' + (Path(folder) / 'Kconfig.defconfig').as_posix() + '"\n') @@ -616,7 +617,7 @@ def parse_kconfig(self, filename="Kconfig", hwm=None): os.makedirs(os.path.join(kconfiglib_dir, 'soc'), exist_ok=True) os.makedirs(os.path.join(kconfiglib_dir, 'arch'), exist_ok=True) - os.environ["BOARD_DIR"] = kconfiglib_boards_dir + os.environ["KCONFIG_BOARD_DIR"] = kconfiglib_boards_dir self.get_v2_model(kconfiglib_dir, os.path.join(kconfiglib_dir, "settings_file.txt")) # Tells Kconfiglib to generate warnings for all references to undefined @@ -920,6 +921,9 @@ def check_no_undef_outside_kconfig(self, kconf): # Zephyr toolchain variant and therefore not # visible to compliance. "BOARD_", # Used as regex in scripts/utils/board_v1_to_v2.py + "BOARD_MPS2_AN521_CPUTEST", # Used for board and SoC extension feature tests + "BOARD_NATIVE_SIM_NATIVE_64_TWO", # Used for board and SoC extension feature tests + "BOARD_NATIVE_SIM_NATIVE_ONE", # Used for board and SoC extension feature tests "BOOT_DIRECT_XIP", # Used in sysbuild for MCUboot configuration "BOOT_DIRECT_XIP_REVERT", # Used in sysbuild for MCUboot configuration "BOOT_FIRMWARE_LOADER", # Used in sysbuild for MCUboot configuration diff --git a/scripts/ci/test_plan.py b/scripts/ci/test_plan.py index 326068ab715f6..4bb428ee5b1bb 100755 --- a/scripts/ci/test_plan.py +++ b/scripts/ci/test_plan.py @@ -239,12 +239,12 @@ def find_boards(self): # Look for boards in monitored repositories lb_args = argparse.Namespace(**{'arch_roots': roots, 'board_roots': roots, 'board': None, 'soc_roots':roots, 'board_dir': None}) - known_boards = list_boards.find_v2_boards(lb_args) + known_boards = list_boards.find_v2_boards(lb_args).values() for changed in changed_boards: for board in known_boards: c = (zephyr_base / changed).resolve() - if c.is_relative_to(board.dir.resolve()): + if c.is_relative_to(board.directories[0].resolve()): for file in glob.glob(os.path.join(board.dir, f"{board.name}*.yaml")): with open(file, 'r', encoding='utf-8') as f: b = yaml.load(f.read(), Loader=SafeLoader) diff --git a/scripts/kconfig/lint.py b/scripts/kconfig/lint.py index 30064c34546be..5a123ded42fae 100755 --- a/scripts/kconfig/lint.py +++ b/scripts/kconfig/lint.py @@ -209,7 +209,7 @@ def init_kconfig(): ZEPHYR_BASE=TOP_DIR, SOC_DIR="soc", ARCH_DIR="arch", - BOARD_DIR="boards/*/*", + KCONFIG_BOARD_DIR="boards/*/*", ARCH="*") kconf = kconfiglib.Kconfig(suppress_traceback=True) diff --git a/scripts/list_boards.py b/scripts/list_boards.py index bf71658488564..634c67df821a0 100755 --- a/scripts/list_boards.py +++ b/scripts/list_boards.py @@ -4,13 +4,13 @@ # SPDX-License-Identifier: Apache-2.0 import argparse -from collections import defaultdict +from collections import defaultdict, Counter from dataclasses import dataclass, field import itertools from pathlib import Path import pykwalify.core import sys -from typing import List +from typing import List, Union import yaml import list_hardware from list_hardware import unique_paths @@ -91,7 +91,8 @@ def from_soc(soc, variants): @dataclass(frozen=True) class Board: name: str - dir: Path + # HWMv1 only supports a single Path, and requires Board dataclass to be hashable. + directories: Union[Path, List[Path]] hwm: str full_name: str = None arch: str = None @@ -103,6 +104,41 @@ class Board: socs: List[Soc] = field(default_factory=list, compare=False) variants: List[str] = field(default_factory=list, compare=False) + def from_qualifier(self, qualifiers): + qualifiers_list = qualifiers.split('/') + + node = Soc(None) + n = len(qualifiers_list) + if n > 0: + soc_qualifier = qualifiers_list.pop(0) + for s in self.socs: + if s.name == soc_qualifier: + node = s + break + + if n > 1: + if node.cpuclusters: + cpu_qualifier = qualifiers_list.pop(0) + for c in node.cpuclusters: + if c.name == cpu_qualifier: + node = c + break + else: + node = Variant(None) + + for q in qualifiers_list: + for v in node.variants: + if v.name == q: + node = v + break + else: + node = Variant(None) + + if node in (Soc(None), Variant(None)): + sys.exit(f'ERROR: qualifiers {qualifiers} not found when extending board {self.name}') + + return node + def board_key(board): return board.name @@ -165,11 +201,10 @@ def find_arch2board_set_in(root, arches, board_dir): for arch in arches: if not (boards / arch).is_dir(): continue - for maybe_board in (boards / arch).iterdir(): if not maybe_board.is_dir(): continue - if board_dir is not None and board_dir != maybe_board: + if board_dir and maybe_board not in board_dir: continue for maybe_defconfig in maybe_board.iterdir(): file_name = maybe_defconfig.name @@ -181,7 +216,8 @@ def find_arch2board_set_in(root, arches, board_dir): def load_v2_boards(board_name, board_yml, systems): - boards = [] + boards = {} + board_extensions = [] if board_yml.is_file(): with board_yml.open('r', encoding='utf-8') as f: b = yaml.load(f.read(), Loader=SafeLoader) @@ -199,6 +235,18 @@ def load_v2_boards(board_name, board_yml, systems): board_array = b.get('boards', [b.get('board', None)]) for board in board_array: + mutual_exclusive = {'name', 'extend'} + if len(mutual_exclusive - board.keys()) < 1: + sys.exit(f'ERROR: Malformed "board" section in file: {board_yml.as_posix()}\n' + f'{mutual_exclusive} are mutual exclusive at this level.') + + # This is a extending an existing board, place in array to allow later processing. + if 'extend' in board: + board.update({'dir': board_yml.parent}) + board_extensions.append(board) + continue + + # Create board if board_name is not None: if board['name'] != board_name: # Not the board we're looking for, ignore. @@ -220,9 +268,9 @@ def load_v2_boards(board_name, board_yml, systems): socs = [Soc.from_soc(systems.get_soc(s['name']), s.get('variants', [])) for s in board.get('socs', {})] - board = Board( + boards[board['name']] = Board( name=board['name'], - dir=board_yml.parent, + directories=[board_yml.parent], vendor=board.get('vendor'), full_name=board.get('full_name'), revision_format=board.get('revision', {}).get('format'), @@ -234,8 +282,28 @@ def load_v2_boards(board_name, board_yml, systems): variants=[Variant.from_dict(v) for v in board.get('variants', [])], hwm='v2', ) - boards.append(board) - return boards + board_qualifiers = board_v2_qualifiers(boards[board['name']]) + duplicates = [q for q, n in Counter(board_qualifiers).items() if n > 1] + if duplicates: + sys.exit(f'ERROR: Duplicated board qualifiers detected {duplicates} for board: ' + f'{board["name"]}.\nPlease check content of: {board_yml.as_posix()}\n') + return boards, board_extensions + + +def extend_v2_boards(boards, board_extensions): + for e in board_extensions: + board = boards.get(e['extend']) + if board is None: + continue + board.directories.append(e['dir']) + + for v in e.get('variants', []): + node = board.from_qualifier(v['qualifier']) + if str(v['qualifier'] + '/' + v['name']) in board_v2_qualifiers(board): + board_yml = e['dir'] / BOARD_YML + sys.exit(f'ERROR: Variant: {v["name"]}, defined multiple times for board: ' + f'{board.name}.\nLast defined in {board_yml}') + node.variants.append(Variant.from_dict(v)) # Note that this does not share the args.board functionality of find_v2_boards @@ -253,14 +321,25 @@ def find_v2_boards(args): root_args = argparse.Namespace(**{'soc_roots': args.soc_roots}) systems = list_hardware.find_v2_systems(root_args) - boards = [] + boards = {} + board_extensions = [] board_files = [] - for root in unique_paths(args.board_roots): - board_files.extend((root / 'boards').rglob(BOARD_YML)) + if args.board_dir: + board_files = [d / BOARD_YML for d in args.board_dir] + else: + for root in unique_paths(args.board_roots): + board_files.extend((root / 'boards').rglob(BOARD_YML)) for board_yml in board_files: - b = load_v2_boards(args.board, board_yml, systems) - boards.extend(b) + b, e = load_v2_boards(args.board, board_yml, systems) + conflict_boards = set(boards.keys()).intersection(b.keys()) + if conflict_boards: + sys.exit(f'ERROR: Board(s): {conflict_boards}, defined multiple times.\n' + f'Last defined in {board_yml}') + boards.update(b) + board_extensions.extend(e) + + extend_v2_boards(boards, board_extensions) return boards @@ -285,7 +364,7 @@ def add_args(parser): help='add a soc root, may be given more than once') parser.add_argument("--board", dest='board', default=None, help='lookup the specific board, fail if not found') - parser.add_argument("--board-dir", default=None, type=Path, + parser.add_argument("--board-dir", default=[], type=Path, action='append', help='Only look for boards at the specific location') @@ -327,20 +406,16 @@ def board_v2_qualifiers_csv(board): def dump_v2_boards(args): - if args.board_dir: - root_args = argparse.Namespace(**{'soc_roots': args.soc_roots}) - systems = list_hardware.find_v2_systems(root_args) - boards = load_v2_boards(args.board, args.board_dir / BOARD_YML, systems) - else: - boards = find_v2_boards(args) + boards = find_v2_boards(args) - for b in boards: + for b in boards.values(): qualifiers_list = board_v2_qualifiers(b) if args.cmakeformat is not None: notfound = lambda x: x or 'NOTFOUND' info = args.cmakeformat.format( NAME='NAME;' + b.name, - DIR='DIR;' + str(b.dir.as_posix()), + DIR='DIR;' + ';'.join( + [str(x.as_posix()) for x in b.directories]), VENDOR='VENDOR;' + notfound(b.vendor), HWM='HWM;' + b.hwm, REVISION_DEFAULT='REVISION_DEFAULT;' + notfound(b.revision_default), @@ -365,7 +440,7 @@ def dump_boards(args): if args.cmakeformat is not None: info = args.cmakeformat.format( NAME='NAME;' + board.name, - DIR='DIR;' + str(board.dir.as_posix()), + DIR='DIR;' + str(board.directories.as_posix()), HWM='HWM;' + board.hwm, VENDOR='VENDOR;NOTFOUND', REVISION_DEFAULT='REVISION_DEFAULT;NOTFOUND', diff --git a/scripts/pylib/twister/twisterlib/testplan.py b/scripts/pylib/twister/twisterlib/testplan.py index 25aa5c218eafc..377a0dab2bb0b 100755 --- a/scripts/pylib/twister/twisterlib/testplan.py +++ b/scripts/pylib/twister/twisterlib/testplan.py @@ -442,7 +442,7 @@ def init_and_add_platforms(data, board, target, qualifier, aliases): logger.debug(f"Adding platform {platform.name} with aliases {platform.aliases}") self.platforms.append(platform) - for board in known_boards: + for board in known_boards.values(): new_config_found = False # don't load the same board data twice if not bdirs.get(board.dir): diff --git a/scripts/schemas/board-schema.yml b/scripts/schemas/board-schema.yml index 7a2afbd566de6..656a62a37ef0f 100644 --- a/scripts/schemas/board-schema.yml +++ b/scripts/schemas/board-schema.yml @@ -23,17 +23,33 @@ schema;variant-schema: required: false include: variant-schema +schema;extend-variant-schema: + required: false + type: seq + sequence: + - type: map + mapping: + name: + required: true + type: str + qualifier: + required: true + type: str + schema;board-schema: type: map mapping: name: - required: true + required: false # Note: either name or extend is required, but that is handled in python type: str desc: Name of the board full_name: required: false type: str desc: Full name of the board. Typically set to the commercial name of the board. + extend: + required: false # Note: either name or extend is required, but that is handled in python + type: str vendor: required: false type: str @@ -63,7 +79,7 @@ schema;board-schema: required: true type: str socs: - required: true + required: false # Required for name:, but not for extend. type: seq sequence: - type: map @@ -73,6 +89,8 @@ schema;board-schema: type: str variants: include: variant-schema + variants: + include: extend-variant-schema type: map mapping: diff --git a/scripts/west_commands/boards.py b/scripts/west_commands/boards.py index 9777d377f53e9..9cb6182a7a725 100644 --- a/scripts/west_commands/boards.py +++ b/scripts/west_commands/boards.py @@ -97,14 +97,14 @@ def do_run(self, args, _): log.inf(args.format.format(name=board.name, arch=board.arch, dir=board.dir, hwm=board.hwm, qualifiers='')) - for board in list_boards.find_v2_boards(args): + for board in list_boards.find_v2_boards(args).values(): if name_re is not None and not name_re.search(board.name): continue log.inf( args.format.format( name=board.name, full_name=board.full_name, - dir=board.dir, + dir=board.directories[0], hwm=board.hwm, vendor=board.vendor, qualifiers=list_boards.board_v2_qualifiers_csv(board), diff --git a/share/sysbuild/Kconfig b/share/sysbuild/Kconfig index 556462af31077..69f2d4cd396c5 100644 --- a/share/sysbuild/Kconfig +++ b/share/sysbuild/Kconfig @@ -6,7 +6,7 @@ rsource "Kconfig.$(HWM_SCHEME)" comment "Sysbuild image configuration" -osource "$(BOARD_DIR)/Kconfig.sysbuild" +osource "$(KCONFIG_BOARD_DIR)/Kconfig.sysbuild" osource "$(KCONFIG_BINARY_DIR)/soc/Kconfig.sysbuild" menu "Modules" From 98b186c1103a818b6fb4de0380f4c018a92c439f Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Wed, 15 May 2024 22:46:33 +0200 Subject: [PATCH 1862/4482] cmake: scripts: support SoC extension Fixes: #72374 Support extending an existing SoC with new CPU clusters. This commit introduces the following changes to allow an SoC to be extended out-of-tree. The SoC yaml schema is extended to support an extend field which will be used to identify the SoC to be extended with extra CPU clusters. A SoC 'a_soc' can be extended like this: > socs: > extend: a_soc > cpuclusters: > - name: extra_core Signed-off-by: Torsten Rasmussen --- cmake/modules/hwm_v2.cmake | 18 ++++++---- cmake/modules/soc_v2.cmake | 7 +++- scripts/list_hardware.py | 66 +++++++++++++++++++++++++--------- scripts/schemas/soc-schema.yml | 19 ++++++++-- 4 files changed, 84 insertions(+), 26 deletions(-) diff --git a/cmake/modules/hwm_v2.cmake b/cmake/modules/hwm_v2.cmake index c4feb03736e3b..a440c95c83242 100644 --- a/cmake/modules/hwm_v2.cmake +++ b/cmake/modules/hwm_v2.cmake @@ -73,19 +73,23 @@ while(TRUE) string(TOUPPER "${ARCH_V2_NAME}" ARCH_V2_NAME_UPPER) set(ARCH_V2_${ARCH_V2_NAME_UPPER}_DIR ${ARCH_V2_DIR}) elseif(HWM_TYPE MATCHES "^soc|^series|^family") - cmake_parse_arguments(SOC_V2 "" "NAME;DIR;HWM" "" ${line}) + cmake_parse_arguments(SOC_V2 "" "NAME;HWM" "DIR" ${line}) list(APPEND kconfig_soc_source_dir "${SOC_V2_DIR}") + string(TOUPPER "${SOC_V2_NAME}" SOC_V2_NAME_UPPER) + string(TOUPPER "${HWM_TYPE}" HWM_TYPE_UPPER) if(HWM_TYPE STREQUAL "soc") - set(setting_name SOC_${SOC_V2_NAME}_DIR) + # We support both SOC_foo_DIR and SOC_FOO_DIR. + set(SOC_${SOC_V2_NAME}_DIRECTORIES ${SOC_V2_DIR}) + set(SOC_${SOC_V2_NAME_UPPER}_DIRECTORIES ${SOC_V2_DIR}) + list(GET SOC_V2_DIR 0 SOC_${SOC_V2_NAME}_DIR) + list(GET SOC_V2_DIR 0 SOC_${SOC_V2_NAME_UPPER}_DIR) else() - set(setting_name SOC_${HWM_TYPE}_${SOC_V2_NAME}_DIR) + # We support both SOC_series_foo_DIR and SOC_SERIES_FOO_DIR (and family / FAMILY). + set(SOC_${HWM_TYPE}_${SOC_V2_NAME}_DIR ${SOC_V2_DIR}) + set(SOC_${HWM_TYPE_UPPER}_${SOC_V2_NAME_UPPER}_DIR ${SOC_V2_DIR}) endif() - # We support both SOC_foo_DIR and SOC_FOO_DIR. - set(${setting_name} ${SOC_V2_DIR}) - string(TOUPPER ${setting_name} setting_name) - set(${setting_name} ${SOC_V2_DIR}) endif() if(idx EQUAL -1) diff --git a/cmake/modules/soc_v2.cmake b/cmake/modules/soc_v2.cmake index 606ed690f77fa..f98d33e001184 100644 --- a/cmake/modules/soc_v2.cmake +++ b/cmake/modules/soc_v2.cmake @@ -28,5 +28,10 @@ if(HWMv2) set(SOC_FAMILY ${CONFIG_SOC_FAMILY}) set(SOC_V2_DIR ${SOC_${SOC_NAME}_DIR}) set(SOC_FULL_DIR ${SOC_V2_DIR} CACHE PATH "Path to the SoC directory." FORCE) - set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${SOC_V2_DIR}/soc.yml) + set(SOC_DIRECTORIES ${SOC_${SOC_NAME}_DIRECTORIES} CACHE INTERNAL + "List of SoC directories for SoC (${SOC_NAME})" FORCE + ) + foreach(dir ${SOC_DIRECTORIES}) + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${dir}/soc.yml) + endforeach() endif() diff --git a/scripts/list_hardware.py b/scripts/list_hardware.py index cce6fbe983137..57c8b22586f9c 100755 --- a/scripts/list_hardware.py +++ b/scripts/list_hardware.py @@ -35,6 +35,7 @@ def __init__(self, folder='', soc_yaml=None): self._socs = [] self._series = [] self._families = [] + self._extended_socs = [] if soc_yaml is None: return @@ -47,12 +48,12 @@ def __init__(self, folder='', soc_yaml=None): sys.exit(f'ERROR: Malformed yaml {soc_yaml.as_posix()}', e) for f in data.get('family', []): - family = Family(f['name'], folder, [], []) + family = Family(f['name'], [folder], [], []) for s in f.get('series', []): - series = Series(s['name'], folder, f['name'], []) + series = Series(s['name'], [folder], f['name'], []) socs = [(Soc(soc['name'], [c['name'] for c in soc.get('cpuclusters', [])], - folder, s['name'], f['name'])) + [folder], s['name'], f['name'])) for soc in s.get('socs', [])] series.socs.extend(socs) self._series.append(series) @@ -61,26 +62,36 @@ def __init__(self, folder='', soc_yaml=None): family.socs.extend(socs) socs = [(Soc(soc['name'], [c['name'] for c in soc.get('cpuclusters', [])], - folder, None, f['name'])) + [folder], None, f['name'])) for soc in f.get('socs', [])] self._socs.extend(socs) self._families.append(family) for s in data.get('series', []): - series = Series(s['name'], folder, '', []) + series = Series(s['name'], [folder], '', []) socs = [(Soc(soc['name'], [c['name'] for c in soc.get('cpuclusters', [])], - folder, s['name'], '')) + [folder], s['name'], '')) for soc in s.get('socs', [])] series.socs.extend(socs) self._series.append(series) self._socs.extend(socs) - socs = [(Soc(soc['name'], - [c['name'] for c in soc.get('cpuclusters', [])], - folder, '', '')) - for soc in data.get('socs', [])] - self._socs.extend(socs) + for soc in data.get('socs', []): + mutual_exclusive = {'name', 'extend'} + if len(mutual_exclusive - soc.keys()) < 1: + sys.exit(f'ERROR: Malformed content in SoC file: {soc_yaml}\n' + f'{mutual_exclusive} are mutual exclusive at this level.') + if soc.get('name') is not None: + self._socs.append(Soc(soc['name'], [c['name'] for c in soc.get('cpuclusters', [])], + [folder], '', '')) + elif soc.get('extend') is not None: + self._extended_socs.append(Soc(soc['extend'], + [c['name'] for c in soc.get('cpuclusters', [])], + [folder], '', '')) + else: + sys.exit(f'ERROR: Malformed "socs" section in SoC file: {soc_yaml}\n' + f'Cannot find one of required keys {mutual_exclusive}.') # Ensure that any runner configuration matches socs and cpuclusters declared in the same # soc.yml file @@ -97,7 +108,7 @@ def __init__(self, folder='', soc_yaml=None): if components and components[-1] == 'ns': components.pop() - for soc in self._socs: + for soc in self._socs + self._extended_socs: if re.match(fr'^{soc_name}$', soc.name) is not None: if soc.cpuclusters and components: check_string = '/'.join(components) @@ -133,8 +144,23 @@ def from_yaml(socs_yaml): def extend(self, systems): self._families.extend(systems.get_families()) self._series.extend(systems.get_series()) + + for es in self._extended_socs[:]: + for s in systems.get_socs(): + if s.name == es.name: + s.extend(es) + self._extended_socs.remove(es) + break self._socs.extend(systems.get_socs()) + for es in systems.get_extended_socs(): + for s in self._socs: + if s.name == es.name: + s.extend(es) + break + else: + self._extended_socs.append(es) + def get_families(self): return self._families @@ -144,6 +170,9 @@ def get_series(self): def get_socs(self): return self._socs + def get_extended_socs(self): + return self._extended_socs + def get_soc(self, name): try: return next(s for s in self._socs if s.name == name) @@ -156,15 +185,20 @@ def get_soc(self, name): class Soc: name: str cpuclusters: List[str] - folder: str + folder: List[str] series: str = '' family: str = '' + def extend(self, soc): + if self.name == soc.name: + self.cpuclusters.extend(soc.cpuclusters) + self.folder.extend(soc.folder) + @dataclass class Series: name: str - folder: str + folder: List[str] family: str socs: List[Soc] @@ -172,7 +206,7 @@ class Series: @dataclass class Family: name: str - folder: str + folder: List[str] series: List[Series] socs: List[Soc] @@ -289,7 +323,7 @@ def dump_v2_system(args, type, system): info = args.cmakeformat.format( TYPE='TYPE;' + type, NAME='NAME;' + system.name, - DIR='DIR;' + Path(system.folder).as_posix(), + DIR='DIR;' + ';'.join([Path(x).as_posix() for x in system.folder]), HWM='HWM;' + 'v2' ) else: diff --git a/scripts/schemas/soc-schema.yml b/scripts/schemas/soc-schema.yml index c13b4a4f7e058..1d8537e8ad273 100644 --- a/scripts/schemas/soc-schema.yml +++ b/scripts/schemas/soc-schema.yml @@ -24,7 +24,22 @@ schema;soc-schema: - type: map mapping: name: - required: true + required: true # Note: either name or extend is required, but that is handled in python + type: str + cpuclusters: + include: cpucluster-schema + +schema;soc-extend-schema: + required: false + type: seq + sequence: + - type: map + mapping: + name: + required: false # Note: either name or extend is required, but that is handled in python + type: str + extend: + required: false # Note: either name or extend is required, but that is handled in python type: str cpuclusters: include: cpucluster-schema @@ -60,7 +75,7 @@ mapping: series: include: series-schema socs: - include: soc-schema + include: soc-extend-schema vendor: required: false type: str From f3151571ba969f2beeae5f16a19e73c747619836 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Wed, 15 May 2024 13:42:04 +0200 Subject: [PATCH 1863/4482] tests: add twister tests for CMake board and SoC extension This commit adds new tests for verifying the functionality of the board and SoC extension feature. It does so by defining: - A new CPU cluster on an existing SoC - Two new board variants on top of an existing board The new board variants are defined on top of the existing `native_sim` board, so that the following native_sim board targets are available for the test. Existing board targets: - native_sim/native - native_sim/native/64 Extended board targets: - native_sim/native/one - native_sim/native/64/two The new CPU cluster is defined for the existing `an521` SoC. Existing CPU Clusters on an521: - cpu0 - cpu1 New CPU Cluster: - cputest For SoC tests the mps2 board is used. This means that for testing, the following board targets using the an521 SoC are: - mps2/an521/cpu0 - mps2/an521/cpu1 - mps2/an521/cputest Signed-off-by: Torsten Rasmussen --- tests/cmake/hwm/board_extend/CMakeLists.txt | 14 ++ tests/cmake/hwm/board_extend/Kconfig | 15 ++ .../hwm/board_extend/boards/native_sim.conf | 1 + .../boards/native_sim_native_64_two.conf | 1 + .../boards/native_sim_native_one.conf | 1 + .../oot_root/boards/arm/mps2/Kconfig.mps2 | 5 + .../oot_root/boards/arm/mps2/board.cmake | 14 ++ .../oot_root/boards/arm/mps2/board.yml | 2 + .../boards/arm/mps2/mps2_an521-common.dtsi | 191 +++++++++++++++ .../boards/arm/mps2/mps2_an521_cputest.dts | 130 +++++++++++ .../arm/mps2/mps2_an521_cputest_defconfig | 21 ++ .../boards/native/native_sim_extend/Kconfig | 30 +++ .../native_sim_extend/Kconfig.defconfig | 16 ++ .../boards/native/native_sim_extend/board.yml | 7 + .../native_sim_native_64_two.dts | 14 ++ .../native_sim_native_64_two.yaml | 25 ++ .../native_sim_native_64_two_defconfig | 7 + .../native_sim_native_one.dts | 218 ++++++++++++++++++ .../native_sim_native_one.yaml | 25 ++ .../native_sim_native_one_defconfig | 7 + .../board_extend/oot_root/soc/arm/Kconfig.soc | 6 + .../hwm/board_extend/oot_root/soc/arm/soc.yml | 4 + tests/cmake/hwm/board_extend/prj.conf | 1 + tests/cmake/hwm/board_extend/src/main.c | 85 +++++++ tests/cmake/hwm/board_extend/testcase.yaml | 33 +++ 25 files changed, 873 insertions(+) create mode 100644 tests/cmake/hwm/board_extend/CMakeLists.txt create mode 100644 tests/cmake/hwm/board_extend/Kconfig create mode 100644 tests/cmake/hwm/board_extend/boards/native_sim.conf create mode 100644 tests/cmake/hwm/board_extend/boards/native_sim_native_64_two.conf create mode 100644 tests/cmake/hwm/board_extend/boards/native_sim_native_one.conf create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/Kconfig.mps2 create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/board.cmake create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/board.yml create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521-common.dtsi create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521_cputest.dts create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521_cputest_defconfig create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/Kconfig create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/Kconfig.defconfig create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/board.yml create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two.dts create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two.yaml create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two_defconfig create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one.dts create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one.yaml create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one_defconfig create mode 100644 tests/cmake/hwm/board_extend/oot_root/soc/arm/Kconfig.soc create mode 100644 tests/cmake/hwm/board_extend/oot_root/soc/arm/soc.yml create mode 100644 tests/cmake/hwm/board_extend/prj.conf create mode 100644 tests/cmake/hwm/board_extend/src/main.c create mode 100644 tests/cmake/hwm/board_extend/testcase.yaml diff --git a/tests/cmake/hwm/board_extend/CMakeLists.txt b/tests/cmake/hwm/board_extend/CMakeLists.txt new file mode 100644 index 0000000000000..20bd94d6af05f --- /dev/null +++ b/tests/cmake/hwm/board_extend/CMakeLists.txt @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2024 Nordic Semiconductor ASA + +cmake_minimum_required(VERSION 3.20.0) + +set(BOARD_ROOT ${CMAKE_CURRENT_LIST_DIR}/oot_root) +set(SOC_ROOT ${CMAKE_CURRENT_LIST_DIR}/oot_root) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(native_sim_extend) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/cmake/hwm/board_extend/Kconfig b/tests/cmake/hwm/board_extend/Kconfig new file mode 100644 index 0000000000000..6bbf5b7322768 --- /dev/null +++ b/tests/cmake/hwm/board_extend/Kconfig @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 + +config BASE_BOARD_SETTING + bool "Base board test string" + help + This kconfig is set when the base board config fragment is supposed to + be sourced, that is when oot variant defines + 'extends:' + ' board: native_sim' + ' qualifier: posix' + ' inherit: 1' + +source "Kconfig.zephyr" diff --git a/tests/cmake/hwm/board_extend/boards/native_sim.conf b/tests/cmake/hwm/board_extend/boards/native_sim.conf new file mode 100644 index 0000000000000..71a2b211d0aab --- /dev/null +++ b/tests/cmake/hwm/board_extend/boards/native_sim.conf @@ -0,0 +1 @@ +CONFIG_BASE_BOARD_SETTING=y diff --git a/tests/cmake/hwm/board_extend/boards/native_sim_native_64_two.conf b/tests/cmake/hwm/board_extend/boards/native_sim_native_64_two.conf new file mode 100644 index 0000000000000..b2dfe184407dc --- /dev/null +++ b/tests/cmake/hwm/board_extend/boards/native_sim_native_64_two.conf @@ -0,0 +1 @@ +CONFIG_EXTENDED_VARIANT_BOARD_SETTING=y diff --git a/tests/cmake/hwm/board_extend/boards/native_sim_native_one.conf b/tests/cmake/hwm/board_extend/boards/native_sim_native_one.conf new file mode 100644 index 0000000000000..b2dfe184407dc --- /dev/null +++ b/tests/cmake/hwm/board_extend/boards/native_sim_native_one.conf @@ -0,0 +1 @@ +CONFIG_EXTENDED_VARIANT_BOARD_SETTING=y diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/Kconfig.mps2 b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/Kconfig.mps2 new file mode 100644 index 0000000000000..448c9cc130809 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/Kconfig.mps2 @@ -0,0 +1,5 @@ +# Copyright (c) 2017 Linaro Limited +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_MPS2 + select SOC_MPS2_AN521_CPUTEST if BOARD_MPS2_AN521_CPUTEST diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/board.cmake b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/board.cmake new file mode 100644 index 0000000000000..27c74975756e2 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/board.cmake @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2024, Nordic Semiconductor ASA + +if(CONFIG_BOARD_MPS2_AN521_CPUTEST) + set(QEMU_CPU_TYPE_${ARCH} cortex-m33) + set(QEMU_FLAGS_${ARCH} + -cpu ${QEMU_CPU_TYPE_${ARCH}} + -machine mps2-an521 + -nographic + -m 16 + -vga none + ) +endif() diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/board.yml b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/board.yml new file mode 100644 index 0000000000000..05982ac1bb846 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/board.yml @@ -0,0 +1,2 @@ +board: + extend: mps2 diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521-common.dtsi b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521-common.dtsi new file mode 100644 index 0000000000000..5b1959ff5fe38 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521-common.dtsi @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2019 Linaro Limited + * + * SPDX-License-Identifier: Apache-2.0 + */ + +sysclk: system-clock { + compatible = "fixed-clock"; + clock-frequency = <25000000>; + #clock-cells = <0>; +}; + +timer0: timer@0 { + compatible = "arm,cmsdk-timer"; + reg = <0x0 0x1000>; + interrupts = <3 3>; +}; + +timer1: timer@1000 { + compatible = "arm,cmsdk-timer"; + reg = <0x1000 0x1000>; + interrupts = <4 3>; +}; + +dtimer0: dtimer@2000 { + compatible = "arm,cmsdk-dtimer"; + reg = <0x2000 0x1000>; + interrupts = <5 3>; +}; + +mhu0: mhu@3000 { + compatible = "arm,mhu"; + reg = <0x3000 0x1000>; + interrupts = <6 3>; +}; + +mhu1: mhu@4000 { + compatible = "arm,mhu"; + reg = <0x4000 0x1000>; + interrupts = <7 3>; +}; + +gpio0: gpio@100000 { + compatible = "arm,cmsdk-gpio"; + reg = <0x100000 0x1000>; + interrupts = <68 3>; + gpio-controller; + #gpio-cells = <2>; +}; + +gpio1: gpio@101000 { + compatible = "arm,cmsdk-gpio"; + reg = <0x101000 0x1000>; + interrupts = <69 3>; + gpio-controller; + #gpio-cells = <2>; +}; + +gpio2: gpio@102000 { + compatible = "arm,cmsdk-gpio"; + reg = <0x102000 0x1000>; + interrupts = <70 3>; + gpio-controller; + #gpio-cells = <2>; +}; + +gpio3: gpio@103000 { + compatible = "arm,cmsdk-gpio"; + reg = <0x103000 0x1000>; + interrupts = <71 3>; + gpio-controller; + #gpio-cells = <2>; +}; + +wdog0: wdog@81000 { + compatible = "arm,cmsdk-watchdog"; + reg = <0x81000 0x1000>; + clocks = <&sysclk>; +}; + +uart0: uart@200000 { + compatible = "arm,cmsdk-uart"; + reg = <0x200000 0x1000>; + interrupts = <33 3 32 3>; + interrupt-names = "tx", "rx"; + clocks = <&sysclk>; + current-speed = <115200>; +}; + +uart1: uart@201000 { + compatible = "arm,cmsdk-uart"; + reg = <0x201000 0x1000>; + interrupts = <35 3 34 3>; + interrupt-names = "tx", "rx"; + clocks = <&sysclk>; + current-speed = <115200>; +}; + +uart2: uart@202000 { + compatible = "arm,cmsdk-uart"; + reg = <0x202000 0x1000>; + interrupts = <37 3 36 3>; + interrupt-names = "tx", "rx"; + clocks = <&sysclk>; + current-speed = <115200>; +}; + +uart3: uart@203000 { + compatible = "arm,cmsdk-uart"; + reg = <0x203000 0x1000>; + interrupts = <39 3 38 3>; + interrupt-names = "tx", "rx"; + clocks = <&sysclk>; + current-speed = <115200>; +}; + +uart4: uart@204000 { + compatible = "arm,cmsdk-uart"; + reg = <0x204000 0x1000>; + interrupts = <41 3 40 3>; + interrupt-names = "tx", "rx"; + clocks = <&sysclk>; + current-speed = <115200>; +}; + +i2c_touch: i2c@207000 { + compatible = "arm,versatile-i2c"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x207000 0x1000>; +}; + +i2c_audio_conf: i2c@208000 { + compatible = "arm,versatile-i2c"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x208000 0x1000>; +}; + +i2c_shield0: i2c@20c000 { + compatible = "arm,versatile-i2c"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x20c000 0x1000>; +}; + +i2c_shield1: i2c@20d000 { + compatible = "arm,versatile-i2c"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x20d000 0x1000>; +}; + +gpio_led0: mps2_fpgaio@302000 { + compatible = "arm,mps2-fpgaio-gpio"; + + reg = <0x302000 0x4>; + gpio-controller; + #gpio-cells = <1>; + ngpios = <2>; +}; + +gpio_button: mps2_fpgaio@302008 { + compatible = "arm,mps2-fpgaio-gpio"; + + reg = <0x302008 0x4>; + gpio-controller; + #gpio-cells = <1>; + ngpios = <2>; +}; + +gpio_misc: mps2_fpgaio@30204c { + compatible = "arm,mps2-fpgaio-gpio"; + + reg = <0x30204c 0x4>; + gpio-controller; + #gpio-cells = <1>; + ngpios = <10>; +}; + +eth0: eth@2000000 { + /* Linux has "smsc,lan9115" */ + compatible = "smsc,lan9220"; + /* Actual reg range is ~0x200 */ + reg = <0x2000000 0x100000>; + interrupts = <48 3>; +}; diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521_cputest.dts b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521_cputest.dts new file mode 100644 index 0000000000000..2bb956645cafa --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521_cputest.dts @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2018-2019 Linaro Limited + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include +#include +#include + +/ { + compatible = "arm,mps2"; + #address-cells = <1>; + #size-cells = <1>; + + aliases { + led0 = &led_0; + led1 = &led_1; + sw0 = &user_button_0; + sw1 = &user_button_1; + uart-1 = &uart1; + watchdog0 = &wdog0; + }; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + + /* + * These SRAM and flash settings give the entire available + * code and data memories to this secure firmware image. + * This may conflict with mps2_an521_remote firmware. Use + * caution when using both targets simultaneously. + */ + zephyr,sram = &ssram2_3; + zephyr,flash = &ssram1; + }; + + leds { + compatible = "gpio-leds"; + led_0: led_0 { + gpios = <&gpio_led0 0>; + label = "USERLED0"; + }; + led_1: led_1 { + gpios = <&gpio_led0 1>; + label = "USERLED1"; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + user_button_0: button_0 { + label = "USERPB0"; + gpios = <&gpio_button 0>; + zephyr,code = ; + }; + user_button_1: button_1 { + label = "USERPB1"; + gpios = <&gpio_button 1>; + zephyr,code = ; + }; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-m33"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + + mpu: mpu@e000ed90 { + compatible = "arm,armv8m-mpu"; + reg = <0xe000ed90 0x40>; + }; + }; + }; + + /* + * The memory regions defined below are according to AN521: + * https://documentation-service.arm.com/static/5fa12fe9b1a7c5445f29017f + * + * Please see tables mentioned in individual comments below for details. + */ + + ssram1: memory@10000000 { + /* Table 3-2, row 6. */ + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x10000000 DT_SIZE_M(4)>; + zephyr,memory-region = "SSRAM1"; + }; + + ssram2_3: memory@38000000 { + /* Table 3-4, rows 16 and 17. */ + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x38000000 DT_SIZE_M(4)>; + zephyr,memory-region = "SSRAM2_3"; + }; + + psram: memory@80000000 { + /* Table 3-6, row 1. */ + device_type = "memory"; + reg = <0x80000000 DT_SIZE_M(16)>; + }; + + soc { + peripheral@50000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x50000000 0x10000000>; + + #include "mps2_an521-common.dtsi" + }; + }; +}; + +&nvic { + arm,num-irq-priority-bits = <3>; +}; + +&uart1 { + status = "okay"; +}; diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521_cputest_defconfig b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521_cputest_defconfig new file mode 100644 index 0000000000000..08949950a9e8d --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521_cputest_defconfig @@ -0,0 +1,21 @@ +# +# Copyright (c) 2018-2019 Linaro Limited +# +# SPDX-License-Identifier: Apache-2.0 +# + +#CONFIG_RUNTIME_NMI=y +#CONFIG_ARM_TRUSTZONE_M=y +#CONFIG_ARM_MPU=y +CONFIG_QEMU_ICOUNT_SHIFT=6 +# +## GPIOs +CONFIG_GPIO=y + +# Serial +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y + +# Build a non-secure firmware image +#CONFIG_TRUSTED_EXECUTION_NONSECURE=y diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/Kconfig b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/Kconfig new file mode 100644 index 0000000000000..e724497c3b599 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/Kconfig @@ -0,0 +1,30 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config EXTENDED_VARIANT_BOARD_SETTING + bool "Extended variant board test string" + depends on BOARD_NATIVE_SIM_NATIVE_ONE || BOARD_NATIVE_SIM_NATIVE_64_TWO + help + This kconfig is set when the extended variant board config fragment + is supposed to be sourced, that is when oot variant defines 'extends:' + +config EXTENDED_VARIANT_BOARD_ONE_SETTING_PROMPTLESS + bool + depends on BOARD_NATIVE_SIM_NATIVE_ONE + help + This kconfig is promptless and is expected to be set through the + Kconfig.defconfig for the extended board. + +config EXTENDED_VARIANT_BOARD_TWO_SETTING_PROMPTLESS + bool + depends on BOARD_NATIVE_SIM_NATIVE_64_TWO + help + This kconfig is promptless and is expected to be set through the + Kconfig.defconfig for the extended board. + +config EXTENDED_VARIANT_BOARD_SETTING_DEFCONFIG + bool "Extended variant board test string defconfig" + depends on BOARD_NATIVE_SIM_NATIVE_ONE || BOARD_NATIVE_SIM_NATIVE_64_TWO + help + This kconfig is set when the extended variant board defconfig fragment + is supposed to be sourced, that is when oot variant defines 'extends:' diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/Kconfig.defconfig b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/Kconfig.defconfig new file mode 100644 index 0000000000000..343daa1246a31 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/Kconfig.defconfig @@ -0,0 +1,16 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_NATIVE_SIM_NATIVE_ONE + +config EXTENDED_VARIANT_BOARD_ONE_SETTING_PROMPTLESS + default y + +endif # BOARD_NATIVE_SIM_NATIVE_ONE + +if BOARD_NATIVE_SIM_NATIVE_64_TWO + +config EXTENDED_VARIANT_BOARD_TWO_SETTING_PROMPTLESS + default y + +endif # BOARD_NATIVE_SIM_NATIVE_64_TWO diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/board.yml b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/board.yml new file mode 100644 index 0000000000000..8df9cf3c433a8 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/board.yml @@ -0,0 +1,7 @@ +board: + extend: native_sim + variants: + - name: one + qualifier: native + - name: two + qualifier: native/64 diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two.dts b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two.dts new file mode 100644 index 0000000000000..b3fc17d81fbd4 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two.dts @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "native_sim_native_one.dts" + +/ { + /delete-node/ added-by-native-one; + + added-by-native-two{ + }; +}; diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two.yaml b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two.yaml new file mode 100644 index 0000000000000..190d4906cc8ae --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two.yaml @@ -0,0 +1,25 @@ +identifier: native_sim_native_64_two +name: Native Simulation port - 32-bit +type: native +simulation: native +arch: posix +ram: 65536 +flash: 65536 +toolchain: + - host + - llvm +supported: + - can + - counter + - dma + - eeprom + - netif:eth + - usb_device + - adc + - i2c + - spi + - gpio + - rtc +testing: + default: true +vendor: zephyr diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two_defconfig b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two_defconfig new file mode 100644 index 0000000000000..d0de015b0dfa7 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two_defconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_CONSOLE=y +CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=1000000 + +CONFIG_EXTENDED_VARIANT_BOARD_SETTING_DEFCONFIG=y diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one.dts b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one.dts new file mode 100644 index 0000000000000..652c7605f60e3 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one.dts @@ -0,0 +1,218 @@ +/* + * Copyright (c) 2019 Jan Van Winkel (jan.van_winkel@dxplore.eu) + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include +#include +#include + +/ { + model = "Native Sim Board"; + compatible = "zephyr,posix"; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,uart-mcumgr = &uart0; + zephyr,flash = &flash0; + zephyr,entropy = &rng; + zephyr,flash-controller = &flashcontroller0; + zephyr,display = &sdl_dc; + zephyr,canbus = &can_loopback0; + zephyr,code-partition = &slot0_partition; + }; + + aliases { + eeprom-0 = &eeprom0; + i2c-0 = &i2c0; + spi-0 = &spi0; + led0 = &led0; + rtc = &rtc; + }; + + leds { + compatible = "gpio-leds"; + led0: led_0 { + gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; + label = "Green LED"; + }; + }; + + lvgl_pointer { + compatible = "zephyr,lvgl-pointer-input"; + input = <&input_sdl_touch>; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + compatible = "zephyr,native-posix-cpu"; + reg = <0>; + }; + }; + + flashcontroller0: flash-controller@0 { + compatible = "zephyr,sim-flash"; + reg = <0x00000000 DT_SIZE_K(2048)>; + + #address-cells = <1>; + #size-cells = <1>; + erase-value = <0xff>; + + flash0: flash@0 { + status = "okay"; + compatible = "soc-nv-flash"; + erase-block-size = <4096>; + write-block-size = <1>; + reg = <0x00000000 DT_SIZE_K(2048)>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 0x0000C000>; + }; + slot0_partition: partition@c000 { + label = "image-0"; + reg = <0x0000C000 0x00069000>; + }; + slot1_partition: partition@75000 { + label = "image-1"; + reg = <0x00075000 0x00069000>; + }; + scratch_partition: partition@de000 { + label = "image-scratch"; + reg = <0x000de000 0x0001e000>; + }; + storage_partition: partition@fc000 { + label = "storage"; + reg = <0x000fc000 0x00004000>; + }; + }; + }; + }; + + eeprom0: eeprom { + status = "okay"; + compatible = "zephyr,sim-eeprom"; + size = ; + }; + + i2c0: i2c@100 { + status = "okay"; + compatible = "zephyr,i2c-emul-controller"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x100 4>; + }; + + spi0: spi@200 { + status = "okay"; + compatible = "zephyr,spi-emul-controller"; + clock-frequency = <50000000>; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x200 4>; + }; + + espi0: espi@300 { + status = "okay"; + compatible = "zephyr,espi-emul-controller"; + reg = <0x300 4>; + #address-cells = <1>; + #size-cells = <0>; + }; + + uart0: uart { + status = "okay"; + compatible = "zephyr,native-posix-uart"; + /* Dummy current-speed entry to comply with serial + * DTS binding + */ + current-speed = <0>; + }; + + uart1: uart_1 { + status = "okay"; + compatible = "zephyr,native-posix-uart"; + /* Dummy current-speed entry to comply with serial + * DTS binding + */ + current-speed = <0>; + }; + + rng: rng { + status = "okay"; + compatible = "zephyr,native-posix-rng"; + }; + + counter0: counter { + status = "okay"; + compatible = "zephyr,native-posix-counter"; + }; + + gpio0: gpio@800 { + status = "okay"; + compatible = "zephyr,gpio-emul"; + reg = <0x800 0x4>; + rising-edge; + falling-edge; + high-level; + low-level; + gpio-controller; + #gpio-cells = <2>; + }; + + zephyr_udc0: udc0 { + compatible = "zephyr,native-posix-udc"; + }; + + sdl_dc: sdl_dc { + compatible = "zephyr,sdl-dc"; + height = <240>; + width = <320>; + }; + + input_sdl_touch: input-sdl-touch { + compatible = "zephyr,input-sdl-touch"; + }; + + can_loopback0: can_loopback0 { + status = "okay"; + compatible = "zephyr,can-loopback"; + }; + + can0: can { + status = "disabled"; + compatible = "zephyr,native-linux-can"; + /* adjust zcan0 to desired host interface or create an alternative + * name, e.g.: sudo ip link property add dev vcan0 altname zcan0 + */ + host-interface = "zcan0"; + }; + + rtc: rtc { + status = "okay"; + compatible = "zephyr,rtc-emul"; + alarms-count = <2>; + }; + + dma: dma { + compatible = "zephyr,dma-emul"; + #dma-cells = <1>; + stack-size = <4096>; + }; + + added-by-native-one { + }; +}; diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one.yaml b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one.yaml new file mode 100644 index 0000000000000..ea2c2d856ae50 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one.yaml @@ -0,0 +1,25 @@ +identifier: native_sim_native_one +name: Native Simulation port - 32-bit +type: native +simulation: native +arch: posix +ram: 65536 +flash: 65536 +toolchain: + - host + - llvm +supported: + - can + - counter + - dma + - eeprom + - netif:eth + - usb_device + - adc + - i2c + - spi + - gpio + - rtc +testing: + default: true +vendor: zephyr diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one_defconfig b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one_defconfig new file mode 100644 index 0000000000000..d0de015b0dfa7 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one_defconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_CONSOLE=y +CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=1000000 + +CONFIG_EXTENDED_VARIANT_BOARD_SETTING_DEFCONFIG=y diff --git a/tests/cmake/hwm/board_extend/oot_root/soc/arm/Kconfig.soc b/tests/cmake/hwm/board_extend/oot_root/soc/arm/Kconfig.soc new file mode 100644 index 0000000000000..a699e8413a1e9 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/soc/arm/Kconfig.soc @@ -0,0 +1,6 @@ +# Copyright (c) 2024, Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SOC_MPS2_AN521_CPUTEST + bool + select SOC_MPS2_AN521 diff --git a/tests/cmake/hwm/board_extend/oot_root/soc/arm/soc.yml b/tests/cmake/hwm/board_extend/oot_root/soc/arm/soc.yml new file mode 100644 index 0000000000000..04b69c75ae4ef --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/soc/arm/soc.yml @@ -0,0 +1,4 @@ +socs: + - extend: an521 + cpuclusters: + - name: cputest diff --git a/tests/cmake/hwm/board_extend/prj.conf b/tests/cmake/hwm/board_extend/prj.conf new file mode 100644 index 0000000000000..9467c2926896d --- /dev/null +++ b/tests/cmake/hwm/board_extend/prj.conf @@ -0,0 +1 @@ +CONFIG_ZTEST=y diff --git a/tests/cmake/hwm/board_extend/src/main.c b/tests/cmake/hwm/board_extend/src/main.c new file mode 100644 index 0000000000000..9795bd8dcb8fd --- /dev/null +++ b/tests/cmake/hwm/board_extend/src/main.c @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#ifdef CONFIG_EXTENDED_VARIANT_BOARD_SETTING +#define EXTENDED_BOARD_A 1 +#else +#define EXTENDED_BOARD_A 0 +#endif + +#ifdef CONFIG_EXTENDED_VARIANT_BOARD_ONE_SETTING_PROMPTLESS +#define EXTENDED_BOARD_ONE_B 1 +#else +#define EXTENDED_BOARD_ONE_B 0 +#endif + +#ifdef CONFIG_EXTENDED_VARIANT_BOARD_TWO_SETTING_PROMPTLESS +#define EXTENDED_BOARD_TWO_C 1 +#else +#define EXTENDED_BOARD_TWO_C 0 +#endif + +#ifdef CONFIG_EXTENDED_VARIANT_BOARD_SETTING_DEFCONFIG +#define EXTENDED_BOARD_D 1 +#else +#define EXTENDED_BOARD_D 0 +#endif + +#ifdef CONFIG_BASE_BOARD_SETTING +#define BASE_BOARD_CONFIG 1 +#else +#define BASE_BOARD_CONFIG 0 +#endif + +#ifdef CONFIG_SOC_MPS2_AN521_CPUTEST +#define EXTENDED_SOC 1 +#else +#define EXTENDED_SOC 0 +#endif + +ZTEST_SUITE(soc_board_extend, NULL, NULL, NULL, NULL, NULL); + +#if CONFIG_BOARD_NATIVE_SIM +ZTEST(soc_board_extend, test_native_sim_extend) +{ +#if CONFIG_BOARD_NATIVE_SIM_NATIVE_ONE + zassert_true(EXTENDED_BOARD_A, "Expected extended board to be set"); + zassert_true(EXTENDED_BOARD_ONE_B, "Expected extended board to be set"); + zassert_false(EXTENDED_BOARD_TWO_C, "Did not expect extended board two to be set"); + zassert_true(EXTENDED_BOARD_D, "Expected extended board to be set"); + zassert_false(BASE_BOARD_CONFIG, "Did not expect base board to be set"); + zassert_true(DT_NODE_EXISTS(DT_PATH(added_by_native_one))); + zassert_false(DT_NODE_EXISTS(DT_PATH(added_by_native_two))); + zassert_false(DT_NODE_EXISTS(DT_PATH(adc))); +#elif CONFIG_BOARD_NATIVE_SIM_NATIVE_64_TWO + zassert_true(EXTENDED_BOARD_A, "Expected extended board to be set"); + zassert_false(EXTENDED_BOARD_ONE_B, "Did not expect extended board one to be set"); + zassert_true(EXTENDED_BOARD_TWO_C, "Expected extended board to be set"); + zassert_true(EXTENDED_BOARD_D, "Expected extended board to be set"); + zassert_false(BASE_BOARD_CONFIG, "Did not expect base board to be set"); + zassert_false(DT_NODE_EXISTS(DT_PATH(added_by_native_one))); + zassert_true(DT_NODE_EXISTS(DT_PATH(added_by_native_two))); + zassert_false(DT_NODE_EXISTS(DT_PATH(adc))); +#else + zassert_true(false, "Did not expect to build for a base native_sim board"); +#endif +#elif CONFIG_BOARD_MPS2 +ZTEST(soc_board_extend, test_an521_soc_extend) +{ +#if CONFIG_BOARD_MPS2_AN521_CPUTEST + zassert_true(EXTENDED_SOC, "Expected extended SoC to be set"); +#elif CONFIG_BOARD_MPS2 + zassert_true(false, "Did not expect to build for a base mps2 board"); +#endif + +#else +ZTEST(soc_board_extend, test_failure) +{ + zassert_true(false, "Did not expect to build for a regular board"); +#endif +} diff --git a/tests/cmake/hwm/board_extend/testcase.yaml b/tests/cmake/hwm/board_extend/testcase.yaml new file mode 100644 index 0000000000000..aae39ce6b2c41 --- /dev/null +++ b/tests/cmake/hwm/board_extend/testcase.yaml @@ -0,0 +1,33 @@ +common: + tags: + - cmake +tests: + cmake.board.extend_one: + extra_args: + # Twister can only lookup known board roots. + # Thus platform above is set to native_sim, while at this location + # we overrule with the native_sim/native/one board. + # Test will fail if we accidentially build for the base native_sim board. + - CACHED_BOARD=native_sim/native/one + platform_allow: + - native_sim + - native_sim/native/64 + integration_platforms: + - native_sim + - native_sim/native/64 + cmake.board.extend_two: + extra_args: + - CACHED_BOARD=native_sim/native/64/two + platform_allow: + - native_sim + - native_sim/native/64 + integration_platforms: + - native_sim + - native_sim/native/64 + cmake.soc.extend_cputest: + extra_args: + - CACHED_BOARD=mps2/an521/cputest + platform_allow: + - mps2/an521/cpu0 + integration_platforms: + - mps2/an521/cpu0 From a04dfc4ece61b8e72886bfd30c6669e85cc5deaf Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 1 Jul 2024 08:19:25 +0100 Subject: [PATCH 1864/4482] scripts: west_commands: run: Add priority to run once config Adds an optional priority parameter to the flash runner run once configuration which allows for deciding upon which file should ultimately be used Signed-off-by: Jamie McCrae --- scripts/schemas/board-schema.yml | 5 ++ scripts/schemas/soc-schema.yml | 5 ++ scripts/west_commands/run_common.py | 105 +++++++++++++++++----------- 3 files changed, 75 insertions(+), 40 deletions(-) diff --git a/scripts/schemas/board-schema.yml b/scripts/schemas/board-schema.yml index 656a62a37ef0f..4c86c9d000c2b 100644 --- a/scripts/schemas/board-schema.yml +++ b/scripts/schemas/board-schema.yml @@ -103,6 +103,11 @@ mapping: runners: type: map mapping: + priority: + type: int + desc: | + Priority of this flash run once configuration. The highest value data will be used + instead of any with lower priorities. If omitted, will default to 10. run_once: type: map desc: | diff --git a/scripts/schemas/soc-schema.yml b/scripts/schemas/soc-schema.yml index 1d8537e8ad273..060afea3254c8 100644 --- a/scripts/schemas/soc-schema.yml +++ b/scripts/schemas/soc-schema.yml @@ -88,6 +88,11 @@ mapping: runners: type: map mapping: + priority: + type: int + desc: | + Priority of this flash run once configuration. The highest value data will be used + instead of any with lower priorities. If omitted, will default to 0. run_once: type: map desc: | diff --git a/scripts/west_commands/run_common.py b/scripts/west_commands/run_common.py index 82ec7a09b9bd8..adfd2922fb98d 100644 --- a/scripts/west_commands/run_common.py +++ b/scripts/west_commands/run_common.py @@ -42,6 +42,10 @@ # Don't change this, or output from argparse won't match up. INDENT = ' ' * 2 +IGNORED_RUN_ONCE_PRIORITY = -1 +SOC_FILE_RUN_ONCE_DEFAULT_PRIORITY = 0 +BOARD_FILE_RUN_ONCE_DEFAULT_PRIORITY = 10 + if log.VERBOSE >= log.VERBOSE_NORMAL: # Using level 1 allows sub-DEBUG levels of verbosity. The # west.log module decides whether or not to actually print the @@ -96,6 +100,13 @@ class ImagesFlashed: flashed: int = 0 total: int = 0 +@dataclass +class SocBoardFilesProcessing: + filename: str + board: bool = False + priority: int = IGNORED_RUN_ONCE_PRIORITY + yaml: object = None + def command_verb(command): return "flash" if command.name == "flash" else "debug" @@ -178,6 +189,10 @@ def do_run_common(command, user_args, user_runner_args, domain_file=None): # images for a given board. board_image_count = defaultdict(ImagesFlashed) + highest_priority = IGNORED_RUN_ONCE_PRIORITY + highest_entry = None + check_files = [] + if user_args.context: dump_context(command, user_args, user_runner_args) return @@ -223,48 +238,58 @@ def do_run_common(command, user_args, user_runner_args, domain_file=None): # Load board flash runner configuration (if it exists) and store # single-use commands in a dictionary so that they get executed # once per unique board name. - if cache['BOARD_DIR'] not in processed_boards and 'SOC_FULL_DIR' in cache: - soc_yaml_file = Path(cache['SOC_FULL_DIR']) / 'soc.yml' - board_yaml_file = Path(cache['BOARD_DIR']) / 'board.yml' - group_type = 'boards' - - # Search for flash runner configuration, board takes priority over SoC - try: - with open(board_yaml_file, 'r') as f: - data_yaml = yaml.safe_load(f.read()) - - except FileNotFoundError: - continue - - if 'runners' not in data_yaml: - # Check SoC file - group_type = 'qualifiers' - try: - with open(soc_yaml_file, 'r') as f: - data_yaml = yaml.safe_load(f.read()) - - except FileNotFoundError: + for directory in cache.get_list('SOC_DIRECTORIES'): + if directory not in processed_boards: + check_files.append(SocBoardFilesProcessing(Path(directory) / 'soc.yml')) + processed_boards.add(directory) + + for directory in cache.get_list('BOARD_DIRECTORIES'): + if directory not in processed_boards: + check_files.append(SocBoardFilesProcessing(Path(directory) / 'board.yml', True)) + processed_boards.add(directory) + + for check in check_files: + try: + with open(check.filename, 'r') as f: + check.yaml = yaml.safe_load(f.read()) + + if 'runners' not in check.yaml: + continue + elif check.board is False and 'run_once' not in check.yaml['runners']: continue - processed_boards.add(cache['BOARD_DIR']) - - if 'runners' not in data_yaml or 'run_once' not in data_yaml['runners']: - continue - - for cmd in data_yaml['runners']['run_once']: - for data in data_yaml['runners']['run_once'][cmd]: - for group in data['groups']: - run_first = bool(data['run'] == 'first') - if group_type == 'qualifiers': - targets = [] - for target in group[group_type]: - # For SoC-based qualifiers, prepend to the beginning of the - # match to allow for matching any board name - targets.append('([^/]+)/' + target) - else: - targets = group[group_type] - - used_cmds.append(UsedFlashCommand(cmd, targets, data['runners'], run_first)) + if 'priority' in check.yaml['runners']: + check.priority = check.yaml['runners']['priority'] + else: + check.priority = BOARD_FILE_RUN_ONCE_DEFAULT_PRIORITY if check.board is True else SOC_FILE_RUN_ONCE_DEFAULT_PRIORITY + + if check.priority == highest_priority: + log.die("Duplicate flash run once configuration found with equal priorities") + + elif check.priority > highest_priority: + highest_priority = check.priority + highest_entry = check + + except FileNotFoundError: + continue + + if highest_entry is not None: + group_type = 'boards' if highest_entry.board is True else 'qualifiers' + + for cmd in highest_entry.yaml['runners']['run_once']: + for data in highest_entry.yaml['runners']['run_once'][cmd]: + for group in data['groups']: + run_first = bool(data['run'] == 'first') + if group_type == 'qualifiers': + targets = [] + for target in group[group_type]: + # For SoC-based qualifiers, prepend to the beginning of the + # match to allow for matching any board name + targets.append('([^/]+)/' + target) + else: + targets = group[group_type] + + used_cmds.append(UsedFlashCommand(cmd, targets, data['runners'], run_first)) # Reduce entries to only those having matching board names (either exact or with regex) and # remove any entries with empty board lists From 33e70b32dc047165d0cc1ed13c7a7f11f65e42e1 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 8 Jul 2024 13:25:12 +0100 Subject: [PATCH 1865/4482] scripts: list_hardware: Do not check qualifiers for run once config Removes validating the qualifiers for flash run once configuration as files may be present that contain information for qualifiers that are not present in a single repository but are spaced out in other repositories, or might be optional Signed-off-by: Jamie McCrae --- scripts/list_hardware.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/scripts/list_hardware.py b/scripts/list_hardware.py index 57c8b22586f9c..0a446ad7fff0d 100755 --- a/scripts/list_hardware.py +++ b/scripts/list_hardware.py @@ -100,25 +100,13 @@ def __init__(self, folder='', soc_yaml=None): for item_data in data['runners']['run_once'][grp]: for group in item_data['groups']: for qualifiers in group['qualifiers']: - soc_name, *components = qualifiers.split('/') + soc_name = qualifiers.split('/')[0] found_match = False - # Allow 'ns' as final qualifier until "virtual" CPUs are ported to soc.yml - # https://github.com/zephyrproject-rtos/zephyr/issues/70721 - if components and components[-1] == 'ns': - components.pop() - for soc in self._socs + self._extended_socs: if re.match(fr'^{soc_name}$', soc.name) is not None: - if soc.cpuclusters and components: - check_string = '/'.join(components) - for cpucluster in soc.cpuclusters: - if re.match(fr'^{check_string}$', cpucluster) is not None: - found_match = True - break - elif not soc.cpuclusters and not components: - found_match = True - break + found_match = True + break if found_match is False: sys.exit(f'ERROR: SoC qualifier match unresolved: {qualifiers}') From a1f3f882fdcded4ef80d25aafd5c7ce9c1fc58d1 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Thu, 18 Jul 2024 15:08:35 +0200 Subject: [PATCH 1866/4482] scripts: list_boards: Reintroduce Board.dir as @property In the `Board` class, the `dir` member was renamed to `directories`, both to indicate that it is now a list (in HWMv2 with board extensions) and to reflect the addition of the `BOARD_DIRECTORIES` CMake variable. Considering that the build system also keeps the `BOARD_DIR` variable, and for the sake of backwards compatibility and brevity, it should be useful to retain `Board.dir` in Python as well, symmetrically. Signed-off-by: Grzegorz Swiderski --- scripts/list_boards.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/list_boards.py b/scripts/list_boards.py index 634c67df821a0..44247b450ff90 100755 --- a/scripts/list_boards.py +++ b/scripts/list_boards.py @@ -104,6 +104,13 @@ class Board: socs: List[Soc] = field(default_factory=list, compare=False) variants: List[str] = field(default_factory=list, compare=False) + @property + def dir(self): + # Get the main board directory. + if isinstance(self.directories, Path): + return self.directories + return self.directories[0] + def from_qualifier(self, qualifiers): qualifiers_list = qualifiers.split('/') From 276c1fc4a09a80499c07808abe2a2fcb9b3c832c Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Thu, 18 Jul 2024 15:08:35 +0200 Subject: [PATCH 1867/4482] scripts: Undo Board.{dir -> directories[0]} renames `Board.dir` can be used in place of `Board.directories[0]` for brevity. Signed-off-by: Grzegorz Swiderski --- doc/_extensions/zephyr/kconfig/__init__.py | 3 +-- scripts/ci/test_plan.py | 2 +- scripts/list_boards.py | 2 +- scripts/west_commands/boards.py | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/_extensions/zephyr/kconfig/__init__.py b/doc/_extensions/zephyr/kconfig/__init__.py index abbdcc1b9be35..905376d816863 100644 --- a/doc/_extensions/zephyr/kconfig/__init__.py +++ b/doc/_extensions/zephyr/kconfig/__init__.py @@ -127,8 +127,7 @@ def kconfig_load(app: Sphinx) -> Tuple[kconfiglib.Kconfig, Dict[str, str]]: board_str = 'BOARD_' + re.sub(r"[^a-zA-Z0-9_]", "_", qualifier).upper() f.write('config ' + board_str + '\n') f.write('\t bool\n') - f.write('source "' + - (board.directories[0] / ('Kconfig.' + board.name)).as_posix() + '"\n\n') + f.write('source "' + (board.dir / ('Kconfig.' + board.name)).as_posix() + '"\n\n') # base environment os.environ["ZEPHYR_BASE"] = str(ZEPHYR_BASE) diff --git a/scripts/ci/test_plan.py b/scripts/ci/test_plan.py index 4bb428ee5b1bb..dfc8736819878 100755 --- a/scripts/ci/test_plan.py +++ b/scripts/ci/test_plan.py @@ -244,7 +244,7 @@ def find_boards(self): for changed in changed_boards: for board in known_boards: c = (zephyr_base / changed).resolve() - if c.is_relative_to(board.directories[0].resolve()): + if c.is_relative_to(board.dir.resolve()): for file in glob.glob(os.path.join(board.dir, f"{board.name}*.yaml")): with open(file, 'r', encoding='utf-8') as f: b = yaml.load(f.read(), Loader=SafeLoader) diff --git a/scripts/list_boards.py b/scripts/list_boards.py index 44247b450ff90..443e18a1980bd 100755 --- a/scripts/list_boards.py +++ b/scripts/list_boards.py @@ -447,7 +447,7 @@ def dump_boards(args): if args.cmakeformat is not None: info = args.cmakeformat.format( NAME='NAME;' + board.name, - DIR='DIR;' + str(board.directories.as_posix()), + DIR='DIR;' + str(board.dir.as_posix()), HWM='HWM;' + board.hwm, VENDOR='VENDOR;NOTFOUND', REVISION_DEFAULT='REVISION_DEFAULT;NOTFOUND', diff --git a/scripts/west_commands/boards.py b/scripts/west_commands/boards.py index 9cb6182a7a725..6c4ee16846604 100644 --- a/scripts/west_commands/boards.py +++ b/scripts/west_commands/boards.py @@ -104,7 +104,7 @@ def do_run(self, args, _): args.format.format( name=board.name, full_name=board.full_name, - dir=board.directories[0], + dir=board.dir, hwm=board.hwm, vendor=board.vendor, qualifiers=list_boards.board_v2_qualifiers_csv(board), From c4fcf56e76c7521ae5dccc8782a65368c9421e43 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Tue, 28 May 2024 15:31:42 +0200 Subject: [PATCH 1868/4482] doc: extend board porting guide with new board extend feature Extend the board porting guide with documentation on the new board extend feature. Signed-off-by: Torsten Rasmussen --- doc/hardware/porting/board_porting.rst | 58 ++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/doc/hardware/porting/board_porting.rst b/doc/hardware/porting/board_porting.rst index 48c7c2e497e2c..5b0e52ade381b 100644 --- a/doc/hardware/porting/board_porting.rst +++ b/doc/hardware/porting/board_porting.rst @@ -910,9 +910,67 @@ There are some extra things you'll need to do: #. Prepare a pull request adding your board which follows the :ref:`contribute_guidelines`. +.. _extend-board: + Board extensions **************** +The board hardware model in Zephyr allows you to extend an existing board with +new board variants. Such board extensions can be done in your custom repository +and thus outside of the Zephyr repository. + +Extending an existing board with an extra variant allows you to adjust an +existing board and thereby during build to select building for the existing, +unmodified board, or the new variant. + +To extend an existing board, first create a :file:`board.yml` in your extended +board. Make sure to use the directory structure described in +:ref:`create-your-board-directory`. + +The skeleton of the board YAML file for extending a board is: + +.. code-block:: yaml + + board: + extend: + variants: + - name: + qualifier: + +When extending a board, your board directory should look like: + +.. code-block:: none + + boards//plank + ├── board.yml + ├── plank__defconfig + └── plank_.dts + +Replace ``plank`` with the real name of the board you extend. + +In some cases you might want to also adjust additional settings, like the +:file:`Kconfig.defconfig` or :file:`Kconfig.{board}`. +Therefore it is also possible to provide the following in addition when +extending a board. + +.. code-block:: none + + boards//plank + ├── board.cmake + ├── Kconfig + ├── Kconfig.plank + ├── Kconfig.defconfig + └── plank_.yaml + +Board extensions (Old hardware model) +************************************* + +.. note:: + + This extension mechanism is intended for boards in old hardware description + format. For boards described in new hardware model format, use the extension + feature described in :ref:`extend-board`. + Boards already supported by Zephyr can be extended by downstream users, such as ``example-application`` or vendor SDKs. In some situations, certain hardware description or :ref:`choices ` can not be added in the From 4670181986c1de3c5c621ff0f532d0178f0eef15 Mon Sep 17 00:00:00 2001 From: Patryk Biel Date: Tue, 1 Oct 2024 20:33:38 +0200 Subject: [PATCH 1869/4482] boards: seeed: Add support for XIAO ESP32S3 Sense The Seeed Studio XIAO ESP32S3 Sense board is a board based on the XIAO ESP32S3 board with a soldered B2B connector that allows to connect an extension board with a camera sensor, microphone and the sdcard slot. Signed-off-by: Patryk Biel --- boards/seeed/xiao_esp32s3/Kconfig | 2 +- .../seeed/xiao_esp32s3/Kconfig.xiao_esp32s3 | 2 +- boards/seeed/xiao_esp32s3/board.yml | 3 + .../doc/img/xiao-esp32s3-sense.png | Bin 0 -> 41388 bytes boards/seeed/xiao_esp32s3/doc/index.rst | 101 +++++++++++--- .../xiao_esp32s3/xiao_esp32s3-pinctrl.dtsi | 32 +++++ .../xiao_esp32s3/xiao_esp32s3_procpu.dts | 123 +--------------- .../xiao_esp32s3_procpu_common.dtsi | 131 ++++++++++++++++++ .../xiao_esp32s3_procpu_sense.dts | 71 ++++++++++ .../xiao_esp32s3_procpu_sense.yaml | 22 +++ .../xiao_esp32s3_procpu_sense_defconfig | 7 + 11 files changed, 351 insertions(+), 143 deletions(-) create mode 100644 boards/seeed/xiao_esp32s3/doc/img/xiao-esp32s3-sense.png create mode 100644 boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_common.dtsi create mode 100644 boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.dts create mode 100644 boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.yaml create mode 100644 boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense_defconfig diff --git a/boards/seeed/xiao_esp32s3/Kconfig b/boards/seeed/xiao_esp32s3/Kconfig index 9261164bb3f51..361a4f5fc84d7 100644 --- a/boards/seeed/xiao_esp32s3/Kconfig +++ b/boards/seeed/xiao_esp32s3/Kconfig @@ -3,5 +3,5 @@ config HEAP_MEM_POOL_ADD_SIZE_BOARD int - default 4096 if BOARD_XIAO_ESP32S3_ESP32S3_PROCPU + default 4096 if BOARD_XIAO_ESP32S3_ESP32S3_PROCPU || BOARD_XIAO_ESP32S3_ESP32S3_PROCPU_SENSE default 256 if BOARD_XIAO_ESP32S3_ESP32S3_APPCPU diff --git a/boards/seeed/xiao_esp32s3/Kconfig.xiao_esp32s3 b/boards/seeed/xiao_esp32s3/Kconfig.xiao_esp32s3 index cbe0701475034..212d510c344bd 100644 --- a/boards/seeed/xiao_esp32s3/Kconfig.xiao_esp32s3 +++ b/boards/seeed/xiao_esp32s3/Kconfig.xiao_esp32s3 @@ -5,5 +5,5 @@ config BOARD_XIAO_ESP32S3 select SOC_ESP32S3_WROOM_N8R8 - select SOC_ESP32S3_PROCPU if BOARD_XIAO_ESP32S3_ESP32S3_PROCPU + select SOC_ESP32S3_PROCPU if BOARD_XIAO_ESP32S3_ESP32S3_PROCPU || BOARD_XIAO_ESP32S3_ESP32S3_PROCPU_SENSE select SOC_ESP32S3_APPCPU if BOARD_XIAO_ESP32S3_ESP32S3_APPCPU diff --git a/boards/seeed/xiao_esp32s3/board.yml b/boards/seeed/xiao_esp32s3/board.yml index c3eb3a0204dd1..1d3c200f65758 100644 --- a/boards/seeed/xiao_esp32s3/board.yml +++ b/boards/seeed/xiao_esp32s3/board.yml @@ -4,3 +4,6 @@ board: vendor: seeed socs: - name: esp32s3 + variants: + - name: 'sense' + cpucluster: 'procpu' diff --git a/boards/seeed/xiao_esp32s3/doc/img/xiao-esp32s3-sense.png b/boards/seeed/xiao_esp32s3/doc/img/xiao-esp32s3-sense.png new file mode 100644 index 0000000000000000000000000000000000000000..90e0824a13e037fbeabc4ed795b076623b2a6232 GIT binary patch literal 41388 zcmdQ~<6kDu+r2Zl?(Dj2vt65Q*Jj(cZM)63ZELe@vu*qLeg2H+&Ahl?3_f$_T-TgA z6QLj{{sSHt9smIRkdzQn0sz1T0RXUiScv~3N_mNR{{=o3WK=}O?PYQ^Q@gu6t18Mi z*4MYTHvgn1?C)%?E-mbAZR%>O#)Jo%n-~la4?Eac_#Li3#%hdAb%C z=5ewysVU3<$w-rx62H1Q<@?3P#6WATuayuN%}h_7m>AE_On-NGt0XU7Q&UrrpIcH= zJUcVd+1~p2c)!29zA!(#wze`b(2sE+M6)tn&T+eRg^z zBP)-JhAJ!~hKY@&&BYi_8rGB>ny@oR6XH?nZ7tuCX%N3(ZyswgWo*HOH?z3gdklvB}_QqbI9 zUo=*i5@#fIcd^qkv?jzvQqwV8oS#%uH(XnubF{N$B*k&@3XV=lu{BatmKI8kkK(4r zdwRU{@p1_Z_RY=t^ZxcwT$mjb87wNTlA4kr#Z5EZ-!(DZ&CN^^(%aKf zZ^P{AA34<3{4pM?Lj-w0nu1M0(&foNKQ)q)krNOWuggoSuOM(fTv_M6H=e*wccB_(2|*{ikol1M2H0WKAkr=+B-5lFk6%KwAvgki9Q+3 zT@m9jmFuD@!8SEHKGD~D(dcZgz_D9u+3cq=R1)p$Y_e4sTVX;_W-sdX3;uGtKEJ5E zxvewJO*=Q(ysEB|hY-FiJ76eOAx@1^1_bLRP4U)cceg&=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D%{)*Z@E-MFEJ#0*k=5Z@LA8r}o`2MepUU5x zN-P0n{Qa45YB?-cK%{v{H*OFb-jupcBaE(?do+YG`GI_5aLAAbQrP@N=G>%nY`zq) z04|TgAPB2C!^IC&p4ztJ_3aZS>~mOaY7YIpIw8~WKwK=-0Qkt zby#6#1lj%tNL?IT0;H(4YXhZHZ8}lLT+38v$&6cJr*+Q?#cC=NFhO_!)Ueh2s#zUW zX^Q-JS-yZ=fDZJTOlooSExcqxt&N|U?Oy_Xq9K+Kc;+qZ9%A$8iE3sAAQmDe$DBlF zQ)0Ae>aK84`G9sGQR+LXcb6LiV9V z8@35on?&MmQN3!DmA{z2`P$7@*woXL{r1Tl7uGLay1ukU#n^_B(<<&4C zeuDCj`ApNTM2g=zh{j<28$s`+zh`2NYctuc6Dj*B@uRoMj*yaX&0k?(#do|nThfY{ zmc$D`x)mdL4z76?Fs+XBwoThjRU{!x;+r8m=hClZ(j7|*@B2Q!I+&&}XB+wu8WK3+ zeup`mu6)R3-;Cu{Uypr4|0S~@z+S&LnRin;Uo!o_)er#A|9gZjilI>We>Q#VWc|kx XaISa~_7ALq^Dv%j8bTV>oudB-GxAn= literal 0 HcmV?d00001 diff --git a/boards/seeed/xiao_esp32s3/doc/index.rst b/boards/seeed/xiao_esp32s3/doc/index.rst index 0da45987f3515..6ce906d3bde59 100644 --- a/boards/seeed/xiao_esp32s3/doc/index.rst +++ b/boards/seeed/xiao_esp32s3/doc/index.rst @@ -1,13 +1,28 @@ -.. zephyr:board:: xiao_esp32s3 +.. _xiao_esp32s3: + +XIAO ESP32S3/XIAO ESP32S3 Sense +############################### Overview ******** -Seeed Studio XIAO ESP32S3 is an IoT mini development board based on the +Seeed Studio XIAO ESP32S3 and XIAO ESP32S3 Sense are IoT mini development boards based on the Espressif ESP32-S3 WiFi/Bluetooth dual-mode chip. For more details see the `Seeed Studio XIAO ESP32S3`_ wiki page. +.. figure:: img/xiao_esp32s3.jpg + :align: center + :alt: XIAO ESP32S3 + + XIAO ESP32S3 + +.. figure:: img/xiao-esp32s3-sense.png + :align: center + :alt: XIAO ESP32S3 Sense + + XIAO ESP32S3 Sense + Hardware ******** @@ -21,6 +36,8 @@ and Bluetooth® Low Energy (Bluetooth LE). It consists of high-performance dual- (Xtensa® 32-bit LX7), a low power coprocessor, a Wi-Fi baseband, a Bluetooth LE baseband, RF module, and numerous peripherals. +Additionally, Sense variant integrates a OV2640 camera sensor, microphone and sdcard slot. + Supported Features ================== @@ -57,6 +74,8 @@ Current Zephyr's XIAO ESP32S3 board supports the following features: +------------+------------+-------------------------------------+ | GDMA | on-chip | dma | +------------+------------+-------------------------------------+ +| LCD_CAM | on-chip | lcd_cam | ++------------+------------+-------------------------------------+ Connections and IOs =================== @@ -67,7 +86,7 @@ The board uses a standard XIAO pinout, the default pin mapping is the following: :align: center :alt: XIAO ESP32S3 Pinout - XIAO ESP32S3 Pinout + XIAO ESP32S3 and XIAO ESP32S3 Sense Pinout Prerequisites ------------- @@ -174,19 +193,41 @@ The only difference is the structure of the build directory. Build and flash applications as usual (see :ref:`build_an_application` and :ref:`application_run` for more details). -.. zephyr-app-commands:: - :zephyr-app: samples/hello_world - :board: xiao_esp32s3/esp32s3/procpu - :goals: build +.. tabs:: + + .. group-tab:: XIAO ESP32S3 + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: xiao_esp32s3/esp32/procpu + :goals: build + + .. group-tab:: XIAO ESP32S3 Sense + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: xiao_esp32s3/esp32/procpu/sense + :goals: build The usual ``flash`` target will work with the ``xiao_esp32s3`` board configuration. Here is an example for the :zephyr:code-sample:`hello_world` application. -.. zephyr-app-commands:: - :zephyr-app: samples/hello_world - :board: xiao_esp32s3/esp32s3/procpu - :goals: flash +.. tabs:: + + .. group-tab:: XIAO ESP32S3 + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: xiao_esp32s3/esp32/procpu + :goals: flash + + .. group-tab:: XIAO ESP32S3 Sense + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: xiao_esp32s3/esp32/procpu/sense + :goals: flash Open the serial monitor using the following command: @@ -213,17 +254,39 @@ Further documentation can be obtained from the SoC vendor in `JTAG debugging for Here is an example for building the :zephyr:code-sample:`hello_world` application. -.. zephyr-app-commands:: - :zephyr-app: samples/hello_world - :board: xiao_esp32s3/esp32/procpu - :goals: build flash +.. tabs:: + + .. group-tab:: XIAO ESP32S3 + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: xiao_esp32s3/esp32/procpu + :goals: debug + + .. group-tab:: XIAO ESP32S3 Sense + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: xiao_esp32s3/esp32/procpu/sense + :goals: debug You can debug an application in the usual way. Here is an example for the :zephyr:code-sample:`hello_world` application. -.. zephyr-app-commands:: - :zephyr-app: samples/hello_world - :board: xiao_esp32s3/esp32/procpu - :goals: debug +.. tabs:: + + .. group-tab:: XIAO ESP32S3 + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: xiao_esp32s3/esp32/procpu + :goals: debug + + .. group-tab:: XIAO ESP32S3 Sense + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: xiao_esp32s3/esp32/procpu/sense + :goals: debug References ********** diff --git a/boards/seeed/xiao_esp32s3/xiao_esp32s3-pinctrl.dtsi b/boards/seeed/xiao_esp32s3/xiao_esp32s3-pinctrl.dtsi index 27097b6bb260b..3159a39611bc5 100644 --- a/boards/seeed/xiao_esp32s3/xiao_esp32s3-pinctrl.dtsi +++ b/boards/seeed/xiao_esp32s3/xiao_esp32s3-pinctrl.dtsi @@ -41,6 +41,38 @@ }; }; + i2c1_default: i2c1_default { + group1 { + pinmux = , + ; + bias-pull-up; + drive-open-drain; + output-high; + }; + }; + + lcd_cam_default: lcd_cam_default { + group1 { + pinmux = ; + output-enable; + }; + group2 { + pinmux = , + , + , + , + , + , + , + , + , + , + ; + input-enable; + bias-disable; + }; + }; + twai_default: twai_default { group1 { pinmux = , diff --git a/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu.dts b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu.dts index 2c1349b735c4c..2a68af1ee1878 100644 --- a/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu.dts +++ b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu.dts @@ -5,130 +5,9 @@ */ /dts-v1/; - -#include -#include "xiao_esp32s3-pinctrl.dtsi" -#include "seeed_xiao_connector.dtsi" +#include "xiao_esp32s3_procpu_common.dtsi" / { model = "Seeed Xiao ESP32S3 PROCPU"; compatible = "seeed,xiao-esp32s3"; - - chosen { - zephyr,sram = &sram0; - zephyr,console = &usb_serial; - zephyr,shell-uart = &usb_serial; - zephyr,flash = &flash0; - zephyr,code-partition = &slot0_partition; - zephyr,bt-hci = &esp32_bt_hci; - }; - - aliases { - i2c-0 = &i2c0; - watchdog0 = &wdt0; - led0 = &led0; - }; - - leds { - compatible = "gpio-leds"; - led0: led_0 { - gpios = <&gpio0 21 GPIO_ACTIVE_LOW>; - label = "BUILTIN LED"; - }; - }; - -}; - -&usb_serial { - status = "okay"; -}; - -&uart0 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart0_default>; - pinctrl-names = "default"; -}; - -&i2c0 { - status = "okay"; - clock-frequency = ; - pinctrl-0 = <&i2c0_default>; - pinctrl-names = "default"; -}; - -&trng0 { - status = "okay"; -}; - -&spi2 { - #address-cells = <1>; - #size-cells = <0>; - status = "okay"; - pinctrl-0 = <&spim2_default>; - pinctrl-names = "default"; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; - -&wdt0 { - status = "okay"; -}; - -&twai { - pinctrl-0 = <&twai_default>; - pinctrl-names = "default"; -}; - -&timer0 { - status = "okay"; -}; - -&timer1 { - status = "okay"; -}; - -&flash0 { - status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x0000F000>; - read-only; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; - -&esp32_bt_hci { - status = "okay"; }; diff --git a/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_common.dtsi b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_common.dtsi new file mode 100644 index 0000000000000..8a99ef2c694f5 --- /dev/null +++ b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_common.dtsi @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2023 Seeed Studio inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "xiao_esp32s3-pinctrl.dtsi" +#include "seeed_xiao_connector.dtsi" + +/ { + chosen { + zephyr,sram = &sram0; + zephyr,console = &usb_serial; + zephyr,shell-uart = &usb_serial; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_partition; + zephyr,bt-hci = &esp32_bt_hci; + }; + + aliases { + i2c-0 = &i2c0; + watchdog0 = &wdt0; + led0 = &led0; + }; + + leds { + compatible = "gpio-leds"; + led0: led_0 { + gpios = <&gpio0 21 GPIO_ACTIVE_LOW>; + label = "BUILTIN LED"; + }; + }; + +}; + +&usb_serial { + status = "okay"; +}; + +&uart0 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart0_default>; + pinctrl-names = "default"; +}; + +&i2c0 { + status = "okay"; + clock-frequency = ; + pinctrl-0 = <&i2c0_default>; + pinctrl-names = "default"; +}; + +&trng0 { + status = "okay"; +}; + +&spi2 { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + pinctrl-0 = <&spim2_default>; + pinctrl-names = "default"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&wdt0 { + status = "okay"; +}; + +&twai { + pinctrl-0 = <&twai_default>; + pinctrl-names = "default"; +}; + +&timer0 { + status = "okay"; +}; + +&timer1 { + status = "okay"; +}; + +&flash0 { + status = "okay"; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 0x0000F000>; + read-only; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x00010000 0x00100000>; + }; + + slot1_partition: partition@110000 { + label = "image-1"; + reg = <0x00110000 0x00100000>; + }; + + scratch_partition: partition@210000 { + label = "image-scratch"; + reg = <0x00210000 0x00040000>; + }; + + storage_partition: partition@250000 { + label = "storage"; + reg = <0x00250000 0x00006000>; + }; + }; +}; + +&esp32_bt_hci { + status = "okay"; +}; diff --git a/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.dts b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.dts new file mode 100644 index 0000000000000..1fc6f2560d7fa --- /dev/null +++ b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.dts @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2023 Seeed Studio inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include "xiao_esp32s3_procpu_common.dtsi" + +/ { + model = "Seeed Xiao ESP32S3 PROCPU Sense"; + compatible = "seeed,xiao-esp32s3"; + + chosen { + zephyr,camera = &lcd_cam; + }; +}; + +&i2c1 { + status = "okay"; + clock-frequency = ; + pinctrl-0 = <&i2c1_default>; + pinctrl-names = "default"; + + ov2640: ov2640@30 { + compatible = "ovti,ov2640"; + reg = <0x30>; + status = "okay"; + clock-rate-control = <0x80>; + port { + ov2640_ep_out: endpoint { + remote-endpoint-label = "dvp_ep_in"; + }; + }; + }; +}; + +&dma { + status = "okay"; +}; + +&lcd_cam { + status = "okay"; + cam-clk = <10000000>; + pinctrl-0 = <&lcd_cam_default>; + pinctrl-names = "default"; + source = <&ov2640>; + dmas = <&dma 2>; + dma-names = "rx"; + port { + dvp_ep_in: endpoint { + remote-endpoint-label = "ov2640_ep_out"; + }; + }; +}; + +&spi2 { + status = "okay"; + cs-gpios = <&gpio0 21 GPIO_ACTIVE_LOW>; + + sdcard: sdcard@0 { + compatible = "zephyr,sdhc-spi-slot"; + reg = <0>; + status = "okay"; + mmc { + compatible = "zephyr,sdmmc-disk"; + status = "okay"; + }; + spi-max-frequency = <20000000>; + }; +}; diff --git a/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.yaml b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.yaml new file mode 100644 index 0000000000000..91521bcd7d633 --- /dev/null +++ b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.yaml @@ -0,0 +1,22 @@ +identifier: xiao_esp32s3/esp32s3/procpu/sense +name: XIAO ESP32S3 Sense PROCPU +type: mcu +arch: xtensa +toolchain: + - zephyr +supported: + - gpio + - uart + - i2c + - spi + - can + - counter + - watchdog + - entropy + - pwm + - dma +testing: + ignore_tags: + - net + - bluetooth +vendor: seeed diff --git a/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense_defconfig b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense_defconfig new file mode 100644 index 0000000000000..6539bd42e5947 --- /dev/null +++ b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense_defconfig @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_UART_CONSOLE=y +CONFIG_GPIO=y From 51412b5875a4ab8a78b8b50fd5b335fcf440d1f9 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 21 Oct 2024 15:13:24 +0200 Subject: [PATCH 1870/4482] soc: st: stm32wb0: make SMPS mode visible to drivers Make the SMPS_MODE define visible from drivers by moving it to soc.h This define is for example used by the ADC driver to determine if sampling should be synchronized with the SMPS clock. Signed-off-by: Mathieu Choplain --- soc/st/stm32/stm32wb0x/soc.c | 9 +-------- soc/st/stm32/stm32wb0x/soc.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/soc/st/stm32/stm32wb0x/soc.c b/soc/st/stm32/stm32wb0x/soc.c index 546ae1a6195b5..49e42f59d815b 100644 --- a/soc/st/stm32/stm32wb0x/soc.c +++ b/soc/st/stm32/stm32wb0x/soc.c @@ -41,16 +41,9 @@ uint32_t SystemCoreClock = 16000000U; Z_GENERIC_SECTION("stm32wb0_RAM_VR") __used RAM_VR_TypeDef RAM_VR; -/** Power Controller node */ +/** Power Controller node (shorthand for upcoming macros) */ #define PWRC DT_INST(0, st_stm32wb0_pwr) -/** SMPS modes */ -#define STM32WB0_SMPS_MODE_OFF 0 -#define STM32WB0_SMPS_MODE_PRECHARGE 1 -#define STM32WB0_SMPS_MODE_RUN 2 - -#define SMPS_MODE _CONCAT(STM32WB0_SMPS_MODE_, DT_STRING_UNQUOTED(PWRC, smps_mode)) - /* Convert DTS properties to LL macros */ #define SMPS_PRESCALER _CONCAT(LL_RCC_SMPS_DIV_, DT_PROP(PWRC, smps_clock_prescaler)) diff --git a/soc/st/stm32/stm32wb0x/soc.h b/soc/st/stm32/stm32wb0x/soc.h index 57d14e761c3bc..8361f7258e87a 100644 --- a/soc/st/stm32/stm32wb0x/soc.h +++ b/soc/st/stm32/stm32wb0x/soc.h @@ -17,6 +17,17 @@ #include +/** SMPS modes */ +#define STM32WB0_SMPS_MODE_OFF 0 +#define STM32WB0_SMPS_MODE_PRECHARGE 1 +#define STM32WB0_SMPS_MODE_RUN 2 + +/** Active SMPS mode (provided here for usage in drivers) */ +#define SMPS_MODE _CONCAT(STM32WB0_SMPS_MODE_, \ + DT_STRING_UNQUOTED( \ + DT_INST(0, st_stm32wb0_pwr), \ + smps_mode)) + #endif /* !_ASMLANGUAGE */ #endif /* _STM32WB0_SOC_H_ */ From 189d0211280d7ca3622c41d8092a2fbf4e208b2e Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 21 Oct 2024 15:24:52 +0200 Subject: [PATCH 1871/4482] dts: bindings: adc: add STM32WB0 ADC Add DT binding for STM32WB0 series ADC. Signed-off-by: Mathieu Choplain --- dts/bindings/adc/st,stm32wb0-adc.yaml | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 dts/bindings/adc/st,stm32wb0-adc.yaml diff --git a/dts/bindings/adc/st,stm32wb0-adc.yaml b/dts/bindings/adc/st,stm32wb0-adc.yaml new file mode 100644 index 0000000000000..b2b6599c83443 --- /dev/null +++ b/dts/bindings/adc/st,stm32wb0-adc.yaml @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: Apache-2.0 + +description: STM32WB0 series Analog-to-Digital Converter + +compatible: "st,stm32wb0-adc" + +include: [adc-controller.yaml, pinctrl-device.yaml] + +properties: + reg: + required: true + + clocks: + required: true + + interrupts: + required: true + + "#io-channel-cells": + const: 1 + + io-booster: + type: boolean + description: | + When set, the I/O Booster block is enabled during ADC usage. Otherwise, the + I/O Booster block is always disabled. This property MUST be set if VBAT voltage + may reach a value below 2.7V to guarantee that the ADC behavior remains correct. + +io-channel-cells: + - input From c86f0ac6f3cfceb8a180714d511214cfc09c87a9 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 21 Oct 2024 15:22:38 +0200 Subject: [PATCH 1872/4482] drivers: adc: stm32: add STM32WB0 ADC Add driver for ADC in STM32WB0 series. Signed-off-by: Mathieu Choplain --- drivers/adc/CMakeLists.txt | 1 + drivers/adc/Kconfig.stm32 | 11 +- drivers/adc/adc_stm32wb0.c | 1251 ++++++++++++++++++++++++++++++++++++ 3 files changed, 1262 insertions(+), 1 deletion(-) create mode 100644 drivers/adc/adc_stm32wb0.c diff --git a/drivers/adc/CMakeLists.txt b/drivers/adc/CMakeLists.txt index dce35036f4323..0877adc5b3d95 100644 --- a/drivers/adc/CMakeLists.txt +++ b/drivers/adc/CMakeLists.txt @@ -19,6 +19,7 @@ zephyr_library_sources_ifdef(CONFIG_ADC_NRFX_SAADC adc_nrfx_saadc.c) zephyr_library_sources_ifdef(CONFIG_ADC_SAM adc_sam.c) zephyr_library_sources_ifdef(CONFIG_ADC_SAM0 adc_sam0.c) zephyr_library_sources_ifdef(CONFIG_ADC_STM32 adc_stm32.c) +zephyr_library_sources_ifdef(CONFIG_ADC_STM32WB0 adc_stm32wb0.c) zephyr_library_sources_ifdef(CONFIG_ADC_XEC adc_mchp_xec.c) zephyr_library_sources_ifdef(CONFIG_ADC_LMP90XXX adc_lmp90xxx.c) zephyr_library_sources_ifdef(CONFIG_ADC_MCP320X adc_mcp320x.c) diff --git a/drivers/adc/Kconfig.stm32 b/drivers/adc/Kconfig.stm32 index 70be46acaef6d..0f567a635f9fd 100644 --- a/drivers/adc/Kconfig.stm32 +++ b/drivers/adc/Kconfig.stm32 @@ -5,6 +5,7 @@ # Copyright (c) 2019 Song Qiang # Copyright (c) 2021 Marius Scholtz, RIC Electronics # Copyright (c) 2022 Hein Wessels, Nobleo Technology +# Copyright (c) 2024 STMicroelectronics # SPDX-License-Identifier: Apache-2.0 config ADC_STM32 @@ -15,7 +16,15 @@ config ADC_STM32 help Enable the driver implementation for the stm32xx ADC -if ADC_STM32 +config ADC_STM32WB0 + bool "STM32WB0 ADC driver" + default y + depends on DT_HAS_ST_STM32WB0_ADC_ENABLED + select PINCTRL + help + Enable the driver implementation for the STM32WB0 series ADC + +if ADC_STM32 || ADC_STM32WB0 config ADC_STM32_DMA bool "STM32 MCU ADC DMA Support" diff --git a/drivers/adc/adc_stm32wb0.c b/drivers/adc/adc_stm32wb0.c new file mode 100644 index 0000000000000..e36cee7631c28 --- /dev/null +++ b/drivers/adc/adc_stm32wb0.c @@ -0,0 +1,1251 @@ +/* + * Copyright (c) 2024 STMicroelectronics + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * Terminology used in this file: + * - sampling: a single analog-to-digital conversion performed by the ADC + * - sequence: one or more sampling(s) performed one after the other by the + * ADC after a single programmation. This is the meaning used in the + * STM32WB0 ADC documentation. + * - round: all ADC operations needed to read all channels in the adc_sequence passed + * to adc_read. Zephyr calls this a "sampling", but we use the term "round" to + * prevent confusion with STM32 terminology. A single round may require multiple + * sequences to be performed by the ADC to be completed, due to hardware limitations. + * + * When Zephyr's "sequence" feature is used, the same round is repeated multiple times. + * + * - idle mode: clock & ADC configuration that minimizes power consumption + * - Only the ADC digital domain clock is turned on: + * - ADC is powered off (CTRL.ADC_CTRL_ADC_ON_OFF = 0) + * - ADC analog domain clock is turned off + * - If applicable: + * - ADC LDO is disabled + * - ADC I/O Booster clock is turned off + * - ADC I/O Booster is disabled + * - ADC-SMPS clock synchronization is disabled + */ + +#define DT_DRV_COMPAT st_stm32wb0_adc + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#ifdef CONFIG_ADC_STM32_DMA +#include +#include +#include +#include +#endif + +#define ADC_CONTEXT_USES_KERNEL_TIMER +#define ADC_CONTEXT_ENABLE_ON_COMPLETE +#include "adc_context.h" + +#include +LOG_MODULE_REGISTER(adc_stm32wb0, CONFIG_ADC_LOG_LEVEL); + +/** + * Driver private definitions & assertions + */ +#define ADC_INSTANCE 0 +#define ADC_NODE DT_DRV_INST(ADC_INSTANCE) +#define ADC_USE_IO_BOOSTER DT_PROP_OR(ADC_NODE, io_booster, 0) + +#define LL_ADC_EXTERNAL_CHANNEL_NUM 12 /* must be a plain constant for LISTIFY */ +#define LL_ADC_EXTERNAL_CHANNEL_MAX (LL_ADC_CHANNEL_VINP3_VINM3 + 1U) +#define LL_ADC_CHANNEL_MAX (LL_ADC_CHANNEL_TEMPSENSOR + 1U) +#define LL_ADC_VIN_RANGE_INVALID ((uint8_t)0xFFU) + +#define NUM_CALIBRATION_POINTS 4 /* 4 calibration point registers (COMP_[0-3]) */ + +#if !defined(ADC_CONF_SAMPLE_RATE_MSB) +# define NUM_ADC_SAMPLE_RATES 4 /* SAMPLE_RATE on 2 bits */ +#else +# define NUM_ADC_SAMPLE_RATES 32 /* SAMPLE_RATE on 5 bits */ +#endif + +/* The STM32WB0 has a 12-bit ADC, but the resolution can be + * enhanced to 16-bit by oversampling (using the downsampler) + */ +#define ADC_MIN_RESOLUTION 12 +#define ADC_MAX_RESOLUTION 16 + +/* ADC channel type definitions are not provided by LL as + * it uses per-type functions instead. Bring our own. + */ +#define ADC_CHANNEL_TYPE_SINGLE_NEG (0x00U) /* Single-ended, positive */ +#define ADC_CHANNEL_TYPE_SINGLE_POS (0x01U) /* Single-ended, negative */ +#define ADC_CHANNEL_TYPE_DIFF (0x02U) /* Differential */ +#define ADC_CHANNEL_TYPE_INVALID (0xFFU) /* Invalid */ + +/** See RM0505 §6.2.1 "System clock details" */ +BUILD_ASSERT(CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC >= (8 * 1000 * 1000), + "STM32WB0: system clock frequency must be at least 8MHz to use ADC"); + +/** + * Driver private structures + */ +struct adc_stm32wb0_data { + struct adc_context ctx; + const struct device *const dev; + + /** + * Bitmask of all channels requested as part of this round + * but not sampled yet. + */ + uint32_t unsampled_channels; + + /** + * Pointer in output buffer where the first data sample of the round + * is stored. This is used to reload next_sample_ptr when the user + * callback asks to repeat a round. + */ + uint16_t *round_buf_pointer; + + /** + * Pointer in output buffer where the next data sample from ADC should + * be stored. + */ + uint16_t *next_sample_ptr; + +#if defined(CONFIG_ADC_STM32_DMA) + /** Size of the sequence currently scheduled and executing */ + size_t sequence_length; + struct dma_config dmac_config; + struct dma_block_config dma_block_config; +#endif + + /** Channels configuration */ + struct adc_stm32wb0_channel_config { + /** Vinput range selection */ + uint8_t vinput_range; + } channel_config[LL_ADC_CHANNEL_MAX]; +}; + +struct adc_stm32wb0_config { + ADC_TypeDef *reg; + const struct pinctrl_dev_config *pinctrl_cfg; + /** ADC digital domain clock */ + struct stm32_pclken dig_clk; + /** ADC analog domain clock */ + struct stm32_pclken ana_clk; +#if defined(CONFIG_ADC_STM32_DMA) + const struct device *dmac; + uint32_t dma_channel; +#endif +}; + +/** + * Driver private utility functions + */ + +/** + * In STM32CubeWB0 v1.0.0, the LL_GetPackageType is buggy and returns wrong values. + * This bug is reported in the ST internal bugtracker under reference 185295. + * For now, implement the function ourselves. + */ +static inline uint32_t ll_get_package_type(void) +{ + return sys_read32(PACKAGE_BASE); +} + +static inline struct adc_stm32wb0_data *drv_data_from_adc_ctx(struct adc_context *adc_ctx) +{ + return CONTAINER_OF(adc_ctx, struct adc_stm32wb0_data, ctx); +} + +static inline uint8_t vinput_range_from_adc_ref(uint32_t reference) +{ + switch (reference) { + case ADC_REF_INTERNAL: + case ADC_REF_VDD_1: + return LL_ADC_VIN_RANGE_3V6; + case ADC_REF_VDD_1_2: + return LL_ADC_VIN_RANGE_2V4; + case ADC_REF_VDD_1_3: + return LL_ADC_VIN_RANGE_1V2; + default: + return LL_ADC_VIN_RANGE_INVALID; + } +} + +static inline uint32_t ds_width_from_adc_res(uint32_t resolution) +{ + /* + * 12 -> 0 (LL_ADC_DS_DATA_WIDTH_12_BIT) + * 13 -> 1 (LL_ADC_DS_DATA_WIDTH_13_BIT) + * 14 -> 2 (LL_ADC_DS_DATA_WIDTH_14_BIT) + * 15 -> 3 (LL_ADC_DS_DATA_WIDTH_15_BIT) + * 16 -> 4 (LL_ADC_DS_DATA_WIDTH_16_BIT) + */ + return resolution - 12; +} + +static inline uint8_t get_channel_type(uint32_t channel) +{ + switch (channel) { + case LL_ADC_CHANNEL_VINM0: + case LL_ADC_CHANNEL_VINM1: + case LL_ADC_CHANNEL_VINM2: + case LL_ADC_CHANNEL_VINM3: + case LL_ADC_CHANNEL_VBAT: + return ADC_CHANNEL_TYPE_SINGLE_NEG; + case LL_ADC_CHANNEL_VINP0: + case LL_ADC_CHANNEL_VINP1: + case LL_ADC_CHANNEL_VINP2: + case LL_ADC_CHANNEL_VINP3: + case LL_ADC_CHANNEL_TEMPSENSOR: + return ADC_CHANNEL_TYPE_SINGLE_POS; + case LL_ADC_CHANNEL_VINP0_VINM0: + case LL_ADC_CHANNEL_VINP1_VINM1: + case LL_ADC_CHANNEL_VINP2_VINM2: + case LL_ADC_CHANNEL_VINP3_VINM3: + return ADC_CHANNEL_TYPE_DIFF; + default: + __ASSERT_NO_MSG(0); + return ADC_CHANNEL_TYPE_INVALID; + } +} + +/** + * @brief Checks all fields of the adc_sequence and asserts they are + * valid and all configuration options are supported by the driver. + * + * @param sequence adc_sequence to validate + * @return 0 if the adc_sequence is valid, negative value otherwise + */ +static int validate_adc_sequence(const struct adc_sequence *sequence) +{ + const size_t round_size = sizeof(uint16_t) * POPCOUNT(sequence->channels); + size_t needed_buf_size; + + if (sequence->channels == 0 || + (sequence->channels & ~BIT_MASK(LL_ADC_CHANNEL_MAX)) != 0) { + LOG_ERR("invalid channels selection"); + return -EINVAL; + } + + CHECKIF(!sequence->buffer) { + LOG_ERR("storage buffer pointer is NULL"); + return -EINVAL; + } + + if (!IN_RANGE(sequence->resolution, ADC_MIN_RESOLUTION, ADC_MAX_RESOLUTION)) { + LOG_ERR("invalid resolution %u (must be between %u and %u)", + sequence->resolution, ADC_MIN_RESOLUTION, ADC_MAX_RESOLUTION); + return -EINVAL; + } + + /* N.B.: LL define is in the same log2(x) format as the Zephyr variable */ + if (sequence->oversampling > LL_ADC_DS_RATIO_128) { + LOG_ERR("oversampling unsupported by hardware (max: %lu)", LL_ADC_DS_RATIO_128); + return -ENOTSUP; + } + + if (sequence->options) { + const size_t samplings = (size_t)sequence->options->extra_samplings + 1; + + if (size_mul_overflow(round_size, samplings, &needed_buf_size)) { + return -ENOMEM; + } + } else { + needed_buf_size = round_size; + } + + if (needed_buf_size > sequence->buffer_size) { + return -ENOMEM; + } + + return 0; +} + +/** + * @brief Set which channel is sampled during a given conversion of the sequence. + * + * @param ADCx ADC registers pointer + * @param Conversion Target conversion index (0~15) + * @param Channel Channel to sample during specified conversion + * + * @note This function is a more convenient implementation of LL_ADC_SetSequencerRanks + */ +static inline void ll_adc_set_conversion_channel(ADC_TypeDef *ADCx, + uint32_t Conversion, uint32_t Channel) +{ + /** + * There are two registers to control the sequencer: + * - SEQ_1 holds channel selection for conversions 0~7 + * - SEQ_2 holds channel selection for conversions 8~15 + * + * Notice that all conversions in SEQ_2 have 3rd bit set, + * whereas all conversions in SEQ_1 have 3rd bit clear. + * + * In a SEQ_x register, each channel occupies 4 bits, so the + * field for conversion N is at bit offset (4 * (N % 7)). + */ + const uint32_t reg = (Conversion & 8) ? 1 : 0; + const uint32_t shift = 4 * (Conversion & 7); + + MODIFY_REG((&ADCx->SEQ_1)[reg], ADC_SEQ_1_SEQ0 << shift, Channel << shift); +} + +/** + * @brief Set the calibration point to use for a chosen channel type and Vinput range. + * + * @param ADCx ADC registers pointer + * @param Type Channel type + * @param Range Channel Vinput range + * @param Point Calibration point to use + * + * @note This is a generic version of the LL_ADC_SetCalibPointFor* functions. + */ +static inline void ll_adc_set_calib_point_for_any(ADC_TypeDef *ADCx, uint32_t Type, + uint32_t Range, uint32_t Point) +{ + __ASSERT(Range == LL_ADC_VIN_RANGE_1V2 + || Range == LL_ADC_VIN_RANGE_2V4 + || Range == LL_ADC_VIN_RANGE_3V6, "Range is not valid"); + + __ASSERT(Type == ADC_CHANNEL_TYPE_SINGLE_NEG + || Type == ADC_CHANNEL_TYPE_SINGLE_POS + || Type == ADC_CHANNEL_TYPE_DIFF, "Type is not valid"); + + __ASSERT(Point == LL_ADC_CALIB_POINT_1 + || Point == LL_ADC_CALIB_POINT_2 + || Point == LL_ADC_CALIB_POINT_3 + || Point == LL_ADC_CALIB_POINT_4, "Point is not valid"); + + /* Register organization is as follows: + * + * - Group for 1.2V Vinput range + * - Group for 2.4V Vinput range + * - Group for 3.6V Vinput range + * + * where Group is organized as: + * - Select for Single Negative mode + * - Select for Single Positive mode + * - Select for Differential mode + * + * Each select is 2 bits, and each group is thus 6 bits. + */ + + uint32_t type_shift, group_shift; + + switch (Type) { + case ADC_CHANNEL_TYPE_SINGLE_NEG: + type_shift = 0 * 2; + break; + case ADC_CHANNEL_TYPE_SINGLE_POS: + type_shift = 1 * 2; + break; + case ADC_CHANNEL_TYPE_DIFF: + type_shift = 2 * 2; + break; + default: + CODE_UNREACHABLE; + } + + switch (Range) { + case LL_ADC_VIN_RANGE_1V2: + group_shift = 0 * 6; + break; + case LL_ADC_VIN_RANGE_2V4: + group_shift = 1 * 6; + break; + case LL_ADC_VIN_RANGE_3V6: + group_shift = 2 * 6; + break; + default: + CODE_UNREACHABLE; + } + + const uint32_t shift = (group_shift + type_shift); + + MODIFY_REG(ADCx->COMP_SEL, (ADC_COMP_SEL_OFFSET_GAIN0 << shift), (Point << shift)); +} + +static void adc_acquire_pm_locks(void) +{ + pm_policy_state_lock_get(PM_STATE_SUSPEND_TO_IDLE, PM_ALL_SUBSTATES); + if (IS_ENABLED(CONFIG_PM_S2RAM)) { + pm_policy_state_lock_get(PM_STATE_SUSPEND_TO_RAM, PM_ALL_SUBSTATES); + } +} + +static void adc_release_pm_locks(void) +{ + pm_policy_state_lock_put(PM_STATE_SUSPEND_TO_IDLE, PM_ALL_SUBSTATES); + if (IS_ENABLED(CONFIG_PM_S2RAM)) { + pm_policy_state_lock_put(PM_STATE_SUSPEND_TO_RAM, PM_ALL_SUBSTATES); + } +} + +/** + * Driver private functions + */ + +static void configure_tempsensor_calib_point(ADC_TypeDef *adc, uint32_t calib_point) +{ + uint16_t gain; +#if defined(CONFIG_SOC_STM32WB09XX) || defined(CONFIG_SOC_STM32WB05XX) + /** RM0505/RM0529 §12.2.1 "Temperature sensor subsystem" */ + gain = 0xFFF; +#else + /** RM0530 §12.2.2 "Temperature sensor subsystem" */ + gain = LL_ADC_GET_CALIB_GAIN_FOR_VINPX_1V2(); +#endif /* CONFIG_SOC_STM32WB09XX | CONFIG_SOC_STM32WB05XX */ + + LL_ADC_ConfigureCalibPoint(adc, calib_point, gain, 0x0); +} + +/** + * @brief Obtain calibration data for specified channel type and Vinput range + * from engineering flash, and write it to specified calibration point + * + * @param ADCx ADC registers pointer + * @param Point Calibration point to configure + * @param Type Target channel type + * @param Range Target channel Vinput range + */ +static void configure_calib_point_from_flash(ADC_TypeDef *ADCx, uint32_t Point, + uint32_t Type, uint32_t Range) +{ + int8_t offset = 0; + uint16_t gain = 0; + + switch (Range) { + case LL_ADC_VIN_RANGE_1V2: + switch (Type) { + case ADC_CHANNEL_TYPE_SINGLE_POS: + gain = LL_ADC_GET_CALIB_GAIN_FOR_VINPX_1V2(); + offset = LL_ADC_GET_CALIB_OFFSET_FOR_VINPX_1V2(); + break; + case ADC_CHANNEL_TYPE_SINGLE_NEG: + gain = LL_ADC_GET_CALIB_GAIN_FOR_VINMX_1V2(); + offset = LL_ADC_GET_CALIB_OFFSET_FOR_VINMX_1V2(); + break; + case ADC_CHANNEL_TYPE_DIFF: + gain = LL_ADC_GET_CALIB_GAIN_FOR_VINDIFF_1V2(); + offset = LL_ADC_GET_CALIB_OFFSET_FOR_VINDIFF_1V2(); + break; + } + break; + case LL_ADC_VIN_RANGE_2V4: + switch (Type) { + case ADC_CHANNEL_TYPE_SINGLE_POS: + gain = LL_ADC_GET_CALIB_GAIN_FOR_VINPX_2V4(); + offset = LL_ADC_GET_CALIB_OFFSET_FOR_VINPX_2V4(); + break; + case ADC_CHANNEL_TYPE_SINGLE_NEG: + gain = LL_ADC_GET_CALIB_GAIN_FOR_VINMX_2V4(); + offset = LL_ADC_GET_CALIB_OFFSET_FOR_VINMX_2V4(); + break; + case ADC_CHANNEL_TYPE_DIFF: + gain = LL_ADC_GET_CALIB_GAIN_FOR_VINDIFF_2V4(); + offset = LL_ADC_GET_CALIB_OFFSET_FOR_VINDIFF_2V4(); + break; + } + break; + case LL_ADC_VIN_RANGE_3V6: + switch (Type) { + case ADC_CHANNEL_TYPE_SINGLE_POS: + gain = LL_ADC_GET_CALIB_GAIN_FOR_VINPX_3V6(); + offset = LL_ADC_GET_CALIB_OFFSET_FOR_VINPX_3V6(); + break; + case ADC_CHANNEL_TYPE_SINGLE_NEG: + gain = LL_ADC_GET_CALIB_GAIN_FOR_VINMX_3V6(); + offset = LL_ADC_GET_CALIB_OFFSET_FOR_VINMX_3V6(); + break; + case ADC_CHANNEL_TYPE_DIFF: + gain = LL_ADC_GET_CALIB_GAIN_FOR_VINDIFF_3V6(); + offset = LL_ADC_GET_CALIB_OFFSET_FOR_VINDIFF_3V6(); + break; + } + break; + } + + LL_ADC_ConfigureCalibPoint(ADCx, Point, gain, offset); +} + +static void adc_enter_idle_mode(ADC_TypeDef *adc, const struct stm32_pclken *ana_clk) +{ + const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE); + int err; + + /* Power down the ADC */ + LL_ADC_Disable(adc); + +#if SMPS_MODE != STM32WB0_SMPS_MODE_OFF + /* Disable SMPS synchronization */ + LL_ADC_SMPSSyncDisable(adc); +#endif /* SMPS_MODE != STM32WB0_SMPS_MODE_OFF */ + +#if ADC_USE_IO_BOOSTER + /* Disable ADC I/O booster */ + LL_RCC_IOBOOST_Disable(); + +# if defined(RCC_CFGR_IOBOOSTCLKEN) + /* Disable ADC I/O Booster clock if present */ + LL_RCC_IOBOOSTCLK_Disable(); +# endif +#endif /* ADC_USE_IO_BOOSTER */ + +#if defined(ADC_CTRL_ADC_LDO_ENA) + /* Disable ADC voltage regulator */ + LL_ADC_DisableInternalRegulator(adc); +#endif /* ADC_CTRL_ADC_LDO_ENA */ + + /* Turn off ADC analog domain clock */ + err = clock_control_off(clk, (clock_control_subsys_t)ana_clk); + if (err < 0) { + LOG_WRN("failed to turn off ADC analog clock (%d)", err); + } + + /* Release power management locks */ + adc_release_pm_locks(); +} + +static int adc_exit_idle_mode(ADC_TypeDef *adc, const struct stm32_pclken *ana_clk) +{ + const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE); + int err; + + /* Acquire power management locks */ + adc_acquire_pm_locks(); + + /* Turn on ADC analog domain clock */ + err = clock_control_on(clk, + (clock_control_subsys_t)ana_clk); + if (err < 0) { + LOG_ERR("failed to turn on ADC analog clock: %d", err); + adc_release_pm_locks(); + return err; + } + +#if defined(ADC_CTRL_ADC_LDO_ENA) + /* RM0479 §12.6.3: bit ADC_LDO_ENA must not be set on QFN32 packages. + * Using an equality check with supported package types ensures that + * we never accidentally set the bit on an unsupported MCU. + */ + const uint32_t package_type = ll_get_package_type(); + + if (package_type == LL_UTILS_PACKAGETYPE_QFN48 + || package_type == LL_UTILS_PACKAGETYPE_CSP49) { + LL_ADC_EnableInternalRegulator(adc); + } +#endif /* ADC_CTRL_ADC_LDO_ENA */ + +#if ADC_USE_IO_BOOSTER +# if defined(RCC_CFGR_IOBOOSTCLKEN) + /* Enable ADC I/O Booster clock if needed by hardware */ + LL_RCC_IOBOOSTCLK_Enable(); +# endif + + /* Enable ADC I/O Booster */ + LL_RCC_IOBOOST_Enable(); +#endif /* ADC_USE_IO_BOOSTER*/ + +#if SMPS_MODE != STM32WB0_SMPS_MODE_OFF + /* RM0505 §6.2.2 "Peripherals clock details": + * To avoid SNR degradation of the ADC, + * SMPS and ADC clocks must be synchronous. + */ + LL_ADC_SMPSSyncEnable(adc); +#endif /* SMPS_MODE != STM32WB0_SMPS_MODE_OFF */ + + /* Power up the ADC */ + LL_ADC_Enable(adc); + + return err; +} + +/** + * @brief Schedule as many samplings as possible in a sequence + * then start the ADC conversion. + */ +static void schedule_and_start_adc_sequence(ADC_TypeDef *adc, struct adc_stm32wb0_data *data) +{ + uint32_t remaining_unsampled = data->unsampled_channels; + uint32_t allocated_calib_points = 0; + uint32_t sequence_length = 0; + bool temp_sensor_scheduled = false; + + /** + * These tables are used to keep track of which calibration + * point registers are used for what type of acquisition, in + * order to share the same calibration point for different + * channels if they use compatible configurations. + * + * Initialize only the first table with invalid values; since + * both tables are updated at the same time, this is sufficient + * to know when to stop programming calibration points. + */ + uint8_t calib_pt_ch_type[NUM_CALIBRATION_POINTS] = { + ADC_CHANNEL_TYPE_INVALID, ADC_CHANNEL_TYPE_INVALID, + ADC_CHANNEL_TYPE_INVALID, ADC_CHANNEL_TYPE_INVALID + }; + uint8_t calib_pt_vin_range[NUM_CALIBRATION_POINTS]; + + /* Schedule as many channels as possible for sampling */ + for (uint32_t channel = 0; + channel < LL_ADC_CHANNEL_MAX && remaining_unsampled != 0U; + channel++) { + const uint32_t ch_bit = BIT(channel); + + if ((remaining_unsampled & ch_bit) == 0) { + continue; + } + + /* Get channel information */ + const uint8_t ch_type = get_channel_type(channel); + const uint8_t ch_vin_range = data->channel_config[channel].vinput_range; + + /* Attempt to find a compatible calibration point */ + uint32_t calib_pt = 0; + + for (; calib_pt < allocated_calib_points; calib_pt++) { + if (calib_pt_ch_type[calib_pt] == ch_type + && calib_pt_vin_range[calib_pt] == ch_vin_range) { + break; + } + } + + if (calib_pt == allocated_calib_points) { + /* No compatible calibration point found. + * If an unallocated calibration point remains, use it. + * Otherwise, this channel cannot be scheduled; since we must + * perform samplings in order, exit the scheduling loop. + */ + if (allocated_calib_points < NUM_CALIBRATION_POINTS) { + allocated_calib_points++; + } else { + /* Exit scheduling loop */ + break; + } + } + + if (channel == LL_ADC_CHANNEL_TEMPSENSOR) { + if (calib_pt_ch_type[calib_pt] == ADC_CHANNEL_TYPE_INVALID) { + /** + * Temperature sensor is a special channel: it must be sampled + * with special gain/offset instead of the calibration values found + * in engineering flash. For this reason, it must NOT be scheduled + * with any other 1.2V Vinput range, single-ended positive channel. + * + * If this check succeeds, then no such channel is scheduled, and we + * can add the temperature sensor to this sequence. We're sure there + * won't be any conflict because the temperature sensor is the last + * channel. Otherwise, a channel with 1.2V Vinput range has been + * scheduled and we must delay the temperature sensor measurement to + * another sequence. + */ + temp_sensor_scheduled = true; + } else { + /* Exit scheduling loop before scheduling temperature sensor */ + break; + } + } + + /* Ensure calibration point tables are updated. + * This is unneeded if the entry was already filled up, + * but cheaper than checking for duplicate work. + */ + calib_pt_ch_type[calib_pt] = ch_type; + calib_pt_vin_range[calib_pt] = ch_vin_range; + + /* Remove channel from unscheduled list */ + remaining_unsampled &= ~ch_bit; + + /* Add channel to sequence */ + ll_adc_set_conversion_channel(adc, sequence_length, channel); + sequence_length++; + + /* Select the calibration point to use for channel */ + ll_adc_set_calib_point_for_any(adc, ch_type, ch_vin_range, calib_pt); + + /* Configure the channel Vinput range selection. + * This must not be done for internal channels, which + * use a hardwired Vinput range selection instead. + */ + if (channel < LL_ADC_EXTERNAL_CHANNEL_MAX) { + LL_ADC_SetChannelVoltageRange(adc, channel, ch_vin_range); + } +#if !defined(CONFIG_ADC_STM32_DMA) + /* If DMA is not enabled, only schedule one channel at a time. + * Otherwise, the ADC will overflow and everything will break. + */ + __ASSERT_NO_MSG(sequence_length == 1); + break; +#endif + } + + /* Configure all (used) calibration points */ + for (int i = 0; i < NUM_CALIBRATION_POINTS; i++) { + uint8_t type = calib_pt_ch_type[i]; + uint8_t range = calib_pt_vin_range[i]; + + if (type == ADC_CHANNEL_TYPE_INVALID) { + break; + } else if ((type == ADC_CHANNEL_TYPE_SINGLE_POS) + && (range == LL_ADC_VIN_RANGE_1V2) + && temp_sensor_scheduled) { + /* Configure special calibration point for temperature sensor */ + configure_tempsensor_calib_point(adc, i); + } else { + configure_calib_point_from_flash(adc, i, type, range); + } + } + + __ASSERT_NO_MSG(sequence_length > 0); + + /* Now that scheduling is done, we can set the sequence length */ + LL_ADC_SetSequenceLength(adc, sequence_length); + + /* Save unsampled channels (if any) for next sequence */ + data->unsampled_channels = remaining_unsampled; + +#if defined(CONFIG_ADC_STM32_DMA) + const struct adc_stm32wb0_config *config = data->dev->config; + int err; + + /* Save sequence length in driver data for later usage */ + data->sequence_length = sequence_length; + + /* Prepare the DMA controller for ADC->memory transfers */ + data->dma_block_config.source_address = (uint32_t)&adc->DS_DATAOUT; + data->dma_block_config.dest_address = (uint32_t)data->next_sample_ptr; + data->dma_block_config.block_size = data->sequence_length * sizeof(uint16_t); + + err = dma_config(config->dmac, config->dma_channel, &data->dmac_config); + if (err < 0) { + LOG_ERR("%s: FAIL - dma_config returns %d", __func__, err); + adc_context_complete(&data->ctx, err); + return; + } + + err = dma_start(config->dmac, config->dma_channel); + if (err < 0) { + LOG_ERR("%s: FAIL - dma_start returns %d", __func__, err); + adc_context_complete(&data->ctx, err); + return; + } +#endif + + /* Start conversion sequence */ + LL_ADC_StartConversion(adc); +} + +static inline void handle_end_of_sequence(ADC_TypeDef *adc, struct adc_stm32wb0_data *data) +{ + if (data->unsampled_channels != 0) { + /* Some channels requested for this round have + * not been sampled yet. Schedule and start another + * acquisition sequence. + */ + schedule_and_start_adc_sequence(adc, data); + } else { + /* All channels sampled: round is complete. */ + adc_context_on_sampling_done(&data->ctx, data->dev); + } +} + +static int initiate_read_operation(const struct device *dev, + const struct adc_sequence *sequence) +{ + const struct adc_stm32wb0_config *config = dev->config; + struct adc_stm32wb0_data *data = dev->data; + ADC_TypeDef *adc = (ADC_TypeDef *)config->reg; + int err; + + err = validate_adc_sequence(sequence); + if (err < 0) { + return err; + } + + /* Take ADC out of idle mode before getting to work */ + err = adc_exit_idle_mode(adc, &config->ana_clk); + if (err < 0) { + return err; + } + + /* Initialize output pointers to first byte of user buffer */ + data->next_sample_ptr = data->round_buf_pointer = sequence->buffer; + + /* Configure resolution */ + LL_ADC_SetDSDataOutputWidth(adc, ds_width_from_adc_res(sequence->resolution)); + + /* Configure oversampling */ + LL_ADC_SetDSDataOutputRatio(adc, sequence->oversampling); + + /* Start reading using the ADC */ + adc_context_start_read(&data->ctx, sequence); + + return 0; +} + +#if !defined(CONFIG_ADC_STM32_DMA) +void adc_stm32wb0_isr(const struct device *dev) +{ + const struct adc_stm32wb0_config *config = dev->config; + struct adc_stm32wb0_data *data = dev->data; + ADC_TypeDef *adc = config->reg; + + /* Down sampler output data available */ + if (LL_ADC_IsActiveFlag_EODS(adc)) { + /* Clear pending interrupt flag */ + LL_ADC_ClearFlag_EODS(adc); + + /* Write ADC data to output buffer and update pointer */ + *data->next_sample_ptr++ = LL_ADC_DSGetOutputData(adc); + } + + /* Down sampler overflow detected - return error */ + if (LL_ADC_IsActiveFlag_OVRDS(adc)) { + LL_ADC_ClearFlag_OVRDS(adc); + + LOG_ERR("ADC overflow\n"); + + adc_context_complete(&data->ctx, -EIO); + return; + } + + if (!LL_ADC_IsActiveFlag_EOS(adc)) { + /* ADC sequence not finished yet */ + return; + } + + /* Clear pending interrupt flag */ + LL_ADC_ClearFlag_EOS(adc); + + /* Execute end-of-sequence logic */ + handle_end_of_sequence(adc, data); +} +#else /* CONFIG_ADC_STM32_DMA */ +static void adc_stm32wb0_dma_callback(const struct device *dma, void *user_data, + uint32_t dma_channel, int dma_status) +{ + struct adc_stm32wb0_data *data = user_data; + const struct device *dev = data->dev; + const struct adc_stm32wb0_config *config = dev->config; + ADC_TypeDef *adc = config->reg; + int err; + + /* N.B.: some of this code is borrowed from existing ADC driver, + * but may be not applicable to STM32WB0 series' ADC. + */ + if (dma_channel == config->dma_channel) { + if (LL_ADC_IsActiveFlag_OVRDS(adc) || (dma_status >= 0)) { + /* Sequence finished - update driver data accordingly */ + data->next_sample_ptr += data->sequence_length; + + /* Stop the DMA controller */ + err = dma_stop(config->dmac, config->dma_channel); + LOG_DBG("%s: dma_stop returns %d", __func__, err); + + LL_ADC_ClearFlag_OVRDS(adc); + + /* Execute the common end-of-sequence logic */ + handle_end_of_sequence(adc, data); + } else { /* dma_status < 0 */ + LOG_ERR("%s: dma error %d", __func__, dma_status); + LL_ADC_StopConversion(adc); + + err = dma_stop(config->dmac, config->dma_channel); + + LOG_DBG("dma_stop returns %d", err); + + adc_context_complete(&data->ctx, dma_status); + } + } else { + LOG_DBG("dma_channel 0x%08X != config->dma_channel 0x%08X", + dma_channel, config->dma_channel); + } +} +#endif /* !CONFIG_ADC_STM32_DMA */ + +/** + * adc_context API implementation + */ +static void adc_context_start_sampling(struct adc_context *ctx) +{ + struct adc_stm32wb0_data *data = drv_data_from_adc_ctx(ctx); + const struct adc_stm32wb0_config *config = data->dev->config; + + /* Mark all channels of this round as unsampled */ + data->unsampled_channels = data->ctx.sequence.channels; + + /* Schedule and start first sequence of this round */ + schedule_and_start_adc_sequence(config->reg, data); +} + +static void adc_context_update_buffer_pointer( + struct adc_context *ctx, bool repeat_sampling) +{ + struct adc_stm32wb0_data *data = drv_data_from_adc_ctx(ctx); + + if (repeat_sampling) { + /* Roll back output pointer to address of first sample in round */ + data->next_sample_ptr = data->round_buf_pointer; + } else /* a new round is starting: */ { + /* Save address of first sample in round in case we have to repeat it */ + data->round_buf_pointer = data->next_sample_ptr; + } +} + +static void adc_context_on_complete(struct adc_context *ctx, int status) +{ + struct adc_stm32wb0_data *data = drv_data_from_adc_ctx(ctx); + const struct adc_stm32wb0_config *config = data->dev->config; + + ARG_UNUSED(status); + + /** + * All ADC operations are complete. + * Save power by placing ADC in idle mode. + */ + adc_enter_idle_mode(config->reg, &config->ana_clk); + + /* Prevent data corruption if something goes wrong. */ + data->next_sample_ptr = NULL; +} + +/** + * Driver subsystem API implementation + */ +int adc_stm32wb0_channel_setup(const struct device *dev, + const struct adc_channel_cfg *channel_cfg) +{ + CHECKIF(dev == NULL) { return -ENODEV; } + CHECKIF(channel_cfg == NULL) { return -EINVAL; } + const bool is_diff_channel = + (channel_cfg->channel_id == LL_ADC_CHANNEL_VINP0_VINM0 + || channel_cfg->channel_id == LL_ADC_CHANNEL_VINP1_VINM1 + || channel_cfg->channel_id == LL_ADC_CHANNEL_VINP2_VINM2 + || channel_cfg->channel_id == LL_ADC_CHANNEL_VINP3_VINM3); + const uint8_t vin_range = vinput_range_from_adc_ref(channel_cfg->reference); + const uint32_t channel_id = channel_cfg->channel_id; + struct adc_stm32wb0_data *data = dev->data; + int res; + + /* Forbid reconfiguration while operation in progress */ + res = k_sem_take(&data->ctx.lock, K_NO_WAIT); + if (res < 0) { + return res; + } + + /* Validate channel configuration parameters */ + if (channel_cfg->gain != ADC_GAIN_1) { + LOG_ERR("gain unsupported by hardware"); + res = -ENOTSUP; + goto unlock_and_return; + } + + if (vin_range == LL_ADC_VIN_RANGE_INVALID) { + LOG_ERR("invalid channel voltage reference"); + res = -EINVAL; + goto unlock_and_return; + } + + if (channel_id >= LL_ADC_CHANNEL_MAX) { + LOG_ERR("invalid channel id %d", channel_cfg->channel_id); + res = -EINVAL; + goto unlock_and_return; + } else if (is_diff_channel != channel_cfg->differential) { + /* channel_cfg->differential flag does not match + * with the selected channel's type + */ + LOG_ERR("differential flag does not match channel type"); + res = -EINVAL; + goto unlock_and_return; + } + + if (channel_cfg->acquisition_time != ADC_ACQ_TIME_DEFAULT) { + LOG_ERR("acquisition time unsupported by hardware"); + res = -ENOTSUP; + goto unlock_and_return; + } + + /* Verify that the correct reference is selected for special channels */ + if (channel_id == LL_ADC_CHANNEL_VBAT && vin_range != LL_ADC_VIN_RANGE_3V6) { + LOG_ERR("invalid reference for Vbat channel"); + res = -EINVAL; + goto unlock_and_return; + } else if (channel_id == LL_ADC_CHANNEL_TEMPSENSOR && vin_range != LL_ADC_VIN_RANGE_1V2) { + LOG_ERR("invalid reference for temperature sensor channel"); + res = -EINVAL; + goto unlock_and_return; + } + + /* Save the channel configuration in driver data. + * Note that the only configuration option available + * is the ADC channel reference (= Vinput range). + */ + data->channel_config[channel_id].vinput_range = vin_range; + +unlock_and_return: + /* Unlock the instance after updating configuration */ + k_sem_give(&data->ctx.lock); + + return res; +} + +int adc_stm32wb0_read(const struct device *dev, + const struct adc_sequence *sequence) +{ + CHECKIF(dev == NULL) { return -ENODEV; } + struct adc_stm32wb0_data *data = dev->data; + int err; + + adc_context_lock(&data->ctx, false, NULL); + + /* When context is locked in synchronous mode, this + * function blocks until the whole operation is complete. + */ + err = initiate_read_operation(dev, sequence); + + if (err >= 0) { + err = adc_context_wait_for_completion(&data->ctx); + } else { + adc_release_pm_locks(); + } + + adc_context_release(&data->ctx, err); + + return err; +} + +#if defined(CONFIG_ADC_ASYNC) +int adc_stm32wb0_read_async(const struct device *dev, + const struct adc_sequence *sequence, struct k_poll_signal *async) +{ + CHECKIF(dev == NULL) { return -ENODEV; } + struct adc_stm32wb0_data *data = dev->data; + int err; + + adc_context_lock(&data->ctx, true, async); + + /* When context is locked in synchronous mode, this + * function blocks until the whole operation is complete. + */ + err = initiate_read_operation(dev, sequence); + if (err < 0) { + adc_release_pm_locks(); + } + + adc_context_release(&data->ctx, err); + + return err; +} +#endif /* CONFIG_ADC_ASYNC */ + +static const struct adc_driver_api api_stm32wb0_driver_api = { + .channel_setup = adc_stm32wb0_channel_setup, + .read = adc_stm32wb0_read, +#if defined(CONFIG_ADC_ASYNC) + .read_async = adc_stm32wb0_read_async, +#endif /* CONFIG_ADC_ASYNC */ + .ref_internal = 3600U /* ADC_REF_INTERNAL is mapped to Vinput 3.6V range */ +}; + +int adc_stm32wb0_init(const struct device *dev) +{ + const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE); + const struct adc_stm32wb0_config *config = dev->config; + struct adc_stm32wb0_data *data = dev->data; + ADC_TypeDef *adc = config->reg; + int err; + + if (!device_is_ready(clk)) { + LOG_ERR("clock control device not ready"); + return -ENODEV; + } + + /* Turn on ADC digital clock (always on) */ + err = clock_control_on(clk, + (clock_control_subsys_t)&config->dig_clk); + if (err < 0) { + LOG_ERR("failed to turn on ADC digital clock (%d)", err); + return err; + } + + /* Configure DT-provided signals when available */ + err = pinctrl_apply_state(config->pinctrl_cfg, PINCTRL_STATE_DEFAULT); + if (err < 0 && err != -ENOENT) { + /* ENOENT indicates no entry - should not be treated as failure */ + LOG_ERR("fail to apply ADC pinctrl state (%d)", err); + return err; + } + +#if defined(ADC_SUPPORT_AUDIO_FEATURES) + /* Configure ADC for analog sampling */ + LL_ADC_SetADCMode(adc, LL_ADC_OP_MODE_ADC); +#endif + +#if defined(PWR_CR2_ENTS) + /* Enable on-die temperature sensor */ + LL_PWR_EnableTempSens(); +#endif + + /* Set ADC sample rate to 1 Msps (maximum speed) */ + LL_ADC_SetSampleRate(adc, LL_ADC_SAMPLE_RATE_16); + + /* Keep new data on overrun, if it ever happens */ + LL_ADC_SetOverrunDS(adc, LL_ADC_NEW_DATA_IS_KEPT); + +#if !defined(CONFIG_ADC_STM32_DMA) + /* Attach ISR and enable ADC interrupt in NVIC */ + IRQ_CONNECT(DT_IRQN(ADC_NODE), DT_IRQ(ADC_NODE, priority), + adc_stm32wb0_isr, DEVICE_DT_GET(ADC_NODE), 0); + irq_enable(DT_IRQN(ADC_NODE)); + + /* Enable ADC interrupt after each sampling. + * NOTE: enabling EOS interrupt is not necessary because + * the EODS interrupt flag is also set to high when the + * EOS flag is being set to high. + */ + LL_ADC_EnableIT_EODS(adc); +#else + /* Check that DMA controller exists and is ready to be used */ + if (!config->dmac) { + LOG_ERR("no DMA assigned to ADC in DMA driver mode!"); + return -ENODEV; + } + + if (!device_is_ready(config->dmac)) { + LOG_ERR("DMA controller '%s' for ADC not ready", config->dmac->name); + return -ENODEV; + } + + /* Finalize DMA configuration structure in driver data */ + data->dmac_config.head_block = &data->dma_block_config; + data->dmac_config.user_data = data; + + /* Enable DMA datapath in ADC */ + LL_ADC_DMAModeDSEnable(adc); +#endif /* !CONFIG_ADC_STM32_DMA */ + + /* Unlock the ADC context to mark ADC as ready to use */ + adc_context_unlock_unconditionally(&data->ctx); + + /* Keep ADC powered down ("idle mode"). + * It will be awakened on-demand when a call to the ADC API + * is performed by the application. + */ + return 0; +} + +/** + * Driver power management implementation + */ +#ifdef CONFIG_PM_DEVICE +static int adc_stm32wb0_pm_action(const struct device *dev, + enum pm_device_action action) +{ + const struct adc_stm32wb0_config *config = dev->config; + ADC_TypeDef *adc = config->reg; + int res; + + switch (action) { + case PM_DEVICE_ACTION_RESUME: + return adc_stm32wb0_init(dev); + case PM_DEVICE_ACTION_SUSPEND: + adc_enter_idle_mode(adc, &config->ana_clk); + + /* Move pins to sleep state */ + res = pinctrl_apply_state(config->pinctrl_cfg, PINCTRL_STATE_SLEEP); + + /** + * -ENOENT is returned if there are no pins defined in DTS for sleep mode. + * This is fine and should not block PM from suspending the device. + * Silently ignore the error by returning 0 instead. + */ + if (res >= 0 || res == -ENOENT) { + return 0; + } else { + return res; + } + default: + return -ENOTSUP; + } +} +#endif /* CONFIG_PM_DEVICE */ + +/** + * Driver device instantiation + */ +PINCTRL_DT_DEFINE(ADC_NODE); + +static const struct adc_stm32wb0_config adc_config = { + .reg = (ADC_TypeDef *)DT_REG_ADDR(ADC_NODE), + .pinctrl_cfg = PINCTRL_DT_DEV_CONFIG_GET(ADC_NODE), + .dig_clk = STM32_CLOCK_INFO(0, ADC_NODE), + .ana_clk = STM32_CLOCK_INFO(1, ADC_NODE), +#if defined(CONFIG_ADC_STM32_DMA) + .dmac = DEVICE_DT_GET(DT_DMAS_CTLR_BY_IDX(ADC_NODE, 0)), + .dma_channel = DT_DMAS_CELL_BY_IDX(ADC_NODE, 0, channel), +#endif +}; + +static struct adc_stm32wb0_data adc_data = { + ADC_CONTEXT_INIT_TIMER(adc_data, ctx), + ADC_CONTEXT_INIT_LOCK(adc_data, ctx), + ADC_CONTEXT_INIT_SYNC(adc_data, ctx), + .dev = DEVICE_DT_GET(ADC_NODE), + .channel_config = { + /* Internal channels selection is hardwired */ + [LL_ADC_CHANNEL_VBAT] = { + .vinput_range = LL_ADC_VIN_RANGE_3V6 + }, + [LL_ADC_CHANNEL_TEMPSENSOR] = { + .vinput_range = LL_ADC_VIN_RANGE_1V2 + } + }, +#if defined(CONFIG_ADC_STM32_DMA) + .dmac_config = { + .dma_slot = DT_INST_DMAS_CELL_BY_IDX(ADC_INSTANCE, 0, slot), + .channel_direction = STM32_DMA_CONFIG_DIRECTION( + STM32_DMA_CHANNEL_CONFIG_BY_IDX(ADC_INSTANCE, 0)), + .channel_priority = STM32_DMA_CONFIG_PRIORITY( + STM32_DMA_CHANNEL_CONFIG_BY_IDX(ADC_INSTANCE, 0)), + .source_data_size = STM32_DMA_CONFIG_PERIPHERAL_DATA_SIZE( + STM32_DMA_CHANNEL_CONFIG_BY_IDX(ADC_INSTANCE, 0)), + .dest_data_size = STM32_DMA_CONFIG_MEMORY_DATA_SIZE( + STM32_DMA_CHANNEL_CONFIG_BY_IDX(ADC_INSTANCE, 0)), + .source_burst_length = 1, /* SINGLE transfer */ + .dest_burst_length = 1, /* SINGLE transfer */ + .block_count = 1, + .dma_callback = adc_stm32wb0_dma_callback, + /* head_block and user_data are initialized at runtime */ + }, + .dma_block_config = { + .source_addr_adj = DMA_ADDR_ADJ_NO_CHANGE, + .source_reload_en = 0, + .dest_addr_adj = DMA_ADDR_ADJ_INCREMENT, + .dest_reload_en = 0, + } +#endif +}; + +PM_DEVICE_DT_DEFINE(ADC_NODE, adc_stm32wb0_pm_action); + +DEVICE_DT_DEFINE(ADC_NODE, &adc_stm32wb0_init, PM_DEVICE_DT_GET(ADC_NODE), + &adc_data, &adc_config, POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, + &api_stm32wb0_driver_api); From 27c2c62c64deab917630f460fc51eec043b58736 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 21 Oct 2024 15:24:25 +0200 Subject: [PATCH 1873/4482] dts: arm: st: wb0: add ADC node Add Device Tree node corresponding to STM32WB0 series ADC. Signed-off-by: Mathieu Choplain --- dts/arm/st/wb0/stm32wb0.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dts/arm/st/wb0/stm32wb0.dtsi b/dts/arm/st/wb0/stm32wb0.dtsi index 0532f0ba027b6..c6a43b37f2353 100644 --- a/dts/arm/st/wb0/stm32wb0.dtsi +++ b/dts/arm/st/wb0/stm32wb0.dtsi @@ -218,6 +218,22 @@ status = "disabled"; }; + adc1: adc@41006000 { + compatible = "st,stm32wb0-adc"; + reg = <0x41006000 256>; + /* On STM32WB0, the two ADC clock domains (ANALOG / DIGITAL) + * can be controlled independently. Expose this feature to + * the driver by having two `clocks` property entries: + * - first entry is digital part of ADC block (always-on) + * - second entry is analog part of ADC block (on-demand) + */ + clocks = <&rcc STM32_CLOCK(APB1, 4)>, + <&rcc STM32_CLOCK(APB1, 5)>; + interrupts = <12 0>; + #io-channel-cells = <1>; + status = "disabled"; + }; + dma1: dma@48700000 { compatible = "st,stm32-dma-v2bis"; #dma-cells = <2>; From 5dd9fda746d739f120815f1b4a3e6c2d14d271c0 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 21 Oct 2024 16:45:32 +0200 Subject: [PATCH 1874/4482] boards: st: wb0: add ADC to supported feature set Add ADC to supported feature set on existing STM32WB0 boards. Signed-off-by: Mathieu Choplain --- boards/st/nucleo_wb05kz/nucleo_wb05kz.yaml | 1 + boards/st/nucleo_wb09ke/nucleo_wb09ke.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/boards/st/nucleo_wb05kz/nucleo_wb05kz.yaml b/boards/st/nucleo_wb05kz/nucleo_wb05kz.yaml index 8070d9ece04fb..bf602772d9daa 100644 --- a/boards/st/nucleo_wb05kz/nucleo_wb05kz.yaml +++ b/boards/st/nucleo_wb05kz/nucleo_wb05kz.yaml @@ -9,6 +9,7 @@ toolchain: ram: 24 flash: 192 supported: + - adc - arduino_i2c - arduino_spi - dma diff --git a/boards/st/nucleo_wb09ke/nucleo_wb09ke.yaml b/boards/st/nucleo_wb09ke/nucleo_wb09ke.yaml index 922f199851d56..a853e0e1d7fca 100644 --- a/boards/st/nucleo_wb09ke/nucleo_wb09ke.yaml +++ b/boards/st/nucleo_wb09ke/nucleo_wb09ke.yaml @@ -9,6 +9,7 @@ toolchain: ram: 64 flash: 512 supported: + - adc - arduino_i2c - arduino_spi - dma From 59b469725b376a4fc1b67386cb46de5a50bd6676 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 21 Oct 2024 15:29:58 +0200 Subject: [PATCH 1875/4482] tests: adc: adc_api: add overlay for Nucleo-WB09KE Add an overlay to the test so that it can run on STM32WB0 series hardware. Signed-off-by: Mathieu Choplain --- .../adc/adc_api/boards/nucleo_wb09ke.overlay | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/drivers/adc/adc_api/boards/nucleo_wb09ke.overlay diff --git a/tests/drivers/adc/adc_api/boards/nucleo_wb09ke.overlay b/tests/drivers/adc/adc_api/boards/nucleo_wb09ke.overlay new file mode 100644 index 0000000000000..65bb4e308f88c --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/nucleo_wb09ke.overlay @@ -0,0 +1,44 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 STMicroelectronics + */ + +/ { + zephyr,user { + io-channels = <&adc1 4>, <&adc1 12>, <&adc1 13>; + }; +}; + +&adc1 { + status = "okay"; + + pinctrl-0 = <&adc1_vinp0_pb3>; + pinctrl-names = "default"; + #address-cells = <1>; + #size-cells = <0>; + + vinp0: channel@4 { + reg = <4>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; + + adc_vbat_ch: channel@c { + reg = <12>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_VDD_1"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; + + adc_tempsensor_ch: channel@d { + reg = <13>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_VDD_1_3"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; +}; From 5e7009a12069515bbac9d469821dec5ce59ad3ac Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Wed, 23 Oct 2024 14:28:50 +0200 Subject: [PATCH 1876/4482] tests: adc: adc_api: add overlay for Nucleo-WB05KZ Add an overlay to the test to allow build for this board (needed for CI). Signed-off-by: Mathieu Choplain --- .../adc/adc_api/boards/nucleo_wb05kz.overlay | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/drivers/adc/adc_api/boards/nucleo_wb05kz.overlay diff --git a/tests/drivers/adc/adc_api/boards/nucleo_wb05kz.overlay b/tests/drivers/adc/adc_api/boards/nucleo_wb05kz.overlay new file mode 100644 index 0000000000000..65bb4e308f88c --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/nucleo_wb05kz.overlay @@ -0,0 +1,44 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 STMicroelectronics + */ + +/ { + zephyr,user { + io-channels = <&adc1 4>, <&adc1 12>, <&adc1 13>; + }; +}; + +&adc1 { + status = "okay"; + + pinctrl-0 = <&adc1_vinp0_pb3>; + pinctrl-names = "default"; + #address-cells = <1>; + #size-cells = <0>; + + vinp0: channel@4 { + reg = <4>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; + + adc_vbat_ch: channel@c { + reg = <12>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_VDD_1"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; + + adc_tempsensor_ch: channel@d { + reg = <13>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_VDD_1_3"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; +}; From 13f1200e771b94ae1bc81c44f3288480920abef5 Mon Sep 17 00:00:00 2001 From: Alessandro Manganaro Date: Thu, 24 Oct 2024 17:18:50 +0200 Subject: [PATCH 1877/4482] soc: st: stm32: stm32wbax: Files renaming Files renaming done to better isolate zephyr related functions from stm32 hal related functions Signed-off-by: Alessandro Manganaro --- soc/st/stm32/stm32wbax/CMakeLists.txt | 4 ++-- .../hci_if/{linklayer_plat.c => linklayer_plat_adapt.c} | 0 .../stm32/stm32wbax/hci_if/{ll_sys_if.c => ll_sys_if_adapt.c} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename soc/st/stm32/stm32wbax/hci_if/{linklayer_plat.c => linklayer_plat_adapt.c} (100%) rename soc/st/stm32/stm32wbax/hci_if/{ll_sys_if.c => ll_sys_if_adapt.c} (100%) diff --git a/soc/st/stm32/stm32wbax/CMakeLists.txt b/soc/st/stm32/stm32wbax/CMakeLists.txt index 0c9707564428c..6872ff696f95f 100644 --- a/soc/st/stm32/stm32wbax/CMakeLists.txt +++ b/soc/st/stm32/stm32wbax/CMakeLists.txt @@ -12,10 +12,10 @@ zephyr_sources_ifdef(CONFIG_PM if(CONFIG_BT_STM32WBA) zephyr_include_directories(hci_if) - zephyr_sources(hci_if/linklayer_plat.c) + zephyr_sources(hci_if/linklayer_plat_adapt.c) zephyr_sources(hci_if/bleplat.c) zephyr_sources(hci_if/host_stack_if.c) - zephyr_sources(hci_if/ll_sys_if.c) + zephyr_sources(hci_if/ll_sys_if_adapt.c) zephyr_sources(hci_if/stm32_timer.c) endif() diff --git a/soc/st/stm32/stm32wbax/hci_if/linklayer_plat.c b/soc/st/stm32/stm32wbax/hci_if/linklayer_plat_adapt.c similarity index 100% rename from soc/st/stm32/stm32wbax/hci_if/linklayer_plat.c rename to soc/st/stm32/stm32wbax/hci_if/linklayer_plat_adapt.c diff --git a/soc/st/stm32/stm32wbax/hci_if/ll_sys_if.c b/soc/st/stm32/stm32wbax/hci_if/ll_sys_if_adapt.c similarity index 100% rename from soc/st/stm32/stm32wbax/hci_if/ll_sys_if.c rename to soc/st/stm32/stm32wbax/hci_if/ll_sys_if_adapt.c From 4b4bba4fa4c0cf5e84433f60a0d0c358a910924c Mon Sep 17 00:00:00 2001 From: Alessandro Manganaro Date: Thu, 24 Oct 2024 17:36:28 +0200 Subject: [PATCH 1878/4482] soc: st: stm32: stm32wbax: STM32WBA Cube 1.4.1 integration Removed unnecessary pure HAL stm32 functions Headers cleanup Signed-off-by: Alessandro Manganaro --- soc/st/stm32/stm32wbax/Kconfig | 1 + .../stm32wbax/hci_if/linklayer_plat_adapt.c | 71 +------------------ .../stm32/stm32wbax/hci_if/ll_sys_if_adapt.c | 10 +-- west.yml | 2 +- 4 files changed, 4 insertions(+), 80 deletions(-) diff --git a/soc/st/stm32/stm32wbax/Kconfig b/soc/st/stm32/stm32wbax/Kconfig index 1b1418e048aa3..cebc0fd7e22ac 100644 --- a/soc/st/stm32/stm32wbax/Kconfig +++ b/soc/st/stm32/stm32wbax/Kconfig @@ -14,5 +14,6 @@ config SOC_SERIES_STM32WBAX select CPU_CORTEX_M_HAS_DWT select HAS_STM32CUBE select USE_STM32_HAL_PWR_EX + select USE_STM32_HAL_CORTEX select HAS_PM select SOC_EARLY_INIT_HOOK diff --git a/soc/st/stm32/stm32wbax/hci_if/linklayer_plat_adapt.c b/soc/st/stm32/stm32wbax/hci_if/linklayer_plat_adapt.c index 4f99a3e684875..b482c0b86fc8f 100644 --- a/soc/st/stm32/stm32wbax/hci_if/linklayer_plat_adapt.c +++ b/soc/st/stm32/stm32wbax/hci_if/linklayer_plat_adapt.c @@ -4,22 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include #include -#include -#include #include #include -#include - -#include - -#include #include "scm.h" #define LOG_LEVEL CONFIG_SOC_LOG_LEVEL -LOG_MODULE_REGISTER(linklayer_plat); +LOG_MODULE_REGISTER(linklayer_plat_adapt); #define RADIO_INTR_PRIO_HIGH_Z (RADIO_INTR_PRIO_HIGH + _IRQ_PRIO_OFFSET) #define RADIO_INTR_PRIO_LOW_Z (RADIO_INTR_PRIO_LOW + _IRQ_PRIO_OFFSET) @@ -36,52 +28,17 @@ extern const struct device *rng_dev; volatile int32_t prio_high_isr_counter; volatile int32_t prio_low_isr_counter; volatile int32_t prio_sys_isr_counter; -volatile int32_t irq_counter; volatile uint32_t local_basepri_value; /* Radio SW low ISR global variable */ volatile uint8_t radio_sw_low_isr_is_running_high_prio; -void LINKLAYER_PLAT_ClockInit(void) -{ - LL_PWR_EnableBkUpAccess(); - - /* Select LSE as Sleep CLK */ - __HAL_RCC_RADIOSLPTIM_CONFIG(RCC_RADIOSTCLKSOURCE_LSE); - - LL_PWR_DisableBkUpAccess(); - - /* Enable AHB5ENR peripheral clock (bus CLK) */ - __HAL_RCC_RADIO_CLK_ENABLE(); -} void LINKLAYER_PLAT_DelayUs(uint32_t delay) { k_busy_wait(delay); } -void LINKLAYER_PLAT_WaitHclkRdy(void) -{ - while (HAL_RCCEx_GetRadioBusClockReadiness() != RCC_RADIO_BUS_CLOCK_READY) { - } -} - -void LINKLAYER_PLAT_AclkCtrl(uint8_t enable) -{ - LOG_DBG("enable: %d", enable); - if (enable) { - /* Enable RADIO baseband clock (active CLK) */ - HAL_RCCEx_EnableRadioBBClock(); - - /* Polling on HSE32 activation */ - while (LL_RCC_HSE_IsReady() == 0) { - } - } else { - /* Disable RADIO baseband clock (active CLK) */ - HAL_RCCEx_DisableRadioBBClock(); - } -} - void LINKLAYER_PLAT_GetRNG(uint8_t *ptr_rnd, uint32_t len) { int ret; @@ -191,22 +148,6 @@ void LINKLAYER_PLAT_TriggerSwLowIT(uint8_t priority) NVIC_SetPendingIRQ((IRQn_Type)RADIO_SW_LOW_INTR_NUM); } -void LINKLAYER_PLAT_EnableIRQ(void) -{ - irq_counter = MAX(0, irq_counter - 1); - - if (irq_counter == 0) { - __enable_irq(); - } -} - -void LINKLAYER_PLAT_DisableIRQ(void) -{ - __disable_irq(); - - irq_counter++; -} - void LINKLAYER_PLAT_Assert(uint8_t condition) { __ASSERT_NO_MSG(condition); @@ -267,16 +208,6 @@ void LINKLAYER_PLAT_DisableSpecificIRQ(uint8_t isr_type) } } -void LINKLAYER_PLAT_EnableRadioIT(void) -{ - irq_enable((IRQn_Type)RADIO_INTR_NUM); -} - -void LINKLAYER_PLAT_DisableRadioIT(void) -{ - irq_disable((IRQn_Type)RADIO_INTR_NUM); -} - void LINKLAYER_PLAT_StartRadioEvt(void) { __HAL_RCC_RADIO_CLK_SLEEP_ENABLE(); diff --git a/soc/st/stm32/stm32wbax/hci_if/ll_sys_if_adapt.c b/soc/st/stm32/stm32wbax/hci_if/ll_sys_if_adapt.c index 8607cbbafd8dd..df0342ff1f19c 100644 --- a/soc/st/stm32/stm32wbax/hci_if/ll_sys_if_adapt.c +++ b/soc/st/stm32/stm32wbax/hci_if/ll_sys_if_adapt.c @@ -8,12 +8,9 @@ #include #define LOG_LEVEL CONFIG_SOC_LOG_LEVEL -LOG_MODULE_REGISTER(ll_sys_if); +LOG_MODULE_REGISTER(ll_sys_if_adapt); -#include "ll_intf.h" #include "ll_sys.h" -#include "linklayer_plat.h" -#include "app_conf.h" extern struct k_mutex ble_ctlr_stack_mutex; extern struct k_work_q ll_work_q; @@ -40,8 +37,3 @@ void ll_sys_bg_process_init(void) { k_work_init(&ll_sys_work, &ll_sys_bg_process_handler); } - -void ll_sys_config_params(void) -{ - ll_intf_config_ll_ctx_params(USE_RADIO_LOW_ISR, NEXT_EVENT_SCHEDULING_FROM_ISR); -} diff --git a/west.yml b/west.yml index b1287ecabd647..d3a1d5f531444 100644 --- a/west.yml +++ b/west.yml @@ -233,7 +233,7 @@ manifest: groups: - hal - name: hal_stm32 - revision: 6f0e5f70cb540c487e3e3678af2e95d0937f9863 + revision: 019d8255333f96bdd47d26b44049bd3e7af8ef55 path: modules/hal/stm32 groups: - hal From d73fda80a6b36fe49ac8811e91a9ed93ba2771ce Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Sat, 26 Oct 2024 11:51:01 +0200 Subject: [PATCH 1879/4482] ci: Switch to CI image v0.27.4 This commit updates the CI workflows to use the CI image v0.27.4, which includes nrf-regtool v7.0.0. Signed-off-by: Carles Cufi Signed-off-by: Stephanos Ioannidis --- .github/workflows/bsim-tests.yaml | 2 +- .github/workflows/clang.yaml | 2 +- .github/workflows/codecov.yaml | 2 +- .github/workflows/errno.yml | 2 +- .github/workflows/footprint-tracking.yml | 2 +- .github/workflows/twister.yaml | 4 ++-- .github/workflows/twister_tests_blackbox.yml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/bsim-tests.yaml b/.github/workflows/bsim-tests.yaml index 47c6aa86c275c..4739f99e68b19 100644 --- a/.github/workflows/bsim-tests.yaml +++ b/.github/workflows/bsim-tests.yaml @@ -37,7 +37,7 @@ jobs: runs-on: group: zephyr-runner-v2-linux-x64-4xlarge container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.3.20241022 + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.4.20241026 options: '--entrypoint /bin/bash' env: ZEPHYR_TOOLCHAIN_VARIANT: zephyr diff --git a/.github/workflows/clang.yaml b/.github/workflows/clang.yaml index 8e1d51ca05e84..4221babe2e5f6 100644 --- a/.github/workflows/clang.yaml +++ b/.github/workflows/clang.yaml @@ -12,7 +12,7 @@ jobs: runs-on: group: zephyr-runner-v2-linux-x64-4xlarge container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.3.20241022 + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.4.20241026 options: '--entrypoint /bin/bash' strategy: fail-fast: false diff --git a/.github/workflows/codecov.yaml b/.github/workflows/codecov.yaml index 834ec8505e376..56edb6a1e87e1 100644 --- a/.github/workflows/codecov.yaml +++ b/.github/workflows/codecov.yaml @@ -14,7 +14,7 @@ jobs: runs-on: group: zephyr-runner-v2-linux-x64-4xlarge container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.3.20241022 + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.4.20241026 options: '--entrypoint /bin/bash' strategy: fail-fast: false diff --git a/.github/workflows/errno.yml b/.github/workflows/errno.yml index c70368ade305f..d3fe1b0dcae40 100644 --- a/.github/workflows/errno.yml +++ b/.github/workflows/errno.yml @@ -10,7 +10,7 @@ jobs: check-errno: runs-on: ubuntu-22.04 container: - image: ghcr.io/zephyrproject-rtos/ci:v0.27.3 + image: ghcr.io/zephyrproject-rtos/ci:v0.27.4 steps: - name: Apply container owner mismatch workaround diff --git a/.github/workflows/footprint-tracking.yml b/.github/workflows/footprint-tracking.yml index 694dc8166be7d..93eae63e954de 100644 --- a/.github/workflows/footprint-tracking.yml +++ b/.github/workflows/footprint-tracking.yml @@ -26,7 +26,7 @@ jobs: group: zephyr-runner-v2-linux-x64-4xlarge if: github.repository_owner == 'zephyrproject-rtos' container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.3.20241022 + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.4.20241026 options: '--entrypoint /bin/bash' defaults: run: diff --git a/.github/workflows/twister.yaml b/.github/workflows/twister.yaml index 8f940ce11c625..f12cdeb2efaa2 100644 --- a/.github/workflows/twister.yaml +++ b/.github/workflows/twister.yaml @@ -25,7 +25,7 @@ jobs: runs-on: group: zephyr-runner-v2-linux-x64-4xlarge container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.3.20241022 + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.4.20241026 options: '--entrypoint /bin/bash' outputs: subset: ${{ steps.output-services.outputs.subset }} @@ -130,7 +130,7 @@ jobs: needs: twister-build-prep if: needs.twister-build-prep.outputs.size != 0 container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.3.20241022 + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.4.20241026 options: '--entrypoint /bin/bash' strategy: fail-fast: false diff --git a/.github/workflows/twister_tests_blackbox.yml b/.github/workflows/twister_tests_blackbox.yml index 0e36630d0928c..f2f64e66a8997 100644 --- a/.github/workflows/twister_tests_blackbox.yml +++ b/.github/workflows/twister_tests_blackbox.yml @@ -24,7 +24,7 @@ jobs: python-version: ['3.10', '3.11', '3.12', '3.13'] os: [ubuntu-22.04] container: - image: ghcr.io/zephyrproject-rtos/ci:v0.27.3 + image: ghcr.io/zephyrproject-rtos/ci:v0.27.4 steps: - name: Apply Container Owner Mismatch Workaround From 26603cefaf41298c417f2eee834ed40d9ab35d3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Amundsen?= Date: Mon, 7 Oct 2024 15:43:13 +0200 Subject: [PATCH 1880/4482] dts: update memory map and remove ext-uicr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extended UICR will not be used as its configurations will be merged with the UICR registers in NVR. Memory maps changes are needed to align with pre compiled firmware. Signed-off-by: Håkon Amundsen Signed-off-by: Jonathan Nilsen --- .../nrf54h20dk/nrf54h20dk_nrf54h20_0_8_0.dtsi | 15 +++++++++++++++ .../nrf54h20dk_nrf54h20_cpuapp_0_8_0.overlay | 7 +++++++ .../nrf54h20dk_nrf54h20_cpuflpr_0_8_0.overlay | 7 +++++++ .../nrf54h20dk_nrf54h20_cpuppr_0_8_0.overlay | 7 +++++++ .../nrf54h20dk_nrf54h20_cpurad_0_8_0.overlay | 7 +++++++ dts/bindings/arm/nordic,nrf-uicr-v2.yaml | 7 ------- dts/common/nordic/nrf54h20.dtsi | 14 ++------------ dts/common/nordic/nrf9280.dtsi | 10 ---------- 8 files changed, 45 insertions(+), 29 deletions(-) create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_0_8_0.dtsi create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_8_0.overlay create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_8_0.overlay create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_8_0.overlay create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_8_0.overlay diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_0_8_0.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_0_8_0.dtsi new file mode 100644 index 0000000000000..940ac4d239167 --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_0_8_0.dtsi @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/delete-node/ &suit_storage_partition; + +/ { + reserved-memory { + suit_storage_partition: memory@e1eb000 { + reg = <0xe1eb000 DT_SIZE_K(24)>; + }; + }; +}; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_8_0.overlay b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_8_0.overlay new file mode 100644 index 0000000000000..dfee18c5b6f00 --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_8_0.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54h20dk_nrf54h20_0_8_0.dtsi" diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_8_0.overlay b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_8_0.overlay new file mode 100644 index 0000000000000..dfee18c5b6f00 --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_8_0.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54h20dk_nrf54h20_0_8_0.dtsi" diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_8_0.overlay b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_8_0.overlay new file mode 100644 index 0000000000000..dfee18c5b6f00 --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_8_0.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54h20dk_nrf54h20_0_8_0.dtsi" diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_8_0.overlay b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_8_0.overlay new file mode 100644 index 0000000000000..dfee18c5b6f00 --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_8_0.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54h20dk_nrf54h20_0_8_0.dtsi" diff --git a/dts/bindings/arm/nordic,nrf-uicr-v2.yaml b/dts/bindings/arm/nordic,nrf-uicr-v2.yaml index f509fdf406125..9000cce94c5bc 100644 --- a/dts/bindings/arm/nordic,nrf-uicr-v2.yaml +++ b/dts/bindings/arm/nordic,nrf-uicr-v2.yaml @@ -17,10 +17,3 @@ properties: description: | Domain ID of the domain associated with this UICR instance. Must be unique across all UICR instances in the system. - - ptr-ext-uicr: - type: phandle - required: true - description: | - Handle of a memory region reserved to contain an Extended UICR instance. - The address of that node will be stored in the UICR.PTREXTUICR register. diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index 5f48cfb6d5b9b..92a4880cf1795 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -145,16 +145,8 @@ #address-cells = <1>; #size-cells = <1>; - suit_storage_partition: memory@e1eb000 { - reg = <0xe1eb000 DT_SIZE_K(24)>; - }; - - cpurad_uicr_ext: memory@e1ff000 { - reg = <0xe1ff000 DT_SIZE_K(2)>; - }; - - cpuapp_uicr_ext: memory@e1ff800 { - reg = <0xe1ff800 DT_SIZE_K(2)>; + suit_storage_partition: memory@e1ed000 { + reg = <0xe1ed000 DT_SIZE_K(20)>; }; }; @@ -217,14 +209,12 @@ compatible = "nordic,nrf-uicr-v2"; reg = <0xfff8000 DT_SIZE_K(2)>; domain = <2>; - ptr-ext-uicr = <&cpuapp_uicr_ext>; }; cpurad_uicr: uicr@fffa000 { compatible = "nordic,nrf-uicr-v2"; reg = <0xfffa000 DT_SIZE_K(2)>; domain = <3>; - ptr-ext-uicr = <&cpurad_uicr_ext>; }; ficr: ficr@fffe000 { diff --git a/dts/common/nordic/nrf9280.dtsi b/dts/common/nordic/nrf9280.dtsi index e0a34fc22f95b..4fd64cd10be60 100644 --- a/dts/common/nordic/nrf9280.dtsi +++ b/dts/common/nordic/nrf9280.dtsi @@ -74,14 +74,6 @@ reserved-memory { #address-cells = <1>; #size-cells = <1>; - - cpurad_uicr_ext: memory@e401000 { - reg = <0xe401000 DT_SIZE_K(2)>; - }; - - cpuapp_uicr_ext: memory@e401800 { - reg = <0xe401800 DT_SIZE_K(2)>; - }; }; clocks { @@ -113,14 +105,12 @@ compatible = "nordic,nrf-uicr-v2"; reg = <0xfff8000 DT_SIZE_K(2)>; domain = <2>; - ptr-ext-uicr = <&cpuapp_uicr_ext>; }; cpurad_uicr: uicr@fffa000 { compatible = "nordic,nrf-uicr-v2"; reg = <0xfffa000 DT_SIZE_K(2)>; domain = <3>; - ptr-ext-uicr = <&cpurad_uicr_ext>; }; ficr: ficr@fffe000 { From 906ae3591c3414c7c0ba3eef31629cb94f02f600 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Tue, 10 Sep 2024 21:52:56 +0200 Subject: [PATCH 1881/4482] Bluetooth: Controller: Fix ISO Sync Receiver BIS payload dereferencing Fix incorrect use of BIS indices to dereference the payload array, instead correctly use synchronised stream indices. Signed-off-by: Vinayak Kariappa Chettimada --- .../ll_sw/nordic/lll/lll_sync_iso.c | 48 +++++++++++-------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c index 42c57790516ee..2b17807f217ed 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c @@ -526,6 +526,7 @@ static void isr_rx(void *param) uint16_t data_chan_id; uint8_t data_chan_use; uint8_t crc_init[3]; + uint8_t stream_curr; uint8_t rssi_ready; uint32_t start_us; uint8_t new_burst; @@ -553,6 +554,9 @@ static void isr_rx(void *param) /* BIS index */ bis_idx = lll->bis_curr - 1U; + /* Current stream */ + stream_curr = lll->stream_curr; + goto isr_rx_done; } @@ -587,6 +591,9 @@ static void isr_rx(void *param) /* BIS index */ bis_idx = lll->bis_curr - 1U; + /* Current stream */ + stream_curr = lll->stream_curr; + /* Check CRC and generate ISO Data PDU */ if (crc_ok) { struct lll_sync_iso_stream *sync_stream; @@ -648,14 +655,14 @@ static void isr_rx(void *param) } /* Get reference to stream context */ - stream_handle = lll->stream_handle[lll->stream_curr]; + stream_handle = lll->stream_handle[stream_curr]; sync_stream = ull_sync_iso_lll_stream_get(stream_handle); /* Store the received PDU if selected stream and not already * received (say in previous event as pre-transmitted PDU. */ if ((lll->bis_curr == sync_stream->bis_index) && pdu->len && - !lll->payload[bis_idx][payload_index]) { + !lll->payload[stream_curr][payload_index]) { uint16_t handle; if (IS_ENABLED(CONFIG_BT_CTLR_BROADCAST_ISO_ENC) && @@ -679,7 +686,7 @@ static void isr_rx(void *param) handle = LL_BIS_SYNC_HANDLE_FROM_IDX(stream_handle); isr_rx_iso_data_valid(lll, handle, node_rx); - lll->payload[bis_idx][payload_index] = node_rx; + lll->payload[stream_curr][payload_index] = node_rx; } } @@ -724,7 +731,7 @@ static void isr_rx(void *param) } /* Check if (bn_curr)th Rx PDU has been received */ - if (!lll->payload[bis_idx][payload_index]) { + if (!lll->payload[stream_curr][payload_index]) { /* Receive the (bn_curr)th Rx PDU of bis_curr */ bis = lll->bis_curr; @@ -767,7 +774,7 @@ static void isr_rx(void *param) /* Check if (irc_curr)th bn = 1 Rx PDU has been * received. */ - if (!lll->payload[bis_idx][payload_index]) { + if (!lll->payload[stream_curr][payload_index]) { /* Receive the (irc_curr)th bn = 1 Rx PDU of * bis_curr. */ @@ -816,14 +823,13 @@ static void isr_rx(void *param) /* Next BIS */ if (lll->bis_curr < lll->num_bis) { - const uint8_t stream_curr = lll->stream_curr + 1U; struct lll_sync_iso_stream *sync_stream; uint16_t stream_handle; /* Next selected stream */ - if (stream_curr < lll->stream_count) { - lll->stream_curr = stream_curr; - stream_handle = lll->stream_handle[lll->stream_curr]; + if ((lll->stream_curr + 1U) < lll->stream_count) { + stream_curr = ++lll->stream_curr; + stream_handle = lll->stream_handle[stream_curr]; sync_stream = ull_sync_iso_lll_stream_get(stream_handle); if (sync_stream->bis_index <= lll->num_bis) { uint32_t payload_offset; @@ -859,7 +865,7 @@ static void isr_rx(void *param) /* Check if (irc_curr)th bn = 1 Rx PDU has been * received. */ - if (!lll->payload[bis_idx_new][payload_index]) { + if (!lll->payload[stream_curr][payload_index]) { /* bn = 1 Rx PDU not received */ skipped = (bis_idx_new - bis_idx) * ((lll->bn * lll->irc) + @@ -1165,14 +1171,16 @@ static void isr_rx_done(void *param) /* Catchup with ISO event latencies */ latency_event = lll->latency_event; do { - lll->stream_curr = 0U; + uint8_t stream_curr; + + stream_curr = 0U; for (bis_idx = 0U; bis_idx < lll->num_bis; bis_idx++) { struct lll_sync_iso_stream *stream; - uint8_t payload_tail; - uint8_t stream_curr; + uint8_t stream_curr_inc; uint16_t stream_handle; + uint8_t payload_tail; - stream_handle = lll->stream_handle[lll->stream_curr]; + stream_handle = lll->stream_handle[stream_curr]; stream = ull_sync_iso_lll_stream_get(stream_handle); /* Skip BIS indices not synchronized. bis_index is 0x01 to 0x1F, * where as bis_idx is 0 indexed. @@ -1184,9 +1192,9 @@ static void isr_rx_done(void *param) payload_tail = lll->payload_tail; bn = lll->bn; while (bn--) { - if (lll->payload[bis_idx][payload_tail]) { - node_rx = lll->payload[bis_idx][payload_tail]; - lll->payload[bis_idx][payload_tail] = NULL; + if (lll->payload[stream_curr][payload_tail]) { + node_rx = lll->payload[stream_curr][payload_tail]; + lll->payload[stream_curr][payload_tail] = NULL; iso_rx_put(node_rx->hdr.link, node_rx); } else { @@ -1221,9 +1229,9 @@ static void isr_rx_done(void *param) payload_tail = payload_index; } - stream_curr = lll->stream_curr + 1U; - if (stream_curr < lll->stream_count) { - lll->stream_curr = stream_curr; + stream_curr_inc = stream_curr + 1U; + if (stream_curr_inc < lll->stream_count) { + stream_curr = stream_curr_inc; } } lll->payload_tail = payload_index; From eb180052bb9ddeab9e65010ac36705e1ee7284ca Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Tue, 10 Sep 2024 22:09:44 +0200 Subject: [PATCH 1882/4482] samples: Bluetooth: iso_broadcast: Restrict max stream sync Restrict possible maximum stream synchronization to implementation defined 2 stream, as structure declarations in the implementation is limited to 2. Signed-off-by: Vinayak Kariappa Chettimada --- samples/bluetooth/iso_receive/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/bluetooth/iso_receive/src/main.c b/samples/bluetooth/iso_receive/src/main.c index 989694907b4a9..b7714e08b2185 100644 --- a/samples/bluetooth/iso_receive/src/main.c +++ b/samples/bluetooth/iso_receive/src/main.c @@ -22,7 +22,7 @@ #define PA_RETRY_COUNT 6 -#define BIS_ISO_CHAN_COUNT 2 +#define BIS_ISO_CHAN_COUNT MIN(2U, CONFIG_BT_ISO_MAX_CHAN) static bool per_adv_found; static bool per_adv_lost; From 7048b0fa4b65a9ec3ab1dba5a92f428bf7399c47 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Tue, 10 Sep 2024 22:17:59 +0200 Subject: [PATCH 1883/4482] samples: Bluetooth: iso_broadcast: Fix buf alloc timeout Fix buf alloc timeout to 20 millisecond as the sent callback can have a latency that is upto twice the ISO interval. Signed-off-by: Vinayak Kariappa Chettimada --- samples/bluetooth/iso_broadcast/src/main.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/samples/bluetooth/iso_broadcast/src/main.c b/samples/bluetooth/iso_broadcast/src/main.c index 85460d10fdd5c..0086a9786de7c 100644 --- a/samples/bluetooth/iso_broadcast/src/main.c +++ b/samples/bluetooth/iso_broadcast/src/main.c @@ -8,9 +8,9 @@ #include #include -#define BUF_ALLOC_TIMEOUT (10) /* milliseconds */ +#define BIG_SDU_INTERVAL_US (10000) +#define BUF_ALLOC_TIMEOUT_US (BIG_SDU_INTERVAL_US * 2U) /* milliseconds */ #define BIG_TERMINATE_TIMEOUT_US (60 * USEC_PER_SEC) /* microseconds */ -#define BIG_SDU_INTERVAL_US (10000) #define BIS_ISO_CHAN_COUNT 2 NET_BUF_POOL_FIXED_DEFINE(bis_tx_pool, BIS_ISO_CHAN_COUNT, @@ -163,16 +163,14 @@ int main(void) struct net_buf *buf; int ret; - buf = net_buf_alloc(&bis_tx_pool, - K_MSEC(BUF_ALLOC_TIMEOUT)); + buf = net_buf_alloc(&bis_tx_pool, K_USEC(BUF_ALLOC_TIMEOUT_US)); if (!buf) { printk("Data buffer allocate timeout on channel" " %u\n", chan); return 0; } - ret = k_sem_take(&sem_iso_data, - K_MSEC(BUF_ALLOC_TIMEOUT)); + ret = k_sem_take(&sem_iso_data, K_USEC(BUF_ALLOC_TIMEOUT_US)); if (ret) { printk("k_sem_take for ISO data sent failed\n"); net_buf_unref(buf); From bb4c44153b3bbf7c55b3f3c41d8873626d140f4f Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Fri, 25 Oct 2024 10:27:41 +0200 Subject: [PATCH 1884/4482] samples: Bluetooth: broadcaster_multiple: Refactor for reuse Refactor the sample so that multiple advertising setup can be reused in other sample if required. Bluetooth enable can be in the sample that reuses the advertising setup. Signed-off-by: Vinayak Kariappa Chettimada --- .../broadcaster_multiple/src/broadcaster_multiple.c | 7 ------- samples/bluetooth/broadcaster_multiple/src/main.c | 10 ++++++++++ tests/bsim/bluetooth/host/adv/chain/src/main.c | 8 ++++++++ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/samples/bluetooth/broadcaster_multiple/src/broadcaster_multiple.c b/samples/bluetooth/broadcaster_multiple/src/broadcaster_multiple.c index f2e7127b406bd..63834fa3852c0 100644 --- a/samples/bluetooth/broadcaster_multiple/src/broadcaster_multiple.c +++ b/samples/bluetooth/broadcaster_multiple/src/broadcaster_multiple.c @@ -77,13 +77,6 @@ int broadcaster_multiple(void) }; int err; - /* Initialize the Bluetooth Subsystem */ - err = bt_enable(NULL); - if (err) { - printk("Bluetooth init failed (err %d)\n", err); - return err; - } - for (int index = 0; index < CONFIG_BT_EXT_ADV_MAX_ADV_SET; index++) { /* Use advertising set instance index as SID */ adv_param.sid = index; diff --git a/samples/bluetooth/broadcaster_multiple/src/main.c b/samples/bluetooth/broadcaster_multiple/src/main.c index f30db217e86d2..4da680e4d8b39 100644 --- a/samples/bluetooth/broadcaster_multiple/src/main.c +++ b/samples/bluetooth/broadcaster_multiple/src/main.c @@ -5,13 +5,23 @@ */ #include +#include int broadcaster_multiple(void); int main(void) { + int err; + printk("Starting Multiple Broadcaster Demo\n"); + /* Initialize the Bluetooth Subsystem */ + err = bt_enable(NULL); + if (err) { + printk("Bluetooth init failed (err %d)\n", err); + return 0; + } + (void)broadcaster_multiple(); printk("Exiting %s thread.\n", __func__); diff --git a/tests/bsim/bluetooth/host/adv/chain/src/main.c b/tests/bsim/bluetooth/host/adv/chain/src/main.c index dd7a400cb62c6..ad71812531861 100644 --- a/tests/bsim/bluetooth/host/adv/chain/src/main.c +++ b/tests/bsim/bluetooth/host/adv/chain/src/main.c @@ -51,6 +51,14 @@ static void test_adv_main(void) extern int broadcaster_multiple(void); int err; + err = bt_enable(NULL); + if (err) { + FAIL("Bluetooth init failed\n"); + + bs_trace_silent_exit(err); + return; + } + err = broadcaster_multiple(); if (err) { FAIL("Adv tests failed\n"); From 742ffd5b169d3fcf938575eba1d55a8d4c7fd368 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Fri, 25 Oct 2024 10:17:35 +0200 Subject: [PATCH 1885/4482] Bluetooth: Controller: Fix compile error missing lll_df_types include Fix compile error due to missing lll_df_types include. Signed-off-by: Vinayak Kariappa Chettimada --- .../controller/ll_sw/ull_llcp_past.c | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_past.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_past.c index a1d3887d115ec..8b8f88147e0f8 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_past.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_past.c @@ -12,36 +12,42 @@ #include "hal/ccm.h" #include "hal/debug.h" -#include "util/memq.h" #include "util/util.h" +#include "util/memq.h" +#include "util/dbuf.h" #include "pdu_df.h" #include "lll/pdu_vendor.h" #include "pdu.h" + #include "lll.h" -#include "lll_conn.h" +#include "lll/lll_df_types.h" #include "lll_filter.h" +#include "lll_scan.h" +#include "lll_sync.h" +#include "lll_sync_iso.h" +#include "lll_conn.h" +#include "lll_conn_iso.h" + #include "ull_tx_queue.h" -#include "ull_conn_types.h" -#include "ull_llcp_internal.h" + #include "isoal.h" +#include "ull_scan_types.h" +#include "ull_sync_types.h" #include "ull_iso_types.h" -#include "lll_conn_iso.h" +#include "ull_conn_types.h" #include "ull_conn_iso_types.h" -#include "lll_sync.h" -#include "lll_sync_iso.h" -#include "ull_sync_types.h" -#include "lll_scan.h" -#include "ull_scan_types.h" -#include "ull_llcp.h" -#include "ull_internal.h" -#include "ull_conn_internal.h" -#include "ull_sync_internal.h" #include "ll_settings.h" #include "ll_feat.h" + +#include "ull_llcp.h" #include "ull_llcp_features.h" +#include "ull_internal.h" +#include "ull_sync_internal.h" +#include "ull_conn_internal.h" +#include "ull_llcp_internal.h" #if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) /* LLCP Remote Procedure FSM states */ From 9a8b1b1d72dadb37dee2c294ff9b15f48a5d194e Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Fri, 25 Oct 2024 10:17:35 +0200 Subject: [PATCH 1886/4482] Bluetooth: Controller: Fix compile error when BT_CTLR_PRIVACY disabled Fix compile error when BT_CTLR_PRIVACY is disabled. Compile error seen building hci_uart sample for nrf54l15dk. Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/ull_llcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp.c b/subsys/bluetooth/controller/ll_sw/ull_llcp.c index 14754090934fc..0f9877ecc845a 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp.c @@ -1072,7 +1072,7 @@ uint8_t ull_cp_periodic_sync(struct ll_conn *conn, struct ll_sync_set *sync, interval = sync->interval; addr_type = sync->peer_id_addr_type; - if (sync->peer_addr_resolved) { + if (IS_ENABLED(CONFIG_BT_CTLR_PRIVACY) && sync->peer_addr_resolved) { uint8_t rl_idx; /* peer_id_addr contains the identity address; Get the peers RPA */ From 14d5b8d63d7acd35f6fc4045370cae32c4a44b59 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Fri, 25 Oct 2024 09:46:44 +0200 Subject: [PATCH 1887/4482] samples: Bluetooth: hci_uart_3wire: Align Kconfigs with hci_uart Align Kconfig values used with bt-ll-sw-split Controller as same used in hci_uart sample. Relates to commit 2c6306d09954 ("Bluetooth: Controller: BT_CTLR_ISO_TX_BUFFER_SIZE from BT_ISO_TX_MTU")'. Signed-off-by: Vinayak Kariappa Chettimada --- .../hci_uart_3wire/overlay-all-bt_ll_sw_split.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf b/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf index 35ac7c6525bcd..548d3a14a2bca 100644 --- a/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf @@ -81,7 +81,7 @@ CONFIG_BT_CTLR_DF_CONN_CTE_REQ=y CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y CONFIG_BT_CTLR_ADV_ISO=y -CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 # ISO Receive Controller @@ -94,12 +94,12 @@ CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 # ISO Connection Oriented CONFIG_BT_CTLR_CENTRAL_ISO=y CONFIG_BT_CTLR_PERIPHERAL_ISO=y -CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=251 +CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 # ISO Transmissions CONFIG_BT_CTLR_ISO_TX_BUFFERS=8 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=251 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 CONFIG_BT_CTLR_ISOAL_SOURCES=2 # ISO Receptions From 7f4bfdfd63af6097582c497fea1c4dc96302246f Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Fri, 25 Oct 2024 09:59:34 +0200 Subject: [PATCH 1888/4482] samples: Bluetooth: hci_uart(_3wire)/hci_ipc: Enable PAST feature Enabled Periodic Advertising Sync Transfer feature in the Bluetooth Low Energy HCI Controller samples. Signed-off-by: Vinayak Kariappa Chettimada --- .../bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf | 2 ++ .../bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf | 2 ++ samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf | 2 ++ .../bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf | 2 ++ 4 files changed, 8 insertions(+) diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf index 0e4a20602b520..c117a556dc1c1 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf @@ -77,6 +77,7 @@ CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM=6 # ISO Broadcaster Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y +CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER=y CONFIG_BT_CTLR_ADV_ISO=y CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 @@ -84,6 +85,7 @@ CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 # ISO Receive Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y +CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER=y CONFIG_BT_CTLR_SYNC_ISO=y CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf index 62a0225b58019..f27d32ee08015 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf @@ -89,6 +89,7 @@ CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM=6 # ISO Broadcaster Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y +CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER=y CONFIG_BT_CTLR_ADV_ISO=y CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 @@ -97,6 +98,7 @@ CONFIG_BT_CTLR_ADV_ISO_STREAM_COUNT=2 # ISO Receive Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y +CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER=y CONFIG_BT_CTLR_SYNC_ISO=y CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 diff --git a/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf b/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf index 3b2a93aba043a..5885a1cfb2881 100644 --- a/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf @@ -81,6 +81,7 @@ CONFIG_BT_CTLR_DF_CONN_CTE_REQ=y # ISO Broadcaster Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y +CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER=y CONFIG_BT_CTLR_ADV_ISO=y CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 @@ -88,6 +89,7 @@ CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 # ISO Receive Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y +CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER=y CONFIG_BT_CTLR_SYNC_ISO=y CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 diff --git a/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf b/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf index 548d3a14a2bca..df974a21ff45e 100644 --- a/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf @@ -80,6 +80,7 @@ CONFIG_BT_CTLR_DF_CONN_CTE_REQ=y # ISO Broadcaster Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y +CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER=y CONFIG_BT_CTLR_ADV_ISO=y CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 @@ -87,6 +88,7 @@ CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 # ISO Receive Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y +CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER=y CONFIG_BT_CTLR_SYNC_ISO=y CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 From 23f03dcd84381e14e28c8a4ca1b21933bf14ec97 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Wed, 24 Jan 2024 13:52:48 +0100 Subject: [PATCH 1889/4482] samples: Bluetooth: hci_uart hci_ipc configuration update Updates to project configuration extras to build with Zephyr Controller. Configure for 2 broadcast audio sources in 2 groups, 2 unicast audio source in 1 group and, 2 audio sinks for 1 group for both broadcast and unicast usecases. Signed-off-by: Vinayak Kariappa Chettimada --- .../nrf5340_cpunet_bis-bt_ll_sw_split.conf | 26 ++++++++---- .../nrf5340_cpunet_cis-bt_ll_sw_split.conf | 23 +++++++---- .../nrf5340_cpunet_df-bt_ll_sw_split.conf | 9 ++-- .../nrf5340_cpunet_iso-bt_ll_sw_split.conf | 41 ++++++++++++------- ...0_cpunet_iso_broadcast-bt_ll_sw_split.conf | 21 ++++++---- ...340_cpunet_iso_central-bt_ll_sw_split.conf | 20 +++++---- ..._cpunet_iso_peripheral-bt_ll_sw_split.conf | 20 +++++---- ...340_cpunet_iso_receive-bt_ll_sw_split.conf | 15 +++---- .../hci_uart/overlay-all-bt_ll_sw_split.conf | 36 ++++++++++++---- .../overlay-all-bt_ll_sw_split.conf | 36 ++++++++++++---- 10 files changed, 169 insertions(+), 78 deletions(-) diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf index c117a556dc1c1..a7487118694a0 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf @@ -5,13 +5,10 @@ CONFIG_ISR_STACK_SIZE=1024 CONFIG_IDLE_STACK_SIZE=256 CONFIG_MAIN_STACK_SIZE=512 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 -CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y -CONFIG_BT_OBSERVER=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_MAX_CONN=2 # Workaround: Unable to allocate command buffer when using K_NO_WAIT since # Host number of completed commands does not follow normal flow control. @@ -24,11 +21,16 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 -# Host features +# Host and Controller common dependencies +CONFIG_BT_BROADCASTER=y +CONFIG_BT_OBSERVER=y CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=y CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_PER_ADV_SYNC_MAX=2 +CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_MAX_CONN=2 # Broadcast and Connected ISO CONFIG_BT_ISO_BROADCASTER=y @@ -37,7 +39,9 @@ CONFIG_BT_ISO_CENTRAL=n CONFIG_BT_ISO_PERIPHERAL=n # ISO Streams -CONFIG_BT_ISO_MAX_CHAN=2 +CONFIG_BT_ISO_MAX_CHAN=4 +CONFIG_BT_ISO_TX_BUF_COUNT=1 +CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y @@ -79,21 +83,25 @@ CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER=y CONFIG_BT_CTLR_ADV_ISO=y -CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 +CONFIG_BT_CTLR_ADV_ISO_SET=2 +CONFIG_BT_CTLR_ADV_ISO_STREAM_COUNT=4 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 +CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 # ISO Receive Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER=y CONFIG_BT_CTLR_SYNC_ISO=y -CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_SCAN_SYNC_ISO_SET=1 +CONFIG_BT_CTLR_SYNC_ISO_STREAM_COUNT=2 CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 +CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 # ISO Transmissions -CONFIG_BT_CTLR_ISO_TX_BUFFERS=8 +CONFIG_BT_CTLR_ISOAL_SOURCES=4 +CONFIG_BT_CTLR_ISO_TX_BUFFERS=12 CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 -CONFIG_BT_CTLR_ISOAL_SOURCES=2 # ISO Receptions CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf index af142bf7dc6aa..f7e1f8fc6737d 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf @@ -5,12 +5,10 @@ CONFIG_ISR_STACK_SIZE=1024 CONFIG_IDLE_STACK_SIZE=256 CONFIG_MAIN_STACK_SIZE=512 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 -CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_MAX_CONN=2 # Workaround: Unable to allocate command buffer when using K_NO_WAIT since # Host number of completed commands does not follow normal flow control. @@ -23,12 +21,15 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 -# Host features +# Host and Controller common dependencies +CONFIG_BT_BROADCASTER=y +CONFIG_BT_OBSERVER=y CONFIG_BT_EXT_ADV=y -CONFIG_BT_PERIPHERAL=y -CONFIG_BT_CENTRAL=y CONFIG_BT_PER_ADV=n CONFIG_BT_PER_ADV_SYNC=n +CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_MAX_CONN=3 # Broadcast and Connected ISO CONFIG_BT_ISO_BROADCASTER=n @@ -37,7 +38,9 @@ CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_ISO_PERIPHERAL=y # ISO Streams -CONFIG_BT_ISO_MAX_CHAN=2 +CONFIG_BT_ISO_MAX_CHAN=4 +CONFIG_BT_ISO_TX_BUF_COUNT=1 +CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y @@ -79,13 +82,17 @@ CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM=6 # ISO Connection Oriented CONFIG_BT_CTLR_CENTRAL_ISO=y CONFIG_BT_CTLR_PERIPHERAL_ISO=y +CONFIG_BT_CTLR_CONN_ISO_STREAMS=2 +CONFIG_BT_CTLR_CONN_ISO_GROUPS=1 +CONFIG_BT_CTLR_CONN_ISO_STREAMS_PER_GROUP=2 CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_CONN_ISO_LOW_LATENCY_POLICY=y # ISO Transmissions -CONFIG_BT_CTLR_ISO_TX_BUFFERS=8 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 CONFIG_BT_CTLR_ISOAL_SOURCES=2 +CONFIG_BT_CTLR_ISO_TX_BUFFERS=12 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 # ISO Receptions CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf index 403501a5810a6..b183a4c9825fc 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf @@ -5,12 +5,10 @@ CONFIG_ISR_STACK_SIZE=1024 CONFIG_IDLE_STACK_SIZE=256 CONFIG_MAIN_STACK_SIZE=512 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 -CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_MAX_CONN=2 # Workaround: Unable to allocate command buffer when using K_NO_WAIT since # Host number of completed commands does not follow normal flow control. @@ -23,11 +21,16 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 -# Host features +# Host and Controller common dependencies +CONFIG_BT_BROADCASTER=y +CONFIG_BT_OBSERVER=y CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=y CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_PER_ADV_SYNC_MAX=2 +CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_MAX_CONN=2 # Controller CONFIG_BT_LL_SW_SPLIT=y diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf index f27d32ee08015..925eac8e34e63 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf @@ -5,7 +5,6 @@ CONFIG_ISR_STACK_SIZE=1024 CONFIG_IDLE_STACK_SIZE=256 CONFIG_MAIN_STACK_SIZE=512 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 -CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_CBPRINTF_REDUCED_INTEGRAL=y @@ -13,10 +12,7 @@ CONFIG_ISR_TABLES_LOCAL_DECLARATION=y CONFIG_LTO=y CONFIG_BT=y -CONFIG_BT_PERIPHERAL=y -CONFIG_BT_CENTRAL=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_MAX_CONN=3 # Workaround: Unable to allocate command buffer when using K_NO_WAIT since # Host number of completed commands does not follow normal flow control. @@ -29,11 +25,16 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 -# Host features +# Host and Controller common dependencies +CONFIG_BT_BROADCASTER=y +CONFIG_BT_OBSERVER=y CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=y CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_PER_ADV_SYNC_MAX=2 +CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_MAX_CONN=3 # Broadcast and Connected ISO CONFIG_BT_ISO_BROADCASTER=y @@ -42,7 +43,11 @@ CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_ISO_PERIPHERAL=y # ISO Streams +CONFIG_BT_ISO_TX_MTU=310 +CONFIG_BT_ISO_RX_MTU=310 CONFIG_BT_ISO_MAX_CHAN=4 +CONFIG_BT_ISO_TX_BUF_COUNT=1 +CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y @@ -71,8 +76,12 @@ CONFIG_BT_CTLR_ADV_DATA_BUF_MAX=6 # Increase the below to receive interleaved advertising chains CONFIG_BT_CTLR_SCAN_AUX_SET=1 +# CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS=y +# CONFIG_BT_CTLR_SCAN_AUX_CHAIN_COUNT=1 CONFIG_BT_CTLR_ADV_RESERVE_MAX=n +CONFIG_BT_CTLR_ADV_ISO_RESERVE_MAX=y +CONFIG_BT_CTLR_SYNC_ISO_RESERVE_MAX=n CONFIG_BT_CTLR_CENTRAL_RESERVE_MAX=n CONFIG_BT_CTLR_PERIPHERAL_RESERVE_MAX=n CONFIG_BT_CTLR_PERIPHERAL_ISO_RESERVE_MAX=n @@ -91,38 +100,42 @@ CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER=y CONFIG_BT_CTLR_ADV_ISO=y -CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 +CONFIG_BT_CTLR_ADV_ISO_SET=2 +CONFIG_BT_CTLR_ADV_ISO_STREAM_COUNT=4 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 -CONFIG_BT_CTLR_ADV_ISO_STREAM_COUNT=2 +CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 # ISO Receive Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER=y CONFIG_BT_CTLR_SYNC_ISO=y -CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_SCAN_SYNC_ISO_SET=1 +CONFIG_BT_CTLR_SYNC_ISO_STREAM_COUNT=2 CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 +CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 # ISO Connection Oriented CONFIG_BT_CTLR_CENTRAL_ISO=y CONFIG_BT_CTLR_PERIPHERAL_ISO=y CONFIG_BT_CTLR_CONN_ISO_STREAMS=2 +CONFIG_BT_CTLR_CONN_ISO_GROUPS=1 CONFIG_BT_CTLR_CONN_ISO_STREAMS_PER_GROUP=2 CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 CONFIG_BT_CTLR_CONN_ISO_LOW_LATENCY_POLICY=y # ISO Transmissions -CONFIG_BT_ISO_TX_MTU=310 -CONFIG_BT_ISO_TX_BUF_COUNT=4 -CONFIG_BT_CTLR_ISO_TX_BUFFERS=8 +CONFIG_BT_CTLR_ISOAL_SOURCES=4 +CONFIG_BT_CTLR_ISO_TX_BUFFERS=12 CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 -CONFIG_BT_CTLR_ISOAL_SOURCES=2 # ISO Receptions -CONFIG_BT_ISO_RX_MTU=310 -CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 CONFIG_BT_CTLR_ISOAL_SINKS=2 +CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 # Tx Power Dynamic Control CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y + +# Ignore HCI ISO data Tx sequence numbers +# CONFIG_BT_CTLR_ISOAL_PSN_IGNORE=y diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf index 05645663bc442..67c5854c9c0c7 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf @@ -5,7 +5,6 @@ CONFIG_ISR_STACK_SIZE=1024 CONFIG_IDLE_STACK_SIZE=256 CONFIG_MAIN_STACK_SIZE=512 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 -CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y @@ -15,26 +14,30 @@ CONFIG_BT_HCI_RAW=y # Host number of completed commands does not follow normal flow control. CONFIG_BT_BUF_CMD_TX_COUNT=10 -# Host +# Host and Controller common dependencies CONFIG_BT_BROADCASTER=y -CONFIG_BT_PERIPHERAL=n CONFIG_BT_OBSERVER=n -CONFIG_BT_CENTRAL=n CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=y CONFIG_BT_ISO_BROADCASTER=y -CONFIG_BT_ISO_MAX_CHAN=2 +CONFIG_BT_ISO_MAX_CHAN=4 +CONFIG_BT_ISO_TX_BUF_COUNT=1 +CONFIG_BT_CENTRAL=n +CONFIG_BT_PERIPHERAL=n # ISO Broadcast Controller CONFIG_BT_LL_SW_SPLIT=y CONFIG_BT_CTLR_ADV_PERIODIC=y CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=191 CONFIG_BT_CTLR_ADV_ISO=y -CONFIG_BT_CTLR_ISO_TX_BUFFERS=16 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 -CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 +CONFIG_BT_CTLR_ADV_ISO_SET=2 +CONFIG_BT_CTLR_ADV_ISO_STREAM_COUNT=4 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 -CONFIG_BT_CTLR_ISOAL_SOURCES=2 +CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 +CONFIG_BT_CTLR_ISOAL_SOURCES=4 + +CONFIG_BT_CTLR_ISO_TX_BUFFERS=12 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 CONFIG_BT_CTLR_ADVANCED_FEATURES=y CONFIG_BT_CTLR_ADV_RESERVE_MAX=n diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf index 56e80860f326b..505b9d352ba0e 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf @@ -5,7 +5,6 @@ CONFIG_ISR_STACK_SIZE=1024 CONFIG_IDLE_STACK_SIZE=256 CONFIG_MAIN_STACK_SIZE=512 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 -CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y @@ -20,21 +19,24 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 -# Host +# Host and Controller common dependencies CONFIG_BT_BROADCASTER=n -CONFIG_BT_PERIPHERAL=n CONFIG_BT_OBSERVER=y -CONFIG_BT_CENTRAL=y CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=n CONFIG_BT_PER_ADV_SYNC=n CONFIG_BT_ISO_BROADCASTER=n CONFIG_BT_ISO_SYNC_RECEIVER=n +CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=n +CONFIG_BT_MAX_CONN=2 CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_ISO_PERIPHERAL=n # ISO Streams CONFIG_BT_ISO_MAX_CHAN=2 +CONFIG_BT_ISO_TX_BUF_COUNT=1 +CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y @@ -44,17 +46,21 @@ CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191 # ISO Connection Oriented CONFIG_BT_CTLR_CENTRAL_ISO=y CONFIG_BT_CTLR_PERIPHERAL_ISO=n +CONFIG_BT_CTLR_CONN_ISO_STREAMS=2 +CONFIG_BT_CTLR_CONN_ISO_GROUPS=1 +CONFIG_BT_CTLR_CONN_ISO_STREAMS_PER_GROUP=2 CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_CONN_ISO_LOW_LATENCY_POLICY=y # ISO Transmissions -CONFIG_BT_CTLR_ISO_TX_BUFFERS=16 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 CONFIG_BT_CTLR_ISOAL_SOURCES=2 +CONFIG_BT_CTLR_ISO_TX_BUFFERS=12 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 # ISO Receptions -CONFIG_BT_CTLR_ISO_RX_BUFFERS=16 CONFIG_BT_CTLR_ISOAL_SINKS=2 +CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 # Controller with minimum ACL event length and unreserved scanning CONFIG_BT_CTLR_ADVANCED_FEATURES=y diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf index b72aaa624f1a7..05c9a9d39033e 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf @@ -5,7 +5,6 @@ CONFIG_ISR_STACK_SIZE=1024 CONFIG_IDLE_STACK_SIZE=256 CONFIG_MAIN_STACK_SIZE=512 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 -CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y @@ -20,21 +19,24 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 -# Host +# Host and Controller common dependencies CONFIG_BT_BROADCASTER=y -CONFIG_BT_PERIPHERAL=y CONFIG_BT_OBSERVER=n -CONFIG_BT_CENTRAL=n CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=n CONFIG_BT_PER_ADV_SYNC=n CONFIG_BT_ISO_BROADCASTER=n CONFIG_BT_ISO_SYNC_RECEIVER=n +CONFIG_BT_CENTRAL=n +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_MAX_CONN=1 CONFIG_BT_ISO_CENTRAL=n CONFIG_BT_ISO_PERIPHERAL=y # ISO Streams CONFIG_BT_ISO_MAX_CHAN=2 +CONFIG_BT_ISO_TX_BUF_COUNT=1 +CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y @@ -44,17 +46,21 @@ CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=191 # ISO Connection Oriented CONFIG_BT_CTLR_CENTRAL_ISO=n CONFIG_BT_CTLR_PERIPHERAL_ISO=y +CONFIG_BT_CTLR_CONN_ISO_STREAMS=2 +CONFIG_BT_CTLR_CONN_ISO_GROUPS=1 +CONFIG_BT_CTLR_CONN_ISO_STREAMS_PER_GROUP=2 CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_CONN_ISO_LOW_LATENCY_POLICY=y # ISO Transmissions -CONFIG_BT_CTLR_ISO_TX_BUFFERS=16 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 CONFIG_BT_CTLR_ISOAL_SOURCES=2 +CONFIG_BT_CTLR_ISO_TX_BUFFERS=12 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 # ISO Receptions -CONFIG_BT_CTLR_ISO_RX_BUFFERS=16 CONFIG_BT_CTLR_ISOAL_SINKS=2 +CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 CONFIG_BT_CTLR_ADVANCED_FEATURES=y CONFIG_BT_CTLR_ADV_RESERVE_MAX=n diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf index cc3b5adecddb6..51ca53e83f233 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf @@ -5,7 +5,6 @@ CONFIG_ISR_STACK_SIZE=1024 CONFIG_IDLE_STACK_SIZE=256 CONFIG_MAIN_STACK_SIZE=512 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 -CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y @@ -15,22 +14,24 @@ CONFIG_BT_HCI_RAW=y # Host number of completed commands does not follow normal flow control. CONFIG_BT_BUF_CMD_TX_COUNT=10 -# Host +# Host and Controller common dependencies CONFIG_BT_BROADCASTER=n -CONFIG_BT_PERIPHERAL=n CONFIG_BT_OBSERVER=y -CONFIG_BT_CENTRAL=n CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_ISO_SYNC_RECEIVER=y -CONFIG_BT_ISO_MAX_CHAN=2 +CONFIG_BT_ISO_MAX_CHAN=4 +CONFIG_BT_CENTRAL=n +CONFIG_BT_PERIPHERAL=n # ISO Receive Controller CONFIG_BT_LL_SW_SPLIT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191 CONFIG_BT_CTLR_SYNC_ISO=y -CONFIG_BT_CTLR_ISO_RX_BUFFERS=16 -CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_SCAN_SYNC_ISO_SET=1 +CONFIG_BT_CTLR_SYNC_ISO_STREAM_COUNT=2 CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 +CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 CONFIG_BT_CTLR_ISOAL_SINKS=2 +CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 diff --git a/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf b/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf index 5885a1cfb2881..a4054de093452 100644 --- a/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf @@ -10,8 +10,8 @@ CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=y CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_PER_ADV_SYNC_MAX=2 -CONFIG_BT_PERIPHERAL=y CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=y # Broadcast and Connected ISO CONFIG_BT_ISO_BROADCASTER=y @@ -20,7 +20,11 @@ CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_ISO_PERIPHERAL=y # ISO Streams -CONFIG_BT_ISO_MAX_CHAN=2 +CONFIG_BT_ISO_TX_MTU=310 +CONFIG_BT_ISO_RX_MTU=310 +CONFIG_BT_ISO_MAX_CHAN=4 +CONFIG_BT_ISO_TX_BUF_COUNT=1 +CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y @@ -49,9 +53,16 @@ CONFIG_BT_CTLR_ADV_DATA_BUF_MAX=6 # Increase the below to receive interleaved advertising chains CONFIG_BT_CTLR_SCAN_AUX_SET=1 +# CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS=y +# CONFIG_BT_CTLR_SCAN_AUX_CHAIN_COUNT=1 CONFIG_BT_CTLR_ADV_RESERVE_MAX=n +CONFIG_BT_CTLR_ADV_ISO_RESERVE_MAX=y +CONFIG_BT_CTLR_SYNC_ISO_RESERVE_MAX=n CONFIG_BT_CTLR_CENTRAL_RESERVE_MAX=n +CONFIG_BT_CTLR_PERIPHERAL_RESERVE_MAX=n +CONFIG_BT_CTLR_PERIPHERAL_ISO_RESERVE_MAX=n +CONFIG_BT_CTLR_EVENT_OVERHEAD_RESERVE_MAX=y CONFIG_BT_CTLR_SLOT_RESERVATION_UPDATE=n CONFIG_BT_CTLR_SCAN_UNRESERVED=y CONFIG_BT_TICKER_NEXT_SLOT_GET_MATCH=y @@ -83,31 +94,42 @@ CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER=y CONFIG_BT_CTLR_ADV_ISO=y -CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 +CONFIG_BT_CTLR_ADV_ISO_SET=2 +CONFIG_BT_CTLR_ADV_ISO_STREAM_COUNT=4 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 +CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 # ISO Receive Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER=y CONFIG_BT_CTLR_SYNC_ISO=y -CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_SCAN_SYNC_ISO_SET=1 +CONFIG_BT_CTLR_SYNC_ISO_STREAM_COUNT=2 CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 +CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 # ISO Connection Oriented CONFIG_BT_CTLR_CENTRAL_ISO=y CONFIG_BT_CTLR_PERIPHERAL_ISO=y +CONFIG_BT_CTLR_CONN_ISO_STREAMS=2 +CONFIG_BT_CTLR_CONN_ISO_GROUPS=1 +CONFIG_BT_CTLR_CONN_ISO_STREAMS_PER_GROUP=2 CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_CONN_ISO_LOW_LATENCY_POLICY=y # ISO Transmissions -CONFIG_BT_CTLR_ISO_TX_BUFFERS=8 +CONFIG_BT_CTLR_ISOAL_SOURCES=4 +CONFIG_BT_CTLR_ISO_TX_BUFFERS=18 CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 -CONFIG_BT_CTLR_ISOAL_SOURCES=2 # ISO Receptions -CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 CONFIG_BT_CTLR_ISOAL_SINKS=2 +CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 # Tx Power Dynamic Control CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y + +# Ignore HCI ISO data Tx sequence numbers +# CONFIG_BT_CTLR_ISOAL_PSN_IGNORE=y diff --git a/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf b/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf index df974a21ff45e..8a0f9d3364acc 100644 --- a/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf @@ -10,8 +10,8 @@ CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=y CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_PER_ADV_SYNC_MAX=2 -CONFIG_BT_PERIPHERAL=y CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=y # Broadcast and Connected ISO CONFIG_BT_ISO_BROADCASTER=y @@ -20,7 +20,11 @@ CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_ISO_PERIPHERAL=y # ISO Streams -CONFIG_BT_ISO_MAX_CHAN=2 +CONFIG_BT_ISO_TX_MTU=310 +CONFIG_BT_ISO_RX_MTU=310 +CONFIG_BT_ISO_MAX_CHAN=4 +CONFIG_BT_ISO_TX_BUF_COUNT=1 +CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y @@ -48,9 +52,16 @@ CONFIG_BT_CTLR_ADV_DATA_BUF_MAX=6 # Increase the below to receive interleaved advertising chains CONFIG_BT_CTLR_SCAN_AUX_SET=1 +# CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS=y +# CONFIG_BT_CTLR_SCAN_AUX_CHAIN_COUNT=1 CONFIG_BT_CTLR_ADV_RESERVE_MAX=n +CONFIG_BT_CTLR_ADV_ISO_RESERVE_MAX=y +CONFIG_BT_CTLR_SYNC_ISO_RESERVE_MAX=n CONFIG_BT_CTLR_CENTRAL_RESERVE_MAX=n +CONFIG_BT_CTLR_PERIPHERAL_RESERVE_MAX=n +CONFIG_BT_CTLR_PERIPHERAL_ISO_RESERVE_MAX=n +CONFIG_BT_CTLR_EVENT_OVERHEAD_RESERVE_MAX=y CONFIG_BT_CTLR_SLOT_RESERVATION_UPDATE=n CONFIG_BT_CTLR_SCAN_UNRESERVED=y CONFIG_BT_TICKER_NEXT_SLOT_GET_MATCH=y @@ -82,31 +93,42 @@ CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER=y CONFIG_BT_CTLR_ADV_ISO=y -CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 +CONFIG_BT_CTLR_ADV_ISO_SET=2 +CONFIG_BT_CTLR_ADV_ISO_STREAM_COUNT=4 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 +CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 # ISO Receive Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER=y CONFIG_BT_CTLR_SYNC_ISO=y -CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_SCAN_SYNC_ISO_SET=1 +CONFIG_BT_CTLR_SYNC_ISO_STREAM_COUNT=2 CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 +CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 # ISO Connection Oriented CONFIG_BT_CTLR_CENTRAL_ISO=y CONFIG_BT_CTLR_PERIPHERAL_ISO=y +CONFIG_BT_CTLR_CONN_ISO_STREAMS=2 +CONFIG_BT_CTLR_CONN_ISO_GROUPS=1 +CONFIG_BT_CTLR_CONN_ISO_STREAMS_PER_GROUP=2 CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_CONN_ISO_LOW_LATENCY_POLICY=y # ISO Transmissions -CONFIG_BT_CTLR_ISO_TX_BUFFERS=8 +CONFIG_BT_CTLR_ISOAL_SOURCES=4 +CONFIG_BT_CTLR_ISO_TX_BUFFERS=18 CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 -CONFIG_BT_CTLR_ISOAL_SOURCES=2 # ISO Receptions -CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 CONFIG_BT_CTLR_ISOAL_SINKS=2 +CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 # Tx Power Dynamic Control CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y + +# Ignore HCI ISO data Tx sequence numbers +# CONFIG_BT_CTLR_ISOAL_PSN_IGNORE=y From 45fbc31a3f0065f0c5a54ab3cf8cd2d38afdc8a3 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Tue, 22 Oct 2024 13:34:47 +0200 Subject: [PATCH 1890/4482] modules: hal_nordic: Require nrf-regtool 7.0.0 Some upcoming changes require this version. Signed-off-by: Carles Cufi --- modules/hal_nordic/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hal_nordic/CMakeLists.txt b/modules/hal_nordic/CMakeLists.txt index a9384a0363343..9be36d4998d41 100644 --- a/modules/hal_nordic/CMakeLists.txt +++ b/modules/hal_nordic/CMakeLists.txt @@ -12,7 +12,7 @@ if(CONFIG_NRF_REGTOOL_GENERATE_UICR) list(APPEND nrf_regtool_components GENERATE:UICR) endif() if(DEFINED nrf_regtool_components) - find_package(nrf-regtool 5.6.0 REQUIRED + find_package(nrf-regtool 7.0.0 REQUIRED COMPONENTS ${nrf_regtool_components} PATHS ${CMAKE_CURRENT_LIST_DIR}/nrf-regtool NO_CMAKE_PATH From b5c53d6ac496f72133dd5b872580b2f802cae2ea Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Sun, 29 Sep 2024 17:42:15 -0300 Subject: [PATCH 1891/4482] wifi: esp32: move kconfig to driver area Make sure all kconfig related to Wi-Fi is in its driver area. This commit also removes esp_timer_init() call from Wi-Fi driver. Signed-off-by: Sylvio Alves --- drivers/wifi/esp32/Kconfig.esp32 | 94 ++++++++++++++++++++++++++- drivers/wifi/esp32/src/esp_wifi_drv.c | 2 - soc/espressif/common/Kconfig.wifi | 51 --------------- 3 files changed, 93 insertions(+), 54 deletions(-) delete mode 100644 soc/espressif/common/Kconfig.wifi diff --git a/drivers/wifi/esp32/Kconfig.esp32 b/drivers/wifi/esp32/Kconfig.esp32 index f6b37899a8ff2..6732bd5ff7eb8 100644 --- a/drivers/wifi/esp32/Kconfig.esp32 +++ b/drivers/wifi/esp32/Kconfig.esp32 @@ -175,6 +175,39 @@ config ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM than WiFi layer can transmit. In these cases, we may run out of TX buffers. +choice ESP32_WIFI_MGMT_RX_BUFFER + prompt "Type of WiFi RX MGMT buffers" + default ESP32_WIFI_STATIC_RX_MGMT_BUFFER + help + Select type of WiFi RX MGMT buffers: + + If "Static" is selected, WiFi RX MGMT buffers are allocated when WiFi is initialized and released + when WiFi is de-initialized. The size of each static RX MGMT buffer is fixed to about 500 Bytes. + + If "Dynamic" is selected, each WiFi RX MGMT buffer is allocated as needed when a MGMT data frame is + received. The MGMT buffer is freed after the MGMT data frame has been processed by the WiFi driver. + + config ESP32_WIFI_STATIC_RX_MGMT_BUFFER + bool "Static" + config ESP32_WIFI_DYNAMIC_RX_MGMT_BUFFER + bool "Dynamic" +endchoice + +config ESP32_WIFI_DYNAMIC_RX_MGMT_BUF + int + default 0 if ESP32_WIFI_STATIC_RX_MGMT_BUFFER + default 1 if ESP32_WIFI_DYNAMIC_RX_MGMT_BUFFER + +config ESP32_WIFI_RX_MGMT_BUF_NUM_DEF + int "Max number of WiFi RX MGMT buffers" + range 1 10 + default 5 + help + Set the number of WiFi RX_MGMT buffers. + + For Management buffers, the number of dynamic and static management buffers is the same. + In order to prevent memory fragmentation, the management buffer type should be set to static first. + config ESP32_WIFI_CSI_ENABLED bool "WiFi CSI(Channel State Information)" default n @@ -234,6 +267,13 @@ config ESP32_WIFI_AMSDU_TX_ENABLED help Select this option to enable AMSDU TX feature +config ESP32_WIFI_MGMT_SBUF_NUM + int "WiFi mgmt short buffer number" + range 6 32 + default 32 + help + Set the number of WiFi management short buffer. + config ESP32_WIFI_IRAM_OPT bool "WiFi IRAM speed optimization" default n if (BT && ESP_SPIRAM && SOC_SERIES_ESP32) @@ -251,10 +291,62 @@ config ESP32_WIFI_RX_IRAM_OPT When this option is disabled, more than 17Kbytes of IRAM memory will be saved but Wi-Fi performance will be reduced. +config ESP32_WIFI_MAX_THREAD_PRIORITY + int "Maximum work queue thread priority" + default 7 + help + Maximum priority of thread used for processing driver work queue items. + +config ESP32_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME + int "Minimum active time" + range 8 60 + default 50 + help + Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. When the station enters the active state, + it will work for at least ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME. If a data packet is received or sent + during this period, the time will be refreshed. If the time is up, but the station still has packets + to receive or send, the time will also be refreshed. unit: milliseconds. + +config ESP32_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME + int "Maximum keep alive time" + range 10 60 + default 10 + help + Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. If no packet has been + sent within ESP_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME, a null data packet will be sent + to maintain the connection with the AP. unit: seconds. + +config ESP32_WIFI_SLP_DEFAULT_WAIT_BROADCAST_DATA_TIME + int "Minimum wait broadcast data time" + range 10 30 + default 15 + help + Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. When the station knows through the beacon + that AP will send broadcast packet, it will wait for ESP_WIFI_SLP_DEFAULT_WAIT_BROADCAST_DATA_TIME + before entering the sleep process. If a broadcast packet is received with more data bits, the time + will refreshed. unit: milliseconds. + +choice ESP_WIFI_HEAP + prompt "Wifi adapter heap in use" + default ESP_WIFI_HEAP_RUNTIME + + config ESP_WIFI_HEAP_RUNTIME + bool "Wifi adapter use ESP runtime heap" + depends on ESP_HEAP_RUNTIME + + config ESP_WIFI_HEAP_SPIRAM + bool "Wifi adapter use SPIRAM heap" + depends on ESP_SPIRAM + + config ESP_WIFI_HEAP_SYSTEM + bool "Wifi adapter use system heap" + +endchoice # ESP_WIFI_HEAP + config ESP32_WIFI_FTM_ENABLE bool "WiFi FTM" default n - depends on SOC_SERIES_ESP32C2 || SOC_SERIES_ESP32C3 + depends on SOC_SERIES_ESP32C2 || SOC_SERIES_ESP32C3 || SOC_SERIES_ESP32C6 || SOC_SERIES_ESP32S2 || SOC_SERIES_ESP32S3 help Enable feature Fine Timing Measurement for calculating WiFi Round-Trip-Time (RTT). diff --git a/drivers/wifi/esp32/src/esp_wifi_drv.c b/drivers/wifi/esp32/src/esp_wifi_drv.c index fb8dd8577f095..56f8b92e51e2b 100644 --- a/drivers/wifi/esp32/src/esp_wifi_drv.c +++ b/drivers/wifi/esp32/src/esp_wifi_drv.c @@ -871,7 +871,6 @@ static int esp32_wifi_dev_init(const struct device *dev) adc2_init_code_calibration(); #endif /* CONFIG_SOC_SERIES_ESP32S2 || CONFIG_SOC_SERIES_ESP32C3 */ - esp_timer_init(); wifi_init_config_t config = WIFI_INIT_CONFIG_DEFAULT(); esp_err_t ret = esp_wifi_init(&config); @@ -883,7 +882,6 @@ static int esp32_wifi_dev_init(const struct device *dev) LOG_ERR("Unable to initialize the Wi-Fi: %d", ret); return -EIO; } - if (IS_ENABLED(CONFIG_ESP32_WIFI_STA_AUTO_DHCPV4)) { net_mgmt_init_event_callback(&esp32_dhcp_cb, wifi_event_handler, DHCPV4_MASK); net_mgmt_add_event_callback(&esp32_dhcp_cb); diff --git a/soc/espressif/common/Kconfig.wifi b/soc/espressif/common/Kconfig.wifi deleted file mode 100644 index a52cff4858388..0000000000000 --- a/soc/espressif/common/Kconfig.wifi +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. -# SPDX-License-Identifier: Apache-2.0 - -if SOC_FAMILY_ESPRESSIF_ESP32 - -menu "ESP32 Wi-Fi config" - -config ESP_WIFI_MAX_THREAD_PRIORITY - int "Maximum work queue thread priority" - default 7 - help - Maximum priority of thread used for processing driver work queue items. - -config ESP32_WIFI_TIMER_TASK_PRIO - int "Wi-Fi timer task priority" - default 2 - range 0 ESP_WIFI_MAX_THREAD_PRIORITY - - -config ESP32_PHY_MAX_WIFI_TX_POWER - int "Max Wi-Fi/BLE TX power (dBm)" - range 10 20 - default 20 - help - Set maximum transmit power for Wi-Fi radio. Actual transmit power for high - data rates may be lower than this setting. - -config ESP32_PHY_MAX_TX_POWER - int - default ESP32_PHY_MAX_WIFI_TX_POWER - -choice ESP_WIFI_HEAP - prompt "Wifi adapter heap in use" - default ESP_WIFI_HEAP_RUNTIME - - config ESP_WIFI_HEAP_RUNTIME - bool "Wifi adapter use ESP runtime heap" - depends on ESP_HEAP_RUNTIME - - config ESP_WIFI_HEAP_SPIRAM - bool "Wifi adapter use SPIRAM heap" - depends on ESP_SPIRAM - - config ESP_WIFI_HEAP_SYSTEM - bool "Wifi adapter use system heap" - -endchoice # ESP_WIFI_HEAP - -endmenu # ESP32 Wi-Fi config - -endif # SOC_FAMILY_ESPRESSIF_ESP32 From a70741bc82d70c80d6fd2d9a93316680ff30b354 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Sun, 29 Sep 2024 18:51:09 -0300 Subject: [PATCH 1892/4482] west.yml: update hal_espressif to latest version - Update GDMA and ADC drivers and remove deprecated entries. - Rebased hal_espressif to latest bump sync. - Added ESP Timer and Radio common config values Signed-off-by: Sylvio Alves --- drivers/adc/adc_esp32.c | 12 ++++++------ drivers/dma/dma_esp32_gdma.c | 4 ---- soc/espressif/common/Kconfig | 27 ++++++++++++++++++++++++++- soc/espressif/common/Kconfig.esptool | 2 +- west.yml | 2 +- 5 files changed, 34 insertions(+), 13 deletions(-) diff --git a/drivers/adc/adc_esp32.c b/drivers/adc/adc_esp32.c index 740719901b3e0..1740d96b0ccb0 100644 --- a/drivers/adc/adc_esp32.c +++ b/drivers/adc/adc_esp32.c @@ -41,7 +41,7 @@ LOG_MODULE_REGISTER(adc_esp32, CONFIG_ADC_LOG_LEVEL); * clip the value instead of yet another correction. The IDF implementation * for ESP32-S2 is doing it, so we copy that approach in Zephyr driver */ -#define ADC_CLIP_MVOLT_11DB 2550 +#define ADC_CLIP_MVOLT_12DB 2550 #elif CONFIG_SOC_SERIES_ESP32S3 #define ADC_CALI_SCHEME ESP_ADC_CAL_VAL_EFUSE_TP_FIT #else @@ -95,7 +95,7 @@ static inline int gain_to_atten(enum adc_gain gain, adc_atten_t *atten) *atten = ADC_ATTEN_DB_6; break; case ADC_GAIN_1_4: - *atten = ADC_ATTEN_DB_11; + *atten = ADC_ATTEN_DB_12; break; default: return -ENOTSUP; @@ -117,7 +117,7 @@ static void atten_to_gain(adc_atten_t atten, uint32_t *val_mv) case ADC_ATTEN_DB_6: *val_mv = *val_mv >> 1; /* 1/ADC_GAIN_1_2 */ break; - case ADC_ATTEN_DB_11: + case ADC_ATTEN_DB_12: *val_mv = *val_mv / 4; /* 1/ADC_GAIN_1_4 */ break; case ADC_ATTEN_DB_0: /* 1/ADC_GAIN_1 */ @@ -458,9 +458,9 @@ static int adc_esp32_read(const struct device *dev, const struct adc_sequence *s cal = cal_mv = esp_adc_cal_raw_to_voltage(reading, &data->chars[channel_id]); #if CONFIG_SOC_SERIES_ESP32 - if (data->attenuation[channel_id] == ADC_ATTEN_DB_11) { - if (cal > ADC_CLIP_MVOLT_11DB) { - cal = ADC_CLIP_MVOLT_11DB; + if (data->attenuation[channel_id] == ADC_ATTEN_DB_12) { + if (cal > ADC_CLIP_MVOLT_12DB) { + cal = ADC_CLIP_MVOLT_12DB; } } #endif /* CONFIG_SOC_SERIES_ESP32 */ diff --git a/drivers/dma/dma_esp32_gdma.c b/drivers/dma/dma_esp32_gdma.c index cc57f419efd65..7fb5da72b43b6 100644 --- a/drivers/dma/dma_esp32_gdma.c +++ b/drivers/dma/dma_esp32_gdma.c @@ -33,11 +33,7 @@ LOG_MODULE_REGISTER(dma_esp32_gdma, CONFIG_DMA_LOG_LEVEL); #define ISR_HANDLER intr_handler_t #endif -#if defined(CONFIG_SOC_SERIES_ESP32C6) -#define DMA_MAX_CHANNEL SOC_GDMA_PAIRS_PER_GROUP_MAX -#else #define DMA_MAX_CHANNEL SOC_GDMA_PAIRS_PER_GROUP -#endif #define ESP_DMA_M2M_ON 0 #define ESP_DMA_M2M_OFF 1 diff --git a/soc/espressif/common/Kconfig b/soc/espressif/common/Kconfig index 05ba9901f6ed4..ccb37c6fff78e 100644 --- a/soc/espressif/common/Kconfig +++ b/soc/espressif/common/Kconfig @@ -32,7 +32,32 @@ config ESP_HEAP_RUNTIME ending by a last memory location that can be safely accesed (depending on a boot mode). This is a memory pool used in runtime to create a new heap memory. +config ESP32_TIMER_TASK_STACK_SIZE + int "Stack size of the high resolution ESP Timer" + default 4096 + help + Set the stack size for the internal high resolution ESP Timer + used in Wi-Fi and BLE peripherals. + +config ESP32_TIMER_TASK_PRIO + int "Task priority of the high resolution ESP Timer" + default 3 + help + Set the task priority for the internal high resolution ESP Timer + used in Wi-Fi and BLE peripherals. + +if (BT_ESP32 || WIFI_ESP32) + +config ESP32_PHY_MAX_TX_POWER + int "Max Wi-Fi/BLE TX power (dBm)" + range 10 20 + default 20 + help + Set maximum transmit power for Wi-Fi radio. Actual transmit power for high + data rates may be lower than this setting. + +endif + rsource "Kconfig.spiram" rsource "Kconfig.esptool" rsource "Kconfig.flash" -rsource "Kconfig.wifi" diff --git a/soc/espressif/common/Kconfig.esptool b/soc/espressif/common/Kconfig.esptool index 5235a207f8423..b484437197156 100644 --- a/soc/espressif/common/Kconfig.esptool +++ b/soc/espressif/common/Kconfig.esptool @@ -114,7 +114,7 @@ endchoice # ESPTOOLPY_FLASHFREQ config ESPTOOLPY_FLASHFREQ_80M_DEFAULT bool - default y if SOC_SERIES_ESP32S2 || SOC_SERIES_ESP32S3 || SOC_SERIES_ESP32C3 + default y if SOC_SERIES_ESP32S2 || SOC_SERIES_ESP32S3 || SOC_SERIES_ESP32C3 || SOC_SERIES_ESP32C6 help This is an invisible item, used to define the targets that defaults to use 80MHz Flash SPI speed. diff --git a/west.yml b/west.yml index d3a1d5f531444..5d50af436004e 100644 --- a/west.yml +++ b/west.yml @@ -157,7 +157,7 @@ manifest: groups: - hal - name: hal_espressif - revision: 09676fc39bde2c38d6cd40912875cf78ee76126e + revision: 0f1874284f5dee0d49cb23f44f756e7be404e7b7 path: modules/hal/espressif west-commands: west/west-commands.yml groups: From 685c6e42b89c476940aff2962108f5e6ff0b3562 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Sun, 29 Sep 2024 18:53:16 -0300 Subject: [PATCH 1893/4482] driver: ble: add custom espressif kconfig Adds ESP32 custom configurations for BLE driver. Signed-off-by: Sylvio Alves --- drivers/bluetooth/hci/Kconfig.esp32 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/bluetooth/hci/Kconfig.esp32 b/drivers/bluetooth/hci/Kconfig.esp32 index cea379b046bbb..ad7a53d5de36b 100644 --- a/drivers/bluetooth/hci/Kconfig.esp32 +++ b/drivers/bluetooth/hci/Kconfig.esp32 @@ -1,5 +1,4 @@ -# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. -# SPDX-License-Identifier: Apache-2.0 +# Copyright 2024 Espressif Systems (Shanghai) PTE LTD if BT_ESP32 @@ -16,4 +15,12 @@ choice ESP_BT_HEAP endchoice # ESP_BT_HEAP -endif +config ESP32_BT_CONTROLLER_STACK_SIZE + int "Bluetooth controller stack size" + default 4096 + +config ESP32_BT_CONTROLLER_TASK_PRIO + int "Bluetooth controller task priority level" + default 2 + +endif # BT_ESP32 From 876a893018b64fe0cae1883e9e25528122b73efb Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Thu, 24 Oct 2024 19:34:48 -0300 Subject: [PATCH 1894/4482] soc: esp32: update linker files Add new wifi sections into iram area. Add new functions to iram area. Remove unused entries. Signed-off-by: Sylvio Alves --- soc/espressif/esp32/default.ld | 26 ++++++++++++++------------ soc/espressif/esp32/mcuboot.ld | 4 ---- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/soc/espressif/esp32/default.ld b/soc/espressif/esp32/default.ld index 593c895d61e94..86a25901d03be 100644 --- a/soc/espressif/esp32/default.ld +++ b/soc/espressif/esp32/default.ld @@ -285,16 +285,16 @@ SECTIONS *libc.a:*(.literal .text .literal.* .text.*) *libphy.a:( .phyiram .phyiram.*) *libgcov.a:(.literal .text .literal.* .text.*) - *libzephyr.a:spi_flash_rom_patch.*(.literal .text .literal.* .text.*) /* [mapping:esp_psram] */ *libzephyr.a:mmu_psram_flash.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_psram_impl_quad.*(.literal .literal.* .text .text.*) - *libzephyr.a:esp_psram_impl_octal.*(.literal .literal.* .text .text.*) /* [mapping:hal] */ *libzephyr.a:mmu_hal.*(.literal .literal.* .text .text.*) - *libzephyr.a:cache_hal.*(.literal .text .literal.* .text.*) + *libzephyr.a:cache_utils.*(.literal .text .literal.* .text.*) + *libzephyr.a:cache_esp32.*(.literal .text .literal.* .text.*) + *libzephyr.a:cache_hal_esp32.*(.literal .text .literal.* .text.*) *libzephyr.a:ledc_hal_iram.*(.literal .literal.* .text .text.*) *libzephyr.a:i2c_hal_iram.*(.literal .literal.* .text .text.*) *libzephyr.a:wdt_hal_iram.*(.literal .literal.* .text .text.*) @@ -325,7 +325,7 @@ SECTIONS *libzephyr.a:flash_brownout_hook.*(.literal .literal.* .text .text.*) *libzephyr.a:spi_flash_wrap.*(.literal .literal.* .text .text.*) *libzephyr.a:spi_flash_hpm_enable.*(.literal .literal.* .text .text.*) - *libzephyr.a:spi_flash_oct_flash_init*(.literal .literal.* .text .text.*) + *libzephyr.a:flash_ops.*(.literal .literal.* .text .text.*) /* [mapping:esp_system] */ *libzephyr.a:esp_err.*(.literal .literal.* .text .text.*) @@ -366,6 +366,7 @@ SECTIONS *libzephyr.a:esp_rom_spiflash.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_rom_systimer.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_rom_wdt.*(.literal .literal.* .text .text.*) + *libzephyr.a:esp_rom_efuse.*(.literal .literal.* .text .text.*) /* [mapping:esp_mm] */ *libzephyr.a:esp_cache.*(.literal .literal.* .text .text.*) @@ -376,8 +377,8 @@ SECTIONS *libzephyr.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable) #if defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.* .wifiextrairam .wifiextrairam.*) /* [mapping:esp_wifi] */ *(.literal.wifi_clock_enable_wrapper .text.wifi_clock_enable_wrapper) @@ -520,20 +521,20 @@ SECTIONS *libzephyr.a:log_output.*(.rodata .rodata.*) *libzephyr.a:loader.*(.rodata .rodata.*) *libdrivers__flash.a:flash_esp32.*(.rodata .rodata.*) - *libzephyr.a:spi_flash_rom_patch.*(.rodata .rodata.*) *libdrivers__serial.a:uart_esp32.*(.rodata .rodata.*) *libzephyr.a:esp_memory_utils.*(.rodata .rodata.* .sdata2 .sdata2.* .srodata .srodata.*) /* [mapping:esp_psram] */ *libzephyr.a:mmu_psram_flash.*(.rodata .rodata.*) - *libzephyr.a:esp_psram_impl_octal.*(.rodata .rodata.*) *libzephyr.a:esp_psram_impl_quad.*(.rodata .rodata.*) /* [mapping:hal] */ *libzephyr.a:mmu_hal.*(.rodata .rodata.*) *libzephyr.a:spi_flash_hal_iram.*(.rodata .rodata.*) *libzephyr.a:spi_flash_encrypt_hal_iram.*(.rodata .rodata.*) - *libzephyr.a:cache_hal.*(.rodata .rodata.*) + *libzephyr.a:cache_utils.*(.rodata .rodata.*) + *libzephyr.a:cache_esp32.*(.rodata .rodata.*) + *libzephyr.a:cache_hal_esp32.*(.rodata .rodata.*) *libzephyr.a:ledc_hal_iram.*(.rodata .rodata.*) *libzephyr.a:i2c_hal_iram.*(.rodata .rodata.*) *libzephyr.a:wdt_hal_iram.*(.rodata .rodata.*) @@ -564,7 +565,7 @@ SECTIONS *libzephyr.a:flash_brownout_hook.*(.rodata .rodata.*) *libzephyr.a:spi_flash_wrap.*(.rodata .rodata.*) *libzephyr.a:spi_flash_hpm_enable.*(.rodata .rodata.*) - *libzephyr.a:spi_flash_oct_flash_init.*(.rodata .rodata.*) + *libzephyr.a:flash_ops.*(.rodata .rodata.* .sdata2 .sdata2.* .srodata .srodata.*) /* [mapping:esp_mm] */ *libzephyr.a:esp_cache.*(.rodata .rodata.*) @@ -609,6 +610,7 @@ SECTIONS *libzephyr.a:esp_rom_spiflash.*(.rodata .rodata.* .sdata2 .sdata2.* .srodata .srodata.*) *libzephyr.a:esp_rom_systimer.*(.rodata .rodata.*) *libzephyr.a:esp_rom_wdt.*(.rodata .rodata.*) + *libzephyr.a:esp_rom_efuse.*(.rodata .rodata.*) KEEP(*(.jcr)) *(.dram1 .dram1.*) @@ -855,8 +857,8 @@ SECTIONS __rom_region_start = ABSOLUTE(.); #ifndef CONFIG_ESP32_WIFI_IRAM_OPT - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.* .wifiextrairam .wifiextrairam.*) #endif #ifndef CONFIG_ESP32_WIFI_RX_IRAM_OPT diff --git a/soc/espressif/esp32/mcuboot.ld b/soc/espressif/esp32/mcuboot.ld index 8fb1c25decc71..b880e2c7b34ea 100644 --- a/soc/espressif/esp32/mcuboot.ld +++ b/soc/espressif/esp32/mcuboot.ld @@ -54,7 +54,6 @@ SECTIONS *libzephyr.a:cbprintf_nano.*(.literal .text .literal.* .text.*) *libzephyr.a:cpu.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) - *libzephyr.a:cache_esp32.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_map.*(.literal .text .literal.* .text.*) *libzephyr.a:esp_rom_spiflash.*(.literal .text .literal.* .text.*) @@ -65,9 +64,6 @@ SECTIONS *libkernel.a:device.*(.literal .text .literal.* .text.*) *libkernel.a:timeout.*(.literal .text .literal.* .text.*) - *(.literal.bootloader_mmap .text.bootloader_mmap) - *(.literal.bootloader_munmap .text.bootloader_munmap) - *libzephyr.a:esp_loader.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) From 412921b59438ee48625b5dd951d20825ac73a425 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Thu, 24 Oct 2024 19:36:00 -0300 Subject: [PATCH 1895/4482] soc: esp32c2: update linker files Add new wifi sections into iram area. Add new functions to iram area. Remove unused entries. Signed-off-by: Sylvio Alves --- soc/espressif/esp32c2/default.ld | 10 ++++------ soc/espressif/esp32c2/mcuboot.ld | 4 ---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/soc/espressif/esp32c2/default.ld b/soc/espressif/esp32c2/default.ld index 1b6ec0e6377b2..1805d45a47230 100644 --- a/soc/espressif/esp32c2/default.ld +++ b/soc/espressif/esp32c2/default.ld @@ -178,7 +178,6 @@ SECTIONS *libkernel.a:(.literal .text .literal.* .text.*) *libgcc.a:lib2funcs.*(.literal .text .literal.* .text.*) *libdrivers__flash.a:flash_esp32.*(.literal .text .literal.* .text.*) - *libzephyr.a:spi_flash_rom_patch.*(.literal .text .literal.* .text.*) *libzephyr.a:log_noos.*(.literal .text .literal.* .text.*) *libdrivers__timer.a:esp32c2_sys_timer.*(.literal .text .literal.* .text.*) *libzephyr.a:log_core.*(.literal .text .literal.* .text.*) @@ -276,8 +275,8 @@ SECTIONS *libzephyr.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable) #if defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) *libcoexist.a:(.wifi_slp_iram .wifi_slp_iram.*) /* [mapping:esp_wifi] */ @@ -421,7 +420,6 @@ SECTIONS *libzephyr.a:log_output.*(.rodata .rodata.* .srodata .srodata.*) *libdrivers__flash.a:flash_esp32.*(.rodata .rodata.* .srodata .srodata.*) *libdrivers__serial.a:uart_esp32.*(.rodata .rodata.* .srodata .srodata.*) - *libzephyr.a:spi_flash_rom_patch.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:periph_ctrl.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:loader.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:cache_utils.*(.rodata .rodata.* .srodata .srodata.*) @@ -616,8 +614,8 @@ SECTIONS __rom_region_start = ABSOLUTE(.); #if !defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) #endif /* CONFIG_ESP32_WIFI_IRAM_OPT */ #if !defined(CONFIG_ESP32_WIFI_RX_IRAM_OPT) diff --git a/soc/espressif/esp32c2/mcuboot.ld b/soc/espressif/esp32c2/mcuboot.ld index 9bbbad889a51b..54aff6076c4b2 100644 --- a/soc/espressif/esp32c2/mcuboot.ld +++ b/soc/espressif/esp32c2/mcuboot.ld @@ -50,7 +50,6 @@ SECTIONS *libzephyr.a:cbprintf_nano.*(.literal .text .literal.* .text.*) *libzephyr.a:cpu.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) - *libzephyr.a:cache_hal.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_map.*(.literal .text .literal.* .text.*) *libzephyr.a:esp_rom_spiflash.*(.literal .text .literal.* .text.*) @@ -59,9 +58,6 @@ SECTIONS *libkernel.a:kheap.*(.literal .text .literal.* .text.*) *libkernel.a:mempool.*(.literal .text .literal.* .text.*) - *(.literal.bootloader_mmap .text.bootloader_mmap) - *(.literal.bootloader_munmap .text.bootloader_munmap) - *libzephyr.a:esp_loader.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) From be9574e48266552090881f206bdf58d05532d4ea Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Thu, 24 Oct 2024 19:36:25 -0300 Subject: [PATCH 1896/4482] soc: esp32c3: update linker files Add new wifi sections into iram area. Add new functions to iram area. Remove unused entries. Signed-off-by: Sylvio Alves --- soc/espressif/esp32c3/default.ld | 17 ++++++----------- soc/espressif/esp32c3/mcuboot.ld | 4 ---- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/soc/espressif/esp32c3/default.ld b/soc/espressif/esp32c3/default.ld index 042e206836627..50f41b6cd997d 100644 --- a/soc/espressif/esp32c3/default.ld +++ b/soc/espressif/esp32c3/default.ld @@ -238,7 +238,6 @@ SECTIONS *libkernel.a:(.literal .text .literal.* .text.*) *libgcc.a:lib2funcs.*(.literal .text .literal.* .text.*) *libdrivers__flash.a:flash_esp32.*(.literal .text .literal.* .text.*) - *libzephyr.a:spi_flash_rom_patch.*(.literal .text .literal.* .text.*) *libzephyr.a:log_noos.*(.literal .text .literal.* .text.*) *libdrivers__timer.a:esp32c3_sys_timer.*(.literal .text .literal.* .text.*) *libzephyr.a:log_core.*(.literal .text .literal.* .text.*) @@ -293,7 +292,7 @@ SECTIONS *libzephyr.a:flash_brownout_hook.*(.literal .literal.* .text .text.*) *libzephyr.a:spi_flash_wrap.*(.literal .literal.* .text .text.*) *libzephyr.a:spi_flash_hpm_enable.*(.literal .literal.* .text .text.*) - *libzephyr.a:spi_flash_oct_flash_init*(.literal .literal.* .text .text.*) + *libzephyr.a:flash_ops.*(.literal .text .literal.* .text.*) /* [mapping:esp_system] */ *libzephyr.a:esp_err.*(.literal .literal.* .text .text.*) @@ -336,8 +335,8 @@ SECTIONS *libzephyr.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable) #if defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) *libcoexist.a:(.wifi_slp_iram .wifi_slp_iram.*) /* [mapping:esp_wifi] */ @@ -381,8 +380,6 @@ SECTIONS *libzephyr.a:bootloader_console.*(.literal .text .literal.* .text.*) *libzephyr.a:esp_image_format.*(.literal .text .literal.* .text.*) - *libzephyr.a:flash_ops.*(.literal .text .literal.* .text.*) - *libzephyr.a:flash_ops_esp32c3.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_encrypt.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_encryption_secure_features.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_partitions.*(.literal .text .literal.* .text.*) @@ -481,7 +478,6 @@ SECTIONS *libzephyr.a:log_output.*(.rodata .rodata.* .srodata .srodata.*) *libdrivers__flash.a:flash_esp32.*(.rodata .rodata.* .srodata .srodata.*) *libdrivers__serial.a:uart_esp32.*(.rodata .rodata.* .srodata .srodata.*) - *libzephyr.a:spi_flash_rom_patch.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:periph_ctrl.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:loader.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:cache_utils.*(.rodata .rodata.* .srodata .srodata.*) @@ -521,7 +517,7 @@ SECTIONS *libzephyr.a:flash_brownout_hook.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:spi_flash_wrap.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:spi_flash_hpm_enable.*(.rodata .rodata.* .srodata .srodata.*) - *libzephyr.a:spi_flash_oct_flash_init.*(.rodata .rodata.* .srodata .srodata.*) + *libzephyr.a:flash_ops.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:flash_qio_mode.*(.rodata .rodata.* .srodata .srodata.*) /* [mapping:esp_mm] */ @@ -580,7 +576,6 @@ SECTIONS *libzephyr.a:esp_clk.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:flash_mmap.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:flash_ops.*(.rodata .rodata.* .srodata .srodata.*) - *libzephyr.a:flash_ops_esp32c3.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:esp_gpio_reserve.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:spi_flash_hal.*(.rodata .rodata.* .srodata .srodata.*) @@ -682,8 +677,8 @@ SECTIONS __rom_region_start = ABSOLUTE(.); #if !defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) #endif /* CONFIG_ESP32_WIFI_IRAM_OPT */ #if !defined(CONFIG_ESP32_WIFI_RX_IRAM_OPT) diff --git a/soc/espressif/esp32c3/mcuboot.ld b/soc/espressif/esp32c3/mcuboot.ld index 44f075893e5a2..cbc727faf0bef 100644 --- a/soc/espressif/esp32c3/mcuboot.ld +++ b/soc/espressif/esp32c3/mcuboot.ld @@ -50,7 +50,6 @@ SECTIONS *libzephyr.a:cbprintf_nano.*(.literal .text .literal.* .text.*) *libzephyr.a:cpu.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) - *libzephyr.a:cache_hal.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_map.*(.literal .text .literal.* .text.*) *libzephyr.a:esp_rom_spiflash.*(.literal .text .literal.* .text.*) @@ -59,9 +58,6 @@ SECTIONS *libkernel.a:kheap.*(.literal .text .literal.* .text.*) *libkernel.a:mempool.*(.literal .text .literal.* .text.*) - *(.literal.bootloader_mmap .text.bootloader_mmap) - *(.literal.bootloader_munmap .text.bootloader_munmap) - *libzephyr.a:esp_loader.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) From a1a6e8a1a37a6d08a3214b2701f216177a46981d Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Thu, 24 Oct 2024 19:37:12 -0300 Subject: [PATCH 1897/4482] soc: esp32c6: update linker files Add new wifi sections into iram area. Add new functions to iram area. Remove unused entries. Signed-off-by: Sylvio Alves --- soc/espressif/esp32c6/Kconfig | 12 ---- soc/espressif/esp32c6/default.ld | 111 ++++++++++++++++++++++--------- soc/espressif/esp32c6/mcuboot.ld | 4 -- 3 files changed, 81 insertions(+), 46 deletions(-) diff --git a/soc/espressif/esp32c6/Kconfig b/soc/espressif/esp32c6/Kconfig index 7c5c00e4777d2..88963c36cd8d7 100644 --- a/soc/espressif/esp32c6/Kconfig +++ b/soc/espressif/esp32c6/Kconfig @@ -18,18 +18,6 @@ config SOC_SERIES_ESP32C6 if SOC_SERIES_ESP32C6 -config ESP32_PHY_MAX_WIFI_TX_POWER - int "Max WiFi TX power (dBm)" - range 10 20 - default 20 - help - Set maximum transmit power for WiFi radio. Actual transmit power for high - data rates may be lower than this setting. - -config ESP32_PHY_MAX_TX_POWER - int - default ESP32_PHY_MAX_WIFI_TX_POWER - config MAC_BB_PD bool "Power down MAC and baseband of Wi-Fi and Bluetooth when PHY is disabled" depends on SOC_SERIES_ESP32C6 && TICKLESS_KERNEL diff --git a/soc/espressif/esp32c6/default.ld b/soc/espressif/esp32c6/default.ld index 514c7ef058b11..9cd69db8e3a4b 100644 --- a/soc/espressif/esp32c6/default.ld +++ b/soc/espressif/esp32c6/default.ld @@ -68,9 +68,9 @@ MEMORY mmap0_0_seg (R): org = CACHED_ORG, len = CACHED_SIZE lp_ram_seg(RW): org = LPSRAM_IRAM_START, - len = 0x4000 - RESERVE_RTC_MEM + len = 0x2000 - RESERVE_RTC_MEM - lp_reserved_seg(RW) : org = LPSRAM_IRAM_START + 0x4000 - RESERVE_RTC_MEM, + lp_reserved_seg(RW) : org = LPSRAM_IRAM_START + 0x2000 - RESERVE_RTC_MEM, len = RESERVE_RTC_MEM #ifdef CONFIG_GEN_ISR_TABLES @@ -145,35 +145,65 @@ SECTIONS .rtc.text : { . = ALIGN(4); + _rtc_fast_start = ABSOLUTE(.); + _rtc_text_start = ABSOLUTE(.); + *(.rtc.entry.text) *(.rtc.literal .rtc.text) *rtc_wake_stub*.o(.literal .text .literal.* .text.*) + . = ALIGN(4); + + _rtc_text_end = ABSOLUTE(.); } GROUP_DATA_LINK_IN(rtc_iram_seg, ROMABLE_REGION) - /* This section is required to skip rtc.text area because the text and - * data segments reflect the same address space on different buses. + /* This section located in RTC FAST Memory area. + * It holds data marked with RTC_FAST_ATTR attribute. + * See the file "esp_attr.h" for more information. */ - .rtc.dummy (NOLOAD): + .rtc.force_fast : { - . = SIZEOF(.rtc.text); - } GROUP_LINK_IN(rtc_iram_seg) + . = ALIGN(4); + _rtc_force_fast_start = ABSOLUTE(.); + + *(.rtc.force_fast .rtc.force_fast.*) + . = ALIGN(4) ; + _rtc_force_fast_end = ABSOLUTE(.); + } GROUP_DATA_LINK_IN(rtc_data_seg, ROMABLE_REGION) + /* RTC data section holds data marked with + * RTC_DATA_ATTR, RTC_RODATA_ATTR attributes. + */ .rtc.data : { _rtc_data_start = ABSOLUTE(.); *(.rtc.data) *(.rtc.rodata) - *rtc_wake_stub*.o(.data .rodata .data.* .rodata.* .bss .bss.*) _rtc_data_end = ABSOLUTE(.); } GROUP_DATA_LINK_IN(rtc_iram_seg, ROMABLE_REGION) .rtc.bss (NOLOAD) : { _rtc_bss_start = ABSOLUTE(.); - *rtc_wake_stub*.o(.bss .bss.*) - *rtc_wake_stub*.o(COMMON) + + *(.rtc.data) + *(.rtc.rodata) + _rtc_bss_end = ABSOLUTE(.); } GROUP_LINK_IN(rtc_iram_seg) + /* This section holds data that should not be initialized at power up + * and will be retained during deep sleep. + * User data marked with RTC_NOINIT_ATTR will be placed + * into this section. See the file "esp_attr.h" for more information. + */ + .rtc_noinit (NOLOAD): + { + . = ALIGN(4); + _rtc_noinit_start = ABSOLUTE(.); + *(.rtc_noinit .rtc_noinit.*) + . = ALIGN(4) ; + _rtc_noinit_end = ABSOLUTE(.); + } GROUP_LINK_IN(rtc_slow_seg) + /* This section located in RTC SLOW Memory area. * It holds data marked with RTC_SLOW_ATTR attribute. * See the file "esp_attr.h" for more information. @@ -183,12 +213,33 @@ SECTIONS . = ALIGN(4); _rtc_force_slow_start = ABSOLUTE(.); *(.rtc.force_slow .rtc.force_slow.*) - . = ALIGN(4) ; + . = ALIGN(4); _rtc_force_slow_end = ABSOLUTE(.); - } > rtc_slow_seg + } GROUP_DATA_LINK_IN(rtc_slow_seg, ROMABLE_REGION) + + /** + * This section holds RTC data that should have fixed addresses. + * The data are not initialized at power-up and are retained during deep sleep. + */ + .rtc_reserved (NOLOAD): + { + . = ALIGN(4); + _rtc_reserved_start = ABSOLUTE(.); + /* New data can only be added here to ensure existing data are not moved. + Because data have adhered to the end of the segment and code is relied on it. + >> put new data here << */ + + *(.rtc_timer_data_in_rtc_mem .rtc_timer_data_in_rtc_mem.*) + KEEP(*(.bootloader_data_rtc_mem .bootloader_data_rtc_mem.*)) + _rtc_reserved_end = ABSOLUTE(.); + } GROUP_LINK_IN(rtc_reserved_seg) - /* Get size of rtc slow data */ + /* Get size of rtc slow data based on rtc_data_location alias */ _rtc_slow_length = (_rtc_force_slow_end - _rtc_data_start); + _rtc_fast_length = (_rtc_force_fast_end - _rtc_fast_start); + + ASSERT((_rtc_slow_length <= LENGTH(rtc_slow_seg)), "RTC_SLOW segment data does not fit.") + ASSERT((_rtc_fast_length <= LENGTH(rtc_data_seg)), "RTC_FAST segment data does not fit.") /* --- END OF RTC --- */ @@ -229,7 +280,6 @@ SECTIONS *libkernel.a:(.literal .text .literal.* .text.*) *libgcc.a:lib2funcs.*(.literal .text .literal.* .text.*) *libdrivers__flash.a:flash_esp32.*(.literal .text .literal.* .text.*) - *libzephyr.a:spi_flash_rom_patch.*(.literal .text .literal.* .text.*) *libzephyr.a:log_noos.*(.literal .text .literal.* .text.*) *libdrivers__timer.a:esp32c6_sys_timer.*(.literal .text .literal.* .text.*) *libzephyr.a:log_core.*(.literal .text .literal.* .text.*) @@ -259,6 +309,8 @@ SECTIONS *libzephyr.a:wdt_hal_iram.*(.literal .text .literal.* .text.*) *libzephyr.a:systimer_hal.*(.literal .text .literal.* .text.*) *libzephyr.a:spi_flash_hal_gpspi.*(.literal .literal.* .text .text.*) + *libzephyr.a:modem_clock_hal.*(.literal .literal.* .text .text.*) + *libzephyr.a:modem_clock.*(.literal .literal.* .text .text.*) /* [mapping:soc] */ *libzephyr.a:lldesc.*(.literal .literal.* .text .text.*) @@ -284,7 +336,7 @@ SECTIONS *libzephyr.a:flash_brownout_hook.*(.literal .literal.* .text .text.*) *libzephyr.a:spi_flash_wrap.*(.literal .literal.* .text .text.*) *libzephyr.a:spi_flash_hpm_enable.*(.literal .literal.* .text .text.*) - *libzephyr.a:spi_flash_oct_flash_init*(.literal .literal.* .text .text.*) + *libzephyr.a:flash_ops.*(.literal .literal.* .text .text.*) /* [mapping:esp_system] */ *libzephyr.a:reset_reason.*(.literal .literal.* .text .text.*) @@ -303,6 +355,7 @@ SECTIONS *(.literal.rtc_vddsdio_set_config .text.rtc_vddsdio_set_config) *libzephyr.a:esp_memory_utils.*(.literal .literal.* .text .text.*) *libzephyr.a:pmu_init.*(.literal .literal.* .text .text.*) + *libzephyr.a:pmu_param.*(.literal .literal.* .text .text.*) *libzephyr.a:rtc_clk.*(.literal .literal.* .text .text.*) *libzephyr.a:rtc_clk_init.*(.literal .literal.* .text .text.*) *libzephyr.a:rtc_time.*(.literal .literal.* .text .text.*) @@ -316,17 +369,14 @@ SECTIONS *(.literal.GPIO_HOLD_MASK .text.GPIO_HOLD_MASK) /* [mapping:esp_rom] */ - *libzephyr.a:esp_rom_spiflash.*(.literal .literal.* .text .text.*) - *libzephyr.a:esp_rom_systimer.*(.literal .literal.* .text .text.*) - *libzephyr.a:esp_rom_wdt.*(.literal .literal.* .text .text.*) - *libzephyr.a:esp_rom_crc.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_rom_sys.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_rom_uart.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_rom_spiflash.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_rom_efuse.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_rom_systimer.*(.literal .literal.* .text .text.*) - *libzephyr.a:esp_rom_regi2c_esp32c6.*(.literal .literal.* .text .text.*) + *libzephyr.a:esp_rom_wdt.*(.literal .literal.* .text .text.*) + *libzephyr.a:esp_rom_hp_regi2c_esp32c6.*(.literal .literal.* .text .text.*) *libzephyr.a:efuse_hal.*(.literal .literal.* .text .text.*) /* [mapping:esp_mm] */ @@ -338,9 +388,8 @@ SECTIONS *libzephyr.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable) #if defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libcoexist.a:(.wifi_slp_iram .wifi_slp_iram.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) /* [mapping:esp_wifi] */ *(.literal.wifi_clock_enable_wrapper .text.wifi_clock_enable_wrapper) @@ -383,7 +432,6 @@ SECTIONS *libzephyr.a:esp_image_format.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_ops.*(.literal .text .literal.* .text.*) - *libzephyr.a:flash_ops_esp32c6.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_encrypt.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_encryption_secure_features.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_partitions.*(.literal .text .literal.* .text.*) @@ -402,6 +450,8 @@ SECTIONS *libzephyr.a:secure_boot_secure_features.*(.literal .text .literal.* .text.*) *libzephyr.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*) + *libzephyr.a:regi2c_ctrl.*(.literal .text .literal.* .text.*) + *libzephyr.a:cpu_region_protect.*(.literal .text .literal.* .text.*) /* TODO: optimise */ @@ -474,7 +524,6 @@ SECTIONS *libzephyr.a:log_output.*(.rodata .rodata.* .srodata .srodata.*) *libdrivers__flash.a:flash_esp32.*(.rodata .rodata.* .srodata .srodata.*) *libdrivers__serial.a:uart_esp32.*(.rodata .rodata.* .srodata .srodata.*) - *libzephyr.a:spi_flash_rom_patch.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:periph_ctrl.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:loader.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:cache_utils.*(.rodata .rodata.* .srodata .srodata.*) @@ -489,6 +538,8 @@ SECTIONS *libzephyr.a:wdt_hal_iram.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:systimer_hal.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:spi_flash_hal_gpspi.*(.rodata .rodata.* .srodata .srodata.*) + *libzephyr.a:modem_clock_hal.*(.rodata .rodata.* .srodata .srodata.*) + *libzephyr.a:modem_clock.*(.rodata .rodata.* .srodata .srodata.*) /* [mapping:soc] */ *libzephyr.a:lldesc.*(.rodata .rodata.* .srodata .srodata.*) @@ -514,7 +565,7 @@ SECTIONS *libzephyr.a:flash_brownout_hook.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:spi_flash_wrap.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:spi_flash_hpm_enable.*(.rodata .rodata.* .srodata .srodata.*) - *libzephyr.a:spi_flash_oct_flash_init.*(.rodata .rodata.* .srodata .srodata.*) + *libzephyr.a:flash_ops.*(.rodata .rodata.* .sdata2 .sdata2.* .srodata .srodata.*) *libzephyr.a:flash_qio_mode.*(.rodata .rodata.* .srodata .srodata.*) /* [mapping:esp_mm] */ @@ -538,6 +589,7 @@ SECTIONS *libzephyr.a:mspi_timing_tuning.*(.rodata .rodata.* .srodata .srodata.*) *(.rodata.sar_periph_ctrl_power_enable) *libzephyr.a:pmu_init.*(.rodata .rodata.* .srodata .srodata.*) + *libzephyr.a:pmu_param.*(.rodata .rodata.* .srodata .srodata.*) /* [mapping:esp_system] */ *libzephyr.a:reset_reason.*(.rodata .rodata.*) @@ -551,7 +603,7 @@ SECTIONS *libzephyr.a:esp_rom_spiflash.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:esp_rom_efuse.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:esp_rom_systimer.*(.rodata .rodata.* .srodata .srodata.*) - *libzephyr.a:esp_rom_regi2c_esp32c6.*(.rodata .rodata.* .srodata .srodata.*) + *libzephyr.a:esp_rom_hp_regi2c_esp32c6.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:efuse_hal.*(.rodata .rodata.* .srodata .srodata.*) . = ALIGN(4); @@ -585,7 +637,6 @@ SECTIONS *libzephyr.a:esp_clk.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:flash_mmap.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:flash_ops.*(.rodata .rodata.* .srodata .srodata.*) - *libzephyr.a:flash_ops_esp32c6.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:esp_gpio_reserve.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:spi_flash_hal.*(.rodata .rodata.* .srodata .srodata.*) @@ -686,8 +737,8 @@ SECTIONS __rom_region_start = ABSOLUTE(.); #if !defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) #endif /* CONFIG_ESP32_WIFI_IRAM_OPT */ #if !defined(CONFIG_ESP32_WIFI_RX_IRAM_OPT) diff --git a/soc/espressif/esp32c6/mcuboot.ld b/soc/espressif/esp32c6/mcuboot.ld index a96d80471acfd..8c76315ffe331 100644 --- a/soc/espressif/esp32c6/mcuboot.ld +++ b/soc/espressif/esp32c6/mcuboot.ld @@ -48,7 +48,6 @@ SECTIONS *libzephyr.a:cbprintf_nano.*(.literal .text .literal.* .text.*) *libzephyr.a:cpu.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) - *libzephyr.a:cache_hal.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_map.*(.literal .text .literal.* .text.*) *libzephyr.a:esp_rom_spiflash.*(.literal .text .literal.* .text.*) @@ -57,9 +56,6 @@ SECTIONS *libkernel.a:kheap.*(.literal .text .literal.* .text.*) *libkernel.a:mempool.*(.literal .text .literal.* .text.*) - *(.literal.bootloader_mmap .text.bootloader_mmap) - *(.literal.bootloader_munmap .text.bootloader_munmap) - *libzephyr.a:esp_loader.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) From 279f4b8aecdbaf50964b206d5d7b20f04a5276ed Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Thu, 24 Oct 2024 19:37:55 -0300 Subject: [PATCH 1898/4482] soc: esp32s2: update linker files Add new wifi sections into iram area. Add new functions to iram area. Remove unused entries. Signed-off-by: Sylvio Alves --- soc/espressif/esp32s2/default.ld | 12 ++++++++---- soc/espressif/esp32s2/mcuboot.ld | 3 --- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/soc/espressif/esp32s2/default.ld b/soc/espressif/esp32s2/default.ld index f79ea789a0829..f3dfcac501551 100644 --- a/soc/espressif/esp32s2/default.ld +++ b/soc/espressif/esp32s2/default.ld @@ -362,6 +362,7 @@ SECTIONS /* [mapping:hal] */ *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) *libzephyr.a:cache_hal.*(.literal .text .literal.* .text.*) + *libzephyr.a:cache_utils.*(.literal .text .literal.* .text.*) *libzephyr.a:ledc_hal_iram.*(.literal .text .literal.* .text.*) *libzephyr.a:i2c_hal_iram.*(.literal .text .literal.* .text.*) *libzephyr.a:wdt_hal_iram.*(.literal .text .literal.* .text.*) @@ -395,6 +396,7 @@ SECTIONS *libzephyr.a:spi_flash_wrap.*(.literal .literal.* .text .text.*) *libzephyr.a:spi_flash_hpm_enable.*(.literal .literal.* .text .text.*) *libzephyr.a:spi_flash_oct_flash_init*(.literal .literal.* .text .text.*) + *libzephyr.a:flash_ops.*(.literal .literal.* .text .text.*) /* [mapping:esp_system] */ *libzephyr.a:esp_err.*(.literal .literal.* .text .text.*) @@ -438,8 +440,8 @@ SECTIONS *libzephyr.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable) #if defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:(.wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:(.wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.*) + *libnet80211.a:(.wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:(.wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.* .wifiextrairam .wifiextrairam.*) *libcoexist.a:(.wifi_slp_iram .wifi_slp_iram.*) /* [mapping:esp_wifi] */ @@ -603,6 +605,7 @@ SECTIONS *libzephyr.a:spi_flash_hal_iram.*(.rodata .rodata.*) *libzephyr.a:spi_flash_encrypt_hal_iram.*(.rodata .rodata.*) *libzephyr.a:cache_hal.*(.rodata .rodata.*) + *libzephyr.a:cache_utils.*(.rodata .rodata.*) *libzephyr.a:ledc_hal_iram.*(.rodata .rodata.*) *libzephyr.a:i2c_hal_iram.*(.rodata .rodata.*) *libzephyr.a:wdt_hal_iram.*(.rodata .rodata.*) @@ -634,6 +637,7 @@ SECTIONS *libzephyr.a:spi_flash_wrap.*(.rodata .rodata.*) *libzephyr.a:spi_flash_hpm_enable.*(.rodata .rodata.*) *libzephyr.a:spi_flash_oct_flash_init.*(.rodata .rodata.*) + *libzephyr.a:flash_ops.*(.rodata .rodata.* .sdata2 .sdata2.* .srodata .srodata.*) *libzephyr.a:flash_qio_mode.*(.rodata .rodata.*) /* [mapping:esp_mm] */ @@ -833,8 +837,8 @@ SECTIONS __rom_region_start = ABSOLUTE(.); #if !defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.* .wifiextrairam .wifiextrairam.*) #endif diff --git a/soc/espressif/esp32s2/mcuboot.ld b/soc/espressif/esp32s2/mcuboot.ld index 23a15b858b50e..bf14afeb6a3e8 100644 --- a/soc/espressif/esp32s2/mcuboot.ld +++ b/soc/espressif/esp32s2/mcuboot.ld @@ -54,7 +54,6 @@ SECTIONS *libzephyr.a:cbprintf_nano.*(.literal .text .literal.* .text.*) *libzephyr.a:cpu.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) - *libzephyr.a:cache_hal.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_map.*(.literal .text .literal.* .text.*) *libzephyr.a:esp_rom_spiflash.*(.literal .text .literal.* .text.*) *libzephyr.a:heap.*(.literal .text .literal.* .text.*) @@ -68,8 +67,6 @@ SECTIONS *libzephyr.a:rtc_clk.*(.literal .literal.* .text .text.*) *libzephyr.a:rtc_clk_init.*(.literal .literal.* .text .text.*) - *(.literal.bootloader_mmap .text.bootloader_mmap) - *(.literal.bootloader_munmap .text.bootloader_munmap) *(.literal.esp_intr_disable .literal.esp_intr_disable.* .text.esp_intr_disable .text.esp_intr_disable.*) *(.literal.default_intr_handler .text.default_intr_handler .iram1.*.default_intr_handler) *(.literal.esp_log_timestamp .text.esp_log_timestamp) From 05b462a907331217a3e04c3f51be50dc15a2e20b Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Fri, 25 Oct 2024 09:11:43 -0300 Subject: [PATCH 1899/4482] soc: esp32s2: add cache mode disabled option Update data cache mode to work when data cache is set to 0KB. Signed-off-by: Sylvio Alves --- soc/espressif/esp32s2/soc_cache.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/soc/espressif/esp32s2/soc_cache.c b/soc/espressif/esp32s2/soc_cache.c index 658d0a5988a0d..8c4e45669bff9 100644 --- a/soc/espressif/esp32s2/soc_cache.c +++ b/soc/espressif/esp32s2/soc_cache.c @@ -24,7 +24,9 @@ /* * Data Cache definitions */ -#if defined(CONFIG_ESP32S2_DATA_CACHE_8KB) +#if defined(CONFIG_ESP32S2_DATA_CACHE_0KB) +#define ESP32S2_DCACHE_SIZE CACHE_SIZE_0KB +#elif defined(CONFIG_ESP32S2_DATA_CACHE_8KB) #define ESP32S2_DCACHE_SIZE CACHE_SIZE_8KB #else #define ESP32S2_DCACHE_SIZE CACHE_SIZE_16KB @@ -66,7 +68,10 @@ void IRAM_ATTR esp_config_data_cache_mode(void) cache_line_size_t cache_line_size; #if CONFIG_ESP32S2_INSTRUCTION_CACHE_8KB -#if CONFIG_ESP32S2_DATA_CACHE_8KB +#if CONFIG_ESP32S2_DATA_CACHE_0KB + Cache_Allocate_SRAM(CACHE_MEMORY_ICACHE_LOW, CACHE_MEMORY_INVALID, CACHE_MEMORY_INVALID, + CACHE_MEMORY_INVALID); +#elif CONFIG_ESP32S2_DATA_CACHE_8KB esp_rom_Cache_Allocate_SRAM(CACHE_MEMORY_ICACHE_LOW, CACHE_MEMORY_DCACHE_LOW, CACHE_MEMORY_INVALID, CACHE_MEMORY_INVALID); #else @@ -74,7 +79,10 @@ void IRAM_ATTR esp_config_data_cache_mode(void) CACHE_MEMORY_DCACHE_HIGH, CACHE_MEMORY_INVALID); #endif #else -#if CONFIG_ESP32S2_DATA_CACHE_8KB +#if CONFIG_ESP32S2_DATA_CACHE_0KB + Cache_Allocate_SRAM(CACHE_MEMORY_ICACHE_LOW, CACHE_MEMORY_ICACHE_HIGH, CACHE_MEMORY_INVALID, + CACHE_MEMORY_INVALID); +#elif CONFIG_ESP32S2_DATA_CACHE_8KB esp_rom_Cache_Allocate_SRAM(CACHE_MEMORY_ICACHE_LOW, CACHE_MEMORY_ICACHE_HIGH, CACHE_MEMORY_DCACHE_LOW, CACHE_MEMORY_INVALID); #else From 02fc5e3f6622f2eab0f40736ea480cbeac517bc2 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Thu, 24 Oct 2024 19:40:07 -0300 Subject: [PATCH 1900/4482] soc: esp32s3: update linker files Add new wifi sections into iram area. Add new functions to iram area. Remove unused entries. Signed-off-by: Sylvio Alves --- soc/espressif/esp32s3/default.ld | 18 ++++++++++++------ soc/espressif/esp32s3/mcuboot.ld | 4 ---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/soc/espressif/esp32s3/default.ld b/soc/espressif/esp32s3/default.ld index 487b084b03d56..17d865cf526f9 100644 --- a/soc/espressif/esp32s3/default.ld +++ b/soc/espressif/esp32s3/default.ld @@ -160,7 +160,7 @@ SECTIONS . = ALIGN(4); _rtc_fast_start = ABSOLUTE(.); _rtc_text_start = ABSOLUTE(.); - *(.rtc.literal .rtc.text) + *(.rtc.entry.literal .rtc.text) *(.rtc.entry.text) _rtc_text_end = ABSOLUTE(.); } GROUP_DATA_LINK_IN(rtc_iram_seg, ROMABLE_REGION) @@ -350,7 +350,8 @@ SECTIONS *libzephyr.a:flash_brownout_hook.*(.literal .literal.* .text .text.*) *libzephyr.a:spi_flash_wrap.*(.literal .literal.* .text .text.*) *libzephyr.a:spi_flash_hpm_enable.*(.literal .literal.* .text .text.*) - *libzephyr.a:spi_flash_oct_flash_init*(.literal .literal.* .text .text.*) + *libzephyr.a:spi_flash_oct_flash_init.*(.literal .literal.* .text .text.*) + *libzephyr.a:flash_ops.*(.literal .literal.* .text .text.*) /* [mapping:esp_system] */ *libzephyr.a:esp_err.*(.literal .literal.* .text .text.*) @@ -381,9 +382,11 @@ SECTIONS /* [mapping:esp_rom] */ *libzephyr.a:esp_rom_cache_esp32s2_esp32s3.*(.literal .literal.* .text .text.*) + *libzephyr.a:cache_utils.*(.literal .text .literal.* .text.*) *libzephyr.a:esp_rom_spiflash.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_rom_systimer.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_rom_wdt.*(.literal .literal.* .text .text.*) + *libzephyr.a:esp_rom_efuse.*(.literal .literal.* .text .text.*) /* [mapping:esp_mm] */ *libzephyr.a:esp_cache.*(.literal .literal.* .text .text.*) @@ -393,8 +396,8 @@ SECTIONS *libzephyr.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable) #if defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:(.wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:(.wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.*) + *libnet80211.a:(.wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:(.wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.* .wifiextrairam .wifiextrairam.*) *libcoexist.a:(.wifi_slp_iram .wifi_slp_iram.*) /* [mapping:esp_wifi] */ @@ -589,6 +592,7 @@ SECTIONS *libzephyr.a:spi_flash_hpm_enable.*(.rodata .rodata.*) *libzephyr.a:spi_flash_oct_flash_init.*(.rodata .rodata.*) *libzephyr.a:flash_qio_mode.*(.rodata .rodata.*) + *libzephyr.a:flash_ops.*(.rodata .rodata.*) /* [mapping:esp_mm] */ *libzephyr.a:esp_cache.*(.rodata .rodata.*) @@ -616,9 +620,11 @@ SECTIONS /* [mapping:esp_rom] */ *libzephyr.a:esp_rom_cache_esp32s2_esp32s3.*(.rodata .rodata.*) + *libzephyr.a:cache_utils.*(.rodata .rodata.*) *libzephyr.a:esp_rom_spiflash.*(.rodata .rodata.*) *libzephyr.a:esp_rom_systimer.*(.rodata .rodata.*) *libzephyr.a:esp_rom_wdt.*(.rodata .rodata.*) + *libzephyr.a:esp_rom_efuse.*(.rodata .rodata.*) /* [mapping:esp_system] */ *libzephyr.a:esp_err.*(.rodata .rodata.*) @@ -761,8 +767,8 @@ SECTIONS __rom_region_start = ABSOLUTE(.); #if !defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.* .wifiextrairam .wifiextrairam.*) #endif #if !defined(CONFIG_ESP32_WIFI_RX_IRAM_OPT) diff --git a/soc/espressif/esp32s3/mcuboot.ld b/soc/espressif/esp32s3/mcuboot.ld index 46a3c0c3168c9..f0fb717d5d91b 100644 --- a/soc/espressif/esp32s3/mcuboot.ld +++ b/soc/espressif/esp32s3/mcuboot.ld @@ -57,7 +57,6 @@ SECTIONS *libzephyr.a:cbprintf_nano.*(.literal .text .literal.* .text.*) *libzephyr.a:cpu.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) - *libzephyr.a:cache_hal.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_map.*(.literal .text .literal.* .text.*) *libzephyr.a:esp_rom_spiflash.*(.literal .text .literal.* .text.*) @@ -68,9 +67,6 @@ SECTIONS *libkernel.a:device.*(.literal .text .literal.* .text.*) *libkernel.a:timeout.*(.literal .text .literal.* .text.*) - *(.literal.bootloader_mmap .text.bootloader_mmap) - *(.literal.bootloader_munmap .text.bootloader_munmap) - *libzephyr.a:esp_loader.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) From 5678512fe830422c1d909f73cad9db3e8a0d0d19 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Thu, 24 Oct 2024 19:40:22 -0300 Subject: [PATCH 1901/4482] soc: esp32s3: move cache mode call Removed unused function declaration. Added missing include. Move Cache_Susped_DCache() call to proper function configuration call. Signed-off-by: Sylvio Alves --- soc/espressif/esp32s3/soc.c | 1 + soc/espressif/esp32s3/soc.h | 4 ---- soc/espressif/esp32s3/soc_cache.c | 3 +-- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/soc/espressif/esp32s3/soc.c b/soc/espressif/esp32s3/soc.c index 538a811aa6fc7..a1349b61db01b 100644 --- a/soc/espressif/esp32s3/soc.c +++ b/soc/espressif/esp32s3/soc.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #if CONFIG_ESP_SPIRAM diff --git a/soc/espressif/esp32s3/soc.h b/soc/espressif/esp32s3/soc.h index 2cb247ca48978..1d6d2204cf41c 100644 --- a/soc/espressif/esp32s3/soc.h +++ b/soc/espressif/esp32s3/soc.h @@ -73,8 +73,4 @@ extern int esp_rom_Cache_Ibus_MMU_Set(uint32_t ext_ram, uint32_t vaddr, uint32_t extern uint8_t esp_rom_i2c_readReg(uint8_t block, uint8_t host_id, uint8_t reg_add); extern void esp_rom_i2c_writeReg(uint8_t block, uint8_t host_id, uint8_t reg_add, uint8_t data); -/* cache initialization functions */ -void esp_config_instruction_cache_mode(void); -void esp_config_data_cache_mode(void); - #endif /* __SOC_H__ */ diff --git a/soc/espressif/esp32s3/soc_cache.c b/soc/espressif/esp32s3/soc_cache.c index 65330b2f939b6..a80d0ca8d8751 100644 --- a/soc/espressif/esp32s3/soc_cache.c +++ b/soc/espressif/esp32s3/soc_cache.c @@ -26,12 +26,11 @@ void IRAM_ATTR esp_config_instruction_cache_mode(void) rom_config_instruction_cache_mode(CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE, CONFIG_ESP32S3_ICACHE_ASSOCIATED_WAYS, CONFIG_ESP32S3_INSTRUCTION_CACHE_LINE_SIZE); - - Cache_Suspend_DCache(); } void IRAM_ATTR esp_config_data_cache_mode(void) { + Cache_Suspend_DCache(); rom_config_data_cache_mode(CONFIG_ESP32S3_DATA_CACHE_SIZE, CONFIG_ESP32S3_DCACHE_ASSOCIATED_WAYS, CONFIG_ESP32S3_DATA_CACHE_LINE_SIZE); From 9f93dede369c365c68b5618844e3d31e35327bc2 Mon Sep 17 00:00:00 2001 From: Dan Kalowsky Date: Sun, 27 Oct 2024 15:05:35 -0700 Subject: [PATCH 1902/4482] VERSION: bump for 4.0.0 rc1 Update the VERSION file to reflect the tagging for 4.0.0rc1 release. Signed-off-by: Dan Kalowsky --- VERSION | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 83bbbb1d94297..1659ec4dbe225 100644 --- a/VERSION +++ b/VERSION @@ -1,5 +1,5 @@ -VERSION_MAJOR = 3 -VERSION_MINOR = 7 -PATCHLEVEL = 99 +VERSION_MAJOR = 4 +VERSION_MINOR = 0 +PATCHLEVEL = 0 VERSION_TWEAK = 0 -EXTRAVERSION = +EXTRAVERSION = rc1 From 8334ca2a858003bbee9d77c56778ae6969fb3b78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Thu, 24 Oct 2024 15:31:45 +0200 Subject: [PATCH 1903/4482] doc: porting_guide: encourage the use of webp for board images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's already mentioned in the board.tmpl template file as well as in documentation writing guidelines so fix this leftover and make sure people contributing boards aim for webp format as it helps with file size while supporting transparency. Signed-off-by: Benjamin Cabé --- doc/hardware/porting/board_porting.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/hardware/porting/board_porting.rst b/doc/hardware/porting/board_porting.rst index 5b0e52ade381b..b1b6141d7af4f 100644 --- a/doc/hardware/porting/board_porting.rst +++ b/doc/hardware/porting/board_porting.rst @@ -261,7 +261,7 @@ Your board directory should look like this: ├── board.cmake ├── CMakeLists.txt ├── doc - │   ├── plank.png + │   ├── plank.webp │   └── index.rst ├── Kconfig.plank ├── Kconfig.defconfig @@ -299,7 +299,7 @@ The optional files are: - :file:`board.cmake`: used for :ref:`flash-and-debug-support` - :file:`CMakeLists.txt`: if you need to add additional source files to your build. -- :file:`doc/index.rst`, :file:`doc/plank.png`: documentation for and a picture +- :file:`doc/index.rst`, :file:`doc/plank.webp`: documentation for and a picture of your board. You only need this if you're :ref:`contributing-your-board` to Zephyr. - :file:`plank_.yaml`: a YAML file with miscellaneous metadata used From c90301300afffd090ebb21cf724336264a9714b7 Mon Sep 17 00:00:00 2001 From: Babak Arisian Date: Thu, 24 Oct 2024 10:45:24 +0200 Subject: [PATCH 1904/4482] MAINTAINERS: Add babrsn to Bluetooth Audio I have contributed the following PRs: https://github.com/zephyrproject-rtos/zephyr/pull/80000 https://github.com/zephyrproject-rtos/zephyr/pull/79360 https://github.com/zephyrproject-rtos/zephyr/pull/78846 https://github.com/zephyrproject-rtos/zephyr/pull/78751 https://github.com/zephyrproject-rtos/zephyr/pull/74950 https://github.com/zephyrproject-rtos/zephyr/pull/74946 https://github.com/zephyrproject-rtos/zephyr/pull/73845 https://github.com/zephyrproject-rtos/zephyr/pull/72849 and am attending the weekly LE Audio Zephyr meetings. Signed-off-by: Babak Arisian --- MAINTAINERS.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 6bfb26a8bf1a0..96790307c125d 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -463,6 +463,7 @@ Bluetooth Audio: - pin-zephyr - niym-ot - jthm-ot + - babrsn files: - subsys/bluetooth/audio/ - include/zephyr/bluetooth/audio/ From a673316b4fa881b881a5d4aef88e6482758da041 Mon Sep 17 00:00:00 2001 From: Lucas Mathias Balling Date: Thu, 24 Oct 2024 10:13:11 +0200 Subject: [PATCH 1905/4482] doc: releases: Add note for PAST support Change adds a release note informing about the addition of PAST support in the Controller. Signed-off-by: Lucas Mathias Balling --- doc/releases/release-notes-4.0.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 18a60105befe1..71cfeaf5427f5 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -138,6 +138,12 @@ Bluetooth :c:func:`bt_conn_le_create` and :c:func:`bt_conn_le_create_synced` return an error if the connection pointer passed as an argument is not NULL. +* Controller + + * Added Periodic Advertising Sync Transfer (PAST) support with support for both sending and receiving roles. + The option can be enabled by :kconfig:option:`CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER` and + :kconfig:option:`CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER`. + * HCI Drivers Boards & SoC Support From a258ab32d12df26b5d159b00b805650f3dea4faf Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 24 Oct 2024 13:21:01 +0200 Subject: [PATCH 1906/4482] doc: doxygen: remove rst utilities We no longer render Doxygen content in Sphinx after the removal of breathe, so let's remove rst related aliases from Doxyfile. Also adjust some headers that contained rst content. Signed-off-by: Gerard Marull-Paretas --- doc/zephyr.doxyfile.in | 18 +- include/zephyr/net/socket.h | 284 ++++++++++++----------------- include/zephyr/net/socket_select.h | 52 +++--- 3 files changed, 143 insertions(+), 211 deletions(-) diff --git a/doc/zephyr.doxyfile.in b/doc/zephyr.doxyfile.in index 38b55ad6aeb8f..abd4440f5aa16 100644 --- a/doc/zephyr.doxyfile.in +++ b/doc/zephyr.doxyfile.in @@ -279,9 +279,7 @@ TAB_SIZE = 8 # with the commands \{ and \} for these it is advised to use the version @{ and # @} or use a double escape (\\{ and \\}) -ALIASES = "rst=\verbatim embed:rst:leading-asterisk" \ - endrst=\endverbatim \ - "kconfig{1}=\htmlonly \1 \endhtmlonly \xmlonly embed:rst:inline :kconfig:option:`\1` \endxmlonly" \ +ALIASES = "kconfig{1}=\verbatim \1 \endverbatim" \ "req{1}=\ref ZEPH_\1 \"ZEPH-\1\"" \ "satisfy{1}=\xrefitem satisfy \"Satisfies requirement\" \"Requirement Implementation\" \1" \ "verify{1}=\xrefitem verify \"Verifies requirement\" \"Requirement Verification\" \1" \ @@ -289,14 +287,14 @@ ALIASES = "rst=\verbatim embed:rst:leading-asterisk" \ "kconfig_dep{2}=\attention Available only when the following Kconfig options are enabled: \kconfig{\1}, \kconfig{\2}." \ "kconfig_dep{3}=\attention Available only when the following Kconfig options are enabled: \kconfig{\1}, \kconfig{\2}, \kconfig{\3}." \ "funcprops=\par \"Function properties (list may not be complete)\"" \ - "reschedule=\htmlonly reschedule \endhtmlonly \xmlonly embed:rst:inline :ref:`api_term_reschedule` \endxmlonly" \ - "sleep=\htmlonly sleep \endhtmlonly \xmlonly embed:rst:inline :ref:`api_term_sleep` \endxmlonly" \ - "no_wait=\htmlonly no-wait \endhtmlonly \xmlonly embed:rst:inline :ref:`api_term_no-wait` \endxmlonly" \ - "isr_ok=\htmlonly isr-ok \endhtmlonly \xmlonly embed:rst:inline :ref:`api_term_isr-ok` \endxmlonly" \ - "pre_kernel_ok=\htmlonly pre-kernel-ok \endhtmlonly \xmlonly embed:rst:inline :ref:`api_term_pre-kernel-ok` \endxmlonly" \ - "async=\htmlonly async \endhtmlonly \xmlonly embed:rst:inline :ref:`api_term_async` \endxmlonly" \ + "reschedule=\qualifier reschedule" \ + "sleep=\qualifier sleep" \ + "no_wait=\qualifier no-wait" \ + "isr_ok=\qualifier isr-ok" \ + "pre_kernel_ok=\qualifier pre-kernel-ok" \ + "async=\qualifier async" \ "atomic_api=As for all atomic APIs, includes a full/sequentially-consistent memory barrier (where applicable)." \ - "supervisor=\htmlonly supervisor \endhtmlonly \xmlonly embed:rst:inline :ref:`api_term_supervisor` \endxmlonly" + "supervisor=\qualifier supervisor" # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For diff --git a/include/zephyr/net/socket.h b/include/zephyr/net/socket.h index 9cef421b84168..f1a937d42294d 100644 --- a/include/zephyr/net/socket.h +++ b/include/zephyr/net/socket.h @@ -332,13 +332,11 @@ __syscall void *zsock_get_context_object(int sock); * @brief Create a network socket * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html * for normative description. - * This function is also exposed as ``socket()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `socket()` + * if @kconfig{CONFIG_POSIX_API} is defined. * * If CONFIG_USERSPACE is enabled, the caller will be granted access to the * context object associated with the returned file descriptor. @@ -351,13 +349,11 @@ __syscall int zsock_socket(int family, int type, int proto); * @brief Create an unnamed pair of connected sockets * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * https://pubs.opengroup.org/onlinepubs/009695399/functions/socketpair.html * for normative description. - * This function is also exposed as ``socketpair()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `socketpair()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ __syscall int zsock_socketpair(int family, int type, int proto, int *sv); @@ -365,12 +361,10 @@ __syscall int zsock_socketpair(int family, int type, int proto, int *sv); * @brief Close a network socket * * @details - * @rst * Close a network socket. - * This function is also exposed as ``close()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined (in which case it - * may conflict with generic POSIX ``close()`` function). - * @endrst + * This function is also exposed as `close()` + * if @kconfig{CONFIG_POSIX_API} is defined (in which case it + * may conflict with generic POSIX `close()` function). */ __syscall int zsock_close(int sock); @@ -378,14 +372,12 @@ __syscall int zsock_close(int sock); * @brief Shutdown socket send/receive operations * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/shutdown.html * for normative description, but currently this function has no effect in * Zephyr and provided solely for compatibility with existing code. - * This function is also exposed as ``shutdown()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `shutdown()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ __syscall int zsock_shutdown(int sock, int how); @@ -393,13 +385,11 @@ __syscall int zsock_shutdown(int sock, int how); * @brief Bind a socket to a local network address * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html * for normative description. - * This function is also exposed as ``bind()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `bind()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ __syscall int zsock_bind(int sock, const struct sockaddr *addr, socklen_t addrlen); @@ -408,13 +398,11 @@ __syscall int zsock_bind(int sock, const struct sockaddr *addr, * @brief Connect a socket to a peer network address * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html * for normative description. - * This function is also exposed as ``connect()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `connect()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ __syscall int zsock_connect(int sock, const struct sockaddr *addr, socklen_t addrlen); @@ -423,13 +411,11 @@ __syscall int zsock_connect(int sock, const struct sockaddr *addr, * @brief Set up a STREAM socket to accept peer connections * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html * for normative description. - * This function is also exposed as ``listen()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `listen()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ __syscall int zsock_listen(int sock, int backlog); @@ -437,13 +423,11 @@ __syscall int zsock_listen(int sock, int backlog); * @brief Accept a connection on listening socket * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html * for normative description. - * This function is also exposed as ``accept()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `accept()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ __syscall int zsock_accept(int sock, struct sockaddr *addr, socklen_t *addrlen); @@ -451,13 +435,11 @@ __syscall int zsock_accept(int sock, struct sockaddr *addr, socklen_t *addrlen); * @brief Send data to an arbitrary network address * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html * for normative description. - * This function is also exposed as ``sendto()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `sendto()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ __syscall ssize_t zsock_sendto(int sock, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, @@ -467,13 +449,11 @@ __syscall ssize_t zsock_sendto(int sock, const void *buf, size_t len, * @brief Send data to a connected peer * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html * for normative description. - * This function is also exposed as ``send()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `send()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ static inline ssize_t zsock_send(int sock, const void *buf, size_t len, int flags) @@ -485,13 +465,11 @@ static inline ssize_t zsock_send(int sock, const void *buf, size_t len, * @brief Send data to an arbitrary network address * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html * for normative description. - * This function is also exposed as ``sendmsg()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `sendmsg()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ __syscall ssize_t zsock_sendmsg(int sock, const struct msghdr *msg, int flags); @@ -500,13 +478,11 @@ __syscall ssize_t zsock_sendmsg(int sock, const struct msghdr *msg, * @brief Receive data from an arbitrary network address * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html * for normative description. - * This function is also exposed as ``recvfrom()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `recvfrom()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ __syscall ssize_t zsock_recvfrom(int sock, void *buf, size_t max_len, int flags, struct sockaddr *src_addr, @@ -516,13 +492,11 @@ __syscall ssize_t zsock_recvfrom(int sock, void *buf, size_t max_len, * @brief Receive a message from an arbitrary network address * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/recvmsg.html * for normative description. - * This function is also exposed as ``recvmsg()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `recvmsg()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ __syscall ssize_t zsock_recvmsg(int sock, struct msghdr *msg, int flags); @@ -530,13 +504,11 @@ __syscall ssize_t zsock_recvmsg(int sock, struct msghdr *msg, int flags); * @brief Receive data from a connected peer * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html * for normative description. - * This function is also exposed as ``recv()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `recv()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ static inline ssize_t zsock_recv(int sock, void *buf, size_t max_len, int flags) @@ -548,13 +520,11 @@ static inline ssize_t zsock_recv(int sock, void *buf, size_t max_len, * @brief Control blocking/non-blocking mode of a socket * * @details - * @rst * This functions allow to (only) configure a socket for blocking or * non-blocking operation (O_NONBLOCK). - * This function is also exposed as ``fcntl()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined (in which case - * it may conflict with generic POSIX ``fcntl()`` function). - * @endrst + * This function is also exposed as `fcntl()` + * if @kconfig{CONFIG_POSIX_API} is defined (in which case + * it may conflict with generic POSIX `fcntl()` function). */ __syscall int zsock_fcntl_impl(int sock, int cmd, int flags); @@ -583,18 +553,16 @@ static inline int zsock_fcntl_wrapper(int sock, int cmd, ...) * @brief Control underlying socket parameters * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * https://pubs.opengroup.org/onlinepubs/9699919799/functions/ioctl.html * for normative description. * This function enables querying or manipulating underlying socket parameters. - * Currently supported @p request values include ``ZFD_IOCTL_FIONBIO``, and - * ``ZFD_IOCTL_FIONREAD``, to set non-blocking mode, and query the number of + * Currently supported @p request values include `ZFD_IOCTL_FIONBIO`, and + * `ZFD_IOCTL_FIONREAD`, to set non-blocking mode, and query the number of * bytes available to read, respectively. - * This function is also exposed as ``ioctl()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined (in which case - * it may conflict with generic POSIX ``ioctl()`` function). - * @endrst + * This function is also exposed as `ioctl()` + * if @kconfig{CONFIG_POSIX_API} is defined (in which case + * it may conflict with generic POSIX `ioctl()` function). */ __syscall int zsock_ioctl_impl(int sock, unsigned long request, va_list ap); @@ -620,14 +588,12 @@ static inline int zsock_ioctl_wrapper(int sock, unsigned long request, ...) * @brief Efficiently poll multiple sockets for events * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html * for normative description. - * This function is also exposed as ``poll()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined (in which case - * it may conflict with generic POSIX ``poll()`` function). - * @endrst + * This function is also exposed as `poll()` + * if @kconfig{CONFIG_POSIX_API} is defined (in which case + * it may conflict with generic POSIX `poll()` function). */ static inline int zsock_poll(struct zsock_pollfd *fds, int nfds, int timeout) { @@ -638,16 +604,14 @@ static inline int zsock_poll(struct zsock_pollfd *fds, int nfds, int timeout) * @brief Get various socket options * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html * for normative description. In Zephyr this function supports a subset of * socket options described by POSIX, but also some additional options * available in Linux (some options are dummy and provided to ease porting * of existing code). - * This function is also exposed as ``getsockopt()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `getsockopt()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ __syscall int zsock_getsockopt(int sock, int level, int optname, void *optval, socklen_t *optlen); @@ -656,16 +620,14 @@ __syscall int zsock_getsockopt(int sock, int level, int optname, * @brief Set various socket options * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html * for normative description. In Zephyr this function supports a subset of * socket options described by POSIX, but also some additional options * available in Linux (some options are dummy and provided to ease porting * of existing code). - * This function is also exposed as ``setsockopt()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `setsockopt()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ __syscall int zsock_setsockopt(int sock, int level, int optname, const void *optval, socklen_t optlen); @@ -674,13 +636,11 @@ __syscall int zsock_setsockopt(int sock, int level, int optname, * @brief Get peer name * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html * for normative description. - * This function is also exposed as ``getpeername()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `getpeername()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ __syscall int zsock_getpeername(int sock, struct sockaddr *addr, socklen_t *addrlen); @@ -689,13 +649,11 @@ __syscall int zsock_getpeername(int sock, struct sockaddr *addr, * @brief Get socket name * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html * for normative description. - * This function is also exposed as ``getsockname()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `getsockname()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ __syscall int zsock_getsockname(int sock, struct sockaddr *addr, socklen_t *addrlen); @@ -704,13 +662,11 @@ __syscall int zsock_getsockname(int sock, struct sockaddr *addr, * @brief Get local host name * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostname.html * for normative description. - * This function is also exposed as ``gethostname()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `gethostname()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ __syscall int zsock_gethostname(char *buf, size_t len); @@ -718,13 +674,11 @@ __syscall int zsock_gethostname(char *buf, size_t len); * @brief Convert network address from internal to numeric ASCII form * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_ntop.html * for normative description. - * This function is also exposed as ``inet_ntop()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `inet_ntop()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ static inline char *zsock_inet_ntop(sa_family_t family, const void *src, char *dst, size_t size) @@ -736,13 +690,11 @@ static inline char *zsock_inet_ntop(sa_family_t family, const void *src, * @brief Convert network address from numeric ASCII form to internal representation * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_pton.html * for normative description. - * This function is also exposed as ``inet_pton()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `inet_pton()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ __syscall int zsock_inet_pton(sa_family_t family, const char *src, void *dst); @@ -781,13 +733,11 @@ __syscall int z_zsock_getaddrinfo_internal(const char *host, * @brief Resolve a domain name to one or more network addresses * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html * for normative description. - * This function is also exposed as ``getaddrinfo()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `getaddrinfo()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ int zsock_getaddrinfo(const char *host, const char *service, const struct zsock_addrinfo *hints, @@ -797,13 +747,11 @@ int zsock_getaddrinfo(const char *host, const char *service, * @brief Free results returned by zsock_getaddrinfo() * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/freeaddrinfo.html * for normative description. - * This function is also exposed as ``freeaddrinfo()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `freeaddrinfo()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ void zsock_freeaddrinfo(struct zsock_addrinfo *ai); @@ -811,13 +759,11 @@ void zsock_freeaddrinfo(struct zsock_addrinfo *ai); * @brief Convert zsock_getaddrinfo() error code to textual message * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/gai_strerror.html * for normative description. - * This function is also exposed as ``gai_strerror()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `gai_strerror()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ const char *zsock_gai_strerror(int errcode); @@ -848,13 +794,11 @@ const char *zsock_gai_strerror(int errcode); * @brief Resolve a network address to a domain name or ASCII address * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/getnameinfo.html * for normative description. - * This function is also exposed as ``getnameinfo()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `getnameinfo()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ int zsock_getnameinfo(const struct sockaddr *addr, socklen_t addrlen, char *host, socklen_t hostlen, diff --git a/include/zephyr/net/socket_select.h b/include/zephyr/net/socket_select.h index 7a9b1ca200b31..581465a6a24a0 100644 --- a/include/zephyr/net/socket_select.h +++ b/include/zephyr/net/socket_select.h @@ -36,17 +36,15 @@ typedef struct zvfs_fd_set zsock_fd_set; * @brief Legacy function to poll multiple sockets for events * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/select.html * for normative description. This function is provided to ease porting of * existing code and not recommended for usage due to its inefficiency, * use zsock_poll() instead. In Zephyr this function works only with * sockets, not arbitrary file descriptors. - * This function is also exposed as ``select()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined (in which case - * it may conflict with generic POSIX ``select()`` function). - * @endrst + * This function is also exposed as `select()` + * if @kconfig{CONFIG_POSIX_API} is defined (in which case + * it may conflict with generic POSIX `select()` function). */ static inline int zsock_select(int nfds, zsock_fd_set *readfds, zsock_fd_set *writefds, zsock_fd_set *exceptfds, struct zsock_timeval *timeout) @@ -66,13 +64,11 @@ static inline int zsock_select(int nfds, zsock_fd_set *readfds, zsock_fd_set *wr * @brief Initialize (clear) fd_set * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/select.html * for normative description. - * This function is also exposed as ``FD_ZERO()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `FD_ZERO()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ static inline void ZSOCK_FD_ZERO(zsock_fd_set *set) { @@ -83,13 +79,11 @@ static inline void ZSOCK_FD_ZERO(zsock_fd_set *set) * @brief Check whether socket is a member of fd_set * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/select.html * for normative description. - * This function is also exposed as ``FD_ISSET()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `FD_ISSET()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ static inline int ZSOCK_FD_ISSET(int fd, zsock_fd_set *set) { @@ -100,13 +94,11 @@ static inline int ZSOCK_FD_ISSET(int fd, zsock_fd_set *set) * @brief Remove socket from fd_set * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/select.html * for normative description. - * This function is also exposed as ``FD_CLR()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `FD_CLR()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ static inline void ZSOCK_FD_CLR(int fd, zsock_fd_set *set) { @@ -117,13 +109,11 @@ static inline void ZSOCK_FD_CLR(int fd, zsock_fd_set *set) * @brief Add socket to fd_set * * @details - * @rst - * See `POSIX.1-2017 article - * `__ + * See POSIX.1-2017 article + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/select.html * for normative description. - * This function is also exposed as ``FD_SET()`` - * if :kconfig:option:`CONFIG_POSIX_API` is defined. - * @endrst + * This function is also exposed as `FD_SET()` + * if @kconfig{CONFIG_POSIX_API} is defined. */ static inline void ZSOCK_FD_SET(int fd, zsock_fd_set *set) { From b5a87c7aca9e0b50c680746467d60e1bb8aea54f Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 24 Oct 2024 14:08:45 +0200 Subject: [PATCH 1907/4482] bluetooth: audio: bap: fix Doxygen issue Doxygen was getting confused when expanding @kconfig (verbatim block within []). Signed-off-by: Gerard Marull-Paretas --- include/zephyr/bluetooth/audio/bap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/zephyr/bluetooth/audio/bap.h b/include/zephyr/bluetooth/audio/bap.h index a85dec860e4e1..30e265599e0e4 100644 --- a/include/zephyr/bluetooth/audio/bap.h +++ b/include/zephyr/bluetooth/audio/bap.h @@ -925,13 +925,13 @@ struct bt_bap_unicast_server_register_param { /** * @brief Sink Count to register. * - * Should be in range [0, @kconfig{CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT}] + * Should be in range 0 to @kconfig{CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT} */ uint8_t snk_cnt; /** @brief Source Count to register. * - * Should be in range [0, @kconfig{CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT}] + * Should be in range 0 to @kconfig{CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT} */ uint8_t src_cnt; }; From 5cdabfa902e80ce5a44717b8f7a0a94b47fcfb59 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Thu, 24 Oct 2024 16:59:15 +0200 Subject: [PATCH 1908/4482] include: usb: add API version Add API versions to all relevant USB headers. Signed-off-by: Johann Fischer --- include/zephyr/drivers/usb/udc.h | 2 ++ include/zephyr/drivers/usb/udc_buf.h | 2 ++ include/zephyr/drivers/usb/uhc.h | 2 ++ include/zephyr/drivers/usb/usb_dc.h | 2 ++ include/zephyr/usb/bos.h | 2 ++ include/zephyr/usb/class/hid.h | 2 ++ include/zephyr/usb/class/usb_hid.h | 2 ++ include/zephyr/usb/class/usbd_hid.h | 2 ++ include/zephyr/usb/class/usbd_msc.h | 2 ++ include/zephyr/usb/class/usbd_uac2.h | 2 ++ include/zephyr/usb/usb_device.h | 2 ++ include/zephyr/usb/usbd.h | 2 ++ include/zephyr/usb/usbd_msg.h | 2 ++ 13 files changed, 26 insertions(+) diff --git a/include/zephyr/drivers/usb/udc.h b/include/zephyr/drivers/usb/udc.h index 15b99cf525137..cd1e03851332e 100644 --- a/include/zephyr/drivers/usb/udc.h +++ b/include/zephyr/drivers/usb/udc.h @@ -297,6 +297,8 @@ struct udc_data { * @brief New USB device controller (UDC) driver API * @defgroup udc_api USB device controller driver API * @ingroup io_interfaces + * @since 3.3 + * @version 0.1.0 * @{ */ diff --git a/include/zephyr/drivers/usb/udc_buf.h b/include/zephyr/drivers/usb/udc_buf.h index ac101e3bacb26..6e1ca15e1c3f8 100644 --- a/include/zephyr/drivers/usb/udc_buf.h +++ b/include/zephyr/drivers/usb/udc_buf.h @@ -38,6 +38,8 @@ * @brief Buffer macros and definitions used in USB device support * @defgroup udc_buf Buffer macros and definitions used in USB device support * @ingroup usb + * @since 4.0 + * @version 0.1.0 * @{ */ diff --git a/include/zephyr/drivers/usb/uhc.h b/include/zephyr/drivers/usb/uhc.h index 01e505adeada1..a2224d24669a3 100644 --- a/include/zephyr/drivers/usb/uhc.h +++ b/include/zephyr/drivers/usb/uhc.h @@ -22,6 +22,8 @@ * @brief USB host controller (UHC) driver API * @defgroup uhc_api USB host controller driver API * @ingroup io_interfaces + * @since 3.3 + * @version 0.1.0 * @{ */ diff --git a/include/zephyr/drivers/usb/usb_dc.h b/include/zephyr/drivers/usb/usb_dc.h index 1d7762f8698b6..7c5506d72f079 100644 --- a/include/zephyr/drivers/usb/usb_dc.h +++ b/include/zephyr/drivers/usb/usb_dc.h @@ -22,6 +22,8 @@ /** * @brief USB Device Controller API * @defgroup _usb_device_controller_api USB Device Controller API + * @since 1.5 + * @version 1.0.0 * @{ */ diff --git a/include/zephyr/usb/bos.h b/include/zephyr/usb/bos.h index f73e7c06678ea..79dd802bf26e9 100644 --- a/include/zephyr/usb/bos.h +++ b/include/zephyr/usb/bos.h @@ -14,6 +14,8 @@ * @brief USB Binary Device Object Store support * @defgroup usb_bos USB BOS support * @ingroup usb + * @since 1.13 + * @version 1.0.0 * @{ */ diff --git a/include/zephyr/usb/class/hid.h b/include/zephyr/usb/class/hid.h index b88880683d5ee..96bb8271ed755 100644 --- a/include/zephyr/usb/class/hid.h +++ b/include/zephyr/usb/class/hid.h @@ -24,6 +24,8 @@ extern "C" { * @brief hid.h API * @defgroup usb_hid_definitions USB HID common definitions * @ingroup usb + * @since 1.11 + * @version 1.0.0 * @{ */ diff --git a/include/zephyr/usb/class/usb_hid.h b/include/zephyr/usb/class/usb_hid.h index f15d0526e4ac1..39e869fa72c1a 100644 --- a/include/zephyr/usb/class/usb_hid.h +++ b/include/zephyr/usb/class/usb_hid.h @@ -24,6 +24,8 @@ extern "C" { * @brief usb_hid.h API * @defgroup usb_hid_class USB HID class API * @ingroup usb + * @since 1.11 + * @version 1.0.0 * @{ */ diff --git a/include/zephyr/usb/class/usbd_hid.h b/include/zephyr/usb/class/usbd_hid.h index 7e9921072f271..db2d55b6cbc7d 100644 --- a/include/zephyr/usb/class/usbd_hid.h +++ b/include/zephyr/usb/class/usbd_hid.h @@ -24,6 +24,8 @@ extern "C" { * @brief USBD HID Device API * @defgroup usbd_hid_device USBD HID device API * @ingroup usb + * @since 3.7 + * @version 0.1.0 * @{ */ diff --git a/include/zephyr/usb/class/usbd_msc.h b/include/zephyr/usb/class/usbd_msc.h index e78990388fc4e..c38fc5fb41ff9 100644 --- a/include/zephyr/usb/class/usbd_msc.h +++ b/include/zephyr/usb/class/usbd_msc.h @@ -27,6 +27,8 @@ struct usbd_msc_lun { * @brief USB Mass Storage Class device API * @defgroup usbd_msc_device USB Mass Storage Class device API * @ingroup usb + * @since 3.4 + * @version 0.1.0 * @{ */ diff --git a/include/zephyr/usb/class/usbd_uac2.h b/include/zephyr/usb/class/usbd_uac2.h index ff15473272496..271d9dd016ea2 100644 --- a/include/zephyr/usb/class/usbd_uac2.h +++ b/include/zephyr/usb/class/usbd_uac2.h @@ -23,6 +23,8 @@ * @brief USB Audio Class 2 device API * @defgroup uac2_device USB Audio Class 2 device API * @ingroup usb + * @since 3.6 + * @version 0.1.0 * @{ */ diff --git a/include/zephyr/usb/usb_device.h b/include/zephyr/usb/usb_device.h index 59c3db1cb5905..e596555ed502f 100644 --- a/include/zephyr/usb/usb_device.h +++ b/include/zephyr/usb/usb_device.h @@ -92,6 +92,8 @@ extern "C" { /** * @brief USB Device Core Layer API * @defgroup _usb_device_core_api USB Device Core API + * @since 1.5 + * @version 1.0.0 * @{ */ diff --git a/include/zephyr/usb/usbd.h b/include/zephyr/usb/usbd.h index a0e347a9805c1..7fc022c30019a 100644 --- a/include/zephyr/usb/usbd.h +++ b/include/zephyr/usb/usbd.h @@ -32,6 +32,8 @@ extern "C" { * @brief New USB device stack core API * @defgroup usbd_api USB device core API * @ingroup usb + * @since 3.3 + * @version 0.1.0 * @{ */ diff --git a/include/zephyr/usb/usbd_msg.h b/include/zephyr/usb/usbd_msg.h index cec39dc63688d..b9e99d00c7065 100644 --- a/include/zephyr/usb/usbd_msg.h +++ b/include/zephyr/usb/usbd_msg.h @@ -21,6 +21,8 @@ extern "C" { /** * @defgroup usbd_msg_api USB device core API * @ingroup usb + * @since 3.7 + * @version 0.1.0 * @{ */ From a0b8908fdab7003ad3d633c95819609ba2e197b6 Mon Sep 17 00:00:00 2001 From: Jonas Remmert Date: Mon, 14 Oct 2024 18:32:32 +0200 Subject: [PATCH 1909/4482] release-notes: add phyBOARD-Nash i.MX93 Add entry to release-notes as a follow-up to #76975. Signed-off-by: Jonas Remmert --- doc/releases/release-notes-4.0.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 71cfeaf5427f5..466d3d52ce670 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -158,6 +158,8 @@ Boards & SoC Support * Added support for these boards: + * Added support for :ref:`PHYTEC phyBOARD-Nash `: ``phyboard_nash``. + * Made these board changes: * :ref:`native_posix` has been deprecated in favour of From 3810fd3742e7ad2b1800701c51c32a2673ef77b6 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 28 Oct 2024 14:15:47 +0100 Subject: [PATCH 1910/4482] doc: release: 4.0: Add two more notes on the native targets Add two more relevant notes regarding the native targets. Signed-off-by: Alberto Escolar Piedras --- doc/releases/release-notes-4.0.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 466d3d52ce670..a18f9dd9e9cf2 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -164,6 +164,8 @@ Boards & SoC Support * :ref:`native_posix` has been deprecated in favour of :ref:`native_sim`. + * The nrf54l15bsim target now includes models of the AAR, CCM and ECB peripherals, and many + other improvements. * Support for Google Kukui EC board (``google_kukui``) has been dropped. * STM32: Deprecated MCO configuration via Kconfig in favour of setting it through devicetree. See ``samples/boards/stm32/mco`` sample. @@ -574,6 +576,10 @@ zcbor Tests and Samples ***************** +* Together with the deprecation of :ref:`native_posix`, many tests which were + explicitly run in native_posix now run in :ref:`native_sim` instead. + native_posix as a platform remains tested though. + Issue Related Items ******************* From b417524b663549246c2bbdd42ed3c5227728059a Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 28 Oct 2024 15:17:22 -0400 Subject: [PATCH 1911/4482] twister: cleanup notrun tests with -M Cleanup notrun tests with the -M option. This is used in the weekly build and fails because devices will run out of space. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/runner.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index f5e2cabf74dcb..4a38eeb284a90 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -798,7 +798,8 @@ def process(self, pipeline, done, message, lock, results): if self.options.prep_artifacts_for_testing: next_op = 'cleanup' additionals = {"mode": "device"} - elif self.options.runtime_artifact_cleanup == "pass" and self.instance.status == TwisterStatus.PASS: + elif self.options.runtime_artifact_cleanup == "pass" and \ + self.instance.status in [TwisterStatus.PASS, TwisterStatus.NOTRUN]: next_op = 'cleanup' additionals = {"mode": "passed"} elif self.options.runtime_artifact_cleanup == "all": From afce5329f772a4306af699c7a06efddf93cadca0 Mon Sep 17 00:00:00 2001 From: Tran Van Quy Date: Fri, 11 Oct 2024 15:09:37 +0700 Subject: [PATCH 1912/4482] doc: boards: renesas: update board image name with the board name Align Renesas board image name with board name Signed-off-by: Tran Van Quy --- boards/renesas/ek_ra2a1/doc/ek_ra2a1.webp | Bin 0 -> 60600 bytes boards/renesas/ek_ra2a1/doc/index.rst | 25 +++++++++++++++++- .../ek_ra2a1/doc/ra2a1_block_diagram.webp | Bin 0 -> 27672 bytes .../{ek-ra4e2-board.webp => ek_ra4e2.webp} | Bin boards/renesas/ek_ra4e2/doc/index.rst | 4 +-- ...-diagram.webp => ra4e2_block_diagram.webp} | Bin boards/renesas/ek_ra4m2/doc/index.rst | 2 +- ...-diagram.webp => ra4m2_block_diagram.webp} | Bin .../{ek-ra4m3-board.webp => ek_ra4m3.webp} | Bin boards/renesas/ek_ra4m3/doc/index.rst | 4 +-- ...-diagram.webp => ra4m3_block_diagram.webp} | Bin .../{ek-ra4w1-board.webp => ek_ra4w1.webp} | Bin boards/renesas/ek_ra4w1/doc/index.rst | 4 +-- ...-diagram.webp => ra4w1_block_diagram.webp} | Bin .../{ek-ra6e2-board.webp => ek_ra6e2.webp} | Bin boards/renesas/ek_ra6e2/doc/index.rst | 4 +-- ...-diagram.webp => ra6e2_block_diagram.webp} | Bin .../{ek-ra6m1-board.webp => ek_ra6m1.webp} | Bin boards/renesas/ek_ra6m1/doc/index.rst | 4 +-- ...-diagram.webp => ra6m1_block_diagram.webp} | Bin .../{ek-ra6m2-board.webp => ek_ra6m2.webp} | Bin boards/renesas/ek_ra6m2/doc/index.rst | 4 +-- ...-diagram.webp => ra6m2_block_diagram.webp} | Bin boards/renesas/ek_ra6m3/doc/index.rst | 2 +- ...-diagram.webp => ra6m3_block_diagram.webp} | Bin .../{ek-ra6m4-board.webp => ek_ra6m4.webp} | Bin boards/renesas/ek_ra6m4/doc/index.rst | 4 +-- ...-diagram.webp => ra6m4_block_diagram.webp} | Bin .../{ek-ra6m5-board.webp => ek_ra6m5.webp} | Bin boards/renesas/ek_ra6m5/doc/index.rst | 4 +-- ...-diagram.webp => ra6m5_block_diagram.webp} | Bin .../doc/{ek-ra8d1-board.jpg => ek_ra8d1.jpg} | Bin boards/renesas/ek_ra8d1/doc/index.rst | 4 +-- ...ck-diagram.png => ra8d1_block_diagram.png} | Bin boards/renesas/ek_ra8m1/doc/index.rst | 2 +- ...ck-diagram.jpg => ra8m1_block_diagram.jpg} | Bin boards/renesas/fpb_ra6e1/doc/index.rst | 4 +-- ...-diagram.webp => ra6e1_block_diagram.webp} | Bin .../{fpb-ra6e2-board.webp => fpb_ra6e2.webp} | Bin boards/renesas/fpb_ra6e2/doc/index.rst | 4 +-- ...-diagram.webp => ra6e2_block_diagram.webp} | Bin boards/renesas/mck_ra8t1/doc/index.rst | 6 ++--- ...-board-block-diagram.jpg => mck_ra8t1.jpg} | Bin ...nts.jpg => mck_ra8t1_product_contents.jpg} | Bin ...ck-diagram.png => ra8t1_block_diagram.png} | Bin 45 files changed, 52 insertions(+), 29 deletions(-) create mode 100644 boards/renesas/ek_ra2a1/doc/ek_ra2a1.webp create mode 100644 boards/renesas/ek_ra2a1/doc/ra2a1_block_diagram.webp rename boards/renesas/ek_ra4e2/doc/{ek-ra4e2-board.webp => ek_ra4e2.webp} (100%) rename boards/renesas/ek_ra4e2/doc/{ra4e2-block-diagram.webp => ra4e2_block_diagram.webp} (100%) rename boards/renesas/ek_ra4m2/doc/{ra4m2-block-diagram.webp => ra4m2_block_diagram.webp} (100%) rename boards/renesas/ek_ra4m3/doc/{ek-ra4m3-board.webp => ek_ra4m3.webp} (100%) rename boards/renesas/ek_ra4m3/doc/{ra4m3-block-diagram.webp => ra4m3_block_diagram.webp} (100%) rename boards/renesas/ek_ra4w1/doc/{ek-ra4w1-board.webp => ek_ra4w1.webp} (100%) rename boards/renesas/ek_ra4w1/doc/{ra4w1-block-diagram.webp => ra4w1_block_diagram.webp} (100%) rename boards/renesas/ek_ra6e2/doc/{ek-ra6e2-board.webp => ek_ra6e2.webp} (100%) rename boards/renesas/ek_ra6e2/doc/{ra6e2-block-diagram.webp => ra6e2_block_diagram.webp} (100%) rename boards/renesas/ek_ra6m1/doc/{ek-ra6m1-board.webp => ek_ra6m1.webp} (100%) rename boards/renesas/ek_ra6m1/doc/{ra6m1-block-diagram.webp => ra6m1_block_diagram.webp} (100%) rename boards/renesas/ek_ra6m2/doc/{ek-ra6m2-board.webp => ek_ra6m2.webp} (100%) rename boards/renesas/ek_ra6m2/doc/{ra6m2-block-diagram.webp => ra6m2_block_diagram.webp} (100%) rename boards/renesas/ek_ra6m3/doc/{ra6m3-block-diagram.webp => ra6m3_block_diagram.webp} (100%) rename boards/renesas/ek_ra6m4/doc/{ek-ra6m4-board.webp => ek_ra6m4.webp} (100%) rename boards/renesas/ek_ra6m4/doc/{ra6m4-block-diagram.webp => ra6m4_block_diagram.webp} (100%) rename boards/renesas/ek_ra6m5/doc/{ek-ra6m5-board.webp => ek_ra6m5.webp} (100%) rename boards/renesas/ek_ra6m5/doc/{ra6m5-block-diagram.webp => ra6m5_block_diagram.webp} (100%) rename boards/renesas/ek_ra8d1/doc/{ek-ra8d1-board.jpg => ek_ra8d1.jpg} (100%) rename boards/renesas/ek_ra8d1/doc/{ra8d1-block-diagram.png => ra8d1_block_diagram.png} (100%) rename boards/renesas/ek_ra8m1/doc/{ra8m1-block-diagram.jpg => ra8m1_block_diagram.jpg} (100%) rename boards/renesas/fpb_ra6e1/doc/{ra6e1-block-diagram.webp => ra6e1_block_diagram.webp} (100%) rename boards/renesas/fpb_ra6e2/doc/{fpb-ra6e2-board.webp => fpb_ra6e2.webp} (100%) rename boards/renesas/fpb_ra6e2/doc/{ra6e2-block-diagram.webp => ra6e2_block_diagram.webp} (100%) rename boards/renesas/mck_ra8t1/doc/{ra8t1-cpu-board-block-diagram.jpg => mck_ra8t1.jpg} (100%) rename boards/renesas/mck_ra8t1/doc/{mck-ra8t1-product-contents.jpg => mck_ra8t1_product_contents.jpg} (100%) rename boards/renesas/mck_ra8t1/doc/{ra8t1-block-diagram.png => ra8t1_block_diagram.png} (100%) diff --git a/boards/renesas/ek_ra2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